[mshr] 01/03: New upstream version 2016.2.0

Johannes Ring johannr-guest at moszumanska.debian.org
Fri Dec 2 14:32:47 UTC 2016


This is an automated email from the git hooks/post-receive script.

johannr-guest pushed a commit to branch master
in repository mshr.

commit 50ff307c3443b5c69362de9e69e31d54921248a4
Author: Johannes Ring <johannr at simula.no>
Date:   Fri Dec 2 15:18:22 2016 +0100

    New upstream version 2016.2.0
---
 3rdparty/CGAL-4.8/CHANGES                          |  4448 ----
 3rdparty/CGAL-4.8/CMakeLists.txt                   |  1036 -
 3rdparty/CGAL-4.8/VERSION                          |     1 -
 .../CGAL-4.8/auxiliary/cgal_create_cmake_script.1  |    42 -
 .../cmake/modules/CGALConfig_binary.cmake.in       |   167 -
 .../cmake/modules/CGALConfig_install.cmake.in      |   122 -
 .../CGAL-4.8/cmake/modules/CGALLibConfig.cmake.in  |    32 -
 3rdparty/CGAL-4.8/cmake/modules/CGAL_Common.cmake  |    58 -
 .../CGAL_CreateSingleSourceCGALProgram.cmake       |    37 -
 3rdparty/CGAL-4.8/cmake/modules/CGAL_Macros.cmake  |   724 -
 .../CGAL-4.8/cmake/modules/CGAL_SetupBoost.cmake   |    59 -
 3rdparty/CGAL-4.8/cmake/modules/FindEigen3.cmake   |    86 -
 3rdparty/CGAL-4.8/cmake/modules/FindTBB.cmake      |   433 -
 3rdparty/CGAL-4.8/cmake/modules/UseCGAL.cmake      |    60 -
 .../testfiles/CGAL_CFG_BOOST_VARIANT_SWAP_BUG.cpp  |    15 -
 3rdparty/CGAL-4.8/demo/AABB_tree/CMakeLists.txt    |    94 -
 3rdparty/CGAL-4.8/demo/AABB_tree/Scene.cpp         |  1339 -
 .../CGAL-4.8/demo/Alpha_shapes_2/CMakeLists.txt    |    50 -
 .../CGAL-4.8/demo/Alpha_shapes_3/CMakeLists.txt    |    49 -
 .../demo/Apollonius_graph_2/CMakeLists.txt         |    48 -
 .../demo/Arrangement_on_surface_2/CMakeLists.txt   |    83 -
 .../CGAL-4.8/demo/Bounding_volumes/CMakeLists.txt  |    53 -
 .../CGAL-4.8/demo/Circular_kernel_2/CMakeLists.txt |    53 -
 .../CGAL-4.8/demo/Circular_kernel_3/CMakeLists.txt |    36 -
 .../CGAL-4.8/demo/Convex_hull_3/CMakeLists.txt     |    27 -
 3rdparty/CGAL-4.8/demo/Generator/CMakeLists.txt    |    50 -
 3rdparty/CGAL-4.8/demo/Geomview/CMakeLists.txt     |    29 -
 3rdparty/CGAL-4.8/demo/GraphicsView/CMakeLists.txt |    35 -
 .../CGAL-4.8/demo/Interpolation/CMakeLists.txt     |    30 -
 .../demo/L1_Voronoi_diagram_2/CMakeLists.txt       |    52 -
 .../demo/Largest_empty_rect_2/CMakeLists.txt       |    51 -
 .../demo/Linear_cell_complex/CMakeLists.txt        |    78 -
 .../Linear_cell_complex_3_subdivision.cpp          |   202 -
 .../Linear_cell_complex_pqq_subdivision.cpp        |   327 -
 .../demo/Linear_cell_complex/MainWindow.cpp        |  3405 ---
 .../CGAL-4.8/demo/Linear_cell_complex/typedefs.h   |   205 -
 3rdparty/CGAL-4.8/demo/Mesh_2/CMakeLists.txt       |    34 -
 3rdparty/CGAL-4.8/demo/Mesh_3/CMakeLists.txt       |   393 -
 3rdparty/CGAL-4.8/demo/Mesh_3/Mesh_function.h      |   265 -
 .../CMakeLists.txt                                 |   116 -
 .../scene.h                                        |   908 -
 .../window.cpp                                     |   642 -
 .../demo/Periodic_2_triangulation_2/CMakeLists.txt |    61 -
 .../demo/Periodic_3_triangulation_3/CMakeLists.txt |   102 -
 .../CGAL-4.8/demo/Periodic_Lloyd_3/CMakeLists.txt  |    90 -
 3rdparty/CGAL-4.8/demo/Polygon/CMakeLists.txt      |    59 -
 3rdparty/CGAL-4.8/demo/Polyhedron/CMakeLists.txt   |   382 -
 3rdparty/CGAL-4.8/demo/Polyhedron/Color_ramp.cpp   |   127 -
 3rdparty/CGAL-4.8/demo/Polyhedron/Color_ramp.h     |    87 -
 .../CGAL-4.8/demo/Polyhedron/FileLoaderDialog.ui   |   121 -
 .../demo/Polyhedron/GlSplat/CMakeLists.txt         |    35 -
 .../demo/Polyhedron/GlSplat/GlSplat_config.h       |    12 -
 3rdparty/CGAL-4.8/demo/Polyhedron/MainWindow.cpp   |  1871 --
 3rdparty/CGAL-4.8/demo/Polyhedron/MainWindow.h     |   386 -
 3rdparty/CGAL-4.8/demo/Polyhedron/MainWindow.ui    |   691 -
 .../Polyhedron/Plugins/AABB_tree/CMakeLists.txt    |     4 -
 .../Polyhedron/Plugins/AABB_tree/Cut_plugin.cpp    |   495 -
 .../Camera_position/Camera_positions_plugin.cpp    |    52 -
 .../Plugins/Convex_decomposition/Nef_plugin.cpp    |   312 -
 .../Plugins/Convex_hull/Convex_hull_plugin.cpp     |   133 -
 .../Plugins/Convex_hull/Kernel_plugin.cpp          |   137 -
 .../Polyhedron/Plugins/IO/Add_point_set_dialog.ui  |    85 -
 .../Polyhedron/Plugins/IO/Add_polylines_dialog.ui  |    91 -
 .../demo/Polyhedron/Plugins/IO/CMakeLists.txt      |    57 -
 .../demo/Polyhedron/Plugins/IO/Function_dialog.ui  |    97 -
 .../demo/Polyhedron/Plugins/IO/GOCAD_io_plugin.cpp |   109 -
 .../Plugins/IO/Implicit_function_io_plugin.cpp     |   213 -
 .../demo/Polyhedron/Plugins/IO/OFF_io_plugin.cpp   |   141 -
 .../Polyhedron/Plugins/IO/OFF_to_xyz_io_plugin.cpp |    85 -
 .../Polyhedron/Plugins/IO/Polylines_io_plugin.cpp  |   272 -
 .../demo/Polyhedron/Plugins/IO/VTK_io_plugin.cpp   |   396 -
 .../demo/Polyhedron/Plugins/IO/XYZ_io_plugin.cpp   |   223 -
 .../Polyhedron/Plugins/Mesh_2/Mesh_2_plugin.cpp    |   437 -
 .../Polyhedron/Plugins/Mesh_2/mesh_2_dialog.ui     |   231 -
 .../Polyhedron/Plugins/Mesh_3/C3t3_io_plugin.cpp   |   424 -
 .../demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt  |    32 -
 .../Plugins/Mesh_3/Detect_sharp_edges_plugin.cpp   |   124 -
 .../Polyhedron/Plugins/Mesh_3/Image_res_dialog.ui  |   105 -
 .../Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp  |   136 -
 .../Plugins/Mesh_3/Io_implicit_function_plugin.cpp |   213 -
 .../Plugins/Mesh_3/Local_optimizers_dialog.ui      |   225 -
 .../Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp    |   449 -
 .../Plugins/Mesh_3/Mesh_3_plugin_cgal_code.cpp     |   168 -
 .../Plugins/Mesh_3/Mesh_3_plugin_cgal_code.h       |    55 -
 .../demo/Polyhedron/Plugins/Mesh_3/Mesh_function.h |   274 -
 .../Polyhedron/Plugins/Mesh_3/Meshing_dialog.ui    |   440 -
 .../Plugins/Mesh_3/Optimization_plugin.cpp         |   630 -
 .../Mesh_3/Optimization_plugin_cgal_code.cpp       |   770 -
 .../Polyhedron_demo_mesh_3_labeled_mesh_domain_3.h |   266 -
 .../Polyhedron/Plugins/Mesh_3/Smoother_dialog.ui   |   340 -
 .../demo/Polyhedron/Plugins/Mesh_3/Volume_plane.h  |   458 -
 .../Plugins/Mesh_3/Volume_plane_interface.h        |    52 -
 .../Plugins/Mesh_3/Volume_plane_intersection.cpp   |   200 -
 .../Plugins/Mesh_3/Volume_plane_intersection.h     |    78 -
 .../Plugins/Mesh_3/Volume_plane_thread.h           |   128 -
 .../Plugins/Mesh_3/Volume_planes_plugin.cpp        |   390 -
 .../Plugins/Operations_on_polyhedra/CMakeLists.txt |     8 -
 .../Clip_polyhedron_plugin.cpp                     |   232 -
 .../Clip_polyhedron_plugin.ui                      |    90 -
 .../Corefinement_plugin.cpp                        |   181 -
 .../Intersection_plugin.cpp                        |   220 -
 .../Scene_combinatorial_map_item.cpp               |   522 -
 .../Scene_combinatorial_map_item.h                 |   117 -
 .../demo/Polyhedron/Plugins/PCA/CMakeLists.txt     |    11 -
 .../Plugins/PCA/Create_bbox_mesh_plugin.cpp        |   156 -
 .../demo/Polyhedron/Plugins/PCA/Pca_plugin.cpp     |   232 -
 .../PCA/Scene_polyhedron_transform_item.cpp        |   124 -
 .../Plugins/PCA/Scene_polyhedron_transform_item.h  |    61 -
 .../Plugins/PCA/Transform_polyhedron_plugin.cpp    |   143 -
 .../demo/Polyhedron/Plugins/PCA/Trivial_plugin.cpp |   199 -
 .../demo/Polyhedron/Plugins/PMP/CMakeLists.txt     |    77 -
 .../demo/Polyhedron/Plugins/PMP/Fairing_plugin.cpp |   135 -
 .../demo/Polyhedron/Plugins/PMP/Fairing_widget.ui  |   144 -
 .../Polyhedron/Plugins/PMP/Hole_filling_plugin.cpp |   702 -
 .../Plugins/PMP/Hole_filling_polyline_plugin.cpp   |   170 -
 .../Polyhedron/Plugins/PMP/Hole_filling_widget.ui  |   314 -
 .../Polyhedron/Plugins/PMP/Inside_out_plugin.cpp   |    83 -
 .../Plugins/PMP/Isotropic_remeshing_dialog.ui      |   250 -
 .../Plugins/PMP/Isotropic_remeshing_plugin.cpp     |   733 -
 .../Polyhedron/Plugins/PMP/Jet_fitting_plugin.cpp  |   142 -
 .../PMP/Join_and_split_polyhedra_plugin.cpp        |   176 -
 .../PMP/Mean_curvature_flow_skeleton_plugin.cpp    |   920 -
 .../PMP/Mean_curvature_flow_skeleton_plugin.ui     |   174 -
 .../Polyhedron/Plugins/PMP/Orient_soup_plugin.cpp  |   172 -
 .../Plugins/PMP/Point_inside_polyhedron_plugin.cpp |   257 -
 .../Plugins/PMP/Point_inside_polyhedron_widget.ui  |    95 -
 .../Plugins/PMP/Polyhedron_slicer_plugin.cpp       |   348 -
 .../Plugins/PMP/Polyhedron_stitching_plugin.cpp    |   167 -
 .../Plugins/PMP/Repair_polyhedron_plugin.cpp       |   115 -
 .../Polyhedron/Plugins/PMP/Selection_plugin.cpp    |   418 -
 .../Polyhedron/Plugins/PMP/Selection_widget.ui     |   369 -
 .../Plugins/PMP/Self_intersection_plugin.cpp       |   101 -
 .../Plugins/PMP/Triangulate_facets_plugin.cpp      |   144 -
 .../Polyhedron/Plugins/Point_set/CMakeLists.txt    |    61 -
 .../Point_set/Features_detection_plugin.cpp        |   115 -
 .../Plugins/Point_set/Features_detection_plugin.ui |   133 -
 .../Plugins/Point_set/Merge_point_sets_plugin.cpp  |    91 -
 .../Point_set/Point_set_average_spacing_plugin.cpp |   117 -
 .../Point_set_bilateral_smoothing_plugin.cpp       |   128 -
 .../Point_set_bilateral_smoothing_plugin.ui        |   130 -
 .../Point_set_normal_estimation_plugin.cpp         |   288 -
 .../Point_set_normal_estimation_plugin.ui          |   415 -
 .../Point_set_outliers_removal_plugin.cpp          |   116 -
 .../Point_set/Point_set_selection_plugin.cpp       |   509 -
 .../Point_set/Point_set_shape_detection_plugin.cpp |   307 -
 .../Point_set/Point_set_shape_detection_plugin.ui  |   261 -
 .../Point_set/Point_set_simplification_plugin.cpp  |   201 -
 .../Point_set/Point_set_simplification_plugin.ui   |   204 -
 .../Point_set/Point_set_smoothing_plugin.cpp       |    97 -
 .../Point_set/Point_set_upsampling_plugin.cpp      |   146 -
 .../Point_set/Point_set_upsampling_plugin.ui       |   156 -
 .../Plugins/Point_set/Point_set_wlop_plugin.cpp    |   128 -
 .../Plugins/Point_set/Point_set_wlop_plugin.ui     |   122 -
 .../Point_set/Surface_reconstruction_plugin.cpp    |   873 -
 .../Point_set/Surface_reconstruction_plugin.ui     |   483 -
 .../Surface_reconstruction_plugin_impl.cpp         |   245 -
 .../Subdivision_methods_plugin.cpp                 |   125 -
 .../Surface_mesh/Mesh_segmentation_plugin.cpp      |   349 -
 .../Surface_mesh/Mesh_segmentation_widget.ui       |   186 -
 .../Surface_mesh/Mesh_simplification_plugin.cpp    |    97 -
 .../Surface_mesh/Parameterization_plugin.cpp       |   193 -
 .../Plugins/Surface_mesh/Remeshing_dialog.ui       |   174 -
 .../Plugins/Surface_mesh/Remeshing_plugin.cpp      |   142 -
 .../Scene_polyhedron_shortest_path_item.cpp        |   531 -
 .../Scene_polyhedron_shortest_path_item.h          |   159 -
 .../Plugins/Surface_mesh/Shortest_path_plugin.cpp  |   311 -
 .../Plugins/Surface_mesh/Shortest_path_widget.ui   |    71 -
 .../Surface_mesh_deformation/CMakeLists.txt        |     7 -
 .../Surface_mesh_deformation/Deform_mesh.ui        |   423 -
 .../Edit_polyhedron_plugin.cpp                     |   418 -
 .../Scene_edit_polyhedron_item.cpp                 |   973 -
 .../Scene_edit_polyhedron_item.h                   |   777 -
 3rdparty/CGAL-4.8/demo/Polyhedron/Polyhedron_3.cpp |    13 -
 3rdparty/CGAL-4.8/demo/Polyhedron/Polyhedron_3.qrc |    42 -
 .../CGAL-4.8/demo/Polyhedron/Polyhedron_demo.cpp   |   126 -
 .../Polyhedron/Polyhedron_demo_plugin_helper.cpp   |   132 -
 3rdparty/CGAL-4.8/demo/Polyhedron/Preferences.ui   |    78 -
 3rdparty/CGAL-4.8/demo/Polyhedron/Scene.cpp        |  1251 -
 3rdparty/CGAL-4.8/demo/Polyhedron/Scene.h          |   325 -
 .../CGAL-4.8/demo/Polyhedron/Scene_c3t3_item.cpp   |  1280 -
 .../CGAL-4.8/demo/Polyhedron/Scene_c3t3_item.h     |   263 -
 .../Polyhedron/Scene_edit_polyhedron_item_config.h |    10 -
 .../CGAL-4.8/demo/Polyhedron/Scene_group_item.cpp  |   116 -
 .../Polyhedron/Scene_implicit_function_item.cpp    |   593 -
 .../demo/Polyhedron/Scene_implicit_function_item.h |   130 -
 3rdparty/CGAL-4.8/demo/Polyhedron/Scene_item.cpp   |   165 -
 .../demo/Polyhedron/Scene_nef_polyhedron_item.cpp  |   678 -
 .../demo/Polyhedron/Scene_nef_polyhedron_item.h    |   112 -
 .../CGAL-4.8/demo/Polyhedron/Scene_plane_item.cpp  |   130 -
 .../CGAL-4.8/demo/Polyhedron/Scene_plane_item.h    |   182 -
 .../Polyhedron/Scene_points_with_normal_item.cpp   |   598 -
 .../Polyhedron/Scene_points_with_normal_item.h     |   128 -
 .../demo/Polyhedron/Scene_polygon_soup_item.cpp    |   710 -
 .../demo/Polyhedron/Scene_polygon_soup_item.h      |   202 -
 .../demo/Polyhedron/Scene_polyhedron_item.cpp      |  1278 -
 .../demo/Polyhedron/Scene_polyhedron_item.h        |   186 -
 .../Polyhedron/Scene_polyhedron_item_decorator.cpp |   102 -
 .../Polyhedron/Scene_polyhedron_item_decorator.h   |    65 -
 .../Scene_polyhedron_item_k_ring_selection.h       |   236 -
 .../Polyhedron/Scene_polyhedron_selection_item.cpp |   233 -
 .../Polyhedron/Scene_polyhedron_selection_item.h   |   926 -
 .../demo/Polyhedron/Scene_polylines_item.cpp       |   682 -
 .../demo/Polyhedron/Scene_polylines_item.h         |   135 -
 .../demo/Polyhedron/Scene_segmented_image_item.cpp |   862 -
 .../demo/Polyhedron/Scene_segmented_image_item.h   |    89 -
 .../Polyhedron/Scene_segmented_image_item_config.h |    10 -
 .../Polyhedron/Scene_textured_polyhedron_item.cpp  |   365 -
 .../Polyhedron/Scene_textured_polyhedron_item.h    |    88 -
 .../CGAL-4.8/demo/Polyhedron/Show_point_dialog.ui  |   161 -
 3rdparty/CGAL-4.8/demo/Polyhedron/Viewer.cpp       |  1164 -
 3rdparty/CGAL-4.8/demo/Polyhedron/Viewer.h         |   138 -
 .../include/CGAL/Triangulation_file_input.h        |   103 -
 .../CGAL-4.8/demo/Polyhedron/include/Point_set_3.h |   323 -
 .../demo/Polyhedron/resources/shader_c3t3.f        |    41 -
 .../demo/Polyhedron/resources/shader_c3t3.v        |    21 -
 .../demo/Polyhedron/resources/shader_c3t3_edges.f  |     9 -
 .../demo/Polyhedron/resources/shader_c3t3_edges.v  |    19 -
 .../demo/Polyhedron/resources/shader_with_light.f  |    36 -
 .../Polyhedron/resources/shader_without_light.f    |    10 -
 .../CGAL-4.8/demo/Polyhedron_IO/CMakeLists.txt     |    28 -
 .../demo/Polyline_simplification_2/CMakeLists.txt  |    51 -
 .../Principal_component_analysis/CMakeLists.txt    |    87 -
 .../demo/Segment_Delaunay_graph_2/CMakeLists.txt   |    59 -
 .../Segment_Delaunay_graph_Linf_2/CMakeLists.txt   |    59 -
 .../CGAL-4.8/demo/Snap_rounding_2/CMakeLists.txt   |    50 -
 .../demo/Spatial_searching_2/CMakeLists.txt        |    52 -
 .../CGAL-4.8/demo/Stream_lines_2/CMakeLists.txt    |    51 -
 .../demo/Surface_mesh_deformation/CMakeLists.txt   |    34 -
 .../CGAL-4.8/demo/Surface_mesher/CMakeLists.txt    |   128 -
 .../demo/Surface_mesher/Surface_mesher.cpp         |    22 -
 3rdparty/CGAL-4.8/demo/Surface_mesher/volume.cpp   |  1550 --
 3rdparty/CGAL-4.8/demo/Surface_mesher/volume.h     |   384 -
 .../demo/Three/Example_plugin/CMakeLists.txt       |    41 -
 .../Polyhedron_demo_example_plugin.cpp             |   312 -
 .../demo/Three/Example_plugin/dock_example.ui      |   156 -
 .../CGAL-4.8/demo/Triangulation_2/CMakeLists.txt   |   106 -
 .../Constrained_Delaunay_triangulation_2.cpp       |   871 -
 .../CGAL-4.8/demo/Triangulation_3/CMakeLists.txt   |    99 -
 .../Triangulation_3_Geomview_demos/CMakeLists.txt  |    30 -
 .../AABB_polyhedron_facet_intersection_example.cpp |    87 -
 .../CGAL-4.8/examples/AABB_tree/CMakeLists.txt     |    37 -
 .../CMakeLists.txt                                 |    29 -
 .../examples/Algebraic_foundations/CMakeLists.txt  |    30 -
 .../examples/Alpha_shapes_2/CMakeLists.txt         |    27 -
 .../examples/Alpha_shapes_3/CMakeLists.txt         |    31 -
 .../examples/Apollonius_graph_2/CMakeLists.txt     |    29 -
 .../Arrangement_on_surface_2/CMakeLists.txt        |    78 -
 .../examples/BGL_polyhedron_3/CMakeLists.txt       |    73 -
 .../CGAL-4.8/examples/BGL_polyhedron_3/kruskal.cpp |    99 -
 .../BGL_polyhedron_3/kruskal_with_stored_id.cpp    |    89 -
 .../BGL_polyhedron_3/polyhedron_2_OpenMesh.cpp     |    87 -
 .../examples/BGL_surface_mesh/CMakeLists.txt       |    27 -
 .../examples/BGL_triangulation_2/dijkstra.cpp      |   101 -
 .../dijkstra_with_internal_properties.cpp          |    92 -
 .../CGAL-4.8/examples/BGL_triangulation_2/emst.cpp |    95 -
 .../Barycentric_coordinates_2/CMakeLists.txt       |    32 -
 .../Boolean_set_operations_2/CMakeLists.txt        |    36 -
 .../examples/Box_intersection_d/CMakeLists.txt     |    32 -
 .../CGAL-4.8/examples/CGAL_ipelets/CMakeLists.txt  |    26 -
 .../CGAL-4.8/examples/CGALimageIO/test_imageio.cpp |    64 -
 .../examples/Circular_kernel_2/CMakeLists.txt      |    27 -
 .../examples/Circular_kernel_3/CMakeLists.txt      |    28 -
 .../CGAL-4.8/examples/Circulator/CMakeLists.txt    |    28 -
 .../examples/Combinatorial_map/CMakeLists.txt      |    32 -
 .../Combinatorial_map/map_3_dynamic_onmerge.cpp    |   135 -
 .../examples/Combinatorial_map/map_3_foreach.cpp   |   115 -
 .../examples/Combinatorial_map/map_3_marks.cpp     |    58 -
 .../Combinatorial_map/map_3_operations.cpp         |    69 -
 .../Combinatorial_map/map_3_simple_example.cpp     |    45 -
 .../map_3_with_colored_facets.cpp                  |    96 -
 .../Combinatorial_map/map_4_simple_example.cpp     |    48 -
 .../examples/Convex_decomposition_3/CMakeLists.txt |    26 -
 .../CGAL-4.8/examples/Convex_hull_2/CMakeLists.txt |    34 -
 .../CGAL-4.8/examples/Convex_hull_3/CMakeLists.txt |    29 -
 .../CGAL-4.8/examples/Envelope_2/CMakeLists.txt    |    28 -
 .../CGAL-4.8/examples/Envelope_3/CMakeLists.txt    |    28 -
 .../examples/Filtered_kernel/CMakeLists.txt        |    26 -
 .../CGAL-4.8/examples/Generator/CMakeLists.txt     |    41 -
 .../CGAL-4.8/examples/HalfedgeDS/CMakeLists.txt    |    34 -
 .../examples/Inscribed_areas/CMakeLists.txt        |    28 -
 .../CGAL-4.8/examples/Interpolation/CMakeLists.txt |    32 -
 .../examples/Interval_skip_list/CMakeLists.txt     |    27 -
 .../CGAL-4.8/examples/Jet_fitting_3/CMakeLists.txt |    56 -
 .../CGAL-4.8/examples/Kernel_23/CMakeLists.txt     |    33 -
 .../examples/Kernel_23/MyPointC2_iostream.h        |    46 -
 3rdparty/CGAL-4.8/examples/Kernel_23/MySegmentC2.h |   254 -
 .../Kinetic_data_structures/CMakeLists.txt         |    33 -
 .../examples/Kinetic_framework/CMakeLists.txt      |    29 -
 .../examples/Linear_cell_complex/CMakeLists.txt    |    59 -
 ...linear_cell_complex_3_attributes_management.cpp |    72 -
 .../linear_cell_complex_3_viewer_qt.h              |   932 -
 .../Linear_cell_complex/linear_cell_complex_4.cpp  |    72 -
 .../examples/Linear_cell_complex/voronoi_2.cpp     |   174 -
 .../examples/Linear_cell_complex/voronoi_3.cpp     |   173 -
 .../CGAL-4.8/examples/Matrix_search/CMakeLists.txt |    26 -
 .../Matrix_search/sorted_matrix_search.cpp         |    46 -
 3rdparty/CGAL-4.8/examples/Mesh_2/CMakeLists.txt   |    30 -
 3rdparty/CGAL-4.8/examples/Mesh_3/CMakeLists.txt   |   105 -
 .../CGAL-4.8/examples/Mesh_3/mesh_3D_image.cpp     |    59 -
 .../Mesh_3/mesh_3D_image_variable_size.cpp         |    70 -
 .../examples/Mesh_3/mesh_implicit_sphere.cpp       |    58 -
 .../Mesh_3/mesh_implicit_sphere_variable_size.cpp  |    73 -
 .../examples/Mesh_3/mesh_optimization_example.cpp  |    69 -
 .../Mesh_3/mesh_optimization_lloyd_example.cpp     |    69 -
 .../examples/Mesh_3/mesh_polyhedral_domain.cpp     |    76 -
 .../mesh_polyhedral_domain_with_features.cpp       |    53 -
 .../mesh_two_implicit_spheres_with_balls.cpp       |   104 -
 .../examples/Min_annulus_d/min_annulus_d.cpp       |    56 -
 .../Min_annulus_d/min_annulus_d_fast_exact.cpp     |    55 -
 .../examples/Minkowski_sum_2/CMakeLists.txt        |    33 -
 .../examples/Minkowski_sum_3/CMakeLists.txt        |    27 -
 .../examples/Modular_arithmetic/CMakeLists.txt     |    26 -
 3rdparty/CGAL-4.8/examples/Nef_2/CMakeLists.txt    |    28 -
 3rdparty/CGAL-4.8/examples/Nef_3/CMakeLists.txt    |    42 -
 3rdparty/CGAL-4.8/examples/Nef_S2/CMakeLists.txt   |    31 -
 .../CMakeLists.txt                                 |    34 -
 .../otr2_simplest_example.cpp                      |    28 -
 .../CGAL-4.8/examples/Partition_2/CMakeLists.txt   |    29 -
 .../Periodic_2_triangulation_2/CMakeLists.txt      |    36 -
 .../Periodic_3_triangulation_3/CMakeLists.txt      |    32 -
 .../colored_vertices.cpp                           |    40 -
 .../Periodic_3_triangulation_3/find_conflicts.cpp  |    55 -
 .../periodic_adding_handles.cpp                    |    69 -
 .../CGAL-4.8/examples/Point_set_2/CMakeLists.txt   |    27 -
 .../examples/Point_set_processing_3/CMakeLists.txt |    81 -
 .../grid_simplify_indices.cpp                      |    57 -
 .../Point_set_shape_detection_3/CMakeLists.txt     |    36 -
 .../efficient_RANSAC_parameters.cpp                |   108 -
 3rdparty/CGAL-4.8/examples/Polygon/CMakeLists.txt  |    29 -
 .../CGAL-4.8/examples/Polyhedron/CMakeLists.txt    |    41 -
 .../CGAL-4.8/examples/Polyhedron_IO/CMakeLists.txt |    37 -
 .../Polyline_simplification_2/CMakeLists.txt       |    29 -
 .../CGAL-4.8/examples/Polynomial/CMakeLists.txt    |    32 -
 .../examples/Polytope_distance_d/CMakeLists.txt    |    29 -
 .../Polytope_distance_d/polytope_distance_d.cpp    |    62 -
 .../polytope_distance_d_fast_exact.cpp             |    64 -
 .../Principal_component_analysis/CMakeLists.txt    |    30 -
 .../examples/Profiling_tools/CMakeLists.txt        |    28 -
 .../CGAL-4.8/examples/QP_solver/CMakeLists.txt     |    51 -
 .../CGAL-4.8/examples/STL_Extension/CMakeLists.txt |    31 -
 .../Scale_space_reconstruction_3/CMakeLists.txt    |    40 -
 .../Segment_Delaunay_graph_2/CMakeLists.txt        |    32 -
 .../Segment_Delaunay_graph_Linf_2/CMakeLists.txt   |    35 -
 .../examples/Snap_rounding_2/CMakeLists.txt        |    28 -
 .../examples/Solver_interface/CMakeLists.txt       |    35 -
 .../searching_with_point_with_info_inplace.cpp     |    78 -
 .../searching_with_point_with_info_pmap.cpp        |    60 -
 .../examples/Spatial_sorting/CMakeLists.txt        |    36 -
 .../sp_sort_using_property_map_3.cpp               |    38 -
 .../examples/Straight_skeleton_2/CMakeLists.txt    |    34 -
 .../examples/Stream_lines_2/CMakeLists.txt         |    27 -
 .../examples/Subdivision_method_3/CMakeLists.txt   |    29 -
 .../CGAL-4.8/examples/Surface_mesh/CMakeLists.txt  |    35 -
 .../examples/Surface_mesh/sm_properties.cpp        |    62 -
 .../Surface_mesh_deformation/CMakeLists.txt        |    48 -
 .../Surface_mesh_parameterization/CMakeLists.txt   |    75 -
 .../Surface_mesh_shortest_path/CMakeLists.txt      |    38 -
 .../Surface_mesh_skeletonization/CMakeLists.txt    |    41 -
 3rdparty/CGAL-4.8/examples/TDS_3/CMakeLists.txt    |    27 -
 .../CGAL-4.8/examples/Triangulation/CMakeLists.txt |    38 -
 .../examples/Triangulation_2/CMakeLists.txt        |    43 -
 .../examples/Triangulation_2/constrained.cpp       |    35 -
 .../examples/Triangulation_2/constrained_plus.cpp  |    37 -
 .../Triangulation_2/polylines_triangulation.cpp    |    89 -
 .../examples/Triangulation_3/CMakeLists.txt        |    48 -
 .../CGAL-4.8/examples/Visibility_2/CMakeLists.txt  |    27 -
 .../examples/Voronoi_diagram_2/CMakeLists.txt      |    27 -
 .../CGAL/AABB_face_graph_triangle_primitive.h      |   178 -
 3rdparty/CGAL-4.8/include/CGAL/AABB_traits.h       |   420 -
 3rdparty/CGAL-4.8/include/CGAL/AABB_tree.h         |  1239 -
 .../Algebraic_kernel_d/Algebraic_curve_kernel_2.h  |  2886 ---
 .../Bitstream_descartes_E08_tree.h                 |  1054 -
 .../Bitstream_descartes_rndl_tree.h                |  1572 --
 .../Apollonius_graph_uncertain_filtered_traits_2.h |   509 -
 .../CGAL-4.8/include/CGAL/Arr_face_index_map.h     |   281 -
 .../include/CGAL/Arr_polycurve_basic_traits_2.h    |  2713 --
 .../CGAL-4.8/include/CGAL/Arr_polyline_traits_2.h  |   600 -
 .../Arr_spherical_gaussian_map_3.h                 |   408 -
 .../CGAL-4.8/include/CGAL/Arr_vertex_index_map.h   |   285 -
 .../CGAL-4.8/include/CGAL/CORE/BigFloat_impl.h     |  1327 -
 3rdparty/CGAL-4.8/include/CGAL/CORE/CoreAux.h      |   189 -
 3rdparty/CGAL-4.8/include/CGAL/CORE/CoreAux_impl.h |   229 -
 3rdparty/CGAL-4.8/include/CGAL/CORE/Expr_impl.h    |  1255 -
 3rdparty/CGAL-4.8/include/CGAL/CORE/Impl.h         |    74 -
 3rdparty/CGAL-4.8/include/CGAL/CORE/MemoryPool.h   |   138 -
 3rdparty/CGAL-4.8/include/CGAL/CORE/Real_impl.h    |   292 -
 3rdparty/CGAL-4.8/include/CGAL/CORE_BigFloat.h     |   550 -
 3rdparty/CGAL-4.8/include/CGAL/CORE_BigInt.h       |   226 -
 3rdparty/CGAL-4.8/include/CGAL/CORE_BigRat.h       |   260 -
 3rdparty/CGAL-4.8/include/CGAL/CORE_Expr.h         |   215 -
 .../CGAL-4.8/include/CGAL/Cartesian/Vector_2.h     |   153 -
 .../include/CGAL/Cartesian/function_objects.h      |  4064 ---
 3rdparty/CGAL-4.8/include/CGAL/Combinatorial_map.h |  3814 ---
 .../include/CGAL/Combinatorial_map_constructors.h  |   298 -
 .../include/CGAL/Combinatorial_map_insertions.h    |   729 -
 .../CGAL/Combinatorial_map_iterators_base.h        |   616 -
 .../include/CGAL/Combinatorial_map_operations.h    |   809 -
 .../include/CGAL/Combinatorial_map_storages.h      |   419 -
 3rdparty/CGAL-4.8/include/CGAL/Compact_container.h |  1207 -
 .../include/CGAL/Compact_mesh_cell_base_3.h        |   713 -
 .../CGAL/Constrained_Delaunay_triangulation_2.h    |   982 -
 .../include/CGAL/Constrained_triangulation_2.h     |  1433 --
 .../CGAL/Constrained_triangulation_plus_2.h        |  1233 -
 .../Non_x_monotone_arc_2.h                         |   314 -
 3rdparty/CGAL-4.8/include/CGAL/Dart.h              |   343 -
 .../CGAL-4.8/include/CGAL/Delaunay_triangulation.h |   895 -
 .../include/CGAL/Delaunay_triangulation_2.h        |  2485 --
 .../include/CGAL/Delaunay_triangulation_3.h        |  2081 --
 .../CGAL-4.8/include/CGAL/Diagonalize_traits.h     |   271 -
 .../include/CGAL/Envelope_3/set_dividors.h         |   120 -
 .../CGAL-4.8/include/CGAL/Euclidean_distance.h     |   205 -
 .../include/CGAL/Euclidean_distance_sphere_point.h |   167 -
 .../include/CGAL/Exact_circular_kernel_2.h         |    79 -
 3rdparty/CGAL-4.8/include/CGAL/FPU.h               |   539 -
 .../include/CGAL/FaceGraph_to_Polyhedron_3.h       |    92 -
 .../include/CGAL/Filtered_extended_homogeneous.h   |  1287 -
 3rdparty/CGAL-4.8/include/CGAL/GMP/Gmpfr_type.h    |  1341 -
 3rdparty/CGAL-4.8/include/CGAL/GMP/Gmpz_type.h     |   438 -
 3rdparty/CGAL-4.8/include/CGAL/GMP/Gmpzf_type.h    |   591 -
 3rdparty/CGAL-4.8/include/CGAL/General_polygon_2.h |   221 -
 .../include/CGAL/General_polygon_with_holes_2.h    |   200 -
 3rdparty/CGAL-4.8/include/CGAL/Gmpfi.h             |   368 -
 3rdparty/CGAL-4.8/include/CGAL/Gmpfr.h             |   186 -
 3rdparty/CGAL-4.8/include/CGAL/Gmpq.h              |   166 -
 3rdparty/CGAL-4.8/include/CGAL/Gmpz.h              |   241 -
 3rdparty/CGAL-4.8/include/CGAL/Gmpzf.h             |   185 -
 .../include/CGAL/Gray_image_mesh_domain_3.h        |   132 -
 .../CGAL-4.8/include/CGAL/Handle_with_policy.h     |  1405 --
 3rdparty/CGAL-4.8/include/CGAL/IO/Color.h          |   104 -
 .../CGAL-4.8/include/CGAL/IO/File_binary_mesh_3.h  |    74 -
 .../include/CGAL/IO/File_header_OFF_impl.h         |   409 -
 3rdparty/CGAL-4.8/include/CGAL/IO/File_medit.h     |   907 -
 .../CGAL-4.8/include/CGAL/IO/File_scanner_OFF.h    |   470 -
 .../include/CGAL/IO/Geomview_stream_impl.h         |   612 -
 .../include/CGAL/IO/Nef_polyhedron_2_PS_stream.h   |   122 -
 .../CGAL/IO/Nef_polyhedron_S2_OGLUT_stream.h       |    61 -
 .../include/CGAL/IO/Nef_polyhedron_iostream_S2.h   |    57 -
 3rdparty/CGAL-4.8/include/CGAL/IO/OFF_reader.h     |   100 -
 .../CGAL-4.8/include/CGAL/IO/Polyhedron_scan_OFF.h |   144 -
 3rdparty/CGAL-4.8/include/CGAL/IO/STL_reader.h     |   148 -
 3rdparty/CGAL-4.8/include/CGAL/IO/io.h             |   535 -
 .../CGAL-4.8/include/CGAL/IO/read_off_points.h     |   436 -
 .../CGAL-4.8/include/CGAL/IO/read_ply_points.h     |   615 -
 .../CGAL-4.8/include/CGAL/IO/read_xyz_points.h     |   428 -
 .../CGAL-4.8/include/CGAL/IO/write_off_points.h    |   259 -
 .../CGAL-4.8/include/CGAL/IO/write_ply_points.h    |   260 -
 .../CGAL-4.8/include/CGAL/IO/write_xyz_points.h    |   250 -
 3rdparty/CGAL-4.8/include/CGAL/ImageIO.h           |   707 -
 3rdparty/CGAL-4.8/include/CGAL/ImageIO_impl.h      |  1633 --
 3rdparty/CGAL-4.8/include/CGAL/Image_3.h           |   515 -
 3rdparty/CGAL-4.8/include/CGAL/Image_3_impl.h      |   232 -
 .../CGAL-4.8/include/CGAL/Implicit_mesh_domain_3.h |    93 -
 3rdparty/CGAL-4.8/include/CGAL/In_place_list.h     |   812 -
 .../CGAL-4.8/include/CGAL/Index_property_map.h     |   168 -
 .../include/CGAL/Interval_arithmetic_impl.h        |    72 -
 3rdparty/CGAL-4.8/include/CGAL/Interval_nt.h       |  1288 -
 3rdparty/CGAL-4.8/include/CGAL/Iterator_range.h    |   115 -
 3rdparty/CGAL-4.8/include/CGAL/Kd_tree.h           |   464 -
 3rdparty/CGAL-4.8/include/CGAL/Kd_tree_node.h      |   551 -
 .../include/CGAL/Kernel/global_functions_2.h       |  1026 -
 .../include/CGAL/Kernel/global_functions_3.h       |  1126 -
 .../include/CGAL/Kernel/interface_macros.h         |   563 -
 .../CGAL-4.8/include/CGAL/Kernel_d/Iso_box_d.h     |   410 -
 .../CGAL-4.8/include/CGAL/Kernel_d/PVDHACd_impl.h  |    36 -
 .../CGAL-4.8/include/CGAL/Kernel_d/PVDHAHd_impl.h  |    36 -
 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Point_d.h  |    99 -
 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Cartesian.h |    49 -
 .../CGAL/Kinetic/Default_instantaneous_kernel.h    |   388 -
 .../Regular_triangulation_instantaneous_kernel.h   |    81 -
 .../include/CGAL/Kinetic/Triangulation_2.h         |   759 -
 .../internal/Delaunay_triangulation_base_3.h       |  1395 --
 .../Kernel/Cartesian_kinetic_kernel_base.h         |   259 -
 .../Kernel/Cartesian_moving_lifted_point_3.h       |   136 -
 .../internal/Kernel/cartesian_predicates_3.h       |   815 -
 3rdparty/CGAL-4.8/include/CGAL/LEDA_basic.h        |    52 -
 .../include/CGAL/Labeled_image_mesh_domain_3.h     |   108 -
 .../CGAL-4.8/include/CGAL/Labeled_mesh_domain_3.h  |   650 -
 3rdparty/CGAL-4.8/include/CGAL/Lazy_exact_nt.h     |  1447 --
 .../CGAL-4.8/include/CGAL/Linear_cell_complex.h    |   936 -
 .../include/CGAL/Linear_cell_complex_storages.h    |   450 -
 3rdparty/CGAL-4.8/include/CGAL/MP_Float.h          |   912 -
 3rdparty/CGAL-4.8/include/CGAL/MP_Float_impl.h     |   512 -
 .../CGAL/Manhattan_distance_iso_box_point.h        |   173 -
 .../CGAL/Mean_curvature_flow_skeletonization.h     |  1438 --
 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Dump_c3t3.h  |   103 -
 .../Mesh_3/Image_to_labeled_function_wrapper.h     |   142 -
 .../Mesh_3/Implicit_to_labeled_function_wrapper.h  |   155 -
 .../Mesh_complex_3_in_triangulation_3_base.h       |   949 -
 .../include/CGAL/Mesh_3/Mesh_global_optimizer.h    |  1158 -
 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Mesher_3.h   |   714 -
 .../CGAL-4.8/include/CGAL/Mesh_3/Refine_facets_3.h |  1965 --
 .../CGAL-4.8/include/CGAL/Mesh_3/io_signature.h    |   275 -
 .../CGAL/Mesh_3/mesh_standard_facet_criteria.h     |   710 -
 .../include/CGAL/Mesh_3/polylines_to_protect.h     |   359 -
 .../Mesh_3/squared_distance_Point_3_Triangle_3.h   |   135 -
 .../CGAL/Mesh_complex_3_in_triangulation_3.h       |   755 -
 3rdparty/CGAL-4.8/include/CGAL/Mesh_criteria_3.h   |   193 -
 .../CGAL/Mesh_domain_with_polyline_features_3.h    |  1088 -
 .../CGAL-4.8/include/CGAL/Mesh_facet_criteria_3.h  |   182 -
 .../CGAL-4.8/include/CGAL/Mesh_triangulation_3.h   |   117 -
 .../CGAL-4.8/include/CGAL/Mesh_vertex_base_3.h     |   310 -
 3rdparty/CGAL-4.8/include/CGAL/Min_annulus_d.h     |   874 -
 .../CGAL/Minkowski_sum_2/Minkowski_sum_decomp_2.h  |   421 -
 .../include/CGAL/Modifiable_priority_queue.h       |   133 -
 .../CGAL-4.8/include/CGAL/Monge_via_jet_fitting.h  |   784 -
 3rdparty/CGAL-4.8/include/CGAL/Mpzf.h              |  1161 -
 3rdparty/CGAL-4.8/include/CGAL/Multiscale_sort.h   |    58 -
 .../CGAL-4.8/include/CGAL/Nef_2/PM_io_parser.h     |   403 -
 .../include/CGAL/Nef_2/gen_point_location.h        |   610 -
 .../include/CGAL/Nef_3/SNC_point_locator.h         |  1389 -
 3rdparty/CGAL-4.8/include/CGAL/Nef_S2/SM_checker.h |   257 -
 .../CGAL-4.8/include/CGAL/Nef_S2/leda_sphere_map.h |   273 -
 3rdparty/CGAL-4.8/include/CGAL/Nef_polyhedron_2.h  |  1137 -
 3rdparty/CGAL-4.8/include/CGAL/Nef_polyhedron_3.h  |  2130 --
 3rdparty/CGAL-4.8/include/CGAL/Nef_polyhedron_S2.h |   735 -
 3rdparty/CGAL-4.8/include/CGAL/Nef_polynomial.h    |   292 -
 .../include/CGAL/NewKernel_d/Cartesian_LA_base.h   |   177 -
 .../include/CGAL/NewKernel_d/LA_eigen/LA.h         |   170 -
 .../CGAL/NewKernel_d/function_objects_cartesian.h  |  1298 -
 3rdparty/CGAL-4.8/include/CGAL/OTR_2/Cost.h        |   110 -
 .../include/CGAL/OTR_2/Reconstruction_edge_2.h     |   144 -
 .../CGAL/OTR_2/Reconstruction_face_base_2.h        |   266 -
 .../CGAL/OTR_2/Reconstruction_triangulation_2.h    |  1079 -
 .../CGAL/OTR_2/Reconstruction_vertex_base_2.h      |   134 -
 .../CGAL/Optimal_transportation_reconstruction_2.h |  1673 --
 .../CGAL/Orthogonal_incremental_neighbor_search.h  |   621 -
 .../include/CGAL/Orthogonal_k_neighbor_search.h    |   189 -
 .../CGAL/Periodic_2_Delaunay_triangulation_2.h     |  5376 ----
 .../CGAL/Periodic_3_Delaunay_triangulation_3.h     |  1241 -
 ...ic_3_Delaunay_triangulation_filtered_traits_3.h |   161 -
 ...ay_triangulation_statically_filtered_traits_3.h |    62 -
 .../Periodic_3_Delaunay_triangulation_traits_3.h   |   150 -
 .../include/CGAL/Periodic_3_triangulation_3.h      |  4141 ---
 .../Periodic_3_triangulation_filtered_traits_3.h   |   203 -
 .../CGAL/Periodic_3_triangulation_traits_3.h       |   173 -
 .../CGAL-4.8/include/CGAL/Point_with_normal_3.h    |   225 -
 .../include/CGAL/Poisson_reconstruction_function.h |  1212 -
 3rdparty/CGAL-4.8/include/CGAL/Polychain_2.h       |   859 -
 .../CGAL-4.8/include/CGAL/Polygon_2_algorithms.h   |   466 -
 .../include/CGAL/Polygon_mesh_processing/Weights.h |   766 -
 .../include/CGAL/Polygon_mesh_processing/border.h  |   199 -
 .../CGAL/Polygon_mesh_processing/compute_normal.h  |   371 -
 .../include/CGAL/Polygon_mesh_processing/fair.h    |   165 -
 .../Hole_filling/Triangulate_hole_polyline.h       |  1236 -
 .../AABB_filtered_projection_traits.h              |   134 -
 .../internal/Isotropic_remeshing/remesh_impl.h     |  1613 --
 .../Polygon_mesh_processing/internal/fair_impl.h   |   203 -
 .../internal/named_function_params.h               |   386 -
 .../internal/named_params_helper.h                 |   140 -
 .../Polygon_mesh_processing/internal/refine_impl.h |   335 -
 .../include/CGAL/Polygon_mesh_processing/measure.h |   418 -
 .../Polygon_mesh_processing/orient_polygon_soup.h  |   426 -
 .../polygon_soup_to_polygon_mesh.h                 |   162 -
 .../include/CGAL/Polygon_mesh_processing/remesh.h  |   278 -
 .../Polygon_mesh_processing/triangulate_faces.h    |   381 -
 .../Polygon_mesh_processing/triangulate_hole.h     |   406 -
 .../CGAL-4.8/include/CGAL/Polygon_with_holes_2.h   |   227 -
 .../include/CGAL/Polyhedral_mesh_domain_3.h        |   804 -
 .../CGAL/Polyhedral_mesh_domain_with_features_3.h  |   245 -
 .../include/CGAL/Polyline_constraint_hierarchy_2.h |  1174 -
 .../CGAL/Polyline_simplification_2/simplify.h      |   472 -
 3rdparty/CGAL-4.8/include/CGAL/Polynomial.h        |    79 -
 3rdparty/CGAL-4.8/include/CGAL/Polynomial/basic.h  |   211 -
 .../include/CGAL/Polynomial/bezout_matrix.h        |   619 -
 .../CGAL/Polynomial/internal/Filtered_kernel.h     |   111 -
 .../Filtered_kernel/Filtered_Descartes_has_root.h  |    56 -
 .../Filtered_Descartes_root_counter.h              |   158 -
 .../Filtered_polynomial_rational_kernel.h          |   226 -
 .../Filtered_Descartes_has_root.h                  |    56 -
 .../Filtered_rational/Filtered_standard_sequence.h |   151 -
 .../CGAL/Polynomial/internal/Kernel/Sign_above.h   |    92 -
 .../internal/Rational/Descartes_has_root.h         |    70 -
 .../internal/Rational/Standard_sequence.h          |    96 -
 .../CGAL/Polynomial/internal/Sturm_root_rep.h      |  1049 -
 .../internal/Turkowski_numeric_solvers_impl.h      |   467 -
 .../include/CGAL/Polynomial/internal/macros.h      |    72 -
 .../CGAL-4.8/include/CGAL/Polytope_distance_d.h    |   933 -
 .../include/CGAL/Qt/DemosMainWindow_impl.h         |   474 -
 .../include/CGAL/Qt/GraphicsViewNavigation_impl.h  |   351 -
 3rdparty/CGAL-4.8/include/CGAL/Quotient.h          |   878 -
 3rdparty/CGAL-4.8/include/CGAL/Random.h            |   254 -
 3rdparty/CGAL-4.8/include/CGAL/Random_impl.h       |    94 -
 .../include/CGAL/Reconstruction_triangulation_3.h  |   514 -
 3rdparty/CGAL-4.8/include/CGAL/Regular_complex_d.h |   736 -
 .../include/CGAL/Regular_triangulation_2.h         |  2237 --
 .../include/CGAL/Regular_triangulation_3.h         |  2326 --
 .../CGAL-4.8/include/CGAL/Search_traits_adapter.h  |   180 -
 3rdparty/CGAL-4.8/include/CGAL/Search_traits_d.h   |    50 -
 .../include/CGAL/Segment_Delaunay_graph_2.h        |  2043 --
 .../CGAL/Shape_detection_3/Efficient_RANSAC.h      |   912 -
 .../include/CGAL/Shape_detection_3/Octree.h        |   727 -
 .../include/CGAL/Shape_detection_3/Plane.h         |   211 -
 .../include/CGAL/Shape_detection_3/Shape_base.h    |   702 -
 .../include/CGAL/Spatial_sort_traits_adapter_2.h   |    77 -
 .../include/CGAL/Spatial_sort_traits_adapter_3.h   |    87 -
 .../include/CGAL/Spatial_sort_traits_adapter_d.h   |    92 -
 .../include/CGAL/Sqrt_extension/Eigen_NumTraits.h  |    48 -
 .../include/CGAL/Straight_skeleton_converter_2.h   |   302 -
 .../include/CGAL/Surface_mesh/Properties.h         |   481 -
 .../include/CGAL/Surface_mesh/Surface_mesh.h       |  3037 ---
 .../include/CGAL/Surface_mesh_deformation.h        |  1537 --
 .../Surface_mesh_shortest_path.h                   |  2786 ---
 .../Surface_mesh_shortest_path_traits.h            |   205 -
 .../Three/Polyhedron_demo_io_plugin_interface.h    |    63 -
 .../CGAL/Three/Polyhedron_demo_plugin_helper.h     |    96 -
 .../CGAL/Three/Polyhedron_demo_plugin_interface.h  |    70 -
 .../include/CGAL/Three/Scene_draw_interface.h      |    45 -
 .../CGAL-4.8/include/CGAL/Three/Scene_group_item.h |   141 -
 .../CGAL-4.8/include/CGAL/Three/Scene_interface.h  |   191 -
 3rdparty/CGAL-4.8/include/CGAL/Three/Scene_item.h  |   459 -
 .../CGAL-4.8/include/CGAL/Three/Viewer_interface.h |   162 -
 3rdparty/CGAL-4.8/include/CGAL/Time_stamper.h      |    90 -
 .../CGAL/Triangulation_2/insert_constraints.h      |   114 -
 .../Triangulation_2_filtered_projection_traits_3.h |    85 -
 .../CGAL/Triangulation_2_projection_traits_3.h     |   487 -
 3rdparty/CGAL-4.8/include/CGAL/Triangulation_3.h   |  6687 -----
 .../include/CGAL/Triangulation_data_structure_3.h  |  3971 ---
 .../CGAL/Triangulation_euclidean_traits_2.h        |   133 -
 .../CGAL/Triangulation_euclidean_traits_xy_3.h     |    39 -
 .../CGAL/Triangulation_euclidean_traits_xz_3.h     |    38 -
 .../CGAL/Triangulation_euclidean_traits_yz_3.h     |    39 -
 .../include/CGAL/Triangulation_hierarchy_3.h       |   842 -
 .../CGAL/Triangulation_line_face_circulator_2.h    |   701 -
 .../include/CGAL/Weighted_Minkowski_distance.h     |   415 -
 3rdparty/CGAL-4.8/include/CGAL/assertions.h        |   353 -
 .../include/CGAL/bilateral_smooth_point_set.h      |   652 -
 3rdparty/CGAL-4.8/include/CGAL/boost/graph/Dual.h  |   329 -
 .../CGAL/boost/graph/convert_surface_mesh.h        |    86 -
 .../graph/graph_traits_Delaunay_triangulation_2.h  |   395 -
 .../CGAL/boost/graph/graph_traits_HalfedgeDS.h     |   252 -
 .../graph/graph_traits_PolyMesh_ArrayKernelT.h     |   697 -
 .../graph/graph_traits_TriMesh_ArrayKernelT.h      |   614 -
 .../boost/graph/graph_traits_Triangulation_2.h     |   873 -
 .../CGAL/boost/graph/properties_CombinatorialMap.h |   276 -
 .../CGAL/boost/graph/properties_Polyhedron_3.h     |   445 -
 .../CGAL/boost/graph/properties_Surface_mesh.h     |   279 -
 .../include/CGAL/compute_average_spacing.h         |   274 -
 3rdparty/CGAL-4.8/include/CGAL/config.h            |   519 -
 .../include/CGAL/corefinement_operations.h         |   477 -
 .../include/CGAL/edge_aware_upsample_point_set.h   |   659 -
 .../CGAL/extract_mean_curvature_flow_skeleton.h    |    67 -
 .../include/CGAL/grid_simplify_point_set.h         |   235 -
 .../include/CGAL/hierarchy_simplify_point_set.h    |   385 -
 3rdparty/CGAL-4.8/include/CGAL/int.h               |   292 -
 .../include/CGAL/internal/AABB_tree/AABB_node.h    |   199 -
 .../Halfedge_and_face_graph_property_maps.h        |   203 -
 .../internal/Combinatorial_map_group_functors.h    |   972 -
 .../CGAL/internal/Mesh_3/Graph_manipulations.h     |    98 -
 .../include/CGAL/internal/Mesh_3/get_index.h       |   170 -
 .../CGAL/internal/Mesh_3/split_in_polylines.h      |   219 -
 .../CGAL/internal/Polyhedron_plane_clipping_3.h    |   391 -
 .../Static_filters/Periodic_3_orientation_3.h      |   267 -
 .../Periodic_3_side_of_oriented_sphere_3.h         |   299 -
 .../CGAL/internal/Static_filters/Static_filters.h  |   302 -
 .../include/CGAL/internal/Static_filters/tools.h   |   193 -
 .../AABB_traversal_traits.h                        |    76 -
 .../Surface_mesh_segmentation/SDF_calculation.h    |   519 -
 .../Surface_mesh_segmentation.h                    |   545 -
 .../Surface_mesh_skeletonization/get_normal.h      |    82 -
 .../Voronoi_covariance_3/voronoi_covariance_3.h    |   229 -
 .../include/CGAL/internal/boost/mutable_queue.hpp  |   153 -
 .../include/CGAL/internal/boost/property_map.h     |    33 -
 .../Combinatorial_map_for_corefinement.h           |   115 -
 .../include/CGAL/intersection_of_Polyhedra_3.h     |  2108 --
 ...ntersection_of_Polyhedra_3_refinement_visitor.h |  2260 --
 3rdparty/CGAL-4.8/include/CGAL/ipower.h            |    83 -
 .../CGAL-4.8/include/CGAL/jet_estimate_normals.h   |   362 -
 .../CGAL-4.8/include/CGAL/jet_smooth_point_set.h   |   345 -
 3rdparty/CGAL-4.8/include/CGAL/kernel_to_kernel.h  |   115 -
 3rdparty/CGAL-4.8/include/CGAL/leda_bigfloat.h     |   161 -
 .../CGAL-4.8/include/CGAL/leda_bigfloat_interval.h |   492 -
 .../CGAL-4.8/include/CGAL/leda_coercion_traits.h   |   135 -
 3rdparty/CGAL-4.8/include/CGAL/leda_integer.h      |   282 -
 3rdparty/CGAL-4.8/include/CGAL/leda_rational.h     |   308 -
 3rdparty/CGAL-4.8/include/CGAL/leda_real.h         |   259 -
 3rdparty/CGAL-4.8/include/CGAL/make_mesh_3.h       |   452 -
 3rdparty/CGAL-4.8/include/CGAL/mesh_segmentation.h |   491 -
 3rdparty/CGAL-4.8/include/CGAL/minkowski_sum_2.h   |   478 -
 .../CGAL-4.8/include/CGAL/mst_orient_normals.h     |   716 -
 3rdparty/CGAL-4.8/include/CGAL/number_utils.h      |   318 -
 .../CGAL-4.8/include/CGAL/pca_estimate_normals.h   |   317 -
 .../CGAL-4.8/include/CGAL/point_generators_2.h     |   547 -
 .../CGAL-4.8/include/CGAL/point_generators_3.h     |   309 -
 3rdparty/CGAL-4.8/include/CGAL/primes.h            |    70 -
 3rdparty/CGAL-4.8/include/CGAL/primes_impl.h       |   293 -
 3rdparty/CGAL-4.8/include/CGAL/property_map.h      |   396 -
 .../CGAL-4.8/include/CGAL/radial_orient_normals.h  |   197 -
 .../include/CGAL/random_simplify_point_set.h       |   123 -
 3rdparty/CGAL-4.8/include/CGAL/refine_mesh_3.h     |   502 -
 3rdparty/CGAL-4.8/include/CGAL/remove_outliers.h   |   257 -
 .../CGAL-4.8/include/CGAL/squared_distance_3_1.h   |   928 -
 .../CGAL-4.8/include/CGAL/squared_distance_3_2.h   |   302 -
 3rdparty/CGAL-4.8/include/CGAL/sse2.h              |    36 -
 .../include/CGAL/test_FPU_rounding_mode_impl.h     |    70 -
 3rdparty/CGAL-4.8/include/CGAL/utility.h           |   351 -
 3rdparty/CGAL-4.8/include/CGAL/value_type_traits.h |    65 -
 3rdparty/CGAL-4.8/include/CGAL/version.h           |    35 -
 .../CGAL/wlop_simplify_and_regularize_point_set.h  |   715 -
 3rdparty/CGAL-4.8/scripts/cgal_create_CMakeLists   |   639 -
 3rdparty/CGAL-4.8/src/CGAL/CMakeLists.txt          |    15 -
 3rdparty/CGAL-4.8/src/CGAL/Random.cpp              |    36 -
 3rdparty/CGAL-4.8/src/CGAL/primes.cpp              |    25 -
 3rdparty/CGAL-4.8/src/CGAL_Core/CMakeLists.txt     |    20 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/CMakeLists.txt  |    54 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/analyze.cpp     |    27 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/analyze.h       |    74 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/analyze_impl.h  |   852 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmp.cpp         |    27 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmp.h           |    65 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmp_impl.h      |   518 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmpendian.cpp   |    27 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmpendian.h     |    80 -
 .../CGAL-4.8/src/CGAL_ImageIO/bmpendian_impl.h     |   257 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmpread.cpp     |    27 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmpread.h       |    87 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmpread_impl.h  |  1237 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmptypes.h      |   222 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/convert.cpp     |    27 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/convert.h       |   108 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/convert_impl.h  |   490 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/fgetns.cpp      |    27 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/fgetns.h        |    35 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/fgetns_impl.h   |    45 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/gif.cpp         |    27 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/gif.h           |    38 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/gif_impl.h      |   700 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/gis.cpp         |    27 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/gis.h           |   141 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/gis_impl.h      |   730 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/inr.cpp         |    27 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/inr.h           |    65 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/inr_impl.h      |   517 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/iris.cpp        |    27 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/iris.h          |    37 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/iris_impl.h     |   499 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/mincio.cpp      |    27 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/mincio.h        |    77 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/pnm.cpp         |    27 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/pnm.h           |    46 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/pnm_impl.h      |   643 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/recbuffer.cpp   |    27 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/recbuffer.h     |   203 -
 .../CGAL-4.8/src/CGAL_ImageIO/recbuffer_impl.h     |  1743 --
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/recline.cpp     |    27 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/recline.h       |   235 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/reech4x4.cpp    |    27 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/reech4x4.h      |   288 -
 3rdparty/CGAL-4.8/src/CGAL_ImageIO/reech4x4_impl.h |  3176 ---
 3rdparty/CGAL-4.8/src/CGAL_Qt5/CMakeLists.txt      |    94 -
 .../CGAL-4.8/src/CGAL_Qt5/GraphicsView.qtmoc.cmake |     9 -
 3rdparty/CGAL-4.8/src/CMakeLists.txt               |   195 -
 3rdparty/{CGAL-4.8 => CGAL}/AUTHORS                |     0
 3rdparty/CGAL/CHANGES                              |  4557 ++++
 3rdparty/CGAL/CMakeLists.txt                       |  1079 +
 3rdparty/{CGAL-4.8 => CGAL}/INSTALL.md             |     0
 3rdparty/{CGAL-4.8 => CGAL}/LICENSE                |     0
 3rdparty/{CGAL-4.8 => CGAL}/LICENSE.BSL            |     0
 3rdparty/{CGAL-4.8 => CGAL}/LICENSE.FREE_USE       |     0
 3rdparty/{CGAL-4.8 => CGAL}/LICENSE.GPL            |     0
 3rdparty/{CGAL-4.8 => CGAL}/LICENSE.LGPL           |     0
 3rdparty/{CGAL-4.8 => CGAL}/README                 |     0
 3rdparty/CGAL/VERSION                              |     1 +
 .../{CGAL-4.8 => CGAL}/auxiliary/cgal_app.icns     |   Bin
 3rdparty/CGAL/auxiliary/cgal_create_cmake_script.1 |    42 +
 .../auxiliary/gdb/python/CGAL/__init__.py          |     0
 .../auxiliary/gdb/python/CGAL/printers.py          |     0
 .../{CGAL-4.8 => CGAL}/auxiliary/gdb/test-gdb.py   |     0
 3rdparty/{CGAL-4.8 => CGAL}/auxiliary/gdb/test.cpp |     0
 3rdparty/{CGAL-4.8 => CGAL}/auxiliary/gmp/README   |     0
 .../CGAL/cmake/modules/CGALConfig_binary.cmake.in  |   199 +
 .../CGAL/cmake/modules/CGALConfig_install.cmake.in |   154 +
 3rdparty/CGAL/cmake/modules/CGALLibConfig.cmake.in |    32 +
 .../cmake/modules/CGAL_CheckCXXFileRuns.cmake      |     0
 3rdparty/CGAL/cmake/modules/CGAL_Common.cmake      |    61 +
 .../CGAL_CreateSingleSourceCGALProgram.cmake       |    53 +
 .../modules/CGAL_GeneratorSpecificSettings.cmake   |     0
 .../cmake/modules/CGAL_Locate_CGAL_TAUCS.cmake     |     0
 3rdparty/CGAL/cmake/modules/CGAL_Macros.cmake      |   717 +
 .../cmake/modules/CGAL_SCM.cmake                   |     0
 3rdparty/CGAL/cmake/modules/CGAL_SetupBoost.cmake  |    63 +
 .../cmake/modules/CGAL_SetupDependencies.cmake     |     0
 .../cmake/modules/CGAL_SetupFlags.cmake            |     0
 .../cmake/modules/CGAL_SetupVLD.cmake              |     0
 .../cmake/modules/CGAL_TweakFindBoost.cmake        |     0
 .../cmake/modules/CGAL_UseBLAS.cmake               |     0
 .../cmake/modules/CGAL_UseLAPACK.cmake             |     0
 .../cmake/modules/CGAL_UseLEDA.cmake               |     0
 .../cmake/modules/CGAL_UseMKL.cmake                |     0
 .../cmake/modules/CGAL_UseMPFI.cmake               |     0
 .../cmake/modules/CGAL_UseRS.cmake                 |     0
 .../cmake/modules/CGAL_UseRS3.cmake                |     0
 .../cmake/modules/CGAL_UseTAUCS.cmake              |     0
 .../cmake/modules/CGAL_VersionUtils.cmake          |     0
 .../cmake/modules/FindBLAS.cmake                   |     0
 .../cmake/modules/FindCGAL.cmake                   |     0
 .../cmake/modules/FindCGAL_CORE.cmake              |     0
 .../cmake/modules/FindCORE.cmake                   |     0
 .../cmake/modules/FindESBTL.cmake                  |     0
 3rdparty/CGAL/cmake/modules/FindEigen3.cmake       |    84 +
 .../{CGAL-4.8 => CGAL}/cmake/modules/FindF2C.cmake |     0
 .../cmake/modules/FindGLEW.cmake                   |     0
 .../{CGAL-4.8 => CGAL}/cmake/modules/FindGMP.cmake |     0
 .../cmake/modules/FindGMPXX.cmake                  |     0
 .../{CGAL-4.8 => CGAL}/cmake/modules/FindIPE.cmake |     0
 .../cmake/modules/FindLAPACK.cmake                 |     0
 .../cmake/modules/FindLEDA.cmake                   |     0
 .../{CGAL-4.8 => CGAL}/cmake/modules/FindMKL.cmake |     0
 .../cmake/modules/FindMPFI.cmake                   |     0
 .../cmake/modules/FindMPFR.cmake                   |     0
 .../{CGAL-4.8 => CGAL}/cmake/modules/FindNTL.cmake |     0
 .../cmake/modules/FindOpenGL.cmake                 |     0
 .../cmake/modules/FindOpenMesh.cmake               |     0
 .../cmake/modules/FindQGLViewer.cmake              |     0
 .../{CGAL-4.8 => CGAL}/cmake/modules/FindRS.cmake  |     0
 .../{CGAL-4.8 => CGAL}/cmake/modules/FindRS3.cmake |     0
 .../cmake/modules/FindTAUCS.cmake                  |     0
 3rdparty/CGAL/cmake/modules/FindTBB.cmake          |   425 +
 3rdparty/CGAL/cmake/modules/UseCGAL.cmake          |    65 +
 .../cmake/modules/UseESBTL.cmake                   |     0
 .../cmake/modules/UseEigen3.cmake                  |     0
 .../cmake/modules/UseOpenMesh.cmake                |     0
 .../{CGAL-4.8 => CGAL}/cmake/modules/UseTBB.cmake  |     0
 .../CGAL/cmake/modules/Use_CGAL_Qt5_headers.cmake  |    13 +
 .../{CGAL-4.8 => CGAL}/cmake/modules/test_MPFI.cpp |     0
 .../config/support/print_BOOST_version.cpp         |     0
 .../config/support/print_GCC_version.cpp           |     0
 .../config/support/print_GMP_version.cpp           |     0
 .../config/support/print_IntelCompiler_version.cpp |     0
 .../config/support/print_LEDA_version.cpp          |     0
 .../config/support/print_MPFI_version.cpp          |     0
 .../config/support/print_MPFR_version.cpp          |     0
 .../config/support/print_OPENGL_version.cpp        |     0
 .../config/support/print_QT4_version.cpp           |     0
 .../config/support/print_QT_version.cpp            |     0
 .../config/support/print_ZLIB_version.cpp          |     0
 .../config/support/test_ATLAS.cpp                  |     0
 .../config/support/test_BLAS.cpp                   |     0
 .../config/support/test_BOOST.cpp                  |     0
 .../config/support/test_BOOST_PROGRAM_OPTIONS.cpp  |     0
 .../config/support/test_BOOST_THREAD.cpp           |     0
 .../{CGAL-4.8 => CGAL}/config/support/test_GMP.cpp |     0
 .../config/support/test_GMPXX.cpp                  |     0
 .../config/support/test_LAPACK.cpp                 |     0
 .../config/support/test_LEDA.cpp                   |     0
 .../config/support/test_LEDAWIN.cpp                |     0
 .../config/support/test_LIDIA.cpp                  |     0
 .../config/support/test_MPFR.cpp                   |     0
 .../config/support/test_OPENGL.cpp                 |     0
 .../{CGAL-4.8 => CGAL}/config/support/test_QT.cpp  |     0
 .../{CGAL-4.8 => CGAL}/config/support/test_X11.cpp |     0
 .../config/support/test_ZLIB.cpp                   |     0
 .../config/support/test_syntaxonly.cpp             |     0
 .../testfiles/CGAL_CFG_DENORMALS_COMPILE_BUG.cpp   |     0
 ...CGAL_CFG_FPU_ROUNDING_MODE_UNWINDING_VC_BUG.cpp |     0
 .../config/testfiles/CGAL_CFG_IEEE_754_BUG.cpp     |     0
 .../config/testfiles/CGAL_CFG_ISTREAM_INT_BUG.cpp  |     0
 .../config/testfiles/CGAL_CFG_MATCHING_BUG_5.cpp   |     0
 .../config/testfiles/CGAL_CFG_MATCHING_BUG_6.cpp   |     0
 .../config/testfiles/CGAL_CFG_MATCHING_BUG_7.cpp   |     0
 .../config/testfiles/CGAL_CFG_MATCHING_BUG_8.cpp   |     0
 ...GAL_CFG_NESTED_CLASS_FRIEND_DECLARATION_BUG.cpp |     0
 .../config/testfiles/CGAL_CFG_NO_LIMITS.cpp        |     0
 .../config/testfiles/CGAL_CFG_NO_NEXTAFTER.cpp     |     0
 .../config/testfiles/CGAL_CFG_NO_STL.cpp           |     0
 .../testfiles/CGAL_CFG_NUMERIC_LIMITS_BUG.cpp      |     0
 .../CGAL_CFG_OUTOFLINE_MEMBER_DEFINITION_BUG.cpp   |     0
 .../CGAL_CFG_TEMPLATE_IN_DEFAULT_PARAMETER_BUG.cpp |     0
 ...AL_CFG_TYPENAME_BEFORE_DEFAULT_ARGUMENT_BUG.cpp |     0
 .../testfiles/CGAL_CFG_USING_BASE_MEMBER_BUG_2.cpp |     0
 3rdparty/{CGAL-4.8 => CGAL}/config/version.h.in    |     0
 .../demo/AABB_tree/AABB_demo.cpp                   |     0
 .../demo/AABB_tree/AABB_demo.pdf                   |   Bin
 .../demo/AABB_tree/AABB_demo.qrc                   |     0
 3rdparty/CGAL/demo/AABB_tree/CMakeLists.txt        |    96 +
 .../{CGAL-4.8 => CGAL}/demo/AABB_tree/Color_ramp.h |     0
 .../demo/AABB_tree/MainWindow.cpp                  |     0
 .../{CGAL-4.8 => CGAL}/demo/AABB_tree/MainWindow.h |     0
 .../demo/AABB_tree/MainWindow.ui                   |     0
 .../{CGAL-4.8 => CGAL}/demo/AABB_tree/Refiner.h    |     0
 3rdparty/CGAL/demo/AABB_tree/Scene.cpp             |  1337 +
 3rdparty/{CGAL-4.8 => CGAL}/demo/AABB_tree/Scene.h |     0
 .../{CGAL-4.8 => CGAL}/demo/AABB_tree/Viewer.cpp   |     0
 .../{CGAL-4.8 => CGAL}/demo/AABB_tree/Viewer.h     |     0
 .../demo/AABB_tree/benchmarks.cpp                  |     0
 .../demo/AABB_tree/data/hand.off                   |     0
 .../demo/AABB_tree/data/knot.off                   |     0
 .../demo/AABB_tree/data/part.off                   |     0
 .../{CGAL-4.8 => CGAL}/demo/AABB_tree/data/u.off   |     0
 .../demo/AABB_tree/resources/about.html            |     0
 .../demo/AABB_tree/resources/cgal_logo.xpm         |     0
 3rdparty/{CGAL-4.8 => CGAL}/demo/AABB_tree/types.h |     0
 .../demo/Alpha_shapes_2/Alpha_shapes_2.cpp         |     0
 .../demo/Alpha_shapes_2/Alpha_shapes_2.qrc         |     0
 .../demo/Alpha_shapes_2/Alpha_shapes_2.ui          |     0
 3rdparty/CGAL/demo/Alpha_shapes_2/CMakeLists.txt   |    50 +
 .../demo/Alpha_shapes_2/about_Alpha_shapes_2.html  |     0
 .../demo/Alpha_shapes_3/Alpha_shape_3.cpp          |     0
 .../demo/Alpha_shapes_3/Alpha_shape_3.qrc          |     0
 3rdparty/CGAL/demo/Alpha_shapes_3/CMakeLists.txt   |    49 +
 .../demo/Alpha_shapes_3/MainWindow.cpp             |     0
 .../demo/Alpha_shapes_3/MainWindow.h               |     0
 .../demo/Alpha_shapes_3/MainWindow.ui              |     0
 .../demo/Alpha_shapes_3/Viewer.cpp                 |     0
 .../demo/Alpha_shapes_3/Viewer.h                   |     0
 .../demo/Alpha_shapes_3/about_Alpha_shapes_3.html  |     0
 .../demo/Alpha_shapes_3/typedefs.h                 |     0
 .../demo/Apollonius_graph_2/Apollonius_graph_2.cpp |     0
 .../demo/Apollonius_graph_2/Apollonius_graph_2.qrc |     0
 .../demo/Apollonius_graph_2/Apollonius_graph_2.ui  |     0
 .../CGAL/demo/Apollonius_graph_2/CMakeLists.txt    |    48 +
 .../about_Apollonius_graph_2.html                  |     0
 .../ArrangementCurveInputCallback.h                |     0
 .../ArrangementDemoGraphicsView.cpp                |     0
 .../ArrangementDemoGraphicsView.h                  |     0
 .../ArrangementDemoPropertiesDialog.cpp            |     0
 .../ArrangementDemoPropertiesDialog.h              |     0
 .../ArrangementDemoPropertiesDialog.ui             |     0
 .../ArrangementDemoTab.cpp                         |     0
 .../Arrangement_on_surface_2/ArrangementDemoTab.h  |     0
 .../ArrangementDemoWindow.cpp                      |     0
 .../ArrangementDemoWindow.h                        |     0
 .../ArrangementDemoWindow.qrc                      |     0
 .../ArrangementDemoWindow.ui                       |     0
 .../ArrangementGraphicsItem.cpp                    |     0
 .../ArrangementGraphicsItem.h                      |     0
 .../ArrangementPainterOstream.h                    |     0
 .../ArrangementSegmentInputCallback.h              |     0
 .../Arrangement_on_surface_2/ArrangementTypes.h    |     0
 .../demo/Arrangement_on_surface_2/CMakeLists.txt   |    83 +
 .../demo/Arrangement_on_surface_2/Callback.cpp     |     0
 .../demo/Arrangement_on_surface_2/Callback.h       |     0
 .../Arrangement_on_surface_2/ColorItemEditor.cpp   |     0
 .../Arrangement_on_surface_2/ColorItemEditor.h     |     0
 .../demo/Arrangement_on_surface_2/Conic_reader.h   |     0
 .../Arrangement_on_surface_2/CurveGraphicsItem.h   |     0
 .../Arrangement_on_surface_2/DeleteCurveCallback.h |     0
 .../Arrangement_on_surface_2/DeleteCurveMode.cpp   |     0
 .../Arrangement_on_surface_2/DeleteCurveMode.h     |     0
 .../DeleteCurveModeItemEditor.cpp                  |     0
 .../DeleteCurveModeItemEditor.h                    |     0
 .../Arrangement_on_surface_2/EnvelopeCallback.cpp  |     0
 .../Arrangement_on_surface_2/EnvelopeCallback.h    |     0
 .../Arrangement_on_surface_2/FillFaceCallback.cpp  |     0
 .../Arrangement_on_surface_2/FillFaceCallback.h    |     0
 .../GraphicsViewCurveInput.cpp                     |     0
 .../GraphicsViewCurveInput.h                       |     0
 .../GraphicsViewSegmentInput.cpp                   |     0
 .../GraphicsViewSegmentInput.h                     |     0
 .../demo/Arrangement_on_surface_2/ISnappable.h     |     0
 .../Arrangement_on_surface_2/MergeEdgeCallback.h   |     0
 .../demo/Arrangement_on_surface_2/NewTabDialog.cpp |     0
 .../demo/Arrangement_on_surface_2/NewTabDialog.h   |     0
 .../demo/Arrangement_on_surface_2/NewTabDialog.ui  |     0
 .../Arrangement_on_surface_2/OverlayDialog.cpp     |     0
 .../demo/Arrangement_on_surface_2/OverlayDialog.h  |     0
 .../demo/Arrangement_on_surface_2/OverlayDialog.ui |     0
 .../PointLocationCallback.h                        |     0
 .../PointsGraphicsItem.cpp                         |     0
 .../Arrangement_on_surface_2/PointsGraphicsItem.h  |     0
 .../PropertyValueDelegate.cpp                      |     0
 .../PropertyValueDelegate.h                        |     0
 .../Arrangement_on_surface_2/SplitEdgeCallback.cpp |     0
 .../Arrangement_on_surface_2/SplitEdgeCallback.h   |     0
 .../demo/Arrangement_on_surface_2/Utils.cpp        |     0
 .../demo/Arrangement_on_surface_2/Utils.h          |     0
 .../VerticalRayGraphicsItem.cpp                    |     0
 .../VerticalRayGraphicsItem.h                      |     0
 .../VerticalRayShootCallback.cpp                   |     0
 .../VerticalRayShootCallback.h                     |     0
 .../Arrangement_on_surface_2/arrangement_2.cpp     |     0
 .../data/algebraic/alg_circle.arr                  |     0
 .../data/algebraic/cubic.arr                       |     0
 .../data/algebraic/erdos_lemiscate.arr             |     0
 .../data/algebraic/infinitesimal.arr               |     0
 .../data/algebraic/trifolium.arr                   |     0
 .../data/conic/big_circ_arcs.arr                   |     0
 .../data/conic/big_circ_arcs.dat                   |     0
 .../data/conic/circles_21.dat                      |     0
 .../data/polyline/ps_circs.dat                     |     0
 .../data/polyline/random_polylines_10_20.dat       |     0
 .../data/polyline/sines.dat                        |     0
 .../data/segment/fork0505_mc.seg.rand.dat          |     0
 .../data/segment/non_degenerate_100_x.dat          |     0
 .../data/segment/onebig_100.dat                    |     0
 .../data/segment/onebig_100_x.dat                  |     0
 .../data/segment/onebig_250_x.dat                  |     0
 .../data/segment/polygon_100.dat                   |     0
 .../data/segment/random_segments_100.dat           |     0
 .../data/segment/random_segments_100_x.dat         |     0
 .../data/segment/random_segments_500_x.dat         |     0
 .../data/segment/tilt_grid_200.dat                 |     0
 .../data/segment/world.seg.cut.rand.dat            |     0
 .../demo/Arrangement_on_surface_2/help/about.html  |     0
 .../demo/Arrangement_on_surface_2/help/index.html  |     0
 .../Arrangement_on_surface_2/icons/blue_icon.xpm   |     0
 .../demo/Arrangement_on_surface_2/icons/conic.xpm  |     0
 .../Arrangement_on_surface_2/icons/conic_types.xpm |     0
 .../demo/Arrangement_on_surface_2/icons/delete.xpm |     0
 .../icons/demo_arrow_down.xpm                      |     0
 .../icons/demo_arrow_up.xpm                        |     0
 .../Arrangement_on_surface_2/icons/demo_colors.xpm |     0
 .../icons/demo_conic_3points.xpm                   |     0
 .../icons/demo_conic_5points.xpm                   |     0
 .../icons/demo_conic_circle.xpm                    |     0
 .../icons/demo_conic_ellipse.xpm                   |     0
 .../icons/demo_conic_line.xpm                      |     0
 .../icons/demo_conic_ray.xpm                       |     0
 .../icons/demo_conic_segment.xpm                   |     0
 .../Arrangement_on_surface_2/icons/demo_delete.bmp |   Bin
 .../Arrangement_on_surface_2/icons/demo_delete.xpm |     0
 .../Arrangement_on_surface_2/icons/demo_fill.xpm   |     0
 .../Arrangement_on_surface_2/icons/demo_insert.bmp |   Bin
 .../Arrangement_on_surface_2/icons/demo_insert.xpm |     0
 .../Arrangement_on_surface_2/icons/demo_merge.bmp  |   Bin
 .../Arrangement_on_surface_2/icons/demo_merge.xpm  |     0
 .../icons/demo_pointlocation.bmp                   |   Bin
 .../icons/demo_pointlocation.xpm                   |     0
 .../icons/demo_rayshoot.bmp                        |   Bin
 .../icons/demo_rayshoot.xpm                        |     0
 .../icons/demo_rayshoot_down.xpm                   |     0
 .../icons/demo_rayshoot_up.xpm                     |     0
 .../icons/demo_snapgrid.bmp                        |   Bin
 .../icons/demo_snapgrid.xpm                        |     0
 .../icons/demo_snapvertex.bmp                      |   Bin
 .../icons/demo_snapvertex.xpm                      |     0
 .../Arrangement_on_surface_2/icons/demo_split.bmp  |   Bin
 .../Arrangement_on_surface_2/icons/demo_split.xpm  |     0
 .../Arrangement_on_surface_2/icons/demo_zoomin.bmp |   Bin
 .../Arrangement_on_surface_2/icons/demo_zoomin.xpm |     0
 .../icons/demo_zoomout.bmp                         |   Bin
 .../icons/demo_zoomout.xpm                         |     0
 .../demo/Arrangement_on_surface_2/icons/draw.xpm   |     0
 .../Arrangement_on_surface_2/icons/green_icon.xpm  |     0
 .../demo/Arrangement_on_surface_2/icons/grid.xpm   |     0
 .../demo/Arrangement_on_surface_2/icons/hand.xpm   |     0
 .../demo/Arrangement_on_surface_2/icons/insert.xpm |     0
 .../icons/lower_env_xpm.bmp                        |   Bin
 .../icons/lower_env_xpm.xpm                        |     0
 .../demo/Arrangement_on_surface_2/icons/merge.xpm  |     0
 .../demo/Arrangement_on_surface_2/icons/none.xpm   |     0
 .../demo/Arrangement_on_surface_2/icons/po.xpm     |     0
 .../demo/Arrangement_on_surface_2/icons/points.xpm |     0
 .../Arrangement_on_surface_2/icons/polyline.xpm    |     0
 .../icons/ray_shooting.xpm                         |     0
 .../icons/ray_shooting2.xpm                        |     0
 .../Arrangement_on_surface_2/icons/red_icon.xpm    |     0
 .../demo/Arrangement_on_surface_2/icons/snap.xpm   |     0
 .../demo/Arrangement_on_surface_2/icons/split.xpm  |     0
 .../icons/upper_env_xpm.bmp                        |   Bin
 .../icons/upper_env_xpm.xpm                        |     0
 .../Arrangement_on_surface_2/icons/voronoi.xpm     |     0
 .../Arrangement_on_surface_2/icons/yellow_icon.xpm |     0
 .../Arrangement_on_surface_2/tests/CMakeLists.txt  |     0
 .../demo/Arrangement_on_surface_2/tests/Test.cpp   |     0
 .../tests/TestAlgebraic.cpp                        |     0
 .../Arrangement_on_surface_2/tests/TestRayPL.cpp   |     0
 .../demo/Bounding_volumes/Bounding_volumes.cpp     |     0
 .../demo/Bounding_volumes/Bounding_volumes.qrc     |     0
 .../demo/Bounding_volumes/Bounding_volumes.ui      |     0
 3rdparty/CGAL/demo/Bounding_volumes/CMakeLists.txt |    53 +
 .../demo/Bounding_volumes/Ellipse.h                |     0
 .../Bounding_volumes/about_Bounding_volumes.html   |     0
 .../demo/Bounding_volumes/icons/convex_hull.png    |   Bin
 .../demo/Bounding_volumes/icons/min_circle.pdf     |   Bin
 .../demo/Bounding_volumes/icons/min_circle.png     |   Bin
 .../demo/Bounding_volumes/icons/min_ellipse.png    |   Bin
 .../Bounding_volumes/icons/min_parallelogram.png   |   Bin
 .../Bounding_volumes/icons/min_quadrilateral.png   |   Bin
 .../demo/Bounding_volumes/icons/p_center.png       |   Bin
 .../demo/CGAL_ipelets/CMakeLists.txt               |     0
 .../demo/CGAL_ipelets/alpha_shapes.cpp             |     0
 .../demo/CGAL_ipelets/arrangement.cpp              |     0
 .../demo/CGAL_ipelets/bbox_restriction.cpp         |     0
 .../demo/CGAL_ipelets/circle_pencils.cpp           |     0
 .../demo/CGAL_ipelets/diagrams.cpp                 |     0
 .../demo/CGAL_ipelets/distance.cpp                 |     0
 .../demo/CGAL_ipelets/generator.cpp                |     0
 .../demo/CGAL_ipelets/hilbert_sort.cpp             |     0
 .../{CGAL-4.8 => CGAL}/demo/CGAL_ipelets/hull.cpp  |     0
 .../demo/CGAL_ipelets/hyperbolic.cpp               |     0
 .../CGAL_ipelets/include/CGAL_ipelets/k_delaunay.h |     0
 .../CGAL_ipelets/include/CGAL_ipelets/pencils.h    |     0
 .../demo/CGAL_ipelets/lua/libCGAL_alpha_shapes.lua |     0
 .../demo/CGAL_ipelets/lua/libCGAL_arrangement.lua  |     0
 .../CGAL_ipelets/lua/libCGAL_bbox_restriction.lua  |     0
 .../CGAL_ipelets/lua/libCGAL_circle_pencils.lua    |     0
 .../demo/CGAL_ipelets/lua/libCGAL_diagrams.lua     |     0
 .../demo/CGAL_ipelets/lua/libCGAL_distance.lua     |     0
 .../demo/CGAL_ipelets/lua/libCGAL_generator.lua    |     0
 .../demo/CGAL_ipelets/lua/libCGAL_hilbert_sort.lua |     0
 .../demo/CGAL_ipelets/lua/libCGAL_hull.lua         |     0
 .../demo/CGAL_ipelets/lua/libCGAL_hyperbolic.lua   |     0
 .../demo/CGAL_ipelets/lua/libCGAL_mesh_2.lua       |     0
 .../demo/CGAL_ipelets/lua/libCGAL_minkowski.lua    |     0
 .../CGAL_ipelets/lua/libCGAL_multi_delaunay.lua    |     0
 .../CGAL_ipelets/lua/libCGAL_multi_regular.lua     |     0
 .../demo/CGAL_ipelets/lua/libCGAL_partition.lua    |     0
 .../demo/CGAL_ipelets/lua/libCGAL_pca.lua          |     0
 .../lua/libCGAL_simple_triangulation.lua           |     0
 .../demo/CGAL_ipelets/lua/libCGAL_skeleton.lua     |     0
 .../demo/CGAL_ipelets/lua/libCGAL_svdlinf.lua      |     0
 .../CGAL_ipelets/lua/libCGAL_triangulation.lua     |     0
 .../demo/CGAL_ipelets/mesh_2.cpp                   |     0
 .../demo/CGAL_ipelets/minkowski.cpp                |     0
 .../demo/CGAL_ipelets/multi_delaunay.cpp           |     0
 .../demo/CGAL_ipelets/multi_regular.cpp            |     0
 .../demo/CGAL_ipelets/partition.cpp                |     0
 .../{CGAL-4.8 => CGAL}/demo/CGAL_ipelets/pca.cpp   |     0
 .../demo/CGAL_ipelets/simple_triangulation.cpp     |     0
 .../demo/CGAL_ipelets/skeleton.cpp                 |     0
 .../demo/CGAL_ipelets/svdlinf.cpp                  |     0
 .../demo/CGAL_ipelets/triangulation.cpp            |     0
 3rdparty/{CGAL-4.8 => CGAL}/demo/CMakeLists.txt    |     0
 .../demo/Circular_kernel_2/ArcsGraphicsItem.h      |     0
 .../CGAL/demo/Circular_kernel_2/CMakeLists.txt     |    53 +
 .../demo/Circular_kernel_2/Circular_kernel_2.cpp   |     0
 .../demo/Circular_kernel_2/Circular_kernel_2.qrc   |     0
 .../demo/Circular_kernel_2/Circular_kernel_2.ui    |     0
 .../Circular_kernel_2/about_Circular_kernel_2.html |     0
 .../demo/Circular_kernel_2/arcs.arc                |     0
 .../demo/Circular_kernel_2/data/circle_grid.cgal   |     0
 .../demo/Circular_kernel_2/data/circles_21.cgal    |     0
 .../CGAL/demo/Circular_kernel_3/CMakeLists.txt     |    36 +
 .../demo/Circular_kernel_3/Circular_kernel_3.cpp   |     0
 .../demo/Circular_kernel_3/Viewer.cpp              |     0
 .../demo/Circular_kernel_3/Viewer.h                |     0
 3rdparty/CGAL/demo/Convex_hull_3/CMakeLists.txt    |    27 +
 .../{CGAL-4.8 => CGAL}/demo/Convex_hull_3/README   |     0
 .../demo/Convex_hull_3/quickhull_3_demo.cpp        |     0
 3rdparty/CGAL/demo/Generator/CMakeLists.txt        |    50 +
 .../demo/Generator/Generator_2.cpp                 |     0
 .../demo/Generator/Generator_2.qrc                 |     0
 .../demo/Generator/Generator_2.ui                  |     0
 .../demo/Generator/about_Generator_2.html          |     0
 3rdparty/CGAL/demo/Geomview/CMakeLists.txt         |    29 +
 3rdparty/{CGAL-4.8 => CGAL}/demo/Geomview/README   |     0
 .../{CGAL-4.8 => CGAL}/demo/Geomview/data/points3  |     0
 .../demo/Geomview/gv_terrain.cpp                   |     0
 .../{CGAL-4.8 => CGAL}/demo/Geomview/input.cpp     |     0
 .../{CGAL-4.8 => CGAL}/demo/Geomview/kernel.cpp    |     0
 3rdparty/CGAL/demo/GraphicsView/CMakeLists.txt     |    35 +
 .../{CGAL-4.8 => CGAL}/demo/GraphicsView/min.cpp   |     0
 3rdparty/CGAL/demo/Interpolation/CMakeLists.txt    |    30 +
 .../{CGAL-4.8 => CGAL}/demo/Interpolation/README   |     0
 .../demo/Interpolation/interpolation_2_demo.cpp    |     0
 .../demo/Interpolation/surface_voronoi.cpp         |     0
 .../CGAL/demo/L1_Voronoi_diagram_2/CMakeLists.txt  |    52 +
 .../L1_Voronoi_diagram_2/L1_voronoi_diagram_2.cpp  |     0
 .../L1_Voronoi_diagram_2/L1_voronoi_diagram_2.qrc  |     0
 .../L1_Voronoi_diagram_2/L1_voronoi_diagram_2.ui   |     0
 .../about_L1_voronoi_diagram_2.html                |     0
 .../include/CGAL/L1_voronoi_traits_2.h             |     0
 .../include/CGAL/Qt/ArrangementGraphicsItem.h      |     0
 .../include/CGAL/Qt/ArrangementPointInput.h        |     0
 .../include/CGAL/Qt/SetGraphicsItem.h              |     0
 .../CGAL/demo/Largest_empty_rect_2/CMakeLists.txt  |    51 +
 .../Largest_empty_rectangle_2.cpp                  |     0
 .../Largest_empty_rectangle_2.qrc                  |     0
 .../Largest_empty_rectangle_2.ui                   |     0
 .../about_Largest_empty_rectangle_2.html           |     0
 .../CGAL/demo/Linear_cell_complex/CMakeLists.txt   |    79 +
 .../demo/Linear_cell_complex/CreateMenger.ui       |     0
 .../demo/Linear_cell_complex/CreateMesh.ui         |     0
 .../Linear_cell_complex/CreateSierpinskiCarpet.ui  |     0
 .../CreateSierpinskiTriangle.ui                    |     0
 .../Linear_cell_complex/Linear_cell_complex_3.qrc  |     0
 .../Linear_cell_complex_3_demo.cpp                 |     0
 .../Linear_cell_complex_3_subdivision.cpp          |   202 +
 .../Linear_cell_complex_pqq_subdivision.cpp        |   327 +
 .../CGAL/demo/Linear_cell_complex/MainWindow.cpp   |  3390 +++
 .../demo/Linear_cell_complex/MainWindow.h          |     0
 .../demo/Linear_cell_complex/MainWindow.ui         |     0
 .../demo/Linear_cell_complex/Viewer.cpp            |     0
 .../demo/Linear_cell_complex/Viewer.h              |     0
 .../about_Linear_cell_complex_3.html               |     0
 .../demo/Linear_cell_complex/import_moka.h         |     0
 3rdparty/CGAL/demo/Linear_cell_complex/typedefs.h  |   205 +
 3rdparty/CGAL/demo/Mesh_2/CMakeLists.txt           |    34 +
 3rdparty/{CGAL-4.8 => CGAL}/demo/Mesh_2/README.txt |     0
 .../{CGAL-4.8 => CGAL}/demo/Mesh_2/conform.cpp     |     0
 .../demo/Mesh_2/data/butterfly.edg                 |     0
 .../demo/Mesh_2/data/clusters.edg                  |     0
 .../demo/Mesh_2/data/clusters.poly                 |     0
 .../demo/Mesh_2/data/clusters2.edg                 |     0
 .../{CGAL-4.8 => CGAL}/demo/Mesh_2/data/fish.edg   |     0
 .../{CGAL-4.8 => CGAL}/demo/Mesh_2/data/fish.poly  |     0
 .../{CGAL-4.8 => CGAL}/demo/Mesh_2/data/img1.edg   |     0
 .../{CGAL-4.8 => CGAL}/demo/Mesh_2/data/img2.edg   |     0
 .../{CGAL-4.8 => CGAL}/demo/Mesh_2/data/img3.edg   |     0
 .../{CGAL-4.8 => CGAL}/demo/Mesh_2/data/img4.edg   |     0
 .../{CGAL-4.8 => CGAL}/demo/Mesh_2/data/img5.edg   |     0
 .../{CGAL-4.8 => CGAL}/demo/Mesh_2/data/img6.edg   |     0
 .../{CGAL-4.8 => CGAL}/demo/Mesh_2/data/img7.edg   |     0
 .../{CGAL-4.8 => CGAL}/demo/Mesh_2/data/img8.edg   |     0
 .../demo/Mesh_2/data/lettre_A.edg                  |     0
 .../demo/Mesh_2/data/lettre_A_2.edg                |     0
 .../demo/Mesh_2/data/trivial.poly                  |     0
 3rdparty/{CGAL-4.8 => CGAL}/demo/Mesh_2/mesh.cpp   |     0
 .../{CGAL-4.8 => CGAL}/demo/Mesh_3/C3t3_type.h     |     0
 3rdparty/CGAL/demo/Mesh_3/CMakeLists.txt           |   391 +
 .../{CGAL-4.8 => CGAL}/demo/Mesh_3/Color_ramp.cpp  |     0
 .../{CGAL-4.8 => CGAL}/demo/Mesh_3/Color_ramp.h    |     0
 .../{CGAL-4.8 => CGAL}/demo/Mesh_3/Image_type.h    |     0
 .../demo/Mesh_3/Image_type_fwd.h                   |     0
 .../demo/Mesh_3/Io_c3t3_plugin.cpp                 |     0
 .../demo/Mesh_3/Io_image_plugin.cpp                |     0
 .../demo/Mesh_3/Io_implicit_function_plugin.cpp    |     0
 .../demo/Mesh_3/Io_off_plugin.cpp                  |     0
 .../{CGAL-4.8 => CGAL}/demo/Mesh_3/MainWindow.cpp  |     0
 .../{CGAL-4.8 => CGAL}/demo/Mesh_3/MainWindow.h    |     0
 3rdparty/{CGAL-4.8 => CGAL}/demo/Mesh_3/Mesh_3.cpp |     0
 3rdparty/{CGAL-4.8 => CGAL}/demo/Mesh_3/Mesh_3.qrc |     0
 .../demo/Mesh_3/Mesh_3_optimization_plugin.cpp     |     0
 .../Mesh_3_optimization_plugin_cgal_code.cpp       |     0
 .../demo/Mesh_3/Mesh_3_plugin.cpp                  |     0
 .../demo/Mesh_3/Mesh_3_plugin_image_cgal_code.cpp  |     0
 .../Mesh_3_plugin_implicit_function_cgal_code.cpp  |     0
 .../Mesh_3/Mesh_3_plugin_polyhedron_cgal_code.cpp  |     0
 3rdparty/CGAL/demo/Mesh_3/Mesh_function.h          |   265 +
 .../demo/Mesh_3/Meshing_thread.cpp                 |     0
 .../demo/Mesh_3/Meshing_thread.h                   |     0
 .../demo/Mesh_3/Optimizer_thread.cpp               |     0
 .../demo/Mesh_3/Optimizer_thread.h                 |     0
 .../demo/Mesh_3/Polyhedron_type.h                  |     0
 .../demo/Mesh_3/Polyhedron_type_fwd.h              |     0
 .../demo/Mesh_3/Scene_c3t3_item.cpp                |     0
 .../demo/Mesh_3/Scene_c3t3_item.h                  |     0
 .../demo/Mesh_3/Scene_c3t3_item_config.h           |     0
 .../demo/Mesh_3/Scene_implicit_function_item.cpp   |     0
 .../demo/Mesh_3/Scene_implicit_function_item.h     |     0
 .../Mesh_3/Scene_implicit_function_item_config.h   |     0
 .../demo/Mesh_3/Scene_polygon_soup.cpp             |     0
 .../demo/Mesh_3/Scene_polygon_soup.h               |     0
 .../demo/Mesh_3/Scene_polygon_soup_config.h        |     0
 .../demo/Mesh_3/Scene_polyhedron_item.cpp          |     0
 .../demo/Mesh_3/Scene_polyhedron_item.h            |     0
 .../demo/Mesh_3/Scene_polyhedron_item_config.h     |     0
 .../demo/Mesh_3/Scene_segmented_image_item.cpp     |     0
 .../demo/Mesh_3/Scene_segmented_image_item.h       |     0
 .../Mesh_3/Scene_segmented_image_item_config.h     |     0
 3rdparty/{CGAL-4.8 => CGAL}/demo/Mesh_3/StdAfx.cpp |     0
 3rdparty/{CGAL-4.8 => CGAL}/demo/Mesh_3/StdAfx.h   |     0
 .../{CGAL-4.8 => CGAL}/demo/Mesh_3/Volume_plane.h  |     0
 .../demo/Mesh_3/Volume_plane_interface.h           |     0
 .../demo/Mesh_3/Volume_plane_intersection.cpp      |     0
 .../demo/Mesh_3/Volume_plane_intersection.h        |     0
 .../demo/Mesh_3/Volume_plane_thread.h              |     0
 .../demo/Mesh_3/Volume_planes_plugin.cpp           |     0
 .../demo/Mesh_3/concurrent_mesher_config.cfg       |     0
 3rdparty/{CGAL-4.8 => CGAL}/demo/Mesh_3/config.h   |     0
 .../demo/Mesh_3/implicit_functions/CMakeLists.txt  |     0
 .../Implicit_function_interface.h                  |     0
 .../implicit_functions/Klein_implicit_function.cpp |     0
 .../Sphere_implicit_function.cpp                   |     0
 .../Tanglecube_implicit_function.cpp               |     0
 .../Mesh_3/include/CGAL_demo/Io_plugin_interface.h |     0
 .../Mesh_3/include/CGAL_demo/Messages_interface.h  |     0
 .../demo/Mesh_3/include/CGAL_demo/Plugin_helper.h  |     0
 .../Mesh_3/include/CGAL_demo/Plugin_interface.h    |     0
 .../demo/Mesh_3/include/CGAL_demo/Scene.h          |     0
 .../include/CGAL_demo/Scene_draw_interface.h       |     0
 .../Mesh_3/include/CGAL_demo/Scene_interface.h     |     0
 .../demo/Mesh_3/include/CGAL_demo/Scene_item.h     |     0
 .../Mesh_3/include/CGAL_demo/Scene_item_config.h   |     0
 .../demo/Mesh_3/include/CGAL_demo/Viewer.h         |     0
 .../demo/Mesh_3/include/CGAL_demo/Viewer_config.h  |     0
 .../demo/Mesh_3/resources/about.html               |     0
 .../demo/Mesh_3/resources/cgal_logo.xpm            |     0
 .../demo/Mesh_3/resources/check-off.png            |   Bin
 .../demo/Mesh_3/resources/check-off.svg            |     0
 .../demo/Mesh_3/resources/check-on.png             |   Bin
 .../demo/Mesh_3/resources/check.svg                |     0
 .../demo/Mesh_3/resources/editcopy.png             |   Bin
 .../demo/Mesh_3/resources/minus.png                |   Bin
 .../demo/Mesh_3/resources/plus.png                 |   Bin
 .../demo/Mesh_3/src/CGAL_demo/Plugin_helper.cpp    |     0
 .../demo/Mesh_3/src/CGAL_demo/Scene.cpp            |     0
 .../demo/Mesh_3/src/CGAL_demo/Scene_item.cpp       |     0
 .../demo/Mesh_3/src/CGAL_demo/Viewer.cpp           |     0
 .../demo/Mesh_3/ui_files/Function_dialog.ui        |     0
 .../demo/Mesh_3/ui_files/Image_res_dialog.ui       |     0
 .../demo/Mesh_3/ui_files/LocalOptim_dialog.ui      |     0
 .../demo/Mesh_3/ui_files/MainWindow.ui             |     0
 .../demo/Mesh_3/ui_files/Meshing_dialog.ui         |     0
 .../demo/Mesh_3/ui_files/Rib_dialog.ui             |     0
 .../demo/Mesh_3/ui_files/Smoother_dialog.ui        |     0
 .../CMakeLists.txt                                 |   126 +
 .../Otr2_demo.cpp                                  |     0
 .../Otr2_kerneled.h                                |     0
 .../data/blob00.xy                                 |     0
 .../data/maple_leaf_embroidery.bmp                 |   Bin
 .../data/round_rect00.xy                           |     0
 .../data/skyline_noisy00.xy                        |     0
 .../data/stair-noise00.xy                          |     0
 .../dialog_options.h                               |     0
 .../glviewer.cpp                                   |     0
 .../glviewer.h                                     |     0
 .../icons/Voronoi_diagram_2.png                    |   Bin
 .../icons/fileNew.png                              |   Bin
 .../icons/fileOpen.png                             |   Bin
 .../icons/fileSave.png                             |   Bin
 .../icons/fit-page-32.png                          |   Bin
 .../icons/inputPoint.png                           |   Bin
 .../icons/snapshot.png                             |   Bin
 .../icons/triangulation.png                        |   Bin
 .../icons/until.png                                |   Bin
 .../icons/vertex.png                               |   Bin
 .../options.ui                                     |     0
 .../pwsrec.qrc                                     |     0
 .../pwsrec.ui                                      |     0
 .../random.h                                       |     0
 .../render.cpp                                     |     0
 .../scene.h                                        |   917 +
 .../window.cpp                                     |   642 +
 .../window.h                                       |     0
 .../demo/Periodic_2_triangulation_2/CMakeLists.txt |    61 +
 .../Periodic_2_Delaunay_triangulation_2.cpp        |     0
 .../Periodic_2_triangulation_2.qrc                 |     0
 .../Periodic_2_triangulation_2.ui                  |     0
 .../TriangulationCircumcircle.h                    |     0
 .../TriangulationConflictZone.h                    |     0
 .../TriangulationMovingPoint.h                     |     0
 .../TriangulationPointInputAndConflictZone.h       |     0
 .../TriangulationRemoveVertex.h                    |     0
 .../about_Periodic_2_triangulation_2.html          |     0
 .../icons/circumcenter.pdf                         |     0
 .../icons/circumcenter.png                         |   Bin
 .../icons/conflict_zone.pdf                        |   Bin
 .../icons/conflict_zone.png                        |   Bin
 .../icons/constrained_triangulation.pdf            |   Bin
 .../icons/constrained_triangulation.png            |   Bin
 .../constrained_triangulation_show_constraints.pdf |   Bin
 .../constrained_triangulation_show_constraints.png |   Bin
 .../constrained_triangulation_show_in_domain.pdf   |   Bin
 .../constrained_triangulation_show_in_domain.png   |   Bin
 .../icons/fit-page-32.png                          |   Bin
 .../icons/inputPoint.png                           |   Bin
 .../icons/moving_point.pdf                         |   Bin
 .../icons/moving_point.png                         |   Bin
 .../icons/triangulation.pdf                        |   Bin
 .../icons/triangulation.png                        |   Bin
 .../CGAL/Qt/PeriodicTriangulationGraphicsItem.h    |     0
 .../include/CGAL/Qt/PeriodicVoronoiGraphicsItem.h  |     0
 .../demo/Periodic_3_triangulation_3/CMakeLists.txt |   102 +
 .../demo/Periodic_3_triangulation_3/MainWindow.h   |     0
 .../demo/Periodic_3_triangulation_3/MainWindow.ui  |     0
 .../Periodic_3_triangulation_3.qhcp                |     0
 .../Periodic_3_triangulation_3.qhp                 |     0
 .../Periodic_3_triangulation_3.qrc                 |     0
 .../demo/Periodic_3_triangulation_3/Scene.cpp      |     0
 .../demo/Periodic_3_triangulation_3/Scene.h        |     0
 .../demo/Periodic_3_triangulation_3/Scene_utils.h  |     0
 .../demo/Periodic_3_triangulation_3/Viewer.cpp     |     0
 .../demo/Periodic_3_triangulation_3/Viewer.h       |     0
 .../demo/Periodic_3_triangulation_3/data/oneH.xyz  |     0
 .../demo/Periodic_3_triangulation_3/data/oneK.xyz  |     0
 .../demo/Periodic_3_triangulation_3/data/points    |     0
 .../documentation/images/mainwindow.png            |   Bin
 .../documentation/index.html                       |     0
 .../documentation/introduction.html                |     0
 .../documentation/menu.html                        |     0
 .../demo/Periodic_3_triangulation_3/icons/ball.png |   Bin
 .../Periodic_3_triangulation_3/icons/camera.png    |   Bin
 .../Periodic_3_triangulation_3/icons/clipping.png  |   Bin
 .../icons/clippingOff.png                          |   Bin
 .../Periodic_3_triangulation_3/icons/conflict.png  |   Bin
 .../Periodic_3_triangulation_3/icons/cover1.png    |   Bin
 .../Periodic_3_triangulation_3/icons/cover27.png   |   Bin
 .../Periodic_3_triangulation_3/icons/fileOpen.png  |   Bin
 .../Periodic_3_triangulation_3/icons/init0.png     |   Bin
 .../Periodic_3_triangulation_3/icons/init1.png     |   Bin
 .../Periodic_3_triangulation_3/icons/initGrid.png  |   Bin
 .../Periodic_3_triangulation_3/icons/initRand.png  |   Bin
 .../icons/initRandPlanar.png                       |   Bin
 .../icons/inputPointBall.png                       |   Bin
 .../icons/inputPointRandom.png                     |   Bin
 .../Periodic_3_triangulation_3/icons/license.txt   |     0
 .../Periodic_3_triangulation_3/icons/locate.png    |   Bin
 .../Periodic_3_triangulation_3/icons/multiple.png  |   Bin
 .../icons/multipleOff.png                          |   Bin
 .../Periodic_3_triangulation_3/icons/pause.png     |   Bin
 .../Periodic_3_triangulation_3/icons/planar.png    |   Bin
 .../demo/Periodic_3_triangulation_3/icons/play.png |   Bin
 .../icons/twoColorClipping.png                     |   Bin
 .../Periodic_3_triangulation_3/icons/wireframe.png |   Bin
 .../icons/wireframeOff.png                         |   Bin
 .../periodic_3_triangulation_3_demo.cpp            |     0
 .../resources/about.html                           |     0
 .../resources/about_CGAL.html                      |     0
 3rdparty/CGAL/demo/Periodic_Lloyd_3/CMakeLists.txt |    90 +
 .../demo/Periodic_Lloyd_3/MainWindow.cpp           |     0
 .../demo/Periodic_Lloyd_3/MainWindow.h             |     0
 .../demo/Periodic_Lloyd_3/MainWindow.ui            |     0
 .../demo/Periodic_Lloyd_3/Periodic_Lloyd_3.cpp     |     0
 .../demo/Periodic_Lloyd_3/Periodic_Lloyd_3.qhcp    |     0
 .../demo/Periodic_Lloyd_3/Periodic_Lloyd_3.qhp     |     0
 .../demo/Periodic_Lloyd_3/Periodic_Lloyd_3.qrc     |     0
 .../demo/Periodic_Lloyd_3/Scene.h                  |     0
 .../demo/Periodic_Lloyd_3/Viewer.cpp               |     0
 .../demo/Periodic_Lloyd_3/Viewer.h                 |     0
 .../demo/Periodic_Lloyd_3/about_CGAL.html          |     0
 .../Periodic_Lloyd_3/about_Periodic_Lloyd_3.html   |     0
 .../documentation/images/mainwindow.png            |   Bin
 .../demo/Periodic_Lloyd_3/documentation/index.html |     0
 .../documentation/introduction.html                |     0
 .../demo/Periodic_Lloyd_3/documentation/menu.html  |     0
 .../demo/Periodic_Lloyd_3/icons/cp8.png            |   Bin
 .../demo/Periodic_Lloyd_3/icons/fileNew.png        |   Bin
 .../demo/Periodic_Lloyd_3/icons/fileOpen.png       |   Bin
 .../demo/Periodic_Lloyd_3/icons/fileSave.png       |   Bin
 .../demo/Periodic_Lloyd_3/icons/pause.png          |   Bin
 .../demo/Periodic_Lloyd_3/icons/planar.png         |   Bin
 .../demo/Periodic_Lloyd_3/icons/play.png           |   Bin
 .../demo/Periodic_Lloyd_3/icons/step.png           |   Bin
 .../demo/Periodic_Lloyd_3/typedefs.h               |     0
 3rdparty/CGAL/demo/Polygon/CMakeLists.txt          |    59 +
 .../{CGAL-4.8 => CGAL}/demo/Polygon/Polygon_2.cpp  |     0
 .../{CGAL-4.8 => CGAL}/demo/Polygon/Polygon_2.qrc  |     0
 .../{CGAL-4.8 => CGAL}/demo/Polygon/Polygon_2.ui   |     0
 .../demo/Polygon/about_Polygon_2.html              |     0
 .../demo/Polygon/unweighted_polygon.poly           |     0
 .../demo/Polygon/weighted_polygon.wsl              |     0
 .../{CGAL-4.8 => CGAL}/demo/Polyhedron/C2t3_type.h |     0
 .../{CGAL-4.8 => CGAL}/demo/Polyhedron/C3t3_type.h |     0
 .../Polyhedron/CGAL_polyhedron_demoConfig.cmake.in |     0
 3rdparty/CGAL/demo/Polyhedron/CMakeLists.txt       |   381 +
 .../{CGAL-4.8 => CGAL}/demo/Polyhedron/Color_map.h |     0
 3rdparty/CGAL/demo/Polyhedron/Color_ramp.cpp       |   142 +
 3rdparty/CGAL/demo/Polyhedron/Color_ramp.h         |    95 +
 3rdparty/CGAL/demo/Polyhedron/FileLoaderDialog.ui  |   124 +
 .../demo/Polyhedron/File_loader_dialog.h           |     0
 .../CGAL/demo/Polyhedron/GlSplat/CMakeLists.txt    |    36 +
 .../demo/Polyhedron/GlSplat/GlSplat.cpp            |     0
 .../demo/Polyhedron/GlSplat/GlSplat.h              |     0
 .../CGAL/demo/Polyhedron/GlSplat/GlSplat_config.h  |    12 +
 .../demo/Polyhedron/GlSplat/Shader.cpp             |     0
 .../demo/Polyhedron/GlSplat/Shader.h               |     0
 .../Polyhedron/GlSplat/cmake/FindQGLViewer.cmake   |     0
 .../demo/Polyhedron/GlSplat/demo.cpp               |     0
 .../demo/Polyhedron/GlSplat/glsplat.qrc            |     0
 .../Polyhedron/GlSplat/shaders/Finalization.glsl   |     0
 .../Polyhedron/GlSplat/shaders/Raycasting.glsl     |     0
 3rdparty/CGAL/demo/Polyhedron/ImageInterface.ui    |   358 +
 .../demo/Polyhedron/Image_type.h                   |     0
 .../demo/Polyhedron/Image_type_fwd.h               |     0
 .../demo/Polyhedron/Kernel_type.h                  |     0
 3rdparty/CGAL/demo/Polyhedron/MainWindow.cpp       |  1866 ++
 3rdparty/CGAL/demo/Polyhedron/MainWindow.h         |   389 +
 3rdparty/CGAL/demo/Polyhedron/MainWindow.ui        |   679 +
 .../demo/Polyhedron/MainWindow_config.h            |     0
 .../{CGAL-4.8 => CGAL}/demo/Polyhedron/Mainpage.md |     0
 .../demo/Polyhedron/Messages_interface.h           |     0
 .../{CGAL-4.8 => CGAL}/demo/Polyhedron/Nef_type.h  |     0
 .../demo/Polyhedron/Nef_type_fwd.h                 |     0
 .../demo/Polyhedron/One_ring_iterators.h           |     0
 .../Polyhedron/Plugins/AABB_tree/CMakeLists.txt    |     4 +
 .../Polyhedron/Plugins/AABB_tree/Cut_plugin.cpp    |  1389 +
 .../Plugins/Camera_position/CMakeLists.txt         |     0
 .../Camera_position/Camera_positions_list.cpp      |     0
 .../Camera_position/Camera_positions_list.h        |     0
 .../Camera_position/Camera_positions_list.ui       |     0
 .../Camera_position/Camera_positions_plugin.cpp    |    52 +
 .../Plugins/Convex_decomposition/CMakeLists.txt    |     0
 .../Plugins/Convex_decomposition/Nef_plugin.cpp    |   326 +
 .../Polyhedron/Plugins/Convex_hull/CMakeLists.txt  |     0
 .../Plugins/Convex_hull/Convex_hull_plugin.cpp     |   132 +
 .../Plugins/Convex_hull/Kernel_plugin.cpp          |   147 +
 .../Polyhedron/Plugins/IO/Add_point_set_dialog.ui  |   106 +
 .../Polyhedron/Plugins/IO/Add_polylines_dialog.ui  |   121 +
 .../CGAL/demo/Polyhedron/Plugins/IO/CMakeLists.txt |    59 +
 .../demo/Polyhedron/Plugins/IO/Function_dialog.ui  |    93 +
 .../demo/Polyhedron/Plugins/IO/GOCAD_io_plugin.cpp |   109 +
 .../Plugins/IO/Implicit_function_io_plugin.cpp     |   210 +
 .../demo/Polyhedron/Plugins/IO/Nef_io_plugin.cpp   |     0
 .../demo/Polyhedron/Plugins/IO/OFF_io_plugin.cpp   |   170 +
 .../Polyhedron/Plugins/IO/OFF_to_nef_io_plugin.cpp |     0
 .../Polyhedron/Plugins/IO/PLY_to_xyz_io_plugin.cpp |     0
 .../Polyhedron/Plugins/IO/Polylines_io_plugin.cpp  |   276 +
 .../demo/Polyhedron/Plugins/IO/STL_io_plugin.cpp   |     0
 .../Polyhedron/Plugins/IO/Selection_io_plugin.cpp  |     0
 .../Plugins/IO/Surface_mesh_io_plugin.cpp          |    89 +
 .../demo/Polyhedron/Plugins/IO/VTK_io_plugin.cpp   |   418 +
 .../demo/Polyhedron/Plugins/IO/XYZ_io_plugin.cpp   |   225 +
 .../demo/Polyhedron/Plugins/Mesh_2/CMakeLists.txt  |     0
 .../Polyhedron/Plugins/Mesh_2/Mesh_2_plugin.cpp    |   448 +
 .../Polyhedron/Plugins/Mesh_2/mesh_2_dialog.ui     |   226 +
 .../Polyhedron/Plugins/Mesh_3/C3t3_io_plugin.cpp   |   417 +
 .../demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt  |    51 +
 .../Plugins/Mesh_3/Detect_sharp_edges_plugin.cpp   |   126 +
 .../Plugins/Mesh_3/Facet_extra_criterion.h         |     0
 .../Polyhedron/Plugins/Mesh_3/Image_res_dialog.ui  |   148 +
 .../Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp  |  1054 +
 .../Plugins/Mesh_3/Io_implicit_function_plugin.cpp |   213 +
 .../Plugins/Mesh_3/Local_optimizers_dialog.ui      |   218 +
 .../Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp    |   548 +
 .../Plugins/Mesh_3/Mesh_3_plugin_cgal_code.cpp     |   253 +
 .../Plugins/Mesh_3/Mesh_3_plugin_cgal_code.h       |    64 +
 .../demo/Polyhedron/Plugins/Mesh_3/Mesh_function.h |   316 +
 .../Polyhedron/Plugins/Mesh_3/Meshing_dialog.ui    |   600 +
 .../Polyhedron/Plugins/Mesh_3/Meshing_thread.cpp   |     0
 .../Polyhedron/Plugins/Mesh_3/Meshing_thread.h     |     0
 .../Plugins/Mesh_3/Optimization_plugin.cpp         |   643 +
 .../Mesh_3/Optimization_plugin_cgal_code.cpp       |   770 +
 .../Polyhedron/Plugins/Mesh_3/Optimizer_thread.cpp |     0
 .../Polyhedron/Plugins/Mesh_3/Optimizer_thread.h   |     0
 .../Polyhedron_demo_mesh_3_labeled_mesh_domain_3.h |   290 +
 .../Polyhedron/Plugins/Mesh_3/Raw_image_dialog.cpp |     0
 .../Polyhedron/Plugins/Mesh_3/Raw_image_dialog.h   |     0
 .../Polyhedron/Plugins/Mesh_3/Smoother_dialog.ui   |   317 +
 .../demo/Polyhedron/Plugins/Mesh_3/Volume_plane.h  |   478 +
 .../Plugins/Mesh_3/Volume_plane_interface.h        |    52 +
 .../Plugins/Mesh_3/Volume_plane_intersection.cpp   |   198 +
 .../Plugins/Mesh_3/Volume_plane_intersection.h     |    45 +
 .../Plugins/Mesh_3/Volume_plane_thread.h           |   132 +
 .../demo/Polyhedron/Plugins/Mesh_3/config_mesh_3.h |     0
 .../demo/Polyhedron/Plugins/Mesh_3/raw_image.ui    |     0
 .../Plugins/Operations_on_polyhedra/CMakeLists.txt |    10 +
 .../Clip_polyhedron_plugin.cpp                     |   297 +
 .../Clip_polyhedron_plugin.ui                      |   133 +
 .../Corefinement_plugin.cpp                        |   180 +
 .../Intersection_plugin.cpp                        |   223 +
 .../Point_set_from_vertices_plugin.cpp             |   106 +
 .../Scene_combinatorial_map_item.cpp               |   573 +
 .../Scene_combinatorial_map_item.h                 |    83 +
 .../Scene_combinatorial_map_item_config.h          |     0
 .../Plugins/PCA/Affine_transform_plugin.cpp        |   314 +
 .../demo/Polyhedron/Plugins/PCA/CMakeLists.txt     |    11 +
 .../Plugins/PCA/Create_bbox_mesh_plugin.cpp        |   165 +
 .../demo/Polyhedron/Plugins/PCA/Pca_plugin.cpp     |   210 +
 .../PCA/Scene_polyhedron_transform_item.cpp        |   170 +
 .../Plugins/PCA/Scene_polyhedron_transform_item.h  |    42 +
 .../demo/Polyhedron/Plugins/PCA/Trivial_plugin.cpp |   205 +
 .../demo/Polyhedron/Plugins/PMP/CMakeLists.txt     |    77 +
 .../demo/Polyhedron/Plugins/PMP/Fairing_plugin.cpp |   135 +
 .../demo/Polyhedron/Plugins/PMP/Fairing_widget.ui  |   144 +
 .../Polyhedron/Plugins/PMP/Hole_filling_plugin.cpp |   703 +
 .../Plugins/PMP/Hole_filling_polyline_plugin.cpp   |   171 +
 .../Polyhedron/Plugins/PMP/Hole_filling_widget.ui  |   314 +
 .../Polyhedron/Plugins/PMP/Inside_out_plugin.cpp   |    87 +
 .../Plugins/PMP/Isotropic_remeshing_dialog.ui      |   287 +
 .../Plugins/PMP/Isotropic_remeshing_plugin.cpp     |   778 +
 .../Polyhedron/Plugins/PMP/Jet_fitting_plugin.cpp  |   146 +
 .../PMP/Join_and_split_polyhedra_plugin.cpp        |   238 +
 .../PMP/Mean_curvature_flow_skeleton_plugin.cpp    |   920 +
 .../PMP/Mean_curvature_flow_skeleton_plugin.ui     |   174 +
 .../Polyhedron/Plugins/PMP/Orient_soup_plugin.cpp  |   256 +
 .../Plugins/PMP/Point_inside_polyhedron_plugin.cpp |   282 +
 .../Plugins/PMP/Point_inside_polyhedron_widget.ui  |   108 +
 .../Plugins/PMP/Polyhedron_slicer_plugin.cpp       |   349 +
 .../Plugins/PMP/Polyhedron_slicer_widget.ui        |     0
 .../Plugins/PMP/Polyhedron_stitching_plugin.cpp    |   167 +
 .../Plugins/PMP/Repair_polyhedron_plugin.cpp       |   108 +
 .../Polyhedron/Plugins/PMP/Selection_plugin.cpp    |   671 +
 .../Polyhedron/Plugins/PMP/Selection_widget.ui     |   567 +
 .../Plugins/PMP/Self_intersection_plugin.cpp       |   118 +
 .../Plugins/PMP/Triangulate_facets_plugin.cpp      |    86 +
 .../Polyhedron/Plugins/Point_set/CMakeLists.txt    |    63 +
 .../Point_set/Features_detection_plugin.cpp        |   119 +
 .../Plugins/Point_set/Features_detection_plugin.ui |   146 +
 .../Plugins/Point_set/Merge_point_sets_plugin.cpp  |    94 +
 .../Point_set/Point_set_average_spacing_plugin.cpp |   119 +
 .../Point_set_bilateral_smoothing_plugin.cpp       |   138 +
 .../Point_set_bilateral_smoothing_plugin.ui        |   143 +
 .../Point_set/Point_set_interference_plugin.cpp    |   109 +
 .../Point_set_normal_estimation_plugin.cpp         |   289 +
 .../Point_set_normal_estimation_plugin.ui          |   415 +
 .../Point_set_outliers_removal_plugin.cpp          |   117 +
 .../Point_set/Point_set_outliers_removal_plugin.ui |     0
 .../Point_set/Point_set_selection_plugin.cpp       |   513 +
 .../Point_set/Point_set_selection_widget.ui        |     0
 .../Point_set/Point_set_shape_detection_plugin.cpp |   398 +
 .../Point_set/Point_set_shape_detection_plugin.ui  |   284 +
 .../Point_set/Point_set_simplification_plugin.cpp  |   203 +
 .../Point_set/Point_set_simplification_plugin.ui   |   217 +
 .../Point_set/Point_set_smoothing_plugin.cpp       |    99 +
 .../Point_set/Point_set_upsampling_plugin.cpp      |   156 +
 .../Point_set/Point_set_upsampling_plugin.ui       |   169 +
 .../Plugins/Point_set/Point_set_wlop_plugin.cpp    |   131 +
 .../Plugins/Point_set/Point_set_wlop_plugin.ui     |   135 +
 .../Point_set/Surface_reconstruction_plugin.cpp    |   867 +
 .../Point_set/Surface_reconstruction_plugin.ui     |   496 +
 .../Surface_reconstruction_plugin_impl.cpp         |   238 +
 .../Plugins/Subdivision_methods/CMakeLists.txt     |     0
 .../Subdivision_methods_plugin.cpp                 |   119 +
 .../Polyhedron/Plugins/Surface_mesh/CMakeLists.txt |     0
 .../Surface_mesh/Mesh_segmentation_plugin.cpp      |   349 +
 .../Surface_mesh/Mesh_segmentation_widget.ui       |   199 +
 .../Surface_mesh/Mesh_simplification_plugin.cpp    |   102 +
 .../Plugins/Surface_mesh/Mesher_base.cpp           |     0
 .../Polyhedron/Plugins/Surface_mesh/Mesher_base.h  |     0
 .../Surface_mesh/Parameterization_plugin.cpp       |   197 +
 .../Plugins/Surface_mesh/Remeshing_dialog.ui       |   175 +
 .../Plugins/Surface_mesh/Remeshing_plugin.cpp      |   143 +
 .../Surface_mesh/Remeshing_plugin_cgal_code.cpp    |     0
 .../Scene_polyhedron_shortest_path_item.cpp        |   613 +
 .../Scene_polyhedron_shortest_path_item.h          |   119 +
 .../Plugins/Surface_mesh/Shortest_path_plugin.cpp  |   316 +
 .../Plugins/Surface_mesh/Shortest_path_widget.ui   |    92 +
 .../Surface_mesh_deformation/CMakeLists.txt        |     7 +
 .../Surface_mesh_deformation/Deform_mesh.ui        |   440 +
 .../Edit_polyhedron_plugin.cpp                     |   550 +
 .../Scene_edit_polyhedron_item.cpp                 |  1703 ++
 .../Scene_edit_polyhedron_item.h                   |   365 +
 .../Scene_edit_polyhedron_item_config.h            |     0
 .../demo/Polyhedron/Point_dialog_config.h          |     0
 3rdparty/CGAL/demo/Polyhedron/Polyhedron_3.cpp     |    16 +
 3rdparty/CGAL/demo/Polyhedron/Polyhedron_3.qrc     |    50 +
 3rdparty/CGAL/demo/Polyhedron/Polyhedron_demo.cpp  |   126 +
 .../demo/Polyhedron/Polyhedron_demo.h              |     0
 .../demo/Polyhedron/Polyhedron_demo_config.h       |     0
 .../Polyhedron_demo_detect_sharp_edges.h           |     0
 .../Polyhedron/Polyhedron_demo_plugin_helper.cpp   |    96 +
 .../demo/Polyhedron/Polyhedron_type.h              |     0
 .../demo/Polyhedron/Polyhedron_type_fwd.h          |     0
 3rdparty/CGAL/demo/Polyhedron/Preferences.ui       |    78 +
 3rdparty/CGAL/demo/Polyhedron/Scene.cpp            |  1274 +
 3rdparty/CGAL/demo/Polyhedron/Scene.h              |   331 +
 .../demo/Polyhedron/Scene_basic_objects_config.h   |     0
 .../demo/Polyhedron/Scene_c2t3_item.cpp            |     0
 .../demo/Polyhedron/Scene_c2t3_item.h              |     0
 .../demo/Polyhedron/Scene_c2t3_item_config.h       |     0
 3rdparty/CGAL/demo/Polyhedron/Scene_c3t3_item.cpp  |  1544 ++
 3rdparty/CGAL/demo/Polyhedron/Scene_c3t3_item.h    |   142 +
 .../demo/Polyhedron/Scene_c3t3_item_config.h       |     0
 .../demo/Polyhedron/Scene_config.h                 |     0
 .../demo/Polyhedron/Scene_find_items.h             |     0
 3rdparty/CGAL/demo/Polyhedron/Scene_group_item.cpp |   236 +
 3rdparty/CGAL/demo/Polyhedron/Scene_image_item.cpp |   941 +
 3rdparty/CGAL/demo/Polyhedron/Scene_image_item.h   |    55 +
 .../CGAL/demo/Polyhedron/Scene_image_item_config.h |    10 +
 .../Polyhedron/Scene_implicit_function_item.cpp    |   647 +
 .../demo/Polyhedron/Scene_implicit_function_item.h |    83 +
 .../Scene_implicit_function_item_config.h          |     0
 3rdparty/CGAL/demo/Polyhedron/Scene_item.cpp       |   241 +
 .../demo/Polyhedron/Scene_nef_polyhedron_item.cpp  |   744 +
 .../demo/Polyhedron/Scene_nef_polyhedron_item.h    |    74 +
 .../Polyhedron/Scene_nef_polyhedron_item_config.h  |     0
 3rdparty/CGAL/demo/Polyhedron/Scene_plane_item.cpp |   267 +
 3rdparty/CGAL/demo/Polyhedron/Scene_plane_item.h   |   100 +
 .../Polyhedron/Scene_points_with_normal_item.cpp   |   787 +
 .../Polyhedron/Scene_points_with_normal_item.h     |    96 +
 .../Scene_points_with_normal_item_config.h         |     0
 .../demo/Polyhedron/Scene_polygon_soup_item.cpp    |   885 +
 .../CGAL/demo/Polyhedron/Scene_polygon_soup_item.h |   161 +
 .../Polyhedron/Scene_polygon_soup_item_config.h    |     0
 .../CGAL/demo/Polyhedron/Scene_polyhedron_item.cpp |  1764 ++
 .../CGAL/demo/Polyhedron/Scene_polyhedron_item.h   |   143 +
 .../demo/Polyhedron/Scene_polyhedron_item_config.h |     0
 .../Polyhedron/Scene_polyhedron_item_decorator.cpp |   102 +
 .../Polyhedron/Scene_polyhedron_item_decorator.h   |    65 +
 .../Scene_polyhedron_item_decorator_config.h       |     0
 .../Scene_polyhedron_item_k_ring_selection.cpp     |     0
 .../Scene_polyhedron_item_k_ring_selection.h       |   350 +
 ...Scene_polyhedron_item_k_ring_selection_config.h |     0
 .../Polyhedron/Scene_polyhedron_selection_item.cpp |  2126 ++
 .../Polyhedron/Scene_polyhedron_selection_item.h   |   941 +
 .../Scene_polyhedron_selection_item_config.h       |     0
 .../Scene_polyhedron_shortest_path_item_config.h   |     0
 .../Scene_polyhedron_transform_item_config.h       |     0
 .../CGAL/demo/Polyhedron/Scene_polylines_item.cpp  |   585 +
 .../CGAL/demo/Polyhedron/Scene_polylines_item.h    |    76 +
 .../demo/Polyhedron/Scene_polylines_item_config.h  |     0
 .../CGAL/demo/Polyhedron/Scene_spheres_item.cpp    |   283 +
 3rdparty/CGAL/demo/Polyhedron/Scene_spheres_item.h |    54 +
 .../demo/Polyhedron/Scene_surface_mesh_item.cpp    |   606 +
 .../CGAL/demo/Polyhedron/Scene_surface_mesh_item.h |    63 +
 .../Polyhedron/Scene_surface_mesh_item_config.h    |    10 +
 .../Polyhedron/Scene_textured_polyhedron_item.cpp  |   424 +
 .../Polyhedron/Scene_textured_polyhedron_item.h    |    56 +
 .../Scene_textured_polyhedron_item_config.h        |     0
 .../demo/Polyhedron/Show_point_dialog.cpp          |     0
 .../demo/Polyhedron/Show_point_dialog.h            |     0
 3rdparty/CGAL/demo/Polyhedron/Show_point_dialog.ui |   161 +
 .../demo/Polyhedron/Statistics_on_item_dialog.ui   |     0
 3rdparty/CGAL/demo/Polyhedron/TextRenderer.cpp     |    92 +
 .../demo/Polyhedron/Textured_polyhedron_type.h     |     0
 .../demo/Polyhedron/Textured_polyhedron_type_fwd.h |     0
 .../demo/Polyhedron/Travel_isolated_components.h   |     0
 .../demo/Polyhedron/UseCGAL_polyhedron_demo.cmake  |     0
 3rdparty/CGAL/demo/Polyhedron/Viewer.cpp           |  1688 ++
 3rdparty/CGAL/demo/Polyhedron/Viewer.h             |   181 +
 .../demo/Polyhedron/concurrent_mesher_config.cfg   |     0
 .../{CGAL-4.8 => CGAL}/demo/Polyhedron/config.h    |     0
 .../demo/Polyhedron/create_sphere.h                |     0
 .../demo/Polyhedron/data/anchor.off                |     0
 .../demo/Polyhedron/data/bones.off                 |     0
 .../demo/Polyhedron/data/couplingdown.off          |     0
 .../demo/Polyhedron/data/cow.off                   |     0
 .../demo/Polyhedron/data/cross.off                 |     0
 .../demo/Polyhedron/data/cube-ouvert.off           |     0
 .../demo/Polyhedron/data/cube-shuffled.off         |     0
 .../demo/Polyhedron/data/cube.off                  |     0
 .../demo/Polyhedron/data/cube4-shuffled.off        |     0
 .../demo/Polyhedron/data/dragknob.off              |     0
 .../demo/Polyhedron/data/elephant.off              |     0
 .../demo/Polyhedron/data/ellipsoid.off             |     0
 .../demo/Polyhedron/data/handle.off                |     0
 .../demo/Polyhedron/data/icosahedron.off           |     0
 .../demo/Polyhedron/data/joint.off                 |     0
 .../demo/Polyhedron/data/knot1.off                 |     0
 .../demo/Polyhedron/data/knot2.off                 |     0
 .../demo/Polyhedron/data/man.off                   |     0
 .../demo/Polyhedron/data/mushroom.off              |     0
 .../demo/Polyhedron/data/negative.off              |     0
 .../demo/Polyhedron/data/oblong-shuffled.off       |     0
 .../demo/Polyhedron/data/oblong.off                |     0
 .../demo/Polyhedron/data/pinion.off                |     0
 .../demo/Polyhedron/data/pipe.off                  |     0
 .../demo/Polyhedron/data/pyramid.off               |     0
 .../demo/Polyhedron/data/rotor.off                 |     0
 .../demo/Polyhedron/data/sphere.off                |     0
 .../demo/Polyhedron/data/spool.off                 |     0
 .../demo/Polyhedron/data/star.off                  |     0
 .../demo/Polyhedron/data/translated-cube.off       |     0
 .../demo/Polyhedron/data/tripod.off                |     0
 .../Polyhedron/implicit_functions/CMakeLists.txt   |     0
 .../Implicit_function_interface.h                  |     0
 .../implicit_functions/Klein_implicit_function.cpp |     0
 .../Sphere_implicit_function.cpp                   |     0
 .../Tanglecube_implicit_function.cpp               |     0
 .../demo/Polyhedron/include/CGAL/Dualizer.h        |     0
 .../demo/Polyhedron/include/CGAL/Make_bar.h        |     0
 .../demo/Polyhedron/include/CGAL/Make_quad_soup.h  |     0
 .../Polyhedron/include/CGAL/Make_triangle_soup.h   |     0
 .../Polyhedron/include/CGAL/Polyhedron_kernel.h    |     0
 .../include/CGAL/Textured_polyhedron_builder.h     |     0
 .../include/CGAL/Triangulation_file_input.h        |   103 +
 .../demo/Polyhedron/include/CGAL/gocad_io.h        |     0
 .../Polyhedron/include/CGAL/statistics_helpers.h   |     0
 .../Polyhedron/include/CGAL/textured_polyhedron.h  |     0
 .../demo/Polyhedron/include/CGAL/translate.h       |     0
 .../CGAL/demo/Polyhedron/include/Point_set_3.h     |   332 +
 .../demo/Polyhedron/include/UI_point_3.h           |     0
 .../demo/Polyhedron/opengl_tools.h                 |     0
 .../demo/Polyhedron/polyhedron_demo_macros.cmake   |     0
 .../demo/Polyhedron/resources/about.html           |     0
 .../CGAL/demo/Polyhedron/resources/add_facet1.png  |   Bin 0 -> 3043 bytes
 .../CGAL/demo/Polyhedron/resources/add_facet2.png  |   Bin 0 -> 3103 bytes
 .../demo/Polyhedron/resources/back.png             |   Bin
 .../demo/Polyhedron/resources/boolean-diff.png     |   Bin
 .../Polyhedron/resources/boolean-intersection.png  |   Bin
 .../demo/Polyhedron/resources/boolean-union.png    |   Bin
 .../demo/Polyhedron/resources/bot.png              |   Bin
 .../demo/Polyhedron/resources/cgal_logo.xpm        |     0
 .../demo/Polyhedron/resources/check-off.png        |   Bin
 .../demo/Polyhedron/resources/check-off.svg        |     0
 .../demo/Polyhedron/resources/check-on.png         |   Bin
 .../demo/Polyhedron/resources/check.svg            |     0
 .../demo/Polyhedron/resources/convex-hull.png      |   Bin
 .../demo/Polyhedron/resources/down.png             |   Bin
 .../demo/Polyhedron/resources/editcopy.png         |   Bin
 .../demo/Polyhedron/resources/euler_center.png     |   Bin 0 -> 4294 bytes
 .../CGAL/demo/Polyhedron/resources/euler_facet.png |   Bin 0 -> 4033 bytes
 .../demo/Polyhedron/resources/euler_vertex.png     |   Bin 0 -> 4499 bytes
 .../demo/Polyhedron/resources/front.png            |   Bin
 .../demo/Polyhedron/resources/general_collapse.png |   Bin 0 -> 9417 bytes
 .../demo/Polyhedron/resources/kernel.png           |   Bin
 .../demo/Polyhedron/resources/left.png             |   Bin
 .../demo/Polyhedron/resources/minus.png            |   Bin
 .../demo/Polyhedron/resources/plus.png             |   Bin
 .../demo/Polyhedron/resources/right.png            |   Bin
 .../CGAL/demo/Polyhedron/resources/shader_c3t3.f   |    42 +
 .../CGAL/demo/Polyhedron/resources/shader_c3t3.v   |    17 +
 .../demo/Polyhedron/resources/shader_c3t3_edges.f  |     9 +
 .../demo/Polyhedron/resources/shader_c3t3_edges.v  |    11 +
 .../Polyhedron/resources/shader_c3t3_spheres.v     |    22 +
 .../demo/Polyhedron/resources/shader_instanced.v   |     0
 .../resources/shader_no_light_no_selection.f       |     0
 .../Polyhedron/resources/shader_plane_two_faces.f  |     0
 .../demo/Polyhedron/resources/shader_spheres.v     |    21 +
 .../demo/Polyhedron/resources/shader_with_light.f  |    36 +
 .../demo/Polyhedron/resources/shader_with_light.v  |     0
 .../Polyhedron/resources/shader_with_texture.f     |     0
 .../Polyhedron/resources/shader_with_texture.v     |     0
 .../resources/shader_with_textured_edges.f         |     0
 .../resources/shader_with_textured_edges.v         |     0
 .../Polyhedron/resources/shader_without_light.f    |    10 +
 .../Polyhedron/resources/shader_without_light.v    |     0
 .../demo/Polyhedron/resources/simplification.png   |   Bin
 .../demo/Polyhedron/resources/top.png              |   Bin
 .../demo/Polyhedron/resources/up.png               |   Bin
 .../{CGAL-4.8 => CGAL}/demo/Polyhedron/texture.cpp |     0
 .../{CGAL-4.8 => CGAL}/demo/Polyhedron/texture.h   |     0
 .../CGAL/demo/Polyhedron/triangulate_primitive.h   |   156 +
 3rdparty/CGAL/demo/Polyhedron_IO/CMakeLists.txt    |    28 +
 .../{CGAL-4.8 => CGAL}/demo/Polyhedron_IO/README   |     0
 .../demo/Polyhedron_IO/geomview_demo.cpp           |     0
 .../demo/Polyhedron_IO/viewpoint2off.cpp           |     0
 .../demo/Polyline_simplification_2/CMakeLists.txt  |    51 +
 .../Polyline_simplification_2.cpp                  |     0
 .../Polyline_simplification_2.qrc                  |     0
 .../Polyline_simplification_2.ui                   |     0
 .../about_Polyline_simplification_2.html           |     0
 .../data/all_crossed.poly                          |     0
 .../demo/Polyline_simplification_2/data/bee.poly   |     0
 .../Polyline_simplification_2/data/letter_G.poly   |     0
 .../Polyline_simplification_2/data/letter_P.poly   |     0
 .../Polyline_simplification_2/data/letter_T.poly   |     0
 .../Polyline_simplification_2/data/letter_c.poly   |     0
 .../Polyline_simplification_2/data/letter_d.poly   |     0
 .../Polyline_simplification_2/data/letter_q.poly   |     0
 .../Polyline_simplification_2/data/letter_u.poly   |     0
 .../Polyline_simplification_2/data/letters_cd.poly |     0
 .../demo/Polyline_simplification_2/data/map_1.poly |     0
 .../demo/Polyline_simplification_2/data/map_2.poly |     0
 .../demo/Polyline_simplification_2/data/map_3.poly |     0
 .../demo/Polyline_simplification_2/data/maps.poly  |     0
 .../Polyline_simplification_2/data/norway.poly     |     0
 .../icons/triangulation.pdf                        |   Bin
 .../icons/triangulation.png                        |   Bin
 .../Qt/Polyline_simplification_2_graphics_item.h   |     0
 .../CGAL/Qt/TriangulationArrangementGraphicsItem.h |     0
 .../Principal_component_analysis/CMakeLists.txt    |    87 +
 .../Principal_component_analysis/MainWindow.cpp    |     0
 .../demo/Principal_component_analysis/MainWindow.h |     0
 .../Principal_component_analysis/MainWindow.ui     |     0
 .../demo/Principal_component_analysis/PCA_demo.cpp |     0
 .../demo/Principal_component_analysis/PCA_demo.qrc |     0
 .../demo/Principal_component_analysis/Scene.cpp    |     0
 .../demo/Principal_component_analysis/Scene.h      |     0
 .../demo/Principal_component_analysis/Viewer.cpp   |     0
 .../demo/Principal_component_analysis/Viewer.h     |     0
 .../Principal_component_analysis/data/cylinder.off |     0
 .../data/cylinder_locally_refined.off              |     0
 .../data/ellipsoid.off                             |     0
 .../Principal_component_analysis/render_edges.h    |     0
 .../resources/about.html                           |     0
 .../resources/cgal_logo.xpm                        |     0
 .../demo/Principal_component_analysis/types.h      |     0
 .../demo/Segment_Delaunay_graph_2/CMakeLists.txt   |    59 +
 .../Segment_Delaunay_graph_2/Segment_voronoi_2.cpp |     0
 .../Segment_Delaunay_graph_2/Segment_voronoi_2.qrc |     0
 .../Segment_Delaunay_graph_2/Segment_voronoi_2.ui  |     0
 .../about_Segment_voronoi_2.html                   |     0
 .../icons/circumcenter.pdf                         |     0
 .../icons/circumcenter.png                         |   Bin
 .../icons/conflict_zone.pdf                        |   Bin
 .../icons/conflict_zone.png                        |   Bin
 .../icons/constrained_triangulation.pdf            |   Bin
 .../icons/constrained_triangulation.png            |   Bin
 .../constrained_triangulation_show_constraints.pdf |   Bin
 .../constrained_triangulation_show_constraints.png |   Bin
 .../constrained_triangulation_show_in_domain.pdf   |   Bin
 .../constrained_triangulation_show_in_domain.png   |   Bin
 .../icons/moving_point.pdf                         |   Bin
 .../icons/moving_point.png                         |   Bin
 .../icons/triangulation.pdf                        |   Bin
 .../icons/triangulation.png                        |   Bin
 .../include/CGAL/Constraints_loader.h              |     0
 .../demo/Segment_Delaunay_graph_2/svd-typedefs.h   |     0
 .../Segment_Delaunay_graph_Linf_2/CMakeLists.txt   |    59 +
 .../Segment_voronoi_2.qrc                          |     0
 .../Segment_voronoi_2.ui                           |     0
 .../Segment_voronoi_linf_2.cpp                     |     0
 .../about_Segment_voronoi_2.html                   |     0
 .../icons/circumcenter.pdf                         |     0
 .../icons/circumcenter.png                         |   Bin
 .../icons/conflict_zone.pdf                        |   Bin
 .../icons/conflict_zone.png                        |   Bin
 .../icons/constrained_triangulation.pdf            |   Bin
 .../icons/constrained_triangulation.png            |   Bin
 .../constrained_triangulation_show_constraints.pdf |   Bin
 .../constrained_triangulation_show_constraints.png |   Bin
 .../constrained_triangulation_show_in_domain.pdf   |   Bin
 .../constrained_triangulation_show_in_domain.png   |   Bin
 .../icons/moving_point.pdf                         |   Bin
 .../icons/moving_point.png                         |   Bin
 .../icons/triangulation.pdf                        |   Bin
 .../icons/triangulation.png                        |   Bin
 .../include/CGAL/Constraints_loader.h              |     0
 .../Segment_Delaunay_graph_Linf_2/svd-typedefs.h   |     0
 3rdparty/CGAL/demo/Snap_rounding_2/CMakeLists.txt  |    50 +
 .../demo/Snap_rounding_2/Snap_rounding_2.cpp       |     0
 .../demo/Snap_rounding_2/Snap_rounding_2.qrc       |     0
 .../demo/Snap_rounding_2/Snap_rounding_2.ui        |     0
 .../Snap_rounding_2/about_Snap_rounding_2.html     |     0
 .../demo/Snap_rounding_2/icons/grid.png            |   Bin
 .../demo/Snap_rounding_2/icons/snapped.png         |   Bin
 .../demo/Snap_rounding_2/icons/unsnapped.png       |   Bin
 .../CGAL/demo/Spatial_searching_2/CMakeLists.txt   |    52 +
 .../demo/Spatial_searching_2/NearestNeighbor.h     |     0
 .../Spatial_searching_2/Spatial_searching_2.cpp    |     0
 .../Spatial_searching_2/Spatial_searching_2.qrc    |     0
 .../Spatial_searching_2/Spatial_searching_2.ui     |     0
 .../about_Spatial_searching_2.html                 |     0
 3rdparty/CGAL/demo/Stream_lines_2/CMakeLists.txt   |    51 +
 .../demo/Stream_lines_2/Stream_lines_2.cpp         |     0
 .../demo/Stream_lines_2/Stream_lines_2.qrc         |     0
 .../demo/Stream_lines_2/Stream_lines_2.ui          |     0
 .../demo/Stream_lines_2/about_Stream_lines_2.html  |     0
 .../demo/Stream_lines_2/data/vnoise.vec.cin        |     0
 .../demo/Surface_mesh_deformation/CMakeLists.txt   |    34 +
 .../deform_mesh_for_botsch08_format.cpp            |     0
 3rdparty/CGAL/demo/Surface_mesher/CMakeLists.txt   |   128 +
 .../demo/Surface_mesher/File_XT.h                  |     0
 .../demo/Surface_mesher/Raw_image_dialog.cpp       |     0
 .../demo/Surface_mesher/Raw_image_dialog.h         |     0
 .../CGAL/demo/Surface_mesher/Surface_mesher.cpp    |    23 +
 .../demo/Surface_mesher/binary_image.h             |     0
 .../demo/Surface_mesher/colorlisteditor.cpp        |     0
 .../demo/Surface_mesher/colorlisteditor.h          |     0
 .../demo/Surface_mesher/get_polyhedral_surface.h   |     0
 .../demo/Surface_mesher/icons/bbox-red.png         |   Bin
 .../demo/Surface_mesher/icons/bbox-red.svg         |     0
 .../demo/Surface_mesher/icons/bbox.png             |   Bin
 .../demo/Surface_mesher/icons/bbox.svg             |     0
 .../demo/Surface_mesher/icons/cgal_logo.xpm        |     0
 .../demo/Surface_mesher/icons/fileopen.png         |   Bin
 .../demo/Surface_mesher/icons/filesave.png         |   Bin
 .../demo/Surface_mesher/icons/flip.png             |   Bin
 .../demo/Surface_mesher/icons/flip.svg             |     0
 .../demo/Surface_mesher/icons/minus.png            |   Bin
 .../demo/Surface_mesher/icons/plus.png             |   Bin
 .../demo/Surface_mesher/icons/resize.png           |   Bin
 .../demo/Surface_mesher/icons/resize.svg           |     0
 .../demo/Surface_mesher/icons/surface.png          |   Bin
 .../demo/Surface_mesher/icons/surface.svg          |     0
 .../demo/Surface_mesher/icons/twosides.png         |   Bin
 .../demo/Surface_mesher/icons/twosides.svg         |     0
 .../demo/Surface_mesher/mainwindow.cpp             |     0
 .../demo/Surface_mesher/mainwindow.h               |     0
 .../demo/Surface_mesher/polyhedral_surface.cpp     |     0
 .../demo/Surface_mesher/polyhedral_surface.h       |     0
 .../demo/Surface_mesher/surface.h                  |     0
 .../demo/Surface_mesher/surface_mesher.qrc         |     0
 .../demo/Surface_mesher/ui/mainwindow.ui           |     0
 .../demo/Surface_mesher/ui/optionsdialog.ui        |     0
 .../demo/Surface_mesher/ui/raw_image.ui            |     0
 .../demo/Surface_mesher/ui/values_list.ui          |     0
 .../demo/Surface_mesher/values_list.cpp            |     0
 .../demo/Surface_mesher/values_list.h              |     0
 .../demo/Surface_mesher/values_list.qrc            |     0
 .../demo/Surface_mesher/viewer.cpp                 |     0
 .../demo/Surface_mesher/viewer.h                   |     0
 3rdparty/CGAL/demo/Surface_mesher/volume.cpp       |  1606 ++
 3rdparty/CGAL/demo/Surface_mesher/volume.h         |   388 +
 .../{CGAL-4.8 => CGAL}/demo/Three/CMakeLists.txt   |     0
 .../Three/Example_plugin/Basic_dialog_plugin.ui    |    91 +
 .../demo/Three/Example_plugin/Basic_dock_widget.ui |    61 +
 .../Three/Example_plugin/Basic_item_plugin.cpp     |    91 +
 .../demo/Three/Example_plugin/Basic_plugin.cpp     |   141 +
 .../CGAL/demo/Three/Example_plugin/CMakeLists.txt  |    48 +
 .../Three/Example_plugin/Dock_widget_plugin.cpp    |   102 +
 .../demo/Three/Example_plugin/Example_plugin.cpp   |   203 +
 .../demo/Three/Example_plugin/Example_plugin.ui}   |     0
 .../Three/Example_plugin/Group_item_plugin.cpp     |    86 +
 3rdparty/CGAL/demo/Triangulation_2/CMakeLists.txt  |   106 +
 .../Constrained_Delaunay_triangulation_2.cpp       |   889 +
 .../Constrained_Delaunay_triangulation_2.qrc       |     0
 .../Constrained_Delaunay_triangulation_2.ui        |     0
 .../demo/Triangulation_2/DelaunayMeshInsertSeeds.h |     0
 .../Triangulation_2/Delaunay_triangulation_2.cpp   |     0
 .../Triangulation_2/Delaunay_triangulation_2.qrc   |     0
 .../Triangulation_2/Delaunay_triangulation_2.ui    |     0
 .../RegularTriangulationRemoveVertex.h             |     0
 .../Triangulation_2/Regular_triangulation_2.cpp    |     0
 .../Triangulation_2/Regular_triangulation_2.qrc    |     0
 .../Triangulation_2/Regular_triangulation_2.ui     |     0
 .../Triangulation_2/TriangulationCircumcircle.h    |     0
 .../Triangulation_2/TriangulationConflictZone.h    |     0
 .../Triangulation_2/TriangulationMovingPoint.h     |     0
 .../TriangulationPointInputAndConflictZone.h       |     0
 .../Triangulation_2/TriangulationRemoveVertex.h    |     0
 ...about_Constrained_Delaunay_triangulation_2.html |     0
 .../about_Delaunay_triangulation_2.html            |     0
 .../about_Regular_triangulation_2.html             |     0
 .../demo/Triangulation_2/data/butterfly            |     0
 .../demo/Triangulation_2/data/butterfly.edg        |     0
 .../demo/Triangulation_2/data/clusters.edg         |     0
 .../demo/Triangulation_2/data/clusters.poly        |     0
 .../demo/Triangulation_2/data/clusters2.edg        |     0
 .../demo/Triangulation_2/data/fish                 |     0
 .../demo/Triangulation_2/data/fish.edg             |     0
 .../demo/Triangulation_2/data/fish.poly            |     0
 .../demo/Triangulation_2/data/img1.edg             |     0
 .../demo/Triangulation_2/data/img2.edg             |     0
 .../demo/Triangulation_2/data/img3.edg             |     0
 .../demo/Triangulation_2/data/img4.edg             |     0
 .../demo/Triangulation_2/data/img5.edg             |     0
 .../demo/Triangulation_2/data/img6.edg             |     0
 .../demo/Triangulation_2/data/img7.edg             |     0
 .../demo/Triangulation_2/data/img8.edg             |     0
 .../demo/Triangulation_2/data/lettre_A.edg         |     0
 .../demo/Triangulation_2/data/lettre_A_2.edg       |     0
 .../demo/Triangulation_2/data/norway.edg           |     0
 .../demo/Triangulation_2/data/poisson              |     0
 .../demo/Triangulation_2/data/tr                   |     0
 .../demo/Triangulation_2/data/triangulation.cgal   |     0
 .../demo/Triangulation_2/data/trivial.poly         |     0
 .../demo/Triangulation_2/icons/circumcenter.pdf    |     0
 .../demo/Triangulation_2/icons/circumcenter.png    |   Bin
 .../demo/Triangulation_2/icons/conflict_zone.pdf   |   Bin
 .../demo/Triangulation_2/icons/conflict_zone.png   |   Bin
 .../icons/constrained_triangulation.pdf            |   Bin
 .../icons/constrained_triangulation.png            |   Bin
 .../constrained_triangulation_show_constraints.pdf |   Bin
 .../constrained_triangulation_show_constraints.png |   Bin
 .../constrained_triangulation_show_in_domain.pdf   |   Bin
 .../constrained_triangulation_show_in_domain.png   |   Bin
 .../demo/Triangulation_2/icons/moving_point.pdf    |   Bin
 .../demo/Triangulation_2/icons/moving_point.png    |   Bin
 .../demo/Triangulation_2/icons/triangulation.pdf   |   Bin
 .../demo/Triangulation_2/icons/triangulation.png   |   Bin
 .../CGAL/Lipschitz_sizing_field_criteria_2.h       |     0
 3rdparty/CGAL/demo/Triangulation_3/CMakeLists.txt  |    99 +
 .../demo/Triangulation_3/MainWindow.cpp            |     0
 .../demo/Triangulation_3/MainWindow.h              |     0
 .../demo/Triangulation_3/MainWindow.ui             |     0
 .../demo/Triangulation_3/PreferenceDlg.cpp         |     0
 .../demo/Triangulation_3/PreferenceDlg.h           |     0
 .../demo/Triangulation_3/Scene.cpp                 |     0
 .../demo/Triangulation_3/Scene.h                   |     0
 .../demo/Triangulation_3/T3_demo.cpp               |     0
 .../demo/Triangulation_3/T3_demo.qrc               |     0
 .../demo/Triangulation_3/Viewer.cpp                |     0
 .../demo/Triangulation_3/Viewer.h                  |     0
 .../demo/Triangulation_3/documentation/about.html  |     0
 .../Triangulation_3/documentation/about_CGAL.html  |     0
 .../demo/Triangulation_3/icons/about_CGAL.html     |     0
 .../demo/Triangulation_3/icons/cgal_logo.xpm       |     0
 .../demo/Triangulation_3/icons/clear.jpeg          |   Bin
 .../demo/Triangulation_3/icons/coordinates.jpeg    |   Bin
 .../demo/Triangulation_3/icons/empty_sphere.jpeg   |   Bin
 .../demo/Triangulation_3/icons/fileOpen.png        |   Bin
 .../demo/Triangulation_3/icons/fileSave.png        |   Bin
 .../demo/Triangulation_3/icons/flat.png            |   Bin
 .../demo/Triangulation_3/icons/grid.jpeg           |   Bin
 .../demo/Triangulation_3/icons/insert.jpeg         |   Bin
 .../demo/Triangulation_3/icons/insert_point.jpg    |   Bin
 .../demo/Triangulation_3/icons/move_1.jpeg         |   Bin
 .../demo/Triangulation_3/icons/nearest_nb.png      |   Bin
 .../demo/Triangulation_3/icons/normal_view.jpeg    |   Bin
 .../demo/Triangulation_3/icons/pause.jpeg          |   Bin
 .../demo/Triangulation_3/icons/play.jpeg           |   Bin
 .../demo/Triangulation_3/icons/pointRandom.png     |   Bin
 .../demo/Triangulation_3/icons/preferences.jpeg    |   Bin
 .../demo/Triangulation_3/icons/quit.jpeg           |   Bin
 .../demo/Triangulation_3/icons/select_hand.jpeg    |   Bin
 .../demo/Triangulation_3/icons/show_delaunay.jpeg  |   Bin
 .../demo/Triangulation_3/icons/show_facet.jpeg     |   Bin
 .../demo/Triangulation_3/icons/show_point.jpeg     |   Bin
 .../demo/Triangulation_3/icons/show_voronoi.jpeg   |   Bin
 .../demo/Triangulation_3/icons/stereo.png          |   Bin
 .../demo/Triangulation_3/icons/stop.jpeg           |   Bin
 .../demo/Triangulation_3/typedefs.h                |     0
 .../Triangulation_3_Geomview_demos/CMakeLists.txt  |    30 +
 .../demo/Triangulation_3_Geomview_demos/README     |     0
 .../Triangulation_3_color_demo.cpp                 |     0
 .../Triangulation_3_demo.cpp                       |     0
 .../Triangulation_3_remove_demo.cpp                |     0
 .../Triangulation_3_voronoi_demo.cpp               |     0
 .../Triangulation_3_Geomview_demos/data/points     |     0
 .../demo/icons/Delaunay_triangulation_2.png        |   Bin
 3rdparty/{CGAL-4.8 => CGAL}/demo/icons/File.qrc    |     0
 3rdparty/{CGAL-4.8 => CGAL}/demo/icons/Input.qrc   |     0
 .../demo/icons/Triangulation_2.qrc                 |     0
 .../demo/icons/Voronoi_diagram_2.png               |   Bin
 3rdparty/{CGAL-4.8 => CGAL}/demo/icons/fileNew.png |   Bin
 .../{CGAL-4.8 => CGAL}/demo/icons/fileOpen.png     |   Bin
 .../{CGAL-4.8 => CGAL}/demo/icons/fileSave.png     |   Bin
 .../{CGAL-4.8 => CGAL}/demo/icons/fit-page-32.png  |   Bin
 .../{CGAL-4.8 => CGAL}/demo/icons/inputPoint.png   |   Bin
 .../{CGAL-4.8 => CGAL}/demo/icons/inputPoint.svg   |     0
 .../demo/icons/inputPolyline.png                   |   Bin
 3rdparty/{CGAL-4.8 => CGAL}/demo/icons/license.txt |     0
 .../demo/icons/zoom-best-fit.png                   |   Bin
 .../demo/icons/zoom-best-fit.svg                   |     0
 .../{CGAL-4.8 => CGAL}/demo/resources/CGAL.qrc     |     0
 .../demo/resources/about_CGAL.html                 |     0
 .../demo/resources/cgal_logo.xpm                   |     0
 .../demo/resources/cgal_logo_ipe_2013.png          |   Bin
 .../{CGAL-4.8 => CGAL}/doc_html/Manual/index.html  |     0
 .../doc_html/Manual/packages.html                  |     0
 3rdparty/{CGAL-4.8 => CGAL}/doc_html/cgal.ico      |   Bin
 .../doc_html/images/cgal_2013_grey.png             |   Bin
 3rdparty/{CGAL-4.8 => CGAL}/doc_html/index.html    |     0
 .../examples/AABB_tree/AABB_custom_example.cpp     |     0
 ...B_custom_indexed_triangle_set_array_example.cpp |     0
 .../AABB_custom_indexed_triangle_set_example.cpp   |     0
 .../AABB_custom_triangle_soup_example.cpp          |     0
 .../AABB_tree/AABB_face_graph_triangle_example.cpp |     0
 .../AABB_tree/AABB_halfedge_graph_edge_example.cpp |     0
 .../examples/AABB_tree/AABB_insertion_example.cpp  |     0
 .../AABB_tree/AABB_polyhedron_edge_example.cpp     |     0
 .../AABB_polyhedron_facet_distance_example.cpp     |     0
 .../AABB_polyhedron_facet_intersection_example.cpp |    90 +
 .../AABB_tree/AABB_ray_shooting_example.cpp        |    72 +
 .../examples/AABB_tree/AABB_segment_3_example.cpp  |     0
 .../examples/AABB_tree/AABB_triangle_3_example.cpp |     0
 3rdparty/CGAL/examples/AABB_tree/CMakeLists.txt    |    30 +
 .../CGAL/examples/AABB_tree/data/tetrahedron.off   |    11 +
 .../CMakeLists.txt                                 |    30 +
 .../boundaries.cpp                                 |     0
 .../data/half.xyz                                  |     0
 .../reconstruction_class.cpp                       |     0
 .../reconstruction_fct.cpp                         |     0
 .../reconstruction_surface_mesh.cpp                |     0
 .../examples/Algebraic_foundations/CMakeLists.txt  |    30 +
 .../algebraic_structure_dispatch.cpp               |     0
 .../Algebraic_foundations/fraction_traits.cpp      |     0
 .../implicit_interoperable_dispatch.cpp            |     0
 .../examples/Algebraic_foundations/integralize.cpp |     0
 .../Algebraic_foundations/interoperable.cpp        |     0
 .../examples/Algebraic_kernel_d/CMakeLists.txt     |     0
 .../examples/Algebraic_kernel_d/Compare_1.cpp      |     0
 .../Construct_algebraic_real_1.cpp                 |     0
 .../examples/Algebraic_kernel_d/Isolate_1.cpp      |     0
 .../examples/Algebraic_kernel_d/Sign_at_1.cpp      |     0
 .../examples/Algebraic_kernel_d/Solve_1.cpp        |     0
 .../CGAL/examples/Alpha_shapes_2/CMakeLists.txt    |    30 +
 .../examples/Alpha_shapes_2/README                 |     0
 .../examples/Alpha_shapes_2/data/fin               |     0
 .../examples/Alpha_shapes_2/ex_alpha_shapes_2.cpp  |     0
 .../Alpha_shapes_2/ex_weighted_alpha_shapes_2.cpp  |     0
 .../CGAL/examples/Alpha_shapes_3/CMakeLists.txt    |    30 +
 .../examples/Alpha_shapes_3/README                 |     0
 .../examples/Alpha_shapes_3/data/bunny_1000        |     0
 .../examples/Alpha_shapes_3/data/bunny_5000        |     0
 .../examples/Alpha_shapes_3/data/fin               |     0
 .../examples/Alpha_shapes_3/ex_alpha_shapes_3.cpp  |     0
 .../Alpha_shapes_3/ex_alpha_shapes_exact_alpha.cpp |     0
 .../ex_alpha_shapes_with_fast_location_3.cpp       |     0
 .../ex_fixed_weighted_alpha_shapes_3.cpp           |     0
 .../Alpha_shapes_3/ex_periodic_alpha_shapes_3.cpp  |     0
 .../Alpha_shapes_3/ex_weighted_alpha_shapes_3.cpp  |     0
 .../examples/Apollonius_graph_2/CMakeLists.txt     |    30 +
 .../examples/Apollonius_graph_2/README             |     0
 .../Apollonius_graph_2/ag2_exact_traits.cpp        |     0
 .../Apollonius_graph_2/ag2_exact_traits_sqrt.cpp   |     0
 .../ag2_filtered_traits_no_hidden.cpp              |     0
 .../examples/Apollonius_graph_2/ag2_hierarchy.cpp  |     0
 .../examples/Apollonius_graph_2/data/hierarchy.cin |     0
 .../examples/Apollonius_graph_2/data/sites.cin     |     0
 .../Approximate_min_ellipsoid_d/CMakeLists.txt     |     0
 .../Approximate_min_ellipsoid_d/ellipsoid.cpp      |     0
 .../ellipsoid_for_maple.cpp                        |     0
 .../examples/Arrangement_on_surface_2/Bezier.dat   |     0
 .../Arrangement_on_surface_2/Bezier_curves.cpp     |     0
 .../Arrangement_on_surface_2/Bezier_polycurve.dat  |     0
 .../Arrangement_on_surface_2/CMakeLists.txt        |    30 +
 .../examples/Arrangement_on_surface_2/Europe.dat   |     0
 .../aggregated_insertion.cpp                       |     0
 .../Arrangement_on_surface_2/algebraic_curves.cpp  |     0
 .../algebraic_segments.cpp                         |     0
 .../arr_inexact_construction_segments.h            |     0
 .../examples/Arrangement_on_surface_2/arr_print.h  |     0
 .../batched_point_location.cpp                     |     0
 .../Arrangement_on_surface_2/bgl_dual_adapter.cpp  |     0
 .../bgl_primal_adapter.cpp                         |     0
 .../bounded_planar_vertical_decomposition.cpp      |     0
 .../examples/Arrangement_on_surface_2/circles.cpp  |     0
 .../Arrangement_on_surface_2/circular_arcs.cpp     |     0
 .../circular_line_arcs.cpp                         |     0
 .../Arrangement_on_surface_2/coll_points.dat       |     0
 .../conic_multiplicities.cpp                       |     0
 .../examples/Arrangement_on_surface_2/conics.cpp   |     0
 .../consolidated_curve_data.cpp                    |     0
 .../Arrangement_on_surface_2/curve_history.cpp     |     0
 .../Arrangement_on_surface_2/dcel_extension.cpp    |     0
 .../Arrangement_on_surface_2/dcel_extension_io.cpp |     0
 .../Arrangement_on_surface_2/dual_lines.cpp        |     0
 .../Arrangement_on_surface_2/dual_with_data.cpp    |     0
 .../Arrangement_on_surface_2/edge_insertion.cpp    |     0
 .../Arrangement_on_surface_2/edge_manipulation.cpp |     0
 .../edge_manipulation_curve_history.cpp            |     0
 .../Arrangement_on_surface_2/face_extension.cpp    |     0
 .../face_extension_overlay.cpp                     |     0
 .../Arrangement_on_surface_2/fan_grids.dat         |     0
 .../generic_curve_data.cpp                         |     0
 .../Arrangement_on_surface_2/global_insertion.cpp  |     0
 .../Arrangement_on_surface_2/global_removal.cpp    |     0
 .../incremental_insertion.cpp                      |     0
 .../examples/Arrangement_on_surface_2/io.cpp       |     0
 .../Arrangement_on_surface_2/io_curve_history.cpp  |     0
 .../Arrangement_on_surface_2/io_unbounded.cpp      |     0
 .../Arrangement_on_surface_2/isolated_vertices.cpp |     0
 .../examples/Arrangement_on_surface_2/observer.cpp |     0
 .../examples/Arrangement_on_surface_2/overlay.cpp  |     0
 .../Arrangement_on_surface_2/overlay_unbounded.cpp |     0
 .../point_location_example.cpp                     |     0
 .../point_location_utils.h                         |     0
 .../examples/Arrangement_on_surface_2/points.dat   |     0
 .../Arrangement_on_surface_2/polycurve_bezier.cpp  |     0
 .../polycurve_circular_arc.cpp                     |     0
 .../Arrangement_on_surface_2/polycurve_conic.cpp   |     0
 .../polycurve_geodesic.cpp                         |     0
 .../Arrangement_on_surface_2/polycurves_basic.cpp  |     0
 .../Arrangement_on_surface_2/polylines.cpp         |     0
 .../Arrangement_on_surface_2/predefined_kernel.cpp |     0
 .../predefined_kernel_non_intersecting.cpp         |     0
 .../rational_functions.cpp                         |     0
 .../rational_functions_rational_coefficients.cpp   |     0
 .../special_edge_insertion.cpp                     |     0
 .../Arrangement_on_surface_2/spherical_insert.cpp  |     0
 .../Arrangement_on_surface_2/tracing_counting.cpp  |     0
 .../unb_planar_vertical_decomposition.cpp          |     0
 .../unbounded_non_intersecting.cpp                 |     0
 .../unbounded_rational_functions.cpp               |     0
 .../vertical_ray_shooting.cpp                      |     0
 .../examples/BGL_OpenMesh/CMakeLists.txt           |     0
 .../examples/BGL_OpenMesh/TriMesh.cpp              |     0
 .../examples/BGL_arrangement_2/CMakeLists.txt      |     0
 .../examples/BGL_arrangement_2/arr_print.h         |     0
 .../examples/BGL_arrangement_2/arr_rational_nt.h   |     0
 .../BGL_arrangement_2/arrangement_dual.cpp         |     0
 .../examples/BGL_arrangement_2/primal.cpp          |     0
 .../CGAL/examples/BGL_polyhedron_3/CMakeLists.txt  |    73 +
 .../examples/BGL_polyhedron_3/copy_polyhedron.cpp  |    86 +
 .../examples/BGL_polyhedron_3/cube.off             |     0
 .../examples/BGL_polyhedron_3/distance.cmd         |     0
 .../examples/BGL_polyhedron_3/distance.cpp         |     0
 .../BGL_polyhedron_3/incident_vertices.cmd         |     0
 .../BGL_polyhedron_3/incident_vertices.cpp         |     0
 .../CGAL/examples/BGL_polyhedron_3/kruskal.cpp     |    99 +
 .../BGL_polyhedron_3/kruskal_with_stored_id.cpp    |    89 +
 .../examples/BGL_polyhedron_3/normals.cmd          |     0
 .../examples/BGL_polyhedron_3/normals.cpp          |     0
 .../examples/BGL_polyhedron_3/range.cmd            |     0
 .../examples/BGL_polyhedron_3/range.cpp            |     0
 .../BGL_polyhedron_3/transform_iterator.cmd        |     0
 .../BGL_polyhedron_3/transform_iterator.cpp        |     0
 .../CGAL/examples/BGL_surface_mesh/CMakeLists.txt  |    28 +
 .../BGL_surface_mesh/connected_components.cpp      |     0
 .../examples/BGL_surface_mesh/data/prim.off        |     0
 .../examples/BGL_surface_mesh/prim.cmd             |     0
 .../examples/BGL_surface_mesh/prim.cpp             |     0
 .../BGL_surface_mesh/surface_mesh_dual.cpp         |    89 +
 .../examples/BGL_triangulation_2/CMakeLists.txt    |     0
 .../examples/BGL_triangulation_2/data/points.xy    |     5 +
 .../CGAL/examples/BGL_triangulation_2/dijkstra.cpp |   103 +
 .../dijkstra_with_internal_properties.cpp          |    94 +
 .../CGAL/examples/BGL_triangulation_2/emst.cpp     |    98 +
 .../examples/BGL_triangulation_2/face_graph.cpp    |     0
 .../Barycentric_coordinates_2/CMakeLists.txt       |    30 +
 .../Discrete_harmonic_coordinates_example.cpp      |     0
 .../Mean_value_coordinates_example.cpp             |     0
 .../Segment_coordinates_example.cpp                |     0
 .../Terrain_height_modeling.cpp                    |     0
 .../Triangle_coordinates_example.cpp               |     0
 .../Triangle_coordinates_speed_test.cpp            |     0
 .../Wachspress_coordinates_example.cpp             |     0
 .../Boolean_set_operations_2/CMakeLists.txt        |    30 +
 .../examples/Boolean_set_operations_2/README       |     0
 .../examples/Boolean_set_operations_2/amer_a.bps   |     0
 .../examples/Boolean_set_operations_2/amer_b.bps   |     0
 .../examples/Boolean_set_operations_2/amer_c.bps   |     0
 .../examples/Boolean_set_operations_2/amer_d.bps   |     0
 .../examples/Boolean_set_operations_2/amer_e.bps   |     0
 .../examples/Boolean_set_operations_2/amer_f.bps   |     0
 .../examples/Boolean_set_operations_2/amer_g.bps   |     0
 .../examples/Boolean_set_operations_2/amer_h.bps   |     0
 .../examples/Boolean_set_operations_2/amer_i.bps   |     0
 .../examples/Boolean_set_operations_2/amer_j.bps   |     0
 .../examples/Boolean_set_operations_2/amer_k.bps   |     0
 .../bezier_traits_adapter.cpp                      |     0
 .../bezier_traits_adapter2.cpp                     |     0
 .../Boolean_set_operations_2/bso_rational_nt.h     |     0
 .../examples/Boolean_set_operations_2/char_g.bps   |     0
 .../examples/Boolean_set_operations_2/char_g.dat   |     0
 .../examples/Boolean_set_operations_2/char_m.bps   |     0
 .../examples/Boolean_set_operations_2/char_m.dat   |     0
 .../Boolean_set_operations_2/circle_segment.cpp    |     0
 .../conic_traits_adapter.cpp                       |     0
 .../Boolean_set_operations_2/connect_polygon.cpp   |     0
 .../Boolean_set_operations_2/do_intersect.cpp      |     0
 .../Boolean_set_operations_2/dxf_union.cpp         |     0
 .../examples/Boolean_set_operations_2/input_0.bps  |     0
 .../examples/Boolean_set_operations_2/input_1.bps  |     0
 .../Boolean_set_operations_2/pgn_holes.dat         |     0
 .../Boolean_set_operations_2/print_utils.h         |     0
 .../examples/Boolean_set_operations_2/sequence.cpp |     0
 .../Boolean_set_operations_2/set_union.cpp         |     0
 .../simple_join_intersect.cpp                      |     0
 .../symmetric_difference.cpp                       |     0
 .../examples/Boolean_set_operations_2/test.dxf     |     0
 .../examples/Box_intersection_d/CMakeLists.txt     |    30 +
 .../examples/Box_intersection_d/box_grid.cpp       |     0
 .../Box_intersection_d/custom_box_grid.cpp         |     0
 .../examples/Box_intersection_d/data/points.xyz    |     0
 .../examples/Box_intersection_d/data/triangles.xyz |     0
 .../examples/Box_intersection_d/minimal.cpp        |     0
 .../examples/Box_intersection_d/minimal_self.cpp   |     0
 .../proximity_custom_box_traits.cpp                |     0
 .../Box_intersection_d/triangle_self_intersect.cpp |     0
 .../triangle_self_intersect_pointers.cpp           |     0
 3rdparty/CGAL/examples/CGAL_ipelets/CMakeLists.txt |    30 +
 .../examples/CGAL_ipelets/test_grabbers.cpp        |     0
 .../examples/CGALimageIO/CMakeLists.txt            |     0
 .../CGALimageIO/convert_raw_image_to_inr.cpp       |     0
 .../CGAL/examples/CGALimageIO/test_imageio.cpp     |    68 +
 .../{CGAL-4.8 => CGAL}/examples/CMakeLists.txt     |     0
 .../CGAL/examples/Circular_kernel_2/CMakeLists.txt |    30 +
 .../Circular_kernel_2/functor_has_on_2.cpp         |     0
 .../Circular_kernel_2/intersecting_arcs.cpp        |     0
 .../CGAL/examples/Circular_kernel_3/CMakeLists.txt |    30 +
 .../Circular_kernel_3/functor_compare_theta_3.cpp  |     0
 .../Circular_kernel_3/functor_has_on_3.cpp         |     0
 .../Circular_kernel_3/intersecting_spheres.cpp     |     0
 3rdparty/CGAL/examples/Circulator/CMakeLists.txt   |    30 +
 .../examples/Circulator/circulator_prog1.cpp       |     0
 .../examples/Circulator/circulator_prog2.cpp       |     0
 .../examples/Circulator/circulator_prog3.cpp       |     0
 .../CGAL/examples/Combinatorial_map/CMakeLists.txt |    30 +
 .../Combinatorial_map/map_3_dynamic_onmerge.cpp    |   134 +
 .../examples/Combinatorial_map/map_3_foreach.cpp   |   114 +
 .../examples/Combinatorial_map/map_3_marks.cpp     |    57 +
 .../Combinatorial_map/map_3_operations.cpp         |    68 +
 .../Combinatorial_map/map_3_simple_example.cpp     |    45 +
 .../map_3_with_colored_facets.cpp                  |    95 +
 .../Combinatorial_map/map_4_simple_example.cpp     |    48 +
 .../CGAL/examples/Cone_spanners_2/CMakeLists.txt   |    35 +
 3rdparty/CGAL/examples/Cone_spanners_2/README      |     9 +
 .../examples/Cone_spanners_2/compute_cones.cmd     |     1 +
 .../examples/Cone_spanners_2/compute_cones.cpp     |    48 +
 .../CGAL/examples/Cone_spanners_2/data/n20.cin     |    20 +
 3rdparty/CGAL/examples/Cone_spanners_2/data/n9.cin |     9 +
 .../examples/Cone_spanners_2/dijkstra_theta.cmd    |     1 +
 .../examples/Cone_spanners_2/dijkstra_theta.cpp    |   102 +
 .../CGAL/examples/Cone_spanners_2/theta_io.cmd     |     1 +
 .../CGAL/examples/Cone_spanners_2/theta_io.cpp     |    79 +
 .../examples/Convex_decomposition_3/CMakeLists.txt |    30 +
 .../list_of_convex_parts.cin                       |     0
 .../list_of_convex_parts.cpp                       |     0
 .../CGAL/examples/Convex_hull_2/CMakeLists.txt     |    32 +
 .../examples/Convex_hull_2/array_convex_hull_2.cpp |     0
 .../examples/Convex_hull_2/ch_from_cin_to_cout.cin |     0
 .../examples/Convex_hull_2/ch_from_cin_to_cout.cpp |     0
 .../examples/Convex_hull_2/ch_graham_anderson.cin  |     0
 .../examples/Convex_hull_2/ch_graham_anderson.cpp  |     0
 .../examples/Convex_hull_2/ch_timing.cpp           |     0
 .../examples/Convex_hull_2/convex_hull_yz.cin      |     0
 .../examples/Convex_hull_2/convex_hull_yz.cpp      |     0
 .../examples/Convex_hull_2/files/CD500             |     0
 .../Convex_hull_2/include/CGAL/ch_timing_2.h       |     0
 .../Convex_hull_2/include/CGAL/ch_timing_2_impl.h  |     0
 .../Convex_hull_2/iostream_convex_hull_2.cin       |     0
 .../Convex_hull_2/iostream_convex_hull_2.cpp       |     0
 .../Convex_hull_2/vector_convex_hull_2.cpp         |     0
 .../CGAL/examples/Convex_hull_3/CMakeLists.txt     |    30 +
 .../examples/Convex_hull_3/dynamic_hull_3.cpp      |     0
 .../Convex_hull_3/halfspace_intersection_3.cpp     |     0
 .../examples/Convex_hull_3/lloyd_algorithm.cpp     |     0
 .../examples/Convex_hull_3/quickhull_3.cpp         |     0
 .../examples/Core/CMakeLists.txt                   |     0
 .../{CGAL-4.8 => CGAL}/examples/Core/delaunay.cpp  |     0
 3rdparty/CGAL/examples/Envelope_2/CMakeLists.txt   |    30 +
 .../examples/Envelope_2/ch_points.dat              |     0
 .../examples/Envelope_2/convex_hull.cpp            |     0
 .../examples/Envelope_2/envelope_circles.cpp       |     0
 .../examples/Envelope_2/envelope_segments.cpp      |     0
 3rdparty/CGAL/examples/Envelope_3/CMakeLists.txt   |    30 +
 .../examples/Envelope_3/envelope_planes.cpp        |     0
 .../examples/Envelope_3/envelope_spheres.cpp       |     0
 .../examples/Envelope_3/envelope_triangles.cpp     |     0
 .../examples/Envelope_3/spheres.dat                |     0
 .../CGAL/examples/Filtered_kernel/CMakeLists.txt   |    30 +
 .../examples/Filtered_kernel/Cartesian_I.h         |     0
 .../Filtered_kernel/Filtered_predicate.cpp         |     0
 3rdparty/CGAL/examples/Generator/CMakeLists.txt    |    30 +
 .../{CGAL-4.8 => CGAL}/examples/Generator/README   |     0
 .../examples/Generator/ball_d.cpp                  |     0
 .../examples/Generator/combination_enumerator.cpp  |     0
 .../examples/Generator/cube_d.cpp                  |     0
 .../examples/Generator/grid_d.cpp                  |     0
 .../examples/Generator/name_pairs.cpp              |     0
 .../examples/Generator/random_convex_hull_2.cpp    |     0
 .../examples/Generator/random_convex_set.cpp       |     0
 .../Generator/random_degenerate_point_set.cpp      |     0
 .../examples/Generator/random_grid.cpp             |     0
 .../random_points_tetrahedron_and_triangle_3.cpp   |     0
 .../Generator/random_points_triangle_2.cpp         |     0
 .../examples/Generator/random_polygon.cpp          |     0
 .../examples/Generator/random_polygon2.cpp         |     0
 .../examples/Generator/random_segments1.cpp        |     0
 .../examples/Generator/random_segments2.cpp        |     0
 .../examples/Generator/sphere_d.cpp                |     0
 3rdparty/CGAL/examples/HalfedgeDS/CMakeLists.txt   |    30 +
 .../examples/HalfedgeDS/hds_prog_color.cpp         |     0
 .../examples/HalfedgeDS/hds_prog_compact.cpp       |     0
 .../examples/HalfedgeDS/hds_prog_compact2.cpp      |     0
 .../examples/HalfedgeDS/hds_prog_default.cpp       |     0
 .../examples/HalfedgeDS/hds_prog_edge_iterator.cpp |     0
 .../examples/HalfedgeDS/hds_prog_graph.cpp         |     0
 .../examples/HalfedgeDS/hds_prog_graph2.cpp        |     0
 .../HalfedgeDS/hds_prog_halfedge_iterator.cpp      |     0
 .../examples/HalfedgeDS/hds_prog_vector.cpp        |     0
 .../CGAL/examples/Inscribed_areas/CMakeLists.txt   |    30 +
 .../Inscribed_areas/extremal_polygon_2_area.cpp    |     0
 .../extremal_polygon_2_perimeter.cpp               |     0
 .../Inscribed_areas/largest_empty_rectangle.cpp    |     0
 .../CGAL/examples/Interpolation/CMakeLists.txt     |    30 +
 .../examples/Interpolation/README                  |     0
 .../examples/Interpolation/data/points3            |     0
 .../examples/Interpolation/interpolation_2.cpp     |     0
 .../Interpolation/linear_interpolation_2.cpp       |     0
 .../examples/Interpolation/nn_coordinates_2.cpp    |     0
 .../examples/Interpolation/nn_coordinates_3.cpp    |     0
 .../examples/Interpolation/rn_coordinates_2.cpp    |     0
 .../Interpolation/sibson_interpolation_2.cpp       |     0
 .../surface_neighbor_coordinates_3.cpp             |     0
 .../examples/Interval_skip_list/CMakeLists.txt     |    30 +
 .../examples/Interval_skip_list/intervals.cpp      |     0
 .../examples/Interval_skip_list/isl_terrain.cpp    |     0
 .../examples/Interval_skip_list/terrain.pts        |     0
 .../CGAL/examples/Jet_fitting_3/CMakeLists.txt     |    56 +
 .../examples/Jet_fitting_3/Mesh_estimation.cpp     |     0
 .../examples/Jet_fitting_3/PolyhedralSurf.h        |     0
 .../Jet_fitting_3/PolyhedralSurf_operations.h      |     0
 .../examples/Jet_fitting_3/PolyhedralSurf_rings.h  |     0
 .../examples/Jet_fitting_3/README                  |     0
 .../examples/Jet_fitting_3/Single_estimation.cpp   |     0
 .../examples/Jet_fitting_3/data/ellipe0.003.off    |     0
 .../examples/Jet_fitting_3/data/in_points_d4.txt   |     0
 .../examples/Jet_fitting_3/data/in_points_file.txt |     0
 .../Jet_fitting_3/data/poly2x^2+y^2-0.062500-off   |     0
 3rdparty/CGAL/examples/Kernel_23/CMakeLists.txt    |    30 +
 .../examples/Kernel_23/MyConstruct_bbox_2.h        |     0
 .../Kernel_23/MyConstruct_coord_iterator.h         |     0
 .../examples/Kernel_23/MyConstruct_point_2.h       |     0
 .../examples/Kernel_23/MyKernel.cpp                |     0
 .../examples/Kernel_23/MyKernel.h                  |     0
 .../examples/Kernel_23/MyPointC2.h                 |     0
 .../CGAL/examples/Kernel_23/MyPointC2_iostream.h   |    46 +
 3rdparty/CGAL/examples/Kernel_23/MySegmentC2.h     |   254 +
 .../examples/Kernel_23/cartesian_converter.cpp     |     0
 .../examples/Kernel_23/exact.cpp                   |     0
 .../examples/Kernel_23/intersection_get.cpp        |     0
 .../examples/Kernel_23/intersection_visitor.cpp    |     0
 .../examples/Kernel_23/intersections.cpp           |     0
 .../examples/Kernel_23/points_and_segment.cpp      |     0
 .../examples/Kernel_23/surprising.cpp              |     0
 .../Kinetic_data_structures/CMakeLists.txt         |    30 +
 .../Kinetic_Delaunay_triangulation_2.cpp           |     0
 .../Kinetic_Delaunay_triangulation_3.cpp           |     0
 .../Kinetic_insert_event.cpp                       |     0
 .../Kinetic_regular_triangulation_3.cpp            |     0
 .../Kinetic_data_structures/Kinetic_sort.cpp       |     0
 .../Kinetic_data_structures/Kinetic_sweepline.cpp  |     0
 .../examples/Kinetic_data_structures/data/points_1 |     0
 .../examples/Kinetic_data_structures/data/points_2 |     0
 .../examples/Kinetic_data_structures/data/points_3 |     0
 .../Kinetic_data_structures/data/sweepline.input   |     0
 .../Kinetic_data_structures/data/weighted_points_3 |     0
 .../defining_a_simulation_traits.cpp               |     0
 .../Kinetic_data_structures/trivial_kds.cpp        |     0
 .../CGAL/examples/Kinetic_framework/CMakeLists.txt |    28 +
 .../Kinetic_framework/adding_a_certificate.cpp     |     0
 .../examples/Kinetic_framework/data/points_2       |     0
 .../Kinetic_framework/data/points_with_color_2     |     0
 .../examples/Kinetic_framework/listener.cpp        |     0
 .../examples/Kinetic_framework/pointer_queue.cpp   |     0
 .../examples/Kinetic_framework/ref_counted.cpp     |     0
 .../Linear_cell_complex/CMakeLCCViewerQt.inc       |     0
 .../examples/Linear_cell_complex/CMakeLists.txt    |    59 +
 .../examples/Linear_cell_complex/README.txt        |     0
 .../Linear_cell_complex/data/armadillo.off         |     0
 .../examples/Linear_cell_complex/data/graph.txt    |     0
 .../examples/Linear_cell_complex/data/points_2     |     0
 .../examples/Linear_cell_complex/data/points_3     |     0
 .../Linear_cell_complex/data/small_points_2        |     0
 .../Linear_cell_complex/data/small_points_3        |     0
 .../Linear_cell_complex/linear_cell_complex_3.cpp  |     0
 ...linear_cell_complex_3_attributes_management.cpp |    72 +
 .../linear_cell_complex_3_viewer_qt.h              |   932 +
 ...linear_cell_complex_3_with_colored_vertices.cpp |     0
 .../linear_cell_complex_3_with_mypoint.cpp         |     0
 .../Linear_cell_complex/linear_cell_complex_4.cpp  |    72 +
 .../Linear_cell_complex/plane_graph_to_lcc_2.cpp   |     0
 .../examples/Linear_cell_complex/voronoi_2.cpp     |   174 +
 .../examples/Linear_cell_complex/voronoi_3.cpp     |   173 +
 .../CGAL/examples/Matrix_search/CMakeLists.txt     |    30 +
 .../Matrix_search/sorted_matrix_search.cpp         |    46 +
 3rdparty/CGAL/examples/Mesh_2/CMakeLists.txt       |    30 +
 .../examples/Mesh_2/conforming.cpp                 |     0
 .../examples/Mesh_2/mesh_class.cpp                 |     0
 .../examples/Mesh_2/mesh_global.cpp                |     0
 .../examples/Mesh_2/mesh_optimization.cpp          |     0
 .../examples/Mesh_2/mesh_with_seeds.cpp            |     0
 3rdparty/CGAL/examples/Mesh_3/CMakeLists.txt       |   111 +
 3rdparty/CGAL/examples/Mesh_3/data/40420.inr       |   Bin 0 -> 264 bytes
 3rdparty/CGAL/examples/Mesh_3/data/420.inr         |   Bin 0 -> 264 bytes
 .../CGAL/examples/Mesh_3/data/420.polylines.txt    |     2 +
 .../examples/Mesh_3/data/cheese.off                |     0
 .../examples/Mesh_3/data/elephant.off              |     0
 .../examples/Mesh_3/data/fandisk.off               |     0
 3rdparty/CGAL/examples/Mesh_3/data/lion-head.off   | 25034 +++++++++++++++++++
 .../examples/Mesh_3/data/liver.inr.gz              |   Bin
 .../examples/Mesh_3/data/skull_2.9.inr             |   Bin
 .../{CGAL-4.8 => CGAL}/examples/Mesh_3/debug.h     |     0
 .../examples/Mesh_3/implicit_functions.cpp         |     0
 .../examples/Mesh_3/implicit_functions.h           |     0
 .../examples/Mesh_3/mesh_3D_gray_image.cpp         |     0
 .../examples/Mesh_3/mesh_3D_gray_vtk_image.cpp     |     0
 3rdparty/CGAL/examples/Mesh_3/mesh_3D_image.cpp    |    59 +
 .../Mesh_3/mesh_3D_image_variable_size.cpp         |    69 +
 .../mesh_3D_image_with_custom_initialization.cpp   |    64 +
 .../Mesh_3/mesh_3D_image_with_features.cpp         |   108 +
 .../examples/Mesh_3/mesh_cubes_intersection.cpp    |     0
 .../mesh_cubes_intersection_with_features.cpp      |     0
 .../examples/Mesh_3/mesh_implicit_domains.cpp      |     0
 .../examples/Mesh_3/mesh_implicit_domains_2.cpp    |     0
 .../examples/Mesh_3/mesh_implicit_ellipsoid.cpp    |     0
 .../CGAL/examples/Mesh_3/mesh_implicit_sphere.cpp  |    57 +
 .../Mesh_3/mesh_implicit_sphere_variable_size.cpp  |    72 +
 .../examples/Mesh_3/mesh_optimization_example.cpp  |    68 +
 .../Mesh_3/mesh_optimization_lloyd_example.cpp     |    68 +
 .../examples/Mesh_3/mesh_polyhedral_domain.cpp     |    75 +
 .../mesh_polyhedral_domain_with_features.cpp       |    52 +
 .../mesh_two_implicit_spheres_with_balls.cpp       |   103 +
 .../CGAL/examples/Mesh_3/random_labeled_image.h    |    53 +
 3rdparty/CGAL/examples/Mesh_3/read_polylines.h     |    29 +
 .../examples/Mesh_3/remesh_polyhedral_surface.cpp  |    60 +
 .../examples/Min_annulus_d/CMakeLists.txt          |     0
 .../CGAL/examples/Min_annulus_d/min_annulus_d.cpp  |    56 +
 .../Min_annulus_d/min_annulus_d_fast_exact.cpp     |    55 +
 .../examples/Min_circle_2/CMakeLists.txt           |     0
 .../examples/Min_circle_2/min_circle_2.cpp         |     0
 .../examples/Min_ellipse_2/CMakeLists.txt          |     0
 .../examples/Min_ellipse_2/min_ellipse_2.cpp       |     0
 .../examples/Min_quadrilateral_2/CMakeLists.txt    |     0
 .../minimum_enclosing_parallelogram_2.cpp          |     0
 .../minimum_enclosing_rectangle_2.cpp              |     0
 .../minimum_enclosing_strip_2.cpp                  |     0
 .../examples/Min_sphere_d/CMakeLists.txt           |     0
 .../examples/Min_sphere_d/min_sphere_d.cpp         |     0
 .../Min_sphere_of_spheres_d/CMakeLists.txt         |     0
 .../examples/Min_sphere_of_spheres_d/benchmark.cpp |     0
 .../min_sphere_of_spheres_d_2.cpp                  |     0
 .../min_sphere_of_spheres_d_3.cpp                  |     0
 .../min_sphere_of_spheres_d_d.cpp                  |     0
 .../CGAL/examples/Minkowski_sum_2/CMakeLists.txt   |    30 +
 .../examples/Minkowski_sum_2/approx_inset.cpp      |     0
 .../examples/Minkowski_sum_2/approx_offset.cpp     |     0
 .../examples/Minkowski_sum_2/arr_conics.h          |     0
 .../examples/Minkowski_sum_2/bops_circular.h       |     0
 .../examples/Minkowski_sum_2/bops_linear.h         |     0
 .../examples/Minkowski_sum_2/exact_inset.cpp       |     0
 .../examples/Minkowski_sum_2/exact_offset.cpp      |     0
 .../examples/Minkowski_sum_2/holes.dat             |     0
 .../examples/Minkowski_sum_2/ms_rational_nt.h      |     0
 .../examples/Minkowski_sum_2/pgn_print.h           |     0
 .../examples/Minkowski_sum_2/print_utils.h         |     0
 .../examples/Minkowski_sum_2/rooms_star.dat        |     0
 .../examples/Minkowski_sum_2/spiked.dat            |     0
 .../Minkowski_sum_2/sum_by_decomposition.cpp       |     0
 .../examples/Minkowski_sum_2/sum_of_holes.cpp      |     0
 .../Minkowski_sum_2/sum_triangle_square.cpp        |     0
 .../examples/Minkowski_sum_2/sum_with_holes.cpp    |     0
 .../examples/Minkowski_sum_2/tight.dat             |     0
 .../CGAL/examples/Minkowski_sum_3/CMakeLists.txt   |    30 +
 .../examples/Minkowski_sum_3/cube.nef3             |     0
 .../examples/Minkowski_sum_3/cube_offset.cin       |     0
 .../examples/Minkowski_sum_3/cube_offset.cpp       |     0
 .../examples/Minkowski_sum_3/glide.cin             |     0
 .../examples/Minkowski_sum_3/glide.cpp             |     0
 .../examples/Modular_arithmetic/CMakeLists.txt     |    30 +
 .../examples/Modular_arithmetic/modular_filter.cpp |     0
 3rdparty/CGAL/examples/Nef_2/CMakeLists.txt        |    30 +
 .../examples/Nef_2/nef_2_construction.cpp          |     0
 .../examples/Nef_2/nef_2_intersection.cpp          |     0
 .../examples/Nef_2/nef_2_polylines.cpp             |     0
 3rdparty/CGAL/examples/Nef_3/CMakeLists.txt        |    30 +
 .../examples/Nef_3/comparison.cpp                  |     0
 .../examples/Nef_3/complex_construction.cin        |     0
 .../examples/Nef_3/complex_construction.cpp        |     0
 .../examples/Nef_3/exploration_SM.cin              |     0
 .../examples/Nef_3/exploration_SM.cpp              |     0
 .../examples/Nef_3/extended_kernel.cin             |     0
 .../examples/Nef_3/extended_kernel.cpp             |     0
 .../examples/Nef_3/handling_double_coordinates.cin |     0
 .../examples/Nef_3/handling_double_coordinates.cpp |     0
 .../examples/Nef_3/interface_polyhedron.cin        |     0
 .../examples/Nef_3/interface_polyhedron.cpp        |     0
 .../{CGAL-4.8 => CGAL}/examples/Nef_3/nefIO.cin    |     0
 .../{CGAL-4.8 => CGAL}/examples/Nef_3/nefIO.cpp    |     0
 .../examples/Nef_3/nef_3_construction.cpp          |     0
 .../examples/Nef_3/nef_3_point_location.cin        |     0
 .../examples/Nef_3/nef_3_point_location.cpp        |     0
 .../examples/Nef_3/nef_3_simple.cpp                |     0
 .../{CGAL-4.8 => CGAL}/examples/Nef_3/offIO.cin    |     0
 .../{CGAL-4.8 => CGAL}/examples/Nef_3/offIO.cpp    |     0
 .../examples/Nef_3/point_set_operations.cpp        |     0
 .../examples/Nef_3/polyline_construction.cpp       |     0
 .../examples/Nef_3/set_operations.cpp              |     0
 .../examples/Nef_3/shell_exploration.cin           |     0
 .../examples/Nef_3/shell_exploration.cpp           |     0
 .../examples/Nef_3/topological_operations.cin      |     0
 .../examples/Nef_3/topological_operations.cpp      |     0
 .../examples/Nef_3/transformation.cpp              |     0
 3rdparty/CGAL/examples/Nef_S2/CMakeLists.txt       |    32 +
 .../include/CGAL/Nef_S2/create_random_Nef_S2.h     |     0
 .../examples/Nef_S2/nef_s2_construction.cpp        |     0
 .../examples/Nef_S2/nef_s2_exploration.cpp         |     0
 .../examples/Nef_S2/nef_s2_point_location.cpp      |     0
 .../examples/Nef_S2/nef_s2_simple.cpp              |     0
 .../CMakeLists.txt                                 |    34 +
 .../data/stair-noise00.xy                          |     0
 .../data/stair.xy                                  |     0
 .../data/stair.xym                                 |     0
 .../otr2_indexed_output_example.cpp                |     0
 .../otr2_list_output_example.cpp                   |     0
 .../otr2_mass_example.cpp                          |     0
 .../otr2_simplest_example.cpp                      |    32 +
 3rdparty/CGAL/examples/Partition_2/CMakeLists.txt  |    30 +
 .../{CGAL-4.8 => CGAL}/examples/Partition_2/README |     0
 .../Partition_2/approx_convex_partition_2.cpp      |     0
 .../greene_approx_convex_partition_2.cpp           |     0
 .../Partition_2/optimal_convex_partition_2.cpp     |     0
 .../Partition_2/y_monotone_partition_2.cpp         |     0
 .../Periodic_2_triangulation_2/CMakeLists.txt      |    30 +
 .../data/triangulation_prog1.cin                   |     0
 .../p2t2_adding_handles.cpp                        |     0
 .../p2t2_colored_vertices.cpp                      |     0
 .../Periodic_2_triangulation_2/p2t2_covering.cpp   |     0
 .../p2t2_find_conflicts.cpp                        |     0
 .../p2t2_geometric_access.cpp                      |     0
 .../Periodic_2_triangulation_2/p2t2_hierarchy.cpp  |     0
 .../p2t2_info_insert_with_pair_iterator_2.cpp      |     0
 .../p2t2_info_insert_with_transform_iterator_2.cpp |     0
 .../p2t2_info_insert_with_zip_iterator_2.cpp       |     0
 .../p2t2_large_point_set.cpp                       |     0
 .../p2t2_simple_example.cpp                        |     0
 .../Periodic_3_triangulation_3/CMakeLists.txt      |    30 +
 .../examples/Periodic_3_triangulation_3/README     |     0
 .../colored_vertices.cpp                           |    40 +
 .../Periodic_3_triangulation_3/covering.cpp        |     0
 .../Periodic_3_triangulation_3/find_conflicts.cpp  |    55 +
 .../geometric_access.cpp                           |     0
 .../Periodic_3_triangulation_3/large_point_set.cpp |     0
 .../periodic_adding_handles.cpp                    |    69 +
 .../Periodic_3_triangulation_3/simple_example.cpp  |     0
 3rdparty/CGAL/examples/Point_set_2/CMakeLists.txt  |    30 +
 .../examples/Point_set_2/nearest_neighbor.cpp      |     0
 .../examples/Point_set_2/range_search.cpp          |     0
 .../examples/Point_set_processing_3/CMakeLists.txt |    82 +
 .../average_spacing_example.cpp                    |     0
 .../bilateral_smooth_point_set_example.cpp         |     0
 .../data/ChineseDragon-10kv.off                    |     0
 .../data/before_upsample.xyz                       |     0
 .../examples/Point_set_processing_3/data/camel.off |     0
 .../Point_set_processing_3/data/colors.ply         |    17 +
 .../Point_set_processing_3/data/fandisk.off        |     0
 .../data/fin90_with_PCA_normals.xyz                |     0
 .../examples/Point_set_processing_3/data/oni.xyz   |     0
 .../Point_set_processing_3/data/sphere_1k.xyz      |     0
 .../Point_set_processing_3/data/sphere_20k.xyz     |     0
 .../data/sphere_20k_normal.xyz                     |     0
 .../edge_aware_upsample_point_set_example.cpp      |     0
 .../Point_set_processing_3/edges_example.cpp       |     0
 .../grid_simplification_example.cpp                |     0
 .../grid_simplify_indices.cpp                      |    60 +
 .../hierarchy_simplification_example.cpp           |     0
 .../jet_smoothing_example.cpp                      |     0
 .../Point_set_processing_3/normal_estimation.cmd   |     0
 .../Point_set_processing_3/normal_estimation.cpp   |     0
 .../Point_set_processing_3/normals_example.cpp     |     0
 .../Point_set_processing_3/property_map.cpp        |     0
 .../random_simplification_example.cpp              |     0
 .../read_ply_points_with_colors_example.cpp        |   101 +
 .../read_write_xyz_point_set_example.cpp           |     0
 .../remove_outliers_example.cpp                    |     0
 ...p_simplify_and_regularize_point_set_example.cpp |     0
 .../Point_set_shape_detection_3/CMakeLists.txt     |    37 +
 .../Point_set_shape_detection_3/data/cube.pwn      |     0
 .../efficient_RANSAC_basic.cpp                     |     0
 .../efficient_RANSAC_custom_shape.cpp              |     0
 .../efficient_RANSAC_custom_shape.h                |     0
 .../efficient_RANSAC_parameters.cpp                |   131 +
 .../efficient_RANSAC_point_access.cpp              |     0
 .../plane_regularization.cpp                       |    53 +
 .../CMakeLists.txt                                 |     0
 .../data/kitten.xyz                                |     0
 .../data/sphere926.pwn                             |     0
 .../poisson_reconstruction.cmd                     |     0
 .../poisson_reconstruction.cpp                     |     0
 .../poisson_reconstruction_example.cpp             |     0
 3rdparty/CGAL/examples/Polygon/CMakeLists.txt      |    30 +
 .../examples/Polygon/Example.cpp                   |     0
 .../examples/Polygon/Polygon.cpp                   |     0
 .../examples/Polygon/polygon_algorithms.cpp        |     0
 .../examples/Polygon/projected_polygon.cpp         |     0
 .../Polygon_mesh_processing/CMakeLists.txt         |     0
 .../compute_normals_example.cpp                    |     0
 .../compute_normals_example_OM.cpp                 |     0
 .../connected_components_example.cpp               |     0
 .../examples/Polygon_mesh_processing/data/P.off    |     0
 .../Polygon_mesh_processing/data/blobby.off        |     0
 .../Polygon_mesh_processing/data/blobby_3cc.off    |     0
 .../Polygon_mesh_processing/data/cube_quad.off     |     0
 .../data/degtri_sliding.off                        |     0
 .../Polygon_mesh_processing/data/eight.off         |     0
 .../data/full_border_quads.off                     |     0
 .../data/mech-holes-shark.off                      |     0
 .../examples/Polygon_mesh_processing/data/pig.off  |     0
 .../Polygon_mesh_processing/data/tet-shuffled.off  |     0
 .../hole_filling_example.cpp                       |     0
 .../hole_filling_example_OM.cpp                    |     0
 .../hole_filling_example_SM.cpp                    |     0
 .../isotropic_remeshing_example.cpp                |     0
 .../mesh_slicer_example.cpp                        |     0
 .../point_inside_example.cpp                       |     0
 .../point_inside_example_OM.cpp                    |     0
 .../polygon_soup_example.cpp                       |     0
 .../refine_fair_example.cpp                        |     0
 .../self_intersections_example.cpp                 |     0
 .../stitch_borders_example.cpp                     |     0
 .../stitch_borders_example_OM.cpp                  |     0
 .../triangulate_faces_example.cpp                  |     0
 .../triangulate_faces_example_OM.cpp               |     0
 .../triangulate_polyline_example.cpp               |     0
 3rdparty/CGAL/examples/Polyhedron/CMakeLists.txt   |    30 +
 .../examples/Polyhedron/corner.off                 |     0
 .../examples/Polyhedron/corner_with_hole.off       |     0
 .../examples/Polyhedron/corner_with_sharp_edge.off |     0
 .../examples/Polyhedron/cross.off                  |     0
 .../examples/Polyhedron/polyhedron_prog_color.cpp  |     0
 .../examples/Polyhedron/polyhedron_prog_cube.cpp   |     0
 .../Polyhedron/polyhedron_prog_cut_cube.cpp        |     0
 .../Polyhedron/polyhedron_prog_incr_builder.cpp    |     0
 .../Polyhedron/polyhedron_prog_normals.cpp         |     0
 .../examples/Polyhedron/polyhedron_prog_off.cpp    |     0
 .../examples/Polyhedron/polyhedron_prog_planes.cpp |     0
 .../examples/Polyhedron/polyhedron_prog_simple.cpp |     0
 .../examples/Polyhedron/polyhedron_prog_subdiv.cin |     0
 .../examples/Polyhedron/polyhedron_prog_subdiv.cpp |     0
 .../polyhedron_prog_subdiv_with_boundary.cin       |     0
 .../polyhedron_prog_subdiv_with_boundary.cpp       |     0
 .../examples/Polyhedron/polyhedron_prog_tetra.cpp  |     0
 .../examples/Polyhedron/polyhedron_prog_traits.cpp |     0
 .../examples/Polyhedron/polyhedron_prog_vector.cpp |     0
 .../Polyhedron/polyhedron_prog_vertex_color.cpp    |     0
 .../Polyhedron/polyhedron_prog_vertex_normal.cpp   |     0
 .../Polyhedron/polyhedron_self_intersection.cin    |     0
 .../Polyhedron/polyhedron_self_intersection.cpp    |     0
 .../CGAL/examples/Polyhedron_IO/CMakeLists.txt     |    30 +
 .../examples/Polyhedron_IO/iv2off.cin              |     0
 .../examples/Polyhedron_IO/iv2off.cpp              |     0
 .../examples/Polyhedron_IO/off2iv.cin              |     0
 .../examples/Polyhedron_IO/off2iv.cpp              |     0
 .../examples/Polyhedron_IO/off2off.cin             |     0
 .../examples/Polyhedron_IO/off2off.cpp             |     0
 .../examples/Polyhedron_IO/off2stl.cin             |     0
 .../examples/Polyhedron_IO/off2stl.cpp             |     0
 .../examples/Polyhedron_IO/off2vrml.cin            |     0
 .../examples/Polyhedron_IO/off2vrml.cpp            |     0
 .../examples/Polyhedron_IO/off2wav.cin             |     0
 .../examples/Polyhedron_IO/off2wav.cpp             |     0
 .../examples/Polyhedron_IO/off_bbox.cin            |     0
 .../examples/Polyhedron_IO/off_bbox.cpp            |     0
 .../examples/Polyhedron_IO/off_glue.cin            |     0
 .../examples/Polyhedron_IO/off_glue.cpp            |     0
 .../examples/Polyhedron_IO/off_transform.cin       |     0
 .../examples/Polyhedron_IO/off_transform.cpp       |     0
 .../examples/Polyhedron_IO/polyhedron2vrml.cin     |     0
 .../examples/Polyhedron_IO/polyhedron2vrml.cpp     |     0
 .../examples/Polyhedron_IO/polyhedron_copy.cin     |     0
 .../examples/Polyhedron_IO/polyhedron_copy.cpp     |     0
 .../examples/Polyhedron_IO/terr_trian.cin          |     0
 .../examples/Polyhedron_IO/terr_trian.cpp          |     0
 .../Polyhedron_IO/triangulation_print_OFF.h        |     0
 .../Polyline_simplification_2/CMakeLists.txt       |    30 +
 .../points_and_vertices.cin                        |     0
 .../points_and_vertices.cpp                        |     0
 .../Polyline_simplification_2/simplify.cin         |     0
 .../Polyline_simplification_2/simplify.cpp         |     0
 .../Polyline_simplification_2/simplify_polygon.cin |     0
 .../Polyline_simplification_2/simplify_polygon.cpp |     0
 .../simplify_polyline.cin                          |     0
 .../simplify_polyline.cpp                          |     0
 3rdparty/CGAL/examples/Polynomial/CMakeLists.txt   |    30 +
 .../examples/Polynomial/coefficient_access.cpp     |     0
 .../examples/Polynomial/construction.cpp           |     0
 .../examples/Polynomial/degree.cpp                 |     0
 .../Polynomial/gcd_up_to_constant_factor.cpp       |     0
 .../examples/Polynomial/subresultants.cpp          |     0
 .../examples/Polynomial/substitute.cpp             |     0
 .../examples/Polynomial/swap_move.cpp              |     0
 .../examples/Polytope_distance_d/CMakeLists.txt    |    30 +
 .../all_furthest_neighbors_2.cpp                   |     0
 .../Polytope_distance_d/polytope_distance_d.cpp    |    62 +
 .../polytope_distance_d_fast_exact.cpp             |    64 +
 .../examples/Polytope_distance_d/width_simplex.cpp |     0
 .../Principal_component_analysis/CMakeLists.txt    |    30 +
 .../Principal_component_analysis/barycenter.cpp    |     0
 .../Principal_component_analysis/bounding_box.cpp  |     0
 .../Principal_component_analysis/centroid.cpp      |     0
 .../linear_least_squares_fitting_points_2.cpp      |     0
 .../linear_least_squares_fitting_triangles_3.cpp   |     0
 .../CGAL/examples/Profiling_tools/CMakeLists.txt   |    30 +
 .../examples/Profiling_tools/Profile_counter.cpp   |     0
 .../Profiling_tools/Profile_histogram_counter.cpp  |     0
 .../examples/Profiling_tools/Profile_timer.cpp     |     0
 3rdparty/CGAL/examples/QP_solver/CMakeLists.txt    |    30 +
 .../examples/QP_solver/convex_hull_containment.cpp |     0
 .../QP_solver/convex_hull_containment2.cpp         |     0
 .../convex_hull_containment_benchmarks.cpp         |     0
 .../examples/QP_solver/cycling.cpp                 |     0
 .../examples/QP_solver/cycling.mps                 |     0
 .../examples/QP_solver/double_qp_solver.cin        |     0
 .../examples/QP_solver/double_qp_solver.data       |     0
 .../examples/QP_solver/first_lp.cpp                |     0
 .../examples/QP_solver/first_lp.mps                |     0
 .../examples/QP_solver/first_lp_from_iterators.cpp |     0
 .../examples/QP_solver/first_lp_from_mps.cpp       |     0
 .../examples/QP_solver/first_nonnegative_lp.cpp    |     0
 .../examples/QP_solver/first_nonnegative_lp.mps    |     0
 .../first_nonnegative_lp_from_iterators.cpp        |     0
 .../QP_solver/first_nonnegative_lp_from_mps.cpp    |     0
 .../examples/QP_solver/first_nonnegative_qp.cpp    |     0
 .../examples/QP_solver/first_nonnegative_qp.mps    |     0
 .../first_nonnegative_qp_from_iterators.cpp        |     0
 .../QP_solver/first_nonnegative_qp_from_mps.cpp    |     0
 .../examples/QP_solver/first_qp.cpp                |     0
 .../examples/QP_solver/first_qp.mps                |     0
 .../QP_solver/first_qp_basic_constraints.cpp       |     0
 .../examples/QP_solver/first_qp_from_iterators.cpp |     0
 .../examples/QP_solver/first_qp_from_mps.cpp       |     0
 .../examples/QP_solver/important_variables.cpp     |     0
 .../QP_solver/infeasibility_certificate.cpp        |     0
 .../examples/QP_solver/integer_qp_solver.cin       |     0
 .../examples/QP_solver/integer_qp_solver.data      |     0
 .../examples/QP_solver/invert_matrix.cpp           |     0
 .../examples/QP_solver/optimality_certificate.cpp  |     0
 .../examples/QP_solver/print_first_lp.cpp          |     0
 .../QP_solver/print_first_nonnegative_lp.cpp       |     0
 .../QP_solver/print_first_nonnegative_qp.cpp       |     0
 .../examples/QP_solver/print_first_qp.cpp          |     0
 .../examples/QP_solver/rational_qp_solver.cin      |     0
 .../examples/QP_solver/rational_qp_solver.data     |     0
 .../QP_solver/solve_convex_hull_containment_lp.h   |     0
 .../QP_solver/solve_convex_hull_containment_lp2.h  |     0
 .../QP_solver/solve_convex_hull_containment_lp3.h  |     0
 .../QP_solver/unboundedness_certificate.cpp        |     0
 .../examples/RangeSegmentTrees/CMakeLists.txt      |     0
 .../RangeSegmentTrees/include/Tree_Traits.h        |     0
 .../examples/RangeSegmentTrees/range_tree_1.cpp    |     0
 .../examples/RangeSegmentTrees/range_tree_2.cpp    |     0
 .../examples/RangeSegmentTrees/range_tree_3.cpp    |     0
 .../examples/RangeSegmentTrees/range_tree_4.cpp    |     0
 .../RangeSegmentTrees/range_tree_map_2.cpp         |     0
 .../RangeSegmentTrees/range_tree_set_2.cpp         |     0
 .../examples/RangeSegmentTrees/segment_tree_1.cpp  |     0
 .../examples/RangeSegmentTrees/segment_tree_2.cpp  |     0
 .../examples/RangeSegmentTrees/segment_tree_3.cpp  |     0
 .../examples/RangeSegmentTrees/segment_tree_4.cpp  |     0
 .../RangeSegmentTrees/segment_tree_map_2.cpp       |     0
 .../RangeSegmentTrees/segment_tree_set_2.cpp       |     0
 .../RangeSegmentTrees/segment_tree_set_3.cpp       |     0
 .../RangeSegmentTrees/software_design_rgs.cpp      |     0
 .../examples/Rectangular_p_center_2/CMakeLists.txt |     0
 .../rectangular_p_center_2.cpp                     |     0
 .../examples/Ridges_3/CMakeLists.txt               |     0
 .../examples/Ridges_3/Compute_Ridges_Umbilics.cpp  |     0
 .../examples/Ridges_3/PolyhedralSurf.h             |     0
 .../examples/Ridges_3/PolyhedralSurf_rings.h       |     0
 .../{CGAL-4.8 => CGAL}/examples/Ridges_3/README    |     0
 .../examples/Ridges_3/Ridges_Umbilics_SM.cpp       |     0
 .../examples/Ridges_3/compute_normals.h            |     0
 .../Ridges_3/data/poly2x^2+y^2-0.062500.off        |     0
 .../examples/Ridges_3/skip_vcproj_auto_generation  |     0
 .../CGAL/examples/STL_Extension/CMakeLists.txt     |    30 +
 .../examples/STL_Extension/Default.cpp             |     0
 .../STL_Extension/Dispatch_output_iterator.cpp     |     0
 .../examples/STL_Extension/in_place_list_prog.cpp  |     0
 .../STL_Extension/min_element_if_example.cpp       |     0
 .../STL_Extension/min_max_element_example.cpp      |     0
 .../examples/STL_Extension/unordered_map.cpp       |     0
 .../Scale_space_reconstruction_3/CMakeLists.txt    |    40 +
 .../Scale_space_reconstruction_3/data/kitten.off   |     0
 .../Scale_space_reconstruction_3/scale_space.cmd   |     0
 .../Scale_space_reconstruction_3/scale_space.cpp   |     0
 .../scale_space_incremental.cmd                    |     0
 .../scale_space_incremental.cpp                    |     0
 .../scale_space_manifold.cmd                       |     0
 .../scale_space_manifold.cpp                       |     0
 .../Segment_Delaunay_graph_2/CMakeLists.txt        |    30 +
 .../Segment_Delaunay_graph_2/data/sites.cin        |     0
 .../Segment_Delaunay_graph_2/data/sites2.cin       |     0
 .../Segment_Delaunay_graph_2/data/sitesx.cin       |     0
 .../Segment_Delaunay_graph_2/data/sitesxx.cin      |     0
 .../Segment_Delaunay_graph_2/data/sitesxx.rb.cin   |     0
 .../Segment_Delaunay_graph_2/sdg-count-sites.cpp   |     0
 .../sdg-fast-sp-polygon.cpp                        |     0
 .../Segment_Delaunay_graph_2/sdg-fast-sp.cpp       |     0
 .../sdg-filtered-traits.cpp                        |     0
 .../Segment_Delaunay_graph_2/sdg-info-set.cpp      |     0
 .../Segment_Delaunay_graph_2/sdg-red-blue-info.cpp |     0
 .../Segment_Delaunay_graph_2/sdg-voronoi-edges.cpp |     0
 .../Segment_Delaunay_graph_Linf_2/CMakeLists.txt   |    35 +
 .../Segment_Delaunay_graph_Linf_2/data/sites.cin   |     0
 .../Segment_Delaunay_graph_Linf_2/data/sites2.cin  |     0
 .../Segment_Delaunay_graph_Linf_2/data/sitesx.cin  |     0
 .../Segment_Delaunay_graph_Linf_2/data/sitesxx.cin |     0
 .../data/sitesxx.rb.cin                            |     0
 .../print-sdg-linf.cpp                             |     0
 .../sdg-count-sites-linf.cpp                       |     0
 .../sdg-fast-sp-linf.cpp                           |     0
 .../sdg-fast-sp-polygon-linf.cpp                   |     0
 .../sdg-filtered-traits-linf.cpp                   |     0
 .../sdg-info-set-linf.cpp                          |     0
 .../sdg-red-blue-info-linf.cpp                     |     0
 .../sdg-voronoi-edges-exact-linf.cpp               |     0
 .../sdg-voronoi-edges-linf.cpp                     |     0
 .../examples/Skin_surface_3/CMakeLists.txt         |     0
 .../examples/Skin_surface_3/data/1IYE.pdb          |     0
 .../examples/Skin_surface_3/data/1mvm.pdb          |     0
 .../examples/Skin_surface_3/data/1t7i.pdb          |     0
 .../examples/Skin_surface_3/data/4lfq.pdb          |     0
 .../examples/Skin_surface_3/data/caffeine.cin      |     0
 .../Skin_surface_3/data/molecule_tunnel.cin        |     0
 .../include/extract_balls_from_pdb.h               |     0
 .../Skin_surface_3/skin_surface_pdb_reader.cpp     |     0
 ...n_surface_retrieve_defining_weighted_points.cpp |     0
 .../Skin_surface_3/skin_surface_simple.cpp         |     0
 .../Skin_surface_3/skin_surface_subdiv.cpp         |     0
 .../skin_surface_subdiv_with_normals.cpp           |     0
 .../examples/Skin_surface_3/skin_surface_writer.h  |     0
 .../Skin_surface_3/union_of_balls_simple.cpp       |     0
 .../Skin_surface_3/union_of_balls_subdiv.cpp       |     0
 .../CGAL/examples/Snap_rounding_2/CMakeLists.txt   |    30 +
 .../Snap_rounding_2/data/snap_rounding_data        |     0
 .../examples/Snap_rounding_2/snap_rounding.cpp     |     0
 .../Snap_rounding_2/snap_rounding_data.cpp         |     0
 .../Snap_rounding_2/snap_rounding_to_integer.cpp   |     0
 .../CGAL/examples/Solver_interface/CMakeLists.txt  |    35 +
 .../Solver_interface/diagonalize_matrix.cpp        |     0
 .../singular_value_decomposition.cpp               |     0
 .../examples/Solver_interface/sparse_solvers.cpp   |     0
 .../examples/Spatial_searching/CMakeLists.txt      |     0
 .../examples/Spatial_searching/Distance.h          |     0
 .../examples/Spatial_searching/Point.h             |     0
 .../examples/Spatial_searching/circular_query.cpp  |     0
 .../examples/Spatial_searching/data/tripod.off     |     0
 .../Spatial_searching/distance_browsing.cpp        |     0
 .../Spatial_searching/fuzzy_range_query.cpp        |     0
 .../general_neighbor_searching.cpp                 |     0
 .../Spatial_searching/iso_rectangle_2_query.cpp    |     0
 .../nearest_neighbor_searching.cpp                 |     0
 .../searching_polyhedron_vertices.cpp              |     0
 ...ching_polyhedron_vertices_with_fuzzy_sphere.cpp |     0
 .../searching_sphere_orthogonally.cpp              |     0
 .../searching_surface_mesh_vertices.cpp            |     0
 .../searching_with_circular_query.cpp              |     0
 .../searching_with_point_with_info.cpp             |     0
 .../searching_with_point_with_info_inplace.cpp     |    76 +
 .../searching_with_point_with_info_pmap.cpp        |    58 +
 .../Spatial_searching/splitter_worst_cases.cpp     |     0
 .../user_defined_point_and_distance.cpp            |     0
 .../using_fair_splitting_rule.cpp                  |     0
 .../weighted_Minkowski_distance.cpp                |     0
 .../CGAL/examples/Spatial_sorting/CMakeLists.txt   |    30 +
 .../Spatial_sorting/example_delaunay_2.cpp         |     0
 .../examples/Spatial_sorting/hilbert.cpp           |     0
 .../examples/Spatial_sorting/hilbert_policies.cpp  |     0
 .../Spatial_sorting/hilbert_sort_on_sphere.cpp     |     0
 .../examples/Spatial_sorting/myPoint.cpp           |     0
 .../Spatial_sorting/small_example_delaunay_2.cpp   |     0
 .../examples/Spatial_sorting/sort_indices.cpp      |     0
 .../sp_sort_using_property_map_2.cpp               |     0
 .../sp_sort_using_property_map_3.cpp               |    39 +
 .../sp_sort_using_property_map_d.cpp               |     0
 .../Spatial_sorting/spatial_sort_on_sphere.cpp     |     0
 .../examples/Straight_skeleton_2/CMakeLists.txt    |    30 +
 .../Create_offset_polygons_2.cpp                   |     0
 .../Create_saop_from_polygon_with_holes_2.cpp      |     0
 .../Create_skeleton_and_offset_polygons_2.cpp      |     0
 ...e_skeleton_and_offset_polygons_with_holes_2.cpp |     0
 .../Create_straight_skeleton_2.cpp                 |     0
 ...straight_skeleton_from_polygon_with_holes_2.cpp |     0
 .../examples/Straight_skeleton_2/Low_level_API.cpp |     0
 .../Straight_skeleton_2/Show_offset_polygon.cpp    |     0
 .../Straight_skeleton_2/Show_straight_skeleton.cpp |     0
 .../examples/Straight_skeleton_2/dump_to_eps.h     |     0
 .../Straight_skeleton_2/input_file_format.txt      |     0
 .../examples/Straight_skeleton_2/print.h           |     0
 .../examples/Straight_skeleton_2/sample_1.dat      |     0
 .../examples/Straight_skeleton_2/sample_2.dat      |     0
 .../examples/Straight_skeleton_2/sample_3.dat      |     0
 .../examples/Straight_skeleton_2/sample_4.dat      |     0
 .../CGAL/examples/Stream_lines_2/CMakeLists.txt    |    30 +
 .../examples/Stream_lines_2/data/datap.tri.cin     |     0
 .../examples/Stream_lines_2/data/datav.tri.cin     |     0
 .../Stream_lines_2/data/irregular_data.tri.cin     |     0
 .../examples/Stream_lines_2/data/vnoise.vec.cin    |     0
 .../examples/Stream_lines_2/stl_regular_field.cpp  |     0
 .../Stream_lines_2/stl_triangular_field.cpp        |     0
 .../examples/Subdivision_method_3/CMakeLists.txt   |    30 +
 .../CatmullClark_subdivision.cpp                   |     0
 .../Customized_subdivision.cpp                     |     0
 .../Subdivision_method_3/DooSabin_subdivision.cpp  |     0
 .../Subdivision_method_3/Loop_subdivision.cpp      |     0
 .../examples/Subdivision_method_3/data/corner.off  |     0
 .../data/corner_tris_with_hole.off                 |     0
 .../Subdivision_method_3/data/corner_with_hole.off |     0
 .../data/corner_with_sharp_edge.off                |     0
 .../examples/Subdivision_method_3/data/cross.off   |     0
 .../Subdivision_method_3/data/quint_tris.off       |     0
 3rdparty/CGAL/examples/Surface_mesh/CMakeLists.txt |    35 +
 .../examples/Surface_mesh/cube.off                 |     0
 .../examples/Surface_mesh/data/elephant.off        |     0
 .../examples/Surface_mesh/data/knot1.off           |     0
 .../examples/Surface_mesh/data/quad.off            |     0
 .../examples/Surface_mesh/data/triangle.off        |     0
 .../examples/Surface_mesh/sm_aabbtree.cpp          |     0
 .../examples/Surface_mesh/sm_bgl.cmd               |     0
 .../examples/Surface_mesh/sm_bgl.cpp               |     0
 .../examples/Surface_mesh/sm_circulators.cpp       |     0
 .../examples/Surface_mesh/sm_do_intersect.cmd      |     0
 .../examples/Surface_mesh/sm_do_intersect.cpp      |     0
 .../examples/Surface_mesh/sm_iterators.cpp         |     0
 .../examples/Surface_mesh/sm_join.cpp              |     0
 .../examples/Surface_mesh/sm_kruskal.cmd           |     0
 .../examples/Surface_mesh/sm_kruskal.cpp           |     0
 .../examples/Surface_mesh/sm_memory.cpp            |     0
 .../CGAL/examples/Surface_mesh/sm_properties.cpp   |    67 +
 .../Surface_mesh_deformation/CMakeLists.txt        |    49 +
 .../all_roi_assign_example.cpp                     |     0
 .../all_roi_assign_example_Surface_mesh.cpp        |     0
 .../all_roi_assign_example_custom_polyhedron.cpp   |     0
 .../all_roi_assign_example_with_OpenMesh.cpp       |     0
 .../custom_weight_for_edges_example.cpp            |     0
 .../Surface_mesh_deformation/data/cactus.def       |     5 +
 .../Surface_mesh_deformation}/data/cactus.off      |     0
 .../Surface_mesh_deformation/data/cactus.sel       |   622 +
 .../Surface_mesh_deformation/data/plane.off        |     0
 .../deform_mesh_for_botsch08_format_sre_arap.cmd   |     1 +
 .../deform_mesh_for_botsch08_format_sre_arap.cpp   |   101 +
 .../deform_polyhedron_with_custom_pmap_example.cpp |     0
 .../k_ring_roi_translate_rotate_Surface_mesh.cpp   |     0
 .../k_ring_roi_translate_rotate_example.cpp        |     0
 .../Authalic_parameterization.cmd                  |     0
 .../Authalic_parameterization.cpp                  |     0
 .../Surface_mesh_parameterization/CMakeLists.txt   |    75 +
 .../Complete_parameterization_example.cmd          |     0
 .../Complete_parameterization_example.cpp          |     0
 .../Mesh_cutting_parameterization.cmd              |     0
 .../Mesh_cutting_parameterization.cpp              |     0
 .../Simple_parameterization.cmd                    |     0
 .../Simple_parameterization.cpp                    |     0
 .../Square_border_parameterization.cmd             |     0
 .../Square_border_parameterization.cpp             |     0
 .../data/check_64x64.bmp                           |   Bin
 .../Surface_mesh_parameterization/data/holes.off   |     0
 .../data/mannequin-devil.off                       |     0
 .../data/mask_cone.off                             |     0
 .../data/nefertiti.off                             |     0
 .../data/parameterization.mtl                      |     0
 .../Surface_mesh_parameterization/data/rotor.off   |     0
 .../data/sphere966.off                             |     0
 .../data/three_peaks.off                           |     0
 .../include/Mesh_cutter.h                          |     0
 .../Parameterization_polyhedron_adaptor_ex.h       |     0
 .../include/Polyhedron_ex.h                        |     0
 .../polyhedron_ex_parameterization.cmd             |     0
 .../polyhedron_ex_parameterization.cpp             |     0
 .../quick_test_suite.bat                           |     0
 .../quick_test_suite.sh                            |     0
 .../Surface_mesh_segmentation/CMakeLists.txt       |     0
 .../Surface_mesh_segmentation/data/cactus.off      |     0
 .../sdf_values_example.cpp                         |     0
 ...gmentation_from_sdf_values_OpenMesh_example.cpp |     0
 .../segmentation_from_sdf_values_SM_example.cpp    |     0
 .../segmentation_from_sdf_values_example.cpp       |     0
 .../segmentation_via_sdf_values_example.cpp        |     0
 .../segmentation_with_facet_ids_example.cpp        |     0
 .../Surface_mesh_shortest_path/CMakeLists.txt      |    38 +
 .../Surface_mesh_shortest_path/data/elephant.off   |     0
 .../shortest_path_sequence.cpp                     |     0
 .../shortest_paths_OpenMesh.cpp                    |     0
 .../shortest_paths_multiple_sources.cpp            |     0
 .../shortest_paths_no_id.cpp                       |     0
 .../shortest_paths_with_id.cpp                     |     0
 .../Surface_mesh_simplification/CMakeLists.txt     |     0
 .../Surface_mesh_simplification/cube-meshed.off    |     0
 .../examples/Surface_mesh_simplification/cube.off  |     0
 .../edge_collapse_OpenMesh.cpp                     |     0
 .../edge_collapse_constrain_sharp_edges.cmd        |     0
 .../edge_collapse_constrain_sharp_edges.cpp        |     0
 ...edge_collapse_constrained_border_polyhedron.cmd |     0
 ...edge_collapse_constrained_border_polyhedron.cpp |     0
 ...ge_collapse_constrained_border_surface_mesh.cmd |     0
 ...ge_collapse_constrained_border_surface_mesh.cpp |     0
 .../edge_collapse_enriched_polyhedron.cmd          |     0
 .../edge_collapse_enriched_polyhedron.cpp          |     0
 .../edge_collapse_polyhedron.cmd                   |     0
 .../edge_collapse_polyhedron.cpp                   |     0
 .../edge_collapse_surface_mesh.cmd                 |     0
 .../edge_collapse_surface_mesh.cpp                 |     0
 .../mesh_with_border.off                           |     0
 .../Surface_mesh_skeletonization/CMakeLists.txt    |    41 +
 .../MCF_Skeleton_example.cpp                       |     0
 .../MCF_Skeleton_sm_example.cpp                    |     0
 .../Surface_mesh_skeletonization/data/161.off      |     0
 .../Surface_mesh_skeletonization/data/elephant.off |     0
 .../segmentation_example.cpp                       |     0
 .../simple_mcfskel_example.cpp                     |     0
 .../simple_mcfskel_sm_example.cpp                  |     0
 .../examples/Surface_mesher/CMakeLists.txt         |     0
 .../examples/Surface_mesher/data/skull_2.9.inr     |   Bin
 .../examples/Surface_mesher/data/triceratops.off   |     0
 .../Surface_mesher/mesh_a_3d_gray_image.cpp        |     0
 .../Surface_mesher/mesh_an_implicit_function.cpp   |     0
 .../Surface_mesher/skip_vcproj_auto_generation     |     0
 .../examples/Sweep_line_2/CMakeLists.txt           |     0
 .../examples/Sweep_line_2/sweep_line.cpp           |     0
 3rdparty/CGAL/examples/TDS_3/CMakeLists.txt        |    30 +
 .../examples/TDS_3/linking_2d_and_3d.cpp           |     0
 3rdparty/{CGAL-4.8 => CGAL}/examples/TDS_3/tds.cpp |     0
 .../CGAL/examples/Triangulation/CMakeLists.txt     |    38 +
 .../Triangulation/barycentric_subdivision.cpp      |     0
 .../Triangulation/delaunay_triangulation.cpp       |     0
 .../examples/Triangulation/triangulation.cpp       |     0
 .../examples/Triangulation/triangulation1.cpp      |     0
 .../examples/Triangulation/triangulation2.cpp      |     0
 .../triangulation_data_structure_dynamic.cpp       |     0
 .../triangulation_data_structure_static.cpp        |     0
 .../CGAL/examples/Triangulation_2/CMakeLists.txt   |    30 +
 .../examples/Triangulation_2/README                |     0
 .../examples/Triangulation_2/adding_handles.cpp    |     0
 .../examples/Triangulation_2/colored_face.cpp      |     0
 .../CGAL/examples/Triangulation_2/constrained.cpp  |    32 +
 .../Triangulation_2/constrained_hierarchy_plus.cpp |     0
 .../examples/Triangulation_2/constrained_plus.cpp  |    34 +
 .../Triangulation_2/copy_triangulation_2.cpp       |     0
 .../examples/Triangulation_2/data/constrained.cin  |     0
 .../examples/Triangulation_2/data/regular.cin      |     0
 .../examples/Triangulation_2/data/terrain.cin      |     0
 .../Triangulation_2/data/triangulation_prog1.cin   |     0
 .../examples/Triangulation_2/data/voronoi.cin      |     0
 .../examples/Triangulation_2/hierarchy.cpp         |     0
 .../info_insert_with_pair_iterator_2.cpp           |     0
 .../info_insert_with_pair_iterator_regular_2.cpp   |     0
 .../info_insert_with_transform_iterator_2.cpp      |     0
 .../info_insert_with_zip_iterator_2.cpp            |     0
 .../Triangulation_2/polygon_triangulation.cpp      |     0
 .../Triangulation_2/polylines_triangulation.cpp    |    86 +
 .../Triangulation_2/print_cropped_voronoi.cpp      |     0
 .../examples/Triangulation_2/regular.cpp           |     0
 .../examples/Triangulation_2/terrain.cpp           |     0
 .../Triangulation_2/triangulation_prog1.cpp        |     0
 .../examples/Triangulation_2/voronoi.cpp           |     0
 .../CGAL/examples/Triangulation_3/CMakeLists.txt   |    48 +
 .../examples/Triangulation_3/README                |     0
 .../examples/Triangulation_3/adding_handles_3.cpp  |     0
 .../examples/Triangulation_3/color.cpp             |     0
 .../Triangulation_3/copy_triangulation_3.cpp       |     0
 .../examples/Triangulation_3/fast_location_3.cpp   |     0
 .../examples/Triangulation_3/find_conflicts_3.cpp  |     0
 .../info_insert_with_pair_iterator.cpp             |     0
 .../info_insert_with_pair_iterator_regular.cpp     |     0
 .../info_insert_with_transform_iterator.cpp        |     0
 .../info_insert_with_zip_iterator.cpp              |     0
 ...parallel_insertion_and_removal_in_regular_3.cpp |     0
 .../parallel_insertion_in_delaunay_3.cpp           |     0
 .../examples/Triangulation_3/regular_3.cpp         |     0
 .../Triangulation_3/sequential_parallel.cpp        |     0
 .../Triangulation_3/simple_triangulation_3.cpp     |     0
 .../examples/Triangulation_3/simplex.cpp           |     0
 3rdparty/CGAL/examples/Visibility_2/CMakeLists.txt |    30 +
 .../Visibility_2/general_polygon_example.cpp       |     0
 .../Visibility_2/simple_polygon_visibility_2.cpp   |     0
 .../CGAL/examples/Voronoi_diagram_2/CMakeLists.txt |    30 +
 .../examples/Voronoi_diagram_2/data/1D.ag.cin      |     0
 .../examples/Voronoi_diagram_2/data/data1.ag.cin   |     0
 .../examples/Voronoi_diagram_2/data/data1.dt.cin   |     0
 .../examples/Voronoi_diagram_2/data/data1.svd.cin  |     0
 .../examples/Voronoi_diagram_2/data/data2.ag.cin   |     0
 .../examples/Voronoi_diagram_2/data/data3.ag.cin   |     0
 .../Voronoi_diagram_2/data/degenerate.ag.cin       |     0
 .../Voronoi_diagram_2/data/queries1.dt.cin         |     0
 .../Voronoi_diagram_2/data/queries1.svd.cin        |     0
 .../Voronoi_diagram_2/vd_2_point_location.cpp      |     0
 .../vd_2_point_location_sdg_linf.cpp               |     0
 .../include/CGAL/AABB_C3T3_triangle_primitive.h    |     0
 .../CGAL/AABB_face_graph_triangle_primitive.h      |   178 +
 .../CGAL/AABB_halfedge_graph_segment_primitive.h   |     0
 .../include/CGAL/AABB_intersections.h              |     0
 .../include/CGAL/AABB_polyhedral_oracle.h          |     0
 .../CGAL/AABB_polyhedron_segment_primitive.h       |     0
 .../CGAL/AABB_polyhedron_triangle_primitive.h      |     0
 .../include/CGAL/AABB_primitive.h                  |     0
 .../include/CGAL/AABB_segment_primitive.h          |     0
 3rdparty/CGAL/include/CGAL/AABB_traits.h           |   505 +
 3rdparty/CGAL/include/CGAL/AABB_tree.h             |  1294 +
 .../include/CGAL/AABB_triangle_primitive.h         |     0
 .../CGAL/Advancing_front_surface_reconstruction.h  |     0
 ...cing_front_surface_reconstruction_cell_base_3.h |     0
 ...ng_front_surface_reconstruction_vertex_base_3.h |     0
 .../include/CGAL/Aff_transformation_2.h            |     0
 .../include/CGAL/Aff_transformation_3.h            |     0
 .../include/CGAL/Algebraic_extension_traits.h      |     0
 .../include/CGAL/Algebraic_kernel_converter.h      |     0
 .../Algebraic_kernel_d/Algebraic_curve_kernel_2.h  |  2762 ++
 .../CGAL/Algebraic_kernel_d/Algebraic_real_d_1.h   |     0
 .../Algebraic_real_quadratic_refinement_rep_bfi.h  |     0
 .../CGAL/Algebraic_kernel_d/Algebraic_real_rep.h   |     0
 .../Algebraic_kernel_d/Algebraic_real_rep_bfi.h    |     0
 .../Bitstream_coefficient_kernel.h                 |     0
 .../Bitstream_coefficient_kernel_at_alpha.h        |     0
 .../CGAL/Algebraic_kernel_d/Bitstream_descartes.h  |     0
 .../Bitstream_descartes_E08_tree.h                 |  1054 +
 .../Bitstream_descartes_rndl_tree.h                |  1572 ++
 .../Bitstream_descartes_rndl_tree_traits.h         |     0
 .../CGAL/Algebraic_kernel_d/Curve_analysis_2.h     |     0
 .../Algebraic_kernel_d/Curve_pair_analysis_2.h     |     0
 .../include/CGAL/Algebraic_kernel_d/Descartes.h    |     0
 .../CGAL/Algebraic_kernel_d/Event_line_builder.h   |     0
 .../include/CGAL/Algebraic_kernel_d/Float_traits.h |     0
 .../CGAL/Algebraic_kernel_d/Interval_evaluate_1.h  |     0
 .../CGAL/Algebraic_kernel_d/Interval_evaluate_2.h  |     0
 .../CGAL/Algebraic_kernel_d/LRU_hashed_map.h       |     0
 .../Algebraic_kernel_d/Real_embeddable_extension.h |     0
 .../include/CGAL/Algebraic_kernel_d/Real_roots.h   |     0
 .../CGAL/Algebraic_kernel_d/Shear_controller.h     |     0
 .../CGAL/Algebraic_kernel_d/Shear_transformation.h |     0
 .../CGAL/Algebraic_kernel_d/Status_line_CA_1.h     |     0
 .../CGAL/Algebraic_kernel_d/Status_line_CPA_1.h    |     0
 .../CGAL/Algebraic_kernel_d/Xy_coordinate_2.h      |     0
 .../algebraic_curve_kernel_2_tools.h               |     0
 .../CGAL/Algebraic_kernel_d/bound_between_1.h      |     0
 .../CGAL/Algebraic_kernel_d/construct_binary.h     |     0
 .../include/CGAL/Algebraic_kernel_d/enums.h        |     0
 .../include/CGAL/Algebraic_kernel_d/exceptions.h   |     0
 .../include/CGAL/Algebraic_kernel_d/flags.h        |     0
 .../include/CGAL/Algebraic_kernel_d/macros.h       |     0
 .../CGAL/Algebraic_kernel_d/refine_zero_against.h  |     0
 .../include/CGAL/Algebraic_kernel_d/shear.h        |     0
 .../univariate_polynomial_utils.h                  |     0
 .../include/CGAL/Algebraic_kernel_d_1.h            |     0
 .../include/CGAL/Algebraic_kernel_d_2.h            |     0
 ...function_objects_on_roots_and_polynomials_2_2.h |     0
 ...nal_functions_comparison_root_for_circles_2_2.h |     0
 ...functions_on_roots_and_polynomial_1_2_and_2_2.h |     0
 ...ternal_functions_on_roots_and_polynomials_2_2.h |     0
 .../CGAL/Algebraic_kernel_for_circles_2_2.h        |     0
 ...function_objects_on_roots_and_polynomials_2_3.h |     0
 ...nal_functions_comparison_root_for_spheres_2_3.h |     0
 ...functions_on_roots_and_polynomial_1_3_and_2_3.h |     0
 ...ternal_functions_on_roots_and_polynomials_1_3.h |     0
 ...ternal_functions_on_roots_and_polynomials_2_3.h |     0
 .../CGAL/Algebraic_kernel_for_spheres_2_3.h        |     0
 .../include/CGAL/Algebraic_kernel_rs_gmpq_d_1.h    |     0
 .../include/CGAL/Algebraic_kernel_rs_gmpz_d_1.h    |     0
 .../include/CGAL/Algebraic_structure_traits.h      |     0
 .../include/CGAL/Alpha_shape_2.h                   |     0
 .../include/CGAL/Alpha_shape_3.h                   |     0
 .../include/CGAL/Alpha_shape_cell_base_3.h         |     0
 .../include/CGAL/Alpha_shape_euclidean_traits_2.h  |     0
 .../include/CGAL/Alpha_shape_euclidean_traits_3.h  |     0
 .../include/CGAL/Alpha_shape_face_base_2.h         |     0
 .../include/CGAL/Alpha_shape_vertex_base_2.h       |     0
 .../include/CGAL/Alpha_shape_vertex_base_3.h       |     0
 .../include/CGAL/Apollonius_graph_2.h              |     0
 .../Apollonius_graph_2/Apollonius_graph_2_impl.h   |     0
 .../Apollonius_graph_hierarchy_2_impl.h            |     0
 .../Bounded_side_of_ccw_circle_C2.h                |     0
 .../CGAL/Apollonius_graph_2/Compare_weight_2.h     |     0
 .../include/CGAL/Apollonius_graph_2/Compare_x_2.h  |     0
 .../include/CGAL/Apollonius_graph_2/Compare_y_2.h  |     0
 .../CGAL/Apollonius_graph_2/Constructions_C2.h     |     0
 .../CGAL/Apollonius_graph_2/Constructions_ftC2.h   |     0
 .../CGAL/Apollonius_graph_2/Constructions_rtH2.h   |     0
 .../CGAL/Apollonius_graph_2/Finite_edge_test8_C2.h |     0
 .../CGAL/Apollonius_graph_2/Finite_edge_test_C2.h  |     0
 .../include/CGAL/Apollonius_graph_2/Incircle8_C2.h |     0
 .../include/CGAL/Apollonius_graph_2/Incircle_C2.h  |     0
 .../Apollonius_graph_2/Infinite_edge_test_C2.h     |     0
 .../Apollonius_graph_2/Is_degenerate_edge_C2.h     |     0
 .../include/CGAL/Apollonius_graph_2/Is_hidden_C2.h |     0
 .../CGAL/Apollonius_graph_2/Kernel_wrapper_2.h     |     0
 .../CGAL/Apollonius_graph_2/Orientation8_C2.h      |     0
 .../CGAL/Apollonius_graph_2/Orientation_2.h        |     0
 .../Oriented_side_of_bisector_C2.h                 |     0
 .../Predicate_constructions_C2.h                   |     0
 .../CGAL/Apollonius_graph_2/Predicates_C2.h        |     0
 .../CGAL/Apollonius_graph_2/Traits_wrapper_2.h     |     0
 .../include/CGAL/Apollonius_graph_2/basic.h        |     0
 .../include/CGAL/Apollonius_graph_2/check_filter.h |     0
 .../CGAL/Apollonius_graph_2/comparator_profiler.h  |     0
 .../CGAL/Apollonius_graph_2/compare_quadratic.h    |     0
 .../CGAL/Apollonius_graph_2/predicate_profiler.h   |     0
 .../uncertain/Uncertain_is_hidden_C2.h             |     0
 .../Uncertain_oriented_side_of_bisector_C2.h       |     0
 .../uncertain/Uncertain_vertex_conflict_2.h        |     0
 .../uncertain/uncertain_functions_on_signs.h       |     0
 .../CGAL/Apollonius_graph_adaptation_policies_2.h  |     0
 .../CGAL/Apollonius_graph_adaptation_traits_2.h    |     0
 .../CGAL/Apollonius_graph_data_structure_2.h       |     0
 .../CGAL/Apollonius_graph_filtered_traits_2.h      |     0
 .../include/CGAL/Apollonius_graph_hierarchy_2.h    |     0
 .../Apollonius_graph_hierarchy_vertex_base_2.h     |     0
 .../include/CGAL/Apollonius_graph_traits_2.h       |     0
 .../include/CGAL/Apollonius_graph_vertex_base_2.h  |     0
 .../include/CGAL/Apollonius_site_2.h               |     0
 .../include/CGAL/Approximate_min_ellipsoid_d.h     |     0
 .../Approximate_min_ellipsoid_d_configure.h        |     0
 .../Approximate_min_ellipsoid_d_debug.h            |     0
 .../Approximate_min_ellipsoid_d_impl.h             |     0
 .../Khachiyan_approximation.h                      |     0
 .../Khachiyan_approximation_impl.h                 |     0
 .../CGAL/Approximate_min_ellipsoid_d_traits_2.h    |     0
 .../CGAL/Approximate_min_ellipsoid_d_traits_3.h    |     0
 .../CGAL/Approximate_min_ellipsoid_d_traits_d.h    |     0
 .../include/CGAL/Arithmetic_kernel.h               |     0
 .../Arithmetic_kernel/Arithmetic_kernel_base.h     |     0
 .../include/CGAL/Arr_Bezier_curve_traits_2.h       |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Arr_accessor.h |     0
 .../include/CGAL/Arr_algebraic_segment_traits_2.h  |     0
 .../include/CGAL/Arr_batched_point_location.h      |     0
 .../CGAL/Arr_bounded_planar_topology_traits_2.h    |     0
 .../include/CGAL/Arr_circle_segment_traits_2.h     |     0
 .../include/CGAL/Arr_circular_arc_traits_2.h       |     0
 .../include/CGAL/Arr_circular_line_arc_traits_2.h  |     0
 .../include/CGAL/Arr_conic_traits_2.h              |     0
 .../CGAL/Arr_consolidated_curve_data_traits_2.h    |     0
 .../include/CGAL/Arr_counting_traits_2.h           |     0
 .../include/CGAL/Arr_curve_data_traits_2.h         |     0
 .../include/CGAL/Arr_dcel_base.h                   |     0
 .../include/CGAL/Arr_default_dcel.h                |     0
 .../include/CGAL/Arr_default_overlay_traits.h      |     0
 ...irectional_non_caching_segment_basic_traits_2.h |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Arr_enums.h    |     0
 .../include/CGAL/Arr_extended_dcel.h               |     0
 3rdparty/CGAL/include/CGAL/Arr_face_index_map.h    |   277 +
 .../{CGAL-4.8 => CGAL}/include/CGAL/Arr_face_map.h |     0
 ...Arr_geodesic_arc_on_sphere_partition_traits_2.h |     0
 .../CGAL/Arr_geodesic_arc_on_sphere_traits_2.h     |     0
 .../include/CGAL/Arr_geometry_traits/Arr_plane_3.h |     0
 .../Bezier_bounding_rational_traits.h              |     0
 .../CGAL/Arr_geometry_traits/Bezier_cache.h        |     0
 .../CGAL/Arr_geometry_traits/Bezier_curve_2.h      |     0
 .../CGAL/Arr_geometry_traits/Bezier_point_2.h      |     0
 .../CGAL/Arr_geometry_traits/Bezier_x_monotone_2.h |     0
 .../CGAL/Arr_geometry_traits/Circle_segment_2.h    |     0
 .../include/CGAL/Arr_geometry_traits/Conic_arc_2.h |     0
 .../Arr_geometry_traits/Conic_intersections_2.h    |     0
 .../CGAL/Arr_geometry_traits/Conic_point_2.h       |     0
 .../Arr_geometry_traits/Conic_x_monotone_arc_2.h   |     0
 .../Consolidated_curve_data_aux.h                  |     0
 .../CGAL/Arr_geometry_traits/Curve_data_aux.h      |     0
 .../CGAL/Arr_geometry_traits/Hyperbolic_arc_2.h    |     0
 .../Arr_geometry_traits/IO/Polycurve_2_iostream.h  |     0
 .../include/CGAL/Arr_geometry_traits/Polycurve_2.h |     0
 .../include/CGAL/Arr_geometry_traits/Polyline_2.h  |     0
 .../CGAL/Arr_geometry_traits/Rational_arc_2.h      |     0
 .../CGAL/Arr_geometry_traits/Segment_assertions.h  |     0
 .../CGAL/Arr_geometry_traits/de_Casteljau_2.h      |     0
 .../include/CGAL/Arr_landmarks_point_location.h    |     0
 .../include/CGAL/Arr_line_arc_traits_2.h           |     0
 .../include/CGAL/Arr_linear_traits_2.h             |     0
 .../include/CGAL/Arr_naive_point_location.h        |     0
 .../CGAL/Arr_non_caching_segment_basic_traits_2.h  |     0
 .../CGAL/Arr_non_caching_segment_traits_2.h        |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Arr_observer.h |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Arr_overlay.h  |     0
 .../include/CGAL/Arr_overlay_2.h                   |     0
 .../Arr_batched_point_location_traits_2.h          |     0
 .../Arr_point_location/Arr_landmarks_pl_impl.h     |     0
 .../Arr_point_location/Arr_lm_generator_base.h     |     0
 .../Arr_point_location/Arr_lm_grid_generator.h     |     0
 .../Arr_point_location/Arr_lm_halton_generator.h   |     0
 .../Arr_lm_middle_edges_generator.h                |     0
 .../Arr_point_location/Arr_lm_nearest_neighbor.h   |     0
 .../Arr_point_location/Arr_lm_random_generator.h   |     0
 .../Arr_lm_specified_points_generator.h            |     0
 .../Arr_point_location/Arr_lm_vertices_generator.h |     0
 .../Arr_naive_point_location_impl.h                |     0
 .../Arr_simple_point_location_impl.h               |     0
 .../Arr_point_location/Arr_trapezoid_ric_pl_impl.h |     0
 .../Arr_triangulation_pl_functions.h               |     0
 .../Arr_point_location/Arr_triangulation_pl_impl.h |     0
 .../Arr_walk_along_line_pl_impl.h                  |     0
 .../CGAL/Arr_point_location/Td_X_trapezoid.h       |     0
 .../CGAL/Arr_point_location/Td_active_edge.h       |     0
 .../Td_active_fictitious_vertex.h                  |     0
 .../CGAL/Arr_point_location/Td_active_trapezoid.h  |     0
 .../CGAL/Arr_point_location/Td_active_vertex.h     |     0
 .../include/CGAL/Arr_point_location/Td_dag.h       |     0
 .../include/CGAL/Arr_point_location/Td_dag_node.h  |     0
 .../CGAL/Arr_point_location/Td_inactive_edge.h     |     0
 .../Td_inactive_fictitious_vertex.h                |     0
 .../Arr_point_location/Td_inactive_trapezoid.h     |     0
 .../CGAL/Arr_point_location/Td_inactive_vertex.h   |     0
 .../include/CGAL/Arr_point_location/Td_ninetuple.h |     0
 .../CGAL/Arr_point_location/Td_predicates.h        |     0
 .../include/CGAL/Arr_point_location/Td_traits.h    |     0
 .../CGAL/Arr_point_location/Td_traits_functions.h  |     0
 .../Trapezoidal_decomposition_2.h                  |     0
 .../Trapezoidal_decomposition_2_impl.h             |     0
 .../Trapezoidal_decomposition_2_iostream.h         |     0
 .../Trapezoidal_decomposition_2_misc.h             |     0
 .../include/CGAL/Arr_point_location_result.h       |     0
 .../include/CGAL/Arr_polycurve_basic_traits_2.h    |  2724 ++
 .../include/CGAL/Arr_polycurve_traits_2.h          |     0
 3rdparty/CGAL/include/CGAL/Arr_polyline_traits_2.h |   600 +
 .../include/CGAL/Arr_rat_arc/Algebraic_point_2.h   |     0
 .../CGAL/Arr_rat_arc/Base_rational_arc_ds_1.h      |     0
 .../include/CGAL/Arr_rat_arc/Cache.h               |     0
 .../include/CGAL/Arr_rat_arc/Rational_arc_d_1.h    |     0
 .../include/CGAL/Arr_rat_arc/Rational_function.h   |     0
 .../Rational_function_canonicalized_pair.h         |     0
 .../Arr_rat_arc/Rational_function_ordered_pair.h   |     0
 .../CGAL/Arr_rat_arc/Rational_function_pair.h      |     0
 .../include/CGAL/Arr_rat_arc/Singleton.h           |     0
 .../include/CGAL/Arr_rational_function_traits_2.h  |     0
 .../include/CGAL/Arr_segment_traits_2.h            |     0
 .../include/CGAL/Arr_simple_point_location.h       |     0
 .../Arr_on_sphere_transformation.h                 |     0
 .../Arr_polyhedral_sgm.h                           |     0
 .../Arr_polyhedral_sgm_arr_dcel.h                  |     0
 .../Arr_polyhedral_sgm_initializer_visitor.h       |     0
 .../Arr_polyhedral_sgm_overlay.h                   |     0
 .../Arr_polyhedral_sgm_polyhedron_3.h              |     0
 .../Arr_polyhedral_sgm_traits.h                    |     0
 .../Arr_polyhedral_sgm_transformation.h            |     0
 .../Arr_spherical_gaussian_map_3.h                 |   404 +
 .../Arr_transform_on_sphere.h                      |     0
 .../include/CGAL/Arr_spherical_topology_traits_2.h |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Arr_tags.h     |     0
 .../Arr_bounded_planar_batched_pl_helper.h         |     0
 .../Arr_bounded_planar_construction_helper.h       |     0
 .../Arr_bounded_planar_insertion_helper.h          |     0
 .../Arr_bounded_planar_overlay_helper.h            |     0
 .../Arr_bounded_planar_topology_traits_2_impl.h    |     0
 .../Arr_bounded_planar_vert_decomp_helper.h        |     0
 .../Arr_inc_insertion_zone_visitor.h               |     0
 .../Arr_planar_topology_traits_base_2.h            |     0
 .../Arr_spherical_batched_pl_helper.h              |     0
 .../Arr_spherical_construction_helper.h            |     0
 .../Arr_spherical_insertion_helper.h               |     0
 .../Arr_spherical_overlay_helper.h                 |     0
 .../Arr_spherical_topology_traits_2_impl.h         |     0
 .../Arr_spherical_vert_decomp_helper.h             |     0
 .../Arr_unb_planar_batched_pl_helper.h             |     0
 .../Arr_unb_planar_construction_helper.h           |     0
 .../Arr_unb_planar_insertion_helper.h              |     0
 .../Arr_unb_planar_overlay_helper.h                |     0
 .../Arr_unb_planar_topology_traits_2_impl.h        |     0
 .../Arr_unb_planar_vert_decomp_helper.h            |     0
 .../include/CGAL/Arr_tracing_traits_2.h            |     0
 .../CGAL/Arr_trapezoid_ric_point_location.h        |     0
 .../CGAL/Arr_triangulation_point_location.h        |     0
 .../CGAL/Arr_unb_planar_topology_traits_2.h        |     0
 3rdparty/CGAL/include/CGAL/Arr_vertex_index_map.h  |   281 +
 .../include/CGAL/Arr_vertex_map.h                  |     0
 .../include/CGAL/Arr_vertical_decomposition_2.h    |     0
 .../CGAL/Arr_walk_along_line_point_location.h      |     0
 .../include/CGAL/Arrangement_2.h                   |     0
 .../CGAL/Arrangement_2/Arr_compute_zone_visitor.h  |     0
 .../Arrangement_2/Arr_default_planar_topology.h    |     0
 .../Arrangement_2/Arr_do_intersect_zone_visitor.h  |     0
 .../Arr_on_surface_with_history_2_impl.h           |     0
 .../CGAL/Arrangement_2/Arr_traits_adaptor_2.h      |     0
 .../Arr_traits_adaptor_2_dispatching.h             |     0
 .../CGAL/Arrangement_2/Arr_with_history_accessor.h |     0
 .../CGAL/Arrangement_2/Arrangement_2_iterators.h   |     0
 .../Arrangement_on_surface_2_global.h              |     0
 .../Arrangement_2/Arrangement_on_surface_2_impl.h  |     0
 .../CGAL/Arrangement_2/Arrangement_zone_2_impl.h   |     0
 .../include/CGAL/Arrangement_2/Open_hash.h         |     0
 .../CGAL/Arrangement_2/arrangement_type_traits.h   |     0
 .../include/CGAL/Arrangement_on_surface_2.h        |     0
 .../CGAL/Arrangement_on_surface_with_history_2.h   |     0
 .../include/CGAL/Arrangement_with_history_2.h      |     0
 .../include/CGAL/Arrangement_zone_2.h              |     0
 .../include/CGAL/Barycentric_coordinates_2.h       |     0
 .../Discrete_harmonic_2.h                          |     0
 .../Generalized_barycentric_coordinates_2.h        |     0
 .../CGAL/Barycentric_coordinates_2/Mean_value_2.h  |     0
 .../Segment_coordinates_2.h                        |     0
 .../Triangle_coordinates_2.h                       |     0
 .../CGAL/Barycentric_coordinates_2/Wachspress_2.h  |     0
 .../Barycentric_coordinates_2/barycentric_enum_2.h |     0
 .../CGAL/Barycentric_mapping_parameterizer_3.h     |     0
 .../include/CGAL/Basic_sweep_line_2.h              |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/Bbox_2.h  |     0
 .../include/CGAL/Bbox_2_Line_2_intersection.h      |     0
 .../include/CGAL/Bbox_2_Line_2_intersection_impl.h |     0
 .../include/CGAL/Bbox_2_Ray_2_intersection.h       |     0
 .../include/CGAL/Bbox_2_intersection.h             |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/Bbox_3.h  |     0
 .../include/CGAL/Bigfloat_interval_traits.h        |     0
 .../include/CGAL/Boolean_set_operations_2.h        |     0
 .../Bso_internal_functions.h                       |     0
 .../Boolean_set_operations_2/Ccb_curve_iterator.h  |     0
 .../Boolean_set_operations_2/Curve_with_halfedge.h |     0
 .../Boolean_set_operations_2/Gps_agg_meta_traits.h |     0
 .../CGAL/Boolean_set_operations_2/Gps_agg_op.h     |     0
 .../Boolean_set_operations_2/Gps_agg_op_sweep.h    |     0
 .../Boolean_set_operations_2/Gps_agg_op_visitor.h  |     0
 .../Boolean_set_operations_2/Gps_base_functor.h    |     0
 .../Gps_bfs_base_visitor.h                         |     0
 .../Gps_bfs_intersection_visitor.h                 |     0
 .../Gps_bfs_join_visitor.h                         |     0
 .../Boolean_set_operations_2/Gps_bfs_scanner.h     |     0
 .../Boolean_set_operations_2/Gps_bfs_xor_visitor.h |     0
 .../Boolean_set_operations_2/Gps_default_dcel.h    |     0
 .../Boolean_set_operations_2/Gps_default_traits.h  |     0
 .../Gps_difference_functor.h                       |     0
 .../Gps_do_intersect_functor.h                     |     0
 .../Gps_insertion_meta_traits.h                    |     0
 .../Gps_intersection_functor.h                     |     0
 .../Boolean_set_operations_2/Gps_join_functor.h    |     0
 .../CGAL/Boolean_set_operations_2/Gps_merge.h      |     0
 .../Gps_on_surface_base_2.h                        |     0
 .../Gps_on_surface_base_2_impl.h                   |     0
 .../Gps_polygon_simplifier.h                       |     0
 .../Gps_polygon_validation.h                       |     0
 .../Gps_simplifier_traits.h                        |     0
 .../Gps_sym_diff_functor.h                         |     0
 .../Boolean_set_operations_2/Gps_traits_adaptor.h  |     0
 .../Gps_traits_decorator.h                         |     0
 .../Boolean_set_operations_2/Point_with_vertex.h   |     0
 .../Polygon_2_curve_iterator.h                     |     0
 .../include/CGAL/Bounded_kernel.h                  |     0
 .../include/CGAL/Box_intersection_d/Box_d.h        |     0
 .../include/CGAL/Box_intersection_d/Box_traits_d.h |     0
 .../CGAL/Box_intersection_d/Box_with_handle_d.h    |     0
 .../CGAL/Box_intersection_d/Box_with_info_d.h      |     0
 .../include/CGAL/Box_intersection_d/box_limits.h   |     0
 .../include/CGAL/Box_intersection_d/segment_tree.h |     0
 .../include/CGAL/CC_safe_handle.h                  |     0
 .../include/CGAL/CGAL_Ipelet_base.h                |     0
 .../include/CGAL/CGAL_Ipelet_base_v6.h             |     0
 .../include/CGAL/CGAL_Ipelet_base_v7.h             |     0
 .../include/CGAL/CORE/BigFloat.h                   |     0
 .../include/CGAL/CORE/BigFloatRep.h                |     0
 3rdparty/CGAL/include/CGAL/CORE/BigFloat_impl.h    |  1327 +
 .../{CGAL-4.8 => CGAL}/include/CGAL/CORE/BigInt.h  |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/CORE/BigRat.h  |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/CORE/CORE.h    |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/CORE/Config.h  |     0
 3rdparty/CGAL/include/CGAL/CORE/CoreAux.h          |   189 +
 3rdparty/CGAL/include/CGAL/CORE/CoreAux_impl.h     |   226 +
 .../include/CGAL/CORE/CoreDefs.h                   |     0
 .../include/CGAL/CORE/CoreDefs_impl.h              |     0
 .../include/CGAL/CORE/CoreIO_impl.h                |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/CORE/Expr.h    |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/CORE/ExprRep.h |     0
 3rdparty/CGAL/include/CGAL/CORE/Expr_impl.h        |  1255 +
 .../{CGAL-4.8 => CGAL}/include/CGAL/CORE/Filter.h  |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/CORE/Gmp.h     |     0
 .../include/CGAL/CORE/Gmp_impl.h                   |     0
 3rdparty/CGAL/include/CGAL/CORE/Impl.h             |    80 +
 3rdparty/CGAL/include/CGAL/CORE/MemoryPool.h       |   138 +
 .../{CGAL-4.8 => CGAL}/include/CGAL/CORE/Promote.h |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/CORE/Real.h    |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/CORE/RealRep.h |     0
 3rdparty/CGAL/include/CGAL/CORE/Real_impl.h        |   292 +
 .../include/CGAL/CORE/RefCount.h                   |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/CORE/Timer.h   |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/CORE/extLong.h |     0
 .../include/CGAL/CORE/extLong_impl.h               |     0
 .../include/CGAL/CORE/geom2d/circle2d.h            |     0
 .../include/CGAL/CORE/geom2d/line2d.h              |     0
 .../include/CGAL/CORE/geom2d/point2d.h             |     0
 .../include/CGAL/CORE/geom2d/segment2d.h           |     0
 .../include/CGAL/CORE/geom3d/line3d.h              |     0
 .../include/CGAL/CORE/geom3d/plane3d.h             |     0
 .../include/CGAL/CORE/geom3d/point3d.h             |     0
 .../include/CGAL/CORE/geom3d/polygon3d.h           |     0
 .../include/CGAL/CORE/geom3d/segment3d.h           |     0
 .../include/CGAL/CORE/geom3d/triangle3d.h          |     0
 .../include/CGAL/CORE/geombase.h                   |     0
 .../include/CGAL/CORE/geometry2d.h                 |     0
 .../include/CGAL/CORE/geometry3d.h                 |     0
 .../include/CGAL/CORE/linearAlgebra.h              |     0
 .../include/CGAL/CORE/poly/Curves.h                |     0
 .../include/CGAL/CORE/poly/Curves.tcc              |     0
 .../include/CGAL/CORE/poly/Poly.h                  |     0
 .../include/CGAL/CORE/poly/Poly.tcc                |     0
 .../include/CGAL/CORE/poly/Sturm.h                 |     0
 3rdparty/CGAL/include/CGAL/CORE_BigFloat.h         |   551 +
 3rdparty/CGAL/include/CGAL/CORE_BigInt.h           |   227 +
 3rdparty/CGAL/include/CGAL/CORE_BigRat.h           |   263 +
 3rdparty/CGAL/include/CGAL/CORE_Expr.h             |   216 +
 .../include/CGAL/CORE_algebraic_number_traits.h    |     0
 .../include/CGAL/CORE_arithmetic_kernel.h          |     0
 .../include/CGAL/CORE_coercion_traits.h            |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/Cache.h   |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Cartesian.h    |     0
 .../include/CGAL/Cartesian/Aff_transformation_2.h  |     0
 .../include/CGAL/Cartesian/Aff_transformation_3.h  |     0
 .../CGAL/Cartesian/Aff_transformation_rep_2.h      |     0
 .../CGAL/Cartesian/Aff_transformation_rep_3.h      |     0
 .../include/CGAL/Cartesian/Cartesian_base.h        |     0
 .../include/CGAL/Cartesian/Circle_2.h              |     0
 .../include/CGAL/Cartesian/Circle_3.h              |     0
 .../include/CGAL/Cartesian/Data_accessor_2.h       |     0
 .../include/CGAL/Cartesian/Direction_2.h           |     0
 .../include/CGAL/Cartesian/Direction_3.h           |     0
 .../include/CGAL/Cartesian/Iso_cuboid_3.h          |     0
 .../include/CGAL/Cartesian/Iso_rectangle_2.h       |     0
 .../include/CGAL/Cartesian/Line_2.h                |     0
 .../include/CGAL/Cartesian/Line_3.h                |     0
 .../include/CGAL/Cartesian/MatrixC33.h             |     0
 .../include/CGAL/Cartesian/Plane_3.h               |     0
 .../include/CGAL/Cartesian/Point_2.h               |     0
 .../include/CGAL/Cartesian/Point_3.h               |     0
 .../include/CGAL/Cartesian/Ray_2.h                 |     0
 .../include/CGAL/Cartesian/Ray_3.h                 |     0
 .../include/CGAL/Cartesian/Rotation_rep_2.h        |     0
 .../include/CGAL/Cartesian/Scaling_rep_2.h         |     0
 .../include/CGAL/Cartesian/Scaling_rep_3.h         |     0
 .../include/CGAL/Cartesian/Segment_2.h             |     0
 .../include/CGAL/Cartesian/Segment_3.h             |     0
 .../include/CGAL/Cartesian/Sphere_3.h              |     0
 .../include/CGAL/Cartesian/Tetrahedron_3.h         |     0
 .../include/CGAL/Cartesian/Translation_rep_2.h     |     0
 .../include/CGAL/Cartesian/Translation_rep_3.h     |     0
 .../include/CGAL/Cartesian/Triangle_2.h            |     0
 .../include/CGAL/Cartesian/Triangle_3.h            |     0
 3rdparty/CGAL/include/CGAL/Cartesian/Vector_2.h    |   153 +
 .../include/CGAL/Cartesian/Vector_3.h              |     0
 .../include/CGAL/Cartesian/basic_constructions_2.h |     0
 .../include/CGAL/Cartesian/basic_constructions_3.h |     0
 .../include/CGAL/Cartesian/ft_constructions_2.h    |     0
 .../include/CGAL/Cartesian/ft_constructions_3.h    |     0
 .../CGAL/include/CGAL/Cartesian/function_objects.h |  4083 +++
 .../include/CGAL/Cartesian/line_constructions_2.h  |     0
 .../include/CGAL/Cartesian/plane_constructions_3.h |     0
 .../include/CGAL/Cartesian/point_constructions_2.h |     0
 .../include/CGAL/Cartesian/point_constructions_3.h |     0
 .../CGAL/Cartesian/predicates_on_directions_2.h    |     0
 .../CGAL/Cartesian/predicates_on_planes_3.h        |     0
 .../CGAL/Cartesian/predicates_on_points_2.h        |     0
 .../CGAL/Cartesian/predicates_on_points_3.h        |     0
 .../include/CGAL/Cartesian/solve_3.h               |     0
 .../include/CGAL/Cartesian_converter.h             |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Cartesian_d.h  |     0
 .../include/CGAL/Cartesian_matrix.h                |     0
 .../include/CGAL/Cell_attribute.h                  |     0
 .../include/CGAL/Cell_attribute_with_point.h       |     0
 .../include/CGAL/Cell_const_iterators.h            |     0
 .../include/CGAL/Cell_iterators.h                  |     0
 .../include/CGAL/Chinese_remainder_traits.h        |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Circle_2.h     |     0
 .../include/CGAL/Circle_2_Circle_2_intersection.h  |     0
 .../include/CGAL/Circle_2_Line_2_intersection.h    |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Circle_3.h     |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Circle_type.h  |     0
 .../include/CGAL/Circular_arc_2.h                  |     0
 .../include/CGAL/Circular_arc_3.h                  |     0
 .../include/CGAL/Circular_arc_point_2.h            |     0
 .../include/CGAL/Circular_arc_point_3.h            |     0
 .../include/CGAL/Circular_border_parameterizer_3.h |     0
 .../include/CGAL/Circular_kernel_2.h               |     0
 .../CGAL/Circular_kernel_2/Circular_arc_2.h        |     0
 .../CGAL/Circular_kernel_2/Circular_arc_point_2.h  |     0
 .../CGAL/Circular_kernel_2/Intersection_traits.h   |     0
 .../include/CGAL/Circular_kernel_2/Line_arc_2.h    |     0
 .../function_objects_on_circle_2.h                 |     0
 .../Circular_kernel_2/function_objects_on_line_2.h |     0
 .../function_objects_polynomial_circular.h         |     0
 .../CGAL/Circular_kernel_2/interface_macros.h      |     0
 .../internal_functions_on_circle_2.h               |     0
 .../internal_functions_on_circular_arc_2.h         |     0
 .../internal_functions_on_line_2.h                 |     0
 .../internal_functions_on_line_arc_2.h             |     0
 .../intersection_line_2_circle_2_map.h             |     0
 .../CGAL/Circular_kernel_3/Circular_arc_3.h        |     0
 .../CGAL/Circular_kernel_3/Circular_arc_point_3.h  |     0
 .../CGAL/Circular_kernel_3/Intersection_traits.h   |     0
 .../include/CGAL/Circular_kernel_3/Line_arc_3.h    |     0
 .../function_objects_polynomial_sphere.h           |     0
 .../get_equation_object_on_curved_kernel_3.h       |     0
 .../CGAL/Circular_kernel_3/interface_macros.h      |     0
 .../internal_function_compare_spherical_kernel.h   |     0
 ...al_function_compare_to_right_spherical_kernel.h |     0
 .../internal_function_has_on_spherical_kernel.h    |     0
 .../internal_functions_on_circle_3.h               |     0
 .../internal_functions_on_circular_arc_3.h         |     0
 .../internal_functions_on_circular_arc_point_3.h   |     0
 .../internal_functions_on_line_3.h                 |     0
 .../internal_functions_on_line_arc_3.h             |     0
 .../internal_functions_on_plane_3.h                |     0
 .../internal_functions_on_sphere_3.h               |     0
 .../include/CGAL/Circular_kernel_converter.h       |     0
 .../include/CGAL/Circular_kernel_intersections.h   |     0
 .../CGAL/Circular_kernel_type_equality_wrapper.h   |     0
 .../include/CGAL/Circulator/Circulator_adapters.h  |     0
 .../include/CGAL/Circulator/Circulator_concepts.h  |     0
 .../Circulator/Safe_circulator_from_iterator.h     |     0
 .../include/CGAL/Circulator_identity.h             |     0
 .../include/CGAL/Circulator_on_node.h              |     0
 .../include/CGAL/Circulator_project.h              |     0
 .../include/CGAL/Coercion_traits.h                 |     0
 .../include/CGAL/Combination_enumerator.h          |     0
 3rdparty/CGAL/include/CGAL/Combinatorial_map.h     |  4761 ++++
 .../CGAL/Combinatorial_map_basic_operations.h      |     0
 .../include/CGAL/Combinatorial_map_constructors.h  |   143 +
 .../include/CGAL/Combinatorial_map_functors.h      |     0
 .../include/CGAL/Combinatorial_map_insertions.h    |   154 +
 .../CGAL/Combinatorial_map_iterators_base.h        |   601 +
 .../include/CGAL/Combinatorial_map_min_items.h     |     0
 .../include/CGAL/Combinatorial_map_operations.h    |   824 +
 .../include/CGAL/Combinatorial_map_save_load.h     |     0
 .../CGAL/include/CGAL/Combinatorial_map_storages.h |   391 +
 3rdparty/CGAL/include/CGAL/Compact_container.h     |  1208 +
 .../CGAL/include/CGAL/Compact_mesh_cell_base_3.h   |   715 +
 .../include/CGAL/Complex_2_in_triangulation_3.h    |     0
 .../CGAL/Complex_2_in_triangulation_cell_base_3.h  |     0
 .../Complex_2_in_triangulation_vertex_base_3.h     |     0
 .../include/CGAL/Complexity_tags.h                 |     0
 .../include/CGAL/Compute_anchor_3.h                |     0
 .../CGAL/include/CGAL/Compute_cone_boundaries_2.h  |   220 +
 .../include/CGAL/Concatenate_iterator.h            |     0
 .../include/CGAL/Concurrent_compact_container.h    |     0
 .../CGAL/Cone_spanners_2/Less_by_direction_2.h     |   107 +
 .../include/CGAL/Cone_spanners_2/Plane_scan_tree.h |   255 +
 .../CGAL/Cone_spanners_2/Plane_scan_tree_impl.h    |   636 +
 .../{CGAL-4.8 => CGAL}/include/CGAL/ConicCPA2.h    |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/ConicHPA2.h    |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/Conic_2.h |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Conic_misc.h   |     0
 .../CGAL/Constrained_Delaunay_triangulation_2.h    |   981 +
 ...onstrained_Delaunay_triangulation_face_base_2.h |     0
 .../include/CGAL/Constrained_triangulation_2.h     |  1453 ++
 .../CGAL/Constrained_triangulation_face_base_2.h   |     0
 .../CGAL/Constrained_triangulation_plus_2.h        |  1236 +
 .../include/CGAL/Constrained_voronoi_diagram_2.h   |     0
 .../include/CGAL/Constraint_hierarchy_2.h          |     0
 .../CGAL/include/CGAL/Construct_theta_graph_2.h    |   230 +
 3rdparty/CGAL/include/CGAL/Construct_yao_graph_2.h |   238 +
 .../include/CGAL/Convertible_circulator_project.h  |     0
 .../include/CGAL/Convertible_filter_iterator.h     |     0
 .../include/CGAL/Convertible_iterator_project.h    |     0
 .../CGAL/Convex_decomposition_3/Edge_sorter.h      |     0
 .../External_structure_builder.h                   |     0
 .../Insert_vertex_into_edge.h                      |     0
 .../Convex_decomposition_3/Ray_hit_generator.h     |     0
 .../Convex_decomposition_3/Ray_hit_generator2.h    |     0
 .../Convex_decomposition_3/Reflex_edge_searcher.h  |     0
 .../Reflex_vertex_searcher.h                       |     0
 .../CGAL/Convex_decomposition_3/SFace_separator.h  |     0
 .../include/CGAL/Convex_decomposition_3/SM_walls.h |     0
 .../Convex_decomposition_3/Single_wall_creator.h   |     0
 .../Convex_decomposition_3/Single_wall_creator2.h  |     0
 .../Convex_decomposition_3/Single_wall_creator3.h  |     0
 .../YVertical_wall_builder.h                       |     0
 .../CGAL/Convex_decomposition_3/is_reflex_sedge.h  |     0
 .../CGAL/Convex_hull_2/ch_akl_toussaint_impl.h     |     0
 .../include/CGAL/Convex_hull_2/ch_assertions.h     |     0
 .../include/CGAL/Convex_hull_2/ch_bykat_impl.h     |     0
 .../include/CGAL/Convex_hull_2/ch_eddy_impl.h      |     0
 .../CGAL/Convex_hull_2/ch_graham_andrew_impl.h     |     0
 .../include/CGAL/Convex_hull_2/ch_jarvis_impl.h    |     0
 .../include/CGAL/Convex_hull_2/ch_melkman_impl.h   |     0
 .../ch_selected_extreme_points_2_impl.h            |     0
 .../CGAL/Convex_hull_2/convexity_check_2_impl.h    |     0
 .../Convex_hull_3/dual/Convex_hull_traits_dual_2.h |     0
 .../Convex_hull_3/dual/Convex_hull_traits_dual_3.h |     0
 .../Convex_hull_3/dual/halfspace_intersection_3.h  |     0
 .../halfspace_intersection_with_constructions_3.h  |     0
 .../Convex_hull_3/dual/interior_polyhedron_3.h     |     0
 .../include/CGAL/Convex_hull_3/dual/predicates.h   |     0
 .../include/CGAL/Convex_hull_d.h                   |     0
 .../include/CGAL/Convex_hull_d_to_polyhedron_3.h   |     0
 .../include/CGAL/Convex_hull_d_traits_3.h          |     0
 .../include/CGAL/Convex_hull_face_base_2.h         |     0
 .../CGAL/Convex_hull_projective_xy_traits_2.h      |     0
 .../CGAL/Convex_hull_projective_xz_traits_2.h      |     0
 .../CGAL/Convex_hull_projective_yz_traits_2.h      |     0
 .../include/CGAL/Convex_hull_traits_3.h            |     0
 .../include/CGAL/Counted_number.h                  |     0
 .../include/CGAL/Counting_iterator.h               |     0
 .../CGAL/Curved_kernel_via_analysis_2/Arc_2.h      |     0
 .../Curve_interval_arcno_cache.h                   |     0
 .../Curve_renderer_facade.h                        |     0
 .../Curved_kernel_via_analysis_2_functors.h        |     0
 .../Curved_kernel_via_analysis_2_impl.h            |     0
 .../Fig_stream_Curve_renderer_2.h                  |     0
 .../Filtered_curved_kernel_via_analysis_2_impl.h   |     0
 .../Curved_kernel_via_analysis_2/Generic_arc_2.h   |     0
 .../Curved_kernel_via_analysis_2/Generic_point_2.h |     0
 .../Make_x_monotone_2.h                            |     0
 .../Non_x_monotone_arc_2.h                         |   313 +
 .../CGAL/Curved_kernel_via_analysis_2/Point_2.h    |     0
 .../Sweep_curves_adapter_2.h                       |     0
 .../gfx/Curve_renderer_2.h                         |     0
 .../gfx/Curve_renderer_internals.h                 |     0
 .../gfx/Curve_renderer_traits.h                    |     0
 .../gfx/Subdivision_1.h                            |     0
 .../gfx/Subdivision_2.h                            |     0
 .../test/simple_models.h                           |     0
 3rdparty/CGAL/include/CGAL/Dart.h                  |   244 +
 .../include/CGAL/Dart_const_iterators.h            |     0
 .../include/CGAL/Dart_iterators.h                  |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/Default.h |     0
 .../include/CGAL/Default_diagonalize_traits.h      |     0
 .../Deformation_Eigen_closest_rotation_traits_3.h  |     0
 ...rmation_Eigen_polar_closest_rotation_traits_3.h |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Delaunay_d.h   |     0
 .../include/CGAL/Delaunay_mesh_area_criteria_2.h   |     0
 .../include/CGAL/Delaunay_mesh_criteria_2.h        |     0
 .../include/CGAL/Delaunay_mesh_face_base_2.h       |     0
 .../CGAL/Delaunay_mesh_local_size_criteria_2.h     |     0
 .../include/CGAL/Delaunay_mesh_size_criteria_2.h   |     0
 .../include/CGAL/Delaunay_mesh_vertex_base_2.h     |     0
 .../include/CGAL/Delaunay_mesher_2.h               |     0
 .../CGAL/Delaunay_mesher_no_edge_refinement_2.h    |     0
 .../CGAL/include/CGAL/Delaunay_triangulation.h     |   897 +
 .../CGAL/include/CGAL/Delaunay_triangulation_2.h   |  2488 ++
 .../CGAL/include/CGAL/Delaunay_triangulation_3.h   |  2084 ++
 .../Delaunay_triangulation_adaptation_policies_2.h |     0
 .../Delaunay_triangulation_adaptation_traits_2.h   |     0
 .../CGAL/Delaunay_triangulation_cell_base_3.h      |     0
 ...y_triangulation_cell_base_with_circumcenter_3.h |     0
 3rdparty/CGAL/include/CGAL/Diagonalize_traits.h    |   275 +
 .../{CGAL-4.8 => CGAL}/include/CGAL/Dimension.h    |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Direction_2.h  |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Direction_3.h  |     0
 .../CGAL/Discrete_authalic_parameterizer_3.h       |     0
 .../CGAL/Discrete_conformal_map_parameterizer_3.h  |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Distance_2.h   |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Double_map.h   |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Dummy_tds_2.h  |     0
 .../include/CGAL/Dynamic_matrix.h                  |     0
 .../include/CGAL/Edge_hash_function.h              |     0
 .../include/CGAL/Eigen_diagonalize_traits.h        |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Eigen_matrix.h |     0
 .../include/CGAL/Eigen_solver_traits.h             |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Eigen_svd.h    |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Eigen_vector.h |     0
 .../include/CGAL/Enum_converter.h                  |     0
 .../include/CGAL/Env_default_diagram_1.h           |     0
 .../include/CGAL/Env_plane_traits_3.h              |     0
 .../include/CGAL/Env_sphere_traits_3.h             |     0
 .../include/CGAL/Env_surface_data_traits_3.h       |     0
 .../include/CGAL/Env_tracing_traits_3.h            |     0
 .../include/CGAL/Env_triangle_traits_3.h           |     0
 .../CGAL/Envelope_2/Env_divide_and_conquer_2.h     |     0
 .../Envelope_2/Env_divide_and_conquer_2_impl.h     |     0
 .../CGAL/Envelope_3/Env_plane_traits_3_functions.h |     0
 .../include/CGAL/Envelope_3/Envelope_base.h        |     0
 .../Envelope_3/Envelope_diagram_on_surface_2.h     |     0
 .../Envelope_3/Envelope_divide_and_conquer_3.h     |     0
 .../CGAL/Envelope_3/Envelope_element_visitor_3.h   |     0
 .../include/CGAL/Envelope_3/Envelope_overlay_2.h   |     0
 .../CGAL/Envelope_3/Envelope_overlay_functor.h     |     0
 .../include/CGAL/Envelope_3/Envelope_pm_dcel.h     |     0
 .../CGAL/include/CGAL/Envelope_3/set_dividors.h    |   120 +
 .../include/CGAL/Envelope_diagram_1.h              |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/Epick_d.h |     0
 3rdparty/CGAL/include/CGAL/Euclidean_distance.h    |   205 +
 .../include/CGAL/Euclidean_distance_sphere_point.h |   167 +
 .../include/CGAL/Euler_integrator_2.h              |     0
 .../CGAL/include/CGAL/Exact_circular_kernel_2.h    |    77 +
 .../include/CGAL/Exact_integer.h                   |     0
 .../Exact_predicates_exact_constructions_kernel.h  |     0
 ...ates_exact_constructions_kernel_with_kth_root.h |     0
 ...cates_exact_constructions_kernel_with_root_of.h |     0
 ...edicates_exact_constructions_kernel_with_sqrt.h |     0
 ...Exact_predicates_inexact_constructions_kernel.h |     0
 .../include/CGAL/Exact_rational.h                  |     0
 .../include/CGAL/Exact_spherical_kernel_3.h        |     0
 .../include/CGAL/Exponent_vector.h                 |     0
 .../include/CGAL/Extended_cartesian.h              |     0
 .../include/CGAL/Extended_homogeneous.h            |     0
 .../include/CGAL/Extremal_polygon_traits_2.h       |     0
 3rdparty/CGAL/include/CGAL/FPU.h                   |   523 +
 .../include/CGAL/FPU_extension.h                   |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/FPU_gcc_i386.h |     0
 .../include/CGAL/FPU_gcc_i386_sse2.h               |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/FPU_msvc.h     |     0
 .../include/CGAL/Filter_circulator.h               |     0
 .../include/CGAL/Filtered_bbox_circular_kernel_2.h |     0
 .../bbox_filtered_predicates.h                     |     0
 .../interface_macros.h                             |     0
 .../include/CGAL/Filtered_construction.h           |     0
 .../include/CGAL/Filtered_extended_homogeneous.h   |  1287 +
 .../include/CGAL/Filtered_kernel.h                 |     0
 .../Cartesian_coordinate_iterator_2.h              |     0
 .../Cartesian_coordinate_iterator_3.h              |     0
 .../include/CGAL/Filtered_kernel_d.h               |     0
 .../include/CGAL/Filtered_kernel_fwd.h             |     0
 .../include/CGAL/Filtered_predicate.h              |     0
 .../include/CGAL/Fixed_alpha_shape_3.h             |     0
 .../include/CGAL/Fixed_alpha_shape_cell_base_3.h   |     0
 .../include/CGAL/Fixed_alpha_shape_vertex_base_3.h |     0
 .../include/CGAL/Fixed_border_parameterizer_3.h    |     0
 .../include/CGAL/Flattening_iterator.h             |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Fourtuple.h    |     0
 .../include/CGAL/Fraction_traits.h                 |     0
 .../include/CGAL/Fuzzy_iso_box.h                   |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Fuzzy_sphere.h |     0
 .../include/CGAL/GMP/Gmpfi_type.h                  |     0
 .../include/CGAL/GMP/Gmpfi_type_static.h           |     0
 3rdparty/CGAL/include/CGAL/GMP/Gmpfr_type.h        |  1341 +
 .../include/CGAL/GMP/Gmpfr_type_static.h           |     0
 .../include/CGAL/GMP/Gmpq_type.h                   |     0
 3rdparty/CGAL/include/CGAL/GMP/Gmpz_type.h         |   438 +
 3rdparty/CGAL/include/CGAL/GMP/Gmpzf_type.h        |   591 +
 .../include/CGAL/GMP_arithmetic_kernel.h           |     0
 3rdparty/CGAL/include/CGAL/General_polygon_2.h     |   221 +
 .../include/CGAL/General_polygon_set_2.h           |     0
 .../CGAL/General_polygon_set_on_surface_2.h        |     0
 .../include/CGAL/General_polygon_with_holes_2.h    |   200 +
 .../include/CGAL/Get_arithmetic_kernel.h           |     0
 .../include/CGAL/Gmp_coercion_traits.h             |     0
 3rdparty/CGAL/include/CGAL/Gmpfi.h                 |   369 +
 3rdparty/CGAL/include/CGAL/Gmpfr.h                 |   187 +
 3rdparty/CGAL/include/CGAL/Gmpq.h                  |   167 +
 3rdparty/CGAL/include/CGAL/Gmpz.h                  |   242 +
 3rdparty/CGAL/include/CGAL/Gmpzf.h                 |   186 +
 .../include/CGAL/Gps_circle_segment_traits_2.h     |     0
 .../include/CGAL/Gps_segment_traits_2.h            |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Gps_traits_2.h |     0
 .../CGAL/include/CGAL/Gray_image_mesh_domain_3.h   |   140 +
 .../include/CGAL/Gray_level_image_3.h              |     0
 .../include/CGAL/HalfedgeDS_const_decorator.h      |     0
 .../include/CGAL/HalfedgeDS_decorator.h            |     0
 .../include/CGAL/HalfedgeDS_default.h              |     0
 .../include/CGAL/HalfedgeDS_face_base.h            |     0
 .../CGAL/HalfedgeDS_face_max_base_with_id.h        |     0
 .../include/CGAL/HalfedgeDS_face_min_base.h        |     0
 .../include/CGAL/HalfedgeDS_halfedge_base.h        |     0
 .../CGAL/HalfedgeDS_halfedge_max_base_with_id.h    |     0
 .../include/CGAL/HalfedgeDS_halfedge_min_base.h    |     0
 .../include/CGAL/HalfedgeDS_items_2.h              |     0
 .../include/CGAL/HalfedgeDS_items_decorator.h      |     0
 .../include/CGAL/HalfedgeDS_iterator.h             |     0
 .../include/CGAL/HalfedgeDS_iterator_adaptor.h     |     0
 .../include/CGAL/HalfedgeDS_list.h                 |     0
 .../include/CGAL/HalfedgeDS_min_items.h            |     0
 .../include/CGAL/HalfedgeDS_vector.h               |     0
 .../include/CGAL/HalfedgeDS_vertex_base.h          |     0
 .../CGAL/HalfedgeDS_vertex_max_base_with_id.h      |     0
 .../include/CGAL/HalfedgeDS_vertex_min_base.h      |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/Handle.h  |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Handle_for.h   |     0
 .../include/CGAL/Handle_for_virtual.h              |     0
 .../include/CGAL/Handle_hash_function.h            |     0
 3rdparty/CGAL/include/CGAL/Handle_with_policy.h    |  1401 ++
 .../include/CGAL/Has_timestamp.h                   |     0
 .../include/CGAL/Hilbert_policy_tags.h             |     0
 .../include/CGAL/Hilbert_sort_2.h                  |     0
 .../include/CGAL/Hilbert_sort_3.h                  |     0
 .../include/CGAL/Hilbert_sort_base.h               |     0
 .../include/CGAL/Hilbert_sort_d.h                  |     0
 .../include/CGAL/Hilbert_sort_median_2.h           |     0
 .../include/CGAL/Hilbert_sort_median_3.h           |     0
 .../include/CGAL/Hilbert_sort_median_d.h           |     0
 .../include/CGAL/Hilbert_sort_middle_2.h           |     0
 .../include/CGAL/Hilbert_sort_middle_3.h           |     0
 .../include/CGAL/Hilbert_sort_middle_base.h        |     0
 .../include/CGAL/Hilbert_sort_middle_d.h           |     0
 .../include/CGAL/Hilbert_sort_on_sphere_3.h        |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Homogeneous.h  |     0
 .../CGAL/Homogeneous/Aff_transformationH2.h        |     0
 .../CGAL/Homogeneous/Aff_transformationH3.h        |     0
 .../include/CGAL/Homogeneous/CircleH2.h            |     0
 .../include/CGAL/Homogeneous/Data_accessorH2.h     |     0
 .../include/CGAL/Homogeneous/DirectionH2.h         |     0
 .../include/CGAL/Homogeneous/DirectionH3.h         |     0
 .../include/CGAL/Homogeneous/Homogeneous_base.h    |     0
 .../include/CGAL/Homogeneous/Iso_cuboidH3.h        |     0
 .../include/CGAL/Homogeneous/Iso_rectangleH2.h     |     0
 .../include/CGAL/Homogeneous/LineH2.h              |     0
 .../include/CGAL/Homogeneous/PlaneH3.h             |     0
 .../include/CGAL/Homogeneous/PointH2.h             |     0
 .../include/CGAL/Homogeneous/PointH3.h             |     0
 .../include/CGAL/Homogeneous/RayH3.h               |     0
 .../include/CGAL/Homogeneous/SphereH3.h            |     0
 .../include/CGAL/Homogeneous/VectorH2.h            |     0
 .../include/CGAL/Homogeneous/VectorH3.h            |     0
 .../CGAL/Homogeneous/basic_constructionsH2.h       |     0
 .../CGAL/Homogeneous/basic_constructionsH3.h       |     0
 .../CGAL/Homogeneous/distance_predicatesH2.h       |     0
 .../CGAL/Homogeneous/distance_predicatesH3.h       |     0
 .../include/CGAL/Homogeneous/function_objects.h    |     0
 .../CGAL/Homogeneous/predicates_on_directionsH2.h  |     0
 .../CGAL/Homogeneous/predicates_on_pointsH2.h      |     0
 .../CGAL/Homogeneous/predicates_on_pointsH3.h      |     0
 .../include/CGAL/Homogeneous_converter.h           |     0
 .../include/CGAL/Homogeneous_d.h                   |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Hyperbola_2.h  |     0
 .../include/CGAL/Hyperbola_ray_2.h                 |     0
 .../include/CGAL/Hyperbola_segment_2.h             |     0
 .../include/CGAL/IEEE_754_unions.h                 |     0
 .../include/CGAL/IO/Alpha_shape_3_VRML_2_ostream.h |     0
 .../include/CGAL/IO/Arr_iostream.h                 |     0
 .../include/CGAL/IO/Arr_text_formatter.h           |     0
 .../include/CGAL/IO/Arr_with_history_2_reader.h    |     0
 .../include/CGAL/IO/Arr_with_history_2_writer.h    |     0
 .../include/CGAL/IO/Arr_with_history_iostream.h    |     0
 .../CGAL/IO/Arr_with_history_text_formatter.h      |     0
 .../include/CGAL/IO/Arrangement_2_reader.h         |     0
 .../include/CGAL/IO/Arrangement_2_writer.h         |     0
 3rdparty/CGAL/include/CGAL/IO/Color.h              |   104 +
 .../include/CGAL/IO/Color_impl.h                   |     0
 .../IO/Complex_2_in_triangulation_3_file_writer.h  |     0
 ...mplex_2_in_triangulation_3_polyhedron_builder.h |     0
 .../CGAL/IO/Complex_2_in_triangulation_3_to_vtk.h  |     0
 .../CGAL/IO/Complex_3_in_triangulation_3_to_vtk.h  |     0
 .../include/CGAL/IO/Dxf_bsop_reader.h              |     0
 .../include/CGAL/IO/Dxf_reader.h                   |     0
 .../include/CGAL/IO/Dxf_reader_doubles.h           |     0
 .../include/CGAL/IO/Dxf_stream.h                   |     0
 .../include/CGAL/IO/Dxf_variant_reader.h           |     0
 .../include/CGAL/IO/Dxf_writer.h                   |     0
 .../include/CGAL/IO/Fig_stream.h                   |     0
 .../include/CGAL/IO/Fig_stream_Conic_arc_2.h       |     0
 .../include/CGAL/IO/File_avizo.h                   |     0
 3rdparty/CGAL/include/CGAL/IO/File_binary_mesh_3.h |    83 +
 .../include/CGAL/IO/File_header_OFF.h              |     0
 .../CGAL/include/CGAL/IO/File_header_OFF_impl.h    |   411 +
 .../include/CGAL/IO/File_header_extended_OFF.h     |     0
 .../CGAL/IO/File_header_extended_OFF_impl.h        |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/IO/File_maya.h |     0
 3rdparty/CGAL/include/CGAL/IO/File_medit.h         |   909 +
 .../{CGAL-4.8 => CGAL}/include/CGAL/IO/File_poly.h |     0
 3rdparty/CGAL/include/CGAL/IO/File_scanner_OFF.h   |   702 +
 .../include/CGAL/IO/File_scanner_OFF_impl.h        |     0
 .../include/CGAL/IO/File_tetgen.h                  |     0
 .../include/CGAL/IO/File_writer_OFF.h              |     0
 .../include/CGAL/IO/File_writer_OFF_impl.h         |     0
 .../include/CGAL/IO/File_writer_VRML_2.h           |     0
 .../include/CGAL/IO/File_writer_VRML_2_impl.h      |     0
 .../include/CGAL/IO/File_writer_inventor.h         |     0
 .../include/CGAL/IO/File_writer_inventor_impl.h    |     0
 .../include/CGAL/IO/File_writer_wavefront.h        |     0
 .../include/CGAL/IO/File_writer_wavefront_impl.h   |     0
 .../include/CGAL/IO/Generic_writer.h               |     0
 .../include/CGAL/IO/Geomview_stream.h              |     0
 .../CGAL/include/CGAL/IO/Geomview_stream_impl.h    |   612 +
 .../include/CGAL/IO/Gps_iostream.h                 |     0
 .../include/CGAL/IO/Inventor_ostream.h             |     0
 .../include/CGAL/IO/Istream_iterator.h             |     0
 .../include/CGAL/IO/Nef_polyhedron_2_PS_stream.h   |   116 +
 .../include/CGAL/IO/Nef_polyhedron_iostream_3.h    |     0
 3rdparty/CGAL/include/CGAL/IO/OBJ_reader.h         |    59 +
 3rdparty/CGAL/include/CGAL/IO/OFF_reader.h         |   172 +
 .../include/CGAL/IO/Ostream_iterator.h             |     0
 .../include/CGAL/IO/Polyhedron_VRML_1_ostream.h    |     0
 .../include/CGAL/IO/Polyhedron_VRML_2_ostream.h    |     0
 .../include/CGAL/IO/Polyhedron_builder_from_STL.h  |     0
 .../include/CGAL/IO/Polyhedron_geomview_ostream.h  |     0
 .../include/CGAL/IO/Polyhedron_inventor_ostream.h  |     0
 .../include/CGAL/IO/Polyhedron_iostream.h          |     0
 .../CGAL/include/CGAL/IO/Polyhedron_scan_OFF.h     |   151 +
 3rdparty/CGAL/include/CGAL/IO/STL_reader.h         |   156 +
 .../include/CGAL/IO/Scanner_OFF.h                  |     0
 .../include/CGAL/IO/Tee_for_output_iterator.h      |     0
 .../CGAL/IO/Triangulation_geomview_ostream_2.h     |     0
 .../CGAL/IO/Triangulation_geomview_ostream_3.h     |     0
 .../include/CGAL/IO/Triangulation_ps_stream.h      |     0
 .../include/CGAL/IO/VRML_1_ostream.h               |     0
 .../include/CGAL/IO/VRML_2_ostream.h               |     0
 .../include/CGAL/IO/Verbose_ostream.h              |     0
 .../include/CGAL/IO/Writer_OFF.h                   |     0
 .../CGAL/IO/alpha_shape_geomview_ostream_3.h       |     0
 .../include/CGAL/IO/binary_file_io.h               |     0
 .../include/CGAL/IO/generic_copy_OFF.h             |     0
 .../include/CGAL/IO/generic_print_polyhedron.h     |     0
 3rdparty/CGAL/include/CGAL/IO/io.h                 |   555 +
 .../{CGAL-4.8 => CGAL}/include/CGAL/IO/io_impl.h   |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/IO/io_tags.h   |     0
 .../CGAL/IO/output_surface_facets_to_polyhedron.h  |     0
 .../IO/output_surface_facets_to_triangle_soup.h    |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/IO/print_OFF.h |     0
 .../include/CGAL/IO/print_VRML_1.h                 |     0
 .../include/CGAL/IO/print_VRML_2.h                 |     0
 .../include/CGAL/IO/print_inventor.h               |     0
 .../include/CGAL/IO/print_wavefront.h              |     0
 3rdparty/CGAL/include/CGAL/IO/read_off_points.h    |   416 +
 3rdparty/CGAL/include/CGAL/IO/read_ply_points.h    |   771 +
 3rdparty/CGAL/include/CGAL/IO/read_xyz_points.h    |   408 +
 .../{CGAL-4.8 => CGAL}/include/CGAL/IO/scan_OFF.h  |     0
 3rdparty/CGAL/include/CGAL/IO/write_off_points.h   |   224 +
 3rdparty/CGAL/include/CGAL/IO/write_ply_points.h   |   238 +
 3rdparty/CGAL/include/CGAL/IO/write_xyz_points.h   |   214 +
 .../include/CGAL/Identity_policy_2.h               |     0
 3rdparty/CGAL/include/CGAL/ImageIO.h               |   716 +
 3rdparty/CGAL/include/CGAL/ImageIO/analyze.h       |    74 +
 3rdparty/CGAL/include/CGAL/ImageIO/analyze_impl.h  |   849 +
 3rdparty/CGAL/include/CGAL/ImageIO/bmp.h           |    65 +
 3rdparty/CGAL/include/CGAL/ImageIO/bmp_impl.h      |   519 +
 3rdparty/CGAL/include/CGAL/ImageIO/bmpendian.h     |    80 +
 .../CGAL/include/CGAL/ImageIO/bmpendian_impl.h     |   257 +
 3rdparty/CGAL/include/CGAL/ImageIO/bmpread.h       |    87 +
 3rdparty/CGAL/include/CGAL/ImageIO/bmpread_impl.h  |  1238 +
 3rdparty/CGAL/include/CGAL/ImageIO/bmptypes.h      |   224 +
 3rdparty/CGAL/include/CGAL/ImageIO/convert.h       |   108 +
 3rdparty/CGAL/include/CGAL/ImageIO/convert_impl.h  |   490 +
 3rdparty/CGAL/include/CGAL/ImageIO/fgetns.h        |    35 +
 3rdparty/CGAL/include/CGAL/ImageIO/fgetns_impl.h   |    43 +
 3rdparty/CGAL/include/CGAL/ImageIO/gif.h           |    38 +
 3rdparty/CGAL/include/CGAL/ImageIO/gif_impl.h      |   700 +
 3rdparty/CGAL/include/CGAL/ImageIO/gis.h           |   141 +
 3rdparty/CGAL/include/CGAL/ImageIO/gis_impl.h      |   735 +
 3rdparty/CGAL/include/CGAL/ImageIO/inr.h           |    65 +
 3rdparty/CGAL/include/CGAL/ImageIO/inr_impl.h      |   514 +
 3rdparty/CGAL/include/CGAL/ImageIO/iris.h          |    37 +
 3rdparty/CGAL/include/CGAL/ImageIO/iris_impl.h     |   499 +
 3rdparty/CGAL/include/CGAL/ImageIO/mincio.h        |    77 +
 .../include/CGAL/ImageIO}/mincio_impl.h            |     0
 3rdparty/CGAL/include/CGAL/ImageIO/pnm.h           |    46 +
 3rdparty/CGAL/include/CGAL/ImageIO/pnm_impl.h      |   643 +
 3rdparty/CGAL/include/CGAL/ImageIO/recbuffer.h     |   203 +
 .../CGAL/include/CGAL/ImageIO/recbuffer_impl.h     |  1743 ++
 3rdparty/CGAL/include/CGAL/ImageIO/recline.h       |   235 +
 .../include/CGAL/ImageIO}/recline_impl.h           |     0
 3rdparty/CGAL/include/CGAL/ImageIO/reech4x4.h      |   288 +
 3rdparty/CGAL/include/CGAL/ImageIO/reech4x4_impl.h |  3176 +++
 .../include/CGAL/ImageIO}/typedefs.h               |     0
 3rdparty/CGAL/include/CGAL/ImageIO_impl.h          |  1700 ++
 3rdparty/CGAL/include/CGAL/Image_3.h               |   529 +
 3rdparty/CGAL/include/CGAL/Image_3_impl.h          |   125 +
 .../include/CGAL/Image_3_vtk_interface.h           |     0
 .../CGAL/include/CGAL/Implicit_mesh_domain_3.h     |    94 +
 .../include/CGAL/Implicit_surface_3.h              |     0
 .../CGAL/Implicit_to_labeling_function_wrapper.h   |     0
 3rdparty/CGAL/include/CGAL/In_place_list.h         |   812 +
 .../include/CGAL/Incremental_neighbor_search.h     |     0
 3rdparty/CGAL/include/CGAL/Index_property_map.h    |   162 +
 .../CGAL/Interpolation_gradient_fitting_traits_2.h |     0
 .../include/CGAL/Interpolation_traits_2.h          |     0
 .../include/CGAL/Intersection_traits.h             |     0
 .../include/CGAL/Intersection_traits_2.h           |     0
 .../include/CGAL/Intersection_traits_3.h           |     0
 .../Triangle_2_Triangle_2_intersection_impl.h      |     0
 .../CGAL/Intersections_3/intersection_3_1_impl.h   |     0
 .../include/CGAL/Interval_arithmetic.h             |     0
 .../CGAL/include/CGAL/Interval_arithmetic_impl.h   |    76 +
 3rdparty/CGAL/include/CGAL/Interval_nt.h           |  1289 +
 .../include/CGAL/Interval_skip_list.h              |     0
 .../include/CGAL/Interval_skip_list_interval.h     |     0
 .../include/CGAL/Interval_traits.h                 |     0
 .../include/CGAL/Inverse_index.h                   |     0
 .../include/CGAL/Is_a_predicate.h                  |     0
 .../include/CGAL/Is_extended_kernel.h              |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Iso_cuboid_3.h |     0
 .../include/CGAL/Iso_rectangle_2.h                 |     0
 .../Iso_rectangle_2_Iso_rectangle_2_intersection.h |     0
 .../CGAL/Iso_rectangle_2_Line_2_intersection.h     |     0
 .../CGAL/Iso_rectangle_2_Point_2_intersection.h    |     0
 .../CGAL/Iso_rectangle_2_Ray_2_intersection.h      |     0
 .../CGAL/Iso_rectangle_2_Segment_2_intersection.h  |     0
 .../include/CGAL/Iso_rectangle_d.h                 |     0
 .../include/CGAL/Iterator_project.h                |     0
 3rdparty/CGAL/include/CGAL/Iterator_range.h        |   115 +
 .../include/CGAL/Iterator_transform.h              |     0
 .../include/CGAL/Join_input_iterator.h             |     0
 .../include/CGAL/K_neighbor_search.h               |     0
 3rdparty/CGAL/include/CGAL/Kd_tree.h               |   472 +
 3rdparty/CGAL/include/CGAL/Kd_tree_node.h          |   567 +
 .../include/CGAL/Kd_tree_rectangle.h               |     0
 .../include/CGAL/Kernel/Dimension_utils.h          |     0
 .../include/CGAL/Kernel/Return_base_tag.h          |     0
 .../include/CGAL/Kernel/Same_uncertainty.h         |     0
 .../include/CGAL/Kernel/Type_equality_wrapper.h    |     0
 .../include/CGAL/Kernel/Type_mapper.h              |     0
 .../include/CGAL/Kernel/Wutils.h                   |     0
 .../include/CGAL/Kernel/function_objects.h         |     0
 .../include/CGAL/Kernel/global_functions.h         |     0
 .../CGAL/include/CGAL/Kernel/global_functions_2.h  |  1034 +
 .../CGAL/include/CGAL/Kernel/global_functions_3.h  |  1134 +
 .../CGAL/Kernel/global_functions_internal_2.h      |     0
 .../CGAL/Kernel/global_functions_internal_3.h      |     0
 .../CGAL/include/CGAL/Kernel/interface_macros.h    |   563 +
 .../{CGAL-4.8 => CGAL}/include/CGAL/Kernel/mpl.h   |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Kernel/solve.h |     0
 .../include/CGAL/Kernel_checker.h                  |     0
 .../include/CGAL/Kernel_d/Aff_transformationCd.h   |     0
 .../include/CGAL/Kernel_d/Aff_transformationHd.h   |     0
 .../include/CGAL/Kernel_d/Aff_transformation_d.h   |     0
 .../CGAL/Kernel_d/Cartesian_const_iterator_d.h     |     0
 .../include/CGAL/Kernel_d/Cartesian_converter_d.h  |     0
 .../include/CGAL/Kernel_d/DirectionCd.h            |     0
 .../include/CGAL/Kernel_d/DirectionCd_impl.h       |     0
 .../include/CGAL/Kernel_d/DirectionHd.h            |     0
 .../include/CGAL/Kernel_d/DirectionHd_impl.h       |     0
 .../include/CGAL/Kernel_d/Direction_d.h            |     0
 .../include/CGAL/Kernel_d/HyperplaneCd.h           |     0
 .../include/CGAL/Kernel_d/HyperplaneCd_impl.h      |     0
 .../include/CGAL/Kernel_d/HyperplaneHd.h           |     0
 .../include/CGAL/Kernel_d/HyperplaneHd_impl.h      |     0
 .../include/CGAL/Kernel_d/Hyperplane_d.h           |     0
 .../include/CGAL/Kernel_d/Interface_classes.h      |     0
 .../CGAL/Kernel_d/Interval_linear_algebra.h        |     0
 3rdparty/CGAL/include/CGAL/Kernel_d/Iso_box_d.h    |   410 +
 .../include/CGAL/Kernel_d/Kernel_classesCd.h       |     0
 .../include/CGAL/Kernel_d/Kernel_classesHd.h       |     0
 .../include/CGAL/Kernel_d/Line_d.h                 |     0
 .../include/CGAL/Kernel_d/Line_d_impl.h            |     0
 .../include/CGAL/Kernel_d/Linear_algebraCd_impl.h  |     0
 .../include/CGAL/Kernel_d/Linear_algebraHd_impl.h  |     0
 .../include/CGAL/Kernel_d/Matrix__.h               |     0
 .../include/CGAL/Kernel_d/Pair_d.h                 |     0
 .../include/CGAL/Kernel_d/PointCd.h                |     0
 .../include/CGAL/Kernel_d/PointCd_impl.h           |     0
 .../include/CGAL/Kernel_d/PointHd.h                |     0
 .../include/CGAL/Kernel_d/PointHd_impl.h           |     0
 3rdparty/CGAL/include/CGAL/Kernel_d/Point_d.h      |   107 +
 .../include/CGAL/Kernel_d/Ray_d.h                  |     0
 .../include/CGAL/Kernel_d/Segment_d.h              |     0
 .../include/CGAL/Kernel_d/Sphere_d.h               |     0
 .../include/CGAL/Kernel_d/Tuple_d.h                |     0
 .../include/CGAL/Kernel_d/VectorCd.h               |     0
 .../include/CGAL/Kernel_d/VectorCd_impl.h          |     0
 .../include/CGAL/Kernel_d/VectorHd.h               |     0
 .../include/CGAL/Kernel_d/VectorHd_impl.h          |     0
 .../include/CGAL/Kernel_d/Vector__.h               |     0
 .../include/CGAL/Kernel_d/Vector_d.h               |     0
 .../include/CGAL/Kernel_d/debug.h                  |     0
 .../include/CGAL/Kernel_d/function_objects.h       |     0
 .../include/CGAL/Kernel_d/function_objectsCd.h     |     0
 .../include/CGAL/Kernel_d/function_objectsHd.h     |     0
 .../include/CGAL/Kernel_d/interface_macros_d.h     |     0
 .../include/CGAL/Kernel_d/intersection_objectsCd.h |     0
 .../include/CGAL/Kernel_d/intersection_objectsHd.h |     0
 .../include/CGAL/Kernel_d/intersection_objects_d.h |     0
 .../include/CGAL/Kernel_d/simple_objects.h         |     0
 .../include/CGAL/Kernel_profiler.h                 |     0
 .../include/CGAL/Kernel_traits.h                   |     0
 .../include/CGAL/Kinetic/Active_objects_vector.h   |     0
 .../Kinetic/CORE_Expr_exact_simulation_traits.h    |     0
 3rdparty/CGAL/include/CGAL/Kinetic/Cartesian.h     |    48 +
 .../include/CGAL/Kinetic/Certificate_generator.h   |     0
 .../CGAL/Kinetic/Default_instantaneous_kernel.h    |   388 +
 .../include/CGAL/Kinetic/Default_simulator.h       |     0
 .../CGAL/Kinetic/Delaunay_triangulation_2.h        |     0
 .../CGAL/Kinetic/Delaunay_triangulation_3.h        |     0
 .../Kinetic/Delaunay_triangulation_cell_base_3.h   |     0
 .../Delaunay_triangulation_default_traits_2.h      |     0
 .../Delaunay_triangulation_event_log_visitor_2.h   |     0
 .../Delaunay_triangulation_event_log_visitor_3.h   |     0
 .../Kinetic/Delaunay_triangulation_face_base_2.h   |     0
 ...Delaunay_triangulation_recent_edges_visitor_2.h |     0
 .../Kinetic/Delaunay_triangulation_vertex_base_2.h |     0
 .../Delaunay_triangulation_visitor_base_2.h        |     0
 .../Delaunay_triangulation_visitor_base_3.h        |     0
 .../Kinetic/Derivitive_filter_function_kernel.h    |     0
 .../include/CGAL/Kinetic/Enclosing_box_2.h         |     0
 .../include/CGAL/Kinetic/Enclosing_box_3.h         |     0
 .../include/CGAL/Kinetic/Erase_event.h             |     0
 .../include/CGAL/Kinetic/Event_base.h              |     0
 .../include/CGAL/Kinetic/Exact_simulation_traits.h |     0
 .../include/CGAL/Kinetic/Free_event_base.h         |     0
 .../Kinetic/Handle_degeneracy_function_kernel.h    |     0
 .../CGAL/Kinetic/Heap_pointer_event_queue.h        |     0
 .../CGAL/Kinetic/Inexact_simulation_traits.h       |     0
 .../include/CGAL/Kinetic/Insert_event.h            |     0
 .../include/CGAL/Kinetic/Listener.h                |     0
 .../include/CGAL/Kinetic/Multi_listener.h          |     0
 .../include/CGAL/Kinetic/Ref_counted.h             |     0
 .../include/CGAL/Kinetic/Regular_triangulation_3.h |     0
 ...ar_triangulation_CORE_exact_simulation_traits.h |     0
 .../Kinetic/Regular_triangulation_cell_base_3.h    |     0
 .../Regular_triangulation_event_log_visitor_3.h    |     0
 ...Regular_triangulation_exact_simulation_traits.h |     0
 ...gular_triangulation_inexact_simulation_traits.h |     0
 .../Regular_triangulation_instantaneous_kernel.h   |    81 +
 .../Kinetic/Regular_triangulation_vertex_base_3.h  |     0
 .../Kinetic/Regular_triangulation_visitor_base_3.h |     0
 .../CGAL/Kinetic/Simulator_objects_listener.h      |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Kinetic/Sort.h |     0
 .../include/CGAL/Kinetic/Sort_event_log_visitor.h  |     0
 .../include/CGAL/Kinetic/Sort_visitor_base.h       |     0
 .../CGAL/Kinetic/Two_list_pointer_event_queue.h    |     0
 .../include/CGAL/Kinetic/basic.h                   |     0
 .../internal/Delaunay_triangulation_base_3.h       |  1394 ++
 .../CGAL/Kinetic/internal/Instantaneous_adaptor.h  |     0
 .../Kernel/Cartesian_kinetic_kernel_base.h         |   259 +
 .../Kernel/Cartesian_moving_lifted_point_3.h       |   136 +
 .../Kernel/Cartesian_moving_orthosphere_3.h        |     0
 .../internal/Kernel/Cartesian_moving_point_1.h     |     0
 .../internal/Kernel/Cartesian_moving_point_2.h     |     0
 .../internal/Kernel/Cartesian_moving_point_3.h     |     0
 .../Kernel/Cartesian_moving_weighted_point_3.h     |     0
 .../include/CGAL/Kinetic/internal/Kernel/Center.h  |     0
 .../CGAL/Kinetic/internal/Kernel/Certificate.h     |     0
 .../internal/Kernel/Delaunay_lifted_lifting.h      |     0
 .../Kinetic/internal/Kernel/Delaunay_lifting.h     |     0
 .../CGAL/Kinetic/internal/Kernel/Reverse_time.h    |     0
 .../internal/Kernel/cartesian_predicates_2.h       |     0
 .../internal/Kernel/cartesian_predicates_3.h       |   814 +
 .../include/CGAL/Kinetic/internal/To_static.h      |     0
 .../CGAL/Kinetic/internal/Triangulation_helper_3.h |     0
 .../include/CGAL/Kinetic/internal/config.h         |     0
 .../include/CGAL/Kinetic/internal/debug_counters.h |     0
 .../CGAL/Kinetic/internal/debug_counters_impl.h    |     0
 .../CGAL/Kinetic/internal/infinity_or_max.h        |     0
 .../include/CGAL/Kinetic/internal/tds_2_helpers.h  |     0
 .../Kinetic/internal/triangulation_helpers_3.h     |     0
 .../include/CGAL/Kinetic/listeners.h               |     0
 .../include/CGAL/LEDA_arithmetic_kernel.h          |     0
 3rdparty/CGAL/include/CGAL/LEDA_basic.h            |    48 +
 .../include/CGAL/LSCM_parameterizer_3.h            |     0
 .../include/CGAL/Labeled_image_mesh_domain_3.h     |   157 +
 3rdparty/CGAL/include/CGAL/Labeled_mesh_domain_3.h |   721 +
 .../{CGAL-4.8 => CGAL}/include/CGAL/Lapack_svd.h   |     0
 .../include/CGAL/Largest_empty_iso_rectangle_2.h   |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/Lazy.h    |     0
 3rdparty/CGAL/include/CGAL/Lazy_exact_nt.h         |  1448 ++
 .../{CGAL-4.8 => CGAL}/include/CGAL/Lazy_kernel.h  |     0
 .../include/CGAL/Level_interval.h                  |     0
 .../include/CGAL/Lightweight_vector_3.h            |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/Line_2.h  |     0
 .../include/CGAL/Line_2_Bbox_2_intersection.h      |     0
 .../CGAL/Line_2_Iso_rectangle_2_intersection.h     |     0
 .../include/CGAL/Line_2_Line_2_intersection.h      |     0
 .../include/CGAL/Line_2_Point_2_intersection.h     |     0
 .../include/CGAL/Line_2_Ray_2_intersection.h       |     0
 .../include/CGAL/Line_2_Segment_2_intersection.h   |     0
 .../include/CGAL/Line_2_Triangle_2_intersection.h  |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/Line_3.h  |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Line_arc_2.h   |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Line_arc_3.h   |     0
 .../include/CGAL/Linear_algebraCd.h                |     0
 .../include/CGAL/Linear_algebraHd.h                |     0
 3rdparty/CGAL/include/CGAL/Linear_cell_complex.h   |   945 +
 .../CGAL/Linear_cell_complex_constructors.h        |     0
 .../CGAL/Linear_cell_complex_incremental_builder.h |     0
 .../include/CGAL/Linear_cell_complex_min_items.h   |     0
 .../include/CGAL/Linear_cell_complex_operations.h  |     0
 .../include/CGAL/Linear_cell_complex_storages.h    |   450 +
 .../include/CGAL/Linear_cell_complex_traits.h      |     0
 .../include/CGAL/Location_policy.h                 |     0
 3rdparty/CGAL/include/CGAL/MP_Float.h              |   913 +
 .../include/CGAL/MP_Float_arithmetic_kernel.h      |     0
 3rdparty/CGAL/include/CGAL/MP_Float_impl.h         |   512 +
 .../CGAL/Manhattan_distance_iso_box_point.h        |   173 +
 .../CGAL/Marching_tetrahedra_observer_default_3.h  |     0
 .../Marching_tetrahedra_traits_skin_surface_3.h    |     0
 .../CGAL/Mean_curvature_flow_skeletonization.h     |  1443 ++
 .../CGAL/Mean_value_coordinates_parameterizer_3.h  |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Memory_sizer.h |     0
 .../include/CGAL/Mesh_2/Clusters.h                 |     0
 .../include/CGAL/Mesh_2/Do_not_refine_edges.h      |     0
 .../include/CGAL/Mesh_2/Face_badness.h             |     0
 .../include/CGAL/Mesh_2/Lipschitz_sizing_field_2.h |     0
 .../include/CGAL/Mesh_2/Lloyd_move_2.h             |     0
 .../include/CGAL/Mesh_2/Mesh_global_optimizer_2.h  |     0
 .../include/CGAL/Mesh_2/Mesh_sizing_field.h        |     0
 .../include/CGAL/Mesh_2/Output_stream.h            |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Mesh_2/README  |     0
 .../include/CGAL/Mesh_2/Refine_edges.h             |     0
 .../include/CGAL/Mesh_2/Refine_edges_visitor.h     |     0
 .../CGAL/Mesh_2/Refine_edges_with_clusters.h       |     0
 .../include/CGAL/Mesh_2/Refine_faces.h             |     0
 .../include/CGAL/Mesh_2/Sizing_field_2.h           |     0
 .../include/CGAL/Mesh_2/Uniform_sizing_field_2.h   |     0
 .../include/CGAL/Mesh_3/C3T3_helpers.h             |     0
 .../CGAL/Mesh_3/Cell_criteria_visitor_with_balls.h |     0
 .../include/CGAL/Mesh_3/Concurrent_mesher_config.h |     0
 .../include/CGAL/Mesh_3/Creator_weighted_point_3.h |     0
 .../CGAL/Mesh_3/Detect_features_in_polyhedra.h     |     0
 .../CGAL/Mesh_3/Detect_features_in_polyhedra_fwd.h |     0
 .../CGAL/Mesh_3/Detect_polylines_in_polyhedra.h    |     0
 .../Mesh_3/Detect_polylines_in_polyhedra_fwd.h     |     0
 3rdparty/CGAL/include/CGAL/Mesh_3/Dump_c3t3.h      |   113 +
 .../Mesh_3/Facet_criteria_visitor_with_balls.h     |     0
 .../CGAL/Mesh_3/Facet_on_same_surface_criterion.h  |     0
 .../include/CGAL/Mesh_3/Has_features.h             |     0
 .../Mesh_3/Image_to_labeled_function_wrapper.h     |   152 +
 .../CGAL/Mesh_3/Implicit_surface_mesher_visitor.h  |     0
 .../Mesh_3/Implicit_to_labeled_function_wrapper.h  |   156 +
 .../include/CGAL/Mesh_3/Labeled_mesh_domain_3.h    |     0
 .../include/CGAL/Mesh_3/Lloyd_move.h               |     0
 .../Mesh_complex_3_in_triangulation_3_base.h       |   981 +
 .../include/CGAL/Mesh_3/Mesh_global_optimizer.h    |  1158 +
 .../include/CGAL/Mesh_3/Mesh_sizing_field.h        |     0
 .../include/CGAL/Mesh_3/Mesh_surface_cell_base_3.h |     0
 3rdparty/CGAL/include/CGAL/Mesh_3/Mesher_3.h       |   700 +
 .../include/CGAL/Mesh_3/Mesher_level.h             |     0
 .../Mesh_3/Mesher_level_default_implementations.h  |     0
 .../include/CGAL/Mesh_3/Null_exuder_visitor.h      |     0
 .../CGAL/Mesh_3/Null_global_optimizer_visitor.h    |     0
 .../include/CGAL/Mesh_3/Null_perturber_visitor.h   |     0
 .../include/CGAL/Mesh_3/Odt_move.h                 |     0
 .../include/CGAL/Mesh_3/Poisson_refine_cells_3.h   |     0
 .../include/CGAL/Mesh_3/Polyline_with_context.h    |     0
 .../include/CGAL/Mesh_3/Profile_counter.h          |     0
 .../include/CGAL/Mesh_3/Profiling_tools.h          |     0
 .../CGAL/Mesh_3/Protect_edges_sizing_field.h       |     0
 .../include/CGAL/Mesh_3/Refine_cells_3.h           |     0
 .../CGAL/include/CGAL/Mesh_3/Refine_facets_3.h     |  1967 ++
 .../CGAL/Mesh_3/Refine_facets_manifold_base.h      |     0
 .../include/CGAL/Mesh_3/Refine_tets_visitor.h      |     0
 .../CGAL/Mesh_3/Robust_intersection_kernel.h       |     0
 .../CGAL/Mesh_3/Robust_intersection_traits_3.h     |     0
 ...obust_weighted_circumcenter_filtered_traits_3.h |     0
 .../include/CGAL/Mesh_3/Sizing_grid.h              |     0
 .../include/CGAL/Mesh_3/Sliver_perturber.h         |     0
 .../include/CGAL/Mesh_3/Slivers_exuder.h           |     0
 .../Mesh_3/Slivers_exuder_cell_attributes_traits.h |     0
 .../CGAL/Mesh_3/Triangle_accessor_primitive.h      |     0
 .../include/CGAL/Mesh_3/Triangulation_helpers.h    |     0
 .../CGAL/Mesh_3/Triangulation_sizing_field.h       |     0
 .../include/CGAL/Mesh_3/Uniform_sizing_field.h     |     0
 .../CGAL/Mesh_3/Worksharing_data_structures.h      |     0
 .../include/CGAL/Mesh_3/config.h                   |     0
 .../include/CGAL/Mesh_3/dihedral_angle_3.h         |     0
 .../include/CGAL/Mesh_3/global_parameters.h        |     0
 .../initialize_triangulation_from_labeled_image.h  |   237 +
 3rdparty/CGAL/include/CGAL/Mesh_3/io_signature.h   |   275 +
 .../CGAL/Mesh_3/mesh_standard_cell_criteria.h      |     0
 .../include/CGAL/Mesh_3/mesh_standard_criteria.h   |     0
 .../CGAL/Mesh_3/mesh_standard_facet_criteria.h     |   791 +
 .../include/CGAL/Mesh_3/min_dihedral_angle.h       |     0
 .../include/CGAL/Mesh_3/parameters_defaults.h      |     0
 .../polyhedral_to_labeled_function_wrapper.h       |     0
 .../include/CGAL/Mesh_3/polylines_to_protect.h     |   608 +
 .../include/CGAL/Mesh_3/radius_ratio.h             |     0
 ...rch_for_connected_components_in_labeled_image.h |   249 +
 .../include/CGAL/Mesh_3/sliver_criteria.h          |     0
 .../Mesh_3/squared_distance_Point_3_Triangle_3.h   |    27 +
 .../include/CGAL/Mesh_3/utilities.h                |     0
 .../include/CGAL/Mesh_3/vertex_perturbation.h      |     0
 .../include/CGAL/Mesh_cell_base_3.h                |     0
 .../include/CGAL/Mesh_cell_criteria_3.h            |     0
 .../CGAL/Mesh_complex_3_in_triangulation_3.h       |   774 +
 .../include/CGAL/Mesh_constant_domain_field_3.h    |     0
 3rdparty/CGAL/include/CGAL/Mesh_criteria_3.h       |   193 +
 .../CGAL/Mesh_domain_with_polyline_features_3.h    |  1096 +
 .../include/CGAL/Mesh_edge_criteria_3.h            |     0
 3rdparty/CGAL/include/CGAL/Mesh_facet_criteria_3.h |   233 +
 .../include/CGAL/Mesh_facet_topology.h             |     0
 .../include/CGAL/Mesh_optimization_return_code.h   |     0
 .../include/CGAL/Mesh_polyhedron_3.h               |     0
 3rdparty/CGAL/include/CGAL/Mesh_triangulation_3.h  |   121 +
 3rdparty/CGAL/include/CGAL/Mesh_vertex_base_3.h    |   313 +
 .../{CGAL-4.8 => CGAL}/include/CGAL/Mesher_level.h |     0
 .../CGAL/Mesher_level_default_implementations.h    |     0
 .../include/CGAL/Mesher_level_visitors.h           |     0
 .../include/CGAL/Meshes/Double_map_container.h     |     0
 .../include/CGAL/Meshes/Filtered_deque_container.h |     0
 .../CGAL/Meshes/Filtered_multimap_container.h      |     0
 .../include/CGAL/Meshes/Filtered_queue_container.h |     0
 .../include/CGAL/Meshes/Simple_map_container.h     |     0
 .../include/CGAL/Meshes/Simple_queue_container.h   |     0
 .../include/CGAL/Meshes/Simple_set_container.h     |     0
 .../Meshes/Triangulation_mesher_level_traits_2.h   |     0
 .../Meshes/Triangulation_mesher_level_traits_3.h   |     0
 3rdparty/CGAL/include/CGAL/Min_annulus_d.h         |   883 +
 .../{CGAL-4.8 => CGAL}/include/CGAL/Min_circle_2.h |     0
 .../CGAL/Min_circle_2/Min_circle_2_adapterC2.h     |     0
 .../CGAL/Min_circle_2/Min_circle_2_adapterH2.h     |     0
 .../include/CGAL/Min_circle_2/Min_circle_2_impl.h  |     0
 .../CGAL/Min_circle_2/Optimisation_circle_2.h      |     0
 .../CGAL/Min_circle_2/Optimisation_circle_2_impl.h |     0
 .../include/CGAL/Min_circle_2_traits_2.h           |     0
 .../include/CGAL/Min_ellipse_2.h                   |     0
 .../CGAL/Min_ellipse_2/Min_ellipse_2_adapterC2.h   |     0
 .../CGAL/Min_ellipse_2/Min_ellipse_2_adapterH2.h   |     0
 .../CGAL/Min_ellipse_2/Min_ellipse_2_impl.h        |     0
 .../CGAL/Min_ellipse_2/Optimisation_ellipse_2.h    |     0
 .../Min_ellipse_2/Optimisation_ellipse_2_impl.h    |     0
 .../include/CGAL/Min_ellipse_2_traits_2.h          |     0
 .../include/CGAL/Min_quadrilateral_traits_2.h      |     0
 .../include/CGAL/Min_sphere_annulus_d_traits_2.h   |     0
 .../include/CGAL/Min_sphere_annulus_d_traits_3.h   |     0
 .../include/CGAL/Min_sphere_annulus_d_traits_d.h   |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Min_sphere_d.h |     0
 .../include/CGAL/Min_sphere_d/Min_sphere_d_impl.h  |     0
 .../CGAL/Min_sphere_d/Optimisation_sphere_d.h      |     0
 .../include/CGAL/Min_sphere_of_points_d_traits_2.h |     0
 .../include/CGAL/Min_sphere_of_points_d_traits_3.h |     0
 .../include/CGAL/Min_sphere_of_points_d_traits_d.h |     0
 .../include/CGAL/Min_sphere_of_spheres_d.h         |     0
 .../Min_sphere_of_spheres_d_configure.h            |     0
 .../Min_sphere_of_spheres_d_impl.h                 |     0
 .../Min_sphere_of_spheres_d_pair.h                 |     0
 .../Min_sphere_of_spheres_d_pivot_impl.h           |     0
 .../Min_sphere_of_spheres_d_support_set.h          |     0
 .../Min_sphere_of_spheres_d_support_set_impl.h     |     0
 .../CGAL/Min_sphere_of_spheres_d_traits_2.h        |     0
 .../CGAL/Min_sphere_of_spheres_d_traits_3.h        |     0
 .../CGAL/Min_sphere_of_spheres_d_traits_d.h        |     0
 .../Minimum_enclosing_quadrilateral_traits_2.h     |     0
 .../Minkowski_sum_2/AABB_collision_detector_2.h    |     0
 .../CGAL/Minkowski_sum_2/AABB_node_with_join.h     |     0
 .../Minkowski_sum_2/AABB_segment_2_primitive.h     |     0
 .../include/CGAL/Minkowski_sum_2/AABB_traits_2.h   |     0
 .../AABB_traversal_traits_with_join.h              |     0
 .../CGAL/Minkowski_sum_2/AABB_tree_with_join.h     |     0
 .../CGAL/Minkowski_sum_2/Approx_offset_base_2.h    |     0
 .../CGAL/Minkowski_sum_2/Arr_labeled_traits_2.h    |     0
 .../Decomposition_strategy_adapter.h               |     0
 .../CGAL/Minkowski_sum_2/Exact_offset_base_2.h     |     0
 .../include/CGAL/Minkowski_sum_2/Hole_filter_2.h   |     0
 .../include/CGAL/Minkowski_sum_2/Labels.h          |     0
 .../Minkowski_sum_by_reduced_convolution_2.h       |     0
 .../CGAL/Minkowski_sum_2/Minkowski_sum_conv_2.h    |     0
 .../CGAL/Minkowski_sum_2/Minkowski_sum_decomp_2.h  |   451 +
 .../include/CGAL/Minkowski_sum_2/Offset_conv_2.h   |     0
 .../include/CGAL/Minkowski_sum_2/Offset_decomp_2.h |     0
 .../Minkowski_sum_2/Polygon_convex_decomposition.h |     0
 .../CGAL/Minkowski_sum_2/Union_of_curve_cycles_2.h |     0
 .../CGAL/Minkowski_sum_2/Union_of_cycles_2.h       |     0
 .../Minkowski_sum_2/Union_of_segment_cycles_2.h    |     0
 .../include/CGAL/Minkowski_sum_3/Gaussian_map.h    |     0
 .../CGAL/Minkowski_sum_3/Gaussian_map_to_nef_3.h   |     0
 .../include/CGAL/Minkowski_sum_3/PointMark.h       |     0
 .../bipartite_nary_union_sorted_combined.h         |     0
 .../CGAL/include/CGAL/Modifiable_priority_queue.h  |   134 +
 .../include/CGAL/Modifier_base.h                   |     0
 .../include/CGAL/Modular_arithmetic/Residue_type.h |     0
 .../include/CGAL/Modular_traits.h                  |     0
 3rdparty/CGAL/include/CGAL/Monge_via_jet_fitting.h |   784 +
 3rdparty/CGAL/include/CGAL/Mpzf.h                  |  1164 +
 .../include/CGAL/Multi_surface_3.h                 |     0
 3rdparty/CGAL/include/CGAL/Multiscale_sort.h       |    58 +
 .../{CGAL-4.8 => CGAL}/include/CGAL/Multiset.h     |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/NT_converter.h |     0
 .../include/CGAL/N_step_adaptor.h                  |     0
 .../include/CGAL/N_step_adaptor_derived.h          |     0
 .../include/CGAL/Needs_parens_as_product.h         |     0
 .../include/CGAL/Nef_2/Bounding_box_2.h            |     0
 .../include/CGAL/Nef_2/Constrained_triang_traits.h |     0
 .../include/CGAL/Nef_2/HDS_items.h                 |     0
 .../include/CGAL/Nef_2/Line_to_epoint.h            |     0
 .../include/CGAL/Nef_2/Object_handle.h             |     0
 .../include/CGAL/Nef_2/Object_index.h              |     0
 .../include/CGAL/Nef_2/PM_checker.h                |     0
 .../include/CGAL/Nef_2/PM_const_decorator.h        |     0
 .../include/CGAL/Nef_2/PM_decorator.h              |     0
 .../include/CGAL/Nef_2/PM_explorer.h               |     0
 3rdparty/CGAL/include/CGAL/Nef_2/PM_io_parser.h    |   403 +
 .../include/CGAL/Nef_2/PM_overlayer.h              |     0
 .../include/CGAL/Nef_2/PM_persistent_PL.h          |     0
 .../include/CGAL/Nef_2/PM_point_locator.h          |     0
 .../include/CGAL/Nef_2/Polynomial.h                |     0
 .../include/CGAL/Nef_2/Polynomial_impl.h           |     0
 .../include/CGAL/Nef_2/Segment_overlay_traits.h    |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Nef_2/debug.h  |     0
 .../CGAL/include/CGAL/Nef_2/gen_point_location.h   |   606 +
 .../include/CGAL/Nef_2/geninfo.h                   |     0
 .../include/CGAL/Nef_2/iterator_tools.h            |     0
 .../include/CGAL/Nef_3/Binary_operation.h          |     0
 .../include/CGAL/Nef_3/Bounding_box_3.h            |     0
 .../include/CGAL/Nef_3/Combine_with_halfspace.h    |     0
 .../include/CGAL/Nef_3/Default_items.h             |     0
 .../include/CGAL/Nef_3/Edge_edge_overlay.h         |     0
 .../Exact_triangulation_euclidean_traits_xy_3.h    |     0
 .../Exact_triangulation_euclidean_traits_xz_3.h    |     0
 .../Exact_triangulation_euclidean_traits_yz_3.h    |     0
 .../include/CGAL/Nef_3/Halfedge.h                  |     0
 .../include/CGAL/Nef_3/Halffacet.h                 |     0
 .../include/CGAL/Nef_3/ID_support_handler.h        |     0
 .../include/CGAL/Nef_3/Infimaximal_box.h           |     0
 .../include/CGAL/Nef_3/K3_tree.h                   |     0
 .../include/CGAL/Nef_3/Mark_bounded_volumes.h      |     0
 .../include/CGAL/Nef_3/Nef_box.h                   |     0
 .../include/CGAL/Nef_3/OGL_helper.h                |     0
 .../include/CGAL/Nef_3/Pluecker_line_3.h           |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Nef_3/SFace.h  |     0
 .../include/CGAL/Nef_3/SHalfedge.h                 |     0
 .../include/CGAL/Nef_3/SHalfloop.h                 |     0
 .../include/CGAL/Nef_3/SM_visualizor.h             |     0
 .../include/CGAL/Nef_3/SNC_FM_decorator.h          |     0
 .../include/CGAL/Nef_3/SNC_SM_explorer.h           |     0
 .../include/CGAL/Nef_3/SNC_SM_overlayer.h          |     0
 .../include/CGAL/Nef_3/SNC_SM_visualizor.h         |     0
 .../include/CGAL/Nef_3/SNC_const_decorator.h       |     0
 .../include/CGAL/Nef_3/SNC_constructor.h           |     0
 .../include/CGAL/Nef_3/SNC_decorator.h             |     0
 .../include/CGAL/Nef_3/SNC_decorator_traits.h      |     0
 .../include/CGAL/Nef_3/SNC_external_structure.h    |     0
 .../include/CGAL/Nef_3/SNC_indexed_items.h         |     0
 .../include/CGAL/Nef_3/SNC_intersection.h          |     0
 .../include/CGAL/Nef_3/SNC_io_parser.h             |     0
 .../include/CGAL/Nef_3/SNC_items.h                 |     0
 .../include/CGAL/Nef_3/SNC_iteration.h             |     0
 .../include/CGAL/Nef_3/SNC_k3_tree_traits.h        |     0
 .../include/CGAL/Nef_3/SNC_list.h                  |     0
 .../CGAL/include/CGAL/Nef_3/SNC_point_locator.h    |  1378 +
 .../include/CGAL/Nef_3/SNC_simplify.h              |     0
 .../include/CGAL/Nef_3/SNC_sphere_map.h            |     0
 .../include/CGAL/Nef_3/SNC_structure.h             |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Nef_3/Vertex.h |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Nef_3/Volume.h |     0
 .../include/CGAL/Nef_3/binop_intersection_tests.h  |     0
 .../include/CGAL/Nef_3/bounded_side_3.h            |     0
 .../include/CGAL/Nef_3/polyhedron_3_to_nef_3.h     |     0
 .../quotient_coordinates_to_homogeneous_point.h    |     0
 .../include/CGAL/Nef_3/shell_to_nef_3.h            |     0
 .../include/CGAL/Nef_3/vertex_cycle_to_nef_3.h     |     0
 .../include/CGAL/Nef_S2/Generic_handle_map.h       |     0
 .../include/CGAL/Nef_S2/Normalizing.h              |     0
 .../include/CGAL/Nef_S2/OGL_base_object.h          |     0
 3rdparty/CGAL/include/CGAL/Nef_S2/SM_checker.h     |   257 +
 .../include/CGAL/Nef_S2/SM_const_decorator.h       |     0
 .../CGAL/Nef_S2/SM_constrained_triang_traits.h     |     0
 .../include/CGAL/Nef_S2/SM_decorator.h             |     0
 .../include/CGAL/Nef_S2/SM_decorator_traits.h      |     0
 .../include/CGAL/Nef_S2/SM_io_parser.h             |     0
 .../include/CGAL/Nef_S2/SM_items.h                 |     0
 .../include/CGAL/Nef_S2/SM_iteration.h             |     0
 .../include/CGAL/Nef_S2/SM_list.h                  |     0
 .../include/CGAL/Nef_S2/SM_overlayer.h             |     0
 .../include/CGAL/Nef_S2/SM_point_locator.h         |     0
 .../include/CGAL/Nef_S2/SM_triangulator.h          |     0
 .../include/CGAL/Nef_S2/SM_visualizor.h            |     0
 .../include/CGAL/Nef_S2/Sphere_circle.h            |     0
 .../include/CGAL/Nef_S2/Sphere_direction.h         |     0
 .../include/CGAL/Nef_S2/Sphere_geometry.h          |     0
 .../include/CGAL/Nef_S2/Sphere_geometry_OGL.h      |     0
 .../include/CGAL/Nef_S2/Sphere_map.h               |     0
 .../include/CGAL/Nef_S2/Sphere_point.h             |     0
 .../include/CGAL/Nef_S2/Sphere_segment.h           |     0
 .../include/CGAL/Nef_S2/Sphere_triangle.h          |     0
 .../CGAL/include/CGAL/Nef_S2/leda_sphere_map.h     |   268 +
 .../include/CGAL/Nef_S2/sphere_predicates.h        |     0
 .../include/CGAL/Nef_nary_intersection_3.h         |     0
 .../include/CGAL/Nef_nary_union_3.h                |     0
 3rdparty/CGAL/include/CGAL/Nef_polyhedron_2.h      |  1136 +
 3rdparty/CGAL/include/CGAL/Nef_polyhedron_3.h      |  2104 ++
 3rdparty/CGAL/include/CGAL/Nef_polyhedron_S2.h     |   734 +
 3rdparty/CGAL/include/CGAL/Nef_polynomial.h        |   285 +
 .../include/CGAL/Nef_polynomial_fwd.h              |     0
 .../include/CGAL/Nested_iterator.h                 |     0
 .../include/CGAL/NewKernel_d/Cartesian_LA_base.h   |   176 +
 .../CGAL/NewKernel_d/Cartesian_LA_functors.h       |     0
 .../include/CGAL/NewKernel_d/Cartesian_base.h      |     0
 .../include/CGAL/NewKernel_d/Cartesian_change_FT.h |     0
 .../include/CGAL/NewKernel_d/Cartesian_complete.h  |     0
 .../include/CGAL/NewKernel_d/Cartesian_filter_K.h  |     0
 .../include/CGAL/NewKernel_d/Cartesian_filter_NT.h |     0
 .../CGAL/NewKernel_d/Cartesian_per_dimension.h     |     0
 .../CGAL/NewKernel_d/Cartesian_static_filters.h    |     0
 .../include/CGAL/NewKernel_d/Coaffine.h            |     0
 .../include/CGAL/NewKernel_d/Define_kernel_types.h |     0
 .../include/CGAL/NewKernel_d/Dimension_base.h      |     0
 .../include/CGAL/NewKernel_d/Filtered_predicate2.h |     0
 .../include/CGAL/NewKernel_d/KernelD_converter.h   |     0
 .../include/CGAL/NewKernel_d/Kernel_2_interface.h  |     0
 .../include/CGAL/NewKernel_d/Kernel_3_interface.h  |     0
 .../include/CGAL/NewKernel_d/Kernel_d_interface.h  |     0
 .../CGAL/NewKernel_d/Kernel_object_converter.h     |     0
 .../CGAL/include/CGAL/NewKernel_d/LA_eigen/LA.h    |   175 +
 .../CGAL/NewKernel_d/LA_eigen/constructors.h       |     0
 .../include/CGAL/NewKernel_d/Lazy_cartesian.h      |     0
 .../CGAL/NewKernel_d/Types/Aff_transformation.h    |     0
 .../include/CGAL/NewKernel_d/Types/Hyperplane.h    |     0
 .../include/CGAL/NewKernel_d/Types/Iso_box.h       |     0
 .../include/CGAL/NewKernel_d/Types/Line.h          |     0
 .../include/CGAL/NewKernel_d/Types/Ray.h           |     0
 .../include/CGAL/NewKernel_d/Types/Segment.h       |     0
 .../include/CGAL/NewKernel_d/Types/Sphere.h        |     0
 .../include/CGAL/NewKernel_d/Vector/array.h        |     0
 .../include/CGAL/NewKernel_d/Vector/avx4.h         |     0
 ...f_iterator_to_points_from_iterator_to_vectors.h |     0
 ...determinant_of_iterator_to_points_from_points.h |     0
 ...terminant_of_iterator_to_vectors_from_vectors.h |     0
 .../Vector/determinant_of_points_from_vectors.h    |     0
 .../Vector/determinant_of_vectors_small_dim.h      |     0
 .../determinant_of_vectors_small_dim_internal.h    |     0
 .../include/CGAL/NewKernel_d/Vector/mix.h          |     0
 .../include/CGAL/NewKernel_d/Vector/sse2.h         |     0
 .../include/CGAL/NewKernel_d/Vector/v2int.h        |     0
 .../include/CGAL/NewKernel_d/Vector/vector.h       |     0
 .../CGAL/NewKernel_d/Wrapper/Cartesian_wrap.h      |     0
 .../CGAL/NewKernel_d/Wrapper/Hyperplane_d.h        |     0
 .../include/CGAL/NewKernel_d/Wrapper/Point_d.h     |     0
 .../CGAL/NewKernel_d/Wrapper/Ref_count_obj.h       |     0
 .../include/CGAL/NewKernel_d/Wrapper/Segment_d.h   |     0
 .../include/CGAL/NewKernel_d/Wrapper/Sphere_d.h    |     0
 .../include/CGAL/NewKernel_d/Wrapper/Vector_d.h    |     0
 .../CGAL/NewKernel_d/function_objects_cartesian.h  |  1301 +
 .../include/CGAL/NewKernel_d/functor_properties.h  |     0
 .../include/CGAL/NewKernel_d/functor_tags.h        |     0
 .../include/CGAL/NewKernel_d/static_int.h          |     0
 .../include/CGAL/NewKernel_d/store_kernel.h        |     0
 .../include/CGAL/NewKernel_d/utils.h               |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Null_matrix.h  |     0
 .../include/CGAL/Number_type_checker.h             |     0
 .../internal_functions_comparison_root_of_2.h      |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/OFF_to_nef_3.h |     0
 3rdparty/CGAL/include/CGAL/OTR_2/Cost.h            |   110 +
 .../include/CGAL/OTR_2/Reconstruction_edge_2.h     |   144 +
 .../CGAL/OTR_2/Reconstruction_face_base_2.h        |   266 +
 .../CGAL/OTR_2/Reconstruction_triangulation_2.h    |  1124 +
 .../CGAL/OTR_2/Reconstruction_vertex_base_2.h      |   134 +
 .../{CGAL-4.8 => CGAL}/include/CGAL/OTR_2/Sample.h |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/Object.h  |     0
 .../include/CGAL/OpenNL/bicgstab.h                 |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/OpenNL/blas.h  |     0
 .../include/CGAL/OpenNL/conjugate_gradient.h       |     0
 .../include/CGAL/OpenNL/full_vector.h              |     0
 .../include/CGAL/OpenNL/linear_solver.h            |     0
 .../include/CGAL/OpenNL/preconditioner.h           |     0
 .../include/CGAL/OpenNL/sparse_matrix.h            |     0
 .../CGAL/Optimal_transportation_reconstruction_2.h |  1770 ++
 .../CGAL/Optimisation/Access_coordinates_begin_2.h |     0
 .../CGAL/Optimisation/Access_coordinates_begin_3.h |     0
 .../CGAL/Optimisation/Access_coordinates_begin_d.h |     0
 .../include/CGAL/Optimisation/Access_dimension_2.h |     0
 .../include/CGAL/Optimisation/Access_dimension_3.h |     0
 .../include/CGAL/Optimisation/Access_dimension_d.h |     0
 .../include/CGAL/Optimisation/Construct_point_2.h  |     0
 .../include/CGAL/Optimisation/Construct_point_3.h  |     0
 .../include/CGAL/Optimisation/Construct_point_d.h  |     0
 .../include/CGAL/Optimisation/assertions.h         |     0
 .../include/CGAL/Optimisation/basic.h              |     0
 .../include/CGAL/Optimisation/debug.h              |     0
 .../include/CGAL/Optimisation_d_traits_2.h         |     0
 .../include/CGAL/Optimisation_d_traits_3.h         |     0
 .../include/CGAL/Optimisation_d_traits_d.h         |     0
 .../include/CGAL/Orientation_Linf_2.h              |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/Origin.h  |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Origin_impl.h  |     0
 .../CGAL/Orthogonal_incremental_neighbor_search.h  |   620 +
 .../include/CGAL/Orthogonal_k_neighbor_search.h    |   193 +
 .../{CGAL-4.8 => CGAL}/include/CGAL/PCA_util.h     |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Parabola_2.h   |     0
 .../include/CGAL/Parabola_segment_2.h              |     0
 .../include/CGAL/Param_mesh_patch_circulators.h    |     0
 .../include/CGAL/Param_mesh_patch_iterators.h      |     0
 .../include/CGAL/Param_mesh_patch_vertex.h         |     0
 .../CGAL/Parameterization_mesh_feature_extractor.h |     0
 .../include/CGAL/Parameterization_mesh_patch_3.h   |     0
 .../CGAL/Parameterization_polyhedron_adaptor_3.h   |     0
 .../include/CGAL/Parameterizer_traits_3.h          |     0
 .../include/CGAL/Partition_2/Circulator_pair.h     |     0
 .../CGAL/Partition_2/Indirect_edge_compare.h       |     0
 .../include/CGAL/Partition_2/Indirect_less_xy_2.h  |     0
 .../CGAL/Partition_2/Indirect_not_less_yx_2.h      |     0
 .../include/CGAL/Partition_2/Iterator_list.h       |     0
 .../include/CGAL/Partition_2/Matrix.h              |     0
 .../Partition_2/Partition_opt_cvx_diagonal_list.h  |     0
 .../CGAL/Partition_2/Partition_opt_cvx_edge.h      |     0
 .../CGAL/Partition_2/Partition_opt_cvx_vertex.h    |     0
 .../CGAL/Partition_2/Partition_traits_2_base.h     |     0
 .../CGAL/Partition_2/Partition_vertex_map.h        |     0
 .../CGAL/Partition_2/Partitioned_polygon_2.h       |     0
 .../CGAL/Partition_2/Point_pair_less_xy_2.h        |     0
 .../include/CGAL/Partition_2/Rotation_tree_2.h     |     0
 .../CGAL/Partition_2/Rotation_tree_2_impl.h        |     0
 .../CGAL/Partition_2/Rotation_tree_node_2.h        |     0
 .../include/CGAL/Partition_2/Segment_less_yx_2.h   |     0
 .../Partition_2/Triangulation_indirect_traits_2.h  |     0
 .../include/CGAL/Partition_2/Turn_reverser.h       |     0
 .../CGAL/Partition_2/Vertex_visibility_graph_2.h   |     0
 .../Partition_2/Vertex_visibility_graph_2_impl.h   |     0
 .../CGAL/Partition_2/is_degenerate_polygon_2.h     |     0
 .../CGAL/Partition_2/partition_approx_convex_2.h   |     0
 .../CGAL/Partition_2/partition_assertions.h        |     0
 .../Partition_2/partition_greene_approx_convex_2.h |     0
 .../CGAL/Partition_2/partition_optimal_convex_2.h  |     0
 .../CGAL/Partition_2/partition_y_monotone_2.h      |     0
 .../include/CGAL/Partition_is_valid_traits_2.h     |     0
 .../include/CGAL/Partition_traits_2.h              |     0
 .../CGAL/Periodic_2_Delaunay_triangulation_2.h     |  5379 ++++
 .../Periodic_2_Delaunay_triangulation_traits_2.h   |     0
 .../include/CGAL/Periodic_2_offset_2.h             |     0
 .../include/CGAL/Periodic_2_triangulation_2.h      |     0
 .../CGAL/Periodic_2_triangulation_dummy_12.h       |     0
 .../CGAL/Periodic_2_triangulation_face_base_2.h    |     0
 .../Periodic_2_triangulation_filtered_traits_2.h   |     0
 .../CGAL/Periodic_2_triangulation_hierarchy_2.h    |     0
 ...iodic_2_triangulation_hierarchy_vertex_base_2.h |     0
 .../CGAL/Periodic_2_triangulation_iterators_2.h    |     0
 ..._2_triangulation_statically_filtered_traits_2.h |     0
 .../CGAL/Periodic_2_triangulation_traits_2.h       |     0
 .../CGAL/Periodic_2_triangulation_vertex_base_2.h  |     0
 .../CGAL/Periodic_3_Delaunay_triangulation_3.h     |  1241 +
 ...ic_3_Delaunay_triangulation_filtered_traits_3.h |    33 +
 .../Periodic_3_Delaunay_triangulation_traits_3.h   |   145 +
 .../include/CGAL/Periodic_3_construct_point_3.h    |     0
 .../include/CGAL/Periodic_3_offset_3.h             |     0
 .../CGAL/include/CGAL/Periodic_3_triangulation_3.h |  4141 +++
 .../CGAL/Periodic_3_triangulation_ds_cell_base_3.h |     0
 .../Periodic_3_triangulation_ds_vertex_base_3.h    |     0
 .../CGAL/Periodic_3_triangulation_dummy_36.h       |     0
 .../CGAL/Periodic_3_triangulation_hierarchy_3.h    |     0
 .../CGAL/Periodic_3_triangulation_iterators_3.h    |     0
 .../CGAL/Periodic_3_triangulation_traits_3.h       |   152 +
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/Plane_3.h |     0
 .../include/CGAL/Plane_separator.h                 |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/Point_2.h |     0
 .../CGAL/Point_2_Iso_rectangle_2_intersection.h    |     0
 .../include/CGAL/Point_2_Line_2_intersection.h     |     0
 .../include/CGAL/Point_2_Point_2_intersection.h    |     0
 .../include/CGAL/Point_2_Ray_2_intersection.h      |     0
 .../include/CGAL/Point_2_Segment_2_intersection.h  |     0
 .../include/CGAL/Point_2_Triangle_2_intersection.h |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/Point_3.h |     0
 .../include/CGAL/Point_container.h                 |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Point_set_2.h  |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Point_traits.h |     0
 3rdparty/CGAL/include/CGAL/Point_with_normal_3.h   |   172 +
 .../include/CGAL/Point_with_psc_localisation.h     |     0
 .../include/CGAL/Point_with_surface_index.h        |     0
 .../CGAL/Point_with_surface_index_geom_traits.h    |     0
 .../include/CGAL/Poisson_implicit_surface_3.h      |     0
 .../include/CGAL/Poisson_mesh_cell_criteria_3.h    |     0
 .../include/CGAL/Poisson_reconstruction_function.h |  1218 +
 3rdparty/CGAL/include/CGAL/Polychain_2.h           |   859 +
 .../{CGAL-4.8 => CGAL}/include/CGAL/Polygon_2.h    |     0
 .../CGAL/Polygon_2/Polygon_2_algorithms_impl.h     |     0
 .../CGAL/Polygon_2/Polygon_2_edge_circulator.h     |     0
 .../CGAL/Polygon_2/Polygon_2_edge_iterator.h       |     0
 .../include/CGAL/Polygon_2/Polygon_2_impl.h        |     0
 .../include/CGAL/Polygon_2/Polygon_2_simplicity.h  |     0
 .../CGAL/Polygon_2/Polygon_2_vertex_circulator.h   |     0
 .../include/CGAL/Polygon_2/polygon_assertions.h    |     0
 3rdparty/CGAL/include/CGAL/Polygon_2_algorithms.h  |   466 +
 .../include/CGAL/Polygon_convex_decomposition_2.h  |     0
 .../include/CGAL/Polygon_mesh_processing/Weights.h |   766 +
 .../include/CGAL/Polygon_mesh_processing/bbox.h    |     0
 .../include/CGAL/Polygon_mesh_processing/border.h  |   217 +
 .../CGAL/Polygon_mesh_processing/compute_normal.h  |   409 +
 .../Polygon_mesh_processing/connected_components.h |     0
 .../CGAL/Polygon_mesh_processing/distance.h        |     0
 .../include/CGAL/Polygon_mesh_processing/fair.h    |   167 +
 .../Hole_filling/Triangulate_hole_polygon_mesh.h   |     0
 .../Hole_filling/Triangulate_hole_polyline.h       |  1236 +
 .../internal/Hole_filling/do_not_use_DT3.h         |     0
 .../Hole_filling/experimental/experimental_code.h  |     0
 .../AABB_filtered_projection_traits.h              |   134 +
 .../internal/Isotropic_remeshing/remesh_impl.h     |  1750 ++
 .../Axis_parallel_plane_traits.h                   |     0
 .../Polygon_mesh_slicer/Traversal_traits.h         |     0
 .../AABB_triangle_accessor_3_primitive.h           |     0
 .../Point_inside_vertical_ray_cast.h               |     0
 .../Ray_3_Triangle_3_traversal_traits.h            |     0
 .../Polygon_mesh_processing/internal/fair_impl.h   |   203 +
 .../internal/named_function_params.h               |   423 +
 .../internal/named_params_helper.h                 |   141 +
 .../Polygon_mesh_processing/internal/refine_impl.h |   335 +
 .../include/CGAL/Polygon_mesh_processing/measure.h |   451 +
 .../Polygon_mesh_processing/orient_polygon_soup.h  |   488 +
 .../CGAL/Polygon_mesh_processing/orientation.h     |     0
 .../polygon_soup_to_polygon_mesh.h                 |   206 +
 .../include/CGAL/Polygon_mesh_processing/refine.h  |     0
 .../include/CGAL/Polygon_mesh_processing/remesh.h  |   346 +
 .../include/CGAL/Polygon_mesh_processing/repair.h  |     0
 .../Polygon_mesh_processing/self_intersections.h   |     0
 .../CGAL/Polygon_mesh_processing/stitch_borders.h  |     0
 .../Polygon_mesh_processing/triangulate_faces.h    |   433 +
 .../Polygon_mesh_processing/triangulate_hole.h     |   407 +
 .../include/CGAL/Polygon_mesh_slicer.h             |     0
 .../include/CGAL/Polygon_nop_decomposition_2.h     |    43 +
 .../include/CGAL/Polygon_offset_builder_2.h        |     0
 .../include/CGAL/Polygon_offset_builder_traits_2.h |     0
 .../include/CGAL/Polygon_set_2.h                   |     0
 .../include/CGAL/Polygon_traits_2.h                |     0
 .../CGAL/Polygon_triangulation_decomposition_2.h   |     0
 .../CGAL/Polygon_vertical_decomposition_2.h        |     0
 3rdparty/CGAL/include/CGAL/Polygon_with_holes_2.h  |   227 +
 .../include/CGAL/PolyhedralSurf_neighbors.h        |     0
 .../CGAL/include/CGAL/Polyhedral_mesh_domain_3.h   |   808 +
 .../CGAL/Polyhedral_mesh_domain_with_features_3.h  |   351 +
 .../{CGAL-4.8 => CGAL}/include/CGAL/Polyhedron_3.h |     0
 .../include/CGAL/Polyhedron_copy_3.h               |     0
 .../include/CGAL/Polyhedron_decorator_3.h          |     0
 .../CGAL/Polyhedron_incremental_builder_3.h        |     0
 .../include/CGAL/Polyhedron_items_3.h              |     0
 .../include/CGAL/Polyhedron_items_with_id_3.h      |     0
 .../include/CGAL/Polyhedron_min_items_3.h          |     0
 .../include/CGAL/Polyhedron_traits_3.h             |     0
 .../CGAL/Polyhedron_traits_with_normals_3.h        |     0
 .../include/CGAL/Polyline_constraint_hierarchy_2.h |  1181 +
 .../Hybrid_squared_distance_cost.h                 |     0
 .../Scaled_squared_distance_cost.h                 |     0
 .../Squared_distance_cost.h                        |     0
 .../Stop_above_cost_threshold.h                    |     0
 .../Stop_below_count_ratio_threshold.h             |     0
 .../Stop_below_count_threshold.h                   |     0
 .../CGAL/Polyline_simplification_2/Vertex_base_2.h |     0
 .../CGAL/Polyline_simplification_2/simplify.h      |   484 +
 3rdparty/CGAL/include/CGAL/Polynomial.h            |    75 +
 .../CGAL/Polynomial/Algebraic_structure_traits.h   |     0
 .../include/CGAL/Polynomial/CORE_Expr_root_stack.h |     0
 .../include/CGAL/Polynomial/CORE_kernel.h          |     0
 .../Cached_extended_euclidean_algorithm.h          |     0
 .../CGAL/Polynomial/Chinese_remainder_traits.h     |     0
 .../include/CGAL/Polynomial/Coercion_traits.h      |     0
 .../include/CGAL/Polynomial/Degree.h               |     0
 .../include/CGAL/Polynomial/Fixed_polynomial.h     |     0
 .../include/CGAL/Polynomial/Fraction_traits.h      |     0
 .../CGAL/Polynomial/Get_arithmetic_kernel.h        |     0
 .../include/CGAL/Polynomial/Interpolator.h         |     0
 .../include/CGAL/Polynomial/Interval_polynomial.h  |     0
 .../include/CGAL/Polynomial/Kernel.h               |     0
 .../include/CGAL/Polynomial/Modular_traits.h       |     0
 .../CGAL/Polynomial/Monomial_representation.h      |     0
 .../include/CGAL/Polynomial/Numeric_root_stack.h   |     0
 .../include/CGAL/Polynomial/Polynomial.h           |     0
 .../include/CGAL/Polynomial/Polynomial_type.h      |     0
 .../CGAL/Polynomial/Real_embeddable_traits.h       |     0
 .../CGAL/Polynomial/Root_stack_default_traits.h    |     0
 .../include/CGAL/Polynomial/Scalar_factor_traits.h |     0
 .../include/CGAL/Polynomial/Sturm_root_stack.h     |     0
 .../CGAL/Polynomial/Sturm_root_stack_traits.h      |     0
 3rdparty/CGAL/include/CGAL/Polynomial/basic.h      |   208 +
 .../CGAL/include/CGAL/Polynomial/bezout_matrix.h   |   614 +
 .../include/CGAL/Polynomial/determinant.h          |     0
 .../include/CGAL/Polynomial/fwd.h                  |     0
 .../include/CGAL/Polynomial/hgdelta_update.h       |     0
 .../CGAL/Polynomial/internal/Alternation_counter.h |     0
 .../CGAL/Polynomial/internal/CORE_polynomial.h     |     0
 .../Polynomial/internal/Descartes_root_count.h     |     0
 .../Polynomial/internal/Double_with_infinity.h     |     0
 .../CGAL/Polynomial/internal/Filtered_function.h   |     0
 .../CGAL/Polynomial/internal/Filtered_kernel.h     |   111 +
 .../Filtered_kernel/Filtered_Descartes_has_root.h  |    56 +
 .../Filtered_Descartes_root_counter.h              |   158 +
 .../Filtered_kernel/Filtered_are_negations.h       |     0
 .../Filtered_root_bound_evaluator.h                |     0
 .../Filtered_kernel/Filtered_root_multiplicity.h   |     0
 .../internal/Filtered_kernel/Filtered_sign_at.h    |     0
 .../CGAL/Polynomial/internal/Filtered_number.h     |     0
 .../Construct_filtered_function.h                  |     0
 .../Filtered_Descartes_has_root.h                  |    56 +
 .../Filtered_Descartes_root_counter.h              |     0
 .../Filtered_rational/Filtered_Sturm_sequence.h    |     0
 .../Filtered_rational/Filtered_are_negations.h     |     0
 .../Filtered_rational_multiplicity.h               |     0
 .../Filtered_rational_sign_above_rational.h        |     0
 .../Filtered_rational/Filtered_rational_traits.h   |     0
 .../Filtered_root_bound_evaluator.h                |     0
 .../Filtered_sign_Sturm_sequence.h                 |     0
 .../Filtered_rational/Filtered_sign_at_rational.h  |     0
 .../Filtered_rational/Filtered_standard_sequence.h |   151 +
 .../Polynomial/internal/Fixed_polynomial_impl.h    |     0
 .../CGAL/Polynomial/internal/GSL_numeric_solver.h  |     0
 .../CGAL/Polynomial/internal/Isolating_interval.h  |     0
 .../internal/JAMA_numeric_solvers_impl.h           |     0
 .../internal/Kernel/Is_even_multiplicity.h         |     0
 .../CGAL/Polynomial/internal/Kernel/Is_rational.h  |     0
 .../internal/Kernel/Isolating_interval.h           |     0
 .../Polynomial/internal/Kernel/Lower_bound_root.h  |     0
 .../CGAL/Polynomial/internal/Kernel/Multiplicity.h |     0
 .../internal/Kernel/Rational_between_roots.h       |     0
 .../Polynomial/internal/Kernel/Root_container.h    |     0
 .../CGAL/Polynomial/internal/Kernel/Sign_above.h   |    91 +
 .../CGAL/Polynomial/internal/Kernel/Sign_at.h      |     0
 .../CGAL/Polynomial/internal/Kernel/Sign_below.h   |     0
 .../internal/Kernel/Sign_between_roots.h           |     0
 .../CGAL/Polynomial/internal/Kernel/To_rational.h  |     0
 .../internal/Kernel/predicate_template.h           |     0
 .../CGAL/Polynomial/internal/Polynomial_impl.h     |     0
 .../Polynomial/internal/Rational/Are_negations.h   |     0
 .../internal/Rational/Bezier_root_counter.h        |     0
 .../Rational/Compare_isolated_roots_in_interval.h  |     0
 .../internal/Rational/Construct_function.h         |     0
 .../CGAL/Polynomial/internal/Rational/Derivative.h |     0
 .../internal/Rational/Descartes_has_root.h         |    70 +
 .../internal/Rational/Descartes_root_counter.h     |     0
 .../internal/Rational/Euclidean_Sturm_sequence.h   |     0
 .../internal/Rational/Evaluate_polynomial.h        |     0
 .../Polynomial/internal/Rational/Invert_variable.h |     0
 .../Rational/Map_rational_interval_to_positive.h   |     0
 .../internal/Rational/Monic_Sturm_sequence.h       |     0
 .../Polynomial/internal/Rational/Negate_variable.h |     0
 .../Rational/Primitive_part_Sturm_sequence.h       |     0
 .../Polynomial/internal/Rational/Pseudo_quotient.h |     0
 .../internal/Rational/Pseudo_remainder.h           |     0
 .../CGAL/Polynomial/internal/Rational/Quotient.h   |     0
 .../internal/Rational/Quotient_remainder.h         |     0
 .../internal/Rational/Rational_multiplicity.h      |     0
 .../internal/Rational/Rational_traits_base.h       |     0
 .../internal/Rational/Rational_translate_zero.h    |     0
 .../internal/Rational/Reduced_Sturm_sequence.h     |     0
 .../CGAL/Polynomial/internal/Rational/Remainder.h  |     0
 .../internal/Rational/Root_bound_evaluator.h       |     0
 .../Polynomial/internal/Rational/Shift_power.h     |     0
 .../internal/Rational/Sign_Sturm_sequence.h        |     0
 .../internal/Rational/Sign_above_rational.h        |     0
 .../internal/Rational/Sign_at_rational.h           |     0
 .../internal/Rational/Sign_below_rational.h        |     0
 .../internal/Rational/Standard_sequence.h          |    94 +
 .../internal/Rational/Sturm_root_counter.h         |     0
 .../Polynomial/internal/Rational/Sturm_sequence.h  |     0
 .../internal/Rational/Sturm_sequence_base.h        |     0
 .../Rational/Subresultant_Sturm_sequence.h         |     0
 .../Polynomial/internal/Root_stack_traits_base.h   |     0
 .../Polynomial/internal/Sign_variations_counter.h  |     0
 .../Polynomial/internal/Simple_interval_root.h     |     0
 .../include/CGAL/Polynomial/internal/Statistics.h  |     0
 .../Polynomial/internal/Sturm_isolating_interval.h |     0
 .../CGAL/Polynomial/internal/Sturm_root_rep.h      |  1048 +
 .../internal/Turkowski_numeric_solvers_impl.h      |   467 +
 .../include/CGAL/Polynomial/internal/config.h      |     0
 .../internal/filtered_function_leaf_nodes.h        |     0
 .../internal/filtered_function_node_bases.h        |     0
 .../internal/filtered_function_operation_nodes.h   |     0
 .../CGAL/Polynomial/internal/interval_arithmetic.h |     0
 .../CGAL/include/CGAL/Polynomial/internal/macros.h |    72 +
 .../CGAL/Polynomial/internal/nt_converters.h       |     0
 .../CGAL/Polynomial/internal/numeric_solvers.h     |     0
 .../Polynomial/internal/numeric_solvers_impl.h     |     0
 .../Polynomial/internal/numeric_solvers_support.h  |     0
 .../internal/numeric_solvers_support_impl.h        |     0
 .../Polynomial/internal/polynomial_generators.h    |     0
 .../include/CGAL/Polynomial/misc.h                 |     0
 .../include/CGAL/Polynomial/modular_filter.h       |     0
 .../include/CGAL/Polynomial/modular_gcd.h          |     0
 .../CGAL/Polynomial/modular_gcd_utcf_algorithm_M.h |     0
 .../CGAL/Polynomial/modular_gcd_utcf_dfai.h        |     0
 .../include/CGAL/Polynomial/modular_gcd_utils.h    |     0
 .../CGAL/Polynomial/polynomial_converters.h        |     0
 .../include/CGAL/Polynomial/polynomial_gcd.h       |     0
 .../Polynomial/polynomial_gcd_implementations.h    |     0
 .../include/CGAL/Polynomial/polynomial_gcd_ntl.h   |     0
 .../include/CGAL/Polynomial/prs_resultant.h        |     0
 .../include/CGAL/Polynomial/resultant.h            |     0
 .../CGAL/Polynomial/square_free_factorize.h        |     0
 .../CGAL/Polynomial/sturm_habicht_sequence.h       |     0
 .../include/CGAL/Polynomial/subresultants.h        |     0
 .../include/CGAL/Polynomial_traits_d.h             |     0
 .../include/CGAL/Polynomial_type_generator.h       |     0
 .../include/CGAL/Polynomials_1_2.h                 |     0
 .../include/CGAL/Polynomials_1_3.h                 |     0
 .../include/CGAL/Polynomials_2_2.h                 |     0
 .../include/CGAL/Polynomials_2_3.h                 |     0
 .../include/CGAL/Polynomials_for_line_3.h          |     0
 3rdparty/CGAL/include/CGAL/Polytope_distance_d.h   |   942 +
 .../include/CGAL/Polytope_distance_d_traits_2.h    |     0
 .../include/CGAL/Polytope_distance_d_traits_3.h    |     0
 .../include/CGAL/Polytope_distance_d_traits_d.h    |     0
 .../include/CGAL/Prevent_deref.h                   |     0
 .../include/CGAL/Profile_counter.h                 |     0
 .../include/CGAL/Profile_timer.h                   |     0
 .../include/CGAL/Projection_traits_xy_3.h          |     0
 .../include/CGAL/Projection_traits_xz_3.h          |     0
 .../include/CGAL/Projection_traits_yz_3.h          |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/QP_functions.h |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/QP_models.h    |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/QP_options.h   |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/QP_solution.h  |     0
 .../include/CGAL/QP_solver/Initialization.h        |     0
 .../include/CGAL/QP_solver/QP__filtered_base.h     |     0
 .../CGAL/QP_solver/QP__filtered_base_impl.h        |     0
 .../include/CGAL/QP_solver/QP__partial_base.h      |     0
 .../include/CGAL/QP_solver/QP_basis_inverse.h      |     0
 .../include/CGAL/QP_solver/QP_basis_inverse_impl.h |     0
 .../CGAL/QP_solver/QP_exact_bland_pricing.h        |     0
 .../include/CGAL/QP_solver/QP_full_exact_pricing.h |     0
 .../CGAL/QP_solver/QP_full_filtered_pricing.h      |     0
 .../include/CGAL/QP_solver/QP_functions_impl.h     |     0
 .../CGAL/QP_solver/QP_partial_exact_pricing.h      |     0
 .../CGAL/QP_solver/QP_partial_filtered_pricing.h   |     0
 .../include/CGAL/QP_solver/QP_pricing_strategy.h   |     0
 .../include/CGAL/QP_solver/QP_solution_impl.h      |     0
 .../include/CGAL/QP_solver/QP_solver.h             |     0
 .../include/CGAL/QP_solver/QP_solver_bounds_impl.h |     0
 .../include/CGAL/QP_solver/QP_solver_impl.h        |     0
 .../QP_solver/QP_solver_nonstandardform_impl.h     |     0
 .../include/CGAL/QP_solver/Unbounded_direction.h   |     0
 .../include/CGAL/QP_solver/assertions.h            |     0
 .../include/CGAL/QP_solver/basic.h                 |     0
 .../include/CGAL/QP_solver/debug.h                 |     0
 .../include/CGAL/QP_solver/functors.h              |     0
 .../include/CGAL/Qt/AlphaShapeGraphicsItem.h       |     0
 .../include/CGAL/Qt/ApolloniusGraphGraphicsItem.h  |     0
 .../include/CGAL/Qt/CGAL_Qt_config.h               |     0
 .../include/CGAL/Qt/CircularArcGraphicsItem.h      |     0
 .../CGAL/Qt/ConstrainedTriangulationGraphicsItem.h |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Qt/Converter.h |     0
 .../include/CGAL/Qt/CreateOpenGLContext.h          |     0
 .../Qt/DelaunayMeshTriangulationGraphicsItem.h     |     0
 .../include/CGAL/Qt/DemosMainWindow.h              |     0
 .../CGAL/include/CGAL/Qt/DemosMainWindow_impl.h    |   474 +
 .../include/CGAL/Qt/GraphicsItem.h                 |     0
 .../include/CGAL/Qt/GraphicsViewCircleInput.h      |     0
 .../include/CGAL/Qt/GraphicsViewCircularArcInput.h |     0
 .../include/CGAL/Qt/GraphicsViewInput.h            |     0
 .../CGAL/Qt/GraphicsViewIsoRectangleInput.h        |     0
 .../include/CGAL/Qt/GraphicsViewLineInput.h        |     0
 .../include/CGAL/Qt/GraphicsViewNavigation.h       |     0
 .../include/CGAL/Qt/GraphicsViewNavigation_impl.h  |   351 +
 .../include/CGAL/Qt/GraphicsViewPointInput.h       |     0
 .../CGAL/Qt/GraphicsViewPolygonWithHolesInput.h    |     0
 .../include/CGAL/Qt/GraphicsViewPolylineInput.h    |     0
 .../CGAL/Qt/GraphicsViewPolylineInput_impl.h       |     0
 .../include/CGAL/Qt/LineGraphicsItem.h             |     0
 .../include/CGAL/Qt/PainterOstream.h               |     0
 .../include/CGAL/Qt/PointsGraphicsItem.h           |     0
 .../include/CGAL/Qt/PointsInKdTreeGraphicsItem.h   |     0
 .../include/CGAL/Qt/PolygonGraphicsItem.h          |     0
 .../include/CGAL/Qt/PolygonWithHolesGraphicsItem.h |     0
 .../include/CGAL/Qt/PolylinesGraphicsItem.h        |     0
 .../include/CGAL/Qt/PowerdiagramGraphicsItem.h     |     0
 .../include/CGAL/Qt/RegularGridGraphicsItem.h      |     0
 .../CGAL/Qt/RegularGridVectorFieldGraphicsItem.h   |     0
 .../CGAL/Qt/RegularTriangulationGraphicsItem.h     |     0
 .../CGAL/Qt/SegmentDelaunayGraphGraphicsItem.h     |     0
 .../CGAL/Qt/SegmentDelaunayGraphLinfGraphicsItem.h |     0
 .../include/CGAL/Qt/SegmentsGraphicsItem.h         |     0
 .../include/CGAL/Qt/StreamLinesGraphicsItem.h      |     0
 .../include/CGAL/Qt/TriangulationGraphicsItem.h    |     0
 .../include/CGAL/Qt/VoronoiGraphicsItem.h          |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Qt/debug.h     |     0
 .../include/CGAL/Qt/debug_impl.h                   |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Qt/resources.h |     0
 .../include/CGAL/Qt/resources_impl.h               |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Qt/utility.h   |     0
 .../include/CGAL/Qt/utility_impl.h                 |     0
 3rdparty/CGAL/include/CGAL/Quotient.h              |   879 +
 .../{CGAL-4.8 => CGAL}/include/CGAL/Quotient_fwd.h |     0
 .../include/CGAL/RS/Gmpfr_make_unique.h            |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/RS/ak_1.h |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/RS/ak_z_1.h    |     0
 .../include/CGAL/RS/algebraic_1.h                  |     0
 .../include/CGAL/RS/algebraic_z_1.h                |     0
 .../include/CGAL/RS/bisection_refiner_1.h          |     0
 .../include/CGAL/RS/comparator_1.h                 |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/RS/dyadic.h    |     0
 .../include/CGAL/RS/exact_signat_1.h               |     0
 .../include/CGAL/RS/functors_1.h                   |     0
 .../include/CGAL/RS/functors_z_1.h                 |     0
 .../include/CGAL/RS/polynomial_converter_1.h       |     0
 .../include/CGAL/RS/rs23_k_isolator_1.h            |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/RS/rs2_calls.h |     0
 .../include/CGAL/RS/rs2_isolator_1.h               |     0
 .../include/CGAL/RS/rs3_k_refiner_1.h              |     0
 .../include/CGAL/RS/rs3_refiner_1.h                |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/RS/signat_1.h  |     0
 3rdparty/CGAL/include/CGAL/Random.h                |   260 +
 .../include/CGAL/Random_access_adaptor.h           |     0
 .../include/CGAL/Random_access_value_adaptor.h     |     0
 .../include/CGAL/Random_convex_hull_traits_2.h     |     0
 .../include/CGAL/Random_convex_set_traits_2.h      |     0
 3rdparty/CGAL/include/CGAL/Random_impl.h           |   100 +
 .../include/CGAL/Random_polygon_2_sweep.h          |     0
 .../include/CGAL/Random_polygon_traits_2.h         |     0
 .../include/CGAL/Range_segment_tree_traits.h       |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Range_tree_d.h |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Range_tree_k.h |     0
 .../include/CGAL/Rational_traits.h                 |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/Ray_2.h   |     0
 .../include/CGAL/Ray_2_Bbox_2_intersection.h       |     0
 .../include/CGAL/Ray_2_Bbox_2_intersection_impl.h  |     0
 .../CGAL/Ray_2_Iso_rectangle_2_intersection.h      |     0
 .../include/CGAL/Ray_2_Line_2_intersection.h       |     0
 .../include/CGAL/Ray_2_Point_2_intersection.h      |     0
 .../include/CGAL/Ray_2_Ray_2_intersection.h        |     0
 .../include/CGAL/Ray_2_Segment_2_intersection.h    |     0
 .../include/CGAL/Ray_2_Triangle_2_intersection.h   |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/Ray_3.h   |     0
 .../include/CGAL/Real_embeddable_traits.h          |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Real_timer.h   |     0
 .../include/CGAL/Real_timer_impl.h                 |     0
 .../include/CGAL/Reconstruction_triangulation_3.h  |   506 +
 .../include/CGAL/Rectangular_p_center_traits_2.h   |     0
 .../include/CGAL/Referenced_argument.h             |     0
 3rdparty/CGAL/include/CGAL/Regular_complex_d.h     |   732 +
 .../include/CGAL/Regular_grid_2.h                  |     0
 .../CGAL/include/CGAL/Regular_triangulation_2.h    |  2240 ++
 .../CGAL/include/CGAL/Regular_triangulation_3.h    |  2329 ++
 .../Regular_triangulation_adaptation_policies_2.h  |     0
 .../Regular_triangulation_adaptation_traits_2.h    |     0
 .../CGAL/Regular_triangulation_cell_base_3.h       |     0
 ...lation_cell_base_with_weighted_circumcenter_3.h |     0
 .../Regular_triangulation_euclidean_traits_2.h     |     0
 .../Regular_triangulation_euclidean_traits_3.h     |     0
 .../CGAL/Regular_triangulation_face_base_2.h       |     0
 .../CGAL/Regular_triangulation_filtered_traits_2.h |     0
 .../CGAL/Regular_triangulation_vertex_base_2.h     |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/Residue.h |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/Ridges.h  |     0
 .../CGAL/Robust_circumcenter_filtered_traits_3.h   |     0
 .../include/CGAL/Robust_circumcenter_traits_3.h    |     0
 .../include/CGAL/Robust_construction.h             |     0
 .../include/CGAL/Root_for_circles_2_2.h            |     0
 .../include/CGAL/Root_for_spheres_2_3.h            |     0
 .../include/CGAL/Root_of_traits.h                  |     0
 .../include/CGAL/Root_of_traits_specializations.h  |     0
 .../include/CGAL/Rotational_sweep_visibility_2.h   |     0
 .../include/CGAL/Runge_kutta_integrator_2.h        |     0
 .../include/CGAL/Scalar_factor_traits.h            |     0
 .../Scale_space_surface_reconstruction_3_impl.h    |     0
 .../Shape_construction_3.h                         |     0
 .../internal/Auto_count.h                          |     0
 .../CGAL/Scale_space_surface_reconstruction_3.h    |     0
 .../include/CGAL/Search_traits.h                   |     0
 .../include/CGAL/Search_traits_2.h                 |     0
 .../include/CGAL/Search_traits_3.h                 |     0
 3rdparty/CGAL/include/CGAL/Search_traits_adapter.h |   182 +
 3rdparty/CGAL/include/CGAL/Search_traits_d.h       |    51 +
 .../include/CGAL/Search_traits_vertex_handle_3.h   |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Segment_2.h    |     0
 .../CGAL/Segment_2_Iso_rectangle_2_intersection.h  |     0
 .../include/CGAL/Segment_2_Line_2_intersection.h   |     0
 .../include/CGAL/Segment_2_Point_2_intersection.h  |     0
 .../include/CGAL/Segment_2_Ray_2_intersection.h    |     0
 .../CGAL/Segment_2_Segment_2_intersection.h        |     0
 .../CGAL/Segment_2_Triangle_2_intersection.h       |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Segment_3.h    |     0
 .../CGAL/include/CGAL/Segment_Delaunay_graph_2.h   |  2045 ++
 .../Segment_Delaunay_graph_2/Are_parallel_C2.h     |     0
 .../Segment_Delaunay_graph_2/Are_same_points_C2.h  |     0
 .../Are_same_segments_C2.h                         |     0
 .../Segment_Delaunay_graph_2/Arrangement_enum.h    |     0
 .../Segment_Delaunay_graph_2/Arrangement_type_C2.h |     0
 .../Arrangement_type_non_intersecting_C2.h         |     0
 .../Segment_Delaunay_graph_2/Basic_predicates_C2.h |     0
 .../Segment_Delaunay_graph_2/Cartesian_converter.h |     0
 .../CGAL/Segment_Delaunay_graph_2/Compare_x_2.h    |     0
 .../CGAL/Segment_Delaunay_graph_2/Compare_y_2.h    |     0
 .../Construct_storage_site_2.h                     |     0
 .../Construct_storage_site_with_info_2.h           |     0
 .../Segment_Delaunay_graph_2/Constructions_C2.h    |     0
 .../Filtered_traits_base_2.h                       |     0
 .../Filtered_traits_concept_check_tags.h           |     0
 .../Finite_edge_interior_conflict_C2.h             |     0
 .../Infinite_edge_interior_conflict_C2.h           |     0
 .../Is_degenerate_edge_C2.h                        |     0
 .../Segment_Delaunay_graph_2/Kernel_wrapper_2.h    |     0
 .../CGAL/Segment_Delaunay_graph_2/Orientation_C2.h |     0
 .../Segment_Delaunay_graph_2/Oriented_side_C2.h    |     0
 .../Oriented_side_of_bisector_C2.h                 |     0
 .../CGAL/Segment_Delaunay_graph_2/Predicates_C2.h  |     0
 .../Segment_Delaunay_graph_2_impl.h                |     0
 .../Segment_Delaunay_graph_hierarchy_2_impl.h      |     0
 .../Segment_Delaunay_graph_2/Sqrt_extension_2.h    |     0
 .../CGAL/Segment_Delaunay_graph_2/Traits_base_2.h  |     0
 .../Segment_Delaunay_graph_2/Traits_wrapper_2.h    |     0
 .../Triangulation_face_base_with_edges_2.h         |     0
 .../Segment_Delaunay_graph_2/Vertex_conflict_C2.h  |     0
 .../Segment_Delaunay_graph_2/Voronoi_vertex_C2.h   |     0
 .../Voronoi_vertex_ring_C2.h                       |     0
 .../Voronoi_vertex_sqrt_field_C2.h                 |     0
 .../Voronoi_vertex_sqrt_field_new_C2.h             |     0
 .../include/CGAL/Segment_Delaunay_graph_2/basic.h  |     0
 .../CGAL/Segment_Delaunay_graph_2/edge_list.h      |     0
 .../Segment_Delaunay_graph_2/in_place_edge_list.h  |     0
 .../include/CGAL/Segment_Delaunay_graph_Linf_2.h   |     0
 .../Basic_predicates_C2.h                          |     0
 .../Segment_Delaunay_graph_Linf_2/Bisector_Linf.h  |     0
 .../Constructions_C2.h                             |     0
 .../Filtered_traits_base_2.h                       |     0
 .../Finite_edge_interior_conflict_C2.h             |     0
 .../Infinite_edge_interior_conflict_C2.h           |     0
 .../Orientation_Linf_C2.h                          |     0
 .../Oriented_side_C2.h                             |     0
 .../Oriented_side_of_bisector_C2.h                 |     0
 .../Segment_Delaunay_graph_Linf_2/Predicates_C2.h  |     0
 .../Segment_Delaunay_graph_Linf_2_impl.h           |     0
 .../Segment_Delaunay_graph_Linf_hierarchy_2_impl.h |     0
 .../Segment_Delaunay_graph_Linf_2/Traits_base_2.h  |     0
 .../Vertex_conflict_C2.h                           |     0
 .../Voronoi_vertex_C2.h                            |     0
 .../Voronoi_vertex_ring_C2.h                       |     0
 .../Voronoi_vertex_sqrt_field_new_C2.h             |     0
 .../CGAL/Segment_Delaunay_graph_Linf_2/basic.h     |     0
 ...Segment_Delaunay_graph_Linf_filtered_traits_2.h |     0
 .../CGAL/Segment_Delaunay_graph_Linf_hierarchy_2.h |     0
 .../CGAL/Segment_Delaunay_graph_Linf_traits_2.h    |     0
 .../Segment_Delaunay_graph_adaptation_policies_2.h |     0
 .../Segment_Delaunay_graph_adaptation_traits_2.h   |     0
 .../CGAL/Segment_Delaunay_graph_face_base_2.h      |     0
 .../Segment_Delaunay_graph_filtered_traits_2.h     |     0
 .../CGAL/Segment_Delaunay_graph_hierarchy_2.h      |     0
 ...egment_Delaunay_graph_hierarchy_vertex_base_2.h |     0
 .../CGAL/Segment_Delaunay_graph_simple_site_2.h    |     0
 .../Segment_Delaunay_graph_simple_storage_site_2.h |     0
 .../include/CGAL/Segment_Delaunay_graph_site_2.h   |     0
 .../CGAL/Segment_Delaunay_graph_storage_site_2.h   |     0
 ...gment_Delaunay_graph_storage_site_with_info_2.h |     0
 .../CGAL/Segment_Delaunay_graph_storage_traits_2.h |     0
 ...ent_Delaunay_graph_storage_traits_with_info_2.h |     0
 .../include/CGAL/Segment_Delaunay_graph_traits_2.h |     0
 .../CGAL/Segment_Delaunay_graph_vertex_base_2.h    |     0
 .../include/CGAL/Segment_tree_d.h                  |     0
 .../include/CGAL/Segment_tree_k.h                  |     0
 .../include/CGAL/Shape_detection_3.h               |     0
 .../include/CGAL/Shape_detection_3/Cone.h          |     0
 .../include/CGAL/Shape_detection_3/Cylinder.h      |     0
 .../CGAL/Shape_detection_3/Efficient_RANSAC.h      |   932 +
 .../Shape_detection_3/Efficient_RANSAC_traits.h    |     0
 .../CGAL/include/CGAL/Shape_detection_3/Octree.h   |   727 +
 .../CGAL/include/CGAL/Shape_detection_3/Plane.h    |   239 +
 .../include/CGAL/Shape_detection_3/Shape_base.h    |   702 +
 .../include/CGAL/Shape_detection_3/Sphere.h        |     0
 .../include/CGAL/Shape_detection_3/Torus.h         |     0
 .../include/CGAL/Side_of_bounded_square_2.h        |     0
 .../include/CGAL/Side_of_oriented_square_2.h       |     0
 .../include/CGAL/Side_of_triangle_mesh.h           |     0
 .../include/CGAL/Simple_cartesian.h                |     0
 .../include/CGAL/Simple_circular_kernel_2.h        |     0
 .../include/CGAL/Simple_homogeneous.h              |     0
 .../include/CGAL/Simple_polygon_visibility_2.h     |     0
 .../include/CGAL/Simple_spherical_kernel_3.h       |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Sixtuple.h     |     0
 .../include/CGAL/Skin_surface_3.h                  |     0
 .../include/CGAL/Skin_surface_base_3.h             |     0
 .../include/CGAL/Skin_surface_filtered_traits_3.h  |     0
 .../Skin_surface_marching_tetrahedra_observer_3.h  |     0
 .../include/CGAL/Skin_surface_polyhedral_items_3.h |     0
 ...urface_polyhedral_items_with_face_information.h |     0
 .../CGAL/Skin_surface_quadratic_surface_3.h        |     0
 .../CGAL/Skin_surface_refinement_policy_3.h        |     0
 .../include/CGAL/Skin_surface_traits_3.h           |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Skiplist.h     |     0
 .../Small_side_angle_bisector_decomposition_2.h    |     0
 .../include/CGAL/Snap_rounding_2.h                 |     0
 .../include/CGAL/Snap_rounding_kd_2.h              |     0
 .../include/CGAL/Snap_rounding_traits_2.h          |     0
 .../CGAL/Sorted_matrix_search_traits_adaptor.h     |     0
 .../include/CGAL/Spatial_lock_grid_3.h             |     0
 .../include/CGAL/Spatial_sort_traits_adapter_2.h   |    73 +
 .../include/CGAL/Spatial_sort_traits_adapter_3.h   |    83 +
 .../include/CGAL/Spatial_sort_traits_adapter_d.h   |    87 +
 .../{CGAL-4.8 => CGAL}/include/CGAL/Sphere_3.h     |     0
 .../include/CGAL/Spherical_kernel_3.h              |     0
 .../include/CGAL/Spherical_kernel_intersections.h  |     0
 .../CGAL/Spherical_kernel_type_equality_wrapper.h  |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Splitters.h    |     0
 .../include/CGAL/Sqrt_extension.h                  |     0
 .../Sqrt_extension/Algebraic_extension_traits.h    |     0
 .../Sqrt_extension/Algebraic_structure_traits.h    |     0
 .../CGAL/Sqrt_extension/Chinese_remainder_traits.h |     0
 .../include/CGAL/Sqrt_extension/Coercion_traits.h  |     0
 .../include/CGAL/Sqrt_extension/Eigen_NumTraits.h  |    49 +
 .../include/CGAL/Sqrt_extension/Fraction_traits.h  |     0
 .../CGAL/Sqrt_extension/Get_arithmetic_kernel.h    |     0
 .../include/CGAL/Sqrt_extension/Modular_traits.h   |     0
 .../CGAL/Sqrt_extension/Real_embeddable_traits.h   |     0
 .../CGAL/Sqrt_extension/Scalar_factor_traits.h     |     0
 .../CGAL/Sqrt_extension/Sqrt_extension_type.h      |     0
 .../include/CGAL/Sqrt_extension/Wang_traits.h      |     0
 .../include/CGAL/Sqrt_extension/convert_to_bfi.h   |     0
 .../include/CGAL/Sqrt_extension/io.h               |     0
 .../include/CGAL/Sqrt_extension_fwd.h              |     0
 .../include/CGAL/Square_border_parameterizer_3.h   |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Straight_2.h   |     0
 .../include/CGAL/Straight_skeleton_2.h             |     0
 .../Polygon_offset_builder_2_impl.h                |     0
 .../Straight_skeleton_2/Straight_skeleton_aux.h    |     0
 .../Straight_skeleton_builder_2_impl.h             |     0
 .../Straight_skeleton_builder_events_2.h           |     0
 .../Straight_skeleton_builder_traits_2_aux.h       |     0
 .../include/CGAL/Straight_skeleton_2/assertions.h  |     0
 .../include/CGAL/Straight_skeleton_2/debug.h       |     0
 .../include/CGAL/Straight_skeleton_2/test.h        |     0
 .../include/CGAL/Straight_skeleton_builder_2.h     |     0
 .../CGAL/Straight_skeleton_builder_traits_2.h      |     0
 .../include/CGAL/Straight_skeleton_converter_2.h   |   304 +
 .../include/CGAL/Straight_skeleton_face_base_2.h   |     0
 .../CGAL/Straight_skeleton_halfedge_base_2.h       |     0
 .../include/CGAL/Straight_skeleton_items_2.h       |     0
 .../include/CGAL/Straight_skeleton_vertex_base_2.h |     0
 .../include/CGAL/Stream_lines_2.h                  |     0
 .../include/CGAL/Subdivision_mask_3.h              |     0
 .../include/CGAL/Subdivision_method_3.h            |     0
 .../include/CGAL/Subdivision_method_impl_3.h       |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Surface_mesh.h |     0
 .../include/CGAL/Surface_mesh/IO.h                 |     0
 .../CGAL/include/CGAL/Surface_mesh/Properties.h    |   480 +
 .../CGAL/include/CGAL/Surface_mesh/Surface_mesh.h  |  3111 +++
 .../include/CGAL/Surface_mesh/Surface_mesh_fwd.h   |     0
 .../include/CGAL/Surface_mesh_cell_base_3.h        |     0
 .../Surface_mesh_complex_2_in_triangulation_3.h    |     0
 .../include/CGAL/Surface_mesh_default_criteria_3.h |     0
 .../CGAL/Surface_mesh_default_edges_criteria_3.h   |     0
 .../CGAL/Surface_mesh_default_triangulation_3.h    |     0
 .../CGAL/include/CGAL/Surface_mesh_deformation.h   |  1614 ++
 .../include/CGAL/Surface_mesh_shortest_path.h      |     0
 .../Surface_mesh_shortest_path.h                   |  2785 +++
 .../Surface_mesh_shortest_path_traits.h            |   205 +
 .../CGAL/Surface_mesh_shortest_path/barycentric.h  |     0
 .../Surface_mesh_shortest_path/function_objects.h  |     0
 .../internal/Cone_expansion_event.h                |     0
 .../internal/Cone_tree.h                           |     0
 .../internal/misc_functions.h                      |     0
 .../Surface_mesh_simplification/Detail/Common.h    |     0
 .../Detail/Edge_collapse.h                         |     0
 .../Detail/Edge_collapse_impl.h                    |     0
 .../Edge_collapse_visitor_base.h                   |     0
 .../HalfedgeGraph_Polyhedron_3.h                   |     0
 .../Policies/Edge_collapse/Constrained_placement.h |     0
 .../Edge_collapse/Count_ratio_stop_predicate.h     |     0
 .../Policies/Edge_collapse/Count_stop_predicate.h  |     0
 .../Edge_collapse/Detail/Lindstrom_Turk_core.h     |     0
 .../Detail/Lindstrom_Turk_core_impl.h              |     0
 .../Policies/Edge_collapse/Edge_length_cost.h      |     0
 .../Policies/Edge_collapse/Edge_profile.h          |     0
 .../Policies/Edge_collapse/Edge_profile_impl.h     |     0
 .../Policies/Edge_collapse/LindstromTurk.h         |     0
 .../Policies/Edge_collapse/LindstromTurk_cost.h    |     0
 .../Policies/Edge_collapse/LindstromTurk_params.h  |     0
 .../Edge_collapse/LindstromTurk_placement.h        |     0
 .../Policies/Edge_collapse/Midpoint_and_length.h   |     0
 .../Policies/Edge_collapse/Midpoint_placement.h    |     0
 .../Surface_mesh_simplification/edge_collapse.h    |     0
 .../include/CGAL/Surface_mesh_traits_generator_3.h |     0
 .../CGAL/Surface_mesh_triangulation_generator_3.h  |     0
 .../include/CGAL/Surface_mesh_vertex_base_3.h      |     0
 .../include/CGAL/Surface_mesher/Combining_oracle.h |     0
 .../include/CGAL/Surface_mesher/Has_edges.h        |     0
 .../Surface_mesher/Implicit_surface_oracle_3.h     |     0
 .../Surface_mesher/Intersection_data_structure_3.h |     0
 .../CGAL/Surface_mesher/Null_oracle_visitor.h      |     0
 .../Point_surface_indices_oracle_visitor.h         |     0
 .../Poisson_implicit_surface_oracle_3.h            |     0
 .../CGAL/Surface_mesher/Polyhedral_oracle.h        |     0
 .../include/CGAL/Surface_mesher/Profile_counter.h  |     0
 .../include/CGAL/Surface_mesher/Profile_timer.h    |     0
 .../include/CGAL/Surface_mesher/Sphere_oracle_3.h  |     0
 .../CGAL/Surface_mesher/Standard_criteria.h        |     0
 .../include/CGAL/Surface_mesher/Surface_mesher.h   |     0
 .../Surface_mesher/Surface_mesher_edges_level.h    |     0
 .../Surface_mesher_edges_level_visitor.h           |     0
 .../CGAL/Surface_mesher/Surface_mesher_manifold.h  |     0
 .../Surface_mesher/Surface_mesher_regular_edges.h  |     0
 .../CGAL/Surface_mesher/Surface_mesher_visitor.h   |     0
 .../include/CGAL/Surface_mesher/Types_generators.h |     0
 .../include/CGAL/Surface_mesher/Verbose_flag.h     |     0
 .../Vertices_on_the_same_psc_element_criterion.h   |     0
 .../Vertices_on_the_same_surface_criterion.h       |     0
 .../include/CGAL/Surface_mesher_generator.h        |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Sweep_line_2.h |     0
 .../Sweep_line_2/Arr_basic_insertion_sl_visitor.h  |     0
 .../Sweep_line_2/Arr_basic_insertion_traits_2.h    |     0
 .../CGAL/Sweep_line_2/Arr_batched_pl_sl_visitor.h  |     0
 .../CGAL/Sweep_line_2/Arr_construction_event.h     |     0
 .../Sweep_line_2/Arr_construction_sl_visitor.h     |     0
 .../CGAL/Sweep_line_2/Arr_construction_subcurve.h  |     0
 .../Sweep_line_2/Arr_default_overlay_traits_base.h |     0
 .../CGAL/Sweep_line_2/Arr_insertion_sl_visitor.h   |     0
 .../CGAL/Sweep_line_2/Arr_insertion_traits_2.h     |     0
 .../CGAL/Sweep_line_2/Arr_overlay_sl_visitor.h     |     0
 .../CGAL/Sweep_line_2/Arr_overlay_subcurve.h       |     0
 .../CGAL/Sweep_line_2/Arr_overlay_traits_2.h       |     0
 .../CGAL/Sweep_line_2/Arr_vert_decomp_sl_visitor.h |     0
 .../CGAL/Sweep_line_2/Basic_sweep_line_2_impl.h    |     0
 .../include/CGAL/Sweep_line_2/Sweep_line_2_debug.h |     0
 .../include/CGAL/Sweep_line_2/Sweep_line_2_impl.h  |     0
 .../include/CGAL/Sweep_line_2/Sweep_line_2_utils.h |     0
 .../CGAL/Sweep_line_2/Sweep_line_2_visitors.h      |     0
 .../CGAL/Sweep_line_2/Sweep_line_curve_pair.h      |     0
 .../include/CGAL/Sweep_line_2/Sweep_line_event.h   |     0
 .../CGAL/Sweep_line_2/Sweep_line_functors.h        |     0
 .../CGAL/Sweep_line_2/Sweep_line_subcurve.h        |     0
 .../include/CGAL/Sweep_line_2_algorithms.h         |     0
 .../include/CGAL/Sweep_line_empty_visitor.h        |     0
 .../CGAL/TDS_full_cell_default_storage_policy.h    |     0
 .../CGAL/TDS_full_cell_mirror_storage_policy.h     |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Taucs_fix.h    |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Taucs_matrix.h |     0
 .../include/CGAL/Taucs_solver_traits.h             |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Taucs_vector.h |     0
 .../include/CGAL/Tetrahedron_3.h                   |     0
 .../Three/Polyhedron_demo_io_plugin_interface.h    |    62 +
 .../CGAL/Three/Polyhedron_demo_plugin_helper.h     |    95 +
 .../CGAL/Three/Polyhedron_demo_plugin_interface.h  |    63 +
 .../CGAL/include/CGAL/Three/Scene_draw_interface.h |    60 +
 .../CGAL/include/CGAL/Three/Scene_group_item.h     |   172 +
 3rdparty/CGAL/include/CGAL/Three/Scene_interface.h |   194 +
 3rdparty/CGAL/include/CGAL/Three/Scene_item.h      |   419 +
 .../include/CGAL/Three/Scene_item_config.h         |     0
 .../CGAL/Three/Scene_print_interface_item.h        |    41 +
 3rdparty/CGAL/include/CGAL/Three/TextRenderer.h    |   146 +
 .../include/CGAL/Three/Viewer_config.h             |     0
 .../CGAL/include/CGAL/Three/Viewer_interface.h     |   186 +
 .../{CGAL-4.8 => CGAL}/include/CGAL/Threetuple.h   |     0
 3rdparty/CGAL/include/CGAL/Time_stamper.h          |   103 +
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/Timer.h   |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Timer_impl.h   |     0
 .../include/CGAL/Tools/Counter.h                   |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Tools/Label.h  |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Tools/Log.h    |     0
 .../include/CGAL/Tools/Log_impl.h                  |     0
 .../include/CGAL/Tools/chained_map.h               |     0
 .../include/CGAL/Tools/utility_macros.h            |     0
 .../include/CGAL/Traits_with_offsets_adaptor.h     |     0
 .../include/CGAL/Transform_iterator.h              |     0
 .../include/CGAL/Tree_assertions.h                 |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Tree_base.h    |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Tree_traits.h  |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Triangle_2.h   |     0
 .../CGAL/Triangle_2_Iso_rectangle_2_intersection.h |     0
 .../include/CGAL/Triangle_2_Line_2_intersection.h  |     0
 .../include/CGAL/Triangle_2_Point_2_intersection.h |     0
 .../include/CGAL/Triangle_2_Ray_2_intersection.h   |     0
 .../CGAL/Triangle_2_Segment_2_intersection.h       |     0
 .../CGAL/Triangle_2_Triangle_2_do_intersect.h      |     0
 .../CGAL/Triangle_2_Triangle_2_intersection.h      |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Triangle_3.h   |     0
 .../include/CGAL/Triangle_3_Line_3_do_intersect.h  |     0
 .../include/CGAL/Triangle_3_Plane_3_do_intersect.h |     0
 .../include/CGAL/Triangle_3_Point_3_do_intersect.h |     0
 .../include/CGAL/Triangle_3_Ray_3_do_intersect.h   |     0
 .../CGAL/Triangle_3_Segment_3_do_intersect.h       |     0
 .../CGAL/Triangle_3_Tetrahedron_3_do_intersect.h   |     0
 .../CGAL/Triangle_3_Triangle_3_do_intersect.h      |     0
 .../CGAL/Triangle_3_Triangle_3_intersection.h      |     0
 .../include/CGAL/Triangle_accessor_3.h             |     0
 .../CGAL/Triangular_expansion_visibility_2.h       |     0
 .../include/CGAL/Triangular_field_2.h              |     0
 .../CGAL/Triangulated_mixed_complex_observer_3.h   |     0
 .../include/CGAL/Triangulation.h                   |     0
 .../include/CGAL/Triangulation_2.h                 |     0
 .../CGAL/Triangulation_2/insert_constraints.h      |   118 +
 .../Triangulation_2_filtered_projection_traits_3.h |    31 +
 .../CGAL/Triangulation_2_projection_traits_3.h     |    57 +
 .../include/CGAL/Triangulation_2_traits_3.h        |     0
 3rdparty/CGAL/include/CGAL/Triangulation_3.h       |  6691 +++++
 .../include/CGAL/Triangulation_cell_base_3.h       |     0
 .../Triangulation_cell_base_with_circumcenter_3.h  |     0
 .../CGAL/Triangulation_cell_base_with_info_3.h     |     0
 .../include/CGAL/Triangulation_conformer_2.h       |     0
 .../include/CGAL/Triangulation_data_structure.h    |     0
 .../include/CGAL/Triangulation_data_structure_2.h  |     0
 .../include/CGAL/Triangulation_data_structure_3.h  |  3974 +++
 .../Triangulation_data_structure_using_list_2.h    |     0
 .../CGAL/Triangulation_default_data_structure_2.h  |     0
 .../include/CGAL/Triangulation_ds_cell_base_3.h    |     0
 .../include/CGAL/Triangulation_ds_circulators_2.h  |     0
 .../include/CGAL/Triangulation_ds_face_2.h         |     0
 .../include/CGAL/Triangulation_ds_face_base_2.h    |     0
 .../include/CGAL/Triangulation_ds_full_cell.h      |     0
 .../include/CGAL/Triangulation_ds_iterators_2.h    |     0
 .../include/CGAL/Triangulation_ds_vertex.h         |     0
 .../include/CGAL/Triangulation_ds_vertex_2.h       |     0
 .../include/CGAL/Triangulation_ds_vertex_base_2.h  |     0
 .../include/CGAL/Triangulation_ds_vertex_base_3.h  |     0
 .../CGAL/Triangulation_euclidean_traits_2.h        |   136 +
 .../include/CGAL/Triangulation_face.h              |     0
 .../include/CGAL/Triangulation_face_base_2.h       |     0
 .../CGAL/Triangulation_face_base_with_info_2.h     |     0
 .../include/CGAL/Triangulation_full_cell.h         |     0
 .../include/CGAL/Triangulation_geom_traits_3.h     |     0
 .../include/CGAL/Triangulation_hierarchy_2.h       |     0
 .../CGAL/include/CGAL/Triangulation_hierarchy_3.h  |   844 +
 .../CGAL/Triangulation_hierarchy_vertex_base_2.h   |     0
 .../CGAL/Triangulation_hierarchy_vertex_base_3.h   |     0
 .../CGAL/Triangulation_incremental_builder_3.h     |     0
 .../CGAL/Triangulation_iterator_adaptator.h        |     0
 .../CGAL/Triangulation_line_face_circulator_2.h    |   698 +
 .../include/CGAL/Triangulation_simplex_3.h         |     0
 .../Triangulation_structural_filtering_traits.h    |     0
 .../include/CGAL/Triangulation_utils_2.h           |     0
 .../include/CGAL/Triangulation_utils_3.h           |     0
 .../include/CGAL/Triangulation_vertex.h            |     0
 .../include/CGAL/Triangulation_vertex_base_2.h     |     0
 .../include/CGAL/Triangulation_vertex_base_3.h     |     0
 .../CGAL/Triangulation_vertex_base_with_id_2.h     |     0
 .../CGAL/Triangulation_vertex_base_with_info_2.h   |     0
 .../CGAL/Triangulation_vertex_base_with_info_3.h   |     0
 .../include/CGAL/Trivial_iterator.h                |     0
 .../include/CGAL/Two_vertices_parameterizer_3.h    |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Twotuple.h     |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Umbilics.h     |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Uncertain.h    |     0
 .../include/CGAL/Unfiltered_predicate_adaptor.h    |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Union_find.h   |     0
 .../include/CGAL/Union_of_balls_3.h                |     0
 .../include/CGAL/Unique_hash_map.h                 |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Vector_2.h     |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/Vector_3.h     |     0
 .../CGAL/Vertex2Data_Property_Map_with_std_map.h   |     0
 .../include/CGAL/Visibility_2/visibility_utils.h   |     0
 .../include/CGAL/Voronoi_diagram_2.h               |     0
 .../include/CGAL/Voronoi_diagram_2/Accessor.h      |     0
 .../Voronoi_diagram_2/Adaptation_traits_base_2.h   |     0
 .../Voronoi_diagram_2/Adaptation_traits_functors.h |     0
 .../Apollonius_graph_degeneracy_testers.h          |     0
 .../Apollonius_graph_nearest_site_2.h              |     0
 .../Voronoi_diagram_2/Cached_degeneracy_testers.h  |     0
 .../CGAL/Voronoi_diagram_2/Circulator_adaptors.h   |     0
 .../CGAL/Voronoi_diagram_2/Connected_components.h  |     0
 .../CGAL/Voronoi_diagram_2/Construct_dual_points.h |     0
 .../Voronoi_diagram_2/Default_site_inserters.h     |     0
 .../CGAL/Voronoi_diagram_2/Default_site_removers.h |     0
 .../Voronoi_diagram_2/Degeneracy_tester_binders.h  |     0
 .../Delaunay_triangulation_degeneracy_testers.h    |     0
 .../Delaunay_triangulation_nearest_site_2.h        |     0
 .../CGAL/Voronoi_diagram_2/Dummy_iterator.h        |     0
 .../include/CGAL/Voronoi_diagram_2/Edge_less.h     |     0
 .../include/CGAL/Voronoi_diagram_2/Face.h          |     0
 .../CGAL/Voronoi_diagram_2/Finder_classes.h        |     0
 .../include/CGAL/Voronoi_diagram_2/Halfedge.h      |     0
 .../CGAL/Voronoi_diagram_2/Handle_adaptor.h        |     0
 .../CGAL/Voronoi_diagram_2/Identity_rejectors.h    |     0
 .../CGAL/Voronoi_diagram_2/Iterator_adaptors.h     |     0
 .../include/CGAL/Voronoi_diagram_2/Policy_base.h   |     0
 .../Regular_triangulation_degeneracy_testers.h     |     0
 .../Regular_triangulation_nearest_site_2.h         |     0
 .../Segment_Delaunay_graph_degeneracy_testers.h    |     0
 .../Segment_Delaunay_graph_nearest_site_2.h        |     0
 .../CGAL/Voronoi_diagram_2/Site_accessors.h        |     0
 .../CGAL/Voronoi_diagram_2/Unbounded_edges.h       |     0
 .../CGAL/Voronoi_diagram_2/Unbounded_faces.h       |     0
 .../CGAL/Voronoi_diagram_2/Validity_testers.h      |     0
 .../include/CGAL/Voronoi_diagram_2/Vertex.h        |     0
 .../include/CGAL/Voronoi_diagram_2/basic.h         |     0
 .../include/CGAL/Voronoi_intersection_2_traits_3.h |     0
 .../include/CGAL/Weighted_Minkowski_distance.h     |   415 +
 .../CGAL/Weighted_alpha_shape_euclidean_traits_2.h |     0
 .../CGAL/Weighted_alpha_shape_euclidean_traits_3.h |     0
 .../include/CGAL/Weighted_point.h                  |     0
 .../CGAL/Weighted_point_with_psc_localisation.h    |     0
 .../CGAL/Weighted_point_with_surface_index.h       |     0
 ...Weighted_point_with_surface_index_geom_traits.h |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/Width_3.h |     0
 .../include/CGAL/Width_default_traits_3.h          |     0
 .../include/CGAL/Width_polyhedron_3.h              |     0
 .../include/CGAL/Win32_exception.h                 |     0
 .../include/CGAL/aff_transformation_tags.h         |     0
 .../include/CGAL/aff_transformation_tags_impl.h    |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/algorithm.h    |     0
 .../include/CGAL/all_furthest_neighbors_2.h        |     0
 .../include/CGAL/apply_to_range.h                  |     0
 .../include/CGAL/approximated_offset_2.h           |     0
 .../include/CGAL/argument_swaps.h                  |     0
 .../include/CGAL/arrange_offset_polygons_2.h       |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/array.h   |     0
 3rdparty/CGAL/include/CGAL/assertions.h            |   359 +
 .../include/CGAL/assertions_behaviour.h            |     0
 .../include/CGAL/assertions_impl.h                 |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/atomic.h  |     0
 .../include/CGAL/auto_link/CGAL.h                  |     0
 .../include/CGAL/auto_link/CORE.h                  |     0
 .../include/CGAL/auto_link/ImageIO.h               |     0
 .../include/CGAL/auto_link/LAPACK.h                |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/auto_link/Qt.h |     0
 .../include/CGAL/auto_link/TAUCS.h                 |     0
 .../include/CGAL/auto_link/auto_link.h             |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/barycenter.h   |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/basic.h   |     0
 .../include/CGAL/basic_classes.h                   |     0
 .../include/CGAL/basic_constructions_2.h           |     0
 .../include/CGAL/basic_constructions_3.h           |     0
 .../include/CGAL/bbox_intersection_3.h             |     0
 .../CGAL/include/CGAL/bilateral_smooth_point_set.h |   629 +
 3rdparty/CGAL/include/CGAL/boost/graph/Dual.h      |   480 +
 .../include/CGAL/boost/graph/Euler_operations.h    |     0
 .../include/CGAL/boost/graph/Graph_geometry.h      |     0
 .../boost/graph/backward_compatibility_functions.h |     0
 .../include/CGAL/boost/graph/copy_face_graph.h     |   161 +
 .../CGAL/boost/graph/dijkstra_shortest_paths.h     |     0
 .../CGAL/boost/graph/dijkstra_shortest_paths.hpp   |     0
 .../include/CGAL/boost/graph/graph_concepts.h      |     0
 .../CGAL/boost/graph/graph_traits_Arrangement_2.h  |     0
 .../boost/graph/graph_traits_CombinatorialMap.h    |     0
 .../graph/graph_traits_Delaunay_triangulation_2.h  |   394 +
 .../boost/graph/graph_traits_Dual_Arrangement_2.h  |     0
 .../CGAL/boost/graph/graph_traits_HalfedgeDS.h     |   260 +
 .../graph/graph_traits_PolyMesh_ArrayKernelT.h     |   697 +
 .../CGAL/boost/graph/graph_traits_Polyhedron_3.h   |     0
 .../CGAL/boost/graph/graph_traits_Surface_mesh.h   |     0
 .../graph/graph_traits_TriMesh_ArrayKernelT.h      |   616 +
 .../boost/graph/graph_traits_Triangulation_2.h     |   872 +
 .../CGAL/boost/graph/halfedge_graph_traits.h       |     0
 .../boost/graph/halfedge_graph_traits_HalfedgeDS.h |     0
 .../graph/halfedge_graph_traits_Polyhedron_3.h     |     0
 .../include/CGAL/boost/graph/helpers.h             |     0
 .../CGAL/boost/graph/internal/Has_member_clear.h   |     0
 .../graph/internal/OM_iterator_from_circulator.h   |     0
 .../include/CGAL/boost/graph/internal/helpers.h    |     0
 .../include/CGAL/boost/graph/iterator.h            |     0
 .../CGAL/boost/graph/named_function_params.h       |     0
 .../include/CGAL/boost/graph/properties.h          |     0
 .../CGAL/boost/graph/properties_CombinatorialMap.h |   279 +
 .../boost/graph/properties_PolyMesh_ArrayKernelT.h |     0
 .../CGAL/boost/graph/properties_Polyhedron_3.h     |   443 +
 .../CGAL/boost/graph/properties_Surface_mesh.h     |   324 +
 .../boost/graph/properties_TriMesh_ArrayKernelT.h  |     0
 .../include/CGAL/boost/graph/selection.h           |     0
 .../CGAL/boost/graph/split_graph_into_polylines.h  |     0
 .../include/CGAL/boost/graph/visitor.h             |     0
 .../CGAL/boost/iterator/counting_iterator.hpp      |     0
 .../CGAL/boost/iterator/transform_iterator.hpp     |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/bounding_box.h |     0
 .../include/CGAL/box_intersection_d.h              |     0
 .../CGAL/cartesian_homogeneous_conversion.h        |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/centroid.h     |     0
 .../include/CGAL/certified_numeric_predicates.h    |     0
 .../include/CGAL/certified_quotient_predicates.h   |     0
 .../include/CGAL/ch_akl_toussaint.h                |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/ch_bykat.h     |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/ch_eddy.h |     0
 .../include/CGAL/ch_function_objects_2.h           |     0
 .../include/CGAL/ch_graham_andrew.h                |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/ch_jarvis.h    |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/ch_melkman.h   |     0
 .../include/CGAL/ch_selected_extreme_points_2.h    |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/circulator.h   |     0
 .../include/CGAL/circulator_bases.h                |     0
 .../include/CGAL/compare_vertices.h                |     0
 .../CGAL/include/CGAL/compute_average_spacing.h    |   258 +
 .../include/CGAL/compute_outer_frame_margin.h      |     0
 3rdparty/CGAL/include/CGAL/config.h                |   536 +
 .../include/CGAL/connect_holes.h                   |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/constant.h     |     0
 .../CGAL/constructions/Polygon_offset_cons_ftC2.h  |     0
 .../constructions/Straight_skeleton_cons_ftC2.h    |     0
 ...ctions_for_voronoi_intersection_cartesian_2_3.h |     0
 .../constructions_on_weighted_points_cartesian_3.h |     0
 .../include/CGAL/constructions/kernel_ftC2.h       |     0
 .../include/CGAL/constructions/kernel_ftC3.h       |     0
 ...squared_radius_smallest_orthogonalcircle_ftC2.h |     0
 .../include/CGAL/constructions_d.h                 |     0
 .../constructions_on_weighted_points_cartesian_2.h |     0
 ...onstructions_on_weighted_points_homogeneous_2.h |     0
 .../include/CGAL/convert_to_bfi.h                  |     0
 .../include/CGAL/convex_decomposition_3.h          |     0
 .../include/CGAL/convex_hull_2.h                   |     0
 .../include/CGAL/convex_hull_3.h                   |     0
 .../include/CGAL/convex_hull_3_to_polyhedron_3.h   |     0
 .../CGAL/convex_hull_constructive_traits_2.h       |     0
 .../include/CGAL/convex_hull_incremental_3.h       |     0
 .../include/CGAL/convex_hull_traits_2.h            |     0
 .../include/CGAL/convexity_check_2.h               |     0
 .../include/CGAL/convexity_check_3.h               |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/copy_n.h  |     0
 .../CGAL/include/CGAL/corefinement_operations.h    |   477 +
 .../include/CGAL/create_offset_polygons_2.h        |     0
 ...ate_offset_polygons_from_polygon_with_holes_2.h |     0
 .../include/CGAL/create_straight_skeleton_2.h      |     0
 ...e_straight_skeleton_from_polygon_with_holes_2.h |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/determinant.h  |     0
 .../include/CGAL/determinant_of_vectors.h          |     0
 .../include/CGAL/distance_predicates_2.h           |     0
 .../include/CGAL/distance_predicates_3.h           |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/double.h  |     0
 .../include/CGAL/edge_aware_upsample_point_set.h   |   648 +
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/enum.h    |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/envelope_2.h   |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/envelope_3.h   |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/exceptions.h   |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/export/CGAL.h  |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/export/CORE.h  |     0
 .../include/CGAL/export/ImageIO.h                  |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/export/Qt.h    |     0
 .../include/CGAL/export/helpers.h                  |     0
 .../include/CGAL/extended_euclidean_algorithm.h    |     0
 .../CGAL/extract_mean_curvature_flow_skeleton.h    |    66 +
 .../include/CGAL/extremal_polygon_2.h              |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/exude_mesh_3.h |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/float.h   |     0
 .../include/CGAL/function_objects.h                |     0
 .../include/CGAL/functions_on_enums.h              |     0
 .../include/CGAL/functions_on_signs.h              |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/generators.h   |     0
 .../include/CGAL/generic_sweep.h                   |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/gl.h      |     0
 .../CGAL/global_functions_circular_kernel_2.h      |     0
 .../CGAL/global_functions_on_root_for_sphere_2_3.h |     0
 ...global_functions_on_roots_and_polynomials_1_3.h |     0
 ...global_functions_on_roots_and_polynomials_2_3.h |     0
 .../CGAL/global_functions_spherical_kernel_3.h     |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/glu.h     |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/gmp.h     |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/gmpxx.h   |     0
 .../include/CGAL/gmpxx_coercion_traits.h           |     0
 3rdparty/CGAL/include/CGAL/gnuplot_output_2.h      |   246 +
 .../{CGAL-4.8 => CGAL}/include/CGAL/grabbers.h     |     0
 .../include/CGAL/graph_traits_Arrangement_2.h      |     0
 .../include/CGAL/graph_traits_Dual_Arrangement_2.h |     0
 .../CGAL/include/CGAL/grid_simplify_point_set.h    |   222 +
 .../include/CGAL/halfedgeDS_cut_component.h        |     0
 .../include/CGAL/halfedgeds_connected_components.h |     0
 3rdparty/CGAL/include/CGAL/hash_openmesh.h         |   115 +
 .../include/CGAL/hierarchy_simplify_point_set.h    |   364 +
 .../{CGAL-4.8 => CGAL}/include/CGAL/hilbert_sort.h |     0
 .../include/CGAL/hilbert_sort_on_sphere.h          |     0
 .../include/CGAL/in_place_edge_list.h              |     0
 3rdparty/CGAL/include/CGAL/int.h                   |   293 +
 .../CGAL/internal/AABB_tree/AABB_drawing_traits.h  |     0
 .../include/CGAL/internal/AABB_tree/AABB_node.h    |   202 +
 .../internal/AABB_tree/AABB_ray_intersection.h     |   244 +
 .../CGAL/internal/AABB_tree/AABB_search_tree.h     |     0
 .../internal/AABB_tree/AABB_traversal_traits.h     |     0
 .../Halfedge_and_face_graph_property_maps.h        |   201 +
 .../AABB_tree/Has_nested_type_Shared_data.h        |     0
 .../AABB_tree/Is_ray_intersection_geomtraits.h     |    52 +
 .../CGAL/internal/AABB_tree/Primitive_helper.h     |     0
 .../internal/AABB_tree/nearest_point_segment_3.h   |     0
 .../internal/AABB_tree/nearest_point_triangle_3.h  |     0
 .../CGAL/internal/AFSR/Surface_face_base_2.h       |     0
 .../CGAL/internal/AFSR/Surface_vertex_base_2.h     |     0
 .../CGAL/internal/AFSR/construct_polyhedron.h      |     0
 .../CGAL/internal/AFSR/construct_surface_2.h       |     0
 .../include/CGAL/internal/AFSR/orient.h            |     0
 .../CGAL/internal/AFSR/write_triple_indices.h      |     0
 .../include/CGAL/internal/Classification_type.h    |     0
 .../include/CGAL/internal/Combination_enumerator.h |     0
 .../internal/Combinatorial_map_copy_functors.h     |     0
 .../internal/Combinatorial_map_group_functors.h    |  1033 +
 .../internal/Combinatorial_map_internal_functors.h |     0
 .../CGAL/internal/Combinatorial_map_sewable.h      |     0
 .../CGAL/internal/Combinatorial_map_utility.h      |     0
 .../Combinatorial_map_utility_novariadic.h         |     0
 .../internal/Delaunay_triangulation_hierarchy_3.h  |     0
 .../include/CGAL/internal/Dummy_tds_3.h            |     0
 .../include/CGAL/internal/Exact_type_selector.h    |     0
 .../include/CGAL/internal/Get_dimension_tag.h      |     0
 .../CGAL/include/CGAL/internal/Has_boolean_tags.h  |    82 +
 .../Intersections_3/Bbox_3_Bbox_3_do_intersect.h   |     0
 .../Intersections_3/Bbox_3_Line_3_do_intersect.h   |     0
 .../Intersections_3/Bbox_3_Plane_3_do_intersect.h  |     0
 .../Intersections_3/Bbox_3_Ray_3_do_intersect.h    |     0
 .../Bbox_3_Segment_3_do_intersect.h                |     0
 .../Intersections_3/Bbox_3_Sphere_3_do_intersect.h |     0
 .../Bbox_3_Triangle_3_do_intersect.h               |     0
 .../Triangle_3_Line_3_intersection.h               |     0
 .../Triangle_3_Ray_3_intersection.h                |     0
 .../Triangle_3_Segment_3_intersection.h            |     0
 .../include/CGAL/internal/K_neighbor_search.h      |     0
 .../include/CGAL/internal/Lazy_alpha_nt_2.h        |     0
 .../include/CGAL/internal/Lazy_alpha_nt_3.h        |     0
 ...domain_of_complex_3_in_triangulation_3_to_off.h |     0
 .../CGAL/internal/Mesh_3/Graph_manipulations.h     |   115 +
 .../internal/Mesh_3/Handle_IO_for_pair_of_int.h    |    84 +
 .../include/CGAL/internal/Mesh_3/check_weights.h   |     0
 .../CGAL/include/CGAL/internal/Mesh_3/get_index.h  |   171 +
 ...ic_3_Delaunay_triangulation_filtered_traits_3.h |   167 +
 ...ay_triangulation_statically_filtered_traits_3.h |    62 +
 .../Periodic_3_triangulation_filtered_traits_3.h   |   210 +
 .../Periodic_3_triangulation_remove_traits_3.h     |     0
 ..._3_triangulation_statically_filtered_traits_3.h |     0
 .../CGAL/internal/Polyhedron_plane_clipping_3.h    |   432 +
 .../include/CGAL/internal/Projection_traits_3.h    |     0
 .../Regular_triangulation_filtered_traits_3.h      |     0
 .../include/CGAL/internal/Rich_grid.h              |     0
 .../include/CGAL/internal/Static_filters/Angle_3.h |     0
 .../Static_filters/Compare_squared_radius_3.h      |     0
 .../Compare_weighted_squared_radius_3.h            |     0
 .../CGAL/internal/Static_filters/Compare_x_2.h     |   103 +
 .../CGAL/internal/Static_filters/Compare_y_2.h     |   103 +
 .../internal/Static_filters/Compare_y_at_x_2.h     |     0
 .../Static_filters/Coplanar_orientation_3.h        |     0
 .../Coplanar_side_of_bounded_circle_3.h            |     0
 .../CGAL/internal/Static_filters/Do_intersect_3.h  |     0
 .../include/CGAL/internal/Static_filters/Equal_2.h |   108 +
 .../include/CGAL/internal/Static_filters/Equal_3.h |     0
 .../CGAL/internal/Static_filters/Is_degenerate_3.h |     0
 .../CGAL/internal/Static_filters/Orientation_2.h   |     0
 .../CGAL/internal/Static_filters/Orientation_3.h   |     0
 .../Static_filters/Periodic_2_orientation_2.h      |     0
 .../Periodic_2_side_of_oriented_circle_2.h         |     0
 .../Static_filters/Periodic_3_orientation_3.h      |   273 +
 .../Periodic_3_side_of_oriented_sphere_3.h         |   306 +
 .../CGAL/internal/Static_filters/Power_test_3.h    |     0
 ...Regular_triangulation_static_filters_traits_3.h |     0
 .../Static_filters/Side_of_oriented_circle_2.h     |     0
 .../Static_filters/Side_of_oriented_sphere_3.h     |     0
 .../internal/Static_filters/Static_filter_error.h  |     0
 .../CGAL/internal/Static_filters/Static_filters.h  |   329 +
 .../include/CGAL/internal/Static_filters/tools.h   |   209 +
 .../CGAL/internal/Static_or_dynamic_array.h        |     0
 .../Spokes_and_rims_iterator.h                     |     0
 .../Surface_mesh_segmentation/AABB_traits.h        |     0
 .../AABB_traversal_traits.h                        |    77 +
 .../Alpha_expansion_graph_cut.h                    |     0
 .../Surface_mesh_segmentation/Disk_samplers.h      |     0
 .../Expectation_maximization.h                     |     0
 .../internal/Surface_mesh_segmentation/Filters.h   |     0
 .../Surface_mesh_segmentation/K_means_clustering.h |     0
 .../Surface_mesh_segmentation/SDF_calculation.h    |   584 +
 .../Surface_mesh_segmentation.h                    |   548 +
 .../Surface_mesh_skeletonization/Curve_skeleton.h  |     0
 .../internal/Surface_mesh_skeletonization/Debug.h  |     0
 .../Detect_degeneracy.h                            |     0
 .../CGAL/internal/Transform_coordinates_traits_3.h |     0
 .../CGAL/internal/Triangulation/Dummy_TDS.h        |     0
 .../Triangulation/Triangulation_ds_iterators.h     |     0
 .../CGAL/internal/Triangulation/utilities.h        |     0
 .../Triangulation_2_filtered_projection_traits_3.h |    85 +
 .../Triangulation_2_projection_traits_base_3.h     |   486 +
 .../CGAL/internal/Triangulation_ds_circulators_3.h |     0
 .../CGAL/internal/Triangulation_ds_iterators_3.h   |     0
 .../Voronoi_covariance_3/voronoi_covariance_3.h    |   231 +
 .../voronoi_covariance_sphere_3.h                  |     0
 .../include/CGAL/internal/auxiliary/graph.h        |     0
 .../CGAL/internal/boost/array_binary_tree.hpp      |     0
 .../include/CGAL/internal/boost/mutable_heap.hpp   |     0
 .../include/CGAL/internal/boost/mutable_queue.hpp  |   153 +
 .../include/CGAL/internal/bounded_priority_queue.h |     0
 .../include/CGAL/internal/container_fwd_fixed.hpp  |     0
 .../Combinatorial_map_for_corefinement.h           |   113 +
 .../corefinement/Polyhedron_constness_types.h      |     0
 .../intersection_coplanar_triangles_3.h            |     0
 .../corefinement/intersection_triangle_segment_3.h |     0
 .../intersection_triangle_segment_3_coplanar.h     |     0
 .../include/CGAL/internal/deprecation_warning.h    |     0
 .../include/CGAL/internal/info_check.h             |     0
 .../include/CGAL/interpolation_functions.h         |     0
 .../include/CGAL/intersection_2.h                  |     0
 .../include/CGAL/intersection_2_1.h                |     0
 .../include/CGAL/intersection_2_2.h                |     0
 .../include/CGAL/intersection_2_3.h                |     0
 .../include/CGAL/intersection_3.h                  |     0
 .../include/CGAL/intersection_3_1.h                |     0
 .../include/CGAL/intersection_of_Polyhedra_3.h     |  2106 ++
 ...ntersection_of_Polyhedra_3_refinement_visitor.h |  2260 ++
 .../include/CGAL/intersections.h                   |     0
 .../include/CGAL/intersections_d.h                 |     0
 3rdparty/CGAL/include/CGAL/ipower.h                |    83 +
 .../include/CGAL/is_convertible.h                  |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/is_iterator.h  |     0
 .../include/CGAL/is_streamable.h                   |     0
 .../include/CGAL/is_y_monotone_2.h                 |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/iterator.h     |     0
 .../include/CGAL/iterator_from_indices.h           |     0
 3rdparty/CGAL/include/CGAL/jet_estimate_normals.h  |   339 +
 3rdparty/CGAL/include/CGAL/jet_smooth_point_set.h  |   323 +
 .../include/CGAL/kernel_assertions.h               |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/kernel_basic.h |     0
 .../include/CGAL/kernel_config.h                   |     0
 3rdparty/CGAL/include/CGAL/kernel_to_kernel.h      |   111 +
 .../include/CGAL/known_bit_size_integers.h         |     0
 3rdparty/CGAL/include/CGAL/leda_bigfloat.h         |   157 +
 .../CGAL/include/CGAL/leda_bigfloat_interval.h     |   488 +
 3rdparty/CGAL/include/CGAL/leda_coercion_traits.h  |   114 +
 3rdparty/CGAL/include/CGAL/leda_integer.h          |   265 +
 3rdparty/CGAL/include/CGAL/leda_rational.h         |   282 +
 3rdparty/CGAL/include/CGAL/leda_real.h             |   231 +
 .../include/CGAL/linear_least_squares_fitting_2.h  |     0
 .../include/CGAL/linear_least_squares_fitting_3.h  |     0
 .../CGAL/linear_least_squares_fitting_circles_2.h  |     0
 .../CGAL/linear_least_squares_fitting_cuboids_3.h  |     0
 .../CGAL/linear_least_squares_fitting_points_2.h   |     0
 .../CGAL/linear_least_squares_fitting_points_3.h   |     0
 .../linear_least_squares_fitting_rectangles_2.h    |     0
 .../CGAL/linear_least_squares_fitting_segments_2.h |     0
 .../CGAL/linear_least_squares_fitting_segments_3.h |     0
 .../CGAL/linear_least_squares_fitting_spheres_3.h  |     0
 .../linear_least_squares_fitting_tetrahedra_3.h    |     0
 .../linear_least_squares_fitting_triangles_2.h     |     0
 .../linear_least_squares_fitting_triangles_3.h     |     0
 .../include/CGAL/lloyd_optimize_mesh_2.h           |     0
 .../include/CGAL/lloyd_optimize_mesh_3.h           |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/long_double.h  |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/long_long.h    |     0
 3rdparty/CGAL/include/CGAL/make_mesh_3.h           |   453 +
 .../CGAL/make_piecewise_smooth_surface_mesh.h      |     0
 .../include/CGAL/make_skin_surface_mesh_3.h        |     0
 .../include/CGAL/make_surface_mesh.h               |     0
 .../include/CGAL/make_union_of_balls_3.h           |     0
 .../include/CGAL/marching_tetrahedra_3.h           |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/memory.h  |     0
 3rdparty/CGAL/include/CGAL/mesh_segmentation.h     |   491 +
 .../include/CGAL/mesh_skin_surface_3.h             |     0
 .../include/CGAL/mesh_union_of_balls_3.h           |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/min_max_n.h    |     0
 .../include/CGAL/min_quadrilateral_2.h             |     0
 .../CGAL/minimum_enclosing_quadrilateral_2.h       |     0
 3rdparty/CGAL/include/CGAL/minkowski_sum_2.h       |  1103 +
 .../include/CGAL/minkowski_sum_3.h                 |     0
 .../include/CGAL/monotone_matrix_search.h          |     0
 .../include/CGAL/more_functions_on_signs.h         |     0
 .../include/CGAL/mpfi_coercion_traits.h            |     0
 .../include/CGAL/mpfr_coercion_traits.h            |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/mpq_class.h    |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/mpz_class.h    |     0
 3rdparty/CGAL/include/CGAL/mst_orient_normals.h    |   672 +
 .../include/CGAL/multiset_assertions.h             |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/mutex.h   |     0
 .../include/CGAL/natural_neighbor_coordinates_2.h  |     0
 .../include/CGAL/natural_neighbor_coordinates_3.h  |     0
 .../include/CGAL/nearest_neighbor_delaunay_2.h     |     0
 .../include/CGAL/normal_vector_newell_3.h          |     0
 .../include/CGAL/number_type_basic.h               |     0
 .../include/CGAL/number_type_config.h              |     0
 3rdparty/CGAL/include/CGAL/number_utils.h          |   335 +
 .../include/CGAL/number_utils_classes.h            |     0
 .../include/CGAL/odt_optimize_mesh_3.h             |     0
 .../include/CGAL/offset_polygon_2.h                |     0
 .../include/CGAL/optimize_mesh_3.h                 |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/parameterize.h |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/partition_2.h  |     0
 .../include/CGAL/partition_is_valid_2.h            |     0
 3rdparty/CGAL/include/CGAL/pca_estimate_normals.h  |   294 +
 .../include/CGAL/periodic_3_triangulation_3_io.h   |     0
 .../include/CGAL/perturb_mesh_3.h                  |     0
 .../include/CGAL/pierce_rectangles_2.h             |     0
 3rdparty/CGAL/include/CGAL/point_generators_2.h    |   547 +
 3rdparty/CGAL/include/CGAL/point_generators_3.h    |   309 +
 .../include/CGAL/point_generators_d.h              |     0
 .../include/CGAL/point_set_processing_assertions.h |     0
 .../include/CGAL/poisson_refine_triangulation.h    |     0
 .../include/CGAL/polygon_function_objects.h        |     0
 .../include/CGAL/polygon_mesh_processing.h         |     0
 .../include/CGAL/polyhedron_cut_plane_3.h          |     0
 .../include/CGAL/polynomial_utils.h                |     0
 .../CGAL/predicates/Polygon_offset_pred_ftC2.h     |     0
 .../CGAL/predicates/Regular_triangulation_ftC2.h   |     0
 .../CGAL/predicates/Regular_triangulation_ftC3.h   |     0
 .../CGAL/predicates/Regular_triangulation_rtH2.h   |     0
 .../CGAL/predicates/Regular_triangulation_rtH3.h   |     0
 .../CGAL/predicates/Straight_skeleton_pred_ftC2.h  |     0
 .../predicates/in_smallest_orthogonalcircle_ftC2.h |     0
 .../include/CGAL/predicates/kernel_ftC2.h          |     0
 .../include/CGAL/predicates/kernel_ftC3.h          |     0
 .../predicates/predicates_for_mixed_complex_3.h    |     0
 ...icates_for_voronoi_intersection_cartesian_2_3.h |     0
 .../predicates_on_weighted_points_cartesian_3.h    |     0
 .../include/CGAL/predicates/sign_of_determinant.h  |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/predicates_d.h |     0
 .../include/CGAL/predicates_on_lines_2.h           |     0
 .../include/CGAL/predicates_on_points_2.h          |     0
 .../include/CGAL/predicates_on_points_3.h          |     0
 3rdparty/CGAL/include/CGAL/primes.h                |   332 +
 3rdparty/CGAL/include/CGAL/property_map.h          |   353 +
 3rdparty/CGAL/include/CGAL/radial_orient_normals.h |   180 +
 .../include/CGAL/random_convex_hull_in_disc_2.h    |     0
 .../include/CGAL/random_convex_set_2.h             |     0
 .../include/CGAL/random_polygon_2.h                |     0
 .../include/CGAL/random_selection.h                |     0
 .../CGAL/include/CGAL/random_simplify_point_set.h  |   119 +
 .../include/CGAL/range_search_delaunay_2.h         |     0
 .../include/CGAL/rational_rotation.h               |     0
 .../include/CGAL/read_vtk_image_data.h             |     0
 .../include/CGAL/rectangular_3_center_2.h          |     0
 .../include/CGAL/rectangular_p_center_2.h          |     0
 3rdparty/CGAL/include/CGAL/refine_mesh_3.h         |   504 +
 .../include/CGAL/regular_neighbor_coordinates_2.h  |     0
 3rdparty/CGAL/include/CGAL/regularize_planes.h     |   771 +
 .../include/CGAL/remove_far_points_in_mesh_3.h     |     0
 3rdparty/CGAL/include/CGAL/remove_outliers.h       |   242 +
 .../include/CGAL/representation_tags.h             |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/result_of.h    |     0
 .../include/CGAL/segment_intersection_points_2.h   |     0
 .../include/CGAL/sibson_gradient_fitting.h         |     0
 .../include/CGAL/simple_transformations_d.h        |     0
 .../include/CGAL/simplest_rational_in_interval.h   |     0
 .../include/CGAL/sorted_matrix_search.h            |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/spatial_sort.h |     0
 .../include/CGAL/spatial_sort_on_sphere.h          |     0
 .../include/CGAL/squared_distance_2.h              |     0
 .../include/CGAL/squared_distance_2_1.h            |     0
 .../include/CGAL/squared_distance_2_2.h            |     0
 .../include/CGAL/squared_distance_3.h              |     0
 .../include/CGAL/squared_distance_3_0.h            |     0
 3rdparty/CGAL/include/CGAL/squared_distance_3_1.h  |  1015 +
 3rdparty/CGAL/include/CGAL/squared_distance_3_2.h  |   404 +
 .../include/CGAL/squared_distance_utils.h          |     0
 3rdparty/CGAL/include/CGAL/sse2.h                  |    36 +
 .../include/CGAL/streamlines_assertions.h          |     0
 .../include/CGAL/subdivide_skin_surface_mesh_3.h   |     0
 .../include/CGAL/subdivide_union_of_balls_mesh_3.h |     0
 .../surface_mesh_parameterization_assertions.h     |     0
 .../include/CGAL/surface_neighbor_coordinates_3.h  |     0
 .../include/CGAL/surface_neighbors_3.h             |     0
 .../surface_reconstruction_points_assertions.h     |     0
 .../include/CGAL/sweep_observer.h                  |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/tags.h    |     0
 .../include/CGAL/test_FPU_rounding_mode_impl.h     |    79 +
 .../{CGAL-4.8 => CGAL}/include/CGAL/to_rational.h  |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/trace.h   |     0
 .../include/CGAL/transforming_iterator.h           |     0
 .../include/CGAL/transforming_pair_iterator.h      |     0
 .../include/CGAL/triangulate_mixed_complex_3.h     |     0
 .../include/CGAL/triangulate_power_diagram_3.h     |     0
 .../include/CGAL/triangulation_assertions.h        |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/tss.h     |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/tuple.h   |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/type_traits.h  |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/typeset.h |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/use.h     |     0
 .../{CGAL-4.8 => CGAL}/include/CGAL/user_classes.h |     0
 3rdparty/CGAL/include/CGAL/utility.h               |   363 +
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/utils.h   |     0
 .../include/CGAL/utils_classes.h                   |     0
 3rdparty/CGAL/include/CGAL/value_type_traits.h     |    66 +
 .../include/CGAL/vcm_estimate_edges.h              |     0
 .../include/CGAL/vcm_estimate_normals.h            |     0
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/vector.h  |     0
 3rdparty/CGAL/include/CGAL/version.h               |    35 +
 .../include/CGAL/version_macros.h                  |     0
 .../include/CGAL/vtkSurfaceMesherContourFilter.h   |     0
 .../include/CGAL/width_assertions.h                |     0
 .../CGAL/wlop_simplify_and_regularize_point_set.h  |   695 +
 3rdparty/{CGAL-4.8 => CGAL}/include/CGAL/wmult.h   |     0
 3rdparty/CGAL/scripts/cgal_create_CMakeLists       |   629 +
 .../scripts/cgal_create_assertions.sh              |     0
 .../scripts/cgal_create_cmake_script               |     0
 .../scripts/cgal_make_macosx_app                   |     0
 .../src/CGAL/Bbox_2_intersections.cpp              |     0
 3rdparty/CGAL/src/CGAL/CMakeLists.txt              |    19 +
 3rdparty/{CGAL-4.8 => CGAL}/src/CGAL/Color.cpp     |     0
 .../src/CGAL/File_header_OFF.cpp                   |     0
 .../src/CGAL/File_header_extended_OFF.cpp          |     0
 .../src/CGAL/File_scanner_OFF.cpp                  |     0
 .../src/CGAL/File_writer_OFF.cpp                   |     0
 .../src/CGAL/File_writer_VRML_2.cpp                |     0
 .../src/CGAL/File_writer_inventor.cpp              |     0
 .../src/CGAL/File_writer_wavefront.cpp             |     0
 .../src/CGAL/Geomview_stream.cpp                   |     0
 .../src/CGAL/Interval_arithmetic.cpp               |     0
 .../src/CGAL/JAMA_numeric_solver.cpp               |     0
 3rdparty/{CGAL-4.8 => CGAL}/src/CGAL/KDS_Log.cpp   |     0
 .../{CGAL-4.8 => CGAL}/src/CGAL/NefPolynomial.cpp  |     0
 3rdparty/CGAL/src/CGAL/Random.cpp                  |    36 +
 .../{CGAL-4.8 => CGAL}/src/CGAL/Real_timer.cpp     |     0
 .../{CGAL-4.8 => CGAL}/src/CGAL/Residue_type.cpp   |     0
 3rdparty/{CGAL-4.8 => CGAL}/src/CGAL/Timer.cpp     |     0
 .../src/CGAL/Turkowski_numeric_solver.cpp          |     0
 .../{CGAL-4.8 => CGAL}/src/CGAL/assertions.cpp     |     0
 3rdparty/{CGAL-4.8 => CGAL}/src/CGAL/io.cpp        |     0
 3rdparty/{CGAL-4.8 => CGAL}/src/CGAL/kernel.cpp    |     0
 .../src/CGAL/numeric_solvers_support.cpp           |     0
 .../src/CGAL/test_FPU_rounding_mode.cpp            |     0
 .../{CGAL-4.8 => CGAL}/src/CGAL_Core/BigFloat.cpp  |     0
 3rdparty/CGAL/src/CGAL_Core/CMakeLists.txt         |    24 +
 .../{CGAL-4.8 => CGAL}/src/CGAL_Core/CoreAux.cpp   |     0
 .../{CGAL-4.8 => CGAL}/src/CGAL_Core/CoreDefs.cpp  |     0
 .../{CGAL-4.8 => CGAL}/src/CGAL_Core/CoreIO.cpp    |     0
 3rdparty/{CGAL-4.8 => CGAL}/src/CGAL_Core/Expr.cpp |     0
 .../{CGAL-4.8 => CGAL}/src/CGAL_Core/GmpIO.cpp     |     0
 3rdparty/{CGAL-4.8 => CGAL}/src/CGAL_Core/Real.cpp |     0
 .../{CGAL-4.8 => CGAL}/src/CGAL_Core/extLong.cpp   |     0
 3rdparty/CGAL/src/CGAL_ImageIO/CMakeLists.txt      |    52 +
 .../src/CGAL_ImageIO/ImageIO.cpp                   |     0
 .../src/CGAL_ImageIO/Image_3.cpp                   |     0
 .../{CGAL-4.8 => CGAL}/src/CGAL_ImageIO/LICENSE    |     0
 3rdparty/CGAL/src/CGAL_ImageIO/analyze.cpp         |    27 +
 3rdparty/CGAL/src/CGAL_ImageIO/bmp.cpp             |    27 +
 3rdparty/CGAL/src/CGAL_ImageIO/bmpendian.cpp       |    27 +
 3rdparty/CGAL/src/CGAL_ImageIO/bmpread.cpp         |    27 +
 3rdparty/CGAL/src/CGAL_ImageIO/convert.cpp         |    27 +
 3rdparty/CGAL/src/CGAL_ImageIO/fgetns.cpp          |    27 +
 3rdparty/CGAL/src/CGAL_ImageIO/gif.cpp             |    27 +
 3rdparty/CGAL/src/CGAL_ImageIO/gis.cpp             |    27 +
 3rdparty/CGAL/src/CGAL_ImageIO/inr.cpp             |    27 +
 3rdparty/CGAL/src/CGAL_ImageIO/iris.cpp            |    27 +
 3rdparty/CGAL/src/CGAL_ImageIO/mincio.cpp          |    27 +
 3rdparty/CGAL/src/CGAL_ImageIO/pnm.cpp             |    27 +
 3rdparty/CGAL/src/CGAL_ImageIO/recbuffer.cpp       |    27 +
 3rdparty/CGAL/src/CGAL_ImageIO/recline.cpp         |    27 +
 3rdparty/CGAL/src/CGAL_ImageIO/reech4x4.cpp        |    27 +
 3rdparty/CGAL/src/CGAL_Qt5/CMakeLists.txt          |   110 +
 .../src/CGAL_Qt5/DemosMainWindow.cpp               |     0
 .../CGAL/src/CGAL_Qt5/GraphicsView.qtmoc.cmake     |     8 +
 .../src/CGAL_Qt5/GraphicsViewNavigation.cpp        |     0
 .../src/CGAL_Qt5/GraphicsViewPolylineInput.cpp     |     0
 3rdparty/{CGAL-4.8 => CGAL}/src/CGAL_Qt5/debug.cpp |     0
 .../{CGAL-4.8 => CGAL}/src/CGAL_Qt5/resources.cpp  |     0
 .../{CGAL-4.8 => CGAL}/src/CGAL_Qt5/utility.cpp    |     0
 .../{CGAL-4.8 => CGAL}/src/CGAL_libs_verinfo.rc.in |     0
 3rdparty/CGAL/src/CMakeLists.txt                   |   217 +
 3rdparty/CMakeLists.txt                            |    12 +-
 3rdparty/cgal-version.txt                          |     1 +
 3rdparty/cgal.patch                                |    35 +
 CMakeLists.txt                                     |    32 +-
 ChangeLog                                          |     3 +
 app/mshrable.cpp                                   |     4 +-
 doc/sphinx/Makefile                                |   216 +
 doc/sphinx/README                                  |    20 +
 doc/sphinx/source/conf.py                          |   291 +
 doc/sphinx/source/index.rst                        |    24 +
 include/mshr/ASCFileReader.h                       |    47 +
 include/mshr/CSGCGALDomain2D.h                     |     5 +-
 include/mshr/CSGCGALDomain3D.h                     |    24 +-
 include/mshr/CSGCGALMeshGenerator2D.h              |    24 +-
 include/mshr/CSGGeometry.h                         |     2 +-
 include/mshr/CSGPrimitives2D.h                     |    10 +-
 include/mshr/DolfinMeshUtils.h                     |    13 +-
 include/mshr/MeshGenerator.h                       |     2 +-
 include/mshr/STLFileReader.h                       |     5 +-
 include/mshr/SurfaceConsistency.h                  |     9 +-
 include/mshr/SurfaceReconstruction.h               |    10 +-
 include/mshr/VTPFileReader.h                       |     6 +-
 src/ASCFileReader.cpp                              |   173 +
 src/CSGCGALDomain2D.cpp                            |   102 +-
 src/CSGCGALDomain3D.cpp                            |   388 +-
 src/CSGCGALMeshGenerator2D.cpp                     |    84 +-
 src/CSGCGALMeshGenerator3D.cpp                     |    56 +-
 src/CSGOperators.cpp                               |     8 +-
 src/CSGPrimitives2D.cpp                            |    14 +-
 src/DolfinMeshUtils.cpp                            |    46 +-
 src/GlobalInitializer.cpp                          |     1 +
 src/MeshGenerator.cpp                              |    63 +-
 src/Meshes.cpp                                     |     2 +-
 src/Polyhedron_utils.h                             |  1721 +-
 src/STLFileReader.cpp                              |    58 +-
 src/SurfaceConsistency.cpp                         |    70 +-
 src/SurfaceReconstruction.cpp                      |   125 +-
 src/TetgenMeshGenerator3D.cpp                      |    13 +-
 src/VTPFileReader.cpp                              |    61 +-
 src/meshclean.h                                    |    25 +-
 test/CMakeLists.txt                                |    23 +-
 test/test-ASCFileReader.py                         |    23 +
 6172 files changed, 327479 insertions(+), 283889 deletions(-)

diff --git a/3rdparty/CGAL-4.8/CHANGES b/3rdparty/CGAL-4.8/CHANGES
deleted file mode 100644
index 0a7c233..0000000
--- a/3rdparty/CGAL-4.8/CHANGES
+++ /dev/null
@@ -1,4448 +0,0 @@
-
--------------------------------- Release 4.8 --------------------------------
-
-Release date: April 2016
-
-
-* General
-
-  - The support for Qt3 is dropped and all demos using it got removed.
-
-
-* Installation
-
-  - Starting with Visual C++ 2015 we no longer require Boost.Thread as we use
-    the C++11 keyword thread_local and the C+11 class std::mutex .
-
-  - The same holds for g++ 4.8 or later when the C++11 standard is used.
-
-
-* Optimal Transportation Curve Reconstruction (new package)
-
-  - This package implements a method to reconstruct and simplify 2D point sets.
-    The input is a set of 2D points with mass attributes, possibly hampered by
-    noise and outliers. The output is a set of line segments and isolated
-    points which approximate the input points.
-
-
-* 2D Regularized Boolean Set-Operations
-
-  - Improve the performance of operations in some settings.
-    Breaking change: This improvement requires changes of the face and halfedge
-    type of the underlying arrangement Dcel. See the concepts
-    GeneralPolygonSetDcelHalfedge and GeneralPolygonSetDcelFace for more
-    details. If you use a different simplex types, inheriting your simplices
-    from CGAL::Gps_face_base and CGAL::Gps_halfedge_base is sufficient to
-    accommodate for the update.
-
-
-* 3D Boolean Operations on Nef Polyhedra
-
-  - Add 3 new constructors: from a point range, from a point, and from a
-    segment.
-
-
-* Combinatorial Maps
-
-  - Breaking change: Change the type of Boolean marks, old type is int, new
-    type is size_type. If no more mark is available, get_new_mark throws an
-    exception, instead of returning -1.
-
-
-* 2D Arrangements
-
-  - Speed up the edge removal in case the incident faces contains many holes.
-
-  - Set the format of polylines and polycurves. The format of a general
-    polyline or polycurve consists of the sequence of subcurves that comprise
-    the original curve. The format of a polyline of linear segments consists of
-    the sequence of points that define the original curve. (The latter restores
-    the format used before polycurves were introduced in 4.7.) Fix the
-    extraction from istream and insertion into ostream operators of polylines
-    and polycurves accordingly.
-
-  - Fix the traits class that handles Bezier curves. In particular, fix the
-    case where the curve is closed (i.e, the first and last control points
-    coincide).
-
-
-* 3D Mesh Generation
-
-  - Add support of 3D gray level images as input for the tetrahedral mesh
-    generation.
-
-  - Breaking change: All models of the concept MeshDomain_3 must now provide a
-    member function bbox().
-
-
-* Advancing Front Surface Reconstruction
-
-  - Optional template functor Filter is replaced by another optional template
-    functor Priority. This allows to change the way facets are prioritized by
-    the algorithm instead of having a simple option to reject some facets.
-    Breaking change: Programs using the old Filter API will not compile anymore
-    as it must be replaced with the Priority API as described in the manual.
-    Codes using the default behavior are not impacted.
-
-
-* Polygon Mesh Processing
-
-  - Add a new triangle-based isotropic remeshing algorithm for triangulated
-    surface meshes, CGAL::Polygon_mesh_processing::isotropic_remeshing() and a
-    helper function for isotropic remeshing : CGAL::Polygon_mesh_processing::
-    split_long_edges()
-
-  - Add the function CGAL::Polygon_mesh_processing::border_halfedges() to
-    collect the border of a given face range
-
-  - Add the function CGAL::Polygon_mesh_processing::remove_isolated_vertices()
-    to be used on any polygon mesh
-
-  - Add the function CGAL::Polygon_mesh_processing::triangulate_face() to
-    triangulate a single face of a polygon mesh
-
-  - Add an overload for CGAL::Polygon_mesh_processing::triangulate_faces() to
-    triangulate a range of faces of a polygon mesh
-
-  - Add function keep_large_connected_components()
-
-  - Add measuring functions for polygon meshes, to compute length, area, and
-    volume of simplices or group of simplices of a polygon mesh.
-
-  - Add function bbox_3() to compute the bounding box of a polygon mesh.
-
-
-* Surface Mesh Parameterization
-
-  - LSCM_parameterizer_3 now uses by default Eigen instead of OpenNL as a model
-    of SparseLinearAlgebraTraits_d.
-
-
-* Point Set Processing
-
-  - Breaking change: new template parameter Concurrency_tag for the functions
-    compute_average_spacing(), edge_aware_upsample_point_set(),
-    jet_estimate_normals(), jet_smooth_point_set(), and pca_estimate_normals().
-    To update your code simply add as first template parameter CGAL::
-    Sequential_tag or CGAL::Parallel_tag when calling one of these functions.
-
-  - CGAL::Parallel_tag can no longer be used in Point Set Processing algorithms
-    if TBB is not available.
-
-  - Add a new simplification algorithm based on hierarchical clustering: CGAL::
-    hierarchy_simplify_point_set(). It allows either to uniformly simplify the
-    point set or to automatically adapt the local density of points to the
-    local variation of the input computed by principal component analysis.
-
-  - New IO functions for PLY format (Polygon File Format): CGAL::
-    read_ply_points(), CGAL::read_ply_points_and_normals(), CGAL::
-    write_ply_points() and CGAL::write_ply_points_and_normals().
-
-
-* Surface Mesh Parameterization
-
-  - LSCM_parameterizer_3 now uses by default Eigen instead of OpenNL as a model
-    of SparseLinearAlgebraTraits_d.
-
-
-* Spatial Searching
-
-  - Add function to find any point in a range query, that is neither all
-    points, nor the closest one.
-
-
-* Principal Component Analysis
-
-  - Add a template parameter DiagonalizeTraits for functions CGAL::
-    linear_least_squares_fitting_2() and CGAL::linear_least_squares_fitting_3
-    (). This allows to either choose the legacy internal diagonalization code
-    from CGAL or the Eigen implementation (or any class that is a model of
-    DiagonalizeTraits). Variants of the function that automatically deduce the
-    kernel also automatically select the diagonalizer, so the API is mostly
-    preserved.
-
-
-* CGAL and Solvers
-
-  - This package now includes all CGAL concepts for solvers with models using
-    the third party Eigen library.
-
-
-* CGAL and the Boost Graph Library (BGL)
-
-  - Add function CGAL::split_graph_into_polylines() that allows to extract from
-    a soup of segments given as a graph, polylines with nodes of degree at most
-    2. In addition a functor can be passed to the function to specify
-    additional polyline endpoints.
-
-  - New functions to manipulate selection of faces, edges and vertices in a
-    halfedge graph are added: CGAL::expand_face_selection(), CGAL::
-    reduce_face_selection(), CGAL::expand_edge_selection(), CGAL::
-    reduce_edge_selection() CGAL::expand_vertex_selection(), CGAL::
-    reduce_vertex_selection() and CGAL::select_incident_faces().
-
-  - Add a helper function CGAL::clear which clears a MutableFaceGraph
-    efficiently and generically.
-
-
-
-
--------------------------------- Release 4.7 --------------------------------
-
-Release date: October 2015
-
-
-* Installation
-
-  - The minimum required version of CMake is now 2.8.11. CMake versions 3.1,
-    3.2, and 3.3 are supported.
-
-  - All Qt4 demos have been updated and now require Qt5 to be compiled. Qt5
-    version 5.3 or higher is required. The support for Qt4 is dropped. To
-    compile libCGAL_Qt5 and demos, you must set the cmake or environment
-    variable Qt5_DIR to point to the path to the directory containing the file
-    Qt5Config.cmake created by your Qt5 installation. If you are using the open
-    source edition it should be /path-to/qt-everywhere-opensource-src-
-    <version>/qtbase/lib/cmake/Qt5.
-
-  - The code of the 3D demos now uses modern OpenGL, with shaders, instead of
-    the fixed pipeline API of OpenGL-1.
-
-  - The Microsoft Windows Visual C++ compiler 2015 (VC14) is now supported.
-    However, since this compiler is not officially supported by Intel TBB 4.4
-    and Qt 5.5 (the latest versions available at the time of this release), the
-    parallelism features of CGAL and Qt5 demos will not work.
-
-
-* L Infinity Segment Delaunay Graphs (new package)
-
-  - The package provides the geometric traits for constructing the segment
-    Delaunay graph in the max-norm (L Infinity). The traits also contain
-    methods to draw the edges of the dual of the segment Delaunay graph in the
-    max-norm i.e., the segment Voronoi diagram in the max-norm. The algorithm
-    and traits rely on the segment Delaunay graph algorithm and traits under
-    the Euclidean distance. The segment Voronoi diagram in the max-norm has
-    applications in VLSI CAD.
-
-
-* Advancing Front Surface Reconstruction (new package)
-
-  - This package provides a greedy algorithm for surface reconstruction from an
-    unorganized point set. Starting from a seed facet, a piecewise linear
-    surface is grown by adding Delaunay triangles one by one. The most
-    plausible triangles are added first, in a way that avoids the appearance of
-    topological singularities.
-
-
-* Triangulated Surface Mesh Shortest Paths (new package)
-
-  - The package provides methods for computing shortest path on triangulated
-    surface meshes. Given a set of source points on the surface, this package
-    provides a data structure that can efficiently provides the shortest path
-    from any point on the surface to the sources points. There is no
-    restriction on the genus or the number of connected components of the mesh.
-
-
-* Triangulated Surface Mesh Skeletonization (new package)
-
-  - This package provides a (1D) curve skeleton extraction algorithm for a
-    triangulated polygonal mesh without borders based on the mean curvature
-    flow. The particularity of this skeleton is that it captures the topology
-    of the input. For each skeleton vertex one can obtain its location and its
-    corresponding vertices from the input mesh. The code is generic and works
-    with any model of the `FaceListGraph` concept.
-
-
-* 3D Point-Set Shape Detection (new package)
-
-  - This package implements the efficient RANSAC method for shape detection,
-    contributed by Schnabel et al. From an unstructured point set with
-    unoriented normals, the algorithm detects a set of shapes. Five types of
-    primitive shapes are provided by this package: plane, sphere, cylinder,
-    cone and torus. Detecting other types of shapes is possible by implementing
-    a class derived from a base shape.
-
-
-* 2D Visibility (new package)
-
-  - This package provides several variants to compute the visibility area of a
-    point within polygonal regions in two dimensions.
-
-
-* Polygon Mesh Processing (new package)
-
-  - This package implements a collection of methods and classes for polygon
-    mesh processing, ranging from basic operations on simplices, to complex
-    geometry processing algorithms. The implementation of this package mainly
-    follows algorithms and references given in Botsch et al.'s book on polygon
-    mesh processing.
-
-
-* General
-
-  - Support for unordered sets and maps of the stdlib and of boost for handle
-    and index classes.
-
-
-
-
-* Approximation of Ridges and Umbilics on Triangulated Surface Meshes
-
-  - This package now supports any model of the concept FaceGraph.
-
-  - Breaking change: The package no longer supports models of
-    TriangulatedSurfaceMesh which are not at the same time models of the
-    concept FaceGraph.
-
-
-* dD Geometry Kernel
-
-  - Epick_d gains 3 new functors: Construct_circumcenter_d,
-    Compute_squared_radius_d, Side_of_bounded_sphere_d. Those are essential for
-    the computation of alpha-shapes.
-
-
-* 2D Arrangements
-
-  - Introduced a new traits class, called
-    Arr_polycurve_traits_2<SubcurveTraits>, which handles general piece-wise
-    (polycurve) curves. The pieces do not necessarily have to be linear.
-
-  - Introduced two new concepts called ArrangementApproximateTraits_2 and
-    ArrangementConstructXMonotoneCurveTraits_2.
-
-      - The existing ArrangementLandmarkTraits_2 concept, which has two
-        requirements, now refines the two respective concepts above.
-
-      - The template parameter of the existing
-        Arr_polyline_traits_2<SegmentTraits> template must be substituted with
-        a traits class that is a model of the
-        ArrangementConstructXMonotoneTraits_2 concept among the other when
-        Arr_polyline_traits_2 is instantiated.
-
-
-
-* 2D Minkowski Sums
-
-  - Added support for polygons with holes and optimized the construction of
-    Minkowski sums.
-
-      - Introduced an implementation of the "reduced convolution" method, a
-        variant of the method described in "2D Minkowski Sum of Polygons Using
-        Reduced Convolution" by Behar and Lien. The new method supports
-        polygons with holes and in many cases out pergorms the implementation
-        of the exsisting (full) convolution method.
-
-      - Introduced two new classes that decompose polygons into convex pieces
-        (models of the PolygonConvexDecomposition_2 concept) based on vertical
-        decomposition and constrained Delaunay triangulation, respectively.
-        These new models also support the convex decomposition of polygons with
-        holes.
-
-
-
-* 3D Periodic Triangulations
-
-  - Rename Periodic_3_triangulation_traits_3 to
-    Periodic_3_Delaunay_triangulation_traits_3.
-
-  - Rename the concept Periodic_3TriangulationTraits_3 to
-    Periodic_3DelaunayTriangulationTraits_3.
-
-  - Create Periodic_3_triangulation_traits_3 and the concept
-    Periodic_3TriangulationTraits_3.
-
-
-* 2D Conforming Triangulations and Meshes
-
-  - Add an optimization method CGAL::lloyd_optimize_mesh_2() that implements
-    the Lloyd (or Centroidal Voronoi Tesselation) optimization algorithm in a
-    Constrained Delaunay Triangulation. For optimization, the triangulation
-    data structure on which the mesher relies needs its VertexBase template
-    parameter to be a model of the new concept DelaunayMeshVertexBase_2.
-
-
-* Point Set Processing and Surface Reconstruction from Point Sets
-
-  - Add the function CGAL::compute_vcm() for computing the Voronoi Covariance
-    Measure (VCM) of a point set. The output of this function can be used with
-    the function CGAL::vcm_is_on_feature_edge() to determine whether a point is
-    on or close to a feature edge. The former function is also internally used
-    by CGAL::vcm_estimate_normals() to estimate the normals of a point set and
-    it is particularly suited to point sets with noise.
-
-
-* Spatial Sorting
-
-  - Add the possibility to sort points on a sphere along a space-filling curve
-    using the functions CGAL::hilbert_sort_on_sphere and CGAL::
-    spatial_sort_on_sphere.
-
-
-* Geometric Object Generators
-
-  - Add new random generator of points in a 2D and 3D triangle and in a
-    tetrahedron (CGAL::Random_points_in_triangle_2, CGAL::
-    Random_points_in_triangle_3, CGAL::Random_points_in_tetrahedron_3).
-
-
--------------------------------- Release 4.6.2 --------------------------------
-
-Release date: August 2015
-
-This release only fixes bugs. See the list of fixed bugs on Github:
-
-https://github.com/CGAL/cgal/issues?q=milestone%3A4.6.2
-
-
--------------------------------- Release 4.6.1 --------------------------------
-
-Release date: June 2015
-
-This release only fixes bugs. See the list of fixed bugs on Github:
-
-https://github.com/CGAL/cgal/issues?q=milestone%3A4.6.1+-label%3Ainvalid
-
-
--------------------------------- Release 4.6 --------------------------------
-
-Release date: April 2015
-
-
-* Installation
-
-  - The required version of Boost is now 1.48 or higher.
-
-
-* 2D Polyline Simplification (new package)
-
-  - This package enables to simplify polylines with the guarantee that the
-    topology of the polylines does not change. This can be done for a single
-    polyline as well as for a set of polyline constraints in a constrained
-    triangulation. The simplification can be controlled with cost and stop
-    functions.
-
-
-* 2D Generalized Barycentric Coordinates (new package)
-
-  - This package offers an efficient and robust implementation of two-
-    dimensional closed-form generalized barycentric coordinates defined for
-    simple two-dimensional polygons.
-
-
-* Scale-Space Surface Reconstruction (new package)
-
-  - This new package provides a class gathering a dedicated smoothing algorithm
-    and some convenience functions to help the creation of a surface out of a
-    point set using the 3D Alpha Shapes package. The particularity of this
-    reconstruction pipeline is that the input point are in the output and no
-    new points are created. Note that in the current version, the output is a
-    triangle soup that is not necessarily a valid (manifold) polyhedral
-    surface.
-
-
-* Surface Mesh (new package)
-
-  - The surface mesh class provided by this package is an implementation of the
-    halfedge data structure allowing to represent polyhedral surfaces. It is an
-    alternative to the packages CGAL::Polyhedron_3 and CGAL::HalfedgeDS.
-
-
-* dD Triangulation (new package)
-
-  - This new package provides classes for manipulating triangulations in
-    Euclidean spaces whose dimension can be specified at compile-time or at
-    run-time. It also provides a class that represents Delaunay triangulations.
-
-
-* dD Convex Hulls and Delaunay Triangulations
-
-  - This package is deprecated and the new package Triangulation should be used
-    instead.
-
-
-
-
-* dD Geometry Kernel
-
-  - It has been reported that the recently introduced Epick_d kernel may not
-    work with Intel C++ Compiler prior to version 15. Documentation has been
-    updated.
-
-
-* 3D Convex Hulls
-
-  - Add functions halfspace_intersection_3 and
-    halfspace_intersection_with_constructions_3 to compute the intersection of
-    halfspaces defining a closed polyhedron.
-
-  - Fix a bug introduced in CGAL 4.5 that can appear while computing the convex
-    hull of coplanar points.
-
-  - Fix a robustness issue in Convex_hull_traits_3. This traits is used by
-    default with the kernel Exact_predicates_inexact_constructions_kernel.
-
-  - The function CGAL::convex_hull_incremental_3 is deprecated and the function
-    convex_hull_3 should be used instead.
-
-
-
-
-* Combinatorial Maps and Linear Cell Complex
-
-  - Added correct_invalid_attributes, set_automatic_attributes_management and
-    are_attributes_automatically_managed methods in CombinatorialMap concept.
-    This allows high level operations to not update non void attributes during
-    massive calls of these operations, but only after the end of their
-    executions.
-
-
-
-
-* 2D Triangulations
-
-  - The class Constrained_triangulation_plus_2 now can handle polylines as
-    constraints.
-
-  - As a consequence a Constraint_id has been introduced which replaces
-    pair<Vertex_handle,Vertex_handle> as identifier of a constraint.
-
-
-
-
-* 3D Mesh Generation
-
-  - Add member functions output_boundary_to_off and
-    output_facets_in_complex_to_off in the class CGAL::
-    Mesh_complex_3_in_triangulation_3 to export the boundary of a domain or a
-    subdomain.
-
-
-
-
-* 3D Fast Intersection and Distance Computation
-
-  - Add new constructors to AABB_halfedge_graph_segment_primitive and
-    AABB_face_graph_triangle_primitive in order to be able to build primitives
-    one by one.
-
-
-* Spatial Searching
-
-  - Fixed a bug in CGAL::Splitters.h sliding midpoint rule, where degenerated
-    point sets (e.g.,points on segment) caused the kd-tree to get linear.
-
-  - Improved performance of Orthogonal_k_neighbor_search. Note that VC 2013
-    does not compile boost::container::deque of Boost 1_55 and does hence have
-    a workaround which does not have the improvement.
-
-  - Breaking change: The concept OrthogonalDistance has new function overloads
-    for min_distance_to_rectangle and max_distance_to_rectangle with an
-    additional reference parameter std::vector.
-
-  - Breaking change: The order of the points in the iterator range [tree.begin
-    (),tree.end()] is not the order of insertion of the points into the tree.
-    This was not guaranteed before but might have been observed and exploited
-    by users.
-
-  - Derived kd_tree_leaf_node and kd_tree_internal_node from kd_tree_node to
-    save memory.
-
-
-
-
-* Geometric Object Generators
-
-  - Add a new function random_convex_hull_in_disc_2 that efficiently generates
-    a random polygon as the convex hull of uniform random points chosen in a
-    disc.
-
-
--------------------------------- Release 4.5.2 --------------------------------
-
-Release date: February 2015
-
-
-* General
-
-  - Fix a bug that prevented the compilation with recent versions of Boost
-    (>=1.56) when explicit conversions operators (from C++11) are supported.
-    That prevented the compilation with Microsoft Visual Studio 2013.
-
-
-* 3D Convex Hulls
-
-  - Fix a non-robust predicate bug that was showing up when input points where
-    lexicographically sorted.
-
-
-* 3D Mesh Generation
-
-  - Fix a bug in the sliver perturbation optimization method. It could create
-    some holes on the surface of the mesh.
-
-
--------------------------------- Release 4.5.1 --------------------------------
-
-Release date: December 2014
-
-
-* 3D Mesh Generation
-
-  - Fix a bug in the sliver exudation preservation of boundaries.
-
-
--------------------------------- Release 4.5 --------------------------------
-
-Release date: October 2014
-
-
-* Installation
-
-  - Changes in the set of supported platforms:
-
-      - The Microsoft Windows Visual C++ compiler 2008 (VC9) is no longer
-        supported since CGAL-4.5.
-
-
-  - Since CGAL version 4.0, Eigen was the recommended third-party library to
-    use with Planar Parameterization of Triangulated Surface Meshes, Surface
-    Reconstruction from Point Sets, Approximation of Ridges and Umbilics on
-    Triangulated Surface Meshes, and Estimation of Local Differential
-    Properties of Point-Sampled Surfaces packages. From CGAL version 4.5,
-    Taucs, Blas and Lapack are no longer supported.
-
-  - CGAL is now compatible with the new CMake version 3.0.
-
-
-* Triangulated Surface Mesh Deformation (new package)
-
-  - This package allows to deform a triangulated surface mesh under positional
-    constraints of some of its vertices without requiring any additional
-    structure other than the surface mesh itself. The methods provided
-    implements an as-rigid-as-possible deformation. Note that the main class
-    name has changed between the 4.5-beta1 and the 4.5 releases to better match
-    the CGAL naming conventions (from CGAL::Deform_mesh to CGAL::
-    Surface_mesh_deformation).
-
-
-* CGAL and the Boost Graph Library (major changes)
-
-  - Cleanup of the HalfedgeGraph concept. In particular:
-
-      - Introduction of the notion of halfedge_descriptor in the specialization
-        of the class boost::graph_traits.
-
-      - Deprecation of halfedge_graph_traits.
-
-      - A model of HalfedgeGraph is considered as an undirected graph. Thus any
-        call to edges() should be replaced by halfedges() and num_edges() now
-        returns the number of (undirected) edges.
-
-      - Breaking change: is_border_edge and is_border_halfedge properties are
-        removed. The free functions is_border() and is_border_edge() should be
-        used instead.
-
-      - Renaming of HalfedgeGraph specific free functions.
-
-
-  - Introduction of the FaceGraph concept.
-
-  - Adaptation of the package Triangulated Surface Mesh Simplification and of
-    the class AABB_halfedge_graph_segment_primitive from the package 3D Fast
-    Intersection and Distance Computation to the API change.
-
-  - Update of the package Triangulated Surface Mesh Segmentation and of the
-    class AABB_face_graph_triangle_primitive from the package 3D Fast
-    Intersection and Distance Computation to accept model of the newly
-    introduced concepts.
-
-  - Offer Euler operations as free functions for models of the graph concepts
-    provided by CGAL.
-
-  - Specialization of boost::graph_traits for OpenMesh::PolyMesh_ArrayKernelT
-    as proof of concept. A OpenMesh::PolyMesh_ArrayKernelT becomes a model of
-    the aforementioned concepts when including CGAL/boost/graph/
-    graph_traits_PolyMesh_ArrayKernelT.h.
-
-
-* dD Geometry Kernel
-
-  - A new model Epick_d of the Kernel_d concept is introduced. It provides
-    better performance through arithmetic filtering and specializations for
-    fixed dimensions. It may not work with compilers as old as gcc-4.2, but was
-    tested with gcc-4.4.
-
-
-* 3D Convex Hulls
-
-  - Clean up the documentation of the concepts
-
-
-* 2D Arrangements
-
-  - Fixed a bug in removing an unbounded curve (e.g., a ray) from an
-    arrangement induced by unbounded curves.
-
-
-* 2D Snap Rounding
-
-  - Replaced use of private kd_tree with CGAL's official Kd_tree from
-    Spatial_searching package; results in a small performance gain. Removed the
-    private kd_tree package.
-
-
-* 3D Triangulations
-
-  - Add an experimental parallel version of the Delaunay triangulation and the
-    regular triangulation algorithms, which allows parallel insertion and
-    removal of point ranges.
-
-  - Add caching of circumcenters to Regular_triangulation_cell_base_3. The
-    cache value is computed when cell->circumcenter() or rt.dual(cell)
-    functions are called.
-
-
-* 3D Periodic Triangulations
-
-  - Add a method to locate point with inexact predicates.
-
-
-* 3D Mesh Generation
-
-  - Add a new constructor for the class Labeled_mesh_domain_3 which takes an
-    Iso_cuboid_3.
-
-  - Add a new labeling function wrapper for meshing multi-domain.
-
-  - The meshing functionality in the Qt demos in demo/Polyhedron/ and demo/
-    Mesh_3/ can now use the handling of 1d-features, that exists in CGAL since
-    version 3.8.
-
-  - Add an experimental parallel version of the 3D mesh refinement and mesh
-    optimization methods.
-
-
-* Point Set Processing and Surface Reconstruction from Point Sets
-
-  - The former demo has been removed and is fully merge in the Polyhedron demo.
-
-
-* Point Set Processing
-
-  - Workaround a bug in dijsktra shortest path of boost 1.54 by shipping and
-    using the boost header from the 1.55 release. This header will be used only
-    if you are using the version 1.54 of boost.
-
-
-* Triangulated Surface Mesh Simplification
-
-  - Breaking change: Due to the cleanup of the concepts of the package CGAL and
-    the Boost Graph Library, the named parameter edge_is_border_map has been
-    removed, and the named parameter edge_is_constrained_map now expects a
-    property map with an edge descriptor as key type (vs. halfedge descriptor
-    before).
-
-  - Add some optimization in the code making the implementation faster
-    (depending on the cost and the placement chosen). However, for an edge
-    which collapse is not topologically valid, the vector of vertices of the
-    link provided by its profile might contains duplicates, thus also breaking
-    the orientation guarantee in the vector. This must not be a problem for
-    users as the edge is not collapsible anyway but if it is a absolute
-    requirement for user defined cost/placement, defining the macro
-    CGAL_SMS_EDGE_PROFILE_ALWAYS_NEED_UNIQUE_VERTEX_IN_LINK will restore the
-    former behavior.
-
-
-* dD Spatial Searching
-
-  - Added methods reserve(size_t size) and size_t capacity() to class Kd_tree
-    to allocate memory to store size points and to report that number (STL
-    compliance).
-
-
-* STL Extensions for CGAL
-
-  - Add Compact_container::operator[], allowing a direct access to the ith
-    element of a compact container.
-
-  - Add Concurrent_compact_container, a compact container which allows
-    concurrent insertion and removal.
-
-
--------------------------------- Release 4.4 --------------------------------
-
-Release date: April 2014
-
-
-* Installation
-
-  - Additional supported platforms:
-
-      - The Apple Clang compiler version 5.0 is now supported on
-        OS X Mavericks.
-
-      - The Microsoft Windows Visual C++ compiler 2013 (VC12) is now supported.
-
-
-
-* Triangulated Surface Mesh Segmentation (new package)
-
-  - This package implements the segmentation of triangulated surface meshes
-    based on the Shape Diameter Function (SDF). In addition, it also provides
-    functions to generate segmentations based on a user defined alternative to
-    the SDF.
-
-
-* Number Types
-
-  - A new class CGAL::Mpzf is introduced on some platforms for exact ring
-    operations. It is used to improve the speed of the evaluation of predicates
-    in degenerate situations.
-
-
-* 2D and 3D Geometry Kernel
-
-  - Fix a bug introduced in CGAL 4.3 when computing the intersection of two 3D
-    triangles.
-
-
-* 2D Polygon Partitioning
-
-  - Bug fix to make the partition algorithms working with a Lazy kernel such as
-    Exact_predicates_exact_constructions_kernel.
-
-
-* 2D Regularized Boolean Set-Operations
-
-  - Fix two memory leaks in CGAL::General_polygon_set_2.
-
-
-* Combinatorial Maps and Linear Cell Complex
-
-  - null_dart_handle is no longer a static data member in the CombinatorialMap
-    concept. This implies to move the following methods of Dart concept into
-    CombinatorialMap concept: is_free, highest_nonfree_dimension, opposite and
-    other_extremity. We also transform the static methods vertex_attribute and
-    point of Linear_cell_complex class into non static methods. You can define
-    the CGAL_CMAP_DEPRECATED macro to keep the old behavior.
-
-
-* 2D Arrangements
-
-  - Revise the API of polylines. In particular, construction is now done using
-    functors and iteration is possible only on the segments of a polyline.
-
-  - Fix a bug in the Landmark point-location strategy.
-
-
-* 2D Snap Rounding
-
-  - Fix a memory leak
-
-
-* 2D Triangulations
-
-  - Add different overloads of the function insert_constraints that inserts a
-    range of points and segments, or a range of segments. These functions uses
-    the spatial sorting in order to speed up the time needed for the insertion.
-
-
-* 3D Alpha Shapes
-
-  - Add member functions in CGAL::Alpha_shape_3 to give access to the alpha
-    status of edges and facets (get_alpha_status()).
-
-  - Add another filtration method (filtration_with_alpha_values()) that reports
-    the alpha value at which each face appears in the filtration.
-
-
-* 3D Mesh Generation
-
-  - Fix the access to functions number_of_facets and number_of_cells in
-    Mesh_complex_3_in_triangulation_3.
-
-  - Change the internal API of the sliver perturber, to make possible for
-    developers to optimize another criterion than the (default) minimal
-    dihedral angle. Developers can also define a new perturbation vector (for
-    angles we had gradient of squared circumradius, gradient of volume,
-    gradient of minimal dihedral angle, and random) which is better suitable to
-    optimize their criterion.
-
-  - Improve the use of cache values in Mesh_cell_base_3 to (re)compute
-    circumcenters and sliver criterion values only when needed.
-
-
-* Triangulated Surface Mesh Simplification
-
-  - Fix a bug in the way edges can be marked as non-removable by adding a
-    named-parameter edge_is_constrained_map to the function edge_collapse
-
-
-* dD Spatial Searching
-
-  - Fix a documentation bug: The property map passed as template parameter to
-    the classes Search_traits_adapter and Distance_adapter must be a lvalue
-    property map. To avoid incorrect usage, a static assertion has been added
-    in the CGAL code to prevent the user from instantiating these classes with
-    an incorrect property map type.
-
-
-* CGAL ipelets
-
-  - Better description of the demo ipelets in the user manual
-
-  - New ipelet for pencils of circles
-
-  - New ipelet for hyperbolic geometry in Poincaré model
-
-  - The generator ipelet now generates point in a selected zone
-
-  - Hilbert sort ipelet implements two policies
-
-
--------------------------------- Release 4.3 --------------------------------
-
-Release date: October 2013
-
-
-* The CGAL Manual
-
-  - The documentation of CGAL is now generated with Doxygen.
-
-
-* 2D Periodic Triangulations (new package)
-
-  - This package allows to build and handle triangulations of point sets in the
-    two dimensional flat torus. Triangulations are built incrementally and can
-    be modified by insertion or removal of vertices. They offer point location
-    facilities. The package provides Delaunay triangulations and offers nearest
-    neighbor queries and primitives to build the dual Voronoi diagrams.
-
-
-* API Changes
-
- ** 2D and 3D Geometry Kernel
-
-  - The intersection functions and functors used to return a CGAL::Object in
-    order to deal with the different possible return types. However, depending
-    on the arguments it is possible to reduce the possible return types to a
-    small set. For this reason and to take advantage of the type safety, we
-    decided to use boost::variant instead of CGAL::Object. The result_of
-    protocol is now even more useful to determine the return type of the
-    intersection functions and functors. The change should be relatively
-    transparent to the user thanks to the implicit constructor added to CGAL::
-    Object. However, it is recommended to upgrade your code. The previous
-    behavior can be restored by defining the macro CGAL_INTERSECTION_VERSION
-    to 1.
-
-
- ** 2D Arrangements
-
-  - The type of the result of point location queries changed to boost::variant
-    (from CGAL::Object). For convenience, the previous behavior can be restored
-    by defining the macro CGAL_ARR_POINT_LOCATION_VERSION to 1.
-
-  - Introduced an optimization for operations on large and dense arrangements.
-
-
- ** 3D Fast Intersection and Distance Computation
-
-  - Following the intersection API change, Object_and_primitive_id has been
-    replaced by a template class Intersection_and_primitive_id<Query> to
-    determine the type depending on the query object type.
-
-
- ** CGAL and Boost Property Maps
-
-  - The key_type of the property maps provided by CGAL used to be an iterator.
-    In order to be more easily re-used, the key_type has been changed to be the
-    value_type of the iterator. The packages that have been updated to match
-    these changes are Point Set Processing and Surface Reconstruction from
-    Point Sets. However, for most users this change should be transparent if
-    the default property maps were used. For convenience, the former behavior
-    can be enabled by defining the macro CGAL_USE_PROPERTY_MAPS_API_V1.
-
-
-* Algebraic Foundations
-
-  - For convenience, add an overload of make_rational() taking a pair of
-    numbers.
-
-
-* 2D and 3D Geometry Kernel
-
-  - A Iso_rectangle_2 can now be constructed from a Bbox_2 and an Iso_cuboid_3
-    from a Bbox_3.
-
-  - The implementation of CGAL::Object has been updated and now uses boost::
-    shared_ptr and boost::any. This implementation is faster.
-
-  - Add to Bbox_2 and Bbox_3 a += operator as well as free functions to get the
-    bounding box of a range of geometric objects.
-
-
-* Combinatorial Maps
-
-  - Two bug fixes: do not use the 2 least significant bits for cell attribute
-    without dart support; share the mark when copying a CMap_cell_iterator.
-
-  - Add a constructor taking a given combinatorial map as argument, possibly
-    with different dimension and/or different attributes. This allows to
-    transform a combinatorial map.
-
-  - Add operator= and swap method.
-
-  - Add dynamic onmerge/onsplit functions that can be associated dynamically to
-    i-attributes and which are automatically called when i-cells are split/
-    merged.
-
-  - Add a function allowing to reverse the orientation of a combinatorial map,
-    and another one to reverse one connected component of a combinatorial map.
-
-
-* 3D Boolean Operations on Nef Polyhedra
-
-  - Bug-fix in IO when using Lazy_exact_nt as number type or
-    Exact_predicates_exact_constructions_kernel as kernel.
-
-
-* 2D Triangulations
-
-  - Extend the concept TriangulationDataStructure_2 to require a more general
-    copy_tds function that allows a copy between TDS of different types. The
-    CGAL model has been updated.
-
-  - Add a way to efficiently insert a range of points with information into the
-    2D constrained Delaunay triangulations.
-
-
-* 3D Triangulations
-
-  - Extend the concept TriangulationDataStructure_3 to require a more general
-    copy_tds function that allows a copy between TDS of different types. The
-    CGAL model has been updated.
-
-  - Add an advanced function to set the infinite vertex of the triangulation
-    for low level operations
-
-  - Fix a bug in the function inserting a range of points with info when the
-    Fast_location tag is used
-
-
-* 2D Segment Delaunay Graph
-
-  - Add functions insert_points and insert_segments to insert a range of points
-    and segments. These functions uses the spatial sorting in order to speed up
-    the time needed for the insertion. The function insert(Input_iterator
-    first, Input_iterator beyond, Tag_true) has been updated to dispatch the
-    input when possible to these functions.
-
-
-* 2D Apollonius Graphs
-
-  - Modified insertion algorithm so that the code can handle pseudo-circles as
-    well.
-
-  - Updated implementation of the vertex conflict predicate by a faster
-    version.
-
-
-* 3D Mesh Generation
-
-  - Speed-up Mesh_3 and in particular the global optimizers (Lloyd and ODT) by
-    introducing a parameter do_freeze to prevent from moving vertices which
-    would move of very small displacements.
-
-  - Introduce new data structures and options for speed-up and compacity. Note
-    that Compact_mesh_cell_base_3 and Mesh_vertex_base_3 are now our favoured
-    implementations of the concepts MeshCellBase_3 and MeshVertexBase_3.
-
-  - Introduce a new constructor for Polyhedral_mesh_domain_3 that takes a
-    bounding polyhedron to be meshed along with a polyhedral surface entirely
-    included in it. This allows the user to mesh a polyhedral domain with
-    internal surface(s) which can be non-watertight and even non-manifold.
-
-  - Several documentation bug fixes.
-
-  - Provide the ability to plug in custom cell_base/vertex_base classes into
-    the Mesh_triangulation_3 class.
-
-
-* Triangulated Surface Mesh Simplification
-
-  - Fix a segmentation fault that was happening when some edges of length 0
-    were in the input mesh.
-
-
-* 3D Fast Intersection and Distance Computation
-
-  - Following the intersection API change, Object_and_primitive_id has been
-    replaced by a template class Intersection_and_primitive_id<Query> to
-    determine the type depending on the query object type.
-
-  - Introduce the class AABB_halfedge_graph_segment_primitive, which replaces
-    the class AABB_polyhedron_segment_primitive (which is now deprecated). The
-    new class is more general and can be used with any model of HalfedgeGraph.
-
-  - Introduce the class AABB_face_graph_triangle_primitive which replaces the
-    class AABB_polyhedron_triangle_primitive (which is now deprecated).
-
-  - Document the classes AABB_segment_primitive and AABB_triangle_primitive
-    that were already used in some examples.
-
-  - Add a generic primitive class AABB_primitive that allows to define a
-    primitive type by defining only two property maps.
-
-  - Introduce a new concept of primitive AABBPrimitiveWithSharedData. It allows
-    to have some data shared between the primitives stored in a AABB_tree. With
-    this you can, for example have a primitive wrapping an integer which refers
-    to the position of a geometric object in a std::vector. Only one reference
-    to this vector will be stored in the traits of the tree. The concept
-    AABBTraits, its model AABB_traits and the class AABB_tree have been updated
-    accordingly. However, everything is backward compatible.
-
-  - Fix a memory leak in the destructor of the class AABB-tree
-
-
-* STL Extensions for CGAL
-
-  - Add to Dispatch_output_iterator and Dispatch_or_drop_output_iterator an
-    operator to accept and dispatch a tuple of values.
-
-
-* Concurrency in CGAL
-
-  - Add a FindTBB CMake module so that one can easily link with TBB to write
-    shared-memory parallel code.
-
-  - Introduce two new tags: Sequential_tag and Parallel_tag
-
-
--------------------------------- Release 4.2 --------------------------------
-
-Release date: March 2013
-
-
-* Installation
-
-  - Additional supported platforms:
-
-      - The Microsoft Windows Visual C++ compiler 2012 (VC11) is now supported.
-
-
-  - With Microsoft Visual C++ (all supported versions), the compiler flags /
-    bigobj and /wd4503 are added by CGAL CMake scripts.
-
-  - This is the last release whose "UseCGAL.cmake" file (if using CGAL in a
-    CMake build environment) contains the line
-      link_libraries(${CGAL_LIBRARIES_DIR} ${CGAL_3RD_PARTY_LIBRARIES_DIRS})
-    as this is a deprecated CMake command. The correct way to link with CGAL's
-    libraries (as for required 3rd party libraries) is to use
-    'target_link_libraries' which specifies for each build target which
-    libraries should be linked. The following serves as example:
-      find_package(CGAL)
-      include(${CGAL_USE_FILE})
-      add_executable(myexe main.cpp)
-      target_link_libraries(myexe ${CGAL_LIBRARIES}
-                                  ${CGAL_3RD_PARTY_LIBRARIES})
-    We also expect further changes in CGAL's CMake setup (change of variable
-    names, consistency of filename and output, removing essential libraries,
-    building executables, removal of '${CGAL_3RD_PARTY_LIBRARIES}').
-
-
-* 2D Arrangements
-
-  - Enhanced the 2D-arrangements demonstration program and ported it to Qt4.
-    The new demonstration program makes use of the CGAL Graphics View
-    framework, in which the 2D primitives are individually represented as
-    objects in a scene. (The implementations of several demos in CGAL already
-    make use of this framework.) This project was carried out as part of the
-    2012 Google Summer of Code program.
-
-  - Fixed a bug in the Walk-Along-A-Line point location strategy for
-    arrangements induced by unbounded curves.
-
-
-* 2D Circular Geometry Kernel
-
-  - Fix the intersection type computed when intersecting two identical circles.
-
-  - Forward correctly the result type of the linear kernel functors
-
-
-* 2D Triangulations
-
-  - Add mechanism to avoid call stack overflow in Delaunay_triangulation_2 and
-    Constrained_Delaunay_triangulation_2.
-
-  - Add a constructor for Regular_triangulation_2 and Delaunay_triangulation_2
-    from a range of points or a range of points with info.
-
-
-* 2D Voronoi Diagram Adaptor
-
-  - Bug-fix: Add ccb() method in face type as documented.
-
-
-* 3D Minkowski Sum of Polyhedra
-
-  - Fix a memory leak.
-
-
-* 3D Fast Intersection and Distance Computation
-
-  - Update requirements of the concepts AABBTraits and AABBGeomTraits to match
-    the implementation of the package.
-
-
-* Generator
-
-  - Addition of the Combination_enumerator
-
-
-* STL Extensions
-
-  - Introduction of CGAL::cpp11::result_of as an alias to the tr1
-    implementation from boost of the result_of mechanism. When all compilers
-    supported by CGAL will have a Standard compliant implemention of the C++11
-    decltype feature, it will become an alias to std::result_of.
-
-
-* Surface Reconstruction from Point Sets
-
-  - Performance improvements and addition of an option to better reconstruct
-    undersampled zones. The poisson reconstruction plugin of the Polyhedron
-    demo has an option to switch it on.
-
-
--------------------------------- Release 4.1 --------------------------------
-
-Release date: October 2012
-
-
-* Installation
-
-  - Additional supported platforms:
-
-      - The Apple Clang compiler versions 3.1 and 3.2 are now supported on
-        Mac OS X.
-
-
-  - Improved configuration for essential and optional external third party
-    software
-
-  - Added more general script to create CMakeLists.txt files:
-    cgal_create_CMakeLists
-
-  - Availability tests for C++11 features are now performed with the help of
-    Boost.Config. A Boost version of 1.40.0 or higher is needed to use C++11
-    features.
-
-
-* 2D Arrangement
-
-  - Improved the implementation of the incremental randomized trapezoidal
-    decomposition point-location strategy. The new implementation enables point
-    location in unbounded arrangements. It constructs a search structure of
-    guaranteed linear size with guaranteed logarithmic query time.
-
-
-* 2D Convex Hulls and Extreme Points
-
-  - Speed up the preprocessing stage of the Akl-Toussaint implementation (used
-    by the free function convex_hull_2 when forward iterators are provided as
-    input).
-
-
-* Combinatorial Maps
-
-  - Minor bugfix; replace some functors by methods.
-
-
-* Linear Cell Complex
-
-  - Improve the demo: add a widget showing all the volumes and an operation to
-    create a Menger sponge.
-
-
-* Kernels
-
-  - All Kernel functors now support the result_of protocol.
-
-
-* STL_Extensions for CGAL
-
-  - The namespace cpp0x has been renamed cpp11. The old name is still available
-    for backward compatibility.
-
-
--------------------------------- Release 4.0.2 --------------------------------
-
-Release date: Jul 2012
-
-This is a bug fix release. It fixes a bug in the CMakeLists.txt for CGAL-4.0.1,
-that prevented even building the libraries.
-
-
--------------------------------- Release 4.0.1 --------------------------------
-
-Release date: Jul 2012
-
-This is a bug fix release. Apart various minor fixes in the documentation, the
-following has been changed since CGAL-4.0:
-
-
-* 2D Voronoi Diagram Adaptor (re-added)
-
-  - The package 2D Voronoi Diagram Adaptor was temporarily removed from the
-    CGAL distribution because of license issues. That package is now back into
-    CGAL.
-
-
-* 2D and 3D Geometry Kernel
-
-  - Fix a bug in the Segment_3-Triangle_3 intersection function in the case the
-    segment is collinear with a triangle edge.
-
-  - Fix a bug in the Projection_traits_.._3 class in the case a segment was
-    parallel to the x-axis.
-
-
-* Algebraic Kernel
-
-  - Avoid the linking error "duplicate symbols" when two compilation units
-    using the algebraic kernel are linked.
-
-
-* 3D Boolean Operations on Nef Polygons Embedded on the Sphere
-
-  - Fix a memory leak due to the usage of an internal mechanism that has been
-    replaced by boost::any. This also influences the packages 2D Boolean
-    Operations on Nef Polygons, 3D Boolean Operations on Nef Polyhedra, Convex
-    Decomposition of Polyhedra, and 3D Minkowski Sum of Polyhedra.
-
-
-* 2D Arrangement
-
-  - Fix several memory leaks.
-
-
-* 2D Mesh Generation
-
-  - Fix a compilation error in the header <CGAL/Mesh_2/Do_not_refine_edges.h>
-    when g++ version 4.7 is used.
-
-
-* Surface Mesh Generation and 3D Mesh Generation
-
-  - Fix an important bug in the CGAL_ImageIO library, that could lead to wrong
-    result when meshing from a 3D image.
-
-  - Fix the compilation of the demo in demo/Surface_mesher, when Boost version
-    1.48 or 1.49 is used.
-
-
-* Surface Mesh Parameterization
-
-  - Fix a memory leak.
-
-  - Fix a compatibility issue with Eigen-3.1 of Eigen_solver_traits. This fix
-    also affects the usage of that class in the package Surface Reconstruction
-    from Point Sets.
-
-
--------------------------------- Release 4.0 --------------------------------
-
-Release date: March 2012
-
-CGAL 4.0 offers the following improvements and new functionality :
-
-
-* License Changes
-The whole CGAL-3.x series was released under a combination of LGPLv2 (for the
-foundations of CGAL), and QPL (for the high-level packages). QPL was the former
-license of the graphical toolkit Qt, but that license is not supported by any
-major free software project. Furthermore, the terms of the LGPLv2 license are
-ambiguous for a library of C++ templates, like CGAL.
-
-The CGAL project, driven by the CGAL Editorial Board, has decided to change the
-license scheme of CGAL. We increased the major number of the CGAL version to
-'4' in order to reflect this license change. The CGAL-4.x series is released
-under:
-
-
-  - LGPLv3+ (that is LGPL "either version 3 of the License, or (at your option)
-    any later version"), for the foundations of CGAL, instead of LGPLv2,
-
-  - GPLv3+ for the high-level packages, instead of QPL.
-
-
-* General
-
-  - On Windows, CGAL libraries are now built by default as shared libraries
-    (also called DLL). To run applications that use .dll files of CGAL, you
-    must either copy the .dll files into the directory of the application, or
-    add the path of the directory that contains those .dll files into the PATH
-    environment variable.
-
-  - On Windows, the CMake scripts of CGAL now search for shared version of the
-    Boost libraries. You must ensure that the .dll files of Boost are found by
-    the dynamic linker. You can, for example, add the path to the Boost .dll
-    files to the PATH environment variable.
-
-  - On Windows, CMake version 2.8.6 or higher is now required.
-
-  - Eigen version 3.1 or later is now the recommended third party library to
-    use in Planar Parameterization of Triangulated Surface Meshes, Surface
-    Reconstruction from Point Sets, Approximation of Ridges and Umbilics on
-    Triangulated Surface Meshes, and Estimation of Local Differential
-    Properties of Point-Sampled Surfaces packages. If you use Eigen you no
-    longer need Taucs, Lapack or Blas to use those packages (and any other in
-    CGAL).
-
-
-* Linear Cell Complex (new package)
-
-  - This package implements linear cell complexes, objects in d-dimension with
-    linear geometry. The combinatorial part of objects is described by a
-    combinatorial map, representing all the cells of the object plus the
-    incidence and adjacency relations between cells. Geometry is added to
-    combinatorial maps simply by associating a point to each vertex of the map.
-    This data structure can be seen as the generalization in dD of the
-    Polyhedron_3.
-
-
-* 2D Voronoi Diagram Adaptor (temporarily removed)
-
-  - As the copyright holder of this package has not granted the right to switch
-    from QPL to GPL, this package is removed from the distribution. Note that
-    it is "only" an adapter, that is the functionality of point/segment/disk
-    Voronoi diagram is offered through the Delaunay triangulation, segment
-    Delaunay graph, and Apollonius graph.
-
-
-* AABB Tree
-
-  - Document constness of member functions of the AABB_tree class.
-
-  - The class AABB_tree is now guaranteed to be read-only thread-safe. As usual
-    in CGAL, this small overhead introduced for thread-safety can be
-    deactivated by defining CGAL_HAS_NO_THREADS.
-
-
-* 2D Alpha Shapes
-
-  - Add an extra template parameter to the class Alpha_shape_2 that allows a
-    certified construction using a traits class with exact predicates and
-    inexact constructions.
-
-  - An object of type Alpha_shape_2 can now be constructed from a
-    triangulation.
-
-
-* 3D Alpha Shapes
-
-  - Add an extra template parameter to the class Alpha_shape_3 that allows a
-    certified construction using a traits class with exact predicates and
-    inexact constructions.
-
-
-* Geometric Object Generators
-
-  - Random_points_in_iso_box_d (deprecated since 3.8) has been removed. Use
-    Random_points_in_cube_d instead.
-
-
-* Linear and Quadratic Programming Solver
-
-  - Minor bugfix.
-
-
-* Spatial Searching
-
-  - The const-correctness of this package have been worked out. The transition
-    for users should be smooth in general, however adding few const in user
-    code might be needed in some cases.
-
-  - The class Kd_tree is now guaranteed to be read-only thread-safe. As usual
-    in CGAL, this small overhead introduced for thread-safety can be
-    deactivated by defining CGAL_HAS_NO_THREADS.
-
-  - Bug-fix in Orthogonal_incremental_neighbor_search and
-    Incremental_neighbor_search classes. Several calls to begin() now allow to
-    make several nearest neighbor search queries independently.
-
-
-* STL Extension
-
-  - CGAL::copy_n is now deprecated for CGAL::cpp0x::copy_n which uses std::
-    copy_n, if available on the platform.
-
-  - CGAL::successor and CGAL::predecessor are now deprecated for CGAL::cpp0x::
-    next and CGAL::cpp0x::prev. These functions use the standard versions if
-    available on the platform. Otherwise, boost::next and boost::prior are
-    used.
-
-
-* Triangulation_2
-
-  - Fix a thread-safety issue in Delaunay_triangulation_2 remove functions. As
-    usual in CGAL, the small overhead introduced for thread-safety can be
-    deactivated by defining CGAL_HAS_NO_THREADS.
-
-  - Add extraction operator for the class Constrained_triangulation_2 (and thus
-    to all inheriting classes).
-
-
--------------------------------- Release 3.9 --------------------------------
-
-Release date: September 2011
-
-CGAL 3.9 offers the following improvements and new functionality :
-
-
-* General
-
-  - The class Root_of_2 is now deprecated. It is recommended to use the class
-    Sqrt_extension instead.
-
-  - The class Sqrt_extension is now used everywhere in CGAL where an algebraic
-    number of degree 2 is needed. This change has been done in the
-    Root_of_traits mechanism (indirectly packages 2D Circular kernel and 3D
-    Spherical kernel) and the packages 2D Segment Delaunay Graphs and 2D
-    Arrangements.
-
-  - Various fixes in the manual.
-
-
-* Combinatorial Maps (new package)
-
-  - This package provides a new combinatorial data structure allowing to
-    describe any orientable subdivided object whatever its dimension. It
-    describes all cells of the subdivision and all the incidence and adjacency
-    relations between these cells. For example it allows to describe a 3D
-    object subdivided in vertices, edges, faces and volumes. This data
-    structure can be seen as the generalization in dD of the halfedge data
-    structure.
-
-
-* 3D Convex Hull (major performance improvement)
-
-  - The quickhull implementation of CGAL (CGAL::convex_hull_3) has been worked
-    out to provide very better performances.
-
-  - The function CGAL::convex_hull_3 no longer computes the plane equations of
-    the facets of the output polyhedron. However an example is provided to show
-    how to compute them easily.
-
-  - A global function convex_hull_3_to_polyhedron_3 is now provided to extract
-    the convex hull of a 3D points set from a triangulation of these points.
-
-
-* dD Spatial Searching (major new feature added)
-
-  - A traits-class and distance adapter that together with a point property
-    map, allow to make nearest neighbor queries on keys instead of points have
-    been added.
-
-  - Few bug fixes in the documentation have revealed some inconsistencies that
-    have been corrected. Two traits class concept are now documented
-    (RangeSearchTraits and SearchTraits). Most other changes concerns only
-    classes documented as advanced. One issue that user can encounter is due to
-    an additional requirement on the nested class
-    Construct_cartesian_const_iterator_d defined in the concept SearchTraits
-    that must provide a nested type result_type.
-
-
-* Spatial Sorting (major new feature added)
-
-  - General dimension is now supported.
-
-  - Hilbert sorting admits now two policies: splitting at median or at middle
-    (see user manual).
-
-  - Using a property map, sorting on keys instead of points is now easier
-
-
-* dD Kernel
-
-  - The d-dimensional kernel concept and models have been modified to
-    additionally provide two new functors Less_coordinate_d and
-    Point_dimension_d.
-
-
-* 2D Arrangements
-
-  - A new geometry-traits class that handles rational arcs, namely
-    Arr_rational_function_traits_2, has been introduced. It replaced an old
-    traits class, which handled the same family of curves, but it was less
-    efficient. The new traits exploits CGAL algebraic kernels and polynomials,
-    which were not available at the time the old traits class was developed.
-
-  - A new geometry traits concept called ArrangementOpenBoundaryTraits_2 has
-    been introduced. A model of this concept supports curves that approach the
-    open boundary of an iso-rectangular area called parameter space, which can
-    be unbounded or bounded. The general code of the package, however, supports
-    only the unbounded parameter space. We intend to enhance the general code
-    to support also bounded parameter spaces in a future release.
-
-  - The deprecated member function is_at_infinity() of Arrangement_2::Vertex
-    has been removed. It has been previously replaced new function
-    is_at_open_boundary().
-
-  - The tags in the geometry traits that indicate the type of boundary of the
-    embedding surface were replaced by the following new tags:
-             Left_side_category
-             Bottom_side_category
-             Top_side_category
-             Right_side_category
-    It is still possible not to indicate the tags at all. Default values are
-    assumed. This however will produce warning messages, and should be avoided.
-
-
--------------------------------- Release 3.8 --------------------------------
-
-Release date: April 2011
-
-CGAL 3.8 offers the following improvements and new functionality :
-
-
-* General
-
-  - Boost version 1.39 at least is now required.
-
-  - Initial support for the LLVM Clang compiler (prereleases of version 2.9).
-
-  - Full support for the options -strict-ansi of the Intel Compiler 11, and -
-    ansi of the GNU g++ compiler.
-
-  - Adding a concept of ranges. In the following releases, it will be the way
-    to provide a set of objects (vs. a couple of iterators).
-
-  - Fix a memory leak in CORE polynomials.
-
-  - Various fixes in the manual.
-
-
-* 3D Mesh Generation (major new feature added)
-
-  - Adding the possibility to handle sharp features: the 3D Mesh generation
-    package now offers the possibility to get in the final mesh an accurate
-    representation of 1-dimensional sharp features present in the description
-    of the input domain.
-
-
-* 2D Triangulations (major new feature added)
-
-  - Add a way to efficiently insert a range of points with information into a
-    2D Delaunay and regular triangulation.
-
-  - Add member function mirror_edge taking an edge as parameter.
-
-  - Fix an infinite loop in constrained triangulation.
-
-
-* 3D Triangulations (major new feature added)
-
-  - Add a way to efficiently insert a range of points with information into a
-    3D Delaunay and regular triangulation.
-
-  - Add a member function to remove a cluster of points from a Delaunay or
-    regular triangulation.
-
-  - function vertices_in_conflict is renamed vertices_on_conflict_zone_boundary
-    for Delaunay and regular triangulation. Function
-    vertices_inside_conflict_zone is added to regular triangulation.
-
-  - Structural filtering is now internally used in locate function of Delaunay
-    and regular triangulation. It improves average construction time by 20%.
-
-  - Added demo.
-
-
-* 3D Alpha Shapes (major new feature added)
-
-  - The new class Fixed_alpha_shape_3 provides a robust and faster way to
-    compute one alpha shape (with a fixed value of alpha).
-
-
-* AABB tree
-
-  - Adding the possibility to iteratively add primitives to an existing tree
-    and to build it only when no further insertion is needed.
-
-
-* 2D and 3D Kernel
-
-  - Better handling of 2D points with elevation (3D points projected onto
-    trivial planes). More general traits classes (Projection_traits_xy_3,
-    Projection_traits_yz_3,Projection_traits_yz_3) are provided to work with
-    triangulations, algorithms on polygons, alpha-shapes, convex hull
-    algorithm... Usage of former equivalent traits classes in different
-    packages is now deprecated.
-
-  - Exact_predicates_exact_constructions_kernel now better use the static
-    filters which leads to performance improvements.
-
-  - Add an overload for the global function angle, taking three 3D points.
-
-  - In the 2D and 3D kernel concept, the constant Boolean
-    Has_filtered_predicates is now deprecated. It is now required to use
-    Has_filtered_predicates_tag (being either Tag_true or Tag_false).
-
-  - Compare_distance_2 and Compare_distance_3 provide additional operators for
-    3 and 4 elements.
-
-  - Add intersection test and intersection computation capabilities between an
-    object of type Ray_3 and either an object of type Line_3, Segment_3 or
-    Ray_3.
-
-  - Improve intersection test performance between an object of type Bbox_3 and
-    an object of type Plane_3 or Triangle_3 by avoiding arithmetic filter
-    failures.
-
-
-* 2D Envelope
-
-  - Env_default_diagram_1 is deprecated, Envelope_diagram_1 should be used
-    instead.
-
-
-* 3D Envelope
-
-  - A new demo program called L1_Voronoi_diagram_2 has been introduced. It
-    demonstrates how 2D Voronoi diagrams of points under the L1 metric are
-    constructed using lower envelopes.
-
-
-* dD Kernel
-
-  - Add functor Compute_coordinate_d to Kernel_d concept.
-
-
-* Geometric Object Generators
-
-  - CGAL::Random uses boost::rand48 instead of std::rand.
-
-  - Adding to CGAL::Random a way to generate random integers.
-
-  - Adding generators for dD points.
-
-
-* Algebraic Foundations
-
-  - Algebraic_structure_traits now provides an Inverse functor for Fields.
-    There is also a new global function inverse.
-
-
-* Bounding Volumes
-
-  - dD Min sphere of spheres has a new traits class for the min sphere of
-    points.
-
-
-* Triangulated Surface Mesh Simplification
-
-  - The priority queue internally used to prioritize edge simplifications is no
-    longer a relaxed heap but a binomial heap. This fix guarantees that all
-    edges satisfying a simplification criteria are removed (if possible).
-
-
-* 3D Boolean Operations on Nef Polyhedra
-
-  - Allow construction of a 3D nef polyhedron from a 3D polyhedron with
-    normals.
-
-
-* 2D Arrangements
-
-  - Fix a bug in the method insert_at_vertices of the Arrangement_2 class.
-
-  - Fix several bugs in the traits class Arr_Bezier_curve_traits_2 for
-    arrangement of Bezier curves.
-
-
-* 2D Minkowski Sums
-
-  - A bug in the convolution method was fixed.
-
-
--------------------------------- Release 3.7 --------------------------------
-
-Release date: October 2010
-
-CGAL 3.7 offers the following improvements and new functionality :
-
-
-* General
-
-  - The configuration of CGAL libraries now requires CMake>=2.6.
-
-  - Changes in the set of supported platforms:
-
-      - GNU g++ 4.5 supported (with or without the compilation option -
-        std=c++0x).
-
-      - Initial support for the option -strict-ansi of the Intel Compiler 11.
-        The CGAL libraries compile with that option, and most CGAL headers have
-        been fixed. The packages "3D Boolean Operations on Nef Polyhedra"
-        (Nef_3), "Convex Decomposition of Polyhedra" (Convex_decomposition_3),
-        and "3D Minkowski Sum of Polyhedra" (Minkowski_sum_3) are known to
-        still fail to compile with that compiler flag.
-
-      - The Microsoft Windows Visual C++ compiler 2010 (VC10), that was
-        experimentally supported by CGAL-3.6.1, is now fully supported. Note
-        that CMake>=2.8.2 is required for that support.
-
-      - The Microsoft Windows Visual C++ compiler 2005 (VC8) is no longer
-        supported by the CGAL project since CGAL-3.7.
-
-      - With Microsoft Windows Visual C++ (VC9 and VC10), the optional
-        dependencies Gmp, Mpfr, Blas, Lapack, Taucs no longer use Boost-style
-        name mangling. Only one variant is now provided by the CGAL Windows
-        installer (release, with dynamic runtime).
-
-
-  - Some demos now require a version of Qt4 >= 4.3.
-
-  - CGAL_PDB is no longer provided with CGAL. An alternative solution for
-    people interested in reading PDB files is to use ESBTL (http://
-    esbtl.sourceforge.net/).
-
-  - Fix issues of the CGAL wrappers around the CORE library, on 64 bits
-    platforms.
-
-
-* Arithmetic and Algebra
-
-  - New models Algebraic_kernel_d_1 and Algebraic_kernel_d_2 for the
-    corresponding concepts. They provide generic support for various
-    coefficient types
-
-
-* Arrangements
-
-  - A new model Arr_algebraic_segment_traits_2 of ArrangementTraits_2 that
-    supports algebraic curves of arbitrary degree in the plane
-
-
-* 2D Triangulations
-
-  - The Delaunay and regular 2D triangulations now use a symbolic perturbation
-    to choose a particular triangulation in co-circular cases.
-
-  - The return type of the template member function insert(It beg, It end),
-    taking an iterator range of points, has been changed from int to std::
-    ptrdiff_t.
-
-  - Classes Triangulation_euclidean_traits_xy_3,
-    Triangulation_euclidean_traits_yz_3 and Triangulation_euclidean_traits_xz_3
-    are now model of the concept ConstrainedTriangulationTraits_2. They can be
-    used with and without intersection of constraints.
-
-  - 2D Delaunay and basic triangulations now provide vertex relocation by the
-    mean of these two new methods: move and move_if_no_collision. The methods
-    are also available for the hierarchy (Triangulation_hierarchy_2).
-
-
-* 3D Triangulations
-
-  - The return type of the template member function insert(It beg, It end),
-    taking an iterator range of points, has been changed from int to std::
-    ptrdiff_t.
-
-  - 3D Delaunay triangulations now provide vertex relocation by the mean of
-    these two new methods: move and move_if_no_collision. This works in both
-    Compact_policy and Fast_policy.
-
-
-* 2D and 3D Alpha Shapes
-
-  - The type int in the API has been changed to std::size_t so that CGAL can
-    deal with large data sets (64 bit addresses).
-
-
-* 2D Mesh Generation
-
-  - The execution of the 2D mesh generator is now deterministic (same at each
-    run).
-
-
-* 3D Mesh Generation
-
-  - The efficiency of the 3D mesh generator has been improved (the number of
-    calls to the oracle per inserted vertex has globally decrease). This is
-    achieved through a slight change of the mesh generator strategy which
-    implies that a surface component that is not detected at the surface mesher
-    level will never be discovered by chance, owing to the refinement of some
-    tetrahedra, as it could happen before. Please note that defining the macro
-    CGAL_MESH_3_USE_OLD_SURFACE_RESTRICTED_DELAUNAY_UPDATE switches back to the
-    old behavior.
-
-  - A demo program is now available.
-
-
-* Surface Reconstruction from Point Sets
-
-  - Improved performance and minor bug fix.
-
-
-* 2D Range and Neighbor Search
-
-  - The type int in the API has been changed to std::size_t so that CGAL can
-    deal with large data sets (64 bit addresses).
-
-
--------------------------------- Release 3.6.1 --------------------------------
-
-Release date: June 2010
-
-This is a bug fix release. The following has been changed since CGAL-3.6:
-
-
-* General
-
-  - Fix compilation errors with recent Boost versions (since 1.40).
-
-  - Initial support for the Microsoft Visual C++ compiler 10.0 (MSVC 2010). For
-    that support, CMake>=2.8.2 is required. Note also that the compiler option
-    "/bigobj" is necessary to compile some CGAL programs with MSVC 2010.
-
-
-* Polynomial
-
-  - Fix compilation errors with the Microsoft Visual C++ compiler and the Intel
-    C++ compiler.
-
-
-* Polyhedron
-
-  - Fix a compilation errors in demo/Polyhedron/:
-
-  - issue with the location of qglobal.h of Qt4 on MacOS X,
-
-  - missing texture.cpp, if TAUCS is used,
-
-  - Fix the location of built plugins of demo/Polyhedron/, when CGAL is
-    configured with WITH_demos=ON
-
-
-* 3D Periodic Triangulations
-
-  - Fixed bug in the triangulation hierarchy for periodic triangulations.
-
-
-* 2D Mesh Generation
-
-  - Fix a bug that lead to precondition violation.
-
-  - Improve the user manual about the member function is_in_domain() of the
-    Face type.
-
-  - The 2D meshing process is now deterministic (sorting of bad faces no longer
-    relies on pointers comparisons).
-
-
-* 3D Mesh Generation
-
-  - Fix a linking errors (duplicate symbols) when <CGAL/refine_mesh_3.h> is
-    included in different compilation units.
-
-
-* Spatial Searching
-
-  - Fix a bug in <CGAL/Orthogonal_k_neighbor_search.h> when several nearest
-    neighbors are at the same distance from the query point.
-
-
-* IO Streams
-
-  - Fix a bug in <CGAL/IO/VRML_2_ostream.h> that generated VRML 2 files with an
-    invalid syntax for IndexedFaceSet nodes.
-
-
-* Triangulation_2
-
-  - Add missing Compare_distance_2 functor in trait classes
-    Triangulation_euclidean_traits_xy_3 Triangulation_euclidean_traits_yz_3 and
-    Triangulation_euclidean_traits_xz_3. This was preventing calling member
-    function nearest_vertex of Delaunay_triangulation_2 instantiated with one
-    of these traits.
-
-
--------------------------------- Release 3.6 --------------------------------
-
-Release date: March 2010
-
-CGAL 3.6 offers the following improvements and new functionality :
-
-
-* General
-
-  - Boost version 1.34.1 at least is now required.
-
-
-* Arithmetic and Algebra
-
- ** Algebraic Kernel (new package)
-
-  - This new package is targeted to provide black-box implementations of state-
-    of-the-art algorithms to determine, compare and approximate real roots of
-    univariate polynomials and bivariate polynomial systems. It includes models
-    of the univariate algebraic kernel concept, based on the library RS.
-
-
- ** Number Types
-
-  - Two new arbitrary fixed-precision floating-point number types have been
-    added: the scalar type Gmpfr and the interval type Gmpfi, based on the MPFR
-    and MPFI libraries respectively.
-
-
-* Geometry Kernels
-
- ** 2D and 3D Geometry Kernel
-
-  - Add new do_intersect() and intersection() overloads:
-
-      - do_intersect(Bbox_3, Bbox_3/Line_3/Ray_3/Segment_3)
-
-      - intersection(Triangle_3, Line_3/Ray_3/Segment_3)
-
-
-
-* Polygons
-
- ** 2D Regularized Boolean Set-Operations
-
-  - Fixed General_polygon_set_2::arrangement() to return the proper type of
-    object.
-
-
-* Arrangement
-
- ** 2D Arrangements
-
-  - Fixed passing a (const) traits object to the constructor of Arrangement_2.
-
-  - Introduced Arrangement_2::fictitious_face(), which returns the fictitious
-    face in case of an unbounded arrangement.
-
-  - Fixed a bug in Bezier-curve handling.
-
-  - Added (back) iterator, number_of_holes(), holes_begin(), and holes_end() to
-    the default DCEL for backward compatibility.
-
-  - Added (simple) versions of the free overlay() function. It employs the
-    default overlay-traits, which practically does nothing.
-
-
-* Polyhedron
-
-  - Fix a compilation errors in demo/Polyhedron/:
-
-      - issue with the location of qglobal.h of Qt4 on MacOS X,
-
-      - missing texture.cpp, if TAUCS is used,
-
-
-  - Fix the location of built plugins of demo/Polyhedron/, when CGAL is
-    configured with WITH_demos=ON
-
-  - Fix a bug in test_facet function of the incremental builder: the function
-    did not test if while a new facet makes a vertex manifold, no other facet
-    incident to that vertex breaks the manifold property.
-
-
-* Triangulations and Delaunay Triangulations
-
- ** 2D/3D Regular Triangulations
-
-  - Weighted_point now has a constructor from Cartesian coordinates.
-
-
- ** 3D Triangulations
-
-  - Regular_triangulation_3 : semi-static floating-point filters are now used
-    in its predicates, which can speed up its construction by a factor of about
-    3 when Exact_predicates_inexact_constructions_kernel is used.
-
-  - The class Regular_triangulation_filtered_traits_3 is deprecated, the class
-    Regular_triangulation_euclidean_traits_3 must be used instead. The
-    predicates of that traits will be filtered if the kernel given as template
-    parameter of that traits is itself a filtered kernel.
-
-  - Triangulation_hierarchy_3 is now deprecated, and replaced by a simpler
-    CGAL::Fast_location policy template parameter of Delaunay_triangulation_3.
-
-  - The old version of remove() (enabled with CGAL_DELAUNAY_3_OLD_REMOVE) has
-    been deleted.
-
-
- ** 3D Periodic Triangulations
-
-  - New demo: 3D periodic Lloyd algorithm.
-
-  - New functionality for Voronoi diagrams: dual of an edge and of a vertex,
-    volume and centroid of the dual of a vertex.
-
-  - The package can now be used with the 3D Alpha Shapes package to compute
-    periodic alpha shapes.
-
-
- ** 3D Alpha shapes
-
-  - The class Weighted_alpha_shape_euclidean_traits_3 is deprecated, the class
-    Regular_triangulation_euclidean_traits_3 must be used instead.
-
-  - The package can now be used together with the 3D Periodic Triangulation
-    package to compute periodic alpha shapes.
-
-
- ** 2D/3D Triangulations, 2D Segment Delaunay Graph, 2D Apollonius Graph, and
-3D Periodic Triangulations
-
-  - The constructor and insert function taking ranges now produce structures
-    whose iterator orders is now deterministic (same at each run).
-
-
-* Mesh Generation
-
- ** 2D Mesh Generation
-
-  - The 2D mesh generator can now be used with a constrained Delaunay
-    triangulation with constraints hierarchy
-    (Constrained_triangulation_plus_2).
-
-  - In some cases (refinement of a constrained edge that is on the convex
-    hull), the 2D mesh generator from CGAL-3.4 and CGAL-3.5 could create
-    invalid triangulations. This bug is now fixed.
-
-
- ** 3D Mesh Generation
-
-  - The mesh generator has been enriched with an optimization phase to provide
-    3D meshes with well shaped tetrahedra (and in particular no slivers). The
-    optimization phase involves four different optimization processes: two
-    global optimization processes (ODT and Lloyd), a perturber and an exuder.
-    Each of these processes can be activated or not, and tuned to the users
-    needs and to available computer resources.
-
-
-* Support library
-
- ** CGAL ipelets
-
-  - Add support for version 7 of Ipe.
-
-
--------------------------------- Release 3.5.1 --------------------------------
-
-Release date: December 2009
-
-This is a bug fix release.
-
-
-* Documentation
-
-  - Fixes in the documentation (the online documentation of CGAL-3.5 is now
-    based on CGAL-3.5.1).
-
-  - Fixes to the bibliographic references.
-
-
-* Windows installer
-
-  - The Windows installer of CGAL-3.5.1 fixes an issue with downloading of
-    precompiled binaries of the external library TAUCS.
-
-
-* Bug fixes in the following CGAL packages
-
- ** AABB tree
-
-  - Fix a linker issue in do_intersect(Bbox_3,Bbox_3).
-
-  - Fix compilation issue in do_intersect(Bbox_3,Ray_3) when using the
-    parameters in this order.
-
-
- ** 3D Mesh Generation
-
-  - Fix a bug in initial points construction of a polyhedral surface.
-
-
--------------------------------- Release 3.5 --------------------------------
-
-Release date: October 2009
-
-CGAL releases will now be published about every six months. As a transition
-release, CGAL-3.5 has been developed during 9 months from the release CGAL-3.4.
-
-Version 3.5 differs from version 3.4 in the platforms that are supported and in
-functionality. There have also been a number of bug fixes for this release.
-
-
-* General
-
-  - Additional supported platforms:
-
-      - GNU g++ 4.4 supported.
-
-      - Intel Compiler 11 supported on Linux
-
-
-  - Fixed ABI incompatibilities when mixing CGAL and Boost Program Options on
-    Windows/Visual C++ (the compilation flag -D_SECURE_SCL=0 is not longer use
-    in Debug mode).
-
-
-* Geometry Kernels
-
- ** 3D Spherical Geometry Kernel
-
-  - Add functionalities to manipulate circles, circular arcs and points that
-    belong to the same sphere.
-
-
-* Polygons
-
- ** 2D Regularized Boolean Set-Operations
-
-  - The polygon validation operations were enhanced and their interface was
-    improved. They are now offered as free functions and applied properly.
-
-
- ** 2D Straight Skeleton and Polygon Offsetting
-
-  - Updated the manual to document the new partial skeletons feature (already
-    in the code since 3.4)
-
-
-* Arrangements
-
- ** 2D Arrangements
-
-  - The member function is_at_infinity() of Arrangement_2::Vertex was replaced
-    by the new function is_at_open_boundary(). The former is deprecated. While
-    still supported in version 3.5, It will not be supported in future
-    releases. The member functions boundary_type_in_x() and boundary_type_in_y
-    () were permanently replaced by the functions parameter_space_in_x() and
-    parameter_space_in_y(), respectively. The 2 new functions return an
-    enumeration of a new type, namely Arr_parameter_space.
-
-  - The tags in the geometry traits that indicate the type of boundary of the
-    embedding surface were replaced by the following new tags:
-    Arr_left_side_tag Arr_bottom_side_tag Arr_top_side_tag Arr_right_side_tag
-    In addition, the code was change, and now it is possible not to indicate
-    the tags at all. Default values are assumed. This however will produce
-    warning messages, and should be avoided.
-
-  - All operations of the geometry traits-class were made 'const'. This change
-    was reflected in the code of this package and all other packages that are
-    based on it. Traits classes that maintain state, should declare the data
-    members that store the state as mutable.
-
-
- ** Envelopes of Surfaces in 3D
-
-  - A few bugs in the code that computes envelopes were fixed, in particular in
-    the code that computes the envelopes of planes.
-
-
-* Triangulations and Delaunay Triangulations
-
- ** 3D Periodic Triangulations (new package)
-
-  - This package allows to build and handle triangulations of point sets in the
-    three dimensional flat torus. Triangulations are built incrementally and
-    can be modified by insertion or removal of vertices. They offer point
-    location facilities.
-
-
-* Mesh Generation
-
- ** Surface Reconstruction from Point Sets (new package)
-
-  - This CGAL package implements an implicit surface reconstruction method:
-    Poisson Surface Reconstruction. The input is an unorganized point set with
-    oriented normals.
-
-
- ** 3D Mesh Generation (new package)
-
-  - This package generates 3 dimensional meshes. It computes isotropic
-    simplicial meshes for domains or multidomains provided that a domain
-    descriptor, able to answer queries from a few different types on the
-    domain, is given. In the current version, Mesh_3 generate meshes for domain
-    described through implicit functional, 3D images or polyhedral boundaries.
-    The output is a 3D mesh of the domain volume and conformal surface meshes
-    for all the boundary and subdividing surfaces.
-
-
-* Geometry Processing
-
- ** Triangulated Surface Mesh Simplification
-
-  - BREAKING API change in the passing of the visitor object.
-
-  - Fixed a bug in the link_condition test
-
-  - Added a geometric test to avoid folding of facets
-
-  - Fixed a bug in the handling of overflow in the LindstromTurk computations
-
-  - Updated the manual to account for the new visitor interface
-
-
- ** Point Set Processing (new package)
-
-  - This packages implements a set of algorithms for analysis, processing, and
-    normal estimation and orientation of point sets.
-
-
-* Spatial Searching and Sorting
-
- ** AABB tree (new package)
-
-  - This package implements a hierarchy of axis-aligned bounding boxes (a AABB
-    tree) for efficient intersection and distance computations between 3D
-    queries and sets of input 3D geometric objects.
-
-
-* Support Library
-
- ** CGAL_ipelets (new package):
-
-  - Object that eases the writing of Ipe's plugins that use CGAL. Plugins for
-    CGAL main 2D algorithm are provided as demo.
-
-
--------------------------------- Release 3.4 --------------------------------
-
-Release date: January 2009
-
-Version 3.4 differs from version 3.3.1 in the platforms that are supported and
-in functionality. There have also been a number of bug fixes for this release.
-
-
-* General
-
-  - GNU g++ 4.3 supported. Support for g++ 3.3 is dropped.
-
-  - Visual 9 supported. Support for Visual 7 is dropped.
-
-  - Boost version 1.33 at least is now required.
-
-  - CGAL now depends on Boost.Threads, which implies to link against a compiled
-    part of Boost.
-
-  - The new macro CGAL_NO_DEPRECATED_CODE can be defined to disable deprecated
-    code, helping users discover if they rely on code that may be removed in
-    subsequent releases.
-
-  - Assertion behaviour: It is not possible anymore to set the CONTINUE mode
-    for assertion failures. Functions that allow to change the assertion
-    behaviour are now declared in <CGAL/assertions_behaviour.h>.
-
-  - Qt3 based demos are still there but the documentation has been removed as
-    the CGAL::Qt_Widget will be deprecated.
-
-  - Qt4 based demos use the Qt GraphicsView framework and the libQGLViewer.
-
-
-* Installation
-
-  - install_cgal has been replaced by CMake.
-
-
-* Polynomial (new package)
-
-  - This package introduces a concept Polynomial_d, a concept for multivariate
-    polynomials in d variables.
-
-
-* Modular Arithmetic (new package)
-
-  - This package provides arithmetic over finite fields.
-
-
-* Number Types
-
-  - the counter Interval_nt::number_of_failures() has been removed, replaced by
-    a profiling counter enabled with CGAL_PROFILE.
-
-  - Fix of a bug in CORE/Expr.h; as a consequence, the arrangement demo works
-    properly when handling arrangements of conics, for example, when defining
-    an arc with 5 points.
-
-
-* 3D Spherical Geometry Kernel (new package)
-
-  - This package is an extension of the linear CGAL Kernel. It offers
-    functionalities on spheres, circles, circular arcs and line segments in the
-    3D space.
-
-
-* Linear Kernel
-
-  - We recommend that you use the object_cast() function instead of assign() to
-    extract an object from a CGAL::Object, for efficiency reasons.
-
-  - The Kernel archetypes provided by the 2D/3D linear kernel have been
-    removed.
-
-  - The deprecated linear kernel functors Construct_supporting_line_2 and
-    Construct_supporting_line_3 have been removed.
-
-  - Ambiant_dimension and Feature_dimenison have been added to retrieve the
-    potentially compile-time dimension of a space or of an object.
-
-  - barycenter() functions have been added.
-
-  - The geometric object Circle_3 as well as predicates and constructions have
-    been added to the kernel
-
-  - The missing intersection/do_intersect between Line_3 and Line_3 has been
-    added as well.
-
-
-* 3D Triangulations
-
-  - Removed the deprecated functions Cell:mirror_index() and Cell::
-    mirror_vertex().
-
-  - Derecursification of two functions that in some cases lead to stack
-    overflows
-
-
-* 3D Nef Polyhedron
-
-  - n-ary union/intersection
-
-  - intersection with halfspace under standard kernel
-
-  - constructor for polylines
-
-
-* CGAL and the Qt4 GraphicsView (new package)
-
-  - 2D CGAL Kernel objects and many data structures have can be rendered in a
-    QGraphicsView
-
-
-* STL Extensions:
-
-  - The functor adaptors for argument binding and composition (bind_*, compose,
-    compose_shared, swap_*, negate, along with the helper functions set_arity_*
-    and Arity class and Arity_tag typedefs) which were provided by <CGAL/
-    functional.h> have been removed. Please use the better boost::bind mecanism
-    instead. The concept AdaptableFunctor has been changed accordingly such
-    that only a nested result_type is required.
-
-  - The accessory classes Twotuple, Threetuple, Fourtuple and Sixtuple are also
-    deprecated (use CGAL::array instead).
-
-  - CGAL::Triple and CGAL::Quadruple are in the process of being replaced by
-    boost::tuple. As a first step, we strongly recommend that you replace the
-    direct access to the data members (.first, .second, .third, .fourth), by
-    the get<i>() member function; and replace the make_triple and
-    make_quadruple maker functions by make_tuple.
-    This way, in a further release, we will be able to switch to boost::tuple
-    more easily.
-
-  - The class CGAL::Uncertain<> has been documented. It is typically used to
-    report uncertain results for predicates using interval arithmetic, and
-    other filtering techniques.
-
-
-* 2D Arrangements
-
-  - Changed the name of the arrangement package from Arrangement_2 to
-    Arrangement_on_surface_2 to reflect the potential capabilities of the
-    package to construct and maintain arrangements induced by curves embedded
-    on two dimensional surfaces in three space. Most of these capabilities will
-    become available only in future releases though.
-
-  - Enhanced the geometry traits concept to handle arrangements embedded on
-    surfaces. Each geometry-traits class must now define the
-    'Boundary_category' tag.
-
-  - Fixed a bug in Arr_polyline_traits_2.h, where the operator that compares
-    two curves failed to evaluate the correct result (true) when the curves are
-    different, but their graphs are identical.
-
-  - Permanently removed IO/Arr_postscript_file_stream.h and IO/
-    Polyline_2_postscript_file_stream.h, as they depend on obsolete features
-    and LEDA.
-
-  - Fixed several bugs in the arrangement demo and enhanced it. e.g., fixed
-    background color change, allowed vertex coloring , enabled "smart" color
-    selection, etc.
-
-  - Enhanced the arrangement demo with new features, such as allowing the
-    abortion of the merge function (de-select), updated the how-to description,
-    etc.
-
-  - Replace the functions CGAL::insert_curve(), CGAL::insert_curves(), CGAL::
-    insert_x_monotone_curve(), and CGAL::insert_x_monotone_curves() with a
-    single overloaded function CGAL::insert(). The former 4 functions are now
-    deprecated, and may no longer be supported in future releases.
-
-
-* Envelopes of Surfaces in 3D
-
-  - Fixed a bug in the computation of the envelope of unbounded planes caused
-    by multiple removals of vertices at infinity.
-
-
-* 2D Regularized Boolean Set-Operations
-
-  - Fixed a bug in connect_holes() that caused failures when connecting holes
-    touching the outer boundary.
-
-  - Fixed the concept GeneralPolygonSetTraits_2. Introduced two new concepts
-    GpsTraitsGeneralPolygon_2 and GpsTraitsGeneralPolygonWithHoles_2. Fixed the
-    definition of the two nested required types Polygon_2 and
-    Polygon_with_holes_2 of the GeneralPolygonSetTraits_2 concept. They must
-    model now the two new concepts above.
-
-  - Added a default template parameter to 'General_polygon_set_2' to allow
-    users to pass their specialized DCEL used to instantiate the underlying
-    arrangement.
-
-  - Enhanced the BOP demo to use multiple windows.
-
-
-* 2D Minkowski Sums
-
-  - Fixed a few bugs in the approximate offset function, making it robust to
-    highly degenerate inputs.
-
-  - Fixed a bug in the exact Minkowski sum computation when processing
-    degenerate inputs that induce overlapping of contiguous segments in the
-    convolution cycles.
-
-  - Optimized the approximate offset function (reduced time consumption up to a
-    factor of 2 in some cases).
-
-  - Added functionality to compute the offset (or to approximate the offset) of
-    a Polygon_with_holes_2 (and not just of a Polygon_2).
-
-  - Added the functionality to compute (or to approximate) the inner offset of
-    a polygon.
-
-
--------------------------------- Release 3.3.1 --------------------------------
-
-Release date: August 2007
-
-This is a bug fix release.
-
-
-* General
-
-  - Intel C++ 9 was wrongly recognized as unsupported by install_cgal.
-
-  - Added autolink (for Visual C++) for the CGALImageIO and CGALPDB libraries.
-
-  - Fixed bug in Memory_sizer when using more than 4GB of memory (64bit).
-
-
-* Number Types
-
-  - Fixed bug in FPU rounding mode macros (affected only the alpha
-    architecture).
-
-  - Fixed bug in MP_Float constructor from double for some particular values.
-
-  - Fixed bug in to_double(Lazy_exact_nt) sometimes returning NaN.
-
-
-* Kernel
-
-  - Fixed forgotten derivation in Circular_kernel_2::Has_on_2
-
-  - Added some missing functions in Bbox_3 compared to Bbox_2.
-
-
-* Skin Surface Meshing
-
-  - The new Skin Surface Meshing package had been forgotten in the list of
-    changes and the release announcement of CGAL 3.3: This package allows to
-    build a triangular mesh of a skin surface. Skin surfaces are used for
-    modeling large molecules in biological computing.
-
-
-* Arrangements
-
-  - Fixed a bug in the Arrangement_2 package in dual arrangement representation
-    for Boost graphs when reporting all halfedges of a face.
-
-  - Fixed a bug in the Arrangement sweep-line when using a specific polyline
-    configuration.
-
-  - Fixed bug in Arrangement_2 in walk along a line point location for
-    unbounded curves.
-
-  - Fixed bug in aggregated insertion to Arrangement_2.
-
-  - Fixed bug in Arrangment_2 class when inserting an unbounded curve from an
-    existing vertex.
-
-  - Fixed bug when dealing with a degenerate conic arc in Arr_conic_traits_2 of
-    the Arrangment package, meaning a line segment which is part of a
-    degenerate parabola/hyperbola.
-
-  - Fixed bug in the Bezier traits-class: properly handle line segments.
-    properly handle comparison near a vertical tangency.
-
-
-* 2D Polygon
-
-  - Fixed bug in degenerate case of Polygon_2::is_convex() for equal points.
-
-
-* 2D Triangulations
-
-  - Fixed bug in Regular_triangulation_2.
-
-
-* 3D Triangulations
-
-  - Added a circumcenter() function in the default Cell type parameter
-    Triangulation_ds_cell_base_3, so that the .dual() member function of
-    Delaunay still work as before, without requiring the explicit use of
-    Triangulation_cell_base.
-
-  - Added missing operator->() to Facet_circulator.
-
-
-* Interpolation
-
-  - Fixed bug in Interpolation 3D about the normalization coefficient
-    initialization.
-
-
-* 3D Boolean Operations on Nef Polyhedra
-
-  - Fixed bug in construction of Nef_polyhedron_3 from off-file. Now, always
-    the inner volume is selected.
-
-  - Fixed bug in conversion from Nef_polyhedron_3 to Polyhedron_3. Polyhedron_3
-    was not cleared at the beginning.
-
-  - Fixed bug in Nef_polyhedron_3 in update of indexes for construction of
-    external structure.
-
-
-* Third Party Libraries Shipped with CGAL
-
-  - TAUCS supports now 64 bits platforms.
-
-  - CAUTION: Since version 3.3.1, CGAL is no longer compatible with the
-    official release of TAUCS (currently 2.2). Make sure to use the version
-    modified by the CGAL project and available from the download section of
-    http://www.cgal.org.
-
-
--------------------------------- Release 3.3 --------------------------------
-
-Release date: May 2007
-
-Version 3.3 differs from version 3.2.1 in the platforms that are supported and
-in functionality. There have also been a number of bug fixes for this release.
-
-Additional supported platforms
-
-  - GNU g++ 4.1 and 4.2
-
-  - Intel C++ compiler 9
-
-  - Microsoft Visual C++ compiler 8.0
-
-
-The following platforms are no longer supported:
-
-  - Intel 8
-
-
-CGAL now supports Visual C++ "Checked iterators" as well as the debug mode of
-GNU g++'s STL (-D_GLIBCXX_DEBUG).
-
-CGAL now works around the preprocessor macros 'min' and 'max' defined in
-<windows.h> which were clashing with min/max functions.
-
-
-* Installation
-
-  - On Windows the libraries built in Developer Studio now have names which
-    encode the compiler version, the runtime and whether it was built in
-    release or debug mode. The libraries to link against are chosen with linker
-    pragmas in header files.
-
-  - On all platforms but Windows shared and static versions of the libraries
-    are generated
-
-
-* Manuals
-
-  - The Package Overview page now also hosts the precompiled demos.
-
-
-* Algebraic Foundations
-
-  - Algebraic Foundations (new package)
-    This package defines what algebra means for CGAL, in terms of concepts,
-    classes and functions. The main features are: (i) explicit concepts for
-    interoperability of types (ii) separation between algebraic types (not
-    necessarily embeddable into the reals), and number types (embeddable into
-    the reals).
-
-  - Number Types
-    Fixed_precision_nt and Filtered_exact number types have been removed.
-
-
-
-* Kernels
-
-  - 2D Circular Kernel
-    Efficiency improved through geometric filtering of predicates, introduced
-    with the filtered kernel Filtered_bbox_circular_kernel_2<.>, and also
-    chosen for the predefined kernel Exact_circular_kernel_2.
-
-  - Linear Kernel
-    Exact_predicates_exact_constructions_kernel memory and run-time
-    improvements through usage of lazy geometric constructions instead of lazy
-    arithmetic.
-
-
-
-* Data Structures and Algorithms
-
-  - Surface Mesh Simplification (new package)
-    This package provides a mesh simplification framework using edge collapse
-    operations, and provides the Turk/Lindstrom simplification algorithm.
-
-  - Skin Surface Meshing (new package)
-    This package allows to build a triangular mesh of a skin surface. Skin
-    surfaces are used for modeling large molecules in biological computing. The
-    surface is defined by a set of balls, representing the atoms of the
-    molecule, and a shrink factor that determines the size of the smooth
-    patches gluing the balls together.
-
-  - Estimation of Local Differential Properties (new package)
-    This package allows to compute local differential quantities of a surface
-    from a point sample
-
-  - Approximation of Ridges and Umbilics on Triangulated Surface Meshes (new
-    package)
-    This package enables the approximation of differential features on
-    triangulated surface meshes. Such curvature related features are lines:
-    ridges or crests, and points: umbilics.
-
-  - Envelopes of Curves in 2D (new package)
-    This package contains two sets of functions that construct the lower and
-    upper envelope diagram for a given range of bounded or unbounded curves.
-
-  - Envelopes of Surfaces in 3D (new package)
-    This package contains two sets of functions that construct the lower and
-    upper envelope diagram for a given range of bounded or unbounded surfaces.
-    The envelope diagram is realized as a 2D arrangement.
-
-  - Minkowski Sums in 2D (new package)
-    This package contains functions for computing planar Minkowski sums of two
-    closed polygons, and for a polygon and a disc (an operation also known as
-    offsetting or dilating a polygon). The package also contains an efficient
-    approximation algorithm for the offset computation, which provides a
-    guaranteed approximation bound while significantly expediting the running
-    times w.r.t. the exact computation procedure.
-
-  - Surface Mesh Parametrization
-    Added Jacobi and SSOR preconditioners to OpenNL solver, which makes it much
-    faster and more stable.
-
-  - 2D Arrangements
-
-      - Added support for unbounded curves.
-
-      - Added a traits class that supports bounded and unbounded linear
-        objects, namely lines, rays and line segments.
-
-      - Added traits classes that handle circular arcs based on the circular
-        kernel.
-
-      - Added a traits class that supports Bezier curves.
-
-      - Enhanced the traits class that supports rational functions to handle
-        unbounded (as well as bounded) arcs
-
-      - Added a free function called decompose() that produces the symbolic
-        vertical decomposition of a given arrangement, performing a batched
-        vertical ray-shooting query from all arrangement vertices.
-
-      - Fixed a memory leak in the sweep-line code.
-
-      - Fixed a bug in computing the minor axis of non-degenerate hyperbolas.
-
-
-  - Boolean Set Operations
-
-      - Added the DCEL as a default template parameter to the
-        General_polygon_set_2 and Polygon_set_2 classes. This allows users to
-        extend the DCEL of the underlying arrangement.
-
-      - Added a function template called connect_holes() that connects the
-        holes in a given polygon with holes, turning it into a sequence of
-        points, where the holes are connceted to the outer boundary using zero-
-        width passages.
-
-      - Added a non-const function member to General_polygon_set_2 that obtains
-        the underlying arrangement.
-
-
-  - 2D and 3D Triangulations
-
-      - The constructors and insert member functions which take an iterator
-        range perform spatial sorting in order to speed up the insertion.
-
-
-  - Optimal Distances
-
-      - Polytope_distance_d: has support for homogeneous points; bugfix in fast
-        exact version.
-
-
-  - Bounding Volumes
-
-      - Min_annulus_d has support for homogeneous points; bugfix in fast exact
-        version.
-
-
-
-
-* Support Library
-
-  - CGAL and the Boost Graph Library (BGL) (new package)
-    This package provides the glue layer for several CGAL data structures such
-    that they become models of the BGL graph concept.
-
-  - Spatial Sorting (new package)
-    This package allows to sort points and other objects along a Hilbert curve
-    which can improve the performance of algorithms like triangulations. It is
-    used by the constructors of the triangulation package which have an
-    iterator range of points as argument.
-
-  - Linear and Quadratic Programming Solver (new package)
-    This package contains algorithms for minimizing linear and convex quadratic
-    functions over polyhedral domains, described by linear equations and
-    inequalities.
-
-
--------------------------------- Release 3.2.1 --------------------------------
-
-Release date: July 2006
-
-This is a bug fix release
-
-
-* Number Types
-
-  - Fix MP_Float constructor which crashed for some values.
-
-
-* Kernel
-
-  - Rename Bool to avoid a clash with a macro in X11 headers.
-
-
-* Arrangement
-
-  - Derived the Arr_segment_traits_2 Arrangement_2 traits class from the
-    parameterized Kernel. This allows the use of this traits class in an
-    extended range of applications that require kernel objects and operations
-    on these objects beyond the ones required by the Arrangement_2 class
-    itself.
-
-  - Fixed a compilation bug in the code that handles overlay of arrangements
-    instantiated with different DCEL classes.
-
-  - Fixed a couple of bugs in the implementation of the Trapezoidal RIC point-
-    location strategy
-
-
-* Triangulation, Alpha Shapes
-
-  - Qualify calls to filter_iterator with "CGAL::" to avoid overload
-    ambiguities with Boost's filter_iterator.
-
-
-* Surface Mesher
-
-  - Fixed a bug in iterators of the class template
-    Surface_mesh_complex_2_in_triangulation_3
-
-
-* Surface Mesh Parametrisation
-
-  - Updated the precompiled taucs lib
-
-
-* Kinetic Data Structures
-
-  - Fixed problems caused by old versions of gcc being confused by operator!
-    and operator int()
-
-  - Added point removal support to the Active_objects_vector
-
-
--------------------------------- Release 3.2 --------------------------------
-
-Release date: May 2006
-
-Version 3.2 differs from version 3.1 in the platforms that are supported and in
-functionality. There have also been a number of bug fixes for this release.
-
-The following platforms are no longer supported:
-
-  - SunPro CC versions 5.4 and 5.5 on Solaris
-
-  - SGI Mips Pro
-
-
-For Visual C++ the installation scripts choose the multi-threaded dynamically
-linked runtime (/MD). Before it was the single-threaded static runtime (/ML).
-
-
-* Installation
-
-  - The install tool tries to find third party libraries at "standard"
-    locations.
-
-  - Installers for Apple, Windows, and rpms.
-
-
-* Manuals
-
-  - User and Reference manual pages of a package are in the same chapter
-
-
-* Kernels
-
-  - 2D Circular Kernel (new package)
-    This package is an extension of the linear CGAL Kernel. It offers
-    functionalities on circles, circular arcs and line segments in the plane.
-
-
-
-* Data Structures and Algorithms
-
-  - 2D Regularized Boolean Set-Operations (new package)
-    This package consists of the implementation of Boolean set-operations on
-    point sets bounded by weakly x-monotone curves in 2-dimensional Euclidean
-    space. In particular, it contains the implementation of regularized Boolean
-    set-operations, intersection predicates, and point containment predicates.
-
-  - 2D Straight Skeleton and Polygon Offsetting (new package)
-    This package implements an algorithm to construct a halfedge data structure
-    representing the straight skeleton in the interior of 2D polygons with
-    holes and an algorithm to construct inward offset polygons at any offset
-    distance given a straight skeleton.
-
-  - 2D Voronoi Diagram Adaptor (new package)
-    This package provides an adaptor that adapts a 2-dimensional triangulated
-    Delaunay graph to the corresponding Voronoi diagram, represented as a
-    doubly connected edge list (DCEL) data structure. The adaptor has the
-    ability to automatically eliminate, in a consistent manner, degenerate
-    features of the Voronoi diagram, that are artifacts of the requirement that
-    Delaunay graphs should be triangulated even in degenerate configurations.
-    Depending on the type of operations that the underlying Delaunay graph
-    supports, the adaptor allows for the incremental or dynamic construction of
-    Voronoi diagrams and can support point location queries.
-
-  - 3D Surface Mesher (new package)
-    This package provides functions to generate surface meshes that interpolate
-    smooth surfaces. The meshing algorithm is based on Delaunay refinement and
-    provides some guarantees on the resulting mesh: the user is able to control
-    the size and shape of the mesh elements and the accuracy of the surface
-    approximation. There is no restriction on the topology and number of
-    components of input surfaces. The surface mesher may also be used for non
-    smooth surfaces but without guarantee.
-    Currently, implementations are provided for implicit surfaces described as
-    the zero level set of some function and surfaces described as a gray level
-    set in a three-dimensional image.
-
-
-  - 3D Surface Subdivision Methods (new package)
-    Subdivision methods recursively refine a control mesh and generate points
-    approximating the limit surface. This package consists of four popular
-    subdivision methods and their refinement hosts. Supported subdivision
-    methods include Catmull-Clark, Loop, Doo-Sabin and sqrt(3) subdivisions.
-    Their respective refinement hosts are PQQ, PTQ, DQQ and sqrt(3)
-    refinements. Variations of those methods can be easily extended by
-    substituting the geometry computation of the refinement host.
-
-  - Planar Parameterization of Triangulated Surface Meshes (new package)
-    Parameterizing a surface amounts to finding a one-to-one mapping from a
-    suitable domain to the surface. In this package, we focus on triangulated
-    surfaces that are homeomorphic to a disk and on piecewise linear mappings
-    into a planar domain. This package implements some of the state-of-the-art
-    surface mesh parameterization methods, such as least squares conformal
-    maps, discrete conformal map, discrete authalic parameterization, Floater
-    mean value coordinates or Tutte barycentric mapping.
-
-  - Principal Component Analysis (new package)
-    This package provides functions to compute global informations on the shape
-    of a set of 2D or 3D objects such as points. It provides the computation of
-    axis-aligned bounding boxes, centroids of point sets, barycenters of
-    weighted point sets, as well as linear least squares fitting for point sets
-    in 2D, and point sets as well as triangle sets in 3D.
-
-  - 2D Placement of Streamlines (new package)
-    Visualizing vector fields is important for many application domains. A good
-    way to do it is to generate streamlines that describe the flow behaviour.
-    This package implements the "Farthest Point Seeding" algorithm for placing
-    streamlines in 2D vector fields. It generates a list of streamlines
-    corresponding to an input flow using a specified separating distance. The
-    algorithm uses a Delaunay triangulation to model objects and adress
-    different queries, and relies on choosing the centers of the biggest empty
-    circles to start the integration of the streamlines.
-
-  - Kinetic Data Structures (new package)
-    Kinetic data structures allow combinatorial structures to be maintained as
-    the primitives move. The package provides implementations of kinetic data
-    structures for Delaunay triangulations in two and three dimensions, sorting
-    of points in one dimension and regular triangulations in three dimensions.
-    The package supports exact or inexact operations on primitives which move
-    along polynomial trajectories.
-
-  - Kinetic Framework (new package)
-    Kinetic data structures allow combinatorial geometric structures to be
-    maintained as the primitives move. The package provides a framework to ease
-    implementing and debugging kinetic data structures. The package supports
-    exact or inexact operations on primitives which move along polynomial
-    trajectories.
-
-  - Smallest Enclosing Ellipsoid (new package)
-    This algorithm is new in the chapter Geometric Optimisation.
-
-  - 2D Arrangement (major revision)
-    This package can be used to construct, maintain, alter, and display
-    arrangements in the plane. Once an arrangement is constructed, the package
-    can be used to obtain results of various queries on the arrangement, such
-    as point location. The package also includes generic implementations of two
-    algorithmic frameworks, that are, computing the zone of an arrangement, and
-    line-sweeping the plane, the arrangements is embedded on.
-    Arrangements and arrangement components can also be extended to store
-    additional data. An important extension stores the construction history of
-    the arrangement, such that it is possible to obtain the originating curve
-    of an arrangement subcurve.
-
-
-  - Geometric Optimisation (major revision)
-    The underlying QP solver which is the foundation for several algorithms in
-    the Geometric Optimisation chapter has been completely rewritten.
-
-  - 3D Triangulation (new functionality)
-    Regular_triangulation_3 now offers vertex removal.
-
-
-
--------------------------------- Release 3.1 --------------------------------
-
-Release date: December 2004
-
-Version 3.1 differs from version 3.0 in the platforms that are supported and in
-functionality. There have also been a number of bug fixes for this release.
-
-Additional supported platforms:
-
-  - MS Visual C++, version 7.3. and 8.0
-
-  - Intel 8.0
-
-  - SunPro CC versions 5.4 and 5.5 on Solaris
-
-  - GNU g++ versions 3.4 on Linux, Solaris, Irix, cygwin, FreeBSD, and MacOS X
-
-  - Darwin (MacOS X) and IA64/Linux support.
-
-
-The following platforms are no longer supported:
-
-  - MS Visual C++, version 7.0
-
-
-The following functionality has been added or changed:
-
-
-
-* All
-
-  - The CORE 1.7 library for exact real arithmetic.
-
-  - Updated GMP to 4.1.3.
-
-  - Added Mpfr a library for multiple-precision floating-point computations
-    with exact rounding.
-
-  - Added Boost 1.32.0 (only include files).
-
-
-* Installation
-
-  - new option --disable-shared to omit building libCGAL.so.
-
-
-* Manuals
-
-  - Merged all major manuals in one multi-part manual, which provides now
-    cross-links between the CGAL Kernel, the CGAL Basic Library, and the CGAL
-    Support Library HTML manuals.
-
-  - Improved layout.
-
-
-* Kernels
-
-  - Improved efficiency of filtered kernels.
-
-  - More predicates and constructions.
-
-
-* Basic Library
-
-  - 2D Segment Voronoi Diagram (new package)
-    A data structure for Voronoi diagrams of segments in the plane under the
-    Euclidean metric. The Voronoi edges are arcs of straight lines and
-    parabolas. The algorithm provided in this package is incremental.
-
-  - 2D Conforming Triangulations and Meshes (new package)
-    An implementation of Shewchuk's algorithm to construct conforming
-    triangulations and 2D meshes.
-
-  - 3D Boolean Operations on Nef Polyhedra (new package)
-    A new class (Nef_polyhedron_3) representing 3D Nef polyhedra, a boundary
-    representation for cell-complexes bounded by halfspaces that supports
-    boolean operations and topological operations in full generality including
-    unbounded cells, mixed dimensional cells (e.g., isolated vertices and
-    antennas). Nef polyhedra distinguish between open and closed sets and can
-    represent non-manifold geometry.
-
-  - 2D and Surface Function Interpolation (new package)
-    This package implements different methods for scattered data interpolation:
-    Given measures of a function on a set of discrete data points, the task is
-    to interpolate this function on an arbitrary query point. The package
-    further offers functions for natural neighbor interpolation.
-
-  - Planar Nef polyhedra embedded on the sphere (new package)
-    A new class (Nef_polyhedron_S2) designed and supported mainly to represent
-    sphere neighborhoods around vertices of the three- dimensional Nef
-    polyhedra.
-
-  - Box_intersection_d (new package)
-    A new efficient algorithm for finding all intersecting pairs for large
-    numbers of iso-oriented boxes, i.e., typically these will be bounding boxes
-    of more complicated geometries. Useful for (self-) intersection tests of
-    surfaces etc.
-
-  - 2D Snap Rounding (new package)
-    Snap Rounding is a well known method for converting arbitrary-precision
-    arrangements of segments into a fixed-precision representation. In the
-    study of robust geometric computing, it can be classified as a finite
-    precision approximation technique. Iterated Snap Roundingis a modification
-    of Snap Rounding in which each vertex is at least half-the-width-of-a-pixel
-    away from any non-incident edge. This package supports both methods.
-
-  - 3D Triangulations
-
-      - Triangulation_3: added operator==(),removed push_back() and
-        copy_triangulation().
-
-      - Delaunay_3 : added nearest_vertex(), move_point(), vertices_in_conflict
-        ().
-
-      - Regular_3 : added filtered traits class, and nearest_power_vertex().
-
-
-  - Planar_map and Arrangement_2
-
-      - The interface of the two traits functions that compute the intersection
-        of two given curves changed. The functions
-        nearest_intersection_to_right() and nearest_intersection_to_left()
-        return an object of type CGAL::Object that represents either an empty
-        intersection, a point, or an overlapping subcurve.
-
-      - Requirements to define two binary tags were added to the traits concept
-        of the Planar_map as follows: Has_left_category - indicates whether the
-        functions curves_compare_y_at_x_left() and nearest_intersection_to_left
-        () are implemented in the traits model. Has_reflect_category -
-        indicates whether the functions point_reflect_in_x_and_y() and
-        curve_reflect_in_x_and_y() are implemented in the traits model. They
-        can be used as an alternative to the two function in the previous item.
-
-      - A new constructor of the Segment_cached_2 type that represents a
-        segment in the Arr_segment_cached_traits_2 traits class was introduced.
-        The new constructor accepts the segment endpoints as well as the
-        coefficients of the underlying line.
-
-      - A new version of the conic-arc traits, based on CORE version 1.7 was
-        introduced. This new traits class makes use of CORE's rootOf() operator
-        to compute the intersection points in the arrangement, making its code
-        much simpler and more elegant than the previous version. In addition,
-        new constructors for conic arcs are provided. The new traits class
-        usually performs about 30% faster than the version included in CGAL 3.0
-
-      - The traits class that handles continuous piecewise linear curves,
-        namely Arr_polyline_traits_2, was rewritten. The new class is
-        parametrized with a traits class that handles segments, say
-        Segment_traits. The polyline curve defined within the
-        Arr_polyline_traits_2 class is implemented as a vector of segments of
-        type Segment_traits::Curve_2.
-
-      - A meta traits class, namely Arr_curve_data_traits_2, that extends the
-        curve type of the planar-map with arbitrary additional data was
-        introduced. It should be instantiated with a regular traits-class and a
-        class that contains all extraneous data associated with a curve.
-
-      - The class that represents the trapezoidal-decomposition point location
-        strategy was renamed to Pm_trapezoid_ric_point_location.
-
-      - The Arrangement demo was rewritten. It covers many more features, has a
-        much better graphical user interface, and comes with online
-        documentation.
-
-      - Few bugs in the sweep-line module related to overlapping vertical
-        segments were fixed. This module is used by the aggregate insert method
-        that inserts a collection of curves at once.
-
-
-  - Triangulation_2
-
-      - added a filtered trait class in the regular triangulation
-
-      - added split and join operations in the triangulation data structure
-        class
-
-
-  - Alpha_shapes_3
-
-      - major changes in the implementation of the class Alpha_shapes_3.
-
-      - New implementation results in a true GENERAL mode allowing null and
-        negative alpha-values. It also fixed the edges classification bug and
-        introduces a classification of vertices.
-
-
-  - Min_ellipse_2
-
-      - made access to approximate double representation public
-
-      - fixed bugs in conversion to double representation
-
-      - added is_circle() method
-
-      - minor performance improvements
-
-
-  - Min_sphere_of_spheres_d:
-
-      - The models Min_sphere_of_spheres_d_traits_2<K,FT,UseSqrt,Algorithm>,
-        Min_sphere_of_spheres_d_traits_3<K,FT,UseSqrt,Algorithm>, and
-        Min_sphere_of_spheres_d_traits_d<K,FT,Dim,UseSqrt,Algorithm> of concept
-        MinSphereOfSpheresTraits now represent a sphere as a std::
-        pair<Point,Radius> (and not any more as a CGAL::
-        Weighted_point<Point,Weight>)
-
-      - Internal code cleanup; in particular, implementation details don't
-        pollute the namespace CGAL anymore
-
-
-  - Polyhedron_3
-
-      - New Tutorial on CGAL Polyhedron for Subdivision Algorithms with
-        interactive demo viewer in source code available.
-
-      - Added example program for efficient self-intersection test. - Added
-        small helper functions, such as vertex_degree, facet_degree, edge_flip,
-        and is_closed.
-
-
-  - Apollonius Graph (Voronoi of Circles)
-
-      - Reduced memory requirements by approximately a factor of two.
-
-
-
--------------------------------- Release 3.0.1 --------------------------------
-
-Release date: February 2004
-
-This is a bug-fix release. No new features have been added in 3.0.1. Here is
-the list of bug-fixes.
-
-
-* Polyhedral Surface
-
-  - Fixed wrong include files for output support. Added example.
-
-
-* Planar_map
-
-  - Fixed the so called "Walk-along-a-line" point-location strategy to
-    correctly handle a degenerate case.
-
-
-* 2D Triangulation
-
-  - added missing figure in html doc
-
-  - in Line_face_circulator_2.h:
-    Fixed changes made to support handles with a typedef to iterator. The fix
-    concerns operator== and !=.
-
-
-* Alpha_shapes_3
-
-  - fixed classify member function for edges.
-
-
-* Number types
-
-  - Lazy_exact_nt:
-
-      - added the possibility to select the relative precision of to_double()
-        (by default 1e-5). This should fix reports that some circumcenters
-        computations have poor coordinates, e.g. nan).
-
-      - when exact computation is triggered, the interval is recomputed, this
-        should speed up some kinds of computations.
-
-
-  - to_interval(Quotient<MP_Float>): avoid spurious overflows.
-
-
-* Kernel
-
-  - missing acknowledgment in the manual and minor clarification of
-    intersection() documentation.
-
-
--------------------------------- Release 3.0 --------------------------------
-
-Release date: October 2003
-
-Version 3.0 differs from version 2.4 in the platforms that are supported and in
-functionality. There have also been a number of bug fixes for this release.
-
-The license has been changed to either the LGPL (GNU Lesser General Public
-License v2.1) or the QPL (Q Public License v1.0) depending on each package. So
-CGAL remains free of use for you, if your usage meets the criteria of these
-licenses, otherwise, a commercial license has to be purchased from
-GeometryFactory.
-
-Additional supported platforms:
-
-  - MS Visual C++, version 7.1.
-
-  - SunPro CC versions 5.4 and 5.5 on Solaris
-
-  - GNU g++ versions 3.2 and 3.3 on Linux, Solaris, Irix, cygwin, and FreeBSD.
-
-  - MipsPRO CC 7.30 and 7.40 with both the n32 and n64 ABIs.
-
-
-The following platforms are no longer supported:
-
-  - MS Visual C++, version 6.
-
-  - GNU g++ 2.95.2 (2.95.3 is still supported)
-
-  - Kai C++ and Borland C++, all versions
-
-
-The following functionality has been added or changed:
-
-All
-
-  - The CORE library for exact computations is now distributed as part of CGAL
-    as well.
-
-
-
-* Kernels
-
-  - 3 typedefs have been added to ease the choice of a robust and fast kernel:
-
-      - Exact_predicates_inexact_constructions_kernel
-
-      - Exact_predicates_exact_constructions_kernel
-
-      - Exact_predicates_exact_constructions_kernel_with_sqrt
-
-
-  - Progress has been made towards the complete adaptability and extensibility
-    of our kernels.
-
-  - New faster Triangle_3 intersection test routines.
-    (see Erratum)
-
-  - Added a Kernel concept archetype to check that generic algorithms don't use
-    more functionality than they should.
-
-  - A few more miscellaneous functions.
-
-
-* Basic Library
-
-  - 2D Apollonius Graph (new package)
-    Algorithms for computing the Apollonius graph in two dimensions. The
-    Apollonius graph is the dual of the Apollonius diagram, also known as the
-    additively weighted Voronoi diagram. The latter can be thought of as the
-    Voronoi diagram of a set of circles under the Euclidean metric, and it is a
-    generalization of the standard Voronoi diagram for points. The algorithms
-    provided are dynamic.
-
-  - dD Min Sphere of Spheres (new package)
-    Algorithms to compute the smallest enclosing sphere of a given set of
-    spheres in Rd. The package provides an algorithm with maximal expected
-    running time O(2O(d) n) and a fast and robust heuristic (for dimension less
-    than 30).
-
-  - Spatial Searching (new package)
-    Provides exact and approximate distance browsing in a set of points in d-
-    dimensional space using implementations of algorithms supporting:
-
-      - both nearest and furthest neighbor searching
-
-      - both exact and approximate searching
-
-      - (approximate) range searching
-
-      - (approximate) k-nearest and k-furthest neighbor searching
-
-      - (approximate) incremental nearest and incremental furthest neighbor
-        searching
-
-      - query items representing points and spatial objects.
-
-
-  - Kd-tree
-    this package is deprecated, its documentation is removed. It is replaced by
-    the Spatial Searching package.
-
-  - Largest_empty_rectangle_2
-    Given a set of points P in the plane, the class
-    Largest_empty_iso_rectangle_2 is a data structure that maintains an iso-
-    rectangle with the largest area among all iso-rectangles that are inside a
-    given iso-rectangle bounding box, and that do not contain any point of the
-    point set P.
-
-  - 2D Triangulation and 3D Triangulation
-
-      - The classes Triangulation_data_structure_2 (and 3), which implements
-        the data structure for 2D triangulation class, now makes use of CGAL::
-        Compact_container (see Support Library section below).
-
-      - The triangulation classes use a Rebind mecanism to provide the full
-        flexibility on Vertex and Face base classes. This means that it is
-        possible for the user to derive its own Face of Vertex base class,
-        adding a functionality that makes use of types defined by the
-        triangulation data structure like Face_handle or Vertex_handle.
-
-      - New classes Triangulation_vertex_base_with_info_2 (and 3) and
-        Triangulation_face_base_with_info_2 (and 3) to make easier the
-        customisation of base classes in most cases.
-
-
-  - 2D Triangulation
-
-      - Regular triangulation provides an easy access to hidden points.
-
-      - The Triangulation_hierarchy_2, which provide an efficient location data
-        structure, can now be used with any 2D triangulation class plugged in
-        (including Regular triangulations).
-
-
-  - 3D Triangulation
-
-      - faster vertex removal function in Delaunay_triangulation_3.
-
-      - Delaunay_triangulation_3 is now independent of the order of insertions
-        of the points (in case of degenerate cosphericity).
-
-      - Regular_triangulation_3 now hides vertices (and updates itself) when
-        inserting a coinciding point with greater weight. This required a new
-        predicate.
-
-      - deprecated functions: copy_triangulation(), push_back(),
-        set_number_of_vertices().
-
-      - Triangulation_3 now gives non-const access to the data structure.
-
-
-  - Interval Skip List (new package)
-    An interval skip list is a data strucure for finding all intervals that
-    contain a point, and for stabbing queries, that is for answering the
-    question whether a given point is contained in an interval or not.
-
-  - Planar Maps and Arrangements
-    The changes concern mainly the traits classes.
-       1. New traits hierarchy and interface: The set of requirements was made
-          sound and complete. A couple of requirements were eliminated, few
-          others were redefined, and some were renamed. A hierarchy of three
-          traits classes for the Planar_map_2, Planar_map_with_intersections_2,
-          and Arrangement_2 types was established to include only the necessary
-          requirements at each level. It was determined that for the aggregate
-          insertion- operation based on a sweep-line algorithm only a subset of
-          the requirements is needed. Preconditions were added where
-          appropriate to tighten the requirements further.
-          The following functions have been renamed:
-
-            - point_is_same() renamed to point_equal()
-
-            - curve_is_same() renamed to curve_equal()
-
-            - curve_is_in_x_range() renamed to point_in_x_range()
-
-            - curve_compare_at_x() renamed to curves_compare_y_at_x()
-              Furthermore, a precondition has been added that the reference
-              point is in the x-range of both curves.
-
-            - curve_compare_at_x_right() renamed to
-              curves_compare_y_at_x_to_right(). Furthermore, a precondition has
-              been added that both curves are equal at the reference point and
-              defined to its right.
-
-            - curve_compare_at_x_left() renamed to
-              curves_compare_y_at_x_to_left(). Furthermore, a precondition has
-              been added that both curves are equal at the reference point and
-              defined to its right.
-
-            - curve_get_point_status() renamed to curve_compare_y_at_x().
-              Furthermore, a precondition has been added that the point is in
-              the x-range of the curve. Consequently, the function now returns
-              a Comparison_result (instead of a special enum).
-
-            - make_x_monotone() renamed to curve_make_x_monotone() See more
-              details below.
-
-            - curve_flip() renamed to curve_opposite()
-
-          The following functions have been removed:
-
-            - curve_is_between_cw()
-
-            - point_to_left()
-
-            - point_to_right()
-
-            - is_x_monotone()
-
-            - point_reflect_in_x_and_y()
-
-            - curve_reflect_in_x_and_y()
-
-            - do_intersect_to_right()
-
-            - do_intersect_to_left()
-
-          Most functions, are required by the PlanarMapTraits_2 concept, except
-          for the make_x_monotone(), nearest_intersection_to_right(),
-          nearest_intersection_to_left(), curves_overlap() and curve_opposite
-          (). PlanarMapWithIntersectionsTraits_2 requires all these functions,
-          except curve_opposite(), needed only by the ArrangementTraits_2
-          concept.
-
-          Furthermore, the two functions curve_compare_at_x_left() and
-          nearest_intersection_to_left() can be omitted, if the two functions
-          point_reflect_in_x() and curve_reflect_in_x() are implemented.
-          Reflection can be avoided, if the two _left functions are supplied.
-
-       2. The type X_curve_2 of the PlanarMapWithIntersectionsTraits_2 concept
-          was renamed to X_monotone_curve_2, and the distinction between this
-          type and the Curve_2 type was made firm. The method is_x_monotone()
-          of the PlanarMapWithIntersectionsTraits_2 concept was removed. The
-          related method curve_make_x_monotone() is now called for each input
-          curve of type Curve_2 when curves are inserted into a
-          Planar_map_with_intersections_2 to subdivide the input curve into x-
-          monotone sub-curves (and in case the curve is already x-monotone,
-          this function is responsible for casting it to an x-monotone curve).
-       3. New and improved traits classes:
-       4. Conic traits - Arr_conic_traits_2 Support finite segments of
-          ellipses, hyperbolas and parabolas, as well as line segments. The
-          traits require an exact real number- type, such as leda_real or
-          CORE::Expr.
-       5. Segment cached traits - Arr_segment_cached_traits_2 This class uses
-          an improved representation for segments that helps avoiding cascaded
-          computations, thus achieving faster running times. To work properly,
-          an exact rational number-type should be used.
-       6. Polyline traits - Arr_polyline_traits_2 The polyline traits class has
-          been reimplemented to work in a more efficient, generic manner. The
-          new class replaces the obsolete Arr_polyline_traits class. It is
-          parameterized with a segment traits class.
-       7. Hyperbola and segment traits - Arr_hyper_segment_traits_2 Supports
-          line segments and segments of canonical hyperbolas. This is the type
-          of curves that arise when projecting segments in three-space
-          rotationally around a line onto a plane containing the line. Such
-          projections are often useful in CAD/CAM problems.
-       8. Removed old traits class:
-
-            - The models of the PlanarMapWithIntersectionsTraits_2 concept
-              below became obsolete, as the new conic traits, namely
-              Arr_conic_traits_2, supports the same functionality and is much
-              more efficient.
-
-                - Arr_circles_real_traits
-
-                - Arr_segment_circle_traits
-
-
-            - The segment traits class and the new polyline traits class were
-              reimplemented using standard CGAL-kernel calls. This essentially
-              eliminated the corresponding leda traits classes, namely:
-
-                - Pm_leda_segment_traits_2
-
-                - Arr_leda_segment_traits_2
-
-                - Arr_leda_polyline_traits
-
-              With the use of the Leda_rat_kernel new external package the same
-              functionality can be achieved with less overhead and more
-              efficiency.
-
-       9. Sweep Line
-
-            - The Sweep_line_2 package was reimplemented. As a consequence it
-              is much more efficient, its traits is tighter (namely neither the
-              two _left nor the reflection functions are required), and its
-              interface has changed a bit.
-                 1. The following global functions have been removed:
-
-                      - sweep_to_produce_subcurves_2()
-
-                      - sweep_to_produce_points_2()
-
-                      - sweep_to_construct_planar_map_2()
-
-                    Instead, the public methods of the Sweep_line_2 class
-                    listed below were introduced:
-
-                      - get_subcurves() - Given a container of curves, this
-                        function returns a list of curves that are created by
-                        intersecting the input curves.
-
-                      - get_intersection_points() - Given a range of curves,
-                        this function returns a list of points that are the
-                        intersection points of the curves.
-
-                      - get_intersecting_curves() - Given a range of curves,
-                        this function returns an iterator to the beginning of a
-                        range that contains the list of curves for each
-                        intersection point between any two curves in the
-                        specified range.
-
-                 2. It is possible to construct a planar map with intersections
-                    (or an arrangement) by inserting a range of curves into an
-                    empty map. This will invoke the sweep-line process to
-                    construct the map more efficiently.
-
-            - New interface functions to the Planar_map_with_intersections_2
-              class. The Planar_map_with_intersections_2 class maintains a
-              planar map of input curves that possibly intersect each other and
-              are not necessarily x-monotone. If an input curve, or a set of
-              input curves, are known to be x-monotone and pairwise disjoint,
-              the new functions below can be used to insert them into the map
-              efficiently.
-
-
-  - Polyhedral Surface
-
-      - The old design that was deprecated since CGAL 2.3 has been removed.
-
-      - Class Polyhedron_incremental_builder_3:
-
-          - Renamed local enum ABSOLUTE to ABSOLUTE_INDEXING, and RELATIVE to
-            RELATIVE_INDEXING to avoid conflicts with similarly named macros of
-            another library.
-
-          - Changed member functions add_vertex(), begin_facet(), and end_facet
-            () to return useful handles.
-
-          - Added test_facet() to check facets for validity before adding them.
-
-          - Added vertex( size_t i) to return Vertex_handle for index i.
-
-
-
-  - Halfedge Data Structure
-
-      - The old design that was deprecated since CGAL 2.3 has been removed.
-
-
-
-* Support Library
-
-  - New container class Compact_container, which (roughly) provides the
-    flexibility of std::list, with the memory compactness of std::vector.
-
-  - Geomview_stream: added a function gv.draw_triangles(InputIterator begin,
-    InputIterator end) which draws a set of triangles much more quickly than
-    one by one.
-
-  - Number types:
-
-      - number types are now required to provide a function: std::pair<double,
-        double> to_interval(const NT &).
-
-      - number types are now required to provide mixed operators with "int".
-
-      - CLN support removed.
-
-      - faster square() for MP_Float.
-
-      - added Gmp_q.
-
-
-  - Qt_widget:
-
-      - New classes:
-
-          - Qt_help_window: provides a simple way to show some helpful
-            information about a demo as an HTML page.
-
-          - Qt_widget_history: provides basic functionality to manipulate
-            intervals of Qt_widget class. The current visible area of Qt_widget
-            is mapped to an interval. Each interval could be stored in the
-            Qt_widget_history object. So you can use this object to navigate in
-            history. It is mostly used by Qt_widget_standard_toolbar.
-
-
-      - Changes:
-
-          - Qt_widget_standard_toolbar: is derived from QToolBar class, so pay
-            attention to modify your code, if you used this class. Some public
-            methods were introduced to control the history object that the
-            toolbar use to navigate.
-
-          - the icons are now part of libCGALQt.
-
-
-      - Deprecated members of Qt_widget:
-
-          - add_to_history(), clear_history(), back(), forth(): use forward(),
-            back() and clear_history() of the Qt_widget_standard_toolbar
-            instead.
-
-          - custom_redraw(): use redraw_on_back() and redraw_on_front()
-            instead.
-
-
-      - Optimizations: the output operators of the following classes have been
-        optimized:
-
-          - CGAL::Segment_2 (now tests for intersection with the drawing area)
-
-          - CGAL::Triangle_2 (now tests for intersection with the drawing area)
-
-          - CGAL::Triangulation_2 (is optimized for faster display on zooming)
-
-
-
-
-* Erratum in the Kernel manual
-
-  - Intersection test routines
-    The documentation of CGAL::do_intersect should mention, for the 3D case:
-    Also, in three-dimensional space Type1 can be
-
-      - either Plane_3<Kernel>
-
-      - or Triangle_3<Kernel>
-
-    and Type2 any of
-
-      - Plane_3<Kernel>
-
-      - Line_3<Kernel>
-
-      - Ray_3<Kernel>
-
-      - Segment_3<Kernel>
-
-      - Triangle_3<Kernel>
-
-
-    In the same way, for Kernel::DoIntersect_3:
-    for all pairs Type1 and Type2, where the type Type1 is
-
-      - either Kernel::Plane_3
-
-      - or Kernel::Triangle_3
-
-    and Type2 can be any of the following:
-
-      - Kernel::Plane_3
-
-      - Kernel::Line_3
-
-      - Kernel::Ray_3
-
-      - Kernel::Segment_3
-
-      - Kernel::Triangle_3
-
-
-    Philippe Guigue (INRIA Sophia-Antipolis) should be mentioned as one of the
-    authors.
-
-
-
--------------------------------- Release 2.4 --------------------------------
-
-Release date: May 2002
-
-Version 2.4 differs from version 2.3 in the platforms that are supported and in
-functionality. There have also been a number of bug fixes for this release.
-
-Additional supported platforms:
-
-  - Microsoft Visual C++, version 7.
-
-  - SunPro 5.3 (with patch 111685-05) on Solaris
-
-  - g++ 3.1 on Linux and Solaris
-
-
-The following functionality has been added or changed:
-
-
-
-* Kernels
-
-  - Point_d has been removed from the 2D and 3D kernels. This type is now
-    available from the d-dimensional kernel only.
-
-
-* Basic Library
-
-  - 2D Polygon Partitioning
-    Traits requirements for optimal partitioning have been changed slightly.
-
-
-  - 2D Sweep line
-    A new package that implements a sweep-line algorithm to compute
-    arrangements of curves for different families of curves, which are not
-    necessarily line segments (e.g., it also works for circular arcs). The
-    resulting output can be the list of vertex points, the resulting subcurves
-    or a planar map.
-
-
-  - Planar Maps and Arrangements
-
-      - New quicker insertion functions of Planar_map_2 for cases where more
-        precomputed information is available regarding the position of the
-        inserted curve in the map.
-
-      - New query function for planar maps that determines whether a given
-        point is within a given face of the planar map.
-
-      - New iterator over edges of planar maps in addition to the existing
-        iterator over halfedges.
-
-      - New copy constructor and assignment operator for arrangements.
-
-
-
-
-  - Polyhedral Surface
-
-      - new design introduced with release 2.3 now supported by VC7 compiler
-
-      - Extended functionality of Polyhedron_incremental_builder: absolute
-        indexing allows one to add new surfaces to existing ones.
-
-
-
-
-  - 2D Triangulation
-
-      - There is a new triangulation data structure replacing the two previous
-        ones. This new data structure is coherent with the 3d triangulation
-        data structure and offer the advantages of both previous ones. Backward
-        compatibility is ensured and this change is transparent for the user of
-        triangulation classes.
-
-      - Constrained and Delaunay constrained triangulations are now able to
-        handle intersecting input constraints. The behavior of constrained
-        triangulations with repect to intersection of input constraints can be
-        customized using an intersection tag.
-
-      - A new class Constrained_triangulation_plus offers a constrained
-        hierarchy on top of a constrained triangulations. This additionnal data
-        structure describes the subdivision of the original constraints into
-        edges of the triangulations.
-
-
-
-
-  - 3D Triangulation
-
-      - Running time improved by a better and more compact management of memory
-        allocation
-
-      - Various improvements and small functionalities added:
-
-          - Triangulation_3<GT,Tds>::triangle() returns a triangle oriented
-            towards the outside of the cell c for facet (c,i)
-
-          - New function insert(Point, Locate_type, Cell_handle, int, int)
-            which avoids the location step.
-
-          - New function to get access to cells in conflict in a Delaunay
-            insertion : find_conflicts() and insert_in_hole()
-
-          - New function TDS::delete_cells(begin, end).
-
-          - New functions : degree(v), reorient(), remove_decrease_dimension(),
-            remove_from_simplex().
-
-
-      - Changes of interface:
-
-          - vertices and cells are the same for the triangulation data
-            structure and the geometric triangulation
-
-          - the triangulation data structure uses Vertex_handle (resp
-            Cell_handle) instead of Vertex* (resp Cell*).
-
-          - incident_cells() and incident_vertices() are templated by output
-            iterators
-
-          - changes in the iterators and circulators interface:
-
-              - Iterators and circulators are convertible to handles
-                automatically, no need to call "->handle()" anymore.
-
-              - Vertex_iterator split into All_vertices_iterator and
-                Finite_vertices_iterator (and similar for cells...).
-
-              - TDS::Edge/Facet iterators now support operator->.
-
-
-
-
-
-
-  - 2D Search structures
-    Additional range search operations taking a predicate functor have been
-    added
-
-
-* Support Library
-
-  - Qt_widget
-
-      - We have added a new class for visualization of 2D CGAL objects. It is
-        derived from Trolltech's Qt class QWidget and privdes a used to scale
-        and pan.
-
-      - Some demos were developed for the following packages: 2D Alpha shapes,
-        2D Convex Hull, Largest empty 2D rectangle, Maximum k-gon, Minimum
-        ellipse, Minimum 2D quadrilateral, 2D polygon partitioning 2D regular
-        and constrained triangulation.
-
-      - Tutorials are available to help users get used to Qt_widget
-
-
-
-
-  - Timer
-    Fixed Timer class (for user process time) to have no wrap-around anymore on
-    Posix-compliant systems.
-
-The following functionality is no longer supported:
-
-  - Planar maps of infinite curves (the so-called planar map bounding-box).
-
-
-Bugs in the following packages have been fixed: 3D Convex hull, 2D Polygon
-partition, simple polygon generator
-
-Also attempts have been made to assure compatability with the upcoming LEDA
-release that introduces the leda namespace.
-
-
-* Known problems
-
-  - 2D Nef Polyhedra contains a memory leak. Memory problems are also the
-    likely cause of occasional run-time errors on some platforms.
-
-  - The d-dimensional convex hull computation produces run-time errors on some
-    platforms because of memory management bugs.
-
-  - The new Halfedge Data Structure design introduced with release 2.3 does not
-    work on VC6. See the release notes in the manual for more information.
-
-  - The following deficiencies relate to planar maps, planar maps of
-    intersecting curves (pmwx), arrangements and sweep line.
-
-      - On KCC, Borland and SunPro we guarantee neither compilation nor correct
-        execution for all of the packages above.
-
-      - On VC6 and VC7 we guarantee neither compilation nor correct execution
-        of the sweep line package.
-
-      - On CC (on Irix 6.5) the trapezoidal decomposition point location
-        strategy is problematic when used with planar maps, pmwx, or
-        arrangements (mind that this is the default for planar maps).
-
-      - On CC (on Irix 6.5) sweep line with polyline traits does not compile
-        (mind that the so-called leda polyline traits does compile).
-
-      - On g++ (on Irix 6.5) the segment-circle (Arr_segment_circle_traits_2)
-        traits does not compile for either of the above packages.
-
-
-
--------------------------------- Release 2.3 --------------------------------
-
-Release date: August 2001
-
-Version 2.3 differs from version 2.2 in the platforms that are supported and in
-functionality.
-
-Additional supported platform:
-
-  - Gnu g++ 3.0 on Solaris and Linux
-
-
-The following functionality has been added:
-
-
-
-* Kernels
-
-  - The 2D and 3D kernels now serve as models of the new kernel concept
-    described in the recent paper, "An Adaptable and Extensible Geometry
-    Kernel" by Susan Hert, Micheal Hoffmann, Lutz Kettner, Sylvain Pion, and
-    Michael Seel to be presented at WAE 2001 (and soon available as a technical
-    report). This new kernel is completely compatible with the previous design
-    but is more flexible in that it allows geometric predicates as well as
-    objects to be easily exchanged and adapted individually to users' needs.
-
-  - A new kernel called Simple_homogeneous is available. It is equivalent to
-    Homogeneous but without reference-counted objects.
-
-  - A new kernel called Filtered_kernel is available that allows one to build
-    kernel traits classes that use exact and efficient predicates.
-
-  - There are two classes, Cartesian_converter and Homogeneous_converter that
-    allows one to convert objects between different Cartesian and homogeneous
-    kernels, respectively.
-
-  - A new d-dimensional kernel, Kernel_d is available. It provides diverse
-    kernel objects, predicates and constructions in d dimensions with two
-    representations based on the kernel families Cartesean_d and Homogeneous_d
-
-
-* Basic Library
-Almost all packages in the basic library have been adapted to the new kernel
-design to realize the flexibility this design makes possible. In several
-packages, this means that the traits class requirements have changed to conform
-to the function objects offered in the kernels so the kernels themselves can be
-used as traits classes in many instances.
-
-
-  - 2D Convex Hull
-    The traits requirements have changed slightly to bring them in line with
-    the CGAL kernels.
-
-  - 3D Convex Hull
-
-      - The function convex_hull_3 now uses a new implementation of the
-        quickhull algorithm and no longer requires LEDA.
-
-      - A new convex_hull_incremental_3 function based on the new d-dimensional
-        convex hull class is available for comparison purposes.
-
-
-
-  - Convex_hull_d, Delaunay_d
-    Two new application classes offering the calculation of d-dimensional
-    convex hulls and delaunay triangulations
-
-
-  - Polygons and Polygon Operations
-
-      - The traits class requirements have been changed.
-
-      - The simplicity test has a completely new implementation.
-
-      - Properties like convexity, simplicity and area can now be cached by
-        polygons. You need to set a flag to select this behaviour.
-
-
-
-
-
-  - Planar Nef Polyhedra
-    A new class (Nef_polyhedron_2) representing planar Nef polyhedra =
-    rectilinearly bounded points sets that are the result of binary and
-    topological operations starting from halfplanes.
-
-
-  - A new package offering functions to partition planar polygons into convex
-    and y-monotone pieces is available.
-
-
-  - Planar Maps and Arrangements
-
-      - A new class Planar_map_with_intersections_2<Planar_map> for planar maps
-        of possibly intersecting, possibly non-x-monotone, possibly overlapping
-        curves (like Arrangement_2 but without the hierarchy tree).
-
-      - I/O utilities for planar maps and arrangements for textual and
-        graphical streams. (It is possible to save and later reload built
-        planar maps or arrangements.)
-
-      - New arrangement traits class for line segments and circular arcs
-        (Arr_segment_circle_traits<NT>).
-
-      - New faster traits for polylines specialized for using the LEDA rational
-        kernel (Arr_leda_polylines_traits). The LEDA traits for segments was
-        also made faster.
-
-      - A new point location strategy (Pm_simple_point_location<Planar_map>).
-
-
-
-
-  - Halfedge Data Structure
-
-    The halfedge data structure has been completely revised. The new design is
-    more in line with the STL naming scheme and it provides a safe and coherent
-    type system throughout the whole design (no void* pointers anymore), which
-    allows for better extendibility. A user can add new incidences in the mesh
-    easily. The new design also uses standard allocators with a new template
-    parameter that has a suitable default.
-
-    The old design is still available, but its use is deprecated, see the
-    manual of deprecated packages for its documentation. Reported bugs in
-    copying the halfedge data structure (and therefore also polyhedral
-    surfaces) have been fixed in both designs. Copying a list-based
-    representation is now based on hash maps instead of std::map and is
-    therefore considerably faster.
-
-
-  - Polyhedral Surface
-
-    The polyhedral surface has been rewritten to work with the new halfedge
-    data structure design. The user level interface of the CGAL::Polyhedron_3
-    class is almost backwards compatible with the previous class. The
-    exceptions are the template parameter list, everything that relies on the
-    flexibility of the underlying halfedge data structure, such as a self-
-    written facet class, and that the distinction between supported normals and
-    supported planes has been removed. Only planes are supported. See the
-    manuals for suggestions how to handle normals instead of planes.
-
-    More example programs are provided with polyhedral surfaces, for example,
-    one about Euler operator and one computing a subdivision surface given a
-    control mesh as input.
-
-    The old design is still available for backwards compatibility and to
-    support older compiler, such as MSVC++6.0. For the polyhedral surface, old
-    and new design cannot be used simultaneously (they have identical include
-    file names and class names). The include files select automatically the old
-    design for MSVC++6.0 and the new design otherwise. This automatism can be
-    overwritten by defining appropriate macros before the include files. The
-    old design is selected with the CGAL_USE_POLYHEDRON_DESIGN_ONE macro. The
-    new design is selected with the CGAL_USE_POLYHEDRON_DESIGN_TWO macro.
-
-
-  - 2D Triangulation
-
-      - The geometric traits class requirements have been changed to conform to
-        the new CGAL kernels. CGAL kernel classes can be used as traits classes
-        for all 2D triangulations except for regular triangulations.
-
-      - Additionnal functionality:
-
-          - dual method for regular triangulations (to build a power diagram)
-
-          - unified names and signatures for various "find_conflicts()" member
-            functions in Delaunay and constrained Delaunay triangulation.
-
-          - As an alternative to the simple insert() member function, insertion
-            of points in those triangulation can be performed using the
-            combination of find_conflicts() and star_hole() which eventually
-            allows the user to keep track of deleted faces.
-
-
-      - More demos and examples
-
-
-
-  - 3D Triangulation
-
-      - Major improvements
-
-          - A new class Triangulation_hierarchy_3 that allows a faster point
-            location, and thus construction of the Delaunay triangulation
-
-          - A new method for removing a vertex from a Delaunay triangulation
-            that solves all degenerate cases
-
-          - Running time of the usual location and insertion methods improved
-
-
-      - A bit more functionality, such as
-
-          - New geomview output
-
-          - dual methods in Delaunay triangulations to draw the Voronoi diagram
-
-
-      - More demos and examples
-
-      - Changes in interface
-
-          - Traits classes requirements have been modified
-
-          - The kernel can be used directly as a traits class (except for
-            regular triangulation)
-
-          - insert methods in Triangulation_data_structure have a new interface
-
-
-
-
-  - A new class (Alpha_shapes_3) that computes Alpha shapes of point sets in 3D
-    is available.
-
-
-  - The traits requirements for matrix search and minimum quadrilaterals have
-    been changed to bring them in line with the CGAL kernels.
-
-
-  - Point_set_2
-
-      - now independent of LEDA; based on the CGAL Delaunay triangulation
-
-      - traits class requirements adapted to new kernel concept.
-
-      - function template versions of the provided query operations are
-        available
-
-
-
-* Support Library
-
-  - Number types:
-
-      - Lazy_exact_nt<NT> is a new number type wrapper to speed up exact number
-        types.
-
-      - MP_Float is a new multiprecision floating point number type. It can do
-        exact additions, subtractions and multiplications over floating point
-        values.
-
-
-  - In_place_list has a new third template parameter (with a suitable default)
-    for an STL-compliant allocator.
-
-  - Unique_hash_map is a new support class.
-
-  - Union_find is a new support class.
-
-  - Geomview_stream :
-
-      - Geomview version 1.8.1 is now required.
-
-      - no need to have a ~/.geomview file anymore.
-
-      - new output operators for triangulations.
-
-      - new output operators for Ray_2, Line_2, Ray_3, Line_3, Sphere_3.
-
-      - various new manipulators.
-
-
-  - Window stream In cooperation with Algorithmic Solutions, GmBH (distributors
-    of the LEDA library), we can now offer a visualization package downloadable
-    in binary form that supports visualization on a ported version of the LEDA
-    window lib.
-
-
--------------------------------- Release 2.2 --------------------------------
-
-Release date: October 2000
-
-Version 2.2 differs from version 2.1 in the platforms that are supported and in
-functionality.
-
-Additional supported platforms:
-
-  - the KAI compiler (4.0) on Solaris 5.8
-
-  - Borland C++ (5.5)
-
-
-The following functionality has been added:
-
-  - There is a new, non-reference-counted kernel, Simple_cartesian. Because
-    reference counting is not used, and thus coordinates are stored within a
-    class, debugging is easier using this kernel. This kernel can also be
-    faster in some cases than the reference-counted Cartesian kernel.
-
-  - New optimisation algorithms
-
-      - Min_annulus_d - Algorithm for computing the smallest enclosing annulus
-        of points in arbitrary dimension
-
-      - Polytope_distance_d - Algorithm for computing the (squared) distance
-        between two convex polytopes in arbitrary dimension
-
-      - Width_3 - Algorithm for computing the (squared) width of points sets in
-        three dimensions
-
-
-  - 2D Triangulations
-
-      - There are now two triangulation data structures available in CGAL. The
-        new one uses a list to store the faces and allows one to represent two-
-        dimensional triangulations embedded in three spaces as well as planar
-        triangulations.
-
-      - The triangulation hierarchy which allows fast location query is now
-        available.
-
-
-  - Inifinite objects can now be included in planar maps.
-
-  - Removal as well as insertions of vertices for 3D Delaunay triangulations is
-    now possible.
-
-  - A generator for ``random'' simple polygons is now available.
-
-  - In directory demo/Robustness, programs that demonstrate typical robustness
-    problems in geometric computing are presented along with the solutions to
-    these problems that CGAL provides.
-
-
-The following functionality has been removed:
-
-  - The binary operations on polygons (union, intersection ...) have been
-    removed. Those operations were not documented in the previous release
-    (2.1). Arrangements can often be used as a substitute.
-
-
-
--------------------------------- Release 2.1 --------------------------------
-
-Release date: January 2000
-
-Version 2.1 differs from version 2.0 in the platforms that are supported and in
-functionality.
-
-Supported platforms:
-
-  - the newest gnu compiler (2.95.2) on Sun, SGI, Linux and Windows.
-
-  - the Microsoft Visual C++ compiler, version 6.
-
-  - the mips CC compiler version 7.3 under Irix.
-
-Support for the old g++ compiler (2.8) and for mips CC 7.2 has been dropped.
-
-The following functionality has been added:
-
-  - Alpha shapes and weighted alpha shapes in 2D. Alpha shapes are a
-    generalization of the convex hull of a point set.
-
-  - Arrangements in 2D. Arrangements are related to and based on planar maps.
-    The major difference between the two is that curves are allowed to
-    intersect in the case of arrangements.
-
-  - Extensions to triangulations in 2D. Constrained triangulations are now
-    dynamic: they support insertions of new constraint as well as removal of
-    existing constraints. There are also constrained Delaunay triangulations.
-
-  - Triangulations in 3D were added, both Delaunay triangulations and regular
-    triangulations.
-
-  - Min_quadrilateral optimisations have been added. These are algorithms to
-    compute the minimum enclosing rectangle/parallelogram (arbitrary
-    orientation) and the minimum enclosing strip of a convex point set.
-
-  - 2d Point_set is a package for 2d range search operations, Delaunay
-    triangulation, nearest neighbor queries. This package works only if LEDA is
-    installed.
-
-  - Support for GeoWin visualization library. This also depends on LEDA.
-
-  - Support for using the CLN number type together with CGAL.
-
-
-
--------------------------------- Release 2.0 --------------------------------
-
-Release date: June 1999
-
-The main difference from release 1.2 is the introduction of namespaces -
-- namespace std for code from the standard library and namespace CGAL for the
-CGAL library.
-
-
--------------------------------- Release 1.2 --------------------------------
-
-Release date: January 1999
-
-Additions to release 1.1 include:
-
-
-  - topological map
-
-  - planar map overlay
-
-  - regular and constrained triangulations
-
-
--------------------------------- Release 1.1 --------------------------------
-
-Release date: July 1998
-
-Additions to release 1.0 include:
-
-  - 3D intersections
-
-  - kD points
-
-  - 3D convex hull
-
-  - kD smallest enclosing sphere
-
-
-
--------------------------------- Release 1.0 --------------------------------
-
-Release date: April 1998
-
-Additions to release 0.9 include:
-
-  - Polyhedral surfaces
-
-  - Halfedge Data Structure
-
-  - Planar maps
-
-
-
--------------------------------- Release 0.9 --------------------------------
-
-Release date: June 1997
-
-Initial (beta) release of the CGAL library.
-
diff --git a/3rdparty/CGAL-4.8/CMakeLists.txt b/3rdparty/CGAL-4.8/CMakeLists.txt
deleted file mode 100644
index be4b013..0000000
--- a/3rdparty/CGAL-4.8/CMakeLists.txt
+++ /dev/null
@@ -1,1036 +0,0 @@
-# Top level CMakeLists.txt for CGAL
-# The name of our project is "CGAL".  CMakeLists files in this project can
-# refer to the root source directory of the project as ${CMAKE_SOURCE_DIR} or
-# ${CMAKE_SOURCE_DIR} and to the root binary directory of the project as
-# ${CMAKE_BINARY_DIR} or ${CMAKE_BINARY_DIR}.
-project(CGAL CXX C)
-
-# Minimal version of CMake:
-cmake_minimum_required(VERSION 2.8.11)
-
-# Tested version:
-cmake_policy(VERSION 2.8.11)
-
-#
-# Compatibility with CMake 3.0
-#
-if(POLICY CMP0042)
-  # Do not enable the use of MACOSX_RPATH
-  # http://www.cmake.org/cmake/help/v3.0/policy/CMP0042.html
-  cmake_policy(SET CMP0042 OLD)
-endif()
-
-# Compatibility with CMake 3.1
-if(POLICY CMP0054)
-  # http://www.cmake.org/cmake/help/v3.1/policy/CMP0054.html
-  # See the discussion https://github.com/CGAL/cgal/issues/189
-  cmake_policy(SET CMP0054 NEW)
-endif()
-
-
-#--------------------------------------------------------------------------------------------------
-#
-#                                    -= PACKAGE SETUP =-
-#
-#--------------------------------------------------------------------------------------------------
-
-message( "== Setting paths ==" )
-
-if ( CGAL_BRANCH_BUILD )
-
-  message( STATUS "Build CGAL from ${CGAL_SCM_NAME}-branch: ${CGAL_SCM_BRANCH_NAME}" )
-
-  # list packages
-  file(GLOB CGAL_CONFIGURED_PACKAGES RELATIVE ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/*")
-  list(REMOVE_ITEM CGAL_CONFIGURED_PACKAGES copyright CMakeLists.txt .svn .git)
-
-  # detect and remove not existing package-directories
-  foreach (package ${CGAL_CONFIGURED_PACKAGES})
-    if (NOT IS_DIRECTORY "${CMAKE_SOURCE_DIR}/${package}")
-      list(APPEND CGAL_WRONG_PACKAGES ${package})
-    elseif(NOT IS_DIRECTORY "${CMAKE_SOURCE_DIR}/${package}/package_info")
-      list(APPEND CGAL_WRONG_PACKAGES ${package})
-    endif()
-  endforeach()
-
-  find_program(CGAL_CREATE_CMAKE_SCRIPT cgal_create_cmake_script
-               HINT ${CMAKE_SOURCE_DIR}/Scripts/scripts
-	       DOC "Script cgal_create_cmake_script, that creates CMakeLists.txt files"
-	       NO_DEFAULT_PATH
-	       NO_CMAKE_ENVIRONMENT_PATH)
-
-  if (DEFINED CGAL_WRONG_PACKAGES)
-    message(STATUS "Removed not-a-package: ${CGAL_WRONG_PACKAGES}")
-    list(REMOVE_ITEM CGAL_CONFIGURED_PACKAGES ${CGAL_WRONG_PACKAGES})
-  endif()
-
-  set(CGAL_CONFIGURED_PACKAGES_NAMES ${CGAL_CONFIGURED_PACKAGES})
-  set(CGAL_CONFIGURED_PACKAGES)
-  foreach (package ${CGAL_CONFIGURED_PACKAGES_NAMES})
-    list(APPEND CGAL_CONFIGURED_PACKAGES "${CMAKE_SOURCE_DIR}/${package}")
-  endforeach()
-
-
-  set(CGAL_INSTALLATION_PACKAGE_DIR "${CMAKE_SOURCE_DIR}/Installation" CACHE INTERNAL "Directory containing the Installation package")
-  set(CGAL_MAINTENANCE_PACKAGE_DIR "${CMAKE_SOURCE_DIR}/Maintenance" CACHE INTERNAL "Directory containing the Maintenance package")
-  set(CGAL_CORE_PACKAGE_DIR "${CMAKE_SOURCE_DIR}/Core" CACHE INTERNAL "Directory containing the Core package")
-
-  message(STATUS "Installation package directory: ${CGAL_INSTALLATION_PACKAGE_DIR}")
-  message(STATUS "Maintenance package directory: ${CGAL_MAINTENANCE_PACKAGE_DIR}")
-  message(STATUS "Core package directory: ${CGAL_CORE_PACKAGE_DIR}")
-
-else ( CGAL_BRANCH_BUILD )
-
-  # get release name
-  file(TO_CMAKE_PATH ${CMAKE_SOURCE_DIR} CMAKE_SOURCE_CDIR)
-  string(REGEX REPLACE "^/" "" CMAKE_SOURCE_DDIR ${CMAKE_SOURCE_CDIR})
-  string(REPLACE "/" ";" CMAKE_SOURCE_PDIR ${CMAKE_SOURCE_DDIR})
-  list(GET CMAKE_SOURCE_PDIR -1 CGAL_RELEASE_NAME)
-  message( STATUS "Build CGAL from release in directory ${CGAL_RELEASE_NAME}" )
-
-  set(CGAL_CONFIGURED_PACKAGES_NAMES ${CGAL_RELEASE_NAME})
-
-  # list packages
-  set(CGAL_CONFIGURED_PACKAGES "${CMAKE_SOURCE_DIR}")
-
-  set(CGAL_INSTALLATION_PACKAGE_DIR "${CMAKE_SOURCE_DIR}" CACHE INTERNAL "Directory containing the Installation package")
-  set(CGAL_MAINTENANCE_PACKAGE_DIR "${CMAKE_SOURCE_DIR}" CACHE INTERNAL "Directory containing the Maintenance package")
-  set(CGAL_CORE_PACKAGE_DIR "${CMAKE_SOURCE_DIR}" CACHE INTERNAL "Directory containing the Core package")
-
-endif (CGAL_BRANCH_BUILD )
-
-#message(STATUS "Packages found: ${CGAL_CONFIGURED_PACKAGES}")
-
-list(SORT CGAL_CONFIGURED_PACKAGES_NAMES)
-if(IS_DIRECTORY "${CMAKE_SOURCE_DIR}/Documentation")
-  # Rescope CGAL_CONFIGURED_PACKAGES_NAMES
-  # We need this variable in the Doxygen configuration process. Reset it
-  # and change the scope to the parent scope.
-  # Philipp Moeller, 2013-05-302013-05-302013-05-30
-  set(CGAL_CONFIGURED_PACKAGES_NAMES ${CGAL_CONFIGURED_PACKAGES_NAMES} PARENT_SCOPE)
-endif()
-
-message(STATUS "Packagenames: ${CGAL_CONFIGURED_PACKAGES_NAMES}")
-message( "== Setting paths (DONE) ==\n" )
-
-message( "== Generate version files ==")
-
-if ( CGAL_BRANCH_BUILD ) 
-    
-  #
-  # Create version files
-  #
-
-  file(STRINGS "${CGAL_MAINTENANCE_PACKAGE_DIR}/release_building/MAJOR_NUMBER" CGAL_MAJOR_VERSION REGEX "[0-9]*")
-  file(STRINGS "${CGAL_MAINTENANCE_PACKAGE_DIR}/release_building/MINOR_NUMBER" CGAL_MINOR_VERSION REGEX "[0-9]*")
-  file(STRINGS "${CGAL_MAINTENANCE_PACKAGE_DIR}/release_building/BUGFIX_NUMBER" CGAL_BUGFIX_VERSION REGEX "[0-9]*")
-
-  file(REMOVE ${CMAKE_BINARY_DIR}/VERSION)
-  if (CGAL_BUGFIX_VERSION AND CGAL_BUGFIX_VERSION GREATER 0)  
-    set(CGAL_CREATED_VERSION_NUM "${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}.${CGAL_BUGFIX_VERSION}")
-  else()
-    set(CGAL_CREATED_VERSION_NUM "${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}")
-  endif()
-
-  # Accessed in the documentation.
-  set(CGAL_CREATED_VERSION_NUM ${CGAL_CREATED_VERSION_NUM} PARENT_SCOPE)
-
-  # TODO EBEB set number of internal release (replace "900")
-  set(CGAL_BUILD_VERSION 900)
-  set(CGAL_CREATED_VERSION "${CGAL_CREATED_VERSION_NUM}-I-${CGAL_BUILD_VERSION}")
-  set(CGAL_VERSION "${CGAL_CREATED_VERSION_NUM}-I-${CGAL_BUILD_VERSION}")
-
-  file(WRITE "${CMAKE_BINARY_DIR}/VERSION" "${CGAL_CREATED_VERSION_NUM}")
-
-  message(STATUS "CGAL_VERSION is ${CGAL_CREATED_VERSION}")
-  set(CGAL_FULL_VERSION ${CGAL_CREATED_VERSION} CACHE INTERNAL "CGAL version")
-
-
-  #define CGAL_VERSION_NR 1030500135
-  string (LENGTH "${CGAL_MAJOR_VERSION}" CGAL_MAJOR_LEN)
-  if ("${CGAL_MAJOR_LEN}" EQUAL 1) 
-    set(CGAL_TMP_MAJOR "0${CGAL_MAJOR_VERSION}")
-  endif()
-  string (LENGTH "${CGAL_MINOR_VERSION}" CGAL_MINOR_LEN)
-  if ("${CGAL_MINOR_LEN}" EQUAL 1) 
-    set(CGAL_TMP_MINOR "0${CGAL_MINOR_VERSION}")
-  else()
-    set(CGAL_TMP_MINOR "${CGAL_MINOR_VERSION}")
-  endif()
-
-  set(CGAL_TMP_BUILD "${CGAL_BUILD_VERSION}")
-  string(LENGTH "${CGAL_TMP_BUILD}" CGAL_BUILD_LEN)
-
-  while(CGAL_BUILD_LEN LESS 4)
-    set(CGAL_TMP_BUILD "0${CGAL_TMP_BUILD}")
-    string(LENGTH "${CGAL_TMP_BUILD}" CGAL_BUILD_LEN)
-  endwhile()
-
-  set(CGAL_CREATED_VERSION_NR "1${CGAL_TMP_MAJOR}${CGAL_TMP_MINOR}${CGAL_BUGFIX_VERSION}${CGAL_TMP_BUILD}")
-  message(STATUS "CGAL_VERSION_NR is ${CGAL_CREATED_VERSION_NR}")
-
-  message(STATUS "CGAL_GIT_HASH is ${CGAL_GIT_HASH}")
-  message(STATUS "CGAL_CREATED_SVN_REVISION is ${CGAL_CREATED_SVN_REVISION} (dummy)")
-
-  file(REMOVE ${CMAKE_BINARY_DIR}/include/CGAL/version.h)
-  configure_file(${CGAL_INSTALLATION_PACKAGE_DIR}/config/version.h.in ${CMAKE_BINARY_DIR}/include/CGAL/version.h @ONLY)
-
-  #
-  # Duplicate files
-  #
-
-  if (CGAL_REPORT_DUPLICATE_FILES) 
-
-    message("== Searching for duplicate files ==")
-
-    foreach (package ${CGAL_CONFIGURED_PACKAGES})
-
-      file(GLOB_RECURSE CGAL_PACKAGE_HEADER_FILES FOLLOW_SYMLINKS ${package}/*.h)
-      foreach (file ${CGAL_PACKAGE_HEADER_FILES})
-        string(REPLACE "${package}/" "" pure_file ${file})
-        if (NOT ${pure_file} MATCHES ".*CMakeFiles.*")
-          list(APPEND CGAL_HEADER_FILES ${pure_file})
-        endif()
-      endforeach()
-
-      file(GLOB_RECURSE CGAL_PACKAGE_CPP_FILES FOLLOW_SYMLINKS ${package}/*.cpp)
-      foreach (file ${CGAL_PACKAGE_CPP_FILES})
-        string(REPLACE "${package}/" "" pure_file ${file})
-        if (NOT ${pure_file} MATCHES ".*CMakeFiles.*")
-          list(APPEND CGAL_CPP_FILES ${pure_file})
-        endif()
-      endforeach()
-
-    endforeach()
-
-    list(SORT CGAL_HEADER_FILES)
-    set(CGAL_UNIQUE_HEADER_FILES ${CGAL_HEADER_FILES})
-    set(CGAL_DUPLICATE_HEADER_FILES ${CGAL_HEADER_FILES})
-    list(REMOVE_DUPLICATES CGAL_UNIQUE_HEADER_FILES)
-    #message(STATUS "Headers: ${CGAL_HEADER_FILES}")
-    foreach (file ${CGAL_UNIQUE_HEADER_FILES})
-      list(FIND CGAL_DUPLICATE_HEADER_FILES "${file}" CGAL_FILE_IDX)
-      list(REMOVE_AT CGAL_DUPLICATE_HEADER_FILES ${CGAL_FILE_IDX})
-    endforeach()
-    message(STATUS "Duplicate header files (will be repeated at end): ${CGAL_DUPLICATE_HEADER_FILES}")
-
-    list(SORT CGAL_CPP_FILES)
-    set(CGAL_UNIQUE_CPP_FILES ${CGAL_CPP_FILES})
-    set(CGAL_DUPLICATE_CPP_FILES ${CGAL_CPP_FILES})
-    list(REMOVE_DUPLICATES CGAL_UNIQUE_CPP_FILES)
-    #message(STATUS "CPPs: ${CGAL_CPP_FILES}")
-    foreach (file ${CGAL_UNIQUE_CPP_FILES})
-      list(FIND CGAL_DUPLICATE_CPP_FILES "${file}" CGAL_FILE_IDX)
-      list(REMOVE_AT CGAL_DUPLICATE_CPP_FILES ${CGAL_FILE_IDX})
-    endforeach()
-    message(STATUS "Duplicate cpp files (will be repeated at end): ${CGAL_DUPLICATE_CPP_FILES}")
-
-  endif(CGAL_REPORT_DUPLICATE_FILES)
-
-else()
-
-  if (NOT EXISTS "${CMAKE_SOURCE_DIR}/VERSION" OR NOT EXISTS "${CMAKE_SOURCE_DIR}/include/CGAL/version.h")
-    message(FATAL_ERROR "File VERSION or include/CGAL/version.h are missing, required by release-build.")
-  endif()
-
-  # 
-  # Read and parse CGAL version number from VERSION file
-  #
-
-  file( READ "${CMAKE_SOURCE_DIR}/VERSION" CGAL_VERSION )
-  # Comment from Laurent Rineau, 2012/06/28:
-  #   file(READ ..) should be replace by file(STRINGS ..), and then we take
-  #   the first line. That would avoid parsing errors when the VERSION file
-  #   contains a CR character!
-
-  set(CGAL_FULL_VERSION ${CGAL_VERSION})
-  string( REPLACE "-" "." CGAL_VERSION_TOKENS1 ${CGAL_VERSION} )
-  string( REPLACE "." ";" CGAL_VERSION_TOKENS ${CGAL_VERSION_TOKENS1} )
-  list( LENGTH CGAL_VERSION_TOKENS CGAL_VERSION_TOKENS_LEN )
-  list( GET CGAL_VERSION_TOKENS 0 CGAL_MAJOR_VERSION )
-
-  set(CGAL_MINOR_VERSION)
-  set(CGAL_BUGFIX_VERSION)
-  set(CGAL_BUILD_VERSION 1000)
-
-  if ( CGAL_VERSION_TOKENS_LEN GREATER 1 )
-    list( GET CGAL_VERSION_TOKENS 1 CGAL_MINOR_VERSION )
-  endif()
-
-  if ( CGAL_VERSION_TOKENS_LEN GREATER 2 )
-    list( GET CGAL_VERSION_TOKENS 2 CGAL_BUGFIX_VERSION )
-
-    # The following condition will be true the token #2 is not a number (if
-    # it is for example "I" or "Ic"):
-    if(NOT CGAL_BUGFIX_VERSION GREATER 0 AND NOT CGAL_BUGFIX_VERSION EQUAL 0)
-      set(CGAL_BUGFIX_VERSION 0)
-      if( CGAL_VERSION_TOKENS_LEN GREATER 3 )
-        list( GET CGAL_VERSION_TOKENS 3 CGAL_BUILD_VERSION )
-      endif()
-    else()
-      if( CGAL_VERSION_TOKENS_LEN GREATER 4 )
-        list( GET CGAL_VERSION_TOKENS 4 CGAL_BUILD_VERSION )
-      endif()
-    endif()
-    # If CGAL_BUILD_VERSION is not a strictly positive number, error
-    if(NOT CGAL_BUILD_VERSION GREATER 0)
-      message(WARNING 
-        "Error parsing VERSION file: CGAL_BUILD_VERSION is not a number.\n"
-        "The content of the VERSION file is:\n${CGAL_VERSION}\n"
-        "CGAL_BUILD_VERSION was set to:\n${CGAL_BUILD_VERSION}")
-      set(CGAL_BUILD_VERSION 1000)
-    endif()
-  endif()
-
-  if(NOT CGAL_BUGFIX_VERSION)
-    set(CGAL_BUGFIX_VERSION 0)
-  endif()
-
-  if(CGAL_BUGFIX_VERSION AND CGAL_BUGFIX_VERSION GREATER 0)
-    set(CGAL_CREATED_VERSION_NUM "${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}.${CGAL_BUGFIX_VERSION}")
-  else()
-    set(CGAL_CREATED_VERSION_NUM "${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}")
-  endif()
-endif()
-
-
-#--------------------------------------------------------------------------------------------------
-#
-#                                    -= BASIC SETUP =-
-#
-#--------------------------------------------------------------------------------------------------
-
-message( STATUS "CGAL_MAJOR_VERSION=${CGAL_MAJOR_VERSION}" )
-message( STATUS "CGAL_MINOR_VERSION=${CGAL_MINOR_VERSION}" )
-message( STATUS "CGAL_BUGFIX_VERSION=${CGAL_BUGFIX_VERSION}" )
-if(CGAL_BUILD_VERSION LESS 1000)
-  message( STATUS "CGAL_BUILD_VERSION=${CGAL_BUILD_VERSION}" )
-endif()
-
-# SONAME, SOVERSION
-#
-# The rule is that each new release or bug fix release should increse the soversion.
-#
-# SOVERSION is $(SONAME_VERSION).$(SOVERSION_MINOR).$(SOVERSION_RELEASE)
-#
-# - If the binary interface of libraries do not change from previous release
-#   (example: most bug fix releases), increase SOVERSION_RELEASE (this third number).
-# - If the binary interface is changed, but remains compatible with
-#   previous release (example: only addition of new functions), then increase
-#   SOVERSION_MINOR (second number) and set SOVERSION_RELEASE to 0.
-# - If the binary interface is changed in an incompatible way to previous
-#   release, then increase the SONAME_VERSION, and set the two other
-#   numbers to 0.
-# 
-# SOVERSION history: 
-#   CGAL<=3.5  : (unversionned)
-#   CGAL-3.5   : 4.0.0
-#   CGAL-3.5.1 : 4.0.1
-#   CGAL-3.6   : 5.0.0
-#   CGAL-3.6.1 : 5.0.0 (should have been 5.0.1)
-#   CGAL-3.7   : 6.0.0 (certainly: some types have been turned from int to
-#                        std::size_t, which is different on some platforms)
-#   CGAL-3.8   : 7.0.0 (At least CGAL::Random has changed its member fields.)
-#   CGAL-3.9   : 8.0.0 (No way to check the binary compatibility.)
-#   CGAL-4.0   : 9.0.0 (No way to check the binary compatibility.)
-#   CGAL-4.1   : 10.0.0 (No way to check the binary compatibility.)
-#   CGAL-4.2   : 10.0.1 (Nothing different in CGAL compiled libraries¹.)
-#   CGAL-4.3   : 10.0.2 (Nothing different in CGAL compiled libraries¹.)
-#   CGAL-4.4   : 10.0.3 (Nothing different in CGAL compiled libraries¹.)
-#   CGAL-4.5   : 10.0.4 (Nothing different in CGAL compiled libraries¹.)
-#   CGAL-4.6   : 11.0.0 (int->size_t in CGAL_ImageIO)
-#   CGAL-4.7   : 11.0.1 (Nothing different in CGAL compiled libraries.)
-#   CGAL-4.8   : 11.0.2 (Nothing different in CGAL compiled libraries.)
-# ¹) According to http://upstream-tracker.org/versions/cgal.html
-
-set( CGAL_SONAME_VERSION "11" )
-set( CGAL_SOVERSION      "11.0.2" )
-
-message( STATUS "CGAL_SONAME_VERSION=${CGAL_SONAME_VERSION}" )
-message( STATUS "CGAL_SOVERSION     =${CGAL_SOVERSION}" )
-set( CGAL_BUILDING_LIBS TRUE )
-
-set( CGAL_VERSION_DIR     CGAL-${CGAL_VERSION} )
-set( CGAL_MODULES_REL_DIR cmake/modules )
-set( CGAL_MODULES_DIR     ${CGAL_INSTALLATION_PACKAGE_DIR}/${CGAL_MODULES_REL_DIR} )
-
-include(${CGAL_MODULES_DIR}/CGAL_Macros.cmake)
-cgal_setup_module_path()
-
-message( STATUS "CGAL_REFERENCE_CACHE_DIR=${CGAL_REFERENCE_CACHE_DIR}" )
-
-if ( RUNNING_CGAL_AUTO_TEST )
-  message(STATUS "Operating system:")
-  execute_process(COMMAND uname -a
-    TIMEOUT 5
-    OUTPUT_VARIABLE uname_a
-    ERROR_VARIABLE uname_a)
-  message(STATUS "${uname_a}")
-  CGAL_display_compiler_version()
-  if ( NOT "${CGAL_REFERENCE_CACHE_DIR}" STREQUAL "" )
-    if ( EXISTS ${CGAL_REFERENCE_CACHE_DIR} )
-      if ( EXISTS ${CGAL_REFERENCE_CACHE_DIR}/CMakeCache.txt )
-        message( STATUS "Loading reference cache from ${CGAL_REFERENCE_CACHE_DIR}" )
-        load_cache( ${CGAL_REFERENCE_CACHE_DIR} 
-          EXCLUDE CGAL_Core_LIBRARY 
-                  CGAL_CORE_PACKAGE_DIR
-                  WITH_CGAL_Core
-                  CGAL_INSTALLATION_PACKAGE_DIR
-                  CGAL_MAINTENANCE_PACKAGE_DIR
-                  CGAL_PDB_BINARY_DIR
-                  CGAL_PDB_SOURCE_DIR
-                  CGAL_BINARY_DIR
-                  CGAL_SOURCE_DIR)
-#        message("List of cache variables:")
-
-        ## The following lines removes nasty loaded cache values. We do not
-        ## want that the current build tree depends on binaries that were
-        ## build in the reference build tree.
-        get_property(cache_variables DIRECTORY PROPERTY CACHE_VARIABLES)
-        foreach(var ${cache_variables}) 
-#          get_property(var_value CACHE ${var} PROPERTY VALUE)
-#          get_property(type CACHE ${var} PROPERTY TYPE)
-          string(REGEX MATCH "^CGAL(_.*_(DEPENDS|BINARY_DIR)|_.*LIBRARY)$" var_name_matches ${var})
-          if(var_name_matches)
-            unset(${var} CACHE)
-#          else()
-#            message("${var}:${var_type}=${var_value}")
-          endif()
-        endforeach()
-
-
-      endif()
-    endif()
-  endif()
-endif()
-
-include(CGAL_Common)
-include(CGAL_GeneratorSpecificSettings)
-include(CGAL_CheckCXXFileRuns)
-
-mark_as_advanced(CMAKE_BACKWARDS_COMPATIBILITY)
-
-message( STATUS "USING CMake version: ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" )
-message( STATUS "System: ${CMAKE_SYSTEM_NAME}" )
-
-#--------------------------------------------------------------------------------------------------
-#
-#                                    -= FLAGS =-
-#
-#--------------------------------------------------------------------------------------------------
-
-if( MSVC )
-  
-  uniquely_add_flags ( CGAL_CXX_FLAGS "-D_CRT_SECURE_NO_DEPRECATE;-D_SCL_SECURE_NO_DEPRECATE;-D_CRT_SECURE_NO_WARNINGS;-D_SCL_SECURE_NO_WARNINGS" )
-  uniquely_add_flags ( CGAL_CXX_FLAGS "/fp:strict" )
-  uniquely_add_flags ( CGAL_CXX_FLAGS "/fp:except-" )
-  uniquely_add_flags ( CGAL_CXX_FLAGS "/wd4503" ) # Suppress warnings C4503 about "decorated name length exceeded"
-  uniquely_add_flags ( CGAL_CXX_FLAGS "/bigobj" ) # Use /bigobj by default
-
-  if ( RUNNING_CGAL_AUTO_TEST )
-    set(CMAKE_CXX_WARNING_LEVEL 2 CACHE STRING "MSVC C++ compiler warning level" FORCE)
-    mark_as_advanced(CMAKE_CXX_WARNING_LEVEL)
-  endif()
-    
-endif()
-
-if( "\"${CMAKE_CXX_COMPILER_ID}\"" MATCHES "SunPro" )
-  message( STATUS "Using SunPro compiler, using STLPort 4." )
-  
-  uniquely_add_flags( CGAL_CXX_FLAGS "-features=extensions;-library=stlport4;-D_GNU_SOURCE" )
-  uniquely_add_flags( CGAL_SHARED_LINKER_FLAGS "-library=stlport4" )
-  uniquely_add_flags( CGAL_EXE_LINKER_FLAGS    "-library=stlport4" )
-endif()
-
-if( "${CMAKE_CXX_COMPILER}" MATCHES "icl" OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc")
-  message( STATUS "Intel compiler is detected." )
-  set( IntelCompiler_FOUND TRUE )
-
-  get_dependency_version(IntelCompiler)
-
-  if( "${IntelCompiler_VERSION}" LESS "1100" )
-    message("Intel Compiler version ${IntelCompiler_VERSION} is not supported by CGAL-${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}! (too old, must be 11.0 or after)")
-  else()
-    message( STATUS "Using Intel Compiler version 11 or later. Adding -fp-model strict" )
-    if(WIN32)
-      uniquely_add_flags( CGAL_CXX_FLAGS "/fp:strict" )
-    else()
-      uniquely_add_flags( CGAL_CXX_FLAGS "-fp-model strict" )
-    endif()
-  endif()
-endif()
-
-
-if ( CMAKE_COMPILER_IS_GNUCXX )
-
-  set( GCC_FOUND TRUE )
-  
-  get_dependency_version(GCC)
-  
-  if ( "${GCC_VERSION}" MATCHES "Not" OR "${GCC_VERSION}" MATCHES "Unknown" )
-    set( GCC_FOUND FALSE )
-  endif()
-  
-  if ( GCC_FOUND )
-  
-    if ( RUNNING_CGAL_AUTO_TEST )
-      uniquely_add_flags( CGAL_CXX_FLAGS "-Wall" )
-      # Remove -g from the relevant CMAKE_CXX_FLAGS. This will also
-      # propagate to the rest of the tests, since we overwrite those
-      # flags with the ones used to build CGAL.
-      string(REGEX REPLACE "-g( |$)" ""
-        CMAKE_CXX_FLAGS
-        "${CMAKE_CXX_FLAGS}")
-      # We only allow the release types DEBUG and RELEASE, but handle
-      # all possible values just to be sure.
-      foreach(release_type DEBUG RELEASE MINSIZEREL RELWITHDEBINFO)
-        string(REGEX REPLACE "-g( |$)" ""
-          CMAKE_CXX_FLAGS_${release_type}
-          "${CMAKE_CXX_FLAGS_${release_type}}")
-      endforeach()
-
-    endif()
-    
-    if ( "${GCC_VERSION}" MATCHES "^[4-9]." )
-      message( STATUS "Using gcc version 4 or later. Adding -frounding-math" )
-      uniquely_add_flags( CGAL_CXX_FLAGS "-frounding-math" )
-    endif()
-    
-    if ( "${GCC_VERSION}" MATCHES "^4.2" )
-      message( STATUS "Using gcc version 4.2. Adding -fno-strict-aliasing" )
-      uniquely_add_flags( CGAL_CXX_FLAGS "-fno-strict-aliasing" )
-    endif()
-    
-    if ( "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "alpha" )
-      message( STATUS "Using gcc on alpha. Adding -mieee -mfp-rounding-mode=d" )
-      uniquely_add_flags( CGAL_CXX_FLAGS "-mieee -mfp-rounding-mode=d" )
-    endif()
-    
-  endif()
-  
-endif()
-
-message( "== Generate version files (DONE) ==\n")
-
-#--------------------------------------------------------------------------------------------------
-#
-#                                    -= External libraries =-
-#
-#--------------------------------------------------------------------------------------------------
- 
-message("== Set up flags ==")
-
-include(CGAL_SetupFlags)
-
-message("== Set up flags (DONE) ==\n")
-
-message("== Detect external libraries ==")
-
-# this is the place to tell which external libs are supporting
-# Remarks: 
-#  External libs configured when Qt5 lib of cgal are required
-#  Coin is used in KDS, but no FindCoin or FindCOIN exists
-#  There exists FindF2C, FindIPE, FindMKL, but they are only used to support supporting libs
-list (INSERT CGAL_SUPPORTING_3RD_PARTY_LIBRARIES 0 GMP MPFR ZLIB OpenGL LEDA MPFI RS RS3 OpenNL Eigen3 BLAS LAPACK QGLViewer ESBTL Coin3D NTL IPE)
-if (NOT WIN32)
-  # GMPXX is not supported on WIN32 machines
-  list (INSERT CGAL_SUPPORTING_3RD_PARTY_LIBRARIES 1 GMPXX)
-endif()
-
-# Where CMake is run several times, to avoid duplicates
-list(REMOVE_DUPLICATES CGAL_SUPPORTING_3RD_PARTY_LIBRARIES)
-hide_variable(CGAL_SUPPORTING_3RD_PARTY_LIBRARIES)
-
-# set some to have special prefix
-macro( set_special_prefix library prefix)
-set(SPECIAL_PREFIXES "${SPECIAL_PREFIXES}set(CGAL_EXT_LIB_${library}_PREFIX \"${prefix}\")\n")
-set(CGAL_EXT_LIB_${library}_PREFIX ${prefix})
-endmacro()
-
-set_special_prefix(Qt5 QT)
-set_special_prefix(Eigen3 EIGEN3)
-set_special_prefix(QGLViewer QGLVIEWER)
-set_special_prefix(Coin3D COIN3D)
-
-# some libraries are essential (stl and Boost.Thread are treated in another way) 
-if($ENV{CGAL_DISABLE_GMP})
-  set(CGAL_DISABLE_GMP ON CACHE INTERNAL "")
-endif()
-if(CGAL_DISABLE_GMP)
-  message("Disable the GMP support")
-  list(LENGTH CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES CGAL_ESSENTIAL_LENGTH)
-  if(NOT CGAL_ESSENTIAL_LENGTH EQUAL 0)
-    list(REMOVE_ITEM CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES GMP MPFR)
-  endif()
-  unset(CGAL_CONFIGURED_LIBRARIES)
-  unset(CGAL_CONFIGURED_LIBRARIES CACHE)
-  unset(GMP_FOUND)
-  unset(GMP_FOUND CACHE)
-  unset(GMPXX_FOUND)
-  unset(GMPXX_FOUND CACHE)
-  unset(MPFR_FOUND)
-  unset(MPFR_FOUND CACHE)
-  unset(WITH_CGAL_Core)
-  unset(WITH_CGAL_Core CACHE)
-  unset(WITH_GMP)
-  unset(WITH_GMP CACHE)
-  unset(WITH_GMPXX)
-  unset(WITH_GMPXX CACHE)
-  unset(WITH_MPFR)
-  unset(WITH_MPFR CACHE)
-
-  # Nasty trick to make sure <gmp.h> is not used when CGAL_DISABLE_GMP is TRUE
-  file(WRITE "${CMAKE_BINARY_DIR}/include/gmp.h"
-    "#error GMP is disabled by the CMake option CGAL_DISABLE_GMP")
-else()
-  list(APPEND      CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES GMP MPFR)
-  # Where CMake is run several times, to avoid duplicates
-  list (REMOVE_DUPLICATES CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES)
-  file(REMOVE "${CMAKE_BINARY_DIR}/include/gmp.h")
-endif()
-hide_variable(CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES)
-
-foreach (lib ${CGAL_SUPPORTING_3RD_PARTY_LIBRARIES}) 
-
-  # set standard prefix
-  if(NOT DEFINED CGAL_EXT_LIB_${lib}_PREFIX)
-    set(CGAL_EXT_LIB_${lib}_PREFIX ${lib})
-  endif()
-  hide_variable(CGAL_EXT_LIB_${lib}_PREFIX)
-
-  # add option
-  list( FIND CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES "${lib}" POSITION )
-  if ( "${POSITION}" STRGREATER "-1" ) # if lib is essential
-   option(WITH_${lib} "Select external library ${lib}" ON)
-  else()
-    option(WITH_${lib} "Select external library ${lib}" OFF)
-  endif()
-
-endforeach()
-
-#--------------------------------------------------------------------------------------------------
-#
-#                                    -= DEPENDENCIES =-
-#
-#--------------------------------------------------------------------------------------------------
-
-#
-# The following variables are in the cache just so subdirectories can set them persistently.
-# But they are not intended to persist from run to run as normal cache variables.
-# Similar variables are created when a library is detected.
-#
-cache_set(CGAL_3RD_PARTY_PRECONFIGURED  "" )
-
-cache_set(CGAL_3RD_PARTY_DEFINITIONS    "" )
-cache_set(CGAL_3RD_PARTY_INCLUDE_DIRS   "" )
-cache_set(CGAL_3RD_PARTY_LIBRARIES      "" )
-cache_set(CGAL_3RD_PARTY_LIBRARIES_DIRS "" ) 
-
-# default is on, but some use-cases need to set it to off, e.g., debian packages
-option( CGAL_ENABLE_PRECONFIG "Select to allow to preconfiguration of external libraries" ON)
-
-# additional info: some header files in CGAL add additional code if
-# certain optional libs are installed, and some examples/tests rely on
-# this; e.g. in MPFI/RS in Algebraic_kernel_d. For these cases CGAL
-# and the example/test must be configured with MPFI (just one is not sufficient)
-
-option( CGAL_ALLOW_ALL_PRECONFIGURED_LIBS_COMPONENT "Select to allow to use all preconfigured external libraries" OFF)
- 
-include(CGAL_SetupDependencies)
-
-message("== Detect external libraries (DONE) ==\n")
-
-#--------------------------------------------------------------------------------------------------
-#
-#                                    -= Generation of compiler_config.h =-
-#
-#--------------------------------------------------------------------------------------------------
-
-# The variables set are the #defines expected by compiler_config.h
-# Note: CMake will not notice when files are added or removed
-# but this is probably OK for the installation procedure.
-
-message("== Write compiler_config.h ==")
-
-macro(add_config_flag flag)
-  if(${flag})
-      file(APPEND ${CMAKE_BINARY_DIR}/include/CGAL/compiler_config.h "#define ${flag} 1\n\n")
-    else()
-      file(APPEND ${CMAKE_BINARY_DIR}/include/CGAL/compiler_config.h "//#define ${flag} 1\n\n")
-    endif()
-endmacro()
-
-file(GLOB all_config_tests "${CGAL_INSTALLATION_PACKAGE_DIR}/config/testfiles/*.cpp")
-list(SORT all_config_tests)
-
-file(WRITE ${CMAKE_BINARY_DIR}/include/CGAL/compiler_config.h "//\n// compiler_config.h is included by CGAL headers to load the needed compiler settings.\n//\n// DO NOT EDIT compiler_config.h. It is generated by CMake.\n//\n\n")
-
-foreach(config_test_cpp ${all_config_tests})
-  # Test's name is .cpp's base name
-  get_filename_component(config_test_name ${config_test_cpp} NAME_WE)
-
-  # Compile and run ${config_test_cpp}. Exit code is stored in ${config_test_name}.
-  CHECK_CXX_FILE_RUNS(${config_test_cpp} ${config_test_name} ${config_test_name})
-  if(${config_test_name})
-    set(${config_test_name} 0)
-  else()
-    set(${config_test_name} 1)
-  endif()
-
-  add_config_flag(${config_test_name} ${config_test_name})
-endforeach()
-
-add_config_flag(CGAL_USE_GMP)
-add_config_flag(CGAL_USE_MPFR)
-add_config_flag(CGAL_USE_GMPXX)
-add_config_flag(CGAL_USE_LEDA)
-add_config_flag(CGAL_USE_MPFI)
-add_config_flag(CGAL_USE_RS)
-add_config_flag(CGAL_USE_NTL)
-
-add_config_flag( CGAL_BUILD_SHARED_LIBS )
-
-if (NOT ${WITH_CGAL_Core}) 
-  set(CGAL_USE_CORE FALSE)
-else()
-  set(CGAL_USE_CORE ${CGAL_USE_GMP})
-endif()
-add_config_flag( CGAL_USE_CORE )
-# ^^ there is CGAL_USE_CORE and not CGAL_HAS_CORE, as CORE is considered
-# as external lib and not as CGAL component (EBEB: 24 Jan 2012)
-
-if ( RUNNING_CGAL_AUTO_TEST AND MSVC )
-  file( APPEND "${CMAKE_BINARY_DIR}/include/CGAL/compiler_config.h" "#include <CGAL/Testsuite/vc_debug_hook.h>\n\n" )
-endif()
-
-#--------------------------------------------------------------------------------------------------
-#
-#                                    -= Installation Setup =-
-#
-#--------------------------------------------------------------------------------------------------
-
-set ( CGAL_INSTALL_INC_DIR "include" CACHE STRING "The folder where CGAL header files will be installed, relative to CMAKE_INSTALL_PREFIX" )
-set ( CGAL_INSTALL_LIB_DIR "lib"     CACHE STRING "The folder where CGAL libraries will be installed, relative to CMAKE_INSTALL_PREFIX" )
-
-if ( CGAL_WIN32_CMAKE_ON_CYGWIN )
-  exec_program(cygpath ARGS -w "${CMAKE_INSTALL_PREFIX}" OUTPUT_VARIABLE CMAKE_INSTALL_PREFIX2 )
-  file ( TO_CMAKE_PATH ${CMAKE_INSTALL_PREFIX2} CMAKE_INSTALL_PREFIX )
-endif()
-
-set ( CGAL_INSTALL_BIN_DIR    "bin"                     
-  CACHE STRING "The folder where CGAL user-side scripts will be installed, relative to CMAKE_INSTALL_PREFIX" 
-  )
-
-set ( CGAL_INSTALL_CMAKE_DIR "${CGAL_INSTALL_LIB_DIR}/CGAL"
-  CACHE STRING "The folder where CGAL CMake modules will be installed, relative to CMAKE_INSTALL_PREFIX" 
-  )
-
-set ( CGAL_INSTALL_DOC_DIR "share/doc/${CGAL_VERSION_DIR}"  
-  CACHE STRING "The folder where CGAL documentation and license files will be installed, relative to CMAKE_INSTALL_PREFIX" 
-  )
-
-set ( CGAL_INSTALL_MAN_DIR "share/man/man1"  
-  CACHE STRING "The folder where manual pages for CGAL scripts will be installed, relative to CMAKE_INSTALL_PREFIX" 
-  )
-
-message("== Write compiler_config.h (DONE) ==\n")
-
-#--------------------------------------------------------------------------------------------------
-#
-#                                    -= Build =-
-#
-#--------------------------------------------------------------------------------------------------
-
-message("== Generating build files ==")
-
-set(CGAL_LIBRARIES_DIR ${CMAKE_BINARY_DIR}/lib)
-
-set(CGAL_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/include)
-
-foreach (package ${CGAL_CONFIGURED_PACKAGES})
-  set(CGAL_INCLUDE_DIRS ${CGAL_INCLUDE_DIRS} ${package}/include)
-endforeach()
-
-include_directories (${CGAL_INCLUDE_DIRS})
-
-cache_get(CGAL_3RD_PARTY_PRECONFIGURED )
-
-cache_get(CGAL_3RD_PARTY_DEFINITIONS   )
-cache_get(CGAL_3RD_PARTY_INCLUDE_DIRS  )
-cache_get(CGAL_3RD_PARTY_LIBRARIES     )
-cache_get(CGAL_3RD_PARTY_LIBRARIES_DIRS) 
-
-add_subdirectory(src)
-
-#
-# Repeat some problems
-#
-message("== Generating build files (DONE) ==\n")
-
-if (CGAL_BRANCH_BUILD AND CGAL_REPORT_DUPLICATE_FILES )
-
-  message( STATUS "Problems: ")
-
-  if (CGAL_DUPLICATE_HEADER_FILES)
-    message(WARNING "WARNING: Duplicate header files")
-    foreach(hfile ${CGAL_DUPLICATE_HEADER_FILES})
-      message(STATUS "  File '${hfile}' multiply found in ")
-      foreach (package ${CGAL_CONFIGURED_PACKAGES})
-        file(GLOB_RECURSE CGAL_PACKAGE_HEADER_FILES FOLLOW_SYMLINKS ${package}/*.h)
-        foreach (file ${CGAL_PACKAGE_HEADER_FILES})
-          string(REPLACE "${package}/" "" pure_file ${file})
-          if ("${pure_file}" STREQUAL "${hfile}")
-            message(STATUS "    ${package}")
-          endif()
-        endforeach()
-      endforeach()
-    endforeach()
-  endif()
-
-  if (CGAL_DUPLICATE_CPP_FILES)
-    message(WARNING "WARNING: Duplicate cpp files")
-    foreach(cfile ${CGAL_DUPLICATE_CPP_FILES})
-      message(STATUS "  File '${cfile}' multiply found in ")
-      foreach (package ${CGAL_CONFIGURED_PACKAGES})
-        file(GLOB_RECURSE CGAL_PACKAGE_CPP_FILES FOLLOW_SYMLINKS ${package}/*.cpp)
-        foreach (file ${CGAL_PACKAGE_CPP_FILES})
-          string(REPLACE "${package}/" "" pure_file ${file})
-          if ("${pure_file}" STREQUAL "${cfile}")
-            message(STATUS "    ${package}")
-          endif()
-        endforeach()
-      endforeach()
-    endforeach()
-  endif()
-
-endif()
-
-create_CGALconfig_files()
-
-#--------------------------------------------------------------------------------------------------
-#
-#                                    -= Installation Commands =-
-#
-#--------------------------------------------------------------------------------------------------
-
-# DESTINATION option is mandatory; skipping it breaks CPack!
-
-if(CGAL_INSTALL_DOC_DIR)
-  install(FILES AUTHORS CHANGES LICENSE LICENSE.FREE_USE LICENSE.GPL LICENSE.LGPL DESTINATION ${CGAL_INSTALL_DOC_DIR} )
-endif()
-
-#install all includes collected in trunk et cetera
-
-
-foreach (dir ${CGAL_CONFIGURED_PACKAGES})
-  if (EXISTS ${dir}/include/CGAL) 
-    install(DIRECTORY ${dir}/include/CGAL              DESTINATION ${CGAL_INSTALL_INC_DIR} PATTERN ".svn" EXCLUDE)
-  endif()
-endforeach()
-install(DIRECTORY ${CMAKE_BINARY_DIR}/include/CGAL     DESTINATION ${CGAL_INSTALL_INC_DIR} PATTERN ".svn" EXCLUDE)
-
-file(GLOB scripts "scripts/*")
-list(REMOVE_ITEM scripts 
-  ${CMAKE_CURRENT_SOURCE_DIR}/scripts/cgal_create_assertions.sh 
-  ${CMAKE_CURRENT_SOURCE_DIR}/scripts/cgal_create_cmake_script_with_options)
-install(PROGRAMS ${scripts} DESTINATION ${CGAL_INSTALL_BIN_DIR})
-
-install(DIRECTORY ${CGAL_MODULES_REL_DIR}/                DESTINATION ${CGAL_INSTALL_CMAKE_DIR} )
-install(FILES     ${CGAL_MODULES_REL_DIR}/UseCGAL.cmake   DESTINATION ${CGAL_INSTALL_CMAKE_DIR} )
-
-if ( GMP_IN_AUXILIARY )
-  install(DIRECTORY auxiliary/gmp/include/ DESTINATION ${CGAL_INSTALL_INC_DIR} )
-  install(DIRECTORY auxiliary/gmp/lib/     DESTINATION ${CGAL_INSTALL_LIB_DIR} )
-endif()
-
-if ( ZLIB_IN_AUXILIARY )
-  install(DIRECTORY auxiliary/zlib/include/ DESTINATION ${CGAL_INSTALL_INC_DIR} )
-  install(DIRECTORY auxiliary/zlib/lib/     DESTINATION ${CGAL_INSTALL_LIB_DIR} )
-endif()
-
-
-install(FILES ${CMAKE_BINARY_DIR}/config/CGALConfig.cmake DESTINATION ${CGAL_INSTALL_CMAKE_DIR} )
-
-if(CGAL_INSTALL_MAN_DIR)
-  install(FILES auxiliary/cgal_create_cmake_script.1 DESTINATION ${CGAL_INSTALL_MAN_DIR} )
-endif()
-
-#--------------------------------------------------------------------------------------------------
-#
-#              -= Special installation commands to copy FindCGAL to the cmake directory =-
-#
-#--------------------------------------------------------------------------------------------------
-
-# Installing FindCGAL into cmake itself is implemented as a custom target
-# because it requires superuser privileges
-
-if ( NOT "${CMAKE_ROOT}" STREQUAL "" )
-  if ( EXISTS ${CMAKE_ROOT}/Modules )
-    add_custom_target( install_FindCGAL
-                      COMMAND ${CMAKE_COMMAND} -E copy ${CGAL_MODULES_DIR}/FindCGAL.cmake ${CMAKE_ROOT}/Modules
-                    ) 
-  endif()
-endif()  
-
-#--------------------------------------------------------------------------------------------------
-#
-#                                    -= APPLICATIONS =-
-#
-#--------------------------------------------------------------------------------------------------
-
-macro( add_programs subdir target ON_OFF )
-
-  cache_set( CGAL_EXECUTABLE_TARGETS "" )
-  
-  add_custom_target( ${target} )
-  
-  option( WITH_${target} "Select ${target}" ${ON_OFF} )
-  if ( WITH_${target} )
-    add_subdirectory( ${subdir} EXCLUDE_FROM_ALL )
-  endif()
-  
-  cache_get( CGAL_EXECUTABLE_TARGETS )
-  
-  foreach( CGAL_EXECUTABLE_TARGET ${CGAL_EXECUTABLE_TARGETS} )
-    add_dependencies( ${target} ${CGAL_EXECUTABLE_TARGET} )
-  endforeach()
-     
-endmacro()
-
-# This allows programs to locate CGALConfig.cmake
-set(CGAL_DIR ${CMAKE_BINARY_DIR} )
-
-if ( NOT RUNNING_CGAL_AUTO_TEST )
-
-  add_programs(examples examples OFF )
-  add_programs(demo     demos    OFF )
-  if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/test")
-    add_programs(test     tests    OFF )
-  endif()
-endif()
-
-#--------------------------------------------------------------------------------------------------
-#
-#                                            -= CPack =-
-#
-#--------------------------------------------------------------------------------------------------
-
-#option( WITH_CPACK "Create package generation rules")
-if( WITH_CPACK AND EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake" )
-
-    set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "CGAL - Computational Geometry Algorithms Library")
-    set(CPACK_PACKAGE_VENDOR "CGAL Open Source Project")
-    set(CPACK_PACKAGE_DESCRIPTION_FILE "${CGAL_INSTALLATION_PACKAGE_DIR}/README")
-    set(CPACK_RESOURCE_FILE_LICENSE "${CGAL_INSTALLATION_PACKAGE_DIR}/LICENSE")
-    set(CPACK_PACKAGE_VERSION_MAJOR "${CGAL_MAJOR_VERSION}")
-    set(CPACK_PACKAGE_VERSION_MINOR "${CGAL_MINOR_VERSION}")
-    set(CPACK_PACKAGE_VERSION_PATCH "${CGAL_BUGFIX_VERSION}")
-    set(CPACK_PACKAGE_INSTALL_DIRECTORY "CGAL ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
-    set(CPACK_SOURCE_PACKAGE_FILE_NAME "CGAL-${CGAL_VERSION}")
-    set(CPACK_RESOURCE_FILE_LICENSE "${CGAL_INSTALLATION_PACKAGE_DIR}/LICENSE")
-    
-    if(NOT DEFINED CPACK_SYSTEM_NAME)
-      set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
-    endif()
-    
-    if(${CPACK_SYSTEM_NAME} MATCHES "Windows")
-      if(CMAKE_CL_64)
-        set(CPACK_SYSTEM_NAME win64-${CMAKE_SYSTEM_PROCESSOR})
-      else()
-        set(CPACK_SYSTEM_NAME win32-${CMAKE_SYSTEM_PROCESSOR})
-      endif()
-    endif()
-    
-    if(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
-      set(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}-${CPACK_SYSTEM_NAME}")
-    endif()
-    
-    set(CPACK_PACKAGE_EXECUTABLES "CGAL" "CGAL")
-
-    if(WIN32 AND NOT UNIX)
-        set(CPACK_GENERATOR "NSIS")
-        # There is a bug in NSI that does not handle full unix paths properly. Make
-        # sure there is at least one set of four (4) backlasshes.
-        #set(CPACK_PACKAGE_ICON "${CGAL_INSTALLATION_PACKAGE_DIR}\\\\cgal_install.gif")
-        #set(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\CGAL.exe")
-        set(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} Computational Geometry Algorithms Library")
-        set(CPACK_NSIS_HELP_LINK "http:\\\\\\\\www.cgal.org")
-        set(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.cgal.org")
-        set(CPACK_NSIS_CONTACT "info at cgal.org")
-        set(CPACK_NSIS_MODIfY_PATH ON)
-    else()
-        set(CPACK_STRIP_FILES "")
-        set(CPACK_SOURCE_STRIP_FILES "")
-    endif()
-
-    include(CPack)
-    
-endif()
-
-
-if ( CGAL_BRANCH_BUILD )
-  option(CGAL_ENABLE_CHECK_HEADERS 
-    "Enable the special targets \"check_pkg_headers\", and \"check_pkg_<package>_headers\" for each package"
-    FALSE)
-
-  if(CGAL_ENABLE_CHECK_HEADERS)
-
-    if(NOT DEFINED CGAL_CHECK_SYNTAX_ONLY)
-      execute_process(COMMAND 
-        ${CMAKE_CXX_COMPILER} -x c++ -fsyntax-only ${CMAKE_CURRENT_SOURCE_DIR}/config/support/test_syntaxonly.cpp
-        ERROR_QUIET
-        RESULT_VARIABLE ok)
-      if(ok EQUAL 0)
-        set(CGAL_CHECK_SYNTAX_ONLY ON CACHE INTERNAL "")
-      else()
-        set(CGAL_CHECK_SYNTAX_ONLY OFF CACHE INTERNAL "")
-      endif()
-    endif(NOT DEFINED CGAL_CHECK_SYNTAX_ONLY)
-
-    if(NOT CGAL_CHECK_SYNTAX_ONLY)
-      message(FATAL_ERROR "Your compiler does not seem to support -fsyntax-only.
-You must disable CGAL_ENABLE_CHECK_HEADERS.")
-    endif()
-
-    ## Fill the variable include_options with all the -I and -isystem options
-    set(include_options)
-    foreach (incdir ${CGAL_INCLUDE_DIRS})
-      list(APPEND include_options "-I${incdir}")
-    endforeach()
-    foreach (incdir ${CGAL_3RD_PARTY_INCLUDE_DIRS})
-      list(APPEND include_options "-isystem${incdir}")
-    endforeach()
-    include_directories ( SYSTEM ${CGAL_3RD_PARTY_INCLUDE_DIRS} )
-
-    ## Loop on package and headers
-    set(check_pkg_target_list)
-    foreach (package ${CGAL_CONFIGURED_PACKAGES_NAMES})
-      if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../${package}/include)
-        set(depends "")
-        file(GLOB ${package}_HEADERS 
-          RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/../${package}/include" 
-          "${CMAKE_CURRENT_SOURCE_DIR}/../${package}/include/CGAL/*.h")
-        foreach(header ${${package}_HEADERS})
-          string(REPLACE "/" "__" header2 "${header}")
-          string(REPLACE "." "_" header2 "${header2}")
-          add_custom_command(OUTPUT check_${header2}
-            COMMAND ${CMAKE_CXX_COMPILER} ${CGAL_3RD_PARTY_DEFINITIONS} ${CGAL_DEFINITIONS} ${include_options} -x c++ -fsyntax-only "${CMAKE_CURRENT_SOURCE_DIR}/../${package}/include/${header}"
-            COMMAND ${CMAKE_COMMAND} -E touch check_${header2}
-            DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/../${package}/include/${header}"
-            VERBATIM
-            COMMENT "Check header ${header}"
-            )
-          list(APPEND depends check_${header2})
-        endforeach() # look on headers
-        add_custom_target(check_pkg_${package}_headers DEPENDS ${depends})
-        list(APPEND check_pkg_target_list check_pkg_${package}_headers)
-      endif() # if the package has an include directory
-    endforeach() # loop on packages
-    add_custom_target(check_headers DEPENDS ${check_pkg_target_list})
-  endif()
-endif( CGAL_BRANCH_BUILD )
-
-if(NOT CGAL_BRANCH_BUILD AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/doc")
-  # in a non-branch build this is the top-level CMakeLists.txt
-  add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/doc")
-endif()
diff --git a/3rdparty/CGAL-4.8/VERSION b/3rdparty/CGAL-4.8/VERSION
deleted file mode 100644
index b6afe80..0000000
--- a/3rdparty/CGAL-4.8/VERSION
+++ /dev/null
@@ -1 +0,0 @@
-4.8
\ No newline at end of file
diff --git a/3rdparty/CGAL-4.8/auxiliary/cgal_create_cmake_script.1 b/3rdparty/CGAL-4.8/auxiliary/cgal_create_cmake_script.1
deleted file mode 100644
index 4267dfe..0000000
--- a/3rdparty/CGAL-4.8/auxiliary/cgal_create_cmake_script.1
+++ /dev/null
@@ -1,42 +0,0 @@
-.TH CGAL_CREATE_CMAKE_SCRIPT "1" "April 2016" "CGAL 4.8" "User Commands"
-.SH NAME
-cgal_create_cmake_script \- create a cmake script for applications using CGAL
-.SH SYNOPSIS
-.B cgal_create_cmake_script
-.BR [ example | demo | test ]
-.SH DESCRIPTION
-The script
-.B cgal_create_cmake_script
-allows the simple creation of cmake scripts for applications which use the CGAL
-library. The parameter selects one of three script types, the default type
-is
-.BR example .
-.SH OPTIONS
-.PP
-.TP
-.B example
-Create a cmake script for several simple applications. Each
-.I C
-and
-.IR cpp
-file in the current directory containing a
-.I main()
-function is compiled and linked as a separate executable.
-.TP
-.B demo
-Create a cmake script for a single application. All
-.I C
-and
-.IR cpp
-files in the current directory are compiled and linked into one executable.
-.TP
-.B test
-Create a cmake script that is suited for the testsuite used by the CGAL developers.
-.SH AUTHOR
-The CGAL project (http://www.cgal.org/).
-.SH "REPORTING BUGS"
-Report bugs to <cgal-discuss at inria.fr> (see http://www.cgal.org/
-for further instructions).
-.SH "SEE ALSO"
-The full documentation for CGAL is available at http://www.cgal.org/ in PDF and
-HTML format.
diff --git a/3rdparty/CGAL-4.8/cmake/modules/CGALConfig_binary.cmake.in b/3rdparty/CGAL-4.8/cmake/modules/CGALConfig_binary.cmake.in
deleted file mode 100644
index 4f0ad5d..0000000
--- a/3rdparty/CGAL-4.8/cmake/modules/CGALConfig_binary.cmake.in
+++ /dev/null
@@ -1,167 +0,0 @@
-#
-# This files contains definitions needed to use CGAL in a program.
-# DO NOT EDIT THIS. The definitons have been generated by CMake at configuration time.
-# This file is loaded by cmake via the command "find_package(CGAL)"
-#
-# This file correspond to a possibly out-of-sources CGAL configuration, thus the actual location
-# must be given by the cmake variable or enviroment variable CGAL_DIR. 
-
-set(CGAL_CONFIG_LOADED TRUE)
-
-get_filename_component(CGAL_CONFIG_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
-
-# The code for including exported targets is different from
-# CGAL_Config_install.cmake. We do not have separate export files in
-# an installed version and we need to make sure that we are not
-# currently building CGAL. Note that for CMake<=2.8.11 (detected by
-# the absence of CMP0024), the else() condition is never used.
-if(NOT POLICY CMP0024 OR NOT CGAL_BUILDING_LIBS)
-  include("${CGAL_CONFIG_DIR}/CGALExports.cmake")
-
-  macro(CGAL_get_property_optional VAR TARGET PROPERTY)
-    if(TARGET ${TARGET})
-      get_property(${VAR} TARGET ${TARGET} PROPERTY ${PROPERTY})
-    else()
-      set(${VAR} "")
-    endif()
-  endmacro()
-
-  if(NOT MSVC)
-    CGAL_get_property_optional(CGAL_LIBRARY CGAL::CGAL LOCATION)
-    CGAL_get_property_optional(CGAL_Core_LIBRARY CGAL::CGAL_Core LOCATION)
-    CGAL_get_property_optional(CGAL_ImageIO_LIBRARY CGAL::CGAL_ImageIO LOCATION)
-    CGAL_get_property_optional(CGAL_Qt5_LIBRARY CGAL::CGAL_Qt5 LOCATION)
-  else()
-    set(CGAL_LIBRARY         "")
-    set(CGAL_Core_LIBRARY    "")
-    set(CGAL_ImageIO_LIBRARY "")
-    set(CGAL_Qt5_LIBRARY     "")
-  endif()
-else()
-  # We are currently in a CGAL Build and CGALExports.cmake has not
-  # necessarily been created yet. Just alias the targets. Also don't
-  # access the LOCATION property here to set lib_LIBRARY, since those
-  # targets are not imported and this is disallowed by CMP0026. Just
-  # set it to the target name.
-  macro(CGAL_alias_library lib)
-    if(TARGET ${lib} AND NOT TARGET CGAL::${lib})
-      add_library(CGAL::${lib} ALIAS ${lib})
-      set(${lib}_LIBRARY CGAL::${lib})
-    else()
-      set(${lib}_LIBRARY "")
-    endif()
-  endmacro()
-
-  CGAL_alias_library(CGAL)
-  CGAL_alias_library(CGAL_Core)
-  CGAL_alias_library(CGAL_ImageIO)
-  CGAL_alias_library(CGAL_Qt5)
-endif()
-
-# Check for possible config files of our libraries and include them.
-file(GLOB CGAL_CONFIG_FILES LIST_DIRECTORIES false
-  RELATIVE "${CGAL_CONFIG_DIR}" "${CGAL_CONFIG_DIR}/*LibConfig.cmake")
-foreach(configfile ${CGAL_CONFIG_FILES})
-  include("${CGAL_CONFIG_DIR}/${configfile}")
-endforeach()
-
-set(CGAL_INSTALLATION_PACKAGE_DIR "@CGAL_INSTALLATION_PACKAGE_DIR@")
-set(CGAL_CORE_PACKAGE_DIR "@CGAL_CORE_PACKAGE_DIR@")
-
-set(CGAL_MAJOR_VERSION    "@CGAL_MAJOR_VERSION@" )
-set(CGAL_MINOR_VERSION    "@CGAL_MINOR_VERSION@" )
-set(CGAL_BUILD_VERSION    "@CGAL_BUILD_VERSION@" )
-set(CGAL_SCM_BRANCH_NAME  "@CGAL_SCM_BRANCH_NAME@")
-set(CGAL_GIT_SHA1         "@CGAL_GIT_SHA1@")
-
-set(CGAL_BUILD_SHARED_LIBS        "@CGAL_BUILD_SHARED_LIBS@" )
-set(CGAL_Boost_USE_STATIC_LIBS    "@CGAL_Boost_USE_STATIC_LIBS@" )
-
-set(CGAL_CXX_FLAGS_INIT                   "@CMAKE_CXX_FLAGS@" )
-set(CGAL_CXX_FLAGS_RELEASE_INIT           "@CMAKE_CXX_FLAGS_RELEASE@" )
-set(CGAL_CXX_FLAGS_DEBUG_INIT             "@CMAKE_CXX_FLAGS_DEBUG@" )
-set(CGAL_MODULE_LINKER_FLAGS_INIT         "@CMAKE_MODULE_LINKER_FLAGS@" )
-set(CGAL_MODULE_LINKER_FLAGS_RELEASE_INIT "@CMAKE_MODULE_LINKER_FLAGS_RELEASE@" )
-set(CGAL_MODULE_LINKER_FLAGS_DEBUG_INIT   "@CMAKE_MODULE_LINKER_FLAGS_DEBUG@" )
-set(CGAL_SHARED_LINKER_FLAGS_INIT         "@CMAKE_SHARED_LINKER_FLAGS@" )
-set(CGAL_SHARED_LINKER_FLAGS_RELEASE_INIT "@CMAKE_SHARED_LINKER_FLAGS_RELEASE@" )
-set(CGAL_SHARED_LINKER_FLAGS_DEBUG_INIT   "@CMAKE_SHARED_LINKER_FLAGS_DEBUG@" )
-set(CGAL_BUILD_TYPE_INIT                  "@CMAKE_BUILD_TYPE@" )
-
-set(CGAL_INCLUDE_DIRS      "@CGAL_INCLUDE_DIRS@" )
-set(CGAL_MODULES_DIR       "@CGAL_MODULES_DIR@" )
-set(CGAL_LIBRARIES_DIR     "@CGAL_LIBRARIES_DIR@" )
-
-# If CGAL_ImageIO is built, tell if it was linked with Zlib.
-set(CGAL_ImageIO_USE_ZLIB                 "@CGAL_ImageIO_USE_ZLIB@" )
-
-set(CGAL_VERSION "${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}.${CGAL_BUILD_VERSION}")
-
-set(CGAL_USE_FILE "${CGAL_MODULES_DIR}/UseCGAL.cmake" )
-
-set(CGAL_ALLOW_ALL_PRECONFIGURED_LIBS_COMPONENT "@CGAL_ALLOW_ALL_PRECONFIGURED_LIBS_COMPONENT@")
-
-if ( CGAL_FIND_REQUIRED )
-  set( CHECK_CGAL_COMPONENT_MSG_ON_ERROR TRUE        )
-  set( CHECK_CGAL_COMPONENT_ERROR_TYPE   FATAL_ERROR )
-  set( CHECK_CGAL_COMPONENT_ERROR_TITLE  "ERROR:"    )
-else()
-  if ( NOT CGAL_FIND_QUIETLY )
-    set( CHECK_CGAL_COMPONENT_MSG_ON_ERROR TRUE      )
-    set( CHECK_CGAL_COMPONENT_ERROR_TYPE   STATUS    )
-    set( CHECK_CGAL_COMPONENT_ERROR_TITLE "NOTICE:" )
-  else()  
-    set( CHECK_CGAL_COMPONENT_MSG_ON_ERROR FALSE )
-  endif()
-endif()
-
-set(CGAL_CONFIGURED_LIBRARIES "@CGAL_CONFIGURED_LIBRARIES@")
-
-macro(check_cgal_component COMPONENT)
-
-  set( CGAL_LIB ${COMPONENT} )
-  #message("LIB: ${CGAL_LIB}")
-
-  if ( "${CGAL_LIB}" STREQUAL "CGAL" )
-    set( CGAL_FOUND TRUE )
-    set( CHECK_CGAL_ERROR_TAIL "" )
-  else() 
-    if ( WITH_${CGAL_LIB} )
-      if(TARGET CGAL::${CGAL_LIB})
-        set( ${CGAL_LIB}_FOUND TRUE )
-      else()
-        set( ${CGAL_LIB}_FOUND FALSE )
-        set( CHECK_${CGAL_LIB}_ERROR_TAIL " CGAL was configured with WITH_${CGAL_LIB}=ON, but one of the dependencies of ${CGAL_LIB} was not configured properly." )
-      endif()
-    else()
-      set( ${CGAL_LIB}_FOUND FALSE )
-      set( CHECK_${CGAL_LIB}_ERROR_TAIL " Please configure CGAL using WITH_${CGAL_LIB}=ON." )
-    endif()
-  endif()  
-
-  if ( NOT ${CGAL_LIB}_FOUND AND CHECK_CGAL_COMPONENT_MSG_ON_ERROR )
-    message( ${CHECK_CGAL_COMPONENT_ERROR_TYPE} "${CHECK_CGAL_COMPONENT_ERROR_TITLE} The ${CGAL_LIB} library was not configured.${CHECK_${CGAL_LIB}_ERROR_TAIL}" )
-  endif()
-  
-endmacro()
-
-check_cgal_component("CGAL")
-
-foreach( CGAL_COMPONENT ${CGAL_FIND_COMPONENTS} )
-  list (FIND CGAL_CONFIGURED_LIBRARIES "CGAL_${CGAL_COMPONENT}" POSITION)
-  if ("${POSITION}" STRGREATER "-1") # means: CGAL_COMPONENT is contained in list
-    check_cgal_component("CGAL_${CGAL_COMPONENT}")
-# TODO EBEB do something for supporting lib in check_component?
-  endif()
-endforeach()
-
-# Starting with cmake 2.6.3, CGAL_FIND_COMPONENTS is cleared out when find_package returns.
-# But we need it within UseCGAL.cmake, so we save it aside into another variable
-set( CGAL_REQUESTED_COMPONENTS ${CGAL_FIND_COMPONENTS} )
-
-# for preconfigured libs
-set(CGAL_ENABLE_PRECONFIG "@CGAL_ENABLE_PRECONFIG@")
-set(CGAL_SUPPORTING_3RD_PARTY_LIBRARIES "@CGAL_SUPPORTING_3RD_PARTY_LIBRARIES@")
-set(CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES "@CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES@")
-
-set(CGAL_DISABLE_GMP "@CGAL_DISABLE_GMP@")
diff --git a/3rdparty/CGAL-4.8/cmake/modules/CGALConfig_install.cmake.in b/3rdparty/CGAL-4.8/cmake/modules/CGALConfig_install.cmake.in
deleted file mode 100644
index 72d1e4e..0000000
--- a/3rdparty/CGAL-4.8/cmake/modules/CGALConfig_install.cmake.in
+++ /dev/null
@@ -1,122 +0,0 @@
-#
-# This files contains definitions needed to use CGAL in a program.
-# DO NOT EDIT THIS. The definitons have been generated by CMake at configuration time.
-# This file is loaded by cmake via the command "find_package(CGAL)"
-#
-# This file correspond to a CGAL installation with "make install", thus the actual location
-# must be given by the cmake variable or enviroment variable CGAL_DIR. 
-
-set(CGAL_CONFIG_LOADED TRUE)
-
-get_filename_component(CGAL_CONFIG_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
-
-# CGAL_DIR is the directory where this CGALConfig.cmake is installed
-set(CGAL_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@")
-
-set(CGAL_MAJOR_VERSION    "@CGAL_MAJOR_VERSION@" )
-set(CGAL_MINOR_VERSION    "@CGAL_MINOR_VERSION@" )
-set(CGAL_BUILD_VERSION    "@CGAL_BUILD_VERSION@" )
-set(CGAL_SCM_BRANCH_NAME  "@CGAL_SCM_BRANCH_NAME@")
-set(CGAL_GIT_SHA1         "@CGAL_GIT_SHA1@")
-
-set(CGAL_BUILD_SHARED_LIBS        "@CGAL_BUILD_SHARED_LIBS@" )
-set(CGAL_Boost_USE_STATIC_LIBS    "@CGAL_Boost_USE_STATIC_LIBS@" )
-
-set(CGAL_CXX_FLAGS_INIT                   "@CMAKE_CXX_FLAGS@" )
-set(CGAL_CXX_FLAGS_RELEASE_INIT           "@CMAKE_CXX_FLAGS_RELEASE@" )
-set(CGAL_CXX_FLAGS_DEBUG_INIT             "@CMAKE_CXX_FLAGS_DEBUG@" )
-set(CGAL_MODULE_LINKER_FLAGS_INIT         "@CMAKE_MODULE_LINKER_FLAGS@" )
-set(CGAL_MODULE_LINKER_FLAGS_RELEASE_INIT "@CMAKE_MODULE_LINKER_FLAGS_RELEASE@" )
-set(CGAL_MODULE_LINKER_FLAGS_DEBUG_INIT   "@CMAKE_MODULE_LINKER_FLAGS_DEBUG@" )
-set(CGAL_SHARED_LINKER_FLAGS_INIT         "@CMAKE_SHARED_LINKER_FLAGS@" )
-set(CGAL_SHARED_LINKER_FLAGS_RELEASE_INIT "@CMAKE_SHARED_LINKER_FLAGS_RELEASE@" )
-set(CGAL_SHARED_LINKER_FLAGS_DEBUG_INIT   "@CMAKE_SHARED_LINKER_FLAGS_DEBUG@" )
-set(CGAL_BUILD_TYPE_INIT                  "@CMAKE_BUILD_TYPE@" )
-
-set(CGAL_INCLUDE_DIRS  "@CMAKE_INSTALL_PREFIX@/@CGAL_INSTALL_INC_DIR@" )
-set(CGAL_MODULES_DIR   "@CMAKE_INSTALL_PREFIX@/@CGAL_INSTALL_CMAKE_DIR@" )
-set(CGAL_LIBRARIES_DIR "@CMAKE_INSTALL_PREFIX@/@CGAL_INSTALL_LIB_DIR@" )
-
-# If CGAL_ImageIO is built, tell if it was linked with Zlib.
-set(CGAL_ImageIO_USE_ZLIB                 "@CGAL_ImageIO_USE_ZLIB@" )
-
-set(CGAL_VERSION "${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}.${CGAL_BUILD_VERSION}")
-
-set(CGAL_USE_FILE "${CGAL_MODULES_DIR}/UseCGAL.cmake" )
-
-set(CGAL_ALLOW_ALL_PRECONFIGURED_LIBS_COMPONENT "@CGAL_ALLOW_ALL_PRECONFIGURED_LIBS_COMPONENT@")
-
-if ( CGAL_FIND_REQUIRED )
-  set( CHECK_CGAL_COMPONENT_MSG_ON_ERROR TRUE        )
-  set( CHECK_CGAL_COMPONENT_ERROR_TYPE   FATAL_ERROR )
-  set( CHECK_CGAL_COMPONENT_ERROR_TITLE  "ERROR:"    )
-else()
-  if ( NOT CGAL_FIND_QUIETLY )
-    set( CHECK_CGAL_COMPONENT_MSG_ON_ERROR TRUE      )
-    set( CHECK_CGAL_COMPONENT_ERROR_TYPE   STATUS    )
-    set( CHECK_CGAL_COMPONENT_ERROR_TITLE "NOTICE:" )
-  else()  
-    set( CHECK_CGAL_COMPONENT_MSG_ON_ERROR FALSE )
-  endif()
-endif()
-
-set(CGAL_CONFIGURED_LIBRARIES "@CGAL_CONFIGURED_LIBRARIES@")
-
-macro(check_cgal_component COMPONENT)
-
-  set( CGAL_LIB ${COMPONENT} )
-  #message("LIB: ${CGAL_LIB}")
-
-  if ( "${CGAL_LIB}" STREQUAL "CGAL" )
-    set( CGAL_FOUND TRUE )
-    # include CGAL export file
-    include(${CGAL_CONFIG_DIR}/CGALExports.cmake)
-    # include config file
-    include(${CGAL_CONFIG_DIR}/CGALLibConfig.cmake)
-    set( CHECK_CGAL_ERROR_TAIL "" )
-  else() 
-    if (EXISTS ${CGAL_CONFIG_DIR}/${CGAL_LIB}LibConfig.cmake)
-      # include export files for requested component
-      include(${CGAL_CONFIG_DIR}/${CGAL_LIB}Exports.cmake)
-      # include config file (defining WITH_${CGAL_LIB})
-      include(${CGAL_CONFIG_DIR}/${CGAL_LIB}LibConfig.cmake)
-    endif()
-    if ( WITH_${CGAL_LIB} )
-      if(TARGET CGAL::${CGAL_LIB})
-        set( ${CGAL_LIB}_FOUND TRUE )
-      else()
-        set( ${CGAL_LIB}_FOUND FALSE )
-        set( CHECK_${CGAL_LIB}_ERROR_TAIL " CGAL was configured with WITH_${CGAL_LIB}=ON, but one of the dependencies of ${CGAL_LIB} was not configured properly." )
-      endif()
-    else()
-      set( ${CGAL_LIB}_FOUND FALSE )
-      set( CHECK_${CGAL_LIB}_ERROR_TAIL " Please configure CGAL using WITH_${CGAL_LIB}=ON." )
-    endif()
-  endif()  
-
-  if ( NOT ${CGAL_LIB}_FOUND AND CHECK_CGAL_COMPONENT_MSG_ON_ERROR )
-    message( ${CHECK_CGAL_COMPONENT_ERROR_TYPE} "${CHECK_CGAL_COMPONENT_ERROR_TITLE} The ${CGAL_LIB} library was not configured.${CHECK_${CGAL_LIB}_ERROR_TAIL}" )
-  endif()
-  
-endmacro()
-
-check_cgal_component("CGAL")
-
-foreach( CGAL_COMPONENT ${CGAL_FIND_COMPONENTS} )
-  list (FIND CGAL_CONFIGURED_LIBRARIES "CGAL_${CGAL_COMPONENT}" POSITION)
-  if ("${POSITION}" STRGREATER "-1") # means: CGAL_COMPONENT is contained in list
-    check_cgal_component("CGAL_${CGAL_COMPONENT}")
-# TODO EBEB do something for supporting lib in check_component?
-  endif()
-endforeach()
-
-# Starting with cmake 2.6.3, CGAL_FIND_COMPONENTS is cleared out when find_package returns.
-# But we need it within UseCGAL.cmake, so we save it aside into another variable
-set( CGAL_REQUESTED_COMPONENTS ${CGAL_FIND_COMPONENTS} )
-
-# for preconfigured libs
-set(CGAL_ENABLE_PRECONFIG "@CGAL_ENABLE_PRECONFIG@")
-set(CGAL_SUPPORTING_3RD_PARTY_LIBRARIES "@CGAL_SUPPORTING_3RD_PARTY_LIBRARIES@")
-set(CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES "@CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES@")
-
-set(CGAL_DISABLE_GMP "@CGAL_DISABLE_GMP@")
diff --git a/3rdparty/CGAL-4.8/cmake/modules/CGALLibConfig.cmake.in b/3rdparty/CGAL-4.8/cmake/modules/CGALLibConfig.cmake.in
deleted file mode 100644
index cfbbf2b..0000000
--- a/3rdparty/CGAL-4.8/cmake/modules/CGALLibConfig.cmake.in
+++ /dev/null
@@ -1,32 +0,0 @@
-set(WITH_ at LIBRARY_NAME@ "ON")
-
-# The else condition of this code is never used in an installed
-# version since it cannot happen there. Note also that for
-# CMake<=2.8.11 (detected by the absence of CMP0024), the else()
-# condition is never used.
-if(NOT POLICY CMP0024 OR NOT CGAL_BUILDING_LIBS)
-  if(NOT MSVC)
-    get_property(@LIBRARY_NAME at _LIBRARY TARGET CGAL::@LIBRARY_NAME@ PROPERTY LOCATION)
-  else()
-    set(@LIBRARY_NAME at _LIBRARY "")
-  endif()
-else()
-  # We are currently in a CGAL Build and CGALExports.cmake has not
-  # necessarily been created yet. Just alias the targets. Also don't
-  # access the LOCATION property here to set lib_LIBRARY, since those
-  # targets are not imported and this is disallowed by CMP0026. Just
-  # set it to the target name.
-  if(TARGET @LIBRARY_NAME@ AND NOT TARGET CGAL::@LIBRARY_NAME@)
-    add_library(CGAL::@LIBRARY_NAME@ ALIAS @LIBRARY_NAME@)
-    set(@LIBRARY_NAME at _LIBRARY CGAL::@LIBRARY_NAME@)
-  else()
-    set(@LIBRARY_NAME at _LIBRARY "")
-  endif()
-endif()
-
-
-# 3RD_PARTY variables.
-set(@LIBRARY_NAME at _3RD_PARTY_INCLUDE_DIRS   "@@LIBRARY_NAME at _3RD_PARTY_INCLUDE_DIRS@")
-set(@LIBRARY_NAME at _3RD_PARTY_DEFINITIONS    "@@LIBRARY_NAME at _3RD_PARTY_DEFINITIONS@")
-set(@LIBRARY_NAME at _3RD_PARTY_LIBRARIES_DIRS "@@LIBRARY_NAME at _3RD_PARTY_LIBRARIES_DIRS@")
-set(@LIBRARY_NAME at _3RD_PARTY_LIBRARIES      "@@LIBRARY_NAME at _3RD_PARTY_LIBRARIES@")
diff --git a/3rdparty/CGAL-4.8/cmake/modules/CGAL_Common.cmake b/3rdparty/CGAL-4.8/cmake/modules/CGAL_Common.cmake
deleted file mode 100644
index ad652ed..0000000
--- a/3rdparty/CGAL-4.8/cmake/modules/CGAL_Common.cmake
+++ /dev/null
@@ -1,58 +0,0 @@
-include(CGAL_Macros)
-
-if(RUNNING_CGAL_AUTO_TEST)
-# Just to avoid a warning from CMake if that variable is set on the command line...
-endif()
-
-# Common settings for CGAL cmake scripts
-if( NOT CGAL_COMMON_FILE_INCLUDED )
-  set(CGAL_COMMON_FILE_INCLUDED 1 )
-
-  # CMAKE_ROOT must be properly configured, but is not by the CMake windows installer, so check here
-  if (NOT CMAKE_ROOT)
-    message( FATAL_ERROR "CMAKE_ROOT environment variable not set. It should point to the directory where CMake is installed.")
-  endif()
-
-  # CMAKE_VERSION was introduced in 2.6.3 so we use it to detect the fact
-  if ( CMAKE_VERSION )
-    set( CMAKE_2_6_3_OR_ABOVE TRUE )
-  else()
-    set( CMAKE_2_6_3_OR_ABOVE FALSE )
-  endif()
-    
-  if ( CGAL_BUILDING_LIBS )
-    option(BUILD_SHARED_LIBS "Build shared libraries" ON)
-    set(CGAL_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
-
-    if ( BUILD_SHARED_LIBS )
-      message( STATUS "Building shared libraries" )
-    else()
-      message( STATUS "Building static libraries" )
-    endif()
-  endif()
-  
-  if ( WIN32 )
-    find_program(CMAKE_UNAME uname /bin /usr/bin /usr/local/bin )
-    if(CMAKE_UNAME)
-      exec_program(uname ARGS -s OUTPUT_VARIABLE CMAKE_SYSTEM_NAME2)
-      if ( CMAKE_SYSTEM_NAME2 MATCHES "CYGWIN" )
-        message( STATUS "This is the Windows CMake running within the cygwin platform." )
-        set( CGAL_WIN32_CMAKE_ON_CYGWIN TRUE CACHE INTERNAL "This is the cygwin platform." )
-      endif()
-    endif()
-    hide_variable(CMAKE_UNAME)
-
-    # Optionally setup the Visual Leak Detector
-    include(CGAL_SetupVLD)
-    CGAL_SetupVLD()
-    if(VLD_FOUND)
-      message(STATUS "Visual Leak Detector (VLD) is enabled.")
-    else()
-      message(STATUS "Visual Leak Detector (VLD) is not found.")
-    endif()
-  endif()
-
-  # set minimal version of some optional libraries:
-  set( Eigen3_FIND_VERSION "3.1.0")
-  
-endif()
diff --git a/3rdparty/CGAL-4.8/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake b/3rdparty/CGAL-4.8/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake
deleted file mode 100644
index 21a6685..0000000
--- a/3rdparty/CGAL-4.8/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake
+++ /dev/null
@@ -1,37 +0,0 @@
-function(create_single_source_cgal_program firstfile )
-
-  if(NOT IS_ABSOLUTE "${firstfile}")
-    set(firstfile "${CMAKE_CURRENT_SOURCE_DIR}/${firstfile}")
-  endif()
-
-  get_filename_component(exe_name ${firstfile} NAME_WE)
-
-  if(EXISTS "${firstfile}")
-
-    set( all "${firstfile}" )
-
-    # remaining files
-    foreach( i ${ARGN} )
-      set( all ${all} ${CMAKE_CURRENT_SOURCE_DIR}/${i} )
-    endforeach()
-
-
-    add_executable(${exe_name} ${all})
-
-    add_to_cached_list( CGAL_EXECUTABLE_TARGETS ${exe_name} )
-
-    # Link the executable to CGAL and third-party libraries
-    if ( CGAL_AUTO_LINK_ENABLED )
-
-      target_link_libraries(${exe_name} ${CGAL_3RD_PARTY_LIBRARIES} )
-
-    else()
-
-      target_link_libraries(${exe_name} ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} )
-
-    endif()
-  else()
-    message(AUTHOR_WARNING "The executable ${exe_name} will not be created because the source file ${firstfile} does not exist.")
-  endif()
-
-endfunction()
diff --git a/3rdparty/CGAL-4.8/cmake/modules/CGAL_Macros.cmake b/3rdparty/CGAL-4.8/cmake/modules/CGAL_Macros.cmake
deleted file mode 100644
index 28c810e..0000000
--- a/3rdparty/CGAL-4.8/cmake/modules/CGAL_Macros.cmake
+++ /dev/null
@@ -1,724 +0,0 @@
-if( NOT CGAL_MACROS_FILE_INCLUDED )
-  set(CGAL_MACROS_FILE_INCLUDED 1 )
-
-  include("${CGAL_MODULES_DIR}/CGAL_VersionUtils.cmake")
-
-  # Probably unused. -- Laurent Rineau, 2011/07/21
-  macro(assert _arg )
-    if ( NOT ${_arg} )
-      message( FATAL_ERROR "Variable ${_arg} must be defined" )
-    endif()
-  endmacro()
-
-  macro( hide_variable var )
-    set ( ${var} ${${var}} CACHE INTERNAL "Variable hidden from user" FORCE )
-  endmacro()
-
-  macro( cache_set var )
-    set ( ${var} ${ARGN} CACHE INTERNAL "" )
-    set ( ${var} ${ARGN} CACHE INTERNAL "" )
-  endmacro()
-
-  macro( typed_cache_set type doc var )
-    set ( ${var} ${ARGN} CACHE ${type} ${doc} FORCE )
-    set ( ${var} ${ARGN} CACHE ${type} ${doc} FORCE )
-  endmacro()
-
-  macro( cache_get var )
-    set ( ${var} )
-  endmacro()
-
-  # Splits inlist in the first element (head) and the rest (tail)
-  macro( list_split head tail )
-    set( ${head} )
-    set( ${tail} )
-    set( _LS_is_head TRUE )
-    foreach( _LS_item ${ARGN} )
-      if ( _LS_is_head )
-        set( ${head} ${_LS_item} )
-        set( _LS_is_head FALSE )
-      else()
-        list( APPEND ${tail} ${_LS_item} )
-      endif()
-    endforeach()
-  endmacro()
-
-  # adds elements to an internal cached list
-  macro( add_to_cached_list listname )
-    cache_get ( ${listname} )
-    set( _ATC_${listname}_tmp  ${${listname}} )
-    if ( NOT "${ARGN}" STREQUAL "" )
-      list( APPEND _ATC_${listname}_tmp ${ARGN} )
-    endif()
-    cache_set ( ${listname} ${_ATC_${listname}_tmp} )
-  endmacro()
-
-  # adds elements to an in-memory variable named 'listname'
-  macro( add_to_memory_list listname )
-    if ( NOT "${ARGN}" STREQUAL "" )
-      list( APPEND ${listname} ${ARGN} )
-    endif()
-  endmacro()
-
-  # adds elements to a list.
-  # If the first argument after 'listname' is PERSISTENT then 'listname'
-  # is a persistent internal cached variable, otherwise is a memory variable.
-  macro( add_to_list listname )
-    list_split( _ATL_ARGN_HEAD _ATL_ARGN_TAIL ${ARGN} )
-    if ( "${_ATL_ARGN_HEAD}" STREQUAL "PERSISTENT" )
-      add_to_cached_list( ${listname} ${_ATL_ARGN_TAIL} )
-    else()
-      add_to_memory_list( ${listname} ${ARGN} )
-    endif()
-  endmacro()
-
-  # Probably unused. -- Laurent Rineau, 2011/07/21
-  macro( at list idx var )
-    list( LENGTH ${list} ${list}_length )
-    if ( ${idx} LESS ${${list}_length} )
-      list( GET ${list} ${idx} ${var} )
-    else()
-      set( ${var} "NOTFOUND" )
-    endif()
-  endmacro()
-
-  macro( found_in_list item_list item result )
-    set( ${result} "FALSE" )
-    foreach( element ${${item_list}} )
-      if ( "${element}" STREQUAL "${item}" )
-        set( ${result} "TRUE" )
-      endif()
-    endforeach()
-  endmacro()
-
-  macro( uniquely_add_flags target_var )
-    if ( "${ARGC}" GREATER "1"  )
-      set( target_list "${${target_var}}" )
-      set( source_list "${ARGN}" )
-      separate_arguments( target_list )
-      separate_arguments( source_list )
-      foreach( flag ${source_list} )
-        found_in_list( target_list ${flag} ${flag}_FOUND )
-        if ( NOT ${flag}_FOUND )
-          typed_cache_set( STRING "User-defined flags" ${target_var} "${${target_var}} ${flag}" )
-        endif()
-      endforeach()
-    endif()
-  endmacro()
-
-  function( CGAL_display_compiler_version )
-    set(search_dirs "")
-    message("Compiler version:")
-    set(version "Unknown compiler. Cannot display its version")
-    if(MSVC)
-      execute_process(COMMAND "${CMAKE_CXX_COMPILER}"
-        RESULT_VARIABLE ok
-        ERROR_VARIABLE out_version
-        TIMEOUT 5)
-      if(ok EQUAL 0)
-        set(version "${out_version}")
-      endif()
-    else()
-      foreach(flag "-V" "--version" "-v")
-        execute_process(COMMAND "${CMAKE_CXX_COMPILER}" ${flag}
-          RESULT_VARIABLE ok
-          OUTPUT_VARIABLE out_version
-          ERROR_VARIABLE out_version
-          TIMEOUT 5)
-        if(ok EQUAL 0)
-          if("${out_version}" MATCHES "^clang")
-            execute_process(COMMAND "${CMAKE_CXX_COMPILER}" -print-search-dirs
-              RESULT_VARIABLE ok
-              OUTPUT_VARIABLE out_search_dirs
-              TIMEOUT 5)
-            if(ok EQUAL 0)
-              set(search_dirs "${out_search_dirs}")
-            endif()
-          endif()
-          set(version "${out_version}")
-          break()
-        endif()
-      endforeach()
-    endif()
-    message("${version}")
-    if(search_dirs)
-      message("Search dirs:")
-      message("${search_dirs}")
-    endif()
-  endfunction()
-
-  macro( get_dependency_version LIB )
-
-    if ( "${ARGC}" GREATER "1" )
-      set( PKG ${ARGV1} )
-    else()
-      set( PKG ${LIB} )
-    endif()
-
-    if ( ${PKG}_FOUND )
-
-      set ( ${LIB}_VERSION "unknown" )
-
-      try_run( ${LIB}_RUN_RES
-               ${LIB}_COMPILE_RES
-               "${CMAKE_BINARY_DIR}"
-               "${CGAL_INSTALLATION_PACKAGE_DIR}/config/support/print_${LIB}_version.cpp"
-               CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${${PKG}_INCLUDE_DIR};${${PKG}_DEPENDENCY_INCLUDE_DIR}"
-                           "-DLINK_LIBRARIES:STRING=${${PKG}_LIBRARIES};${${PKG}_DEPENDENCY_LIBRARIES}"
-                           "-DLINK_DIRECTORIES:STRING=${${PKG}_LIBRARIES_DIR};${${PKG}_DEPENDENCY_LIBRARIES_DIR}"
-               OUTPUT_VARIABLE ${LIB}_OUTPUT
-            )
-
-      if ( ${LIB}_COMPILE_RES )
-
-        if ( ${LIB}_RUN_RES EQUAL "0" )
-
-          string( REGEX MATCH "version=.*\$" ${LIB}_VERSION_LINE ${${LIB}_OUTPUT}  )
-          string( REPLACE "\n" "" ${LIB}_VERSION_LINE2 ${${LIB}_VERSION_LINE} )
-          string( REPLACE "\r" "" ${LIB}_VERSION_LINE3 ${${LIB}_VERSION_LINE2} )
-          string( REPLACE "version=" "" ${LIB}_VERSION ${${LIB}_VERSION_LINE3} )
-
-        else()
-
-          message( STATUS "WARNING: ${LIB} found but print_${LIB}_version.cpp exited with error condition: ${${LIB}_RUN_RES}" )
-          message( STATUS "${PKG}_INCLUDE_DIR=${${PKG}_INCLUDE_DIR}" )
-          message( STATUS "${PKG}_LIBRARIES=${${PKG}_LIBRARIES}" )
-          message( STATUS "${PKG}_LIBRARIES_DIR=${${PKG}_LIBRARIES_DIR}" )
-          message( STATUS "${${LIB}_OUTPUT}" )
-
-        endif()
-
-      else()
-
-        message( STATUS "WARNING: ${LIB} found but could not compile print_${LIB}_version.cpp:")
-        message( STATUS "${PKG}_INCLUDE_DIR=${${PKG}_INCLUDE_DIR}" )
-        message( STATUS "${PKG}_LIBRARIES=${${PKG}_LIBRARIES}" )
-        message( STATUS "${PKG}_LIBRARIES_DIR=${${PKG}_LIBRARIES_DIR}" )
-        message( STATUS "${${LIB}_OUTPUT}" )
-
-      endif()
-
-      message( STATUS "USING ${LIB}_VERSION = '${${LIB}_VERSION}'" )
-
-    endif()
-
-  endmacro()
-
-  macro( use_lib )
-
-    set (lib "${ARGV0}")
-
-    set (vlib ${CGAL_EXT_LIB_${lib}_PREFIX} )
-
-    if ( ${vlib}_FOUND AND (NOT TARGET CGAL OR WITH_${lib}))
-
-      if ( NOT ${vlib}_SETUP ) # avoid double usage
-
-        if ( "${ARGC}" EQUAL "2" )
-
-          set (usefile "${ARGV1}")
-
-          include( ${usefile} )
-          message (STATUS "Configured ${lib} from UseLIB-file: ${usefile}")
-
-          # UseLIB-file has to set ${vlib}_SETUP to TRUE
-          # TODO EBEB what about Qt5, zlib?
-
-        else()
-
-          ####message( STATUS "${lib} include:     ${${vlib}_INCLUDE_DIR}" )
-          include_directories ( SYSTEM ${${vlib}_INCLUDE_DIR} )
-
-          # TODO EBEB remove definitions?
-          ####message( STATUS "${lib} definitions: ${${vlib}_DEFINITIONS}" )
-          add_definitions( ${${vlib}_DEFINITIONS} "-DCGAL_USE_${vlib}" )
-
-          if ( ${vlib}_LIBRARIES )
-            ####message( STATUS "${lib} libraries:   ${${vlib}_LIBRARIES}" )
-            link_libraries( ${${vlib}_LIBRARIES} )
-          endif()
-
-          ####message (STATUS "Configured ${lib} in standard way")
-
-          set( ${vlib}_SETUP TRUE )
-
-        endif()
-
-      endif()
-
-      if (NOT ${vlib}_SETUP )
-
-         message( WARNING "${vlib} has not been set up" )
-
-      endif()
-
-    else()
-
-      if ( WITH_${lib} )
-        message( SEND_ERROR "Try to use ${lib} that is not found")
-      endif()
-
-    endif()
-
-  endmacro()
-
-
-  macro( use_component component)
-
-    message (STATUS "Requested component: ${component}")
-
-    if(WITH_CGAL_${component})
-      if(TARGET CGAL_${component})
-        add_to_list( CGAL_LIBRARIES CGAL_${component} )
-      else()
-        add_to_list( CGAL_LIBRARIES ${CGAL_${component}_LIBRARY} )
-      endif()
-      add_to_list( CGAL_3RD_PARTY_LIBRARIES  ${CGAL_${component}_3RD_PARTY_LIBRARIES}  )
-
-      add_to_list( CGAL_3RD_PARTY_INCLUDE_DIRS   ${CGAL_${component}_3RD_PARTY_INCLUDE_DIRS}   )
-      add_to_list( CGAL_3RD_PARTY_DEFINITIONS    ${CGAL_${component}_3RD_PARTY_DEFINITIONS}    )
-      add_to_list( CGAL_3RD_PARTY_LIBRARIES_DIRS ${CGAL_${component}_3RD_PARTY_LIBRARIES_DIRS} )
-
-      # Nothing to add for Core
-
-      if (${component} STREQUAL "ImageIO")
-        find_package( OpenGL QUIET )
-        find_package( ZLIB QUIET )
-      endif()
-
-      if (${component} STREQUAL "Qt5")
-        find_package( OpenGL QUIET )
-        find_package( Qt5 QUIET COMPONENTS OpenGL Svg )
-      endif()
-
-    else(WITH_CGAL_${component})
-
-      # now we are talking about 3rd party libs
-
-      if ( ${component} STREQUAL "ALL_PRECONFIGURED_LIBS" )
-
-        if (CGAL_ALLOW_ALL_PRECONFIGURED_LIBS_COMPONENT)
-          message( STATUS "External libraries are all used")
-          foreach ( CGAL_3RD_PARTY_LIB ${CGAL_SUPPORTING_3RD_PARTY_LIBRARIES})
-            if (${CGAL_3RD_PARTY_LIB}_FOUND)
-              use_lib( ${CGAL_3RD_PARTY_LIB} ${${CGAL_3RD_PARTY_LIB}_USE_FILE})
-            endif()
-          endforeach()
-        else()
-          message( SEND_ERROR "Component ALL_PRECONFIGURED_LIBS only allow with CGAL_ALLOW_ALL_PRECONFIGURED_LIBS_COMPONENT=ON")
-        endif()
-
-      else()
-
-        list( FIND CGAL_CONFIGURED_LIBRARIES "CGAL_${component}" POSITION )
-        if ( "${POSITION}" EQUAL "-1" ) # if component is not a CGAL_<lib>
-
-          if (NOT DEFINED CGAL_EXT_LIB_${component}_PREFIX)
-            set(CGAL_EXT_LIB_${component}_PREFIX ${component})
-          endif()
-
-          set( vlib "${CGAL_EXT_LIB_${component}_PREFIX}" )
-
-          if ( NOT CGAL_IGNORE_PRECONFIGURED_${component} AND ${vlib}_FOUND)
-
-            ####message( STATUS "External library ${component} has been preconfigured")
-            use_lib( ${component} ${${vlib}_USE_FILE})
-
-          else()
-
-            ####message( STATUS "External library ${component} has not been preconfigured")
-      if (${component} STREQUAL "ImageIO")
-        find_package( OpenGL )
-        find_package( ZLIB )
-      endif()
-
-      if (${component} STREQUAL "Qt5")
-                set(CGAL_${component}_FOUND TRUE)
-                find_package( OpenGL )
-                find_package (Qt5 COMPONENTS OpenGL Gui Core Script ScriptTools)
-      endif()
-            ####message( STATUS "External library ${vlib} after find")
-            if (${vlib}_FOUND)
-              ####message( STATUS "External library ${vlib} about to be used")
-              use_lib( ${component} ${${vlib}_USE_FILE})
-            endif()
-
-          endif()
-        else()
-
-          if (NOT WITH_CGAL_${component}) 
-            message(STATUS "NOTICE: The CGAL_${component} library seems to be required but is not build. Thus, it is expected that some executables will not be compiled.")
-          endif()
-
-        endif()
-
-      endif()
-
-    endif(WITH_CGAL_${component})
-
-  endmacro()
-
-  macro( use_essential_libs )
-
-    # Comment: This is subject to be changed in the future
-    #          - either more specific (giving precise include_dir- and link-order)
-    #          - or even less specific if order becomes less relevant
-    # Eric Berberich 2012/06/29
-
-    if(NOT CGAL_DISABLE_GMP)
-      if(RS_FOUND)
-        use_component( RS )
-      endif()
-
-      if(MPFI_FOUND)
-        use_component( MPFI )
-      endif()
-
-      if(MPFR_FOUND)
-        use_component( MPFR )
-      endif()
-
-      if (GMPXX_FOUND)
-        use_component( GMPXX )
-      endif()
-
-      if(GMP_FOUND)
-        use_component( GMP )
-      endif()
-    endif(NOT CGAL_DISABLE_GMP)
-
-    if(LEDA_FOUND)
-      use_component( LEDA )
-    endif()
-
-    if(NTL_FOUND)
-      use_component( NTL )
-    endif()
-  endmacro()
-
-
-  function( cgal_setup_module_path )
-    # Avoid to modify the modules path twice
-    if(NOT CGAL_MODULE_PATH_IS_SET)
-      # Where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
-      set(CGAL_CMAKE_MODULE_PATH ${CGAL_MODULES_DIR})
-
-      set(ORIGINAL_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} PARENT_SCOPE)
-
-      set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CGAL_CMAKE_MODULE_PATH})
-
-      # Export those variables to the parent scope (the scope that calls the function)
-      set(CGAL_MODULE_PATH_IS_SET TRUE PARENT_SCOPE)
-      set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" PARENT_SCOPE)
-      set(CGAL_CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" PARENT_SCOPE)
-      set(ORIGINAL_CMAKE_MODULE_PATH "${ORIGINAL_CMAKE_MODULE_PATH}" PARENT_SCOPE)
-    endif()
-  endfunction()
-
-  macro( create_CGALconfig_files )
-
-    # CGALConfig.cmake is platform specific so it is generated and stored in the binary folder.
-    configure_file("${CGAL_MODULES_DIR}/CGALConfig_binary.cmake.in"  "${CMAKE_BINARY_DIR}/CGALConfig.cmake"        @ONLY)
-
-    # There is also a version of CGALConfig.cmake that is prepared in case CGAL in installed in CMAKE_INSTALL_PREFIX.
-    configure_file("${CGAL_MODULES_DIR}/CGALConfig_install.cmake.in" "${CMAKE_BINARY_DIR}/config/CGALConfig.cmake" @ONLY)
-
-    #write prefix exceptions
-    file( APPEND ${CMAKE_BINARY_DIR}/CGALConfig.cmake "${SPECIAL_PREFIXES}\n")
-    file( APPEND ${CMAKE_BINARY_DIR}/config/CGALConfig.cmake "${SPECIAL_PREFIXES}")
-
-     foreach( lib ${CGAL_SUPPORTING_3RD_PARTY_LIBRARIES} )
-
-       list( FIND CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES "${lib}" POSITION )
-       # if lib is essential or preconfiguration for an activated library ...
-       if ( ("${POSITION}" STRGREATER "-1") OR ( CGAL_ENABLE_PRECONFIG AND WITH_${lib} ))
-
-         set (vlib ${CGAL_EXT_LIB_${lib}_PREFIX} )
-         #the next 'if' is needed to avoid ${vlib} config variables to be overidden in case of a local configuration change
-         file( APPEND ${CMAKE_BINARY_DIR}/CGALConfig.cmake "if (NOT CGAL_IGNORE_PRECONFIGURED_${lib})\n")
-         file( APPEND ${CMAKE_BINARY_DIR}/CGALConfig.cmake "  set( ${vlib}_FOUND           \"${${vlib}_FOUND}\" )\n")
-         file( APPEND ${CMAKE_BINARY_DIR}/CGALConfig.cmake "  set( ${vlib}_USE_FILE        \"${${vlib}_USE_FILE}\" )\n")
-         file( APPEND ${CMAKE_BINARY_DIR}/CGALConfig.cmake "  set( ${vlib}_INCLUDE_DIR     \"${${vlib}_INCLUDE_DIR}\" )\n")
-         file( APPEND ${CMAKE_BINARY_DIR}/CGALConfig.cmake "  set( ${vlib}_LIBRARIES       \"${${vlib}_LIBRARIES}\" )\n")
-         file( APPEND ${CMAKE_BINARY_DIR}/CGALConfig.cmake "  set( ${vlib}_DEFINITIONS     \"${${vlib}_DEFINITIONS}\" )\n")
-         file( APPEND ${CMAKE_BINARY_DIR}/CGALConfig.cmake "endif()\n\n")
-
-
-         #the next 'if' is needed to avoid ${vlib} config variables to be overidden in case of a local configuration change
-         file( APPEND ${CMAKE_BINARY_DIR}/config/CGALConfig.cmake "if (NOT CGAL_IGNORE_PRECONFIGURED_${lib})\n")
-         file( APPEND ${CMAKE_BINARY_DIR}/config/CGALConfig.cmake "  set( ${vlib}_FOUND           \"${${vlib}_FOUND}\")\n")
-         file( APPEND ${CMAKE_BINARY_DIR}/config/CGALConfig.cmake "  set( ${vlib}_USE_FILE        \"${${vlib}_USE_FILE}\" )\n")
-         file( APPEND ${CMAKE_BINARY_DIR}/config/CGALConfig.cmake "  set( ${vlib}_INCLUDE_DIR     \"${${vlib}_INCLUDE_DIR}\" )\n")
-         file( APPEND ${CMAKE_BINARY_DIR}/config/CGALConfig.cmake "  set( ${vlib}_LIBRARIES       \"${${vlib}_LIBRARIES}\" )\n")
-         file( APPEND ${CMAKE_BINARY_DIR}/config/CGALConfig.cmake "  set( ${vlib}_DEFINITIONS     \"${${vlib}_DEFINITIONS}\" )\n")
-         file( APPEND ${CMAKE_BINARY_DIR}/config/CGALConfig.cmake "endif()\n\n")
-       endif()
-
-     endforeach()
-
-  endmacro()
-
-  macro ( fetch_env_var VAR )
-    if ( "${${VAR}}" STREQUAL "" )
-      set( ${VAR}_env_value "$ENV{${VAR}}" )
-      if ( NOT "${${VAR}_env_value}" STREQUAL "" )
-        # Convert Windows path to Unix-style
-        FILE(TO_CMAKE_PATH ${${VAR}_env_value} ${VAR})
-      endif()
-    endif()
-  endmacro()
-
-
-## All the following macros are probably unused. -- Laurent Rineau, 2011/07/21
-
-  # Composes a tagged list of libraries: a list with interpersed keywords or tags
-  # indicating that all following libraries, up to the next tag, are to be linked only for the
-  # corresponding build type. The 'general' tag indicates libraries that corresponds to all build types.
-  # 'optimized' corresponds to release builds and 'debug' to debug builds. Tags are case sensitve and
-  # the inital range of libraries listed before any tag is implicitely 'general'
-  #
-  # This macro takes 3 lists of general, optimized and debug libraries, resp, and populates the list
-  # given in the fourth argument.
-  #
-  # The first three parameters must be strings containing a semi-colon separated list of elements.
-  # All three lists must be passed, but any of them can be an empty string "".
-  # The fourth parameter, corresponding to the result, must be a variable name and it will be APPENDED
-  # (retaining any previous contents)
-  #
-  # If there is a last parameter whose value is "PERSISTENT" then the result is an internal cached variable,
-  # otherwise it is an in-memory variable
-  #
-  macro( compose_tagged_libraries libs_general libs_optimized libs_debug libs )
-
-    if ( "${ARGN}" STREQUAL "PERSISTENT" )
-      set( _CTL_IN_CACHE "PERSISTENT" )
-    else()
-      set( _CTL_IN_CACHE )
-    endif()
-
-    if ( NOT "${libs_general}" STREQUAL "" )
-      add_to_list( ${libs} ${_CTL_IN_CACHE} ${libs_general} )
-    endif()
-
-    if ( NOT "${libs_optimized}" STREQUAL "" )
-      add_to_list( ${libs} ${_CTL_IN_CACHE} optimized ${libs_optimized} )
-    endif()
-
-    if ( NOT "${libs_debug}" STREQUAL "" )
-      add_to_list( ${libs} ${_CTL_IN_CACHE} debug ${libs_debug} )
-    endif()
-
-  endmacro()
-
-  # Decomposes a tagged list of libraries (see macro compose_tagged_libraries).
-  # The first argument is the tagged list and the next 3 arguments are the lists
-  # where the general, optimized and debug libraries are collected.
-  #
-  # The first parameter must be a string containing a semi-colon separated list of elements.
-  # It cannot be ommitted, but it can be an empty string ""
-  #
-  # TThe next three arguments must be the names of the variables containing the result, and they
-  # will be APPENDED (retaining any previous contents)
-  #
-  # If there is a last parameter whose value is "PERSISTENT" then the result variables are internal in the cache,
-  # otherwise they are in-memory.
-  #
-  macro( decompose_tagged_libraries libs libs_general libs_optimized libs_debug )
-
-    if ( "${ARGN}" STREQUAL "PERSISTENT" )
-      set( _DTL_IN_CACHE "PERSISTENT" )
-    else()
-      set( _DTL_IN_CACHE )
-    endif()
-
-    set( _DTL_tag general )
-
-    foreach( _DTL_lib ${libs} )
-
-      if ( "${_DTL_lib}" STREQUAL "general" OR "${_DTL_lib}" STREQUAL "optimized" OR "${_DTL_lib}" STREQUAL "debug" )
-
-        set( _DTL_tag "${_DTL_lib}" )
-
-      else()
-
-        if (     "${_DTL_tag}" STREQUAL "general"   )
-                                                       set( _DTL_target ${libs_general}   )
-        elseif ( "${_DTL_tag}" STREQUAL "optimized" )
-                                                       set( _DTL_target ${libs_optimized} )
-        else()
-                                                       set( _DTL_target ${libs_debug}     )
-        endif()
-
-        add_to_list( ${_DTL_target} ${_DTL_IN_CACHE} ${_DTL_lib} )
-
-      endif()
-
-    endforeach()
-
-  endmacro()
-
-  # Given lists of optimized and debug libraries, creates a tagged list which will
-  # contain the libraries listed in the 'general' section if any of the two lists is empty,
-  #
-  # All arguments are variable names (not values), thus the input list can be undefined or empty.
-  # The return variable ('libs') will be APPENDED the result (retaining any previous contents)
-  #
-  # If there is a last parameter whose value is "PERSISTENT" then the result is an internal cached variable,
-  # otherwise it is an in-memory variable
-  #
-  # Example:
-  #
-  #   set( LIBS_1 libA.so libB.so )
-  #   set( LIBS_2 libC.so )
-  #
-  #   tag_libraries( LIBS_1 LIBS_2 LIBS_R )
-  #
-  # LIBS_R -> optimized;libA.so;libB.so;debug;libC.so
-  #
-  #   tag_libraries( LIBS_1 SOME_UNDEFINED_VARIABLE_OR_EMPTY_LIST LIBS_R )
-  #
-  # LIBS_R -> libA.so;libB.so  (implicitely 'general' since there is no tag)
-  #
-  #   tag_libraries( SOME_UNDEFINED_VARIABLE_OR_EMPTY_LIST LIBS_2 LIBS_R )
-  #
-  # LIBS_R -> libC.so  (implicitely 'general' since there is no tag)
-  #
-  macro( tag_libraries libs_general_or_optimized libs_general_or_debug libs )
-
-    list( LENGTH ${libs_general_or_optimized} _TL_libs_general_or_optimized_len )
-    list( LENGTH ${libs_general_or_debug}     _TL_libs_general_or_debug_len     )
-
-    if ( _TL_libs_general_or_optimized_len EQUAL 0 )
-                                                     compose_tagged_libraries( "${${libs_general_or_debug}}"     ""                                 ""                           ${libs} ${ARGN} )
-    elseif ( _TL_libs_general_or_debug_len EQUAL 0 )
-                                                     compose_tagged_libraries( "${${libs_general_or_optimized}}" ""                                 ""                           ${libs} ${ARGN} )
-    else()
-                                                     compose_tagged_libraries( ""                                "${${libs_general_or_optimized}}" "${${libs_general_or_debug}}" ${libs} ${ARGN} )
-    endif()
-
-  endmacro()
-
-  # add_to_tagged_libraries( libsR ${libsA} <PERSISTENT> )
-  #
-  # Appends the list of tagged libraries contained in the variable 'libA' to the list
-  # of tagged libraries contained in the variable 'libR', properly redistributing each tagged subsequence.
-  #
-  # The first argument is the name of the variable recieving the list. It will be APPENDED
-  # (retaining any previous contents).
-  # The second parameter is a single string value containing the tagged
-  # lists of libraries to append (as a semi-colon separated list). It can be empty, in which case noting is added.
-  #
-  # If there is a third parameter whose value is PERSISTENT, then 'libR' is an internal cached variable, otherwise
-  # it is an in-memory variable.
-  #
-  # It is not possible to append more than one list in the same call.
-  #
-  # Example:
-  #
-  #   set( LIBS_1 libG0.so libG1.so optimized libO0.so)
-  #   set( LIBS_2 libG2.so debug libD0.so)
-  #   set( LIBS_3 debug libD1.so optimized libO1.so libO2.so )
-  #
-  #   concat_tagged_libraries( LIBS_R ${LIBS_1} PERSISTENT )
-  #   concat_tagged_libraries( LIBS_R ${LIBS_2} PERSISTENT )
-  #   concat_tagged_libraries( LIBS_R ${LIBS_3} PERSISTENT )
-  #
-  # LIBS_R -> libG0.so;libG1.so;libG2.so;optimized;libO0.so;libO1.so;libO2.so;debug;libD0.so;libD1.so, in the cache
-  #
-  macro( add_to_tagged_libraries libsR in_cache libsA  )
-
-    if ( "${in_cache}" STREQUAL "PERSISTENT" )
-      set( _CTL_IN_CACHE "PERSISTENT" )
-    else()
-      set( _CTL_IN_CACHE )
-    endif()
-
-    set( _CTL_general_0   )
-    set( _CTL_optimized_0 )
-    set( _CTL_debug_0     )
-    set( _CTL_general_1   )
-    set( _CTL_optimized_1 )
-    set( _CTL_debug_0     )
-
-    decompose_tagged_libraries( "${${libsR}}" _CTL_general_0 _CTL_optimized_0 _CTL_debug_0 )
-    decompose_tagged_libraries( "${libsA}"    _CTL_general_1 _CTL_optimized_1 _CTL_debug_1 )
-
-    add_to_list( _CTL_general_0   ${_CTL_general_1}   )
-    add_to_list( _CTL_optimized_0 ${_CTL_optimized_1} )
-    add_to_list( _CTL_debug_0     ${_CTL_debug_1}     )
-
-    if ( "${_CTL_IN_CACHE}" STREQUAL "PERSISTENT" )
-      cache_set( ${libsR} )
-    else()
-      set( ${libsR} )
-    endif()
-
-    compose_tagged_libraries( "${_CTL_general_0}" "${_CTL_optimized_0}" "${_CTL_debug_0}" ${libsR} ${_CTL_IN_CACHE} )
-
-  endmacro()
-
-
-  macro( add_to_persistent_tagged_libraries libsR )
-    add_to_tagged_libraries( ${libsR} PERSISTENT "${ARGN}" )
-  endmacro()
-
-  macro( add_to_in_memory_tagged_libraries libsR )
-    add_to_tagged_libraries( ${libsR} NOT_PERSISTENT "${ARGN}" )
-  endmacro()
-
-
-endif()
-
-
-function(process_CGAL_subdirectory entry subdir type_name)
-  # For example, subdir can be "examples", type_name "example", and entry "Mesh_2"
-
-  if ( CGAL_BRANCH_BUILD )
-    string( REGEX REPLACE "${CMAKE_SOURCE_DIR}/.*/${subdir}/" "" ENTRY_DIR_NAME "${entry}" )
-  else()
-    string( REGEX REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" ENTRY_DIR_NAME "${entry}" )
-  endif()
-
-  if( NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") # out-of-source
-    make_directory("${CMAKE_BINARY_DIR}/${subdir}/${ENTRY_DIR_NAME}")
-  endif()
-
-  set(ADD_SUBDIR TRUE)
-
-  if(EXISTS ${entry}/../../dont_submit)
-    file(STRINGS ${entry}/../../dont_submit dont_submit_grep REGEX "^${ENTRY_DIR_NAME}/?\$")
-    if(dont_submit_grep)
-      set(ADD_SUBDIR FALSE)
-    endif()
-    file(STRINGS ${entry}/../../dont_submit dont_submit_grep REGEX "^${subdir}/${ENTRY_DIR_NAME}/?\$")
-    if(dont_submit_grep)
-      set(ADD_SUBDIR FALSE)
-    endif()
-    file(STRINGS ${entry}/../../dont_submit dont_submit_grep REGEX "^${subdir}/?\$")
-    if(dont_submit_grep)
-      set(ADD_SUBDIR FALSE)
-    endif()
-  endif()
-
-  if(ADD_SUBDIR)
-    message("\n-- Configuring ${subdir} in ${subdir}/${ENTRY_DIR_NAME}")
-    if(EXISTS ${entry}/CMakeLists.txt)
-      add_subdirectory( ${entry} ${CMAKE_BINARY_DIR}/${subdir}/${ENTRY_DIR_NAME} )
-    else()
-      if(CGAL_CREATE_CMAKE_SCRIPT)
-#        message("bah ${CGAL_CREATE_CMAKE_SCRIPT} ${type_name} --source_dir ${entry}")
-        execute_process(
-          COMMAND bash ${CGAL_CREATE_CMAKE_SCRIPT} ${type_name} --source_dir "${entry}"
-          WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/${subdir}/${ENTRY_DIR_NAME}"
-          RESULT_VARIABLE RESULT_VAR OUTPUT_QUIET)
-        if(NOT RESULT_VAR)
-#          message("Subdir ${CMAKE_BINARY_DIR}/${subdir}/${ENTRY_DIR_NAME}")
-          add_subdirectory( "${CMAKE_BINARY_DIR}/${subdir}/${ENTRY_DIR_NAME}" "${CMAKE_BINARY_DIR}/${subdir}/${ENTRY_DIR_NAME}")
-        endif()
-      endif()
-    endif()
-  else()
-    message(STATUS "${subdir}/${ENTRY_DIR_NAME} is in dont_submit")
-  endif()
-endfunction()
-
diff --git a/3rdparty/CGAL-4.8/cmake/modules/CGAL_SetupBoost.cmake b/3rdparty/CGAL-4.8/cmake/modules/CGAL_SetupBoost.cmake
deleted file mode 100644
index 0d5b557..0000000
--- a/3rdparty/CGAL-4.8/cmake/modules/CGAL_SetupBoost.cmake
+++ /dev/null
@@ -1,59 +0,0 @@
-if ( NOT CGAL_Boost_Setup )
-
-  include(CGAL_TweakFindBoost)
-
-  set ( CGAL_requires_Boost_libs TRUE )
-  if ( DEFINED  MSVC_VERSION AND "${MSVC_VERSION}" GREATER 1800)
-    set ( CGAL_requires_Boost_libs FALSE )
-  endif()
-  if ( CMAKE_COMPILER_IS_GNUCXX
-      AND(
-        #GCC 4.8+ with c++11 on
-        ( NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8
-          AND CMAKE_CXX_FLAGS MATCHES "\\-std=(c|gnu)\\+\\+[01][14yxz]")
-        #GCC 6.0+ without c++03 on
-        OR ( NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0
-             AND NOT CMAKE_CXX_FLAGS MATCHES "\\-std=(c|gnu)\\+\\+[90][83]")
-      ) )
-    set ( CGAL_requires_Boost_libs FALSE )
-  endif()
-
-  # In the documentation, we say we require Boost-1.48, but technically we
-  # require 1.39. Some packages may require more recent versions, though.
-  if (CGAL_requires_Boost_libs)
-    find_package( Boost 1.39 REQUIRED thread system )
-  else()
-    find_package( Boost 1.39 REQUIRED )
-  endif()
-
-  if(Boost_FOUND)
-    if(DEFINED Boost_DIR AND NOT Boost_DIR)
-      # Unset that cache variable that is set in the cache by FindBoost
-      # (while it was searching for boost-cmake).
-      unset(Boost_DIR CACHE)
-      set(Boost_NO_BOOST_CMAKE TRUE CACHE INTERNAL "Avoid future search of boost-cmake")
-    endif()
-  endif()
-  
-  message( STATUS "Boost include:     ${Boost_INCLUDE_DIRS}" )
-  message( STATUS "Boost libraries:   ${Boost_LIBRARIES}" )
-  message( STATUS "Boost definitions: ${Boost_DEFINITIONS}" )
-  
-  set ( CGAL_USE_BOOST 1 )
-  
-  include(CGAL_Macros)
-  
-  add_to_cached_list(CGAL_3RD_PARTY_INCLUDE_DIRS   ${Boost_INCLUDE_DIRS} )
-  add_to_cached_list(CGAL_3RD_PARTY_LIBRARIES_DIRS ${Boost_LIBRARY_DIRS} )
-  add_to_cached_list(CGAL_3RD_PARTY_DEFINITIONS    ${Boost_DEFINITIONS}  )
-  
-  if ( NOT MSVC )
-    add_to_cached_list(CGAL_3RD_PARTY_LIBRARIES ${Boost_LIBRARIES} )
-  endif()
-  
-  message( STATUS "USING BOOST_VERSION = '${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}'" )
-  
-  set ( CGAL_Boost_Setup TRUE )
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/cmake/modules/FindEigen3.cmake b/3rdparty/CGAL-4.8/cmake/modules/FindEigen3.cmake
deleted file mode 100644
index 70c07df..0000000
--- a/3rdparty/CGAL-4.8/cmake/modules/FindEigen3.cmake
+++ /dev/null
@@ -1,86 +0,0 @@
-# - Try to find Eigen3 lib
-#
-# This module supports requiring a minimum version, e.g. you can do
-#   find_package(Eigen3 3.1.2)
-# to require version 3.1.2 or newer of Eigen3.
-#
-# Once done this will define
-#
-#  EIGEN3_FOUND - system has eigen lib with correct version
-#  EIGEN3_INCLUDE_DIR - the eigen include directory
-#  EIGEN3_VERSION - eigen version
-
-# Copyright (c) 2006, 2007 Montel Laurent, <montel at kde.org>
-# Copyright (c) 2008, 2009 Gael Guennebaud, <g.gael at free.fr>
-# Copyright (c) 2009 Benoit Jacob <jacob.benoit.1 at gmail.com>
-# Redistribution and use is allowed according to the terms of the 2-clause BSD license.
-
-include(FindPackageHandleStandardArgs)
-
-if(NOT Eigen3_FIND_VERSION)
-  if(NOT Eigen3_FIND_VERSION_MAJOR)
-    set(Eigen3_FIND_VERSION_MAJOR 2)
-  endif(NOT Eigen3_FIND_VERSION_MAJOR)
-  if(NOT Eigen3_FIND_VERSION_MINOR)
-    set(Eigen3_FIND_VERSION_MINOR 91)
-  endif(NOT Eigen3_FIND_VERSION_MINOR)
-  if(NOT Eigen3_FIND_VERSION_PATCH)
-    set(Eigen3_FIND_VERSION_PATCH 0)
-  endif(NOT Eigen3_FIND_VERSION_PATCH)
-
-  set(Eigen3_FIND_VERSION "${Eigen3_FIND_VERSION_MAJOR}.${Eigen3_FIND_VERSION_MINOR}.${Eigen3_FIND_VERSION_PATCH}")
-endif(NOT Eigen3_FIND_VERSION)
-
-macro(_eigen3_get_version)
-  file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen3_version_header)
-
-  string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen3_world_version_match "${_eigen3_version_header}")
-  set(EIGEN3_WORLD_VERSION "${CMAKE_MATCH_1}")
-  string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen3_major_version_match "${_eigen3_version_header}")
-  set(EIGEN3_MAJOR_VERSION "${CMAKE_MATCH_1}")
-  string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen3_minor_version_match "${_eigen3_version_header}")
-  set(EIGEN3_MINOR_VERSION "${CMAKE_MATCH_1}")
-
-  set(EIGEN3_VERSION ${EIGEN3_WORLD_VERSION}.${EIGEN3_MAJOR_VERSION}.${EIGEN3_MINOR_VERSION})
-endmacro(_eigen3_get_version)
-
-set(EIGEN3_USE_FILE "UseEigen3")
-
-if (EIGEN3_INCLUDE_DIR)
-
-  if (EXISTS ${EIGEN3_INCLUDE_DIR}/signature_of_eigen3_matrix_library)
-    # in cache already and valid
-    _eigen3_get_version()
-    set(EIGEN3_FOUND ${EIGEN3_VERSION_OK})
-
-    find_package_handle_standard_args(Eigen3 
-      REQUIRED_VARS EIGEN3_INCLUDE_DIR
-      VERSION_VAR EIGEN3_VERSION)
-
-  else()
-    message(STATUS "Eigen3 path specified in cmake variable EIGEN3_INCLUDE_DIR is "
-                    "set to ${EIGEN3_INCLUDE_DIR}, but that path does not contains the file "
-                    "signature_of_eigen3_matrix_library and is considered as invalid.")
-  endif()
-
-
-
-else (EIGEN3_INCLUDE_DIR)
-
-  find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library
-      HINTS ENV EIGEN3_INC_DIR
-            ENV EIGEN3_DIR
-      PATHS ${KDE4_INCLUDE_DIR}
-      PATH_SUFFIXES include eigen3 eigen
-      DOC "Directory containing the Eigen3 header files"
-    )
-
-  if(EIGEN3_INCLUDE_DIR)
-    _eigen3_get_version()
-  endif(EIGEN3_INCLUDE_DIR)
-
-  find_package_handle_standard_args(Eigen3 
-    REQUIRED_VARS EIGEN3_INCLUDE_DIR
-    VERSION_VAR EIGEN3_VERSION)
-
-endif(EIGEN3_INCLUDE_DIR)
diff --git a/3rdparty/CGAL-4.8/cmake/modules/FindTBB.cmake b/3rdparty/CGAL-4.8/cmake/modules/FindTBB.cmake
deleted file mode 100644
index a29c6d9..0000000
--- a/3rdparty/CGAL-4.8/cmake/modules/FindTBB.cmake
+++ /dev/null
@@ -1,433 +0,0 @@
-# Locate Intel Threading Building Blocks include paths and libraries
-# FindTBB.cmake can be found at https://code.google.com/p/findtbb/
-# Written by Hannes Hofmann <hannes.hofmann _at_ informatik.uni-erlangen.de>
-# Improvements by Gino van den Bergen <gino _at_ dtecta.com>,
-#   Florian Uhlig <F.Uhlig _at_ gsi.de>,
-#   Jiri Marsik <jiri.marsik89 _at_ gmail.com>
-
-# The MIT License
-#
-# Copyright (c) 2011 Hannes Hofmann
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-# GvdB: This module uses the environment variable TBB_ARCH_PLATFORM which defines architecture and compiler.
-#   e.g. "ia32/vc8" or "em64t/cc4.1.0_libc2.4_kernel2.6.16.21"
-#   TBB_ARCH_PLATFORM is set by the build script tbbvars[.bat|.sh|.csh], which can be found
-#   in the TBB installation directory (TBB_INSTALL_DIR).
-#
-# GvdB: Mac OS X distribution places libraries directly in lib directory.
-#
-# For backwards compatibility, you may explicitely set the CMake variables TBB_ARCHITECTURE and TBB_COMPILER.
-# TBB_ARCHITECTURE [ ia32 | em64t | itanium ]
-#   which architecture to use
-# TBB_COMPILER e.g. vc9 or cc3.2.3_libc2.3.2_kernel2.4.21 or cc4.0.1_os10.4.9
-#   which compiler to use (detected automatically on Windows)
-
-# This module respects
-# TBB_INSTALL_DIR or $ENV{TBB21_INSTALL_DIR} or $ENV{TBB_INSTALL_DIR}
-
-# This module defines
-# TBB_INCLUDE_DIRS, where to find task_scheduler_init.h, etc.
-# TBB_LIBRARY_DIRS, where to find TBB libraries
-# TBB_INSTALL_DIR, the base TBB install directory.
-# TBB_LIBRARIES, all the following TBB libraries (both release and debug versions, using "optimized" and "debug" CMake keywords). Note that if the debug versions are not found, the release versions will be used instead for the debug mode.
-#   TBB_RELEASE_LIBRARY, the TBB release library
-#   TBB_MALLOC_RELEASE_LIBRARY, the TBB release malloc library
-#   TBB_DEBUG_LIBRARY, the TBB debug library
-#   TBB_MALLOC_DEBUG_LIBRARY, the TBB debug malloc library
-# TBB_FOUND, If false, don't try to use TBB.
-# TBB_INTERFACE_VERSION, as defined in tbb/tbb_stddef.h
-# TBB_MALLOCPROXY_DEBUG_LIBRARY, the TBB debug malloc_proxy library (not included in TBB_LIBRARIES since it's optionnal)
-# TBB_MALLOCPROXY_RELEASE_LIBRARY, the TBB release malloc_proxy library (not included in TBB_LIBRARIES since it's optionnal)
-
-include(CheckCXXSourceCompiles)
-
-# Usage:
-#   try_TBB_with_pthread(<result_var_name> [additional linker args...])
-function(try_TBB_with_pthread result_var)
-    set(TBB_try_ts_source "
-          #include <tbb/enumerable_thread_specific.h>
-          int main() {
-            tbb::enumerable_thread_specific<
-              bool*,
-              tbb::cache_aligned_allocator<bool*>,
-              tbb::ets_key_per_instance> grid;
-          }
-          ")
-    set(CMAKE_REQUIRED_LIBRARIES ${ALL_TBB_LIBRARIES} ${ARGN})
-    set(CMAKE_REQUIRED_INCLUDES ${TBB_INCLUDE_DIR})
-    check_cxx_source_compiles("${TBB_try_ts_source}" ${result_var})
-    set(${result_var} ${${result_var}} PARENT_SCOPE)
-endfunction(try_TBB_with_pthread)
-
-if (WIN32)
-    # has em64t/vc8 em64t/vc9
-    # has ia32/vc7.1 ia32/vc8 ia32/vc9
-    set(_TBB_DEFAULT_INSTALL_DIR "C:/Program Files/Intel/TBB" "C:/Program Files (x86)/Intel/TBB")
-    set(_TBB_LIB_RELEASE_NAME "tbb")
-    set(_TBB_LIB_MALLOC_RELEASE_NAME "${_TBB_LIB_RELEASE_NAME}malloc")
-    set(_TBB_LIB_MALLOCPROXY_RELEASE_NAME "${_TBB_LIB_RELEASE_NAME}malloc_proxy")
-    set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_RELEASE_NAME}_debug")
-    set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_RELEASE_NAME}_debug")
-    set(_TBB_LIB_MALLOCPROXY_DEBUG_NAME "${_TBB_LIB_MALLOCPROXY_RELEASE_NAME}_debug")
-    if (MSVC71)
-        set (_TBB_COMPILER "vc7.1")
-    endif(MSVC71)
-    if (MSVC80)
-        set(_TBB_COMPILER "vc8")
-    endif(MSVC80)
-    if (MSVC90)
-        set(_TBB_COMPILER "vc9")
-    endif(MSVC90)
-    if(MSVC10)
-        set(_TBB_COMPILER "vc10")
-    endif(MSVC10)
-    if(MSVC11)
-        set(_TBB_COMPILER "vc11")
-    endif(MSVC11)
-    if(MSVC12)
-	set(_TBB_COMPILER "vc12")
-    endif(MSVC12)
-    #note there was no MSVC13
-    if(MSVC14)
-	if(RUNNING_CGAL_AUTO_TEST)
-	    set (TBB_FOUND "NO")
-	    return()#binaries for TBB not publicly available when CGAL-4.7 is published
-	endif(RUNNING_CGAL_AUTO_TEST)
-	message(STATUS "[Warning] FindTBB.cmake: TBB 4.4 (latest available when CGAL-4.7 is published) does not provide support for MSVC 2015.")
-    endif(MSVC14)
-    # Todo: add other Windows compilers such as ICL.
-    set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
-endif (WIN32)
-
-if (UNIX)
-    if (APPLE)
-        # MAC
-        set(_TBB_DEFAULT_INSTALL_DIR "/Library/Frameworks/Intel_TBB.framework/Versions")
-        # libs: libtbb.dylib, libtbbmalloc.dylib, *_debug
-        set(_TBB_LIB_RELEASE_NAME "tbb")
-        set(_TBB_LIB_MALLOC_RELEASE_NAME "${_TBB_LIB_RELEASE_NAME}malloc")
-        #set(_TBB_LIB_MALLOCPROXY_RELEASE_NAME "${_TBB_LIB_RELEASE_NAME}malloc_proxy")
-        set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_RELEASE_NAME}_debug")
-        set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_RELEASE_NAME}_debug")
-        #set(_TBB_LIB_MALLOCPROXY_DEBUG_NAME "${_TBB_LIB_MALLOCPROXY_RELEASE_NAME}_debug")
-        # default flavor on apple: ia32/cc4.0.1_os10.4.9
-        # Jiri: There is no reason to presume there is only one flavor and
-        #       that user's setting of variables should be ignored.
-        if(NOT TBB_COMPILER)
-            set(_TBB_COMPILER "cc4.0.1_os10.4.9")
-        elseif (NOT TBB_COMPILER)
-            set(_TBB_COMPILER ${TBB_COMPILER})
-        endif(NOT TBB_COMPILER)
-        if(NOT TBB_ARCHITECTURE)
-            set(_TBB_ARCHITECTURE "ia32")
-        elseif(NOT TBB_ARCHITECTURE)
-            set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
-        endif(NOT TBB_ARCHITECTURE)
-    else (APPLE)
-        # LINUX
-        set(_TBB_DEFAULT_INSTALL_DIR "/opt/intel/tbb" "/usr/local/include" "/usr/include")
-        set(_TBB_LIB_RELEASE_NAME "tbb")
-        set(_TBB_LIB_MALLOC_RELEASE_NAME "${_TBB_LIB_RELEASE_NAME}malloc")
-        set(_TBB_LIB_MALLOCPROXY_RELEASE_NAME "${_TBB_LIB_RELEASE_NAME}malloc_proxy")
-        set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_RELEASE_NAME}_debug")
-        set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_RELEASE_NAME}_debug")
-        set(_TBB_LIB_MALLOCPROXY_DEBUG_NAME "${_TBB_LIB_MALLOCPROXY_RELEASE_NAME}_debug")
-        # has em64t/cc3.2.3_libc2.3.2_kernel2.4.21 em64t/cc3.3.3_libc2.3.3_kernel2.6.5 em64t/cc3.4.3_libc2.3.4_kernel2.6.9 em64t/cc4.1.0_libc2.4_kernel2.6.16.21
-        # has ia32/*
-        # has itanium/*
-        set(_TBB_COMPILER ${TBB_COMPILER})
-        set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
-    endif (APPLE)
-endif (UNIX)
-
-if (CMAKE_SYSTEM MATCHES "SunOS.*")
-# SUN
-# not yet supported
-# has em64t/cc3.4.3_kernel5.10
-# has ia32/*
-endif (CMAKE_SYSTEM MATCHES "SunOS.*")
-
-
-#-- Clear the public variables
-set (TBB_FOUND "NO")
-
-
-#-- Find TBB install dir and set ${_TBB_INSTALL_DIR} and cached ${TBB_INSTALL_DIR}
-# first: use CMake variable TBB_INSTALL_DIR
-if (TBB_INSTALL_DIR)
-    set (_TBB_INSTALL_DIR ${TBB_INSTALL_DIR})
-endif (TBB_INSTALL_DIR)
-# second: use environment variable
-if (NOT _TBB_INSTALL_DIR)
-    if (NOT "$ENV{TBBROOT}" STREQUAL "")
-        set (_TBB_INSTALL_DIR $ENV{TBBROOT})
-    endif (NOT "$ENV{TBBROOT}" STREQUAL "")
-    if (NOT "$ENV{TBB_INSTALL_DIR}" STREQUAL "")
-        set (_TBB_INSTALL_DIR $ENV{TBB_INSTALL_DIR})
-    endif (NOT "$ENV{TBB_INSTALL_DIR}" STREQUAL "")
-    # Intel recommends setting TBB21_INSTALL_DIR
-    if (NOT "$ENV{TBB21_INSTALL_DIR}" STREQUAL "")
-        set (_TBB_INSTALL_DIR $ENV{TBB21_INSTALL_DIR})
-    endif (NOT "$ENV{TBB21_INSTALL_DIR}" STREQUAL "")
-    if (NOT "$ENV{TBB22_INSTALL_DIR}" STREQUAL "")
-        set (_TBB_INSTALL_DIR $ENV{TBB22_INSTALL_DIR})
-    endif (NOT "$ENV{TBB22_INSTALL_DIR}" STREQUAL "")
-    if (NOT "$ENV{TBB30_INSTALL_DIR}" STREQUAL "")
-        set (_TBB_INSTALL_DIR $ENV{TBB30_INSTALL_DIR})
-    endif (NOT "$ENV{TBB30_INSTALL_DIR}" STREQUAL "")
-endif (NOT _TBB_INSTALL_DIR)
-# third: try to find path automatically
-if (NOT _TBB_INSTALL_DIR)
-    if (_TBB_DEFAULT_INSTALL_DIR)
-        set (_TBB_INSTALL_DIR ${_TBB_DEFAULT_INSTALL_DIR})
-    endif (_TBB_DEFAULT_INSTALL_DIR)
-endif (NOT _TBB_INSTALL_DIR)
-# sanity check
-if (NOT _TBB_INSTALL_DIR)
-    message ("ERROR: Unable to find Intel TBB install directory. ${_TBB_INSTALL_DIR}")
-else (NOT _TBB_INSTALL_DIR)
-# finally: set the cached CMake variable TBB_INSTALL_DIR
-if (NOT TBB_INSTALL_DIR)
-    set (TBB_INSTALL_DIR ${_TBB_INSTALL_DIR} CACHE PATH "Intel TBB install directory")
-    mark_as_advanced(TBB_INSTALL_DIR)
-endif (NOT TBB_INSTALL_DIR)
-
-
-#-- A macro to rewrite the paths of the library. This is necessary, because
-#   find_library() always found the em64t/vc9 version of the TBB libs
-macro(TBB_CORRECT_LIB_DIR var_name)
-#    if (NOT "${_TBB_ARCHITECTURE}" STREQUAL "em64t")
-        string(REPLACE em64t "${_TBB_ARCHITECTURE}" ${var_name} ${${var_name}})
-#    endif (NOT "${_TBB_ARCHITECTURE}" STREQUAL "em64t")
-    string(REPLACE ia32 "${_TBB_ARCHITECTURE}" ${var_name} ${${var_name}})
-    string(REPLACE vc7.1 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
-    string(REPLACE vc8 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
-    string(REPLACE vc9 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
-    string(REPLACE vc10 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
-    string(REPLACE vc11 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
-endmacro(TBB_CORRECT_LIB_DIR var_content)
-
-
-#-- Look for include directory and set ${TBB_INCLUDE_DIR}
-set (TBB_INC_SEARCH_DIR ${_TBB_INSTALL_DIR}/include)
-# Jiri: tbbvars now sets the CPATH environment variable to the directory
-#       containing the headers.
-#  LR: search first with NO_DEFAULT_PATH...
-find_path(TBB_INCLUDE_DIR
-    tbb/task_scheduler_init.h
-    PATHS ${TBB_INC_SEARCH_DIR} ENV CPATH
-    NO_DEFAULT_PATH
-)
-if(NOT TBB_INCLUDE_DIR)
-#  LR: ... and then search again with NO_DEFAULT_PATH if nothing was found in
-#  hinted paths
-  find_path(TBB_INCLUDE_DIR
-      tbb/task_scheduler_init.h
-      PATHS ${TBB_INC_SEARCH_DIR} ENV CPATH
-  )
-endif()
-mark_as_advanced(TBB_INCLUDE_DIR)
-
-
-#-- Look for libraries
-# GvdB: $ENV{TBB_ARCH_PLATFORM} is set by the build script tbbvars[.bat|.sh|.csh]
-if (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "")
-    set (_TBB_LIBRARY_DIR
-         ${_TBB_INSTALL_DIR}/lib/$ENV{TBB_ARCH_PLATFORM}
-         ${_TBB_INSTALL_DIR}/$ENV{TBB_ARCH_PLATFORM}/lib
-        )
-endif (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "")
-# Jiri: This block isn't mutually exclusive with the previous one
-#       (hence no else), instead I test if the user really specified
-#       the variables in question.
-if ((NOT ${TBB_ARCHITECTURE} STREQUAL "") AND (NOT ${TBB_COMPILER} STREQUAL ""))
-    # HH: deprecated
-    message(STATUS "[Warning] FindTBB.cmake: The use of TBB_ARCHITECTURE and TBB_COMPILER is deprecated and may not be supported in future versions. Please set \$ENV{TBB_ARCH_PLATFORM} (using tbbvars.[bat|csh|sh]).")
-    # Jiri: It doesn't hurt to look in more places, so I store the hints from
-    #       ENV{TBB_ARCH_PLATFORM} and the TBB_ARCHITECTURE and TBB_COMPILER
-    #       variables and search them both.
-    set (_TBB_LIBRARY_DIR "${_TBB_INSTALL_DIR}/${_TBB_ARCHITECTURE}/${_TBB_COMPILER}/lib" ${_TBB_LIBRARY_DIR})
-endif ((NOT ${TBB_ARCHITECTURE} STREQUAL "") AND (NOT ${TBB_COMPILER} STREQUAL ""))
-
-# GvdB: Mac OS X distribution places libraries directly in lib directory.
-list(APPEND _TBB_LIBRARY_DIR ${_TBB_INSTALL_DIR}/lib)
-
-# Jiri: No reason not to check the default paths. From recent versions,
-#       tbbvars has started exporting the LIBRARY_PATH and LD_LIBRARY_PATH
-#       variables, which now point to the directories of the lib files.
-#       It all makes more sense to use the ${_TBB_LIBRARY_DIR} as a HINTS
-#       argument instead of the implicit PATHS as it isn't hard-coded
-#       but computed by system introspection. Searching the LIBRARY_PATH
-#       and LD_LIBRARY_PATH environment variables is now even more important
-#       that tbbvars doesn't export TBB_ARCH_PLATFORM and it facilitates
-#       the use of TBB built from sources.
-#  LR: search first with NO_DEFAULT_PATH...
-find_library(TBB_RELEASE_LIBRARY ${_TBB_LIB_RELEASE_NAME} HINTS ${_TBB_LIBRARY_DIR}
-        PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH NO_DEFAULT_PATH)
-find_library(TBB_MALLOC_RELEASE_LIBRARY ${_TBB_LIB_MALLOC_RELEASE_NAME} HINTS ${_TBB_LIBRARY_DIR}
-        PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH NO_DEFAULT_PATH)
-find_library(TBB_MALLOCPROXY_RELEASE_LIBRARY ${_TBB_LIB_MALLOCPROXY_RELEASE_NAME} HINTS ${_TBB_LIBRARY_DIR}
-        PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH NO_DEFAULT_PATH)
-if(NOT TBB_RELEASE_LIBRARY OR NOT TBB_MALLOC_RELEASE_LIBRARY OR NOT TBB_MALLOCPROXY_RELEASE_LIBRARY)
-# LR: ... and then search again with NO_DEFAULT_PATH if nothing was found
-#  in hinted paths
-    find_library(TBB_RELEASE_LIBRARY ${_TBB_LIB_RELEASE_NAME} HINTS ${_TBB_LIBRARY_DIR}
-            PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
-    find_library(TBB_MALLOC_RELEASE_LIBRARY ${_TBB_LIB_MALLOC_RELEASE_NAME} HINTS ${_TBB_LIBRARY_DIR}
-            PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
-    find_library(TBB_MALLOCPROXY_RELEASE_LIBRARY ${_TBB_LIB_MALLOCPROXY_RELEASE_NAME} HINTS ${_TBB_LIBRARY_DIR}
-            PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
-endif()
-
-#Extract path from TBB_RELEASE_LIBRARY name
-get_filename_component(TBB_RELEASE_LIBRARY_DIR ${TBB_RELEASE_LIBRARY} PATH)
-
-#TBB_CORRECT_LIB_DIR(TBB_RELEASE_LIBRARY)
-#TBB_CORRECT_LIB_DIR(TBB_MALLOC_RELEASE_LIBRARY)
-#TBB_CORRECT_LIB_DIR(TBB_MALLOCPROXY_RELEASE_LIBRARY)
-mark_as_advanced(TBB_RELEASE_LIBRARY TBB_MALLOC_RELEASE_LIBRARY TBB_MALLOCPROXY_RELEASE_LIBRARY)
-
-#-- Look for debug libraries
-# Jiri: Changed the same way as for the release libraries.
-find_library(TBB_DEBUG_LIBRARY ${_TBB_LIB_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}
-        PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH NO_DEFAULT_PATH)
-find_library(TBB_MALLOC_DEBUG_LIBRARY ${_TBB_LIB_MALLOC_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}
-        PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH NO_DEFAULT_PATH)
-find_library(TBB_MALLOCPROXY_DEBUG_LIBRARY ${_TBB_LIB_MALLOCPROXY_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}
-        PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH NO_DEFAULT_PATH)
-if(NOT TBB_DEBUG_LIBRARY OR NOT TBB_MALLOC_DEBUG_LIBRARY OR NOT TBB_MALLOCPROXY_DEBUG_LIBRARY)
-    find_library(TBB_DEBUG_LIBRARY ${_TBB_LIB_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}
-            PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
-    find_library(TBB_MALLOC_DEBUG_LIBRARY ${_TBB_LIB_MALLOC_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}
-            PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
-    find_library(TBB_MALLOCPROXY_DEBUG_LIBRARY ${_TBB_LIB_MALLOCPROXY_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}
-            PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
-endif()
-
-# Jiri: Self-built TBB stores the debug libraries in a separate directory.
-#       Extract path from TBB_DEBUG_LIBRARY name
-get_filename_component(TBB_DEBUG_LIBRARY_DIR ${TBB_DEBUG_LIBRARY} PATH)
-
-#TBB_CORRECT_LIB_DIR(TBB_DEBUG_LIBRARY)
-#TBB_CORRECT_LIB_DIR(TBB_MALLOC_DEBUG_LIBRARY)
-#TBB_CORRECT_LIB_DIR(TBB_MALLOCPROXY_DEBUG_LIBRARY)
-mark_as_advanced(TBB_DEBUG_LIBRARY TBB_MALLOC_DEBUG_LIBRARY TBB_MALLOCPROXY_DEBUG_LIBRARY)
-
-if (TBB_INCLUDE_DIR)
-    if (TBB_RELEASE_LIBRARY)
-        set (TBB_FOUND "YES")
-
-        # NOTE: Removed because we don't want to link with the malloc_proxy by default
-        #if (NOT "${TBB_MALLOCPROXY_RELEASE_LIBRARY}" STREQUAL "TBB_MALLOCPROXY_RELEASE_LIBRARY-NOTFOUND")
-        #    mark_as_advanced(TBB_MALLOCPROXY_RELEASE_LIBRARY)
-        #    set (_TBB_MALLOCPROXY optimized ${TBB_MALLOCPROXY_RELEASE_LIBRARY})
-        #endif (NOT "${TBB_MALLOCPROXY_RELEASE_LIBRARY}" STREQUAL "TBB_MALLOCPROXY_RELEASE_LIBRARY-NOTFOUND")
-        #if (NOT "${TBB_MALLOCPROXY_DEBUG_LIBRARY}" STREQUAL "TBB_MALLOCPROXY_DEBUG_LIBRARY-NOTFOUND")
-        #    mark_as_advanced(TBB_MALLOCPROXY_DEBUG_LIBRARY)
-        #    set (_TBB_MALLOCPROXY ${_TBB_MALLOCPROXY} debug ${TBB_MALLOCPROXY_DEBUG_LIBRARY})
-        #endif (NOT "${TBB_MALLOCPROXY_DEBUG_LIBRARY}" STREQUAL "TBB_MALLOCPROXY_DEBUG_LIBRARY-NOTFOUND")
-
-        # TBB release library
-        set (ALL_TBB_LIBRARIES optimized ${TBB_RELEASE_LIBRARY})
-
-        # TBB debug library found?
-        if (TBB_DEBUG_LIBRARY)
-            list(APPEND ALL_TBB_LIBRARIES debug ${TBB_DEBUG_LIBRARY})
-        else (TBB_DEBUG_LIBRARY)
-            # Otherwise, link with the release library even in debug mode
-            list(APPEND ALL_TBB_LIBRARIES debug ${TBB_RELEASE_LIBRARY})
-        endif (TBB_DEBUG_LIBRARY)
-
-        # TBB malloc - release
-        if (TBB_MALLOC_RELEASE_LIBRARY)
-            list(APPEND ALL_TBB_LIBRARIES optimized ${TBB_MALLOC_RELEASE_LIBRARY})
-
-            # TBB malloc - debug
-            if (TBB_MALLOC_DEBUG_LIBRARY)
-                list(APPEND ALL_TBB_LIBRARIES debug ${TBB_MALLOC_DEBUG_LIBRARY})
-            else (TBB_MALLOC_DEBUG_LIBRARY)
-                list(APPEND ALL_TBB_LIBRARIES debug ${TBB_MALLOC_RELEASE_LIBRARY})
-            endif (TBB_MALLOC_DEBUG_LIBRARY)
-        endif (TBB_MALLOC_RELEASE_LIBRARY)
-
-        if(UNIX AND NOT APPLE)
-            # On Fedora, code using TBB might need -pthread
-
-            # First check without pthread
-            try_TBB_with_pthread(TBB_without_pthread)
-
-            if(NOT TBB_without_pthread)
-                # Then check with -pthread
-                try_TBB_with_pthread(TBB_with_pthread -pthread)
-                if(TBB_with_pthread)
-                    list(APPEND ALL_TBB_LIBRARIES general -pthread)
-                endif(TBB_with_pthread)
-                endif(NOT TBB_without_pthread)
-        endif(UNIX AND NOT APPLE)
-
-        set (TBB_LIBRARIES ${ALL_TBB_LIBRARIES}
-             CACHE PATH "TBB libraries" FORCE)
-
-        # Include dirs
-        set (TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR} CACHE PATH "TBB include directory" FORCE)
-
-        # Library dirs
-        if( "${TBB_DEBUG_LIBRARY_DIR}" STREQUAL "" OR "${TBB_RELEASE_LIBRARY_DIR}" STREQUAL "${TBB_DEBUG_LIBRARY_DIR}" )
-            set (TBB_LIBRARY_DIRS
-                ${TBB_RELEASE_LIBRARY_DIR}
-                CACHE PATH "TBB library directories" FORCE)
-        else( "${TBB_DEBUG_LIBRARY_DIR}" STREQUAL "" OR "${TBB_RELEASE_LIBRARY_DIR}" STREQUAL "${TBB_DEBUG_LIBRARY_DIR}" )
-            set (TBB_LIBRARY_DIRS
-                ${TBB_RELEASE_LIBRARY_DIR} ${TBB_DEBUG_LIBRARY_DIR}
-                CACHE PATH "TBB library directories" FORCE)
-        endif( "${TBB_DEBUG_LIBRARY_DIR}" STREQUAL "" OR "${TBB_RELEASE_LIBRARY_DIR}" STREQUAL "${TBB_DEBUG_LIBRARY_DIR}" )
-
-        message(STATUS "Found Intel TBB")
-    endif (TBB_RELEASE_LIBRARY)
-endif (TBB_INCLUDE_DIR)
-
-if (NOT TBB_FOUND)
-    if(NOT TBB_FIND_QUIETLY)
-        message("ERROR: Intel TBB NOT found! Please define the TBBROOT (or TBB_INSTALL_DIR) and/or TBB_ARCH_PLATFORM environment variables.")
-        message(STATUS "Looked for Threading Building Blocks in ${_TBB_INSTALL_DIR}")
-    endif(NOT TBB_FIND_QUIETLY)
-    SET(TBB_INSTALL_DIR "TBB_INSTALL_DIR_NOT_FOUND" CACHE STRING "Intel TBB install directory")
-    # do only throw fatal, if this pkg is REQUIRED
-    if (TBB_FIND_REQUIRED)
-        message(FATAL_ERROR "Could NOT find TBB library.")
-    endif (TBB_FIND_REQUIRED)
-endif (NOT TBB_FOUND)
-
-endif (NOT _TBB_INSTALL_DIR)
-
-if (TBB_FOUND)
-    set(TBB_INTERFACE_VERSION 0)
-    FILE(READ "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h" _TBB_VERSION_CONTENTS)
-    STRING(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1" TBB_INTERFACE_VERSION "${_TBB_VERSION_CONTENTS}")
-    set(TBB_INTERFACE_VERSION "${TBB_INTERFACE_VERSION}")
-endif (TBB_FOUND)
-
-set(TBB_USE_FILE "UseTBB")
-
-### ** Emacs settings **
-### Local Variables:
-### cmake-tab-width: 4
-### End:
diff --git a/3rdparty/CGAL-4.8/cmake/modules/UseCGAL.cmake b/3rdparty/CGAL-4.8/cmake/modules/UseCGAL.cmake
deleted file mode 100644
index a3e5236..0000000
--- a/3rdparty/CGAL-4.8/cmake/modules/UseCGAL.cmake
+++ /dev/null
@@ -1,60 +0,0 @@
-#
-# UseCGAL.cmake can be included in a project to set the needed compiler and linker
-# settings to use CGAL in a program.
-#
-# The variables used here are defined in the CGALConfig.cmake generated when CGAL was installed.
-#
-#
-include(${CGAL_MODULES_DIR}/CGAL_Macros.cmake)
-
-cgal_setup_module_path()
-
-if(NOT USE_CGAL_FILE_INCLUDED)
-  set(USE_CGAL_FILE_INCLUDED 1)
-
-  include(CGAL_Common)
-  include(CGAL_SetupFlags)
-  include(CGAL_GeneratorSpecificSettings)
-  include(CGAL_TweakFindBoost)
-
-  set(CGAL_INSTALLED_SCM_BRANCH_NAME ${CGAL_SCM_BRANCH_NAME})
-  set(CGAL_SCM_BRANCH_NAME "")
-
-  if( NOT "${CGAL_INSTALLED_SCM_BRANCH_NAME}" STREQUAL "" )
-    include(CGAL_SCM)
-    if ( NOT "${CGAL_SCM_BRANCH_NAME}" STREQUAL "" )
-      message ( STATUS "Code taken from Git branch: ${CGAL_SCM_BRANCH_NAME}" )
-      if ( NOT "${CGAL_SCM_BRANCH_NAME}" STREQUAL "${CGAL_INSTALLED_SCM_BRANCH_NAME}")
-        message (AUTHOR_WARNING "Branch '${CGAL_SCM_BRANCH_NAME}' does not match branch '${CGAL_INSTALLED_SCM_BRANCH_NAME}' from which CGAL has been installed. Please consider rebuilding CGAL from this branch.")
-      endif()
-    endif()
-  endif()
-
-  set( CGAL_LIBRARIES )
-
-  foreach ( component ${CGAL_REQUESTED_COMPONENTS} )
-    use_component( ${component} )
-  endforeach()
-
-  use_essential_libs()
-
-  include_directories( "${CMAKE_CURRENT_BINARY_DIR}" )
-
-  if(TARGET CGAL)
-    add_to_list( CGAL_LIBRARIES CGAL )
-  else()
-    add_to_list( CGAL_LIBRARIES ${CGAL_LIBRARY} )
-  endif()
-
-  #message (STATUS "LIB: ${CGAL_LIBRARY}")
-  #message (STATUS "LIBS: ${CGAL_LIBRARIES}")
-
-  include_directories ( ${CGAL_INCLUDE_DIRS})
-  include_directories ( SYSTEM ${CGAL_3RD_PARTY_INCLUDE_DIRS} )
-  add_definitions     ( ${CGAL_3RD_PARTY_DEFINITIONS}  ${CGAL_DEFINITIONS}  )
-
-  link_directories    ( ${CGAL_LIBRARIES_DIR} ${CGAL_3RD_PARTY_LIBRARIES_DIRS} )
-  link_libraries      ( ${CGAL_LIBRARIES}     ${CGAL_3RD_PARTY_LIBRARIES}      )
-
-
-endif()
diff --git a/3rdparty/CGAL-4.8/config/testfiles/CGAL_CFG_BOOST_VARIANT_SWAP_BUG.cpp b/3rdparty/CGAL-4.8/config/testfiles/CGAL_CFG_BOOST_VARIANT_SWAP_BUG.cpp
deleted file mode 100644
index fef3dcb..0000000
--- a/3rdparty/CGAL-4.8/config/testfiles/CGAL_CFG_BOOST_VARIANT_SWAP_BUG.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-// This test a bug in the implementation of the swap of boost variant.
-// Here is the bug report:
-// https://svn.boost.org/trac/boost/ticket/2839
-
-#include <vector>
-#include <boost/variant.hpp>
-
-int main()
-{
-  typedef boost::variant< std::vector<int>::iterator > Variant;
-  std::vector<int> vect;
-  Variant x = vect.begin(), y=vect.end();
-  x.swap(y);
-  return 0;
-}
diff --git a/3rdparty/CGAL-4.8/demo/AABB_tree/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/AABB_tree/CMakeLists.txt
deleted file mode 100644
index 0b47164..0000000
--- a/3rdparty/CGAL-4.8/demo/AABB_tree/CMakeLists.txt
+++ /dev/null
@@ -1,94 +0,0 @@
-# This is the CMake script for compiling the AABB tree demo.
-
-project( AABB_demo )
-
-# Find includes in corresponding build directories
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-# Instruct CMake to run moc automatically when needed.
-set(CMAKE_AUTOMOC ON)
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-# Include this package's headers first
-include_directories( BEFORE ./ ./include ../../include )
-# Find CGAL and CGAL Qt5
-find_package(CGAL COMPONENTS Qt5 )
-include( ${CGAL_USE_FILE} )
-
-# Find Qt5 itself
-find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Gui Svg)
-
-# Find OpenGL
-find_package(OpenGL)
-
-# Find QGLViewer
-if(Qt5_FOUND)
-  find_package(QGLViewer )
-endif(Qt5_FOUND)
-
-if(CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
-
-  include_directories ( ${QGLVIEWER_INCLUDE_DIR} )
-
-  qt5_wrap_ui( UI_FILES MainWindow.ui )
-
-  include(AddFileDependencies)
-
-  qt5_generate_moc( "MainWindow.h" "${CMAKE_CURRENT_BINARY_DIR}/MainWindow_moc.cpp" )
-  add_file_dependencies( MainWindow_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/MainWindow.h" )
-
-  qt5_generate_moc( "Viewer.h" "${CMAKE_CURRENT_BINARY_DIR}/Viewer_moc.cpp" )
-  add_file_dependencies( Viewer_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/Viewer.h" )
-
-  qt5_generate_moc( "Scene.h" "${CMAKE_CURRENT_BINARY_DIR}/Scene_moc.cpp" )
-  add_file_dependencies( Scene_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/Scene.h" )
-
-  qt5_add_resources ( RESOURCE_FILES AABB_demo.qrc )
-
-  add_file_dependencies( AABB_demo.cpp "${CMAKE_CURRENT_BINARY_DIR}/MainWindow_moc.cpp"
-                                       "${CMAKE_CURRENT_BINARY_DIR}/Viewer_moc.cpp"
-                                       "${CMAKE_CURRENT_BINARY_DIR}/Scene_moc.cpp" )
-
-  add_executable  ( AABB_demo AABB_demo.cpp ${UI_FILES} ${RESOURCE_FILES} )
-  qt5_use_modules(AABB_demo Gui OpenGL Xml Script Svg )
-  # Link with Qt libraries
-  target_link_libraries( AABB_demo ${QT_LIBRARIES} )
-
-  # Link with CGAL
-  target_link_libraries( AABB_demo ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} )
-
-  # Link with libQGLViewer, OpenGL
-  target_link_libraries( AABB_demo ${QGLVIEWER_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} )
-
-  add_to_cached_list( CGAL_EXECUTABLE_TARGETS AABB_demo )
-
-
-else (CGAL_FOUND AND CGAL_CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
-
-  set(AABB_MISSING_DEPS "")
-
-  if(NOT CGAL_FOUND)
-    set(AABB_MISSING_DEPS "the CGAL library, ${AABB_MISSING_DEPS}")
-  endif()
-
-  if(NOT CGAL_Qt5_FOUND)
-    set(AABB_MISSING_DEPS "the CGAL Qt5 library, ${AABB_MISSING_DEPS}")
-  endif()
-
-  if(NOT Qt5_FOUND)
-    set(AABB_MISSING_DEPS "Qt5, ${AABB_MISSING_DEPS}")
-  endif()
-
-  if(NOT OPENGL_FOUND)
-    set(AABB_MISSING_DEPS "OpenGL, ${AABB_MISSING_DEPS}")
-  endif()
-
-  if(NOT QGLVIEWER_FOUND)
-    set(AABB_MISSING_DEPS "QGLViewer, ${AABB_MISSING_DEPS}")
-  endif()
-
-  message(STATUS "NOTICE: This demo requires ${AABB_MISSING_DEPS}and will not be compiled.")
-
-endif (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
diff --git a/3rdparty/CGAL-4.8/demo/AABB_tree/Scene.cpp b/3rdparty/CGAL-4.8/demo/AABB_tree/Scene.cpp
deleted file mode 100644
index 5edece4..0000000
--- a/3rdparty/CGAL-4.8/demo/AABB_tree/Scene.cpp
+++ /dev/null
@@ -1,1339 +0,0 @@
-#include "Scene.h"
-
-#include <iostream>
-#include <fstream>
-
-#include <QtCore/qglobal.h>
-#include <QString>
-#include <QTextStream>
-#include <QFileInfo>
-#include <QInputDialog>
-
-#include "Refiner.h"
-//#include "render_edges.h"
-
-#include <CGAL/Timer.h>
-#include <CGAL/IO/Polyhedron_iostream.h>
-#include <CGAL/Subdivision_method_3.h>
-
-#include <QOpenGLShader>
-#include <QDebug>
-#include "Viewer.h"
-
-
-// constants
-const int slow_distance_grid_size = 100;
-const int fast_distance_grid_size = 20;
-#define _SIGNED 0
-#define _UNSIGNED 1
-
-Scene::Scene()
-    : m_frame (new ManipulatedFrame())
-    , m_view_plane(false)
-    , m_grid_size(slow_distance_grid_size)
-    , m_cut_plane(NONE)
-{
-    m_pPolyhedron = NULL;
-
-    // view options
-    m_view_points = true;
-    m_view_segments = true;
-    m_view_polyhedron = true;
-
-    // distance function
-    m_red_ramp.build_red();
-    m_blue_ramp.build_blue();
-    m_max_distance_function = (FT)0.0;
-    texture = new Texture(m_grid_size,m_grid_size);
-    startTimer(0);
-    ready_to_cut = false;
-    are_buffers_initialized = false;
-    gl_init = false;
-
-}
-
-Scene::~Scene()
-{
-    delete m_pPolyhedron;
-    delete m_frame;
-
-    buffers[0].destroy();
-    buffers[1].destroy();
-    buffers[2].destroy();
-    buffers[3].destroy();
-    buffers[4].destroy();
-    buffers[5].destroy();
-    buffers[6].destroy();
-    buffers[7].destroy();
-    vao[0].destroy();
-    vao[1].destroy();
-    vao[2].destroy();
-    vao[3].destroy();
-    vao[4].destroy();
-    vao[5].destroy();
-    vao[6].destroy();
-
-
-}
-
-void Scene::compile_shaders()
-{
-    if(! buffers[0].create() || !buffers[1].create() || !buffers[2].create() || !buffers[3].create() || !buffers[4].create() || !buffers[5].create() || !buffers[6].create() || !buffers[7].create())
-    {
-        std::cerr<<"VBO Creation FAILED"<<std::endl;
-    }
-
-    if(!vao[0].create() || !vao[1].create() || !vao[2].create() || !vao[3].create() || !vao[4].create() || !vao[5].create() || !vao[6].create())
-    {
-        std::cerr<<"VAO Creation FAILED"<<std::endl;
-    }
-
-
-    //Vertex source code
-    const char vertex_source[] =
-    {
-        "#version 120 \n"
-        "attribute highp vec4 vertex;\n"
-        "uniform highp mat4 mvp_matrix;\n"
-        "uniform highp mat4 f_matrix;\n"
-        "void main(void)\n"
-        "{\n"
-        "   gl_Position = mvp_matrix * f_matrix * vertex;\n"
-        "}"
-    };
-    //Vertex source code
-    const char fragment_source[] =
-    {
-        "#version 120 \n"
-        "uniform highp vec4 color; \n"
-        "void main(void) { \n"
-        "gl_FragColor = color; \n"
-        "} \n"
-        "\n"
-    };
-    QOpenGLShader *vertex_shader = new QOpenGLShader(QOpenGLShader::Vertex);
-    if(!vertex_shader->compileSourceCode(vertex_source))
-    {
-        std::cerr<<"Compiling vertex source FAILED"<<std::endl;
-    }
-
-    QOpenGLShader *fragment_shader= new QOpenGLShader(QOpenGLShader::Fragment);
-    if(!fragment_shader->compileSourceCode(fragment_source))
-    {
-        std::cerr<<"Compiling fragmentsource FAILED"<<std::endl;
-    }
-
-    if(!rendering_program.addShader(vertex_shader))
-    {
-        std::cerr<<"adding vertex shader FAILED"<<std::endl;
-    }
-    if(!rendering_program.addShader(fragment_shader))
-    {
-        std::cerr<<"adding fragment shader FAILED"<<std::endl;
-    }
-    if(!rendering_program.link())
-    {
-        std::cerr<<"linking Program FAILED"<<std::endl;
-    }
-    rendering_program.bind();
-
-    //Vertex source code
-    const char tex_vertex_source[] =
-    {
-        "#version 120 \n"
-        "attribute highp vec4 vertex;\n"
-        "attribute highp vec2 tex_coord; \n"
-        "uniform highp mat4 mvp_matrix;\n"
-        "uniform highp mat4 f_matrix;\n"
-        "varying highp vec2 texc;\n"
-        "void main(void)\n"
-        "{\n"
-        "   gl_Position = mvp_matrix * f_matrix * vertex;\n"
-        "    texc = tex_coord;\n"
-        "}"
-    };
-    //Vertex source code
-    const char tex_fragment_source[] =
-    {
-        "#version 120 \n"
-        "uniform sampler2D texture;\n"
-        "varying highp vec2 texc;\n"
-        "void main(void) { \n"
-        "gl_FragColor = texture2D(texture, texc.st);\n"
-        "} \n"
-        "\n"
-    };
-    QOpenGLShader *tex_vertex_shader = new QOpenGLShader(QOpenGLShader::Vertex);
-    if(!tex_vertex_shader->compileSourceCode(tex_vertex_source))
-    {
-        std::cerr<<"Compiling vertex source FAILED"<<std::endl;
-    }
-
-    QOpenGLShader *tex_fragment_shader= new QOpenGLShader(QOpenGLShader::Fragment);
-    if(!tex_fragment_shader->compileSourceCode(tex_fragment_source))
-    {
-        std::cerr<<"Compiling fragmentsource FAILED"<<std::endl;
-    }
-
-    if(!tex_rendering_program.addShader(tex_vertex_shader))
-    {
-        std::cerr<<"adding vertex shader FAILED"<<std::endl;
-    }
-    if(!tex_rendering_program.addShader(tex_fragment_shader))
-    {
-        std::cerr<<"adding fragment shader FAILED"<<std::endl;
-    }
-    if(!tex_rendering_program.link())
-    {
-        std::cerr<<"linking Program FAILED"<<std::endl;
-    }
-    tex_rendering_program.bind();
-
-}
-
-void Scene::initialize_buffers()
-{
-    //Points
-    vao[0].bind();
-    buffers[0].bind();
-    buffers[0].allocate(pos_points.data(),
-                        static_cast<int>(pos_points.size()*sizeof(float)));
-    points_vertexLocation = rendering_program.attributeLocation("vertex");
-    rendering_program.bind();
-    rendering_program.enableAttributeArray(points_vertexLocation);
-    rendering_program.setAttributeBuffer(points_vertexLocation,GL_FLOAT,0,3);
-    buffers[0].release();
-    rendering_program.release();
-    vao[0].release();
-
-    //Lines
-    vao[1].bind();
-    buffers[1].bind();
-    buffers[1].allocate(pos_lines.data(),
-                        static_cast<int>(pos_lines.size()*sizeof(float)));
-    lines_vertexLocation = rendering_program.attributeLocation("vertex");
-    rendering_program.bind();
-    rendering_program.setAttributeBuffer(lines_vertexLocation,GL_FLOAT,0,3);
-    buffers[1].release();
-    rendering_program.enableAttributeArray(lines_vertexLocation);
-    rendering_program.release();
-    vao[1].release();
-
-    //Polyhedron's edges
-    vao[2].bind();
-    buffers[2].bind();
-    buffers[2].allocate(pos_poly.data(),
-                        static_cast<int>(pos_poly.size()*sizeof(float)));
-    poly_vertexLocation = rendering_program.attributeLocation("vertex");
-    rendering_program.bind();
-    rendering_program.setAttributeBuffer(poly_vertexLocation,GL_FLOAT,0,3);
-    rendering_program.enableAttributeArray(poly_vertexLocation);
-    buffers[2].release();
-    rendering_program.release();
-    vao[2].release();
-
-    //cutting segments
-    vao[3].bind();
-    buffers[3].bind();
-    buffers[3].allocate(pos_cut_segments.data(),
-                        static_cast<int>(pos_cut_segments.size()*sizeof(float)));
-    poly_vertexLocation = rendering_program.attributeLocation("vertex");
-    rendering_program.bind();
-    rendering_program.setAttributeBuffer(poly_vertexLocation,GL_FLOAT,0,3);
-    rendering_program.enableAttributeArray(poly_vertexLocation);
-    buffers[3].release();
-    rendering_program.release();
-    vao[3].release();
-
-    //cutting plane
-    vao[4].bind();
-    buffers[4].bind();
-    buffers[4].allocate(pos_plane.data(), static_cast<int>(pos_plane.size()*sizeof(float)));
-    poly_vertexLocation = rendering_program.attributeLocation("vertex");
-    rendering_program.bind();
-    rendering_program.setAttributeBuffer(poly_vertexLocation,GL_FLOAT,0,3);
-    rendering_program.enableAttributeArray(poly_vertexLocation);
-    buffers[4].release();
-    rendering_program.release();
-
-    vao[4].release();
-
-    //grid
-    vao[5].bind();
-    buffers[5].bind();
-    buffers[5].allocate(pos_grid.data(), static_cast<int>(pos_grid.size()*sizeof(float)));
-    poly_vertexLocation = rendering_program.attributeLocation("vertex");
-    rendering_program.bind();
-    rendering_program.setAttributeBuffer(poly_vertexLocation,GL_FLOAT,0,3);
-    rendering_program.enableAttributeArray(poly_vertexLocation);
-    buffers[5].release();
-    rendering_program.release();
-    vao[5].release();
-
-    //cutting plane
-    vao[6].bind();
-    buffers[6].bind();
-    buffers[6].allocate(pos_plane.data(), static_cast<int>(pos_plane.size()*sizeof(float)));
-    poly_vertexLocation = tex_rendering_program.attributeLocation("vertex");
-    tex_rendering_program.bind();
-    tex_rendering_program.setAttributeBuffer(poly_vertexLocation,GL_FLOAT,0,3);
-    tex_rendering_program.enableAttributeArray(poly_vertexLocation);
-    buffers[6].release();
-    tex_rendering_program.release();
-
-    buffers[7].bind();
-    buffers[7].allocate(tex_map.data(), static_cast<int>(tex_map.size()*sizeof(float)));
-    tex_Location = tex_rendering_program.attributeLocation("tex_coord");
-    tex_rendering_program.bind();
-    tex_rendering_program.setAttributeBuffer(tex_Location,GL_FLOAT,0,2);
-    tex_rendering_program.enableAttributeArray(tex_Location);
-    buffers[7].release();
-    tex_rendering_program.release();
-
-    gl->glBindTexture(GL_TEXTURE_2D, textureId);
-    gl->glTexImage2D(GL_TEXTURE_2D,
-                 0,
-                 GL_RGB,
-                 texture->getWidth(),
-                 texture->getHeight(),
-                 0,
-                 GL_RGB,
-                 GL_UNSIGNED_BYTE,
-                 texture->getData());
-    gl->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-    gl->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-    gl->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE );
-    gl->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE );
-    vao[6].release();
-
-    are_buffers_initialized = true;
-
-
-
-}
-
-void Scene::compute_elements(int mode)
-{
-    pos_points.resize(0);
-    pos_lines.resize(0);
-    pos_poly.resize(0);
-    pos_cut_segments.resize(0);
-    tex_map.resize(0);
-    pos_grid.resize(66);
-    pos_plane.resize(18);
-    float diag = .6f * float(bbox_diag());
-    //The Points
-    {
-        std::list<Point>::iterator pit;
-        for(pit = m_points.begin(); pit != m_points.end(); pit++)
-        {
-            const Point& p = *pit;
-            pos_points.push_back(p.x());
-            pos_points.push_back(p.y());
-            pos_points.push_back(p.z());
-        }
-    }
-    //The Segements
-    {
-        std::list<Segment>::iterator sit;
-        for(sit = m_segments.begin(); sit != m_segments.end(); sit++)
-        {
-            const Segment& s = *sit;
-            const Point& p = s.source();
-            const Point& q = s.target();
-
-            pos_lines.push_back(p.x());
-            pos_lines.push_back(p.y());
-            pos_lines.push_back(p.z());
-
-            pos_lines.push_back(q.x());
-            pos_lines.push_back(q.y());
-            pos_lines.push_back(q.z());
-        }
-    }
-    //The Polygon's edges
-    {
-        Polyhedron::Edge_iterator he;
-        for(he = m_pPolyhedron->edges_begin();
-            he != m_pPolyhedron->edges_end();
-            he++)
-        {
-            const Point& a = he->vertex()->point();
-            const Point& b = he->opposite()->vertex()->point();
-            pos_poly.push_back(a.x());
-            pos_poly.push_back(a.y());
-            pos_poly.push_back(a.z());
-
-            pos_poly.push_back(b.x());
-            pos_poly.push_back(b.y());
-            pos_poly.push_back(b.z());
-        }
-    }
-    //The cutting segments
-    {
-        for ( std::vector<Segment>::const_iterator csit = m_cut_segments.begin(),
-              end = m_cut_segments.end() ; csit != end ; ++csit )
-        {
-            const Point& a = csit->source();
-            const Point& b = csit->target();
-
-            pos_cut_segments.push_back(a.x());
-            pos_cut_segments.push_back(a.y());
-            pos_cut_segments.push_back(a.z());
-
-            pos_cut_segments.push_back(b.x());
-            pos_cut_segments.push_back(b.y());
-            pos_cut_segments.push_back(b.z());
-        }
-    }
-    //The cutting plane
-    {
-
-        pos_plane[0]= -diag; pos_plane[1]=-diag; pos_plane[2]=0.0;
-        pos_plane[3]= -diag; pos_plane[4]= diag; pos_plane[5]=0.;
-        pos_plane[6]=  diag; pos_plane[7]= diag; pos_plane[8]=0.;
-        pos_plane[9]= -diag; pos_plane[10]= -diag; pos_plane[11]=0.;
-        pos_plane[12]= diag;    pos_plane[13]= diag; pos_plane[14]= 0.;
-        pos_plane[15]= diag;    pos_plane[16]= -diag; pos_plane[17]= 0.;
-
-        //UV Mapping
-        tex_map.push_back(-0.11f);
-        tex_map.push_back(-0.11f);
-
-        tex_map.push_back(-0.11f);
-        tex_map.push_back(1.11f);
-
-        tex_map.push_back(1.11f);
-        tex_map.push_back(1.11f);
-
-        tex_map.push_back(-0.11f);
-        tex_map.push_back(-0.11f);
-
-        tex_map.push_back(1.11f);
-        tex_map.push_back(1.11f);
-
-        tex_map.push_back(1.11f);
-        tex_map.push_back(-0.11f);
-
-
-
-
-
-    }
-    //The grid
-    {
-        float z = 0;
-        float x = (2 * diag)/10.0;
-        float y = (2 * diag)/10.0;
-        for(int u = 0; u < 11; u++)
-        {
-
-            pos_grid.push_back(-diag + x* u);
-            pos_grid.push_back(-diag);
-            pos_grid.push_back(z);
-
-            pos_grid.push_back(-diag + x* u);
-            pos_grid.push_back(diag);
-            pos_grid.push_back(z);
-        }
-        for(int v=0; v<11; v++)
-        {
-
-            pos_grid.push_back(-diag);
-            pos_grid.push_back(-diag + v * y);
-            pos_grid.push_back(z);
-
-            pos_grid.push_back(diag);
-            pos_grid.push_back(-diag + v * y);
-            pos_grid.push_back(z);
-
-        }
-
-    }
-    //The texture
-    switch(mode)
-    {
-    case _SIGNED:
-        for( int i=0 ; i < texture->getWidth(); i++ )
-        {
-            for( int j=0 ; j < texture->getHeight() ; j++)
-            {
-                compute_texture(i,j,m_red_ramp,m_blue_ramp);
-            }
-        }
-        break;
-    case _UNSIGNED:
-        for( int i=0 ; i < texture->getWidth(); i++ )
-        {
-            for( int j=0 ; j < texture->getHeight() ; j++)
-            {
-                compute_texture(i,j,m_thermal_ramp,m_thermal_ramp);
-            }
-        }
-        break;}
-    sampler_location = tex_rendering_program.attributeLocation("texture");
-}
-
-void Scene::compute_texture(int i, int j,Color_ramp pos_ramp ,Color_ramp neg_ramp)
-{
-
-
-    const FT& d00 = m_distance_function[i][j].second;
-    // determines grey level
-    unsigned int i00 = 255-(unsigned)(255.0 * (double)std::fabs(d00) / m_max_distance_function);
-
-    if(d00 > 0.0)
-        texture->setData(i,j,pos_ramp.r(i00),pos_ramp.g(i00),pos_ramp.b(i00));
-    else
-        texture->setData(i,j,neg_ramp.r(i00),neg_ramp.g(i00),neg_ramp.b(i00));
-
-
-}
-
-void Scene::attrib_buffers(QGLViewer* viewer)
-{
-    QMatrix4x4 mvpMatrix;
-    double mat[16];
-    viewer->camera()->getModelViewProjectionMatrix(mat);
-    for(int i=0; i < 16; i++)
-    {
-        mvpMatrix.data()[i] = (float)mat[i];
-    }
-    rendering_program.bind();
-    mvpLocation = rendering_program.uniformLocation("mvp_matrix");
-    fLocation = rendering_program.uniformLocation("f_matrix");
-    colorLocation = rendering_program.uniformLocation("color");
-    rendering_program.setUniformValue(mvpLocation, mvpMatrix);
-    rendering_program.release();
-
-    tex_rendering_program.bind();
-    tex_mvpLocation = tex_rendering_program.uniformLocation("mvp_matrix");
-    tex_fLocation = tex_rendering_program.uniformLocation("f_matrix");
-    tex_rendering_program.setUniformValue(tex_mvpLocation, mvpMatrix);
-    tex_rendering_program.release();
-}
-
-void Scene::changed()
-{
-    if(m_cut_plane == UNSIGNED_FACETS || m_cut_plane == UNSIGNED_EDGES)
-        compute_elements(_UNSIGNED);
-    else
-        compute_elements(_SIGNED);
-    are_buffers_initialized = false;
-
-}
-
-int Scene::open(QString filename)
-{
-    QTextStream cerr(stderr);
-    cerr << QString("Opening file \"%1\"\n").arg(filename);
-    QApplication::setOverrideCursor(QCursor(::Qt::WaitCursor));
-
-    QFileInfo fileinfo(filename);
-    std::ifstream in(filename.toUtf8());
-
-    if(!in || !fileinfo.isFile() || ! fileinfo.isReadable())
-    {
-        std::cerr << "unable to open file" << std::endl;
-        QApplication::restoreOverrideCursor();
-        return -1;
-    }
-
-    if(m_pPolyhedron != NULL)
-        delete m_pPolyhedron;
-
-    // allocate new polyhedron
-    m_pPolyhedron = new Polyhedron;
-    in >> *m_pPolyhedron;
-    if(!in)
-    {
-        std::cerr << "invalid OFF file" << std::endl;
-        QApplication::restoreOverrideCursor();
-
-        delete m_pPolyhedron;
-        m_pPolyhedron = NULL;
-
-        return -1;
-    }
-
-    // clear tree
-    clear_internal_data();
-
-    QApplication::restoreOverrideCursor();
-    changed();
-    return 0;
-}
-
-void Scene::update_bbox()
-{
-    std::cout << "Compute bbox...";
-    m_bbox = Bbox();
-
-    if(m_pPolyhedron == NULL)
-    {
-        std::cout << "failed (no polyhedron)." << std::endl;
-        return;
-    }
-
-    if(m_pPolyhedron->empty())
-    {
-        std::cout << "failed (empty polyhedron)." << std::endl;
-        return;
-    }
-
-    Polyhedron::Point_iterator it = m_pPolyhedron->points_begin();
-    m_bbox = (*it).bbox();
-    for(; it != m_pPolyhedron->points_end();it++)
-        m_bbox = m_bbox + (*it).bbox();
-    std::cout << "done (" << m_pPolyhedron->size_of_facets()
-              << " facets)" << std::endl;
-}
-
-void Scene::draw(QGLViewer* viewer)
-{       
-    if(!gl_init)
-        initGL();
-    if(!are_buffers_initialized)
-        initialize_buffers();
-    QColor color;
-    QMatrix4x4 fMatrix;
-    fMatrix.setToIdentity();
-    if(m_view_polyhedron && pos_poly.size()>0)
-    {
-        vao[2].bind();
-        attrib_buffers(viewer);
-        rendering_program.bind();
-        color.setRgbF(0.0,0.0,0.0);
-        rendering_program.setUniformValue(colorLocation, color);
-        rendering_program.setUniformValue(fLocation, fMatrix);
-        gl->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(pos_poly.size()/3));
-        rendering_program.release();
-        vao[2].release();
-    }
-    if(m_view_points && pos_points.size()>0)
-    {
-        gl->glPointSize(2.0f);
-        vao[0].bind();
-        attrib_buffers(viewer);
-        rendering_program.bind();
-        color.setRgbF(0.7,0.0,0.0);
-        rendering_program.setUniformValue(colorLocation, color);
-        rendering_program.setUniformValue(fLocation, fMatrix);
-        gl->glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(pos_points.size()/3));
-        rendering_program.release();
-        vao[0].release();
-    }
-
-    if(m_view_segments && pos_lines.size()>0)
-    {
-        vao[1].bind();
-        attrib_buffers(viewer);
-        rendering_program.bind();
-        color.setRgbF(0.0,0.7,0.0);
-        rendering_program.setUniformValue(colorLocation, color);
-        rendering_program.setUniformValue(fLocation, fMatrix);
-        gl->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(pos_lines.size()/3));
-        rendering_program.release();
-        vao[1].release();
-    }
-    if (m_view_plane && pos_plane.size()>0)
-    {
-        switch( m_cut_plane )
-        {
-        case UNSIGNED_EDGES:
-        case UNSIGNED_FACETS:
-        case SIGNED_FACETS:
-
-            gl->glActiveTexture(GL_TEXTURE0);
-            gl->glBindTexture(GL_TEXTURE_2D, textureId);
-
-            for(int i=0; i< 16 ; i++)
-                fMatrix.data()[i] =  m_frame->matrix()[i];
-            vao[6].bind();
-            attrib_buffers(viewer);
-            tex_rendering_program.bind();
-            tex_rendering_program.setUniformValue(tex_fLocation, fMatrix);
-
-            gl->glDrawArrays(GL_TRIANGLES, 0,static_cast<GLsizei>(pos_plane.size()/3));
-            tex_rendering_program.release();
-            vao[6].release();
-            break;
-
-        case CUT_SEGMENTS:
-
-            //cutting_segments
-            fMatrix.setToIdentity();
-            ::glLineWidth(2.0f);
-            vao[3].bind();
-            attrib_buffers(viewer);
-            rendering_program.bind();
-            color.setRgbF(1.0,0.0,0.0);
-            rendering_program.setUniformValue(colorLocation, color);
-            rendering_program.setUniformValue(fLocation, fMatrix);
-            gl->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(pos_cut_segments.size()/3));
-            ::glLineWidth(1.0f);
-            rendering_program.release();
-            vao[3].release();
-            //grid
-            for(int i=0; i< 16 ; i++)
-                fMatrix.data()[i] =  m_frame->matrix()[i];
-            vao[5].bind();
-            attrib_buffers(viewer);
-            rendering_program.bind();
-            color.setRgbF(.6f, .6f, .6f);
-            rendering_program.setUniformValue(colorLocation, color);
-            rendering_program.setUniformValue(fLocation, fMatrix);
-            gl->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(pos_grid.size()/3));
-            rendering_program.release();
-            vao[5].release();
-
-            //cutting_plane
-            // for(int i=0; i< 16 ; i++)
-            //     fMatrix.data()[i] =  m_frame->matrix()[i];
-            ::glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
-            ::glEnable(GL_BLEND);
-            vao[4].bind();
-            attrib_buffers(viewer);
-            rendering_program.bind();
-            color.setRgbF(.6f, .85f, 1.f, .65f);
-            rendering_program.setUniformValue(colorLocation, color);
-            rendering_program.setUniformValue(fLocation, fMatrix);
-            gl->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(pos_plane.size()/3));
-            ::glDisable(GL_BLEND);
-            rendering_program.release();
-            vao[4].release();
-
-            break;
-        case NONE: // do nothing
-            break;
-        }
-    }
-
-
-}
-
-FT Scene::random_in(const double a,
-                    const double b)
-{
-    double r = rand() / (double)RAND_MAX;
-    return (FT)(a + (b - a) * r);
-}
-
-Point Scene::random_point(const CGAL::Bbox_3& bbox)
-{
-    FT x = random_in(bbox.xmin(),bbox.xmax());
-    FT y = random_in(bbox.ymin(),bbox.ymax());
-    FT z = random_in(bbox.zmin(),bbox.zmax());
-    return Point(x,y,z);
-}
-
-Vector Scene::random_vector()
-{
-    FT x = random_in(0.0,1.0);
-    FT y = random_in(0.0,1.0);
-    FT z = random_in(0.0,1.0);
-    return Vector(x,y,z);
-}
-
-Ray Scene::random_ray(const CGAL::Bbox_3& bbox)
-{
-    Point p = random_point(bbox);
-    Point q = random_point(bbox);
-    return Ray(p,q);
-}
-
-Segment Scene::random_segment(const CGAL::Bbox_3& bbox)
-{
-    Point p = random_point(bbox);
-    Point q = random_point(bbox);
-    return Segment(p,q);
-}
-
-Line Scene::random_line(const CGAL::Bbox_3& bbox)
-{
-    Point p = random_point(bbox);
-    Point q = random_point(bbox);
-    return Line(p,q);
-}
-
-Plane Scene::random_plane(const CGAL::Bbox_3& bbox)
-{
-    Point p = random_point(bbox);
-    Vector vec = random_vector();
-    return Plane(p,vec);
-}
-
-Plane Scene::frame_plane() const
-{
-    const qglviewer::Vec& pos = m_frame->position();
-    const qglviewer::Vec& n = m_frame->inverseTransformOf(qglviewer::Vec(0.f, 0.f, 1.f));
-
-    return Plane(n[0], n[1],  n[2], - n * pos);
-}
-
-Aff_transformation Scene::frame_transformation() const
-{
-    const ::GLdouble* m = m_frame->matrix();
-
-    // OpenGL matrices are row-major matrices
-    return Aff_transformation (m[0], m[4], m[8], m[12],
-            m[1], m[5], m[9], m[13],
-            m[2], m[6], m[10], m[14]);
-}
-
-FT Scene::bbox_diag() const
-{
-    double dx = m_bbox.xmax()-m_bbox.xmin();
-    double dy = m_bbox.ymax()-m_bbox.ymin();
-    double dz = m_bbox.zmax()-m_bbox.zmin();
-
-    return FT(std::sqrt(dx*dx + dy*dy + dz*dz));
-}
-
-void Scene::build_facet_tree()
-{
-    if ( NULL == m_pPolyhedron )
-    {
-        std::cerr << "Build facet tree failed: load polyhedron first." << std::endl;
-        return;
-    }
-
-    // Don't rebuild tree if it is already built
-    if ( !m_facet_tree.empty() ) { return; }
-
-    // build tree
-    CGAL::Timer timer;
-    timer.start();
-    std::cout << "Construct Facet AABB tree...";
-    m_facet_tree.rebuild(faces(*m_pPolyhedron).first, faces(*m_pPolyhedron).second,*m_pPolyhedron);
-    m_facet_tree.accelerate_distance_queries();
-    std::cout << "done (" << timer.time() << " s)" << std::endl;
-}
-
-void Scene::build_edge_tree()
-{
-    if ( NULL == m_pPolyhedron )
-    {
-        std::cerr << "Build edge tree failed: load polyhedron first." << std::endl;
-        return;
-    }
-
-    // Don't rebuild tree if it is already built
-    if ( !m_edge_tree.empty() ) { return; }
-
-    // build tree
-    CGAL::Timer timer;
-    timer.start();
-    std::cout << "Construct Edge AABB tree...";
-    m_edge_tree.rebuild(edges(*m_pPolyhedron).first,edges(*m_pPolyhedron).second,*m_pPolyhedron);
-    m_edge_tree.accelerate_distance_queries();
-    std::cout << "done (" << timer.time() << " s)" << std::endl;
-}
-
-void Scene::clear_internal_data()
-{
-    m_facet_tree.clear();
-    m_edge_tree.clear();
-
-    clear_points();
-    clear_segments();
-    clear_cutting_plane();
-}
-
-void Scene::clear_cutting_plane()
-{
-    m_cut_segments.clear();
-    m_cut_plane = NONE;
-
-    deactivate_cutting_plane();
-    changed();
-}
-
-void Scene::update_grid_size()
-{
-    m_grid_size = m_fast_distance ? fast_distance_grid_size
-                                  : slow_distance_grid_size;
-    texture = new Texture(m_grid_size,m_grid_size);
-}
-
-void Scene::generate_points_in(const unsigned int nb_points,
-                               const double min,
-                               const double max)
-{
-    if(m_pPolyhedron == NULL)
-    {
-        std::cout << "Load polyhedron first." << std::endl;
-        return;
-    }
-
-    typedef CGAL::AABB_face_graph_triangle_primitive<Polyhedron> Primitive;
-    typedef CGAL::AABB_traits<Kernel, Primitive> Traits;
-    typedef CGAL::AABB_tree<Traits> Tree;
-
-    std::cout << "Construct AABB tree...";
-    Tree tree(faces(*m_pPolyhedron).first, faces(*m_pPolyhedron).second, *m_pPolyhedron);
-    std::cout << "done." << std::endl;
-
-    CGAL::Timer timer;
-    timer.start();
-    std::cout << "Generate " << nb_points << " points in interval ["
-              << min << ";" << max << "]";
-
-    unsigned int nb_trials = 0;
-    Vector vec = random_vector();
-    while(m_points.size() < nb_points)
-    {
-        Point p = random_point(tree.bbox());
-
-        // measure distance
-        FT signed_distance = std::sqrt(tree.squared_distance(p));
-
-        // measure sign
-        Ray ray(p,vec);
-        int nb_intersections = (int)tree.number_of_intersected_primitives(ray);
-        if(nb_intersections % 2 != 0)
-            signed_distance *= -1.0;
-
-        if(signed_distance >= min &&
-                signed_distance <= max)
-        {
-            m_points.push_back(p);
-            if(m_points.size()%(nb_points/10) == 0)
-                std::cout << "."; // ASCII progress bar
-        }
-        nb_trials++;
-    }
-    double speed = (double)nb_trials / timer.time();
-    std::cout << "done (" << nb_trials << " trials, "
-              << timer.time() << " s, "
-              << speed << " queries/s)" << std::endl;
-    changed();
-}
-
-
-void Scene::generate_inside_points(const unsigned int nb_points)
-{
-    if(m_pPolyhedron == NULL)
-    {
-        std::cout << "Load polyhedron first." << std::endl;
-        return;
-    }
-
-    typedef CGAL::AABB_face_graph_triangle_primitive<Polyhedron> Primitive;
-    typedef CGAL::AABB_traits<Kernel, Primitive> Traits;
-    typedef CGAL::AABB_tree<Traits> Tree;
-
-    std::cout << "Construct AABB tree...";
-    Tree tree(faces(*m_pPolyhedron).first, faces(*m_pPolyhedron).second,*m_pPolyhedron);
-    std::cout << "done." << std::endl;
-
-    CGAL::Timer timer;
-    timer.start();
-    std::cout << "Generate " << nb_points << " inside points";
-
-    unsigned int nb_trials = 0;
-    Vector vec = random_vector();
-    while(m_points.size() < nb_points)
-    {
-        Point p = random_point(tree.bbox());
-        Ray ray(p,vec);
-        int nb_intersections = (int)tree.number_of_intersected_primitives(ray);
-        if(nb_intersections % 2 != 0)
-        {
-            m_points.push_back(p);
-            if(m_points.size()%(nb_points/10) == 0)
-                std::cout << "."; // ASCII progress bar
-        }
-        nb_trials++;
-    }
-    double speed = (double)nb_trials / timer.time();
-    std::cout << "done (" << nb_trials << " trials, "
-              << timer.time() << " s, "
-              << speed << " queries/s)" << std::endl;
-    changed();
-}
-
-void Scene::generate_boundary_segments(const unsigned int nb_slices)
-{
-    if(m_pPolyhedron == NULL)
-    {
-        std::cout << "Load polyhedron first." << std::endl;
-        return;
-    }
-
-    typedef CGAL::AABB_face_graph_triangle_primitive<Polyhedron> Primitive;
-    typedef CGAL::AABB_traits<Kernel, Primitive> Traits;
-    typedef CGAL::AABB_tree<Traits> Tree;
-    typedef Tree::Object_and_primitive_id Object_and_primitive_id;
-
-    std::cout << "Construct AABB tree...";
-    Tree tree(faces(*m_pPolyhedron).first,faces(*m_pPolyhedron).second,*m_pPolyhedron);
-    std::cout << "done." << std::endl;
-
-    CGAL::Timer timer;
-    timer.start();
-    std::cout << "Generate boundary segments from " << nb_slices << " slices: ";
-
-    Vector normal((FT)0.0,(FT)0.0,(FT)1.0);
-    unsigned int i;
-
-    const double dz = m_bbox.zmax() - m_bbox.zmin();
-    for(i=0;i<nb_slices;i++)
-    {
-        FT z = m_bbox.zmin() + (FT)i / (FT)nb_slices * dz;
-        Point p((FT)0.0, (FT)0.0, z);
-        Plane plane(p,normal);
-
-        std::list<Object_and_primitive_id> intersections;
-        tree.all_intersections(plane,std::back_inserter(intersections));
-
-        std::list<Object_and_primitive_id>::iterator it;
-        for(it = intersections.begin();
-            it != intersections.end();
-            it++)
-        {
-            Object_and_primitive_id op = *it;
-            CGAL::Object object = op.first;
-            Segment segment;
-            if(CGAL::assign(segment,object))
-                m_segments.push_back(segment);
-        }
-    }
-    std::cout << m_segments.size() << " segments, " << timer.time() << " s." << std::endl;
-    changed();
-}
-
-void Scene::generate_boundary_points(const unsigned int nb_points)
-{
-    if(m_pPolyhedron == NULL)
-    {
-        std::cout << "Load polyhedron first." << std::endl;
-        return;
-    }
-
-    typedef CGAL::AABB_face_graph_triangle_primitive<Polyhedron> Primitive;
-    typedef CGAL::AABB_traits<Kernel, Primitive> Traits;
-    typedef CGAL::AABB_tree<Traits> Tree;
-    typedef Tree::Object_and_primitive_id Object_and_primitive_id;
-
-    std::cout << "Construct AABB tree...";
-    Tree tree(faces(*m_pPolyhedron).first, faces(*m_pPolyhedron).second,*m_pPolyhedron);
-    std::cout << "done." << std::endl;
-
-    CGAL::Timer timer;
-    timer.start();
-    std::cout << "Generate boundary points: ";
-
-    unsigned int nb = 0;
-    unsigned int nb_lines = 0;
-    while(nb < nb_points)
-    {
-        Line line = random_line(tree.bbox());
-
-        std::list<Object_and_primitive_id> intersections;
-        tree.all_intersections(line,std::back_inserter(intersections));
-        nb_lines++;
-
-        std::list<Object_and_primitive_id>::iterator it;
-        for(it = intersections.begin();
-            it != intersections.end();
-            it++)
-        {
-            Object_and_primitive_id op = *it;
-            CGAL::Object object = op.first;
-            Point point;
-            if(CGAL::assign(point,object))
-            {
-                m_points.push_back(point);
-                nb++;
-            }
-        }
-    }
-    std::cout << nb_lines << " line queries, " << timer.time() << " s." << std::endl;
-    changed();
-}
-
-void Scene::generate_edge_points(const unsigned int nb_points)
-{
-    if(m_pPolyhedron == NULL)
-    {
-        std::cout << "Load polyhedron first." << std::endl;
-        return;
-    }
-
-    typedef CGAL::AABB_halfedge_graph_segment_primitive<Polyhedron> Primitive;
-    typedef CGAL::AABB_traits<Kernel, Primitive> Traits;
-    typedef CGAL::AABB_tree<Traits> Tree;
-    typedef Tree::Object_and_primitive_id Object_and_primitive_id;
-
-    std::cout << "Construct AABB tree...";
-    Tree tree( CGAL::edges(*m_pPolyhedron).first,
-               CGAL::edges(*m_pPolyhedron).second,
-               *m_pPolyhedron);
-    std::cout << "done." << std::endl;
-
-    CGAL::Timer timer;
-    timer.start();
-    std::cout << "Generate edge points: ";
-
-    unsigned int nb = 0;
-    unsigned int nb_planes = 0;
-    while(nb < nb_points)
-    {
-        Plane plane = random_plane(tree.bbox());
-
-        std::list<Object_and_primitive_id> intersections;
-        tree.all_intersections(plane,std::back_inserter(intersections));
-        nb_planes++;
-
-        std::list<Object_and_primitive_id>::iterator it;
-        for(it = intersections.begin();
-            it != intersections.end();
-            it++)
-        {
-            Object_and_primitive_id op = *it;
-            CGAL::Object object = op.first;
-            Point point;
-            if(CGAL::assign(point,object))
-            {
-                m_points.push_back(point);
-                nb++;
-            }
-        }
-    }
-    std::cout << nb_planes << " plane queries, " << timer.time() << " s." << std::endl;
-    changed();
-}
-
-
-template <typename Tree>
-void Scene::compute_distance_function(const Tree& tree)
-{
-    // Get transformation
-    Aff_transformation t = frame_transformation();
-
-    m_max_distance_function = FT(0);
-    FT diag = bbox_diag();
-
-    const FT dx = diag;
-    const FT dy = diag;
-    const FT z (0);
-    const FT fd =  FT(2);
-    for(int i=0 ; i<m_grid_size ; ++i)
-    {
-        FT x = -diag/fd + FT(i)/FT(m_grid_size) * dx;
-
-        for(int j=0 ; j<m_grid_size ; ++j)
-        {
-            FT y = -diag/fd + FT(j)/FT(m_grid_size) * dy;
-
-            Point query = t( Point(x,y,z) );
-            FT dist = CGAL::sqrt( tree.squared_distance(query) );
-
-            m_distance_function[i][j] = Point_distance(query,dist);
-            m_max_distance_function = (std::max)(dist, m_max_distance_function);
-        }
-    }
-}
-
-template <typename Tree>
-void Scene::sign_distance_function(const Tree& tree)
-{
-    typedef typename Tree::size_type size_type;
-    Vector random_vec = random_vector();
-
-    for(int i=0 ; i<m_grid_size ; ++i)
-    {
-        for(int j=0 ; j<m_grid_size ; ++j)
-        {
-            const Point& p = m_distance_function[i][j].first;
-            const FT unsigned_distance = m_distance_function[i][j].second;
-
-            // get sign through ray casting (random vector)
-            Ray ray(p, random_vec);
-            size_type nbi = tree.number_of_intersected_primitives(ray);
-
-            FT sign ( (nbi&1) == 0 ? 1 : -1);
-            m_distance_function[i][j].second = sign * unsigned_distance;
-        }
-    }
-    changed();
-}
-
-
-void Scene::unsigned_distance_function()
-{
-    // Build tree (if build fail, exit)
-    build_facet_tree();
-    if ( m_facet_tree.empty() ) { return; }
-
-    compute_distance_function(m_facet_tree);
-
-    m_cut_plane = UNSIGNED_FACETS;
-    changed();
-}
-
-
-void Scene::unsigned_distance_function_to_edges()
-{
-    // Build tree (if build fail, exit)
-    build_edge_tree();
-    if ( m_edge_tree.empty() ) { return; }
-
-    compute_distance_function(m_edge_tree);
-
-    m_cut_plane = UNSIGNED_EDGES;
-    changed();
-}
-
-
-void Scene::signed_distance_function()
-{
-    // Build tree (if build fail, exit)
-    build_facet_tree();
-    if ( m_facet_tree.empty() ) { return; }
-
-    compute_distance_function(m_facet_tree);
-    sign_distance_function(m_facet_tree);
-
-    m_cut_plane = SIGNED_FACETS;
-    changed();
-}
-
-
-void Scene::cut_segment_plane()
-{
-    // Build tree (if build fail, exit)
-    build_facet_tree();
-    if ( m_facet_tree.empty() ) { return; }
-
-    Plane plane = frame_plane();
-
-    // Compute intersections
-    typedef std::vector<Facet_tree::Object_and_primitive_id> Intersections;
-    Intersections intersections;
-    m_facet_tree.all_intersections(plane, std::back_inserter(intersections));
-
-    // Fill data structure
-    m_cut_segments.clear();
-    for ( Intersections::iterator it = intersections.begin(),
-          end = intersections.end() ; it != end ; ++it )
-    {
-        const Segment* inter_seg = CGAL::object_cast<Segment>(&(it->first));
-
-        if ( NULL != inter_seg )
-        {
-            m_cut_segments.push_back(*inter_seg);
-        }
-    }
-
-    m_cut_plane = CUT_SEGMENTS;
-    changed();
-}
-
-void Scene::cutting_plane(bool override)
-{
-    if(ready_to_cut || override)
-    {
-        ready_to_cut = false;
-        switch( m_cut_plane )
-        {
-        case UNSIGNED_FACETS:
-            return unsigned_distance_function();
-        case SIGNED_FACETS:
-            return signed_distance_function();
-        case UNSIGNED_EDGES:
-            return unsigned_distance_function_to_edges();
-        case CUT_SEGMENTS:
-            return cut_segment_plane();
-        case NONE: // do nothing
-            return;
-        }
-
-        // Should not be here
-        std::cerr << "Unknown cut_plane type" << std::endl;
-        CGAL_assertion(false);
-    }
-}
-
-void Scene::toggle_view_poyhedron()
-{
-    m_view_polyhedron = !m_view_polyhedron;
-}
-
-void Scene::toggle_view_segments()
-{
-    m_view_segments = !m_view_segments;
-}
-
-void Scene::toggle_view_points()
-{
-    m_view_points = !m_view_points;
-}
-
-void Scene::toggle_view_plane()
-{
-    m_view_plane = !m_view_plane;
-}
-
-void Scene::refine_bisection(const FT max_sqlen)
-{
-    if(m_pPolyhedron == NULL)
-    {
-        std::cout << "Load polyhedron first." << std::endl;
-        return;
-    }
-    std::cout << "Refine through recursive longest edge bisection...";
-    Refiner<Kernel,Polyhedron> refiner(m_pPolyhedron);
-    refiner(max_sqlen);
-    std::cout << "done (" << m_pPolyhedron->size_of_facets() << " facets)" << std::endl;
-
-    clear_internal_data();
-}
-
-void Scene::refine_loop()
-{
-    if(m_pPolyhedron == NULL)
-    {
-        std::cout << "Load polyhedron first." << std::endl;
-        return;
-    }
-    std::cout << "Loop subdivision...";
-    CGAL::Subdivision_method_3::Loop_subdivision(*m_pPolyhedron, 1);
-    std::cout << "done (" << m_pPolyhedron->size_of_facets() << " facets)" << std::endl;
-
-    clear_internal_data();
-}
-
-
-void Scene::activate_cutting_plane()
-{
-    connect(m_frame, SIGNAL(modified()), this, SLOT(cutting_plane()));
-    m_view_plane = true;
-}
-
-void Scene::deactivate_cutting_plane()
-{
-    disconnect(m_frame, SIGNAL(modified()), this, SLOT(cutting_plane()));
-    m_view_plane = false;
-}
-void Scene::initGL()
-{
-    gl = new QOpenGLFunctions_2_1();
-   if(!gl->initializeOpenGLFunctions())
-    {
-        qFatal("ERROR : OpenGL Functions not initialized. Check your OpenGL Verison (should be >=3.3)");
-        exit(1);
-    }
-
-    gl->glGenTextures(1, &textureId);
-    compile_shaders();
-    gl_init = true;
-}
-
-void Scene::timerEvent(QTimerEvent *)
-{
-    if(manipulatedFrame()->isSpinning())
-        set_fast_distance(true);
-    ready_to_cut = true;
-}
diff --git a/3rdparty/CGAL-4.8/demo/Alpha_shapes_2/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Alpha_shapes_2/CMakeLists.txt
deleted file mode 100644
index 66675dd..0000000
--- a/3rdparty/CGAL-4.8/demo/Alpha_shapes_2/CMakeLists.txt
+++ /dev/null
@@ -1,50 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-project (Alpha_shapes_2_demo)
-
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-find_package(CGAL COMPONENTS Qt5)
-
-include(${CGAL_USE_FILE})
-
-find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
-include_directories (BEFORE ../../include)
-include_directories (BEFORE ./include)
-
-if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
-add_definitions(-DQT_NO_KEYWORDS)
-
-#--------------------------------
-# The "Delaunay" demo: Alpha_shapes_2
-#--------------------------------
-# UI files (Qt Designer files)
-qt5_wrap_ui( DT_UI_FILES Alpha_shapes_2.ui )
-
-# qrc files (resources files, that contain icons, at least)
-qt5_add_resources ( DT_RESOURCE_FILES ./Alpha_shapes_2.qrc )
-
-# use the Qt MOC preprocessor on classes that derives from QObject
-qt5_generate_moc( Alpha_shapes_2.cpp Alpha_shapes_2.moc )
-
-# The executable itself.
-add_executable  ( Alpha_shapes_2 Alpha_shapes_2.cpp Alpha_shapes_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} )
-
-qt5_use_modules(Alpha_shapes_2 Xml Script OpenGL Svg)
-
-add_to_cached_list( CGAL_EXECUTABLE_TARGETS Alpha_shapes_2 )
-
-# Link with Qt libraries
-target_link_libraries( Alpha_shapes_2 ${QT_LIBRARIES} )
-# Link with CGAL
-target_link_libraries( Alpha_shapes_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES})
-
-else()
-
-  message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
-
-endif()
diff --git a/3rdparty/CGAL-4.8/demo/Alpha_shapes_3/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Alpha_shapes_3/CMakeLists.txt
deleted file mode 100644
index 6613a77..0000000
--- a/3rdparty/CGAL-4.8/demo/Alpha_shapes_3/CMakeLists.txt
+++ /dev/null
@@ -1,49 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-project (Alpha_shape_3)
-# Find includes in corresponding build directories
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-# Instruct CMake to run moc automatically when needed.
-set(CMAKE_AUTOMOC ON)
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-find_package(CGAL COMPONENTS Qt5)
-include(${CGAL_USE_FILE})
-
-find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
-
-find_package(OpenGL)
-find_package(QGLViewer)
-
-if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND )
-
-  add_definitions(-DQT_NO_KEYWORDS)
-
- # include(${QT_USE_FILE})
-
-  include_directories (${QGLVIEWER_INCLUDE_DIR})
-  include_directories (BEFORE ../../include ./ )
-
-  # ui file, created wih Qt Designer
-  qt5_wrap_ui( uis MainWindow.ui )
-
-  # qrc files (resources files, that contain icons, at least)
-  qt5_add_resources ( RESOURCE_FILES ./Alpha_shape_3.qrc )
-
-  add_executable  ( Alpha_shape_3 Alpha_shape_3.cpp MainWindow.cpp Viewer.cpp ${uis}  ${RESOURCE_FILES} )
-  qt5_use_modules(Alpha_shape_3 Xml Script OpenGL Svg)
-  add_to_cached_list( CGAL_EXECUTABLE_TARGETS Alpha_shape_3 )
-
-  target_link_libraries( Alpha_shape_3 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES})
-  target_link_libraries( Alpha_shape_3 ${QT_LIBRARIES} ${QGLVIEWER_LIBRARIES} )
-  target_link_libraries( Alpha_shape_3 ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} )
-
-else()
-
-  message(STATUS "NOTICE: This demo requires CGAL, the QGLViewer, OpenGL and Qt5, and will not be compiled.")
-
-endif()
diff --git a/3rdparty/CGAL-4.8/demo/Apollonius_graph_2/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Apollonius_graph_2/CMakeLists.txt
deleted file mode 100644
index 4b6589b..0000000
--- a/3rdparty/CGAL-4.8/demo/Apollonius_graph_2/CMakeLists.txt
+++ /dev/null
@@ -1,48 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-project (Apollonius_graph_2_demo)
-
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-find_package(CGAL COMPONENTS Qt5)
-
-include(${CGAL_USE_FILE})
-
-find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
-include_directories (BEFORE ../../include)
-
-
-if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
-add_definitions(-DQT_NO_KEYWORDS)
-
-#--------------------------------
-# UI files (Qt Designer files)
-qt5_wrap_ui( DT_UI_FILES Apollonius_graph_2.ui )
-
-# qrc files (resources files, that contain icons, at least)
-qt5_add_resources ( DT_RESOURCE_FILES ./Apollonius_graph_2.qrc )
-
-# use the Qt MOC preprocessor on classes that derives from QObject
-qt5_generate_moc( Apollonius_graph_2.cpp Apollonius_graph_2.moc )
-
-# The executable itself.
-add_executable  ( Apollonius_graph_2 Apollonius_graph_2.cpp Apollonius_graph_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} )
-
-qt5_use_modules(Apollonius_graph_2 Xml Script OpenGL Svg)
-
-add_to_cached_list( CGAL_EXECUTABLE_TARGETS Apollonius_graph_2 )
-
-# Link with Qt libraries
-target_link_libraries( Apollonius_graph_2 ${QT_LIBRARIES} )
-# Link with CGAL
-target_link_libraries( Apollonius_graph_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES})
-
-else()
-
-  message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
-
-endif()
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/CMakeLists.txt
deleted file mode 100644
index b6843be..0000000
--- a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/CMakeLists.txt
+++ /dev/null
@@ -1,83 +0,0 @@
-# This is the CMake script for compiling a CGAL application.
-
-project( Arrangement_2 ) 
-
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-find_package(CGAL COMPONENTS Core Qt5 )
-include( ${CGAL_USE_FILE} )
-
-find_package( Qt5 QUIET COMPONENTS Script Widgets )
-
-if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND)
-  include_directories( ./ )
-  # Arrangement package includes
-  include_directories( BEFORE ../../include )
-
-  qt5_wrap_ui( arrangement_2_uis
-    ArrangementDemoWindow.ui
-    NewTabDialog.ui
-    OverlayDialog.ui
-    ArrangementDemoPropertiesDialog.ui
-  )
-  qt5_wrap_cpp( arrangement_2_mocs
-    ArrangementDemoWindow.h
-    ArrangementDemoTab.h
-    Callback.h
-#    NewTabDialog.h
-    OverlayDialog.h
-    ArrangementDemoPropertiesDialog.h
-    ColorItemEditor.h
-    DeleteCurveModeItemEditor.h
-    PropertyValueDelegate.h
-    #PropertyValueDelegate.cpp
-  )
-  qt5_add_resources( arrangement_2_resources
-    ArrangementDemoWindow.qrc
-  )
-  add_executable( arrangement_2
-    arrangement_2.cpp
-    ArrangementGraphicsItem.cpp
-    ArrangementDemoWindow.cpp
-    ArrangementDemoTab.cpp
-    ArrangementDemoGraphicsView.cpp
-    Callback.cpp
-    VerticalRayShootCallback.cpp
-    EnvelopeCallback.cpp
-    SplitEdgeCallback.cpp
-    FillFaceCallback.cpp
-    GraphicsViewSegmentInput.cpp
-    GraphicsViewCurveInput.cpp
-    Utils.cpp
-    NewTabDialog.cpp
-    OverlayDialog.cpp
-    ArrangementDemoPropertiesDialog.cpp
-    ColorItemEditor.cpp
-    PropertyValueDelegate.cpp
-    DeleteCurveMode.cpp
-    DeleteCurveModeItemEditor.cpp
-    PointsGraphicsItem.cpp
-    VerticalRayGraphicsItem.cpp
-   ${arrangement_2_mocs}
-   ${arrangement_2_uis}
-   ${arrangement_2_resources}
-  )
-  qt5_use_modules(arrangement_2 Widgets Script)
-  target_link_libraries( arrangement_2
-    ${CGAL_LIBRARIES}
-    ${CGAL_3RD_PARTY_LIBRARIES}
-    ${QT_LIBRARIES}
-  )
-
-  add_to_cached_list( CGAL_EXECUTABLE_TARGETS arrangement_2 )
-
-else()
-
-  message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
-
-endif()
-
-# add_subdirectory( tests )
diff --git a/3rdparty/CGAL-4.8/demo/Bounding_volumes/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Bounding_volumes/CMakeLists.txt
deleted file mode 100644
index 94b2153..0000000
--- a/3rdparty/CGAL-4.8/demo/Bounding_volumes/CMakeLists.txt
+++ /dev/null
@@ -1,53 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-project (Bounding_volumes)
-
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-find_package(CGAL COMPONENTS Qt5)
-
-include(${CGAL_USE_FILE})
-
-find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
-include_directories (BEFORE ../../include)
-include_directories (BEFORE ./include)
-include_directories (BEFORE ../../../Matrix_search/include)
-
-
-if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
-
-add_definitions(-DQT_NO_KEYWORDS)
-
-#----------------------------------------------
-# The "Bounding volumes" demo: Bounding_volumes
-#----------------------------------------------
-# UI files (Qt Designer files)
-qt5_wrap_ui( DT_UI_FILES Bounding_volumes.ui )
-
-# qrc files (resources files, that contain icons, at least)
-qt5_add_resources ( DT_RESOURCE_FILES ./Bounding_volumes.qrc )
-
-# use the Qt MOC preprocessor on classes that derives from QObject
-qt5_generate_moc( "Bounding_volumes.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Bounding_volumes.moc" )
-
-# The executable itself.
-add_executable  ( Bounding_volumes Bounding_volumes.cpp Bounding_volumes.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} )
-
-qt5_use_modules(Bounding_volumes Xml Script OpenGL Svg)
-
-add_to_cached_list( CGAL_EXECUTABLE_TARGETS Bounding_volumes )
-
-# Link with Qt libraries
-target_link_libraries( Bounding_volumes ${QT_LIBRARIES} )
-# Link with CGAL
-target_link_libraries( Bounding_volumes ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES})
-
-else()
-
-  message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
-
-endif()
diff --git a/3rdparty/CGAL-4.8/demo/Circular_kernel_2/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Circular_kernel_2/CMakeLists.txt
deleted file mode 100644
index 14de363..0000000
--- a/3rdparty/CGAL-4.8/demo/Circular_kernel_2/CMakeLists.txt
+++ /dev/null
@@ -1,53 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-project (Circular_kernel_2)
-
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-find_package(CGAL COMPONENTS Qt5)
-
-include(${CGAL_USE_FILE})
-
-
-
-find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
-
-include_directories (BEFORE ../../include)
-
-if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
-  add_definitions(-DQT_NO_KEYWORDS)
-  
-
-  #--------------------------------
-  # The demo: Circular_kernel_2
-  #--------------------------------
-  # UI files (Qt Designer files)
-  qt5_wrap_ui( DT_UI_FILES Circular_kernel_2.ui )
-
-  # qrc files (resources files, that contain icons, at least)
-  qt5_add_resources ( DT_RESOURCE_FILES ./Circular_kernel_2.qrc )
-
-  # use the Qt MOC preprocessor on classes that derives from QObject
-  qt5_generate_moc( "Circular_kernel_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Circular_kernel_2.moc" )
-
-  # The executable itself.
-  add_executable  ( Circular_kernel_2 Circular_kernel_2.cpp Circular_kernel_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} )
-
-  qt5_use_modules(Circular_kernel_2 Xml Script OpenGL Svg)
-
-  add_to_cached_list( CGAL_EXECUTABLE_TARGETS Circular_kernel_2 )
-
-  # Link with Qt libraries
-  target_link_libraries( Circular_kernel_2 ${QT_LIBRARIES} )
-  # Link with CGAL
-  target_link_libraries( Circular_kernel_2 ${CGAL_LIBRARIES}  ${CGAL_3RD_PARTY_LIBRARIES})
-
-else()
-
-  message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
-
-endif()
diff --git a/3rdparty/CGAL-4.8/demo/Circular_kernel_3/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Circular_kernel_3/CMakeLists.txt
deleted file mode 100644
index 698a779..0000000
--- a/3rdparty/CGAL-4.8/demo/Circular_kernel_3/CMakeLists.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-project (Circular_kernel_3)
-
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-find_package(CGAL COMPONENTS Qt5)
-include(${CGAL_USE_FILE})
-
-find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL)
-
-find_package(OpenGL)
-find_package(QGLViewer)
-
-if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND )
-
-
-  include_directories (${QGLVIEWER_INCLUDE_DIR})
-  include_directories (BEFORE ../../include ./ )
-
-  add_executable  ( Circular_kernel_3 Circular_kernel_3.cpp Viewer.cpp )
-
-  qt5_use_modules( Circular_kernel_3 Xml Script OpenGL)
-
-  add_to_cached_list( CGAL_EXECUTABLE_TARGETS Circular_kernel_3 )
-
-  target_link_libraries( Circular_kernel_3 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES})
-  target_link_libraries( Circular_kernel_3 ${QT_LIBRARIES} ${QGLVIEWER_LIBRARIES} )
-  target_link_libraries( Circular_kernel_3 ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} )
-
-else()
-
-  message(STATUS "NOTICE: This demo requires CGAL, the QGLViewer, OpenGL and Qt5, and will not be compiled.")
-
-endif()
diff --git a/3rdparty/CGAL-4.8/demo/Convex_hull_3/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Convex_hull_3/CMakeLists.txt
deleted file mode 100644
index ca7554e..0000000
--- a/3rdparty/CGAL-4.8/demo/Convex_hull_3/CMakeLists.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Convex_hull_3_Demo )
-
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  create_single_source_cgal_program( "quickhull_3_demo.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/demo/Generator/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Generator/CMakeLists.txt
deleted file mode 100644
index 03ecc8f..0000000
--- a/3rdparty/CGAL-4.8/demo/Generator/CMakeLists.txt
+++ /dev/null
@@ -1,50 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-project (GeneratorDemo)
-
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-find_package(CGAL COMPONENTS Qt5)
-
-include(${CGAL_USE_FILE})
-
-find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
-
-include_directories (BEFORE ../../include)
-
-if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
-
-  add_definitions(-DQT_NO_KEYWORDS)
-  #--------------------------------
-  # Demo: Generator_2
-  #--------------------------------
-  # UI files (Qt Designer files)
-  qt5_wrap_ui( DT_UI_FILES Generator_2.ui )
-
-  # qrc files (resources files, that contain icons, at least)
-  qt5_add_resources ( DT_RESOURCE_FILES ./Generator_2.qrc )
-
-  # use the Qt MOC preprocessor on classes that derives from QObject
-  qt5_generate_moc( "Generator_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Generator_2.moc" )
-
-  # The executable itself.
-  add_executable  ( Generator_2 Generator_2.cpp Generator_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} )
-
-  qt5_use_modules(Generator_2 Xml Script OpenGL Svg)
-
-  add_to_cached_list( CGAL_EXECUTABLE_TARGETS Generator_2 )
-
-  # Link with Qt libraries
-  target_link_libraries( Generator_2 ${QT_LIBRARIES} )
-  # And with CGAL libraries
-  target_link_libraries( Generator_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} )
-
-else()
-
-  message(STATUS "NOTICE: This demo requires CGAL, and Qt5, and will not be compiled.")
-
-endif()
diff --git a/3rdparty/CGAL-4.8/demo/Geomview/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Geomview/CMakeLists.txt
deleted file mode 100644
index 6ecbf00..0000000
--- a/3rdparty/CGAL-4.8/demo/Geomview/CMakeLists.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Geomview_Demo )
-
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  create_single_source_cgal_program( "input.cpp" )
-  create_single_source_cgal_program( "kernel.cpp" )
-  create_single_source_cgal_program( "gv_terrain.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/demo/GraphicsView/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/GraphicsView/CMakeLists.txt
deleted file mode 100644
index 2012948..0000000
--- a/3rdparty/CGAL-4.8/demo/GraphicsView/CMakeLists.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-# This is the CMake script for compiling a CGAL application.
-
-project (GraphicsView)
-
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-find_package(CGAL COMPONENTS Qt5)
-
-include(${CGAL_USE_FILE})
-
-find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
-
-if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
-
-  add_definitions(-DQT_NO_KEYWORDS)
-
-  add_executable  ( min min.cpp )
-
-  qt5_use_modules(min Xml Script OpenGL Svg)
-
-  add_to_cached_list( CGAL_EXECUTABLE_TARGETS min )
-
-  # Link with Qt libraries
-  target_link_libraries( min ${QT_LIBRARIES} )
-  # Link with CGAL
-  target_link_libraries( min ${CGAL_LIBRARIES}  ${CGAL_3RD_PARTY_LIBRARIES})
-
-else()
-
-  message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
-
-endif()
diff --git a/3rdparty/CGAL-4.8/demo/Interpolation/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Interpolation/CMakeLists.txt
deleted file mode 100644
index a10b1d7..0000000
--- a/3rdparty/CGAL-4.8/demo/Interpolation/CMakeLists.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Interpolation_ )
-
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "interpolation_2_demo.cpp" )
-  create_single_source_cgal_program( "surface_voronoi.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/demo/L1_Voronoi_diagram_2/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/L1_Voronoi_diagram_2/CMakeLists.txt
deleted file mode 100644
index 1a41c66..0000000
--- a/3rdparty/CGAL-4.8/demo/L1_Voronoi_diagram_2/CMakeLists.txt
+++ /dev/null
@@ -1,52 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-project (L1_voronoi_diagram_2)
-
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-find_package(CGAL COMPONENTS Qt5)
-
-include(${CGAL_USE_FILE})
-
-find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
-include_directories (BEFORE ../../include)
-include_directories (BEFORE ./include)
-
-
-if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
-
-add_definitions(-DQT_NO_KEYWORDS)
-
-#--------------------------------
-# The "L1 Voronoi diagram" demo: L1_voronoi_diagram_2
-#--------------------------------
-# UI files (Qt Designer files)
-qt5_wrap_ui( DT_UI_FILES L1_voronoi_diagram_2.ui )
-
-# qrc files (resources files, that contain icons, at least)
-qt5_add_resources ( DT_RESOURCE_FILES ./L1_voronoi_diagram_2.qrc )
-
-# use the Qt MOC preprocessor on classes that derives from QObject
-qt5_generate_moc( L1_voronoi_diagram_2.cpp L1_voronoi_diagram_2.moc )
-
-# The executable itself.
-add_executable  ( L1_voronoi_diagram_2 L1_voronoi_diagram_2.cpp L1_voronoi_diagram_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} )
-
-qt5_use_modules(L1_voronoi_diagram_2 Xml Script OpenGL Svg)
-
-add_to_cached_list( CGAL_EXECUTABLE_TARGETS L1_voronoi_diagram_2 )
-
-# Link with Qt libraries
-target_link_libraries( L1_voronoi_diagram_2 ${QT_LIBRARIES} )
-# Link with CGAL
-target_link_libraries( L1_voronoi_diagram_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES})
-
-else()
-
-  message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
-
-endif()
diff --git a/3rdparty/CGAL-4.8/demo/Largest_empty_rect_2/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Largest_empty_rect_2/CMakeLists.txt
deleted file mode 100644
index 51ee7e8..0000000
--- a/3rdparty/CGAL-4.8/demo/Largest_empty_rect_2/CMakeLists.txt
+++ /dev/null
@@ -1,51 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-project (Largest_empty_rectangleDemo)
-
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-find_package(CGAL COMPONENTS Qt5)
-
-include(${CGAL_USE_FILE})
-
-find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
-
-include_directories (BEFORE ../../include)
-
-if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
-
-  add_definitions(-DQT_NO_KEYWORDS)
-  
-  #--------------------------------
-  # Demo: Largest_empty_rectangle_2
-  #--------------------------------
-  # UI files (Qt Designer files)
-  qt5_wrap_ui( DT_UI_FILES Largest_empty_rectangle_2.ui )
-
-  # qrc files (resources files, that contain icons, at least)
-  qt5_add_resources ( DT_RESOURCE_FILES ./Largest_empty_rectangle_2.qrc )
-
-  # use the Qt MOC preprocessor on classes that derives from QObject
-  qt5_generate_moc( Largest_empty_rectangle_2.cpp Largest_empty_rectangle_2.moc )
-
-  # The executable itself.
-  add_executable  ( Largest_empty_rectangle_2 Largest_empty_rectangle_2.cpp Largest_empty_rectangle_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} )
-
-  qt5_use_modules(Largest_empty_rectangle_2 Xml Script OpenGL Svg)
-
-  add_to_cached_list( CGAL_EXECUTABLE_TARGETS Largest_empty_rectangle_2 )
-
-  # Link with Qt libraries
-  target_link_libraries( Largest_empty_rectangle_2 ${QT_LIBRARIES} )
-  # And with CGAL libraries
-  target_link_libraries( Largest_empty_rectangle_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} )
-
-else()
-
-  message(STATUS "NOTICE: This demo requires CGAL, and Qt5, and will not be compiled.")
-
-endif()
diff --git a/3rdparty/CGAL-4.8/demo/Linear_cell_complex/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Linear_cell_complex/CMakeLists.txt
deleted file mode 100644
index 763c25d..0000000
--- a/3rdparty/CGAL-4.8/demo/Linear_cell_complex/CMakeLists.txt
+++ /dev/null
@@ -1,78 +0,0 @@
-# Created by the script cgal_create_cmake_script (and then adapted manually).
-# This is the CMake script for compiling a CGAL application.
-# cmake ../ -DCMAKE_BUILD_TYPE=Debug
-
-project (Linear_cell_complex_3_demo)
-
-# Find includes in corresponding build directories
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-# Instruct CMake to run moc automatically when needed.
-set(CMAKE_AUTOMOC ON)
-
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-## To add expensive tests
-# add_definitions("-DCGAL_CHECK_EXPENSIVE")
-# add_definitions("-Wall -Wextra")
-
-## For profilling with gprof
-# add_definitions("-pg")
-# SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
-
-## To add an is_valid test after each operation (only in debug mode)
-# add_definitions("-DCGAL_CMAP_TEST_VALID_REMOVALS")
-# add_definitions("-DCGAL_CMAP_TEST_VALID_CONTRACTIONS")
-# add_definitions("-DCGAL_CMAP_TEST_VALID_INSERTIONS")
-
-# Option allowing to profile each operation of the demo (cout times on stdout).
-add_definitions(-DCGAL_PROFILE_LCC_DEMO)
-
-##################
-find_package(CGAL COMPONENTS Qt5)
-include(${CGAL_USE_FILE})
-
-find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
-
-find_package(OpenGL)
-find_package(QGLViewer)
-
-if ( NOT (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND
-      OPENGL_FOUND AND QGLVIEWER_FOUND) )
-
-  MESSAGE(STATUS "NOTICE: This demo requires CGAL, QGLViewer, OpenGL "
-    "and Qt5, and will not be compiled.")
-
-else()
-
-add_definitions(-DQT_NO_KEYWORDS)
-
-include_directories(${QGLVIEWER_INCLUDE_DIR})
-include_directories(BEFORE . ../../include/)
-
-# ui file, created wih Qt Designer
-qt5_wrap_ui(uis MainWindow.ui CreateMesh.ui CreateMenger.ui
-                CreateSierpinskiCarpet.ui CreateSierpinskiTriangle.ui)
-
-# qrc files (resources files, that contain icons, at least)
-qt5_add_resources (RESOURCE_FILES ./Linear_cell_complex_3.qrc)
-
-
-add_executable(Linear_cell_complex_3_demo
-  Linear_cell_complex_3_demo.cpp MainWindow.cpp
-  Viewer.cpp Linear_cell_complex_3_subdivision.cpp
-  Linear_cell_complex_pqq_subdivision.cpp
-  ${uis} ${RESOURCE_FILES} )
-
-qt5_use_modules(Linear_cell_complex_3_demo Xml Script OpenGL Svg)
-add_to_cached_list(CGAL_EXECUTABLE_TARGETS Linear_cell_complex_3_demo)
-
-target_link_libraries(Linear_cell_complex_3_demo ${CGAL_LIBRARIES}
-                                                 ${CGAL_3RD_PARTY_LIBRARIES})
-target_link_libraries(Linear_cell_complex_3_demo ${QT_LIBRARIES}
-                                                 ${QGLVIEWER_LIBRARIES} )
-target_link_libraries(Linear_cell_complex_3_demo ${OPENGL_gl_LIBRARY} )
-
-endif()
diff --git a/3rdparty/CGAL-4.8/demo/Linear_cell_complex/Linear_cell_complex_3_subdivision.cpp b/3rdparty/CGAL-4.8/demo/Linear_cell_complex/Linear_cell_complex_3_subdivision.cpp
deleted file mode 100644
index 1dcb27c..0000000
--- a/3rdparty/CGAL-4.8/demo/Linear_cell_complex/Linear_cell_complex_3_subdivision.cpp
+++ /dev/null
@@ -1,202 +0,0 @@
-// Copyright (c) 2011 CNRS and LIRIS' Establishments (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Guillaume Damiand <guillaume.damiand at liris.cnrs.fr>
-//
-#include "typedefs.h"
-
-#define PI 3.1415926535897932
-
-// Smoth a vertex depending on the vertices of its incident facet.
-class Smooth_old_vertex
-{
-public:
-  /**  Constructor.
-   * @param alcc is the lcc to smooth
-   * @param amark is a mark designing old darts (i.e. darts not created during
-   *        the triangulation step)
-   */
-  Smooth_old_vertex (LCC & alcc, LCC::size_type /* TODO amark*/):mlcc (alcc)
-  {
-  }
-
-  Vertex operator  () (Vertex & v) const
-  {
-    Dart_handle d = v.dart ();
-
-    int degree = 0;
-    bool open = false;
-
-    LCC::One_dart_per_incident_cell_range<1,0>::iterator it (mlcc, d),
-      itend(mlcc.one_dart_per_incident_cell<1,0>(d).end());
-    for (; it != itend; ++it)
-    {
-      ++degree;
-      if (mlcc.is_free(it, 2)) open = true;
-    }
-
-    if (open)
-      return v;
-
-    LCC::FT alpha = (4.0f - 2.0f *
-                     (LCC::FT) cos (2.0f * PI / (LCC::FT) degree)) / 9.0f;
-    LCC::Vector vec =
-      LCC::Traits::Construct_scaled_vector()
-      ( LCC::Traits::Construct_vector() (CGAL::ORIGIN, v.point()), (1.0f - alpha));
-
-    for (it.rewind (); it != itend; ++it)
-    {
-      CGAL_assertion (!mlcc.is_free(it,2));
-      vec = vec + (mlcc.point(mlcc.beta(it,2)) - CGAL::ORIGIN)
-        * alpha / degree;
-    }
-
-    Vertex res= LCC::Traits::Construct_translated_point() (CGAL::ORIGIN, vec);
-    res.set_dart (d);
-
-    return res;
-  }
-private:
-  LCC & mlcc;
-};
-
-// Flip an edge, work only in 2D and 3D
-Dart_handle
-flip_edge (LCC & m, Dart_handle d)
-{
-  CGAL_assertion ( !m.is_free(d,2) );
-  CGAL_assertion ( !m.is_free(d,1) && !m.is_free(d,0) );
-  CGAL_assertion ( !m.is_free(m.beta(d,2), 0) && !m.is_free(m.beta(d, 2), 1) );
-  
-  if (!CGAL::is_removable<LCC,1>(m,d)) return LCC::null_handle;
-
-  Dart_handle d1 = m.beta(d,1);
-  Dart_handle d2 = m.beta(d,2,0);
-
-  CGAL_assertion ( !m.is_free(d1,1) && !m.is_free(d2,0) );
-
-  Dart_handle d3 = m.beta(d1,1);
-  Dart_handle d4 = m.beta(d2, 0);
-
-  // We isolated the edge
-  m.basic_link_beta_1(m.beta(d,0), m.beta(d,2,1));
-  m.basic_link_beta_0(m.beta(d,1), m.beta(d,2,0));
-  if ( !m.is_free(d,3) )
-  {
-    m.basic_link_beta_0(m.beta(d,0,3), m.beta(d,2,1,3));
-    m.basic_link_beta_1(m.beta(d,1,3), m.beta(d,2,0,3));
-  }
-
-  // Then we push the two extremities.
-  m.basic_link_beta_0(d3, d);
-  m.basic_link_beta_0(d2, m.beta(d,2));
-  m.link_beta_1(d4, d);
-  m.link_beta_1(d1, m.beta(d,2));
-
-  if ( !m.is_free(d,3) )
-  {
-    m.basic_link_beta_0(m.beta(d4,3), m.beta(d,3));
-    m.basic_link_beta_0(m.beta(d1,3), m.beta(d,2,3));
-    m.link_beta_1(m.beta(d3,3), m.beta(d,3));
-    m.link_beta_1(m.beta(d2,3), m.beta(d,2,3));
-  }
-  
-  // CGAL::remove_cell<LCC,1>(m, d);
-  // insert_cell_1_in_cell_2(m, d1, d1->beta(1)->beta(1));
-
-  return d;
-}
-
-// Subdivide each facet of the lcc by using sqrt(3)-subdivision.
-void
-subdivide_lcc_3 (LCC & m)
-{
-  if (m.number_of_darts () == 0)
-    return;
-
-  LCC::size_type mark = m.get_new_mark ();
-  LCC::size_type treated = m.get_new_mark ();
-  m.negate_mark (mark);  // All the old darts are marked in O(1).
-
-  // 1) We smoth the old vertices.
-  std::vector < Vertex > vertices;  // smooth the old vertices
-  vertices.reserve (m.number_of_attributes<0> ());  // get intermediate space
-  std::transform (m.vertex_attributes().begin (), 
-		  m.vertex_attributes().end (),
-		  std::back_inserter (vertices), 
-		  Smooth_old_vertex (m, mark));
-
-  // 2) We subdivide each facet.
-  m.negate_mark (treated);  // All the darts are marked in O(1).
-  unsigned int nb = 0;
-  for (LCC::Dart_range::iterator it (m.darts().begin ());
-       m.number_of_marked_darts (treated) > 0; ++it)
-  {
-    ++nb;
-    if (m.is_marked (it, treated))
-    {
-      // We unmark the darts of the facet to process only once dart/facet.
-      CGAL::unmark_cell < LCC, 2 > (m, it, treated);
-      // We triangulate the facet.
-      m.insert_barycenter_in_cell<2>(it);
-    }
-  }
-
-  CGAL_assertion (m.is_whole_map_unmarked (treated));
-  CGAL_assertion (m.is_valid ());
-  m.free_mark (treated);
-
-  // 3) We update the coordinates of old vertices.
-  for (std::vector < Vertex >::iterator vit = vertices.begin ();
-       vit != vertices.end (); ++vit)
-  {
-    m.point(vit->dart())=vit->point();
-  }
-
-  // 4) We flip all the old edges.
-  m.negate_mark (mark);  // Now only new darts are marked.
-  Dart_handle d2 =LCC::null_handle;
-  for (LCC::Dart_range::iterator it (m.darts().begin ());
-       it != m.darts().end ();)
-  {
-    d2 = it++;
-    if (!m.is_marked (d2, mark))  // This is an old dart.
-    {
-      // We process only the last dart of a same edge.
-      if (!m.is_free(d2,2) && (m.beta(d2,2,3)==m.beta(d2,3,2)))
-      {
-        if (m.is_marked(m.beta(d2,2), mark) &&
-            (m.is_free(d2,3) ||
-             (m.is_marked(m.beta(d2,3), mark) &&
-              m.is_marked(m.beta(d2,2,3), mark))))
-        {
-          flip_edge (m, d2);
-          m.mark(d2, mark);
-        }
-        else
-          m.mark (d2, mark);
-      }
-      else
-        m.mark (d2, mark);
-    }
-  }
-
-  CGAL_assertion (m.is_whole_map_marked (mark));
-  m.free_mark (mark);
-  
-  CGAL_postcondition ( m.is_valid ());
-}
diff --git a/3rdparty/CGAL-4.8/demo/Linear_cell_complex/Linear_cell_complex_pqq_subdivision.cpp b/3rdparty/CGAL-4.8/demo/Linear_cell_complex/Linear_cell_complex_pqq_subdivision.cpp
deleted file mode 100644
index dbec290..0000000
--- a/3rdparty/CGAL-4.8/demo/Linear_cell_complex/Linear_cell_complex_pqq_subdivision.cpp
+++ /dev/null
@@ -1,327 +0,0 @@
-// Copyright (c) 2011 CNRS and LIRIS' Establishments (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Guillaume Damiand <guillaume.damiand at liris.cnrs.fr> 
-//		   Jérémy Girerd-Rey <jeremy.girerd-rey at etu.univ-lyon1.fr>
-//
-
-#include "typedefs.h"
-
-// Smooth a vertex depending on the vertices of its incidents facets.
-class Smooth_edge_pqq
-{
-public:
-  /**  Constructor.
-   * @param alcc is the lcc to smooth
-   * @param amark is a mark designing old darts (i.e. darts not created during
-   *        the subdivision step)
-   */
-  Smooth_edge_pqq (LCC & alcc, LCC::size_type o):mlcc (alcc), old(o)
-  {
-  }
-
-  Vertex operator  () (Vertex & v) const
-  {
-    Dart_handle d = v.dart ();
-
-    // Old points aren't concerned.
-    if (mlcc.is_marked(d, old))
-    {       
-    return v;
-    }
-
-    std::vector<LCC::Point> facetsPoints;
-    facetsPoints.resize(0);
-
-    // We search barycenter point of incidents facets.
-    for (LCC::One_dart_per_incident_cell_range<1,0>::iterator it =
-           mlcc.one_dart_per_incident_cell<1,0>(d).begin();
-         it != mlcc.one_dart_per_incident_cell<1,0>(d).end(); ++it)
-    {
-      // If the vertex is on a border.
-      if (mlcc.is_free(it,2))
-      { 
-        return v;
-      }
-      // If we found barycenter of a facet.
-      if (!mlcc.is_marked(mlcc.opposite(it), old))
-      {       
-        facetsPoints.push_back(mlcc.point(mlcc.opposite(it)));
-      }
-    }
-
-    // If we found more than two points we are on a vertice barycenter of a facet.
-    // They aren't concerned.
-    if (facetsPoints.size() > 2 || facetsPoints.size() < 2)
-    {       
-      return v;
-    }
-
-    // Average.
-    LCC::Vector averageFacetsV = LCC::Traits::Construct_vector() 
-			          ( CGAL::ORIGIN, LCC::Point(0,0,0) );                                                   
-
-    for (unsigned int i=0; i < facetsPoints.size(); i++)
-    {
-      averageFacetsV = LCC::Traits::Construct_sum_of_vectors()
-      		       (averageFacetsV, 
-       		       LCC::Traits::Construct_vector() (CGAL::ORIGIN, facetsPoints[i]));
-     }
-
-    averageFacetsV = LCC::Traits::Construct_scaled_vector()
-                     ( averageFacetsV, (1.0f/facetsPoints.size()) );
-
-    // Barycenter point.
-    LCC::Vector barycenterV = LCC::Traits::Construct_sum_of_vectors()
-      		              ( LCC::Traits::Construct_vector() (CGAL::ORIGIN, v.point()), averageFacetsV );
-
-    barycenterV = LCC::Traits::Construct_scaled_vector()
-                  ( barycenterV, (1.0f/2.0f) );
-
-    Vertex res = LCC::Traits::Construct_translated_point() (CGAL::ORIGIN, barycenterV);
-    res.set_dart (d);
-
-    return res;
-  }
-private:
-  LCC & mlcc;
-  LCC::size_type old;
-};
-
-// Smooth an old vertex depending on the vertices of its incident facet and edge.
-class Smooth_vertex_pqq
-{
-public:
-  /**  Constructor.
-   * @param alcc is the lcc to smooth
-   * @param amark is a mark designing old darts (i.e. darts not created during
-   *        the triangulation step)
-   */
-  Smooth_vertex_pqq (LCC & alcc, LCC::size_type o):mlcc (alcc), old(o)
-  {
-  }
-
-  Vertex operator  () (Vertex & v) const
-  {
-    Dart_handle d = v.dart ();
-
-    // Just old points are concerned.
-    if (!mlcc.is_marked(d, old))
-    {       
-      return v;
-    }
-
-    unsigned int degree = 0;
-    std::vector<LCC::Point> edgesPoints;
-    edgesPoints.resize(0);    
-    
-    std::vector<LCC::Point> facetsPoints;
-    facetsPoints.resize(0);    
-
-    // We search barycenter point of incidents facets, and incidents edges points.
-    for (LCC::One_dart_per_incident_cell_range<1,0>::iterator it =
-           mlcc.one_dart_per_incident_cell<1,0>(d).begin();
-        it != mlcc.one_dart_per_incident_cell<1,0>(d).end(); ++it)
-    {
-      // If the vertex is on a border
-      if (mlcc.is_free(it,2))
-      { 
-        return v;
-      }
-      // If incident isn't an old point, it's an edge point.
-      if (!mlcc.is_marked(mlcc.opposite(it), old))
-      {       
-        edgesPoints.push_back (mlcc.point(mlcc.opposite(it)));
-      }
-      // We go find the "facet point" of incidents facet (barycenter of a facet).
-      facetsPoints.push_back (mlcc.point(mlcc.beta(mlcc.opposite(it), 0)));
-      ++degree;
-    }
-
-    CGAL_assertion (facetsPoints.size() != 0 && edgesPoints.size() != 0);
-
-    if (facetsPoints.size() < 3 || edgesPoints.size() < 3 )
-    {       
-      return v;
-    }
-
-    // Average of incidents "edge points".
-    LCC::Vector averageEdgesV = LCC::Traits::Construct_vector() 
-			        (CGAL::ORIGIN, LCC::Point(0,0,0));                                                   
-
-    for (unsigned int i=0; i < edgesPoints.size(); i++)
-    {
-      averageEdgesV = LCC::Traits::Construct_sum_of_vectors()
-                      ( averageEdgesV, 
-       		      LCC::Traits::Construct_vector() (CGAL::ORIGIN, edgesPoints[i]));
-    }
-
-    averageEdgesV = LCC::Traits::Construct_scaled_vector()
-                    ( averageEdgesV, 1.0f/ (LCC::FT) edgesPoints.size() );
-
-    // Average of incidents "facet points".
-    LCC::Vector averageFacetsV = LCC::Traits::Construct_vector() 
-			         (CGAL::ORIGIN, LCC::Point(0,0,0));                                                   
-
-    for (unsigned int i=0; i < facetsPoints.size(); i++)
-    {
-      averageFacetsV = LCC::Traits::Construct_sum_of_vectors()
-      		       ( averageFacetsV, 
-       		       LCC::Traits::Construct_vector() (CGAL::ORIGIN, facetsPoints[i]));
-    }
-
-    averageFacetsV = LCC::Traits::Construct_scaled_vector()
-                     ( averageFacetsV, (1.0f/ (LCC::FT) facetsPoints.size()) );
-
-    // COEFFICIENTS of PQQ - Catmull–Clark subdivision : 
-    // point = ( averageFacets + 2*averageEdges + point*(degree-3) )/degree
-
-    averageFacetsV = LCC::Traits::Construct_scaled_vector()
-      		     ( averageFacetsV, 1.0f/ (LCC::FT) degree);
-
-    averageEdgesV = LCC::Traits::Construct_scaled_vector()
-      		    ( averageEdgesV, 2.0f/ (LCC::FT) degree);
-
-    LCC::Vector pointV = LCC::Traits::Construct_scaled_vector()
-      		         ( LCC::Traits::Construct_vector() (CGAL::ORIGIN, v.point() ), 
-                         (LCC::FT) (degree-3)/ (LCC::FT) degree );
-
-    // New position of the old point.
-    LCC::Vector	newPosition = LCC::Traits::Construct_sum_of_vectors()
-      		              ( averageFacetsV, averageEdgesV);
-    
-    newPosition = LCC::Traits::Construct_sum_of_vectors()
-      		  ( newPosition, pointV);
-
-    Vertex res = LCC::Traits::Construct_translated_point() (CGAL::ORIGIN, newPosition);
-    res.set_dart (d);
-
-    return res;
-  }
-private:
-  LCC & mlcc;
-  LCC::size_type old;
-};
-
-
-// Subdivide each facet of the lcc by using pqq-subdivision.
-void
-subdivide_lcc_pqq (LCC & m)
-{
-  if (m.number_of_darts () == 0)
-    return;
-
-  LCC::size_type old = m.get_new_mark ();
-  LCC::size_type treated = m.get_new_mark ();
-  m.negate_mark (old);  // All the old darts are marked in O(1).
-
-  // 1) We subdivide each edge.
-  m.negate_mark (treated);  // All the darts are marked in O(1).
-  
-  for (LCC::Dart_range::iterator it (m.darts().begin ());
-       m.number_of_marked_darts (treated) > 0; ++it)
-  {
-    if (m.is_marked (it, treated))
-    {
-      // We unmark the darts of the facet to process only once dart/facet.
-      CGAL::unmark_cell < LCC, 1 > (m, it, treated);
-
-      // We insert barycenter in the middle of the edge.
-      m.insert_barycenter_in_cell<1>(it);
-    }
-  }
-
-  // 2) We create a barycenter point for each facets.
-  Dart_handle dc;
-  std::vector<Dart_handle> remove;
-  remove.resize(0);
-
-  m.negate_mark (treated);  // All the darts are marked in O(1).
-  for (LCC::Dart_range::iterator it (m.darts().begin ());
-       m.number_of_marked_darts (treated) > 0; ++it)
-  {
-    if (m.is_marked (it, treated))
-    {
-      // We unmark the darts of the facet to process only once dart/facet.
-      CGAL::unmark_cell < LCC, 2 > (m, it, treated);
-      // We insert barycenter of the facet.
-      dc =  m.insert_barycenter_in_cell<2>(it);
-
-      // We remove useless edges.
-      for (LCC::One_dart_per_incident_cell_range<1,0>::iterator it2 =
-             m.one_dart_per_incident_cell<1,0>(dc).begin(); 
-          it2 != m.one_dart_per_incident_cell<1,0>(dc).end(); ++it2)
-      {
-        // If the edge join the center and a corner.
-        // We remove the edge.
-        if( m.is_marked(m.beta(it2,1), old) )
-        {
-          remove.push_back(it2);
-        }
-      }
-
-      // Remove edges. 
-      for (std::vector <Dart_handle>::iterator dit = remove.begin ();
-          dit != remove.end (); ++dit)
-      {
-        CGAL_assertion( (CGAL::is_removable<LCC, 1>(m,*dit)) );
-        CGAL::remove_cell<LCC, 1>(m, *dit);
-      }
-      remove.resize(0); 
-      // CGAL_assertion( m.is_valid() );
-    }
-  }
-
-  m.negate_mark (treated);
-  CGAL_assertion (m.is_whole_map_marked (treated));
-  m.free_mark (treated);
-
-  // 3) Smooth old points. 
-  std::vector < Vertex > old_vertices; // smooth the old vertices.
-  old_vertices.reserve (m.number_of_attributes<0> ()); // get intermediate space.
-  std::transform (m.vertex_attributes().begin (), 
-		  m.vertex_attributes().end (),
-		  std::back_inserter (old_vertices), 
-		  Smooth_vertex_pqq (m, old));
-
-  // Update.
-  for (std::vector < Vertex >::iterator vit = old_vertices.begin ();
-      vit != old_vertices.end (); ++vit)
-  {
-    m.point(vit->dart())=vit->point();
-  }
-
-  // 4) Smooth new edges points.	  
-  std::vector < Vertex > vertices; // smooth the old vertices.
-  vertices.reserve (m.number_of_attributes<0> ()); // get intermediate space.
-  std::transform (m.vertex_attributes().begin (), 
-		  m.vertex_attributes().end (),
-		  std::back_inserter (vertices), 
-		  Smooth_edge_pqq (m, old));
-
-  // Update.
-  for (std::vector < Vertex >::iterator vit = vertices.begin ();
-      vit != vertices.end (); ++vit)
-  {
-    m.point(vit->dart())=vit->point();
-  }
-
-  m.unmark_all (old);
-  m.free_mark (old);
-  CGAL_postcondition ( m.is_valid ());
-}
-
diff --git a/3rdparty/CGAL-4.8/demo/Linear_cell_complex/MainWindow.cpp b/3rdparty/CGAL-4.8/demo/Linear_cell_complex/MainWindow.cpp
deleted file mode 100644
index 418a200..0000000
--- a/3rdparty/CGAL-4.8/demo/Linear_cell_complex/MainWindow.cpp
+++ /dev/null
@@ -1,3405 +0,0 @@
-// Copyright (c) 2011 CNRS and LIRIS' Establishments (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Guillaume Damiand <guillaume.damiand at liris.cnrs.fr>
-// Contributor(s): Kumar Snehasish <kumar.snehasish at gmail.com>
-//                 Sylvain Brandel <sylvain.brandel at liris.cnrs.fr>
-//
-#include "MainWindow.h"
-#include <CGAL/Delaunay_triangulation_3.h>
-#include <QSettings>
-#include <CGAL/Timer.h>
-#include <CGAL/ipower.h>
-#include "import_moka.h"
-
-// Function defined in Linear_cell_complex_3_subivision.cpp
-void subdivide_lcc_3 (LCC & m);
-
-// Function defined in Linear_cell_complex_pqq_subivision.cpp
-void subdivide_lcc_pqq (LCC & m);
-
-#define DELAY_STATUSMSG 1500
-
-MainWindow::MainWindow (QWidget * parent):CGAL::Qt::DemosMainWindow (parent),
-  nbcube      (0),
-  dialogmesh  (this),
-  dialogmenger(this),
-  dialogsierpinskicarpet(this),
-  dialogsierpinskitriangle(this)
-{
-  setupUi (this);
-  scene.lcc = new LCC;
-  
-  volumeListDock = new QDockWidget(QString(tr("Volume List")),this);
-  volumeListDock->setAllowedAreas(Qt::RightDockWidgetArea |
-                                  Qt::LeftDockWidgetArea);
-  volumeList = new QTableWidget(0,4,volumeListDock);
-  volumeList->verticalHeader()->hide();
-  volumeList->setColumnHidden(3,true);
-  QObject::connect(this->volumeList, SIGNAL(cellChanged(int,int)),
-                   this, SLOT(onCellChanged(int,int)));
-
-  QStringList labels(QString(tr("Color")));
-  labels.append(QString(tr("Filled")));
-  labels.append(QString(tr("Hidden")));
-  volumeList->setHorizontalHeaderLabels(labels);
-  //volumeList->resizeColumnsToContents();
-  volumeList->setFixedWidth(220);
-/*  volumeList->setColumnWidth(0,85);
-  volumeList->setColumnWidth(1,35);
-  volumeList->setColumnWidth(2,35);*/
-
-  volumeList->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
- 
-  volumeList->setSelectionMode(QAbstractItemView::NoSelection);
-  //volumeList->setSelectionBehavior(QAbstractItemView::SelectRows);
-  volumeListDock->setWidget(volumeList);
-  addDockWidget(Qt::RightDockWidgetArea,volumeListDock);
-  menuView->addAction(volumeListDock->toggleViewAction());
-
-  QObject::connect(&dialogmesh, SIGNAL(accepted()),
-                   this, SLOT(onCreateMeshOk()));
-  this->viewer->setScene(&scene);
-
-  connect_actions ();
-  this->addAboutDemo (":/cgal/help/about_Linear_cell_complex_3.html");
-  this->addAboutCGAL ();
-
-  this->addRecentFiles (this->menuFile, this->actionQuit);
-  connect (this, SIGNAL (openRecentFile (QString)),
-           this, SLOT (load_depend_on_extension(QString)));
-
-  statusMessage = new QLabel
-      ("Darts: 0,  Vertices: 0  (Points: 0),  Edges: 0, Facets: 0,"
-       " Volume: 0 (Vol color: 0),  Connected components: 0");
-  statusBar ()->addWidget (statusMessage);
-
-}
-
-void MainWindow::connect_actions ()
-{
-  QObject::connect (this->actionQuit, SIGNAL (triggered ()),
-                    qApp, SLOT (quit ()));
-
-  QObject::connect (this, SIGNAL (sceneChanged ()),
-                    this, SLOT (onSceneChanged ()));
-
-  QObject::connect(this->volumeList->horizontalHeader(),
-                   SIGNAL(sectionClicked(int)),
-                   this, SLOT(onHeaderClicked(int)));
-  QObject::connect(dialogmenger.mengerLevel, SIGNAL(valueChanged(int)),
-                   this, SLOT(onMengerChange(int)));
-  QObject::connect(dialogmenger.updateAttributes, SIGNAL(clicked(bool)),
-                   this, SLOT(onMengerUpdateAttributes(bool)));
-  QObject::connect(&dialogmenger, SIGNAL(accepted()),
-                   this, SLOT(onMengerOk()));
-  QObject::connect(&dialogmenger, SIGNAL(rejected()),
-                   this, SLOT(onMengerCancel()));
-
-  QObject::connect(dialogsierpinskicarpet.level, SIGNAL(valueChanged(int)),
-                   this, SLOT(onSierpinskiCarpetChangeLevel(int)));
-  QObject::connect(dialogsierpinskicarpet.updateAttributes, SIGNAL(clicked(bool)),
-                   this, SLOT(onSierpinskiCarpetUpdateAttributes(bool)));
-/*  QObject::connect(dialogsierpinskicarpet.never, SIGNAL(clicked(bool)),
-                   this, SLOT(onSierpinskiCarpetNeverUpdateAttributes(bool)));
-  QObject::connect(dialogsierpinskicarpet.during, SIGNAL(clicked(bool)),
-                   this, SLOT(onSierpinskiCarpetDuringConstructionUpdateAttributes(bool)));
-  QObject::connect(dialogsierpinskicarpet.after, SIGNAL(clicked(bool)),
-                   this, SLOT(onSierpinskiCarpetAfterConstructionUpdateAttributes(bool)));
-  QObject::connect(dialogsierpinskicarpet.stdmap, SIGNAL(clicked(bool)),
-                   this, SLOT(onSierpinskiCarpetUpdateAttributesMethodStdMap(bool)));
-  QObject::connect(dialogsierpinskicarpet.traversal, SIGNAL(clicked(bool)),
-                   this, SLOT(onSierpinskiCarpetUpdateAttributesMethodTraversal(bool)));
-  QObject::connect(dialogsierpinskicarpet.computeGeometry, SIGNAL(clicked(bool)),
-                   this, SLOT(onSierpinskiCarpetComputeGeometry(bool)));*/
-  QObject::connect(&dialogsierpinskicarpet, SIGNAL(accepted()),
-                   this, SLOT(onSierpinskiCarpetOk()));
-  QObject::connect(&dialogsierpinskicarpet, SIGNAL(rejected()),
-                   this, SLOT(onSierpinskiCarpetCancel()));
-
-  QObject::connect(dialogsierpinskitriangle.level, SIGNAL(valueChanged(int)),
-                   this, SLOT(onSierpinskiTriangleChangeLevel(int)));
-  QObject::connect(dialogsierpinskitriangle.updateAttributes, SIGNAL(clicked(bool)),
-                   this, SLOT(onSierpinskiTriangleUpdateAttributes(bool)));
-  QObject::connect(&dialogsierpinskitriangle, SIGNAL(accepted()),
-                   this, SLOT(onSierpinskiTriangleOk()));
-  QObject::connect(&dialogsierpinskitriangle, SIGNAL(rejected()),
-                   this, SLOT(onSierpinskiTriangleCancel()));
-}
-
-void MainWindow::connectVolumeListHandlers()
-{
-  QObject::connect(this->volumeList, SIGNAL(cellChanged(int,int)),
-                   this, SLOT(onCellChanged(int,int)));
-}
-
-void MainWindow::update_operations_entries(bool show)
-{
-  actionImportOFF->setEnabled(show);
-  actionAddOFF->setEnabled(show);
-  actionImport3DTDS->setEnabled(show);
-  actionCompute_Voronoi_3D->setEnabled(show);
-  actionClear->setEnabled(show);
-  menuCreations->setEnabled(show);
-  menuOperations->setEnabled(show);
-}
-
-void MainWindow::onSceneChanged ()
-{
-  QApplication::setOverrideCursor( Qt::WaitCursor );
-
-  LCC::size_type mark = scene.lcc->get_new_mark ();
-  scene.lcc->negate_mark (mark);
-
-  std::vector<unsigned int> cells;
-  cells.push_back(0);
-  cells.push_back(1);
-  cells.push_back(2);
-  cells.push_back(3);
-  cells.push_back(4);
-
-  std::vector<unsigned int> res = scene.lcc->count_cells (cells);
-
-  std::ostringstream os;
-  os << "Darts: " << scene.lcc->number_of_darts ()
-     << ",  Vertices:" << res[0]
-     <<",  (Points:"<<scene.lcc->number_of_attributes<0>()<<")"
-    << ",  Edges:" << res[1]
-    << ",  Facets:" << res[2]
-    << ",  Volumes:" << res[3]
-    <<",  (Vol color:"<<scene.lcc->number_of_attributes<3>()<<")"
-   << ",  Connected components:" << res[4]
-   <<",  Valid:"<<(scene.lcc->is_valid()?"true":"FALSE");
-
-  scene.lcc->negate_mark (mark);
-  scene.lcc->free_mark (mark);
-
-  // statusBar()->showMessage (QString ("Update OpenGL lists"), DELAY_STATUSMSG);
-
-  viewer->sceneChanged ();
-
-  statusMessage->setText (os.str().c_str ());
-  QApplication::restoreOverrideCursor();
-}
-
-void MainWindow::clear_all()
-{
-  scene.lcc->clear();
-  nbcube=0;
-
-  volumeList->clearContents();
-  volumeList->setRowCount(0);
-}
-
-void MainWindow::on_new_volume(Dart_handle adart)
-{
-  CGAL_assertion( scene.lcc->attribute<3>(adart)==LCC::null_handle);
-  CGAL::Set_i_attribute_functor<LCC, 3>::
-      run(scene.lcc, adart, scene.lcc->create_attribute<3>());
-  update_volume_list_add(scene.lcc->attribute<3>(adart));
-}
-
-void MainWindow::init_all_new_volumes()
-{
-  for (LCC::One_dart_per_cell_range<3>::iterator
-       it(scene.lcc->one_dart_per_cell<3>().begin());
-       it.cont(); ++it)
-    if ( scene.lcc->attribute<3>(it)==LCC::null_handle )
-    { on_new_volume(it); }
-}
-
-void MainWindow::on_actionSave_triggered ()
-{
-  QString fileName = QFileDialog::getSaveFileName (this,
-                                                   tr ("Save"),
-                                                   "save.3map",
-                                                   tr ("3-map files (*.3map)"));
-
-  if (!fileName.isEmpty ())
-  {
-     save(fileName);
-  }
-}
-
-void MainWindow::on_actionLoad_triggered ()
-{
-  QString fileName = QFileDialog::getOpenFileName (this,
-                                                   tr ("Load"),
-                                                   "./3map",
-                                                   tr ("3-map files (*.3map)"));
-
-  if (!fileName.isEmpty ())
-  {
-    load(fileName, true);
-  }
-}
-
-void MainWindow::on_actionImportOFF_triggered ()
-{
-  QString fileName = QFileDialog::getOpenFileName (this,
-                                                   tr ("Import OFF"),
-                                                   "./off",
-                                                   tr ("off files (*.off)"));
-
-  if (!fileName.isEmpty ())
-  {
-    load_off (fileName, true);
-  }
-}
-
-void MainWindow::on_actionImportMoka_triggered()
-{
-  QString fileName = QFileDialog::getOpenFileName (this,
-                                                   tr ("Import Moka"),
-                                                   "./moka",
-                                                   tr ("Moka files (*.moka)"));
-
-  if (!fileName.isEmpty ())
-  {
-    load_moka(fileName, true);
-  }
-}
-
-void MainWindow::on_actionImport3DTDS_triggered ()
-{
-  QString fileName = QFileDialog::getOpenFileName (this,
-                                                   tr ("Import 3DTDS"),
-                                                   ".",
-                                                   tr ("Data file (*)"));
-
-  if (!fileName.isEmpty ())
-  {
-    load_3DTDS (fileName, true);
-    statusBar ()->showMessage (QString ("Import 3DTDS file") + fileName,
-                               DELAY_STATUSMSG);
-  }
-}
-
-void MainWindow::on_actionAddOFF_triggered()
-{
-  QString fileName = QFileDialog::getOpenFileName (this,
-                                                   tr ("Add OFF"),
-                                                   "./off",
-                                                   tr ("off files (*.off)"));
-
-  if (!fileName.isEmpty ())
-  {
-    load_off (fileName, false);
-  }
-}
-
-void MainWindow::load_depend_on_extension(const QString & fileName, bool clear)
-{
-  QString ext = QFileInfo(fileName).suffix();
-  if ( ext=="3map")
-  {
-    load(fileName, clear);
-  }
-  else if (ext=="off")
-  {
-    load_off(fileName, clear);
-  }
-  else if (ext=="moka")
-  {
-    load_moka(fileName, clear);
-  }
-  else
-  {
-    std::cout<<"Extension not considered."<<std::endl;
-  }
-}
-
-void MainWindow::load(const QString & fileName, bool clear)
-{
-  QApplication::setOverrideCursor (Qt::WaitCursor);
-
-  if (clear) this->clear_all();
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  CGAL::Timer timer;
-  timer.start();
-#endif
-
-  bool res = load_combinatorial_map(fileName.toStdString().c_str(), *(scene.lcc));
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  timer.stop();
-  std::cout<<"Time to load 3-map "<<qPrintable(fileName)<<": "
-           <<timer.time()<<" seconds."<<std::endl;
-#endif
-
-  recreate_whole_volume_list();
-
-  this->addToRecentFiles(fileName);
-  QApplication::restoreOverrideCursor ();
-
-  if (res)
-    statusBar ()->showMessage (QString ("3-map loaded ") + fileName,
-                               DELAY_STATUSMSG);
-  else
-    statusBar ()->showMessage (QString ("Problem: 3-map not loaded ") + fileName,
-                               DELAY_STATUSMSG);
-  Q_EMIT (sceneChanged ());
-}
-
-void MainWindow::save(const QString & fileName)
-{
-  QApplication::setOverrideCursor (Qt::WaitCursor);
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  CGAL::Timer timer;
-  timer.start();
-#endif
-
-  if ( save_combinatorial_map(*(scene.lcc), fileName.toStdString().c_str()) )
-    statusBar ()->showMessage (QString ("3-map saved ") + fileName,
-                               DELAY_STATUSMSG);
-  else
-    statusBar ()->showMessage (QString ("Problem: 3-map not saved ") + fileName,
-                               DELAY_STATUSMSG);
-  QApplication::restoreOverrideCursor ();
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  timer.stop();
-  std::cout<<"Time to save 3-map "<<qPrintable(fileName)<<": "
-           <<timer.time()<<" seconds."<<std::endl;
-#endif
-}
-
-void MainWindow::load_off (const QString & fileName, bool clear)
-{
-  QApplication::setOverrideCursor (Qt::WaitCursor);
-
-  if (clear) this->clear_all();
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  CGAL::Timer timer;
-  timer.start();
-#endif
-
-  std::ifstream ifs (qPrintable (fileName));
-
-  CGAL::import_from_polyhedron_3_flux < LCC > (*scene.lcc, ifs);
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  timer.stop();
-  std::cout<<"Time to load off "<<qPrintable(fileName)<<": "
-           <<timer.time()<<" seconds."<<std::endl;
-#endif
-
-  init_all_new_volumes();
-
-  this->addToRecentFiles (fileName);
-  QApplication::restoreOverrideCursor ();
-
-  if (clear)
-    statusBar ()->showMessage (QString ("Load off file") + fileName,
-                               DELAY_STATUSMSG);
-  else
-    statusBar ()->showMessage (QString ("Add off file") + fileName,
-                               DELAY_STATUSMSG);
-  Q_EMIT (sceneChanged ());
-}
-
-void MainWindow::load_3DTDS (const QString & fileName, bool clear)
-{
-  QApplication::setOverrideCursor (Qt::WaitCursor);
-
-  if (clear) this->clear_all();
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  CGAL::Timer timer;
-  timer.start();
-#endif
-
-  typedef CGAL::Delaunay_triangulation_3 < LCC::Traits > Triangulation;
-  Triangulation T;
-
-  std::ifstream ifs (qPrintable (fileName));
-  T.insert (std::istream_iterator < Point_3 >(ifs),
-            std::istream_iterator < Point_3 >() );
-
-  CGAL::import_from_triangulation_3 < LCC, Triangulation >(*scene.lcc, T);
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  timer.stop();
-  std::cout<<"Time to import the 3DTDS from "<<qPrintable(fileName)<<": "
-           <<timer.time()
-           <<" seconds (counting the time to compute denaulay triangulation)."
-           <<std::endl;
-#endif
-
-  init_all_new_volumes();
-
-  QApplication::restoreOverrideCursor ();
-  Q_EMIT (sceneChanged ());
-}
-
-void MainWindow::load_moka(const QString & fileName, bool clear)
-{
-  QApplication::setOverrideCursor (Qt::WaitCursor);
-
-  if (clear) this->clear_all();
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  CGAL::Timer timer;
-  timer.start();
-#endif
-
-  CGAL::import_from_moka < LCC > (*scene.lcc, qPrintable (fileName));
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  timer.stop();
-  std::cout<<"Time to load off "<<qPrintable(fileName)<<": "
-           <<timer.time()<<" seconds."<<std::endl;
-#endif
-
-  init_all_new_volumes();
-  recreate_whole_volume_list();
-
-  this->addToRecentFiles (fileName);
-  QApplication::restoreOverrideCursor ();
-
-  if (clear)
-    statusBar ()->showMessage (QString ("Load off file") + fileName,
-                               DELAY_STATUSMSG);
-  else
-    statusBar ()->showMessage (QString ("Add off file") + fileName,
-                               DELAY_STATUSMSG);
-  Q_EMIT (sceneChanged ());
-}
-
-Dart_handle MainWindow::make_iso_cuboid(const Point_3 basepoint, LCC::FT lg)
-{
-  Dart_handle dh = scene.lcc->make_hexahedron(basepoint,
-                                    LCC::Traits::Construct_translated_point()
-                                    (basepoint,LCC::Traits::Vector(lg,0,0)),
-                                    LCC::Traits::Construct_translated_point()
-                                    (basepoint,LCC::Traits::Vector(lg,lg,0)),
-                                    LCC::Traits::Construct_translated_point()
-                                    (basepoint,LCC::Traits::Vector(0,lg,0)),
-                                    LCC::Traits::Construct_translated_point()
-                                    (basepoint,LCC::Traits::Vector(0,lg,lg)),
-                                    LCC::Traits::Construct_translated_point()
-                                    (basepoint,LCC::Traits::Vector(0,0,lg)),
-                                    LCC::Traits::Construct_translated_point()
-                                    (basepoint,LCC::Traits::Vector(lg,0,lg)),
-                                    LCC::Traits::Construct_translated_point()
-                                    (basepoint,LCC::Traits::Vector(lg,lg,lg)));
-
-  scene.lcc->reverse_orientation_connected_component(dh);
-  return dh;
-}
-
-Dart_handle MainWindow::on_actionCreate_cube_triggered ()
-{
-  Point_3 basepoint(nbcube%5, (nbcube/5)%5, nbcube/25);
-
-  Dart_handle d = make_iso_cuboid(basepoint, 1);
-
-  on_new_volume(d);
-
-  ++nbcube;
-
-  statusBar ()->showMessage (QString ("Cube created"),DELAY_STATUSMSG);
-
-  Q_EMIT (sceneChanged ());
-
-  return d;
-}
-
-void MainWindow::on_actionCreate3Cubes_triggered ()
-{
-  Dart_handle d1 = make_iso_cuboid (Point_3 (nbcube, nbcube, nbcube),1);
-  Dart_handle d2 = make_iso_cuboid (Point_3 (nbcube + 1, nbcube, nbcube),1);
-  Dart_handle d3 = make_iso_cuboid (Point_3 (nbcube, nbcube + 1, nbcube), 1);
-
-  on_new_volume(d1);
-  on_new_volume(d2);
-  on_new_volume(d3);
-
-  scene.lcc->sew<3>(scene.lcc->beta(d1,1,1,2), scene.lcc->beta(d2,2));
-  scene.lcc->sew<3>(scene.lcc->beta(d1,2,1,1,2), d3);
-
-  ++nbcube;
-
-  statusBar ()->showMessage (QString ("3 cubes were created"),
-                             DELAY_STATUSMSG);
-
-  Q_EMIT (sceneChanged ());
-}
-
-void MainWindow::on_actionCreate2Volumes_triggered ()
-{
-  Dart_handle d1 = make_iso_cuboid(Point_3(nbcube, nbcube, nbcube),1);
-  Dart_handle d2 = make_iso_cuboid(Point_3(nbcube + 1, nbcube, nbcube), 1);
-  Dart_handle d3 = make_iso_cuboid(Point_3(nbcube, nbcube + 1, nbcube), 1);
-  Dart_handle d4 = make_iso_cuboid(Point_3(nbcube + 1, nbcube + 1, nbcube), 1);
-
-  scene.lcc->sew<3>(scene.lcc->beta(d1,1,1,2), scene.lcc->beta(d2,2));
-  scene.lcc->sew<3>(scene.lcc->beta(d1,2,1,1,2), d3);
-
-  scene.lcc->sew<3>(scene.lcc->beta(d3,1,1,2), scene.lcc->beta(d4,2));
-  scene.lcc->sew<3>(scene.lcc->beta(d2,2,1,1,2), d4);
-
-  CGAL::remove_cell<LCC,2>(*scene.lcc, d3);
-  CGAL::remove_cell<LCC,2>(*scene.lcc, scene.lcc->beta(d2,2));
-
-  on_new_volume(d1);
-  on_new_volume(d4);
-
-  ++nbcube;
-  statusBar ()->showMessage (QString ("2 volumes were created"),
-                             DELAY_STATUSMSG);
-
-  Q_EMIT (sceneChanged());
-}
-
-void MainWindow::on_actionCreate_mesh_triggered ()
-{
-  dialogmesh.show();
-}
-
-void MainWindow::onCreateMeshOk()
-{
-  QApplication::setOverrideCursor (Qt::WaitCursor);
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  CGAL::Timer timer;
-  timer.start();
-#endif
-
-  for (int x=0; x<dialogmesh.getX(); ++x)
-    for (int y=0; y<dialogmesh.getY(); ++y)
-      for (int z=0; z<dialogmesh.getZ(); ++z)
-      {
-        Dart_handle d = make_iso_cuboid
-          (Point_3 (x+nbcube, y+nbcube, z+nbcube), 1);
-        on_new_volume(d);
-      }
-  nbcube+=dialogmesh.getX();
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  timer.stop();
-  std::cout<<"Time to create mesh ("<<dialogmesh.getX()<<", "
-           <<dialogmesh.getY()<<", "<<dialogmesh.getZ()<<"): "
-           <<timer.time()<<" seconds."<<std::endl;
-#endif
-
-  statusBar ()->showMessage (QString ("Mesh created"),DELAY_STATUSMSG);
-
-  QApplication::restoreOverrideCursor ();
-  Q_EMIT (sceneChanged ());
-}
-
-void MainWindow::on_actionSubdivide_triggered ()
-{
-  QApplication::setOverrideCursor (Qt::WaitCursor);
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  CGAL::Timer timer;
-  timer.start();
-#endif
-
-  subdivide_lcc_3 (*(scene.lcc));
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  timer.stop();
-  std::cout<<"Time to subdivide the current LCC: "
-           <<timer.time()<<" seconds."<<std::endl;
-#endif
-
-  QApplication::restoreOverrideCursor ();
-  Q_EMIT (sceneChanged ());
-  statusBar ()->showMessage (QString ("Objects were subdivided"),
-                             DELAY_STATUSMSG);
-}
-
-void MainWindow::on_actionSubdivide_pqq_triggered ()
-{
-  QApplication::setOverrideCursor (Qt::WaitCursor);
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  CGAL::Timer timer;
-  timer.start();
-#endif
-
-  subdivide_lcc_pqq (*(scene.lcc));
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  timer.stop();
-  std::cout<<"Time to pqq-subdivide the current LCC: "
-           <<timer.time()<<" seconds."<<std::endl;
-#endif
-
-  QApplication::restoreOverrideCursor ();
-  Q_EMIT (sceneChanged ());
-  statusBar ()->showMessage (QString ("Objects were subdivided"),
-                             DELAY_STATUSMSG);
-}
-
-
-void MainWindow::on_actionClear_triggered()
-{
-  clear_all();
-  statusBar ()->showMessage (QString ("Scene cleared"), DELAY_STATUSMSG);
-  Q_EMIT (sceneChanged ());
-}
-
-void MainWindow::on_actionCompute_Voronoi_3D_triggered ()
-{
-  QString fileName = QFileDialog::getOpenFileName (this,
-                                                   tr ("Voronoi 3D"),
-                                                   ".",
-                                                   tr ("Data file (*)"));
-
-  if (fileName.isEmpty ()) return;
-
-  QApplication::setOverrideCursor (Qt::WaitCursor);
-
-  this->clear_all();
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  CGAL::Timer timer;
-  timer.start();
-#endif
-
-  typedef CGAL::Delaunay_triangulation_3 < LCC::Traits > Triangulation;
-  Triangulation T;
-
-  LCC delaunay_lcc;
-  Dart_handle dh;
-
-  std::ifstream ifs (qPrintable (fileName));
-  T.insert (std::istream_iterator < Point_3 >(ifs),
-            std::istream_iterator < Point_3 >() );
-
-  std::map<Triangulation::Cell_handle,
-      LCC::Dart_handle > vol_to_dart;
-
-  dh = CGAL::import_from_triangulation_3 < LCC, Triangulation >
-      (delaunay_lcc, T, &vol_to_dart);
-
-  Dart_handle ddh=delaunay_lcc.dual(*scene.lcc, dh);
-
-  // We transform all the darts in vol_to_dart into their dual.
-  {
-    LCC::Dart_range::iterator it1=delaunay_lcc.darts().begin();
-    LCC::Dart_range::iterator it2=scene.lcc->darts().begin();
-
-    std::map<LCC::Dart_handle, LCC::Dart_handle> dual;
-
-    for ( ; it1!=delaunay_lcc.darts().end(); ++it1, ++it2 )
-    {
-      dual[it1]=it2;
-    }
-
-    // We update the geometry of dual_lcc by using the std::map face_to_dart.
-    for ( std::map<Triangulation::Cell_handle, LCC::Dart_handle>
-          ::iterator it=vol_to_dart.begin(), itend=vol_to_dart.end();
-          it!=itend; ++it)
-    {
-      vol_to_dart[it->first]=dual[it->second];
-      if ( !T.is_infinite(it->first) )
-        scene.lcc->set_vertex_attribute
-            (it->second,scene.lcc->create_vertex_attribute(T.dual(it->first)));
-      /*       else
-                alcc.set_vertex_attribute(it->second,alcc.create_vertex_attribute());*/
-    }
-  }
-
-  // We remove the infinite volume and all its adjacent volumes.
-  {
-    std::stack<Dart_handle> toremove;
-    LCC::size_type mark_toremove=scene.lcc->get_new_mark();
-    toremove.push(ddh);
-    CGAL::mark_cell<LCC,3>(*scene.lcc, ddh, mark_toremove);
-    for (LCC::Dart_of_cell_range<3>::iterator
-         it=scene.lcc->darts_of_cell<3>(ddh).begin(),
-         itend=scene.lcc->darts_of_cell<3>(ddh).end(); it!=itend; ++it)
-    {
-      if ( !scene.lcc->is_marked(scene.lcc->beta(it,3), mark_toremove) )
-      {
-        CGAL::mark_cell<LCC,3>(*scene.lcc,
-                               scene.lcc->beta(it,3), mark_toremove);
-        toremove.push(scene.lcc->beta(it,3));
-      }
-    }
-    while( !toremove.empty() )
-    {
-      CGAL::remove_cell<LCC, 3>(*scene.lcc, toremove.top());
-      toremove.pop();
-    }
-    CGAL_assertion(scene.lcc->is_whole_map_unmarked(mark_toremove));
-    scene.lcc->free_mark(mark_toremove);
-  }
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  timer.stop();
-  std::cout<<"Time to compute Voronoi 3D from "<<qPrintable(fileName)<<": "
-           <<timer.time()<<" seconds."<<std::endl;
-#endif
-
-  init_all_new_volumes();
-  QApplication::restoreOverrideCursor ();
-  Q_EMIT (sceneChanged ());
-  statusBar ()->showMessage (QString ("Voronoi 3D of points in ") + fileName,
-                             DELAY_STATUSMSG);
-}
-
-void MainWindow::on_actionDual_3_triggered ()
-{
-  if ( !scene.lcc->is_without_boundary(3) )
-  {
-    statusBar()->showMessage
-        (QString ("Dual impossible: the lcc has some 3-boundary"),
-         DELAY_STATUSMSG);
-    return;
-  }
-
-  QApplication::setOverrideCursor (Qt::WaitCursor);
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  CGAL::Timer timer;
-  timer.start();
-#endif
-
-  LCC* duallcc = new LCC;
-  scene.lcc->dual_points_at_barycenter(*duallcc);
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  timer.stop();
-  std::cout<<"Time to compute the dual: "
-           <<timer.time()<<" seconds."<<std::endl;
-#endif
-
-  this->clear_all();
-  delete scene.lcc;
-  scene.lcc = duallcc;
-  this->viewer->setScene(&scene);
-  init_all_new_volumes();
-
-  statusBar ()->showMessage (QString ("Dual_3 computed"), DELAY_STATUSMSG);
-  QApplication::restoreOverrideCursor ();
-  Q_EMIT (sceneChanged ());
-}
-
-void MainWindow::on_actionClose_volume_triggered()
-{
-  QApplication::setOverrideCursor (Qt::WaitCursor);
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  CGAL::Timer timer;
-  timer.start();
-#endif
-
-  if ( scene.lcc->close<3>() > 0 )
-  {
-    init_all_new_volumes();
-    statusBar ()->showMessage (QString ("All volume(s) closed"),
-                               DELAY_STATUSMSG);
-    Q_EMIT (sceneChanged ());
-  }
-  else
-    statusBar ()->showMessage
-        (QString ("LCC already 3-closed"), DELAY_STATUSMSG);
-
-  QApplication::restoreOverrideCursor ();
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  timer.stop();
-  std::cout<<"Time to 3-close the current lcc: "
-           <<timer.time()<<" seconds."<<std::endl;
-#endif
-
-}
-
-void MainWindow::on_actionSew3_same_facets_triggered()
-{
-  LCC::size_type mymark = scene.lcc->get_new_mark();
-  mark_all_filled_and_visible_volumes(mymark);
-
-  QApplication::setOverrideCursor (Qt::WaitCursor);
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  CGAL::Timer timer;
-  timer.start();
-#endif
-
-  if ( scene.lcc->sew3_same_facets(mymark) > 0 )
-  {
-    statusBar()->showMessage
-        (QString ("Same facets of visible and filled volume(s) are 3-sewn"),
-         DELAY_STATUSMSG);
-    Q_EMIT (sceneChanged ());
-  }
-  else
-    statusBar()->showMessage (QString ("No facets 3-sewn"), DELAY_STATUSMSG);
-
-  scene.lcc->free_mark(mymark);
-
-  QApplication::restoreOverrideCursor ();
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  timer.stop();
-  std::cout<<"Time to sew3 all same facets: "
-           <<timer.time()<<" seconds."<<std::endl;
-#endif
-}
-
-void MainWindow::on_actionUnsew3_all_triggered()
-{
-  unsigned int nb=0;
-  QApplication::setOverrideCursor (Qt::WaitCursor);
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  CGAL::Timer timer;
-  timer.start();
-#endif
-
-  for (LCC::Dart_range::iterator it=scene.lcc->darts().begin();
-       it!=scene.lcc->darts().end(); ++it)
-  {
-    if ( !scene.lcc->is_free(it,3) &&
-         scene.lcc->info<3>(it).is_filled_and_visible() &&
-         scene.lcc->info<3>(scene.lcc->beta(it,3))
-           .is_filled_and_visible())
-    { scene.lcc->unsew<3>(it); ++nb; }
-  }
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  timer.stop();
-  std::cout<<"Time to unsew3 all filled volumes: "
-           <<timer.time()<<" seconds."<<std::endl;
-#endif
-  QApplication::restoreOverrideCursor ();
-
-  if ( nb > 0 )
-  {
-    statusBar()->showMessage
-        (QString ("Darts between visible and filled volume(s) are 3-unsewn"),
-         DELAY_STATUSMSG);
-    Q_EMIT (sceneChanged ());
-  }
-  else
-    statusBar()->showMessage (QString ("No dart 3-unsewn"), DELAY_STATUSMSG);
-}
-
-void MainWindow::on_actionRemove_filled_volumes_triggered()
-{
-  QApplication::setOverrideCursor (Qt::WaitCursor);
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  CGAL::Timer timer;
-  timer.start();
-#endif
-
-  unsigned int count = 0;
-  for (LCC::Attribute_range<3>::type::iterator
-       it=scene.lcc->attributes<3>().begin(),
-       itend=scene.lcc->attributes<3>().end(); it!=itend; )
-  {
-    LCC::Attribute_handle<3>::type cur = it++;
-    if( scene.lcc->get_attribute<3>(cur).info().is_filled_and_visible() )
-    {
-      CGAL::remove_cell<LCC,3>(*scene.lcc,scene.lcc->get_attribute<3>(cur).dart());
-      ++count;
-    }
-  }
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  timer.stop();
-  std::cout<<"Time to remove all filled volumes: "
-           <<timer.time()<<" seconds."<<std::endl;
-#endif
-
-  recreate_whole_volume_list();
-  QApplication::restoreOverrideCursor ();
-  Q_EMIT( sceneChanged());
-
-  statusBar()->showMessage
-      (QString::number(count)+QString("Visible and filled volume(s) removed"),
-       DELAY_STATUSMSG);
-}
-
-void MainWindow::on_actionInsert_center_vertices_triggered()
-{
-  QApplication::setOverrideCursor (Qt::WaitCursor);
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  CGAL::Timer timer;
-  timer.start();
-#endif
-
-  std::vector<LCC::Dart_handle> v;
-  for (LCC::One_dart_per_cell_range<2>::iterator
-       it(scene.lcc->one_dart_per_cell<2>().begin()); it.cont(); ++it)
-  {
-    if ( scene.lcc->info<3>(it).is_filled_and_visible() )
-      v.push_back(it);
-  }
-  for (std::vector<LCC::Dart_handle>::iterator itv(v.begin());
-       itv!=v.end(); ++itv)
-    scene.lcc->insert_barycenter_in_cell<2>(*itv);
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  timer.stop();
-  std::cout<<"Time to insert center vertices in all filled faces: "
-           <<timer.time()<<" seconds."<<std::endl;
-#endif
-
-  QApplication::restoreOverrideCursor ();
-  Q_EMIT (sceneChanged ());
-  statusBar()->showMessage
-      (QString ("Vertices are inserted in center of facets of visible and filled volume(s)"),
-       DELAY_STATUSMSG);
-}
-
-double compute_angle3d(const Vector_3& v1, const Vector_3& v2)
-{
-  double a = CGAL::to_double( (v1*v2) /
-                              ( sqrt(v1.squared_length()) * sqrt(v2.squared_length()) ) ) ;
-
-  if (a < -1.0) return acos(-1.0)/M_PI*180.0;
-  else if (a > 1.0) return acos(1.0)/M_PI*180.0;
-  else return acos(a)/M_PI*180.0;
-}
-
-void MainWindow::on_actionMerge_coplanar_faces_triggered()
-{
-  QApplication::setOverrideCursor (Qt::WaitCursor);
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  CGAL::Timer timer;
-  timer.start();
-#endif
-
-  scene.lcc->set_update_attributes(false);
-
-  std::vector<Dart_handle> edges;
-  LCC::size_type treated  = scene.lcc->get_new_mark();
-  LCC::size_type treated2 = scene.lcc->get_new_mark();
-
-  for ( LCC::Dart_range::iterator it= scene.lcc->darts().begin(),
-          itend = scene.lcc->darts().end(); it!=itend; ++it )
-  {
-    if (!scene.lcc->is_marked(it, treated) )
-    {
-      if ( CGAL::is_removable<LCC, 1>(*scene.lcc, it) )
-      {
-        LCC::Vector normal1 = CGAL::compute_normal_of_cell_2(*scene.lcc,it);
-        LCC::Vector normal2 = CGAL::compute_normal_of_cell_2(*scene.lcc, scene.lcc->beta<2>(it) );
-        double angle = compute_angle3d(normal1, normal2);
-
-        if ( ((angle<5.0 || angle>355.0) || (angle<185.0 && angle>175.0)) )
-        {
-          edges.push_back(it);
-        }
-      }
-      CGAL::mark_cell<LCC, 1>(*scene.lcc, it, treated);
-    }
-  }
-
-
-  for (std::vector<Dart_handle>::iterator it=edges.begin(),
-         itend=edges.end(); it!=itend; ++it)
-  {
-    CGAL::mark_cell<LCC, 1>(*scene.lcc, *it, treated2);
-
-    if ( scene.lcc->beta<0, 2>(*it)==*it || scene.lcc->beta<1, 2>(*it)==*it)
-    { // To process dangling edges
-
-      Dart_handle actu = *it, prev=NULL;
-      do
-      {
-        if ( scene.lcc->beta<0, 2>(actu)==actu ) prev = scene.lcc->beta<1>(actu);
-        else prev = scene.lcc->beta<0>(actu);
-
-        if (scene.lcc->is_marked(actu, treated2) &&
-            (scene.lcc->beta<0, 2>(actu)!=actu || scene.lcc->beta<1, 2>(actu)!=actu) )
-        {
-          CGAL::remove_cell<LCC, 1>(*scene.lcc, actu);
-          actu = prev;
-        }
-        else
-          actu = NULL;
-      }
-      while (actu!=NULL && (scene.lcc->beta<0, 2>(actu)==actu || scene.lcc->beta<1, 2>(actu)==actu));
-    }
-    else if ( !CGAL::belong_to_same_cell<LCC, 2>(*scene.lcc, *it,
-                                                 scene.lcc->beta<2>(*it)) )
-      CGAL::remove_cell<LCC, 1>(*scene.lcc, *it);
-  }
-
-  assert(scene.lcc->is_whole_map_marked(treated));
-  scene.lcc->free_mark(treated);
-  scene.lcc->free_mark(treated2);
-
-  scene.lcc->set_update_attributes(true);
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  timer.stop();
-  std::cout<<"Time to merge all coplanar faces: "
-           <<timer.time()<<" seconds."<<std::endl;
-#endif
-
-  recreate_whole_volume_list();
-
-  QApplication::restoreOverrideCursor ();
-  Q_EMIT (sceneChanged ());
-  statusBar()->showMessage
-      (QString ("Coplanar face(s) merged"), DELAY_STATUSMSG);
-}
-
-void MainWindow::on_actionMerge_all_volumes_triggered()
-{
-  QApplication::setOverrideCursor (Qt::WaitCursor);
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  CGAL::Timer timer;
-  timer.start();
-#endif
-
-  scene.lcc->set_update_attributes(false);
-
-  Dart_handle prev = scene.lcc->null_handle;
-  for (LCC::Dart_range::iterator it(scene.lcc->darts().begin()),
-       itend=scene.lcc->darts().end(); it!=itend; )
-  {
-    if ( !scene.lcc->is_free(it,3) &&
-         scene.lcc->info<3>(it).is_filled_and_visible() &&
-         scene.lcc->info<3>(scene.lcc->beta(it,3))
-          .is_filled_and_visible())
-    {
-      CGAL::remove_cell<LCC,2>(*scene.lcc,it);
-      itend=scene.lcc->darts().end();
-      if ( prev==scene.lcc->null_handle ) it=scene.lcc->darts().begin();
-      else { it=prev; if ( it!=itend ) ++it; }
-    }
-    else
-      ++it;
-  }
-
-  scene.lcc->set_update_attributes(true);
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  timer.stop();
-  std::cout<<"Time to merge all filled volumes: "
-           <<timer.time()<<" seconds."<<std::endl;
-#endif
-
-  recreate_whole_volume_list();
-
-  QApplication::restoreOverrideCursor ();
-  Q_EMIT (sceneChanged ());
-  statusBar()->showMessage
-      (QString ("Visible and filled volume(s) merged"), DELAY_STATUSMSG);
-}
-
-bool is_external(CDT::Face_handle fh)
-{
-  return fh->info().is_external;
-}
-
-int number_of_existing_edge(CDT::Face_handle fh)
-{
-  unsigned res=0;
-  for (int i=0; i<3; ++i)
-    if (fh->info().exist_edge[i]) ++res;
-  return res;
-}
-
-int get_free_edge(CDT::Face_handle fh)
-{
-  CGAL_assertion( number_of_existing_edge(fh)==2 );
-  for (int i=0; i<3; ++i)
-    if (!fh->info().exist_edge[i]) return i;
-
-  CGAL_assertion(false);
-  return -1;
-}
-
-void constrained_delaunay_triangulation(LCC &lcc, Dart_handle d1)
-{
-  Vector_3 normal = CGAL::compute_normal_of_cell_2(lcc,d1);
-  P_traits cdt_traits(normal);
-  CDT cdt(cdt_traits);
-
-  //inserting the constraints edge by edge
-  LCC::Dart_of_orbit_range<1>::iterator
-    it(lcc.darts_of_orbit<1>(d1).begin());
-
-  CDT::Vertex_handle previous=LCC::null_handle, first=LCC::null_handle,
-    vh=LCC::null_handle;
-
-   for (LCC::Dart_of_orbit_range<1>::iterator
-          itend(lcc.darts_of_orbit<1>(d1).end()); it!=itend; ++it)
-   {
-     vh = cdt.insert(lcc.point(it));
-     vh->info().dh=it;
-     if( first==NULL )
-     {
-       first=vh;
-     }
-     if( previous!=NULL)
-     {
-       CGAL_assertion( previous !=vh );
-       cdt.insert_constraint(previous,vh);
-     }
-
-     previous=vh;
-   }
-   cdt.insert_constraint(previous,first);
-   CGAL_assertion(cdt.is_valid());
-
-   // sets mark is_external
-   for( CDT::All_faces_iterator fit = cdt.all_faces_begin(),
-          fitend = cdt.all_faces_end(); fit != fitend; ++fit)
-   {
-     fit->info().is_external = true;
-     fit->info().is_process = false;
-     fit->info().exist_edge[0]=false;
-     fit->info().exist_edge[1]=false;
-     fit->info().exist_edge[2]=false;
-   }
-
-   std::queue<CDT::Face_handle> face_queue;
-   CDT::Face_handle face_internal = NULL;
-
-   face_queue.push(cdt.infinite_vertex()->face());
-   while(! face_queue.empty() )
-   {
-     CDT::Face_handle fh = face_queue.front();
-     face_queue.pop();
-     if(!fh->info().is_process)
-     {
-       fh->info().is_process = true;
-       for(int i = 0; i <3; ++i)
-       {
-         if(!cdt.is_constrained(std::make_pair(fh, i)))
-         {
-           face_queue.push(fh->neighbor(i));
-         }
-         else if (face_internal==NULL)
-         {
-           face_internal = fh->neighbor(i);
-         }
-       }
-     }
-   }
-   if ( face_internal!=NULL )
-     face_queue.push(face_internal);
-   
-   while(! face_queue.empty() )
-   {
-     CDT::Face_handle fh = face_queue.front();
-     face_queue.pop();
-     if(!fh->info().is_process)
-     {
-       fh->info().is_process = true;
-       fh->info().is_external = false;
-       for(int i = 0; i <3; ++i)
-       {
-         if(!cdt.is_constrained(std::make_pair(fh, i)))
-         {
-           face_queue.push(fh->neighbor(i));
-         }
-       }
-     }
-   }
-   
-   for( CDT::Finite_edges_iterator eit = cdt.finite_edges_begin(),
-          eitend = cdt.finite_edges_end(); eit != eitend; ++eit)
-   {
-     CDT::Face_handle fh = eit->first;
-     int index = eit->second;
-     CDT::Face_handle opposite_fh = fh->neighbor(index);
-     if(cdt.is_constrained(std::make_pair(fh, index)))
-     {
-       fh->info().exist_edge[index]=true;
-       opposite_fh->info().exist_edge[cdt.mirror_index(fh,index)]=true;
-
-       if ( !fh->info().is_external && number_of_existing_edge(fh)==2 )
-         face_queue.push(fh);
-       if ( !opposite_fh->info().is_external &&
-            number_of_existing_edge(opposite_fh)==2 )
-         face_queue.push(opposite_fh);
-     }
-   }
-
-   while( !face_queue.empty() )
-   {
-     CDT::Face_handle fh = face_queue.front();
-     face_queue.pop();
-     CGAL_assertion( number_of_existing_edge(fh)>=2 ); // i.e. ==2 or ==3
-     CGAL_assertion( !fh->info().is_external );
-
-     if (number_of_existing_edge(fh)==2)
-     {
-       int index = get_free_edge(fh);
-       CDT::Face_handle opposite_fh = fh->neighbor(index);
-
-       CGAL_assertion( !fh->info().exist_edge[index] );
-       CGAL_assertion( !opposite_fh->info().
-                       exist_edge[cdt.mirror_index(fh,index)] );
-       // triangle is (vc, vb, va)
-       const CDT::Vertex_handle va = fh->vertex(cdt. cw(index));
-       const CDT::Vertex_handle vb = fh->vertex(cdt.ccw(index));
-       const CDT::Vertex_handle vc = fh->vertex(index);
-       
-       Dart_handle dd1 = NULL;
-       for (LCC::Dart_of_cell_range<0, 2>::iterator it(lcc.darts_of_cell<0, 2>(va->info().dh).begin());
-            dd1==NULL && it.cont(); ++it)
-       {
-         if (lcc.point(lcc.beta<1>(it))==vc->point())
-           dd1=it;
-       }
-       
-       Dart_handle dd2 = NULL;
-       for (LCC::Dart_of_cell_range<0, 2>::iterator it(lcc.darts_of_cell<0, 2>(vb->info().dh).begin());
-            dd2==NULL && it.cont(); ++it)
-       {
-         if (lcc.point(lcc.beta<0>(it))==vc->point())
-           dd2=it;
-       }
-       
-       //       assert(((lcc.beta<0,0>(dd1)==dd2) || lcc.beta<1,1>(dd1)==dd2));
-       
-       Dart_handle ndart=CGAL::insert_cell_1_in_cell_2(lcc, dd1, dd2);
-       va->info().dh=lcc.beta<2>(ndart);
-
-       fh->info().exist_edge[index]=true;
-       opposite_fh->info().exist_edge[cdt.mirror_index(fh,index)]=true;
-
-       if ( !opposite_fh->info().is_external &&
-            number_of_existing_edge(opposite_fh)==2 )
-         face_queue.push(opposite_fh);
-     }
-   }
-}
-
-void MainWindow::on_actionTriangulate_all_facets_triggered()
-{
-  QApplication::setOverrideCursor (Qt::WaitCursor);
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  CGAL::Timer timer;
-  timer.start();
-#endif
-
-  std::vector<LCC::Dart_handle> v;
-  for (LCC::One_dart_per_cell_range<2>::iterator
-       it(scene.lcc->one_dart_per_cell<2>().begin()); it.cont(); ++it)
-  {
-    if ( scene.lcc->info<3>(it).is_filled_and_visible() ||
-         (!scene.lcc->is_free<3>(it) &&
-          scene.lcc->info<3>(scene.lcc->beta<3>(it)).is_filled_and_visible()) )
-      v.push_back(it);
-  }
-
-  for (std::vector<LCC::Dart_handle>::iterator itv(v.begin());
-       itv!=v.end(); ++itv)
-    constrained_delaunay_triangulation(*scene.lcc, *itv);
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  timer.stop();
-  std::cout<<"Time to triangulate all filled faces: "
-           <<timer.time()<<" seconds."<<std::endl;
-#endif
-
-  recreate_whole_volume_list();
-
-  QApplication::restoreOverrideCursor ();
-  Q_EMIT (sceneChanged ());
-  statusBar()->showMessage
-      (QString ("All visible and filled faces were triangulated"), DELAY_STATUSMSG);
-}
-
-bool MainWindow::is_volume_in_list(LCC::Attribute_handle<3>::type ah)
-{
-  for(int row=0; row < volumeList->rowCount(); ++row)
-  {
-    LCC::Attribute_type<3>::type* ptr=
-        reinterpret_cast<LCC::Attribute_type<3>::type*>
-        ( volumeList->item(row,3)->data(Qt::UserRole).value<quintptr>() );
-
-    if(ptr==&(scene.lcc->get_attribute<3>(ah))) return true;
-  }
-
-  return false;
-}
-
-void MainWindow::update_volume_list_add(LCC::Attribute_handle<3>::type ah)
-{
-  // CGAL_assertion( !is_volume_in_list(ah) );
-
-  volumeList->disconnect(this);
-
-  int newRow = volumeList->rowCount();
-  volumeList->setRowCount(newRow+1);
-
-  QTableWidgetItem* volumeLabel = new QTableWidgetItem
-    (QString((scene.lcc->get_attribute<3>(ah).info().color_name().c_str())));
-  volumeLabel->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
-  volumeLabel->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
-  volumeList->setItem(newRow,0,volumeLabel);
-
-  QTableWidgetItem* fillCB = new QTableWidgetItem;
-  fillCB->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
-  if ( scene.lcc->get_attribute<3>(ah).info().is_filled() )
-    fillCB->setCheckState(Qt::Checked);
-  else
-    fillCB->setCheckState(Qt::Unchecked);
-  volumeList->setItem(newRow,1, fillCB);
-
-  QTableWidgetItem* hiddenCB = new QTableWidgetItem();
-  hiddenCB->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
-  if ( scene.lcc->get_attribute<3>(ah).info().is_visible() )
-    hiddenCB->setCheckState(Qt::Unchecked);
-  else
-    hiddenCB->setCheckState(Qt::Checked);
-  volumeList->setItem(newRow,2,hiddenCB);
-
-  QTableWidgetItem* attribHandle = new QTableWidgetItem;
-  attribHandle->setData
-      (Qt::UserRole,
-       reinterpret_cast<quintptr>(&scene.lcc->get_attribute<3>(ah)));
-
-  volumeList->setItem(newRow,3,attribHandle);
-
-  connectVolumeListHandlers();
-}
-
-void MainWindow::update_volume_list_remove(int i)
-{
-  CGAL_assertion(i<volumeList->rowCount());
-  volumeList->removeRow(i);
-}
-
-void MainWindow::update_volume_list_remove(LCC::Attribute_handle<3>::type ah)
-{
-  for(int row=0; row < volumeList->rowCount(); ++row)
-  {
-    LCC::Attribute_type<3>::type* ptr=
-        reinterpret_cast<LCC::Attribute_type<3>::type*>
-        ( volumeList->item(row,3)->data(Qt::UserRole).value<quintptr>() );
-
-    if(ptr==&scene.lcc->get_attribute<3>(ah))
-    {
-      update_volume_list_remove(row);
-      return;
-    }
-  }
-}
-
-void MainWindow::update_volume_list_all_ckeckstates()
-{
-  volumeList->disconnect(this);
-
-  for(int row=0; row < volumeList->rowCount(); ++row)
-  {
-    LCC::Attribute_type<3>::type* ptr=
-        reinterpret_cast<LCC::Attribute_type<3>::type*>
-        ( volumeList->item(row,3)->data(Qt::UserRole).value<quintptr>() );
-
-    if ( ptr->info().is_filled() )
-      volumeList->item(row,1)->setCheckState(Qt::Checked);
-    else
-      volumeList->item(row,1)->setCheckState(Qt::Unchecked);
-
-    if ( !ptr->info().is_visible() )
-      volumeList->item(row,2)->setCheckState(Qt::Checked);
-    else
-      volumeList->item(row,2)->setCheckState(Qt::Unchecked);
-  }
-
-  connectVolumeListHandlers();
-}
-
-void MainWindow::recreate_whole_volume_list()
-{
-  volumeList->clearContents();
-  volumeList->setRowCount(0);
-
-  for (LCC::Attribute_range<3>::type::iterator
-       it=scene.lcc->attributes<3>().begin(),
-       itend=scene.lcc->attributes<3>().end(); it!=itend; ++it)
-    update_volume_list_add(it);
-}
-
-void MainWindow::onCellChanged(int row, int col)
-{
-  volumeList->disconnect(this);
-
-  LCC::Attribute_type<3>::type* ptr=
-      reinterpret_cast<LCC::Attribute_type<3>::type*>
-      ( volumeList->item(row,3)->data(Qt::UserRole).value<quintptr>() );
-
-  if ( col==1 )
-  {
-    ptr->info().negate_filled();
-  }
-  else if ( col==2 )
-  {
-    ptr->info().negate_visible();
-    if ( !ptr->info().is_visible() )
-      volumeList->item(row,1)->setFlags
-          (volumeList->item(row,1)->flags()^Qt::ItemIsEnabled);
-    else
-      volumeList->item(row,1)->setFlags
-          (volumeList->item(row,1)->flags()|Qt::ItemIsEnabled);
-  }
-
-  connectVolumeListHandlers();
-  Q_EMIT( sceneChanged());
-}
-
-void MainWindow::onHeaderClicked(int col)
-{
-  if(col != 0)
-  {
-    volumeList->disconnect(this);
-
-    for(int i = 0; i < volumeList->rowCount(); ++i)
-    {
-      LCC::Attribute_type<3>::type* ptr=
-          reinterpret_cast<LCC::Attribute_type<3>::type*>
-          ( volumeList->item(i,3)->data(Qt::UserRole).value<quintptr>() );
-
-      switch(qApp->keyboardModifiers())
-      {
-      case(Qt::ShiftModifier):
-        if (col==1)
-          ptr->info().set_filled(false);
-        else if (col==2)
-        {
-          ptr->info().set_visible(true);
-          volumeList->item(i,1)->setFlags
-              (volumeList->item(i,1)->flags()|Qt::ItemIsEnabled);
-        }
-        volumeList->item(i,col)->setCheckState(Qt::Unchecked);
-        break;
-      case(Qt::ControlModifier):
-        if (col==1)
-          ptr->info().negate_filled();
-        else if (col==2)
-        {
-          ptr->info().negate_visible();
-          if ( !ptr->info().is_visible() )
-            volumeList->item(i,1)->setFlags
-                (volumeList->item(i,1)->flags()^Qt::ItemIsEnabled);
-          else
-            volumeList->item(i,1)->setFlags
-                (volumeList->item(i,1)->flags()|Qt::ItemIsEnabled);
-        }
-        volumeList->item(i,col)->
-            setCheckState(volumeList->item(i,col)->checkState() ?
-                            Qt::Unchecked: Qt::Checked);
-        break;
-      default:
-        if (col==1)
-          ptr->info().set_filled(true);
-        else if (col==2)
-        {
-          if ( ptr->info().is_visible() )
-          {
-            ptr->info().set_visible(false);
-            volumeList->item(i,1)->setFlags
-              (volumeList->item(i,1)->flags()^Qt::ItemIsEnabled);
-          }
-        }
-        volumeList->item(i,col)->setCheckState(Qt::Checked);
-        break;
-      }
-    }
-
-    connectVolumeListHandlers();
-    Q_EMIT( sceneChanged());
-  }
-}
-
-void MainWindow::mark_all_filled_and_visible_volumes(LCC::size_type amark)
-{
-  for (LCC::Attribute_range<3>::type::iterator
-       it=scene.lcc->attributes<3>().begin(),
-       itend=scene.lcc->attributes<3>().end(); it!=itend; ++it)
-  {
-    if ( scene.lcc->get_attribute<3>(it).info().is_filled_and_visible() &&
-         !scene.lcc->is_marked(it->dart(), amark) )
-      CGAL::mark_cell<LCC,3>(*scene.lcc,
-                             scene.lcc->get_attribute<3>(it).dart(), amark);
-  }
-}
-
-void MainWindow::on_actionExtend_filled_volumes_triggered()
-{
-  volumeList->disconnect(this);
-
-  std::vector<LCC::Attribute_handle<3>::type> tofill;
-
-  LCC::size_type mark_volume = scene.lcc->get_new_mark();
-  bool already_tofill;
-
-  for (LCC::Attribute_range<3>::type::iterator
-       it=scene.lcc->attributes<3>().begin(),
-       itend=scene.lcc->attributes<3>().end(); it!=itend; ++it)
-  {
-    if ( !scene.lcc->is_marked(it->dart(), mark_volume) )
-    {
-      if ( !scene.lcc->get_attribute<3>(it).info().is_filled() )
-      {
-        already_tofill = false;
-        for (LCC::Dart_of_cell_basic_range<3>::iterator it2=
-               scene.lcc->darts_of_cell_basic<3>(it->dart(), mark_volume).begin();
-             it2.cont(); ++it2 )
-        {
-          scene.lcc->mark(it2, mark_volume);
-          if ( !scene.lcc->is_free(it2,3) &&
-               scene.lcc->info<3>(scene.lcc->beta(it2,3)).
-                 is_filled() && !already_tofill)
-          {
-            tofill.push_back(scene.lcc->attribute<3>(it2));
-            already_tofill = true;
-          }
-        }
-      }
-      else
-        CGAL::mark_cell<LCC,3>(*scene.lcc, it->dart(), mark_volume);
-    }
-  }
-
-  CGAL_assertion( scene.lcc->is_whole_map_marked(mark_volume) );
-  scene.lcc->free_mark(mark_volume);
-
-  if ( tofill.size()>0 )
-  {
-    for ( std::vector<LCC::Attribute_handle<3>::type>::iterator
-            it=tofill.begin(), itend=tofill.end(); it!=itend; ++it )
-    {
-      scene.lcc->get_attribute<3>(*it).info().set_filled(true);
-    }
-
-    update_volume_list_all_ckeckstates();
-    Q_EMIT( sceneChanged());
-  }
-
-  connectVolumeListHandlers();
-}
-
-void MainWindow::on_actionExtend_hidden_volumes_triggered()
-{
-  volumeList->disconnect(this);
-
-  std::vector<LCC::Attribute_handle<3>::type> tohide;
-
-  LCC::size_type mark_volume = scene.lcc->get_new_mark();
-  bool already_tohide;
-
-  for (LCC::Attribute_range<3>::type::iterator
-       it=scene.lcc->attributes<3>().begin(),
-       itend=scene.lcc->attributes<3>().end(); it!=itend; ++it)
-  {
-    if ( !scene.lcc->is_marked(it->dart(), mark_volume) )
-    {
-      if ( scene.lcc->get_attribute<3>(it).info().is_visible() )
-      {
-        already_tohide = false;
-        for (LCC::Dart_of_cell_basic_range<3>::iterator it2=
-               scene.lcc->darts_of_cell_basic<3>(it->dart(), mark_volume).begin();
-             it2.cont(); ++it2 )
-        {
-          scene.lcc->mark(it2, mark_volume);
-          if ( !scene.lcc->is_free(it2,3) &&
-               !scene.lcc->info<3>(scene.lcc->beta(it2,3)).
-                  is_visible() && !already_tohide)
-          {
-            tohide.push_back(scene.lcc->attribute<3>(it2));
-            already_tohide = true;
-          }
-        }
-      }
-      else
-        CGAL::mark_cell<LCC,3>(*scene.lcc, it->dart(), mark_volume);
-    }
-  }
-
-  CGAL_assertion( scene.lcc->is_whole_map_marked(mark_volume) );
-  scene.lcc->free_mark(mark_volume);
-
-  if ( tohide.size()>0 )
-  {
-    for ( std::vector<LCC::Attribute_handle<3>::type>::iterator
-            it=tohide.begin(), itend=tohide.end(); it!=itend; ++it )
-    {
-      scene.lcc->get_attribute<3>(*it).info().set_visible(false);
-    }
-
-    update_volume_list_all_ckeckstates();
-    Q_EMIT( sceneChanged());
-  }
-
-  connectVolumeListHandlers();
-}
-
-void MainWindow::on_actionCreate_Menger_Sponge_triggered ()
-{
-  dialogmenger.mengerLevel->disconnect(this);
-
-  mengerUpdateAttributes = dialogmenger.updateAttributes->isChecked();
-
-  dialogmenger.mengerLevel->setValue(0);
-  mengerLevel=0;
-  CGAL_assertion( mengerVolumes.empty() );
-  mengerVolumes.push_back(on_actionCreate_cube_triggered());
-  update_operations_entries(false);
-
-  QObject::connect(dialogmenger.mengerLevel, SIGNAL(valueChanged(int)),
-                   this, SLOT(onMengerChange(int)));
-
-  dialogmenger.show();
-}
-
-void MainWindow::onMengerCancel()
-{
-  for(std::vector<Dart_handle>::iterator it=mengerVolumes.begin();
-      it!=mengerVolumes.end(); ++it)
-  {
-    CGAL::remove_cell<LCC,3>(*scene.lcc, *it);
-  }
-
-  recreate_whole_volume_list();
-  mengerVolumes.clear();
-  update_operations_entries(true);
-  statusBar()->showMessage (QString ("Menger sponge creation canceled"),
-                            DELAY_STATUSMSG);
-  Q_EMIT( sceneChanged());
-}
-
-void MainWindow::onMengerOk()
-{
-  update_operations_entries(true);
-  mengerVolumes.clear();
-}
-
-void MainWindow::onMengerChange(int newLevel)
-{
-  while ( newLevel > mengerLevel ) onMengerInc();
-  while ( newLevel < mengerLevel ) onMengerDec();
-}
-
-void MainWindow::onMengerUpdateAttributes(bool newValue)
-{
-  mengerUpdateAttributes = newValue;
-}
-
-void MainWindow::onMengerInc()
-{
-  QApplication::setOverrideCursor (Qt::WaitCursor);
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  CGAL::Timer timer;
-  timer.start();
-#endif
-
-  this->mengerLevel++;
-
-  if (!mengerUpdateAttributes)
-  {
-    scene.lcc->set_update_attributes(false);
-  }
-
-  std::vector<Dart_handle> edges;
-  std::vector<Dart_handle> faces;
-  std::size_t nbvolinit = mengerVolumes.size();
-
-  LCC::size_type markEdges = (scene.lcc)->get_new_mark();
-  LCC::size_type markFaces = (scene.lcc)->get_new_mark();
-  LCC::size_type markVols  = (scene.lcc)->get_new_mark();
-
-  for(std::vector<Dart_handle>::iterator itvol=mengerVolumes.begin();
-        itvol!=mengerVolumes.end(); ++itvol)
-  {
-    CGAL_assertion( !(scene.lcc)->is_marked(*itvol, markVols) );
-    for (LCC::Dart_of_cell_basic_range<3>::iterator
-         it=(scene.lcc)->darts_of_cell_basic<3>(*itvol, markVols).begin(),
-         itend=(scene.lcc)->darts_of_cell_basic<3>(*itvol, markVols).end();
-         it!=itend; ++it)
-    {
-      if ( !(scene.lcc)->is_marked(it, markEdges) )
-      {
-        edges.push_back(it);
-        CGAL::mark_cell<LCC,1>(*(scene.lcc), it, markEdges);
-      }
-      if ( !(scene.lcc)->is_marked(it, markFaces) )
-      {
-        faces.push_back(it);
-        CGAL::mark_cell<LCC,2>(*(scene.lcc), it, markFaces);
-      }
-    }
-  }
-
-  (scene.lcc)->negate_mark(markVols);
-  for(std::vector<Dart_handle>::iterator itvol=mengerVolumes.begin();
-        itvol!=mengerVolumes.end(); ++itvol)
-  {
-    for (LCC::Dart_of_cell_basic_range<3>::iterator
-         it=(scene.lcc)->darts_of_cell_basic<3>(*itvol, markVols).begin(),
-         itend=(scene.lcc)->darts_of_cell_basic<3>(*itvol, markVols).end();
-         it!=itend; ++it)
-    {
-      (scene.lcc)->unmark(it, markEdges);
-      (scene.lcc)->unmark(it, markFaces);
-    }
-  }
-
-  (scene.lcc)->negate_mark(markVols);
-  CGAL_assertion( (scene.lcc)->is_whole_map_unmarked(markVols) );
-  CGAL_assertion( (scene.lcc)->is_whole_map_unmarked(markFaces) );
-  CGAL_assertion( (scene.lcc)->is_whole_map_unmarked(markEdges) );
-
-  (scene.lcc)->free_mark(markEdges);
-  (scene.lcc)->free_mark(markFaces);
-  (scene.lcc)->free_mark(markVols);
-
-  for(std::size_t i = 0; i < edges.size(); i++)
-  {
-    split_edge_in_three(edges[i]);
-  }
-  edges.clear();
-
-  for(std::size_t i = 0; i < faces.size(); i++)
-  {
-    split_face_in_nine(faces[i]);
-  }
-  faces.clear();
-
-  for(std::size_t i = 0; i < nbvolinit; i++)
-  {
-    split_vol_in_twentyseven(mengerVolumes[i]);
-  }
-
-  if (!mengerUpdateAttributes)
-  {
-    for(std::size_t i = nbvolinit; i < mengerVolumes.size(); i++)
-    {
-      LCC::Attribute_handle<3>::type ah = (scene.lcc)->create_attribute<3>();
-      scene.lcc->set_attribute<3>(mengerVolumes[i], ah);
-      scene.lcc->info<3>(mengerVolumes[i]).color()=
-          (CGAL::Color(myrandom.get_int(0,256),
-                       myrandom.get_int(0,256),
-                       myrandom.get_int(0,256)));
-
-        update_volume_list_add(scene.lcc->attribute<3>(mengerVolumes[i]));
-    }
-
-    scene.lcc->set_update_attributes(true);
-  }
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  timer.stop();
-  std::cout<<"Menger sponge "
-           <<this->mengerLevel-1<<" -> "<<this->mengerLevel<<", "
-          <<"attributes updated "
-         <<(mengerUpdateAttributes ? "DURING" : "AFTER")
-        << " construction: "
-        <<timer.time()<<" seconds."<<std::endl;
-#endif
-
-  CGAL_assertion( (scene.lcc)->is_valid() );
-
-  QApplication::restoreOverrideCursor ();
-  statusBar()->showMessage(QString ("Menger sponge creation %1 -> %2").
-                           arg(this->mengerLevel-1).arg(this->mengerLevel),
-                           DELAY_STATUSMSG);
-
-  Q_EMIT( sceneChanged());
-}
-
-void MainWindow::split_edge_in_three(Dart_handle dh)
-{
-  LCC::Point p1 = scene.lcc->point(dh);
-  LCC::Point p2 = scene.lcc->point(scene.lcc->other_extremity(dh));
-
-  LCC::Vector v1 = LCC::Traits::Construct_vector() (p1,p2);
-  LCC::Vector v2 = LCC::Traits::Construct_scaled_vector() (v1,1.0/3);
-  LCC::Vector v3 = LCC::Traits::Construct_scaled_vector() (v1,2.0/3);
-
-  LCC::Point p3 = LCC::Traits::Construct_translated_point() (p1,v2);
-  LCC::Point p4 = LCC::Traits::Construct_translated_point() (p1,v3);
-
-  (scene.lcc)->insert_point_in_cell<1>(dh,p4);
-  (scene.lcc)->insert_point_in_cell<1>(dh,p3);
-}
-
-void MainWindow::split_face_in_three(Dart_handle dh)
-{
-  CGAL::insert_cell_1_in_cell_2(*(scene.lcc),scene.lcc->beta(dh,1,1,1),
-                                scene.lcc->beta(dh,0,0));
-  CGAL::insert_cell_1_in_cell_2(*(scene.lcc),scene.lcc->beta(dh,1,1),
-                                scene.lcc->beta(dh,0));
-}
-
-void MainWindow::split_face_in_nine(Dart_handle dh)
-{
-  Dart_handle d2 = scene.lcc->beta(dh,1,1,1,1,1,1,1);
-
-  Dart_handle e2= CGAL::insert_cell_1_in_cell_2(*(scene.lcc),
-                                                scene.lcc->beta(dh,1,1),d2);
-  Dart_handle e1= CGAL::insert_cell_1_in_cell_2(*(scene.lcc),
-                                                scene.lcc->beta(dh,1),
-                                                scene.lcc->beta(d2,1));
-
-  split_edge_in_three(e1);
-  split_edge_in_three(e2);
-
-  split_face_in_three(dh);
-  split_face_in_three(d2);
-  split_face_in_three(scene.lcc->beta(e2,0));
-}
-
-void MainWindow::split_vol_in_three(Dart_handle dh, bool removecenter)
-{
-  std::vector<Dart_handle> edges1;
-  std::vector<Dart_handle> edges2;
-
-  Dart_handle curd = scene.lcc->beta(dh,2,1,1,2);
-  for (unsigned int i=0;i<4;++i)
-  {
-    edges1.push_back(curd);
-    curd=scene.lcc->beta(curd,1,2,1);
-  }
-  CGAL_assertion( curd==scene.lcc->beta(dh,2,1,1,2) );
-
-  curd = scene.lcc->beta(curd,1,1,2);
-  for (unsigned int i=0;i<4;++i)
-  {
-    edges2.push_back(curd);
-    curd=scene.lcc->beta(curd,1,2,1);
-  }
-  CGAL_assertion( curd==
-                  scene.lcc->beta(dh,2,1,1,2,1,1,2) );
-
-  Dart_handle f1=
-      insert_cell_2_in_cell_3(*(scene.lcc),edges1.begin(),edges1.end());
-
-  Dart_handle f2=
-      insert_cell_2_in_cell_3(*(scene.lcc),edges2.begin(),edges2.end());
-
-  if (scene.lcc->are_attributes_automatically_managed())
-  {
-    scene.lcc->info<3>(f1).color()=
-      (CGAL::Color(myrandom.get_int(0,256),
-                   myrandom.get_int(0,256),
-                   myrandom.get_int(0,256)));
-    scene.lcc->info<3>(f2).color()=
-      (CGAL::Color(myrandom.get_int(0,256),
-                   myrandom.get_int(0,256),
-                   myrandom.get_int(0,256)));
-
-    update_volume_list_add(scene.lcc->attribute<3>(dh));
-  }
-
-  if ( removecenter )
-    CGAL::remove_cell<LCC,3>(*scene.lcc,f1);
-  else
-  {
-    mengerVolumes.push_back(f1);
-
-    if (scene.lcc->are_attributes_automatically_managed())
-      update_volume_list_add(scene.lcc->attribute<3>(f1));
-  }
-
-  mengerVolumes.push_back(f2);
-}
-
-void MainWindow::split_vol_in_nine(Dart_handle dh, bool removecenter)
-{
-  std::vector<Dart_handle> edges1;
-  std::vector<Dart_handle> edges2;
-
-  Dart_handle curd = scene.lcc->beta(dh,1,2);
-  for (unsigned int i=0;i<8;++i)
-  {
-    edges1.push_back(curd);
-    curd=scene.lcc->beta(curd,1,2,1);
-  }
-  CGAL_assertion( curd==scene.lcc->beta(dh,1,2) );
-
-  curd = scene.lcc->beta(curd,1,1,2);
-  for (unsigned int i=0;i<8;++i)
-  {
-    edges2.push_back(curd);
-    curd=scene.lcc->beta(curd,1,2,1);
-  }
-  CGAL_assertion( curd==scene.lcc->beta(dh,1,2,1,1,2) );
-
-  Dart_handle f1=
-      insert_cell_2_in_cell_3(*(scene.lcc),edges1.begin(),edges1.end());
-
-  Dart_handle f2=
-      insert_cell_2_in_cell_3(*(scene.lcc),edges2.begin(),edges2.end());
-
-  if (scene.lcc->are_attributes_automatically_managed())
-  {
-    scene.lcc->info<3>(f1).color()=
-      (CGAL::Color(myrandom.get_int(0,256),
-                   myrandom.get_int(0,256),
-                   myrandom.get_int(0,256)));
-    scene.lcc->info<3>(f2).color()=
-      (CGAL::Color(myrandom.get_int(0,256),
-                   myrandom.get_int(0,256),
-                   myrandom.get_int(0,256)));
-
-    update_volume_list_add(scene.lcc->attribute<3>(dh));
-    if ( !removecenter)
-      update_volume_list_add(scene.lcc->attribute<3>(f1));
-  }
-
-  split_face_in_three(f1);
-  split_face_in_three(f2);
-
-  split_vol_in_three(dh,removecenter);
-
-  mengerVolumes.push_back(scene.lcc->beta(f2,2,1));
-  split_vol_in_three(scene.lcc->beta(f2,2,1),removecenter);
-
-  if ( removecenter )
-    CGAL::remove_cell<LCC,3>(*scene.lcc,f1);
-  else
-  {
-    mengerVolumes.push_back(scene.lcc->beta(f1,2,1));
-    split_vol_in_three(scene.lcc->beta(f1,2,1),true);
-  }
-}
-
-void MainWindow::split_vol_in_twentyseven(Dart_handle dh)
-{
-  std::vector<Dart_handle> edges1;
-  std::vector<Dart_handle> edges2;
-
-  Dart_handle curd = scene.lcc->beta(dh,1,1,2);
-  for (unsigned int i=0;i<12;++i)
-  {
-    edges1.push_back(curd);
-    curd=scene.lcc->beta(curd,1,2,1);
-  }
-  CGAL_assertion( curd==scene.lcc->beta(dh,1,1,2) );
-
-  curd = scene.lcc->beta(curd,1,1,2);
-  for (unsigned int i=0;i<12;++i)
-  {
-    edges2.push_back(curd);
-    curd=scene.lcc->beta(curd,1,2,1);
-  }
-  CGAL_assertion( curd==scene.lcc->beta(dh,1,1,2,1,1,2) );
-
-  Dart_handle f1=
-      insert_cell_2_in_cell_3(*(scene.lcc),edges1.begin(),edges1.end());
-
-  Dart_handle f2=
-      insert_cell_2_in_cell_3(*(scene.lcc),edges2.begin(),edges2.end());
-
-  if (scene.lcc->are_attributes_automatically_managed())
-  {
-    scene.lcc->info<3>(f1).color()=
-      (CGAL::Color(myrandom.get_int(0,256),
-                   myrandom.get_int(0,256),
-                   myrandom.get_int(0,256)));
-    scene.lcc->info<3>(f2).color()=
-      (CGAL::Color(myrandom.get_int(0,256),
-                   myrandom.get_int(0,256),
-                   myrandom.get_int(0,256)));
-    update_volume_list_add(scene.lcc->attribute<3>(dh));
-    update_volume_list_add(scene.lcc->attribute<3>(f1));
-
-  }
-
-  mengerVolumes.push_back(scene.lcc->beta(f1,2));
-  mengerVolumes.push_back(scene.lcc->beta(f2,2));
-
-  split_face_in_nine(scene.lcc->beta(f1,1));
-  split_face_in_nine(scene.lcc->beta(f2,1));
-
-  split_vol_in_nine(dh,false);
-  split_vol_in_nine(scene.lcc->beta(f1,2),true);
-  split_vol_in_nine(scene.lcc->beta(f2,2),false);
-}
-
-void MainWindow::process_full_slice(Dart_handle init,
-                                  std::vector<Dart_handle>& faces,
-                                  LCC::size_type markVols)
-{
-  Dart_handle d[12];
-  d[0]=scene.lcc->beta(init,1,2);
-  d[1]=scene.lcc->beta(d[0],3,1,2,1);
-  d[2]=scene.lcc->beta(d[1],1,2,1);
-  d[3]=scene.lcc->beta(d[2],3,1,2,1);
-
-  d[4]=scene.lcc->beta(init,1,1,2);
-  d[5]=scene.lcc->beta(d[4],3,0,2,0);
-  d[6]=scene.lcc->beta(d[5],0,2,0);
-
-  d[7]=scene.lcc->beta(d[6],3,0,2,0);
-  d[8]=scene.lcc->beta(d[7],3,0,2,0);
-  d[9]=scene.lcc->beta(d[8],0,2,0);
-
-  d[10]=scene.lcc->beta(d[9],3,0,2,0);
-  d[11]=scene.lcc->beta(d[10],3,0,2,0);
-
-  for (unsigned int j=0; j<12; ++j)
-  {
-    if ( !(scene.lcc)->is_marked(d[j], markVols) )
-    {
-      CGAL::mark_cell<LCC,3>(*(scene.lcc), d[j], markVols);
-    }
-    faces.push_back(d[j]);
-  }
-}
-
-void MainWindow::process_inter_slice(Dart_handle init,
-                                   std::vector<Dart_handle>& faces,
-                                   LCC::size_type markVols)
-{
-  Dart_handle d[24];
-  d[0]=init;
-  d[1]=scene.lcc->beta(d[0],0,2,3,2,0);
-  d[2]=scene.lcc->beta(d[1],0,2,3,2,0);
-  d[3]=scene.lcc->beta(d[2],1,1,2,3,2);
-  d[4]=scene.lcc->beta(d[3],1,1,2,3,2);
-  d[5]=scene.lcc->beta(d[0],1,1,2,3,2);
-  d[6]=scene.lcc->beta(d[5],1,1,2,3,2);
-  d[7]=scene.lcc->beta(d[6],0,2,3,2,0);
-
-  init = scene.lcc->beta(init,3,2,1,1,2);
-  d[8]=init;
-  d[9]=scene.lcc->beta(d[8],3,1,2,3,2,1);
-  d[10]=scene.lcc->beta(d[9],1,2,3,2,1,3);
-  d[11]=scene.lcc->beta(d[10],3,0,0,2,3,2);
-  d[12]=scene.lcc->beta(d[11],0,0,2,3,2,3);
-  d[13]=scene.lcc->beta(d[8],3,0,0,2,3,2);
-  d[14]=scene.lcc->beta(d[13],0,0,2,3,2,3);
-  d[15]=scene.lcc->beta(d[14],3,1,2,3,2,1);
-
-  d[16]=scene.lcc->beta(d[0],3,1,2);
-  d[17]=scene.lcc->beta(d[0],3,1,1,2);
-
-  d[18]=scene.lcc->beta(d[4],3,2);
-  d[19]=scene.lcc->beta(d[4],3,0,2);
-
-  d[20]=scene.lcc->beta(d[2],3,0,2);
-  d[21]=scene.lcc->beta(d[2],3,1,1,2);
-
-  d[22]=scene.lcc->beta(d[6],3,2);
-  d[23]=scene.lcc->beta(d[6],3,1,2);
-
-  for (unsigned int j=0; j<24; ++j)
-  {
-    CGAL_assertion( d[j]!=(scene.lcc)->null_dart_handle );
-    if ( !(scene.lcc)->is_marked(d[j], markVols) )
-    {
-      CGAL::mark_cell<LCC,3>(*(scene.lcc), d[j], markVols);
-    }
-    faces.push_back(d[j]);
-  }
-}
-
-void MainWindow::onMengerDec()
-{
-  QApplication::setOverrideCursor (Qt::WaitCursor);
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  CGAL::Timer timer;
-  timer.start();
-#endif
-
-  this->mengerLevel--;
-
-  // We know here the number of Menger volume: 20^mengerLevel
-  // thus we can directly "cut" the std::vector to the correct size.
-  mengerVolumes.resize(CGAL::ipower(20,mengerLevel));
-
-  LCC::size_type markVols     = (scene.lcc)->get_new_mark();
-  LCC::size_type markVertices = (scene.lcc)->get_new_mark();
-
-  std::vector<Dart_handle> faces;
-  std::vector<Dart_handle> edges;
-  std::vector<Dart_handle> vertices;
-
-  // First we remove faces.
-  for ( std::vector<Dart_handle>::iterator itvol=mengerVolumes.begin();
-        itvol!=mengerVolumes.end(); ++itvol)
-  {
-    if ( !(scene.lcc)->is_marked(*itvol, markVols) )
-    {
-      Dart_handle init=*itvol;
-      CGAL::mark_cell<LCC,3>(*(scene.lcc), init, markVols);
-      process_full_slice(init, faces, markVols);
-      init=scene.lcc->beta(init, 2,1,1,2);
-      process_inter_slice(init, faces, markVols);
-      init=scene.lcc->beta(init, 3,2,1,1,2,3);
-      process_full_slice(init, faces, markVols);
-    }
-  }
-
-  for(std::size_t i = 0; i < faces.size(); i++)
-  {
-    CGAL::remove_cell<LCC,2>(*scene.lcc, faces[i],mengerUpdateAttributes);
-  }
-  faces.clear();
-
-  // Now we remove edges.
-  for ( std::vector<Dart_handle>::iterator itvol=mengerVolumes.begin();
-        itvol!=mengerVolumes.end(); ++itvol)
-  {
-    if ( (scene.lcc)->is_marked(*itvol, markVols) )
-      CGAL::unmark_cell<LCC,3>(*(scene.lcc), *itvol, markVols);
-
-    for (LCC::Dart_of_cell_range<3>::iterator
-           it=scene.lcc->darts_of_cell<3>(*itvol).begin(),
-           itend=scene.lcc->darts_of_cell<3>(*itvol).end();
-         it!=itend; ++it)
-    {
-      if ( scene.lcc->is_free(it,2) &&
-           ( scene.lcc->is_free(it,3) || it<scene.lcc->beta(it,3) ) )
-        edges.push_back(it);
-    }
-  }
-
-  CGAL_assertion( (scene.lcc)->is_whole_map_unmarked(markVols) );
-
-  for(std::size_t i = 0; i < edges.size(); i++)
-  {
-    CGAL::remove_cell<LCC,1>(*scene.lcc, scene.lcc->beta(edges[i],0),mengerUpdateAttributes);
-    CGAL::remove_cell<LCC,1>(*scene.lcc, scene.lcc->beta(edges[i],1),mengerUpdateAttributes);
-    CGAL::remove_cell<LCC,1>(*scene.lcc, edges[i],mengerUpdateAttributes);
-  }
-  edges.clear();
-
-  // Lastly we remove vertices.
-  for ( std::vector<Dart_handle>::iterator itvol=mengerVolumes.begin();
-        itvol!=mengerVolumes.end(); ++itvol)
-  {
-    for (LCC::Dart_of_cell_basic_range<3>::iterator
-         it=(scene.lcc)->darts_of_cell_basic<3>
-           (*itvol, markVols).begin(),
-         itend=(scene.lcc)->darts_of_cell_basic<3>
-           (*itvol, markVols).end(); it!=itend; ++it)
-    {
-      if ( !(scene.lcc)->is_marked(it, markVertices) )
-      {
-        if ( CGAL::is_removable<LCC, 0>(*scene.lcc, it) )
-          vertices.push_back(it);
-        CGAL::mark_cell<LCC, 0>(*scene.lcc, it, markVertices);
-      }
-    }
-  }
-
-  (scene.lcc)->negate_mark(markVols);
-  for ( std::vector<Dart_handle>::iterator itvol=mengerVolumes.begin();
-        itvol!=mengerVolumes.end(); ++itvol)
-  {
-    for (LCC::Dart_of_cell_basic_range<3>::iterator
-         it=(scene.lcc)->darts_of_cell_basic<3>
-           (*itvol, markVols).begin(),
-         itend=(scene.lcc)->darts_of_cell_basic<3>
-           (*itvol, markVols).end(); it!=itend; ++it)
-    {
-      if ( (scene.lcc)->is_marked(it, markVertices) )
-        CGAL::unmark_cell<LCC, 0>(*scene.lcc, it, markVertices);
-    }
-  }
-
-  (scene.lcc)->negate_mark(markVols);
-  CGAL_assertion( (scene.lcc)->is_whole_map_unmarked(markVols) );
-  CGAL_assertion( (scene.lcc)->is_whole_map_unmarked(markVertices) );
-
-  for(std::size_t i = 0; i < vertices.size(); i++)
-  {
-    CGAL::remove_cell<LCC,0>(*scene.lcc, vertices[i],mengerUpdateAttributes);
-  }
-  vertices.clear();
-
-  (scene.lcc)->free_mark(markVols);
-  (scene.lcc)->free_mark(markVertices);
-
-  if (!mengerUpdateAttributes)
-  {
-    scene.lcc->correct_invalid_attributes();
-  }
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  timer.stop();
-  std::cout<<"Menger sponge "
-           <<this->mengerLevel+1<<" -> "<<this->mengerLevel<<", "
-          <<"attributes updated "
-         <<(mengerUpdateAttributes ? "DURING" : "AFTER")
-        << " construction: "
-        <<timer.time()<<" seconds."<<std::endl;
-#endif
-
-  recreate_whole_volume_list();
-
-  statusBar()->showMessage(QString ("Menger sponge creation %1 -> %2").
-                           arg(this->mengerLevel+1).arg(this->mengerLevel),
-                           DELAY_STATUSMSG);
-
-  QApplication::restoreOverrideCursor ();
-  Q_EMIT( sceneChanged());
-}
-
-///////////////////////////////////////////////////////////////////////////////////
-// SIERPINSKI CARPET
-///////////////////////////////////////////////////////////////////////////////////
-
-void MainWindow::on_actionCreate_Sierpinski_Carpet_triggered ()
-{
-  /*neverUpdateAttributes = dialogsierpinskicarpet.never->isChecked();
-  duringConstructionUpdateAttributes = dialogsierpinskicarpet.during->isChecked();
-  afterConstructionUpdateAttributes = dialogsierpinskicarpet.after->isChecked();
-  updateAttributesMethodStdMap = dialogsierpinskicarpet.stdmap->isChecked();
-  updateAttributesMethodTraversal = dialogsierpinskicarpet.traversal->isChecked();
-  // By default, the geometry will be computed after the construction
-  isComputableGeometry = true;*/
-
-  computeGeometry = false;
-
-  sierpinskiCarpetUpdateAttributes
-    = dialogsierpinskicarpet.updateAttributes->isChecked();
-
-  dialogsierpinskicarpet.level->disconnect(this);
-
-  dialogsierpinskicarpet.level->setValue(0);
-  sierpinskiCarpetLevel=0;
-  CGAL_assertion( sierpinskiCarpetSurfaces.empty() );
-
-  Point_3 basepoint(nbcube%5, (nbcube/5)%5, nbcube/25);
-
-  Dart_handle d = scene.lcc->make_quadrangle(basepoint,
-                                             LCC::Traits::Construct_translated_point()
-                                             (basepoint,LCC::Traits::Vector(1,0,0)),
-                                             LCC::Traits::Construct_translated_point()
-                                             (basepoint,LCC::Traits::Vector(1,1,0)),
-                                             LCC::Traits::Construct_translated_point()
-                                             (basepoint,LCC::Traits::Vector(0,1,0)));
-
-  on_new_volume(d);
-
-  ++nbcube;
-
-  statusBar ()->showMessage (QString ("Square created"),DELAY_STATUSMSG);
-
-  Q_EMIT (sceneChanged ());
-
-  sierpinskiCarpetSurfaces.push_back(d);
-  update_operations_entries(false);
-
-  QObject::connect(dialogsierpinskicarpet.level, SIGNAL(valueChanged(int)),
-                   this, SLOT(onSierpinskiCarpetChangeLevel(int)));
-
-  dialogsierpinskicarpet.show();
-}
-
-void MainWindow::onSierpinskiCarpetCancel()
-{
-  QApplication::setOverrideCursor (Qt::WaitCursor);
-  for(std::vector<Dart_handle>::iterator it=sierpinskiCarpetSurfaces.begin();
-      it!=sierpinskiCarpetSurfaces.end(); ++it)
-  {
-    CGAL::remove_cell<LCC,2>(*scene.lcc, *it);
-  }
-
-  recreate_whole_volume_list();
-  sierpinskiCarpetSurfaces.clear();
-  update_operations_entries(true);
-  QApplication::restoreOverrideCursor ();
-  Q_EMIT( sceneChanged());
-}
-
-void MainWindow::onSierpinskiCarpetOk()
-{
-  update_operations_entries(true);
-  sierpinskiCarpetSurfaces.clear();
-}
-
-void MainWindow::onSierpinskiCarpetChangeLevel(int newLevel)
-{
-  while ( newLevel > sierpinskiCarpetLevel ) onSierpinskiCarpetInc();
-  while ( newLevel < sierpinskiCarpetLevel ) onSierpinskiCarpetDec();
-}
-
-void MainWindow::onSierpinskiCarpetUpdateAttributes(bool newValue)
-{
-  sierpinskiCarpetUpdateAttributes = newValue;
-}
-
-void MainWindow::onSierpinskiCarpetInc()
-{
-  QApplication::setOverrideCursor (Qt::WaitCursor);
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  CGAL::Timer timer;
-  timer.start();
-#endif
-
-  this->sierpinskiCarpetLevel++;
-
-/*  if (computeGeometry)
-  {
-    // Here case where the geometry could be computed after the construction, but it was not updated.
-    computeGeometry = false;
-    dialogsierpinskicarpet.computeGeometry->setEnabled(false);
-    //  => geometry will not be computed later.
-    isComputableGeometry = false;
-  }*/
-
-  std::vector<Dart_handle> edges;
-  nbfacesinit = sierpinskiCarpetSurfaces.size();
-
-  LCC::size_type markEdges = (scene.lcc)->get_new_mark();
-  LCC::size_type markFaces = (scene.lcc)->get_new_mark();
-
-  for(std::vector<Dart_handle>::iterator itfaces=sierpinskiCarpetSurfaces.begin();
-        itfaces!=sierpinskiCarpetSurfaces.end(); ++itfaces)
-  {
-    CGAL_assertion( !(scene.lcc)->is_marked(*itfaces, markFaces) );
-    for (LCC::Dart_of_cell_basic_range<2>::iterator
-         it=(scene.lcc)->darts_of_cell_basic<2>(*itfaces, markFaces).begin(),
-         itend=(scene.lcc)->darts_of_cell_basic<2>(*itfaces, markFaces).end();
-         it!=itend; ++it)
-    {
-      if ( !(scene.lcc)->is_marked(it, markEdges) )
-      {
-        edges.push_back(it);
-        CGAL::mark_cell<LCC,1>(*(scene.lcc), it, markEdges);
-      }
-    }
-  }
-
-  (scene.lcc)->negate_mark(markFaces);
-  for(std::vector<Dart_handle>::iterator itfaces=sierpinskiCarpetSurfaces.begin();
-        itfaces!=sierpinskiCarpetSurfaces.end(); ++itfaces)
-  {
-    for (LCC::Dart_of_cell_basic_range<2>::iterator
-         it=(scene.lcc)->darts_of_cell_basic<2>(*itfaces, markFaces).begin(),
-         itend=(scene.lcc)->darts_of_cell_basic<2>(*itfaces, markFaces).end();
-         it!=itend; ++it)
-    {
-      (scene.lcc)->unmark(it, markEdges);
-    }
-  }
-
-  (scene.lcc)->negate_mark(markFaces);
-  CGAL_assertion( (scene.lcc)->is_whole_map_unmarked(markFaces) );
-  CGAL_assertion( (scene.lcc)->is_whole_map_unmarked(markEdges) );
-
-  (scene.lcc)->free_mark(markEdges);
-  (scene.lcc)->free_mark(markFaces);
-
-/*  if (afterConstructionUpdateAttributes)
-  {
-    if (updateAttributesMethodStdMap)
-    {
-      // We create a map to associate embeddings to new darts
-      for(std::size_t i = 0; i < edges.size(); i++)
-      {
-        dart_map.insert(std::pair<Dart_handle, LCC::Point>
-                        (edges[i], scene.lcc->point(edges[i])));
-        if (!(scene.lcc)->is_free(edges[i],2))
-        {
-          dart_map.insert(std::pair<Dart_handle, LCC::Point>
-                          ((scene.lcc)->beta(edges[i],2),
-                           scene.lcc->point((scene.lcc)->beta(edges[i],2))));
-        }
-      }
-    }
-  }*/
-
-  for(std::size_t i = 0; i < edges.size(); i++)
-  {
-    sierpinski_carpet_split_edge_in_three(edges[i]);
-  }
-  edges.clear();
-
-  for(std::size_t i = 0; i < nbfacesinit; i++)
-  {
-    sierpinski_carpet_split_face_in_nine(sierpinskiCarpetSurfaces[i]);
-  }
-
-  if (!sierpinskiCarpetUpdateAttributes)
-  {
-    sierpinski_carpet_update_geometry();
-  }
-
-/*  if (neverUpdateAttributes)
-  {
-    scene.lcc->correct_invalid_attributes();
-
-    // Now that the map is valid, we can compute the geometry
-    if (isComputableGeometry)
-    {
-      computeGeometry = true;
-      dialogsierpinskicarpet.computeGeometry->setEnabled(true);
-    }
-  }*/
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  timer.stop();
-  std::cout<<"Sierpinski carpet "
-           <<this->sierpinskiCarpetLevel-1<<" -> "
-          <<this->sierpinskiCarpetLevel<<", "
-         <<"attributes updated "
-        <<(sierpinskiCarpetUpdateAttributes ? "DURING" : "AFTER")
-       << " construction: "
-       <<timer.time()<<" seconds."<<std::endl;
-#endif
-
-  CGAL_assertion( (scene.lcc)->is_valid() );
-
-  statusBar()->showMessage(QString ("Sierpinski carpet creation %1 -> %2").
-                           arg(this->sierpinskiCarpetLevel-1).
-                           arg(this->sierpinskiCarpetLevel),
-                           DELAY_STATUSMSG);
-
-  QApplication::restoreOverrideCursor ();
-  Q_EMIT( sceneChanged());
-}
-
-void MainWindow::sierpinski_carpet_update_geometry()
-{
-/*  if (updateAttributesMethodStdMap)
-  {
-    for(std::size_t i = 0; i < new_darts.size(); i++)
-    {
-      sierpinski_carpet_copy_attributes_and_embed_vertex(new_darts[i], dart_map[new_darts[i]]);
-    }
-
-    dart_map.clear();
-    new_darts.clear();
-  }
-
-  if (updateAttributesMethodTraversal)*/
-  {
-    LCC::size_type markVertices = (scene.lcc)->get_new_mark();
-
-    for(std::size_t i = 0; i < nbfacesinit; i++)
-    {
-      // Geometry of the 4 corners of the current face
-      LCC::Point p[4][4];
-      Dart_handle d00 = sierpinskiCarpetSurfaces[i];
-      Dart_handle d03 = scene.lcc->beta(d00,1,2,1,1,2,1,1);
-      Dart_handle d33 = scene.lcc->beta(d03,1,2,1,1,2,1,1);
-      Dart_handle d30 = scene.lcc->beta(d33,1,2,1,1,2,1,1);
-      sierpinski_carpet_compute_4x4_geometry_matrix(p,
-                                                    scene.lcc->point(d00),
-                                                    scene.lcc->point(d03),
-                                                    scene.lcc->point(d33),
-                                                    scene.lcc->point(d30));
-
-      Dart_handle dh = sierpinskiCarpetSurfaces[i];
-
-      // bottom border
-      dh = scene.lcc->beta(dh,1,2,1);
-      if ( ! (scene.lcc)->is_marked(dh, markVertices) )
-      {
-        sierpinski_carpet_copy_attributes_and_embed_vertex(dh, p[0][1]);
-        CGAL::mark_cell<LCC,0>(*(scene.lcc), dh, markVertices);
-      }
-      dh = scene.lcc->beta(dh,1,2,1);
-      if ( ! (scene.lcc)->is_marked(dh, markVertices) )
-      {
-        sierpinski_carpet_copy_attributes_and_embed_vertex(dh, p[0][2]);
-        CGAL::mark_cell<LCC,0>(*(scene.lcc), dh, markVertices);
-      }
-
-      // right border
-      dh = scene.lcc->beta(dh,1,1,2,1);
-      if ( ! (scene.lcc)->is_marked(dh, markVertices) )
-      {
-        sierpinski_carpet_copy_attributes_and_embed_vertex(dh, p[1][3]);
-        CGAL::mark_cell<LCC,0>(*(scene.lcc), dh, markVertices);
-      }
-      dh = scene.lcc->beta(dh,1,2,1);
-      if ( ! (scene.lcc)->is_marked(dh, markVertices) )
-      {
-        sierpinski_carpet_copy_attributes_and_embed_vertex(dh, p[2][3]);
-        CGAL::mark_cell<LCC,0>(*(scene.lcc), dh, markVertices);
-      }
-
-      // top border
-      dh = scene.lcc->beta(dh,1,1,2,1);
-      if ( ! (scene.lcc)->is_marked(dh, markVertices) )
-      {
-        sierpinski_carpet_copy_attributes_and_embed_vertex(dh, p[3][2]);
-        CGAL::mark_cell<LCC,0>(*(scene.lcc), dh, markVertices);
-      }
-      dh = scene.lcc->beta(dh,1,2,1);
-      if ( ! (scene.lcc)->is_marked(dh, markVertices) )
-      {
-        sierpinski_carpet_copy_attributes_and_embed_vertex(dh, p[3][1]);
-        CGAL::mark_cell<LCC,0>(*(scene.lcc), dh, markVertices);
-      }
-
-      // left border
-      dh = scene.lcc->beta(dh,1,1,2,1);
-      if ( ! (scene.lcc)->is_marked(dh, markVertices) )
-      {
-        sierpinski_carpet_copy_attributes_and_embed_vertex(dh, p[2][0]);
-        CGAL::mark_cell<LCC,0>(*(scene.lcc), dh, markVertices);
-      }
-      dh = scene.lcc->beta(dh,1,2,1);
-      if ( ! (scene.lcc)->is_marked(dh, markVertices) )
-      {
-        sierpinski_carpet_copy_attributes_and_embed_vertex(dh, p[1][0]);
-        CGAL::mark_cell<LCC,0>(*(scene.lcc), dh, markVertices);
-      }
-
-      dh = sierpinskiCarpetSurfaces[i];
-
-      // middle vertex, bottom left
-      dh = scene.lcc->beta(dh,1,1);
-      sierpinski_carpet_copy_attributes_and_embed_vertex(dh, p[1][1]);
-
-      // middle vertex, top left
-      dh = scene.lcc->beta(dh,2,1,1);
-      sierpinski_carpet_copy_attributes_and_embed_vertex(dh, p[2][1]);
-
-      // middle vertex, top right
-      dh = scene.lcc->beta(dh,2,1,2,1,1,2,1);
-      sierpinski_carpet_copy_attributes_and_embed_vertex(dh, p[2][2]);
-
-      // middle vertex, bottom right
-      dh = scene.lcc->beta(dh,2,1,1);
-      sierpinski_carpet_copy_attributes_and_embed_vertex(dh, p[1][2]);
-    }
-
-    scene.lcc->unmark_all(markVertices);
-    CGAL_assertion( (scene.lcc)->is_whole_map_unmarked(markVertices) );
-  }
-}
-
-void MainWindow::sierpinski_carpet_compute_geometry()
-{
-  LCC::size_type markVertices = (scene.lcc)->get_new_mark();
-
-  for(std::size_t i = 0; i < nbfacesinit; i++)
-  {
-    // on récupère la géométrie des 4 coins de la face courante
-    LCC::Point p[4][4];
-    Dart_handle d00 = sierpinskiCarpetSurfaces[i];
-    Dart_handle d03 = scene.lcc->beta(d00,1,2,1,1,2,1,1);
-    Dart_handle d33 = scene.lcc->beta(d03,1,2,1,1,2,1,1);
-    Dart_handle d30 = scene.lcc->beta(d33,1,2,1,1,2,1,1);
-    sierpinski_carpet_compute_4x4_geometry_matrix(p, scene.lcc->point(d00), scene.lcc->point(d03), scene.lcc->point(d33), scene.lcc->point(d30));
-
-    Dart_handle dh = sierpinskiCarpetSurfaces[i];
-
-    // Geometry of the 4 corners of the current face
-    // bottom border
-    dh = scene.lcc->beta(dh,1,2,1);
-    if ( ! (scene.lcc)->is_marked(dh, markVertices) )
-    {
-      scene.lcc->point(dh) = p[0][1];
-      CGAL::mark_cell<LCC,0>(*(scene.lcc), dh, markVertices);
-    }
-    dh = scene.lcc->beta(dh,1,2,1);
-    if ( ! (scene.lcc)->is_marked(dh, markVertices) )
-    {
-      scene.lcc->point(dh) = p[0][2];
-      CGAL::mark_cell<LCC,0>(*(scene.lcc), dh, markVertices);
-    }
-
-    // right border
-    dh = scene.lcc->beta(dh,1,1,2,1);
-    if ( ! (scene.lcc)->is_marked(dh, markVertices) )
-    {
-      scene.lcc->point(dh) = p[1][3];
-      CGAL::mark_cell<LCC,0>(*(scene.lcc), dh, markVertices);
-    }
-    dh = scene.lcc->beta(dh,1,2,1);
-    if ( ! (scene.lcc)->is_marked(dh, markVertices) )
-    {
-      scene.lcc->point(dh) = p[2][3];
-      CGAL::mark_cell<LCC,0>(*(scene.lcc), dh, markVertices);
-    }
-
-    // top border
-    dh = scene.lcc->beta(dh,1,1,2,1);
-    if ( ! (scene.lcc)->is_marked(dh, markVertices) )
-    {
-      scene.lcc->point(dh) = p[3][2];
-      CGAL::mark_cell<LCC,0>(*(scene.lcc), dh, markVertices);
-    }
-    dh = scene.lcc->beta(dh,1,2,1);
-    if ( ! (scene.lcc)->is_marked(dh, markVertices) )
-    {
-      scene.lcc->point(dh) = p[3][1];
-      CGAL::mark_cell<LCC,0>(*(scene.lcc), dh, markVertices);
-    }
-
-    // left border
-    dh = scene.lcc->beta(dh,1,1,2,1);
-    if ( ! (scene.lcc)->is_marked(dh, markVertices) )
-    {
-      scene.lcc->point(dh) = p[2][0];
-      CGAL::mark_cell<LCC,0>(*(scene.lcc), dh, markVertices);
-    }
-    dh = scene.lcc->beta(dh,1,2,1);
-    if ( ! (scene.lcc)->is_marked(dh, markVertices) )
-    {
-      scene.lcc->point(dh) = p[1][0];
-      CGAL::mark_cell<LCC,0>(*(scene.lcc), dh, markVertices);
-    }
-
-    dh = sierpinskiCarpetSurfaces[i];
-
-    // middle vertex, bottom left
-    dh = scene.lcc->beta(dh,1,1);
-    scene.lcc->point(dh) = p[1][1];
-
-    // middle vertex, top left
-    dh = scene.lcc->beta(dh,2,1,1);
-    scene.lcc->point(dh) = p[2][1];
-
-    // middle vertex, top right
-    dh = scene.lcc->beta(dh,2,1,2,1,1,2,1);
-    scene.lcc->point(dh) = p[2][2];
-
-    // middle vertex, bottom right
-    dh = scene.lcc->beta(dh,2,1,1);
-    scene.lcc->point(dh) = p[1][2];
-
-    }
-
-  scene.lcc->unmark_all(markVertices);
-  CGAL_assertion( (scene.lcc)->is_whole_map_unmarked(markVertices) );
-}
-
-void MainWindow::sierpinski_carpet_compute_4x4_geometry_matrix
-(LCC::Point p[4][4], LCC::Point& p00, LCC::Point& p03,
- LCC::Point& p33, LCC::Point& p30)
-{
-  p[0][0] = p00;
-  p[0][3] = p03;
-  p[3][3] = p33;
-  p[3][0] = p30;
-
-  LCC::Vector v1, v2, v3;
-
-  // bottom border
-  v1 = LCC::Traits::Construct_vector() (p[0][0],p[0][3]);
-  v2 = LCC::Traits::Construct_scaled_vector() (v1,1.0/3);
-  v3 = LCC::Traits::Construct_scaled_vector() (v1,2.0/3);
-  p[0][1] = LCC::Traits::Construct_translated_point() (p[0][0],v2);
-  p[0][2] = LCC::Traits::Construct_translated_point() (p[0][0],v3);
-  // right border
-  v1 = LCC::Traits::Construct_vector() (p[0][3],p[3][3]);
-  v2 = LCC::Traits::Construct_scaled_vector() (v1,1.0/3);
-  v3 = LCC::Traits::Construct_scaled_vector() (v1,2.0/3);
-  p[1][3] = LCC::Traits::Construct_translated_point() (p[0][3],v2);
-  p[2][3] = LCC::Traits::Construct_translated_point() (p[0][3],v3);
-  // top border
-  v1 = LCC::Traits::Construct_vector() (p[3][3],p[3][0]);
-  v2 = LCC::Traits::Construct_scaled_vector() (v1,1.0/3);
-  v3 = LCC::Traits::Construct_scaled_vector() (v1,2.0/3);
-  p[3][2] = LCC::Traits::Construct_translated_point() (p[3][3],v2);
-  p[3][1] = LCC::Traits::Construct_translated_point() (p[3][3],v3);
-  // left border
-  v1 = LCC::Traits::Construct_vector() (p[3][0],p[0][0]);
-  v2 = LCC::Traits::Construct_scaled_vector() (v1,1.0/3);
-  v3 = LCC::Traits::Construct_scaled_vector() (v1,2.0/3);
-  p[2][0] = LCC::Traits::Construct_translated_point() (p[3][0],v2);
-  p[1][0] = LCC::Traits::Construct_translated_point() (p[3][0],v3);
-  // middle, left column
-  v1 = LCC::Traits::Construct_vector() (p[0][1],p[3][1]);
-  v2 = LCC::Traits::Construct_scaled_vector() (v1,1.0/3);
-  v3 = LCC::Traits::Construct_scaled_vector() (v1,2.0/3);
-  p[1][1] = LCC::Traits::Construct_translated_point() (p[0][1],v2);
-  p[2][1] = LCC::Traits::Construct_translated_point() (p[0][1],v3);
-  // middle, right column
-  v1 = LCC::Traits::Construct_vector() (p[3][2],p[0][2]);
-  v2 = LCC::Traits::Construct_scaled_vector() (v1,1.0/3);
-  v3 = LCC::Traits::Construct_scaled_vector() (v1,2.0/3);
-  p[2][2] = LCC::Traits::Construct_translated_point() (p[3][2],v2);
-  p[1][2] = LCC::Traits::Construct_translated_point() (p[3][2],v3);
-}
-
-void MainWindow::sierpinski_carpet_copy_attributes_and_embed_vertex
-(Dart_handle dh, LCC::Point& p)
-{
-  LCC::Attribute_handle<0>::type ah = (scene.lcc)->create_vertex_attribute(p);
-  for ( LCC::Dart_of_cell_range<0>::iterator
-        it=(scene.lcc)->darts_of_cell<0>(dh).begin();
-        it != (scene.lcc)->darts_of_cell<0>(dh).end(); ++it )
-  {
-    // We copy all the attributes except for dim=0
-    LCC::Helper::Foreach_enabled_attributes_except
-      <CGAL::internal::Group_attribute_functor_of_dart<LCC>, 0>::
-      run(scene.lcc,sierpinskiCarpetSurfaces[0],it);
-    // We initialise the 0-atttrib to ah
-    CGAL::internal::Set_i_attribute_of_dart_functor<LCC, 0>::
-        run(scene.lcc, it, ah);
-  }
-}
-
-void MainWindow::sierpinski_carpet_split_edge_in_three(Dart_handle dh)
-{
-  if (sierpinskiCarpetUpdateAttributes)
-  {
-    LCC::Point p1 = scene.lcc->point(dh);
-    LCC::Point p2 = scene.lcc->point(scene.lcc->other_extremity(dh));
-
-    LCC::Vector v1 = LCC::Traits::Construct_vector() (p1,p2);
-    LCC::Vector v2 = LCC::Traits::Construct_scaled_vector() (v1,1.0/3);
-    LCC::Vector v3 = LCC::Traits::Construct_scaled_vector() (v1,2.0/3);
-
-    LCC::Point p3 = LCC::Traits::Construct_translated_point() (p1,v2);
-    LCC::Point p4 = LCC::Traits::Construct_translated_point() (p1,v3);
-
-    (scene.lcc)->insert_point_in_cell<1>(dh,p4);
-    (scene.lcc)->insert_point_in_cell<1>(dh,p3);
-  }
-  else
-  {
-    LCC::Point p3, p4;
-
-    /*if (afterConstructionUpdateAttributes && updateAttributesMethodStdMap)
-    {
-      LCC::Point p1 = dart_map[dh];
-      LCC::Point p2 = dart_map[scene.lcc->other_extremity(dh)];
-      LCC::Vector v1 = LCC::Traits::Construct_vector() (p1,p2);
-      LCC::Vector v2 = LCC::Traits::Construct_scaled_vector() (v1,1.0/3);
-      LCC::Vector v3 = LCC::Traits::Construct_scaled_vector() (v1,2.0/3);
-
-      p3 = LCC::Traits::Construct_translated_point() (p1,v2);
-      p4 = LCC::Traits::Construct_translated_point() (p1,v3);
-    }*/
-
-    //    Dart_handle d1=
-        CGAL::insert_cell_0_in_cell_1(*(scene.lcc),
-                                      dh,
-                                      LCC::null_handle,
-                                      false);
-
-    /*if (afterConstructionUpdateAttributes && updateAttributesMethodStdMap)
-    {
-      dart_map.insert(std::pair<Dart_handle, LCC::Point>(d1, p4));
-      if (!(scene.lcc)->is_free(d1,2))
-      {
-        dart_map.insert(std::pair<Dart_handle, LCC::Point>((scene.lcc)->beta(d1,2,1), p4));
-      }
-      new_darts.push_back((scene.lcc)->beta(dh,1));
-    }*/
-
-    //    Dart_handle d2=
-        CGAL::insert_cell_0_in_cell_1(*(scene.lcc),
-                                      dh,
-                                      LCC::null_handle,
-                                      false);
-
-    /*if (afterConstructionUpdateAttributes && updateAttributesMethodStdMap)
-    {
-      dart_map.insert(std::pair<Dart_handle, LCC::Point>(d2, p3));
-      if (!(scene.lcc)->is_free(d2,2))
-      {
-        dart_map.insert(std::pair<Dart_handle, LCC::Point>((scene.lcc)->beta(d2,2,1), p3));
-      }
-      new_darts.push_back((scene.lcc)->beta(dh,1));
-    }*/
-  }
-}
-
-void MainWindow::sierpinski_carpet_split_face_in_three(Dart_handle dh,
-                                                       bool removecenter)
-{
-  Dart_handle d1=
-  CGAL::insert_cell_1_in_cell_2(*(scene.lcc),
-                                scene.lcc->beta(dh,1,1,1),
-                                scene.lcc->beta(dh,0,0),
-                                sierpinskiCarpetUpdateAttributes);
-  Dart_handle d2=
-  CGAL::insert_cell_1_in_cell_2(*(scene.lcc),
-                                scene.lcc->beta(dh,1,1),
-                                scene.lcc->beta(dh,0),
-                                sierpinskiCarpetUpdateAttributes);
-
-  if ( removecenter )
-  {
-    CGAL::remove_cell<LCC,2>(*scene.lcc,d2,sierpinskiCarpetUpdateAttributes);
-  }
-  else
-  {
-    sierpinskiCarpetSurfaces.push_back(d2);
-  }
-
-  sierpinskiCarpetSurfaces.push_back(d1);
-}
-
-void MainWindow::sierpinski_carpet_split_face_in_nine(Dart_handle dh)
-{
-  Dart_handle d1 = scene.lcc->beta(dh,1,1);
-  Dart_handle d2 = scene.lcc->beta(dh,1,1,1,1,1,1,1);
-  Dart_handle d3 = scene.lcc->beta(dh,1);
-  Dart_handle d4 = scene.lcc->beta(d2,1);
-
-  Dart_handle e2=
-  CGAL::insert_cell_1_in_cell_2(*(scene.lcc),
-                                d1,
-                                d2,
-                                sierpinskiCarpetUpdateAttributes);
-
-  /*if (afterConstructionUpdateAttributes && updateAttributesMethodStdMap)
-  {
-    dart_map.insert(std::pair<Dart_handle, LCC::Point>(e2, dart_map[d2]));
-    dart_map.insert(std::pair<Dart_handle, LCC::Point>((scene.lcc)->beta(e2,2), dart_map[d1]));
-  }*/
-
-  Dart_handle e1=
-  CGAL::insert_cell_1_in_cell_2(*(scene.lcc),
-                                d3,
-                                d4,
-                                sierpinskiCarpetUpdateAttributes);
-
-  /*if (afterConstructionUpdateAttributes && updateAttributesMethodStdMap)
-  {
-    dart_map.insert(std::pair<Dart_handle, LCC::Point>(e1, dart_map[d4]));
-    dart_map.insert(std::pair<Dart_handle, LCC::Point>((scene.lcc)->beta(e1,2), dart_map[d3]));
-  }*/
-
-  sierpinskiCarpetSurfaces.push_back(e2);
-  sierpinskiCarpetSurfaces.push_back(e1);
-
-  // We give the beta2 to not insert in new_darts a dart that will be removed
-  // during the removal of the middle face
-  sierpinski_carpet_split_edge_in_three(scene.lcc->beta(e1,2));
-  sierpinski_carpet_split_edge_in_three(e2);
-
-  sierpinski_carpet_split_face_in_three(dh, false);
-  sierpinski_carpet_split_face_in_three(d2, true);
-  sierpinski_carpet_split_face_in_three(scene.lcc->beta(e2,0), false);
-}
-
-void MainWindow::onSierpinskiCarpetDec()
-{
-  QApplication::setOverrideCursor (Qt::WaitCursor);
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  CGAL::Timer timer;
-  timer.start();
-#endif
-
-  this->sierpinskiCarpetLevel--;
-
-  // We know here the number of Sierpinski surfaces: 8^sierpinskiCarpetLevel
-  // thus we can directly "cut" the std::vector to the correct size.
-  sierpinskiCarpetSurfaces.resize(CGAL::ipower(8,sierpinskiCarpetLevel));
-
-  LCC::size_type markSurfaces = (scene.lcc)->get_new_mark();
-  LCC::size_type markVertices = (scene.lcc)->get_new_mark();
-
-  std::vector<Dart_handle> edges;
-  std::vector<Dart_handle> vertices;
-
-  // First we remove edges.
-  for ( std::vector<Dart_handle>::iterator
-        itsurfaces=sierpinskiCarpetSurfaces.begin();
-        itsurfaces!=sierpinskiCarpetSurfaces.end(); ++itsurfaces)
-  {
-    Dart_handle dh = *itsurfaces;
-    dh = scene.lcc->beta(dh,1,1,2,1);
-    edges.push_back(dh);
-    dh = scene.lcc->beta(dh,1,2,1,2,1);
-    edges.push_back(dh);
-    dh = scene.lcc->beta(dh,1,2,1,2,1);
-    edges.push_back(dh);
-    dh = scene.lcc->beta(dh,1,2,1,2,1);
-    edges.push_back(dh);
-  }
-
-  for(std::size_t i = 0; i < edges.size(); i++)
-  {
-    CGAL::remove_cell<LCC,1>(*scene.lcc, scene.lcc->beta(edges[i],0),
-                             sierpinskiCarpetUpdateAttributes);
-    CGAL::remove_cell<LCC,1>(*scene.lcc, scene.lcc->beta(edges[i],1),
-                             sierpinskiCarpetUpdateAttributes);
-    CGAL::remove_cell<LCC,1>(*scene.lcc, edges[i],
-                             sierpinskiCarpetUpdateAttributes);
-  }
-  edges.clear();
-
-  // Lastly we remove vertices.
-  for ( std::vector<Dart_handle>::iterator
-        itsurfaces=sierpinskiCarpetSurfaces.begin();
-        itsurfaces!=sierpinskiCarpetSurfaces.end(); ++itsurfaces)
-  {
-    Dart_handle dh = scene.lcc->beta(*itsurfaces,1);
-    // we proceed side by side
-    for (unsigned int i = 0; i < 4; i++)
-    {
-      if ( !(scene.lcc)->is_marked(dh, markVertices) )
-      {
-        vertices.push_back(dh);
-        CGAL::mark_cell<LCC, 0>(*scene.lcc, dh, markVertices);
-      }
-      dh = scene.lcc->beta(dh,1);
-      if ( !(scene.lcc)->is_marked(dh, markVertices) )
-      {
-        vertices.push_back(dh);
-        CGAL::mark_cell<LCC, 0>(*scene.lcc, dh, markVertices);
-      }
-      dh = scene.lcc->beta(dh,1,1);
-    }
-  }
-
-  (scene.lcc)->negate_mark(markSurfaces);
-  for ( std::vector<Dart_handle>::iterator
-        itsurfaces=sierpinskiCarpetSurfaces.begin();
-        itsurfaces!=sierpinskiCarpetSurfaces.end(); ++itsurfaces)
-  {
-    Dart_handle dh = scene.lcc->beta(*itsurfaces,1);
-    for (unsigned int i = 0; i < 4; i++)
-    {
-      if ( (scene.lcc)->is_marked(dh, markVertices) )
-        CGAL::unmark_cell<LCC, 0>(*scene.lcc, dh, markVertices);
-      dh = scene.lcc->beta(dh,1);
-      if ( (scene.lcc)->is_marked(dh, markVertices) )
-        CGAL::unmark_cell<LCC, 0>(*scene.lcc, dh, markVertices);
-      dh = scene.lcc->beta(dh,1,1);
-    }
-  }
-
-  (scene.lcc)->negate_mark(markSurfaces);
-  CGAL_assertion( (scene.lcc)->is_whole_map_unmarked(markSurfaces) );
-  CGAL_assertion( (scene.lcc)->is_whole_map_unmarked(markVertices) );
-
-  for(std::size_t i = 0; i < vertices.size(); i++)
-  {
-    CGAL::remove_cell<LCC,0>(*scene.lcc, vertices[i],
-                             sierpinskiCarpetUpdateAttributes);
-  }
-  vertices.clear();
-
-  (scene.lcc)->free_mark(markSurfaces);
-  (scene.lcc)->free_mark(markVertices);
-
-  if (!sierpinskiCarpetUpdateAttributes)
-  {
-    scene.lcc->correct_invalid_attributes();
-  }
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  timer.stop();
-  std::cout<<"Sierpinski carpet "
-           <<this->sierpinskiCarpetLevel+1<<" -> "
-          <<this->sierpinskiCarpetLevel<<", "
-         <<"attributes updated "
-        <<(sierpinskiCarpetUpdateAttributes ? "DURING" : "AFTER")
-       << " construction: "
-       <<timer.time()<<" seconds."<<std::endl;
-#endif
-
-  recreate_whole_volume_list();
-  QApplication::restoreOverrideCursor ();
-
-  statusBar()->showMessage(QString ("Sierpinski carpet creation %1 -> %2").
-                           arg(this->sierpinskiCarpetLevel+1).
-                           arg(this->sierpinskiCarpetLevel),
-                           DELAY_STATUSMSG);
-  Q_EMIT( sceneChanged());
-}
-
-///////////////////////////////////////////////////////////////////////////////////
-// SIERPINSKI TRIANGLE
-///////////////////////////////////////////////////////////////////////////////////
-void MainWindow::on_actionCreate_Sierpinski_Triangle_triggered ()
-{
-  sierpinskiTriangleUpdateAttributes
-    = dialogsierpinskitriangle.updateAttributes->isChecked();
-
-  dialogsierpinskitriangle.level->disconnect(this);
-
-  dialogsierpinskitriangle.level->setValue(0);
-  sierpinskiTriangleLevel=0;
-  CGAL_assertion( sierpinskiTriangleSurfaces.empty() );
-
-  CGAL_assertion( removedTriangles.empty() );
-
-  Point_3 basepoint(nbcube%5, (nbcube/5)%5, nbcube/25);
-
-  Dart_handle d = scene.lcc->make_triangle(basepoint,
-                                           LCC::Traits::Construct_translated_point()
-                                           (basepoint,LCC::Traits::Vector(1,0,0)),
-                                           LCC::Traits::Construct_translated_point()
-                                           (basepoint,LCC::Traits::Vector(0.5f,CGAL::sqrt(3.f)/2.f,0)));
-
-  on_new_volume(d);
-
-  ++nbcube;
-
-  statusBar ()->showMessage (QString ("Triangle created"),DELAY_STATUSMSG);
-
-  Q_EMIT (sceneChanged ());
-
-  sierpinskiTriangleSurfaces.push_back(d);
-  update_operations_entries(false);
-
-  QObject::connect(dialogsierpinskitriangle.level, SIGNAL(valueChanged(int)),
-                   this, SLOT(onSierpinskiTriangleChangeLevel(int)));
-
-  dialogsierpinskitriangle.show();
-}
-
-void MainWindow::onSierpinskiTriangleCancel()
-{
-  for(std::vector<Dart_handle>::iterator it=sierpinskiTriangleSurfaces.begin();
-      it!=sierpinskiTriangleSurfaces.end(); ++it)
-  {
-    CGAL::remove_cell<LCC,2>(*scene.lcc, *it);
-  }
-
-  recreate_whole_volume_list();
-  sierpinskiTriangleSurfaces.clear();
-  update_operations_entries(true);
-  Q_EMIT( sceneChanged());
-}
-
-void MainWindow::onSierpinskiTriangleOk()
-{
-  update_operations_entries(true);
-  sierpinskiTriangleSurfaces.clear();
-}
-
-void MainWindow::onSierpinskiTriangleChangeLevel(int newLevel)
-{
-  while ( newLevel > sierpinskiTriangleLevel ) onSierpinskiTriangleInc();
-  while ( newLevel < sierpinskiTriangleLevel ) onSierpinskiTriangleDec();
-}
-
-void MainWindow::onSierpinskiTriangleUpdateAttributes(bool newValue)
-{
-  sierpinskiTriangleUpdateAttributes = newValue;
-}
-
-void MainWindow::onSierpinskiTriangleInc()
-{
-  QApplication::setOverrideCursor (Qt::WaitCursor);
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  CGAL::Timer timer;
-  timer.start();
-#endif
-
-  this->sierpinskiTriangleLevel++;
-
-  std::vector<Dart_handle> edges;
-  nbfacesinit = sierpinskiTriangleSurfaces.size();
-
-  LCC::size_type markEdges = (scene.lcc)->get_new_mark();
-  LCC::size_type markFaces = (scene.lcc)->get_new_mark();
-
-  for(std::vector<Dart_handle>::iterator itfaces=sierpinskiTriangleSurfaces.begin();
-        itfaces!=sierpinskiTriangleSurfaces.end(); ++itfaces)
-  {
-    CGAL_assertion( !(scene.lcc)->is_marked(*itfaces, markFaces) );
-    for (LCC::Dart_of_cell_basic_range<2>::iterator
-         it=(scene.lcc)->darts_of_cell_basic<2>(*itfaces, markFaces).begin(),
-         itend=(scene.lcc)->darts_of_cell_basic<2>(*itfaces, markFaces).end();
-         it!=itend; ++it)
-    {
-      if ( !(scene.lcc)->is_marked(it, markEdges) )
-      {
-        edges.push_back(it);
-        CGAL::mark_cell<LCC,1>(*(scene.lcc), it, markEdges);
-      }
-    }
-  }
-
-  (scene.lcc)->negate_mark(markFaces);
-  for(std::vector<Dart_handle>::iterator itfaces=sierpinskiTriangleSurfaces.begin();
-        itfaces!=sierpinskiTriangleSurfaces.end(); ++itfaces)
-  {
-    for (LCC::Dart_of_cell_basic_range<2>::iterator
-         it=(scene.lcc)->darts_of_cell_basic<2>(*itfaces, markFaces).begin(),
-         itend=(scene.lcc)->darts_of_cell_basic<2>(*itfaces, markFaces).end();
-         it!=itend; ++it)
-    {
-      (scene.lcc)->unmark(it, markEdges);
-    }
-  }
-
-  (scene.lcc)->negate_mark(markFaces);
-  CGAL_assertion( (scene.lcc)->is_whole_map_unmarked(markFaces) );
-  CGAL_assertion( (scene.lcc)->is_whole_map_unmarked(markEdges) );
-
-  (scene.lcc)->free_mark(markEdges);
-  (scene.lcc)->free_mark(markFaces);
-
-  for(std::size_t i = 0; i < edges.size(); i++)
-  {
-    sierpinski_triangle_split_edge_in_two(edges[i]);
-  }
-  edges.clear();
-
-  for(std::size_t i = 0; i < nbfacesinit; i++)
-  {
-    sierpinski_triangle_split_face_in_four(sierpinskiTriangleSurfaces[i],true);
-  }
-
-  if (!sierpinskiTriangleUpdateAttributes)
-  {
-    for(std::size_t i = nbfacesinit; i < sierpinskiTriangleSurfaces.size(); i++)
-    {
-      LCC::Attribute_handle<3>::type ah = (scene.lcc)->create_attribute<3>();
-        CGAL::Set_i_attribute_functor<LCC, 3>::
-            run(scene.lcc, sierpinskiTriangleSurfaces[i], ah);
-        scene.lcc->info<3>(sierpinskiTriangleSurfaces[i]).color()=
-          (CGAL::Color(myrandom.get_int(0,256),
-                       myrandom.get_int(0,256),
-                       myrandom.get_int(0,256)));
-
-        update_volume_list_add(scene.lcc->attribute<3>(sierpinskiTriangleSurfaces[i]));
-    }
-
-    scene.lcc->correct_invalid_attributes();
-  }
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  timer.stop();
-  std::cout<<"Sierpinski triangle "
-           <<this->sierpinskiTriangleLevel-1<<" -> "
-          <<this->sierpinskiTriangleLevel<<", "
-         <<"attributes updated "
-        <<(sierpinskiTriangleUpdateAttributes ? "DURING" : "AFTER")
-       << " construction: "
-       <<timer.time()<<" seconds."<<std::endl;
-#endif
-
-  //CGAL_assertion( (scene.lcc)->is_valid() );
-  statusBar()->showMessage(QString ("Sierpinski triangle creation %1 -> %2").
-                           arg(this->sierpinskiTriangleLevel-1).
-                           arg(this->sierpinskiTriangleLevel),
-                           DELAY_STATUSMSG);
-  QApplication::restoreOverrideCursor ();
-
-  Q_EMIT( sceneChanged());
-}
-
-void MainWindow::sierpinski_triangle_split_edge_in_two(Dart_handle dh)
-{
-  LCC::Point p1 = scene.lcc->point(dh);
-  LCC::Point p2 = scene.lcc->point(scene.lcc->other_extremity(dh));
-
-  LCC::Vector v1 = LCC::Traits::Construct_vector() (p1,p2);
-  LCC::Vector v2 = LCC::Traits::Construct_scaled_vector() (v1,1.0/2);
-
-  LCC::Point p3 = LCC::Traits::Construct_translated_point() (p1,v2);
-
-  (scene.lcc)->insert_point_in_cell<1>(dh,p3,sierpinskiTriangleUpdateAttributes);
-}
-
-void MainWindow::sierpinski_triangle_split_face_in_four(Dart_handle dh, bool removecenter)
-{
-  Dart_handle d1=
-  CGAL::insert_cell_1_in_cell_2(*(scene.lcc),
-                                scene.lcc->beta(dh,1),
-                                scene.lcc->beta(dh,1,1,1),
-                                sierpinskiTriangleUpdateAttributes);
-
-  Dart_handle d2=
-  CGAL::insert_cell_1_in_cell_2(*(scene.lcc),
-                                scene.lcc->beta(d1,2,1),
-                                scene.lcc->beta(d1,2,1,1,1),
-                                sierpinskiTriangleUpdateAttributes);
-
-  Dart_handle d3=
-  CGAL::insert_cell_1_in_cell_2(*(scene.lcc),
-                                scene.lcc->beta(d2,2,1),
-                                scene.lcc->beta(d2,2,1,1,1),
-                                sierpinskiTriangleUpdateAttributes);
-  if ( removecenter )
-  {
-    Triplet <Dart_handle, Dart_handle, Dart_handle> triplet(d1,d2,d3);
-    removedTriangles.push_back(triplet);
-
-    // at this step, the map is correctly 0-embedded, any other attribute is set
-    //  (call of insert_point_in_cell<1> with update_attributes set to true)
-
-    CGAL::remove_cell<LCC,2>(*scene.lcc,scene.lcc->beta(d3,2),sierpinskiTriangleUpdateAttributes);
-
-    if (sierpinskiTriangleUpdateAttributes)
-    {
-      update_volume_list_add(scene.lcc->attribute<3>(scene.lcc->beta(d2,0)));
-      update_volume_list_add(scene.lcc->attribute<3>(scene.lcc->beta(d1,0)));
-    }
-    else
-    {
-      // we dupplicate all 0-embeddings to set them to the splitted vertices
-      (scene.lcc)->set_dart_attribute<0>(scene.lcc->beta(d2,1),(scene.lcc)->create_vertex_attribute(scene.lcc->point(d1)));
-      (scene.lcc)->set_dart_attribute<0>(scene.lcc->beta(d3,1),(scene.lcc)->create_vertex_attribute(scene.lcc->point(d2)));
-      (scene.lcc)->set_dart_attribute<0>(scene.lcc->beta(d1,1),(scene.lcc)->create_vertex_attribute(scene.lcc->point(d3)));
-    }
-  }
-  else
-  {
-    sierpinskiTriangleSurfaces.push_back(scene.lcc->beta(d3,2));
-  }
-
-  sierpinskiTriangleSurfaces.push_back(scene.lcc->beta(d2,0));
-  sierpinskiTriangleSurfaces.push_back(scene.lcc->beta(d1,0));
-}
-
-void MainWindow::onSierpinskiTriangleDec()
-{
-  QApplication::setOverrideCursor( Qt::WaitCursor );
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  CGAL::Timer timer;
-  timer.start();
-#endif
-
-  this->sierpinskiTriangleLevel--;
-
-  int nbt = CGAL::ipower(3,this->sierpinskiTriangleLevel);
-
-  // First we add triangles removed during construction process
-  for ( std::size_t i = removedTriangles.size() - nbt; i < removedTriangles.size(); i++)
-  {
-    Dart_handle d1 = scene.lcc->create_dart();
-    Dart_handle d2 = scene.lcc->create_dart();
-    Dart_handle d3 = scene.lcc->create_dart();
-    scene.lcc->sew<1>(d1,d2);
-    scene.lcc->sew<1>(d2,d3);
-    scene.lcc->sew<1>(d3,d1);
-    scene.lcc->sew<2>(d1, removedTriangles[i].first);
-    scene.lcc->sew<2>(d2, removedTriangles[i].second);
-    scene.lcc->sew<2>(d3, removedTriangles[i].third);
-  }
-
-  removedTriangles.resize(removedTriangles.size() - nbt);
-
-  // We know here the number of Sierpinski surfaces: 3^sierpinskiTriangleLevel
-  // thus we can directly "cut" the std::vector to the correct size.
-  sierpinskiTriangleSurfaces.resize(CGAL::ipower(3,sierpinskiTriangleLevel));
-
-  LCC::size_type markSurfaces = (scene.lcc)->get_new_mark();
-  LCC::size_type markVertices = (scene.lcc)->get_new_mark();
-
-  std::vector<Dart_handle> edges;
-  std::vector<Dart_handle> vertices;
-
-  // Now we remove edges.
-  for ( std::vector<Dart_handle>::iterator
-        itsurfaces=sierpinskiTriangleSurfaces.begin();
-        itsurfaces!=sierpinskiTriangleSurfaces.end(); ++itsurfaces)
-  {
-    Dart_handle dh = *itsurfaces;
-    dh = scene.lcc->beta(dh,1);
-    edges.push_back(dh);
-    dh = scene.lcc->beta(dh,2,1,2);
-    edges.push_back(dh);
-    dh = scene.lcc->beta(dh,2,1,2);
-    edges.push_back(dh);
-  }
-
-  for(std::size_t i = 0; i < edges.size(); i++)
-  {
-    CGAL::remove_cell<LCC,1>(*scene.lcc, edges[i],
-                             sierpinskiTriangleUpdateAttributes);
-  }
-  edges.clear();
-
-  // Lastly we remove vertices.
-  for ( std::vector<Dart_handle>::iterator
-        itsurfaces=sierpinskiTriangleSurfaces.begin();
-        itsurfaces!=sierpinskiTriangleSurfaces.end(); ++itsurfaces)
-  {
-    Dart_handle dh = scene.lcc->beta(*itsurfaces,1);
-    if ( !(scene.lcc)->is_marked(dh, markVertices) )
-    {
-      vertices.push_back(dh);
-      CGAL::mark_cell<LCC, 0>(*scene.lcc, dh, markVertices);
-    }
-    dh = scene.lcc->beta(dh,1,1);
-    if ( !(scene.lcc)->is_marked(dh, markVertices) )
-    {
-      vertices.push_back(dh);
-      CGAL::mark_cell<LCC, 0>(*scene.lcc, dh, markVertices);
-    }
-    dh = scene.lcc->beta(dh,1,1);
-    if ( !(scene.lcc)->is_marked(dh, markVertices) )
-    {
-      vertices.push_back(dh);
-      CGAL::mark_cell<LCC, 0>(*scene.lcc, dh, markVertices);
-    }
-  }
-
-  (scene.lcc)->negate_mark(markSurfaces);
-  for ( std::vector<Dart_handle>::iterator
-        itsurfaces=sierpinskiTriangleSurfaces.begin();
-        itsurfaces!=sierpinskiTriangleSurfaces.end(); ++itsurfaces)
-  {
-    Dart_handle dh = scene.lcc->beta(*itsurfaces,1);
-    if ( (scene.lcc)->is_marked(dh, markVertices) )
-      CGAL::unmark_cell<LCC, 0>(*scene.lcc, dh, markVertices);
-    dh = scene.lcc->beta(dh,1,1);
-    if ( (scene.lcc)->is_marked(dh, markVertices) )
-      CGAL::unmark_cell<LCC, 0>(*scene.lcc, dh, markVertices);
-    dh = scene.lcc->beta(dh,1,1);
-    if ( (scene.lcc)->is_marked(dh, markVertices) )
-      CGAL::unmark_cell<LCC, 0>(*scene.lcc, dh, markVertices);
-  }
-
-  (scene.lcc)->negate_mark(markSurfaces);
-  CGAL_assertion( (scene.lcc)->is_whole_map_unmarked(markSurfaces) );
-  CGAL_assertion( (scene.lcc)->is_whole_map_unmarked(markVertices) );
-
-  for(std::size_t i = 0; i < vertices.size(); i++)
-  {
-    CGAL::remove_cell<LCC,0>(*scene.lcc, vertices[i],
-                             sierpinskiTriangleUpdateAttributes);
-  }
-  vertices.clear();
-
-  (scene.lcc)->free_mark(markSurfaces);
-  (scene.lcc)->free_mark(markVertices);
-
-  if (!sierpinskiTriangleUpdateAttributes)
-  {
-    scene.lcc->correct_invalid_attributes();
-  }
-
-#ifdef CGAL_PROFILE_LCC_DEMO
-  timer.stop();
-  std::cout<<"Sierpinski triangle "
-           <<this->sierpinskiTriangleLevel+1<<" -> "
-          <<this->sierpinskiTriangleLevel<<", "
-         <<"attributes updated "
-        <<(sierpinskiTriangleUpdateAttributes ? "DURING" : "AFTER")
-       << " construction: "
-       <<timer.time()<<" seconds."<<std::endl;
-#endif
-
-  recreate_whole_volume_list();
-  statusBar()->showMessage(QString ("Sierpinski triangle creation %1 -> %2").
-                           arg(this->sierpinskiTriangleLevel+1).
-                           arg(this->sierpinskiTriangleLevel),
-                           DELAY_STATUSMSG);
-  QApplication::restoreOverrideCursor ();
-
-  Q_EMIT( sceneChanged());
-}
-
-#undef DELAY_STATUSMSG
diff --git a/3rdparty/CGAL-4.8/demo/Linear_cell_complex/typedefs.h b/3rdparty/CGAL-4.8/demo/Linear_cell_complex/typedefs.h
deleted file mode 100644
index 3a84e9f..0000000
--- a/3rdparty/CGAL-4.8/demo/Linear_cell_complex/typedefs.h
+++ /dev/null
@@ -1,205 +0,0 @@
-// Copyright (c) 2011 CNRS and LIRIS' Establishments (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Guillaume Damiand <guillaume.damiand at liris.cnrs.fr>
-//
-#ifndef TYPEDEFS_H
-#define TYPEDEFS_H
-
-#include <CGAL/Linear_cell_complex.h>
-#include <CGAL/Linear_cell_complex_constructors.h>
-#include <CGAL/Linear_cell_complex_operations.h>
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-#include <CGAL/Combinatorial_map_save_load.h>
-
-#include <CGAL/Triangulation_2_filtered_projection_traits_3.h>
-#include <CGAL/Triangulation_vertex_base_with_info_2.h>
-#include <CGAL/Triangulation_face_base_with_info_2.h>
-#include <CGAL/Constrained_Delaunay_triangulation_2.h>
-#include <CGAL/Constrained_triangulation_plus_2.h>
-
-#include <CGAL/IO/Color.h>
-#include <CGAL/Timer.h>
-#include <CGAL/Random.h>
-
-#include <cstdio>
-#include <cstring>
-#include <iostream>
-#include <fstream>
-#include <vector>
-#include <list>
-
-// Global random
-extern CGAL::Random myrandom;
-
-// Use to define properties on volumes.
-#define LCC_DEMO_VISIBLE 1 // if not visible => hidden
-#define LCC_DEMO_FILLED  2 // if not filled, wireframe
-
-class Volume_info
-{
-  friend void CGAL::read_cmap_attribute_node<Volume_info>
-  (const boost::property_tree::ptree::value_type &v,Volume_info &val);
-
-  friend void CGAL::write_cmap_attribute_node<Volume_info>(boost::property_tree::ptree & node,
-                                                           const Volume_info& arg);
-public:
-  Volume_info() : m_color(CGAL::Color(myrandom.get_int(0,256),
-                                      myrandom.get_int(0,256),
-                                      myrandom.get_int(0,256))),
-    m_status( LCC_DEMO_VISIBLE | LCC_DEMO_FILLED )
-  {}
-
-  CGAL::Color& color()
-  { return m_color; }
-  const CGAL::Color& color() const
-  { return m_color; }
-
-  std::string color_name() const
-  {
-    std::ostringstream ss;
-    ss<<std::setfill('0');
-    ss<<"#"<<std::hex<<std::setw(2)<<(int)m_color.red()
-     <<std::setw(2)<<(int)m_color.green()<<std::setw(2)<<(int)m_color.blue();
-    return ss.str();
-  }
-
-  bool is_visible() const
-  { return (m_status & LCC_DEMO_VISIBLE)!=0; }
-  bool is_filled() const
-  { return (m_status & LCC_DEMO_FILLED)!=0; }
-  bool is_filled_and_visible() const
-  { return is_filled() && is_visible(); }
-
-  void set_visible(bool val=true)
-  {
-    if ( is_visible()==val ) return;
-    if ( val ) m_status = m_status | LCC_DEMO_VISIBLE;
-    else       m_status = m_status ^ LCC_DEMO_VISIBLE;
-  }
-  void set_filled(bool val=true)
-  {
-    if ( is_filled()==val ) return;
-    if ( val ) m_status = m_status | LCC_DEMO_FILLED;
-    else       m_status = m_status ^ LCC_DEMO_FILLED;
-  }
-
-  void negate_visible()
-  { set_visible(!is_visible()); }
-  void negate_filled()
-  { set_filled(!is_filled()); }
-
-private:
-  CGAL::Color m_color;
-  char        m_status;
-};
-
-namespace CGAL
-{
-
-template<>
-inline void read_cmap_attribute_node<Volume_info>
-(const boost::property_tree::ptree::value_type &v,Volume_info &val)
-{
-  try
-  {
-    val.m_status = v.second.get<int>("status");
-  }
-  catch(const std::exception &  )
-  {}
-
-  try
-  {
-    char r = v.second.get<int>("color-r");
-    char g = v.second.get<int>("color-g");
-    char b = v.second.get<int>("color-b");
-    val.m_color = CGAL::Color(r,g,b);
-  }
-  catch(const std::exception &  )
-  {}
-}
-
-// Definition of function allowing to save custon information.
-template<>
-inline void write_cmap_attribute_node<Volume_info>(boost::property_tree::ptree & node,
-                                                   const Volume_info& arg)
-{
-  boost::property_tree::ptree & nValue = node.add("v","");
-  nValue.add("status",(int)arg.m_status);
-  nValue.add("color-r",(int)arg.m_color.r());
-  nValue.add("color-g",(int)arg.m_color.g());
-  nValue.add("color-b",(int)arg.m_color.b());
-}
-
-}
-
-class Myitems
-{
-public:
-  template < class Refs >
-  struct Dart_wrapper
-  {
-    typedef CGAL::Dart<3, Refs > Dart;
-
-    typedef CGAL::Cell_attribute_with_point< Refs > Vertex_attrib;
-    typedef CGAL::Cell_attribute< Refs, Volume_info> Volume_attrib;
-
-    typedef CGAL::cpp11::tuple<Vertex_attrib,void,void,
-                               Volume_attrib> Attributes;
-  };
-};
-
-typedef CGAL::Linear_cell_complex_traits
-<3,CGAL::Exact_predicates_inexact_constructions_kernel> Mytraits;
-
-typedef CGAL::Linear_cell_complex<3,3,Mytraits,Myitems> LCC;
-typedef LCC::Dart_handle      Dart_handle;
-typedef LCC::Vertex_attribute Vertex;
-
-typedef LCC::Point    Point_3;
-typedef LCC::Vector   Vector_3;
-
-typedef CGAL::Timer Timer;
-
-struct Vertex_info
-{
-  Dart_handle dh;
-  Vector_3 v;
-};
-
-struct Face_info {
-  bool exist_edge[3];
-  bool is_external;
-  bool is_process;
-};
-
-typedef CGAL::Triangulation_2_filtered_projection_traits_3<Mytraits> P_traits;
-typedef CGAL::Triangulation_vertex_base_with_info_2<Vertex_info, P_traits> Vb;
-
-typedef CGAL::Triangulation_face_base_with_info_2<Face_info,P_traits> Fb1;
-
-typedef CGAL::Constrained_triangulation_face_base_2<P_traits, Fb1>    Fb;
-typedef CGAL::Triangulation_data_structure_2<Vb,Fb>                   TDS;
-typedef CGAL::No_intersection_tag                                     Itag;
-typedef CGAL::Constrained_Delaunay_triangulation_2<P_traits, TDS,
-                                                   Itag>              CDT;
-
-struct Scene {
-  LCC* lcc;
-};
-
-#endif
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_2/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Mesh_2/CMakeLists.txt
deleted file mode 100644
index fed9dbb..0000000
--- a/3rdparty/CGAL-4.8/demo/Mesh_2/CMakeLists.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-# Created by the script cgal_create_cmake_script (and then adapted manually).
-# This is the CMake script for compiling a CGAL application.
-
-project( mesh_2_demo )
-
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
- 
-find_package(CGAL COMPONENTS Core )
-include( ${CGAL_USE_FILE} )
-
-include_directories(BEFORE ../../include)
-include_directories(BEFORE ../../../Triangulation_2/include)
-
-
-if ( CGAL_FOUND )
-
-  # conform target
-  add_executable  (conform conform.cpp)
-  target_link_libraries(conform ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} )
-  add_to_cached_list( CGAL_EXECUTABLE_TARGETS conform )
-
-  # mesh target
-  add_executable  (mesh mesh.cpp)
-  target_link_libraries(mesh ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} )
-  add_to_cached_list( CGAL_EXECUTABLE_TARGETS mesh )
-
-else()
-
-  message(STATUS "NOTICE: This demo requires CGAL and will not be compiled.")
-
-endif()
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Mesh_3/CMakeLists.txt
deleted file mode 100644
index c292d33..0000000
--- a/3rdparty/CGAL-4.8/demo/Mesh_3/CMakeLists.txt
+++ /dev/null
@@ -1,393 +0,0 @@
-# This is the CMake script for compiling the CGAL Mesh_3 demo.
-
-project( Mesh_3_demo )
-
-# Find includes in corresponding build directories
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-# Instruct CMake to run moc automatically when needed.
-set(CMAKE_AUTOMOC ON)
-
-
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-# Compatibility with CMake 3.0
-if(POLICY CMP0042)
-  # Do not enable the use of MACOSX_RPATH
-  # http://www.cmake.org/cmake/help/v3.0/policy/CMP0042.html
-  cmake_policy(SET CMP0042 OLD)
-endif()
-
-
-# Creates a new CMake option, turned ON by default
-option(ACTIVATE_MSVC_PRECOMPILED_HEADERS
-  "Activate precompiled headers in MSVC"
-  OFF)
-
-# Macro to add precompiled headers for MSVC
-# This function does two things:
-# 1. Enable precompiled headers on each file which is listed in "SourcesVar".
-# 2. Add the content of "PrecompiledSource" (e.g. "StdAfx.cpp") to "SourcesVar".
-MACRO(ADD_MSVC_PRECOMPILED_HEADER PrecompiledHeader PrecompiledSource SourcesVar)
-  IF(MSVC AND ACTIVATE_MSVC_PRECOMPILED_HEADERS)
-    GET_FILENAME_COMPONENT(PrecompiledBasename ${PrecompiledHeader} NAME_WE)
-    SET(Sources ${${SourcesVar}})
-
-    SET_SOURCE_FILES_PROPERTIES(${PrecompiledSource}
-                                PROPERTIES COMPILE_FLAGS "/Yc\"${PrecompiledHeader}\"")
-    SET_SOURCE_FILES_PROPERTIES(${Sources}
-                                PROPERTIES COMPILE_FLAGS "/Yu\"${PrecompiledHeaders}\" /FI\"${PrecompiledHeader}\"")
-    # Add precompiled header to SourcesVar
-    LIST(APPEND ${SourcesVar} ${PrecompiledSource})
-  ENDIF(MSVC AND ACTIVATE_MSVC_PRECOMPILED_HEADERS)
-ENDMACRO(ADD_MSVC_PRECOMPILED_HEADER)
-# The compiler might need more memory because of precompiled headers
-if(MSVC AND ACTIVATE_MSVC_PRECOMPILED_HEADERS AND NOT(MSVC_VERSION LESS 1310))
-  set(CGAL_C_FLAGS "${CGAL_C_FLAGS} /Zm1000")
-  set(CGAL_CXX_FLAGS "${CGAL_CXX_FLAGS} /Zm1000")
-endif()
-
-# Let plugins be compiled in the same directory as the executable.
-set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
-
-#option(MESH_3_DEMO_ENABLE_FORWARD_DECL "In the Mesh_3 demo, enable " OFF)
-#mark_as_advanced(MESH_3_DEMO_ENABLE_FORWARD_DECL)
-
-# Include this package's headers first
-include_directories( BEFORE ./ ./include ../../include )
-
-# Disable deprecated Mesh_3 names
-add_definitions(-DCGAL_MESH_3_NO_DEPRECATED_SURFACE_INDEX
-                -DCGAL_MESH_3_NO_DEPRECATED_C3T3_ITERATORS)
-
-# Add specific Find.cmake modules
-set(CMAKE_MODULE_PATH 
-  ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
-
-# Activate concurrency ? (turned OFF by default)
-option(ACTIVATE_CONCURRENT_MESH_3
-  "Activate parallelism in Mesh_3"
-  OFF)
-  
-# Find CGAL and CGAL Qt5
-find_package(CGAL COMPONENTS Qt5 ImageIO)
-include( ${CGAL_USE_FILE} )
-# And add -DCGAL_CONCURRENT_MESH_3 if that option is ON
-if( ACTIVATE_CONCURRENT_MESH_3 )
-  add_definitions( -DCGAL_CONCURRENT_MESH_3 )
-  find_package( TBB REQUIRED )
-else( ACTIVATE_CONCURRENT_MESH_3 )
-  option( LINK_WITH_TBB
-    "Link with TBB anyway so we can use TBB timers for profiling"
-    ON)
-  if( LINK_WITH_TBB )
-    find_package( TBB )
-  endif( LINK_WITH_TBB )
-endif()
-
-if( TBB_FOUND )
-  include(${TBB_USE_FILE})
-endif()
-
-# Find Qt5 itself
-find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL)
-
-# Find OpenGL
-find_package(OpenGL)
-
-# Find everybodies darling
-find_package(Boost COMPONENTS thread system)
-
-# Find QGLViewer
-
-if(Qt5_FOUND)
-
- add_definitions(-DQT_NO_KEYWORDS)
- add_definitions(-DSCENE_SEGMENTED_IMAGE_GL_BUFFERS_AVAILABLE)
-
- find_package(QGLViewer )
-endif(Qt5_FOUND)
-
-
-if(CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND AND Boost_FOUND)
-
-  # Add directory containing implicit function plugin source files
-  add_subdirectory("implicit_functions")
-
-  include_directories ( ${QGLVIEWER_INCLUDE_DIR} )
-
-  qt5_wrap_ui( UI_FILES ui_files/MainWindow.ui )
-  qt5_wrap_ui( meshingUI_FILES  ui_files/Meshing_dialog.ui)
-  qt5_wrap_ui( optimUI_FILES  ui_files/Smoother_dialog.ui ui_files/LocalOptim_dialog.ui)
-  qt5_wrap_ui( ribUI_FILES  ui_files/Rib_dialog.ui)
-  qt5_wrap_ui( funcUI_FILES  ui_files/Function_dialog.ui)
-  qt5_wrap_ui( imgUI_FILES ui_files/Image_res_dialog.ui)
-
-  include(AddFileDependencies)
-
-  # Shared demo files directory
-  set(DEMO_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/CGAL_demo")
-  set(DEMO_H_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/CGAL_demo")
-
-  qt5_generate_moc( "MainWindow.h" "${CMAKE_CURRENT_BINARY_DIR}/MainWindow_moc.cpp" )
-  add_file_dependencies( MainWindow_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/MainWindow.h" )
-
-  qt5_generate_moc( "${DEMO_H_DIR}/Viewer.h" Viewer_moc.cpp )
-  add_file_dependencies( Viewer_moc.cpp "${DEMO_H_DIR}/Viewer.h" )
-
-  qt5_generate_moc( "${DEMO_H_DIR}/Scene.h" Scene_moc.cpp )
-  add_file_dependencies( Scene_moc.cpp "${DEMO_H_DIR}/Scene.h" )
-
-  qt5_generate_moc( "${DEMO_H_DIR}/Scene_item.h" Scene_item_moc.cpp )
-  add_file_dependencies( Scene_item_moc.cpp "${DEMO_H_DIR}/Scene_item.h" )
-
-  qt5_wrap_cpp( VOLUME_MOC_OUTFILES ${CMAKE_CURRENT_SOURCE_DIR}/Volume_plane_thread.h )
-  qt5_wrap_cpp( VOLUME_MOC_OUTFILES ${CMAKE_CURRENT_SOURCE_DIR}/Volume_plane_interface.h )
-
-  qt5_add_resources ( RESOURCE_FILES Mesh_3.qrc )
-
-  # put plugins (which are shared libraries) at the same location as
-  # executable files
-  set(LIBRARY_OUTPUT_PATH ${RUNTIME_OUTPUT_PATH})
-
-  # prefix for Mesh_3 libs to avoid conflicts with Polyhedron demo
-  set(MESH_3_LIB_PREFIX "mesh_3_demo_")
-
-  # AUXILIARY LIBRARIES
-  set(VIEWER_LIB "${MESH_3_LIB_PREFIX}viewer")
-  add_library(${VIEWER_LIB} SHARED
-    ${DEMO_SRC_DIR}/Viewer.cpp Viewer_moc.cpp)
-  qt5_use_modules(${VIEWER_LIB} Xml Script OpenGL Svg)
-  target_link_libraries(${VIEWER_LIB} ${QGLVIEWER_LIBRARIES} ${QT_LIBRARIES} ${OPENGL_LIBRARIES})
-  set_target_properties(${VIEWER_LIB} PROPERTIES DEFINE_SYMBOL viewer_EXPORTS)
-
-  set(SCENE_ITEM_LIB "${MESH_3_LIB_PREFIX}scene_item")
-  add_library(${SCENE_ITEM_LIB} SHARED
-    ${DEMO_SRC_DIR}/Scene_item.cpp
-    Scene_item_moc.cpp
-    ${DEMO_SRC_DIR}/Plugin_helper.cpp)
-  qt5_use_modules(${SCENE_ITEM_LIB} Xml Script OpenGL Svg)
-  set_target_properties(${SCENE_ITEM_LIB} PROPERTIES DEFINE_SYMBOL scene_item_EXPORTS)
-  target_link_libraries(${SCENE_ITEM_LIB} ${QT_LIBRARIES} ${OPENGL_LIBRARIES})
-
-  set(SCENE_SEGMENTED_IMAGE_ITEM_LIB "${MESH_3_LIB_PREFIX}scene_segmented_image_item")
-  add_library(${SCENE_SEGMENTED_IMAGE_ITEM_LIB} SHARED
-    Scene_segmented_image_item.cpp)
-  qt5_use_modules(${SCENE_SEGMENTED_IMAGE_ITEM_LIB} Xml Script OpenGL Svg)
-  target_link_libraries(${SCENE_SEGMENTED_IMAGE_ITEM_LIB} ${SCENE_ITEM_LIB} ${QGLVIEWER_LIBRARIES} ${CGAL_LIBRARIES} ${TBB_LIBRARIES})
-  set_target_properties(${SCENE_SEGMENTED_IMAGE_ITEM_LIB} PROPERTIES DEFINE_SYMBOL scene_segmented_image_item_EXPORTS)
-
-  set(SCENE_POLYHEDRON_ITEM_LIB "${MESH_3_LIB_PREFIX}scene_polyhedron_item")
-  add_library(${SCENE_POLYHEDRON_ITEM_LIB} SHARED
-    Scene_polyhedron_item.cpp )
-  qt5_use_modules(${SCENE_POLYHEDRON_ITEM_LIB} Xml Script OpenGL Svg)
-  target_link_libraries(${SCENE_POLYHEDRON_ITEM_LIB} ${SCENE_ITEM_LIB}  ${QGLVIEWER_LIBRARIES} ${CGAL_LIBRARIES} ${TBB_LIBRARIES})
-  set_target_properties(${SCENE_POLYHEDRON_ITEM_LIB} PROPERTIES DEFINE_SYMBOL scene_polyhedron_item_EXPORTS)
-
-  set(POLYGON_SOUP_LIB "${MESH_3_LIB_PREFIX}polygon_soup")
-  add_library(${POLYGON_SOUP_LIB} SHARED
-    Scene_polygon_soup.cpp )
-  qt5_use_modules(${POLYGON_SOUP_LIB} Xml Script OpenGL Svg)
-  target_link_libraries(${POLYGON_SOUP_LIB} ${SCENE_ITEM_LIB}  ${QGLVIEWER_LIBRARIES} ${CGAL_LIBRARIES} ${TBB_LIBRARIES})
-  set_target_properties(${POLYGON_SOUP_LIB} PROPERTIES DEFINE_SYMBOL polygon_soup_EXPORTS)
-
-  set(SCENE_C3T3_ITEM_LIB "${MESH_3_LIB_PREFIX}scene_c3t3_item")
-  set (SCENE_C3T3_ITEM_LIB_SOURCE_FILES Scene_c3t3_item.cpp)
-  ADD_MSVC_PRECOMPILED_HEADER("StdAfx.h" "StdAfx.cpp" SCENE_C3T3_ITEM_LIB_SOURCE_FILES)
-
-  add_library(${SCENE_C3T3_ITEM_LIB} SHARED
-    ${SCENE_C3T3_ITEM_LIB_SOURCE_FILES})
-  qt5_use_modules(${SCENE_C3T3_ITEM_LIB} Xml Script OpenGL Svg)
-  target_link_libraries(${SCENE_C3T3_ITEM_LIB} ${SCENE_ITEM_LIB} ${QGLVIEWER_LIBRARIES} ${QT_LIBRARIES} ${CGAL_LIBRARIES} ${Boost_LIBRARIES} ${TBB_LIBRARIES})
-  set_target_properties(${SCENE_C3T3_ITEM_LIB} PROPERTIES DEFINE_SYMBOL scene_c3t3_item_EXPORTS)
-
-  set(SCENE_IMPLICIT_FUNCTION_ITEM_LIB "${MESH_3_LIB_PREFIX}scene_implicit_function_item")
-  add_library(${SCENE_IMPLICIT_FUNCTION_ITEM_LIB} SHARED
-    Scene_implicit_function_item.cpp Color_ramp.cpp)
-  qt5_use_modules(${SCENE_IMPLICIT_FUNCTION_ITEM_LIB} Xml Script OpenGL Svg)
-  target_link_libraries(${SCENE_IMPLICIT_FUNCTION_ITEM_LIB} ${SCENE_ITEM_LIB} ${QGLVIEWER_LIBRARIES} ${QT_LIBRARIES} ${TBB_LIBRARIES})
-  set_target_properties(${SCENE_IMPLICIT_FUNCTION_ITEM_LIB} PROPERTIES DEFINE_SYMBOL scene_implicit_function_item_EXPORTS)
-
-  
-  add_definitions(-DUSE_FORWARD_DECL)
-  add_definitions(-DQT_STATICPLUGIN)
-    set (MESH_3_SOURCE_FILES 
-      MainWindow.cpp
-      Mesh_3.cpp
-      ${DEMO_SRC_DIR}/Scene.cpp
-
-      Scene_moc.cpp)
-    #ADD_MSVC_PRECOMPILED_HEADER("StdAfx.h" "StdAfx.cpp" MESH_3_SOURCE_FILES)
-    LIST(APPEND MESH_3_SOURCE_FILES ${UI_FILES} ${RESOURCE_FILES})
-    add_executable( Mesh_3 ${MESH_3_SOURCE_FILES} )
-    qt5_use_modules(Mesh_3 Xml Script OpenGL Svg)
-    add_to_cached_list( CGAL_EXECUTABLE_TARGETS Mesh_3 )
-
-  # Link with Qt libraries
-  target_link_libraries( Mesh_3 ${QT_LIBRARIES} )
-
-  # Link with CGAL
-  target_link_libraries( Mesh_3 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ${TBB_LIBRARIES})
-
-  # Link with libQGLViewer, OpenGL
-  target_link_libraries( Mesh_3 ${QGLVIEWER_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} )
-
-#  # Link with the scene_item library.
-#  target_link_libraries( Mesh_3 scene_item )
-
-  target_link_libraries( Mesh_3 ${VIEWER_LIB} )
-
-
-  add_to_cached_list( CGAL_EXECUTABLE_TARGETS Mesh_3 )
-
-
-  ###########
-  # PLUGINS #
-  ###########
-  remove_definitions(-DQT_STATICPLUGIN)
-
-  # polyhedron_demo_plugin is a macro copied from demo/Polyhedron/CMakeLists.txt
-  macro(polyhedron_demo_plugin plugin_name plugin_implementation_base_name)
-    list_split(option ARGN_TAIL ${ARGN} )
-    if(NOT ${option} STREQUAL "EXCLUDE_FROM_ALL")
-      set(other_sources ${ARGN})
-      set(option "")
-    else()
-      set(other_sources ${ARGN_TAIL})
-    endif()
-    qt5_generate_moc( "${CMAKE_CURRENT_SOURCE_DIR}/${plugin_implementation_base_name}.cpp" ${plugin_implementation_base_name}.moc )
-    add_file_dependencies( ${plugin_implementation_base_name}.moc "${CMAKE_CURRENT_SOURCE_DIR}/${plugin_implementation_base_name}.cpp" )
-
-    add_library(${plugin_name} MODULE ${option} ${plugin_implementation_base_name}.moc ${plugin_implementation_base_name}.cpp ${other_sources})
-    qt5_use_modules(${plugin_name} Xml Script OpenGL Svg)
-    add_to_cached_list( CGAL_EXECUTABLE_TARGETS ${plugin_name} )
-    # Link with Qt
-    target_link_libraries( ${plugin_name} ${QT_LIBRARIES} )
-    # Link with scene_item
-    target_link_libraries( ${plugin_name} ${SCENE_ITEM_LIB})
-    # Link with CGAL
-    target_link_libraries( ${plugin_name} ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ${TBB_LIBRARIES})
-  endmacro(polyhedron_demo_plugin)
-
-  set(IO_IMAGE_PLUGIN_LIB "${MESH_3_LIB_PREFIX}io_image_plugin")
-  polyhedron_demo_plugin(${IO_IMAGE_PLUGIN_LIB} Io_image_plugin ${imgUI_FILES})
-  target_link_libraries(${IO_IMAGE_PLUGIN_LIB} ${SCENE_SEGMENTED_IMAGE_ITEM_LIB})
-
-  set(IO_OFF_PLUGIN_LIB "${MESH_3_LIB_PREFIX}io_off_plugin")
-  polyhedron_demo_plugin(${IO_OFF_PLUGIN_LIB} Io_off_plugin)
-  target_link_libraries(${IO_OFF_PLUGIN_LIB} ${SCENE_POLYHEDRON_ITEM_LIB} ${POLYGON_SOUP_LIB})
-
-  if(Qt5_FOUND)
-    set(VOLUME_PLANES_PLUGIN_LIB "${MESH_3_LIB_PREFIX}volume_planes_plugin")
-    polyhedron_demo_plugin(${VOLUME_PLANES_PLUGIN_LIB} Volume_planes_plugin
-                           ${VOLUME_MOC_OUTFILES}
-                           Volume_plane_intersection.cpp)
-    target_link_libraries(${VOLUME_PLANES_PLUGIN_LIB} ${SCENE_SEGMENTED_IMAGE_ITEM_LIB} ${VIEWER_LIB})
-  endif()
-
-  set(IO_C3T3_PLUGIN_LIB "${MESH_3_LIB_PREFIX}io_c3t3_plugin")
-  polyhedron_demo_plugin(${IO_C3T3_PLUGIN_LIB} Io_c3t3_plugin)
-  target_link_libraries(${IO_C3T3_PLUGIN_LIB} ${SCENE_C3T3_ITEM_LIB})
-
-  if ( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/C3t3_rib_exporter_plugin.cpp" )
-    set(C3T3_RIB_EXPORTER_PLUGIN_LIB "${MESH_3_LIB_PREFIX}c3t3_rib_exporter_plugin")
-    polyhedron_demo_plugin(${C3T3_RIB_EXPORTER_PLUGIN_LIB} C3t3_rib_exporter_plugin ${ribUI_FILES})
-    target_link_libraries(${C3T3_RIB_EXPORTER_PLUGIN_LIB} ${SCENE_C3T3_ITEM_LIB} ${VIEWER_LIB})
-  endif()
-
-  set(IO_IMPLICIT_FUNCTION_PLUGIN_LIB "${MESH_3_LIB_PREFIX}io_implicit_function_plugin")
-  polyhedron_demo_plugin(${IO_IMPLICIT_FUNCTION_PLUGIN_LIB} Io_implicit_function_plugin ${funcUI_FILES})
-  target_link_libraries(${IO_IMPLICIT_FUNCTION_PLUGIN_LIB} ${SCENE_IMPLICIT_FUNCTION_ITEM_LIB})
-
-  set(MESH_3_PLUGIN_LIB "${MESH_3_LIB_PREFIX}mesh_3_plugin") 
-  set(MESH_3_PLUGIN_SOURCE_FILES
-    Mesh_3_plugin.cpp
-    Mesh_3_plugin_polyhedron_cgal_code.cpp
-    Mesh_3_plugin_image_cgal_code.cpp
-    Mesh_3_plugin_implicit_function_cgal_code.cpp
-    Meshing_thread.cpp)
-  ADD_MSVC_PRECOMPILED_HEADER("StdAfx.h" "StdAfx.cpp" MESH_3_PLUGIN_SOURCE_FILES)
-  LIST(REMOVE_AT MESH_3_PLUGIN_SOURCE_FILES 0) # Remove Mesh_3_plugin.cpp since it's added by polyhedron_demo_plugin
-  LIST(APPEND MESH_3_PLUGIN_SOURCE_FILES  ${meshingUI_FILES})
-  polyhedron_demo_plugin(${MESH_3_PLUGIN_LIB} Mesh_3_plugin ${MESH_3_PLUGIN_SOURCE_FILES})
-
-#  set(MESH_3_PLUGIN_LIB "${MESH_3_LIB_PREFIX}mesh_3_plugin") 
-#  polyhedron_demo_plugin(${MESH_3_PLUGIN_LIB} Mesh_3_plugin 
-#                         Mesh_3_plugin_polyhedron_cgal_code.cpp
-#                         Mesh_3_plugin_image_cgal_code.cpp
-#                         Mesh_3_plugin_implicit_function_cgal_code.cpp
-#                         Meshing_thread.cpp
-#                         Scene_c3t3_item.moc
-#                         ${meshingUI_FILES})
-
-  target_link_libraries(${MESH_3_PLUGIN_LIB}
-                        ${SCENE_C3T3_ITEM_LIB}
-                        ${SCENE_POLYHEDRON_ITEM_LIB}
-                        ${SCENE_SEGMENTED_IMAGE_ITEM_LIB}
-                        ${SCENE_IMPLICIT_FUNCTION_ITEM_LIB}
-                        ${QGLVIEWER_LIBRARIES}
-                        ${OPENGL_gl_LIBRARY}
-                        ${OPENGL_glu_LIBRARY}
-                        ${TBB_LIBRARIES})
-
-  set(MESH_3_OPTIMIZATION_PLUGIN_LIB "${MESH_3_LIB_PREFIX}mesh_3_optimization_plugin")
-  set(MESH_3_OPTIMIZATION_PLUGIN_SOURCE_FILES
-    Mesh_3_optimization_plugin.cpp
-    Mesh_3_optimization_plugin_cgal_code.cpp
-    Optimizer_thread.cpp)
-  ADD_MSVC_PRECOMPILED_HEADER("StdAfx.h" "StdAfx.cpp" MESH_3_OPTIMIZATION_PLUGIN_SOURCE_FILES)
-  LIST(REMOVE_AT MESH_3_OPTIMIZATION_PLUGIN_SOURCE_FILES 0) # Remove Mesh_3_optimization_plugin.cpp since it's added by polyhedron_demo_plugin
-  LIST(APPEND MESH_3_OPTIMIZATION_PLUGIN_SOURCE_FILES ${optimUI_FILES})
-  polyhedron_demo_plugin(${MESH_3_OPTIMIZATION_PLUGIN_LIB} Mesh_3_optimization_plugin ${MESH_3_OPTIMIZATION_PLUGIN_SOURCE_FILES})
-
-  target_link_libraries(${MESH_3_OPTIMIZATION_PLUGIN_LIB}
-                        ${SCENE_C3T3_ITEM_LIB}
-                        ${SCENE_POLYHEDRON_ITEM_LIB}
-                        ${SCENE_SEGMENTED_IMAGE_ITEM_LIB}
-                        ${SCENE_IMPLICIT_FUNCTION_ITEM_LIB}
-                        ${QGLVIEWER_LIBRARIES}
-                        ${OPENGL_gl_LIBRARY}
-                        ${OPENGL_glu_LIBRARY}
-                        ${TBB_LIBRARIES})
-
-
-else (CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND AND Boost_FOUND)
-
-  set(MESH_3_MISSING_DEPS "")
-
-  if(NOT CGAL_Qt5_FOUND)
-    set(MESH_3_MISSING_DEPS "the CGAL Qt5 library, ${MESH_3_MISSING_DEPS}")
-  endif()
-
-  if(NOT Qt5_FOUND)
-    set(MESH_3_MISSING_DEPS "Qt5, ${MESH_3_MISSING_DEPS}")
-  endif()
-
-  if(NOT OPENGL_FOUND)
-    set(MESH_3_MISSING_DEPS "OpenGL, ${MESH_3_MISSING_DEPS}")
-  endif()
-
-  if(NOT QGLVIEWER_FOUND)
-    set(MESH_3_MISSING_DEPS "QGLViewer, ${MESH_3_MISSING_DEPS}")
-  endif()
-
-  if(NOT QGLVIEWER_FOUND)
-    set(MESH_3_MISSING_DEPS "QGLViewer, ${MESH_3_MISSING_DEPS}")
-  endif()
-
-  if(NOT QGLVIEWER_FOUND)
-    set(MESH_3_MISSING_DEPS "QGLViewer, ${MESH_3_MISSING_DEPS}")
-  endif()
-
-  if(NOT Boost_FOUND)
-    set(MESH_3_MISSING_DEPS "Boost, ${MESH_3_MISSING_DEPS}")
-  endif()
-
-  message(STATUS "NOTICE: This demo requires ${MESH_3_MISSING_DEPS}and will not be compiled.")
-
-endif (CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND AND Boost_FOUND)
-
-
-
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Mesh_function.h b/3rdparty/CGAL-4.8/demo/Mesh_3/Mesh_function.h
deleted file mode 100644
index 2c6186f..0000000
--- a/3rdparty/CGAL-4.8/demo/Mesh_3/Mesh_function.h
+++ /dev/null
@@ -1,265 +0,0 @@
-// Copyright (c) 2010 INRIA Sophia-Antipolis (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
-// 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(s)     : Stephane Tayeb
-//
-//******************************************************************************
-// File Description : 
-//******************************************************************************
-
-#ifndef CGAL_DEMO_MESH_3_MESH_FUNCTION_H
-#define CGAL_DEMO_MESH_3_MESH_FUNCTION_H
-
-#define CGAL_MESH_3_MESHER_STATUS_ACTIVATED 1
-
-#include <CGAL/Mesh_3/Concurrent_mesher_config.h>
-
-#include <QStringList>
-#include <QString>
-
-#include <CGAL/Mesh_3/Mesher_3.h>
-#include <CGAL/Mesh_criteria_3.h>
-#include <CGAL/Mesh_3/Protect_edges_sizing_field.h>
-
-#include "C3t3_type.h"
-#include "Meshing_thread.h"
-#include <CGAL/make_mesh_3.h> // for C3t3_initializer
-#include <CGAL/use.h>
-
-struct Mesh_parameters
-{
-  double facet_angle;
-  double facet_sizing;
-  double facet_approx;
-  
-  double tet_shape;
-  double tet_sizing;
-  bool protect_features;
-  
-  inline QStringList log() const;
-};
-
-
-template < typename Domain_ >
-class Mesh_function
-  : public Mesh_function_interface
-{
-  typedef Domain_ Domain;
-  
-public:
-  Mesh_function(C3t3& c3t3, Domain* domain, const Mesh_parameters& p);
-  
-  ~Mesh_function();
-  
-  // Launch
-  virtual void launch();
-  
-  // Stop
-  virtual void stop();
-  
-  // Logs
-  virtual QStringList parameters_log() const;
-  virtual QString status(double time_period) const;
-
-private:
-  typedef typename Domain::Point_3                  Point_3;
-  typedef typename Domain::Index                    Index;
-  typedef std::vector<std::pair<Point_3, Index> >   Initial_points_vector;
-  typedef typename Initial_points_vector::iterator  Ipv_iterator;
-  typedef C3t3::Vertex_handle                       Vertex_handle;
-  
-  typedef C3t3::Triangulation                       Tr;
-  typedef CGAL::Mesh_criteria_3<Tr>                 Mesh_criteria;
-  typedef Mesh_criteria::Edge_criteria              Edge_criteria;
-  typedef Mesh_criteria::Facet_criteria             Facet_criteria;
-  typedef Mesh_criteria::Cell_criteria              Cell_criteria;
-  
-  typedef CGAL::Mesh_3::Mesher_3<C3t3, Mesh_criteria, Domain>   Mesher;
-  
-private:
-  C3t3& c3t3_;
-  Domain* domain_;
-  Mesh_parameters p_;
-  bool continue_;
-  Mesher* mesher_;
-#ifdef CGAL_MESH_3_MESHER_STATUS_ACTIVATED
-  mutable typename Mesher::Mesher_status last_report_;
-#endif
-};
-
-
-
-// -----------------------------------
-// Class Mesh_parameters
-// -----------------------------------
-inline
-QStringList
-Mesh_parameters::
-log() const
-{
-  return QStringList()
-  << QString("facet min angle: %1").arg(facet_angle)
-  << QString("facet max size: %1").arg(facet_sizing)
-  << QString("facet approx error: %1").arg(facet_approx)
-  << QString("tet shape (radius-edge): %1").arg(tet_shape)
-  << QString("tet max size: %1").arg(tet_sizing)
-  << QString("protect features: %1").arg(protect_features);
-}
-
-
-// -----------------------------------
-// Class Mesh_function
-// -----------------------------------
-template < typename D_ >
-Mesh_function<D_>::
-Mesh_function(C3t3& c3t3, Domain* domain, const Mesh_parameters& p)
-: c3t3_(c3t3)
-, domain_(domain)
-, p_(p)
-, continue_(true)
-, mesher_(NULL)
-#ifdef CGAL_MESH_3_MESHER_STATUS_ACTIVATED
-, last_report_(0,0,0)
-#endif
-{
-#ifdef CGAL_CONCURRENT_MESH_3
-  Concurrent_mesher_config::load_config_file(CONFIG_FILENAME, false);
-#endif
-}
-
-
-template < typename D_ >
-Mesh_function<D_>::
-~Mesh_function()
-{
-  delete domain_;
-  delete mesher_;
-}
-
-
-template < typename D_ >
-void
-Mesh_function<D_>::
-launch()
-{
-#ifdef CGAL_MESH_3_INITIAL_POINTS_NO_RANDOM_SHOOTING
-  CGAL::default_random = CGAL::Random(0);
-#endif
-
-  // Create mesh criteria
-  Mesh_criteria criteria(Edge_criteria(p_.facet_sizing),
-                         Facet_criteria(p_.facet_angle,
-                                        p_.facet_sizing,
-                                        p_.facet_approx),
-                         Cell_criteria(p_.tet_shape,
-                                       p_.tet_sizing));
-
-  // Initialization of the mesh, either with the protection of sharp
-  // features, or with the initial points (or both).
-  CGAL::internal::Mesh_3::C3t3_initializer<
-    C3t3,
-    Domain,
-    Mesh_criteria,
-    CGAL::internal::Mesh_3::has_Has_features<Domain>::value >()
-    (c3t3_,
-     *domain_,
-     criteria,
-     p_.protect_features);
-
-  // Build mesher and launch refinement process
-  mesher_ = new Mesher(c3t3_, *domain_, criteria);
-
-#ifdef CGAL_MESH_3_PROFILING
-  CGAL::Real_timer t;
-  t.start();
-#endif
-
-#if CGAL_MESH_3_MESHER_STATUS_ACTIVATED
-  mesher_->initialize();
-  while ( ! mesher_->is_algorithm_done() && continue_ )
-  {
-    mesher_->one_step();
-  }
-#else // not CGAL_MESH_3_MESHER_STATUS_ACTIVATED
-  mesher_->refine_mesh();
-#endif
-
-#ifdef CGAL_MESH_3_PROFILING
-  std::cerr << "Full refinement time (without fix_c3t3): " << t.time() << " seconds." << std::endl;
-#endif
-
-  // Ensure c3t3 is ok (usefull if process has been stop by the user)
-  mesher_->fix_c3t3();
-}
-
-
-template < typename D_ >
-void
-Mesh_function<D_>::
-stop()
-{
-  continue_ = false;
-}
-
-
-template < typename D_ >
-QStringList
-Mesh_function<D_>::
-parameters_log() const
-{
-  return p_.log();
-}
-
-
-template < typename D_ >
-QString
-Mesh_function<D_>::
-status(double time_period) const
-{
-  QString result;
-
-  CGAL_USE(time_period); // to avoid a warning when the macro
-                         // CGAL_MESH_3_MESHER_STATUS_ACTIVATED is not
-                         // defined
-#ifdef CGAL_MESH_3_MESHER_STATUS_ACTIVATED
-  // If mesher_ is not yet created, it means that either launch() has not
-  // been called or that initial points have not been founded
-  if ( NULL == mesher_ )
-  {
-    return QString("Initialization in progress...");
-  }
-  
-  // Get status and return a string corresponding to it
-  typename Mesher::Mesher_status s = mesher_->status();
-  
-  result = QString("Vertices: %1 \n"
-                           "Vertices inserted last %2s: %3 \n\n"
-                           "Bad facets: %4 \n"
-                           "Bad cells: %5")
-    .arg(s.vertices)
-    .arg(time_period)
-    .arg(s.vertices - last_report_.vertices)
-    .arg(s.facet_queue)
-    .arg(s.cells_queue);
-  
-  last_report_ = s;
-#endif
-  return result;
-}
-
-#endif // CGAL_DEMO_MESH_3_MESH_FUNCTION_H
diff --git a/3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/CMakeLists.txt
deleted file mode 100644
index 71e49e2..0000000
--- a/3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/CMakeLists.txt
+++ /dev/null
@@ -1,116 +0,0 @@
-# This is the CMake script for compiling the Optimal_transportation_reconstruction_2 demo.
-
-project(Optimal_transportation_reconstruction_2_demo)
-
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-# Include this package's headers first
-include_directories( BEFORE ./ ./include ../../include )
-
-# Find CGAL and CGAL Qt5
-find_package(CGAL COMPONENTS Qt5)
-include( ${CGAL_USE_FILE} )
-
-# Find Qt5 itself
-find_package(Qt5 5.4 QUIET COMPONENTS OpenGL)
-if(Qt5_FOUND)
-  add_definitions(-DQT_NO_KEYWORDS)
-endif(Qt5_FOUND)
-
-# Find OpenGL
-find_package(OpenGL)
-
-# Find CImg
-find_path(CIMG_INCLUDE_DIR
-          NAMES CImg.h
-          HINTS ENV CIMG_INC_DIR
-          DOC "Path to the header of the CImg library")
-
-if (CIMG_INCLUDE_DIR)
-  add_definitions(-DCGAL_USE_CIMG)
-  include_directories(${CIMG_INCLUDE_DIR})
-  MESSAGE(STATUS "CImg library found, the demo can load point set from image files.")
-else()
-  MESSAGE(STATUS "CImg library was not found, the demo will not be able to load point set from image files. "
-                 "Try setting the environment variable CIMG_INC_DIR to point to the path of the directory containing CImg.h.")
-endif()
-
-if(CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND)
-
-  set(
-  SRCS 
-  glviewer.cpp 
-  Otr2_demo.cpp 
-  window.cpp 
-  render.cpp 
-  )
-
-  set( 
-  MOCS 
-  moc_dialog_options.cxx 
-  moc_glviewer.cxx 
-  moc_window.cxx 
-  )
-
-  set(
-  UIS
-  pwsrec.ui 
-  options.ui
-  )
-  
-  qt5_wrap_ui( UI_FILES ${UIS} )
-
-  include(AddFileDependencies)
-
-  qt5_generate_moc( "window.h" "${CMAKE_CURRENT_BINARY_DIR}/moc_window.cxx" )
-  add_file_dependencies( moc_window.cxx "${CMAKE_CURRENT_SOURCE_DIR}/window.h" )
-
-  qt5_generate_moc( "glviewer.h" "${CMAKE_CURRENT_BINARY_DIR}/moc_glviewer.cxx" )
-  add_file_dependencies( moc_glviewer.cxx "${CMAKE_CURRENT_SOURCE_DIR}/glviewer.h" )
-
-  qt5_generate_moc( "dialog_options.h" "${CMAKE_CURRENT_BINARY_DIR}/moc_dialog_options.cxx" )
-  add_file_dependencies( moc_dialog_options.cxx "${CMAKE_CURRENT_SOURCE_DIR}/dialog_options.h" )
-
-  qt5_add_resources ( RESOURCE_FILES pwsrec.qrc )
-
-  add_executable  ( Optimal_transportation_reconstruction_2_demo ${SRCS} ${MOCS} ${UI_FILES} ${RESOURCE_FILES} ${CGAL_ADDITIONAL_FILES} ${CGAL_RESOURCE_FILES})
-  
-  qt5_use_modules(Optimal_transportation_reconstruction_2_demo OpenGL)
-
-  # Link with Qt libraries
-  target_link_libraries( Optimal_transportation_reconstruction_2_demo ${QT_LIBRARIES} )
-
-  # Link with CGAL
-  target_link_libraries( Optimal_transportation_reconstruction_2_demo ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} )
-
-  # Link with OpenGL
-  target_link_libraries( Optimal_transportation_reconstruction_2_demo ${OPENGL_gl_LIBRARY} )
-    
-  add_to_cached_list( CGAL_EXECUTABLE_TARGETS Optimal_transportation_reconstruction_2_demo )
-
-else (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND )
-
-  set(OTR2_MISSING_DEPS "")
-
-  if(NOT CGAL_FOUND)
-    set(OTR2_MISSING_DEPS "the CGAL library, ${OTR2_MISSING_DEPS}")
-  endif()
-
-  if(NOT CGAL_Qt5_FOUND)
-    set(OTR2_MISSING_DEPS "the CGAL Qt5 library, ${OTR2_MISSING_DEPS}")
-  endif()
-
-  if(NOT Qt5_FOUND)
-    set(OTR2_MISSING_DEPS "Qt5.4, ${OTR2_MISSING_DEPS}")
-  endif()
-
-  if(NOT OPENGL_FOUND)
-    set(OTR2_MISSING_DEPS "OpenGL, ${OTR2_MISSING_DEPS}")
-  endif()
-
-  message(STATUS "NOTICE: This demo requires ${OTR2_MISSING_DEPS}and will not be compiled.")
-
-endif (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND)
diff --git a/3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/scene.h b/3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/scene.h
deleted file mode 100644
index d3e73c6..0000000
--- a/3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/scene.h
+++ /dev/null
@@ -1,908 +0,0 @@
-#ifndef SCENE_H_
-#define SCENE_H_
-
-// STL
-#include <fstream>
-
-//Qt
-#include <QtOpenGL>
-#include <QWidget>
-
-// local
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-#include "Otr2_kerneled.h"
-#include <CGAL/Optimal_transportation_reconstruction_2.h>
-
-
-#ifdef CGAL_USE_CIMG
-#define cimg_display 0 // To avoid X11 or Windows-GDI dependency
-#include <CImg.h>
-#endif
-#include "random.h"
-#include <utility>      // std::pair
-#include <vector>
-#include <CGAL/property_map.h>
-#include <CGAL/value_type_traits.h>
-
-class Scene {
-
-public:
-  typedef std::pair<Point, FT> PointMassPair;
-
-  typedef std::vector<PointMassPair> PointMassList;
-  typedef PointMassList::const_iterator InputIterator;
-
-  typedef CGAL::value_type_traits<InputIterator>::type MassPoint;
-
-  typedef CGAL::First_of_pair_property_map<PointMassPair> Point_property_map;
-  typedef CGAL::Second_of_pair_property_map<PointMassPair> Mass_property_map;
-
-  typedef CGAL::Optimal_transportation_reconstruction_2<K, Point_property_map,
-    Mass_property_map> R_s_2;
-
-  typedef K::Segment_2 Segment;
-
-  typedef R_s_2::Vector Vector;
-
-  typedef R_s_2::Vertex Vertex;
-  typedef R_s_2::Vertex_handle Vertex_handle;
-  typedef R_s_2::Vertex_iterator Vertex_iterator;
-  typedef R_s_2::Vertex_circulator Vertex_circulator;
-  typedef R_s_2::Finite_vertices_iterator Finite_vertices_iterator;
-
-  typedef R_s_2::Edge Edge;
-  typedef R_s_2::Edge_circulator Edge_circulator;
-  typedef R_s_2::Finite_edges_iterator Finite_edges_iterator;
-
-  typedef R_s_2::Face_handle Face_handle;
-  typedef R_s_2::Face_circulator Face_circulator;
-  typedef R_s_2::Finite_faces_iterator Finite_faces_iterator;
-
-  typedef R_s_2::Vertex_handle_map Vertex_handle_map;
-  typedef R_s_2::Face_handle_map Face_handle_map;
-
-  typedef R_s_2::Vertex_handle_set Vertex_handle_set;
-  typedef R_s_2::Edge_set Edge_set;
-
-  typedef R_s_2::Edge_vector Edge_vector;
-
-  typedef R_s_2::Sample_ Sample_;
-  typedef R_s_2::Sample_vector Sample_vector;
-  typedef R_s_2::Sample_vector_const_iterator Sample_vector_const_iterator;
-
-  typedef R_s_2::PSample PSample;
-  typedef R_s_2::SQueue SQueue;
-
-  typedef R_s_2::Rec_edge_2 PEdge;
-
-
-private:
-  // data
-  std::vector<Sample_> m_samples;
-
-  Optimal_transportation_reconstruction_kerneled_2* m_pwsrec;
-  int m_ignore;
-  bool m_init_done;
-  double m_percentage;
-
-  // bbox
-  double m_bbox_x;
-  double m_bbox_y;
-  double m_bbox_size;
-
-public:
-  Scene() {
-    srand(0); // for sake of repeatability
-    m_ignore = 0;
-    m_init_done = false;
-    m_percentage = 100.;
-    m_bbox_x = 0.0;
-    m_bbox_y = 0.0;
-    m_bbox_size = 1.0;
-
-    m_pwsrec = new Optimal_transportation_reconstruction_kerneled_2();
-  }
-
-  ~Scene() {
-    clear();
-  }
-
-  void clear() {
-    m_pwsrec->clear();
-    m_samples.clear();
-  }
-
-
-
-  void subdivide() {
-    if (m_samples.size() < 3)
-      return;
-
-    std::vector<Sample_> new_samples;
-    std::vector<Sample_>::const_iterator it = m_samples.begin();
-    std::vector<Sample_>::const_iterator last = it++;
-    while (it != m_samples.end()) {
-      Point p = CGAL::midpoint(last->point(), it->point());
-      FT m = 0.5 * (last->mass() + it->mass());
-      new_samples.push_back(Sample_(p, m));
-      last = it++;
-    }
-    it = m_samples.begin();
-    Point p = CGAL::midpoint(last->point(), it->point());
-    FT m = 0.5 * (last->mass() + it->mass());
-    new_samples.push_back(Sample_(p, m));
-
-    std::vector<Sample_> final_samples;
-    std::vector<Sample_>::const_iterator it2 = new_samples.begin();
-    while (it != m_samples.end() && it2 != new_samples.end()) {
-      final_samples.push_back(*it);
-      final_samples.push_back(*it2);
-      it++;
-      it2++;
-    }
-
-    m_samples = final_samples;
-  }
-
-  // SAMPLE //
-
-  void add_sample(const Point& point, const FT mass = 1.0) {
-    m_samples.push_back(Sample_(point, mass));
-    m_init_done = false;
-  }
-
-  void add_outliers(const unsigned int nb) {
-    std::cerr << "adding " << nb << " outliers...";
-    for (unsigned int i = 0; i < nb; i++) {
-      Point outlier = CGAL::ORIGIN + random_vec<Vector>(1.3);
-      m_samples.push_back(outlier);
-    }
-    m_init_done = false;
-    std::cerr << "done" << std::endl;
-  }
-
-  void noise(const FT scale) {
-    std::cerr << "noising by " << scale << "...";
-    std::vector<Sample_>::iterator it;
-    for (it = m_samples.begin(); it != m_samples.end(); it++) {
-      Sample_& sample = *it;
-      Point& point = sample.point();
-      point = point + random_vec<Vector>(scale);
-    }
-    std::cerr << "done" << std::endl;
-  }
-
-  void normalize_points() {
-    noise(1e-5);
-    compute_bbox(m_bbox_x, m_bbox_y, m_bbox_size);
-    if (m_bbox_size == 0.0)
-      return;
-
-    Point center(m_bbox_x, m_bbox_y);
-    std::vector<Sample_>::iterator it;
-    for (it = m_samples.begin(); it != m_samples.end(); ++it) {
-      Sample_& sample = *it;
-      Vector vec = (sample.point() - center) / m_bbox_size;
-      sample.point() = CGAL::ORIGIN + vec;
-    }
-    m_bbox_x = m_bbox_y = 0.0;
-    m_bbox_size = 1.0;
-  }
-
-  void compute_bbox(double &x, double &y, double &scale) {
-    if (m_samples.empty()) {
-      x = y = 0.0;
-      scale = 1.0;
-      return;
-    }
-
-    FT x_min, x_max, y_min, y_max;
-    std::vector<Sample_>::const_iterator it = m_samples.begin();
-    Point p = it->point();
-    x_min = x_max = p.x();
-    y_min = y_max = p.y();
-    ++it;
-    for (; it != m_samples.end(); ++it) {
-      p = it->point();
-      x_min = (std::min)(x_min, p.x());
-      x_max = (std::max)(x_max, p.x());
-      y_min = (std::min)(y_min, p.y());
-      y_max = (std::max)(y_max, p.y());
-    }
-
-    x = 0.5 * (x_min + x_max);
-    y = 0.5 * (y_min + y_max);
-    scale = (std::max)(x_max - x_min, y_max - y_min);
-    if (scale == 0.0)
-      scale = 1.0;
-  }
-
-  // IO SAMPLES //
-
-  void load(const QString& filename, QWidget* qw) {
-
-    if (filename.contains(".xy", Qt::CaseInsensitive)) {
-      load_xy_file(filename);
-      normalize_points();
-      return;
-    }
-
-#ifdef CGAL_USE_CIMG
-    if (filename.contains(".bmp", Qt::CaseInsensitive)) {
-      bool use_gradient = false;
-
-      QMessageBox::StandardButton reply;
-      reply = QMessageBox::question(qw, QString("Open BMP"), "Use gradient?",
-        QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
-      if (reply == QMessageBox::Yes)
-        use_gradient = true;
-      else if (reply == QMessageBox::No)
-        use_gradient = false;
-      else
-        return;
-
-      if (use_gradient)
-        load_gradient(filename);
-      else
-        load_image(filename);
-      normalize_points();
-      return;
-    }
-
-    std::cerr << "Invalid file (try .xy, .bmp)" << std::endl;
-#else
-    CGAL_USE(qw);
-    std::cerr << "Invalid file (try .xy)" << std::endl;
-#endif
-
-
-  }
-
-  void load_xy_file(const QString& fileName) {
-
-    std::cout << "filename: " << fileName.toUtf8().constData() << std::endl;
-    std::ifstream ifs(qPrintable(fileName));
-    std::cerr << "reading xy...";
-    Point point;
-    unsigned int nb = 0;
-    while (ifs >> point) {
-      add_sample(point, 1.0);
-      nb++;
-    }
-    std::cerr << "done (" << nb << " points)" << std::endl;
-    ifs.close();
-  }
-
-
-#ifdef CGAL_USE_CIMG
-  void load_image(const QString& fileName) {
-    std::cerr << "reading image...";
-    cimg_library::CImg<float> image(qPrintable(fileName));
-    std::cerr << "done" << std::endl;
-
-    std::cerr << "computing grayscale...";
-    cimg_library::CImg<float> grayscale =
-      image.RGBtoHSV().get_channel(2).normalize(0.0f, 1.0f);
-    std::cerr << "done" << std::endl;
-
-    // turn pixels into weighted samples
-    std::cerr << "adding samples...";
-    for (int i = 0; i < grayscale.width(); i++) {
-      for (int j = 0; j < grayscale.height(); j++) {
-        float mass = 1.0f - grayscale.atXY(i, j);
-        double x = double(i) / grayscale.width();
-        double y = 1.0 - double(j) / grayscale.height();
-        if (mass > 0.f)
-          add_sample(Point(x, y), mass);
-      }
-    }
-    std::cerr << "done (" << m_samples.size() << ")" << std::endl;
-  }
-
-  void load_gradient(const QString& fileName) {
-    std::cerr << "reading image...";
-    cimg_library::CImg<float> image(qPrintable(fileName));
-    std::cerr << "done" << std::endl;
-
-    std::cerr << "computing gradient...";
-    cimg_library::CImgList<float> grad = image.get_gradient();
-    cimg_library::CImg<float> normgrad = sqrt(
-      grad[0].pow(2) + grad[1].pow(2)).normalize(0.0f, 1.0f);
-    std::cerr << "done" << std::endl;
-
-    // turn pixels into weighted samples
-    std::cerr << "adding samples...";
-    for (int i = 0; i < normgrad.width(); i++) {
-      for (int j = 0; j < normgrad.height(); j++) {
-        float mass = normgrad.atXY(i, j);
-        double x = double(i) / normgrad.width();
-        double y = 1.0 - double(j) / normgrad.height();
-        add_sample(Point(x, y), mass);
-      }
-    }
-    std::cerr << "done (" << m_samples.size() << ")" << std::endl;
-  }
-#endif
-
-  void print_vertex(Vertex vertex) {
-    std::cout << "vertex " << vertex << std::endl;
-  }
-
-
-  void print_edge(PEdge edge) {
-    int i = ((edge).edge()).second;
-    Point a = ((edge).edge()).first->vertex((i + 1) % 3)->point();
-    Point b = ((edge).edge()).first->vertex((i + 2) % 3)->point();
-    std::cout << "( " << (edge).priority() << ") ( " << a
-      << " , " << b << " )" << std::endl;
-  }
-
-
-  void debug_print()
-  {
-    std::vector<Point> isolated_points;
-    std::vector<Segment> edges;
-
-    m_pwsrec->list_output(std::back_inserter(isolated_points), std::back_inserter(edges));
-
-    int vertex_count = 0;
-    for (std::vector<Point>::iterator it = isolated_points.begin();
-      it != isolated_points.end(); it++) {
-      vertex_count++;
-      std::cout << *it << std::endl;
-    }
-    CGAL_assertion(vertex_count == 18);
-
-    int edge_count = 0;
-    for (std::vector<Segment>::iterator it = edges.begin();
-      it != edges.end(); it++) {
-      std::cout << *it << std::endl;
-      edge_count++;
-    }
-  }
-
-  void save(const QString& filename)
-  {
-    Sample_vector samples;
-    for (std::vector<Sample_>::iterator it = m_samples.begin();
-      it != m_samples.end(); ++it) {
-      Sample_& s = *it;
-      samples.push_back(&s);
-    }
-
-    if (filename.contains(".xy", Qt::CaseInsensitive)) {
-      save_xy(filename, samples);
-      return;
-    }
-
-    std::cerr << "Error: not an XY file." << std::endl;
-  }
-
-
-
-  void save_xy(const QString& filename, const Sample_vector& samples) {
-    std::ofstream ofs(qPrintable(filename));
-    for (Sample_vector_const_iterator it = samples.begin();
-      it != samples.end(); ++it) {
-      Sample_* sample = *it;
-      ofs << sample->point() << std::endl;
-    }
-    ofs.close();
-  }
-
-
-  // RECONSTRUCTION //
-
-  void set_options(const int verbose, const int mchoice,
-    const bool use_flip, const unsigned int relocation,
-    const double ghost) {
-
-    m_pwsrec->set_verbose(verbose);
-    m_pwsrec->set_random_sample_size(mchoice);
-    m_pwsrec->set_use_flip(use_flip);
-    m_pwsrec->set_relocation(relocation);
-    m_pwsrec->set_relevance(ghost);
-  }
-
-  bool init_reconstruction(const double percentage) {
-    std::cout << " init_reconstruction " << std::endl;
-
-    if (m_samples.empty()) {
-      std::cerr << "initialization failed (empty point set)" << std::endl;
-      return false;
-    }
-
-    Sample_vector vertices, samples;
-    select_samples(percentage, vertices, samples);
-
-    PointMassList point_mass_list;
-    Sample_vector_const_iterator it;
-    for (it = vertices.begin(); it != vertices.end(); it++) {
-      point_mass_list.push_back(
-        std::make_pair((*it)->point(), (*it)->mass()));
-    }
-
-    Point_property_map point_pmap;
-    Mass_property_map mass_pmap;
-    MassPoint mp;
-
-    m_pwsrec->initialize(point_mass_list.begin(), point_mass_list.end(),
-      point_pmap, mass_pmap);
-
-    m_init_done = true;
-
-    return true;
-  }
-
-  void decimate(const double percentage) {
-    std::cout << "decimating from " << m_samples.size() << " to...";
-    std::vector<Sample_> selected;
-
-    std::vector<Sample_>::iterator it;
-    for (it = m_samples.begin(); it != m_samples.end(); it++) {
-      const double rd = random_double(0.0, 1.0);
-      if (rd >= percentage)
-        selected.push_back(*it);
-    }
-
-    m_samples.clear();
-    std::copy(selected.begin(), selected.end(),
-      std::back_inserter(m_samples));
-    std::cout << m_samples.size() << std::endl;
-  }
-
-
-  void select_samples(const double percentage, Sample_vector& vertices,
-    Sample_vector& samples) {
-    std::vector<Sample_>::iterator it;
-    for (it = m_samples.begin(); it != m_samples.end(); ++it) {
-      Sample_& s = *it;
-
-      samples.push_back(&s);
-      FT rv = random_double(0.0, 1.0);
-      if (rv <= percentage)
-        vertices.push_back(&s);
-    }
-  }
-
-  void reconstruct_until(const unsigned int nv) {
-    std::cout << "reconstruct_until" << std::endl;
-    if (!m_init_done)
-      init_reconstruction(m_percentage);
-    m_pwsrec->run_until(nv);
-  }
-
-  void reconstruct(const unsigned int steps) {
-    std::cout << "reconstruct" << std::endl;
-    if (!m_init_done)
-      init_reconstruction(m_percentage);
-    m_pwsrec->run(steps);
-  }
-
-  void relocate_all_points() {
-    std::cout << "relocate_all_points" << std::endl;
-    m_pwsrec->relocate_all_points();
-  }
-
-  void output_console()
-  {
-    std::cout << std::endl;
-    std::cout << "OFF OUTPUT" << std::endl;
-    std::vector<Point> points;
-    std::vector<std::size_t> isolated_vertices;
-    std::vector<std::pair<std::size_t, std::size_t> > edges;
-
-    m_pwsrec->indexed_output(
-      std::back_inserter(points),
-      std::back_inserter(isolated_vertices),
-      std::back_inserter(edges));
-
-    std::cout << "OFF " << points.size() << " 0 " << edges.size() << std::endl;
-
-    // points
-    std::vector<Point>::iterator pit;
-    for (pit = points.begin(); pit != points.end(); pit++)
-      std::cout << *pit << std::endl;
-
-    // isolated vertices
-    std::vector<std::size_t>::iterator vit;
-    for (vit = isolated_vertices.begin(); vit != isolated_vertices.end(); vit++)
-      std::cout << "1 " << *vit << std::endl;
-
-    // edges
-    std::vector<std::pair<std::size_t, std::size_t> >::iterator eit;
-    for (eit = edges.begin(); eit != edges.end(); eit++)
-      std::cout << "2 " << eit->first << " " << eit->second << std::endl;
-  }
-
-  // RENDER //
-
-  void render(const bool view_points, const bool view_vertices,
-    const bool view_edges, const bool view_ghost_edges,
-    const bool view_edge_cost, const bool view_edge_priority,
-    const bool view_bins, const bool view_foot_points,
-    const bool view_relocation, const bool view_edge_relevance,
-    const float point_size, const float vertex_size,
-    const float line_thickness)
-  {
-    if (m_pwsrec == NULL) {
-      return;
-    }
-
-    if (view_edges)
-      m_pwsrec->draw_edges(0.5f * line_thickness, 0.9f, 0.9f, 0.9f);
-
-    if (view_edge_cost)
-      m_pwsrec->draw_costs(line_thickness, view_ghost_edges);
-
-    if (view_edge_priority)
-      m_pwsrec->draw_pedges(line_thickness);
-
-    if (view_edge_relevance)
-      m_pwsrec->draw_relevance(line_thickness, m_ignore);
-
-    if (view_relocation)
-      m_pwsrec->draw_relocation();
-
-    if (view_vertices)
-      m_pwsrec->draw_vertices(vertex_size, 0.0f, 0.0f, 0.5f);
-
-    if (view_bins)
-      m_pwsrec->draw_bins(0.5f * line_thickness);
-
-    if (view_foot_points)
-      m_pwsrec->draw_footpoints(line_thickness, 0.2f, 0.8f, 0.2f);
-
-    if (view_points)
-      draw_samples(point_size);
-  }
-
-  void draw_samples(const float point_size) {
-
-    ::glPointSize(point_size);
-    ::glBegin(GL_POINTS);
-
-    std::vector<Sample_>::const_iterator it;
-    for (it = m_samples.begin(); it != m_samples.end(); it++) {
-      double mass = it->mass();
-
-      float value = mass;
-      float grey = 0.9 * (1.0f - value);
-      ::glColor3f(grey, grey, grey);
-      const Point& p = it->point();
-      ::glVertex2d(p.x(), p.y());
-    }
-    ::glEnd();
-  }
-
-
-  // PREDEFINED EXAMPLES //
-
-  void make_line(const unsigned int nb, const Point& start,
-    const Point& end) {
-    Point curr = start;
-    Vector incr = (end - start) / nb;
-    for (unsigned int i = 0; i < nb; i++) {
-      add_sample(curr);
-      curr = curr + incr;
-    }
-  }
-
-  void make_circle_arc(const unsigned int nb, const Point& c,
-    const double radius, const double min_angle = 0.0,
-    const double max_angle = 360.0) {
-    const double range = max_angle - min_angle;
-    const double incr = range / double(nb);
-    for (double angle = min_angle; angle < max_angle; angle += incr) {
-      double angle_rad = (angle / 360.0) * 6.2831853;
-      double x = c.x() + radius * cos(angle_rad);
-      double y = c.y() + radius * sin(angle_rad);
-      Point point(x, y);
-      add_sample(point);
-    }
-  }
-
-  void append_widely_variable_sampling(const float d1, const float d2) {
-    double angle;
-    double incr = d1;
-    Point c = Point(0.5, 0.5);
-    const double radius = 0.5;
-    // 0-90 deg -> d1
-    for (angle = 0.0; angle < 90.0; angle += incr) {
-      double angle_rad = (angle / 360.0) * 6.2831853;
-      double x = c.x() + radius * cos(angle_rad);
-      double y = c.y() + radius * sin(angle_rad);
-      Point point(x, y);
-      add_sample(point);
-    }
-    // 90-180 deg -> d1 -> d2
-    for (angle = 90.0; angle < 180.0; angle += incr) {
-      double angle_rad = (angle / 360.0) * 6.2831853;
-      double x = c.x() + radius * cos(angle_rad);
-      double y = c.y() + radius * sin(angle_rad);
-      Point point(x, y);
-      add_sample(point);
-      incr = d1 + (d2 - d1) / 90.0 * (angle - 90);
-    }
-    // 180-270 deg -> d2
-    incr = d2;
-    for (angle = 180.0; angle < 270.0; angle += incr) {
-      double angle_rad = (angle / 360.0) * 6.2831853;
-      double x = c.x() + radius * cos(angle_rad);
-      double y = c.y() + radius * sin(angle_rad);
-      Point point(x, y);
-      add_sample(point);
-    }
-    // 270-360 deg -> d2 -> d1
-    incr = d2;
-    for (angle = 270.0; angle < 360.0; angle += incr) {
-      double angle_rad = (angle / 360.0) * 6.2831853;
-      double x = c.x() + radius * cos(angle_rad);
-      double y = c.y() + radius * sin(angle_rad);
-      Point point(x, y);
-      add_sample(point);
-      incr = d2 + (d1 - d2) / 90.0 * (angle - 270.0);
-    }
-  }
-
-  void append_predefined_line(const int density) {
-    std::cerr << "append line...";
-    Point start(0.0, 0.5);
-    Point end(1.0, 0.5);
-    make_line(density, start, end);
-    std::cerr << "done" << std::endl;
-  }
-
-  void append_predefined_parallel_lines(const int nb_lines, const float space,
-    const int density) {
-    std::cerr << "append parallel lines...";
-    FT x[4];
-    x[0] = 0.0;
-    x[1] = 0.75;
-    x[2] = 1.0;
-    x[3] = 1.75;
-    FT y = 0.0;
-    for (int i = 0; i < nb_lines; ++i) {
-      int j = i % 2;
-      Point start(x[j], y);
-      Point end(x[j + 2], y);
-      make_line(density, start, end);
-      y += space;
-    }
-    std::cerr << "done" << std::endl;
-  }
-
-  void append_predefined_circle(const int density, const float x,
-    const float y, const float radius) {
-    std::cerr << "append circle...";
-    Point center(x, y);
-    make_circle_arc(density, center, radius);
-    std::cerr << "done" << std::endl;
-  }
-
-  void append_predefined_spiral(const int nb_loops, const int density) {
-    std::cerr << "append spiral...";
-    Point center(0.5, 0.5);
-    const FT max_radius = 0.5;
-    const FT spacing = 10. / density; // target spacing
-    double radius = max_radius;
-    const double max_angle = nb_loops * 360.0;
-    for (double angle = max_angle; angle > 0.0; /**/) {
-      double angle_rad = (angle / 360.0) * 6.2831853;
-      double x = center.x() + radius * cos(angle_rad);
-      double y = center.y() + radius * sin(angle_rad);
-      Point point(x, y);
-      add_sample(point);
-
-      const double angle_incr = atan(spacing / radius);
-      angle -= angle_incr;
-      radius = max_radius * angle / max_angle;
-    }
-    std::cerr << "done" << std::endl;
-  }
-
-  void append_predefined_half_circle(const int density) {
-    std::cerr << "append half circle...";
-    Point center(0.5, 0.5);
-    make_circle_arc(density, center, 0.5, 0.0, 180.0);
-    std::cerr << "done" << std::endl;
-  }
-
-  void append_predefined_box(const int density, const float x, const float y,
-    const float size_x, const float size_y) {
-    std::cerr << "append box...";
-    Point a(x - size_x / 2, y - size_y / 2);
-    Point b(x + size_x / 2, y - size_y / 2);
-    Point c(x + size_x / 2, y + size_y / 2);
-    Point d(x - size_x / 2, y + size_y / 2);
-    make_line(density, a, b);
-    make_line(density, b, c);
-    make_line(density, c, d);
-    make_line(density, d, a);
-    std::cerr << "done" << std::endl;
-  }
-
-  void append_predefined_box_with_boundaries(const int density) {
-    std::cerr << "append box with boundaries...";
-
-    Point a(0.1, 0.1);
-    Point b(0.4, 0.1);
-    Point c(0.6, 0.1);
-    Point d(0.9, 0.1);
-    Point e(0.9, 0.4);
-    Point f(0.9, 0.6);
-    Point g(0.9, 0.9);
-    Point h(0.6, 0.9);
-    Point i(0.4, 0.9);
-    Point j(0.1, 0.9);
-    Point k(0.1, 0.6);
-    Point l(0.1, 0.4);
-
-    make_line(density, a, b);
-    make_line(density, c, d);
-    make_line(density, d, e);
-    make_line(density, f, g);
-    make_line(density, g, h);
-    make_line(density, i, j);
-    make_line(density, j, k);
-    make_line(density, l, a);
-
-    std::cerr << "done" << std::endl;
-  }
-
-  void append_predefined_box_with_missing_corners(const int density) {
-    std::cerr << "append box with missing corners...";
-    Point a(0.12, 0.1);
-    Point b(0.88, 0.1);
-    Point c(0.9, 0.12);
-    Point d(0.9, 0.88);
-    Point e(0.88, 0.9);
-    Point f(0.12, 0.9);
-    Point g(0.1, 0.88);
-    Point h(0.1, 0.12);
-    make_line(density, a, b);
-    make_line(density, c, d);
-    make_line(density, e, f);
-    make_line(density, g, h);
-    std::cerr << "done" << std::endl;
-  }
-
-  void append_predefined_boxes(const int density) {
-    std::cerr << "append two boxes...";
-    Point a(0.0, 0.0);
-    Point b(0.2, 0.0);
-    Point c(0.2, 1.0);
-    Point d(0.0, 1.0);
-    make_line(2 * density, a, b);
-    make_line(10 * density, b, c);
-    make_line(2 * density, c, d);
-    make_line(10 * density, d, a);
-
-    Point e(0.3, 0.0);
-    Point f(0.4, 0.0);
-    Point g(0.4, 0.3);
-    Point h(0.3, 0.3);
-    make_line(1 * density, e, f);
-    make_line(3 * density, f, g);
-    make_line(1 * density, g, h);
-    make_line(3 * density, h, e);
-    std::cerr << "done" << std::endl;
-  }
-
-  void append_predefined_stair(const int density) {
-    std::cerr << "append stair...";
-    Point a(0.0, 0.0);
-    Point b(0.1, 0.0);
-    Point c(0.1, 0.1);
-    Point d(0.2, 0.1);
-    Point e(0.2, 0.2);
-    Point f(0.3, 0.2);
-    Point g(0.3, 0.3);
-    Point h(0.4, 0.3);
-    Point i(0.4, 0.4);
-
-    make_line(density, a, b);
-    make_line(density, b, c);
-    make_line(density, c, d);
-    make_line(density, d, e);
-    make_line(density, e, f);
-    make_line(density, f, g);
-    make_line(density, g, h);
-    make_line(density, h, i);
-    std::cerr << "done" << std::endl;
-  }
-
-  void append_predefined_skyline(const int density) {
-    std::cerr << "append skyline...";
-    Point a(0.0, 0.0);
-    Point b(0.1, 0.0);
-    Point c(0.1, 0.5);
-    Point d(0.3, 0.5);
-    Point e(0.3, 0.2);
-    Point f(0.4, 0.2);
-    Point g(0.4, 0.4);
-    Point h(0.6, 0.4);
-    Point i(0.6, -0.1);
-    Point j(0.7, -0.1);
-    Point k(0.7, 0.2);
-    Point l(0.8, 0.2);
-    Point m(0.8, 0.7);
-    Point n(0.9, 0.7);
-    Point o(0.9, 0.5);
-    Point p(1.0, 0.5);
-    Point q(1.0, 0.1);
-    Point r(1.1, 0.1);
-    Point s(1.1, -0.1);
-    Point t(1.2, -0.1);
-
-    make_line(1 * density, a, b);
-    make_line(5 * density, b, c);
-    make_line(2 * density, c, d);
-    make_line(3 * density, d, e);
-    make_line(1 * density, e, f);
-    make_line(2 * density, f, g);
-    make_line(2 * density, g, h);
-    make_line(5 * density, h, i);
-    make_line(1 * density, i, j);
-    make_line(3 * density, j, k);
-    make_line(1 * density, k, l);
-    make_line(5 * density, l, m);
-    make_line(1 * density, m, n);
-    make_line(2 * density, n, o);
-    make_line(1 * density, o, p);
-    make_line(4 * density, p, q);
-    make_line(1 * density, q, r);
-    make_line(2 * density, r, s);
-    make_line(1 * density, s, t);
-    std::cerr << "done" << std::endl;
-  }
-
-  void append_star(const int nb_branches, const int density) {
-    std::cerr << "append star...";
-    const double deg_in_rad = 3.1415926535897932384626 / 180.0;
-    const double incr = 180.0 / nb_branches;
-    double angle = 0.0;
-    const Point center(0.5, 0.5);
-    for (int i = 0; i < nb_branches; i++) {
-      const double angle_rad = angle * deg_in_rad;
-      Vector v(sin(angle_rad), cos(angle_rad));
-      Point a = center + v;
-      Point b = center - v;
-      make_line(density, a, b);
-      angle += incr;
-    }
-    std::cerr << "done" << std::endl;
-  }
-
-  void append_predefined_increasingly_sharp_angles(const int density,
-    const double min_angle) {
-    const double deg_in_rad = 3.1415926535897932384626 / 180.0;
-    double prev_angle = 0.0;
-    double curr_angle = min_angle;
-    double incr = min_angle;
-    const double r1 = 0.5;
-    const Point center(0.5, 0.5);
-    while (curr_angle < 360.0) {
-      Vector va(r1 * cos(prev_angle * deg_in_rad),
-        r1 * sin(prev_angle * deg_in_rad));
-      Vector vb(r1 * cos(curr_angle * deg_in_rad),
-        r1 * sin(curr_angle * deg_in_rad));
-      const double average_angle = 0.5 * (prev_angle + curr_angle);
-      Vector vc(r1 * cos(average_angle * deg_in_rad),
-        r1 * sin(average_angle * deg_in_rad));
-      Point a = center + va;
-      Point b = center + vb;
-      Point c = center + 2 * vc;
-
-      make_line(density, a, c);
-      make_line(density, b, c);
-
-      prev_angle = curr_angle;
-      curr_angle += incr;
-      incr += 2.0;
-    }
-    noise(1e-5);
-  }
-};
-
-#endif // SCENE_H_
diff --git a/3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/window.cpp b/3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/window.cpp
deleted file mode 100644
index 4e160e2..0000000
--- a/3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/window.cpp
+++ /dev/null
@@ -1,642 +0,0 @@
-// STL
-#include <fstream>
-
-// Qt
-#include <QtGui>
-#include <QDialog>
-#include <QActionGroup>
-#include <QFileDialog>
-#include <QInputDialog>
-#include <QClipboard>
-
-// local
-#include "window.h"
-#include "ui_options.h"
-#include "dialog_options.h"
-
-MainWindow::MainWindow() : 
-QMainWindow(), Ui_MainWindow(), 
-maxNumRecentFiles(15), recentFileActs(15)
-{
-  setupUi(this);
-
-  // init scene
-  m_scene = new Scene;
-  viewer->set_scene(m_scene);
-
-  // options
-  m_verbose = 0;
-  m_mchoice = 0;
-  m_relevance = 1.0;
-  m_use_flip = true;
-  m_percent  = 100.0;
-  m_relocation = 2;
-
-  // accepts drop events
-  setAcceptDrops(true);
-
-  // Handling actions
-  addRecentFiles(menuFile, actionQuit);
-  connect(actionQuit, SIGNAL(triggered()), this, SLOT(close()));
-  connect(this, SIGNAL(openRecentFile(QString)), this, SLOT(open(QString)));
-  Q_EMIT update();
-  viewer->update();
-}
-
-MainWindow::~MainWindow()
-{
-  delete m_scene;
-}
-
-void MainWindow::addToRecentFiles(QString fileName)
-{
-  QSettings settings;
-  QStringList files = settings.value("recentFileList").toStringList();
-  files.removeAll(fileName);
-  files.prepend(fileName);
-  while (files.size() > (int)maxNumRecentFiles)
-    files.removeLast();
-  settings.setValue("recentFileList", files);
-  updateRecentFileActions();
-}
-
-void MainWindow::dropEvent(QDropEvent *event)
-{
-  Q_FOREACH(QUrl url, event->mimeData()->urls())
-  {
-    QString filename = url.toLocalFile();
-    if (!filename.isEmpty())
-    {
-      QTextStream(stderr) << QString("dropEvent(\"%1\")\n").arg(filename);
-      open(filename);
-    }
-  }
-  event->acceptProposedAction();
-}
-
-void MainWindow::closeEvent(QCloseEvent *event)
-{
-  event->accept();
-}
-
-void MainWindow::dragEnterEvent(QDragEnterEvent *event)
-{
-  if (event->mimeData()->hasFormat("text/uri-list"))
-    event->acceptProposedAction();
-}
-
-void MainWindow::openRecentFile_aux()
-{
-  QAction* action = qobject_cast<QAction*>(sender());
-  if (action)
-    Q_EMIT openRecentFile(action->data().toString());
-}
-
-void MainWindow::updateRecentFileActions()
-{
-  QSettings settings;
-  QStringList files = settings.value("recentFileList").toStringList();
-
-  int numRecentFiles = qMin(files.size(), (int)maxNumberOfRecentFiles());
-  for (int i = 0; i < numRecentFiles; ++i) {
-    QString strippedName = QFileInfo(files[i]).fileName();
-    QString text = tr("&%1 %2").arg(i).arg(strippedName);
-    recentFileActs[i]->setText(text);
-    recentFileActs[i]->setData(files[i]);
-    recentFileActs[i]->setVisible(true);
-  }
-  for (unsigned int j = numRecentFiles; j < maxNumberOfRecentFiles(); ++j)
-    recentFileActs[j]->setVisible(false);
-
-  recentFilesSeparator->setVisible(numRecentFiles > 0);
-}
-
-void MainWindow::addRecentFiles(QMenu* menu, QAction* insertBeforeAction)
-{
-  if (insertBeforeAction)
-    recentFilesSeparator = menu->insertSeparator(insertBeforeAction);
-  else
-    recentFilesSeparator = menu->addSeparator();
-  recentFilesSeparator->setVisible(false);
-
-  for (unsigned int i = 0; i < maxNumberOfRecentFiles(); ++i) {
-    recentFileActs[i] = new QAction(this);
-    recentFileActs[i]->setVisible(false);
-    connect(recentFileActs[i], SIGNAL(triggered()), this, SLOT(openRecentFile_aux()));
-    if (insertBeforeAction)
-      menu->insertAction(insertBeforeAction, recentFileActs[i]);
-    else
-      menu->addAction(recentFileActs[i]);
-  }
-  updateRecentFileActions();
-}
-
-void MainWindow::open(const QString& filename)
-{
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-  m_scene->load(filename, this);
-  QApplication::restoreOverrideCursor();
-  addToRecentFiles(filename);
-  on_actionRecenter_triggered();
-  update();
-}
-
-void MainWindow::save(const QString& filename)
-{
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-  m_scene->save(filename);
-  QApplication::restoreOverrideCursor();
-}
-
-void MainWindow::update()
-{
-  viewer->repaint();
-}
-
-void MainWindow::on_actionClear_triggered()
-{
-  m_scene->clear();
-  update();
-}
-
-void MainWindow::on_actionLoadPoints_triggered()
-{
-  QString fileName =
-      QFileDialog::getOpenFileName(this, tr("Open point set"), ".");
-  if (fileName.isEmpty()) return;
-  open(fileName);
-}
-
-void MainWindow::on_actionSave_triggered()
-{
-  QString filename =
-    QFileDialog::getSaveFileName(this, tr("Save point set"), ".", tr("*.xy"));
-  if (filename.isEmpty()) return;
-  save(filename);
-}
-
-
-void MainWindow::on_actionInsertPoint_toggled() 
-{
-  viewer->toggle_insert_points();
-  update();
-}
-
-void MainWindow::on_actionRecenter_triggered() 
-{
-  double center_x, center_y, scale;
-  m_scene->compute_bbox(center_x, center_y, scale);
-  viewer->set_camera(center_x, center_y, 1. / scale);
-  update();
-}
-
-
-///////////////////////////
-// PREDEFINED POINT SETS //
-///////////////////////////
-
-void MainWindow::on_actionCircle_triggered()
-{
-  bool ok;
-  int density = QInputDialog::getInt(
-      this, tr("Density"), tr("Density:"), 300, 10, 10000, 1, &ok);
-  if (!ok) return;
-
-  float x = QInputDialog::getDouble(
-      this, tr("Center x"), tr("Center x:"), 0.0, 0.0, 10, 1, &ok);
-  if (!ok) return;
-
-  float y = QInputDialog::getDouble(
-      this, tr("Center y"), tr("Center y:"), 0.0, 0.0, 10, 1, &ok);
-  if (!ok) return;
-
-  float radius = QInputDialog::getDouble(
-      this, tr("Radius"), tr("Radius:"), 0.5, 0.1, 10, 1, &ok);
-  if (!ok) return;
-
-  m_scene->append_predefined_circle(density, x, y, radius);
-  update();
-}
-
-void MainWindow::on_actionHalf_circle_triggered()
-{
-  bool ok;
-  unsigned int density = QInputDialog::getInt(
-      this, tr("Density"), tr("Density:"), 150, 10, 10000, 1, &ok);
-  if (!ok) return;
-
-  m_scene->append_predefined_half_circle(density);
-  update();
-}
-
-void MainWindow::on_actionSpiral_triggered()
-{
-  bool ok;
-
-  int loops = QInputDialog::getInt(
-      this, tr("Loops"), tr("Number:"), 3, 1, 10000, 1, &ok);
-  if (!ok) return;
-
-  int density = QInputDialog::getInt(
-      this, tr("Density"), tr("Density:"), 10, 1, 10000, 1, &ok);
-  if (!ok) return;
-
-  m_scene->append_predefined_spiral(loops,density);
-  update();
-}
-
-
-void MainWindow::on_actionLine_triggered()
-{
-  bool ok;
-  unsigned int density = QInputDialog::getInt(
-      this, tr("Density"), tr("Density:"), 50, 1, 10000, 1, &ok);
-  if (!ok) return;
-
-  m_scene->append_predefined_line(density);
-  update();
-}
-
-void MainWindow::on_actionBox_triggered()
-{
-  bool ok;
-  int density = QInputDialog::getInt(
-      this, tr("Density"), tr("Density:"), 100, 1, 10000, 1, &ok);
-  if (!ok) return;
-
-  float x = QInputDialog::getDouble(
-      this, tr("x"), tr("x:"), 0.0, 0.0, 10.0, 1, &ok);
-  if (!ok) return;
-
-  float y = QInputDialog::getDouble(
-      this, tr("y"), tr("y:"), 0.0, 0.0, 10.0, 1, &ok);
-  if (!ok) return;
-
-  float sx = QInputDialog::getDouble(
-      this, tr("size x"), tr("size x:"), 1.0, 0.1, 10.0, 1, &ok);
-  if (!ok) return;
-
-  float sy = QInputDialog::getDouble(
-      this, tr("size y"), tr("size y:"), 1.0, 0.1, 10.0, 1, &ok);
-  if (!ok) return;
-
-  m_scene->append_predefined_box(density, x, y, sx, sy);
-  update();
-}
-
-void MainWindow::on_actionBoxes_triggered()
-{
-  bool ok;
-  unsigned int density = QInputDialog::getInt(
-      this, tr("Density"), tr("Density:"), 10, 1, 10000, 1, &ok);
-  if (!ok) return;
-
-  m_scene->append_predefined_boxes(density);
-  update();
-}
-
-void MainWindow::on_actionParallel_lines_triggered()
-{
-  bool ok;
-
-  int lines = QInputDialog::getInt(
-      this, tr("Lines"), tr("Number:"), 3, 1, 10000, 1, &ok);
-  if(!ok) return;
-
-  float space = QInputDialog::getDouble(
-      this, tr("Space"), tr("Space:"), 0.2, 0.1, 10, 1, &ok);
-  if (!ok) return;
-
-  int density = QInputDialog::getInt(
-      this, tr("Density"), tr("Density:"), 10, 1, 10000, 1, &ok);
-  if(!ok) return;
-
-  m_scene->append_predefined_parallel_lines(lines, space, density);
-  update();
-}
-
-void MainWindow::on_actionBox_with_boundaries_triggered()
-{
-  bool ok;
-  unsigned int density = QInputDialog::getInt(
-      this, tr("Density"), tr("Density:"), 10, 1, 10000, 1, &ok);
-  if (!ok) return;
-
-  m_scene->append_predefined_box_with_boundaries(density);
-  update();
-}
-
-void MainWindow::on_actionBox_with_missing_corners_triggered()
-{
-  bool ok;
-  unsigned int density = QInputDialog::getInt(
-      this, tr("Density"), tr("Density:"), 10, 1, 10000, 1, &ok);
-  if (!ok) return;
-
-  m_scene->append_predefined_box_with_missing_corners(density);
-  update();
-}
-
-void MainWindow::on_actionStar_triggered()
-{
-  bool ok;
-  int nb_branches = QInputDialog::getInt(
-      this, tr("Branches"), tr("Branches:"), 20, 2, 10000, 1, &ok);
-  if(!ok) return;
-
-  int density = QInputDialog::getInt(
-      this, tr("Density"), tr("Density:"), 100, 10, 10000, 1, &ok);
-  if(!ok) return;
-
-  m_scene->append_star(nb_branches,density);
-  update();
-}
-
-
-void MainWindow::on_actionStair_triggered()
-{
-  bool ok;
-  unsigned int density = QInputDialog::getInt(
-      this, tr("Density"), tr("Density:"), 30, 2, 10000, 1, &ok);
-  if (!ok) return;
-
-  m_scene->append_predefined_stair(density);
-  on_actionRecenter_triggered();
-  update();
-}
-
-void MainWindow::on_actionSkyline_triggered()
-{
-  bool ok;
-  unsigned int density = QInputDialog::getInt(
-      this, tr("Density"), tr("Density:"), 10, 1, 10000, 1, &ok);
-  if (!ok) return;
-
-  m_scene->append_predefined_skyline(density);
-  on_actionRecenter_triggered();
-  update();
-}
-
-void MainWindow::on_actionIncreasingly_sharp_angles_triggered()
-{
-  bool ok;
-  unsigned int density = QInputDialog::getInt(
-      this, tr("Density"), tr("Density:"), 100, 1, 10000, 1, &ok);
-  if (!ok) return;
-
-  double min_angle = QInputDialog::getDouble(
-      this, tr("Min Angle"), tr("Min Angle:"), 1.0, 1.0, 360.0, 1.0, &ok);
-  if (!ok) return;
-
-  m_scene->append_predefined_increasingly_sharp_angles(density, min_angle);
-  on_actionRecenter_triggered();
-  update();
-}
-
-void MainWindow::on_actionWidely_variable_sampling_triggered()
-{
-  bool ok;
-  float d1 = QInputDialog::getDouble(
-      this, tr("Delta-angle"), tr("Delta-angle:"), 1, 0.01, 20.0, 2, &ok);
-  if (!ok) return;
-
-  float d2 = QInputDialog::getDouble(
-      this, tr("Delta-angle"), tr("Delta-angle:"), 10, 0.01, 30.0, 2, &ok);
-  if (!ok) return;
-
-  m_scene->append_widely_variable_sampling(d1, d2);
-  update();
-}
-
-void MainWindow::on_actionNoise_triggered()
-{
-  bool ok;
-  double noise = QInputDialog::getDouble(
-      this, tr("Noise"), tr("Amount:"), 0.003, 0.0, 1000.0, 8, &ok);
-  if (!ok) return;
-
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-  m_scene->noise(noise);
-  QApplication::restoreOverrideCursor();
-  update();
-}
-
-void MainWindow::on_actionAdd_outliers_triggered()
-{
-  bool ok;
-  unsigned int nb = (unsigned)
-        QInputDialog::getInt(
-            this, tr("Outliers"), tr("How many:"), 10, 1, 100000, 1, &ok);
-  if (!ok) return;
-
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-  m_scene->add_outliers(nb);
-  QApplication::restoreOverrideCursor();
-  update();
-}
-
-void MainWindow::on_actionSubdivide_triggered()
-{
-  m_scene->subdivide();
-  update();
-}
-
-void MainWindow::on_actionDecimate_triggered()
-{
-  bool ok;
-  int percent = QInputDialog::getInt(
-      this, tr("Decimate"), tr("Percentage:"), 50, 1, 100, 1, &ok);
-  if (!ok) return;
-
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-  const double percentage = double(percent) / 100.0;
-  m_scene->decimate(percentage);
-  QApplication::restoreOverrideCursor();
-  update();
-}
-
-
-////////////////////
-// RECONSTRUCTION //
-////////////////////
-
-void MainWindow::set_scene_options()
-{
-  m_scene->set_options(m_verbose, m_mchoice, m_use_flip,
-      m_relocation, m_relevance);
-}
-
-void MainWindow::on_actionReconstruction_reinit_triggered()
-{
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-  set_scene_options();
-  m_scene->init_reconstruction(percentage());
-  QApplication::restoreOverrideCursor();
-  update();
-}
-
-void MainWindow::on_actionReconstruction_one_step_triggered()
-{
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-  set_scene_options();
-  m_scene->reconstruct(1);
-  QApplication::restoreOverrideCursor();
-  update();
-}
-
-void MainWindow::on_actionReconstruction_10_steps_triggered()
-{
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-  set_scene_options();
-  m_scene->reconstruct(10);
-  QApplication::restoreOverrideCursor();
-  update();
-}
-
-void MainWindow::on_actionReconstruction_100_steps_triggered()
-{
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-  set_scene_options();
-  m_scene->reconstruct(100);
-  QApplication::restoreOverrideCursor();
-  update();
-}
-
-void MainWindow::on_actionReconstruction_1000_steps_triggered()
-{
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-  set_scene_options();
-  m_scene->reconstruct(1000);
-  QApplication::restoreOverrideCursor();
-  update();
-}
-
-void MainWindow::on_actionReconstruction_until_triggered()
-{
-  bool ok;
-  int nb_points = QInputDialog::getInt(
-      this, tr("Number of Points"), tr("Nb:"), 4, 1, 1000000, 1, &ok);
-  if (!ok) return;
-
-  set_scene_options();
-
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-  m_scene->reconstruct_until(nb_points);
-  QApplication::restoreOverrideCursor();
-
-  update();
-}
-
-void MainWindow::on_actionRelocate_vertices_triggered()
-{
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-  m_scene->relocate_all_points();
-  QApplication::restoreOverrideCursor();
-  update();
-}
-
-void MainWindow::on_actionOutput_console_triggered()
-{
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-  m_scene->output_console();
-  QApplication::restoreOverrideCursor();
-  update();
-}
-
-
-
-//////////
-// VIEW //
-//////////
-
-void MainWindow::on_actionView_points_toggled()
-{
-  viewer->toggle_view_points();
-  update();
-}
-
-void MainWindow::on_actionView_vertices_toggled()
-{
-  viewer->toggle_view_vertices();
-  update();
-}
-
-void MainWindow::on_actionView_edges_toggled()
-{
-  viewer->toggle_view_edges();
-  update();
-}
-
-void MainWindow::on_actionView_ghost_toggled()
-{
-  viewer->toggle_view_ghost_edges();
-  update();
-}
-
-void MainWindow::on_actionView_edge_cost_toggled()
-{
-  viewer->toggle_view_edge_cost();
-  update();
-}
-
-void MainWindow::on_actionView_edge_priority_toggled()
-{
-  viewer->toggle_view_edge_priority();
-  update();
-}
-
-void MainWindow::on_actionView_bins_toggled()
-{
-  viewer->toggle_view_bins();
-  update();
-}
-
-void MainWindow::on_actionView_foot_points_toggled()
-{
-  viewer->toggle_view_foot_points();
-  update();
-}
-
-void MainWindow::on_actionView_relocation_toggled()
-{
-  viewer->toggle_view_relocation();
-  update();
-}
-
-void MainWindow::on_actionView_relevance_toggled()
-{
-  viewer->toggle_view_edge_relevance();
-  update();
-}
-
-void MainWindow::on_actionSet_options_triggered()
-{
-  Dialog_options dlg;
-  dlg.set_all_ranges();
-  dlg.set_verbose(m_verbose);
-  dlg.set_random_sample_size(m_mchoice);
-  dlg.set_percent(m_percent);
-  dlg.set_relocation(m_relocation);
-  dlg.set_relevance(m_relevance);
-  dlg.set_use_flip(m_use_flip);
-  dlg.set_multiple_choice_checkbox(m_mchoice != 0);
-  dlg.set_line_thickness(viewer->line_thickness());
-  dlg.set_point_size(viewer->point_size());
-  dlg.set_vertex_size(viewer->vertex_size());
-
-  if (dlg.exec() == QDialog::Accepted)
-  {
-    m_verbose = dlg.get_verbose();
-    m_mchoice = dlg.get_mchoice();
-    m_percent = dlg.get_percent();
-    m_relocation = dlg.get_relocation();
-    m_relevance  = dlg.get_relevance();
-    m_use_flip   = dlg.get_use_flip();
-
-    set_scene_options();
-    viewer->line_thickness() = dlg.get_line_thickness();
-    viewer->point_size()  = dlg.get_point_size();
-    viewer->vertex_size() = dlg.get_vertex_size();
-    update();
-  }
-}
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/CMakeLists.txt
deleted file mode 100644
index cb1a4a8..0000000
--- a/3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/CMakeLists.txt
+++ /dev/null
@@ -1,61 +0,0 @@
-project (Periodic_2_Triangulation_2_demo)
-
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-find_package(CGAL COMPONENTS Qt5)
-
-include(${CGAL_USE_FILE})
-
-
-
-find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
-include_directories (BEFORE ../../../include)
-include_directories (BEFORE ./include)
-
-if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
-
-add_definitions(-DQT_NO_KEYWORDS)
-
-
-#--------------------------------
-# The "2D Periodic triangulation" demo: Periodic_2_triangulation_2
-#--------------------------------
-# UI files (Qt Designer files)
-qt5_wrap_ui( DT_UI_FILES Periodic_2_triangulation_2.ui )
-
-# qrc files (resources files, that contain icons, at least)
-qt5_add_resources ( DT_RESOURCE_FILES ./Periodic_2_triangulation_2.qrc )
-
-# use the Qt MOC preprocessor on classes that derives from QObject
-qt5_generate_moc( Periodic_2_Delaunay_triangulation_2.cpp Periodic_2_triangulation_2.moc )
-
-# find header files for projects that can show them
-file(GLOB headers "*.h")
-file(GLOB QT_headers "include/CGAL/Qt/*.h")
-file(GLOB P2T2_headers "../../../include/CGAL/*.h")
-SOURCE_GROUP("P2T2" FILES ${P2T2_headers})
-SOURCE_GROUP("QT" FILES ${QT_headers})
-
-# The executable itself.
-add_executable  ( Periodic_2_Delaunay_triangulation_2 
-  Periodic_2_Delaunay_triangulation_2.cpp
-  Periodic_2_triangulation_2.moc 
-  ${DT_UI_FILES} ${DT_RESOURCE_FILES} 
-  ${headers} ${QT_headers} ${P2T2_headers})
-
-qt5_use_modules( Periodic_2_Delaunay_triangulation_2 Xml Script OpenGL Svg)
-
-add_to_cached_list( CGAL_EXECUTABLE_TARGETS Periodic_2_Delaunay_triangulation_2 )
-
-# Link with Qt libraries
-target_link_libraries( Periodic_2_Delaunay_triangulation_2 ${QT_LIBRARIES} )
-# Link with CGAL
-target_link_libraries( Periodic_2_Delaunay_triangulation_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES})
-else()
-
-  message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
-
-endif()
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/CMakeLists.txt
deleted file mode 100644
index 1da698a..0000000
--- a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/CMakeLists.txt
+++ /dev/null
@@ -1,102 +0,0 @@
-
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-project( Periodic_3_triangulation_3_demo )
-
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-# Find CGAL
-find_package(CGAL COMPONENTS Qt5)
-include( ${CGAL_USE_FILE} )
-
-# Find Qt5 itself
-find_package(Qt5 QUIET COMPONENTS Xml OpenGL Help Core)
-
-# Find OpenGL
-find_package(OpenGL)
-
-# Find QGLViewer
-if(Qt5_FOUND)
-  add_definitions(-DQT_NO_KEYWORDS)
-  find_package(QGLViewer)
-endif(Qt5_FOUND)
-
-if (CGAL_FOUND AND CGAL_Qt5_FOUND AND OPENGL_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND AND TARGET Qt5::qcollectiongenerator)
-
-   include_directories( ${QGLVIEWER_INCLUDE_DIR} )
-
-  # UI files (Qt Designer files)
-  qt5_wrap_ui ( UI_FILES MainWindow.ui )
-
-  # qrc files (resource files)
-  qt5_add_resources( RESOURCE_FILES ./Periodic_3_triangulation_3.qrc )
-
-  # use the Qt MOC preprocessor on classes that derive from QObject
-  qt5_generate_moc( "Scene.h" "${CMAKE_CURRENT_BINARY_DIR}/moc_Scene.cpp" )
-  qt5_generate_moc( "MainWindow.h" "${CMAKE_CURRENT_BINARY_DIR}/moc_MainWindow.cpp" )
-  qt5_generate_moc( "Viewer.h" "${CMAKE_CURRENT_BINARY_DIR}/moc_Viewer.cpp" )
-
-  if(DEFINED QT_QCOLLECTIONGENERATOR_EXECUTABLE)
-  else()
-    set(QT_QCOLLECTIONGENERATOR_EXECUTABLE qcollectiongenerator)
-  endif()
-
-  # generate QtAssistant collection file
-  add_custom_command ( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Periodic_3_triangulation_3.qhc
-      DEPENDS Periodic_3_triangulation_3.qhp Periodic_3_triangulation_3.qhcp
-      COMMAND Qt5::qcollectiongenerator
-                 ${CMAKE_CURRENT_SOURCE_DIR}/Periodic_3_triangulation_3.qhcp
-                 -o ${CMAKE_CURRENT_BINARY_DIR}/Periodic_3_triangulation_3.qhc
-  )
-
-  # Make sure the compiler can find generated .moc files
-  include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
-  include_directories( ${QT_INCLUDE_DIR} )
-  include_directories( ../../include .)
-
-  # The executable itself
-  add_executable  ( periodic_3_triangulation_3_demo
-                    Scene.cpp moc_Scene.cpp
-                    Viewer.cpp moc_Viewer.cpp
-                    periodic_3_triangulation_3_demo.cpp
-                    MainWindow.ui moc_MainWindow.cpp
-                    ${UI_FILES} ${RESOURCE_FILES} Periodic_3_triangulation_3.qhc)
-
-  qt5_use_modules(periodic_3_triangulation_3_demo Xml Help OpenGL)
-
-  add_to_cached_list( CGAL_EXECUTABLE_TARGETS periodic_3_triangulation_3_demo)
-
-  # Link the executable to CGAL and third-party libraries
-  target_link_libraries(periodic_3_triangulation_3_demo ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ${QT_LIBRARIES} ${QGLVIEWER_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} )
-
-else ()
-
-  set(PERIODIC_TRIANGULATION_MISSING_DEPS "")
-
-  if(NOT CGAL_Qt5_FOUND)
-    set(PERIODIC_TRIANGULATION_MISSING_DEPS "the CGAL Qt5 library, ${PERIODIC_TRIANGULATION_MISSING_DEPS}")
-  endif()
-
-  if(NOT Qt5_FOUND)
-    set(PERIODIC_TRIANGULATION_MISSING_DEPS "Qt5, ${PERIODIC_TRIANGULATION_MISSING_DEPS}")
-  endif()
-
-  if(NOT OPENGL_FOUND)
-    set(PERIODIC_TRIANGULATION_MISSING_DEPS "OpenGL, ${PERIODIC_TRIANGULATION_MISSING_DEPS}")
-  endif()
-
-  if(NOT QGLVIEWER_FOUND)
-    set(PERIODIC_TRIANGULATION_MISSING_DEPS "QGLViewer, ${PERIODIC_TRIANGULATION_MISSING_DEPS}")
-  endif()
-
-  if (NOT TARGET Qt5::qcollectiongenerator)
-    set(PERIODIC_TRIANGULATION_MISSING_DEPS "qcollectiongenerator, ${PERIODIC_TRIANGULATION_MISSING_DEPS}")
-  endif()
-
-  message(STATUS "NOTICE: This demo requires ${PERIODIC_TRIANGULATION_MISSING_DEPS}and will not be compiled.")
-
-endif ()
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/CMakeLists.txt
deleted file mode 100644
index a4aa152..0000000
--- a/3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/CMakeLists.txt
+++ /dev/null
@@ -1,90 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-project (Periodic_Lloyd_3)
-
-# Find includes in corresponding build directories
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-# Instruct CMake to run moc automatically when needed.
-set(CMAKE_AUTOMOC ON)
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-find_package(CGAL COMPONENTS Qt5)
-include(${CGAL_USE_FILE})
-
-
-find_package(Qt5 QUIET COMPONENTS Xml Script Help OpenGL Svg)
-
-find_package(OpenGL)
-
-if(Qt5_FOUND)
-  find_package(QGLViewer)
-endif(Qt5_FOUND)
-
-if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND AND TARGET Qt5::qcollectiongenerator )
-
-
-  include_directories (${QGLVIEWER_INCLUDE_DIR})
-  include_directories (BEFORE ../../include ./ )
-
-  # ui file, created wih Qt Designer
-  qt5_wrap_ui( uis MainWindow.ui )
-
-  # qrc files (resources files, that contain icons, at least)
-  qt5_add_resources ( RESOURCE_FILES ./Periodic_Lloyd_3.qrc )
-
-
-  if(DEFINED QT_QCOLLECTIONGENERATOR_EXECUTABLE)
-  else()
-    set(QT_QCOLLECTIONGENERATOR_EXECUTABLE qcollectiongenerator)
-  endif()
-
-  # generate QtAssistant collection file
-  add_custom_command ( OUTPUT Periodic_Lloyd_3.qhc
-      DEPENDS Periodic_Lloyd_3.qhp Periodic_Lloyd_3.qhcp
-      COMMAND Qt5::qcollectiongenerator
-                ${CMAKE_CURRENT_SOURCE_DIR}/Periodic_Lloyd_3.qhcp
-                -o ${CMAKE_CURRENT_BINARY_DIR}/Periodic_Lloyd_3.qhc
-      WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
-  )
-
-  add_executable  ( Periodic_Lloyd_3 Periodic_Lloyd_3.qhc Periodic_Lloyd_3.cpp MainWindow.cpp Viewer.cpp ${uis}  ${RESOURCE_FILES} )
-
-  qt5_use_modules(Periodic_Lloyd_3 Xml Script Help OpenGL Svg)
-  add_to_cached_list( CGAL_EXECUTABLE_TARGETS Periodic_Lloyd_3 )
-
-  target_link_libraries( Periodic_Lloyd_3 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES})
-  target_link_libraries( Periodic_Lloyd_3 ${QT_LIBRARIES} ${QGLVIEWER_LIBRARIES} )
-  target_link_libraries( Periodic_Lloyd_3 ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} )
-
-else( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND AND QT_QCOLLECTIONGENERATOR_EXECUTABLE )
-
-  set(PERIODIC_LLOYD_MISSING_DEPS "")
-
-  if(NOT CGAL_Qt5_FOUND)
-    set(PERIODIC_LLOYD_MISSING_DEPS "the CGAL Qt5 library, ${PERIODIC_LLOYD_MISSING_DEPS}")
-  endif()      	   
-
-  if(NOT Qt5_FOUND)
-    set(PERIODIC_LLOYD_MISSING_DEPS "Qt5, ${PERIODIC_LLOYD_MISSING_DEPS}")
-  endif()      	   
-
-  if(NOT OPENGL_FOUND)
-    set(PERIODIC_LLOYD_MISSING_DEPS "OpenGL, ${PERIODIC_LLOYD_MISSING_DEPS}")
-  endif()      	   
-
-  if(NOT QGLVIEWER_FOUND)
-    set(PERIODIC_LLOYD_MISSING_DEPS "QGLViewer, ${PERIODIC_LLOYD_MISSING_DEPS}")
-  endif()      	   
-
-  if(NOT QT_QCOLLECTIONGENERATOR_EXECUTABLE)
-    set(PERIODIC_LLOYD_MISSING_DEPS "qcollectiongenerator, ${PERIODIC_LLOYD_MISSING_DEPS}")
-  endif()
-
-
-  message(STATUS "NOTICE: This demo requires ${PERIODIC_LLOYD_MISSING_DEPS}and will not be compiled.")
-
-endif()
diff --git a/3rdparty/CGAL-4.8/demo/Polygon/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Polygon/CMakeLists.txt
deleted file mode 100644
index bfe8288..0000000
--- a/3rdparty/CGAL-4.8/demo/Polygon/CMakeLists.txt
+++ /dev/null
@@ -1,59 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-project (GraphicsView)
-
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-find_package(CGAL COMPONENTS Qt5 Core)
-
-include(${CGAL_USE_FILE})
-
-find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
-
-include_directories (BEFORE ../../include)
-
-if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
-
-  add_definitions(-DQT_NO_KEYWORDS)
-
-  if( CGAL_Core_FOUND)
-    add_definitions(-DCGAL_USE_CORE)
-  endif()
-
-  #--------------------------------
-  # Demo: Polygon_2
-  #--------------------------------
-  # UI files (Qt Designer files)
-  qt5_wrap_ui( DT_UI_FILES Polygon_2.ui )
-
-  # qrc files (resources files, that contain icons, at least)
-  qt5_add_resources ( DT_RESOURCE_FILES ./Polygon_2.qrc )
-
-  # use the Qt MOC preprocessor on classes that derives from QObject
-  qt5_generate_moc( Polygon_2.cpp "${CMAKE_CURRENT_BINARY_DIR}/Polygon_2.moc" )
-
-#  add_library( CGAL SHARED IMPORTED ) 
-#  SET_PROPERTY(TARGET CGAL PROPERTY IMPORTED_LOCATION ${CGAL_LIBRARY} )
-
-  # The executable itself.
-  add_executable  ( Polygon_2 Polygon_2.cpp Polygon_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} )
-
-  qt5_use_modules(Polygon_2 Xml Script OpenGL Svg)
-
-  add_to_cached_list( CGAL_EXECUTABLE_TARGETS Polygon_2 )
-
-
-  # Link with Qt libraries
-  target_link_libraries( Polygon_2 ${QT_LIBRARIES} )
-  # And with CGAL libraries
-  target_link_libraries( Polygon_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} )
-
-else()
-
-  message(STATUS "NOTICE: This demo requires CGAL, CGAL_Core, and Qt5, and will not be compiled.")
-
-endif()
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Polyhedron/CMakeLists.txt
deleted file mode 100644
index 266bcd4..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/CMakeLists.txt
+++ /dev/null
@@ -1,382 +0,0 @@
-# This is the CMake script for compiling the CGAL Polyhedron demo.
-
-project( Polyhedron )
-# Find includes in corresponding build directories
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-# Instruct CMake to run moc automatically when needed.
-set(CMAKE_AUTOMOC ON)
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-# Compatibility with CMake 3.0
-if(POLICY CMP0042)
-  # Do not enable the use of MACOSX_RPATH
-  # http://www.cmake.org/cmake/help/v3.0/policy/CMP0042.html
-  cmake_policy(SET CMP0042 OLD)
-endif()
-
-#Defines flags to emulate windows behavior for linking error generation
-if(CMAKE_CXX_COMPILER_ID EQUAL Clang OR CMAKE_COMPILER_IS_GNUCC  OR CMAKE_COMPILER_IS_GNUCXX)
-  if(UNIX OR APPLE)
-    SET( CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS} -fvisibility=hidden" )
-  endif()
-  if(UNIX AND NOT APPLE)
-    SET( CMAKE_EXE_LINKER_FLAGS  "${CMAKE_EXE_LINKER_FLAGS} -z defs")
-    SET( CMAKE_MODULE_LINKER_FLAGS  "${CMAKE_MODULE_LINKER_FLAGS} -z defs")
-    SET( CMAKE_SHARED_LINKER_FLAGS  "${CMAKE_SHARED_LINKER_FLAGS} -z defs")
-  endif()
-endif()
-# Let plugins be compiled in the same directory as the executable.
-set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
-
-# Include this package's headers first
-include_directories( BEFORE ./ ./include ../../include ./CGAL_demo )
-list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}")
-
-add_subdirectory( implicit_functions )
-
-# Find CGAL
-
-option( POLYHEDRON_QTSCRIPT_DEBUGGER 
-  "Activate the use of Qt Script Debugger in Polyhedron_3 demo" OFF)
-
-# Find Qt5 itself
-find_package(CGAL COMPONENTS Qt5 ImageIO)
-include( ${CGAL_USE_FILE} )
-
-find_package(Qt5
-             QUIET
-             COMPONENTS            OpenGL Script Svg Xml
-             OPTIONAL_COMPONENTS   ScriptTools)
-
-# Find OpenGL
-find_package(OpenGL)
-
-# Find QGLViewer
-if(Qt5_FOUND)
-
-  add_definitions(-DQT_NO_KEYWORDS)
-  add_definitions(-DSCENE_SEGMENTED_IMAGE_GL_BUFFERS_AVAILABLE)
-  find_package(QGLViewer )
-
-endif(Qt5_FOUND)
-
-find_package(Eigen3 3.2.0) #(requires 3.2.0 or greater)
-if (EIGEN3_FOUND)
-  include( ${EIGEN3_USE_FILE} )
-endif(EIGEN3_FOUND)
-
-# Activate concurrency?
-option(POLYHEDRON_DEMO_ACTIVATE_CONCURRENCY
-  "Enable concurrency"
-  ON)
-
-if( POLYHEDRON_DEMO_ACTIVATE_CONCURRENCY )
-  find_package( TBB )
-  if( TBB_FOUND )
-    include( ${TBB_USE_FILE} )
-    list( APPEND CGAL_3RD_PARTY_LIBRARIES ${TBB_LIBRARIES} )
-  else()
-    message( STATUS "NOTICE: Intel TBB was not found. Bilateral smoothing and WLOP plugins are faster if TBB is linked." )
-  endif()
-endif()
-
-
-# Activate concurrency ? (turned OFF by default)
-option(ACTIVATE_CONCURRENT_MESH_3
-  "Activate parallelism in Mesh_3"
-  OFF)
-
-# And add -DCGAL_CONCURRENT_MESH_3 if that option is ON
-if( ACTIVATE_CONCURRENT_MESH_3 OR ENV{ACTIVATE_CONCURRENT_MESH_3} )
-  add_definitions( -DCGAL_CONCURRENT_MESH_3 )
-  if(NOT TBB_FOUND)
-    find_package( TBB REQUIRED )
-    if( TBB_FOUND )
-      include(${TBB_USE_FILE})
-      list(APPEND CGAL_3RD_PARTY_LIBRARIES ${TBB_LIBRARIES})
-    else()
-      message(STATUS "NOTICE: Intel TBB was not found. Mesh_3 is faster if TBB is linked.")
-    endif()
-  endif()
-
-else( ACTIVATE_CONCURRENT_MESH_3 OR ENV{ACTIVATE_CONCURRENT_MESH_3} )
-  option( LINK_WITH_TBB
-    "Link with TBB anyway so we can use TBB timers for profiling"
-    ON)
-  if( LINK_WITH_TBB )
-    find_package( TBB )
-  endif( LINK_WITH_TBB )
-endif()
-
-
-
-
-if(CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
-
-  set(Boost_USE_MULTITHREADED      ON)
-  find_package(Boost COMPONENTS thread system)
-
-  include_directories ( ${QGLVIEWER_INCLUDE_DIR} )
-  qt5_wrap_ui( MainWindowUI_files MainWindow.ui)
-  qt5_wrap_ui( statisticsUI_FILES Statistics_on_item_dialog.ui)
-  qt5_wrap_ui( FileLoaderDialogUI_files FileLoaderDialog.ui )
-  qt5_wrap_ui( Show_point_dialogUI_FILES Show_point_dialog.ui )
-  qt5_wrap_ui( PreferencesUI_FILES   Preferences.ui )
-  qt5_wrap_ui( Show_point_dialogUI_FILES Show_point_dialog.ui )
-  qt5_generate_moc( "File_loader_dialog.h" "${CMAKE_CURRENT_BINARY_DIR}/File_loader_dialog_moc.cpp" )
-  add_file_dependencies( File_loader_dialog_moc_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/File_loader_dialog.h" )
-
-  qt5_generate_moc( "Viewer.h" "${CMAKE_CURRENT_BINARY_DIR}/Viewer_moc.cpp" )
-  add_file_dependencies( Viewer_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/Viewer.h" )
-
-  include( ${CMAKE_CURRENT_SOURCE_DIR}/polyhedron_demo_macros.cmake )
-
-
-  qt5_add_resources ( RESOURCE_FILES Polyhedron_3.qrc )
-  qt5_add_resources(gl_splat_rc GlSplat/glsplat.qrc)
-  add_library(gl_splat SHARED
-      GlSplat/GlSplat.cpp GlSplat/Shader.cpp ${gl_splat_rc})
-  qt5_use_modules(gl_splat OpenGL Gui Xml)
-
-  find_path(CGAL_THREE_VIEWER_INTERFACE_H_PATH
-    NAME CGAL/Three/Viewer_interface.h
-    PATHS ${CGAL_INCLUDE_DIRS}
-    NO_DEFAULT_PATH
-    DOC "Path to CGAL/Three/Viewer_interface.h")
-  hide_variable(CGAL_THREE_VIEWER_INTERFACE_H_PATH)
-  if(CGAL_THREE_VIEWER_INTERFACE_H_PATH)
-    qt5_generate_moc( "${CGAL_THREE_VIEWER_INTERFACE_H_PATH}/CGAL/Three/Viewer_interface.h"
-      "${CMAKE_CURRENT_BINARY_DIR}/Viewer_interface_moc.cpp" )
-  else()
-    message(FATAL_ERROR "Cannot find <CGAL/Three/Viewer_interface.h>")
-  endif()
-
-  find_path(CGAL_THREE_SCENE_ITEM_H_PATH
-    NAME CGAL/Three/Scene_item.h
-    PATHS ${CGAL_INCLUDE_DIRS}
-    NO_DEFAULT_PATH
-    DOC "Path to CGAL/Three/Scene_item.h")
-  hide_variable(CGAL_THREE_SCENE_ITEM_H_PATH)
-
-  find_path(CGAL_THREE_SCENE_GROUP_ITEM_H_PATH
-    NAME CGAL/Three/Scene_group_item.h
-    PATHS ${CGAL_INCLUDE_DIRS}
-    NO_DEFAULT_PATH
-    DOC "Path to CGAL/Three/Scene_group_item.h")
-  hide_variable(CGAL_THREE_SCENE_GROUP_ITEM_H_PATH)
-
-  if(CGAL_THREE_SCENE_ITEM_H_PATH)
-    qt5_generate_moc( "${CGAL_THREE_SCENE_ITEM_H_PATH}/CGAL/Three/Scene_item.h"
-      "${CMAKE_CURRENT_BINARY_DIR}/Scene_item_moc.cpp" )
-  else()
-    message(FATAL_ERROR "Cannot find <CGAL/Three/Viewer_interface.h>")
-  endif()
-
-  if(CGAL_THREE_SCENE_GROUP_ITEM_H_PATH)
-    qt5_generate_moc( "${CGAL_THREE_SCENE_GROUP_ITEM_H_PATH}/CGAL/Three/Scene_group_item.h"
-      "${CMAKE_CURRENT_BINARY_DIR}/Scene_group_item_moc.cpp" )
-  else()
-    message(FATAL_ERROR "Cannot find <CGAL/Three/Scene_group_item.h>")
-  endif()
-
-
-  # AUXILIARY LIBRARIES
-
-  # put s (which are shared libraries) at the same location as
-  # executable files
-  set(CGAL_POLYHEDRON_DEMO_PLUGINS_DIR "${RUNTIME_OUTPUT_PATH}")
-  set(LIBRARY_OUTPUT_PATH "${CGAL_POLYHEDRON_DEMO_PLUGINS_DIR}")
-
-  add_library(demo_framework SHARED
-    Scene.cpp
-    Viewer.cpp
-    Viewer_interface_moc.cpp
-    Scene_item_moc.cpp
-    Scene_item.cpp
-    Scene_group_item.cpp
-    Scene_group_item_moc.cpp
-    Polyhedron_demo_plugin_helper.cpp)
-    qt5_use_modules(demo_framework OpenGL Gui Widgets Script Xml)
-
-  target_link_libraries(demo_framework
-    ${QGLVIEWER_LIBRARIES}
-    ${OPENGL_gl_LIBRARY}
-    ${OPENGL_glu_LIBRARY}
-    )
-
-  add_library(scene_basic_objects SHARED
-    Scene_plane_item.cpp
-)
-  target_link_libraries(scene_basic_objects 
-    demo_framework
-    ${CGAL_LIBRARIES}
-    ${QGLVIEWER_LIBRARIES}
-    ${OPENGL_gl_LIBRARY}
-    ${OPENGL_glu_LIBRARY}
-    )
-  qt5_use_modules(scene_basic_objects OpenGL Gui Xml Script Widgets)
-  add_library(point_dialog SHARED Show_point_dialog.cpp Show_point_dialog.ui ${Show_point_dialogUI_FILES})
-  qt5_use_modules(point_dialog OpenGL Gui Xml Script Widgets)
-
-  macro(add_item item_name)
-    add_library(${item_name} SHARED ${ARGN})
-    qt5_use_modules(${item_name} OpenGL Gui Xml Script Widgets)
-    target_link_libraries(${item_name} demo_framework ${CGAL_LIBRARIES} ${Boost_LIBRARIES})
-  endmacro(add_item)
-
-  add_item(scene_c2t3_item Scene_c2t3_item.cpp)
-  add_item(scene_c3t3_item Scene_c3t3_item.cpp)
-  target_link_libraries(scene_c3t3_item scene_polyhedron_item scene_polygon_soup_item ${TBB_LIBRARIES})
-  add_item(scene_polyhedron_item Scene_polyhedron_item.cpp)
-  add_item(scene_polyhedron_transform_item Plugins/PCA/Scene_polyhedron_transform_item.cpp )
-
-  add_item(scene_segmented_image_item Scene_segmented_image_item.cpp)
- 
-  # special
-  target_link_libraries(scene_polyhedron_transform_item scene_polyhedron_item)
-
-  add_item(scene_combinatorial_map_item Plugins/Operations_on_polyhedra/Scene_combinatorial_map_item.cpp)
-  # special
-  target_link_libraries(scene_combinatorial_map_item scene_polyhedron_item)
-
-  add_item(scene_polylines_item Scene_polylines_item.cpp)
-
-  add_item(scene_polyhedron_item_decorator Scene_polyhedron_item_decorator.cpp )
-  target_link_libraries(scene_polyhedron_item_decorator scene_polyhedron_item)
-  
-  add_item(scene_polyhedron_item_k_ring_selection Scene_polyhedron_item_k_ring_selection.cpp)
-  target_link_libraries(scene_polyhedron_item_k_ring_selection scene_polyhedron_item)
- 
-  add_item(scene_polyhedron_selection_item Scene_polyhedron_selection_item.cpp)
-  target_link_libraries(scene_polyhedron_selection_item scene_polyhedron_item_decorator scene_polyhedron_item_k_ring_selection)
-
-  add_item(scene_polyhedron_shortest_path_item Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.cpp)
-  
-  target_link_libraries(scene_polyhedron_shortest_path_item scene_polyhedron_item_decorator scene_polyhedron_item scene_polylines_item)
-
-  if(EIGEN3_FOUND )
-    qt5_wrap_ui( editionUI_FILES Plugins/Surface_mesh_deformation/Deform_mesh.ui )
-    add_item(scene_textured_polyhedron_item Scene_textured_polyhedron_item.cpp texture.cpp)
-    add_item(scene_edit_polyhedron_item Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp
-           ${editionUI_FILES})
-    target_link_libraries(scene_edit_polyhedron_item scene_polyhedron_item scene_polyhedron_item_k_ring_selection)
-  endif()
-
-  add_item(scene_implicit_function_item Scene_implicit_function_item.cpp  Color_ramp.cpp )
-
-  add_item(scene_polygon_soup_item Scene_polygon_soup_item.cpp)
-  target_link_libraries(scene_polygon_soup_item scene_polyhedron_item)
-  add_item(scene_nef_polyhedron_item Scene_nef_polyhedron_item.cpp)
-  
-  target_link_libraries(scene_nef_polyhedron_item scene_polyhedron_item)
-  add_item(scene_points_with_normal_item Scene_points_with_normal_item.cpp)
-  target_link_libraries( scene_points_with_normal_item gl_splat)
-  target_link_libraries( demo_framework gl_splat)
-  
-  
-
-
-  foreach( lib 
-      demo_framework
-      scene_basic_objects
-      scene_polyhedron_item
-      scene_polygon_soup_item
-      scene_nef_polyhedron_item)
-    add_to_cached_list( CGAL_EXECUTABLE_TARGETS ${lib} )
-  endforeach()
-
-  add_definitions( -DUSE_FORWARD_DECL)
-  add_library(polyhedron_demo SHARED
-    MainWindow.cpp
-    Polyhedron_demo.cpp
-    File_loader_dialog_moc.cpp
-    ${FileLoaderDialogUI_files} ${MainWindowUI_files} ${PreferencesUI_FILES} ${RESOURCE_FILES} ${statisticsUI_FILES})
-  target_link_libraries(polyhedron_demo demo_framework point_dialog)
-  qt5_use_modules(polyhedron_demo Gui OpenGL Xml Widgets Script Svg )
-  add_executable  ( Polyhedron_3 Polyhedron_3.cpp )
-  target_link_libraries( Polyhedron_3 polyhedron_demo )
-  add_to_cached_list( CGAL_EXECUTABLE_TARGETS Polyhedron_3 )
-
-  if( POLYHEDRON_QTSCRIPT_DEBUGGER )
-    if(TARGET Qt5::ScriptTools)
-      qt5_use_modules(Polyhedron_3 ScriptTools)
-    else()
-      message(STATUS "POLYHEDRON_QTSCRIPT_DEBUGGER is set to TRUE but the Qt5 ScriptTools library was not found.")
-    endif()
-  endif()
-  target_link_libraries( Polyhedron_3 demo_framework )
-
-  # Link with CGAL
-  target_link_libraries( Polyhedron_3 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} )
-
-  # Link with libQGLViewer, OpenGL
-  target_link_libraries( Polyhedron_3 ${QGLVIEWER_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} )
-
-
-  add_to_cached_list( CGAL_EXECUTABLE_TARGETS Polyhedron_3 )
-
-
-  ###########
-  # PLUGINS #
-  ###########
-
-
-  file(GLOB DEMO_PLUGINS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/Plugins/" "${CMAKE_CURRENT_SOURCE_DIR}/Plugins/*")
-  FOREACH(SUB_DIR ${DEMO_PLUGINS})
-      add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/Plugins/${SUB_DIR}")
-  ENDFOREACH()
-
-#
-# Exporting
-#
-  if(TARGET CGAL_Qt5)
-    export(TARGETS CGAL CGAL_Qt5 FILE polyhedron_demo_targets.cmake NAMESPACE Polyhedron_)
-  else()
-    export(TARGETS FILE polyhedron_demo_targets.cmake)
-  endif()
-  export(
-    TARGETS
-    demo_framework
-    scene_polyhedron_item
-    scene_points_with_normal_item
-    scene_implicit_function_item
-    scene_polylines_item
-    NAMESPACE Polyhedron_
-    APPEND FILE polyhedron_demo_targets.cmake)
-
-  export(
-    TARGETS
-    gl_splat
-    NAMESPACE Polyhedron_
-    APPEND FILE polyhedron_demo_targets.cmake)
-
-  configure_file(CGAL_polyhedron_demoConfig.cmake.in  CGAL_polyhedron_demoConfig.cmake)
-#TO DO script the activation of all the plugins.
-
-else (CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
-
-  set(POLYHEDRON_MISSING_DEPS "")
-
-  if(NOT CGAL_Qt5_FOUND)
-    set(POLYHEDRON_MISSING_DEPS "the CGAL Qt5 library, ${POLYHEDRON_MISSING_DEPS}")
-  endif()
-
-  if(NOT Qt5_FOUND)
-    set(POLYHEDRON_MISSING_DEPS "Qt5, ${POLYHEDRON_MISSING_DEPS}")
-  endif()
-
-  if(NOT OPENGL_FOUND)
-    set(POLYHEDRON_MISSING_DEPS "OpenGL, ${POLYHEDRON_MISSING_DEPS}")
-  endif()
-
-  if(NOT QGLVIEWER_FOUND)
-    set(POLYHEDRON_MISSING_DEPS "QGLViewer, ${POLYHEDRON_MISSING_DEPS}")
-  endif()
-
-  message(STATUS "NOTICE: This demo requires ${POLYHEDRON_MISSING_DEPS}and will not be compiled.")
-
-
-endif (CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Color_ramp.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Color_ramp.cpp
deleted file mode 100644
index 40c55a9..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Color_ramp.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-#include "Color_ramp.h"
-#include <iostream>
-
-// -----------------------------------
-// Color_component
-// -----------------------------------
-Color_component::
-Color_component()
-{
-  add(0,0);
-  add(1,1);
-}
-
-Color_component::
-Color_component(const double c0, const double c1)
-{
-  add(0,c0);
-  add(1,c1);
-}
-
-double 
-Color_component::
-interpolate(const double v) const
-{
-  Values::const_iterator next = next_it(v);
-
-  // next is just after v
-  Values::const_iterator prev = --next;
-  ++next;
-
-  if ( v>=1 && next != values_.end())
-    std::cerr << ".";
-  
-  if ( next == values_.end() )
-  {
-    return prev->second;
-  }
-
-  const double& a = prev->first;
-  const double& b = next->first;
-  return (b-v)/(b-a) * prev->second + (v-a)/(b-a) * next->second;
-
-}
-
-void
-Color_component::
-add(const double v, double color)
-{
-  if ( color > 1 ) { color = 1; }
-  if ( color < 0 ) { color = 0; }
-  
-  Values::iterator next = next_it(v);
-  values_.insert(next, std::make_pair(v,color));
-}
-
-
-void
-Color_component::
-rebuild(const double c0, const double c1)
-{
-  values_.clear();
-  add(1,c1);
-  add(0,c0);
-}
-
-void
-Color_component::
-print() const
-{
-  for ( Values::const_iterator it = values_.begin(),
-       end = values_.end() ; it != end ; ++it )
-  { 
-    std::cout << "<" << it->first << "," << it->second << "> ";
-  }
-  
-  std::cout << std::endl;
-}
-
-
-// -----------------------------------
-// Color_ramp
-// -----------------------------------
-Color_ramp::Color_ramp()
-  : r_()
-  , g_()
-  , b_()
-{ 
-}
-
-void 
-Color_ramp::build_red()
-{
-  r_.rebuild(1,0.5);
-  g_.rebuild(1,0);
-  b_.rebuild(1,0);
-
-  r_.add(0.3,1);
-  r_.add(0.05,1);
-  g_.add(0.05,0.95);
-  g_.add(0.3,0.5);
-  b_.add(0.05,0);
-}
-
-void 
-Color_ramp::build_blue()
-{
-  r_.rebuild(1,0);
-  g_.rebuild(1,0);
-  b_.rebuild(1,0.5);
-  
-  b_.add(0.1,0.8);
-  g_.add(0.1,0.4);
-  r_.add(0.1,0.4);
-}
-
-void
-Color_ramp::
-print() const
-{
-  std::cout << "r: ";
-  r_.print();
-  std::cout << "g: ";
-  g_.print();
-  std::cout << "b: ";
-  b_.print();
-}
-
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Color_ramp.h b/3rdparty/CGAL-4.8/demo/Polyhedron/Color_ramp.h
deleted file mode 100644
index 4843cd9..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Color_ramp.h
+++ /dev/null
@@ -1,87 +0,0 @@
-#ifndef _COLOR_RAMP_H
-#define _COLOR_RAMP_H
-
-#include <list>
-
-class Color_component
-{
-  typedef std::list<std::pair<double,double> > Values;
-  
-public:
-  Color_component();
-  Color_component(const double c0, const double c1);
-  ~Color_component() {}
-  
-  double interpolate(const double v) const;
-  void add(const double v, double color);
-  void rebuild(const double c0, const double c1);
-  void print() const;
-  
-private:
-  inline Values::const_iterator next_it(const double v) const;
-  inline Values::iterator next_it(const double v);
-  
-private:
-  Values values_;
-};
-
-
-class Color_ramp
-{
-public :
-	Color_ramp();
-	~Color_ramp() {}
-
-public :
-  inline double r(double v) const;
-  inline double g(double v) const;
-  inline double b(double v) const;
-
-	void build_red();
-	void build_blue();
-  void print() const;
-
-private :
-  Color_component r_;
-  Color_component g_;
-  Color_component b_;
-};
-
-
-inline
-Color_component::Values::const_iterator
-Color_component::
-next_it(const double v) const
-{
-  Values::const_iterator next = values_.begin();
-  while ( next != values_.end() && v >= next->first ) { ++next; }
-  return next;
-}
-
-inline
-Color_component::Values::iterator
-Color_component::
-next_it(const double v)
-{
-  Values::iterator next = values_.begin();
-  while ( next != values_.end() && v >= next->first ) { ++next; }
-  return next;
-}
-
-inline
-double
-Color_ramp::r(double v) const
-{ return r_.interpolate(v); }
-
-inline
-double
-Color_ramp::g(double v) const
-{ return g_.interpolate(v);  }
-
-inline
-double
-Color_ramp::b(double v) const
-{ return b_.interpolate(v);  }
-
-
-#endif // _COLOR_RAMP_H
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/FileLoaderDialog.ui b/3rdparty/CGAL-4.8/demo/Polyhedron/FileLoaderDialog.ui
deleted file mode 100644
index 4242b30..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/FileLoaderDialog.ui
+++ /dev/null
@@ -1,121 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>FileLoaderDialog</class>
- <widget class="QDialog" name="FileLoaderDialog">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>339</width>
-    <height>105</height>
-   </rect>
-  </property>
-  <property name="sizePolicy">
-   <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-    <horstretch>0</horstretch>
-    <verstretch>0</verstretch>
-   </sizepolicy>
-  </property>
-  <property name="windowTitle">
-   <string>Select a Loader</string>
-  </property>
-  <property name="layoutDirection">
-   <enum>Qt::LeftToRight</enum>
-  </property>
-  <property name="sizeGripEnabled">
-   <bool>false</bool>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout">
-   <item>
-    <widget class="QLabel" name="label">
-     <property name="sizePolicy">
-      <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-     <property name="text">
-      <string>TextLabel</string>
-     </property>
-    </widget>
-   </item>
-   <item>
-    <widget class="QComboBox" name="pluginBox">
-     <property name="statusTip">
-      <string/>
-     </property>
-     <property name="whatsThis">
-      <string/>
-     </property>
-     <property name="accessibleName">
-      <string/>
-     </property>
-    </widget>
-   </item>
-   <item>
-    <widget class="QDialogButtonBox" name="buttonBox">
-     <property name="layoutDirection">
-      <enum>Qt::LeftToRight</enum>
-     </property>
-     <property name="orientation">
-      <enum>Qt::Horizontal</enum>
-     </property>
-     <property name="standardButtons">
-      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
-     </property>
-    </widget>
-   </item>
-   <item>
-    <widget class="QCheckBox" name="alwaysUse">
-     <property name="sizePolicy">
-      <sizepolicy hsizetype="Minimum" vsizetype="Expanding">
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-     <property name="text">
-      <string/>
-     </property>
-     <property name="checked">
-      <bool>true</bool>
-     </property>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <resources/>
- <connections>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>accepted()</signal>
-   <receiver>FileLoaderDialog</receiver>
-   <slot>accept()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>248</x>
-     <y>254</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>157</x>
-     <y>274</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>rejected()</signal>
-   <receiver>FileLoaderDialog</receiver>
-   <slot>reject()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>316</x>
-     <y>260</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>286</x>
-     <y>274</y>
-    </hint>
-   </hints>
-  </connection>
- </connections>
-</ui>
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/GlSplat/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Polyhedron/GlSplat/CMakeLists.txt
deleted file mode 100644
index 3bf89f4..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/GlSplat/CMakeLists.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-
-project(GlSplat)
-
-cmake_minimum_required(VERSION 2.6.0)
-if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
-  cmake_policy(VERSION 2.8.4)
-else()
-  cmake_policy(VERSION 2.6)
-endif()
-set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
-
-find_package(Qt4 REQUIRED)
-
-set(QT_USE_QTOPENGL TRUE)
-set(QT_USE_QTXML TRUE)
-include(${QT_USE_FILE})
-include_directories( ${QT_QTOPENGL_INCLUDE_DIR} ${QT_QTXML_INCLUDE_DIR})
-
-set(srcs Shader.cpp GlSplat.cpp)
-
-qt4_automoc( ${srcs})
-qt4_add_resources(srcs glsplat.qrc)
-
-add_library(GlSplat SHARED ${srcs})
-target_link_libraries(GlSplat ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY} )
-
-find_package(QGLViewer)
-if(QGLVIEWER_FOUND)
-  include_directories( ${QGLViewer_INCLUDES})
-  add_executable(demo demo.cpp)
-  target_link_libraries(demo ${QT_QTXML_LIBRARY} ${QGLViewer_LIBRARIES} GlSplat)
-else()
-  message("QGLViewer not found, demo won't be built")
-endif()
-include( polyhedron_demo_macros )
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/GlSplat/GlSplat_config.h b/3rdparty/CGAL-4.8/demo/Polyhedron/GlSplat/GlSplat_config.h
deleted file mode 100644
index b64e406..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/GlSplat/GlSplat_config.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef GLSPLAT_CONFIG_H
-#define GLSPLAT_CONFIG_H
-
-#include <CGAL/export/helpers.h>
-
-#ifdef gl_splat_EXPORTS
-  #define GLSPLAT_EXPORT CGAL_DLL_EXPORT
-#else
-  #define GLSPLAT_EXPORT CGAL_DLL_IMPORT
-#endif
-
-#endif // GLSPLAT_CONFIG_H
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/MainWindow.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/MainWindow.cpp
deleted file mode 100644
index a51f730..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/MainWindow.cpp
+++ /dev/null
@@ -1,1871 +0,0 @@
-#include "config.h"
-#include "MainWindow.h"
-#include "Scene.h"
-#include <CGAL/Three/Scene_item.h>
-#include <CGAL/Qt/debug.h>
-
-#include <QtDebug>
-#include <QFileDialog>
-#include <QFileInfo>
-#include <QSettings>
-#include <QHeaderView>
-#include <QMenu>
-#include <QMenuBar>
-#include <QChar>
-#include <QAction>
-#include <QShortcut>
-#include <QKeySequence>
-#include <QLibrary>
-#include <QPluginLoader>
-#include <QMessageBox>
-#include <QScrollBar>
-#include <QColor>
-#include <QColorDialog>
-#include <QClipboard>
-#include <QCloseEvent>
-#include <QInputDialog>
-#include <QTreeView>
-#include <QSortFilterProxyModel>
-#include <QMap>
-#include <QStandardItemModel>
-#include <QStandardItem>
-#include <stdexcept>
-#ifdef QT_SCRIPT_LIB
-#  include <QScriptValue>
-#  ifdef QT_SCRIPTTOOLS_LIB
-#    include <QScriptEngineDebugger>
-#  endif
-#endif
-
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-#include <CGAL/Three/Polyhedron_demo_io_plugin_interface.h>
-
-#include "ui_MainWindow.h"
-#include "ui_Preferences.h"
-#include "ui_Statistics_on_item_dialog.h"
-#include "Show_point_dialog.h"
-#include "File_loader_dialog.h"
-
-#include <QGLViewer/manipulatedCameraFrame.h>
-#include <QGLViewer/manipulatedFrame.h>
-
-#ifdef QT_SCRIPT_LIB
-#  include <QScriptEngine>
-#  include <QScriptValue>
-using namespace CGAL::Three;
-QScriptValue 
-myScene_itemToScriptValue(QScriptEngine *engine, 
-                          CGAL::Three::Scene_item* const &in)
-{ 
-  return engine->newQObject(in); 
-}
-
-void myScene_itemFromScriptValue(const QScriptValue &object, 
-                                 CGAL::Three::Scene_item* &out)
-{
-  out = qobject_cast<CGAL::Three::Scene_item*>(object.toQObject());
-}
-#endif // QT_SCRIPT_LIB
-
-#ifdef QT_SCRIPT_LIB
-#  ifdef QT_SCRIPTTOOLS_LIB
-
-const QScriptEngineDebugger::DebuggerWidget debug_widgets[9] = {
-  QScriptEngineDebugger::ConsoleWidget,
-  QScriptEngineDebugger::StackWidget,
-  QScriptEngineDebugger::ScriptsWidget,
-  QScriptEngineDebugger::LocalsWidget,
-  QScriptEngineDebugger::CodeWidget,
-  QScriptEngineDebugger::CodeFinderWidget,
-  QScriptEngineDebugger::BreakpointsWidget,
-  QScriptEngineDebugger::DebugOutputWidget,
-  QScriptEngineDebugger::ErrorLogWidget
-};
-const QString debug_widgets_names[9] = {
-  "Script console",
-  "Stack",
-  "Scripts",
-  "Locals",
-  "Code",
-  "CodeFinder",
-  "Breakpoints",
-  "DebugOutput",
-  "ErrorLog"
-};
-
-#  endif
-#endif
-
-QScriptValue myPrintFunction(QScriptContext *context, QScriptEngine *engine)
-{
-  MainWindow* mw = qobject_cast<MainWindow*>(engine->parent());
-  QString result;
-  for (int i = 0; i < context->argumentCount(); ++i) {
-    if (i > 0)
-      result.append(" ");
-    result.append(context->argument(i).toString());
-  }
-
-  if(mw) mw->message(QString("QtScript: ") + result, "");
-
-  return engine->undefinedValue();
-}
-
-MainWindow::~MainWindow()
-{
-  delete ui;
-  delete statistics_ui;
-}
-MainWindow::MainWindow(QWidget* parent)
-  : CGAL::Qt::DemosMainWindow(parent)
-{
-  ui = new Ui::MainWindow;
-  ui->setupUi(this);
-  // remove the Load Script menu entry, when the demo has not been compiled with QT_SCRIPT_LIB
-#if !defined(QT_SCRIPT_LIB)
-  ui->menuBar->removeAction(ui->actionLoad_Script);
-#endif
-  
-  // Save some pointers from ui, for latter use.
-  sceneView = ui->sceneView;
-  viewer = ui->viewer;
-  // do not save the state of the viewer (anoying)
-  viewer->setStateFileName(QString::null);
-
-  // setup scene
-  scene = new Scene(this);
-  viewer->setScene(scene);
-  {
-    QShortcut* shortcut = new QShortcut(QKeySequence(Qt::ALT+Qt::Key_Q), this);
-    connect(shortcut, SIGNAL(activated()),
-            this, SLOT(setFocusToQuickSearch()));
-  }
-
-  proxyModel = new QSortFilterProxyModel(this);
-  proxyModel->setSourceModel(scene);
-  SceneDelegate *delegate = new SceneDelegate(this);
-  delegate->setProxy(proxyModel);
-  delegate->setScene(scene);
-
-
-  connect(ui->searchEdit, SIGNAL(textChanged(QString)),
-          proxyModel, SLOT(setFilterFixedString(QString)));
-  sceneView->setModel(proxyModel);
-
-  // setup the sceneview: delegation and columns sizing...
-  sceneView->setItemDelegate(delegate);
-
- //sceneView->header()->setStretchLastSection(false);
-  /* sceneView->header()->setSectionResizeMode(Scene::NameColumn, QHeaderView::Stretch);
-   sceneView->header()->setSectionResizeMode(Scene::NameColumn, QHeaderView::Stretch);
-  sceneView->header()->setSectionResizeMode(Scene::ColorColumn, QHeaderView::ResizeToContents);
-  sceneView->header()->setSectionResizeMode(Scene::RenderingModeColumn, QHeaderView::Fixed);
-  sceneView->header()->setSectionResizeMode(Scene::ABColumn, QHeaderView::Fixed);
-  sceneView->header()->setSectionResizeMode(Scene::VisibleColumn, QHeaderView::Fixed);
-  sceneView->resizeColumnToContents(Scene::ColorColumn);
-  sceneView->resizeColumnToContents(Scene::RenderingModeColumn);
-  sceneView->resizeColumnToContents(Scene::ABColumn);
-  sceneView->resizeColumnToContents(Scene::VisibleColumn);
-*/
-  // setup connections
-  connect(scene, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex & )),
-          this, SLOT(updateInfo()));
-  
-  connect(scene, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex & )),
-          this, SLOT(updateDisplayInfo()));
-
-  connect(scene, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex & )),
-          viewer, SLOT(updateGL()));
-
-  connect(scene, SIGNAL(updated()),
-          viewer, SLOT(updateGL()));
-
-  connect(scene, SIGNAL(updated()),
-          this, SLOT(selectionChanged()));
-
-  connect(scene, SIGNAL(itemAboutToBeDestroyed(CGAL::Three::Scene_item*)),
-          this, SLOT(removeManipulatedFrame(CGAL::Three::Scene_item*)));
-
-  connect(scene, SIGNAL(updated_bbox()),
-          this, SLOT(updateViewerBBox()));
-
-  connect(scene, SIGNAL(selectionChanged(int)),
-          this, SLOT(selectSceneItem(int)));
-
-  connect(scene, SIGNAL(itemPicked(const QModelIndex &)),
-          this, SLOT(recenterSceneView(const QModelIndex &)));
-
-  connect(sceneView->selectionModel(), 
-          SIGNAL(selectionChanged ( const QItemSelection & , const QItemSelection & ) ),
-          this, SLOT(updateInfo()));
-
-  connect(sceneView->selectionModel(), 
-          SIGNAL(selectionChanged ( const QItemSelection & , const QItemSelection & ) ),
-          this, SLOT(updateDisplayInfo()));
-
-  connect(sceneView->selectionModel(), 
-          SIGNAL(selectionChanged ( const QItemSelection & , const QItemSelection & ) ),
-          this, SLOT(selectionChanged()));
-
-  sceneView->setContextMenuPolicy(Qt::CustomContextMenu);
-  connect(sceneView, SIGNAL(customContextMenuRequested(const QPoint & )),
-          this, SLOT(showSceneContextMenu(const QPoint &)));
-
-  connect(sceneView, SIGNAL(expanded(QModelIndex)),
-          this, SLOT(setExpanded(QModelIndex)));
-
-  connect(sceneView, SIGNAL(collapsed(QModelIndex)),
-          this, SLOT(setCollapsed(QModelIndex)));
-  connect(this, SIGNAL(collapsed(QModelIndex)),
-          scene, SLOT(setCollapsed(QModelIndex)));
-  connect(this, SIGNAL(expanded(QModelIndex)),
-          scene, SLOT(setExpanded(QModelIndex)));
-
-  connect(scene, SIGNAL(restoreCollapsedState()),
-          this, SLOT(restoreCollapseState()));
-
-  connect(viewer, SIGNAL(selected(int)),
-          this, SLOT(selectSceneItem(int)));
-  connect(viewer, SIGNAL(selectedPoint(double, double, double)),
-          this, SLOT(showSelectedPoint(double, double, double)));
-
-  connect(viewer, SIGNAL(selectionRay(double, double, double, 
-                                      double, double, double)),
-          scene, SIGNAL(selectionRay(double, double, double,
-                                     double, double, double)));
-
-  connect(viewer, SIGNAL(requestContextMenu(QPoint)),
-          this, SLOT(contextMenuRequested(QPoint)));
-
-  // The contextMenuPolicy of infoLabel is now the default one, so that one
-  // can easily copy-paste its text.
-  // connect(ui->infoLabel, SIGNAL(customContextMenuRequested(const QPoint & )),
-  //         this, SLOT(showSceneContextMenu(const QPoint &)));
-
-  connect(ui->actionRecenterScene, SIGNAL(triggered()),
-          viewer, SLOT(update()));
-
-  connect(ui->actionAntiAliasing, SIGNAL(toggled(bool)),
-          viewer, SLOT(setAntiAliasing(bool)));
-
-  connect(ui->actionDraw_two_sides, SIGNAL(toggled(bool)),
-          viewer, SLOT(setTwoSides(bool)));
-  connect(ui->actionQuick_camera_mode, SIGNAL(toggled(bool)),
-          viewer, SLOT(setFastDrawing(bool)));
-
-  // add the "About CGAL..." and "About demo..." entries
-  this->addAboutCGAL();
-  this->addAboutDemo(":/cgal/Polyhedron_3/about.html");
-
-  // Connect the button "addButton" with actionLoad
-  ui->addButton->setDefaultAction(ui->actionLoad);
-  // Same with "removeButton" and "duplicateButton"
-  ui->removeButton->setDefaultAction(ui->actionErase);
-  ui->duplicateButton->setDefaultAction(ui->actionDuplicate);
-
-  // Connect actionQuit (Ctrl+Q) and qApp->quit()
-  connect(ui->actionQuit, SIGNAL(triggered()),
-          this, SLOT(quit()));
-
-  // Connect "Select all items"
-  connect(ui->actionSelect_all_items, SIGNAL(triggered()),
-          this, SLOT(selectAll()));
-
-  // Recent files menu
-  this->addRecentFiles(ui->menuFile, ui->actionQuit);
-  connect(this, SIGNAL(openRecentFile(QString)),
-	  this, SLOT(open(QString)));
-
-  // Reset the "Operation menu"
-  clearMenu(ui->menuOperations);
-
-#ifdef QT_SCRIPT_LIB
-  std::cerr << "Enable scripts.\n";
-  script_engine = new QScriptEngine(this);
-  qScriptRegisterMetaType<CGAL::Three::Scene_item*>(script_engine,
-                                       myScene_itemToScriptValue,
-                                       myScene_itemFromScriptValue);
-#  ifdef QT_SCRIPTTOOLS_LIB
-  QScriptEngineDebugger* debugger = new QScriptEngineDebugger(this);
-  debugger->setObjectName("qt script debugger");
-  QAction* debuggerMenuAction = 
-    menuBar()->addMenu(debugger->createStandardMenu());
-  debuggerMenuAction->setText(tr("Qt Script &Debug"));
-  for(unsigned int i = 0; i < 9; ++i)
-  {
-    QDockWidget* dock = new QDockWidget(debug_widgets_names[i], this);
-    dock->setObjectName(debug_widgets_names[i]);
-    dock->setWidget(debugger->widget(debug_widgets[i]));
-    this->addDockWidget(Qt::BottomDockWidgetArea, dock);
-    dock->hide();
-  }
-  debugger->setAutoShowStandardWindow(false);
-  debugger->attachTo(script_engine);
-#  endif // QT_SCRIPTTOOLS_LIB
-  QScriptValue fun = script_engine->newFunction(myPrintFunction);
-  script_engine->globalObject().setProperty("print", fun);
-  
-  //  evaluate_script("print('hello', 'world', 'from QtScript!')");
-  QScriptValue mainWindowObjectValue = script_engine->newQObject(this);
-  script_engine->globalObject().setProperty("main_window", mainWindowObjectValue);
-
-  QScriptValue sceneObjectValue = script_engine->newQObject(scene);
-  mainWindowObjectValue.setProperty("scene", sceneObjectValue);
-  script_engine->globalObject().setProperty("scene", sceneObjectValue);
-
-  QScriptValue viewerObjectValue = script_engine->newQObject(viewer);
-  mainWindowObjectValue.setProperty("viewer", viewerObjectValue);
-  script_engine->globalObject().setProperty("viewer", viewerObjectValue);
-
-  QScriptValue cameraObjectValue = script_engine->newQObject(viewer->camera());
-  viewerObjectValue.setProperty("camera", cameraObjectValue);
-  script_engine->globalObject().setProperty("camera", cameraObjectValue);
-
-  evaluate_script("var plugins = new Array();");
-#  ifdef QT_SCRIPTTOOLS_LIB
-  QScriptValue debuggerObjectValue = script_engine->newQObject(debugger);
-  script_engine->globalObject().setProperty("debugger", debuggerObjectValue);
-#  endif
-#endif
-
-  readSettings(); // Among other things, the column widths are stored.
-
-  // Load plugins, and re-enable actions that need it.
-  loadPlugins();
-
-  // Setup the submenu of the View menu that can toggle the dockwidgets
-  Q_FOREACH(QDockWidget* widget, findChildren<QDockWidget*>()) {
-    ui->menuDockWindows->addAction(widget->toggleViewAction());
-  }
-  ui->menuDockWindows->removeAction(ui->dummyAction);
-
-
-  this->readState("MainWindow", Size|State);
-
-  //Manages the group_item creation
-  actionAddToGroup= new QAction("Add New Group", this);
-
-  if(actionAddToGroup) {
-    connect(actionAddToGroup, SIGNAL(triggered()),
-            this, SLOT(make_new_group()));
-  }
-
-  QMenu* menuFile = findChild<QMenu*>("menuFile");
-  if ( NULL != menuFile )
-  {
-    QList<QAction*> menuFileActions = menuFile->actions();
-
-    // Look for action just after "Load..." action
-    QAction* actionAfterLoad = NULL;
-    for ( QList<QAction*>::iterator it_action = menuFileActions.begin(),
-         end = menuFileActions.end() ; it_action != end ; ++ it_action ) //Q_FOREACH( QAction* action, menuFileActions)
-    {
-      if ( NULL != *it_action && (*it_action)->text().contains("Load") )
-      {
-        ++it_action;
-        if ( it_action != end && NULL != *it_action )
-        {
-          actionAfterLoad = *it_action;
-        }
-      }
-    }
-
-    // Insert "Load implicit function" action
-    if ( NULL != actionAfterLoad )
-    {
-      menuFile->insertAction(actionAfterLoad,actionAddToGroup);
-    }
-  }
-
-  statistics_dlg = NULL;
-  statistics_ui = new Ui::Statistics_on_item_dialog();
-
-#ifdef QT_SCRIPT_LIB
-  // evaluate_script("print(plugins);");
-  Q_FOREACH(QAction* action, findChildren<QAction*>()) {
-    if(action->objectName() != "") {
-      QScriptValue objectValue = script_engine->newQObject(action);
-      script_engine->globalObject().setProperty(action->objectName(),
-                                                objectValue);
-    }
-  }
-  // debugger->action(QScriptEngineDebugger::InterruptAction)->trigger();
-#endif
-
-  // setup menu filtering
-  connect(ui->menuOperations, SIGNAL(aboutToShow()), this, SLOT(filterOperations()));
-}
-
-//Recursive function that do a pass over a menu and its sub-menus(etc.) and hide them when they are empty
-void filterMenuOperations(QMenu* menu)
-{
-    Q_FOREACH(QAction* action, menu->actions()) {
-        if(QMenu* menu = action->menu()) {
-            filterMenuOperations(menu);
-            action->setVisible(!(menu->isEmpty()));
-        }
-    }
-
-}
-
-void MainWindow::filterOperations()
-{
-  Q_FOREACH(const PluginNamePair& p, plugins) {
-    Q_FOREACH(QAction* action, p.first->actions()) {
-        action->setVisible( p.first->applicable(action) );
-    }
-  }
-
-  // do a pass over all menus in Operations and their sub-menus(etc.) and hide them when they are empty
-  filterMenuOperations(ui->menuOperations);
-}
-#ifdef QT_SCRIPT_LIB
-void MainWindow::evaluate_script(QString script,
-                                 const QString& filename,
-                                 const bool quiet) {
-  QScriptValue value = script_engine->evaluate(script, filename);
-  if(script_engine->hasUncaughtException()) {
-    QTextStream err(stderr);
-    err << "Qt Script exception:\n"
-        << script_engine->uncaughtException().toString()
-        << "\nBacktrace:\n";
-    Q_FOREACH(QString line, script_engine->uncaughtExceptionBacktrace()) {
-      err << "  " << line << "\n";
-    }
-  }
-  else if(!quiet && !value.isNull() && !value.isUndefined()) {
-    QTextStream(stderr) << "Qt Script evaluated to \""
-                        << value.toString() << "\"\n";
-  }
-}
-
-void MainWindow::evaluate_script_quiet(QString script,
-                                       const QString& filename)
-{
-  evaluate_script(script, filename, true);
-}
-#endif
-
-void MainWindow::enableScriptDebugger(bool b /* = true */)
-{
-  Q_UNUSED(b);
-#ifdef QT_SCRIPT_LIB
-#  ifdef QT_SCRIPTTOOLS_LIB
-  QScriptEngineDebugger* debugger =
-    findChild<QScriptEngineDebugger*>("qt script debugger");
-  if(debugger) {
-    if(b) {
-      debugger->action(QScriptEngineDebugger::InterruptAction)->trigger();
-    }
-  }
-  return;
-#  endif
-#endif
-  // If we are here, then the debugger is not available
-  this->error(tr("Your version of Qt is too old, and for that reason "
-                 "the Qt Script Debugger is not available."));
-}
-
-namespace {
-bool actionsByName(QAction* x, QAction* y) {
-  return x->text() < y->text();
-}
-}
-
-//Recursively creates all subMenus containing an action.
-void MainWindow::setMenus(QString name, QString parentName, QAction* a )
-{
-
-        bool hasSub = false;
-        QString menuName, subMenuName;
-        if (!name.isNull())
-        {
-            //Get the menu and submenu names
-            for(int i=0; i<name.size(); i++)
-            {
-                if(name.at(i)=='/')
-                    hasSub = true;
-            }
-
-            if(!hasSub)
-                menuName= name;
-            else
-            {
-                int i;
-                for(i = 0; name.at(i)!='/'; i++)
-                    menuName.append(name.at(i));
-                i++;
-                for(int j = i; j<name.size(); j++)
-                    subMenuName.append(name.at(j));
-                setMenus(subMenuName, menuName, a);
-            }
-
-            //Create the menu and sub menu
-            QMenu* menu = 0;
-            QMenu* parentMenu = 0;
-            //If the menu already exists, don't create a new one.
-            Q_FOREACH(QAction* action, findChildren<QAction*>()) {
-                if(!action->menu()) continue;
-                QString menuText = action->menu()->title();
-                //If the menu title does not correspond to the name of the menu or submenu we want,
-                //go to the next one.
-                if(menuText != menuName) continue;
-                menu = action->menu();
-            }
-
-            bool hasAction = false;
-            if(menu == 0)
-                menu = new QMenu(menuName, this);
-            else //checks the action is not already in the menu
-                if(a->property("added").toBool())
-                    hasAction = true;
-            if(!hasAction)
-                menu->addAction(a);
-            a->setProperty("added", true);
-            //If the parent menu already exists, don't create a new one.
-            Q_FOREACH(QAction* action, findChildren<QAction*>()) {
-                if(!action->menu()) continue;
-                QString menuText = action->menu()->title();
-                //If the menu title does not correspond to the name of the menu or submenu we want,
-                //go to the next one.
-                if(menuText != parentName) continue;
-                parentMenu = action->menu();
-            }
-
-            if(parentMenu == 0)
-                parentMenu = new QMenu(parentName, this);
-            parentMenu->addMenu(menu);
-            ui->menuOperations->removeAction(a);
-    }
-}
-
-
-
-void MainWindow::loadPlugins()
-{
-  Q_FOREACH(QObject *obj, QPluginLoader::staticInstances())
-  {
-    initPlugin(obj);
-    initIOPlugin(obj);
-  }
-  QList<QDir> plugins_directories;
-  QString dirPath = qApp->applicationDirPath();
-  plugins_directories<<dirPath;
-
-  QDir msvc_dir(dirPath);
-  QString build_dir_name = msvc_dir.dirName();//Debug or Release for msvc
-  msvc_dir.cdUp();
-
-  QFileInfoList filist = QDir(dirPath).entryInfoList();
-  filist << msvc_dir.entryInfoList();
-
-  Q_FOREACH(QFileInfo fileinfo, filist)
-  {
-      //checks if the path leads to a directory
-      if(fileinfo.baseName().contains("Plugins"))
-      {
-        QString plugins_dir = fileinfo.absolutePath();
-        plugins_dir.append("/").append(fileinfo.baseName());
-
-        Q_FOREACH(QString package_dir,
-                  QDir(plugins_dir).entryList(QDir::Dirs))
-        {
-          QString package_dir_path(plugins_dir);
-          package_dir_path.append("/").append(package_dir);
-
-          QString libdir_path(package_dir_path);
-          libdir_path.append("/").append(build_dir_name);
-
-          if (QDir(libdir_path).exists())
-            plugins_directories << QDir(libdir_path);
-          else
-            plugins_directories << QDir(package_dir_path);
-        }
-      }
-  }
-  QString env_path = qgetenv("POLYHEDRON_DEMO_PLUGINS_PATH");
-  if(!env_path.isEmpty()) {
-    Q_FOREACH (QString pluginsDir, 
-               env_path.split(":", QString::SkipEmptyParts)) {
-      QDir dir(pluginsDir);
-      if(dir.isReadable())
-        plugins_directories << dir;
-    }
-  }
-  Q_FOREACH (QDir pluginsDir, plugins_directories) {
-    qDebug("# Looking for plugins in directory \"%s\"...",
-           qPrintable(pluginsDir.absolutePath()));
-    Q_FOREACH (QString fileName, pluginsDir.entryList(QDir::Files)) {
-      if(fileName.contains("plugin") && QLibrary::isLibrary(fileName)) {
-        //set plugin name
-        QString name = fileName;
-        name.remove(QRegExp("^lib"));
-        name.remove(QRegExp("\\..*"));
-        //do not load it if it is in the blacklist
-        if ( plugin_blacklist.contains(name) ){
-          qDebug("### Ignoring plugin \"%s\".", qPrintable(fileName));
-          continue;
-        }
-        QDebug qdebug = qDebug();
-        qdebug << "### Loading \"" << fileName.toUtf8().data() << "\"... ";
-        QPluginLoader loader;
-        loader.setFileName(pluginsDir.absoluteFilePath(fileName));
-        QObject *obj = loader.instance();
-        if(obj) {
-          obj->setObjectName(name);
-          bool init1 = initPlugin(obj);
-          bool init2 = initIOPlugin(obj);
-          if (!init1 && !init2)
-            qdebug << "not for this program";
-          else
-            qdebug << "success";
-        }
-        else {
-          qdebug << "error: " << qPrintable(loader.errorString());
-        }
-      }
-    }
-  }
-
-
-//Creates sub-Menus for operations.
-  //!TODO : Make it recursive to allow sub-menus of sub-menus.
-  //!The argument should be the menuPath and it should recurse until hasSub stays false.
-   QList<QAction*> as = ui->menuOperations->actions();
-  Q_FOREACH(QAction* a, as)
-{
-              QString menuPath = a->property("subMenuName").toString();
-              setMenus(menuPath, ui->menuOperations->title(), a);
-              // sort the operations menu by name
-              as = ui->menuOperations->actions();
-              qSort(as.begin(), as.end(), actionsByName);
-              ui->menuOperations->clear();
-              ui->menuOperations->addActions(as);
-          }
-      }
-
-bool MainWindow::hasPlugin(const QString& pluginName) const
-{
-  Q_FOREACH(const PluginNamePair& p, plugins) {
-    if(p.second == pluginName) return true;
-  }
-  return false;
-}
-
-bool MainWindow::initPlugin(QObject* obj)
-{
-  QObjectList childs = this->children();
-  CGAL::Three::Polyhedron_demo_plugin_interface* plugin =
-    qobject_cast<CGAL::Three::Polyhedron_demo_plugin_interface*>(obj);
-  if(plugin) {
-    // Call plugin's init() method
-    obj->setParent(this);
-    plugin->init(this, this->scene, this);
-    plugins << qMakePair(plugin, obj->objectName());
-#ifdef QT_SCRIPT_LIB
-    QScriptValue objectValue =
-      script_engine->newQObject(obj);
-    script_engine->globalObject().setProperty(obj->objectName(), objectValue);
-    evaluate_script_quiet(QString("plugins.push(%1);").arg(obj->objectName()));
-#endif
-
-    Q_FOREACH(QAction* action, plugin->actions()) {
-      // If action does not belong to the menus, add it to "Operations" menu
-      if(!childs.contains(action)) {
-        ui->menuOperations->addAction(action);
-      }
-      // Show and enable menu item
-      addAction(action);
-    }
-    return true;
-  }
-  else 
-    return false;
-}
-
-bool MainWindow::initIOPlugin(QObject* obj)
-{
-  CGAL::Three::Polyhedron_demo_io_plugin_interface* plugin =
-    qobject_cast<CGAL::Three::Polyhedron_demo_io_plugin_interface*>(obj);
-  if(plugin) {
-    io_plugins << plugin;
-    return true;
-  }
-  else 
-    return false;
-}
-
-void MainWindow::clearMenu(QMenu* menu)
-{
-  Q_FOREACH(QAction* action, menu->actions())
-  {
-    QMenu* menu = action->menu();
-    if(menu) {
-      clearMenu(menu);
-    }
-    action->setVisible(false);
-  }
-  menu->menuAction()->setEnabled(false);
-}
-
-void MainWindow::addAction(QAction* action)
-{
-  if(!action) return;
-
-  action->setVisible(true);
-  action->setEnabled(true);
-  Q_FOREACH(QWidget* widget, action->associatedWidgets())
-  {
-//     qDebug() << QString("%1 (%2)\n")
-//       .arg(widget->objectName())
-//       .arg(widget->metaObject()->className());
-    QMenu* menu = qobject_cast<QMenu*>(widget);
-    if(menu)
-    {
-      addAction(menu->menuAction());
-    }
-  }
-}
-
-void MainWindow::addAction(QString actionName,
-                           QString actionText,
-                           QString menuName) {
-  QMenu* menu = 0;
-  Q_FOREACH(QAction* action, findChildren<QAction*>()) {
-    if(!action->menu()) continue;
-    QString menuText = action->menu()->title();
-    if(menuText != menuName) continue;
-    menu = action->menu();
-  }
-  if(menu == 0) {
-    menu = new QMenu(menuName, this);
-    menuBar()->insertMenu(ui->menuView->menuAction(), menu);
-  }
-  QAction* action = new QAction(actionText, this);
-  action->setObjectName(actionName);
-  menu->addAction(action);
-#ifdef QT_SCRIPT_LIB
-  QScriptValue objectValue = script_engine->newQObject(action);
-  script_engine->globalObject().setProperty(action->objectName(),
-                                            objectValue);
-#endif
-}
-
-void MainWindow::viewerShow(float xmin,
-                            float ymin,
-                            float zmin,
-                            float xmax,
-                            float ymax,
-                            float zmax)
-{
-  qglviewer::Vec
-    min_(xmin, ymin, zmin),
-    max_(xmax, ymax, zmax);
-#if QGLVIEWER_VERSION >= 0x020502
-  viewer->camera()->setPivotPoint((min_+max_)*0.5);
-#else
-  viewer->camera()->setRevolveAroundPoint((min_+max_)*0.5);
-#endif
-
-  qglviewer::ManipulatedCameraFrame backup_frame(*viewer->camera()->frame());
-  viewer->camera()->fitBoundingBox(min_, max_);
-  qglviewer::ManipulatedCameraFrame new_frame(*viewer->camera()->frame());
-  *viewer->camera()->frame() = backup_frame;
-  viewer->camera()->interpolateTo(new_frame, 1.f);
-  viewer->setVisualHintsMask(1);
-}
-
-void MainWindow::viewerShow(float x, float y, float z) {
-#if QGLVIEWER_VERSION >= 0x020502
-  viewer->camera()->setPivotPoint(qglviewer::Vec(x, y, z));
-#else
-  viewer->camera()->setRevolveAroundPoint(qglviewer::Vec(x, y, z));
-#endif
-  // viewer->camera()->lookAt(qglviewer::Vec(x, y, z));
-
-  qglviewer::ManipulatedCameraFrame backup_frame(*viewer->camera()->frame());
-  viewer->camera()->fitSphere(qglviewer::Vec(x, y, z),
-                              viewer->camera()->sceneRadius()/100);
-  qglviewer::ManipulatedCameraFrame new_frame(*viewer->camera()->frame());
-  *viewer->camera()->frame() = backup_frame;
-  viewer->camera()->interpolateTo(new_frame, 1.f);
-  viewer->setVisualHintsMask(1);
-}
-
-void MainWindow::message(QString message, QString colorName, QString font) {
-  if (message.endsWith('\n')) {
-    message.remove(message.length()-1, 1);
-  }
-  std::cerr << qPrintable(message) << std::endl;
-  statusBar()->showMessage(message, 5000);
-  message = "<font color=\"" + colorName + "\" style=\"font-style: " + font + ";\" >" +
-    message + "</font><br>";
-  message = "[" + QTime::currentTime().toString() + "] " + message;
-  ui->consoleTextEdit->insertHtml(message);
-  ui->consoleTextEdit->verticalScrollBar()->setValue(ui->consoleTextEdit->verticalScrollBar()->maximum());
-}
-
-void MainWindow::information(QString text) {
-  this->message("INFO: " + text, "");
-}
-
-void MainWindow::warning(QString text) {
-  this->message("WARNING: " + text, "blue");
-}
-
-void MainWindow::error(QString text) {
-  this->message("ERROR: " + text, "red");
-}
-
-void MainWindow::updateViewerBBox()
-{
-  const Scene::Bbox bbox = scene->bbox();
-  const double xmin = bbox.xmin;
-  const double ymin = bbox.ymin;
-  const double zmin = bbox.zmin;
-  const double xmax = bbox.xmax;
-  const double ymax = bbox.ymax;
-  const double zmax = bbox.zmax;
-   //qDebug() << QString("Bounding box: (%1, %2, %3) - (%4, %5, %6)\n")
-   //.arg(xmin).arg(ymin).arg(zmin).arg(xmax).arg(ymax).arg(zmax);
-  qglviewer::Vec 
-    vec_min(xmin, ymin, zmin),
-    vec_max(xmax, ymax, zmax);
-  viewer->setSceneBoundingBox(vec_min,
-                              vec_max);
-  viewer->camera()->showEntireScene();
-}
-
-void MainWindow::reload_item() {
-  QAction* sender_action = qobject_cast<QAction*>(sender());
-  if(!sender_action) return;
-  
-  bool ok;
-  int item_index = sender_action->data().toInt(&ok);
-  QObject* item_object = scene->item(item_index);
-  if(!ok || !item_object || sender_action->data().type() != QVariant::Int) {
-    std::cerr << "Cannot reload item: "
-              << "the reload action has not item attached\n";
-    return;
-  }
-  CGAL::Three::Scene_item* item = qobject_cast<CGAL::Three::Scene_item*>(item_object);
-  if(!item) {
-    std::cerr << "Cannot reload item: "
-              << "the reload action has a QObject* pointer attached\n"
-              << "that is not a Scene_item*\n";
-    return;
-  }
-  QString filename = item->property("source filename").toString();
-  QString loader_name = item->property("loader_name").toString();
-  if(filename.isEmpty() || loader_name.isEmpty()) {
-    std::cerr << "Cannot reload item: "
-              << "the item has no \"source filename\" or no \"loader_name\" attached attached\n";
-    return;
-  }
-
-  CGAL::Three::Polyhedron_demo_io_plugin_interface* fileloader = find_loader(loader_name);
-  QFileInfo fileinfo(filename);
-
-  CGAL::Three::Scene_item* new_item = load_item(fileinfo, fileloader);
-
-  new_item->setName(item->name());
-  new_item->setColor(item->color());
-  new_item->setRenderingMode(item->renderingMode());
-  new_item->setVisible(item->visible());
-  new_item->invalidateOpenGLBuffers();
-  scene->replaceItem(item_index, new_item, true);
-  item->deleteLater();
-}
-
-CGAL::Three::Polyhedron_demo_io_plugin_interface* MainWindow::find_loader(const QString& loader_name) const {
-  Q_FOREACH(CGAL::Three::Polyhedron_demo_io_plugin_interface* io_plugin,
-            io_plugins) {
-    if(io_plugin->name() == loader_name) {
-      return io_plugin;
-    }
-  }
-  throw std::invalid_argument(QString("No loader found with the name %1 available")
-                              .arg(loader_name).toStdString()) ;
-}
-
-bool MainWindow::file_matches_filter(const QString& filters,
-                                     const QString& filename )
-{
-  QFileInfo fileinfo(filename);
-  QString filename_striped=fileinfo.fileName();
-
-  //match all filters between ()
-  QRegExp all_filters_rx("\\((.*)\\)");
-
-  QStringList split_filters = filters.split(";;");
-  Q_FOREACH(const QString& filter, split_filters) {
-    //extract filters
-    if ( all_filters_rx.indexIn(filter)!=-1 ){
-      Q_FOREACH(const QString& pattern,all_filters_rx.cap(1).split(' ')){
-        QRegExp rx(pattern);
-        rx.setPatternSyntax(QRegExp::Wildcard);
-        if ( rx.exactMatch(filename_striped) ){
-          return true;
-        }
-      }
-    }
-  }
-  return false;
-}
-
-void MainWindow::open(QString filename)
-{
-  QFileInfo fileinfo(filename);
-
-#ifdef QT_SCRIPT_LIB
-  // Handles the loading of script file from the command line arguments,
-  // and the special command line arguments that start with "javascript:"
-  // or "qtscript:"
-  QString program;
-  if(filename.startsWith("javascript:")) {
-    program=filename.right(filename.size() - 11);
-  }
-  if(filename.startsWith("qtscript:")) {
-    program=filename.right(filename.size() - 9);
-  }
-  if(filename.endsWith(".js")) {
-    load_script(fileinfo);
-    return;
-  }
-  if(!program.isEmpty())
-  {
-    {
-      QTextStream(stderr) << "Execution of script \"" 
-                          << filename << "\"\n";
-                          // << filename << "\", with following content:\n"
-                          // << program;
-    }
-    QApplication::setOverrideCursor(Qt::WaitCursor);
-    evaluate_script(program, filename);
-    QApplication::restoreOverrideCursor();
-    return;
-  }
-#endif
-
-  if ( !fileinfo.exists() ){
-    QMessageBox::warning(this,
-                         tr("Cannot open file"),
-                         tr("File %1 does not exist.")
-                         .arg(filename));
-    return;
-  }
-
-
-  QStringList selected_items;
-  QStringList all_items;
-
-  QMap<QString,QString>::iterator dfs_it = 
-    default_plugin_selection.find( fileinfo.completeSuffix() );
-  
-  if ( dfs_it==default_plugin_selection.end() )
-  {
-    // collect all io_plugins and offer them to load if the file extension match one name filter
-    // also collect all available plugin in case of a no extension match
-    Q_FOREACH(CGAL::Three::Polyhedron_demo_io_plugin_interface* io_plugin, io_plugins) {
-      if ( !io_plugin->canLoad() ) continue;
-      all_items << io_plugin->name();
-      if ( file_matches_filter(io_plugin->loadNameFilters(), filename) )
-        selected_items << io_plugin->name();
-    }
-  }
-  else
-    selected_items << *dfs_it;
-  
-  bool ok;
-  std::pair<QString, bool> load_pair;
-  
-  switch( selected_items.size() )
-  {
-    case 1:
-      load_pair = std::make_pair(selected_items.first(), false);
-      ok=true;
-      break;
-    case 0:
-      load_pair = File_loader_dialog::getItem(fileinfo.fileName(), all_items, &ok);
-      break;
-    default:
-      load_pair = File_loader_dialog::getItem(fileinfo.fileName(), selected_items, &ok);
-  }
-  viewer->context()->makeCurrent();
-  if(!ok || load_pair.first.isEmpty()) { return; }
-  
-  if (load_pair.second)
-     default_plugin_selection[fileinfo.completeSuffix()]=load_pair.first;
-  
-  
-  QSettings settings;
-  settings.setValue("OFF open directory",
-                    fileinfo.absoluteDir().absolutePath());
-
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-  CGAL::Three::Scene_item* scene_item = load_item(fileinfo, find_loader(load_pair.first));
-  QApplication::restoreOverrideCursor();
-
-  if(scene_item != 0) {
-    this->addToRecentFiles(fileinfo.absoluteFilePath());
-  }
-  selectSceneItem(scene->addItem(scene_item));
-}
-
-bool MainWindow::open(QString filename, QString loader_name) {
-  QFileInfo fileinfo(filename); 
-  CGAL::Three::Scene_item* item;
-  try {
-    item = load_item(fileinfo, find_loader(loader_name));
-  }
-  catch(std::logic_error e) {
-    std::cerr << e.what() << std::endl;
-    return false;
-  }
-  selectSceneItem(scene->addItem(item));
-  return true;
-}
-
-
-CGAL::Three::Scene_item* MainWindow::load_item(QFileInfo fileinfo, CGAL::Three::Polyhedron_demo_io_plugin_interface* loader) {
-  CGAL::Three::Scene_item* item = NULL;
-  if(!fileinfo.isFile() || !fileinfo.isReadable()) {
-    throw std::invalid_argument(QString("File %1 is not a readable file.")
-                                .arg(fileinfo.absoluteFilePath()).toStdString());
-  }
-
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-  item = loader->load(fileinfo);
-  QApplication::restoreOverrideCursor();
-  if(!item) {
-    throw std::logic_error(QString("Could not load item from file %1 using plugin %2")
-                           .arg(fileinfo.absoluteFilePath()).arg(loader->name()).toStdString());
-  }
-
-  item->setProperty("source filename", fileinfo.absoluteFilePath());
-  item->setProperty("loader_name", loader->name());
-  return item;
-}
-
-
-void MainWindow::setFocusToQuickSearch()
-{
-  ui->searchEdit->setFocus(Qt::ShortcutFocusReason);
-}
-
-void MainWindow::selectSceneItem(int i)
-{
-  if(i < 0 || i >= scene->numberOfEntries()) {
-    sceneView->selectionModel()->clearSelection();
-    updateInfo();
-    updateDisplayInfo();
-  }
-  else {
-    QItemSelection s =
-      proxyModel->mapSelectionFromSource(scene->createSelection(i));
-
-    sceneView->selectionModel()->select(s,
-                                        QItemSelectionModel::ClearAndSelect);
-  }
-}
-
-
-void MainWindow::showSelectedPoint(double x, double y, double z)
-{
-  static double x_prev = 0;
-  static double y_prev = 0;
-  static double z_prev = 0;
-  double dist = std::sqrt((x-x_prev)*(x-x_prev) + (y-y_prev)*(y-y_prev) + (z-z_prev)*(z-z_prev)); 
-  information(QString("Selected point: (%1, %2, %3) distance to previous: %4").
-              arg(x, 0, 'g', 10).
-              arg(y, 0, 'g', 10).
-              arg(z, 0, 'g', 10).
-              arg(dist,0,'g',10));
-  x_prev = x;
-  y_prev = y;
-  z_prev = z;
-}
-
-void MainWindow::unSelectSceneItem(int i)
-{
-  removeSceneItemFromSelection(i);
-}
-
-void MainWindow::addSceneItemInSelection(int i)
-{
-  QItemSelection s =
-    proxyModel->mapSelectionFromSource(scene->createSelection(i));
-  sceneView->selectionModel()->select(s, QItemSelectionModel::Select);
-  scene->itemChanged(i);
-}
-
-void MainWindow::removeSceneItemFromSelection(int i)
-{
-  QItemSelection s =
-    proxyModel->mapSelectionFromSource(scene->createSelection(i));
-  sceneView->selectionModel()->select(s,
-                                      QItemSelectionModel::Deselect);
-  scene->itemChanged(i);
-}
-
-void MainWindow::selectAll()
-{
-  QItemSelection s =
-    proxyModel->mapSelectionFromSource(scene->createSelectionAll());
-  sceneView->selectionModel()->select(s, 
-                                      QItemSelectionModel::ClearAndSelect);
-}
-
-int MainWindow::getSelectedSceneItemIndex() const
-{
-  QModelIndexList selectedRows = sceneView->selectionModel()->selectedIndexes();
-  if(selectedRows.size() == 0)
-    return -1;
-  else {
-    QModelIndex i = proxyModel->mapToSource(selectedRows.first());
-    return scene->getIdFromModelIndex(i);
-  }
-}
-
-QList<int> MainWindow::getSelectedSceneItemIndices() const
-{
-
-  QModelIndexList selectedIndices = sceneView->selectionModel()->selectedIndexes();
-  QList<int> result;
-  Q_FOREACH(QModelIndex index, selectedIndices) {
-      int temp = scene->getIdFromModelIndex(proxyModel->mapToSource(index));
-      if(!result.contains(temp))
-          result<<temp;
-  }
-  return result;
-}
-
-void MainWindow::selectionChanged()
-{
-  scene->setSelectedItemIndex(getSelectedSceneItemIndex());
-  scene->setSelectedItemsList(getSelectedSceneItemIndices());
-  CGAL::Three::Scene_item* item = scene->item(getSelectedSceneItemIndex());
-  if(item != NULL && item->manipulatable()) {
-    viewer->setManipulatedFrame(item->manipulatedFrame());
-  } else {
-    viewer->setManipulatedFrame(0);
-  }
-  if(viewer->manipulatedFrame() == 0) {
-    Q_FOREACH(CGAL::Three::Scene_item* item, scene->entries()) {
-      if(item->manipulatable() && item->manipulatedFrame() != 0) {
-        if(viewer->manipulatedFrame() != 0) {
-          // there are at least two possible frames
-          viewer->setManipulatedFrame(0);
-          break;
-        } else {
-          viewer->setManipulatedFrame(item->manipulatedFrame());
-        }
-      }
-    }
-  }
-  if(viewer->manipulatedFrame() != 0) {
-    connect(viewer->manipulatedFrame(), SIGNAL(modified()),
-            this, SLOT(updateInfo()));
-  }
-  viewer->updateGL();
-}
-
-void MainWindow::contextMenuRequested(const QPoint& global_pos) {
-  int index = scene->mainSelectionIndex();
-  showSceneContextMenu(index, global_pos);
-}
-
-void MainWindow::showSceneContextMenu(int selectedItemIndex,
-                                      const QPoint& global_pos)
-{
-  CGAL::Three::Scene_item* item = scene->item(scene->getIdFromModelIndex(scene->index(selectedItemIndex,0,QModelIndex())));
-  if(!item) return;
-
-  const char* prop_name = "Menu modified by MainWindow.";
-
-  QMenu* menu = item->contextMenu();
-  if(menu) {
-    bool menuChanged = menu->property(prop_name).toBool();
-    if(!menuChanged) {
-      QAction* actionStatistics =
-      menu->addAction(tr("Statistics..."));
-      actionStatistics->setObjectName("actionStatisticsOnPolyhedron");
-      connect(actionStatistics, SIGNAL(triggered()),
-              this, SLOT(statistics_on_item()));
-      menu->addSeparator();
-      if(!item->property("source filename").toString().isEmpty()) {
-        QAction* reload = menu->addAction(tr("&Reload Item from File"));
-        reload->setData(qVariantFromValue(selectedItemIndex));
-        connect(reload, SIGNAL(triggered()),
-                this, SLOT(reload_item()));
-      }
-      QAction* saveas = menu->addAction(tr("&Save as..."));
-      saveas->setData(qVariantFromValue(selectedItemIndex));
-      connect(saveas,  SIGNAL(triggered()),
-              this, SLOT(on_actionSaveAs_triggered()));
-      QAction* showobject = menu->addAction(tr("&Zoom to this Object"));
-      showobject->setData(qVariantFromValue(selectedItemIndex));
-      connect(showobject, SIGNAL(triggered()),
-              this, SLOT(viewerShowObject()));
-
-      menu->setProperty(prop_name, true);
-    }
-  }
-  menu->addMenu(ui->menuOperations);
-  if(menu)
-    menu->exec(global_pos);
-}
-
-void MainWindow::showSceneContextMenu(const QPoint& p) {
-  QWidget* sender = qobject_cast<QWidget*>(this->sender());
-  if(!sender) return;
-
-  int index = -1;
-  if(sender == sceneView) {
-      QModelIndex modelIndex = sceneView->indexAt(p);
-      if(!modelIndex.isValid())
-      {
-          const char* prop_name = "Menu modified by MainWindow.";
-
-          QMenu* menu = ui->menuFile;
-          if(menu) {
-              bool menuChanged = menu->property(prop_name).toBool();
-              if(!menuChanged) {
-                  menu->setProperty(prop_name, true);
-              }
-          }
-          if(menu)
-              menu->exec(sender->mapToGlobal(p));
-          return;
-      }
-      else
-      {
-          index = proxyModel->mapToSource(modelIndex).row();
-          scene->setSelectedItemIndex(index);
-      }
-  }
-  else {
-    index = scene->mainSelectionIndex();
-  }
-
-  showSceneContextMenu(index, sender->mapToGlobal(p));
-}
-
-void MainWindow::removeManipulatedFrame(CGAL::Three::Scene_item* item)
-{
-  if(item->manipulatable() &&
-     item->manipulatedFrame() == viewer->manipulatedFrame()) {
-    viewer->setManipulatedFrame(0);
-  }
-}
-
-void MainWindow::updateInfo() {
-  CGAL::Three::Scene_item* item = scene->item(getSelectedSceneItemIndex());
-  if(item) {
-    QString item_text = item->toolTip();
-    QString item_filename = item->property("source filename").toString();
-    item_text += QString("Bounding box: min (%1,%2,%3), max(%4,%5,%6)")
-            .arg(item->bbox().xmin)
-            .arg(item->bbox().ymin)
-            .arg(item->bbox().zmin)
-            .arg(item->bbox().xmax)
-            .arg(item->bbox().ymax)
-            .arg(item->bbox().zmax);
-    if(item->getNbIsolatedvertices() > 0)
-    item_text += QString("<br />Number of isolated vertices : %1<br />").arg(item->getNbIsolatedvertices());
-    if(!item_filename.isEmpty()) {
-      item_text += QString("<br />File:<i> %1").arg(item_filename);
-    }
-    ui->infoLabel->setText(item_text);
-  }
-  else
-    ui->infoLabel->clear();
-}
-void MainWindow::updateDisplayInfo() {
-  CGAL::Three::Scene_item* item = scene->item(getSelectedSceneItemIndex());
-  if(item)
-    ui->displayLabel->setPixmap(item->graphicalToolTip());
-  else 
-    ui->displayLabel->clear();
-}
-
-void MainWindow::readSettings()
-{
-  {
-    QSettings settings;
-    // enable anti-aliasing 
-    ui->actionAntiAliasing->setChecked(settings.value("antialiasing", false).toBool());
-    // read plugin blacklist
-    QStringList blacklist=settings.value("plugin_blacklist",QStringList()).toStringList();
-    Q_FOREACH(QString name,blacklist){ plugin_blacklist.insert(name); }
-  }
-}
-
-void MainWindow::writeSettings()
-{
-  this->writeState("MainWindow");
-  {
-    QSettings settings;
-    settings.setValue("antialiasing", 
-                      ui->actionAntiAliasing->isChecked());
-    //setting plugin blacklist
-    QStringList blacklist;
-    Q_FOREACH(QString name,plugin_blacklist){ blacklist << name; }
-    if ( !blacklist.isEmpty() ) settings.setValue("plugin_blacklist",blacklist);
-    else settings.remove("plugin_blacklist");
-  }
-  std::cerr << "Write setting... done.\n";
-}
-
-void MainWindow::quit()
-{
-  close();
-}
-
-void MainWindow::closeEvent(QCloseEvent *event)
-{
-    for(int i=0; i<plugins.size(); i++)
-    {
-      plugins[i].first->closure();
-    }
-  writeSettings();
-  event->accept();
-}
-
-bool MainWindow::load_script(QString filename)
-{
-  QFileInfo fileinfo(filename);
-  return load_script(fileinfo);
-}
-
-bool MainWindow::load_script(QFileInfo info)
-{
-#if defined(QT_SCRIPT_LIB)
-  QString program;
-  QString filename = info.absoluteFilePath();
-  QFile script_file(filename);
-  script_file.open(QIODevice::ReadOnly);
-  program = script_file.readAll();
-  if(!program.isEmpty())
-  {
-    QTextStream(stderr) 
-      << "Execution of script \"" 
-      << filename << "\"\n";
-    evaluate_script(program, filename);
-    return true;
-  }
-#endif
-  return false;
-}
-
-void MainWindow::on_actionLoad_Script_triggered() 
-{
-#if defined(QT_SCRIPT_LIB)
-  QString filename = QFileDialog::getOpenFileName(
-    this,
-    tr("Select a script to run..."),
-    ".",
-    "QTScripts (*.js);;All Files (*)");
-
-  load_script(QFileInfo(filename));
-#endif
-}
-
-void MainWindow::on_actionLoad_triggered()
-{
-  QStringList filters;
-  // we need to special case our way out of this
-  filters << "All Files (*)";
-
-  QStringList extensions;
-
-  typedef QMap<QString, CGAL::Three::Polyhedron_demo_io_plugin_interface*> FilterPluginMap;
-  FilterPluginMap filterPluginMap;
-  
-  Q_FOREACH(CGAL::Three::Polyhedron_demo_io_plugin_interface* plugin, io_plugins) {
-    QStringList split_filters = plugin->loadNameFilters().split(";;");
-    Q_FOREACH(const QString& filter, split_filters) {
-      FilterPluginMap::iterator it = filterPluginMap.find(filter);
-      if(it != filterPluginMap.end()) {
-        qDebug() << "Duplicate Filter: " << it.value();
-        qDebug() << "This filter will not be available.";
-      } else {
-        filterPluginMap[filter] = plugin;
-      }
-      filters << filter;
-    }
-  }
-
-  QSettings settings;
-  QString directory = settings.value("OFF open directory",
-                                     QDir::current().dirName()).toString();
-
-  QFileDialog dialog(this);
-  dialog.setDirectory(directory);
-  dialog.setNameFilters(filters);
-  dialog.setFileMode(QFileDialog::ExistingFiles);
-
-  if(dialog.exec() != QDialog::Accepted) { return; }
-  FilterPluginMap::iterator it = 
-    filterPluginMap.find(dialog.selectedNameFilter());
-  
-  CGAL::Three::Polyhedron_demo_io_plugin_interface* selectedPlugin = NULL;
-
-  if(it != filterPluginMap.end()) {
-    selectedPlugin = it.value();
-  }
-
-  Q_FOREACH(const QString& filename, dialog.selectedFiles()) {
-    CGAL::Three::Scene_item* item = NULL;
-    if(selectedPlugin) {
-      QFileInfo info(filename);
-      item = load_item(info, selectedPlugin);
-      Scene::Item_id index = scene->addItem(item);
-      selectSceneItem(index);
-      this->addToRecentFiles(filename);
-    } else {
-      open(filename);
-    }
-  }
-}
-
-void MainWindow::on_actionSaveAs_triggered()
-{
-  int index = -1;
-  QAction* sender_action = qobject_cast<QAction*>(sender());
-  if(sender_action && !sender_action->data().isNull()) {
-    index = sender_action->data().toInt();
-  }
-
-  if(index < 0) {
-    QModelIndexList selectedRows = sceneView->selectionModel()->selectedRows();
-    if(selectedRows.size() != 1)
-      return;
-    index = getSelectedSceneItemIndex();
-  }
-  CGAL::Three::Scene_item* item = scene->item(index);
-
-  if(!item)
-    return;
-
-  QVector<CGAL::Three::Polyhedron_demo_io_plugin_interface*> canSavePlugins;
-  QStringList filters;
-  Q_FOREACH(CGAL::Three::Polyhedron_demo_io_plugin_interface* plugin, io_plugins) {
-    if(plugin->canSave(item)) {
-      canSavePlugins << plugin;
-      filters += plugin->saveNameFilters();
-    }
-  }
-  filters << tr("All files (*)");
-
-  if(canSavePlugins.isEmpty()) {
-    QMessageBox::warning(this,
-                         tr("Cannot save"),
-                         tr("The selected object %1 cannot be saved.")
-                         .arg(item->name()));
-    return;
-  }
-
-  QString caption = tr("Save %1 to File...").arg(item->name());
-  QString filename = 
-    QFileDialog::getSaveFileName(this,
-                                 caption,
-                                 QString(),
-                                 filters.join(";;"));
-  save(filename, item);
-}
-
-void MainWindow::save(QString filename, CGAL::Three::Scene_item* item) {
-  QFileInfo fileinfo(filename);
-
-  Q_FOREACH(CGAL::Three::Polyhedron_demo_io_plugin_interface* plugin, io_plugins) {
-    if(  plugin->canSave(item) &&
-        file_matches_filter(plugin->saveNameFilters(),filename) )
-    {
-      if(plugin->save(item, fileinfo))
-        break;
-    }
-  }
-}
-
-void MainWindow::on_actionSaveSnapshot_triggered()
-{
-  viewer->saveSnapshot(false);
-}
-
-bool MainWindow::on_actionErase_triggered()
-{
-  int next_index = scene->erase(scene->selectionIndices());
-  selectSceneItem(next_index);
-  return next_index >= 0;
-}
-
-void MainWindow::on_actionEraseAll_triggered()
-{
-  while(on_actionErase_triggered()) {
-  }
-}
-
-void MainWindow::on_actionDuplicate_triggered()
-{
-  int index = scene->duplicate(getSelectedSceneItemIndex());
-  selectSceneItem(index);
-}
-
-void MainWindow::on_actionShowHide_triggered()
-{
-  Q_FOREACH(QModelIndex index, sceneView->selectionModel()->selectedRows())
-  {
-    int i = proxyModel->mapToSource(index).row();
-    CGAL::Three::Scene_item* item = scene->item(i);
-    item->setVisible(!item->visible());
-    scene->itemChanged(i);
-  }
-}
-
-void MainWindow::on_actionSetPolyhedronA_triggered()
-{
-  int i = getSelectedSceneItemIndex();
-  scene->setItemA(i);
-}
-
-void MainWindow::on_actionSetPolyhedronB_triggered()
-{
-  int i = getSelectedSceneItemIndex();
-  scene->setItemB(i);
-}
-void MainWindow::on_actionPreferences_triggered()
-{
-  QDialog dialog(this);
-  Ui::PreferencesDialog prefdiag;
-  prefdiag.setupUi(&dialog);
-  
-  
-  QStandardItemModel* iStandardModel = new QStandardItemModel(this);
-  //add blacklisted plugins
-  Q_FOREACH(QString name, plugin_blacklist)
-  {
-    QStandardItem* item =  new QStandardItem(name);
-    item->setCheckable(true);
-    item->setCheckState(Qt::Checked);
-    iStandardModel->appendRow(item);
-  }
-
-  //add operations plugins
-  Q_FOREACH(PluginNamePair pair,plugins){
-    QStandardItem* item =  new QStandardItem(pair.second);
-    item->setCheckable(true);
-    iStandardModel->appendRow(item);
-  }
-  
-  //add io-plugins
-  Q_FOREACH(CGAL::Three::Polyhedron_demo_io_plugin_interface* plugin, io_plugins)
-  {
-    QStandardItem* item =  new QStandardItem(plugin->name());
-    item->setCheckable(true);
-    if ( plugin_blacklist.contains(plugin->name()) ) item->setCheckState(Qt::Checked);
-    iStandardModel->appendRow(item);
-  }
-
-  //Setting the model
-  prefdiag.listView->setModel(iStandardModel);
-  
-  dialog.exec();  
-  
-  if ( dialog.result() )
-  {
-    plugin_blacklist.clear();
-    for (int k=0,k_end=iStandardModel->rowCount();k<k_end;++k)
-    {
-      QStandardItem* item=iStandardModel->item(k);
-      if (item->checkState()==Qt::Checked)
-        plugin_blacklist.insert(item->text());
-    }
-  }
-  
-  for (int k=0,k_end=iStandardModel->rowCount();k<k_end;++k) delete iStandardModel->item(k);
-  delete iStandardModel;
-}
-
-void MainWindow::on_actionSetBackgroundColor_triggered()
-{
-  QColor c =  QColorDialog::getColor();
-  if(c.isValid()) {
-    viewer->setBackgroundColor(c);
-  }
-}
-
-void MainWindow::on_action_Look_at_triggered()
-{
-  Show_point_dialog dialog(this);
-  dialog.setWindowTitle(tr("Look at..."));
-  int i = dialog.exec();
-  if( i == QDialog::Accepted &&
-      dialog.has_correct_coordinates() )
-  {
-    viewerShow((float)dialog.get_x(),
-               (float)dialog.get_y(),
-               (float)dialog.get_z());
-  }
-}
-
-void MainWindow::viewerShowObject()
-{
-  int index = -1;
-  QAction* sender_action = qobject_cast<QAction*>(sender());
-  if(sender_action && !sender_action->data().isNull()) {
-    index = sender_action->data().toInt();
-  }
-  if(index >= 0) {
-    const Scene::Bbox bbox = scene->item(index)->bbox();
-    viewerShow((float)bbox.xmin, (float)bbox.ymin, (float)bbox.zmin,
-               (float)bbox.xmax, (float)bbox.ymax, (float)bbox.zmax);
-  }
-}
-
-QString MainWindow::camera_string() const
-{
-  return viewer->dumpCameraCoordinates();
-}
-
-void MainWindow::on_actionDumpCamera_triggered()
-{
-  information(QString("Camera: %1")
-              .arg(camera_string()));
-}
-
-void MainWindow::on_action_Copy_camera_triggered()
-{
-  qApp->clipboard()->setText(this->camera_string());
-}
-
-void MainWindow::on_action_Paste_camera_triggered()
-{
-  QString s = qApp->clipboard()->text();
-  viewer->moveCameraToCoordinates(s, 0.5f);
-}
-
-void MainWindow::setAddKeyFrameKeyboardModifiers(::Qt::KeyboardModifiers m)
-{
-  viewer->setAddKeyFrameKeyboardModifiers(m);
-}
-
-void MainWindow::on_actionRecenterScene_triggered()
-{
-  updateViewerBBox();
-  viewer->camera()->interpolateToFitScene();
-}
-
-void MainWindow::on_actionLoad_plugin_triggered()
-{
-    //pop a dialog of path selection, get the path and add it to plugins_directory
-
-    QString filters("Library files (*.dll *.DLL *.so *.a *.sl *.dylib *.bundle);;"
-                    "Any files (*)");
-
-    QStringList paths = QFileDialog::getOpenFileNames(
-                this,
-                tr("Select the directory containing your plugins:"),
-                ".",filters);
-    Q_FOREACH(QString fileName, paths)
-    {
-      if(fileName.contains("plugin") && QLibrary::isLibrary(fileName)) {
-          QFileInfo fileinfo(fileName);
-        //set plugin name
-        QString name = fileinfo.fileName();
-        name.remove(QRegExp("^lib"));
-        name.remove(QRegExp("\\..*"));
-        QDebug qdebug = qDebug();
-        qdebug << "### Loading \"" << fileName.toUtf8().data() << "\"... ";
-        QPluginLoader loader;
-        loader.setFileName(fileName);
-        QObject *obj = loader.instance();
-        if(obj) {
-          obj->setObjectName(name);
-          bool init1 = initPlugin(obj);
-          bool init2 = initIOPlugin(obj);
-          if (!init1 && !init2)
-              qdebug << "not for this program";
-          else
-              qdebug << "success";
-        }
-        else {
-          qdebug << "error: " << qPrintable(loader.errorString());
-        }
-      }
-    }
-
-//Creates sub-Menus for operations.
-//!TODO : Make it recursive to allow sub-menus of sub-menus.
-//!The argument should be the menuPath and it should recurse until hasSub stays false.
- QList<QAction*> as = ui->menuOperations->actions();
-
-Q_FOREACH(QAction* a, as)
-{
-            QString menuPath = a->property("subMenuName").toString();
-            setMenus(menuPath, ui->menuOperations->title(), a);
-            // sort the operations menu by name
-            as = ui->menuOperations->actions();
-            qSort(as.begin(), as.end(), actionsByName);
-            ui->menuOperations->clear();
-            ui->menuOperations->addActions(as);
-        }
-}
-
-void MainWindow::recurseExpand(QModelIndex index)
-{
-    int row = index.row();
-    if(index.child(0,0).isValid())
-    {
-        recurseExpand(index.child(0,0));
-    }
-
-    QString name = scene->item(scene->getIdFromModelIndex(index))->name();
-        CGAL::Three::Scene_group_item* group =
-                qobject_cast<CGAL::Three::Scene_group_item*>(scene->item(scene->getIdFromModelIndex(index)));
-        if(group && group->isExpanded())
-        {
-            sceneView->setExpanded(proxyModel->mapFromSource(index), true);
-        }
-        else if (group && !group->isExpanded()){
-            sceneView->setExpanded(proxyModel->mapFromSource(index), false);
-        }
-
-        if( index.sibling(row+1,0).isValid())
-            recurseExpand(index.sibling(row+1,0));
-}
-void MainWindow::restoreCollapseState()
-{
-    QModelIndex modelIndex = scene->index(0,0,scene->invisibleRootItem()->index());
-    if(modelIndex.isValid())
-        recurseExpand(modelIndex);
-}
-void MainWindow::make_new_group()
-{
-    Scene_group_item * group = new Scene_group_item("New group");
-    scene->add_group(group);
-}
-
-void MainWindow::on_upButton_pressed()
-{
-    scene->moveRowUp();
-}
-
-void MainWindow::on_downButton_pressed()
-{
-    scene->moveRowDown();
-}
-
-void MainWindow::recenterSceneView(const QModelIndex &id)
-{
-    if(id.isValid())
-    {
-        // mapFromSource is necessary to convert the QModelIndex received
-        // from the Scene into a valid QModelIndex in the view, beacuse of
-        // the proxymodel
-        sceneView->scrollTo(proxyModel->mapFromSource(id));
-    }
-}
-
-void MainWindow::statistics_on_item()
-{
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-
-  if (statistics_dlg == NULL)
-  {
-    statistics_dlg = new QDialog(this);
-    statistics_ui->setupUi(statistics_dlg);
-    connect(statistics_ui->okButtonBox, SIGNAL(accepted()),
-            statistics_dlg, SLOT(accept()));
-    connect(statistics_ui->updateButton, SIGNAL(clicked()),
-            this, SLOT(statistics_on_item()));
-  }
-  statistics_ui->label_htmltab->setText(get_item_stats());
-
-  statistics_dlg->show();
-  statistics_dlg->raise();
-
-  QApplication::restoreOverrideCursor();
-}
-
-/* Creates a string containing an html table. This string is constructed by appending each parts of each row, so that the data can
-  depend on the number of selected items. This String is then returned.*/
-QString MainWindow::get_item_stats()
-{
-  //1st step : get all classnames of the selected items
-  QList<QString> classnames;
-  Q_FOREACH(int id, getSelectedSceneItemIndices())
-  {
-    QString classname = scene->item(id)->metaObject()->className();
-    if(!classnames.contains(classname))
-      classnames << classname;
-  }
-  //2nd step : separate the selection in lists corresponding to their classname
-  QVector< QList<Scene_item*> > items;
-  items.resize(classnames.size());
-  Q_FOREACH(int id, getSelectedSceneItemIndices())
-  {
-    Scene_item* s_item = scene->item(id);
-    for(int i=0; i<items.size(); i++)
-      if(classnames.at(i).contains(s_item->metaObject()->className()))
-      {
-        items[i] << s_item;
-        break;
-      }
-  }
-  //last step :: making tables for each type of item
-  QString str;
-  for(int i=0; i< classnames.size(); i++)
-  {
-    CGAL::Three::Scene_item::Header_data data = items[i].at(0)->header();
-    int title = 0;
-    int titles_limit =0;
-    if(data.titles.size()>0)
-    {
-      //1st row : item names
-      str.append("<html> <table border=1>""<tr><td colspan = 2></td>");
-      Q_FOREACH(Scene_item* sit, items[i])
-      {
-        str.append(QString("<td>%1</td>").arg(sit->name()));
-      }
-
-
-
-      for(int j=0; j<data.categories.size(); j++)
-      {
-        str.append(QString("<tr><th rowspan=%1> %2 </th>")
-                   .arg(QString::number(data.categories[j].second))
-                   .arg(data.categories[j].first));
-        titles_limit+=data.categories[j].second;
-        str.append(QString("<td> %1 </td>").arg(data.titles.at(title)));
-        Q_FOREACH(Scene_item* sit, items[i])
-        {
-          str.append(QString("<td>%1</td>").arg(sit->compute_stats(title)));
-        }
-        title++;
-        for(;title<titles_limit; title++)
-        {
-          str.append(QString("</tr><tr><td> %1 </td>").arg(data.titles.at(title)));
-          Q_FOREACH(Scene_item* sit, items[i])
-          {
-            str.append(QString("<td>%1</td>").arg(sit->compute_stats(title)));
-          }
-        }
-
-        str.append("</tr>");
-      }
-
-      str.append(QString("</tr>""</table></html>"));
-    }
-  }
-  return str;
-}
-void MainWindow::setCollapsed(QModelIndex index)
-{
-  Q_EMIT collapsed(proxyModel->mapToSource(index));
-}
-
-void MainWindow::setExpanded(QModelIndex index)
-{
-  Q_EMIT expanded(proxyModel->mapToSource(index));
-}
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/MainWindow.h b/3rdparty/CGAL-4.8/demo/Polyhedron/MainWindow.h
deleted file mode 100644
index e2e8a9e..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/MainWindow.h
+++ /dev/null
@@ -1,386 +0,0 @@
-#ifndef MAINWINDOW_H
-#define MAINWINDOW_H
-#include "config.h"
-#include "MainWindow_config.h"
-
-#include <QtOpenGL/qgl.h>
-#include <CGAL/Qt/DemosMainWindow.h>
-#ifdef QT_SCRIPT_LIB
-#  include  <QScriptEngine>
-#endif
-
-#include <QVector>
-#include <QList>
-#include <QFileInfo>
-#include <QStringList>
-#include <QSet>
-#include <QModelIndex>
-class Scene;
-class Viewer;
-class QTreeView;
-class QMenu;
-namespace CGAL {
-namespace Three{
-class Polyhedron_demo_io_plugin_interface;
-class Polyhedron_demo_plugin_interface;
-class Scene_item;
-}
-}
-
-class QSortFilterProxyModel;
-
-namespace Ui {
-  class MainWindow;
-  class Statistics_on_item_dialog;
-}
-
-#include "Polyhedron_type_fwd.h"
-
-#include "Messages_interface.h"
-
-/*!
- * \brief The main window of the applicatipon.
- * It contains all the widgets, the menus and the elements of interface
- * of the application.*/
-
-class MAINWINDOW_EXPORT MainWindow : 
-  public CGAL::Qt::DemosMainWindow,
-  public Messages_interface
-{
-  Q_OBJECT
-  Q_INTERFACES(Messages_interface)
-public:
-  /*! \brief The constructor
-   * It links the class with its UI file and sets it up.
-   * It also saves pointers to viewer and the sceneView.
-   * Then it creates and initializes the scene and do the
-   * connexions with the UI. Finally it loads the plugins.*/
-
-  MainWindow(QWidget* parent = 0);
-  ~MainWindow();
-
-  /*! Find an IO plugin.
-   * throws std::invalid_argument if no loader with that argument can be found
-   @returns the IO plugin associated with `loader_name`*/
-  CGAL::Three::Polyhedron_demo_io_plugin_interface* find_loader(const QString& loader_name) const;
-  
-  /*! \brief Load an item with a given loader.
-   * throws `std::logic_error` if loading does not succeed or
-   * `std::invalid_argument` if `fileinfo` specifies an invalid file*/
-  CGAL::Three::Scene_item* load_item(QFileInfo fileinfo, CGAL::Three::Polyhedron_demo_io_plugin_interface*);
-
-Q_SIGNALS:
-  void on_closure();
-  void expanded(QModelIndex);
-  void collapsed(QModelIndex);
-
-
-public Q_SLOTS:
-  //!Creates a new group and adds it to the scene.
-  void make_new_group();
-  void updateViewerBBox();
-  void open(QString);
-  void on_upButton_pressed();
-  void on_downButton_pressed();
-  void restoreCollapseState();
-  void setExpanded(QModelIndex);
-  void setCollapsed(QModelIndex);
-  /// given a file extension file, returns true if `filename` matches the filter
-  bool file_matches_filter(const QString& filters, const QString& filename);
-  //!Prints a dialog containing statistics on the selected polyhedrons.
-  void statistics_on_item();
-  /*! Open a file with a given loader, and return true if it was successful.
-   This slot is for use by scripts.*/
-  bool open(QString filename, QString loader_name);
-
-  /*! Reloads an item. Expects to be called by a QAction with the
-   index of the item to be reloaded as data attached to the action.
-   The index must identify a valid `Scene_item`.*/
-  void reload_item();
-  
-  /*!
-   * This is an overloaded function.
-   * If QT_SCRIPT_LIB is defined, returns true if the script is valid.
-   * If not, returns false.
-   */
-  bool load_script(QString filename);
-
-  /*! If QT_SCRIPT_LIB is defined, returns true if the script is valid.
-  * If not, returns false.
-  */
-  bool load_script(QFileInfo);
-
-  /*!
-   * Gives the keyboard input focus to the widget searchEdit.
-   */
-  void setFocusToQuickSearch();
-
-  /*!
-   * Clears the current selection and select the scene_item with
-   * the index i in the sceneView. Calls itemChanged(i) from the scene.
-   */
-  void selectSceneItem(int i);
-  /*!
-   * Prints coordinates of a point and its distance to the last
-   * position printed by this function.
-   */
-  void showSelectedPoint(double, double, double);
-  /*!
-   * Calls removeSceneItemFromSelection(i).
-   */
-  void unSelectSceneItem(int i);
-  /*!
-   * Clears the current selection and select all the scene_items
-   * in the sceneView.
-   */
-  void selectAll();
-  /*!
-   * Adds the scene_item with the index i in the sceneView to the
-   * current selection. Calls itemChanged(i) from the scene.
-   */
-  void addSceneItemInSelection(int i);
-
-  /*!
-   * Removes the scene_item with the index i in the sceneView to the
-   * current selection. Calls itemChanged(i) from the scene.
-   */
-  void removeSceneItemFromSelection(int i);
-
-  /*!
-   * Calls setAddKeyFrameKeyboardModifiers(m) from the viewer.
-   */
-  void setAddKeyFrameKeyboardModifiers(Qt::KeyboardModifiers);
-  /*!
-   * Set the visibility of all actions from the targeted menu
-   * and its submenus to false and disables them.
-   */
-  void clearMenu(QMenu*);
-  /*!
-   * Enables and sets the targeted action's visibility to true.
-   * Does the same in all the menus of the widgets associated with
-   * this action.
-   */
-  void addAction(QAction*);
-  /*!
-   * Creates an action with text actionText named actionName and
-   * adds it to the menu menuName. If menuName does not exist,
-   * it is created.
-   */
-  void addAction(QString actionName,
-                 QString actionText,
-                 QString menuName);
-  /*!
-   * Sets the scene center to the target position and makes the
-   * scene slide to this new center. Also sets the pivotPoint of
-   * the camera to this position.
-   */
-  void viewerShow(float, float, float);
-  /*!
-   * Sets the scene center to be the center of the target BBox.
-   * Also sets the pivotPoint of the camera to this position.
-   */
-  void viewerShow(float, float, float, float, float, float);
-  /*!
-   * Centers the scene on the target object.
-   */
-  void viewerShowObject();
-  /*!
-   * Displays a text preceded by the mention "INFO :".
-   */
-  void information(QString);
-  /*!
-   * Displays a blue text preceded by the mention "WARNING :".
-   */
-  void warning(QString);
-  /*!
-   * Displays a red text preceded by the mention "ERROR :".
-   */
-  void error(QString);
-
-    //!Displays a text in the chosen html color with the chosen html font.
-
-  void message(QString, QString, QString = QString("normal"));
-
-    //!Returns true if the target plugin is present. If not, returns false.
-  bool hasPlugin(const QString&) const;
-  /*!
-   * If able, finds a script debugger and interrupts current action. Default
-   * value for parameter is true.
-   */
-  void enableScriptDebugger(bool = true);
-
-protected Q_SLOTS:
-
-   //!Gets the new selected item(s) from the sceneView and updates the scene
-   //!and viewer accordingly.
-  /*!
-   * Set the scene selected item or selected item list. Sets the manipulated
-   * frame of the viewer to the new selected item's and calls updateGL().
-   */
-  void selectionChanged();
-  //! Scrolls to the new selected item.
-  void recenterSceneView(const QModelIndex &id);
-
-  /*!
-   * Invoques a context menu for the currently selected item at the requested
-   * position.
-   */
-  void contextMenuRequested(const QPoint& global_pos);
-  /*!
-   * Invoques a context menu for the requested item at the requested
-   * position.
-   */
-  void showSceneContextMenu(int selectedItemIndex,
-                            const QPoint& global_pos);
-
-  //!This is an overloaded function. Invoques a context menu at the requested
-  //!position.
-  /*!
-   * If the widget which received the request is not the sceneView, the index
-   * chosen by default for the menu is the one of the currently selected item.
-   * If it is the sceneView, then the index of the clicked item is collected.
-   * If this index is valid, then it is used for the menu. If not, the function
-   * returns.
-   */
-  void showSceneContextMenu(const QPoint& local_pos_of_treeview);
-
-  //!Prints information about the currently selected item if able.
-  void updateInfo();
-  //!Prints graphical information about the currently selected item if able.
-  void updateDisplayInfo();
-  //!Sets the current manipulated frame to 0.
-  void removeManipulatedFrame(CGAL::Three::Scene_item*);
-
-  // settings
-  //!Closes the main window.
-  void quit();
-  //!Reads the plugin_blacklist contents and apply them.
-  void readSettings();
-  //!Sets up the plugin_blacklist.
-  void writeSettings();
-
-  // load, erase, duplicate
-  //!Loops on on_actionErase_triggered();
-  void on_actionEraseAll_triggered();
-  //!Opens a dialog to open one or several files.
-  void on_actionLoad_triggered();
-  //!Erases the selected items. Returns true if items remain in the sceneView.
-  bool on_actionErase_triggered();
-  //!Duplicates the selected item and selects the new item.
-  void on_actionDuplicate_triggered();
-  //!If QT_SCRIPT_LIB is defined, opens a dialog to choose a script.
-  void on_actionLoad_Script_triggered();
-  //!Loads a plugin from a specified directory
-  void on_actionLoad_plugin_triggered();
-  // Show/Hide
-  //!Swap the visibility of the selected item(s).
-  void on_actionShowHide_triggered();
-
-  // Select A/B
-  //!Sets the selected item as item_A.
-  void on_actionSetPolyhedronA_triggered();
-  //!Sets the selected item as Item_B.
-  void on_actionSetPolyhedronB_triggered();
-
-  //Preferences edition
-  //!Opens the Preferences dialog.
-  void on_actionPreferences_triggered();
-  // save as...
-  //!Opens a dialog to save selected item if able.
-  void on_actionSaveAs_triggered(); 
-  //!Calls the function save of the current plugin if able.
-  void save(QString filename, CGAL::Three::Scene_item* item);
-  //!Calls the function saveSnapShot of the viewer.
-  void on_actionSaveSnapshot_triggered();
-  //!Opens a Dialog to choose a color and make it the background color.
-  void on_actionSetBackgroundColor_triggered();
-  /*! Opens a Dialog to enter coordinates of the new center point and sets it
-   * with viewerShow.
-   *@see viewerShow(float, float, float, float, float, float)
-   */
-  void on_action_Look_at_triggered();
-  //!Returns the position and orientation of the current camera frame.
-  QString camera_string() const;
-  /*! Prints the position and orientation of the current camera frame.
-   * @see camera_string()
-   */
-  void on_actionDumpCamera_triggered();
-  //!Sets the coordinates of the camera in the clipboard text.
-  void on_action_Copy_camera_triggered();
-  //!Gets coordinates from the clipboard and sets them as the current ones for
-  //!the camera.
-  void on_action_Paste_camera_triggered();
-  //!Hides not available operations and show available operations in all the
-  //!menus.
-  void filterOperations();
-  //!Updates the bounding box and moves the camera to fits the scene.
-  void on_actionRecenterScene_triggered();
-protected:
-  QList<QAction*> createSubMenus(QList<QAction*>);
-  /*! For each objects in the sceneView, loads the associated plugins.
-   * Gets the property "submenuName" of all the actions and creates submenus.
-   * Sorts the Operations menu by name.
-   * @see initPlugin(QObject*);
-   * @see initIOPlugin(QObject*);
-   */
-  void loadPlugins();
-  /*!
-   * \brief Initializes the plugins.
-   * Makes pairs between plugins and object names and fills the Operations menu.
-   * Called only once.
-   */
-  bool initPlugin(QObject*);
-  //!Initializes the IO plugin for the target object.
-  bool initIOPlugin(QObject*);
-  /*!
-   * Calls writeSettings() and set the flag accepted for the event.
-   * @see writeSettings()
-   */
-  void closeEvent(QCloseEvent *event);
-  /*! Returns the currently selected item in the sceneView. Returns -1
-   * if none is selected.
-   */
-  int getSelectedSceneItemIndex() const;
-  //! Returns a list of the selected items in the sceneView.
-  QList<int> getSelectedSceneItemIndices() const;
-private:
-  void recurseExpand(QModelIndex index);
-  QString get_item_stats();
-  QString strippedName(const QString &fullFileName);
-  void setMenus(QString, QString, QAction *a);
-  /// plugin black-list
-  QSet<QString> plugin_blacklist;
-  Scene* scene;
-  Viewer* viewer;
-  QSortFilterProxyModel* proxyModel;
-  QTreeView* sceneView;
-  Ui::MainWindow* ui;
-  QVector<CGAL::Three::Polyhedron_demo_io_plugin_interface*> io_plugins;
-  QMap<QString,QString> default_plugin_selection;
-  // typedef to make Q_FOREACH work
-  typedef QPair<CGAL::Three::Polyhedron_demo_plugin_interface*, QString> PluginNamePair;
-  QVector<PluginNamePair > plugins;
-  //!Called when "Add new group" in the file menu is triggered.
-  QAction* actionAddToGroup;
-  void print_message(QString message) { messages->information(message); }
-  Messages_interface* messages;
-
-  QDialog *statistics_dlg;
-  Ui::Statistics_on_item_dialog* statistics_ui;
-
-#ifdef QT_SCRIPT_LIB
-  QScriptEngine* script_engine;
-public:
-  /*! Evaluates a script and search for uncaught exceptions. If quiet is false, prints the
-   *backtrace of the uncaught exceptions.
-   */
-  void evaluate_script(QString script, 
-                       const QString & fileName = QString(),
-                       const bool quiet = false);
-  //! Calls evaluate_script(script, filename, true).
-  void evaluate_script_quiet(QString script, 
-                             const QString & fileName = QString());
-#endif
-};
-
-#endif // ifndef MAINWINDOW_H
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/MainWindow.ui b/3rdparty/CGAL-4.8/demo/Polyhedron/MainWindow.ui
deleted file mode 100644
index bd6e04e..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/MainWindow.ui
+++ /dev/null
@@ -1,691 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>MainWindow</class>
- <widget class="QMainWindow" name="MainWindow">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>978</width>
-    <height>594</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>CGAL Three</string>
-  </property>
-  <property name="windowIcon">
-   <iconset resource="Polyhedron_3.qrc">
-    <normaloff>:/cgal/icons/resources/cgal_logo.xpm</normaloff>:/cgal/icons/resources/cgal_logo.xpm</iconset>
-  </property>
-  <widget class="QWidget" name="centralwidget">
-   <layout class="QVBoxLayout" name="verticalLayout_2">
-    <item>
-     <widget class="Viewer" name="viewer" native="true">
-      <property name="sizePolicy">
-       <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
-        <horstretch>0</horstretch>
-        <verstretch>1</verstretch>
-       </sizepolicy>
-      </property>
-     </widget>
-    </item>
-   </layout>
-  </widget>
-  <widget class="QMenuBar" name="menubar">
-   <property name="geometry">
-    <rect>
-     <x>0</x>
-     <y>0</y>
-     <width>978</width>
-     <height>26</height>
-    </rect>
-   </property>
-   <widget class="QMenu" name="menuFile">
-    <property name="title">
-     <string>&File</string>
-    </property>
-    <addaction name="actionLoad"/>
-    <addaction name="actionErase"/>
-    <addaction name="actionEraseAll"/>
-    <addaction name="actionDuplicate"/>
-    <addaction name="actionSaveAs"/>
-    <addaction name="actionSaveSnapshot"/>
-    <addaction name="separator"/>
-    <addaction name="actionLoad_Script"/>
-    <addaction name="separator"/>
-    <addaction name="actionLoad_plugin"/>
-    <addaction name="separator"/>
-    <addaction name="actionQuit"/>
-   </widget>
-   <widget class="QMenu" name="menuEdit">
-    <property name="title">
-     <string>&Edit</string>
-    </property>
-    <addaction name="actionShowHide"/>
-    <addaction name="actionSetPolyhedronA"/>
-    <addaction name="actionSetPolyhedronB"/>
-    <addaction name="actionSelect_all_items"/>
-    <addaction name="actionPreferences"/>
-   </widget>
-   <widget class="QMenu" name="menuOperations">
-    <property name="title">
-     <string>&Operations</string>
-    </property>
-    <widget class="QMenu" name="menu_Boolean_operations">
-     <property name="title">
-      <string>&Boolean Operations</string>
-     </property>
-     <addaction name="actionToNef"/>
-     <addaction name="actionToPoly"/>
-     <addaction name="actionUnion"/>
-     <addaction name="actionIntersection"/>
-     <addaction name="actionDifference"/>
-     <addaction name="separator"/>
-     <addaction name="actionMinkowskiSum"/>
-    </widget>
-    <addaction name="actionEstimateCurvature"/>
-    <addaction name="actionSelfIntersection"/>
-    <addaction name="actionConvexHull"/>
-    <addaction name="actionKernel"/>
-    <addaction name="actionSimplify"/>
-    <addaction name="actionRemeshing"/>
-    <addaction name="actionConvexDecomposition"/>
-    <addaction name="menu_Boolean_operations"/>
-    <addaction name="actionInsideOut"/>
-   </widget>
-   <widget class="QMenu" name="menuView">
-    <property name="title">
-     <string>&View</string>
-    </property>
-    <widget class="QMenu" name="menuDockWindows">
-     <property name="title">
-      <string>&Dock Windows</string>
-     </property>
-     <addaction name="dummyAction"/>
-    </widget>
-    <widget class="QMenu" name="menuCamera">
-     <property name="title">
-      <string>Ca&mera</string>
-     </property>
-     <addaction name="actionDumpCamera"/>
-     <addaction name="action_Copy_camera"/>
-     <addaction name="action_Paste_camera"/>
-    </widget>
-    <addaction name="actionRecenterScene"/>
-    <addaction name="action_Look_at"/>
-    <addaction name="actionAntiAliasing"/>
-    <addaction name="actionDraw_two_sides"/>
-    <addaction name="actionQuick_camera_mode"/>
-    <addaction name="actionSetBackgroundColor"/>
-    <addaction name="menuDockWindows"/>
-    <addaction name="menuCamera"/>
-   </widget>
-   <addaction name="menuFile"/>
-   <addaction name="menuEdit"/>
-   <addaction name="menuOperations"/>
-   <addaction name="menuView"/>
-  </widget>
-  <widget class="QStatusBar" name="statusbar"/>
-  <widget class="QDockWidget" name="sceneDockWidget">
-   <property name="locale">
-    <locale language="English" country="UnitedStates"/>
-   </property>
-   <property name="windowTitle">
-    <string>Geometric Objects</string>
-   </property>
-   <attribute name="dockWidgetArea">
-    <number>1</number>
-   </attribute>
-   <widget class="QWidget" name="dockWidgetContent">
-    <layout class="QGridLayout" name="gridLayout_2">
-     <item row="0" column="0">
-      <layout class="QVBoxLayout" name="verticalLayout">
-       <item>
-        <layout class="QHBoxLayout" name="horizontalLayout">
-         <item>
-          <widget class="QToolButton" name="addButton">
-           <property name="text">
-            <string>+</string>
-           </property>
-           <property name="icon">
-            <iconset resource="Polyhedron_3.qrc">
-             <normaloff>:/cgal/icons/plus</normaloff>:/cgal/icons/plus</iconset>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QToolButton" name="removeButton">
-           <property name="text">
-            <string>-</string>
-           </property>
-           <property name="icon">
-            <iconset resource="Polyhedron_3.qrc">
-             <normaloff>:/cgal/icons/minus</normaloff>:/cgal/icons/minus</iconset>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QToolButton" name="duplicateButton">
-           <property name="text">
-            <string>...</string>
-           </property>
-           <property name="icon">
-            <iconset resource="Polyhedron_3.qrc">
-             <normaloff>:/cgal/icons/duplicate</normaloff>:/cgal/icons/duplicate</iconset>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QToolButton" name="upButton">
-           <property name="text">
-            <string>...</string>
-           </property>
-           <property name="icon">
-            <iconset resource="Polyhedron_3.qrc">
-             <normaloff>:/cgal/icons/resources/up.png</normaloff>:/cgal/icons/resources/up.png</iconset>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QToolButton" name="downButton">
-           <property name="text">
-            <string>...</string>
-           </property>
-           <property name="icon">
-            <iconset resource="Polyhedron_3.qrc">
-             <normaloff>:/cgal/icons/resources/down.png</normaloff>:/cgal/icons/resources/down.png</iconset>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <spacer name="horizontalSpacer">
-           <property name="orientation">
-            <enum>Qt::Horizontal</enum>
-           </property>
-           <property name="sizeHint" stdset="0">
-            <size>
-             <width>40</width>
-             <height>20</height>
-            </size>
-           </property>
-          </spacer>
-         </item>
-         <item>
-          <widget class="QLineEdit" name="searchEdit">
-           <property name="placeholderText">
-            <string>Quick filter... <Alt+Q></string>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </item>
-       <item>
-        <widget class="QTreeView" name="sceneView">
-         <property name="editTriggers">
-          <set>QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked</set>
-         </property>
-         <property name="dragDropMode">
-          <enum>QAbstractItemView::InternalMove</enum>
-         </property>
-         <property name="alternatingRowColors">
-          <bool>true</bool>
-         </property>
-         <property name="selectionMode">
-          <enum>QAbstractItemView::ExtendedSelection</enum>
-         </property>
-         <property name="indentation">
-          <number>10</number>
-         </property>
-        </widget>
-       </item>
-      </layout>
-     </item>
-    </layout>
-   </widget>
-  </widget>
-  <widget class="QDockWidget" name="consoleDockWidget">
-   <property name="allowedAreas">
-    <set>Qt::BottomDockWidgetArea|Qt::LeftDockWidgetArea|Qt::TopDockWidgetArea</set>
-   </property>
-   <property name="windowTitle">
-    <string>Console</string>
-   </property>
-   <attribute name="dockWidgetArea">
-    <number>8</number>
-   </attribute>
-   <widget class="QWidget" name="dockWidgetContents">
-    <layout class="QVBoxLayout" name="verticalLayout_3">
-     <item>
-      <widget class="QTextEdit" name="consoleTextEdit">
-       <property name="readOnly">
-        <bool>true</bool>
-       </property>
-      </widget>
-     </item>
-    </layout>
-   </widget>
-  </widget>
-  <widget class="QDockWidget" name="infoDockWidget">
-   <property name="windowTitle">
-    <string>Infos</string>
-   </property>
-   <attribute name="dockWidgetArea">
-    <number>8</number>
-   </attribute>
-   <widget class="QWidget" name="dockWidgetContents_2">
-    <layout class="QHBoxLayout" name="horizontalLayout_2">
-     <item>
-      <layout class="QVBoxLayout" name="verticalLayout_4" stretch="0,0">
-       <property name="spacing">
-        <number>0</number>
-       </property>
-       <item>
-        <widget class="QScrollArea" name="scrollArea">
-         <property name="minimumSize">
-          <size>
-           <width>350</width>
-           <height>0</height>
-          </size>
-         </property>
-         <property name="frameShape">
-          <enum>QFrame::NoFrame</enum>
-         </property>
-         <property name="widgetResizable">
-          <bool>true</bool>
-         </property>
-         <widget class="QWidget" name="scrollAreaWidgetContents">
-          <property name="geometry">
-           <rect>
-            <x>0</x>
-            <y>0</y>
-            <width>534</width>
-            <height>174</height>
-           </rect>
-          </property>
-          <layout class="QGridLayout" name="gridLayout">
-           <item row="0" column="0">
-            <widget class="QLabel" name="infoLabel">
-             <property name="sizePolicy">
-              <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
-               <horstretch>0</horstretch>
-               <verstretch>1</verstretch>
-              </sizepolicy>
-             </property>
-             <property name="contextMenuPolicy">
-              <enum>Qt::DefaultContextMenu</enum>
-             </property>
-             <property name="lineWidth">
-              <number>0</number>
-             </property>
-             <property name="alignment">
-              <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
-             </property>
-             <property name="textInteractionFlags">
-              <set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
-             </property>
-            </widget>
-           </item>
-          </layout>
-         </widget>
-        </widget>
-       </item>
-       <item>
-        <widget class="QLabel" name="displayLabel">
-         <property name="text">
-          <string/>
-         </property>
-        </widget>
-       </item>
-      </layout>
-     </item>
-    </layout>
-   </widget>
-  </widget>
-  <action name="actionQuit">
-   <property name="text">
-    <string>&Quit</string>
-   </property>
-   <property name="shortcut">
-    <string>Ctrl+Q</string>
-   </property>
-  </action>
-  <action name="actionSimplify">
-   <property name="text">
-    <string>&Simplification</string>
-   </property>
-  </action>
-  <action name="actionCatmullClark">
-   <property name="text">
-    <string>&Catmull-Clark</string>
-   </property>
-  </action>
-  <action name="actionKernel">
-   <property name="text">
-    <string>&Kernel</string>
-   </property>
-  </action>
-  <action name="actionUnion">
-   <property name="text">
-    <string>&Union (A/B)</string>
-   </property>
-   <property name="shortcut">
-    <string>Ctrl+O, U</string>
-   </property>
-  </action>
-  <action name="actionIntersection">
-   <property name="text">
-    <string>&Intersection (A/B)</string>
-   </property>
-   <property name="shortcut">
-    <string>Ctrl+O, I</string>
-   </property>
-  </action>
-  <action name="actionDifference">
-   <property name="text">
-    <string>&Difference (A/B)</string>
-   </property>
-   <property name="shortcut">
-    <string>Ctrl+O, D</string>
-   </property>
-  </action>
-  <action name="actionFitPlane">
-   <property name="text">
-    <string>Fit &Plane</string>
-   </property>
-  </action>
-  <action name="actionFitLine">
-   <property name="text">
-    <string>Fit &Line</string>
-   </property>
-  </action>
-  <action name="actionEstimateCurvature">
-   <property name="text">
-    <string>&Curvature Estimation</string>
-   </property>
-  </action>
-  <action name="actionLoad">
-   <property name="icon">
-    <iconset resource="Polyhedron_3.qrc">
-     <normaloff>:/cgal/icons/plus</normaloff>:/cgal/icons/plus</iconset>
-   </property>
-   <property name="text">
-    <string>&Load...</string>
-   </property>
-   <property name="shortcut">
-    <string>Ctrl+L</string>
-   </property>
-  </action>
-  <action name="actionErase">
-   <property name="icon">
-    <iconset resource="Polyhedron_3.qrc">
-     <normaloff>:/cgal/icons/minus</normaloff>:/cgal/icons/minus</iconset>
-   </property>
-   <property name="text">
-    <string>&Erase</string>
-   </property>
-   <property name="shortcut">
-    <string>Del</string>
-   </property>
-  </action>
-  <action name="actionDuplicate">
-   <property name="icon">
-    <iconset resource="Polyhedron_3.qrc">
-     <normaloff>:/cgal/icons/duplicate</normaloff>:/cgal/icons/duplicate</iconset>
-   </property>
-   <property name="text">
-    <string>&Duplicate</string>
-   </property>
-   <property name="shortcut">
-    <string>Ctrl+D</string>
-   </property>
-  </action>
-  <action name="actionSqrt3">
-   <property name="text">
-    <string>&Sqrt3</string>
-   </property>
-  </action>
-  <action name="actionAntiAliasing">
-   <property name="checkable">
-    <bool>true</bool>
-   </property>
-   <property name="text">
-    <string>&Antialiasing</string>
-   </property>
-  </action>
-  <action name="dummyAction">
-   <property name="text">
-    <string>n/a</string>
-   </property>
-  </action>
-  <action name="actionConvexHull">
-   <property name="text">
-    <string>&Convex Hull</string>
-   </property>
-  </action>
-  <action name="actionEraseAll">
-   <property name="text">
-    <string>&Erase All</string>
-   </property>
-  </action>
-  <action name="actionOptions">
-   <property name="text">
-    <string>&Options...</string>
-   </property>
-  </action>
-  <action name="actionLoop">
-   <property name="text">
-    <string>&Loop</string>
-   </property>
-  </action>
-  <action name="actionSaveAs">
-   <property name="text">
-    <string>Save &as...</string>
-   </property>
-  </action>
-  <action name="actionSave">
-   <property name="text">
-    <string>&Save</string>
-   </property>
-  </action>
-  <action name="actionSaveAll">
-   <property name="text">
-    <string>Save A&ll</string>
-   </property>
-  </action>
-  <action name="actionMergeAll">
-   <property name="text">
-    <string>Mer&ge All</string>
-   </property>
-  </action>
-  <action name="actionMerge">
-   <property name="text">
-    <string>&Merge</string>
-   </property>
-  </action>
-  <action name="actionSelfIntersection">
-   <property name="text">
-    <string>Self-&intersection</string>
-   </property>
-  </action>
-  <action name="actionSelectAll">
-   <property name="text">
-    <string>Select &All</string>
-   </property>
-  </action>
-  <action name="actionSelectNone">
-   <property name="text">
-    <string>Select &None</string>
-   </property>
-  </action>
-  <action name="actionSelectInvert">
-   <property name="text">
-    <string>&Invert Selection</string>
-   </property>
-  </action>
-  <action name="actionShowHide">
-   <property name="text">
-    <string>Show/Hide</string>
-   </property>
-   <property name="shortcut">
-    <string>Ctrl+Space</string>
-   </property>
-  </action>
-  <action name="actionSetPolyhedronA">
-   <property name="text">
-    <string>Set Polyhedron A</string>
-   </property>
-  </action>
-  <action name="actionSetPolyhedronB">
-   <property name="text">
-    <string>Set Polyhedron B</string>
-   </property>
-  </action>
-  <action name="actionInsideOut">
-   <property name="text">
-    <string>&Inside-Out</string>
-   </property>
-  </action>
-  <action name="actionRemeshing">
-   <property name="text">
-    <string>&Remeshing</string>
-   </property>
-  </action>
-  <action name="actionConvexDecomposition">
-   <property name="text">
-    <string>Convex Decomposition</string>
-   </property>
-  </action>
-  <action name="actionMVC">
-   <property name="text">
-    <string>Mean &Value Coordinates</string>
-   </property>
-  </action>
-  <action name="actionDCP">
-   <property name="text">
-    <string>Discrete &Conformal Maps</string>
-   </property>
-  </action>
-  <action name="actionExplode">
-   <property name="text">
-    <string>Explode</string>
-   </property>
-  </action>
-  <action name="actionToNef">
-   <property name="text">
-    <string>Convert to Nef Polyhedron</string>
-   </property>
-  </action>
-  <action name="actionToPoly">
-   <property name="text">
-    <string>Convert to Normal Polyhedron</string>
-   </property>
-  </action>
-  <action name="actionDraw_two_sides">
-   <property name="checkable">
-    <bool>true</bool>
-   </property>
-   <property name="text">
-    <string>Draw &Two Sides</string>
-   </property>
-   <property name="shortcut">
-    <string>Ctrl+T</string>
-   </property>
-  </action>
-  <action name="actionRecenterScene">
-   <property name="text">
-    <string>Re&center Scene</string>
-   </property>
-   <property name="shortcut">
-    <string>Ctrl+C</string>
-   </property>
-  </action>
-  <action name="actionSetBackgroundColor">
-   <property name="text">
-    <string>Change &Background Color...</string>
-   </property>
-  </action>
-  <action name="actionMinkowskiSum">
-   <property name="text">
-    <string>&Minkowski Sum (A/B)</string>
-   </property>
-   <property name="shortcut">
-    <string>Ctrl+O, M</string>
-   </property>
-  </action>
-  <action name="action_Look_at">
-   <property name="text">
-    <string>&Look at...</string>
-   </property>
-  </action>
-  <action name="actionSaveSnapshot">
-   <property name="text">
-    <string>Save Snapshot</string>
-   </property>
-  </action>
-  <action name="actionDumpCamera">
-   <property name="text">
-    <string>&Dump Camera Coordinates</string>
-   </property>
-  </action>
-  <action name="action_Copy_camera">
-   <property name="text">
-    <string>&Copy Camera</string>
-   </property>
-  </action>
-  <action name="action_Paste_camera">
-   <property name="text">
-    <string>&Paste Camera</string>
-   </property>
-  </action>
-  <action name="actionSelect_all_items">
-   <property name="text">
-    <string>Select All Items</string>
-   </property>
-   <property name="shortcut">
-    <string>Ctrl+A</string>
-   </property>
-  </action>
-  <action name="actionLoad_Script">
-   <property name="text">
-    <string>Load &Script</string>
-   </property>
-  </action>
-  <action name="actionPreferences">
-   <property name="text">
-    <string>&Preferences</string>
-   </property>
-  </action>
-  <action name="actionLSC">
-   <property name="text">
-    <string>Least Square Conformal Maps</string>
-   </property>
-  </action>
-  <action name="actionLoad_plugin">
-   <property name="text">
-    <string>Load Plugin</string>
-   </property>
-  </action>
-  <action name="actionQuick_camera_mode">
-   <property name="checkable">
-    <bool>true</bool>
-   </property>
-   <property name="checked">
-    <bool>true</bool>
-   </property>
-   <property name="text">
-    <string>Quick Camera Mode</string>
-   </property>
-  </action>
- </widget>
- <customwidgets>
-  <customwidget>
-   <class>Viewer</class>
-   <extends>QWidget</extends>
-   <header>Viewer.h</header>
-  </customwidget>
- </customwidgets>
- <resources>
-  <include location="Polyhedron_3.qrc"/>
- </resources>
- <connections/>
-</ui>
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/AABB_tree/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/AABB_tree/CMakeLists.txt
deleted file mode 100644
index d35c622..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/AABB_tree/CMakeLists.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-include( polyhedron_demo_macros )
-
-polyhedron_demo_plugin(cut_plugin Cut_plugin)
-target_link_libraries(cut_plugin scene_polyhedron_item scene_basic_objects)
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/AABB_tree/Cut_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/AABB_tree/Cut_plugin.cpp
deleted file mode 100644
index ab3f002..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/AABB_tree/Cut_plugin.cpp
+++ /dev/null
@@ -1,495 +0,0 @@
-
-#include <fstream>
-#include <QtCore/qglobal.h>
-#include <CGAL/AABB_intersections.h>
-
-#include "Messages_interface.h"
-#include "Scene_plane_item.h"
-#include "Scene_polyhedron_item.h"
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-#include <CGAL/Three/Polyhedron_demo_io_plugin_interface.h>
-#include <CGAL/gl.h>
-
-#include <CGAL/AABB_tree.h>
-#include <CGAL/AABB_traits.h>
-#include <CGAL/AABB_face_graph_triangle_primitive.h>
-#include <CGAL/internal/AABB_tree/AABB_drawing_traits.h>
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-
-#include <CGAL/bounding_box.h>
-
-#include "Polyhedron_type.h"
-
-#include <QTime>
-
-#include <QAction>
-#include <QMainWindow>
-#include <QApplication>
-#include  <CGAL/Three/Scene_item.h>
-//typedef CGAL::Simple_cartesian<double> Epic_kernel;
-typedef CGAL::Exact_predicates_inexact_constructions_kernel Epic_kernel;
-
-typedef CGAL::AABB_face_graph_triangle_primitive<Polyhedron>     AABB_primitive;
-typedef CGAL::AABB_traits<Epic_kernel,AABB_primitive>           AABB_traits;
-typedef CGAL::AABB_tree<AABB_traits>                            AABB_tree;
-
-class Q_DECL_EXPORT Scene_aabb_item : public CGAL::Three::Scene_item
-{
-  Q_OBJECT
-public:
-  Scene_aabb_item(const AABB_tree& tree_) : CGAL::Three::Scene_item(1,1), tree(tree_)
-  {
-      positions_lines.resize(0);
-  }
-
-    ~Scene_aabb_item()
-    {
-    }
-
-  bool isFinite() const { return true; }
-  bool isEmpty() const { return tree.empty(); }
-  void compute_bbox() const {
-    const CGAL::Bbox_3 bbox = tree.bbox();
-    _bbox = Bbox(bbox.xmin(),
-                bbox.ymin(),
-                bbox.zmin(),
-                bbox.xmax(),
-                bbox.ymax(),
-                bbox.zmax());
-    qDebug()<<this->name()<<" at creation: "<<bbox.xmin()<<", "<<bbox.xmax()<<", "<<bbox.ymin()<<", "<<bbox.ymax()<<", "
-              <<bbox.zmin()<<", "<<bbox.zmax();
-  }
-
-  Scene_aabb_item* clone() const {
-    return 0;
-  }
-
-  QString toolTip() const {
-    return
-      tr("<p><b>%1</b> (mode: %2, color: %3)<br />"
-         "<i>AABB_tree</i></p>"
-         "<p>Number of nodes: %4</p>")
-      .arg(this->name())
-      .arg(this->renderingModeName())
-      .arg(this->color().name())
-      .arg(tree.size());
-  }
-  
-
-  // Indicate if rendering mode is supported
-  bool supportsRenderingMode(RenderingMode m) const {
-    return (m == Wireframe);
-  }
-
-  // Wireframe OpenGL drawing in a display list
-  void invalidateOpenGLBuffers()
-  {
-      compute_elements();
-      are_buffers_filled = false;
-      compute_bbox();
-  }
-public:
-  const AABB_tree& tree;
-private:
-   mutable  std::vector<float> positions_lines;
-
-    mutable QOpenGLShaderProgram *program;
-
-    using CGAL::Three::Scene_item::initialize_buffers;
-    void initialize_buffers(CGAL::Three::Viewer_interface *viewer)const
-    {
-        program = getShaderProgram(PROGRAM_NO_SELECTION, viewer);
-        program->bind();
-        vaos[0]->bind();
-
-        buffers[0].bind();
-        buffers[0].allocate(positions_lines.data(),
-                            static_cast<int>(positions_lines.size()*sizeof(float)));
-        program->enableAttributeArray("vertex");
-        program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
-        buffers[0].release();
-        program->release();
-
-        vaos[0]->release();
-        are_buffers_filled = true;
-    }
-
-    void compute_elements() const
-    {
-       positions_lines.clear();
-
-       CGAL::AABB_drawing_traits<AABB_primitive, CGAL::AABB_node<AABB_traits> > traits;
-       traits.v_edges = &positions_lines;
-
-       tree.traversal(0, traits);
-    }
-    void draw_edges(CGAL::Three::Viewer_interface* viewer) const
-    {
-        if(!are_buffers_filled)
-            initialize_buffers(viewer);
-        vaos[0]->bind();
-        program = getShaderProgram(PROGRAM_NO_SELECTION);
-        attrib_buffers(viewer, PROGRAM_NO_SELECTION);
-        program->bind();
-        program->setAttributeValue("colors",this->color());
-        viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(positions_lines.size()/3));
-        program->release();
-        vaos[0]->release();
-    }
-}; // end class Scene_aabb_item
-
-class Q_DECL_EXPORT Scene_edges_item : public CGAL::Three::Scene_item
-{
-  Q_OBJECT
-public:
-    Scene_edges_item():CGAL::Three::Scene_item(1,1)
-    {
-        positions_lines.resize(0);
-        top = true;
-    }
-  ~Scene_edges_item()
-  {
-  }
-    bool isFinite() const { return true; }
-  bool isEmpty() const { return edges.empty(); }
-  void compute_bbox() const {
-    if(isEmpty())
-      _bbox = Bbox();
-    return;
-    CGAL::Bbox_3 bbox = edges.begin()->bbox();
-    for(size_t i = 1, end = edges.size(); i < end; ++i) {
-      bbox = bbox + edges[i].bbox();
-    }
-    _bbox = Bbox(bbox.xmin(),
-                bbox.ymin(),
-                bbox.zmin(),
-                bbox.xmax(),
-                bbox.ymax(),
-                bbox.zmax());
-  }
-  void invalidateOpenGLBuffers()
-  {
-      compute_elements();
-      are_buffers_filled = false;
-      compute_bbox();
-  }
-
-  Scene_edges_item* clone() const {
-    Scene_edges_item* item = new Scene_edges_item();
-    item->edges = edges;
-    return item;
-  }
-
-  QString toolTip() const {
-    return
-      tr("<p><b>%1</b> (mode: %2, color: %3)<br />"
-         "<i>Edges</i></p>"
-         "<p>Number of edges: %4</p>")
-      .arg(this->name())
-      .arg(this->renderingModeName())
-      .arg(this->color().name())
-      .arg(edges.size());
-  }
-
-  // Indicate if rendering mode is supported
-  bool supportsRenderingMode(RenderingMode m) const {
-    return (m == Wireframe);
-  }
-
-
-
-  bool save(std::ostream& os) const
-  {
-    os.precision(17);
-    for(size_t i = 0, end = edges.size(); i < end; ++i){
-      os << "2 " << edges[i].source() << " " <<  edges[i].target() << "\n";
-    }
-    return true;
-  }
-
-public:
-  std::vector<Epic_kernel::Segment_3> edges;
-  bool top;
-
-private:
-    mutable std::vector<float> positions_lines;
-    void timerEvent(QTimerEvent* /*event*/)
-    {
-       top = true;
-    }
-
-  mutable QOpenGLShaderProgram *program;
-
-    using CGAL::Three::Scene_item::initialize_buffers;
-    void initialize_buffers(CGAL::Three::Viewer_interface *viewer)const
-    {
-        program = getShaderProgram(PROGRAM_NO_SELECTION, viewer);
-        program->bind();
-        vaos[0]->bind();
-
-        buffers[0].bind();
-        buffers[0].allocate(positions_lines.data(),
-                            static_cast<int>(positions_lines.size()*sizeof(float)));
-        program->enableAttributeArray("vertex");
-        program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
-        buffers[0].release();
-        program->release();
-
-        vaos[0]->release();
-        are_buffers_filled = true;
-    }
-    void compute_elements() const
-    {
-       positions_lines.clear();
-
-       for(size_t i = 0, end = edges.size();
-           i < end; ++i)
-       {
-         const Epic_kernel::Point_3& a = edges[i].source();
-         const Epic_kernel::Point_3& b = edges[i].target();
-         positions_lines.push_back(a.x()); positions_lines.push_back(a.y()); positions_lines.push_back(a.z());
-         positions_lines.push_back(b.x()); positions_lines.push_back(b.y()); positions_lines.push_back(b.z());
-       }
-    }
-    void draw_edges(CGAL::Three::Viewer_interface* viewer) const
-    {
-        if(!are_buffers_filled)
-            initialize_buffers(viewer);
-        vaos[0]->bind();
-        program = getShaderProgram(PROGRAM_NO_SELECTION);
-        attrib_buffers(viewer, PROGRAM_NO_SELECTION);
-        program->bind();
-        program->setAttributeValue("colors",this->color());
-        viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(positions_lines.size()/3));
-        vaos[0]->release();
-        program->release();
-
-    }
-
-}; // end class Scene_edges_item
-
-using namespace CGAL::Three;
-class Polyhedron_demo_cut_plugin :
-  public QObject,
-  public Polyhedron_demo_plugin_interface,
-  public Polyhedron_demo_io_plugin_interface 
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-public:
-  Polyhedron_demo_cut_plugin() : QObject(), edges_item(0) {
-  }
-  
-  virtual ~Polyhedron_demo_cut_plugin();
-
-  bool applicable(QAction*) const {
-    // returns true if one polyhedron is in the entries
-    for (int i=0; i< scene->numberOfEntries(); ++i)
-    {
-      if ( qobject_cast<Scene_polyhedron_item*>(scene->item(i)) )
-        return true;
-    }
-    return false;
-  }
-
-  virtual QString name() const
-  {
-    return "cut-plugin";
-  }
-
-
-  virtual QString nameFilters() const
-  {
-    return "Segment soup file (*.polylines.txt *.cgal)";
-  }
-
-
-  bool canLoad() const
-  {
-    return false;
-  }
-
-  virtual CGAL::Three::Scene_item* load(QFileInfo /* fileinfo */)
-  {
-    return 0;
-  }
-
-  virtual bool canSave(const CGAL::Three::Scene_item* item)
-  {
-    // This plugin supports edges items
-    bool b = qobject_cast<const Scene_edges_item*>(item) != 0;
-    return b;
-  }
-
-
-  virtual bool save(const CGAL::Three::Scene_item* item, QFileInfo fileinfo)
-  {  // This plugin supports edges items
-    const Scene_edges_item* edges_item = 
-      qobject_cast<const Scene_edges_item*>(item);
-    
-    if(!edges_item){
-      return false;
-    }
-    
-    std::ofstream out(fileinfo.filePath().toUtf8());
-    
-    return (out && edges_item->save(out));
-  }
-
-
-
-  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface,
-            Messages_interface* m);
-  QList<QAction*> actions() const;
-
-public Q_SLOTS:
-  void createCutPlane();
-  void enableAction();
-  void cut();
-  void reset_edges() {
-    edges_item = 0;
-  }
-
-private:
-  CGAL::Three::Scene_interface* scene;
-  Messages_interface* messages;
-  Scene_plane_item* plane_item;
-  Scene_edges_item* edges_item;
-  QAction* actionCreateCutPlane;
-
-  typedef std::map<QObject*,  AABB_tree*> Trees;
-  Trees trees;
-}; // end Polyhedron_demo_cut_plugin
-
-
-Polyhedron_demo_cut_plugin::~Polyhedron_demo_cut_plugin()
-{
-  for ( Trees::iterator it = trees.begin(), end = trees.end() ;
-       it != end ; ++it)
-  {
-    delete it->second;
-  }
-}
-
-
-void Polyhedron_demo_cut_plugin::init(QMainWindow* mainWindow,
-                                      CGAL::Three::Scene_interface* scene_interface,
-                                      Messages_interface* m)
-{
-  scene = scene_interface;
-  messages = m;
-  actionCreateCutPlane = new QAction(tr("Create Cutting Plane"), mainWindow);
-  actionCreateCutPlane->setProperty("subMenuName","3D Fast Intersection and Distance Computation");
-  connect(actionCreateCutPlane, SIGNAL(triggered()),
-          this, SLOT(createCutPlane()));
-}
-
-QList<QAction*> Polyhedron_demo_cut_plugin::actions() const {
-  return QList<QAction*>() << actionCreateCutPlane;
-}
-
-void Polyhedron_demo_cut_plugin::createCutPlane() {
-  plane_item = new Scene_plane_item(scene);
-  const CGAL::Three::Scene_interface::Bbox& bbox = scene->bbox();
-  plane_item->setPosition((bbox.xmin+bbox.xmax)/2.f,
-                          (bbox.ymin+bbox.ymax)/2.f,
-                          (bbox.zmin+bbox.zmax)/2.f);
-  plane_item->setNormal(0., 0., 1.);
-  connect(plane_item, SIGNAL(destroyed()),
-          this, SLOT(enableAction()));
-  plane_item->setManipulatable(true);
-  plane_item->setClonable(false);
-  plane_item->setColor(Qt::green);
-  plane_item->setName(tr("Cutting plane"));
-  connect(plane_item->manipulatedFrame(), SIGNAL(modified()),
-          this, SLOT(cut()));
-  scene->addItem(plane_item);
-  actionCreateCutPlane->setEnabled(false);
-
-  // Hide polyhedrons and call cut() (avoid that nothing shows up until user
-  // decides to move the plane item)
-  for(int i = 0, end = scene->numberOfEntries(); i < end; ++i) {
-    CGAL::Three::Scene_item* item = scene->item(i);
-    Scene_polyhedron_item* poly_item = qobject_cast<Scene_polyhedron_item*>(item);
-    if ( NULL != poly_item )
-      poly_item->setVisible(false);
-  }
-  cut();
-}
-
-
-void Polyhedron_demo_cut_plugin::cut() {
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-  if(!edges_item) {
-    edges_item = new Scene_edges_item;
-    edges_item->setName("Edges of the Cut");
-    edges_item->setColor(Qt::red);
-    edges_item->startTimer(0);
-    connect(edges_item, SIGNAL(destroyed()),
-            this, SLOT(reset_edges()));
-    scene->addItem(edges_item);
-  }
-  if(edges_item->top)
-  {
-  const qglviewer::Vec& pos = plane_item->manipulatedFrame()->position();
-  const qglviewer::Vec& n =
-    plane_item->manipulatedFrame()->inverseTransformOf(qglviewer::Vec(0.f, 0.f, 1.f));
-  Epic_kernel::Plane_3 plane(n[0], n[1],  n[2], - n * pos);
-  //std::cerr << plane << std::endl;
-  edges_item->edges.clear();
-  QTime time;
-  time.start();
-  for(int i = 0, end = scene->numberOfEntries(); i < end; ++i) {
-    CGAL::Three::Scene_item* item = scene->item(i);
-    Scene_polyhedron_item* poly_item = qobject_cast<Scene_polyhedron_item*>(item);
-    if(!poly_item) continue;
-    Trees::iterator it = trees.find(poly_item);
-    if(it == trees.end()) {
-      it = trees.insert(trees.begin(),
-                        std::make_pair(poly_item,
-                                       new AABB_tree(faces(*(poly_item->polyhedron())).first,
-                                                     faces(*(poly_item->polyhedron())).second,
-                                                     *poly_item->polyhedron() )));
-      Scene_aabb_item* aabb_item = new Scene_aabb_item(*it->second);
-      aabb_item->setName(tr("AABB tree of %1").arg(poly_item->name()));
-      aabb_item->setRenderingMode(Wireframe);
-      aabb_item->setColor(Qt::black);
-      aabb_item->setVisible(false);
-      scene->addItem(aabb_item);
-      //std::cerr << "size: " << it->second->size() << std::endl;
-    }
-    
-    if(!CGAL::do_intersect(plane, it->second->bbox()))
-      continue;
-    
-    std::vector<AABB_tree::Object_and_primitive_id> intersections;
-    it->second->all_intersections(plane, std::back_inserter(intersections));
-    
-    for ( std::vector<AABB_tree::Object_and_primitive_id>::iterator it = intersections.begin(),
-         end = intersections.end() ; it != end ; ++it )
-    {
-      const Epic_kernel::Segment_3* inter_seg =
-        CGAL::object_cast<Epic_kernel::Segment_3>(&(it->first));
-      
-      if ( NULL != inter_seg )
-        edges_item->edges.push_back(*inter_seg);
-    }
-  }
-
-  messages->information(QString("cut (%1 ms). %2 edges.").arg(time.elapsed()).arg(edges_item->edges.size()));
-  edges_item->invalidateOpenGLBuffers();
-  scene->itemChanged(edges_item);
-  }
-  QApplication::restoreOverrideCursor();
-
-    edges_item->top = false;
-}
-
-void Polyhedron_demo_cut_plugin::enableAction() {
-  actionCreateCutPlane->setEnabled(true);
-}
-
-#include "Cut_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Camera_position/Camera_positions_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Camera_position/Camera_positions_plugin.cpp
deleted file mode 100644
index 0fb9dcd..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Camera_position/Camera_positions_plugin.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-#include <QtCore/qglobal.h>
-#include "Messages_interface.h"
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-#include <CGAL/Three/Polyhedron_demo_io_plugin_interface.h>
-
-#include "Camera_positions_list.h"
-#include <CGAL/Three/Viewer_interface.h>
-
-#include <QMainWindow>
-using namespace CGAL::Three;
-class Polyhedron_demo_camera_positions_plugin : 
-  public QObject,
-  public Polyhedron_demo_plugin_interface,
-  public CGAL::Three::Polyhedron_demo_io_plugin_interface
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface CGAL::Three::Polyhedron_demo_io_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0")
-
-public:
-  void init(QMainWindow* mainWindow, Scene_interface* scene_interface);
-  QList<QAction*> actions() const;
-
-  QString name() const { return "camera_positions_plugin"; }
-  QString nameFilters() const { return "Camera positions (*.camera.txt)"; }
-  bool canLoad() const { return true; }
-  Scene_item* load(QFileInfo fileinfo) { cpl->load(fileinfo.filePath()); return 0; }
-
-  bool canSave(const Scene_item*) { return false; }
-  bool save(const Scene_item*, QFileInfo ) {return false; }
-  bool applicable(QAction*) const {return false;}
-private:
-  Camera_positions_list* cpl;
-};
-
-void Polyhedron_demo_camera_positions_plugin::init(QMainWindow* mainWindow, Scene_interface*)
-{
-
-  cpl = new Camera_positions_list(mainWindow);
-  Viewer_interface* viewer = mainWindow->findChild<Viewer_interface*>("viewer");
-  cpl->setViewer(viewer);
-  mainWindow->addDockWidget(Qt::LeftDockWidgetArea, cpl);
-}
-
-QList<QAction*> 
-Polyhedron_demo_camera_positions_plugin::actions() const
-{
-  return QList<QAction*>();
-}
-
-#include "Camera_positions_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Convex_decomposition/Nef_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Convex_decomposition/Nef_plugin.cpp
deleted file mode 100644
index 1147c1b..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Convex_decomposition/Nef_plugin.cpp
+++ /dev/null
@@ -1,312 +0,0 @@
-#include "Scene_polyhedron_item.h"
-#include "Scene_nef_polyhedron_item.h"
-
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-
-#include <QString>
-#include <QAction>
-#include <QMenu>
-#include <QMainWindow>
-#include <QApplication>
-#include <QTime>
-#include <QMessageBox>
-using namespace CGAL::Three;
-class Polyhedron_demo_nef_plugin :
-  public QObject,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-public:
-  QStringList actionsNames() const {
-    return QStringList() << "actionToNef" 
-                         << "actionToPoly"
-                         << "actionUnion"
-                         << "actionIntersection"
-                         << "actionDifference"
-                         << "actionConvexDecomposition"
-                         << "actionMinkowskiSum";
-  }
-
-  void init(QMainWindow* mainWindow,
-            Scene_interface* scene_interface)
-  {
-      mw = mainWindow;
-      scene = scene_interface;
-      actions_map["actionConvexDecomposition"] = getActionFromMainWindow(mw, "actionConvexDecomposition");
-      actions_map["actionConvexDecomposition"]->setProperty("subMenuName",
-                                                            "Convex Decomposition");
-
-      actions_map["actionToNef"] = getActionFromMainWindow(mw, "actionToNef");
-      actions_map["actionToPoly"] = getActionFromMainWindow(mw, "actionToPoly");
-      actions_map["actionUnion"] = getActionFromMainWindow(mw, "actionUnion");
-      actions_map["actionIntersection"] = getActionFromMainWindow(mw, "actionIntersection");
-      actions_map["actionDifference"] = getActionFromMainWindow(mw, "actionDifference");
-      actions_map["actionMinkowskiSum"] = getActionFromMainWindow(mw, "actionMinkowskiSum");
-      autoConnectActions();
-
-  }
-
-  bool applicable(QAction*) const {
-    const int indexA = scene->selectionAindex();
-    const int indexB = scene->selectionBindex();
-
-    return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()))
-      || qobject_cast<Scene_nef_polyhedron_item*>(scene->item(scene->mainSelectionIndex()))
-      || qobject_cast<Scene_polyhedron_item*>(scene->item(indexA))
-      || qobject_cast<Scene_polyhedron_item*>(scene->item(indexB))
-      || qobject_cast<Scene_nef_polyhedron_item*>(scene->item(indexA))
-      || qobject_cast<Scene_nef_polyhedron_item*>(scene->item(indexB))
-      ;
-  }
-
-//   QList<QAction*> actions() const {
-//     QMenu* menu = new QMenu(tr("Boolean Operations"), mw);
-//     QAction* action_to_nef = new QAction(tr("Convert to Nef Polyhedron"), mw);
-//     connect(action_to_nef, SIGNAL(triggered()),
-//             this, SLOT(convert_to_nef_polyhedron()));
-//     QAction* action_to_poly = new QAction(tr("Convert Nef Polyhedron to Polyhedron"), mw);
-//     connect(action_to_poly, SIGNAL(triggered()),
-//             this, SLOT(convert_to_polyhedron()));
-//     menu->addAction(action_to_nef);
-//     menu->addAction(action_to_poly);
-
-//     return QList<QAction*>() << menu->menuAction();
-//   }
-
-private:
-  enum  Boolean_operation { BOOLEAN_UNION,
-                            BOOLEAN_INTERSECTION,
-                            BOOLEAN_DIFFERENCE,
-                            MINKOWSKI_SUM
-  };
-  void boolean_operation(const Boolean_operation operation);
-
-public Q_SLOTS:
-  void on_actionToNef_triggered();
-  void on_actionToPoly_triggered();
-  void on_actionUnion_triggered();
-  void on_actionIntersection_triggered();
-  void on_actionDifference_triggered();
-  void on_actionMinkowskiSum_triggered();
-  void on_actionConvexDecomposition_triggered();
-}; // end class Polyhedron_demo_nef_plugin
-
-void
-Polyhedron_demo_nef_plugin::on_actionToNef_triggered()
-{
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-  
-  Scene_polyhedron_item* item = 
-    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-
-  if(item)
-  {
-    QApplication::setOverrideCursor(Qt::WaitCursor);
-    QTime time;
-    time.start();
-    std::cerr << "Convert polyhedron to nef polyhedron...";
-
-    Scene_nef_polyhedron_item* new_nef_item = 
-      Scene_nef_polyhedron_item::from_polyhedron(item);
-
-    new_nef_item->setName(tr("%1 (to nef)").arg(item->name()));
-    new_nef_item->setRenderingMode(item->renderingMode());
-    item->setVisible(false);
-    scene->itemChanged(index);
-    new_nef_item->invalidateOpenGLBuffers();
-    scene->addItem(new_nef_item);
-    std::cerr << "ok (" << time.elapsed() << " ms)" << std::endl;
-    QApplication::restoreOverrideCursor();
-  }
-}
-
-
-void
-Polyhedron_demo_nef_plugin::on_actionConvexDecomposition_triggered()
-{
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-  
-  Scene_polyhedron_item* pitem = 
-    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-
-  Scene_nef_polyhedron_item* item =   
-    (pitem)? Scene_nef_polyhedron_item::from_polyhedron(pitem)
-           : qobject_cast<Scene_nef_polyhedron_item*>(scene->item(index));
-  
-  if(item) {
-    QTime time;
-    time.start();
-    std::cerr << "Convex decomposition...";
-
-    QApplication::setOverrideCursor(Qt::WaitCursor);
-    
-    std::list<Scene_polyhedron_item*> convex_parts;
-    item->convex_decomposition(convex_parts);
-    int i = 0;
-    for(std::list<Scene_polyhedron_item*>::iterator it = convex_parts.begin();
-        it != convex_parts.end();
-        ++it){
-      (*it)->setName(tr("part %1 of %2").arg(i++).arg(item->name()));
-      (*it)->setRenderingMode(item->renderingMode());
-      scene->addItem(*it);
-    }
-
-    if(pitem){
-      delete item;
-      pitem->setVisible(false);
-    } else {
-      item->setVisible(false);
-    }
-
-    std::cerr << "ok (" << time.elapsed() << " ms)" << std::endl;
-    QApplication::restoreOverrideCursor();
-  } else {
-    std::cerr << "Only a Polyhedron or a Nef Polyhedron can be decomposed in convex parts" << std::endl; 
-  }
-}
-
-void
-Polyhedron_demo_nef_plugin::on_actionToPoly_triggered()
-{
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-  
-  Scene_nef_polyhedron_item* item = 
-    qobject_cast<Scene_nef_polyhedron_item*>(scene->item(index));
-
-  if(item)
-  {
-    QTime time;
-    time.start();
-    std::cerr << "Convert nef polyhedron to polyhedron...";
-
-    if(!item->is_simple())
-    {
-      QMessageBox::warning(mw,
-                           tr("Cannot convert"),
-                           tr("The nef polyhedron \"%1\" is not simple, "
-                              "and thus cannot be converted!")
-                              .arg(item->name()));
-      return;
-    }
-
-    QApplication::setOverrideCursor(Qt::WaitCursor);
-    
-    Scene_polyhedron_item* new_item = item->convert_to_polyhedron();
-    new_item->setName(tr("%1 (from nef)").arg(item->name()));
-    new_item->setRenderingMode(item->renderingMode());
-    item->setVisible(false);
-    scene->itemChanged(index);
-    scene->addItem(new_item);
-    std::cerr << "ok (" << time.elapsed() << " ms)" << std::endl;
-    QApplication::restoreOverrideCursor();
-  }
-}
-
-void Polyhedron_demo_nef_plugin::on_actionUnion_triggered()
-{
-  boolean_operation(BOOLEAN_UNION);
-}
-
-void Polyhedron_demo_nef_plugin::on_actionIntersection_triggered()
-{
-  boolean_operation(BOOLEAN_INTERSECTION);
-}
-
-void Polyhedron_demo_nef_plugin::on_actionDifference_triggered()
-{
-  boolean_operation(BOOLEAN_DIFFERENCE);
-}
-
-void
-Polyhedron_demo_nef_plugin::on_actionMinkowskiSum_triggered()
-{
-  boolean_operation(MINKOWSKI_SUM);
-}
-
-void Polyhedron_demo_nef_plugin::boolean_operation(const Boolean_operation operation)
-{
-  const int indexA = scene->selectionAindex();
-  const int indexB = scene->selectionBindex();
-
-  if(indexA < 0 || indexB < 0) return;
-  if(indexA == indexB) return;
-
-  if(qobject_cast<Scene_polyhedron_item*>(scene->item(indexA)) ||
-     qobject_cast<Scene_polyhedron_item*>(scene->item(indexB))) {
-    QMenu* menu = mw->findChild<QMenu*>("menu_Boolean_operations");
-    if(!menu) qWarning("Do not find object named \"menu_Boolean_operations\"!");
-    QMessageBox::warning(mw,
-                         tr("Boolean operation cannot be applied on normal polyhedron"),
-                         tr("You need to call the operation \"%1\" in the menu \"%2\".")
-                         .arg(actions_map["actionToNef"]->text())
-                         .arg(menu ? menu->title() : "Boolean Operations"));
-  }
-  Scene_nef_polyhedron_item* itemA = 
-    qobject_cast<Scene_nef_polyhedron_item*>(scene->item(indexA));
-  Scene_nef_polyhedron_item* itemB = 
-    qobject_cast<Scene_nef_polyhedron_item*>(scene->item(indexB));
-  if(!itemA || !itemB)
-    return;
-
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-
-  // copy itemA
-  Scene_nef_polyhedron_item* new_item = 0;
-  if(operation != MINKOWSKI_SUM) {
-    new_item = new Scene_nef_polyhedron_item(*itemA->nef_polyhedron());
-  };
-
- // perform Boolean operation
-  std::cout << "Boolean operation...";
-  QTime time;
-  time.start();
-  switch(operation)
-  {
-  case BOOLEAN_UNION:
-    (*new_item) += (*itemB);
-    break;
-  case BOOLEAN_INTERSECTION:
-    (*new_item) *= (*itemB);
-    break;
-  case BOOLEAN_DIFFERENCE:
-    (*new_item) -= (*itemB);
-    break;
-  case MINKOWSKI_SUM:
-    new_item = Scene_nef_polyhedron_item::sum(*itemA, 
-                                              *itemB);
-  }
-  std::cout << "ok (" << time.elapsed() << " ms)" << std::endl;
-
-  QString name;
-  switch(operation)
-  {
-  case BOOLEAN_UNION:
-    name = tr("%1 union %2");
-    break;
-  case BOOLEAN_INTERSECTION:
-    name = tr("%1 intersection %2");
-    break;
-  case BOOLEAN_DIFFERENCE:
-    name = tr("%1 minus %2");
-    break;
-  case MINKOWSKI_SUM:
-    name = tr("Minkowski sum of %1 and %2");
-  }
-  
-  new_item->setName(name.arg(itemA->name(), itemB->name()));
-  new_item->setColor(Qt::green);
-  new_item->setRenderingMode(FlatPlusEdges);
-  itemA->setRenderingMode(Wireframe);
-  itemB->setRenderingMode(Wireframe);
-  scene->addItem(new_item);
-  scene->itemChanged(indexA);
-  scene->itemChanged(indexB);
-
-  QApplication::restoreOverrideCursor();
-}
-
-#include "Nef_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Convex_hull/Convex_hull_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Convex_hull/Convex_hull_plugin.cpp
deleted file mode 100644
index fac1be2..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Convex_hull/Convex_hull_plugin.cpp
+++ /dev/null
@@ -1,133 +0,0 @@
-#include <QTime>
-#include <QApplication>
-#include <QAction>
-#include <QStringList>
-
-#include "opengl_tools.h"
-#include "Scene_polyhedron_item.h"
-#include "Scene_points_with_normal_item.h"
-#include "Scene_polylines_item.h"
-#include "Scene_polyhedron_selection_item.h"
-#include "Polyhedron_type.h"
-
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-
-#include <CGAL/convex_hull_3.h>
-#include <boost/iterator/transform_iterator.hpp>
-using namespace CGAL::Three;
-class Polyhedron_demo_convex_hull_plugin : 
-  public QObject,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-public:
-    void init(QMainWindow* mainWindow,
-              Scene_interface* scene_interface)
-    {
-        mw = mainWindow;
-        scene = scene_interface;
-        actions_map["actionConvexHull"] = getActionFromMainWindow(mw, "actionConvexHull");
-        actions_map["actionConvexHull"]->setProperty("subMenuName",
-                                                     "3D Convex Hulls");
-        autoConnectActions();
-
-    }
-
-  // used by Polyhedron_demo_plugin_helper
-  QStringList actionsNames() const {
-    return QStringList() << "actionConvexHull";
-  }
-
-  bool applicable(QAction*) const {
-    return 
-      qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex())) ||
-      qobject_cast<Scene_polylines_item*>(scene->item(scene->mainSelectionIndex())) ||
-      qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex())) ||
-      qobject_cast<Scene_polyhedron_selection_item*>(scene->item(scene->mainSelectionIndex()));
-  }
-
-public Q_SLOTS:
-  void on_actionConvexHull_triggered();
-
-}; // end Polyhedron_demo_convex_hull_plugin
-
-// for transform iterator
-struct Get_point {
-  typedef const Polyhedron::Point_3& result_type;
-  result_type operator()(const Polyhedron::Vertex_handle v) const
-  { return v->point(); }
-};
-
-void Polyhedron_demo_convex_hull_plugin::on_actionConvexHull_triggered()
-{
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-  
-  Scene_polyhedron_item* poly_item = 
-    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-
-  Scene_points_with_normal_item* pts_item =
-    qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
-  
-  Scene_polylines_item* lines_item = 
-    qobject_cast<Scene_polylines_item*>(scene->item(index));
-  
-  Scene_polyhedron_selection_item* selection_item = 
-    qobject_cast<Scene_polyhedron_selection_item*>(scene->item(index));
-
-  if(poly_item || pts_item || lines_item || selection_item)
-  {
-    // wait cursor
-    QApplication::setOverrideCursor(Qt::WaitCursor);
-    
-    QTime time;
-    time.start();
-    std::cout << "Convex hull...";
-
-    // add convex hull as new polyhedron
-    Polyhedron *pConvex_hull = new Polyhedron;
-    if(selection_item) {
-      CGAL::convex_hull_3(
-        boost::make_transform_iterator(selection_item->selected_vertices.begin(), Get_point()),
-        boost::make_transform_iterator(selection_item->selected_vertices.end(), Get_point()),
-        *pConvex_hull);
-    }
-    else if ( poly_item ){
-      Polyhedron* pMesh = poly_item->polyhedron();  
-      CGAL::convex_hull_3(pMesh->points_begin(),pMesh->points_end(),*pConvex_hull);
-    }
-    else{
-      if (pts_item)
-        CGAL::convex_hull_3(pts_item->point_set()->begin(),pts_item->point_set()->end(),*pConvex_hull);
-      else{
-        std::size_t nb_points=0;
-        for(std::list<std::vector<Kernel::Point_3> >::const_iterator it = lines_item->polylines.begin();
-            it != lines_item->polylines.end();
-            ++it)  nb_points+=it->size();
-
-        std::vector<Kernel::Point_3> all_points;
-        all_points.reserve( nb_points );
-
-        for(std::list<std::vector<Kernel::Point_3> >::const_iterator it = lines_item->polylines.begin();
-            it != lines_item->polylines.end();
-            ++it)  std::copy(it->begin(), it->end(),std::back_inserter( all_points ) );
-        
-        CGAL::convex_hull_3(all_points.begin(),all_points.end(),*pConvex_hull);
-      }
-    }
-    std::cout << "ok (" << time.elapsed() << " ms)" << std::endl;
-
-    Scene_polyhedron_item* new_item = new Scene_polyhedron_item(pConvex_hull);
-    new_item->setName(tr("%1 (convex hull)").arg(scene->item(index)->name()));
-    new_item->setColor(Qt::magenta);
-    new_item->setRenderingMode(FlatPlusEdges);
-    scene->addItem(new_item);
-
-    // default cursor
-    QApplication::restoreOverrideCursor();
-  }
-}
-
-#include "Convex_hull_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Convex_hull/Kernel_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Convex_hull/Kernel_plugin.cpp
deleted file mode 100644
index 3a0abe3..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Convex_hull/Kernel_plugin.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-#include <QApplication>
-#include <QMainWindow>
-#include <QMessageBox>
-#include <QAction>
-#include <QStringList>
-
-#include "Scene_polyhedron_item.h"
-#include "Polyhedron_type.h"
-
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-
-#include <CGAL/Polyhedron_kernel.h>
-#include <CGAL/Exact_integer.h>
-#include <CGAL/convex_hull_3.h>
-
-#include <CGAL/Dualizer.h>
-#include <CGAL/translate.h>
-
-#include "Kernel_type.h"
-typedef Kernel::Triangle_3 Triangle;
-typedef Kernel::Point_3 Point;
-typedef Kernel::Vector_3 Vector;
-typedef Kernel::Plane_3 Plane;
-typedef Kernel::FT FT;
-using namespace CGAL::Three;
-class Polyhedron_demo_kernel_plugin : 
-  public QObject,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-public:
-  // used by Polyhedron_demo_plugin_helper
-  QStringList actionsNames() const {
-    return QStringList() << "actionKernel";
-  }
-
-  bool applicable(QAction*) const { 
-    return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
-  }
-
-public Q_SLOTS:
-  void on_actionKernel_triggered();
-
-}; // end Polyhedron_demo_kernel_plugin
-
-
-void Polyhedron_demo_kernel_plugin::on_actionKernel_triggered()
-{
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-  
-  Scene_polyhedron_item* item = 
-    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-
-  if(item)
-  {
-    Polyhedron* pMesh = item->polyhedron();
-
-    typedef CGAL::Exact_integer ET; // choose exact integral type
-    typedef Polyhedron_kernel<Kernel,ET> Polyhedron_kernel;
-
-    // get triangles from polyhedron
-    std::list<Triangle> triangles;
-    get_triangles(*pMesh,std::back_inserter(triangles));
-
-    // solve LP 
-    std::cout << "Solve linear program..." << triangles.size();
-    Polyhedron_kernel kernel;
-    if(!kernel.solve(triangles.begin(),triangles.end()))
-    {
-      std::cout << "done (empty kernel)" << std::endl;
-      QMessageBox::information(mw, tr("Empty kernel"),
-                               tr("The kernel of the polyhedron \"%1\" is empty.").
-                               arg(item->name()));
-      QApplication::restoreOverrideCursor();
-      return;
-    }
-    std::cout << "done" << std::endl;
-
-    // add kernel as new polyhedron
-    Polyhedron *pKernel = new Polyhedron;
-
-    // get inside point
-    Point inside_point = kernel.inside_point();
-    Vector translate = inside_point - CGAL::ORIGIN;
-
-    // compute dual of translated polyhedron w.r.t. inside point.
-    std::cout << "Compute dual of translated polyhedron...";
-    std::list<Point> dual_points;
-    std::list<Triangle>::iterator it;
-    for(it = triangles.begin();
-      it != triangles.end();
-      it++)
-    {
-      const Triangle& triangle = *it;
-      const Point p0 = triangle[0] - translate;
-      const Point p1 = triangle[1] - translate;
-      const Point p2 = triangle[2] - translate;
-      Plane plane(p0,p1,p2); 
-      Vector normal = plane.orthogonal_vector();
-      normal = normal / std::sqrt(normal*normal);
-      // compute distance to origin (do not use plane.d())
-      FT distance_to_origin = std::sqrt(CGAL::squared_distance(Point(CGAL::ORIGIN),plane));
-      Point dual_point = CGAL::ORIGIN + normal / distance_to_origin;
-      dual_points.push_back(dual_point);
-    }
-    std::cout << "ok" << std::endl;
-
-    // compute convex hull in dual space
-    std::cout << "convex hull in dual space...";
-    Polyhedron convex_hull;
-    CGAL::convex_hull_3(dual_points.begin(),dual_points.end(),convex_hull);
-    std::cout << "ok" << std::endl;
-
-    // dualize and translate back to get final kernel
-    Dualizer<Polyhedron,Kernel> dualizer;
-    dualizer.run(convex_hull,*pKernel);
-    ::translate<Polyhedron,Kernel>(*pKernel,translate);
-    pKernel->inside_out();
-
-    Scene_polyhedron_item* new_item = new Scene_polyhedron_item(pKernel);
-    new_item->setName(tr("%1 (kernel)").arg(item->name()));
-    new_item->setColor(Qt::magenta);
-    new_item->setRenderingMode(item->renderingMode());
-    scene->addItem(new_item);
-
-    item->setRenderingMode(Wireframe);
-    scene->itemChanged(item);
-
-    QApplication::restoreOverrideCursor();
-  }
-}
-
-#include "Kernel_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/Add_point_set_dialog.ui b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/Add_point_set_dialog.ui
deleted file mode 100644
index 43a30f0..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/Add_point_set_dialog.ui
+++ /dev/null
@@ -1,85 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>Add_point_set_dialog</class>
- <widget class="QDialog" name="Add_point_set_dialog">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>400</width>
-    <height>300</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Dialog</string>
-  </property>
-  <layout class="QHBoxLayout" name="horizontalLayout_2">
-   <item>
-    <layout class="QVBoxLayout" name="verticalLayout">
-     <property name="sizeConstraint">
-      <enum>QLayout::SetMinimumSize</enum>
-     </property>
-     <item>
-      <widget class="QTextEdit" name="textEdit">
-       <property name="sizePolicy">
-        <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
-       <property name="html">
-        <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
-<html><head><meta name="qrichtext" content="1" /><style type="text/css">
-p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;">
-<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html></string>
-       </property>
-       <property name="overwriteMode">
-        <bool>false</bool>
-       </property>
-       <property name="placeholderText">
-        <string notr="true">Point set format:  Ax Ay A3 Bx By Bz ... Zx Zy Zz </string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <layout class="QHBoxLayout" name="horizontalLayout">
-       <property name="sizeConstraint">
-        <enum>QLayout::SetMinimumSize</enum>
-       </property>
-       <item>
-        <widget class="QPushButton" name="add_point_setButton">
-         <property name="text">
-          <string>Add point set</string>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <spacer name="horizontalSpacer">
-         <property name="orientation">
-          <enum>Qt::Horizontal</enum>
-         </property>
-         <property name="sizeHint" stdset="0">
-          <size>
-           <width>40</width>
-           <height>20</height>
-          </size>
-         </property>
-        </spacer>
-       </item>
-       <item>
-        <widget class="QPushButton" name="close_point_setButton">
-         <property name="text">
-          <string>Close</string>
-         </property>
-        </widget>
-       </item>
-      </layout>
-     </item>
-    </layout>
-   </item>
-  </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/Add_polylines_dialog.ui b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/Add_polylines_dialog.ui
deleted file mode 100644
index d9a88bb..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/Add_polylines_dialog.ui
+++ /dev/null
@@ -1,91 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>Add_polylines_dialog</class>
- <widget class="QDialog" name="Add_polylines_dialog">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>459</width>
-    <height>332</height>
-   </rect>
-  </property>
-  <property name="sizePolicy">
-   <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
-    <horstretch>0</horstretch>
-    <verstretch>0</verstretch>
-   </sizepolicy>
-  </property>
-  <property name="windowTitle">
-   <string>Add polylines</string>
-  </property>
-  <layout class="QHBoxLayout" name="horizontalLayout_2">
-   <item>
-    <layout class="QVBoxLayout" name="verticalLayout">
-     <property name="sizeConstraint">
-      <enum>QLayout::SetMinimumSize</enum>
-     </property>
-     <item>
-      <widget class="QTextEdit" name="textEdit">
-       <property name="sizePolicy">
-        <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
-       <property name="html">
-        <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
-<html><head><meta name="qrichtext" content="1" /><style type="text/css">
-p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;">
-<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html></string>
-       </property>
-       <property name="overwriteMode">
-        <bool>false</bool>
-       </property>
-       <property name="placeholderText">
-        <string notr="true">Polyline format:  Ax Ay A3 Bx By Bz ... Zx Zy Zz </string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <layout class="QHBoxLayout" name="horizontalLayout">
-       <property name="sizeConstraint">
-        <enum>QLayout::SetMinimumSize</enum>
-       </property>
-       <item>
-        <widget class="QPushButton" name="add_polylineButton">
-         <property name="text">
-          <string>Create Polyline Item</string>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <spacer name="horizontalSpacer">
-         <property name="orientation">
-          <enum>Qt::Horizontal</enum>
-         </property>
-         <property name="sizeHint" stdset="0">
-          <size>
-           <width>40</width>
-           <height>20</height>
-          </size>
-         </property>
-        </spacer>
-       </item>
-       <item>
-        <widget class="QPushButton" name="close_polylineButton">
-         <property name="text">
-          <string>Close</string>
-         </property>
-        </widget>
-       </item>
-      </layout>
-     </item>
-    </layout>
-   </item>
-  </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/CMakeLists.txt
deleted file mode 100644
index 5475b5c..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/CMakeLists.txt
+++ /dev/null
@@ -1,57 +0,0 @@
-include( polyhedron_demo_macros )
-
-polyhedron_demo_plugin(gocad_plugin GOCAD_io_plugin)
-target_link_libraries(gocad_plugin scene_polyhedron_item)
-
-qt5_wrap_ui( funcUI_FILES Function_dialog.ui )
-polyhedron_demo_plugin(io_implicit_function_plugin Implicit_function_io_plugin ${funcUI_FILES})
-target_link_libraries(io_implicit_function_plugin scene_implicit_function_item)
-
-polyhedron_demo_plugin(nef_io_plugin Nef_io_plugin)
-target_link_libraries(nef_io_plugin  scene_nef_polyhedron_item)
-
-qt5_wrap_ui( statisticsPolyhedronUI_FILES Polyhedron_demo_statistics_on_polyhedron_dialog.ui)
-polyhedron_demo_plugin(off_plugin OFF_io_plugin)
-target_link_libraries(off_plugin scene_polyhedron_item scene_polygon_soup_item)
-
-polyhedron_demo_plugin(off_to_nef_plugin OFF_to_nef_io_plugin)
-target_link_libraries(off_to_nef_plugin scene_nef_polyhedron_item)
-
-polyhedron_demo_plugin(off_to_xyz_plugin OFF_to_xyz_io_plugin)
-target_link_libraries(off_to_xyz_plugin scene_points_with_normal_item)
-
-qt5_wrap_ui( polylines_ioUI_FILES Add_polylines_dialog.ui )
-polyhedron_demo_plugin(polylines_io_plugin Polylines_io_plugin ${polylines_ioUI_FILES})
-target_link_libraries(polylines_io_plugin scene_polylines_item)
-
-polyhedron_demo_plugin(selection_io_plugin Selection_io_plugin)
-target_link_libraries(selection_io_plugin scene_polyhedron_selection_item)
-
-polyhedron_demo_plugin(stl_plugin STL_io_plugin)
-target_link_libraries(stl_plugin scene_polyhedron_item scene_polygon_soup_item)
-
-find_package(VTK QUIET COMPONENTS
-  vtkCommonCore vtkIOCore vtkIOLegacy vtkIOXML vtkFiltersCore vtkFiltersSources)
-if (VTK_FOUND)
-  include(${VTK_USE_FILE})
-  if ("${VTK_VERSION_MAJOR}" GREATER "5")
-    if(VTK_LIBRARIES)
-      polyhedron_demo_plugin(vtk_plugin VTK_io_plugin)
-      target_link_libraries(vtk_plugin scene_polyhedron_item scene_polylines_item
-                                        vtkCommonCore vtkIOCore vtkIOLegacy vtkIOXML
-                                        vtkFiltersCore vtkFiltersSources)
-    else()
-      message(STATUS "NOTICE : the vtk IO plugin needs VTK libraries and will not be compiled.")
-    endif()
-  else()
-    message(STATUS "NOTICE : the vtk IO plugin needs VTK 6.0 or greater and will not be compiled (incorrect version found).")
-  endif()
-else()
-  message(STATUS "NOTICE : the vtk IO plugin needs VTK 6.0 or greater and will not be compiled.")
-endif()
-qt5_wrap_ui( xyzUI_FILES Add_point_set_dialog.ui)
-polyhedron_demo_plugin(xyz_plugin XYZ_io_plugin ${xyzUI_FILES})
-target_link_libraries(xyz_plugin scene_points_with_normal_item)
-
-polyhedron_demo_plugin(ply_to_xyz_plugin PLY_to_xyz_io_plugin)
-target_link_libraries(ply_to_xyz_plugin scene_points_with_normal_item)
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/Function_dialog.ui b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/Function_dialog.ui
deleted file mode 100644
index fe6d2b4..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/Function_dialog.ui
+++ /dev/null
@@ -1,97 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>FunctionDialog</class>
- <widget class="QDialog" name="FunctionDialog">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>399</width>
-    <height>149</height>
-   </rect>
-  </property>
-  <property name="sizePolicy">
-   <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-    <horstretch>0</horstretch>
-    <verstretch>0</verstretch>
-   </sizepolicy>
-  </property>
-  <property name="windowTitle">
-   <string>Load Function</string>
-  </property>
-  <widget class="QDialogButtonBox" name="buttonBox">
-   <property name="geometry">
-    <rect>
-     <x>40</x>
-     <y>100</y>
-     <width>341</width>
-     <height>32</height>
-    </rect>
-   </property>
-   <property name="orientation">
-    <enum>Qt::Horizontal</enum>
-   </property>
-   <property name="standardButtons">
-    <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
-   </property>
-  </widget>
-  <widget class="QComboBox" name="functionList">
-   <property name="geometry">
-    <rect>
-     <x>20</x>
-     <y>40</y>
-     <width>261</width>
-     <height>26</height>
-    </rect>
-   </property>
-  </widget>
-  <widget class="QLabel" name="label">
-   <property name="geometry">
-    <rect>
-     <x>20</x>
-     <y>20</y>
-     <width>251</width>
-     <height>16</height>
-    </rect>
-   </property>
-   <property name="text">
-    <string>Please choose the function to load:</string>
-   </property>
-  </widget>
- </widget>
- <resources/>
- <connections>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>accepted()</signal>
-   <receiver>FunctionDialog</receiver>
-   <slot>accept()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>248</x>
-     <y>254</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>157</x>
-     <y>274</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>rejected()</signal>
-   <receiver>FunctionDialog</receiver>
-   <slot>reject()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>316</x>
-     <y>260</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>286</x>
-     <y>274</y>
-    </hint>
-   </hints>
-  </connection>
- </connections>
-</ui>
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/GOCAD_io_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/GOCAD_io_plugin.cpp
deleted file mode 100644
index 9aa8bfb..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/GOCAD_io_plugin.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-#include "Scene_polyhedron_item.h"
-#include "Scene_polygon_soup_item.h"
-#include "Kernel_type.h"
-#include "Polyhedron_type.h"
-#include <CGAL/gocad_io.h>
-#include <CGAL/Timer.h>
-#include <CGAL/Three/Polyhedron_demo_io_plugin_interface.h>
-#include <fstream>
-
-#include <QColor>
-
-using namespace CGAL::Three;
-
-class Polyhedron_demo_gocad_plugin :
-  public QObject,
-  public Polyhedron_demo_io_plugin_interface
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0")
-
-public:
-  QString nameFilters() const;
-  QString name() const { return "gocad_plugin"; }
-  bool canLoad() const;
-  CGAL::Three::Scene_item* load(QFileInfo fileinfo);
-
-  bool canSave(const CGAL::Three::Scene_item*);
-  bool save(const CGAL::Three::Scene_item*, QFileInfo fileinfo);
-};
-
-QString Polyhedron_demo_gocad_plugin::nameFilters() const {
-  return "GOCAD files (*.ts *.xyz)";
-}
-
-bool Polyhedron_demo_gocad_plugin::canLoad() const {
-  return true;
-}
-
-
-CGAL::Three::Scene_item*
-Polyhedron_demo_gocad_plugin::load(QFileInfo fileinfo) {
-
-  // Open file
-  std::ifstream in(fileinfo.filePath().toUtf8());
-  if(!in) {
-    std::cerr << "Error! Cannot open file " << (const char*)fileinfo.filePath().toUtf8() << std::endl;
-    return NULL;
-  }
-    
-  // Try to read GOCAD file in a polyhedron
-
-  CGAL::Timer t;
-  t.start();
-  Scene_polyhedron_item* item = new Scene_polyhedron_item(Polyhedron());
-  Polyhedron& P = * const_cast<Polyhedron*>(item->polyhedron());
-  
-  std::string name, color;
-  if(! read_gocad(P, in, name, color)){
-    // std::cerr << "Error: Invalid polyhedron" << std::endl;
-    delete item;
-    return 0;
-  }   
-
-  t.stop();
-  std::cerr << "Reading took " << t.time() << " sec." << std::endl;
-  if(name.size() == 0){
-    item->setName(fileinfo.baseName());
-  } else {
-    item->setName(name.c_str());
-  }
-  QColor qcolor(color.c_str());
-  if(qcolor.isValid()) 
-  {  
-    item->setColor(qcolor);
-    item->invalidateOpenGLBuffers();
-  }
-  
-
-  return item;
-}
-
-bool Polyhedron_demo_gocad_plugin::canSave(const CGAL::Three::Scene_item* item)
-{
-  // This plugin supports polyhedrons
-  return qobject_cast<const Scene_polyhedron_item*>(item);
-}
-
-bool Polyhedron_demo_gocad_plugin::save(const CGAL::Three::Scene_item* item, QFileInfo fileinfo)
-{
-  // This plugin supports polyhedrons
-  const Scene_polyhedron_item* poly_item = 
-    qobject_cast<const Scene_polyhedron_item*>(item);
- 
-  if(!poly_item)
-    return false;
-
-  std::ofstream out(fileinfo.filePath().toUtf8());
-  out.precision (std::numeric_limits<double>::digits10 + 2);
-  Polyhedron* poly = const_cast<Polyhedron*>(poly_item->polyhedron());
-
-  write_gocad(*poly, out, qPrintable(fileinfo.baseName()));
-
-  
-  return true;
-
-}
-
-#include "GOCAD_io_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/Implicit_function_io_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/Implicit_function_io_plugin.cpp
deleted file mode 100644
index 26fedb2..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/Implicit_function_io_plugin.cpp
+++ /dev/null
@@ -1,213 +0,0 @@
-// Copyright (c) 2010 INRIA Sophia-Antipolis (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
-// 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(s)     : Stephane Tayeb
-//
-//******************************************************************************
-// File Description : 
-//******************************************************************************
-
-//#include <CGAL_demo/Plugin_interface.h>
-//#include <CGAL_demo/Plugin_helper.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <CGAL/Three/Polyhedron_demo_io_plugin_interface.h>
-
-#include "implicit_functions/Implicit_function_interface.h"
-#include "Scene_implicit_function_item.h"
-#include "ui_Function_dialog.h"
-
-#include <iostream>
-
-#include <QAction>
-#include <QMainWindow>
-#include <QPluginLoader>
-#include <QDir>
-#include <QApplication>
-#include <QMenu>
-#include <QList>
-#include <QLibrary>
-using namespace CGAL::Three;
-class Io_implicit_function_plugin :
-  public QObject, 
-  // public Polyhedron_demo_plugin_interface,
-  protected Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-public:
-  Io_implicit_function_plugin();
-  virtual ~Io_implicit_function_plugin() {}
-
-  bool applicable(QAction*) const { return true; }
-
-  QString name() const { return "implicit functions"; }
-  // QString nameFilters() const { return ""; }
-  // bool canLoad() const { return false; }
-  
-
-  typedef Polyhedron_demo_plugin_helper Plugin_helper;
-  
-  using Plugin_helper::init;
-  virtual void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface);
-  
-  QList<QAction*> actions() const
-  {
-    return QList<QAction*>();
-  }
-  
-public Q_SLOTS:
-  void load_function() const;
-  
-private:
-  void load_function_plugins();
-  
-private:
-  QList<Implicit_function_interface*> functions_;
-};
-
-
-
-Io_implicit_function_plugin::
-Io_implicit_function_plugin()
-{
-  load_function_plugins();
-}
-
-
-void
-Io_implicit_function_plugin::
-init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface)
-{
-  this->scene = scene_interface;
-  this->mw = mainWindow;
-  
-  QAction* actionLoadFunction = new QAction("Load &Implicit Function", mw);
-  if( NULL != actionLoadFunction )
-  {
-    connect(actionLoadFunction, SIGNAL(triggered()), this, SLOT(load_function()));
-  }
-  
-  QMenu* menuFile = mw->findChild<QMenu*>("menuFile");
-  if ( NULL != menuFile )
-  {
-    QList<QAction*> menuFileActions = menuFile->actions();
-    
-    // Look for action just after "Load..." action
-    QAction* actionAfterLoad = NULL;
-    for ( QList<QAction*>::iterator it_action = menuFileActions.begin(), 
-         end = menuFileActions.end() ; it_action != end ; ++ it_action ) //Q_FOREACH( QAction* action, menuFileActions)
-    {
-      if ( NULL != *it_action && (*it_action)->text().contains("Load") )
-      {
-        ++it_action;
-        if ( it_action != end && NULL != *it_action )
-        {
-          actionAfterLoad = *it_action;
-        }
-      }
-    }
-    
-    // Insert "Load implicit function" action
-    if ( NULL != actionAfterLoad )
-    {
-      menuFile->insertAction(actionAfterLoad,actionLoadFunction);      
-    }
-    
-  }
-}
-
-
-void
-Io_implicit_function_plugin::
-load_function() const
-{
-  QDialog dialog(mw);
-  Ui::FunctionDialog ui;
-  ui.setupUi(&dialog);
-  
-  connect(ui.buttonBox, SIGNAL(accepted()), &dialog, SLOT(accept()));
-  connect(ui.buttonBox, SIGNAL(rejected()), &dialog, SLOT(reject()));
-  
-  // Add loaded functions to the dialog
-  int i=0;
-  Q_FOREACH( Implicit_function_interface* f, functions_ )
-  {
-    ui.functionList->insertItem(i++,f->name());
-  }
-
-  // Open window
-  int return_code = dialog.exec();
-  if(return_code == QDialog::Rejected) { return; }
-  
-  // Get selected function
-  i = ui.functionList->currentIndex();
-  Implicit_function_interface* function = functions_[i];
-  
-  // Create Scene_implicit_function object and add it to the framework
-  Scene_implicit_function_item* item =
-    new Scene_implicit_function_item(function);
-  
-  item->setName(tr("%1").arg(function->name()));
-  item->setRenderingMode(FlatPlusEdges);
-
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-  scene->itemChanged(index);
-    
-  CGAL::Three::Scene_interface::Item_id new_item_id = scene->addItem(item);
-  scene->setSelectedItem(new_item_id);
-}
-
-void
-Io_implicit_function_plugin::
-load_function_plugins()
-{
-  QDir pluginsDir(qApp->applicationDirPath());
-  QString dirname = pluginsDir.dirName();
-  if ( !pluginsDir.cd("implicit_functions") ) { 
-    // In that case, dirname may be "Debug" or "Release" and one has to
-    // search in ../implicit_functions/Debug or
-    // ../implicit_functions/Release
-    QString newDir = QString("../implicit_functions/") + dirname;
-    if( !pluginsDir.cd(newDir) ) return; 
-  }
-  
-  Q_FOREACH (QString fileName, pluginsDir.entryList(QDir::Files))
-  {
-    if ( fileName.contains("plugin") && QLibrary::isLibrary(fileName) )
-    {
-      qDebug("    + Loading Function \"%s\"...", fileName.toUtf8().data());
-      QPluginLoader loader;
-      loader.setFileName(pluginsDir.absoluteFilePath(fileName));
-      QObject *function_plugin = loader.instance();
-      if ( NULL != function_plugin )
-      {
-        Implicit_function_interface* function =
-          qobject_cast<Implicit_function_interface*>(function_plugin);
-        
-        if ( NULL != function )
-        {
-          functions_ << function;
-        }
-      }
-    }
-  }
-}
-
-#include "Implicit_function_io_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/OFF_io_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/OFF_io_plugin.cpp
deleted file mode 100644
index 4ef5a45..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/OFF_io_plugin.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-#include "Scene_polyhedron_item.h"
-#include "Scene_polygon_soup_item.h"
-#include "Polyhedron_type.h"
-
-#include <CGAL/Three/Polyhedron_demo_io_plugin_interface.h>
-#include <fstream>
-
-#include <CGAL/IO/File_scanner_OFF.h>
-#include <QMessageBox>
-#include <QApplication>
-
-using namespace CGAL::Three;
-class Polyhedron_demo_off_plugin :
-  public QObject,
-  public Polyhedron_demo_io_plugin_interface
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0")
-
-public:
-  QString name() const { return "off_plugin"; }
-  QString nameFilters() const { return "OFF files (*.off);;Wavefront OBJ (*.obj)"; }
-  bool canLoad() const;
-  CGAL::Three::Scene_item* load(QFileInfo fileinfo);
-   CGAL::Three::Scene_item* load_off(QFileInfo fileinfo);
-   CGAL::Three::Scene_item* load_obj(QFileInfo fileinfo);
-  
-  bool canSave(const CGAL::Three::Scene_item*);
-  bool save(const CGAL::Three::Scene_item*, QFileInfo fileinfo);
-};
-
-bool Polyhedron_demo_off_plugin::canLoad() const {
-  return true;
-}
-
-
-CGAL::Three::Scene_item*
-Polyhedron_demo_off_plugin::load(QFileInfo fileinfo) {
-  if(fileinfo.suffix().toLower() == "off"){
-    return load_off(fileinfo);
-  } else if(fileinfo.suffix().toLower() == "obj"){
-    return load_obj(fileinfo);
-  }
-  return 0;
-}
-
-
-CGAL::Three::Scene_item*
-Polyhedron_demo_off_plugin::load_off(QFileInfo fileinfo) {
-  // Open file
-  std::ifstream in(fileinfo.filePath().toUtf8());
-  if(!in) {
-    std::cerr << "Error! Cannot open file " << (const char*)fileinfo.filePath().toUtf8() << std::endl;
-    return NULL;
-  }
-
-  // to detect isolated vertices
-  CGAL::File_scanner_OFF scanner( in, false);
-  std::size_t total_nb_of_vertices = scanner.size_of_vertices();
-  in.seekg(0);
-
-  // Try to read .off in a polyhedron
-  Scene_polyhedron_item* item = new Scene_polyhedron_item();
-  item->setName(fileinfo.completeBaseName());
-  if(!item->load(in))
-  {
-    delete item;
-
-    // Try to read .off in a polygon soup
-    Scene_polygon_soup_item* soup_item = new Scene_polygon_soup_item;
-    soup_item->setName(fileinfo.completeBaseName());
-    in.close();
-    std::ifstream in2(fileinfo.filePath().toUtf8());
-    if(!soup_item->load(in2)) {
-      delete soup_item;
-      return 0;
-    }
-    return soup_item;
-  }
-  else
-    if( total_nb_of_vertices!= item->polyhedron()->size_of_vertices())
-    {
-      QApplication::restoreOverrideCursor();
-      item->setNbIsolatedvertices(total_nb_of_vertices - item->polyhedron()->size_of_vertices());
-      QMessageBox::warning((QWidget*)NULL,
-                     tr("Isolated vertices found"),
-                     tr("%1 isolated vertices ignored")
-                     .arg(item->getNbIsolatedvertices()));
-    }
-
-  return item;
-}
-
-CGAL::Three::Scene_item*
-Polyhedron_demo_off_plugin::load_obj(QFileInfo fileinfo) {
-  // Open file
-  std::ifstream in(fileinfo.filePath().toUtf8());
-  if(!in) {
-    std::cerr << "Error! Cannot open file " << (const char*)fileinfo.filePath().toUtf8() << std::endl;
-    return NULL;
-  }
-
-  // Try to read .obj in a polyhedron
-  Scene_polyhedron_item* item = new Scene_polyhedron_item();
-  item->setName(fileinfo.completeBaseName());
-  if(!item->load_obj(in))
-    {
-      delete item;
-      return 0;
-    }
-
-
-  return item;
-}
-
-bool Polyhedron_demo_off_plugin::canSave(const CGAL::Three::Scene_item* item)
-{
-  // This plugin supports polyhedrons and polygon soups
-  return qobject_cast<const Scene_polyhedron_item*>(item) ||
-    qobject_cast<const Scene_polygon_soup_item*>(item);
-}
-
-bool Polyhedron_demo_off_plugin::save(const CGAL::Three::Scene_item* item, QFileInfo fileinfo)
-{
-  // This plugin supports polyhedrons and polygon soups
-  const Scene_polyhedron_item* poly_item = 
-    qobject_cast<const Scene_polyhedron_item*>(item);
-  const Scene_polygon_soup_item* soup_item = 
-    qobject_cast<const Scene_polygon_soup_item*>(item);
-
-  if(!poly_item && !soup_item)
-    return false;
-
-  std::ofstream out(fileinfo.filePath().toUtf8());
-  out.precision (std::numeric_limits<double>::digits10 + 2);
-  return (poly_item && poly_item->save(out)) || 
-    (soup_item && soup_item->save(out));
-}
-
-#include "OFF_io_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/OFF_to_xyz_io_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/OFF_to_xyz_io_plugin.cpp
deleted file mode 100644
index f818789..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/OFF_to_xyz_io_plugin.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-#include "Scene_points_with_normal_item.h"
-#include "Polyhedron_type.h"
-#include <CGAL/Three/Polyhedron_demo_io_plugin_interface.h>
-
-#include <CGAL/IO/Polyhedron_iostream.h>
-
-#include <fstream>
-using namespace CGAL::Three;
-class Polyhedron_demo_off_to_xyz_plugin :
-  public QObject,
-  public Polyhedron_demo_io_plugin_interface
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0")
-
-public:
-  QString name() const { return "off_to_xyz_plugin"; }
-  QString nameFilters() const { return "OFF files as Point set (*.off)"; }
-  bool canLoad() const;
-  CGAL::Three::Scene_item* load(QFileInfo fileinfo);
-
-  bool canSave(const CGAL::Three::Scene_item*);
-  bool save(const CGAL::Three::Scene_item*, QFileInfo fileinfo);
-};
-
-bool Polyhedron_demo_off_to_xyz_plugin::canLoad() const {
-  return true;
-}
-
-CGAL::Three::Scene_item*
-Polyhedron_demo_off_to_xyz_plugin::load(QFileInfo fileinfo) {
-  std::ifstream in(fileinfo.filePath().toUtf8());
-
-  if(!in)
-    std::cerr << "Error!\n";
-
-  Scene_points_with_normal_item* item;
-
-  Polyhedron p;
-  in >> p;
-  if (in && !p.empty())
-    item = new Scene_points_with_normal_item(p);
-  else{
-    in.close();
-    in.open(fileinfo.filePath().toUtf8());
-    item = new Scene_points_with_normal_item();
-    if(!item->read_off_point_set(in))
-    {
-      delete item;
-      return 0;
-    }
-  }
-
-  item->setName(fileinfo.completeBaseName());
-  return item;
-}
-
-bool Polyhedron_demo_off_to_xyz_plugin::canSave(const CGAL::Three::Scene_item* item)
-{
-  // This plugin supports point sets
-  return qobject_cast<const Scene_points_with_normal_item*>(item);
-}
-
-bool Polyhedron_demo_off_to_xyz_plugin::save(const CGAL::Three::Scene_item* item, QFileInfo fileinfo)
-{
-  // Check extension (quietly)
-  std::string extension = fileinfo.suffix().toUtf8().data();
-  if (extension != "off" && extension != "OFF")
-    return false;
-
-  // This plugin supports point sets
-  const Scene_points_with_normal_item* point_set_item =
-    qobject_cast<const Scene_points_with_normal_item*>(item);
-  if(!point_set_item)
-    return false;
-
-  // Save point set as .xyz
-  std::ofstream out(fileinfo.filePath().toUtf8().data());
-  out.precision (std::numeric_limits<double>::digits10 + 2);
-  return point_set_item->write_off_point_set(out);
-}
-
-
-#include "OFF_to_xyz_io_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/Polylines_io_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/Polylines_io_plugin.cpp
deleted file mode 100644
index 7beec99..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/Polylines_io_plugin.cpp
+++ /dev/null
@@ -1,272 +0,0 @@
-#include "Scene_polylines_item.h"
-
-#include <QMainWindow>
-#include <CGAL/Three/Polyhedron_demo_io_plugin_interface.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <fstream>
-#include <QVariant>
-#include <boost/foreach.hpp>
-#include <QMessageBox>
-
-#include "ui_Add_polylines_dialog.h"
-using namespace CGAL::Three;
-namespace Ui{
-    class Add_polylines_dialog;
-}
-class Polyhedron_demo_polylines_io_plugin :
-  public QObject,
-  public Polyhedron_demo_io_plugin_interface,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-    Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface CGAL::Three::Polyhedron_demo_io_plugin_interface)
-    Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-    Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0")
-
-
-public:
-    // To silent a warning -Woverloaded-virtual
-    // See http://stackoverflow.com/questions/9995421/gcc-woverloaded-virtual-warnings
-    using Polyhedron_demo_plugin_helper::init;
-    //! Adds an action to the menu and configures the widget
-    void init(QMainWindow* mainWindow,
-              CGAL::Three::Scene_interface* scene_interface) {
-      //get the references
-      this->scene = scene_interface;
-      this->mw = mainWindow;
-      //creates and link the actions
-      actionAdd_polylines= new QAction("Add Polylines", mw);
-      if(actionAdd_polylines) {
-        connect(actionAdd_polylines, SIGNAL(triggered()),
-                this, SLOT(on_actionAdd_polylines_triggered()));
-      }
-
-      QMenu* menuFile = mw->findChild<QMenu*>("menuFile");
-      if ( NULL != menuFile )
-      {
-        QList<QAction*> menuFileActions = menuFile->actions();
-
-        // Look for action just after "Load..." action
-        QAction* actionAfterLoad = NULL;
-        for ( QList<QAction*>::iterator it_action = menuFileActions.begin(),
-             end = menuFileActions.end() ; it_action != end ; ++ it_action ) //Q_FOREACH( QAction* action, menuFileActions)
-        {
-          if ( NULL != *it_action && (*it_action)->text().contains("Load Plugin") )
-          {
-            ++it_action;
-            if ( it_action != end && NULL != *it_action )
-            {
-              actionAfterLoad = *it_action;
-            }
-          }
-        }
-
-        // Insert "Load implicit function" action
-        if ( NULL != actionAfterLoad )
-        {
-          menuFile->insertAction(actionAfterLoad,actionAdd_polylines);
-        }
-      }
-    }
-  QString name() const { return "polylines_io_plugin"; }
-  QString nameFilters() const { return "Polylines files (*.polylines.txt *.cgal)"; }
-  bool canLoad() const;
-  CGAL::Three::Scene_item* load(QFileInfo fileinfo);
-
-  bool canSave(const CGAL::Three::Scene_item*);
-  bool save(const CGAL::Three::Scene_item*, QFileInfo fileinfo);
-  bool applicable(QAction*) const { return true;}
-  QList<QAction*> actions() const {
-    return QList<QAction*>();
-  }
-  protected Q_SLOTS:
-  //!Opens a dialog to add polylines on the fly.
-  void on_actionAdd_polylines_triggered();
-  //!Adds a polyline
-  void addPolylineButton_clicked();
-  //!Closes the dialog
-  void closePolylinesButton_clicked();
-
-private:
-  QAction* actionAdd_polylines;
-  Ui::Add_polylines_dialog *add_polydiagui;
-  QDialog *add_polydiag;
-};
-
-bool Polyhedron_demo_polylines_io_plugin::canLoad() const {
-  return true;
-}
-
-
-CGAL::Three::Scene_item*
-Polyhedron_demo_polylines_io_plugin::load(QFileInfo fileinfo) {
-
-  // Open file
-  std::ifstream ifs(fileinfo.filePath().toUtf8());
-  if(!ifs) {
-    std::cerr << "Error! Cannot open file " << (const char*)fileinfo.filePath().toUtf8() << std::endl;
-    return NULL;
-  }
-
-  std::list<std::vector<Scene_polylines_item::Point_3> > polylines;
-  QStringList polylines_metadata;
-  
-  int counter = 0;
-  std::size_t n;
-  while(ifs >> n) {
-    ++counter;
-    std::cerr << "Polyline #" << polylines.size() << ": " << n << " vertices";
-    polylines.resize(polylines.size()+1);
-    std::vector<Scene_polylines_item::Point_3>& polyline = *(polylines.rbegin());
-    while(n--){
-      Scene_polylines_item::Point_3 p;
-      ifs >> p;
-      polyline.push_back(p);
-      if(!ifs.good()) return 0;
-    }
-    std::string line_remainder;
-    std::getline(ifs, line_remainder);
-    QString metadata(line_remainder.c_str());
-    if(metadata[0].isSpace()) {
-      metadata.remove(0, 1);
-    }
-    polylines_metadata << metadata;
-    if(!metadata.isEmpty()) {
-      std::cerr << " (metadata: \"" << qPrintable(metadata) << "\")\n";
-    } else {
-      std::cerr << "\n";
-    }
-    if(ifs.bad() || ifs.fail()) return 0;
-  }
-  if(counter == 0) return 0;
-  Scene_polylines_item* item = new Scene_polylines_item;
-  item->polylines = polylines;
-  item->setName(fileinfo.baseName());
-  item->setColor(Qt::black);
-  item->setProperty("polylines metadata", polylines_metadata);
-  std::cerr << "Number of polylines in item: " << item->polylines.size() << std::endl;
-  item->invalidateOpenGLBuffers();
-  return item;
-}
-
-bool Polyhedron_demo_polylines_io_plugin::canSave(const CGAL::Three::Scene_item* item)
-{
-  return qobject_cast<const Scene_polylines_item*>(item) != 0;
-}
-
-bool Polyhedron_demo_polylines_io_plugin::save(const CGAL::Three::Scene_item* item, QFileInfo fileinfo)
-{
-  const Scene_polylines_item* poly_item = 
-    qobject_cast<const Scene_polylines_item*>(item);
-
-  if(!poly_item)
-    return false;
-
-  std::ofstream out(fileinfo.filePath().toUtf8());
-
-  out.precision (std::numeric_limits<double>::digits10 + 2);
-
-  if(!out) {
-    std::cerr << "Error! Cannot open file " << (const char*)fileinfo.filePath().toUtf8() << std::endl;
-    return false;
-  }
-
-  typedef Scene_polylines_item::Polylines_container Polylines_container;
-  typedef Polylines_container::value_type Polyline;
-  typedef Polyline::value_type Point_3;
-
-  QStringList metadata = item->property("polylines metadata").toStringList();
-
-  BOOST_FOREACH(const Polyline& polyline, poly_item->polylines) {
-    out << polyline.size();
-    BOOST_FOREACH(const Point_3& p, polyline) {
-      out << " " << p.x() << " " << p.y() << " " << p.z();
-    }
-    if(!metadata.isEmpty()) {
-      out << " " << qPrintable(metadata.front());
-      metadata.pop_front();
-    }
-    out << std::endl;
-  }
-  return (bool) out;
-}
-
-void Polyhedron_demo_polylines_io_plugin::on_actionAdd_polylines_triggered()
-{
-  add_polydiag = new QDialog(mw);
-  add_polydiagui = new Ui::Add_polylines_dialog();
-  add_polydiagui->setupUi(add_polydiag);
-  connect(add_polydiagui->add_polylineButton, SIGNAL(clicked()), this, SLOT(addPolylineButton_clicked()));
-  connect(add_polydiagui->close_polylineButton, SIGNAL(clicked()), this, SLOT(closePolylinesButton_clicked()));
-  add_polydiag->exec();
-}
-
-
-void Polyhedron_demo_polylines_io_plugin::addPolylineButton_clicked()
-{
-    static int nb_of_polylines = 0;
-  QString text = add_polydiagui->textEdit->toPlainText();
-  std::list<std::vector<Scene_polylines_item::Point_3> > polylines;
-  polylines.resize(polylines.size()+1);
-  std::vector<Scene_polylines_item::Point_3>& polyline = *(polylines.rbegin());
-  QStringList polylines_metadata;
-  QStringList list = text.split(QRegExp("\\s+"), QString::SkipEmptyParts);
-  int counter = 0;
-  double coord[3];
-  bool ok = true;
-  if (list.isEmpty()) return;
-  if (list.size()%3!=0){
-    QMessageBox *msgBox = new QMessageBox;
-    msgBox->setWindowTitle("Error");
-    msgBox->setText("ERROR : Input should consists of triplets.");
-    msgBox->exec();
-    return;
-  }
-  Q_FOREACH(QString s, list)
-  {
-      if(!s.isEmpty())
-      {
-          double res = s.toDouble(&ok);
-          if(!ok)
-          {
-              QMessageBox *msgBox = new QMessageBox;
-              msgBox->setWindowTitle("Error");
-              msgBox->setText("ERROR : Coordinates are invalid.");
-              msgBox->exec();
-              break;
-          }
-          else
-          {
-            coord[counter] = res;
-            counter++;
-          }
-      }
-      if(counter == 3)
-      {
-          Scene_polylines_item::Point_3 p(coord[0], coord[1], coord[2]);
-          polyline.push_back(p);
-          counter =0;
-      }
-  }
-    if(ok)
-    {
-        add_polydiagui->textEdit->clear();
-        Scene_polylines_item* item = new Scene_polylines_item;
-        item->polylines = polylines;
-        nb_of_polylines++;
-        QString name = QString("Polyline #%1").arg(QString::number(nb_of_polylines));
-        item->setName(name);
-        item->setColor(Qt::black);
-        item->setProperty("polylines metadata", polylines_metadata);
-        item->invalidateOpenGLBuffers();
-        scene->addItem(item);
-    }
-}
-
-void Polyhedron_demo_polylines_io_plugin::closePolylinesButton_clicked()
-{
-    add_polydiag->close();
-}
-
-#include "Polylines_io_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/VTK_io_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/VTK_io_plugin.cpp
deleted file mode 100644
index b754e47..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/VTK_io_plugin.cpp
+++ /dev/null
@@ -1,396 +0,0 @@
-// Copyright (c) 2015  GeometryFactory (France). All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Sebastien Loriot <sebastien.loriot at cgal.org>,
-//                 Jane Tournois
-//
-
-#include <QtCore/qglobal.h>
-
-#include "Polyhedron_type.h"
-#include "Scene_polyhedron_item.h"
-#include "Scene_polylines_item.h"
-
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <CGAL/Three/Polyhedron_demo_io_plugin_interface.h>
-
-#include <QApplication>
-#include <QMessageBox>
-#include <QMainWindow>
-#include <QFileDialog>
-#include <QString>
-
-#include <fstream>
-
-#include <boost/graph/graph_traits.hpp>
-#include <boost/unordered_map.hpp>
-
-#include <CGAL/boost/graph/properties.h>
-#include <CGAL/boost/graph/Euler_operations.h>
-#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
-#include <CGAL/property_map.h>
-
-#include <vtkSmartPointer.h>
-#include <vtkDataSetReader.h>
-#include <vtkXMLPolyDataReader.h>
-#include <vtkPolyDataWriter.h>
-#include <vtkUnstructuredGrid.h>
-#include <vtkXMLUnstructuredGridReader.h>
-#include <vtkXMLPolyDataWriter.h>
-#include <vtkPolyData.h>
-#include <vtkIdTypeArray.h>
-#include <vtkFieldData.h>
-#include <vtkFloatArray.h>
-#include <vtkDoubleArray.h>
-#include <vtkCell.h>
-#include <vtkCellData.h>
-#include <vtkIdList.h>
-#include <vtkAppendFilter.h>
-#include <vtkSphereSource.h>
-#include <vtkVersion.h>
-#include <vtkPoints.h>
-#include <vtkCellArray.h>
-#include <vtkType.h>
-#include <vtkCommand.h>
-
-namespace CGAL{
-
-  class ErrorObserverVtk : public vtkCommand
-  {
-  public:
-    ErrorObserverVtk() :
-      Error(false),
-      Warning(false),
-      ErrorMessage(""),
-      WarningMessage("") {}
-    static ErrorObserverVtk *New() { return new ErrorObserverVtk; }
-
-    bool GetError() const          { return this->Error; }
-    bool GetWarning() const        { return this->Warning; }
-    std::string GetErrorMessage()   { return ErrorMessage; }
-    std::string GetWarningMessage() { return WarningMessage; }
-
-    void Clear()
-    {
-      this->Error = false;
-      this->Warning = false;
-      this->ErrorMessage = "";
-      this->WarningMessage = "";
-    }
-    virtual void Execute(vtkObject *vtkNotUsed(caller),
-                         unsigned long event,
-                         void *calldata)
-    {
-      switch (event)
-      {
-      case vtkCommand::ErrorEvent:
-        ErrorMessage = static_cast<char *>(calldata);
-        this->Error = true;
-        break;
-      case vtkCommand::WarningEvent:
-        WarningMessage = static_cast<char *>(calldata);
-        this->Warning = true;
-        break;
-      }
-    }
-
-  private:
-    bool        Error;
-    bool        Warning;
-    std::string ErrorMessage;
-    std::string WarningMessage;
-  };
-
-  template <typename TM>
-  bool vtkPointSet_to_polygon_mesh(vtkPointSet* poly_data,
-                                   TM& tmesh)
-  {
-    typedef typename boost::property_map<TM, CGAL::vertex_point_t>::type VPMap;
-    typedef typename boost::property_map_value<TM, CGAL::vertex_point_t>::type Point_3;
-    typedef typename boost::graph_traits<TM>::vertex_descriptor vertex_descriptor;
-
-    VPMap vpmap = get(CGAL::vertex_point, tmesh);
-
-    // get nb of points and cells
-    vtkIdType nb_points = poly_data->GetNumberOfPoints();
-    vtkIdType nb_cells = poly_data->GetNumberOfCells();
-
-    //extract points
-    std::vector<vertex_descriptor> vertex_map(nb_points);
-    for (vtkIdType i = 0; i<nb_points; ++i)
-    {
-      double coords[3];
-      poly_data->GetPoint(i, coords);
-
-      vertex_descriptor v = add_vertex(tmesh);
-      put(vpmap, v, Point_3(coords[0], coords[1], coords[2]));
-      vertex_map[i]=v;
-    }
-
-    //extract cells
-    for (vtkIdType i = 0; i<nb_cells; ++i)
-    {
-      vtkCell* cell_ptr = poly_data->GetCell(i);
-
-      vtkIdType nb_vertices = cell_ptr->GetNumberOfPoints();
-      if (nb_vertices < 3)
-        return false;
-      std::vector<vertex_descriptor> vr(nb_vertices);
-      for (vtkIdType k=0; k<nb_vertices; ++k)
-        vr[k]=vertex_map[cell_ptr->GetPointId(k)];
-
-      CGAL::Euler::add_face(vr, tmesh);
-    }
-    return true;
-  }
-
-  template <class Point_3>
-  void extract_segments_from_vtkPointSet(vtkPointSet* poly_data,
-                                         std::vector< std::vector<Point_3> >& segments)
-  {
-    // get nb of points and cells
-    vtkIdType nb_points = poly_data->GetNumberOfPoints();
-    vtkIdType nb_cells = poly_data->GetNumberOfCells();
-
-    //extract points
-    std::vector<Point_3> point_map(nb_points);
-    for (vtkIdType i = 0; i<nb_points; ++i)
-    {
-      double coords[3];
-      poly_data->GetPoint(i, coords);
-      point_map[i]=Point_3(coords[0], coords[1], coords[2]);
-    }
-
-    //extract segments
-    for (vtkIdType i = 0; i<nb_cells; ++i)
-    {
-      vtkCell* cell_ptr = poly_data->GetCell(i);
-
-      vtkIdType nb_vertices = cell_ptr->GetNumberOfPoints();
-      if (nb_vertices !=2) continue;
-      segments.push_back( std::vector<Point_3>() );
-      segments.back().push_back(point_map[cell_ptr->GetPointId(0)]);
-      segments.back().push_back(point_map[cell_ptr->GetPointId(1)]);
-    }
-  }
-
-  template<typename VtkWriter, typename PM>
-  void polygon_mesh_to_vtkUnstructured(const PM& pmesh,//PolygonMesh
-                                       const char* filename)
-  {
-    typedef typename boost::graph_traits<PM>::vertex_descriptor   vertex_descriptor;
-    typedef typename boost::graph_traits<PM>::face_descriptor     face_descriptor;
-    typedef typename boost::graph_traits<PM>::halfedge_descriptor halfedge_descriptor;
-
-    typedef typename boost::property_map<PM, CGAL::vertex_point_t>::const_type VPMap;
-    typedef typename boost::property_map_value<PM, CGAL::vertex_point_t>::type Point_3;
-    VPMap vpmap = get(CGAL::vertex_point, pmesh);
-
-    vtkPoints* const vtk_points = vtkPoints::New();
-    vtkCellArray* const vtk_cells = vtkCellArray::New();
-
-    vtk_points->Allocate(pmesh.size_of_vertices());
-    vtk_cells->Allocate(pmesh.size_of_facets());
-
-    std::map<Polyhedron::Vertex_handle, vtkIdType> Vids;
-    vtkIdType inum = 0;
-
-    BOOST_FOREACH(vertex_descriptor v, vertices(pmesh))
-    {
-      const Point_3& p = get(vpmap, v);
-      vtk_points->InsertNextPoint(CGAL::to_double(p.x()),
-                                  CGAL::to_double(p.y()),
-                                  CGAL::to_double(p.z()));
-      Vids[v] = inum++;
-    }
-    BOOST_FOREACH(face_descriptor f, faces(pmesh))
-    {
-      vtkIdList* cell = vtkIdList::New();
-      BOOST_FOREACH(halfedge_descriptor h,
-                    halfedges_around_face(halfedge(f, pmesh), pmesh))
-      {
-        cell->InsertNextId(Vids[target(h, pmesh)]);
-      }
-      vtk_cells->InsertNextCell(cell);
-      cell->Delete();
-    }
-
-    vtkSmartPointer<vtkPolyData> polydata =
-      vtkSmartPointer<vtkPolyData>::New();
-
-    polydata->SetPoints(vtk_points);
-    vtk_points->Delete();
-
-    polydata->SetPolys(vtk_cells);
-    vtk_cells->Delete();
-
-    // Combine the two data sets
-    //vtkSmartPointer<vtkAppendFilter> appendFilter =
-    //  vtkSmartPointer<vtkAppendFilter>::New();
-    //appendFilter->AddInputData(polydata);
-    //appendFilter->Update();
-
-    //vtkSmartPointer<vtkPolyData> unstructuredGrid =
-    //  vtkSmartPointer<vtkPolyData>::New();
-    //unstructuredGrid->ShallowCopy(appendFilter->GetOutput());
-
-    // Write the unstructured grid
-    vtkSmartPointer<VtkWriter> writer =
-      vtkSmartPointer<VtkWriter>::New();
-    writer->SetFileName(filename);
-    writer->SetInputData(polydata);
-    writer->Write();
-  }
-}//end namespace CGAL
-
-
-class Polyhedron_demo_vtk_plugin :
-  public QObject,
-  public CGAL::Three::Polyhedron_demo_io_plugin_interface
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0")
-
-public:
-  typedef boost::graph_traits<Polyhedron>::vertex_descriptor vertex_descriptor;
-  typedef boost::graph_traits<Polyhedron>::face_descriptor face_descriptor;
-
-  QString nameFilters() const {
-    return "VTK PolyData files (*.vtk);; VTK XML PolyData (*.vtp)"; }
-  QString name() const { return "vtk_plugin"; }
-
-  bool canSave(const CGAL::Three::Scene_item* item)
-  {
-    return qobject_cast<const Scene_polyhedron_item*>(item);
-  }
-  bool save(const CGAL::Three::Scene_item* item, QFileInfo fileinfo)
-  {
-    std::string extension = fileinfo.suffix().toLower().toStdString();
-    if ( extension != "vtk" && extension != "vtp")
-      return false;
-
-    std::string output_filename = fileinfo.absoluteFilePath().toStdString();
-
-    const Scene_polyhedron_item* poly_item =
-      qobject_cast<const Scene_polyhedron_item*>(item);
-
-    if (!poly_item)
-      return false;
-    else
-    {
-      if (extension != "vtp")
-        CGAL::polygon_mesh_to_vtkUnstructured<vtkPolyDataWriter>(
-          *poly_item->polyhedron(),
-          output_filename.data());
-      else
-        CGAL::polygon_mesh_to_vtkUnstructured<vtkXMLPolyDataWriter>(
-        *poly_item->polyhedron(),
-        output_filename.data());
-    }
-    return true;
-  }
-
-  bool canLoad() const { return true; }
-
-  template <class vtkReader>
-  vtkSmartPointer<vtkReader>
-  read_vtk_file(const std::string& input_filename,
-                vtkSmartPointer<CGAL::ErrorObserverVtk> errorObserver)
-  {
-    vtkSmartPointer<vtkReader> reader = vtkSmartPointer<vtkReader>::New();
-    reader->AddObserver(vtkCommand::ErrorEvent, errorObserver);
-    reader->AddObserver(vtkCommand::WarningEvent, errorObserver);
-    reader->SetFileName(input_filename.data());
-    reader->Update();
-    return reader;
-  }
-
-  CGAL::Three::Scene_item* load(QFileInfo fileinfo)
-  {
-    std::string extension=fileinfo.suffix().toLower().toStdString();
-    if (extension != "vtk" && extension != "vtp" && extension != "vtu")
-      return 0;
-
-    std::string fname = fileinfo.absoluteFilePath().toStdString();
-
-    Polyhedron poly;
-    // Try to read .vtk in a polyhedron
-    vtkSmartPointer<vtkPointSet> data;
-    vtkSmartPointer<CGAL::ErrorObserverVtk> obs =
-      vtkSmartPointer<CGAL::ErrorObserverVtk>::New();
-
-    if (extension=="vtp")
-      data = read_vtk_file<vtkXMLPolyDataReader>(fname,obs)
-              ->GetOutput();
-    else
-     if (extension=="vtu")
-       data = read_vtk_file<vtkXMLUnstructuredGridReader>(fname,obs)
-                ->GetOutput();
-     else{
-       //read non-XML data
-       vtkSmartPointer<vtkDataSetReader> reader =
-         read_vtk_file<vtkDataSetReader>(fname,obs);
-       data = vtkPolyData::SafeDownCast(reader->GetOutput());
-       if (!data)
-        data = vtkUnstructuredGrid::SafeDownCast(reader->GetOutput());
-     }
-
-    if (obs->GetError())
-    {
-      QMessageBox msgBox;
-      msgBox.setText("This type of data can't be opened");
-      msgBox.setInformativeText(QString("VTK error message :\n")
-        .append(QString(obs->GetErrorMessage().data())));
-      msgBox.setStandardButtons(QMessageBox::Ok);
-      msgBox.setIcon(QMessageBox::Critical);
-      msgBox.exec();
-      return NULL;
-    }
-    if (obs->GetWarning())
-    {
-      QMessageBox msgBox;
-      msgBox.setText("This file generates a warning");
-      msgBox.setInformativeText(QString("VTK warning message :\n")
-        .append(QString(obs->GetWarningMessage().data())));
-      msgBox.setStandardButtons(QMessageBox::Ok);
-      msgBox.setIcon(QMessageBox::Warning);
-      msgBox.exec();
-    }
-
-    if (CGAL::vtkPointSet_to_polygon_mesh(data, poly))
-    {
-      Scene_polyhedron_item* poly_item = new Scene_polyhedron_item(poly);
-      poly_item->setName(fileinfo.fileName());
-      return poly_item;
-    }
-    else{
-      // extract only segments
-      std::vector< std::vector<Polyhedron::Point> > segments;
-      extract_segments_from_vtkPointSet(data,segments);
-      if (segments.empty()) return NULL; /// TODO handle point sets
-      Scene_polylines_item* polyline_item = new Scene_polylines_item();
-      polyline_item->setName(fileinfo.fileName());
-      BOOST_FOREACH(const std::vector<Polyhedron::Point_3>& segment, segments)
-        polyline_item->polylines.push_back(segment);
-      return polyline_item;
-    }
-    return NULL;
-  }
-}; // end Polyhedron_demo_vtk_plugin
-
-
-#include "VTK_io_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/XYZ_io_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/XYZ_io_plugin.cpp
deleted file mode 100644
index 1c18da4..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/XYZ_io_plugin.cpp
+++ /dev/null
@@ -1,223 +0,0 @@
-#include "Scene_points_with_normal_item.h"
-#include "Kernel_type.h"
-
-#include <QMainWindow>
-#include <CGAL/Three/Polyhedron_demo_io_plugin_interface.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <fstream>
-#include <QMessageBox>
-#include <QMenu>
-
-#include "ui_Add_point_set_dialog.h"
-using namespace CGAL::Three;
-namespace Ui{
-    class Add_point_set_dialog;
-}
-class Polyhedron_demo_xyz_plugin :
-  public QObject,
-  public Polyhedron_demo_io_plugin_interface,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-    Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface CGAL::Three::Polyhedron_demo_io_plugin_interface)
-    Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-    Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0")
-
-public:
-    // To silent a warning -Woverloaded-virtual
-    // See http://stackoverflow.com/questions/9995421/gcc-woverloaded-virtual-warnings
-    using Polyhedron_demo_plugin_helper::init;
-    //! Adds an action to the menu and configures the widget
-    void init(QMainWindow* mainWindow,
-              CGAL::Three::Scene_interface* scene_interface) {
-      //get the references
-      this->scene = scene_interface;
-      this->mw = mainWindow;
-      //creates and link the actions
-      actionAdd_point_set= new QAction("Add Point Sets", mw);
-      if(actionAdd_point_set) {
-        connect(actionAdd_point_set, SIGNAL(triggered()),
-                this, SLOT(on_actionAdd_point_set_triggered()));
-      }
-
-      QMenu* menuFile = mw->findChild<QMenu*>("menuFile");
-      if ( NULL != menuFile )
-      {
-        QList<QAction*> menuFileActions = menuFile->actions();
-
-        // Look for action just after "Load..." action
-        QAction* actionAfterLoad = NULL;
-        for ( QList<QAction*>::iterator it_action = menuFileActions.begin(),
-             end = menuFileActions.end() ; it_action != end ; ++ it_action ) //Q_FOREACH( QAction* action, menuFileActions)
-        {
-          if ( NULL != *it_action && (*it_action)->text().contains("Load Plugin") )
-          {
-            ++it_action;
-            if ( it_action != end && NULL != *it_action )
-            {
-              actionAfterLoad = *it_action;
-            }
-          }
-        }
-
-        // Insert "Load implicit function" action
-        if ( NULL != actionAfterLoad )
-        {
-          menuFile->insertAction(actionAfterLoad,actionAdd_point_set);
-        }
-      }
-    }
-  QString name() const { return "xyz_plugin"; }
-
-  QString nameFilters() const { return "XYZ as Point Set (*.xyz);;Point Set with Normal (*.pwn)"; }
-  bool canLoad() const;
-  CGAL::Three::Scene_item* load(QFileInfo fileinfo);
-
-  bool canSave(const CGAL::Three::Scene_item*);
-  bool save(const CGAL::Three::Scene_item*, QFileInfo fileinfo);
-  bool applicable(QAction*) const { return true;}
-  QList<QAction*> actions() const {
-    return QList<QAction*>();
-  }
-protected Q_SLOTS:
-  //!Opens a dialog to add a point set on the fly.
-  void on_actionAdd_point_set_triggered();
-  //!Adds a point set
-  void addPointSetButton_clicked();
-  //!Closes the dialog
-  void closePointSetButton_clicked();
-private:
-  QAction* actionAdd_point_set;
-  QDialog *add_pointsetdiag;
-  Ui::Add_point_set_dialog *add_pointsetdiagui;
-};
-
-bool Polyhedron_demo_xyz_plugin::canLoad() const {
-  return true;
-}
-
-
-CGAL::Three::Scene_item*
-Polyhedron_demo_xyz_plugin::load(QFileInfo fileinfo)
-{
-  // Open file
-  std::ifstream in(fileinfo.filePath().toUtf8().data());
-  if(!in) {
-    std::cerr << "Error! Cannot open file " << fileinfo.filePath().toStdString() << std::endl;
-    return NULL;
-  }
-
-  // Read .xyz in a point set
-  Scene_points_with_normal_item* point_set_item = new Scene_points_with_normal_item;
-  point_set_item->setName(fileinfo.completeBaseName());
-  if(!point_set_item->read_xyz_point_set(in)) {
-    delete point_set_item;
-    return NULL;
-  }
-  return point_set_item;
-}
-
-bool Polyhedron_demo_xyz_plugin::canSave(const CGAL::Three::Scene_item* item)
-{
-  // This plugin supports point sets
-  return qobject_cast<const Scene_points_with_normal_item*>(item);
-}
-
-bool Polyhedron_demo_xyz_plugin::save(const CGAL::Three::Scene_item* item, QFileInfo fileinfo)
-{
-  // Check extension (quietly)
-  std::string extension = fileinfo.suffix().toUtf8().data();
-  if (extension != "xyz" && extension != "XYZ" &&
-      extension != "pwn" && extension != "PWN")
-    return false;
-
-  // This plugin supports point sets
-  const Scene_points_with_normal_item* point_set_item =
-    qobject_cast<const Scene_points_with_normal_item*>(item);
-  if(!point_set_item)
-    return false;
-
-  // Save point set as .xyz
-  std::ofstream out(fileinfo.filePath().toUtf8().data());
-  out.precision (std::numeric_limits<double>::digits10 + 2);
-  return point_set_item->write_xyz_point_set(out);
-}
-
-
-void Polyhedron_demo_xyz_plugin::on_actionAdd_point_set_triggered()
-{
-  add_pointsetdiag = new QDialog(mw);
-  add_pointsetdiagui = new Ui::Add_point_set_dialog();
-  add_pointsetdiagui->setupUi(add_pointsetdiag);
-  connect(add_pointsetdiagui->add_point_setButton, SIGNAL(clicked()), this, SLOT(addPointSetButton_clicked()));
-  connect(add_pointsetdiagui->close_point_setButton, SIGNAL(clicked()), this, SLOT(closePointSetButton_clicked()));
-  add_pointsetdiag->exec();
-}
-
-void Polyhedron_demo_xyz_plugin::addPointSetButton_clicked()
-{
-    static int nb_of_point_set =0;
-  QString text = add_pointsetdiagui->textEdit->toPlainText();
-  Scene_points_with_normal_item* item = new Scene_points_with_normal_item();
-  QStringList list = text.split(QRegExp("\\s+"), QString::SkipEmptyParts);
-  int counter = 0;
-  double coord[3];
-  bool ok = true;
-  if (list.isEmpty()) return;
-  if (list.size()%3!=0){
-    QMessageBox *msgBox = new QMessageBox;
-    msgBox->setWindowTitle("Error");
-    msgBox->setText("ERROR : Input should consists of triplets.");
-    msgBox->exec();
-    return;
-  }
-  Q_FOREACH(QString s, list)
-  {
-      if(!s.isEmpty())
-      {
-          double res = s.toDouble(&ok);
-          if(!ok)
-          {
-              QMessageBox *msgBox = new QMessageBox;
-              msgBox->setWindowTitle("Error");
-              msgBox->setText("ERROR : Coordinates are invalid.");
-              msgBox->exec();
-              break;
-          }
-          else
-          {
-            coord[counter] = res;
-            counter++;
-          }
-      }
-      if(counter == 3)
-      {
-          const Kernel::Point_3 p(coord[0], coord[1], coord[2]);
-          Kernel::Vector_3 n(0,0,0);
-          UI_point point(p,n);
-          item->point_set()->push_back(point);
-
-
-          counter =0;
-      }
-  }
-    if(ok)
-    {
-        add_pointsetdiagui->textEdit->clear();
-        item->point_set()->unselect_all();
-        nb_of_point_set++;
-        QString name = QString("Point_set #%1").arg(QString::number(nb_of_point_set));
-        item->setName(name);
-        item->setColor(Qt::black);
-        item->invalidateOpenGLBuffers();
-        scene->addItem(item);
-    }
-}
-
-void Polyhedron_demo_xyz_plugin::closePointSetButton_clicked()
-{
-    add_pointsetdiag->close();
-}
-
-#include "XYZ_io_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_2/Mesh_2_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_2/Mesh_2_plugin.cpp
deleted file mode 100644
index 9aa275f..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_2/Mesh_2_plugin.cpp
+++ /dev/null
@@ -1,437 +0,0 @@
-
-// Needed for lloyd_optimize_mesh_2 which does it too late
-// (and we don't want to spend the time on finding out who
-// includes the header file that sets it too a value too low
-#define  BOOST_PARAMETER_MAX_ARITY 8
-
-#include <stdexcept>
-
-#define CGAL_CT2_WANTS_TO_HAVE_EXTRA_ACTION_FOR_INTERSECTING_CONSTRAINTS
-#define CGAL_CDT2_EXTRA_ACTION_FOR_INTERSECTING_CONSTRAINTS \
-  throw std::runtime_error("This plugin does not deal with intersecting edges");
-
-#include <QtCore/qglobal.h>
-
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-
-#include "Scene_polyhedron_item.h"
-#include "Scene_polylines_item.h"
-#include "Scene_points_with_normal_item.h"
-#include "Polyhedron_type.h"
-
-#include <CGAL/iterator.h>
-
-#include <CGAL/Projection_traits_xy_3.h>
-#include <CGAL/Projection_traits_yz_3.h>
-#include <CGAL/Projection_traits_xz_3.h>
-#include <CGAL/Constrained_Delaunay_triangulation_2.h>
-#include <CGAL/Delaunay_mesh_vertex_base_2.h>
-#include <CGAL/Delaunay_mesh_face_base_2.h>
-#include <CGAL/Delaunay_mesher_2.h>
-#include <CGAL/Delaunay_mesh_size_criteria_2.h>
-#include <CGAL/Triangulation_face_base_with_info_2.h>
-#include <CGAL/lloyd_optimize_mesh_2.h>
-
-#include <CGAL/boost/graph/Euler_operations.h>
-
-#include <QTime>
-#include <QAction>
-#include <QMainWindow>
-#include <QApplication>
-#include <QString>
-#include <QDialog>
-#include <QMessageBox>
-#include <QtPlugin>
-
-#include <vector>
-#include <algorithm>
-#include <queue>
-#include <sstream>
-
-#include "ui_mesh_2_dialog.h"
-
-struct FaceInfo2
-{
-  FaceInfo2(){}
-  int nesting_level;
-  bool in_domain(){
-    return nesting_level%2 == 1;
-  }
-};
-
-template <class CDT>
-void
-mark_domains(CDT& ct,
-             typename CDT::Face_handle start,
-             int index,
-             std::list<typename CDT::Edge>& border )
-{
-  if(start->info().nesting_level != -1){
-    return;
-  }
-  std::list<typename CDT::Face_handle> queue;
-  queue.push_back(start);
-  while(! queue.empty()){
-    typename CDT::Face_handle fh = queue.front();
-    queue.pop_front();
-    if(fh->info().nesting_level == -1){
-      fh->info().nesting_level = index;
-      for(int i = 0; i < 3; i++){
-        typename CDT::Edge e(fh,i);
-        typename CDT::Face_handle n = fh->neighbor(i);
-        if(n->info().nesting_level == -1){
-          if(ct.is_constrained(e)) border.push_back(e);
-          else queue.push_back(n);
-        }
-      }
-    }
-  }
-}
-
-template <class CDT>
-void
-mark_nested_domains(CDT& cdt)
-{
-  for(typename CDT::All_faces_iterator it = cdt.all_faces_begin(); it != cdt.all_faces_end(); ++it){
-    it->info().nesting_level = -1;
-  }
-  std::list<typename CDT::Edge> border;
-  mark_domains(cdt, cdt.infinite_face(), 0, border);
-  while(! border.empty()){
-    typename CDT::Edge e = border.front();
-    border.pop_front();
-    typename CDT::Face_handle n = e.first->neighbor(e.second);
-    if(n->info().nesting_level == -1){
-      mark_domains(cdt, n, e.first->info().nesting_level+1, border);
-    }
-  }
-}
-
-template <class CDT, class TriangleMesh>
-void cdt2_to_face_graph(const CDT& cdt, TriangleMesh& tm)
-{
-  typedef typename boost::graph_traits<Polyhedron>::vertex_descriptor vertex_descriptor;
-
-  typedef std::map<typename CDT::Vertex_handle, vertex_descriptor> Map;
-  Map descriptors;
-  for (typename CDT::Finite_faces_iterator fit=cdt.finite_faces_begin(),
-                                           fit_end=cdt.finite_faces_end();
-                                           fit!=fit_end; ++fit)
-  {
-    if (!fit->is_in_domain()) continue;
-    CGAL::cpp11::array<vertex_descriptor,3> vds;
-    for(int i=0; i<3; ++i)
-    {
-      typename Map::iterator it;
-      bool insert_ok;
-      boost::tie(it,insert_ok) =
-        descriptors.insert(std::make_pair(fit->vertex(i),vertex_descriptor()));
-      if (insert_ok)
-        it->second = add_vertex(fit->vertex(i)->point(),tm);
-      vds[i]=it->second;
-    }
-
-    CGAL::Euler::add_face(vds, tm);
-  }
-}
-
-class Polyhedron_demo_mesh_2_plugin :
-  public QObject,
-  public CGAL::Three::Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-public:
-  void init(QMainWindow* mainWindow,
-            CGAL::Three::Scene_interface* scene_interface)
-  {
-    this->scene = scene_interface;
-    this->mw = mainWindow;
-
-    actionMesh_2_ = new QAction("Mesh_2", mw);
-    // actionMesh_2_->setProperty("subMenuName", "Polygon Mesh Processing");
-    if (actionMesh_2_) {
-      connect(actionMesh_2_, SIGNAL(triggered()),
-        this, SLOT(run()));
-    }
-  }
-
-  QList<QAction*> actions() const {
-    return QList<QAction*>() << actionMesh_2_;
-  }
-
-  bool applicable(QAction*) const
-  {
-    Q_FOREACH(int index, scene->selectionIndices())
-    {
-      //if one polyhedron is found in the selection, it's fine
-      if (qobject_cast<Scene_polylines_item*>(scene->item(index)))
-        return true;
-    }
-    return false;
-  }
-
-private:
-  Ui::mesh_2_dialog
-  create_dialog(QDialog* dialog, double diag_length, bool no_seeds)
-  {
-    Ui::mesh_2_dialog ui;
-    ui.setupUi(dialog);
-    connect(ui.buttonBox, SIGNAL(accepted()), dialog, SLOT(accept()));
-    connect(ui.buttonBox, SIGNAL(rejected()), dialog, SLOT(reject()));
-
-    //connect checkbox to spinbox
-    connect(ui.runLloyd_checkbox, SIGNAL(toggled(bool)),
-            ui.nbIterations_spinbox, SLOT(setEnabled(bool)));
-    connect(ui.runMesh2_checkbox, SIGNAL(toggled(bool)),
-            ui.edgeLength_dspinbox, SLOT(setEnabled(bool)));
-
-    //Set default parameter edge length
-    ui.edgeLength_dspinbox->setDecimals(3);
-    ui.edgeLength_dspinbox->setSingleStep(0.001);
-    ui.edgeLength_dspinbox->setRange(1e-6 * diag_length, //min
-                                     2.   * diag_length);//max
-    ui.edgeLength_dspinbox->setValue(0.05 * diag_length);
-    ui.edgeLength_dspinbox->setToolTip(
-      "Diagonal length of the Bbox of the selection to mesh is "+
-      QString::number(diag_length)+" - default is 5% of it");
-
-    //Set default for nb iterations
-    ui.nbIterations_spinbox->setSingleStep(1);
-    ui.nbIterations_spinbox->setRange(1/*min*/, 1000/*max*/);
-    ui.nbIterations_spinbox->setValue(1);
-
-    // Run Mesh_2 by default, not Lloyd
-    ui.runLloyd_checkbox->setChecked(false);
-    ui.runMesh2_checkbox->setChecked(true);
-
-    // Domain definition and disabling all options if no Mesh_2 run
-    if (no_seeds){
-      ui.radioSeedsIn->setDisabled(true);
-      ui.radioSeedsOut->setDisabled(true);
-      ui.radioNesting->setChecked(true);
-    }
-    else{
-      ui.radioSeedsOut->setChecked(true);
-      connect(ui.runMesh2_checkbox, SIGNAL(toggled(bool)),
-              ui.radioSeedsOut, SLOT(setEnabled(bool)));
-      connect(ui.runMesh2_checkbox, SIGNAL(toggled(bool)),
-              ui.radioSeedsIn, SLOT(setEnabled(bool)));
-    }
-    connect(ui.runMesh2_checkbox, SIGNAL(toggled(bool)),
-            ui.radioNesting, SLOT(setEnabled(bool)));
-    connect(ui.runMesh2_checkbox, SIGNAL(toggled(bool)),
-            ui.radioAll, SLOT(setEnabled(bool)));
-    connect(ui.runMesh2_checkbox, SIGNAL(toggled(bool)),
-            ui.runLloyd_checkbox, SLOT(setEnabled(bool)));
-    return ui;
-  }
-
-  template <class ProjectionTraits>
-  void mesh(const std::vector<Scene_polylines_item*>& polylines_items,
-            const std::vector<Scene_points_with_normal_item*>& points_items,
-            double diagonal_length)
-  {
-    // extract seeds
-    std::vector<Kernel::Point_3> seeds;
-    Q_FOREACH(Scene_points_with_normal_item* points_item, points_items)
-      Q_FOREACH(UI_point_3<Kernel> pt, *points_item->point_set())
-        seeds.push_back(pt);
-
-    // Create dialog box
-    QDialog dialog(mw);
-    Ui::mesh_2_dialog ui =
-      create_dialog(&dialog, diagonal_length, seeds.empty());
-
-    // Get values
-    int i = dialog.exec();
-    if (i == QDialog::Rejected)
-    {
-      std::cout << "2D Meshing aborted" << std::endl;
-      return;
-    }
-    bool runMesh2 = ui.runMesh2_checkbox->isChecked();
-    double target_length = ui.edgeLength_dspinbox->value();
-    unsigned int nb_iter = ui.nbIterations_spinbox->value();
-    bool runLloyd = ui.runLloyd_checkbox->isChecked();
-
-
-    // wait cursor
-    QApplication::setOverrideCursor(Qt::WaitCursor);
-    typedef ProjectionTraits                                             Gt;
-    typedef CGAL::Delaunay_mesh_vertex_base_2<Gt>                        Vb;
-    typedef CGAL::Delaunay_mesh_face_base_2<Gt>                          Fm;
-    typedef CGAL::Triangulation_face_base_with_info_2<FaceInfo2,Gt,Fm>   Fb;
-    typedef CGAL::Triangulation_data_structure_2<Vb, Fb>                TDS;
-    typedef CGAL::No_intersection_tag                                   Tag;
-    typedef CGAL::Constrained_Delaunay_triangulation_2<Gt, TDS, Tag>    CDT;
-    typedef CGAL::Delaunay_mesh_size_criteria_2<CDT>               Criteria;
-
-    QTime time; // global timer
-    time.start();
-
-    std::cout << " Building Constrained_Delaunay_triangulation_2..."
-              << std::flush;
-    CDT cdt;
-
-    QTime ltime; //local timer
-    ltime.start();
-    try{
-      Q_FOREACH(Scene_polylines_item* polylines_item, polylines_items)
-        Q_FOREACH(const std::vector<Kernel::Point_3>& points,
-                    polylines_item->polylines)
-          cdt.insert_constraint(points.begin(),points.end());
-    }catch(std::runtime_error)
-    {
-      QApplication::restoreOverrideCursor();
-      throw;
-    }
-    std::cout << " done (" << ltime.elapsed() << " ms)" << std::endl;
-
-    if (cdt.dimension()!=2){
-      QApplication::restoreOverrideCursor();
-      std::cout << "Triangulation is not of dimension 2" << std::endl;
-      return;
-    }
-
-    if (runMesh2){
-      ltime.restart();
-      std::cout << " Running refine_Delaunay_mesh_2 ..." << std::flush;
-      Criteria criteria(0.125, target_length);
-      bool use_seeds=ui.radioSeedsOut->isChecked() ||
-                     ui.radioSeedsIn->isChecked();
-      if (!use_seeds){
-        bool use_nesting = ui.radioNesting->isChecked();
-        if (use_nesting){
-          mark_nested_domains(cdt);
-          for(typename CDT::All_faces_iterator fit=cdt.all_faces_begin(),
-                                               fit_end=cdt.all_faces_end();
-                                               fit!=fit_end;++fit)
-          {
-            fit->set_in_domain(fit->info().in_domain());
-          }
-        }
-        CGAL::refine_Delaunay_mesh_2(cdt, criteria, use_nesting);
-      }
-      else
-        CGAL::refine_Delaunay_mesh_2(cdt,
-                                     seeds.begin(), seeds.end(),
-                                     criteria, ui.radioSeedsIn->isChecked());
-      std::cout << " done (" << ltime.elapsed() << " ms)" << std::endl;
-    }
-
-    if (runLloyd){
-      ltime.restart();
-      std::cout << " Running lloyd_optimize_mesh_2..." << std::flush;
-      CGAL::lloyd_optimize_mesh_2(cdt,
-        CGAL::parameters::max_iteration_number = nb_iter);
-      std::cout << " done (" << ltime.elapsed() << " ms)" << std::endl;
-    }
-
-    // export result as a polyhedron item
-    QString iname =
-      polylines_items.size()==1?
-      polylines_items.front()->name()+QString("_meshed_"):
-      QString("2dmesh_");
-    iname+=QString::number(target_length);
-    if (runLloyd) iname+=QString("_Lloyd_")+QString::number(nb_iter);
-    Scene_polyhedron_item* poly_item = new Scene_polyhedron_item();
-    poly_item->setName(iname);
-    cdt2_to_face_graph(cdt,*poly_item->polyhedron());
-    scene->addItem(poly_item);
-    poly_item->invalidateOpenGLBuffers();
-
-    std::cout << "ok (" << time.elapsed() << " ms)" << std::endl;
-    // default cursor
-    QApplication::restoreOverrideCursor();
-  }
-
-  int detect_constant_coordinate(
-    const std::vector<Scene_polylines_item*>& polylines_items,
-    const std::vector<Scene_points_with_normal_item*>& points_items)
-  {
-    int res=-1;
-    Kernel::Point_3 ref = polylines_items.front()->polylines.front().front();
-    Q_FOREACH(Scene_polylines_item* polylines_item, polylines_items)
-      Q_FOREACH(const std::vector<Kernel::Point_3>& points,
-                  polylines_item->polylines)
-        Q_FOREACH(const Kernel::Point_3& pt, points)
-        {
-          int nbe=0, candidate=-1;
-          for (int i=0; i<3; ++i)
-            if (ref[i]==pt[i]){
-              ++nbe;
-              candidate=i;
-            }
-          if (nbe==0) return -1;
-          if (nbe==1){
-            if (res==-1)
-              res=candidate;
-            else
-              if(res!=candidate) return -1;
-          }
-        }
-    if (res==-1) return res;
-    Q_FOREACH(Scene_points_with_normal_item* points_item, points_items)
-      Q_FOREACH(UI_point_3<Kernel> pt, *points_item->point_set())
-        if (pt[res]!=ref[res])
-          return -1;
-    return res;
-  }
-
-public Q_SLOTS:
-
-  void run()
-  {
-    //collect input polylines
-    std::vector<Scene_polylines_item*> polylines_items;
-    std::vector<Scene_points_with_normal_item*> points_items;
-    double inf = std::numeric_limits<double>::infinity();
-    CGAL::Three::Scene_interface::Bbox bbox(inf,inf,inf,-inf,-inf,-inf);
-    Q_FOREACH(int index, scene->selectionIndices())
-    {
-      Scene_polylines_item* polylines_item =
-        qobject_cast<Scene_polylines_item*>(scene->item(index));
-      if (polylines_item){
-        polylines_items.push_back(polylines_item);
-        bbox=bbox+polylines_item->bbox();
-      }
-      else{
-        Scene_points_with_normal_item* points_item =
-          qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
-        if (points_item)
-          points_items.push_back(points_item);
-      }
-    }
-
-    double diag = bbox.diagonal_length();
-    switch( detect_constant_coordinate(polylines_items, points_items) )
-    {
-      using namespace CGAL;
-      typedef Kernel K;
-      case 0:
-        mesh<Projection_traits_yz_3<K> >(polylines_items, points_items, diag);
-      break;
-      case 1:
-        mesh<Projection_traits_xz_3<K> >(polylines_items, points_items, diag);
-      break;
-      case 2:
-        mesh<Projection_traits_xy_3<K> >(polylines_items, points_items, diag);
-      break;
-      default:
-        QMessageBox::critical(mw,
-                              "Invalid Input Data",
-                              "Polylines and seed points must all be in "
-                              "the same xy, yz or xz plane");
-    }
-  }
-
-private:
-  QAction* actionMesh_2_;
-
-}; // end Mesh_2_plugin
-
-#include "Mesh_2_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_2/mesh_2_dialog.ui b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_2/mesh_2_dialog.ui
deleted file mode 100644
index a9fc72a..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_2/mesh_2_dialog.ui
+++ /dev/null
@@ -1,231 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>mesh_2_dialog</class>
- <widget class="QDialog" name="mesh_2_dialog">
-  <property name="enabled">
-   <bool>true</bool>
-  </property>
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>408</width>
-    <height>357</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>2D Mesh Criteria</string>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout">
-   <item>
-    <widget class="QGroupBox" name="groupBox">
-     <property name="title">
-      <string>Mesh_2</string>
-     </property>
-     <layout class="QVBoxLayout" name="verticalLayout_3">
-      <item>
-       <layout class="QHBoxLayout" name="horizontalLayout">
-        <item>
-         <widget class="QLabel" name="runMesh2_label">
-          <property name="text">
-           <string>Run Mesh Refinement</string>
-          </property>
-          <property name="alignment">
-           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-          </property>
-         </widget>
-        </item>
-        <item>
-         <widget class="QCheckBox" name="runMesh2_checkbox">
-          <property name="text">
-           <string/>
-          </property>
-          <property name="checked">
-           <bool>true</bool>
-          </property>
-         </widget>
-        </item>
-       </layout>
-      </item>
-      <item>
-       <layout class="QHBoxLayout" name="horizontalLayout_4">
-        <item>
-         <widget class="QLabel" name="edgeLength_label">
-          <property name="text">
-           <string>Maximum edge length</string>
-          </property>
-          <property name="alignment">
-           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-          </property>
-          <property name="buddy">
-           <cstring>edgeLength_dspinbox</cstring>
-          </property>
-         </widget>
-        </item>
-        <item>
-         <widget class="QDoubleSpinBox" name="edgeLength_dspinbox">
-          <property name="minimumSize">
-           <size>
-            <width>110</width>
-            <height>0</height>
-           </size>
-          </property>
-          <property name="maximum">
-           <double>1000.000000000000000</double>
-          </property>
-          <property name="singleStep">
-           <double>0.100000000000000</double>
-          </property>
-         </widget>
-        </item>
-       </layout>
-      </item>
-      <item>
-       <layout class="QHBoxLayout" name="horizontalLayout_5">
-        <item>
-         <widget class="QLabel" name="label">
-          <property name="text">
-           <string>Domain Definition:</string>
-          </property>
-         </widget>
-        </item>
-        <item>
-         <layout class="QVBoxLayout" name="verticalLayout_2">
-          <item>
-           <widget class="QRadioButton" name="radioAll">
-            <property name="text">
-             <string>Whole Domain</string>
-            </property>
-           </widget>
-          </item>
-          <item>
-           <widget class="QRadioButton" name="radioNesting">
-            <property name="text">
-             <string>Use Nesting Number</string>
-            </property>
-           </widget>
-          </item>
-          <item>
-           <widget class="QRadioButton" name="radioSeedsIn">
-            <property name="text">
-             <string>With Seeds Inside the Domain</string>
-            </property>
-           </widget>
-          </item>
-          <item>
-           <widget class="QRadioButton" name="radioSeedsOut">
-            <property name="text">
-             <string>With Seeds Outside the Domain</string>
-            </property>
-           </widget>
-          </item>
-         </layout>
-        </item>
-       </layout>
-      </item>
-      <item>
-       <layout class="QHBoxLayout" name="horizontalLayout_2">
-        <item>
-         <widget class="QLabel" name="runLloyd_label">
-          <property name="text">
-           <string>Run Lloyd Optimisation</string>
-          </property>
-          <property name="alignment">
-           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-          </property>
-         </widget>
-        </item>
-        <item>
-         <widget class="QCheckBox" name="runLloyd_checkbox">
-          <property name="text">
-           <string/>
-          </property>
-         </widget>
-        </item>
-       </layout>
-      </item>
-      <item>
-       <layout class="QHBoxLayout" name="horizontalLayout_3">
-        <item>
-         <widget class="QLabel" name="nbIterations_label">
-          <property name="text">
-           <string>Number of iterations</string>
-          </property>
-          <property name="alignment">
-           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-          </property>
-          <property name="buddy">
-           <cstring>nbIterations_spinbox</cstring>
-          </property>
-         </widget>
-        </item>
-        <item>
-         <widget class="QSpinBox" name="nbIterations_spinbox">
-          <property name="enabled">
-           <bool>false</bool>
-          </property>
-          <property name="minimumSize">
-           <size>
-            <width>110</width>
-            <height>0</height>
-           </size>
-          </property>
-         </widget>
-        </item>
-       </layout>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item>
-    <widget class="QDialogButtonBox" name="buttonBox">
-     <property name="orientation">
-      <enum>Qt::Horizontal</enum>
-     </property>
-     <property name="standardButtons">
-      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
-     </property>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <tabstops>
-  <tabstop>edgeLength_dspinbox</tabstop>
-  <tabstop>buttonBox</tabstop>
- </tabstops>
- <resources/>
- <connections>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>accepted()</signal>
-   <receiver>mesh_2_dialog</receiver>
-   <slot>accept()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>388</x>
-     <y>288</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>157</x>
-     <y>195</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>rejected()</signal>
-   <receiver>mesh_2_dialog</receiver>
-   <slot>reject()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>388</x>
-     <y>288</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>286</x>
-     <y>195</y>
-    </hint>
-   </hints>
-  </connection>
- </connections>
-</ui>
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/C3t3_io_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/C3t3_io_plugin.cpp
deleted file mode 100644
index a4a8696..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/C3t3_io_plugin.cpp
+++ /dev/null
@@ -1,424 +0,0 @@
-#include <CGAL/Mesh_3/io_signature.h>
-#include "Scene_c3t3_item.h"
-
-#include <CGAL/Three/Polyhedron_demo_io_plugin_interface.h>
-#include <CGAL/IO/File_avizo.h>
-#include <iostream>
-#include <fstream>
-
-
-class Polyhedron_demo_c3t3_binary_io_plugin :
-  public QObject,
-  public CGAL::Three::Polyhedron_demo_io_plugin_interface
-{
-    Q_OBJECT
-    Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface)
-    Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-public:
-  QString name() const { return "C3t3_io_plugin"; }
-  QString nameFilters() const { return "binary files (*.cgal);;ascii (*.mesh);;maya (*.ma)"; }
-  QString saveNameFilters() const { return "binary files (*.cgal);;ascii (*.mesh);;maya (*.ma);;avizo (*.am)"; }
-  QString loadNameFilters() const { return "binary files (*.cgal)" ; }
-
-  bool canLoad() const;
-  CGAL::Three::Scene_item* load(QFileInfo fileinfo);
-
-  bool canSave(const CGAL::Three::Scene_item*);
-  bool save(const CGAL::Three::Scene_item*, QFileInfo fileinfo);
-
-private:
-  bool try_load_other_binary_format(std::istream& in, C3t3& c3t3);
-  bool try_load_a_cdt_3(std::istream& in, C3t3& c3t3);
-};
-
-
-bool Polyhedron_demo_c3t3_binary_io_plugin::canLoad() const {
-  return true;
-}
-
-
-CGAL::Three::Scene_item*
-Polyhedron_demo_c3t3_binary_io_plugin::load(QFileInfo fileinfo) {
-
-
-    if(fileinfo.suffix().toLower() == "cgal")
-    {
-        // Open file
-        std::ifstream in(fileinfo.filePath().toUtf8(),
-                         std::ios_base::in|std::ios_base::binary);
-        if(!in) {
-          std::cerr << "Error! Cannot open file "
-                    << (const char*)fileinfo.filePath().toUtf8() << std::endl;
-          return NULL;
-        }
-
-        Scene_c3t3_item* item = new Scene_c3t3_item();
-        item->setName(fileinfo.baseName());
-
-
-        if(item->load_binary(in)) {
-          item->c3t3_changed();
-          item->changed();
-          return item;
-        }
-
-        item->c3t3().clear();
-        in.seekg(0);
-        if(try_load_other_binary_format(in, item->c3t3())) {
-          item->c3t3_changed();
-          item->changed();
-          return item;
-        }
-
-        item->c3t3().clear();
-        in.seekg(0);
-        if(try_load_a_cdt_3(in, item->c3t3())) {
-          item->c3t3_changed();
-          item->changed();
-          return item;
-        }
-    }
-
-
-
-  // if all loading failed...
-  return NULL;
-}
-
-bool Polyhedron_demo_c3t3_binary_io_plugin::canSave(const CGAL::Three::Scene_item* item)
-{
-  // This plugin supports c3t3 items.
-  return qobject_cast<const Scene_c3t3_item*>(item);
-}
-
-bool
-Polyhedron_demo_c3t3_binary_io_plugin::
-save(const CGAL::Three::Scene_item* item, QFileInfo fileinfo)
-{
-    const Scene_c3t3_item* c3t3_item = qobject_cast<const Scene_c3t3_item*>(item);
-    if ( NULL == c3t3_item )
-    {
-      return false;
-    }
-
-    QString path = fileinfo.absoluteFilePath();
-
-    if(path.endsWith(".cgal"))
-    {
-    std::ofstream out(fileinfo.filePath().toUtf8(),
-                     std::ios_base::out|std::ios_base::binary);
-
-    return out && c3t3_item->save_binary(out);
-    }
-
-   else  if (fileinfo.suffix() == "mesh")
-    {
-      std::ofstream medit_file (qPrintable(path));
-      c3t3_item->c3t3().output_to_medit(medit_file,true,true);
-          return true;
-    }
-    else if (fileinfo.suffix() == "ma")
-    {
-      std::ofstream maya_file (qPrintable(path));
-      c3t3_item->c3t3().output_to_maya(
-        maya_file,true);
-          return true;
-    }
-    else if (fileinfo.suffix() == "am")
-    {
-      std::ofstream avizo_file (qPrintable(path));
-      CGAL::output_to_avizo(avizo_file, c3t3_item->c3t3());
-      return true;
-    }
-    else
-        return false;
-}
-
-struct Fake_mesh_domain {
-  typedef CGAL::Tag_true Has_features;
-  typedef int Subdomain_index;
-  typedef int Surface_patch_index;
-  typedef int Curve_segment_index;
-  typedef int Corner_index;
-  typedef boost::variant<Subdomain_index,Surface_patch_index> Index;
-};
-
-typedef Geom_traits Fake_gt;
-typedef CGAL::Mesh_vertex_base_3<Fake_gt, Fake_mesh_domain> Fake_vertex_base;
-typedef CGAL::Compact_mesh_cell_base_3<Fake_gt, Fake_mesh_domain> Fake_cell_base;
-typedef CGAL::Triangulation_data_structure_3<Fake_vertex_base,Fake_cell_base> Fake_tds;
-typedef CGAL::Regular_triangulation_3<Fake_gt, Fake_tds> Fake_tr;
-typedef CGAL::Mesh_complex_3_in_triangulation_3<
-  Fake_tr,
-  Fake_mesh_domain::Corner_index,
-  Fake_mesh_domain::Curve_segment_index> Fake_c3t3;
-
-template <class Vb = CGAL::Triangulation_vertex_base_3<Kernel> >
-struct Fake_CDT_3_vertex_base : public Vb
-{
-  typedef Vb Base;
-  bool steiner;
-  std::size_t ref_1, ref_2;
-
-  template < typename TDS2 >
-  struct Rebind_TDS {
-    typedef typename Base::template Rebind_TDS<TDS2>::Other   Vb2;
-    typedef Fake_CDT_3_vertex_base<Vb2>  Other;
-  };
-};
-
-template <class Vb>
-std::istream&
-operator>>( std::istream& is, Fake_CDT_3_vertex_base<Vb>& v)
-{
-  is >> static_cast<typename Fake_CDT_3_vertex_base<Vb>::Base&>(v);
-  char s;
-  if( CGAL::is_ascii(is) ) {
-    is >> s;
-    if( s == 'S' ) {
-      v.steiner = true;
-      is >> v.ref_1 >> v.ref_2;
-    }
-    else {
-      CGAL_assertion(s == '.' || s == 'F');
-      v.steiner = false;
-    }
-  } else {
-    CGAL::read( is, s );
-    if(is.bad()) return is;
-    if( s == 'S' ) {
-      v.steiner = true;
-      CGAL::read( is, v.ref_1 );
-      CGAL::read( is, v.ref_2 );
-    }
-    else {
-      // if(s != '.') {
-      // 	std::cerr << "v.point()=" << v.point() << std::endl;
-      // 	std::cerr << "s=" << s << " (" << (int)s
-      // 		  << "), just before position "
-      // 		  << is.tellg() << " !\n";
-      // }
-      CGAL_assertion(s == '.' || s== 'F');
-      v.steiner = false;
-    }
-  }
-  return is;
-}
-
-template <class Cb = CGAL::Triangulation_cell_base_3<Kernel> >
-struct Fake_CDT_3_cell_base : public Cb
-{
-  typedef Cb Base;
-  int constrained_facet[4];
-  bool _restoring[6];
-  int to_edge_index( int li, int lj ) const {
-    CGAL_triangulation_precondition( li >= 0 && li < 4 );
-    CGAL_triangulation_precondition( lj >= 0 && lj < 4 );
-    CGAL_triangulation_precondition( li != lj );
-    return ( li==0 || lj==0 ) ? li+lj-1 : li+lj;
-  }
-
-  template < typename TDS2 >
-  struct Rebind_TDS {
-    typedef typename Base::template Rebind_TDS<TDS2>::Other   Cb2;
-    typedef Fake_CDT_3_cell_base<Cb2>  Other;
-  };
-};
-
-template <typename Cb>
-std::istream&
-operator>>( std::istream& is, Fake_CDT_3_cell_base<Cb>& c) {
-  char s;
-  for( int li = 0; li < 4; ++li ) {
-    if( CGAL::is_ascii(is) )
-      is >> c.constrained_facet[li];
-    else
-      CGAL::read( is, c.constrained_facet[li] );
-  }
-
-  if( CGAL::is_ascii(is) ) {
-    is >> s;
-    CGAL_assertion(s == '-');
-  }
-  is >> static_cast<typename Fake_CDT_3_cell_base<Cb>::Base&>(c);
-  for( int li = 0; li < 3; ++li ) {
-    for( int lj = li+1; lj < 4; ++lj ) {
-      char s;
-      is >> s;
-      if(s == 'C') {
-        c._restoring[c.to_edge_index(li, lj)] = true;
-      } else {
-        if(s != '.') {
-          std::cerr << "cDT cell:";
-          for( int li = 0; li < 4; ++li ) {
-            std::cerr << " " << c.constrained_facet[li];
-          }
-          std::cerr << "\n";
-          std::cerr << "s=" << s << " (" << (int)s
-                    << "), just before position "
-                    << is.tellg() << " !\n";	}
-        CGAL_assertion(s == '.');
-        c._restoring[c.to_edge_index(li, lj)] = false;
-      }
-    }
-  }
-  return is;
-}
-
-typedef CGAL::Triangulation_data_structure_3<Fake_CDT_3_vertex_base<>, Fake_CDT_3_cell_base<> > Fake_CDT_3_TDS;
-typedef CGAL::Triangulation_3<Kernel, Fake_CDT_3_TDS> Fake_CDT_3;
-
-namespace CGAL {
-template <>
-class Output_rep<Patch_id> {
-  typedef Patch_id T;
-  const T& t;
-public:
-  //! initialize with a const reference to \a t.
-  Output_rep( const T& tt) : t(tt) {}
-  //! perform the output, calls \c operator\<\< by default.
-  std::ostream& operator()( std::ostream& out) const {
-    if(is_ascii(out)) {
-      out << t;
-    } else {
-      CGAL::write(out, t);
-    }
-    return out;
-  }
-};
-
-template <>
-class Input_rep<Patch_id> {
-  typedef Patch_id T;
-  T& t;
-public:
-  //! initialize with a const reference to \a t.
-  Input_rep( T& tt) : t(tt) {}
-  //! perform the output, calls \c operator\<\< by default.
-  std::istream& operator()( std::istream& in) const {
-    if(is_ascii(in)) {
-      in >> t;
-    } else {
-      CGAL::read(in, t);
-    }
-    return in;
-  }
-};
-} // end namespace CGAL
-
-struct Update_vertex {
-  typedef Fake_mesh_domain::Surface_patch_index Sp_index;
-  template <typename V1, typename V2>
-  bool operator()(const V1& v1, V2& v2) {
-    v2.set_point(v1.point());
-    v2.set_dimension(v1.in_dimension());
-    v2.set_special(v1.is_special());
-    switch(v1.in_dimension()) {
-    case 0:
-    case 1:
-    case 3:
-      v2.set_index(boost::get<int>(v1.index()));
-      break;
-    default: // case 2
-      const typename V1::Index& index = v1.index();
-      const Sp_index sp_index = boost::get<Sp_index>(index);
-      v2.set_index(sp_index);
-    }
-    return true;
-  }
-}; // end struct Update_vertex
-
-struct Update_cell {
-  typedef Fake_mesh_domain::Surface_patch_index Sp_index;
-  template <typename C1, typename C2>
-  bool operator()(const C1& c1, C2& c2) {
-    c2.set_subdomain_index(c1.subdomain_index());
-    for(int i = 0; i < 4; ++i) {
-      const Sp_index sp_index = c1.surface_patch_index(i);
-      c2.set_surface_patch_index(i, sp_index);
-    }
-    return true;
-  }
-}; // end struct Update_cell
-
-#include <CGAL/Triangulation_file_input.h>
-
-struct Update_vertex_from_CDT_3 {
-  template <typename V1, typename V2>
-  bool operator()(const V1& v1, V2& v2) {
-    v2.set_point(v1.point());
-    v2.set_dimension(2);
-    v2.set_special(false);
-    return true;
-  }
-}; // end struct Update_vertex
-
-struct Update_cell_from_CDT_3 {
-  typedef Fake_mesh_domain::Surface_patch_index Sp_index;
-  template <typename C1, typename C2>
-  bool operator()(const C1& c1, C2& c2) {
-    c2.set_subdomain_index(1);
-    for(int i = 0; i < 4; ++i) {
-      c2.set_surface_patch_index(i, c1.constrained_facet[i]);
-    }
-    return true;
-  }
-}; // end struct Update_cell
-
-bool
-Polyhedron_demo_c3t3_binary_io_plugin::
-try_load_a_cdt_3(std::istream& is, C3t3& c3t3)
-{
-  std::cerr << "Try load a CDT_3...";
-  CGAL::set_binary_mode(is);
-  if(CGAL::file_input<
-     Fake_CDT_3,
-     C3t3::Triangulation,
-     Update_vertex_from_CDT_3,
-     Update_cell_from_CDT_3>(is, c3t3.triangulation()))
-  {
-    std::cerr << "Try load a CDT_3... DONE";
-    return true;
-  }
-  else {
-    return false;
-  }
-}
-//Generates a compilation error.
-bool
-Polyhedron_demo_c3t3_binary_io_plugin::
-try_load_other_binary_format(std::istream& is, C3t3& c3t3)
-{
-  CGAL::set_ascii_mode(is);
-  std::string s;
-  is >> s;
-  if (s != "binary" ||
-      !(is >> s) ||
-      s != "CGAL" ||
-      !(is >> s) ||
-      s != "c3t3")
-  {
-    return false;
-  }
-  std::getline(is, s);
-  if(s != "") {
-    if(s != std::string(" ") + CGAL::Get_io_signature<Fake_c3t3>()()) {
-      std::cerr << "Polyhedron_demo_c3t3_binary_io_plugin::try_load_other_binary_format:"
-                << "\n  expected format: " << CGAL::Get_io_signature<Fake_c3t3>()()
-                << "\n       got format:" << s << std::endl;
-      return false;
-    }
-  }
-  CGAL::set_binary_mode(is);
-  std::istream& f_is = CGAL::file_input<
-    Fake_c3t3::Triangulation,
-    C3t3::Triangulation,
-    Update_vertex,
-    Update_cell>(is, c3t3.triangulation());
-
-  return f_is.good();
-}
-
-#include <QtPlugin>
-#include "C3t3_io_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt
deleted file mode 100644
index 9c393a4..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-include( polyhedron_demo_macros )
-
-if ( Boost_VERSION GREATER 103400 )
-  remove_definitions(-DQT_STATICPLUGIN)
-
-    qt5_wrap_cpp( VOLUME_MOC_OUTFILES ${CMAKE_CURRENT_SOURCE_DIR}/Volume_plane_thread.h )
-    qt5_wrap_cpp( VOLUME_MOC_OUTFILES ${CMAKE_CURRENT_SOURCE_DIR}/Volume_plane_interface.h )
-    qt5_wrap_ui( meshingUI_FILES  Meshing_dialog.ui Smoother_dialog.ui Local_optimizers_dialog.ui )
-    qt5_generate_moc( "Polyhedron_demo_mesh_3_plugin_cgal_code.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Scene_c3t3_item.moc" )
-    polyhedron_demo_plugin(mesh_3_plugin Mesh_3_plugin 
-      Mesh_3_plugin_cgal_code.cpp Meshing_thread.cpp 
-      ${meshingUI_FILES})
-    target_link_libraries(mesh_3_plugin scene_polyhedron_item scene_polygon_soup_item scene_polylines_item scene_implicit_function_item scene_segmented_image_item
-	scene_c3t3_item ${QGLVIEWER_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
-    polyhedron_demo_plugin(mesh_3_volume_planes_plugin Volume_planes_plugin ${VOLUME_MOC_OUTFILES} Volume_plane_intersection.cpp)
-    target_link_libraries(mesh_3_volume_planes_plugin scene_segmented_image_item)
-    polyhedron_demo_plugin(mesh_3_optimization_plugin Optimization_plugin
-      Optimization_plugin_cgal_code.cpp Optimizer_thread.cpp
-      ${meshingUI_FILES})
-    target_link_libraries(mesh_3_optimization_plugin scene_c3t3_item scene_polyhedron_item scene_segmented_image_item scene_implicit_function_item )
-
-  qt5_wrap_ui( imgUI_FILES Image_res_dialog.ui raw_image.ui)
-  polyhedron_demo_plugin(io_image_plugin Io_image_plugin Raw_image_dialog.cpp ${imgUI_FILES})
-  target_link_libraries(io_image_plugin scene_segmented_image_item)
-  polyhedron_demo_plugin(c3t3_io_plugin C3t3_io_plugin)
-  target_link_libraries(c3t3_io_plugin  scene_c3t3_item)
-  else( Boost_VERSION GREATER 103400 )
-    message(STATUS "warning: the plugin mesh_3_plugin requires Boost>=1.34.1 and will not be compiled.")
-  endif( Boost_VERSION GREATER 103400 )
-
-  polyhedron_demo_plugin(detect_sharp_edges_plugin Detect_sharp_edges_plugin)
-  target_link_libraries(detect_sharp_edges_plugin scene_polyhedron_item)
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Detect_sharp_edges_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Detect_sharp_edges_plugin.cpp
deleted file mode 100644
index 51d1ee2..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Detect_sharp_edges_plugin.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-#include <QApplication>
-#include <QMainWindow>
-#include <QAction>
-#include <QStringList>
-#include <QInputDialog>
-#include <QtPlugin>
-
-#include "Scene_polyhedron_item.h"
-#include "Scene_polygon_soup_item.h"
-#include "Polyhedron_type.h"
-
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-
-#include "Polyhedron_demo_detect_sharp_edges.h"
-
-using namespace CGAL::Three;
-class Polyhedron_demo_detect_sharp_edges_plugin :
-  public QObject,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-public:
-  void init(QMainWindow* mainWindow, Scene_interface* scene_interface) {
-    this->scene = scene_interface;
-    this->mw = mainWindow;
-    actionSharEdges = new QAction("Detect Sharp Features", mw);
-    actionSharEdges->setObjectName("detectSharpFeaturesAction");
-    if(actionSharEdges) {
-      connect(actionSharEdges, SIGNAL(triggered()),
-              this, SLOT(detectSharpEdgesWithInputDialog()));
-    }
-  }
-
-  bool applicable(QAction*) const {
-    Q_FOREACH(int index, scene->selectionIndices())
-    {
-      Scene_polyhedron_item* item =
-        qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-      if (item) return true;
-    }
-    return false;
-  }
-  
-  // used by Polyhedron_demo_plugin_helper
-  QList<QAction*> actions() const {
-    return QList<QAction*>() << actionSharEdges;
-  }
-
-public Q_SLOTS:
-void detectSharpEdges(bool input_dialog = false, double angle = 60);
-  void detectSharpEdgesWithInputDialog();
-
-protected:
-  Kernel::Vector_3 facet_normal(Polyhedron::Facet_handle f);
-  bool is_sharp(Polyhedron::Halfedge_handle he);
-
-private:
-  QAction* actionSharEdges;
-}; // end Polyhedron_demo_detect_sharp_edges_plugin
-
-void Polyhedron_demo_detect_sharp_edges_plugin::detectSharpEdgesWithInputDialog()
-{
-  detectSharpEdges(true);
-}
-
-void Polyhedron_demo_detect_sharp_edges_plugin::detectSharpEdges(bool input_dialog,
-                                                                 double angle)
-{
-  typedef std::pair<int,Polyhedron*> Poly_tuple;
-  
-  // Get selected items
-  QList<Poly_tuple> polyhedrons;
-  Q_FOREACH(int index, scene->selectionIndices())
-  {
-    Scene_polyhedron_item* item = 
-      qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-    if(!item)
-      return;
-    
-    Polyhedron* pMesh = item->polyhedron();
-    if(!pMesh)
-      return;
-    item->show_feature_edges(true);
-    polyhedrons << make_pair(index, pMesh);
-  }
-
-  if(input_dialog) {
-    bool ok = true;
-    angle = QInputDialog::getDouble(NULL, 
-                                    tr("Sharp edges max angle"),
-                                    tr("Angle in degrees between 0 and 180:"),
-                                    angle, // value
-                                    0.,          // min 
-                                    180., // max
-                                    2,          // decimals
-                                    &ok);
-    if(!ok) return;
-  }
-  // Detect edges
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-
-  Q_FOREACH(Poly_tuple tuple, polyhedrons)
-  {
-    Polyhedron* pMesh = tuple.second;
-    if (!pMesh) continue;
-
-    CGAL::detect_sharp_edges(pMesh, angle);
-
-    //update item
-    scene->item(tuple.first)->invalidateOpenGLBuffers();
-
-    // update scene
-    scene->itemChanged(tuple.first);
-  }
-
-  // default cursor
-  QApplication::restoreOverrideCursor();
-}
-
-#include "Detect_sharp_edges_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Image_res_dialog.ui b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Image_res_dialog.ui
deleted file mode 100644
index cd6a36d..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Image_res_dialog.ui
+++ /dev/null
@@ -1,105 +0,0 @@
-<ui version="4.0">
- <class>ImagePrecisionDialog</class>
- <widget class="QDialog" name="ImagePrecisionDialog">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>407</width>
-    <height>139</height>
-   </rect>
-  </property>
-  <property name="sizePolicy">
-   <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-    <horstretch>0</horstretch>
-    <verstretch>0</verstretch>
-   </sizepolicy>
-  </property>
-  <property name="windowTitle">
-   <string>Image Drawing Precision</string>
-  </property>
-  <layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0,0,0,0,0">
-   <item row="0" column="0">
-    <widget class="QLabel" name="label">
-     <property name="lineWidth">
-      <number>1</number>
-     </property>
-     <property name="text">
-      <string>Please choose the image drawing precision</string>
-     </property>
-     <property name="wordWrap">
-      <bool>true</bool>
-     </property>
-    </widget>
-   </item>
-   <item row="6" column="0" colspan="2">
-    <widget class="QDialogButtonBox" name="buttonBox">
-     <property name="orientation">
-      <enum>Qt::Horizontal</enum>
-     </property>
-     <property name="standardButtons">
-      <set>QDialogButtonBox::Ok</set>
-     </property>
-    </widget>
-   </item>
-   <item row="0" column="1">
-    <widget class="QComboBox" name="precisionList">
-     <property name="editable">
-      <bool>false</bool>
-     </property>
-    </widget>
-   </item>
-   <item row="1" column="0">
-    <widget class="QLabel" name="label_2">
-     <property name="font">
-      <font>
-       <pointsize>11</pointsize>
-       <italic>true</italic>
-      </font>
-     </property>
-     <property name="text">
-      <string>1:x means that x voxels of the original image are represented by 1 cube in the drawn image</string>
-     </property>
-     <property name="wordWrap">
-      <bool>true</bool>
-     </property>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <resources/>
- <connections>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>accepted()</signal>
-   <receiver>ImagePrecisionDialog</receiver>
-   <slot>accept()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>248</x>
-     <y>254</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>157</x>
-     <y>274</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>rejected()</signal>
-   <receiver>ImagePrecisionDialog</receiver>
-   <slot>reject()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>316</x>
-     <y>260</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>286</x>
-     <y>274</y>
-    </hint>
-   </hints>
-  </connection>
- </connections>
-</ui>
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp
deleted file mode 100644
index 225f887..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-#include "config.h"
-#include "Scene_segmented_image_item.h"
-#include "Image_type.h"
-#include "ui_Image_res_dialog.h"
-
-#include <QMessageBox>
-#include <QSettings>
-#include <QUrl>
-#include "Raw_image_dialog.h"
-#include <CGAL/Three/Polyhedron_demo_io_plugin_interface.h>
-#include <fstream>
-class Io_image_plugin :
-  public QObject,
-  public CGAL::Three::Polyhedron_demo_io_plugin_interface
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0")
-
-public:
-  Io_image_plugin() {}
-
-  QString nameFilters() const;
-  bool canLoad() const;
-  CGAL::Three::Scene_item* load(QFileInfo fileinfo);
-
-  bool canSave(const CGAL::Three::Scene_item*);
-  bool save(const CGAL::Three::Scene_item*, QFileInfo) { return false; }
-  QString name() const { return "segmented images"; }
-};
-
-
-QString Io_image_plugin::nameFilters() const {
-  return QString("Inrimage files (*.inr *.inr.gz) ;; Analyze files (*.hdr *.img *img.gz)");
-}
-
-
-bool Io_image_plugin::canLoad() const {
-  return true;
-}
-
-CGAL::Three::Scene_item*
-Io_image_plugin::load(QFileInfo fileinfo) {
-  Image* image = new Image;
-  QApplication::restoreOverrideCursor();
-  if(!image->read(fileinfo.filePath().toUtf8()))
-    {
-      QMessageBox qmb(QMessageBox::NoIcon,
-                      "Raw Dialog",
-                      tr("Error with file <tt>%1</tt>:\n"
-                         "unknown file format!\n"
-                         "\n"
-                         "Open it as a raw image?").arg(fileinfo.fileName()),
-                      QMessageBox::Yes|QMessageBox::No);
-
-      bool success = true;
-      if(qmb.exec() == QMessageBox::Yes) {
-        Raw_image_dialog raw_dialog;
-        raw_dialog.label_file_size->setText(QString("%1 B").arg(fileinfo.size()));
-        if( raw_dialog.exec() ){
-          QApplication::setOverrideCursor(Qt::WaitCursor);
-
-          if(image->read_raw(fileinfo.filePath().toUtf8(),
-			     raw_dialog.dim_x->value(),
-			     raw_dialog.dim_y->value(),
-			     raw_dialog.dim_z->value(),
-			     raw_dialog.spacing_x->value(),
-			     raw_dialog.spacing_y->value(),
-			     raw_dialog.spacing_z->value(),
-                             raw_dialog.offset->value())){
-            QSettings settings;
-            settings.beginGroup(QUrl::toPercentEncoding(fileinfo.absoluteFilePath()));
-            settings.setValue("is_raw", true);
-            settings.setValue("dim_x", raw_dialog.dim_x->value());
-            settings.setValue("dim_y", raw_dialog.dim_y->value());
-            settings.setValue("dim_z", raw_dialog.dim_z->value());
-            settings.setValue("spacing_x", raw_dialog.spacing_x->value());
-            settings.setValue("spacing_y", raw_dialog.spacing_y->value());
-            settings.setValue("spacing_z", raw_dialog.spacing_z->value());
-            settings.setValue("offset", raw_dialog.offset->value());
-            settings.endGroup();
-          }else {
-            success = false;
-          }
-        }else {
-          success = false;
-        }
-      }else {
-        success = false;   
-      }
-      if(!success){
-        delete image;
-        return NULL;
-      }
-    }
-  // Get display precision
-  QDialog dialog;
-  Ui::ImagePrecisionDialog ui;
-  ui.setupUi(&dialog);
-  
-  connect(ui.buttonBox, SIGNAL(accepted()), &dialog, SLOT(accept()));
-  connect(ui.buttonBox, SIGNAL(rejected()), &dialog, SLOT(reject()));
-  
-  // Add precision values to the dialog
-  for ( int i=1 ; i<9 ; ++i )
-  {
-    QString s = tr("1:%1").arg(i*i*i);
-    ui.precisionList->addItem(s);
-  }
-  
-  // Open window
-  QApplication::restoreOverrideCursor();
-  int return_code = dialog.exec();
-  if(return_code != QDialog::Accepted)
-  {
-    delete image;
-    return NULL;
-  }
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-  
-  // Get selected precision
-  int voxel_scale = ui.precisionList->currentIndex() + 1;
-
-  Scene_segmented_image_item* image_item = 
-    new Scene_segmented_image_item(image,voxel_scale);
-  image_item->setName(fileinfo.baseName());
-
-  return image_item;
-}
-
-bool Io_image_plugin::canSave(const CGAL::Three::Scene_item*)
-{
-  return false;
-}
-
-#include "Io_image_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Io_implicit_function_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Io_implicit_function_plugin.cpp
deleted file mode 100644
index 3dbbba5..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Io_implicit_function_plugin.cpp
+++ /dev/null
@@ -1,213 +0,0 @@
-// Copyright (c) 2010 INRIA Sophia-Antipolis (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
-// 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(s)     : Stephane Tayeb
-//
-//******************************************************************************
-// File Description : 
-//******************************************************************************
-
-//#include <CGAL_demo/Plugin_interface.h>
-//#include <CGAL_demo/Plugin_helper.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <CGAL/Three/Polyhedron_demo_io_plugin_interface.h>
-
-#include "implicit_functions/Implicit_function_interface.h"
-#include "Scene_implicit_function_item.h"
-#include "ui_Function_dialog.h"
-
-#include <iostream>
-
-#include <QAction>
-#include <QMainWindow>
-#include <QPluginLoader>
-#include <QDir>
-#include <QApplication>
-#include <QMenu>
-#include <QList>
-#include <QLibrary>
-using namespace CGAL::Three;
-class Io_implicit_function_plugin :
-  public QObject, 
-  protected Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-public:
-  Io_implicit_function_plugin();
-  virtual ~Io_implicit_function_plugin() {}
-
-  bool applicable(QAction*) const { return true; }
-
-  QString name() const { return "implicit functions"; }
-  // QString nameFilters() const { return ""; }
-  // bool canLoad() const { return false; }
-  
-
-  typedef Polyhedron_demo_plugin_helper Plugin_helper;
-  
-  using Plugin_helper::init;
-  virtual void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface);
-  
-  QList<QAction*> actions() const
-  {
-    return QList<QAction*>();
-  }
-  
-public Q_SLOTS:
-  void load_function() const;
-  
-private:
-  void load_function_plugins();
-  
-private:
-  QList<Implicit_function_interface*> functions_;
-};
-
-
-
-Io_implicit_function_plugin::
-Io_implicit_function_plugin()
-{
-  load_function_plugins();
-}
-
-
-void
-Io_implicit_function_plugin::
-init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface)
-{
-
-  this->scene = scene_interface;
-  this->mw = mainWindow;
-  
-  QAction* actionLoadFunction = new QAction("Load &Implicit Function", mw);
-  if( NULL != actionLoadFunction )
-  {
-    connect(actionLoadFunction, SIGNAL(triggered()), this, SLOT(load_function()));
-  }
-  
-  QMenu* menuFile = mw->findChild<QMenu*>("menuFile");
-  if ( NULL != menuFile )
-  {
-    QList<QAction*> menuFileActions = menuFile->actions();
-    
-    // Look for action just after "Load..." action
-    QAction* actionAfterLoad = NULL;
-    for ( QList<QAction*>::iterator it_action = menuFileActions.begin(), 
-         end = menuFileActions.end() ; it_action != end ; ++ it_action ) //Q_FOREACH( QAction* action, menuFileActions)
-    {
-      if ( NULL != *it_action && (*it_action)->text().contains("Load") )
-      {
-        ++it_action;
-        if ( it_action != end && NULL != *it_action )
-        {
-          actionAfterLoad = *it_action;
-        }
-      }
-    }
-    
-    // Insert "Load implicit function" action
-    if ( NULL != actionAfterLoad )
-    {
-      menuFile->insertAction(actionAfterLoad,actionLoadFunction);      
-    }
-    
-  }
-}
-
-
-void
-Io_implicit_function_plugin::
-load_function() const
-{
-  QDialog dialog(mw);
-  Ui::FunctionDialog ui;
-  ui.setupUi(&dialog);
-  
-  connect(ui.buttonBox, SIGNAL(accepted()), &dialog, SLOT(accept()));
-  connect(ui.buttonBox, SIGNAL(rejected()), &dialog, SLOT(reject()));
-  
-  // Add loaded functions to the dialog
-  int i=0;
-  Q_FOREACH( Implicit_function_interface* f, functions_ )
-  {
-    ui.functionList->insertItem(i++,f->name());
-  }
-
-  // Open window
-  int return_code = dialog.exec();
-  if(return_code == QDialog::Rejected) { return; }
-  
-  // Get selected function
-  i = ui.functionList->currentIndex();
-  Implicit_function_interface* function = functions_[i];
-  
-  // Create Scene_implicit_function object and add it to the framework
-  Scene_implicit_function_item* item =
-    new Scene_implicit_function_item(function);
-  
-  item->setName(tr("%1").arg(function->name()));
-  item->setRenderingMode(FlatPlusEdges);
-
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-  scene->itemChanged(index);
-    
-  CGAL::Three::Scene_interface::Item_id new_item_id = scene->addItem(item);
-  scene->setSelectedItem(new_item_id);
-}
-
-void
-Io_implicit_function_plugin::
-load_function_plugins()
-{
-  QDir pluginsDir(qApp->applicationDirPath());
-  QString dirname = pluginsDir.dirName();
-  if ( !pluginsDir.cd("implicit_functions") ) { 
-    // In that case, dirname may be "Debug" or "Release" and one has to
-    // search in ../implicit_functions/Debug or
-    // ../implicit_functions/Release
-    QString newDir = QString("../implicit_functions/") + dirname;
-    if( !pluginsDir.cd(newDir) ) return; 
-  }
-  
-  Q_FOREACH (QString fileName, pluginsDir.entryList(QDir::Files))
-  {
-    if ( fileName.contains("plugin") && QLibrary::isLibrary(fileName) )
-    {
-      qDebug("    + Loading Function \"%s\"...", fileName.toUtf8().data());
-      QPluginLoader loader;
-      loader.setFileName(pluginsDir.absoluteFilePath(fileName));
-      QObject *function_plugin = loader.instance();
-      if ( NULL != function_plugin )
-      {
-        Implicit_function_interface* function =
-          qobject_cast<Implicit_function_interface*>(function_plugin);
-        
-        if ( NULL != function )
-        {
-          functions_ << function;
-        }
-      }
-    }
-  }
-}
-
-#include "Io_implicit_function_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Local_optimizers_dialog.ui b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Local_optimizers_dialog.ui
deleted file mode 100644
index fb6b729..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Local_optimizers_dialog.ui
+++ /dev/null
@@ -1,225 +0,0 @@
-<ui version="4.0">
- <class>LocalOptim_dialog</class>
- <widget class="QDialog" name="LocalOptim_dialog">
-  <property name="sizePolicy">
-   <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
-    <horstretch>0</horstretch>
-    <verstretch>0</verstretch>
-   </sizepolicy>
-  </property>
-  <property name="minimumSize">
-   <size>
-    <width>0</width>
-    <height>0</height>
-   </size>
-  </property>
-  <property name="windowTitle">
-   <string>Local optimizer parameters</string>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout">
-   <item>
-    <widget class="QLabel" name="objectName">
-     <property name="font">
-      <font>
-       <pointsize>15</pointsize>
-       <weight>75</weight>
-       <bold>true</bold>
-      </font>
-     </property>
-     <property name="text">
-      <string>NO OBJECT</string>
-     </property>
-    </widget>
-   </item>
-   <item>
-    <spacer name="verticalSpacer">
-     <property name="orientation">
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeType">
-      <enum>QSizePolicy::MinimumExpanding</enum>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>20</width>
-       <height>10</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
-   <item>
-    <widget class="QGroupBox" name="groupBox">
-     <property name="font">
-      <font>
-       <pointsize>13</pointsize>
-      </font>
-     </property>
-     <property name="title">
-      <string>Parameters</string>
-     </property>
-     <layout class="QGridLayout" name="gridLayout_2">
-      <item row="0" column="0">
-       <widget class="QLabel" name="timeLabel">
-        <property name="text">
-         <string>Max CPU running time (s)</string>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-        </property>
-        <property name="buddy">
-         <cstring>maxTime</cstring>
-        </property>
-       </widget>
-      </item>
-      <item row="0" column="1">
-       <widget class="QDoubleSpinBox" name="maxTime">
-        <property name="minimumSize">
-         <size>
-          <width>100</width>
-          <height>0</height>
-         </size>
-        </property>
-        <property name="decimals">
-         <number>1</number>
-        </property>
-        <property name="maximum">
-         <double>9999.000000000000000</double>
-        </property>
-        <property name="value">
-         <double>60.000000000000000</double>
-        </property>
-       </widget>
-      </item>
-      <item row="0" column="2">
-       <widget class="QCheckBox" name="noTimeLimit">
-        <property name="text">
-         <string>No time limit</string>
-        </property>
-       </widget>
-      </item>
-      <item row="1" column="0">
-       <widget class="QLabel" name="sliverLabel">
-        <property name="text">
-         <string>Min. dihedral angle (degree)</string>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-        </property>
-        <property name="buddy">
-         <cstring>sliverBound</cstring>
-        </property>
-       </widget>
-      </item>
-      <item row="1" column="1">
-       <widget class="QDoubleSpinBox" name="sliverBound">
-        <property name="minimumSize">
-         <size>
-          <width>100</width>
-          <height>0</height>
-         </size>
-        </property>
-        <property name="readOnly">
-         <bool>false</bool>
-        </property>
-        <property name="decimals">
-         <number>1</number>
-        </property>
-        <property name="maximum">
-         <double>180.000000000000000</double>
-        </property>
-        <property name="value">
-         <double>8.000000000000000</double>
-        </property>
-       </widget>
-      </item>
-      <item row="1" column="2">
-       <widget class="QCheckBox" name="noBound">
-        <property name="text">
-         <string>No angle bound</string>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item>
-    <spacer name="verticalSpacer_3">
-     <property name="orientation">
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeType">
-      <enum>QSizePolicy::Fixed</enum>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>20</width>
-       <height>10</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
-   <item>
-    <layout class="QHBoxLayout" name="horizontalLayout">
-     <item>
-      <widget class="QCheckBox" name="createNewItem">
-       <property name="layoutDirection">
-        <enum>Qt::RightToLeft</enum>
-       </property>
-       <property name="text">
-        <string>Create a new mesh object</string>
-       </property>
-       <property name="checked">
-        <bool>true</bool>
-       </property>
-      </widget>
-     </item>
-    </layout>
-   </item>
-   <item>
-    <widget class="QDialogButtonBox" name="buttonBox">
-     <property name="orientation">
-      <enum>Qt::Horizontal</enum>
-     </property>
-     <property name="standardButtons">
-      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
-     </property>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <resources/>
- <connections>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>accepted()</signal>
-   <receiver>LocalOptim_dialog</receiver>
-   <slot>accept()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>384</x>
-     <y>191</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>157</x>
-     <y>195</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>rejected()</signal>
-   <receiver>LocalOptim_dialog</receiver>
-   <slot>reject()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>384</x>
-     <y>191</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>286</x>
-     <y>195</y>
-    </hint>
-   </hints>
-  </connection>
- </connections>
-</ui>
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp
deleted file mode 100644
index b3cb2c5..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp
+++ /dev/null
@@ -1,449 +0,0 @@
-#include "config.h"
-#include "config_mesh_3.h"
-
-#ifdef CGAL_POLYHEDRON_DEMO_USE_SURFACE_MESHER
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-#include "Messages_interface.h"
-
-#include <QObject>
-#include <QAction>
-#include <QMainWindow>
-#include <QApplication>
-#include <QtPlugin>
-#include "Scene_c3t3_item.h"
-#include <QInputDialog>
-#include <QFileDialog>
-#include <QMessageBox>
-#include <fstream>
-
-#include "Scene_polyhedron_item.h"
-#include "Scene_polylines_item.h"
-
-#ifdef CGAL_MESH_3_DEMO_ACTIVATE_IMPLICIT_FUNCTIONS
-#include "Scene_implicit_function_item.h"
-#endif
-#ifdef CGAL_MESH_3_DEMO_ACTIVATE_SEGMENTED_IMAGES
-#include "Scene_segmented_image_item.h"
-#endif
-
-#include "Meshing_thread.h"
-
-#include "ui_Meshing_dialog.h"
-
-using namespace CGAL::Three;
-
-// Constants
-const QColor default_mesh_color(45,169,70);
-
-#include "Mesh_3_plugin_cgal_code.h" // declare functions `cgal_code_mesh_3`
-
-class Mesh_3_plugin :
-  public QObject,
-  protected Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-public:
-  using Polyhedron_demo_plugin_helper::init;
-  void init(QMainWindow* mainWindow,
-            CGAL::Three::Scene_interface* scene_interface,
-            Messages_interface* msg_interface)
-  {
-    this->scene = scene_interface;
-    this->mw = mainWindow;
-    actionMesh_3 = new QAction("Create a Tetrahedral Mesh", mw);
-    if(actionMesh_3) {
-      actionMesh_3->setProperty("subMenuName", "Tetrahedral Mesh Generation");
-      connect(actionMesh_3, SIGNAL(triggered()),
-              this, SLOT(mesh_3()));
-    }
-    this->msg = msg_interface;
-  }
-
-  QList<QAction*> actions() const {
-    return QList<QAction*>() << actionMesh_3;
-  }
-
-
-  bool applicable(QAction*) const {
-#ifdef CGAL_MESH_3_DEMO_ACTIVATE_IMPLICIT_FUNCTIONS
-    if(qobject_cast<Scene_implicit_function_item*>(scene->item(scene->mainSelectionIndex())))
-      return true;
-#endif
-#ifdef CGAL_MESH_3_DEMO_ACTIVATE_SEGMENTED_IMAGES
-    Q_FOREACH(int ind, scene->selectionIndices()){
-      if( qobject_cast<Scene_segmented_image_item*>(scene->item(ind)))
-        return true;
-    }
-#endif  
-    Q_FOREACH(int ind, scene->selectionIndices()){
-      if( qobject_cast<Scene_polyhedron_item*>(scene->item(ind)))
-        return true;
-    }
-    return false;
-  }
-
-public Q_SLOTS:
-  void mesh_3();
-  void meshing_done(Meshing_thread* t);
-  void status_report(QString str);
-
-private:
-  void launch_thread(Meshing_thread* mesh_thread);
-  void treat_result(Scene_item& source_item, Scene_c3t3_item& result_item) const;
-
-private:
-  QAction* actionMesh_3;
-  Messages_interface* msg;
-  QMessageBox* message_box_;
-  Scene_item* source_item_;
-}; // end class Mesh_3_plugin
-
-double
-get_approximate(double d, int precision, int& decimals)
-{
-    if ( d<0 ) { return 0; }
-
-    double i = std::pow(10.,precision-1);
-
-    decimals = 0;
-    while ( d > i*10 ) { d = d/10.; ++decimals; }
-    while ( d < i ) { d = d*10.; --decimals; }
-
-    return std::floor(d)*std::pow(10.,decimals);
-}
-
-void Mesh_3_plugin::mesh_3()
-{
-  Scene_polyhedron_item* poly_item = NULL;
-  Scene_implicit_function_item* function_item = NULL;
-  Scene_segmented_image_item* image_item = NULL;
-  Scene_polylines_item* polylines_item = NULL;
-
-  Q_FOREACH(int ind, scene->selectionIndices()) {
-
-    if(poly_item == NULL){
-      poly_item = qobject_cast<Scene_polyhedron_item*>(scene->item(ind));
-    }
-#ifdef CGAL_MESH_3_DEMO_ACTIVATE_IMPLICIT_FUNCTIONS
-    if(function_item == NULL){
-      function_item = qobject_cast<Scene_implicit_function_item*>(scene->item(ind));
-    }
-#endif
-#ifdef CGAL_MESH_3_DEMO_ACTIVATE_SEGMENTED_IMAGES
-    if(image_item == NULL){
-      image_item = qobject_cast<Scene_segmented_image_item*>(scene->item(ind));
-    }
-#endif
-    if(polylines_item == NULL){
-      polylines_item = qobject_cast<Scene_polylines_item*>(scene->item(ind));
-    }
-  }
-  Scene_item* item = NULL;
-  bool features_protection_available = false;
-  if(NULL != poly_item)
-  {
-    item = poly_item;
-    features_protection_available = true;
-  }
-#ifdef CGAL_MESH_3_DEMO_ACTIVATE_IMPLICIT_FUNCTIONS
-  else if (NULL != function_item) { item = function_item; }
-#endif
-#ifdef CGAL_MESH_3_DEMO_ACTIVATE_SEGMENTED_IMAGES
-  else if (NULL != image_item)
-    { 
-      item = image_item;
-      features_protection_available = true;
-    }
-#endif
-
-  if (NULL == item)
-  {
-    QMessageBox::warning(mw, tr(""),
-      tr("Selected object can't be meshed"));
-    return;
-  }
-
-  // -----------------------------------
-  // Create Mesh dialog
-  // -----------------------------------
-  QDialog dialog(mw);
-  Ui::Meshing_dialog ui;
-  ui.setupUi(&dialog);
-  connect(ui.buttonBox, SIGNAL(accepted()),
-          &dialog, SLOT(accept()));
-  connect(ui.buttonBox, SIGNAL(rejected()),
-          &dialog, SLOT(reject()));
-
-  // Connect checkboxes to spinboxes
-  connect(ui.noApprox, SIGNAL(toggled(bool)),
-          ui.approx,   SLOT(setEnabled(bool)));
-
-  connect(ui.noFacetSizing, SIGNAL(toggled(bool)),
-          ui.facetSizing,   SLOT(setEnabled(bool)));
-
-  connect(ui.noAngle,    SIGNAL(toggled(bool)),
-          ui.facetAngle, SLOT(setEnabled(bool)));
-
-  connect(ui.noTetSizing, SIGNAL(toggled(bool)),
-          ui.tetSizing,   SLOT(setEnabled(bool)));
-
-  connect(ui.noTetShape, SIGNAL(toggled(bool)),
-          ui.tetShape,   SLOT(setEnabled(bool)));
-
-  // Set default parameters
-  CGAL::Three::Scene_interface::Bbox bbox = item->bbox();
-  ui.objectName->setText(item->name());
-  ui.objectNameSize->setText(tr("Object bbox size (w,h,d):  <b>%1</b>,  <b>%2</b>,  <b>%3</b>")
-                             .arg(bbox.width(),0,'g',3)
-                             .arg(bbox.height(),0,'g',3)
-                             .arg(bbox.depth(),0,'g',3) );
-
-  double diag = bbox.diagonal_length();
-  int decimals = 0;
-  double sizing_default = get_approximate(diag * 0.05, 2, decimals);
-  ui.facetSizing->setDecimals(-decimals+2);
-  ui.facetSizing->setSingleStep(std::pow(10.,decimals));
-  ui.facetSizing->setRange(diag * 10e-6, // min
-                           diag); // max
-  ui.facetSizing->setValue(sizing_default); // default value
-
-  ui.tetSizing->setDecimals(-decimals+2);
-  ui.tetSizing->setSingleStep(std::pow(10.,decimals));
-  ui.tetSizing->setRange(diag * 10e-6, // min
-                         diag); // max
-  ui.tetSizing->setValue(sizing_default); // default value
-
-  double approx_default = get_approximate(diag * 0.005, 2, decimals);
-  ui.approx->setDecimals(-decimals+2);
-  ui.approx->setSingleStep(std::pow(10.,decimals));
-  ui.approx->setRange(diag * 10e-7, // min
-                      diag); // max
-  ui.approx->setValue(approx_default);
-
-  ui.protect->setEnabled(features_protection_available);
-  if (!features_protection_available)
-    ui.protect->setChecked(false);
-
-  // -----------------------------------
-  // Get values
-  // -----------------------------------
-  int i = dialog.exec();
-  if( i == QDialog::Rejected ) { return; }
-
-  // 0 means parameter is not considered
-  const double angle = !ui.noAngle->isChecked() ? 0 : ui.facetAngle->value();
-  const double approx = !ui.noApprox->isChecked() ? 0 : ui.approx->value();
-  const double facet_sizing = !ui.noFacetSizing->isChecked() ? 0 : ui.facetSizing->value();
-  const double radius_edge = !ui.noTetShape->isChecked() ? 0 : ui.tetShape->value();
-  const double tet_sizing = !ui.noTetSizing->isChecked() ? 0  : ui.tetSizing->value();
-  const bool protect_features = ui.protect->isChecked();
-  const int manifold = ui.manifoldCheckBox->isChecked() ? 1 : 0;
-
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-
-  Meshing_thread* thread = NULL;
-
-  // Polyhedron
-  if ( NULL != poly_item )
-  {
-    Polyhedron* pMesh = poly_item->polyhedron();
-    if (NULL == pMesh)
-    {
-      QMessageBox::critical(mw, tr(""), tr("ERROR: no data in selected item"));
-      return;
-    }
-
-    Scene_polylines_item::Polylines_container plc;
-
-    thread =    cgal_code_mesh_3(pMesh,
-                                 (polylines_item == NULL)?plc:polylines_item->polylines,
-                                 item->name(),
-                                 angle,
-                                 facet_sizing,
-                                 approx,
-                                 tet_sizing,
-                                 radius_edge,
-                                 protect_features,
-                                 manifold,
-                                 scene);
-  }
-  // Image
-#ifdef CGAL_MESH_3_DEMO_ACTIVATE_IMPLICIT_FUNCTIONS
-  else if (NULL != function_item)
-  {
-    const Implicit_function_interface* pFunction = function_item->function();
-    if (NULL == pFunction)
-    {
-      QMessageBox::critical(mw, tr(""), tr("ERROR: no data in selected item"));
-      return;
-    }
-
-    thread =    cgal_code_mesh_3(pFunction,
-                                 angle,
-                                 facet_sizing,
-                                 approx,
-                                 tet_sizing,
-                                 radius_edge,
-                                 manifold,
-                                 scene);
-  }
-#endif
-#ifdef CGAL_MESH_3_DEMO_ACTIVATE_SEGMENTED_IMAGES
-  else if (NULL != image_item)
-  {
-    const Image* pImage = image_item->image();
-    if (NULL == pImage)
-    {
-      QMessageBox::critical(mw, tr(""), tr("ERROR: no data in selected item"));
-      return;
-    }
-
-    Scene_polylines_item::Polylines_container plc;
-
-    thread =    cgal_code_mesh_3(pImage,
-                                 (polylines_item == NULL)?plc:polylines_item->polylines,
-                                 angle,
-                                 facet_sizing,
-                                 approx,
-                                 tet_sizing,
-                                 radius_edge,
-                                 protect_features,
-                                 manifold,
-                                 scene);
-  }
-#endif
-
-  if ( NULL == thread )
-  {
-    QMessageBox::critical(mw,tr(""),tr("ERROR: no thread created"));
-    return;
-  }
-
-  // Launch thread
-  source_item_ = item;
-  launch_thread(thread);
-
-  QApplication::restoreOverrideCursor();
-}
-
-void
-Mesh_3_plugin::
-launch_thread(Meshing_thread* mesh_thread)
-{
-  // -----------------------------------
-  // Create message box with stop button
-  // -----------------------------------
-  message_box_ = new QMessageBox(QMessageBox::NoIcon,
-                                 "Meshing",
-                                 "Mesh generation in progress...",
-                                 QMessageBox::Cancel,
-                                 mw);
-
-  message_box_->setDefaultButton(QMessageBox::Cancel);
-  QAbstractButton* cancelButton = message_box_->button(QMessageBox::Cancel);
-  cancelButton->setText(tr("Stop"));
-
-  QObject::connect(cancelButton, SIGNAL(clicked()),
-                   mesh_thread,  SLOT(stop()));
-
-  message_box_->show();
-
-  // -----------------------------------
-  // Connect main thread to meshing thread
-  // -----------------------------------
-  QObject::connect(mesh_thread, SIGNAL(done(Meshing_thread*)),
-                   this,        SLOT(meshing_done(Meshing_thread*)));
-
-  QObject::connect(mesh_thread, SIGNAL(status_report(QString)),
-                   this,        SLOT(status_report(QString)));
-
-  // -----------------------------------
-  // Launch mesher
-  // -----------------------------------
-  mesh_thread->start();
-}
-
-
-void
-Mesh_3_plugin::
-status_report(QString str)
-{
-  if ( NULL == message_box_ ) { return; }
-
-  message_box_->setInformativeText(str);
-}
-
-
-void
-Mesh_3_plugin::
-meshing_done(Meshing_thread* thread)
-{
-  // Print message in console
-  QString str = QString("Meshing of \"%1\" done in %2s<br>")
-    .arg(source_item_->name())
-    .arg(thread->time());
-
-  Q_FOREACH( QString param, thread->parameters_log() )
-  {
-    str.append(QString("( %1 )<br>").arg(param));
-  }
-
-  Scene_c3t3_item* result_item = thread->item();
-  const Scene_item::Bbox& bbox = result_item->bbox();
-  str.append(QString("BBox (x,y,z): [ %1, %2 ], [ %3, %4 ], [ %5, %6 ], <br>")
-    .arg(bbox.xmin)
-    .arg(bbox.xmax)
-    .arg(bbox.ymin)
-    .arg(bbox.ymax)
-    .arg(bbox.zmin)
-    .arg(bbox.zmax));
-
-  msg->information(qPrintable(str));
-
-  // Treat new c3t3 item
-  treat_result(*source_item_, *result_item);
-
-  // close message box
-  message_box_->close();
-  message_box_ = NULL;
-
-  // free memory
-  // TODO: maybe there is another way to do that
-  delete thread;
-}
-
-
-void
-Mesh_3_plugin::
-treat_result(Scene_item& source_item,
-             Scene_c3t3_item& result_item) const
-{
-  result_item.setName(tr("%1 [3D Mesh]").arg(source_item.name()));
-
-  result_item.c3t3_changed();
-
-  const Scene_item::Bbox& bbox = result_item.bbox();
-  result_item.setPosition((bbox.xmin + bbox.xmax)/2.f,
-                          (bbox.ymin + bbox.ymax)/2.f,
-                          (bbox.zmin + bbox.zmax)/2.f);
-
-  result_item.setColor(default_mesh_color);
-  result_item.setRenderingMode(source_item.renderingMode());
-  result_item.set_data_item(&source_item);
-
-  source_item.setVisible(false);
-
-  const Scene_interface::Item_id index = scene->mainSelectionIndex();
-  scene->itemChanged(index);
-
-  Scene_interface::Item_id new_item_id = scene->addItem(&result_item);
-  scene->setSelectedItem(new_item_id);
-}
-
-#include "Mesh_3_plugin.moc"
-
-#endif // CGAL_POLYHEDRON_DEMO_USE_SURFACE_MESHER
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.cpp
deleted file mode 100644
index af1d873..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-#include "config_mesh_3.h"
-#include "Mesh_3_plugin_cgal_code.h"
-
-#include <CGAL/Mesh_3/polylines_to_protect.h>
-#include <CGAL/Bbox_3.h>
-
-#include <Polyhedron_type.h>
-#include <C3t3_type.h>
-
-#include <Scene_c3t3_item.h>
-
-#include "Mesh_function.h"
-#include "Facet_extra_criterion.h"
-
-#include <CGAL/Timer.h>
-using namespace CGAL::Three;
-
-typedef Tr::Point Point_3;
-
-Meshing_thread* cgal_code_mesh_3(const Polyhedron* pMesh,
-                                 const Polylines_container& polylines,
-                                 QString filename,
-                                 const double facet_angle,
-                                 const double facet_sizing,
-                                 const double facet_approx,
-                                 const double tet_sizing,
-                                 const double tet_shape,
-                                 bool protect_features,
-                                 const int manifold,
-                                 CGAL::Three::Scene_interface* scene)
-{
-  if(!pMesh) return 0;
-
-  std::cerr << "Meshing file \"" << qPrintable(filename) << "\"\n";
-  std::cerr << "  angle: " << facet_angle << std::endl
-            << "  facets size bound: " << facet_sizing << std::endl
-            << "  approximation bound: " << facet_approx << std::endl
-            << "  tetrahedra size bound: " << tet_sizing << std::endl;
-  std::cerr << "Build AABB tree...";
-  CGAL::Timer timer;
-  timer.start();
-  // Create domain
-  Polyhedral_mesh_domain* p_domain = new Polyhedral_mesh_domain(*pMesh);
-  if(polylines.empty() && protect_features) {
-      p_domain->detect_features();
-  }
-  if(! polylines.empty()){
-    p_domain->add_features(polylines.begin(), polylines.end());
-    protect_features = true; // so that it will be passed in make_mesh_3
-  }
-
-  std::cerr << "done (" << timer.time() << " ms)" << std::endl;
-
-  Scene_c3t3_item* p_new_item = new Scene_c3t3_item;
-  p_new_item->set_scene(scene);
-
-  Mesh_parameters param;
-  param.facet_angle = facet_angle;
-  param.facet_sizing = facet_sizing;
-  param.facet_approx = facet_approx;
-  param.tet_sizing = tet_sizing;
-  param.tet_shape = tet_shape;
-  param.manifold = manifold;
-  param.protect_features = protect_features;
-
-  typedef ::Mesh_function<Polyhedral_mesh_domain> Mesh_function;
-  Mesh_function* p_mesh_function = new Mesh_function(p_new_item->c3t3(),
-                                                     p_domain, param);
-  return new Meshing_thread(p_mesh_function, p_new_item);
-}
-
-#ifdef CGAL_MESH_3_DEMO_ACTIVATE_IMPLICIT_FUNCTIONS
-
-Meshing_thread* cgal_code_mesh_3(const Implicit_function_interface* pfunction,
-                                 const double facet_angle,
-                                 const double facet_sizing,
-                                 const double facet_approx,
-                                 const double tet_sizing,
-                                 const double tet_shape,
-                                 const int manifold,
-                                 CGAL::Three::Scene_interface* scene)
-{
-  if (pfunction == NULL) { return NULL; }
-
-  CGAL::Bbox_3 domain_bbox(pfunction->bbox().xmin,
-                           pfunction->bbox().ymin,
-                           pfunction->bbox().zmin,
-                           pfunction->bbox().xmax,
-                           pfunction->bbox().ymax,
-                           pfunction->bbox().zmax);
-
-  Function_mesh_domain* p_domain =
-    new Function_mesh_domain(Function_wrapper(*pfunction), domain_bbox, 1e-7);
-
-  Scene_c3t3_item* p_new_item = new Scene_c3t3_item;
-  p_new_item->set_scene(scene);
-
-  Mesh_parameters param;
-  param.protect_features = false;
-  param.facet_angle = facet_angle;
-  param.facet_sizing = facet_sizing;
-  param.facet_approx = facet_approx;
-  param.tet_sizing = tet_sizing;
-  param.tet_shape = tet_shape;
-  param.manifold = manifold;
-
-  typedef ::Mesh_function<Function_mesh_domain> Mesh_function;
-  Mesh_function* p_mesh_function = new Mesh_function(p_new_item->c3t3(),
-                                                     p_domain, param);
-  return new Meshing_thread(p_mesh_function, p_new_item);
-}
-#endif // CGAL_MESH_3_DEMO_ACTIVATE_IMPLICIT_FUNCTIONS
-
-
-#ifdef CGAL_MESH_3_DEMO_ACTIVATE_SEGMENTED_IMAGES
-
-Meshing_thread* cgal_code_mesh_3(const Image* pImage,
-                                 const Polylines_container& polylines,
-                                 const double facet_angle,
-                                 const double facet_sizing,
-                                 const double facet_approx,
-                                 const double tet_sizing,
-                                 const double tet_shape,
-                                 bool protect_features,
-                                 const int manifold,
-                                 CGAL::Three::Scene_interface* scene)
-{
-  if (NULL == pImage) { return NULL; }
-
-  Image_mesh_domain* p_domain = new Image_mesh_domain(*pImage, 1e-6);
-
-
-  if(protect_features && polylines.empty()){
-    std::vector<std::vector<Point_3> > polylines_on_bbox;
-    CGAL::polylines_to_protect<Point_3>(*pImage, polylines_on_bbox);
-    p_domain->add_features(polylines_on_bbox.begin(), polylines_on_bbox.end());
-  }
-  if(! polylines.empty()){
-    // Insert edge in domain
-    p_domain->add_features(polylines.begin(), polylines.end());
-    protect_features = true; // so that it will be passed in make_mesh_3
-  }
-  CGAL::Timer timer;
-  timer.start();
-  Scene_c3t3_item* p_new_item = new Scene_c3t3_item;
-  p_new_item->set_scene(scene);
-
-  Mesh_parameters param;
-  param.protect_features = protect_features;
-  param.facet_angle = facet_angle;
-  param.facet_sizing = facet_sizing;
-  param.facet_approx = facet_approx;
-  param.tet_sizing = tet_sizing;
-  param.tet_shape = tet_shape;
-  param.manifold = manifold;
-  
-  typedef ::Mesh_function<Image_mesh_domain> Mesh_function;
-  Mesh_function* p_mesh_function = new Mesh_function(p_new_item->c3t3(),
-                                                     p_domain, param);
-  return new Meshing_thread(p_mesh_function, p_new_item);
-}
-
-#endif //CGAL_MESH_3_DEMO_ACTIVATE_SEGMENTED_IMAGES
-
-
-//#include "Polyhedron_demo_mesh_3_plugin_cgal_code.moc"
-//#include "Scene_c3t3_item.moc" //Check this one, it's strange moc include.
-
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.h b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.h
deleted file mode 100644
index 6393596..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.h
+++ /dev/null
@@ -1,55 +0,0 @@
-#include "Polyhedron_type_fwd.h"
-#ifdef CGAL_MESH_3_DEMO_ACTIVATE_SEGMENTED_IMAGES
-#  include "Image_type_fwd.h"
-#endif
-#ifdef CGAL_MESH_3_DEMO_ACTIVATE_IMPLICIT_FUNCTIONS
-#  include "implicit_functions/Implicit_function_interface.h"
-#endif
-
-#include "Kernel_type.h"
-#include "Meshing_thread.h"
-
-struct Mesh_parameters;
-
-namespace CGAL { namespace Three {
-  class Scene_item;
-  class Scene_interface;
-}}
-
-typedef std::list<std::vector<CGAL::Exact_predicates_inexact_constructions_kernel::Point_3> > Polylines_container;
-
-Meshing_thread* cgal_code_mesh_3(const Polyhedron* pMesh,
-                                 const Polylines_container&,
-                                 QString filename,
-                                 const double angle,
-                                 const double facet_sizing,
-                                 const double approx,
-                                 const double tet_sizing,
-                                 const double tet_shape,
-                                 bool protect_features,
-                                 const int manifold,
-                                 CGAL::Three::Scene_interface* scene);
-
-#ifdef CGAL_MESH_3_DEMO_ACTIVATE_IMPLICIT_FUNCTIONS
-Meshing_thread* cgal_code_mesh_3(const Implicit_function_interface* pfunction,
-                                 const double facet_angle,
-                                 const double facet_sizing,
-                                 const double facet_approx,
-                                 const double tet_sizing,
-                                 const double tet_shape,
-                                 const int manifold,
-                                 CGAL::Three::Scene_interface* scene);
-#endif
-
-#ifdef CGAL_MESH_3_DEMO_ACTIVATE_SEGMENTED_IMAGES
-Meshing_thread* cgal_code_mesh_3(const CGAL::Image_3* pImage,
-                                 const Polylines_container& polylines,
-                                 const double facet_angle,
-                                 const double facet_sizing,
-                                 const double facet_approx,
-                                 const double tet_sizing,
-                                 const double tet_shape,
-                                 bool protect_features,
-                                 const int manifold,
-                                 CGAL::Three::Scene_interface* scene);
-#endif
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Mesh_function.h b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Mesh_function.h
deleted file mode 100644
index 708f028..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Mesh_function.h
+++ /dev/null
@@ -1,274 +0,0 @@
-// Copyright (c) 2010 INRIA Sophia-Antipolis (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
-// 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(s)     : Stephane Tayeb
-//
-//******************************************************************************
-// File Description : 
-//******************************************************************************
-
-#ifndef CGAL_DEMO_MESH_3_MESH_FUNCTION_H
-#define CGAL_DEMO_MESH_3_MESH_FUNCTION_H
-
-#define CGAL_MESH_3_MESHER_STATUS_ACTIVATED 1
-
-#include <CGAL/Mesh_3/Concurrent_mesher_config.h>
-
-#include <QStringList>
-#include <QString>
-
-#include <CGAL/Mesh_3/Mesher_3.h>
-#include <CGAL/Mesh_criteria_3.h>
-#include <CGAL/Mesh_3/Protect_edges_sizing_field.h>
-
-#include "C3t3_type.h"
-#include "Meshing_thread.h"
-#include <CGAL/make_mesh_3.h> // for C3t3_initializer
-#include <CGAL/use.h>
-
-struct Mesh_parameters
-{
-  double facet_angle;
-  double facet_sizing;
-  double facet_approx;
-  
-  double tet_shape;
-  double tet_sizing;
-  bool protect_features;
-  int manifold;
-  
-  inline QStringList log() const;
-};
-
-
-template < typename Domain_ >
-class Mesh_function
-  : public Mesh_function_interface
-{
-  typedef Domain_ Domain;
-  
-public:
-  Mesh_function(C3t3& c3t3, Domain* domain, const Mesh_parameters& p);
-  
-  ~Mesh_function();
-  
-  // Launch
-  virtual void launch();
-  
-  // Stop
-  virtual void stop();
-  
-  // Logs
-  virtual QStringList parameters_log() const;
-  virtual QString status(double time_period) const;
-
-private:
-  typedef typename Domain::Point_3                  Point_3;
-  typedef typename Domain::Index                    Index;
-  typedef std::vector<std::pair<Point_3, Index> >   Initial_points_vector;
-  typedef typename Initial_points_vector::iterator  Ipv_iterator;
-  typedef C3t3::Vertex_handle                       Vertex_handle;
-  
-  typedef C3t3::Triangulation                       Tr;
-  typedef CGAL::Mesh_criteria_3<Tr>                 Mesh_criteria;
-  typedef Mesh_criteria::Edge_criteria              Edge_criteria;
-  typedef Mesh_criteria::Facet_criteria             Facet_criteria;
-  typedef Mesh_criteria::Cell_criteria              Cell_criteria;
-  
-  typedef CGAL::Mesh_3::Mesher_3<C3t3, Mesh_criteria, Domain>   Mesher;
-  
-private:
-  C3t3& c3t3_;
-  Domain* domain_;
-  Mesh_parameters p_;
-  bool continue_;
-  Mesher* mesher_;
-#ifdef CGAL_MESH_3_MESHER_STATUS_ACTIVATED
-  mutable typename Mesher::Mesher_status last_report_;
-#endif
-};
-
-
-
-// -----------------------------------
-// Class Mesh_parameters
-// -----------------------------------
-inline
-QStringList
-Mesh_parameters::
-log() const
-{
-  return QStringList()
-  << QString("facet min angle: %1").arg(facet_angle)
-  << QString("facet max size: %1").arg(facet_sizing)
-  << QString("facet approx error: %1").arg(facet_approx)
-  << QString("tet shape (radius-edge): %1").arg(tet_shape)
-  << QString("tet max size: %1").arg(tet_sizing)
-  << QString("protect features: %1").arg(protect_features);
-}
-
-
-// -----------------------------------
-// Class Mesh_function
-// -----------------------------------
-template < typename D_ >
-Mesh_function<D_>::
-Mesh_function(C3t3& c3t3, Domain* domain, const Mesh_parameters& p)
-: c3t3_(c3t3)
-, domain_(domain)
-, p_(p)
-, continue_(true)
-, mesher_(NULL)
-#ifdef CGAL_MESH_3_MESHER_STATUS_ACTIVATED
-, last_report_(0,0,0)
-#endif
-{
-#ifdef CGAL_CONCURRENT_MESH_3
-  Concurrent_mesher_config::load_config_file(CONFIG_FILENAME, false);
-#endif
-}
-
-
-template < typename D_ >
-Mesh_function<D_>::
-~Mesh_function()
-{
-  delete domain_;
-  delete mesher_;
-}
-
-
-CGAL::Mesh_facet_topology topology(int manifold) {
-  return manifold == 0 ? CGAL::FACET_VERTICES_ON_SURFACE :
-    static_cast<CGAL::Mesh_facet_topology>
-    (CGAL::MANIFOLD |
-     CGAL::FACET_VERTICES_ON_SAME_SURFACE_PATCH);
-}
-
-template < typename D_ >
-void
-Mesh_function<D_>::
-launch()
-{
-#ifdef CGAL_MESH_3_INITIAL_POINTS_NO_RANDOM_SHOOTING
-  CGAL::default_random = CGAL::Random(0);
-#endif
-
-  // Create mesh criteria
-  Mesh_criteria criteria(Edge_criteria(p_.facet_sizing),
-                         Facet_criteria(p_.facet_angle,
-                                        p_.facet_sizing,
-                                        p_.facet_approx,
-                                        topology(p_.manifold)),
-                         Cell_criteria(p_.tet_shape,
-                                       p_.tet_sizing));
-
-  // Initialization of the mesh, either with the protection of sharp
-  // features, or with the initial points (or both).
-  CGAL::internal::Mesh_3::C3t3_initializer<
-    C3t3,
-    Domain,
-    Mesh_criteria,
-    CGAL::internal::Mesh_3::has_Has_features<Domain>::value >()
-    (c3t3_,
-     *domain_,
-     criteria,
-     p_.protect_features);
-
-  // Build mesher and launch refinement process
-  mesher_ = new Mesher(c3t3_, *domain_, criteria);
-
-#ifdef CGAL_MESH_3_PROFILING
-  CGAL::Real_timer t;
-  t.start();
-#endif
-
-#if CGAL_MESH_3_MESHER_STATUS_ACTIVATED
-  mesher_->initialize();
-  while ( ! mesher_->is_algorithm_done() && continue_ )
-  {
-    mesher_->one_step();
-  }
-#else // not CGAL_MESH_3_MESHER_STATUS_ACTIVATED
-  mesher_->refine_mesh();
-#endif
-
-#ifdef CGAL_MESH_3_PROFILING
-  std::cerr << "Full refinement time (without fix_c3t3): " << t.time() << " seconds." << std::endl;
-#endif
-
-  // Ensure c3t3 is ok (usefull if process has been stop by the user)
-  mesher_->fix_c3t3();
-}
-
-
-template < typename D_ >
-void
-Mesh_function<D_>::
-stop()
-{
-  continue_ = false;
-}
-
-
-template < typename D_ >
-QStringList
-Mesh_function<D_>::
-parameters_log() const
-{
-  return p_.log();
-}
-
-
-template < typename D_ >
-QString
-Mesh_function<D_>::
-status(double time_period) const
-{
-  QString result;
-
-  CGAL_USE(time_period); // to avoid a warning when the macro
-                         // CGAL_MESH_3_MESHER_STATUS_ACTIVATED is not
-                         // defined
-#ifdef CGAL_MESH_3_MESHER_STATUS_ACTIVATED
-  // If mesher_ is not yet created, it means that either launch() has not
-  // been called or that initial points have not been founded
-  if ( NULL == mesher_ )
-  {
-    return QString("Initialization in progress...");
-  }
-  
-  // Get status and return a string corresponding to it
-  typename Mesher::Mesher_status s = mesher_->status();
-  
-  result = QString("Vertices: %1 \n"
-                           "Vertices inserted last %2s: %3 \n\n"
-                           "Bad facets: %4 \n"
-                           "Bad cells: %5")
-    .arg(s.vertices)
-    .arg(time_period)
-    .arg(s.vertices - last_report_.vertices)
-    .arg(s.facet_queue)
-    .arg(s.cells_queue);
-  
-  last_report_ = s;
-#endif
-  return result;
-}
-
-#endif // CGAL_DEMO_MESH_3_MESH_FUNCTION_H
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Meshing_dialog.ui b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Meshing_dialog.ui
deleted file mode 100644
index 965a4eb..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Meshing_dialog.ui
+++ /dev/null
@@ -1,440 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>Meshing_dialog</class>
- <widget class="QDialog" name="Meshing_dialog">
-  <property name="enabled">
-   <bool>true</bool>
-  </property>
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>473</width>
-    <height>482</height>
-   </rect>
-  </property>
-  <property name="sizePolicy">
-   <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
-    <horstretch>0</horstretch>
-    <verstretch>0</verstretch>
-   </sizepolicy>
-  </property>
-  <property name="windowTitle">
-   <string>Meshing criteria</string>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout">
-   <property name="sizeConstraint">
-    <enum>QLayout::SetFixedSize</enum>
-   </property>
-   <item>
-    <widget class="QLabel" name="objectName">
-     <property name="font">
-      <font>
-       <pointsize>15</pointsize>
-       <weight>75</weight>
-       <bold>true</bold>
-      </font>
-     </property>
-     <property name="text">
-      <string>NO OBJECT</string>
-     </property>
-    </widget>
-   </item>
-   <item>
-    <widget class="QLabel" name="objectNameSize">
-     <property name="text">
-      <string>No size</string>
-     </property>
-    </widget>
-   </item>
-   <item>
-    <widget class="QGroupBox" name="sharpFeaturesGroup">
-     <property name="layoutDirection">
-      <enum>Qt::LeftToRight</enum>
-     </property>
-     <property name="title">
-      <string>Sharp features</string>
-     </property>
-     <layout class="QGridLayout" name="gridLayout" columnstretch="2">
-      <item row="0" column="0">
-       <widget class="QCheckBox" name="protect">
-        <property name="layoutDirection">
-         <enum>Qt::RightToLeft</enum>
-        </property>
-        <property name="text">
-         <string>&Protect sharp edges</string>
-        </property>
-        <property name="checked">
-         <bool>true</bool>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item>
-    <widget class="QGroupBox" name="groupBox">
-     <property name="title">
-      <string>Surface</string>
-     </property>
-     <layout class="QGridLayout" name="gridLayout_2" rowstretch="0,0,0,0,0,0,0,0,0" columnstretch="2,0,0">
-      <item row="4" column="0">
-       <widget class="QCheckBox" name="checkBox">
-        <property name="text">
-         <string>See advanced &controls...</string>
-        </property>
-       </widget>
-      </item>
-      <item row="2" column="1">
-       <widget class="QDoubleSpinBox" name="facetSizing">
-        <property name="minimumSize">
-         <size>
-          <width>110</width>
-          <height>0</height>
-         </size>
-        </property>
-        <property name="decimals">
-         <number>4</number>
-        </property>
-       </widget>
-      </item>
-      <item row="3" column="0">
-       <widget class="QLabel" name="angleLabel">
-        <property name="text">
-         <string>Facet min. &angle (deg)</string>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-        </property>
-        <property name="buddy">
-         <cstring>facetAngle</cstring>
-        </property>
-       </widget>
-      </item>
-      <item row="3" column="2">
-       <widget class="QCheckBox" name="noAngle">
-        <property name="toolTip">
-         <string>Enable/Disable parameter</string>
-        </property>
-        <property name="text">
-         <string/>
-        </property>
-        <property name="checked">
-         <bool>true</bool>
-        </property>
-       </widget>
-      </item>
-      <item row="1" column="0">
-       <widget class="QLabel" name="approxLabel">
-        <property name="text">
-         <string>Approximation &error</string>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-        </property>
-        <property name="buddy">
-         <cstring>approx</cstring>
-        </property>
-       </widget>
-      </item>
-      <item row="2" column="0">
-       <widget class="QLabel" name="sizingLabel">
-        <property name="text">
-         <string>&Facet max. size</string>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-        </property>
-        <property name="buddy">
-         <cstring>facetSizing</cstring>
-        </property>
-       </widget>
-      </item>
-      <item row="1" column="1">
-       <widget class="QDoubleSpinBox" name="approx">
-        <property name="minimumSize">
-         <size>
-          <width>110</width>
-          <height>0</height>
-         </size>
-        </property>
-       </widget>
-      </item>
-      <item row="2" column="2">
-       <widget class="QCheckBox" name="noFacetSizing">
-        <property name="toolTip">
-         <string>Enable/Disable parameter</string>
-        </property>
-        <property name="text">
-         <string/>
-        </property>
-        <property name="checked">
-         <bool>true</bool>
-        </property>
-       </widget>
-      </item>
-      <item row="3" column="1">
-       <widget class="QDoubleSpinBox" name="facetAngle">
-        <property name="minimumSize">
-         <size>
-          <width>110</width>
-          <height>0</height>
-         </size>
-        </property>
-        <property name="minimum">
-         <double>1.000000000000000</double>
-        </property>
-        <property name="maximum">
-         <double>30.000000000000000</double>
-        </property>
-        <property name="value">
-         <double>25.000000000000000</double>
-        </property>
-       </widget>
-      </item>
-      <item row="1" column="2">
-       <widget class="QCheckBox" name="noApprox">
-        <property name="toolTip">
-         <string>Enable/Disable parameter</string>
-        </property>
-        <property name="text">
-         <string/>
-        </property>
-        <property name="checked">
-         <bool>true</bool>
-        </property>
-       </widget>
-      </item>
-      <item row="8" column="0" colspan="3">
-       <widget class="QFrame" name="advanced">
-        <property name="visible">
-         <bool>false</bool>
-        </property>
-        <property name="frameShape">
-         <enum>QFrame::StyledPanel</enum>
-        </property>
-        <property name="frameShadow">
-         <enum>QFrame::Plain</enum>
-        </property>
-        <layout class="QVBoxLayout" name="advancedLayout">
-         <item>
-          <widget class="QLabel" name="manifoldLabel">
-           <property name="sizePolicy">
-            <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
-             <horstretch>0</horstretch>
-             <verstretch>0</verstretch>
-            </sizepolicy>
-           </property>
-           <property name="text">
-            <string>The following option forces the meshing engine to produce a 3D mesh with a manifold boundary. That may lead to an infinite loop if the input domain has a non-manifold 2D component.</string>
-           </property>
-           <property name="wordWrap">
-            <bool>true</bool>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QCheckBox" name="manifoldCheckBox">
-           <property name="layoutDirection">
-            <enum>Qt::RightToLeft</enum>
-           </property>
-           <property name="text">
-            <string>&manifold</string>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item>
-    <widget class="QGroupBox" name="groupBox_2">
-     <property name="title">
-      <string>Volume</string>
-     </property>
-     <layout class="QGridLayout" name="gridLayout_3" columnstretch="2,1,0">
-      <item row="0" column="0">
-       <widget class="QLabel" name="label">
-        <property name="text">
-         <string>&Tetrahedron max. size</string>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-        </property>
-        <property name="buddy">
-         <cstring>tetSizing</cstring>
-        </property>
-       </widget>
-      </item>
-      <item row="0" column="1">
-       <widget class="QDoubleSpinBox" name="tetSizing">
-        <property name="minimumSize">
-         <size>
-          <width>110</width>
-          <height>0</height>
-         </size>
-        </property>
-        <property name="decimals">
-         <number>4</number>
-        </property>
-       </widget>
-      </item>
-      <item row="1" column="0">
-       <widget class="QLabel" name="label_2">
-        <property name="text">
-         <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
-<html><head><meta name="qrichtext" content="1" /><style type="text/css">
-p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;">
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Lucida Grande';">Tetrahedron &amp;shape</span><span style=" font-family:'Lucida Grande'; font-size:13pt;"> </span><span style=" font-family:'Lucida Grande'; font-style:italic;">(radius-edge ratio)</span></p></body></html></string>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-        </property>
-        <property name="buddy">
-         <cstring>tetShape</cstring>
-        </property>
-       </widget>
-      </item>
-      <item row="1" column="1">
-       <widget class="QDoubleSpinBox" name="tetShape">
-        <property name="minimumSize">
-         <size>
-          <width>110</width>
-          <height>0</height>
-         </size>
-        </property>
-        <property name="minimum">
-         <double>1.000000000000000</double>
-        </property>
-        <property name="value">
-         <double>3.000000000000000</double>
-        </property>
-       </widget>
-      </item>
-      <item row="1" column="2">
-       <widget class="QCheckBox" name="noTetShape">
-        <property name="toolTip">
-         <string>Enable/Disable parameter</string>
-        </property>
-        <property name="text">
-         <string/>
-        </property>
-        <property name="checked">
-         <bool>true</bool>
-        </property>
-       </widget>
-      </item>
-      <item row="0" column="2">
-       <widget class="QCheckBox" name="noTetSizing">
-        <property name="toolTip">
-         <string>Enable/Disable parameter</string>
-        </property>
-        <property name="text">
-         <string/>
-        </property>
-        <property name="checked">
-         <bool>true</bool>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item>
-    <spacer name="verticalSpacer">
-     <property name="orientation">
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeType">
-      <enum>QSizePolicy::MinimumExpanding</enum>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>20</width>
-       <height>0</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
-   <item>
-    <widget class="QDialogButtonBox" name="buttonBox">
-     <property name="orientation">
-      <enum>Qt::Horizontal</enum>
-     </property>
-     <property name="standardButtons">
-      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
-     </property>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <tabstops>
-  <tabstop>protect</tabstop>
-  <tabstop>approx</tabstop>
-  <tabstop>noApprox</tabstop>
-  <tabstop>facetSizing</tabstop>
-  <tabstop>noFacetSizing</tabstop>
-  <tabstop>facetAngle</tabstop>
-  <tabstop>noAngle</tabstop>
-  <tabstop>tetSizing</tabstop>
-  <tabstop>noTetSizing</tabstop>
-  <tabstop>tetShape</tabstop>
-  <tabstop>noTetShape</tabstop>
-  <tabstop>checkBox</tabstop>
-  <tabstop>manifoldCheckBox</tabstop>
- </tabstops>
- <resources/>
- <connections>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>accepted()</signal>
-   <receiver>Meshing_dialog</receiver>
-   <slot>accept()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>397</x>
-     <y>544</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>157</x>
-     <y>195</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>rejected()</signal>
-   <receiver>Meshing_dialog</receiver>
-   <slot>reject()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>397</x>
-     <y>544</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>286</x>
-     <y>195</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>checkBox</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>advanced</receiver>
-   <slot>setVisible(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>69</x>
-     <y>283</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>72</x>
-     <y>297</y>
-    </hint>
-   </hints>
-  </connection>
- </connections>
-</ui>
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Optimization_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Optimization_plugin.cpp
deleted file mode 100644
index efff242..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Optimization_plugin.cpp
+++ /dev/null
@@ -1,630 +0,0 @@
-#include <boost/config.hpp>
-#if defined(BOOST_MSVC)
-#  pragma warning( disable : 4503)
-#endif
-
-#include "config.h"
-#include "config_mesh_3.h"
-
-#ifdef CGAL_POLYHEDRON_DEMO_USE_SURFACE_MESHER
-
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-
-#include "Messages_interface.h"
-#include "ui_Smoother_dialog.h"
-#include "ui_Local_optimizers_dialog.h"
-
-#include "Scene_c3t3_item.h"
-#include "C3t3_type.h"
-
-#include "Optimizer_thread.h"
-
-#include <QObject>
-#include <QAction>
-#include <QMainWindow>
-#include <QApplication>
-#include <QtPlugin>
-#include <QInputDialog>
-#include <QFileDialog>
-#include <QMessageBox>
-#include <QTimer>
-
-#include <iostream>
-#include <fstream>
-
-#include <CGAL/Mesh_optimization_return_code.h>
-#include <CGAL/Mesh_3/parameters_defaults.h> // to get default values
-
-// declare the CGAL function
-#ifndef CGAL_MESH_3_DEMO_DISABLE_ODT
-Optimizer_thread* cgal_code_odt_mesh_3(Scene_c3t3_item& c3t3_item,
-                                       const double time_limit,
-                                       const double convergence_ratio,
-                                       const double freeze_ratio,
-                                       const int max_iteration_number,
-                                       const bool create_new_item);
-#endif
-
-#ifndef CGAL_MESH_3_DEMO_DISABLE_LLOYD
-Optimizer_thread* cgal_code_lloyd_mesh_3(Scene_c3t3_item& c3t3_item,
-                                         const double time_limit,
-                                         const double convergence_ratio,
-                                         const double freeze_ratio,
-                                         const int max_iteration_number,
-                                         const bool create_new_item);
-#endif
-
-#ifndef CGAL_MESH_3_DEMO_DISABLE_PERTURBER
-Optimizer_thread* cgal_code_perturb_mesh_3(Scene_c3t3_item& c3t3_item,
-                                           const double time_limit,
-                                           const double sliver_bound,
-                                           const bool create_new_item);
-#endif
-
-#ifndef CGAL_MESH_3_DEMO_DISABLE_EXUDER
-Optimizer_thread* cgal_code_exude_mesh_3(Scene_c3t3_item& c3t3_item,
-                                         const double time_limit,
-                                         const double sliver_bound,
-                                         const bool create_new_item);
-#endif
-
-QString translate(CGAL::Mesh_optimization_return_code rc);
-
-
-// Mesh_3_optimization_plugin class
-using namespace CGAL::Three;
-class Mesh_3_optimization_plugin :
-  public QObject,
-  protected Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-  typedef Polyhedron_demo_plugin_helper Base;
-public:
-  Mesh_3_optimization_plugin();
-  
-  using Base::init;
-  virtual void init(QMainWindow*, Scene_interface*, Messages_interface*);
-  inline virtual QList<QAction*> actions() const;
-  
-  bool applicable(QAction*) const {
-    return qobject_cast<Scene_c3t3_item*>(scene->item(scene->mainSelectionIndex()));
-  }
-
-public Q_SLOTS:
-#ifndef CGAL_MESH_3_DEMO_DISABLE_ODT
-  void odt();
-#endif
-#ifndef CGAL_MESH_3_DEMO_DISABLE_LLOYD
-  void lloyd();
-#endif
-#ifndef CGAL_MESH_3_DEMO_DISABLE_PERTURBER
-  void perturb();
-#endif
-#ifndef CGAL_MESH_3_DEMO_DISABLE_EXUDER
-  void exude();
-#endif
-  
-  void optimization_done(Optimizer_thread* t);
-  void status_report(QString s);
-  
-private:
-  Scene_c3t3_item* get_c3t3_item() const;
-  
-  void treat_result(Scene_c3t3_item& source_item, Scene_c3t3_item& result_item,
-                    const QString& name) const;
-  
-  void launch_thread(Optimizer_thread* thread, const QString& msg);
-
-private:
-  QAction* actionOdt;
-  QAction* actionLloyd;
-  QAction* actionPerturb;
-  QAction* actionExude;
-  Messages_interface* msg;
-  QMessageBox* message_box_;
-  
-  Scene_c3t3_item* source_item_;
-}; // end class Mesh_3_optimization_plugin
-
-Mesh_3_optimization_plugin::
-Mesh_3_optimization_plugin()
-  : actionOdt(NULL)
-  , actionLloyd(NULL)
-  , actionPerturb(NULL)
-  , actionExude(NULL)
-  , msg(NULL)
-  , message_box_(NULL)
-  , source_item_(NULL)
-{
-}
-
-void 
-Mesh_3_optimization_plugin::
-init(QMainWindow* mainWindow,
-     Scene_interface* scene_interface,
-     Messages_interface* msg_interface)
-{
-  this->scene = scene_interface;
-  this->mw = mainWindow;
-  
-  // Create menu items
-#ifndef CGAL_MESH_3_DEMO_DISABLE_ODT
-  actionOdt = new QAction(tr("odt_optimize_mesh_3"), mw);
-  if( NULL != actionOdt )
-  {
-    actionOdt->setProperty("subMenuName", "Tetrahedral Mesh Generation");
-    connect(actionOdt, SIGNAL(triggered()), this, SLOT(odt()));
-  }
-#endif
-  
-#ifndef CGAL_MESH_3_DEMO_DISABLE_LLOYD
-  actionLloyd = new QAction(tr("lloyd_optimize_mesh_3"), mw);
-  if( NULL != actionLloyd )
-  {
-    actionLloyd->setProperty("subMenuName", "Tetrahedral Mesh Generation");
-    connect(actionLloyd, SIGNAL(triggered()), this, SLOT(lloyd()));
-  }
-#endif
-  
-#ifndef CGAL_MESH_3_DEMO_DISABLE_PERTURBER
-  actionPerturb = new QAction(tr("perturb_mesh_3"), mw);
-  if( NULL != actionPerturb )
-  {
-    actionPerturb->setProperty("subMenuName", "Tetrahedral Mesh Generation");
-    connect(actionPerturb, SIGNAL(triggered()), this, SLOT(perturb()));
-  }
-#endif
-  
-#ifndef CGAL_MESH_3_DEMO_DISABLE_EXUDER
-  actionExude =new QAction(tr("exude_mesh_3"), mw);
-  if( NULL != actionExude )
-  {
-    actionExude->setProperty("subMenuName", "Tetrahedral Mesh Generation");
-    connect(actionExude, SIGNAL(triggered()), this, SLOT(exude()));
-  }
-#endif
-  
-  msg = msg_interface;
-}
-
-
-inline
-QList<QAction*> 
-Mesh_3_optimization_plugin::actions() const
-{
-  return QList<QAction*>() << actionOdt << actionLloyd 
-                           << actionPerturb << actionExude;
-}
-
-
-#ifndef CGAL_MESH_3_DEMO_DISABLE_ODT
-void
-Mesh_3_optimization_plugin::odt()
-{
-  // -----------------------------------
-  // Get c3t3 item
-  // -----------------------------------
-  Scene_c3t3_item* item = get_c3t3_item();
-  if ( NULL == item ) { return; }
-
-  // -----------------------------------
-  // Dialog box
-  // -----------------------------------
-  QDialog dialog(mw);
-  Ui::Smoother_dialog ui;
-  ui.setupUi(&dialog);
-  dialog.setWindowTitle(tr("Odt-smoothing parameters"));
-  
-  connect(ui.buttonBox, SIGNAL(accepted()),
-          &dialog, SLOT(accept()));
-  connect(ui.buttonBox, SIGNAL(rejected()),
-          &dialog, SLOT(reject()));
-  
-  connect(ui.noTimeLimit, SIGNAL(toggled(bool)),
-          ui.maxTime,     SLOT(setDisabled(bool)));
-  
-  ui.objectName->setText(item->name());
-
-  namespace cgpd = CGAL::parameters::default_values;
-  ui.convergenceRatio->setValue(cgpd::odt_convergence_ratio);
-  ui.freezeRatio->setValue(cgpd::odt_freeze_ratio);
-  
-  int i = dialog.exec();
-  if(i == QDialog::Rejected)
-    return;
-    
-  // 0 means parameter is not considered
-  const double max_time = ui.noTimeLimit->isChecked() ? 0 : ui.maxTime->value();
-  const int max_iteration_nb = static_cast<int>(ui.maxIterationNb->value());
-  const double convergence = ui.convergenceRatio->value();
-  const double freeze = ui.freezeRatio->value();
-  const bool create_new_item = ui.createNewItem->isChecked();
-  
-  // -----------------------------------
-  // Launch optimization
-  // -----------------------------------
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-  
-  Optimizer_thread* opt_thread = cgal_code_odt_mesh_3(*item,
-                                                      max_time,
-                                                      convergence,
-                                                      freeze,
-                                                      max_iteration_nb,
-                                                      create_new_item);
-  
-  if ( NULL == opt_thread )
-  {
-    QApplication::restoreOverrideCursor();
-    return;
-  }
-  
-  source_item_ = item;
-  launch_thread(opt_thread, "Odt iterations are running...");
-  QApplication::restoreOverrideCursor();
-}
-#endif
-
-
-#ifndef CGAL_MESH_3_DEMO_DISABLE_LLOYD
-void
-Mesh_3_optimization_plugin::lloyd()
-{
-  // -----------------------------------
-  // Get c3t3 item
-  // -----------------------------------
-  Scene_c3t3_item* item = get_c3t3_item();
-  if ( NULL == item ) { return; }
-  // -----------------------------------
-  // Dialog box
-  // -----------------------------------
-  QDialog dialog(mw);
-  Ui::Smoother_dialog ui;
-  ui.setupUi(&dialog);
-  dialog.setWindowTitle(tr("Lloyd-smoothing parameters"));
-  
-  connect(ui.buttonBox, SIGNAL(accepted()),
-          &dialog, SLOT(accept()));
-  connect(ui.buttonBox, SIGNAL(rejected()),
-          &dialog, SLOT(reject()));
-  
-  connect(ui.noTimeLimit, SIGNAL(toggled(bool)),
-          ui.maxTime,     SLOT(setDisabled(bool)));
-  
-  ui.objectName->setText(item->name());
-  
-  namespace cgpd = CGAL::parameters::default_values;
-  ui.convergenceRatio->setValue(cgpd::lloyd_convergence_ratio);
-  ui.freezeRatio->setValue(cgpd::lloyd_freeze_ratio);
-  
-  int i = dialog.exec();
-  if(i == QDialog::Rejected)
-    return;
-  
-  // 0 means parameter is not considered
-  const double max_time = ui.noTimeLimit->isChecked() ? 0 : ui.maxTime->value();
-  const int max_iteration_nb = static_cast<int>(ui.maxIterationNb->value());
-  const double convergence = ui.convergenceRatio->value();
-  const double freeze = ui.freezeRatio->value();
-  const bool create_new_item = ui.createNewItem->isChecked();
-
-  // -----------------------------------
-  // Launch optimization
-  // -----------------------------------
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-  
-  Optimizer_thread* opt_thread = cgal_code_lloyd_mesh_3(*item,
-                                                        max_time,
-                                                        convergence,
-                                                        freeze,
-                                                        max_iteration_nb,
-                                                        create_new_item);
-  if ( NULL == opt_thread )
-  {
-    QApplication::restoreOverrideCursor();
-    return;
-  }
-  source_item_ = item;
-  launch_thread(opt_thread, "Lloyd iterations are running...");
-  QApplication::restoreOverrideCursor();
-}
-#endif
-
-
-#ifndef CGAL_MESH_3_DEMO_DISABLE_PERTURBER
-void
-Mesh_3_optimization_plugin::perturb()
-{
-  // -----------------------------------
-  // Get c3t3 item
-  // -----------------------------------
-  Scene_c3t3_item* item = get_c3t3_item();
-  if ( NULL == item ) { return; }
-  
-  // -----------------------------------
-  // Dialog box
-  // -----------------------------------
-  QDialog dialog(mw);
-  Ui::LocalOptim_dialog ui;
-  ui.setupUi(&dialog);
-  dialog.setWindowTitle(tr("Sliver perturbation parameters"));
-  
-  connect(ui.buttonBox, SIGNAL(accepted()),
-          &dialog, SLOT(accept()));
-  connect(ui.buttonBox, SIGNAL(rejected()),
-          &dialog, SLOT(reject()));
-  
-  connect(ui.noTimeLimit, SIGNAL(toggled(bool)),
-          ui.maxTime,     SLOT(setDisabled(bool)));
-  
-  connect(ui.noBound,     SIGNAL(toggled(bool)),
-          ui.sliverBound, SLOT(setDisabled(bool)));
-  
-  ui.objectName->setText(item->name());
-  
-  int i = dialog.exec();
-  if(i == QDialog::Rejected)
-    return;
-  
-  // 0 means parameter is not considered
-  const double max_time = ui.noTimeLimit->isChecked() ? 0 : ui.maxTime->value();
-  const double sliver_bound = ui.noBound->isChecked() ? 0 : ui.sliverBound->value();
-  const bool create_new_item = ui.createNewItem->isChecked();
-  
-  // -----------------------------------
-  // Launch optimization
-  // -----------------------------------
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-  
-  Optimizer_thread* opt_thread = cgal_code_perturb_mesh_3(*item,
-                                                          max_time,
-                                                          sliver_bound,
-                                                          create_new_item);
-  
-
-  if ( NULL == opt_thread )
-  {
-    QApplication::restoreOverrideCursor();
-    return;
-  }
-  
-  source_item_ = item;
-  launch_thread(opt_thread, "Sliver perturbation is running...");
-  QApplication::restoreOverrideCursor();
-}
-#endif
-
-
-#ifndef CGAL_MESH_3_DEMO_DISABLE_EXUDER
-void
-Mesh_3_optimization_plugin::exude()
-{
-  // -----------------------------------
-  // Get c3t3 item
-  // -----------------------------------
-  Scene_c3t3_item* item = get_c3t3_item();
-  if ( NULL == item ) { return; }
-  
-  // -----------------------------------
-  // Dialog box
-  // -----------------------------------
-  QDialog dialog(mw);
-  Ui::LocalOptim_dialog ui;
-  ui.setupUi(&dialog);
-  dialog.setWindowTitle(tr("Sliver exudation parameters"));
-  
-  connect(ui.buttonBox, SIGNAL(accepted()),
-          &dialog, SLOT(accept()));
-  connect(ui.buttonBox, SIGNAL(rejected()),
-          &dialog, SLOT(reject()));
-  
-  connect(ui.noTimeLimit, SIGNAL(toggled(bool)),
-          ui.maxTime,     SLOT(setDisabled(bool)));
-  
-  connect(ui.noBound,     SIGNAL(toggled(bool)),
-          ui.sliverBound, SLOT(setDisabled(bool)));
-  
-  ui.objectName->setText(item->name());
-  ui.sliverBound->setValue(25.);
-  
-  int i = dialog.exec();
-  if(i == QDialog::Rejected)
-    return;
-  
-  // 0 means parameter is not considered
-  const double max_time = ui.noTimeLimit->isChecked() ? 0 : ui.maxTime->value();
-  const double sliver_bound = ui.noBound->isChecked() ? 0 : ui.sliverBound->value();
-  const bool create_new_item = ui.createNewItem->isChecked();
-  
-  // -----------------------------------
-  // Launch optimization
-  // -----------------------------------
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-  
-  Optimizer_thread* opt_thread = cgal_code_exude_mesh_3(*item,
-                                                        max_time,
-                                                        sliver_bound,
-                                                        create_new_item);
-
-  if ( NULL == opt_thread )
-  {
-    QApplication::restoreOverrideCursor();
-    return;
-  }
-  
-  source_item_ = item;
-  launch_thread(opt_thread, "Sliver exudation is running...");
-  QApplication::restoreOverrideCursor();
-}
-#endif
-
-
-Scene_c3t3_item*
-Mesh_3_optimization_plugin::
-get_c3t3_item() const
-{
-  const Scene_interface::Item_id index = scene->mainSelectionIndex();
-  Scene_c3t3_item* item = qobject_cast<Scene_c3t3_item*>(scene->item(index));
-
-  if ( NULL == item )
-  {
-    QMessageBox::warning(mw,tr(""),
-                          tr("Selected object is not a mesh... optimization can't be performed"));
-    return NULL;
-  }
-  
-  if ( NULL == item->data_item() )
-  {
-    QMessageBox::critical(mw,tr(""),
-                          tr("Can't perturb: data object has been destroyed !"));
-    return NULL;
-  }
-  
-  return item;
-}
-
-
-
-void
-Mesh_3_optimization_plugin::
-treat_result(Scene_c3t3_item& source_item,
-             Scene_c3t3_item& result_item,
-             const QString& name) const
-{
-  result_item.setName(tr("%1 [%2]").arg(source_item.name())
-                                   .arg(name));
-  
-  result_item.c3t3_changed();
-  
-  // If a new item has been created
-  if ( &source_item != &result_item)
-  {
-    const Scene_item::Bbox& bbox = result_item.bbox();
-    result_item.setPosition((bbox.xmin + bbox.xmax)/2.f,
-                            (bbox.ymin + bbox.ymax)/2.f,
-                            (bbox.zmin + bbox.zmax)/2.f);
-    
-    result_item.setColor(QColor(59,74,226));
-    result_item.setRenderingMode(source_item.renderingMode());
-    result_item.set_data_item(source_item.data_item());
-
-    source_item.setVisible(false);
-    
-    const Scene_interface::Item_id index = scene->mainSelectionIndex();
-    scene->itemChanged(index);
-    
-    Scene_interface::Item_id new_item_id = scene->addItem(&result_item);
-    scene->setSelectedItem(new_item_id);
-  }
-  else
-  {
-    result_item.update_histogram();
-    
-    const Scene_interface::Item_id index = scene->mainSelectionIndex();
-    scene->itemChanged(index);
-  }
-}
-
-
-void
-Mesh_3_optimization_plugin::
-optimization_done(Optimizer_thread* thread)
-{
-  CGAL::Mesh_optimization_return_code return_code = thread->return_code();
-  QString name = thread->optimizer_name();
-  
-  // Print message in console
-  QString str = QString("%1 of \"%2\" done in %3s<br>"
-                        "End reason: '%4'<br>")
-                  .arg(name)
-                  .arg(source_item_->name())
-                  .arg(thread->time())
-                  .arg(translate(return_code));
-  
-  Q_FOREACH( QString param, thread->parameters_log() )
-  {
-    str.append(QString("( %1 )<br>").arg(param));
-  }
-  
-  msg->information(qPrintable(str));
-  
-  // Treat new c3t3 item
-  Scene_c3t3_item* result_item = thread->item();
-  treat_result( *source_item_, *result_item, name);
-  // close message box
-  message_box_->close();
-  // free memory
-  delete thread;
-}
-
-
-void
-Mesh_3_optimization_plugin::
-launch_thread(Optimizer_thread* opt_thread, const QString& window_text)
-{
-
-  // -----------------------------------
-  // Create message box with stop button
-  // -----------------------------------
-  message_box_ = new QMessageBox(QMessageBox::NoIcon,
-                                 "Optimization...",
-                                 window_text,
-                                 QMessageBox::Cancel,
-                                 mw);
-  
-  message_box_->setDefaultButton(QMessageBox::Cancel);
-  QAbstractButton* cancelButton = message_box_->button(QMessageBox::Cancel);
-  cancelButton->setText(tr("Stop"));
-  
-  QObject::connect(cancelButton, SIGNAL(clicked()),
-                   opt_thread,   SLOT(stop()));
-  
-  message_box_->show();
-  
-  // -----------------------------------
-  // Connect main thread to optimization thread and launch optimizer
-  // -----------------------------------
-  QObject::connect(opt_thread, SIGNAL(done(Optimizer_thread*)),
-                   this,       SLOT(optimization_done(Optimizer_thread*)));
-  
-  QObject::connect(opt_thread, SIGNAL(status_report(QString)),
-                   this,       SLOT(status_report(QString)));
-  
-  opt_thread->start();
-
-}
-
-
-void
-Mesh_3_optimization_plugin::
-status_report(QString str)
-{
-  if ( NULL == message_box_ ) { return; }
-  
-  message_box_->setInformativeText(str);
-}
-
-
-QString
-translate(CGAL::Mesh_optimization_return_code rc)
-{
-  switch (rc)
-  {
-    case CGAL::MESH_OPTIMIZATION_UNKNOWN_ERROR: return QString("Unexpected error");
-    case CGAL::BOUND_REACHED: return QString("Bound reached");
-    case CGAL::TIME_LIMIT_REACHED: return QString("Time limit reached");
-    case CGAL::CANT_IMPROVE_ANYMORE: return QString("Can't improve anymore");
-    case CGAL::CONVERGENCE_REACHED: return QString("Convergence reached");
-    case CGAL::MAX_ITERATION_NUMBER_REACHED: return QString("Max iteration number reached");
-    case CGAL::ALL_VERTICES_FROZEN: return QString("All vertices have been frozen");
-  }
-  
-  return QString("ERROR");
-}
-
-#include "Optimization_plugin.moc"
-
-#endif // CGAL_POLYHEDRON_DEMO_USE_SURFACE_MESHER
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Optimization_plugin_cgal_code.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Optimization_plugin_cgal_code.cpp
deleted file mode 100644
index 0024ee6..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Optimization_plugin_cgal_code.cpp
+++ /dev/null
@@ -1,770 +0,0 @@
-#include "config.h"
-#include "config_mesh_3.h"
-#include "C3t3_type.h"
-#include "Scene_c3t3_item.h"
-#include "Scene_polyhedron_item.h"
-
-#ifdef CGAL_MESH_3_DEMO_ACTIVATE_SEGMENTED_IMAGES
-#include "Scene_segmented_image_item.h"
-#endif
-#ifdef CGAL_MESH_3_DEMO_ACTIVATE_IMPLICIT_FUNCTIONS
-#include "Scene_implicit_function_item.h"
-#include "implicit_functions/Implicit_function_interface.h"
-#endif
-
-#include "Optimizer_thread.h"
-
-#include <CGAL/optimize_mesh_3.h>
-#include <CGAL/Bbox_3.h>
-
-#include <fstream>
-#include <cstddef>
-
-namespace cgp = CGAL::parameters;
-
-
-// -----------------------------------
-// Helper function
-// -----------------------------------
-QString translate_bool(const bool b)
-{
-  return b ? QString("done") 
-           : QString("in progress");
-}
-
-
-// -----------------------------------
-// Optimization_function_base template class
-// -----------------------------------
-template <typename Domain>
-class Optimization_function_base
-  : public Optimization_function_interface
-{
-public:
-  /// Constructor
-  /// Takes the responsability of d
-  explicit
-  Optimization_function_base(C3t3& c3t3, Domain* d)
-    : c3t3_(c3t3), domain_(d) {}
-  
-  /// Destructor
-  virtual ~Optimization_function_base()
-  {
-    delete domain_;
-  }
-  
-  /// Launch
-  virtual CGAL::Mesh_optimization_return_code launch()
-  {
-    return (*this)(c3t3_, *domain_);
-  }
-  
-protected:
-  /// Virtual operator() which should be overloaded
-  virtual CGAL::Mesh_optimization_return_code
-  operator()(C3t3& c3t3, const Domain& domain) = 0;
-  
-private:
-  C3t3& c3t3_;
-  Domain* domain_;
-};
-
-// Prototype which will be partially specialized for each Parameter class
-template < typename Domain, typename Parameters >
-class Optimization_function {};
-
-
-
-// -----------------------------------
-// Optimization generic function (responsible of dynamic casting)
-// -----------------------------------
-template <typename Parameters>
-Optimizer_thread* cgal_code_optimization(Scene_c3t3_item& c3t3_item,
-                                        const Parameters& param,
-                                        const bool create_new_item)
-{
-  // Create result item
-  Scene_c3t3_item* p_result_item = create_new_item ? 
-    new Scene_c3t3_item(c3t3_item.c3t3()) : &c3t3_item;
-
-  if ( NULL == p_result_item )
-  {
-    return NULL;
-  }
-  
-  
-  // Create domain using real type of c3t3_item.data_item()
-  // ------------------
-
-#ifdef CGAL_MESH_3_DEMO_ACTIVATE_SEGMENTED_IMAGES
-  // Image
-  const Scene_segmented_image_item* image_item = 
-    qobject_cast<const Scene_segmented_image_item*>(c3t3_item.data_item());
-  
-  if ( NULL != image_item )
-  {
-    // Build domain
-    const Image* p_image = image_item->image();
-
-    if ( NULL == p_image )
-    {
-      return NULL;
-    }
-    
-    Image_mesh_domain* p_domain = new Image_mesh_domain(*p_image, 1e-6);
-    
-    // Create thread
-    typedef Optimization_function<Image_mesh_domain,Parameters> Opt_function;
-    Opt_function* p_opt_function = new Opt_function(p_result_item->c3t3(), p_domain, param);
-    
-    return new Optimizer_thread(p_opt_function, p_result_item);
-  }
-#endif
-  
-  // Polyhedron
-  const Scene_polyhedron_item* poly_item = 
-    qobject_cast<const Scene_polyhedron_item*>(c3t3_item.data_item());
-  
-  if ( NULL != poly_item )
-  {
-    // Build domain
-    const Polyhedron* p_poly = poly_item->polyhedron();
-    if ( NULL == p_poly )
-    {
-      return NULL;
-    }
-    
-    Polyhedral_mesh_domain* p_domain = new Polyhedral_mesh_domain(*p_poly);
-    
-    // Create thread
-    typedef Optimization_function<Polyhedral_mesh_domain,Parameters> Opt_function;
-    Opt_function* p_opt_function = new Opt_function(p_result_item->c3t3(), p_domain, param);
-    return new Optimizer_thread(p_opt_function, p_result_item);
-  }
-  
-#ifdef CGAL_MESH_3_DEMO_ACTIVATE_IMPLICIT_FUNCTIONS
-  // Function
-  const Scene_implicit_function_item* function_item = 
-    qobject_cast<const Scene_implicit_function_item*>(c3t3_item.data_item());
-  
-  if ( NULL != function_item )
-  {
-    // Build domain
-    const Implicit_function_interface* p_function = function_item->function();
-    if ( NULL == p_function ) { return NULL; }
-    
-    CGAL::Bbox_3 dom_bbox (p_function->bbox().xmin,
-                           p_function->bbox().ymin,
-                           p_function->bbox().zmin,
-                           p_function->bbox().xmax,
-                           p_function->bbox().ymax,
-                           p_function->bbox().zmax);
-    
-    Function_mesh_domain* p_domain =
-      new Function_mesh_domain(Function_wrapper(*p_function), dom_bbox, 1e-7);
-    
-    // Create thread
-    typedef Optimization_function<Function_mesh_domain,Parameters> Opt_function;
-    Opt_function* p_opt_function = new Opt_function(p_result_item->c3t3(), p_domain, param);
-    
-    return new Optimizer_thread(p_opt_function, p_result_item);
-  }
-#endif
-  
-  return NULL;
-}
-
-
-
-// -----------------------------------
-// Global optimization
-// -----------------------------------
-struct Global_optimization_status
-{
-  bool compute_moves_done;
-  bool move_points_done;
-  bool rebuild_restricted_delaunay_done;
-  int iteration_done;
-  
-  Global_optimization_status()
-    : compute_moves_done(false)
-    , move_points_done(false)
-    , rebuild_restricted_delaunay_done(false)
-    , iteration_done(-1) {}
-};
-
-struct Global_visitor
-{
-  Global_visitor(Global_optimization_status* status) : p_status_(status) {}
-  Global_visitor(const Global_visitor& rhs) : p_status_(rhs.p_status_) {}
-  
-  void after_compute_moves() { p_status_->compute_moves_done = true; }
-  void after_move_points() { p_status_->move_points_done = true; }
-  void after_rebuild_restricted_delaunay() { p_status_->rebuild_restricted_delaunay_done = true; }
-  
-  void end_of_iteration(int iteration_number)
-  {
-    p_status_->iteration_done = iteration_number;
-    p_status_->compute_moves_done = false;
-    p_status_->move_points_done = false;
-    p_status_->rebuild_restricted_delaunay_done = false;
-  }
-  
-private:
-  Global_optimization_status* p_status_;
-};
-
-
-template <typename Domain>
-class Global_optimization_function
-  : public Optimization_function_base< Domain >
-{
-  typedef Global_visitor                       Visitor;
-  typedef Optimization_function_base< Domain > Base;  
-  
-public:
-  /// Constructor
-  Global_optimization_function(C3t3& c3t3, Domain* d)
-    : Base(c3t3,d)
-    , status_() {}
-  
-  /// Destructor
-  virtual ~Global_optimization_function() {}
-
-  // Logs
-  virtual QString status(double) const
-  {
-    QString res = QString("Iteration %1<br /><br />"
-                          "Compute moves: %2<br />")
-    .arg(status_.iteration_done + 2)
-    .arg(translate_bool(status_.compute_moves_done));
-    
-    if ( status_.compute_moves_done )
-    {
-      res += QString("Move points: %1<br />")
-      .arg(translate_bool(status_.move_points_done));
-    }
-    
-    if ( status_.move_points_done )
-    {
-      res += QString("Rebuild restricted Delaunay: %1")
-      .arg(translate_bool(status_.rebuild_restricted_delaunay_done));
-    }
-    
-    return res;
-  }
-  
-protected:
-  Global_optimization_status status_;
-};
-
-
-// -----------------------------------
-// Odt
-// -----------------------------------
-
-#ifndef CGAL_MESH_3_DEMO_DISABLE_ODT
-
-struct Odt_parameters
-{
-  double time_limit;
-  double convergence_ratio;
-  double freeze_ratio;
-  bool do_freeze;
-  int max_iteration_nb;
-  
-  QStringList log() const
-  {
-    return QStringList()
-      << QString("time limit: %1").arg(time_limit)
-      << QString("convergence ratio: %1").arg(convergence_ratio)
-      << QString("freeze ratio: %1").arg(freeze_ratio)
-      << QString("do freeze: %1").arg(do_freeze)
-      << QString("maximum iterations: %1").arg(max_iteration_nb);
-  }
-};
-
-
-/**
- * @class Odt_function
- * Partial specialization of class Optimization_function for Odt
- * Runs odt global optimization
- */
-template <typename Domain>
-class Optimization_function < Domain, Odt_parameters >
-  : public Global_optimization_function< Domain >
-{
-  // Private types
-  typedef C3t3::Triangulation  Tr;
-  typedef CGAL::Mesh_3::Mesh_sizing_field<Tr>    Sizing;
-  typedef CGAL::Mesh_3::Odt_move<C3t3,Sizing>    Move;
-  typedef Global_visitor                         Visitor;
-  
-  typedef typename CGAL::Mesh_3::Mesh_global_optimizer<C3t3,Domain,Move,Visitor> Odt_optimizer;
-
-  typedef Global_optimization_function< Domain > Base;  
-
-public:
-  /// Constructor
-  Optimization_function(C3t3& c3t3, Domain* d, const Odt_parameters& p)
-    : Base(c3t3,d)
-    , odt_(NULL)
-    , p_(p) {}
-  
-  /// Destructor
-  virtual ~Optimization_function() { delete odt_; }
-
-  /// Stops process (set time limit to 1ms)
-  virtual void stop() { odt_->set_time_limit(0.001); }
-  
-  /// Log strings
-  virtual QString name() const { return QString("Odt"); }
-  virtual QStringList parameters_log() const { return p_.log(); }
-  
-protected:
-  /// Launch odt optimization
-  /// The content of this method is taken from CGAL::odt_optimize_mesh_3()
-  virtual CGAL::Mesh_optimization_return_code 
-  operator()(C3t3& c3t3, const Domain& domain)
-  {
-    if ( NULL != odt_ ) { return CGAL::MESH_OPTIMIZATION_UNKNOWN_ERROR; }
-
-    // Create optimizer
-    odt_ = new Odt_optimizer(c3t3, domain, p_.freeze_ratio, p_.do_freeze, p_.convergence_ratio);
-    if ( NULL == odt_ ) { return CGAL::MESH_OPTIMIZATION_UNKNOWN_ERROR; }
-    
-    // Set max time
-    odt_->set_time_limit(p_.time_limit);
-    
-    // 1000 iteration max to avoid infinite loops
-    int max_iteration_nb = ( 0 == p_.max_iteration_nb ) ? 1000
-                                                       : p_.max_iteration_nb;
-      
-    // Launch optimization
-    return (*odt_)(max_iteration_nb, Visitor(&(this->status_)));
-  }
-  
-private:
-  Odt_optimizer* odt_;
-  Odt_parameters p_;
-};
-
-
-/**
- * Global function cgal_code_odt_mesh_3
- */
-Optimizer_thread*
-cgal_code_odt_mesh_3(Scene_c3t3_item& c3t3_item,
-                     const double time_limit,
-                     const double convergence_ratio,
-                     const double freeze_ratio,
-                     const int max_iteration_number,
-                     const bool create_new_item)
-{
-  Odt_parameters p;
-  p.time_limit = time_limit;
-  p.convergence_ratio = convergence_ratio;
-  p.freeze_ratio = freeze_ratio;
-  p.max_iteration_nb = max_iteration_number;
-  
-  return cgal_code_optimization(c3t3_item, p, create_new_item);
-}
-#endif
-
-
-
-// -----------------------------------
-// Lloyd
-// -----------------------------------
-
-#ifndef CGAL_MESH_3_DEMO_DISABLE_LLOYD
-
-struct Lloyd_parameters
-{
-  double time_limit;
-  double convergence_ratio;
-  double freeze_ratio;
-  bool do_freeze;
-  int max_iteration_nb;
-  
-  QStringList log() const
-  {
-    return QStringList()
-      << QString("time limit: %1").arg(time_limit)
-      << QString("convergence ratio: %1").arg(convergence_ratio)
-      << QString("freeze ratio: %1").arg(freeze_ratio)
-      << QString("do freeze: %1").arg(do_freeze)
-      << QString("maximum iterations: %1").arg(max_iteration_nb);
-  }
-};
-
-
-/**
- * @class Lloyd_function
- * Partial specialization of class Optimization_function for Lloyd
- * Runs lloyd global optimization
- */
-template <typename Domain>
-class Optimization_function < Domain, Lloyd_parameters >
-  : public Global_optimization_function< Domain >
-{
-  // Private types
-  typedef C3t3::Triangulation  Tr;
-  typedef CGAL::Mesh_3::Mesh_sizing_field<Tr>    Sizing;
-  typedef CGAL::Mesh_3::Lloyd_move<C3t3,Sizing>  Move;
-  typedef Global_visitor                         Visitor;
-  
-  typedef typename CGAL::Mesh_3::Mesh_global_optimizer<C3t3,Domain,Move,Visitor> Lloyd_optimizer;
-  
-  typedef Global_optimization_function< Domain > Base;
-  
-public:
-  /// Constructor
-  Optimization_function(C3t3& c3t3, Domain* d, const Lloyd_parameters& p)
-    : Base(c3t3,d)
-    , lloyd_(NULL)
-    , p_(p) {}
-  
-  /// Destructor
-  virtual ~Optimization_function() { delete lloyd_; }
-
-  /// Stops process (set time limit to 1ms)
-  virtual void stop() { lloyd_->set_time_limit(0.001); }
-  
-  /// Log strings
-  virtual QString name() const { return QString("Lloyd"); }
-  virtual QStringList parameters_log() const { return p_.log(); }
-  
-protected:
-  /// Launch lloyd optimization
-  /// The content of this method is taken from CGAL::lloyd_optimize_mesh_3()
-  virtual CGAL::Mesh_optimization_return_code 
-  operator()(C3t3& c3t3, const Domain& domain)
-  {
-    if ( NULL != lloyd_ ) { return CGAL::MESH_OPTIMIZATION_UNKNOWN_ERROR; }
-    
-    // Create optimizer
-    lloyd_ = new Lloyd_optimizer(c3t3, domain, p_.freeze_ratio, p_.do_freeze, p_.convergence_ratio);
-    if ( NULL == lloyd_ ) { return CGAL::MESH_OPTIMIZATION_UNKNOWN_ERROR; }
-    
-    // Set max time
-    lloyd_->set_time_limit(p_.time_limit);
-    
-    // 1000 iteration max to avoid infinite loops
-    int max_iteration_nb = ( 0 == p_.max_iteration_nb ) ? 1000
-                                                        : p_.max_iteration_nb;
-    
-    // Launch optimization
-    return (*lloyd_)(max_iteration_nb, Visitor(&(this->status_)));
-  }
-  
-private:
-  Lloyd_optimizer* lloyd_;
-  Lloyd_parameters p_;
-};
-
-
-/**
- * Global function cgal_code_lloyd_mesh_3
- */
-Optimizer_thread*
-cgal_code_lloyd_mesh_3(Scene_c3t3_item& c3t3_item,
-                       const double time_limit,
-                       const double convergence_ratio,
-                       const double freeze_ratio,
-                       const int max_iteration_number,
-                       const bool create_new_item)
-{
-  Lloyd_parameters p;
-  p.time_limit = time_limit;
-  p.convergence_ratio = convergence_ratio;
-  p.freeze_ratio = freeze_ratio;
-  p.max_iteration_nb = max_iteration_number;
-
-  return cgal_code_optimization(c3t3_item, p, create_new_item);
-}
-#endif
-
-
-
-// -----------------------------------
-// Perturbation
-// -----------------------------------
-
-#ifndef CGAL_MESH_3_DEMO_DISABLE_PERTURBER
-
-struct Perturb_parameters
-{
-  double time_limit;
-  double sliver_bound;
-  
-  QStringList log() const
-  {
-    return QStringList()
-      << QString("time limit: %1").arg(time_limit)
-      << QString("sliver bound: %1").arg(sliver_bound);
-  }
-};
-
-
-struct Perturb_status
-{
-  double bound_reached;
-  double vertices_left;
-
-  Perturb_status() : bound_reached(0), vertices_left(0) {}
-};
-
-struct Perturb_visitor
-{
-  Perturb_visitor(Perturb_status* status) : p_status_(status) {}
-  Perturb_visitor(const Perturb_visitor& rhs) : p_status_(rhs.p_status_) {}
-  
-  void bound_reached(const double bound) { p_status_->bound_reached = bound; }
-  void end_of_perturbation_iteration(std::size_t v) { p_status_->vertices_left = v;}
-  
-private:
-  Perturb_status* p_status_;
-};
-
-
-/**
- * @class Perturb_function
- * Partial specialization of class Optimization_function for perturbation
- * Runs sliver perturbation
- */
-template <typename Domain>
-class Optimization_function < Domain, Perturb_parameters >
-  : public Optimization_function_base< Domain >
-{
-  // Private types
-  typedef C3t3::Triangulation                                     Tr;
-  typedef CGAL::Mesh_3::Min_dihedral_angle_criterion<Tr>          Sc;
-  typedef Perturb_visitor                                         Visitor;
-  
-  typedef CGAL::Mesh_3::Sliver_perturber<C3t3,Domain,Sc,Visitor>  Perturber;
-  
-  typedef Optimization_function_base< Domain > Base;
-  
-public:
-  /// Constructor
-  Optimization_function(C3t3& c3t3, Domain* d, const Perturb_parameters& p)
-    : Base(c3t3,d)
-    , perturb_(NULL)
-    , p_(p)
-    , criterion_(p.sliver_bound, c3t3.triangulation()) {}
-  
-  /// Destructor
-  ~Optimization_function() { delete perturb_; }
-
-  /// Stops process (set time limit to 1ms)
-  virtual void stop() { perturb_->set_time_limit(0.001); }
-  
-  /// Log strings
-  virtual QString name() const { return QString("Perturb"); }
-  virtual QStringList parameters_log() const { return p_.log(); }
-  virtual QString status(double) const
-  {
-    return QString("Dihedral angle reached: %1<br /><br />"
-                   "Vertices left in queue (to reach next bound): %2")
-    .arg(status_.bound_reached)
-    .arg(status_.vertices_left);
-  }
-  
-protected:
-  /// Launch sliver perturbation
-  /// The content of this method is taken from CGAL::perturb_mesh_3()
-  virtual CGAL::Mesh_optimization_return_code  
-  operator()(C3t3& c3t3, const Domain& domain)
-  {
-    if ( NULL != perturb_ ) { return CGAL::MESH_OPTIMIZATION_UNKNOWN_ERROR; }
-
-    typedef CGAL::Mesh_3::Sq_radius_perturbation<C3t3,Domain,Sc>      Sq_radius;
-    typedef CGAL::Mesh_3::Volume_perturbation<C3t3,Domain,Sc>         Volume;
-    typedef CGAL::Mesh_3::Dihedral_angle_perturbation<C3t3,Domain,Sc> Dihedral_angle;
-    typedef CGAL::Mesh_3::Li_random_perturbation<C3t3,Domain,Sc>      Li_random;
-    
-    // Build perturber
-    perturb_ = new Perturber(c3t3, domain, criterion_);
-    if ( NULL == perturb_ ) { return CGAL::MESH_OPTIMIZATION_UNKNOWN_ERROR; }
-    
-    // Add perturbations
-    perturb_->add_perturbation(new Sq_radius(40,0.05));
-    perturb_->add_perturbation(new Volume(40,0.05));
-    perturb_->add_perturbation(new Dihedral_angle(40,0.05));
-    perturb_->add_perturbation(new Li_random(100,0.15));
-    
-    // Set max time
-    perturb_->set_time_limit(p_.time_limit);
-    
-    // Set sliver bound (0 means no sliver bound)
-    if ( 0 == p_.sliver_bound ) { p_.sliver_bound = Sc::max_value; }
-    
-    // Launch perturber
-    return (*perturb_)(Visitor(&status_));
-  }
-
-private:
-  Perturber* perturb_;
-  Perturb_parameters p_;
-  Perturb_status status_;
-  Sc criterion_;
-};
-
-
-/**
- * Global function cgal_code_perturb_mesh_3
- */
-Optimizer_thread*
-cgal_code_perturb_mesh_3(Scene_c3t3_item& c3t3_item,
-                         const double time_limit,
-                         const double sliver_bound,
-                         const bool create_new_item)
-{
-  Perturb_parameters p;
-  p.sliver_bound = sliver_bound;
-  p.time_limit = time_limit;
-  
-  return cgal_code_optimization(c3t3_item, p, create_new_item);
-}
-#endif
-
-// -----------------------------------
-// Exudation
-// -----------------------------------
-
-#ifndef CGAL_MESH_3_DEMO_DISABLE_EXUDER
-
-struct Exude_parameters
-{
-  double time_limit;
-  double sliver_bound;
-  
-  QStringList log() const
-  {
-    return QStringList()
-      << QString("time limit: %1").arg(time_limit)
-      << QString("sliver bound: %1").arg(sliver_bound);
-  }
-};
-
-
-struct Exude_status
-{
-  double cells_left_in_queue;
-  double vertices_pumped;
-  
-  Exude_status() : cells_left_in_queue(0), vertices_pumped(0) {}
-};
-
-struct Exude_visitor
-{
-  Exude_visitor(Exude_status* status) : p_status_(status) {}
-  Exude_visitor(const Exude_visitor& rhs) : p_status_(rhs.p_status_) {}
-  
-  void after_cell_pumped(std::size_t n) { p_status_->cells_left_in_queue = n; }
-  
-private:
-  Exude_status* p_status_;
-};
-
-
-/**
- * @class Exude_function
- * Partial specialization of class Optimization_function for exudation
- * Runs sliver exudation
- */
-template <typename Domain>
-class Optimization_function < Domain, Exude_parameters >
-  : public Optimization_function_base< Domain >
-{
-  // Private types
-  typedef C3t3::Triangulation                               Tr;
-  typedef CGAL::Mesh_3::Min_dihedral_angle_criterion<Tr>    Sc;
-  typedef Exude_visitor                                     Visitor;
-  typedef CGAL::Mesh_3::Slivers_exuder<C3t3,Sc,Visitor>     Exuder;
-  
-  typedef Optimization_function_base< Domain > Base;
-  
-public:
-  // Constructor
-  Optimization_function(C3t3& c3t3, Domain* d, const Exude_parameters& p)
-    : Base(c3t3,d)
-    , exude_(NULL)
-    , p_(p)
-    , criterion_(p.sliver_bound, c3t3.triangulation()) {}
-  
-  /// Destructor
-  ~Optimization_function() { delete exude_; }
-  
-  /// Stops process (set time limit to 1ms)
-  virtual void stop() { exude_->set_time_limit(0.001); }
-  
-  // Log strings
-  virtual QString name() const { return QString("Exude"); }
-  virtual QStringList parameters_log() const { return p_.log(); }
-  virtual QString status(double) const
-  {
-    return QString("Cells left in queue: %1<br />")
-                   //"Vertices pumped: %2")
-      .arg(status_.cells_left_in_queue);
-      //.arg(status_.vertices_pumped);
-  }
-  
-protected:
-  /// Launch sliver exudation
-  /// The content of this method is taken from CGAL::exude_mesh_3()
-  virtual CGAL::Mesh_optimization_return_code  
-  operator()(C3t3& c3t3, const Domain&)
-  {
-    if ( NULL != exude_ ) { return CGAL::MESH_OPTIMIZATION_UNKNOWN_ERROR; }
-    
-    // Create exuder
-    exude_ = new Exuder(c3t3, criterion_);
-    if ( NULL == exude_ ) { return CGAL::MESH_OPTIMIZATION_UNKNOWN_ERROR; }
-    
-    // Set time_limit
-    exude_->set_time_limit(p_.time_limit);
-    
-    // Launch exudation
-    return (*exude_)(Visitor(&status_));
-  }
-  
-private:
-  Exuder* exude_;
-  Exude_parameters p_;
-  Exude_status status_;
-  Sc criterion_;
-};
-
-
-/**
- * Global function cgal_code_exude_mesh_3
- */
-Optimizer_thread*
-cgal_code_exude_mesh_3(Scene_c3t3_item& c3t3_item,
-                       const double time_limit,
-                       const double sliver_bound,
-                       const bool create_new_item)
-{
-  // Create result item
-  Scene_c3t3_item* p_result_item = create_new_item ? 
-    new Scene_c3t3_item(c3t3_item.c3t3()) : &c3t3_item;
-
-  if ( NULL == p_result_item )
-  {
-    return NULL;
-  }
-  
-  // Exudation
-  Exude_parameters p;
-  p.sliver_bound = sliver_bound;
-  p.time_limit = time_limit;
-
-  // Create thread
-  typedef Optimization_function<int,Exude_parameters> Opt_function;
-  Opt_function* p_opt_function = new Opt_function(p_result_item->c3t3(), NULL, p);
-  
-  return new Optimizer_thread(p_opt_function, p_result_item);
-}
-#endif
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Polyhedron_demo_mesh_3_labeled_mesh_domain_3.h b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Polyhedron_demo_mesh_3_labeled_mesh_domain_3.h
deleted file mode 100644
index 2663405..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Polyhedron_demo_mesh_3_labeled_mesh_domain_3.h
+++ /dev/null
@@ -1,266 +0,0 @@
-// Copyright (c) 2009 INRIA Sophia-Antipolis (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
-// 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(s)     : Jane Tournois
-//
-//******************************************************************************
-// File Description :
-// class Labeled_mesh_domain_3. See class description.
-//******************************************************************************
-
-#ifndef CGAL_POLYHEDRON_DEMO_LABELED_MESH_DOMAIN_3_H
-#define CGAL_POLYHEDRON_DEMO_LABELED_MESH_DOMAIN_3_H
-
-#include <CGAL/Labeled_mesh_domain_3.h>
-#include <CGAL/Random.h>
-#include "Image_type.h"
-
-#include <boost/type_traits.hpp>
-
-namespace CGAL {
-
-/**
- * \class Polyhedron_demo_labeled_mesh_domain_3
- * LabeledDomain must be a Labeled_mesh_domain_3
- */
-template<class LabeledDomain, class Image = CGAL::Image_3>
-class Polyhedron_demo_labeled_mesh_domain_3
-  : public LabeledDomain
-{
-public:
-  typedef LabeledDomain Base;
-  typedef Polyhedron_demo_labeled_mesh_domain_3 Domain;
-
-  //-------------------------------------------------------
-  // Index Types
-  //-------------------------------------------------------
-  /// Type of indexes for cells of the input complex
-  typedef typename Base::Subdomain_index       Subdomain_index;
-  typedef boost::optional<Subdomain_index>     Subdomain;
-
-  /// Type of indexes for surface patch of the input complex
-  typedef int                                  Surface_patch_index;
-  typedef boost::optional<Surface_patch_index> Surface_patch;
-
-  typedef typename Base::Point_3   Point_3;
-  typedef typename Base::Segment_3 Segment_3;
-
-  /// Type of indexes to characterize the lowest dimensional face of the input
-  /// complex on which a vertex lie
-  typedef int Index;
-  typedef CGAL::cpp11::tuple<Point_3, Index, int> Intersection;
-
-  //constructors
-  Polyhedron_demo_labeled_mesh_domain_3(
-    const typename Base::Fct& f,
-    const typename Base::Bbox_3& bbox,
-    const typename Base::FT& error_bound = Base::FT(1e-3),
-    CGAL::Random* p_rng = NULL)
-    : Base(f, bbox, error_bound, p_rng)
-  {}
-
-  Polyhedron_demo_labeled_mesh_domain_3(
-    const Image& img,
-    const typename Base::FT& error_bound = Base::FT(1e-3),
-    CGAL::Random* p_rng = NULL)
-    : Base(img, error_bound, p_rng)
-  {}
-
-  /**
-   * Returns the index to be stored in a vertex lying on the surface identified
-   * by \c index.
-   */
-  Index index_from_surface_patch_index(
-    const Surface_patch_index& index) const
-  {
-    return Index(index);
-  }
-
-  Index index_from_surface_patch_index(
-    const typename Base::Surface_patch_index& index_pair) const
-  {
-    return Index(index_pair.first * 1000 + index_pair.second);
-  }
-
-  Index index_from_surface_patch_index(
-    const typename Base::Index& index) const
-  {
-    return index_from_surface_patch_index(surface_patch_index(index));
-  }
-
-  Index index_from_index(
-    const typename Base::Index& index) const
-  {
-    if (const typename Base::Surface_patch_index* index_pair =
-      boost::get<typename Base::Surface_patch_index>(&index))
-        return Index(index_pair->first * 1000 + index_pair->second);
-
-    else if (const typename Base::Subdomain_index* sub_index =
-      boost::get<typename Base::Subdomain_index>(&index))
-        return Index(*sub_index);
-
-    return Index(-1);//~error
-  }
-
-  /**
-   * Returns the index to be stored in a vertex lying in the subdomain
-   * identified by \c index.
-   */
-  Index index_from_subdomain_index(const Subdomain_index& index) const
-  { return Index(index); }
-
-  /**
-   * Returns the \c Surface_patch_index of the surface patch
-   * where lies a vertex with dimension 2 and index \c index.
-   */
-  Surface_patch_index
-    surface_patch_index(const Index& index) const
-  {
-    return index;
-  }
-
-  Surface_patch_index
-    surface_patch_index(const typename Base::Index& index) const
-  {
-    typename Base::Surface_patch_index index_pair =
-      boost::get<typename Base::Surface_patch_index>(index);
-    return Surface_patch_index(index_pair.first * 1000 + index_pair.second);
-  }
-
-  typename Base::Surface_patch_index
-    surface_patch_index_base(const Index& index) const
-  {
-    return typename Base::Surface_patch_index(index / 1000,
-                                              index % 1000);
-  }
-
-  /**
-   * Returns the index of the subdomain containing a vertex
-   *  with dimension 3 and index \c index.
-   */
-  Subdomain_index subdomain_index(const Index& index) const
-  { return index; }
-  
-  // -----------------------------------
-  // Backward Compatibility
-  // -----------------------------------
-#ifndef CGAL_MESH_3_NO_DEPRECATED_SURFACE_INDEX
-  typedef Surface_patch_index   Surface_index;
-  
-  Index index_from_surface_index(const Surface_index& index) const
-  { return index_from_surface_patch_index(index); }
-  
-  Surface_index surface_index(const Index& index) const
-  { return surface_patch_index(index); }
-#endif // CGAL_MESH_3_NO_DEPRECATED_SURFACE_INDEX
-  // -----------------------------------
-  // End backward Compatibility
-  // -----------------------------------
-
-
-  struct Construct_initial_points
-  {
-    Construct_initial_points(const Domain& domain)
-      : r_domain_(domain) {}
-
-    template<class OutputIterator>
-    OutputIterator operator()(OutputIterator pts, const int n = 12) const
-    {
-      typename Base::Construct_initial_points cip =
-        r_domain_.Base::construct_initial_points_object();
-
-      std::vector<std::pair<Point_3, typename Base::Index> > initial_points;
-      cip(std::back_inserter(initial_points), n);
-
-      for (std::size_t i = 0; i < initial_points.size(); ++i)
-      {
-        std::pair<Point_3, typename Base::Index> p = initial_points[i];
-        *pts++ = std::make_pair(p.first,
-                                r_domain_.surface_patch_index(p.second));
-      }
-      return pts;
-    }
-
-  private:
-    const Domain& r_domain_;
-  };
-
-  /// Returns Construct_initial_points object
-  Construct_initial_points construct_initial_points_object() const
-  {
-    return Construct_initial_points(*this);
-  }
-
-
-  struct Construct_intersection
-  {
-    Construct_intersection(const Domain& domain)
-      : r_domain_(domain) {}
-
-    template<typename Query>
-    Intersection operator()(const Query& q) const
-    {
-      typename Base::Construct_intersection
-        ci = r_domain_.Base::construct_intersection_object();
-      typename Base::Intersection bi = ci(q);
-
-      return CGAL::cpp11::make_tuple(
-        CGAL::cpp11::get<0>(bi),
-        r_domain_.index_from_index(CGAL::cpp11::get<1>(bi)),
-        CGAL::cpp11::get<2>(bi));
-    }
-
-  private:
-    const Domain& r_domain_;
-  };
-
-  /// Returns Construct_intersection object
-  Construct_intersection construct_intersection_object() const
-  {
-    return Construct_intersection(*this);
-  }
-
-
-private:
-  ///// Returns Surface_patch_index from \c i and \c j
-  //typename Base::Surface_patch_index
-  //  make_surface_index(const Subdomain_index i,
-  //                     const Subdomain_index j) const
-  //{
-  //  if ( i < j )
-  //    return typename Base::Surface_patch_index(i, j);
-  //  else
-  //    return typename Base::Surface_patch_index(j, i);
-  //}
-
-  Surface_patch_index
-    make_surface_index(const Subdomain_index i,
-                       const Subdomain_index j) const
-  {
-    if (i < j)
-      return (i * 1000 + j);
-    else
-      return (j * 1000 + i);
-  }
-
-};  // end class Labeled_mesh_domain_3
-
-}  // end namespace CGAL
-
-#endif // CGAL_POLYHEDRON_DEMO_LABELED_MESH_DOMAIN_3_H
-
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Smoother_dialog.ui b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Smoother_dialog.ui
deleted file mode 100644
index a7136ed..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Smoother_dialog.ui
+++ /dev/null
@@ -1,340 +0,0 @@
-<ui version="4.0">
- <class>Smoother_dialog</class>
- <widget class="QDialog" name="Smoother_dialog">
-  <property name="sizePolicy">
-   <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
-    <horstretch>0</horstretch>
-    <verstretch>0</verstretch>
-   </sizepolicy>
-  </property>
-  <property name="minimumSize">
-   <size>
-    <width>0</width>
-    <height>0</height>
-   </size>
-  </property>
-  <property name="windowTitle">
-   <string>Global smoother parameters</string>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout">
-   <item>
-    <widget class="QLabel" name="objectName">
-     <property name="font">
-      <font>
-       <pointsize>15</pointsize>
-       <weight>75</weight>
-       <bold>true</bold>
-      </font>
-     </property>
-     <property name="text">
-      <string>NO OBJECT</string>
-     </property>
-    </widget>
-   </item>
-   <item>
-    <spacer name="verticalSpacer_4">
-     <property name="orientation">
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeType">
-      <enum>QSizePolicy::MinimumExpanding</enum>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>20</width>
-       <height>10</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
-   <item>
-    <widget class="QGroupBox" name="groupBox">
-     <property name="font">
-      <font>
-       <pointsize>13</pointsize>
-      </font>
-     </property>
-     <property name="title">
-      <string>Parameters</string>
-     </property>
-     <layout class="QGridLayout" name="gridLayout_2" rowstretch="0,0">
-      <property name="topMargin">
-       <number>8</number>
-      </property>
-      <property name="bottomMargin">
-       <number>8</number>
-      </property>
-      <property name="horizontalSpacing">
-       <number>-1</number>
-      </property>
-      <item row="1" column="0">
-       <widget class="QLabel" name="timeLabel">
-        <property name="text">
-         <string>Max CPU running time (s)</string>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-        </property>
-        <property name="buddy">
-         <cstring>maxTime</cstring>
-        </property>
-       </widget>
-      </item>
-      <item row="1" column="2">
-       <widget class="QCheckBox" name="noTimeLimit">
-        <property name="layoutDirection">
-         <enum>Qt::LeftToRight</enum>
-        </property>
-        <property name="text">
-         <string>No time limit</string>
-        </property>
-       </widget>
-      </item>
-      <item row="1" column="1">
-       <widget class="QDoubleSpinBox" name="maxTime">
-        <property name="minimumSize">
-         <size>
-          <width>100</width>
-          <height>0</height>
-         </size>
-        </property>
-        <property name="decimals">
-         <number>1</number>
-        </property>
-        <property name="maximum">
-         <double>9999.000000000000000</double>
-        </property>
-        <property name="value">
-         <double>60.000000000000000</double>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item>
-    <spacer name="verticalSpacer_2">
-     <property name="orientation">
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeType">
-      <enum>QSizePolicy::Fixed</enum>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>20</width>
-       <height>15</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
-   <item>
-    <widget class="QGroupBox" name="groupBox_2">
-     <property name="font">
-      <font>
-       <pointsize>11</pointsize>
-       <italic>true</italic>
-      </font>
-     </property>
-     <property name="title">
-      <string>Advanced Parameters</string>
-     </property>
-     <property name="flat">
-      <bool>false</bool>
-     </property>
-     <property name="checkable">
-      <bool>false</bool>
-     </property>
-     <layout class="QGridLayout" name="gridLayout_3">
-      <property name="topMargin">
-       <number>8</number>
-      </property>
-      <property name="bottomMargin">
-       <number>8</number>
-      </property>
-      <item row="0" column="0">
-       <widget class="QLabel" name="iterationLabel">
-        <property name="font">
-         <font>
-          <pointsize>11</pointsize>
-          <italic>true</italic>
-         </font>
-        </property>
-        <property name="text">
-         <string>Maximum number of iterations</string>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-        </property>
-        <property name="buddy">
-         <cstring>maxIterationNb</cstring>
-        </property>
-       </widget>
-      </item>
-      <item row="0" column="1">
-       <widget class="QDoubleSpinBox" name="maxIterationNb">
-        <property name="decimals">
-         <number>0</number>
-        </property>
-        <property name="maximum">
-         <double>200.000000000000000</double>
-        </property>
-        <property name="value">
-         <double>100.000000000000000</double>
-        </property>
-       </widget>
-      </item>
-      <item row="1" column="0">
-       <widget class="QLabel" name="convergenceLabel">
-        <property name="font">
-         <font>
-          <pointsize>11</pointsize>
-          <italic>true</italic>
-         </font>
-        </property>
-        <property name="text">
-         <string>Convergence ratio</string>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-        </property>
-       </widget>
-      </item>
-      <item row="1" column="1">
-       <widget class="QDoubleSpinBox" name="convergenceRatio">
-        <property name="decimals">
-         <number>4</number>
-        </property>
-        <property name="minimum">
-         <double>0.000100000000000</double>
-        </property>
-        <property name="maximum">
-         <double>1.000000000000000</double>
-        </property>
-        <property name="singleStep">
-         <double>0.010000000000000</double>
-        </property>
-       </widget>
-      </item>
-      <item row="2" column="0">
-       <widget class="QLabel" name="freezeLabel">
-        <property name="font">
-         <font>
-          <pointsize>11</pointsize>
-          <italic>true</italic>
-         </font>
-        </property>
-        <property name="text">
-         <string>Freeze ratio</string>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-        </property>
-        <property name="buddy">
-         <cstring>freezeRatio</cstring>
-        </property>
-       </widget>
-      </item>
-      <item row="2" column="1">
-       <widget class="QDoubleSpinBox" name="freezeRatio">
-        <property name="decimals">
-         <number>4</number>
-        </property>
-        <property name="minimum">
-         <double>0.000000000000000</double>
-        </property>
-        <property name="maximum">
-         <double>1.000000000000000</double>
-        </property>
-        <property name="singleStep">
-         <double>0.001000000000000</double>
-        </property>
-        <property name="value">
-         <double>0.000000000000000</double>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item>
-    <spacer name="verticalSpacer_3">
-     <property name="orientation">
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeType">
-      <enum>QSizePolicy::Fixed</enum>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>20</width>
-       <height>10</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
-   <item>
-    <layout class="QHBoxLayout" name="horizontalLayout_2">
-     <item>
-      <widget class="QCheckBox" name="createNewItem">
-       <property name="layoutDirection">
-        <enum>Qt::RightToLeft</enum>
-       </property>
-       <property name="text">
-        <string>Create a new mesh object</string>
-       </property>
-       <property name="checked">
-        <bool>true</bool>
-       </property>
-      </widget>
-     </item>
-    </layout>
-   </item>
-   <item>
-    <widget class="QDialogButtonBox" name="buttonBox">
-     <property name="orientation">
-      <enum>Qt::Horizontal</enum>
-     </property>
-     <property name="standardButtons">
-      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
-     </property>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <resources/>
- <connections>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>accepted()</signal>
-   <receiver>Smoother_dialog</receiver>
-   <slot>accept()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>384</x>
-     <y>191</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>157</x>
-     <y>195</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>rejected()</signal>
-   <receiver>Smoother_dialog</receiver>
-   <slot>reject()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>384</x>
-     <y>191</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>286</x>
-     <y>195</y>
-    </hint>
-   </hints>
-  </connection>
- </connections>
-</ui>
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Volume_plane.h b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Volume_plane.h
deleted file mode 100644
index 29dbb60..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Volume_plane.h
+++ /dev/null
@@ -1,458 +0,0 @@
-#ifndef CGAL_VOLUME_PLANE_H
-#define CGAL_VOLUME_PLANE_H
-
-#include <CGAL/Three/Scene_item.h>
-
-#include <vector>
-#include <cassert>
-
-#include <QDebug>
-#include <QGLViewer/qglviewer.h>
-
-#include "Volume_plane_interface.h"
-#include <QOpenGLVertexArrayObject>
-#include <QOpenGLBuffer>
-#include <QOpenGLShaderProgram>
-#include <CGAL/Three/Viewer_interface.h>
-#include <CGAL/Qt/debug.h>
-
-using namespace CGAL::Three;
-
-#if !defined(NDEBUG)
-inline
-void printGlError(unsigned int line) {
- CGAL::Qt::opengl_check_errors(line);
-}
-#else
-inline
-void printGlError(unsigned int) {
-}
-#endif
-
-template<int Dim>
-class Length_constraint : public qglviewer::WorldConstraint {
-public:
-  Length_constraint(double max_) : max_(max_) { }
-
-  void constrainTranslation(qglviewer::Vec& t, qglviewer::Frame* const frame) {
-    WorldConstraint::constrainTranslation(t, frame);
-    qglviewer::Vec pos = frame->position();
-    double start = pos[Dim];
-    double end = t[Dim];
-    start += end;
-
-    if(start > max_ || (start < 0)) {
-      t[Dim] = 0.0;
-    }
-  }
-
-private:
-  double max_;
-};
-
-struct x_tag {};
-struct y_tag {};
-struct z_tag {};
-
-template<typename Tag>
-class Volume_plane : public Volume_plane_interface, public Tag {
-public:
- Volume_plane();
- void setData(unsigned int adim, unsigned int bdim, unsigned int cdim,
-                 float xscale, float yscale, float zscale, std::vector<float>& colors);
-
-  virtual ~Volume_plane();
-
-  Volume_plane* clone() const { return NULL; }
-
-  virtual RenderingMode renderingMode() const { return Flat; }
-  bool supportsRenderingMode(RenderingMode m) const { return m == Flat; }
-  
-  QString toolTip() const { return "Plane through a volume"; }
-  QString name() const { return name(*this); }
-
-  bool isFinite() const { return true; }
-  bool isEmpty() const { return false; }
-  bool manipulatable() const { return true; }
-
-  unsigned int cube() {return currentCube; }
-
-  void draw(Viewer_interface* viewer)const;
-
-  unsigned int aDim() const { return adim_; }
-  unsigned int bDim() const { return bdim_; }
-  unsigned int cDim() const { return cdim_; }
-
-  qglviewer::Vec translationVector() const { return translationVector(*this); }
-
-  unsigned int getCurrentCube() const { return currentCube; }
-
-  // uses a public init function to make enable construction in
-  // threads without gl-context
-  void init();
-
-private:
-  static const char* vertexShader_source;
-
-  static const char* fragmentShader_source;
-
-  static const char* vertexShader_bordures_source;
-
-  static const char* fragmentShader_bordures_source;
-
-
-  qglviewer::Vec translationVector(x_tag) const {
-    return qglviewer::Vec(xscale_, 0.0, 0.0);
-  }
-  qglviewer::Vec translationVector(y_tag) const {
-    return qglviewer::Vec(0.0, yscale_, 0.0);
-  }
-  qglviewer::Vec translationVector(z_tag) const {
-    return qglviewer::Vec(0.0, 0.0, zscale_);
-  }
-
-  void initShaders();
-
-  void buildVertex(std::vector<float>& out, unsigned int i, unsigned int j) {
-    buildVertex(out, i, j, *this);
-  }
-
-  void buildVertex(std::vector<float>& out, unsigned int i, unsigned int j, x_tag) {
-    out.push_back(0.0f);
-    out.push_back(i * yscale_);
-    out.push_back(j * zscale_);
-  }
-
-  void buildVertex(std::vector<float>& out, unsigned int i, unsigned int j, y_tag) {
-    out.push_back(i * xscale_);
-    out.push_back(0.0f);
-    out.push_back(j * zscale_);
-  }
-
-  void buildVertex(std::vector<float>& out, unsigned int i, unsigned int j, z_tag) {
-    out.push_back(i * xscale_);
-    out.push_back(j * yscale_);
-    out.push_back(0.0f);
-  }
-
-  unsigned int adim_, bdim_, cdim_;
-  double xscale_, yscale_, zscale_;
-  mutable int currentCube;
-
-  mutable QOpenGLBuffer vVBO;
-  mutable QOpenGLBuffer cbuffer;
-  mutable QOpenGLBuffer rectBuffer;
-  mutable std::vector<float> v_rec;
-  mutable QOpenGLShaderProgram program_bordures;
-  mutable QOpenGLShaderProgram program;
-  mutable std::vector< std::pair<QOpenGLBuffer, unsigned int> > ebos;
-  std::vector< float > colors_;
-
-  QString name(x_tag) const { return tr("X Slice for %1").arg(name_); }
-  QString name(y_tag) const { return tr("Y Slice for %2").arg(name_); }
-  QString name(z_tag) const { return tr("Z Slice for %2").arg(name_); }
-
-  void drawRectangle(x_tag) const {
-
-
-      v_rec.push_back(0.0f); v_rec.push_back(0.0f); v_rec.push_back(0.0f);
-      v_rec.push_back(0.0f); v_rec.push_back((adim_ - 1) * yscale_); v_rec.push_back(0.0f);
-      v_rec.push_back(0.0f); v_rec.push_back((adim_ - 1) * yscale_); v_rec.push_back((bdim_ - 1) * zscale_);
-      v_rec.push_back(0.0f); v_rec.push_back(0.0f); v_rec.push_back((bdim_ - 1) * zscale_);
-
-  }
-
-  void drawRectangle(y_tag) const {
-      v_rec.push_back(0.0f); v_rec.push_back(0.0f); v_rec.push_back(0.0f);
-      v_rec.push_back((adim_ - 1) * xscale_);v_rec.push_back(0.0f); v_rec.push_back(0.0f);
-      v_rec.push_back((adim_ - 1) * xscale_);v_rec.push_back(0.0f);v_rec.push_back( (bdim_ - 1) * zscale_);
-      v_rec.push_back(0.0f); v_rec.push_back(0.0f); v_rec.push_back((bdim_ - 1) * zscale_);
-  }
-
-  void drawRectangle(z_tag) const {
-      v_rec.push_back(0.0f); v_rec.push_back(0.0f); v_rec.push_back(0.0f);
-      v_rec.push_back((adim_ - 1) * xscale_); v_rec.push_back(0.0f); v_rec.push_back(0.0f);
-      v_rec.push_back((adim_ - 1) * xscale_); v_rec.push_back((bdim_ - 1) * yscale_); v_rec.push_back(0.0f);
-      v_rec.push_back(0.0f); v_rec.push_back((bdim_ - 1) * yscale_); v_rec.push_back(0.0f);
-  }
-
-  qglviewer::Constraint* setConstraint(x_tag) {
-    qglviewer::AxisPlaneConstraint* c = new Length_constraint<0>(cdim_ * xscale_);
-    c->setRotationConstraintType(qglviewer::AxisPlaneConstraint::FORBIDDEN);
-    c->setTranslationConstraint(qglviewer::AxisPlaneConstraint::AXIS, qglviewer::Vec(1.0f, 0.0f, 0.0f));
-    return c;
-  }
-  
-  qglviewer::Constraint* setConstraint(y_tag) {
-    qglviewer::AxisPlaneConstraint* c = new Length_constraint<1>(cdim_ * yscale_);
-    c->setRotationConstraintType(qglviewer::AxisPlaneConstraint::FORBIDDEN);
-    c->setTranslationConstraint(qglviewer::AxisPlaneConstraint::AXIS, qglviewer::Vec(0.0f, 1.0f, 0.0f));
-    return c;
-  }
-
-  qglviewer::Constraint* setConstraint(z_tag) {
-    qglviewer::AxisPlaneConstraint* c = new Length_constraint<2>(cdim_ * zscale_);
-    c->setRotationConstraintType(qglviewer::AxisPlaneConstraint::FORBIDDEN);
-    c->setTranslationConstraint(qglviewer::AxisPlaneConstraint::AXIS, qglviewer::Vec(0.0f, 0.0f, 1.0f));
-    return c;
-  }
-
-  void updateCurrentCube() const { currentCube = getTranslation(); }
-
-  GLdouble getTranslation() const { return getTranslation(*this); }
-  GLdouble getTranslation(x_tag) const { return mFrame_->matrix()[12] / xscale_; }
-  GLdouble getTranslation(y_tag) const { return mFrame_->matrix()[13] / yscale_; }
-  GLdouble getTranslation(z_tag) const { return mFrame_->matrix()[14] / zscale_; }
-
-};
-
-template<typename T>
-const char* Volume_plane<T>::vertexShader_source =
-      "#version 120 \n"
-      "attribute highp vec4 vertex; \n"
-      "attribute highp float color; \n"
-      "uniform highp mat4 mvp_matrix; \n"
-      "uniform highp mat4 f_matrix; \n"
-      "varying highp vec4 fullColor; \n"
-      "void main() \n"
-      "{ gl_Position = mvp_matrix * f_matrix * vertex; \n"
-      " fullColor = vec4(color, color, color, 1.0); } \n";
-
-template<typename T>
-const char* Volume_plane<T>::fragmentShader_source =
-      "#version 120\n"
-      "varying highp vec4 fullColor; \n"
-      "void main() { gl_FragColor = fullColor; } \n";
-
-template<typename T>
-const char* Volume_plane<T>::vertexShader_bordures_source =
-      "#version 120 \n"
-      "attribute highp vec4 vertex; \n"
-      "uniform highp vec4 color; \n"
-      "uniform highp mat4 mvp_matrix; \n"
-      "uniform highp mat4 f_matrix; \n"
-      "varying vec4 fullColor; \n"
-      "void main() \n"
-      "{ gl_Position = mvp_matrix * f_matrix * vertex; \n"
-      " fullColor = color; } \n";
-
-template<typename T>
-const char* Volume_plane<T>::fragmentShader_bordures_source =
-      "#version 120\n"
-      "varying highp vec4 fullColor; \n"
-      "void main() { gl_FragColor = fullColor; } \n";
-
-
-
-template<typename T>
-Volume_plane<T>::Volume_plane()
-  : Volume_plane_interface(new qglviewer::ManipulatedFrame)
- {
- }
-template<typename T>
-void Volume_plane<T>::setData(unsigned int adim, unsigned int bdim, unsigned int cdim, float xscale, float yscale, float zscale, std::vector<float> &colors)
-{
- adim_ = adim;
- bdim_ = bdim;
- cdim_= cdim;
- xscale_ = xscale;
- yscale_ =yscale;
- zscale_ = zscale;
- currentCube = 0;
- colors_.swap(colors);
- mFrame_->setConstraint(setConstraint(*this));
-}
-template<typename T>
-Volume_plane<T>::~Volume_plane() {
-  for(std::vector< std::pair< QOpenGLBuffer, unsigned int> >::iterator it = ebos.begin();
-      it != ebos.end(); ++it) { 
-      it->first.destroy();
-  }
-  program.release();
-}
-
-template<typename T>
-void Volume_plane<T>::draw(Viewer_interface *viewer) const {
-  updateCurrentCube();
-
-
-
-  GLdouble mat[16];
-  viewer->camera()->getModelViewProjectionMatrix(mat);
-  QMatrix4x4 mvp;
-  QMatrix4x4 f;
-  for(int i=0; i<16; i++)
-  {
-      mvp.data()[i] = (float)mat[i];
-      f.data()[i] = (float)mFrame_->matrix()[i];
-  }
-
-
-  program_bordures.bind();
-  program_bordures.setUniformValue("mvp_matrix", mvp);
-  program_bordures.setUniformValue("f_matrix", f);
-  program_bordures.release();
-  GLint renderMode;
-  glGetIntegerv(GL_RENDER_MODE, &renderMode);
-  printGlError(__LINE__);
-
-
-  glLineWidth(4.0f);
-  v_rec.resize(0);
-  drawRectangle(*this);
-
-  program_bordures.bind();
-  rectBuffer.create();
-  rectBuffer.bind();
-  rectBuffer.allocate(v_rec.data(), static_cast<int>(v_rec.size()*sizeof(float)));
-  program_bordures.setAttributeBuffer("vertex",GL_FLOAT,0,3);
-  program_bordures.enableAttributeArray("vertex");
-  float current_color[4];
-  glGetFloatv(GL_CURRENT_COLOR, current_color);
-  QColor color;
-  color.setRgbF(current_color[0], current_color[1], current_color[2]);
-  program_bordures.setUniformValue("color",color);
-  glDrawArrays(GL_LINE_LOOP, 0, static_cast<GLsizei>(v_rec.size()/3));
-  rectBuffer.release();
-  program_bordures.release();
-  glLineWidth(1.0f);
-
-  program.bind();
-  int mvpLoc = program.uniformLocation("mvp_matrix");
-  int fLoc = program.uniformLocation("f_matrix");
-  program.setUniformValue(mvpLoc, mvp);
-  program.setUniformValue(fLoc, f);
-  vVBO.bind();
-  int vloc = program.attributeLocation("vertex");
-  program.enableAttributeArray(vloc);
-  program.setAttributeBuffer(vloc, GL_FLOAT, 0, 3);
-  vVBO.release();
-
-  cbuffer.bind();
-  int colorLoc = program.attributeLocation("color");
-  program.enableAttributeArray(colorLoc);
-  program.setAttributeBuffer(colorLoc, GL_FLOAT, (currentCube*sizeof(float)) * (bdim_) * (adim_), 1, 0 );
-  cbuffer.release();
-
-
-  printGlError(__LINE__);
-
- for(unsigned int i = 0; i < ebos.size(); ++i)
-  {
-      ebos[i].first.bind();
-      glDrawElements(GL_TRIANGLES, ebos[i].second, GL_UNSIGNED_INT, 0);
-      ebos[i].first.release();
-  }
-
-  cbuffer.release();
-  printGlError(__LINE__);
-  program.release();
-
-  printGlError(__LINE__);
-}
-
-template<typename T>
-void Volume_plane<T>::init() {
-  
-  initShaders();
-
-  // for each vertex
-  std::vector< float > vertices;
-  vertices.reserve(bdim_ * adim_ * 3);
-  for(unsigned int i = 0; i < adim_; ++i) 
-  {
-    for(unsigned int j = 0; j < bdim_; ++j)
-    {
-      buildVertex(vertices, i, j);
-    }
-  }
-    
-  assert(vertices.size() == (3 * adim_ * bdim_));
-
-  int maxi, maxv;
-  glGetIntegerv(GL_MAX_ELEMENTS_INDICES, &maxi);
-  glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, &maxv);
-  assert((vertices.size( ) / 3) < (unsigned int)maxi);
-  vVBO.create();
-  vVBO.bind();
-  vVBO.allocate(vertices.data(),static_cast<int>(sizeof(float) * vertices.size()));
-  vVBO.release();
-  printGlError(__LINE__);
-
-  // for each patch
-  std::vector<unsigned int> indices;
-  for(unsigned int j = 0; j < adim_ - 1; ++j) {
-    for(unsigned int k = 0; k < bdim_ - 1; ++k) {
-        //0
-        indices.push_back( j * bdim_ + k );
-        assert(indices.back() < (vertices.size() / 3));
-
-        //1
-        indices.push_back( j * bdim_ + (k + 1) );
-        assert(indices.back() < (vertices.size() / 3));
-
-        //3
-        indices.push_back( (j+1) * bdim_ + (k+1) );
-        assert(indices.back() < (vertices.size() / 3));
-
-        //0
-        indices.push_back( j * bdim_ + k );
-        assert(indices.back() < (vertices.size() / 3));
-
-        //3
-        indices.push_back( (j+1) * bdim_ + (k+1) );
-        assert(indices.back() < (vertices.size() / 3));
-
-        //2
-        indices.push_back( (j+1) * bdim_ + (k) );
-        assert(indices.back() < (vertices.size() / 3));
-
-    }
-  }
-
-  assert((indices.size() / 6) == (adim_ - 1) * (bdim_ - 1));
-  //slice must be multiple of 3.
-  const unsigned int slice = 63399;
-  for(unsigned int i = 0; i < indices.size(); i+=slice)
-  {
-    QOpenGLBuffer ebo = QOpenGLBuffer(QOpenGLBuffer::IndexBuffer);
-    unsigned int left_over = (i + slice) > indices.size()  ? std::distance(indices.begin() + i, indices.end()) : slice;
-    ebo.create();
-    ebo.bind();
-    ebo.allocate(&indices[i],static_cast<int>(sizeof(unsigned int) * left_over));
-    ebo.release();
-    ebos.push_back(std::make_pair(ebo, left_over));
-  }
-
-  cbuffer.create();
-  cbuffer.bind();
-  cbuffer.allocate(colors_.data(),static_cast<int>(colors_.size()*sizeof(float)));
-  cbuffer.release();
-
-  printGlError(__LINE__);
-}
-
-template<typename T>
-void Volume_plane<T>::initShaders() {
-  QOpenGLShader *vertex = new QOpenGLShader(QOpenGLShader::Vertex);
-
-  vertex->compileSourceCode(vertexShader_source);
-  QOpenGLShader *fragment= new QOpenGLShader(QOpenGLShader::Fragment);
-  fragment->compileSourceCode(fragmentShader_source);
-  program.addShader(vertex);
-  program.addShader(fragment);
-  program.link();
-
-
-  QOpenGLShader *vertex_bordures = new QOpenGLShader(QOpenGLShader::Vertex);
-
-  vertex_bordures->compileSourceCode(vertexShader_bordures_source);
-  QOpenGLShader *fragment_bordures= new QOpenGLShader(QOpenGLShader::Fragment);
-  fragment_bordures->compileSourceCode(fragmentShader_bordures_source);
-  program_bordures.addShader(vertex_bordures);
-  program_bordures.addShader(fragment_bordures);
-  program_bordures.link();
-}
-
-
-#endif /* CGAL_VOLUME_PLANE_H */
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_interface.h b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_interface.h
deleted file mode 100644
index 65eb112..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_interface.h
+++ /dev/null
@@ -1,52 +0,0 @@
-#ifndef CGAL_VOLUME_PLANE_INTERFACE_H_
-#define CGAL_VOLUME_PLANE_INTERFACE_H_
-
-#include <QObject>
-#include <QGLViewer/qglviewer.h>
-#include <CGAL/Three/Scene_item.h>
-#include <iostream>
-#include <QGLViewer/manipulatedFrame.h>
-using namespace CGAL::Three;
-class Volume_plane_interface : public Scene_item {
-Q_OBJECT
-public:
-  Volume_plane_interface(qglviewer::ManipulatedFrame* f) : mFrame_(f) { 
-    connect(mFrame_, SIGNAL(manipulated()), this, SLOT(propagateManipulation()));
-  }
-
-  virtual ~Volume_plane_interface() {
-    delete mFrame_;
-  }
-
-  virtual void init() = 0;
-
-  virtual void setData(unsigned int adim, unsigned int bdim, unsigned int cdim, float xscale, float yscale, float zscale, std::vector<float> &colors) =0;
-  virtual unsigned int aDim() const = 0;
-  virtual unsigned int bDim() const = 0;
-  virtual unsigned int cDim() const = 0;
-  virtual qglviewer::Vec translationVector() const = 0;
-  void itemAboutToBeDestroyed(Scene_item* item) {
-    if(this == item) {
-      Q_EMIT planeDestructionIncoming(this);
-      Q_EMIT aboutToBeDestroyed();
-    }
-  }
-
-  virtual unsigned int getCurrentCube() const = 0;
-
-  virtual qglviewer::ManipulatedFrame* manipulatedFrame() { return mFrame_; }
-
-Q_SIGNALS:
-  void planeDestructionIncoming(Volume_plane_interface*);
-  void manipulated(int);
-private Q_SLOTS:
-  void propagateManipulation() {
-    Q_EMIT manipulated(getCurrentCube());
-  }
-protected:
-  qglviewer::ManipulatedFrame* mFrame_;
-};
-
-
-#endif /* CGAL_VOLUME_PLANE_INTERFACE_H_ */
-
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_intersection.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_intersection.cpp
deleted file mode 100644
index e92e1fb..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_intersection.cpp
+++ /dev/null
@@ -1,200 +0,0 @@
-#include "config.h"
-
-#include "Volume_plane_intersection.h"
-#include "Volume_plane_interface.h"
-
-#include <CGAL/gl.h>
-
-void Volume_plane_intersection::compile_shaders()
-{
-
-    for(int i=0; i< vboSize; i++)
-        buffers[i].create();
-    for(int i=0; i< vaoSize; i++)
-        vao[i].create();
-
-    //Vertex source code
-    const char vertex_source[] =
-    {
-        "#version 120 \n"
-        "attribute highp vec4 vertex;\n"
-        "uniform highp mat4 mvp_matrix;\n"
-        "uniform highp mat4 f_matrix; \n"
-        "void main(void)\n"
-        "{\n"
-        "   gl_Position = mvp_matrix* f_matrix * vertex; \n"
-        "}"
-    };
-    //Fragment source code
-    const char fragment_source[] =
-    {
-        "#version 120 \n"
-        "void main(void) { \n"
-        "gl_FragColor = vec4(1.0,0.0,0.0,1.0); \n"
-        "} \n"
-        "\n"
-    };
-    QOpenGLShader *vertex_shader = new QOpenGLShader(QOpenGLShader::Vertex);
-    if(!vertex_shader->compileSourceCode(vertex_source))
-    {
-        std::cerr<<"Compiling vertex source FAILED"<<std::endl;
-    }
-
-    QOpenGLShader *fragment_shader= new QOpenGLShader(QOpenGLShader::Fragment);
-    if(!fragment_shader->compileSourceCode(fragment_source))
-    {
-        std::cerr<<"Compiling fragmentsource FAILED"<<std::endl;
-    }
-
-    if(!rendering_program.addShader(vertex_shader))
-    {
-        std::cerr<<"adding vertex shader FAILED"<<std::endl;
-    }
-    if(!rendering_program.addShader(fragment_shader))
-    {
-        std::cerr<<"adding fragment shader FAILED"<<std::endl;
-    }
-    if(!rendering_program.link())
-    {
-        std::cerr<<"linking Program FAILED"<<std::endl;
-    }
-}
-
-void Volume_plane_intersection::compute_elements()
-{
-   a_vertex.resize(0);
-   b_vertex.resize(0);
-   c_vertex.resize(0);
-
-   a_vertex.push_back(0.0); a_vertex.push_back(0.0); a_vertex.push_back(0.0);
-   a_vertex.push_back(x);   a_vertex.push_back(0.0); a_vertex.push_back(0.0);
-
-   b_vertex.push_back(0.0); b_vertex.push_back(0.0); b_vertex.push_back(0.0);
-   b_vertex.push_back(0.0); b_vertex.push_back(y);   b_vertex.push_back(0.0);
-
-   c_vertex.push_back(0.0); c_vertex.push_back(0.0); c_vertex.push_back(0.0);
-   c_vertex.push_back(0.0); c_vertex.push_back(0.0); c_vertex.push_back(z);
-}
-
-void Volume_plane_intersection::init_buffers()
-{
-    rendering_program.bind();
-
-        vao[0].bind();
-        buffers[0].bind();
-        buffers[0].allocate(a_vertex.data(), static_cast<int>(a_vertex.size()*sizeof(float)));
-        vertexLocation[0] = rendering_program.attributeLocation("vertex");
-        rendering_program.enableAttributeArray(vertexLocation[0]);
-        rendering_program.setAttributeBuffer(vertexLocation[0],GL_FLOAT,0,3);
-        buffers[0].release();
-        vao[0].release();
-
-        vao[1].bind();
-        buffers[1].bind();
-        buffers[1].allocate(b_vertex.data(), static_cast<int>(b_vertex.size()*sizeof(float)));
-        vertexLocation[0] = rendering_program.attributeLocation("vertex");
-        rendering_program.enableAttributeArray(vertexLocation[0]);
-        rendering_program.setAttributeBuffer(vertexLocation[0],GL_FLOAT,0,3);
-        buffers[1].release();
-        vao[1].release();
-
-        vao[2].bind();
-        buffers[2].bind();
-        buffers[2].allocate(c_vertex.data(), static_cast<int>(c_vertex.size()*sizeof(float)));
-        vertexLocation[0] = rendering_program.attributeLocation("vertex");
-        rendering_program.enableAttributeArray(vertexLocation[0]);
-        rendering_program.setAttributeBuffer(vertexLocation[0],GL_FLOAT,0,3);
-        buffers[2].release();
-        vao[2].release();
-
-
-
-    rendering_program.release();
-
-}
-
-void Volume_plane_intersection::attrib_buffers(Viewer_interface* viewer) const
-{
-    QMatrix4x4 mvpMatrix;
-    double mat[16];
-    viewer->camera()->getModelViewProjectionMatrix(mat);
-    for(int i=0; i < 16; i++)
-    {
-        mvpMatrix.data()[i] = (float)mat[i];
-    }
-
-    rendering_program.bind();
-    mvpLocation[0] = rendering_program.uniformLocation("mvp_matrix");
-    rendering_program.setUniformValue(mvpLocation[0], mvpMatrix);
-    rendering_program.release();
-}
-
-void Volume_plane_intersection::draw(Viewer_interface* viewer) const {
-  viewer->glLineWidth(4.0f);
-  attrib_buffers(viewer);
-  if(b && c) {
-
-    vao[0].bind();
-    rendering_program.bind();
-    GLdouble mat[16];
-    b->manipulatedFrame()->getMatrix(mat);
-    QMatrix4x4 b_mat, c_mat;
-    for(int i=0; i<16; i++)
-    {
-       b_mat.data()[i] = (float)mat[i];
-    }
-    c->manipulatedFrame()->getMatrix(mat);
-    for(int i=0; i<16; i++)
-    {
-       c_mat.data()[i] = (float)mat[i];
-    }
-    rendering_program.setUniformValue("f_matrix", b_mat*c_mat);
-    viewer->glDrawArrays(GL_LINES, 0, 2);
-    rendering_program.release();
-    vao[0].release();
-  }
-
-  if(a && c) {
-      vao[1].bind();
-      rendering_program.bind();
-      GLdouble mat[16];
-      a->manipulatedFrame()->getMatrix(mat);
-      QMatrix4x4 a_mat, c_mat;
-      for(int i=0; i<16; i++)
-      {
-         a_mat.data()[i] = (float)mat[i];
-      }
-      c->manipulatedFrame()->getMatrix(mat);
-      for(int i=0; i<16; i++)
-      {
-         c_mat.data()[i] = (float)mat[i];
-      }
-      rendering_program.setUniformValue("f_matrix", a_mat*c_mat);
-      viewer->glDrawArrays(GL_LINES, 0, 2);
-      rendering_program.release();
-      vao[1].release();
-  }
-
-  if(a && b) {
-      vao[2].bind();
-      rendering_program.bind();
-      GLdouble mat[16];
-      a->manipulatedFrame()->getMatrix(mat);
-      QMatrix4x4 a_mat, b_mat;
-      for(int i=0; i<16; i++)
-      {
-         a_mat.data()[i] = (float)mat[i];
-      }
-      b->manipulatedFrame()->getMatrix(mat);
-      for(int i=0; i<16; i++)
-      {
-         b_mat.data()[i] = (float)mat[i];
-      }
-      rendering_program.setUniformValue("f_matrix", a_mat*b_mat);
-      viewer->glDrawArrays(GL_LINES, 0, 2);
-      rendering_program.release();
-      vao[2].release();
-  }
-
-  viewer->glLineWidth(1.0f);
-}
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_intersection.h b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_intersection.h
deleted file mode 100644
index bfd013f..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_intersection.h
+++ /dev/null
@@ -1,78 +0,0 @@
-#ifndef CGAL_VOLUME_PLANE_INTERSECTION_H_
-#define CGAL_VOLUME_PLANE_INTERSECTION_H_
-
-#include <CGAL/Three/Scene_item.h>
-
-#include <QColor>
-#include <QString>
-#include <QGLViewer/qglviewer.h>
-#include <QOpenGLVertexArrayObject>
-#include <QOpenGLBuffer>
-#include <QOpenGLShaderProgram>
-#include <CGAL/Three/Viewer_interface.h>
-using namespace CGAL::Three;
-class Volume_plane_interface;
-
-class Volume_plane_intersection
-  : public Scene_item {
-  typedef std::pair<Volume_plane_interface*, Volume_plane_interface*> Interface_pair;
-Q_OBJECT
-public:
-  Volume_plane_intersection(float x, float y, float z)
-    : a(NULL), b(NULL), c(NULL), x(x), y(y), z(z) {
-    setColor(QColor(255, 0, 0));
-    setName("Volume plane intersection");
-    compile_shaders();
-    compute_elements();
-    init_buffers();
-  }
-
-  bool isFinite() const { return true; }
-  bool isEmpty() const { return false; }
-  bool manipulatable() const { return false; }
-  Volume_plane_intersection* clone() const { return 0; }
-  bool supportsRenderingMode(RenderingMode) const { return true; }
-  QString toolTip() const { return "Tooling"; }
-
-  void draw(Viewer_interface*)const;
-
-  void setX(Volume_plane_interface* x) { a = x; }
-  void setY(Volume_plane_interface* x) { b = x; }
-  void setZ(Volume_plane_interface* x) { c = x; }
-
-public Q_SLOTS:
-  void planeRemoved(Volume_plane_interface* i) {
-    if(a == i) {
-      a = NULL;
-    } else if(b == i) {
-      b = NULL;
-    } else if(c == i) {
-      c = NULL;
-    }
-  }
-
-private:
-  Volume_plane_interface *a, *b, *c;
-  float x, y, z;
-
-  static const int vaoSize = 3;
-  static const int vboSize = 3;
-
-  mutable int vertexLocation[1];
-  mutable int mvpLocation[1];
-
-  std::vector<float> a_vertex;
-  std::vector<float> b_vertex;
-  std::vector<float> c_vertex;
-
-  mutable QOpenGLBuffer buffers[vboSize];
-  mutable QOpenGLVertexArrayObject vao[vaoSize];
-  mutable QOpenGLShaderProgram rendering_program;
-  void compute_elements();
-  void init_buffers();
-  void attrib_buffers(Viewer_interface*) const;
-  void compile_shaders();
-};
-
-#endif /* CGAL_VOLUME_PLANE_INTERSECTION_H_ */
-
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_thread.h b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_thread.h
deleted file mode 100644
index 19bf2ca..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_thread.h
+++ /dev/null
@@ -1,128 +0,0 @@
-#ifndef CGAL_VOLUME_PLANE_THREAD_H
-#define CGAL_VOLUME_PLANE_THREAD_H
-
-#include "Volume_plane.h"
-#include <CGAL/Image_3.h>
-
-#include "Scene_segmented_image_item.h"
-
-#include <QApplication>
-#include <QThread>
-#include <vector>
-
-struct Clamp_to_one_zero_range {
-  std::pair<float, float> min_max;
-  float operator()(const float& inVal) {
-    float inValNorm = inVal - min_max.first;
-    float aUpperNorm = min_max.second - min_max.first;
-    float bValNorm = inValNorm / aUpperNorm;
-    return bValNorm;
-  }
-};
-
-class Volume_plane_thread : public QThread {
-Q_OBJECT  
-public:
-  Volume_plane_thread(const CGAL::Image_3* img, const Clamp_to_one_zero_range& clamp, const QString& name)
-    : img(img), clamper(clamp), item(NULL), name(name) { }
-
-  Volume_plane_interface* getItem() {
-    return item;
-  }
-
-Q_SIGNALS:
-  void finished(Volume_plane_thread*);
-
-protected:
-  const CGAL::Image_3* img;
-  Clamp_to_one_zero_range clamper;
-  Volume_plane_interface* item;
-  std::vector<float> buffer;
-  QString name;
-};
-
-template<typename Word>
-class X_plane_thread : public Volume_plane_thread {
-public:
- X_plane_thread(Volume_plane<x_tag>*p_it, const CGAL::Image_3* img, const Clamp_to_one_zero_range& clamp, const QString& name)
-  : Volume_plane_thread(img, clamp, name) { item = p_it;}
-protected:
-  void run();
-};
-
-template<typename Word>
-class Y_plane_thread : public Volume_plane_thread {
-public:
- Y_plane_thread(Volume_plane<y_tag>* p_it, const CGAL::Image_3* img, const Clamp_to_one_zero_range& clamp, const QString& name)
-  : Volume_plane_thread(img, clamp, name) {item = p_it; }
-protected:
-  void run();
-};
-
-template<typename Word>
-class Z_plane_thread : public Volume_plane_thread {
-public:
- Z_plane_thread(Volume_plane<z_tag>* p_it, const CGAL::Image_3* img, const Clamp_to_one_zero_range& clamp, const QString& name)
-  : Volume_plane_thread(img, clamp, name) {item = p_it;}
-protected:
-  void run();
-};
-
-template<typename Word>
-void X_plane_thread<Word>::run() {
-    buffer.reserve(img->size());
-    for(unsigned int i = 0; i < img->xdim(); ++i) {
-      for(unsigned int j = 0; j < img->ydim(); ++j) {
-        for(unsigned int k = 0; k < img->zdim(); ++k) {
-          float x = CGAL::IMAGEIO::static_evaluate<Word>(img->image(), i, j, k);
-          x = clamper(x);
-          buffer.push_back(x);
-        }
-      }
-    }
-    item->setData(static_cast<int>(img->ydim()), static_cast<int>(img->zdim()), static_cast<int>(img->xdim()),
-                         img->vx(), img->vy(), img->vz(), buffer);
-
-    item->setName(name);
-    item->moveToThread(QApplication::instance()->thread());
-    Q_EMIT finished(this);
-}
-
-template<typename Word>
-void Y_plane_thread<Word>::run() {
-      buffer.reserve(img->size());
-    for(unsigned int i = 0; i < img->ydim(); ++i) {
-      for(unsigned int j = 0; j < img->xdim(); ++j) {
-        for(unsigned int k = 0; k < img->zdim(); ++k) {
-          float x = CGAL::IMAGEIO::static_evaluate<Word>(img->image(), j, i, k);
-          x = clamper(x);
-          buffer.push_back(x);
-        }
-      }
-    }
-    item->setData(static_cast<int>(img->xdim()), static_cast<int>(img->zdim()), static_cast<int>(img->ydim()),
-                                   img->vx(), img->vy(), img->vz(), buffer);
-    item->setName(name);
-    item->moveToThread(QApplication::instance()->thread());
-    Q_EMIT finished(this);
-}
-
-template<typename Word>
-void Z_plane_thread<Word>::run() {
-  for(unsigned int i = 0; i < img->zdim(); ++i) {
-    for(unsigned int j = 0; j < img->xdim(); ++j) {
-      for(unsigned int k = 0; k < img->ydim(); ++k) {
-        float x = CGAL::IMAGEIO::static_evaluate<Word>(img->image(), j, k, i);
-        x = clamper(x);
-        buffer.push_back(x);
-      }
-    }
-  }
-  item->setData(static_cast<int>(img->xdim()), static_cast<int>(img->ydim()), static_cast<int>(img->zdim()),
-                                 img->vx(), img->vy(), img->vz(), buffer);
-  item->setName(name);
-  item->moveToThread(QApplication::instance()->thread());
-  Q_EMIT finished(this);
-}
-
-#endif /* CGAL_VOLUME_PLANE_THREAD_H */
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Volume_planes_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Volume_planes_plugin.cpp
deleted file mode 100644
index dabecde..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Volume_planes_plugin.cpp
+++ /dev/null
@@ -1,390 +0,0 @@
-
-#ifdef _MSC_VER
-#  pragma warning(disable:4244) // conversion with loss of data
-#endif
-
-#include <CGAL/config.h>
-#include "config.h"
-
-#include "Volume_plane.h"
-#include <CGAL/Image_3.h>
-
-#include "Volume_plane_thread.h"
-#include "Volume_plane_intersection.h"
-#include "Scene_segmented_image_item.h"
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-#include "Messages_interface.h"
-#include <CGAL/Three/Scene_interface.h>
-#include <CGAL/Three/Scene_item.h>
-#include <CGAL/Three/Viewer_interface.h>
-
-#include <QAction>
-#include <QMenu>
-#include <QList>
-#include <QInputDialog>
-#include <QSlider>
-#include <QLabel>
-#include <QHBoxLayout>
-#include <QVBoxLayout>
-#include <QDockWidget>
-#include <QMainWindow>
-#include <QMessageBox>
-#include <QString>
-#include <QFontMetrics>
-
-#include <cassert>
-#include <iostream>
-
-#include <boost/type_traits.hpp>
-#include <boost/optional.hpp>
-
-// Covariant return types don't work for scalar types and we cannot
-// have templates here, hence this unfortunate hack.
-
-// The input float value we are reading is always in
-// 0..1 and min_max is the range it came from.
-struct IntConverter {
-  std::pair<int, int> min_max;
-  
-  int operator()(float f) {
-    float s = f * (min_max.second - min_max.first);
-    return s + min_max.first;
-  }
-};
-
-struct DoubleConverter {
-  std::pair<float, float> min_max;
-
-  float operator()(float f) {
-    float s = f * (min_max.second - min_max.first);
-    return s + min_max.first;
-  }
-};
-
-class PixelReader : public QObject
-{
-Q_OBJECT
-
-
-Q_SIGNALS:
-  void x(int);
-
-public:
-  void setIC(const IntConverter& x) { ic = x; fc = boost::optional<DoubleConverter>(); }
-  void setFC(const DoubleConverter& x) { fc = x; ic = boost::optional<IntConverter>(); }
-  void setViewer(Viewer_interface* viewer) { this->viewer = viewer; }
-
-private:
-  boost::optional<IntConverter> ic;
-  boost::optional<DoubleConverter> fc;
-  Viewer_interface* viewer;
-
-  void getPixel(const QPoint& e) {
-    float data[3];
-    int vp[4];
-    viewer->glGetIntegerv(GL_VIEWPORT, vp);
-    viewer->glReadPixels(e.x(), vp[3] - e.y(), 1, 1, GL_RGB, GL_FLOAT, data);
-
-    if(fc) {
-      Q_EMIT x( (*fc)(data[0]) );
-    } else if(ic) {
-      Q_EMIT x( (*ic)(data[0]) );
-    }
-  }
-};
-
-
-class Plane_slider : public QSlider
-{
-  Q_OBJECT
-public:
-  Plane_slider(const qglviewer::Vec& v, int id, Scene_interface* scene,
-               qglviewer::ManipulatedFrame* frame, Qt::Orientation ori, QWidget* widget) 
-    : QSlider(ori, widget), v(v), id(id), scene(scene), frame(frame) { 
-    this->setTracking(true);
-    connect(frame,  SIGNAL(manipulated()), this, SLOT(updateValue()));
-  }
-
-public:
-  void sliderChange(SliderChange c) {
-    QSlider::sliderChange(c);
-    if(c == SliderValueChange) {
-      qglviewer::Vec v2 = v * (this->value() / scale);
-      frame->setTranslationWithConstraint(v2);
-      scene->itemChanged(id);
-    }
-
-    Q_EMIT realChange(this->value() / scale);
-  }
-
-public Q_SLOTS:
-  void updateValue() {
-#if QGLVIEWER_VERSION >= 0x020600
-    typedef qreal qglviewer_real;
-#else // QGLViewer < 2.6.0
-    typedef float qglviewer_real;
-#endif // QGLViewer < 2.6.0
-    qglviewer_real a, b, c;
-    frame->getPosition(a, b, c);
-    float sum1 = float(a + b + c);
-    float sum2 = float(v.x + v.y + v.z);
-    sum1 /= sum2;
-    setValue(sum1 * scale);
-  }
-
-Q_SIGNALS:
-  void realChange(int);
-
-private:
-  static const unsigned int scale;
-
-  qglviewer::Vec v;
-  int id;
-  Scene_interface* scene;
-  qglviewer::ManipulatedFrame* frame;
-};
-
-const unsigned int Plane_slider::scale = 100;
-
-class Volume_plane_plugin :
-  public QObject,
-  public CGAL::Three::Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-public:
-  Volume_plane_plugin() : planeSwitch(NULL)
-    {
-    }
-
-  bool applicable(QAction*) const {
-    return qobject_cast<Scene_segmented_image_item*>(scene->item(scene->mainSelectionIndex()));
-  }
-
-
-  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface) {
-    this->scene = scene_interface;
-    this->mw = mainWindow;
-    planeSwitch = new QAction("Add Volume Planes", mw);
-    if(planeSwitch) {
-      planeSwitch->setProperty("subMenuName", "3D Mesh Generation");
-      connect(planeSwitch, SIGNAL(triggered()),
-              this, SLOT(selectPlanes()));
-    }
-    Viewer_interface* v = mw->findChild<Viewer_interface*>("viewer");
-    CGAL_assertion(v != 0);
-    pxr_.setViewer(v);
-    createOrGetDockLayout();
-
-  }
-  QList<QAction*> actions() const {
-    return QList<QAction*>() << planeSwitch;
-  }
-  virtual void closure()
-  {
-      QDockWidget* controlDockWidget = mw->findChild<QDockWidget*>("volumePlanesControl");
-      if(controlDockWidget)
-          controlDockWidget->hide();
-  }
-public Q_SLOTS:
-  void selectPlanes() {
-    std::vector< Scene_segmented_image_item* > seg_items;
-    Scene_segmented_image_item* seg_img = NULL;
-    for(int i = 0; i < scene->numberOfEntries(); ++i) {
-      Scene_segmented_image_item* tmp = qobject_cast<Scene_segmented_image_item*>(scene->item(i));
-      if(tmp != NULL){
-        seg_items.push_back(tmp);
-      }
-    }
-    if(seg_items.empty()) {
-      QMessageBox::warning(mw, tr("No suitable item found"), tr("Load an inrimage or hdr file to enable Volume Planes."));
-      return;
-    } else {
-      QList<QString> items;
-      for(std::vector< Scene_segmented_image_item* >::const_iterator it = seg_items.begin(); 
-          it != seg_items.end(); ++it) { 
-        items << (*it)->name();
-      }
-      bool ok;
-      QString selected = QInputDialog::getItem(mw, tr("Select a dataset:"), tr("Items"), items, 0, false, &ok);
-      if(!ok || selected.isEmpty())
-        return;
-      for(std::vector< Scene_segmented_image_item*>::const_iterator it = seg_items.begin(); 
-          it != seg_items.end(); ++it) { 
-        if(selected == (*it)->name())
-          seg_img = *it;
-      }
-    }
-    
-    if(!(seg_img == NULL)) {
-      const CGAL::Image_3* img = seg_img->image();
-      CGAL_IMAGE_IO_CASE(img->image(), this->launchAdders<Word>(img, seg_img->name()))
-
-      Volume_plane_intersection* i = new Volume_plane_intersection(img->xdim() * img->vx(), 
-                                                                   img->ydim() * img->vy(), 
-                                                                   img->zdim() * img->vz());
-      this->intersectionId = scene->addItem(i);
-    } else {
-      QMessageBox::warning(mw, tr("Something went wrong"), tr("Selected a suitable Object but couldn't get an image pointer."));
-      return;
-    }
-
-  }
-
-  void addVP(Volume_plane_thread* thread) {
-    Volume_plane_interface* plane = thread->getItem();
-    plane->init();
-
-    // add the interface for this Volume_plane
-    int id = scene->addItem(plane);
-    
-    QLayout* layout = createOrGetDockLayout();
-    
-    QWidget* controls = new QWidget;
-    QHBoxLayout* box = new QHBoxLayout(controls);
-    layout->addWidget(controls);
-
-    QLabel* label = new QLabel(controls);
-    label->setText(plane->name());
-
-    QLabel* cubeLabel = new QLabel(controls);
-    cubeLabel->setNum(static_cast<int>(plane->getCurrentCube()));
-    
-    // Find the right width for the label to accommodate at least 9999
-    QFontMetrics metric = cubeLabel->fontMetrics();
-    cubeLabel->setFixedWidth(metric.width(QString("9999")));
-
-    QSlider* slider = new Plane_slider(plane->translationVector(), id, scene, plane->manipulatedFrame(),
-                                       Qt::Horizontal, controls);
-    slider->setRange(0, (plane->cDim() - 1) * 100);
-
-    connect(slider, SIGNAL(realChange(int)), cubeLabel, SLOT(setNum(int)));
-    connect(plane, SIGNAL(manipulated(int)), cubeLabel, SLOT(setNum(int)));
-    
-    box->addWidget(label);
-    box->addWidget(slider);
-    box->addWidget(cubeLabel);
-    
-    connect(plane, SIGNAL(aboutToBeDestroyed()), controls, SLOT(deleteLater()));
-
-    std::vector<Volume_plane_thread*>::iterator it = std::find(threads.begin(), threads.end(), thread);
-
-    // this slot has been connected to a thread that hasn't been
-    // registered here.
-    assert(it != threads.end());
-    delete *it;
-    threads.erase(it);
-
-    Volume_plane_intersection* intersection = dynamic_cast<Volume_plane_intersection*>(scene->item(intersectionId));
-    if(!intersection) {
-      // the intersection is gone before it was initialized
-      return;
-    }
-    // FIXME downcasting mode
-    // FIXME this will bug if two volume planes are generated simultaneously by the plugin
-    if(Volume_plane<x_tag>* p = dynamic_cast< Volume_plane<x_tag>* >(plane)) {
-      intersection->setX(p);
-    } else if(Volume_plane<y_tag>* p = dynamic_cast< Volume_plane<y_tag>* >(plane)) {
-      intersection->setY(p);
-    } else if(Volume_plane<z_tag>* p = dynamic_cast< Volume_plane<z_tag>* >(plane)) {
-      intersection->setZ(p);
-    }
-
-    connect(plane, SIGNAL(planeDestructionIncoming(Volume_plane_interface*)), 
-            intersection, SLOT(planeRemoved(Volume_plane_interface*)));
-  }
- 
-private:
-  QAction* planeSwitch;
-  PixelReader pxr_;
-
-  std::vector<Volume_plane_thread*> threads;
-  unsigned int intersectionId;
-
-  QLayout* createOrGetDockLayout() {
-    QLayout* layout = NULL;
-    QDockWidget* controlDockWidget = mw->findChild<QDockWidget*>("volumePlanesControl");;
-
-    if(!controlDockWidget) {
-      controlDockWidget = new QDockWidget(mw);
-      controlDockWidget->setObjectName("volumePlanesControl");
-      QWidget* content = new QWidget(controlDockWidget);
-      layout = new QVBoxLayout(content);
-      layout->setObjectName("vpSliderLayout");
-      controlDockWidget->setWindowTitle("Control Widget");
-      mw->addDockWidget(Qt::LeftDockWidgetArea, controlDockWidget);
-      
-      QWidget* vlabels = new QWidget(content);
-      layout->addWidget(vlabels);
-      QHBoxLayout* vbox = new QHBoxLayout(vlabels);
-      vbox->setAlignment(Qt::AlignJustify);
-
-      QLabel* text = new QLabel(vlabels);
-      text->setText("Isovalue at point:");
-      QLabel* x = new QLabel(vlabels);
-
-      connect(&pxr_, SIGNAL(x(int)), x, SLOT(setNum(int)));
-      
-      vbox->addWidget(text); vbox->addWidget(x);
-      controlDockWidget->setWidget(content);
-      controlDockWidget->hide();
-
-    } else {
-      layout = controlDockWidget->findChild<QLayout*>("vpSliderLayout");
-      controlDockWidget->show();
-    }
-
-    return layout;
-  }
-
-  template<typename Word>
-  void launchAdders(const CGAL::Image_3* img, const QString& name) {
-    const Word* begin = (const Word*)img->data();
-    const Word* end = (const Word*)img->data() + img->size();
-
-    std::pair<const Word, const Word> minmax(*std::min_element(begin, end), *std::max_element(begin, end));
-
-    Clamp_to_one_zero_range clamper = { minmax };
-
-    switchReaderConverter< Word >(minmax);
-    
-    Volume_plane<x_tag> *xitem = new Volume_plane<x_tag>();
-    Volume_plane<y_tag> *yitem = new Volume_plane<y_tag>();
-    Volume_plane<z_tag> *zitem = new Volume_plane<z_tag>();
-
-    threads.push_back(new X_plane_thread<Word>(xitem, img, clamper, name));
-    connect(threads.back(), SIGNAL(finished(Volume_plane_thread*)), this, SLOT(addVP(Volume_plane_thread*)));
-    threads.back()->start();
-    
-    threads.push_back(new Y_plane_thread<Word>(yitem,img, clamper, name));
-    connect(threads.back(), SIGNAL(finished(Volume_plane_thread*)), this, SLOT(addVP(Volume_plane_thread*)));
-    threads.back()->start();
-
-    threads.push_back(new Z_plane_thread<Word>(zitem,img, clamper, name));
-    connect(threads.back(), SIGNAL(finished(Volume_plane_thread*)), this, SLOT(addVP(Volume_plane_thread*)));
-    threads.back()->start();
-
-  }
-
-  template<typename T>
-  void switchReaderConverter(std::pair<T, T> minmax) { 
-    switchReaderConverter(minmax, typename boost::is_integral<T>::type()); 
-  }
-
-  template<typename T>
-  void switchReaderConverter(std::pair<T, T> minmax, boost::true_type) {
-    // IntConverter
-    IntConverter x = { minmax }; pxr_.setIC(x);
-  }
-
-  template<typename T>
-  void switchReaderConverter(std::pair<T, T> minmax, boost::false_type) {
-    // IntConverter
-    DoubleConverter x = { minmax }; pxr_.setFC(x);
-  }
-};
-
-#include "Volume_planes_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Operations_on_polyhedra/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Operations_on_polyhedra/CMakeLists.txt
deleted file mode 100644
index 38eeb29..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Operations_on_polyhedra/CMakeLists.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-include( polyhedron_demo_macros )
- qt5_wrap_ui( clip_polyhedronUI_FILES Clip_polyhedron_plugin.ui )
- polyhedron_demo_plugin(clip_polyhedron_plugin Clip_polyhedron_plugin ${clip_polyhedronUI_FILES})
- target_link_libraries(clip_polyhedron_plugin  scene_polyhedron_item scene_basic_objects)
- polyhedron_demo_plugin(corefinement_plugin Corefinement_plugin)
- target_link_libraries(corefinement_plugin  scene_polyhedron_item scene_combinatorial_map_item scene_polylines_item)
- polyhedron_demo_plugin(intersection_plugin Intersection_plugin)
- target_link_libraries(intersection_plugin  scene_polyhedron_item scene_polylines_item)
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.cpp
deleted file mode 100644
index 11cb3b1..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.cpp
+++ /dev/null
@@ -1,232 +0,0 @@
-#include "Messages_interface.h"
-#include <QApplication>
-#include <QMainWindow>
-#include <QAction>
-#include <QVector>
-#include "Scene_polyhedron_item.h"
-#include "Scene_plane_item.h"
-#include <CGAL/Three/Viewer_interface.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <CGAL/internal/Polyhedron_plane_clipping_3.h>
-#include "ui_Clip_polyhedron_plugin.h"
-#include "Viewer.h"
-
-
-using namespace CGAL::Three;
-// The special 2 faces plane
-class Scene_clipping_plane_item : public Scene_plane_item
-{
-  Q_OBJECT
-
-public:
-  Scene_clipping_plane_item(const CGAL::Three::Scene_interface* scene_interface)
-    :Scene_plane_item(scene_interface)
-  {
-  }
-
-  void draw(CGAL::Three::Viewer_interface* viewer)const
-  {
-    if(!are_buffers_filled)
-      initialize_buffers(viewer);
-    vaos[Facets]->bind();
-    program = getShaderProgram(PROGRAM_PLANE_TWO_FACES);
-    attrib_buffers(viewer, PROGRAM_PLANE_TWO_FACES);
-    QMatrix4x4 f_matrix;
-    for(int i=0; i<16; i++)
-      f_matrix.data()[i] = (float)frame->matrix()[i];
-    program->bind();
-    program->setUniformValue("f_matrix", f_matrix);
-    program->setAttributeValue("colors",this->color());
-    QVector3D normal;
-    normal.setX(plane().orthogonal_vector().x());normal.setY(plane().orthogonal_vector().y());normal.setZ(plane().orthogonal_vector().z());
-    program->setUniformValue("plane_normal", normal);
-    QVector3D vd;
-    vd.setX(viewer->camera()->position().x); vd.setY(viewer->camera()->position().y); vd.setZ(viewer->camera()->position().z);
-    program->setUniformValue("dirView", vd);
-    QVector3D pp;
-    pp.setX(plane().point().x());pp.setY(plane().point().y());pp.setZ(plane().point().z());
-    program->setUniformValue("plane_pos", pp);
-
-    viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(positions_quad.size()/3));
-    program->release();
-    vaos[Facets]->release();
-
-  }
-
-private:
-  void initialize_buffers(CGAL::Three::Viewer_interface *viewer) const
-  {
-    program = getShaderProgram(PROGRAM_PLANE_TWO_FACES, viewer);
-    program->bind();
-    vaos[Facets]->bind();
-
-    buffers[Facets_vertices].bind();
-    buffers[Facets_vertices].allocate(positions_quad.data(),
-                                      static_cast<int>(positions_quad.size()*sizeof(float)));
-    program->enableAttributeArray("vertex");
-    program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
-    buffers[Facets_vertices].release();
-    vaos[Facets]->release();
-
-
-    vaos[Edges]->bind();
-    buffers[Edges_vertices].bind();
-    buffers[Edges_vertices].allocate(positions_lines.data(),
-                                     static_cast<int>(positions_lines.size()*sizeof(float)));
-    program->enableAttributeArray("vertex");
-    program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
-    buffers[Edges_vertices].release();
-    vaos[Edges]->release();
-
-    program->release();
-    are_buffers_filled = true;
-
-  }
-}; //end of class Scene_triangle_item
-
-
-class Q_DECL_EXPORT Clip_polyhedron_plugin :
-    public QObject,
-    public CGAL::Three::Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-public :
-  // To silent a warning -Woverloaded-virtual
-  // See http://stackoverflow.com/questions/9995421/gcc-woverloaded-virtual-warnings
-  using Polyhedron_demo_plugin_helper::init;
-  // Adds an action to the menu and configures the widget
-  void init(QMainWindow* mainWindow,
-            CGAL::Three::Scene_interface* scene_interface,
-            Messages_interface* mi) {
-    //get the references
-    this->scene = scene_interface;
-    this->mw = mainWindow;
-    this->messages = mi;
-    plane = NULL;
-    //creates and link the actions
-    actionClipPolyhedra = new QAction("Clip Polyhedra", mw);
-    actionClipPolyhedra->setProperty("subMenuName","Operations on Polyhedra");
-    dock_widget = new QDockWidget("Polyhedra Clipping", mw);
-    dock_widget->setVisible(false); // do not show at the beginning
-    ui_widget.setupUi(dock_widget);
-    mw->addDockWidget(Qt::LeftDockWidgetArea, dock_widget);
-
-    if(actionClipPolyhedra ) {
-      connect(actionClipPolyhedra , SIGNAL(triggered()),
-              this, SLOT(pop_widget()));
-      connect(ui_widget.clipButton, SIGNAL(clicked()),
-              this, SLOT(clip_polyhedron()));
-    }
-  }
-  bool applicable(QAction*) const
-  {
-    Q_FOREACH(int id, scene->selectionIndices())
-    {
-      if(qobject_cast<Scene_polyhedron_item*>(scene->item(id)))
-        return true;
-    }
-    return false;
-  }
-  QList<QAction*> actions() const {
-    return QList<QAction*>() << actionClipPolyhedra;
-  }
-  void closure() {
-    dock_widget->hide();
-  }
-public Q_SLOTS:
-  void on_plane_destroyed()
-  {
-    plane = NULL;
-    dock_widget->hide();
-  }
-  void pop_widget()
-  {
-    if(dock_widget->isVisible()) { dock_widget->hide(); }
-    else                         { dock_widget->show(); }
-
-    //creates a new  cutting_plane;
-    if(!plane)
-    {
-      const Scene_interface::Bbox scene_bbox = scene->bbox();
-      plane = new Scene_clipping_plane_item(scene);
-      plane->setNormal(0., 0., 1.);
-      plane->setPosition((scene_bbox.xmin + scene_bbox.xmax)/2.,
-                         (scene_bbox.ymin + scene_bbox.ymax)/2.,
-                         (scene_bbox.zmin + scene_bbox.zmax)/2.);
-      plane->setManipulatable(true);
-      plane->setClonable(false);
-      plane->setColor(QColor(0,126,255));
-      plane->setFlatMode();
-      plane->setName(tr("Clipping plane"));
-      connect(plane, SIGNAL(destroyed()),
-              this, SLOT(on_plane_destroyed()));
-      scene->addItem(plane);
-    }
-  }
-  void clip_polyhedron()
-  {
-    if(!plane)
-      return;
-    else
-    {
-      QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
-      QList<Scene_polyhedron_item*> polyhedra;
-
-      //Fills the list of target polyhedra and the cutting plane
-      Q_FOREACH(int id, scene->selectionIndices())
-      {
-        Scene_polyhedron_item *target_item = qobject_cast<Scene_polyhedron_item*>(scene->item(id));
-        if(target_item)
-        {
-          polyhedra << target_item;
-        }
-      }
-
-      //apply the clipping function
-      Q_FOREACH(Scene_polyhedron_item* poly, polyhedra)
-      {
-        if(ui_widget.close_checkBox->isChecked() && poly->polyhedron()->is_closed())
-        {
-          Polyhedron * polyhedron = CGAL::corefinement::clip_polyhedron(*(poly->polyhedron()),plane->plane());
-          if(polyhedron)
-          {
-            Scene_polyhedron_item* new_item = new Scene_polyhedron_item(polyhedron);
-            new_item->setName(poly->name());
-            new_item->setColor(poly->color());
-            new_item->setRenderingMode(poly->renderingMode());
-            new_item->setVisible(poly->visible());
-            new_item->invalidateOpenGLBuffers();
-            new_item->setProperty("source filename", poly->property("source filename"));
-            scene->replaceItem(scene->item_id(poly),new_item);
-            delete poly;
-            new_item->invalidateOpenGLBuffers();
-            viewer->updateGL();
-            messages->information(QString("%1 clipped").arg(new_item->name()));
-          }
-          else
-          {
-             messages->information(QString("Could not clip %1 : returned polyhedron is null.").arg(poly->name()));
-             delete polyhedron;
-          }
-        }
-        else
-        {
-          CGAL::corefinement::inplace_clip_open_polyhedron(*(poly->polyhedron()),plane->plane());
-          poly->invalidateOpenGLBuffers();
-          viewer->updateGL();
-          messages->information(QString("%1 clipped").arg(poly->name()));
-        }
-      }
-    }
-  }
-private:
-  QAction* actionClipPolyhedra;
-  Ui::ClipPolyhedronWidget ui_widget;
-  QDockWidget* dock_widget;
-  Scene_clipping_plane_item* plane;
-  Messages_interface* messages;
-}; //end of plugin class
-#include "Clip_polyhedron_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.ui b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.ui
deleted file mode 100644
index 7c5473b..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.ui
+++ /dev/null
@@ -1,90 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>ClipPolyhedronWidget</class>
- <widget class="QDockWidget" name="ClipPolyhedronWidget">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>364</width>
-    <height>258</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Clip Polyhedra</string>
-  </property>
-  <widget class="QWidget" name="dockWidgetContents">
-   <layout class="QVBoxLayout" name="verticalLayout_2">
-    <item>
-     <layout class="QVBoxLayout" name="verticalLayout">
-      <item>
-       <widget class="QLabel" name="label">
-        <property name="text">
-         <string><html><head/><body><p>This function allows to clip all the selected polyhedra against a halfspace. What is on the blue side of the clipping plane will be clipped, and what is on the yellow side will be kept.<br/><br/>If the option <span style=" font-style:italic;">keep closed</span> is checked, the clipped part of each polyhedron will be closed, if it has a closed contour on the clipping plane. Otherwise, it will  [...]
-        </property>
-        <property name="wordWrap">
-         <bool>true</bool>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <spacer name="verticalSpacer">
-        <property name="orientation">
-         <enum>Qt::Vertical</enum>
-        </property>
-        <property name="sizeHint" stdset="0">
-         <size>
-          <width>20</width>
-          <height>40</height>
-         </size>
-        </property>
-       </spacer>
-      </item>
-      <item>
-       <layout class="QHBoxLayout" name="horizontalLayout">
-        <item>
-         <widget class="QCheckBox" name="close_checkBox">
-          <property name="layoutDirection">
-           <enum>Qt::LeftToRight</enum>
-          </property>
-          <property name="autoFillBackground">
-           <bool>false</bool>
-          </property>
-          <property name="text">
-           <string>&Keep Closed</string>
-          </property>
-         </widget>
-        </item>
-        <item>
-         <spacer name="horizontalSpacer">
-          <property name="orientation">
-           <enum>Qt::Horizontal</enum>
-          </property>
-          <property name="sizeHint" stdset="0">
-           <size>
-            <width>40</width>
-            <height>20</height>
-           </size>
-          </property>
-         </spacer>
-        </item>
-        <item>
-         <widget class="QPushButton" name="clipButton">
-          <property name="text">
-           <string>&Clip</string>
-          </property>
-         </widget>
-        </item>
-       </layout>
-      </item>
-      <item>
-       <layout class="QHBoxLayout" name="horizontalLayout_2"/>
-      </item>
-     </layout>
-    </item>
-   </layout>
-  </widget>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Operations_on_polyhedra/Corefinement_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Operations_on_polyhedra/Corefinement_plugin.cpp
deleted file mode 100644
index 4827e30..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Operations_on_polyhedra/Corefinement_plugin.cpp
+++ /dev/null
@@ -1,181 +0,0 @@
-#define CGAL_COREFINEMENT_DO_REPORT_SELF_INTERSECTIONS
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-#include <CGAL/corefinement_operations.h>
-#include <CGAL/bounding_box.h>
-#include "Scene_polyhedron_item.h"
-#include "Scene_combinatorial_map_item.h"
-#include "Polyhedron_type.h"
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-
-#include "Scene_polylines_item.h"
-
-#include <QString>
-#include <QAction>
-#include <QMenu>
-#include <QMainWindow>
-#include <QApplication>
-#include <QTime>
-#include <QMessageBox>
-
-//#define PRINT_EACH_VOLUME
-using namespace CGAL::Three;
-class Polyhedron_demo_corefinement_plugin :
-  public QObject,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-public:
-
-  bool applicable(QAction*) const { 
-    return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
-  }
-
-  QList<QAction*> actions() const {
-    return QList<QAction*>() << actionPolyhedronCorefinement_3;
-  }
-
-  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface) {
-    this->scene = scene_interface;
-    this->mw = mainWindow;
-    actionPolyhedronCorefinement_3 = new QAction("Polyhedra Corefinement (A/B)", mw);
-    actionPolyhedronCorefinement_3->setProperty("subMenuName", "Operations on Polyhedra");
-    if(actionPolyhedronCorefinement_3) {
-      connect(actionPolyhedronCorefinement_3, SIGNAL(triggered()),
-              this, SLOT(corefinement()));
-    }
-  }
-
-private:
-
-  QAction*  actionPolyhedronCorefinement_3;
-
-public Q_SLOTS:
-  void corefinement();
-
-}; // end class Polyhedron_demo_corefinement_plugin
-
-
-struct Is_on_polyline{
-  bool operator()(Polyhedron::Halfedge_handle he) const { 
-    return he->is_feature_edge();
-  }
-};
-
-struct Set_vertex_corner{
-  template <typename Info>
-  void add_info_to_node(int, Polyhedron*,const Info&) {
-  }
-
-  void operator()(Polyhedron::Vertex_handle v, int, Polyhedron*) {
-    ++v->nb_of_feature_edges;
-  }
-};
-
-void Polyhedron_demo_corefinement_plugin::corefinement()
-{
-  int indexA = scene->selectionAindex();
-  int indexB = scene->selectionBindex();
-
-  Scene_polyhedron_item* itemA = 
-    qobject_cast<Scene_polyhedron_item*>(scene->item(indexA));
-  Scene_polyhedron_item* itemB = 
-    qobject_cast<Scene_polyhedron_item*>(scene->item(indexB));
-  if(!itemA || !itemB || itemA == itemB)
-  {
-    Q_FOREACH(int index, scene->selectionIndices()) {
-      Scene_polyhedron_item* item = 
-        qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-      if(!item)
-        return;
-    }
-    if(scene->selectionIndices().size() == 2) {
-      indexA = scene->selectionIndices()[0];
-      indexB = scene->selectionIndices()[1];
-      itemA = 
-        qobject_cast<Scene_polyhedron_item*>(scene->item(indexA));
-      itemB = 
-        qobject_cast<Scene_polyhedron_item*>(scene->item(indexB));
-    }
-  }
-  std::vector<Polyhedron*> poly_ptrs;
-  Q_FOREACH(int index, scene->selectionIndices()) {
-    Scene_polyhedron_item* item = 
-      qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-    if(!item)
-      return;
-    else if(item != itemA) {
-      poly_ptrs.push_back(item->polyhedron());
-      if(poly_ptrs.back() == 0) return;
-    }
-  }
-
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-
-  if(itemA && itemB && itemA != itemB) {
-  
-   // perform Boolean operation
-    QTime time;
-    time.start();
-
-    //since the visitor modify input polyhedra, we make copies.
-    Polyhedron A( *itemA->polyhedron() );
-    Polyhedron B( *itemB->polyhedron() );
-    
-    itemA->setVisible(false);
-    itemB->setVisible(false);
-    
-    Scene_polylines_item* new_item = new Scene_polylines_item();
-    
-  #ifdef _COREFINEMENT_OUTPUT_IS_POLYHEDRON
-    typedef CGAL::Polyhedron_corefinement<Polyhedron> Corefinement;
-    Corefinement corefinement;
-
-    typedef std::list<std::pair<Polyhedron*,int> > Decomposition;
-    Decomposition decomposition;
-    
-    #ifndef PRINT_EACH_VOLUME
-    int features=Corefinement::Join_tag+Corefinement::Intersection_tag+Corefinement::P_minus_Q_tag+Corefinement::Q_minus_P_tag;
-    #else
-    int features=Corefinement::Decomposition_tag;
-    #endif
-    corefinement(A, B, std::back_inserter(new_item->polylines),std::back_inserter(decomposition),features);
-    
-    
-    for (Decomposition::iterator it=decomposition.begin();it!=decomposition.end();++it)
-    {
-      Polyhedron* new_poly=it->first;
-      Scene_polyhedron_item* new_item_bool= new Scene_polyhedron_item(new_poly);
-      new_item_bool->setName(
-        QString::fromStdString(
-          corefinement.get_type_str(itemA->name().toStdString(),itemB->name().toStdString(),it->second)
-        )
-      );
-      scene->addItem(new_item_bool);
-    }
-  #else  
-    Scene_combinatorial_map_item* cmap_item = new Scene_combinatorial_map_item(scene,static_cast<void*>(&A)); 
-    typedef CGAL::Node_visitor_refine_polyhedra<Polyhedron> Split_visitor; 
-    cmap_item->m_combinatorial_map=new Combinatorial_map_3();
-    Split_visitor visitor(cmap_item->m_combinatorial_map);
-    CGAL::Intersection_of_Polyhedra_3<Polyhedron,Kernel,Split_visitor> polyline_intersections(visitor);
-    polyline_intersections(A, B, std::back_inserter(new_item->polylines));
-    cmap_item->setName(QString("%1_and_%2_corefined").arg(itemA->name()).arg(itemB->name()));
-    scene->addItem(cmap_item);
-  #endif
-    new_item->setName(tr("boundary intersection"));
-    new_item->setColor(Qt::green);
-    new_item->setRenderingMode(Wireframe);
-    scene->addItem(new_item);  
-    new_item->invalidateOpenGLBuffers();
-    std::cout << "ok (" << time.elapsed() << " ms)" << std::endl;
-      
-  }
-
-  QApplication::restoreOverrideCursor();
-}
-
-#include "Corefinement_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Operations_on_polyhedra/Intersection_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Operations_on_polyhedra/Intersection_plugin.cpp
deleted file mode 100644
index 00dafd7..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Operations_on_polyhedra/Intersection_plugin.cpp
+++ /dev/null
@@ -1,220 +0,0 @@
-#define CGAL_COREFINEMENT_DO_REPORT_SELF_INTERSECTIONS
-#define CGAL_USE_SEGMENT_APPROACH
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-#ifdef CGAL_USE_SEGMENT_APPROACH
-#include <CGAL/intersection_of_Polyhedra_3.h>
-#else
-#include <CGAL/intersection_Polyhedron_3_Polyhedron_3.h>
-#endif
-#include <CGAL/iterator.h>
-#include <CGAL/bounding_box.h>
-#include "Scene_polyhedron_item.h"
-#include "Polyhedron_type.h"
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-
-#include "Scene_polylines_item.h"
-
-#include <boost/foreach.hpp>
-
-#include <QString>
-#include <QAction>
-#include <QMenu>
-#include <QMainWindow>
-#include <QApplication>
-#include <QTime>
-#include <QMessageBox>
-using namespace CGAL::Three;
-class Polyhedron_demo_intersection_plugin :
-  public QObject,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-public:
-
-  bool applicable(QAction*) const { 
-    return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
-  }
-
-  QList<QAction*> actions() const {
-    return QList<QAction*>() << actionPolyhedronIntersection_3;
-  }
-
-  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface) {
-    this->scene = scene_interface;
-    this->mw = mainWindow;
-    actionPolyhedronIntersection_3 = new QAction("Intersect Polyhedra (A/B)", mw);
-    actionPolyhedronIntersection_3->setProperty("subMenuName", "Operations on Polyhedra");
-    if(actionPolyhedronIntersection_3) {
-      connect(actionPolyhedronIntersection_3, SIGNAL(triggered()),
-              this, SLOT(intersection()));
-    }
-  }
-
-private:
-
-  QAction*  actionPolyhedronIntersection_3;
-
-public Q_SLOTS:
-  void intersection();
-
-}; // end class Polyhedron_demo_intersection_plugin
-
-
-#ifdef CGAL_USE_SEGMENT_APPROACH
-struct Is_on_polyline{
-  bool operator()(Polyhedron::Halfedge_handle he) const { 
-    return he->is_feature_edge();
-  }
-};
-
-struct Set_vertex_corner{
-  template <typename Info>
-  void add_info_to_node(int, Polyhedron*,const Info&) {
-  }
-
-  void operator()(Polyhedron::Vertex_handle v, int, Polyhedron*) {
-    ++v->nb_of_feature_edges;
-  }
-};
-#endif
-
-void Polyhedron_demo_intersection_plugin::intersection()
-{
-  int indexA = scene->selectionAindex();
-  int indexB = scene->selectionBindex();
-
-  Scene_polyhedron_item* itemA = 
-    qobject_cast<Scene_polyhedron_item*>(scene->item(indexA));
-  Scene_polyhedron_item* itemB = 
-    qobject_cast<Scene_polyhedron_item*>(scene->item(indexB));
-  if(!itemA || !itemB || itemA == itemB)
-  {
-    Q_FOREACH(int index, scene->selectionIndices()) {
-      Scene_polyhedron_item* item = 
-        qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-      if(!item)
-        return;
-    }
-    if(scene->selectionIndices().size() == 2) {
-      indexA = scene->selectionIndices()[0];
-      indexB = scene->selectionIndices()[1];
-      itemA = 
-        qobject_cast<Scene_polyhedron_item*>(scene->item(indexA));
-      itemB = 
-        qobject_cast<Scene_polyhedron_item*>(scene->item(indexB));
-    }
-  }
-#ifndef CGAL_USE_SEGMENT_APPROACH
-  if(!itemA || !itemB || itemA == itemB)
-    return;
-#else
-  std::vector<Polyhedron*> poly_ptrs;
-  Q_FOREACH(int index, scene->selectionIndices()) {
-    Scene_polyhedron_item* item = 
-      qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-    if(!item)
-      return;
-    else if(item != itemA) {
-      poly_ptrs.push_back(item->polyhedron());
-      if(poly_ptrs.back() == 0) return;
-    }
-  }
-#endif
-
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-
-  Scene_polylines_item* new_item = new Scene_polylines_item();
- // perform Boolean operation
-  QTime time;
-  time.start();
-
-#ifdef CGAL_USE_SEGMENT_APPROACH
-  typedef CGAL::Node_visitor_for_polyline_split<Polyhedron,
-    Is_on_polyline, Set_vertex_corner> Split_visitor;
-
-  CGAL::Intersection_of_Polyhedra_3<Polyhedron,
-    Kernel,
-    Split_visitor> polyline_intersections;
-
-  typedef std::pair<Polyhedron::Facet_handle,
-                    Polyhedron::Facet_handle> Pair_of_facet_handles;
-  typedef std::vector<Pair_of_facet_handles> Polyline_info;
-  typedef std::vector<Polyline_info> Polylines_infos;
-  Polylines_infos polylines_infos;
-
-  typedef Scene_polylines_item::Polylines_container Polylines_container;
-  typedef std::back_insert_iterator<Polylines_container> To_container;
-  typedef std::back_insert_iterator<Polylines_infos> To_infos;
-  To_container to_container(new_item->polylines);
-  To_infos to_infos(polylines_infos);
-  CGAL::Dispatch_output_iterator<
-    CGAL::cpp11::tuple<Polylines_container::value_type,
-                       Polyline_info>,
-    CGAL::cpp11::tuple<To_container, 
-                       To_infos> > out_iterator(to_container,
-                                                to_infos);
-
-  if(itemA && itemB && itemA != itemB) {
-    Polyhedron* A = itemA->polyhedron();
-    Polyhedron* B = itemB->polyhedron();
-    polyline_intersections(*A, *B, out_iterator);
-  } else {
-    if(itemA) {
-      Polyhedron* A = itemA->polyhedron();
-      polyline_intersections(*A, 
-                             poly_ptrs.begin(),
-                             poly_ptrs.end(),
-                             out_iterator,
-                             0);
-    } else {
-      polyline_intersections(poly_ptrs.begin(),
-                             poly_ptrs.end(),
-                             out_iterator,
-                             0);
-    }
-  }
-  QStringList polylines_metadata;
-  BOOST_FOREACH(Polyline_info& info, polylines_infos) {
-    std::set<int> indices;
-    BOOST_FOREACH(Pair_of_facet_handles p, info)
-    {
-      indices.insert(p.first->patch_id());
-      indices.insert(p.second->patch_id());
-    }
-    QString metadata;
-    BOOST_FOREACH(int index, indices) {
-      metadata = metadata + QString(" %1").arg(index);
-    }
-    std::cerr << "new polyline metadata: " << qPrintable(metadata) << "\n";
-    polylines_metadata << metadata;
-  }
-  new_item->setProperty("polylines metadata", polylines_metadata);
-  new_item->setName(tr("intersection"));
-#else
-  Polyhedron* A = itemA->polyhedron();
-  Polyhedron* B = itemB->polyhedron();
-  CGAL::intersection_Polyhedron_3_Polyhedron_3(*A, *B, std::back_inserter(new_item->polylines));
-
-  QString name = tr("%1 intersection %2");
-   
-  new_item->setName(name.arg(itemA->name(), itemB->name()));
-  itemA->setRenderingMode(Wireframe);
-  itemB->setRenderingMode(Wireframe);
-  scene->itemChanged(indexA);
-  scene->itemChanged(indexB);
-#endif
-  std::cout << "ok (" << time.elapsed() << " ms)" << std::endl;
-
-  new_item->setColor(Qt::green);
-  new_item->setRenderingMode(Wireframe);
-  scene->addItem(new_item);
-  new_item->invalidateOpenGLBuffers();
-
-  QApplication::restoreOverrideCursor();
-}
-
-#include "Intersection_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Operations_on_polyhedra/Scene_combinatorial_map_item.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Operations_on_polyhedra/Scene_combinatorial_map_item.cpp
deleted file mode 100644
index 6780b15..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Operations_on_polyhedra/Scene_combinatorial_map_item.cpp
+++ /dev/null
@@ -1,522 +0,0 @@
-#include "Scene_combinatorial_map_item.h"
-#include "Scene_polyhedron_item.h"
-#include <CGAL/Three/Scene_interface.h>
-#include <CGAL/Three/Viewer_interface.h>
-
-#include <QObject>
-#include <QMenu>
-#include <QAction>
-#include <QtDebug>
-#include <QDebug>
-#include <QKeyEvent>
-#include <CGAL/corefinement_operations.h>
-
-Scene_combinatorial_map_item::Scene_combinatorial_map_item(CGAL::Three::Scene_interface* scene,void* address):last_known_scene(scene),volume_to_display(0),exportSelectedVolume(NULL),address_of_A(address){m_combinatorial_map=NULL; are_buffers_filled = false; nb_points = 0; nb_lines =0; nb_facets =0;}
-Scene_combinatorial_map_item::~Scene_combinatorial_map_item(){if (m_combinatorial_map!=NULL) delete m_combinatorial_map;}
-
-Scene_combinatorial_map_item* Scene_combinatorial_map_item::clone() const{return NULL;}
-
-Kernel::Vector_3 Scene_combinatorial_map_item::compute_face_normal(Combinatorial_map_3::Dart_const_handle adart) const
-{
-    typedef Combinatorial_map_3::Dart_of_orbit_const_range<1> Dart_in_facet_range;
-    typedef Kernel::Vector_3 Vector_3;
-    Vector_3 normal = CGAL::NULL_VECTOR;
-
-    Dart_in_facet_range vertices=combinatorial_map().darts_of_orbit<1>(adart);
-    Kernel::Point_3 points[3];
-    int index=0;
-    Dart_in_facet_range::const_iterator pit=vertices.begin();
-    for (;pit!=vertices.end() && index!=3;++pit,++index ){
-        points[index]=pit->attribute<0>()->point();
-    }
-
-    if (index!=3) return normal;
-
-    do{
-        Vector_3 n = CGAL::cross_product(points[2]-points[1],points[0]-points[1]);
-        if (n != Vector_3(0,0,0) )
-            normal = normal + (n / std::sqrt(n*n));
-        points[0]=points[1];
-        points[1]=points[2];
-        if ( pit==vertices.end() ) break;
-
-        points[2]=pit->attribute<0>()->point();
-        ++pit;
-    }while(true);
-
-    return normal == Vector_3(0,0,0)? normal : normal / std::sqrt(normal * normal);
-}  
-
-void Scene_combinatorial_map_item::set_next_volume(){
-    //Update des vectors faits ici
-    ++volume_to_display;
-    volume_to_display=volume_to_display%(combinatorial_map().attributes<3>().size()+1);
-  are_buffers_filled = false;
-  invalidateOpenGLBuffers();
-  Q_EMIT itemChanged();
-
-    if (exportSelectedVolume!=NULL && ( volume_to_display==1 || volume_to_display==0 ) )
-        exportSelectedVolume->setEnabled(!exportSelectedVolume->isEnabled());
-}
-
-
-template <class Predicate> 
-void Scene_combinatorial_map_item::export_as_polyhedron(Predicate pred,const QString& name) const {
-    typedef Combinatorial_map_3::Dart_const_handle Dart_handle;
-    typedef Combinatorial_map_3::One_dart_per_cell_const_range<3> One_dart_per_vol_range;
-    typedef CGAL::internal::Import_volume_as_polyhedron<Polyhedron::HalfedgeDS> Volume_import_modifier;
-
-    std::vector<Dart_handle> darts;
-    One_dart_per_vol_range cell_range=combinatorial_map().template one_dart_per_cell<3>();
-
-
-    for (One_dart_per_vol_range::const_iterator it = cell_range.begin();it!= cell_range.end() ; ++it )
-        if ( pred(it) ){
-            darts.push_back(it);
-            if (Predicate::only_one_run) break;
-        }
-
-    if (!darts.empty())
-    {
-        Volume_import_modifier modifier=Predicate::swap_orientation?
-                    Volume_import_modifier(combinatorial_map(),darts.begin(),darts.end(),Predicate::swap_orientation):
-                    Volume_import_modifier(combinatorial_map(),darts.begin(),darts.end());
-
-        Polyhedron* new_poly=new Polyhedron();
-        new_poly->delegate(modifier);
-        Scene_polyhedron_item* new_item = new Scene_polyhedron_item(new_poly);
-        new_item->setName(name);
-        last_known_scene->addItem(new_item);
-    }
-}
-
-struct Select_volume{
-    static const bool only_one_run=true;
-    static const bool swap_orientation=false;
-    Select_volume(std::size_t i):volume_to_select(i),index(0){}
-    template <class Dart_handle>
-    bool operator() (Dart_handle){
-        return ++index==volume_to_select;
-    }
-private:
-    std::size_t volume_to_select;
-    std::size_t index;
-};
-
-void Scene_combinatorial_map_item::export_current_volume_as_polyhedron() const {
-    if (volume_to_display==0) return; //no volume selected
-
-    Select_volume predicate(volume_to_display);
-    export_as_polyhedron(predicate,QString("%1_%2").arg(this->name()).arg(volume_to_display-1));
-}
-
-struct Select_union{
-    static const bool only_one_run=false;
-    static const bool swap_orientation=true;
-    template <class Dart_handle>
-    bool operator() (Dart_handle d){ return d->template attribute<3>()->info().outside.size()==2; }
-};
-
-struct Select_inter{
-    static const bool only_one_run=false;
-    static const bool swap_orientation=false;
-    template <class Dart_handle>
-    bool operator() (Dart_handle d){ return d->template attribute<3>()->info().inside.size()==2; }
-};
-
-struct Select_A_minus_B{
-    static const bool only_one_run=false;
-    static const bool swap_orientation=false;
-    Select_A_minus_B(void* address):address_of_A(address){}
-    template <class Dart_handle>
-    bool operator() (Dart_handle d){
-        return d->template attribute<3>()->info().inside.size()==1 &&
-                static_cast<void*>(*d->template attribute<3>()->info().inside.begin())==address_of_A;
-    }
-private:
-    void* address_of_A;
-};
-
-struct Select_B_minus_A{
-    static const bool only_one_run=false;
-    static const bool swap_orientation=false;
-    Select_B_minus_A(void* address):address_of_A(address){}
-    template <class Dart_handle>
-    bool operator() (Dart_handle d){
-        return d->template attribute<3>()->info().inside.size()==1 &&
-                static_cast<void*>(*d->template attribute<3>()->info().inside.begin())!=address_of_A;
-    }
-private:
-    void* address_of_A;
-};
-
-void Scene_combinatorial_map_item::export_union_as_polyhedron() const {
-    export_as_polyhedron(Select_union(),QString("%1_union_%2").arg("A").arg("B"));
-}
-void Scene_combinatorial_map_item::export_intersection_as_polyhedron() const{
-    export_as_polyhedron(Select_inter(),QString("%1_inter_%2").arg("A").arg("B"));
-}
-void Scene_combinatorial_map_item::export_A_minus_B_as_polyhedron() const{
-    Select_A_minus_B predicate(address_of_A);
-    export_as_polyhedron(predicate,QString("%1_minus_%2").arg("A").arg("B"));
-}
-void Scene_combinatorial_map_item::export_B_minus_A_as_polyhedron() const{
-    Select_B_minus_A predicate(address_of_A);
-    export_as_polyhedron(predicate,QString("%1_minus_%2").arg("B").arg("A"));
-}
-
-QMenu* Scene_combinatorial_map_item::contextMenu()
-{
-    const char* prop_name = "Menu modified by Scene_combinatorial_map_item.";
-
-    QMenu* menu = Scene_item::contextMenu();
-
-    // Use dynamic properties:
-    // http://doc.qt.io/qt-5/qobject.html#property
-    bool menuChanged = menu->property(prop_name).toBool();
-
-    if(!menuChanged) {
-        QAction* actionSelectNextVolume =
-                menu->addAction(tr("Iterate over volumes"));
-        actionSelectNextVolume->setObjectName("actionSelectNextVolume");
-        connect(actionSelectNextVolume, SIGNAL(triggered()),this, SLOT(set_next_volume()));
-
-        exportSelectedVolume =
-                menu->addAction(tr("Export current volume as polyhedron"));
-        exportSelectedVolume->setObjectName("exportSelectedVolume");
-        connect(exportSelectedVolume, SIGNAL(triggered()),this, SLOT(export_current_volume_as_polyhedron()));
-        exportSelectedVolume->setEnabled(volume_to_display!=0);
-        menu->setProperty(prop_name, true);
-
-        if(is_from_corefinement()){
-            //Export union as polyhedron
-            QAction* exportUnion =
-                    menu->addAction(tr("Export union as polyhedron"));
-            exportUnion->setObjectName("exportUnion");
-            connect(exportUnion, SIGNAL(triggered()),this, SLOT(export_union_as_polyhedron()));
-
-            //Export intersection as polyhedron
-            QAction* exportIntersection =
-                    menu->addAction(tr("Export intersection as polyhedron"));
-            exportIntersection->setObjectName("exportIntersection");
-            connect(exportIntersection, SIGNAL(triggered()),this, SLOT(export_intersection_as_polyhedron()));
-
-            //Export A minus B as polyhedron
-            QAction* exportAMinusB =
-                    menu->addAction(tr("Export A minus B as polyhedron"));
-            exportAMinusB->setObjectName("exportAMinusB");
-            connect(exportAMinusB, SIGNAL(triggered()),this, SLOT(export_A_minus_B_as_polyhedron()));
-
-            //Export B minus A as polyhedron
-            QAction* exportBMinusA =
-                    menu->addAction(tr("Export B minus A as polyhedron"));
-            exportBMinusA->setObjectName("exportBMinusA");
-            connect(exportBMinusA, SIGNAL(triggered()),this, SLOT(export_B_minus_A_as_polyhedron()));
-
-        }
-    }
-    return menu;
-}
-
-bool Scene_combinatorial_map_item::keyPressEvent(QKeyEvent* e){
-    if (e->key()==Qt::Key_N){
-        set_next_volume();
-        return true;
-    }
-    return false;
-}
-
-void Scene_combinatorial_map_item::compute_elements(void) const{
-
-    positions_facets.resize(0);
-    normals.resize(0);
-    positions_lines.resize(0);
-    positions_points.resize(0);
-
-    //Facets
-    {
-    std::size_t index = 0;
-    Combinatorial_map_3::size_type voltreated
-      = combinatorial_map().get_new_mark();
-    Combinatorial_map_3::size_type facetreated
-      = combinatorial_map().get_new_mark();
-    Combinatorial_map_3::Dart_const_range::const_iterator
-            darts_it=combinatorial_map().darts().begin(), darts_end=combinatorial_map().darts().end();
-    for( ; darts_it!=darts_end; ++darts_it)
-    {
-        if ( !combinatorial_map().is_marked(darts_it,voltreated) )
-        {
-            ++index;
-            //iterate over all the darts of the volume
-            Combinatorial_map_3::Dart_of_cell_const_range<3>::const_iterator
-                    vol_it=combinatorial_map().darts_of_cell<3>(darts_it).begin(),
-                    vol_end=combinatorial_map().darts_of_cell<3>(darts_it).end();
-            if ( volume_to_display!=0 && index!=volume_to_display )
-            {
-                //only mark darts if the volume is not the one to display
-                for ( ;vol_it!=vol_end; ++vol_it )
-                {
-                    combinatorial_map().mark(vol_it,facetreated);
-                    combinatorial_map().mark(vol_it, voltreated);
-                }
-            }
-            else
-            {
-                for ( ;vol_it!=vol_end; ++vol_it )
-                {
-                    if ( !combinatorial_map().is_marked(vol_it,facetreated) )
-                    {
-                        Kernel::Vector_3 normal = compute_face_normal(vol_it);
-                        for(int i=0; i<3; i++)
-                        {
-                            normals.push_back(normal.x());
-                            normals.push_back(normal.y());
-                            normals.push_back(normal.z());
-                        }
-
-                        //iterate over all darts of facets
-                        for ( Combinatorial_map_3::Dart_of_orbit_const_range<1>::const_iterator
-                              face_it=combinatorial_map().darts_of_orbit<1>(vol_it).begin(),
-                              face_end=combinatorial_map().darts_of_orbit<1>(vol_it).end();
-                              face_it!=face_end; ++face_it)
-                        {
-                            const Kernel::Point_3& p= face_it->attribute<0>()->point();
-                            positions_facets.push_back(p.x());
-                            positions_facets.push_back(p.y());
-                            positions_facets.push_back(p.z());
-                            combinatorial_map().mark(face_it,facetreated);
-                            combinatorial_map().mark(face_it, voltreated);
-                        }
-                    }
-                }
-            }
-            if ( index==volume_to_display ) break;
-        }
-    }
-    //mark remaining darts to have an O(1) free_mark
-    for( ;  darts_it!=darts_end; ++darts_it)
-    {
-        combinatorial_map().mark(darts_it, facetreated);
-        combinatorial_map().mark(darts_it, voltreated);
-    }
-
-    combinatorial_map().free_mark(facetreated);
-    combinatorial_map().free_mark(voltreated);
-    }
-
-    //edges
-    {
-
-        typedef Combinatorial_map_3::One_dart_per_cell_const_range<1> Edge_darts;
-        Edge_darts darts=combinatorial_map().one_dart_per_cell<1>();
-        for (Edge_darts::const_iterator dit=darts.begin();dit!=darts.end();++dit){
-            CGAL_assertion(!dit->is_free(1));
-            const Kernel::Point_3& a = dit->attribute<0>()->point();
-            const Kernel::Point_3& b = dit->beta(1)->attribute<0>()->point();
-            positions_lines.push_back(a.x());
-            positions_lines.push_back(a.y());
-            positions_lines.push_back(a.z());
-
-            positions_lines.push_back(b.x());
-            positions_lines.push_back(b.y());
-            positions_lines.push_back(b.z());
-
-        }
-    }
-
-    //points
-    {
-        typedef Combinatorial_map_3::Attribute_const_range<0>::type Point_range;
-        const Point_range& points=combinatorial_map().attributes<0>();
-        for(Point_range::const_iterator pit=boost::next(points.begin());pit!=points.end();++pit){
-            const Kernel::Point_3& p=pit->point();
-            positions_points.push_back(p.x());
-            positions_points.push_back(p.y());
-            positions_points.push_back(p.z());
-        }
-
-    }
-
-}
-
-void Scene_combinatorial_map_item::initialize_buffers(CGAL::Three::Viewer_interface *viewer) const
-{
-    //vao for the edges
-    {
-        program = getShaderProgram(PROGRAM_WITHOUT_LIGHT, viewer);
-        program->bind();
-
-        vaos[Edges]->bind();
-        buffers[Edges_vertices].bind();
-        buffers[Edges_vertices].allocate(positions_lines.data(),
-                            static_cast<int>(positions_lines.size()*sizeof(double)));
-        program->enableAttributeArray("vertex");
-        program->setAttributeBuffer("vertex",GL_DOUBLE,0,3);
-        buffers[Edges_vertices].release();
-        nb_lines = positions_lines.size();
-        positions_lines.resize(0);
-        std::vector<double>(positions_lines).swap(positions_lines);
-        vaos[Edges]->release();
-        program->release();
-    }
-    //vao for the points
-    {
-        program = getShaderProgram(PROGRAM_WITHOUT_LIGHT, viewer);
-        program->bind();
-
-        vaos[Points]->bind();
-        buffers[Points_vertices].bind();
-        buffers[Points_vertices].allocate(positions_points.data(),
-                            static_cast<int>(positions_points.size()*sizeof(double)));
-        program->enableAttributeArray("vertex");
-        program->setAttributeBuffer("vertex",GL_DOUBLE,0,3);
-        buffers[Points_vertices].release();
-        vaos[Points]->release();
-        nb_points = positions_points.size();
-        positions_points.resize(0);
-        std::vector<double>(positions_points).swap(positions_points);
-        program->release();
-    }
-    //vao for the facets
-    {
-        program = getShaderProgram(PROGRAM_WITH_LIGHT, viewer);
-        program->bind();
-
-        vaos[Facets]->bind();
-        buffers[Facets_vertices].bind();
-        buffers[Facets_vertices].allocate(positions_facets.data(),
-                            static_cast<int>(positions_facets.size()*sizeof(double)));
-        program->enableAttributeArray("vertex");
-        program->setAttributeBuffer("vertex",GL_DOUBLE,0,3);
-        buffers[Facets_vertices].release();
-
-        buffers[Facets_normals].bind();
-        buffers[Facets_normals].allocate(normals.data(),
-                            static_cast<int>(normals.size()*sizeof(double)));
-        program->enableAttributeArray("normals");
-        program->setAttributeBuffer("normals",GL_DOUBLE,0,3);
-        buffers[Facets_normals].release();
-        nb_facets = positions_facets.size();
-        positions_facets.resize(0);
-        std::vector<double>(positions_facets).swap(positions_facets);
-        normals.resize(0);
-        std::vector<double>(normals).swap(normals);
-        vaos[Facets]->release();
-        program->release();
-    }
-    are_buffers_filled = true;
-
-
-}
-
-bool Scene_combinatorial_map_item::isEmpty() const {return combinatorial_map().number_of_darts()==0;}
-
-void
-Scene_combinatorial_map_item::compute_bbox() const {
-    typedef Combinatorial_map_3::Attribute_const_range<0>::type Point_range;
-    const Point_range& points=combinatorial_map().attributes<0>();
-    CGAL::Bbox_3 bbox=points.begin()->point().bbox();
-    for(Point_range::const_iterator pit=boost::next(points.begin());pit!=points.end();++pit)
-        bbox=bbox+pit->point().bbox();
-    _bbox = Bbox(bbox.xmin(),bbox.ymin(),bbox.zmin(),
-                bbox.xmax(),bbox.ymax(),bbox.zmax());
-}
-
-
-QString Scene_combinatorial_map_item::toolTip() const{ 
-    if(!m_combinatorial_map)
-        return QString();
-
-    std::vector<unsigned int> cells(5);
-    for (unsigned int i=0; i<=4; ++i)
-        cells[i]=i;
-    std::vector<unsigned int> res = combinatorial_map().count_cells(cells);
-    if (volume_to_display==0)
-        return QObject::tr("<p>Combinatorial_map_3 <b>%1</b> (mode: %8, color: %9)</p>"
-                           "<p>Number of darts: %2<br />"
-                           "Number of vertices: %3<br />"
-                           "Number of edges: %4<br />"
-                           "Number of facets: %5<br />"
-                           "Number of volumes: %6<br />"
-                           "Number of connected components: %7</p>")
-                .arg(this->name())
-                .arg(combinatorial_map().number_of_darts())
-                .arg(res[0])
-                .arg(res[1])
-                .arg(res[2])
-                .arg(res[3])
-                .arg(res[4])
-                .arg(this->renderingModeName())
-                .arg(this->color().name());
-    return QObject::tr("<p>Combinatorial_map_3 <b>%1</b> (mode: %8, color: %9)</p>"
-                       "<p>Number of darts: %2<br />"
-                       "Number of vertices: %3<br />"
-                       "Number of edges: %4<br />"
-                       "Number of facets: %5<br />"
-                       "Number of volumes: %6<br />"
-                       "Number of connected components: %7 <br />"
-                       "Currently Displaying facets of volume: %10 </p>")
-            .arg(this->name())
-            .arg(combinatorial_map().number_of_darts())
-            .arg(res[0])
-            .arg(res[1])
-            .arg(res[2])
-            .arg(res[3])
-            .arg(res[4])
-            .arg(this->renderingModeName())
-            .arg(this->color().name())
-            .arg(volume_to_display-1);
-}
-
-
-void Scene_combinatorial_map_item::draw(CGAL::Three::Viewer_interface* viewer) const
-{
-    if(!are_buffers_filled)
-    {
-        compute_elements();
-        initialize_buffers(viewer);
-    }
-    vaos[Facets]->bind();
-    program=getShaderProgram(PROGRAM_WITH_LIGHT);
-    attrib_buffers(viewer,PROGRAM_WITH_LIGHT);
-    program->bind();
-    program->setAttributeValue("colors", this->color());
-    viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(nb_facets/3));
-    vaos[Facets]->release();
-    program->release();
-
-}
- void Scene_combinatorial_map_item::draw_edges(CGAL::Three::Viewer_interface* viewer) const
-{
-     if(!are_buffers_filled)
-     {
-         compute_elements();
-         initialize_buffers(viewer);
-     }
-     vaos[Edges]->bind();
-     program=getShaderProgram(PROGRAM_WITHOUT_LIGHT);
-     attrib_buffers(viewer,PROGRAM_WITHOUT_LIGHT);
-     program->bind();
-     program->setAttributeValue("colors", this->color());
-     viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(nb_lines/3));
-     vaos[Edges]->release();
-     program->release();
-
-}
- void Scene_combinatorial_map_item::draw_points(CGAL::Three::Viewer_interface* viewer) const
-{
-     if(!are_buffers_filled)
-     {
-         compute_elements();
-         initialize_buffers(viewer);
-     }
-     vaos[Points]->bind();
-     program=getShaderProgram(PROGRAM_WITHOUT_LIGHT);
-     attrib_buffers(viewer,PROGRAM_WITHOUT_LIGHT);
-     program->bind();
-     program->setAttributeValue("colors", this->color());
-     viewer->glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(nb_points/3));
-     vaos[Points]->release();
-     program->release();
-
-}
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Operations_on_polyhedra/Scene_combinatorial_map_item.h b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Operations_on_polyhedra/Scene_combinatorial_map_item.h
deleted file mode 100644
index a5f1abc..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Operations_on_polyhedra/Scene_combinatorial_map_item.h
+++ /dev/null
@@ -1,117 +0,0 @@
-#ifndef SCENE_COMBINATORIAL_MAP_ITEM_H
-#define SCENE_COMBINATORIAL_MAP_ITEM_H
-
-//=========
-#include <CGAL/internal/corefinement/Combinatorial_map_for_corefinement.h>
-#include "Scene_combinatorial_map_item_config.h"
-#include <iostream>
-#include <QOpenGLBuffer>
-#include <QOpenGLShader>
-#include <QOpenGLShaderProgram>
-#include "Polyhedron_type.h"
-#include  <CGAL/Three/Scene_item.h>
-typedef CGAL::internal_IOP::Item_with_points_and_volume_info<Kernel,Polyhedron> Items;
-typedef CGAL::Combinatorial_map<3,Items> Combinatorial_map_3;
-//=========
-
-class QMenu;
-class QAction;
-namespace CGAL { namespace Three{
-class Scene_interface;
-}}
-class Scene_polyhedron_item;
-class Viewer_interface;
-
-class SCENE_COMBINATORIAL_MAP_ITEM_EXPORT Scene_combinatorial_map_item
-        : public CGAL::Three::Scene_item
-{
-    Q_OBJECT
-public:  
-    Scene_combinatorial_map_item(CGAL::Three::Scene_interface*,void* ad_A=NULL);
-    ~Scene_combinatorial_map_item();
-
-    Scene_combinatorial_map_item* clone() const;
-    // Function to override the context menu
-    QMenu* contextMenu();
-
-    //  bool load(std::istream& in);
-    //  void load(Scene_polyhedron_item*);
-    //  bool save(std::ostream& out) const;
-
-    QString toolTip() const;
-
-    // Indicate if rendering mode is supported
-    virtual bool supportsRenderingMode(RenderingMode m) const { return (m != Gouraud && m!=PointsPlusNormals && m!=Splatting); } // CHECK THIS!
-    //Event handling
-    virtual bool keyPressEvent(QKeyEvent*);
-    //drawing of the scene
-    virtual void draw_edges(CGAL::Three::Viewer_interface* viewer) const;
-    virtual void draw_points(CGAL::Three::Viewer_interface*) const;
-    virtual void draw(CGAL::Three::Viewer_interface*) const;
-
-    bool isFinite() const { return true; }
-    bool is_from_corefinement() const {return address_of_A!=NULL;}
-    bool isEmpty() const;
-    void compute_bbox() const;
-
-    const Combinatorial_map_3& combinatorial_map() const
-    {
-        return *m_combinatorial_map;
-    }
-
-    Combinatorial_map_3& combinatorial_map()
-    {
-        return *m_combinatorial_map;
-    }
-
-    Combinatorial_map_3* m_combinatorial_map;
-
-private:
-    Kernel::Vector_3 compute_face_normal(Combinatorial_map_3::Dart_const_handle adart) const;
-    CGAL::Three::Scene_interface* last_known_scene;
-    std::size_t volume_to_display;
-    QAction* exportSelectedVolume;
-    void* address_of_A;
-    template <class Predicate> void export_as_polyhedron(Predicate,const QString&) const;
-
-   enum VAOs {
-       Edges = 0,
-       Points,
-       Facets,
-       NbOfVaos = Facets +1
-   };
-   enum VBOs {
-       Edges_vertices = 0,
-       Points_vertices,
-       Facets_vertices,
-       Facets_normals,
-       NbOfVbos = Facets_normals +1
-   };
-
-   mutable std::vector<double> positions_lines;
-   mutable std::vector<double> positions_points;
-   mutable std::vector<double> positions_facets;
-   mutable std::vector<double> normals;
-   mutable std::size_t nb_lines;
-   mutable std::size_t nb_points;
-   mutable std::size_t nb_facets;
-
-    mutable QOpenGLShaderProgram *program;
-
-    using CGAL::Three::Scene_item::initialize_buffers;
-    void initialize_buffers(CGAL::Three::Viewer_interface *viewer) const;
-
-    using CGAL::Three::Scene_item::compute_elements;
-    void compute_elements(void) const;
-
-public Q_SLOTS:
-    void set_next_volume();
-    void export_current_volume_as_polyhedron() const;
-    void export_union_as_polyhedron() const;
-    void export_intersection_as_polyhedron() const;
-    void export_A_minus_B_as_polyhedron() const;
-    void export_B_minus_A_as_polyhedron() const;
-
-}; // end class Scene_combinatorial_map_item
-
-#endif // SCENE_COMBINATORIAL_MAP_ITEM_H
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PCA/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PCA/CMakeLists.txt
deleted file mode 100644
index dec1440..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PCA/CMakeLists.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-include( polyhedron_demo_macros )
-polyhedron_demo_plugin(pca_plugin Pca_plugin)
-target_link_libraries(pca_plugin scene_polyhedron_item scene_basic_objects)
-
-polyhedron_demo_plugin(transform_polyhedron_plugin Transform_polyhedron_plugin)
-target_link_libraries(transform_polyhedron_plugin  scene_polyhedron_item scene_polyhedron_transform_item)
-
-polyhedron_demo_plugin(trivial_plugin Trivial_plugin)
-
-polyhedron_demo_plugin(create_bbox_mesh_plugin Create_bbox_mesh_plugin)
-target_link_libraries(create_bbox_mesh_plugin scene_polyhedron_item)
\ No newline at end of file
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PCA/Create_bbox_mesh_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PCA/Create_bbox_mesh_plugin.cpp
deleted file mode 100644
index 533fa4d..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PCA/Create_bbox_mesh_plugin.cpp
+++ /dev/null
@@ -1,156 +0,0 @@
-#include <QtCore/qglobal.h>
-
-#include <CGAL/Three/Scene_item.h>
-#include <CGAL/Three/Scene_interface.h>
-#include <CGAL/gl.h>
-#include <CGAL/Polyhedron_incremental_builder_3.h>
-
-#include <QAction>
-#include <QMainWindow>
-
-#include "Scene_polyhedron_item.h"
-#include "Polyhedron_type.h"
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-
-
-const int cube[][3] = { { 0, 1, 3 },
-                        { 3, 1, 2 },
-                        { 0, 4, 1 },
-                        { 1, 4, 5 },
-                        { 3, 2, 7 },
-                        { 7, 2, 6 },
-                        { 4, 0, 3 },
-                        { 7, 4, 3 },
-                        { 6, 4, 7 },
-                        { 6, 5, 4 },
-                        { 1, 5, 6 },
-                        { 2, 1, 6 } };
-
-using namespace CGAL::Three;
-
-struct Build_bbox_mesh : 
-  public CGAL::Modifier_base<Polyhedron::HalfedgeDS>
-{
-  Scene_interface::Bbox bbox;
-  typedef Polyhedron::HalfedgeDS HDS;
-
-public:
-  Build_bbox_mesh(Scene_interface::Bbox b) : bbox(b) {}
-
-  void operator()( HDS& hds) {
-    CGAL::Polyhedron_incremental_builder_3<HDS> B( hds, true);
-    B.begin_surface( 8, 12, 24);
-    typedef HDS::Vertex   Vertex;
-    typedef Vertex::Point Point;
-    B.add_vertex( Point( bbox.xmin, bbox.ymin, bbox.zmin)); // -1 -1 -1
-    B.add_vertex( Point( bbox.xmin, bbox.ymax, bbox.zmin)); // -1 1 -1
-    B.add_vertex( Point( bbox.xmax, bbox.ymax, bbox.zmin)); // 1 1 -1
-    B.add_vertex( Point( bbox.xmax, bbox.ymin, bbox.zmin)); // 1 -1 -1
-    B.add_vertex( Point( bbox.xmin, bbox.ymin, bbox.zmax)); // -1 -1 1
-    B.add_vertex( Point( bbox.xmin, bbox.ymax, bbox.zmax)); // -1 1 1
-    B.add_vertex( Point( bbox.xmax, bbox.ymax, bbox.zmax)); // 1 1 1 
-    B.add_vertex( Point( bbox.xmax, bbox.ymin, bbox.zmax)); // 1 -1 1
-    for(int i = 0; i < 12; ++i) {
-      B.begin_facet();
-      B.add_vertex_to_facet( cube[i][0]);
-      B.add_vertex_to_facet( cube[i][1]);
-      B.add_vertex_to_facet( cube[i][2]);
-      B.end_facet();
-    }
-    B.end_surface();
-  }
-};
-
-class Create_bbox_mesh_plugin : 
-  public QObject,
-  public CGAL::Three::Polyhedron_demo_plugin_interface
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-public:
-  void init(QMainWindow* mainWindow, Scene_interface* scene_interface);
-  QList<QAction*> actions() const;
-  bool applicable(QAction*) const {
-    if(scene->mainSelectionIndex() != -1)
-      return true;
-  return false;}
-
-protected:
-  void bbox(bool extended = false);
-
-public Q_SLOTS:
-  void createBbox() { bbox(); }
-  void createExtendedBbox() { bbox(true); }
-
-private:
-  Scene_interface* scene;
-  QAction* actionBbox;
-  QAction* actionExtendedBbox;
-
-}; // end Create_bbox_mesh_plugin
-
-void Create_bbox_mesh_plugin::init(QMainWindow* mainWindow, Scene_interface* scene_interface)
-{
-  scene = scene_interface;
-  actionBbox = new QAction(tr("Create &Bbox Mesh"), mainWindow);
-  actionBbox->setObjectName("createBboxMeshAction");
-  connect(actionBbox, SIGNAL(triggered()),
-          this, SLOT(createBbox()));
-  actionExtendedBbox = new QAction(tr("Create &Extended Bbox Mesh"), mainWindow);
-  actionExtendedBbox->setObjectName("createExtendedBboxMeshAction");
-  connect(actionExtendedBbox, SIGNAL(triggered()),
-          this, SLOT(createExtendedBbox()));
-}
-
-QList<QAction*> Create_bbox_mesh_plugin::actions() const {
-  return QList<QAction*>() << actionBbox << actionExtendedBbox;
-}
-
-void Create_bbox_mesh_plugin::bbox(bool extended)
-{
-  Scene_interface::Bbox bbox;
-  bool initialized = false;
-
-  Q_FOREACH(int index, scene->selectionIndices()) {
-    Scene_item* item = scene->item(index);
-    if(item->isFinite() && ! item->isEmpty()) {
-      if(initialized) {
-        bbox = bbox + item->bbox();
-      } else {
-        bbox = item->bbox();
-        initialized = true;
-      }
-    }
-  }
-  std::cerr << "bbox dimensions: " << bbox.xmax - bbox.xmin
-            << "\n                 " << bbox.ymax - bbox.ymin
-            << "\n                 " << bbox.zmax - bbox.zmin
-            << std::endl;
-
-  if(extended) {
-    const double delta_x = ( bbox.xmax - bbox.xmin ) / 20.;
-    const double delta_y = ( bbox.ymax - bbox.ymin ) / 20.;
-    const double delta_z = ( bbox.zmax - bbox.zmin ) / 20.;
-
-    bbox.xmin -= delta_x;
-    bbox.xmax += delta_x;
-    bbox.ymin -= delta_y;
-    bbox.ymax += delta_y;
-    bbox.zmin -= delta_z;
-    bbox.zmax += delta_z;
-  }
-
-  Polyhedron p;
-  
-  Build_bbox_mesh b(bbox);
-  p.delegate(b);
-
-  Scene_item* item = new Scene_polyhedron_item(p);
-  item->setName("Scene bbox mesh");
-  item->setRenderingMode(Wireframe);
-  scene->addItem(item);
-}
-
-#include "Create_bbox_mesh_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PCA/Pca_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PCA/Pca_plugin.cpp
deleted file mode 100644
index ee5c285..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PCA/Pca_plugin.cpp
+++ /dev/null
@@ -1,232 +0,0 @@
-#include <QApplication>
-#include <QAction>
-#include <QMainWindow>
-#include "Scene_polyhedron_item.h"
-#include "Scene_plane_item.h"
-#include "Polyhedron_type.h"
-
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-
-#include <CGAL/centroid.h>
-#include <CGAL/bounding_box.h>
-#include <CGAL/linear_least_squares_fitting_3.h>
-
-
-#include <CGAL/Make_quad_soup.h> // output for plane fitting
-#include <CGAL/Make_bar.h> // output for line fitting
-
-#include "Kernel_type.h"
-typedef Kernel::Plane_3 Plane;
-typedef Kernel::Iso_cuboid_3 Iso_cuboid;
-typedef Kernel::Triangle_3 Triangle;
-typedef Kernel::Line_3 Line;
-typedef Kernel::Vector_3 Vector;
-typedef Kernel::Point_3 Point;
-typedef Kernel::FT FT;
-
-using namespace CGAL::Three;
-class Polyhedron_demo_pca_plugin : 
-  public QObject,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-public:
-  // used by Polyhedron_demo_plugin_helper
-  QStringList actionsNames() const {
-    return QStringList() << "actionFitPlane"
-                         << "actionFitLine";
-  }
-
-  void init(QMainWindow* mainWindow,
-            Scene_interface* scene_interface)
-  {
-      mw = mainWindow;
-      scene = scene_interface;
-      actions_map["actionFitPlane"] = new QAction("Fit Plane", mw);
-      actions_map["actionFitPlane"]->setProperty("subMenuName", "Principal Component Analysis");
-
-      actions_map["actionFitLine"] = new QAction("Fit Line", mw);
-      actions_map["actionFitLine"]->setProperty("subMenuName", "Principal Component Analysis");
-
-      connect(actions_map["actionFitPlane"], SIGNAL(triggered()),
-              this, SLOT(on_actionFitPlane_triggered()));
-      connect(actions_map["actionFitLine"], SIGNAL(triggered()),
-              this, SLOT(on_actionFitLine_triggered()));
-
-  }
-
-
-  bool applicable(QAction*) const { 
-    return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
-  }
-
-
-public Q_SLOTS:
-  void on_actionFitPlane_triggered();
-  void on_actionFitLine_triggered();
-
-}; // end Polyhedron_demo_pca_plugin
-
-void Polyhedron_demo_pca_plugin::on_actionFitPlane_triggered()
-{
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-  
-  Scene_polyhedron_item* item = 
-    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-
-  if(item)
-  {
-    Polyhedron* pMesh = item->polyhedron();
-
-    // get triangles from the mesh
-    std::list<Triangle> triangles;
-    Polyhedron::Facet_iterator f;
-    for(f = pMesh->facets_begin();
-      f != pMesh->facets_end();
-      ++f)
-    {
-      const Point& a = f->halfedge()->vertex()->point();
-      const Point& b = f->halfedge()->next()->vertex()->point();
-      const Point& c = f->halfedge()->prev()->vertex()->point();
-      triangles.push_back(Triangle(a,b,c));
-    }
-
-    // fit plane to triangles
-    Plane plane;
-    std::cout << "Fit plane...";
-    CGAL::linear_least_squares_fitting_3(triangles.begin(),triangles.end(),plane,CGAL::Dimension_tag<2>());
-    std::cout << "ok" << std::endl;
-
-    // compute centroid
-    Point center_of_mass = CGAL::centroid(triangles.begin(),triangles.end());
-
-//     // compute bounding box diagonal
-//     Iso_cuboid bbox = CGAL::bounding_box(pMesh->points_begin(),pMesh->points_end());
-
-//     // compute scale (for rendering) using diagonal of bbox
-//     Point cmin = (bbox.min)();
-//     Point cmax = (bbox.max)();
-//     FT diag = std::sqrt(CGAL::squared_distance(cmin,cmax));
-//     Vector u1 = plane.base1();
-//     u1 = u1 / std::sqrt(u1*u1);
-//     u1 = u1 * 0.7 * diag;
-//     Vector u2 = plane.base2();
-//     u2 = u2 / std::sqrt(u2*u2);
-//     u2 = u2 * 0.7 * diag;
-//     std::list<Point> points;
-//     points.push_back(center_of_mass + u1);
-//     points.push_back(center_of_mass + u2);
-//     points.push_back(center_of_mass - u1);
-//     points.push_back(center_of_mass - u2);
-
-    // add best fit plane as new polyhedron
-//     Polyhedron *pFit = new Polyhedron;
-//     typedef std::list<Point>::iterator Iterator;
-//     Make_quad_soup<Polyhedron,Kernel,Iterator> quad;
-//     quad.run(points.begin(),points.end(),*pFit);
-
-//     Scene_polyhedron_item* new_item = new Scene_polyhedron_item(pFit);
-    Scene_plane_item* new_item = new Scene_plane_item(this->scene);
-    new_item->setPosition(center_of_mass.x(),
-                          center_of_mass.y(),
-                          center_of_mass.z());
-    const Vector& normal = plane.orthogonal_vector();
-    new_item->setNormal(normal.x(), normal.y(), normal.z());
-    new_item->setName(tr("%1 (plane fit)").arg(item->name()));
-    new_item->setColor(Qt::magenta);
-    new_item->setRenderingMode(item->renderingMode());
-    scene->addItem(new_item);
-
-    QApplication::restoreOverrideCursor();
-  }
-}
-
-void Polyhedron_demo_pca_plugin::on_actionFitLine_triggered()
-{
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-  
-  Scene_polyhedron_item* item = 
-    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-
-  if(item)
-  {
-    Polyhedron* pMesh = item->polyhedron();
-
-    // get triangles from the mesh
-    std::list<Triangle> triangles;
-    Polyhedron::Facet_iterator f;
-    for(f = pMesh->facets_begin();
-      f != pMesh->facets_end();
-      ++f)
-    {
-      const Point& a = f->halfedge()->vertex()->point();
-      const Point& b = f->halfedge()->next()->vertex()->point();
-      const Point& c = f->halfedge()->prev()->vertex()->point();
-      triangles.push_back(Triangle(a,b,c));
-    }
-
-    // fit line to triangles
-    Line line;
-    std::cout << "Fit line...";
-    CGAL::linear_least_squares_fitting_3(triangles.begin(),triangles.end(),line,CGAL::Dimension_tag<2>());
-    std::cout << "ok" << std::endl;
-
-    // compute centroid
-    Point center_of_mass = CGAL::centroid(triangles.begin(),triangles.end());
-
-    // compute bounding box diagonal
-    Iso_cuboid bbox = CGAL::bounding_box(pMesh->points_begin(),pMesh->points_end());
-
-    // compute scale for rendering using diagonal of bbox
-    Point cmin = (bbox.min)();
-    Point cmax = (bbox.max)();
-    FT diag = std::sqrt(CGAL::squared_distance(cmin,cmax));
-
-    // construct a 3D bar
-    Vector u = line.to_vector();
-    u = u / std::sqrt(u*u);
-
-    Point a = center_of_mass + u * diag;
-    Point b = center_of_mass - u * diag;
-
-    Plane plane_a = line.perpendicular_plane(a);
-
-    Vector u1 = plane_a.base1();
-    u1 = u1 / std::sqrt(u1*u1);
-    u1 = u1 * 0.01 * diag;
-    Vector u2 = plane_a.base2();
-    u2 = u2 / std::sqrt(u2*u2);
-    u2 = u2 * 0.01 * diag;
-
-    Point points[8];
-
-    points[0] = a + u1;
-    points[1] = a + u2;
-    points[2] = a - u1;
-    points[3] = a - u2;
-
-    points[4] = b + u1;
-    points[5] = b + u2;
-    points[6] = b - u1;
-    points[7] = b - u2;
-
-    // add best fit line as new polyhedron bar
-    Polyhedron *pFit = new Polyhedron;
-    Make_bar<Polyhedron,Kernel> bar;
-    bar.run(points,*pFit);
-
-    Scene_polyhedron_item* new_item = new Scene_polyhedron_item(pFit);
-    new_item->setName(tr("%1 (line fit)").arg(item->name()));
-    new_item->setColor(Qt::magenta);
-    new_item->setRenderingMode(item->renderingMode());
-    scene->addItem(new_item);
-
-    QApplication::restoreOverrideCursor();
-  }
-}
-
-#include "Pca_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PCA/Scene_polyhedron_transform_item.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PCA/Scene_polyhedron_transform_item.cpp
deleted file mode 100644
index 3b5ad79..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PCA/Scene_polyhedron_transform_item.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-#include "Scene_polyhedron_transform_item.h"
-#include "Kernel_type.h"
-#include "Polyhedron_type.h"
-
-Scene_polyhedron_transform_item::Scene_polyhedron_transform_item(const qglviewer::Vec& pos,const Scene_polyhedron_item* poly_item_,const CGAL::Three::Scene_interface*):
-    Scene_item(NbOfVbos,NbOfVaos),
-    poly_item(poly_item_),
-    manipulable(false),
-    frame(new ManipulatedFrame()),
-    poly(poly_item->polyhedron()),
-    center_(pos)
-
-{
-    frame->setPosition(pos);
-    nb_lines = 0;
-    invalidateOpenGLBuffers();
-}
-
-void Scene_polyhedron_transform_item::initialize_buffers(CGAL::Three::Viewer_interface *viewer =0) const
-{
-    //vao for the edges
-    {
-        program = getShaderProgram(PROGRAM_WITHOUT_LIGHT, viewer);
-        program->bind();
-
-        vaos[Edges]->bind();
-        buffers[Vertices].bind();
-        buffers[Vertices].allocate(positions_lines.data(),
-                            static_cast<int>(positions_lines.size()*sizeof(float)));
-        program->enableAttributeArray("vertex");
-        program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
-        buffers[Vertices].release();
-        vaos[Edges]->release();
-
-        program->release();
-    }
-    nb_lines = positions_lines.size();
-    positions_lines.resize(0);
-    std::vector<float>(positions_lines).swap(positions_lines);
-
-    are_buffers_filled = true;
-}
-
-void Scene_polyhedron_transform_item::compute_elements() const
-{
-     positions_lines.resize(0);
-    typedef Kernel::Point_3		Point;
-    typedef Polyhedron::Edge_const_iterator	Edge_iterator;
-
-    Edge_iterator he;
-    for(he = poly->edges_begin();
-        he != poly->edges_end();
-        he++)
-    {
-        const Point& a = he->vertex()->point();
-        const Point& b = he->opposite()->vertex()->point();
-        positions_lines.push_back(a.x()-center_.x);
-        positions_lines.push_back(a.y()-center_.y);
-        positions_lines.push_back(a.z()-center_.z);
-
-        positions_lines.push_back(b.x()-center_.x);
-        positions_lines.push_back(b.y()-center_.y);
-        positions_lines.push_back(b.z()-center_.z);
-
-    }
-}
-
-void Scene_polyhedron_transform_item::draw_edges(CGAL::Three::Viewer_interface* viewer) const
-{
-    if(!are_buffers_filled)
-        initialize_buffers(viewer);
-    vaos[Edges]->bind();
-    program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
-    attrib_buffers(viewer,PROGRAM_WITHOUT_LIGHT);
-    program->bind();
-    QMatrix4x4 f_matrix;
-    for (int i=0; i<16; ++i){
-        f_matrix.data()[i] = (float)frame->matrix()[i];
-    }
-    QColor color = this->color();
-    program->setAttributeValue("colors",color);
-    program->setUniformValue("f_matrix", f_matrix);
-    program->setUniformValue("is_selected", false);
-    viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(nb_lines/3));
-    vaos[Edges]->release();
-    program->release();
-
-}
-
-QString Scene_polyhedron_transform_item::toolTip() const {
-    return QObject::tr("<p>Affine transformation of <b>%1</b></p>"
-                       "<p>Keep <b>Ctrl</b> pressed and use the arcball to define an affine transformation.<br />"
-                       "Press <b>S</b> to apply the affine transformation to a copy of <b>%1</b>.</p>")
-            .arg(getBase()->name());
-}
-bool Scene_polyhedron_transform_item::keyPressEvent(QKeyEvent* e){
-    if (e->key()==Qt::Key_S){
-    Q_EMIT stop();
-        return true;
-    }
-    return false;
-}
-
-void
-Scene_polyhedron_transform_item::compute_bbox() const {
-    const Kernel::Point_3& p = *(poly->points_begin());
-    CGAL::Bbox_3 bbox(p.x(), p.y(), p.z(), p.x(), p.y(), p.z());
-    for(Polyhedron::Point_const_iterator it = poly->points_begin();
-        it != poly->points_end();
-        ++it) {
-        bbox = bbox + it->bbox();
-    }
-    _bbox = Bbox(bbox.xmin(),bbox.ymin(),bbox.zmin(),
-                bbox.xmax(),bbox.ymax(),bbox.zmax());
-}
-
-
-void Scene_polyhedron_transform_item::invalidateOpenGLBuffers()
-{
-    compute_elements();
-    are_buffers_filled = false;
-    compute_bbox();
-}
-
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PCA/Scene_polyhedron_transform_item.h b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PCA/Scene_polyhedron_transform_item.h
deleted file mode 100644
index bc21640..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PCA/Scene_polyhedron_transform_item.h
+++ /dev/null
@@ -1,61 +0,0 @@
-#ifndef SCENE_POLYHEDRON_TRANSFORM_ITEM_H
-#define SCENE_POLYHEDRON_TRANSFORM_ITEM_H
-
-#include "Scene_polyhedron_item.h"
-#include "Scene_polyhedron_transform_item_config.h"
-#include <QGLViewer/manipulatedFrame.h>
-#include <QGLViewer/qglviewer.h>
-#include <QKeyEvent>
-
-// This class represents a polyhedron in the OpenGL scene
-class SCENE_POLYHEDRON_TRANSFORM_ITEM_EXPORT Scene_polyhedron_transform_item 
-        : public CGAL::Three::Scene_item {
-    Q_OBJECT
-    
-    typedef Scene_polyhedron_item Base;
-    
-public: 
-    Scene_polyhedron_transform_item(const qglviewer::Vec& pos,const Scene_polyhedron_item* poly_item,const CGAL::Three::Scene_interface* scene_interface);
-    Scene_item* clone() const{return NULL;}
-    QString toolTip() const;
-    void draw_edges(CGAL::Three::Viewer_interface*) const;
-    void compute_bbox() const;
-    ~Scene_polyhedron_transform_item() {delete frame; Q_EMIT killed();}
-    bool manipulatable() const { return manipulable; }
-    ManipulatedFrame* manipulatedFrame() { return frame; }
-    void setManipulatable(bool b = true) { manipulable = b;}
-    const Scene_polyhedron_item* getBase() const{ return poly_item;  };
-    const qglviewer::Vec& center() const { return center_; }
-    virtual bool supportsRenderingMode(RenderingMode m) const { return m==Wireframe ; }
-    virtual void invalidateOpenGLBuffers();
-    virtual bool keyPressEvent(QKeyEvent*);
-
-private:
-    const Scene_polyhedron_item* poly_item;
-    bool manipulable;
-    qglviewer::ManipulatedFrame* frame;
-    const Polyhedron* poly;
-    qglviewer::Vec center_;
-
-    enum VAOs {
-        Edges=0,
-        NbOfVaos = Edges+1
-    };
-    enum VBOs {
-        Vertices = 0,
-        NbOfVbos = Vertices+1
-    };
-
-    mutable QOpenGLShaderProgram *program;
-    mutable std::vector<float> positions_lines;
-    mutable std::size_t nb_lines;
-    using CGAL::Three::Scene_item::initialize_buffers;
-    void initialize_buffers(CGAL::Three::Viewer_interface *viewer) const;
-    void compute_elements() const;
-
-Q_SIGNALS:
-    void stop();
-    void killed();
-}; // end class Scene_polyhedron_transform_item
-
-#endif // SCENE_POLYHEDRON_TRANSFORM_ITEM_H
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PCA/Transform_polyhedron_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PCA/Transform_polyhedron_plugin.cpp
deleted file mode 100644
index afe9809..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PCA/Transform_polyhedron_plugin.cpp
+++ /dev/null
@@ -1,143 +0,0 @@
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-#include <CGAL/bounding_box.h>
-#include "Scene_polyhedron_transform_item.h"
-#include "Polyhedron_type.h"
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-
-#include "Scene_polylines_item.h"
-
-#include <QString>
-#include <QAction>
-#include <QMenu>
-#include <QMainWindow>
-#include <QApplication>
-#include <QTime>
-#include <QMessageBox>
-using namespace CGAL::Three;
-class Polyhedron_demo_transform_polyhedron_plugin :
-  public QObject,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-public:
-
-  Polyhedron_demo_transform_polyhedron_plugin():started(false){}
-
-  QList<QAction*> actions() const {
-    return QList<QAction*>() << actionTransformPolyhedron;
-  }
-
-  bool applicable(QAction*) const { 
-    return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex())) ||
-           qobject_cast<Scene_polyhedron_transform_item*>(scene->item(scene->mainSelectionIndex()));
-  }
-  
-  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface) {
-    this->scene = scene_interface;
-    this->mw = mainWindow;
-    actionTransformPolyhedron = new QAction("Affine Transformation", mw);
-    if(actionTransformPolyhedron) {
-      connect(actionTransformPolyhedron, SIGNAL(triggered()),this, SLOT(go()));
-    }
-  }
-
-  void start(Scene_polyhedron_item*);
-  void end();  
-  
-private:
-
-  QAction*  actionTransformPolyhedron;
-  Scene_polyhedron_transform_item* transform_item;
-  CGAL::Three::Scene_interface::Item_id tr_item_index;
-  bool started;
-
-public Q_SLOTS:
-  void go();
-  void transformed_killed();
-}; // end class Polyhedron_demo_transform_polyhedron_plugin
-
-void Polyhedron_demo_transform_polyhedron_plugin::go(){
-  if (!started){
-    Scene_item* item = scene->item(scene->mainSelectionIndex());
-    Scene_polyhedron_item* poly_item = qobject_cast<Scene_polyhedron_item*>(item);
-    if(!poly_item) return;    
-    
-    started=true;
-    actionTransformPolyhedron->setText("Apply affine transformation");
-    start(poly_item);
-  }
-  else
-    end();    
-}
-
-void Polyhedron_demo_transform_polyhedron_plugin::transformed_killed(){
-    started=false;
-    actionTransformPolyhedron->setText("Affine Transformation");
-}
-
-void Polyhedron_demo_transform_polyhedron_plugin::start(Scene_polyhedron_item* poly_item){
-  QApplication::setOverrideCursor(Qt::PointingHandCursor);
-  
-  Scene_polyhedron_item::Bbox bbox = poly_item->bbox();
-  double x=(bbox.xmin+bbox.xmax)/2;
-  double y=(bbox.ymin+bbox.ymax)/2;
-  double z=(bbox.zmin+bbox.zmax)/2;
-  
-  transform_item = new Scene_polyhedron_transform_item(qglviewer::Vec(x,y,z),poly_item,scene);
-  transform_item->setManipulatable(true);
-  transform_item->setColor(Qt::green);
-  transform_item->setName(tr("Affine Transformation"));
-  connect(transform_item, SIGNAL(stop()),this, SLOT(go()));
-  connect(transform_item, SIGNAL(killed()),this, SLOT(transformed_killed()));
-  tr_item_index=scene->addItem(transform_item);
-  scene->setSelectedItem(tr_item_index);
-}
-
-
-struct Modifier_transform_vertices : public CGAL::Modifier_base<Polyhedron::HalfedgeDS> {
-  typedef Polyhedron::HalfedgeDS HDS;
-  
-  CGAL::Aff_transformation_3<Kernel> transform;
-  Kernel::Vector_3 frame_center_translation;
-  Modifier_transform_vertices(const GLdouble* m,const qglviewer::Vec& tr):
-    transform(m[0],m[4], m[8],m[12],
-              m[1],m[5], m[9],m[13],
-              m[2],m[6],m[10],m[14],
-              /*m[3],m[7],m[11],*/m[15]),
-    frame_center_translation(-tr.x,-tr.y,-tr.z)
-  {
-    CGAL_assertion(m[3]==0);
-    CGAL_assertion(m[7]==0);
-    CGAL_assertion(m[11]==0);
-  }
-  
-  void operator()(HDS& hds)
-  {
-    for (HDS::Vertex_iterator it=hds.vertices_begin(),
-                                   endit=hds.vertices_end();endit!=it;++it)
-    {
-      it->point() = transform( it->point() + frame_center_translation );
-    }
-  }
-};
-
-
-void Polyhedron_demo_transform_polyhedron_plugin::end(){
-  QApplication::restoreOverrideCursor();
-  const GLdouble* matrix = transform_item->manipulatedFrame()->matrix();
-  Modifier_transform_vertices modifier(matrix,transform_item->center());
-  Polyhedron* new_poly=new Polyhedron(*transform_item->getBase()->polyhedron());
-  new_poly->delegate(modifier);
-  
-  Scene_polyhedron_item* new_item=new Scene_polyhedron_item(new_poly);
-  new_item->setName(tr("%1_transformed").arg(transform_item->getBase()->name()));
-  
-  scene->replaceItem(tr_item_index,new_item);
-  delete transform_item;
-}
-
-#include "Transform_polyhedron_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PCA/Trivial_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PCA/Trivial_plugin.cpp
deleted file mode 100644
index e77c678..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PCA/Trivial_plugin.cpp
+++ /dev/null
@@ -1,199 +0,0 @@
-#include <QtCore/qglobal.h>
-
-#include  <CGAL/Three/Scene_item.h>
-#include <CGAL/Three/Scene_interface.h>
-#include <CGAL/gl.h>
-
-#include <CGAL/Three/Viewer_interface.h>
-#include <QAction>
-#include <QMainWindow>
-
-class Q_DECL_EXPORT Scene_bbox_item : public CGAL::Three::Scene_item
-{
-    Q_OBJECT
-public:
-    Scene_bbox_item(const CGAL::Three::Scene_interface* scene_interface)
-        :  Scene_item(1,1), scene(scene_interface)
-
-    {
-
-        positions_lines.resize(0);
-        //Generates an integer which will be used as ID for each buffer
-    }
-    ~Scene_bbox_item()
-    {
-    }
-    bool isFinite() const { return true; }
-    bool isEmpty() const { return true; }
-    void compute_bbox() const { _bbox = scene->bbox(); }
-
-    Scene_bbox_item* clone() const {
-        return 0;
-    }
-
-    QString toolTip() const {
-        const Bbox& bb = scene->bbox();
-        return QString("<p><b>Scene bounding box</b></p>"
-                       "<p>x range: (%1, %2)<br />"
-                       "y range: (%3, %4)<br />"
-                       "z range: (%5, %6)</p>")
-                .arg(bb.xmin).arg(bb.xmax)
-                .arg(bb.ymin).arg(bb.ymax)
-                .arg(bb.zmin).arg(bb.zmax);
-    }
-
-    // Indicate if rendering mode is supported
-    bool supportsRenderingMode(RenderingMode m) const {
-        return (m == Wireframe);
-    }
-
-    void draw_edges(CGAL::Three::Viewer_interface* viewer) const
-    {
-        if(!are_buffers_filled)
-            initialize_buffers(viewer);
-        vaos[0]->bind();
-        program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
-        attrib_buffers(viewer, PROGRAM_WITHOUT_LIGHT);
-        program->bind();
-        program->setAttributeValue("colors", this->color());
-        viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(positions_lines.size()/3));
-        vaos[0]->release();
-        program->release();
-
-    }
-
-    void invalidateOpenGLBuffers()
-    {
-        compute_elements();
-        are_buffers_filled = false;
-        compute_bbox();
-    }
-
-private:
-
-    mutable std::vector<float> positions_lines;
-    mutable QOpenGLShaderProgram *program;
-    using CGAL::Three::Scene_item::initialize_buffers;
-    void initialize_buffers(CGAL::Three::Viewer_interface *viewer)const
-    {
-
-        //vao containing the data for the lines
-        {
-            program = getShaderProgram(PROGRAM_WITHOUT_LIGHT, viewer);
-            program->bind();
-
-            vaos[0]->bind();
-            buffers[0].bind();
-            buffers[0].allocate(positions_lines.data(),
-                                static_cast<GLsizei>(positions_lines.size()*sizeof(float)));
-            program->enableAttributeArray("vertex");
-            program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
-            buffers[0].release();
-
-            vaos[0]->release();
-            program->release();
-
-        }
-        are_buffers_filled = true;
-    }
-
-    void compute_elements() const
-    {
-        positions_lines.clear();
-        const Bbox& bb = scene->bbox();
-        positions_lines.push_back(bb.xmin); positions_lines.push_back(bb.ymin); positions_lines.push_back(bb.zmin);
-        positions_lines.push_back(bb.xmax); positions_lines.push_back(bb.ymin); positions_lines.push_back(bb.zmin);
-        positions_lines.push_back(bb.xmin); positions_lines.push_back(bb.ymin); positions_lines.push_back(bb.zmin);
-        positions_lines.push_back(bb.xmin); positions_lines.push_back(bb.ymax); positions_lines.push_back(bb.zmin);
-        positions_lines.push_back(bb.xmin); positions_lines.push_back(bb.ymin); positions_lines.push_back(bb.zmin);
-        positions_lines.push_back(bb.xmin); positions_lines.push_back(bb.ymin); positions_lines.push_back(bb.zmax);
-
-        positions_lines.push_back(bb.xmax); positions_lines.push_back(bb.ymin); positions_lines.push_back(bb.zmin);
-        positions_lines.push_back(bb.xmax); positions_lines.push_back(bb.ymax); positions_lines.push_back(bb.zmin);
-        positions_lines.push_back(bb.xmax); positions_lines.push_back(bb.ymin); positions_lines.push_back(bb.zmin);
-        positions_lines.push_back(bb.xmax); positions_lines.push_back(bb.ymin); positions_lines.push_back(bb.zmax);
-
-        positions_lines.push_back(bb.xmin); positions_lines.push_back(bb.ymax); positions_lines.push_back(bb.zmin);
-        positions_lines.push_back(bb.xmax); positions_lines.push_back(bb.ymax); positions_lines.push_back(bb.zmin);
-        positions_lines.push_back(bb.xmin); positions_lines.push_back(bb.ymax); positions_lines.push_back(bb.zmin);
-        positions_lines.push_back(bb.xmin); positions_lines.push_back(bb.ymax); positions_lines.push_back(bb.zmax);
-
-        positions_lines.push_back(bb.xmin); positions_lines.push_back(bb.ymin); positions_lines.push_back(bb.zmax);
-        positions_lines.push_back(bb.xmax); positions_lines.push_back(bb.ymin); positions_lines.push_back(bb.zmax);
-        positions_lines.push_back(bb.xmin); positions_lines.push_back(bb.ymin); positions_lines.push_back(bb.zmax);
-        positions_lines.push_back(bb.xmin); positions_lines.push_back(bb.ymax); positions_lines.push_back(bb.zmax);
-
-        positions_lines.push_back(bb.xmax); positions_lines.push_back(bb.ymax); positions_lines.push_back(bb.zmax);
-        positions_lines.push_back(bb.xmin); positions_lines.push_back(bb.ymax); positions_lines.push_back(bb.zmax);
-        positions_lines.push_back(bb.xmax); positions_lines.push_back(bb.ymax); positions_lines.push_back(bb.zmax);
-        positions_lines.push_back(bb.xmax); positions_lines.push_back(bb.ymin); positions_lines.push_back(bb.zmax);
-        positions_lines.push_back(bb.xmax); positions_lines.push_back(bb.ymax); positions_lines.push_back(bb.zmax);
-        positions_lines.push_back(bb.xmax); positions_lines.push_back(bb.ymax); positions_lines.push_back(bb.zmin);
-    }
-
-    const CGAL::Three::Scene_interface* scene;
-};
-
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-using namespace CGAL::Three;
-class Polyhedron_demo_trivial_plugin : 
-        public QObject,
-        public Polyhedron_demo_plugin_interface
-{
-    Q_OBJECT
-    Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-    Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-public:
-    void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface);
-    QList<QAction*> actions() const {
-        return QList<QAction*>() << actionBbox;
-    }
-
-    bool applicable(QAction*) const {
-        return true;
-    }
-public Q_SLOTS:
-
-    void bbox();
-    void enableAction();
-
-private:
-    CGAL::Three::Scene_interface* scene;
-    QAction* actionBbox;
-
-
-}; // end Polyhedron_demo_trivial_plugin
-
-void Polyhedron_demo_trivial_plugin::init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface)
-{
-    scene = scene_interface;
-    actionBbox = new QAction(tr("Create Bbox"), mainWindow);
-    //actionBbox->setProperty("subMenuName", "Object creation");
-    connect(actionBbox, SIGNAL(triggered()),
-            this, SLOT(bbox()));
-}
-
-void Polyhedron_demo_trivial_plugin::bbox()
-{
-    for(int i = 0, end = scene->numberOfEntries();
-        i < end; ++i)
-    {
-        if(qobject_cast<Scene_bbox_item*>(scene->item(i)))
-            return;
-    }
-    Scene_item* item = new Scene_bbox_item(scene);
-    connect(item, SIGNAL(destroyed()),
-            this, SLOT(enableAction()));
-    item->setName("Scene bbox");
-    item->setColor(Qt::black);
-    item->setRenderingMode(Wireframe);
-    scene->addItem(item);
-    actionBbox->setEnabled(false);
-}
-
-void Polyhedron_demo_trivial_plugin::enableAction() {
-    actionBbox->setEnabled(true);
-}
-
-#include "Trivial_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/CMakeLists.txt
deleted file mode 100644
index ec4f055..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/CMakeLists.txt
+++ /dev/null
@@ -1,77 +0,0 @@
-include( polyhedron_demo_macros )
-if(EIGEN3_FOUND)
-
-  polyhedron_demo_plugin(jet_fitting_plugin Jet_fitting_plugin)
-  target_link_libraries(jet_fitting_plugin scene_polyhedron_item scene_polylines_item)
-
-else(EIGEN3_FOUND)
-  message(STATUS "NOTICE: Eigen 3.1 (or greater) was not found. Jet fitting plugin will not be available.")
-endif(EIGEN3_FOUND)
-
-if(EIGEN3_FOUND)
-  if("${EIGEN3_VERSION}" VERSION_GREATER "3.1.90")
-
-    qt5_wrap_ui( hole_fillingUI_FILES Hole_filling_widget.ui)
-    polyhedron_demo_plugin(hole_filling_plugin Hole_filling_plugin ${hole_fillingUI_FILES})
-    target_link_libraries(hole_filling_plugin scene_polyhedron_item scene_polylines_item)
-
-    qt5_wrap_ui( fairingUI_FILES Fairing_widget.ui)
-    polyhedron_demo_plugin(fairing_plugin Fairing_plugin ${fairingUI_FILES})
-    target_link_libraries(fairing_plugin scene_polyhedron_selection_item)
-
-    polyhedron_demo_plugin(hole_filling_polyline_plugin Hole_filling_polyline_plugin)
-    target_link_libraries(hole_filling_polyline_plugin scene_polyhedron_item scene_polylines_item)
-  else()
-    message(STATUS "NOTICE: The hole filling and fairing plugins require Eigen 3.2 (or higher) and will not be available.")
-  endif()
-else()
-  message(STATUS "NOTICE: The hole filling and fairing plugins require Eigen 3.2 (or higher) and will not be available.")
-endif()
-
-
-polyhedron_demo_plugin(orient_soup_plugin Orient_soup_plugin)
-target_link_libraries(orient_soup_plugin scene_polygon_soup_item scene_polyhedron_item)
-
-
-polyhedron_demo_plugin(inside_out_plugin Inside_out_plugin)
-target_link_libraries(inside_out_plugin scene_polyhedron_item scene_polygon_soup_item)
-
-polyhedron_demo_plugin(join_and_split_polyhedra_plugin Join_and_split_polyhedra_plugin)
-target_link_libraries(join_and_split_polyhedra_plugin scene_polyhedron_item)
-
-qt5_wrap_ui( Mean_curvature_flow_skeleton_pluginUI_FILES  Mean_curvature_flow_skeleton_plugin.ui)
-polyhedron_demo_plugin(mean_curvature_flow_skeleton_plugin Mean_curvature_flow_skeleton_plugin ${Mean_curvature_flow_skeleton_pluginUI_FILES})
-target_link_libraries(mean_curvature_flow_skeleton_plugin 
-    scene_polyhedron_item 
-    scene_points_with_normal_item
-    scene_polylines_item
-    demo_framework)
-    
-qt5_wrap_ui( point_inside_polyhedronUI_FILES Point_inside_polyhedron_widget.ui)
-polyhedron_demo_plugin(point_inside_polyhedron_plugin Point_inside_polyhedron_plugin ${point_inside_polyhedronUI_FILES})
-target_link_libraries(point_inside_polyhedron_plugin scene_polyhedron_item scene_points_with_normal_item)
-
-
-qt5_wrap_ui( polyhedron_slicerUI_FILES Polyhedron_slicer_widget.ui)
-polyhedron_demo_plugin(polyhedron_slicer_plugin Polyhedron_slicer_plugin ${polyhedron_slicerUI_FILES})
-target_link_libraries(polyhedron_slicer_plugin scene_polyhedron_item scene_basic_objects scene_polylines_item)
-
-polyhedron_demo_plugin(polyhedron_stitching_plugin Polyhedron_stitching_plugin)
-target_link_libraries(polyhedron_stitching_plugin scene_polyhedron_item scene_polylines_item)
-
-qt5_wrap_ui( selectionUI_FILES Selection_widget.ui)
-polyhedron_demo_plugin(selection_plugin Selection_plugin ${selectionUI_FILES})
-target_link_libraries(selection_plugin scene_polyhedron_selection_item scene_points_with_normal_item scene_polylines_item)
-
-polyhedron_demo_plugin(self_intersection_plugin Self_intersection_plugin)
-target_link_libraries(self_intersection_plugin scene_polyhedron_item scene_polyhedron_selection_item)
-
-polyhedron_demo_plugin(triangulate_facets_plugin Triangulate_facets_plugin)
-target_link_libraries(triangulate_facets_plugin scene_polyhedron_item)
-
-polyhedron_demo_plugin(repair_polyhedron_plugin Repair_polyhedron_plugin)
-target_link_libraries(repair_polyhedron_plugin scene_polyhedron_item)
-
-qt5_wrap_ui( isotropicRemeshingUI_FILES Isotropic_remeshing_dialog.ui)
-polyhedron_demo_plugin(isotropic_remeshing_plugin Isotropic_remeshing_plugin  ${isotropicRemeshingUI_FILES})
-target_link_libraries(isotropic_remeshing_plugin  scene_polyhedron_item scene_polyhedron_selection_item)
\ No newline at end of file
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Fairing_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Fairing_plugin.cpp
deleted file mode 100644
index 89e5a88..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Fairing_plugin.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-#undef NDEBUG
-#include <QtCore/qglobal.h>
-
-#include "Messages_interface.h"
-#include "Scene_polyhedron_selection_item.h"
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include "ui_Fairing_widget.h"
-#include "Polyhedron_type.h"
-
-#include <CGAL/iterator.h>
-#include <CGAL/Polygon_mesh_processing/fair.h>
-#include <CGAL/Polygon_mesh_processing/refine.h>
-
-#include <QTime>
-#include <QAction>
-#include <QMainWindow>
-#include <QApplication>
-#include <QDockWidget>
-#include <QEvent>
-#include <QKeyEvent>
-#include <QMouseEvent>
-#include <QFileDialog>
-
-#include <vector>
-#include <algorithm>
-#include <queue>
-
-using namespace CGAL::Three;
-class Polyhedron_demo_fairing_plugin :
-  public QObject,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-public:
-  bool applicable(QAction*) const { 
-    return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()))
-    || qobject_cast<Scene_polyhedron_selection_item*>(scene->item(scene->mainSelectionIndex()));  
-  }
-  void print_message(QString message) { messages->information(message);}
-  QList<QAction*> actions() const { return QList<QAction*>() << actionFairing; }
-
-  using Polyhedron_demo_plugin_helper::init;
-  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface* m) {
-    mw = mainWindow;
-    scene = scene_interface;
-    messages = m;
-    actionFairing = new QAction(tr("Refinement and Fairing"), mw);
-    actionFairing->setProperty("subMenuName", "Polygon Mesh Processing");
-
-    connect(actionFairing, SIGNAL(triggered()), this, SLOT(fairing_action()));
-
-    dock_widget = new QDockWidget("Refinement and Fairing", mw);
-    dock_widget->setVisible(false);
-
-    ui_widget.setupUi(dock_widget);
-    add_dock_widget(dock_widget);
-
-    connect(ui_widget.Fair_button,  SIGNAL(clicked()), this, SLOT(on_Fair_button_clicked()));  
-    connect(ui_widget.Refine_button,  SIGNAL(clicked()), this, SLOT(on_Refine_button_clicked()));
-  }
-  virtual void closure()
-  {
-    dock_widget->hide();
-  }
-
-public Q_SLOTS:
-  void fairing_action() {
-    dock_widget->show();
-    dock_widget->raise();
-  }
-
-  void on_Fair_button_clicked() {
-    Scene_polyhedron_selection_item* selection_item = get_selected_item<Scene_polyhedron_selection_item>();
-    if(!selection_item) { return; }
-
-    if(selection_item->selected_vertices.empty()) {
-      print_message("Error: please select a region of vertices!");
-    }
-    QApplication::setOverrideCursor(Qt::WaitCursor);
-    int weight_index = ui_widget.Weight_combo_box->currentIndex();
-    unsigned int continuity = ui_widget.Continuity_spin_box->value();
-
-    if(weight_index == 1)
-      CGAL::Polygon_mesh_processing::fair(*selection_item->polyhedron(),
-        selection_item->selected_vertices,
-        CGAL::Polygon_mesh_processing::parameters::weight_calculator(CGAL::internal::Uniform_weight_fairing<Polyhedron>(*selection_item->polyhedron())).
-        fairing_continuity(continuity));
-    if(weight_index == 0)
-      CGAL::Polygon_mesh_processing::fair(*selection_item->polyhedron(),
-        selection_item->selected_vertices,
-        CGAL::Polygon_mesh_processing::parameters::fairing_continuity(continuity));
-    selection_item->changed_with_poly_item();
-    selection_item->invalidateOpenGLBuffers();
-    QApplication::restoreOverrideCursor();
-  }
-
-  void on_Refine_button_clicked() {
-    Scene_polyhedron_selection_item* selection_item = get_selected_item<Scene_polyhedron_selection_item>();
-    if(!selection_item) { return; }
-
-    if(selection_item->selected_facets.empty()) {
-      print_message("Error: please select a region of facets!");
-    }
-    QApplication::setOverrideCursor(Qt::WaitCursor);
-    double alpha = ui_widget.Density_control_factor_spin_box->value();
-    std::vector<Polyhedron::Facet_handle> new_facets;
-
-    CGAL::Polygon_mesh_processing::refine(*selection_item->polyhedron(),
-      selection_item->selected_facets,
-      std::back_inserter(new_facets),
-      CGAL::Emptyset_iterator(),
-      CGAL::Polygon_mesh_processing::parameters::density_control_factor(alpha));
-    // add new facets to selection
-    for(std::vector<Polyhedron::Facet_handle>::iterator it = new_facets.begin(); it != new_facets.end(); ++it) {
-      selection_item->selected_facets.insert(*it);
-    }
-    selection_item->changed_with_poly_item();
-    selection_item->invalidateOpenGLBuffers();
-    QApplication::restoreOverrideCursor();
-  }
-
-private:
-  Messages_interface* messages;
-  QAction* actionFairing;
-
-  QDockWidget* dock_widget;
-  Ui::Fairing ui_widget;
-
-}; // end Polyhedron_demo_fairing_plugin
-
-// Q_EXPORT_PLUGIN2(Polyhedron_demo_fairing_plugin, Polyhedron_demo_fairing_plugin)
-
-#include "Fairing_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Fairing_widget.ui b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Fairing_widget.ui
deleted file mode 100644
index 8a4b371..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Fairing_widget.ui
+++ /dev/null
@@ -1,144 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>Fairing</class>
- <widget class="QDockWidget" name="Fairing">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>296</width>
-    <height>248</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Fairing</string>
-  </property>
-  <widget class="QWidget" name="dockWidgetContents">
-   <layout class="QVBoxLayout" name="verticalLayout">
-    <item>
-     <widget class="QGroupBox" name="groupBox">
-      <property name="title">
-       <string>Fairing</string>
-      </property>
-      <layout class="QVBoxLayout" name="verticalLayout_2">
-       <item>
-        <layout class="QHBoxLayout" name="horizontalLayout_4">
-         <item>
-          <widget class="QLabel" name="label_2">
-           <property name="text">
-            <string>Weight Type:</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QComboBox" name="Weight_combo_box">
-           <property name="currentIndex">
-            <number>0</number>
-           </property>
-           <item>
-            <property name="text">
-             <string>Cotangent Weight</string>
-            </property>
-           </item>
-           <item>
-            <property name="text">
-             <string>Uniform Weight</string>
-            </property>
-           </item>
-          </widget>
-         </item>
-        </layout>
-       </item>
-       <item>
-        <layout class="QHBoxLayout" name="horizontalLayout_2">
-         <item>
-          <widget class="QLabel" name="label_3">
-           <property name="text">
-            <string>Continuity:</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QSpinBox" name="Continuity_spin_box">
-           <property name="minimum">
-            <number>0</number>
-           </property>
-           <property name="maximum">
-            <number>2</number>
-           </property>
-           <property name="value">
-            <number>1</number>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </item>
-       <item>
-        <widget class="QPushButton" name="Fair_button">
-         <property name="text">
-          <string>Fair a region defined by a selection of vertices</string>
-         </property>
-        </widget>
-       </item>
-      </layout>
-     </widget>
-    </item>
-    <item>
-     <widget class="QGroupBox" name="groupBox_2">
-      <property name="title">
-       <string>Refinement</string>
-      </property>
-      <layout class="QVBoxLayout" name="verticalLayout_3">
-       <item>
-        <layout class="QHBoxLayout" name="horizontalLayout">
-         <item>
-          <widget class="QLabel" name="label">
-           <property name="text">
-            <string>Density Control Factor:</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QDoubleSpinBox" name="Density_control_factor_spin_box">
-           <property name="maximum">
-            <double>96.989999999999995</double>
-           </property>
-           <property name="singleStep">
-            <double>0.200000000000000</double>
-           </property>
-           <property name="value">
-            <double>2.410000000000000</double>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </item>
-       <item>
-        <widget class="QPushButton" name="Refine_button">
-         <property name="text">
-          <string>Refine a region defined by a selection of faces</string>
-         </property>
-        </widget>
-       </item>
-      </layout>
-     </widget>
-    </item>
-    <item>
-     <spacer name="verticalSpacer">
-      <property name="orientation">
-       <enum>Qt::Vertical</enum>
-      </property>
-      <property name="sizeHint" stdset="0">
-       <size>
-        <width>20</width>
-        <height>40</height>
-       </size>
-      </property>
-     </spacer>
-    </item>
-   </layout>
-  </widget>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Hole_filling_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Hole_filling_plugin.cpp
deleted file mode 100644
index 49facb2..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Hole_filling_plugin.cpp
+++ /dev/null
@@ -1,702 +0,0 @@
-#undef NDEBUG
-#define DEBUG_TRACE
-#include <QtCore/qglobal.h>
-
-#include "Messages_interface.h"
-#include "Scene_polyhedron_item.h"
-#include "Scene_polylines_item.h"
-#include "Scene.h"
-
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include "ui_Hole_filling_widget.h"
-#include "Polyhedron_type.h"
-
-#include <CGAL/Polygon_mesh_processing/triangulate_hole.h>
-#include <CGAL/Timer.h>
-#include <CGAL/iterator.h>
-
-#include <QTime>
-#include <QAction>
-#include <QMainWindow>
-#include <QApplication>
-#include <QDockWidget>
-
-#include <QEvent>
-#include <QKeyEvent>
-#include <QMouseEvent>
-
-#include <vector>
-#include <algorithm>
-
-#include <QGLViewer/qglviewer.h>
-
-#include <CGAL/Polygon_mesh_processing/self_intersections.h>
-#include "Kernel_type.h"
-
-#include <boost/function_output_iterator.hpp>
-#include <QMap>
-
-// Class for visualizing holes in a polyhedron
-// provides mouse selection functionality
-class Q_DECL_EXPORT Scene_hole_visualizer : public CGAL::Three::Scene_item
-{
-  Q_OBJECT
-public:
-  // structs
-  struct Polyline_data {
-    Scene_polylines_item* polyline;
-    Polyhedron::Halfedge_handle halfedge;
-    qglviewer::Vec position;
-  };
-  struct Mouse_keyboard_state
-  {
-    bool ctrl_pressing, left_button_pressing;
-    Mouse_keyboard_state() : ctrl_pressing(false), left_button_pressing(false) { }
-  };
-public: typedef std::list<Polyline_data> Polyline_data_list;
-private:
-  struct List_iterator_comparator {
-    bool operator()(Polyline_data_list::const_iterator it_1, Polyline_data_list::const_iterator it_2) const 
-    { return (&*it_1) < (&*it_2); }
-  };
-public:
-  typedef std::set<Polyline_data_list::const_iterator, List_iterator_comparator> Selected_holes_set;
-
-  Scene_hole_visualizer(Scene_polyhedron_item* poly_item, QMainWindow* mainWindow)
-    : poly_item(poly_item), block_poly_item_changed(false)
-  {
-    get_holes();
-    active_hole = polyline_data_list.end();
-
-    QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
-    viewer->installEventFilter(this);
-    mainWindow->installEventFilter(this);
-
-    connect(poly_item, SIGNAL(item_is_about_to_be_changed()), this, SLOT(poly_item_changed())); 
-  }
-  ~Scene_hole_visualizer() {
-    clear();
-  }
-  bool isFinite() const { return true; }
-  bool isEmpty() const { return polyline_data_list.empty(); }
-  void compute_bbox() const {
-    if(polyline_data_list.empty()) { _bbox = Bbox(); return;}
-    Bbox bbox = polyline_data_list.begin()->polyline->bbox();
-    for(Polyline_data_list::const_iterator it = polyline_data_list.begin(); it != polyline_data_list.end(); ++it) {
-      bbox = bbox + it->polyline->bbox();
-    }
-    _bbox = bbox;
-  }
-  Scene_hole_visualizer* clone() const {
-    return 0;
-  }
-  QString toolTip() const {
-    return tr("%1 with %2 holes").arg(name()).arg(polyline_data_list.size());
-  }
-
-  bool supportsRenderingMode(RenderingMode m) const {
-    return (m == Wireframe);
-  }
-  void draw() const {}
-  void draw_edges(CGAL::Three::Viewer_interface* viewer) const {
-    
-    for(Polyline_data_list::const_iterator it = polyline_data_list.begin(); it != polyline_data_list.end(); ++it) {
-      if(it == active_hole) { viewer->glLineWidth(7.f); }
-      else                  { viewer->glLineWidth(3.f); }
-
-      if(selected_holes.find(it) != selected_holes.end()) 
-      { it->polyline->setRbgColor(255, 0, 0); }
-      else 
-      { it->polyline->setRbgColor(0, 0, 255); }
-
-      it->polyline->draw_edges(viewer);
-    }
-  }
-
-  void select_deselect_all(bool select) {
-    if(select) {
-      for(Polyline_data_list::iterator it = polyline_data_list.begin(); it != polyline_data_list.end(); ++it)
-      { selected_holes.insert(it); }
-    }
-    else {
-      selected_holes.clear();
-    }
-    Q_EMIT itemChanged();
-  }
-
-  // filter events for selecting / activating holes with mouse input
-  bool eventFilter(QObject* /*target*/, QEvent *event)
-  {
-    // This filter is both filtering events from 'viewer' and 'main window'
-    Mouse_keyboard_state old_state = state;
-    // key events
-    if(event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease)  {
-      QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
-      Qt::KeyboardModifiers modifiers = keyEvent->modifiers();
-
-      state.ctrl_pressing = modifiers.testFlag(Qt::ControlModifier);
-    }
-    // mouse events
-    if(event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonRelease) {
-      QMouseEvent* mouse_event = static_cast<QMouseEvent*>(event);
-      if(mouse_event->button() == Qt::LeftButton) {
-        state.left_button_pressing = event->type() == QEvent::MouseButtonPress;
-      }   
-    }
-
-    if(!visible()) { return false; } // if not visible just update event state but don't do any action
-
-    // activate closest hole
-    if(event->type() == QEvent::HoverMove) 
-    {
-      QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
-      const QPoint& p = viewer->mapFromGlobal(QCursor::pos());
-      bool need_repaint = activate_closest_hole(p.x(), p.y());
-      if(need_repaint) { Q_EMIT itemChanged(); }
-    }
-
-    // select closest hole
-    bool left_clicked_now = state.left_button_pressing && !old_state.left_button_pressing;
-    if(left_clicked_now && state.ctrl_pressing) {
-      Selected_holes_set::iterator active_it = selected_holes.find(active_hole);
-      if(active_it == selected_holes.end()) {
-        selected_holes.insert(active_hole);
-      }
-      else { selected_holes.erase(active_it); }
-      Q_EMIT itemChanged();
-    }
-    return false;
-  }
-
-private:
-  // find holes in polyhedron and construct a internal polyline for each
-  void get_holes() {
-    typedef Polyhedron::Halfedge_iterator Halfedge_iterator;
-    typedef Polyhedron::Halfedge_around_facet_circulator Halfedge_around_facet_circulator;
-    // save selected hole positions to keep selected holes selected
-    // we just use center position of holes for identification which might not work good for advanced cases...
-    std::vector<qglviewer::Vec> selected_hole_positions;
-    for(Selected_holes_set::const_iterator it = selected_holes.begin(); it != selected_holes.end(); ++it) {
-      selected_hole_positions.push_back((*it)->position);
-    }
-
-    clear();
-
-    Polyhedron& poly = *poly_item->polyhedron();
-    for(Halfedge_iterator it = poly.halfedges_begin(); it != poly.halfedges_end(); ++it)
-    { it->id() = 0; }
-
-    for(Halfedge_iterator it = poly.halfedges_begin(); it != poly.halfedges_end(); ++it){
-      if(it->is_border() && it->id() == 0){
-        polyline_data_list.push_back(Polyline_data());
-        Polyline_data& polyline_data = polyline_data_list.back();
-        polyline_data.polyline = new Scene_polylines_item();
-        polyline_data.polyline->polylines.push_back(Scene_polylines_item::Polyline());
-        polyline_data.halfedge = it;
-
-        qglviewer::Vec center;
-        int counter = 0;
-        Halfedge_around_facet_circulator hf_around_facet = it->facet_begin();
-        do {
-          CGAL_assertion(hf_around_facet->id() == 0);
-          hf_around_facet->id() = 1;
-          const Polyhedron::Traits::Point_3& p = hf_around_facet->vertex()->point();          
-          polyline_data.polyline->polylines.front().push_back(p);
-          center += qglviewer::Vec(p.x(), p.y(), p.z());
-          ++counter;
-        } while(++hf_around_facet != it->facet_begin());
-        polyline_data.polyline->polylines.front().push_back(hf_around_facet->vertex()->point());
-        polyline_data.position = center / counter;
-      }
-    }
-    //keep previous selected holes selected
-    for(Polyline_data_list::const_iterator it = polyline_data_list.begin(); it != polyline_data_list.end(); ++it) {
-      if(std::find(selected_hole_positions.begin(), selected_hole_positions.end(), it->position) != selected_hole_positions.end()) {
-        selected_holes.insert(it);
-      }
-    }
-  }
-  // finds closest polyline from polyline_data_list and makes it active_hole
-  bool activate_closest_hole(int x, int y) {
-    typedef Polyhedron::Halfedge_around_facet_circulator Halfedge_around_facet_circulator;
-    if(polyline_data_list.empty()) { return false; }
-
-    QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
-    qglviewer::Camera* camera = viewer->camera();
-
-    Polyline_data_list::const_iterator min_it;
-    double min_dist = (std::numeric_limits<double>::max)();
-    Kernel::Point_2 xy(x,y);
-    for(Polyline_data_list::const_iterator it = polyline_data_list.begin(); it != polyline_data_list.end(); ++it)
-    {
-#if 0
-      /* use center of polyline to measure distance - performance wise */
-      const qglviewer::Vec& pos_it = camera->projectedCoordinatesOf(it->position);
-      float dist = std::pow(pos_it.x - x, 2) + std::pow(pos_it.y - y, 2);
-      if(dist < min_dist) {
-        min_dist = dist;
-        min_it = it;
-      }
-#else
-      /* use polyline points to measure distance - might hurt performance for large holes */
-      Halfedge_around_facet_circulator hf_around_facet = it->halfedge->facet_begin();
-      do {
-        
-        const Polyhedron::Traits::Point_3& p_1 = hf_around_facet->vertex()->point();
-        const qglviewer::Vec& pos_it_1 = camera->projectedCoordinatesOf(qglviewer::Vec(p_1.x(), p_1.y(), p_1.z()));
-        const Polyhedron::Traits::Point_3& p_2 = hf_around_facet->opposite()->vertex()->point();
-        const qglviewer::Vec& pos_it_2 = camera->projectedCoordinatesOf(qglviewer::Vec(p_2.x(), p_2.y(), p_2.z()));
-        Kernel::Segment_2 s(Kernel::Point_2(pos_it_1.x, pos_it_1.y), Kernel::Point_2(pos_it_2.x, pos_it_2.y));
-
-        double dist = CGAL::squared_distance(s, xy);
-        if(dist < min_dist) {
-          min_dist = dist;
-          min_it = it;
-        }
-      } while(++hf_around_facet != it->halfedge->facet_begin());
-#endif
-    }
-
-    if(min_it == active_hole) { 
-      return false;
-    }
-    active_hole = min_it;
-    return true;
-  }
-  // clears internal data except poly_item
-  void clear() {
-    for(Polyline_data_list::const_iterator it = polyline_data_list.begin(); it != polyline_data_list.end(); ++it) {
-      delete it->polyline;
-    }
-    polyline_data_list.clear();
-    selected_holes.clear();
-    active_hole = polyline_data_list.end();
-  }
-  
-  Polyline_data_list::const_iterator active_hole;
-  Mouse_keyboard_state state;
-public:
-  Selected_holes_set selected_holes;
-  Scene_polyhedron_item* poly_item;
-  Polyline_data_list polyline_data_list;
-  bool block_poly_item_changed;
-
-public Q_SLOTS:
-  void poly_item_changed() {
-    if(block_poly_item_changed) { return; }
-    get_holes();
-    Q_EMIT itemChanged();
-  }
-
-}; // end class Scene_hole_visualizer
-///////////////////////////////////////////////////////////////////////////////////////////////////
-using namespace CGAL::Three;
-class Polyhedron_demo_hole_filling_plugin :
-  public QObject,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-public:
-  bool applicable(QAction*) const { return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex())); }
-  void print_message(QString message) { messages->information(message); }
-  QList<QAction*> actions() const { return QList<QAction*>() << actionHoleFilling; }
-
-  using Polyhedron_demo_plugin_helper::init;
-  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface* m);
-
-  virtual void closure()
-  {
-    dock_widget->hide();
-  }
-  Scene_hole_visualizer* get_hole_visualizer(Scene_polyhedron_item* poly_item) {
-      return visualizers[poly_item];
-  }
-
-public Q_SLOTS:
-  void hole_filling_action() { 
-    dock_widget->show();
-    dock_widget->raise();
-    if(scene->numberOfEntries() < 2) { on_Visualize_holes_button(); }
-  }
-  void on_Select_all_holes_button();
-  void on_Deselect_all_holes_button();
-  void on_Visualize_holes_button();
-  void on_Fill_selected_holes_button();
-  void on_Create_polyline_items_button();
-  void on_Accept_button();
-  void on_Reject_button();
-  void item_about_to_be_destroyed(CGAL::Three::Scene_item*);
-  void hole_visualizer_changed();
-  void dock_widget_closed();
-  void on_Select_small_holes_button();
-protected:
-  bool eventFilter(QObject *, QEvent *event) {
-    if(event->type() == QEvent::Close) {
-      dock_widget_closed();
-    }
-    return false;
-  }
-
-  void change_poly_item_by_blocking(Scene_polyhedron_item* poly_item, Scene_hole_visualizer* collection) {
-    if(collection) collection->block_poly_item_changed = true;
-    poly_item->invalidateOpenGLBuffers();
-    scene->itemChanged(poly_item);
-    if(collection) collection->block_poly_item_changed = false;
-  }
-private:
-  Messages_interface* messages;
-  QAction* actionHoleFilling;
-
-  QDockWidget* dock_widget;
-  Ui::HoleFilling ui_widget;
-
-  //Maintains a reference between all the visualizers and their poly_item
-  // to ease the management of the visualizers
-  QMap<Scene_polyhedron_item*, Scene_hole_visualizer*> visualizers;
-  // hold created facet for accept reject functionality
-  std::vector<Polyhedron::Facet_handle> new_facets; 
-  Scene_polyhedron_item* last_active_item; // always keep it NULL while not active-reject state
- 
-  bool fill(Polyhedron& polyhedron, Polyhedron::Halfedge_handle halfedge);
-  bool self_intersecting(Polyhedron& polyhedron);
-  void accept_reject_toggle(bool activate_accept_reject) {
-    if(activate_accept_reject) {
-      ui_widget.Accept_button->setVisible(true);
-      ui_widget.Reject_button->setVisible(true);
-
-      Q_FOREACH( QWidget* w, ui_widget.dockWidgetContents->findChildren<QWidget*>() )
-      { w->setEnabled(false); }
-
-      ui_widget.Accept_button->setEnabled(true);
-      ui_widget.Reject_button->setEnabled(true);
-    }
-    else {
-      ui_widget.Accept_button->setVisible(false);
-      ui_widget.Reject_button->setVisible(false);
-
-      Q_FOREACH( QWidget* w, ui_widget.dockWidgetContents->findChildren<QWidget*>() )
-      { w->setEnabled(true); }
-    }
-  }
-
-  static QString no_selected_hole_visualizer_error_message() {
-    return "Error: please select a hole visualizer from Geometric Objects list."
-      "Use 'Visualize Holes' button to create one by selecting the polyhedron item!";
-  }
-
-}; // end Polyhedron_demo_hole_filling_plugin
-
-void Polyhedron_demo_hole_filling_plugin::init(QMainWindow* mainWindow,
-                                      CGAL::Three::Scene_interface* scene_interface,
-                                      Messages_interface* m)
-{
-  last_active_item = NULL;
-
-  mw = mainWindow;
-  scene = scene_interface;
-  messages = m;
-
-  actionHoleFilling = new QAction(tr("Hole Filling"), mw);
-  actionHoleFilling->setProperty("subMenuName", "Polygon Mesh Processing");
-  connect(actionHoleFilling, SIGNAL(triggered()), this, SLOT(hole_filling_action()));
-
-  dock_widget = new QDockWidget("Hole Filling", mw);
-  dock_widget->setVisible(false);
-  dock_widget->installEventFilter(this);
-
-  ui_widget.setupUi(dock_widget);
-  ui_widget.Accept_button->setVisible(false);
-  ui_widget.Reject_button->setVisible(false);
-
-  add_dock_widget(dock_widget);
-  
-  connect(ui_widget.Visualize_holes_button,  SIGNAL(clicked()), this, SLOT(on_Visualize_holes_button()));  
-  connect(ui_widget.Fill_selected_holes_button,  SIGNAL(clicked()), this, SLOT(on_Fill_selected_holes_button())); 
-  connect(ui_widget.Select_all_holes_button,  SIGNAL(clicked()), this, SLOT(on_Select_all_holes_button()));
-  connect(ui_widget.Deselect_all_holes_button,  SIGNAL(clicked()), this, SLOT(on_Deselect_all_holes_button()));
-  connect(ui_widget.Create_polyline_items_button,  SIGNAL(clicked()), this, SLOT(on_Create_polyline_items_button()));
-  connect(ui_widget.Accept_button,  SIGNAL(clicked()), this, SLOT(on_Accept_button()));
-  connect(ui_widget.Reject_button,  SIGNAL(clicked()), this, SLOT(on_Reject_button()));
-  connect(ui_widget.Select_small_holes_button,  SIGNAL(clicked()), this, SLOT(on_Select_small_holes_button()));
-
-  if(Scene* scene_casted = dynamic_cast<Scene*>(scene_interface)) 
-  { connect(scene_casted, SIGNAL(itemAboutToBeDestroyed(CGAL::Three::Scene_item*)), this, SLOT(item_about_to_be_destroyed(CGAL::Three::Scene_item*))); }
-}
-
-void Polyhedron_demo_hole_filling_plugin::item_about_to_be_destroyed(CGAL::Three::Scene_item* scene_item) {
-  Scene_polyhedron_item* poly_item = qobject_cast<Scene_polyhedron_item*>(scene_item);
-  if(poly_item) {
-    // erase assoc polylines item
-    scene->erase( scene->item_id( get_hole_visualizer(poly_item) ) );
-    visualizers.remove(poly_item);
-    // close accept-reject dialog if it is open
-    if(last_active_item == poly_item) {
-      on_Accept_button();
-    }
-  }
-  else {
-    Scene_hole_visualizer* visu_item = qobject_cast<Scene_hole_visualizer*>(scene_item);
-    if(visu_item) {
-        visualizers.remove(visu_item->poly_item);
-    }
-  }
-}
-// removes Scene_hole_visualizer items
-void Polyhedron_demo_hole_filling_plugin::dock_widget_closed() {
-  // remove all Scene_hole_visualizer items
-  for(CGAL::Three::Scene_interface::Item_id i = 0, end = scene->numberOfEntries();
-    i < end; ++i)
-  {
-    Scene_hole_visualizer* hole_visualizer = qobject_cast<Scene_hole_visualizer*>(scene->item(i));
-    if(hole_visualizer) {
-      scene->erase( scene->item_id(hole_visualizer) );
-    }
-  }
-  on_Accept_button(); 
-}
-// creates a Scene_hole_visualizer and associate it with active Scene_polyhedron_item
-void Polyhedron_demo_hole_filling_plugin::on_Visualize_holes_button() {
-  Scene_polyhedron_item* poly_item = get_selected_item<Scene_polyhedron_item>();
-  if(!poly_item) {
-    print_message("Error: please select a polyhedron item from Geometric Objects list!");
-    return;
-  }
-
-  if(get_hole_visualizer(poly_item)) {
-    print_message("Error: selected polyhedron item already has an associated hole visualizer!");
-    return;
-  }
-
-  Scene_hole_visualizer* hole_visualizer = new Scene_hole_visualizer(poly_item, mw);
-  visualizers[poly_item] = hole_visualizer;
-  connect(hole_visualizer, SIGNAL(itemChanged()), this, SLOT(hole_visualizer_changed()));
-
-  if(hole_visualizer->polyline_data_list.empty()) {
-    print_message("There is no hole in selected polyhedron item!");
-    visualizers.remove(poly_item);
-    delete hole_visualizer;
-    return;
-  }
-  else {
-    // poly_item->setFlatMode(); // for better visualization
-    int item_id = scene->addItem(hole_visualizer);
-    scene->setSelectedItem(item_id);
-    hole_visualizer->setName(tr("%1-hole visualizer").arg(poly_item->name()));
-  }
-}
-// fills selected holes on active Scene_hole_visualizer
-void Polyhedron_demo_hole_filling_plugin::on_Fill_selected_holes_button() {
-  // get active polylines item
-  Scene_hole_visualizer* hole_visualizer = get_selected_item<Scene_hole_visualizer>();
-  if(!hole_visualizer) {
-    print_message(no_selected_hole_visualizer_error_message());
-    return;
-  }
-  if(hole_visualizer->selected_holes.empty()) {
-    print_message("Error: there is no selected holes in hole visualizer!");
-    return;
-  }
-
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-  // fill selected holes  
-  int counter = 0;
-  int filled_counter = 0;
-  for(Scene_hole_visualizer::Selected_holes_set::iterator it = hole_visualizer->selected_holes.begin();
-    it != hole_visualizer->selected_holes.end(); ++it, ++counter) {
-      print_message(tr("Hole %1:").arg(counter));
-      if( fill(*(hole_visualizer->poly_item->polyhedron()), (*it)->halfedge) ) { ++filled_counter;}
-  }
-
-  if(filled_counter > 0) {
-    change_poly_item_by_blocking(hole_visualizer->poly_item, hole_visualizer);
-    last_active_item = hole_visualizer->poly_item;
-    accept_reject_toggle(true);
-  }
-  print_message(tr("%1 of %2 holes are filled!").arg(filled_counter).arg(counter));
-  QApplication::restoreOverrideCursor();
-}
-
-// fills all holes and removes associated Scene_hole_visualizer if any
-void Polyhedron_demo_hole_filling_plugin::on_Select_all_holes_button() {
-  Scene_hole_visualizer* hole_visualizer = get_selected_item<Scene_hole_visualizer>();
-  if(!hole_visualizer) {
-    print_message(no_selected_hole_visualizer_error_message());
-    return;
-  }
-  hole_visualizer->select_deselect_all(true);
-}
-
-void Polyhedron_demo_hole_filling_plugin::on_Select_small_holes_button() {
-  Scene_hole_visualizer* hole_visualizer = get_selected_item<Scene_hole_visualizer>();
-  if(!hole_visualizer) {
-    print_message(no_selected_hole_visualizer_error_message());
-    return;
-  }
-
-  std::size_t threshold = ui_widget.vertices_threshold_spin_box->value();
-  typedef Scene_hole_visualizer::Polyline_data_list::const_iterator const_iterator;
-  for(const_iterator it = hole_visualizer->polyline_data_list.begin();
-                     it != hole_visualizer->polyline_data_list.end(); ++it)
-  {
-    if(it->polyline->polylines.front().size() <= threshold+1)
-      hole_visualizer->selected_holes.insert(it);
-  }
-  scene->itemChanged(hole_visualizer);
-}
-
-void Polyhedron_demo_hole_filling_plugin::on_Deselect_all_holes_button() {
-  Scene_hole_visualizer* hole_visualizer = get_selected_item<Scene_hole_visualizer>();
-  if(!hole_visualizer) {
-    print_message(no_selected_hole_visualizer_error_message());
-    return;
-  }
-  hole_visualizer->select_deselect_all(false);
-}
-
-// Simply create polyline items and put them into scene - nothing related with other parts of the plugin
-void Polyhedron_demo_hole_filling_plugin::on_Create_polyline_items_button(){
-  Scene_hole_visualizer* hole_visualizer = get_selected_item<Scene_hole_visualizer>();
-  if(!hole_visualizer) {
-    print_message(no_selected_hole_visualizer_error_message());
-    return;
-  }
-  if(hole_visualizer->selected_holes.empty()) {
-    print_message("Error: there is no selected holes in hole visualizer!");
-    return;
-  }
-  int counter = 0;
-  for(Scene_hole_visualizer::Selected_holes_set::iterator it = hole_visualizer->selected_holes.begin();
-    it != hole_visualizer->selected_holes.end(); ++it) {
-      Scene_polylines_item* polyline_item = new Scene_polylines_item();
-      polyline_item->polylines = (*it)->polyline->polylines;
-      polyline_item->setName(QString("selected hole %1").arg(counter++));
-      scene->addItem(polyline_item);
-  }
-}
-void Polyhedron_demo_hole_filling_plugin::on_Accept_button() {
-  if(last_active_item == NULL) { return; }
-
-  accept_reject_toggle(false);
-  if(Scene_hole_visualizer* hole_visualizer = get_hole_visualizer(last_active_item)) 
-  { hole_visualizer->poly_item_changed();}
-
-  new_facets.clear();
-  last_active_item = NULL;
-}
-void Polyhedron_demo_hole_filling_plugin::on_Reject_button() {
-  if(last_active_item == NULL) { return; }
-
-  accept_reject_toggle(false);
-  for(std::vector<Polyhedron::Facet_handle>::iterator it = new_facets.begin(); it != new_facets.end(); ++it) {
-   last_active_item->polyhedron()->erase_facet((*it)->halfedge());
-  }
-  change_poly_item_by_blocking(last_active_item, get_hole_visualizer(last_active_item));
-
-  new_facets.clear();
-  last_active_item = NULL;
-}
-// To delete Scene_hole_visualizer when it becomes empty
-void Polyhedron_demo_hole_filling_plugin::hole_visualizer_changed() {
-  Scene_hole_visualizer* hole_visualizer = qobject_cast<Scene_hole_visualizer*>(this->sender());
-  if(hole_visualizer && hole_visualizer->polyline_data_list.empty()) {
-    scene->erase( scene->item_id(hole_visualizer));
-    visualizers.remove(hole_visualizer->poly_item);
-  }
-}
-// helper function for filling holes
-bool Polyhedron_demo_hole_filling_plugin::fill
-  (Polyhedron& poly, Polyhedron::Halfedge_handle it) {
-
-  int action_index = ui_widget.action_combo_box->currentIndex();
-  double alpha = ui_widget.Density_control_factor_spin_box->value();
-  bool use_DT = ui_widget.Use_delaunay_triangulation_check_box->isChecked();
-  unsigned int continuity = ui_widget.Continuity_spin_box->value();
-
-  CGAL::Timer timer; timer.start();
-  std::vector<Polyhedron::Facet_handle> patch;
-  if(action_index == 0) {
-    CGAL::Polygon_mesh_processing::triangulate_hole(poly,
-             it, std::back_inserter(patch),
-             CGAL::Polygon_mesh_processing::parameters::use_delaunay_triangulation(use_DT));
-  }
-  else if(action_index == 1) {
-    CGAL::Polygon_mesh_processing::triangulate_and_refine_hole(poly,
-             it, std::back_inserter(patch), CGAL::Emptyset_iterator(),
-             CGAL::Polygon_mesh_processing::parameters::density_control_factor(alpha).
-             use_delaunay_triangulation(use_DT));
-  }
-  else {
-    int weight_index = ui_widget.weight_combo_box->currentIndex();
-
-    bool success;
-    if(weight_index == 0) {
-      success = CGAL::cpp11::get<0>(CGAL::Polygon_mesh_processing::triangulate_refine_and_fair_hole(poly,
-              it, std::back_inserter(patch), CGAL::Emptyset_iterator(),
-              CGAL::Polygon_mesh_processing::parameters::weight_calculator
-                (CGAL::internal::Uniform_weight_fairing<Polyhedron>(poly)).
-              density_control_factor(alpha).
-              fairing_continuity(continuity).
-              use_delaunay_triangulation(use_DT)));
-    }
-    else {
-      success = CGAL::cpp11::get<0>(CGAL::Polygon_mesh_processing::triangulate_refine_and_fair_hole(poly,
-              it, std::back_inserter(patch), CGAL::Emptyset_iterator(),
-              CGAL::Polygon_mesh_processing::parameters::weight_calculator(CGAL::internal::Cotangent_weight_with_voronoi_area_fairing<Polyhedron>(poly)).
-              density_control_factor(alpha).
-              fairing_continuity(continuity).
-              use_delaunay_triangulation(use_DT)));
-    }
-
-    if(!success) { print_message("Error: fairing is not successful, only triangulation and refinement are applied!"); }
-  }
-  print_message(QString("Took %1 sec.").arg(timer.time()));
-
-  if(patch.empty()) {
-    print_message(tr("Warning: generating patch is not successful! %1")
-      .arg(use_DT ? "Please try without 'Use 3D Delaunay Triangulation'!" : ""));
-    return false;
-  }
-
-  // Self intersection test
-  if(ui_widget.Skip_self_intersection_check_box->checkState() == Qt::Checked) {
-    timer.reset();
-
-    typedef std::vector<std::pair<Polyhedron::Facet_const_handle, Polyhedron::Facet_const_handle> > Intersected_facets;
-    Intersected_facets intersected_facets;
-    CGAL::Polygon_mesh_processing::self_intersections(poly,
-      std::back_inserter(intersected_facets),
-      CGAL::Polygon_mesh_processing::parameters::vertex_point_map(get(CGAL::vertex_point, poly)));
-
-    print_message(QString("Self intersecting test: finding intersecting triangles in %1 sec.").arg(timer.time()));
-    timer.reset();
-    // this part might need speed-up
-    bool intersected = false;
-    for(Intersected_facets::iterator it = intersected_facets.begin(); 
-      it != intersected_facets.end() && !intersected; ++it) {
-      for(std::vector<Polyhedron::Facet_handle>::iterator it_patch = patch.begin(); 
-        it_patch != patch.end() && !intersected; ++it_patch) {
-        if(it->first == (*it_patch) || it->second == (*it_patch)) {
-          intersected = true;
-        }
-      }
-    }
-    print_message(QString("Self intersecting test: iterate on patch in %1 sec.").arg(timer.time()));
-    if(intersected) {
-      for(std::vector<Polyhedron::Facet_handle>::iterator it = patch.begin(); it != patch.end(); ++it) {
-        poly.erase_facet((*it)->halfedge());
-      }
-      print_message("Self intersecting patch is generated, and it is removed.");
-      return false;
-    }
-    else { print_message("No Self intersection found, patch is valid."); }
-  }
-  // save facets for accept-reject 
-  new_facets.insert(new_facets.end(), patch.begin(), patch.end());
-  return true;
-}
-
-// Q_EXPORT_PLUGIN2(Polyhedron_demo_hole_filling_plugin, Polyhedron_demo_hole_filling_plugin)
-
-#include "Hole_filling_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Hole_filling_polyline_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Hole_filling_polyline_plugin.cpp
deleted file mode 100644
index 10844f6..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Hole_filling_polyline_plugin.cpp
+++ /dev/null
@@ -1,170 +0,0 @@
-#include <QtCore/qglobal.h>
-
-#include "Messages_interface.h"
-#include "Scene_polyhedron_item.h"
-#include "Scene_polylines_item.h"
-#include <CGAL/Three/Scene_interface.h>
-
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-#include "Polyhedron_type.h"
-
-#include <CGAL/Polygon_mesh_processing/triangulate_hole.h>
-#include <CGAL/Polygon_mesh_processing/refine.h>
-#include <CGAL/Polygon_mesh_processing/internal/named_function_params.h>
-#include <CGAL/Polyhedron_incremental_builder_3.h>
-#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
-#include <CGAL/Timer.h>
-
-#include <QAction>
-#include <QMainWindow>
-#include <QApplication>
-#include <QInputDialog>
-#include <QMessageBox>
-
-#include <vector>
-#include <algorithm>
-
-#include <boost/function_output_iterator.hpp>
-#include <boost/iterator/transform_iterator.hpp>
-
-namespace PMP = CGAL::Polygon_mesh_processing;
-
-template<class HDS>
-class Polyhedron_builder : public CGAL::Modifier_base<HDS> {
-public:
-  Polyhedron_builder(std::vector<CGAL::Triple<int, int, int> >* triangles, 
-    Scene_polylines_item::Polyline* polyline) 
-    : triangles(triangles), polyline(polyline) 
-  { }
-
-  void operator()(HDS& hds) {
-    CGAL::Polyhedron_incremental_builder_3<HDS> B(hds, true);
-    B.begin_surface(polyline->size() -1, triangles->size());
-
-    for(Scene_polylines_item::Polyline::iterator it = polyline->begin();
-      it != --polyline->end(); ++it) {
-      B.add_vertex(*it);
-    }
-
-    for(std::vector<CGAL::Triple<int, int, int> >::iterator it = triangles->begin();
-      it != triangles->end(); ++it) {
-      B.begin_facet();
-      B.add_vertex_to_facet(it->first);
-      B.add_vertex_to_facet(it->second);
-      B.add_vertex_to_facet(it->third);
-      B.end_facet();
-    }
-
-    B.end_surface();
-  }
-
-private:
-  std::vector<CGAL::Triple<int, int, int> >* triangles;
-  Scene_polylines_item::Polyline* polyline;
-};
-using namespace CGAL::Three;
-class Polyhedron_demo_hole_filling_polyline_plugin :
-  public QObject,
-  public Polyhedron_demo_plugin_interface
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-public:
-  bool applicable(QAction *) const { return qobject_cast<Scene_polylines_item*>(scene->item(scene->mainSelectionIndex())); }
-  void print_message(QString message) { messages->information(message); }
-  QList<QAction*> actions() const { return QList<QAction*>() << actionHoleFillingPolyline; }
-  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface* m){
-    mw = mainWindow;
-    scene = scene_interface;
-    messages = m;
-    actionHoleFillingPolyline = new QAction(tr("Polyline Hole Filling"), mw);
-    connect(actionHoleFillingPolyline, SIGNAL(triggered()),
-      this, SLOT(hole_filling_polyline_action()));
-  }
-private:
-  struct Nop_functor {
-    template<class T>
-    void operator()(const T & /*t*/) const {}
-  };
-  typedef boost::function_output_iterator<Nop_functor> Nop_out;
-
-  struct Get_handle {
-    typedef Polyhedron::Facet_handle result_type;
-    result_type operator()(Polyhedron::Facet& f) const
-    { return f.halfedge()->facet(); }
-  };
-  
-public Q_SLOTS:
-  void hole_filling_polyline_action() {
-    Scene_polylines_item* polylines_item = qobject_cast<Scene_polylines_item*>(scene->item(scene->mainSelectionIndex()));
-    if(!polylines_item) {
-      print_message("Error: there is no selected polyline item!");
-      return;
-    } 
-
-    bool also_refine;
-    const double density_control_factor = 
-      QInputDialog::getDouble(mw, tr("Density Control Factor"),
-      tr("Density Control Factor (Cancel for not Refine): "), 1.41, 0.0, 100.0, 2, &also_refine);
-
-    bool use_DT = 
-      QMessageBox::Yes == QMessageBox::question(
-      NULL, "Use Delaunay Triangulation", "Use Delaunay Triangulation ?", QMessageBox::Yes|QMessageBox::No);
-
-    QApplication::setOverrideCursor(Qt::WaitCursor);
-    std::size_t counter = 0;
-    for(Scene_polylines_item::Polylines_container::iterator it = polylines_item->polylines.begin();
-      it != polylines_item->polylines.end(); ++it, ++counter) 
-    {
-      if(it->front() != it->back()) { //not closed, skip it
-        print_message("Warning: skipping not closed polyline!");
-        continue; 
-      } 
-      if(it->size() < 4) { // no triangle, skip it (needs at least 3 + 1 repeat)
-        print_message("Warning: skipping polyline which has less than 4 points!");
-        continue; 
-      }
-
-      CGAL::Timer timer; timer.start();
-      std::vector<CGAL::Triple<int, int, int> > patch;
-      CGAL::Polygon_mesh_processing::triangulate_hole_polyline(*it,
-        std::back_inserter(patch),
-        PMP::parameters::use_delaunay_triangulation(use_DT));
-      print_message(QString("Triangulated in %1 sec.").arg(timer.time()));
-
-      if(patch.empty()) {
-        print_message("Warning: generating patch is not successful, please try it without 'Delaunay Triangulation'!");
-        continue;
-      }
-      Polyhedron* poly = new Polyhedron;
-      Polyhedron_builder<Polyhedron::HalfedgeDS> patch_builder(&patch, &(*it));
-      poly->delegate(patch_builder);
-
-      if(also_refine) {
-        timer.reset();
-        CGAL::Polygon_mesh_processing::refine(*poly, faces(*poly),
-          Nop_out(), Nop_out(),
-          CGAL::Polygon_mesh_processing::parameters::density_control_factor(density_control_factor));
-        print_message(QString("Refined in %1 sec.").arg(timer.time()));
-      }
-
-      Scene_polyhedron_item* poly_item = new Scene_polyhedron_item(poly);
-      poly_item->setName(tr("%1-filled-%2").arg(polylines_item->name()).arg(counter));
-      poly_item->setRenderingMode(FlatPlusEdges);
-      scene->setSelectedItem(scene->addItem(poly_item));
-    }
-    QApplication::restoreOverrideCursor();
-  }
-
-private:
-  QMainWindow* mw;
-  CGAL::Three::Scene_interface* scene;
-  Messages_interface* messages;
-  QAction* actionHoleFillingPolyline;
-
-}; // end Polyhedron_demo_hole_filling_polyline_plugin
-
-// Q_EXPORT_PLUGIN2(Polyhedron_demo_hole_filling_polyline_plugin, Polyhedron_demo_hole_filling_polyline_plugin)
-
-#include "Hole_filling_polyline_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Hole_filling_widget.ui b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Hole_filling_widget.ui
deleted file mode 100644
index 6bf2368..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Hole_filling_widget.ui
+++ /dev/null
@@ -1,314 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>HoleFilling</class>
- <widget class="QDockWidget" name="HoleFilling">
-  <property name="enabled">
-   <bool>true</bool>
-  </property>
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>815</width>
-    <height>973</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Hole Filling</string>
-  </property>
-  <widget class="QWidget" name="dockWidgetContents">
-   <property name="enabled">
-    <bool>true</bool>
-   </property>
-   <layout class="QVBoxLayout" name="verticalLayout_6">
-    <item>
-     <layout class="QHBoxLayout" name="horizontalLayout">
-      <item>
-       <widget class="QLabel" name="label_2">
-        <property name="text">
-         <string>Action:</string>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QComboBox" name="action_combo_box">
-        <property name="currentIndex">
-         <number>2</number>
-        </property>
-        <item>
-         <property name="text">
-          <string>Triangulate</string>
-         </property>
-        </item>
-        <item>
-         <property name="text">
-          <string>Triangulate + Refine</string>
-         </property>
-        </item>
-        <item>
-         <property name="text">
-          <string>Triangulate + Refine + Fair</string>
-         </property>
-        </item>
-       </widget>
-      </item>
-     </layout>
-    </item>
-    <item>
-     <widget class="QGroupBox" name="groupBox">
-      <property name="title">
-       <string>Hole Filling Parameters</string>
-      </property>
-      <layout class="QVBoxLayout" name="verticalLayout_4">
-       <item>
-        <widget class="QCheckBox" name="Use_delaunay_triangulation_check_box">
-         <property name="text">
-          <string>Use 3D Delaunay Triangulation Search Space</string>
-         </property>
-         <property name="checked">
-          <bool>true</bool>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <widget class="QCheckBox" name="Skip_self_intersection_check_box">
-         <property name="text">
-          <string>Skip Hole Fillings Making the Surface Self Intersecting</string>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <layout class="QHBoxLayout" name="horizontalLayout_8">
-         <item>
-          <widget class="QLabel" name="label_4">
-           <property name="text">
-            <string>Small Hole #Vertices Threshold</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QDoubleSpinBox" name="vertices_threshold_spin_box">
-           <property name="decimals">
-            <number>0</number>
-           </property>
-           <property name="maximum">
-            <double>999999999.000000000000000</double>
-           </property>
-           <property name="singleStep">
-            <double>1.000000000000000</double>
-           </property>
-           <property name="value">
-            <double>10.000000000000000</double>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </item>
-      </layout>
-     </widget>
-    </item>
-    <item>
-     <widget class="QGroupBox" name="groupBox_2">
-      <property name="title">
-       <string>Refinement Parameters</string>
-      </property>
-      <layout class="QVBoxLayout" name="verticalLayout_3">
-       <item>
-        <layout class="QHBoxLayout" name="horizontalLayout_5">
-         <item>
-          <widget class="QLabel" name="label">
-           <property name="text">
-            <string>Density Factor</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QDoubleSpinBox" name="Density_control_factor_spin_box">
-           <property name="maximum">
-            <double>96.989999999999995</double>
-           </property>
-           <property name="singleStep">
-            <double>0.200000000000000</double>
-           </property>
-           <property name="value">
-            <double>1.410000000000000</double>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </item>
-      </layout>
-     </widget>
-    </item>
-    <item>
-     <widget class="QGroupBox" name="groupBox_3">
-      <property name="title">
-       <string>Fairing Parameters</string>
-      </property>
-      <layout class="QVBoxLayout" name="verticalLayout">
-       <item>
-        <layout class="QHBoxLayout" name="horizontalLayout_6">
-         <item>
-          <widget class="QLabel" name="label_5">
-           <property name="text">
-            <string>Continuity</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QSpinBox" name="Continuity_spin_box">
-           <property name="minimum">
-            <number>0</number>
-           </property>
-           <property name="maximum">
-            <number>2</number>
-           </property>
-           <property name="value">
-            <number>1</number>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </item>
-       <item>
-        <layout class="QHBoxLayout" name="horizontalLayout_7">
-         <item>
-          <widget class="QLabel" name="label_3">
-           <property name="text">
-            <string>Weight Type</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QComboBox" name="weight_combo_box">
-           <property name="currentIndex">
-            <number>1</number>
-           </property>
-           <item>
-            <property name="text">
-             <string>Uniform Weight</string>
-            </property>
-           </item>
-           <item>
-            <property name="text">
-             <string>Cotangent Weight</string>
-            </property>
-           </item>
-          </widget>
-         </item>
-        </layout>
-       </item>
-      </layout>
-     </widget>
-    </item>
-    <item>
-     <widget class="QGroupBox" name="groupBox_4">
-      <property name="title">
-       <string>Hole Display and Selection</string>
-      </property>
-      <layout class="QVBoxLayout" name="verticalLayout_2">
-       <item>
-        <widget class="QPushButton" name="Visualize_holes_button">
-         <property name="enabled">
-          <bool>true</bool>
-         </property>
-         <property name="font">
-          <font>
-           <weight>75</weight>
-           <bold>true</bold>
-          </font>
-         </property>
-         <property name="text">
-          <string>Detect and Display Holes</string>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <layout class="QHBoxLayout" name="horizontalLayout_3">
-         <item>
-          <widget class="QPushButton" name="Select_all_holes_button">
-           <property name="text">
-            <string>Select All Holes</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QPushButton" name="Select_small_holes_button">
-           <property name="text">
-            <string>Select Small Holes</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QPushButton" name="Deselect_all_holes_button">
-           <property name="text">
-            <string>Deselect All Holes</string>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </item>
-       <item>
-        <widget class="QLabel" name="label_6">
-         <property name="text">
-          <string>Note: Use CTRL+Left mouse click to manually select/deselect a hole</string>
-         </property>
-        </widget>
-       </item>
-      </layout>
-     </widget>
-    </item>
-    <item>
-     <widget class="QGroupBox" name="groupBox_5">
-      <property name="title">
-       <string>Actions</string>
-      </property>
-      <layout class="QVBoxLayout" name="verticalLayout_5">
-       <item>
-        <layout class="QHBoxLayout" name="horizontalLayout_2">
-         <item>
-          <widget class="QPushButton" name="Fill_selected_holes_button">
-           <property name="enabled">
-            <bool>true</bool>
-           </property>
-           <property name="text">
-            <string>Fill Selected Holes</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QPushButton" name="Create_polyline_items_button">
-           <property name="text">
-            <string>Create Polyline Items for Selected Holes</string>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </item>
-      </layout>
-     </widget>
-    </item>
-    <item>
-     <layout class="QHBoxLayout" name="horizontalLayout_4">
-      <item>
-       <widget class="QPushButton" name="Reject_button">
-        <property name="text">
-         <string>Reject</string>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QPushButton" name="Accept_button">
-        <property name="text">
-         <string>Accept</string>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </item>
-   </layout>
-  </widget>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Inside_out_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Inside_out_plugin.cpp
deleted file mode 100644
index f351191..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Inside_out_plugin.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-#include <QApplication>
-#include <QAction>
-#include <QStringList>
-
-#include "Scene_polyhedron_item.h"
-#include "Scene_polygon_soup_item.h"
-#include "Polyhedron_type.h"
-
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-#include <CGAL/Polygon_mesh_processing/orientation.h>
-using namespace CGAL::Three;
-class Polyhedron_demo_inside_out_plugin : 
-  public QObject,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-public:
-  // used by Polyhedron_demo_plugin_helper
-  QStringList actionsNames() const {
-    return QStringList() << "actionInsideOut";
-  }
-
-  void init(QMainWindow* mainWindow,
-            Scene_interface* scene_interface)
-  {
-      mw = mainWindow;
-      scene = scene_interface;
-      actions_map["actionInsideOut"] = getActionFromMainWindow(mw, "actionInsideOut");
-      actions_map["actionInsideOut"]->setProperty("subMenuName", "Polygon Mesh Processing");
-      autoConnectActions();
-
-  }
-  bool applicable(QAction*) const { 
-    const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-    return qobject_cast<Scene_polyhedron_item*>(scene->item(index)) 
-      || qobject_cast<Scene_polygon_soup_item*>(scene->item(index));
-  }
-
-public Q_SLOTS:
-  void on_actionInsideOut_triggered();
-
-}; // end Polyhedron_demo_inside_out_plugin
-
-void Polyhedron_demo_inside_out_plugin::on_actionInsideOut_triggered()
-{
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-  
-  Scene_polyhedron_item* poly_item = 
-    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-
-  Scene_polygon_soup_item* soup_item = 
-    qobject_cast<Scene_polygon_soup_item*>(scene->item(index));
-
-  if(poly_item || soup_item)
-  {
-    QApplication::setOverrideCursor(Qt::WaitCursor);
-
-    if(poly_item) {
-      Polyhedron* pMesh = poly_item->polyhedron();
-      if(!pMesh) return;
-  
-      // inside out
-      CGAL::Polygon_mesh_processing::reverse_face_orientations(*pMesh);
-      poly_item->invalidateOpenGLBuffers();
-    }
-    else {
-      soup_item->inside_out();
-      soup_item->invalidateOpenGLBuffers();
-    }
-
-    // update scene
-    scene->itemChanged(index);
-
-    // default cursor
-    QApplication::restoreOverrideCursor();
-  }
-}
-
-#include "Inside_out_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_dialog.ui b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_dialog.ui
deleted file mode 100644
index 3ddde77..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_dialog.ui
+++ /dev/null
@@ -1,250 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>Isotropic_remeshing_dialog</class>
- <widget class="QDialog" name="Isotropic_remeshing_dialog">
-  <property name="enabled">
-   <bool>true</bool>
-  </property>
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>414</width>
-    <height>318</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Isotropic remeshing criteria</string>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout">
-   <item>
-    <widget class="QLabel" name="objectName">
-     <property name="font">
-      <font>
-       <pointsize>15</pointsize>
-       <weight>75</weight>
-       <bold>true</bold>
-      </font>
-     </property>
-     <property name="text">
-      <string>NO OBJECT</string>
-     </property>
-    </widget>
-   </item>
-   <item>
-    <widget class="QLabel" name="objectNameSize">
-     <property name="text">
-      <string>No size</string>
-     </property>
-    </widget>
-   </item>
-   <item>
-    <widget class="QGroupBox" name="groupBox_2">
-     <property name="title">
-      <string>Remesh</string>
-     </property>
-     <layout class="QHBoxLayout" name="horizontalLayout">
-      <item>
-       <widget class="QCheckBox" name="splitEdgesOnly_checkbox">
-        <property name="text">
-         <string>Split only border/selected edges</string>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item>
-    <spacer name="verticalSpacer">
-     <property name="orientation">
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>20</width>
-       <height>40</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
-   <item>
-    <widget class="QGroupBox" name="groupBox">
-     <property name="title">
-      <string>Isotropic remeshing</string>
-     </property>
-     <layout class="QGridLayout" name="gridLayout_2" rowstretch="0,0,0,0" columnstretch="2,0">
-      <item row="1" column="1">
-       <widget class="QSpinBox" name="nbIterations_spinbox">
-        <property name="minimumSize">
-         <size>
-          <width>110</width>
-          <height>0</height>
-         </size>
-        </property>
-       </widget>
-      </item>
-      <item row="1" column="0">
-       <widget class="QLabel" name="nbIterations_label">
-        <property name="text">
-         <string>Number of iterations</string>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-        </property>
-        <property name="buddy">
-         <cstring>nbIterations_spinbox</cstring>
-        </property>
-       </widget>
-      </item>
-      <item row="0" column="0">
-       <widget class="QLabel" name="edgeLength_label">
-        <property name="text">
-         <string>Target edge length</string>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-        </property>
-        <property name="buddy">
-         <cstring>edgeLength_dspinbox</cstring>
-        </property>
-       </widget>
-      </item>
-      <item row="0" column="1">
-       <widget class="QDoubleSpinBox" name="edgeLength_dspinbox">
-        <property name="minimumSize">
-         <size>
-          <width>110</width>
-          <height>0</height>
-         </size>
-        </property>
-        <property name="maximum">
-         <double>1000.000000000000000</double>
-        </property>
-        <property name="singleStep">
-         <double>0.100000000000000</double>
-        </property>
-       </widget>
-      </item>
-      <item row="2" column="0">
-       <widget class="QLabel" name="protect_label">
-        <property name="text">
-         <string>Protect borders/selected edges</string>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-        </property>
-       </widget>
-      </item>
-      <item row="2" column="1">
-       <widget class="QCheckBox" name="protect_checkbox">
-        <property name="text">
-         <string/>
-        </property>
-        <property name="checked">
-         <bool>true</bool>
-        </property>
-       </widget>
-      </item>
-      <item row="3" column="1">
-       <widget class="QCheckBox" name="smooth1D_checkbox">
-        <property name="text">
-         <string/>
-        </property>
-       </widget>
-      </item>
-      <item row="3" column="0">
-       <widget class="QLabel" name="smooth1D_label">
-        <property name="text">
-         <string>Allow 1D smoothing along borders</string>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-        </property>
-       </widget>
-      </item>
-      <item row="4" column="1">
-       <widget class="QCheckBox" name="preserveDuplicates_checkbox">
-        <property name="text">
-         <string/>
-        </property>
-       </widget>
-      </item>
-      <item row="4" column="0">
-       <widget class="QLabel" name="preserveDuplicates_label">
-        <property name="text">
-         <string>Preserve duplicated edges</string>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item>
-    <spacer name="verticalSpacer_2">
-     <property name="orientation">
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>20</width>
-       <height>40</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
-   <item>
-    <widget class="QDialogButtonBox" name="buttonBox">
-     <property name="orientation">
-      <enum>Qt::Horizontal</enum>
-     </property>
-     <property name="standardButtons">
-      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
-     </property>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <tabstops>
-  <tabstop>edgeLength_dspinbox</tabstop>
-  <tabstop>nbIterations_spinbox</tabstop>
-  <tabstop>buttonBox</tabstop>
- </tabstops>
- <resources/>
- <connections>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>accepted()</signal>
-   <receiver>Isotropic_remeshing_dialog</receiver>
-   <slot>accept()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>388</x>
-     <y>288</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>157</x>
-     <y>195</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>rejected()</signal>
-   <receiver>Isotropic_remeshing_dialog</receiver>
-   <slot>reject()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>388</x>
-     <y>288</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>286</x>
-     <y>195</y>
-    </hint>
-   </hints>
-  </connection>
- </connections>
-</ui>
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp
deleted file mode 100644
index ba7c461..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp
+++ /dev/null
@@ -1,733 +0,0 @@
-//#define CGAL_PMP_REMESHING_VERBOSE
-//#define CGAL_PMP_REMESHING_DEBUG
-//#define CGAL_PMP_REMESHING_VERY_VERBOSE
-
-#include <QtCore/qglobal.h>
-
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-
-#include "Scene_polyhedron_item.h"
-#include "Scene_polyhedron_selection_item.h"
-#include "Polyhedron_type.h"
-
-#include <CGAL/iterator.h>
-#include <CGAL/Polygon_mesh_processing/remesh.h>
-#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
-#include <CGAL/boost/graph/properties_Polyhedron_3.h>
-#include <CGAL/Polygon_mesh_processing/triangulate_faces.h>
-#include <CGAL/utility.h>
-
-#include <boost/graph/graph_traits.hpp>
-#include <boost/unordered_set.hpp>
-#include <CGAL/property_map.h>
-
-#include <QTime>
-#include <QAction>
-#include <QMainWindow>
-#include <QApplication>
-#include <QString>
-#include <QDialog>
-#include <QtPlugin>
-
-#include <vector>
-#include <algorithm>
-#include <queue>
-#include <sstream>
-
-#ifdef CGAL_LINKED_WITH_TBB
-#include "tbb/parallel_for.h"
-#include "tbb/blocked_range.h"
-#include "tbb/partitioner.h"
-#endif
-
-#include "ui_Isotropic_remeshing_dialog.h"
-
-// give a halfedge and a target edge length, put in `out` points
-// which the edge equally spaced such that splitting the edge
-// using the sequence of points make the edges shorter than
-// `target_length`
-template <class TriangleMesh, class PointPMap, class PointOutputIterator>
-PointOutputIterator
-sample_edge(
-  typename boost::graph_traits<TriangleMesh>::halfedge_descriptor hd,
-  TriangleMesh& triangle_mesh,
-  double target_length,
-  const PointPMap& pmap,
-  PointOutputIterator out)
-{
-  typedef typename boost::property_traits<PointPMap>::value_type Point_3;
-  typedef typename CGAL::Kernel_traits<Point_3>::Kernel::Vector_3 Vector_3;
-  typename boost::property_traits<PointPMap>::reference src=get(pmap, source(hd,triangle_mesh) );
-  typename boost::property_traits<PointPMap>::reference tgt=get(pmap, target(hd,triangle_mesh) );
-
-  double length = std::sqrt( CGAL::squared_distance(src, tgt) );
-  if ( length <= target_length ) return out;
-
-  double nb_points = std::floor( length / target_length );
-  Vector_3 unit = (tgt-src) / (nb_points+1);
-
-  for(double i=0; i<nb_points; ++i)
-    *out++=src+unit*(i+1);
-
-  return out;
-}
-
-// given a set of points that are expected to be on an edge, split
-// that edge and retriangulate the face incident to the edge
-// Points are sorted so that they are sorted from the source to the target
-// of the edge (the sequence does not contains edge endpoints)
-template <class TriangleMesh, class PointPMap, class PointRange, class EdgeOutputIterator>
-EdgeOutputIterator
-split_identical_edges(
-  typename boost::graph_traits<TriangleMesh>::halfedge_descriptor hd,
-  TriangleMesh& tm,
-  const PointPMap& pmap,
-  const PointRange& points,
-  EdgeOutputIterator out)
-{
-  typedef typename PointRange::value_type Point_3;
-  typedef boost::graph_traits<TriangleMesh> GT;
-  typedef typename GT::halfedge_descriptor halfedge_descriptor;
-
-  BOOST_FOREACH(const Point_3& p, points)
-  {
-    // split the edge
-    halfedge_descriptor new_hd=CGAL::Euler::split_edge(hd,tm);
-    // set the vertex point
-    put(pmap, target(new_hd, tm), p);
-    *out++=edge(new_hd, tm);
-  }
-  *out++=edge(hd, tm);
-  return out;
-}
-
-// HedgeRange is expected to be a range with value type being
-// std::pair<halfedge_descriptor, TriangleMesh*>
-// Given a set of halfedges representing different edges
-// but with identical endpoints, and a target edge length
-// we split all edges identically so that subedges are
-// or length <= length
-template <class HedgeRange, class Edges_to_protect>
-void split_long_duplicated_edge(const HedgeRange& hedge_range,
-                                double target_length,
-                                Edges_to_protect& edges_to_protect)
-{
-  typedef typename HedgeRange::value_type Pair;
-  typedef typename Pair::first_type halfedge_descriptor;
-  typedef typename boost::remove_pointer<
-    typename Pair::second_type>::type TriangleMesh;
-  typedef typename boost::property_map<TriangleMesh,
-    CGAL::vertex_point_t>::type PointPMap;
-  typedef typename boost::property_traits<PointPMap>::value_type Point_3;
-
-  if (hedge_range.empty()) return;
-
-  const Pair& p = *hedge_range.begin();
-  PointPMap pmap = get(boost::vertex_point, *p.second);
-
-  std::vector<Point_3> points;
-  halfedge_descriptor hd = p.first;
-
-  // collect points to be add inside the edges
-  sample_edge(hd, *p.second, target_length, pmap, std::back_inserter(points) );
-
-  CGAL_assertion_code(Point_3 src = get(pmap, source(hd, *p.second));)
-  CGAL_assertion_code(Point_3 tgt = get(pmap, target(hd, *p.second));)
-
-  // split the edges and collect faces to triangulate
-  BOOST_FOREACH(const Pair& h_and_p, hedge_range)
-  {
-    halfedge_descriptor hc=h_and_p.first;
-    TriangleMesh* polyc = h_and_p.second;
-
-    PointPMap pmap_2 = get(boost::vertex_point, *polyc);
-    //make sure halfedge are consistently oriented
-    CGAL_assertion( get(pmap_2, source(hc, *polyc)) == src );
-    CGAL_assertion( get(pmap_2, target(hc, *polyc)) == tgt );
-
-    typedef typename Edges_to_protect::value_type::second_type Edge_set;
-    Edge_set& edge_set = edges_to_protect[polyc];
-
-    // now split the halfedge and incident faces
-    split_identical_edges(hc,*polyc,pmap_2, points,
-                          std::inserter( edge_set, edge_set.begin()));
-  }
-}
-
-using namespace CGAL::Three;
-class Polyhedron_demo_isotropic_remeshing_plugin :
-  public QObject,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-  typedef boost::graph_traits<Polyhedron>::edge_descriptor edge_descriptor;
-  typedef boost::graph_traits<Polyhedron>::halfedge_descriptor halfedge_descriptor;
-  typedef boost::graph_traits<Polyhedron>::face_descriptor face_descriptor;
-
-  typedef boost::unordered_set<edge_descriptor, CGAL::Handle_hash_function>    Edge_set;
-  typedef Scene_polyhedron_selection_item::Is_constrained_map<Edge_set> Edge_constrained_pmap;
-
-public:
-  void init(QMainWindow* mainWindow, Scene_interface* scene_interface)
-  {
-    this->scene = scene_interface;
-    this->mw = mainWindow;
-
-    actionIsotropicRemeshing_ = new QAction("Isotropic Remeshing", mw);
-    actionIsotropicRemeshing_->setProperty("subMenuName", "Polygon Mesh Processing");
-    if (actionIsotropicRemeshing_) {
-      connect(actionIsotropicRemeshing_, SIGNAL(triggered()),
-        this, SLOT(isotropic_remeshing()));
-    }
-  }
-
-  QList<QAction*> actions() const {
-    return QList<QAction*>() << actionIsotropicRemeshing_;
-  }
-
-  bool applicable(QAction*) const
-  {
-    if (scene->selectionIndices().size() == 1)
-    {
-    return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()))
-    || qobject_cast<Scene_polyhedron_selection_item*>(scene->item(scene->mainSelectionIndex()));
-    }
-
-    Q_FOREACH(int index, scene->selectionIndices())
-    {
-      //if one polyhedron is found in the selection, it's fine
-      if (qobject_cast<Scene_polyhedron_item*>(scene->item(index)))
-        return true;
-    }
-    return false;
-  }
-
-  void detect_and_split_duplicates(std::vector<Scene_polyhedron_item*>& selection,
-                                   std::map<Polyhedron*,Edge_set>& edges_to_protect,
-                                   double target_length)
-  {
-    typedef Polyhedron::Point_3 Point_3;
-    typedef std::pair<Point_3,Point_3> Segment_3;
-
-    typedef std::map< Segment_3,
-                      std::vector< std::pair<halfedge_descriptor, Polyhedron*> > > MapType;
-    MapType duplicated_edges;
-
-
-    BOOST_FOREACH(Scene_polyhedron_item* poly_item, selection){
-      Polyhedron& pmesh = *poly_item->polyhedron();
-      BOOST_FOREACH(edge_descriptor ed, edges(pmesh)){
-        halfedge_descriptor hd = halfedge(ed,pmesh);
-        Point_3 p = source(hd,pmesh)->point(), q = target(hd,pmesh)->point();
-        Segment_3 s = CGAL::make_sorted_pair(p,q);
-        if (s.first==q) hd=opposite(hd,pmesh); // make sure the halfedges are consistently oriented
-
-        duplicated_edges[s].push_back( std::make_pair(hd,&pmesh) );
-      }
-    }
-
-    // consistently split duplicate edges and triangulate incident faces
-    typedef std::pair<face_descriptor, Polyhedron*> Face_and_poly;
-    std::set< Face_and_poly > faces_to_triangulate;
-    BOOST_FOREACH(const MapType::value_type& p, duplicated_edges)
-      if (p.second.size()>1){
-        //collect faces to retriangulate
-        typedef std::pair<halfedge_descriptor, Polyhedron*> Pair_type;
-        BOOST_FOREACH(const Pair_type& h_and_p, p.second)
-        {
-          halfedge_descriptor hc=h_and_p.first;
-          Polyhedron* polyc = h_and_p.second;
-
-          if ( !is_border(hc, *polyc) )
-            faces_to_triangulate.insert( Face_and_poly(face(hc,*polyc), polyc) );
-          if ( !is_border(opposite(hc, *polyc), *polyc) )
-            faces_to_triangulate.insert(
-              Face_and_poly(face(opposite(hc, *polyc),*polyc), polyc) );
-        }
-        // split the edges
-        split_long_duplicated_edge(p.second, target_length, edges_to_protect);
-      }
-    // now retriangulate
-    namespace PMP=CGAL::Polygon_mesh_processing;
-    BOOST_FOREACH(Face_and_poly f_and_p, faces_to_triangulate)
-      PMP::triangulate_face(f_and_p.first, *f_and_p.second);
-  }
-
-
-public Q_SLOTS:
-  void isotropic_remeshing()
-  {
-    if (scene->selectionIndices().size() > 1)
-    {
-      isotropic_remeshing_of_several_polyhedra();
-      return;
-    }
-    const Scene_interface::Item_id index = scene->mainSelectionIndex();
-
-    Scene_polyhedron_item* poly_item =
-      qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-
-    Scene_polyhedron_selection_item* selection_item =
-      qobject_cast<Scene_polyhedron_selection_item*>(scene->item(index));
-
-    if (poly_item || selection_item)
-    {
-      // Create dialog box
-      QDialog dialog(mw);
-      Ui::Isotropic_remeshing_dialog ui
-        = remeshing_dialog(&dialog, poly_item, selection_item);
-
-      // Get values
-      int i = dialog.exec();
-      if (i == QDialog::Rejected)
-      {
-        std::cout << "Remeshing aborted" << std::endl;
-        return;
-      }
-      bool edges_only = ui.splitEdgesOnly_checkbox->isChecked();
-      bool preserve_duplicates = ui.preserveDuplicates_checkbox->isChecked();
-      double target_length = ui.edgeLength_dspinbox->value();
-      unsigned int nb_iter = ui.nbIterations_spinbox->value();
-      bool protect = ui.protect_checkbox->isChecked();
-      bool smooth_features = ui.smooth1D_checkbox->isChecked();
-
-      // wait cursor
-      QApplication::setOverrideCursor(Qt::WaitCursor);
-
-      QTime time;
-      time.start();
-
-      typedef boost::graph_traits<Polyhedron>::edge_descriptor edge_descriptor;
-      typedef boost::graph_traits<Polyhedron>::halfedge_descriptor halfedge_descriptor;
-      typedef boost::graph_traits<Polyhedron>::face_descriptor face_descriptor;
-
-      const Polyhedron& pmesh = (poly_item != NULL)
-        ? *poly_item->polyhedron()
-        : *selection_item->polyhedron();
-
-      boost::property_map<Polyhedron, CGAL::face_index_t>::type fim
-        = get(CGAL::face_index, pmesh);
-      unsigned int id = 0;
-      BOOST_FOREACH(face_descriptor f, faces(pmesh))
-      {
-        put(fim, f, id++);
-      }
-
-      if (selection_item)
-      {
-        if (edges_only)
-        {
-          std::vector<edge_descriptor> edges;
-          BOOST_FOREACH(edge_descriptor e, selection_item->selected_edges)
-          {
-            if (selection_item->selected_facets.find(face(halfedge(e, pmesh), pmesh))
-                 != selection_item->selected_facets.end()
-             || selection_item->selected_facets.find(face(opposite(halfedge(e, pmesh), pmesh), pmesh))
-                 != selection_item->selected_facets.end())
-              edges.push_back(e);
-          }
-          BOOST_FOREACH(face_descriptor f, selection_item->selected_facets)
-          {
-            BOOST_FOREACH(halfedge_descriptor he, halfedges_around_face(halfedge(f, pmesh), pmesh))
-            {
-              if (selection_item->selected_facets.find(face(opposite(he, pmesh), pmesh))
-                  == selection_item->selected_facets.end())
-              edges.push_back(edge(he, pmesh));
-            }
-          }
-          if (!edges.empty())
-            CGAL::Polygon_mesh_processing::split_long_edges(
-              edges
-              , target_length
-              , *selection_item->polyhedron()
-              , PMP::parameters::geom_traits(Kernel())
-              .edge_is_constrained_map(selection_item->constrained_edges_pmap()));
-          else
-            std::cout << "No selected or boundary edges to be split" << std::endl;
-        }
-        else
-        {
-         CGAL::Polygon_mesh_processing::isotropic_remeshing(
-           selection_item->selected_facets
-         , target_length
-         , *selection_item->polyhedron()
-         , CGAL::Polygon_mesh_processing::parameters::number_of_iterations(nb_iter)
-         .protect_constraints(protect)
-         .edge_is_constrained_map(selection_item->constrained_edges_pmap())
-         .smooth_along_features(smooth_features)
-         .vertex_is_constrained_map(selection_item->constrained_vertices_pmap()));
-        }
-        selection_item->poly_item_changed();
-        selection_item->clear<face_descriptor>();
-        selection_item->changed_with_poly_item();
-      }
-      else if (poly_item)
-      {
-        if (edges_only)
-        {
-          std::vector<halfedge_descriptor> border;
-          CGAL::Polygon_mesh_processing::border_halfedges(
-            faces(*poly_item->polyhedron()),
-            pmesh,
-            std::back_inserter(border));
-          std::vector<edge_descriptor> border_edges;
-          BOOST_FOREACH(halfedge_descriptor h, border)
-            border_edges.push_back(edge(h, pmesh));
-
-          if (!border_edges.empty())
-            CGAL::Polygon_mesh_processing::split_long_edges(
-              border_edges
-              , target_length
-              , *poly_item->polyhedron()
-              , PMP::parameters::geom_traits(Kernel()));
-          else
-            std::cout << "No border to be split" << std::endl;
-        }
-        else
-        {
-          // tricks to use the function detect_and_split_duplicates
-          // that uses several poly items
-          std::map<Polyhedron*, Edge_set > edges_to_protect_map;
-          std::vector<Scene_polyhedron_item*> poly_items(1, poly_item);
-          Edge_set& edges_to_protect = edges_to_protect_map[poly_item->polyhedron()];
-          if (preserve_duplicates)
-          {
-            detect_and_split_duplicates(poly_items, edges_to_protect_map, target_length);
-            boost::property_map<Polyhedron, CGAL::face_index_t>::type fim = get(CGAL::face_index, pmesh);
-            unsigned int id = 0;
-            BOOST_FOREACH(face_descriptor f, faces(pmesh))
-              put(fim, f, id++);
-          }
-          Scene_polyhedron_selection_item::Is_constrained_map<Edge_set> ecm(edges_to_protect);
-
-          CGAL::Polygon_mesh_processing::isotropic_remeshing(
-           faces(*poly_item->polyhedron())
-         , target_length
-         , *poly_item->polyhedron()
-         , CGAL::Polygon_mesh_processing::parameters::number_of_iterations(nb_iter)
-         .protect_constraints(protect)
-         .edge_is_constrained_map(ecm)
-         .smooth_along_features(smooth_features));
-        }
-        poly_item->invalidateOpenGLBuffers();
-        Q_EMIT poly_item->itemChanged();
-      }
-      else{
-        std::cout << "Can't remesh that type of thing" << std::endl;
-      }
-      std::cout << "ok (" << time.elapsed() << " ms)" << std::endl;
-
-      // default cursor
-      QApplication::restoreOverrideCursor();
-    }
-  }
-
-  void isotropic_remeshing_of_several_polyhedra()
-  {
-    // Remeshing parameters
-    bool edges_only = false, preserve_duplicates = false;
-    double target_length = 0.;
-    unsigned int nb_iter = 1;
-    bool protect = false;
-    bool smooth_features = true;
-
-    std::vector<Scene_polyhedron_item*> selection;
-    BOOST_FOREACH(int index, scene->selectionIndices())
-    {
-      Scene_polyhedron_item* poly_item =
-        qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-
-      if (poly_item == NULL)
-      {
-        std::cout << scene->item(index)->name().data()
-          << " is not a Polyhedron, remeshing skipped\n";
-        continue;
-      }
-      else
-      {
-        selection.push_back(poly_item);
-
-        if (target_length == 0.)//parameters have not been set yet
-        {
-        QDialog dialog(mw);
-        Ui::Isotropic_remeshing_dialog ui = remeshing_dialog(&dialog, poly_item);
-        ui.objectName->setText(QString::number(scene->selectionIndices().size())
-          .append(QString(" items to be remeshed")));
-        int i = dialog.exec();
-        if (i == QDialog::Rejected)
-        {
-          std::cout << "Remeshing aborted" << std::endl;
-          return;
-        }
-
-        edges_only = ui.splitEdgesOnly_checkbox->isChecked();
-        preserve_duplicates = ui.preserveDuplicates_checkbox->isChecked();
-        target_length = ui.edgeLength_dspinbox->value();
-        nb_iter = ui.nbIterations_spinbox->value();
-        protect = ui.protect_checkbox->isChecked();
-        smooth_features = ui.smooth1D_checkbox->isChecked();
-        }
-      }
-    }
-
-    if(target_length == 0.)//parameters have not been set
-    {                      // i.e. no item is a polyhedron
-      std::cout << "Remeshing aborted" << std::endl;
-      return;
-    }
-
-    // wait cursor
-    QApplication::setOverrideCursor(Qt::WaitCursor);
-    int total_time = 0;
-
-
-    //     typedef boost::graph_traits<Polyhedron>::edge_descriptor edge_descriptor;
-    std::map<Polyhedron*,Edge_set > edges_to_protect;
-
-    if(preserve_duplicates)
-      detect_and_split_duplicates(selection, edges_to_protect, target_length);
-
-#ifdef CGAL_LINKED_WITH_TBB
-    QTime time;
-    time.start();
-
-      tbb::parallel_for(
-        tbb::blocked_range<std::size_t>(0, selection.size()),
-        Remesh_polyhedron_item_for_parallel_for<Remesh_polyhedron_item>(
-                                                                        selection, edges_to_protect, edges_only, target_length, nb_iter, protect, smooth_features));
-
-    total_time = time.elapsed();
-
-#else
-
-    Remesh_polyhedron_item remesher(edges_only,
-      target_length, nb_iter, protect, smooth_features);
-    BOOST_FOREACH(Scene_polyhedron_item* poly_item, selection)
-    {
-      QTime time;
-      time.start();
-
-      remesher(poly_item, edges_to_protect[poly_item->polyhedron()]);
-
-      total_time += time.elapsed();
-      std::cout << "Remeshing of " << poly_item->name().data()
-                << " done in " << time.elapsed() << " ms" << std::endl;
-    }
-#endif
-    std::cout << "Remeshing of all selected items done in "
-      << total_time << " ms" << std::endl;
-
-    BOOST_FOREACH(Scene_polyhedron_item* poly_item, selection)
-    {
-      poly_item->invalidateOpenGLBuffers();
-      Q_EMIT poly_item->itemChanged();
-    }
-
-    // default cursor
-    QApplication::restoreOverrideCursor();
-  }
-
-private:
-  struct Remesh_polyhedron_item
-  {
-    typedef boost::graph_traits<Polyhedron>::edge_descriptor     edge_descriptor;
-    typedef boost::graph_traits<Polyhedron>::halfedge_descriptor halfedge_descriptor;
-    typedef boost::graph_traits<Polyhedron>::face_descriptor     face_descriptor;
-
-    bool edges_only_;
-    double target_length_;
-    unsigned int nb_iter_;
-    bool protect_;
-    bool smooth_features_;
-
-  protected:
-    void remesh(Scene_polyhedron_item* poly_item,
-                Edge_set& edges_to_protect) const
-    {
-      //fill face_index property map
-      boost::property_map<Polyhedron, CGAL::face_index_t>::type fim
-        = get(CGAL::face_index, *poly_item->polyhedron());
-      unsigned int id = 0;
-      BOOST_FOREACH(face_descriptor f, faces(*poly_item->polyhedron()))
-      { put(fim, f, id++); }
-
-      if (edges_only_)
-      {
-        std::vector<halfedge_descriptor> border;
-        CGAL::Polygon_mesh_processing::border_halfedges(
-          faces(*poly_item->polyhedron())
-          , *poly_item->polyhedron()
-          , std::back_inserter(border));
-        std::vector<edge_descriptor> border_edges;
-        BOOST_FOREACH(halfedge_descriptor h, border)
-          border_edges.push_back(edge(h, *poly_item->polyhedron()));
-
-        CGAL::Polygon_mesh_processing::split_long_edges(
-            border_edges
-          , target_length_
-          , *poly_item->polyhedron());
-      }
-      else
-      {
-        Scene_polyhedron_selection_item::Is_constrained_map<Edge_set > ecm(edges_to_protect);
-        CGAL::Polygon_mesh_processing::isotropic_remeshing(
-            faces(*poly_item->polyhedron())
-          , target_length_
-          , *poly_item->polyhedron()
-          , CGAL::Polygon_mesh_processing::parameters::number_of_iterations(nb_iter_)
-          .protect_constraints(protect_)
-          .edge_is_constrained_map(ecm)
-          .smooth_along_features(smooth_features_));
-      }
-    }
-
-  public:
-    Remesh_polyhedron_item(
-      const bool edges_only,
-      const double target_length,
-      const unsigned int nb_iter,
-      const bool protect,
-      const bool smooth_features)
-      : edges_only_(edges_only)
-      , target_length_(target_length)
-      , nb_iter_(nb_iter)
-      , protect_(protect)
-      , smooth_features_(smooth_features)
-    {}
-
-    Remesh_polyhedron_item(const Remesh_polyhedron_item& remesh)
-      : edges_only_(remesh.edges_only_)
-      , target_length_(remesh.target_length_)
-      , nb_iter_(remesh.nb_iter_)
-      , protect_(remesh.protect_)
-      , smooth_features_(remesh.smooth_features_)
-    {}
-
-    void operator()(Scene_polyhedron_item* poly_item,
-                    Edge_set& edges_to_protect) const
-    {
-      remesh(poly_item, edges_to_protect);
-    }
-  };
-
-#ifdef CGAL_LINKED_WITH_TBB
-  template<typename RemeshFunctor>
-  struct Remesh_polyhedron_item_for_parallel_for
-    : RemeshFunctor
-  {
-    const std::vector<Scene_polyhedron_item*>& selection_;
-    std::map<Polyhedron*,Edge_set >& edges_to_protect_;
-
-  public:
-    // Constructor
-    Remesh_polyhedron_item_for_parallel_for(
-      const std::vector<Scene_polyhedron_item*>& selection,
-      std::map<Polyhedron*,Edge_set >& edges_to_protect,
-      const bool edges_only,
-      const double target_length,
-      const unsigned int nb_iter,
-      const bool protect,
-      const bool smooth_features)
-      : RemeshFunctor(edges_only, target_length, nb_iter, protect, smooth_features)
-      , selection_(selection), edges_to_protect_(edges_to_protect)
-    {}
-
-    // Constructor
-    Remesh_polyhedron_item_for_parallel_for(
-      const Remesh_polyhedron_item_for_parallel_for &remesh)
-      : RemeshFunctor(remesh)
-      , selection_(remesh.selection_)
-      , edges_to_protect_(remesh.edges_to_protect_)
-    {}
-
-    // operator()
-    void operator()(const tbb::blocked_range<size_t>& r) const
-    {
-      for (size_t i = r.begin(); i != r.end(); ++i)
-        RemeshFunctor::remesh(selection_[i], edges_to_protect_[selection_[i]->polyhedron()]);
-    }
-  };
-#endif
-
-  Ui::Isotropic_remeshing_dialog
-  remeshing_dialog(QDialog* dialog,
-                   Scene_polyhedron_item* poly_item,
-                   Scene_polyhedron_selection_item* selection_item = NULL)
-  {
-    Ui::Isotropic_remeshing_dialog ui;
-    ui.setupUi(dialog);
-    connect(ui.buttonBox, SIGNAL(accepted()), dialog, SLOT(accept()));
-    connect(ui.buttonBox, SIGNAL(rejected()), dialog, SLOT(reject()));
-
-    //connect checkbox to spinbox
-    connect(ui.splitEdgesOnly_checkbox, SIGNAL(toggled(bool)),
-            ui.nbIterations_spinbox, SLOT(setDisabled(bool)));
-    connect(ui.splitEdgesOnly_checkbox, SIGNAL(toggled(bool)),
-            ui.protect_checkbox, SLOT(setDisabled(bool)));
-    connect(ui.protect_checkbox, SIGNAL(toggled(bool)),
-            ui.smooth1D_checkbox, SLOT(setDisabled(bool)));
-    connect(ui.splitEdgesOnly_checkbox, SIGNAL(toggled(bool)),
-            ui.smooth1D_checkbox, SLOT(setDisabled(bool)));
-    connect(ui.preserveDuplicates_checkbox, SIGNAL(toggled(bool)),
-            ui.protect_checkbox, SLOT(setChecked(bool)));
-    connect(ui.preserveDuplicates_checkbox, SIGNAL(toggled(bool)),
-            ui.protect_checkbox, SLOT(setDisabled(bool)));
-
-    //Set default parameters
-    Scene_interface::Bbox bbox = poly_item != NULL ? poly_item->bbox()
-      : (selection_item != NULL ? selection_item->bbox()
-        : scene->bbox());
-    ui.objectName->setText(poly_item != NULL ? poly_item->name()
-      : (selection_item != NULL ? selection_item->name()
-        : QString("Remeshing parameters")));
-
-    ui.objectNameSize->setText(
-      tr("Object bbox size (w,h,d):  <b>%1</b>,  <b>%2</b>,  <b>%3</b>")
-      .arg(bbox.width(), 0, 'g', 3)
-      .arg(bbox.height(), 0, 'g', 3)
-      .arg(bbox.depth(), 0, 'g', 3));
-
-    double diago_length = bbox.diagonal_length();
-    ui.edgeLength_dspinbox->setDecimals(3);
-    ui.edgeLength_dspinbox->setSingleStep(0.001);
-    ui.edgeLength_dspinbox->setRange(1e-6 * diago_length, //min
-      2.   * diago_length);//max
-    ui.edgeLength_dspinbox->setValue(0.05 * diago_length);
-
-    std::ostringstream oss;
-    oss << "Diagonal length of the Bbox of the selection to remesh is ";
-    oss << diago_length << "." << std::endl;
-    oss << "Default is 5% of it" << std::endl;
-    ui.edgeLength_dspinbox->setToolTip(QString::fromStdString(oss.str()));
-
-    ui.nbIterations_spinbox->setSingleStep(1);
-    ui.nbIterations_spinbox->setRange(1/*min*/, 1000/*max*/);
-    ui.nbIterations_spinbox->setValue(1);
-
-    ui.protect_checkbox->setChecked(false);
-    ui.smooth1D_checkbox->setChecked(true);
-
-    if (NULL != selection_item)
-    {
-      //do not preserve duplicates in selection mode
-      ui.preserveDuplicates_checkbox->setDisabled(true);
-      ui.preserveDuplicates_checkbox->setChecked(false);
-    }
-
-    return ui;
-  }
-
-
-private:
-  QAction* actionIsotropicRemeshing_;
-
-}; // end Polyhedron_demo_isotropic_remeshing_plugin
-
-//Q_EXPORT_PLUGIN2(Polyhedron_demo_isotropic_remeshing_plugin,
-//                 Polyhedron_demo_isotropic_remeshing_plugin)
-
-#include "Isotropic_remeshing_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Jet_fitting_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Jet_fitting_plugin.cpp
deleted file mode 100644
index 2471c53..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Jet_fitting_plugin.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-#include "Polyhedron_type.h"
-#include "Scene_polyhedron_item.h"
-#include "Scene_polylines_item.h"
-
-#include <limits>
-
-#include "Scene.h"
-#include <QApplication>
-
-#include <CGAL/Monge_via_jet_fitting.h>
-#include <CGAL/Polygon_mesh_processing/compute_normal.h>
-using namespace CGAL::Three;
-class Polyhedron_demo_jet_fitting_plugin :
-  public QObject,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-public:
-  // used by Polyhedron_demo_plugin_helper
-  QStringList actionsNames() const {
-    return QStringList() << "actionEstimateCurvature";
-  }
-  void init(QMainWindow* mainWindow,
-            Scene_interface* scene_interface)
-  {
-      mw = mainWindow;
-      scene = scene_interface;
-      actions_map["actionEstimateCurvature"] = getActionFromMainWindow(mw, "actionEstimateCurvature");
-      actions_map["actionEstimateCurvature"]->setProperty("subMenuName",
-                                                          "Estimation of Local Differential Properties");
-      autoConnectActions();
-
-  }
-
-  bool applicable(QAction*) const { 
-    return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
-  }
-
-public Q_SLOTS:
-  void on_actionEstimateCurvature_triggered();
-}; // end Polyhedron_demo_jet_fitting_plugin
-
-void Polyhedron_demo_jet_fitting_plugin::on_actionEstimateCurvature_triggered()
-{
-  // get active polyhedron
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-  Scene_polyhedron_item* poly_item = 
-    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-  if(!poly_item)
-    return;
-
-  // wait cursor
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-
-  Polyhedron* pMesh = poly_item->polyhedron();
-
-  // types
-  typedef CGAL::Monge_via_jet_fitting<Kernel> Fitting;
-  typedef Fitting::Monge_form Monge_form;
-
-  typedef Kernel::Point_3 Point;
-
-  Scene_polylines_item* max_curv = new Scene_polylines_item;
-  max_curv->setColor(Qt::red);
-  max_curv->setName(tr("%1 (max curvatures)").arg(poly_item->name()));
-  Scene_polylines_item* min_curv = new Scene_polylines_item;
-  min_curv->setColor(Qt::green);
-  min_curv->setName(tr("%1 (min curvatures)").arg(poly_item->name()));
-
-  Polyhedron::Vertex_iterator v;
-  for(v = pMesh->vertices_begin();
-      v != pMesh->vertices_end();
-      v++)
-  {
-    std::vector<Point> points;
-
-    // pick central point
-    const Point& central_point = v->point();
-    points.push_back(central_point);
-
-    // compute min edge len around central vertex
-    // to scale the ribbons used to display the directions
-
-    typedef Kernel::FT FT;
-
-    FT min_edge_len = std::numeric_limits<FT>::infinity();
-    Polyhedron::Halfedge_around_vertex_circulator he = v->vertex_begin();
-    Polyhedron::Halfedge_around_vertex_circulator end = he;
-    CGAL_For_all(he,end)
-    {
-      const Point& p = he->opposite()->vertex()->point();
-      points.push_back(p);
-      FT edge_len = std::sqrt(CGAL::squared_distance(central_point,p));
-      min_edge_len = edge_len < min_edge_len ? edge_len : min_edge_len; // avoids #undef min
-    }
-
-    if(points.size() > 5)
-    {
-      // estimate curvature by fitting
-      Fitting monge_fit;
-      const int dim_monge = 2;
-      const int dim_fitting = 2;
-      Monge_form monge_form = monge_fit(points.begin(),points.end(),dim_fitting,dim_monge);
-
-      // make monge form comply with vertex normal (to get correct
-      // orientation)
-      typedef Kernel::Vector_3 Vector;
-      Vector n = CGAL::Polygon_mesh_processing::compute_vertex_normal(v, *pMesh);
-      monge_form.comply_wrt_given_normal(n);
-
-      Vector umin = min_edge_len * monge_form.minimal_principal_direction();
-      Vector umax = min_edge_len * monge_form.maximal_principal_direction();
-
-      Scene_polylines_item::Polyline max_segment(2), min_segment(2);
-
-      const double du = 0.2;
-
-      max_segment[0] = central_point + du * umax;
-      max_segment[1] = central_point - du * umax;
-      min_segment[0] = central_point + du * umin;
-      min_segment[1] = central_point - du * umin;
-
-      max_curv->polylines.push_back(max_segment);
-      min_curv->polylines.push_back(min_segment);
-    }
-  }
-
-  scene->addItem(max_curv);
-  scene->addItem(min_curv);
-  max_curv->invalidateOpenGLBuffers();
-  min_curv->invalidateOpenGLBuffers();
-  
-  // default cursor
-  QApplication::restoreOverrideCursor();
-}
-
-#include "Jet_fitting_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Join_and_split_polyhedra_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Join_and_split_polyhedra_plugin.cpp
deleted file mode 100644
index 726a837..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Join_and_split_polyhedra_plugin.cpp
+++ /dev/null
@@ -1,176 +0,0 @@
-#include <QApplication>
-#include <QMessageBox>
-#include <QMainWindow>
-#include "Kernel_type.h"
-#include "Polyhedron_type.h"
-#include "Scene_polyhedron_item.h"
-#include "Scene_polylines_item.h"
-#include "Messages_interface.h"
-
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <CGAL/Three/Polyhedron_demo_io_plugin_interface.h>
-
-#include <CGAL/Polyhedron_copy_3.h>
-#include <CGAL/Polygon_mesh_processing/connected_components.h>
-
-#include <boost/foreach.hpp>
-#include <boost/function_output_iterator.hpp>
-using namespace CGAL::Three;
-class Polyhedron_demo_join_and_split_polyhedra_plugin:
-  public QObject,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  QAction* actionJoinPolyhedra, *actionSplitPolyhedra, *actionColorConnectedComponents;
-  Messages_interface* msg_interface;
-public:
-  QList<QAction*> actions() const { return QList<QAction*>() << actionJoinPolyhedra << actionSplitPolyhedra << actionColorConnectedComponents; }
-  using Polyhedron_demo_plugin_helper::init;
-  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface* m)
-  {
-    msg_interface = m;
-    actionJoinPolyhedra= new QAction(tr("Join Selected Polyhedra"), mainWindow);
-    actionJoinPolyhedra->setProperty("subMenuName", "Operations on Polyhedra");
-    actionJoinPolyhedra->setObjectName("actionJoinPolyhedra");
-
-    actionSplitPolyhedra= new QAction(tr("Split Selected Polyhedra"), mainWindow);
-    actionSplitPolyhedra->setProperty("subMenuName", "Operations on Polyhedra");
-    actionSplitPolyhedra->setObjectName("actionSplitPolyhedra");
-
-    actionColorConnectedComponents = new QAction(tr("Color Each Connected Component of Selected Polyhedra"), mainWindow);
-    actionColorConnectedComponents ->setProperty("subMenuName", "Polygon Mesh Processing");
-    actionColorConnectedComponents->setObjectName("actionColorConnectedComponents");
-    Polyhedron_demo_plugin_helper::init(mainWindow, scene_interface);
-  }
-
-  bool applicable(QAction*) const {
-    Q_FOREACH(int index, scene->selectionIndices())
-    {
-      if ( qobject_cast<Scene_polyhedron_item*>(scene->item(index)) )
-        return true;
-    }
-    return false;
-  }
-
-public Q_SLOTS:
-  void on_actionJoinPolyhedra_triggered();
-  void on_actionSplitPolyhedra_triggered();
-  void on_actionColorConnectedComponents_triggered();
-
-}; // end Polyhedron_demo_polyhedron_stitching_plugin
-
-void Polyhedron_demo_join_and_split_polyhedra_plugin::on_actionJoinPolyhedra_triggered()
-{
-  CGAL::Three::Scene_interface::Item_id mainSelectionIndex
-    = scene->mainSelectionIndex();
-  Scene_polyhedron_item* mainSelectionItem
-    = qobject_cast<Scene_polyhedron_item*>(scene->item(mainSelectionIndex));
-
-  QList<int> indices_to_remove;
-  Q_FOREACH(int index, scene->selectionIndices()) {
-    if (index == mainSelectionIndex)
-      continue;
-
-    Scene_polyhedron_item* item =
-      qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-    if(item)
-    {
-      indices_to_remove.push_front(index);
-      CGAL::Polyhedron_copy_3<Polyhedron, Polyhedron::HalfedgeDS, false>
-        modifier( *(item->polyhedron()) );
-      mainSelectionItem->polyhedron()->delegate(modifier);
-    }
-  }
-
-  mainSelectionItem->invalidateOpenGLBuffers();
-  scene->itemChanged(mainSelectionIndex);
-
-  //remove the other items
-  Q_FOREACH(int index, indices_to_remove)
-  {
-    scene->erase(index);
-  }
-}
-
-struct Polyhedron_appender{
-  Polyhedron_appender(std::list<Polyhedron*>& new_polyhedra):
-    m_new_polyhedra(new_polyhedra) {}
-  void operator()(const Polyhedron& p){
-    m_new_polyhedra.push_back( new Polyhedron(p) );
-  }
-  std::list<Polyhedron*>& m_new_polyhedra;
-};
-
-void Polyhedron_demo_join_and_split_polyhedra_plugin::on_actionSplitPolyhedra_triggered()
-{
-  Q_FOREACH(int index, scene->selectionIndices()) {
-    Scene_polyhedron_item* item =
-      qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-    if(item)
-    {
-      std::list<Polyhedron*> new_polyhedra;
-      CGAL::internal::corefinement::extract_connected_components(
-        *item->polyhedron(),
-        boost::make_function_output_iterator(Polyhedron_appender(new_polyhedra))
-      );
-
-      if (new_polyhedra.size()==1)
-      {
-        delete new_polyhedra.front();
-        msg_interface->information( tr("%1 has only one connected component").arg(item->name()) );
-        continue;
-      }
-
-      int cc=0;
-      BOOST_FOREACH(Polyhedron* polyhedron_ptr, new_polyhedra)
-      {
-        Scene_polyhedron_item* new_item=new Scene_polyhedron_item(polyhedron_ptr);
-        new_item->setName(tr("%1 - CC %2").arg(item->name()).arg(cc));
-        ++cc;
-        scene->addItem(new_item);
-      }
-      item->setVisible(false);
-    }
-  }
-}
-
-struct Polyhedron_cc_marker{
-  int cc_index;
-  Polyhedron_cc_marker() : cc_index(0) {}
-  void start_new_connected_component(){
-    ++cc_index;
-  }
-
-  template <class Facet_iterator>
-  void mark(Facet_iterator begin, Facet_iterator end)
-  {
-    for(;begin!=end; ++begin)
-      (*begin)->set_patch_id(cc_index-1);
-  }
-};
-
-void Polyhedron_demo_join_and_split_polyhedra_plugin::on_actionColorConnectedComponents_triggered()
-{
-  Q_FOREACH(int index, scene->selectionIndices()) {
-    Scene_polyhedron_item* item =
-      qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-    if(item)
-    {
-        item->setItemIsMulticolor(true);
-      std::list<Polyhedron*> new_polyhedra;
-      Polyhedron_cc_marker marker;
-      CGAL::internal::corefinement::mark_connected_components(
-        *item->polyhedron(),
-        CGAL::internal::corefinement::Dummy_true(),
-        marker
-      );
-      item->invalidateOpenGLBuffers();
-      scene->itemChanged(item);
-    }
-  }
-}
-
-
-#include "Join_and_split_polyhedra_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.cpp
deleted file mode 100644
index 57a7667..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.cpp
+++ /dev/null
@@ -1,920 +0,0 @@
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-#include "ui_Mean_curvature_flow_skeleton_plugin.h"
-#include "Scene_polyhedron_item.h"
-#include "Scene_points_with_normal_item.h"
-#include "Scene_polylines_item.h"
-#include "Scene.h"
-
-#include "Polyhedron_type.h"
-
-#include <QApplication>
-#include <QMainWindow>
-#include <QInputDialog>
-#include <QTime>
-#include <QMessageBox>
-
-#include <Eigen/Sparse>
-
-#include <boost/property_map/property_map.hpp>
-#include <boost/graph/graph_traits.hpp>
-#include <boost/graph/adjacency_list.hpp>
-
-#include <CGAL/Simple_cartesian.h>
-#include <CGAL/Eigen_solver_traits.h>
-#include <CGAL/extract_mean_curvature_flow_skeleton.h>
-#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
-#include <CGAL/iterator.h>
-#include <CGAL/Polygon_mesh_processing/connected_components.h>
-#include <CGAL/boost/graph/split_graph_into_polylines.h>
-#include <CGAL/mesh_segmentation.h>
-#include <CGAL/Polyhedron_copy_3.h>
-#include <queue>
-
-
-typedef boost::graph_traits<Polyhedron>::vertex_descriptor          vertex_descriptor;
-typedef boost::graph_traits<Polyhedron>::vertex_iterator            vertex_iterator;
-typedef boost::graph_traits<Polyhedron>::halfedge_descriptor        halfedge_descriptor;
-typedef Polyhedron::Facet_iterator                                  Facet_iterator;
-
-typedef CGAL::Mean_curvature_flow_skeletonization<Polyhedron>      Mean_curvature_skeleton;
-typedef Mean_curvature_skeleton::Skeleton Skeleton;
-
-typedef Polyhedron::Traits         Kernel;
-typedef Kernel::Point_3            Point;
-
-struct Polyline_visitor
-{
-  typedef std::vector<Point> Polyline;
-  typedef std::vector<std::size_t> Polyline_of_ids;
-
-  std::list<Polyline>& polylines;
-  Skeleton& skeleton;
-
-  Polyline_visitor(std::list<Polyline>& lines, Skeleton& skeleton)
-    : polylines(lines),
-      skeleton(skeleton)
-  {}
-
-  void start_new_polyline()
-  {
-    Polyline V;
-    polylines.push_back(V);
-  }
-
-  void add_node(boost::graph_traits<Skeleton>::vertex_descriptor vd)
-  {
-    Polyline& polyline = polylines.back();
-    polyline.push_back(skeleton[vd].point);
-  }
-
-  void end_polyline(){}
-};
-
-template<class ValueType>
-struct Facet_with_id_pmap
-    : public boost::put_get_helper<ValueType&,
-             Facet_with_id_pmap<ValueType> >
-{
-    typedef Polyhedron::Face_handle key_type;
-    typedef ValueType value_type;
-    typedef value_type& reference;
-    typedef boost::lvalue_property_map_tag category;
-
-    Facet_with_id_pmap(
-      std::vector<ValueType>& internal_vector
-    ) : internal_vector(internal_vector) { }
-
-    reference operator[](key_type key) const
-    { return internal_vector[key->id()]; }
-private:
-    std::vector<ValueType>& internal_vector;
-};
-using namespace CGAL::Three;
-class Polyhedron_demo_mean_curvature_flow_skeleton_plugin :
-  public QObject,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-  QAction* actionMCFSkeleton;
-  QAction* actionConvert_to_medial_skeleton;
-
-public:
-  // used by Polyhedron_demo_plugin_helper
-  QStringList actionsNames() const {
-    return QStringList() << "actionMCFSkeleton" << "actionConvert_to_medial_skeleton";
-  }
-
-  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface) {
-    mcs = NULL;
-    dockWidget = NULL;
-    ui = NULL;
-
-    actionMCFSkeleton = new QAction(tr("Mean Curvature Skeleton (Advanced)"), mainWindow);
-    actionMCFSkeleton->setProperty("subMenuName", "Triangulated Surface Mesh Skeletonization");
-    actionMCFSkeleton->setObjectName("actionMCFSkeleton");
-
-    actionConvert_to_medial_skeleton = new QAction(tr("Extract Medial Skeleton"), mainWindow);
-    actionConvert_to_medial_skeleton->setProperty("subMenuName", "Triangulated Surface Mesh Skeletonization");
-    actionConvert_to_medial_skeleton->setObjectName("actionConvert_to_medial_skeleton");
-
-    Polyhedron_demo_plugin_helper::init(mainWindow, scene_interface);
-
-    dockWidget = new QDockWidget(mw);
-    dockWidget->setVisible(false);
-    ui = new Ui::Mean_curvature_flow_skeleton_plugin();
-    ui->setupUi(dockWidget);
-    dockWidget->setFeatures(QDockWidget::DockWidgetMovable
-                          | QDockWidget::DockWidgetFloatable
-                          | QDockWidget::DockWidgetClosable);
-    dockWidget->setWindowTitle("Mean Curvature Flow Skeleton");
-    add_dock_widget(dockWidget);
-
-    connect(ui->pushButton_contract, SIGNAL(clicked()),
-            this, SLOT(on_actionContract()));
-    connect(ui->pushButton_collapse, SIGNAL(clicked()),
-            this, SLOT(on_actionCollapse()));
-    connect(ui->pushButton_split, SIGNAL(clicked()),
-            this, SLOT(on_actionSplit()));
-    connect(ui->pushButton_degeneracy, SIGNAL(clicked()),
-            this, SLOT(on_actionDegeneracy()));
-    connect(ui->pushButton_run, SIGNAL(clicked()),
-            this, SLOT(on_actionRun()));
-    connect(ui->pushButton_skeletonize, SIGNAL(clicked()),
-            this, SLOT(on_actionSkeletonize()));
-    connect(ui->pushButton_converge, SIGNAL(clicked()),
-            this, SLOT(on_actionConverge()));
-    connect(dynamic_cast<Scene*>(scene), SIGNAL(updated_bbox()),
-            this, SLOT(on_actionUpdateBBox()));
-    connect(ui->pushButton_segment, SIGNAL(clicked()),
-            this, SLOT(on_actionSegment()));
-
-    QObject* scene_object = dynamic_cast<QObject*>(scene);
-    connect(scene_object, SIGNAL(itemAboutToBeDestroyed(CGAL::Three::Scene_item*)),
-            this, SLOT(on_actionItemAboutToBeDestroyed(CGAL::Three::Scene_item*)));
-  }
-
-  virtual void closure()
-  {
-    dockWidget->hide();
-  }
-
-  QList<QAction*> actions() const {
-    return QList<QAction*>() << actionMCFSkeleton << actionConvert_to_medial_skeleton;
-  }
-
-  bool applicable(QAction*) const {
-    return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
-  }
-
-  void init_ui(double diag) {
-    ui->omega_H->setValue(0.1);
-    ui->omega_H->setSingleStep(0.1);
-    ui->omega_H->setDecimals(3);
-    ui->omega_P->setValue(0.2);
-    ui->omega_P->setSingleStep(0.1);
-    ui->omega_P->setDecimals(3);
-    ui->min_edge_length->setDecimals(7);
-    ui->min_edge_length->setValue(0.002 * diag);
-    ui->min_edge_length->setSingleStep(0.0000001);
-    ui->delta_area->setDecimals(7);
-    ui->delta_area->setValue(1e-4);
-    ui->delta_area->setSingleStep(1e-5);
-    ui->is_medially_centered->setChecked(false);
-
-    ui->label_omega_H->setToolTip(QString("omega_H controls the velocity of movement and approximation quality"));
-    ui->label_omega_P->setToolTip(QString("omega_P controls the smoothness of the medial approximation"));
-    ui->pushButton_contract->setToolTip(QString("contract mesh based on mean curvature flow"));
-    ui->pushButton_collapse->setToolTip(QString("collapse short edges"));
-    ui->pushButton_split->setToolTip(QString("split obtuse triangles"));
-    ui->pushButton_degeneracy->setToolTip(QString("fix degenerate points"));
-    ui->pushButton_skeletonize->setToolTip(QString("Turn mesh to a skeleton curve"));
-    ui->pushButton_run->setToolTip(QString("run one iteration of contract, collapse, split, detect degeneracy"));
-    ui->pushButton_converge->setToolTip(QString("iteratively contract the mesh until convergence"));
-  }
-
-  bool check_item_index(int index) {
-    if (index < 0)
-    {
-      QMessageBox msgBox;
-      msgBox.setText("Please select an item first");
-      msgBox.exec();
-      return false;
-    }
-    return true;
-  }
-
-  /// \todo move this function into an include
-  bool is_mesh_valid(Polyhedron *pMesh) {
-    if (!pMesh->is_closed())
-    {
-      QMessageBox msgBox;
-      msgBox.setText("The mesh is not closed.");
-      msgBox.exec();
-      return false;
-    }
-    if (!pMesh->is_pure_triangle())
-    {
-      QMessageBox msgBox;
-      msgBox.setText("The mesh is not a pure triangle mesh.");
-      msgBox.exec();
-      return false;
-    }
-
-    // the algorithm is only applicable on a mesh
-    // that has only one connected component
-    std::size_t num_component;
-    CGAL::Counting_output_iterator output_it(&num_component);
-    CGAL::internal::corefinement::extract_connected_components(*pMesh, output_it);
-    ++output_it;
-    if (num_component != 1)
-    {
-      QMessageBox msgBox;
-      QString str = QString("The mesh is not a single closed mesh.\n It has %1 components.").arg(num_component);
-      msgBox.setText(str);
-      msgBox.exec();
-      return false;
-    }
-    return true;
-  }
-
-  /// \todo remove duplicated code
-  // check if the Mean_curvature_skeleton exists
-  // or has the same polyheron item
-  // check if the mesh is a watertight triangle mesh
-  bool check_mesh(Scene_polyhedron_item* item) {
-    double omega_H = ui->omega_H->value();
-    double omega_P = ui->omega_P->value();
-    double min_edge_length = ui->min_edge_length->value();
-    double delta_area = ui->delta_area->value();
-    bool is_medially_centered = ui->is_medially_centered->isChecked();
-
-    Polyhedron *pMesh = item->polyhedron();
-
-    if (mcs == NULL)
-    {
-      if (!is_mesh_valid(pMesh))
-      {
-        return false;
-      }
-
-      mcs = new Mean_curvature_skeleton(*pMesh);
-      meso_skeleton = new Polyhedron(*pMesh);
-      input_triangle_mesh = pMesh;
-      //set algorithm parameters
-      mcs->set_quality_speed_tradeoff(omega_H);
-      mcs->set_medially_centered_speed_tradeoff(omega_P);
-      mcs->set_min_edge_length(min_edge_length);
-      mcs->set_is_medially_centered(is_medially_centered);
-      mcs->set_area_variation_factor(delta_area);
-
-      Scene_polyhedron_item* contracted_item = new Scene_polyhedron_item( meso_skeleton );
-      contracted_item->setName(QString("contracted mesh of %1").arg(item->name()));
-
-      InputMeshItemIndex = scene->mainSelectionIndex();
-
-      contractedItemIndex = scene->addItem(contracted_item);
-
-      item->setVisible(false);
-
-      fixedPointsItemIndex = -1;
-      nonFixedPointsItemIndex = -1;
-      poleLinesItemIndex = -1;
-    }
-    else
-    {
-      if (input_triangle_mesh != pMesh)
-      {
-        if (!is_mesh_valid(pMesh))
-        {
-          return false;
-        }
-
-        delete mcs;
-
-        mcs = new Mean_curvature_skeleton(*pMesh);
-        meso_skeleton = new Polyhedron(*pMesh);
-        input_triangle_mesh = pMesh;
-        //set algorithm parameters
-        mcs->set_quality_speed_tradeoff(omega_H);
-        mcs->set_medially_centered_speed_tradeoff(omega_P);
-        mcs->set_min_edge_length(min_edge_length);
-        mcs->set_is_medially_centered(is_medially_centered);
-        mcs->set_area_variation_factor(delta_area);
-
-        Scene_polyhedron_item* contracted_item = new Scene_polyhedron_item(meso_skeleton);
-        contracted_item->setName(QString("contracted mesh of %1").arg(item->name()));
-
-        InputMeshItemIndex = scene->mainSelectionIndex();
-
-        contractedItemIndex = scene->addItem(contracted_item);
-
-        item->setVisible(false);
-
-        fixedPointsItemIndex = -1;
-        nonFixedPointsItemIndex = -1;
-        poleLinesItemIndex = -1;
-      }
-      else
-      {
-        mcs->set_quality_speed_tradeoff(omega_H);
-        mcs->set_medially_centered_speed_tradeoff(omega_P);
-        mcs->set_min_edge_length(min_edge_length);
-        mcs->set_area_variation_factor(delta_area);
-        mcs->set_is_medially_centered(is_medially_centered);
-      }
-    }
-    return true;
-  }
-
-  void update_meso_skeleton()
-  {
-    CGAL::Polyhedron_copy_3<Mean_curvature_skeleton::Meso_skeleton, Polyhedron::HalfedgeDS> modifier(mcs->meso_skeleton());
-    meso_skeleton->delegate(modifier);
-    scene->item(contractedItemIndex)->invalidateOpenGLBuffers();
-    scene->itemChanged(contractedItemIndex);
-  }
-
-  void update_parameters(Mean_curvature_skeleton* mcs)
-  {
-    double omega_H = ui->omega_H->value();
-    double omega_P = ui->omega_P->value();
-    double min_edge_length = ui->min_edge_length->value();
-    double delta_area = ui->delta_area->value();
-    bool is_medially_centered = ui->is_medially_centered->isChecked();
-
-    mcs->set_quality_speed_tradeoff(omega_H);
-    mcs->set_medially_centered_speed_tradeoff(omega_P);
-    mcs->set_min_edge_length(min_edge_length);
-    mcs->set_area_variation_factor(delta_area);
-    mcs->set_is_medially_centered(is_medially_centered);
-  }
-
-public Q_SLOTS:
-  void on_actionMCFSkeleton_triggered();
-  void on_actionConvert_to_medial_skeleton_triggered();
-  void on_actionContract();
-  void on_actionCollapse();
-  void on_actionSplit();
-  void on_actionDegeneracy();
-  void on_actionRun();
-  void on_actionSkeletonize();
-  void on_actionConverge();
-  void on_actionUpdateBBox();
-  void on_actionSegment();
-  void on_actionItemAboutToBeDestroyed(CGAL::Three::Scene_item*);
-
-private:
-  Mean_curvature_skeleton* mcs;
-  Polyhedron* meso_skeleton; // a copy of the meso_skeleton that is displayed
-  Polyhedron* input_triangle_mesh;
-  QDockWidget* dockWidget;
-  Ui::Mean_curvature_flow_skeleton_plugin* ui;
-
-  int fixedPointsItemIndex;
-  int nonFixedPointsItemIndex;
-  int poleLinesItemIndex;
-  int contractedItemIndex;
-  int InputMeshItemIndex;
-
-  Skeleton skeleton_curve;
-}; // end Polyhedron_demo_mean_curvature_flow_skeleton_plugin
-
-void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionMCFSkeleton_triggered()
-{
-  dockWidget->show();
-  dockWidget->raise();
-
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-
-  Scene_polyhedron_item* item =
-    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-
-  if(item)
-  {
-    Polyhedron* pMesh = item->polyhedron();
-
-    if(!pMesh) return;
-
-    double diag = scene->len_diagonal();
-    init_ui(diag);
-
-    fixedPointsItemIndex = -1;
-    nonFixedPointsItemIndex = -1;
-    poleLinesItemIndex = -1;
-    contractedItemIndex = -1;
-    InputMeshItemIndex = -1;
-  }
-}
-
-void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionUpdateBBox()
-{
-  double diag = scene->len_diagonal();
-  ui->min_edge_length->setValue(0.002 * diag);
-}
-
-void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionSegment()
-{
-  if (num_vertices(skeleton_curve)==0 ) on_actionSkeletonize();
-  if (num_vertices(skeleton_curve)==0 ) return;
-
-  QTime time;
-  time.start();
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-
-    // init the polyhedron simplex indices
-  CGAL::set_halfedgeds_items_id(*input_triangle_mesh);
-
-  //for each input vertex compute its distance to the skeleton
-  std::vector<double> distances(num_vertices(*input_triangle_mesh));
-  BOOST_FOREACH(boost::graph_traits<Skeleton>::vertex_descriptor v, vertices(skeleton_curve) )
-  {
-    const Point& skel_pt = skeleton_curve[v].point;
-    BOOST_FOREACH(vertex_descriptor mesh_v, skeleton_curve[v].vertices)
-    {
-      const Point& mesh_pt = mesh_v->point();
-      distances[mesh_v->id()] = std::sqrt(CGAL::squared_distance(skel_pt, mesh_pt));
-    }
-  }
-
-  // create a property-map for sdf values
-  std::vector<double> sdf_values( num_faces(*input_triangle_mesh) );
-  Facet_with_id_pmap<double> sdf_property_map(sdf_values);
-
-  // compute sdf values with skeleton
-  BOOST_FOREACH(Polyhedron::Face_handle f, faces(*input_triangle_mesh))
-  {
-    double dist = 0;
-    BOOST_FOREACH(Polyhedron::Halfedge_handle hd, halfedges_around_face(halfedge(f, *input_triangle_mesh), *input_triangle_mesh))
-      dist+=distances[target(hd, *input_triangle_mesh)->id()];
-    sdf_property_map[f] = dist / 3.;
-  }
-
-  // post-process the sdf values
-  CGAL::sdf_values_postprocessing(*input_triangle_mesh, sdf_property_map);
-
-  // create a property-map for segment-ids (it is an adaptor for this case)
-  std::vector<std::size_t> segment_ids( num_faces(*input_triangle_mesh) );
-  Facet_with_id_pmap<std::size_t> segment_property_map(segment_ids);
-
-  // segment the mesh using default parameters
-  std::cout << "Number of segments: "
-            << CGAL::segmentation_from_sdf_values(*input_triangle_mesh, sdf_property_map, segment_property_map) <<"\n";
-
-  Polyhedron* segmented_polyhedron = new Polyhedron(*input_triangle_mesh);
-
-  int i=0;
-  BOOST_FOREACH(Polyhedron::Face_handle fd, faces(*segmented_polyhedron))
-  {
-    fd->set_patch_id( static_cast<int>(segment_ids[i++] ));
-  }
-
-  scene->item(InputMeshItemIndex)->setVisible(false);
-  Scene_polyhedron_item* item_segmentation = new Scene_polyhedron_item(segmented_polyhedron);
-  item_segmentation->setItemIsMulticolor(true);
-  scene->addItem(item_segmentation);
-  item_segmentation->setName(QString("segmentation"));
-
-  QApplication::restoreOverrideCursor();
-}
-
-void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionConvert_to_medial_skeleton_triggered()
-{
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-
-  Scene_polyhedron_item* item =
-    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-
-  if(item)
-  {
-    Polyhedron* pMesh = item->polyhedron();
-
-    if ( !is_mesh_valid(pMesh) ) return;
-
-    QTime time;
-    time.start();
-    QApplication::setOverrideCursor(Qt::WaitCursor);
-
-    Skeleton skeleton;
-    CGAL::extract_mean_curvature_flow_skeleton(*pMesh, skeleton);
-
-    std::cout << "ok (" << time.elapsed() << " ms, " << ")" << std::endl;
-
-    //create the polylines representing the skeleton
-    Scene_polylines_item* skeleton_item = new Scene_polylines_item();
-    skeleton_item->setColor(QColor(175, 0, 255));
-
-    Polyline_visitor polyline_visitor(skeleton_item->polylines, skeleton);
-    CGAL::split_graph_into_polylines( skeleton,
-                                      polyline_visitor,
-                                      CGAL::internal::IsTerminalDefault() );
-
-    skeleton_item->setName(QString("Medial skeleton curve of %1").arg(item->name()));
-    scene->addItem(skeleton_item);
-    skeleton_item->invalidateOpenGLBuffers();
-
-    item->setPointsMode();
-
-    QApplication::restoreOverrideCursor();
-  }
-}
-
-void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionContract()
-{
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-  if (!check_item_index(index))
-  {
-    return;
-  }
-
-  Scene_polyhedron_item* item =
-    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-
-  if (!check_mesh(item))
-  {
-    return;
-  }
-
-  QTime time;
-  time.start();
-  std::cout << "Contract...\n";
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-
-  update_parameters(mcs);
-  mcs->contract_geometry();
-
-  std::cout << "ok (" << time.elapsed() << " ms, " << ")" << std::endl;
-
-  update_meso_skeleton();
-  QApplication::restoreOverrideCursor();
-}
-
-void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionCollapse()
-{
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-  if (!check_item_index(index))
-  {
-    return;
-  }
-
-  Scene_polyhedron_item* item =
-    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-
-  if (!check_mesh(item))
-  {
-    return;
-  }
-
-  QTime time;
-  time.start();
-  std::cout << "Collapse...\n";
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-
-  update_parameters(mcs);
-  std::size_t num_collapses = mcs->collapse_edges();
-  std::cout << "collapsed " << num_collapses << " edges.\n";
-
-  std::cout << "ok (" << time.elapsed() << " ms, " << ")" << std::endl;
-
-  update_meso_skeleton();
-  QApplication::restoreOverrideCursor();
-}
-
-void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionSplit()
-{
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-  if (!check_item_index(index))
-  {
-    return;
-  }
-
-  Scene_polyhedron_item* item =
-    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-
-  if (!check_mesh(item))
-  {
-    return;
-  }
-
-  QTime time;
-  time.start();
-  std::cout << "Split...\n";
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-
-  update_parameters(mcs);
-  std::size_t num_split = mcs->split_faces();
-  std::cout << "split " << num_split << " triangles.\n";
-
-  std::cout << "ok (" << time.elapsed() << " ms, " << ")" << std::endl;
-
-  update_meso_skeleton();
-  QApplication::restoreOverrideCursor();
-}
-
-void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionDegeneracy()
-{
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-  if (!check_item_index(index))
-  {
-    return;
-  }
-
-  Scene_polyhedron_item* item =
-    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-
-  if (!check_mesh(item))
-  {
-    return;
-  }
-
-  QTime time;
-  time.start();
-  std::cout << "Detect degeneracy...\n";
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-
-  update_parameters(mcs);
-  mcs->detect_degeneracies();
-
-  std::cout << "ok (" << time.elapsed() << " ms, " << ")" << std::endl;
-
-  Scene_points_with_normal_item* fixedPointsItem = new Scene_points_with_normal_item;
-  fixedPointsItem->setName(QString("fixed points of %1").arg(item->name()));
-
-  std::vector<Point> fixedPoints;
-  mcs->fixed_points(fixedPoints);
-
-  Point_set *ps = fixedPointsItem->point_set();
-  for (size_t i = 0; i < fixedPoints.size(); ++i)
-  {
-    UI_point_3<Kernel> point(fixedPoints[i].x(), fixedPoints[i].y(), fixedPoints[i].z());
-    ps->push_back(point);
-  }
-  ps->select_all ();
-
-  if (fixedPointsItemIndex == -1)
-  {
-    fixedPointsItemIndex = scene->addItem(fixedPointsItem);
-  }
-  else
-  {
-    Scene_item* temp = scene->replaceItem(fixedPointsItemIndex, fixedPointsItem, false);
-    delete temp;
-  }
-  // update scene
-  update_meso_skeleton();
-  scene->item(fixedPointsItemIndex)->invalidateOpenGLBuffers();
-  scene->itemChanged(fixedPointsItemIndex);
-  scene->setSelectedItem(index);
-  QApplication::restoreOverrideCursor();
-}
-
-void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionRun()
-{
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-  if (!check_item_index(index))
-  {
-    return;
-  }
-
-  Scene_polyhedron_item* item =
-    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-
-  if (!check_mesh(item))
-  {
-    return;
-  }
-
-  QTime time;
-  time.start();
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-
-  std::cout << "Run one iteration...\n";
-
-  update_parameters(mcs);
-  mcs->contract();
-
-  std::cout << "ok (" << time.elapsed() << " ms, " << ")" << std::endl;
-
-  CGAL::Three::Scene_interface::Item_id contracted_item_index = scene->mainSelectionIndex();
-  Scene_polyhedron_item* contracted_item =
-    qobject_cast<Scene_polyhedron_item*>(scene->item(contracted_item_index));
-
-  // update scene
-  Scene_points_with_normal_item* fixedPointsItem = new Scene_points_with_normal_item;
-  fixedPointsItem->setName(QString("fixed points of %1").arg(contracted_item->name()));
-
-  std::vector<Point> fixedPoints;
-  mcs->fixed_points(fixedPoints);
-
-  Point_set *ps = fixedPointsItem->point_set();
-  for (size_t i = 0; i < fixedPoints.size(); ++i)
-  {
-    UI_point_3<Kernel> point(fixedPoints[i].x(), fixedPoints[i].y(), fixedPoints[i].z());
-    ps->push_back(point);
-  }
-  ps->select_all();
-  
-  if (fixedPointsItemIndex == -1)
-  {
-    fixedPointsItemIndex = scene->addItem(fixedPointsItem);
-  }
-  else
-  {
-    Scene_item* temp = scene->replaceItem(fixedPointsItemIndex, fixedPointsItem, false);
-    delete temp;
-  }
-
-//#define DRAW_NON_FIXED_POINTS
-#ifdef DRAW_NON_FIXED_POINTS
-  // draw non-fixed points
-  Scene_points_with_normal_item* nonFixedPointsItem = new Scene_points_with_normal_item;
-  nonFixedPointsItem->setName("non-fixed points");
-  nonFixedPointsItem->setColor(QColor(0, 255, 0));
-  std::vector<Point> nonFixedPoints;
-  mcs->non_fixed_points(nonFixedPoints);
-  ps = nonFixedPointsItem->point_set();
-  for (size_t i = 0; i < nonFixedPoints.size(); ++i)
-  {
-    UI_point_3<Kernel> point(nonFixedPoints[i].x(), nonFixedPoints[i].y(), nonFixedPoints[i].z());
-    ps->push_back(point);
-  }
-  if (nonFixedPointsItemIndex == -1)
-  {
-    nonFixedPointsItemIndex = scene->addItem(nonFixedPointsItem);
-  }
-  else
-  {
-    scene->replaceItem(nonFixedPointsItemIndex, nonFixedPointsItem, false);
-  }
-  scene->itemChanged(nonFixedPointsItemIndex);
-#endif
-
-//#define DRAW_POLE_LINE
-#ifdef DRAW_POLE_LINE
-  // draw lines connecting surface points and their correspondent poles
-  Scene_polylines_item* poleLinesItem = new Scene_polylines_item();
-
-  Polyhedron* pMesh = item->polyhedron();
-  std::vector<Point> pole_points;
-  mcs->poles(pole_points);
-  vertex_iterator vb, ve;
-  int id = 0;
-  for (boost::tie(vb, ve) = vertices(*pMesh); vb != ve; ++vb)
-  {
-    std::vector<Point> line;
-    line.clear();
-
-    vertex_descriptor v = *vb;
-    Point s = v->point();
-    Point t = pole_points[id++];
-
-    line.push_back(s);
-    line.push_back(t);
-    poleLinesItem->polylines.push_back(line);
-  }
-
-  if (poleLinesItemIndex == -1)
-  {
-    poleLinesItemIndex = scene->addItem(poleLinesItem);
-  }
-  else
-  {
-    scene->replaceItem(poleLinesItemIndex, poleLinesItem, false);
-  }
-#endif
-
-  update_meso_skeleton();
-  scene->setSelectedItem(index);
-  QApplication::restoreOverrideCursor();
-}
-
-void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionSkeletonize()
-{
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-  if (!check_item_index(index))
-  {
-    return;
-  }
-
-  Scene_polyhedron_item* item =
-    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-
-  if (!check_mesh(item))
-  {
-    return;
-  }
-
-  QTime time;
-  time.start();
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-
-  update_parameters(mcs);
-
-  mcs->convert_to_skeleton(skeleton_curve);
-
-
-  std::cout << "ok (" << time.elapsed() << " ms, " << ")" << std::endl;
-
-  //create the polylines representing the skeleton
-  Scene_polylines_item* skeleton = new Scene_polylines_item();
-  skeleton->setColor(QColor(175, 0, 255));
-
-  Polyline_visitor polyline_visitor(skeleton->polylines, skeleton_curve);
-  CGAL::split_graph_into_polylines( skeleton_curve,
-                                    polyline_visitor,
-                                    CGAL::internal::IsTerminalDefault() );
-
-  skeleton->setName(QString("skeleton curve of %1").arg(item->name()));
-  scene->addItem(skeleton);
-  skeleton->invalidateOpenGLBuffers();
-
-  // set the fixed points and contracted mesh as invisible
-  if (fixedPointsItemIndex >= 0)
-  {
-    scene->item(fixedPointsItemIndex)->setVisible(false);
-    scene->itemChanged(fixedPointsItemIndex);
-  }
-  scene->item(contractedItemIndex)->setVisible(false);
-  scene->itemChanged(contractedItemIndex);
-  // display the original mesh in transparent mode
-  item->setVisible(false);
-  if (InputMeshItemIndex >= 0)
-  {
-    scene->item(InputMeshItemIndex)->setVisible(true);
-    scene->item(InputMeshItemIndex)->setPointsMode();
-    scene->itemChanged(InputMeshItemIndex);
-  }
-
-  // update scene
-  QApplication::restoreOverrideCursor();
-}
-
-void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionConverge()
-{
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-  if (!check_item_index(index))
-  {
-    return;
-  }
-
-  Scene_polyhedron_item* item =
-    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-
-  if (!check_mesh(item))
-  {
-    return;
-  }
-
-  QTime time;
-  time.start();
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-
-  mcs->contract_until_convergence();
-
-  std::cout << "ok (" << time.elapsed() << " ms, " << ")" << std::endl;
-
-  // update scene
-  Scene_points_with_normal_item* fixedPointsItem = new Scene_points_with_normal_item;
-  fixedPointsItem->setName(QString("fixed points of %1").arg(item->name()));
-
-  std::vector<Point> fixedPoints;
-  mcs->fixed_points(fixedPoints);
-
-  Point_set *ps = fixedPointsItem->point_set();
-  for (size_t i = 0; i < fixedPoints.size(); ++i)
-  {
-    UI_point_3<Kernel> point(fixedPoints[i].x(), fixedPoints[i].y(), fixedPoints[i].z());
-    ps->push_back(point);
-  }
-  ps->select_all();
-  
-  if (fixedPointsItemIndex == -1)
-  {
-    fixedPointsItemIndex = scene->addItem(fixedPointsItem);
-  }
-  else
-  {
-    Scene_item* temp = scene->replaceItem(fixedPointsItemIndex, fixedPointsItem, false);
-    delete temp;
-  }
-
-  scene->item(fixedPointsItemIndex)->invalidateOpenGLBuffers();
-  scene->itemChanged(fixedPointsItemIndex);
-  update_meso_skeleton();
-  scene->setSelectedItem(index);
-
-  QApplication::restoreOverrideCursor();
-}
-
-void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionItemAboutToBeDestroyed(CGAL::Three::Scene_item* /* item */)
-{
-  if (mcs != NULL)
-  {
-    delete mcs;
-    mcs = NULL;
-  }
-}
-
-#include "Mean_curvature_flow_skeleton_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.ui b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.ui
deleted file mode 100644
index 0ffff6e..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.ui
+++ /dev/null
@@ -1,174 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>Mean_curvature_flow_skeleton_plugin</class>
- <widget class="QDockWidget" name="Mean_curvature_flow_skeleton_plugin">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>744</width>
-    <height>468</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>DockWidget</string>
-  </property>
-  <widget class="QWidget" name="dockWidgetContents">
-   <layout class="QVBoxLayout" name="verticalLayout_3">
-    <item>
-     <widget class="QCheckBox" name="is_medially_centered">
-      <property name="text">
-       <string>Is medially centered</string>
-      </property>
-     </widget>
-    </item>
-    <item>
-     <layout class="QHBoxLayout" name="horizontalLayout_6">
-      <item>
-       <layout class="QVBoxLayout" name="verticalLayout_2">
-        <item>
-         <layout class="QHBoxLayout" name="horizontalLayout_2">
-          <item>
-           <widget class="QLabel" name="label_omega_H">
-            <property name="text">
-             <string>quality_speed_tradeoff</string>
-            </property>
-           </widget>
-          </item>
-          <item>
-           <widget class="QDoubleSpinBox" name="omega_H"/>
-          </item>
-         </layout>
-        </item>
-        <item>
-         <layout class="QHBoxLayout" name="horizontalLayout_3">
-          <item>
-           <widget class="QLabel" name="label_omega_P">
-            <property name="text">
-             <string>medially_centered_speed_tradeoff</string>
-            </property>
-           </widget>
-          </item>
-          <item>
-           <widget class="QDoubleSpinBox" name="omega_P"/>
-          </item>
-         </layout>
-        </item>
-        <item>
-         <layout class="QHBoxLayout" name="horizontalLayout_4">
-          <item>
-           <widget class="QLabel" name="label_min_edge_length">
-            <property name="text">
-             <string>min_edge_length</string>
-            </property>
-           </widget>
-          </item>
-          <item>
-           <widget class="QDoubleSpinBox" name="min_edge_length"/>
-          </item>
-         </layout>
-        </item>
-        <item>
-         <layout class="QHBoxLayout" name="horizontalLayout_5">
-          <item>
-           <widget class="QLabel" name="label_delta_area">
-            <property name="text">
-             <string>area_variation_factor </string>
-            </property>
-           </widget>
-          </item>
-          <item>
-           <widget class="QDoubleSpinBox" name="delta_area"/>
-          </item>
-         </layout>
-        </item>
-       </layout>
-      </item>
-      <item>
-       <layout class="QVBoxLayout" name="verticalLayout">
-        <item>
-         <widget class="QPushButton" name="pushButton_run">
-          <property name="text">
-           <string>Run one iteration</string>
-          </property>
-         </widget>
-        </item>
-        <item>
-         <widget class="QPushButton" name="pushButton_converge">
-          <property name="text">
-           <string>Run to convergence</string>
-          </property>
-         </widget>
-        </item>
-        <item>
-         <widget class="QPushButton" name="pushButton_skeletonize">
-          <property name="text">
-           <string>Skeletonize</string>
-          </property>
-         </widget>
-        </item>
-        <item>
-         <widget class="QPushButton" name="pushButton_segment">
-          <property name="text">
-           <string>Segment</string>
-          </property>
-         </widget>
-        </item>
-       </layout>
-      </item>
-     </layout>
-    </item>
-    <item>
-     <widget class="QLabel" name="label">
-      <property name="font">
-       <font>
-        <weight>75</weight>
-        <bold>true</bold>
-       </font>
-      </property>
-      <property name="text">
-       <string>Steps of an iteration:</string>
-      </property>
-     </widget>
-    </item>
-    <item>
-     <layout class="QHBoxLayout" name="horizontalLayout">
-      <item>
-       <widget class="QPushButton" name="pushButton_contract">
-        <property name="text">
-         <string> 1 - Contract</string>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QPushButton" name="pushButton_collapse">
-        <property name="text">
-         <string>2 - Collapse</string>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QPushButton" name="pushButton_split">
-        <property name="text">
-         <string>3 - Split</string>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QPushButton" name="pushButton_degeneracy">
-        <property name="text">
-         <string>4 - Degeneracy</string>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </item>
-   </layout>
-  </widget>
- </widget>
- <resources/>
- <connections/>
- <slots>
-  <slot>contract()</slot>
- </slots>
-</ui>
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Orient_soup_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Orient_soup_plugin.cpp
deleted file mode 100644
index 173fec4..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Orient_soup_plugin.cpp
+++ /dev/null
@@ -1,172 +0,0 @@
-#include <QApplication>
-#include <QAction>
-#include <QList>
-#include <QMainWindow>
-#include <QMessageBox>
-#include <QtDebug>
-
-#include "Scene_polygon_soup_item.h"
-#include "Scene_polyhedron_item.h"
-
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-#include "Messages_interface.h"
-using namespace CGAL::Three;
-class Polyhedron_demo_orient_soup_plugin : 
-  public QObject,
-  public Polyhedron_demo_plugin_interface
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-public:
-  void init(QMainWindow* mainWindow,
-            CGAL::Three::Scene_interface* scene_interface,
-            Messages_interface* m);
-
-  bool applicable(QAction* action) const {
-    Q_FOREACH(CGAL::Three::Scene_interface::Item_id index, scene->selectionIndices()) {
-      if(qobject_cast<Scene_polygon_soup_item*>(scene->item(index)))
-        return true;
-      else
-        if (action==actionShuffle && 
-            qobject_cast<Scene_polyhedron_item*>(scene->item(index)))
-            return true;
-    }
-    return false;
-  }
-
-  QList<QAction*> actions() const;
-
-public Q_SLOTS:
-  void orient();
-  void shuffle();
-  void displayNonManifoldEdges();
-
-private:
-  CGAL::Three::Scene_interface* scene;
-  Messages_interface* messages;
-  QMainWindow* mw;
-  QAction* actionOrient;
-  QAction* actionShuffle;
-  QAction* actionDisplayNonManifoldEdges;
-
-}; // end Polyhedron_demo_orient_soup_plugin
-
-void Polyhedron_demo_orient_soup_plugin::init(QMainWindow* mainWindow,
-                                              CGAL::Three::Scene_interface* scene_interface,
-                                              Messages_interface* m)
-{
-  scene = scene_interface;
-  mw = mainWindow;
-  messages = m;
-  actionOrient = new QAction(tr("&Orient Polygon Soup"), mainWindow);
-  actionOrient->setObjectName("actionOrient");
-  actionOrient->setProperty("subMenuName", "Polygon Mesh Processing");
-  connect(actionOrient, SIGNAL(triggered()),
-          this, SLOT(orient()));
-
-  actionShuffle = new QAction(tr("&Shuffle Polygon Soup"), mainWindow);
-  actionShuffle->setProperty("subMenuName", "Polygon Mesh Processing");
-  connect(actionShuffle, SIGNAL(triggered()),
-          this, SLOT(shuffle()));
-
-  actionDisplayNonManifoldEdges = new QAction(tr("Display Non Manifold Edges"),
-                                              mainWindow);
-  actionDisplayNonManifoldEdges->setProperty("subMenuName", "View");
-  connect(actionDisplayNonManifoldEdges, SIGNAL(triggered()),
-          this, SLOT(displayNonManifoldEdges()));
-}
-
-QList<QAction*> Polyhedron_demo_orient_soup_plugin::actions() const {
-  return QList<QAction*>() << actionOrient
-                           << actionShuffle
-                           << actionDisplayNonManifoldEdges;
-}
-
-void Polyhedron_demo_orient_soup_plugin::orient()
-{
-  Q_FOREACH(CGAL::Three::Scene_interface::Item_id index, scene->selectionIndices())
-  {
-    Scene_polygon_soup_item* item = 
-      qobject_cast<Scene_polygon_soup_item*>(scene->item(index));
-
-    if(item)
-    {
-      //     qDebug()  << tr("I have the item %1\n").arg(item->name());
-      QApplication::setOverrideCursor(Qt::WaitCursor);
-      if(!item->orient()) {
-         QMessageBox::information(mw, tr("Not orientable without self-intersections"),
-                                      tr("The polygon soup \"%1\" is not directly orientable."
-                                         " Some vertices have been duplicated and some self-intersections"
-                                         " have been created.")
-                                      .arg(item->name()));
-      }
-
-      Scene_polyhedron_item* poly_item = new Scene_polyhedron_item();
-      if(item->exportAsPolyhedron(poly_item->polyhedron())) {
-        poly_item->setName(item->name());
-        poly_item->setColor(item->color());
-        poly_item->setRenderingMode(item->renderingMode());
-        poly_item->setVisible(item->visible());
-        poly_item->invalidateOpenGLBuffers();
-        poly_item->setProperty("source filename", item->property("source filename"));
-        scene->replaceItem(index, poly_item);
-        delete item;
-      } else {
-        item->invalidateOpenGLBuffers();
-        scene->itemChanged(item);
-      }
-
-      QApplication::restoreOverrideCursor();
-    }
-    else{
-      messages->warning(tr("This function is only applicable on polygon soups."));
-    }
-  }
-}
-
-void Polyhedron_demo_orient_soup_plugin::shuffle()
-{
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-  
-  Scene_polygon_soup_item* item = 
-    qobject_cast<Scene_polygon_soup_item*>(scene->item(index));
-
-  if(item) {
-    item->shuffle_orientations();
-    //scene->itemChanged(item);
-  }
-  else {
-    Scene_polyhedron_item* poly_item = 
-      qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-    if(poly_item) {
-      item = new Scene_polygon_soup_item();
-      item->setName(poly_item->name());
-      item->setRenderingMode(poly_item->renderingMode());
-      item->setVisible(poly_item->visible());
-      item->setProperty("source filename", poly_item->property("source filename"));
-      item->load(poly_item);
-      item->shuffle_orientations();
-      item->setColor(poly_item->color());
-      scene->replaceItem(index, item);
-      delete poly_item;
-    }
-  }
-}
-
-void Polyhedron_demo_orient_soup_plugin::displayNonManifoldEdges()
-{
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-  
-  Scene_polygon_soup_item* item = 
-    qobject_cast<Scene_polygon_soup_item*>(scene->item(index));
-
-  if(item)
-  {
-    item->setDisplayNonManifoldEdges(!item->displayNonManifoldEdges());
-    scene->itemChanged(item);
-  }
-}
-
-#include "Orient_soup_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Point_inside_polyhedron_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Point_inside_polyhedron_plugin.cpp
deleted file mode 100644
index 5af4869..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Point_inside_polyhedron_plugin.cpp
+++ /dev/null
@@ -1,257 +0,0 @@
-#include <QtCore/qglobal.h>
-#include "opengl_tools.h"
-
-#include "Messages_interface.h"
-#include "Scene_polyhedron_item.h"
-#include "Scene_points_with_normal_item.h"
-#include <CGAL/Three/Scene_interface.h>
-
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include "Polyhedron_type.h"
-
-#include <CGAL/Timer.h>
-#include <CGAL/Random.h>
-#include <CGAL/Side_of_triangle_mesh.h>
-#include "ui_Point_inside_polyhedron_widget.h"
-
-#include <QAction>
-#include <QMainWindow>
-#include <QApplication>
-#include <QDockWidget>
-#include <QInputDialog>
-
-#include <vector>
-#include <algorithm>
-
-#include <boost/iterator/transform_iterator.hpp>
-#include <boost/optional/optional.hpp>
-using namespace CGAL::Three;
-typedef CGAL::Exact_predicates_inexact_constructions_kernel Epic_kernel;
-
-class Polyhedron_demo_point_inside_polyhedron_plugin :
-  public QObject,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-public:
-  bool applicable(QAction*) const 
-  {
-    bool poly_item_exists = false;
-    bool point_item_exists = false;
-
-    for(CGAL::Three::Scene_interface::Item_id i = 0, end = scene->numberOfEntries();
-      i < end && (!poly_item_exists || !point_item_exists); ++i)
-    {
-      poly_item_exists |= qobject_cast<Scene_polyhedron_item*>(scene->item(i)) != NULL;
-      point_item_exists |= qobject_cast<Scene_points_with_normal_item*>(scene->item(i)) != NULL;
-    }
-
-    //return poly_item_exists && point_item_exists;
-    return poly_item_exists || point_item_exists;
-  }
-  void print_message(QString message) { messages->information(message); }
-  QList<QAction*> actions() const { return QList<QAction*>() << actionPointInsidePolyhedron; }
-
-  using Polyhedron_demo_plugin_helper::init;
-  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface* m)
-  {
-    mw = mainWindow;
-    scene = scene_interface;
-    messages = m;
-
-    actionPointInsidePolyhedron = new QAction(tr("Point Inside Polyhedron"), mw);
-    actionPointInsidePolyhedron->setProperty("subMenuName", "Polygon Mesh Processing");
-    connect(actionPointInsidePolyhedron, SIGNAL(triggered()), this, SLOT(point_inside_polyhedron_action()));
-
-    dock_widget = new QDockWidget("Point Inside Polyhedron", mw);
-    dock_widget->setVisible(false);
-    ui_widget.setupUi(dock_widget);
-
-    add_dock_widget(dock_widget);
-
-    connect(ui_widget.Select_button,  SIGNAL(clicked()), this, SLOT(on_Select_button())); 
-    connect(ui_widget.Sample_random_points_from_bbox,  SIGNAL(clicked()), this, SLOT(on_Sample_random_points_from_bbox())); 
-    
-  }
-
-  virtual void closure()
-  {
-    dock_widget->hide();
-  }
-private:
-  // for transform iterator
-  struct Get_ref {
-    typedef const Polyhedron& result_type;
-    result_type operator()(const Polyhedron* poly_ptr) const
-    { return *poly_ptr; }
-  };
-
-
-public Q_SLOTS:
-  void point_inside_polyhedron_action() { 
-    dock_widget->show();
-    dock_widget->raise();
-  }
-
-  void on_Select_button() 
-  {
-    bool inside = ui_widget.Inside_check_box->isChecked();
-    bool on_boundary = ui_widget.On_boundary_check_box->isChecked();
-    bool outside = ui_widget.Outside_check_box->isChecked();
-
-    if(!(inside || on_boundary || outside)) {
-      print_message("Error: please check at least one parameter check box.");
-      return;
-    }
-
-    // place all selected polyhedron and point items to vectors below
-    std::vector<const Polyhedron*> polys;
-    typedef CGAL::Side_of_triangle_mesh<Polyhedron, Kernel> Point_inside;
-    std::vector<Point_inside*> inside_testers;// to put all polyhedra to query object
-        // it does not support copy-construction so let's use pointers
-    std::vector<Point_set*> point_sets;
-    Q_FOREACH(CGAL::Three::Scene_interface::Item_id id, scene->selectionIndices()) {
-      Scene_polyhedron_item* poly_item = qobject_cast<Scene_polyhedron_item*>(scene->item(id));
-      if (poly_item)
-        inside_testers.push_back(new Point_inside(*(poly_item->polyhedron())));
-      if(poly_item) { polys.push_back(poly_item->polyhedron()); }
-
-      Scene_points_with_normal_item* point_item = qobject_cast<Scene_points_with_normal_item*>(scene->item(id));
-      if(point_item) { point_sets.push_back(point_item->point_set()); }
-    }
-
-    // there should be at least one selected polyhedron and point item
-    if(inside_testers.empty()) { print_message("Error: there is no selected polyhedron item(s)."); }
-    if(point_sets.empty()) { print_message("Error: there is no selected point set item(s)."); }
-    if(inside_testers.empty() || point_sets.empty()) { return; }
-
-    // deselect all points
-    for(std::vector<Point_set*>::iterator point_set_it = point_sets.begin(); 
-      point_set_it != point_sets.end(); ++point_set_it) {
-      (*point_set_it)->unselect_all();
-    }
-
-    CGAL::Timer timer; timer.start();
-
-    print_message(
-      QString("Constructing with %1 items is done in %2 sec.").arg(inside_testers.size()).arg(timer.time()));
-    timer.reset();
-
-    std::size_t nb_query = 0, nb_selected = 0;// for print message
-    for(std::vector<Point_set*>::iterator point_set_it = point_sets.begin(); 
-      point_set_it != point_sets.end(); ++point_set_it) 
-    {
-      Point_set* point_set = *point_set_it;
-      for (std::size_t pt = 0;
-           pt < point_set->size() - point_set->nb_selected_points();
-           ++ pt, ++ nb_query)
-      {
-        Point_set::iterator point_it = point_set->begin() + pt;
-        for (std::size_t i = 0; i < inside_testers.size(); ++i)
-        {
-        CGAL::Bounded_side res = (*inside_testers[i])(point_it->position());
-
-        if( (inside      && res == CGAL::ON_BOUNDED_SIDE) ||
-            (on_boundary && res == CGAL::ON_BOUNDARY)     ||
-            (outside     && res == CGAL::ON_UNBOUNDED_SIDE) )
-        {
-          point_set->select(point_it); ++nb_selected;
-          -- pt; // Selection replaces current point with unselected one
-          break;//loop on i
-        }
-        }
-      } // loop on points in point_set
-    }// loop on selected point sets
-
-    print_message(QString("Querying with %1 points is done in %2 sec.").arg(nb_query).arg(timer.time()));
-    print_message(QString("%1 points are selected. All Done!").arg(nb_selected));
-
-    // delete testers
-    for (std::size_t i = 0; i < inside_testers.size(); ++i)
-      delete inside_testers[i];
-
-    // for repaint
-    Q_FOREACH(CGAL::Three::Scene_interface::Item_id id, scene->selectionIndices()) {
-      Scene_points_with_normal_item* point_item = qobject_cast<Scene_points_with_normal_item*>(scene->item(id));
-      if(point_item) { 
-        point_item->invalidateOpenGLBuffers();
-        scene->itemChanged(point_item);
-      }
-    }
-
-  }
-
-  void on_Sample_random_points_from_bbox() {
-    
-    // calculate bbox of selected polyhedron items
-    boost::optional<CGAL::Three::Scene_interface::Bbox> bbox
-      = boost::make_optional(false, CGAL::Three::Scene_interface::Bbox());
-    // Workaround a bug in g++-4.8.3:
-    //   http://stackoverflow.com/a/21755207/1728537
-    // Using boost::make_optional to copy-initialize 'bbox' hides the
-    //   warning about '*bbox' not being initialized.
-    // -- Laurent Rineau, 2014/10/30
-
-    Q_FOREACH(CGAL::Three::Scene_interface::Item_id id, scene->selectionIndices()) {
-      Scene_polyhedron_item* poly_item = qobject_cast<Scene_polyhedron_item*>(scene->item(id));
-      if(poly_item) {
-        if(!bbox) {
-          bbox = poly_item->bbox();
-        }
-        else {
-          *bbox = *bbox + poly_item->bbox();
-        }
-      }
-    }
-
-    if(!bbox) {
-      print_message("Error: there is no selected polyhedron item(s)."); 
-      return;
-    }
-
-    // take number of points param
-    bool ok;
-    const int nb_points = 
-      QInputDialog::getInt(mw, tr("Number of Points"),
-      tr("Number of Points:"),
-      100000, // default value
-      1, // min
-      (int)1.e9, // max
-      10, // step for the spinbox
-      &ok);
-
-    if(!ok) { return; }
-
-    // sample random points and constuct item
-    Scene_points_with_normal_item* point_item = new Scene_points_with_normal_item();
-    point_item->setName(QString("sample-%1").arg(nb_points));
-    CGAL::Random rg(1340818006);
-
-    double grid_dx = bbox->xmax - bbox->xmin;
-    double grid_dy = bbox->ymax - bbox->ymin;
-    double grid_dz = bbox->zmax - bbox->zmin;
-
-    for(int i=0; i < nb_points; i++){
-      point_item->point_set()->push_back(
-      Epic_kernel::Point_3(bbox->xmin + rg.get_double()* grid_dx, 
-        bbox->ymin + rg.get_double()* grid_dy,
-        bbox->zmin + rg.get_double()* grid_dz)
-      );
-    }
-
-    scene->addItem(point_item);
-    scene->itemChanged(point_item);
-  }
-private:
-  Messages_interface* messages;
-  QAction* actionPointInsidePolyhedron;
-
-  QDockWidget* dock_widget;
-  Ui::Point_inside_polyhedron ui_widget;
-
-}; // end Polyhedron_demo_point_inside_polyhedron_plugin
-
-#include "Point_inside_polyhedron_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Point_inside_polyhedron_widget.ui b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Point_inside_polyhedron_widget.ui
deleted file mode 100644
index cd1529c..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Point_inside_polyhedron_widget.ui
+++ /dev/null
@@ -1,95 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>Point_inside_polyhedron</class>
- <widget class="QDockWidget" name="Point_inside_polyhedron">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>542</width>
-    <height>258</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Point Inside Polyhedron</string>
-  </property>
-  <widget class="QWidget" name="dockWidgetContents">
-   <layout class="QVBoxLayout" name="verticalLayout">
-    <item>
-     <widget class="QPushButton" name="Sample_random_points_from_bbox">
-      <property name="text">
-       <string>Sample Random Points from Bbox</string>
-      </property>
-     </widget>
-    </item>
-    <item>
-     <widget class="QGroupBox" name="groupBox">
-      <property name="title">
-       <string>Point Location</string>
-      </property>
-      <layout class="QVBoxLayout" name="verticalLayout_2">
-       <item>
-        <layout class="QHBoxLayout" name="horizontalLayout">
-         <item>
-          <widget class="QCheckBox" name="Inside_check_box">
-           <property name="text">
-            <string>Inside</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QCheckBox" name="On_boundary_check_box">
-           <property name="text">
-            <string>On Boundary</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QCheckBox" name="Outside_check_box">
-           <property name="text">
-            <string>Outside</string>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </item>
-       <item>
-        <widget class="QPushButton" name="Select_button">
-         <property name="text">
-          <string>Select</string>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <widget class="QLabel" name="label">
-         <property name="font">
-          <font>
-           <weight>75</weight>
-           <bold>true</bold>
-          </font>
-         </property>
-         <property name="text">
-          <string>Note:</string>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <layout class="QHBoxLayout" name="horizontalLayout_2">
-         <item>
-          <widget class="QLabel" name="label_2">
-           <property name="text">
-            <string><html><head/><body><p>A selection is possible only if a point set item<br/>and a (closed) polyhedron item are selected</p></body></html></string>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </item>
-      </layout>
-     </widget>
-    </item>
-   </layout>
-  </widget>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Polyhedron_slicer_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Polyhedron_slicer_plugin.cpp
deleted file mode 100644
index 19709df..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Polyhedron_slicer_plugin.cpp
+++ /dev/null
@@ -1,348 +0,0 @@
-#include <QtCore/qglobal.h>
-#include <CGAL/AABB_intersections.h>
-
-#include "Messages_interface.h"
-#include "Scene_plane_item.h"
-#include "Scene_polyhedron_item.h"
-#include "Scene_polylines_item.h"
-#include "Scene.h"
-
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include "ui_Polyhedron_slicer_widget.h"
-
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-#include <CGAL/bounding_box.h> 
-#include <CGAL/Polygon_mesh_slicer.h>
-
-#include "Polyhedron_type.h"
-
-#include <QTime>
-#include <QAction>
-#include <QMainWindow>
-#include <QApplication>
-#include <QDockWidget>
-
-#include <vector>
-#include <algorithm>
-
-typedef CGAL::Exact_predicates_inexact_constructions_kernel Epic_kernel;
-using namespace CGAL::Three;
-class Polyhedron_demo_polyhedron_slicer_plugin :
-  public QObject,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-public:
-  bool applicable(QAction*) const { return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex())); }
-  void print_message(QString message) { messages->information(message);}
-
-  using Polyhedron_demo_plugin_helper::init;
-  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface* m);
-  virtual void closure()
-  {
-    dock_widget->hide();
-  }
-  QList<QAction*> actions() const;
-  bool get_base_1_2(double bases[6]) {
-    bool oks[6];
-    bases[0] = ui_widget.Base_1_x->text().toDouble(&oks[0]);
-    bases[1] = ui_widget.Base_1_y->text().toDouble(&oks[1]);
-    bases[2] = ui_widget.Base_1_z->text().toDouble(&oks[2]);
-
-    bases[3] = ui_widget.Base_2_x->text().toDouble(&oks[3]);
-    bases[4] = ui_widget.Base_2_y->text().toDouble(&oks[4]);
-    bases[5] = ui_widget.Base_2_z->text().toDouble(&oks[5]);
-
-    bool total_ok = true;
-    for(int i = 0; i < 6; ++i && total_ok) { total_ok &= oks[i];}
-    return total_ok;
-  }
-public Q_SLOTS:
-  void slicer_widget_action();
-  void on_Generate_button_clicked();
-  bool on_Update_plane_button_clicked();
-  void plane_manipulated_frame_modified();
-  void item_about_to_be_destroyed(CGAL::Three::Scene_item* scene_item);
-  void dock_widget_closed();
-
-protected:
-  bool eventFilter(QObject *, QEvent *event) {
-    if(event->type() == QEvent::Close) {
-      dock_widget_closed();
-    }
-    return false;
-  }
-
-private:
-  Messages_interface* messages;
-  Scene_plane_item* plane_item;
-  QAction* actionSlicerWidget;
-
-  QDockWidget* dock_widget;
-  Ui::Polyhedron_slicer ui_widget;
-  
-  void intersection_of_plane_Polyhedra_3_using_AABB_wrapper(Polyhedron& mesh, 
-    const std::vector<Epic_kernel::Plane_3>& planes,
-    const std::vector<qglviewer::Vec>& plane_positions,
-    std::list<std::vector<Epic_kernel::Point_3> >& polylines);
-
-}; // end Polyhedron_demo_polyhedron_slicer_plugin
-
-void Polyhedron_demo_polyhedron_slicer_plugin::init(QMainWindow* mainWindow,
-                                      CGAL::Three::Scene_interface* scene_interface,
-                                      Messages_interface* m)
-{
-  mw = mainWindow;
-  scene = scene_interface;
-  messages = m;
-  plane_item = NULL;
-
-  actionSlicerWidget = new QAction(tr("Polyhedron Slicer"), mw);
-  actionSlicerWidget->setProperty("subMenuName", "Polygon Mesh Processing");
-  connect(actionSlicerWidget, SIGNAL(triggered()), this, SLOT(slicer_widget_action()));
-
-  dock_widget = new QDockWidget("Polyhedron Slicer", mw);
-  dock_widget->setVisible(false);
-  dock_widget->installEventFilter(this);
-  ui_widget.setupUi(dock_widget);
-
-  add_dock_widget(dock_widget);
-
-  connect(ui_widget.Generate_button,  SIGNAL(clicked()), this, SLOT(on_Generate_button_clicked()));   
-  connect(ui_widget.Update_plane_button,  SIGNAL(clicked()), this, SLOT(on_Update_plane_button_clicked())); 
-}
-
-QList<QAction*> Polyhedron_demo_polyhedron_slicer_plugin::actions() const {
-  return QList<QAction*>() << actionSlicerWidget;
-}
-
-void Polyhedron_demo_polyhedron_slicer_plugin::slicer_widget_action(){
-  if(dock_widget->isVisible()) { return; }
-  dock_widget->show(); 
-  dock_widget->raise();
-  ///// from cut plugin /////
-  CGAL_assertion(plane_item == NULL);
-
-  plane_item = new Scene_plane_item(scene);
-  const CGAL::Three::Scene_interface::Bbox& bbox = scene->bbox();
-  plane_item->setPosition((bbox.xmin + bbox.xmax)/2.f,
-    (bbox.ymin+bbox.ymax)/2.f,
-    (bbox.zmin+bbox.zmax)/2.f);
-  plane_item->setNormal(0., 0., 1.);
-  plane_item->setManipulatable(true);
-  plane_item->setClonable(false);
-  plane_item->setColor(Qt::green);
-  plane_item->setName(tr("Cutting plane"));
-  connect(plane_item->manipulatedFrame(), SIGNAL(modified()),
-    this, SLOT(plane_manipulated_frame_modified()));
-
-  if(Scene* scene_casted = dynamic_cast<Scene*>(scene)) 
-  { connect(scene_casted, SIGNAL(itemAboutToBeDestroyed(CGAL::Three::Scene_item*)), this, SLOT(item_about_to_be_destroyed(CGAL::Three::Scene_item*))); }
-  scene->addItem(plane_item);
-
-  // set distance_with_planes = bbox_diagona / 30
-  double diagonal = std::sqrt(
-    CGAL::squared_distanceC3( bbox.xmin, bbox.ymin, bbox.zmin, bbox.xmax, bbox.ymax, bbox.zmax) );
-  ui_widget.Distance_with_planes->setText(QString::number(diagonal / 30.0));
-
-  plane_manipulated_frame_modified(); // update text boxes
-}
-
-// when manipulated frame of plane is modified, update line-edits
-void Polyhedron_demo_polyhedron_slicer_plugin::plane_manipulated_frame_modified() {
-  qglviewer::ManipulatedFrame* mf = plane_item->manipulatedFrame();
-  const qglviewer::Vec& pos = mf->position();
-  ui_widget.Center_x->setText(QString::number(pos.x));
-  ui_widget.Center_y->setText(QString::number(pos.y));
-  ui_widget.Center_z->setText(QString::number(pos.z));
-
-  const qglviewer::Vec& base_1 = mf->inverseTransformOf(qglviewer::Vec(1., 0., 0.));
-  const qglviewer::Vec& base_2 = mf->inverseTransformOf(qglviewer::Vec(0., 1., 0.));
-
-  ui_widget.Base_1_x->setText(QString::number(base_1.x));
-  ui_widget.Base_1_y->setText(QString::number(base_1.y));
-  ui_widget.Base_1_z->setText(QString::number(base_1.z));
-
-  ui_widget.Base_2_x->setText(QString::number(base_2.x));
-  ui_widget.Base_2_y->setText(QString::number(base_2.y));
-  ui_widget.Base_2_z->setText(QString::number(base_2.z));
-}
-
-// when Update Plane button is clicked, update manipulated frame of plane with line-edits
-bool Polyhedron_demo_polyhedron_slicer_plugin::on_Update_plane_button_clicked() {
-  qglviewer::ManipulatedFrame* mf = plane_item->manipulatedFrame();
-  // get center
-  bool ok_1 = true, ok_2 = true, ok_3 = true;
-  double center_x = ui_widget.Center_x->text().toDouble(&ok_1);
-  double center_y = ui_widget.Center_y->text().toDouble(&ok_2);
-  double center_z = ui_widget.Center_z->text().toDouble(&ok_3);
-  if(!ok_1 || !ok_2 || !ok_3) 
-  { print_message("Error: center coordinates not convertible to double."); return false; }
-
-  // set center
-  bool oldState = mf->blockSignals(true); // dont let it signal, it will invoke plane_manipulated_frame_modified otherwise
-  mf->setPosition(center_x, center_y, center_z);
-  mf->blockSignals(oldState);
-
-  // get base 1 and base 2
-  double bases[6];
-  if(!get_base_1_2(bases)) 
-  { print_message("Error: Base-1, Base-2 coordinates not convertible to double."); return false; }
-
-  // compute other axis
-  qglviewer::Vec base_1(bases[0], bases[1], bases[2]);
-  qglviewer::Vec base_2(bases[3], bases[4], bases[5]);
-  qglviewer::Vec other = cross(base_1, base_2);
-  if(other.norm() == 0.0) { print_message("Error: collinear base vectors are not accepted!"); return false; }
-  
-  // set orientation
-  qglviewer::Quaternion orientation_from_bases;
-  orientation_from_bases.setFromRotatedBasis(base_1, base_2, other);
-
-  oldState = mf->blockSignals(true); // dont let it signal, it will invoke plane_manipulated_frame_modified otherwise
-  mf->setOrientation(orientation_from_bases);
-  mf->blockSignals(oldState);
-
-  scene->itemChanged(plane_item); // redraw
-  return true;
-}
-
-// generate multiple cuts, until any cut does not intersect with bbox
-void Polyhedron_demo_polyhedron_slicer_plugin::on_Generate_button_clicked()
-{
-  Scene_polyhedron_item* item = get_selected_item<Scene_polyhedron_item>();
-  if(!item) { 
-    print_message("Error: There is no selected Scene_polyhedron_item!");
-    return; 
-  }
-
-  if(!on_Update_plane_button_clicked()) { return; }
-
-  // get plane position and normal
-  qglviewer::ManipulatedFrame* mf = plane_item->manipulatedFrame();
-  const qglviewer::Vec& pos = mf->position();
-  // WARNING: due to fp arithmetic (setting quaternion based orientation from base vectors then getting plane normal back from this orientation)
-  // for base vectors like: 1,0,0 - 0,1,0 we might not have exact corresponding normal vector.
-  // So not using below normal but construct plane directly from bases from text boxes
-  const qglviewer::Vec& n = mf->inverseTransformOf(qglviewer::Vec(0.f, 0.f, 1.f));
-
-  // get bases
-  double bases[6];
-  get_base_1_2(bases); // no need to check since we call on_Update_plane_button_clicked
-  Epic_kernel::Vector_3 base_1(bases[0], bases[1], bases[2]);
-  Epic_kernel::Vector_3 base_2(bases[3], bases[4], bases[5]);
-  const Epic_kernel::Vector_3 normal = CGAL::cross_product(base_1, base_2);
-
-  // get distance between planes
-  bool to_double_ok = true;
-  double distance_with_planes = ui_widget.Distance_with_planes->text().toDouble(&to_double_ok);
-  if(!to_double_ok) { 
-    print_message("Error: Set Distance_with_planes text box!");
-    return; 
-  }
-
-  // construct a bbox for selected polyhedron
-  const CGAL::Three::Scene_interface::Bbox& bbox = item->bbox();
-  CGAL::Bbox_3 cgal_bbox(bbox.xmin, bbox.ymin, bbox.zmin,
-    bbox.xmax, bbox.ymax, bbox.zmax);
-  Polyhedron* poly = item->polyhedron();
-
-  // continue generating planes while inside bbox
-  std::vector<Epic_kernel::Plane_3> planes;
-  std::vector<qglviewer::Vec> plane_positions;
-
-  for(int dir = 1, step = 0; /* */ ; ++step) 
-  {
-    double distance_norm = (dir * step) * distance_with_planes;
-    qglviewer::Vec new_pos = pos + (n*distance_norm);
-
-    //Epic_kernel::Plane_3 plane(n[0], n[1],  n[2], - n * new_pos);
-    Epic_kernel::Point_3 new_pos_cgal(new_pos[0], new_pos[1], new_pos[2]);
-    Epic_kernel::Plane_3 plane(new_pos_cgal, normal);
-
-    if(!CGAL::do_intersect(cgal_bbox, plane)) { 
-      if(dir == -1) { break; }
-      std::reverse(planes.begin(), planes.end());
-      std::reverse(plane_positions.begin(), plane_positions.end());
-      dir = -1; // reverse direction
-      step = 0; // we should skip the plane itself, and we will when continue cause ++step
-      continue;
-    }
-    planes.push_back(plane);
-    plane_positions.push_back(new_pos); 
-  }
-  print_message(QString("Created %1 cuts inside bbox...").arg(planes.size()));
-
-  bool new_polyline_item_for_polylines = ui_widget.newPolylineItemCheckBox->checkState() == Qt::Checked;
-  if(!new_polyline_item_for_polylines) 
-  {
-    Scene_polylines_item* new_polylines_item = new Scene_polylines_item();
-    QTime time; time.start();
-    // call algorithm and fill polylines in polylines_item
-    intersection_of_plane_Polyhedra_3_using_AABB_wrapper(*poly, planes, plane_positions, new_polylines_item->polylines);
-    // set names etc and print timing
-    print_message( QString("Done: processed %1 cuts - generated %2 polylines in %3 ms!").
-      arg(planes.size()).arg(new_polylines_item->polylines.size()).arg(time.elapsed()) );
-
-    new_polylines_item->setName(QString("%1 with %2 cuts").
-      arg(item->name()).arg(planes.size()) );
-    new_polylines_item->setColor(Qt::green);
-    new_polylines_item->setRenderingMode(Wireframe);
-    scene->addItem(new_polylines_item);
-  }
-  else {
-    QTime time; time.start();
-    std::list<std::vector<Epic_kernel::Point_3> > polylines;
-    // call algorithm and fill polylines in polylines_item
-    intersection_of_plane_Polyhedra_3_using_AABB_wrapper(*poly, planes, plane_positions, polylines);
-    // set names etc and print timing
-    print_message( QString("Done: processed %1 cuts - generated %2 polylines in %3 ms!").
-      arg(planes.size()).arg(polylines.size()).arg(time.elapsed()) );
-
-    int counter = 0;
-    for(std::list<std::vector<Epic_kernel::Point_3> >::iterator it = polylines.begin(); it != polylines.end(); ++it, ++counter) {
-      Scene_polylines_item* new_polylines_item = new Scene_polylines_item();
-      new_polylines_item->polylines.push_back(*it);
-      new_polylines_item->setName(QString("%1 with %2 cuts %3").
-        arg(item->name()).arg(planes.size()).arg(counter) );
-      new_polylines_item->setColor(Qt::green);
-      new_polylines_item->setRenderingMode(Wireframe);
-      scene->addItem(new_polylines_item);
-      new_polylines_item->invalidateOpenGLBuffers();
-    }
-  }
-}
-
-void Polyhedron_demo_polyhedron_slicer_plugin::item_about_to_be_destroyed(CGAL::Three::Scene_item* scene_item) {
-  if(plane_item == NULL) { return; }// which means this plugin erased plane_item
-  Scene_plane_item* destroyed_plane = qobject_cast<Scene_plane_item*>(scene_item);
-  if(destroyed_plane && destroyed_plane == plane_item) {
-    plane_item = NULL;
-    dock_widget->hide();
-  }
-}
-
-void Polyhedron_demo_polyhedron_slicer_plugin::dock_widget_closed() {
-  CGAL_assertion(plane_item != NULL);
-  CGAL::Three::Scene_interface::Item_id id = scene->item_id(plane_item);
-  plane_item = NULL;
-  scene->erase(id);
-}
-// this function assumes 'planes' are parallel
-void Polyhedron_demo_polyhedron_slicer_plugin::intersection_of_plane_Polyhedra_3_using_AABB_wrapper(
-  Polyhedron& poly, 
-  const std::vector<Epic_kernel::Plane_3>& planes,
-  const std::vector<qglviewer::Vec>& plane_positions,
-  std::list<std::vector<Epic_kernel::Point_3> >& polylines) 
-{
-  CGAL::Polygon_mesh_slicer<Polyhedron, Epic_kernel> slicer(poly);
-  std::vector<qglviewer::Vec>::const_iterator plane_position_it = plane_positions.begin();
-  for(std::vector<Epic_kernel::Plane_3>::const_iterator plane_it = planes.begin(); plane_it != planes.end(); ++plane_it, ++plane_position_it) 
-    slicer(*plane_it, std::front_inserter(polylines));
-
-}
-
-#include "Polyhedron_slicer_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Polyhedron_stitching_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Polyhedron_stitching_plugin.cpp
deleted file mode 100644
index 17522c4..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Polyhedron_stitching_plugin.cpp
+++ /dev/null
@@ -1,167 +0,0 @@
-#include <QApplication>
-#include <QMessageBox>
-#include <QMainWindow>
-#include "Kernel_type.h"
-#include "Polyhedron_type.h"
-#include "Scene_polyhedron_item.h"
-#include "Scene_polylines_item.h"
-
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-
-#include <CGAL/Polygon_mesh_processing/stitch_borders.h>
-
-#include <CGAL/boost/graph/split_graph_into_polylines.h>
-#include <CGAL/boost/graph/helpers.h>
-#include <boost/graph/filtered_graph.hpp>
-
-template <typename G>
-struct Is_border {
-  const G& g;
-  Is_border(const G& g)
-    : g(g)
-  {}
-
- template <typename Descriptor>
-  bool operator()(const Descriptor& d) const {
-   return is_border(d,g);
-  }
-
-  bool operator()(typename boost::graph_traits<G>::vertex_descriptor d) const {
-    return is_border(d,g) != boost::none;
-  }
-
-};
-
-
-using namespace CGAL::Three;
-class Polyhedron_demo_polyhedron_stitching_plugin :
-  public QObject,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-  QAction* actionDetectBorders;
-  QAction* actionStitchBorders;
-public:
-  QList<QAction*> actions() const { return QList<QAction*>() << actionDetectBorders << actionStitchBorders; }
-  using Polyhedron_demo_plugin_helper::init;
-  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface* /* m */)
-  {
-    actionDetectBorders= new QAction(tr("Detect Boundaries"), mainWindow);
-    actionStitchBorders= new QAction(tr("Stitch Duplicated Boundaries"), mainWindow);
-    actionDetectBorders->setObjectName("actionDetectBorders");
-    actionStitchBorders->setObjectName("actionStitchBorders");
-    actionStitchBorders->setProperty("subMenuName", "Polygon Mesh Processing");
-    actionDetectBorders->setProperty("subMenuName", "Polygon Mesh Processing");
-    Polyhedron_demo_plugin_helper::init(mainWindow, scene_interface);
-  }
-
-  bool applicable(QAction*) const {
-    Q_FOREACH(int index, scene->selectionIndices())
-    {
-      if ( qobject_cast<Scene_polyhedron_item*>(scene->item(index)) )
-        return true;
-    }
-    return false;
-  }
-
-public Q_SLOTS:
-  void on_actionDetectBorders_triggered();
-  void on_actionStitchBorders_triggered();
-
-}; // end Polyhedron_demo_polyhedron_stitching_plugin
-
-
-
-struct Polyline_visitor
-{
-  Scene_polylines_item* new_item;
-
-  Polyline_visitor(Scene_polylines_item* new_item)
-    : new_item(new_item)
-  {}
-
-  void start_new_polyline()
-  {
-    new_item->polylines.push_back( Scene_polylines_item::Polyline() );
-  }
-
-  void add_node(boost::graph_traits<Polyhedron>::vertex_descriptor vd)
-  {
-    new_item->polylines.back().push_back(vd->point());
-  }
-  void end_polyline(){}
-};
-
-void Polyhedron_demo_polyhedron_stitching_plugin::on_actionDetectBorders_triggered()
-{
-  Q_FOREACH(int index, scene->selectionIndices())
-  {
-    Scene_polyhedron_item* item =
-      qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-
-    if(item)
-    {
-      Scene_polylines_item* new_item = new Scene_polylines_item();
-
-      Polyhedron* pMesh = item->polyhedron();
-      pMesh->normalize_border();
-
-#if 0
-      for (Polyhedron::Halfedge_iterator
-              it=pMesh->border_halfedges_begin(), it_end=pMesh->halfedges_end();
-              it!=it_end; ++it)
-      {
-        if (!it->is_border()) continue;
-        /// \todo build cycles and graph with nodes of valence 2.
-        new_item->polylines.push_back( Scene_polylines_item::Polyline() );
-        new_item->polylines.back().push_back( it->opposite()->vertex()->point() );
-        new_item->polylines.back().push_back( it->vertex()->point() );
-      }
-#else
-      typedef boost::filtered_graph<Polyhedron,Is_border<Polyhedron>, Is_border<Polyhedron> > BorderGraph;
-      
-      Is_border<Polyhedron> ib(*pMesh);
-      BorderGraph bg(*pMesh,ib,ib);
-      Polyline_visitor polyline_visitor(new_item); 
-      CGAL::split_graph_into_polylines( bg,
-                                        polyline_visitor,
-                                        CGAL::internal::IsTerminalDefault() );
-#endif
-      
-      if (new_item->polylines.empty())
-      {
-        delete new_item;
-      }
-      else
-      {
-        new_item->setName(tr("Boundary of %1").arg(item->name()));
-        new_item->setColor(Qt::red);
-        scene->addItem(new_item);
-        new_item->invalidateOpenGLBuffers();
-      }
-    }
-  }
-}
-
-void Polyhedron_demo_polyhedron_stitching_plugin::on_actionStitchBorders_triggered()
-{
-  Q_FOREACH(int index, scene->selectionIndices())
-  {
-    Scene_polyhedron_item* item =
-      qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-
-    if(item)
-    {
-      Polyhedron* pMesh = item->polyhedron();
-      CGAL::Polygon_mesh_processing::stitch_borders(*pMesh);
-      item->invalidateOpenGLBuffers();
-      scene->itemChanged(item);
-    }
-  }
-}
-
-#include "Polyhedron_stitching_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Repair_polyhedron_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Repair_polyhedron_plugin.cpp
deleted file mode 100644
index 21154f1..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Repair_polyhedron_plugin.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-#include <QtCore/qglobal.h>
-
-#include "Scene_polyhedron_item.h"
-#include <CGAL/Three/Scene_interface.h>
-#include "Polyhedron_type.h"
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include "Messages_interface.h"
-#include <CGAL/gl.h>
-
-#include <QAction>
-#include <QMainWindow>
-#include <QObject>
-
-#include <CGAL/Polygon_mesh_processing/repair.h>
-#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
-
-using namespace CGAL::Three;
-class Polyhedron_demo_repair_polyhedron_plugin :
-        public QObject,
-        public Polyhedron_demo_plugin_helper
-{
-    Q_OBJECT
-    Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-    Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-public:
-  // To silent a warning -Woverloaded-virtual
-  // See http://stackoverflow.com/questions/9995421/gcc-woverloaded-virtual-warnings
-  using Polyhedron_demo_plugin_helper::init;
-
-  void init(QMainWindow* mainWindow,
-            Scene_interface* scene_interface,
-            Messages_interface* m)
-  {
-    this->scene = scene_interface;
-    this->mw = mainWindow;
-    this->messages = m;
-
-    actionRemoveIsolatedVertices = new QAction(tr("Remove Isolated Vertices"), mw);
-    if (actionRemoveIsolatedVertices){
-      connect(actionRemoveIsolatedVertices, SIGNAL(triggered()),
-              this, SLOT(on_actionRemoveIsolatedVertices_triggered()));
-    }
-
-    actionRemoveDegenerateFaces = new QAction(tr("Remove Degenerate Faces"), mw);
-    if (actionRemoveDegenerateFaces){
-      connect(actionRemoveDegenerateFaces, SIGNAL(triggered()),
-        this, SLOT(on_actionRemoveDegenerateFaces_triggered()));
-    }
-  }
-
-  QList<QAction*> actions() const
-  {
-    return QList<QAction*>() << actionRemoveIsolatedVertices
-      << actionRemoveDegenerateFaces;
-  }
-
-  bool applicable(QAction*) const
-  {
-    int item_id = scene->mainSelectionIndex();
-    return qobject_cast<Scene_polyhedron_item*>(
-      scene->item(item_id));
-  }
-
-public Q_SLOTS:
-  void on_actionRemoveIsolatedVertices_triggered();
-  void on_actionRemoveDegenerateFaces_triggered();
-
-private:
-  QAction* actionRemoveIsolatedVertices;
-  QAction* actionRemoveDegenerateFaces;
-
-  Messages_interface* messages;
-}; // end Polyhedron_demo_repair_polyhedron_plugin
-
-
-void Polyhedron_demo_repair_polyhedron_plugin::on_actionRemoveIsolatedVertices_triggered()
-{
-  const Scene_interface::Item_id index = scene->mainSelectionIndex();
-
-  Scene_polyhedron_item* poly_item =
-    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-  if (poly_item)
-  {
-    std::size_t nbv =
-      CGAL::Polygon_mesh_processing::remove_isolated_vertices(
-        *poly_item->polyhedron());
-    messages->information(tr(" %1 isolated vertices have been removed.")
-      .arg(nbv));
-    poly_item->invalidateOpenGLBuffers();
-    Q_EMIT poly_item->itemChanged();
-  }
-}
-
-void Polyhedron_demo_repair_polyhedron_plugin::on_actionRemoveDegenerateFaces_triggered()
-{
-  const Scene_interface::Item_id index = scene->mainSelectionIndex();
-
-  Scene_polyhedron_item* poly_item =
-    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-  if (poly_item)
-  {
-    std::size_t nbv =
-      CGAL::Polygon_mesh_processing::remove_degenerate_faces(
-      *poly_item->polyhedron());
-    messages->information(tr(" %1 degenerate faces have been removed.")
-      .arg(nbv));
-    poly_item->invalidateOpenGLBuffers();
-    Q_EMIT poly_item->itemChanged();
-  }
-}
-
-
-#include "Repair_polyhedron_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Selection_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Selection_plugin.cpp
deleted file mode 100644
index f9b7212..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Selection_plugin.cpp
+++ /dev/null
@@ -1,418 +0,0 @@
-#include <QtCore/qglobal.h>
-#include "opengl_tools.h"
-
-#include "Messages_interface.h"
-#include "Scene_polyhedron_item.h"
-#include "Scene_polyhedron_selection_item.h"
-#include "Scene_points_with_normal_item.h"
-#include "Scene_polylines_item.h"
-
-#include <CGAL/Three/Scene_interface.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include "ui_Selection_widget.h"
-
-#include <QAction>
-#include <QMainWindow>
-#include <QApplication>
-
-#include <map>
-
-#include <boost/graph/adjacency_list.hpp>
-#include <CGAL/boost/graph/split_graph_into_polylines.h>
-
-struct Is_terminal
-{
-  template <typename VertexDescriptor, typename Graph>
-  bool operator ()(VertexDescriptor , const Graph& )
-  {
-    return false; // degree(vd,g) != 2; is a bad test in case of parallel edges
-  }
-};
-
-
-template <typename Graph>
-struct Polyline_visitor
-{
-  Scene_polylines_item* item;
-  const Graph& points_pmap;
-
-  Polyline_visitor(Scene_polylines_item* item_,
-                   const Graph& points_property_map)
-    : item(item_),
-      points_pmap(points_property_map)
-  {}
-
-  void start_new_polyline()
-  {
-    item->polylines.push_back( Scene_polylines_item::Polyline() );
-  }
-
-  void add_node(typename boost::graph_traits<Graph>::vertex_descriptor vd)
-  {
-    item->polylines.back().push_back(points_pmap[vd]);
-  }
-  void end_polyline(){}
-};
-using namespace CGAL::Three;
-class Polyhedron_demo_selection_plugin :
-  public QObject,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-    Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-    Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-public:
-  bool applicable(QAction*) const { 
-    return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()))
-        || qobject_cast<Scene_polyhedron_selection_item*>(scene->item(scene->mainSelectionIndex())); 
-  }
-  void print_message(QString message) { messages->information(message); }
-  QList<QAction*> actions() const { return QList<QAction*>() << actionSelection; }
-  using Polyhedron_demo_plugin_helper::init;
-  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface* m) {
-    mw = mainWindow;
-    scene = scene_interface;
-    messages = m;
-    actionSelection = new QAction(tr("Selection"), mw);
-    connect(actionSelection, SIGNAL(triggered()), this, SLOT(selection_action()));
-
-    dock_widget = new QDockWidget("Selection", mw);
-    dock_widget->setVisible(false);
-
-    ui_widget.setupUi(dock_widget);
-    add_dock_widget(dock_widget);
-
-    connect(ui_widget.Select_all_button,  SIGNAL(clicked()), this, SLOT(on_Select_all_button_clicked()));
-    connect(ui_widget.Clear_button,  SIGNAL(clicked()), this, SLOT(on_Clear_button_clicked()));
-    connect(ui_widget.Select_isolated_components_button,  SIGNAL(clicked()), this, SLOT(on_Select_isolated_components_button_clicked()));
-    connect(ui_widget.Get_minimum_button,  SIGNAL(clicked()), this, SLOT(on_Get_minimum_button_clicked()));
-    connect(ui_widget.Create_selection_item_button,  SIGNAL(clicked()), this, SLOT(on_Create_selection_item_button_clicked()));    
-    connect(ui_widget.Selection_type_combo_box, SIGNAL(currentIndexChanged(int)), 
-            this, SLOT(on_Selection_type_combo_box_changed(int)));
-    connect(ui_widget.Insertion_radio_button, SIGNAL(toggled(bool)), this, SLOT(on_Insertion_radio_button_toggled(bool)));
-    connect(ui_widget.Brush_size_spin_box, SIGNAL(valueChanged(int)), this, SLOT(on_Brush_size_spin_box_changed(int)));
-    connect(ui_widget.Create_point_set_item_button, SIGNAL(clicked()), this, SLOT(on_Create_point_set_item_button_clicked()));
-    connect(ui_widget.Create_polyline_item_button, SIGNAL(clicked()), this, SLOT(on_Create_polyline_item_button_clicked()));
-    connect(ui_widget.Erase_selected_facets_button, SIGNAL(clicked()), this, SLOT(on_Erase_selected_facets_button_clicked()));
-    connect(ui_widget.Keep_connected_components_button, SIGNAL(clicked()), this, SLOT(on_Keep_connected_components_button_clicked()));
-    connect(ui_widget.Expand_reduce_button, SIGNAL(clicked()), this, SLOT(on_Expand_reduce_button_clicked()));
-    connect(ui_widget.Create_polyhedron_item_button, SIGNAL(clicked()), this, SLOT(on_Create_polyhedron_item_button_clicked()));
-    connect(ui_widget.Select_sharp_edges_button, SIGNAL(clicked()), this, SLOT(on_Select_sharp_edges_button_clicked()));
-
-    QObject* scene = dynamic_cast<QObject*>(scene_interface);
-    if(scene) { 
-      connect(scene, SIGNAL(itemAboutToBeDestroyed(CGAL::Three::Scene_item*)), this, SLOT(item_about_to_be_destroyed(CGAL::Three::Scene_item*)));
-      connect(scene, SIGNAL(newItem(int)), this, SLOT(new_item_created(int)));
-    } 
-  }
-  virtual void closure()
-  {
-    dock_widget->hide();
-  }
-public Q_SLOTS:
-  void selection_action() { 
-    dock_widget->show();
-    dock_widget->raise();
-    if(scene->numberOfEntries() < 2) {
-      Scene_polyhedron_item* poly_item = get_selected_item<Scene_polyhedron_item>();
-      if(!poly_item || selection_item_map.find(poly_item) != selection_item_map.end()) { return; }
-      Scene_polyhedron_selection_item* new_item = new Scene_polyhedron_selection_item(poly_item, mw);
-      int item_id = scene->addItem(new_item);
-      QObject* scene_ptr = dynamic_cast<QObject*>(scene);
-      if (scene_ptr)
-        connect(new_item,SIGNAL(simplicesSelected(CGAL::Three::Scene_item*)), scene_ptr, SLOT(setSelectedItem(CGAL::Three::Scene_item*)));
-      scene->setSelectedItem(item_id);
-    }
-  }
-  // Select all
-  void on_Select_all_button_clicked() {
-    Scene_polyhedron_selection_item* selection_item = get_selected_item<Scene_polyhedron_selection_item>();
-    if(!selection_item) {
-      print_message("Error: there is no selected polyhedron selection item!");
-      return; 
-    }
-
-    selection_item->select_all();
-  }
-  // Clear selection
-  void on_Clear_button_clicked() {
-    Scene_polyhedron_selection_item* selection_item = get_selected_item<Scene_polyhedron_selection_item>();
-    if(!selection_item) {
-      print_message("Error: there is no selected polyhedron selection item!");
-      return; 
-    }
-
-    selection_item->clear();
-  }
-  // Isolated component related functions
-  void on_Select_isolated_components_button_clicked() {
-    Scene_polyhedron_selection_item* selection_item = get_selected_item<Scene_polyhedron_selection_item>();
-    if(!selection_item) {
-      print_message("Error: there is no selected polyhedron selection item!");
-      return; 
-    }
-
-    boost::optional<std::size_t> minimum =
-      selection_item->select_isolated_components(ui_widget.Threshold_size_spin_box->value());
-    if(minimum) {
-      ui_widget.Threshold_size_spin_box->setValue((int) *minimum);
-    }
-  }
-  void on_Get_minimum_button_clicked() {
-    Scene_polyhedron_selection_item* selection_item = get_selected_item<Scene_polyhedron_selection_item>();
-    if(!selection_item) {
-      print_message("Error: there is no selected polyhedron selection item!");
-      return; 
-    }
-    boost::optional<std::size_t> minimum = selection_item->get_minimum_isolated_component();
-    if(minimum) {
-      ui_widget.Threshold_size_spin_box->setValue((int) *minimum);
-    }
-  }
-  // Create selection item for selected polyhedron item
-  void on_Create_selection_item_button_clicked() {
-    Scene_polyhedron_item* poly_item = get_selected_item<Scene_polyhedron_item>();
-    if(!poly_item) {
-      print_message("Error: there is no selected polyhedron item!");
-      return; 
-    }
-    // all other arrangements (putting inside selection_item_map), setting names etc,
-    // other params (e.g. k_ring) will be set inside new_item_created
-    Scene_polyhedron_selection_item* new_item = new Scene_polyhedron_selection_item(poly_item, mw);
-    int item_id = scene->addItem(new_item);
-    QObject* scene_ptr = dynamic_cast<QObject*>(scene);
-    if (scene_ptr)
-      connect(new_item,SIGNAL(simplicesSelected(CGAL::Three::Scene_item*)), scene_ptr, SLOT(setSelectedItem(CGAL::Three::Scene_item*)));
-    scene->setSelectedItem(item_id);
-  }
-  void on_Selection_type_combo_box_changed(int index) {
-    typedef Scene_polyhedron_selection_item::Active_handle Active_handle;
-    for(Selection_item_map::iterator it = selection_item_map.begin(); it != selection_item_map.end(); ++it) {
-      it->second->set_active_handle_type(static_cast<Active_handle::Type>(index));
-    }
-  }
-  void on_Insertion_radio_button_toggled(bool toggle){
-    for(Selection_item_map::iterator it = selection_item_map.begin(); it != selection_item_map.end(); ++it) {
-      it->second->set_is_insert(toggle);
-    }
-  }
-  void on_Brush_size_spin_box_changed(int value) {
-    for(Selection_item_map::iterator it = selection_item_map.begin(); it != selection_item_map.end(); ++it) {
-      it->second->set_k_ring(value);
-    }
-  }
-
-  void on_Create_point_set_item_button_clicked() {
-    Scene_polyhedron_selection_item* selection_item = get_selected_item<Scene_polyhedron_selection_item>();
-    if(!selection_item) {
-      print_message("Error: there is no selected polyhedron selection item!");
-      return; 
-    }
-    if(selection_item->selected_vertices.empty()) {
-      print_message("Error: there is no selected vertex in polyhedron selection item!");
-      return;
-    }
-    Scene_points_with_normal_item* point_item = new Scene_points_with_normal_item();
-    point_item->setName(QString("%1-points").arg(selection_item->name()));
-    for(Scene_polyhedron_selection_item::Selection_set_vertex::iterator begin = selection_item->selected_vertices.begin(); 
-       begin != selection_item->selected_vertices.end(); ++begin) {
-       point_item->point_set()->push_back((*begin)->point());
-    }
-    scene->setSelectedItem( scene->addItem(point_item) );
-    scene->itemChanged(point_item);
-  }
-
-  void on_Create_polyline_item_button_clicked(){
-    Scene_polyhedron_selection_item* selection_item = get_selected_item<Scene_polyhedron_selection_item>();
-    if(!selection_item) {
-      print_message("Error: there is no selected polyhedron selection item!");
-      return;
-    }
-    if(selection_item->selected_edges.empty()) {
-      print_message("Error: there is no selected edge in polyhedron selection item!");
-      return;
-    }
-    Scene_polylines_item* polyline_item = new Scene_polylines_item();
-    polyline_item->setName(QString("%1-edges").arg(selection_item->name()));
-
-    typedef boost::adjacency_list < boost::listS,
-                                    boost::vecS,
-                                    boost::undirectedS,
-                                    Kernel::Point_3 > Edge_graph;
-    typedef Polyhedron::Vertex_handle Vertex_handle;
-    Edge_graph edge_graph;
-    std::map<Vertex_handle, Edge_graph::vertex_descriptor> p2vd;
-    std::map<Vertex_handle, Edge_graph::vertex_descriptor>::iterator it_find;
-    bool insert_OK;
-
-    for(Scene_polyhedron_selection_item::Selection_set_edge::iterator begin = selection_item->selected_edges.begin();
-       begin != selection_item->selected_edges.end(); ++begin)
-    {
-      Vertex_handle source = begin->halfedge()->opposite()->vertex();
-      boost::tie(it_find, insert_OK)
-        = p2vd.insert(std::make_pair(source, Edge_graph::vertex_descriptor()));
-      if (insert_OK)
-      {
-        it_find->second = add_vertex(edge_graph);
-        edge_graph[it_find->second] = source->point();
-      }
-      Edge_graph::vertex_descriptor src=it_find->second;
-
-      Vertex_handle target = begin->halfedge()->vertex();
-      boost::tie(it_find, insert_OK)
-        = p2vd.insert(std::make_pair(target, Edge_graph::vertex_descriptor()));
-      if (insert_OK)
-      {
-        it_find->second = add_vertex(edge_graph);
-        edge_graph[it_find->second] = target->point();
-      }
-      Edge_graph::vertex_descriptor tgt=it_find->second;
-      boost::add_edge(src, tgt, edge_graph);
-    }
-
-    Polyline_visitor<Edge_graph> polyline_visitor(polyline_item, edge_graph);
-    CGAL::split_graph_into_polylines( edge_graph,
-                                      polyline_visitor,
-                                      Is_terminal() );
-    scene->setSelectedItem( scene->addItem(polyline_item) );
-    scene->itemChanged(polyline_item);
-  }
-
-  void on_Erase_selected_facets_button_clicked() {
-    Scene_polyhedron_selection_item* selection_item = get_selected_item<Scene_polyhedron_selection_item>();
-    if(!selection_item) {
-      print_message("Error: there is no selected polyhedron selection item!");
-      return; 
-    }
-
-    selection_item->erase_selected_facets();
-  }
-  void on_Keep_connected_components_button_clicked() {
-    Scene_polyhedron_selection_item* selection_item = get_selected_item<Scene_polyhedron_selection_item>();
-    if (!selection_item) {
-      print_message("Error: there is no selected polyhedron selection item!");
-      return;
-    }
-    selection_item->keep_connected_components();
-  }
-  void on_Create_polyhedron_item_button_clicked() {
-    Scene_polyhedron_selection_item* selection_item = get_selected_item<Scene_polyhedron_selection_item>();
-    if(!selection_item) {
-      print_message("Error: there is no selected polyhedron selection item!");
-      return; 
-    }
-
-    Scene_polyhedron_item* poly_item = new Scene_polyhedron_item();
-    if(selection_item->export_selected_facets_as_polyhedron(poly_item->polyhedron())) {
-      poly_item->setName(QString("%1-facets").arg(selection_item->name()));
-      poly_item->invalidateOpenGLBuffers(); // for init()
-      scene->setSelectedItem( scene->addItem(poly_item) );
-      scene->itemChanged(poly_item);
-    }
-    else {
-      delete poly_item;
-      print_message("Error: polyhedron item is not created!");
-    }
-  }
-
-  void on_Select_sharp_edges_button_clicked() {
-    Scene_polyhedron_selection_item* selection_item = get_selected_item<Scene_polyhedron_selection_item>();
-    if (!selection_item) {
-      print_message("Error: there is no selected polyhedron selection item!");
-      return;
-    }
-
-    double angle = ui_widget.Sharp_angle_spinbox->value();
-    selection_item->select_sharp_edges(angle);
-    scene->itemChanged(selection_item);
-  }
-
-  void on_Expand_reduce_button_clicked() {
-    Scene_polyhedron_selection_item* selection_item = get_selected_item<Scene_polyhedron_selection_item>();
-    if(!selection_item) {
-      print_message("Error: there is no selected polyhedron selection item!");
-      return; 
-    }
-
-    int steps = ui_widget.Expand_reduce_spin_box->value();
-    selection_item->expand_or_reduce(steps);
-  }
-  // To handle empty selection items coming from loader
-  void new_item_created(int item_id) {
-    typedef Scene_polyhedron_selection_item::Active_handle Active_handle;
-    Scene_polyhedron_selection_item* selection_item = 
-      qobject_cast<Scene_polyhedron_selection_item*>(scene->item(item_id));
-    if(!selection_item) { return; }
-
-    Scene_polyhedron_item* poly_item = get_selected_item<Scene_polyhedron_item>();
-    if(!poly_item) {
-      CGAL_assertion(selection_item->polyhedron_item() == NULL); // which means it is coming from selection_io loader
-      print_message("Error: please select corresponding polyhedron item from Geometric Objects list.");
-      scene->erase(item_id);
-      return;
-    }
-
-    if(selection_item->polyhedron_item() == NULL) { //coming from selection_io loader
-      if(!selection_item->actual_load(poly_item, mw)) {
-        print_message("Error: loading selection item is not successful!");
-        scene->erase(item_id);
-        return;
-      }
-      selection_item->invalidateOpenGLBuffers();
-      scene->itemChanged(selection_item);
-    }
-    // now set default params both for selection items coming from selection_io, or on_Create_selection_item_button_clicked
-    Active_handle::Type aht = static_cast<Active_handle::Type>(ui_widget.Selection_type_combo_box->currentIndex());
-    bool is_insert = ui_widget.Insertion_radio_button->isChecked();
-    int k_ring = ui_widget.Brush_size_spin_box->value();
-
-    selection_item->set_active_handle_type(aht);
-    selection_item->set_is_insert(is_insert);
-    selection_item->set_k_ring(k_ring);
-    selection_item->setRenderingMode(Flat);
-    if(selection_item->name() == "unamed") {
-      selection_item->setName(tr("%1 (selection)").arg(poly_item->name()));
-    }
-
-    selection_item_map.insert(std::make_pair(poly_item, selection_item));
-  }
-  void item_about_to_be_destroyed(CGAL::Three::Scene_item* scene_item) {
-    // if polyhedron item
-    Scene_polyhedron_item* poly_item = qobject_cast<Scene_polyhedron_item*>(scene_item);
-    if(poly_item) {
-      std::pair<Selection_item_map::iterator, Selection_item_map::iterator> res =
-        selection_item_map.equal_range(poly_item);
-
-      for(Selection_item_map::iterator begin = res.first; begin != res.second; ) {
-        Scene_polyhedron_selection_item* selection_item = begin->second;
-        selection_item_map.erase(begin++); // first erase from map, because scene->erase will cause a call to this function
-        scene->erase( scene->item_id(selection_item) );
-      }
-    }
-    // if polyhedron selection item
-    Scene_polyhedron_selection_item* selection_item = qobject_cast<Scene_polyhedron_selection_item*>(scene_item);
-    if(selection_item) {
-      Scene_polyhedron_item* poly_item = selection_item->polyhedron_item();
-      std::pair<Selection_item_map::iterator, Selection_item_map::iterator> res =
-        selection_item_map.equal_range(poly_item);
-      for(Selection_item_map::iterator begin = res.first; begin != res.second; ++begin) {
-        if(begin->second == selection_item) {
-          selection_item_map.erase(begin); break;
-        }
-      }
-    }
-  }
-
-private:
-  Messages_interface* messages;
-  QAction* actionSelection;
-
-  QDockWidget* dock_widget;
-  Ui::Selection ui_widget;
-typedef std::multimap<Scene_polyhedron_item*, Scene_polyhedron_selection_item*> Selection_item_map;
-  Selection_item_map selection_item_map;
-}; // end Polyhedron_demo_selection_plugin
-
-//Q_EXPORT_PLUGIN2(Polyhedron_demo_selection_plugin, Polyhedron_demo_selection_plugin)
-
-#include "Selection_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Selection_widget.ui b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Selection_widget.ui
deleted file mode 100644
index 897cbc8..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Selection_widget.ui
+++ /dev/null
@@ -1,369 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>Selection</class>
- <widget class="QDockWidget" name="Selection">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>455</width>
-    <height>684</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Selection</string>
-  </property>
-  <widget class="QWidget" name="dockWidgetContents">
-   <layout class="QVBoxLayout" name="verticalLayout">
-    <item>
-     <layout class="QVBoxLayout" name="verticalLayout_3">
-      <item>
-       <layout class="QHBoxLayout" name="horizontalLayout_4">
-        <item>
-         <widget class="QLabel" name="label_2">
-          <property name="text">
-           <string>Selection &Type:</string>
-          </property>
-          <property name="buddy">
-           <cstring>Selection_type_combo_box</cstring>
-          </property>
-         </widget>
-        </item>
-        <item>
-         <widget class="QComboBox" name="Selection_type_combo_box">
-          <item>
-           <property name="text">
-            <string>Vertex</string>
-           </property>
-          </item>
-          <item>
-           <property name="text">
-            <string>Facet</string>
-           </property>
-          </item>
-          <item>
-           <property name="text">
-            <string>Edge</string>
-           </property>
-          </item>
-          <item>
-           <property name="text">
-            <string>Connected component (facet)</string>
-           </property>
-          </item>
-         </widget>
-        </item>
-       </layout>
-      </item>
-     </layout>
-    </item>
-    <item>
-     <spacer name="verticalSpacer_4">
-      <property name="orientation">
-       <enum>Qt::Vertical</enum>
-      </property>
-      <property name="sizeHint" stdset="0">
-       <size>
-        <width>20</width>
-        <height>40</height>
-       </size>
-      </property>
-     </spacer>
-    </item>
-    <item>
-     <layout class="QVBoxLayout" name="verticalLayout_2">
-      <item>
-       <layout class="QHBoxLayout" name="horizontalLayout_2">
-        <item>
-         <layout class="QHBoxLayout" name="horizontalLayout">
-          <item>
-           <widget class="QRadioButton" name="Insertion_radio_button">
-            <property name="text">
-             <string>Insertion</string>
-            </property>
-            <property name="checked">
-             <bool>true</bool>
-            </property>
-           </widget>
-          </item>
-          <item>
-           <widget class="QRadioButton" name="Removal_radio_button">
-            <property name="text">
-             <string>Removal</string>
-            </property>
-           </widget>
-          </item>
-         </layout>
-        </item>
-        <item>
-         <layout class="QVBoxLayout" name="verticalLayout_7">
-          <item>
-           <layout class="QHBoxLayout" name="horizontalLayout_6">
-            <item>
-             <widget class="QLabel" name="label">
-              <property name="text">
-               <string>Brush &size:</string>
-              </property>
-              <property name="buddy">
-               <cstring>Brush_size_spin_box</cstring>
-              </property>
-             </widget>
-            </item>
-            <item>
-             <widget class="QSpinBox" name="Brush_size_spin_box"/>
-            </item>
-           </layout>
-          </item>
-         </layout>
-        </item>
-       </layout>
-      </item>
-      <item>
-       <layout class="QHBoxLayout" name="horizontalLayout_3">
-        <item>
-         <widget class="QPushButton" name="Select_all_button">
-          <property name="text">
-           <string>Select &All</string>
-          </property>
-         </widget>
-        </item>
-        <item>
-         <widget class="QPushButton" name="Clear_button">
-          <property name="text">
-           <string>&Clear</string>
-          </property>
-         </widget>
-        </item>
-       </layout>
-      </item>
-     </layout>
-    </item>
-    <item>
-     <spacer name="verticalSpacer_2">
-      <property name="orientation">
-       <enum>Qt::Vertical</enum>
-      </property>
-      <property name="sizeHint" stdset="0">
-       <size>
-        <width>20</width>
-        <height>40</height>
-       </size>
-      </property>
-     </spacer>
-    </item>
-    <item>
-     <layout class="QVBoxLayout" name="verticalLayout_4">
-      <item>
-       <layout class="QHBoxLayout" name="horizontalLayout_5">
-        <item>
-         <widget class="QLabel" name="label_3">
-          <property name="text">
-           <string>Isolated &Component Size:</string>
-          </property>
-          <property name="buddy">
-           <cstring>Threshold_size_spin_box</cstring>
-          </property>
-         </widget>
-        </item>
-        <item>
-         <widget class="QSpinBox" name="Threshold_size_spin_box">
-          <property name="maximum">
-           <number>999999999</number>
-          </property>
-          <property name="value">
-           <number>8</number>
-          </property>
-         </widget>
-        </item>
-        <item>
-         <widget class="QPushButton" name="Get_minimum_button">
-          <property name="text">
-           <string>&Get Minimum</string>
-          </property>
-         </widget>
-        </item>
-       </layout>
-      </item>
-      <item>
-       <widget class="QPushButton" name="Select_isolated_components_button">
-        <property name="text">
-         <string>Select &Isolated Components Below Threshold</string>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </item>
-    <item>
-     <spacer name="verticalSpacer_3">
-      <property name="orientation">
-       <enum>Qt::Vertical</enum>
-      </property>
-      <property name="sizeHint" stdset="0">
-       <size>
-        <width>20</width>
-        <height>40</height>
-       </size>
-      </property>
-     </spacer>
-    </item>
-    <item>
-     <layout class="QHBoxLayout" name="horizontalLayout_7">
-      <item>
-       <widget class="QLabel" name="label_6">
-        <property name="text">
-         <string>Sharp edges angle:</string>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QSpinBox" name="Sharp_angle_spinbox">
-        <property name="sizePolicy">
-         <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
-        </property>
-        <property name="maximum">
-         <number>180</number>
-        </property>
-        <property name="value">
-         <number>60</number>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QPushButton" name="Select_sharp_edges_button">
-        <property name="text">
-         <string>Select</string>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </item>
-    <item>
-     <spacer name="verticalSpacer_1">
-      <property name="orientation">
-       <enum>Qt::Vertical</enum>
-      </property>
-      <property name="sizeHint" stdset="0">
-       <size>
-        <width>20</width>
-        <height>40</height>
-       </size>
-      </property>
-     </spacer>
-    </item>
-    <item>
-     <layout class="QHBoxLayout" name="horizontalLayout_8">
-      <item>
-       <widget class="QLabel" name="label_5">
-        <property name="text">
-         <string>Expand or reduce selection:</string>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QSpinBox" name="Expand_reduce_spin_box">
-        <property name="minimum">
-         <number>-50</number>
-        </property>
-        <property name="maximum">
-         <number>50</number>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QPushButton" name="Expand_reduce_button">
-        <property name="text">
-         <string>Apply</string>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </item>
-    <item>
-     <spacer name="verticalSpacer_5">
-      <property name="orientation">
-       <enum>Qt::Vertical</enum>
-      </property>
-      <property name="sizeHint" stdset="0">
-       <size>
-        <width>20</width>
-        <height>40</height>
-       </size>
-      </property>
-     </spacer>
-    </item>
-    <item>
-     <widget class="QPushButton" name="Create_point_set_item_button">
-      <property name="text">
-       <string>Create Point Set Item from Selected Vertices</string>
-      </property>
-     </widget>
-    </item>
-    <item>
-     <widget class="QPushButton" name="Create_polyline_item_button">
-      <property name="text">
-       <string>Create Polyline Item from Selected Edges</string>
-      </property>
-     </widget>
-    </item>
-    <item>
-     <widget class="QPushButton" name="Create_polyhedron_item_button">
-      <property name="text">
-       <string>Create Polyhedron Item from Selected Facets</string>
-      </property>
-     </widget>
-    </item>
-    <item>
-     <widget class="QPushButton" name="Erase_selected_facets_button">
-      <property name="text">
-       <string>Erase Selected Facets from Polyhedron Item</string>
-      </property>
-     </widget>
-    </item>
-    <item>
-     <widget class="QPushButton" name="Keep_connected_components_button">
-      <property name="toolTip">
-       <string extracomment="from selected facets"/>
-      </property>
-      <property name="text">
-       <string>Keep connected components of Selected Facets</string>
-      </property>
-     </widget>
-    </item>
-    <item>
-     <spacer name="verticalSpacer">
-      <property name="orientation">
-       <enum>Qt::Vertical</enum>
-      </property>
-      <property name="sizeHint" stdset="0">
-       <size>
-        <width>20</width>
-        <height>40</height>
-       </size>
-      </property>
-     </spacer>
-    </item>
-    <item>
-     <widget class="QPushButton" name="Create_selection_item_button">
-      <property name="font">
-       <font>
-        <weight>75</weight>
-        <bold>true</bold>
-       </font>
-      </property>
-      <property name="text">
-       <string>Create Selection Item</string>
-      </property>
-     </widget>
-    </item>
-   </layout>
-  </widget>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Self_intersection_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Self_intersection_plugin.cpp
deleted file mode 100644
index d548175..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Self_intersection_plugin.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-#include <QApplication>
-#include <QAction>
-#include <QMessageBox>
-#include <QMainWindow>
-#include "opengl_tools.h"
-#include "Kernel_type.h"
-#include "Polyhedron_type.h"
-#include "Scene_polyhedron_item.h"
-#include "Scene_polyhedron_selection_item.h"
-
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-
-#include <CGAL/intersections.h>
-#include <CGAL/Bbox_3.h>
-#include <CGAL/box_intersection_d.h>
-
-#include <CGAL/Polygon_mesh_processing/self_intersections.h>
-#include <CGAL/Make_triangle_soup.h>
-
-typedef Kernel::Triangle_3 Triangle;
-using namespace CGAL::Three;
-class Polyhedron_demo_self_intersection_plugin : 
-  public QObject,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-public:
-  // used by Polyhedron_demo_plugin_helper
-  QStringList actionsNames() const {
-    return QStringList() << "actionSelfIntersection";
-  }
-
-  void init(QMainWindow* mainWindow,
-            Scene_interface* scene_interface)
-  {
-      mw = mainWindow;
-      scene = scene_interface;
-      actions_map["actionSelfIntersection"] = getActionFromMainWindow(mw, "actionSelfIntersection");
-      actions_map["actionSelfIntersection"]->setProperty("subMenuName", "Polygon Mesh Processing");
-      autoConnectActions();
-
-  }
-
-  bool applicable(QAction*) const { 
-    return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
-  }
-
-public Q_SLOTS:
-  void on_actionSelfIntersection_triggered();
-
-}; // end Polyhedron_demo_self_intersection_plugin
-
-void Polyhedron_demo_self_intersection_plugin::on_actionSelfIntersection_triggered()
-{
-  CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-  
-  Scene_polyhedron_item* item = 
-    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-
-  if(item)
-  {
-    Polyhedron* pMesh = item->polyhedron();
-
-    // compute self-intersections
-
-    typedef Polyhedron::Facet_handle Facet_handle;
-    std::vector<std::pair<Facet_handle, Facet_handle> > facets;
-    CGAL::Polygon_mesh_processing::self_intersections
-      (*pMesh, std::back_inserter(facets),
-      CGAL::Polygon_mesh_processing::parameters::vertex_point_map(get(CGAL::vertex_point, *pMesh)));
-
-    std::cout << "ok (" << facets.size() << " triangle pair(s))" << std::endl;
-
-    // add intersecting triangles as a new polyhedron, i.e., a triangle soup.
-    if(!facets.empty())
-    {
-      Scene_polyhedron_selection_item* selection_item = new Scene_polyhedron_selection_item(item, mw);
-      for(std::vector<std::pair<Facet_handle, Facet_handle> >::iterator fb = facets.begin();
-        fb != facets.end(); ++fb) {
-        selection_item->selected_facets.insert(fb->first);
-        selection_item->selected_facets.insert(fb->second);
-      }
-      selection_item->invalidateOpenGLBuffers();
-      selection_item->setName(tr("%1 (selection) (intersecting triangles)").arg(item->name()));
-      item->setRenderingMode(Wireframe);
-      scene->addItem(selection_item);
-      scene->itemChanged(item);
-      scene->itemChanged(selection_item);
-    }
-    else 
-      QMessageBox::information(mw, tr("No self intersection"),
-                               tr("The polyhedron \"%1\" does not self-intersect.").
-                               arg(item->name()));
-  }
-}
-
-#include "Self_intersection_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Triangulate_facets_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Triangulate_facets_plugin.cpp
deleted file mode 100644
index 564824c..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Triangulate_facets_plugin.cpp
+++ /dev/null
@@ -1,144 +0,0 @@
-#include <QApplication>
-#include <QMainWindow>
-#include <QAction>
-#include "Messages_interface.h"
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include "Scene_polyhedron_item.h"
-#include "Polyhedron_type.h"
-
-#include <CGAL/Polygon_mesh_processing/triangulate_faces.h>
-using namespace CGAL::Three;
-class Polyhedron_demo_triangulate_facets_plugin : 
-  public QObject,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-public:
-  // To silent a warning -Woverloaded-virtual
-  // See http://stackoverflow.com/questions/9995421/gcc-woverloaded-virtual-warnings
-  using Polyhedron_demo_plugin_helper::init;
-
-  void init(QMainWindow* mainWindow,
-            CGAL::Three::Scene_interface* scene_interface,
-            Messages_interface* m) {
-    this->scene = scene_interface;
-    this->mw = mainWindow;
-    this->messages = m;
-    actionTriangulateFacets = new QAction("Triangulate Facets", mw);
-    actionTriangulateFacets->setProperty("subMenuName","Polygon Mesh Processing");
-    if(actionTriangulateFacets) {
-      connect(actionTriangulateFacets, SIGNAL(triggered()),
-              this, SLOT(triangulate())); 
-    }
-    actionUnTriangulateFacets = new QAction("Untriangulate Facets", mw);
-    actionUnTriangulateFacets->setProperty("subMenuName","Polygon Mesh Processing");
-    if(actionUnTriangulateFacets) {
-      connect(actionUnTriangulateFacets, SIGNAL(triggered()),
-              this, SLOT(untriangulate())); 
-    }
-  };
-
-  QList<QAction*> actions() const {
-    return QList<QAction*>() << actionTriangulateFacets
-                             << actionUnTriangulateFacets;
-  }
-
-  bool applicable(QAction*) const {
-    Q_FOREACH(CGAL::Three::Scene_interface::Item_id index, scene->selectionIndices()){
-      if ( qobject_cast<Scene_polyhedron_item*>(scene->item(index)) )
-        return true;
-    }
-    return false;
-  }
-
-public Q_SLOTS:
-  void untriangulate() {
-    const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-  
-    Scene_polyhedron_item* item = 
-      qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-
-    if(item)
-    {
-      Polyhedron* pMesh = item->polyhedron();
-      if(!pMesh) return;
-
-      QApplication::setOverrideCursor(Qt::WaitCursor);
-
-      for(Polyhedron::Edge_iterator 
-            eit = pMesh->edges_begin(),
-            end = pMesh->edges_end();
-          eit != end; /*increment is done manually*/)
-      {
-        // std::cerr << (void*)&*eit << std::endl;
-        Polyhedron::Edge_iterator eit_copy = eit++;
-        if(!eit_copy->is_border()) {
-          Polyhedron::Facet_handle fh1 = eit_copy->facet();
-          Polyhedron::Facet_handle fh2 = eit_copy->opposite()->facet();
-          if( fh1 != fh2 &&  
-              !eit_copy->vertex()->is_bivalent() && 
-              !eit_copy->opposite()->vertex()->is_bivalent())
-          {
-            Kernel::Vector_3 v1 =
-              CGAL::Polygon_mesh_processing::compute_face_normal(fh1, *pMesh);
-            Kernel::Vector_3 v2 =
-              CGAL::Polygon_mesh_processing::compute_face_normal(fh2, *pMesh);
-            if(v1 * v2 > 0.99) {
-              // std::cerr << "join\n";
-              // pMesh->is_valid(true);
-              pMesh->join_facet(eit_copy);
-            }
-          }
-        }
-      }
-      CGAL_assertion_code(pMesh->normalize_border());
-      // CGAL_assertion(pMesh->is_valid(true, 3));
-      item->invalidateOpenGLBuffers();
-      scene->itemChanged(item);
-      // default cursor
-      QApplication::restoreOverrideCursor();
-    }
-  }
-
-  void triangulate() {
-    Q_FOREACH(CGAL::Three::Scene_interface::Item_id index, scene->selectionIndices())  {
-
-    Scene_polyhedron_item* item = 
-      qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-
-    if(item)
-    {
-      Polyhedron* pMesh = item->polyhedron();
-      if(!pMesh) continue;
-      if(pMesh->is_pure_triangle()) {
-        messages->warning(tr("The polyhedron \"%1\" is already triangulated.")
-                          .arg(item->name()));
-        continue;
-      }
-
-      QApplication::setOverrideCursor(Qt::WaitCursor);
-
-      CGAL::Polygon_mesh_processing::triangulate_faces(*pMesh);
-
-      CGAL_assertion_code(pMesh->normalize_border());
-      CGAL_assertion(pMesh->is_valid(false, 3));
-
-      item->invalidateOpenGLBuffers();
-      scene->itemChanged(item);
-      // default cursor
-      QApplication::restoreOverrideCursor();
-    } // end of if(item)
-
-    } // end of the loop on the selected items
-  }
-  
-private:
-  QAction* actionTriangulateFacets;
-  QAction* actionUnTriangulateFacets;  
-  Messages_interface* messages;
-};
-
-#include "Triangulate_facets_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/CMakeLists.txt
deleted file mode 100644
index ea76fd9..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/CMakeLists.txt
+++ /dev/null
@@ -1,61 +0,0 @@
-include( polyhedron_demo_macros )
-if(EIGEN3_FOUND)
-  qt5_wrap_ui( surface_reconstructionUI_FILES Surface_reconstruction_plugin.ui)
-  polyhedron_demo_plugin(surface_reconstruction_plugin Surface_reconstruction_plugin Surface_reconstruction_plugin_impl ${surface_reconstructionUI_FILES})
-  target_link_libraries(surface_reconstruction_plugin scene_polygon_soup_item scene_polyhedron_item scene_points_with_normal_item)
-
-  qt5_wrap_ui( point_set_normal_estimationUI_FILES Point_set_normal_estimation_plugin.ui)
-  polyhedron_demo_plugin(point_set_normal_estimation_plugin Point_set_normal_estimation_plugin ${point_set_normal_estimationUI_FILES})
-  target_link_libraries(point_set_normal_estimation_plugin scene_points_with_normal_item)
-
-  qt5_wrap_ui( features_detection_pluginUI_FILES Features_detection_plugin.ui)
-  polyhedron_demo_plugin(features_detection_plugin Features_detection_plugin ${features_detection_pluginUI_FILES})
-  target_link_libraries(features_detection_plugin scene_points_with_normal_item)
-
-  polyhedron_demo_plugin(point_set_smoothing_plugin Point_set_smoothing_plugin)
-  target_link_libraries(point_set_smoothing_plugin scene_points_with_normal_item)
-
-  polyhedron_demo_plugin(point_set_average_spacing_plugin Point_set_average_spacing_plugin)
-  target_link_libraries(point_set_average_spacing_plugin scene_points_with_normal_item)
-
-else(EIGEN3_FOUND)
-  message(STATUS "NOTICE: Eigen 3.1 (or greater) was not found. Surface reconstruction plugin will not be available.")
-  message(STATUS "NOTICE: Eigen 3.1 (or greater) was not found. Normal estimation plugins will not be available.")
-  message(STATUS "NOTICE: Eigen 3.1 (or greater) was not found. Smoothing plugin will not be available.")
-  message(STATUS "NOTICE: Eigen 3.1 (or greater) was not found. Average spacing plugin will not be available.")
-  message(STATUS "NOTICE: Eigen 3.1 (or greater) was not found. Feature detection plugin will not be available.")
-
-endif()
-
-  qt5_wrap_ui(point_set_bilateral_smoothingUI_FILES Point_set_bilateral_smoothing_plugin.ui)
-  polyhedron_demo_plugin(point_set_bilateral_smoothing_plugin Point_set_bilateral_smoothing_plugin ${point_set_bilateral_smoothingUI_FILES})
-  target_link_libraries(point_set_bilateral_smoothing_plugin scene_points_with_normal_item)
-
-  qt5_wrap_ui( ps_outliers_removal_UI_FILES Point_set_outliers_removal_plugin.ui)
-  polyhedron_demo_plugin(point_set_outliers_removal_plugin Point_set_outliers_removal_plugin ${ps_outliers_removal_UI_FILES})
-  target_link_libraries(point_set_outliers_removal_plugin scene_points_with_normal_item)
-
-  qt5_wrap_ui( point_set_selectionUI_FILES Point_set_selection_widget.ui)
-  polyhedron_demo_plugin(point_set_selection_plugin Point_set_selection_plugin ${point_set_selectionUI_FILES})
-  target_link_libraries(point_set_selection_plugin scene_points_with_normal_item scene_polylines_item)
-
-  qt5_wrap_ui(point_set_shape_detectionUI_FILES Point_set_shape_detection_plugin.ui)
-  polyhedron_demo_plugin(point_set_shape_detection_plugin Point_set_shape_detection_plugin ${point_set_shape_detectionUI_FILES})
-  target_link_libraries(point_set_shape_detection_plugin scene_polyhedron_item scene_points_with_normal_item scene_polygon_soup_item)
-
-  qt5_wrap_ui(point_set_simplificationUI_FILES Point_set_simplification_plugin.ui)
-  polyhedron_demo_plugin(point_set_simplification_plugin Point_set_simplification_plugin ${point_set_simplificationUI_FILES})
-  target_link_libraries(point_set_simplification_plugin scene_points_with_normal_item)
-
-
-  qt5_wrap_ui(point_set_upsamplingUI_FILES Point_set_upsampling_plugin.ui)
-  polyhedron_demo_plugin(point_set_upsampling_plugin Point_set_upsampling_plugin ${point_set_upsamplingUI_FILES})
-  target_link_libraries(point_set_upsampling_plugin scene_points_with_normal_item)
-
-  qt5_wrap_ui(point_set_wlopFILES Point_set_wlop_plugin.ui)
-  polyhedron_demo_plugin(point_set_wlop_plugin Point_set_wlop_plugin ${point_set_wlopFILES})
-  target_link_libraries(point_set_wlop_plugin scene_points_with_normal_item)
-
-  polyhedron_demo_plugin(merge_point_sets_plugin Merge_point_sets_plugin)
-  target_link_libraries(merge_point_sets_plugin scene_points_with_normal_item)
-
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Features_detection_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Features_detection_plugin.cpp
deleted file mode 100644
index b8f3fee..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Features_detection_plugin.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-#include <QApplication>
-#include <QMessageBox>
-#include <QMainWindow>
-#include "config.h"
-#include "Scene_points_with_normal_item.h"
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-
-#include <CGAL/vcm_estimate_edges.h>
-
-#include <CGAL/Timer.h>
-
-#include "ui_Features_detection_plugin.h"
-using namespace CGAL::Three;
-class Polyhedron_demo_features_detection_plugin :
-  public QObject,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-    Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0")
-  QAction* actionDetectFeatures;
-public:
-  QList<QAction*> actions() const { return QList<QAction*>() << actionDetectFeatures; }
-  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface)
-  {
-    actionDetectFeatures= new QAction(tr("VCM Features Estimation"), mainWindow);
-    actionDetectFeatures->setObjectName("actionDetectFeatures");
-
-    Polyhedron_demo_plugin_helper::init(mainWindow, scene_interface);
-  }
-
-  bool applicable(QAction*) const {
-    return qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
-  }
-
-public Q_SLOTS:
-  void on_actionDetectFeatures_triggered();
-
-}; // end Polyhedron_demo_features_detection_plugin
-
-class Polyhedron_demo_features_detection_dialog : public QDialog, private Ui::VCMFeaturesDetectionDialog
-{
-  Q_OBJECT
-  public:
-    Polyhedron_demo_features_detection_dialog(QWidget* /*parent*/ = 0)
-    {
-      setupUi(this);
-    }
-
-    float offsetRadius() const { return m_inputOffsetRadius->value(); }
-    float convolveRadius() const { return m_inputConvolveRadius->value(); }
-    float threshold() const { return m_inputFeaturesThreshold->value(); }
-};
-
-void Polyhedron_demo_features_detection_plugin::on_actionDetectFeatures_triggered()
-{
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-
-  Scene_points_with_normal_item* item =
-    qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
-
-  if(item)
-  {
-    // Gets point set
-    Point_set* points = item->point_set();
-    if(points == NULL)
-        return;
-
-    // Gets options
-    Polyhedron_demo_features_detection_dialog dialog;
-    if(!dialog.exec())
-      return;
-
-    typedef CGAL::cpp11::array<double,6> Covariance;
-    std::vector<Covariance> cov;
-
-    std::cerr << "Compute VCM (offset_radius="
-        << dialog.offsetRadius() << " and convolution radius=" << dialog.convolveRadius() << ")...\n";
-
-    CGAL::Timer task_timer; task_timer.start();
-    CGAL::compute_vcm(points->begin(), points->end(),
-                      CGAL::make_identity_property_map(Point_set::value_type()),
-                      cov, dialog.offsetRadius(), dialog.convolveRadius(),
-                      Kernel());
-    task_timer.stop();
-    std::cerr << "done: " << task_timer.time() << " seconds\n";
-
-    Scene_points_with_normal_item* new_item = new Scene_points_with_normal_item();
-    task_timer.reset(); task_timer.start();
-    std::size_t i=0;
-    std::cerr << "Select feature points (threshold=" << dialog.threshold() << ")...\n";
-    BOOST_FOREACH(const Point_set::value_type& p, *points)
-    {
-      if (CGAL::vcm_is_on_feature_edge(cov[i], dialog.threshold()))
-          new_item->point_set()->push_back(p);
-      ++i;
-    }
-    task_timer.stop();
-    std::cerr << "done: " << task_timer.time() << " seconds\n";
-
-    if ( !new_item->point_set()->empty() )
-    {
-      new_item->setName(tr("Features of %1").arg(item->name()));
-      new_item->setColor(Qt::red);
-      scene->addItem(new_item);
-      item->setVisible(false);
-    }
-    else
-      delete new_item;
-  }
-
-}
-
-#include "Features_detection_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Features_detection_plugin.ui b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Features_detection_plugin.ui
deleted file mode 100644
index 1f4d77f..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Features_detection_plugin.ui
+++ /dev/null
@@ -1,133 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>VCMFeaturesDetectionDialog</class>
- <widget class="QDialog" name="VCMFeaturesDetectionDialog">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>318</width>
-    <height>208</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Normal Estimation</string>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout">
-   <item>
-    <layout class="QHBoxLayout" name="horizontalLayout">
-     <item>
-      <widget class="QLabel" name="label">
-       <property name="text">
-        <string>Offset Radius:</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QDoubleSpinBox" name="m_inputOffsetRadius">
-       <property name="decimals">
-        <number>3</number>
-       </property>
-       <property name="singleStep">
-        <double>0.050000000000000</double>
-       </property>
-       <property name="value">
-        <double>0.100000000000000</double>
-       </property>
-      </widget>
-     </item>
-    </layout>
-   </item>
-   <item>
-    <layout class="QHBoxLayout" name="horizontalLayout_3">
-     <item>
-      <widget class="QLabel" name="label_2">
-       <property name="text">
-        <string>Convolution Radius:</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QDoubleSpinBox" name="m_inputConvolveRadius">
-       <property name="decimals">
-        <number>3</number>
-       </property>
-       <property name="singleStep">
-        <double>0.050000000000000</double>
-       </property>
-      </widget>
-     </item>
-    </layout>
-   </item>
-   <item>
-    <layout class="QHBoxLayout" name="horizontalLayout_2">
-     <item>
-      <widget class="QLabel" name="label_3">
-       <property name="text">
-        <string>Threshold:</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QDoubleSpinBox" name="m_inputFeaturesThreshold">
-       <property name="decimals">
-        <number>3</number>
-       </property>
-       <property name="singleStep">
-        <double>0.020000000000000</double>
-       </property>
-       <property name="value">
-        <double>0.160000000000000</double>
-       </property>
-      </widget>
-     </item>
-    </layout>
-   </item>
-   <item>
-    <widget class="QDialogButtonBox" name="buttonBox">
-     <property name="orientation">
-      <enum>Qt::Horizontal</enum>
-     </property>
-     <property name="standardButtons">
-      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
-     </property>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <resources/>
- <connections>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>accepted()</signal>
-   <receiver>VCMFeaturesDetectionDialog</receiver>
-   <slot>accept()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>248</x>
-     <y>254</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>157</x>
-     <y>274</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>rejected()</signal>
-   <receiver>VCMFeaturesDetectionDialog</receiver>
-   <slot>reject()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>316</x>
-     <y>260</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>286</x>
-     <y>274</y>
-    </hint>
-   </hints>
-  </connection>
- </connections>
-</ui>
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Merge_point_sets_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Merge_point_sets_plugin.cpp
deleted file mode 100644
index 3425b90..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Merge_point_sets_plugin.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-#include "config.h"
-#include "Scene_points_with_normal_item.h"
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-
-#include <QObject>
-#include <QAction>
-#include <QMainWindow>
-#include <QApplication>
-#include <QtPlugin>
-#include <QInputDialog>
-#include <QMessageBox>
-
-
-using namespace CGAL::Three;
-class Polyhedron_demo_merge_point_sets_plugin :
-  public QObject,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-private:
-  QAction* actionMergePointSets;
-  
-public:
-  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface) {
-    actionMergePointSets = new QAction(tr("Merge"), mainWindow);
-    actionMergePointSets->setObjectName("actionMergePointSets");
-
-    Polyhedron_demo_plugin_helper::init(mainWindow, scene_interface);
-  }
-
-  QList<QAction*> actions() const {
-    return QList<QAction*>() << actionMergePointSets;
-  }
-  
-  bool applicable(QAction*) const {
-    if (scene->selectionIndices().size() < 2)
-      return false;
-    
-    Q_FOREACH(int index, scene->selectionIndices())
-      {
-        if ( qobject_cast<Scene_points_with_normal_item*>(scene->item(index)) )
-          return true;
-      }
-    return false;
-  }
-
-public Q_SLOTS:
-  void on_actionMergePointSets_triggered();
-}; // end Polyhedron_demo_merge_point_sets_plugin
-
-void Polyhedron_demo_merge_point_sets_plugin::on_actionMergePointSets_triggered()
-{
-  CGAL::Three::Scene_interface::Item_id mainSelectionIndex
-    = scene->mainSelectionIndex();
-  Scene_points_with_normal_item* mainSelectionItem
-    = qobject_cast<Scene_points_with_normal_item*>(scene->item(mainSelectionIndex));
-
-  QList<int> indices_to_remove;
-  Q_FOREACH(int index, scene->selectionIndices())
-    {
-      if (index == mainSelectionIndex)
-        continue;
-
-      Scene_points_with_normal_item* item =
-        qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
-      if(item)
-        {
-          indices_to_remove.push_front(index);
-          std::copy (item->point_set()->begin(), item->point_set()->end(),
-                     std::back_inserter (*(mainSelectionItem->point_set())));
-          mainSelectionItem->setName(tr("%1 + %2").arg(mainSelectionItem->name()).arg(item->name()));
-        }
-    }
-  
-
-  mainSelectionItem->invalidateOpenGLBuffers();
-  scene->itemChanged(mainSelectionIndex);
-
-  //remove the other items
-  Q_FOREACH(int index, indices_to_remove)
-  {
-    scene->erase(index);
-  }
-}
-
-
-#include "Merge_point_sets_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_average_spacing_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_average_spacing_plugin.cpp
deleted file mode 100644
index 4183b67..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_average_spacing_plugin.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-#include "config.h"
-#include "Scene_points_with_normal_item.h"
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-
-#include <CGAL/compute_average_spacing.h>
-#include <CGAL/Timer.h>
-#include <CGAL/Memory_sizer.h>
-
-#include <QObject>
-#include <QAction>
-#include <QMainWindow>
-#include <QApplication>
-#include <QtPlugin>
-#include <QInputDialog>
-#include <QMessageBox>
-// Concurrency
-#ifdef CGAL_LINKED_WITH_TBB
-typedef CGAL::Parallel_tag Concurrency_tag;
-#else
-typedef CGAL::Sequential_tag Concurrency_tag;
-#endif
-
-using namespace CGAL::Three;
-class Polyhedron_demo_point_set_average_spacing_plugin :
-  public QObject,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-private:
-  QAction* actionAverageSpacing;
-  
-public:
-  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface) {
-    actionAverageSpacing = new QAction(tr("Point Set Average Spacing"), mainWindow);
-    actionAverageSpacing->setObjectName("actionAverageSpacing");
-
-    Polyhedron_demo_plugin_helper::init(mainWindow, scene_interface);
-  }
-
-  QList<QAction*> actions() const {
-    return QList<QAction*>() << actionAverageSpacing;
-  }
-  
-  //! Applicable if the currently selected item is a
-  //! points_with_normal_item.
-  bool applicable(QAction*) const {
-    return qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
-  }
-
-public Q_SLOTS:
-  void on_actionAverageSpacing_triggered();
-}; // end Polyhedron_demo_point_set_average_spacing_plugin
-
-void Polyhedron_demo_point_set_average_spacing_plugin::on_actionAverageSpacing_triggered()
-{
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-
-  Scene_points_with_normal_item* item =
-    qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
-
-  if(item)
-  {
-    // Gets point set
-    Point_set* points = item->point_set();
-    if(points == NULL)
-        return;
-
-    // Gets options
-    bool ok;
-
-    const int nb_neighbors =
-      QInputDialog::getInt((QWidget*)mw,
-                               tr("Average Spacing"), // dialog title
-                               tr("Number of neighbors:"), // field label
-                               6, // default value = 1 ring
-                               6, // min
-                               1000, // max
-                               1, // step
-                               &ok);
-    if(!ok) 
-      return;
-
-    QApplication::setOverrideCursor(Qt::WaitCursor);
-
-    CGAL::Timer task_timer; task_timer.start();
-    std::cerr << "Average spacing (k=" << nb_neighbors <<")...\n";
-
-    // Computes average spacing
-    double average_spacing = CGAL::compute_average_spacing<Concurrency_tag>(
-                                      points->begin(), points->end(),
-                                      nb_neighbors);
-
-    // Print result
-    Kernel::Sphere_3 bsphere = points->bounding_sphere();
-    double radius = std::sqrt(bsphere.squared_radius());
-    std::size_t memory = CGAL::Memory_sizer().virtual_size();
-    std::cerr << "Average spacing = " << average_spacing 
-                                      << " = " << average_spacing/radius << " * point set radius (" 
-                                      << task_timer.time() << " seconds, "
-                                      << (memory>>20) << " Mb allocated)"
-                                      << std::endl;
-    QApplication::restoreOverrideCursor();
-
-    QMessageBox::information(NULL,
-                             tr("Average Spacing"),
-                             tr("Average Spacing = %1 = %2 * point set radius")
-                             .arg(average_spacing)
-                             .arg(average_spacing/radius));
-  }
-}
-
-
-#include "Point_set_average_spacing_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_bilateral_smoothing_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_bilateral_smoothing_plugin.cpp
deleted file mode 100644
index 14932ff..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_bilateral_smoothing_plugin.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-#include "config.h"
-#include "Scene_points_with_normal_item.h"
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-
-#include <CGAL/bilateral_smooth_point_set.h>
-#include <CGAL/Timer.h>
-#include <CGAL/Memory_sizer.h>
-
-#include <QObject>
-#include <QAction>
-#include <QMainWindow>
-#include <QApplication>
-#include <QtPlugin>
-#include <QMessageBox>
-
-#include "ui_Point_set_bilateral_smoothing_plugin.h"
-
-// Concurrency
-#ifdef CGAL_LINKED_WITH_TBB
-typedef CGAL::Parallel_tag Concurrency_tag;
-#else
-typedef CGAL::Sequential_tag Concurrency_tag;
-#endif
-
-
-using namespace CGAL::Three;
-class Polyhedron_demo_point_set_bilateral_smoothing_plugin :
-  public QObject,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-  
-  QAction* actionBilateralSmoothing;
-
-public:
-  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface) {
-    actionBilateralSmoothing = new QAction(tr("Point Set Bilateral Smoothing"), mainWindow);
-    actionBilateralSmoothing->setObjectName("actionBilateralSmoothing");
-
-    Polyhedron_demo_plugin_helper::init(mainWindow, scene_interface);
-  }
-
-  bool applicable(QAction*) const {
-    return qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
-  }
-
-  QList<QAction*> actions() const {
-    return QList<QAction*>() << actionBilateralSmoothing;
-  }
-
-public Q_SLOTS:
-  void on_actionBilateralSmoothing_triggered();
-
-}; // end Polyhedron_demo_point_set_bilateral_smoothing_plugin
-
-class Point_set_demo_point_set_bilateral_smoothing_dialog : public QDialog, private Ui::PointSetBilateralSmoothingDialog
-{
-  Q_OBJECT
-  public:
-    Point_set_demo_point_set_bilateral_smoothing_dialog(QWidget * /*parent*/ = 0)
-    {
-      setupUi(this);
-    }
-
-    unsigned int iterations() const { return m_iterations->value(); }
-    unsigned int neighborhood_size () const { return m_neighborhoodSize->value(); }
-    unsigned int sharpness_angle () const { return m_sharpnessAngle->value(); }
-};
-
-void Polyhedron_demo_point_set_bilateral_smoothing_plugin::on_actionBilateralSmoothing_triggered()
-{
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-
-  Scene_points_with_normal_item* item =
-    qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
-
-  if(item)
-  {
-    // Gets point set
-    Point_set* points = item->point_set();
-    if(points == NULL)
-        return;
-
-    // Gets options
-    Point_set_demo_point_set_bilateral_smoothing_dialog dialog;
-    if(!dialog.exec())
-      return;
-
-    std::cerr << "Bilateral smoothing using "
-	      << dialog.iterations () << " iteration(s), neighborhood size of "
-	      << dialog.neighborhood_size () << " and sharpness angle of "
-	      << dialog.sharpness_angle () << "... ";
-    QApplication::setOverrideCursor(Qt::WaitCursor);
-
-    CGAL::Timer task_timer; task_timer.start();
-
-    for (unsigned int i = 0; i < dialog.iterations (); ++i)
-      {
-	/* double error = */
-	CGAL::bilateral_smooth_point_set<Concurrency_tag>
-	  (points->begin(), 
-	   points->end(),
-	   CGAL::make_identity_property_map(Point_set::value_type()),
-	   CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()),
-	   dialog.neighborhood_size (),
-	   dialog.sharpness_angle ());
-      }
-
-
-    
-    std::size_t memory = CGAL::Memory_sizer().virtual_size();
-    std::cerr << task_timer.time() << " seconds, "
-	      << (memory>>20) << " Mb allocated)"
-	      << std::endl;
-
-    // Updates scene
-    item->invalidateOpenGLBuffers();
-    scene->itemChanged(index);
-
-    QApplication::restoreOverrideCursor();
-
-  }
-}
-
-#include "Point_set_bilateral_smoothing_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_bilateral_smoothing_plugin.ui b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_bilateral_smoothing_plugin.ui
deleted file mode 100644
index 95b0e43..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_bilateral_smoothing_plugin.ui
+++ /dev/null
@@ -1,130 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>PointSetBilateralSmoothingDialog</class>
- <widget class="QDialog" name="PointSetBilateralSmoothingDialog">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>357</width>
-    <height>141</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Bilateral Smoothing</string>
-  </property>
-  <layout class="QGridLayout">
-   <item row="0" column="0">
-    <widget class="QLabel" name="label_4">
-     <property name="text">
-      <string>Iterations</string>
-     </property>
-    </widget>
-   </item>
-   <item row="3" column="0" colspan="2">
-    <widget class="QDialogButtonBox" name="buttonBox">
-     <property name="orientation">
-      <enum>Qt::Horizontal</enum>
-     </property>
-     <property name="standardButtons">
-      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
-     </property>
-    </widget>
-   </item>
-   <item row="1" column="0">
-    <widget class="QLabel" name="label_5">
-     <property name="text">
-      <string>Neighborhood size</string>
-     </property>
-    </widget>
-   </item>
-   <item row="0" column="1">
-    <widget class="QSpinBox" name="m_iterations">
-     <property name="minimum">
-      <number>1</number>
-     </property>
-     <property name="maximum">
-      <number>2147483647</number>
-     </property>
-     <property name="value">
-      <number>1</number>
-     </property>
-    </widget>
-   </item>
-   <item row="1" column="1">
-    <widget class="QSpinBox" name="m_neighborhoodSize">
-     <property name="suffix">
-      <string/>
-     </property>
-     <property name="prefix">
-      <string/>
-     </property>
-     <property name="minimum">
-      <number>1</number>
-     </property>
-     <property name="maximum">
-      <number>2147483647</number>
-     </property>
-     <property name="value">
-      <number>24</number>
-     </property>
-    </widget>
-   </item>
-   <item row="2" column="1">
-    <widget class="QSpinBox" name="m_sharpnessAngle">
-     <property name="suffix">
-      <string>°</string>
-     </property>
-     <property name="maximum">
-      <number>90</number>
-     </property>
-     <property name="value">
-      <number>25</number>
-     </property>
-    </widget>
-   </item>
-   <item row="2" column="0">
-    <widget class="QLabel" name="label">
-     <property name="text">
-      <string>Sharpness Angle</string>
-     </property>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <resources/>
- <connections>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>accepted()</signal>
-   <receiver>PointSetBilateralSmoothingDialog</receiver>
-   <slot>accept()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>248</x>
-     <y>254</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>157</x>
-     <y>274</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>rejected()</signal>
-   <receiver>PointSetBilateralSmoothingDialog</receiver>
-   <slot>reject()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>316</x>
-     <y>260</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>286</x>
-     <y>274</y>
-    </hint>
-   </hints>
-  </connection>
- </connections>
-</ui>
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.cpp
deleted file mode 100644
index 2d8f8f5..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.cpp
+++ /dev/null
@@ -1,288 +0,0 @@
-#include "config.h"
-#include "Scene_points_with_normal_item.h"
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-
-#include <CGAL/pca_estimate_normals.h>
-#include <CGAL/jet_estimate_normals.h>
-#include <CGAL/vcm_estimate_normals.h>
-#include <CGAL/mst_orient_normals.h>
-#include <CGAL/Timer.h>
-#include <CGAL/Memory_sizer.h>
-
-#include <QObject>
-#include <QAction>
-#include <QMainWindow>
-#include <QApplication>
-#include <QtPlugin>
-#include <QInputDialog>
-#include <QMessageBox>
-
-#include "ui_Point_set_normal_estimation_plugin.h"
-
-#if BOOST_VERSION == 105700
-#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS)
-#  define CGAL_DISABLE_NORMAL_ESTIMATION_PLUGIN 1
-#endif
-#endif
-
-// Concurrency
-#ifdef CGAL_LINKED_WITH_TBB
-typedef CGAL::Parallel_tag Concurrency_tag;
-#else
-typedef CGAL::Sequential_tag Concurrency_tag;
-#endif
-using namespace CGAL::Three;
-
-class Polyhedron_demo_point_set_normal_estimation_plugin :
-  public QObject,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-  QAction* actionNormalEstimation;
-  QAction* actionNormalInversion;
-
-public:
-  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface) {
-
-    actionNormalEstimation = new QAction(tr("Point Set Normal Estimation"), mainWindow);
-    actionNormalEstimation->setObjectName("actionNormalEstimation");
-
-    actionNormalInversion = new QAction(tr("Point Set Inverse Normal Orientations"), mainWindow);
-    actionNormalInversion->setObjectName("actionNormalInversion");
-    
-    Polyhedron_demo_plugin_helper::init(mainWindow, scene_interface);
-  }
-
-  QList<QAction*> actions() const {
-    return QList<QAction*>() << actionNormalEstimation << actionNormalInversion;
-  }
-
-  bool applicable(QAction* action) const {
-    Scene_points_with_normal_item* item = qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
-
-    if (action==actionNormalEstimation)
-#if CGAL_DISABLE_NORMAL_ESTIMATION_PLUGIN
-    return false;
-#else
-    return item;
-#endif
-    else
-      return item && item->has_normals();
-  }
-
-public Q_SLOTS:
-  void on_actionNormalEstimation_triggered();
-  void on_actionNormalInversion_triggered();
-
-}; // end PS_demo_smoothing_plugin
-
-class Point_set_demo_normal_estimation_dialog : public QDialog, private Ui::NormalEstimationDialog
-{
-  Q_OBJECT
-  public:
-    Point_set_demo_normal_estimation_dialog(QWidget* /*parent*/ = 0)
-    {
-      setupUi(this);
-    }
-
-  int pca_neighbors() const { return m_pca_neighbors->value(); }
-  int jet_neighbors() const { return m_jet_neighbors->value(); }
-  unsigned int convolution_neighbors() const { return m_convolution_neighbors->value(); }
-  double convolution_radius() const { return m_convolution_radius->value(); }
-  double offset_radius() const { return m_offset_radius->value(); }
-  int orient_neighbors() const { return m_orient_neighbors->value(); }
-
-  unsigned int method () const
-  {
-    if (buttonPCA->isChecked ())       return 0;
-    if (buttonJet->isChecked ())       return 1;
-    if (buttonVCM->isChecked ())       return 2;
-    return -1;
-  }
-  bool orient () const
-  {
-    return buttonOrient->isChecked();
-  }
-  bool use_convolution_radius () const
-  {
-    return buttonRadius->isChecked();
-  }
-};
-
-
-void Polyhedron_demo_point_set_normal_estimation_plugin::on_actionNormalInversion_triggered()
-{
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-
-  Scene_points_with_normal_item* item =
-    qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
-
-  if(item)
-  {
-    // Gets point set
-    Point_set* points = item->point_set();
-    if(points == NULL)
-        return;
-  
-    for(Point_set::iterator it = points->begin(); it != points->end(); ++it){
-      it->normal() = -1 * it->normal();
-    }
-    item->invalidateOpenGLBuffers();
-    scene->itemChanged(item);
-  }
-}
-
-void Polyhedron_demo_point_set_normal_estimation_plugin::on_actionNormalEstimation_triggered()
-{
-#if !CGAL_DISABLE_NORMAL_ESTIMATION_PLUGIN
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-
-  Scene_points_with_normal_item* item =
-    qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
-
-  if(item)
-  {
-    // Gets point set
-    Point_set* points = item->point_set();
-    if(points == NULL)
-        return;
-
-    // Gets options
-    Point_set_demo_normal_estimation_dialog dialog;
-    if(!dialog.exec())
-      return;
-      
-    QApplication::setOverrideCursor(Qt::WaitCursor);
-
-    // First point to delete
-    Point_set::iterator first_unoriented_point = points->end();
-
-    //***************************************
-    // normal estimation
-    //***************************************
-
-    if (dialog.method() == 0) // PCA
-    {
-      CGAL::Timer task_timer; task_timer.start();
-      std::cerr << "Estimates normal direction by PCA (k=" << dialog.pca_neighbors() <<")...\n";
-
-      // Estimates normals direction.
-      CGAL::pca_estimate_normals<Concurrency_tag>(points->begin(), points->end(),
-                                CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()),
-                                dialog.pca_neighbors());
-
-      std::size_t memory = CGAL::Memory_sizer().virtual_size();
-      std::cerr << "Estimates normal direction: " << task_timer.time() << " seconds, "
-                                                  << (memory>>20) << " Mb allocated"
-                                                  << std::endl;
-    }
-    else if (dialog.method() == 1) // Jet
-    {
-      CGAL::Timer task_timer; task_timer.start();
-      std::cerr << "Estimates normal direction by Jet Fitting (k=" << dialog.jet_neighbors() <<")...\n";
-
-      // Estimates normals direction.
-      CGAL::jet_estimate_normals<Concurrency_tag>(points->begin(), points->end(),
-                                CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()),
-                                dialog.jet_neighbors());
-
-      std::size_t memory = CGAL::Memory_sizer().virtual_size();
-      std::cerr << "Estimates normal direction: " << task_timer.time() << " seconds, "
-                                                  << (memory>>20) << " Mb allocated"
-                                                  << std::endl;
-    }
-    else if (dialog.method() == 2) // VCM
-    {
-      CGAL::Timer task_timer; task_timer.start();
-      // Estimates normals direction.
-      if (dialog.use_convolution_radius())
-        {
-          std::cerr << "Estimates Normals Direction using VCM (R="
-                    << dialog.offset_radius() << " and r=" << dialog.convolution_radius() << ")...\n";
-
-          CGAL::vcm_estimate_normals(points->begin(), points->end(),
-                                     CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()),
-                                     dialog.offset_radius(), dialog.convolution_radius());
-        }
-      else
-        {
-          std::cerr << "Estimates Normals Direction using VCM (R="
-                    << dialog.offset_radius() << " and k=" << dialog.convolution_neighbors() << ")...\n";
-
-          CGAL::vcm_estimate_normals(points->begin(), points->end(),
-                                     CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()),
-                                     dialog.offset_radius(), dialog.convolution_neighbors());
-        }
-
-      std::size_t memory = CGAL::Memory_sizer().virtual_size();
-      std::cerr << "Estimates normal direction: " << task_timer.time() << " seconds, "
-                                                  << (memory>>20) << " Mb allocated"
-                                                  << std::endl;
-    }
-
-    item->set_has_normals(true);
-    item->setRenderingMode(PointsPlusNormals);
-
-    //***************************************
-    // normal orientation
-    //***************************************
-
-    if (dialog.orient ())
-      {
-        CGAL::Timer task_timer; task_timer.start();
-        std::cerr << "Orient normals with a Minimum Spanning Tree (k=" << dialog.orient_neighbors() << ")...\n";
-
-        // Tries to orient normals
-        first_unoriented_point =
-          CGAL::mst_orient_normals(points->begin(), points->end(),
-                                   CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()),
-                                   dialog.orient_neighbors());
-
-        //indicates that the point set has normals
-        if (first_unoriented_point!=points->begin()){
-          item->set_has_normals(true);
-          item->setRenderingMode(PointsPlusNormals);
-        }
-
-        std::size_t nb_unoriented_normals = std::distance(first_unoriented_point, points->end());
-        std::size_t memory = CGAL::Memory_sizer().virtual_size();
-        std::cerr << "Orient normals: " << nb_unoriented_normals << " point(s) with an unoriented normal are selected ("
-                  << task_timer.time() << " seconds, "
-                  << (memory>>20) << " Mb allocated)"
-                  << std::endl;
-
-        // Selects points with an unoriented normal
-        points->set_first_selected (first_unoriented_point);
-
-        // Updates scene
-        item->invalidateOpenGLBuffers();
-        scene->itemChanged(index);
-
-        QApplication::restoreOverrideCursor();
-
-        // Warns user
-        if (nb_unoriented_normals > 0)
-          {
-            QMessageBox::information(NULL,
-                                     tr("Points with an unoriented normal"),
-                                     tr("%1 point(s) with an unoriented normal are selected.\nPlease orient them or remove them before running Poisson reconstruction.")
-                                     .arg(nb_unoriented_normals));
-          }
-      }
-    else
-      {
-        // Updates scene
-        item->invalidateOpenGLBuffers();
-        scene->itemChanged(index);
-
-        QApplication::restoreOverrideCursor();
-      }
-  }
-#endif // !CGAL_DISABLE_NORMAL_ESTIMATION_PLUGIN
-}
-
-#include "Point_set_normal_estimation_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.ui b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.ui
deleted file mode 100644
index 4e78393..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.ui
+++ /dev/null
@@ -1,415 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>NormalEstimationDialog</class>
- <widget class="QDialog" name="NormalEstimationDialog">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>400</width>
-    <height>473</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Dialog</string>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout">
-   <item>
-    <widget class="QRadioButton" name="buttonPCA">
-     <property name="text">
-      <string>PCA Estimate Normals</string>
-     </property>
-    </widget>
-   </item>
-   <item>
-    <widget class="QFrame" name="frame">
-     <property name="enabled">
-      <bool>false</bool>
-     </property>
-     <property name="frameShape">
-      <enum>QFrame::StyledPanel</enum>
-     </property>
-     <property name="frameShadow">
-      <enum>QFrame::Raised</enum>
-     </property>
-     <layout class="QFormLayout" name="formLayout_2">
-      <property name="fieldGrowthPolicy">
-       <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
-      </property>
-      <item row="0" column="0">
-       <widget class="QLabel" name="supportSizeLabel">
-        <property name="text">
-         <string>Support Size</string>
-        </property>
-       </widget>
-      </item>
-      <item row="0" column="1">
-       <widget class="QSpinBox" name="m_pca_neighbors">
-        <property name="suffix">
-         <string>Nearest Neighbors</string>
-        </property>
-        <property name="minimum">
-         <number>3</number>
-        </property>
-        <property name="maximum">
-         <number>10000000</number>
-        </property>
-        <property name="value">
-         <number>6</number>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item>
-    <widget class="QRadioButton" name="buttonJet">
-     <property name="text">
-      <string>Jet Estimate Normals</string>
-     </property>
-     <property name="checked">
-      <bool>true</bool>
-     </property>
-    </widget>
-   </item>
-   <item>
-    <widget class="QFrame" name="frame_2">
-     <property name="frameShape">
-      <enum>QFrame::StyledPanel</enum>
-     </property>
-     <property name="frameShadow">
-      <enum>QFrame::Raised</enum>
-     </property>
-     <layout class="QFormLayout" name="formLayout_3">
-      <property name="fieldGrowthPolicy">
-       <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
-      </property>
-      <item row="0" column="0">
-       <widget class="QLabel" name="supportSizeLabel_2">
-        <property name="text">
-         <string>Support Size</string>
-        </property>
-       </widget>
-      </item>
-      <item row="0" column="1">
-       <widget class="QSpinBox" name="m_jet_neighbors">
-        <property name="suffix">
-         <string>Nearest Neighbors</string>
-        </property>
-        <property name="minimum">
-         <number>3</number>
-        </property>
-        <property name="maximum">
-         <number>100000000</number>
-        </property>
-        <property name="value">
-         <number>12</number>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item>
-    <widget class="QRadioButton" name="buttonVCM">
-     <property name="text">
-      <string>VCM Estimate Normals</string>
-     </property>
-    </widget>
-   </item>
-   <item>
-    <widget class="QFrame" name="frame_3">
-     <property name="enabled">
-      <bool>false</bool>
-     </property>
-     <property name="frameShape">
-      <enum>QFrame::StyledPanel</enum>
-     </property>
-     <property name="frameShadow">
-      <enum>QFrame::Raised</enum>
-     </property>
-     <layout class="QFormLayout" name="formLayout_4">
-      <property name="fieldGrowthPolicy">
-       <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
-      </property>
-      <item row="0" column="0">
-       <widget class="QLabel" name="offsetRadiusLabel">
-        <property name="text">
-         <string>Offset Radius</string>
-        </property>
-       </widget>
-      </item>
-      <item row="0" column="1">
-       <widget class="QDoubleSpinBox" name="m_offset_radius">
-        <property name="minimum">
-         <double>0.010000000000000</double>
-        </property>
-        <property name="singleStep">
-         <double>0.010000000000000</double>
-        </property>
-        <property name="value">
-         <double>0.100000000000000</double>
-        </property>
-       </widget>
-      </item>
-      <item row="1" column="1">
-       <widget class="QDoubleSpinBox" name="m_convolution_radius"/>
-      </item>
-      <item row="1" column="0">
-       <widget class="QRadioButton" name="buttonRadius">
-        <property name="text">
-         <string>Convolution Radius</string>
-        </property>
-        <property name="checked">
-         <bool>true</bool>
-        </property>
-       </widget>
-      </item>
-      <item row="2" column="0">
-       <widget class="QRadioButton" name="buttonNeighbors">
-        <property name="text">
-         <string>Convolution Neighbors</string>
-        </property>
-       </widget>
-      </item>
-      <item row="2" column="1">
-       <widget class="QSpinBox" name="m_convolution_neighbors">
-        <property name="enabled">
-         <bool>false</bool>
-        </property>
-        <property name="maximum">
-         <number>100000000</number>
-        </property>
-        <property name="value">
-         <number>40</number>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item>
-    <spacer name="verticalSpacer">
-     <property name="orientation">
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>20</width>
-       <height>40</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
-   <item>
-    <widget class="Line" name="line">
-     <property name="orientation">
-      <enum>Qt::Horizontal</enum>
-     </property>
-    </widget>
-   </item>
-   <item>
-    <spacer name="verticalSpacer_2">
-     <property name="orientation">
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>20</width>
-       <height>40</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
-   <item>
-    <widget class="QCheckBox" name="buttonOrient">
-     <property name="text">
-      <string>Orient Estimated Normals</string>
-     </property>
-     <property name="checked">
-      <bool>true</bool>
-     </property>
-    </widget>
-   </item>
-   <item>
-    <widget class="QFrame" name="frame_4">
-     <property name="frameShape">
-      <enum>QFrame::StyledPanel</enum>
-     </property>
-     <property name="frameShadow">
-      <enum>QFrame::Raised</enum>
-     </property>
-     <layout class="QFormLayout" name="formLayout_5">
-      <property name="fieldGrowthPolicy">
-       <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
-      </property>
-      <item row="0" column="0">
-       <widget class="QLabel" name="neighborhoodSizeLabel">
-        <property name="text">
-         <string>Neighborhood Size</string>
-        </property>
-       </widget>
-      </item>
-      <item row="0" column="1">
-       <widget class="QSpinBox" name="m_orient_neighbors">
-        <property name="suffix">
-         <string>Nearest Neighbors</string>
-        </property>
-        <property name="minimum">
-         <number>6</number>
-        </property>
-        <property name="maximum">
-         <number>100000000</number>
-        </property>
-        <property name="value">
-         <number>18</number>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item>
-    <widget class="QDialogButtonBox" name="buttonBox">
-     <property name="orientation">
-      <enum>Qt::Horizontal</enum>
-     </property>
-     <property name="standardButtons">
-      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
-     </property>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <resources/>
- <connections>
-  <connection>
-   <sender>buttonJet</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>frame_2</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>199</x>
-     <y>96</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>199</x>
-     <y>135</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>buttonPCA</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>frame</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>199</x>
-     <y>18</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>199</x>
-     <y>57</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>buttonVCM</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>frame_3</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>199</x>
-     <y>174</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>199</x>
-     <y>245</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>buttonOrient</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>frame_4</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>199</x>
-     <y>316</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>199</x>
-     <y>355</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>buttonRadius</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>m_convolution_radius</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>90</x>
-     <y>242</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>285</x>
-     <y>245</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>buttonNeighbors</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>m_convolution_neighbors</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>101</x>
-     <y>274</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>285</x>
-     <y>277</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>accepted()</signal>
-   <receiver>NormalEstimationDialog</receiver>
-   <slot>accept()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>199</x>
-     <y>428</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>199</x>
-     <y>225</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>rejected()</signal>
-   <receiver>NormalEstimationDialog</receiver>
-   <slot>reject()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>199</x>
-     <y>428</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>199</x>
-     <y>225</y>
-    </hint>
-   </hints>
-  </connection>
- </connections>
-</ui>
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_outliers_removal_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_outliers_removal_plugin.cpp
deleted file mode 100644
index 4d4b790..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_outliers_removal_plugin.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-#include "config.h"
-#include "Scene_points_with_normal_item.h"
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-
-#include <CGAL/remove_outliers.h>
-#include <CGAL/Timer.h>
-#include <CGAL/Memory_sizer.h>
-
-#include <QObject>
-#include <QAction>
-#include <QMainWindow>
-#include <QApplication>
-#include <QtPlugin>
-#include <QInputDialog>
-#include <QMessageBox>
-
-#include "ui_Point_set_outliers_removal_plugin.h"
-using namespace CGAL::Three;
-class Polyhedron_demo_point_set_outliers_removal_plugin :
-  public QObject,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-private:
-  QAction* actionOutlierRemoval;
-
-public:
-  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface) {
-    actionOutlierRemoval = new QAction(tr("Point Set Outliers Selection"), mainWindow);
-    actionOutlierRemoval->setObjectName("actionOutlierRemoval");
-
-    Polyhedron_demo_plugin_helper::init(mainWindow, scene_interface);
-  }
-  
-  //! Applicate for Point_sets with normals.
-  bool applicable(QAction*) const {
-    return qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
-  }
-
-  QList<QAction*> actions() const {
-    return QList<QAction*>() << actionOutlierRemoval;
-  }
-
-public Q_SLOTS:
-  void on_actionOutlierRemoval_triggered();
-
-}; // end Polyhedron_demo_point_set_outliers_removal_plugin
-
-class Point_set_demo_outlier_removal_dialog : public QDialog, private Ui::OutlierRemovalDialog
-{
-  Q_OBJECT
-  public:
-    Point_set_demo_outlier_removal_dialog(QWidget * /*parent*/ = 0)
-    {
-      setupUi(this);
-    }
-
-    double percentage() const { return m_inputPercentage->value(); }
-    int nbNeighbors() const { return m_inputNbNeighbors->value(); }
-};
-
-void Polyhedron_demo_point_set_outliers_removal_plugin::on_actionOutlierRemoval_triggered()
-{
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-
-  Scene_points_with_normal_item* item =
-    qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
-
-  if(item)
-  {
-    // Gets point set
-    Point_set* points = item->point_set();
-    if(points == NULL)
-        return;
-
-    // Gets options
-    Point_set_demo_outlier_removal_dialog dialog;
-    if(!dialog.exec())
-      return;
-    const double removed_percentage = dialog.percentage(); // percentage of points to remove
-    const int nb_neighbors = dialog.nbNeighbors();
-
-    QApplication::setOverrideCursor(Qt::WaitCursor);
-
-    CGAL::Timer task_timer; task_timer.start();
-    std::cerr << "Select outliers (" << removed_percentage <<"%)...\n";
-
-    // Computes outliers
-    Point_set::iterator first_point_to_remove =
-      CGAL::remove_outliers(points->begin(), points->end(),
-                            nb_neighbors,
-                            removed_percentage);
-
-    std::size_t nb_points_to_remove = std::distance(first_point_to_remove, points->end());
-    std::size_t memory = CGAL::Memory_sizer().virtual_size();
-    std::cerr << "Simplification: " << nb_points_to_remove << " point(s) are selected ("
-                                    << task_timer.time() << " seconds, "
-                                    << (memory>>20) << " Mb allocated)"
-                                    << std::endl;
-
-    // Selects points to delete
-    points->set_first_selected (first_point_to_remove);
-
-    // Updates scene
-    item->invalidateOpenGLBuffers();
-    scene->itemChanged(index);
-
-    QApplication::restoreOverrideCursor();
-  }
-}
-
-#include "Point_set_outliers_removal_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_selection_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_selection_plugin.cpp
deleted file mode 100644
index 8c16027..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_selection_plugin.cpp
+++ /dev/null
@@ -1,509 +0,0 @@
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-#include <CGAL/Bbox_2.h>
-#include <CGAL/Polygon_2.h>
-#include <QtCore/qglobal.h>
-#include <QGLViewer/manipulatedCameraFrame.h>
-#include "opengl_tools.h"
-
-#include "Messages_interface.h"
-#include "Scene_points_with_normal_item.h"
-#include "Scene_polylines_item.h"
-
-#include <CGAL/Three/Scene_interface.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include "ui_Point_set_selection_widget.h"
-#include "Point_set_3.h"
-
-#include <QAction>
-#include <QMainWindow>
-#include <QApplication>
-
-#include <QEvent>
-#include <QKeyEvent>
-#include <QMouseEvent>
-
-#include <map>
-#include <fstream>
-
-
-// Class for visualizing selection 
-// provides mouse selection functionality
-class Q_DECL_EXPORT Scene_point_set_selection_visualizer : public CGAL::Three::Scene_item
-{
-  Q_OBJECT
-
- private:
-  typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
-  typedef K::Point_2 Point_2;
-  typedef K::Point_3 Point_3;
-  typedef CGAL::Polygon_2<K> Polygon_2;
-  
-  bool rectangle;
-  std::vector<Point_2> contour_2d;
-  Scene_polylines_item* polyline;
-  Bbox point_set_bbox;
-  CGAL::Bbox_2 domain_rectangle;
-  Polygon_2 domain_freeform;
-  
-public:
-
-  Scene_point_set_selection_visualizer(bool rectangle, const Bbox& point_set_bbox)
-    : rectangle (rectangle), point_set_bbox (point_set_bbox)
-  {
-    polyline = new Scene_polylines_item();
-    polyline->setRenderingMode (Wireframe);
-    polyline->setVisible (true);
-    polyline->polylines.push_back (Scene_polylines_item::Polyline());
-  }
-  ~Scene_point_set_selection_visualizer() {
-  }
-  bool isFinite() const { return true; }
-  bool isEmpty() const { return poly().empty(); }
-  void compute_bbox() const {
-    _bbox = point_set_bbox;
-  }
-  Scene_point_set_selection_visualizer* clone() const {
-    return 0;
-  }
-  QString toolTip() const {
-    return tr("%1").arg(name());
-  }
-
-  bool supportsRenderingMode(RenderingMode m) const {
-    return (m == Wireframe);
-  }
-  
-  void draw_edges(CGAL::Three::Viewer_interface* viewer) const {
-    viewer->glLineWidth(3.f);
-    polyline->setRbgColor(0, 255, 0); 
-
-    polyline->draw_edges(viewer);
-  }
-
-  Scene_polylines_item::Polyline& poly() const
-  { return polyline->polylines.front(); }
-  
-  bool update_polyline () const
-  {
-    if (contour_2d.size() < 2 ||
-	(!(poly().empty()) && scene_point (contour_2d.back ()) == poly().back()))
-      return false;
-    
-    if (rectangle)
-      {
-	poly().clear();
-	
-	poly().push_back (scene_point (Point_2 (domain_rectangle.xmin(),
-						domain_rectangle.ymin())));
-	poly().push_back (scene_point (Point_2 (domain_rectangle.xmax(),
-						domain_rectangle.ymin())));
-	poly().push_back (scene_point (Point_2 (domain_rectangle.xmax(),
-						domain_rectangle.ymax())));
-	poly().push_back (scene_point (Point_2 (domain_rectangle.xmin(),
-						domain_rectangle.ymax())));
-	poly().push_back (scene_point (Point_2 (domain_rectangle.xmin(),
-						domain_rectangle.ymin())));
-
-      }
-    else
-      {
-	if (!(poly().empty()) && scene_point (contour_2d.back ()) == poly().back())
-	  return false;
-
-	poly().clear();
-
-	for (unsigned int i = 0; i < contour_2d.size (); ++ i)
-	  poly().push_back (scene_point (contour_2d[i]));
-      }
-    
-    return true;
-  }
-
-  Point_3 scene_point (const Point_2& p) const
-  {
-    QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
-    qglviewer::Camera* camera = viewer->camera();
-    qglviewer::Vec vp (p.x(), p.y(), 0.1);
-    qglviewer::Vec vsp = camera->unprojectedCoordinatesOf (vp);
-    
-    return Point_3 (vsp.x, vsp.y, vsp.z);
-  }
-
-
-  
-  void sample_mouse_path()
-  {
-    QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
-    const QPoint& p = viewer->mapFromGlobal(QCursor::pos());
-    
-    if (rectangle && contour_2d.size () == 2)
-      {
-	contour_2d[1] = Point_2 (p.x (), p.y ());
-	domain_rectangle = CGAL::bbox_2 (contour_2d.begin (), contour_2d.end ());
-      }
-    else
-      contour_2d.push_back (Point_2 (p.x (), p.y ()));
-
-    if (update_polyline ())
-      {
-	Q_EMIT itemChanged();
-      }
-  }
-
-  void apply_path()
-  {
-    update_polyline ();
-    domain_rectangle = CGAL::bbox_2 (contour_2d.begin (), contour_2d.end ());    
-    if (!rectangle)
-      domain_freeform = Polygon_2 (contour_2d.begin (), contour_2d.end ());
-  }
-
-  bool is_selected (qglviewer::Vec& p)
-  {
-    if (domain_rectangle.xmin () < p.x &&
-	p.x < domain_rectangle.xmax () &&
-	domain_rectangle.ymin () < p.y &&
-	p.y < domain_rectangle.ymax ())
-      {
-	if (rectangle)
-	  return true;
-	
-	if (domain_freeform.has_on_bounded_side (Point_2 (p.x, p.y)))
-	  return true;
-      }
-    return false;
-  }
-
-
-}; // end class Scene_point_set_selection_visualizer
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-using namespace CGAL::Three;
-class Polyhedron_demo_point_set_selection_plugin :
-  public QObject,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-    Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-    Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-public:
-  bool applicable(QAction*) const { 
-      return qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
-  }
-  void print_message(QString message) { messages->information(message); }
-  QList<QAction*> actions() const { return QList<QAction*>() << actionPointSetSelection; }
-  using Polyhedron_demo_plugin_helper::init;
-  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface* m) {
-    mw = mainWindow;
-    scene = scene_interface;
-    messages = m;
-    actionPointSetSelection = new QAction(tr("Selection"), mw);
-    connect(actionPointSetSelection, SIGNAL(triggered()), this, SLOT(selection_action()));
-
-    dock_widget = new QDockWidget("Point Set Selection", mw);
-    dock_widget->setVisible(false);
-
-    ui_widget.setupUi(dock_widget);
-    add_dock_widget(dock_widget);
-
-    connect(ui_widget.Selection_tool_combo_box, SIGNAL(currentIndexChanged(int)), 
-            this, SLOT(on_Selection_tool_combo_box_changed(int)));
-    connect(ui_widget.Selection_mode_combo_box, SIGNAL(currentIndexChanged(int)), 
-            this, SLOT(on_Selection_mode_combo_box_changed(int)));
-    connect(ui_widget.Select_all_button,  SIGNAL(clicked()), this, SLOT(on_Select_all_button_clicked()));
-    connect(ui_widget.Clear_button,  SIGNAL(clicked()), this, SLOT(on_Clear_button_clicked()));
-    connect(ui_widget.Invert_selection_button,  SIGNAL(clicked()), this, SLOT(on_Invert_selection_button_clicked()));
-    connect(ui_widget.Erase_selected_points_button,  SIGNAL(clicked()), this, SLOT(on_Erase_selected_points_button_clicked()));
-    connect(ui_widget.Create_point_set_item_button, SIGNAL(clicked()), this, SLOT(on_Create_point_set_item_button_clicked()));
-
-    rectangle = true;
-    selection_mode = 0;
-    visualizer = NULL;
-    shift_pressing = false;
-    
-    QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
-    viewer->installEventFilter(this);
-    mainWindow->installEventFilter(this);
-
-
-  }
-  virtual void closure()
-  {
-    dock_widget->hide();
-  }
-
-protected:
-
-  bool eventFilter(QObject *, QEvent *event) {
-    if (dock_widget->isHidden() || !(dock_widget->isActiveWindow()))
-      return false;
-    
-    Scene_points_with_normal_item* point_set_item
-      = qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
-    if(!point_set_item) {
-      return false; 
-    }
-    int item_id = scene->item_id (point_set_item);
-      
-    if(event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease)  {
-      QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
-      Qt::KeyboardModifiers modifiers = keyEvent->modifiers();
-
-      shift_pressing = modifiers.testFlag(Qt::ShiftModifier);
-    }
-
-    // mouse events
-    if(shift_pressing && event->type() == QEvent::MouseButtonPress)
-      {
-	QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
-	// Start selection
-	if (mouseEvent->button() == Qt::LeftButton && !visualizer)
-	  {
-	    QApplication::setOverrideCursor(Qt::CrossCursor);
-	    QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
-	    if (viewer->camera()->frame()->isSpinning())
-	      viewer->camera()->frame()->stopSpinning();
-	
-	    visualizer = new Scene_point_set_selection_visualizer(rectangle,
-								  point_set_item->bbox());
-	    visualizer->setName(tr("Point set selection visualizer"));
-	    visualizer->setRenderingMode (Wireframe);
-	    visualizer->setVisible (true);
-
-	    // Hack to prevent camera for "jumping" when creating new item
-	    scene->addItem(visualizer);
-	
-	    scene->setSelectedItem(item_id);
-	    visualizer->sample_mouse_path();
-	    return true;
-	  }
-	// Cancel selection
-	else if (mouseEvent->button() == Qt::RightButton && visualizer)
-	  {
-
-	    scene->erase( scene->item_id(visualizer) );
-	    scene->setSelectedItem(item_id);
-	    visualizer = NULL;
-	    QApplication::restoreOverrideCursor();
-	    return true;
-	  }
-
-      }
-    // End selection
-    else if (event->type() == QEvent::MouseButtonRelease && visualizer)
-      {
-	visualizer->apply_path();
-	select_points();
-	scene->erase( scene->item_id(visualizer) );
-	scene->setSelectedItem(item_id);
-	visualizer = NULL;
-	QApplication::restoreOverrideCursor();
-	return true;
-      }
-    // Update selection
-    else if (event->type() == QEvent::MouseMove && visualizer)
-      {
-	visualizer->sample_mouse_path();
-	return true;
-      }
-
-    return false;
-  }
-
-  void select_points()
-  {
-    Scene_points_with_normal_item* point_set_item = get_selected_item<Scene_points_with_normal_item>();
-    if(!point_set_item)
-      {
-	print_message("Error: no point set selected!");
-	return; 
-      }
-
-    if (selection_mode == 0) // New selection
-      point_set_item->point_set()->unselect_all();
-    
-    QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
-    qglviewer::Camera* camera = viewer->camera();
-
-    std::vector<UI_point_3<Kernel> > unselected, selected;
-    
-    for(Point_set::iterator it = point_set_item->point_set()->begin ();
-	it != point_set_item->point_set()->end(); ++ it)
-      {
-	bool already_selected = point_set_item->point_set()->is_selected (it);
-	    
-	qglviewer::Vec vp (it->x (), it->y (), it->z ());
-	qglviewer::Vec vsp = camera->projectedCoordinatesOf (vp);
-	    
-	bool now_selected = visualizer->is_selected (vsp);
-
-	// NEW INTERSECTION
-	if (selection_mode == 0)
-	  {
-	    if (now_selected)
-	      selected.push_back (*it);
-	    else
-	      unselected.push_back (*it);
-	  }
-	// UNION
-	else if (selection_mode == 1)
-	  {
-	    if (already_selected || now_selected)
-	      selected.push_back (*it);
-	    else
-	      unselected.push_back (*it);
-	  }
-	// INTERSECTION
-	//  * Unselect point if it was selected and is not anymore
-	else if (selection_mode == 2)
-	  {
-	    if (already_selected && now_selected)
-	      selected.push_back (*it);
-	    else
-	      unselected.push_back (*it);
-	  }
-	// DIFFERENCE
-	//  * Unselect point if it was selected and is now selected
-	else if (selection_mode == 3)
-	  {
-	    if (already_selected && !now_selected)
-	      selected.push_back (*it);
-	    else
-	      unselected.push_back (*it);
-	  }
-
-      }
-
-    point_set_item->point_set()->clear();
-    
-    std::copy (unselected.begin (), unselected.end (),
-	       std::back_inserter (*(point_set_item->point_set())));
-    std::size_t size = unselected.size();
-
-    if (selected.empty ())
-      {
-	point_set_item->point_set()->unselect_all();
-      }
-    else
-      {
-	std::copy (selected.begin (), selected.end (),
-		   std::back_inserter (*(point_set_item->point_set())));
-	point_set_item->point_set()->set_first_selected
-	  (point_set_item->point_set()->begin() + size);
-      } 
-    point_set_item->invalidateOpenGLBuffers();
-  }
-
-  
-
-
-public Q_SLOTS:
-  void selection_action() { 
-    dock_widget->show();
-    dock_widget->raise();
-  }
-  
-  // Select all
-  void on_Select_all_button_clicked() {
-    Scene_points_with_normal_item* point_set_item = get_selected_item<Scene_points_with_normal_item>();
-    if(!point_set_item)
-      {
-	print_message("Error: no point set selected!");
-	return; 
-      }
-
-    point_set_item->selectAll();
-  }
-  
-  // Clear selection
-  void on_Clear_button_clicked() {
-    Scene_points_with_normal_item* point_set_item
-      = qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
-    if(!point_set_item) {
-      print_message("Error: no point set selected!");
-      return; 
-    }
-
-    point_set_item->resetSelection();
-  }
-
-  void on_Erase_selected_points_button_clicked() {
-    Scene_points_with_normal_item* point_set_item
-      = qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
-    if(!point_set_item) {
-      print_message("Error: no point set selected!");
-      return; 
-    }
-
-    point_set_item->deleteSelection();
-  }
-
-  void on_Invert_selection_button_clicked() {
-    Scene_points_with_normal_item* point_set_item
-      = qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
-    if(!point_set_item) {
-      print_message("Error: no point set selected!");
-      return; 
-    }
-
-    point_set_item->invertSelection();
-  }
-
-  void on_Create_point_set_item_button_clicked() {
-    Scene_points_with_normal_item* point_set_item
-      = qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
-    if(!point_set_item) {
-      print_message("Error: no point set selected!");
-      return; 
-    }
-    if(point_set_item->isSelectionEmpty ()) {
-      print_message("Error: there is no selected point in point set item!");
-      return;
-    }
-    
-    Scene_points_with_normal_item* new_item = new Scene_points_with_normal_item();
-    new_item->setName(QString("%1 (selected points)").arg(point_set_item->name()));
-    new_item->set_has_normals (point_set_item->has_normals());
-    new_item->setColor(point_set_item->color());
-    new_item->setRenderingMode(point_set_item->renderingMode());
-    new_item->setVisible(point_set_item->visible());
-
-    typedef Point_set_3<Kernel> Point_set;
-    for(Point_set::iterator it = point_set_item->point_set()->begin ();
-	it != point_set_item->point_set()->end(); ++ it) {
-      if (point_set_item->point_set()->is_selected (it))
-	new_item->point_set()->push_back(*it);
-    }
-    new_item->resetSelection();
-    new_item->invalidateOpenGLBuffers();
-
-    scene->addItem(new_item);
- }
-
-  void on_Selection_tool_combo_box_changed (int index)
-  {
-    rectangle = (index == 0);
-  }
-
-  void on_Selection_mode_combo_box_changed (int index)
-  {
-    selection_mode = index;
-  }
-
-
-private:
-  Messages_interface* messages;
-  QAction* actionPointSetSelection;
-
-  QDockWidget* dock_widget;
-  Ui::PointSetSelection ui_widget;
-  bool rectangle;
-  int selection_mode;
-  Scene_point_set_selection_visualizer* visualizer;
-  bool shift_pressing;
-
-}; // end Polyhedron_demo_point_set_selection_plugin
-
-//Q_EXPORT_PLUGIN2(Polyhedron_demo_point_set_selection_plugin, Polyhedron_demo_point_set_selection_plugin)
-
-#include "Point_set_selection_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.cpp
deleted file mode 100644
index 7fd7479..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.cpp
+++ /dev/null
@@ -1,307 +0,0 @@
-#include "config.h"
-#include "Scene_points_with_normal_item.h"
-#include "Scene_polygon_soup_item.h"
-#include "Scene_polyhedron_item.h"
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-
-#include <CGAL/Random.h>
-
-#include <CGAL/Shape_detection_3.h>
-#include <CGAL/Delaunay_triangulation_2.h>
-#include <CGAL/Alpha_shape_2.h>
-
-#include <QObject>
-#include <QAction>
-#include <QMainWindow>
-#include <QApplication>
-#include <QtPlugin>
-#include <QMessageBox>
-
-#include <boost/foreach.hpp>
-
-#include "ui_Point_set_shape_detection_plugin.h"
-
-typedef CGAL::Exact_predicates_inexact_constructions_kernel Epic_kernel;
-typedef Epic_kernel::Point_3 Point;
-//typedef CGAL::Point_with_normal_3<Epic_kernel> Point_with_normal;
-//typedef std::vector<Point_with_normal> Point_list;
-//typedef CGAL::Identity_property_map<Point_with_normal> PointPMap;
-//typedef CGAL::Normal_of_point_with_normal_pmap<Epic_kernel> NormalPMap;
-using namespace CGAL::Three;
-class Polyhedron_demo_point_set_shape_detection_plugin :
-  public QObject,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-    Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-    Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-    QAction* actionDetect;
-
-public:
-  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface) {
-    actionDetect = new QAction(tr("Point Set Shape Detection"), mainWindow);
-    actionDetect->setObjectName("actionDetect");
-
-    Polyhedron_demo_plugin_helper::init(mainWindow, scene_interface);
-  }
-
-  bool applicable(QAction*) const {
-    Scene_points_with_normal_item* item =
-      qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
-    if (item && item->has_normals())
-      return true;
-    return false;
-  }
-
-  QList<QAction*> actions() const {
-    return QList<QAction*>() << actionDetect;
-  }
-
-  public Q_SLOTS:
-    void on_actionDetect_triggered();
-
-private:
-
-  typedef Kernel::Plane_3 Plane_3;
-  
-  void build_alpha_shape (Point_set& points, const Plane_3& plane,
-                          Scene_polyhedron_item* item, double epsilon);
-
-}; // end Polyhedron_demo_point_set_shape_detection_plugin
-
-class Point_set_demo_point_set_shape_detection_dialog : public QDialog, private Ui::PointSetShapeDetectionDialog
-{
-  Q_OBJECT
-public:
-  Point_set_demo_point_set_shape_detection_dialog(QWidget * /*parent*/ = 0)
-  {
-    setupUi(this);
-  }
-
-  //QString shapeDetectionMethod() const { return m_shapeDetectionMethod->currentText(); }
-  double cluster_epsilon() const { return m_cluster_epsilon_field->value(); }
-  double epsilon() const { return m_epsilon_field->value(); }
-  unsigned int min_points() const { return m_min_pts_field->value(); }
-  double normal_tolerance() const { return m_normal_tolerance_field->value(); }
-  double search_probability() const { return m_probability_field->value(); }
-  double gridCellSize() const { return 1.0; }
-  bool detect_plane() const { return planeCB->isChecked(); } 
-  bool detect_sphere() const { return sphereCB->isChecked(); } 
-  bool detect_cylinder() const { return cylinderCB->isChecked(); } 
-  bool detect_torus() const { return torusCB->isChecked(); } 
-  bool detect_cone() const { return coneCB->isChecked(); }
-  bool generate_alpha() const { return m_generate_alpha->isChecked(); }
-  bool generate_subset() const { return !(m_do_not_generate_subset->isChecked()); }
-};
-
-void Polyhedron_demo_point_set_shape_detection_plugin::on_actionDetect_triggered() {
-  CGAL::Random rand(time(0));
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-
-  Scene_points_with_normal_item* item =
-    qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
-
-  Scene_points_with_normal_item::Bbox bb = item->bbox();
- 
-  double diam = bb.diagonal_length();
-
-  if(item)
-  {
-    // Gets point set
-    Point_set* points = item->point_set();
-
-    if(points == NULL)
-      return;
-
-    //Epic_kernel::FT diag = sqrt(((points->bounding_box().max)() - (points->bounding_box().min)()).squared_length());
-
-    // Gets options
-    Point_set_demo_point_set_shape_detection_dialog dialog;
-    if(!dialog.exec())
-      return;
-
-    QApplication::setOverrideCursor(Qt::WaitCursor);
-
-    typedef CGAL::Identity_property_map<Point_set::Point_with_normal> PointPMap;
-    typedef CGAL::Normal_of_point_with_normal_pmap<Point_set::Geom_traits> NormalPMap;
-
-    typedef CGAL::Shape_detection_3::Efficient_RANSAC_traits<Epic_kernel, Point_set, PointPMap, NormalPMap> Traits;
-    typedef CGAL::Shape_detection_3::Efficient_RANSAC<Traits> Shape_detection;
-
-    Shape_detection shape_detection;
-    shape_detection.set_input(*points);
-
-    // Shapes to be searched for are registered by using the template Shape_factory
-    if(dialog.detect_plane()){
-        shape_detection.add_shape_factory<CGAL::Shape_detection_3::Plane<Traits> >();
-      }
-    if(dialog.detect_cylinder()){
-      shape_detection.add_shape_factory<CGAL::Shape_detection_3::Cylinder<Traits> >();
-    }
-    if(dialog.detect_torus()){
-       shape_detection.add_shape_factory< CGAL::Shape_detection_3::Torus<Traits> >();
-    }
-    if(dialog.detect_cone()){
-      shape_detection.add_shape_factory< CGAL::Shape_detection_3::Cone<Traits> >();
-    }
-    if(dialog.detect_sphere()){
-      shape_detection.add_shape_factory< CGAL::Shape_detection_3::Sphere<Traits> >();
-    }
-
-    // Parameterization of the shape detection using the Parameters structure.
-    Shape_detection::Parameters op;
-    op.probability = dialog.search_probability();       // probability to miss the largest primitive on each iteration.
-    op.min_points = dialog.min_points();          // Only extract shapes with a minimum number of points.
-    op.epsilon = dialog.epsilon();          // maximum euclidean distance between point and shape.
-    op.cluster_epsilon = dialog.cluster_epsilon();    // maximum euclidean distance between points to be clustered.
-    op.normal_threshold = dialog.normal_tolerance();   // normal_threshold < dot(surface_normal, point_normal); maximum normal deviation.
-
-    // The actual shape detection.
-    shape_detection.detect(op);
-
-    std::cout << shape_detection.shapes().size() << " shapes found" << std::endl;
-    //print_message(QString("%1 shapes found.").arg(shape_detection.number_of_shapes()));
-    int index = 0;
-    BOOST_FOREACH(boost::shared_ptr<Shape_detection::Shape> shape, shape_detection.shapes())
-    {
-      CGAL::Shape_detection_3::Cylinder<Traits> *cyl;
-      cyl = dynamic_cast<CGAL::Shape_detection_3::Cylinder<Traits> *>(shape.get());
-      if (cyl != NULL){
-        if(cyl->radius() > diam){
-          continue;
-        }
-      }
-        
-      Scene_points_with_normal_item *point_item = new Scene_points_with_normal_item;
-      BOOST_FOREACH(std::size_t i, shape->indices_of_assigned_points())
-        point_item->point_set()->push_back((*points)[i]);
-      
-      unsigned char r, g, b;
-      r = static_cast<unsigned char>(64 + rand.get_int(0, 192));
-      g = static_cast<unsigned char>(64 + rand.get_int(0, 192));
-      b = static_cast<unsigned char>(64 + rand.get_int(0, 192));
-      point_item->setRbgColor(r, g, b);
-
-      // Providing a useful name consisting of the order of detection, name of type and number of inliers
-      std::stringstream ss;
-      if (dynamic_cast<CGAL::Shape_detection_3::Cylinder<Traits> *>(shape.get())){
-        CGAL::Shape_detection_3::Cylinder<Traits> * cyl 
-          = dynamic_cast<CGAL::Shape_detection_3::Cylinder<Traits> *>(shape.get());
-        ss << item->name().toStdString() << "_cylinder_" << cyl->radius() << "_";
-      }
-      else if (dynamic_cast<CGAL::Shape_detection_3::Plane<Traits> *>(shape.get()))
-        {
-          ss << item->name().toStdString() << "_plane_";
-
-          if (dialog.generate_alpha ())
-            {
-              // If plane, build alpha shape
-              Scene_polyhedron_item* poly_item = new Scene_polyhedron_item;
-
-              Plane_3 plane = (Plane_3)(*(dynamic_cast<CGAL::Shape_detection_3::Plane<Traits>*>(shape.get ())));
-              build_alpha_shape (*(point_item->point_set()), plane,
-                                 poly_item, dialog.cluster_epsilon());
-          
-              poly_item->setRbgColor(r-32, g-32, b-32);
-              poly_item->setName(QString("%1%2_alpha_shape").arg(QString::fromStdString(ss.str()))
-                                 .arg (QString::number (shape->indices_of_assigned_points().size())));
-              poly_item->setRenderingMode (Flat);
-              scene->addItem(poly_item);
-            }
-        }
-      else if (dynamic_cast<CGAL::Shape_detection_3::Cone<Traits> *>(shape.get()))
-        ss << item->name().toStdString() << "_cone_";
-      else if (dynamic_cast<CGAL::Shape_detection_3::Torus<Traits> *>(shape.get()))
-        ss << item->name().toStdString() << "_torus_";
-      else if (dynamic_cast<CGAL::Shape_detection_3::Sphere<Traits> *>(shape.get()))
-        ss << item->name().toStdString() << "_sphere_";
-
-
-      ss << shape->indices_of_assigned_points().size();
-
-      //names[i] = ss.str(		
-      point_item->setName(QString::fromStdString(ss.str()));
-      point_item->set_has_normals(true);
-      point_item->setRenderingMode(item->renderingMode());
-      if (dialog.generate_subset())
-        scene->addItem(point_item);
-      else
-        delete point_item;
-
-      ++index;
-    }
-
-    // Updates scene
-    scene->itemChanged(index);
-
-    QApplication::restoreOverrideCursor();
-
-    //     Warn user, maybe choice of parameters is unsuitable
-    //         if (nb_points_to_remove > 0)
-    //         {
-    //           QMessageBox::information(NULL,
-    //                                    tr("Points selected for removal"),
-    //                                    tr("%1 point(s) are selected for removal.\nYou may delete or reset the selection using the item context menu.")
-    //                                    .arg(nb_points_to_remove));
-    //         }
-    item->setVisible(false);
-  }
-}
-
-void Polyhedron_demo_point_set_shape_detection_plugin::build_alpha_shape
-(Point_set& points, const Plane_3& plane, Scene_polyhedron_item* item, double epsilon)
-{
-  typedef Kernel::Point_2  Point_2;
-  typedef CGAL::Alpha_shape_vertex_base_2<Kernel> Vb;
-  typedef CGAL::Alpha_shape_face_base_2<Kernel>  Fb;
-  typedef CGAL::Triangulation_data_structure_2<Vb,Fb> Tds;
-  typedef CGAL::Delaunay_triangulation_2<Kernel,Tds> Triangulation_2;
-  typedef CGAL::Alpha_shape_2<Triangulation_2>  Alpha_shape_2;
-
-
-  std::vector<Point_2> projections;
-  projections.reserve (points.size ());
-
-  for (std::size_t i = 0; i < points.size (); ++ i)
-    projections.push_back (plane.to_2d (points[i]));
-
-  Alpha_shape_2 ashape (projections.begin (), projections.end (), epsilon);
-  
-  std::map<Alpha_shape_2::Vertex_handle, std::size_t> map_v2i;
-
-  Scene_polygon_soup_item *soup_item = new Scene_polygon_soup_item;
-  
-  soup_item->init_polygon_soup(points.size(), ashape.number_of_faces ());
-  std::size_t current_index = 0;
-
-  for (Alpha_shape_2::Finite_faces_iterator it = ashape.finite_faces_begin ();
-       it != ashape.finite_faces_end (); ++ it)
-    {
-      if (ashape.classify (it) != Alpha_shape_2::INTERIOR)
-        continue;
-
-      for (int i = 0; i < 3; ++ i)
-        {
-          if (map_v2i.find (it->vertex (i)) == map_v2i.end ())
-            {
-              map_v2i.insert (std::make_pair (it->vertex (i), current_index ++));
-              Point p = plane.to_3d (it->vertex (i)->point ());
-              soup_item->new_vertex (p.x (), p.y (), p.z ());
-            }
-        }
-      soup_item->new_triangle (map_v2i[it->vertex (0)],
-                               map_v2i[it->vertex (1)],
-                               map_v2i[it->vertex (2)]);
-    }
-
-  soup_item->orient();
-  soup_item->exportAsPolyhedron (item->polyhedron());
-  
-  delete soup_item;
-}
-
-
-#include <QtPlugin>
-
-#include "Point_set_shape_detection_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.ui b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.ui
deleted file mode 100644
index 6b3c146..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.ui
+++ /dev/null
@@ -1,261 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>PointSetShapeDetectionDialog</class>
- <widget class="QDialog" name="PointSetShapeDetectionDialog">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>444</width>
-    <height>269</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Shape Detection</string>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout">
-   <item>
-    <layout class="QHBoxLayout" name="horizontalLayout_6">
-     <item>
-      <widget class="QCheckBox" name="planeCB">
-       <property name="text">
-        <string>Plane</string>
-       </property>
-       <property name="checked">
-        <bool>true</bool>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QCheckBox" name="cylinderCB">
-       <property name="text">
-        <string>Cylinder</string>
-       </property>
-       <property name="checked">
-        <bool>true</bool>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QCheckBox" name="torusCB">
-       <property name="text">
-        <string>Torus</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QCheckBox" name="coneCB">
-       <property name="text">
-        <string>Cone</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QCheckBox" name="sphereCB">
-       <property name="text">
-        <string>Sphere</string>
-       </property>
-      </widget>
-     </item>
-    </layout>
-   </item>
-   <item>
-    <layout class="QHBoxLayout" name="horizontalLayout_2">
-     <item>
-      <widget class="QLabel" name="label_2">
-       <property name="text">
-        <string>Epsilon:</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QDoubleSpinBox" name="m_epsilon_field">
-       <property name="toolTip">
-        <string>Fitting tolerance in Euclidean distance</string>
-       </property>
-       <property name="decimals">
-        <number>3</number>
-       </property>
-       <property name="maximum">
-        <double>1.000000000000000</double>
-       </property>
-       <property name="singleStep">
-        <double>0.001000000000000</double>
-       </property>
-       <property name="value">
-        <double>0.002000000000000</double>
-       </property>
-      </widget>
-     </item>
-    </layout>
-   </item>
-   <item>
-    <layout class="QHBoxLayout" name="horizontalLayout">
-     <item>
-      <widget class="QLabel" name="label">
-       <property name="text">
-        <string>Normal Tolerance:</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QDoubleSpinBox" name="m_normal_tolerance_field">
-       <property name="toolTip">
-        <string>Normal angle deviation tolerance as cosine of the angle</string>
-       </property>
-       <property name="singleStep">
-        <double>0.001000000000000</double>
-       </property>
-       <property name="value">
-        <double>0.900000000000000</double>
-       </property>
-      </widget>
-     </item>
-    </layout>
-   </item>
-   <item>
-    <layout class="QHBoxLayout" name="horizontalLayout_3">
-     <item>
-      <widget class="QLabel" name="label_3">
-       <property name="text">
-        <string>Minimum Numbr of Points:</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QSpinBox" name="m_min_pts_field">
-       <property name="toolTip">
-        <string>Smallest allowed size for a primitive</string>
-       </property>
-       <property name="maximum">
-        <number>10000</number>
-       </property>
-       <property name="singleStep">
-        <number>50</number>
-       </property>
-       <property name="value">
-        <number>100</number>
-       </property>
-      </widget>
-     </item>
-    </layout>
-   </item>
-   <item>
-    <layout class="QHBoxLayout" name="horizontalLayout_4">
-     <item>
-      <widget class="QLabel" name="label_4">
-       <property name="text">
-        <string>Connectivity Epsilon:</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QDoubleSpinBox" name="m_cluster_epsilon_field">
-       <property name="toolTip">
-        <string>Maximum world distance between points on a shape to be considered as connected</string>
-       </property>
-       <property name="decimals">
-        <number>2</number>
-       </property>
-       <property name="maximum">
-        <double>1.000000000000000</double>
-       </property>
-       <property name="singleStep">
-        <double>0.010000000000000</double>
-       </property>
-       <property name="value">
-        <double>0.020000000000000</double>
-       </property>
-      </widget>
-     </item>
-    </layout>
-   </item>
-   <item>
-    <layout class="QHBoxLayout" name="horizontalLayout_5">
-     <item>
-      <widget class="QLabel" name="label_5">
-       <property name="text">
-        <string>Search Rigorosity (Probability):</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QDoubleSpinBox" name="m_probability_field">
-       <property name="toolTip">
-        <string>Probability to overlook the largest primitive in one extraction iteration</string>
-       </property>
-       <property name="maximum">
-        <double>1.000000000000000</double>
-       </property>
-       <property name="singleStep">
-        <double>0.010000000000000</double>
-       </property>
-       <property name="value">
-        <double>0.050000000000000</double>
-       </property>
-      </widget>
-     </item>
-    </layout>
-   </item>
-   <item>
-    <widget class="QCheckBox" name="m_generate_alpha">
-     <property name="text">
-      <string>Generate Alpha Shapes for Planes</string>
-     </property>
-    </widget>
-   </item>
-   <item>
-    <widget class="QCheckBox" name="m_do_not_generate_subset">
-     <property name="text">
-      <string>Do Not Generate Point Subsets</string>
-     </property>
-    </widget>
-   </item>
-   <item>
-    <widget class="QDialogButtonBox" name="buttonBox">
-     <property name="orientation">
-      <enum>Qt::Horizontal</enum>
-     </property>
-     <property name="standardButtons">
-      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
-     </property>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <resources/>
- <connections>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>accepted()</signal>
-   <receiver>PointSetShapeDetectionDialog</receiver>
-   <slot>accept()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>248</x>
-     <y>254</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>157</x>
-     <y>274</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>rejected()</signal>
-   <receiver>PointSetShapeDetectionDialog</receiver>
-   <slot>reject()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>316</x>
-     <y>260</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>286</x>
-     <y>274</y>
-    </hint>
-   </hints>
-  </connection>
- </connections>
-</ui>
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_simplification_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_simplification_plugin.cpp
deleted file mode 100644
index 24e5700..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_simplification_plugin.cpp
+++ /dev/null
@@ -1,201 +0,0 @@
-#include "config.h"
-#include "Scene_points_with_normal_item.h"
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-
-#include <CGAL/grid_simplify_point_set.h>
-#include <CGAL/random_simplify_point_set.h>
-#include <CGAL/hierarchy_simplify_point_set.h>
-#include <CGAL/compute_average_spacing.h>
-#include <CGAL/Timer.h>
-#include <CGAL/Memory_sizer.h>
-
-#include <QObject>
-#include <QAction>
-#include <QMainWindow>
-#include <QApplication>
-#include <QtPlugin>
-#include <QMessageBox>
-
-#include "ui_Point_set_simplification_plugin.h"
-
-// Concurrency
-#ifdef CGAL_LINKED_WITH_TBB
-typedef CGAL::Parallel_tag Concurrency_tag;
-#else
-typedef CGAL::Sequential_tag Concurrency_tag;
-#endif
-
-
-using namespace CGAL::Three;
-class Polyhedron_demo_point_set_simplification_plugin :
-  public QObject,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-  QAction* actionSimplify;
-
-public:
-  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface) {
-    actionSimplify = new QAction(tr("Point Set Simplification Selection"), mainWindow);
-    actionSimplify->setObjectName("actionSimplify");
-
-    Polyhedron_demo_plugin_helper::init(mainWindow, scene_interface);
-  }
-
-  bool applicable(QAction*) const {
-    return qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
-  }
-
-  QList<QAction*> actions() const {
-    return QList<QAction*>() << actionSimplify;
-  }
-
-public Q_SLOTS:
-  void on_actionSimplify_triggered();
-
-
-}; // end Polyhedron_demo_point_set_simplification_plugin
-
-class Point_set_demo_point_set_simplification_dialog : public QDialog, private Ui::PointSetSimplificationDialog
-{
-  Q_OBJECT
-  public:
-    Point_set_demo_point_set_simplification_dialog(QWidget * /*parent*/ = 0)
-    {
-      setupUi(this);
-    }
-
-  unsigned int simplificationMethod() const
-  {
-    if (Random->isChecked())
-      return 0;
-    else if (Grid->isChecked())
-      return 1;
-    else
-      return 2;
-  }
-  double randomSimplificationPercentage() const { return m_randomSimplificationPercentage->value(); }
-  double gridCellSize() const { return m_gridCellSize->value(); }
-  unsigned int maximumClusterSize() const { return m_maximumClusterSize->value(); }
-  double maximumSurfaceVariation() const { return m_maximumSurfaceVariation->value(); }
-
-public Q_SLOTS:
-  
-  void on_Random_toggled (bool toggled)
-  {
-    m_randomSimplificationPercentage->setEnabled (toggled);
-    m_gridCellSize->setEnabled (!toggled);
-    m_maximumClusterSize->setEnabled (!toggled);
-    m_maximumSurfaceVariation->setEnabled (!toggled);
-  }
-  void on_Grid_toggled (bool toggled)
-  {
-    m_randomSimplificationPercentage->setEnabled (!toggled);
-    m_gridCellSize->setEnabled (toggled);
-    m_maximumClusterSize->setEnabled (!toggled);
-    m_maximumSurfaceVariation->setEnabled (!toggled);
-  }
-  void on_Hierarchy_toggled (bool toggled)
-  {
-    m_randomSimplificationPercentage->setEnabled (!toggled);
-    m_gridCellSize->setEnabled (!toggled);
-    m_maximumClusterSize->setEnabled (toggled);
-    m_maximumSurfaceVariation->setEnabled (toggled);
-  }
-
-};
-
-void Polyhedron_demo_point_set_simplification_plugin::on_actionSimplify_triggered()
-{
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-
-  Scene_points_with_normal_item* item =
-    qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
-
-  if(item)
-  {
-    // Gets point set
-    Point_set* points = item->point_set();
-    if(points == NULL)
-        return;
-
-    // Gets options
-    Point_set_demo_point_set_simplification_dialog dialog;
-    if(!dialog.exec())
-      return;
-
-    QApplication::setOverrideCursor(Qt::WaitCursor);
-
-    CGAL::Timer task_timer; task_timer.start();
-
-    // First point to delete
-    Point_set::iterator first_point_to_remove = points->end();
-
-    unsigned int method = dialog.simplificationMethod ();
-    if (method == 0)
-    {
-      std::cerr << "Point set random simplification (" << dialog.randomSimplificationPercentage() <<"%)...\n";
-
-      // Computes points to remove by random simplification
-      first_point_to_remove =
-        CGAL::random_simplify_point_set(points->begin(), points->end(),
-                                        dialog.randomSimplificationPercentage());
-    }
-    else if (method == 1)
-    {
-      std::cerr << "Point set grid simplification (cell size = " << dialog.gridCellSize() <<" * average spacing)...\n";
-
-      // Computes average spacing
-      double average_spacing = CGAL::compute_average_spacing<Concurrency_tag>(
-                                      points->begin(), points->end(),
-                                      6 /* knn = 1 ring */);
-
-      // Computes points to remove by Grid Clustering
-      first_point_to_remove =
-        CGAL::grid_simplify_point_set(points->begin(), points->end(),
-                                      dialog.gridCellSize()*average_spacing);
-    }
-    else
-    {
-      std::cerr << "Point set hierarchy simplification (cluster size = " << dialog.maximumClusterSize()
-		<< ", maximum variation = " << dialog.maximumSurfaceVariation() << ")...\n";
-
-      // Computes points to remove by Grid Clustering
-      first_point_to_remove =
-        CGAL::hierarchy_simplify_point_set(points->begin(), points->end(),
-					   dialog.maximumClusterSize(),
-					   dialog.maximumSurfaceVariation());
-    }
-
-    std::size_t nb_points_to_remove = std::distance(first_point_to_remove, points->end());
-    std::size_t memory = CGAL::Memory_sizer().virtual_size();
-    std::cerr << "Simplification: " << nb_points_to_remove << " point(s) are selected for removal ("
-                                    << task_timer.time() << " seconds, "
-                                    << (memory>>20) << " Mb allocated)"
-                                    << std::endl;
-
-    // Selects points to delete
-    points->set_first_selected(first_point_to_remove);
-
-    // Updates scene
-    item->invalidateOpenGLBuffers();
-    scene->itemChanged(index);
-
-    QApplication::restoreOverrideCursor();
-
-    // Warns user
-    if (nb_points_to_remove > 0)
-    {
-      QMessageBox::information(NULL,
-                               tr("Points selected for removal"),
-                               tr("%1 point(s) are selected for removal.\nYou may delete or reset the selection using the item context menu.")
-                               .arg(nb_points_to_remove));
-    }
-  }
-}
-
-#include "Point_set_simplification_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_simplification_plugin.ui b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_simplification_plugin.ui
deleted file mode 100644
index a75294b..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_simplification_plugin.ui
+++ /dev/null
@@ -1,204 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>PointSetSimplificationDialog</class>
- <widget class="QDialog" name="PointSetSimplificationDialog">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>450</width>
-    <height>251</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Simplification</string>
-  </property>
-  <layout class="QGridLayout">
-   <item row="7" column="0">
-    <widget class="QLabel" name="label_4">
-     <property name="text">
-      <string>Maximum Cluster Size</string>
-     </property>
-    </widget>
-   </item>
-   <item row="9" column="0" colspan="2">
-    <widget class="QDialogButtonBox" name="buttonBox">
-     <property name="orientation">
-      <enum>Qt::Horizontal</enum>
-     </property>
-     <property name="standardButtons">
-      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
-     </property>
-    </widget>
-   </item>
-   <item row="2" column="0">
-    <widget class="QRadioButton" name="Random">
-     <property name="text">
-      <string>Random</string>
-     </property>
-     <property name="checked">
-      <bool>true</bool>
-     </property>
-    </widget>
-   </item>
-   <item row="4" column="0">
-    <widget class="QRadioButton" name="Grid">
-     <property name="text">
-      <string>Grid</string>
-     </property>
-    </widget>
-   </item>
-   <item row="3" column="1">
-    <widget class="QDoubleSpinBox" name="m_randomSimplificationPercentage">
-     <property name="suffix">
-      <string> %</string>
-     </property>
-     <property name="decimals">
-      <number>2</number>
-     </property>
-     <property name="minimum">
-      <double>0.100000000000000</double>
-     </property>
-     <property name="maximum">
-      <double>100.000000000000000</double>
-     </property>
-     <property name="singleStep">
-      <double>0.100000000000000</double>
-     </property>
-     <property name="value">
-      <double>50.000000000000000</double>
-     </property>
-    </widget>
-   </item>
-   <item row="6" column="0">
-    <widget class="QRadioButton" name="Hierarchy">
-     <property name="text">
-      <string>Hierarchy</string>
-     </property>
-    </widget>
-   </item>
-   <item row="5" column="1">
-    <widget class="QDoubleSpinBox" name="m_gridCellSize">
-     <property name="enabled">
-      <bool>false</bool>
-     </property>
-     <property name="suffix">
-      <string> * average spacing</string>
-     </property>
-     <property name="decimals">
-      <number>2</number>
-     </property>
-     <property name="minimum">
-      <double>0.100000000000000</double>
-     </property>
-     <property name="maximum">
-      <double>10.000000000000000</double>
-     </property>
-     <property name="singleStep">
-      <double>0.100000000000000</double>
-     </property>
-     <property name="value">
-      <double>1.000000000000000</double>
-     </property>
-    </widget>
-   </item>
-   <item row="3" column="0">
-    <widget class="QLabel" name="label_2">
-     <property name="text">
-      <string>Points to Remove Randomly</string>
-     </property>
-    </widget>
-   </item>
-   <item row="5" column="0">
-    <widget class="QLabel" name="label_3">
-     <property name="text">
-      <string>Grid Cell Size</string>
-     </property>
-    </widget>
-   </item>
-   <item row="7" column="1">
-    <widget class="QSpinBox" name="m_maximumClusterSize">
-     <property name="enabled">
-      <bool>false</bool>
-     </property>
-     <property name="minimum">
-      <number>1</number>
-     </property>
-     <property name="maximum">
-      <number>2147483647</number>
-     </property>
-     <property name="value">
-      <number>10</number>
-     </property>
-    </widget>
-   </item>
-   <item row="8" column="0">
-    <widget class="QLabel" name="label_5">
-     <property name="text">
-      <string>Maximum Surface Variation</string>
-     </property>
-    </widget>
-   </item>
-   <item row="8" column="1">
-    <widget class="QDoubleSpinBox" name="m_maximumSurfaceVariation">
-     <property name="enabled">
-      <bool>false</bool>
-     </property>
-     <property name="suffix">
-      <string/>
-     </property>
-     <property name="decimals">
-      <number>5</number>
-     </property>
-     <property name="minimum">
-      <double>0.000010000000000</double>
-     </property>
-     <property name="maximum">
-      <double>0.333330000000000</double>
-     </property>
-     <property name="singleStep">
-      <double>0.012340000000000</double>
-     </property>
-     <property name="value">
-      <double>0.333330000000000</double>
-     </property>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <resources/>
- <connections>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>accepted()</signal>
-   <receiver>PointSetSimplificationDialog</receiver>
-   <slot>accept()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>248</x>
-     <y>254</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>157</x>
-     <y>274</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>rejected()</signal>
-   <receiver>PointSetSimplificationDialog</receiver>
-   <slot>reject()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>316</x>
-     <y>260</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>286</x>
-     <y>274</y>
-    </hint>
-   </hints>
-  </connection>
- </connections>
-</ui>
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_smoothing_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_smoothing_plugin.cpp
deleted file mode 100644
index 04aeec7..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_smoothing_plugin.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-#include "config.h"
-#include "Scene_points_with_normal_item.h"
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-
-#include <QObject>
-#include <QAction>
-#include <QMainWindow>
-#include <QApplication>
-#include <QtPlugin>
-#include <QInputDialog>
-
-#include <CGAL/jet_smooth_point_set.h>
-
-// Concurrency
-#ifdef CGAL_LINKED_WITH_TBB
-typedef CGAL::Parallel_tag Concurrency_tag;
-#else
-typedef CGAL::Sequential_tag Concurrency_tag;
-#endif
-
-using namespace CGAL::Three;
-class Polyhedron_demo_point_set_smoothing_plugin :
-  public QObject,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-  QAction* actionJetSmoothing;
-
-public:
-  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface) {
-    actionJetSmoothing = new QAction(tr("Point Set Jet Smoothing"), mainWindow);
-    actionJetSmoothing->setObjectName("actionJetSmoothing");
-
-    Polyhedron_demo_plugin_helper::init(mainWindow, scene_interface);
-  }
-
-  QList<QAction*> actions() const {
-    return QList<QAction*>() << actionJetSmoothing;
-  }
-
-  bool applicable(QAction*) const { 
-    return qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
-  }
-
-public Q_SLOTS:
-  void on_actionJetSmoothing_triggered();
-
-}; // end Polyhedron_demo_point_set_smoothing_plugin
-
-void Polyhedron_demo_point_set_smoothing_plugin::on_actionJetSmoothing_triggered()
-{
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-
-  Scene_points_with_normal_item* item =
-    qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
-
-  if(item)
-  {
-    Point_set* points = item->point_set();
-    if(!points) return;
-
-    // Gets options
-    bool ok;
-
-    const unsigned int nb_neighbors =
-      QInputDialog::getInt((QWidget*)mw,
-                           tr("Jet Smoothing"), // dialog title
-                           tr("Number of neighbors:"), // field label
-                           24, // default value = fast
-                           6, // min
-                           1000, // max
-                           1, // step
-                           &ok);
-    if(!ok) return;
-
-    QApplication::setOverrideCursor(Qt::WaitCursor);
-
-    CGAL::jet_smooth_point_set<Concurrency_tag>(points->begin(), points->end(), nb_neighbors);
-
-    points->invalidate_bounds();
-
-    // calling jet_smooth_point_set breaks the normals
-    item->set_has_normals(false);
-
-    // update scene
-    item->invalidateOpenGLBuffers();
-    scene->itemChanged(index);
-
-    QApplication::restoreOverrideCursor();
-  }
-}
-
-#include "Point_set_smoothing_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_upsampling_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_upsampling_plugin.cpp
deleted file mode 100644
index 5f452e3..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_upsampling_plugin.cpp
+++ /dev/null
@@ -1,146 +0,0 @@
-#include "config.h"
-#include "Scene_points_with_normal_item.h"
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-
-#include <CGAL/compute_average_spacing.h>
-#include <CGAL/edge_aware_upsample_point_set.h>
-#include <CGAL/Timer.h>
-#include <CGAL/Memory_sizer.h>
-
-#include <QObject>
-#include <QAction>
-#include <QMainWindow>
-#include <QApplication>
-#include <QtPlugin>
-#include <QMessageBox>
-
-#include "ui_Point_set_upsampling_plugin.h"
-// Concurrency
-#ifdef CGAL_LINKED_WITH_TBB
-typedef CGAL::Parallel_tag Concurrency_tag;
-#else
-typedef CGAL::Sequential_tag Concurrency_tag;
-#endif
- 
-using namespace CGAL::Three;
-class Polyhedron_demo_point_set_upsampling_plugin :
-  public QObject,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-  
-  QAction* actionEdgeAwareUpsampling;
-
-public:
-  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface) {
-    actionEdgeAwareUpsampling = new QAction(tr("Point Set Edge Aware Upsampling"), mainWindow);
-    actionEdgeAwareUpsampling->setObjectName("actionEdgeAwareUpsampling");
-
-    Polyhedron_demo_plugin_helper::init(mainWindow, scene_interface);
-  }
-
-  bool applicable(QAction*) const {
-    return qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
-  }
-
-  QList<QAction*> actions() const {
-    return QList<QAction*>() << actionEdgeAwareUpsampling;
-  }
-
-public Q_SLOTS:
-  void on_actionEdgeAwareUpsampling_triggered();
-
-}; // end Polyhedron_demo_point_set_upsampling_plugin
-
-class Point_set_demo_point_set_upsampling_dialog : public QDialog, private Ui::PointSetUpsamplingDialog
-{
-  
-  Q_OBJECT
-public:
-  Point_set_demo_point_set_upsampling_dialog(QWidget * /*parent*/ = 0)
-  {
-    setupUi(this);
-  }
-
-  unsigned int sharpness_angle () const { return m_sharpnessAngle->value(); }
-  double edge_sensitivity() const { return m_edgeSensitivity->value(); }
-  double neighborhood_radius () const { return m_neighborhoodRadius->value(); }
-  double output_size () const { return m_outputSize->value(); }
-
-};
-
-void Polyhedron_demo_point_set_upsampling_plugin::on_actionEdgeAwareUpsampling_triggered()
-{
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-
-  Scene_points_with_normal_item* item =
-    qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
-
-  if(item)
-    {
-      if (!(item->has_normals ()))
-	{
-	  std::cerr << "Error: upsampling algorithm requires point set with normals." << std::endl;
-	  return;
-	}
-      
-      // Gets point set
-      Point_set* points = item->point_set();
-      if(points == NULL)
-        return;
-
-      // Gets options
-      Point_set_demo_point_set_upsampling_dialog dialog;
-      if(!dialog.exec())
-	return;
-
-      unsigned int output_size = static_cast<unsigned int>(dialog.output_size ()
-							   * points->size ());
-      std::cerr << "Edge aware upsampling (sharpness angle = "
-		<< dialog.sharpness_angle () << ", edge sensitivity = "
-		<< dialog.edge_sensitivity () << ", neighborhood radius = "
-		<< dialog.neighborhood_radius () << " * average spacing, output size = "
-		<< output_size << "...\n";
-
-      QApplication::setOverrideCursor(Qt::WaitCursor);
-
-      CGAL::Timer task_timer; task_timer.start();
-
-      // Computes average spacing
-      double average_spacing = CGAL::compute_average_spacing<Concurrency_tag>(
-                                      points->begin(), points->end(),
-                                      6 /* knn = 1 ring */);
-
-      std::vector<std::pair<Point_set::Point, Point_set::Vector> > new_points;
-      CGAL::edge_aware_upsample_point_set<Concurrency_tag>(points->begin(), 
-					  points->end(), 
-					  std::back_inserter(new_points),
-					  CGAL::make_identity_property_map(Point_set::value_type()),
-					  CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()),
-					  dialog.sharpness_angle(), 
-					  dialog.edge_sensitivity(),
-					  dialog.neighborhood_radius() * average_spacing,
-					  output_size);
-
-      for (unsigned int i = 0; i < new_points.size (); ++ i)
-	points->push_back (Point_set::Point_with_normal (new_points[i].first,
-							 new_points[i].second));
-      
-      std::size_t memory = CGAL::Memory_sizer().virtual_size();
-      std::cerr << task_timer.time() << " seconds, "
-		<< (memory>>20) << " Mb allocated)"
-		<< std::endl;
-
-      // Updates scene
-      item->invalidateOpenGLBuffers();
-      scene->itemChanged(index);
-
-      QApplication::restoreOverrideCursor();
-
-    }
-}
-
-#include "Point_set_upsampling_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_upsampling_plugin.ui b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_upsampling_plugin.ui
deleted file mode 100644
index 564b6e2..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_upsampling_plugin.ui
+++ /dev/null
@@ -1,156 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>PointSetUpsamplingDialog</class>
- <widget class="QDialog" name="PointSetUpsamplingDialog">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>443</width>
-    <height>175</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Edge Aware Upsampling</string>
-  </property>
-  <layout class="QGridLayout">
-   <item row="0" column="0">
-    <widget class="QLabel" name="label_4">
-     <property name="text">
-      <string>Sharpness Angle</string>
-     </property>
-    </widget>
-   </item>
-   <item row="3" column="0">
-    <widget class="QLabel" name="label">
-     <property name="text">
-      <string>Neighborhood Radius</string>
-     </property>
-    </widget>
-   </item>
-   <item row="2" column="0">
-    <widget class="QLabel" name="label_5">
-     <property name="text">
-      <string>Edge Sensitivity</string>
-     </property>
-    </widget>
-   </item>
-   <item row="5" column="0" colspan="2">
-    <widget class="QDialogButtonBox" name="buttonBox">
-     <property name="orientation">
-      <enum>Qt::Horizontal</enum>
-     </property>
-     <property name="standardButtons">
-      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
-     </property>
-    </widget>
-   </item>
-   <item row="4" column="0">
-    <widget class="QLabel" name="label_2">
-     <property name="text">
-      <string>Output Size</string>
-     </property>
-    </widget>
-   </item>
-   <item row="2" column="1">
-    <widget class="QDoubleSpinBox" name="m_edgeSensitivity">
-     <property name="maximum">
-      <double>1.000000000000000</double>
-     </property>
-     <property name="singleStep">
-      <double>0.010000000000000</double>
-     </property>
-    </widget>
-   </item>
-   <item row="4" column="1">
-    <widget class="QDoubleSpinBox" name="m_outputSize">
-     <property name="prefix">
-      <string/>
-     </property>
-     <property name="suffix">
-      <string> * input size</string>
-     </property>
-     <property name="minimum">
-      <double>1.000000000000000</double>
-     </property>
-     <property name="maximum">
-      <double>1000.000000000000000</double>
-     </property>
-     <property name="value">
-      <double>4.000000000000000</double>
-     </property>
-    </widget>
-   </item>
-   <item row="0" column="1">
-    <widget class="QSpinBox" name="m_sharpnessAngle">
-     <property name="suffix">
-      <string>°</string>
-     </property>
-     <property name="maximum">
-      <number>90</number>
-     </property>
-     <property name="value">
-      <number>25</number>
-     </property>
-    </widget>
-   </item>
-   <item row="3" column="1">
-    <widget class="QDoubleSpinBox" name="m_neighborhoodRadius">
-     <property name="suffix">
-      <string> * average spacing</string>
-     </property>
-     <property name="decimals">
-      <number>2</number>
-     </property>
-     <property name="minimum">
-      <double>0.100000000000000</double>
-     </property>
-     <property name="maximum">
-      <double>10.000000000000000</double>
-     </property>
-     <property name="singleStep">
-      <double>0.100000000000000</double>
-     </property>
-     <property name="value">
-      <double>3.000000000000000</double>
-     </property>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <resources/>
- <connections>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>accepted()</signal>
-   <receiver>PointSetUpsamplingDialog</receiver>
-   <slot>accept()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>248</x>
-     <y>254</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>157</x>
-     <y>274</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>rejected()</signal>
-   <receiver>PointSetUpsamplingDialog</receiver>
-   <slot>reject()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>316</x>
-     <y>260</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>286</x>
-     <y>274</y>
-    </hint>
-   </hints>
-  </connection>
- </connections>
-</ui>
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_wlop_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_wlop_plugin.cpp
deleted file mode 100644
index 17ff3f3..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_wlop_plugin.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-#include "config.h"
-#include "Scene_points_with_normal_item.h"
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-
-#include <CGAL/wlop_simplify_and_regularize_point_set.h>
-#include <CGAL/compute_average_spacing.h>
-#include <CGAL/Timer.h>
-#include <CGAL/Memory_sizer.h>
-
-#include <QObject>
-#include <QAction>
-#include <QMainWindow>
-#include <QApplication>
-#include <QtPlugin>
-#include <QMessageBox>
-
-#include "ui_Point_set_wlop_plugin.h"
-
-// Concurrency
-#ifdef CGAL_LINKED_WITH_TBB
-typedef CGAL::Parallel_tag Concurrency_tag;
-#else
-typedef CGAL::Sequential_tag Concurrency_tag;
-#endif
-
-using namespace CGAL::Three;
-class Polyhedron_demo_point_set_wlop_plugin :
-  public QObject,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-  
-  QAction* actionSimplifyAndRegularize;
-
-public:
-  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface) {
-    actionSimplifyAndRegularize = new QAction(tr("Point Set WLOP Simplification and Regularization Selection"), mainWindow);
-    actionSimplifyAndRegularize->setObjectName("actionSimplifyAndRegularize");
-
-    Polyhedron_demo_plugin_helper::init(mainWindow, scene_interface);
-  }
-
-  bool applicable(QAction*) const {
-    return qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
-  }
-
-  QList<QAction*> actions() const {
-    return QList<QAction*>() << actionSimplifyAndRegularize;
-  }
-
-public Q_SLOTS:
-  void on_actionSimplifyAndRegularize_triggered();
-
-}; // end Polyhedron_demo_point_set_wlop_plugin
-
-class Point_set_demo_point_set_wlop_simplification_and_regularization_dialog : public QDialog, private Ui::WLOPRegularizationAndSimplificationDialog
-{
-  Q_OBJECT
-  public:
-    Point_set_demo_point_set_wlop_simplification_and_regularization_dialog(QWidget * /*parent*/ = 0)
-    {
-      setupUi(this);
-    }
-
-    double retainedPercentage() const { return m_retainedPercentage->value(); }
-    double neighborhoodRadius() const { return m_neighborhoodRadius->value(); }
-};
-
-void Polyhedron_demo_point_set_wlop_plugin::on_actionSimplifyAndRegularize_triggered()
-{
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-
-  Scene_points_with_normal_item* item =
-    qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
-
-  if(item)
-  {
-    // Gets point set
-    Point_set* points = item->point_set();
-    if(points == NULL)
-        return;
-
-    // Gets options
-    Point_set_demo_point_set_wlop_simplification_and_regularization_dialog dialog;
-    if(!dialog.exec())
-      return;
-
-    QApplication::setOverrideCursor(Qt::WaitCursor);
-
-    CGAL::Timer task_timer; task_timer.start();
-
-    std::cerr << "Point cloud simplification and regularization by WLOP ("
-	      << dialog.retainedPercentage () << "% retained points, neighborhood radius = "
-	      << dialog.neighborhoodRadius() <<" * average spacing)...\n";
-
-    // Computes average spacing
-    double average_spacing = CGAL::compute_average_spacing<Concurrency_tag>(points->begin(), points->end(),
-							   6 /* knn = 1 ring */);
-
-    Scene_points_with_normal_item* new_item
-      = new Scene_points_with_normal_item();
-    new_item->setName (tr("%1 (WLOP processed)").arg(item->name()));
-    new_item->setVisible(true);
-    scene->addItem(new_item);
-      
-    CGAL::wlop_simplify_and_regularize_point_set<Concurrency_tag>
-      (points->begin(),
-       points->end(),
-       std::back_inserter(*(new_item->point_set ())),
-       dialog.retainedPercentage (),
-       dialog.neighborhoodRadius()*average_spacing
-       );
-
-    std::size_t memory = CGAL::Memory_sizer().virtual_size();
-    std::cerr << "Simplification and regularization: "
-	      << new_item->point_set ()->size () << " point(s) created ("
-	      << task_timer.time() << " seconds, "
-	      << (memory>>20) << " Mb allocated)"
-	      << std::endl;
-
-    QApplication::restoreOverrideCursor();
-  }
-}
-
-#include "Point_set_wlop_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_wlop_plugin.ui b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_wlop_plugin.ui
deleted file mode 100644
index dc2a9a4..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_wlop_plugin.ui
+++ /dev/null
@@ -1,122 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>WLOPRegularizationAndSimplificationDialog</class>
- <widget class="QDialog" name="WLOPRegularizationAndSimplificationDialog">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>292</width>
-    <height>109</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>WLOP Simplification and Regularization</string>
-  </property>
-  <layout class="QGridLayout">
-   <item row="0" column="0">
-    <widget class="QLabel" name="label_2">
-     <property name="text">
-      <string>Retained Percentage</string>
-     </property>
-    </widget>
-   </item>
-   <item row="0" column="1">
-    <widget class="QDoubleSpinBox" name="m_retainedPercentage">
-     <property name="suffix">
-      <string> %</string>
-     </property>
-     <property name="decimals">
-      <number>2</number>
-     </property>
-     <property name="minimum">
-      <double>0.100000000000000</double>
-     </property>
-     <property name="maximum">
-      <double>100.000000000000000</double>
-     </property>
-     <property name="singleStep">
-      <double>0.100000000000000</double>
-     </property>
-     <property name="value">
-      <double>50.000000000000000</double>
-     </property>
-    </widget>
-   </item>
-   <item row="1" column="0">
-    <widget class="QLabel" name="label_3">
-     <property name="text">
-      <string>Neighborhood Radius</string>
-     </property>
-    </widget>
-   </item>
-   <item row="1" column="1">
-    <widget class="QDoubleSpinBox" name="m_neighborhoodRadius">
-     <property name="suffix">
-      <string> * average spacing</string>
-     </property>
-     <property name="decimals">
-      <number>2</number>
-     </property>
-     <property name="minimum">
-      <double>0.100000000000000</double>
-     </property>
-     <property name="maximum">
-      <double>10.000000000000000</double>
-     </property>
-     <property name="singleStep">
-      <double>0.100000000000000</double>
-     </property>
-     <property name="value">
-      <double>1.000000000000000</double>
-     </property>
-    </widget>
-   </item>
-   <item row="2" column="0" colspan="2">
-    <widget class="QDialogButtonBox" name="buttonBox">
-     <property name="orientation">
-      <enum>Qt::Horizontal</enum>
-     </property>
-     <property name="standardButtons">
-      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
-     </property>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <resources/>
- <connections>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>accepted()</signal>
-   <receiver>WLOPRegularizationAndSimplificationDialog</receiver>
-   <slot>accept()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>248</x>
-     <y>254</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>157</x>
-     <y>274</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>rejected()</signal>
-   <receiver>WLOPRegularizationAndSimplificationDialog</receiver>
-   <slot>reject()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>316</x>
-     <y>260</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>286</x>
-     <y>274</y>
-    </hint>
-   </hints>
-  </connection>
- </connections>
-</ui>
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_plugin.cpp
deleted file mode 100644
index 719bc01..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_plugin.cpp
+++ /dev/null
@@ -1,873 +0,0 @@
-#include <QTime>
-#include <QApplication>
-#include <QAction>
-#include <QList>
-#include <QMainWindow>
-#include <QObject>
-
-#include <fstream>
-
-#include "Scene_polygon_soup_item.h"
-#include "Scene_polyhedron_item.h"
-#include "Scene_points_with_normal_item.h"
-#include "Polyhedron_type.h"
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-
-#include <CGAL/array.h>
-#include <CGAL/centroid.h>
-#include <CGAL/PCA_util.h>
-#include <CGAL/Search_traits_3.h>
-#include <CGAL/squared_distance_3.h>
-#include <CGAL/Orthogonal_k_neighbor_search.h>
-#include <CGAL/Default_diagonalize_traits.h>
-#include <CGAL/compute_average_spacing.h>
-#include <CGAL/grid_simplify_point_set.h>
-#include <CGAL/jet_smooth_point_set.h>
-#include <CGAL/jet_estimate_normals.h>
-#include <CGAL/mst_orient_normals.h>
-#include <CGAL/Scale_space_surface_reconstruction_3.h>
-#include <CGAL/Advancing_front_surface_reconstruction.h>
-
-#include "ui_Surface_reconstruction_plugin.h"
-
-// Concurrency
-#ifdef CGAL_LINKED_WITH_TBB
-typedef CGAL::Parallel_tag Concurrency_tag;
-#else
-typedef CGAL::Sequential_tag Concurrency_tag;
-#endif
-
-
-// Poisson reconstruction method:
-// Reconstructs a surface mesh from a point set and returns it as a polyhedron.
-Polyhedron* poisson_reconstruct(const Point_set& points,
-                                Kernel::FT sm_angle, // Min triangle angle (degrees). 
-                                Kernel::FT sm_radius, // Max triangle size w.r.t. point set average spacing. 
-                                Kernel::FT sm_distance, // Approximation error w.r.t. point set average spacing.
-                                const QString& solver, // solver name
-                                bool use_two_passes,
-				bool do_not_fill_holes);
-
-
-struct Radius {
-
-  double bound;
-
-  Radius(double bound)
-    : bound(bound)
-  {}
-
-  template <typename AdvancingFront, typename Cell_handle>
-  double operator() (const AdvancingFront& adv, Cell_handle& c,
-                     const int& index) const
-  {
-    // bound == 0 is better than bound < infinity
-    // as it avoids the distance computations
-    if(bound == 0){
-      return adv.smallest_radius_delaunay_sphere (c, index);
-    }
-
-    // If radius > bound, return infinity so that facet is not used
-    double d  = 0;
-    d = sqrt(squared_distance(c->vertex((index+1)%4)->point(),
-                              c->vertex((index+2)%4)->point()));
-    if(d>bound) return adv.infinity();
-    d = sqrt(squared_distance(c->vertex((index+2)%4)->point(),
-                               c->vertex((index+3)%4)->point()));
-    if(d>bound) return adv.infinity();
-    d = sqrt(squared_distance(c->vertex((index+1)%4)->point(),
-                               c->vertex((index+3)%4)->point()));
-    if(d>bound) return adv.infinity();
-
-    // Otherwise, return usual priority value: smallest radius of
-    // delaunay sphere
-    return adv.smallest_radius_delaunay_sphere (c, index);
-  }
-
-};
-
-
-namespace SurfaceReconstruction
-{
-  typedef Kernel::Point_3 Point;
-  typedef Kernel::Vector_3 Vector;
-  // types for K nearest neighbors search
-  typedef CGAL::Search_traits_3<Kernel> Tree_traits;
-  typedef CGAL::Orthogonal_k_neighbor_search<Tree_traits> Neighbor_search;
-  typedef Neighbor_search::Tree Tree;
-  typedef Neighbor_search::iterator Search_iterator;
-
-  typedef CGAL::Scale_space_surface_reconstruction_3<Kernel> ScaleSpace;
-  
-  template <typename OutputIterator>
-  void generate_scales (OutputIterator out,
-			const unsigned int scale_min = 6,
-			const double factor = 1.15,
-			unsigned int nb_scales = 30)
-  {
-    unsigned int prev = -1;
-    
-    for (unsigned int i = 0; i < nb_scales; ++ i)
-      {
-	unsigned int current = static_cast<unsigned int>(scale_min * std::pow (factor, i));
-	if (current != prev)
-	  {
-	    *(out ++) = current;
-	    prev = current;
-	  }
-	else
-	  ++ nb_scales;
-      }
-  }
-  
-  unsigned int scale_of_anisotropy (const Point_set& points, double& size)
-  {
-    Tree tree(points.begin(), points.end());
-    
-    double ratio_kept = (points.size() < 1000)
-      ? 1. : 1000. / (points.size());
-    
-    std::vector<Point> subset;
-    for (std::size_t i = 0; i < points.size (); ++ i)
-      if (rand() / (double)RAND_MAX < ratio_kept)
-    	subset.push_back (points[i]);
-    
-    std::vector<unsigned int> scales;
-    generate_scales (std::back_inserter (scales));
-
-    std::vector<unsigned int> chosen;
-
-    for (std::size_t i = 0; i < subset.size (); ++ i)
-      {
-    	Neighbor_search search(tree, subset[i],scales.back());
-	double current = 0.;
-    	unsigned int nb = 0;
-    	std::size_t index = 0;
-	double maximum = 0.;
-	unsigned int c = 0;
-	
-    	for (Search_iterator search_iterator = search.begin();
-    	     search_iterator != search.end (); ++ search_iterator, ++ nb)
-    	  {
-	    current += search_iterator->second;
-
-    	    if (nb + 1 == scales[index])
-    	      {
-		double score = std::sqrt (current / scales[index])
-		  / std::pow (scales[index], 0.75); // NB ^ (3/4)
-
-		if (score > maximum)
-		  {
-		    maximum = score;
-		    c = scales[index];
-		  }
-
-    		++ index;
-    		if (index == scales.size ())
-    		  break;
-    	      }
-    	  }
-	chosen.push_back (c);
-      }
-
-    double mean = 0.;
-    for (std::size_t i = 0; i < chosen.size(); ++ i)
-      mean += chosen[i];
-    mean /= chosen.size();
-    unsigned int aniso_scale = static_cast<unsigned int>(mean);
-
-    size = 0.;
-    for (std::size_t i = 0; i < subset.size (); ++ i)
-      {
-    	Neighbor_search search(tree, subset[i], aniso_scale);
-	size += std::sqrt ((-- search.end())->second);
-      }
-    size /= subset.size();
-    
-    return aniso_scale;
-  }
-
-  
-  unsigned int scale_of_noise (const Point_set& points, double& size)
-  {
-    Tree tree(points.begin(), points.end());
-    
-    double ratio_kept = (points.size() < 1000)
-      ? 1. : 1000. / (points.size());
-    
-    std::vector<Point> subset;
-    for (std::size_t i = 0; i < points.size (); ++ i)
-      if (rand() / (double)RAND_MAX < ratio_kept)
-    	subset.push_back (points[i]);
-    
-    std::vector<unsigned int> scales;
-    generate_scales (std::back_inserter (scales));
-
-    std::vector<unsigned int> chosen;
-    
-    for (std::size_t i = 0; i < subset.size (); ++ i)
-      {
-    	Neighbor_search search(tree, subset[i],scales.back());
-	double current = 0.;
-    	unsigned int nb = 0;
-    	std::size_t index = 0;
-	double minimum = (std::numeric_limits<double>::max)();
-	unsigned int c = 0;
-	
-    	for (Search_iterator search_iterator = search.begin();
-    	     search_iterator != search.end (); ++ search_iterator, ++ nb)
-    	  {
-	    current += search_iterator->second;
-
-    	    if (nb + 1 == scales[index])
-    	      {
-		double score = std::sqrt (current / scales[index])
-		  / std::pow (scales[index], 0.375); // NB ^ (5/12)
-
-		if (score < minimum)
-		  {
-		    minimum = score;
-		    c = scales[index];
-		  }
-
-    		++ index;
-    		if (index == scales.size ())
-    		  break;
-    	      }
-    	  }
-	chosen.push_back (c);
-      }
-
-    std::sort (chosen.begin (), chosen.end());
-
-    unsigned int noise_scale = chosen[chosen.size() / 2];
-    size = 0.;
-    for (std::size_t i = 0; i < subset.size (); ++ i)
-      {
-    	Neighbor_search search(tree, subset[i], noise_scale);
-	size += std::sqrt ((-- search.end())->second);
-      }
-    size /= subset.size();
-
-    
-    return noise_scale;
-  }
-
-  void simplify_point_set (Point_set& points, double size)
-  {
-    points.erase (CGAL::grid_simplify_point_set (points.begin (), points.end (), size),
-		  points.end ());
-  }
-
-  void smooth_point_set (Point_set& points, unsigned int scale)
-  {
-    CGAL::jet_smooth_point_set<Concurrency_tag>(points.begin(), points.end(),
-                                                scale);
-  }
-
-  template <typename ItemsInserter>
-  void scale_space (const Point_set& points, ItemsInserter items,
-		    unsigned int scale, bool generate_smooth = false,
-                    bool separate_shells = false, bool force_manifold = true,
-                    unsigned int samples = 300, unsigned int iterations = 4)
-  {
-    ScaleSpace reconstruct (scale, samples);
-    reconstruct.reconstruct_surface(points.begin (), points.end (), iterations,
-                                    separate_shells, force_manifold);
-
-    for( unsigned int sh = 0; sh < reconstruct.number_of_shells(); ++sh )
-      {
-        Scene_polygon_soup_item* new_item
-          = new Scene_polygon_soup_item ();
-        new_item->setColor(Qt::magenta);
-        new_item->setRenderingMode(FlatPlusEdges);
-        new_item->init_polygon_soup(points.size(), reconstruct.number_of_triangles ());
-
-        Scene_polygon_soup_item* smooth_item = NULL;
-        if (generate_smooth)
-          {
-            smooth_item = new Scene_polygon_soup_item ();
-            smooth_item->setColor(Qt::magenta);
-            smooth_item->setRenderingMode(FlatPlusEdges);
-            smooth_item->init_polygon_soup(points.size(), reconstruct.number_of_triangles ());
-          }
-
-        std::map<unsigned int, unsigned int> map_i2i;
-        unsigned int current_index = 0;
-    
-        for (ScaleSpace::Triple_iterator it = reconstruct.shell_begin (sh);
-             it != reconstruct.shell_end (sh); ++ it)
-          {
-            for (unsigned int ind = 0; ind < 3; ++ ind)
-              {
-                if (map_i2i.find ((*it)[ind]) == map_i2i.end ())
-                  {
-                    map_i2i.insert (std::make_pair ((*it)[ind], current_index ++));
-                    Point p = points[(*it)[ind]].position();
-                    new_item->new_vertex (p.x (), p.y (), p.z ());
-                    
-                    if (generate_smooth)
-                      {
-                        p = *(reconstruct.points_begin() + (*it)[ind]);
-                        smooth_item->new_vertex (p.x (), p.y (), p.z ());
-                      }
-                  }
-              }
-            new_item->new_triangle( map_i2i[(*it)[0]],
-                                    map_i2i[(*it)[1]],
-                                    map_i2i[(*it)[2]] );
-            if (generate_smooth)
-              smooth_item->new_triangle( map_i2i[(*it)[0]],
-                                         map_i2i[(*it)[1]],
-                                         map_i2i[(*it)[2]] );
-              
-          }
-
-        *(items ++) = new_item;
-        if (generate_smooth)
-          *(items ++) = smooth_item;
-      }
-
-    if (force_manifold)
-      {
-        std::ptrdiff_t num = std::distance( reconstruct.garbage_begin(  ),
-                                            reconstruct.garbage_end(  ) );
-
-        Scene_polygon_soup_item* new_item
-          = new Scene_polygon_soup_item ();
-        new_item->setColor(Qt::blue);
-        new_item->setRenderingMode(FlatPlusEdges);
-        new_item->init_polygon_soup(points.size(), num);
-
-        Scene_polygon_soup_item* smooth_item = NULL;
-        if (generate_smooth)
-          {
-            smooth_item = new Scene_polygon_soup_item ();
-            smooth_item->setColor(Qt::blue);
-            smooth_item->setRenderingMode(FlatPlusEdges);
-            smooth_item->init_polygon_soup(points.size(), num);
-          }
-
-        std::map<unsigned int, unsigned int> map_i2i;
-
-        unsigned int current_index = 0;
-        for (ScaleSpace::Triple_iterator it=reconstruct.garbage_begin(),
-               end=reconstruct.garbage_end();it!=end;++it)
-          {
-            for (unsigned int ind = 0; ind < 3; ++ ind)
-              {
-                if (map_i2i.find ((*it)[ind]) == map_i2i.end ())
-                  {
-                    map_i2i.insert (std::make_pair ((*it)[ind], current_index ++));
-                    Point p = points[(*it)[ind]].position();
-                    new_item->new_vertex (p.x (), p.y (), p.z ());
-                    
-                    if (generate_smooth)
-                      {
-                        p = *(reconstruct.points_begin() + (*it)[ind]);
-                        smooth_item->new_vertex (p.x (), p.y (), p.z ());
-                      }
-                  }
-
-              }
-            new_item->new_triangle( map_i2i[(*it)[0]],
-                                    map_i2i[(*it)[1]],
-                                    map_i2i[(*it)[2]] );
-            if (generate_smooth)
-              smooth_item->new_triangle( map_i2i[(*it)[0]],
-                                         map_i2i[(*it)[1]],
-                                         map_i2i[(*it)[2]] );
-          }
-
-        *(items ++) = new_item;
-        if (generate_smooth)
-          *(items ++) = smooth_item;
-
-      }
-  }
-  
-  void advancing_front (const Point_set& points, Scene_polyhedron_item* new_item, double size,
-                        double radius_ratio_bound = 5., double beta = 0.52)
-  {
-    Polyhedron& P = * const_cast<Polyhedron*>(new_item->polyhedron());
-    Radius filter (size);
-
-    CGAL::advancing_front_surface_reconstruction (points.begin (), points.end (), P, filter,
-                                                  radius_ratio_bound, beta);
-						  
-  }
-
-  void compute_normals (Point_set& points, unsigned int neighbors)
-  {
-    CGAL::jet_estimate_normals<Concurrency_tag>(points.begin(), points.end(),
-                                                CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()),
-                                                2 * neighbors);
-    
-    points.erase (CGAL::mst_orient_normals (points.begin(), points.end(),
-					    CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()),
-					    2 * neighbors),
-		  points.end ());
-  }
-  
-}
-
-
-
-class Polyhedron_demo_surface_reconstruction_plugin_dialog : public QDialog, private Ui::SurfaceReconstructionDialog
-{
-  Q_OBJECT
-public:
-  Polyhedron_demo_surface_reconstruction_plugin_dialog(QWidget* /*parent*/ = 0)
-  {
-    setupUi(this);
-    
-#ifdef CGAL_EIGEN3_ENABLED
-    m_inputSolver->addItem("Eigen - built-in CG");
-    m_inputSolver->addItem("Eigen - built-in simplicial LDLt");
-#endif
-  }
-
-  unsigned int method () const
-  {
-    if (buttonAuto->isChecked ())       return 0;
-    if (buttonAdvancing->isChecked ())  return 1;
-    if (buttonScaleSpace->isChecked ()) return 2;
-    if (buttonPoisson->isChecked ())    return 3;
-    return -1;
-  }
-  bool boundaries () const { return m_boundaries->isChecked (); }
-  bool interpolate () const { return m_interpolate->isChecked (); }
-  double longest_edge () const { return m_longestEdge->value (); }
-  double radius_ratio_bound () const { return m_radiusRatioBound->value (); }
-  double beta_angle () const { return m_betaAngle->value (); }
-  unsigned int neighbors () const { return m_neighbors->value (); }
-  unsigned int samples () const { return m_samples->value (); }
-  unsigned int iterations () const { return m_iterations->value (); }
-  bool separate_shells () const { return m_genShells->isChecked (); }
-  bool force_manifold () const { return m_forceManifold->isChecked (); }
-  bool generate_smoothed () const { return m_genSmooth->isChecked (); }
-  double angle () const { return m_inputAngle->value (); }
-  double radius () const { return m_inputRadius->value (); }
-  double distance () const { return m_inputDistance->value (); }
-  bool two_passes () const { return m_inputTwoPasses->isChecked (); }
-  bool do_not_fill_holes () const { return m_doNotFillHoles->isChecked (); }
-  QString solver () const { return m_inputSolver->currentText (); }
-};
-
-#include <CGAL/Scale_space_surface_reconstruction_3.h>
-
-class Polyhedron_demo_surface_reconstruction_plugin :
-  public QObject,
-  public CGAL::Three::Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  QAction* actionSurfaceReconstruction;
-
-public:
-  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface) {
-
-    actionSurfaceReconstruction = new QAction(tr("Surface Reconstruction"), mainWindow);
-    actionSurfaceReconstruction->setObjectName("actionSurfaceReconstruction");
-
-    CGAL::Three::Polyhedron_demo_plugin_helper::init(mainWindow, scene_interface);
-  }
-
-  void automatic_reconstruction (const Polyhedron_demo_surface_reconstruction_plugin_dialog& dialog);
-  void advancing_front_reconstruction (const Polyhedron_demo_surface_reconstruction_plugin_dialog& dialog);
-  void scale_space_reconstruction (const Polyhedron_demo_surface_reconstruction_plugin_dialog& dialog);
-  void poisson_reconstruction (const Polyhedron_demo_surface_reconstruction_plugin_dialog& dialog);
-  
-  //! Applicate for Point_sets with normals.
-  bool applicable(QAction*) const {
-    return qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
-  }
-
-  QList<QAction*> actions() const {
-    return QList<QAction*>() << actionSurfaceReconstruction;
-  }
-
-public Q_SLOTS:
-  void on_actionSurfaceReconstruction_triggered();
-}; // end class Polyhedron_surface_reconstruction_plugin
-
-
-void Polyhedron_demo_surface_reconstruction_plugin::on_actionSurfaceReconstruction_triggered()
-{
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-
-  Scene_points_with_normal_item* pts_item =
-    qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
-
-  if(pts_item)
-    {
-      //generate the dialog box to set the options
-      Polyhedron_demo_surface_reconstruction_plugin_dialog dialog;
-      if(!dialog.exec())
-	return;
-
-      unsigned int method = dialog.method ();
-      switch (method)
-        {
-        case 0:
-          automatic_reconstruction (dialog);
-          break;
-        case 1:
-          advancing_front_reconstruction (dialog);
-          break;
-        case 2:
-          scale_space_reconstruction (dialog);
-          break;
-        case 3:
-          poisson_reconstruction (dialog);
-          break;
-        default:
-          std::cerr << "Error: unkown method." << std::endl;
-          return;
-        }
-      
-
-    }
-}
-
-void Polyhedron_demo_surface_reconstruction_plugin::automatic_reconstruction
-(const Polyhedron_demo_surface_reconstruction_plugin_dialog& dialog)
-{
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-
-  Scene_points_with_normal_item* pts_item =
-    qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
-
-  if(pts_item)
-    {
-      // Gets point set
-      Point_set* points = pts_item->point_set();
-
-      // wait cursor
-      QApplication::setOverrideCursor(Qt::WaitCursor);
-
-      QTime time;
-      std::cout << "Meta surface reconstruction with the following requirements:" << std::endl
-		<< (dialog.boundaries() ? " * Output shape has boundaries" : " * Output shape is closed") << std::endl
-		<< (dialog.interpolate() ? " * Output shape passes through input points"
-		    : " * Output shape approximates input points") << std::endl;
-
-      Scene_points_with_normal_item* new_item = NULL;
-      if (!(dialog.interpolate()))
-	{
-	  new_item = new Scene_points_with_normal_item();
-	  new_item->setName(QString("%1 (preprocessed)").arg(pts_item->name()));
-	  new_item->set_has_normals (pts_item->has_normals());
-	  new_item->setColor(pts_item->color());
-	  new_item->setRenderingMode(pts_item->renderingMode());
-	  new_item->setVisible(pts_item->visible());
-	  new_item->resetSelection();
-	  new_item->invalidateOpenGLBuffers();
-
-	  points = new_item->point_set();
-	  std::copy (pts_item->point_set()->begin(), pts_item->point_set()->end(),
-		     std::back_inserter (*points));
-	}
-
-      std::cerr << "Analysing isotropy of point set... ";
-      time.start();
-      double aniso_size;
-      unsigned int aniso_scale = SurfaceReconstruction::scale_of_anisotropy (*points, aniso_size);
-      std::cerr << "ok (" << time.elapsed() << " ms)" << std::endl;
-
-      std::cerr << " -> Scale / size = " << aniso_scale << " / " << aniso_size << std::endl;
-      
-      bool isotropic = (aniso_scale == 6);
-      std::cerr << (isotropic ? " -> Point set is isotropic" : " -> Point set is anisotropic") << std::endl;
-      if (!(dialog.interpolate()) && !isotropic)
-	{
-	  std::cerr << "Correcting anisotropy of point set... ";
-	  time.restart();
-	  std::size_t prev_size = points->size ();
-	  SurfaceReconstruction::simplify_point_set (*points, aniso_size);
-	  std::cerr << "ok (" << time.elapsed() << " ms)" << std::endl;
-	  std::cerr << " -> " << prev_size - points->size() << " point(s) removed ("
-		    << 100. * (prev_size - points->size()) / (double)(prev_size)
-		    << "%)" << std::endl;
-	}
-
-      std::cerr << "Analysing noise of point set... ";
-      time.restart();
-      double noise_size;
-      unsigned int noise_scale = SurfaceReconstruction::scale_of_noise (*points, noise_size);
-      std::cerr << "ok (" << time.elapsed() << " ms)" << std::endl;
-      
-      std::cerr << " -> Scale / size = " << noise_scale << " / " << noise_size << std::endl;
-      
-      bool noisy = (noise_scale > 6);
-      std::cerr << (noisy ? " -> Point set is noisy" : " -> Point set is noise-free") << std::endl;
-      
-      if (!(dialog.interpolate()) && noisy)
-	{
-	  std::cerr << "Denoising point set... ";
-	  time.restart();
-	  SurfaceReconstruction::smooth_point_set (*points, noise_scale);
-          new_item->set_has_normals (false);
-	  std::cerr << "ok (" << time.elapsed() << " ms)" << std::endl;
-	}
-
-      if (dialog.interpolate())
-	{
-	  if (noisy)
-	    { 
-	      std::cerr << "Scale space reconstruction... ";
-	      time.restart();
-
-              std::vector<Scene_polygon_soup_item*> reco_items;
-
-	      SurfaceReconstruction::scale_space (*points, std::back_inserter (reco_items),
-                                                  (std::max)(noise_scale, aniso_scale));
-	      
-              for (std::size_t i = 0; i < reco_items.size (); ++ i)
-                {
-                  reco_items[i]->setName(tr("%1 (scale space)").arg(scene->item(index)->name()));
-                  scene->addItem (reco_items[i]);
-                }
-
-	      std::cerr << "ok (" << time.elapsed() << " ms)" << std::endl;
-	    }
-	  else
-	    {
-	      std::cerr << "Advancing front reconstruction... ";
-	      time.restart();
-
-	      Scene_polyhedron_item* reco_item = new Scene_polyhedron_item(Polyhedron());
-	      SurfaceReconstruction::advancing_front (*points, reco_item, 10. * (std::max)(noise_size, aniso_size));
-	      
-	      reco_item->setName(tr("%1 (advancing front)").arg(scene->item(index)->name()));
-	      reco_item->setColor(Qt::magenta);
-	      reco_item->setRenderingMode(FlatPlusEdges);
-	      scene->addItem(reco_item);
-
-	      std::cerr << "ok (" << time.elapsed() << " ms)" << std::endl;
-	    }
-
-	}
-      else
-	{
-	  if (dialog.boundaries())
-	    {
-	      std::cerr << "Advancing front reconstruction... ";
-	      time.restart();
-
-	      Scene_polyhedron_item* reco_item = new Scene_polyhedron_item(Polyhedron());
-	      SurfaceReconstruction::advancing_front (*points, reco_item, 10. * (std::max)(noise_size, aniso_size));
-	      
-	      reco_item->setName(tr("%1 (advancing front)").arg(scene->item(index)->name()));
-	      reco_item->setColor(Qt::magenta);
-	      reco_item->setRenderingMode(FlatPlusEdges);
-	      scene->addItem(reco_item);
-
-	      std::cerr << "ok (" << time.elapsed() << " ms)" << std::endl;
-	    }
-	  else
-	    {
-	      if (!(new_item->has_normals()))
-		{
-		  std::cerr << "Estimation of normal vectors... ";
-		  time.restart();
-
-		  SurfaceReconstruction::compute_normals (*points, noise_scale);
-		  
-		  new_item->set_has_normals (true);
-		  new_item->setRenderingMode(PointsPlusNormals);
-		  
-		  std::cerr << "ok (" << time.elapsed() << " ms)" << std::endl;
-		}
-	      
-	      std::cerr << "Poisson reconstruction... ";
-	      time.restart();
-
-	      Polyhedron* pRemesh = poisson_reconstruct(*points, 20,
-							100 * (std::max)(noise_size, aniso_size),
-							(std::max)(noise_size, aniso_size),
-							QString ("Eigen - built-in CG"), false, false);
-	      if(pRemesh)
-
-		{
-		  // Add polyhedron to scene
-		  Scene_polyhedron_item* reco_item = new Scene_polyhedron_item(pRemesh);
-		  reco_item->setName(tr("%1 (poisson)").arg(pts_item->name()));
-		  reco_item->setColor(Qt::lightGray);
-		  scene->addItem(reco_item);
-		}
-
-	      std::cerr << "ok (" << time.elapsed() << " ms)" << std::endl;
-	    }
-	}
-
-      if (!(dialog.interpolate()))
-	{
-	  if (noisy || !isotropic)
-	    scene->addItem(new_item);
-	  else
-	    delete new_item;
-	}
-
-      // default cursor
-      QApplication::restoreOverrideCursor();
-    }
-}
-
-
-void Polyhedron_demo_surface_reconstruction_plugin::advancing_front_reconstruction
-(const Polyhedron_demo_surface_reconstruction_plugin_dialog& dialog)
-{
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-
-  Scene_points_with_normal_item* pts_item =
-    qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
-
-  if(pts_item)
-    {
-      // Gets point set
-      Point_set* points = pts_item->point_set();
-
-      // wait cursor
-      QApplication::setOverrideCursor(Qt::WaitCursor);
-
-      std::cerr << "Advancing front reconstruction... ";
-
-      Scene_polyhedron_item* reco_item = new Scene_polyhedron_item(Polyhedron());
-      SurfaceReconstruction::advancing_front (*points, reco_item,
-                                              dialog.longest_edge (),
-                                              dialog.radius_ratio_bound (),
-                                              CGAL_PI * dialog.beta_angle () / 180.);
-	      
-      reco_item->setName(tr("%1 (advancing front)").arg(scene->item(index)->name()));
-      reco_item->setColor(Qt::magenta);
-      reco_item->setRenderingMode(FlatPlusEdges);
-      scene->addItem(reco_item);
-
-      QApplication::restoreOverrideCursor();
-    }
-}
-
-
-void Polyhedron_demo_surface_reconstruction_plugin::scale_space_reconstruction
-(const Polyhedron_demo_surface_reconstruction_plugin_dialog& dialog)
-{
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-
-  Scene_points_with_normal_item* pts_item =
-    qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
-
-  if(pts_item)
-    {
-      // Gets point set
-      Point_set* points = pts_item->point_set();
-
-      // wait cursor
-      QApplication::setOverrideCursor(Qt::WaitCursor);
-
-      std::cout << "Scale scape surface reconstruction...";
-      
-      std::vector<Scene_polygon_soup_item*> reco_items;
-
-      SurfaceReconstruction::scale_space (*points, std::back_inserter (reco_items),
-                                          dialog.neighbors (),
-                                          dialog.generate_smoothed (),
-                                          dialog.separate_shells (),
-                                          dialog.force_manifold (),
-                                          dialog.samples (),
-                                          dialog.iterations ());
-
-      for (std::size_t i = 0; i < reco_items.size (); ++ i)
-        {
-          if (dialog.force_manifold () && i > reco_items.size () - 3)
-            {
-              if (dialog.generate_smoothed () && i % 2)
-                reco_items[i]->setName(tr("%1 (scale space smooth garbage)").arg(scene->item(index)->name()));
-              else
-                reco_items[i]->setName(tr("%1 (scale space garbage)").arg(scene->item(index)->name()));
-            }
-          else
-            {
-              if (dialog.generate_smoothed ())
-                {
-                  if (i % 2)
-                    reco_items[i]->setName(tr("%1 (scale space smooth shell %2)").arg(scene->item(index)->name()).arg((i+1)/2));
-                  else
-                    reco_items[i]->setName(tr("%1 (scale space shell %2)").arg(scene->item(index)->name()).arg(((i+1)/2)+1));
-                }
-              else
-                reco_items[i]->setName(tr("%1 (scale space shell %2)").arg(scene->item(index)->name()).arg(i+1));
-            }
-          scene->addItem (reco_items[i]);
-        }
-
-      QApplication::restoreOverrideCursor();
-    }
-}
-
-
-void Polyhedron_demo_surface_reconstruction_plugin::poisson_reconstruction
-(const Polyhedron_demo_surface_reconstruction_plugin_dialog& dialog)
-{
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-
-  Scene_points_with_normal_item* point_set_item =
-    qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
-
-  if(point_set_item)
-    {
-      // Gets point set
-      Point_set* points = point_set_item->point_set();
-      if(!points) return;
-
-      const double sm_angle     = dialog.angle ();
-      const double sm_radius    = dialog.radius ();
-      const double sm_distance  = dialog.distance ();
-      const QString sm_solver   = dialog.solver();
-      bool use_two_passes = dialog.two_passes();
-      bool do_not_fill_holes = dialog.do_not_fill_holes();
-
-      QApplication::setOverrideCursor(Qt::WaitCursor);
-
-      if (!(point_set_item->has_normals()))
-        {
-          std::cerr << "Estimation of normal vectors... ";
-
-          SurfaceReconstruction::compute_normals (*points, 12);
-		  
-          point_set_item->set_has_normals (true);
-          point_set_item->setRenderingMode(PointsPlusNormals);
-
-        }
-
-
-      // Reconstruct point set as a polyhedron
-      Polyhedron* pRemesh = poisson_reconstruct(*points, sm_angle, sm_radius, sm_distance, sm_solver, use_two_passes,
-                                                do_not_fill_holes);
-      if(pRemesh)
-        {
-          // Add polyhedron to scene
-          Scene_polyhedron_item* new_item = new Scene_polyhedron_item(pRemesh);
-          new_item->setName(tr("%1 Poisson (%2 %3 %4)")
-                            .arg(point_set_item->name())
-                            .arg(sm_angle)
-                            .arg(sm_radius)
-                            .arg(sm_distance));
-          new_item->setColor(Qt::lightGray);
-          scene->addItem(new_item);
-
-
-          // Hide point set
-          point_set_item->setVisible(false);
-          scene->itemChanged(index);
-        }
-
-      QApplication::restoreOverrideCursor();
-    }
-}
-
-
-#include "Surface_reconstruction_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_plugin.ui b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_plugin.ui
deleted file mode 100644
index d52a3bf..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_plugin.ui
+++ /dev/null
@@ -1,483 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>SurfaceReconstructionDialog</class>
- <widget class="QDialog" name="SurfaceReconstructionDialog">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>397</width>
-    <height>663</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Surface Reconstruction</string>
-  </property>
-  <layout class="QGridLayout" name="gridLayout_2">
-   <item row="3" column="0">
-    <widget class="QFrame" name="frameAdvancing">
-     <property name="enabled">
-      <bool>false</bool>
-     </property>
-     <property name="frameShape">
-      <enum>QFrame::StyledPanel</enum>
-     </property>
-     <property name="frameShadow">
-      <enum>QFrame::Raised</enum>
-     </property>
-     <layout class="QFormLayout" name="formLayout">
-      <item row="0" column="0">
-       <widget class="QLabel" name="label">
-        <property name="text">
-         <string>Longest Edge</string>
-        </property>
-       </widget>
-      </item>
-      <item row="0" column="1">
-       <widget class="QDoubleSpinBox" name="m_longestEdge">
-        <property name="maximum">
-         <double>999999999.000000000000000</double>
-        </property>
-       </widget>
-      </item>
-      <item row="1" column="0">
-       <widget class="QLabel" name="label_9">
-        <property name="text">
-         <string>Radius Ratio Bound</string>
-        </property>
-       </widget>
-      </item>
-      <item row="2" column="0">
-       <widget class="QLabel" name="label_10">
-        <property name="text">
-         <string>Beta Angle</string>
-        </property>
-       </widget>
-      </item>
-      <item row="1" column="1">
-       <widget class="QDoubleSpinBox" name="m_radiusRatioBound">
-        <property name="minimum">
-         <double>0.010000000000000</double>
-        </property>
-        <property name="maximum">
-         <double>1000.000000000000000</double>
-        </property>
-        <property name="value">
-         <double>5.000000000000000</double>
-        </property>
-       </widget>
-      </item>
-      <item row="2" column="1">
-       <widget class="QDoubleSpinBox" name="m_betaAngle">
-        <property name="suffix">
-         <string>°</string>
-        </property>
-        <property name="maximum">
-         <double>150.000000000000000</double>
-        </property>
-        <property name="value">
-         <double>30.000000000000000</double>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item row="5" column="0">
-    <widget class="QFrame" name="frameScaleSpace">
-     <property name="enabled">
-      <bool>false</bool>
-     </property>
-     <property name="frameShape">
-      <enum>QFrame::StyledPanel</enum>
-     </property>
-     <property name="frameShadow">
-      <enum>QFrame::Raised</enum>
-     </property>
-     <layout class="QFormLayout" name="formLayout_2">
-      <item row="0" column="0">
-       <widget class="QLabel" name="label_2">
-        <property name="text">
-         <string>Average Neighborhood Size</string>
-        </property>
-       </widget>
-      </item>
-      <item row="0" column="1">
-       <widget class="QSpinBox" name="m_neighbors">
-        <property name="minimum">
-         <number>0</number>
-        </property>
-        <property name="maximum">
-         <number>100000</number>
-        </property>
-        <property name="value">
-         <number>30</number>
-        </property>
-       </widget>
-      </item>
-      <item row="1" column="0">
-       <widget class="QLabel" name="label_4">
-        <property name="text">
-         <string>Size of Sample to Estimate Neighborhood</string>
-        </property>
-       </widget>
-      </item>
-      <item row="1" column="1">
-       <widget class="QSpinBox" name="m_samples">
-        <property name="maximum">
-         <number>1000000</number>
-        </property>
-        <property name="value">
-         <number>200</number>
-        </property>
-       </widget>
-      </item>
-      <item row="2" column="0">
-       <widget class="QLabel" name="label_3">
-        <property name="text">
-         <string>Iterations</string>
-        </property>
-       </widget>
-      </item>
-      <item row="2" column="1">
-       <widget class="QSpinBox" name="m_iterations">
-        <property name="minimum">
-         <number>1</number>
-        </property>
-        <property name="maximum">
-         <number>1000000</number>
-        </property>
-        <property name="value">
-         <number>4</number>
-        </property>
-       </widget>
-      </item>
-      <item row="3" column="0">
-       <widget class="QCheckBox" name="m_genShells">
-        <property name="text">
-         <string>Generate separate shells</string>
-        </property>
-        <property name="checked">
-         <bool>false</bool>
-        </property>
-       </widget>
-      </item>
-      <item row="4" column="0">
-       <widget class="QCheckBox" name="m_forceManifold">
-        <property name="text">
-         <string>Force manifold output</string>
-        </property>
-        <property name="checked">
-         <bool>true</bool>
-        </property>
-       </widget>
-      </item>
-      <item row="5" column="0">
-       <widget class="QCheckBox" name="m_genSmooth">
-        <property name="text">
-         <string>Smoothed version</string>
-        </property>
-        <property name="checked">
-         <bool>false</bool>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item row="6" column="0">
-    <widget class="QRadioButton" name="buttonPoisson">
-     <property name="text">
-      <string>Poisson Reconstruction</string>
-     </property>
-    </widget>
-   </item>
-   <item row="7" column="0">
-    <widget class="QFrame" name="framePoisson">
-     <property name="enabled">
-      <bool>false</bool>
-     </property>
-     <property name="frameShape">
-      <enum>QFrame::StyledPanel</enum>
-     </property>
-     <property name="frameShadow">
-      <enum>QFrame::Raised</enum>
-     </property>
-     <layout class="QFormLayout" name="formLayout_3">
-      <item row="0" column="0">
-       <widget class="QLabel" name="label_5">
-        <property name="text">
-         <string>Min Triangle Angle:</string>
-        </property>
-       </widget>
-      </item>
-      <item row="0" column="1">
-       <widget class="QDoubleSpinBox" name="m_inputAngle">
-        <property name="suffix">
-         <string> °</string>
-        </property>
-        <property name="minimum">
-         <double>1.000000000000000</double>
-        </property>
-        <property name="maximum">
-         <double>30.000000000000000</double>
-        </property>
-        <property name="value">
-         <double>20.000000000000000</double>
-        </property>
-       </widget>
-      </item>
-      <item row="1" column="0">
-       <widget class="QLabel" name="label_7">
-        <property name="text">
-         <string>Max Triangle Size:</string>
-        </property>
-       </widget>
-      </item>
-      <item row="1" column="1">
-       <widget class="QDoubleSpinBox" name="m_inputRadius">
-        <property name="suffix">
-         <string> * average spacing</string>
-        </property>
-        <property name="decimals">
-         <number>0</number>
-        </property>
-        <property name="minimum">
-         <double>1.000000000000000</double>
-        </property>
-        <property name="maximum">
-         <double>1000.000000000000000</double>
-        </property>
-        <property name="singleStep">
-         <double>1.000000000000000</double>
-        </property>
-        <property name="value">
-         <double>100.000000000000000</double>
-        </property>
-       </widget>
-      </item>
-      <item row="2" column="0">
-       <widget class="QLabel" name="label_6">
-        <property name="text">
-         <string>Approximation Error:</string>
-        </property>
-       </widget>
-      </item>
-      <item row="2" column="1">
-       <widget class="QDoubleSpinBox" name="m_inputDistance">
-        <property name="suffix">
-         <string> * average spacing</string>
-        </property>
-        <property name="decimals">
-         <number>6</number>
-        </property>
-        <property name="minimum">
-         <double>0.010000000000000</double>
-        </property>
-        <property name="maximum">
-         <double>100.000000000000000</double>
-        </property>
-        <property name="singleStep">
-         <double>0.010000000000000</double>
-        </property>
-        <property name="value">
-         <double>0.250000000000000</double>
-        </property>
-       </widget>
-      </item>
-      <item row="3" column="0">
-       <widget class="QLabel" name="label_8">
-        <property name="text">
-         <string>Solver:</string>
-        </property>
-       </widget>
-      </item>
-      <item row="3" column="1">
-       <widget class="QComboBox" name="m_inputSolver">
-        <property name="toolTip">
-         <string extracomment="Name of the sparse solver"/>
-        </property>
-       </widget>
-      </item>
-      <item row="4" column="0">
-       <widget class="QCheckBox" name="m_inputTwoPasses">
-        <property name="text">
-         <string>Perform two passes</string>
-        </property>
-       </widget>
-      </item>
-      <item row="5" column="0">
-       <widget class="QCheckBox" name="m_doNotFillHoles">
-        <property name="text">
-         <string>Do not fill holes</string>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item row="2" column="0">
-    <widget class="QRadioButton" name="buttonAdvancing">
-     <property name="text">
-      <string>Advancing Front Reconstruction</string>
-     </property>
-    </widget>
-   </item>
-   <item row="0" column="0">
-    <widget class="QRadioButton" name="buttonAuto">
-     <property name="text">
-      <string>Select Method and Parameters Automatically</string>
-     </property>
-     <property name="checked">
-      <bool>true</bool>
-     </property>
-    </widget>
-   </item>
-   <item row="4" column="0">
-    <widget class="QRadioButton" name="buttonScaleSpace">
-     <property name="text">
-      <string>Scale Space Reconstruction</string>
-     </property>
-    </widget>
-   </item>
-   <item row="1" column="0">
-    <widget class="QFrame" name="frameAuto">
-     <property name="frameShape">
-      <enum>QFrame::StyledPanel</enum>
-     </property>
-     <property name="frameShadow">
-      <enum>QFrame::Raised</enum>
-     </property>
-     <layout class="QVBoxLayout" name="verticalLayout">
-      <item>
-       <widget class="QCheckBox" name="m_boundaries">
-        <property name="text">
-         <string>Output surface has boundaries</string>
-        </property>
-        <property name="checked">
-         <bool>true</bool>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QCheckBox" name="m_interpolate">
-        <property name="text">
-         <string>Output surface must pass exactly through input points</string>
-        </property>
-        <property name="checked">
-         <bool>true</bool>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item row="8" column="0">
-    <widget class="QDialogButtonBox" name="buttonBox">
-     <property name="standardButtons">
-      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
-     </property>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <resources/>
- <connections>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>accepted()</signal>
-   <receiver>SurfaceReconstructionDialog</receiver>
-   <slot>accept()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>198</x>
-     <y>640</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>198</x>
-     <y>331</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>rejected()</signal>
-   <receiver>SurfaceReconstructionDialog</receiver>
-   <slot>reject()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>198</x>
-     <y>640</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>198</x>
-     <y>331</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>buttonAdvancing</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>frameAdvancing</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>198</x>
-     <y>116</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>198</x>
-     <y>155</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>buttonAuto</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>frameAuto</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>198</x>
-     <y>18</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>198</x>
-     <y>67</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>buttonPoisson</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>framePoisson</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>198</x>
-     <y>414</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>198</x>
-     <y>525</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>buttonScaleSpace</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>frameScaleSpace</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>198</x>
-     <y>194</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>198</x>
-     <y>304</y>
-    </hint>
-   </hints>
-  </connection>
- </connections>
-</ui>
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_plugin_impl.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_plugin_impl.cpp
deleted file mode 100644
index 1b701f1..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_plugin_impl.cpp
+++ /dev/null
@@ -1,245 +0,0 @@
-//----------------------------------------------------------
-// Poisson reconstruction method:
-// Reconstructs a surface mesh from a point set and returns it as a polyhedron.
-//----------------------------------------------------------
-
-
-// CGAL
-#include <CGAL/AABB_tree.h> // must be included before kernel
-#include <CGAL/AABB_traits.h>
-#include <CGAL/AABB_face_graph_triangle_primitive.h>
-#include <CGAL/Timer.h>
-#include <CGAL/Surface_mesh_default_triangulation_3.h>
-#include <CGAL/make_surface_mesh.h>
-#include <CGAL/Implicit_surface_3.h>
-#include <CGAL/IO/output_surface_facets_to_polyhedron.h>
-#include <CGAL/Poisson_reconstruction_function.h>
-#include <CGAL/compute_average_spacing.h>
-
-#ifdef CGAL_EIGEN3_ENABLED
-#include <CGAL/Eigen_solver_traits.h>
-#endif
-
-#include <math.h>
-
-#include "Kernel_type.h"
-#include "Polyhedron_type.h"
-#include "Scene_points_with_normal_item.h"
-
-
-// Poisson implicit function
-typedef CGAL::Poisson_reconstruction_function<Kernel> Poisson_reconstruction_function;
-
-// Surface mesher
-typedef CGAL::Surface_mesh_default_triangulation_3 STr;
-typedef CGAL::Surface_mesh_complex_2_in_triangulation_3<STr> C2t3;
-typedef CGAL::Implicit_surface_3<Kernel, Poisson_reconstruction_function> Surface_3;
-
-// AABB tree
-typedef CGAL::AABB_face_graph_triangle_primitive<Polyhedron> Primitive;
-typedef CGAL::AABB_traits<Kernel, Primitive> AABB_traits;
-typedef CGAL::AABB_tree<AABB_traits> AABB_tree;
-
-// Concurrency
-#ifdef CGAL_LINKED_WITH_TBB
-typedef CGAL::Parallel_tag Concurrency_tag;
-#else
-typedef CGAL::Sequential_tag Concurrency_tag;
-#endif
-
-
-
-// Poisson reconstruction method:
-// Reconstructs a surface mesh from a point set and returns it as a polyhedron.
-Polyhedron* poisson_reconstruct(const Point_set& points,
-                                Kernel::FT sm_angle, // Min triangle angle (degrees).
-                                Kernel::FT sm_radius, // Max triangle size w.r.t. point set average spacing.
-                                Kernel::FT sm_distance, // Approximation error w.r.t. point set average spacing.
-                                const QString& solver_name, // solver name
-                                bool use_two_passes,
-				bool do_not_fill_holes)
-{
-    CGAL::Timer task_timer; task_timer.start();
-
-    //***************************************
-    // Checks requirements
-    //***************************************
-
-    if (points.size() == 0)
-    {
-      std::cerr << "Error: empty point set" << std::endl;
-      return NULL;
-    }
-
-    bool points_have_normals = (points.begin()->normal() != CGAL::NULL_VECTOR);
-    if ( ! points_have_normals )
-    {
-      std::cerr << "Input point set not supported: this reconstruction method requires oriented normals" << std::endl;
-      return NULL;
-    }
-
-    CGAL::Timer reconstruction_timer; reconstruction_timer.start();
-
-    //***************************************
-    // Computes implicit function
-    //***************************************
-
- 
-    std::cerr << "Computes Poisson implicit function "
-              << "using " << solver_name.toLatin1().data() << " solver...\n";
-              
-    
-    // Creates implicit function from the point set.
-    // Note: this method requires an iterator over points
-    // + property maps to access each point's position and normal.
-    // The position property map can be omitted here as we use iterators over Point_3 elements.
-    Poisson_reconstruction_function function(
-                              points.begin(), points.end(),
-                              CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()));
-
-    bool ok = false;    
-    #ifdef CGAL_EIGEN3_ENABLED
-    if(solver_name=="Eigen - built-in simplicial LDLt")
-    {
-      CGAL::Eigen_solver_traits<Eigen::SimplicialCholesky<CGAL::Eigen_sparse_matrix<double>::EigenType> > solver;
-      ok = function.compute_implicit_function(solver, use_two_passes);
-    }
-    if(solver_name=="Eigen - built-in CG")
-    {
-      CGAL::Eigen_solver_traits<Eigen::ConjugateGradient<CGAL::Eigen_sparse_matrix<double>::EigenType> > solver;
-      solver.solver().setTolerance(1e-6);
-      solver.solver().setMaxIterations(1000);
-      ok = function.compute_implicit_function(solver, use_two_passes);
-    }
-    #endif
-
-    // Computes the Poisson indicator function f()
-    // at each vertex of the triangulation.
-    if ( ! ok )
-    {
-      std::cerr << "Error: cannot compute implicit function" << std::endl;
-      return NULL;
-    }
-
-    // Prints status
-    std::cerr << "Total implicit function (triangulation+refinement+solver): " << task_timer.time() << " seconds\n";
-    task_timer.reset();
-
-    //***************************************
-    // Surface mesh generation
-    //***************************************
-
-    std::cerr << "Surface meshing...\n";
-
-    // Computes average spacing
-    Kernel::FT average_spacing = CGAL::compute_average_spacing<Concurrency_tag>(points.begin(), points.end(),
-                                                       6 /* knn = 1 ring */);
-
-    // Gets one point inside the implicit surface
-    Kernel::Point_3 inner_point = function.get_inner_point();
-    Kernel::FT inner_point_value = function(inner_point);
-    if(inner_point_value >= 0.0)
-    {
-      std::cerr << "Error: unable to seed (" << inner_point_value << " at inner_point)" << std::endl;
-      return NULL;
-    }
-
-    // Gets implicit function's radius
-    Kernel::Sphere_3 bsphere = function.bounding_sphere();
-    Kernel::FT radius = std::sqrt(bsphere.squared_radius());
-
-    // Defines the implicit surface: requires defining a
-  	// conservative bounding sphere centered at inner point.
-    Kernel::FT sm_sphere_radius = 5.0 * radius;
-    Kernel::FT sm_dichotomy_error = sm_distance*average_spacing/1000.0; // Dichotomy error must be << sm_distance
-    Surface_3 surface(function,
-                      Kernel::Sphere_3(inner_point,sm_sphere_radius*sm_sphere_radius),
-                      sm_dichotomy_error/sm_sphere_radius);
-
-    // Defines surface mesh generation criteria
-    CGAL::Surface_mesh_default_criteria_3<STr> criteria(sm_angle,  // Min triangle angle (degrees)
-                                                        sm_radius*average_spacing,  // Max triangle size
-                                                        sm_distance*average_spacing); // Approximation error
-
-    CGAL_TRACE_STREAM << "  make_surface_mesh(sphere center=("<<inner_point << "),\n"
-                      << "                    sphere radius="<<sm_sphere_radius<<",\n"
-                      << "                    angle="<<sm_angle << " degrees,\n"
-                      << "                    triangle size="<<sm_radius<<" * average spacing="<<sm_radius*average_spacing<<",\n"
-                      << "                    distance="<<sm_distance<<" * average spacing="<<sm_distance*average_spacing<<",\n"
-                      << "                    dichotomy error=distance/"<<sm_distance*average_spacing/sm_dichotomy_error<<",\n"
-                      << "                    Manifold_with_boundary_tag)\n";
-
-    // Generates surface mesh with manifold option
-    STr tr; // 3D Delaunay triangulation for surface mesh generation
-    C2t3 c2t3(tr); // 2D complex in 3D Delaunay triangulation
-    CGAL::make_surface_mesh(c2t3,                                 // reconstructed mesh
-                            surface,                              // implicit surface
-                            criteria,                             // meshing criteria
-                            CGAL::Manifold_with_boundary_tag());  // require manifold mesh
-
-    // Prints status
-    std::cerr << "Surface meshing: " << task_timer.time() << " seconds, "
-                                     << tr.number_of_vertices() << " output vertices"
-                                     << std::endl;
-    task_timer.reset();
-
-    if(tr.number_of_vertices() == 0)
-      return NULL;
-
-    // Converts to polyhedron
-    Polyhedron* output_mesh = new Polyhedron;
-    CGAL::output_surface_facets_to_polyhedron(c2t3, *output_mesh);
-
-    // Prints total reconstruction duration
-    std::cerr << "Total reconstruction (implicit function + meshing): " << reconstruction_timer.time() << " seconds\n";
-
-    //***************************************
-    // Computes reconstruction error
-    //***************************************
-
-    // Constructs AABB tree and computes internal KD-tree
-    // data structure to accelerate distance queries
-    AABB_tree tree(faces(*output_mesh).first, faces(*output_mesh).second, *output_mesh);
-    tree.accelerate_distance_queries();
-
-    // Computes distance from each input point to reconstructed mesh
-    double max_distance = DBL_MIN;
-    double avg_distance = 0;
-
-    std::set<Polyhedron::Face_handle> faces_to_keep;
-    
-    for (Point_set::const_iterator p=points.begin(); p!=points.end(); p++)
-    {
-      AABB_traits::Point_and_primitive_id pap = tree.closest_point_and_primitive (*p);
-      double distance = std::sqrt(CGAL::squared_distance (pap.first, *p));
-      
-      max_distance = (std::max)(max_distance, distance);
-      avg_distance += distance;
-
-      Polyhedron::Face_handle f = pap.second;
-      faces_to_keep.insert (f);  
-    }
-    avg_distance /= double(points.size());
-
-    std::cerr << "Reconstruction error:\n"
-              << "  max = " << max_distance << " = " << max_distance/average_spacing << " * average spacing\n"
-              << "  avg = " << avg_distance << " = " << avg_distance/average_spacing << " * average spacing\n";
-
-    if (do_not_fill_holes)
-      {
-	Polyhedron::Facet_iterator it = output_mesh->facets_begin ();
-	while (it != output_mesh->facets_end ())
-	  {
-	    Polyhedron::Facet_iterator current = it ++;
-
-	    if (faces_to_keep.find (current) == faces_to_keep.end ())
-	      output_mesh->erase_facet (current->halfedge ());
-
-	  }
-
-      }
-    
-
-    return output_mesh;
-}
-
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Subdivision_methods/Subdivision_methods_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Subdivision_methods/Subdivision_methods_plugin.cpp
deleted file mode 100644
index a2e0cf7..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Subdivision_methods/Subdivision_methods_plugin.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-#include <QTime>
-#include <QApplication>
-#include <QMainWindow>
-#include <QAction>
-
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-
-#include "Scene_polyhedron_item.h"
-#include "Polyhedron_type.h"
-#include <CGAL/Subdivision_method_3.h>
-using namespace CGAL::Three;
-class Polyhedron_demo_subdivision_methods_plugin : 
-  public QObject,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-public:
-  // used by Polyhedron_demo_plugin_helper
-  QStringList actionsNames() const {
-    return QStringList() << "actionLoop"
-                         << "actionCatmullClark"
-                         << "actionSqrt3";
-  }
-
-  void init(QMainWindow* mainWindow,
-            Scene_interface* scene_interface)
-  {
-      mw = mainWindow;
-      scene = scene_interface;
-      actions_map["actionLoop"] = new QAction("Loop", mw);
-      actions_map["actionLoop"]->setProperty("subMenuName", "3D Surface Subdivision Methods");
-
-      actions_map["actionCatmullClark"] = new QAction("Catmull Clark", mw);
-      actions_map["actionCatmullClark"]->setProperty("subMenuName", "3D Surface Subdivision Methods");
-
-      actions_map["actionSqrt3"] = new QAction("Sqrt3", mw);
-      actions_map["actionSqrt3"]->setProperty("subMenuName", "3D Surface Subdivision Methods");
-
-      //autoConnectActions();
-      connect(actions_map["actionLoop"], SIGNAL(triggered()),
-              this, SLOT(on_actionLoop_triggered()));
-
-      connect(actions_map["actionCatmullClark"], SIGNAL(triggered()),
-              this, SLOT(on_actionCatmullClark_triggered()));
-
-      connect(actions_map["actionSqrt3"], SIGNAL(triggered()),
-              this, SLOT(on_actionSqrt3_triggered()));
-
-  }
-
-  bool applicable(QAction*) const { 
-    return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
-  }
-public Q_SLOTS:
-  void on_actionLoop_triggered();
-  void on_actionCatmullClark_triggered();
-  void on_actionSqrt3_triggered();
-}; // end Polyhedron_demo_subdivision_methods_plugin
-
-void Polyhedron_demo_subdivision_methods_plugin::on_actionLoop_triggered()
-{
-  CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-  
-  Scene_polyhedron_item* item = 
-    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-
-  if(!item) return;
-  Polyhedron* poly = item->polyhedron();
-  QTime time;
-  time.start();
-  std::cout << "Loop subdivision...";
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-  CGAL::Subdivision_method_3::Loop_subdivision(*poly, 1);
-  std::cout << "ok (" << time.elapsed() << " ms)" << std::endl;
-  QApplication::restoreOverrideCursor();
-  item->invalidateOpenGLBuffers();
-  scene->itemChanged(item);
-}
-
-void Polyhedron_demo_subdivision_methods_plugin::on_actionCatmullClark_triggered()
-{
-  CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-  
-  Scene_polyhedron_item* item = 
-    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-
-  if(!item) return;
-  Polyhedron* poly = item->polyhedron();
-  if(!poly) return;
-  QTime time;
-  time.start();
-  std::cout << "Catmull-Clark subdivision...";
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-  CGAL::Subdivision_method_3::CatmullClark_subdivision(*poly, 1);
-  std::cout << "ok (" << time.elapsed() << " ms)" << std::endl;
-  QApplication::restoreOverrideCursor();
-  item->invalidateOpenGLBuffers();
-  scene->itemChanged(item);
-}
-
-void Polyhedron_demo_subdivision_methods_plugin::on_actionSqrt3_triggered()
-{
-  CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-  
-  Scene_polyhedron_item* item = 
-    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-
-  if(!item) return;
-  Polyhedron* poly = item->polyhedron();
-  if(!poly) return;
-  QTime time;
-  time.start();
-  std::cout << "Sqrt3 subdivision...";
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-  CGAL::Subdivision_method_3::Sqrt3_subdivision(*poly, 1);
-  std::cout << "ok (" << time.elapsed() << " ms)" << std::endl;
-  QApplication::restoreOverrideCursor();
-  item->invalidateOpenGLBuffers();
-  scene->itemChanged(item);
-}
-
-#include "Subdivision_methods_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh/Mesh_segmentation_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh/Mesh_segmentation_plugin.cpp
deleted file mode 100644
index 03bac66..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh/Mesh_segmentation_plugin.cpp
+++ /dev/null
@@ -1,349 +0,0 @@
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-
-#include "ui_Mesh_segmentation_widget.h"
-#include "Scene_polyhedron_item.h"
-#include "Polyhedron_type.h"
-#include "Scene.h"
-#include "Color_map.h"
-
-#include <CGAL/mesh_segmentation.h>
-#include <QApplication>
-#include <QMainWindow>
-#include <QInputDialog>
-#include <QTime>
-#include <QAction>
-#include <QDebug>
-#include <QObject>
-#include <QDockWidget>
-//#include <QtConcurrentRun>
-#include <map>
-#include <algorithm>
-#include <vector>
-#include <CGAL/property_map.h>
-
-
-template<class PolyhedronWithId, class ValueType>
-struct Polyhedron_with_id_to_vector_property_map
-    : public boost::put_get_helper<ValueType&,
-             Polyhedron_with_id_to_vector_property_map<PolyhedronWithId, ValueType> >
-{
-public:
-    typedef typename PolyhedronWithId::Facet_const_handle key_type;
-    typedef ValueType value_type;
-    typedef value_type& reference;
-    typedef boost::lvalue_property_map_tag category;
-
-    Polyhedron_with_id_to_vector_property_map() : internal_vector(NULL) { }
-    Polyhedron_with_id_to_vector_property_map(std::vector<ValueType>* internal_vector)
-         : internal_vector(internal_vector) { }
-        
-    reference operator[](key_type key) const { return (*internal_vector)[key->id()]; }
-private:
-    std::vector<ValueType>* internal_vector;
-};
-using namespace CGAL::Three;
-class Polyhedron_demo_mesh_segmentation_plugin : 
-    public QObject,
-    public Polyhedron_demo_plugin_helper
-{
-    Q_OBJECT
-    Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-    Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-private:
-    typedef std::map<Scene_polyhedron_item*, std::vector<double> > Item_sdf_map;
-public:
-
-    QList<QAction*> actions() const {
-        return QList<QAction*>() << actionSegmentation;
-    }
-
-    bool applicable(QAction*) const {
-      return 
-        qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
-    }    
-    
-    void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface) {
-        this->scene = scene_interface;
-        this->mw = mainWindow;
-        actionSegmentation = new QAction("Mesh Segmentation", mw);
-        actionSegmentation->setProperty("subMenuName", "Triangulated Surface Mesh Segmentation");
-        connect(actionSegmentation, SIGNAL(triggered()),this, SLOT(on_actionSegmentation_triggered()));
-
-        // adding slot for itemAboutToBeDestroyed signal, aim is removing item from item-functor map.
-        
-        if( Scene* scene = dynamic_cast<Scene*>(scene_interface) ) {
-            connect(scene, SIGNAL(itemAboutToBeDestroyed(CGAL::Three::Scene_item*)), this, SLOT(itemAboutToBeDestroyed(CGAL::Three::Scene_item*)));
-        }
-        
-        init_color_map_sdf();
-        init_color_map_segmentation();
-
-        dock_widget = new QDockWidget("Mesh segmentation parameters", mw);
-        dock_widget->setVisible(false); // do not show at the beginning
-        ui_widget.setupUi(dock_widget);
-        mw->addDockWidget(Qt::LeftDockWidgetArea, dock_widget);
-    
-        connect(ui_widget.Partition_button,  SIGNAL(clicked()), this, SLOT(on_Partition_button_clicked()));   
-        connect(ui_widget.SDF_button,  SIGNAL(clicked()), this, SLOT(on_SDF_button_clicked()));   
-    }
-    virtual void closure()
-    {
-      dock_widget->hide();
-    }
-    
-    template<class SDFPropertyMap>
-    void colorize_sdf(Scene_polyhedron_item* item, SDFPropertyMap sdf_values, std::vector<QColor>& color_vector);
-    template<class SegmentPropertyMap> 
-    void colorize_segmentation(Scene_polyhedron_item* item, SegmentPropertyMap segment_ids, std::vector<QColor>& color_vector);
-    void check_and_set_ids(Polyhedron* polyhedron);
-    void init_color_map_sdf();
-    void init_color_map_segmentation();
-    
-    public Q_SLOTS:
-        void on_actionSegmentation_triggered();
-        void on_Partition_button_clicked();
-        void on_SDF_button_clicked();
-        void itemAboutToBeDestroyed(CGAL::Three::Scene_item*);
-private:
-    QAction*                      actionSegmentation;
-    QDockWidget*                  dock_widget;
-    Ui::Mesh_segmentation         ui_widget;
-    
-    std::vector<QColor>  color_map_sdf;
-    std::vector<QColor>  color_map_segmentation;
-    Item_sdf_map         item_sdf_map;
-};
-
-void Polyhedron_demo_mesh_segmentation_plugin::init_color_map_sdf()
-{
-    color_map_sdf = std::vector<QColor>(256);
-    int r = 0, g = 0, b = 255;
-    for(int i = 0; i <= 255; ++i)
-    {
-        if(i > 128 && i <= 192) { r = static_cast<int>( ((i - 128) / (192.0 - 128)) * 255 ); }        
-        if(i > 0 && i <= 98)    { g = static_cast<int>( ((i) / (98.0)) * 255 ); }
-        if(i > 191 && i <=255)  { g = 255 - static_cast<int>( ((i - 191) / (255.0 - 191)) * 255 ); }
-        if(i > 64 && i <= 127)  { b = 255 - static_cast<int>( ((i - 64) / (127.0 - 64)) * 255 ); }
-        color_map_sdf[i] = QColor(r, g, b);        
-    }
-}
-
-void Polyhedron_demo_mesh_segmentation_plugin::init_color_map_segmentation()
-{
-
-    color_map_segmentation.push_back(QColor( 173, 35, 35)); 
-    color_map_segmentation.push_back(QColor( 87, 87, 87));    
-    color_map_segmentation.push_back(QColor( 42, 75, 215)); 
-    color_map_segmentation.push_back(QColor( 29, 105, 20)); 
-    color_map_segmentation.push_back(QColor( 129, 74, 25)); 
-    color_map_segmentation.push_back(QColor( 129, 38, 192)); 
-    color_map_segmentation.push_back(QColor( 160, 160, 160)); 
-    color_map_segmentation.push_back(QColor( 129, 197, 122)); 
-    color_map_segmentation.push_back(QColor( 157, 175, 255)); 
-    color_map_segmentation.push_back(QColor( 41, 208, 208)); 
-    color_map_segmentation.push_back(QColor( 255, 146, 51)); 
-    color_map_segmentation.push_back(QColor( 255, 238, 51)); 
-    color_map_segmentation.push_back(QColor( 233, 222, 187)); 
-    color_map_segmentation.push_back(QColor( 255, 205, 243)); 
-    
-}
-
-void Polyhedron_demo_mesh_segmentation_plugin::itemAboutToBeDestroyed(CGAL::Three::Scene_item* scene_item)
-{
-    if(Scene_polyhedron_item* item = qobject_cast<Scene_polyhedron_item*>(scene_item)) {
-      item_sdf_map.erase(item);
-    }
-}
-
-void Polyhedron_demo_mesh_segmentation_plugin::on_actionSegmentation_triggered()
-{ dock_widget->show(); }
-
-void Polyhedron_demo_mesh_segmentation_plugin::on_SDF_button_clicked()
-{
-    CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-    Scene_polyhedron_item* item = qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-    if(!item) { return; }
-    QApplication::setOverrideCursor(Qt::WaitCursor);
-    
-    std::size_t number_of_rays = ui_widget.Number_of_rays_spin_box->value();
-    double cone_angle = (ui_widget.Cone_angle_spin_box->value()  / 180.0) * CGAL_PI;
-    bool create_new_item = ui_widget.New_item_check_box->isChecked();
-    
-    Item_sdf_map::iterator pair;
-    Scene_polyhedron_item* active_item = item;
-
-    if(create_new_item) {
-        active_item = new Scene_polyhedron_item(*item->polyhedron()); 
-        active_item->setGouraudMode();
-    }
-    
-    pair = item_sdf_map.insert(
-            std::make_pair(active_item, std::vector<double>()) ).first; 
-    
-    check_and_set_ids(pair->first->polyhedron());
-    pair->second.resize(item->polyhedron()->size_of_facets(), 0.0);
-    Polyhedron_with_id_to_vector_property_map<Polyhedron, double>  sdf_pmap(&pair->second);
-    QTime time;
-    time.start();
-    std::pair<double, double> min_max_sdf = sdf_values(*(pair->first->polyhedron()), sdf_pmap, cone_angle, number_of_rays);
-    std::cout << "ok (" << time.elapsed() << " ms)" << std::endl;
-
-    std::cout << "SDF computation is completed. Min-SDF : " << min_max_sdf.first << " " "Max-SDF : " << min_max_sdf.second << std::endl;
-
-    pair->first->set_color_vector_read_only(true);
-    colorize_sdf(pair->first, sdf_pmap, pair->first->color_vector());
-       
-    pair->first->setName(tr("(SDF-%1-%2)").arg(number_of_rays).arg(ui_widget.Cone_angle_spin_box->value()));
-    
-    if(create_new_item) {
-        scene->addItem(pair->first);
-        item->setVisible(false);
-        scene->itemChanged(item);
-        scene->itemChanged(pair->first);
-        scene->setSelectedItem(index);
-    }
-    else {
-      item->invalidateOpenGLBuffers();
-      scene->itemChanged(index);
-    }
-
-    QApplication::restoreOverrideCursor();
-}
-
-void Polyhedron_demo_mesh_segmentation_plugin::on_Partition_button_clicked()
-{    
-    CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-    Scene_polyhedron_item* item = qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-    if(!item) { return; }
-    
-    QApplication::setOverrideCursor(Qt::WaitCursor);
-    
-    std::size_t number_of_clusters = ui_widget.Number_of_clusters_spin_box->value();
-    double smoothness = ui_widget.Smoothness_spin_box->value();
-    std::size_t number_of_rays = ui_widget.Number_of_rays_spin_box->value();
-    double cone_angle = (ui_widget.Cone_angle_spin_box->value()  / 180.0) * CGAL_PI;
-    bool create_new_item = ui_widget.New_item_check_box->isChecked();
-    bool extract_segments = ui_widget.Extract_segments_check_box->isChecked();
-
-    Item_sdf_map::iterator pair;
-    if(create_new_item)
-    {
-        // create new item
-        Scene_polyhedron_item* new_item = new Scene_polyhedron_item(*item->polyhedron()); 
-        new_item->setGouraudMode(); 
-        
-        // copy SDF values of existing poly to new poly
-        Item_sdf_map::iterator it = item_sdf_map.find(item);
-        const std::vector<double>& sdf_data = it == item_sdf_map.end() ?
-                                              std::vector<double>() : it->second;
-        pair = item_sdf_map.insert(std::make_pair(new_item, sdf_data) ).first;
-    }
-    else
-    {
-        std::pair<Item_sdf_map::iterator, bool> res = 
-          item_sdf_map.insert(std::make_pair(item, std::vector<double>()) );
-        pair = res.first;
-    }
-
-    check_and_set_ids(pair->first->polyhedron());
-    QTime time;
-    time.start();
-    if(pair->second.empty()) { // SDF values are empty, calculate
-      pair->second.resize(pair->first->polyhedron()->size_of_facets(), 0.0);
-      Polyhedron_with_id_to_vector_property_map<Polyhedron, double> sdf_pmap(&pair->second);
-      sdf_values(*(pair->first->polyhedron()), sdf_pmap, cone_angle, number_of_rays); 
-    }
-
-    std::vector<std::size_t> internal_segment_map(pair->first->polyhedron()->size_of_facets());
-    Polyhedron_with_id_to_vector_property_map<Polyhedron, std::size_t> segment_pmap(&internal_segment_map);
-    Polyhedron_with_id_to_vector_property_map<Polyhedron, double> sdf_pmap(&pair->second);
-
-    std::size_t nb_segments = segmentation_from_sdf_values(*(pair->first->polyhedron())
-        ,sdf_pmap, segment_pmap, number_of_clusters, smoothness, extract_segments); 
-    std::cout << "ok (" << time.elapsed() << " ms)" << std::endl;
-    std::cout << "Segmentation is completed. Number of segments : " << nb_segments << std::endl;  
-    pair->first->set_color_vector_read_only(true);  
-     
-    colorize_segmentation(pair->first, segment_pmap, pair->first->color_vector());
-    pair->first->setName(tr("(Segmentation-%1-%2)").arg(number_of_clusters).arg(smoothness));   
-
-    if(create_new_item) {
-        scene->addItem(pair->first);
-        item->setVisible(false);
-        scene->itemChanged(item);
-        scene->itemChanged(pair->first);
-        scene->setSelectedItem(index);
-    }
-    else {
-      item->invalidateOpenGLBuffers();
-      scene->itemChanged(index);
-    }
-
-    QApplication::restoreOverrideCursor();
-}
-
-void Polyhedron_demo_mesh_segmentation_plugin::check_and_set_ids(Polyhedron* polyhedron)
-{
-    Polyhedron::Facet_iterator a_facet = polyhedron->facets_begin();
-    Polyhedron::Facet_iterator another_facet = ++polyhedron->facets_begin();
-    if(a_facet->id() != another_facet->id()) { return; } // ids are OK
-    std::size_t facet_id = 0;
-    for(Polyhedron::Facet_iterator facet_it = polyhedron->facets_begin();
-        facet_it != polyhedron->facets_end(); ++facet_it, ++facet_id)
-    {
-        facet_it->id() = facet_id;
-    }
-}
-
-template<class SDFPropertyMap>
-void Polyhedron_demo_mesh_segmentation_plugin::colorize_sdf(
-     Scene_polyhedron_item* item,
-     SDFPropertyMap sdf_values,  
-     std::vector<QColor>& color_vector)
-{
-    item->setItemIsMulticolor(true);
-    Polyhedron* polyhedron = item->polyhedron();
-    color_vector.clear();
-    std::size_t patch_id = 0;
-    for(Polyhedron::Facet_iterator facet_it = polyhedron->facets_begin(); 
-        facet_it != polyhedron->facets_end(); ++facet_it, ++patch_id)   
-    {
-        double sdf_value = sdf_values[facet_it]; 
-        int gray_color = static_cast<int>(255 * sdf_value);
-        if(gray_color < 0 || gray_color >= 256) {
-          color_vector.push_back(QColor::fromRgb(0,0,0));
-        }
-        else {
-          color_vector.push_back(color_map_sdf[gray_color]);
-        }
-        facet_it->set_patch_id(static_cast<int>(patch_id));
-    }
-}
-
-template<class SegmentPropertyMap>
-void Polyhedron_demo_mesh_segmentation_plugin::colorize_segmentation(
-     Scene_polyhedron_item* item,
-     SegmentPropertyMap segment_ids,
-     std::vector<QColor>& color_vector)
-{
-    item->setItemIsMulticolor(true);
-    Polyhedron* polyhedron = item->polyhedron();
-    color_vector.clear();
-    std::size_t max_segment = 0;
-    for(Polyhedron::Facet_iterator facet_it = polyhedron->facets_begin(); 
-        facet_it != polyhedron->facets_end(); ++facet_it)   
-    {
-        std::size_t segment_id = segment_ids[facet_it];
-        facet_it->set_patch_id(static_cast<int>(segment_id));
-        max_segment = (std::max)(max_segment, segment_id);      
-    }
-    for(std::size_t i = 0; i <= max_segment; ++i)   
-    {
-        QColor aColor = color_map_segmentation[(max_segment - i) % color_map_segmentation.size()]; 
-        color_vector.push_back(aColor);     
-    }    
-}
-
-#include "Mesh_segmentation_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh/Mesh_segmentation_widget.ui b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh/Mesh_segmentation_widget.ui
deleted file mode 100644
index 8595f30..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh/Mesh_segmentation_widget.ui
+++ /dev/null
@@ -1,186 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>Mesh_segmentation</class>
- <widget class="QDockWidget" name="Mesh_segmentation">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>286</width>
-    <height>254</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Mesh Segmentation</string>
-  </property>
-  <widget class="QWidget" name="dockWidgetContents">
-   <layout class="QVBoxLayout" name="verticalLayout">
-    <item>
-     <widget class="QGroupBox" name="groupBox_2">
-      <property name="title">
-       <string>SDF Calculation Parameters</string>
-      </property>
-      <layout class="QGridLayout" name="gridLayout_2">
-       <item row="0" column="0">
-        <widget class="QLabel" name="Number_of_rays_label">
-         <property name="text">
-          <string>Number of rays:</string>
-         </property>
-         <property name="alignment">
-          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-         </property>
-        </widget>
-       </item>
-       <item row="0" column="1">
-        <widget class="QSpinBox" name="Number_of_rays_spin_box">
-         <property name="value">
-          <number>25</number>
-         </property>
-        </widget>
-       </item>
-       <item row="1" column="0">
-        <widget class="QLabel" name="Cone_angle_label">
-         <property name="text">
-          <string>Cone angle:</string>
-         </property>
-         <property name="alignment">
-          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-         </property>
-        </widget>
-       </item>
-       <item row="1" column="1">
-        <widget class="QSpinBox" name="Cone_angle_spin_box">
-         <property name="maximum">
-          <number>180</number>
-         </property>
-         <property name="value">
-          <number>120</number>
-         </property>
-        </widget>
-       </item>
-      </layout>
-     </widget>
-    </item>
-    <item>
-     <widget class="QGroupBox" name="groupBox">
-      <property name="title">
-       <string>Segmentation Parameters</string>
-      </property>
-      <layout class="QGridLayout" name="gridLayout">
-       <item row="0" column="1">
-        <widget class="QSpinBox" name="Number_of_clusters_spin_box">
-         <property name="minimum">
-          <number>1</number>
-         </property>
-         <property name="value">
-          <number>5</number>
-         </property>
-        </widget>
-       </item>
-       <item row="1" column="0">
-        <widget class="QLabel" name="Smoothness_label">
-         <property name="layoutDirection">
-          <enum>Qt::LeftToRight</enum>
-         </property>
-         <property name="text">
-          <string>Smoothness:</string>
-         </property>
-         <property name="alignment">
-          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-         </property>
-        </widget>
-       </item>
-       <item row="0" column="0">
-        <widget class="QLabel" name="Number_of_clusters_label">
-         <property name="text">
-          <string>Number of clusters:</string>
-         </property>
-         <property name="alignment">
-          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-         </property>
-        </widget>
-       </item>
-       <item row="1" column="1">
-        <widget class="QDoubleSpinBox" name="Smoothness_spin_box">
-         <property name="maximum">
-          <double>10.000000000000000</double>
-         </property>
-         <property name="singleStep">
-          <double>0.010000000000000</double>
-         </property>
-         <property name="value">
-          <double>0.260000000000000</double>
-         </property>
-        </widget>
-       </item>
-       <item row="2" column="0">
-        <widget class="QLabel" name="label">
-         <property name="layoutDirection">
-          <enum>Qt::LeftToRight</enum>
-         </property>
-         <property name="text">
-          <string>Extract segments:</string>
-         </property>
-         <property name="alignment">
-          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-         </property>
-        </widget>
-       </item>
-       <item row="2" column="1">
-        <widget class="QCheckBox" name="Extract_segments_check_box">
-         <property name="text">
-          <string/>
-         </property>
-         <property name="checked">
-          <bool>true</bool>
-         </property>
-        </widget>
-       </item>
-      </layout>
-     </widget>
-    </item>
-    <item>
-     <layout class="QHBoxLayout">
-      <item>
-       <layout class="QGridLayout" name="gridLayout_3">
-        <item row="0" column="0">
-         <widget class="QLabel" name="New_item_label">
-          <property name="text">
-           <string>Create new item:</string>
-          </property>
-          <property name="alignment">
-           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-          </property>
-         </widget>
-        </item>
-        <item row="0" column="1">
-         <widget class="QCheckBox" name="New_item_check_box">
-          <property name="text">
-           <string/>
-          </property>
-         </widget>
-        </item>
-       </layout>
-      </item>
-      <item>
-       <widget class="QPushButton" name="SDF_button">
-        <property name="text">
-         <string>Calculate SDF</string>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QPushButton" name="Partition_button">
-        <property name="text">
-         <string>Segment</string>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </item>
-   </layout>
-  </widget>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh/Mesh_simplification_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh/Mesh_simplification_plugin.cpp
deleted file mode 100644
index a29c92e..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh/Mesh_simplification_plugin.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-
-#include "Scene_polyhedron_item.h"
-#include "Polyhedron_type.h"
-
-#include <QApplication>
-#include <QMainWindow>
-#include <QInputDialog>
-#include <QTime>
-#include <QAction>
-
-#include <CGAL/Surface_mesh_simplification/HalfedgeGraph_Polyhedron_3.h>
-#include <CGAL/Surface_mesh_simplification/edge_collapse.h>
-#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h>
-using namespace CGAL::Three;
-class Polyhedron_demo_mesh_simplification_plugin : 
-  public QObject,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-public:
-  // used by Polyhedron_demo_plugin_helper
-  QStringList actionsNames() const {
-    return QStringList() << "actionSimplify";
-  }
-
-  void init(QMainWindow* mainWindow,
-            Scene_interface* scene_interface)
-  {
-      mw = mainWindow;
-      scene = scene_interface;
-      actions_map["actionSimplify"] = getActionFromMainWindow(mw, "actionSimplify");
-      actions_map["actionSimplify"]->setProperty("subMenuName",
-                                                 "Triangulated Surface Mesh Simplification");
-      autoConnectActions();
-
-  }
-  bool applicable(QAction*) const { 
-    return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
-  }
-public Q_SLOTS:
-  void on_actionSimplify_triggered();
-
-}; // end Polyhedron_demo_mesh_simplification_plugin
-
-void Polyhedron_demo_mesh_simplification_plugin::on_actionSimplify_triggered()
-{
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-  
-  Scene_polyhedron_item* item = 
-    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-
-  if(item)
-  {
-    Polyhedron* pMesh = item->polyhedron();
-
-    // get option (#edges)
-    bool ok;
-  
-    const int nb_edges = 
-    QInputDialog::getInt(mw, tr("Stop condition"),
-      tr("Number of edges:"),
-      (int)(pMesh->size_of_halfedges () / 4), // default value: current #edges / 2 
-      3, // min = one triangle
-      (int)pMesh->size_of_halfedges(), // max #edges
-      1, // step for the spinbox
-      &ok);
-
-    // check user cancellation
-    if(!ok)
-      return;
-
-    // simplify
-    QTime time;
-    time.start();
-    std::cout << "Simplify...";
-    QApplication::setOverrideCursor(Qt::WaitCursor);
-    namespace SMS = CGAL::Surface_mesh_simplification;
-    SMS::Count_stop_predicate< Polyhedron > stop(nb_edges); // target #edges
-    SMS::edge_collapse( *pMesh, stop,
-                        CGAL::parameters::vertex_index_map(get(CGAL::vertex_external_index,*pMesh))
-                                         .halfedge_index_map(get(CGAL::halfedge_external_index,*pMesh)));
-    std::cout << "ok (" << time.elapsed() << " ms, " 
-      << pMesh->size_of_halfedges() / 2 << " edges)" << std::endl;
-
-    // update scene
-    item->invalidateOpenGLBuffers();
-    scene->itemChanged(index);
-    QApplication::restoreOverrideCursor();
-  }
-}
-
-#include "Mesh_simplification_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh/Parameterization_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh/Parameterization_plugin.cpp
deleted file mode 100644
index 1ed5b64..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh/Parameterization_plugin.cpp
+++ /dev/null
@@ -1,193 +0,0 @@
-#include <QApplication>
-#include <QAction>
-#include <QMainWindow>
-#include <QStringList>
-
-#include "Scene_polyhedron_item.h"
-#include "Scene_textured_polyhedron_item.h"
-#include "Textured_polyhedron_type.h"
-#include "Polyhedron_type.h"
-
-#include <QTime>
-
-#include <CGAL/Parameterization_polyhedron_adaptor_3.h>
-#include <CGAL/parameterize.h>
-#include <CGAL/Discrete_conformal_map_parameterizer_3.h>
-#include <CGAL/LSCM_parameterizer_3.h>
-#include <CGAL/Two_vertices_parameterizer_3.h>
-
-#include <CGAL/Textured_polyhedron_builder.h>
-
-#include <iostream>
-
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-
-typedef Kernel::FT FT;
-using namespace CGAL::Three;
-class Polyhedron_demo_parameterization_plugin : 
-  public QObject,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-public:
-  // used by Polyhedron_demo_plugin_helper
-  QStringList actionsNames() const {
-    return QStringList() << "actionMVC"
-                         << "actionDCP"
-                         << "actionLSC";
-  }
-
-  void init(QMainWindow* mainWindow,
-            Scene_interface* scene_interface)
-  {
-      mw = mainWindow;
-      scene = scene_interface;
-      actions_map["actionMVC"] = new QAction("Mean Value Coordinates", mw);
-      actions_map["actionMVC"]->setProperty("subMenuName",
-        "Triangulated Surface Mesh Parameterization");
-
-      actions_map["actionDCP"] = new QAction ("Discrete Conformal Map", mw);
-      actions_map["actionDCP"]->setProperty("subMenuName",
-        "Triangulated Surface Mesh Parameterization");
-
-      actions_map["actionLSC"] = new QAction("Least Square Conformal Map", mw);
-      actions_map["actionLSC"]->setProperty("subMenuName",
-        "Triangulated Surface Mesh Parameterization");
-
-      connect(actions_map["actionMVC"], SIGNAL(triggered()),
-              this, SLOT(on_actionMVC_triggered()));
-      connect(actions_map["actionDCP"], SIGNAL(triggered()),
-              this, SLOT(on_actionDCP_triggered()));
-      connect(actions_map["actionLSC"], SIGNAL(triggered()),
-              this, SLOT(on_actionLSC_triggered()));
-  }
-
-  bool applicable(QAction*) const { 
-    return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
-  }
-
-public Q_SLOTS:
-  void on_actionMVC_triggered();
-  void on_actionDCP_triggered();
-  void on_actionLSC_triggered();
-
-protected:
-  enum Parameterization_method { PARAM_MVC, PARAM_DCP, PARAM_LSC };
-  void parameterize(Parameterization_method method);
-}; // end Polyhedron_demo_parameterization_plugin
-
-
-
-void Polyhedron_demo_parameterization_plugin::parameterize(const Parameterization_method method)
-{
-  // get active polyhedron
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-  Scene_polyhedron_item* poly_item = 
-    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-  if(!poly_item)
-    return;
-
-  Polyhedron* pMesh = poly_item->polyhedron();
-  if(!pMesh)
-    return;
-
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-
-  // parameterize
-  QTime time;
-  time.start();
-  typedef CGAL::Parameterization_polyhedron_adaptor_3<Polyhedron> Adaptor;
-  Adaptor adaptor(*pMesh);  
-
-  bool success = false;
-  switch(method)
-  {
-  case PARAM_MVC:
-    {
-      std::cout << "Parameterize (MVC)...";
-      typedef CGAL::Mean_value_coordinates_parameterizer_3<Adaptor> Parameterizer;
-      Parameterizer::Error_code err = CGAL::parameterize(adaptor,Parameterizer());
-      success = err == Parameterizer::OK;
-      break;
-    }
-  case PARAM_DCP:
-    {
-      std::cout << "Parameterize (DCP)...";
-      typedef CGAL::Discrete_conformal_map_parameterizer_3<Adaptor> Parameterizer;
-      Parameterizer::Error_code err = CGAL::parameterize(adaptor,Parameterizer());
-      success = err == Parameterizer::OK;
-    }  
-  case PARAM_LSC:
-    {
-      std::cout << "Parameterize (LSC)...";
-      typedef CGAL::LSCM_parameterizer_3<Adaptor> Parameterizer;
-      Parameterizer::Error_code err = CGAL::parameterize(adaptor,Parameterizer());
-      success = err == Parameterizer::OK;
-    }
-  }
-
-  if(success)
-    std::cout << "ok (" << time.elapsed() << " ms)" << std::endl;
-  else
-  {
-    std::cout << "failure" << std::endl;
-    QApplication::restoreOverrideCursor();
-    return;
-  }
-
-  // add textured polyhedon to the scene
-  Textured_polyhedron *pTex_polyhedron = new Textured_polyhedron();
-  Textured_polyhedron_builder<Polyhedron,Textured_polyhedron,Kernel> builder;
-  builder.run(*pMesh,*pTex_polyhedron);
-  pTex_polyhedron->compute_normals();
-
-  Polyhedron::Vertex_iterator it1;
-  Textured_polyhedron::Vertex_iterator it2;
-  for(it1 = pMesh->vertices_begin(), 
-    it2 = pTex_polyhedron->vertices_begin();
-    it1 != pMesh->vertices_end() &&
-    it2 != pTex_polyhedron->vertices_end();
-  it1++, it2++)
-  {
-    // (u,v) pair is stored per halfedge
-    FT u = adaptor.info(it1->halfedge())->uv().x();
-    FT v = adaptor.info(it1->halfedge())->uv().y();
-    it2->u() = u;
-    it2->v() = v;
-  }
-
-  Scene_item* new_item = new Scene_textured_polyhedron_item(pTex_polyhedron);
-
-  new_item->setName(tr("%1 (parameterized)").arg(poly_item->name()));
-  new_item->setColor(Qt::white);
-  new_item->setRenderingMode(poly_item->renderingMode());
-
-  poly_item->setVisible(false);
-  scene->itemChanged(index);
-  scene->addItem(new_item);
-
-  QApplication::restoreOverrideCursor();
-}
-
-void Polyhedron_demo_parameterization_plugin::on_actionMVC_triggered()
-{
-  parameterize(PARAM_MVC);
-}
-
-void Polyhedron_demo_parameterization_plugin::on_actionDCP_triggered()
-{
-  std::cerr << "DCP...";
-  parameterize(PARAM_DCP);
-}
-
-void Polyhedron_demo_parameterization_plugin::on_actionLSC_triggered()
-{
-  std::cerr << "LSC...";
-  parameterize(PARAM_LSC);
-}
-
-#include "Parameterization_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh/Remeshing_dialog.ui b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh/Remeshing_dialog.ui
deleted file mode 100644
index 27af120..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh/Remeshing_dialog.ui
+++ /dev/null
@@ -1,174 +0,0 @@
-<ui version="4.0">
- <class>Remeshing_dialog</class>
- <widget class="QDialog" name="Remeshing_dialog">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>389</width>
-    <height>173</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Meshing criteria</string>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout">
-   <item>
-    <layout class="QGridLayout" name="gridLayout">
-     <item row="0" column="0">
-      <widget class="QLabel" name="angleLabel">
-       <property name="text">
-        <string>&Angle:</string>
-       </property>
-       <property name="alignment">
-        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-       </property>
-       <property name="buddy">
-        <cstring>angle</cstring>
-       </property>
-      </widget>
-     </item>
-     <item row="0" column="1">
-      <widget class="QDoubleSpinBox" name="angle">
-       <property name="minimum">
-        <double>1.000000000000000</double>
-       </property>
-       <property name="maximum">
-        <double>30.000000000000000</double>
-       </property>
-       <property name="value">
-        <double>25.000000000000000</double>
-       </property>
-      </widget>
-     </item>
-     <item row="1" column="0">
-      <widget class="QLabel" name="sizingLabel">
-       <property name="text">
-        <string>&Size:</string>
-       </property>
-       <property name="alignment">
-        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-       </property>
-       <property name="buddy">
-        <cstring>sizing</cstring>
-       </property>
-      </widget>
-     </item>
-     <item row="1" column="1">
-      <widget class="QDoubleSpinBox" name="sizing">
-       <property name="decimals">
-        <number>4</number>
-       </property>
-      </widget>
-     </item>
-     <item row="2" column="0">
-      <widget class="QLabel" name="approxLabel">
-       <property name="text">
-        <string>Approximation &error:</string>
-       </property>
-       <property name="alignment">
-        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-       </property>
-       <property name="buddy">
-        <cstring>approx</cstring>
-       </property>
-      </widget>
-     </item>
-     <item row="2" column="1">
-      <widget class="QDoubleSpinBox" name="approx"/>
-     </item>
-     <item row="3" column="1">
-      <widget class="QComboBox" name="tags">
-       <item>
-        <property name="text">
-         <string>Non manifold</string>
-        </property>
-       </item>
-       <item>
-        <property name="text">
-         <string>Manifold</string>
-        </property>
-       </item>
-       <item>
-        <property name="text">
-         <string>Manifold with boundaries</string>
-        </property>
-       </item>
-      </widget>
-     </item>
-     <item row="3" column="0">
-      <widget class="QLabel" name="label">
-       <property name="text">
-        <string>&Topological criterion:</string>
-       </property>
-       <property name="alignment">
-        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-       </property>
-       <property name="buddy">
-        <cstring>tags</cstring>
-       </property>
-      </widget>
-     </item>
-    </layout>
-   </item>
-   <item>
-    <widget class="QDialogButtonBox" name="buttonBox">
-     <property name="orientation">
-      <enum>Qt::Horizontal</enum>
-     </property>
-     <property name="standardButtons">
-      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
-     </property>
-    </widget>
-   </item>
-   <item>
-    <spacer name="verticalSpacer">
-     <property name="orientation">
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>20</width>
-       <height>40</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
-  </layout>
- </widget>
- <resources/>
- <connections>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>accepted()</signal>
-   <receiver>Remeshing_dialog</receiver>
-   <slot>accept()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>384</x>
-     <y>191</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>157</x>
-     <y>195</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>rejected()</signal>
-   <receiver>Remeshing_dialog</receiver>
-   <slot>reject()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>384</x>
-     <y>191</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>286</x>
-     <y>195</y>
-    </hint>
-   </hints>
-  </connection>
- </connections>
-</ui>
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh/Remeshing_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh/Remeshing_plugin.cpp
deleted file mode 100644
index 5be2a2c..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh/Remeshing_plugin.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-#include "config.h"
-#ifdef CGAL_POLYHEDRON_DEMO_USE_SURFACE_MESHER
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-#include "ui_Remeshing_dialog.h"
-
-#include <QObject>
-#include <QAction>
-#include <QMainWindow>
-#include <QMenu>
-#include <QApplication>
-#include <QtPlugin>
-#include "Scene_polyhedron_item.h"
-#include <QInputDialog>
-#include <QStringList>
-
-// declare the CGAL function
-CGAL::Three::Scene_item* cgal_code_remesh(QWidget* parent,
-                             Polyhedron*,
-                             const double angle,
-                             const double sizing,
-                             const double approx,
-                             int tag);
-using namespace CGAL::Three;
-class Polyhedron_demo_remeshing_plugin : 
-  public QObject,
-  protected Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-public:
-  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface) {
-    this->scene = scene_interface;
-    this->mw = mainWindow;
-    actionRemeshing = this->getActionFromMainWindow(mw, "actionRemeshing");
-    actionRemeshing->setProperty("subMenuName", "3D Surface Mesh Generation");
-    if(actionRemeshing) {
-      connect(actionRemeshing, SIGNAL(triggered()),
-              this, SLOT(remesh()));
-    }
-  }
-
-  bool applicable(QAction*) const {
-    return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
-  }
-
-  QList<QAction*> actions() const {
-    return QList<QAction*>() << actionRemeshing;
-  }
-public Q_SLOTS:
-  void remesh();
-
-private:
-  QAction* actionRemeshing;
-}; // end class Polyhedron_demo_remeshing_plugin
-
-void Polyhedron_demo_remeshing_plugin::remesh()
-{
-  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
-
-  Scene_polyhedron_item* item =
-    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
-
-  if(item)
-  {
-    Polyhedron* pMesh = item->polyhedron();
-
-    if(!pMesh) return;
-
-    // TODO:
-    // sizing and approximation parameters should be expressed as ratio of
-    // scene bbox diagonal.
-
-    QDialog dialog(mw);
-    Ui::Remeshing_dialog ui;
-    ui.setupUi(&dialog);
-    connect(ui.buttonBox, SIGNAL(accepted()),
-            &dialog, SLOT(accept()));
-    connect(ui.buttonBox, SIGNAL(rejected()),
-            &dialog, SLOT(reject()));
-    double diag = scene->len_diagonal();
-
-    ui.sizing->setDecimals(4);
-    ui.sizing->setRange(diag * 10e-6, // min
-                       diag); // max
-    ui.sizing->setValue(diag * 0.05); // default value
-
-    ui.approx->setDecimals(6);
-    ui.approx->setRange(diag * 10e-7, // min
-                       diag); // max
-    ui.approx->setValue(diag * 0.005);
-
-
-    int i = dialog.exec();
-    if(i == QDialog::Rejected)
-      return;
-
-    const double angle = ui.angle->value();
-    const double approx = ui.approx->value();
-    const double sizing = ui.sizing->value();
-    const int tag_index = ui.tags->currentIndex();
-    if(tag_index < 0) return;
-
-    QApplication::setOverrideCursor(Qt::WaitCursor);
-
-    std::cerr << "remesh with:"
-              << "\n  angle=" << angle
-              << "\n  sizing=" << sizing
-              << "\n  approx=" << approx
-              << "\n  tag=" << tag_index
-              << std::boolalpha
-              << std::endl;
-    CGAL::Three::Scene_item* new_item = cgal_code_remesh(mw,
-                                            pMesh,
-                                            angle,
-                                            sizing,
-                                            approx,
-                                            tag_index);
-
-    if(new_item)
-    {
-      new_item->setName(tr("%1 remeshed (%2 %3 %4)")
-                         .arg(item->name())
-                         .arg(angle)
-                         .arg(sizing)
-                         .arg(approx));
-      new_item->setColor(Qt::magenta);
-      new_item->setRenderingMode(item->renderingMode());
-      item->setVisible(false);
-      scene->itemChanged(index);
-      scene->addItem(new_item);
-    }
-
-    QApplication::restoreOverrideCursor();
-  }
-}
-
-#include "Remeshing_plugin.moc"
-
-#endif // CGAL_POLYHEDRON_DEMO_USE_SURFACE_MESHER
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.cpp
deleted file mode 100644
index b52c54c..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.cpp
+++ /dev/null
@@ -1,531 +0,0 @@
-#include "Scene_polyhedron_shortest_path_item.h"
-
-#include "Scene_polylines_item.h"
-
-#include <vector>
-#include <Qt>
-#include <QKeySequence>
-#include <fstream>
-
-#include <CGAL/Surface_mesh_shortest_path/function_objects.h>
-
-Scene_polyhedron_shortest_path_item::Scene_polyhedron_shortest_path_item()
-   :Scene_polyhedron_item_decorator(NULL, false)
-  , m_shortestPaths(NULL)
-  , m_isTreeCached(false)
-  , m_shiftHeld(false)
-{
-}
-
-Scene_polyhedron_shortest_path_item::Scene_polyhedron_shortest_path_item(Scene_polyhedron_item* polyhedronItem, CGAL::Three::Scene_interface* sceneInterface, Messages_interface* messages, QMainWindow* mainWindow)
-  :Scene_polyhedron_item_decorator(polyhedronItem, false)
-  , m_shortestPaths(NULL)
-  , m_isTreeCached(false)
-  , m_shiftHeld(false)
-{ 
-  initialize(polyhedronItem, sceneInterface, messages, mainWindow);
-}
-  
-Scene_polyhedron_shortest_path_item::~Scene_polyhedron_shortest_path_item()
-{
-  deinitialize();
-}
-
-void Scene_polyhedron_shortest_path_item::compute_elements() const
-{
-
-    vertices.resize(0);
-
-    for(Surface_mesh_shortest_path::Source_point_iterator it = m_shortestPaths->source_points_begin(); it != m_shortestPaths->source_points_end(); ++it)
-    {
-      const Point_3& p = m_shortestPaths->point(it->first, it->second);
-      vertices.push_back(p.x());
-      vertices.push_back(p.y());
-      vertices.push_back(p.z());
-    }
-
-
-
-}
-
-void Scene_polyhedron_shortest_path_item::initialize_buffers(CGAL::Three::Viewer_interface* viewer)const
-{
-    //vao containing the data for the selected lines
-    {
-        program = getShaderProgram(PROGRAM_WITHOUT_LIGHT, viewer);
-        vaos[Selected_Edges]->bind();
-        program->bind();
-        buffers[Vertices].bind();
-        buffers[Vertices].allocate(vertices.data(), vertices.size()*sizeof(float));
-        program->enableAttributeArray("vertex");
-        program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
-        buffers[Vertices].release();
-        vaos[Selected_Edges]->release();
-    }
-    are_buffers_filled = true;
-}
-bool Scene_polyhedron_shortest_path_item::supportsRenderingMode(RenderingMode m) const
-{
-  switch (m)
-  {
-  case Points:
-    return true;
-  case PointsPlusNormals:
-    return true;
-  case Wireframe:
-    return true;
-  case Flat:
-    return true;
-  case FlatPlusEdges:
-    return true;
-  case Gouraud:
-    return true;
-  default:
-    return true;
-  }
-}
-  
-void Scene_polyhedron_shortest_path_item::draw(CGAL::Three::Viewer_interface* viewer) const
-{
-    if (supportsRenderingMode(renderingMode()))
-    {
-      draw_points(viewer);
-    }
-}
-
-
-void Scene_polyhedron_shortest_path_item::draw_points(CGAL::Three::Viewer_interface* viewer) const
-{
-    if(!are_buffers_filled)
-    {
-        initialize_buffers(viewer);
-    }
-   glPointSize(4.0f);
-   program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
-   attrib_buffers(viewer, PROGRAM_WITHOUT_LIGHT);
-   vaos[Selected_Edges]->bind();
-   program->bind();
-   program->setAttributeValue("colors", QColor(Qt::green));
-   viewer->glDrawArrays(GL_POINTS, 0, vertices.size()/3);
-   program->release();
-   vaos[Selected_Edges]->release();
-   glPointSize(1.0f);
-}
-  
-Scene_polyhedron_shortest_path_item* Scene_polyhedron_shortest_path_item::clone() const
-{
-  return 0;
-}
-
-void Scene_polyhedron_shortest_path_item::set_selection_mode(Selection_mode mode)
-{
-  m_selectionMode = mode;
-}
-
-Scene_polyhedron_shortest_path_item::Selection_mode Scene_polyhedron_shortest_path_item::get_selection_mode() const
-{
-  return m_selectionMode;
-}
-
-void Scene_polyhedron_shortest_path_item::set_primitives_mode(Primitives_mode mode)
-{
-  m_primitivesMode = mode;
-}
-
-Scene_polyhedron_shortest_path_item::Primitives_mode Scene_polyhedron_shortest_path_item::get_primitives_mode() const
-{
-  return m_primitivesMode;
-}
-
-void Scene_polyhedron_shortest_path_item::recreate_shortest_path_object()
-{
-  if (m_shortestPaths)
-  {
-    delete m_shortestPaths;
-  }
-
-  m_shortestPaths = new Surface_mesh_shortest_path(*polyhedron(), 
-            CGAL::get(boost::vertex_index, *polyhedron()), 
-            CGAL::get(CGAL::halfedge_index, *polyhedron()),
-            CGAL::get(CGAL::face_index, *polyhedron()),
-            CGAL::get(CGAL::vertex_point, *polyhedron()));
-            
-  //m_shortestPaths->m_debugOutput = true;
-
-  m_isTreeCached = false;
-}
-
-void Scene_polyhedron_shortest_path_item::ensure_aabb_object()
-{
-  if (!m_isTreeCached)
-  {
-    m_shortestPaths->build_aabb_tree(m_aabbTree);
-    m_isTreeCached = true;
-  }
-}
-
-void Scene_polyhedron_shortest_path_item::ensure_shortest_paths_tree()
-{
-  if (!m_shortestPaths->changed_since_last_build())
-  {
-    m_messages->information(tr("Recomputing shortest paths tree..."));
-    m_shortestPaths->build_sequence_tree();
-    m_messages->information(tr("Done."));
-  }
-}
-  
-void Scene_polyhedron_shortest_path_item::poly_item_changed()
-{
-  recreate_shortest_path_object();
-  invalidateOpenGLBuffers();
-  Q_EMIT itemChanged();
-}
-  
-void Scene_polyhedron_shortest_path_item::invalidateOpenGLBuffers()
-{
-  compute_elements();
-  compute_bbox();
-  are_buffers_filled = false;
-
-}
-
-bool Scene_polyhedron_shortest_path_item::get_mouse_ray(QMouseEvent* mouseEvent, Ray_3& outRay)
-{
-  bool found = false;
-  
-  QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
-  qglviewer::Camera* camera = viewer->camera();
-  const qglviewer::Vec point = camera->pointUnderPixel(mouseEvent->pos(), found);
-  
-  if(found)
-  {
-    const qglviewer::Vec orig = camera->position();
-    outRay = Ray_3(Point_3(orig.x, orig.y, orig.z), Point_3(point.x, point.y, point.z));
-  }
-  
-  return found;
-}
-
-void Scene_polyhedron_shortest_path_item::remove_nearest_point(const Face_location& faceLocation)
-{
-  Surface_mesh_shortest_path_traits::Compute_squared_distance_3 computeSquaredDistance3;
-  
-  const Point_3 pickLocation = m_shortestPaths->point(faceLocation.first, faceLocation.second);
-  
-  Surface_mesh_shortest_path::Source_point_iterator found = m_shortestPaths->source_points_end();
-  FT minDistance(0.0);
-  const FT thresholdDistance = FT(0.4);
-  
-  for (Surface_mesh_shortest_path::Source_point_iterator it = m_shortestPaths->source_points_begin(); it != m_shortestPaths->source_points_end(); ++it)
-  {
-    Point_3 sourceLocation = m_shortestPaths->point(it->first, it->second);
-    FT distance = computeSquaredDistance3(sourceLocation, pickLocation);
-    
-    if ((found == m_shortestPaths->source_points_end() && distance <= thresholdDistance) || distance < minDistance)
-    {
-      found = it;
-      minDistance = distance;
-    }
-  }
-  
-  if (found != m_shortestPaths->source_points_end())
-  {
-    m_shortestPaths->remove_source_point(found);
-  }
-}
-
-void Scene_polyhedron_shortest_path_item::get_as_edge_point(Scene_polyhedron_shortest_path_item::Face_location& inOutLocation)
-{
-  size_t minIndex = 0;
-  FT minCoord(inOutLocation.second[0]);
-  
-  for (size_t i = 1; i < 3; ++i)
-  {
-    if (minCoord > inOutLocation.second[i])
-    {
-      minIndex = i;
-      minCoord = inOutLocation.second[i];
-    }
-  }
-  
-  // The nearest edge is that of the two non-minimal barycentric coordinates
-  size_t nearestEdge[2];
-  size_t current = 0;
-  
-  for (size_t i = 0; i < 3; ++i)
-  {
-    if (i != minIndex)
-    {
-      nearestEdge[current] = i;
-      ++current;
-    }
-  }
-
-  Construct_barycentric_coordinate construct_barycentric_coordinate;
-
-  Point_3 trianglePoints[3] = { 
-    m_shortestPaths->point(inOutLocation.first, construct_barycentric_coordinate(FT(1.0), FT(0.0), FT(0.0))),
-    m_shortestPaths->point(inOutLocation.first, construct_barycentric_coordinate(FT(0.0), FT(1.0), FT(0.0))),
-    m_shortestPaths->point(inOutLocation.first, construct_barycentric_coordinate(FT(0.0), FT(0.0), FT(1.0))),
-  };
-  
-  CGAL::Surface_mesh_shortest_paths_3::Parametric_distance_along_segment_3<Surface_mesh_shortest_path_traits> parametricDistanceSegment3;
-  
-  Point_3 trianglePoint = m_shortestPaths->point(inOutLocation.first, inOutLocation.second);
-  
-  FT distanceAlongSegment = parametricDistanceSegment3(trianglePoints[nearestEdge[0]], trianglePoints[nearestEdge[1]], trianglePoint);
-  
-  FT coords[3] = { FT(0.0), FT(0.0), FT(0.0), };
-  
-  coords[nearestEdge[1]] = distanceAlongSegment;
-  coords[nearestEdge[0]] = FT(1.0) - distanceAlongSegment;
-
-  inOutLocation.second = construct_barycentric_coordinate(coords[0], coords[1], coords[2]);
-}
-
-void Scene_polyhedron_shortest_path_item::get_as_vertex_point(Scene_polyhedron_shortest_path_item::Face_location& inOutLocation)
-{
-  size_t maxIndex = 0;
-  FT maxCoord(inOutLocation.second[0]);
-  
-  for (size_t i = 1; i < 3; ++i)
-  {
-    if (inOutLocation.second[i] > maxCoord)
-    {
-      maxIndex = i;
-      maxCoord = inOutLocation.second[i];
-    }
-  }
-  
-  FT coords[3] = { FT(0.0), FT(0.0), FT(0.0), };
-  coords[maxIndex] = FT(1.0);
-  
-  Construct_barycentric_coordinate construct_barycentric_coordinate;
-  inOutLocation.second = construct_barycentric_coordinate(coords[0], coords[1], coords[2]);
-}
-
-bool Scene_polyhedron_shortest_path_item::run_point_select(const Ray_3& ray)
-{
-  ensure_aabb_object();
-  
-  Face_location faceLocation = m_shortestPaths->locate(ray, m_aabbTree);
-  
-  if (faceLocation.first == GraphTraits::null_face())
-  {
-    m_messages->information(tr("Shortest Paths: No face under cursor."));
-    return false;
-  }
-  else
-  {
-    m_messages->information(tr("Shortest Paths: Selected Face: %1; Barycentric coordinates: %2 %3 %4")
-      .arg(faceLocation.first->id())
-      .arg(double(faceLocation.second[0]))
-      .arg(double(faceLocation.second[1]))
-      .arg(double(faceLocation.second[2])));
-    switch (m_selectionMode)
-    {
-    case INSERT_POINTS_MODE:
-      switch (m_primitivesMode)
-      {
-      case VERTEX_MODE:
-        get_as_vertex_point(faceLocation);
-        m_shortestPaths->add_source_point(faceLocation.first, faceLocation.second);
-        break;
-      case EDGE_MODE:
-        get_as_edge_point(faceLocation);
-        m_shortestPaths->add_source_point(faceLocation.first, faceLocation.second);
-        break;
-      case FACE_MODE:
-        m_shortestPaths->add_source_point(faceLocation.first, faceLocation.second);
-        break;
-      }
-      break;
-    case REMOVE_POINTS_MODE:
-      remove_nearest_point(faceLocation);
-      break;
-    case SHORTEST_PATH_MODE:
-      switch (m_primitivesMode)
-      {
-      case VERTEX_MODE:
-        get_as_vertex_point(faceLocation);
-        break;
-      case EDGE_MODE:
-        get_as_edge_point(faceLocation);
-        break;
-      case FACE_MODE:
-        break;
-      }
-      
-      if (m_shortestPaths->number_of_source_points() > 0)
-      {
-        ensure_shortest_paths_tree();
-        
-        Scene_polylines_item* polylines = new Scene_polylines_item();
-            
-        polylines->polylines.push_back(Scene_polylines_item::Polyline());
-            
-        m_messages->information(tr("Computing shortest path polyline..."));
-
-        QTime time;
-        time.start();
-        //~ m_shortestPaths->m_debugOutput=true;
-        m_shortestPaths->shortest_path_points_to_source_points(faceLocation.first, faceLocation.second, std::back_inserter(polylines->polylines.back()));
-        std::cout << "ok (" << time.elapsed() << " ms)" << std::endl;
-        
-        polylines->setName(tr("%1 (shortest path)").arg(polyhedron_item()->name()));
-        polylines->setColor(Qt::red);
-
-        this->m_sceneInterface->addItem(polylines);
-      }
-      else
-      {
-        m_messages->warning(tr("No source points to compute shortest paths from."));
-      }
-      break;
-    }
-    invalidateOpenGLBuffers();
-    return true;
-  }
-}
-
-
-
-bool Scene_polyhedron_shortest_path_item::eventFilter(QObject* /*target*/, QEvent* event)
-{
-  if(event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease)
-  {
-    QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
-    Qt::KeyboardModifiers modifiers = keyEvent->modifiers();
-    m_shiftHeld = modifiers.testFlag(Qt::ShiftModifier);
-  }
-  
-  if (event->type() == QEvent::MouseButtonPress && m_shiftHeld)
-  {
-    QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
-    if(mouseEvent->button() == Qt::LeftButton) 
-    {
-      Ray_3 mouseRay;
-      
-      if (get_mouse_ray(mouseEvent, mouseRay))
-      {
-        if (run_point_select(mouseRay))
-        {
-          return true;
-        }
-      }
-    }
-  }
-  
-  return false;
-}
-
-bool Scene_polyhedron_shortest_path_item::load(const std::string& file_name)
-{
-  m_deferredLoadFilename = file_name;
-  return true;
-}
-
-bool Scene_polyhedron_shortest_path_item::deferred_load(Scene_polyhedron_item* polyhedronItem, CGAL::Three::Scene_interface* sceneInterface, Messages_interface* messages, QMainWindow* mainWindow)
-{
-  initialize(polyhedronItem, sceneInterface, messages, mainWindow);
-  
-  std::ifstream inFile(m_deferredLoadFilename.c_str());
-  
-  if (!inFile) 
-  { 
-    return false;
-  }
-  
-  m_shortestPaths->clear();
-  
-  std::vector<face_descriptor> listOfFaces;
-  listOfFaces.reserve(CGAL::num_faces(*polyhedron()));
-  face_iterator current, end;
-  for (boost::tie(current, end) = CGAL::faces(*polyhedron()); current != end; ++current)
-  {
-    listOfFaces.push_back(*current);
-  }
-
-  std::string line;
-  std::size_t faceId;
-  Barycentric_coordinate location;
-  Construct_barycentric_coordinate construct_barycentric_coordinate;
-
-  while (std::getline(inFile, line))
-  {
-    std::istringstream lineStream(line);
-    FT coords[3];
-    lineStream >> faceId >> coords[0] >> coords[1] >> coords[2];
-    
-    location = construct_barycentric_coordinate(coords[0], coords[1], coords[2]);
-    
-    // std::cout << "Read in face: " << faceId << " , " << location << std::endl;
-    
-    m_shortestPaths->add_source_point(listOfFaces[faceId], location);
-  }
-
-  return true;
-}
-
-bool Scene_polyhedron_shortest_path_item::save(const std::string& file_name) const 
-{
-  std::ofstream out(file_name.c_str());
-  
-  if (!out)
-  { 
-    return false; 
-  }
-
-  for(Surface_mesh_shortest_path::Source_point_iterator it = m_shortestPaths->source_points_begin(); it != m_shortestPaths->source_points_end(); ++it) 
-  { 
-    // std::cout << "Output face location: " << it->first->id() << " , " << it->second << std::endl;
-    out << it->first->id() << " " << it->second[0] << " " << it->second[1] << " " << it->second[3] << std::endl;
-  }
-
-  return true;
-}
-
-void Scene_polyhedron_shortest_path_item::initialize(Scene_polyhedron_item* polyhedronItem, CGAL::Three::Scene_interface* sceneInterface, Messages_interface* messages, QMainWindow* mainWindow)
-{
-  this->m_mainWindow = mainWindow;
-  this->m_messages = messages;
-  this->poly_item = polyhedronItem;
-  this->m_sceneInterface = sceneInterface;
-  connect(polyhedronItem, SIGNAL(item_is_about_to_be_changed()), this, SLOT(poly_item_changed())); 
-  QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
-  viewer->installEventFilter(this);
-  m_mainWindow->installEventFilter(this);
-  recreate_shortest_path_object();
-}
-
-void Scene_polyhedron_shortest_path_item::deinitialize()
-{
-  if (m_shortestPaths)
-  {
-    delete m_shortestPaths;
-  }
-  
-  this->poly_item = NULL;
-  this->m_sceneInterface = NULL;
-}
-
-bool Scene_polyhedron_shortest_path_item::isFinite() const
-{
-  return true;
-}
-
-bool Scene_polyhedron_shortest_path_item::isEmpty() const 
-{
-  return false;
-}
-
-void Scene_polyhedron_shortest_path_item::compute_bbox() const
-{
-  _bbox = polyhedron_item()->bbox();
-}
-
-QString Scene_polyhedron_shortest_path_item::toolTip() const
-{
-  return QString();
-}
-
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.h b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.h
deleted file mode 100644
index 0bff4db..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.h
+++ /dev/null
@@ -1,159 +0,0 @@
-#ifndef SCENE_POLYHEDRON_SHORTEST_PATH_ITEM_H
-#define SCENE_POLYHEDRON_SHORTEST_PATH_ITEM_H
-
-#include "Scene_polyhedron_shortest_path_item_config.h"
-#include "Scene_polyhedron_item_decorator.h"
-#include <CGAL/Three/Scene_interface.h>
-#include "Messages_interface.h"
-
-#include "Polyhedron_type.h"
-#include "Kernel_type.h"
-
-#include "opengl_tools.h"
-
-#include <QGLViewer/qglviewer.h>
-#include <QKeyEvent>
-#include <QMouseEvent>
-#include <QMainWindow>
-#include <QObject>
-
-#include <string>
-#include <list>
-
-#ifndef Q_MOC_RUN
-#include <CGAL/Surface_mesh_shortest_path.h>
-#endif
-
-#include <CGAL/AABB_face_graph_triangle_primitive.h>
-#include <CGAL/AABB_traits.h>
-#include <CGAL/AABB_tree.h>
-
-#include <boost/current_function.hpp>
-
-class SCENE_POLYHEDRON_SHORTEST_PATH_ITEM_EXPORT Scene_polyhedron_shortest_path_item : public Scene_polyhedron_item_decorator
-{
-  Q_OBJECT
-  
-  friend class Polyhedron_demo_shortest_path_plugin;
-  
-public:
-  typedef CGAL::Three::Scene_interface::Bbox Bbox;
-  
-  typedef boost::property_map<Polyhedron, CGAL::vertex_point_t>::type VertexPointMap;
-  
-  typedef boost::graph_traits<Polyhedron> GraphTraits;
-  typedef GraphTraits::face_descriptor face_descriptor;
-  typedef GraphTraits::face_iterator face_iterator;
-  
-  typedef CGAL::Surface_mesh_shortest_path_traits<Kernel, Polyhedron> Surface_mesh_shortest_path_traits;
-  typedef CGAL::Surface_mesh_shortest_path<Surface_mesh_shortest_path_traits> Surface_mesh_shortest_path;
-  typedef Surface_mesh_shortest_path::Face_location Face_location;
-  typedef CGAL::AABB_face_graph_triangle_primitive<Polyhedron, VertexPointMap> AABB_face_graph_primitive;
-  typedef CGAL::AABB_traits<Kernel, AABB_face_graph_primitive> AABB_face_graph_traits;
-  typedef CGAL::AABB_tree<AABB_face_graph_traits> AABB_face_graph_tree;
-  
-  typedef Surface_mesh_shortest_path_traits::Barycentric_coordinate Barycentric_coordinate;
-  typedef Surface_mesh_shortest_path_traits::Construct_barycentric_coordinate Construct_barycentric_coordinate;
-  typedef Surface_mesh_shortest_path_traits::Ray_3 Ray_3;
-  typedef Surface_mesh_shortest_path_traits::Point_3 Point_3;
-  typedef Surface_mesh_shortest_path_traits::FT FT;
-  
-  enum Selection_mode
-  {
-    INSERT_POINTS_MODE = 0,
-    REMOVE_POINTS_MODE = 1,
-    SHORTEST_PATH_MODE = 2
-  };
-  
-  enum Primitives_mode
-  {
-    VERTEX_MODE = 0,
-    EDGE_MODE = 1,
-    FACE_MODE = 2
-  };
-  
-  enum VAOs {
-      Selected_Edges=0,
-      NbOfVaos = Selected_Edges+1
-  };
-  enum VBOs {
-      Vertices = 0,
-      NbOfVbos = Vertices+1
-  };
-private:
-  Messages_interface* m_messages;
-  QMainWindow* m_mainWindow;
-  CGAL::Three::Scene_interface* m_sceneInterface;
-  Surface_mesh_shortest_path* m_shortestPaths;
-  AABB_face_graph_tree m_aabbTree;
-  
-  std::string m_deferredLoadFilename;
-  
-  Selection_mode m_selectionMode;
-  Primitives_mode m_primitivesMode;
-
-  bool m_isTreeCached;
-  
-  bool m_shiftHeld;
-  
-private:
-  bool get_mouse_ray(QMouseEvent* mouseEvent, Kernel::Ray_3&);
-
-  void recreate_shortest_path_object();
-  void ensure_aabb_object();
-  void ensure_shortest_paths_tree();
-  
-  bool run_point_select(const Kernel::Ray_3&);
-  void remove_nearest_point(const Face_location& ray);
-  void get_as_edge_point(Face_location& inOutLocation);
-  void get_as_vertex_point(Face_location& inOutLocation);
-
-  mutable std::vector<float> vertices;
-  mutable QOpenGLShaderProgram *program;
-
-  using Scene_polyhedron_item_decorator::initialize_buffers;
-  void initialize_buffers(CGAL::Three::Viewer_interface *viewer = 0) const;
-  void compute_elements(void) const;
-  
-  
-public:
-
-  Scene_polyhedron_shortest_path_item();
-  Scene_polyhedron_shortest_path_item(Scene_polyhedron_item* polyhedronItem, CGAL::Three::Scene_interface* sceneInterface, Messages_interface* messages, QMainWindow* mainWindow);
-  ~Scene_polyhedron_shortest_path_item();
-  
-  void set_selection_mode(Selection_mode mode);
-  Selection_mode get_selection_mode() const;
-  void set_primitives_mode(Primitives_mode mode);
-  Primitives_mode get_primitives_mode() const;
-  
-  virtual bool supportsRenderingMode(RenderingMode m) const;
-  using Scene_polyhedron_item_decorator::draw;
-  virtual void draw(CGAL::Three::Viewer_interface*) const;
-  // Points OpenGL drawing
-  virtual void draw_points(CGAL::Three::Viewer_interface*) const;
-  
-  virtual Scene_polyhedron_shortest_path_item* clone() const;
-  
-  bool deferred_load(Scene_polyhedron_item* polyhedronItem, CGAL::Three::Scene_interface* sceneInterface, Messages_interface* messages, QMainWindow* mainWindow);
-  virtual bool load(const std::string& file_name);
-  virtual bool save(const std::string& file_name) const;
-  
-protected:
-  void initialize(Scene_polyhedron_item* polyhedronItem, CGAL::Three::Scene_interface* sceneInterface, Messages_interface* messages, QMainWindow* mainWindow);
-  void deinitialize();
-  
-  virtual bool isFinite() const;
-  virtual bool isEmpty() const;
-  virtual void compute_bbox()const;
-  virtual QString toolTip() const;
-  
-protected:
-  bool eventFilter(QObject* /*target*/, QEvent * gen_event);
-  
-public Q_SLOTS:
-  virtual void poly_item_changed();
-  virtual void invalidateOpenGLBuffers();
-};
-
-#endif // SCENE_POLYHEDRON_SHORTEST_PATH_ITEM_H
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh/Shortest_path_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh/Shortest_path_plugin.cpp
deleted file mode 100644
index e7f94c6..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh/Shortest_path_plugin.cpp
+++ /dev/null
@@ -1,311 +0,0 @@
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-
-#include "Messages_interface.h"
-#include "Scene_polyhedron_item.h"
-#include "Scene_polylines_item.h"
-#include "Scene_polyhedron_selection_item.h"
-#include "Scene_polyhedron_shortest_path_item.h"
-#include "Polyhedron_type.h"
-#include "Scene.h"
-#include "ui_Shortest_path_widget.h"
-
-#include <QApplication>
-#include <QMainWindow>
-#include <QInputDialog>
-#include <QTime>
-#include <QAction>
-#include <QDebug>
-#include <QObject>
-#include <QDockWidget>
-//#include <QtConcurrentRun>
-#include <map>
-#include <algorithm>
-#include <vector>
-using namespace CGAL::Three;
-class Polyhedron_demo_shortest_path_plugin :
-    public QObject,
-    public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-    Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-    Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-private:
-
-  typedef boost::property_map<Polyhedron, boost::vertex_index_t>::type VertexIndexMap;
-  typedef boost::property_map<Polyhedron, CGAL::halfedge_index_t>::type HalfedgeIndexMap;
-  typedef boost::property_map<Polyhedron, CGAL::face_index_t>::type FaceIndexMap;
-  typedef boost::property_map<Polyhedron, CGAL::vertex_point_t>::type VertexPointMap;
-
-  typedef CGAL::Surface_mesh_shortest_path_traits<Kernel, Polyhedron> Surface_mesh_shortest_path_traits;
-  typedef CGAL::Surface_mesh_shortest_path<Surface_mesh_shortest_path_traits, VertexIndexMap, HalfedgeIndexMap, FaceIndexMap, VertexPointMap> Surface_mesh_shortest_path;
-
-  struct ShortestPathsPointsVisitor
-  {
-    typedef std::vector<Surface_mesh_shortest_path::Point_3> Container;
-    Container& m_container;
-
-    ShortestPathsPointsVisitor(Container& container)
-      : m_container(container)
-    {
-    }
-
-    void point(const Surface_mesh_shortest_path::Point_3& point)
-    {
-      std::cout << point << std::endl;
-      m_container.push_back(point);
-    }
-  };
-
-  typedef std::map<Scene_polyhedron_item*, Scene_polyhedron_shortest_path_item* > Shortest_paths_map;
-
-public:
-
-  QList<QAction*> actions() const
-  {
-      return QList<QAction*>() << actionMakeShortestPaths;
-  }
-
-  bool applicable(QAction*) const
-  {
-    return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
-  }
-
-  using Polyhedron_demo_plugin_helper::init;
-  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface* messages)
-  {
-    this->scene = scene_interface;
-    this->mw = mainWindow;
-    this->m_messages = messages;
-
-    dock_widget = new QDockWidget("Shortest path", mw);
-
-    dock_widget->setVisible(false);
-
-    ui_widget.setupUi(dock_widget);
-    add_dock_widget(dock_widget);
-
-    connect(ui_widget.Selection_type_combo_box, SIGNAL(currentIndexChanged(int)),  this, SLOT(on_Selection_type_combo_box_changed(int)));
-    connect(ui_widget.Primitives_type_combo_box, SIGNAL(currentIndexChanged(int)), this, SLOT(on_Primitives_type_combo_box_changed(int)));
-
-    actionMakeShortestPaths = new QAction("Make Shortest Path", this->mw);
-    actionMakeShortestPaths->setProperty("subMenuName", "Triangulated Surface Mesh Shortest Paths");
-
-    connect(actionMakeShortestPaths, SIGNAL(triggered()), this, SLOT(on_actionMakeShortestPaths_triggered()));
-
-    Scene* trueScene = dynamic_cast<Scene*>(scene_interface);
-    // This is for later
-    if(trueScene) {
-        connect(trueScene, SIGNAL(itemAboutToBeDestroyed(CGAL::Three::Scene_item*)), this, SLOT(item_about_to_be_destroyed(CGAL::Three::Scene_item*)));
-        connect(trueScene, SIGNAL(newItem(int)), this, SLOT(new_item(int)));
-    }
-  }
-
-  virtual void closure()
-  {
-    dock_widget->hide();
-  }
-private:
-
-  Scene_polyhedron_shortest_path_item::Selection_mode get_selection_mode() const;
-  Scene_polyhedron_shortest_path_item::Primitives_mode get_primitives_mode() const;
-
-  void check_and_set_ids(Polyhedron* polyhedron);
-
-public Q_SLOTS:
-  void on_actionMakeShortestPaths_triggered();
-  void on_Selection_type_combo_box_changed(int index);
-  void on_Primitives_type_combo_box_changed(int index);
-  void new_item(int index);
-  void item_about_to_be_destroyed(CGAL::Three::Scene_item* scene_item);
-
-private:
-  Shortest_paths_map m_shortestPathsMap;
-
-  Messages_interface* m_messages;
-  QAction* actionMakeShortestPaths;
-  QDockWidget* dock_widget;
-  Ui::Shortest_path ui_widget;
-};
-
-Scene_polyhedron_shortest_path_item::Selection_mode Polyhedron_demo_shortest_path_plugin::get_selection_mode() const
-{
-  return (Scene_polyhedron_shortest_path_item::Selection_mode) ui_widget.Selection_type_combo_box->currentIndex();
-}
-
-Scene_polyhedron_shortest_path_item::Primitives_mode Polyhedron_demo_shortest_path_plugin::get_primitives_mode() const
-{
-  return (Scene_polyhedron_shortest_path_item::Primitives_mode) ui_widget.Primitives_type_combo_box->currentIndex();
-}
-
-void Polyhedron_demo_shortest_path_plugin::item_about_to_be_destroyed(CGAL::Three::Scene_item* sceneItem)
-{
-    // if polyhedron item
-    Scene_polyhedron_item* polyhedronItem = qobject_cast<Scene_polyhedron_item*>(sceneItem);
-    if(polyhedronItem)
-    {
-      Shortest_paths_map::iterator found = m_shortestPathsMap.find(polyhedronItem);
-
-      if (found != m_shortestPathsMap.end())
-      {
-        Scene_polyhedron_shortest_path_item* shortestPathItem = found->second;
-        m_shortestPathsMap.erase(found);
-        scene->erase(scene->item_id(shortestPathItem));
-      }
-    }
-
-    // if polyhedron selection item
-    Scene_polyhedron_shortest_path_item* shortestPathItem = qobject_cast<Scene_polyhedron_shortest_path_item*>(sceneItem);
-    if(shortestPathItem)
-    {
-      Scene_polyhedron_item* polyhedronItem = shortestPathItem->polyhedron_item();
-      Shortest_paths_map::iterator found = m_shortestPathsMap.find(polyhedronItem);
-
-      if (found != m_shortestPathsMap.end())
-      {
-        m_shortestPathsMap.erase(found);
-      }
-    }
-  }
-
-void Polyhedron_demo_shortest_path_plugin::new_item(int itemIndex)
-{
-  Scene_polyhedron_shortest_path_item* item = qobject_cast<Scene_polyhedron_shortest_path_item*>(scene->item(itemIndex));
-
-  if (!item)
-  {
-    return;
-  }
-
-  if(item->polyhedron_item() == NULL)
-  {
-    Scene_polyhedron_item* polyhedronItem = get_selected_item<Scene_polyhedron_item>();
-
-    if(!polyhedronItem)
-    {
-      CGAL_assertion(item->polyhedron_item() == NULL); // which means it is coming from selection_io loader
-      this->m_messages->information(tr("Error: please select corresponding polyhedron item from Geometric Objects list."));
-      scene->erase(itemIndex);
-      return;
-    }
-
-    if(!item->deferred_load(polyhedronItem, this->scene, this->m_messages, this->mw))
-    {
-      this->m_messages->information("Error: loading selection item is not successful!");
-      scene->erase(itemIndex);
-      return;
-    }
-  }
-
-  check_and_set_ids(item->polyhedron_item()->polyhedron());
-
-  Scene_polyhedron_shortest_path_item::Selection_mode selectionMode = get_selection_mode(); // Scene_polyhedron_shortest_path_item::INSERT_POINTS_MODE;
-
-  std::cout << "Selection mode: " << selectionMode << std::endl;
-
-  item->set_selection_mode(selectionMode);
-
-  Scene_polyhedron_shortest_path_item::Primitives_mode primitivesMode = get_primitives_mode(); // Scene_polyhedron_shortest_path_item::FACE_MODE;
-
-  std::cout << "Primitives mode: " << primitivesMode << std::endl;
-
-  item->set_primitives_mode(primitivesMode);
-
-  item->setRenderingMode(Flat);
-
-  if(item->name() == "unamed")
-  {
-    item->setName(tr("%1 (shortest path computation item)").arg(item->polyhedron_item()->name()));
-  }
-
-  m_shortestPathsMap.insert(std::make_pair(item->polyhedron_item(), item));
-}
-
-void Polyhedron_demo_shortest_path_plugin::on_actionMakeShortestPaths_triggered()
-{
-  Scene_polyhedron_item* polyhedronItem = get_selected_item<Scene_polyhedron_item>();
-  if (polyhedronItem)
-  {
-    if (m_shortestPathsMap.find(polyhedronItem) == m_shortestPathsMap.end())
-    {
-      dock_widget->show();
-      dock_widget->raise();
-      // The other parts of initialization will be handled by the 'new_item' callback
-      scene->addItem(new Scene_polyhedron_shortest_path_item(polyhedronItem, this->scene, this->m_messages, this->mw));
-    }
-    else
-    {
-      this->m_messages->warning(tr("A shortest path item for this polyhedron already exists (only one allowed per for now)"));
-    }
-  }
-  else
-  {
-    this->m_messages->warning("No polyhedron selected.");
-  }
-}
-
-void Polyhedron_demo_shortest_path_plugin::on_Selection_type_combo_box_changed(int index)
-{
-  std::cout << "Selection mode changed: " << index << std::endl;
-
-  for (Shortest_paths_map::iterator it = m_shortestPathsMap.begin(); it != m_shortestPathsMap.end(); ++it)
-  {
-    it->second->set_selection_mode(get_selection_mode());
-  }
-}
-
-void Polyhedron_demo_shortest_path_plugin::on_Primitives_type_combo_box_changed(int index)
-{
-  std::cout << "Primitives mode changed: " << index << std::endl;
-
-  for (Shortest_paths_map::iterator it = m_shortestPathsMap.begin(); it != m_shortestPathsMap.end(); ++it)
-  {
-    it->second->set_primitives_mode(get_primitives_mode());
-  }
-}
-
-void Polyhedron_demo_shortest_path_plugin::check_and_set_ids(Polyhedron* polyhedron)
-{
-  Polyhedron::Vertex_iterator testVertex1 = polyhedron->vertices_begin();
-  Polyhedron::Vertex_iterator testVertex2 = ++polyhedron->vertices_begin();
-
-  if(testVertex1->id() == testVertex2->id())
-  {
-    std::size_t vertexId = 0;
-    for(Polyhedron::Vertex_iterator currentVertex = polyhedron->vertices_begin();
-        currentVertex != polyhedron->vertices_end(); ++currentVertex, ++vertexId)
-    {
-        currentVertex->id() = vertexId;
-    }
-  }
-
-  Polyhedron::Halfedge_iterator testHalfedge1 = polyhedron->halfedges_begin();
-  Polyhedron::Halfedge_iterator testHalfedge2 = ++polyhedron->halfedges_begin();
-
-  if (testHalfedge1->id() == testHalfedge2->id())
-  {
-    std::size_t halfedgeId = 0;
-    for(Polyhedron::Halfedge_iterator currentHalfedge = polyhedron->halfedges_begin();
-        currentHalfedge != polyhedron->halfedges_end(); ++currentHalfedge, ++halfedgeId)
-    {
-        currentHalfedge->id() = halfedgeId;
-    }
-  }
-
-  Polyhedron::Facet_iterator testFacet1 = polyhedron->facets_begin();
-  Polyhedron::Facet_iterator testFacet2 = ++polyhedron->facets_begin();
-
-  if (testFacet1->id() == testFacet2->id())
-  {
-    std::size_t facetId = 0;
-    for(Polyhedron::Facet_iterator currentFacet = polyhedron->facets_begin();
-        currentFacet != polyhedron->facets_end(); ++currentFacet, ++facetId)
-    {
-        currentFacet->id() = facetId;
-    }
-  }
-}
-
-
-
-#include "Shortest_path_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh/Shortest_path_widget.ui b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh/Shortest_path_widget.ui
deleted file mode 100644
index a01d7ed..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh/Shortest_path_widget.ui
+++ /dev/null
@@ -1,71 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>Shortest_path</class>
- <widget class="QDockWidget" name="Shortest_path">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>334</width>
-    <height>402</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Shortest_path</string>
-  </property>
-  <widget class="QWidget" name="dockWidgetContents">
-   <layout class="QHBoxLayout" name="horizontalLayout_4">
-    <item>
-     <widget class="QLabel" name="label_2">
-      <property name="text">
-       <string>Shortest_path &Type:</string>
-      </property>
-      <property name="buddy">
-       <cstring>Selection_type_combo_box</cstring>
-      </property>
-     </widget>
-    </item>
-    <item>
-     <widget class="QComboBox" name="Selection_type_combo_box">
-      <item>
-       <property name="text">
-        <string>Insertion</string>
-       </property>
-      </item>
-      <item>
-       <property name="text">
-        <string>Removal</string>
-       </property>
-      </item>
-      <item>
-       <property name="text">
-        <string>Compute Path</string>
-       </property>
-      </item>
-     </widget>
-    </item>
-    <item>
-     <widget class="QComboBox" name="Primitives_type_combo_box">
-      <item>
-       <property name="text">
-        <string>Vertex</string>
-       </property>
-      </item>
-      <item>
-       <property name="text">
-        <string>Edge</string>
-       </property>
-      </item>
-      <item>
-       <property name="text">
-        <string>Face</string>
-       </property>
-      </item>
-     </widget>
-    </item>
-   </layout>
-  </widget>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh_deformation/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh_deformation/CMakeLists.txt
deleted file mode 100644
index e84acc5..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh_deformation/CMakeLists.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-include( polyhedron_demo_macros )
-if ( EIGEN3_FOUND AND "${EIGEN3_VERSION}" VERSION_GREATER "3.1.90" )
-  polyhedron_demo_plugin(edit_polyhedron_plugin Edit_polyhedron_plugin Deform_mesh.ui)
-  target_link_libraries(edit_polyhedron_plugin scene_polyhedron_item scene_edit_polyhedron_item)
-else()
-  message(STATUS "NOTICE: The polyhedron edit plugin require Eigen 3.2 (or higher) and will not be available.")
-endif()
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh_deformation/Deform_mesh.ui b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh_deformation/Deform_mesh.ui
deleted file mode 100644
index cb959cd..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh_deformation/Deform_mesh.ui
+++ /dev/null
@@ -1,423 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>DeformMesh</class>
- <widget class="QDockWidget" name="DeformMesh">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>568</width>
-    <height>588</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Surface Mesh Deformation</string>
-  </property>
-  <widget class="QWidget" name="dockWidgetContents">
-   <layout class="QVBoxLayout" name="verticalLayout">
-    <item>
-     <widget class="QGroupBox" name="SelectionGroupBox">
-      <property name="title">
-       <string>Selection</string>
-      </property>
-      <layout class="QGridLayout" name="gridLayout">
-       <item row="2" column="1" rowspan="2" colspan="2">
-        <layout class="QVBoxLayout" name="RingLayout">
-         <item>
-          <layout class="QHBoxLayout" name="horizontalLayout_4">
-           <item>
-            <layout class="QVBoxLayout" name="verticalLayout_5">
-             <item>
-              <widget class="QLabel" name="label">
-               <property name="text">
-                <string>Brush Size ROI:</string>
-               </property>
-              </widget>
-             </item>
-             <item>
-              <widget class="QLabel" name="label_2">
-               <property name="text">
-                <string>Control Vertices Brush Size:</string>
-               </property>
-              </widget>
-             </item>
-            </layout>
-           </item>
-           <item>
-            <layout class="QVBoxLayout" name="verticalLayout_2">
-             <item>
-              <widget class="QSpinBox" name="BrushSpinBoxRoi"/>
-             </item>
-             <item>
-              <widget class="QSpinBox" name="BrushSpinBoxCtrlVert"/>
-             </item>
-            </layout>
-           </item>
-          </layout>
-         </item>
-        </layout>
-       </item>
-       <item row="4" column="0" colspan="4">
-        <layout class="QHBoxLayout" name="horizontalLayout_3">
-         <item>
-          <widget class="QPushButton" name="SelectAllVerticesPushButton">
-           <property name="text">
-            <string>Set All Vertices as ROI</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QPushButton" name="ClearROIPushButton">
-           <property name="text">
-            <string>Clear ROI</string>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </item>
-       <item row="2" column="0" rowspan="2">
-        <widget class="QGroupBox" name="ROICtrlVertGroupBox">
-         <layout class="QVBoxLayout" name="CtrlVertRoiLayout">
-          <item>
-           <widget class="QRadioButton" name="ROIRadioButton">
-            <property name="toolTip">
-             <string>Use Shift + Left Click to paint ROI vertices</string>
-            </property>
-            <property name="text">
-             <string>ROI</string>
-            </property>
-            <property name="checked">
-             <bool>true</bool>
-            </property>
-           </widget>
-          </item>
-          <item>
-           <widget class="QRadioButton" name="CtrlVertRadioButton">
-            <property name="toolTip">
-             <string>Use Shift + Left Click to paint control vertices</string>
-            </property>
-            <property name="text">
-             <string>Control vertices</string>
-            </property>
-           </widget>
-          </item>
-         </layout>
-        </widget>
-       </item>
-       <item row="2" column="3" rowspan="2">
-        <widget class="QGroupBox" name="InsertEraseGroupBox">
-         <layout class="QVBoxLayout" name="InsertRemoveLayout">
-          <item>
-           <widget class="QRadioButton" name="InsertRadioButton">
-            <property name="text">
-             <string>Insertion</string>
-            </property>
-            <property name="checked">
-             <bool>true</bool>
-            </property>
-           </widget>
-          </item>
-          <item>
-           <widget class="QRadioButton" name="EraseRadioButton">
-            <property name="text">
-             <string>Removal</string>
-            </property>
-           </widget>
-          </item>
-         </layout>
-        </widget>
-       </item>
-       <item row="5" column="0" colspan="4">
-        <layout class="QGridLayout" name="gridLayout_2">
-         <property name="sizeConstraint">
-          <enum>QLayout::SetDefaultConstraint</enum>
-         </property>
-         <item row="0" column="1">
-          <widget class="QPushButton" name="ReadROIPushButton">
-           <property name="text">
-            <string>Load ROI / Control Vertices</string>
-           </property>
-          </widget>
-         </item>
-         <item row="1" column="0">
-          <widget class="QCheckBox" name="ShowAsSphereCheckBox">
-           <property name="text">
-            <string>Show As Sphere</string>
-           </property>
-           <property name="checked">
-            <bool>false</bool>
-           </property>
-          </widget>
-         </item>
-         <item row="0" column="0">
-          <widget class="QCheckBox" name="ShowROICheckBox">
-           <property name="text">
-            <string>Show ROI</string>
-           </property>
-           <property name="checked">
-            <bool>true</bool>
-           </property>
-          </widget>
-         </item>
-         <item row="1" column="1">
-          <widget class="QPushButton" name="SaveROIPushButton">
-           <property name="text">
-            <string>Save ROI / Control Vertices</string>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </item>
-      </layout>
-     </widget>
-    </item>
-    <item>
-     <widget class="QGroupBox" name="groupBox">
-      <property name="title">
-       <string/>
-      </property>
-      <layout class="QVBoxLayout" name="verticalLayout_8">
-       <item>
-        <layout class="QVBoxLayout" name="verticalLayout_4">
-         <item>
-          <layout class="QHBoxLayout" name="horizontalLayout_8">
-           <item>
-            <widget class="QLabel" name="label_3">
-             <property name="text">
-              <string>Isolated Component Size:</string>
-             </property>
-            </widget>
-           </item>
-           <item>
-            <widget class="QSpinBox" name="Threshold_size_spin_box">
-             <property name="maximum">
-              <number>999999999</number>
-             </property>
-             <property name="value">
-              <number>8</number>
-             </property>
-            </widget>
-           </item>
-           <item>
-            <widget class="QPushButton" name="Get_minimum_button">
-             <property name="text">
-              <string>Get Minimum</string>
-             </property>
-            </widget>
-           </item>
-          </layout>
-         </item>
-         <item>
-          <widget class="QPushButton" name="Select_isolated_components_button">
-           <property name="text">
-            <string>Select Isolated Components Below Threshold</string>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </item>
-      </layout>
-     </widget>
-    </item>
-    <item>
-     <widget class="QGroupBox" name="remeshing_groupBox">
-      <property name="contextMenuPolicy">
-       <enum>Qt::DefaultContextMenu</enum>
-      </property>
-      <property name="title">
-       <string>Remeshing</string>
-      </property>
-      <property name="flat">
-       <bool>false</bool>
-      </property>
-      <layout class="QHBoxLayout" name="horizontalLayout_10">
-       <item>
-        <layout class="QHBoxLayout" name="horizontalLayout_9" stretch="0,0,0">
-         <item>
-          <widget class="QCheckBox" name="RemeshingCheckBox">
-           <property name="toolTip">
-            <string>Warning : after remeshing all ROI and control vertices will be unselected. "Discard changes" will be unavailable.</string>
-           </property>
-           <property name="layoutDirection">
-            <enum>Qt::LeftToRight</enum>
-           </property>
-           <property name="text">
-            <string>Remesh after deformation</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <layout class="QVBoxLayout" name="verticalLayout_6">
-           <item>
-            <widget class="QCheckBox" name="remeshingEdgeLengthInput_checkBox">
-             <property name="toolTip">
-              <string>If unchecked, automatic value is used (the average edge length at ROI boundary)</string>
-             </property>
-             <property name="layoutDirection">
-              <enum>Qt::RightToLeft</enum>
-             </property>
-             <property name="text">
-              <string>Target edge length</string>
-             </property>
-            </widget>
-           </item>
-           <item>
-            <widget class="QLabel" name="label_4">
-             <property name="layoutDirection">
-              <enum>Qt::RightToLeft</enum>
-             </property>
-             <property name="text">
-              <string>Nb. iterations</string>
-             </property>
-             <property name="alignment">
-              <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-             </property>
-            </widget>
-           </item>
-          </layout>
-         </item>
-         <item>
-          <layout class="QVBoxLayout" name="verticalLayout_7">
-           <item>
-            <widget class="QDoubleSpinBox" name="remeshing_edge_length_spinbox"/>
-           </item>
-           <item>
-            <widget class="QSpinBox" name="remeshing_iterations_spinbox"/>
-           </item>
-          </layout>
-         </item>
-        </layout>
-       </item>
-      </layout>
-     </widget>
-    </item>
-    <item>
-     <widget class="QGroupBox" name="CtrlVertGroupNavigationGroupBox">
-      <property name="title">
-       <string>Group of Control Vertices Navigation</string>
-      </property>
-      <layout class="QVBoxLayout" name="verticalLayout_3">
-       <item>
-        <layout class="QHBoxLayout" name="horizontalLayout">
-         <item>
-          <widget class="QPushButton" name="PrevCtrlVertPushButton">
-           <property name="sizePolicy">
-            <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
-             <horstretch>0</horstretch>
-             <verstretch>0</verstretch>
-            </sizepolicy>
-           </property>
-           <property name="text">
-            <string><<</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QPushButton" name="NextCtrlVertPushButton">
-           <property name="text">
-            <string>>></string>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </item>
-       <item>
-        <layout class="QHBoxLayout" name="horizontalLayout_2">
-         <item>
-          <widget class="QPushButton" name="AddCtrlVertPushButton">
-           <property name="text">
-            <string>Create new</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QPushButton" name="DeleteCtrlVertPushButton">
-           <property name="text">
-            <string>Delete </string>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </item>
-       <item>
-        <layout class="QHBoxLayout" name="horizontalLayout_11">
-         <item>
-          <widget class="QCheckBox" name="ActivatePivotingCheckBox">
-           <property name="text">
-            <string>Activate Pivoting </string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QCheckBox" name="ActivateFixedPlaneCheckBox">
-           <property name="text">
-            <string>Activate Fixed Plane Deformation</string>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </item>
-      </layout>
-     </widget>
-    </item>
-    <item>
-     <widget class="Line" name="line">
-      <property name="orientation">
-       <enum>Qt::Horizontal</enum>
-      </property>
-     </widget>
-    </item>
-    <item>
-     <layout class="QHBoxLayout" name="ApplyAndCloseLayout">
-      <item>
-       <layout class="QVBoxLayout" name="verticalLayout_10">
-        <item>
-         <layout class="QGridLayout" name="gridLayout_3">
-          <item row="2" column="0">
-           <widget class="QPushButton" name="DiscardChangesPushButton">
-            <property name="toolTip">
-             <string>Reset mesh to last version saved by "Overwrite Initial Geometry". Not available when Remeshing is ON.</string>
-            </property>
-            <property name="text">
-             <string>Discard changes</string>
-            </property>
-           </widget>
-          </item>
-          <item row="1" column="1">
-           <widget class="QPushButton" name="OverwritePushButton">
-            <property name="sizePolicy">
-             <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
-              <horstretch>0</horstretch>
-              <verstretch>0</verstretch>
-             </sizepolicy>
-            </property>
-            <property name="text">
-             <string>Overwrite Initial Geometry</string>
-            </property>
-           </widget>
-          </item>
-          <item row="2" column="1">
-           <widget class="QPushButton" name="ApplyAndClosePushButton">
-            <property name="sizePolicy">
-             <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
-              <horstretch>0</horstretch>
-              <verstretch>0</verstretch>
-             </sizepolicy>
-            </property>
-            <property name="text">
-             <string>Apply and Close</string>
-            </property>
-           </widget>
-          </item>
-         </layout>
-        </item>
-       </layout>
-      </item>
-     </layout>
-    </item>
-   </layout>
-  </widget>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh_deformation/Edit_polyhedron_plugin.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh_deformation/Edit_polyhedron_plugin.cpp
deleted file mode 100644
index 3645ab4..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh_deformation/Edit_polyhedron_plugin.cpp
+++ /dev/null
@@ -1,418 +0,0 @@
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include "Scene_polyhedron_item.h"
-#include "Scene_edit_polyhedron_item.h"
-
-#include <QAction>
-#include <QMainWindow>
-#include <QFileDialog>
-
-#include <QGLViewer/qglviewer.h>
-
-#include "ui_Deform_mesh.h"
-using namespace CGAL::Three;
-class Polyhedron_demo_edit_polyhedron_plugin : 
-  public QObject,
-  public Polyhedron_demo_plugin_helper
-{
-  Q_OBJECT
-  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-public:
-  Polyhedron_demo_edit_polyhedron_plugin() 
-    : Polyhedron_demo_plugin_helper(), dock_widget(NULL)
-  { }
-  ~Polyhedron_demo_edit_polyhedron_plugin()
-  { }
-
-  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface);
-  virtual void closure()
-  {
-    dock_widget->hide();
-  }
-  QList<QAction*> actions() const;
-  bool applicable(QAction*) const;
-
-public Q_SLOTS:
-  void on_actionDeformation_triggered();
-  /////// Dock window signal handlers //////
-  // what they do is simply transmiting required 'action' to selected scene_edit_polyhedron_item object
-  void on_AddCtrlVertPushButton_clicked();
-  void on_PrevCtrlVertPushButton_clicked();
-  void on_NextCtrlVertPushButton_clicked();
-  void on_SelectAllVerticesPushButton_clicked();
-  void on_DeleteCtrlVertPushButton_clicked();  
-  void on_ApplyAndClosePushButton_clicked();
-  void on_DiscardChangesPushButton_clicked();
-  void on_ClearROIPushButton_clicked();
-  void on_ShowROICheckBox_stateChanged(int state);
-  void on_ShowAsSphereCheckBox_stateChanged(int state);  
-  void on_ActivatePivotingCheckBox_stateChanged(int state);
-  void on_ActivateFixedPlaneCheckBox_stateChanged(int state);
-  void on_OverwritePushButton_clicked();
-  void on_SaveROIPushButton_clicked();
-  void on_ReadROIPushButton_clicked();
-  void dock_widget_visibility_changed(bool visible);
-  void on_Select_isolated_components_button_clicked();
-  void on_Get_minimum_button_clicked();
-
-  void on_BrushSpinBoxCtrlVert_changed(int);
-  void on_BrushSpinBoxRoi_changed(int);
-  void on_ROIRadioButton_toggled(bool);
-  void new_item_created(int item_id);
-
-private:
-  typedef CGAL::Three::Scene_interface::Item_id Item_id;
-
-  Scene_edit_polyhedron_item* convert_to_edit_polyhedron(Item_id, Scene_polyhedron_item*);
-  Scene_polyhedron_item* convert_to_plain_polyhedron(Item_id, Scene_edit_polyhedron_item*);
-
-  Ui::DeformMesh ui_widget;
-  QDockWidget* dock_widget;
-
-  QAction* actionDeformation;
-}; // end Polyhedron_demo_edit_polyhedron_plugin
-
-QList<QAction*> Polyhedron_demo_edit_polyhedron_plugin::actions() const {
-  return QList<QAction*>() << actionDeformation;
-}
-bool Polyhedron_demo_edit_polyhedron_plugin::applicable(QAction*) const { 
-  Q_FOREACH(CGAL::Three::Scene_interface::Item_id i, scene->selectionIndices())
-  {
-    if(qobject_cast<Scene_polyhedron_item*>(scene->item(i)) 
-        || qobject_cast<Scene_edit_polyhedron_item*>(scene->item(i)))
-      return true;
-  }
-  return false;
-}
-
-void Polyhedron_demo_edit_polyhedron_plugin::init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface)
-{
-  mw = mainWindow;
-  scene = scene_interface;
-  actionDeformation = new QAction("Surface Mesh Deformation", mw);
-  actionDeformation->setProperty("subMenuName", "Triangulated Surface Mesh Deformation");
-
-  actionDeformation->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_E));
-  connect(actionDeformation, SIGNAL(triggered()), this, SLOT(on_actionDeformation_triggered()));
-
-  // Connect Scene::newItem so that, if dock_widget is visible, convert
-  // automatically polyhedron items to "edit polyhedron" items.
-  QObject* scene = dynamic_cast<QObject*>(scene_interface);
-  if(scene) {
-    connect(scene, SIGNAL(newItem(int)), this, SLOT(new_item_created(int)));
-  } else {
-    std::cerr << "ERROR " << __FILE__ << ":" << __LINE__ << " :"
-              << " cannot convert scene_interface to scene!\n"; 
-  }
-  ////////////////// Construct widget /////////////////////////////
-  // First time, construct docking window
-  dock_widget = new QDockWidget("Mesh Deformation", mw);
-  dock_widget->setVisible(false); // do not show at the beginning
-
-  ui_widget.setupUi(dock_widget); 
-  mw->addDockWidget(Qt::LeftDockWidgetArea, dock_widget);
-
-  connect(ui_widget.AddCtrlVertPushButton, SIGNAL(clicked()), this, SLOT(on_AddCtrlVertPushButton_clicked()));
-  connect(ui_widget.PrevCtrlVertPushButton, SIGNAL(clicked()), this, SLOT(on_PrevCtrlVertPushButton_clicked()));
-  connect(ui_widget.NextCtrlVertPushButton, SIGNAL(clicked()), this, SLOT(on_NextCtrlVertPushButton_clicked()));
-  connect(ui_widget.SelectAllVerticesPushButton, SIGNAL(clicked()), this, SLOT(on_SelectAllVerticesPushButton_clicked()));
-  connect(ui_widget.DeleteCtrlVertPushButton, SIGNAL(clicked()), this, SLOT(on_DeleteCtrlVertPushButton_clicked()));
-  connect(ui_widget.ApplyAndClosePushButton, SIGNAL(clicked()), this, SLOT(on_ApplyAndClosePushButton_clicked()));
-  connect(ui_widget.DiscardChangesPushButton, SIGNAL(clicked()), this, SLOT(on_DiscardChangesPushButton_clicked()));
-  connect(ui_widget.ClearROIPushButton, SIGNAL(clicked()), this, SLOT(on_ClearROIPushButton_clicked()));
-  connect(ui_widget.ShowROICheckBox, SIGNAL(stateChanged(int)), this, SLOT(on_ShowROICheckBox_stateChanged(int)));
-  connect(ui_widget.ShowAsSphereCheckBox, SIGNAL(stateChanged(int)), this, SLOT(on_ShowAsSphereCheckBox_stateChanged(int)));  
-  connect(ui_widget.ActivateFixedPlaneCheckBox, SIGNAL(stateChanged(int)), this, SLOT(on_ActivateFixedPlaneCheckBox_stateChanged(int)));
-  connect(ui_widget.ActivatePivotingCheckBox, SIGNAL(stateChanged(int)), this, SLOT(on_ActivatePivotingCheckBox_stateChanged(int)));
-  connect(ui_widget.OverwritePushButton, SIGNAL(clicked()), this, SLOT(on_OverwritePushButton_clicked()));
-  connect(ui_widget.Select_isolated_components_button,  SIGNAL(clicked()), this, SLOT(on_Select_isolated_components_button_clicked()));
-  connect(ui_widget.Get_minimum_button,  SIGNAL(clicked()), this, SLOT(on_Get_minimum_button_clicked()));
-
-  connect(ui_widget.SaveROIPushButton, SIGNAL(clicked()), this, SLOT(on_SaveROIPushButton_clicked()));
-  connect(ui_widget.ReadROIPushButton, SIGNAL(clicked()), this, SLOT(on_ReadROIPushButton_clicked()));
-  connect(dock_widget, SIGNAL(visibilityChanged(bool)), this, SLOT(dock_widget_visibility_changed(bool)) );
-
-  connect(ui_widget.BrushSpinBoxRoi, SIGNAL(valueChanged(int)), this, SLOT(on_BrushSpinBoxRoi_changed(int)));
-  connect(ui_widget.BrushSpinBoxCtrlVert, SIGNAL(valueChanged(int)), this, SLOT(on_BrushSpinBoxCtrlVert_changed(int)));
-  connect(ui_widget.ROIRadioButton, SIGNAL(toggled(bool)), this, SLOT(on_ROIRadioButton_toggled(bool)));
-  ///////////////////////////////////////////////////////////////////
-}
-
-void Polyhedron_demo_edit_polyhedron_plugin::on_actionDeformation_triggered()
-{  
-  // dock widget should be constructed in init()
-  if(dock_widget->isVisible()) { dock_widget->hide(); }
-  else                         { dock_widget->show(); }
-}
-
-/////// Dock window signal handlers //////
-// what they do is simply transmitting required 'action' to selected scene_edit_polyhedron_item object
-void Polyhedron_demo_edit_polyhedron_plugin::on_AddCtrlVertPushButton_clicked()
-{
-  int item_id = scene->mainSelectionIndex();
-  Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(item_id));
-  if(!edit_item) return;                             // the selected item is not of the right type
-
-  edit_item->create_ctrl_vertices_group();
-}
-void Polyhedron_demo_edit_polyhedron_plugin::on_PrevCtrlVertPushButton_clicked()
-{
-  int item_id = scene->mainSelectionIndex();
-  Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(item_id));
-  if(!edit_item) return;                             // the selected item is not of the right type
-
-  edit_item->prev_ctrl_vertices_group();
-  edit_item->invalidateOpenGLBuffers();
-  scene->itemChanged(edit_item); // for repaint
-}
-void Polyhedron_demo_edit_polyhedron_plugin::on_NextCtrlVertPushButton_clicked()
-{
-  int item_id = scene->mainSelectionIndex();
-  Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(item_id));
-  if(!edit_item) return;                             // the selected item is not of the right type
-
-  edit_item->next_ctrl_vertices_group();
-  scene->itemChanged(edit_item); // for repaint
-}
-void Polyhedron_demo_edit_polyhedron_plugin::on_SelectAllVerticesPushButton_clicked()
-{
-  int item_id = scene->mainSelectionIndex();
-  Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(item_id));
-  if(!edit_item) return;                             // the selected item is not of the right type
-
-  edit_item->set_all_vertices_as_roi();
-  edit_item->invalidateOpenGLBuffers();
-  scene->itemChanged(edit_item); // for repaint
-}
-void Polyhedron_demo_edit_polyhedron_plugin::on_DeleteCtrlVertPushButton_clicked()
-{
-  int item_id = scene->mainSelectionIndex();
-  Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(item_id));
-  if(!edit_item) return;                             // the selected item is not of the right type
-
-  edit_item->delete_ctrl_vertices_group();
-  edit_item->invalidateOpenGLBuffers();
-  scene->itemChanged(edit_item); // for repaint
-}
-void Polyhedron_demo_edit_polyhedron_plugin::on_ClearROIPushButton_clicked()
-{
-  int item_id = scene->mainSelectionIndex();
-  Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(item_id));
-  if(!edit_item) return;                             // the selected item is not of the right type
-
-  edit_item->clear_roi();
-  edit_item->invalidateOpenGLBuffers();
-  scene->itemChanged(edit_item); // for repaint
-}
-void Polyhedron_demo_edit_polyhedron_plugin::on_ApplyAndClosePushButton_clicked()
-{
-  dock_widget->setVisible(false);
-}
-void Polyhedron_demo_edit_polyhedron_plugin::on_DiscardChangesPushButton_clicked()
-{
-  int item_id = scene->mainSelectionIndex();
-  Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(item_id));
-  if (!edit_item) return;                             // the selected item is not of the right type
-
-  edit_item->reset_deform_object();
-  edit_item->invalidateOpenGLBuffers();
-  scene->itemChanged(edit_item); //for redraw
-}
-void Polyhedron_demo_edit_polyhedron_plugin::on_ShowROICheckBox_stateChanged(int /*state*/)
-{
-  for(CGAL::Three::Scene_interface::Item_id i = 0, end = scene->numberOfEntries(); i < end; ++i)
-  {
-    Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(i));
-    if(!edit_item) { continue; }
-    
-    scene->itemChanged(edit_item);  // just for redraw   
-  }  
-}
-void Polyhedron_demo_edit_polyhedron_plugin::on_ShowAsSphereCheckBox_stateChanged(int /*state*/)
-{
-  for(CGAL::Three::Scene_interface::Item_id i = 0, end = scene->numberOfEntries(); i < end; ++i)
-  {
-    Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(i));
-    if(!edit_item) { continue; }
-    
-    scene->itemChanged(edit_item);  // just for redraw   
-  }  
-}
-void Polyhedron_demo_edit_polyhedron_plugin::on_ActivatePivotingCheckBox_stateChanged(int state)
-{
-  for(CGAL::Three::Scene_interface::Item_id i = 0, end = scene->numberOfEntries(); i < end; ++i)
-  {
-    Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(i));
-    if(!edit_item) { continue; }
-    
-    if(state == Qt::Checked) {
-      edit_item->pivoting_begin();
-    }
-    else {
-      edit_item->pivoting_end();
-    }
-    scene->itemChanged(edit_item);     
-  }
-}
-void Polyhedron_demo_edit_polyhedron_plugin::on_ActivateFixedPlaneCheckBox_stateChanged(int)
-{
-    for(CGAL::Three::Scene_interface::Item_id i = 0, end = scene->numberOfEntries(); i < end; ++i)
-    {
-        Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(i));
-        if(!edit_item) { continue; }
-        edit_item->update_frame_plane();
-        edit_item->invalidateOpenGLBuffers();
-        scene->itemChanged(edit_item);
-    }
-}
-void Polyhedron_demo_edit_polyhedron_plugin::on_OverwritePushButton_clicked()
-{
-  int item_id = scene->mainSelectionIndex();
-  Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(item_id));
-  if(!edit_item) return;                             // the selected item is not of the right type
-
-  edit_item->overwrite_deform_object();
-}
-void Polyhedron_demo_edit_polyhedron_plugin::on_Select_isolated_components_button_clicked() {
-  int item_id = scene->mainSelectionIndex();
-  Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(item_id));
-  if(!edit_item) return;                             // the selected item is not of the right type
-
-  boost::optional<std::size_t> minimum = 
-    edit_item->select_isolated_components(ui_widget.Threshold_size_spin_box->value());
-  if(minimum) {
-    ui_widget.Threshold_size_spin_box->setValue((int) *minimum);
-  }
-}
-
-void Polyhedron_demo_edit_polyhedron_plugin::on_Get_minimum_button_clicked() {
-  int item_id = scene->mainSelectionIndex();
-  Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(item_id));
-  if(!edit_item) return;                             // the selected item is not of the right type
-
-  boost::optional<std::size_t> minimum = edit_item->get_minimum_isolated_component();
-  if(minimum) {
-    ui_widget.Threshold_size_spin_box->setValue((int) *minimum);
-  }
-}
-
-void Polyhedron_demo_edit_polyhedron_plugin::on_SaveROIPushButton_clicked()
-{
-  int item_id = scene->mainSelectionIndex();
-  Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(item_id));
-  if(!edit_item) return;  
-
-  QString fileName = QFileDialog::getSaveFileName(mw, "Save", 
-      "roi.txt", "Text (*.txt)");
-  if(fileName.isNull()) { return; }
-
-  edit_item->save_roi(fileName.toLocal8Bit().data());  
-}
-void Polyhedron_demo_edit_polyhedron_plugin::on_ReadROIPushButton_clicked()
-{
-  int item_id = scene->mainSelectionIndex();
-  Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(item_id));
-  if(!edit_item) return;  
-
-  QString fileName = QFileDialog::getOpenFileName(mw, "Read", 
-    "roi.txt", "Text (*.txt)");
-  if(fileName.isNull()) { return; }
-
-  edit_item->read_roi(fileName.toLocal8Bit().data());
-  edit_item->invalidateOpenGLBuffers();
-  scene->itemChanged(edit_item); 
-}
-void Polyhedron_demo_edit_polyhedron_plugin::dock_widget_visibility_changed(bool visible)
-{
-  for(CGAL::Three::Scene_interface::Item_id i = 0, end = scene->numberOfEntries();
-      i < end; ++i)
-  {
-    Scene_polyhedron_item* poly_item = qobject_cast<Scene_polyhedron_item*>(scene->item(i));
-    if (poly_item) 
-    { poly_item->update_halfedge_indices(); }
-    Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(i));
-
-    if(visible && poly_item) {
-      convert_to_edit_polyhedron(i, poly_item);
-    } else if(!visible && edit_item) {
-      convert_to_plain_polyhedron(i, edit_item);
-    }
-  }
-}
-
-
-void Polyhedron_demo_edit_polyhedron_plugin::on_ROIRadioButton_toggled(bool value) {
-  int k_ring = value ? ui_widget.BrushSpinBoxRoi->value() : 
-                       ui_widget.BrushSpinBoxCtrlVert->value();
-  for(CGAL::Three::Scene_interface::Item_id i = 0, end = scene->numberOfEntries(); i < end; ++i)
-  {
-    Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(i));
-    if(!edit_item) { continue; }
-
-    edit_item->set_k_ring(k_ring);
-  }
-}
-
-void Polyhedron_demo_edit_polyhedron_plugin::on_BrushSpinBoxCtrlVert_changed(int value) {
-  if(ui_widget.ROIRadioButton->isChecked()) { return; }
-  for(CGAL::Three::Scene_interface::Item_id i = 0, end = scene->numberOfEntries(); i < end; ++i)
-  {
-    Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(i));
-    if(!edit_item) { continue; }
-
-    edit_item->set_k_ring(value);
-  }
-}
-
-void Polyhedron_demo_edit_polyhedron_plugin::on_BrushSpinBoxRoi_changed(int value) {
-  if(!ui_widget.ROIRadioButton->isChecked()) { return; }
-  for(CGAL::Three::Scene_interface::Item_id i = 0, end = scene->numberOfEntries(); i < end; ++i)
-  {
-    Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(i));
-    if(!edit_item) { continue; }
-
-    edit_item->set_k_ring(value);
-  }
-}
-
-void Polyhedron_demo_edit_polyhedron_plugin::new_item_created(int item_id)
-{
-  if(dock_widget->isVisible()) {
-    Scene_polyhedron_item* poly_item = 
-      qobject_cast<Scene_polyhedron_item*>(scene->item(item_id));
-    if(poly_item) {
-      convert_to_edit_polyhedron(item_id, poly_item);
-    }
-  }
-}
-
-Scene_edit_polyhedron_item* 
-Polyhedron_demo_edit_polyhedron_plugin::convert_to_edit_polyhedron(Item_id i,
-                           Scene_polyhedron_item* poly_item)
-{
-  QString poly_item_name = poly_item->name();
-  Scene_edit_polyhedron_item* edit_poly = new Scene_edit_polyhedron_item(poly_item, &ui_widget, mw);
-  edit_poly->setColor(poly_item->color());
-  edit_poly->setName(QString("%1 (edit)").arg(poly_item->name()));
-  edit_poly->setRenderingMode(Gouraud);
-  poly_item->setName(poly_item_name); // Because it is changed when the
-                                      // name of edit_poly is changed.
-  int k_ring = ui_widget.ROIRadioButton->isChecked() ? ui_widget.BrushSpinBoxRoi->value() : 
-                                                       ui_widget.BrushSpinBoxCtrlVert->value();
-  edit_poly->set_k_ring(k_ring);
-  scene->replaceItem(i, edit_poly);
-  return edit_poly;
-}
-
-Scene_polyhedron_item* 
-Polyhedron_demo_edit_polyhedron_plugin::convert_to_plain_polyhedron(Item_id i,
-                            Scene_edit_polyhedron_item* edit_item) 
-{
-  Scene_polyhedron_item* poly_item = edit_item->to_polyhedron_item();
-  scene->replaceItem(i, poly_item);
-  delete edit_item;
-  return poly_item;
-}
-
-#include "Edit_polyhedron_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp
deleted file mode 100644
index 7f477b6..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp
+++ /dev/null
@@ -1,973 +0,0 @@
-//#define CGAL_PMP_REMESHING_VERBOSE
-
-#include "opengl_tools.h"
-#include "create_sphere.h"
-#include "Scene_edit_polyhedron_item.h"
-#include <boost/foreach.hpp>
-#include <algorithm>
-#include <QTime>
-
-#include <CGAL/Polygon_mesh_processing/border.h>
-
-Scene_edit_polyhedron_item::Scene_edit_polyhedron_item
-(Scene_polyhedron_item* poly_item,
- Ui::DeformMesh* ui_widget,
- QMainWindow* mw)
-  : Scene_item(NumberOfBuffers,NumberOfVaos),
-    ui_widget(ui_widget),
-    poly_item(poly_item),
-    is_rot_free(true),
-    own_poly_item(true),
-    k_ring_selector(poly_item, mw, Scene_polyhedron_item_k_ring_selection::Active_handle::VERTEX, true)
-{
-  nb_ROI = 0;
-  nb_sphere = 0;
-  nb_control = 0;
-  nb_axis = 0;
-  nb_bbox = 0;
-  mw->installEventFilter(this);
-  // bind vertex picking
-  connect(&k_ring_selector, SIGNAL(selected(const std::set<Polyhedron::Vertex_handle>&)), this,
-          SLOT(selected(const std::set<Polyhedron::Vertex_handle>&)));
-
-  poly_item->set_color_vector_read_only(true); // to prevent recomputation of color vector in invalidateOpenGLBuffers()
-  poly_item->update_vertex_indices();
-
-  deform_mesh = new Deform_mesh(*(poly_item->polyhedron()),
-                                Deform_mesh::Vertex_index_map(),
-                                Deform_mesh::Hedge_index_map(),
-                                Array_based_vertex_point_map(&positions));
-
-  length_of_axis = bbox().diagonal_length() / 15.0;
-
-  // interleave events of viewer (there is only one viewer) 
-  QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
-  viewer->installEventFilter(this);
-    
-  // create an empty group of control vertices for starting
-  create_ctrl_vertices_group();
-   
-  // start QObject's timer for continuous effects 
-  // (deforming mesh while mouse not moving)
-  startTimer(0);
-
-  // Required for drawing functionality
-  reset_drawing_data();
-
-    //Generates an integer which will be used as ID for each buffer
-
-    const char vertex_shader_source_bbox[] =
-    {
-        "#version 120 \n"
-        "attribute highp vec3 vertex; \n"
-        "attribute highp vec3 colors; \n"
-
-        "uniform highp mat4 mvp_matrix; \n"
-        "uniform highp mat4 rotations; \n"
-        "uniform highp vec3 translation; \n"
-        "uniform highp vec3 translation_2; \n"
-        "varying highp vec3 fColors; \n"
-        " \n"
-
-        "void main(void) \n"
-        "{ \n"
-        "   fColors = colors; \n"
-        "   gl_Position = mvp_matrix * (rotations *(vec4(translation_2,0.0)+vec4(vertex,1.0) )+ vec4(translation,0.0)) ; \n"
-        "} \n"
-    };
-    const char fragment_shader_source[]=
-    {
-        "#version 120 \n"
-        "varying vec3 fColors; \n"
-        " \n"
-        "void main(void) \n"
-        "{ \n"
-        " gl_FragColor = vec4(fColors, 1.0); \n"
-        "} \n"
-    };
-    bbox_program.addShaderFromSourceCode(QOpenGLShader::Vertex,vertex_shader_source_bbox);
-    bbox_program.addShaderFromSourceCode(QOpenGLShader::Fragment,fragment_shader_source);
-    bbox_program.link();
-
-    ui_widget->remeshing_iterations_spinbox->setValue(1);
-
-    ui_widget->remeshing_edge_length_spinbox->setValue(length_of_axis);
-    ui_widget->remeshing_edge_length_spinbox->setDisabled(true);
-    ui_widget->remeshingEdgeLengthInput_checkBox->setChecked(false);
-    connect(ui_widget->remeshingEdgeLengthInput_checkBox, SIGNAL(toggled(bool)),
-            ui_widget->remeshing_edge_length_spinbox, SLOT(setEnabled(bool)));
-
-    //the spheres :
-    create_Sphere(length_of_axis/15.0);
-    invalidateOpenGLBuffers();
-}
-
-Scene_edit_polyhedron_item::~Scene_edit_polyhedron_item()
-{
-  while(is_there_any_ctrl_vertices_group())
-  {
-    delete_ctrl_vertices_group(false);
-  }
-
-  delete deform_mesh;
-  if (own_poly_item) delete poly_item;
-}
-/////////////////////////////
-/// For the Shader gestion///
-void Scene_edit_polyhedron_item::initialize_buffers(CGAL::Three::Viewer_interface *viewer =0) const
-{
-    //vao for the facets
-    {
-        program = getShaderProgram(PROGRAM_WITH_LIGHT, viewer);
-        program->bind();
-
-        vaos[Facets]->bind();
-        buffers[Facet_vertices].bind();
-        buffers[Facet_vertices].allocate(positions.data(),
-                            static_cast<int>(positions.size()*sizeof(double)));
-        program->enableAttributeArray("vertex");
-        program->setAttributeBuffer("vertex",GL_DOUBLE,0,3);
-        buffers[Facet_vertices].release();
-
-        buffers[Facet_normals].bind();
-        buffers[Facet_normals].allocate(normals.data(),
-                            static_cast<int>(normals.size()*sizeof(double)));
-        program->enableAttributeArray("normals");
-        program->setAttributeBuffer("normals",GL_DOUBLE,0,3);
-        buffers[Facet_normals].release();
-        vaos[Facets]->release();
-        program->release();
-    }
-    //vao for the ROI points
-    {   program = getShaderProgram(PROGRAM_NO_SELECTION, viewer);
-        program->bind();
-        vaos[Roi_points]->bind();
-        buffers[Roi_vertices].bind();
-        buffers[Roi_vertices].allocate(ROI_points.data(),
-                            static_cast<int>(ROI_points.size()*sizeof(double)));
-        program->enableAttributeArray("vertex");
-        program->setAttributeBuffer("vertex",GL_DOUBLE,0,3);
-        buffers[Roi_vertices].release();
-        vaos[Roi_points]->release();
-
-        program->release();
-    }
-   //vao for the edges
-    {
-        program = getShaderProgram(PROGRAM_NO_SELECTION, viewer);
-        program->bind();
-        vaos[Edges]->bind();
-        buffers[Facet_vertices].bind();
-        program->enableAttributeArray("vertex");
-        program->setAttributeBuffer("vertex",GL_DOUBLE,0,3);
-        buffers[Facet_vertices].release();
-        vaos[Edges]->release();
-        program->release();
-    }
-    //vao for the ROI spheres
-    {
-        program = getShaderProgram(PROGRAM_INSTANCED, viewer);
-        program->bind();
-        vaos[ROI_spheres]->bind();
-        buffers[Sphere_vertices].bind();
-        buffers[Sphere_vertices].allocate(pos_sphere.data(),
-                            static_cast<int>(pos_sphere.size()*sizeof(double)));
-        program->enableAttributeArray("vertex");
-        program->setAttributeBuffer("vertex",GL_DOUBLE,0,3);
-        buffers[Sphere_vertices].release();
-
-        buffers[Sphere_normals].bind();
-        buffers[Sphere_normals].allocate(normals_sphere.data(),
-                            static_cast<int>(normals_sphere.size()*sizeof(double)));
-        program->enableAttributeArray("normals");
-        program->setAttributeBuffer("normals",GL_DOUBLE,0,3);
-        buffers[Sphere_normals].release();
-
-        buffers[Roi_vertices].bind();
-        program->enableAttributeArray("center");
-        program->setAttributeBuffer("center",GL_DOUBLE,0,3);
-        buffers[Roi_vertices].release();
-
-        if(viewer->extension_is_found)
-        {
-            viewer->glVertexAttribDivisor(program->attributeLocation("center"), 1);
-            viewer->glVertexAttribDivisor(program->attributeLocation("colors"), 1);
-        }
-        vaos[ROI_spheres]->release();
-        ROI_color.resize(0);
-        std::vector<double>(ROI_color).swap(ROI_color);
-        nb_ROI = ROI_points.size();
-        ROI_points.resize(0);
-        std::vector<double>(ROI_points).swap(ROI_points);
-    }
-    //vao for the BBOX
-    {
-        bbox_program.bind();
-        vaos[4]->bind();
-        buffers[Bbox_vertices].bind();
-        buffers[Bbox_vertices].allocate(pos_bbox.data(),
-                             static_cast<int>(pos_bbox.size()*sizeof(double)));
-        bbox_program.enableAttributeArray("vertex");
-        bbox_program.setAttributeBuffer("vertex",GL_DOUBLE,0,3);
-        buffers[Bbox_vertices].release();
-
-        vaos[4]->release();
-        nb_bbox = pos_bbox.size();
-        pos_bbox.resize(0);
-        std::vector<double>(pos_bbox).swap(pos_bbox);
-        color_bbox.resize(0);
-        std::vector<double>(color_bbox).swap(color_bbox);
-        bbox_program.release();
-    }
-    //vao for the control points
-    {
-        program = getShaderProgram(PROGRAM_NO_SELECTION, viewer);
-        program->bind();
-        vaos[Control_points]->bind();
-        buffers[Control_vertices].bind();
-        buffers[Control_vertices].allocate(control_points.data(),
-                             static_cast<int>(control_points.size()*sizeof(double)));
-        program->enableAttributeArray("vertex");
-        program->setAttributeBuffer("vertex",GL_DOUBLE,0,3);
-        buffers[Control_vertices].release();
-
-        vaos[Control_points]->release();
-        program->release();
-    }
-    //vao for the control spheres
-    {
-        program = getShaderProgram(PROGRAM_INSTANCED, viewer);
-        program->bind();
-        vaos[Control_spheres]->bind();
-        buffers[Sphere_vertices].bind();
-        program->enableAttributeArray("vertex");
-        program->setAttributeBuffer("vertex",GL_DOUBLE,0,3);
-
-        buffers[Sphere_normals].bind();
-        program->enableAttributeArray("normals");
-        program->setAttributeBuffer("normals",GL_DOUBLE,0,3);
-        buffers[Sphere_normals].release();
-
-        buffers[Control_vertices].bind();
-        program->enableAttributeArray("center");
-        program->setAttributeBuffer("center",GL_DOUBLE,0,3);
-        buffers[Control_vertices].release();
-
-        if(viewer->extension_is_found)
-        {
-            viewer->glVertexAttribDivisor(program->attributeLocation("center"), 1);
-        }
-        vaos[Control_spheres]->release();
-        nb_sphere = pos_sphere.size();
-        //pos_sphere.resize(0);
-        //std::vector<double>(pos_sphere).swap(pos_sphere);
-       // normals_sphere.resize(0);
-       // std::vector<double>(normals_sphere).swap(normals_sphere);
-        control_color.resize(0);
-        std::vector<double>(control_color).swap(control_color);
-        nb_control = control_points.size();
-        control_points.resize(0);
-        std::vector<double>(control_points).swap(control_points);
-    }
-    //vao for the axis
-    {
-        program = getShaderProgram(PROGRAM_NO_SELECTION, viewer);
-        program->bind();
-        vaos[Axis]->bind();
-        buffers[Axis_vertices].bind();
-        buffers[Axis_vertices].allocate(pos_axis.data(),
-                             static_cast<int>(pos_axis.size()*sizeof(double)));
-        program->enableAttributeArray("vertex");
-        program->setAttributeBuffer("vertex",GL_DOUBLE,0,3);
-        buffers[Axis_vertices].release();
-        buffers[Axis_colors].bind();
-        buffers[Axis_colors].allocate(color_lines.data(),
-                             static_cast<int>(color_lines.size()*sizeof(double)));
-        program->enableAttributeArray("colors");
-        program->setAttributeBuffer("colors",GL_DOUBLE,0,3);
-        buffers[Axis_colors].release();
-        vaos[Axis]->release();
-        program->release();
-        nb_axis = pos_axis.size();
-        pos_axis.resize(0);
-        std::vector<double>(pos_axis).swap(pos_axis);
-        color_lines.resize(0);
-        std::vector<double>(color_lines).swap(color_lines);
-    }
-    //vao for the frame plane
-    {
-        program = getShaderProgram(PROGRAM_NO_SELECTION, viewer);
-        program->bind();
-        bbox_program.bind();
-        vaos[Frame_plane]->bind();
-        buffers[Frame_vertices].bind();
-        buffers[Frame_vertices].allocate(pos_frame_plane.data(),
-                             static_cast<int>(pos_frame_plane.size()*sizeof(double)));
-        bbox_program.enableAttributeArray("vertex");
-        bbox_program.setAttributeBuffer("vertex",GL_DOUBLE,0,3);
-        buffers[Frame_vertices].release();
-
-        vaos[Frame_plane]->release();
-        bbox_program.release();
-        program->release();
-    }
-    are_buffers_filled = true;
-}
-
-void Scene_edit_polyhedron_item::reset_drawing_data()
-{
-  positions.clear();
-  positions.resize(num_vertices(*polyhedron()) * 3);
-
-  normals.clear();
-  normals.resize(positions.size());
-
-  std::size_t counter = 0;
-  BOOST_FOREACH(vertex_descriptor vb, vertices(*polyhedron()))
-  {
-    positions[counter * 3] = vb->point().x();
-    positions[counter * 3 + 1] = vb->point().y();
-    positions[counter * 3 + 2] = vb->point().z();
-
-    const Polyhedron::Traits::Vector_3& n =
-      CGAL::Polygon_mesh_processing::compute_vertex_normal(vb, deform_mesh->halfedge_graph());
-    normals[counter * 3] = n.x();
-    normals[counter * 3 + 1] = n.y();
-    normals[counter * 3 + 2] = n.z();
-
-    ++counter;
-  }
-
-  tris.clear();
-  tris.resize(polyhedron()->size_of_facets() * 3);
-  counter = 0;
-  BOOST_FOREACH(face_descriptor fb, faces(*polyhedron()))
-  {
-    tris[counter * 3] = static_cast<unsigned int>(fb->halfedge()->vertex()->id());
-    tris[counter * 3 + 1] = static_cast<unsigned int>(fb->halfedge()->next()->vertex()->id());
-    tris[counter * 3 + 2] = static_cast<unsigned int>(fb->halfedge()->prev()->vertex()->id());
-    ++counter;
-  }
-
-  edges.clear();
-  edges.resize(polyhedron()->size_of_halfedges());
-  counter = 0;
-  for (Polyhedron::Edge_iterator eb = polyhedron()->edges_begin();
-       eb != polyhedron()->edges_end(); ++eb, ++counter)
-  {
-    edges[counter * 2] = static_cast<unsigned int>(eb->vertex()->id());
-    edges[counter * 2 + 1] = static_cast<unsigned int>(eb->opposite()->vertex()->id());
-  }
-}
-
-void Scene_edit_polyhedron_item::compute_normals_and_vertices(void)
-{
-    ROI_points.resize(0);
-    control_points.resize(0);
-    control_color.resize(0);
-    pos_frame_plane.resize(0);
-    BOOST_FOREACH(vertex_descriptor vd, deform_mesh->roi_vertices())
-    {
-        if(!deform_mesh->is_control_vertex(vd))
-        {//gl_draw_point( vd->point() );
-            ROI_points.push_back(vd->point().x());
-            ROI_points.push_back(vd->point().y());
-            ROI_points.push_back(vd->point().z());
-        }
-    }
-    ROI_color.assign(ROI_points.size(),0);
-    for(std::size_t i=0; i<ROI_color.size()/3; i++)
-      ROI_color[3*i+1]=1.0;
-
-    QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
-    for(Ctrl_vertices_group_data_list::const_iterator hgb_data = ctrl_vertex_frame_map.begin(); hgb_data != ctrl_vertex_frame_map.end(); ++hgb_data)
-    {
-        if(hgb_data->frame == viewer->manipulatedFrame())
-        {
-            if(!ui_widget->ActivatePivotingCheckBox->isChecked())
-            {
-                // draw bbox
-                compute_bbox(hgb_data->bbox);
-            }
-        }
-
-        const double r=hgb_data == active_group?1:0;
-        const double b=hgb_data == active_group?0:1;
-
-        for(std::vector<vertex_descriptor>::const_iterator hb = hgb_data->ctrl_vertices_group.begin(); hb != hgb_data->ctrl_vertices_group.end(); ++hb)
-        {
-            control_points.push_back((*hb)->point().x());
-            control_points.push_back((*hb)->point().y());
-            control_points.push_back((*hb)->point().z());
-            control_color.push_back(r);
-            control_color.push_back(0);
-            control_color.push_back(b);
-        }
-    }
-
-    //The box color
-    color_bbox.resize(pos_bbox.size());
-    for(int i =0; i< (int)pos_bbox.size(); i++)
-        color_bbox[i]=0.0;
-
-    for(int i =0; i< (int)pos_bbox.size(); i+=3)
-        color_bbox[i]=1.0;
-
-    //The axis
-
-    pos_axis.resize(18);
-    for(int i =0; i< 18; i++)
-        pos_axis[i]=0.0;
-    pos_axis[3] = length_of_axis; pos_axis[10] = length_of_axis; pos_axis[17] = length_of_axis;
-    color_lines.resize(18);
-    for(int i =0; i< 18; i++)
-        color_lines[i]=0.0;
-
-    color_lines[2] = 1.0; color_lines[5] = 1.0;
-    color_lines[6] = 1.0; color_lines[9] = 1.0;
-    color_lines[13] = 1.0; color_lines[16] = 1.0;
-
-    if(ui_widget->ActivateFixedPlaneCheckBox->isChecked())
-      draw_frame_plane(viewer);
-
-}
-
-/////////////////////////////////////////////////////////
-/////////// Most relevant functions lie here ///////////
-void Scene_edit_polyhedron_item::deform()
-{
-  if(!is_there_any_ctrl_vertices()) { return; }
-
-  for(Ctrl_vertices_group_data_list::iterator it = ctrl_vertex_frame_map.begin(); it != ctrl_vertex_frame_map.end(); ++it)
-  { it->set_target_positions(); }
-  deform_mesh->deform();
-
-  poly_item->invalidate_aabb_tree(); // invalidate the AABB-tree of the poly_item
-  Q_EMIT itemChanged();
-}
-
-struct ROI_border_pmap
-{
-  std::set<edge_descriptor>* m_set_ptr;
-
-  typedef edge_descriptor                    key_type;
-  typedef bool                               value_type;
-  typedef bool                               reference;
-  typedef boost::read_write_property_map_tag category;
-
-  ROI_border_pmap() : m_set_ptr(NULL) {}
-  ROI_border_pmap(std::set<edge_descriptor>* set_)
-    : m_set_ptr(set_)
-  {}
-  friend bool get(const ROI_border_pmap& map, const key_type& k)
-  {
-    CGAL_assertion(map.m_set_ptr != NULL);
-    return map.m_set_ptr->count(k);
-  }
-  friend void put(ROI_border_pmap& map, const key_type& k, const value_type b)
-  {
-    CGAL_assertion(map.m_set_ptr != NULL);
-    if (b)              map.m_set_ptr->insert(k);
-    else if(get(map,k)) map.m_set_ptr->erase(k);
-  }
-};
-
-void Scene_edit_polyhedron_item::remesh()
-{
-  const Polyhedron& g = deform_mesh->halfedge_graph();
-  Array_based_vertex_point_map vpmap(&positions);
-
-  std::set<face_descriptor> roi_facets;
-  std::set<vertex_descriptor> roi_vertices(
-    deform_mesh->roi_vertices().begin(),deform_mesh->roi_vertices().end());
-
-  BOOST_FOREACH(vertex_descriptor v, deform_mesh->roi_vertices())
-  {
-    BOOST_FOREACH(face_descriptor fv, CGAL::faces_around_target(halfedge(v, g), g))
-    {
-      bool add_face=true;
-      BOOST_FOREACH(vertex_descriptor vfd, CGAL::vertices_around_face(halfedge(fv,g),g))
-        if (roi_vertices.count(vfd)==0)
-          add_face=false;
-      if(add_face)
-        roi_facets.insert(fv);
-    }
-  }
-
-  // set face_index map needed for border_halfedges and isotropic_remeshing
-  boost::property_map<Polyhedron, CGAL::face_index_t>::type fim
-    = get(CGAL::face_index, *polyhedron());
-  unsigned int id = 0;
-
-  // estimate the target_length using the perimeter of the region to remesh
-  bool automatic_target_length = !ui_widget->remeshingEdgeLengthInput_checkBox->isChecked();
-  double estimated_target_length = 0.;
-  if (automatic_target_length)
-  {
-    BOOST_FOREACH(face_descriptor f, faces(*polyhedron()))
-      put(fim, f, id++);
-    std::set<halfedge_descriptor> roi_border_halfedges;
-    CGAL::Polygon_mesh_processing::border_halfedges(roi_facets, g,
-      std::inserter(roi_border_halfedges, roi_border_halfedges.begin()));
-
-    double sum_len=0.;
-    BOOST_FOREACH(halfedge_descriptor h, roi_border_halfedges)
-    {
-      sum_len += CGAL::sqrt(CGAL::squared_distance(
-                    get(vpmap, source(h, g)), get(vpmap, target(h, g))));
-    }
-    if (sum_len==0) automatic_target_length = false;
-    else
-      estimated_target_length = sum_len / (0. + roi_border_halfedges.size());
-  }
-
-  double target_length = automatic_target_length
-    ? estimated_target_length
-    : ui_widget->remeshing_edge_length_spinbox->value();
-
-  unsigned int nb_iter = ui_widget->remeshing_iterations_spinbox->value();
-
-  std::cout << "Remeshing...";
-  CGAL::Polygon_mesh_processing::isotropic_remeshing(
-      roi_facets
-    , target_length
-    , *polyhedron()
-    , CGAL::Polygon_mesh_processing::parameters::number_of_iterations(nb_iter)
-    .protect_constraints(false)
-    .vertex_point_map(vpmap)
-    );
-  std::cout << "done." << std::endl;
-
-  //reset ROI from its outside border roi_border
-  clear_roi();
-  do{
-    delete_ctrl_vertices_group(false);
-  }
-  while(!ctrl_vertex_frame_map.empty());
-
-  poly_item->update_vertex_indices();
-  poly_item->update_halfedge_indices();
-  delete deform_mesh;
-  deform_mesh = new Deform_mesh(*(poly_item->polyhedron()),
-                                Deform_mesh::Vertex_index_map(),
-                                Deform_mesh::Hedge_index_map(),
-                                vpmap);
-
-  reset_drawing_data();
-  compute_normals_and_vertices();
-
-  poly_item->invalidate_aabb_tree(); // invalidate the AABB tree
-  create_ctrl_vertices_group();
-
-  Q_EMIT itemChanged();
-}
-
-void Scene_edit_polyhedron_item::timerEvent(QTimerEvent* /*event*/)
-{ // just handle deformation - paint like selection is handled in eventFilter()
-  if(state.ctrl_pressing && (state.left_button_pressing || state.right_button_pressing)) {
-      invalidateOpenGLBuffers();
-    if(!ui_widget->ActivatePivotingCheckBox->isChecked()) {
-        deform();
-    }
-    else {
-      Q_EMIT itemChanged(); // for redraw while Pivoting (since we close signals of manipulatedFrames while pivoting, 
-                          // for now redraw with timer)
-    }
-  }
-}
-bool Scene_edit_polyhedron_item::eventFilter(QObject* /*target*/, QEvent *event)
-{
-  // This filter is both filtering events from 'viewer' and 'main window'
-  Mouse_keyboard_state_deformation old_state = state;
-  ////////////////// TAKE EVENTS /////////////////////
-  // key events
-  if(event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease) 
-  {
-    QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
-    Qt::KeyboardModifiers modifiers = keyEvent->modifiers();
-
-    state.ctrl_pressing = modifiers.testFlag(Qt::ControlModifier);
-    state.shift_pressing = modifiers.testFlag(Qt::ShiftModifier);
-  }
-  // mouse events
-  if(event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonRelease)
-	{
-    QMouseEvent* mouse_event = static_cast<QMouseEvent*>(event);
-    if(mouse_event->button() == Qt::LeftButton) {
-      state.left_button_pressing = event->type() == QEvent::MouseButtonPress;
-    }
-    if(mouse_event->button() == Qt::RightButton) {
-      state.right_button_pressing = event->type() == QEvent::MouseButtonPress;
-    }    
-  }
-  ////////////////// //////////////// /////////////////////
-
-  if(!poly_item->visible()) { return false; } // if not visible just update event state but don't do any action
-
-  // check state changes between old and current state
-  bool ctrl_pressed_now = state.ctrl_pressing && !old_state.ctrl_pressing;
-  bool ctrl_released_now = !state.ctrl_pressing && old_state.ctrl_pressing;
-  if(ctrl_pressed_now || ctrl_released_now || event->type() == QEvent::HoverMove)
-  {// activate a handle manipulated frame
-    QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
-    const QPoint& p = viewer->mapFromGlobal(QCursor::pos());
-    bool need_repaint = activate_closest_manipulated_frame(p.x(), p.y());
-
-    if (!ui_widget->ActivatePivotingCheckBox->isChecked() &&
-        ctrl_released_now && ui_widget->RemeshingCheckBox->isChecked())
-    {
-      remesh();
-    }
-
-    if(need_repaint) { Q_EMIT itemChanged(); }
-  }
-
-  return false;
-}
-
-#include "opengl_tools.h"
-void Scene_edit_polyhedron_item::draw_edges(CGAL::Three::Viewer_interface* viewer) const {
-    if(!are_buffers_filled)
-        initialize_buffers(viewer);
-    vaos[Edges]->bind();
-    program = getShaderProgram(PROGRAM_NO_SELECTION);
-    attrib_buffers(viewer,PROGRAM_NO_SELECTION);
-    program->bind();
-    program->setAttributeValue("colors", QColor(0,0,0));
-    viewer->glDrawElements(GL_LINES, (GLsizei) edges.size(), GL_UNSIGNED_INT, edges.data());
-    program->release();
-    vaos[Edges]->release();
-
-
-    vaos[Frame_plane]->bind();
-    program = getShaderProgram(PROGRAM_NO_SELECTION);
-    attrib_buffers(viewer,PROGRAM_NO_SELECTION);
-    program->bind();
-    program->setAttributeValue("colors", QColor(0,0,0));
-    viewer->glDrawArrays(GL_LINE_LOOP, 0, (GLsizei)pos_frame_plane.size()/3);
-    program->release();
-    vaos[Frame_plane]->release();
-
-
-  if(rendering_mode == Wireframe) {
-        draw_ROI_and_control_vertices(viewer);
-  }
-}
-void Scene_edit_polyhedron_item::draw(CGAL::Three::Viewer_interface* viewer) const {
-    if(!are_buffers_filled)
-        initialize_buffers(viewer);
-    vaos[Facets]->bind();
-    program = getShaderProgram(PROGRAM_WITH_LIGHT);
-    attrib_buffers(viewer,PROGRAM_WITH_LIGHT);
-    program->bind();
-    QColor color = this->color();
-    program->setAttributeValue("colors", color);
-    viewer->glDrawElements(GL_TRIANGLES, (GLsizei) tris.size(), GL_UNSIGNED_INT, tris.data());
-    program->release();
-    vaos[Facets]->release();
-    draw_edges(viewer);
-    draw_ROI_and_control_vertices(viewer);
-
-}
-
-void Scene_edit_polyhedron_item::draw_frame_plane(QGLViewer* ) const
-{
-    pos_frame_plane.resize(15);
-    for(Ctrl_vertices_group_data_list::const_iterator hgb_data = ctrl_vertex_frame_map.begin(); hgb_data != ctrl_vertex_frame_map.end(); ++hgb_data)
-    {
-          const double diag = scene_diag();
-          qglviewer::Vec base1(1,0,0);
-          qglviewer::Vec base2(0,1,0);
-
-          qglviewer::Quaternion orientation=hgb_data->frame->orientation();
-          base1=orientation.rotate(base1);
-          base2=orientation.rotate(base2);
-
-          qglviewer::Vec center = hgb_data->calculate_initial_center();
-          qglviewer::Vec p1 = center - diag*base1 - diag*base2;
-          qglviewer::Vec p2 = center + diag*base1 - diag*base2;
-          qglviewer::Vec p3 = center + diag*base1 + diag*base2;
-          qglviewer::Vec p4 = center - diag*base1 + diag*base2;
-
-          pos_frame_plane[0] = p1.x ; pos_frame_plane[1] = p1.y; pos_frame_plane[2] =p1.z ;
-          pos_frame_plane[3] = p2.x ; pos_frame_plane[4] = p2.y; pos_frame_plane[5] =p2.z ;
-          pos_frame_plane[6] = p3.x ; pos_frame_plane[7] = p3.y; pos_frame_plane[8] =p3.z ;
-          pos_frame_plane[9] = p4.x ; pos_frame_plane[10]= p4.y; pos_frame_plane[11] =p4.z ;
-          pos_frame_plane[12] = p1.x ; pos_frame_plane[13]= p1.y; pos_frame_plane[14] =p1.z ;
-    }
-}
-
-void Scene_edit_polyhedron_item::draw_ROI_and_control_vertices(CGAL::Three::Viewer_interface* viewer) const {
-
-  CGAL::GL::Color color;
-  CGAL::GL::Point_size point_size; point_size.set_point_size(5);
-
-  color.set_rgb_color(0, 1.f, 0);
-  if(ui_widget->ShowROICheckBox->isChecked()) {
-
-        if(!ui_widget->ShowAsSphereCheckBox->isChecked() || !viewer->extension_is_found) {
-
-            vaos[Roi_points]->bind();
-            program = getShaderProgram(PROGRAM_NO_SELECTION);
-            attrib_buffers(viewer,PROGRAM_NO_SELECTION);
-            program->bind();
-            program->setAttributeValue("colors", QColor(0,255,0));
-            viewer->glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(nb_ROI/3));
-            program->release();
-            vaos[Roi_points]->release();
-        }
-        else{
-            vaos[ROI_spheres]->bind();
-            program = getShaderProgram(PROGRAM_INSTANCED);
-            attrib_buffers(viewer,PROGRAM_INSTANCED);
-            program->bind();
-
-            program->setAttributeValue("colors", QColor(0,255,0));
-            viewer->glDrawArraysInstanced(GL_TRIANGLES, 0,
-                                        static_cast<GLsizei>(nb_sphere/3),
-                                        static_cast<GLsizei>(nb_ROI/3));
-            program->release();
-            vaos[ROI_spheres]->release();
-    }
-  }
-
-    if(!ui_widget->ShowAsSphereCheckBox->isChecked() || !viewer->extension_is_found) {
-        vaos[Control_points]->bind();
-        program = getShaderProgram(PROGRAM_NO_SELECTION);
-        attrib_buffers(viewer,PROGRAM_NO_SELECTION);
-        program->bind();
-        program->setAttributeValue("colors", QColor(255,0,0));
-        viewer->glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(nb_control/3));
-        program->release();
-        vaos[Control_points]->release();
-    }
-    else{
-        vaos[Control_spheres]->bind();
-        program = getShaderProgram(PROGRAM_INSTANCED);
-        attrib_buffers(viewer,PROGRAM_INSTANCED);
-        program->bind();
-        program->setAttributeValue("colors", QColor(255,0,0));
-        viewer->glDrawArraysInstanced(GL_TRIANGLES, 0,
-                                    static_cast<GLsizei>(nb_sphere/3),
-                                    static_cast<GLsizei>(nb_control/3));
-        program->release();
-        vaos[Control_spheres]->release();
-    }
-
-    QGLViewer* viewerB = *QGLViewer::QGLViewerPool().begin();
-  for(Ctrl_vertices_group_data_list::const_iterator hgb_data = ctrl_vertex_frame_map.begin(); hgb_data != ctrl_vertex_frame_map.end(); ++hgb_data)
-  {
-        if(hgb_data->frame == viewerB->manipulatedFrame())
-    {      
-            GLfloat f_matrix[16];
-            for(int i =0; i<16; i++)
-                f_matrix[i] = hgb_data->frame->matrix()[i];
-            QMatrix4x4 f_mat;
-                for(int i=0; i<16; i++)
-                    f_mat.data()[i] = (float)f_matrix[i];
-            vaos[Axis]->bind();
-            program = getShaderProgram(PROGRAM_NO_SELECTION);
-            attrib_buffers(viewer, PROGRAM_NO_SELECTION);
-            program->bind();
-            program->setUniformValue("f_matrix", f_mat);
-            viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(nb_axis/3));
-            program->release();
-            vaos[Axis]->release();
-
-            //QGLViewer::drawAxis(length_of_axis);
-      // draw bbox
-      if(!ui_widget->ActivatePivotingCheckBox->isChecked())
-      {
-                GLfloat f_matrix[16];
-                GLfloat trans[3];
-                GLfloat trans2[3];
-
-                trans[0] = hgb_data->frame->position().x;
-                trans[1] = hgb_data->frame->position().y;
-                trans[2] = hgb_data->frame->position().z;
-
-                trans2[0] = -hgb_data->frame_initial_center.x;
-                trans2[1] = -hgb_data->frame_initial_center.y;
-                trans2[2] = -hgb_data->frame_initial_center.z;
-
-                for(int i =0; i<16; i++)
-                    f_matrix[i] = hgb_data->frame->orientation().matrix()[i];
-                QMatrix4x4 f_mat;
-                QMatrix4x4 mvp_mat;
-
-                QVector3D vec(trans[0], trans[1], trans[2]);
-                QVector3D vec2(trans2[0], trans2[1], trans2[2]);
-                    for(int i=0; i<16; i++)
-                        f_mat.data()[i] = (float)f_matrix[i];
-                    GLdouble temp_mat[16];
-                    viewer->camera()->getModelViewProjectionMatrix(temp_mat);
-                    for(int i=0; i<16; i++)
-                        mvp_mat.data()[i] = (float)temp_mat[i];
-                vaos[4]->bind();
-                bbox_program.bind();
-                bbox_program.setUniformValue("rotations", f_mat);
-                bbox_program.setUniformValue("translation", vec);
-                bbox_program.setUniformValue("translation_2", vec2);
-                bbox_program.setUniformValue("mvp_matrix", mvp_mat);
-                program->setAttributeValue("colors", QColor(255,0,0));
-                viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(nb_bbox/3));
-                bbox_program.release();
-                vaos[4]->release();
-    }
-    }
-  }
-
-  } 
-
-
-void Scene_edit_polyhedron_item::compute_bbox(const CGAL::Three::Scene_interface::Bbox& bb){
-    pos_bbox.resize(24*3);
-
-    pos_bbox[0]=bb.xmin; pos_bbox[1]=bb.ymin; pos_bbox[2]=bb.zmin;
-    pos_bbox[3]=bb.xmax; pos_bbox[4]=bb.ymin; pos_bbox[5]=bb.zmin;
-    pos_bbox[6]=bb.xmin; pos_bbox[7]=bb.ymin; pos_bbox[8]=bb.zmin;
-    pos_bbox[9]=bb.xmin; pos_bbox[10]=bb.ymax; pos_bbox[11]=bb.zmin;
-    
-    pos_bbox[12]=bb.xmin; pos_bbox[13]=bb.ymin; pos_bbox[14]=bb.zmin;
-    pos_bbox[15]=bb.xmin; pos_bbox[16]=bb.ymin; pos_bbox[17]=bb.zmax;
-    pos_bbox[18]= bb.xmax; pos_bbox[19]=bb.ymin; pos_bbox[20]=bb.zmin;
-    pos_bbox[21]= bb.xmax; pos_bbox[22]=bb.ymax; pos_bbox[23]=bb.zmin;
-    
-    pos_bbox[24]= bb.xmax; pos_bbox[25]=bb.ymin; pos_bbox[26]=bb.zmin;
-    pos_bbox[27]= bb.xmax; pos_bbox[28]=bb.ymin; pos_bbox[29]=bb.zmax;
-    pos_bbox[30]=bb.xmin; pos_bbox[31]=bb.ymax; pos_bbox[32]=bb.zmin;
-    pos_bbox[33]=bb.xmax; pos_bbox[34]=bb.ymax; pos_bbox[35]=bb.zmin;
-    
-    pos_bbox[36]=bb.xmin; pos_bbox[37]=bb.ymax; pos_bbox[38]=bb.zmin;
-    pos_bbox[39]=bb.xmin; pos_bbox[40]=bb.ymax; pos_bbox[41]=bb.zmax;
-    pos_bbox[42]=bb.xmin; pos_bbox[43]=bb.ymin; pos_bbox[44]=bb.zmax;
-    pos_bbox[45]=bb.xmax; pos_bbox[46]=bb.ymin; pos_bbox[47]=bb.zmax;
-
-    pos_bbox[48]=bb.xmin; pos_bbox[49]=bb.ymin; pos_bbox[50]=bb.zmax;
-    pos_bbox[51]=bb.xmin; pos_bbox[52]=bb.ymax; pos_bbox[53]=bb.zmax;
-    pos_bbox[54]=bb.xmax; pos_bbox[55]=bb.ymax; pos_bbox[56]=bb.zmax;
-    pos_bbox[57]=bb.xmin; pos_bbox[58]=bb.ymax; pos_bbox[59]=bb.zmax;
-
-    pos_bbox[60]=bb.xmax; pos_bbox[61]=bb.ymax; pos_bbox[62]=bb.zmax;
-    pos_bbox[63]=bb.xmax; pos_bbox[64]=bb.ymin; pos_bbox[65]=bb.zmax;
-    pos_bbox[66]=bb.xmax; pos_bbox[67]=bb.ymax; pos_bbox[68]=bb.zmax;
-    pos_bbox[69]=bb.xmax; pos_bbox[70]=bb.ymax; pos_bbox[71]=bb.zmin;
-    
-}
-
-void Scene_edit_polyhedron_item::invalidateOpenGLBuffers()
-{
-    compute_normals_and_vertices();
-    update_normals();
-    compute_bbox();
-    are_buffers_filled = false;
-}
-
-Scene_polyhedron_item* Scene_edit_polyhedron_item::to_polyhedron_item() {
-  Scene_polyhedron_item* poly_item_tmp = poly_item;
-  poly_item->set_color_vector_read_only(false);
-  own_poly_item=false;
-  poly_item_tmp->invalidateOpenGLBuffers();
-  return poly_item_tmp;
-}
-
-Polyhedron* Scene_edit_polyhedron_item::polyhedron()       
-{ return poly_item->polyhedron(); }
-const Polyhedron* Scene_edit_polyhedron_item::polyhedron() const 
-{ return poly_item->polyhedron(); }
-QString Scene_edit_polyhedron_item::toolTip() const
-{
-  if(!poly_item->polyhedron())
-    return QString();
-
-  return QObject::tr("<p>Polyhedron <b>%1</b> (mode: %5, color: %6)</p>"
-                     "<p>Number of vertices: %2<br />"
-                     "Number of edges: %3<br />"
-                     "Number of facets: %4</p>")
-    .arg(this->name())
-    .arg(poly_item->polyhedron()->size_of_vertices())
-    .arg(poly_item->polyhedron()->size_of_halfedges()/2)
-    .arg(poly_item->polyhedron()->size_of_facets())
-    .arg(this->renderingModeName())
-    .arg(this->color().name());
-}
-bool Scene_edit_polyhedron_item::isEmpty() const {
-  return poly_item->isEmpty();
-}
-void Scene_edit_polyhedron_item::compute_bbox() const {
-  _bbox = poly_item->bbox();
-}
-
-void Scene_edit_polyhedron_item::setVisible(bool b) {
-  poly_item->setVisible(b);
-  Scene_item::setVisible(b);
-  if(!b) {
-    (*QGLViewer::QGLViewerPool().begin())->setManipulatedFrame(NULL);
-  }
-}
-void Scene_edit_polyhedron_item::setColor(QColor c) {
-  poly_item->setColor(c);
-  Scene_item::setColor(c);
-}
-void Scene_edit_polyhedron_item::setName(QString n) {
-  Scene_item::setName(n);
-  n.replace(" (edit)", "");
-  poly_item->setName(n);
-}
-void Scene_edit_polyhedron_item::setRenderingMode(RenderingMode m) {
-  poly_item->setRenderingMode(m);
-  Scene_item::setRenderingMode(m);
-}
-Scene_edit_polyhedron_item* Scene_edit_polyhedron_item::clone() const {
-  return 0;
-}
-void Scene_edit_polyhedron_item::select(
-          double orig_x,
-          double orig_y,
-          double orig_z,
-          double dir_x,
-          double dir_y,
-          double dir_z)
-{
-  Scene_item::select(orig_x,
-                     orig_y,
-                     orig_z,
-                     dir_x,
-                     dir_y,
-                     dir_z);
-  poly_item->select(orig_x,
-                       orig_y,
-                       orig_z,
-                       dir_x,
-                       dir_y,
-                       dir_z);
-}
-
-bool Scene_edit_polyhedron_item::keyPressEvent(QKeyEvent* e)
-{
-  //setting/unsetting rotation constraints
-  if (e->key()==Qt::Key_R && !state.ctrl_pressing)
-  {
-    is_rot_free = !is_rot_free;
-    rot_constraint.setRotationConstraintType( is_rot_free?
-        qglviewer::AxisPlaneConstraint::FREE:
-        qglviewer::AxisPlaneConstraint::AXIS);
-    return true;
-  }
-
-  return false;
-}
-
-void Scene_edit_polyhedron_item::create_Sphere(double R)
-{
-  create_flat_sphere(R, pos_sphere, normals_sphere);
-}
-
-//#include "Scene_edit_polyhedron_item.moc"
-void Scene_edit_polyhedron_item::update_frame_plane()
-{
-  for(Ctrl_vertices_group_data_list::iterator hgb_data = ctrl_vertex_frame_map.begin(); hgb_data != ctrl_vertex_frame_map.end(); ++hgb_data)
-  {
-      hgb_data->refresh();
-  }
-}
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.h b/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.h
deleted file mode 100644
index 1c63217..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.h
+++ /dev/null
@@ -1,777 +0,0 @@
-#ifndef SCENE_EDIT_POLYHEDRON_ITEM_H
-#define SCENE_EDIT_POLYHEDRON_ITEM_H
-//#define CGAL_PROFILE 
-#include "Scene_edit_polyhedron_item_config.h"
-#include "Scene_polyhedron_item.h"
-#include "Scene_polyhedron_item_k_ring_selection.h"
-#include "Travel_isolated_components.h"
-
-#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
-#include <CGAL/boost/graph/properties_Polyhedron_3.h>
-#include <CGAL/boost/graph/iterator.h>
-
-#include <iostream>
-#include <fstream>
-
-#include <QGLViewer/manipulatedFrame.h>
-#include <QGLViewer/qglviewer.h>
-#include <QGLViewer/camera.h>
-
-#include "ui_Deform_mesh.h"
-
-#include <CGAL/Polygon_mesh_processing/compute_normal.h>
-#include <CGAL/Surface_mesh_deformation.h>
-#include <CGAL/Polygon_mesh_processing/remesh.h>
-
-#include <boost/function_output_iterator.hpp>
-#include <QGLBuffer>
-#include <QGLShader>
-#include <QGLShaderProgram>
-
-
-typedef Polyhedron::Vertex_handle Vertex_handle;
-typedef boost::graph_traits<Polyhedron>::vertex_descriptor		vertex_descriptor;
-typedef boost::graph_traits<Polyhedron>::vertex_iterator		  vertex_iterator;
-typedef boost::graph_traits<Polyhedron>::face_descriptor      face_descriptor;
-typedef boost::graph_traits<Polyhedron>::halfedge_descriptor  halfedge_descriptor;
-typedef boost::graph_traits<Polyhedron>::edge_descriptor      edge_descriptor;
-
-struct Array_based_vertex_point_map
-{
-public:
-  typedef vertex_descriptor            key_type;
-  typedef Polyhedron::Traits::Point_3  value_type;
-  typedef const value_type&                  reference;
-  typedef boost::read_write_property_map_tag category;
-  Array_based_vertex_point_map(std::vector<double>* positions) : positions(positions) {}
-  std::vector<double>* positions;
-};
-
-
-inline
-Array_based_vertex_point_map::reference
-get(Array_based_vertex_point_map,
-  Array_based_vertex_point_map::key_type key) {
-    return key->point();
-}
-
-inline
-void
-put(Array_based_vertex_point_map pmap,
-  Array_based_vertex_point_map::key_type key,
-  Array_based_vertex_point_map::value_type val)
-{
-  key->point() = val; // to make things easy (ray selection after deformation, save to polyhedron after close etc),
-  // I also change point() of vertex together with positions list
-  // So that we do not need to pmap everywhere other than draw
-  if (key->id() == std::size_t(-1))
-  {
-    key->id() = pmap.positions->size() / 3;
-    pmap.positions->push_back(val.x());
-    pmap.positions->push_back(val.y());
-    pmap.positions->push_back(val.z());
-  }
-  else
-  {
-  std::size_t pos = key->id() * 3;
-  (*pmap.positions)[pos] = val.x();
-  (*pmap.positions)[pos+1] = val.y();
-  (*pmap.positions)[pos+2] = val.z();
-  }
-}
-
-typedef CGAL::Surface_mesh_deformation<Polyhedron, CGAL::Default, CGAL::Default, CGAL::ORIGINAL_ARAP
-  ,CGAL::Default, CGAL::Default, CGAL::Default, 
-  Array_based_vertex_point_map> Deform_mesh;
-
-
-typedef Deform_mesh::Point  Point;
-
-/// For storing associated data with a group of control vertices
-class Control_vertices_data
-{
-public:
-  std::vector<vertex_descriptor> ctrl_vertices_group;
-  qglviewer::ManipulatedFrame* frame;  // manframe assoc with a group of control vertices
-  qglviewer::Vec frame_initial_center; // initial center of frame
-  CGAL::Three::Scene_interface::Bbox bbox;          // bbox of control vertices inside group
-  qglviewer::Vec rot_direction;        // vector for constraint rotation
-private:
-  std::vector<qglviewer::Vec> initial_positions;
-  Deform_mesh* deform_mesh;
-
-public:
-  Control_vertices_data(Deform_mesh* deform_mesh, qglviewer::ManipulatedFrame* frame = 0)
-    : frame(frame), bbox(0,0,0,0,0,0), rot_direction(0.,0.,1.), deform_mesh(deform_mesh)
-  { }
-  void refresh()
-  {
-    for(std::vector<vertex_descriptor>::iterator it = ctrl_vertices_group.begin(); it != ctrl_vertices_group.end(); ) {
-      if(!deform_mesh->is_control_vertex(*it)) {
-        it = ctrl_vertices_group.erase(it);
-      }
-      else { ++it; }
-    }
-
-    reset_initial_positions();
-    frame_initial_center = calculate_initial_center();
-    bbox = calculate_initial_bbox();
-
-    bool oldState = frame->blockSignals(true); // do not let it Q_EMIT modified, which will cause a deformation
-                                  // but we are just adjusting the center so it does not require a deformation
-    // frame->setOrientation(qglviewer::Quaternion());
-    frame->setPosition(frame_initial_center);
-    frame->blockSignals(oldState);
-  }
-  void set_target_positions()
-  {
-    std::vector<vertex_descriptor>::iterator hb = ctrl_vertices_group.begin();
-    for(std::vector<qglviewer::Vec>::iterator it = initial_positions.begin(); it != initial_positions.end(); ++it, ++hb)
-    {
-      qglviewer::Vec dif_from_initial_center = (*it) - frame_initial_center;
-      qglviewer::Vec rotated = frame->orientation() * dif_from_initial_center;
-      qglviewer::Vec rotated_and_translated = rotated + frame->position();
-
-      deform_mesh->set_target_position(*hb, Point(rotated_and_translated.x, rotated_and_translated.y, rotated_and_translated.z) );
-    }
-  }
-  qglviewer::Vec calculate_initial_center() const
-  {
-    qglviewer::Vec center_acc(0, 0, 0);
-    if (initial_positions.empty()) { return center_acc; }
-
-    for (std::vector<qglviewer::Vec>::const_iterator it = initial_positions.begin();
-         it != initial_positions.end(); ++it)
-    {
-      center_acc += (*it);
-    }
-    return center_acc / initial_positions.size();
-  }
-
-private:
-  void reset_initial_positions()
-  {
-    initial_positions.clear();
-    
-    for(std::vector<vertex_descriptor>::iterator hb = ctrl_vertices_group.begin(); hb != ctrl_vertices_group.end(); ++hb)
-    {
-      qglviewer::Vec point((*hb)->point().x(), (*hb)->point().y(), (*hb)->point().z() );
-      initial_positions.push_back(point);
-    }
-  }
-  CGAL::Three::Scene_interface::Bbox calculate_initial_bbox()
-  {    
-    if(initial_positions.empty()) {return CGAL::Three::Scene_interface::Bbox(0,0,0,0,0,0); }
-
-    const qglviewer::Vec& p_i = *(initial_positions.begin());
-    CGAL::Three::Scene_interface::Bbox bbox(p_i.x, p_i.y, p_i.z, p_i.x, p_i.y, p_i.z);
-
-    for(std::vector<qglviewer::Vec>::iterator it = initial_positions.begin(); it != initial_positions.end(); ++it)
-    {
-      const qglviewer::Vec& p_i = (*it);
-      CGAL::Three::Scene_interface::Bbox bbox_it(p_i.x, p_i.y, p_i.z, p_i.x, p_i.y, p_i.z);
-      bbox = bbox + bbox_it;
-    }
-    return bbox;
-  }
-};
-
-// To hold pressing states together
-struct Mouse_keyboard_state_deformation
-{
-  bool ctrl_pressing;
-  bool shift_pressing;
-  bool left_button_pressing;
-  bool right_button_pressing;
-
-  Mouse_keyboard_state_deformation() 
-    : ctrl_pressing(false), shift_pressing(false), left_button_pressing(false), right_button_pressing(false)
-  { }
-};
-
-// This class represents a polyhedron in the OpenGL scene
-class SCENE_EDIT_POLYHEDRON_ITEM_EXPORT Scene_edit_polyhedron_item 
-  : public CGAL::Three::Scene_item {
-  Q_OBJECT
-public:  
-  /// Create an Scene_edit_polyhedron_item from a Scene_polyhedron_item.
-  /// The ownership of the polyhedron is moved to the new edit_polyhedron
-  /// item.
-  Scene_edit_polyhedron_item(Scene_polyhedron_item* poly_item, Ui::DeformMesh* ui_widget, QMainWindow* mw);
-  ~Scene_edit_polyhedron_item();
-
-  /// Returns 0, so that one cannot clone an "edit polyhedron" item.
-  Scene_edit_polyhedron_item* clone() const;
-
-  // Function for displaying meta-data of the item
-  QString toolTip() const;
-
-  void setColor(QColor c);
-  void setName(QString n);
-  void setVisible(bool b);
-  void setRenderingMode(RenderingMode m);
-  
-  // Indicate if rendering mode is supported
-  bool supportsRenderingMode(RenderingMode m) const { 
-    return m == Gouraud; 
-  }
-  // Points/Wireframe/Flat/Gouraud OpenGL drawing in a display list
-  void draw() const{}
-  void draw(CGAL::Three::Viewer_interface*) const;
-  void draw_edges(CGAL::Three::Viewer_interface*) const;
-  void draw_bbox(const CGAL::Three::Scene_interface::Bbox&) const;
-  void draw_ROI_and_control_vertices(CGAL::Three::Viewer_interface *viewer) const;
-  void draw_frame_plane(QGLViewer *) const;
-
-  // Get wrapped polyhedron
-  Polyhedron*       polyhedron();
-  const Polyhedron* polyhedron() const;
-
-  /// Returns a Scene_polyhedron_item from the edit polyhedron item, and
-  /// transfer the ownership of the polyhedron to it.
-  /// The item 'this' must be destroy just after a call to this function.
-  Scene_polyhedron_item* to_polyhedron_item();
-
-  // Get dimensions
-  bool isFinite() const { return true; }
-  bool isEmpty() const;
-  void compute_bbox() const;
-
-  int get_k_ring()       { return k_ring_selector.k_ring; }
-  void set_k_ring(int v) { k_ring_selector.k_ring = v; }
-
-  // take mouse events from viewer, main-window does not work
-  // take keyboard events from main-window, which is more stable
-  bool eventFilter(QObject *target, QEvent *event);
-  void update_frame_plane();
-  
-protected:
-  void timerEvent(QTimerEvent *event);
-
-
-public Q_SLOTS:
-  void invalidateOpenGLBuffers();
-  void selected(const std::set<Polyhedron::Vertex_handle>& m)
-  {
-    bool any_changes = false;
-    for(std::set<vertex_descriptor>::const_iterator it = m.begin(); it != m.end(); ++it)
-    {
-      vertex_descriptor vh = *it;
-      bool changed = false;
-      if(ui_widget->ROIRadioButton->isChecked()) {
-        if(ui_widget->InsertRadioButton->isChecked()) { changed = insert_roi_vertex(vh); }
-        else          { changed = erase_roi_vertex(vh);  }
-      }
-      else {
-        if(ui_widget->InsertRadioButton->isChecked()) { changed = insert_control_vertex(vh); }
-        else          { changed = erase_control_vertex(vh);  }
-      }
-      any_changes |= changed;
-    }
-    if(any_changes) { invalidateOpenGLBuffers(); Q_EMIT itemChanged(); }
-  }
-
-  void select(double orig_x,
-              double orig_y,
-              double orig_z,
-              double dir_x,
-              double dir_y,
-              double dir_z);
-
-  void deform(); // deform the mesh
-  void remesh();
-
-// members
-private:
-  Ui::DeformMesh* ui_widget;
-  Scene_polyhedron_item* poly_item;
-  // For drawing
-  mutable std::vector<GLdouble> positions;
-  mutable std::vector<unsigned int> tris;
-  mutable std::vector<unsigned int> edges;
-  mutable std::vector<GLdouble> color_lines;
-  mutable std::vector<GLdouble> color_bbox;
-  mutable std::vector<GLdouble> ROI_points;
-  mutable std::vector<GLdouble> control_points;
-  mutable std::vector<GLdouble> ROI_color;
-  mutable std::vector<GLdouble> control_color;
-  mutable std::vector<GLdouble> normals;
-  mutable std::vector<GLdouble> pos_bbox;
-  mutable std::vector<GLdouble> pos_axis;
-  mutable std::vector<GLdouble> pos_sphere;
-  mutable std::vector<GLdouble> normals_sphere;
-  mutable std::vector<GLdouble> pos_frame_plane;
-  mutable QOpenGLShaderProgram *program;
-  mutable QOpenGLShaderProgram bbox_program;
-  mutable std::size_t nb_ROI;
-  mutable std::size_t nb_sphere;
-  mutable std::size_t nb_control;
-  mutable std::size_t nb_axis;
-  mutable std::size_t nb_bbox;
-
-  enum Buffer
-  {
-      Facet_vertices =0,
-      Facet_normals,
-      Roi_vertices,
-      Control_vertices,
-      Sphere_vertices,
-      Sphere_normals,
-      Bbox_vertices,
-      Axis_vertices,
-      Axis_colors,
-      Frame_vertices,
-      NumberOfBuffers
-  };
-  enum Vao
-  {
-      Facets=0,
-      Roi_points,
-      Edges,
-      ROI_spheres,
-      BBox,
-      Control_points,
-      Control_spheres,
-      Axis,
-      Frame_plane,
-      NumberOfVaos
-  };
-  mutable QOpenGLBuffer *in_bu;
-  using CGAL::Three::Scene_item::initialize_buffers;
-  void initialize_buffers(CGAL::Three::Viewer_interface *viewer) const;
-  void compute_normals_and_vertices(void);
-  void compute_bbox(const CGAL::Three::Scene_interface::Bbox&);
-  void create_Sphere(double);
-  void reset_drawing_data();
-
-  Deform_mesh* deform_mesh;
-  typedef std::list<Control_vertices_data> Ctrl_vertices_group_data_list;
-  Ctrl_vertices_group_data_list::iterator active_group;
-  Ctrl_vertices_group_data_list ctrl_vertex_frame_map; // keep list of group of control vertices with assoc data
-
-  double length_of_axis; // for drawing axis at a group of control vertices
-
-  // by interleaving 'viewer's events (check constructor), keep followings:
-  Mouse_keyboard_state_deformation state;
-
-  //For constraint rotation
-  qglviewer::LocalConstraint rot_constraint;
-  bool is_rot_free;
-
-  bool own_poly_item; //indicates if the poly_item should be deleted by the destructor
-  Scene_polyhedron_item_k_ring_selection k_ring_selector;
-
-public:
-  // Deformation related functions //
-  bool insert_control_vertex(vertex_descriptor v)
-  {
-    if(!is_there_any_ctrl_vertices_group()) {
-      print_message("There is no group of control vertices, create one!");
-      return false; 
-    } // no group of control vertices to insert
-
-    bool inserted = deform_mesh->insert_control_vertex(v);
-    if(inserted) {
-      active_group->ctrl_vertices_group.push_back(v);
-      active_group->refresh();
-    }
-    return inserted;
-  }
-
-  bool insert_roi_vertex(vertex_descriptor v)
-  {
-    return deform_mesh->insert_roi_vertex(v);
-  }
-  
-  bool erase_control_vertex(vertex_descriptor v)
-  {
-    if(deform_mesh->erase_control_vertex(v)) // API should be safe enough to do that (without checking empty group of control vertices etc.)
-    {
-      refresh_all_group_centers(); // since we don't know which group of control vertices v is erased from, refresh all
-      return true;
-    }
-
-    print_message("Selected vertex is not a control vertex!");
-    return false;     
-  }
-
-  bool erase_roi_vertex(vertex_descriptor v)
-  {
-    erase_control_vertex(v); // erase control vertex
-    return deform_mesh->erase_roi_vertex(v);
-  }
-
-  void set_all_vertices_as_roi()
-  {
-    vertex_iterator vb, ve;
-    for(boost::tie(vb, ve) = vertices(*polyhedron()); vb != ve; ++vb)
-    {
-      insert_roi_vertex(*vb);
-    }   
-  }
-
-  void clear_roi()
-  {
-    for(Ctrl_vertices_group_data_list::iterator it = ctrl_vertex_frame_map.begin(); it != ctrl_vertex_frame_map.end(); ++it)
-    {
-      delete it->frame;
-    }
-    ctrl_vertex_frame_map.clear();
-    deform_mesh->clear_roi_vertices();
-
-    create_ctrl_vertices_group(); // create one new group of control vertices
-  } 
-
-  void create_ctrl_vertices_group()
-  {
-    for(Ctrl_vertices_group_data_list::iterator it = ctrl_vertex_frame_map.begin(); it != ctrl_vertex_frame_map.end(); ++it) {
-      if(it->ctrl_vertices_group.empty()) { 
-        active_group = it;
-        return;
-      }
-    }
-
-    // No empty group of control vertices
-    qglviewer::ManipulatedFrame* new_frame = new qglviewer::ManipulatedFrame();
-    new_frame->setRotationSensitivity(2.0f);
-
-    Control_vertices_data hgd(deform_mesh, new_frame);
-    ctrl_vertex_frame_map.push_back(hgd);
-    hgd.refresh();
-
-    active_group = --ctrl_vertex_frame_map.end();
-
-    invalidateOpenGLBuffers();
-    Q_EMIT itemChanged();
-
-    print_message("A new empty group of control vertices is created.");
-  }
-
-  void delete_ctrl_vertices_group(bool create_new = true)
-  {
-    if(!is_there_any_ctrl_vertices_group()) { 
-      print_message("There is no group of control vertices to be deleted!");
-      return; 
-    } // no group of control vertices
-
-    // delete group representative    
-    for(Ctrl_vertices_group_data_list::iterator it = ctrl_vertex_frame_map.begin(); it != ctrl_vertex_frame_map.end(); ++it)
-    {
-      if(it == active_group)
-      {
-        delete it->frame;        
-        for(std::vector<vertex_descriptor>::iterator v_it = it->ctrl_vertices_group.begin(); v_it != it->ctrl_vertices_group.end(); ++v_it) {
-          deform_mesh->erase_control_vertex(*v_it);
-        }
-        ctrl_vertex_frame_map.erase(it);
-        break;
-      }
-    }
-
-    // assign another ctrl_vertices_group to active_group
-    Ctrl_vertices_group_data_list::iterator hgb, hge;
-    if( is_there_any_ctrl_vertices_group(hgb, hge) )
-    { 
-      active_group = hgb; 
-    } // no group of control vertices
-    else if(create_new)
-    { 
-      create_ctrl_vertices_group(); 
-    }
-  }
-
-  void prev_ctrl_vertices_group()
-  {
-    Ctrl_vertices_group_data_list::iterator hgb, hge;
-    if( !is_there_any_ctrl_vertices_group(hgb, hge) ) {
-      print_message("There is no group of control vertices to iterate on!");
-      return; 
-    }
-    // shift
-    if(hgb == active_group) { active_group = --hge; }
-    else                    {--active_group; }    
-  }
-
-  void next_ctrl_vertices_group()
-  {
-    Ctrl_vertices_group_data_list::iterator hgb, hge;
-    if( !is_there_any_ctrl_vertices_group(hgb, hge) ) {
-      print_message("There is no group of control vertices to iterate on!");
-      return; 
-    }
-    // shift
-    if(--hge == active_group) { active_group = hgb; }
-    else                      {++active_group; }    
-  }
-
-  void pivoting_end()
-  {       
-    for(Ctrl_vertices_group_data_list::iterator it = ctrl_vertex_frame_map.begin(); it != ctrl_vertex_frame_map.end(); ++it)
-    {
-      //update constraint rotation vector, set only for the last group
-      it->rot_direction = it->frame->rotation().rotate( qglviewer::Vec(0.,0.,1.) );
-      //translate center of the frame
-      qglviewer::Vec vec= it->frame->position();
-      it->refresh();
-      it->frame_initial_center = vec;
-      it->frame->setPosition(vec);
-    }
-    for(Ctrl_vertices_group_data_list::iterator it = ctrl_vertex_frame_map.begin(); it != ctrl_vertex_frame_map.end(); ++it)
-    {
-      it->frame->blockSignals(false);
-    }
-  }
-
-  void pivoting_begin()
-  {
-    is_rot_free=true;
-    rot_constraint.setRotationConstraintType(qglviewer::AxisPlaneConstraint::FREE);
-    rot_constraint.setTranslationConstraintType(qglviewer::AxisPlaneConstraint::FREE);
-
-    // just block signals to prevent deformation
-    for(Ctrl_vertices_group_data_list::iterator it = ctrl_vertex_frame_map.begin(); it != ctrl_vertex_frame_map.end(); ++it)
-    {
-      it->frame->blockSignals(true);
-    }
-  }
-
-  void save_roi(const char* file_name) const
-  { 
-    std::ofstream out(file_name);
-    // save roi
-    out << deform_mesh->roi_vertices().size() << std::endl;
-    BOOST_FOREACH(vertex_descriptor vd, deform_mesh->roi_vertices())
-    {
-      out << vd->id() << " ";
-    }
-    out << std::endl;
-    // save control vertices
-    
-    out << ctrl_vertex_frame_map.size() << std::endl; // control vertices count
-    for(Ctrl_vertices_group_data_list::const_iterator hgb = ctrl_vertex_frame_map.begin(); hgb != ctrl_vertex_frame_map.end(); ++hgb) {
-
-      out << hgb->ctrl_vertices_group.size() << std::endl;
-      for(std::vector<vertex_descriptor>::const_iterator hb = hgb->ctrl_vertices_group.begin(); hb != hgb->ctrl_vertices_group.end(); ++hb) 
-      {
-        out << (*hb)->id() << " ";
-      }
-      out << std::endl;
-    }
-  }
-
-  void read_roi(const char* file_name)
-  { 
-    clear_roi();
-    delete_ctrl_vertices_group(false);
-
-    // put vertices to vector
-    std::vector<vertex_descriptor> all_vertices;
-    all_vertices.reserve(num_vertices(deform_mesh->halfedge_graph()));
-    vertex_iterator vb, ve;
-    for(boost::tie(vb, ve) = vertices(deform_mesh->halfedge_graph()); vb != ve; ++vb) {
-      all_vertices.push_back(*vb);
-    }
-    // read roi
-    std::ifstream in(file_name);
-    int roi_size;
-    in >> roi_size;
-    while(roi_size-- > 0)
-    {
-      std::size_t v_id;
-      in >> v_id;
-      insert_roi_vertex(all_vertices[v_id]);
-    }
-    // read control vertices
-    int ctrl_vertices_group_size;
-    in >> ctrl_vertices_group_size;
-    while(ctrl_vertices_group_size-- > 0)
-    {
-      create_ctrl_vertices_group();
-      int ctrl_size;
-      in >> ctrl_size;      
-      while(ctrl_size-- > 0) 
-      {                    
-        std::size_t v_id;
-        in >> v_id;
-        insert_control_vertex(all_vertices[v_id]);
-      }
-    }
-  }
-
-  void overwrite_deform_object()
-  {
-    deform_mesh->overwrite_initial_geometry();
-
-    refresh_all_group_centers();
-  }
-
-  void reset_deform_object()
-  {
-    deform_mesh->reset();
-    refresh_all_group_centers();
-  }
-
-  struct Is_selected {
-    Deform_mesh* dm;
-    Is_selected(Deform_mesh* dm) : dm(dm) {}
-    bool count(Vertex_handle vh) const {
-      return dm->is_roi_vertex(vh);
-    }
-  };
-
-  boost::optional<std::size_t> get_minimum_isolated_component() {
-    Travel_isolated_components::Minimum_visitor visitor;
-    Travel_isolated_components().travel<Vertex_handle>
-      (vertices(*polyhedron()).first, vertices(*polyhedron()).second, 
-       polyhedron()->size_of_vertices(), Is_selected(deform_mesh), visitor);
-    return visitor.minimum;
-  }
-
-  struct Select_roi_output {
-    Select_roi_output(Deform_mesh* dm) : dm(dm) { }
-    void operator()(Vertex_handle vh) {
-      dm->insert_roi_vertex(vh);
-    }
-    Deform_mesh* dm;
-  };
-
-  boost::optional<std::size_t> select_isolated_components(std::size_t threshold) {
-    typedef boost::function_output_iterator<Select_roi_output> Output_iterator;
-    Output_iterator out(deform_mesh);
-
-    Travel_isolated_components::Selection_visitor<Output_iterator> visitor(threshold, out);
-    Travel_isolated_components().travel<Vertex_handle>
-      (vertices(*polyhedron()).first, vertices(*polyhedron()).second,
-      polyhedron()->size_of_vertices(), Is_selected(deform_mesh), visitor);
-
-    if(visitor.any_inserted) { invalidateOpenGLBuffers(); Q_EMIT itemChanged(); }
-    return visitor.minimum_visitor.minimum;
-  }
-protected:
-  // Deformation related functions //
-  void print_message(const QString& /*message*/)
-  {
-    // std::cout << message.toStdString() << std::endl;
-  }
-
-  bool is_there_any_ctrl_vertices_group(Ctrl_vertices_group_data_list::iterator& hgb, Ctrl_vertices_group_data_list::iterator& hge)
-  {
-    hgb = ctrl_vertex_frame_map.begin(); hge = ctrl_vertex_frame_map.end();
-    return hgb != hge;
-  }
-
-  bool is_there_any_ctrl_vertices_group()
-  {
-    Ctrl_vertices_group_data_list::iterator hgb, hge;
-    return is_there_any_ctrl_vertices_group(hgb, hge);
-  }
-
-  bool is_there_any_ctrl_vertices()
-  {
-    Ctrl_vertices_group_data_list::iterator hgb, hge;
-    if(!is_there_any_ctrl_vertices_group(hgb, hge)) { return false; } // there isn't any group of control vertices
-
-    for(; hgb != hge; ++hgb) // check inside groups of control vertices
-    {
-      if(!hgb->ctrl_vertices_group.empty()) { return true; }
-    }
-    return false;
-  }
-
-  void refresh_all_group_centers()
-  {
-    for(Ctrl_vertices_group_data_list::iterator it = ctrl_vertex_frame_map.begin(); it != ctrl_vertex_frame_map.end(); ++it)
-    { it->refresh(); }
-  }
-
-  bool activate_closest_manipulated_frame(int x, int y)
-  {
-    if(state.ctrl_pressing && (state.left_button_pressing || state.right_button_pressing) ) 
-    { // user is deforming currently don't change the state 
-      return false;  
-    }
-    if(ctrl_vertex_frame_map.empty()) { return false; }
-
-    rot_constraint.setRotationConstraintType(qglviewer::AxisPlaneConstraint::FREE);
-    rot_constraint.setTranslationConstraintType(qglviewer::AxisPlaneConstraint::FREE);
-
-    QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
-    qglviewer::Camera* camera = viewer->camera();
-
-    if(!state.ctrl_pressing) 
-    {   
-      if(viewer->manipulatedFrame() == NULL) 
-      { return false;}
-      viewer->setManipulatedFrame(NULL);    
-      return true;
-    }
-    
-    // now find closest frame and make it active manipulated frame
-    Ctrl_vertices_group_data_list::iterator min_it = ctrl_vertex_frame_map.begin();    
-    const qglviewer::Vec& pos_it = camera->projectedCoordinatesOf(min_it->frame->position());
-    float min_dist = std::pow(pos_it.x - x, 2) + std::pow(pos_it.y - y, 2);
-
-    for(Ctrl_vertices_group_data_list::iterator it = ctrl_vertex_frame_map.begin(); it != ctrl_vertex_frame_map.end(); ++it)
-    {
-      const qglviewer::Vec& pos_it = camera->projectedCoordinatesOf(it->frame->position());
-      float dist = std::pow(pos_it.x - x, 2) + std::pow(pos_it.y - y, 2);
-      if(dist < min_dist) {
-        min_dist = dist;
-        min_it = it;
-      }
-    }
-
-    //set rotation constraint for the manipulated frame
-    if (!is_rot_free){
-      rot_constraint.setRotationConstraintDirection(min_it->rot_direction);
-      rot_constraint.setRotationConstraintType(qglviewer::AxisPlaneConstraint::AXIS);
-      min_it->frame->setConstraint(&rot_constraint);
-    }
-    else
-    {
-      if( ui_widget->ActivateFixedPlaneCheckBox->isChecked())
-      {
-        // the constraint is local to the frame
-        rot_constraint.setTranslationConstraint(qglviewer::AxisPlaneConstraint::PLANE,qglviewer::Vec(0,0,1));
-         if(!ui_widget->ActivatePivotingCheckBox->isChecked()){
-             rot_constraint.setRotationConstraintType(qglviewer::AxisPlaneConstraint::FORBIDDEN);
-         }
-         min_it->frame->setConstraint(&rot_constraint);
-      }
-    }
-
-    if(viewer->manipulatedFrame() == min_it->frame)
-    { return false; }
-    viewer->setManipulatedFrame(min_it->frame);
-
-    return true;
-  }
-
-  bool keyPressEvent(QKeyEvent* e);
-
-  void update_normals() {
-    BOOST_FOREACH(vertex_descriptor vd, deform_mesh->roi_vertices())
-    {
-      std::size_t id = vd->id();
-      const Polyhedron::Traits::Vector_3& n = 
-        CGAL::Polygon_mesh_processing::compute_vertex_normal(vd, deform_mesh->halfedge_graph());
-      normals[id*3] = n.x();
-      normals[id*3+1] = n.y(); 
-      normals[id*3+2] = n.z(); 
-
-    }
-  }
-
-  double scene_diag() const {
-    const double& xdelta = bbox().xmax - bbox().xmin;
-    const double& ydelta = bbox().ymax - bbox().ymin;
-    const double& zdelta = bbox().zmax - bbox().zmin;
-    const double diag = std::sqrt(xdelta*xdelta +
-      ydelta*ydelta +
-      zdelta*zdelta);
-    return diag * 0.5;
-  }
-
-}; // end class Scene_edit_polyhedron_item
-
-#endif // SCENE_EDIT_POLYHEDRON_ITEM_H
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Polyhedron_3.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Polyhedron_3.cpp
deleted file mode 100644
index f156757..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Polyhedron_3.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-#include "Polyhedron_demo.h"
-
-/*!
- * \brief Defines the entry point of the demo.
- * Creates the application and sets a main window.
- */
-int main(int argc, char **argv)
-{
-  Polyhedron_demo app(argc, argv,
-                      "Polyhedron_3 demo",
-                      "CGAL Polyhedron Demo");
-  return app.try_exec();
-}
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Polyhedron_3.qrc b/3rdparty/CGAL-4.8/demo/Polyhedron/Polyhedron_3.qrc
deleted file mode 100644
index 3b30902..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Polyhedron_3.qrc
+++ /dev/null
@@ -1,42 +0,0 @@
-<RCC>
-    <qresource prefix="/cgal/icons">
-        <file>resources/cgal_logo.xpm</file>
-        <file>resources/boolean-union.png</file>
-        <file>resources/kernel.png</file>
-        <file>resources/boolean-diff.png</file>
-        <file>resources/boolean-intersection.png</file>
-        <file alias="convex-hull.png">resources/convex-hull.png</file>
-        <file alias="simplification.png">resources/simplification.png</file>
-        <file alias="duplicate">resources/editcopy.png</file>
-        <file alias="check-on.png">resources/check-on.png</file>
-        <file alias="plus">resources/plus.png</file>
-        <file alias="check-off.png">resources/check-off.png</file>
-        <file alias="minus">resources/minus.png</file>
-        <file>resources/back.png</file>
-        <file>resources/front.png</file>
-        <file>resources/top.png</file>
-        <file>resources/bot.png</file>
-        <file>resources/left.png</file>
-        <file>resources/right.png</file>
-        <file>resources/up.png</file>
-        <file>resources/down.png</file>
-    </qresource>
-    <qresource prefix="/cgal/Polyhedron_3">
-        <file alias="about.html">resources/about.html</file>
-        <file>resources/shader_c3t3.v</file>
-        <file>resources/shader_with_light.v</file>
-        <file>resources/shader_with_light.f</file>
-        <file>resources/shader_without_light.f</file>
-        <file>resources/shader_without_light.v</file>
-        <file>resources/shader_with_texture.f</file>
-        <file>resources/shader_with_textured_edges.f</file>
-        <file>resources/shader_with_textured_edges.v</file>
-        <file>resources/shader_with_texture.v</file>
-        <file>resources/shader_instanced.v</file>
-        <file>resources/shader_no_light_no_selection.f</file>
-        <file>resources/shader_c3t3_edges.f</file>
-        <file>resources/shader_c3t3.f</file>
-        <file>resources/shader_c3t3_edges.v</file>
-        <file>resources/shader_plane_two_faces.f</file>
-    </qresource>
-</RCC>
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Polyhedron_demo.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Polyhedron_demo.cpp
deleted file mode 100644
index f15f6bd..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Polyhedron_demo.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-#include "Polyhedron_demo.h"
-#include "MainWindow.h"
-#include <QMessageBox>
-#include <CGAL/Qt/resources.h>
-#include <stdexcept>
-
-#include <QCommandLineParser>
-#include <QCommandLineOption>
-
-struct Polyhedron_demo_impl {
-  bool catch_exceptions;
-  QScopedPointer<MainWindow> mainWindow;
-
-  Polyhedron_demo_impl() : catch_exceptions(true) {}
-}; // end struct Polyhedron_demo_impl
-
-Polyhedron_demo::Polyhedron_demo(int& argc, char **argv,
-                                 QString application_name,
-                                 QString main_window_title)
-  : QApplication(argc, argv)
-  , d_ptr_is_initialized(false)
-  , d_ptr(new Polyhedron_demo_impl)
-{
-  d_ptr_is_initialized = true;
-  std::cerr.precision(17);
-  std::cout.precision(17);
-  std::clog.precision(17);
-
-  //for windows
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 3, 0))
-  this->setAttribute(Qt::AA_UseDesktopOpenGL);
-#endif
-
-  // Import resources from libCGAL (Qt5).
-  CGAL_QT_INIT_RESOURCES;
-
-  this->setOrganizationDomain("geometryfactory.com");
-  this->setOrganizationName("GeometryFactory");
-  this->setApplicationName(application_name);
-
-  QCommandLineParser parser;
-  parser.addHelpOption();
-
-  QCommandLineOption use_meta("use-meta",
-                              tr("Use the [Meta] key to move frames, instead of [Tab]."));
-  parser.addOption(use_meta);
-  QCommandLineOption no_try_catch("no-try-catch",
-                                  tr("Do not catch uncaught exceptions."));
-  parser.addOption(no_try_catch);
-#ifdef QT_SCRIPT_LIB
-  QCommandLineOption debug_scripts("debug-scripts",
-                                   tr("Use the scripts debugger."));
-  parser.addOption(debug_scripts);
-#endif
-  QCommandLineOption no_autostart("no-autostart",
-                                  tr("Ignore the autostart.js file, if any."));
-  parser.addOption(no_autostart);
-  parser.addPositionalArgument("files", tr("Files to open"), "[files...]");
-  parser.process(*this);
-
-  d_ptr->mainWindow.reset(new MainWindow);
-  MainWindow& mainWindow = *d_ptr->mainWindow;
-
-  mainWindow.setWindowTitle(main_window_title);
-  mainWindow.show();
-
-  if(parser.isSet(use_meta)) {
-    mainWindow.setAddKeyFrameKeyboardModifiers(::Qt::MetaModifier);
-  }
-  if(parser.isSet(no_try_catch)) {
-    this->do_not_catch_exceptions();
-  }
-#ifdef QT_SCRIPT_LIB
-  if(parser.isSet(debug_scripts)) {
-    mainWindow.enableScriptDebugger();
-  }
-  QFileInfo autostart_js("autostart.js");
-  if(!parser.isSet(no_autostart) && autostart_js.exists()) {
-    mainWindow.load_script(autostart_js);
-  }
-#endif
-  Q_FOREACH(QString filename, parser.positionalArguments()) {
-    mainWindow.open(filename);
-  }
-
-}
-
-Polyhedron_demo::~Polyhedron_demo() {}
-
-void Polyhedron_demo::do_not_catch_exceptions() {
-  d_ptr->catch_exceptions = false;
-}
-
-bool Polyhedron_demo::notify(QObject* receiver, QEvent* event)
-{
-  if(!d_ptr_is_initialized || !d_ptr->catch_exceptions)
-    return QApplication::notify(receiver, event);
-  else try {
-      return QApplication::notify(receiver, event);
-    } catch (std::exception &e) {
-      // find the mainwindow to spawn an error message
-      Q_FOREACH (QWidget *widget, QApplication::topLevelWidgets()) {
-        if(MainWindow* mw = qobject_cast<MainWindow*>(widget)) {
-          QMessageBox::critical(
-                                mw,
-                                tr("Unhandled exception"),
-                                e.what());
-          break;
-        }
-      }
-      QApplication::restoreOverrideCursor();
-    } catch (...) {
-      qFatal("Unknown exception encountered. Aborting.");
-    }
-  return false;
-}
-
-int Polyhedron_demo::try_exec()
-{
-  // A Qt Script may have closed the main window.
-  // The following loop launch app.exec() only if the main window is visible.
-  if(d_ptr->mainWindow->isVisible()) {
-    return this->exec();
-  }
-  return 0;
-}
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Polyhedron_demo_plugin_helper.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Polyhedron_demo_plugin_helper.cpp
deleted file mode 100644
index ff8eae8..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Polyhedron_demo_plugin_helper.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-#include <QMainWindow>
-#include <QAction>
-#include <QMetaObject>
-#include <QMetaMethod>
-#include <QtDebug>
-#include <QVector>
-#include <QSet>
-#include <QDockWidget>
-
-using namespace CGAL::Three;
-QAction*
-Polyhedron_demo_plugin_helper::
-getActionFromMainWindow(QMainWindow* mw,
-                        QString action_name)
-{
-  return mw->findChild<QAction*>(action_name);
-}
-
-QStringList 
-Polyhedron_demo_plugin_helper::actionsNames() const
-{
-  return QStringList();
-}
-
-void
-Polyhedron_demo_plugin_helper::
-init(QMainWindow* mainWindow, Scene_interface* scene_interface) {
-  mw = mainWindow;
-  scene = scene_interface;
-  Q_FOREACH(QString actionName,actionsNames())
-  {
-    actions_map[actionName] = getActionFromMainWindow(mw, actionName);
-  }
-  autoConnectActions();
-}
-
-QList<QAction*> 
-Polyhedron_demo_plugin_helper::actions() const
-{
-  return actions_map.values();
-}
-
-// Auto-connect actions to slots
-void Polyhedron_demo_plugin_helper::autoConnectActions()
-{
-  QObject* thisObject = dynamic_cast<QObject*>(this);
-  if(!thisObject)
-    return;
-
-  const QMetaObject* metaObject = thisObject->metaObject();
-  QVector<QMetaMethod> methods;
-  QVector<QString> methodsNames;
-  QSet<QString> connected;
-  for(int i = metaObject->methodOffset();
-      i < metaObject->methodCount();
-      ++i)
-  {
-    const int pos = QString(metaObject->method(i).methodSignature()).indexOf('(');
-    methodsNames << QString(metaObject->method(i).methodSignature()).left(pos);
-
-    methods << metaObject->method(i);
-  }
-
-  Q_FOREACH(QAction* action, actions())
-  {
-    bool success = false;
-//     qDebug("Autoconnecting action \"%s\"...", 
-//            action->objectName().toUtf8().data());
-    const QMetaObject* action_metaObject = action->metaObject();
-    for(int i = action_metaObject->methodOffset();
-        i < action_metaObject->methodCount(); ++i)
-    {
-      QMetaMethod action_method = action_metaObject->method(i);
-        
-      if(action_method.methodType() == QMetaMethod::Signal)
-      {
-        const int pos = QString(action_method.methodSignature()).indexOf('(');
-        QString methodName = QString(action_method.methodSignature()).left(pos);
-
-        QString slotName = 
-          QString("on_%1_%2").arg(action->objectName()).arg(methodName);
-//         qDebug() << thisObject->tr("Slot %1 (%2)...").arg(slotName).arg(i);
-        int index = methodsNames.indexOf(slotName);
-        if(index>=0 && !connected.contains(slotName)) 
-        {
-            const bool ok = QObject::connect(action, 
-                             qPrintable(QString("2%1").arg(QString(action_method.methodSignature()))),
-                             thisObject,
-                             qPrintable(QString("1%1").arg(QString(methods[index].methodSignature()))));
-
-          if(!ok)
-          {
-            qDebug() << thisObject->tr("Cannot connect method %1.%2 to slot %3!")
-              .arg(action->objectName())
-              .arg(QString(action_method.methodSignature()))
-              .arg(QString(methods[index].methodSignature()));
-          }
-          else {
-//             qDebug("  ->Connected!");
-            success = true;
-            connected << slotName;
-          }
-        }
-//         else {
-//           qDebug(" nothing found!\n");
-//         }
-      }
-    } // end for each method of action
-    if(!success)
-      qDebug("ERROR: Failed to autoconnect the action \"%s\"!",
-             action->objectName().toUtf8().data());
-  } // end foreach action of actions()
-}
-
-void Polyhedron_demo_plugin_helper::add_dock_widget(QDockWidget* dock_widget) 
-{
-  mw->addDockWidget(::Qt::LeftDockWidgetArea, dock_widget);
-
-  QList<QDockWidget*> dockWidgets = mw->findChildren<QDockWidget*>();
-  int counter = 0;
-  Q_FOREACH(QDockWidget* dock, dockWidgets) {
-    if( mw->dockWidgetArea(dock) != ::Qt::LeftDockWidgetArea ||
-        dock == dock_widget ) 
-    { continue; }
-
-    if(++counter > 1) {
-      mw->tabifyDockWidget(dock, dock_widget);
-      return;
-    }
-  }
-}
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Preferences.ui b/3rdparty/CGAL-4.8/demo/Polyhedron/Preferences.ui
deleted file mode 100644
index 446b5e9..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Preferences.ui
+++ /dev/null
@@ -1,78 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>PreferencesDialog</class>
- <widget class="QDialog" name="PreferencesDialog">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>377</width>
-    <height>503</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Dialog</string>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout">
-   <item>
-    <widget class="QLabel" name="label">
-     <property name="text">
-      <string>Tick plugins you don't want to load at start up</string>
-     </property>
-    </widget>
-   </item>
-   <item>
-    <widget class="QListView" name="listView">
-     <property name="selectionMode">
-      <enum>QAbstractItemView::NoSelection</enum>
-     </property>
-    </widget>
-   </item>
-   <item>
-    <widget class="QDialogButtonBox" name="buttonBox">
-     <property name="orientation">
-      <enum>Qt::Horizontal</enum>
-     </property>
-     <property name="standardButtons">
-      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
-     </property>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <resources/>
- <connections>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>accepted()</signal>
-   <receiver>PreferencesDialog</receiver>
-   <slot>accept()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>248</x>
-     <y>254</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>157</x>
-     <y>274</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>rejected()</signal>
-   <receiver>PreferencesDialog</receiver>
-   <slot>reject()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>316</x>
-     <y>260</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>286</x>
-     <y>274</y>
-    </hint>
-   </hints>
-  </connection>
- </connections>
-</ui>
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Scene.cpp
deleted file mode 100644
index 6fdd9ea..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene.cpp
+++ /dev/null
@@ -1,1251 +0,0 @@
-#include "GlSplat/GlSplat.h"
-
-
-
-#include "config.h"
-#include "Scene.h"
-#include  <CGAL/Three/Scene_item.h>
-
-#include <QObject>
-#include <QMetaObject>
-#include <QString>
-#include <QGLWidget>
-#include <QEvent>
-#include <QMouseEvent>
-#include <QPainter>
-#include <QColorDialog>
-#include <QApplication>
-#include <QPointer>
-#include <QList>
-#include <QAbstractProxyModel>
-#include <QMimeData>
-
-GlSplat::SplatRenderer* Scene::ms_splatting = 0;
-int Scene::ms_splattingCounter = 0;
-GlSplat::SplatRenderer* Scene::splatting()
-{
-    assert(ms_splatting!=0 && "A Scene object must be created before requesting the splatting object");
-    return ms_splatting;
-}
-
-Scene::Scene(QObject* parent)
-    : QStandardItemModel(parent),
-      selected_item(-1),
-      item_A(-1),
-      item_B(-1)
-{
-
-    connect(this, SIGNAL(selectionRay(double, double, double,
-                                      double, double, double)),
-            this, SLOT(setSelectionRay(double, double, double,
-                                       double, double, double)));
-
-    if(ms_splatting==0)
-        ms_splatting  = new GlSplat::SplatRenderer();
-    ms_splattingCounter++;
-    picked = false;
-    gl_init = false;
-
-}
-Scene::Item_id
-Scene::addItem(CGAL::Three::Scene_item* item)
-{
-    CGAL::Three::Scene_group_item* group =
-            qobject_cast<CGAL::Three::Scene_group_item*>(item);
-    if(group)
-        m_group_entries.prepend(group);
-    Bbox bbox_before = bbox();
-    m_entries.push_back(item);
-    connect(item, SIGNAL(itemChanged()),
-            this, SLOT(itemChanged()));
-    connect(item, SIGNAL(redraw()),
-            this, SLOT(callDraw()));
-    if(item->isFinite()
-            && !item->isEmpty()
-            && bbox_before + item->bbox() != bbox_before
-            )
-    {
-        Q_EMIT updated_bbox();
-    }
-    QList<QStandardItem*> list;
-    for(int i=0; i<5; i++)
-    {
-        list<<new QStandardItem();
-        list.at(i)->setEditable(false);
-    }
-    invisibleRootItem()->appendRow(list);
-    for(int i=0; i<5; i++){
-        index_map[list.at(i)->index()] = m_entries.size() -1;
-    }
-    Q_EMIT updated();
-    Item_id id = m_entries.size() - 1;
-    Q_EMIT newItem(id);
-    //if group selected, add item to it
-    if(mainSelectionIndex() >=0)
-    {
-        //if new item is a group, don't do that, to avoid any ambiguity
-        if(!group)
-        {
-            CGAL::Three::Scene_group_item* selected_group =
-                    qobject_cast<CGAL::Three::Scene_group_item*>(m_entries.at(mainSelectionIndex()));
-            if(selected_group)
-            {
-                selected_group->addChild(item);
-                group_added();
-            }
-        }
-    }
-    return id;
-}
-
-CGAL::Three::Scene_item*
-Scene::replaceItem(Scene::Item_id index, CGAL::Three::Scene_item* item, bool emit_item_about_to_be_destroyed)
-{
-    if(index < 0 || index >= m_entries.size())
-        return 0;
-
-    if(emit_item_about_to_be_destroyed) {
-    Q_EMIT itemAboutToBeDestroyed(m_entries[index]);
-    }
-
-    connect(item, SIGNAL(itemChanged()),
-            this, SLOT(itemChanged()));
-    std::swap(m_entries[index], item);
-    if ( item->isFinite() && !item->isEmpty() &&
-         m_entries[index]->isFinite() && !m_entries[index]->isEmpty() &&
-         item->bbox()!=m_entries[index]->bbox() )
-    {
-    Q_EMIT updated_bbox();
-    }
-  Q_EMIT updated();
-    itemChanged(index);
-    Q_EMIT restoreCollapsedState();
-    group_added();
-    return item;
-}
-
-Scene::Item_id
-Scene::erase(Scene::Item_id index)
-{
-    clear();
-    index_map.clear();
-    if(index < 0 || index >= m_entries.size())
-        return -1;
-
-    CGAL::Three::Scene_item* item = m_entries[index];
-    CGAL::Three::Scene_group_item* group =
-            qobject_cast<CGAL::Three::Scene_group_item*>(item);
-  if(group)
-  {
-      m_group_entries.removeAll(group);
-  }
-    Q_FOREACH(CGAL::Three::Scene_group_item* group, m_group_entries)
-    {
-        if(group->getChildren().contains(item))
-            group->removeChild(item);
-    }
-  Q_EMIT itemAboutToBeDestroyed(item);
-    delete item;
-    m_entries.removeAll(item);
-    selected_item = -1;
-    Q_FOREACH(Scene_item* item, m_entries)
-    {
-        organize_items(item, invisibleRootItem(), 0);
-    }
-    QStandardItemModel::beginResetModel();
-    Q_EMIT updated();
-    QStandardItemModel::endResetModel();
-    Q_EMIT restoreCollapsedState();
-    if(--index >= 0)
-      return index;
-    if(!m_entries.isEmpty())
-      return 0;
-    return -1;
-
-}
-
-int
-Scene::erase(QList<int> indices)
-{
-  QList<CGAL::Three::Scene_item*> to_be_removed;
-  int max_index = -1;
-  Q_FOREACH(int index, indices) {
-    if(index < 0 || index >= m_entries.size())
-      continue;
-
-    max_index = (std::max)(max_index, index);
-    CGAL::Three::Scene_item* item = m_entries[index];
-    if(!to_be_removed.contains(item))
-      to_be_removed.push_back(item);
-  }
-
-  Q_FOREACH(Scene_item* item, to_be_removed) {
-    CGAL::Three::Scene_group_item* group =
-        qobject_cast<CGAL::Three::Scene_group_item*>(item);
-    if(group)
-    {
-      m_group_entries.removeAll(group);
-    }
-    Q_FOREACH(CGAL::Three::Scene_group_item* group_item, m_group_entries)
-      if(group_item->getChildren().contains(item))
-        group_item->removeChild(item);
-    Q_EMIT itemAboutToBeDestroyed(item);
-    delete item;
-    m_entries.removeAll(item);
-  }
-  clear();
-  index_map.clear();
-  selected_item = -1;
-  Q_FOREACH(Scene_item* item, m_entries)
-  {
-    organize_items(item, invisibleRootItem(), 0);
-  }
-  QStandardItemModel::beginResetModel();
-  Q_EMIT updated();
-  QStandardItemModel::endResetModel();
-  Q_EMIT restoreCollapsedState();
-
-  int index = max_index + 1 - indices.size();
-  if(index >= m_entries.size()) {
-    index = m_entries.size() - 1;
-  }
-  if(index >= 0)
-    return index;
-  if(!m_entries.isEmpty())
-    return 0;
-  return -1;
-
-}
-
-void Scene::remove_item_from_groups(Scene_item* item)
-{
-    Q_FOREACH(CGAL::Three::Scene_group_item* group, m_group_entries)
-    {
-        if(group->getChildren().contains(item))
-        {
-            group->removeChild(item);
-        }
-    }
-}
-Scene::~Scene()
-{
-    Q_FOREACH(CGAL::Three::Scene_item* item_ptr, m_entries)
-    {
-        delete item_ptr;
-    }
-    m_entries.clear();
-
-    if((--ms_splattingCounter)==0)
-        delete ms_splatting;
-}
-
-CGAL::Three::Scene_item*
-Scene::item(Item_id index) const
-{
-    return m_entries.value(index); // QList::value checks bounds
-}
-
-Scene::Item_id 
-Scene::item_id(CGAL::Three::Scene_item* scene_item) const
-{
-    return m_entries.indexOf(scene_item);
-}
-
-int
-Scene::numberOfEntries() const
-{
-    return m_entries.size();
-}
-
-// Duplicate a scene item.
-// Return the ID of the new item (-1 on error).
-Scene::Item_id
-Scene::duplicate(Item_id index)
-{
-    if(index < 0 || index >= m_entries.size())
-        return -1;
-
-    const CGAL::Three::Scene_item* item = m_entries[index];
-    CGAL::Three::Scene_item* new_item = item->clone();
-    if(new_item) {
-        new_item->setName(tr("%1 (copy)").arg(item->name()));
-        new_item->setColor(item->color());
-        new_item->setVisible(item->visible());
-        addItem(new_item);
-        return m_entries.size() - 1;
-    }
-    else
-        return -1;
-}
-
-void Scene::initializeGL()
-{
-    ms_splatting->init();
-
-    //Setting the light options
-
-    // Create light components
-    GLfloat ambientLight[] = { 0.4f, 0.4f, 0.4f, 1.0f };
-    GLfloat diffuseLight[] = { 1.0f, 1.0f, 1.0, 1.0f };
-    GLfloat specularLight[] = { 0.0f, 0.0f, 0.0f, 1.0f };
-    GLfloat position[] = { 0.0f, 0.0f, 1.0f, 1.0f };
-
-    // Assign created components to GL_LIGHT0
-    glLightfv(GL_LIGHT0, GL_AMBIENT, ambientLight);
-    glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuseLight);
-    glLightfv(GL_LIGHT0, GL_SPECULAR, specularLight);
-    glLightfv(GL_LIGHT0, GL_POSITION, position);
-
-    gl_init = true;
-}
-
-bool
-Scene::keyPressEvent(QKeyEvent* e){
-    bool res=false;
-    for (QList<int>::iterator it=selected_items_list.begin(),endit=selected_items_list.end();
-         it!=endit;++it)
-    {
-        CGAL::Three::Scene_item* item=m_entries[*it];
-        res |= item->keyPressEvent(e);
-    }
-    return res;
-}
-
-void
-Scene::draw()
-{
-    draw_aux(false, 0);
-}
-void
-Scene::draw(CGAL::Three::Viewer_interface* viewer)
-{
-    draw_aux(false, viewer);
-}
-void
-Scene::drawWithNames()
-{
-    draw_aux(true, 0);
-}
-void
-Scene::drawWithNames(CGAL::Three::Viewer_interface* viewer)
-{
-    draw_aux(true, viewer);
-}
-
-void 
-Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer)
-{
-    if(!ms_splatting->viewer_is_set)
-        ms_splatting->setViewer(viewer);
-    if(!gl_init)
-        initializeGL();
-    // Flat/Gouraud OpenGL drawing
-    for(int index = 0; index < m_entries.size(); ++index)
-    {
-        if(with_names) {
-            viewer->glPushName(index);
-        }
-        CGAL::Three::Scene_item& item = *m_entries[index];
-        if(item.visible())
-        {
-            if(item.renderingMode() == Flat || item.renderingMode() == FlatPlusEdges || item.renderingMode() == Gouraud)
-            {
-                viewer->glEnable(GL_LIGHTING);
-                viewer->glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
-                viewer->glPointSize(2.f);
-                viewer->glLineWidth(1.0f);
-                if(index == selected_item || selected_items_list.contains(index))
-                {
-                    item.selection_changed(true);
-                }
-                else
-
-                {
-                    item.selection_changed(false);
-                }
-
-                if(item.renderingMode() == Gouraud)
-                    viewer->glShadeModel(GL_SMOOTH);
-                else
-                    viewer->glShadeModel(GL_FLAT);
-                if(viewer)
-                    item.draw(viewer);
-                else
-                    item.draw();
-            }
-        }
-        if(with_names) {
-            viewer->glPopName();
-        }
-    }
-glDepthFunc(GL_LEQUAL);
-    // Wireframe OpenGL drawing
-    for(int index = 0; index < m_entries.size(); ++index)
-    {
-        if(with_names) {
-            viewer->glPushName(index);
-        }
-        CGAL::Three::Scene_item& item = *m_entries[index];
-        if(item.visible())
-        {
-            if(item.renderingMode() == FlatPlusEdges || item.renderingMode() == Wireframe)
-            {
-                viewer->glDisable(GL_LIGHTING);
-                viewer->glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
-                viewer->glPointSize(2.f);
-                viewer->glLineWidth(1.0f);
-                if(index == selected_item || selected_items_list.contains(index))
-                {
-                      item.selection_changed(true);
-                }
-                else
-                {
-                      item.selection_changed(false);
-                }
-
-
-
-                if(viewer)
-                    item.draw_edges(viewer);
-                else
-                    item.draw_edges();
-            }
-            else{
-                if( item.renderingMode() == PointsPlusNormals ){
-                    viewer->glDisable(GL_LIGHTING);
-                    viewer->glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
-                    viewer->glPointSize(2.f);
-                    viewer->glLineWidth(1.0f);
-                    if(index == selected_item || selected_items_list.contains(index))
-                    {
-
-                        item.selection_changed(true);
-                    }
-                    else
-                    {
-
-                        item.selection_changed(false);
-                    }
-                    if(viewer)
-                        item.draw_edges(viewer);
-                    else
-                        item.draw_edges();
-                }
-            }
-        }
-        if(with_names) {
-            viewer->glPopName();
-        }
-    }
-
-
-    // Points OpenGL drawing
-    for(int index = 0; index < m_entries.size(); ++index)
-    {
-        if(with_names) {
-            viewer->glPushName(index);
-        }
-        CGAL::Three::Scene_item& item = *m_entries[index];
-        if(item.visible())
-        {
-            if(item.renderingMode() == Points  || item.renderingMode() == PointsPlusNormals)
-            {
-                viewer->glDisable(GL_LIGHTING);
-                viewer->glPolygonMode(GL_FRONT_AND_BACK,GL_POINT);
-                viewer->glPointSize(2.f);
-                viewer->glLineWidth(1.0f);
-
-                if(viewer)
-                    item.draw_points(viewer);
-                else
-                    item.draw_points();
-            }
-        }
-        if(with_names) {
-            viewer->glPopName();
-        }
-    }
-    glDepthFunc(GL_LESS);
-    // Splatting
-    if(!with_names && ms_splatting->isSupported())
-    {
-
-        ms_splatting->beginVisibilityPass();
-        for(int index = 0; index < m_entries.size(); ++index)
-        {
-            CGAL::Three::Scene_item& item = *m_entries[index];
-            if(item.visible() && item.renderingMode() == Splatting)
-            {
-
-                if(viewer)
-                {
-                    item.draw_splats(viewer);
-                }
-                else
-                    item.draw_splats();
-            }
-
-        }
-       ms_splatting->beginAttributePass();
-         for(int index = 0; index < m_entries.size(); ++index)
-        {  CGAL::Three::Scene_item& item = *m_entries[index];
-            if(item.visible() && item.renderingMode() == Splatting)
-            {
-                viewer->glColor4d(item.color().redF(), item.color().greenF(), item.color().blueF(), item.color().alphaF());
-                if(viewer)
-                    item.draw_splats(viewer);
-                else
-                    item.draw_splats();
-            }
-        }
-        ms_splatting->finalize();
-
-    }
-
-    //scrolls the sceneView to the selected item's line.
-    if(picked)
-        Q_EMIT(itemPicked(index_map.key(mainSelectionIndex())));
-    if(with_names)
-        picked = true;
-    else
-        picked = false;
-
-}
-
-// workaround for Qt-4.2 (see above)
-#undef lighter
-QVariant
-Scene::data(const QModelIndex &index, int role) const
-{
-    if (!index.isValid())
-    {
-        return QVariant();
-    }
-
-    int id = index_map[index];
-    if(id < 0 || id >= m_entries.size())
-        return QVariant();
-    if(role == ::Qt::ToolTipRole)
-    {
-        return m_entries[id]->toolTip();
-    }
-    switch(index.column())
-    {
-    case ColorColumn:
-        if(role == ::Qt::DisplayRole || role == ::Qt::EditRole)
-            return m_entries.value(id)->color();
-        else if(role == ::Qt::DecorationRole)
-            return m_entries.value(id)->color();
-        break;
-    case NameColumn:
-        if(role == ::Qt::DisplayRole || role == ::Qt::EditRole)
-            return m_entries.value(id)->name();
-        if(role == ::Qt::FontRole)
-            return m_entries.value(id)->font();
-        break;
-    case RenderingModeColumn:
-        if(role == ::Qt::DisplayRole) {
-            return m_entries.value(id)->renderingModeName();
-        }
-        else if(role == ::Qt::EditRole) {
-            return static_cast<int>(m_entries.value(id)->renderingMode());
-        }
-        else if(role == ::Qt::TextAlignmentRole) {
-            return ::Qt::AlignCenter;
-        }
-        break;
-    case ABColumn:
-        if(role == ::Qt::DisplayRole) {
-            if(id == item_A)
-                return "A";
-            if(id == item_B)
-                return "B";
-        }
-        else if(role == ::Qt::TextAlignmentRole) {
-            return ::Qt::AlignCenter;
-        }
-        break;
-    case VisibleColumn:
-        if(role == ::Qt::DisplayRole || role == ::Qt::EditRole)
-            return m_entries.value(id)->visible();
-        break;
-    default:
-        return QVariant();
-    }
-    return QVariant();
-}
-
-QVariant
-Scene::headerData ( int section, ::Qt::Orientation orientation, int role ) const
-{
-    if(orientation == ::Qt::Horizontal)  {
-        if (role == ::Qt::DisplayRole)
-        {
-            switch(section)
-            {
-            case NameColumn:
-                return tr("Name");
-                break;
-            case ColorColumn:
-                return tr("Color");
-                break;
-            case RenderingModeColumn:
-                return tr("Mode");
-            case ABColumn:
-                return tr("A/B");
-                break;
-            case VisibleColumn:
-                return tr("View");
-                break;
-            default:
-                return QVariant();
-            }
-        }
-        else if(role == ::Qt::ToolTipRole) {
-            if(section == RenderingModeColumn) {
-                return tr("Rendering mode (points/wireframe/flat/flat+edges/Gouraud)");
-            }
-            else if(section == ABColumn) {
-                return tr("Selection A/Selection B");
-            }
-        }
-    }
-    return QStandardItemModel::headerData(section, orientation, role);
-}
-
-Qt::ItemFlags
-Scene::flags ( const QModelIndex & index ) const
-{
-    if (index.isValid() && index.column() == NameColumn) {
-        return QStandardItemModel::flags(index) | ::Qt::ItemIsEditable;
-    }
-    else {
-        return QStandardItemModel::flags(index);
-    }
-}
-
-bool
-Scene::setData(const QModelIndex &index,
-               const QVariant &value,
-               int role)
-{
-
-    if( role != ::Qt::EditRole || !index.isValid() )
-        return false;
-
-    int id = index_map[index];
-    if(id < 0 || id >= m_entries.size()){
-        return false;
-    }
-
-    CGAL::Three::Scene_item* item = m_entries[id];
-
-    if(!item) return false;
-    switch(index.column())
-    {
-    case NameColumn:
-        item->setName(value.toString());
-    Q_EMIT dataChanged(index, index);
-        return true;
-        break;
-    case ColorColumn:
-        item->setColor(value.value<QColor>());
-    Q_EMIT dataChanged(index, index);
-        return true;
-        break;
-    case RenderingModeColumn:
-    {
-        RenderingMode rendering_mode = static_cast<RenderingMode>(value.toInt());
-        // Find next supported rendering mode
-        while ( ! item->supportsRenderingMode(rendering_mode)
-      //          || (rendering_mode==Splatting && !Scene::splatting()->isSupported())
-                )
-        {
-            rendering_mode = static_cast<RenderingMode>( (rendering_mode+1) % NumberOfRenderingMode );
-        }
-        item->setRenderingMode(rendering_mode);
-        QModelIndex nindex = createIndex(m_entries.size()-1,RenderingModeColumn+1);
-    Q_EMIT dataChanged(index, nindex);
-        return true;
-        break;
-    }
-    case VisibleColumn:
-        item->setVisible(value.toBool());
-    Q_EMIT dataChanged(index, createIndex(m_entries.size()-1,VisibleColumn+1));
-        return true;
-    default:
-        return false;
-    }
-    return false;
-}
-
-bool Scene::dropMimeData(const QMimeData * /*data*/,
-                         Qt::DropAction /*action*/,
-                         int /*row*/,
-                         int /*column*/,
-                         const QModelIndex &parent)
-{
-    //gets the moving items
-    QList<Scene_item*> items;
-    QList<int> groups_children;
-
-    //get IDs of all children of selected groups
-    Q_FOREACH(int i, selected_items_list)
-    {
-        CGAL::Three::Scene_group_item* group =
-                qobject_cast<CGAL::Three::Scene_group_item*>(item(i));
-        if(group)
-            Q_FOREACH(Scene_item* child, group->getChildren())
-              groups_children << item_id(child);
-    }
-    // Insure that children of selected groups will not be added twice
-    Q_FOREACH(int i, selected_items_list)
-    {
-        if(!groups_children.contains(i))
-          items << item(i);
-    }
-    //Gets the group at the drop position
-    CGAL::Three::Scene_group_item* group =
-            qobject_cast<CGAL::Three::Scene_group_item*>(this->item(index_map[parent]));
-    bool one_contained = false;
-    if(group)
-    {
-    Q_FOREACH(int id, selected_items_list)
-        if(group->getChildren().contains(item(id)))
-        {
-            one_contained = true;
-            break;
-        }
-    }
-    //if the drop item is not a group_item or if it already contains the item, then the drop action must be ignored
-    if(!group ||one_contained)
-    {
-        //unless the drop zone is empty, which means the item should be removed from all groups.
-        if(!parent.isValid())
-        {
-          Q_FOREACH(Scene_item* item, items)
-            while(item->has_group!=0)
-            {
-              Q_FOREACH(CGAL::Three::Scene_group_item* group_item, m_group_entries)
-                if(group_item->getChildren().contains(item))
-                {
-                  group_item->removeChild(item);
-                  break;
-                }
-            }
-        group_added();
-        return true;
-        }
-        return false;
-    }
-      Q_FOREACH(Scene_item* item, items)
-    changeGroup(item, group);
-    //group->addChild(item(mainSelectionIndex()));
-    group_added();
-    return true;
-
-
-}
-
-void Scene::moveRowUp()
-{
-    Scene_item* selected_item = item(mainSelectionIndex());
-    if(index_map.key(mainSelectionIndex()).row() > 0)
-    {
-        if(item(mainSelectionIndex())->has_group >0)
-        {
-            Q_FOREACH(Scene_group_item* group, m_group_entries)
-                if(group->getChildren().contains(selected_item))
-                {
-                    int id = group->getChildren().indexOf(selected_item);
-                    group->moveUp(id);
-                }
-        }
-        else
-        {
-            //if not in group
-            QModelIndex baseId = index_map.key(mainSelectionIndex());
-            int newId = index_map.value(index(baseId.row()-1, baseId.column(),baseId.parent())) ;
-            m_entries.move(mainSelectionIndex(), newId);
-        }
-        group_added();
-        setSelectedItem(m_entries.indexOf(selected_item));
-    }
-}
-void Scene::moveRowDown()
-{
-    Scene_item* selected_item = item(mainSelectionIndex());
-    if(index_map.key(mainSelectionIndex()).row() < rowCount(index_map.key(mainSelectionIndex()).parent())-1)
-    {
-        if(item(mainSelectionIndex())->has_group >0)
-        {
-            Q_FOREACH(Scene_group_item* group, m_group_entries)
-                if(group->getChildren().contains(selected_item))
-                {
-                    int id = group->getChildren().indexOf(selected_item);
-                    group->moveDown(id);
-                }
-        }
-        else
-        {
-            //if not in group
-            QModelIndex baseId = index_map.key(mainSelectionIndex());
-            int newId = index_map.value(index(baseId.row()+1, baseId.column(),baseId.parent())) ;
-            m_entries.move(mainSelectionIndex(), newId);
-        }
-        group_added();
-        setSelectedItem(m_entries.indexOf(selected_item));
-    }
-}
-Scene::Item_id Scene::mainSelectionIndex() const {
-    return selected_item;
-}
-
-QList<int> Scene::selectionIndices() const {
-    return selected_items_list;
-}
-
-int Scene::selectionAindex() const {
-    return item_A;
-}
-
-int Scene::selectionBindex() const {
-    return item_B;
-}
-
-QItemSelection Scene::createSelection(int i)
-{
-    return QItemSelection(index_map.keys(i).at(0),
-                          index_map.keys(i).at(4));
-}
-
-QItemSelection Scene::createSelectionAll()
-{
-    return QItemSelection(index_map.keys(0).at(0),
-                          index_map.keys(m_entries.size() - 1).at(4));
-}
-
-void Scene::itemChanged()
-{
-    CGAL::Three::Scene_item* item = qobject_cast<CGAL::Three::Scene_item*>(sender());
-    if(item)
-        itemChanged(item);
-}
-
-void Scene::itemChanged(Item_id i)
-{
-    if(i < 0 || i >= m_entries.size())
-        return;
-
-  Q_EMIT dataChanged(this->createIndex(i, 0),
-                     this->createIndex(i, LastColumn));
-  //  Q_EMIT restoreCollapsedState();
-}
-
-void Scene::itemChanged(CGAL::Three::Scene_item* /* item */)
-{
-  Q_EMIT dataChanged(this->createIndex(0, 0),
-                     this->createIndex(m_entries.size() - 1, LastColumn));
-}
-
-bool SceneDelegate::editorEvent(QEvent *event, QAbstractItemModel *model,
-                                const QStyleOptionViewItem &option,
-                                const QModelIndex &index)
-{
-    QAbstractProxyModel* proxyModel = dynamic_cast<QAbstractProxyModel*>(model);
-    Q_ASSERT(proxyModel);
-    Scene *scene = dynamic_cast<Scene*>(proxyModel->sourceModel());
-    Q_ASSERT(scene);
-    int id = scene->index_map[proxyModel->mapToSource(index)];
-    switch(index.column()) {
-    case Scene::VisibleColumn:
-        if (event->type() == QEvent::MouseButtonPress) {
-            QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
-            if(mouseEvent->button() == ::Qt::LeftButton) {
-                int x = mouseEvent->pos().x() - option.rect.x();
-                if(x >= (option.rect.width() - size)/2 &&
-                        x <= (option.rect.width() + size)/2) {
-                    model->setData(index, !model->data(index).toBool());
-                }
-            }
-            return false; //so that the selection can change
-        }
-        return true;
-        break;
-    case Scene::ColorColumn:
-        if (event->type() == QEvent::MouseButtonPress) {
-            QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
-            if(mouseEvent->button() == ::Qt::LeftButton) {
-                QColor color =
-                        QColorDialog::getColor(model->data(index).value<QColor>(),
-                                               0/*,
-                                                                                                                                 tr("Select color"),
-                                                                                                                                 QColorDialog::ShowAlphaChannel*/);
-                if (color.isValid()) {
-                    model->setData(index, color );
-                }
-            }
-        }
-        else if(event->type() == QEvent::MouseButtonDblClick) {
-            return true; // block double-click
-        }
-        return false;
-        break;
-    case Scene::RenderingModeColumn:
-        if (event->type() == QEvent::MouseButtonPress) {
-            QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
-            if(mouseEvent->button() == ::Qt::LeftButton) {
-                // Switch rendering mode
-                /*RenderingMode*/int rendering_mode = model->data(index, ::Qt::EditRole).toInt();
-                rendering_mode = (rendering_mode+1) % NumberOfRenderingMode;
-                model->setData(index, rendering_mode);
-            }
-        }
-        else if(event->type() == QEvent::MouseButtonDblClick) {
-            return true; // block double-click
-        }
-        return false;
-        break;
-    case Scene::ABColumn:
-        if (event->type() == QEvent::MouseButtonPress) {
-            if(id == scene->item_B) {
-                scene->item_A = id;
-                scene->item_B = -1;
-            }
-            else if(id == scene->item_A) {
-                scene->item_B = id;
-                scene->item_A = -1;
-            }
-            else if(scene->item_A == -1) {
-                scene->item_A = id;
-            }
-            else {
-                scene->item_B = id;
-            }
-            scene->dataChanged(scene->createIndex(0, Scene::ABColumn),
-                               scene->createIndex(scene->rowCount() - 1, Scene::ABColumn));
-        }
-        return false;
-        break;
-    default:
-        return QItemDelegate::editorEvent(event, model, option, index);
-    }
-}
-
-void SceneDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
-                          const QModelIndex &index) const
-{
-    QModelIndex test = proxy->mapToSource(index);
-    if (index.column() != Scene::VisibleColumn) {
-        QItemDelegate::paint(painter, option, index);
-    } else {
-        const QAbstractItemModel *model = index.model();
-
-        QPalette::ColorGroup cg = (option.state & QStyle::State_Enabled) ?
-                    (option.state & QStyle::State_Active) ? QPalette::Normal : QPalette::Inactive : QPalette::Disabled;
-
-        if (option.state & QStyle::State_Selected)
-            painter->fillRect(option.rect, option.palette.color(cg, QPalette::Highlight));
-        bool checked = model->data(index, ::Qt::DisplayRole).toBool();
-        int width = option.rect.width();
-        int height = option.rect.height();
-        size = (std::min)(width, height);
-        int x = option.rect.x() + (option.rect.width() / 2) - (size / 2);;
-        int y = option.rect.y() + (option.rect.height() / 2) - (size / 2);
-        if(test.row()>=0 && test.row()<scene->m_entries.size()){
-
-            if(checked) {
-                painter->drawPixmap(x, y, checkOnPixmap.scaled(QSize(size, size),
-                                                               ::Qt::KeepAspectRatio,
-                                                               ::Qt::SmoothTransformation));
-            }
-            else {
-                painter->drawPixmap(x, y, checkOffPixmap.scaled(QSize(size, size),
-                                                                ::Qt::KeepAspectRatio,
-                                                                ::Qt::SmoothTransformation));
-            }
-        }
-        drawFocus(painter, option, option.rect); // since we draw the grid ourselves
-    }
-}
-
-void Scene::setItemVisible(int index, bool b)
-{
-    if( index < 0 || index >= m_entries.size() )
-        return;
-    m_entries[index]->setVisible(b);
-  Q_EMIT dataChanged(this->createIndex(index, VisibleColumn),
-                     this->createIndex(index, VisibleColumn));
-}
-
-void Scene::setSelectionRay(double orig_x,
-                            double orig_y,
-                            double orig_z,
-                            double dir_x,
-                            double dir_y,
-                            double dir_z)
-{
-    CGAL::Three::Scene_item* item = this->item(selected_item);
-    if(item) item->select(orig_x,
-                          orig_y,
-                          orig_z,
-                          dir_x,
-                          dir_y,
-                          dir_z);
-}
-
-void Scene::setItemA(int i)
-{
-    item_A = i;
-    if(item_A == item_B)
-    {
-        item_B = -1;
-    }
-  Q_EMIT dataChanged(this->createIndex(0, ABColumn),
-                     this->createIndex(m_entries.size()-1, ABColumn));
-}
-
-void Scene::setItemB(int i)
-{
-    item_B = i;
-    if(item_A == item_B)
-    {
-        item_A = -1;
-    }
-  Q_EMIT updated();
-  Q_EMIT dataChanged(this->createIndex(0, ABColumn),
-                     this->createIndex(m_entries.size()-1, ABColumn));
-}
-
-Scene::Bbox Scene::bbox() const
-{
-    if(m_entries.empty())
-        return Bbox(0,0,0,0,0,0);
-
-    bool bbox_initialized = false;
-    Bbox bbox = Bbox(0,0,0,0,0,0);
-    Q_FOREACH(CGAL::Three::Scene_item* item, m_entries)
-    {
-        if(item->isFinite() && !item->isEmpty()) {
-            if(bbox_initialized) {
-
-                bbox = bbox + item->bbox();
-            }
-            else {
-                bbox = item->bbox();
-                bbox_initialized = true;
-
-            }
-        }
-
-    }
-    return bbox;
-}
-QList<CGAL::Three::Scene_group_item*> Scene::group_entries() const
-{
-    return m_group_entries;
-}
-
-QList<Scene_item*> Scene::item_entries() const
-{
-    return m_entries;
-}
-void Scene::group_added()
-{
-    //makes the hierarchy in the tree
-    //clears the model
-    clear();
-    index_map.clear();
-    //fills the model
-    Q_FOREACH(Scene_item* item, m_entries)
-    {
-        organize_items(item, invisibleRootItem(), 0);
-    }
-    Q_EMIT restoreCollapsedState();
-}
-void Scene::changeGroup(Scene_item *item, CGAL::Three::Scene_group_item *target_group)
-{
-    //remove item from the containing group if any
- if(item->has_group!=0)
-  Q_FOREACH(CGAL::Three::Scene_group_item* group, m_group_entries)
-  {
-    if(group->getChildren().contains(item))
-    {
-        remove_item_from_groups(item);
-      break;
-    }
-  }
- //add the item to the target group
- target_group->addChild(item);
- item->has_group = target_group->has_group +1;
-}
-
-float Scene::get_bbox_length() const
-{
-    return bbox().height();
-}
-
-
-#include "Scene_find_items.h"
-
-void Scene::organize_items(Scene_item* item, QStandardItem* root, int loop)
-{
-    if(item->has_group <= loop)
-    {
-        QList<QStandardItem*> list;
-        for(int i=0; i<5; i++)
-        {
-            list<<new QStandardItem();
-            list.at(i)->setEditable(false);
-
-        }
-        root->appendRow(list);
-        for(int i=0; i<5; i++){
-            index_map[list.at(i)->index()] = m_entries.indexOf(item);
-        }
-        CGAL::Three::Scene_group_item* group =
-                qobject_cast<CGAL::Three::Scene_group_item*>(item);
-        if(group)
-        {
-            Q_FOREACH(Scene_item*child, group->getChildren())
-            {
-                organize_items(child, list.first(), loop+1);
-            }
-        }
-    }
-}
-
-void Scene::setExpanded(QModelIndex id)
-{
-    CGAL::Three::Scene_group_item* group =
-            qobject_cast<CGAL::Three::Scene_group_item*>(item(index_map.value(index(0, 0, id.parent()))));
-    if(group)
-    {
-        group->setExpanded(true);
-    }
-}
-void Scene::setCollapsed(QModelIndex id)
-{
-    CGAL::Three::Scene_group_item* group =
-            qobject_cast<CGAL::Three::Scene_group_item*>(item(getIdFromModelIndex(id)));
-    if(group)
-    {
-        group->setExpanded(false);
-    }
-}
-
-int Scene::getIdFromModelIndex(QModelIndex modelId)const
-{
-    return index_map.value(modelId);
-}
-
-QList<QModelIndex> Scene::getModelIndexFromId(int id) const
-{
-    return index_map.keys(id);
-}
-
-void Scene::add_group(Scene_group_item* group)
-{
-    //Find the indices of the selected items
-    QList<int> indices;
-    QList<int> blacklist;
-    Q_FOREACH(int id, selectionIndices()){
-        CGAL::Three::Scene_group_item* group =
-                qobject_cast<CGAL::Three::Scene_group_item*>(item(id));
-        if(group)
-            Q_FOREACH(CGAL::Three::Scene_item *item, group->getChildren())
-                blacklist<<item_id(item);
-
-        if(!indices.contains(id) && !blacklist.contains(id))
-            indices<<id;
-}
-    //checks if all the selected items are in the same group
-    bool all_in_one = true;
-    if(indices.isEmpty())
-        all_in_one = false;
-    //group containing the selected item
-    CGAL::Three::Scene_group_item * existing_group = 0;
-    //for each selected item
-    Q_FOREACH(int id, indices){
-        //if the selected item is in a group
-        if(item(id)->has_group!=0){
-            //for each group
-            Q_FOREACH(CGAL::Three::Scene_group_item *group, group_entries())
-            {
-                //if the group contains the selected item
-                if(group->getChildren().contains(item(id))){
-                    //if it is the first one, we initialize existing_group
-                    if(existing_group == 0)
-                        existing_group = group;
-                    //else we check if it is the same group as before.
-                    //If not, all selected items are not in the same group
-                    else if(existing_group != group)
-                        all_in_one = false;
-                    break;
-                }
-            }//end for each group
-        }
-        //else it is impossible that all the selected items are in the same group
-        else{
-            all_in_one = false;
-            break;
-        }
-    }//end foreach selected item
-
-    //If all the selected items are in the same group, we put them in a sub_group of this group
-    if(all_in_one)
-    {
-        Q_FOREACH(int id, indices)
-            changeGroup(item(id),group);
-        changeGroup(group, existing_group);
-        addItem(group);
-        group_added();
-    }
-    //else wer create a new group
-    else
-    {
-        Q_FOREACH(int id, indices)
-            changeGroup(item(id),group);
-        addItem(group);
-        group_added();
-    }
-}
-
-namespace scene { namespace details {
-
-Q_DECL_EXPORT
-CGAL::Three::Scene_item*
-findItem(const CGAL::Three::Scene_interface* scene_interface,
-         const QMetaObject& metaobj,
-         QString name, Scene_item_name_fn_ptr fn) {
-    const Scene* scene = dynamic_cast<const Scene*>(scene_interface);
-    if(!scene) return 0;
-    Q_FOREACH(CGAL::Three::Scene_item* item, scene->entries()) {
-       CGAL::Three::Scene_item* ptr = qobject_cast<CGAL::Three::Scene_item*>(metaobj.cast(item));
-        if(ptr && ((ptr->*fn)() == name)) return ptr;
-    }
-    return 0;
-}
-
-Q_DECL_EXPORT
-QList<CGAL::Three::Scene_item*>
-findItems(const CGAL::Three::Scene_interface* scene_interface,
-
-          const QMetaObject&,
-          QString name, Scene_item_name_fn_ptr fn)
-{
-    const Scene* scene = dynamic_cast<const Scene*>(scene_interface);
-    QList<CGAL::Three::Scene_item*> list;
-    if(!scene) return list;
-
-    Q_FOREACH(CGAL::Three::Scene_item* item, scene->entries()) {
-        CGAL::Three::Scene_item* ptr = qobject_cast<CGAL::Three::Scene_item*>(item);
-        if(ptr && ((ptr->*fn)() == name)) {
-            list << ptr;
-        }
-    }
-    return list;
-}
-
-} // end namespace details
-                } // end namespace scene
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene.h b/3rdparty/CGAL-4.8/demo/Polyhedron/Scene.h
deleted file mode 100644
index 7e938d1..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene.h
+++ /dev/null
@@ -1,325 +0,0 @@
-//! \file Scene.h
-#ifndef SCENE_H
-#define SCENE_H
-#include "config.h"
-#include "Scene_config.h"
-#include <CGAL/Three/Scene_interface.h>
-#include <CGAL/Three/Scene_draw_interface.h>
-#include <CGAL/Three/Viewer_config.h>
-
-#include <QtOpenGL/qgl.h>
-#include <QStandardItemModel>
-#include <QString>
-#include <QColor>
-#include <QList>
-#include <QMap>
-#include <QItemDelegate>
-#include <QPixmap>
-#include <QItemSelection>
-#include <QGLViewer/qglviewer.h>
-#include <QDebug>
-#include <iostream>
-#include <cmath>
-#include <boost/variant.hpp>
-#include <CGAL/Three/Scene_group_item.h>
-class QEvent;
-class QMouseEvent;
-namespace GlSplat { class SplatRenderer; }
-namespace CGAL { namespace Three{ class Viewer_interface;}}
-
-
-class SCENE_EXPORT Scene  :
-  public QStandardItemModel, public CGAL::Three::Scene_interface, public CGAL::Three::Scene_draw_interface
-
-{
-  Q_OBJECT
-  Q_PROPERTY(int numberOfEntries READ numberOfEntries)
-
-  friend class SceneDelegate;
-
-public:
-  QList<QModelIndex> getModelIndexFromId(int id) const;
-  int getIdFromModelIndex(QModelIndex modelId) const;
-  enum Columns { NameColumn = 0, 
-                 ColorColumn, 
-                 RenderingModeColumn, 
-                 VisibleColumn,
-                 ABColumn,
-                 LastColumn = ABColumn,
-                 NumberOfColumns = LastColumn + 1};
-  Scene(QObject*  parent);
-  ~Scene();
-
-  //!Adds item to the items list, gives it an ID and
-  //!updates the bounding box if needed.
-  int addItem(CGAL::Three::Scene_item* item);
-
-  void changeGroup(CGAL::Three::Scene_item* item, CGAL::Three::Scene_group_item* target_group);
-  //!Sets item as the item at index and calls @ref Scene_item#changed().
-  //!If emit_item_about_to_be_destroyed is set to true, emits
-  //!an itemAboutToBeDestroyed signal.
-  CGAL::Three::Scene_item* replaceItem(Scene::Item_id index, CGAL::Three::Scene_item* item, bool emit_item_about_to_be_destroyed = false);
-  /*! Deletes the item with the target index.
-   * @returns  the index of the polyhedra just before the
-   * one that is erased, or just after. -1 if
-   * the list is empty.
-   */
-  Q_INVOKABLE Item_id erase(Item_id);
-
-  /*! Deletes the items with the target indexes.
-   * @returns the index of the polyhedra just before the
-   * one that is erased, or just after. Returns -1 if
-   * the list is empty.
-   */
-  int erase(QList<int>);
-
-  /*! Duplicate a scene item.
-   * @returns the ID of the new item (-1 on error).
-   */
-  int duplicate(int index); 
-
-  // Accessors (getters)
-  //! @returns the number of items.
-  int numberOfEntries() const;
-  //! @returns the list of items.
-  const QList<CGAL::Three::Scene_item*>& entries() const { return m_entries; }
-  //! @returns the item at the target index.
-  Q_INVOKABLE CGAL::Three::Scene_item* item(int) const ;
-  //! @returns the id of the target item.
-  Item_id item_id(CGAL::Three::Scene_item*) const;
-  
-  //! \todo Replace Index based selection functionality with those
-  //! functions.
-  ///@{
-  CGAL::Three::Scene_item* selectedItem() const;
-  QList<CGAL::Three::Scene_item*> selectedItems() const;
-  QList<CGAL::Three::Scene_item*> selectionA() const;
-  QList<CGAL::Three::Scene_item*> selectionB() const;
-  ///@}
-
-  //!@returns the currently selected item's index.
-  int mainSelectionIndex() const;
-  //!@returns the list of currently selected items indices.
-  QList<int> selectionIndices() const;
-  //!@returns the index of the Item_A
-  int selectionAindex() const;
-  //!@returns the index of the Item_B
-  int selectionBindex() const;
-
-  /*! Is called by Viewer::initializeGL(). Allows all the initialization
-   * of OpenGL code that needs a context.
-   */
-  void initializeGL();
-  /*! Is called by Viewer::draw(). Is deprecated and does nothing.*/
-  void draw();
-  /*! Is deprecated and does nothing.*/
-  void drawWithNames();
-  /*! Is called by Viewer::draw(Viewer_interface*). Calls draw_aux(false, viewer).
-   * @see draw_aux(bool with_names, Viewer_interface).*/
-  void draw(CGAL::Three::Viewer_interface*);
-  /*! Is called by Viewer::drawWithNames(Viewer_interface*). Calls draw_aux(true, viewer).
-   * @see draw_aux(bool with_names, Viewer_interface).*/
-  void drawWithNames(CGAL::Three::Viewer_interface*);
-  /*! Manages the key events.
-   * @returns true if the keyEvent executed well.
-   */
-  bool keyPressEvent(QKeyEvent* e);
-
-  //!@returns the scene bounding box
-  Bbox bbox() const;
-  float get_bbox_length() const;
-  //!@returns the length of the bounding box's diagonal.
-  double len_diagonal() const
-  {
-    Bbox box = bbox();
-    double dx = box.xmax - box.xmin;
-    double dy = box.ymax - box.ymin;
-    double dz = box.zmax - box.zmin;
-    return std::sqrt(dx*dx + dy*dy + dz*dz);
-  }
-
-
-  // QStandardItemModel functions
-  void moveRowUp();
-  void moveRowDown();
-  bool dropMimeData(const QMimeData *, Qt::DropAction, int, int, const QModelIndex &parent);
-  QVariant data ( const QModelIndex & index, int role = ::Qt::DisplayRole ) const;
-  //!@returns the type of data correspondind to the role.
-  QVariant headerData ( int section, ::Qt::Orientation orientation, int role = ::Qt::DisplayRole ) const;
-  //!@returns the flags for the item at the target index.
-  ::Qt::ItemFlags flags ( const QModelIndex & index ) const;
-  /*! Sets the column data for the target index. Returns false if index is not valid and
-   * if role is not EditRole.*/
-  bool setData(const QModelIndex &index, const QVariant &value, int role);
-  QList<CGAL::Three::Scene_group_item*> group_entries() const ;
-  QList<CGAL::Three::Scene_item*> item_entries() const ;
-  // auxiliary public function for QMainWindow
-  //!Selects the row at index i in the sceneView.
-  QItemSelection createSelection(int i);
-  //!Selects all the rows in the sceneView.
-  QItemSelection createSelectionAll();
-
-public Q_SLOTS:
-  //!Specifies a group as Expanded for the view
-  void setExpanded(QModelIndex);
-  //!Specifies a group as Collapsed for the view
-  void setCollapsed(QModelIndex);
-  /*! This is an overloaded function.
-   * Notifies the scene that the sender item was modified.
-   * Called by the items. Calls @ref Scene_item#changed().
-   * This function is called by the items.*/
-  void itemChanged();
-  /*! Notifies the scene that the item at index i was modified.
-   * Called by the items. Calls @ref Scene_item#changed().
-   * This function is called by the items.*/
-  void itemChanged(int i); 
-  /*! Notifies the scene that the item was modified.
-   *  Calls @ref Scene_item#changed().
-   * This function is called by the items.*/
-  void itemChanged(CGAL::Three::Scene_item*);
-  //!Removes item from all the groups of the scene.
-  void remove_item_from_groups(CGAL::Three::Scene_item* item);
-
-  void add_group(Scene_group_item* group);
-  //!Re-organizes the sceneView.
-  void group_added();
-  //! Sets the selected item to the target index.
-  void setSelectedItemIndex(int i)
-  {
-    selected_item = i;
-  }
-  //! Sets the selected item to the target index and emits selectionChanged(i).
-  void setSelectedItem(int i )
-  {
-    selected_item = i;
-    Q_EMIT selectionChanged(i);
-  }
-
-  //! Sets the target item as selected and emits setSelectedItem for its index.
-  void setSelectedItem(CGAL::Three::Scene_item* item_to_select)
-  {
-    int i=0;
-    Q_FOREACH(CGAL::Three::Scene_item* item, m_entries)
-    {
-      if (item==item_to_select)
-      {
-        Q_EMIT setSelectedItem(i);
-        break;
-      }
-      ++i;
-    }
-  }
-  //! Sets the target list of indices as the selected indices.
-  QList<int> setSelectedItemsList(QList<int> l )
-  {
-    Q_FOREACH(int i,l)
-    {
-       CGAL::Three::Scene_group_item* group =
-               qobject_cast<CGAL::Three::Scene_group_item*>(item(i));
-       if(group)
-       {
-         QList<int> list;
-         Q_FOREACH(CGAL::Three::Scene_item* child, group->getChildren())
-           list<<m_entries.indexOf(child);
-         l << setSelectedItemsList(list);
-       }
-
-    }
-    selected_items_list = l;
-    return l;
-  }
-
-  // Accessors (setters)
-  //!Sets the item at index i to visible or not visible.
-  void setItemVisible(int, bool b);
-  //!Sets the item_A as the item at index i .
-  void setItemA(int i);
-  //!Sets the item_B as the item at index i .
-  void setItemB(int i);
-
-Q_SIGNALS:
-  //generated automatically by moc
-  void itemPicked(const QModelIndex &);
-  void newItem(int);
-  void updated_bbox();
-  void updated();
-  void itemAboutToBeDestroyed(CGAL::Three::Scene_item*);
-  void selectionRay(double, double, double, double, double, double);
-  void selectionChanged(int i);
-  void restoreCollapsedState();
-private Q_SLOTS:
-  //! Casts a selection ray and calls the item function select.
-  void setSelectionRay(double, double, double, double, double, double);
-  void callDraw(){  QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin(); viewer->update();}
-
-private:
-  /*! Calls the drawing functions of each visible item according
-   * to its current renderingMode. If with_names is true, uses
-   * the OpenGL mode GL_WITH_NAMES, essentially used for the picking.*/
-  void draw_aux(bool with_names, CGAL::Three::Viewer_interface*);
-  //! Re-draw the hierarchy of the view.
-  void organize_items(CGAL::Three::Scene_item* item, QStandardItem *root, int loop);
-  //! List of Scene_items.
-  typedef QList<CGAL::Three::Scene_item*> Entries;
-  //!List containing all the scene_items.
-  Entries m_entries;
-  //! Index of the currently selected item.
-  int selected_item;
-  //!List containing all the scene_group_items.
-  QList<CGAL::Three::Scene_group_item*> m_group_entries;
-  //!List of indices of the currently selected items.
-  QList<int> selected_items_list;
-  //!Index of the item_A.
-  int item_A;
-  //!Index of the item_B.
-  int item_B;
-  bool picked;
-  bool gl_init;
-  static GlSplat::SplatRenderer* ms_splatting;
-  static int ms_splattingCounter;
-  QMap<QModelIndex, int> index_map;
-
-public:
-  static GlSplat::SplatRenderer* splatting();
-
-}; // end class Scene
-
-class QAbstractProxyModel;
-/*!
- * \brief The SceneDelegate class
- * Handles the columns of the sceneView
- */
-class SCENE_EXPORT SceneDelegate : public QItemDelegate
-{
-public:
-  SceneDelegate(QObject * parent = 0)
-    : QItemDelegate(parent),
-      checkOnPixmap(":/cgal/icons/check-on.png"),
-      checkOffPixmap(":/cgal/icons/check-off.png")
-  {
-  }
-//! Handles the clicks on the sceneView
-  bool editorEvent(QEvent *event, QAbstractItemModel *model,
-                   const QStyleOptionViewItem &option,
-                   const QModelIndex &index);
-  //! Draws the content of the sceneView
-  void paint(QPainter *painter, const QStyleOptionViewItem &option,
-             const QModelIndex &index) const;
-  void setProxy(QAbstractProxyModel* p_proxy){
-      proxy = p_proxy;
-  }
-  void setScene(Scene* p_scene){
-      scene = p_scene;
-  }
-
-private:
-  QPixmap checkOnPixmap;
-  QPixmap checkOffPixmap;
-  QAbstractProxyModel *proxy;
-  Scene *scene;
-  mutable int size;
-}; // end class SceneDelegate
-
-#endif // SCENE_H
-
-
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_c3t3_item.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_c3t3_item.cpp
deleted file mode 100644
index 43f1a90..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_c3t3_item.cpp
+++ /dev/null
@@ -1,1280 +0,0 @@
-#include "config.h"
-#include "create_sphere.h"
-#include "Scene_c3t3_item.h"
-
-#include <QVector>
-#include <QColor>
-#include <QPixmap>
-#include <QPainter>
-#include <QtCore/qglobal.h>
-
-#include <map>
-#include <vector>
-#include <CGAL/gl.h>
-#include <CGAL/Mesh_3/dihedral_angle_3.h>
-#include <CGAL/Three/Scene_interface.h>
-
-#include <QGLViewer/manipulatedFrame.h>
-#include <QGLViewer/qglviewer.h>
-
-#include <boost/function_output_iterator.hpp>
-#include <boost/foreach.hpp>
-
-struct Scene_c3t3_item_priv {
-  Scene_c3t3_item_priv() : c3t3() {}
-  Scene_c3t3_item_priv(const C3t3& c3t3_) : c3t3(c3t3_) {}
-
-  C3t3 c3t3;
-  QVector<QColor> colors;
-};
-
-void Scene_c3t3_item::compile_shaders()
-{
-    program_sphere = new QOpenGLShaderProgram();
-
-    //Source code
-    const char vertex_source[] =
-    {
-        "#version 120                                                                                             \n"
-        "attribute highp vec4 vertex;                                                                             \n"
-        "attribute highp vec3 normals;                                                                            \n"
-        "attribute highp vec3 colors;                                                                             \n"
-        "attribute highp vec3 center;                                                                             \n"
-        "attribute highp float radius;                                                                            \n"
-        "uniform highp vec4 cutplane;                                                                             \n"
-        "uniform highp mat4 mvp_matrix;                                                                           \n"
-        "uniform highp mat4 mv_matrix;                                                                            \n"
-        "varying highp vec4 fP;                                                                                   \n"
-        "varying highp vec3 fN;                                                                                   \n"
-        "varying highp vec4 color;                                                                                \n"
-        "                                                                                                         \n"
-        "                                                                                                         \n"
-        "void main(void)                                                                                          \n"
-        "{                                                                                                        \n"
-        " if(center.x * cutplane.x  + center.y * cutplane.y  + center.z * cutplane.z  +  cutplane.w > 0){         \n"
-        "    color = vec4(colors,0.0);                                                                            \n"
-        " }else{                                                                                                  \n"
-        "  color = vec4(colors,1.0);}                                                                             \n"
-        "  fP = mv_matrix * vertex;                                                                               \n"
-        "  fN = mat3(mv_matrix)* normals;                                                                         \n"
-        "  gl_Position =  mvp_matrix *                                                                            \n"
-        "  vec4(radius*vertex.x + center.x, radius* vertex.y + center.y, radius*vertex.z + center.z, 1.0) ;       \n"
-        "}                                                                                                        \n"
-    };
-    QOpenGLShader *vertex_shader = new QOpenGLShader(QOpenGLShader::Vertex);
-    if(!vertex_shader->compileSourceCode(vertex_source))
-    {
-        std::cerr<<"Compiling vertex source FAILED"<<std::endl;
-    }
-
-
-    if(!program_sphere->addShader(vertex_shader))
-    {
-        std::cerr<<"adding vertex shader FAILED"<<std::endl;
-    }
-    if(!program_sphere->addShaderFromSourceFile(QOpenGLShader::Fragment,":/cgal/Polyhedron_3/resources/shader_c3t3.f" ))
-    {
-        std::cerr<<"adding fragment shader FAILED"<<std::endl;
-    }
-    if(!program_sphere->link())
-    {
-        //std::cerr<<"linking Program FAILED"<<std::endl;
-        qDebug() << program_sphere->log();
-    }
-}
-double complex_diag(const Scene_item* item) {
-  const Scene_item::Bbox& bbox = item->bbox();
-  const double& xdelta = bbox.xmax-bbox.xmin;
-  const double& ydelta = bbox.ymax-bbox.ymin;
-  const double& zdelta = bbox.zmax-bbox.zmin;
-  const double diag = std::sqrt(xdelta*xdelta +
-                                ydelta*ydelta +
-                                zdelta*zdelta);
-  return diag * 0.7;
-}
-
-Scene_c3t3_item::Scene_c3t3_item()
-  : Scene_item(NumberOfBuffers, NumberOfVaos)
-  , d(new Scene_c3t3_item_priv())
-  , frame(new ManipulatedFrame())
-  , last_known_scene(NULL)
-  , data_item_(NULL)
-  , histogram_()
-  , indices_()
-{
-  are_intersection_buffers_filled = false;
-  positions_lines.resize(0);
-  positions_poly.resize(0);
-  normals.resize(0);
-  s_vertex.resize(0);
-  s_normals.resize(0);
-  ws_vertex.resize(0);
-  need_changed = false;
-  startTimer(0);
-  connect(frame, SIGNAL(modified()), this, SLOT(changed()));
-  c3t3_changed();
-  setRenderingMode(FlatPlusEdges);
-  compile_shaders();
-  spheres_are_shown = false;
-  create_flat_and_wire_sphere(1.0f,s_vertex,s_normals, ws_vertex);
-
-}
-
-Scene_c3t3_item::Scene_c3t3_item(const C3t3& c3t3)
-  : Scene_item(NumberOfBuffers, NumberOfVaos)
-  , d(new Scene_c3t3_item_priv(c3t3))
-  , frame(new ManipulatedFrame())
-  , last_known_scene(NULL)  
-  , data_item_(NULL)  
-  , histogram_()
-  , indices_()
-{
-  positions_lines.resize(0);
-  positions_poly.resize(0);
-  normals.resize(0);
-  s_vertex.resize(0);
-  s_normals.resize(0);
-  ws_vertex.resize(0);
-  need_changed = false;
-  startTimer(0);
-  connect(frame, SIGNAL(modified()), this, SLOT(changed()));
-  reset_cut_plane();
-  c3t3_changed();
-  setRenderingMode(FlatPlusEdges);
-  compile_shaders();
-  spheres_are_shown = false;
-  create_flat_and_wire_sphere(1.0f,s_vertex,s_normals, ws_vertex);
-}
-
-Scene_c3t3_item::~Scene_c3t3_item()
-{
-  frame = 0;
-  delete frame;
-  delete d;
-}
-
-
-
-const Scene_item*
-Scene_c3t3_item::data_item() const
-{
-  return data_item_;
-}
-
-void
-Scene_c3t3_item::set_data_item(const Scene_item* data_item)
-{
-  data_item_ = data_item;
-  if (NULL != data_item)
-  {
-    connect(data_item, SIGNAL(aboutToBeDestroyed()),
-      this, SLOT(data_item_destroyed()));
-  }
-}
-
-void
-Scene_c3t3_item::data_item_destroyed()
-{
-  set_data_item(NULL);
-}
-
-const C3t3&
-Scene_c3t3_item::c3t3() const {
-  return d->c3t3;
-}
-
-C3t3&
-Scene_c3t3_item::c3t3()
-{
-  return d->c3t3;
-}
-
-void
-Scene_c3t3_item::changed()
-{
-  need_changed = true;
-}
-
-void Scene_c3t3_item::timerEvent(QTimerEvent* /*event*/)
-{ // just handle deformation - paint like selection is handled in eventFilter()
-  if(need_changed) {
-    are_intersection_buffers_filled = false;
-    need_changed = false;
-  }
-}
-
-void
-Scene_c3t3_item::c3t3_changed()
-{
-  // Update colors
-  // Fill indices map and get max subdomain value
-  indices_.clear();
-
-  int max = 0;
-  for (C3t3::Cells_in_complex_iterator cit = this->c3t3().cells_in_complex_begin(),
-    end = this->c3t3().cells_in_complex_end(); cit != end; ++cit)
-  {
-    max = (std::max)(max, cit->subdomain_index());
-    indices_.insert(cit->subdomain_index());
-  }
-  for (C3t3::Facets_in_complex_iterator fit = this->c3t3().facets_in_complex_begin(),
-    end = this->c3t3().facets_in_complex_end(); fit != end; ++fit)
-  {
-    max = (std::max)(max, fit->first->surface_patch_index(fit->second));
-    indices_.insert(fit->first->surface_patch_index(fit->second));
-  }
-
-  d->colors.resize(max + 1);
-  compute_color_map(color_);
-
-  // Rebuild histogram
-  build_histogram();
-  
-}
-
-QPixmap
-Scene_c3t3_item::graphicalToolTip() const
-{
-  if (!histogram_.isNull())
-  {
-    return histogram_;
-  }
-  else
-  {
-    const_cast<Scene_c3t3_item&>(*this).build_histogram();
-    return histogram_;
-  }
-}
-
-template<typename C3t3>
-std::vector<int>
-create_histogram(const C3t3& c3t3, double& min_value, double& max_value)
-{
-  typedef typename C3t3::Triangulation::Point Point_3;
-
-  std::vector<int> histo(181, 0);
-
-  min_value = 180.;
-  max_value = 0.;
-
-  for (typename C3t3::Cells_in_complex_iterator cit = c3t3.cells_in_complex_begin();
-    cit != c3t3.cells_in_complex_end();
-    ++cit)
-  {
-    if (!c3t3.is_in_complex(cit))
-      continue;
-
-#ifdef CGAL_MESH_3_DEMO_DONT_COUNT_TETS_ADJACENT_TO_SHARP_FEATURES_FOR_HISTOGRAM
-    if (c3t3.in_dimension(cit->vertex(0)) <= 1
-      || c3t3.in_dimension(cit->vertex(1)) <= 1
-      || c3t3.in_dimension(cit->vertex(2)) <= 1
-      || c3t3.in_dimension(cit->vertex(3)) <= 1)
-      continue;
-#endif //CGAL_MESH_3_DEMO_DONT_COUNT_TETS_ADJACENT_TO_SHARP_FEATURES_FOR_HISTOGRAM
-
-    const Point_3& p0 = cit->vertex(0)->point();
-    const Point_3& p1 = cit->vertex(1)->point();
-    const Point_3& p2 = cit->vertex(2)->point();
-    const Point_3& p3 = cit->vertex(3)->point();
-
-    double a = CGAL::to_double(CGAL::abs(CGAL::Mesh_3::dihedral_angle(p0, p1, p2, p3)));
-    histo[static_cast<int>(std::floor(a))] += 1;
-    min_value = (std::min)(min_value, a);
-    max_value = (std::max)(max_value, a);
-
-    a = CGAL::to_double(CGAL::abs(CGAL::Mesh_3::dihedral_angle(p0, p2, p1, p3)));
-    histo[static_cast<int>(std::floor(a))] += 1;
-    min_value = (std::min)(min_value, a);
-    max_value = (std::max)(max_value, a);
-
-    a = CGAL::to_double(CGAL::abs(CGAL::Mesh_3::dihedral_angle(p0, p3, p1, p2)));
-    histo[static_cast<int>(std::floor(a))] += 1;
-    min_value = (std::min)(min_value, a);
-    max_value = (std::max)(max_value, a);
-
-    a = CGAL::to_double(CGAL::abs(CGAL::Mesh_3::dihedral_angle(p1, p2, p0, p3)));
-    histo[static_cast<int>(std::floor(a))] += 1;
-    min_value = (std::min)(min_value, a);
-    max_value = (std::max)(max_value, a);
-
-    a = CGAL::to_double(CGAL::abs(CGAL::Mesh_3::dihedral_angle(p1, p3, p0, p2)));
-    histo[static_cast<int>(std::floor(a))] += 1;
-    min_value = (std::min)(min_value, a);
-    max_value = (std::max)(max_value, a);
-
-    a = CGAL::to_double(CGAL::abs(CGAL::Mesh_3::dihedral_angle(p2, p3, p0, p1)));
-    histo[static_cast<int>(std::floor(a))] += 1;
-    min_value = (std::min)(min_value, a);
-    max_value = (std::max)(max_value, a);
-
-  }
-
-  return histo;
-}
-
-void
-Scene_c3t3_item::build_histogram()
-{
-#ifdef CGAL_MESH_3_DEMO_BIGGER_HISTOGRAM_WITH_WHITE_BACKGROUNG
-  // Create an histogram_ and display it
-  const int height = 280;
-  const int top_margin = 5;
-  const int left_margin = 20;
-  const int drawing_height = height - top_margin * 2;
-  const int width = 804;
-  const int cell_width = 4;
-  const int text_margin = 3;
-  const int text_height = 34;
-
-  histogram_ = QPixmap(width, height + text_height);
-  histogram_.fill(QColor(255, 255, 255));
-#else
-  // Create an histogram_ and display it
-  const int height = 140;
-  const int top_margin = 5;
-  const int left_margin = 20;
-  const int drawing_height = height - top_margin * 2;
-  const int width = 402;
-  const int cell_width = 2;
-  const int text_margin = 3;
-  const int text_height = 20;
-
-  histogram_ = QPixmap(width, height + text_height);
-  histogram_.fill(QColor(192, 192, 192));
-#endif  
-
-  QPainter painter(&histogram_);
-  painter.setPen(Qt::black);
-  painter.setBrush(QColor(128, 128, 128));
-  //painter.setFont(QFont("Arial", 30));
-
-  // Build histogram_ data
-  double min_value, max_value;
-  std::vector<int> histo_data = create_histogram(c3t3(), min_value, max_value);
-
-  // Get maximum value (to normalize)
-  int max_size = 0;
-  for (std::vector<int>::iterator it = histo_data.begin(), end = histo_data.end();
-    it != end; ++it)
-  {
-    max_size = (std::max)(max_size, *it);
-  }
-
-  // colored histogram
-  int j = 0;
-
-  // draw
-  int i = left_margin;
-  for (std::vector<int>::iterator it = histo_data.begin(), end = histo_data.end();
-    it != end; ++it, i += cell_width)
-  {
-    int line_height = static_cast<int>(std::ceil(static_cast<double>(drawing_height)*
-      static_cast<double>(*it) / static_cast<double>(max_size)) + .5);
-
-    painter.fillRect(i,
-      drawing_height + top_margin - line_height,
-      cell_width,
-      line_height,
-      get_histogram_color(j++));
-  }
-
-  // draw bottom horizontal line
-  painter.setPen(Qt::blue);
-
-  painter.drawLine(QPoint(left_margin, drawing_height + top_margin),
-    QPoint(left_margin + static_cast<int>(histo_data.size())*cell_width,
-    drawing_height + top_margin));
-
-
-  // draw min value and max value
-  const int min_tr_width = static_cast<int>(2 * (std::floor(min_value)*cell_width + left_margin));
-  const int max_tr_width = static_cast<int>(
-    2 * ((histo_data.size() - std::floor(max_value))*cell_width + left_margin));
-  const int tr_y = drawing_height + top_margin + text_margin;
-
-  painter.setPen(get_histogram_color(min_value));
-  QRect min_text_rect(0, tr_y, min_tr_width, text_height);
-  painter.drawText(min_text_rect, Qt::AlignCenter, tr("%1").arg(min_value, 0, 'f', 1));
-
-  painter.setPen(get_histogram_color(max_value));
-  QRect max_text_rect(width - max_tr_width, tr_y, max_tr_width, text_height);
-  painter.drawText(max_text_rect, Qt::AlignCenter, tr("%1").arg(max_value, 0, 'f', 1));
-}
-
-QColor
-Scene_c3t3_item::get_histogram_color(const double v) const
-{
-  if (v < 5)            { return Qt::red; }
-  else if (v < 10)      { return QColor(215, 108, 0); }
-  else if (v < 15)      { return QColor(138, 139, 0); }
-  else if (v < 165)     { return QColor(60, 136, 64); }
-  else if (v < 170)     { return QColor(138, 139, 1); }
-  else if (v < 175)     { return QColor(215, 108, 0); }
-  else /* 175<v<=180 */   { return Qt::red; }
-}
-
-void
-Scene_c3t3_item::update_histogram()
-{
-  build_histogram();
-}
-
-void
-Scene_c3t3_item::compute_color_map(const QColor& c)
-{
-  typedef Indices::size_type size_type;
-
-  size_type nb_domains = indices_.size();
-  size_type i = 0;
-  for (Indices::iterator it = indices_.begin(), end = indices_.end();
-    it != end; ++it, ++i)
-  {
-    double hue = c.hueF() + 1. / nb_domains * i;
-    if (hue > 1) { hue -= 1.; }
-    d->colors[*it] = QColor::fromHsvF(hue, c.saturationF(), c.valueF());
-  }
-}
-
-Kernel::Plane_3 Scene_c3t3_item::plane() const {
-  const qglviewer::Vec& pos = frame->position();
-  const qglviewer::Vec& n =
-    frame->inverseTransformOf(qglviewer::Vec(0.f, 0.f, 1.f));
-  return Kernel::Plane_3(n[0], n[1], n[2], -n * pos);
-}
-
-void Scene_c3t3_item::compute_bbox() const {
-  if (isEmpty())
-    _bbox = Bbox();
-  else {
-    CGAL::Bbox_3 result;
-    for (Tr::Finite_vertices_iterator
-           vit = ++c3t3().triangulation().finite_vertices_begin(),
-           end = c3t3().triangulation().finite_vertices_end();
-         vit != end; ++vit)
-    {
-      if(vit->in_dimension() == -1) continue;
-      result = result + vit->point().bbox();
-    }
-    _bbox = Bbox(result.xmin(), result.ymin(), result.zmin(),
-                 result.xmax(), result.ymax(), result.zmax());
-  }
-}
-
-QString Scene_c3t3_item::toolTip() const {
-  int number_of_tets = 0;
-  for (Tr::Finite_cells_iterator
-    cit = c3t3().triangulation().finite_cells_begin(),
-    end = c3t3().triangulation().finite_cells_end();
-    cit != end; ++cit)
-  {
-    if (c3t3().is_in_complex(cit))
-      ++number_of_tets;
-  }
-  return tr("<p><b>3D complex in a 3D triangulation</b></p>"
-    "<p>Number of vertices: %1<br />"
-    "Number of surface facets: %2<br />"
-    "Number of volume tetrahedra: %3</p>")
-    .arg(c3t3().triangulation().number_of_vertices())
-    .arg(c3t3().number_of_facets())
-    .arg(number_of_tets);
-}
-
-void Scene_c3t3_item::draw(CGAL::Three::Viewer_interface* viewer) const {
-  Scene_c3t3_item* ncthis = const_cast<Scene_c3t3_item*>(this);
-
-  if (!are_buffers_filled)
-  {
-    ncthis->compute_elements();
-    ncthis->initialize_buffers(viewer);
-  }
-
-  vaos[Grid]->bind();
-  program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
-  attrib_buffers(viewer, PROGRAM_WITHOUT_LIGHT);
-  program->bind();
-  program->setAttributeValue("colors", QColor(Qt::black));
-  QMatrix4x4 f_mat;
-  for (int i = 0; i<16; i++)
-    f_mat.data()[i] = frame->matrix()[i];
-  program->setUniformValue("f_matrix", f_mat);
-  viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(positions_grid.size() / 3));
-  program->release();
-  vaos[Grid]->release();
-
-  vaos[Facets]->bind();
-  program = getShaderProgram(PROGRAM_C3T3);
-  attrib_buffers(viewer, PROGRAM_C3T3);
-  program->bind();
-  QVector4D cp(this->plane().a(),this->plane().b(),this->plane().c(),this->plane().d());
-  program->setUniformValue("cutplane", cp);
-  // positions_poly_size is the number of total facets in the C3T3
-  // it is only computed once and positions_poly is emptied at the end
-  viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(positions_poly_size / 3));
-  program->release();
-  vaos[Facets]->release();
-
-
- if (!are_intersection_buffers_filled)
-  {
-     ncthis->compute_intersections();
-     ncthis->initialize_intersection_buffers(viewer);
-  }
-  vaos[iFacets]->bind();
-  program = getShaderProgram(PROGRAM_WITH_LIGHT);
-  attrib_buffers(viewer, PROGRAM_WITH_LIGHT);
-  program->bind();
-
-  // positions_poly is also used for the faces in the cut plane
-  // and changes when the cut plane is moved
-  viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(positions_poly.size() / 3));
-  program->release();
-  vaos[iFacets]->release();
-
-
-  if(spheres_are_shown)
-  {
-    vaos[Spheres]->bind();
-    program_sphere->bind();
-    //ModelViewMatrix used for the transformation of the camera.
-    QMatrix4x4 mvp_mat;
-    // ModelView Matrix used for the lighting system
-    QMatrix4x4 mv_mat;
-    GLdouble d_mat[16];
-    GLint is_both_sides = 0;
-    viewer->camera()->getModelViewProjectionMatrix(d_mat);
-    //Convert the GLdoubles matrices in GLfloats
-    for (int i=0; i<16; ++i){
-      mvp_mat.data()[i] = GLfloat(d_mat[i]);
-    }
-    viewer->camera()->getModelViewMatrix(d_mat);
-    for (int i=0; i<16; ++i)
-      mv_mat.data()[i] = GLfloat(d_mat[i]);
-    QVector4D position(0.0f,0.0f,1.0f, 1.0f );
-    QVector4D ambient(0.4f, 0.4f, 0.4f, 0.4f);
-    // Diffuse
-    QVector4D diffuse(1.0f, 1.0f, 1.0f, 1.0f);
-    // Specular
-    QVector4D specular(0.0f, 0.0f, 0.0f, 1.0f);
-    viewer->glGetIntegerv(GL_LIGHT_MODEL_TWO_SIDE, &is_both_sides);
-
-    QVector4D cp(this->plane().a(),this->plane().b(),this->plane().c(),this->plane().d());
-
-    program_sphere->setUniformValue("cutplane", cp);
-    program_sphere->setUniformValue("mvp_matrix", mvp_mat);
-    program_sphere->setUniformValue("mv_matrix", mv_mat);
-    program_sphere->setUniformValue("light_pos", position);
-    program_sphere->setUniformValue("light_diff",diffuse);
-    program_sphere->setUniformValue("light_spec", specular);
-    program_sphere->setUniformValue("light_amb", ambient);
-    program_sphere->setUniformValue("spec_power", 51.8f);
-    program_sphere->setUniformValue("is_two_side", is_both_sides);
-
-    viewer->glDrawArraysInstanced(GL_TRIANGLES, 0,
-                                  static_cast<GLsizei>(s_vertex.size()/3),
-                                  static_cast<GLsizei>(s_radius.size()));
-    program_sphere->release();
-    vaos[Spheres]->release();
-  }
-}
-
-void Scene_c3t3_item::draw_edges(CGAL::Three::Viewer_interface* viewer) const {
-  Scene_c3t3_item* ncthis = const_cast<Scene_c3t3_item*>(this);
-  if (!are_buffers_filled)
-  {
-    ncthis->compute_elements();
-    ncthis->initialize_buffers(viewer);
-  }
-
-  if(renderingMode() == Wireframe)
-  {
-    vaos[Grid]->bind();
-    program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
-    attrib_buffers(viewer, PROGRAM_WITHOUT_LIGHT);
-    program->bind();
-    program->setAttributeValue("colors", QColor(Qt::black));
-    QMatrix4x4 f_mat;
-    for (int i = 0; i<16; i++)
-        f_mat.data()[i] = frame->matrix()[i];
-    program->setUniformValue("f_matrix", f_mat);
-    viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(positions_grid.size() / 3));
-    program->release();
-    vaos[Grid]->release();
-  }
-  vaos[Edges]->bind();
-  program = getShaderProgram(PROGRAM_C3T3_EDGES);
-  attrib_buffers(viewer, PROGRAM_C3T3_EDGES);
-  program->bind();
-  QVector4D cp(this->plane().a(),this->plane().b(),this->plane().c(),this->plane().d());
-  program->setUniformValue("cutplane", cp);
-  program->setAttributeValue("colors", QColor(Qt::black));
-  viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(positions_lines_size / 3));
-  program->release();
-  vaos[Edges]->release();
-
-  vaos[iEdges]->bind();
-  program = getShaderProgram(PROGRAM_NO_SELECTION);
-  attrib_buffers(viewer, PROGRAM_NO_SELECTION);
-  program->bind();
-  program->setAttributeValue("colors", QColor(Qt::black));
-  viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(positions_lines.size() / 3));
-  program->release();
-  vaos[iEdges]->release();
-
-  if(spheres_are_shown)
-  {
-      vaos[Wired_spheres]->bind();
-      program_sphere->bind();
-      //ModelViewMatrix used for the transformation of the camera.
-      QMatrix4x4 mvp_mat;
-      // ModelView Matrix used for the lighting system
-      QMatrix4x4 mv_mat;
-      GLdouble d_mat[16];
-      GLint is_both_sides = 0;
-      viewer->camera()->getModelViewProjectionMatrix(d_mat);
-      //Convert the GLdoubles matrices in GLfloats
-      for (int i=0; i<16; ++i){
-          mvp_mat.data()[i] = GLfloat(d_mat[i]);
-      }
-      viewer->camera()->getModelViewMatrix(d_mat);
-      for (int i=0; i<16; ++i)
-          mv_mat.data()[i] = GLfloat(d_mat[i]);
-      QVector4D position(0.0f,0.0f,1.0f, 1.0f );
-      QVector4D ambient(0.4f, 0.4f, 0.4f, 0.4f);
-      // Diffuse
-      QVector4D diffuse(1.0f, 1.0f, 1.0f, 1.0f);
-      // Specular
-      QVector4D specular(0.0f, 0.0f, 0.0f, 1.0f);
-      viewer->glGetIntegerv(GL_LIGHT_MODEL_TWO_SIDE, &is_both_sides);
-
-
-      program_sphere->setUniformValue("mvp_matrix", mvp_mat);
-      program_sphere->setUniformValue("mv_matrix", mv_mat);
-      program_sphere->setUniformValue("light_pos", position);
-      program_sphere->setUniformValue("light_diff",diffuse);
-      program_sphere->setUniformValue("light_spec", specular);
-      program_sphere->setUniformValue("light_amb", ambient);
-      program_sphere->setUniformValue("spec_power", 51.8f);
-      program_sphere->setUniformValue("is_two_side", is_both_sides);
-
-      viewer->glDrawArraysInstanced(GL_TRIANGLES, 0,
-                                    static_cast<GLsizei>(ws_vertex.size()/3),
-                                    static_cast<GLsizei>(s_radius.size()));
-      program_sphere->release();
-      vaos[Wired_spheres]->release();
-  }
-}
-
-void Scene_c3t3_item::draw_points(CGAL::Three::Viewer_interface * viewer) const
-{
-  Scene_c3t3_item* ncthis = const_cast<Scene_c3t3_item*>(this);
-  if (!are_buffers_filled)
-  {
-    ncthis->compute_elements();
-    ncthis-> initialize_buffers(viewer);
-  }
-  vaos[Edges]->bind();
-  program = getShaderProgram(PROGRAM_C3T3_EDGES);
-  attrib_buffers(viewer, PROGRAM_C3T3_EDGES);
-  program->bind();
-  QVector4D cp(this->plane().a(),this->plane().b(),this->plane().c(),this->plane().d());
-  program->setUniformValue("cutplane", cp);
-  program->setAttributeValue("colors", this->color());
-  viewer->glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(positions_lines.size() / 3));
-  vaos[Edges]->release();
-  program->release();
-
-  vaos[Grid]->bind();
-  program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
-  attrib_buffers(viewer, PROGRAM_WITHOUT_LIGHT);
-  program->bind();
-  program->setAttributeValue("colors", this->color());
-  QMatrix4x4 f_mat;
-  for (int i = 0; i<16; i++)
-    f_mat.data()[i] = frame->matrix()[i];
-  program->setUniformValue("f_matrix", f_mat);
-  viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(positions_grid.size() / 3));
-  program->release();
-  vaos[Grid]->release();
-}
-
-void Scene_c3t3_item::draw_triangle(const Kernel::Point_3& pa,
-  const Kernel::Point_3& pb,
-  const Kernel::Point_3& pc, bool /* is_cut */) const {
-
-  #undef darker
-  Kernel::Vector_3 n = cross_product(pb - pa, pc - pa);
-  n = n / CGAL::sqrt(n*n);
-
-
-  for (int i = 0; i<3; i++)
-  {
-    normals.push_back(n.x());
-    normals.push_back(n.y());
-    normals.push_back(n.z());
-  }
-  positions_poly.push_back(pa.x());
-  positions_poly.push_back(pa.y());
-  positions_poly.push_back(pa.z());
-
-  positions_poly.push_back(pb.x());
-  positions_poly.push_back(pb.y());
-  positions_poly.push_back(pb.z());
-
-  positions_poly.push_back(pc.x());
-  positions_poly.push_back(pc.y());
-  positions_poly.push_back(pc.z());
-
-
-
-}
-
-void Scene_c3t3_item::draw_triangle_edges(const Kernel::Point_3& pa,
-  const Kernel::Point_3& pb,
-  const Kernel::Point_3& pc)const {
-
-#undef darker
-  positions_lines.push_back(pa.x());
-  positions_lines.push_back(pa.y());
-  positions_lines.push_back(pa.z());
-
-  positions_lines.push_back(pb.x());
-  positions_lines.push_back(pb.y());
-  positions_lines.push_back(pb.z());
-
-  positions_lines.push_back(pb.x());
-  positions_lines.push_back(pb.y());
-  positions_lines.push_back(pb.z());
-
-  positions_lines.push_back(pc.x());
-  positions_lines.push_back(pc.y());
-  positions_lines.push_back(pc.z());
-
-  positions_lines.push_back(pc.x());
-  positions_lines.push_back(pc.y());
-  positions_lines.push_back(pc.z());
-
-  positions_lines.push_back(pa.x());
-  positions_lines.push_back(pa.y());
-  positions_lines.push_back(pa.z());
-
-}
-
-double Scene_c3t3_item::complex_diag() const {
-  const Bbox& bbox = this->bbox();
-  const double& xdelta = bbox.xmax - bbox.xmin;
-  const double& ydelta = bbox.ymax - bbox.ymin;
-  const double& zdelta = bbox.zmax - bbox.zmin;
-  const double diag = std::sqrt(xdelta*xdelta +
-    ydelta*ydelta +
-    zdelta*zdelta);
-  return diag * 0.7;
-}
-
-void Scene_c3t3_item::export_facets_in_complex()
-{
-  std::stringstream off_sstream;
-  c3t3().output_facets_in_complex_to_off(off_sstream);
-  std::string backup = off_sstream.str();
-  // Try to read .off in a polyhedron
-  Scene_polyhedron_item* item = new Scene_polyhedron_item;
-  if (!item->load(off_sstream))
-  {
-    delete item;
-    off_sstream.str(backup);
-
-    // Try to read .off in a polygon soup
-    Scene_polygon_soup_item* soup_item = new Scene_polygon_soup_item;
-
-    if (!soup_item->load(off_sstream)) {
-      delete soup_item;
-      return;
-    }
-
-    soup_item->setName(QString("%1_%2").arg(this->name()).arg("facets"));
-    last_known_scene->addItem(soup_item);
-  }
-  else{
-    item->setName(QString("%1_%2").arg(this->name()).arg("facets"));
-    last_known_scene->addItem(item);
-  }
-}
-
-QMenu* Scene_c3t3_item::contextMenu()
-{
-  const char* prop_name = "Menu modified by Scene_c3t3_item.";
-
-  QMenu* menu = Scene_item::contextMenu();
-
-  // Use dynamic properties:
-  // http://doc.qt.io/qt-5/qobject.html#property
-  bool menuChanged = menu->property(prop_name).toBool();
-
-  if (!menuChanged) {
-    QAction* actionExportFacetsInComplex =
-      menu->addAction(tr("Export facets in complex"));
-    actionExportFacetsInComplex->setObjectName("actionExportFacetsInComplex");
-    connect(actionExportFacetsInComplex,
-      SIGNAL(triggered()), this,
-      SLOT(export_facets_in_complex()));
-
-    QAction* actionShowSpheres =
-      menu->addAction(tr("Show protecting &spheres"));
-    actionShowSpheres->setCheckable(true);
-    actionShowSpheres->setObjectName("actionShowSpheres");
-    connect(actionShowSpheres, SIGNAL(toggled(bool)),
-            this, SLOT(show_spheres(bool)));
-    menu->setProperty(prop_name, true);
-  }
-  return menu;
-}
-
-
-void Scene_c3t3_item::initialize_intersection_buffers(CGAL::Three::Viewer_interface *viewer)
-{
- //vao containing the data for the facets
-  {
-    program = getShaderProgram(PROGRAM_WITH_LIGHT, viewer);
-    program->bind();
-
-    vaos[iFacets]->bind();
-    buffers[iFacet_vertices].bind();
-    buffers[iFacet_vertices].allocate(positions_poly.data(),
-      static_cast<int>(positions_poly.size()*sizeof(float)));
-    program->enableAttributeArray("vertex");
-    program->setAttributeBuffer("vertex", GL_FLOAT, 0, 3);
-    buffers[iFacet_vertices].release();
-
-    buffers[iFacet_normals].bind();
-    buffers[iFacet_normals].allocate(normals.data(),
-      static_cast<int>(normals.size()*sizeof(float)));
-    program->enableAttributeArray("normals");
-    program->setAttributeBuffer("normals", GL_FLOAT, 0, 3);
-    buffers[iFacet_normals].release();
-
-    buffers[iFacet_colors].bind();
-    buffers[iFacet_colors].allocate(f_colors.data(),
-      static_cast<int>(f_colors.size()*sizeof(float)));
-    program->enableAttributeArray("colors");
-    program->setAttributeBuffer("colors", GL_FLOAT, 0, 3);
-    buffers[iFacet_colors].release();
-
-    vaos[iFacets]->release();
-    program->release();
-
-  }
-    //vao containing the data for the lines
-    {
-        program = getShaderProgram(PROGRAM_NO_SELECTION, viewer);
-        program->bind();
-
-        vaos[iEdges]->bind();
-        buffers[iEdges_vertices].bind();
-        buffers[iEdges_vertices].allocate(positions_lines.data(),
-                                         static_cast<int>(positions_lines.size()*sizeof(float)));
-        program->enableAttributeArray("vertex");
-        program->setAttributeBuffer("vertex", GL_FLOAT, 0, 3);
-        buffers[iEdges_vertices].release();
-
-        vaos[iEdges]->release();
-        program->release();
-    }
-        are_intersection_buffers_filled = true;
-}
-
-
-void Scene_c3t3_item::initialize_buffers(CGAL::Three::Viewer_interface *viewer)
-{
-  //vao containing the data for the facets
-  {
-    program = getShaderProgram(PROGRAM_C3T3, viewer);
-    program->bind();
-
-    vaos[Facets]->bind();
-    buffers[Facet_vertices].bind();
-    buffers[Facet_vertices].allocate(positions_poly.data(),
-      static_cast<int>(positions_poly.size()*sizeof(float)));
-    program->enableAttributeArray("vertex");
-    program->setAttributeBuffer("vertex", GL_FLOAT, 0, 3);
-    buffers[Facet_vertices].release();
-
-    buffers[Facet_normals].bind();
-    buffers[Facet_normals].allocate(normals.data(),
-      static_cast<int>(normals.size()*sizeof(float)));
-    program->enableAttributeArray("normals");
-    program->setAttributeBuffer("normals", GL_FLOAT, 0, 3);
-    buffers[Facet_normals].release();
-
-    buffers[Facet_colors].bind();
-    buffers[Facet_colors].allocate(f_colors.data(),
-      static_cast<int>(f_colors.size()*sizeof(float)));
-    program->enableAttributeArray("colors");
-    program->setAttributeBuffer("colors", GL_FLOAT, 0, 3);
-    buffers[Facet_colors].release();
-
-    vaos[Facets]->release();
-    program->release();
-    
-    positions_poly_size = positions_poly.size();
-    positions_poly.clear();
-    positions_poly.swap(positions_poly);
-    normals.clear();
-    normals.swap(normals);
-    f_colors.clear();
-    f_colors.swap(f_colors);
-  }
-
-  //vao containing the data for the lines
-  {
-    program = getShaderProgram(PROGRAM_C3T3_EDGES, viewer);
-    program->bind();
-
-    vaos[Edges]->bind();
-    buffers[Edges_vertices].bind();
-    buffers[Edges_vertices].allocate(positions_lines.data(),
-                                     static_cast<int>(positions_lines.size()*sizeof(float)));
-    program->enableAttributeArray("vertex");
-    program->setAttributeBuffer("vertex", GL_FLOAT, 0, 3);
-    buffers[Edges_vertices].release();
-
-    vaos[Edges]->release();
-    program->release();
-
-    positions_lines_size = positions_lines.size();
-    positions_lines.clear();
-    positions_lines.swap(positions_lines);
-    
-  }
-
-  //vao containing the data for the grid
-  {
-    program = getShaderProgram(PROGRAM_WITHOUT_LIGHT, viewer);
-    program->bind();
-
-    vaos[Grid]->bind();
-    buffers[Grid_vertices].bind();
-    buffers[Grid_vertices].allocate(positions_grid.data(),
-                                    static_cast<int>(positions_grid.size()*sizeof(float)));
-    program->enableAttributeArray("vertex");
-    program->setAttributeBuffer("vertex", GL_FLOAT, 0, 3);
-    buffers[Grid_vertices].release();
-    vaos[Grid]->release();
-    program->release();
-  }
-
-  //vao containing the data for the spheres
-  {
-    program_sphere->bind();
-
-    vaos[Spheres]->bind();
-    buffers[Sphere_vertices].bind();
-    buffers[Sphere_vertices].allocate(s_vertex.data(),
-                                      static_cast<int>(s_vertex.size()*sizeof(float)));
-    program_sphere->enableAttributeArray("vertex");
-    program_sphere->setAttributeBuffer("vertex", GL_FLOAT, 0, 3);
-    buffers[Sphere_vertices].release();
-
-    buffers[Sphere_normals].bind();
-    buffers[Sphere_normals].allocate(s_normals.data(),
-                                     static_cast<int>(s_normals.size()*sizeof(float)));
-    program_sphere->enableAttributeArray("normals");
-    program_sphere->setAttributeBuffer("normals", GL_FLOAT, 0, 3);
-    buffers[Sphere_normals].release();
-
-    buffers[Sphere_colors].bind();
-    buffers[Sphere_colors].allocate(s_colors.data(),
-                                    static_cast<int>(s_colors.size()*sizeof(float)));
-    program_sphere->enableAttributeArray("colors");
-    program_sphere->setAttributeBuffer("colors", GL_FLOAT, 0, 3);
-    buffers[Sphere_colors].release();
-
-    buffers[Sphere_radius].bind();
-    buffers[Sphere_radius].allocate(s_radius.data(),
-                                    static_cast<int>(s_radius.size()*sizeof(float)));
-    program_sphere->enableAttributeArray("radius");
-    program_sphere->setAttributeBuffer("radius", GL_FLOAT, 0, 1);
-    buffers[Sphere_radius].release();
-
-    buffers[Sphere_center].bind();
-    buffers[Sphere_center].allocate(s_center.data(),
-                                    static_cast<int>(s_center.size()*sizeof(float)));
-    program_sphere->enableAttributeArray("center");
-    program_sphere->setAttributeBuffer("center", GL_FLOAT, 0, 3);
-    buffers[Sphere_center].release();
-
-    viewer->glVertexAttribDivisor(program_sphere->attributeLocation("center"), 1);
-    viewer->glVertexAttribDivisor(program_sphere->attributeLocation("radius"), 1);
-    viewer->glVertexAttribDivisor(program_sphere->attributeLocation("colors"), 1);
-    vaos[Spheres]->release();
-
-  }
-
-    //vao containing the data for the wired spheres
-    {
-      program_sphere->bind();
-
-      vaos[Wired_spheres]->bind();
-      buffers[Wired_spheres_vertices].bind();
-      buffers[Wired_spheres_vertices].allocate(s_vertex.data(),
-                                               static_cast<int>(s_vertex.size()*sizeof(float)));
-      program_sphere->enableAttributeArray("vertex");
-      program_sphere->setAttributeBuffer("vertex", GL_FLOAT, 0, 3);
-      buffers[Wired_spheres_vertices].release();
-
-      buffers[Sphere_normals].bind();
-      program_sphere->enableAttributeArray("normals");
-      program_sphere->setAttributeBuffer("normals", GL_FLOAT, 0, 3);
-      buffers[Sphere_normals].release();
-
-      buffers[Sphere_colors].bind();
-      program_sphere->enableAttributeArray("colors");
-      program_sphere->setAttributeBuffer("colors", GL_FLOAT, 0, 3);
-      buffers[Sphere_colors].release();
-
-      buffers[Sphere_radius].bind();
-      program_sphere->enableAttributeArray("radius");
-      program_sphere->setAttributeBuffer("radius", GL_FLOAT, 0, 1);
-      buffers[Sphere_radius].release();
-
-      buffers[Sphere_center].bind();
-      program_sphere->enableAttributeArray("center");
-      program_sphere->setAttributeBuffer("center", GL_FLOAT, 0, 3);
-      buffers[Sphere_center].release();
-
-      viewer->glVertexAttribDivisor(program_sphere->attributeLocation("center"), 1);
-      viewer->glVertexAttribDivisor(program_sphere->attributeLocation("radius"), 1);
-      viewer->glVertexAttribDivisor(program_sphere->attributeLocation("colors"), 1);
-      vaos[Wired_spheres]->release();
-
-      program_sphere->release();
-    }
-    program_sphere->release();
-    are_buffers_filled = true;
-}
-
-
-
-void Scene_c3t3_item::compute_intersection(const Primitive& facet)
-{  
-  const Kernel::Point_3& pa = facet.id().first->vertex(0)->point();
-  const Kernel::Point_3& pb = facet.id().first->vertex(1)->point();
-  const Kernel::Point_3& pc = facet.id().first->vertex(2)->point();
-  const Kernel::Point_3& pd = facet.id().first->vertex(3)->point();
-
-  QColor color = d->colors[facet.id().first->subdomain_index()].darker(150);
-
-  for(int i=0; i < 12;i++){
-    f_colors.push_back(color.redF());f_colors.push_back(color.greenF());f_colors.push_back(color.blueF());
-  }
-  draw_triangle(pb, pa, pc, true);
-  draw_triangle(pa, pb, pd, true);
-  draw_triangle(pa, pd, pc, true);
-  draw_triangle(pb, pc, pd, true);
-
-  draw_triangle_edges(pb, pa, pc);
-  draw_triangle_edges(pa, pb, pd);
-  draw_triangle_edges(pa, pd, pc);
-  draw_triangle_edges(pb, pc, pd);
-
-  {
-    Tr::Cell_handle nh = facet.id().first->neighbor(facet.id().second);
-    if(c3t3().is_in_complex(nh)){
-      const Kernel::Point_3& pa = nh->vertex(0)->point();
-      const Kernel::Point_3& pb = nh->vertex(1)->point();
-      const Kernel::Point_3& pc = nh->vertex(2)->point();
-      const Kernel::Point_3& pd = nh->vertex(3)->point();
-
-      for(int i=0; i < 12;i++){
-        f_colors.push_back(color.redF());f_colors.push_back(color.greenF());f_colors.push_back(color.blueF());
-      }
-      draw_triangle(pb, pa, pc, true);
-      draw_triangle(pa, pb, pd, true);
-      draw_triangle(pa, pd, pc, true);
-      draw_triangle(pb, pc, pd, true);
-
-      draw_triangle_edges(pb, pa, pc);
-      draw_triangle_edges(pa, pb, pd);
-      draw_triangle_edges(pa, pd, pc);
-      draw_triangle_edges(pb, pc, pd);
-    }
-  }
-
-}
-
-
-void Scene_c3t3_item::compute_intersections()
-{
-  positions_poly.clear();
-  normals.clear();
-  f_colors.clear();
-  positions_lines.clear();
-  const Kernel::Plane_3& plane = this->plane();
-  tree.all_intersected_primitives(plane, boost::make_function_output_iterator(Compute_intersection(*this)));
-}
-
-
-void Scene_c3t3_item::compute_elements()
-{
-  positions_poly.clear();
-  normals.clear();
-  f_colors.clear();
-  positions_lines.clear();
-  s_colors.resize(0);
-  s_center.resize(0);
-  s_radius.resize(0);
-
-
-  //The grid
-  {
-    float x = (2 * (float)complex_diag()) / 10.0;
-    float y = (2 * (float)complex_diag()) / 10.0;
-    for (int u = 0; u < 11; u++)
-    {
-
-      positions_grid.push_back(-(float)complex_diag() + x* u);
-      positions_grid.push_back(-(float)complex_diag());
-      positions_grid.push_back(0.0);
-
-      positions_grid.push_back(-(float)complex_diag() + x* u);
-      positions_grid.push_back((float)complex_diag());
-      positions_grid.push_back(0.0);
-    }
-    for (int v = 0; v<11; v++)
-    {
-
-      positions_grid.push_back(-(float)complex_diag());
-      positions_grid.push_back(-(float)complex_diag() + v * y);
-      positions_grid.push_back(0.0);
-
-      positions_grid.push_back((float)complex_diag());
-      positions_grid.push_back(-(float)complex_diag() + v * y);
-      positions_grid.push_back(0.0);
-    }
-  }
-
-
-  if (isEmpty()){
-    return;
-  }
-  for (Tr::Finite_facets_iterator
-         fit = c3t3().triangulation().finite_facets_begin(),
-         end = c3t3().triangulation().finite_facets_end();
-       fit != end; ++fit)
-    {
-      Tr::Cell_handle ch = fit->first, nh =ch->neighbor(fit->second);
-
-      if( (!c3t3().is_in_complex(ch)) &&  (!c3t3().is_in_complex(nh)) )
-        continue;
-      
-      if(c3t3().is_in_complex(ch)){
-        tree.insert(Primitive(fit));
-      } else{
-        int ni = nh->index(ch);
-        tree.insert(Primitive(Tr::Facet(nh,ni)));
-      }
-    }
-    tree.build();
-
-  //The facets
-  {  
-    for (C3t3::Facet_iterator
-      fit = c3t3().facets_begin(),
-      end = c3t3().facets_end();
-    fit != end; ++fit)
-    {
-      const Tr::Cell_handle& cell = fit->first;
-      const int& index = fit->second;
-      const Kernel::Point_3& pa = cell->vertex((index + 1) & 3)->point();
-      const Kernel::Point_3& pb = cell->vertex((index + 2) & 3)->point();
-      const Kernel::Point_3& pc = cell->vertex((index + 3) & 3)->point();
-
-      QColor color = d->colors[cell->surface_patch_index(index)];
-      f_colors.push_back(color.redF());f_colors.push_back(color.greenF());f_colors.push_back(color.blueF());
-      f_colors.push_back(color.redF());f_colors.push_back(color.greenF());f_colors.push_back(color.blueF());
-      f_colors.push_back(color.redF());f_colors.push_back(color.greenF());f_colors.push_back(color.blueF());
-      if ((index % 2 == 1) == c3t3().is_in_complex(cell)) draw_triangle(pb, pa, pc, false);
-      else draw_triangle(pa, pb, pc, false);
-      draw_triangle_edges(pa, pb, pc);
-    }
-
-
-  }
-  //The Spheres
-  {
-    for(Tr::Finite_vertices_iterator
-          vit = d->c3t3.triangulation().finite_vertices_begin(),
-          end =  d->c3t3.triangulation().finite_vertices_end();
-        vit != end; ++vit)
-    {
-      if(vit->point().weight()==0) continue;
-
-      typedef Tr::Vertex_handle Vertex_handle;
-      std::vector<Vertex_handle> incident_vertices;
-      d->c3t3.triangulation().incident_vertices(vit, std::back_inserter(incident_vertices));
-      bool red = vit->is_special();
-      for(std::vector<Vertex_handle>::const_iterator
-            vvit = incident_vertices.begin(), end = incident_vertices.end();
-          vvit != end; ++vvit)
-      {
-        if(Kernel::Sphere_3(vit->point().point(),
-                            vit->point().weight()).bounded_side((*vvit)->point().point())
-           == CGAL::ON_BOUNDED_SIDE)
-          red = true;
-      }
-      if(red){
-        s_colors.push_back(1.0);
-        s_colors.push_back(0.0);
-        s_colors.push_back(0.0);
-
-      }
-      else{
-        QColor c = this->color().darker(250);
-        s_colors.push_back(c.redF());
-        s_colors.push_back(c.greenF());
-        s_colors.push_back(c.blueF());
-      }
-      s_center.push_back(vit->point().point().x());
-      s_center.push_back(vit->point().point().y());
-      s_center.push_back(vit->point().point().z());
-
-      s_radius.push_back(CGAL::sqrt(vit->point().weight()));
-    }
-  }
-}
-
-
-bool Scene_c3t3_item::load_binary(std::istream& is)
-{
-  if(!CGAL::Mesh_3::load_binary_file(is, c3t3())) return false;
-  if(is && frame == 0) {
-    frame = new qglviewer::ManipulatedFrame();
-  }
-  reset_cut_plane();
-  if(is.good()) {
-    c3t3_changed();
-    changed();
-    return true;
-  }
-  else
-    return false;
-}
-
-void
-Scene_c3t3_item::reset_cut_plane() {
-  const Bbox& bbox = this->bbox();
-  const float xcenter = static_cast<float>((bbox.xmax+bbox.xmin)/2.);
-  const float ycenter = static_cast<float>((bbox.ymax+bbox.ymin)/2.);
-  const float zcenter = static_cast<float>((bbox.zmax+bbox.zmin)/2.);
-
-  frame->setPosition(qglviewer::Vec(xcenter, ycenter, zcenter));
-}
-
-void
-Scene_c3t3_item::setColor(QColor c)
-{
-  color_ = c;
-  compute_color_map(c);
-  invalidateOpenGLBuffers();
-// changed() doesn't work because the timerEvent delays it out of the draw
-// function and the intersection is not drawn before the next draw call
-  are_intersection_buffers_filled = false;
-}
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_c3t3_item.h b/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_c3t3_item.h
deleted file mode 100644
index 1da98da..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_c3t3_item.h
+++ /dev/null
@@ -1,263 +0,0 @@
-#ifndef SCENE_C3T3_ITEM_H
-#define SCENE_C3T3_ITEM_H
-
-#include "Scene_c3t3_item_config.h"
-#include "C3t3_type.h"
-
-#include <QVector>
-#include <QColor>
-#include <QPixmap>
-#include <QMenu>
-#include <set>
-
-#include <QtCore/qglobal.h>
-#include <CGAL/gl.h>
-#include <QGLViewer/manipulatedFrame.h>
-#include <QGLViewer/qglviewer.h>
-#include <QOpenGLVertexArrayObject>
-#include <QOpenGLBuffer>
-#include <QOpenGLShaderProgram>
-
-#include <CGAL/Three/Viewer_interface.h>
-
-#include <CGAL/Three/Scene_item.h>
-#include <Scene_polyhedron_item.h>
-#include <Scene_polygon_soup_item.h>
-#include <CGAL/IO/File_binary_mesh_3.h>
-
-#include <CGAL/AABB_tree.h>
-#include <CGAL/AABB_traits.h>
-#include <CGAL/AABB_C3T3_triangle_primitive.h>
-
-struct Scene_c3t3_item_priv;
-
-using namespace CGAL::Three;
-  class SCENE_C3T3_ITEM_EXPORT Scene_c3t3_item
-  : public Scene_item
-{
-  Q_OBJECT
-public:
-  typedef qglviewer::ManipulatedFrame ManipulatedFrame;
-
-  Scene_c3t3_item();
-  Scene_c3t3_item(const C3t3& c3t3);
-  ~Scene_c3t3_item();
-  void setColor(QColor c);
-  bool save_binary(std::ostream& os) const
-  {
-    return CGAL::Mesh_3::save_binary_file(os, c3t3());
-  }
-  bool save_ascii(std::ostream& os) const
-  {
-      os << "ascii CGAL c3t3 " << CGAL::Get_io_signature<C3t3>()() << "\n";
-      CGAL::set_ascii_mode(os);
-      return !!(os << c3t3());
-  }
-
-  void invalidateOpenGLBuffers()
-  {
-    are_buffers_filled = false;
-    compute_bbox();
-  }
-
-  void c3t3_changed();
-
-  const C3t3& c3t3() const;
-  C3t3& c3t3();
-
-  bool manipulatable() const {
-    return true;
-  }
-  ManipulatedFrame* manipulatedFrame() {
-    return frame;
-  }
-
-  void setPosition(float x, float y, float z) {
-    frame->setPosition(x, y, z);
-  }
-
-  void setNormal(float x, float y, float z) {
-    frame->setOrientation(x, y, z, 0.f);
-  }
-
-  Kernel::Plane_3 plane() const;
-
-  bool isFinite() const { return true; }
-  bool isEmpty() const {
-    return c3t3().triangulation().number_of_vertices() == 0
-      || (    c3t3().number_of_facets_in_complex() == 0
-           && c3t3().number_of_cells_in_complex()  == 0  );
-  }
-
-  void compute_bbox() const;
-
-  Scene_c3t3_item* clone() const {
-    return 0;
-  }
-
-  bool load_binary(std::istream& is);
-
-  // data item
-  const Scene_item* data_item() const;
-  void set_data_item(const Scene_item* data_item);
-
-  QString toolTip() const;
-
-  // Indicate if rendering mode is supported
-  bool supportsRenderingMode(RenderingMode m) const {
-    return (m != Gouraud && m != PointsPlusNormals && m != Splatting);
-  }
-
-  void draw(CGAL::Three::Viewer_interface* viewer) const;
-  void draw_edges(CGAL::Three::Viewer_interface* viewer) const;
-  void draw_points(CGAL::Three::Viewer_interface * viewer) const;
-private:
-
-  typedef CGAL::AABB_C3T3_triangle_primitive<Kernel,C3t3> Primitive;
-  typedef CGAL::AABB_traits<Kernel, Primitive> Traits;
-  typedef CGAL::AABB_tree<Traits> Tree;
-  typedef Tree::Point_and_primitive_id Point_and_primitive_id;
-
-  Tree tree;
-
-  bool need_changed;
-  void reset_cut_plane();
-  void draw_triangle(const Kernel::Point_3& pa,
-    const Kernel::Point_3& pb,
-    const Kernel::Point_3& pc, bool /* is_cut */) const;
-
-  void draw_triangle_edges(const Kernel::Point_3& pa,
-    const Kernel::Point_3& pb,
-    const Kernel::Point_3& pc)const;
-
-  double complex_diag() const;
-
-  void compute_color_map(const QColor& c);
-
-  public Q_SLOTS:
-  void export_facets_in_complex();
-
-  void data_item_destroyed();
-
-  void show_spheres(bool b)
-  {
-    spheres_are_shown = b;
-    Q_EMIT redraw();
-
-  }
-  virtual QPixmap graphicalToolTip() const;
-
-  void update_histogram();
-
-  void changed();
-
-  void timerEvent(QTimerEvent*);
-
-private:
-  void build_histogram();
-
-  QColor get_histogram_color(const double v) const;
-
-public:
-  QMenu* contextMenu();
-
-  void set_scene(CGAL::Three::Scene_interface* scene){ last_known_scene = scene; }
-
-protected:
-  Scene_c3t3_item_priv* d;
-
-private:
-
-  
-  
-  mutable bool are_intersection_buffers_filled;
-  enum Buffer
-  {
-      Facet_vertices =0,
-      Facet_normals,
-      Facet_colors,
-      Edges_vertices,
-      Grid_vertices,
-      Sphere_vertices,
-      Sphere_normals,
-      Sphere_colors,
-      Sphere_radius,
-      Sphere_center,
-      Wired_spheres_vertices,
-      iEdges_vertices,
-      iFacet_vertices,
-      iFacet_normals,
-      iFacet_colors,
-      NumberOfBuffers
-  };
-  enum Vao
-  {
-      Facets=0,
-      Edges,
-      Grid,
-      Spheres,
-      Wired_spheres,
-      iEdges,
-      iFacets,
-      NumberOfVaos
-  };
-  qglviewer::ManipulatedFrame* frame;
-  CGAL::Three::Scene_interface* last_known_scene;
-
-  bool spheres_are_shown;
-  const Scene_item* data_item_;
-  QPixmap histogram_;
-
-  typedef std::set<int> Indices;
-  Indices indices_;
-
-  //!Allows OpenGL 2.1 context to get access to glDrawArraysInstanced.
-  typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDARBPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
-  //!Allows OpenGL 2.1 context to get access to glVertexAttribDivisor.
-  typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORARBPROC) (GLuint index, GLuint divisor);
-  //!Allows OpenGL 2.1 context to get access to gkFrameBufferTexture2D.
-  PFNGLDRAWARRAYSINSTANCEDARBPROC glDrawArraysInstanced;
-  //!Allows OpenGL 2.1 context to get access to glVertexAttribDivisor.
-  PFNGLVERTEXATTRIBDIVISORARBPROC glVertexAttribDivisor;
-
-  mutable std::size_t positions_poly_size;
-  mutable std::size_t positions_lines_size;
-  mutable std::vector<float> positions_lines;
-  mutable std::vector<float> positions_grid;
-  mutable std::vector<float> positions_poly;
-  mutable std::vector<float> normals;
-  mutable std::vector<float> f_colors;
-  mutable std::vector<float> s_normals;
-  mutable std::vector<float> s_colors;
-  mutable std::vector<float> s_vertex;
-  mutable std::vector<float> ws_vertex;
-  mutable std::vector<float> s_radius;
-  mutable std::vector<float> s_center;
-  mutable QOpenGLShaderProgram *program;
-  mutable QOpenGLShaderProgram *program_sphere;
-
-  using Scene_item::initialize_buffers;
-  void initialize_buffers(CGAL::Three::Viewer_interface *viewer);
-  void initialize_intersection_buffers(CGAL::Three::Viewer_interface *viewer);
-  void compute_elements();
-  void compute_intersections();
-  void compute_intersection(const Primitive& facet);
-  void compile_shaders();
-
-struct Compute_intersection {
-  Scene_c3t3_item& item;
-
-  Compute_intersection(Scene_c3t3_item& item)
-    : item(item)
-  {}
-
-  void operator()(const Primitive& facet) const
-  {
-    item.compute_intersection(facet);
-  }
-};
-
-
-};
-
-#endif // SCENE_C3T3_ITEM_H
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_edit_polyhedron_item_config.h b/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_edit_polyhedron_item_config.h
deleted file mode 100644
index a1fde07..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_edit_polyhedron_item_config.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef SCENE_EDIT_POLYHEDRON_ITEM_CONFIG_H
-#define SCENE_EDIT_POLYHEDRON_ITEM_CONFIG_H
-
-#ifdef scene_edit_polyhedron_item_EXPORTS
-#  define SCENE_EDIT_POLYHEDRON_ITEM_EXPORT Q_DECL_EXPORT
-#else
-#  define SCENE_EDIT_POLYHEDRON_ITEM_EXPORT Q_DECL_IMPORT
-#endif
-
-#endif // SCENE_EDIT_POLYHEDRON_ITEM_CONFIG_H
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_group_item.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_group_item.cpp
deleted file mode 100644
index 86d2b22..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_group_item.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-
-#include <CGAL/Three/Scene_group_item.h>
-#include <QDebug>
-
-using namespace CGAL::Three;
-Scene_group_item::Scene_group_item(QString name)
-    :  Scene_item(0,0)
-{
-    this->name_ = name;
-    expanded = true;
-}
-
-bool Scene_group_item::isFinite() const
-{
-    Q_FOREACH(Scene_item *item, children)
-        if(!item->isFinite()){
-            return false;
-        }
-    return true;
-}
-
-bool Scene_group_item::isEmpty() const {
-    Q_FOREACH(Scene_item *item, children)
-        if(!item->isEmpty()){
-            return true;
-        }
-    return true;
-}
-
-Scene_group_item::Bbox Scene_group_item::bbox() const
-{
-    return Bbox(0, 0, 0, 0, 0,0);
-}
-
-
-bool Scene_group_item::supportsRenderingMode(RenderingMode m) const {
-    Q_FOREACH(Scene_item* item, children)
-        if(!item->supportsRenderingMode(m))
-            return false;
-    return !children.isEmpty();
-
-}
-
-QString Scene_group_item::toolTip() const {
-    QString str =
-            QObject::tr( "<p>Number of children: %1<br />").arg(children.size());
-    str+="</p>";
-    return str;
-}
-
-void Scene_group_item::addChild(Scene_item* new_item)
-{  
-    if(!children.contains(new_item))
-    {
-        children.append(new_item);
-        add_group_number(new_item);
-    }
-
-}
-
-void Scene_group_item::add_group_number(Scene_item * new_item)
-{
-
-    Scene_group_item* group =
-            qobject_cast<Scene_group_item*>(new_item);
-    if(group)
-      Q_FOREACH(Scene_item* child, group->getChildren())
-          add_group_number(child);
-    new_item->has_group++;
-}
-void Scene_group_item::setColor(QColor c)
-{
-  Scene_item::setColor(c);
-  Q_FOREACH(Scene_item* child, children)
-  {
-    child->setColor(c);
-  }
-}
-
-void Scene_group_item::setRenderingMode(RenderingMode m)
-{
-  Scene_item::setRenderingMode(m);
-  Q_FOREACH(Scene_item* child, children)
-  {
-    child->setRenderingMode(m);
-  }
-}
-
-void Scene_group_item::setVisible(bool b)
-{
-  Scene_item::setVisible(b);
-  Q_FOREACH(Scene_item* child, children)
-  {
-    child->setVisible(b);
-  }
-}
-
-bool Scene_group_item::isExpanded() const
-{
-  return expanded;
-}
-
-void Scene_group_item::setExpanded(bool b)
-{
-    expanded = b;
-}
-
-void Scene_group_item::moveDown(int i)
-{
-    children.move(i, i+1);
-}
-
-void Scene_group_item::moveUp(int i)
-{
-    children.move(i, i-1);
-}
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_implicit_function_item.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_implicit_function_item.cpp
deleted file mode 100644
index a17717d..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_implicit_function_item.cpp
+++ /dev/null
@@ -1,593 +0,0 @@
-#include "Scene_implicit_function_item.h"
-#include <QColor>
-#include <map>
-#include <CGAL/gl.h>
-#include <CGAL/Simple_cartesian.h>
-#include <QGLViewer/manipulatedFrame.h>
-
-#include "Color_ramp.h"
-#include <CGAL/Three/Viewer_interface.h>
-
-#include <CGAL/double.h>
-
-inline
-bool is_nan(double d)
-{
-    return !CGAL::Is_valid<double>()( d );
-}
-
-void Scene_implicit_function_item::initialize_buffers(CGAL::Three::Viewer_interface *viewer = 0) const
-{
-    if(GLuint(-1) == textureId) {
-        viewer->glGenTextures(1, &textureId);
-    }
-
-    //vao fot the cutting plane
-    {
-        program = getShaderProgram(PROGRAM_WITH_TEXTURE, viewer);
-        program->bind();
-        vaos[Plane]->bind();
-
-
-        buffers[Quad_vertices].bind();
-        buffers[Quad_vertices].allocate(positions_tex_quad.data(),
-                            static_cast<int>(positions_tex_quad.size()*sizeof(float)));
-        program->enableAttributeArray("vertex");
-        program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
-        buffers[Quad_vertices].release();
-
-        buffers[TexMap].bind();
-        buffers[TexMap].allocate(texture_map.data(),
-                            static_cast<int>(texture_map.size()*sizeof(float)));
-        program->enableAttributeArray("v_texCoord");
-        program->setAttributeBuffer("v_texCoord",GL_FLOAT,0,2);
-        buffers[TexMap].release();
-        program->setAttributeValue("normal", QVector3D(0.f,0.f,0.f));
-
-        program->release();
-        vaos[Plane]->release();
-    }
-    //vao fot the bbox
-    {
-        program = getShaderProgram(PROGRAM_WITHOUT_LIGHT, viewer);
-        program->bind();
-        vaos[BBox]->bind();
-
-
-        buffers[Cube_vertices].bind();
-        buffers[Cube_vertices].allocate(positions_cube.data(),
-                            static_cast<int>(positions_cube.size()*sizeof(float)));
-        program->enableAttributeArray("vertex");
-        program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
-        buffers[Cube_vertices].release();
-
-        program->release();
-        vaos[BBox]->release();
-    }
-    //vao fot the grid
-    {
-        program = getShaderProgram(PROGRAM_WITHOUT_LIGHT, viewer);
-        program->bind();
-        vaos[Grid]->bind();
-
-
-        buffers[Grid_vertices].bind();
-        buffers[Grid_vertices].allocate(positions_grid.data(),
-                            static_cast<int>(positions_grid.size()*sizeof(float)));
-        program->enableAttributeArray("vertex");
-        program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
-        buffers[Grid_vertices].release();
-        program->release();
-        vaos[Grid]->release();
-    }
-
-
-
-    viewer->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-    viewer->glBindTexture(GL_TEXTURE_2D, textureId);
-    viewer->glTexImage2D(GL_TEXTURE_2D,
-                 0,
-                 GL_RGB,
-                 texture->getWidth(),
-                 texture->getHeight(),
-                 0,
-                 GL_RGB,
-                 GL_UNSIGNED_BYTE,
-                 texture->getData());
-       viewer->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-       viewer->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-       viewer->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE );
-       viewer->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE );
-
-       are_buffers_filled = true;
-}
-
-void Scene_implicit_function_item::compute_vertices_and_texmap(void)
-{
-    positions_tex_quad.resize(0);
-    positions_cube.resize(0);
-    positions_grid.resize(0);
-    texture_map.resize(0);
-
-    const Bbox& b = bbox();
-    float x,y,z;
-    z = 0;
-    x = (b.xmax-b.xmin)/10.0;
-    y = (b.ymax-b.ymin)/10.0;
-    // The Quad
-    {
-
-
-        //A
-        positions_tex_quad.push_back(b.xmin);
-        positions_tex_quad.push_back(b.ymin);
-        positions_tex_quad.push_back(z);
-
-
-        //B
-        positions_tex_quad.push_back(b.xmin);
-        positions_tex_quad.push_back(b.ymax);
-        positions_tex_quad.push_back(z);
-
-
-        //C
-        positions_tex_quad.push_back(b.xmax);
-        positions_tex_quad.push_back(b.ymax);
-        positions_tex_quad.push_back(z);
-
-
-
-        //A
-        positions_tex_quad.push_back(b.xmin);
-        positions_tex_quad.push_back(b.ymin);
-        positions_tex_quad.push_back(z);
-
-
-        //C
-        positions_tex_quad.push_back(b.xmax);
-        positions_tex_quad.push_back(b.ymax);
-        positions_tex_quad.push_back(z);
-
-
-        //D
-        positions_tex_quad.push_back(b.xmax);
-        positions_tex_quad.push_back(b.ymin);
-        positions_tex_quad.push_back(z);
-
-
-        //UV Mapping x2 but I don't know why.
-        texture_map.push_back(0.0);
-        texture_map.push_back(0.0);
-
-        texture_map.push_back(0.0);
-        texture_map.push_back(1.0);
-
-        texture_map.push_back(1.0);
-        texture_map.push_back(1.0);
-
-        texture_map.push_back(0.0);
-        texture_map.push_back(0.0);
-
-        texture_map.push_back(1.0);
-        texture_map.push_back(1.0);
-
-        texture_map.push_back(1.0);
-        texture_map.push_back(0.0);
-
-
-
-    }
-    //The grid
-    {
-
-        for(int u = 0; u < 11; u++)
-        {
-
-            positions_grid.push_back(b.xmin + x* u);
-            positions_grid.push_back(b.ymin);
-            positions_grid.push_back(z);
-
-            positions_grid.push_back(b.xmin + x* u);
-            positions_grid.push_back(b.ymax);
-            positions_grid.push_back(z);
-        }
-        for(int v=0; v<11; v++)
-        {
-
-            positions_grid.push_back(b.xmin);
-            positions_grid.push_back(b.ymin + v * y);
-            positions_grid.push_back(z);
-
-            positions_grid.push_back(b.xmax);
-            positions_grid.push_back(b.ymin + v * y);
-            positions_grid.push_back(z);
-        }
-
-    }
-    //the Box
-    {
-
-        positions_cube.push_back(b.xmin);
-        positions_cube.push_back(b.ymin);
-        positions_cube.push_back(b.zmin);
-
-        positions_cube.push_back(b.xmin);
-        positions_cube.push_back(b.ymin);
-        positions_cube.push_back(b.zmax);
-
-
-        positions_cube.push_back(b.xmin);
-        positions_cube.push_back(b.ymin);
-        positions_cube.push_back(b.zmin);
-
-
-        positions_cube.push_back(b.xmin);
-        positions_cube.push_back(b.ymax);
-        positions_cube.push_back(b.zmin);
-
-
-        positions_cube.push_back(b.xmin);
-        positions_cube.push_back(b.ymin);
-        positions_cube.push_back(b.zmin);
-
-
-        positions_cube.push_back(b.xmax);
-        positions_cube.push_back(b.ymin);
-        positions_cube.push_back(b.zmin);
-
-
-        positions_cube.push_back(b.xmax);
-        positions_cube.push_back(b.ymin);
-        positions_cube.push_back(b.zmin);
-
-
-        positions_cube.push_back(b.xmax);
-        positions_cube.push_back(b.ymax);
-        positions_cube.push_back(b.zmin);
-
-
-        positions_cube.push_back(b.xmax);
-        positions_cube.push_back(b.ymin);
-        positions_cube.push_back(b.zmin);
-
-
-        positions_cube.push_back(b.xmax);
-        positions_cube.push_back(b.ymin);
-        positions_cube.push_back(b.zmax);
-
-
-        positions_cube.push_back(b.xmin);
-        positions_cube.push_back(b.ymax);
-        positions_cube.push_back(b.zmin);
-
-
-        positions_cube.push_back(b.xmin);
-        positions_cube.push_back(b.ymax);
-        positions_cube.push_back(b.zmax);
-
-
-        positions_cube.push_back(b.xmin);
-        positions_cube.push_back(b.ymax);
-        positions_cube.push_back(b.zmin);
-
-
-        positions_cube.push_back(b.xmax);
-        positions_cube.push_back(b.ymax);
-        positions_cube.push_back(b.zmin);
-
-
-        positions_cube.push_back(b.xmax);
-        positions_cube.push_back(b.ymax);
-        positions_cube.push_back(b.zmin);
-
-
-        positions_cube.push_back(b.xmax);
-        positions_cube.push_back(b.ymax);
-        positions_cube.push_back(b.zmax);
-
-
-        positions_cube.push_back(b.xmin);
-        positions_cube.push_back(b.ymin);
-        positions_cube.push_back(b.zmax);
-
-
-        positions_cube.push_back(b.xmin);
-        positions_cube.push_back(b.ymax);
-        positions_cube.push_back(b.zmax);
-
-
-        positions_cube.push_back(b.xmin);
-        positions_cube.push_back(b.ymin);
-        positions_cube.push_back(b.zmax);
-
-
-        positions_cube.push_back(b.xmax);
-        positions_cube.push_back(b.ymin);
-        positions_cube.push_back(b.zmax);
-
-
-        positions_cube.push_back(b.xmax);
-        positions_cube.push_back(b.ymax);
-        positions_cube.push_back(b.zmax);
-
-
-        positions_cube.push_back(b.xmin);
-        positions_cube.push_back(b.ymax);
-        positions_cube.push_back(b.zmax);
-
-
-        positions_cube.push_back(b.xmax);
-        positions_cube.push_back(b.ymax);
-        positions_cube.push_back(b.zmax);
-
-
-        positions_cube.push_back(b.xmax);
-        positions_cube.push_back(b.ymin);
-        positions_cube.push_back(b.zmax);
-
-    }
-
-    //The texture
-    for( int i=0 ; i < texture->getWidth() ; i++ )
-    {
-        for( int j=0 ; j < texture->getHeight() ; j++)
-        {
-            compute_texture(i,j);
-        }
-    }
-}
-
-Scene_implicit_function_item::
-Scene_implicit_function_item(Implicit_function_interface* f)
-    :CGAL::Three::Scene_item(4,3)
-    , function_(f)
-    , frame_(new ManipulatedFrame())
-    , need_update_(true)
-    , grid_size_(SCENE_IMPLICIT_GRID_SIZE)
-    , max_value_(0.)
-    , min_value_(0.)
-    , blue_color_ramp_()
-    , red_color_ramp_()
-    , textureId(-1)
-{
-    texture = new Texture(grid_size_-1,grid_size_-1);
-    blue_color_ramp_.build_blue();
-    red_color_ramp_.build_red();
-    startTimer(0);
-    //Generates an integer which will be used as ID for each buffer
-    compute_min_max();
-    compute_function_grid();
-    double offset_x = (bbox().xmin + bbox().xmax) / 2;
-    double offset_y = (bbox().ymin + bbox().ymax) / 2;
-    double offset_z = (bbox().zmin + bbox().zmax) / 2;
-    frame_->setPosition(offset_x, offset_y, offset_z);
-    frame_->setOrientation(1., 0, 0, 0);
-    connect(frame_, SIGNAL(modified()), this, SLOT(plane_was_moved()));
-
-    invalidateOpenGLBuffers();
-}
-
-
-Scene_implicit_function_item::~Scene_implicit_function_item()
-{
-
-    delete frame_;
-
-}
-
-
-void
-Scene_implicit_function_item::compute_bbox() const
-{
-    _bbox = function_->bbox();
-}
-
-void
-Scene_implicit_function_item::draw(CGAL::Three::Viewer_interface* viewer) const
-{
-    if(!are_buffers_filled)
-        initialize_buffers(viewer);
-
-    if(frame_->isManipulated()) {
-        if(need_update_) {
-            compute_function_grid();
-            need_update_ = false;
-        }
-    }
-    vaos[Plane]->bind();
-    viewer->glActiveTexture(GL_TEXTURE0);
-    viewer->glBindTexture(GL_TEXTURE_2D, textureId);
-    attrib_buffers(viewer, PROGRAM_WITH_TEXTURE);
-    QMatrix4x4 f_mat;
-    GLdouble d_mat[16];
-    frame_->getMatrix(d_mat);
-    //Convert the GLdoubles matrices in GLfloats
-    for (int i=0; i<16; ++i){
-        f_mat.data()[i] = GLfloat(d_mat[i]);
-    }
-    program = getShaderProgram(PROGRAM_WITH_TEXTURE);
-    program->bind();
-    program->setUniformValue("f_matrix", f_mat);
-    program->setUniformValue("light_amb", QVector4D(1.f,1.f,1.f,1.f));
-    program->setUniformValue("light_diff", QVector4D(0.f,0.f,0.f,1.f));
-    program->setAttributeValue("color_facets", QVector3D(1.f,1.f,1.f));
-    viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(positions_tex_quad.size()/3));
-    vaos[Plane]->release();
-    program->release();
-}
-
-void
-Scene_implicit_function_item::draw_edges(CGAL::Three::Viewer_interface* viewer) const
-{
-    if(!are_buffers_filled)
-        initialize_buffers(viewer);
-    //  draw_aux(viewer, true);
-    vaos[BBox]->bind();
-    attrib_buffers(viewer, PROGRAM_WITHOUT_LIGHT);
-    program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
-    program->bind();
-    program->setAttributeValue("colors", QVector3D(0.f,0.f,0.f));
-    viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(positions_cube.size()/3));
-    vaos[BBox]->release();
-    vaos[Grid]->bind();
-    QMatrix4x4 f_mat;
-    GLdouble d_mat[16];
-    frame_->getMatrix(d_mat);
-    //Convert the GLdoubles matrices in GLfloats
-    for (int i=0; i<16; ++i){
-        f_mat.data()[i] = double(d_mat[i]);
-    }
-    program->setUniformValue("f_matrix", f_mat);
-    program->setAttributeValue("colors", QVector3D(0.6f, 0.6f, 0.6f));
-    viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(positions_grid.size()/3));
-    vaos[Grid]->release();
-    program->release();
-}
-
-QString
-Scene_implicit_function_item::toolTip() const
-{
-    return tr("<p>Function <b>%1</b>")
-            .arg(this->name());
-}
-
-bool
-Scene_implicit_function_item::supportsRenderingMode(RenderingMode m) const
-{
-    switch ( m )
-    {
-    case Splatting:
-    case Gouraud:
-        return false;
-
-    case Points:
-    case Wireframe:
-    case Flat:
-    case FlatPlusEdges:
-        return true;
-
-    default:
-        return false;
-    }
-
-    return false;
-}
-
-void Scene_implicit_function_item::compute_texture(int i, int j)
-{
-    double v = (implicit_grid_[i][j]).second;
-
-    if(is_nan(v)) {
-        texture->setData(i,j,51,51,51);
-    } else
-        // determines grey level
-        if ( v > 0 )
-        {
-            v = v/max_value_;
-            GLdouble r = red_color_ramp_.r(v), g = red_color_ramp_.g(v), b = red_color_ramp_.b(v);
-            texture->setData(i,j,255*r,255*g,255*b);
-        }
-        else
-        {
-            v = v/min_value_;
-            GLdouble r = blue_color_ramp_.r(v), g = blue_color_ramp_.g(v), b = blue_color_ramp_.b(v);
-            texture->setData(i,j,255*r,255*g,255*b);
-        }
-}
-
-
-void
-Scene_implicit_function_item::
-compute_function_grid() const
-{
-    typedef CGAL::Simple_cartesian<double>  K;
-    typedef K::Aff_transformation_3         Aff_transformation;
-    typedef K::Point_3                      Point_3;
-
-    // Get transformation
-    const GLdouble* m = frame_->matrix();
-
-    // OpenGL matrices are row-major matrices
-    Aff_transformation t (m[0], m[4], m[8], m[12],
-            m[1], m[5], m[9], m[13],
-            m[2], m[6], m[10], m[14]);
-
-    double diag = bbox().diagonal_length() * .6;
-
-    const double dx = diag;
-    const double dy = diag;
-    const double z (0);
-
-    int nb_quad = grid_size_ - 1;
-
-    for(int i=0 ; i<grid_size_ ; ++i)
-    {
-        double x = -diag/2. + double(i)/double(nb_quad) * dx;
-
-        for(int j=0 ; j<grid_size_ ; ++j)
-        {
-            double y = -diag/2. + double(j)/double(nb_quad) * dy;
-
-            Point_3 query = t( Point_3(x, y, z) );
-            double v = function_->operator()(query.x(), query.y(), query.z());
-
-            implicit_grid_[i][j] = Point_value(Point(query.x(),query.y(),query.z()),v);
-        }
-    }
-
-    // Update
-    const_cast<Scene_implicit_function_item*>(this)->invalidateOpenGLBuffers();
-
-}
-
-void
-Scene_implicit_function_item::
-compute_min_max()
-{
-    if(function_->get_min_max(min_value_, max_value_))
-        return;
-
-    double probes_nb = double(grid_size_) / 2;
-
-    // Probe bounding box
-    const Bbox& b = bbox();
-
-    for ( int i = 0 ; i <= probes_nb ; ++i )
-    {
-        double x = b.xmin + double(i) * (b.xmax - b.xmin) / probes_nb;
-
-        for ( int j = 0 ; j <= probes_nb ; ++j )
-        {
-            double y = b.ymin + double(j) * (b.ymax - b.ymin) / probes_nb;
-
-            for ( int k = 0 ; k <= probes_nb ; ++k )
-            {
-                double z = b.zmin + double(k) * (b.zmax - b.zmin) / probes_nb;
-
-                double v = (*function_)(x,y,z);
-                if(is_nan(v)) continue;
-                max_value_ = (std::max)(v,max_value_);
-                min_value_ = (std::min)(v,min_value_);
-            }
-        }
-    }
-}
-
-void
-Scene_implicit_function_item::invalidateOpenGLBuffers()
-{
-    Scene_item::invalidateOpenGLBuffers();
-    compute_bbox();
-    compute_vertices_and_texmap();
-    are_buffers_filled = false;
-}
-
-
-void Scene_implicit_function_item::timerEvent(QTimerEvent* /*event*/)
-{ // just handle deformation - paint like selection is handled in eventFilter()
-  if(need_update_) {
-    compute_function_grid();
-    compute_vertices_and_texmap();
-    need_update_= false;
-  }
-}
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_implicit_function_item.h b/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_implicit_function_item.h
deleted file mode 100644
index 053f2d5..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_implicit_function_item.h
+++ /dev/null
@@ -1,130 +0,0 @@
-#ifndef SCENE_IMPLICIT_FUNCTION_ITEM_H
-#define SCENE_IMPLICIT_FUNCTION_ITEM_H
-
-#include <CGAL/Three/Scene_item.h>
-#include <CGAL/Three/Scene_interface.h>
-#include "Scene_implicit_function_item_config.h"
-#include "implicit_functions/Implicit_function_interface.h"
-#include "Color_ramp.h"
-#include <QGLViewer/manipulatedFrame.h>
-#include <Viewer.h>
-
-#define SCENE_IMPLICIT_GRID_SIZE 120
-
-class Viewer_interface;
-
-class Texture{
-private:
-     int Width;
-     int Height;
-     int size;
-    GLubyte *data;
-public:
-    Texture(int w, int h)
-    {
-        Width = w;
-        Height = h;
-        size = 3*Height*Width;
-        data = new GLubyte[size];
-    }
-    int getWidth() const {return Width;}
-    int getHeight() const {return Height;}
-    int getSize() const {return size;}
-    void setData(int i, int j, int r, int g, int b){
-        data[j*Width*3 +i*3] = r;
-        data[j*Width*3 +i*3+1] = g;
-        data[j*Width*3 +i*3+2] = b;}
-    GLubyte* getData(){return data; }
-
-};
-class SCENE_IMPLICIT_FUNCTION_ITEM_EXPORT Scene_implicit_function_item 
-  : public CGAL::Three::Scene_item
-{
-  Q_OBJECT
-  
-  typedef qglviewer::ManipulatedFrame ManipulatedFrame;
-  
-public:
-  Scene_implicit_function_item(Implicit_function_interface*);
-  virtual ~Scene_implicit_function_item();
-  
-  Implicit_function_interface* function() const { return function_; }
-
-  bool isFinite() const { return true; }
-  bool isEmpty() const { return false; }
-  void compute_bbox() const;
-
-  Scene_implicit_function_item* clone() const { return NULL; }
-
-  // rendering mode
-  virtual bool supportsRenderingMode(RenderingMode m) const;
-  virtual bool manipulatable() const { return true; }
-  virtual ManipulatedFrame* manipulatedFrame() { return frame_; }
-  
-
-
-  // actually draw() is also overloaded to detect when the cut plane is moved
-  virtual void draw()const {}
-  virtual void draw(CGAL::Three::Viewer_interface*) const;
-  virtual void draw_edges(CGAL::Three::Viewer_interface*) const;
-
-  virtual QString toolTip() const;
-  virtual void invalidateOpenGLBuffers();
-public Q_SLOTS:
-  void plane_was_moved() { need_update_ = true; }
-  void compute_function_grid() const;
-  void timerEvent(QTimerEvent*);
-
-private:
-  typedef qglviewer::Vec                  Point;
-  typedef std::pair <Point,double>        Point_value;
-  void compute_min_max();
-  
-private:
-  Implicit_function_interface* function_;
-  ManipulatedFrame* frame_;
-  
-  mutable bool need_update_;
-  int grid_size_;
-  double max_value_;
-  double min_value_;
-  mutable Point_value implicit_grid_[SCENE_IMPLICIT_GRID_SIZE][SCENE_IMPLICIT_GRID_SIZE];
-  
-  Color_ramp blue_color_ramp_;
-  Color_ramp red_color_ramp_;
-
-  enum VAOs {
-      Plane = 0,
-      BBox,
-      Grid,
-      NbOfVaos = Grid +1
-  };
-  enum VBOs {
-      Quad_vertices = 0,
-      TexMap,
-      Cube_vertices,
-      Grid_vertices,
-      NbOfVbos = Grid_vertices +1
-  };
-
-  std::vector<float> positions_cube;
-  std::vector<float> positions_grid;
-  std::vector<float> positions_tex_quad;
-  std::vector<float> texture_map;
-  Texture *texture;
-
-
-  mutable QOpenGLShaderProgram *program;
-  mutable GLuint textureId;
-
-
-
-  GLuint vao;
-  GLuint buffer[4];
-  using CGAL::Three::Scene_item::initialize_buffers;
-  void initialize_buffers(CGAL::Three::Viewer_interface *viewer) const;
-  void compute_vertices_and_texmap(void);
-  void compute_texture(int, int);
-};
-
-#endif // SCENE_IMPLICIT_FUNCTION_ITEM
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_item.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_item.cpp
deleted file mode 100644
index c4ba9a8..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_item.cpp
+++ /dev/null
@@ -1,165 +0,0 @@
-#include <CGAL/Three/Scene_item.h>
-#include <CGAL/Three/Scene_interface.h>
-#include <QMenu>
-#include <iostream>
-#include <QDebug>
-#include <CGAL/Three/Viewer_interface.h>
-const QColor CGAL::Three::Scene_item::defaultColor = QColor(100, 100, 255);
-
-CGAL::Three::Scene_item::~Scene_item() {
-  delete defaultContextMenu;
-  for(int i=0; i<buffersSize; i++)
-  {
-    buffers[i].destroy();
-  }
-  for(int i=0; i<vaosSize; i++)
-  {
-    delete vaos[i];
-  }
-}
-
-void CGAL::Three::Scene_item::itemAboutToBeDestroyed(CGAL::Three::Scene_item* item) {
-    if(this == item)
-    Q_EMIT aboutToBeDestroyed();
-}
-
-
-QString modeName(RenderingMode mode) {
-    switch(mode)
-    {
-    case Points:
-        return QObject::tr("points");
-    case Wireframe:
-        return QObject::tr("wire");
-    case Flat:
-        return QObject::tr("flat");
-    case FlatPlusEdges:
-        return QObject::tr("flat+edges");
-    case Gouraud:
-        return QObject::tr("Gouraud");
-    case PointsPlusNormals:
-        return QObject::tr("pts+normals");
-    case Splatting:
-        return QObject::tr("splats");
-    default:
-        Q_ASSERT(false);
-        return QObject::tr("unknown");
-    }
-}
-
-const char* slotName(RenderingMode mode) {
-    switch(mode)
-    {
-    case Points:
-        return SLOT(setPointsMode());
-    case Wireframe:
-        return SLOT(setWireframeMode());
-    case Flat:
-        return SLOT(setFlatMode());
-    case FlatPlusEdges:
-        return SLOT(setFlatPlusEdgesMode());
-    case Gouraud:
-        return SLOT(setGouraudMode());
-    case PointsPlusNormals:
-        return SLOT(setPointsPlusNormalsMode());
-    case Splatting:
-        return SLOT(setSplattingMode());
-    default:
-        Q_ASSERT(false);
-        return "";
-    }
-}
-
-// Rendering mode as a human readable string
-QString CGAL::Three::Scene_item::renderingModeName() const
-{
-    return modeName(renderingMode());
-} 
-QMenu* CGAL::Three::Scene_item::contextMenu()
-{
-    if(defaultContextMenu) {
-        defaultContextMenu->setTitle(name());
-        return defaultContextMenu;
-    }
-
-    defaultContextMenu = new QMenu(name());
-    // defaultContextMenu->addAction(name());
-    // defaultContextMenu->addSeparator();
-    // QMenu* modeMenu = new QMenu(QObject::tr("Rendering mode"),
-    //                             defaultContextMenu);
-    for(unsigned int mode = 0; mode < NumberOfRenderingMode;
-        ++mode)
-    {
-        if(!supportsRenderingMode(RenderingMode(mode))) continue;
-        QString mName = modeName(RenderingMode(mode));
-        defaultContextMenu->addAction(tr("Set %1 Mode")
-                                      .arg(mName),
-                                      this,
-                                      slotName(RenderingMode(mode)));
-    }
-    // defaultContextMenu->addAction(modeMenu->menuAction());
-    return defaultContextMenu;
-}
-
-void CGAL::Three::Scene_item::invalidateOpenGLBuffers() {}
-
-void CGAL::Three::Scene_item::selection_changed(bool) {}
-
-
-void CGAL::Three::Scene_item::select(double /*orig_x*/,
-                        double /*orig_y*/,
-                        double /*orig_z*/,
-                        double /*dir_x*/,
-                        double /*dir_y*/,
-                        double /*dir_z*/)
-{
-}
-
-// set-up the uniform attributes of the shader programs.
-void CGAL::Three::Scene_item::attrib_buffers(CGAL::Three::Viewer_interface* viewer,
-                                             int program_name) const
-{
-    viewer->attrib_buffers(program_name);
-    viewer->getShaderProgram(program_name)->bind();
-    if(is_selected)
-        viewer->getShaderProgram(program_name)->setUniformValue("is_selected", true);
-    else
-        viewer->getShaderProgram(program_name)->setUniformValue("is_selected", false);
-    QColor c = this->color();
-    if(program_name == Scene_item::PROGRAM_WITH_TEXTURE)
-    {
-       if(is_selected) c = c.lighter(120);
-       viewer->getShaderProgram(program_name)->setAttributeValue
-         ("color_facets",
-          c.redF(),
-          c.greenF(),
-          c.blueF());
-    }
-    else if(program_name == PROGRAM_WITH_TEXTURED_EDGES)
-    {
-        if(is_selected) c = c.lighter(50);
-        viewer->getShaderProgram(program_name)->setUniformValue
-          ("color_lines",
-           QVector3D(c.redF(), c.greenF(), c.blueF()));
-    }
-    viewer->getShaderProgram(program_name)->release();
-}
-
-
-QOpenGLShaderProgram* CGAL::Three::Scene_item::getShaderProgram(int name, CGAL::Three::Viewer_interface * viewer) const
-{
-    if(viewer == 0)
-        viewer = dynamic_cast<CGAL::Three::Viewer_interface*>(*QGLViewer::QGLViewerPool().begin());
-    return viewer->getShaderProgram(name);
-}
-
-CGAL::Three::Scene_item::Header_data CGAL::Three::Scene_item::header() const
-{
-  CGAL::Three::Scene_item::Header_data data;
-  return data;
-}
-
-QString CGAL::Three::Scene_item::compute_stats(int )
-{
-  return QString();
-}
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_nef_polyhedron_item.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_nef_polyhedron_item.cpp
deleted file mode 100644
index c27b466..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_nef_polyhedron_item.cpp
+++ /dev/null
@@ -1,678 +0,0 @@
-#include "Scene_nef_polyhedron_item.h"
-#include "Scene_polyhedron_item.h"
-#include "Nef_type.h"
-#include "Polyhedron_type.h"
-#include <CGAL/Polyhedron_incremental_builder_3.h>
-// #include <CGAL/OFF_to_nef_3.h>
-#include <CGAL/IO/Polyhedron_iostream.h>
-#include <CGAL/IO/Nef_polyhedron_iostream_3.h>
-#include <CGAL/Inverse_index.h>
-
-#include <QObject>
-
-#include <CGAL/minkowski_sum_3.h>
-#include <CGAL/convex_decomposition_3.h>
-
-#include <CGAL/Triangulation_2_filtered_projection_traits_3.h>
-#include <CGAL/Triangulation_vertex_base_with_info_2.h>
-#include <CGAL/Triangulation_face_base_with_info_2.h>
-
-typedef Nef_polyhedron::Traits Traits;
-typedef Nef_polyhedron::Halffacet Facet;
-typedef CGAL::Triangulation_2_filtered_projection_traits_3<Traits>   P_traits;
-typedef Nef_polyhedron::Halfedge_const_handle Halfedge_handle;
-struct Face_info {
-    Nef_polyhedron::Halfedge_const_handle e[3];
-    bool is_external;
-};
-typedef CGAL::Triangulation_vertex_base_with_info_2<Halfedge_handle,
-P_traits>        Vb;
-typedef CGAL::Triangulation_face_base_with_info_2<Face_info,
-P_traits>          Fb1;
-typedef CGAL::Constrained_triangulation_face_base_2<P_traits, Fb1>   Fb;
-typedef CGAL::Triangulation_data_structure_2<Vb,Fb>                  TDS;
-typedef CGAL::No_intersection_tag                                    Itag;
-typedef CGAL::Constrained_Delaunay_triangulation_2<P_traits,
-TDS,
-Itag>             CDTbase;
-typedef CGAL::Constrained_triangulation_plus_2<CDTbase>              CDT;
-
-
-struct DPoint {
-    DPoint(GLdouble x, GLdouble y, GLdouble z)
-    {
-        coords[0] = x;
-        coords[1] = y;
-        coords[2] = z;
-    }
-    GLdouble coords[3];
-};
-Scene_nef_polyhedron_item::Scene_nef_polyhedron_item()
-    : Scene_item(NbOfVbos,NbOfVaos),
-      nef_poly(new Nef_polyhedron)
-{
-    is_selected = true;
-    nb_points = 0;
-    nb_lines = 0;
-    nb_facets = 0;
-}
-
-Scene_nef_polyhedron_item::Scene_nef_polyhedron_item(Nef_polyhedron* const p)
-    : Scene_item(NbOfVbos,NbOfVaos),
-      nef_poly(p)
-{
-    is_selected = true;
-    nb_points = 0;
-    nb_lines = 0;
-    nb_facets = 0;
-}
-
-Scene_nef_polyhedron_item::Scene_nef_polyhedron_item(const Nef_polyhedron& p)
-    : Scene_item(NbOfVbos,NbOfVaos),
-      nef_poly(new Nef_polyhedron(p))
-{
-     is_selected = true;
-     nb_points = 0;
-     nb_lines = 0;
-     nb_facets = 0;
-}
-
-Scene_nef_polyhedron_item::~Scene_nef_polyhedron_item()
-{
-    delete nef_poly;
-}
-
-void Scene_nef_polyhedron_item::initialize_buffers(CGAL::Three::Viewer_interface *viewer) const
-{
-    //vao for the facets
-    {
-        program = getShaderProgram(PROGRAM_WITH_LIGHT, viewer);
-        program->bind();
-
-        vaos[Facets]->bind();
-        buffers[Facets_vertices].bind();
-        buffers[Facets_vertices].allocate(positions_facets.data(),
-                            static_cast<int>(positions_facets.size()*sizeof(double)));
-        program->enableAttributeArray("vertex");
-        program->setAttributeBuffer("vertex",GL_DOUBLE,0,3);
-        buffers[Facets_vertices].release();
-
-
-
-        buffers[Facets_normals].bind();
-        buffers[Facets_normals].allocate(normals.data(),
-                            static_cast<int>(normals.size()*sizeof(double)));
-        program->enableAttributeArray("normals");
-        program->setAttributeBuffer("normals",GL_DOUBLE,0,3);
-        buffers[Facets_normals].release();
-
-        nb_facets = positions_facets.size();
-        positions_facets.resize(0);
-        std::vector<double>(positions_facets).swap(positions_facets);
-
-        normals.resize(0);
-        std::vector<double>(normals).swap(normals);
-
-        program->release();
-
-    }
-    //vao for the edges
-    {
-        program = getShaderProgram(PROGRAM_WITHOUT_LIGHT, viewer);
-        program->bind();
-
-        vaos[Edges]->bind();
-        buffers[Edges_vertices].bind();
-        buffers[Edges_vertices].allocate(positions_lines.data(),
-                            static_cast<int>(positions_lines.size()*sizeof(double)));
-        program->enableAttributeArray("vertex");
-        program->setAttributeBuffer("vertex",GL_DOUBLE,0,3);
-        buffers[Edges_vertices].release();
-
-
-        nb_lines = positions_lines.size();
-        positions_lines.resize(0);
-        std::vector<double>(positions_lines).swap(positions_lines);
-        vaos[Edges]->release();
-        program->release();
-    }
-    //vao for the points
-    {
-        program = getShaderProgram(PROGRAM_WITHOUT_LIGHT, viewer);
-        program->bind();
-
-        vaos[Points]->bind();
-        buffers[Points_vertices].bind();
-        buffers[Points_vertices].allocate(positions_points.data(),
-                            static_cast<int>(positions_points.size()*sizeof(double)));
-        program->enableAttributeArray("vertex");
-        program->setAttributeBuffer("vertex",GL_DOUBLE,0,3);
-        buffers[Points_vertices].release();
-
-        vaos[Points]->release();
-
-        nb_points = positions_points.size();
-        positions_points.resize(0);
-        std::vector<double>(positions_points).swap(positions_points);
-        program->release();
-    }
-    are_buffers_filled = true;
-}
-void Scene_nef_polyhedron_item::compute_normals_and_vertices(void) const
-{
-     int count = 0;
-    positions_facets.resize(0);
-    positions_points.resize(0);
-    normals.resize(0);
-    positions_lines.resize(0);
-    //The Facets
-    {
-        for(Nef_polyhedron::Halffacet_const_iterator
-            f = nef_poly->halffacets_begin (),
-            end = nef_poly->halffacets_end();
-            f != end; ++f)
-        {
-            if(f->is_twin()) continue;
-            count++;
-            Nef_polyhedron::Vector_3 v = f->plane().orthogonal_vector();
-            P_traits cdt_traits(v);
-            CDT cdt(cdt_traits);
-
-            for(Nef_polyhedron::Halffacet_cycle_const_iterator
-                fc = f->facet_cycles_begin(),
-                end = f->facet_cycles_end();
-                fc != end; ++fc)
-            {
-                if ( fc.is_shalfedge() )
-                {
-
-                    Nef_polyhedron::SHalfedge_const_handle h = fc;
-                    Nef_polyhedron::SHalfedge_around_facet_const_circulator hc(h), he(hc);
-
-                    CDT::Vertex_handle previous, first;
-
-                    do {
-                        Nef_polyhedron::SVertex_const_handle v = hc->source();
-                        const Nef_polyhedron::Point_3& point = v->source()->point();
-                        CDT::Vertex_handle vh = cdt.insert(point);
-                        if(first == 0) {
-                            first = vh;
-                        }
-                        vh->info() = hc->source();
-                        if(previous != 0 && previous != vh) {
-                            cdt.insert_constraint(previous, vh);
-                        }
-                        previous = vh;
-                    } while( ++hc != he );
-
-                    cdt.insert_constraint(previous, first);
-
-                    // sets mark is_external
-                    for(CDT::All_faces_iterator
-                        fit = cdt.all_faces_begin(),
-                        end = cdt.all_faces_end();
-                        fit != end; ++fit)
-                    {
-                        fit->info().is_external = false;
-
-                    }
-                    //check if the facet is external or internal
-                    std::queue<CDT::Face_handle> face_queue;
-                    face_queue.push(cdt.infinite_vertex()->face());
-
-                    while(! face_queue.empty() ) {
-                        CDT::Face_handle fh = face_queue.front();
-                        face_queue.pop();
-                        if(fh->info().is_external) continue;
-                        fh->info().is_external = true;
-                        for(int i = 0; i <3; ++i) {
-                            if(!cdt.is_constrained(std::make_pair(fh, i)))
-                            {
-                                face_queue.push(fh->neighbor(i));
-                            }
-                        }
-
-                    }
-                    //iterates on the internal faces to add the vertices to the positions
-                    //and the normals to the appropriate vectors
-
-                    for(CDT::Finite_faces_iterator
-                        ffit = cdt.finite_faces_begin(),
-                        end = cdt.finite_faces_end();
-                        ffit != end; ++ffit)
-                    {
-
-
-                        if(ffit->info().is_external){ continue;}
-                        for(int i = 0; i<3; i++)
-                        {
-                            positions_facets.push_back(CGAL::to_double(ffit->vertex(i)->point().x()));
-                            positions_facets.push_back(CGAL::to_double(ffit->vertex(i)->point().y()));
-                            positions_facets.push_back(CGAL::to_double(ffit->vertex(i)->point().z()));
-
-                        }
-
-
-
-                        Nef_polyhedron::Vector_3 v = f->plane().orthogonal_vector();
-                        GLdouble normal[3];
-                        normal[0] = CGAL::to_double(v.x());
-                        normal[1] = CGAL::to_double(v.y());
-                        normal[2] = CGAL::to_double(v.z());
-                        GLdouble norm = normal[0]*normal[0]
-                                + normal[1]*normal[1]
-                                + normal[2]*normal[2];
-                        norm = CGAL::sqrt(norm);
-                        normal[0] /= norm;
-                        normal[1] /= norm;
-                        normal[2] /= norm;
-
-                        normals.push_back(normal[0]);
-                        normals.push_back(normal[1]);
-                        normals.push_back(normal[2]);
-
-                        normals.push_back(normal[0]);
-                        normals.push_back(normal[1]);
-                        normals.push_back(normal[2]);
-
-                        normals.push_back(normal[0]);
-                        normals.push_back(normal[1]);
-                        normals.push_back(normal[2]);
-
-                    }
-                }
-            }
-        }
-
-    } // end facets
-
-    //The Lines
-    {
-       for(Nef_polyhedron::Halfedge_const_iterator
-            e = nef_poly->halfedges_begin(),
-            end = nef_poly->halfedges_end();
-            e != end; ++e)
-        {
-            if (e->is_twin()) continue;
-            const Nef_polyhedron::Vertex_const_handle& s = e->source();
-            const Nef_polyhedron::Vertex_const_handle& t = e->twin()->source();
-            const Nef_polyhedron::Point_3& a = s->point();
-            const Nef_polyhedron::Point_3& b = t->point();
-
-            positions_lines.push_back(CGAL::to_double(a.x()));
-            positions_lines.push_back(CGAL::to_double(a.y()));
-            positions_lines.push_back(CGAL::to_double(a.z()));
-
-            positions_lines.push_back(CGAL::to_double(b.x()));
-            positions_lines.push_back(CGAL::to_double(b.y()));
-            positions_lines.push_back(CGAL::to_double(b.z()));
-
-
-        }
-    }
-    //The points
-    {
-        for(Nef_polyhedron::Vertex_const_iterator
-            v = nef_poly->vertices_begin(),
-            end = nef_poly->vertices_end();
-            v != end; ++v)
-        {
-            const Nef_polyhedron::Point_3& p = v->point();
-            positions_points.push_back(CGAL::to_double(p.x()));
-            positions_points.push_back(CGAL::to_double(p.y()));
-            positions_points.push_back(CGAL::to_double(p.z()));
-
-                color_points.push_back(this->color().lighter(50).redF());
-                color_points.push_back(this->color().lighter(50).greenF());
-                color_points.push_back(this->color().lighter(50).blueF());
-
-                color_points.push_back(this->color().lighter(50).redF());
-                color_points.push_back(this->color().lighter(50).greenF());
-                color_points.push_back(this->color().lighter(50).blueF());
-
-        }
-
-    } //end points
-}
-Scene_nef_polyhedron_item* 
-Scene_nef_polyhedron_item::clone() const {
-    return new Scene_nef_polyhedron_item(*nef_poly);
-}
-
-bool
-Scene_nef_polyhedron_item::load_from_off(std::istream& in)
-{
-    //   const std::size_t discarded = CGAL::OFF_to_nef_3(in, *nef_poly);
-    //   return discarded != 0;
-
-    Exact_polyhedron exact_poly;
-    in >> exact_poly;
-    *nef_poly = Nef_polyhedron(exact_poly);
-
-    //   Polyhedron poly;
-    //   in >> poly;
-    //   *nef_poly = Nef_polyhedron(poly);
-    invalidateOpenGLBuffers();
-    return (bool) in;
-}
-
-QFont 
-Scene_nef_polyhedron_item::font() const {
-    QFont font;
-    font.setItalic(!font.italic());
-    return font;
-}
-
-bool
-Scene_nef_polyhedron_item::load(std::istream& in)
-{
-    in >> *nef_poly;
-    invalidateOpenGLBuffers();
-    return (bool) in;
-}
-
-bool
-Scene_nef_polyhedron_item::save(std::ostream& in) const
-{
-    in << *nef_poly;
-    return (bool) in;
-}
-
-QString 
-Scene_nef_polyhedron_item::toolTip() const
-{
-    if(!nef_poly)
-        return QString();
-
-    return QObject::tr("<p><b>%1</b> (mode: %5, color: %6)<br />"
-                       "<i>Nef_3 polyhedron</i></p>"
-                       "<p>Number of vertices: %2<br />"
-                       "Number of edges: %3<br />"
-                       "Number of facets: %4<br />"
-                       "number of volumes: %7</p>")
-            .arg(this->name())
-            .arg(nef_poly->number_of_vertices())
-            .arg(nef_poly->number_of_edges())
-            .arg(nef_poly->number_of_facets())
-            .arg(this->renderingModeName())
-            .arg(this->color().name())
-            .arg(nef_poly->number_of_volumes());
-}
-
-void Scene_nef_polyhedron_item::draw(CGAL::Three::Viewer_interface* viewer) const
-{
-    if(!are_buffers_filled)
-    {
-        compute_normals_and_vertices();
-        initialize_buffers(viewer);
-    }
-    vaos[Facets]->bind();
-
-    // tells the GPU to use the program just created
-    program=getShaderProgram(PROGRAM_WITH_LIGHT);
-    attrib_buffers(viewer,PROGRAM_WITH_LIGHT);
-    program->bind();
-    program->setUniformValue("is_two_side", 1);
-    viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(nb_facets/3));
-    vaos[Facets]->release();
-    program->release();
-    GLfloat point_size;
-    viewer->glGetFloatv(GL_POINT_SIZE, &point_size);
-    viewer->glPointSize(10.f);
-
-    draw_points(viewer);
-    viewer->glPointSize(point_size);
-
-}
-void Scene_nef_polyhedron_item::draw_edges(CGAL::Three::Viewer_interface* viewer) const
-{
-    if(!are_buffers_filled)
-    {
-        compute_normals_and_vertices();
-        initialize_buffers(viewer);
-    }
-
-    vaos[Edges]->bind();
-    program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
-    attrib_buffers(viewer ,PROGRAM_WITHOUT_LIGHT);
-    program->bind();
-    viewer->glDrawArrays(GL_LINES,0,static_cast<GLsizei>(nb_lines/3));
-    vaos[Edges]->release();
-    program->release();
-    if(renderingMode() == PointsPlusNormals)
-    {
-        GLfloat point_size;
-        viewer->glGetFloatv(GL_POINT_SIZE, &point_size);
-        viewer->glPointSize(10.f);
-
-        draw_points(viewer);
-        viewer->glPointSize(point_size);
-    }
-}
-void Scene_nef_polyhedron_item::draw_points(CGAL::Three::Viewer_interface* viewer) const
-{
-    if(!are_buffers_filled)
-    {
-        compute_normals_and_vertices();
-        initialize_buffers(viewer);
-    }
-    vaos[Points]->bind();
-    program=getShaderProgram(PROGRAM_WITHOUT_LIGHT);
-    attrib_buffers(viewer ,PROGRAM_WITHOUT_LIGHT);
-    program->bind();
-    program->setAttributeValue("colors", this->color());
-    viewer->glDrawArrays(GL_POINTS,0,static_cast<GLsizei>(nb_points/3));
-    vaos[Points]->release();
-    program->release();
-
-}
-
-
-Nef_polyhedron* 
-Scene_nef_polyhedron_item::nef_polyhedron() {
-    return nef_poly;
-}
-
-bool
-Scene_nef_polyhedron_item::isEmpty() const {
-    return (nef_poly == 0) || nef_poly->is_empty();
-}
-
-void
-Scene_nef_polyhedron_item::compute_bbox() const {
-    if(isEmpty())
-    {
-        _bbox = Bbox();
-        return;
-    }
-    CGAL::Bbox_3 bbox(nef_poly->vertices_begin()->point().bbox());
-    for(Nef_polyhedron::Vertex_const_iterator it = nef_poly->vertices_begin();
-        it != nef_poly->vertices_end();
-        ++it) {
-        bbox = bbox + it->point().bbox();
-    }
-    _bbox = Bbox(bbox.xmin(),bbox.ymin(),bbox.zmin(),
-                bbox.xmax(),bbox.ymax(),bbox.zmax());
-}
-
-// quick hacks to convert polyhedra from exact to inexact and vice-versa
-template <class Polyhedron_input,
-          class Polyhedron_output>
-struct Copy_polyhedron_to 
-        : public CGAL::Modifier_base<typename Polyhedron_output::HalfedgeDS>
-{
-    Copy_polyhedron_to(const Polyhedron_input& in_poly)
-        : in_poly(in_poly) {}
-
-    void operator()(typename Polyhedron_output::HalfedgeDS& out_hds)
-    {
-        typedef typename Polyhedron_output::HalfedgeDS Output_HDS;
-
-        CGAL::Polyhedron_incremental_builder_3<Output_HDS> builder(out_hds);
-
-        typedef typename Polyhedron_input::Vertex_const_iterator Vertex_const_iterator;
-        typedef typename Polyhedron_input::Facet_const_iterator  Facet_const_iterator;
-        typedef typename Polyhedron_input::Halfedge_around_facet_const_circulator HFCC;
-
-        builder.begin_surface(in_poly.size_of_vertices(),
-                              in_poly.size_of_facets(),
-                              in_poly.size_of_halfedges());
-
-        for(Vertex_const_iterator
-            vi = in_poly.vertices_begin(), end = in_poly.vertices_end();
-            vi != end ; ++vi)
-        {
-            typename Polyhedron_output::Point_3 p(::CGAL::to_double( vi->point().x()),
-                                                  ::CGAL::to_double( vi->point().y()),
-                                                  ::CGAL::to_double( vi->point().z()));
-            builder.add_vertex(p);
-        }
-
-        typedef CGAL::Inverse_index<Vertex_const_iterator> Index;
-        Index index( in_poly.vertices_begin(), in_poly.vertices_end());
-
-        for(Facet_const_iterator
-            fi = in_poly.facets_begin(), end = in_poly.facets_end();
-            fi != end; ++fi)
-        {
-            HFCC hc = fi->facet_begin();
-            HFCC hc_end = hc;
-            //     std::size_t n = circulator_size( hc);
-            //     CGAL_assertion( n >= 3);
-            builder.begin_facet ();
-            do {
-                builder.add_vertex_to_facet(index[hc->vertex()]);
-                ++hc;
-            } while( hc != hc_end);
-            builder.end_facet();
-        }
-        builder.end_surface();
-    } // end operator()(..)
-private:
-    const Polyhedron_input& in_poly;
-}; // end Copy_polyhedron_to<>
-
-template <class Poly_A, class Poly_B>
-void copy_to(const Poly_A& poly_a, Poly_B& poly_b)
-{
-    Copy_polyhedron_to<Poly_A, Poly_B> modifier(poly_a);
-    poly_b.delegate(modifier);
-}
-
-void from_exact(Exact_polyhedron& in,
-                Polyhedron& out)
-{
-    copy_to(in, out);
-    CGAL_assertion(out.is_valid());
-}
-
-void to_exact(Polyhedron& in,
-              Exact_polyhedron& out)
-{
-    copy_to(in, out);
-    CGAL_assertion(out.is_valid());
-}
-
-bool Scene_nef_polyhedron_item::is_simple() const
-{
-    return nef_poly->is_simple();
-}
-
-// [static]
-Scene_nef_polyhedron_item* 
-Scene_nef_polyhedron_item::from_polyhedron(Scene_polyhedron_item* item)
-{
-    Polyhedron* poly = item->polyhedron();
-    if(!poly) return 0;
-
-    Exact_polyhedron exact_poly;
-    to_exact(*poly, exact_poly);
-    Nef_polyhedron* nef_poly = new Nef_polyhedron(exact_poly);
-    exact_poly.clear();
-
-    return new Scene_nef_polyhedron_item(nef_poly);
-}
-
-Scene_polyhedron_item*
-Scene_nef_polyhedron_item::convert_to_polyhedron() const {
-    Exact_polyhedron exact_poly;
-    nef_poly->convert_to_Polyhedron(exact_poly);
-    Polyhedron* poly = new Polyhedron;
-    from_exact(exact_poly, *poly);
-    exact_poly.clear();
-    return new Scene_polyhedron_item(poly);
-}
-
-Scene_nef_polyhedron_item&
-Scene_nef_polyhedron_item::
-operator+=(const Scene_nef_polyhedron_item& other)
-{
-    (*nef_poly) += (*other.nef_poly);
-    return *this;
-}
-
-Scene_nef_polyhedron_item&
-Scene_nef_polyhedron_item::
-operator*=(const Scene_nef_polyhedron_item& other)
-{
-    (*nef_poly) *= (*other.nef_poly);
-    return *this;
-}
-
-Scene_nef_polyhedron_item&
-Scene_nef_polyhedron_item::
-operator-=(const Scene_nef_polyhedron_item& other)
-{
-    (*nef_poly) -= (*other.nef_poly);
-    return *this;
-}
-
-Scene_nef_polyhedron_item*
-Scene_nef_polyhedron_item::
-sum(const Scene_nef_polyhedron_item& a, 
-    const Scene_nef_polyhedron_item& b)
-{
-    return new Scene_nef_polyhedron_item(CGAL::minkowski_sum_3(*a.nef_poly,
-                                                               *b.nef_poly));
-}
-
-void
-Scene_nef_polyhedron_item::
-convex_decomposition(std::list< Scene_polyhedron_item*>& convex_parts)
-{
-    // copy the Nef polyhedron, as markers are added
-    Nef_polyhedron N(*nef_poly);
-    CGAL::convex_decomposition_3(N);
-
-    typedef Nef_polyhedron::Volume_const_iterator Volume_const_iterator;
-
-    Volume_const_iterator ci = ++N.volumes_begin();
-    for( ; ci != N.volumes_end(); ++ci) {
-        if(ci->mark()) {
-            Exact_polyhedron P;
-            N.convert_inner_shell_to_polyhedron(ci->shells_begin(), P);
-            Polyhedron* poly = new Polyhedron;
-            from_exact(P, *poly);
-            Scene_polyhedron_item *spoly = new Scene_polyhedron_item(poly);
-            convex_parts.push_back(spoly);
-            spoly->invalidateOpenGLBuffers();
-        }
-    }
-}
-
-void
-Scene_nef_polyhedron_item::
-invalidateOpenGLBuffers()
-{
-    compute_bbox();
-    Base::invalidateOpenGLBuffers();
-    are_buffers_filled = false;
-}
-void
-Scene_nef_polyhedron_item::selection_changed(bool p_is_selected)
-{
-
-    if(p_is_selected != is_selected)
-        is_selected = p_is_selected;
-
-}
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_nef_polyhedron_item.h b/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_nef_polyhedron_item.h
deleted file mode 100644
index 7cf33a9..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_nef_polyhedron_item.h
+++ /dev/null
@@ -1,112 +0,0 @@
-#ifndef SCENE_NEF_POLYHEDRON_ITEM_H
-#define SCENE_NEF_POLYHEDRON_ITEM_H
-#include  <CGAL/Three/Scene_item.h>
-#include "Scene_nef_polyhedron_item_config.h"
-#include "Nef_type_fwd.h"
-#include <iostream>
-#include <queue>
-class Scene_polyhedron_item;
-
-class SCENE_NEF_POLYHEDRON_ITEM_EXPORT Scene_nef_polyhedron_item
- : public CGAL::Three::Scene_item
-{
-  Q_OBJECT
-public:
-  Scene_nef_polyhedron_item();
-//   Scene_nef_polyhedron_item(const Scene_nef_polyhedron_item&);
-  Scene_nef_polyhedron_item(const Nef_polyhedron& p);
-  Scene_nef_polyhedron_item(Nef_polyhedron* const p);
-  ~Scene_nef_polyhedron_item();
-
-  Scene_nef_polyhedron_item* clone() const;
-  bool load_from_off(std::istream& in);
-  bool load(std::istream& in);
-  bool save(std::ostream& in) const;
-
-  QFont font() const;
-  QString toolTip() const;
-
-  virtual void invalidateOpenGLBuffers();
-  virtual void selection_changed(bool);
-  // Indicate if rendering mode is supported
-  virtual bool supportsRenderingMode(RenderingMode m) const { return m != Gouraud && m!=Splatting; } // CHECK THIS!
-  // OpenGL drawing in a display list
-  void direct_draw() const;
-
-  virtual void draw(CGAL::Three::Viewer_interface*) const;
-  virtual void draw_edges() const {}
-  virtual void draw_edges(CGAL::Three::Viewer_interface* viewer) const;
-  virtual void draw_points(CGAL::Three::Viewer_interface*) const;
-  // Wireframe OpenGL drawing
-
-  bool isFinite() const { return true; }
-  bool isEmpty() const;
-  void compute_bbox() const;
-
-  Nef_polyhedron* nef_polyhedron();
-  const Nef_polyhedron* nef_polyhedron() const;
-
-  bool is_simple() const;
-  bool is_Triangle;
-  // conversion operations
-  static Scene_nef_polyhedron_item* from_polyhedron(Scene_polyhedron_item*);
-  Scene_polyhedron_item* convert_to_polyhedron() const;
-
-  // Nef boolean operations
-  Scene_nef_polyhedron_item&
-  operator+=(const Scene_nef_polyhedron_item&); // union
-
-  Scene_nef_polyhedron_item&
-  operator*=(const Scene_nef_polyhedron_item&); // intersection
-
-  Scene_nef_polyhedron_item&
-  operator-=(const Scene_nef_polyhedron_item&); // difference
-
-  static Scene_nef_polyhedron_item*
-  sum(const Scene_nef_polyhedron_item&, 
-      const Scene_nef_polyhedron_item&);
-
-  void convex_decomposition(std::list< Scene_polyhedron_item*>&);
-  
-private:
-  typedef Scene_item Base;
-  typedef std::vector<QColor> Color_vector;
-
-  Nef_polyhedron* nef_poly;
-
-  enum VAOs {
-      Facets = 0,
-      Edges,
-      Points,
-      NbOfVaos = Points +1
-  };
-  enum VBOs {
-      Facets_vertices = 0,
-      Facets_normals,
-      Edges_vertices,
-      Points_vertices,
-      NbOfVbos = Points_vertices +1
-  };
-
-  mutable std::vector<double> positions_lines;
-  mutable std::vector<double> positions_facets;
-  mutable std::vector<double> positions_points;
-  mutable std::vector<double> normals;
-  mutable std::vector<double> color_lines;
-  mutable std::vector<double> color_facets;
-  mutable std::vector<double> color_points;
-  mutable std::size_t nb_points;
-  mutable std::size_t nb_lines;
-  mutable std::size_t nb_facets;
-
-  mutable QOpenGLShaderProgram *program;
-
-  using CGAL::Three::Scene_item::initialize_buffers;
-  void initialize_buffers(CGAL::Three::Viewer_interface *viewer) const;
-  void compute_normals_and_vertices(void) const;
-
-  void triangulate_facet();
-  void triangulate_facet_color();
-}; // end class Scene_nef_polyhedron_item
-
-#endif // SCENE_NEF_POLYHEDRON_ITEM_H
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_plane_item.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_plane_item.cpp
deleted file mode 100644
index 28adabd..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_plane_item.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-#include "Scene_plane_item.h"
-
-
-
-void Scene_plane_item::initialize_buffers(CGAL::Three::Viewer_interface *viewer) const
-{
-    program = getShaderProgram(PROGRAM_WITHOUT_LIGHT, viewer);
-    program->bind();
-    vaos[Facets]->bind();
-
-    buffers[Facets_vertices].bind();
-    buffers[Facets_vertices].allocate(positions_quad.data(),
-                        static_cast<int>(positions_quad.size()*sizeof(float)));
-    program->enableAttributeArray("vertex");
-    program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
-    buffers[Facets_vertices].release();
-    vaos[Facets]->release();
-
-
-    vaos[Edges]->bind();
-    buffers[Edges_vertices].bind();
-    buffers[Edges_vertices].allocate(positions_lines.data(),
-                        static_cast<int>(positions_lines.size()*sizeof(float)));
-    program->enableAttributeArray("vertex");
-    program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
-    buffers[Edges_vertices].release();
-    vaos[Edges]->release();
-
-    program->release();
-    are_buffers_filled = true;
-
-}
-
-void Scene_plane_item::compute_normals_and_vertices(void)
-{
-    positions_quad.resize(0);
-    positions_lines.resize(0);
-
-    const double diag = scene_diag();
-    //The quad
-    {
-
-    positions_quad.push_back(-diag);
-    positions_quad.push_back(-diag);
-    positions_quad.push_back(0.0);
-    positions_quad.push_back(-diag);
-    positions_quad.push_back(diag);
-    positions_quad.push_back(0.0);
-    positions_quad.push_back(diag);
-    positions_quad.push_back(-diag);
-    positions_quad.push_back(0.0);
-
-    positions_quad.push_back(-diag);
-    positions_quad.push_back(diag);
-    positions_quad.push_back(0.0);
-    positions_quad.push_back(diag);
-    positions_quad.push_back(-diag);
-    positions_quad.push_back(0.0);
-    positions_quad.push_back(diag);
-    positions_quad.push_back(diag);
-    positions_quad.push_back(0.0);
-
-}
-    //The grid
-    float x = (2*diag)/10.0;
-    float y = (2*diag)/10.0;
-    {
-        for(int u = 0; u < 11; u++)
-        {
-
-            positions_lines.push_back(-diag + x* u);
-            positions_lines.push_back(-diag);
-            positions_lines.push_back(0.0);
-
-            positions_lines.push_back(-diag + x* u);
-            positions_lines.push_back(diag);
-            positions_lines.push_back(0.0);
-        }
-        for(int v=0; v<11; v++)
-        {
-
-            positions_lines.push_back(-diag);
-            positions_lines.push_back(-diag + v * y);
-            positions_lines.push_back(0.0);
-
-            positions_lines.push_back(diag);
-            positions_lines.push_back(-diag + v * y);
-            positions_lines.push_back(0.0);
-        }
-
-    }
-}
-
-void Scene_plane_item::draw(CGAL::Three::Viewer_interface* viewer)const
-{
-    if(!are_buffers_filled)
-        initialize_buffers(viewer);
-    vaos[Facets]->bind();
-    program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
-    attrib_buffers(viewer, PROGRAM_WITHOUT_LIGHT);
-    QMatrix4x4 f_matrix;
-    for(int i=0; i<16; i++)
-        f_matrix.data()[i] = (float)frame->matrix()[i];
-    program->bind();
-    program->setUniformValue("f_matrix", f_matrix);
-    program->setAttributeValue("colors",this->color());
-    program->setUniformValue("is_selected", false);
-    viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(positions_quad.size()/3));
-    program->release();
-    vaos[Facets]->release();
-
-}
-
-void Scene_plane_item::draw_edges(CGAL::Three::Viewer_interface* viewer)const
-{
-    if(!are_buffers_filled)
-        initialize_buffers(viewer);
-    vaos[Edges]->bind();
-    program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
-    attrib_buffers(viewer, PROGRAM_WITHOUT_LIGHT);
-    QMatrix4x4 f_matrix;
-    for(int i=0; i<16; i++)
-        f_matrix.data()[i] = (float)frame->matrix()[i];
-    program->bind();
-    program->setUniformValue("f_matrix", f_matrix);
-    program->setAttributeValue("colors",QVector3D(0,0,0));
-    viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(positions_lines.size()/3));
-    program->release();
-    vaos[Edges]->release();
-}
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_plane_item.h b/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_plane_item.h
deleted file mode 100644
index ab08af0..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_plane_item.h
+++ /dev/null
@@ -1,182 +0,0 @@
-#ifndef SCENE_PLANE_ITEM_H
-#define SCENE_PLANE_ITEM_H
-
-
-#include  <CGAL/Three/Scene_item.h>
-#include <CGAL/Three/Scene_interface.h>
-
-#include "Scene_basic_objects_config.h"
-
-#include <QGLViewer/manipulatedFrame.h>
-#include <QGLViewer/qglviewer.h>
-#include <CGAL/Three/Viewer_interface.h>
-
-#include <cmath>
-
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel_epic;
-typedef Kernel_epic::Plane_3 Plane_3;
-
-class SCENE_BASIC_OBJECTS_EXPORT Scene_plane_item 
-  : public CGAL::Three::Scene_item
-{
-  Q_OBJECT
-public:
-  typedef qglviewer::ManipulatedFrame ManipulatedFrame;
-
-  Scene_plane_item(const CGAL::Three::Scene_interface* scene_interface)
-      :CGAL::Three::Scene_item(NbOfVbos,NbOfVaos),
-      scene(scene_interface),
-      manipulable(false),
-      can_clone(true),
-      frame(new ManipulatedFrame())
-  {
-    setNormal(0., 0., 1.);
-    //Generates an integer which will be used as ID for each buffer
-    invalidateOpenGLBuffers();
-  }
-
-  ~Scene_plane_item() {
-    frame = 0;
-    delete frame;
-  }
-
-  bool isFinite() const { return false; }
-  bool isEmpty() const { return false; }
-  void compute_bbox() const { _bbox = Bbox(); }
-
-  bool manipulatable() const {
-    return manipulable;
-  }
-  ManipulatedFrame* manipulatedFrame() {
-    return frame;
-  }
-
-  Scene_plane_item* clone() const {
-    if(can_clone)
-    {
-      Scene_plane_item* item = new Scene_plane_item(scene);
-      item->manipulable = manipulable;
-      item->can_clone = true;
-      item->frame = new ManipulatedFrame;
-      item->frame->setPosition(frame->position());
-      item->frame->setOrientation(frame->orientation());
-      return item;
-    }
-    else
-      return 0;
-  }
-
-  QString toolTip() const {
-    const qglviewer::Vec& pos = frame->position();
-    const qglviewer::Vec& n = frame->inverseTransformOf(qglviewer::Vec(0.f, 0.f, 1.f));
-    return
-      tr("<p><b>%1</b> (mode: %2, color: %3)<br />")
-      .arg(this->name())
-      .arg(this->renderingModeName())
-      .arg(this->color().name())
-
-      +
-      tr("<i>Plane</i></p>"
-         "<p>Equation: %1*x + %2*y + %3*z + %4 = 0<br />"
-         "Normal vector: (%1, %2, %3)<br />"
-         "Point: (%5, %6, %7)</p>")
-      .arg(n[0]).arg(n[1]).arg(n[2])
-      .arg( - pos * n)
-      .arg(pos[0]).arg(pos[1]).arg(pos[2])
-      +
-      tr("<p>Can clone: %1<br />"
-         "Manipulatable: %2</p>")
-      .arg(can_clone?tr("true"):tr("false"))
-      .arg(manipulable?tr("true"):tr("false"));
-  }
-
-  // Indicate if rendering mode is supported
-  bool supportsRenderingMode(RenderingMode m) const {
-    return (m == Wireframe || m == Flat || m == FlatPlusEdges);
-  }
-  virtual void draw(CGAL::Three::Viewer_interface*) const;
- virtual void draw_edges(CGAL::Three::Viewer_interface* viewer)const;
-  Plane_3 plane() const {
-    const qglviewer::Vec& pos = frame->position();
-    const qglviewer::Vec& n = 
-      frame->inverseTransformOf(qglviewer::Vec(0.f, 0.f, 1.f));
-    return Plane_3(n[0], n[1],  n[2], - n * pos);
-  }
-
-private:
-  double scene_diag() const {
-    const Bbox& bbox = scene->bbox();
-    const double& xdelta = bbox.xmax-bbox.xmin;
-    const double& ydelta = bbox.ymax-bbox.ymin;
-    const double& zdelta = bbox.zmax-bbox.zmin;
-    const double diag = std::sqrt(xdelta*xdelta + 
-                            ydelta*ydelta +
-                            zdelta*zdelta);
-    return diag * 0.7;
-  }
-
-public Q_SLOTS:
-  virtual void invalidateOpenGLBuffers()
-  {
-      compute_normals_and_vertices();
-      are_buffers_filled = false;
-      compute_bbox();
-  }
-
-  void setPosition(float x, float y, float z) {
-    frame->setPosition(x, y, z);
-  }
-  
-  void setPosition(double x, double y, double z) {
-    frame->setPosition((float)x, (float)y, (float)z);
-  }
-  
-  void setNormal(float x, float y, float z) {
-    QVector3D normal(x,y,z);
-    QVector3D origin(0,0,1);
-    QQuaternion q(CGAL::sqrt((normal.lengthSquared()) * (origin.lengthSquared())) + QVector3D::dotProduct(origin, normal),QVector3D::crossProduct(origin, normal));
-    q.normalize();
-    frame->setOrientation(q.x(), q.y(), q.z(), q.scalar());
-  }
-
-  void setNormal(double x, double y, double z) {
-    setNormal((float)x, (float)y, (float)z);
-  }
-
-  void setClonable(bool b = true) {
-    can_clone = b;
-  }
-
-  void setManipulatable(bool b = true) {
-    manipulable = b;
-  }
-protected:
-  const CGAL::Three::Scene_interface* scene;
-  bool manipulable;
-  bool can_clone;
-  qglviewer::ManipulatedFrame* frame;
-
-  enum VAOs {
-      Facets = 0,
-      Edges,
-      NbOfVaos = Edges +1
-  };
-  enum VBOs {
-      Facets_vertices = 0,
-      Edges_vertices,
-      NbOfVbos = Edges_vertices +1
-  };
-
-  mutable std::vector<float> positions_lines;
-  mutable std::vector<float> positions_quad;
-  mutable GLint sampler_location;
-  mutable bool smooth_shading;
-  mutable QOpenGLShaderProgram *program;
-
-  using CGAL::Three::Scene_item::initialize_buffers;
-  void initialize_buffers(CGAL::Three::Viewer_interface*)const;
-  void compute_normals_and_vertices(void);
-};
-
-#endif // SCENE_PLANE_ITEM_H
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_points_with_normal_item.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_points_with_normal_item.cpp
deleted file mode 100644
index 648c44a..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_points_with_normal_item.cpp
+++ /dev/null
@@ -1,598 +0,0 @@
-#include "Scene_points_with_normal_item.h"
-#include "Polyhedron_type.h"
-#include <CGAL/Polygon_mesh_processing/compute_normal.h>
-
-#include <CGAL/IO/read_ply_points.h>
-#include <CGAL/IO/write_ply_points.h>
-#include <CGAL/IO/read_off_points.h>
-#include <CGAL/IO/write_off_points.h>
-#include <CGAL/IO/read_xyz_points.h>
-#include <CGAL/IO/write_xyz_points.h>
-#include <CGAL/Timer.h>
-#include <CGAL/Memory_sizer.h>
-
-#include <CGAL/Three/Viewer_interface.h>
-#include <CGAL/Orthogonal_k_neighbor_search.h>
-#include <CGAL/Search_traits_3.h>
-
-#include <QObject>
-#include <QMenu>
-#include <QGLViewer/manipulatedCameraFrame.h>
-
-#include <set>
-#include <stack>
-#include <algorithm>
-#include <boost/array.hpp>
-
-
-Scene_points_with_normal_item::Scene_points_with_normal_item()
-    : Scene_item(NbOfVbos,NbOfVaos),
-    m_points(new Point_set),
-    m_has_normals(false)
-{
-  setRenderingMode(Points);
-    is_selected = true;
-    nb_points = 0;
-    nb_selected_points = 0;
-    nb_lines = 0;
-}
-
-// Copy constructor
-Scene_points_with_normal_item::Scene_points_with_normal_item(const Scene_points_with_normal_item& toCopy)
-    :Scene_item(NbOfVbos,NbOfVaos), // do not call superclass' copy constructor
-    m_points(new Point_set(*toCopy.m_points)),
-    m_has_normals(toCopy.m_has_normals)
-{
-  if (m_has_normals)
-    {
-    setRenderingMode(PointsPlusNormals);
-        is_selected = true;
-    }
-  else
-    {
-    setRenderingMode(Points);
-        is_selected = true;
-    }
-    nb_points = 0;
-    nb_selected_points = 0;
-    nb_lines = 0;
-    invalidateOpenGLBuffers();
-}
-
-// Converts polyhedron to point set
-Scene_points_with_normal_item::Scene_points_with_normal_item(const Polyhedron& input_mesh)
-    : Scene_item(NbOfVbos,NbOfVaos),
-    m_points(new Point_set),
-    m_has_normals(true)
-{
-  // Converts Polyhedron vertices to point set.
-  // Computes vertices normal from connectivity.
-
-  Polyhedron::Vertex_iterator v;
-  for (v = const_cast<Polyhedron&>(input_mesh).vertices_begin(); 
-       v != const_cast<Polyhedron&>(input_mesh).vertices_end(); v++)
-  {
-    const Kernel::Point_3& p = v->point();
-    Kernel::Vector_3 n =
-      CGAL::Polygon_mesh_processing::compute_vertex_normal(v, input_mesh);
-    m_points->push_back(UI_point(p,n));
-  }
-
-  setRenderingMode(PointsPlusNormals);
-  is_selected = true;
-  nb_points = 0;
-  nb_selected_points = 0;
-  nb_lines = 0;
-  invalidateOpenGLBuffers();
-}
-
-Scene_points_with_normal_item::~Scene_points_with_normal_item()
-{
-  Q_ASSERT(m_points != NULL);
-  delete m_points; m_points = NULL;
-}
-
-
-
-void Scene_points_with_normal_item::initialize_buffers(CGAL::Three::Viewer_interface *viewer) const
-{
-    compute_normals_and_vertices();
-    //vao for the edges
-    {
-        program = getShaderProgram(PROGRAM_NO_SELECTION, viewer);
-        program->bind();
-
-        vaos[Edges]->bind();
-        buffers[Edges_vertices].bind();
-        buffers[Edges_vertices].allocate(positions_lines.data(),
-                            static_cast<int>(positions_lines.size()*sizeof(double)));
-        program->enableAttributeArray("vertex");
-        program->setAttributeBuffer("vertex",GL_DOUBLE,0,3);
-        buffers[Edges_vertices].release();
-
-        vaos[Edges]->release();
-        nb_lines = positions_lines.size();
-        positions_lines.resize(0);
-        std::vector<double>(positions_lines).swap(positions_lines);
-        program->release();
-    }
-    //vao for the points
-    {
-        program = getShaderProgram(PROGRAM_NO_SELECTION, viewer);
-        program->bind();
-
-        vaos[ThePoints]->bind();
-        buffers[Points_vertices].bind();
-        buffers[Points_vertices].allocate(positions_points.data(),
-                            static_cast<int>(positions_points.size()*sizeof(double)));
-        program->enableAttributeArray("vertex");
-        program->setAttributeBuffer("vertex",GL_DOUBLE,0,3);
-        buffers[Points_vertices].release();
-        vaos[ThePoints]->release();
-        nb_points = positions_points.size();
-        positions_points.resize(0);
-        std::vector<double>(positions_points).swap(positions_points);
-        program->release();
-    }
-    //vao for the selected points
-    {
-        program = getShaderProgram(PROGRAM_NO_SELECTION, viewer);
-        program->bind();
-
-        vaos[Selected_points]->bind();
-        buffers[Selected_points_vertices].bind();
-        buffers[Selected_points_vertices].allocate(positions_selected_points.data(),
-                            static_cast<int>(positions_selected_points.size()*sizeof(double)));
-        program->enableAttributeArray("vertex");
-        program->setAttributeBuffer("vertex",GL_DOUBLE,0,3);
-        buffers[Selected_points_vertices].release();
-
-        vaos[Selected_points]->release();
-        nb_selected_points = positions_selected_points.size();
-        positions_selected_points.resize(0);
-        std::vector<double>(positions_selected_points).swap(positions_selected_points);
-        program->release();
-    }
-    are_buffers_filled = true;
-}
-
-void Scene_points_with_normal_item::compute_normals_and_vertices() const
-{
-    positions_points.resize(0);
-    positions_lines.resize(0);
-    positions_selected_points.resize(0);
-    normals.resize(0);
-
-    positions_points.reserve(m_points->size() * 3);
-    positions_lines.reserve(m_points->size() * 3 * 2);
-
-
-    //Shuffle container to allow quick display random points
-    Point_set_3<Kernel> points = *m_points;
-    std::random_shuffle (points.begin(), points.end() - m_points->nb_selected_points());
-    std::random_shuffle (points.end() - m_points->nb_selected_points(), points.end());
-    
-    //The points
-    {
-        // The *non-selected* points
-      for (Point_set_3<Kernel>::const_iterator it = points.begin(); it != points.first_selected(); it++)
-	{
-	  const UI_point& p = *it;
-	  positions_points.push_back(p.x());
-	  positions_points.push_back(p.y());
-	  positions_points.push_back(p.z());
-	}
-
-        // Draw *selected* points
-      for (Point_set_3<Kernel>::const_iterator it = points.first_selected(); it != points.end(); it++)
-	{
-	  const UI_point& p = *it;
-	  positions_selected_points.push_back(p.x());
-	  positions_selected_points.push_back(p.y());
-	  positions_selected_points.push_back(p.z());
-	}
-    }
-
-    //The lines
-    {
-        // Stock normals
-        Kernel::Sphere_3 region_of_interest = points.region_of_interest();
-        float normal_length = (float)std::sqrt(region_of_interest.squared_radius() / 1000.);
-
-	for (Point_set_3<Kernel>::const_iterator it = points.begin(); it != points.end(); it++)
-	  {
-	    const UI_point& p = *it;
-	    const Point_set_3<Kernel>::Vector& n = p.normal();
-	    Point_set_3<Kernel>::Point q = p + normal_length * n;
-	    positions_lines.push_back(p.x());
-	    positions_lines.push_back(p.y());
-	    positions_lines.push_back(p.z());
-
-	    positions_lines.push_back(q.x());
-	    positions_lines.push_back(q.y());
-	    positions_lines.push_back(q.z());
-	  }
-    }
-}
-
-// Duplicates scene item
-Scene_points_with_normal_item*
-Scene_points_with_normal_item::clone() const
-{
-  return new Scene_points_with_normal_item(*this);
-}
-
-// Is selection empty?
-bool Scene_points_with_normal_item::isSelectionEmpty() const
-{
-  return (m_points->nb_selected_points() == 0);
-}
-
-// Delete selection
-void Scene_points_with_normal_item::deleteSelection()
-{
-  CGAL::Timer task_timer; task_timer.start();
-  std::cerr << "Delete " << m_points->nb_selected_points() << " points...";
-
-  // Delete selected points
-  m_points->delete_selection();
-
-  std::size_t memory = CGAL::Memory_sizer().virtual_size();
-  std::cerr << "done: " << task_timer.time() << " seconds, "
-                        << (memory>>20) << " Mb allocated"
-                        << std::endl;
-  invalidateOpenGLBuffers();
-  Q_EMIT itemChanged();
-}
-
-// Invert selection
-void Scene_points_with_normal_item::invertSelection()
-{
-  m_points->invert_selection();
-  invalidateOpenGLBuffers();
-  Q_EMIT itemChanged();
-}
-
-// Select everything
-void Scene_points_with_normal_item::selectAll()
-{
-  m_points->select_all();
-  invalidateOpenGLBuffers();
-  Q_EMIT itemChanged();
-}
-// Reset selection mark
-void Scene_points_with_normal_item::resetSelection()
-{
-  // Un-select all points
-  m_points->unselect_all();
-  invalidateOpenGLBuffers();
-  Q_EMIT itemChanged();
-}
-  //Select duplicated points
-void Scene_points_with_normal_item::selectDuplicates()
-{
-  std::set<Kernel::Point_3> unique_points;
-  for (Point_set::iterator ptit=m_points->begin(); ptit!=m_points->end();++ptit )
-    if ( !unique_points.insert(*ptit).second )
-      m_points->select(ptit);
-  invalidateOpenGLBuffers();
-  Q_EMIT itemChanged();
-}
-
-// Loads point set from .PLY file
-bool Scene_points_with_normal_item::read_ply_point_set(std::istream& stream)
-{
-  Q_ASSERT(m_points != NULL);
-
-  m_points->clear();
-  bool ok = stream &&
-            CGAL::read_ply_points_and_normals(stream,
-                                              std::back_inserter(*m_points),
-                                              CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type())) &&
-            !isEmpty();
-  if (ok)
-    {
-      for (Point_set::iterator it=m_points->begin(),
-             end=m_points->end();it!=end; ++it)
-        {
-          if (it->normal() != CGAL::NULL_VECTOR)
-            {
-              m_has_normals=true;
-              setRenderingMode(PointsPlusNormals);
-              break;
-            }
-        }
-    }
-  invalidateOpenGLBuffers();
-  return ok;
-}
-
-// Write point set to .PLY file
-bool Scene_points_with_normal_item::write_ply_point_set(std::ostream& stream) const
-{
-  Q_ASSERT(m_points != NULL);
-
-  return stream &&
-         CGAL::write_ply_points_and_normals(stream,
-                                            m_points->begin(), m_points->end(),
-                                            CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()));
-}
-
-// Loads point set from .OFF file
-bool Scene_points_with_normal_item::read_off_point_set(std::istream& stream)
-{
-  Q_ASSERT(m_points != NULL);
-
-  m_points->clear();
-  bool ok = stream &&
-            CGAL::read_off_points_and_normals(stream,
-                                              std::back_inserter(*m_points),
-                                              CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type())) &&
-            !isEmpty();
-  invalidateOpenGLBuffers();
-  return ok;
-}
-
-// Write point set to .OFF file
-bool Scene_points_with_normal_item::write_off_point_set(std::ostream& stream) const
-{
-  Q_ASSERT(m_points != NULL);
-
-  return stream &&
-         CGAL::write_off_points_and_normals(stream,
-                                            m_points->begin(), m_points->end(),
-                                            CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()));
-}
-
-// Loads point set from .XYZ file
-bool Scene_points_with_normal_item::read_xyz_point_set(std::istream& stream)
-{
-  Q_ASSERT(m_points != NULL);
-
-  m_points->clear();
-  bool ok = stream &&
-            CGAL::read_xyz_points_and_normals(stream,
-                                              std::back_inserter(*m_points),
-                                              CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type())) &&
-            !isEmpty();
-
-  if (ok)
-  {
-    for (Point_set::iterator it=m_points->begin(),
-                             end=m_points->end();it!=end; ++it)
-    {
-      if (it->normal() != CGAL::NULL_VECTOR)
-      {
-        m_has_normals=true;
-        setRenderingMode(PointsPlusNormals);
-        break;
-      }
-    }
-  }
-  invalidateOpenGLBuffers();
-  return ok;
-}
-
-// Write point set to .XYZ file
-bool Scene_points_with_normal_item::write_xyz_point_set(std::ostream& stream) const
-{
-  Q_ASSERT(m_points != NULL);
-
-  return stream &&
-         CGAL::write_xyz_points_and_normals(stream,
-                                            m_points->begin(), m_points->end(),
-                                            CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()));
-}
-
-QString
-Scene_points_with_normal_item::toolTip() const
-{
-  Q_ASSERT(m_points != NULL);
-
-  return QObject::tr("<p><b>%1</b> (color: %4)<br />"
-                     "<i>Point set</i></p>"
-                     "<p>Number of points: %2</p>")
-    .arg(name())
-    .arg(m_points->size())
-    .arg(color().name());
-}
-
-bool Scene_points_with_normal_item::supportsRenderingMode(RenderingMode m) const 
-{
-    return m==Points ||
-            ( has_normals() &&
-              ( m==PointsPlusNormals || m==Splatting ) );
-}
-
-void Scene_points_with_normal_item::draw_splats(CGAL::Three::Viewer_interface* viewer) const
-{
-   // TODO add support for selection
-   viewer->glBegin(GL_POINTS);
-   for ( Point_set_3<Kernel>::const_iterator it = m_points->begin(); it != m_points->end(); it++)
-   {
-     const UI_point& p = *it;
-     viewer->glNormal3dv(&p.normal().x());
-     viewer->glMultiTexCoord1d(GL_TEXTURE2, p.radius());
-     viewer->glVertex3dv(&p.x());
-
-   }
-   viewer->glEnd();
-
-
-
-}
-
-void Scene_points_with_normal_item::draw_edges(CGAL::Three::Viewer_interface* viewer) const
-{
-    double ratio_displayed = 1.0;
-    if (viewer->inFastDrawing () &&
-        (nb_lines/6 > 300000)) // arbitrary large value
-      ratio_displayed = 6 * 300000. / (double)(nb_lines);
-
-    if(!are_buffers_filled)
-        initialize_buffers(viewer);
-    vaos[Edges]->bind();
-    program=getShaderProgram(PROGRAM_NO_SELECTION);
-    attrib_buffers(viewer,PROGRAM_NO_SELECTION);
-    program->bind();
-    program->setAttributeValue("colors", this->color());
-    viewer->glDrawArrays(GL_LINES, 0,
-                         static_cast<GLsizei>(((std::size_t)(ratio_displayed * nb_lines)/3)));
-    vaos[Edges]->release();
-    program->release();
-}
-void Scene_points_with_normal_item::draw_points(CGAL::Three::Viewer_interface* viewer) const
-{
-    if(!are_buffers_filled)
-        initialize_buffers(viewer);
-
-    double ratio_displayed = 1.0;
-    if (viewer->inFastDrawing () &&
-        ((nb_points + nb_selected_points)/3 > 300000)) // arbitrary large value
-      ratio_displayed = 3 * 300000. / (double)(nb_points + nb_selected_points);
-
-    vaos[ThePoints]->bind();
-    program=getShaderProgram(PROGRAM_NO_SELECTION);
-    attrib_buffers(viewer,PROGRAM_NO_SELECTION);
-    program->bind();
-    program->setAttributeValue("colors", this->color());
-    viewer->glDrawArrays(GL_POINTS, 0,
-                         static_cast<GLsizei>(((std::size_t)(ratio_displayed * nb_points)/3)));
-    vaos[ThePoints]->release();
-    program->release();
-    GLfloat point_size;
-    viewer->glGetFloatv(GL_POINT_SIZE, &point_size);
-    viewer->glPointSize(4.f);
-
-    vaos[Selected_points]->bind();
-    program=getShaderProgram(PROGRAM_NO_SELECTION);
-    attrib_buffers(viewer,PROGRAM_NO_SELECTION);
-    program->bind();
-    program->setAttributeValue("colors", QColor(255,0,0));
-    viewer->glDrawArrays(GL_POINTS, 0,
-                         static_cast<GLsizei>(((std::size_t)(ratio_displayed * nb_selected_points)/3)));
-    vaos[Selected_points]->release();
-    program->release();
-    viewer->glPointSize(point_size);
-}
-// Gets wrapped point set
-Point_set* Scene_points_with_normal_item::point_set()
-{
-  Q_ASSERT(m_points != NULL);
-  return m_points;
-}
-const Point_set* Scene_points_with_normal_item::point_set() const
-{
-  Q_ASSERT(m_points != NULL);
-  return m_points;
-}
-
-bool
-Scene_points_with_normal_item::isEmpty() const
-{
-  Q_ASSERT(m_points != NULL);
-  return m_points->empty();
-}
-
-void
-Scene_points_with_normal_item::compute_bbox() const
-{
-  Q_ASSERT(m_points != NULL);
-
-  Kernel::Iso_cuboid_3 bbox = m_points->bounding_box();
-  _bbox = Bbox(bbox.xmin(),bbox.ymin(),bbox.zmin(),
-              bbox.xmax(),bbox.ymax(),bbox.zmax());
-}
-
-void Scene_points_with_normal_item::computes_local_spacing(int k)
-{
-  typedef Kernel Geom_traits;
-  typedef CGAL::Search_traits_3<Geom_traits> TreeTraits;
-  typedef CGAL::Orthogonal_k_neighbor_search<TreeTraits> Neighbor_search;
-  typedef Neighbor_search::Tree Tree;
-
-  Point_set::iterator end(m_points->end());
-
-  // build kdtree
-  Tree tree(m_points->begin(), end);
-
-  // Compute the radius of each point = (distance max to k nearest neighbors)/2.
-  {
-    int i=0;
-    for (Point_set::iterator it=m_points->begin(); it!=end; ++it, ++i)
-    {
-      Neighbor_search search(tree, *it, k+1);
-      double maxdist2 = (--search.end())->second; // squared distance to furthest neighbor
-      it->radius() = sqrt(maxdist2)/2.;
-    }
-  }
-
-  m_points->set_radii_uptodate(true);
-}
-
-QMenu* Scene_points_with_normal_item::contextMenu()
-{
-    const char* prop_name = "Menu modified by Scene_points_with_normal_item.";
-
-    QMenu* menu = Scene_item::contextMenu();
-
-    // Use dynamic properties:
-    // http://doc.qt.io/qt-5/qobject.html#property
-    bool menuChanged = menu->property(prop_name).toBool();
-
-    if(!menuChanged) {
-        actionDeleteSelection = menu->addAction(tr("Delete Selection"));
-        actionDeleteSelection->setObjectName("actionDeleteSelection");
-        connect(actionDeleteSelection, SIGNAL(triggered()),this, SLOT(deleteSelection()));
-
-        actionResetSelection = menu->addAction(tr("Reset Selection"));
-        actionResetSelection->setObjectName("actionResetSelection");
-        connect(actionResetSelection, SIGNAL(triggered()),this, SLOT(resetSelection()));
-
-        actionSelectDuplicatedPoints = menu->addAction(tr("Select duplicated points"));
-        actionSelectDuplicatedPoints->setObjectName("actionSelectDuplicatedPoints");
-        connect(actionSelectDuplicatedPoints, SIGNAL(triggered()),this, SLOT(selectDuplicates()));
-
-        menu->setProperty(prop_name, true);
-    }
-
-    if (isSelectionEmpty())
-    {
-        actionDeleteSelection->setDisabled(true);
-        actionResetSelection->setDisabled(true);
-    }
-    else
-    {
-        actionDeleteSelection->setDisabled(false);
-        actionResetSelection->setDisabled(false);
-    }
-
-    return menu;
-}
-
-void Scene_points_with_normal_item::setRenderingMode(RenderingMode m)
-{
-    Scene_item::setRenderingMode(m);
-    if (rendering_mode==Splatting && (!m_points->are_radii_uptodate()))
-    {
-        computes_local_spacing(6); // default value = small
-    }
-}
-
-bool Scene_points_with_normal_item::has_normals() const { return m_has_normals; }
-
-void Scene_points_with_normal_item::set_has_normals(bool b) {
-  if (b!=m_has_normals){
-    m_has_normals=b;
-    //reset the context menu
-    delete this->defaultContextMenu;
-    this->defaultContextMenu = 0;
-  }
-}
-
-void Scene_points_with_normal_item::invalidateOpenGLBuffers()
-{
-    are_buffers_filled = false;
-    compute_bbox();
-}
-
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_points_with_normal_item.h b/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_points_with_normal_item.h
deleted file mode 100644
index ea74b7e..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_points_with_normal_item.h
+++ /dev/null
@@ -1,128 +0,0 @@
-#ifndef POINT_SET_ITEM_H
-#define POINT_SET_ITEM_H
-#include  <CGAL/Three/Scene_item.h>
-#include "Scene_points_with_normal_item_config.h"
-#include "Polyhedron_type_fwd.h"
-#include "Kernel_type.h"
-#include "Point_set_3.h"
-
-#include <iostream>
-
-
-// point set
-typedef Point_set_3<Kernel> Point_set;
-typedef Point_set::UI_point UI_point; // type of points in Point_set_3
-
-class QMenu;
-class QAction;
-
-// This class represents a point set in the OpenGL scene
-class SCENE_POINTS_WITH_NORMAL_ITEM_EXPORT Scene_points_with_normal_item
-  : public CGAL::Three::Scene_item
-{
-  Q_OBJECT
-
-public:
-  Scene_points_with_normal_item();
-  Scene_points_with_normal_item(const Scene_points_with_normal_item& toCopy);
-  Scene_points_with_normal_item(const Polyhedron& p);
-  ~Scene_points_with_normal_item();
-  Scene_points_with_normal_item* clone() const;
-
-  // Is selection empty?
-  virtual bool isSelectionEmpty() const;
-
-  // Function to override the context menu
-  QMenu* contextMenu();
-
-  // IO
-  bool read_ply_point_set(std::istream& in);
-  bool write_ply_point_set(std::ostream& out) const;
-  bool read_off_point_set(std::istream& in);
-  bool write_off_point_set(std::ostream& out) const;
-  bool read_xyz_point_set(std::istream& in);
-  bool write_xyz_point_set(std::ostream& out) const;
-
-  // Function for displaying meta-data of the item
-  virtual QString toolTip() const;
-
-  virtual void invalidateOpenGLBuffers();
-
-  // Indicate if rendering mode is supported
-  virtual bool supportsRenderingMode(RenderingMode m) const;
-
-  virtual void draw_edges(CGAL::Three::Viewer_interface* viewer) const;
-  virtual void draw_points(CGAL::Three::Viewer_interface*) const;
-
-  virtual void draw_splats(CGAL::Three::Viewer_interface*) const;
-  
-  // Gets wrapped point set
-  Point_set*       point_set();
-  const Point_set* point_set() const;
-
-  // Gets dimensions
-  virtual bool isFinite() const { return true; }
-  virtual bool isEmpty() const;
-  virtual void compute_bbox() const;
-
-  virtual void setRenderingMode(RenderingMode m);
-
-  // computes the local point spacing (aka radius) of each point
-  void computes_local_spacing(int k);
-
-  bool has_normals() const;
-  void set_has_normals(bool b);
-
-public Q_SLOTS:
-  // Delete selection
-  virtual void deleteSelection();
-  // Invert selection
-  void invertSelection();
-  // Select all points
-  void selectAll();
-  // Reset selection mark
-  void resetSelection();
-  //Select duplicated points
-  void selectDuplicates();
-
-// Data
-private:
-  Point_set* m_points;
-  bool m_has_normals;
-  QAction* actionDeleteSelection;
-  QAction* actionResetSelection;
-  QAction* actionSelectDuplicatedPoints;
-
-  enum VAOs {
-      Edges=0,
-      ThePoints,
-      Selected_points,
-      NbOfVaos = Selected_points+1
-  };
-  enum VBOs {
-      Edges_vertices = 0,
-      Points_vertices,
-      Selected_points_vertices,
-      NbOfVbos = Selected_points_vertices+1
-  };
-
-  mutable std::vector<double> positions_lines;
-  mutable std::vector<double> positions_points;
-  mutable std::vector<double> positions_selected_points;
-  mutable std::vector<double> normals;
-  mutable std::size_t nb_points;
-  mutable std::size_t nb_selected_points;
-  mutable std::size_t nb_lines;
-
-  mutable QOpenGLShaderProgram *program;
-
-  using CGAL::Three::Scene_item::initialize_buffers;
-  void initialize_buffers(CGAL::Three::Viewer_interface *viewer) const;
-
-  void compute_normals_and_vertices() const;
-
-
-}; // end class Scene_points_with_normal_item
-
-
-#endif // POINT_SET_ITEM_H
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polygon_soup_item.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polygon_soup_item.cpp
deleted file mode 100644
index 6e23288..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polygon_soup_item.cpp
+++ /dev/null
@@ -1,710 +0,0 @@
-#include <vector>
-#include <queue>
-
-#include "Scene_polygon_soup_item.h"
-#include "Scene_polyhedron_item.h"
-#include <CGAL/IO/Polyhedron_iostream.h>
-#include <CGAL/Polyhedron_incremental_builder_3.h>
-
-#include <QObject>
-#include <QtDebug>
-
-#include <set>
-#include <stack>
-#include <algorithm>
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-
-#include <CGAL/IO/OFF_reader.h>
-#include <CGAL/IO/File_writer_OFF.h>
-#include <CGAL/version.h> 
-
-#include <CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h>
-#include <CGAL/Polygon_mesh_processing/orient_polygon_soup.h>
-#include <CGAL/Polygon_mesh_processing/orientation.h>
-#include <CGAL/Polygon_mesh_processing/repair.h>
-
-#include <CGAL/Triangulation_vertex_base_with_info_2.h>
-#include <CGAL/Triangulation_face_base_with_info_2.h>
-#include <CGAL/Constrained_Delaunay_triangulation_2.h>
-#include <CGAL/Constrained_triangulation_plus_2.h>
-#include <CGAL/Triangulation_2_filtered_projection_traits_3.h>
-
-#include <CGAL/Polygon_mesh_processing/compute_normal.h>
-
-
-
-
-struct Polyhedron_to_polygon_soup_writer {
-  typedef Kernel::Point_3 Point_3;
-
-  Polygon_soup* soup;
-  Polygon_soup::Polygon_3 polygon;
-
-  Polyhedron_to_polygon_soup_writer(Polygon_soup* soup) : soup(soup), polygon() {
-  }
-
-  void write_header( std::ostream&,
-                     std::size_t /* vertices */,
-                     std::size_t /* halfedges */,
-                     std::size_t /* facets */,
-                     bool /* normals */ = false ) {
-    soup->clear();
-  }
-
-  void write_footer() {
-  }
-
-  void write_vertex( const double& x, const double& y, const double& z) {
-    soup->points.push_back(Point_3(x, y, z));
-  }
-
-  void write_normal( const double& /* x */, const double& /* y */, const double& /* z */) {
-  }
-
-  void write_facet_header() {
-  }
-
-  void write_facet_begin( std::size_t no) {
-    polygon.clear();
-    polygon.reserve(no);
-  }
-  void write_facet_vertex_index( std::size_t index) {
-    polygon.push_back(index);
-  }
-  void write_facet_end() {
-    soup->polygons.push_back(polygon);
-    polygon.clear();
-  }
-}; // end struct Polyhedron_to_soup_writer
-
-void
-Scene_polygon_soup_item::initialize_buffers(CGAL::Three::Viewer_interface* viewer) const
-{
-    //vao containing the data for the facets
-    {
-        program = getShaderProgram(PROGRAM_WITH_LIGHT, viewer);
-        program->bind();
-
-        vaos[Facets]->bind();
-        buffers[Facets_vertices].bind();
-        buffers[Facets_vertices].allocate(positions_poly.data(),
-                            static_cast<int>(positions_poly.size()*sizeof(float)));
-        program->enableAttributeArray("vertex");
-        program->setAttributeBuffer("vertex",GL_FLOAT,0,4);
-        buffers[Facets_vertices].release();
-
-
-
-        buffers[Facets_normals].bind();
-        buffers[Facets_normals].allocate(normals.data(),
-                            static_cast<int>(normals.size()*sizeof(float)));
-        program->enableAttributeArray("normals");
-        program->setAttributeBuffer("normals",GL_FLOAT,0,3);
-        buffers[Facets_normals].release();
-
-        program->release();
-        vaos[Facets]->release();
-        nb_polys = positions_poly.size();
-        positions_poly.resize(0);
-        std::vector<float>(positions_poly).swap(positions_poly);
-
-        normals.resize(0);
-        std::vector<float>(normals).swap(normals);
-
-    }
-    //vao containing the data for the edges
-    {
-        program = getShaderProgram(PROGRAM_WITHOUT_LIGHT, viewer);
-        program->bind();
-        vaos[Edges]->bind();
-
-        buffers[Edges_vertices].bind();
-        buffers[Edges_vertices].allocate(positions_lines.data(),
-                            static_cast<int>(positions_lines.size()*sizeof(float)));
-        program->enableAttributeArray("vertex");
-        program->setAttributeBuffer("vertex",GL_FLOAT,0,4);
-        buffers[Edges_vertices].release();
-        program->release();
-        vaos[Edges]->release();
-
-        nb_lines = positions_lines.size();
-        positions_lines.resize(0);
-        std::vector<float>(positions_lines).swap(positions_lines);
-
-    }
-    //vao containing the data for the non manifold edges
-    {
-        program = getShaderProgram(PROGRAM_WITHOUT_LIGHT, viewer);
-        program->bind();
-        vaos[NM_Edges]->bind();
-        buffers[NM_Edges_vertices].bind();
-        buffers[NM_Edges_vertices].allocate(positions_nm_lines.data(),
-                            static_cast<int>(positions_nm_lines.size()*sizeof(float)));
-        program->enableAttributeArray("vertex");
-        program->setAttributeBuffer("vertex",GL_FLOAT,0,4);
-        buffers[NM_Edges_vertices].release();
-        vaos[NM_Edges]->release();
-        nb_nm_edges = positions_nm_lines.size();
-        positions_nm_lines.resize(0);
-        std::vector<float> (positions_nm_lines).swap(positions_nm_lines);
-    }
-    are_buffers_filled = true;
-}
-
-typedef Polyhedron::Traits Traits;
-typedef Polygon_soup::Polygon_3 Facet;
-typedef CGAL::Triangulation_2_filtered_projection_traits_3<Traits>   P_traits;
-typedef Polyhedron::Halfedge_handle Halfedge_handle;
-struct Face_info {
-    Polyhedron::Halfedge_handle e[3];
-    bool is_external;
-};
-typedef CGAL::Triangulation_vertex_base_with_info_2<Halfedge_handle,
-P_traits>        Vb;
-typedef CGAL::Triangulation_face_base_with_info_2<Face_info,
-P_traits>          Fb1;
-typedef CGAL::Constrained_triangulation_face_base_2<P_traits, Fb1>   Fb;
-typedef CGAL::Triangulation_data_structure_2<Vb,Fb>                  TDS;
-typedef CGAL::No_intersection_tag                                    Itag;
-typedef CGAL::Constrained_Delaunay_triangulation_2<P_traits,
-TDS,
-Itag>             CDTbase;
-typedef CGAL::Constrained_triangulation_plus_2<CDTbase>              CDT;
-void
-Scene_polygon_soup_item::triangulate_polygon(Polygons_iterator pit) const
-{
-    //Computes the normal of the facet
-    const Point_3& pa = soup->points[pit->at(0)];
-    const Point_3& pb = soup->points[pit->at(1)];
-    const Point_3& pc = soup->points[pit->at(2)];
-    Traits::Vector_3 normal = CGAL::cross_product(pb-pa, pc -pa);
-    normal = normal / std::sqrt(normal * normal);
-
-    P_traits cdt_traits(normal);
-
-    CDT cdt(cdt_traits);
-
-    std::size_t it = 0;
-    std::size_t it_end =pit->size();
-
-    // Iterates the vector of facet handles
-    CDT::Vertex_handle previous, first;
-    do {
-
-        CDT::Vertex_handle vh = cdt.insert(soup->points[pit->at(it)]);
-        if(first == 0) {
-            first = vh;
-        }
-        if(previous != 0 && previous != vh) {
-            cdt.insert_constraint(previous, vh);
-        }
-        previous = vh;
-    } while( ++it != it_end );
-
-    cdt.insert_constraint(previous, first);
-
-    // sets mark is_external
-    for(CDT::All_faces_iterator
-        pitt = cdt.all_faces_begin(),
-        end = cdt.all_faces_end();
-        pitt != end; ++pitt)
-    {
-        pitt->info().is_external = false;
-    }
-
-    //check if the facet is external or internal
-    std::queue<CDT::Face_handle> face_queue;
-    face_queue.push(cdt.infinite_vertex()->face());
-    while(! face_queue.empty() ) {
-        CDT::Face_handle fh = face_queue.front();
-        face_queue.pop();
-        if(fh->info().is_external) continue;
-        fh->info().is_external = true;
-        for(int i = 0; i <3; ++i) {
-            if(!cdt.is_constrained(std::make_pair(fh, i)))
-            {
-                face_queue.push(fh->neighbor(i));
-            }
-        }
-    }
-
-    //iterates on the internal faces to add the vertices to the positions
-    //and the normals to the appropriate vectors
-    int count =0;
-    for(CDT::Finite_faces_iterator
-        ffit = cdt.finite_faces_begin(),
-        end = cdt.finite_faces_end();
-        ffit != end; ++ffit)
-    {
-        count ++;
-        if(ffit->info().is_external)
-            continue;
-
-        positions_poly.push_back(ffit->vertex(0)->point().x());
-        positions_poly.push_back(ffit->vertex(0)->point().y());
-        positions_poly.push_back(ffit->vertex(0)->point().z());
-        positions_poly.push_back(1.0);
-
-        positions_poly.push_back(ffit->vertex(1)->point().x());
-        positions_poly.push_back(ffit->vertex(1)->point().y());
-        positions_poly.push_back(ffit->vertex(1)->point().z());
-        positions_poly.push_back(1.0);
-
-        positions_poly.push_back(ffit->vertex(2)->point().x());
-        positions_poly.push_back(ffit->vertex(2)->point().y());
-        positions_poly.push_back(ffit->vertex(2)->point().z());
-        positions_poly.push_back(1.0);
-
-
-        const Point_3& pa = soup->points[pit->at(0)];
-        const Point_3& pb = soup->points[pit->at(1)];
-        const Point_3& pc = soup->points[pit->at(2)];
-
-        Kernel::Vector_3 n = CGAL::cross_product(pb-pa, pc -pa);
-        n = n / std::sqrt(n * n);
-
-        normals.push_back(n.x());
-        normals.push_back(n.y());
-        normals.push_back(n.z());
-
-        normals.push_back(n.x());
-        normals.push_back(n.y());
-        normals.push_back(n.z());
-
-
-        normals.push_back(n.x());
-        normals.push_back(n.y());
-        normals.push_back(n.z());
-
-
-    }
-}
-void
-Scene_polygon_soup_item::compute_normals_and_vertices() const{
-    //get the vertices and normals
-    typedef Polygon_soup::Polygons::size_type size_type;
-    positions_poly.resize(0);
-    positions_lines.resize(0);
-    normals.resize(0);
-    positions_nm_lines.resize(0);
-    soup->fill_edges();
-    for(Polygons_iterator it = soup->polygons.begin();
-        it != soup->polygons.end(); ++it)
-    {
-        if(it->size()!=3)
-        {
-            triangulate_polygon(it);
-        }
-        else{
-
-            const Point_3& pa = soup->points[it->at(0)];
-            const Point_3& pb = soup->points[it->at(1)];
-            const Point_3& pc = soup->points[it->at(2)];
-
-            Kernel::Vector_3 n = CGAL::cross_product(pb-pa, pc -pa);
-            n = n / std::sqrt(n * n);
-
-            normals.push_back(n.x());
-            normals.push_back(n.y());
-            normals.push_back(n.z());
-
-            normals.push_back(n.x());
-            normals.push_back(n.y());
-            normals.push_back(n.z());
-
-
-            normals.push_back(n.x());
-            normals.push_back(n.y());
-            normals.push_back(n.z());
-
-
-            for(size_type i = 0; i < it->size(); ++i)
-            {
-                const Point_3& p = soup->points[it->at(i)];
-                positions_poly.push_back(p.x());
-                positions_poly.push_back(p.y());
-                positions_poly.push_back(p.z());
-                positions_poly.push_back(1.0);
-            }
-        }
-
-        //Lines
-        for(size_type i = 0; i < it->size(); ++i)
-        {
-
-            const Point_3& pa = soup->points[it->at(i)];
-            const Point_3& pb = soup->points[it->at((i+1)%it->size())];
-            positions_lines.push_back(pa.x());
-            positions_lines.push_back(pa.y());
-            positions_lines.push_back(pa.z());
-            positions_lines.push_back(1.0);
-
-            positions_lines.push_back(pb.x());
-            positions_lines.push_back(pb.y());
-            positions_lines.push_back(pb.z());
-            positions_lines.push_back(1.0);
-        }
-    }
-
-    //Non manifold edges
-    BOOST_FOREACH(const Polygon_soup::Edge& edge,
-                    soup->non_manifold_edges)
-      {
-
-        const Point_3& a = soup->points[edge[0]];
-        const Point_3& b = soup->points[edge[1]];
-        positions_nm_lines.push_back(a.x());
-        positions_nm_lines.push_back(a.y());
-        positions_nm_lines.push_back(a.z());
-        positions_nm_lines.push_back(1.0);
-
-        positions_nm_lines.push_back(b.x());
-        positions_nm_lines.push_back(b.y());
-        positions_nm_lines.push_back(b.z());
-        positions_nm_lines.push_back(1.0);
-      }
-
-}
-
-
-Scene_polygon_soup_item::Scene_polygon_soup_item()
-    : Scene_item(NbOfVbos,NbOfVaos),
-    soup(0),
-    oriented(false)
-{
-    nb_polys = 0;
-    nb_lines = 0;
-    nb_nm_edges = 0;
-}
-
-Scene_polygon_soup_item::~Scene_polygon_soup_item()
-{
-
-  delete soup;
-}
-
-Scene_polygon_soup_item* 
-Scene_polygon_soup_item::clone() const {
-  Scene_polygon_soup_item* new_soup = new Scene_polygon_soup_item();
-  new_soup->soup = soup->clone();
-  new_soup->oriented = oriented;
-  return new_soup;
-}
-
-
-bool
-Scene_polygon_soup_item::load(std::istream& in)
-{
-  if (!soup) soup=new Polygon_soup();
-  else soup->clear();
-
-    bool result = CGAL::read_OFF(in, soup->points, soup->polygons);
-    Q_EMIT invalidateOpenGLBuffers();
-    return result;
-}
-
-void Scene_polygon_soup_item::init_polygon_soup(std::size_t nb_pts, std::size_t nb_polygons){
-  if(!soup)
-    soup = new Polygon_soup;
-  soup->clear();
-  soup->points.reserve(nb_pts);
-  soup->polygons.reserve(nb_polygons);
-  oriented = false;
-}
-
-
-
-#include <CGAL/IO/generic_print_polyhedron.h>
-#include <iostream>
-
-void Scene_polygon_soup_item::load(Scene_polyhedron_item* poly_item) {
-  if(!poly_item) return;
-  if(!poly_item->polyhedron()) return;
-
-  if(!soup)
-    soup = new Polygon_soup;
-
-  Polyhedron_to_polygon_soup_writer writer(soup);
-  CGAL::generic_print_polyhedron(std::cerr,
-                                 *poly_item->polyhedron(),
-                                 writer);
-  Q_EMIT invalidateOpenGLBuffers();
-}
-
-void
-Scene_polygon_soup_item::setDisplayNonManifoldEdges(const bool b)
-{
-
-  soup->display_non_manifold_edges = b;
-}
-
-bool
-Scene_polygon_soup_item::displayNonManifoldEdges() const {
-
-  return soup->display_non_manifold_edges;
-}
-
-void Scene_polygon_soup_item::shuffle_orientations()
-{
-  for(Polygon_soup::size_type i = 0, end = soup->polygons.size();
-      i < end; ++i)
-  {
-    if(std::rand() % 2 == 0) soup->inverse_orientation(i);
-  }
-  invalidateOpenGLBuffers();
-}
-
-void Scene_polygon_soup_item::inside_out()
-{
-  for(Polygon_soup::size_type i = 0, end = soup->polygons.size();
-      i < end; ++i)
-  {
-    soup->inverse_orientation(i);
-  }
-  invalidateOpenGLBuffers();
-}
-
-bool 
-Scene_polygon_soup_item::orient()
-{
-
-  if(isEmpty() || this->oriented)
-    return true; // nothing to do
-  oriented=true;
-
-  //first skip degenerate polygons
-  Polygon_soup::Polygons valid_polygons;
-  valid_polygons.reserve(soup->polygons.size());
-  BOOST_FOREACH(Polygon_soup::Polygon_3& polygon, soup->polygons)
-  {
-    std::set<std::size_t> vids;
-    bool to_remove=false;
-    BOOST_FOREACH(std::size_t id, polygon)
-    {
-      if (!vids.insert(id).second){
-        to_remove=true;
-        break;
-      }
-    }
-    if (!to_remove) valid_polygons.push_back(polygon);
-  }
-  if (valid_polygons.size()!=soup->polygons.size())
-    soup->polygons.swap(valid_polygons);
-
-  return CGAL::Polygon_mesh_processing::
-    orient_polygon_soup(soup->points, soup->polygons);
-}
-
-
-bool 
-Scene_polygon_soup_item::save(std::ostream& out) const
-{
-
-  typedef Polygon_soup::size_type size_type;
-  CGAL::File_writer_OFF writer;
-  writer.write_header(out,
-                      soup->points.size(),
-                      0,
-                      soup->polygons.size());
-  for(size_type i = 0, end = soup->points.size();
-      i < end; ++i)
-  {
-    const Point_3& p = soup->points[i];
-    writer.write_vertex( p.x(), p.y(), p.z() );
-  }
-  writer.write_facet_header();
-  for(size_type i = 0, end = soup->polygons.size();
-      i < end; ++i)
-  {
-    const Polygon_soup::Polygon_3& polygon = soup->polygons[i]; 
-    const size_type size = polygon.size();
-    writer.write_facet_begin(size);
-    for(size_type j = 0; j < size; ++j) {
-      writer.write_facet_vertex_index(polygon[j]);
-    }
-    writer.write_facet_end();
-  }
-  writer.write_footer();
-
-  return (bool) out;
-}
-
-bool 
-Scene_polygon_soup_item::exportAsPolyhedron(Polyhedron* out_polyhedron)
-{
-  orient();
-  CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh<Polyhedron>(
-    soup->points, soup->polygons, *out_polyhedron);
-  std::size_t rv = CGAL::Polygon_mesh_processing::remove_isolated_vertices(*out_polyhedron);
-  if(rv > 0)
-    std::cerr << "Ignore isolated vertices: " << rv << std::endl;
-  if(out_polyhedron->size_of_vertices() > 0) {
-    // Also check whether the consistent orientation is fine
-    if(out_polyhedron->is_closed() &&
-       !CGAL::Polygon_mesh_processing::is_outward_oriented(*out_polyhedron)) {
-      out_polyhedron->inside_out();
-    }
-    return true;
-  }
-  return false;
-}
-QString 
-Scene_polygon_soup_item::toolTip() const
-{
-
-  if(!soup)
-    return QString();
-
-  QString str = QObject::tr("<p><b>%1</b> (mode: %5, color: %6)<br />"
-                     "<i>Polygons soup</i></p>"
-                     "<p>Number of vertices: %2<br />"
-                     "Number of polygons: %3</p>")
-    .arg(this->name())
-    .arg(soup->points.size())
-    .arg(soup->polygons.size())
-    .arg(this->renderingModeName())
-    .arg(this->color().name());
-    str += QString("<br />Number of isolated vertices : %1<br />").arg(getNbIsolatedvertices());
-    return str;
-}
-
-void
-Scene_polygon_soup_item::draw(CGAL::Three::Viewer_interface* viewer) const {
-    if(!are_buffers_filled)
-    {
-     compute_normals_and_vertices();
-     initialize_buffers(viewer);
-    }
-    if(soup == 0) return;
-    //Calls the buffer info again so that it's the right one used even if
-    //there are several objects drawn
-    vaos[Facets]->bind();
-    attrib_buffers(viewer,PROGRAM_WITH_LIGHT);
-    //fills the arraw of colors with the current color
-
-    QColor v_colors = this->color();
-    // tells the GPU to use the program just created
-    program = getShaderProgram(PROGRAM_WITH_LIGHT);
-    program->bind();
-    program->setAttributeValue("colors", v_colors);
-    //draw the polygons
-    // the third argument is the number of vec4 that will be entered
-    viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(nb_polys/4));
-    // Clean-up
-    program->release();
-    vaos[Facets]->release();
-  }
-
-void
-Scene_polygon_soup_item::draw_points(CGAL::Three::Viewer_interface* viewer) const {
-    if(!are_buffers_filled)
-    {
-      compute_normals_and_vertices();
-      initialize_buffers(viewer);
-    }
-    if(soup == 0) return;
-    vaos[Edges]->bind();
-    attrib_buffers(viewer,PROGRAM_WITHOUT_LIGHT);
-    program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
-    program->bind();
-    QColor color = this->color();
-    program->setAttributeValue("colors", color);
-    //draw the points
-    viewer->glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(nb_lines/4));
-    // Clean-up
-    program->release();
-    vaos[Edges]->release();
-}
-
-void
-Scene_polygon_soup_item::draw_edges(CGAL::Three::Viewer_interface* viewer) const {
-    if(!are_buffers_filled)
-  {
-     compute_normals_and_vertices();
-     initialize_buffers(viewer);
-  }
-    if(soup == 0) return;
-    vaos[Edges]->bind();
-    attrib_buffers(viewer,PROGRAM_WITHOUT_LIGHT);
-    program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
-    program->bind();
-    QColor color = this->color().lighter(120);
-
-    program->setAttributeValue("colors", color);
-    //draw the edges
-    viewer->glDrawArrays(GL_LINES, 0,static_cast<GLsizei>( nb_lines/4));
-    // Clean-up
-    program->release();
-    vaos[Edges]->release();
-    if(displayNonManifoldEdges())
-    {
-        vaos[NM_Edges]->bind();
-        attrib_buffers(viewer,PROGRAM_WITHOUT_LIGHT);
-        program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
-        program->bind();
-        QColor c = QColor(255,0,0,255);
-
-        program->setAttributeValue("colors", c);
-        //draw the edges
-        viewer->glDrawArrays(GL_LINES, 0,static_cast<GLsizei>( nb_nm_edges/4));
-        // Clean-up
-        program->release();
-        vaos[NM_Edges]->release();
-    }
-
-}
-
-bool
-Scene_polygon_soup_item::isEmpty() const {
-
-  return (soup == 0 || soup->points.empty());
-}
-void
-Scene_polygon_soup_item::invalidateOpenGLBuffers()
-{
-    are_buffers_filled = false;
-    compute_bbox();
-}
-
-void Scene_polygon_soup_item::compute_bbox() const {
-
-  if (isEmpty())
-    return;
-  const Point_3& p = *(soup->points.begin());
-  CGAL::Bbox_3 bbox(p.x(), p.y(), p.z(), p.x(), p.y(), p.z());
-  for(Polygon_soup::Points::const_iterator it = soup->points.begin();
-      it != soup->points.end();
-      ++it) {
-    bbox = bbox + it->bbox();
-  }
-  _bbox = Bbox(bbox.xmin(),bbox.ymin(),bbox.zmin(),
-              bbox.xmax(),bbox.ymax(),bbox.zmax());
-}
-
-void 
-Scene_polygon_soup_item::new_vertex(const double& x,
-                                    const double& y,
-                                    const double& z)
-{
-
-    soup->points.push_back(Point_3(x, y, z));
-}
-                               
-void 
-Scene_polygon_soup_item::new_triangle(const std::size_t i,
-                                      const std::size_t j,
-                                      const std::size_t k)
-{
-
-  Polygon_soup::Polygon_3 new_polygon(3);
-  new_polygon[0] = i;
-  new_polygon[1] = j;
-  new_polygon[2] = k;
-  soup->polygons.push_back(new_polygon);
-}
-                               
-
-// Local Variables:
-// c-basic-offset: 4
-// End:
-
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polygon_soup_item.h b/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polygon_soup_item.h
deleted file mode 100644
index 8c3aa20..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polygon_soup_item.h
+++ /dev/null
@@ -1,202 +0,0 @@
-#ifndef SCENE_POLYGON_SOUP_ITEM_H
-#define SCENE_POLYGON_SOUP_ITEM_H
-#include "Scene_polygon_soup_item_config.h"
-#include  <CGAL/Three/Scene_item.h>
-#include "Viewer.h"
-#include "Polyhedron_type.h"
-
-#include <boost/foreach.hpp>
-#include <boost/array.hpp>
-
-#include <iostream>
-
-
-struct Polygon_soup
-{
-    typedef Kernel::Point_3 Point_3;
-    typedef std::vector<Point_3> Points;
-    //vector containing 3 indices of points in Points
-    typedef std::vector<std::size_t> Polygon_3;
-    //vector containing a pair of indices of points in Points and a set of indices of Polygons
-    //containing the edge.
-    typedef std::map<std::pair<std::size_t, std::size_t>, std::set<std::size_t> > Edges_map;
-    typedef boost::array<std::size_t, 2> Edge;
-    typedef std::vector<Polygon_3> Polygons;
-    typedef std::set<Edge> Edges;
-    typedef Polygons::size_type size_type;
-    Points points;
-    Polygons polygons;
-    Edges_map edges;
-    Edges non_manifold_edges;
-    bool display_non_manifold_edges;
-
-    Polygon_soup():
-        display_non_manifold_edges(false){}
-
-    Polygon_soup* clone() const {
-        Polygon_soup* result = new Polygon_soup();
-        result->points = points;
-        result->polygons = polygons;
-        result->edges = edges;
-        result->non_manifold_edges = non_manifold_edges;
-        result->display_non_manifold_edges = display_non_manifold_edges;
-        return result;
-    }
-
-    void clear() {
-        points.clear();
-        polygons.clear();
-        edges.clear();
-        non_manifold_edges.clear();
-    }
-
-    void fill_edges() {
-        // Fill edges
-        edges.clear();
-        for(size_type i = 0; i < polygons.size(); ++i)
-        {
-            const size_type size = polygons[i].size();
-            for(size_type j = 0; j < size; ++j) {
-                const std::size_t& i0 = polygons[i][j];
-                const std::size_t& i1 = polygons[i][ j+1 < size ? j+1: 0];
-                edges[std::make_pair(i0, i1)].insert(i);
-                //         qDebug() << tr("edges[std::make_pair(%1, %2)].insert(%3). Size=%4")
-                //           .arg(i0).arg(i1).arg(i).arg(edges[std::make_pair(i0, i1)].size());
-            }
-        }
-
-        // Fill non-manifold edges
-        non_manifold_edges.clear();
-        for(size_type i = 0; i < polygons.size(); ++i)
-        {
-            const size_type size = polygons[i].size();
-            for(size_type j = 0; j < size; ++j) {
-                const std::size_t& i0 = polygons[i][j];
-                const std::size_t& i1 = polygons[i][ j+1 < size ? j+1: 0];
-
-                if(edges[std::make_pair(i0, i1)].size() +
-                         edges[std::make_pair(i1, i0)].size() > 2)
-                {
-                    Edge edge;
-                    edge[0] = i0;
-                    edge[1] = i1;
-                    if(i0 > i1) std::swap(edge[0], edge[1]);
-                    non_manifold_edges.insert(edge);
-
-                }
-            }
-        }
-    }
-
-    void inverse_orientation(const std::size_t index) {
-        std::reverse(polygons[index].begin(), polygons[index].end());
-    }
-};
-
-
-class Scene_polyhedron_item;
-
-class SCENE_POLYGON_SOUP_ITEM_EXPORT Scene_polygon_soup_item 
-        : public CGAL::Three::Scene_item
-{
-    typedef Kernel::Point_3 Point_3;
-
-    Q_OBJECT
-public:  
-    Scene_polygon_soup_item();
-    ~Scene_polygon_soup_item();
-
-    Scene_polygon_soup_item* clone() const;
-    bool load(std::istream& in);
-    void load(Scene_polyhedron_item*);
-
-    template <class Point, class Polygon>
-    inline void load(const std::vector<Point>& points, const std::vector<Polygon>& polygons)
-    {
-        if(!soup)
-            soup = new Polygon_soup;
-        soup->clear();
-
-        /// add points
-        soup->points.reserve(points.size());
-        BOOST_FOREACH(const Point& p, points)
-                soup->points.push_back( Point_3(p[0], p[1], p[2]) );
-
-        /// add polygons
-        std::size_t nb_polygons=polygons.size();
-        soup->polygons.resize(nb_polygons);
-        for(std::size_t i=0; i<nb_polygons; ++i)
-            soup->polygons[i].assign(polygons[i].begin(), polygons[i].end());
-
-        /// fill non-manifold edges container
-        //soup->fill_edges();
-        oriented = false;
-
-        Q_EMIT invalidateOpenGLBuffers();
-    }
-
-    bool save(std::ostream& out) const;
-
-    QString toolTip() const;
-
-    // Indicate if rendering mode is supported
-    virtual bool supportsRenderingMode(RenderingMode m) const { return (m!=Gouraud && m!=PointsPlusNormals && m!=Splatting); } // CHECK THIS!
-    // OpenGL drawing in a display list
-    virtual void draw() const {}
-    virtual void draw(CGAL::Three::Viewer_interface*) const;
-    virtual void draw_points(CGAL::Three::Viewer_interface*) const;
-    virtual void draw_edges(CGAL::Three::Viewer_interface* viewer) const;
-    void invalidateOpenGLBuffers();
-    bool isFinite() const { return true; }
-    bool isEmpty() const;
-    void compute_bbox() const;
-
-    void new_vertex(const double&, const double&, const double&);
-    void new_triangle(const std::size_t, const std::size_t, const std::size_t);
-
-    void init_polygon_soup(std::size_t nb_pts, std::size_t nb_polygons);
-
-public Q_SLOTS:
-    void shuffle_orientations();
-    bool orient();
-    bool exportAsPolyhedron(Polyhedron*);
-    void inside_out();
-
-    void setDisplayNonManifoldEdges(const bool);
-    bool displayNonManifoldEdges() const;
-
-private:
-    typedef Polygon_soup::Polygons::const_iterator Polygons_iterator;
-    Polygon_soup* soup;
-    bool oriented;
-
-    enum VAOs {
-        Facets=0,
-        Edges,
-        NM_Edges,
-        NbOfVaos = NM_Edges+1
-    };
-    enum VBOs {
-        Facets_vertices = 0,
-        Facets_normals,
-        Edges_vertices,
-        NM_Edges_vertices,
-        NbOfVbos = NM_Edges_vertices+1
-    };
-
-    mutable std::vector<float> positions_poly;
-    mutable std::vector<float> positions_lines;
-    mutable std::vector<float> normals;
-    mutable std::vector<float> positions_nm_lines;
-    mutable std::size_t nb_nm_edges;
-    mutable std::size_t nb_polys;
-    mutable std::size_t nb_lines;
-    using CGAL::Three::Scene_item::initialize_buffers;
-    void initialize_buffers(CGAL::Three::Viewer_interface *viewer) const;
-    void compute_normals_and_vertices(void) const;
-    void triangulate_polygon(Polygons_iterator ) const;
-    mutable QOpenGLShaderProgram *program;
-
-}; // end class Scene_polygon_soup_item
-
-#endif // SCENE_POLYGON_SOUP_ITEM_H
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polyhedron_item.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polyhedron_item.cpp
deleted file mode 100644
index dc0a452..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polyhedron_item.cpp
+++ /dev/null
@@ -1,1278 +0,0 @@
-#include "Scene_polyhedron_item.h"
-#include <CGAL/AABB_intersections.h>
-#include "Kernel_type.h"
-#include <CGAL/IO/Polyhedron_iostream.h>
-
-#include <CGAL/AABB_tree.h>
-#include <CGAL/AABB_traits.h>
-#include <CGAL/AABB_face_graph_triangle_primitive.h>
-
-#include <CGAL/Triangulation_vertex_base_with_info_2.h>
-#include <CGAL/Triangulation_face_base_with_info_2.h>
-#include <CGAL/Constrained_Delaunay_triangulation_2.h>
-#include <CGAL/Constrained_triangulation_plus_2.h>
-#include <CGAL/Triangulation_2_filtered_projection_traits_3.h>
-#include <CGAL/Polygon_mesh_processing/compute_normal.h>
-#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
-#include <CGAL/Polygon_mesh_processing/connected_components.h>
-#include <CGAL/Polygon_mesh_processing/measure.h>
-#include <CGAL/Polygon_mesh_processing/self_intersections.h>
-#include <CGAL/Polygon_mesh_processing/repair.h>
-#include <CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h>
-#include <CGAL/Polygon_mesh_processing/orient_polygon_soup.h>
-#include <CGAL/property_map.h>
-#include <CGAL/statistics_helpers.h>
-
-#include <list>
-#include <queue>
-#include <iostream>
-#include <limits>
-
-#include <QVariant>
-#include <QDebug>
-#include <QDialog>
-
-#include <boost/foreach.hpp>
-#include <boost/container/flat_map.hpp>
-
-namespace PMP = CGAL::Polygon_mesh_processing;
-
-
-typedef CGAL::AABB_face_graph_triangle_primitive<Polyhedron> Primitive;
-typedef CGAL::AABB_traits<Kernel, Primitive> AABB_traits;
-typedef CGAL::AABB_tree<AABB_traits> Input_facets_AABB_tree;
-const char* aabb_property_name = "Scene_polyhedron_item aabb tree";
-
-Input_facets_AABB_tree* get_aabb_tree(Scene_polyhedron_item* item)
-{
-    QVariant aabb_tree_property = item->property(aabb_property_name);
-    if(aabb_tree_property.isValid()) {
-        void* ptr = aabb_tree_property.value<void*>();
-        return static_cast<Input_facets_AABB_tree*>(ptr);
-    }
-    else {
-        Polyhedron* poly = item->polyhedron();
-        if(poly) {
-            Input_facets_AABB_tree* tree =
-                    new Input_facets_AABB_tree(faces(*poly).first,
-                                               faces(*poly).second,
-                                               *poly);
-            item->setProperty(aabb_property_name,
-                              QVariant::fromValue<void*>(tree));
-            return tree;
-        }
-        else return 0;
-    }
-}
-
-void delete_aabb_tree(Scene_polyhedron_item* item)
-{
-    QVariant aabb_tree_property = item->property(aabb_property_name);
-    if(aabb_tree_property.isValid()) {
-        void* ptr = aabb_tree_property.value<void*>();
-        Input_facets_AABB_tree* tree = static_cast<Input_facets_AABB_tree*>(ptr);
-        if(tree) {
-            delete tree;
-            tree = 0;
-        }
-        item->setProperty(aabb_property_name, QVariant());
-    }
-}
-
-template<typename TypeWithXYZ, typename ContainerWithPushBack>
-void push_back_xyz(const TypeWithXYZ& t,
-                   ContainerWithPushBack& vector)
-{
-  vector.push_back(t.x());
-  vector.push_back(t.y());
-  vector.push_back(t.z());
-}
-
-typedef Polyhedron::Traits Traits;
-typedef Polyhedron::Facet Facet;
-typedef CGAL::Triangulation_2_filtered_projection_traits_3<Traits>   P_traits;
-typedef Polyhedron::Halfedge_handle Halfedge_handle;
-struct Face_info {
-    Polyhedron::Halfedge_handle e[3];
-    bool is_external;
-};
-typedef CGAL::Triangulation_vertex_base_with_info_2<Halfedge_handle,
-P_traits>        Vb;
-typedef CGAL::Triangulation_face_base_with_info_2<Face_info,
-P_traits>          Fb1;
-typedef CGAL::Constrained_triangulation_face_base_2<P_traits, Fb1>   Fb;
-typedef CGAL::Triangulation_data_structure_2<Vb,Fb>                  TDS;
-typedef CGAL::No_intersection_tag                                    Itag;
-typedef CGAL::Constrained_Delaunay_triangulation_2<P_traits,
-TDS,
-Itag>             CDTbase;
-typedef CGAL::Constrained_triangulation_plus_2<CDTbase>              CDT;
-
-//Make sure all the facets are triangles
-
-template<typename FaceNormalPmap, typename VertexNormalPmap>
-void
-Scene_polyhedron_item::triangulate_facet(Facet_iterator fit,
-                                         const FaceNormalPmap& fnmap,
-                                         const VertexNormalPmap& vnmap,
-                                         const bool colors_only) const
-{
-    //Computes the normal of the facet
-    Traits::Vector_3 normal = get(fnmap, fit);
-
-    //check if normal contains NaN values
-    if (normal.x() != normal.x() || normal.y() != normal.y() || normal.z() != normal.z())
-    {
-        qDebug()<<"Warning : normal is not valid. Facet not displayed";
-        return;
-    }
-    P_traits cdt_traits(normal);
-    CDT cdt(cdt_traits);
-
-    Facet::Halfedge_around_facet_circulator
-            he_circ = fit->facet_begin(),
-            he_circ_end(he_circ);
-
-    // Iterates on the vector of facet handles
-    typedef boost::graph_traits<Polyhedron>::vertex_descriptor vertex_descriptor;
-    boost::container::flat_map<CDT::Vertex_handle, vertex_descriptor> v2v;
-    CDT::Vertex_handle previous, first;
-    do {
-        CDT::Vertex_handle vh = cdt.insert(he_circ->vertex()->point());
-        v2v.insert(std::make_pair(vh, he_circ->vertex()));
-        if(first == 0) {
-            first = vh;
-        }
-        vh->info() = he_circ;
-        if(previous != 0 && previous != vh) {
-            cdt.insert_constraint(previous, vh);
-        }
-        previous = vh;
-    } while( ++he_circ != he_circ_end );
-    cdt.insert_constraint(previous, first);
-    // sets mark is_external
-    for(CDT::All_faces_iterator
-        fit2 = cdt.all_faces_begin(),
-        end = cdt.all_faces_end();
-        fit2 != end; ++fit2)
-    {
-        fit2->info().is_external = false;
-    }
-    //check if the facet is external or internal
-    std::queue<CDT::Face_handle> face_queue;
-    face_queue.push(cdt.infinite_vertex()->face());
-    while(! face_queue.empty() ) {
-        CDT::Face_handle fh = face_queue.front();
-        face_queue.pop();
-        if(fh->info().is_external) continue;
-        fh->info().is_external = true;
-        for(int i = 0; i <3; ++i) {
-            if(!cdt.is_constrained(std::make_pair(fh, i)))
-            {
-                face_queue.push(fh->neighbor(i));
-            }
-        }
-    }
-    //iterates on the internal faces to add the vertices to the positions
-    //and the normals to the appropriate vectors
-    const int this_patch_id = fit->patch_id();
-    for(CDT::Finite_faces_iterator
-        ffit = cdt.finite_faces_begin(),
-        end = cdt.finite_faces_end();
-        ffit != end; ++ffit)
-    {
-        if(ffit->info().is_external)
-            continue;
-
-        if (!is_monochrome)
-        {
-          for (int i = 0; i<3; ++i)
-          {
-            color_facets.push_back(colors_[this_patch_id].redF());
-            color_facets.push_back(colors_[this_patch_id].greenF());
-            color_facets.push_back(colors_[this_patch_id].blueF());
-
-            color_facets.push_back(colors_[this_patch_id].redF());
-            color_facets.push_back(colors_[this_patch_id].greenF());
-            color_facets.push_back(colors_[this_patch_id].blueF());
-          }
-        }
-        if (colors_only)
-          continue;
-
-        push_back_xyz(ffit->vertex(0)->point(), positions_facets);
-        positions_facets.push_back(1.0);
-
-        push_back_xyz(ffit->vertex(1)->point(), positions_facets);
-        positions_facets.push_back(1.0);
-
-        push_back_xyz(ffit->vertex(2)->point(), positions_facets);
-        positions_facets.push_back(1.0);
-
-        push_back_xyz(normal, normals_flat);
-        push_back_xyz(normal, normals_flat);
-        push_back_xyz(normal, normals_flat);
-
-        Traits::Vector_3 ng = get(vnmap, v2v[ffit->vertex(0)]);
-        push_back_xyz(ng, normals_gouraud);
-
-        ng = get(vnmap, v2v[ffit->vertex(1)]);
-        push_back_xyz(ng, normals_gouraud);
-
-        ng = get(vnmap, v2v[ffit->vertex(2)]);
-        push_back_xyz(ng, normals_gouraud);
-    }
-}
-
-
-#include <QObject>
-#include <QMenu>
-#include <QAction>
-
-
-void
-Scene_polyhedron_item::initialize_buffers(CGAL::Three::Viewer_interface* viewer) const
-{
-    //vao containing the data for the facets
-    {
-        program = getShaderProgram(PROGRAM_WITH_LIGHT, viewer);
-        program->bind();
-        //flat
-        vaos[Facets]->bind();
-        buffers[Facets_vertices].bind();
-        buffers[Facets_vertices].allocate(positions_facets.data(),
-                            static_cast<int>(positions_facets.size()*sizeof(float)));
-        program->enableAttributeArray("vertex");
-        program->setAttributeBuffer("vertex",GL_FLOAT,0,4);
-        buffers[Facets_vertices].release();
-
-
-
-        buffers[Facets_normals_flat].bind();
-        buffers[Facets_normals_flat].allocate(normals_flat.data(),
-                            static_cast<int>(normals_flat.size()*sizeof(float)));
-        program->enableAttributeArray("normals");
-        program->setAttributeBuffer("normals",GL_FLOAT,0,3);
-        buffers[Facets_normals_flat].release();
-
-        if(!is_monochrome)
-        {
-            buffers[Facets_color].bind();
-            buffers[Facets_color].allocate(color_facets.data(),
-                                static_cast<int>(color_facets.size()*sizeof(float)));
-            program->enableAttributeArray("colors");
-            program->setAttributeBuffer("colors",GL_FLOAT,0,3);
-            buffers[Facets_color].release();
-        }
-        vaos[Facets]->release();
-        //gouraud
-        vaos[Gouraud_Facets]->bind();
-        buffers[Facets_vertices].bind();
-        program->enableAttributeArray("vertex");
-        program->setAttributeBuffer("vertex",GL_FLOAT,0,4);
-        buffers[Facets_vertices].release();
-
-        buffers[Facets_normals_gouraud].bind();
-        buffers[Facets_normals_gouraud].allocate(normals_gouraud.data(),
-                            static_cast<int>(normals_gouraud.size()*sizeof(float)));
-        program->enableAttributeArray("normals");
-        program->setAttributeBuffer("normals",GL_FLOAT,0,3);
-        buffers[Facets_normals_gouraud].release();
-        if(!is_monochrome)
-        {
-            buffers[Facets_color].bind();
-            program->enableAttributeArray("colors");
-            program->setAttributeBuffer("colors",GL_FLOAT,0,3);
-            buffers[Facets_color].release();
-        }
-        else
-        {
-            program->disableAttributeArray("colors");
-        }
-        vaos[Gouraud_Facets]->release();
-
-        program->release();
-
-    }
-    //vao containing the data for the lines
-    {
-        program = getShaderProgram(PROGRAM_WITHOUT_LIGHT, viewer);
-        program->bind();
-        vaos[Edges]->bind();
-
-        buffers[Edges_vertices].bind();
-        buffers[Edges_vertices].allocate(positions_lines.data(),
-                            static_cast<int>(positions_lines.size()*sizeof(float)));
-        program->enableAttributeArray("vertex");
-        program->setAttributeBuffer("vertex",GL_FLOAT,0,4);
-        buffers[Edges_vertices].release();
-
-        buffers[Edges_color].bind();
-        buffers[Edges_color].allocate(color_lines.data(),
-                            static_cast<int>(color_lines.size()*sizeof(float)));
-       if(!is_monochrome)
-       {
-           program->enableAttributeArray("colors");
-           program->setAttributeBuffer("colors",GL_FLOAT,0,3);
-           buffers[Edges_color].release();
-       }
-       else
-       {
-           program->disableAttributeArray("colors");
-       }
-        program->release();
-
-        vaos[Edges]->release();
-
-    }
-  //vao containing the data for the feature_edges
-  {
-      program = getShaderProgram(PROGRAM_NO_SELECTION, viewer);
-      program->bind();
-      vaos[Feature_edges]->bind();
-
-      buffers[Feature_edges_vertices].bind();
-      buffers[Feature_edges_vertices].allocate(positions_feature_lines.data(),
-                          static_cast<int>(positions_feature_lines.size()*sizeof(float)));
-      program->enableAttributeArray("vertex");
-      program->setAttributeBuffer("vertex",GL_FLOAT,0,4);
-      buffers[Feature_edges_vertices].release();
-      program->disableAttributeArray("colors");
-      program->release();
-
-      vaos[Feature_edges]->release();
-
-  }
-    nb_f_lines = positions_feature_lines.size();
-    positions_feature_lines.resize(0);
-    std::vector<float>(positions_feature_lines).swap(positions_feature_lines);
-    nb_lines = positions_lines.size();
-    positions_lines.resize(0);
-    std::vector<float>(positions_lines).swap(positions_lines);
-    nb_facets = positions_facets.size();
-    positions_facets.resize(0);
-    std::vector<float>(positions_facets).swap(positions_facets);
-
-
-    color_lines.resize(0);
-    std::vector<float>(color_lines).swap(color_lines);
-    color_facets.resize(0);
-    std::vector<float>(color_facets).swap(color_facets);
-    normals_flat.resize(0);
-    std::vector<float>(normals_flat).swap(normals_flat);
-    normals_gouraud.resize(0);
-    std::vector<float>(normals_gouraud).swap(normals_gouraud);
-    are_buffers_filled = true;
-}
-
-void
-Scene_polyhedron_item::compute_normals_and_vertices(const bool colors_only) const
-{
-    positions_facets.resize(0);
-    positions_lines.resize(0);
-    positions_feature_lines.resize(0);
-    normals_flat.resize(0);
-    normals_gouraud.resize(0);
-    color_lines.resize(0);
-    color_facets.resize(0);
-
-    //Facets
-    typedef Polyhedron::Traits	    Kernel;
-    typedef Kernel::Point_3	    Point;
-    typedef Kernel::Vector_3	    Vector;
-    typedef Polyhedron::Facet_iterator Facet_iterator;
-    typedef Polyhedron::Halfedge_around_facet_circulator HF_circulator;
-    typedef boost::graph_traits<Polyhedron>::face_descriptor   face_descriptor;
-    typedef boost::graph_traits<Polyhedron>::vertex_descriptor vertex_descriptor;
-
-    boost::container::flat_map<face_descriptor, Vector> face_normals_map;
-    boost::associative_property_map< boost::container::flat_map<face_descriptor, Vector> >
-      nf_pmap(face_normals_map);
-    boost::container::flat_map<vertex_descriptor, Vector> vertex_normals_map;
-    boost::associative_property_map< boost::container::flat_map<vertex_descriptor, Vector> >
-      nv_pmap(vertex_normals_map);
-
-    PMP::compute_normals(*poly, nv_pmap, nf_pmap);
-
-    Facet_iterator f = poly->facets_begin();
-    for(f = poly->facets_begin();
-        f != poly->facets_end();
-        f++)
-    {
-      if (f == boost::graph_traits<Polyhedron>::null_face())
-        continue;
-
-      if(is_triangle(f->halfedge(),*poly))
-      {
-          const int this_patch_id = f->patch_id();
-          Vector n = get(nf_pmap, f);
-          HF_circulator he = f->facet_begin();
-          HF_circulator end = he;
-          CGAL_For_all(he,end)
-          {
-            if (!is_monochrome)
-            {
-              color_facets.push_back(colors_[this_patch_id].redF());
-              color_facets.push_back(colors_[this_patch_id].greenF());
-              color_facets.push_back(colors_[this_patch_id].blueF());
-            }
-            if (colors_only)
-              continue;
-
-            // If Flat shading:1 normal per polygon added once per vertex
-            push_back_xyz(n, normals_flat);
-
-            //// If Gouraud shading: 1 normal per vertex
-            Vector nv = get(nv_pmap, he->vertex());
-            push_back_xyz(nv, normals_gouraud);
-
-            //position
-            const Point& p = he->vertex()->point();
-            push_back_xyz(p, positions_facets);
-            positions_facets.push_back(1.0);
-         }
-      }
-      else if (is_quad(f->halfedge(), *poly))
-      {
-        if (!is_monochrome)
-        {
-          const int this_patch_id = f->patch_id();
-          for (unsigned int i = 0; i < 6; ++i)
-          { //6 "halfedges" for the quad, because it is 2 triangles
-            color_facets.push_back(colors_[this_patch_id].redF());
-            color_facets.push_back(colors_[this_patch_id].greenF());
-            color_facets.push_back(colors_[this_patch_id].blueF());
-          }
-        }
-        if (colors_only)
-          continue;
-
-        Vector nf = get(nf_pmap, f);
-
-        //1st half-quad
-        Point p0 = f->halfedge()->vertex()->point();
-        Point p1 = f->halfedge()->next()->vertex()->point();
-        Point p2 = f->halfedge()->next()->next()->vertex()->point();
-
-        push_back_xyz(p0, positions_facets);
-        positions_facets.push_back(1.0);
-
-        push_back_xyz(p1, positions_facets);
-        positions_facets.push_back(1.0);
-
-        push_back_xyz(p2, positions_facets);
-        positions_facets.push_back(1.0);
-
-        push_back_xyz(nf, normals_flat);
-        push_back_xyz(nf, normals_flat);
-        push_back_xyz(nf, normals_flat);
-
-        Vector nv = get(nv_pmap, f->halfedge()->vertex());
-        push_back_xyz(nv, normals_gouraud);
-
-        nv = get(nv_pmap, f->halfedge()->next()->vertex());
-        push_back_xyz(nv, normals_gouraud);
-
-        nv = get(nv_pmap, f->halfedge()->next()->next()->vertex());
-        push_back_xyz(nv, normals_gouraud);
-
-        //2nd half-quad
-        p0 = f->halfedge()->next()->next()->vertex()->point();
-        p1 = f->halfedge()->prev()->vertex()->point();
-        p2 = f->halfedge()->vertex()->point();
-
-        push_back_xyz(p0, positions_facets);
-        positions_facets.push_back(1.0);
-
-        push_back_xyz(p1, positions_facets);
-        positions_facets.push_back(1.0);
-
-        push_back_xyz(p2, positions_facets);
-        positions_facets.push_back(1.0);
-
-        push_back_xyz(nf, normals_flat);
-        push_back_xyz(nf, normals_flat);
-        push_back_xyz(nf, normals_flat);
-
-        nv = get(nv_pmap, f->halfedge()->next()->next()->vertex());
-        push_back_xyz(nv, normals_gouraud);
-
-        nv = get(nv_pmap, f->halfedge()->prev()->vertex());
-        push_back_xyz(nv, normals_gouraud);
-
-        nv = get(nv_pmap, f->halfedge()->vertex());
-        push_back_xyz(nv, normals_gouraud);
-      }
-      else
-      {
-        triangulate_facet(f, nf_pmap, nv_pmap, colors_only);
-      }
-
-    }
-    //Lines
-    typedef Kernel::Point_3		Point;
-    typedef Polyhedron::Edge_iterator	Edge_iterator;
-    Edge_iterator he;
-    for(he = poly->edges_begin();
-        he != poly->edges_end();
-        he++)
-    {
-        const Point& a = he->vertex()->point();
-        const Point& b = he->opposite()->vertex()->point();
-        if ( he->is_feature_edge())
-        {
-          if (colors_only)
-            continue;
-
-          push_back_xyz(a, positions_feature_lines);
-          positions_feature_lines.push_back(1.0);
-
-          push_back_xyz(b, positions_feature_lines);
-          positions_feature_lines.push_back(1.0);
-        }
-        else
-        {
-          if (!is_monochrome)
-          {
-            color_lines.push_back(this->color().lighter(50).redF());
-            color_lines.push_back(this->color().lighter(50).greenF());
-            color_lines.push_back(this->color().lighter(50).blueF());
-
-            color_lines.push_back(this->color().lighter(50).redF());
-            color_lines.push_back(this->color().lighter(50).greenF());
-            color_lines.push_back(this->color().lighter(50).blueF());
-          }
-          if (colors_only)
-            continue;
-
-          push_back_xyz(a, positions_lines);
-          positions_lines.push_back(1.0);
-
-          push_back_xyz(b, positions_lines);
-          positions_lines.push_back(1.0);
-        }
-    }
-}
-
-Scene_polyhedron_item::Scene_polyhedron_item()
-    : Scene_item(NbOfVbos,NbOfVaos),
-      poly(new Polyhedron),
-      show_only_feature_edges_m(false),
-      show_feature_edges_m(false),
-      facet_picking_m(false),
-      erase_next_picked_facet_m(false),
-      plugin_has_set_color_vector_m(false)
-{
-    cur_shading=FlatPlusEdges;
-    is_selected = true;
-    nb_facets = 0;
-    nb_lines = 0;
-    nb_f_lines = 0;
-    init();
-}
-
-Scene_polyhedron_item::Scene_polyhedron_item(Polyhedron* const p)
-    : Scene_item(NbOfVbos,NbOfVaos),
-      poly(p),
-      show_only_feature_edges_m(false),
-      show_feature_edges_m(false),
-      facet_picking_m(false),
-      erase_next_picked_facet_m(false),
-      plugin_has_set_color_vector_m(false)
-{
-    cur_shading=FlatPlusEdges;
-    is_selected = true;
-    nb_facets = 0;
-    nb_lines = 0;
-    nb_f_lines = 0;
-    init();
-    invalidateOpenGLBuffers();
-}
-
-Scene_polyhedron_item::Scene_polyhedron_item(const Polyhedron& p)
-    : Scene_item(NbOfVbos,NbOfVaos),
-      poly(new Polyhedron(p)),
-      show_only_feature_edges_m(false),
-      show_feature_edges_m(false),
-      facet_picking_m(false),
-      erase_next_picked_facet_m(false),
-      plugin_has_set_color_vector_m(false)
-{
-    //setItemIsMulticolor(true);
-    cur_shading=FlatPlusEdges;
-    is_selected=true;
-    init();
-    nb_facets = 0;
-    nb_lines = 0;
-    nb_f_lines = 0;
-    invalidateOpenGLBuffers();
-}
-
-Scene_polyhedron_item::~Scene_polyhedron_item()
-{
-    delete_aabb_tree(this);
-    delete poly;
-}
-
-#include "Color_map.h"
-
-void
-Scene_polyhedron_item::
-init()
-{
-  typedef Polyhedron::Facet_iterator Facet_iterator;
-
-  if ( !plugin_has_set_color_vector_m )
-  {
-    // Fill indices map and get max subdomain value
-    int max = 0;
-    for(Facet_iterator fit = poly->facets_begin(), end = poly->facets_end() ;
-        fit != end; ++fit)
-    {
-      max = (std::max)(max, fit->patch_id());
-    }
-
-    colors_.resize(0);
-    compute_color_map(this->color(), max + 1,
-                      std::back_inserter(colors_));
-  }
-  invalidate_stats();
-}
-
-void
-Scene_polyhedron_item::
-invalidate_stats()
-{
-  number_of_degenerated_faces = (unsigned int)(-1);
-  number_of_null_length_edges = (unsigned int)(-1);
-  volume = -std::numeric_limits<double>::infinity();
-  area = -std::numeric_limits<double>::infinity();
-  self_intersect = false;
-
-}
-
-Scene_polyhedron_item*
-Scene_polyhedron_item::clone() const {
-    return new Scene_polyhedron_item(*poly);}
-
-// Load polyhedron from .OFF file
-bool
-Scene_polyhedron_item::load(std::istream& in)
-{
-
-
-    in >> *poly;
-
-    if ( in && !isEmpty() )
-    {
-        invalidateOpenGLBuffers();
-        return true;
-    }
-    return false;
-}
-// Load polyhedron from .obj file
-bool
-Scene_polyhedron_item::load_obj(std::istream& in)
-{
-  typedef Polyhedron::Vertex::Point Point;
-  std::vector<Point> points;
-  std::vector<std::vector<std::size_t> > faces;
-  
-  Point p;
-  std::string line;
-  std::size_t i, j, k;
-  bool failed = false;
-  while(getline(in, line)){
-    if(line[0] == 'v'){
-      std::istringstream iss(line.substr(1));
-      iss >> p;
-      if(! iss) failed = true;
-      points.push_back(p);
-    } else if(line[0] == 'f'){
-      std::istringstream iss(line.substr(1));
-      iss >> i >> j >> k;
-      if(! iss) failed = true;
-      std::vector<std::size_t> face;
-      face.push_back(i-1);
-      face.push_back(j-1);
-      face.push_back(k-1);
-      faces.push_back(face);
-    }
-  }
-  if(CGAL::Polygon_mesh_processing::orient_polygon_soup(points,faces)){
-    CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh( points,faces,*poly);
-  }else{
-    std::cerr << "not orientable"<< std::endl;
-    return false;
-  }
-    if ( (! failed) && !isEmpty() )
-    {
-        invalidateOpenGLBuffers();
-        return true;
-    }
-    return false;
-}
-
-// Write polyhedron to .OFF file
-bool
-Scene_polyhedron_item::save(std::ostream& out) const
-{
-  out.precision(17);
-    out << *poly;
-    return (bool) out;
-}
-
-QString
-Scene_polyhedron_item::toolTip() const
-{
-    if(!poly)
-        return QString();
-
-  QString str =
-         QObject::tr("<p>Polyhedron <b>%1</b> (mode: %5, color: %6)</p>"
-                       "<p>Number of vertices: %2<br />"
-                       "Number of edges: %3<br />"
-                     "Number of facets: %4")
-            .arg(this->name())
-            .arg(poly->size_of_vertices())
-            .arg(poly->size_of_halfedges()/2)
-            .arg(poly->size_of_facets())
-            .arg(this->renderingModeName())
-            .arg(this->color().name());
-  str += QString("<br />Number of isolated vertices : %1<br />").arg(getNbIsolatedvertices());
-  return str;
-}
-
-QMenu* Scene_polyhedron_item::contextMenu()
-{
-  const char* prop_name = "Menu modified by Scene_polyhedron_item.";
-
-  QMenu* menu = Scene_item::contextMenu();
-
-  // Use dynamic properties:
-  // http://doc.qt.io/qt-5/qobject.html#property
-  bool menuChanged = menu->property(prop_name).toBool();
-
-  if(!menuChanged) {
-
-    QAction* actionShowOnlyFeatureEdges =
-        menu->addAction(tr("Show Only &Feature Edges"));
-    actionShowOnlyFeatureEdges->setCheckable(true);
-    actionShowOnlyFeatureEdges->setChecked(show_only_feature_edges_m);
-    actionShowOnlyFeatureEdges->setObjectName("actionShowOnlyFeatureEdges");
-    connect(actionShowOnlyFeatureEdges, SIGNAL(toggled(bool)),
-            this, SLOT(show_only_feature_edges(bool)));
-
-    QAction* actionShowFeatureEdges =
-        menu->addAction(tr("Show Feature Edges"));
-    actionShowFeatureEdges->setCheckable(true);
-    actionShowFeatureEdges->setChecked(show_feature_edges_m);
-    actionShowFeatureEdges->setObjectName("actionShowFeatureEdges");
-    connect(actionShowFeatureEdges, SIGNAL(toggled(bool)),
-            this, SLOT(show_feature_edges(bool)));
-
-    QAction* actionPickFacets =
-        menu->addAction(tr("Facets Picking"));
-    actionPickFacets->setCheckable(true);
-    actionPickFacets->setObjectName("actionPickFacets");
-    connect(actionPickFacets, SIGNAL(toggled(bool)),
-            this, SLOT(enable_facets_picking(bool)));
-
-    QAction* actionEraseNextFacet =
-        menu->addAction(tr("Erase Next Picked Facet"));
-    actionEraseNextFacet->setCheckable(true);
-    actionEraseNextFacet->setObjectName("actionEraseNextFacet");
-    connect(actionEraseNextFacet, SIGNAL(toggled(bool)),
-            this, SLOT(set_erase_next_picked_facet(bool)));
-    menu->setProperty(prop_name, true);
-  }
-
-  QAction* action = menu->findChild<QAction*>("actionShowOnlyFeatureEdges");
-  if(action) action->setChecked(show_only_feature_edges_m);
-  action = menu->findChild<QAction*>("actionShowFeatureEdges");
-  if(action) action->setChecked(show_feature_edges_m);
-  action = menu->findChild<QAction*>("actionPickFacets");
-  if(action) action->setChecked(facet_picking_m);
-  action = menu->findChild<QAction*>("actionEraseNextFacet");
-  if(action) action->setChecked(erase_next_picked_facet_m);
-  return menu;
-}
-
-void Scene_polyhedron_item::show_only_feature_edges(bool b)
-{
-    show_only_feature_edges_m = b;
-    invalidateOpenGLBuffers();
-    Q_EMIT itemChanged();
-}
-
-void Scene_polyhedron_item::show_feature_edges(bool b)
-{
-  show_feature_edges_m = b;
-  invalidateOpenGLBuffers();
-  Q_EMIT itemChanged();
-}
-
-void Scene_polyhedron_item::enable_facets_picking(bool b)
-{
-    facet_picking_m = b;
-}
-
-void Scene_polyhedron_item::set_erase_next_picked_facet(bool b)
-{
-    if(b) { facet_picking_m = true; } // automatically activate facet_picking
-    erase_next_picked_facet_m = b;
-}
-
-void Scene_polyhedron_item::draw(CGAL::Three::Viewer_interface* viewer) const {
-    if(!are_buffers_filled)
-    {
-        compute_normals_and_vertices();
-        initialize_buffers(viewer);
-        compute_bbox();
-    }
-
-    if(renderingMode() == Flat || renderingMode() == FlatPlusEdges)
-        vaos[Facets]->bind();
-    else
-    {
-        vaos[Gouraud_Facets]->bind();
-    }
-    attrib_buffers(viewer, PROGRAM_WITH_LIGHT);
-    program = getShaderProgram(PROGRAM_WITH_LIGHT);
-    program->bind();
-    if(is_monochrome)
-    {
-            program->setAttributeValue("colors", this->color());
-    }
-    if(is_selected)
-            program->setUniformValue("is_selected", true);
-    else
-            program->setUniformValue("is_selected", false);
-    viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(nb_facets/4));
-    program->release();
-    if(renderingMode() == Flat || renderingMode() == FlatPlusEdges)
-        vaos[Facets]->release();
-    else
-        vaos[Gouraud_Facets]->release();
-}
-
-// Points/Wireframe/Flat/Gouraud OpenGL drawing in a display list
-void Scene_polyhedron_item::draw_edges(CGAL::Three::Viewer_interface* viewer) const
-{
-    if (!are_buffers_filled)
-    {
-        compute_normals_and_vertices();
-        initialize_buffers(viewer);
-        compute_bbox();
-    }
-
-    if(!show_only_feature_edges_m)
-    {
-        vaos[Edges]->bind();
-
-        attrib_buffers(viewer, PROGRAM_WITHOUT_LIGHT);
-        program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
-        program->bind();
-        //draw the edges
-        if(is_monochrome)
-        {
-            program->setAttributeValue("colors", this->color().lighter(50));
-            if(is_selected)
-                program->setUniformValue("is_selected", true);
-            else
-                program->setUniformValue("is_selected", false);
-        }
-        viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(nb_lines/4));
-        program->release();
-        vaos[Edges]->release();
-    }
-
-    //draw the feature edges
-    vaos[Feature_edges]->bind();
-    attrib_buffers(viewer, PROGRAM_NO_SELECTION);
-    program = getShaderProgram(PROGRAM_NO_SELECTION);
-    program->bind();
-    if(show_feature_edges_m || show_only_feature_edges_m)
-        program->setAttributeValue("colors", Qt::red);
-    else
-    {
-        if(!is_selected)
-            program->setAttributeValue("colors", this->color().lighter(50));
-        else
-            program->setAttributeValue("colors",QColor(0,0,0));
-    }
-    viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(nb_f_lines/4));
-    program->release();
-    vaos[Feature_edges]->release();
-    }
-
-void
-Scene_polyhedron_item::draw_points(CGAL::Three::Viewer_interface* viewer) const {
-    if(!are_buffers_filled)
-    {
-        compute_normals_and_vertices();
-        initialize_buffers(viewer);
-        compute_bbox();
-    }
-
-    vaos[Edges]->bind();
-    attrib_buffers(viewer, PROGRAM_WITHOUT_LIGHT);
-    program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
-    program->bind();
-    //draw the points
-    viewer->glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(nb_lines/4));
-    // Clean-up
-    program->release();
-    vaos[Edges]->release();
-}
-
-Polyhedron*
-Scene_polyhedron_item::polyhedron()       { return poly; }
-const Polyhedron*
-Scene_polyhedron_item::polyhedron() const { return poly; }
-
-bool
-Scene_polyhedron_item::isEmpty() const {
-    return (poly == 0) || poly->empty();
-}
-
-void Scene_polyhedron_item::compute_bbox() const {
-    const Kernel::Point_3& p = *(poly->points_begin());
-    CGAL::Bbox_3 bbox(p.x(), p.y(), p.z(), p.x(), p.y(), p.z());
-    for(Polyhedron::Point_iterator it = poly->points_begin();
-        it != poly->points_end();
-        ++it) {
-        bbox = bbox + it->bbox();
-    }
-    _bbox = Bbox(bbox.xmin(),bbox.ymin(),bbox.zmin(),
-                bbox.xmax(),bbox.ymax(),bbox.zmax());
-}
-
-
-void
-Scene_polyhedron_item::
-invalidateOpenGLBuffers()
-{
-  Q_EMIT item_is_about_to_be_changed();
-    delete_aabb_tree(this);
-    init();
-    Base::invalidateOpenGLBuffers();
-    are_buffers_filled = false;
-
-    invalidate_stats();
-}
-
-void
-Scene_polyhedron_item::selection_changed(bool p_is_selected)
-{
-    if(p_is_selected != is_selected)
-    {
-        is_selected = p_is_selected;
-    }
-
-}
-
-void
-Scene_polyhedron_item::setColor(QColor c)
-{
-  // reset patch ids
-  if (colors_.size()>2 || plugin_has_set_color_vector_m)
-  {
-    BOOST_FOREACH(Polyhedron::Facet_handle fh, faces(*poly))
-      fh->set_patch_id(1);
-    colors_[1]=c;
-  }
-  Scene_item::setColor(c);
-}
-
-void
-Scene_polyhedron_item::select(double orig_x,
-                              double orig_y,
-                              double orig_z,
-                              double dir_x,
-                              double dir_y,
-                              double dir_z)
-{
-    if(facet_picking_m) {
-        typedef Input_facets_AABB_tree Tree;
-        typedef Tree::Object_and_primitive_id Object_and_primitive_id;
-
-        Tree* aabb_tree = get_aabb_tree(this);
-        if(aabb_tree) {
-            const Kernel::Point_3 ray_origin(orig_x, orig_y, orig_z);
-            const Kernel::Vector_3 ray_dir(dir_x, dir_y, dir_z);
-            const Kernel::Ray_3 ray(ray_origin, ray_dir);
-            typedef std::list<Object_and_primitive_id> Intersections;
-            Intersections intersections;
-            aabb_tree->all_intersections(ray, std::back_inserter(intersections));
-            Intersections::iterator closest = intersections.begin();
-            if(closest != intersections.end()) {
-                const Kernel::Point_3* closest_point =
-                        CGAL::object_cast<Kernel::Point_3>(&closest->first);
-                for(Intersections::iterator
-                    it = boost::next(intersections.begin()),
-                    end = intersections.end();
-                    it != end; ++it)
-                {
-                    if(! closest_point) {
-                        closest = it;
-                    }
-                    else {
-                        const Kernel::Point_3* it_point =
-                                CGAL::object_cast<Kernel::Point_3>(&it->first);
-                        if(it_point &&
-                                (ray_dir * (*it_point - *closest_point)) < 0)
-                        {
-                            closest = it;
-                            closest_point = it_point;
-                        }
-                    }
-                }
-                if(closest_point) {
-                    Polyhedron::Facet_handle selected_fh = closest->second;
-
-                    // The computation of the nearest vertex may be costly.  Only
-                    // do it if some objects are connected to the signal
-                    // 'selected_vertex'.
-                    if(QObject::receivers(SIGNAL(selected_vertex(void*))) > 0)
-                    {
-                        Polyhedron::Halfedge_around_facet_circulator
-                                he_it = selected_fh->facet_begin(),
-                                around_end = he_it;
-
-                        Polyhedron::Vertex_handle v = he_it->vertex(), nearest_v = v;
-
-                        Kernel::FT sq_dist = CGAL::squared_distance(*closest_point,
-                                                                    v->point());
-                        while(++he_it != around_end) {
-                            v = he_it->vertex();
-                            Kernel::FT new_sq_dist = CGAL::squared_distance(*closest_point,
-                                                                            v->point());
-                            if(new_sq_dist < sq_dist) {
-                                sq_dist = new_sq_dist;
-                                nearest_v = v;
-                            }
-                        }
-                        //bottleneck
-            Q_EMIT selected_vertex((void*)(&*nearest_v));
-                    }
-
-                    if(QObject::receivers(SIGNAL(selected_edge(void*))) > 0
-                            || QObject::receivers(SIGNAL(selected_halfedge(void*))) > 0)
-                    {
-                        Polyhedron::Halfedge_around_facet_circulator
-                                he_it = selected_fh->facet_begin(),
-                                around_end = he_it;
-
-                        Polyhedron::Halfedge_handle nearest_h = he_it;
-                        Kernel::FT sq_dist = CGAL::squared_distance(*closest_point,
-                                                                    Kernel::Segment_3(he_it->vertex()->point(), he_it->opposite()->vertex()->point()));
-
-                        while(++he_it != around_end) {
-                            Kernel::FT new_sq_dist = CGAL::squared_distance(*closest_point,
-                                                                            Kernel::Segment_3(he_it->vertex()->point(), he_it->opposite()->vertex()->point()));
-                            if(new_sq_dist < sq_dist) {
-                                sq_dist = new_sq_dist;
-                                nearest_h = he_it;
-                            }
-                        }
-
-            Q_EMIT selected_halfedge((void*)(&*nearest_h));
-            Q_EMIT selected_edge((void*)(std::min)(&*nearest_h, &*nearest_h->opposite()));
-                    }
-
-          Q_EMIT selected_facet((void*)(&*selected_fh));
-                    if(erase_next_picked_facet_m) {
-                        polyhedron()->erase_facet(selected_fh->halfedge());
-                        polyhedron()->normalize_border();
-                        //set_erase_next_picked_facet(false);
-                        invalidateOpenGLBuffers();
-            Q_EMIT itemChanged();
-                    }
-                }
-            }
-        }
-    }
-    Base::select(orig_x, orig_y, orig_z, dir_x, dir_y, dir_z);
-}
-
-void Scene_polyhedron_item::update_vertex_indices()
-{
-    std::size_t id=0;
-    for (Polyhedron::Vertex_iterator vit = polyhedron()->vertices_begin(),
-         vit_end = polyhedron()->vertices_end(); vit != vit_end; ++vit)
-    {
-        vit->id()=id++;
-    }
-}
-void Scene_polyhedron_item::update_facet_indices()
-{
-    std::size_t id=0;
-    for (Polyhedron::Facet_iterator  fit = polyhedron()->facets_begin(),
-         fit_end = polyhedron()->facets_end(); fit != fit_end; ++fit)
-    {
-        fit->id()=id++;
-    }
-}
-void Scene_polyhedron_item::update_halfedge_indices()
-{
-    std::size_t id=0;
-    for (Polyhedron::Halfedge_iterator hit = polyhedron()->halfedges_begin(),
-         hit_end = polyhedron()->halfedges_end(); hit != hit_end; ++hit)
-    {
-        hit->id()=id++;
-    }
-}
-void Scene_polyhedron_item::invalidate_aabb_tree()
-{
-  delete_aabb_tree(this);
-}
-QString Scene_polyhedron_item::compute_stats(int type)
-{
-  double minl, maxl, meanl, midl;
-  switch (type)
-  {
-  case MIN_LENGTH:
-  case MAX_LENGTH:
-  case MID_LENGTH:
-  case MEAN_LENGTH:
-  case NB_NULL_LENGTH:
-    poly->normalize_border();
-    edges_length(poly, minl, maxl, meanl, midl, number_of_null_length_edges);
-  }
-
-  double mini, maxi, ave;
-  switch (type)
-  {
-  case MIN_ANGLE:
-  case MAX_ANGLE:
-  case MEAN_ANGLE:
-    angles(poly, mini, maxi, ave);
-  }
-
-  switch(type)
-  {
-  case NB_VERTICES:
-    return QString::number(poly->size_of_vertices());
-
-  case NB_FACETS:
-    return QString::number(poly->size_of_facets());
-  
-  case NB_CONNECTED_COMPOS:
-  {
-    typedef boost::graph_traits<Polyhedron>::face_descriptor face_descriptor;
-    int i = 0;
-    BOOST_FOREACH(face_descriptor f, faces(*poly)){
-      f->id() = i++;
-    }
-    boost::vector_property_map<int,
-      boost::property_map<Polyhedron, boost::face_index_t>::type>
-      fccmap(get(boost::face_index, *poly));
-    return QString::number(PMP::connected_components(*poly, fccmap));
-  }
-  case NB_BORDER_EDGES:
-    poly->normalize_border();
-    return QString::number(poly->size_of_border_halfedges());
-
-  case NB_EDGES:
-    return QString::number(poly->size_of_halfedges() / 2);
-
-  case NB_DEGENERATED_FACES:
-  {
-    if (poly->is_pure_triangle())
-    {
-      if (number_of_degenerated_faces == (unsigned int)(-1))
-        number_of_degenerated_faces = nb_degenerate_faces(poly, get(CGAL::vertex_point, *poly));
-      return QString::number(number_of_degenerated_faces);
-    }
-    else
-      return QString("n/a");
-  }
-  case AREA:
-  {
-    if (poly->is_pure_triangle())
-    {
-      if(area == -std::numeric_limits<double>::infinity())
-        area = CGAL::Polygon_mesh_processing::area(*poly);
-      return QString::number(area);
-    }
-    else
-      return QString("n/a");
-  }
-  case VOLUME:
-  {
-    if (poly->is_pure_triangle() && poly->is_closed())
-    {
-      if (volume == -std::numeric_limits<double>::infinity())
-        volume = CGAL::Polygon_mesh_processing::volume(*poly);
-      return QString::number(volume);
-    }
-    else
-      return QString("n/a");
-  }
-  case SELFINTER:
-  {
-    //todo : add a test about cache validity
-    if (poly->is_pure_triangle())
-      self_intersect = CGAL::Polygon_mesh_processing::does_self_intersect(*poly);
-    if (self_intersect)
-      return QString("Yes");
-    else if (poly->is_pure_triangle())
-      return QString("No");
-    else
-      return QString("n/a");
-  }
-  case MIN_LENGTH:
-    return QString::number(minl);
-  case MAX_LENGTH:
-    return QString::number(maxl);
-  case MID_LENGTH:
-    return QString::number(midl);
-  case MEAN_LENGTH:
-    return QString::number(meanl);
-  case NB_NULL_LENGTH:
-    return QString::number(number_of_null_length_edges);
-
-  case MIN_ANGLE:
-    return QString::number(mini);
-  case MAX_ANGLE:
-    return QString::number(maxi);
-  case MEAN_ANGLE:
-    return QString::number(ave);
-
-  case HOLES:
-    return QString::number(nb_holes(poly));
-  }
-  return QString();
-}
-
-CGAL::Three::Scene_item::Header_data Scene_polyhedron_item::header() const
-{
-  CGAL::Three::Scene_item::Header_data data;
-  //categories
-  data.categories.append(std::pair<QString,int>(QString("Properties"),9));
-  data.categories.append(std::pair<QString,int>(QString("Edges"),6));
-  data.categories.append(std::pair<QString,int>(QString("Angles"),3));
-
-
-  //titles
-  data.titles.append(QString("#Vertices"));
-  data.titles.append(QString("#Facets"));
-  data.titles.append(QString("#Connected Components"));
-  data.titles.append(QString("#Border Edges"));
-  data.titles.append(QString("#Degenerated Faces"));
-  data.titles.append(QString("Connected Components of the Boundary"));
-  data.titles.append(QString("Area"));
-  data.titles.append(QString("Volume"));
-  data.titles.append(QString("Self-Intersecting"));
-  data.titles.append(QString("#Edges"));
-  data.titles.append(QString("Minimum Length"));
-  data.titles.append(QString("Maximum Length"));
-  data.titles.append(QString("Median Length"));
-  data.titles.append(QString("Mean Length"));
-  data.titles.append(QString("#Null Length"));
-  data.titles.append(QString("Minimum"));
-  data.titles.append(QString("Maximum"));
-  data.titles.append(QString("Average"));
-  return data;
-}
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polyhedron_item.h b/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polyhedron_item.h
deleted file mode 100644
index 4db00b2..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polyhedron_item.h
+++ /dev/null
@@ -1,186 +0,0 @@
-#ifndef SCENE_POLYHEDRON_ITEM_H
-#define SCENE_POLYHEDRON_ITEM_H
-
-#include "Scene_polyhedron_item_config.h"
-#include  <CGAL/Three/Scene_item.h> //<- modif ?
-#include "Polyhedron_type_fwd.h"
-#include "Polyhedron_type.h"
-#include "Viewer.h"
-#include <iostream>
-#include <QOpenGLVertexArrayObject>
-#include <QOpenGLBuffer>
-#include <QOpenGLShaderProgram>
-#include <QOpenGLTexture>
-
-#include <set>
-#include <vector>
-
-#include <QColor>
-
-class QMenu;
-
-// This class represents a polyhedron in the OpenGL scene
-class SCENE_POLYHEDRON_ITEM_EXPORT Scene_polyhedron_item
-        : public CGAL::Three::Scene_item{
-    Q_OBJECT
-public:
-    enum STATS {
-      NB_VERTICES = 0,
-      NB_FACETS,
-      NB_CONNECTED_COMPOS,
-      NB_BORDER_EDGES,
-      NB_DEGENERATED_FACES,
-      HOLES,
-      AREA,
-      VOLUME,
-      SELFINTER,
-      NB_EDGES,
-      MIN_LENGTH,
-      MAX_LENGTH,
-      MID_LENGTH,
-      MEAN_LENGTH,
-      NB_NULL_LENGTH,
-      MIN_ANGLE,
-      MAX_ANGLE,
-      MEAN_ANGLE
-    };
-    QString compute_stats(int type);
-    CGAL::Three::Scene_item::Header_data header() const;
-    Scene_polyhedron_item();
-    //   Scene_polyhedron_item(const Scene_polyhedron_item&);
-    Scene_polyhedron_item(const Polyhedron& p);
-    Scene_polyhedron_item(Polyhedron* const p);
-    ~Scene_polyhedron_item();
-
-    Scene_polyhedron_item* clone() const;
-
-    // IO
-    bool load(std::istream& in);
-    bool load_obj(std::istream& in);
-    bool save(std::ostream& out) const;
-
-    // Function for displaying meta-data of the item
-    virtual QString toolTip() const;
-
-    // Function to override the context menu
-    QMenu* contextMenu();
-
-    // Indicate if rendering mode is supported
-    virtual bool supportsRenderingMode(RenderingMode m) const { return (m!=PointsPlusNormals && m!=Splatting); }
-    // Points/Wireframe/Flat/Gouraud OpenGL drawing in a display list
-    void draw() const {}
-    virtual void draw(CGAL::Three::Viewer_interface*) const;
-    virtual void draw_edges() const {}
-    virtual void draw_edges(CGAL::Three::Viewer_interface* viewer) const;
-    virtual void draw_points(CGAL::Three::Viewer_interface*) const;
-
-    // Get wrapped polyhedron
-    Polyhedron*       polyhedron();
-    const Polyhedron* polyhedron() const;
-
-    // Get dimensions
-    bool isFinite() const { return true; }
-    bool isEmpty() const;
-    void compute_bbox() const;
-    std::vector<QColor>& color_vector() {return colors_;}
-    void set_color_vector_read_only(bool on_off) {plugin_has_set_color_vector_m=on_off;}
-    int getNumberOfNullLengthEdges(){return number_of_null_length_edges;}
-    int getNumberOfDegeneratedFaces(){return number_of_degenerated_faces;}
-    bool triangulated(){return poly->is_pure_triangle();}
-    bool self_intersected(){return !self_intersect;}
-
-public Q_SLOTS:
-    virtual void invalidateOpenGLBuffers();
-    virtual void selection_changed(bool);
-    virtual void setColor(QColor c);
-	virtual void show_feature_edges(bool);
-    void show_only_feature_edges(bool);
-    void enable_facets_picking(bool);
-    void set_erase_next_picked_facet(bool);
-
-    void select(double orig_x,
-                double orig_y,
-                double orig_z,
-                double dir_x,
-                double dir_y,
-                double dir_z);
-
-    void update_vertex_indices();
-    void update_facet_indices();
-    void update_halfedge_indices();
-    void invalidate_aabb_tree();
-
-Q_SIGNALS:
-    void selected_vertex(void*);
-    void selected_facet(void*);
-    void selected_edge(void*);
-    void selected_halfedge(void*);
-    void item_is_about_to_be_changed(); // emitted in invalidateOpenGLBuffers()
-
-private:
-    // Initialization
-    void init();
-    void invalidate_stats();
-
-private:
-    Polyhedron* poly;
-
-private:
-    typedef Scene_item Base;
-    typedef std::vector<QColor> Color_vector;
-    typedef Polyhedron::Facet_iterator Facet_iterator;
-
-
-    Color_vector colors_;
-    bool show_only_feature_edges_m;
-    bool show_feature_edges_m;
-    bool facet_picking_m;
-    bool erase_next_picked_facet_m;
-    //the following variable is used to indicate if the color vector must not be automatically updated.
-    bool plugin_has_set_color_vector_m;
-
-    enum VAOs {
-        Facets=0,
-        Edges,
-        Feature_edges,
-        Gouraud_Facets,
-        NbOfVaos = Gouraud_Facets+1
-    };
-    enum VBOs {
-        Facets_vertices = 0,
-        Facets_normals_flat,
-        Facets_color,
-        Edges_vertices,
-        Feature_edges_vertices,
-        Edges_color,
-        Facets_normals_gouraud,
-        NbOfVbos = Facets_normals_gouraud+1
-    };
-
-    mutable std::vector<float> positions_lines;
-    mutable std::vector<float> positions_feature_lines;
-    mutable std::vector<float> positions_facets;
-    mutable std::vector<float> normals_flat;
-    mutable std::vector<float> normals_gouraud;
-    mutable std::vector<float> color_lines;
-    mutable std::vector<float> color_facets;
-    mutable std::size_t nb_facets;
-    mutable std::size_t nb_lines;
-    mutable std::size_t nb_f_lines;
-    mutable QOpenGLShaderProgram *program;
-    mutable unsigned int number_of_null_length_edges;
-    mutable unsigned int number_of_degenerated_faces;
-    mutable bool self_intersect;
-
-    using CGAL::Three::Scene_item::initialize_buffers;
-    void initialize_buffers(CGAL::Three::Viewer_interface *viewer = 0) const;
-    void compute_normals_and_vertices(const bool colors_only = false) const;
-    template<typename FaceNormalPmap, typename VertexNormalPmap>
-    void triangulate_facet(Facet_iterator,
-      const FaceNormalPmap&, const VertexNormalPmap&,
-      const bool colors_only) const;
-    double volume, area;
-
-}; // end class Scene_polyhedron_item
-
-#endif // SCENE_POLYHEDRON_ITEM_H
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polyhedron_item_decorator.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polyhedron_item_decorator.cpp
deleted file mode 100644
index 3172020..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polyhedron_item_decorator.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-#include "Scene_polyhedron_item_decorator.h"
-#include "Polyhedron_type.h"
-
-Scene_polyhedron_item_decorator::Scene_polyhedron_item_decorator
-  (Scene_polyhedron_item* poly_item, bool delete_item)
-  :CGAL::Three::Scene_item(), poly_item(poly_item), delete_poly_item(delete_item)
-{ }
-
-Scene_polyhedron_item_decorator::~Scene_polyhedron_item_decorator()
-{ 
-  if(delete_poly_item) { delete poly_item; }
-}
-
-Scene_polyhedron_item_decorator* 
-Scene_polyhedron_item_decorator::clone() const {
-  return 0;
-}
-
-QString 
-Scene_polyhedron_item_decorator::toolTip() const
-{
-  if(!poly_item->polyhedron())
-    return QString();
-
-  return QObject::tr("<p>Polyhedron <b>%1</b> (mode: %5, color: %6)</p>"
-                     "<p>Number of vertices: %2<br />"
-                     "Number of edges: %3<br />"
-                     "Number of facets: %4</p>")
-    .arg(this->name())
-    .arg(poly_item->polyhedron()->size_of_vertices())
-    .arg(poly_item->polyhedron()->size_of_halfedges()/2)
-    .arg(poly_item->polyhedron()->size_of_facets())
-    .arg(this->renderingModeName())
-    .arg(this->color().name());
-}
-
-void Scene_polyhedron_item_decorator::draw() const {
-  poly_item->draw();
-}
-
-void Scene_polyhedron_item_decorator::draw_edges() const {
-  poly_item->draw_edges();
-}
-
-Polyhedron* 
-Scene_polyhedron_item_decorator::polyhedron()       
-{ return poly_item->polyhedron(); }
-
-const Polyhedron* 
-Scene_polyhedron_item_decorator::polyhedron() const 
-{ return poly_item->polyhedron(); }
-
-bool
-Scene_polyhedron_item_decorator::isEmpty() const {
-  return poly_item->isEmpty();
-}
-
-void
-Scene_polyhedron_item_decorator::compute_bbox() const {
-  _bbox = poly_item->bbox();
-}
-
-
-void
-Scene_polyhedron_item_decorator::
-invalidateOpenGLBuffers()
-{
-  poly_item->invalidateOpenGLBuffers();
-  Scene_item::invalidateOpenGLBuffers();
-  compute_bbox();
-}
-
-void 
-Scene_polyhedron_item_decorator::select(double orig_x,
-                                   double orig_y,
-                                   double orig_z,
-                                   double dir_x,
-                                   double dir_y,
-                                   double dir_z)
-{
-  Scene_item::select(orig_x,
-                     orig_y,
-                     orig_z,
-                     dir_x,
-                     dir_y,
-                     dir_z);
-  poly_item->select(orig_x,
-                       orig_y,
-                       orig_z,
-                       dir_x,
-                       dir_y,
-                       dir_z);
-}
-
-Scene_polyhedron_item* Scene_polyhedron_item_decorator::polyhedron_item() const {
-  return poly_item;
-}
-
-void Scene_polyhedron_item_decorator::set_polyhedron_item(Scene_polyhedron_item* poly_item) {
-  this->poly_item = poly_item;
-}
-
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polyhedron_item_decorator.h b/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polyhedron_item_decorator.h
deleted file mode 100644
index 3766890..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polyhedron_item_decorator.h
+++ /dev/null
@@ -1,65 +0,0 @@
-#ifndef SCENE_POLYHEDRON_ITEM_DECORATOR_H
-#define SCENE_POLYHEDRON_ITEM_DECORATOR_H
-#include "Scene_polyhedron_item_decorator_config.h"
-#include "Scene_polyhedron_item.h"
-
-// This class is a decorator for Scene_polyhedron_item yet it does not inherit it but Scene_item
-class SCENE_POLYHEDRON_ITEM_DECORATOR_EXPORT Scene_polyhedron_item_decorator 
-  : public CGAL::Three::Scene_item {
-  Q_OBJECT
-public:  
-  /// Create an Scene_polyhedron_item_decorator from a Scene_polyhedron_item.
-
-  Scene_polyhedron_item_decorator(Scene_polyhedron_item* poly_item, bool delete_item = true);
-  ~Scene_polyhedron_item_decorator();
-
-  /// Returns 0, so that one cannot clone decorator
-  Scene_polyhedron_item_decorator* clone() const;
-  
-  // // IO
-  // bool load(std::istream& in);
-  // bool save(std::ostream& out) const;
-
-  // Function for displaying meta-data of the item
-  QString toolTip() const;
-
-  // // Function to override the context menu
-  // QMenu* contextMenu();
-  
-  // Indicate if rendering mode is supported
-  bool supportsRenderingMode(RenderingMode m) const { return (m!=PointsPlusNormals && m!=Splatting); }
-  // Points/Wireframe/Flat/Gouraud OpenGL drawing in a display list
-  // dispatch to poly_item direct_draw and direct_draw_edges
-  void draw() const;
-  void draw_edges() const;
-
-  // Get wrapped polyhedron
-  Polyhedron*       polyhedron();
-  const Polyhedron* polyhedron() const;
-
-  Scene_polyhedron_item* polyhedron_item() const;
-  void                   set_polyhedron_item(Scene_polyhedron_item* poly_item);
-
-  // Get dimensions
-  bool isFinite() const { return true; }
-  bool isEmpty() const;
-  void compute_bbox() const;
-
-  bool delete_item() { return delete_poly_item; }
-  void set_delete_item(bool delete_item) { delete_poly_item = delete_item; }
-
-public Q_SLOTS:
-  void invalidateOpenGLBuffers();
-  void select(double orig_x,
-              double orig_y,
-              double orig_z,
-              double dir_x,
-              double dir_y,
-              double dir_z);
-
-protected:
-  Scene_polyhedron_item* poly_item;
-  bool delete_poly_item;
-}; // end class Scene_polyhedron_item_decorator
-
-#endif // SCENE_POLYHEDRON_ITEM_DECORATOR_H
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polyhedron_item_k_ring_selection.h b/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polyhedron_item_k_ring_selection.h
deleted file mode 100644
index e277792..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polyhedron_item_k_ring_selection.h
+++ /dev/null
@@ -1,236 +0,0 @@
-#ifndef SCENE_POLYHEDRON_ITEM_K_RING_SELECTION_H
-#define SCENE_POLYHEDRON_ITEM_K_RING_SELECTION_H
-#include "Scene_polyhedron_item_k_ring_selection_config.h"
-#include "Polyhedron_type.h"
-#include "Scene_polyhedron_item.h"
-
-#include <QGLViewer/qglviewer.h>
-#include <QKeyEvent>
-#include <QMouseEvent>
-#include <QMainWindow>
-#include <QObject>
-
-#include <map>
-#include <queue>
-
-#include <CGAL/boost/graph/selection.h>
-
-class SCENE_POLYHEDRON_ITEM_K_RING_SELECTION_EXPORT Scene_polyhedron_item_k_ring_selection 
-  : public QObject
-{
-  Q_OBJECT
-public:
-  struct Active_handle {
-    enum Type{ VERTEX = 0, FACET = 1, EDGE = 2 , CONNECTED_COMPONENT = 3}; };
-
-  typedef boost::graph_traits<Polyhedron>::edge_descriptor edge_descriptor;
-
-  // Hold mouse keyboard state together
-  struct Mouse_keyboard_state
-  {
-    Mouse_keyboard_state() : shift_pressing(false), left_button_pressing(false) { }
-    bool shift_pressing, left_button_pressing;
-  };
-
-  Mouse_keyboard_state  state;
-
-  Active_handle::Type    active_handle_type;
-  int                    k_ring;
-  Scene_polyhedron_item* poly_item;
-  bool is_active;
-
-  Scene_polyhedron_item_k_ring_selection() {}
-
-  Scene_polyhedron_item_k_ring_selection
-    (Scene_polyhedron_item* poly_item, QMainWindow* mw, Active_handle::Type aht, int k_ring)
-      :is_active(false)
-  {
-    init(poly_item, mw, aht, k_ring);
-  }
-
-  void init(Scene_polyhedron_item* poly_item, QMainWindow* /*mw*/, Active_handle::Type aht, int k_ring) {
-    this->poly_item = poly_item;
-    this->active_handle_type = aht;
-    this->k_ring = k_ring;
-
-    poly_item->enable_facets_picking(true);
-    poly_item->set_color_vector_read_only(true);
-
-    QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
-    viewer->installEventFilter(this);
-#if QGLVIEWER_VERSION >= 0x020501
-    viewer->setMouseBindingDescription(Qt::Key_D, Qt::ShiftModifier, Qt::LeftButton, "(When in selection plugin) Removes the clicked primitive from the selection. ");
-#else
-    viewer->setMouseBindingDescription(Qt::SHIFT + Qt::LeftButton,  "(When in selection plugin) When D is pressed too, removes the clicked primitive from the selection. ");
-#endif
-    connect(poly_item, SIGNAL(selected_vertex(void*)), this, SLOT(vertex_has_been_selected(void*)));
-    connect(poly_item, SIGNAL(selected_facet(void*)), this, SLOT(facet_has_been_selected(void*)));
-    connect(poly_item, SIGNAL(selected_edge(void*)), this, SLOT(edge_has_been_selected(void*)));
-  }
-
-public Q_SLOTS:
-  // slots are called by signals of polyhedron_item
-  void vertex_has_been_selected(void* void_ptr) 
-  {
-    is_active=true;
-    if(active_handle_type != Active_handle::VERTEX) { return; }
-    process_selection( static_cast<Polyhedron::Vertex*>(void_ptr)->halfedge()->vertex() );
-  }
-  void facet_has_been_selected(void* void_ptr)
-  {
-    is_active=true;
-    if (active_handle_type == Active_handle::FACET
-      || active_handle_type == Active_handle::CONNECTED_COMPONENT)
-      process_selection(static_cast<Polyhedron::Facet*>(void_ptr)->halfedge()->facet());
-  }
-  void edge_has_been_selected(void* void_ptr) 
-  {
-    is_active=true;
-    if(active_handle_type != Active_handle::EDGE) { return; }
-    process_selection( edge(static_cast<Polyhedron::Halfedge*>(void_ptr)->opposite()->opposite(), *poly_item->polyhedron()) );
-  }
-
-Q_SIGNALS:
-  void selected(const std::set<Polyhedron::Vertex_handle>&);
-  void selected(const std::set<Polyhedron::Facet_handle>&);
-  void selected(const std::set<edge_descriptor>&);
-  void toogle_insert(const bool);
-  void endSelection();
-
-protected:
-
-  template<class HandleType>
-  void process_selection(HandleType clicked) {
-    const std::set<HandleType>& selection = extract_k_ring(clicked, k_ring);
-    Q_EMIT selected(selection);
-  }
-
-  template <class Handle>
-  struct Is_selected_from_set{
-    std::set<Handle>& selection;
-    Is_selected_from_set(std::set<Handle>& selection)
-      :selection(selection) {}
-    friend bool get(Is_selected_from_set<Handle> map, Handle k)
-    {
-      return map.selection.count(k);
-    }
-    friend void put(Is_selected_from_set<Handle> map, Handle k, bool b)
-    {
-      if (b)
-        map.selection.insert(k);
-      else
-        map.selection.erase(k);
-    }
-  };
-
-  std::set<Polyhedron::Vertex_handle>
-  extract_k_ring(Polyhedron::Vertex_handle clicked, unsigned int k)
-  {
-    std::set<Polyhedron::Vertex_handle> selection;
-    selection.insert(clicked);
-    if (k>0)
-      CGAL::expand_vertex_selection(CGAL::make_array(clicked),
-                                    *poly_item->polyhedron(),
-                                    k,
-                                    Is_selected_from_set<Polyhedron::Vertex_handle>(selection),
-                                    CGAL::Emptyset_iterator());
-
-    return selection;
-  }
-
-  std::set<Polyhedron::Facet_handle>
-  extract_k_ring(Polyhedron::Facet_handle clicked, unsigned int k)
-  {
-    std::set<Polyhedron::Facet_handle> selection;
-    selection.insert(clicked);
-    if (k>0)
-      CGAL::expand_face_selection(CGAL::make_array(clicked),
-                                  *poly_item->polyhedron(),
-                                  k,
-                                  Is_selected_from_set<Polyhedron::Facet_handle>(selection),
-                                  CGAL::Emptyset_iterator());
-
-    return selection;
-  }
-
-  std::set<edge_descriptor>
-  extract_k_ring(edge_descriptor clicked, unsigned int k)
-  {
-    std::set<edge_descriptor> selection;
-    selection.insert(clicked);
-
-    if (k>0)
-      CGAL::expand_edge_selection(CGAL::make_array(clicked),
-                                  *poly_item->polyhedron(),
-                                  k,
-                                  Is_selected_from_set<edge_descriptor>(selection),
-                                  CGAL::Emptyset_iterator());
-    return selection;
-  }
-
-
-  bool eventFilter(QObject* /*target*/, QEvent *event)
-  {
-    // This filter is both filtering events from 'viewer' and 'main window'
-    // key events
-      if(event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease)  {
-      QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
-      Qt::KeyboardModifiers modifiers = keyEvent->modifiers();
-
-      state.shift_pressing = modifiers.testFlag(Qt::ShiftModifier);
-    }
-
-    if(event->type() == QEvent::KeyPress
-            && state.shift_pressing
-            && static_cast<QKeyEvent*>(event)->key()==Qt::Key_D)
-    {
-     Q_EMIT toogle_insert(false);
-    }
-    else if(event->type() == QEvent::KeyRelease
-            && static_cast<QKeyEvent*>(event)->key()==Qt::Key_D)
-    {
-     Q_EMIT toogle_insert(true);
-    }
-    // mouse events
-    if(event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonRelease) {
-      QMouseEvent* mouse_event = static_cast<QMouseEvent*>(event);
-      if(mouse_event->button() == Qt::LeftButton) {
-        state.left_button_pressing = event->type() == QEvent::MouseButtonPress;
-        if (!state.left_button_pressing)
-          if (is_active)
-          {
-            Q_EMIT endSelection();
-            is_active=false;
-          }
-      }
-      //to avoid the contextual menu to mess up the states.
-      else if(mouse_event->button() == Qt::RightButton) {
-          state.left_button_pressing = false;
-          state.shift_pressing = false;
-        }
-    }
-    // use mouse move event for paint-like selection
-    if( (event->type() == QEvent::MouseMove
-         || (event->type() == QEvent::MouseButtonPress
-             && static_cast<QMouseEvent*>(event)->button() == Qt::LeftButton))
-      && (state.shift_pressing && state.left_button_pressing) )
-    {
-      // paint with mouse move event
-      QMouseEvent* mouse_event = static_cast<QMouseEvent*>(event);
-      QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
-      qglviewer::Camera* camera = viewer->camera();
-
-      bool found = false;
-      const qglviewer::Vec& point = camera->pointUnderPixel(mouse_event->pos(), found);
-      if(found)
-      {
-        const qglviewer::Vec& orig = camera->position();
-        const qglviewer::Vec& dir = point - orig;
-        poly_item->select(orig.x, orig.y, orig.z, dir.x, dir.y, dir.z);
-      }
-    }//end MouseMove
-    return false;
-  }
-};
-
-#endif
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polyhedron_selection_item.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polyhedron_selection_item.cpp
deleted file mode 100644
index 89b9aed..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polyhedron_selection_item.cpp
+++ /dev/null
@@ -1,233 +0,0 @@
-#include "Scene_polyhedron_selection_item.h"
-#include <CGAL/Polygon_mesh_processing/compute_normal.h>
-
-
-void Scene_polyhedron_selection_item::initialize_buffers(CGAL::Three::Viewer_interface *viewer)const
-{
-    //vao containing the data for the unselected facets
-    {
-        program = getShaderProgram(PROGRAM_WITH_LIGHT, viewer);
-        program->bind();
-
-        vaos[0]->bind();
-        buffers[0].bind();
-        buffers[0].allocate(positions_facets.data(),
-                            static_cast<int>(positions_facets.size()*sizeof(float)));
-        program->enableAttributeArray("vertex");
-        program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
-        buffers[0].release();
-
-
-
-        buffers[1].bind();
-        buffers[1].allocate(normals.data(),
-                            static_cast<int>(normals.size()*sizeof(float)));
-        program->enableAttributeArray("normals");
-        program->setAttributeBuffer("normals",GL_FLOAT,0,3);
-        buffers[1].release();
-
-        vaos[0]->release();
-        program->release();
-
-    }
-    //vao containing the data for the unselected lines
-    {
-        program = getShaderProgram(PROGRAM_NO_SELECTION, viewer);
-        program->bind();
-        vaos[1]->bind();
-
-        buffers[2].bind();
-        buffers[2].allocate(positions_lines.data(),
-                            static_cast<int>(positions_lines.size()*sizeof(float)));
-        program->enableAttributeArray("vertex");
-        program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
-        buffers[2].release();
-
-        program->release();
-
-        vaos[1]->release();
-
-    }
-    //vao containing the data for the points
-    {
-        program = getShaderProgram(PROGRAM_NO_SELECTION, viewer);
-        program->bind();
-        vaos[2]->bind();
-
-        buffers[3].bind();
-        buffers[3].allocate(positions_points.data(),
-                            static_cast<int>(positions_points.size()*sizeof(float)));
-        program->enableAttributeArray("vertex");
-        program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
-        buffers[3].release();
-
-        buffers[6].release();
-        program->release();
-
-        vaos[2]->release();
-    }
-    nb_facets = positions_facets.size();
-    positions_facets.resize(0);
-    std::vector<float>(positions_facets).swap(positions_facets);
-
-    normals.resize(0);
-    std::vector<float>(normals).swap(normals);
-
-    nb_lines = positions_lines.size();
-    positions_lines.resize(0);
-    std::vector<float>(positions_lines).swap(positions_lines);
-
-    nb_points = positions_points.size();
-    positions_points.resize(0);
-    std::vector<float>(positions_points).swap(positions_points);
-
-    are_buffers_filled = true;
-}
-
-void Scene_polyhedron_selection_item::compute_elements()const
-{
-    positions_facets.clear();
-    positions_lines.clear();
-    positions_points.clear();
-    normals.clear();
-    //The facets
-    {
-
-
-        for(Selection_set_facet::iterator
-            it = selected_facets.begin(),
-            end = selected_facets.end();
-            it != end; ++it)
-        {
-            const Kernel::Vector_3 n =
-                    CGAL::Polygon_mesh_processing::compute_face_normal(*it, *this->poly_item->polyhedron());
-
-            normals.push_back(n.x());
-            normals.push_back(n.y());
-            normals.push_back(n.z());
-
-            normals.push_back(n.x());
-            normals.push_back(n.y());
-            normals.push_back(n.z());
-
-            normals.push_back(n.x());
-            normals.push_back(n.y());
-            normals.push_back(n.z());
-
-
-            Polyhedron::Halfedge_around_facet_circulator
-                    he = (*it)->facet_begin(),
-                    cend = he;
-
-            CGAL_For_all(he,cend)
-            {
-                const Kernel::Point_3& p = he->vertex()->point();
-                positions_facets.push_back(p.x());
-                positions_facets.push_back(p.y());
-                positions_facets.push_back(p.z());
-            }
-        }
-    }
-
-    //The Lines
-    {
-
-        for(Selection_set_edge::iterator it = selected_edges.begin(); it != selected_edges.end(); ++it) {
-            const Kernel::Point_3& a = (it->halfedge())->vertex()->point();
-            const Kernel::Point_3& b = (it->halfedge())->opposite()->vertex()->point();
-            positions_lines.push_back(a.x());
-            positions_lines.push_back(a.y());
-            positions_lines.push_back(a.z());
-
-            positions_lines.push_back(b.x());
-            positions_lines.push_back(b.y());
-            positions_lines.push_back(b.z());
-        }
-
-    }
-
-    //The points
-    {
-        for(Selection_set_vertex::iterator
-            it = selected_vertices.begin(),
-            end = selected_vertices.end();
-            it != end; ++it)
-        {
-            const Kernel::Point_3& p = (*it)->point();
-            positions_points.push_back(p.x());
-            positions_points.push_back(p.y());
-            positions_points.push_back(p.z());
-        }
-    }
-}
-
-void Scene_polyhedron_selection_item::draw(CGAL::Three::Viewer_interface* viewer) const
-{
-
-    if(!are_buffers_filled)
-    {
-        compute_elements();
-        initialize_buffers(viewer);
-    }
-
-    draw_points(viewer);
-    GLfloat offset_factor;
-    GLfloat offset_units;
-    viewer->glGetFloatv( GL_POLYGON_OFFSET_FACTOR, &offset_factor);
-    viewer->glGetFloatv(GL_POLYGON_OFFSET_UNITS, &offset_units);
-    glPolygonOffset(-1.f, 1.f);
-
-    vaos[0]->bind();
-    program = getShaderProgram(PROGRAM_WITH_LIGHT);
-    attrib_buffers(viewer,PROGRAM_WITH_LIGHT);
-    program->bind();
-    program->setAttributeValue("colors",this->color());
-    viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(nb_facets/3));
-    program->release();
-    vaos[0]->release();
-    glPolygonOffset(offset_factor, offset_units);
-    draw_edges(viewer);
-
-
-}
-
-void Scene_polyhedron_selection_item::draw_edges(CGAL::Three::Viewer_interface* viewer) const
-{
-    if(!are_buffers_filled)
-    {
-        compute_elements();
-        initialize_buffers(viewer);
-    }
-
-    viewer->glLineWidth(3.f);
-    vaos[1]->bind();
-    program = getShaderProgram(PROGRAM_NO_SELECTION);
-    attrib_buffers(viewer,PROGRAM_NO_SELECTION);
-    program->bind();
-
-    program->setAttributeValue("colors",edge_color);
-    viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(nb_lines/3));
-    program->release();
-    vaos[1]->release();
-    viewer->glLineWidth(1.f);
-}
-
-void Scene_polyhedron_selection_item::draw_points(CGAL::Three::Viewer_interface* viewer) const
-{
-    if(!are_buffers_filled)
-    {
-        compute_elements();
-        initialize_buffers(viewer);
-    }
-    viewer->glPointSize(5.f);
-    vaos[2]->bind();
-    program = getShaderProgram(PROGRAM_NO_SELECTION);
-    attrib_buffers(viewer,PROGRAM_NO_SELECTION);
-    program->bind();
-    program->setAttributeValue("colors",vertex_color);
-    viewer->glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(nb_points/3));
-    program->release();
-    vaos[2]->release();
-    viewer->glPointSize(1.f);
-
-}
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polyhedron_selection_item.h b/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polyhedron_selection_item.h
deleted file mode 100644
index 5f82079..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polyhedron_selection_item.h
+++ /dev/null
@@ -1,926 +0,0 @@
-#ifndef SCENE_POLYHEDRON_SELECTION_ITEM_H
-#define SCENE_POLYHEDRON_SELECTION_ITEM_H
-#include "opengl_tools.h"
-#include "Scene_polyhedron_selection_item_config.h"
-#include "Scene_polyhedron_item_k_ring_selection.h"
-#include "Travel_isolated_components.h"
-
-#include "Scene_polyhedron_item_decorator.h"
-#include "Polyhedron_type.h"
-
-#include <CGAL/property_map.h>
-#include <CGAL/Polygon_mesh_processing/orient_polygon_soup.h>
-#include <CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h>
-#include <CGAL/Polygon_mesh_processing/connected_components.h>
-#include "Polyhedron_demo_detect_sharp_edges.h"
-
-#include <fstream>
-#include <boost/foreach.hpp>
-#include <boost/unordered_set.hpp>
-#include <boost/property_map/vector_property_map.hpp>
-
-#include <CGAL/boost/graph/selection.h>
-#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
-
-namespace PMP = CGAL::Polygon_mesh_processing;
-
-
-template<class HandleType, class SelectionItem>
-struct Selection_traits {};
-
-template<class SelectionItem>
-struct Selection_traits<typename SelectionItem::Vertex_handle, SelectionItem> 
-{
-  typedef typename SelectionItem::Selection_set_vertex Container;
-  typedef boost::graph_traits<Polyhedron>::vertex_iterator Iterator;
-  Selection_traits(SelectionItem* item) : item(item) { }
-
-  Container& container() { return item->selected_vertices; }
-  Iterator iterator_begin() { return vertices(*item->polyhedron()).first; }
-  Iterator iterator_end() { return vertices(*item->polyhedron()).second; }
-  std::size_t size() { return item->polyhedron()->size_of_vertices(); }
-  void update_indices() { item->polyhedron_item()->update_vertex_indices(); }
-  std::size_t id(typename SelectionItem::Vertex_handle  vh) {return vh->id();}
-
-  template <class VertexRange, class HalfedgeGraph, class IsVertexSelectedPMap, class OutputIterator>
-  static
-  OutputIterator
-  reduce_selection(
-    const VertexRange& selection,
-    HalfedgeGraph& graph,
-    unsigned int k,
-    IsVertexSelectedPMap is_selected,
-    OutputIterator out)
-  {
-    return reduce_vertex_selection(selection, graph, k, is_selected, out);
-  }
-  template <class VertexRange, class HalfedgeGraph, class IsVertexSelectedPMap, class OutputIterator>
-  static
-  OutputIterator
-  expand_selection(
-    const VertexRange& selection,
-    HalfedgeGraph& graph,
-    unsigned int k,
-    IsVertexSelectedPMap is_selected,
-    OutputIterator out)
-  {
-    return expand_vertex_selection(selection, graph, k, is_selected, out);
-  }
-
-  SelectionItem* item;
-};
-
-template<class SelectionItem>
-struct Selection_traits<typename SelectionItem::Facet_handle, SelectionItem>
-{
-  typedef typename SelectionItem::Selection_set_facet Container;
-  typedef boost::graph_traits<Polyhedron>::face_iterator Iterator;
-  Selection_traits(SelectionItem* item) : item(item) { }
-
-  Container& container() { return item->selected_facets; }
-  Iterator iterator_begin() { return faces(*item->polyhedron()).first; }
-  Iterator iterator_end() { return faces(*item->polyhedron()).second; }
-  std::size_t size() { return item->polyhedron()->size_of_facets(); }
-  void update_indices() { item->polyhedron_item()->update_facet_indices(); }
-  std::size_t id(typename SelectionItem::Facet_handle fh) {return fh->id();}
-
-  template <class FaceRange, class HalfedgeGraph, class IsFaceSelectedPMap, class OutputIterator>
-  static
-  OutputIterator
-  reduce_selection(
-    const FaceRange& selection,
-    HalfedgeGraph& graph,
-    unsigned int k,
-    IsFaceSelectedPMap is_selected,
-    OutputIterator out)
-  {
-    return reduce_face_selection(selection, graph, k, is_selected, out);
-  }
-  template <class FaceRange, class HalfedgeGraph, class IsFaceSelectedPMap, class OutputIterator>
-  static
-  OutputIterator
-  expand_selection(
-    const FaceRange& selection,
-    HalfedgeGraph& graph,
-    unsigned int k,
-    IsFaceSelectedPMap is_selected,
-    OutputIterator out)
-  {
-    return expand_face_selection(selection, graph, k, is_selected, out);
-  }
-
-  SelectionItem* item;
-};
-
-template<class SelectionItem>
-struct Selection_traits<typename SelectionItem::edge_descriptor, SelectionItem> 
-{
-  typedef typename SelectionItem::Selection_set_edge Container;
-  typedef boost::graph_traits<Polyhedron>::edge_iterator Iterator;
-  Selection_traits(SelectionItem* item) : item(item) { }
-
-  Container& container() { return item->selected_edges; }
-  Iterator iterator_begin() { return edges(*item->polyhedron()).first; }
-  Iterator iterator_end() { return edges(*item->polyhedron()).second; }
-  std::size_t size() { return item->polyhedron()->size_of_halfedges()/2; }
-  void update_indices() { item->polyhedron_item()->update_halfedge_indices(); }
-  std::size_t id(boost::graph_traits<Polyhedron>::edge_descriptor ed) {return ed.halfedge()->id()/2;}
-
-  template <class EdgeRange, class HalfedgeGraph, class IsEdgeSelectedPMap, class OutputIterator>
-  static
-  OutputIterator
-  reduce_selection(
-    const EdgeRange& selection,
-    HalfedgeGraph& graph,
-    unsigned int k,
-    IsEdgeSelectedPMap is_selected,
-    OutputIterator out)
-  {
-    return reduce_edge_selection(selection, graph, k, is_selected, out);
-  }
-  template <class EdgeRange, class HalfedgeGraph, class IsEdgeSelectedPMap, class OutputIterator>
-  static
-  OutputIterator
-  expand_selection(
-    const EdgeRange& selection,
-    HalfedgeGraph& graph,
-    unsigned int k,
-    IsEdgeSelectedPMap is_selected,
-    OutputIterator out)
-  {
-    return expand_edge_selection(selection, graph, k, is_selected, out);
-  }
-
-  SelectionItem* item;
-};
-
-//////////////////////////////////////////////////////////////////////////
-
-class SCENE_POLYHEDRON_SELECTION_ITEM_EXPORT Scene_polyhedron_selection_item 
-  : public Scene_polyhedron_item_decorator
-{
-  Q_OBJECT
-
-friend class Polyhedron_demo_selection_plugin;
-
-public:
-  typedef Polyhedron::Vertex_handle   Vertex_handle;
-  typedef Polyhedron::Facet_handle    Facet_handle;
-  typedef boost::graph_traits<Polyhedron>::edge_descriptor edge_descriptor;
-  typedef Polyhedron::Vertex_iterator Vertex_iterator;
-  typedef Polyhedron::Facet_iterator  Facet_iterator;
-  typedef Scene_polyhedron_item_k_ring_selection::Active_handle Active_handle;
-  // To be used inside loader
-  Scene_polyhedron_selection_item() 
-    : Scene_polyhedron_item_decorator(NULL, false)
-    {
-        for(int i=0; i<3; i++)
-        {
-            addVaos(i);
-            vaos[i]->create();
-        }
-
-        for(int i=0; i<7; i++)
-        {
-            buffers[i].create();
-        }
-        nb_facets = 0;
-        nb_points = 0;
-        nb_lines = 0;
-        this->setColor(facet_color);
-    }
-
-  Scene_polyhedron_selection_item(Scene_polyhedron_item* poly_item, QMainWindow* mw) 
-    : Scene_polyhedron_item_decorator(NULL, false)
-    {
-        nb_facets = 0;
-        nb_points = 0;
-        nb_lines = 0;
-
-        for(int i=0; i<3; i++)
-        {
-            addVaos(i);
-            vaos[i]->create();
-        }
-
-        for(int i=0; i<7; i++)
-        {
-            buffers[i].create();
-        }
-        init(poly_item, mw);
-        this->setColor(facet_color);
-        invalidateOpenGLBuffers();
-    }
-
-   ~Scene_polyhedron_selection_item()
-    {
-    }
-
-protected: 
-  void init(Scene_polyhedron_item* poly_item, QMainWindow* mw)
-  {
-    this->poly_item = poly_item;
-    connect(poly_item, SIGNAL(item_is_about_to_be_changed()), this, SLOT(poly_item_changed())); 
-    connect(&k_ring_selector, SIGNAL(selected(const std::set<Polyhedron::Vertex_handle>&)), this,
-      SLOT(selected(const std::set<Polyhedron::Vertex_handle>&)));
-    connect(&k_ring_selector, SIGNAL(selected(const std::set<Polyhedron::Facet_handle>&)), this,
-      SLOT(selected(const std::set<Polyhedron::Facet_handle>&)));
-    connect(&k_ring_selector, SIGNAL(selected(const std::set<edge_descriptor>&)), this,
-      SLOT(selected(const std::set<edge_descriptor>&)));
-    connect(&k_ring_selector, SIGNAL(endSelection()), this,SLOT(endSelection()));
-    connect(&k_ring_selector, SIGNAL(toogle_insert(bool)), this,SLOT(toggle_insert(bool)));
-    k_ring_selector.init(poly_item, mw, Active_handle::VERTEX, -1);
-
-    QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
-    viewer->installEventFilter(this);
-    mw->installEventFilter(this);
-
-    facet_color = QColor(87,87,87);
-    edge_color = QColor(173,35,35);
-    vertex_color = QColor(255,205,243);
-  }
-
-  Active_handle::Type get_active_handle_type() 
-  { return k_ring_selector.active_handle_type; }
-  void set_active_handle_type(Active_handle::Type aht) 
-  { k_ring_selector.active_handle_type = aht; }
-
-  int get_k_ring() { return k_ring_selector.k_ring; }
-  void set_k_ring(int k) { k_ring_selector.k_ring = k; }
-
-  bool get_is_insert() { return is_insert; }
-  void set_is_insert(bool i) { is_insert = i; }
-  
-public:
-  typedef boost::unordered_set<Vertex_handle, CGAL::Handle_hash_function>    Selection_set_vertex;
-  typedef boost::unordered_set<Facet_handle, CGAL::Handle_hash_function>      Selection_set_facet;
-  typedef boost::unordered_set<edge_descriptor, CGAL::Handle_hash_function>    Selection_set_edge;
-
-  Polyhedron* polyhedron()
-  {
-    return this->poly_item->polyhedron();
-  }
-
-    using Scene_polyhedron_item_decorator::draw;
-    virtual void draw(CGAL::Three::Viewer_interface*) const;
-    virtual void draw_edges() const { }
-    virtual void draw_edges(CGAL::Three::Viewer_interface*) const;
-    virtual void draw_points(CGAL::Three::Viewer_interface*) const;
-
-  bool supportsRenderingMode(RenderingMode m) const { return (m==Flat); }
-
-  bool isEmpty() const {
-    return selected_vertices.empty() && selected_edges.empty() && selected_facets.empty();
-  }
-  void selection_changed(bool b)
-  {
-      QGLViewer* v = *QGLViewer::QGLViewerPool().begin();
-      CGAL::Three::Viewer_interface* viewer = dynamic_cast<CGAL::Three::Viewer_interface*>(v);
-      if(!viewer)
-          return;
-      if(!b)
-        viewer->setBindingSelect();
-      else
-        viewer->setNoBinding();
-  }
-  void compute_bbox() const
-  {
-    // Workaround a bug in g++-4.8.3:
-    //   http://stackoverflow.com/a/21755207/1728537
-    // Using boost::make_optional to copy-initialize 'item_bbox' hides the
-    //   warning about '*item_bbox' not being initialized.
-    // -- Laurent Rineau, 2014/10/30
-    boost::optional<CGAL::Bbox_3> item_bbox
-      = boost::make_optional(false, CGAL::Bbox_3());
-
-    for(Selection_set_vertex::const_iterator v_it = selected_vertices.begin(); 
-        v_it != selected_vertices.end(); ++v_it) {
-
-      if(item_bbox) { *item_bbox = *item_bbox + (*v_it)->point().bbox(); }
-      else          {  item_bbox = (*v_it)->point().bbox(); }
-    }
-
-    for(Selection_set_edge::const_iterator e_it = selected_edges.begin(); 
-        e_it != selected_edges.end(); ++e_it) {
-        CGAL::Bbox_3 e_bbox = e_it->halfedge()->vertex()->point().bbox();
-        e_bbox = e_bbox + e_it->halfedge()->opposite()->vertex()->point().bbox();
-        if(item_bbox) { *item_bbox = *item_bbox + e_bbox; }
-        else          {  item_bbox = e_bbox; }
-    }
-
-    for(Selection_set_facet::const_iterator f_it = selected_facets.begin(); 
-        f_it != selected_facets.end(); ++f_it) {
-
-        Polyhedron::Halfedge_around_facet_circulator he = (*f_it)->facet_begin(), cend = he;
-        CGAL_For_all(he,cend) {
-          if(item_bbox) { *item_bbox = *item_bbox + he->vertex()->point().bbox(); }
-          else          {  item_bbox = he->vertex()->point().bbox(); }
-        }
-    }
-
-    if(!item_bbox) { _bbox = this->poly_item->bbox(); return;}
-    _bbox = Bbox(item_bbox->xmin(),item_bbox->ymin(),item_bbox->zmin(),
-                item_bbox->xmax(),item_bbox->ymax(),item_bbox->zmax());
-  }
-
-  bool save(const std::string& file_name) const {
-    // update id fields before using
-    if(selected_vertices.size() > 0) { poly_item->update_vertex_indices();   }
-    if(selected_facets.size() > 0)   { poly_item->update_facet_indices();    }
-    if(selected_edges.size() > 0)    { poly_item->update_halfedge_indices(); }
-
-    std::ofstream out(file_name.c_str());
-    if(!out) { return false; }
-
-    for(Selection_set_vertex::const_iterator it = selected_vertices.begin(); it != selected_vertices.end(); ++it) 
-    { out << (*it)->id() << " "; }
-    out << std::endl;
-
-    for(Selection_set_facet::const_iterator it = selected_facets.begin(); it != selected_facets.end(); ++it) 
-    { out << (*it)->id() << " "; }
-    out << std::endl;
-
-    for(Selection_set_edge::const_iterator it = selected_edges.begin(); it != selected_edges.end(); ++it) 
-    { out << it->id() << " "; }
-    out << std::endl;
-    return true;
-  }
-  bool load(const std::string& file_name) {
-    file_name_holder = file_name;
-    return true;
-  }
-  // this function is called by selection_plugin, since at the time of the call of load(...) 
-  // we do not have access to selected polyhedron item
-  bool actual_load(Scene_polyhedron_item* poly_item, QMainWindow* mw) 
-  {
-    init(poly_item, mw);
-
-    std::vector<Vertex_handle> all_vertices;
-    all_vertices.reserve(polyhedron()->size_of_vertices());
-    Polyhedron::Vertex_iterator vb(polyhedron()->vertices_begin()), ve(polyhedron()->vertices_end());
-    for(;vb != ve; ++vb) { all_vertices.push_back(vb); }
-    
-    std::vector<Facet_handle> all_facets;
-    all_facets.reserve(polyhedron()->size_of_facets());
-    Polyhedron::Facet_iterator fb(polyhedron()->facets_begin()), fe(polyhedron()->facets_end());
-    for(;fb != fe; ++fb) { all_facets.push_back(fb); }
-
-    std::vector<edge_descriptor> all_edges(edges(*polyhedron()).first, edges(*polyhedron()).second);
-
-    std::ifstream in(file_name_holder.c_str());
-    if(!in) { return false; }
-
-    std::string line;
-    std::size_t id;
-
-    if(!std::getline(in, line)) { return true; }
-    std::istringstream vertex_line(line);
-    while(vertex_line >> id) {
-      if(id >= all_vertices.size()) { return false; }
-      selected_vertices.insert(all_vertices[id]);
-    }
-
-    if(!std::getline(in, line)) { return true; }
-    std::istringstream facet_line(line);
-    while(facet_line >> id) {
-      if(id >= all_facets.size()) { return false; }
-      selected_facets.insert(all_facets[id]);
-    }
-
-    if(!std::getline(in, line)) { return true; }
-    std::istringstream edge_line(line);
-    while(edge_line >> id) {
-      if(id >= all_edges.size()) { return false; }
-      selected_edges.insert(all_edges[id]);
-    }
-    return true;
-  }
-
-  // select all of `active_handle_type`(vertex, facet or edge)
-  void select_all() {
-    switch(get_active_handle_type()) {
-    case Active_handle::VERTEX:
-      select_all<Vertex_handle>(); break;
-    case Active_handle::FACET:
-    case Active_handle::CONNECTED_COMPONENT:
-      select_all<Facet_handle>(); break;
-    case Active_handle::EDGE:
-      selected_edges.insert(edges(*polyhedron()).first, edges(*polyhedron()).second);
-      invalidateOpenGLBuffers();
-      QGLViewer* v = *QGLViewer::QGLViewerPool().begin();
-      v->update();
-
-    }
-  }
-  // select all of vertex, facet or edge (use Vertex_handle, Facet_handle, edge_descriptor as template argument)
-  template<class HandleType>
-  void select_all() {
-    typedef Selection_traits<HandleType, Scene_polyhedron_selection_item> Tr;
-    Tr tr(this);
-    for(typename Tr::Iterator it = tr.iterator_begin() ; it != tr.iterator_end(); ++it) {
-      tr.container().insert(*it);
-    }
-    invalidateOpenGLBuffers();
-    Q_EMIT itemChanged();
-  }
-
-  // clear all of `active_handle_type`(vertex, facet or edge)
-  void clear() {
-    switch(get_active_handle_type()) {
-    case Active_handle::VERTEX:
-      clear<Vertex_handle>(); break;
-    case Active_handle::FACET:
-    case Active_handle::CONNECTED_COMPONENT:
-      clear<Facet_handle>(); break;
-    case Active_handle::EDGE:
-      clear<edge_descriptor>(); break;
-    }
-  }
-  // select all of vertex, facet or edge (use Vertex_handle, Facet_handle, edge_descriptor as template argument)
-  template<class HandleType>
-  void clear() {
-
-    Selection_traits<HandleType, Scene_polyhedron_selection_item> tr(this);
-    tr.container().clear();
-    invalidateOpenGLBuffers();
-    Q_EMIT itemChanged();
-  }
-
-  void clear_all(){
-    clear<Vertex_handle>();
-    clear<Facet_handle>();
-    clear<edge_descriptor>();
-  }
-
-  boost::optional<std::size_t> get_minimum_isolated_component() {
-    switch(get_active_handle_type()) {
-    case Active_handle::VERTEX:
-      return get_minimum_isolated_component<Vertex_handle>();
-    case Active_handle::FACET:
-      return get_minimum_isolated_component<Facet_handle>();
-    default:
-      return get_minimum_isolated_component<edge_descriptor>();
-    }
-  }
-  template<class HandleType> // use Vertex_handle, Facet_handle, edge_descriptor
-  boost::optional<std::size_t> get_minimum_isolated_component() {
-    Selection_traits<HandleType, Scene_polyhedron_selection_item> tr(this);
-    tr.update_indices();
-    Travel_isolated_components::Minimum_visitor visitor;
-    Travel_isolated_components().travel<HandleType>
-      (tr.iterator_begin(), tr.iterator_end(), tr.size(), tr.container(), visitor);
-    return visitor.minimum;
-  }
-
-  boost::optional<std::size_t> select_isolated_components(std::size_t threshold) {
-    switch(get_active_handle_type()) {
-    case Active_handle::VERTEX:
-      return select_isolated_components<Vertex_handle>(threshold);
-    case Active_handle::FACET:
-      return select_isolated_components<Facet_handle>(threshold);
-    default:
-      return select_isolated_components<edge_descriptor>(threshold);
-    }
-  }
-  template<class HandleType> // use Vertex_handle, Facet_handle, edge_descriptor
-  boost::optional<std::size_t> select_isolated_components(std::size_t threshold) {
-    typedef Selection_traits<HandleType, Scene_polyhedron_selection_item> Tr;
-    Tr tr(this);
-    tr.update_indices();
-    typedef std::insert_iterator<typename Tr::Container> Output_iterator;
-    Output_iterator out(tr.container(), tr.container().begin());
-
-    Travel_isolated_components::Selection_visitor<Output_iterator> visitor(threshold , out);
-    Travel_isolated_components().travel<HandleType>
-      (tr.iterator_begin(), tr.iterator_end(), tr.size(), tr.container(), visitor);
-
-    if(visitor.any_inserted) { invalidateOpenGLBuffers(); Q_EMIT itemChanged(); }
-    return visitor.minimum_visitor.minimum;
-  }
-
-  void expand_or_reduce(int steps) {
-    if (steps>0)
-    {
-      switch(get_active_handle_type()) {
-        case Active_handle::VERTEX:
-          expand_selection<Vertex_handle>(steps);
-        break;
-        case Active_handle::FACET:
-        case Active_handle::CONNECTED_COMPONENT:
-          expand_selection<Facet_handle>(steps);
-        break;
-        case Active_handle::EDGE:
-          expand_selection<edge_descriptor>(steps);
-      }
-    }
-    else
-    {
-      switch(get_active_handle_type()) {
-        case Active_handle::VERTEX:
-          reduce_selection<Vertex_handle>(-steps);
-        break;
-        case Active_handle::FACET:
-        case Active_handle::CONNECTED_COMPONENT:
-          reduce_selection<Facet_handle>(-steps);
-        break;
-        case Active_handle::EDGE:
-          reduce_selection<edge_descriptor>(-steps);
-      }
-    }
-  }
-
-  template <class Handle>
-  struct Is_selected_property_map{
-    std::vector<bool>* is_selected_ptr;
-    Is_selected_property_map()
-      : is_selected_ptr(NULL) {}
-    Is_selected_property_map(std::vector<bool>& is_selected)
-      : is_selected_ptr( &is_selected) {}
-
-    template<class H>
-    std::size_t id(H h){ return h->id(); }
-    std::size_t id(edge_descriptor ed) { return ed.halfedge()->id()/2; }
-
-    friend bool get(Is_selected_property_map map, Handle h)
-    {
-      CGAL_assertion(map.is_selected_ptr!=NULL);
-      return (*map.is_selected_ptr)[map.id(h)];
-    }
-
-    friend void put(Is_selected_property_map map, Handle h, bool b)
-    {
-      CGAL_assertion(map.is_selected_ptr!=NULL);
-      (*map.is_selected_ptr)[map.id(h)]=b;
-    }
-  };
-
-  template <typename SelectionSet>
-  struct Is_constrained_map
-  {
-    SelectionSet& m_set;
-
-    typedef typename SelectionSet::key_type    key_type;
-    typedef bool                               value_type;
-    typedef bool                               reference;
-    typedef boost::read_write_property_map_tag category;
-
-    Is_constrained_map(SelectionSet& set_)
-      : m_set(set_)
-    {}
-    friend bool get(const Is_constrained_map& map, const key_type& k)
-    {
-      return map.m_set.count(k);
-    }
-    friend void put(Is_constrained_map& map, const key_type& k, const value_type b)
-    {
-      if (b)  map.m_set.insert(k);
-      else    map.m_set.erase(k);
-    }
-  };
-
-  template <class Handle>
-  struct Index_map
-  {
-    typedef Handle  key_type;
-    typedef std::size_t     value_type;
-    typedef value_type&    reference;
-    typedef boost::read_write_property_map_tag category;
-
-    friend value_type get(Index_map, Handle h)
-    {
-      return h->id();
-    }
-    friend void put(Index_map, Handle h, value_type i)
-    {
-      h->id() = i;
-    }
-  };
-
-  template <class Handle>
-  void expand_selection(unsigned int steps)
-  {
-    typedef Selection_traits<Handle, Scene_polyhedron_selection_item> Tr;
-    Tr tr(this);
-
-    tr.update_indices();
-    std::vector<bool> mark(tr.size(),false);
-
-    BOOST_FOREACH(Handle h,tr.container())
-      mark[tr.id(h)]=true;
-
-    Tr::expand_selection(
-      tr.container(),
-      *this->poly_item->polyhedron(),
-      steps,
-      Is_selected_property_map<Handle>(mark),
-      CGAL::Emptyset_iterator()
-    );
-
-    bool any_change = false;
-    for(typename Tr::Iterator it = tr.iterator_begin() ; it != tr.iterator_end(); ++it) {
-      if(mark[tr.id(*it)]) {
-        any_change |= tr.container().insert(*it).second;
-      }
-    }
-    if(any_change) { invalidateOpenGLBuffers(); Q_EMIT itemChanged(); }
-  }
-
-  template <class Handle>
-  void reduce_selection(unsigned int steps) {
-
-    typedef Selection_traits<Handle, Scene_polyhedron_selection_item> Tr;
-    Tr tr(this);
-
-    tr.update_indices();
-    std::vector<bool> mark(tr.size(),false);
-
-    BOOST_FOREACH(Handle h,tr.container())
-      mark[tr.id(h)]=true;
-
-    Tr::reduce_selection(
-      tr.container(),
-      *this->poly_item->polyhedron(),
-      steps,
-      Is_selected_property_map<Handle>(mark),
-      CGAL::Emptyset_iterator()
-    );
-
-    bool any_change = false;
-    for(typename Tr::Iterator it = tr.iterator_begin() ; it != tr.iterator_end(); ++it) {
-      if(!mark[tr.id(*it)]) {
-        any_change |= (tr.container().erase(*it)!=0);
-      }
-    }
-    if(any_change) { invalidateOpenGLBuffers(); Q_EMIT itemChanged(); }
-  }
-
-  void erase_selected_facets() {
-    if(selected_facets.empty()) {return;}
-    // no-longer-valid vertices and edges will be handled when item_about_to_be_changed() 
-
-    // erase facets from poly
-    for(Selection_set_facet::iterator fb = selected_facets.begin(); fb != selected_facets.end(); ++fb) {
-      polyhedron()->erase_facet((*fb)->halfedge());
-    }
-    selected_facets.clear();
-    invalidateOpenGLBuffers();
-    changed_with_poly_item();
-  }
-
-  void keep_connected_components() {
-    if (selected_facets.empty()) { return; }
-
-    Selection_traits<Polyhedron::Face_handle, Scene_polyhedron_selection_item> trf(this);
-    trf.update_indices();
-    Selection_traits<Polyhedron::Vertex_handle, Scene_polyhedron_selection_item> trv(this);
-    trv.update_indices();
-
-    //Selection_traits<edge_descriptor, Scene_polyhedron_selection_item> tre(this);
-    //tre.update_indices();
-    //std::vector<bool> mark(polyhedron()->size_of_halfedges() / 2, false);
-    //BOOST_FOREACH(edge_descriptor e, selected_edges)
-    //  mark[tre.id(e)] = true;
-
-    PMP::keep_connected_components(*polyhedron()
-      , trf.container()
-      , PMP::parameters::face_index_map(Index_map<Polyhedron::Face_handle>())
-      .vertex_index_map(Index_map<Polyhedron::Vertex_handle>()));
-//      .edge_is_constrained_map(Is_selected_property_map<edge_descriptor>(mark)));
-
-    changed_with_poly_item();
-  }
-
-  bool export_selected_facets_as_polyhedron(Polyhedron* out) {
-    // Note: might be a more performance wise solution
-    // assign sequential id to vertices neighbor to selected facets
-    for(Selection_set_facet::iterator fb = selected_facets.begin(); fb != selected_facets.end(); ++fb) {
-      Polyhedron::Halfedge_around_facet_circulator hb((*fb)->facet_begin()), hend(hb);
-      do {
-        hb->vertex()->id() = 0;
-      } while(++hb != hend);
-    }
-    // construct point vector
-    std::vector<Polyhedron::Point_3> points;
-    points.reserve(selected_facets.size());
-    std::size_t counter = 1;
-    for(Selection_set_facet::iterator fb = selected_facets.begin(); fb != selected_facets.end(); ++fb) {
-      Polyhedron::Halfedge_around_facet_circulator hb((*fb)->facet_begin()), hend(hb);
-      do {
-        if(hb->vertex()->id() == 0) {
-          hb->vertex()->id() = counter++; 
-          points.push_back(hb->vertex()->point());
-        }
-      } while(++hb != hend);
-    }
-    // construct polygon vector
-    std::vector<std::vector<std::size_t> > polygons(selected_facets.size());
-    counter = 0;
-    for(Selection_set_facet::iterator fb = selected_facets.begin(); fb != selected_facets.end(); ++fb, ++counter) {
-      Polyhedron::Halfedge_around_facet_circulator hb((*fb)->facet_begin()), hend(hb);
-      do {
-        polygons[counter].push_back(hb->vertex()->id() -1);
-      } while(++hb != hend);
-    }
-    CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh<Polyhedron>(
-      points, polygons, *out);
-
-    return out->size_of_vertices() > 0;
-  }
-
-  void select_sharp_edges(const double angle)
-  {
-    CGAL::detect_sharp_edges(polyhedron(), angle);
-
-    BOOST_FOREACH(edge_descriptor e, edges(*polyhedron()))
-    {
-      Polyhedron::Halfedge_handle h = halfedge(e, *polyhedron());
-      if (h->is_feature_edge())
-        selected_edges.insert(e);
-    }
-    invalidateOpenGLBuffers();
-  }
-
-  void changed_with_poly_item() {
-    // no need to update indices
-    poly_item->invalidateOpenGLBuffers();
-    Q_EMIT poly_item->itemChanged();
-    Q_EMIT itemChanged();
-  }
-
-Q_SIGNALS:
-  void simplicesSelected(CGAL::Three::Scene_item*);
-
-public Q_SLOTS:
-  void invalidateOpenGLBuffers() {
-
-    // do not use decorator function, which calls changed on poly_item which cause deletion of AABB
-      //  poly_item->invalidateOpenGLBuffers();
-        are_buffers_filled = false;
-        compute_bbox();
-  }
-  // slots are called by signals of polyhedron_k_ring_selector
-  void selected(const std::set<Polyhedron::Vertex_handle>& m)
-  { has_been_selected(m); }
-  void selected(const std::set<Polyhedron::Facet_handle>& m)
-  { has_been_selected(m); }
-  void selected(const std::set<edge_descriptor>& m)
-  { has_been_selected(m); }
-  void poly_item_changed() {
-    remove_erased_handles<Vertex_handle>();
-    remove_erased_handles<edge_descriptor>();
-    remove_erased_handles<Facet_handle>();
-  }
-  void endSelection(){
-    Q_EMIT simplicesSelected(this);
-  }
-  void toggle_insert(bool b)
-  {
-   is_insert = b;
-  }
-
-protected:
-  bool eventFilter(QObject* /*target*/, QEvent * gen_event)
-  {
-    if(!visible() || !k_ring_selector.state.shift_pressing) { return false; }
-    if(gen_event->type() == QEvent::Wheel)
-    {
-      QWheelEvent *event = static_cast<QWheelEvent*>(gen_event);
-      int steps = event->delta() / 120;
-      expand_or_reduce(steps);
-      return true;
-    }
-    return false;
-  }
-
-  template<class HandleType>
-  void remove_erased_handles() {
-    typedef Selection_traits<HandleType, Scene_polyhedron_selection_item> Tr;
-    Tr tr(this);
-    if(tr.container().empty()) { return;}
-
-    std::vector<HandleType> exists;
-    for(typename Tr::Iterator it = tr.iterator_begin() ; it != tr.iterator_end(); ++it) {
-      if(tr.container().count(*it)) {
-        exists.push_back(*it);
-      }
-    }
-    tr.container().clear();
-    for(typename std::vector<HandleType>::iterator it = exists.begin(); it != exists.end(); ++it) {
-      tr.container().insert(*it);
-    }
-  }
-
-  template<typename HandleRange>
-  bool treat_selection(const HandleRange& selection)
-  {
-    typedef typename HandleRange::value_type HandleType;
-    Selection_traits<HandleType, Scene_polyhedron_selection_item> tr(this);
-
-    bool any_change = false;
-    if(is_insert) {
-      BOOST_FOREACH(HandleType h, selection)
-        any_change |= tr.container().insert(h).second;
-    }
-    else{
-      BOOST_FOREACH(HandleType h, selection)
-        any_change |= (tr.container().erase(h)!=0);
-    }
-    if(any_change) { invalidateOpenGLBuffers(); Q_EMIT itemChanged(); }
-    return any_change;
-  }
-
-  Facet_handle face(Facet_handle fh)
-  { return fh; }
-  Facet_handle face(Vertex_handle)
-  { return boost::graph_traits<Polyhedron>::null_face(); }
-  Facet_handle face(edge_descriptor)
-  { return boost::graph_traits<Polyhedron>::null_face(); }
-
-  template<class HandleType>
-  void has_been_selected(const std::set<HandleType>& selection)
-  {
-    if(!visible()) { return; }
-
-
-    if (get_active_handle_type() == Active_handle::CONNECTED_COMPONENT)
-    {
-      Selection_traits<edge_descriptor,
-                       Scene_polyhedron_selection_item> tr(this);
-      tr.update_indices();
-      std::vector<bool> mark(tr.size(), false);
-      BOOST_FOREACH(edge_descriptor e, selected_edges)
-        mark[tr.id(e)] = true;
-      std::vector<Facet_handle> selected_cc;
-      CGAL::Polygon_mesh_processing::connected_component(
-        face(*selection.begin()),
-        *polyhedron(),
-        std::back_inserter(selected_cc),
-        CGAL::Polygon_mesh_processing::parameters::edge_is_constrained_map(
-          Is_selected_property_map<edge_descriptor>(mark)));
-       treat_selection(selected_cc);
-    }
-    else
-    {
-      treat_selection(selection);
-    }
-  }
-
-public:
-  Is_selected_property_map<edge_descriptor>
-    selected_edges_pmap(std::vector<bool>& mark)
-  {
-    Selection_traits<edge_descriptor,
-      Scene_polyhedron_selection_item> tr(this);
-    tr.update_indices();
-
-    for (unsigned int i = 0; i < mark.size(); ++i)
-      mark[i] = false;
-
-    BOOST_FOREACH(edge_descriptor e, selected_edges)
-      mark[tr.id(e)] = true;
-
-    return Is_selected_property_map<edge_descriptor>(mark);
-  }
-
-  Is_constrained_map<Selection_set_edge> constrained_edges_pmap()
-  {
-    return Is_constrained_map<Selection_set_edge>(selected_edges);
-  }
-
-  Is_constrained_map<Selection_set_vertex> constrained_vertices_pmap()
-  {
-    return Is_constrained_map<Selection_set_vertex>(selected_vertices);
-  }
-
-protected:
-  // members
-  std::string file_name_holder;
-  Scene_polyhedron_item_k_ring_selection k_ring_selector;
-  // action state
-  bool is_insert;
-
-public:
-// selection
-  Selection_set_vertex selected_vertices;
-  Selection_set_facet  selected_facets;
-  Selection_set_edge   selected_edges; // stores one halfedge for each pair (halfedge with minimum address)
-// 
-  QColor vertex_color, facet_color, edge_color;
-
-private:
-
-  mutable std::vector<float> positions_facets;
-  mutable std::vector<float> normals;
-  mutable std::vector<float> positions_lines;
-  mutable std::vector<float> positions_points;
-  mutable std::size_t nb_facets;
-  mutable std::size_t nb_points;
-  mutable std::size_t nb_lines;
-  mutable QOpenGLShaderProgram *program;
-  using CGAL::Three::Scene_item::initialize_buffers;
-  void initialize_buffers(CGAL::Three::Viewer_interface *viewer) const;
-  void compute_elements() const;
-
-};
-
-#endif 
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polylines_item.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polylines_item.cpp
deleted file mode 100644
index b7b3f67..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polylines_item.cpp
+++ /dev/null
@@ -1,682 +0,0 @@
-#include "Scene_polylines_item.h"
-#include "create_sphere.h"
-
-#include <CGAL/bounding_box.h>
-#include <CGAL/gl.h>
-#include <QMenu>
-#include <QAction>
-
-#include <QInputDialog>
-
-class Scene_polylines_item_private {
-public:
-    typedef Scene_polylines_item::K K;
-    typedef K::Point_3 Point_3;
-
-    Scene_polylines_item_private() :
-        draw_extremities(false),
-        spheres_drawn_radius(0)
-    {}
-
-    void draw_sphere(const K::Point_3&, double) const;
-    void draw_spheres(const Scene_polylines_item*) const;
-
-    bool draw_extremities;
-    double spheres_drawn_radius;
-};
-
-void
-Scene_polylines_item::create_Sphere(float R) const
-{
-  create_flat_and_wire_sphere(R, positions_spheres, normals_spheres, positions_wire_spheres);
-}
-
-void
-Scene_polylines_item::initialize_buffers(CGAL::Three::Viewer_interface *viewer = 0) const
-{
-    QOpenGLShaderProgram *program;
-   //vao for the lines
-    {
-        program = getShaderProgram(PROGRAM_NO_SELECTION, viewer);
-        program->bind();
-
-        vaos[Edges]->bind();
-        buffers[Edges_Vertices].bind();
-        buffers[Edges_Vertices].allocate(positions_lines.data(),
-                            static_cast<int>(positions_lines.size()*sizeof(float)));
-        program->enableAttributeArray("vertex");
-        program->setAttributeBuffer("vertex",GL_FLOAT,0,4);
-        buffers[Edges_Vertices].release();
-        vaos[Edges]->release();
-        program->release();
-    }
-   //vao for the spheres
-    {
-        if(viewer->extension_is_found)
-        {
-            program = getShaderProgram(PROGRAM_INSTANCED, viewer);
-            program->bind();
-
-            vaos[Spheres]->bind();
-            buffers[Spheres_Vertices].bind();
-            buffers[Spheres_Vertices].allocate(positions_spheres.data(),
-                                static_cast<int>(positions_spheres.size()*sizeof(float)));
-            program->enableAttributeArray("vertex");
-            program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
-            buffers[Spheres_Vertices].release();
-
-            buffers[Spheres_Normals].bind();
-            buffers[Spheres_Normals].allocate(normals_spheres.data(),
-                                static_cast<int>(normals_spheres.size()*sizeof(float)));
-            program->enableAttributeArray("normals");
-            program->setAttributeBuffer("normals",GL_FLOAT,0,3);
-            buffers[Spheres_Normals].release();
-
-            buffers[Spheres_Colors].bind();
-            buffers[Spheres_Colors].allocate(color_spheres.data(),
-                                static_cast<int>(color_spheres.size()*sizeof(float)));
-            program->enableAttributeArray("colors");
-            program->setAttributeBuffer("colors",GL_FLOAT,0,3);
-            buffers[Spheres_Colors].release();
-
-            buffers[Spheres_Center].bind();
-            buffers[Spheres_Center].allocate(positions_center.data(),
-                                static_cast<int>(positions_center.size()*sizeof(float)));
-            program->enableAttributeArray("center");
-            program->setAttributeBuffer("center",GL_FLOAT,0,3);
-            buffers[Spheres_Center].release();
-
-            viewer->glVertexAttribDivisor(program->attributeLocation("center"), 1);
-            viewer->glVertexAttribDivisor(program->attributeLocation("colors"), 1);
-
-        }
-        else
-        {
-            program = getShaderProgram(PROGRAM_NO_SELECTION, viewer);
-            program->bind();
-
-            vaos[Spheres]->bind();
-            buffers[Spheres_Vertices].bind();
-            buffers[Spheres_Vertices].allocate(positions_center.data(),
-                                static_cast<int>(positions_center.size()*sizeof(float)));
-            program->enableAttributeArray("vertex");
-            program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
-            buffers[Spheres_Vertices].release();
-
-            buffers[Spheres_Normals].bind();
-            buffers[Spheres_Normals].allocate(color_spheres.data(),
-                                static_cast<int>(color_spheres.size()*sizeof(float)));
-            program->enableAttributeArray("colors");
-            program->setAttributeBuffer("colors",GL_FLOAT,0,3);
-            buffers[Spheres_Normals].release();
-        }
-        vaos[Spheres]->release();
-
-        program->release();
-    }
-
-//vao for the wired spheres
-    {
-        if(viewer->extension_is_found)
-        {
-            program = getShaderProgram(PROGRAM_INSTANCED_WIRE, viewer);
-            program->bind();
-
-            vaos[Wired_Spheres]->bind();
-            buffers[Wired_Spheres_Vertices].bind();
-            buffers[Wired_Spheres_Vertices].allocate(positions_wire_spheres.data(),
-                                static_cast<int>(positions_wire_spheres.size()*sizeof(float)));
-            program->enableAttributeArray("vertex");
-            program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
-            buffers[Wired_Spheres_Vertices].release();
-
-            buffers[Spheres_Colors].bind();
-            program->enableAttributeArray("colors");
-            program->setAttributeBuffer("colors",GL_FLOAT,0,3);
-            buffers[Spheres_Colors].release();
-
-            buffers[Spheres_Normals].bind();
-            program->enableAttributeArray("normals");
-            program->setAttributeBuffer("normals",GL_FLOAT,0,3);
-            buffers[Spheres_Normals].release();
-
-
-            buffers[Spheres_Center].bind();
-            program->enableAttributeArray("center");
-            program->setAttributeBuffer("center",GL_FLOAT,0,3);
-            buffers[Spheres_Center].release();
-
-
-            viewer->glVertexAttribDivisor(program->attributeLocation("center"), 1);
-            viewer->glVertexAttribDivisor(program->attributeLocation("colors"), 1);
-
-            vaos[Wired_Spheres]->release();
-            program->release();
-
-            nb_lines = positions_lines.size();
-            positions_lines.resize(0);
-            std::vector<float>(positions_lines).swap(positions_lines);
-            nb_spheres = positions_spheres.size();
-            positions_spheres.resize(0);
-            std::vector<float>(positions_spheres).swap(positions_spheres);
-            normals_spheres.resize(0);
-            std::vector<float>(normals_spheres).swap(normals_spheres);
-            color_spheres.resize(0);
-            std::vector<float>(color_spheres).swap(color_spheres);
-            nb_centers = positions_center.size();
-            positions_center.resize(0);
-            std::vector<float>(positions_center).swap(positions_center);
-            nb_wire = positions_wire_spheres.size();
-            positions_wire_spheres.resize(0);
-            std::vector<float>(positions_wire_spheres).swap(positions_wire_spheres);
-        }
-    }
-
-   are_buffers_filled = true;
-
-}
-void
-Scene_polylines_item::compute_elements() const
-{
-    positions_spheres.resize(0);
-    positions_wire_spheres.resize(0);
-    positions_lines.resize(0);
-    color_spheres.resize(0);
-    normals_spheres.resize(0);
-    positions_center.resize(0);
-    nbSpheres = 0;
-
-    //Fills the VBO with the lines
-    for(std::list<std::vector<Point_3> >::const_iterator it = polylines.begin();
-        it != polylines.end();
-        ++it){
-        if(it->empty()) continue;
-        for(size_t i = 0, end = it->size()-1;
-            i < end; ++i)
-        {
-            const Point_3& a = (*it)[i];
-            const Point_3& b = (*it)[i+1];
-            positions_lines.push_back(a.x());
-            positions_lines.push_back(a.y());
-            positions_lines.push_back(a.z());
-            positions_lines.push_back(1.0);
-
-            positions_lines.push_back(b.x());
-            positions_lines.push_back(b.y());
-            positions_lines.push_back(b.z());
-            positions_lines.push_back(1.0);
-
-        }
-
-    }
-    //Fills the VBO with the spheres
-    if(d->draw_extremities)
-    {
-
-        // FIRST, count the number of incident cycles and polylines
-        // for all extremities.
-        typedef std::map<Point_3, int> Point_to_int_map;
-        typedef Point_to_int_map::iterator iterator;
-        Point_to_int_map corner_polyline_nb;
-
-        { // scope to fill corner_polyline_nb'
-            Point_to_int_map corner_cycles_nb;
-
-            for(std::list<std::vector<Point_3> >::const_iterator
-                it = this->polylines.begin(),
-                end = this->polylines.end();
-                it != end; ++it)
-            {
-                const K::Point_3& a = *it->begin();
-                const K::Point_3& b = *it->rbegin();
-                if(a == b) {
-                    if ( it->size()>1 )
-                        ++corner_cycles_nb[a];
-                    else
-                        ++corner_polyline_nb[a];
-                }
-                else {
-                    ++corner_polyline_nb[a];
-                    ++corner_polyline_nb[b];
-                }
-            }
-            // THEN, ignore points that are incident to one cycle only.
-            for(iterator
-                c_it = corner_cycles_nb.begin(),
-                end = corner_cycles_nb.end();
-                c_it != end; ++c_it)
-            {
-                const Point_3& a = c_it->first;
-
-                iterator p_it = corner_polyline_nb.find(a);
-
-                // If the point 'a'=c_it->first has only incident cycles...
-                if(p_it == corner_polyline_nb.end()) {
-                    // ...then count it as a corner only if it has two incident cycles
-                    // or more.
-                    if(c_it->second > 1) {
-                        corner_polyline_nb[a] = c_it->second;
-                    }
-                } else {
-                    // else add the number of cycles.
-                    p_it->second += c_it->second;
-                }
-            }
-        }
-        // At this point, 'corner_polyline_nb' gives the multiplicity of all
-        // corners.
-        //Finds the centers of the spheres and their color
-        for(iterator
-            p_it = corner_polyline_nb.begin(),
-            end = corner_polyline_nb.end();
-            p_it != end; ++p_it)
-        {
-            nbSpheres++;
-            const K::Point_3& centre = p_it->first;
-            positions_center.push_back(centre.x());
-            positions_center.push_back(centre.y());
-            positions_center.push_back(centre.z());
-
-            float colors[3];
-            switch(p_it->second) {
-            case 1:
-                colors[0] = 0.0; // black
-                colors[1] = 0.0;
-                colors[2] = 0.0;
-                break;
-            case 2:
-                colors[0] = 0.0; // green
-                colors[1] = 0.8f;
-                colors[2] = 0.0;
-                break;
-            case 3:
-                colors[0] = 0.0; // blue
-                colors[1] = 0.0;
-                colors[2] = 0.8f;
-                break;
-            case 4:
-                colors[0] = 0.8f; //red
-                colors[1] = 0.0;
-                colors[2] = 0.0;
-                break;
-            default:
-                colors[0] = 0.8f; //fuschia
-                colors[1] = 0.0;
-                colors[2] = 0.8f;
-            }
-
-            color_spheres.push_back(colors[0]);
-            color_spheres.push_back(colors[1]);
-            color_spheres.push_back(colors[2]);
-            color_wire_spheres.push_back(colors[0]);
-            color_wire_spheres.push_back(colors[1]);
-            color_wire_spheres.push_back(colors[2]);
-            color_wire_spheres.push_back(colors[0]);
-            color_wire_spheres.push_back(colors[1]);
-            color_wire_spheres.push_back(colors[2]);
-        }
-        create_Sphere(d->spheres_drawn_radius);
-
-    }
-}
-
-
-Scene_polylines_item::Scene_polylines_item() 
-    :CGAL::Three::Scene_item(NbOfVbos,NbOfVaos)
-    ,d(new Scene_polylines_item_private())
-    ,nbSpheres(0)
-{
-    setRenderingMode(FlatPlusEdges);
-    nb_spheres = 0;
-    nb_wire = 0;
-    nb_centers = 0;
-    nb_lines = 0;
-    invalidateOpenGLBuffers();
-
-}
-
-Scene_polylines_item::~Scene_polylines_item()
-{
-    delete d;
-
-}
-
-bool
-Scene_polylines_item::isEmpty() const {
-    return polylines.empty();
-}
-
-void
-Scene_polylines_item::compute_bbox() const {
-    typedef K::Iso_cuboid_3 Iso_cuboid_3;
-
-    if(isEmpty())
-    {
-        _bbox =Bbox();
-        return;
-    }
-    std::list<Point_3> boxes;
-    for(std::list<std::vector<Point_3> >::const_iterator it = polylines.begin();
-        it != polylines.end();
-        ++it){
-        if(it->begin() != it->end()) {
-            Iso_cuboid_3 cub = CGAL::bounding_box(it->begin(), it->end());
-            boxes.push_back((cub.min)());
-            boxes.push_back((cub.max)());
-        }
-    }
-    Iso_cuboid_3 bbox =
-            boxes.begin() != boxes.end() ?
-                CGAL::bounding_box(boxes.begin(), boxes.end()) :
-                Iso_cuboid_3();
-
-    _bbox = Bbox(bbox.xmin(),
-                bbox.ymin(),
-                bbox.zmin(),
-                bbox.xmax(),
-                bbox.ymax(),
-                bbox.zmax());
-}
-
-Scene_polylines_item* 
-Scene_polylines_item::clone() const {
-    Scene_polylines_item* item = new Scene_polylines_item;
-    item->polylines = polylines;
-    QVariant metadata_variant = property("polylines metadata");
-    if(metadata_variant.type() == QVariant::StringList)
-    {
-        item->setProperty("polylines metadata", metadata_variant);
-    }
-    return item;
-}
-
-QString
-Scene_polylines_item::toolTip() const {
-    QString s =
-            tr("<p><b>%1</b> (mode: %2, color: %3)<br />"
-               "<i>Polylines</i></p>"
-               "<p>Number of polylines: %4</p>")
-            .arg(this->name())
-            .arg(this->renderingModeName())
-            .arg(this->color().name())
-            .arg(polylines.size());
-    if(d->draw_extremities) {
-        s += tr("<p>Legende of endpoints colors: <ul>"
-                "<li>black: one incident polyline</li>"
-                "<li>green: two incident polylines</li>"
-                "<li>blue: three incident polylines</li>"
-                "<li>red: four incident polylines</li>"
-                "<li>fuchsia: five or more incident polylines</li>"
-                "</ul></p>");
-    }
-    return s;
-}
-
-bool
-Scene_polylines_item::supportsRenderingMode(RenderingMode m) const {
-    return (m == Wireframe ||
-            m == FlatPlusEdges ||
-            m == Points);
-}
-
-// Shaded OpenGL drawing: only draw spheres
-void
-Scene_polylines_item::draw(CGAL::Three::Viewer_interface* viewer) const {
-
-    if(!are_buffers_filled)
-    {
-        compute_elements();
-        initialize_buffers(viewer);
-    }
-    if(d->draw_extremities)
-    {
-        if(viewer->extension_is_found)
-        {
-            vaos[Spheres]->bind();
-            QOpenGLShaderProgram* program = getShaderProgram(PROGRAM_INSTANCED);
-            attrib_buffers(viewer, PROGRAM_INSTANCED);
-            program->bind();
-            viewer->glDrawArraysInstanced(GL_TRIANGLES, 0,
-                                          static_cast<GLsizei>(nb_spheres/3), nbSpheres);
-            program->release();
-            vaos[Spheres]->release();
-        }
-        else
-        {
-            vaos[Spheres]->bind();
-            QOpenGLShaderProgram* program = getShaderProgram(PROGRAM_NO_SELECTION);
-            attrib_buffers(viewer, PROGRAM_NO_SELECTION);
-            glPointSize(8.0f);
-            glEnable(GL_POINT_SMOOTH);
-            program->bind();
-            viewer->glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(nb_centers/3));
-            glDisable(GL_POINT_SMOOTH);
-            program->release();
-            vaos[Spheres]->release();
-        }
-    }
-}
-
-// Wireframe OpenGL drawing
-void 
-Scene_polylines_item::draw_edges(CGAL::Three::Viewer_interface* viewer) const {
-    if(!are_buffers_filled)
-    {
-        compute_elements();
-        initialize_buffers(viewer);
-    }
-
-    vaos[Edges]->bind();
-    attrib_buffers(viewer, PROGRAM_NO_SELECTION);
-    QOpenGLShaderProgram *program = getShaderProgram(PROGRAM_NO_SELECTION);
-    program->bind();
-    program->setAttributeValue("colors", this->color());
-    viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(nb_lines/4));
-    program->release();
-    vaos[Edges]->release();
-    if(d->draw_extremities)
-    {
-        if(viewer->extension_is_found)
-        {
-            vaos[Wired_Spheres]->bind();
-            attrib_buffers(viewer, PROGRAM_INSTANCED_WIRE);
-            program = getShaderProgram(PROGRAM_INSTANCED_WIRE);
-            program->bind();
-            viewer->glDrawArraysInstanced(GL_LINES, 0,
-                                          static_cast<GLsizei>(nb_wire/3), nbSpheres);
-            program->release();
-            vaos[Wired_Spheres]->release();
-        }
-    }
-
-}
-
-void 
-Scene_polylines_item::draw_points(CGAL::Three::Viewer_interface* viewer) const {
-    if(!are_buffers_filled)
-    {
-        compute_elements();
-        initialize_buffers(viewer);
-    }
-
-    vaos[Edges]->bind();
-    attrib_buffers(viewer, PROGRAM_NO_SELECTION);
-    QOpenGLShaderProgram *program = getShaderProgram(PROGRAM_NO_SELECTION);
-    program->bind();
-    QColor temp = this->color();
-    program->setAttributeValue("colors", temp);
-    viewer->glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(nb_lines/4));
-    // Clean-up
-   vaos[Edges]->release();
-   program->release();
-}
-
-QMenu* Scene_polylines_item::contextMenu() 
-{
-    const char* prop_name = "Menu modified by Scene_polylines_item.";
-
-    QMenu* menu = Scene_item::contextMenu();
-
-    // Use dynamic properties:
-    // http://doc.qt.io/qt-5/qobject.html#property
-    bool menuChanged = menu->property(prop_name).toBool();
-
-    if(!menuChanged) {
-        menu->addSeparator();
-        // TODO: add actions to display corners
-        QAction* action = menu->addAction(tr("Display corners with radius..."));
-        connect(action, SIGNAL(triggered()),
-                this, SLOT(change_corner_radii()));
-
-        QAction* actionSmoothPolylines =
-                menu->addAction(tr("Smooth polylines"));
-        actionSmoothPolylines->setObjectName("actionSmoothPolylines");
-        connect(actionSmoothPolylines, SIGNAL(triggered()),this, SLOT(smooth()));
-        menu->setProperty(prop_name, true);
-    }
-    return menu;
-}
-
-void Scene_polylines_item::invalidateOpenGLBuffers()
-{
-    are_buffers_filled = false;
-    compute_bbox();
-
-
-}
-
-void Scene_polylines_item::change_corner_radii() {
-    bool ok = true;
-    double proposed_radius = d->spheres_drawn_radius;
-    if(proposed_radius == 0) {
-        CGAL::Three::Scene_interface::Bbox b = bbox();
-        proposed_radius = (std::max)(b.xmax - b.xmin,
-                                     proposed_radius);
-        proposed_radius = (std::max)(b.ymax - b.ymin,
-                                     proposed_radius);
-        proposed_radius = (std::max)(b.zmax - b.zmin,
-                                     proposed_radius);
-        proposed_radius /= 100;
-    }
-    double r = QInputDialog::getDouble(NULL,
-                                       tr("Display corners with new radius..."),
-                                       tr("Radius:"),
-                                       proposed_radius, // value
-                                       0.,          // min
-                                       2147483647., // max
-                                       10,          // decimals
-                                       &ok);
-    if(ok) {
-        change_corner_radii(r);
-    }
-}
-
-void Scene_polylines_item::change_corner_radii(double r) {
-    if(r >= 0) {
-        d->spheres_drawn_radius = r;
-        d->draw_extremities = (r > 0);
-        this->invalidateOpenGLBuffers();
-    Q_EMIT itemChanged();
-    }
-}
-
-void Scene_polylines_item::split_at_sharp_angles()
-{
-    typedef Polylines_container Bare_polyline_container;
-    typedef Polyline Bare_polyline;
-    Polylines_container& bare_polylines = polylines;
-
-    int counter = 0;
-    for(Bare_polyline_container::iterator
-        bare_polyline_it = bare_polylines.begin();
-        bare_polyline_it != bare_polylines.end(); // the end changes
-        // during the loop
-        ++counter /* bare_polyline_it is incremented in the loop */)
-    {
-        Bare_polyline_container::iterator current_polyline_it =
-                bare_polyline_it;
-        Bare_polyline& bare_polyline = *bare_polyline_it;
-        Bare_polyline::iterator it = boost::next(bare_polyline.begin());
-
-        if(boost::next(bare_polyline.begin()) == bare_polyline.end())
-        {
-            std::cerr << "WARNING: Isolated point in polylines\n";
-            bare_polyline_it = bare_polylines.erase(bare_polyline_it);
-            continue;
-        }
-        else
-            ++bare_polyline_it;
-        if(it != bare_polyline.end()) {
-            for(; it != boost::prior(bare_polyline.end()); ++it) {
-                const Point_3 pv = *it;
-                const Point_3 pa = *boost::prior(it);
-                const Point_3 pb = *boost::next(it);
-                const K::Vector_3 av = pv - pa;
-                const K::Vector_3 bv = pv - pb;
-                const K::FT sc_prod = av * bv;
-                if( sc_prod >= 0 ||
-                        (sc_prod < 0 &&
-                         CGAL::square(sc_prod) < (av * av) * (bv * bv) / 4 ) )
-                {
-#ifdef PROTECTION_DEBUG
-                    std::cerr << "Split polyline (small angle) "
-                              <<  std::acos(sqrt(CGAL::square(sc_prod) /
-                                                 ((av*av) * (bv*bv)))) * 180 /CGAL_PI
-                               << " degres\n";
-#endif
-                    Bare_polyline new_polyline;
-                    std::copy(it, bare_polyline.end(),
-                              std::back_inserter(new_polyline));
-
-                    if(*bare_polyline.begin() == *bare_polyline.rbegin()) {
-                        // if the polyline is a cycle, test if its beginning is a sharp
-                        // angle...
-                        const Point_3 pv = *bare_polyline.begin();
-                        const Point_3 pa = *boost::prior(boost::prior(bare_polyline.end()));
-                        const Point_3 pb = *boost::next(bare_polyline.begin());
-                        const K::Vector_3 av = pv - pa;
-                        const K::Vector_3 bv = pv - pb;
-                        const K::FT sc_prod = av * bv;
-                        if( sc_prod >= 0 ||
-                                (sc_prod < 0 &&
-                                 CGAL::square(sc_prod) < (av * av) * (bv * bv) / 4 ) )
-                        {
-                            // if its beginning is a sharp angle, then split
-                            bare_polyline.erase(boost::next(it), bare_polyline.end());
-                        }
-                        else {
-                            // ...if not, modifies its beginning
-                            std::copy(boost::next(bare_polyline.begin()),
-                                      boost::next(it),
-                                      std::back_inserter(new_polyline));
-                            bare_polylines.erase(current_polyline_it);
-                        }
-                    }
-                    else {
-                        bare_polyline.erase(boost::next(it), bare_polyline.end());
-                    }
-                    bare_polylines.push_back(new_polyline);
-                    break;
-                }
-            }
-        }
-    }
-  Q_EMIT itemChanged();
-}
-
-void
-Scene_polylines_item::merge(Scene_polylines_item* other_item) {
-    if(other_item == 0) return;
-    std::copy(other_item->polylines.begin(),
-              other_item->polylines.end(),
-              std::back_inserter(polylines));
-    QVariant other_metadata_variant = other_item->property("polylines metadata");
-    if(other_metadata_variant.type() == QVariant::StringList)
-    {
-        QStringList metadata = property("polylines metadata").toStringList();
-        metadata.append(other_metadata_variant.toStringList());
-        setProperty("polylines metadata", metadata);
-    }
-    invalidateOpenGLBuffers();
-}
-
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polylines_item.h b/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polylines_item.h
deleted file mode 100644
index 480744c..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polylines_item.h
+++ /dev/null
@@ -1,135 +0,0 @@
-#ifndef SCENE_POLYLINES_ITEM_H
-#define SCENE_POLYLINES_ITEM_H
-#include "Scene_polylines_item_config.h"
-#include <CGAL/Three/Viewer_interface.h>
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-#include <CGAL/Three/Scene_item.h>
-
-#include <QString>
-#include <QMenu>
-
-#include <list>
-#include <vector>
-
-class Scene_polylines_item_private;
-
-class SCENE_POLYLINES_ITEM_EXPORT Scene_polylines_item : public CGAL::Three::Scene_item
-{
-    Q_OBJECT
-public:
-    typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
-    typedef K::Point_3 Point_3;
-    typedef std::vector<Point_3> Polyline;
-    typedef std::list<Polyline> Polylines_container;
-
-    Scene_polylines_item();
-    virtual ~Scene_polylines_item();
-
-    bool isFinite() const { return true; }
-    bool isEmpty() const;
-    void compute_bbox() const;
-
-    Scene_polylines_item* clone() const;
-
-    QString toolTip() const;
-
-    // Indicate if rendering mode is supported
-    bool supportsRenderingMode(RenderingMode m) const;
-
-    QMenu* contextMenu();
-
-    // Flat/Gouraud OpenGL drawing
-    void draw() const {}
-    void draw(CGAL::Three::Viewer_interface*) const;
-
-    // Wireframe OpenGL drawing
-    void draw_edges() const{}
-    void draw_edges(CGAL::Three::Viewer_interface*) const;
-
-    void draw_points() const{}
-    void draw_points(CGAL::Three::Viewer_interface*) const;
-
-
-    void smooth(std::vector<Point_3>& polyline){
-        bool is_closed = polyline.front()==polyline.back();
-        typedef K::Vector_3 Vector_3;
-
-        std::size_t start = is_closed ? 0:1;
-        std::size_t end   = polyline.size()-1;
-
-        Vector_3 prev = (is_closed ? polyline[end-1] : polyline[0]) - CGAL::ORIGIN;
-
-        for (std::size_t i=start; i!=end; ++i)
-        {
-            Vector_3 curr = polyline[i] - CGAL::ORIGIN;
-            Vector_3 next = polyline[i+1] - CGAL::ORIGIN;
-
-            polyline[i] = CGAL::ORIGIN+(prev+2*curr+next)/4;
-            prev=curr;
-        }
-
-        if (is_closed) polyline[end]=polyline[0];
-    }
-
-public Q_SLOTS:
-    virtual void invalidateOpenGLBuffers();
-    void change_corner_radii(double);
-    void change_corner_radii();
-    void split_at_sharp_angles();
-
-    void merge(Scene_polylines_item*);
-
-    void smooth(){
-        for (Polylines_container::iterator pit=polylines.begin(),pit_end=polylines.end();pit!=pit_end;++pit)
-            smooth(*pit);
-      invalidateOpenGLBuffers();
-      Q_EMIT itemChanged();
-    }
-public:
-    Polylines_container polylines;
-
-    // http://en.wikipedia.org/wiki/D-pointer
-    Scene_polylines_item_private* d;
-private:
-
-    enum VAOs {
-        Edges=0,
-        Spheres,
-        Wired_Spheres,
-        NbOfVaos = Wired_Spheres+1
-    };
-    enum VBOs {
-        Edges_Vertices = 0,
-        Spheres_Vertices,
-        Spheres_Normals,
-        Spheres_Colors,
-        Spheres_Center,
-        Wired_Spheres_Vertices,
-        NbOfVbos = Wired_Spheres_Vertices+1
-    };
-
-    mutable std::vector<float> positions_lines;
-    mutable std::vector<float> positions_spheres;
-    mutable std::vector<float> positions_wire_spheres;
-    mutable std::vector<float> positions_center;
-    mutable std::vector<float> normals_spheres;
-    mutable std::vector<float> color_spheres;
-    mutable std::vector<float> color_wire_spheres;
-    mutable std::size_t nb_spheres;
-    mutable std::size_t nb_wire;
-    mutable std::size_t nb_centers;
-    mutable std::size_t nb_lines;
-    mutable   GLuint nbSpheres;
-    typedef std::map<Point_3, int> Point_to_int_map;
-    typedef Point_to_int_map::iterator iterator;
-    void create_Sphere(float) const;
-    using CGAL::Three::Scene_item::initialize_buffers;
-    void initialize_buffers(CGAL::Three::Viewer_interface *viewer) const;
-    using CGAL::Three::Scene_item::compute_elements;
-    void compute_elements() const;
-
-
-
-}; // end class Scene_polylines_item
-
-#endif
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_segmented_image_item.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_segmented_image_item.cpp
deleted file mode 100644
index 6959eb2..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_segmented_image_item.cpp
+++ /dev/null
@@ -1,862 +0,0 @@
-#include "config.h"
-
-#include "Scene_segmented_image_item.h"
-#include "Image_type.h"
-#include <QColor>
-#include <map>
-#include <CGAL/gl.h>
-#include <CGAL/ImageIO.h>
-#include <CGAL/use.h>
-
-
-
-// -----------------------------------
-// Internal classes
-// -----------------------------------
-namespace internal {
-
-class Image_accessor
-{
-public:
-  Image_accessor(const Image& im, int dx=1, int dy=1, int dz=1);
-  
-  bool is_vertex_active(std::size_t i, std::size_t j, std::size_t k) const;
-  const QColor& vertex_color(std::size_t i, std::size_t j, std::size_t k) const;
-  void normal(std::size_t i, std::size_t j, std::size_t k,
-              float& x, float& y, float& z) const;
-  
-  int dx() const { return dx_; }
-  int dy() const { return dy_; }
-  int dz() const { return dz_; }
-  std::size_t xdim() const { return im_.xdim(); }
-  std::size_t ydim() const { return im_.ydim(); }
-  std::size_t zdim() const { return im_.zdim(); }
-  double vx() const { return im_.vx(); }
-  double vy() const { return im_.vy(); }
-  double vz() const { return im_.vz(); }
-  
-private:
-  unsigned char non_null_neighbor_data(std::size_t i,
-                                       std::size_t j,
-                                       std::size_t k) const;
-  
-  unsigned char image_data(std::size_t i, std::size_t j, std::size_t k) const;
-  
-  void add_to_normal(unsigned char v,
-                     float& x, float& y, float& z,
-                     int dx, int dy, int dz) const;
-  
-private:
-  const Image& im_;
-  int dx_, dy_, dz_;
-  const QColor default_color_;
-  std::map<unsigned char, QColor> colors_;
-};
-
-
-Image_accessor::Image_accessor(const Image& im, int dx, int dy, int dz)
-: im_(im)
-, dx_(dx)
-, dy_(dy)
-, dz_(dz)
-, default_color_()
-, colors_()
-{
-  const std::size_t xdim = im_.xdim();
-  const std::size_t ydim = im_.ydim();
-  const std::size_t zdim = im_.zdim();  
-  
-  for(std::size_t i=0 ; i<xdim ; i+=dx_)
-  { 
-    for(std::size_t j=0 ; j<ydim ; j+=dy_)
-    { 
-      for(std::size_t k=0 ; k<zdim ; k+=dz_)
-      {
-        unsigned char c = image_data(i,j,k);
-        if ( 0 != c ) { colors_.insert(std::make_pair(c,QColor())); }
-      }
-    }
-  }
-  
-  int i=0;
-  const double starting_hue = 45./360.; // magenta
-  for ( std::map<unsigned char, QColor>::iterator it = colors_.begin(),
-       end = colors_.end() ; it != end ; ++it, ++i )
-  {
-    double hue =  starting_hue + 1./colors_.size() * i;
-    if ( hue > 1. ) { hue -= 1.; }
-    it->second = QColor::fromHsvF(hue, .75, .75);
-  }
-}
-
-bool 
-Image_accessor::
-is_vertex_active(std::size_t i, std::size_t j, std::size_t k) const
-{
-  unsigned char v1 = image_data(i-dx_, j-dy_, k-dz_);
-  unsigned char v2 = image_data(i-dx_, j-dy_, k  );
-  unsigned char v3 = image_data(i-dx_, j    , k-dz_);
-  unsigned char v4 = image_data(i-dx_, j    , k  );
-  unsigned char v5 = image_data(i    , j-dy_, k-dz_);
-  unsigned char v6 = image_data(i    , j-dy_, k  );
-  unsigned char v7 = image_data(i    , j    , k-dz_);
-  unsigned char v8 = image_data(i    , j    , k  );
-  
-  // don't draw interior vertices
-  if ( v1 != 0 && v2 != 0 && v3 != 0 && v4 != 0 && 
-       v5 != 0 && v6 != 0 && v7 != 0 && v8 != 0 )
-  {
-    return false;
-  }
-  
-  return ( v1 != 0 || v2 != 0 || v3 != 0 || v4 != 0 || 
-           v5 != 0 || v6 != 0 || v7 != 0 || v8 != 0 ); 
-}
-
-const QColor&
-Image_accessor::vertex_color(std::size_t i, std::size_t j, std::size_t k) const
-{
-  unsigned char c = non_null_neighbor_data(i,j,k);
-  if ( 0 == c ) { return default_color_; }
-  
-  std::map<unsigned char, QColor>::const_iterator color = colors_.find(c);
-  if ( colors_.end() == color ) { return default_color_; }
-  
-  return color->second;
-}
-
-unsigned char
-Image_accessor::image_data(std::size_t i, std::size_t j, std::size_t k) const
-{
-  if ( i<im_.xdim() && j<im_.ydim() && k<im_.zdim() )
-    return CGAL::IMAGEIO::static_evaluate<unsigned char>(im_.image(),i,j,k);
-  else
-    return 0;
-}
-
-unsigned char
-Image_accessor::
-non_null_neighbor_data(std::size_t i, std::size_t j, std::size_t k) const
-{
-  unsigned char v = image_data(i-dx_, j-dy_, k-dz_);
-  if ( v != 0 ) { return v; }
-  
-  v = image_data(i-dx_, j-dy_, k  );
-  if ( v != 0 ) { return v; }
-
-  v = image_data(i-dx_, j    , k-dz_);
-  if ( v != 0 ) { return v; }
-
-  v = image_data(i-dx_, j    , k  );
-  if ( v != 0 ) { return v; }
-
-  v = image_data(i    , j-dy_, k-dz_);
-  if ( v != 0 ) { return v; }
-  
-  v = image_data(i    , j-dy_, k  );
-  if ( v != 0 ) { return v; }
-  
-  v = image_data(i    , j    , k-dz_);
-  if ( v != 0 ) { return v; }
-
-  v = image_data(i    , j    , k  );
-  if ( v != 0 ) { return v; }
-  
-  return 0;
-}
-
-void
-Image_accessor::
-normal(std::size_t i, std::size_t j, std::size_t k,
-       float& x, float& y, float& z) const
-{
-  unsigned char v = image_data(i-dx_, j-dy_, k-dz_);
-  add_to_normal(v,x,y,z,       1    , 1    , 1);
-  
-  v = image_data(        i-dx_, j-dy_, k);
-  add_to_normal(v,x,y,z, 1    , 1    , -1);
-  
-  v = image_data(        i-dx_, j    , k-dz_);
-  add_to_normal(v,x,y,z, 1    , -1   , 1);
-  
-  v = image_data(        i-dx_, j    , k  );
-  add_to_normal(v,x,y,z, 1    , -1   , -1);
-  
-  v = image_data(        i    , j-dy_, k-dz_);
-  add_to_normal(v,x,y,z, -1   , 1    , 1);
-  
-  v = image_data(        i    , j-dy_, k  );
-  add_to_normal(v,x,y,z, -1   , 1    , -1);
-  
-  v = image_data(        i    , j    , k-dz_);
-  add_to_normal(v,x,y,z, -1   , -1   , 1);
-  
-  v = image_data(        i    , j    , k);
-  add_to_normal(v,x,y,z, -1   , -1   , -1);
-}
-
-void
-Image_accessor::
-add_to_normal(unsigned char v,
-              float& x, float& y, float& z,
-              int dx, int dy, int dz) const
-{
-  if ( 0 != v )
-  {
-    x += dx;
-    y += dy;
-    z += dz;    
-  }
-}
-
-
-
-class Vertex_buffer_helper
-{
-public:
-  Vertex_buffer_helper(const Image_accessor& data);
-  
-  void fill_buffer_data();
-
-  const GLfloat* colors() const { return &(colors_[0]); }
-  const GLfloat* normals() const { return &(normals_[0]); }
-  const GLfloat* vertices() const { return &(vertices_[0]); }
-  const GLuint* quads() const { return &(quads_[0]); }
-  
-  std::size_t color_size() const { return colors_.size()*sizeof(GLfloat); }
-  std::size_t normal_size() const { return normals_.size()*sizeof(GLfloat); }
-  std::size_t vertex_size() const { return vertices_.size()*sizeof(GLfloat); }
-  std::size_t quad_size() const { return quads_.size()*sizeof(GLuint); }
-  
-private:
-  void treat_vertex(std::size_t i, std::size_t j, std::size_t k);
-  
-  void push_color(std::size_t i, std::size_t j, std::size_t k);
-  void push_normal(std::size_t i, std::size_t j, std::size_t k);
-  void push_vertex(std::size_t i, std::size_t j, std::size_t k);
-  void push_quads(std::size_t i, std::size_t j, std::size_t k);
-  void push_quad(int pos1, int pos2, int pos3, int pos4);
-  
-  int compute_position(std::size_t i, std::size_t j, std::size_t k) const;
-  int vertex_index(std::size_t i, std::size_t j, std::size_t k) const;
-  
-  int dx() const { return data_.dx(); }
-  int dy() const { return data_.dy(); }
-  int dz() const { return data_.dz(); }
-  
-private:
-  static int vertex_not_found_;
-  
-  const Image_accessor& data_;
-  typedef std::map<int, std::size_t> Indices;
-  Indices indices_;
-  std::vector<GLfloat> colors_, normals_, vertices_;
-  std::vector<GLuint> quads_;
-};
-
-int Vertex_buffer_helper::vertex_not_found_ = -1;
-
-Vertex_buffer_helper::
-Vertex_buffer_helper(const Image_accessor& data)
-  : data_(data)
-{}
-
-
-void
-Vertex_buffer_helper::
-fill_buffer_data()
-{
-  std::size_t i,j,k;
-  
-  for ( i = 0 ; i <= data_.xdim() ; i+=dx() )
-  {  
-    for ( j = 0 ; j <= data_.ydim() ; j+=dy() )
-    {   
-      for ( k = 0 ; k <= data_.zdim() ; k+=dz() )
-      {
-        treat_vertex(i,j,k);
-      }
-    }
-  }
-}
-
-void
-Vertex_buffer_helper::treat_vertex(std::size_t i, std::size_t j, std::size_t k)
-{
-  if ( data_.is_vertex_active(i,j,k) )
-  {
-    push_vertex(i,j,k);
-    push_color(i,j,k);
-    push_normal(i,j,k);
-    push_quads(i,j,k);    
-  }
-}
-
-void
-Vertex_buffer_helper::push_color(std::size_t i, std::size_t j, std::size_t k)
-{
-  const QColor& color = data_.vertex_color(i,j,k);
-  if ( ! color.isValid() ) { return; }
-  
-  colors_.push_back(color.red()/255.f);
-  colors_.push_back(color.green()/255.f);
-  colors_.push_back(color.blue()/255.f);
-}
-
-void
-Vertex_buffer_helper::push_normal(std::size_t i, std::size_t j, std::size_t k)
-{
-  float x=0.f, y=0.f, z=0.f;
-  data_.normal(i,j,k,x,y,z);
-  
-  float norm = std::sqrt(x*x+y*y+z*z);
-  x = x / norm;
-  y = y / norm;
-  z = z / norm;
-  
-  normals_.push_back(x);
-  normals_.push_back(y);
-  normals_.push_back(z);
-}
-
-void
-Vertex_buffer_helper::push_vertex(std::size_t i, std::size_t j, std::size_t k)
-{
-  indices_.insert(std::make_pair(compute_position(i,j,k),
-                                 vertices_.size()/3)); 
-  
-  vertices_.push_back( (i - 0.5) * data_.vx());
-  vertices_.push_back( (j - 0.5) * data_.vy());
-  vertices_.push_back( (k - 0.5) * data_.vz());
-}
-
-void
-Vertex_buffer_helper::push_quads(std::size_t i, std::size_t j, std::size_t k)
-{
-  int pos1 = vertex_index(i-dx(), j     , k);
-  int pos2 = vertex_index(i-dx(), j-dy(), k);
-  int pos3 = vertex_index(i     , j-dy(), k);
-  int pos4 = vertex_index(i     ,j      , k);
-  push_quad(pos1, pos2, pos3, pos4);
-  
-  pos1 = vertex_index(i-dx(), j, k);
-  pos2 = vertex_index(i-dx(), j, k-dz());
-  pos3 = vertex_index(i     , j, k-dz());
-  push_quad(pos1, pos2, pos3, pos4);
-
-  pos1 = vertex_index(i, j-dy(), k);
-  pos2 = vertex_index(i, j-dy(), k-dz());
-  pos3 = vertex_index(i, j     , k-dz());
-  push_quad(pos1, pos2, pos3, pos4);
-}
-
-void
-Vertex_buffer_helper::push_quad(int pos1, int pos2, int pos3, int pos4)
-{
-  if (   pos1 != vertex_not_found_
-      && pos2 != vertex_not_found_
-      && pos3 != vertex_not_found_ )
-  {
-    quads_.push_back(pos1);
-    quads_.push_back(pos2);
-    quads_.push_back(pos3);
-    quads_.push_back(pos1);
-    quads_.push_back(pos3);
-    quads_.push_back(pos4);
-  }
-}
-
-int
-Vertex_buffer_helper::
-compute_position(std::size_t i, std::size_t j, std::size_t k) const
-{
-  return  static_cast<int>(
-    i/dx() * (data_.ydim()/dy()+1) * (data_.zdim()/dz()+1)
-         + j/dy() * (data_.zdim()/dz()+1)
-         + k/dz());
-}
-
-int
-Vertex_buffer_helper::
-vertex_index(std::size_t i, std::size_t j, std::size_t k) const
-{
-  if ( i > data_.xdim() || j > data_.ydim() || k > data_.zdim() )
-  {
-    return vertex_not_found_;
-  }
-  
-  int vertex_key = compute_position(i,j,k);
-  Indices::const_iterator it = indices_.find(vertex_key);
-  if ( it != indices_.end() )
-  {
-    return static_cast<int>(it->second);
-  }
-  
-  return vertex_not_found_;
-}
-
-
-} // namespace internal
-
-
-// -----------------------------------
-// Scene_segmented_image_item
-// -----------------------------------
-Scene_segmented_image_item::Scene_segmented_image_item(Image* im,
-                                                       int display_scale)
-  : m_image(im)
-  , m_initialized(false)
-  , m_voxel_scale(display_scale)
-
-{
-  CGAL_USE(display_scale);
-
-  v_box = new std::vector<float>();
-  compile_shaders();
-  initialize_buffers();
-  setRenderingMode(Flat);
-}
-
-
-Scene_segmented_image_item::~Scene_segmented_image_item()
-{
-    for(int i=0; i<vboSize; i++)
-        m_vbo[i].destroy();
-    for(int i=0; i<vaoSize; i++)
-        vao[i].destroy();
-}
-
-/**************************************************
-****************SHADER FUNCTIONS******************/
-
-void Scene_segmented_image_item::compile_shaders()
-{
-
-    for(int i=0; i< vboSize; i++)
-        m_vbo[i].create();
-    for(int i=0; i< vaoSize; i++)
-        vao[i].create();
-    m_ibo = new QOpenGLBuffer(QOpenGLBuffer::IndexBuffer);
-    m_ibo->create();
-    //Vertex source code
-    const char vertex_source[] =
-    {
-        "#version 120 \n"
-        "attribute highp vec4 vertex;\n"
-        "attribute highp vec3 normal;\n"
-        "attribute highp vec4 inColor;\n"
-
-        "uniform highp mat4 mvp_matrix;\n"
-        "uniform highp mat4 mv_matrix; \n"
-        "varying highp vec4 fP; \n"
-        "varying highp vec3 fN; \n"
-        "varying highp vec4 color; \n"
-        "void main(void)\n"
-        "{\n"
-        "   color=inColor; \n"
-        "   fP = mv_matrix * vertex; \n"
-        "   fN = mat3(mv_matrix)* normal; \n"
-        "   gl_Position = mvp_matrix * vertex; \n"
-        "}"
-    };
-    //Fragment source code
-    const char fragment_source[] =
-    {
-        "#version 120 \n"
-        "varying highp vec4 fP; \n"
-        "varying highp vec3 fN; \n"
-        "varying highp vec4 color; \n"
-        "uniform bool is_two_side; \n"
-        "uniform highp vec4 light_pos;  \n"
-        "uniform highp vec4 light_diff; \n"
-        "uniform highp vec4 light_spec; \n"
-        "uniform highp vec4 light_amb;  \n"
-        "uniform float spec_power ; \n"
-
-        "void main(void) { \n"
-
-        "   vec3 L = light_pos.xyz - fP.xyz; \n"
-        "   vec3 V = -fP.xyz; \n"
-
-        "   vec3 N; \n"
-        "   if(fN == vec3(0.0,0.0,0.0)) \n"
-        "       N = vec3(0.0,0.0,0.0); \n"
-        "   else \n"
-        "       N = normalize(fN); \n"
-        "   L = normalize(L); \n"
-        "   V = normalize(V); \n"
-
-        "   vec3 R = reflect(-L, N); \n"
-        "   vec4 diffuse; \n"
-        "   if(!is_two_side) \n"
-        "       diffuse = max(dot(N,L),0) * light_diff*color; \n"
-        "   else \n"
-        "       diffuse = max(abs(dot(N,L)),0) * light_diff*color; \n"
-        "   vec4 specular = pow(max(dot(R,V), 0.0), spec_power) * light_spec; \n"
-
-         "gl_FragColor = color*light_amb + diffuse + specular; \n"
-        "} \n"
-        "\n"
-    };
-    QOpenGLShader *vertex_shader = new QOpenGLShader(QOpenGLShader::Vertex);
-    if(!vertex_shader->compileSourceCode(vertex_source))
-    {
-        std::cerr<<"Compiling vertex source FAILED"<<std::endl;
-    }
-
-    QOpenGLShader *fragment_shader= new QOpenGLShader(QOpenGLShader::Fragment);
-    if(!fragment_shader->compileSourceCode(fragment_source))
-    {
-        std::cerr<<"Compiling fragmentsource FAILED"<<std::endl;
-    }
-
-    if(!rendering_program.addShader(vertex_shader))
-    {
-        std::cerr<<"adding vertex shader FAILED"<<std::endl;
-    }
-    if(!rendering_program.addShader(fragment_shader))
-    {
-        std::cerr<<"adding fragment shader FAILED"<<std::endl;
-    }
-    if(!rendering_program.link())
-    {
-        std::cerr<<"linking Program FAILED"<<std::endl;
-    }
-}
-
-void Scene_segmented_image_item::attrib_buffers(Viewer_interface* viewer) const
-{
-    QMatrix4x4 mvpMatrix;
-    QMatrix4x4 mvMatrix;
-    double mat[16];
-    viewer->camera()->getModelViewProjectionMatrix(mat);
-    for(int i=0; i < 16; i++)
-    {
-        mvpMatrix.data()[i] = (float)mat[i];
-    }
-    viewer->camera()->getModelViewMatrix(mat);
-    for(int i=0; i < 16; i++)
-    {
-        mvMatrix.data()[i] = (float)mat[i];
-    }
-    QVector4D	position(0.0f,0.0f,1.0f,1.0f );
-    GLboolean isTwoSide;
-    viewer->glGetBooleanv(GL_LIGHT_MODEL_TWO_SIDE,&isTwoSide);
-    // define material
-     QVector4D	ambient;
-     QVector4D	diffuse;
-     QVector4D	specular;
-     GLfloat      shininess ;
-    // Ambient
-    ambient[0] = 0.29225f;
-    ambient[1] = 0.29225f;
-    ambient[2] = 0.29225f;
-    ambient[3] = 1.0f;
-    // Diffuse
-    diffuse[0] = 0.50754f;
-    diffuse[1] = 0.50754f;
-    diffuse[2] = 0.50754f;
-    diffuse[3] = 1.0f;
-    // Specular
-    specular[0] = 0.0f;
-    specular[1] = 0.0f;
-    specular[2] = 0.0f;
-    specular[3] = 0.0f;
-    // Shininess
-    shininess = 51.2f;
-
-
-    rendering_program.bind();
-    colorLocation[0] = rendering_program.uniformLocation("color");
-    twosideLocation = rendering_program.uniformLocation("is_two_side");
-    mvpLocation[0] = rendering_program.uniformLocation("mvp_matrix");
-    mvLocation[0] = rendering_program.uniformLocation("mv_matrix");
-    lightLocation[0] = rendering_program.uniformLocation("light_pos");
-    lightLocation[1] = rendering_program.uniformLocation("light_diff");
-    lightLocation[2] = rendering_program.uniformLocation("light_spec");
-    lightLocation[3] = rendering_program.uniformLocation("light_amb");
-    lightLocation[4] = rendering_program.uniformLocation("spec_power");
-
-    rendering_program.setUniformValue(lightLocation[0], position);
-    rendering_program.setUniformValue(twosideLocation, isTwoSide);
-    rendering_program.setUniformValue(mvpLocation[0], mvpMatrix);
-    rendering_program.setUniformValue(mvLocation[0], mvMatrix);
-    rendering_program.setUniformValue(lightLocation[1], diffuse);
-    rendering_program.setUniformValue(lightLocation[2], specular);
-    rendering_program.setUniformValue(lightLocation[3], ambient);
-    rendering_program.setUniformValue(lightLocation[4], shininess);
-
-    rendering_program.release();
-}
-
-void
-Scene_segmented_image_item::compute_bbox() const
-{
-  if(!m_image)
-    _bbox = Bbox();
-  else
-    _bbox = Bbox(0, 0, 0,
-              m_image->xdim() * m_image->vx(),
-              m_image->ydim() * m_image->vy(),
-              m_image->zdim() * m_image->vz());
-}
-
-void
-Scene_segmented_image_item::draw(Viewer_interface* viewer) const
-{
-  if(m_image)
-  {
-
-    //m_image->gl_draw_bbox(3.0f,0,0,0);
-    draw_gl(viewer);
-  }
-}
-
-QString
-Scene_segmented_image_item::toolTip() const
-{
-  return tr("<p>Image <b>%1</b></p>"
-            "<p>Word type: %2</p>"
-            "<p>Dimensions: %3 x %4 x %5</p>"
-            "<p>Spacings: ( %6 , %7 , %8 )</p>")
-    .arg(this->name())
-    .arg("...")
-    .arg(m_image->xdim()) 
-    .arg(m_image->ydim())
-    .arg(m_image->zdim())
-    .arg(m_image->vx())
-    .arg(m_image->vy())
-    .arg(m_image->vz());
-}
-
-bool
-Scene_segmented_image_item::supportsRenderingMode(RenderingMode m) const
-{ 
-  switch ( m )
-  {
-    case Gouraud:
-      return false;
-      
-    case Points:
-    case Wireframe:
-    case Flat:
-    case FlatPlusEdges:
-      return true;
-      
-    default:
-      return false;
-  }
-  
-  return false;
-}
-
-void
-Scene_segmented_image_item::initialize_buffers() 
-{
-  internal::Image_accessor image_data_accessor (*m_image,
-                                                m_voxel_scale,
-                                                m_voxel_scale,
-                                                m_voxel_scale);
-  
-  internal::Vertex_buffer_helper helper (image_data_accessor);
-  helper.fill_buffer_data();
-
-  draw_Bbox(bbox(), v_box);
-  std::vector<float> nul_vec(0);
-  for(std::size_t i=0; i<v_box->size(); i++)
-      nul_vec.push_back(0.0);
-
-  rendering_program.bind();
-  vao[0].bind();
-  m_vbo[0].bind();
-  m_vbo[0].allocate(helper.vertices(), static_cast<int>(helper.vertex_size()));
-  poly_vertexLocation[0] = rendering_program.attributeLocation("vertex");
-  rendering_program.enableAttributeArray(poly_vertexLocation[0]);
-  rendering_program.setAttributeBuffer(poly_vertexLocation[0],GL_FLOAT,0,3);
-  m_vbo[0].release();
-
-  m_vbo[1].bind();
-  m_vbo[1].allocate(helper.normals(), static_cast<int>(helper.normal_size()));
-  normalsLocation[0] = rendering_program.attributeLocation("normal");
-  rendering_program.enableAttributeArray(normalsLocation[0]);
-  rendering_program.setAttributeBuffer(normalsLocation[0],GL_FLOAT,0,3);
-  m_vbo[1].release();
-
-  m_vbo[2].bind();
-  m_vbo[2].allocate(helper.colors(), static_cast<int>(helper.color_size()));
-  colorLocation[0] = rendering_program.attributeLocation("inColor");
-  rendering_program.enableAttributeArray(colorLocation[0]);
-  rendering_program.setAttributeBuffer(colorLocation[0],GL_FLOAT,0,3);
-  m_vbo[2].release();
-
-  m_ibo->bind();
-  m_ibo->allocate(helper.quads(), static_cast<int>(helper.quad_size()));
-  vao[0].release();
-
-  color.resize(0);
-  for(std::size_t i=0; i<helper.color_size()/sizeof(GLuint); i++)
-      color.push_back(0.0);
-
-  vao[1].bind();
-  m_vbo[3].bind();
-  m_vbo[3].allocate(v_box->data(), static_cast<int>(v_box->size()*sizeof(float)));
-  poly_vertexLocation[0] = rendering_program.attributeLocation("vertex");
-  rendering_program.enableAttributeArray(poly_vertexLocation[0]);
-  rendering_program.setAttributeBuffer(poly_vertexLocation[0],GL_FLOAT,0,3);
-  m_vbo[3].release();
-
-  m_vbo[4].bind();
-  m_vbo[3].allocate(nul_vec.data(), static_cast<int>(nul_vec.size()*sizeof(float)));
-  normalsLocation[0] = rendering_program.attributeLocation("normal");
-  rendering_program.enableAttributeArray(normalsLocation[0]);
-  rendering_program.setAttributeBuffer(normalsLocation[0],GL_FLOAT,0,3);
-  m_vbo[4].release();
-
-  m_vbo[5].bind();
-  m_vbo[5].allocate(nul_vec.data(), static_cast<int>(nul_vec.size()*sizeof(float)));
-  colorLocation[0] = rendering_program.attributeLocation("inColor");
-  rendering_program.enableAttributeArray(colorLocation[0]);
-  rendering_program.setAttributeBuffer(colorLocation[0],GL_FLOAT,0,3);
-  m_vbo[5].release();
-
-  m_ibo->bind();
-  vao[1].release();
-  rendering_program.release();
-
-  m_initialized = true;
-}
-
-
-void
-Scene_segmented_image_item::draw_gl(Viewer_interface* viewer) const
-{
-  attrib_buffers(viewer);
-  rendering_program.bind();
-  vao[0].bind();
-  viewer->glDrawElements(GL_TRIANGLES, m_ibo->size()/sizeof(GLuint), GL_UNSIGNED_INT, 0);
-  vao[0].release();
-
-  vao[1].bind();
-  viewer->glLineWidth(3);
-  viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(v_box->size()/3));
-  vao[1].release();
-  rendering_program.release();
-}
-
-GLint
-Scene_segmented_image_item::ibo_size() const
-{
-      m_ibo->bind();
-    GLint nb_elts = m_ibo->size();
-    m_ibo->release();
-
-    return nb_elts/sizeof(GLuint);
-
-  return 0;
-}
-
-void Scene_segmented_image_item::changed()
-{
-    initialize_buffers();
-}
-
-void Scene_segmented_image_item::draw_Bbox(Bbox bbox, std::vector<float> *vertices)
-{
-    vertices->push_back(bbox.xmin);
-    vertices->push_back(bbox.ymin);
-    vertices->push_back(bbox.zmin);
-
-    vertices->push_back(bbox.xmin);
-    vertices->push_back(bbox.ymin);
-    vertices->push_back(bbox.zmax);
-
-    vertices->push_back(bbox.xmin);
-    vertices->push_back(bbox.ymin);
-    vertices->push_back(bbox.zmin);
-
-    vertices->push_back(bbox.xmin);
-    vertices->push_back(bbox.ymax);
-    vertices->push_back(bbox.zmin);
-
-    vertices->push_back(bbox.xmin);
-    vertices->push_back(bbox.ymin);
-    vertices->push_back(bbox.zmin);
-
-    vertices->push_back(bbox.xmax);
-    vertices->push_back(bbox.ymin);
-    vertices->push_back(bbox.zmin);
-
-    vertices->push_back(bbox.xmax);
-    vertices->push_back(bbox.ymin);
-    vertices->push_back(bbox.zmin);
-
-    vertices->push_back(bbox.xmax);
-    vertices->push_back(bbox.ymax);
-    vertices->push_back(bbox.zmin);
-
-    vertices->push_back(bbox.xmax);
-    vertices->push_back(bbox.ymin);
-    vertices->push_back(bbox.zmin);
-
-    vertices->push_back(bbox.xmax);
-    vertices->push_back(bbox.ymin);
-    vertices->push_back(bbox.zmax);
-
-    vertices->push_back(bbox.xmin);
-    vertices->push_back(bbox.ymax);
-    vertices->push_back(bbox.zmin);
-
-    vertices->push_back(bbox.xmin);
-    vertices->push_back(bbox.ymax);
-    vertices->push_back(bbox.zmax);
-
-    vertices->push_back(bbox.xmin);
-    vertices->push_back(bbox.ymax);
-    vertices->push_back(bbox.zmin);
-
-    vertices->push_back(bbox.xmax);
-    vertices->push_back(bbox.ymax);
-    vertices->push_back(bbox.zmin);
-
-    vertices->push_back(bbox.xmax);
-    vertices->push_back(bbox.ymax);
-    vertices->push_back(bbox.zmin);
-
-    vertices->push_back(bbox.xmax);
-    vertices->push_back(bbox.ymax);
-    vertices->push_back(bbox.zmax);
-
-    vertices->push_back(bbox.xmin);
-    vertices->push_back(bbox.ymin);
-    vertices->push_back(bbox.zmax);
-
-    vertices->push_back(bbox.xmin);
-    vertices->push_back(bbox.ymax);
-    vertices->push_back(bbox.zmax);
-
-    vertices->push_back(bbox.xmin);
-    vertices->push_back(bbox.ymin);
-    vertices->push_back(bbox.zmax);
-
-    vertices->push_back(bbox.xmax);
-    vertices->push_back(bbox.ymin);
-    vertices->push_back(bbox.zmax);
-
-    vertices->push_back(bbox.xmax);
-    vertices->push_back(bbox.ymax);
-    vertices->push_back(bbox.zmax);
-
-    vertices->push_back(bbox.xmin);
-    vertices->push_back(bbox.ymax);
-    vertices->push_back(bbox.zmax);
-
-    vertices->push_back(bbox.xmax);
-    vertices->push_back(bbox.ymax);
-    vertices->push_back(bbox.zmax);
-
-    vertices->push_back(bbox.xmax);
-    vertices->push_back(bbox.ymin);
-    vertices->push_back(bbox.zmax);
-
-}
-
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_segmented_image_item.h b/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_segmented_image_item.h
deleted file mode 100644
index e1e9a64..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_segmented_image_item.h
+++ /dev/null
@@ -1,89 +0,0 @@
-#ifndef SCENE_SEGMENTED_IMAGE_ITEM_H
-#define SCENE_SEGMENTED_IMAGE_ITEM_H
-
-#include <CGAL/Three/Scene_item.h>
-#include "Image_type_fwd.h"
-#include "Scene_segmented_image_item_config.h"
-#include <CGAL/gl.h>
-
-#include <QOpenGLVertexArrayObject>
-#include <QOpenGLBuffer>
-#include <QOpenGLShaderProgram>
-
-#include <CGAL/Three/Scene_interface.h>
-#include <CGAL/Three/Viewer_interface.h>
-
-typedef CGAL::Image_3 Image;
-using namespace CGAL::Three;
-class SCENE_SEGMENTED_IMAGE_ITEM_EXPORT Scene_segmented_image_item 
-  : public Scene_item
-{
-  Q_OBJECT
-public:
-
-  Scene_segmented_image_item(Image* im, int drawing_scale);
-  ~Scene_segmented_image_item();
-
-  bool isFinite() const { return true; }
-  bool isEmpty() const { return false; }
-  void compute_bbox() const;
-
-  Scene_segmented_image_item* clone() const { return NULL; }
-
-  // rendering mode
-  virtual bool supportsRenderingMode(RenderingMode m) const;
-
-  // draw
-  virtual void direct_draw(CGAL::Three::Viewer_interface* viewer) const
-  { draw(viewer); }
-  virtual void direct_draw_edges(CGAL::Three::Viewer_interface* viewer) const
-  { draw_edges(viewer); }
-  virtual void draw(CGAL::Three::Viewer_interface*) const;
-  virtual void draw_edges(CGAL::Three::Viewer_interface* viewer) const
-  { draw_gl(viewer); }
-  
-  virtual QString toolTip() const;
-  
-  const Image* image() const { return m_image; }
-
-private:
-  void draw_gl(CGAL::Three::Viewer_interface* viewer) const;
-  
-  void initialize_buffers();
-  GLint ibo_size() const;
-  
-public:
-  Image* m_image;
-
-private:
-  bool m_initialized;
-#ifdef SCENE_SEGMENTED_IMAGE_GL_BUFFERS_AVAILABLE
-  int m_voxel_scale;
-  static const int vaoSize = 2;
-  static const int vboSize = 6;
-  mutable int poly_vertexLocation[1];
-  mutable int normalsLocation[1];
-  mutable int mvpLocation[1];
-  mutable int mvLocation[1];
-  mutable int colorLocation[1];
-  mutable int lightLocation[5];
-  mutable int twosideLocation;
-
-   std::vector<float> *v_box;
-   std::vector<float> color;
-
-
-  mutable QOpenGLBuffer m_vbo[vboSize];
-  mutable QOpenGLBuffer *m_ibo;
-  mutable QOpenGLVertexArrayObject vao[vaoSize];
-  mutable QOpenGLShaderProgram rendering_program;
-  void draw_bbox();
-  void attrib_buffers(CGAL::Three::Viewer_interface*) const;
-  void compile_shaders();
-  void draw_Bbox(Bbox bbox, std::vector<float> *vertices);
-public Q_SLOTS:
-    void changed();
-#endif // SCENE_SEGMENTED_IMAGE_GL_BUFFERS_AVAILABLE
-};
-
-#endif // SCENE_SEGMENTED_IMAGE_ITEM_H
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_segmented_image_item_config.h b/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_segmented_image_item_config.h
deleted file mode 100644
index 047f838..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_segmented_image_item_config.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef SCENE_SEGMENTED_IMAGE_ITEM_CONFIG_H
-#define SCENE_SEGMENTED_IMAGE_ITEM_CONFIG_H
-
-#ifdef scene_segmented_image_item_EXPORTS
-#  define SCENE_SEGMENTED_IMAGE_ITEM_EXPORT Q_DECL_EXPORT
-#else
-#  define SCENE_SEGMENTED_IMAGE_ITEM_EXPORT Q_DECL_IMPORT
-#endif
-
-#endif // SCENE_SEGMENTED_IMAGE_ITEM_CONFIG_H
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_textured_polyhedron_item.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_textured_polyhedron_item.cpp
deleted file mode 100644
index 3ef414c..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_textured_polyhedron_item.cpp
+++ /dev/null
@@ -1,365 +0,0 @@
-#include "Scene_textured_polyhedron_item.h"
-#include "Textured_polyhedron_type.h"
-#include <CGAL/IO/Polyhedron_iostream.h>
-#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
-#include <CGAL/Polygon_mesh_processing/compute_normal.h>
-
-#include <QObject>
-
-typedef EPIC_kernel::Point_3 Point;
-
-
-void Scene_textured_polyhedron_item::initialize_buffers(CGAL::Three::Viewer_interface *viewer = 0) const
-{
-    if(GLuint(-1) == textureId) {
-        viewer->glGenTextures(1, &textureId);
-    }
-    //vao for the facets
-    {
-        program = getShaderProgram(PROGRAM_WITH_TEXTURE, viewer);
-        program->bind();
-        vaos[Facets]->bind();
-        buffers[Facets_Vertices].bind();
-        buffers[Facets_Vertices].allocate(positions_facets.data(),
-                            static_cast<int>(positions_facets.size()*sizeof(float)));
-        program->enableAttributeArray("vertex");
-        program->setAttributeBuffer("vertex",GL_FLOAT,0,4);
-        buffers[Facets_Vertices].release();
-
-        buffers[Facets_Normals].bind();
-        buffers[Facets_Normals].allocate(normals.data(),
-                            static_cast<int>(normals.size()*sizeof(float)));
-        program->enableAttributeArray("normal");
-        program->setAttributeBuffer("normal",GL_FLOAT,0,3);
-        buffers[Facets_Normals].release();
-
-
-        buffers[Facets_Texmap].bind();
-        buffers[Facets_Texmap].allocate(textures_map_facets.data(),
-                            static_cast<int>(textures_map_facets.size()*sizeof(float)));
-        program->enableAttributeArray("v_texCoord");
-        program->setAttributeBuffer("v_texCoord",GL_FLOAT,0,2);
-        buffers[Facets_Texmap].release();
-        vaos[Facets]->release();
-        program->release();
-    }
-
-    //vao for the lines
-    {
-        program = getShaderProgram(PROGRAM_WITH_TEXTURED_EDGES, viewer);
-        program->bind();
-        vaos[Edges]->bind();
-        buffers[Edges_Vertices].bind();
-        buffers[Edges_Vertices].allocate(positions_lines.data(),
-                            static_cast<int>(positions_lines.size()*sizeof(float)));
-        program->enableAttributeArray("vertex");
-        program->setAttributeBuffer("vertex",GL_FLOAT,0,4);
-        buffers[Edges_Vertices].release();
-
-
-        buffers[Edges_Texmap].bind();
-        buffers[Edges_Texmap].allocate(textures_map_lines.data(),
-                            static_cast<int>(textures_map_lines.size()*sizeof(float)));
-        program->enableAttributeArray("v_texCoord");
-        program->setAttributeBuffer("v_texCoord",GL_FLOAT,0,2);
-        buffers[Edges_Texmap].release();
-        vaos[Edges]->release();
-        program->release();
-    }
-
-    viewer->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-
-    viewer->glActiveTexture(GL_TEXTURE0);
-    viewer->glBindTexture(GL_TEXTURE_2D, textureId);
-    viewer->glTexImage2D(GL_TEXTURE_2D,
-                 0,
-                 GL_RGB,
-                 texture.GetWidth(),
-                 texture.GetHeight(),
-                 0,
-                 GL_RGB,
-                 GL_UNSIGNED_BYTE,
-                 texture.GetData());
-    viewer->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
-    viewer->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
-    viewer->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-    viewer->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-    glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-
-    nb_facets = positions_facets.size();
-    positions_facets.resize(0);
-    std::vector<float>(positions_facets).swap(positions_facets);
-    normals.resize(0);
-    std::vector<float>(normals).swap(normals);
-    textures_map_facets.resize(0);
-    std::vector<float>(textures_map_facets).swap(textures_map_facets);
-    nb_lines = positions_lines.size();
-    positions_lines.resize(0);
-    std::vector<float>(positions_lines).swap(positions_lines);
-    textures_map_lines.resize(0);
-    std::vector<float>(textures_map_lines).swap(textures_map_lines);
-
-    are_buffers_filled = true;
-}
-
-void
-Scene_textured_polyhedron_item::compute_normals_and_vertices(void) const
-{
-    positions_facets.resize(0);
-    positions_lines.resize(0);
-    textures_map_facets.resize(0);
-    textures_map_lines.resize(0);
-    normals.resize(0);
-
-    typedef ::EPIC_kernel Kernel;
-    typedef CGAL::Textured_items Items;
-    typedef Kernel::Point_3 Point;
-    typedef Kernel::Vector_3 Vector;
-    typedef CGAL::Polyhedron_3<Kernel,Items> Base;
-
-    typedef Base::Halfedge_around_facet_circulator Halfedge_around_facet_circulator;
-    typedef Base::Edge_iterator Edge_iterator;
-    typedef Base::Facet Facet;
-    typedef Base::Facet_iterator Facet_iterator;
-
-    //Facets
-    Facet_iterator f = poly->facets_begin();
-
-    for(f = poly->facets_begin();
-        f != poly->facets_end();
-        f++)
-    {
-
-        Halfedge_around_facet_circulator he = f->facet_begin();
-        Halfedge_around_facet_circulator end = he;
-        CGAL_For_all(he,end)
-        {
-
-            // If Flat shading:1 normal per polygon added once per vertex
-            if (cur_shading == Flat || cur_shading == FlatPlusEdges)
-            {
-
-                Vector n = CGAL::Polygon_mesh_processing::
-                  compute_face_normal(f, static_cast<Base&>(*poly));
-                normals.push_back(n[0]);
-                normals.push_back(n[1]);
-                normals.push_back(n[2]);
-            }
-
-            // If Gouraud shading: 1 normal per vertex
-            else if(cur_shading == Gouraud)
-            {
-
-                const Facet::Normal_3& n = he->vertex()->normal();
-                normals.push_back(n[0]);
-                normals.push_back(n[1]);
-                normals.push_back(n[2]);
-            }
-
-            //position
-            const Point& p = he->vertex()->point();
-            positions_facets.push_back(p.x());
-            positions_facets.push_back(p.y());
-            positions_facets.push_back(p.z());
-            positions_facets.push_back(1.0);
-
-            const double u = he->vertex()->u();
-            const double v = he->vertex()->v();
-            textures_map_facets.push_back(u);
-            textures_map_facets.push_back(v);
-        }
-
-
-    }
-    //Lines
-    typedef Kernel::Point_3		Point;
-    typedef Base::Edge_iterator	Edge_iterator;
-
-    Edge_iterator he;
-
-    for(he = poly->edges_begin();
-        he != poly->edges_end();
-        he++)
-    {
-
-        const Point& a = he->vertex()->point();
-        const Point& b = he->opposite()->vertex()->point();
-        positions_lines.push_back(a.x());
-        positions_lines.push_back(a.y());
-        positions_lines.push_back(a.z());
-        positions_lines.push_back(1.0);
-
-        const double u = he->vertex()->u();
-        const double v = he->vertex()->v();
-        textures_map_lines.push_back(u);
-        textures_map_lines.push_back(v);
-
-        positions_lines.push_back(b.x());
-        positions_lines.push_back(b.y());
-        positions_lines.push_back(b.z());
-        positions_lines.push_back(1.0);
-
-        const double ou = he->opposite()->vertex()->u();
-        const double ov = he->opposite()->vertex()->v();
-        textures_map_lines.push_back(ou);
-        textures_map_lines.push_back(ov);
-
-    }
-
-}
-
-Scene_textured_polyhedron_item::Scene_textured_polyhedron_item()
-    : Scene_item(NbOfVbos,NbOfVaos),poly(new Textured_polyhedron), textureId(-1)
-{
-    texture.GenerateCheckerBoard(2048,2048,128,0,0,0,250,250,255);
-    cur_shading=FlatPlusEdges;
-    is_selected=false;
-    nb_facets = 0;
-    nb_lines = 0;
-    invalidateOpenGLBuffers();
-}
-
-Scene_textured_polyhedron_item::Scene_textured_polyhedron_item(Textured_polyhedron* const p)
-    : Scene_item(NbOfVbos,NbOfVaos),poly(p),textureId(-1),smooth_shading(true)
-{
-    cur_shading=FlatPlusEdges;
-    is_selected=false;
-    texture.GenerateCheckerBoard(2048,2048,128,0,0,0,250,250,255);
-    nb_facets = 0;
-    nb_lines = 0;
-    invalidateOpenGLBuffers();
-}
-
-Scene_textured_polyhedron_item::Scene_textured_polyhedron_item(const Textured_polyhedron& p)
-    : Scene_item(NbOfVbos,NbOfVaos), poly(new Textured_polyhedron(p)),textureId(-1),smooth_shading(true)
-{
-    texture.GenerateCheckerBoard(2048,2048,128,0,0,0,250,250,255);
-    cur_shading=FlatPlusEdges;
-    is_selected=false;
-    nb_facets = 0;
-    nb_lines = 0;
-    invalidateOpenGLBuffers();
-}
-
-Scene_textured_polyhedron_item::~Scene_textured_polyhedron_item()
-{
-    delete poly;
-}
-
-Scene_textured_polyhedron_item* 
-Scene_textured_polyhedron_item::clone() const {
-    return new Scene_textured_polyhedron_item(*poly);
-}
-
-// Load textured_polyhedron from .OFF file
-bool
-Scene_textured_polyhedron_item::load(std::istream& in)
-{
-    std::cout<<"LOAD"<<std::endl;
-    in >> *poly;
-    invalidateOpenGLBuffers();
-    return in && !isEmpty();
-}
-
-// Write textured_polyhedron to .OFF file
-bool 
-Scene_textured_polyhedron_item::save(std::ostream& out) const
-{
-    out << *poly;
-    return (bool) out;
-}
-
-QString 
-Scene_textured_polyhedron_item::toolTip() const
-{
-    if(!poly)
-        return QString();
-
-    return QObject::tr("<p>Textured polyhedron <b>%1</b> (mode: %5, color: %6)</p>"
-                       "<p>Number of vertices: %2<br />"
-                       "Number of edges: %3<br />"
-                       "Number of facets: %4</p>")
-            .arg(this->name())
-            .arg(poly->size_of_vertices())
-            .arg(poly->size_of_halfedges()/2)
-            .arg(poly->size_of_facets())
-            .arg(this->renderingModeName())
-            .arg(this->color().name());
-}
-
-// Points/Wireframe/Flat/Gouraud OpenGL drawing in a display list
-void Scene_textured_polyhedron_item::draw(CGAL::Three::Viewer_interface* viewer) const {
-
-    if(!are_buffers_filled)
-    {
-        compute_normals_and_vertices();
-        initialize_buffers(viewer);
-    }
-
-    vaos[Facets]->bind();
-    viewer->glActiveTexture(GL_TEXTURE0);
-    viewer->glBindTexture(GL_TEXTURE_2D, textureId);
-    attrib_buffers(viewer, PROGRAM_WITH_TEXTURE);
-    program=getShaderProgram(PROGRAM_WITH_TEXTURE);
-    program->bind();
-    viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(nb_facets/4));
-    //Clean-up
-    program->release();
-    vaos[Facets]->release();
-}
-void Scene_textured_polyhedron_item::draw_edges(CGAL::Three::Viewer_interface* viewer) const {
-    if(!are_buffers_filled)
-        initialize_buffers(viewer);
-
-    vaos[Edges]->bind();
-    viewer->glActiveTexture(GL_TEXTURE0);
-    viewer->glBindTexture(GL_TEXTURE_2D, textureId);
-    attrib_buffers(viewer, PROGRAM_WITH_TEXTURED_EDGES);
-
-    program=getShaderProgram(PROGRAM_WITH_TEXTURED_EDGES);
-    program->bind();
-    viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(nb_lines/4));
-    //Clean-up
-    program->release();
-    vaos[Edges]->release();
-}
-
-Textured_polyhedron* 
-Scene_textured_polyhedron_item::textured_polyhedron()       { return poly; }
-const Textured_polyhedron* 
-Scene_textured_polyhedron_item::textured_polyhedron() const { return poly; }
-
-bool
-Scene_textured_polyhedron_item::isEmpty() const {
-    return (poly == 0) || poly->empty();
-}
-
-void
-Scene_textured_polyhedron_item::compute_bbox() const {
-    const Point& p = *(poly->points_begin());
-    CGAL::Bbox_3 bbox(p.x(), p.y(), p.z(), p.x(), p.y(), p.z());
-    for(Textured_polyhedron::Point_iterator it = poly->points_begin();
-        it != poly->points_end();
-        ++it) {
-        bbox = bbox + it->bbox();
-    }
-    _bbox = Bbox(bbox.xmin(),bbox.ymin(),bbox.zmin(),
-                bbox.xmax(),bbox.ymax(),bbox.zmax());
-}
-void
-Scene_textured_polyhedron_item::invalidateOpenGLBuffers()
-{
-    are_buffers_filled = false;
-    compute_bbox();
-}
-void
-Scene_textured_polyhedron_item::selection_changed(bool p_is_selected)
-{
-    if(p_is_selected != is_selected)
-    {
-        is_selected = p_is_selected;
-        initialize_buffers();
-    }
-    else
-        is_selected = p_is_selected;
-}
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_textured_polyhedron_item.h b/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_textured_polyhedron_item.h
deleted file mode 100644
index dbddb49..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_textured_polyhedron_item.h
+++ /dev/null
@@ -1,88 +0,0 @@
-#ifndef SCENE_TEXTURED_POLYHEDRON_ITEM_H
-#define SCENE_TEXTURED_POLYHEDRON_ITEM_H
-#include "Scene_textured_polyhedron_item_config.h"
-#include  <CGAL/Three/Scene_item.h>
-#include <CGAL/Three/Viewer_interface.h>
-#include "Textured_polyhedron_type_fwd.h"
-#include <iostream>
-#include "texture.h"
-
-// This class represents a textured polyhedron in the OpenGL scene
-class SCENE_TEXTURED_POLYHEDRON_ITEM_EXPORT Scene_textured_polyhedron_item 
-  : public CGAL::Three::Scene_item {
-  Q_OBJECT
-public:  
-  Scene_textured_polyhedron_item();
-//   Scene_textured_polyhedron_item(const Scene_textured_polyhedron_item&);
-  Scene_textured_polyhedron_item(const Textured_polyhedron& p);
-  Scene_textured_polyhedron_item(Textured_polyhedron* const p);
-  ~Scene_textured_polyhedron_item();
-
-  Scene_textured_polyhedron_item* clone() const;
-  
-  // IO
-  bool load(std::istream& in);
-  bool save(std::ostream& out) const;
-
-  // Function for displaying meta-data of the item
-  virtual QString toolTip() const;
-
-  // Indicate if rendering mode is supported
-  virtual bool supportsRenderingMode(RenderingMode m) const { return (m != Splatting && m != PointsPlusNormals && m != Points && m != Gouraud ); }
-  // Points/Wireframe/Flat/Gouraud OpenGL drawing in a display list
-   void draw() const {}
-  virtual void draw(CGAL::Three::Viewer_interface*) const;
-   virtual void draw_edges() const {}
-   virtual void draw_edges(CGAL::Three::Viewer_interface* viewer) const;
-
-  // Get wrapped textured_polyhedron
-  Textured_polyhedron*       textured_polyhedron();
-  const Textured_polyhedron* textured_polyhedron() const;
-
-  // Get dimensions
-  bool isFinite() const { return true; }
-  bool isEmpty() const;
-  void compute_bbox() const;
-
-  virtual void invalidateOpenGLBuffers();
-  virtual void selection_changed(bool);
-
-private:
-  Textured_polyhedron* poly;
-  Texture texture;
-
-  enum VAOs {
-      Facets=0,
-      Edges,
-      NbOfVaos
-  };
-  enum VBOs {
-      Facets_Vertices=0,
-      Facets_Normals,
-      Facets_Texmap,
-      Edges_Vertices,
-      Edges_Texmap,
-      NbOfVbos
-  };
-
-  mutable std::vector<float> positions_lines;
-  mutable std::vector<float> positions_facets;
-  mutable std::vector<float> normals;
-  mutable std::vector<float> textures_map_facets;
-  mutable std::vector<float> textures_map_lines;
-  mutable std::size_t nb_facets;
-  mutable std::size_t nb_lines;
-
-  mutable GLuint textureId;
-  mutable QOpenGLShaderProgram* program;
-
-  bool smooth_shading;
-
-  using CGAL::Three::Scene_item::initialize_buffers;
-  void initialize_buffers(CGAL::Three::Viewer_interface *viewer) const;
-  void compute_normals_and_vertices(void) const;
-
-
-}; // end class Scene_textured_polyhedron_item
-
-#endif // SCENE_TEXTURED_POLYHEDRON_ITEM_H
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Show_point_dialog.ui b/3rdparty/CGAL-4.8/demo/Polyhedron/Show_point_dialog.ui
deleted file mode 100644
index 5543f27..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Show_point_dialog.ui
+++ /dev/null
@@ -1,161 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>Show_point_dialog</class>
- <widget class="QDialog" name="Show_point_dialog">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>575</width>
-    <height>151</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Dialog</string>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout_2">
-   <item>
-    <layout class="QVBoxLayout" name="verticalLayout">
-     <item>
-      <layout class="QFormLayout" name="formLayout">
-       <property name="fieldGrowthPolicy">
-        <enum>QFormLayout::ExpandingFieldsGrow</enum>
-       </property>
-       <item row="1" column="0">
-        <widget class="QLabel" name="label_7">
-         <property name="text">
-          <string>Point &coordinates</string>
-         </property>
-         <property name="alignment">
-          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-         </property>
-         <property name="buddy">
-          <cstring>lineEdit</cstring>
-         </property>
-        </widget>
-       </item>
-       <item row="1" column="1">
-        <widget class="QLineEdit" name="lineEdit">
-         <property name="sizePolicy">
-          <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
-           <horstretch>1</horstretch>
-           <verstretch>0</verstretch>
-          </sizepolicy>
-         </property>
-         <property name="toolTip">
-          <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
-<html><head><meta name="qrichtext" content="1" /><style type="text/css">
-p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'DejaVu LGC Sans'; font-size:11pt; font-weight:400; font-style:normal;">
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Paste here the coordinates of a point. It can be for example:</p>
-<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&quot;(10., -2e-2, .4)&quot;</p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">or:</p>
-<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&quot;-2 3 5&quot;</p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">or even something with garbage around:</p>
-<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&quot;point  (-2, 5, 0) and...&quot;</p></body></html></string>
-         </property>
-        </widget>
-       </item>
-       <item row="2" column="0">
-        <widget class="QLabel" name="label_x">
-         <property name="text">
-          <string>x</string>
-         </property>
-         <property name="alignment">
-          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-         </property>
-        </widget>
-       </item>
-       <item row="2" column="1">
-        <widget class="QLabel" name="coord_x">
-         <property name="text">
-          <string/>
-         </property>
-        </widget>
-       </item>
-       <item row="3" column="0">
-        <widget class="QLabel" name="label_y">
-         <property name="text">
-          <string>y</string>
-         </property>
-         <property name="alignment">
-          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-         </property>
-        </widget>
-       </item>
-       <item row="3" column="1">
-        <widget class="QLabel" name="coord_y">
-         <property name="text">
-          <string/>
-         </property>
-        </widget>
-       </item>
-       <item row="4" column="0">
-        <widget class="QLabel" name="label_z">
-         <property name="text">
-          <string>z</string>
-         </property>
-         <property name="alignment">
-          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-         </property>
-        </widget>
-       </item>
-       <item row="4" column="1">
-        <widget class="QLabel" name="coord_z">
-         <property name="text">
-          <string/>
-         </property>
-        </widget>
-       </item>
-      </layout>
-     </item>
-     <item>
-      <widget class="QDialogButtonBox" name="buttonBox">
-       <property name="standardButtons">
-        <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
-       </property>
-      </widget>
-     </item>
-    </layout>
-   </item>
-  </layout>
- </widget>
- <tabstops>
-  <tabstop>lineEdit</tabstop>
- </tabstops>
- <resources/>
- <connections>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>accepted()</signal>
-   <receiver>Show_point_dialog</receiver>
-   <slot>accept()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>423</x>
-     <y>120</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>387</x>
-     <y>139</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>rejected()</signal>
-   <receiver>Show_point_dialog</receiver>
-   <slot>reject()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>520</x>
-     <y>120</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>512</x>
-     <y>138</y>
-    </hint>
-   </hints>
-  </connection>
- </connections>
-</ui>
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Viewer.cpp b/3rdparty/CGAL-4.8/demo/Polyhedron/Viewer.cpp
deleted file mode 100644
index 48f80ee..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Viewer.cpp
+++ /dev/null
@@ -1,1164 +0,0 @@
-#include "Viewer.h"
-#include <CGAL/gl.h>
-#include <CGAL/Three/Scene_draw_interface.h>
-#include <QMouseEvent>
-#include <QKeyEvent>
-#include <QGLViewer/manipulatedCameraFrame.h>
-#include <QDebug>
-#include <QOpenGLShader>
-#include <QOpenGLShaderProgram>
-#include <cmath>
-
-class Viewer_impl {
-public:
-  CGAL::Three::Scene_draw_interface* scene;
-  bool antialiasing;
-  bool twosides;
-  bool macro_mode;
-  bool inFastDrawing;
-  
-  void draw_aux(bool with_names, Viewer*);
-
-  //! Contains all the programs for the item rendering.
-  mutable std::vector<QOpenGLShaderProgram*> shader_programs;
-};
-Viewer::Viewer(QWidget* parent, bool antialiasing)
-  : CGAL::Three::Viewer_interface(parent)
-{
-  d = new Viewer_impl;
-  d->scene = 0;
-  d->antialiasing = antialiasing;
-  d->twosides = false;
-  d->macro_mode = false;
-  d->inFastDrawing = true;
-  d->shader_programs.resize(NB_OF_PROGRAMS);
-  setShortcut(EXIT_VIEWER, 0);
-  setShortcut(DRAW_AXIS, 0);
-  setKeyDescription(Qt::Key_T,
-                    tr("Turn the camera by 180 degrees"));
-  setKeyDescription(Qt::Key_M,
-                    tr("Toggle macro mode: useful to view details very near from the camera, "
-                       "but decrease the z-buffer precision"));
-  setKeyDescription(Qt::Key_A,
-                      tr("Toggle the axis system visibility."));
-#if QGLVIEWER_VERSION >= 0x020501
-  //modify mouse bindings that have been updated
-  setMouseBinding(Qt::Key(0), Qt::NoModifier, Qt::LeftButton, RAP_FROM_PIXEL, true, Qt::RightButton);
-  setMouseBindingDescription(Qt::ShiftModifier, Qt::RightButton,
-                             tr("Select and pop context menu"));
-  setMouseBinding(Qt::Key_R, Qt::NoModifier, Qt::LeftButton, RAP_FROM_PIXEL);
-  //use the new API for these
-  setMouseBinding(Qt::ShiftModifier, Qt::LeftButton, SELECT);
-#else
-  setMouseBinding(Qt::SHIFT + Qt::LeftButton, SELECT);
-  setMouseBindingDescription(Qt::SHIFT + Qt::RightButton,
-                             tr("Selects and display context "
-                                "menu of the selected item"));
-#endif // QGLVIEWER_VERSION >= 2.5.0
-  for(int i=0; i<16; i++)
-      pickMatrix_[i]=0;
-  pickMatrix_[0]=1;
-  pickMatrix_[5]=1;
-  pickMatrix_[10]=1;
-  pickMatrix_[15]=1;
-  prev_radius = sceneRadius();
-  axis_are_displayed = true;
-}
-
-Viewer::~Viewer()
-{
-  delete d;
-}
-
-void Viewer::setScene(CGAL::Three::Scene_draw_interface* scene)
-{
-  d->scene = scene;
-}
-
-bool Viewer::antiAliasing() const
-{
-  return d->antialiasing; 
-}
-
-void Viewer::setAntiAliasing(bool b)
-{
-  d->antialiasing = b;
-  updateGL();
-}
-
-void Viewer::setTwoSides(bool b)
-{
-  d->twosides = b;
-  updateGL();
-}
-
-
-void Viewer::setFastDrawing(bool b)
-{
-  d->inFastDrawing = b;
-  updateGL();
-}
-
-bool Viewer::inFastDrawing() const
-{
-  return (d->inFastDrawing
-          && (camera()->frame()->isSpinning()
-              || camera()->frame()->isManipulated()));
-}
-
-void Viewer::draw()
-{
-  glEnable(GL_DEPTH_TEST);
-  d->draw_aux(false, this);
-}
-
-void Viewer::fastDraw()
-{
-  d->draw_aux(false, this);
-}
-
-void Viewer::initializeGL()
-{
-  QGLViewer::initializeGL();
-  initializeOpenGLFunctions();
-  glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDARBPROC)this->context()->getProcAddress("glDrawArraysInstancedARB");
-  if(!glDrawArraysInstanced)
-  {
-      qDebug()<<"glDrawArraysInstancedARB : extension not found. Spheres will be displayed as points.";
-      extension_is_found = false;
-  }
-  else
-      extension_is_found = true;
-
-  glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISORARBPROC)this->context()->getProcAddress("glVertexAttribDivisorARB");
-  if(!glDrawArraysInstanced)
-  {
-      qDebug()<<"glVertexAttribDivisorARB : extension not found. Spheres will be displayed as points.";
-      extension_is_found = false;
-  }
-  else
-      extension_is_found = true;
-
-
-  setBackgroundColor(::Qt::white);
-  vao[0].create();
-  for(int i=0; i<3; i++)
-    buffers[i].create();
-
-  //Vertex source code
-  const char vertex_source[] =
-  {
-      "#version 120 \n"
-      "attribute highp vec4 vertex;\n"
-      "attribute highp vec3 normal;\n"
-      "attribute highp vec4 colors;\n"
-      "uniform highp mat4 mvp_matrix;\n"
-      "uniform highp mat4 ortho_mat;\n"
-      "uniform highp mat4 mv_matrix; \n"
-      "uniform highp float width; \n"
-      "uniform highp float height; \n"
-      "varying highp vec4 fP; \n"
-      "varying highp vec3 fN; \n"
-      "varying highp vec4 color; \n"
-      "void main(void)\n"
-      "{\n"
-      "   color = colors; \n"
-      "   fP = mv_matrix * vertex; \n"
-      "   fN = mat3(mv_matrix)* normal; \n"
-      "   vec4 temp = vec4(mvp_matrix * vertex); \n"
-      "   vec4 ort = ortho_mat * vec4(width-150, height-150, 0,0); \n"
-      "   float ratio = width/height; \n"
-      "   gl_Position =  ort +vec4(temp.x, temp.y, temp.z, 1.0); \n"
-      "} \n"
-      "\n"
-  };
-  //Fragment source code
-  const char fragment_source[] =
-  {
-      "#version 120 \n"
-      "varying highp vec4 color; \n"
-      "varying highp vec4 fP; \n"
-      "varying highp vec3 fN; \n"
-      "uniform highp vec4 light_pos;  \n"
-      "uniform highp vec4 light_diff; \n"
-      "uniform highp vec4 light_spec; \n"
-      "uniform highp vec4 light_amb;  \n"
-      "uniform highp float spec_power ; \n"
-
-      "void main(void) { \n"
-
-      "   vec3 L = light_pos.xyz - fP.xyz; \n"
-      "   vec3 V = -fP.xyz; \n"
-      "   vec3 N; \n"
-      "   if(fN == vec3(0.0,0.0,0.0)) \n"
-      "       N = vec3(0.0,0.0,0.0); \n"
-      "   else \n"
-      "       N = normalize(fN); \n"
-      "   L = normalize(L); \n"
-      "   V = normalize(V); \n"
-      "   vec3 R = reflect(-L, N); \n"
-      "   vec4 diffuse = max(abs(dot(N,L)),0.0) * light_diff*color; \n"
-      "   vec4 specular = pow(max(dot(R,V), 0.0), spec_power) * light_spec; \n"
-
-      "gl_FragColor = color*light_amb + diffuse + specular; \n"
-      "} \n"
-      "\n"
-  };
-  QOpenGLShader *vertex_shader = new QOpenGLShader(QOpenGLShader::Vertex);
-  if(!vertex_shader->compileSourceCode(vertex_source))
-  {
-      std::cerr<<"Compiling vertex source FAILED"<<std::endl;
-  }
-
-  QOpenGLShader *fragment_shader= new QOpenGLShader(QOpenGLShader::Fragment);
-  if(!fragment_shader->compileSourceCode(fragment_source))
-  {
-      std::cerr<<"Compiling fragmentsource FAILED"<<std::endl;
-  }
-
-  if(!rendering_program.addShader(vertex_shader))
-  {
-      std::cerr<<"adding vertex shader FAILED"<<std::endl;
-  }
-  if(!rendering_program.addShader(fragment_shader))
-  {
-      std::cerr<<"adding fragment shader FAILED"<<std::endl;
-  }
-  if(!rendering_program.link())
-  {
-      qDebug() << rendering_program.log();
-  }
-}
-
-#include <QMouseEvent>
-
-void Viewer::mousePressEvent(QMouseEvent* event)
-{
-  if(event->button() == Qt::RightButton &&
-     event->modifiers().testFlag(Qt::ShiftModifier)) 
-  {
-    select(event->pos());
-    requestContextMenu(event->globalPos());
-    event->accept();
-  }
-  else {
-    QGLViewer::mousePressEvent(event);
-  }
-}
-
-void Viewer::keyPressEvent(QKeyEvent* e)
-{
-  if(!e->modifiers()) {
-    if(e->key() == Qt::Key_T) {
-      turnCameraBy180Degres();
-      return;
-    }
-    else if(e->key() == Qt::Key_M) {
-      d->macro_mode = ! d->macro_mode;
-
-      if(d->macro_mode) {
-          camera()->setZNearCoefficient(0.0005f);
-      } else {
-        camera()->setZNearCoefficient(0.005f);
-      }
-      this->displayMessage(tr("Macro mode: %1").
-                           arg(d->macro_mode ? tr("on") : tr("off")));
-
-
-
-      return;
-    }
-    else if(e->key() == Qt::Key_A) {
-          axis_are_displayed = !axis_are_displayed;
-          updateGL();
-        }
-  }
-  //forward the event to the scene (item handling of the event)
-  if (! d->scene->keyPressEvent(e) )
-    QGLViewer::keyPressEvent(e);
-}
-
-void Viewer::turnCameraBy180Degres() {
-  qglviewer::Camera* camera = this->camera();
-  using qglviewer::ManipulatedCameraFrame;
-
-  ManipulatedCameraFrame frame_from(*camera->frame());
-  camera->setViewDirection(-camera->viewDirection());
-  ManipulatedCameraFrame frame_to(*camera->frame());
-
-  camera->setOrientation(frame_from.orientation());
-  camera->interpolateTo(frame_to, 0.5f);
-}
-
-void Viewer_impl::draw_aux(bool with_names, Viewer* viewer)
-{
-  if(scene == 0)
-    return;
-  viewer->glLineWidth(1.0f);
-  viewer->glPointSize(2.f);
-  viewer->glEnable(GL_POLYGON_OFFSET_FILL);
-  viewer->glPolygonOffset(1.0f,1.0f);
-  viewer->glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
-
-  viewer->glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);
-
-  if(twosides)
-    viewer->glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
-  else
-    viewer->glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
-
-  if(antialiasing)
-  {
-    viewer->glEnable(GL_BLEND);
-    viewer->glEnable(GL_LINE_SMOOTH);
-    viewer->glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
-    viewer->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-  }
-  else
-  {
-    viewer->glDisable(GL_BLEND);
-    viewer->glDisable(GL_LINE_SMOOTH);
-    viewer->glHint(GL_LINE_SMOOTH_HINT, GL_FASTEST);
-    viewer->glBlendFunc(GL_ONE, GL_ZERO);
-  }
-  if(with_names)
-    scene->drawWithNames(viewer);
-  else
-    scene->draw(viewer);
-  viewer->glDisable(GL_POLYGON_OFFSET_FILL);
-  viewer->glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
-}
-
-void Viewer::drawWithNames()
-{
-  QGLViewer::draw();
-  d->draw_aux(true, this);
-}
-
-void Viewer::postSelection(const QPoint& pixel)
-{
-  bool found = false;
-  qglviewer::Vec point = camera()->pointUnderPixel(pixel, found);
-  if(found) {
-    Q_EMIT selectedPoint(point.x,
-                       point.y,
-                       point.z);
-    Q_EMIT selected(this->selectedName());
-    const qglviewer::Vec orig = camera()->position();
-    const qglviewer::Vec dir = point - orig;
-    Q_EMIT selectionRay(orig.x, orig.y, orig.z,
-                      dir.x, dir.y, dir.z);
-  }
-}
-bool CGAL::Three::Viewer_interface::readFrame(QString s, qglviewer::Frame& frame)
-{
-  QStringList list = s.split(" ", QString::SkipEmptyParts);
-  if(list.size() != 7)
-    return false;
-  float vec[3];
-  for(int i = 0; i < 3; ++i)
-  {
-    bool ok;
-    vec[i] = list[i].toFloat(&ok);
-    if(!ok) return false;
-  }
-  double orient[4];
-  for(int i = 0; i < 4; ++i)
-  {
-    bool ok;
-    orient[i] = list[i + 3].toDouble(&ok);
-    if(!ok) return false;
-  }
-  frame.setPosition(qglviewer::Vec(vec[0],
-                                   vec[1],
-                                   vec[2]));
-  frame.setOrientation(orient[0],
-                       orient[1],
-                       orient[2],
-                       orient[3]);
-  return true;
-}
-
-QString CGAL::Three::Viewer_interface::dumpFrame(const qglviewer::Frame& frame) {
-  const qglviewer::Vec pos = frame.position();
-  const qglviewer::Quaternion q = frame.orientation();
-
-  return QString("%1 %2 %3 %4 %5 %6 %7")
-    .arg(pos[0])
-    .arg(pos[1])
-    .arg(pos[2])
-    .arg(q[0])
-    .arg(q[1])
-    .arg(q[2])
-    .arg(q[3]);
-}
-
-bool Viewer::moveCameraToCoordinates(QString s, float animation_duration) {
-  qglviewer::Frame new_frame;
-  if(readFrame(s, new_frame)) {
-    camera()->interpolateTo(new_frame, animation_duration); 
-    return true;
-  }
-  else
-    return false;
-}
-
-QString Viewer::dumpCameraCoordinates()
-{
-  if(camera()->frame()) {
-    return dumpFrame(*camera()->frame());
-  } else {
-    return QString();
-  }
-}
-
-void Viewer::attrib_buffers(int program_name) const {
-    GLint is_both_sides = 0;
-    //ModelViewMatrix used for the transformation of the camera.
-    QMatrix4x4 mvp_mat;
-    // ModelView Matrix used for the lighting system
-    QMatrix4x4 mv_mat;
-    // transformation of the manipulated frame
-    QMatrix4x4 f_mat;
-    // used for the picking. Is Identity except while selecting an item.
-    QMatrix4x4 pick_mat;
-    f_mat.setToIdentity();
-    //fills the MVP and MV matrices.
-    GLdouble d_mat[16];
-    this->camera()->getModelViewProjectionMatrix(d_mat);
-    //Convert the GLdoubles matrices in GLfloats
-    for (int i=0; i<16; ++i){
-        mvp_mat.data()[i] = GLfloat(d_mat[i]);
-    }
-    this->camera()->getModelViewMatrix(d_mat);
-    for (int i=0; i<16; ++i)
-        mv_mat.data()[i] = GLfloat(d_mat[i]);
-    for (int i=0; i<16; ++i)
-        pick_mat.data()[i] = this->pickMatrix_[i];
-
-    mvp_mat = pick_mat * mvp_mat;
-
-    const_cast<Viewer*>(this)->glGetIntegerv(GL_LIGHT_MODEL_TWO_SIDE,
-                                             &is_both_sides);
-
-    QVector4D position(0.0f,0.0f,1.0f, 1.0f );
-    QVector4D ambient(0.4f, 0.4f, 0.4f, 0.4f);
-    // Diffuse
-    QVector4D diffuse(1.0f, 1.0f, 1.0f, 1.0f);
-    // Specular
-    QVector4D specular(0.0f, 0.0f, 0.0f, 1.0f);
-    QOpenGLShaderProgram* program = getShaderProgram(program_name);
-    program->bind();
-    switch(program_name)
-    {
-    case PROGRAM_NO_SELECTION:
-        program->setUniformValue("mvp_matrix", mvp_mat);
-
-        program->setUniformValue("f_matrix",f_mat);
-        break;
-    case PROGRAM_WITH_LIGHT:
-        program->setUniformValue("mvp_matrix", mvp_mat);
-        program->setUniformValue("mv_matrix", mv_mat);
-        program->setUniformValue("light_pos", position);
-        program->setUniformValue("light_diff",diffuse);
-        program->setUniformValue("light_spec", specular);
-        program->setUniformValue("light_amb", ambient);
-        program->setUniformValue("spec_power", 51.8f);
-        program->setUniformValue("is_two_side", is_both_sides);
-        break;
-    case PROGRAM_C3T3:
-        program->setUniformValue("mvp_matrix", mvp_mat);
-        program->setUniformValue("mv_matrix", mv_mat);
-        program->setUniformValue("light_pos", position);
-        program->setUniformValue("light_diff",diffuse);
-        program->setUniformValue("light_spec", specular);
-        program->setUniformValue("light_amb", ambient);
-        program->setUniformValue("spec_power", 51.8f);
-        program->setUniformValue("is_two_side", is_both_sides);
-        break;
-    case PROGRAM_C3T3_EDGES:
-        program->setUniformValue("mvp_matrix", mvp_mat);
-        break;
-    case PROGRAM_WITHOUT_LIGHT:
-        program->setUniformValue("mvp_matrix", mvp_mat);
-        program->setUniformValue("mv_matrix", mv_mat);
-
-        program->setUniformValue("light_pos", position);
-        program->setUniformValue("light_diff", diffuse);
-        program->setUniformValue("light_spec", specular);
-        program->setUniformValue("light_amb", ambient);
-        program->setUniformValue("spec_power", 51.8f);
-        program->setUniformValue("is_two_side", is_both_sides);
-        program->setAttributeValue("normals", 0.0,0.0,0.0);
-        program->setUniformValue("f_matrix",f_mat);
-
-
-        break;
-    case PROGRAM_WITH_TEXTURE:
-
-        program->setUniformValue("mvp_matrix", mvp_mat);
-        program->setUniformValue("mv_matrix", mv_mat);
-        program->setUniformValue("light_pos", position);
-        program->setUniformValue("light_diff",diffuse);
-        program->setUniformValue("light_spec", specular);
-        program->setUniformValue("light_amb", ambient);
-        program->setUniformValue("spec_power", 51.8f);
-        program->setUniformValue("s_texture",0);
-        program->setUniformValue("f_matrix",f_mat);
-
-        break;
-    case PROGRAM_PLANE_TWO_FACES:
-        program->setUniformValue("mvp_matrix", mvp_mat);
-        program->setUniformValue("mv_matrix", mv_mat);
-        program->setUniformValue("light_pos", position);
-        program->setUniformValue("light_diff",diffuse);
-        program->setUniformValue("light_spec", specular);
-        program->setUniformValue("light_amb", ambient);
-        program->setUniformValue("spec_power", 51.8f);
-        program->setUniformValue("is_two_side", is_both_sides);
-        break;
-
-    case PROGRAM_WITH_TEXTURED_EDGES:
-
-        program->setUniformValue("mvp_matrix", mvp_mat);
-        program->setUniformValue("s_texture",0);
-
-        break;
-    case PROGRAM_INSTANCED:
-
-        program->setUniformValue("mvp_matrix", mvp_mat);
-        program->setUniformValue("mv_matrix", mv_mat);
-
-        program->setUniformValue("light_pos", position);
-        program->setUniformValue("light_diff",diffuse);
-        program->setUniformValue("light_spec", specular);
-        program->setUniformValue("light_amb", ambient);
-        program->setUniformValue("spec_power", 51.8f);
-        program->setUniformValue("is_two_side", is_both_sides);
-
-        break;
-    case PROGRAM_INSTANCED_WIRE:
-        program->setUniformValue("mvp_matrix", mvp_mat);
-        break;
-    }
-    program->release();
-}
-
-
-void Viewer::pickMatrix(GLdouble x, GLdouble y, GLdouble width, GLdouble height,
-GLint viewport[4])
-{
- //GLfloat m[16];
- GLfloat sx, sy;
- GLfloat tx, ty;
-
- sx = viewport[2] / width;
- sy = viewport[3] / height;
- tx = (viewport[2] + 2.0 * (viewport[0] - x)) / width;
- ty = (viewport[3] + 2.0 * (viewport[1] - y)) / height;
-
- #define M(row, col) pickMatrix_[col*4+row]
-  M(0, 0) = sx;
-  M(0, 1) = 0.0;
-  M(0, 2) = 0.0;
-  M(0, 3) = tx;
-  M(1, 0) = 0.0;
-  M(1, 1) = sy;
-  M(1, 2) = 0.0;
-  M(1, 3) = ty;
-  M(2, 0) = 0.0;
-  M(2, 1) = 0.0;
-  M(2, 2) = 1.0;
-  M(2, 3) = 0.0;
-  M(3, 0) = 0.0;
-  M(3, 1) = 0.0;
-  M(3, 2) = 0.0;
-  M(3, 3) = 1.0;
- #undef M
-
- //pickMatrix_[i] = m[i];
-}
-void Viewer::beginSelection(const QPoint &point)
-{
-    QGLViewer::beginSelection(point);
-    //set the picking matrix to allow the picking
-    static GLint viewport[4];
-    camera()->getViewport(viewport);
-    pickMatrix(point.x(), point.y(), selectRegionWidth(), selectRegionHeight(), viewport);
-
-}
-void Viewer::endSelection(const QPoint& point)
-{
-  QGLViewer::endSelection(point);
-   //set the pick matrix to Identity
-    for(int i=0; i<16; i++)
-        pickMatrix_[i]=0;
-    pickMatrix_[0]=1;
-    pickMatrix_[5]=1;
-    pickMatrix_[10]=1;
-    pickMatrix_[15]=1;
-}
-
-void Viewer::makeArrow(double R, int prec, qglviewer::Vec from, qglviewer::Vec to, qglviewer::Vec color, AxisData &data)
-{
-    qglviewer::Vec temp = to-from;
-    QVector3D dir = QVector3D(temp.x, temp.y, temp.z);
-    QMatrix4x4 mat;
-    mat.setToIdentity();
-    mat.translate(from.x, from.y, from.z);
-    mat.scale(dir.length());
-    dir.normalize();
-    float angle = 0.0;
-    if(std::sqrt((dir.x()*dir.x()+dir.y()*dir.y())) > 1)
-        angle = 90.0f;
-    else
-        angle =acos(dir.y()/std::sqrt(dir.x()*dir.x()+dir.y()*dir.y()+dir.z()*dir.z()))*180.0/M_PI;
-
-    QVector3D axis;
-    axis = QVector3D(dir.z(), 0, -dir.x());
-    mat.rotate(angle, axis);
-
-    //Head
-    const float Rf = static_cast<float>(R);
-    for(int d = 0; d<360; d+= 360/prec)
-    {
-        float D = (float) (d * M_PI / 180.);
-        float a = (float) std::atan(Rf / 0.33);
-        QVector4D p(0., 1., 0, 1.);
-        QVector4D n(Rf*2.*sin(D), sin(a), Rf*2.*cos(D), 1.);
-        QVector4D pR = mat*p;
-        QVector4D nR = mat*n;
-
-        //point A1
-        data.vertices->push_back(pR.x());
-        data.vertices->push_back(pR.y());
-        data.vertices->push_back(pR.z());
-        data.normals->push_back(nR.x());
-        data.normals->push_back(nR.y());
-        data.normals->push_back(nR.z());
-        data.colors->push_back((float)color.x);
-        data.colors->push_back((float)color.y);
-        data.colors->push_back((float)color.z);
-
-        //point B1
-        p = QVector4D(Rf*2.*sin(D), 0.66f, Rf*2.* cos(D), 1.f);
-        n = QVector4D(sin(D), sin(a), cos(D), 1.);
-        pR = mat*p;
-        nR = mat*n;
-        data.vertices->push_back(pR.x());
-        data.vertices->push_back(pR.y());
-        data.vertices->push_back(pR.z());
-        data.normals->push_back(nR.x());
-        data.normals->push_back(nR.y());
-        data.normals->push_back(nR.z());
-        data.colors->push_back((float)color.x);
-        data.colors->push_back((float)color.y);
-        data.colors->push_back((float)color.z);
-        //point C1
-        D = (d+360/prec)*M_PI/180.0;
-        p = QVector4D(Rf*2.* sin(D), 0.66f, Rf *2.* cos(D), 1.f);
-        n = QVector4D(sin(D), sin(a), cos(D), 1.0);
-        pR = mat*p;
-        nR = mat*n;
-
-        data.vertices->push_back(pR.x());
-        data.vertices->push_back(pR.y());
-        data.vertices->push_back(pR.z());
-        data.normals->push_back(nR.x());
-        data.normals->push_back(nR.y());
-        data.normals->push_back(nR.z());
-        data.colors->push_back((float)color.x);
-        data.colors->push_back((float)color.y);
-        data.colors->push_back((float)color.z);
-
-    }
-
-    //cylinder
-    //body of the cylinder
-    for(int d = 0; d<360; d+= 360/prec)
-    {
-        //point A1
-        double D = d*M_PI/180.0;
-        QVector4D p(Rf*sin(D), 0.66f, Rf*cos(D), 1.f);
-        QVector4D n(sin(D), 0.f, cos(D), 1.f);
-        QVector4D pR = mat*p;
-        QVector4D nR = mat*n;
-
-        data.vertices->push_back(pR.x());
-        data.vertices->push_back(pR.y());
-        data.vertices->push_back(pR.z());
-        data.normals->push_back(nR.x());
-        data.normals->push_back(nR.y());
-        data.normals->push_back(nR.z());
-        data.colors->push_back(color.x);
-        data.colors->push_back(color.y);
-        data.colors->push_back(color.z);
-        //point B1
-        p = QVector4D(Rf * sin(D),0,Rf*cos(D), 1.0);
-        n = QVector4D(sin(D), 0, cos(D), 1.0);
-        pR = mat*p;
-        nR = mat*n;
-
-
-        data.vertices->push_back(pR.x());
-        data.vertices->push_back(pR.y());
-        data.vertices->push_back(pR.z());
-        data.normals->push_back(nR.x());
-        data.normals->push_back(nR.y());
-        data.normals->push_back(nR.z());
-        data.colors->push_back(color.x);
-        data.colors->push_back(color.y);
-        data.colors->push_back(color.z);
-          //point C1
-        D = (d+360/prec)*M_PI/180.0;
-        p = QVector4D(Rf * sin(D),0,Rf*cos(D), 1.0);
-        n = QVector4D(sin(D), 0, cos(D), 1.0);
-        pR = mat*p;
-        nR = mat*n;
-        data.vertices->push_back(pR.x());
-        data.vertices->push_back(pR.y());
-        data.vertices->push_back(pR.z());
-        data.normals->push_back(nR.x());
-        data.normals->push_back(nR.y());
-        data.normals->push_back(nR.z());
-        data.colors->push_back(color.x);
-        data.colors->push_back(color.y);
-        data.colors->push_back(color.z);
-        //point A2
-        D = (d+360/prec)*M_PI/180.0;
-
-        p = QVector4D(Rf * sin(D),0,Rf*cos(D), 1.0);
-        n = QVector4D(sin(D), 0, cos(D), 1.0);
-        pR = mat*p;
-        nR = mat*n;
-        data.vertices->push_back(pR.x());
-        data.vertices->push_back(pR.y());
-        data.vertices->push_back(pR.z());
-        data.normals->push_back(nR.x());
-        data.normals->push_back(nR.y());
-        data.normals->push_back(nR.z());
-        data.colors->push_back((float)color.x);
-        data.colors->push_back((float)color.y);
-        data.colors->push_back((float)color.z);
-        //point B2
-        p = QVector4D(Rf * sin(D), 0.66f, Rf*cos(D), 1.f);
-        n = QVector4D(sin(D), 0, cos(D), 1.0);
-        pR = mat*p;
-        nR = mat*n;
-        data.vertices->push_back(pR.x());
-        data.vertices->push_back(pR.y());
-        data.vertices->push_back(pR.z());
-        data.normals->push_back(nR.x());
-        data.normals->push_back(nR.y());
-        data.normals->push_back(nR.z());
-        data.colors->push_back((float)color.x);
-        data.colors->push_back((float)color.y);
-        data.colors->push_back((float)color.z);
-        //point C2
-        D = d*M_PI/180.0;
-        p = QVector4D(Rf * sin(D), 0.66f, Rf*cos(D), 1.f);
-        n = QVector4D(sin(D), 0.f, cos(D), 1.f);
-        pR = mat*p;
-        nR = mat*n;
-        data.vertices->push_back(pR.x());
-        data.vertices->push_back(pR.y());
-        data.vertices->push_back(pR.z());
-        data.normals->push_back(nR.x());
-        data.normals->push_back(nR.y());
-        data.normals->push_back(nR.z());
-        data.colors->push_back(color.x);
-        data.colors->push_back(color.y);
-        data.colors->push_back(color.z);
-
-    }
-}
-
-void Viewer::drawVisualHints()
-{
-    QGLViewer::drawVisualHints();
-    if(axis_are_displayed)
-    {
-        QMatrix4x4 mvpMatrix;
-        QMatrix4x4 mvMatrix;
-        double mat[16];
-        //camera()->frame()->rotation().getMatrix(mat);
-        camera()->getModelViewProjectionMatrix(mat);
-        //nullifies the translation
-        mat[12]=0;
-        mat[13]=0;
-        mat[14]=0;
-        for(int i=0; i < 16; i++)
-        {
-            mvpMatrix.data()[i] = (float)mat[i];
-        }
-        camera()->getModelViewMatrix(mat);
-        for(int i=0; i < 16; i++)
-        {
-            mvMatrix.data()[i] = (float)mat[i];
-        }
-
-        QVector4D	position(0.0f,0.0f,1.0f,1.0f );
-        // define material
-        QVector4D	ambient;
-        QVector4D	diffuse;
-        QVector4D	specular;
-        GLfloat      shininess ;
-        // Ambient
-        ambient[0] = 0.29225f;
-        ambient[1] = 0.29225f;
-        ambient[2] = 0.29225f;
-        ambient[3] = 1.0f;
-        // Diffuse
-        diffuse[0] = 0.50754f;
-        diffuse[1] = 0.50754f;
-        diffuse[2] = 0.50754f;
-        diffuse[3] = 1.0f;
-        // Specular
-        specular[0] = 0.0f;
-        specular[1] = 0.0f;
-        specular[2] = 0.0f;
-        specular[3] = 0.0f;
-        // Shininess
-        shininess = 51.2f;
-
-        rendering_program.bind();
-        rendering_program.setUniformValue("light_pos", position);
-        rendering_program.setUniformValue("mvp_matrix", mvpMatrix);
-        rendering_program.setUniformValue("mv_matrix", mvMatrix);
-        rendering_program.setUniformValue("light_diff", diffuse);
-        rendering_program.setUniformValue("light_spec", specular);
-        rendering_program.setUniformValue("light_amb", ambient);
-        rendering_program.setUniformValue("spec_power", shininess);
-        rendering_program.release();
-
-        vao[0].bind();
-        rendering_program.bind();
-        glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(v_Axis.size() / 3));
-        rendering_program.release();
-        vao[0].release();
-    }
-
-}
-
-void Viewer::resizeGL(int w, int h)
-{
-    QGLViewer::resizeGL(w,h);
-    qglviewer::Vec dim = qglviewer::Vec(w,h, 0) ;
-    GLdouble ortho[16];
-    QMatrix4x4 orthoMatrix;
-    ortho[0]  = 1.0/width(); ortho[1]  = 0; ortho[2]  = 0; ortho[3]  = -0.0;
-    ortho[4]  = 0; ortho[5]  = 1.0/height(); ortho[6]  = 0; ortho[7]  = -0.0;
-    ortho[8]  = 0; ortho[9]  = 0; ortho[10] = 2.0/(camera()->zNear()-camera()->zFar()); ortho[11] = -(camera()->zNear()+camera()->zFar())/(-camera()->zNear()+camera()->zFar());
-    ortho[12] = 0; ortho[13] = 0; ortho[14] = 0; ortho[15] = 1;
-    for(int i=0; i < 16; i++)
-    {
-        orthoMatrix.data()[i] = (float)ortho[i];
-    }
-
-    QVector4D length(60,60,60, 1.0);
-    length = orthoMatrix * length;
-    AxisData data;
-    v_Axis.resize(0);
-    n_Axis.resize(0);
-    c_Axis.resize(0);
-    data.vertices = &v_Axis;
-    data.normals = &n_Axis;
-    data.colors = &c_Axis;
-    double l = length.x()*w/h;
-    makeArrow(0.06,10, qglviewer::Vec(0,0,0),qglviewer::Vec(l,0,0),qglviewer::Vec(1,0,0), data);
-    makeArrow(0.06,10, qglviewer::Vec(0,0,0),qglviewer::Vec(0,l,0),qglviewer::Vec(0,1,0), data);
-    makeArrow(0.06,10, qglviewer::Vec(0,0,0),qglviewer::Vec(0,0,l),qglviewer::Vec(0,0,1), data);
-
-
-    vao[0].bind();
-    buffers[0].bind();
-    buffers[0].allocate(v_Axis.data(), static_cast<int>(v_Axis.size()) * sizeof(float));
-    rendering_program.enableAttributeArray("vertex");
-    rendering_program.setAttributeBuffer("vertex",GL_FLOAT,0,3);
-    buffers[0].release();
-
-    buffers[1].bind();
-    buffers[1].allocate(n_Axis.data(), static_cast<int>(n_Axis.size() * sizeof(float)));
-    rendering_program.enableAttributeArray("normal");
-    rendering_program.setAttributeBuffer("normal",GL_FLOAT,0,3);
-    buffers[1].release();
-
-    buffers[2].bind();
-    buffers[2].allocate(c_Axis.data(), static_cast<int>(c_Axis.size() * sizeof(float)));
-    rendering_program.enableAttributeArray("colors");
-    rendering_program.setAttributeBuffer("colors",GL_FLOAT,0,3);
-    buffers[2].release();
-
-    rendering_program.release();
-    vao[0].release();
-
-
-
-    rendering_program.bind();
-    rendering_program.setUniformValue("width", (float)dim.x);
-    rendering_program.setUniformValue("height", (float)dim.y);
-    rendering_program.setUniformValue("ortho_mat", orthoMatrix);
-    rendering_program.release();
-
-}
-
-QOpenGLShaderProgram* Viewer::getShaderProgram(int name) const
-{
-    // workaround constness issues in Qt
-    Viewer* viewer = const_cast<Viewer*>(this);
-
-    switch(name)
-    {
-    /// @TODO: factorize this code   
-    case PROGRAM_C3T3:
-        if(d->shader_programs[PROGRAM_C3T3])
-        {
-            return d->shader_programs[PROGRAM_C3T3];
-        }
-
-        else
-        {
-
-            QOpenGLShaderProgram *program = new QOpenGLShaderProgram(viewer);
-            if(!program->addShaderFromSourceFile(QOpenGLShader::Vertex,":/cgal/Polyhedron_3/resources/shader_c3t3.v"))
-            {
-                std::cerr<<"adding vertex shader FAILED"<<std::endl;
-            }
-            if(!program->addShaderFromSourceFile(QOpenGLShader::Fragment,":/cgal/Polyhedron_3/resources/shader_c3t3.f"))
-            {
-                std::cerr<<"adding fragment shader FAILED"<<std::endl;
-            }
-            program->bindAttributeLocation("colors", 1);
-            program->link();
-            d->shader_programs[PROGRAM_C3T3] = program;
-            return program;
-        }
-        break;
-    case PROGRAM_C3T3_EDGES:
-        if(d->shader_programs[PROGRAM_C3T3_EDGES])
-        {
-            return d->shader_programs[PROGRAM_C3T3_EDGES];
-        }
-
-        else
-        {
-
-            QOpenGLShaderProgram *program = new QOpenGLShaderProgram(viewer);
-            if(!program->addShaderFromSourceFile(QOpenGLShader::Vertex,":/cgal/Polyhedron_3/resources/shader_c3t3_edges.v"))
-            {
-                std::cerr<<"adding vertex shader FAILED"<<std::endl;
-            }
-            if(!program->addShaderFromSourceFile(QOpenGLShader::Fragment,":/cgal/Polyhedron_3/resources/shader_c3t3_edges.f"))
-            {
-                std::cerr<<"adding fragment shader FAILED"<<std::endl;
-            }
-            program->bindAttributeLocation("colors", 1);
-            program->link();
-            d->shader_programs[PROGRAM_C3T3_EDGES] = program;
-            return program;
-        }
-        break;
-    case PROGRAM_WITH_LIGHT:
-        if(d->shader_programs[PROGRAM_WITH_LIGHT])
-        {
-            return d->shader_programs[PROGRAM_WITH_LIGHT];
-        }
-
-        else
-        {
-
-            QOpenGLShaderProgram *program = new QOpenGLShaderProgram(viewer);
-            if(!program->addShaderFromSourceFile(QOpenGLShader::Vertex,":/cgal/Polyhedron_3/resources/shader_with_light.v"))
-            {
-                std::cerr<<"adding vertex shader FAILED"<<std::endl;
-            }
-            if(!program->addShaderFromSourceFile(QOpenGLShader::Fragment,":/cgal/Polyhedron_3/resources/shader_with_light.f"))
-            {
-                std::cerr<<"adding fragment shader FAILED"<<std::endl;
-            }
-            program->bindAttributeLocation("colors", 1);
-            program->link();
-            d->shader_programs[PROGRAM_WITH_LIGHT] = program;
-            return program;
-        }
-        break;
-    case PROGRAM_WITHOUT_LIGHT:
-        if( d->shader_programs[PROGRAM_WITHOUT_LIGHT])
-        {
-            return d->shader_programs[PROGRAM_WITHOUT_LIGHT];
-        }
-        else
-        {
-            QOpenGLShaderProgram *program = new QOpenGLShaderProgram(viewer);
-            if(!program->addShaderFromSourceFile(QOpenGLShader::Vertex,":/cgal/Polyhedron_3/resources/shader_without_light.v"))
-            {
-                std::cerr<<"adding vertex shader FAILED"<<std::endl;
-            }
-            if(!program->addShaderFromSourceFile(QOpenGLShader::Fragment,":/cgal/Polyhedron_3/resources/shader_without_light.f"))
-            {
-                std::cerr<<"adding fragment shader FAILED"<<std::endl;
-            }
-            program->bindAttributeLocation("colors", 1);
-            program->link();
-            d->shader_programs[PROGRAM_WITHOUT_LIGHT] = program;
-            return program;
-        }
-        break;
-    case PROGRAM_NO_SELECTION:
-        if( d->shader_programs[PROGRAM_NO_SELECTION])
-        {
-            return d->shader_programs[PROGRAM_NO_SELECTION];
-        }
-        else
-        {
-            QOpenGLShaderProgram *program = new QOpenGLShaderProgram(viewer);
-            if(!program->addShaderFromSourceFile(QOpenGLShader::Vertex,":/cgal/Polyhedron_3/resources/shader_without_light.v"))
-            {
-                std::cerr<<"adding vertex shader FAILED"<<std::endl;
-            }
-            if(!program->addShaderFromSourceFile(QOpenGLShader::Fragment,":/cgal/Polyhedron_3/resources/shader_no_light_no_selection.f"))
-            {
-                std::cerr<<"adding fragment shader FAILED"<<std::endl;
-            }
-            program->bindAttributeLocation("colors", 1);
-            program->link();
-            d->shader_programs[PROGRAM_NO_SELECTION] = program;
-            return program;
-        }
-        break;
-    case PROGRAM_WITH_TEXTURE:
-        if( d->shader_programs[PROGRAM_WITH_TEXTURE])
-        {
-            return d->shader_programs[PROGRAM_WITH_TEXTURE];
-        }
-        else
-        {
-            QOpenGLShaderProgram *program = new QOpenGLShaderProgram(viewer);
-            if(!program->addShaderFromSourceFile(QOpenGLShader::Vertex,":/cgal/Polyhedron_3/resources/shader_with_texture.v"))
-            {
-                std::cerr<<"adding vertex shader FAILED"<<std::endl;
-            }
-            if(!program->addShaderFromSourceFile(QOpenGLShader::Fragment,":/cgal/Polyhedron_3/resources/shader_with_texture.f"))
-            {
-                std::cerr<<"adding fragment shader FAILED"<<std::endl;
-            }
-            program->bindAttributeLocation("color_facets", 1);
-            program->link();
-            d->shader_programs[PROGRAM_WITH_TEXTURE] = program;
-            return program;
-        }
-        break;
-    case PROGRAM_PLANE_TWO_FACES:
-        if(d->shader_programs[PROGRAM_PLANE_TWO_FACES])
-        {
-            return d->shader_programs[PROGRAM_PLANE_TWO_FACES];
-        }
-
-        else
-        {
-
-            QOpenGLShaderProgram *program = new QOpenGLShaderProgram(viewer);
-            if(!program->addShaderFromSourceFile(QOpenGLShader::Vertex,":/cgal/Polyhedron_3/resources/shader_without_light.v"))
-            {
-                std::cerr<<"adding vertex shader FAILED"<<std::endl;
-            }
-            if(!program->addShaderFromSourceFile(QOpenGLShader::Fragment,":/cgal/Polyhedron_3/resources/shader_plane_two_faces.f"))
-            {
-                std::cerr<<"adding fragment shader FAILED"<<std::endl;
-            }
-            program->link();
-            d->shader_programs[PROGRAM_PLANE_TWO_FACES] = program;
-            return program;
-        }
-        break;
-
-    case PROGRAM_WITH_TEXTURED_EDGES:
-        if( d->shader_programs[PROGRAM_WITH_TEXTURED_EDGES])
-        {
-            return d->shader_programs[PROGRAM_WITH_TEXTURED_EDGES];
-        }
-        else
-        {
-            QOpenGLShaderProgram *program = new QOpenGLShaderProgram(viewer);
-            if(!program->addShaderFromSourceFile(QOpenGLShader::Vertex,":/cgal/Polyhedron_3/resources/shader_with_textured_edges.v" ))
-            {
-                std::cerr<<"adding vertex shader FAILED"<<std::endl;
-            }
-            if(!program->addShaderFromSourceFile(QOpenGLShader::Fragment,":/cgal/Polyhedron_3/resources/shader_with_textured_edges.f" ))
-            {
-                std::cerr<<"adding fragment shader FAILED"<<std::endl;
-            }
-            program->bindAttributeLocation("color_lines", 1);
-            program->link();
-            d->shader_programs[PROGRAM_WITH_TEXTURED_EDGES] = program;
-            return program;
-
-        }
-        break;
-    case PROGRAM_INSTANCED:
-        if( d->shader_programs[PROGRAM_INSTANCED])
-        {
-            return d->shader_programs[PROGRAM_INSTANCED];
-        }
-        else
-        {
-            QOpenGLShaderProgram *program = new QOpenGLShaderProgram(viewer);
-            if(!program->addShaderFromSourceFile(QOpenGLShader::Vertex,":/cgal/Polyhedron_3/resources/shader_instanced.v" ))
-            {
-                std::cerr<<"adding vertex shader FAILED"<<std::endl;
-            }
-            if(!program->addShaderFromSourceFile(QOpenGLShader::Fragment,":/cgal/Polyhedron_3/resources/shader_with_light.f" ))
-            {
-                std::cerr<<"adding fragment shader FAILED"<<std::endl;
-            }
-            program->bindAttributeLocation("colors", 1);
-            program->link();
-            d->shader_programs[PROGRAM_INSTANCED] = program;
-            return program;
-
-        }
-        break;
-    case PROGRAM_INSTANCED_WIRE:
-        if( d->shader_programs[PROGRAM_INSTANCED_WIRE])
-        {
-            return d->shader_programs[PROGRAM_INSTANCED_WIRE];
-        }
-        else
-        {
-            QOpenGLShaderProgram *program = new QOpenGLShaderProgram(viewer);
-            if(!program->addShaderFromSourceFile(QOpenGLShader::Vertex,":/cgal/Polyhedron_3/resources/shader_instanced.v" ))
-            {
-                std::cerr<<"adding vertex shader FAILED"<<std::endl;
-            }
-            if(!program->addShaderFromSourceFile(QOpenGLShader::Fragment,":/cgal/Polyhedron_3/resources/shader_without_light.f" ))
-            {
-                std::cerr<<"adding fragment shader FAILED"<<std::endl;
-            }
-            program->bindAttributeLocation("colors", 1);
-            program->link();
-            d->shader_programs[PROGRAM_INSTANCED_WIRE] = program;
-            return program;
-
-        }
-        break;
-    default:
-        std::cerr<<"ERROR : Program not found."<<std::endl;
-        return 0;
-    }
-}
-void Viewer::wheelEvent(QWheelEvent* e)
-{
-    if(e->modifiers().testFlag(Qt::ShiftModifier))
-    {
-        double delta = e->delta();
-        if(delta>0)
-        {
-            camera()->setZNearCoefficient(camera()->zNearCoefficient() * 1.01);
-        }
-        else
-            camera()->setZNearCoefficient(camera()->zNearCoefficient() / 1.01);
-        updateGL();
-    }
-    else
-        QGLViewer::wheelEvent(e);
-}
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Viewer.h b/3rdparty/CGAL-4.8/demo/Polyhedron/Viewer.h
deleted file mode 100644
index 3435ebe..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/Viewer.h
+++ /dev/null
@@ -1,138 +0,0 @@
-//! \file Viewer.h
-
-#ifndef VIEWER_H
-#define VIEWER_H
-
-#include <CGAL/Three/Viewer_config.h>
-#include <QOpenGLBuffer>
-#include <QOpenGLVertexArrayObject>
-#include <QOpenGLShaderProgram>
-#include <CGAL/Three/Viewer_interface.h>
-
-#include <QGLViewer/qglviewer.h>
-#include <QPoint>
-
-// forward declarations
-class QWidget;
-namespace CGAL{
-namespace Three{
-class Scene_draw_interface;
-}
-}
-class QMouseEvent;
-class QKeyEvent;
-
-class Viewer_impl;
-//!The viewer class. Deals with all the openGL rendering and the mouse/keyboard events.
-class VIEWER_EXPORT Viewer : public CGAL::Three::Viewer_interface {
-
-  Q_OBJECT
-
-public:
-  Viewer(QWidget * parent, bool antialiasing = false);
-  ~Viewer();
-
-  // overload several QGLViewer virtual functions
-  //! Deprecated and does nothing.
-  void draw();
-  //!This step happens after draw(). It is here that the axis system is
-  //!displayed.
-  void drawVisualHints();
-  //! Deprecated. Does the same as draw().
-  void fastDraw();
-  //! Initializes the OpenGL functions and sets the backGround color.
-  void initializeGL();
-  //! Deprecated and does nothing.
-  void drawWithNames();
-  /*! Uses the parameter pixel's coordinates to get the corresponding point
-   * in the World frame. If this point is found, emits selectedPoint, selected,
-   * and selectionRay signals.
-   */
-  void postSelection(const QPoint&);
-  //! Sets the picking matrix to allow the picking.
-  void beginSelection(const QPoint &point);
-  //! Sets the pick matrix to Identity once the picking is done.
-  void endSelection(const QPoint &point);
-  //! Sets the scene for the viewer.
-  void setScene(CGAL::Three::Scene_draw_interface* scene);
-  //! @returns the antialiasing state.
-  bool antiAliasing() const;
-  //! @returns the fastDrawing state.
-  bool inFastDrawing() const;
-  //! Implementation of `Viewer_interface::attrib_buffers()`
-  void attrib_buffers(int program_name) const;
-  //! Implementation of `Viewer_interface::getShaderProgram()`
-  QOpenGLShaderProgram* getShaderProgram(int name) const;
-
-public Q_SLOTS:
-  //! Sets the antialiasing to true or false.
-  void setAntiAliasing(bool b);
-  //! If b is true, facets will be ligted from both internal and external sides.
-  //! If b is false, only the side that is exposed to the light source will be lighted.
-  void setTwoSides(bool b);
-  //! If b is true, some items are displayed in a simplified version when moving the camera.
-  //! If b is false, items display is never altered, even when moving.
-  void setFastDrawing(bool b);
-  //! Make the camera turn around.
-  void turnCameraBy180Degres();
-  //! @returns a QString containing the position and orientation of the camera.
-  QString dumpCameraCoordinates();
-  //!Moves the camera to the new coordinates (position and orientation) through an animation.
-  bool moveCameraToCoordinates(QString, 
-                               float animation_duration = 0.5f);
-
-protected:
-  //! Holds useful data to draw the axis system
-  struct AxisData
-  {
-      std::vector<float> *vertices;
-      std::vector<float> *normals;
-      std::vector<float> *colors;
-  };
-  //! The buffers used to draw the axis system
-  QOpenGLBuffer buffers[3];
-  //! The VAO used to draw the axis system
-  QOpenGLVertexArrayObject vao[1];
-  //! The rendering program used to draw the axis system
-  QOpenGLShaderProgram rendering_program;
-  //! Holds the vertices data for the axis system
-  std::vector<float> v_Axis;
-  //! Holds the normals data for the axis system
-  std::vector<float> n_Axis;
-  //! Holds the color data for the axis system
-  std::vector<float> c_Axis;
-  //! Decides if the axis system must be drawn or not
-  bool axis_are_displayed;
-  //!Defines the behaviour for the mouse press events
-  void mousePressEvent(QMouseEvent*);
-  void wheelEvent(QWheelEvent *);
-  //!Defines the behaviour for the key press events
-  void keyPressEvent(QKeyEvent*);
-  /*! \brief Encapsulates the pickMatrix.
-  * Source code of gluPickMatrix slightly modified : instead of multiplying the current matrix by this value,
-  * sets the viewer's pickMatrix_ so that the drawing area is only around the cursor. This is because since CGAL 4.7,
-  * the drawing system changed to use shaders, and these need this value. pickMatrix_ is passed to the shaders in
-  * Scene_item::attrib_buffers(CGAL::Three::Viewer_interface* viewer, int program_name).*/
-  void pickMatrix(GLdouble x, GLdouble y, GLdouble width, GLdouble height,
-                  GLint viewport[4]);
-  /*!
-   * \brief makeArrow creates an arrow and stores it in a struct of vectors.
-   * \param R the radius of the arrow.
-   * \param prec the precision of the quadric. The lower this value is, the higher precision you get.
-   * It can be any int between 1 and 360.
-   * \param from the starting point of the arrow.
-   * \param to the destination point of the arrow (the pointed extremity).
-   * \param color the RGB color of the arrow.
-   * \param data the struct of std::vector that will contain the results.
-   */
-
-  void makeArrow(double R, int prec, qglviewer::Vec from, qglviewer::Vec to, qglviewer::Vec color, AxisData &data);
-  void resizeGL(int w, int h);
-
-
-protected:
-  Viewer_impl* d;
-  double prev_radius;
-}; // end class Viewer
-
-#endif // VIEWER_H
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/include/CGAL/Triangulation_file_input.h b/3rdparty/CGAL-4.8/demo/Polyhedron/include/CGAL/Triangulation_file_input.h
deleted file mode 100644
index af08e43..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/include/CGAL/Triangulation_file_input.h
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright (c) 1997-2010  INRIA Sophia-Antipolis (France).
-// Copyright (c) 2011       GeometryFactory Sarl (France)
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you may redistribute it under
-// the terms of the Q Public License version 1.0.
-// See the file LICENSE.QPL distributed with CGAL.
-//
-// Licensees holding a valid commercial license may use this file in
-// accordance with the commercial license agreement provided with the software.
-//
-// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-// Author(s)     : Laurent Rineau
-//
-
-// Adapted from operator>>(std::istream&, Triangulation_3&) from
-// <CGAL/Triangulation_3.h>
-
-#ifndef CGAL_TRIANGULATION_FILE_INPUT_3_H
-#define CGAL_TRIANGULATION_FILE_INPUT_3_H
-
-#include <CGAL/basic.h>
-
-namespace CGAL {
-
-template <typename Tr1, 
-          typename Tr2,
-          typename Update_vertex,
-          typename Update_cell>
-std::istream& file_input(std::istream& is, Tr2 &tr,
-                         Update_vertex update_vertex = Update_vertex(),
-                         Update_cell update_cell = Update_cell())
-  // reads
-  // the dimension
-  // the number of finite vertices
-  // the non combinatorial information on vertices (point, etc)
-  // the number of cells
-  // the cells by the indices of their vertices in the preceding list
-  // of vertices, plus the non combinatorial information on each cell
-  // the neighbors of each cell by their index in the preceding list of cells
-  // when dimension < 3 : the same with faces of maximal dimension
-{
-  typedef Tr2 Triangulation;
-  typedef typename Triangulation::Vertex_handle  Vertex_handle;
-  typedef typename Triangulation::Cell_handle    Cell_handle;
-
-  typedef typename Tr1::Vertex Vertex1;
-  typedef typename Tr1::Cell Cell1;
-
-  tr.clear();
-  tr.tds().cells().clear();
-
-  std::size_t n;
-  int d;
-  if(is_ascii(is))
-     is >> d >> n;
-  else {
-    read(is, d);
-    read(is, n);
-  }
-  if(!is) return is;
-  tr.tds().set_dimension(d);
-
-  std::map< std::size_t, Vertex_handle > V;
-  V[0] = tr.infinite_vertex();
-  // the infinite vertex is numbered 0
-
-  for (std::size_t i=1; i <= n; i++) {
-    V[i] = tr.tds().create_vertex();
-    Vertex1 v;
-    if(!(is >> v)) return is;
-    if(!update_vertex(v, *V[i])) { 
-      is.setstate(std::ios_base::failbit);
-      return is;
-    }
-  }
-
-  std::map< std::size_t, Cell_handle > C;
-
-  std::size_t m;
-  tr.tds().read_cells(is, V, m, C);
-
-  for (std::size_t j=0 ; j < m; j++) {
-    Cell1 c;
-    if(!(is >> c)) return is;
-    if(!update_cell(c, *(C[j]))) {
-      is.setstate(std::ios_base::failbit);
-      return is;
-    }
-  }
-
-  CGAL_triangulation_assertion( tr.is_valid(false) );
-  return is;
-}
-
-} // end namespace CGAL
-
-#endif // CGAL_TRIANGULATION_FILE_INPUT_3_H
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/include/Point_set_3.h b/3rdparty/CGAL-4.8/demo/Polyhedron/include/Point_set_3.h
deleted file mode 100644
index beef321..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/include/Point_set_3.h
+++ /dev/null
@@ -1,323 +0,0 @@
-// Author: Laurent Saboret, Nader Salman, Gael Guennebaud
-
-#ifndef POINT_SET_3_H
-#define POINT_SET_3_H
-
-#include <CGAL/property_map.h>
-#include <CGAL/Min_sphere_of_spheres_d.h>
-#include <CGAL/Min_sphere_of_points_d_traits_3.h>
-#include <CGAL/Min_sphere_of_spheres_d_traits_3.h>
-#include <UI_point_3.h>
-#include <algorithm>
-#include <vector>
-# include <CGAL/gl.h>
-
-/// The Point_set_3 class is array of points + normals of type
-/// Point_with_normal_3<Gt> (in fact
-/// UI_point_3 to support a selection flag and an optional radius).
-/// It provides:
-/// - accessors: points and normals iterators, property maps
-/// - OpenGL rendering
-/// - bounding box
-///
-/// CAUTION:
-/// - User is responsible to call invalidate_bounds() after adding, moving or removing points.
-/// - Selecting points changes the order of the points in the
-///   container. If selection is *not* empty, it becomes invalid after
-///   adding, moving or removing points, user is reponsible to call
-///   unselect_all() in those cases.
-///
-/// @heading Parameters:
-/// @param Gt       Geometric traits class.
-
-template <class Gt>
-class Point_set_3 : public std::vector<UI_point_3<Gt> >
-{
-// Private types
-private:
-
-  // Base class
-  typedef std::vector<UI_point_3<Gt> > Base;
-
-// Public types
-public:
-
-  // Repeat base class' types
-  /// @cond SKIP_IN_MANUAL
-  typedef typename Base::iterator iterator;
-  typedef typename Base::const_iterator const_iterator;
-
-  using Base::erase;
-
-  /// @endcond
-
-  // Classic CGAL geometric types
-  typedef Gt  Geom_traits; ///< Geometric traits class.
-  typedef typename Geom_traits::FT FT;
-  typedef typename Geom_traits::Point_3 Point;  ///< typedef to Geom_traits::Point_3
-  typedef typename Geom_traits::Vector_3 Vector; ///< typedef to Geom_traits::Vector_3
-  typedef typename Geom_traits::Iso_cuboid_3 Iso_cuboid;
-  typedef typename Geom_traits::Sphere_3 Sphere;
-
-  /// Type of points in Point_set_3
-  typedef UI_point_3<Gt> UI_point; ///< Position + normal + selection flag
-  // Its superclass:
-  typedef typename UI_point::Point_with_normal Point_with_normal; ///< Position + normal
-
-// Data members
-private:
-
-  // Indicate if m_barycenter, m_bounding_box, m_bounding_sphere and
-  // m_diameter_standard_deviation below are valid.
-  mutable bool m_bounding_box_is_valid;
-
-  mutable Iso_cuboid m_bounding_box; // point set's bounding box
-  mutable Sphere m_bounding_sphere; // point set's bounding sphere
-  mutable Point m_barycenter; // point set's barycenter
-  mutable FT m_diameter_standard_deviation; // point set's standard deviation
-
-  std::size_t m_nb_selected; // handle selection
-
-  bool m_radii_are_uptodate;
-
-  // Assignment operator not implemented and declared private to make
-  // sure nobody uses the default one without knowing it
-  Point_set_3& operator= (const Point_set_3&)
-  {
-    return *this;
-  }
-
-  
-// Public methods
-public:
-
-  /// Default constructor.
-  Point_set_3()
-  {
-    m_nb_selected = 0;
-    m_bounding_box_is_valid = false;
-    m_radii_are_uptodate = false;
-  }
-
-  // copy constructor 
-  Point_set_3 (const Point_set_3& p) : Base (p)
-  {
-    m_bounding_box_is_valid = p.m_bounding_box_is_valid;
-    m_bounding_box = p.m_bounding_box;
-    m_barycenter = p.m_barycenter;
-    m_diameter_standard_deviation = p.m_diameter_standard_deviation;
-
-    m_nb_selected = p.nb_selected_points ();
-    
-    m_radii_are_uptodate = p.m_radii_are_uptodate;
-  }
-
-  // Repeat base class' public methods used below
-  /// @cond SKIP_IN_MANUAL
-  using Base::begin;
-  using Base::end;
-  using Base::size;
-  /// @endcond
-
-  iterator first_selected() { return end() - m_nb_selected; }
-  const_iterator first_selected() const { return end () - m_nb_selected; }
-  void set_first_selected(iterator it)
-  {
-    m_nb_selected = static_cast<std::size_t>(std::distance (it, end()));
-  }
-
-  // Test if point is selected
-  bool is_selected(const_iterator it) const
-  {
-    return static_cast<std::size_t>(std::distance (it, end())) <= m_nb_selected;
-  }
-
-  /// Gets the number of selected points.
-  std::size_t nb_selected_points() const
-  {
-    return m_nb_selected;
-  }
-
-  /// Mark a point as selected/not selected.
-  void select(iterator it, bool selected = true)
-  {
-    bool currently = is_selected (it);
-    iterator first = first_selected();
-    if (currently && !selected)
-      {
-        std::swap (*it, *first);
-        -- m_nb_selected;
-      }
-    else if (!currently && selected)
-      {
-        std::swap (*it, *first);
-        ++ m_nb_selected;
-      }
-  }
-
-  void select_all()
-  {
-    m_nb_selected = size ();
-  }
-  void unselect_all()
-  {
-    m_nb_selected = 0;
-  }
-
-
-  // Invert selection
-  void invert_selection()
-  {
-    iterator sel = end() - 1;
-    iterator unsel = begin();
-
-    iterator first = first_selected();
-
-    while (sel != first - 1 && unsel != first)
-      std::swap (*(sel --), *(unsel ++));
-    
-    m_nb_selected = size() - m_nb_selected;
-  }
-
-  /// Deletes selected points.
-  void delete_selection()
-  {
-    // Deletes selected points using erase-remove idiom
-    erase (first_selected(), end ());
-
-    // after erase(), use Scott Meyer's "swap trick" to trim excess capacity
-    Point_set_3(*this).swap(*this);
-    m_nb_selected = 0;
-    invalidate_bounds();
-  }
-
-  /// Gets the bounding box.
-  Iso_cuboid bounding_box() const
-  {
-    if (!m_bounding_box_is_valid)
-      update_bounds();
-
-    return m_bounding_box;
-  }
-
-  /// Gets bounding sphere.
-  Sphere bounding_sphere() const
-  {
-    if (!m_bounding_box_is_valid)
-      update_bounds();
-
-    return m_bounding_sphere;
-  }
-
-  /// Gets points barycenter.
-  Point barycenter() const
-  {
-    if (!m_bounding_box_is_valid)
-      update_bounds();
-
-    return m_barycenter;
-  }
-
-  /// Gets the standard deviation of the distance to barycenter.
-  FT diameter_standard_deviation() const
-  {
-    if (!m_bounding_box_is_valid)
-      update_bounds();
-
-    return m_diameter_standard_deviation;
-  }
-
-  // Gets the region of interest, ignoring the outliers.
-  // This method is used to define the OpenGL arcball sphere.
-  Sphere region_of_interest() const
-  {
-    if (!m_bounding_box_is_valid)
-      update_bounds();
-
-    // A good candidate is a sphere containing the dense region of the point cloud:
-    // - center point is barycenter
-    // - Radius is 2 * standard deviation
-    float radius = 2.f * (float)m_diameter_standard_deviation;
-    return Sphere(m_barycenter, radius*radius);
-  }
-
-  /// Update barycenter, bounding box, bounding sphere and standard deviation.
-  /// User is responsible to call invalidate_bounds() after adding, moving or removing points.
-  void invalidate_bounds()
-  {
-    m_bounding_box_is_valid = false;
-  }
-
-
-
-
-  
-  bool are_radii_uptodate() const { return m_radii_are_uptodate; }
-  void set_radii_uptodate(bool /*on*/) { m_radii_are_uptodate = false; }
-
-// Private methods:
-private:
-
-  /// Recompute barycenter, bounding box, bounding sphere and standard deviation.
-  void update_bounds() const
-  {
-    if (begin() == end())
-      return;
-
-    // Update bounding box and barycenter.
-    // TODO: we should use the functions in PCA component instead.
-    FT xmin,xmax,ymin,ymax,zmin,zmax;
-    xmin = ymin = zmin =  1e38;
-    xmax = ymax = zmax = -1e38;
-    Vector v = CGAL::NULL_VECTOR;
-    FT norm = 0;
-    for (const_iterator it = begin(); it != end(); it++)
-    {
-      const Point& p = *it;
-
-      // update bbox
-      xmin = (std::min)(p.x(),xmin);
-      ymin = (std::min)(p.y(),ymin);
-      zmin = (std::min)(p.z(),zmin);
-      xmax = (std::max)(p.x(),xmax);
-      ymax = (std::max)(p.y(),ymax);
-      zmax = (std::max)(p.z(),zmax);
-
-      // update barycenter
-      v = v + (p - CGAL::ORIGIN);
-      norm += 1;
-    }
-    //
-    Point p(xmin,ymin,zmin);
-    Point q(xmax,ymax,zmax);
-    m_bounding_box = Iso_cuboid(p,q);
-    //
-    m_barycenter = CGAL::ORIGIN + v / norm;
-
-    // Computes bounding sphere
-    typedef CGAL::Min_sphere_of_points_d_traits_3<Gt,FT> Traits;
-    typedef CGAL::Min_sphere_of_spheres_d<Traits> Min_sphere;
-
-    Min_sphere ms(begin(),end());
-
-    typename Min_sphere::Cartesian_const_iterator coord = ms.center_cartesian_begin();
-    FT cx = *coord++;
-    FT cy = *coord++;
-    FT cz = *coord++;
-    m_bounding_sphere = Sphere(Point(cx,cy,cz), ms.radius()*ms.radius());
-
-    // Computes standard deviation of the distance to barycenter
-    typename Geom_traits::Compute_squared_distance_3 sqd;
-    FT sq_radius = 0;
-    for (const_iterator it = begin(); it != end(); it++)
-        sq_radius += sqd(*it, m_barycenter);
-    sq_radius /= FT(size());
-    m_diameter_standard_deviation = CGAL::sqrt(sq_radius);
-
-    m_bounding_box_is_valid = true;
-  }
-
-}; // end of class Point_set_3
-
-
-#endif // POINT_SET_3_H
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/shader_c3t3.f b/3rdparty/CGAL-4.8/demo/Polyhedron/resources/shader_c3t3.f
deleted file mode 100644
index 7713ae2..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/shader_c3t3.f
+++ /dev/null
@@ -1,41 +0,0 @@
-#version 120
-varying highp vec4 color;
-varying highp vec4 fP; 
-varying highp vec3 fN; 
-uniform highp vec4 light_pos;  
-uniform highp vec4 light_diff; 
-uniform highp vec4 light_spec; 
-uniform highp vec4 light_amb;  
-uniform highp float spec_power ; 
-uniform int is_two_side; 
-uniform bool is_selected;
-void main(void) {
- if(color.w>0)
- {
-    highp vec3 L = light_pos.xyz - fP.xyz; 
-    highp vec3 V = -fP.xyz; 
-    highp vec3 N; 
-    if(fN == highp vec3(0.0,0.0,0.0))
-        N = highp vec3(0.0,0.0,0.0); 
-    else 
-        N = normalize(fN); 
-    L = normalize(L); 
-    V = normalize(V); 
-    highp vec3 R = reflect(-L, N); 
-    vec4 diffuse; 
-    if(is_two_side == 1) 
-        diffuse = abs(dot(N,L)) * light_diff * color; 
-    else 
-        diffuse = max(dot(N,L), 0.0) * light_diff * color; 
-    highp vec4 specular = pow(max(dot(R,V), 0.0), spec_power) * light_spec; 
-    vec4 ret_color = vec4((color*light_amb).xyz + diffuse.xyz + specular.xyz,1); 
-    if(is_selected)
-        gl_FragColor = vec4(ret_color.r+70.0/255.0, ret_color.g+70.0/255.0, ret_color.b+70.0/255.0, 1.0);
-    else
-        gl_FragColor = ret_color;
- }
- else
-   discard;
-}
-
-
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/shader_c3t3.v b/3rdparty/CGAL-4.8/demo/Polyhedron/resources/shader_c3t3.v
deleted file mode 100644
index eece539..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/shader_c3t3.v
+++ /dev/null
@@ -1,21 +0,0 @@
-#version 120
-attribute highp vec4 vertex;
-attribute highp vec3 normals;
-attribute highp vec3 colors;
-uniform highp mat4 mvp_matrix;
-uniform highp mat4 mv_matrix; 
-uniform highp vec4 cutplane;
-varying highp vec4 fP; 
-varying highp vec3 fN; 
-varying highp vec4 color; 
-void main(void)
-{
-  if(vertex.x * cutplane.x  + vertex.y * cutplane.y  + vertex.z * cutplane.z  +  cutplane.w > 0){
-    color = vec4(0.0, 1.0, 1.0, 0.0);
-                                                                                             } else {
-    color = vec4(colors, 1.0);
-  }
-  fP = mv_matrix * vertex; 
-  fN = mat3(mv_matrix)* normals; 
-  gl_Position = mvp_matrix * vertex; 
-}
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/shader_c3t3_edges.f b/3rdparty/CGAL-4.8/demo/Polyhedron/resources/shader_c3t3_edges.f
deleted file mode 100644
index 8a19a0a..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/shader_c3t3_edges.f
+++ /dev/null
@@ -1,9 +0,0 @@
-#version 120
-varying highp vec4 color;
-void main(void) 
-{ 
-  if(color.w>0)
-    gl_FragColor = vec4(0,0,0,1.0); 
-  else
-    discard;
-}  
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/shader_c3t3_edges.v b/3rdparty/CGAL-4.8/demo/Polyhedron/resources/shader_c3t3_edges.v
deleted file mode 100644
index 6823cd5..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/shader_c3t3_edges.v
+++ /dev/null
@@ -1,19 +0,0 @@
-#version 120
-attribute highp vec4 vertex;
-attribute highp vec3 colors;
-uniform highp mat4 mvp_matrix;
-uniform highp vec4 cutplane;
-varying highp vec4 color; 
-void main(void)
-{
-  if(vertex.x * cutplane.x  + vertex.y * cutplane.y  + vertex.z * cutplane.z  +  cutplane.w > 0)
-  {
-    color = vec4(0.0, 1.0, 1.0, 0.0);
-  } 
-  else 
-  {
-    color = vec4(colors, 1.0);
-  }
-  gl_Position = mvp_matrix * vertex;
-}
- 
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/shader_with_light.f b/3rdparty/CGAL-4.8/demo/Polyhedron/resources/shader_with_light.f
deleted file mode 100644
index badf68a..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/shader_with_light.f
+++ /dev/null
@@ -1,36 +0,0 @@
-#version 120
-varying highp vec4 color;
-varying highp vec4 fP; 
-varying highp vec3 fN; 
-uniform highp vec4 light_pos;  
-uniform highp vec4 light_diff; 
-uniform highp vec4 light_spec; 
-uniform highp vec4 light_amb;  
-uniform highp float spec_power ; 
-uniform int is_two_side; 
-uniform bool is_selected;
-void main(void) {
-   highp vec3 L = light_pos.xyz - fP.xyz; 
-   highp vec3 V = -fP.xyz; 
-   highp vec3 N; 
-   if(fN == highp vec3(0.0,0.0,0.0))
-       N = highp vec3(0.0,0.0,0.0); 
-   else 
-       N = normalize(fN); 
-   L = normalize(L); 
-   V = normalize(V); 
-   highp vec3 R = reflect(-L, N); 
-  vec4 diffuse; 
-   if(is_two_side == 1) 
-       diffuse = abs(dot(N,L)) * light_diff * color; 
-   else 
-       diffuse = max(dot(N,L), 0.0) * light_diff * color; 
-   highp vec4 specular = pow(max(dot(R,V), 0.0), spec_power) * light_spec; 
-   vec4 ret_color = vec4((color*light_amb).xyz + diffuse.xyz + specular.xyz,1); 
-   if(is_selected)
-       gl_FragColor = vec4(ret_color.r+70.0/255.0, ret_color.g+70.0/255.0, ret_color.b+70.0/255.0, 1.0);
-   else
-       gl_FragColor = ret_color;
-}
-
-
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/shader_without_light.f b/3rdparty/CGAL-4.8/demo/Polyhedron/resources/shader_without_light.f
deleted file mode 100644
index 639530d..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/shader_without_light.f
+++ /dev/null
@@ -1,10 +0,0 @@
-#version 120
-varying highp vec4 color;
-uniform bool is_selected;
-void main(void) 
-{ 
-if(is_selected)
-  gl_FragColor = vec4(0,0,0,1.0); 
-else
-  gl_FragColor = color; 
-}  
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron_IO/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Polyhedron_IO/CMakeLists.txt
deleted file mode 100644
index 1e91cdc..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyhedron_IO/CMakeLists.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Polyhedron_IO_Demo )
-
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  create_single_source_cgal_program( "geomview_demo.cpp" )
-  create_single_source_cgal_program( "viewpoint2off.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/demo/Polyline_simplification_2/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Polyline_simplification_2/CMakeLists.txt
deleted file mode 100644
index 808265d..0000000
--- a/3rdparty/CGAL-4.8/demo/Polyline_simplification_2/CMakeLists.txt
+++ /dev/null
@@ -1,51 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-project (Polyline_simplification_2)
-
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-find_package(CGAL COMPONENTS Qt5)
-
-include(${CGAL_USE_FILE})
-
-find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Widgets Svg)
-
-include_directories (BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/include)
-include_directories (BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../../include )
-include_directories (BEFORE ${CMAKE_CURRENT_BINARY_DIR})
-
-if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
-
-add_definitions(-DQT_NO_KEYWORDS)
-
-
-# UI files (Qt Designer files)
-qt5_wrap_ui( CDT_UI_FILES Polyline_simplification_2.ui )
-
-# qrc files (resources files, that contain icons, at least)
-qt5_add_resources ( CDT_RESOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/Polyline_simplification_2.qrc )
-
-# use the Qt MOC preprocessor on classes that derives from QObject
-qt5_generate_moc( ${CMAKE_CURRENT_SOURCE_DIR}/Polyline_simplification_2.cpp Polyline_simplification_2.moc )
-
-# The executable itself.
-add_executable  ( Polyline_simplification_2 ${CMAKE_CURRENT_SOURCE_DIR}/Polyline_simplification_2.cpp Polyline_simplification_2.moc ${CDT_UI_FILES} ${CDT_RESOURCE_FILES} )
-
-qt5_use_modules(Polyline_simplification_2 Xml Script OpenGL Widgets Svg)
-# Link with Qt libraries
-target_link_libraries( Polyline_simplification_2 ${QT_LIBRARIES} )
-
-# Link with CGAL
-target_link_libraries( Polyline_simplification_2 ${CGAL_LIBRARIES}  ${CGAL_3RD_PARTY_LIBRARIES})
-
-add_to_cached_list( CGAL_EXECUTABLE_TARGETS Polyline_simplification_2 )
-
-else()
-
-  message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
-
-endif()
diff --git a/3rdparty/CGAL-4.8/demo/Principal_component_analysis/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Principal_component_analysis/CMakeLists.txt
deleted file mode 100644
index 60863f5..0000000
--- a/3rdparty/CGAL-4.8/demo/Principal_component_analysis/CMakeLists.txt
+++ /dev/null
@@ -1,87 +0,0 @@
-# This is the CMake script for compiling the PCA demo.
-
-project( PCA_demo )
-
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-foreach(INCDIR ../../include ../../../STL_Extension/include ../../../GraphicsView/include ../../../filtered_kernel/include )
-  if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${INCDIR}")
-    include_directories (BEFORE "${CMAKE_CURRENT_SOURCE_DIR}/${INCDIR}")
-  endif()
-endforeach()
-
-include_directories( ./ )
-
-# Find CGAL and CGAL Qt5
-find_package(CGAL COMPONENTS Qt5)
-include( ${CGAL_USE_FILE} )
-
-# Find Qt5 itself
-find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL)
-
-# Find OpenGL
-find_package(OpenGL)
-
-# Find QGLViewer
-if(Qt5_FOUND)
-  find_package(QGLViewer )
-endif(Qt5_FOUND)
-
-if(CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
-
-  include_directories ( ${QGLVIEWER_INCLUDE_DIR} )
-
-  qt5_wrap_ui( UI_FILES MainWindow.ui )
-
-  include(AddFileDependencies)
-
-  qt5_generate_moc( "MainWindow.h" "${CMAKE_CURRENT_BINARY_DIR}/MainWindow_moc.cpp" )
-  add_file_dependencies( MainWindow_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/MainWindow.h" )
-
-  qt5_generate_moc( "Viewer.h" "${CMAKE_CURRENT_BINARY_DIR}/Viewer_moc.cpp" )
-  add_file_dependencies( Viewer_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/Viewer.h" )
-
-  qt5_add_resources ( RESOURCE_FILES PCA_demo.qrc )
-
-    add_file_dependencies( PCA_demo.cpp "${CMAKE_CURRENT_BINARY_DIR}/MainWindow_moc.cpp"
-                                         "${CMAKE_CURRENT_BINARY_DIR}/Viewer_moc.cpp" )
-    add_executable  ( PCA_demo PCA_demo.cpp ${UI_FILES} ${RESOURCE_FILES} )
-    qt5_use_modules( PCA_demo Xml Script OpenGL)
-  # Link with Qt libraries
-  target_link_libraries( PCA_demo ${QT_LIBRARIES} )
-
-  # Link with CGAL
-  target_link_libraries( PCA_demo ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} )
-
-  # Link with libQGLViewer, OpenGL
-  target_link_libraries( PCA_demo ${QGLVIEWER_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} )
-
-  add_to_cached_list( CGAL_EXECUTABLE_TARGETS PCA_demo )
-
-
-else (CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
-
-  set(PCA_MISSING_DEPS "")
-
-  if(NOT CGAL_Qt5_FOUND)
-    set(PCA_MISSING_DEPS "the CGAL Qt5 library, ${PCA_MISSING_DEPS}")
-  endif()
-
-  if(NOT Qt5_FOUND)
-    set(PCA_MISSING_DEPS "Qt5, ${PCA_MISSING_DEPS}")
-  endif()
-
-  if(NOT OPENGL_FOUND)
-    set(PCA_MISSING_DEPS "OpenGL, ${PCA_MISSING_DEPS}")
-  endif()
-
-  if(NOT QGLVIEWER_FOUND)
-    set(PCA_MISSING_DEPS "QGLViewer, ${PCA_MISSING_DEPS}")
-  endif()
-
-  message(STATUS "NOTICE: This demo requires ${PCA_MISSING_DEPS} and will not be compiled.")
-
-endif (CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/CMakeLists.txt
deleted file mode 100644
index 0377456..0000000
--- a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/CMakeLists.txt
+++ /dev/null
@@ -1,59 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-project (Segment_voronoi_2)
-
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-find_package(CGAL COMPONENTS Qt5 Core)
-
-include(${CGAL_USE_FILE})
-
-set( QT_USE_QTXML    TRUE )
-set( QT_USE_QTMAIN   TRUE )
-set( QT_USE_QTSCRIPT  TRUE )
-set( QT_USE_QTOPENGL  TRUE )
-
-
-find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
-include_directories (BEFORE ../../include)
-include_directories (BEFORE ./include)
-
-
-if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
-
-add_definitions(-DQT_NO_KEYWORDS)
-
-#--------------------------------
-# The "Segment Voronoi" demo: Segment_voronoi_2
-#--------------------------------
-# UI files (Qt Designer files)
-qt5_wrap_ui( CDT_UI_FILES Segment_voronoi_2.ui )
-
-# qrc files (resources files, that contain icons, at least)
-qt5_add_resources ( CDT_RESOURCE_FILES ./Segment_voronoi_2.qrc )
-
-# use the Qt MOC preprocessor on classes that derives from QObject
-qt5_generate_moc( "Segment_voronoi_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Segment_voronoi_2.moc" )
-
-# The executable itself.
-add_executable  ( Segment_voronoi_2 Segment_voronoi_2.cpp Segment_voronoi_2.moc ${CDT_UI_FILES} ${CDT_RESOURCE_FILES} )
-
-qt5_use_modules(Segment_voronoi_2 Xml Script OpenGL Svg)
-
-add_to_cached_list( CGAL_EXECUTABLE_TARGETS Segment_voronoi_2 )
-
-# Link with Qt libraries
-target_link_libraries( Segment_voronoi_2 ${QT_LIBRARIES} )
-# Link with CGAL
-target_link_libraries( Segment_voronoi_2 ${CGAL_LIBRARIES}  ${CGAL_3RD_PARTY_LIBRARIES})
-
-
-else()
-
-  message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
-
-endif()
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/CMakeLists.txt
deleted file mode 100644
index dd00fe2..0000000
--- a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/CMakeLists.txt
+++ /dev/null
@@ -1,59 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-project (Segment_voronoi_linf_2)
-
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-find_package(CGAL COMPONENTS Qt5 Core)
-
-include(${CGAL_USE_FILE})
-
-set( QT_USE_QTXML    TRUE )
-set( QT_USE_QTMAIN   TRUE )
-set( QT_USE_QTSCRIPT  TRUE )
-set( QT_USE_QTOPENGL  TRUE )
-
-
-find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
-include_directories (BEFORE ../../include)
-include_directories (BEFORE ./include)
-
-
-if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
-
-add_definitions(-DQT_NO_KEYWORDS)
-
-#--------------------------------
-# The "Segment Voronoi Linf" demo: Segment_voronoi_linf_2
-#--------------------------------
-# UI files (Qt Designer files)
-qt5_wrap_ui( CDT_UI_FILES Segment_voronoi_2.ui )
-
-# qrc files (resources files, that contain icons, at least)
-qt5_add_resources ( CDT_RESOURCE_FILES ./Segment_voronoi_2.qrc )
-
-# use the Qt MOC preprocessor on classes that derives from QObject
-qt5_generate_moc( "Segment_voronoi_linf_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Segment_voronoi_linf_2.moc" )
-
-# The executable itself.
-add_executable  ( Segment_voronoi_linf_2 Segment_voronoi_linf_2.cpp Segment_voronoi_linf_2.moc ${CDT_UI_FILES} ${CDT_RESOURCE_FILES} )
-
-qt5_use_modules(Segment_voronoi_linf_2 Xml Script OpenGL Svg)
-
-add_to_cached_list( CGAL_EXECUTABLE_TARGETS Segment_voronoi_linf_2 )
-
-# Link with Qt libraries
-target_link_libraries( Segment_voronoi_linf_2 ${QT_LIBRARIES} )
-# Link with CGAL
-target_link_libraries( Segment_voronoi_linf_2 ${CGAL_LIBRARIES}  ${CGAL_3RD_PARTY_LIBRARIES})
-
-
-else()
-
-  message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
-
-endif()
diff --git a/3rdparty/CGAL-4.8/demo/Snap_rounding_2/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Snap_rounding_2/CMakeLists.txt
deleted file mode 100644
index da969e5..0000000
--- a/3rdparty/CGAL-4.8/demo/Snap_rounding_2/CMakeLists.txt
+++ /dev/null
@@ -1,50 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-project (Snap_rounding_2_demo)
-
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-find_package(CGAL COMPONENTS Qt5)
-
-include(${CGAL_USE_FILE})
-
-find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
-include_directories (BEFORE ../../include)
-include_directories (BEFORE ../../../Snap_rounding_2/include)
-
-
-if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
-
-add_definitions(-DQT_NO_KEYWORDS)
-
-#--------------------------------
-# UI files (Qt Designer files)
-qt5_wrap_ui( DT_UI_FILES Snap_rounding_2.ui )
-
-# qrc files (resources files, that contain icons, at least)
-qt5_add_resources ( DT_RESOURCE_FILES ./Snap_rounding_2.qrc )
-
-# use the Qt MOC preprocessor on classes that derives from QObject
-qt5_generate_moc( Snap_rounding_2.cpp Snap_rounding_2.moc )
-
-# The executable itself.
-add_executable  ( Snap_rounding_2 Snap_rounding_2.cpp Snap_rounding_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} )
-
-qt5_use_modules(Snap_rounding_2 Xml Script OpenGL Svg)
-
-add_to_cached_list( CGAL_EXECUTABLE_TARGETS Snap_rounding_2 )
-
-# Link with Qt libraries
-target_link_libraries( Snap_rounding_2 ${QT_LIBRARIES} )
-# Link with CGAL
-target_link_libraries( Snap_rounding_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES})
-
-else()
-
-  message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
-
-endif()
diff --git a/3rdparty/CGAL-4.8/demo/Spatial_searching_2/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Spatial_searching_2/CMakeLists.txt
deleted file mode 100644
index f23272a..0000000
--- a/3rdparty/CGAL-4.8/demo/Spatial_searching_2/CMakeLists.txt
+++ /dev/null
@@ -1,52 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-project (Spatial_searchingDemo)
-
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-find_package(CGAL COMPONENTS Qt5)
-
-include(${CGAL_USE_FILE})
-
-find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
-
-include_directories (BEFORE ../../include)
-include_directories (BEFORE ../../../Spatial_searching/include)
-
-if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
-
-  add_definitions(-DQT_NO_KEYWORDS)
-
-  #--------------------------------
-  # Demo: Spatial_searching_2
-  #--------------------------------
-  # UI files (Qt Designer files)
-  qt5_wrap_ui( DT_UI_FILES Spatial_searching_2.ui )
-
-  # qrc files (resources files, that contain icons, at least)
-  qt5_add_resources ( DT_RESOURCE_FILES ./Spatial_searching_2.qrc )
-
-  # use the Qt MOC preprocessor on classes that derives from QObject
-  qt5_generate_moc( Spatial_searching_2.cpp Spatial_searching_2.moc )
-
-  # The executable itself.
-  add_executable  ( Spatial_searching_2 Spatial_searching_2.cpp Spatial_searching_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} )
-
-  qt5_use_modules(Spatial_searching_2 Xml Script OpenGL Svg)
-
-  add_to_cached_list( CGAL_EXECUTABLE_TARGETS Spatial_searching_2 )
-
-  # Link with Qt libraries
-  target_link_libraries( Spatial_searching_2 ${QT_LIBRARIES} )
-  # And with CGAL libraries
-  target_link_libraries( Spatial_searching_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} )
-
-else()
-
-  message(STATUS "NOTICE: This demo requires CGAL, and Qt5, and will not be compiled.")
-
-endif()
diff --git a/3rdparty/CGAL-4.8/demo/Stream_lines_2/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Stream_lines_2/CMakeLists.txt
deleted file mode 100644
index 7c35248..0000000
--- a/3rdparty/CGAL-4.8/demo/Stream_lines_2/CMakeLists.txt
+++ /dev/null
@@ -1,51 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-project (Stream_lines_2_demo)
-
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-find_package(CGAL COMPONENTS Qt5)
-
-include(${CGAL_USE_FILE})
-
-
-find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
-include_directories (BEFORE ../../include)
-
-
-if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
-
-add_definitions(-DQT_NO_KEYWORDS)
-
-
-#--------------------------------
-# UI files (Qt Designer files)
-qt5_wrap_ui( DT_UI_FILES Stream_lines_2.ui )
-
-# qrc files (resources files, that contain icons, at least)
-qt5_add_resources ( DT_RESOURCE_FILES ./Stream_lines_2.qrc )
-
-# use the Qt MOC preprocessor on classes that derives from QObject
-qt5_generate_moc( Stream_lines_2.cpp Stream_lines_2.moc )
-
-# The executable itself.
-add_executable  ( Stream_lines_2 Stream_lines_2.cpp Stream_lines_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} )
-
-qt5_use_modules(Stream_lines_2 Xml Script OpenGL Svg)
-
-add_to_cached_list( CGAL_EXECUTABLE_TARGETS Stream_lines_2 )
-
-# Link with Qt libraries
-target_link_libraries( Stream_lines_2 ${QT_LIBRARIES} )
-# Link with CGAL
-target_link_libraries( Stream_lines_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES})
-
-else()
-
-  message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
-
-endif()
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesh_deformation/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Surface_mesh_deformation/CMakeLists.txt
deleted file mode 100644
index b5ae259..0000000
--- a/3rdparty/CGAL-4.8/demo/Surface_mesh_deformation/CMakeLists.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Surface_mesh_deformation_demo )
-
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  find_package(Eigen3 3.1.91) #(requires 3.2.0 or greater)
-  if (EIGEN3_FOUND)
-    include( ${EIGEN3_USE_FILE} )
-    include( CGAL_CreateSingleSourceCGALProgram )
-
-    include_directories (BEFORE "../../include")
-    create_single_source_cgal_program( "deform_mesh_for_botsch08_format.cpp" )
-
-  else()
-    message(STATUS "NOTICE: This program requires the Eigen library, version 3.2 or later and will not be compiled.")
-  endif()
-else()
-  
-    message(STATUS "NOTICE: This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Surface_mesher/CMakeLists.txt
deleted file mode 100644
index d2008d5..0000000
--- a/3rdparty/CGAL-4.8/demo/Surface_mesher/CMakeLists.txt
+++ /dev/null
@@ -1,128 +0,0 @@
-set ( prj Surface_mesher )
-
-project ( ${prj} )
-
-# Find includes in corresponding build directories
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-# Instruct CMake to run moc automatically when needed.
-set(CMAKE_AUTOMOC ON)
-
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-set(PACKAGE_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../..)
-
-# Add several CGAL packages to the include and link paths,
-# if they lie in ${PACKAGE_ROOT}/.
-foreach(INC_DIR ${PACKAGE_ROOT}/include ${PACKAGE_ROOT}/../Mesh_2/include ${PACKAGE_ROOT}/../Data_structure_for_queries_3/include ${PACKAGE_ROOT}/../Marching_cube/include ${PACKAGE_ROOT}/../CGAL_ImageIO/include ${PACKAGE_ROOT}/../GraphicsView/include)
-  if (EXISTS ${INC_DIR})
-    include_directories (BEFORE ${INC_DIR})
-  endif()
-endforeach()
-foreach(LIB_DIR ${PACKAGE_ROOT}/../CGAL_ImageIO/src/CGAL_ImageIO ${PACKAGE_ROOT}/../GraphicsView/src/CGALQt5)
-  if (EXISTS ${LIB_DIR})
-    link_directories (${LIB_DIR})
-  endif()
-endforeach()
-
-include_directories( ./ )
-
-# QGLViwer needs Qt5 configured with QtOpenGL and QtXml support
-
-set( QT_USE_QTOPENGL TRUE )
-set( QT_USE_QTXML    TRUE )
-set( QT_USE_QTMAIN   TRUE )
-
-find_package(CGAL COMPONENTS ImageIO Qt5)
-if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND CGAL_ImageIO_FOUND)
-
-  add_definitions(-DQT_NO_KEYWORDS)
-  include( ${CGAL_USE_FILE} )
-
-  find_package(Qt5 QUIET COMPONENTS OpenGL Xml Svg)
-  find_package(QGLViewer )
-  find_package(OpenGL    )
-  
-  if ( QGLVIEWER_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND OPENGL_GLU_FOUND )
-
-        
-    include_directories( ${QGLVIEWER_INCLUDE_DIR} )
-    add_definitions(${QGLVIEWER_DEFINITIONS})
-
-    set( sources Raw_image_dialog.cpp colorlisteditor.cpp values_list.cpp mainwindow.cpp Surface_mesher.cpp viewer.cpp volume.cpp )
-
-    if(EXISTS ${PACKAGE_ROOT}/../Marching_cube)
-      option(SURFACE_MESH_DEMO_USE_MARCHING_CUBE "Embed a marching cube implementation in the Surface Mesh demo." ON)
-      mark_as_advanced(SURFACE_MESH_DEMO_USE_MARCHING_CUBE)
-    endif()
-    
-    if(EXISTS ${PACKAGE_ROOT}/include/CGAL/Polyhedral_surface_3.h)
-      option(SURFACE_MESH_DEMO_WITH_POLYHEDRAL_SURFACE "Compile the support for polyhedral surfaces." OFF)
-      mark_as_advanced(SURFACE_MESH_DEMO_WITH_POLYHEDRAL_SURFACE)
-    endif()
-
-    option(SURFACE_MESH_DEMO_VERBOSE "Set this option if you want the Surface Mesh demo to display messages on standard output." OFF)
-    mark_as_advanced(SURFACE_MESH_DEMO_VERBOSE)
-
-    if(SURFACE_MESH_DEMO_VERBOSE)
-      add_definitions(-DCGAL_SURFACE_MESHER_VERBOSE)
-    endif()
-
-    if(SURFACE_MESH_DEMO_WITH_POLYHEDRAL_SURFACE)
-      set(sources ${sources} polyhedral_surface.cpp)
-    else(SURFACE_MESH_DEMO_WITH_POLYHEDRAL_SURFACE)
-      add_definitions(-DCGAL_DO_NOT_USE_POLYHEDRAL_SURFACE)
-    endif(SURFACE_MESH_DEMO_WITH_POLYHEDRAL_SURFACE)
-
-    if(SURFACE_MESH_DEMO_USE_MARCHING_CUBE)
-      set(sources ${sources} ${PACKAGE_ROOT}/../Marching_cube/src/mc/ply.c)
-      add_definitions(-DCGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE)
-    endif()
-    
-
-    qt5_generate_moc( "surface.h" "${CMAKE_CURRENT_BINARY_DIR}/moc_surface.cpp" )
-
-    set( sources ${sources} moc_surface.cpp)
-    
-    qt5_wrap_ui( uis ui/values_list.ui ui/mainwindow.ui ui/optionsdialog.ui ui/raw_image.ui )
-    
-    qt5_add_resources( qrc_sources values_list.qrc surface_mesher.qrc  )
-
-    add_executable  ( ${prj}  ${sources} ${uis} ${qrc_sources} )
-
-    qt5_use_modules(${prj} OpenGL Xml Svg)
-    
-    add_to_cached_list( CGAL_EXECUTABLE_TARGETS ${prj} )
-    
-    set(VTK_LIBS "")
-    find_package(VTK QUIET COMPONENTS vtkImagingGeneral  vtkIOImage NO_MODULE)
-    if(VTK_FOUND)
-      include(${VTK_USE_FILE})
-      if ("${VTK_VERSION_MAJOR}" GREATER "5")
-        message(STATUS "VTK found")
-        add_definitions(-DCGAL_USE_VTK)
-        set(VTK_LIBS vtkImagingGeneral vtkIOImage)
-      else()
-        message(STATUS "Vtk must be at least Rel 6")
-      endif()
-    else()
-      message(STATUS "For reading Dicom files install VTK first")
-    endif()
-
-    # Link the executable to CGAL and third-party libraries
-    target_link_libraries( ${prj} ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES})    
-    
-    target_link_libraries( ${prj} ${QT_LIBRARIES} ${QGLVIEWER_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${VTK_LIBS})
-    
-  else( QGLVIEWER_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND OPENGL_GLU_FOUND )
-    message(STATUS "NOTICE: This demo needs libQGLViewer, and will not be compiled.")
-  endif( QGLVIEWER_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND OPENGL_GLU_FOUND )
-else(CGAL_FOUND AND CGAL_Qt5_FOUND AND CGAL_ImageIO_FOUND)
-  if(RUNNING_CGAL_AUTO_TEST)
-    # Just to avoid a warning from CMake if that variable is set on the command line...
-  endif()
-
-  message(STATUS "NOTICE: This demo needs Qt5, and will not be compiled.")
-endif(CGAL_FOUND AND CGAL_Qt5_FOUND AND CGAL_ImageIO_FOUND)
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/Surface_mesher.cpp b/3rdparty/CGAL-4.8/demo/Surface_mesher/Surface_mesher.cpp
deleted file mode 100644
index ab73dab..0000000
--- a/3rdparty/CGAL-4.8/demo/Surface_mesher/Surface_mesher.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-#include "mainwindow.h"
-#include <QApplication>
-#include <iostream>
-
-int main(int argc, char** argv)
-{
-  QApplication application(argc,argv);
-
-  application.setOrganizationDomain("geometryfactory.com");
-  application.setOrganizationName("GeometryFactory");
-  application.setApplicationName("Surface mesher Qt5 demo");
-
-  MainWindow w;
-
-  if(argc>1)
-    w.surface_open(argv[1]);
-
-  w.show();
-
-  return application.exec();
-  std::cerr << "Exit\n";
-}
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/volume.cpp b/3rdparty/CGAL-4.8/demo/Surface_mesher/volume.cpp
deleted file mode 100644
index 244d876..0000000
--- a/3rdparty/CGAL-4.8/demo/Surface_mesher/volume.cpp
+++ /dev/null
@@ -1,1550 +0,0 @@
-#include <CGAL/basic.h>
-
-#include "volume.h"
-
-#include  <algorithm> // std::sort
-#include <boost/shared_ptr.hpp>
-#include <fstream>
-#include <boost/foreach.hpp>
-
-#include <CGAL/Bbox_3.h>
-
-#include "viewer.h"
-#include "mainwindow.h"
-#include "values_list.h"
-
-#include "File_XT.h" // format XT from Total/ELF
-
-#include <QApplication>
-#include <QFileDialog>
-#include <QAction>
-#include <QStatusBar>
-#include <QDoubleSpinBox>
-#include <QMessageBox>
-#include <QTreeWidgetItem>
-#include <QTime>
-#include <QColor>
-#include <QColorDialog>
-#include <QSettings>
-#include <QUrl>
-#include "Raw_image_dialog.h"
-#include <CGAL/Surface_mesher/Standard_criteria.h>
-// #include <CGAL/Surface_mesher/Image_surface_oracle_3.h>
-#include <CGAL/Surface_mesher/Implicit_surface_oracle_3.h>
-#include <CGAL/Surface_mesher/Vertices_on_the_same_psc_element_criterion.h>
-#include <CGAL/IO/Complex_2_in_triangulation_3_file_writer.h>
-#include <CGAL/make_surface_mesh.h>
-#include <CGAL/Qt/debug.h>
-
-struct Threshold : public std::unary_function<FT, unsigned char> {
-  double isovalue;
-  bool is_identity;
-
-  Threshold(double isovalue) : isovalue(isovalue), is_identity(false) {}
-
-  result_type operator()(FT value)
-  {
-    if(is_identity)
-      return static_cast<unsigned char>(value);
-    else if(value >=  isovalue)
-      return 1;
-    else
-      return 0;
-  }
-};
-
-class Classify_from_isovalue_list :
-  public std::unary_function<FT, unsigned char> 
-{
-  typedef std::pair<FT, result_type> Isovalue;
-  typedef std::vector<Isovalue> Isovalues;
-  boost::shared_ptr<Isovalues> isovalues;
-  bool is_identity;
-
-  struct Sort_isovalues : std::binary_function<Isovalue, Isovalue, bool> 
-  {
-    bool operator()(const Isovalue& isoval1, const Isovalue& isoval2)
-    {
-      return isoval1.first < isoval2.first;
-    }
-  };
-public:
-  Classify_from_isovalue_list(Values_list * list)
-    : is_identity(false)
-  {
-    isovalues = boost::shared_ptr<Isovalues>(new Isovalues(list->numberOfValues()));
-    for(int i = 0, nbs = list->numberOfValues(); i < nbs; ++i )
-      (*isovalues)[i] = std::make_pair(list->value(i), i);
-    std::sort(isovalues->begin(), isovalues->end(), Sort_isovalues());
-  }
-
-  void set_identity(bool b) {
-    is_identity = b;
-  }
-
-  result_type operator()(FT value)
-  {
-    if(is_identity) {
-      return static_cast<unsigned char>(value);
-    }
-    result_type result = 0;
-//     std::cerr << "isovalues: ";
-    for(int i = 1, end = static_cast<int>(isovalues->size()); i <= end; ++i)
-    {
-//       std::cerr << (*isovalues)[i-1] << ", ";
-      if(value >= (*isovalues)[i-1].first &&
-         i >= result)
-      {
-        result = i;
-      }
-    }
-//     if(result>1)
-//       std::cerr << "result = "  << (int)result << "/" << list->numberOfValues() << std::endl;
-//     else
-//       std::cerr << std::endl;
-    if(result>0)
-      return (*isovalues)[result-1].second + 1;
-    else
-      return 0;
-  }
-};
-
-class Generate_surface_identifiers :
-  public std::binary_function<Classify_from_isovalue_list::result_type,
-                              Classify_from_isovalue_list::result_type,
-                              const QTreeWidgetItem*>
-{
-  Values_list* list;
-  bool labellized;
-
-public:
-  Generate_surface_identifiers(Values_list* list)
-    : list(list), labellized(false) {};
-
-  void set_labellized_image(bool b)
-  {
-    labellized = b;
-  }
-
-  result_type operator()(const Classify_from_isovalue_list::result_type& a,
-                         const Classify_from_isovalue_list::result_type& b)
-  {
-    if(labellized)
-      return list->search((std::max)(a, b));
-    else
-      return list->item((std::min)(a, b));
-  }
-};
-
-// class Classify_from_isovalue_list :
-//   public std::unary_function<FT, const QTreeWidgetItem*> 
-// {
-//   typedef std::pair<FT, result_type> Isovalue;
-//   typedef std::vector<Isovalue> Isovalues;
-//   boost::shared_ptr<Isovalues> isovalues;
-
-//   struct Sort_isovalues : std::binary_function<Isovalue, Isovalue, bool> 
-//   {
-//     bool operator()(const Isovalue& isoval1, const Isovalue& isoval2)
-//     {
-//       return isoval1.first < isoval2.first;
-//     }
-//   };
-// public:
-//   Classify_from_isovalue_list(Isovalues_list * list)
-//   {
-//     isovalues = boost::shared_ptr<Isovalues>(new Isovalues(list->numberOfIsoValues()));
-//     for(int i = 0, nbs = list->numberOfIsoValues(); i < nbs; ++i )
-//       (*isovalues)[i] = std::make_pair(list->isovalue(i), list->item(i));
-//     std::sort(isovalues->begin(), isovalues->end(), Sort_isovalues());
-//   }
-
-//   result_type operator()(FT value)
-//   {
-//     int result = 0;
-// //     std::cerr << "isovalues: ";
-//     for(int i = 1, end = isovalues->size(); i <= end; ++i)
-//     {
-// //       std::cerr << (*isovalues)[i-1] << ", ";
-//       if(value >= (*isovalues)[i-1].first &&
-//          i >= result)
-//       {
-//         result = i;
-//       }
-//     }
-//     if(result>1)
-//       std::cerr << boost::format("result = %1%/%2%\n") % result % isovalues->size();
-//     if(result>0)
-//       return (*isovalues)[result-1].second;
-//     else
-//       return 0;
-//   }
-// };
-Volume::Volume(MainWindow* mw) : 
-  Surface(mw),
-  m_sm_angle(30),
-  m_sm_radius(0),
-  m_sm_distance(0),
-  m_relative_precision(0.000000001),
-  m_view_surface(false),
-  m_triangulation_color(QColor(Qt::green)),
-  m_inverse_normals(false),
-  two_sides(false),
-  del(),
-  c2t3(del),
-  mw(mw),
-  lists_draw_surface(),
-  lists_draw_surface_is_valid(false),
-#ifdef CGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE
-  list_draw_marching_cube(0),
-  list_draw_marching_cube_is_valid(false),
-  lists_draw_surface_mc(),
-#endif // CGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE
-  m_view_mc(false)
-{
-  spinBox_radius_bound = mw->findChild<QDoubleSpinBox*>("spinBox_radius_bound");
-  spinBox_distance_bound = mw->findChild<QDoubleSpinBox*>("spinBox_distance_bound");
-  Q_ASSERT_X(spinBox_radius_bound && spinBox_distance_bound,
-             "Volume::Volume()", "Cannot find spinboxes!");
-
-  values_list = mw->values;
-
-  connect(spinBox_radius_bound, SIGNAL(valueChanged(double)),
-          this, SLOT(set_radius_bound(double)));
-  connect(spinBox_distance_bound, SIGNAL(valueChanged(double)),
-          this, SLOT(set_distance_bound(double)));
-
-  connect(mw->actionSurface_mesher, SIGNAL(triggered()),
-          this, SLOT(display_surface_mesher_result()));
-
-  connect(mw->actionInverse_normals, SIGNAL(toggled(bool)),
-          this, SLOT(set_inverse_normals(bool)));
-  m_inverse_normals = mw->actionInverse_normals->isChecked();
-
-  connect(mw->actionDisplay_front_and_back, SIGNAL(toggled(bool)),
-          this, SLOT(set_two_sides(bool)));
-  two_sides = mw->actionDisplay_front_and_back->isChecked();
-
-  connect(mw->actionDraw_triangles_edges, SIGNAL(toggled(bool)),
-          this, SLOT(set_draw_triangles_edges(bool)));
-  draw_triangles_edges = mw->actionDraw_triangles_edges->isChecked();
-
-  connect(mw->actionUse_Gouraud_shading, SIGNAL(toggled(bool)),
-          this, SLOT(set_use_gouraud(bool)));
-  use_gouraud = mw->actionUse_Gouraud_shading->isChecked();
-
-  connect(mw->actionShow_the_image_bounding_box, SIGNAL(toggled(bool)),
-          this, SLOT(set_show_bbox(bool)));
-  show_bbox = mw->actionShow_the_image_bounding_box->isChecked();
-
-  connect(mw->actionShow_triangulation, SIGNAL(toggled(bool)),
-          this, SLOT(set_draw_triangulation(bool)));
-  m_draw_triangulation = mw->actionShow_triangulation->isChecked();
-
-  connect(mw->actionTriangulation_edges_color, SIGNAL(triggered()),
-          this, SLOT(set_triangulation_edges_color()));
-
-  connect(this, SIGNAL(new_bounding_box(double, double, double, double, double, double)),
-          mw->viewer, SLOT(interpolateToFitBoundingBox(double, double, double, double, double, double)));
-
-  connect(values_list, SIGNAL(values_changed()),
-          this, SLOT(changed_parameters()));
-  connect(values_list, SIGNAL(changed()),
-          mw->viewer, SLOT(updateGL()));
-  connect(this, SIGNAL(changed()),
-          this, SLOT(check_can_export_off()));
-
-  connect(mw->labellizedRadioButton, SIGNAL(toggled(bool)),
-	  this, SLOT(labellizedToogled(bool)));
-
-  mw->actionExport_surface_mesh_to_OFF->setEnabled(false);
-  connect(mw->actionExport_surface_mesh_to_OFF, SIGNAL(triggered()),
-          this, SLOT(export_off()));
-
-  connect(mw->actionSave, SIGNAL(triggered()),
-          this, SLOT(save_image_to_inr()));
-
-#ifdef CGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE
-  connect(mw->actionMarching_cubes, SIGNAL(triggered()),
-          this, SLOT(display_marchin_cube()));
-#endif
-}
-
-void Volume::set_inverse_normals(const bool b) {
-  m_inverse_normals = b;
-
-  list_draw_marching_cube = 0; // Invalidate the display list for the
-                               // marching cube. See gl_draw_marchingcube()
-                               // for an explanation.
-
-  Q_EMIT changed();
-}
-
-void Volume::set_two_sides(const bool b) {
-  two_sides = b;
-  Q_EMIT changed();
-}
-
-void Volume::set_draw_triangles_edges(const bool b) {
-  draw_triangles_edges = b;
-  Q_EMIT changed();
-}
-
-void Volume::set_draw_triangulation(const bool b) {
-  m_draw_triangulation = b;
-  Q_EMIT changed();
-}
-
-void Volume::set_triangulation_edges_color() {
-  const QColor color = QColorDialog::getColor(m_triangulation_color, mw);
-  if (color.isValid()) {
-    m_triangulation_color = color;
-    Q_EMIT changed();
-  }
-}
-
-void Volume::set_use_gouraud(const bool b) {
-  use_gouraud = b;
-  Q_EMIT changed();
-}
-
-void Volume::set_show_bbox(const bool b) {
-  show_bbox = b;
-  Q_EMIT changed();
-}
-
-void Volume::only_in()
-{
-  mw->show_only("volume");
-#ifndef CGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE
-  mw->actionMarching_cubes->setVisible(false);
-#endif
-}
-
-#ifdef CGAL_USE_VTK
-
-#include <CGAL/read_vtk_image_data.h>
-
-#include <vtkImageData.h>
-#include <vtkDICOMImageReader.h>
-#include <vtkImageReader.h>
-#include <vtkImageGaussianSmooth.h>
-#include <vtkDemandDrivenPipeline.h>
-
-Volume::~Volume()
-{
-  if(vtk_reader) vtk_reader->Delete();
-  if(vtk_image) vtk_image->Delete();
-  if(dicom_reader) dicom_reader->Delete();
-  if(executive) executive->Delete();
-  if(smoother) smoother->Delete();
-}
-
-bool Volume::opendir(const QString& dirname) 
-{
-  bool result = true;
-  if(!fileinfo.isReadable())
-  {
-    QMessageBox::warning(mw, mw->windowTitle(),
-                         tr("Cannot read directory <tt>%1</tt>!").arg(dirname));
-    status_message(tr("Opening of directory %1 failed!").arg(dirname));
-    result = false;
-  }
-  else
-  {
-    dicom_reader = vtkDICOMImageReader::New();
-    dicom_reader->SetDirectoryName(dirname.toUtf8());
-
-    executive =
-      vtkDemandDrivenPipeline::SafeDownCast(dicom_reader->GetExecutive());
-    if (executive)
-    {
-      executive->SetReleaseDataFlag(0, 0); // where 0 is the port index
-    }
-
-    smoother = vtkImageGaussianSmooth::New();
-    smoother->SetStandardDeviations(1., 1., 1.);
-    smoother->SetInputConnection(dicom_reader->GetOutputPort());
-    smoother->Update();
-    vtk_image = smoother->GetOutput();
-    vtk_image->Print(std::cerr);
-    m_image = CGAL::read_vtk_image_data(vtk_image);
-    if(m_image.image() == 0)
-    {
-      QMessageBox::warning(mw, mw->windowTitle(),
-                           tr("Error with file <tt>%1/</tt>:\nunknown file format!").arg(dirname));
-      status_message(tr("Opening of file %1/ failed!").arg(dirname));
-      result = false;
-    }
-    else
-    {
-      status_message(tr("File %1/ successfully opened.").arg(dirname));
-      finish_open();
-      result = true;
-    }
-    // if(executive) executive->Delete();
-    // dicom_reader->Delete();
-    // smoother->Delete();
-  }
-  return result;
-}
-
-bool Volume::open_vtk(const QString& filename)
-{
-  only_in();
-
-  fileinfo.setFile(filename);
-
-  if(fileinfo.isDir())
-  {
-    return opendir(filename);
-  }
-
-  if(!fileinfo.isReadable())
-  {
-    QMessageBox::warning(mw, mw->windowTitle(),
-                         tr("Cannot read file <tt>%1</tt>!").arg(filename));
-    status_message(tr("Opening of file %1 failed!").arg(filename));
-    return false;
-  }
-  else
-  {
-    vtk_reader = vtkImageReader::New();
-    vtk_reader->SetFileName(filename.toUtf8());
-    vtk_reader->SetDataScalarTypeToUnsignedChar();
-    vtk_reader->SetDataExtent(0, 249, 0, 249, 0,  124);
-    vtk_reader->SetDataSpacing(1., 1., 1.);
-    vtk_reader->SetFileDimensionality(3);
-    vtk_reader->Update();
-    vtk_reader->Print(std::cerr);
-    vtk_image = vtk_reader->GetOutput();
-    vtk_image->Print(std::cerr);
-    m_image = CGAL::read_vtk_image_data(vtk_image);
-    if(m_image.image() == NULL)
-    {
-      QMessageBox::warning(mw, mw->windowTitle(),
-                           tr("Error with file <tt>%1</tt>:\nunknown file format!").arg(filename));
-      status_message(tr("Opening of file %1 failed!").arg(filename));
-      return false;
-    }
-    else
-    {
-      status_message(tr("File %1 successfully opened.").arg(filename));
-      finish_open();
-      return true;
-    }
-  }
-}
-
-// Total 3D images (XT format, that is the old Inrimage format, 1994.
-bool Volume::open_xt(const QString& filename)
-{
-  only_in();
-
-  fileinfo.setFile(filename);
-
-  if(fileinfo.isDir())
-  {
-    return false;
-  }
-
-  if(!fileinfo.isReadable())
-  {
-    QMessageBox::warning(mw, mw->windowTitle(),
-                         tr("Cannot read file <tt>%1</tt>!").arg(filename));
-    status_message(tr("Opening of file %1 failed!").arg(filename));
-    return false;
-  }
-  else
-  {
-    long dimx, dimy, dimz;
-    long word_dim;
-    long header_size;
-    const char* filename_stl = qPrintable(filename);
-    CGAL::Total::lire_longueur_entete(filename_stl, &header_size);
-    CGAL::Total::lire_nb_octet(filename_stl, &word_dim);
-    CGAL::Total::lire_longueur_trace(filename_stl, &dimx);
-    CGAL::Total::lire_nb_trace(filename_stl, &dimy);
-    CGAL::Total::lire_nb_plan(filename_stl, &dimz);
-
-    vtkImageReader* vtk_reader = vtkImageReader::New();
-    vtk_reader->SetFileName(filename_stl);
-    switch(word_dim) {
-    case 8:
-      vtk_reader->SetDataScalarTypeToUnsignedChar();
-      break;
-    case 16:
-      vtk_reader->SetDataScalarTypeToUnsignedShort();
-      break;
-    default:
-      return false;
-    }
-    vtk_reader->SetHeaderSize(header_size);
-    vtk_reader->SetDataExtent(1, dimx, 1, dimy, 1,  dimz);
-    vtk_reader->SetDataSpacing(1., 1., 1.);
-    vtk_reader->SetFileDimensionality(3);
-    vtk_reader->Update();
-    vtk_reader->Print(std::cerr);
-    vtkImageData* vtk_image = vtk_reader->GetOutput();
-    vtk_image->Print(std::cerr);
-    m_image = CGAL::read_vtk_image_data(vtk_image);
-    if(m_image.image() != NULL)
-    {
-      QMessageBox::warning(mw, mw->windowTitle(),
-                           tr("Error with file <tt>%1</tt>:\nunknown file format!").arg(filename));
-      status_message(tr("Opening of file %1 failed!").arg(filename));
-      return false;
-    }
-    else
-    {
-      status_message(tr("File %1 successfully opened.").arg(filename));
-      finish_open();
-    }
-    return true;
-  }
-}
-
-#else // CGAL_USE_VTK
-Volume::~Volume()
-{
-}
-
-bool Volume::opendir(const QString&)
-{
-  return false;
-}
-
-bool Volume::open_xt(const QString&)
-{
-  return false;
-}
-#endif // CGAL_USE_VTK
-
-bool Volume::open(const QString& filename)
-{
-  only_in();
-
-  fileinfo.setFile(filename);
-
-  if(fileinfo.isDir())
-  {
-    return opendir(filename);
-  }
-
-  if(!fileinfo.isReadable())
-  {
-    QMessageBox::warning(mw, mw->windowTitle(),
-                         tr("Cannot read file <tt>%1</tt>!").arg(filename));
-  }
-  else
-  {
-    if(m_image.read(filename.toStdString().c_str()))
-    {
-      status_message(tr("File %1 successfully opened.").arg(filename));
-      finish_open();
-      return true;
-    }
-    else if(open_xt(filename)) {
-      return true;
-    }
-    else 
-    {
-      QSettings settings;
-      settings.beginGroup(QUrl::toPercentEncoding(fileinfo.absoluteFilePath()));
-      if( settings.value("is_raw").toBool() &&
-	  m_image.read_raw(filename.toStdString().c_str(),
-			   settings.value("dim_x").toInt(),
-			   settings.value("dim_y").toInt(),
-			   settings.value("dim_z").toInt(),
-			   settings.value("spacing_x").toDouble(),
-			   settings.value("spacing_y").toDouble(),
-			   settings.value("spacing_z").toDouble(),
-			   settings.value("offset").toInt()) )
-      {
-	status_message(tr("File %1 successfully opened.").arg(filename));
-	finish_open();
-	return true;
-      }
-      else if(QMessageBox::warning(mw, mw->windowTitle(),
-				   tr("Error with file <tt>%1</tt>:\n"
-				      "unknown file format!\n"
-				      "\n"
-				      "Open it as a raw image?").arg(filename),
-				   QMessageBox::Yes|QMessageBox::No) == QMessageBox::Yes) 
-      {
-	Raw_image_dialog raw_dialog;
-	raw_dialog.label_file_size->setText(QString("%1 B").arg(fileinfo.size()));
-	if( raw_dialog.exec() && 
-	    m_image.read_raw(filename.toStdString().c_str(),
-			     raw_dialog.dim_x->value(),
-			     raw_dialog.dim_y->value(),
-			     raw_dialog.dim_z->value(),
-			     raw_dialog.spacing_x->value(),
-			     raw_dialog.spacing_y->value(),
-			     raw_dialog.spacing_z->value(),
-			     raw_dialog.offset->value()) )
-	{
-	  status_message(tr("File %1 successfully opened.").arg(filename));
-	  QSettings settings;
-	  settings.beginGroup(QUrl::toPercentEncoding(fileinfo.absoluteFilePath()));
-	  settings.setValue("is_raw", true);
-	  settings.setValue("dim_x", raw_dialog.dim_x->value());
-	  settings.setValue("dim_y", raw_dialog.dim_y->value());
-	  settings.setValue("dim_z", raw_dialog.dim_z->value());
-	  settings.setValue("spacing_x", raw_dialog.spacing_x->value());
-	  settings.setValue("spacing_y", raw_dialog.spacing_y->value());
-	  settings.setValue("spacing_z", raw_dialog.spacing_z->value());
-	  settings.setValue("offset", raw_dialog.offset->value());
-	  settings.endGroup();
-	  finish_open();
-	  return true;
-	}
-      }
-    }
-  }
-  status_message(tr("Opening of file %1 failed!").arg(filename));
-  return false;
-}
-
-void Volume::finish_open()
-{
-  m_image.finish_open();
-  mw->viewer->camera()->setSceneBoundingBox(qglviewer::Vec(0, 0, 0),
-                                            qglviewer::Vec(m_image.xmax(),
-                                                           m_image.ymax(),
-                                                           m_image.zmax()));
-
-  mw->viewer->showEntireScene();
-  values_list->load_values(fileinfo.absoluteFilePath());
-  load_image_settings(fileinfo.absoluteFilePath());
-  changed_parameters();
-  Q_EMIT changed();
-}
-
-void Volume::export_off()
-{
-  QFileDialog filedialog(mw, tr("Export surface to file"));
-  filedialog.setFileMode(QFileDialog::AnyFile);
-  
-  filedialog.setNameFilter(tr("OFF files (*.off);;"
-                              "All files (*)"));
-  
-  filedialog.setAcceptMode(QFileDialog::AcceptSave);
-  filedialog.setDefaultSuffix("off");
-  if(filedialog.exec())
-  {
-    const QString filename = filedialog.selectedFiles().front();
-    std::cerr << "Saving to file \"" << filename.toLocal8Bit().data() << "\"...";
-    std::ofstream out(filename.toUtf8());
-    CGAL::output_surface_facets_to_off(out, c2t3);
-    if(!out)
-    {
-      QMessageBox::warning(mw, mw->windowTitle(),
-                           tr("Export to the OFF file <tt>%1</tt> failed!").arg(filename));
-      status_message(tr("Export to the OFF file %1 failed!").arg(filename));
-      std::cerr << " failed!\n";
-    }
-    else
-    {
-      std::cerr << " done.\n";
-      status_message(tr("Successfull export to the OFF file %1.").arg(filename));
-    }
-  }
-}
-
-void Volume::save_image_to_inr()
-{
-  QFileDialog filedialog(mw, tr("Export image to Inrimage format"));
-  filedialog.setFileMode(QFileDialog::AnyFile);
-  
-  filedialog.setNameFilter(tr("Inrimage files (*.inr);;"
-                              "Compressed Inrimage files (*.inr.gz)"));
-
-
-  filedialog.setAcceptMode(QFileDialog::AcceptSave);
-  filedialog.setDefaultSuffix("inr.gz");
-  if(filedialog.exec())
-  {
-    const QString filename = filedialog.selectedFiles().front();
-    std::cerr << "Saving image to file \"" << filename.toLocal8Bit().data() << "\"...";
-    const int result = ::_writeImage(m_image.image(), filename.toUtf8());
-    if(result != ImageIO_NO_ERROR)
-    {
-      QMessageBox::warning(mw, mw->windowTitle(),
-                           tr("Export to the Inrimage file <tt>%1</tt> failed!").arg(filename));
-      status_message(tr("Export to the Inrimage file %1 failed!").arg(filename));
-      std::cerr << " failed!\n";
-    }
-    else
-    {
-      std::cerr << " done.\n";
-      status_message(tr("Successfull export to the Inrimage file %1.").arg(filename));
-    }
-  }
-}
-
-void Volume::check_can_export_off()
-{
-  mw->actionExport_surface_mesh_to_OFF->setEnabled(m_view_surface);// || m_view_mc);
-}
-
-void Volume::status_message(QString string)
-{
-  std::cerr << qPrintable(string) << std::endl;
-  mw->statusBar()->showMessage(string);
-}
-
-void Volume::busy() const 
-{
-  QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
-}
-
-void Volume::not_busy() const 
-{
-  QApplication::restoreOverrideCursor();
-}
-
-void Volume::display_marchin_cube()
-{
-#ifdef CGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE
-  if(m_surface_mc.empty())
-  {
-    QTime total_time;
-    total_time.start();
-
-    values_list->save_values(fileinfo.absoluteFilePath());
-
-    unsigned int nx = m_image.xdim();
-    unsigned int ny = m_image.ydim();
-    unsigned int nz = m_image.zdim();
-    if(nx * ny * nz == 0)
-    {
-      status_message("No volume loaded.");
-      return;
-    }
-
-    mc_timer.reset();
-    busy();
-    status_message("Marching cubes...");
-
-    mc_timer.start();
-    m_surface_mc.clear();
-
-    if(mc.ntrigs()!=0)
-      mc.clean_all();
-    mc.set_resolution(nx,ny,nz);
-    mc.init_all();
-    mc.set_ext_data(static_cast<unsigned char*>(m_image.image()->data));
-
-    nbs_of_mc_triangles.resize(values_list->numberOfValues());
-
-    for(int value_id = 0; 
-        value_id < values_list->numberOfValues();
-        ++value_id)
-    {
-      status_message(tr("Marching cubes, isovalue #%1...").arg(value_id));
-
-      // set data
-//       for(unsigned int i=0;i<nx;i++)
-//         for(unsigned int j=0;j<ny;j++)
-//           for(unsigned int k=0;k<nz;k++)
-//           {
-//             const float& value = m_image.value(i,j,k);
-//             mc.set_data(value,i,j,k);
-//           }
-      // compute scaling ratio
-      if(value_id > 0)
-        mc.init_temps();
-      mc.run(values_list->value(value_id),
-             m_image.vx(),
-             m_image.vy(),
-             m_image.vz());
-      mc.clean_temps();
-
-      std::vector<double> facets;
-      mc.get_facets(facets);
-
-      mc_timer.stop();
-      const unsigned int begin = value_id == 0 ? 0 : nbs_of_mc_triangles[value_id-1];
-      const unsigned int nbt = facets.size() / 9;
-      for(unsigned int i=begin;i<nbt;i++)
-      {
-        const Point a(facets[9*i],   facets[9*i+1], facets[9*i+2]);
-        const Point b(facets[9*i+3], facets[9*i+4], facets[9*i+5]);
-        const Point c(facets[9*i+6], facets[9*i+7], facets[9*i+8]);
-        const Triangle_3 t(a,b,c);
-        const Vector u = t[1] - t[0];
-        const Vector v = t[2] - t[0];
-        Vector n = CGAL::cross_product(u,v);
-        n = n / std::sqrt(n*n);
-        m_surface_mc.push_back(Facet(t,n,values_list->item(value_id)));
-      }
-      nbs_of_mc_triangles[value_id]=m_surface_mc.size();
-      mc_timer.start();
-    }
-    mc_timer.stop();
-    not_busy();
-    mc_total_time = total_time.elapsed();
-
-    // invalidate the display list
-    lists_draw_surface_mc_is_valid = false;
-    list_draw_marching_cube_is_valid = false;
-  }
-  CGAL::Bbox_3 bbox(0,0,0,0,0,0);
-  for(std::vector<Facet>::const_iterator
-        it = m_surface_mc.begin(), end = m_surface_mc.end();
-      it != end; ++it)
-  {
-    bbox = bbox + it->get<0>().bbox();
-  }
-
-  m_view_mc = true;
-  m_view_surface = false;
-  Q_EMIT changed();
-  if(!m_surface_mc.empty())
-  {
-    Q_EMIT new_bounding_box(bbox.xmin(),
-                          bbox.ymin(),
-                          bbox.zmin(),
-                          bbox.xmax(),
-                          bbox.ymax(),
-                          bbox.zmax());
-  }
-  status_message(tr("Marching cubes done. %2 facets in %1s (CPU time), total time is %3s.")
-                 .arg(mc_timer.time())
-                 .arg(m_surface_mc.size())
-                 .arg(mc_total_time/1000.));
-
-  save_image_settings(fileinfo.absoluteFilePath());
-#endif // CGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE
-}
-
-void Volume::display_surface_mesher_result()
-{
-  if(m_surface.empty() || // Either the surface is not computed.
-     m_view_surface) // Or it is computed and displayed, and one want
-                     // to recompute it.
-  {
-    QTime total_time;
-    total_time.start();
-
-    values_list->save_values(fileinfo.absoluteFilePath());
-
-    std::size_t nx = m_image.xdim();
-    std::size_t ny = m_image.ydim();
-    std::size_t nz = m_image.zdim();
-    if(nx * ny * nz == 0)
-    {
-      status_message("No volume loaded.");
-      return;
-    }
-
-    m_surface.clear();
-    sm_timer.reset();
-    busy();
-
-    status_message("Surface meshing...");
-
-    sm_timer.start();
-
-    c2t3.clear();
-    del.clear();
-    Sphere bounding_sphere(m_image.center(),m_image.radius()*m_image.radius());
-
-    Classify_from_isovalue_list classify(values_list);
-    Generate_surface_identifiers generate_ids(values_list);
-
-    m_image.set_interpolation(mw->interpolationCheckBox->isChecked());
-    if(mw->labellizedRadioButton->isChecked()) {
-      std::cerr << "Labellized image\n";
-    }
-    m_image.set_labellized(mw->labellizedRadioButton->isChecked());
-    classify.set_identity(mw->labellizedRadioButton->isChecked());
-    generate_ids.set_labellized_image(mw->labellizedRadioButton->isChecked());
-
-    // definition of the surface
-    Surface_3 surface(m_image, bounding_sphere, m_relative_precision);
-//     Threshold threshold(m_image.isovalue());
-
-    // surface mesh traits class
-    typedef CGAL::Surface_mesher::Implicit_surface_oracle_3<Kernel,
-      //     typedef CGAL::Surface_mesher::Image_surface_oracle_3<Kernel,
-      Surface_3, 
-      Classify_from_isovalue_list,
-      Generate_surface_identifiers> Oracle;
-    Oracle oracle(classify, generate_ids);
-
-    if(mw->searchSeedsCheckBox->isChecked())
-    {
-      typedef std::vector<std::pair<Point, double> > Seeds;
-      Seeds seeds;
-      {
-	std::cerr << "Search seeds...\n";
-	std::set<unsigned char> domains;
-	search_for_connected_components(std::back_inserter(seeds),
-					CGAL::inserter(domains),
-					classify);
-	std::cerr << "Found " << seeds.size() << " seed(s).\n";
-
-	if(mw->labellizedRadioButton->isChecked() && 
-	   values_list->numberOfValues() == 0) 
-	{
-	  Q_FOREACH(unsigned char label, domains) {
-	    if(label != 0) {
-	      values_list->addValue(label);
-	    }
-	  }
-	}
-      }
-      std::ofstream seeds_out("seeds.off");
-      std::ofstream segments_out("segments.txt");
-      seeds_out.precision(18);
-      seeds_out << "OFF\n" << seeds.size() << " 0 0\n";
-      segments_out.precision(18);
-      for(Seeds::const_iterator it = seeds.begin(), end = seeds.end();
-	  it != end; ++it)
-      {
-        seeds_out << it->first << std::endl;
-	CGAL::Random_points_on_sphere_3<Point> random_points_on_sphere_3(it->second);
-	Oracle::Intersect_3 intersect = oracle.intersect_3_object();
-	for(int i = 0; i < 20; ++i)
-	{
-	  const Point test = it->first + (*random_points_on_sphere_3++ - CGAL::ORIGIN);
-	  CGAL::Object o = intersect(surface, Segment_3(it->first, test));
-	  if (const Point* intersection = CGAL::object_cast<Point>(&o)) {
-            segments_out << "2 " << it->first << " " << *intersection << std::endl;
-	    del.insert(*intersection);
-          }
-	  else 
-	  {
-	    std::cerr << 
-	      boost::format("Error. Segment (%1%, %2%) does not intersect the surface! values=(%3%, %4%)\n")
-	      % it->first % test
-	      % surface(it->first) % surface(test);
-	  }
-	}
-      }
-    }
-    else {
-      oracle.construct_initial_points_object()(surface, 
-					       CGAL::inserter(c2t3.triangulation()),
-					       20);
-    }
-
-    std::ofstream points_out("initial-points.off");
-    points_out.precision(18);
-    points_out << "OFF\n" << c2t3.triangulation().number_of_vertices() << " 0 0\n";
-    BOOST_FOREACH(const Tr::Vertex& v,
-                  std::make_pair(c2t3.triangulation().vertices_begin(),
-                                 c2t3.triangulation().vertices_end()))
-    {
-      points_out << v.point() << std::endl;
-    }
-
-    std::cerr << boost::format("Number of initial points: %1%\n") % del.number_of_vertices();
-
-    // defining meshing criteria
-    typedef CGAL::Surface_mesher::Refine_criterion<Tr> Criterion;
-    CGAL::Surface_mesher::Curvature_size_criterion<Tr>
-      curvature_size_criterion (m_sm_distance);
-    CGAL::Surface_mesher::Uniform_size_criterion<Tr>
-      uniform_size_criterion (m_sm_radius);
-    CGAL::Surface_mesher::Aspect_ratio_criterion<Tr>
-      aspect_ratio_criterion (m_sm_angle);
-    CGAL::Surface_mesher::Vertices_on_the_same_psc_element_criterion<Tr, Surface_3>
-      vertices_on_the_same_psc_element_criterion(surface);
-    
-    std::vector<Criterion*> criterion_vector;
-    criterion_vector.push_back(&aspect_ratio_criterion);
-    criterion_vector.push_back(&uniform_size_criterion);
-    criterion_vector.push_back(&curvature_size_criterion);
-    if(mw->sameIndexCheckBox->isChecked()) {
-      criterion_vector.push_back(&vertices_on_the_same_psc_element_criterion);
-      std::cerr << "vertices_on_the_same_psc_element_criterion is activated.\n";
-    }
-
-    typedef CGAL::Surface_mesher::Standard_criteria<Criterion> Criteria;
-    Criteria criteria(criterion_vector);
-    std::cerr << "Surface_mesher... angle=" << m_sm_angle << ", radius= " << m_sm_radius
-              << ", distance=" << m_sm_distance << "\n";
-
-    typedef CGAL::Surface_mesher_generator<C2t3,
-      Oracle,
-      Criteria,
-      CGAL::Manifold_tag,
-      CGAL_SURFACE_MESHER_VERBOSITY
-      >::type Surface_mesher_manifold;
-      
-    typedef CGAL::Surface_mesher_generator<C2t3,
-      Oracle,
-      Criteria,
-      CGAL::Non_manifold_tag,
-      CGAL_SURFACE_MESHER_VERBOSITY
-      >::type Surface_mesher_non_manifold; 
-
-    if(mw->manifoldCheckBox->isChecked()) {
-      // meshing surface
-      std::cerr << "manifold criteria is activated.\n";
-//       make_surface_mesh(c2t3, surface, oracle, criteria,
-// 			CGAL::Manifold_tag(), 0);
-      Surface_mesher_manifold manifold_mesher(c2t3, surface, oracle, criteria);
-      manifold_mesher.refine_mesh();
-    }
-    else {
-//       m_view_surface = true;
-      Surface_mesher_non_manifold non_manifold_mesher(c2t3, surface, oracle, criteria);
-#if 0
-      int nb_steps = 0;
-//       direct_draw = true;
-      non_manifold_mesher.init();
-      while(!non_manifold_mesher.is_algorithm_done()) {
-	CGAL::Null_mesh_visitor null_visitor;
-	non_manifold_mesher.one_step(null_visitor);
-	if(++nb_steps % 1000 == 0) {
-	  CGAL::Timer timer;
-	  std::cerr << "(process events...";
-	  timer.start();
-	  list_draw_marching_cube_is_valid = false;
-	  lists_draw_surface_is_valid = false;
-	  for(Tr::Finite_cells_iterator 
-		cit = del.finite_cells_begin(),
-		end = del.finite_cells_end();
-	      cit != end; ++cit)
-	  {
-	    cit->info() = classify(surface(cit->circumcenter()));
-	  }
-// 	  Q_EMIT changed();
-	  qApp->processEvents();
-	  timer.stop();
-	  std::cerr << timer.time() << " secondes)\n";
-	}
-      }
-#else
-      non_manifold_mesher.refine_mesh();
-#endif
-    }
-    sm_timer.stop();
-    not_busy();
-    direct_draw = false;
-
-    for(Tr::Finite_cells_iterator 
-	  cit = del.finite_cells_begin(),
-	  end = del.finite_cells_end();
-	cit != end; ++cit)
-    {
-      cit->info() = classify(surface(cit->circumcenter()));
-    }
-    // get output surface
-    for(C2t3::Facet_iterator
-          fit = c2t3.facets_begin(), end = c2t3.facets_end();
-        fit != end; ++fit)
-    {
-      const Tr::Cell_handle& cell = fit->first;
-      const int index = fit->second;
-
-      // here "left" means nothing
-      const Point left_circumcenter = cell->circumcenter();
-      const Point right_circumcenter = cell->neighbor(index)->circumcenter();
-
-      const Triangle_3 t = 
-        Triangle_3(cell->vertex(del.vertex_triple_index(index, 0))->point(),
-                   cell->vertex(del.vertex_triple_index(index, 1))->point(),
-                   cell->vertex(del.vertex_triple_index(index, 2))->point());
-      const Vector u = t[1] - t[0];
-      const Vector v = t[2] - t[0];
-      Vector n = CGAL::cross_product(u,v);
-      n = n / std::sqrt(n*n);
-      if(mw->labellizedRadioButton->isChecked()) 
-      {
-	m_surface.push_back(Facet(t,
-				  n,
-				  values_list->search((std::max)(surface(left_circumcenter), 
-								 surface(right_circumcenter)))));
-      }
-      else {
-	m_surface.push_back(Facet(t,n,cell->vertex(del.vertex_triple_index(index, 0))->point().element_index()));
-      }
-    }
-
-    // invalidate the display list
-    lists_draw_surface_is_valid = false;
-    sm_total_time = total_time.elapsed();
-  }
-
-  CGAL::Bbox_3 bbox(0,0,0,0,0,0);
-  for(std::vector<Facet>::const_iterator
-        it = m_surface.begin(), end = m_surface.end();
-      it != end; ++it)
-  {
-    bbox = bbox + it->get<0>().bbox();
-  }
-
-  // toggle visualization
-  m_view_mc = false;
-  m_view_surface = true;
-  Q_EMIT changed();
-  if(!m_surface.empty())
-  {
-    Q_EMIT new_bounding_box(bbox.xmin(),
-                          bbox.ymin(),
-                          bbox.zmin(),
-                          bbox.xmax(),
-                          bbox.ymax(),
-                          bbox.zmax());
-  }
-  status_message(tr("Surface meshing done. %1 facets in %2s (CPU time), total time is %3s.")
-                 .arg(m_surface.size())
-                 .arg(sm_timer.time())
-                 .arg(sm_total_time/1000.));
-  save_image_settings(fileinfo.absoluteFilePath());
-}
-
-void Volume::draw()
-{
-  float	ambient[]  =   { 0.25f,
-                         0.20725f,
-                         0.20725f,
-                         0.922f };
-  float	diffuse[]  =   { 1.0f,
-                         0.829f,
-                         0.829f,
-                         0.922f };
-
-  float	specular[]  = {  0.296648f,
-                         0.296648f,
-                         0.296648f,
-                         0.522f };
-
-  float	emission[]  = {  0.3f,
-                         0.3f,
-                         0.3f,
-                         1.0f };
-  float shininess[] = {  11.264f };
-
-  // apply
-  ::glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT,   ambient);
-  ::glMaterialfv( GL_FRONT_AND_BACK, GL_DIFFUSE,   diffuse);
-  ::glMaterialfv( GL_FRONT_AND_BACK, GL_SPECULAR,  specular);
-  ::glMaterialfv( GL_FRONT_AND_BACK, GL_SHININESS, shininess);
-  ::glMaterialfv( GL_FRONT_AND_BACK, GL_EMISSION,  emission);
-
-  ::glEnable(GL_LINE_SMOOTH);
-
-  if(two_sides)
-    ::glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
-  else
-    ::glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE); // default
-
-  // draw surface mesh
-  if(m_view_surface)
-  {
-    ::glEnable(GL_LIGHTING);
-    ::glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
-    ::glColor3f(0.2f, 0.2f, 1.f);
-    ::glEnable(GL_POLYGON_OFFSET_FILL);
-    ::glPolygonOffset(3.0f,-3.0f);
-    gl_draw_surface();
-
-    if(draw_triangles_edges)
-    {
-      ::glDisable(GL_LIGHTING);
-      ::glLineWidth(1.);
-      ::glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
-      ::glColor3ub(0,0,0);
-      ::glDisable(GL_POLYGON_OFFSET_FILL);
-      gl_draw_surface();
-    }
-  }
-
-#ifdef CGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE
-  // draw MC surface mesh
-  if(m_view_mc)
-  {
-    ::glEnable(GL_LIGHTING);
-    ::glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
-    ::glColor3f(0.2f, 0.2f, 1.f);
-    ::glEnable(GL_POLYGON_OFFSET_FILL);
-    ::glPolygonOffset(3.0f,-3.0f);
-    gl_draw_surface_mc();
-
-    if(draw_triangles_edges)
-    {
-      ::glDisable(GL_LIGHTING);
-      ::glLineWidth(1.);
-      ::glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
-      ::glColor3ub(0,0,0);
-      ::glDisable(GL_POLYGON_OFFSET_FILL);
-      gl_draw_surface_mc();
-    }
-  }
-#endif // CGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE
-
-  if(show_bbox) {
-    ::glDisable(GL_LIGHTING);
-    m_image.gl_draw_bbox(3.0f,0,0,0);
-  }
-
-  if(!m_view_mc && m_draw_triangulation)
-  {
-    // draw the triangualtion
-    mw->viewer->qglColor(m_triangulation_color);
-    ::glLineWidth(1.0);
-    ::glBegin(GL_LINES);
-    for(Tr::Finite_edges_iterator 
-          eit = del.finite_edges_begin(), 
-          end = del.finite_edges_end();
-        eit != end; ++eit) 
-    {
-      const Point p1 = eit->first->vertex(eit->second)->point();
-      const Point p2 = eit->first->vertex(eit->third)->point();
-      ::glVertex3d(p1.x(),p1.y(),p1.z());
-      ::glVertex3d(p2.x(),p2.y(),p2.z());
-    }
-    ::glEnd();
-  }
-}
-
-void Volume::set_radius_bound(double d)
-{ 
-  m_sm_radius = FT(d);
-  changed_parameters();
-}
-
-void Volume::set_distance_bound(double d)
-{ 
-  m_sm_distance = FT(d);
-  changed_parameters();
-}
-
-#ifdef CGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE
-void Volume::gl_draw_surface_mc()
-{
-  if(use_gouraud)
-  {
-    gl_draw_marchingcube();
-    return;
-  }
-  
-  if(lists_draw_surface_mc_is_valid)
-  {
-    for(int i = 0, nbs = values_list->numberOfValues(); i < nbs; ++i )
-    {
-      if(values_list->enabled(i))
-      {
-        mw->viewer->qglColor(values_list->color(i));
-        ::glCallList(lists_draw_surface_mc[i]);
-      }
-    }
-  }
-  else
-  {
-    lists_draw_surface_mc.resize(values_list->numberOfValues(), 0);
-    for(int i = 0, nbs = values_list->numberOfValues(); i < nbs; ++i )
-    {
-      if(!lists_draw_surface_mc[i])
-      {
-        lists_draw_surface_mc[i] = ::glGenLists(1);
-      }
-
-      std::cerr << boost::format("(Re-)Generating list #%1% for marching cube surface #%2%"
-                                 " in gl_draw_surface(), ()\n")
-        % lists_draw_surface_mc[i]
-        % i;
-
-      mw->viewer->qglColor(values_list->color(i));
-
-      if(lists_draw_surface_mc[i])             // If
-        ::glNewList(lists_draw_surface_mc[i],  // lists_draw_surface[i]==0 then something
-                    values_list->enabled(i) // got wrong in the list generation.
-                    ? GL_COMPILE_AND_EXECUTE
-                    : GL_COMPILE);
-
-
-      gl_draw_surface(m_surface_mc.begin(),
-                      m_surface_mc.end(),
-                      values_list->item(i));
-        
-      if(lists_draw_surface_mc[i]) // If lists_draw_surface[i]==0 then
-      {                            // something got wrong in the list
-        ::glEndList();             // generation.
-      }
-    }
-    lists_draw_surface_mc_is_valid = (::glGetError() == GL_NO_ERROR);
-  }
-}
-#endif // CGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE
-
-void Volume::gl_draw_surface()
-{
-//   if(mw->labellizedRadioButton->isChecked()) {
-//     mw->viewer->qglColor(::Qt::blue);
-//     gl_draw_surface(m_surface.begin(),
-// 		    m_surface.end(),
-// 		    0);
-//   }
-//   else
-  if(direct_draw) {
-    ::glBegin(GL_TRIANGLES);
-    unsigned int counter = 0;
-    for(Tr::Finite_cells_iterator
-	  cit = del.finite_cells_begin(), end = del.finite_cells_end();
-	cit != end; ++cit)
-    {
-      for(int facet_index = 0; facet_index < 4; ++facet_index)
-      {
-	const Tr::Cell_handle& facet_cell = cit;
-	if(c2t3.face_status(facet_cell, facet_index) == C2t3::NOT_IN_COMPLEX) {
-	  continue;
-	}
-	const Point& a = facet_cell->vertex(del.vertex_triple_index(facet_index, 0))->point();
-	const Point& b = facet_cell->vertex(del.vertex_triple_index(facet_index, 1))->point();
-	const Point& c = facet_cell->vertex(del.vertex_triple_index(facet_index, 2))->point();
-	Vector n = CGAL::cross_product(b-a,c-a);
-	n = n / std::sqrt(n*n); // unit normal
-	if(m_inverse_normals) {
-	  ::glNormal3d(-n.x(),-n.y(),-n.z());
-	} else {
-	  ::glNormal3d(n.x(),n.y(),n.z());
-	}
-	mw->viewer->qglColor(values_list->color(values_list->search(facet_cell->info())));
-	::glVertex3d(a.x(),a.y(),a.z());
-	::glVertex3d(b.x(),b.y(),b.z());
-	::glVertex3d(c.x(),c.y(),c.z());
-	++counter;
-      }
-      ::glEnd();
-    }
-    return;
-  }
-  if(!direct_draw && lists_draw_surface_is_valid)
-  {
-    for(int i = 0, nbs = values_list->numberOfValues(); i < nbs; ++i )
-    {
-      if(values_list->enabled(i))
-      {
-        mw->viewer->qglColor(values_list->color(i));
-        ::glCallList(lists_draw_surface[i]);
-      }
-    }
-  }
-  else
-  {
-    lists_draw_surface.resize(values_list->numberOfValues(), 0);
-    for(int i = 0, nbs = values_list->numberOfValues(); i < nbs; ++i )
-    {
-      if(!lists_draw_surface[i])
-      {
-        lists_draw_surface[i] = ::glGenLists(1);
-      }
-
-      std::cerr << boost::format("(Re-)Generating list #%1% for surface #%2%"
-                                 " in gl_draw_surface(), ()\n")
-        % lists_draw_surface[i]
-        % i;
-        
-      mw->viewer->qglColor(values_list->color(i));
-
-      if(!direct_draw && lists_draw_surface[i]) // If
-        ::glNewList(lists_draw_surface[i],      // lists_draw_surface[i]==0
-                    values_list->enabled(i)     // then something got wrong
-                    ? GL_COMPILE_AND_EXECUTE    // in the list generation.
-                    : GL_COMPILE);
-
-      if(!mw->labellizedRadioButton->isChecked()) 
-      {
-	gl_draw_surface(m_surface.begin(),
-			m_surface.end(),
-			values_list->item(i));
-      }
-      else 
-      {
-	const unsigned char volume_index = values_list->value(i);
-
-	::glBegin(GL_TRIANGLES);
-	unsigned int counter = 0;
-	for(C2t3::Facet_iterator
-	      fit = c2t3.facets_begin(), end = c2t3.facets_end();
-	    fit != end; ++fit)
-	{
-	  Tr::Cell_handle facet_cell = fit->first;
-	  int facet_index = fit->second;
-	  Tr::Cell_handle opposite_cell = facet_cell->neighbor(facet_index);
-	  int opposite_index = opposite_cell->index(facet_cell);
-
-	  if( facet_cell->info() != volume_index ) {
-	    if( opposite_cell->info() == volume_index ) {
-	      std::swap(facet_cell, opposite_cell);
-	      std::swap(facet_index, opposite_index);
-	    }
-	    else 
-	      continue; // go to next facet
-	  }
-	  const Point& a = opposite_cell->vertex(del.vertex_triple_index(opposite_index, 0))->point();
-	  const Point& b = opposite_cell->vertex(del.vertex_triple_index(opposite_index, 1))->point();
-	  const Point& c = opposite_cell->vertex(del.vertex_triple_index(opposite_index, 2))->point();
-	  Vector n = CGAL::cross_product(b-a,c-a);
-	  n = n / std::sqrt(n*n); // unit normal
-	  if(m_inverse_normals) {
-	    ::glNormal3d(-n.x(),-n.y(),-n.z());
-	  } else {
-	    ::glNormal3d(n.x(),n.y(),n.z());
-	  }
-	  ::glVertex3d(a.x(),a.y(),a.z());
-	  ::glVertex3d(b.x(),b.y(),b.z());
-	  ::glVertex3d(c.x(),c.y(),c.z());
-	  ++counter;
-	}
-	::glEnd();
-	std::cerr << boost::format("(c2t3) number of facets: %1%\n")
-	  % counter;
-      }
-
-      if(!direct_draw && lists_draw_surface[i])
-	                        // If lists_draw_surface[i]==0 then
-      {                         // something got wrong in the list
-        ::glEndList();          // generation.
-      }
-    }
-    lists_draw_surface_is_valid = (::glGetError() == GL_NO_ERROR);
-  }
-}
-
-template <typename Iterator>
-void Volume::gl_draw_surface(Iterator begin, Iterator end, const QTreeWidgetItem* i)
-{
-  ::glBegin(GL_TRIANGLES);
-  unsigned int counter = 0;
-  for(Iterator it = begin; it != end; ++it)
-  {
-    const Facet& f = *it;
-
-    if(f.get<2>() != i) continue;
-
-    const Vector& n = f.get<1>();
-
-    if(m_inverse_normals)
-      ::glNormal3d(-n.x(),-n.y(),-n.z());
-    else
-      ::glNormal3d(n.x(),n.y(),n.z());
-
-    const Triangle_3& t = f.get<0>();
-    const Point& a = t[0];
-    const Point& b = t[1];
-    const Point& c = t[2];
-
-    ::glVertex3d(a.x(),a.y(),a.z());
-    ::glVertex3d(b.x(),b.y(),b.z());
-    ::glVertex3d(c.x(),c.y(),c.z());
-    ++counter;
-  }
-  ::glEnd();
-  std::cerr << boost::format("number of facets: %1%\n")
-    % counter;
-}
-
-void Volume::changed_parameters()
-{
-  m_surface.clear();
-#ifdef CGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE
-  m_surface_mc.clear();
-#endif
-  list_draw_marching_cube_is_valid = false;
-  lists_draw_surface_is_valid = false;
-  c2t3.clear();
-  del.clear();
-  m_view_mc = m_view_surface = false;
-  Q_EMIT changed();
-}
-
-#ifdef CGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE
-void Volume::gl_draw_one_marching_cube_vertex(int i)
-{
-  if(!m_inverse_normals)
-    glArrayElement(i);
-  else
-  {
-    const Vertex* const vertex = mc.vert(i);
-    ::glNormal3d(-vertex->nx, -vertex->ny, -vertex->nz);
-    ::glVertex3d(vertex->x, vertex->y, vertex->z);
-  }
-}
-
-void Volume::gl_draw_marchingcube()
-{
-  if(list_draw_marching_cube_is_valid)
-    ::glCallList(list_draw_marching_cube);
-  else
-  {
-    if(!list_draw_marching_cube)
-      list_draw_marching_cube = ::glGenLists(1);
-    std::cerr << boost::format("(Re-)Generating list #%1% for"
-                               " gl_draw_marchingcube()\n")
-      % list_draw_marching_cube;
-
-    if(list_draw_marching_cube)          // If list_draw_marching_cube==0 then
-    ::glNewList(list_draw_marching_cube, // something got wrong in the list
-                GL_COMPILE_AND_EXECUTE); // generation.
-
-    ::glVertexPointer(3, GL_DOUBLE, sizeof(Vertex), mc.vertices());
-    ::glNormalPointer(GL_DOUBLE, sizeof(Vertex), &(mc.vertices()->nx));
-    ::glEnableClientState(GL_VERTEX_ARRAY);
-
-    // because of that conditionnal, the display list has to be
-    // reconstructed each time m_inverse_normals is toggled.
-    if(!m_inverse_normals)
-      ::glEnableClientState(GL_NORMAL_ARRAY);
-
-    for(int i = 0, nbs = values_list->numberOfValues(); i < nbs; ++i)
-    {
-      const int begin = i == 0 ? 0 : nbs_of_mc_triangles[i-1];
-      const int end = nbs_of_mc_triangles[i];
-      mw->viewer->qglColor(values_list->color(i));
-      ::glBegin(GL_TRIANGLES);
-      for(int i = begin; i < end; ++i)
-      {
-        const MC_Triangle* const trig = mc.trig(i);
-        gl_draw_one_marching_cube_vertex(trig->v1);
-        gl_draw_one_marching_cube_vertex(trig->v2);
-        gl_draw_one_marching_cube_vertex(trig->v3);
-      }
-      ::glEnd();
-    }
-    if(list_draw_marching_cube > 0) // If list_draw_marching_cube==0 then
-    {                               // something got wrong in the list
-      ::glEndList();                // generation.
-      list_draw_marching_cube_is_valid = (::glGetError() == GL_NO_ERROR);
-    }
-    if(!list_draw_marching_cube_is_valid)
-    {
-     CGAL::Qt::opengl_check_errors();
-    }
-  }
-}
-#endif // CGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE
-
-void Volume::save_image_settings(QString filename)
-{
-  QSettings settings;
-  settings.beginGroup(QUrl::toPercentEncoding(filename));
-  settings.setValue("labellized", mw->labellizedRadioButton->isChecked());
-  settings.endGroup();
-}
-
-void Volume::load_image_settings(QString filename)
-{
-  QSettings settings;
-  settings.beginGroup(QUrl::toPercentEncoding(filename));
-  mw->labellizedRadioButton->setChecked(settings.value("labellized").toBool());
-  settings.endGroup();
-}
-
-void Volume::labellizedToogled(bool toggled)
-{
-  if(toggled) {
-    values_list->setHeaderTitle(tr("Label"));
-  }
-  else {
-    values_list->setHeaderTitle(tr("Iso-Value"));
-  }
-}
-
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/volume.h b/3rdparty/CGAL-4.8/demo/Surface_mesher/volume.h
deleted file mode 100644
index 0b43eb8..0000000
--- a/3rdparty/CGAL-4.8/demo/Surface_mesher/volume.h
+++ /dev/null
@@ -1,384 +0,0 @@
-#ifndef _VOLUME_H
-#define _VOLUME_H
-
-#include <CGAL/basic.h>
-#include <CGAL/Object.h>
-#include <CGAL/Timer.h>
-
-
-#include "surface.h"
-#include "binary_image.h"
-
-#include <boost/multi_array.hpp>
-#include <boost/tuple/tuple.hpp>
-#include <boost/tuple/tuple_comparison.hpp>
-#include <boost/format.hpp>
-
-#include <queue>
-#include <vector>
-#include <iterator> // std::back_inserter
-
-#include <QString>
-#include <QFileInfo>
-
-#ifdef CGAL_USE_VTK
-class vtkImageReader;
-class vtkImageData;
-class vtkDICOMImageReader;
-class vtkDemandDrivenPipeline;
-class vtkImageGaussianSmooth;
-#endif // CGAL_USE_VTK
-
-class QTreeWidgetItem;
-
-// kernel
-// #include <CGAL/Simple_cartesian.h>
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel1;
-
-#include <CGAL/Point_with_psc_localisation.h>
-struct Kernel : public Kernel1 {
-  typedef CGAL::Point_with_psc_localisation<Kernel::Point_3,
-                                            const QTreeWidgetItem*> Point_3;
-};
-
-typedef Kernel::FT FT;
-typedef Kernel::Point_3 Point;
-typedef Kernel::Sphere_3 Sphere;
-typedef Kernel::Vector_3 Vector;
-typedef Kernel::Triangle_3 Triangle_3;
-typedef Kernel::Segment_3 Segment_3;
-
-// typedef CGAL::Triple<Triangle_3,Vector,const QTreeWidgetItem*> Facet;
-
-typedef boost::tuple<Triangle_3,Vector,const QTreeWidgetItem*> Facet;
-
-typedef CBinary_image_3<FT,Point> Binary_image;
-
-class QTreeWidgetItem;
-
-// surface mesher
-// #define CGAL_MESHES_NO_OUTPUT
-#include <CGAL/Surface_mesh_vertex_base_3.h>
-#include <CGAL/Triangulation_cell_base_with_info_3.h>
-#include <CGAL/Surface_mesh_cell_base_3.h>
-#include <CGAL/Delaunay_triangulation_cell_base_with_circumcenter_3.h>
-#include <CGAL/Delaunay_triangulation_3.h>
-#include <CGAL/Surface_mesh_complex_2_in_triangulation_3.h>
-#include <CGAL/Surface_mesh_default_criteria_3.h>
-#include <CGAL/Implicit_surface_3.h>
-#include <CGAL/Surface_mesh_traits_generator_3.h>
-typedef CGAL::Surface_mesh_vertex_base_3<Kernel> Vb;
-typedef CGAL::Triangulation_cell_base_with_info_3<unsigned char, Kernel> Cb1;
-typedef CGAL::Surface_mesh_cell_base_3<Kernel, Cb1> Cb2;
-typedef CGAL::Delaunay_triangulation_cell_base_with_circumcenter_3<Kernel, Cb2> Cb;
-typedef CGAL::Triangulation_data_structure_3<Vb, Cb> Tds;
-typedef CGAL::Delaunay_triangulation_3<Kernel, Tds> Tr;
-typedef CGAL::Surface_mesh_complex_2_in_triangulation_3<Tr> C2t3;
-typedef CGAL::Implicit_surface_3<Kernel, Binary_image> Surface_3;
-
-#ifdef CGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE
-#include <mc/MarchingCubes.h>
-#endif
-
-class MainWindow;
-class QDoubleSpinBox;
-class Viewer;
-class Values_list;
-
-class Volume : public Surface
-{
-  Q_OBJECT
-public:
-  Volume(MainWindow* mw);
-  ~Volume();
-
-private:
-  Binary_image m_image;
-
-  // options
-  FT m_sm_angle;
-  FT m_sm_radius;
-  FT m_sm_distance;
-  double m_relative_precision;
-
-  // visualization
-  bool m_view_surface;
-  bool m_draw_triangulation;
-  QColor m_triangulation_color;
-  bool m_inverse_normals;
-  bool two_sides;
-  bool draw_triangles_edges;
-  bool use_gouraud;
-  bool show_bbox;
-
-  std::vector<Facet> m_surface;
-  Tr del;            // 3D-Delaunay triangulation
-  C2t3 c2t3;         // 2D complex in 3D triangulation
-
-  MainWindow* mw;
-  QFileInfo fileinfo;
-  Values_list* values_list;
-  QDoubleSpinBox* spinBox_radius_bound;
-  QDoubleSpinBox* spinBox_distance_bound;
-
-  bool direct_draw; // do not use display lists
-  std::vector<GLint> lists_draw_surface;
-  bool lists_draw_surface_is_valid;
-  GLint list_draw_marching_cube;
-  bool list_draw_marching_cube_is_valid;
-
-  CGAL::Timer sm_timer;
-  int sm_total_time;
-
-#ifdef CGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE
-  std::vector<Facet> m_surface_mc;
-  MarchingCubes<unsigned char> mc ;
-  std::vector<int> nbs_of_mc_triangles;
-  std::vector<GLint> lists_draw_surface_mc;
-  bool lists_draw_surface_mc_is_valid;
-  CGAL::Timer mc_timer;
-  int mc_total_time;
-public:
-  void gl_draw_surface_mc();
-  void gl_draw_marchingcube();
-private:
-  void gl_draw_one_marching_cube_vertex(int);
-
-#endif // CGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE
-
-  bool m_view_mc; // that boolean is here even with if
-		  // CGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE
-                  // is not defined.
-
-#ifdef CGAL_USE_VTK
-  vtkImageReader* vtk_reader;
-  vtkImageData* vtk_image;
-  vtkDICOMImageReader* dicom_reader;
-  vtkDemandDrivenPipeline* executive;
-  vtkImageGaussianSmooth* smoother;
-#endif // CGAL_USE_VTK
-
-public Q_SLOTS:
-void display_marchin_cube();
-
-private:
-  template <typename Iterator>
-  void gl_draw_surface(Iterator begin, Iterator end, const QTreeWidgetItem* = 0);
-
-  template <typename PointsOutputIterator,
-	    typename DomainsOutputIterator,
-	    typename TransformOperator>
-  void search_for_connected_components(PointsOutputIterator,
-				       DomainsOutputIterator, 
-				       TransformOperator);
-
-public:
-  void gl_draw_surface();
-
-Q_SIGNALS:
-
-  void new_bounding_box(double, double, double, double, double, double);
-
-public Q_SLOTS:
-  void only_in();
-  void set_inverse_normals(const bool);
-  void set_two_sides(const bool);
-  void set_draw_triangles_edges(const bool);
-  void set_triangulation_edges_color();
-  void set_draw_triangulation(const bool);
-  void set_use_gouraud(const bool);
-  void set_show_bbox(const bool);
-  bool open(const QString& filename);
-#ifdef CGAL_USE_VTK
-  bool open_vtk(const QString& filename);
-#endif
-  bool open_xt(const QString& filename);
-  bool opendir(const QString& dirname);
-  void finish_open();
-  void export_off();
-  void save_image_to_inr();
-  void check_can_export_off();
-  void draw();
-  void get_bbox(float& /*xmin*/, float& /*ymin*/, float& /*zmin*/,
-		float& /*xmax*/, float& /*ymax*/, float& /*zmax*/) {}
-  void close() {}
-  void display_surface_mesher_result();
-  void set_radius_bound(double);
-  void set_distance_bound(double);
-  void changed_parameters();
-
-  void labellizedToogled(bool);
-
-  void save_image_settings(QString);
-  void load_image_settings(QString);
-private:
-  void status_message(QString);
-  void busy() const;
-  void not_busy() const;
-};
-
-template <typename PointsOutputIterator,
-	  typename DomainsOutputIterator,
-	  typename TransformOperator>
-void Volume::search_for_connected_components(PointsOutputIterator it,
-					     DomainsOutputIterator dom_it,
-					     TransformOperator transform)
-{
-  const std::size_t nx = m_image.xdim();
-  const std::size_t ny = m_image.ydim();
-  const std::size_t nz = m_image.zdim();
-
-  const double max_v = (std::max)((std::max)(m_image.vx(),
-                                             m_image.vy()),
-                                  m_image.vz());
-
-  typedef unsigned char Marker;
-  typedef typename TransformOperator::result_type Label;
-
-  boost::multi_array<Marker, 3> visited(boost::extents[nx][ny][nz]);
-  typedef boost::tuple<std::size_t, std::size_t, std::size_t, std::size_t>
-                                Indices;
-  typedef std::queue<Indices>   Indices_queue;
-  typedef std::vector<Indices>  Border_vector;
-
-  int number_of_connected_components = 0;
-  for(std::size_t i=0; i<nx; i++)
-    for(std::size_t j=0; j<ny; j++)
-      for(std::size_t k=0; k<nz; k++)
-      {
-        if(visited[i][j][k]>0)
-          continue;
-        const Label current_label = transform(m_image.value(i, j, k));
-	*dom_it++ = current_label;
-        if(current_label == Label()) {
-          visited[i][j][k] = 3;
-          continue;
-        }
-
-        // if we reach here, (i, j, k) is a new connected component
-        ++number_of_connected_components;
-        std::cerr << boost::format("Found new connected component (#%5%) "
-                                   "at voxel (%1%, %2%, %3%), value=%4%, volume id=%6%\n")
-          % i % j % k
-          % m_image.value(i, j, k) 
-          % number_of_connected_components
-          % (int)current_label;
-
-        int nb_voxels = 0;
-
-        Indices_queue queue;
-        Indices indices(i, j ,k, 0);
-        queue.push(indices);
-
-        Border_vector border;
-
-        /*
-         * First pass is a BFS to retrieve all the connected component, and
-         * its border.
-         * Second pass is a BFS initialized with all voxel of the border.
-         * The last voxel of that BFS is used as the seed.
-         */
-        int pass = 1; // pass will be equal to 2 in second pass
-
-        Indices bbox_min = indices;
-        Indices bbox_max = indices;
-
-        while(!queue.empty()) // walk through the connected component
-        {
-          Indices indices = queue.front();
-          queue.pop();
-
-          // warning: those indices i, j and k are local to the while loop
-          const std::size_t i = boost::get<0>(indices);
-          const std::size_t j = boost::get<1>(indices);
-          const std::size_t k = boost::get<2>(indices);
-          const std::size_t depth = boost::get<3>(indices);
-
-          if(visited[i][j][k] < pass)
-          {
-            visited[i][j][k] = pass;
-            if(pass == 1 )
-            {
-              ++nb_voxels;
-              boost::get<0>(bbox_min) = (std::min)(i, boost::get<0>(bbox_min));
-              boost::get<0>(bbox_max) = (std::max)(i, boost::get<0>(bbox_max));
-              boost::get<1>(bbox_min) = (std::min)(j, boost::get<1>(bbox_min));
-              boost::get<1>(bbox_max) = (std::max)(j, boost::get<1>(bbox_max));
-              boost::get<2>(bbox_min) = (std::min)(k, boost::get<2>(bbox_min));
-              boost::get<2>(bbox_max) = (std::max)(k, boost::get<2>(bbox_max));
-            }
-
-            static const int neighbors_offset[6][3] = { { +1,  0,  0 },
-                                                        { -1,  0,  0 },
-                                                        {  0, +1,  0 },
-                                                        {  0, -1,  0 },
-                                                        {  0,  0, +1 },
-                                                        {  0,  0, -1 } };
-            bool voxel_is_on_border = false;
-
-            // Visit neighbors.
-            // (i_n, j_n, k_n) are indices of neighbors.
-            for(int n = 0; n < 6; ++n)
-            {
-              const ptrdiff_t i_n = i + neighbors_offset[n][0];
-              const ptrdiff_t j_n = j + neighbors_offset[n][1];
-              const ptrdiff_t k_n = k + neighbors_offset[n][2];
-              if(i_n < 0 || i_n >= static_cast<ptrdiff_t>(nx) ||
-                 j_n < 0 || j_n >= static_cast<ptrdiff_t>(ny) ||
-                 k_n < 0 || k_n >= static_cast<ptrdiff_t>(nz))
-              {
-                voxel_is_on_border = true;
-                continue;
-              }
-              else
-              {
-                if(transform(m_image.value(i_n, j_n, k_n)) == current_label)
-                {
-                  if(visited[i_n][j_n][k_n] < pass) {
-                    Indices indices(i_n, j_n, k_n, depth+1);
-                    queue.push(indices);
-                  }
-                }
-                else
-                  voxel_is_on_border = true;
-              }
-            } // end for neighbors
-
-            if(pass == 1 && voxel_is_on_border)
-              border.push_back(indices);
-          } // end if voxel not already visited
-
-          if(queue.empty()) {
-            if(pass == 1)
-            { // End of first pass. Begin second pass with the voxels of
-              // the border.
-              for(typename Border_vector::const_iterator
-                    border_it = border.begin(), border_end = border.end();
-                  border_it != border_end; ++border_it)
-                queue.push(*border_it);
-              pass = 2;
-            }
-            else // end of second pass, return the last visited voxel
-            {
-// 	      if(nb_voxels >= 100)
-	      {
-		*it++ = std::make_pair(m_image.point(i, j, k), (depth+1)*max_v);
-		std::cerr << boost::format("Found seed %5%, which is voxel (%1%, %2%, %3%), value=%4%\n")
-		  % i % j % k %  m_image.value(i, j, k) % m_image.point(i, j, k);
-	      }
-            }
-          } // end if queue.empty()
-        } // end while !queue.empty() (with local indices i, j, k)
-
-        std::cerr << boost::format("There was %1% voxel(s) in that component.\n"
-                                   "The bounding box is (%2% %3% %4%, %5% %6% %7%).\n"
-                                   "%8% voxel(s) on border\n")
-          % nb_voxels
-          % boost::get<0>(bbox_min) % boost::get<1>(bbox_min) % boost::get<2>(bbox_min)
-          % boost::get<0>(bbox_max) % boost::get<1>(bbox_max) % boost::get<2>(bbox_max)
-          % border.size();
-      } // end for i,j,k
-} // end function Volume::search_for_connected_components()
-
-#endif // _VOLUME_H
diff --git a/3rdparty/CGAL-4.8/demo/Three/Example_plugin/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Three/Example_plugin/CMakeLists.txt
deleted file mode 100644
index fa2d8f2..0000000
--- a/3rdparty/CGAL-4.8/demo/Three/Example_plugin/CMakeLists.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-project( Example_plugin )
-# Find includes in corresponding build directories
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-# Instruct CMake to run moc automatically when needed.
-set(CMAKE_AUTOMOC ON)
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-# Compatibility with CMake 3.0
-if(POLICY CMP0042)
-  # Do not enable the use of MACOSX_RPATH
-  # http://www.cmake.org/cmake/help/v3.0/policy/CMP0042.html
-  cmake_policy(SET CMP0042 OLD)
-endif()
-#Find CGAL
-find_package(CGAL COMPONENTS Qt5)
-include( ${CGAL_USE_FILE} )
-# Find Qt5 itself
-find_package(Qt5
-             QUIET
-             COMPONENTS            OpenGL Script Svg Xml
-             OPTIONAL_COMPONENTS   ScriptTools)
-             
-if(Qt5_FOUND AND CGAL_FOUND)  
-  find_package(CGAL_polyhedron_demo
-  HINTS "${CGAL_DIR}" "${CGAL_DIR}/Polyhedron/demo/Polyhedron-build"
-  )
-
-include( ${CGAL_POLYHEDRON_DEMO_USE_FILE} )
-# Let plugins be compiled in the same directory as the executable.
-set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
-
-           
-  #include( ${CMAKE_CURRENT_SOURCE_DIR}/../../Polyhedron/demo/Polyhedron/polyhedron_demo_macros.cmake )
-  qt5_wrap_ui( exampleUI_FILES Polyhedron_demo_example_plugin.ui dock_example.ui)
-  qt5_wrap_ui( example_dockUI_FILES dock_example.ui)
-  polyhedron_demo_plugin(example_plugin Polyhedron_demo_example_plugin ${exampleUI_FILES} ${example_dockUI_FILES})
-  target_link_libraries(example_plugin scene_polyhedron_item)  
-endif()
\ No newline at end of file
diff --git a/3rdparty/CGAL-4.8/demo/Three/Example_plugin/Polyhedron_demo_example_plugin.cpp b/3rdparty/CGAL-4.8/demo/Three/Example_plugin/Polyhedron_demo_example_plugin.cpp
deleted file mode 100644
index 2b9cb4e..0000000
--- a/3rdparty/CGAL-4.8/demo/Three/Example_plugin/Polyhedron_demo_example_plugin.cpp
+++ /dev/null
@@ -1,312 +0,0 @@
-//! \file Polyhedron_demo_example_plugin.cpp
-#include <QApplication>
-#include <QMainWindow>
-#include <QAction>
-#include <QVector>
-#include <CGAL/Three/Scene_item.h>
-#include <CGAL/Three/Viewer_interface.h>
-#include <CGAL/Three/Scene_group_item.h>
-#include "ui_Polyhedron_demo_example_plugin.h"
-#include "ui_dock_example.h"
-
-
-
-// The dialog class to get the coordinates of the triangle
-class Polyhedron_demo_example_plugin_dialog : public QDialog, private Ui::Polyhedron_demo_example_plugin_dialog
-{
-  Q_OBJECT
-  public:
-    Polyhedron_demo_example_plugin_dialog(QWidget* /*parent*/ = 0)
-    {
-      setupUi(this);
-
-    }
-
-    double getAx() const { return doubleSpinBox_Ax->value(); }
-    double getAy() const { return doubleSpinBox_Ay->value(); }
-    double getAz() const { return doubleSpinBox_Az->value(); }
-
-    double getBx() const { return doubleSpinBox_Bx->value(); }
-    double getBy() const { return doubleSpinBox_By->value(); }
-    double getBz() const { return doubleSpinBox_Bz->value(); }
-
-    double getCx() const { return doubleSpinBox_Cx->value(); }
-    double getCy() const { return doubleSpinBox_Cy->value(); }
-    double getCz() const { return doubleSpinBox_Cz->value(); }
-    void setTriangleName(QString name) {triangle_name_label->setText(name); }
-};
-
-// The special Scene_item only for triangles
-class Scene_triangle_item : public CGAL::Three::Scene_item
-{
-
-    Q_OBJECT
-public :
-    Scene_triangle_item(double ax,double ay, double az,
-                        double bx,double by, double bz,
-                        double cx,double cy, double cz)
-        :  CGAL::Three::Scene_item(1,1)
-    {
-        //Fills the position vector with data.
-        vertices.resize(9);
-        vertices[0] = ax; vertices[1] = ay; vertices[2] = az;
-        vertices[3] = bx; vertices[4] = by; vertices[5] = bz;
-        vertices[6] = cx; vertices[7] = cy; vertices[8] = cz;
-        changed();
-
-    }
-    Scene_triangle_item()
-        :  CGAL::Three::Scene_item(1,1)
-    {
-
-        Scene_triangle_item(
-                    0,0,0,
-                    0.5,1,0,
-                    1,0,0);
-
-    }
-    ~Scene_triangle_item()
-    {
-    }
-    bool isFinite() const { return true; }
-    bool isEmpty() const { return true; }
-    Bbox bbox() const { return Bbox(); }
-    Scene_triangle_item* clone() const {
-        return 0;
-    }
-
-    // Indicated if rendering mode is supported
-    bool supportsRenderingMode(RenderingMode m) const {
-        return (m == Flat);
-    }
-
-    QString toolTip() const {    
-      QString str =
-             QObject::tr( "<p>Number of vertices: %1<br />"
-                           "Number of edges: %2<br />"
-                         "Number of facets: %3")
-                .arg(3)
-                .arg(3)
-                .arg(1);
-        str+=QObject::tr("<br />Volume: %1").arg(0);
-        str+=QObject::tr("<br />Area: %1").arg(0.5);
-      str+="</p>";
-      str += QString("Bounding box: min (%1,%2,%3), max(%4,%5,%6)")
-           .arg(bbox().xmin)
-           .arg(bbox().ymin)
-           .arg(bbox().zmin)
-           .arg(bbox().xmax)
-           .arg(bbox().ymax)
-           .arg(bbox().zmax);
-      str += QString("<br />Number of isolated vertices : 0<br />");
-
-      return str;
-    }
-
-    void draw(CGAL::Three::Viewer_interface* viewer) const
-    {
-        //Initializes the buffers only when specified.
-        if(!are_buffers_filled)
-            initialize_buffers(viewer);
-        //Binds the vao corresponding to the type of data we are drawing.
-        vaos[0]->bind();
-        //Gets the program corresponding to the type of data we are drawing.
-        //Here we want triangles with light effects.
-        program = getShaderProgram(PROGRAM_WITH_LIGHT);
-        //Gives most of the uniform values to the shaders.
-        attrib_buffers(viewer, PROGRAM_WITH_LIGHT);
-        //Binds the program chosen before to use the right shaders.
-        program->bind();
-        //Gives the wanted color to the fragment shader as uniform value.
-        program->setAttributeValue("colors", this->color());
-        //Draws the items
-        viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(vertices.size()/3));
-        //clean up
-        vaos[0]->release();
-        program->release();
-
-    }
-
-    //Specifies that the buffers need to be initialized again.
-    //Is mostly called after a change of geometry in the data.
-    void changed()
-    {
-        are_buffers_filled = false;
-    }
-
-private:
-    //contains the data
-    std::vector<float> vertices;
-    mutable QOpenGLShaderProgram *program;
-    using CGAL::Three::Scene_item::initialize_buffers;
-    //Fills the buffers with data. The buffers allow us to give data to the shaders.
-    void initialize_buffers(CGAL::Three::Viewer_interface *viewer)const
-    {
-
-        //vao containing the data for the lines
-        {
-            program = getShaderProgram(PROGRAM_WITH_LIGHT, viewer);
-            program->bind();
-
-            vaos[0]->bind();
-            buffers[0].bind();
-            buffers[0].allocate(vertices.data(),
-                                static_cast<GLsizei>(vertices.size()*sizeof(float)));
-            program->enableAttributeArray("vertex");
-            program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
-            buffers[0].release();
-
-            vaos[0]->release();
-            program->release();
-
-        }
-        are_buffers_filled = true;
-    }
-
-}; //end of class Scene_triangle_item
-
-#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
-//The actual plugin
-using namespace CGAL::Three;
-class Q_DECL_EXPORT Polyhedron_demo_example_plugin :
-        public QObject,
-        public Polyhedron_demo_plugin_helper
-{
-    //Configures CMake to use MOC correctly
-    Q_OBJECT
-    Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
-    Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-
-public :
-    // To silent a warning -Woverloaded-virtual
-    // See http://stackoverflow.com/questions/9995421/gcc-woverloaded-virtual-warnings
-    using Polyhedron_demo_plugin_helper::init;
-    // Adds an action to the menu and configures the widget
-    void init(QMainWindow* mainWindow,
-              CGAL::Three::Scene_interface* scene_interface) {
-      //get the references
-      this->scene = scene_interface;
-      this->mw = mainWindow;
-        triangle_array.resize(0);
-
-      //creates and link the actions
-      actionDrawTriangle= new QAction("Draw Triangle", mw);
-      if(actionDrawTriangle) {
-        connect(actionDrawTriangle, SIGNAL(triggered()),
-                this, SLOT(populate_dialog()));
-      }
-
-      //Dock widget initialization
-      dock_widget = new QDockWidget("Triangle Creation", mw);
-      dock_widget->setVisible(false); // do not show at the beginning
-
-      ui_widget.setupUi(dock_widget);
-      mw->addDockWidget(Qt::LeftDockWidgetArea, dock_widget);
-      connect(ui_widget.buttonBox, SIGNAL(accepted()), this, SLOT(on_dock_OK_clicked()));
-    }
-    virtual void closure()
-    {
-      dock_widget->hide();
-    }
-    bool applicable(QAction*) const
-    {
-        return true;
-    }
-    QList<QAction*> actions() const {
-      return QList<QAction*>() << actionDrawTriangle;
-    }
-
-  public Q_SLOTS:
-
-    void populate_dialog()
-    {
-        // dock widget should be constructed in init()
-        if(dock_widget->isVisible()) { dock_widget->hide(); }
-        else                         { dock_widget->show(); }
-        //creates a new dialog
-        dialog = new Polyhedron_demo_example_plugin_dialog();
-        //changes the value of the label according to the number of triangles
-        dialog->setTriangleName(QString("Triangle %1").arg(triangle_array.size()));
-        //opens the dialog
-        if(!dialog->exec())
-            return;
-        //gets the values
-        ax = dialog->getAx();
-        ay = dialog->getAy();
-        az = dialog->getAz();
-        bx = dialog->getBx();
-        by = dialog->getBy();
-        bz = dialog->getBz();
-        cx = dialog->getCx();
-        cy = dialog->getCy();
-        cz = dialog->getCz();
-        //creates a triangle and store it in a vector.
-        triangle_array.push_back(new Scene_triangle_item(ax, ay, az,
-                                                               bx, by, bz,
-                                                               cx, cy, cz));
-        triangle_array[triangle_array.size()-1]->setName(QString("Triangle %1").arg(triangle_array.size()));
-        //Adds the triangle to the items of the scene
-        scene->addItem(triangle_array[triangle_array.size()-1]);
-        //if the were less than 3 triangles created this way, opens a new dialog
-        if(triangle_array.size()%3 > 0)
-            populate_dialog();
-        //else creates a new group and passes the 3 last triangles to it.
-        else
-        {
-            //clears the selection to avoid adding unwanted items to the group.
-            scene->setSelectedItem(-1);
-            //Creates a new group
-            Scene_group_item *group = new Scene_group_item("Triangle group");
-            //Then gives it its children
-            for(int i =0; i<3; i++)
-                scene->changeGroup(triangle_array[triangle_array.size()-i-1], group);
-            //adds it to the scene
-            scene->add_group(group);
-        }
-    }
-
-  void draw_triangle() {
-
-    triangle = new Scene_triangle_item(ax, ay, az,
-                                       bx, by, bz,
-                                       cx, cy, cz);
-    scene->addItem(triangle);
-  }
-
-  void on_dock_OK_clicked()
-  {
-      ax = ui_widget.doubleSpinBox_Ax->value();
-      ay = ui_widget.doubleSpinBox_Ay->value();
-      az = ui_widget.doubleSpinBox_Az->value();
-
-      bx = ui_widget.doubleSpinBox_Bx->value();
-      by = ui_widget.doubleSpinBox_By->value();
-      bz = ui_widget.doubleSpinBox_Bz->value();
-
-      cx = ui_widget.doubleSpinBox_Cx->value();
-      cy = ui_widget.doubleSpinBox_Cy->value();
-      cz = ui_widget.doubleSpinBox_Cz->value();
-      draw_triangle();
-
-  }
-
-private:
-  CGAL::Three::Scene_item* triangle;
-  QAction* actionDrawTriangle;
-  Polyhedron_demo_example_plugin_dialog *dialog;
-  double ax;
-  double ay;
-  double az;
-  double bx;
-  double by;
-  double bz;
-  double cx;
-  double cy;
-  double cz;
-  QVector<Scene_triangle_item*> triangle_array;
-Ui::Dock_example ui_widget;
-QDockWidget* dock_widget;
-
-}; //end of class Polyhedron_demo_example_plugin
-#include "Polyhedron_demo_example_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Three/Example_plugin/dock_example.ui b/3rdparty/CGAL-4.8/demo/Three/Example_plugin/dock_example.ui
deleted file mode 100644
index 9e96390..0000000
--- a/3rdparty/CGAL-4.8/demo/Three/Example_plugin/dock_example.ui
+++ /dev/null
@@ -1,156 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>Dock_example</class>
- <widget class="QDockWidget" name="Dock_example">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>275</width>
-    <height>222</height>
-   </rect>
-  </property>
-  <property name="sizePolicy">
-   <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
-    <horstretch>0</horstretch>
-    <verstretch>0</verstretch>
-   </sizepolicy>
-  </property>
-  <property name="minimumSize">
-   <size>
-    <width>58</width>
-    <height>200</height>
-   </size>
-  </property>
-  <property name="windowTitle">
-   <string>DockWidget</string>
-  </property>
-  <widget class="QWidget" name="dockWidgetContents">
-   <widget class="QDialogButtonBox" name="buttonBox">
-    <property name="geometry">
-     <rect>
-      <x>0</x>
-      <y>150</y>
-      <width>261</width>
-      <height>32</height>
-     </rect>
-    </property>
-    <property name="orientation">
-     <enum>Qt::Horizontal</enum>
-    </property>
-    <property name="standardButtons">
-     <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
-    </property>
-   </widget>
-   <widget class="QWidget" name="gridLayoutWidget">
-    <property name="geometry">
-     <rect>
-      <x>0</x>
-      <y>10</y>
-      <width>261</width>
-      <height>121</height>
-     </rect>
-    </property>
-    <layout class="QGridLayout" name="gridLayout">
-     <item row="3" column="3">
-      <widget class="QDoubleSpinBox" name="doubleSpinBox_Cz"/>
-     </item>
-     <item row="1" column="2">
-      <widget class="QDoubleSpinBox" name="doubleSpinBox_Bx"/>
-     </item>
-     <item row="2" column="2">
-      <widget class="QDoubleSpinBox" name="doubleSpinBox_By"/>
-     </item>
-     <item row="2" column="3">
-      <widget class="QDoubleSpinBox" name="doubleSpinBox_Cy"/>
-     </item>
-     <item row="2" column="1">
-      <widget class="QDoubleSpinBox" name="doubleSpinBox_Ay"/>
-     </item>
-     <item row="4" column="2">
-      <spacer name="verticalSpacer">
-       <property name="orientation">
-        <enum>Qt::Vertical</enum>
-       </property>
-       <property name="sizeHint" stdset="0">
-        <size>
-         <width>20</width>
-         <height>40</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-     <item row="0" column="3">
-      <widget class="QLabel" name="label_3">
-       <property name="text">
-        <string>Point C</string>
-       </property>
-      </widget>
-     </item>
-     <item row="0" column="1">
-      <widget class="QLabel" name="label">
-       <property name="text">
-        <string>Point A</string>
-       </property>
-      </widget>
-     </item>
-     <item row="1" column="3">
-      <widget class="QDoubleSpinBox" name="doubleSpinBox_Cx"/>
-     </item>
-     <item row="3" column="1">
-      <widget class="QDoubleSpinBox" name="doubleSpinBox_Az"/>
-     </item>
-     <item row="0" column="2">
-      <widget class="QLabel" name="label_2">
-       <property name="text">
-        <string>Point B</string>
-       </property>
-      </widget>
-     </item>
-     <item row="3" column="2">
-      <widget class="QDoubleSpinBox" name="doubleSpinBox_Bz"/>
-     </item>
-     <item row="1" column="1">
-      <widget class="QDoubleSpinBox" name="doubleSpinBox_Ax"/>
-     </item>
-     <item row="1" column="0">
-      <widget class="QLabel" name="label_4">
-       <property name="text">
-        <string>X</string>
-       </property>
-      </widget>
-     </item>
-     <item row="2" column="0">
-      <widget class="QLabel" name="label_5">
-       <property name="text">
-        <string>Y</string>
-       </property>
-      </widget>
-     </item>
-     <item row="3" column="0">
-      <widget class="QLabel" name="label_6">
-       <property name="text">
-        <string>Z</string>
-       </property>
-      </widget>
-     </item>
-     <item row="2" column="4">
-      <spacer name="horizontalSpacer">
-       <property name="orientation">
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="sizeHint" stdset="0">
-        <size>
-         <width>40</width>
-         <height>20</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-    </layout>
-   </widget>
-  </widget>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Triangulation_2/CMakeLists.txt
deleted file mode 100644
index ee7be01..0000000
--- a/3rdparty/CGAL-4.8/demo/Triangulation_2/CMakeLists.txt
+++ /dev/null
@@ -1,106 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-project (Triangulation_2)
-
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-find_package(CGAL COMPONENTS Qt5)
-
-include(${CGAL_USE_FILE})
-
-
-find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
-
-include_directories (BEFORE ../../include)
-include_directories (BEFORE ./include)
-include_directories (BEFORE ../../../Number_types/include)
-
-include_directories (BEFORE ../../../Triangulation_2/include)
-
-if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
-
-add_definitions(-DQT_NO_KEYWORDS)
-
-
-
-#--------------------------------
-# The "constrained Delaunay" demo: Constrained_Delaunay_triangulation_2
-#--------------------------------
-# UI files (Qt Designer files)
-qt5_wrap_ui( CDT_UI_FILES Constrained_Delaunay_triangulation_2.ui )
-
-# qrc files (resources files, that contain icons, at least)
-qt5_add_resources ( CDT_RESOURCE_FILES ./Constrained_Delaunay_triangulation_2.qrc )
-
-# use the Qt MOC preprocessor on classes that derives from QObject
-qt5_generate_moc( "Constrained_Delaunay_triangulation_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Constrained_Delaunay_triangulation_2.moc" )
-
-# The executable itself.
-add_executable  ( Constrained_Delaunay_triangulation_2 Constrained_Delaunay_triangulation_2.cpp Constrained_Delaunay_triangulation_2.moc ${CDT_UI_FILES} ${CDT_RESOURCE_FILES} )
-
-qt5_use_modules(Constrained_Delaunay_triangulation_2 Xml Script OpenGL Svg)
-
-add_to_cached_list( CGAL_EXECUTABLE_TARGETS Constrained_Delaunay_triangulation_2 )
-
-# Link with Qt libraries
-target_link_libraries( Constrained_Delaunay_triangulation_2 ${QT_LIBRARIES} )
-# Link with CGAL
-target_link_libraries( Constrained_Delaunay_triangulation_2 ${CGAL_LIBRARIES}  ${CGAL_3RD_PARTY_LIBRARIES})
-
-#--------------------------------
-# The "Delaunay" demo: Delaunay_triangulation_2
-#--------------------------------
-# UI files (Qt Designer files)
-qt5_wrap_ui( DT_UI_FILES Delaunay_triangulation_2.ui )
-
-# qrc files (resources files, that contain icons, at least)
-qt5_add_resources ( DT_RESOURCE_FILES ./Delaunay_triangulation_2.qrc )
-
-# use the Qt MOC preprocessor on classes that derives from QObject
-qt5_generate_moc( "Delaunay_triangulation_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Delaunay_triangulation_2.moc" )
-
-# The executable itself.
-add_executable  ( Delaunay_triangulation_2 Delaunay_triangulation_2.cpp Delaunay_triangulation_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} )
-
-qt5_use_modules(Delaunay_triangulation_2 Xml Script OpenGL Svg)
-
-add_to_cached_list( CGAL_EXECUTABLE_TARGETS Delaunay_triangulation_2 )
-
-# Link with Qt libraries
-target_link_libraries( Delaunay_triangulation_2 ${QT_LIBRARIES} )
-# Link with CGAL
-target_link_libraries( Delaunay_triangulation_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES})
-
-#--------------------------------
-# The "Regular" demo: Regular_triangulation_2
-#--------------------------------
-# UI files (Qt Designer files)
-qt5_wrap_ui( DT_UI_FILES Regular_triangulation_2.ui )
-
-# qrc files (resources files, that contain icons, at least)
-qt5_add_resources ( DT_RESOURCE_FILES ./Regular_triangulation_2.qrc )
-
-# use the Qt MOC preprocessor on classes that derives from QObject
-qt5_generate_moc( "Regular_triangulation_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Regular_triangulation_2.moc" )
-
-# The executable itself.
-add_executable  ( Regular_triangulation_2 Regular_triangulation_2.cpp Regular_triangulation_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} )
-
-qt5_use_modules(Regular_triangulation_2 Xml Script OpenGL Svg)
-
-add_to_cached_list( CGAL_EXECUTABLE_TARGETS Regular_triangulation_2 )
-
-# Link with Qt libraries
-target_link_libraries( Regular_triangulation_2 ${QT_LIBRARIES} )
-# Link with CGAL
-target_link_libraries( Regular_triangulation_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES})
-
-else()
-
-  message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
-
-endif()
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/Constrained_Delaunay_triangulation_2.cpp b/3rdparty/CGAL-4.8/demo/Triangulation_2/Constrained_Delaunay_triangulation_2.cpp
deleted file mode 100644
index 3dd25ad..0000000
--- a/3rdparty/CGAL-4.8/demo/Triangulation_2/Constrained_Delaunay_triangulation_2.cpp
+++ /dev/null
@@ -1,871 +0,0 @@
-//#define CGAL_USE_BOOST_BIMAP
-#define CGAL_MESH_2_OPTIMIZER_VERBOSE
-#define CGAL_MESH_2_OPTIMIZERS_DEBUG
-
-#include <fstream>
-#include <vector>
-#include <list>
-
-// CGAL headers
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-#include <CGAL/Constrained_Delaunay_triangulation_2.h>
-#include <CGAL/Delaunay_mesher_2.h>
-#include <CGAL/Delaunay_mesh_face_base_2.h>
-#include <CGAL/Delaunay_mesh_vertex_base_2.h>
-#include <CGAL/Delaunay_mesh_size_criteria_2.h>
-#include <CGAL/Mesh_2/Lipschitz_sizing_field_2.h>
-#include <CGAL/Lipschitz_sizing_field_criteria_2.h>
-#include <CGAL/Constrained_voronoi_diagram_2.h>
-#include <CGAL/Triangulation_conformer_2.h>
-#include <CGAL/lloyd_optimize_mesh_2.h>
-#include <CGAL/Random.h>
-#include <CGAL/point_generators_2.h>
-#include <CGAL/Timer.h>
-
-// Qt headers
-#include <QtGui>
-#include <QString>
-#include <QActionGroup>
-#include <QFileDialog>
-#include <QInputDialog>
-#include <QDragEnterEvent>
-#include <QDropEvent>
-#include <QMessageBox>
-
-// GraphicsView items and event filters (input classes)
-#include "TriangulationCircumcircle.h"
-#include "DelaunayMeshInsertSeeds.h"
-#include <CGAL/Qt/GraphicsViewPolylineInput.h>
-#include <CGAL/Qt/DelaunayMeshTriangulationGraphicsItem.h>
-#include <CGAL/Qt/Converter.h>
-
-// the two base classes
-#include "ui_Constrained_Delaunay_triangulation_2.h"
-#include <CGAL/Qt/DemosMainWindow.h>
-
-// for viewportsBbox(QGraphicsScene*)
-#include <CGAL/Qt/utility.h>
-
-typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
-typedef K::Point_2 Point_2;
-typedef K::Segment_2 Segment_2;
-typedef K::Iso_rectangle_2 Iso_rectangle_2;
-typedef CGAL::Delaunay_mesh_vertex_base_2<K>  Vertex_base;
-typedef CGAL::Delaunay_mesh_face_base_2<K> Face_base;
-
-typedef Face_base Fb;
-typedef CGAL::Triangulation_data_structure_2<Vertex_base, Fb>  TDS;
-typedef CGAL::Exact_predicates_tag              Itag;
-typedef CGAL::Constrained_Delaunay_triangulation_2<K, TDS, Itag> CDT;
-typedef CGAL::Constrained_voronoi_diagram_2<CDT> CVD;
-typedef CGAL::Delaunay_mesh_size_criteria_2<CDT> Criteria;
-
-typedef CGAL::Lipschitz_sizing_field_2<CDT> Lipschitz_sizing_field;
-typedef CGAL::Lipschitz_sizing_field_criteria_2<CDT, Lipschitz_sizing_field> Lipschitz_criteria;
-typedef CGAL::Delaunay_mesher_2<CDT, Lipschitz_criteria> Lipschitz_mesher;
-
-typedef CDT::Vertex_handle Vertex_handle;
-typedef CDT::Face_handle Face_handle;
-typedef CDT::All_faces_iterator All_faces_iterator;
-
-using namespace CGAL::parameters;
-
-void
-discoverInfiniteComponent(const CDT & ct)
-{
-  //when this function is called, all faces are set "in_domain"
-  Face_handle start = ct.infinite_face();
-  std::list<Face_handle> queue;
-  queue.push_back(start);
-
-  while(! queue.empty())
-  {
-    Face_handle fh = queue.front();
-    queue.pop_front();
-    fh->set_in_domain(false);
-	
-    for(int i = 0; i < 3; i++)
-    {
-      Face_handle fi = fh->neighbor(i);
-      if(fi->is_in_domain()
-        && !ct.is_constrained(CDT::Edge(fh,i)))
-        queue.push_back(fi);
-    }
-  }
-}
-
-template<typename SeedList>
-void 
-discoverComponents(const CDT & ct,
-                   const SeedList& seeds)
-{
-  if (ct.dimension() != 2)
-    return;
-
-  // tag all faces inside
-  for(typename CDT::All_faces_iterator fit = ct.all_faces_begin();
-      fit != ct.all_faces_end();
-      ++fit)
-      fit->set_in_domain(true);
-
-  // mark "outside" infinite component of the object
-  discoverInfiniteComponent(ct);
-
-  // mark "outside" components with a seed
-  for(typename SeedList::const_iterator sit = seeds.begin();
-      sit != seeds.end();
-      ++sit)
-  {
-    typename CDT::Face_handle fh_loc = ct.locate(*sit);
-
-    if(fh_loc == NULL || !fh_loc->is_in_domain())
-      continue;
-
-    std::list<typename CDT::Face_handle> queue;
-    queue.push_back(fh_loc);
-    while(!queue.empty())
-    {
-      typename CDT::Face_handle f = queue.front();
-      queue.pop_front();
-      f->set_in_domain(false);
-
-      for(int i = 0; i < 3; ++i)
-      {
-        typename CDT::Face_handle ni = f->neighbor(i);
-        if(ni->is_in_domain()
-          && !ct.is_constrained(typename CDT::Edge(f,i))) //same component
-        {
-          queue.push_back(ni);
-        }
-      }
-    }
-  }
-} 
-
-
-
-class MainWindow :
-  public CGAL::Qt::DemosMainWindow,
-  public Ui::Constrained_Delaunay_triangulation_2
-{
-  Q_OBJECT
-  
-private:  
-  CDT cdt; 
-  QGraphicsScene scene;
-  std::list<Point_2> m_seeds;
-
-  CGAL::Qt::DelaunayMeshTriangulationGraphicsItem<CDT> * dgi;
-
-  CGAL::Qt::GraphicsViewPolylineInput<K> * pi;
-  CGAL::Qt::TriangulationCircumcircle<CDT> *tcc;
-  CGAL::Qt::DelaunayMeshInsertSeeds<CDT> *dms;
-
-public:
-  MainWindow();
-
-  void clear();
-
-private:
-  template <typename Iterator> 
-  void insert_polyline(Iterator b, Iterator e)
-  {
-    Point_2 p, q;
-    typename CDT::Vertex_handle vh, wh;
-    Iterator it = b;
-    vh = cdt.insert(*it);
-    p = *it;
-    ++it;
-    for(; it != e; ++it){
-      q = *it;
-      if(p != q){
-        wh = cdt.insert(*it);
-        cdt.insert_constraint(vh,wh);
-        vh = wh;
-        p = q;
-      } else {
-        std::cout << "duplicate point: " << p << std::endl; 
-      }
-    }
-    Q_EMIT( changed());
-  }
-
-public Q_SLOTS:
-  void open(QString);
-
-  void processInput(CGAL::Object o);
-
-  void on_actionShowVertices_toggled(bool checked);
-
-  void on_actionShowDelaunay_toggled(bool checked);
-
-  void on_actionShowTriangulationInDomain_toggled(bool checked);
-
-  void on_actionShow_constrained_edges_toggled(bool checked);
-
-  void on_actionShow_voronoi_edges_toggled(bool checked);
-
-  void on_actionShow_faces_in_domain_toggled(bool checked);
-
-  void on_actionShow_blind_faces_toggled(bool checked);
-
-  void on_actionShow_seeds_toggled(bool checked);
-
-  void on_actionInsertPolyline_toggled(bool checked);
-  
-  void on_actionInsertSeeds_OnOff_toggled(bool checked);
-  
-  void on_actionCircumcenter_toggled(bool checked);
-
-  void on_actionClear_triggered();
-
-  void on_actionRecenter_triggered();
-
-  void on_actionLoadConstraints_triggered();
-
-  void loadFile(QString);
-
-  void loadPolygonConstraints(QString);
-
-  void loadEdgConstraints(QString);
-
-  void on_actionSaveConstraints_triggered();
-
-  void saveConstraints(QString);
-
-  void on_actionMakeGabrielConform_triggered();
-
-  void on_actionMakeDelaunayConform_triggered();
-
-  void on_actionMakeDelaunayMesh_triggered();
-
-  void on_actionMakeLipschitzDelaunayMesh_triggered();
-
-  void on_actionInsertRandomPoints_triggered();
-
-  void on_actionTagBlindFaces_triggered();
-
-  void on_actionLloyd_optimization_triggered();
-
-Q_SIGNALS:
-  void changed();
-};
-
-
-MainWindow::MainWindow()
-  : DemosMainWindow()
-{
-  setupUi(this);
-
-  this->graphicsView->setAcceptDrops(false);
-
-  // Add a GraphicItem for the CDT triangulation
-  dgi = new CGAL::Qt::DelaunayMeshTriangulationGraphicsItem<CDT>(&cdt);
-  QColor facesColor(::Qt::blue);
-  facesColor.setAlpha(150);
-  dgi->setFacesInDomainBrush(facesColor);
-    
-  QObject::connect(this, SIGNAL(changed()),
-		   dgi, SLOT(modelChanged()));
-  dgi->setVerticesPen(
-    QPen(Qt::red, 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
-  dgi->setVoronoiPen(
-    QPen(Qt::darkGreen, 0, Qt::DashLine, Qt::RoundCap, Qt::RoundJoin));
-  dgi->setSeedsPen(
-    QPen(Qt::darkBlue, 0, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
-
-  dgi->setZValue(-1);
-  scene.addItem(dgi);
-
-  // Setup input handlers. They get events before the scene gets them
-  // and the input they generate is passed to the triangulation with 
-  // the signal/slot mechanism    
-  pi = new CGAL::Qt::GraphicsViewPolylineInput<K>(this, &scene, 0, true); // inputs polylines which are not closed
-  QObject::connect(pi, SIGNAL(generate(CGAL::Object)),
-		   this, SLOT(processInput(CGAL::Object)));
-    
-  tcc = new CGAL::Qt::TriangulationCircumcircle<CDT>(&scene, &cdt, this);
-  tcc->setPen(QPen(Qt::red, 0, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
-  
-  dms = new CGAL::Qt::DelaunayMeshInsertSeeds<CDT>(&scene, &cdt, this);//input seeds
-  QObject::connect(dms, SIGNAL(generate(CGAL::Object)),
-                   this, SLOT(processInput(CGAL::Object)));
-
-  // 
-  // Manual handling of actions
-  //
-  QObject::connect(this->actionQuit, SIGNAL(triggered()), 
-		   this, SLOT(close()));
-
-  // We put mutually exclusive actions in an QActionGroup
-  QActionGroup* ag = new QActionGroup(this);
-  ag->addAction(this->actionInsertPolyline);
-
-  // Check two actions 
-  this->actionInsertPolyline->setChecked(true);
-  this->actionShowDelaunay->setChecked(true);
-  this->actionShowVertices->setChecked(true);
-  this->actionShowTriangulationInDomain->setChecked(false);
-  this->actionShow_faces_in_domain->setChecked(true);
-  this->actionShow_constrained_edges->setChecked(true);
-  this->actionShow_voronoi_edges->setChecked(false);
-  this->actionShow_seeds->setChecked(false);
-  this->actionInsertSeeds_OnOff->setChecked(false);
-
-  //
-  // Setup the scene and the view
-  //
-  scene.setItemIndexMethod(QGraphicsScene::NoIndex);
-  scene.setSceneRect(-100, -100, 100, 100);
-  this->graphicsView->setScene(&scene);
-  this->graphicsView->setMouseTracking(true);
-
-  // Turn the vertical axis upside down
-  this->graphicsView->scale(1, -1);
-                                                      
-  // The navigation adds zooming and translation functionality to the
-  // QGraphicsView
-  this->addNavigation(this->graphicsView);
-
-  this->setupStatusBar();
-  this->setupOptionsMenu();
-  this->addAboutDemo(":/cgal/help/about_Constrained_Delaunay_triangulation_2.html");
-  this->addAboutCGAL();
-  this->setupExportSVG(this->actionExport_SVG, this->graphicsView);
-
-  this->addRecentFiles(this->menuFile, this->actionQuit);
-  connect(this, SIGNAL(openRecentFile(QString)),
-	  this, SLOT(open(QString)));
-}
-
-
-void
-MainWindow::processInput(CGAL::Object o)
-{
-  // Polygon
-  std::list<Point_2> points;
-  if(CGAL::assign(points, o))
-  {
-    if(points.size() == 1)
-      cdt.insert(points.front());
-    else
-      insert_polyline(points.begin(), points.end());
-    }
-  else
-  {
-    // Seed (from Shift + left clic)
-    Point_2 p;
-    if(CGAL::assign(p, o))
-    {
-      m_seeds.push_back(p);
-      if(actionShow_seeds->isChecked())
-        dgi->setVisibleSeeds(true, m_seeds.begin(), m_seeds.end());
-    }
-  }
-
-  discoverComponents(cdt, m_seeds);
-  Q_EMIT( changed());
-}
-
-
-/* 
- *  Qt Automatic Connections
- *  http://doc.qt.io/qt-5/designer-using-a-ui-file.html#automatic-connections
- * 
- *  setupUi(this) generates connections to the slots named
- *  "on_<action_name>_<signal_name>"
- */
-void
-MainWindow::on_actionInsertPolyline_toggled(bool checked)
-{
-  if(checked){
-    scene.installEventFilter(pi);
-  } else {
-    scene.removeEventFilter(pi);
-  }
-}
-
-void
-MainWindow::on_actionInsertSeeds_OnOff_toggled(bool checked)
-{
-  if(checked){
-    std::cout << "Insert seeds with Shift + Left click" << std::endl;
-    scene.installEventFilter(dms);
-  } else {
-    scene.removeEventFilter(dms);
-  }
-}
-
-void
-MainWindow::on_actionShowDelaunay_toggled(bool checked)
-{
-  dgi->setVisibleEdges(checked);
-  if(checked)
-  {
-    dgi->setVisibleInsideEdges(false);
-    actionShowTriangulationInDomain->setChecked(false);
-  }
-  update();
-}
-
-void
-MainWindow::on_actionShowVertices_toggled(bool checked)
-{
-  dgi->setVisibleVertices(checked);
-  update();
-}
-
-void
-MainWindow::on_actionShowTriangulationInDomain_toggled(bool checked)
-{
-  dgi->setVisibleInsideEdges(checked);
-  if(checked)
-  {
-    dgi->setVisibleEdges(false);
-    actionShowDelaunay->setChecked(false);
-  }
-  update();
-}
-
-void
-MainWindow::on_actionShow_constrained_edges_toggled(bool checked)
-{
-  dgi->setVisibleConstraints(checked);
-  update();
-}
-
-void
-MainWindow::on_actionShow_voronoi_edges_toggled(bool checked)
-{
-  dgi->setVisibleVoronoiEdges(checked);
-  update();
-}
-
-void
-MainWindow::on_actionShow_faces_in_domain_toggled(bool checked)
-{
-  dgi->setVisibleFacesInDomain(checked);
-  update();
-}
-
-void
-MainWindow::on_actionShow_blind_faces_toggled(bool checked)
-{
-  dgi->setVisibleBlindFaces(checked);
-  update();
-}
-
-void
-MainWindow::on_actionShow_seeds_toggled(bool checked)
-{
-  dgi->setVisibleSeeds(checked, m_seeds.begin(), m_seeds.end());
-  update();
-}
-
-void
-MainWindow::on_actionCircumcenter_toggled(bool checked)
-{
-  if(checked){
-    scene.installEventFilter(tcc);
-    tcc->show();
-  } else {  
-    scene.removeEventFilter(tcc);
-    tcc->hide();
-  }
-}
-
-
-void
-MainWindow::on_actionClear_triggered()
-{
-  clear();
-  Q_EMIT( changed());
-}
-
-void
-MainWindow::clear()
-{
-  cdt.clear();
-  m_seeds.clear();
-
-  if(actionShow_seeds->isChecked())
-    dgi->setVisibleSeeds(true, m_seeds.end(), m_seeds.end());
-}
-
-void 
-MainWindow::open(QString fileName)
-{
-  if(! fileName.isEmpty()){
-    if(cdt.number_of_vertices() > 0)
-    {
-      QMessageBox msgBox(QMessageBox::Warning,
-        "Open new polygon",
-        "Do you really want to clear the current mesh?",
-        (QMessageBox::Yes | QMessageBox::No),
-        this);
-      int ret = msgBox.exec();
-      if(ret == QMessageBox::Yes)
-        clear();
-      else
-        return;
-    }
-    if(fileName.endsWith(".cgal")){
-      loadFile(fileName);
-      this->addToRecentFiles(fileName);
-    } else if(fileName.endsWith(".plg")){
-      loadPolygonConstraints(fileName);
-      this->addToRecentFiles(fileName);
-    } else if(fileName.endsWith(".edg")){
-      loadEdgConstraints(fileName);
-      this->addToRecentFiles(fileName);
-    }
-  }
-  Q_EMIT(changed());
-  actionRecenter->trigger();
-}
-
-void
-MainWindow::on_actionLoadConstraints_triggered()
-{
-  QString fileName = QFileDialog::getOpenFileName(this,
-						  tr("Open Constraint File"),
-						  ".",
-						  tr("Edge files (*.edg);;"
-						     "Poly files (*.plg)"));
-  open(fileName);
-}
-
-void
-MainWindow::loadFile(QString fileName)
-{
-  std::ifstream ifs(qPrintable(fileName));
-  ifs >> cdt;
-  if(!ifs) abort();
-  discoverComponents(cdt, m_seeds);
-  Q_EMIT( changed());
-  actionRecenter->trigger();
-}
-
-void
-MainWindow::loadPolygonConstraints(QString fileName)
-{
-  K::Point_2 p,q, first;
-  CDT::Vertex_handle vp, vq, vfirst;
-  std::ifstream ifs(qPrintable(fileName));
-  int n;
-  // int counter = 0;
-  while(ifs >> n){
-    int poly_size = n;
-    ifs >> first;
-    p = first;
-    vfirst = vp = cdt.insert(p);
-    n--;
-    while(n--){
-      ifs >> q;
-      vq = cdt.insert(q, vp->face());
-      if(vp != vq) {
-        cdt.insert_constraint(vp,vq);
-        // std::cerr << "inserted constraint #" << counter++ << std::endl;
-      }
-      p = q;
-      vp = vq;
-    }
-    if(poly_size != 2 && vp != vfirst) {
-      cdt.insert_constraint(vp, vfirst);
-    }
-  }
-  
-  discoverComponents(cdt, m_seeds);
-  Q_EMIT( changed());
-  actionRecenter->trigger();
-}
-
-
-void
-MainWindow::loadEdgConstraints(QString fileName)
-{
-  // wait cursor
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-  CGAL::Timer tim;
-  tim.start();
-  std::ifstream ifs(qPrintable(fileName));
-  bool first=true;
-  int n;
-  ifs >> n;
-  
-  K::Point_2 p,q, qold;
-
-  CDT::Vertex_handle vp, vq, vqold;
-  while(ifs >> p) {
-    ifs >> q;
-    if(p == q){
-      continue;
-    }
-    if((!first) && (p == qold)){
-      vp = vqold;
-    } else {
-      vp = cdt.insert(p);
-    }
-    vq = cdt.insert(q, vp->face());
-    if(vp != vq) {
-      cdt.insert_constraint(vp,vq);
-    }
-    qold = q;
-    vqold = vq;
-    first = false;
-  }
-
-
-  tim.stop();
-  statusBar()->showMessage(QString("Insertion took %1 seconds").arg(tim.time()), 2000);
-  discoverComponents(cdt, m_seeds);
-  // default cursor
-  QApplication::restoreOverrideCursor();
-  Q_EMIT( changed());
-  actionRecenter->trigger();
-}
-
-void
-MainWindow::on_actionRecenter_triggered()
-{
-  this->graphicsView->setSceneRect(dgi->boundingRect());
-  this->graphicsView->fitInView(dgi->boundingRect(), Qt::KeepAspectRatio);  
-}
-
-
-void
-MainWindow::on_actionSaveConstraints_triggered()
-{
-  QString fileName = QFileDialog::getSaveFileName(this,
-						  tr("Save Constraints"),
-						  ".",
-						  tr("Poly files (*.poly)\n"
-						     "Edge files (*.edg)"));
-  if(! fileName.isEmpty()){
-    saveConstraints(fileName);
-  }
-}
-
-
-void
-MainWindow::saveConstraints(QString fileName)
-{
-  std::ofstream output(qPrintable(fileName));
-  if (output) output << cdt;
-}
-
-
-void
-MainWindow::on_actionMakeGabrielConform_triggered()
-{
-  // wait cursor
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-  std::size_t nv = cdt.number_of_vertices();
-  CGAL::make_conforming_Gabriel_2(cdt);
-  nv = cdt.number_of_vertices() - nv;
-  discoverComponents(cdt, m_seeds);
-  statusBar()->showMessage(QString("Added %1 vertices").arg(nv), 2000);
-  // default cursor
-  QApplication::restoreOverrideCursor();
-  Q_EMIT( changed());
-}
-
-
-void
-MainWindow::on_actionMakeDelaunayConform_triggered()
-{
-  // wait cursor
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-  std::size_t nv = cdt.number_of_vertices();
-  CGAL::make_conforming_Delaunay_2(cdt);
-  discoverComponents(cdt, m_seeds);
-  nv = cdt.number_of_vertices() - nv;
-  statusBar()->showMessage(QString("Added %1 vertices").arg(nv), 2000);
-   // default cursor
-  QApplication::restoreOverrideCursor();
-  Q_EMIT( changed());
-}
-
-
-void
-MainWindow::on_actionMakeDelaunayMesh_triggered()
-{
-  // wait cursor
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-  CGAL::Timer timer;
-  timer.start();
-  discoverComponents(cdt, m_seeds);
-  timer.stop();
-  QApplication::restoreOverrideCursor();
-
-  bool ok;
-  double shape = QInputDialog::getDouble(this, tr("Shape criterion"),
-    tr("B = "), 0.125, 0.005, 100, 4, &ok);
-  if(!ok) return;
-
-  double edge_len = QInputDialog::getDouble(this, tr("Size criterion"),
-    tr("S = "), 0., 0., (std::numeric_limits<double>::max)(), 5, &ok);
-  if(!ok) return;
-
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-  std::size_t nv = cdt.number_of_vertices();
-  timer.start();
-
-  CGAL::refine_Delaunay_mesh_2(cdt,
-      m_seeds.begin(), m_seeds.end(),
-      Criteria(shape, edge_len),
-      false);//mesh the subdomains including NO seed
-
-  timer.stop();
-  nv = cdt.number_of_vertices() - nv;
-  statusBar()->showMessage(QString("Added %1 vertices in %2 seconds").arg(nv).arg(timer.time()), 2000);
-  // default cursor
-  QApplication::restoreOverrideCursor();
-  Q_EMIT( changed());
-}
-
-void
-MainWindow::on_actionMakeLipschitzDelaunayMesh_triggered()
-{
-  // wait cursor
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-  std::set<Point_2> points;
-  for(CDT::Finite_edges_iterator it = cdt.finite_edges_begin();
-      it != cdt.finite_edges_end();
-      ++it){
-    if(cdt.is_constrained(*it)){
-      Segment_2 s = cdt.segment(*it);
-      points.insert(s.source());
-      points.insert(s.target());
-    }
-  }
-
-  discoverComponents(cdt, m_seeds);
-
-  bool ok;
-  double shape = QInputDialog::getDouble(this, tr("Shape criterion"),
-    tr("B = "), 0.125, 0.005, 100, 4, &ok);
-  if(!ok) return;
-  double klip = QInputDialog::getDouble(this, tr("k-Lipschitz sizing field"),
-    tr("k = "), 1., 0.01, 500, 5, &ok);
-  if(!ok) return;
-
-  Lipschitz_sizing_field field(points.begin(), points.end(), klip);
-  Lipschitz_criteria criteria(shape, &field);
-  Lipschitz_mesher mesher(cdt);
-  mesher.set_criteria(criteria);
-
-  std::size_t nv = cdt.number_of_vertices();
-  mesher.init(true);
-  mesher.set_seeds(m_seeds.begin(), m_seeds.end(),
-                   false);//mesh the subdomains including NO seed
-
-  mesher.refine_mesh();
-  nv = cdt.number_of_vertices() - nv;
-  statusBar()->showMessage(QString("Added %1 vertices").arg(nv), 2000);
-  // default cursor
-  QApplication::restoreOverrideCursor();
-  Q_EMIT( changed());
-}
-
-void
-MainWindow::on_actionInsertRandomPoints_triggered()
-{
-  QRectF rect = CGAL::Qt::viewportsBbox(&scene);
-  CGAL::Qt::Converter<K> convert;
-  Iso_rectangle_2 isor = convert(rect);
-  CGAL::Random_points_in_iso_rectangle_2<Point_2> pg((isor.min)(), (isor.max)());
-  bool ok = false;
-
-  const int number_of_points = 
-    QInputDialog::getInt(this, 
-                             tr("Number of random points"),
-                             tr("Enter number of random points"),
-			     100,
-			     0,
-			     (std::numeric_limits<int>::max)(),
-			     1,
-			     &ok);
-
-  if(!ok) {
-    return;
-  }
-
-  // wait cursor
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-  std::vector<Point_2> points;
-  points.reserve(number_of_points);
-  for(int i = 0; i < number_of_points; ++i){
-    points.push_back(*pg++);
-  }
-  cdt.insert(points.begin(), points.end());
-  // default cursor
-  QApplication::restoreOverrideCursor();
-  Q_EMIT( changed());
-}
-
-void
-MainWindow::on_actionTagBlindFaces_triggered()
-{
-  // wait cursor
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-
-  CVD voronoi(cdt);
-  voronoi.tag_faces_blind();
-
-  // default cursor
-  QApplication::restoreOverrideCursor();
-  Q_EMIT(changed());
-}
-
-void
-MainWindow::on_actionLloyd_optimization_triggered()
-{
-  // wait cursor
-  QApplication::setOverrideCursor(Qt::WaitCursor);
-
-  bool ok;
-  int nb = QInputDialog::getInt(this, tr("QInputDialog::getInteger()"),
-    tr("Number of iterations :"),
-    1/*val*/, 0/*min*/, 1000/*max*/, 1/*step*/, &ok);
-  if(!ok)
-  {
-    QApplication::restoreOverrideCursor();
-    return;
-  }
-
-  CGAL::lloyd_optimize_mesh_2(cdt,
-      max_iteration_number = nb,
-      seeds_begin = m_seeds.begin(),
-      seeds_end = m_seeds.end());
-
-  // default cursor
-  QApplication::restoreOverrideCursor();
-  Q_EMIT(changed());
-}
-
-#include "Constrained_Delaunay_triangulation_2.moc"
-#include <CGAL/Qt/resources.h>
-
-int main(int argc, char **argv)
-{
-  QApplication app(argc, argv);
-
-  app.setOrganizationDomain("geometryfactory.com");
-  app.setOrganizationName("GeometryFactory");
-  app.setApplicationName("Constrained_Delaunay_triangulation_2 demo");
-
-  // Import resources from libCGAL (Qt5).
-  CGAL_QT_INIT_RESOURCES;
-
-  MainWindow mainWindow;
-  mainWindow.show();
-
-  QStringList args = app.arguments();
-  args.removeAt(0);
-  Q_FOREACH(QString filename, args) {
-    mainWindow.open(filename);
-  }
-
-  return app.exec();
-}
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Triangulation_3/CMakeLists.txt
deleted file mode 100644
index 20cba24..0000000
--- a/3rdparty/CGAL-4.8/demo/Triangulation_3/CMakeLists.txt
+++ /dev/null
@@ -1,99 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-project (Triangulation_demo_3)
-
-# Find includes in corresponding build directories
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-# Instruct CMake to run moc automatically when needed.
-set(CMAKE_AUTOMOC ON)
-
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-find_package(CGAL  COMPONENTS Qt5)
-include(${CGAL_USE_FILE})
-
-
-find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL)
-
-find_package(OpenGL)
-
-if(Qt5_FOUND)
-  add_definitions(-DQT_NO_KEYWORDS)
-  find_package(QGLViewer)
-endif(Qt5_FOUND)
-
-# Activate concurrency ? (turned OFF by default)
-option(ACTIVATE_CONCURRENT_TRIANGULATION_3
-  "Activate parallelism in Triangulation_3"
-  OFF)
-  
-# And add -DCGAL_CONCURRENT_TRIANGULATION_3 if that option is ON
-if( ACTIVATE_CONCURRENT_TRIANGULATION_3 )
-  add_definitions( -DCGAL_CONCURRENT_TRIANGULATION_3 )
-  find_package( TBB REQUIRED )
-else( ACTIVATE_CONCURRENT_TRIANGULATION_3 )
-  option( LINK_WITH_TBB
-    "Link with TBB anyway so we can use TBB timers for profiling"
-    ON)
-  if( LINK_WITH_TBB )
-    find_package( TBB )
-  endif( LINK_WITH_TBB )
-endif()
-
-if( TBB_FOUND )
-  include(${TBB_USE_FILE})
-endif()
-
-if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND )
-
-  include_directories (${QGLVIEWER_INCLUDE_DIR})
-  include_directories (BEFORE ../../include ./ )
-
-  # ui files, created with Qt Designer
-  qt5_wrap_ui( uis MainWindow.ui )
-
-  # qrc files (resources files, that contain icons, at least)
-  qt5_add_resources ( RESOURCE_FILES ./T3_demo.qrc )
-
-
-  # cpp files
-  add_executable  ( T3_demo T3_demo.cpp
-                    MainWindow.cpp Viewer.cpp
-                    PreferenceDlg.cpp
-                    Scene.cpp ${uis}  ${RESOURCE_FILES} )
-
-  qt5_use_modules(T3_demo Xml Script OpenGL)
-  add_to_cached_list( CGAL_EXECUTABLE_TARGETS T3_demo )
-
-  target_link_libraries( T3_demo ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES})
-  target_link_libraries( T3_demo ${QT_LIBRARIES} ${QGLVIEWER_LIBRARIES} ${TBB_LIBRARIES})
-  target_link_libraries( T3_demo ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} )
-
-else( CGAL_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND )
-
-  set(TRIANGULATION_3_MISSING_DEPS "")
-
-  if(NOT CGAL_Qt5_FOUND)
-    set(TRIANGULATION_3_MISSING_DEPS "the CGAL Qt5 library, ${TRIANGULATION_3_MISSING_DEPS}")
-  endif()      	   
-
-  if(NOT Qt5_FOUND)
-    set(TRIANGULATION_3_MISSING_DEPS "Qt5, ${TRIANGULATION_3_MISSING_DEPS}")
-  endif()      	   
-
-  if(NOT OPENGL_FOUND)
-    set(TRIANGULATION_3_MISSING_DEPS "OpenGL, ${TRIANGULATION_3_MISSING_DEPS}")
-  endif()      	   
-
-  if(NOT QGLVIEWER_FOUND)
-    set(TRIANGULATION_3_MISSING_DEPS "QGLViewer, ${TRIANGULATION_3_MISSING_DEPS}")
-  endif()      	   
-
-
-  message(STATUS "NOTICE: This demo requires ${TRIANGULATION_3_MISSING_DEPS}and will not be compiled.")
-
-endif( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND )
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3_Geomview_demos/CMakeLists.txt b/3rdparty/CGAL-4.8/demo/Triangulation_3_Geomview_demos/CMakeLists.txt
deleted file mode 100644
index 82989fc..0000000
--- a/3rdparty/CGAL-4.8/demo/Triangulation_3_Geomview_demos/CMakeLists.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Triangulation_3_Demo )
-
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  create_single_source_cgal_program( "Triangulation_3_demo.cpp" )
-  create_single_source_cgal_program( "Triangulation_3_color_demo.cpp" )
-  create_single_source_cgal_program( "Triangulation_3_remove_demo.cpp" )
-  create_single_source_cgal_program( "Triangulation_3_voronoi_demo.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/AABB_tree/AABB_polyhedron_facet_intersection_example.cpp b/3rdparty/CGAL-4.8/examples/AABB_tree/AABB_polyhedron_facet_intersection_example.cpp
deleted file mode 100644
index 6451be1..0000000
--- a/3rdparty/CGAL-4.8/examples/AABB_tree/AABB_polyhedron_facet_intersection_example.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-// Author(s) : Camille Wormser, Pierre Alliez
-
-#include <iostream>
-#include <list>
-
-#include <CGAL/Simple_cartesian.h>
-#include <CGAL/AABB_tree.h>
-#include <CGAL/AABB_traits.h>
-#include <CGAL/Polyhedron_3.h>
-#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
-#include <CGAL/AABB_face_graph_triangle_primitive.h>
-
-typedef CGAL::Simple_cartesian<double> K;
-typedef K::Point_3 Point;
-typedef K::Plane_3 Plane;
-typedef K::Vector_3 Vector;
-typedef K::Segment_3 Segment;
-typedef CGAL::Polyhedron_3<K> Polyhedron;
-typedef CGAL::AABB_face_graph_triangle_primitive<Polyhedron> Primitive;
-typedef CGAL::AABB_traits<K, Primitive> Traits;
-typedef CGAL::AABB_tree<Traits> Tree;
-typedef boost::optional< Tree::Intersection_and_primitive_id<Segment>::Type > Segment_intersection;
-typedef boost::optional< Tree::Intersection_and_primitive_id<Plane>::Type > Plane_intersection;
-typedef Tree::Primitive_id Primitive_id;
-
-int main()
-{
-    Point p(1.0, 0.0, 0.0);
-    Point q(0.0, 1.0, 0.0);
-    Point r(0.0, 0.0, 1.0);
-    Point s(0.0, 0.0, 0.0);
-    Polyhedron polyhedron;
-    polyhedron.make_tetrahedron(p, q, r, s);
-
-    // constructs AABB tree
-    Tree tree(faces(polyhedron).first, faces(polyhedron).second, polyhedron);
-
-    // constructs segment query
-    Point a(-0.2, 0.2, -0.2);
-    Point b(1.3, 0.2, 1.3);
-    Segment segment_query(a,b);
-
-    // tests intersections with segment query
-    if(tree.do_intersect(segment_query))
-        std::cout << "intersection(s)" << std::endl;
-    else
-        std::cout << "no intersection" << std::endl;
-
-    // computes #intersections with segment query
-    std::cout << tree.number_of_intersected_primitives(segment_query)
-        << " intersection(s)" << std::endl;
-
-    // computes first encountered intersection with segment query
-    // (generally a point)
-    Segment_intersection intersection =
-        tree.any_intersection(segment_query);
-    if(intersection)
-    {
-        // gets intersection object
-      if(boost::get<Point>(&(intersection->first)))
-        std::cout << "intersection object is a point" << std::endl;
-    }
-
-    // computes all intersections with segment query (as pairs object - primitive_id)
-    std::list<Segment_intersection> intersections;
-    tree.all_intersections(segment_query, std::back_inserter(intersections));
-
-    // computes all intersected primitives with segment query as primitive ids
-    std::list<Primitive_id> primitives;
-    tree.all_intersected_primitives(segment_query, std::back_inserter(primitives));
-
-    // constructs plane query
-    Vector vec(0.0,0.0,1.0);
-    Plane plane_query(a,vec);
-
-    // computes first encountered intersection with plane query
-    // (generally a segment)
-    Plane_intersection plane_intersection = tree.any_intersection(plane_query);
-    if(plane_intersection)
-    {
-      
-      if(boost::get<Segment>(&(plane_intersection->first)))
-            std::cout << "intersection object is a segment" << std::endl;
-    }
-
-    return EXIT_SUCCESS;
-}
diff --git a/3rdparty/CGAL-4.8/examples/AABB_tree/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/AABB_tree/CMakeLists.txt
deleted file mode 100644
index 4106721..0000000
--- a/3rdparty/CGAL-4.8/examples/AABB_tree/CMakeLists.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( AABB_tree_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "AABB_custom_example.cpp" )
-  create_single_source_cgal_program( "AABB_custom_indexed_triangle_set_array_example.cpp" )
-  create_single_source_cgal_program( "AABB_custom_indexed_triangle_set_example.cpp" )
-  create_single_source_cgal_program( "AABB_custom_triangle_soup_example.cpp" )
-  create_single_source_cgal_program( "AABB_face_graph_triangle_example.cpp" )
-  create_single_source_cgal_program( "AABB_halfedge_graph_edge_example.cpp" )
-  create_single_source_cgal_program( "AABB_insertion_example.cpp" )
-  create_single_source_cgal_program( "AABB_polyhedron_edge_example.cpp" )
-  create_single_source_cgal_program( "AABB_polyhedron_facet_distance_example.cpp" )
-  create_single_source_cgal_program( "AABB_polyhedron_facet_intersection_example.cpp" )
-  create_single_source_cgal_program( "AABB_segment_3_example.cpp" )
-  create_single_source_cgal_program( "AABB_triangle_3_example.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Advancing_front_surface_reconstruction/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Advancing_front_surface_reconstruction/CMakeLists.txt
deleted file mode 100644
index a06965f..0000000
--- a/3rdparty/CGAL-4.8/examples/Advancing_front_surface_reconstruction/CMakeLists.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Advancing_front_surface_reconstruction_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "boundaries.cpp" )
-  create_single_source_cgal_program( "reconstruction_class.cpp" )
-  create_single_source_cgal_program( "reconstruction_fct.cpp" )
-  create_single_source_cgal_program( "reconstruction_surface_mesh.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Algebraic_foundations/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Algebraic_foundations/CMakeLists.txt
deleted file mode 100644
index 6ca9c39..0000000
--- a/3rdparty/CGAL-4.8/examples/Algebraic_foundations/CMakeLists.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Algebraic_foundations_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "algebraic_structure_dispatch.cpp" )
-  create_single_source_cgal_program( "fraction_traits.cpp" )
-  create_single_source_cgal_program( "implicit_interoperable_dispatch.cpp" )
-  create_single_source_cgal_program( "integralize.cpp" )
-  create_single_source_cgal_program( "interoperable.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Alpha_shapes_2/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Alpha_shapes_2/CMakeLists.txt
deleted file mode 100644
index 6b465b0..0000000
--- a/3rdparty/CGAL-4.8/examples/Alpha_shapes_2/CMakeLists.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Alpha_shapes_2_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "ex_alpha_shapes_2.cpp" )
-  create_single_source_cgal_program( "ex_weighted_alpha_shapes_2.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Alpha_shapes_3/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Alpha_shapes_3/CMakeLists.txt
deleted file mode 100644
index 35aec41..0000000
--- a/3rdparty/CGAL-4.8/examples/Alpha_shapes_3/CMakeLists.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Alpha_shapes_3_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "ex_alpha_shapes_3.cpp" )
-  create_single_source_cgal_program( "ex_alpha_shapes_exact_alpha.cpp" )
-  create_single_source_cgal_program( "ex_alpha_shapes_with_fast_location_3.cpp" )
-  create_single_source_cgal_program( "ex_fixed_weighted_alpha_shapes_3.cpp" )
-  create_single_source_cgal_program( "ex_periodic_alpha_shapes_3.cpp" )
-  create_single_source_cgal_program( "ex_weighted_alpha_shapes_3.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Apollonius_graph_2/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Apollonius_graph_2/CMakeLists.txt
deleted file mode 100644
index 9f97c4e..0000000
--- a/3rdparty/CGAL-4.8/examples/Apollonius_graph_2/CMakeLists.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Apollonius_graph_2_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "ag2_exact_traits.cpp" )
-  create_single_source_cgal_program( "ag2_exact_traits_sqrt.cpp" )
-  create_single_source_cgal_program( "ag2_filtered_traits_no_hidden.cpp" )
-  create_single_source_cgal_program( "ag2_hierarchy.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/CMakeLists.txt
deleted file mode 100644
index 1ae57dc..0000000
--- a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/CMakeLists.txt
+++ /dev/null
@@ -1,78 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Arrangement_on_surface_2_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "Bezier_curves.cpp" )
-  create_single_source_cgal_program( "aggregated_insertion.cpp" )
-  create_single_source_cgal_program( "algebraic_curves.cpp" )
-  create_single_source_cgal_program( "algebraic_segments.cpp" )
-  create_single_source_cgal_program( "batched_point_location.cpp" )
-  create_single_source_cgal_program( "bgl_dual_adapter.cpp" )
-  create_single_source_cgal_program( "bgl_primal_adapter.cpp" )
-  create_single_source_cgal_program( "bounded_planar_vertical_decomposition.cpp" )
-  create_single_source_cgal_program( "circles.cpp" )
-  create_single_source_cgal_program( "circular_arcs.cpp" )
-  create_single_source_cgal_program( "circular_line_arcs.cpp" )
-  create_single_source_cgal_program( "conic_multiplicities.cpp" )
-  create_single_source_cgal_program( "conics.cpp" )
-  create_single_source_cgal_program( "consolidated_curve_data.cpp" )
-  create_single_source_cgal_program( "curve_history.cpp" )
-  create_single_source_cgal_program( "dcel_extension.cpp" )
-  create_single_source_cgal_program( "dcel_extension_io.cpp" )
-  create_single_source_cgal_program( "dual_lines.cpp" )
-  create_single_source_cgal_program( "dual_with_data.cpp" )
-  create_single_source_cgal_program( "edge_insertion.cpp" )
-  create_single_source_cgal_program( "edge_manipulation.cpp" )
-  create_single_source_cgal_program( "edge_manipulation_curve_history.cpp" )
-  create_single_source_cgal_program( "face_extension.cpp" )
-  create_single_source_cgal_program( "face_extension_overlay.cpp" )
-  create_single_source_cgal_program( "generic_curve_data.cpp" )
-  create_single_source_cgal_program( "global_insertion.cpp" )
-  create_single_source_cgal_program( "global_removal.cpp" )
-  create_single_source_cgal_program( "incremental_insertion.cpp" )
-  create_single_source_cgal_program( "io.cpp" )
-  create_single_source_cgal_program( "io_curve_history.cpp" )
-  create_single_source_cgal_program( "io_unbounded.cpp" )
-  create_single_source_cgal_program( "isolated_vertices.cpp" )
-  create_single_source_cgal_program( "observer.cpp" )
-  create_single_source_cgal_program( "overlay.cpp" )
-  create_single_source_cgal_program( "overlay_unbounded.cpp" )
-  create_single_source_cgal_program( "point_location_example.cpp" )
-  create_single_source_cgal_program( "polycurve_bezier.cpp" )
-  create_single_source_cgal_program( "polycurve_circular_arc.cpp" )
-  create_single_source_cgal_program( "polycurve_conic.cpp" )
-  create_single_source_cgal_program( "polycurve_geodesic.cpp" )
-  create_single_source_cgal_program( "polycurves_basic.cpp" )
-  create_single_source_cgal_program( "polylines.cpp" )
-  create_single_source_cgal_program( "predefined_kernel.cpp" )
-  create_single_source_cgal_program( "predefined_kernel_non_intersecting.cpp" )
-  create_single_source_cgal_program( "rational_functions.cpp" )
-  create_single_source_cgal_program( "rational_functions_rational_coefficients.cpp" )
-  create_single_source_cgal_program( "special_edge_insertion.cpp" )
-  create_single_source_cgal_program( "spherical_insert.cpp" )
-  create_single_source_cgal_program( "tracing_counting.cpp" )
-  create_single_source_cgal_program( "unb_planar_vertical_decomposition.cpp" )
-  create_single_source_cgal_program( "unbounded_non_intersecting.cpp" )
-  create_single_source_cgal_program( "unbounded_rational_functions.cpp" )
-  create_single_source_cgal_program( "vertical_ray_shooting.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/BGL_polyhedron_3/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/BGL_polyhedron_3/CMakeLists.txt
deleted file mode 100644
index a84cf74..0000000
--- a/3rdparty/CGAL-4.8/examples/BGL_polyhedron_3/CMakeLists.txt
+++ /dev/null
@@ -1,73 +0,0 @@
-# Created by the script cgal_create_CMakeLists
-# This is the CMake script for compiling a set of CGAL applications.
-
-project( BGL_polyhedron_3 )
-
-
-cmake_minimum_required(VERSION 2.8.11)
-
-# CGAL and its components
-find_package( CGAL QUIET COMPONENTS  )
-
-if ( NOT CGAL_FOUND )
-
-  message(STATUS "This project requires the CGAL library, and will not be compiled.")
-  return()  
-
-endif()
-
-# include helper file
-include( ${CGAL_USE_FILE} )
-
-
-# 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()
-
-find_package( OpenMesh QUIET )
-
-if ( OpenMesh_FOUND )
-include( UseOpenMesh )
-else()
-  message(STATUS "Examples that use OpenMesh will not be compiled.")
-endif()
-
-# include for local directory
-
-# include for local package
-include_directories( BEFORE ../../include )
-
-
-# Creating entries for all C++ files with "main" routine
-# ##########################################################
-
-include( CGAL_CreateSingleSourceCGALProgram )
-
-create_single_source_cgal_program( "distance.cpp" )
-
-create_single_source_cgal_program( "incident_vertices.cpp" )
-
-create_single_source_cgal_program( "kruskal.cpp" )
-
-create_single_source_cgal_program( "kruskal_with_stored_id.cpp" )
-
-create_single_source_cgal_program( "normals.cpp" )
-
-create_single_source_cgal_program( "range.cpp" )
-
-create_single_source_cgal_program( "transform_iterator.cpp" )
-
-
-
-if(OpenMesh_FOUND)
-  create_single_source_cgal_program( "polyhedron_2_OpenMesh.cpp" )
-  target_link_libraries( polyhedron_2_OpenMesh ${OPENMESH_LIBRARIES} )
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/BGL_polyhedron_3/kruskal.cpp b/3rdparty/CGAL-4.8/examples/BGL_polyhedron_3/kruskal.cpp
deleted file mode 100644
index f06179f..0000000
--- a/3rdparty/CGAL-4.8/examples/BGL_polyhedron_3/kruskal.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-#include <CGAL/Simple_cartesian.h>
-#include <CGAL/Polyhedron_3.h>
-#include <CGAL/IO/Polyhedron_iostream.h>
-#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
-
-#include <iostream>
-#include <list>
-
-#include <boost/graph/kruskal_min_spanning_tree.hpp>
-
-
-typedef CGAL::Simple_cartesian<double>                       Kernel;
-typedef Kernel::Vector_3                                     Vector;
-typedef Kernel::Point_3                                      Point;
-typedef CGAL::Polyhedron_3<Kernel>                           Polyhedron;
-
-typedef boost::graph_traits<Polyhedron>::vertex_descriptor vertex_descriptor;
-typedef boost::graph_traits<Polyhedron>::vertex_iterator   vertex_iterator;
-typedef boost::graph_traits<Polyhedron>::edge_descriptor   edge_descriptor;
-
-// The BGL makes heavy use of indices associated to the vertices
-// We use a std::map to store the index
-
-typedef std::map<vertex_descriptor,int> Vertex_index_map;
-Vertex_index_map vertex_index_map;
-
-// A std::map is not a property map, because it is not lightweight
-typedef boost::associative_property_map<Vertex_index_map> Vertex_index_pmap;
-Vertex_index_pmap vertex_index_pmap(vertex_index_map);
-
-void
-kruskal(const Polyhedron& P)
-{
-  // associate indices to the vertices
-  vertex_iterator vb, ve;
-  int index = 0;
-  
-  // boost::tie assigns the first and second element of the std::pair
-  // returned by boost::vertices to the variables vb and ve
-  for(boost::tie(vb, ve)=vertices(P); vb!=ve; ++vb){
-    vertex_index_pmap[*vb]= index++;
-  }
-
-  
-  // We use the default edge weight which is the squared length of the edge
-  // This property map is defined in graph_traits_Polyhedron_3.h
-
-  // In the function call you can see a named parameter: vertex_index_map
-  std::list<edge_descriptor> mst;
-
-  boost::kruskal_minimum_spanning_tree(P, 
-                                       std::back_inserter(mst), 
-                                       boost::vertex_index_map(vertex_index_pmap));
-
-  std::cout << "#VRML V2.0 utf8\n"
-    "Shape {\n"
-    "  appearance Appearance {\n"
-    "    material Material { emissiveColor 1 0 0}}\n"
-    "    geometry\n"
-    "    IndexedLineSet {\n"
-    "      coord Coordinate {\n"
-    "        point [ \n";
-
-  for(boost::tie(vb, ve) = vertices(P); vb!=ve; ++vb){
-    std::cout <<  "        " << (*vb)->point() << "\n";
-  }
-
-  std::cout << "        ]\n"
-               "     }\n"
-    "      coordIndex [\n";
-
-  for(std::list<edge_descriptor>::iterator it = mst.begin(); it != mst.end(); ++it)
-  {
-    edge_descriptor e = *it ;
-    vertex_descriptor s = source(e,P);
-    vertex_descriptor t = target(e,P);
-    std::cout << "      " << vertex_index_pmap[s] << ", " << vertex_index_pmap[t] <<  ", -1\n";
-  }
-
-  std::cout << "]\n"
-    "  }#IndexedLineSet\n"
-    "}# Shape\n";
-}
-
-
-int main() {
-
-  Polyhedron P;
-  Point a(1,0,0);
-  Point b(0,1,0);
-  Point c(0,0,1);
-  Point d(0,0,0);
-
-  P.make_tetrahedron(a,b,c,d);
-
-  kruskal(P);
-
-  return 0;
-}
diff --git a/3rdparty/CGAL-4.8/examples/BGL_polyhedron_3/kruskal_with_stored_id.cpp b/3rdparty/CGAL-4.8/examples/BGL_polyhedron_3/kruskal_with_stored_id.cpp
deleted file mode 100644
index 85207e4..0000000
--- a/3rdparty/CGAL-4.8/examples/BGL_polyhedron_3/kruskal_with_stored_id.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-#include <CGAL/Simple_cartesian.h>
-#include <CGAL/Polyhedron_3.h>
-#include <CGAL/Polyhedron_items_with_id_3.h>
-#include <CGAL/IO/Polyhedron_iostream.h>
-#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
-
-#include <iostream>
-#include <list>
-
-#include <boost/graph/kruskal_min_spanning_tree.hpp>
-
-typedef CGAL::Simple_cartesian<double>                               Kernel;
-typedef Kernel::Point_3                                              Point;
-typedef CGAL::Polyhedron_3<Kernel,CGAL::Polyhedron_items_with_id_3>  Polyhedron;
-
-typedef boost::graph_traits<Polyhedron>::vertex_descriptor vertex_descriptor;
-typedef boost::graph_traits<Polyhedron>::vertex_iterator   vertex_iterator;
-typedef boost::graph_traits<Polyhedron>::edge_descriptor   edge_descriptor;
-
-
-
-void
-kruskal( const Polyhedron& P)
-{
-
-  // We use the default edge weight which is the squared length of the edge
-  // This property map is defined in graph_traits_Polyhedron_3.h
-  
-  // This function call requires a vertex_index_map named parameter which
-  // when  ommitted defaults to "get(vertex_index,graph)".
-  // That default works here because the vertex type has an "id()" method
-  // field which is used by the vertex_index internal property.
-  std::list<edge_descriptor> mst;
-  boost::kruskal_minimum_spanning_tree(P,std::back_inserter(mst));
-  
-  std::cout << "#VRML V2.0 utf8\n"
-    "Shape {\n"
-    "appearance Appearance {\n"
-    "material Material { emissiveColor 1 0 0}}\n"
-    "geometry\n"
-    "IndexedLineSet {\n"
-    "coord Coordinate {\n"
-    "point [ \n";
-  
-  vertex_iterator vb, ve;
-  for(boost::tie(vb,ve) = vertices(P); vb!=ve; ++vb){
-    std::cout << (*vb)->point() << "\n";
-  }
-  
-  std::cout << "]\n"
-    "}\n"
-    "coordIndex [\n";
-  
-  for(std::list<edge_descriptor>::iterator it = mst.begin(); it != mst.end(); ++it){
-    std::cout << source(*it,P)->id()
-	      << ", " << target(*it,P)->id() <<  ", -1\n";
-  }
-  
-  std::cout << "]\n"
-    "}#IndexedLineSet\n"
-    "}# Shape\n";
-}
-
-
-int main() {
-  
-  Polyhedron P;
-  
-  Point a(1,0,0);
-  Point b(0,1,0);
-  Point c(0,0,1);
-  Point d(0,0,0);
-  
-  P.make_tetrahedron(a,b,c,d);
-
-  // associate indices to the vertices using the "id()" field of the vertex.
-  vertex_iterator vb, ve;
-  int index = 0;
-  
-  // boost::tie assigns the first and second element of the std::pair
-  // returned by boost::vertices to the variables vit and ve
-  for(boost::tie(vb,ve)=vertices(P); vb!=ve; ++vb ){
-    vertex_descriptor  vd = *vb;
-    vd->id() = index++;
-  }
-  
-  kruskal(P);
-  return 0;
-}
diff --git a/3rdparty/CGAL-4.8/examples/BGL_polyhedron_3/polyhedron_2_OpenMesh.cpp b/3rdparty/CGAL-4.8/examples/BGL_polyhedron_3/polyhedron_2_OpenMesh.cpp
deleted file mode 100644
index 55f64a8..0000000
--- a/3rdparty/CGAL-4.8/examples/BGL_polyhedron_3/polyhedron_2_OpenMesh.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-
-#include <CGAL/Polyhedron_3.h>
-#include <CGAL/IO/Polyhedron_iostream.h>
-#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
-
-#include <OpenMesh/Core/IO/MeshIO.hh>
-
-#if 1
-#include <OpenMesh/Core/Mesh/PolyMesh_ArrayKernelT.hh>
-#include <CGAL/boost/graph/graph_traits_PolyMesh_ArrayKernelT.h>
-#else
-#include <OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh>
-#include <CGAL/boost/graph/graph_traits_TriMesh_ArrayKernelT.h>
-#endif
-
-#include <CGAL/boost/graph/convert_surface_mesh.h>
-
-#include <boost/unordered_map.hpp>
-
-#include <iostream>
-#include <fstream>
-
-
-typedef CGAL::Exact_predicates_inexact_constructions_kernel  Kernel;
-typedef Kernel::Vector_3                                     Vector;
-typedef Kernel::Point_3                                      Point;
-typedef CGAL::Polyhedron_3<Kernel>                           Source;
-
-#if 1
-typedef OpenMesh::PolyMesh_ArrayKernelT</* MyTraits*/> Target;
-#else
-typedef OpenMesh::TriMesh_ArrayKernelT</* MyTraits*/> Target;
-#endif
-typedef boost::graph_traits<Source>::vertex_descriptor sm_vertex_descriptor;
-typedef boost::graph_traits<Target>::vertex_descriptor tm_vertex_descriptor;
-
-typedef boost::graph_traits<Source>::halfedge_descriptor sm_halfedge_descriptor;
-typedef boost::graph_traits<Target>::halfedge_descriptor tm_halfedge_descriptor;
-
-namespace OpenMesh {
-
-inline  std::size_t hash_value(const VertexHandle&  i)
-  {
-    return i.idx();
-  }
-
-inline  std::size_t hash_value(const HalfedgeHandle&  i)
-  {
-    return i.idx();
-  }
-
-inline  std::size_t hash_value(const FaceHandle&  i)
-  {
-    return i.idx();
-  }
-
-}
-
-int main(int argc, char* argv[])
-{
-  Source S;
-  Target T;
-  std::ifstream in((argc>1)?argv[1]:"cube.off");
-  in >> S;
-
-  {
-    boost::unordered_map<sm_vertex_descriptor, tm_vertex_descriptor> v2v;
-    boost::unordered_map<sm_halfedge_descriptor, tm_halfedge_descriptor> h2h;
-    
-    convert_surface_mesh(S,T,v2v,h2h);
-    OpenMesh::IO::write_mesh(T, "om.off");
-  }
-  S.clear();
-  {
-    boost::unordered_map<tm_vertex_descriptor, sm_vertex_descriptor> v2v;
-    boost::unordered_map<tm_halfedge_descriptor, sm_halfedge_descriptor> h2h;
-    
-    convert_surface_mesh(T,S,v2v,h2h);
-    std::ofstream out("reverse.off");
-    out << S << std::endl;
-  }
-
-  
-  return 0;
-}
diff --git a/3rdparty/CGAL-4.8/examples/BGL_surface_mesh/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/BGL_surface_mesh/CMakeLists.txt
deleted file mode 100644
index 9019b9a..0000000
--- a/3rdparty/CGAL-4.8/examples/BGL_surface_mesh/CMakeLists.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( BGL_surface_mesh_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "connected_components.cpp" )
-  create_single_source_cgal_program( "prim.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/BGL_triangulation_2/dijkstra.cpp b/3rdparty/CGAL-4.8/examples/BGL_triangulation_2/dijkstra.cpp
deleted file mode 100644
index d5dc03e..0000000
--- a/3rdparty/CGAL-4.8/examples/BGL_triangulation_2/dijkstra.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-#include <CGAL/Triangulation_2.h>
-#include <CGAL/boost/graph/graph_traits_Triangulation_2.h>
-
-#include <CGAL/boost/graph/dijkstra_shortest_paths.h>
-#include <boost/graph/filtered_graph.hpp>
-
-typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
-typedef K::Point_2 Point;
-
-typedef CGAL::Triangulation_2<K> Triangulation;
-
-// As we want to run Dijskra's shortest path algorithm we only
-// consider finite vertices and edges.
-
-template <typename T>
-struct Is_finite {
-
-  const T* t_;
-
-  Is_finite()
-    : t_(NULL)
-  {}
-
-  Is_finite(const T& t)
-    : t_(&t)
-  { }
-
-  template <typename VertexOrEdge>
-  bool operator()(const VertexOrEdge& voe) const {
-    return ! t_->is_infinite(voe);
-  }
-};
-
-typedef Is_finite<Triangulation> Filter;
-typedef boost::filtered_graph<Triangulation,Filter,Filter> Finite_triangulation;
-typedef boost::graph_traits<Finite_triangulation>::vertex_descriptor vertex_descriptor;
-typedef boost::graph_traits<Finite_triangulation>::vertex_iterator vertex_iterator;
-
-typedef std::map<vertex_descriptor,int> VertexIndexMap;
-VertexIndexMap vertex_id_map;
-
-typedef boost::associative_property_map<VertexIndexMap> VertexIdPropertyMap;
-VertexIdPropertyMap vertex_index_pmap(vertex_id_map);
-
-int
-main(int,char*[])
-{
-  Triangulation t;
-  Filter is_finite(t);
-  Finite_triangulation ft(t, is_finite, is_finite);
-
-  t.insert(Point(0,0));
-  t.insert(Point(1,0));
-  t.insert(Point(0.2,0.2));
-  t.insert(Point(0,1));
-  t.insert(Point(0,2));
-
-  vertex_iterator vit, ve;
-  // Associate indices to the vertices
-  int index = 0;
-  // boost::tie assigns the first and second element of the std::pair
-  // returned by boost::vertices to the variables vit and ve
-  for(boost::tie(vit,ve)=boost::vertices(ft); vit!=ve; ++vit ){
-    vertex_descriptor  vd = *vit;
-    vertex_id_map[vd]= index++;
-    }
-
-  // Dijkstra's shortest path needs property maps for the predecessor and distance
-  // We first declare a vector
-  std::vector<vertex_descriptor> predecessor(boost::num_vertices(ft));
-  // and then turn it into a property map
-  boost::iterator_property_map<std::vector<vertex_descriptor>::iterator,
-                               VertexIdPropertyMap>
-    predecessor_pmap(predecessor.begin(), vertex_index_pmap);
-
-  std::vector<double> distance(boost::num_vertices(ft));
-  boost::iterator_property_map<std::vector<double>::iterator,
-                               VertexIdPropertyMap>
-    distance_pmap(distance.begin(), vertex_index_pmap);
-
-  // start at an arbitrary vertex
-  vertex_descriptor source = *boost::vertices(ft).first;
-  std::cout << "\nStart dijkstra_shortest_paths at " << source->point() <<"\n";
-
-  boost::dijkstra_shortest_paths(ft, source,
-				 distance_map(distance_pmap)
-				 .predecessor_map(predecessor_pmap)
-				 .vertex_index_map(vertex_index_pmap));
-
-  for(boost::tie(vit,ve)=boost::vertices(ft); vit!=ve; ++vit ){
-    vertex_descriptor vd = *vit;
-    std::cout << vd->point() << " [" <<  vertex_id_map[vd] << "] ";
-    std::cout << " has distance = "  << boost::get(distance_pmap,vd)
-	      << " and predecessor ";
-    vd =  boost::get(predecessor_pmap,vd);
-    std::cout << vd->point() << " [" <<  vertex_id_map[vd] << "]\n ";
-  }
-
-  return 0;
-}
diff --git a/3rdparty/CGAL-4.8/examples/BGL_triangulation_2/dijkstra_with_internal_properties.cpp b/3rdparty/CGAL-4.8/examples/BGL_triangulation_2/dijkstra_with_internal_properties.cpp
deleted file mode 100644
index 0a3d0d7..0000000
--- a/3rdparty/CGAL-4.8/examples/BGL_triangulation_2/dijkstra_with_internal_properties.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-#include <CGAL/Delaunay_triangulation_2.h>
-#include <CGAL/Triangulation_vertex_base_with_id_2.h>
-#include <CGAL/boost/graph/graph_traits_Delaunay_triangulation_2.h>
-
-#include <CGAL/boost/graph/dijkstra_shortest_paths.h>
-#include <boost/graph/filtered_graph.hpp>
-
-typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
-typedef K::Point_2 Point;
-
-typedef CGAL::Triangulation_vertex_base_with_id_2<K> Tvb;
-typedef CGAL::Triangulation_face_base_2<K> Tfb;
-typedef CGAL::Triangulation_data_structure_2<Tvb,Tfb> Tds;
-typedef CGAL::Delaunay_triangulation_2<K, Tds> Triangulation;
-
-// consider finite vertices and edges.
-
-template <typename T>
-struct Is_finite {
-
-  const T* t_;
-
-  Is_finite()
-    : t_(NULL)
-  {}
-
-  Is_finite(const T& t)
-    : t_(&t)
-  { }
-
-  template <typename VertexOrEdge>
-  bool operator()(const VertexOrEdge& voe) const {
-    return ! t_->is_infinite(voe);
-  }
-};
-
-typedef Is_finite<Triangulation> Filter;
-typedef boost::filtered_graph<Triangulation,Filter,Filter> Finite_triangulation;
-typedef boost::graph_traits<Finite_triangulation>::vertex_descriptor vertex_descriptor;
-typedef boost::graph_traits<Finite_triangulation>::vertex_iterator vertex_iterator;
-
-
-int
-main(int,char*[])
-{
-  Triangulation t;
-  Filter is_finite(t);
-  Finite_triangulation ft(t, is_finite, is_finite);
-
-  t.insert(Point(0,0));
-  t.insert(Point(1,0));
-  t.insert(Point(0.2,0.2));
-  t.insert(Point(0,1));
-  t.insert(Point(0,2));
-
-  vertex_iterator vit, ve;
-  // associate indices to the vertices
-  int index = 0;
-  for(boost::tie(vit,ve)=boost::vertices(ft); vit!=ve; ++vit ){
-    vertex_descriptor  vd = *vit;
-    vd->id()= index++;
-  }
-
-  typedef boost::property_map<Triangulation, boost::vertex_index_t>::type VertexIdPropertyMap;
-  VertexIdPropertyMap vertex_index_pmap = get(boost::vertex_index, ft);
-
-  // Dijkstra's shortest path needs property maps for the predecessor and distance
-  std::vector<vertex_descriptor> predecessor(boost::num_vertices(ft));
-  boost::iterator_property_map<std::vector<vertex_descriptor>::iterator, VertexIdPropertyMap>
-    predecessor_pmap(predecessor.begin(), vertex_index_pmap);
-
-  std::vector<double> distance(boost::num_vertices(ft));
-  boost::iterator_property_map<std::vector<double>::iterator, VertexIdPropertyMap>
-    distance_pmap(distance.begin(), vertex_index_pmap);
-
-  vertex_descriptor source =  *boost::vertices(ft).first;
-  std::cout << "\nStart dijkstra_shortest_paths at " << source->point() << std::endl;
-
-  boost::dijkstra_shortest_paths(ft, source ,
-				 distance_map(distance_pmap)
-				 .predecessor_map(predecessor_pmap));
-
-  for(boost::tie(vit,ve)=boost::vertices(ft); vit!=ve; ++vit ){
-    vertex_descriptor vd = *vit;
-    std::cout << vd->point() << " [" << vd->id() << "] ";
-    std::cout << " has distance = "  << get(distance_pmap,vd) << " and predecessor ";
-    vd = get(predecessor_pmap,vd);
-    std::cout << vd->point() << " [" << vd->id() << "]\n";
-  }
-  return 0;
-}
diff --git a/3rdparty/CGAL-4.8/examples/BGL_triangulation_2/emst.cpp b/3rdparty/CGAL-4.8/examples/BGL_triangulation_2/emst.cpp
deleted file mode 100644
index 2ce5c8f..0000000
--- a/3rdparty/CGAL-4.8/examples/BGL_triangulation_2/emst.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-#include <CGAL/Delaunay_triangulation_2.h>
-#include <CGAL/boost/graph/graph_traits_Delaunay_triangulation_2.h>
-
-#include <boost/graph/kruskal_min_spanning_tree.hpp>
-#include <boost/graph/filtered_graph.hpp>
-
-typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
-typedef K::Point_2 Point;
-
-typedef CGAL::Delaunay_triangulation_2<K> Triangulation;
-
-// As we only consider finite vertices and edges
-// we need the following filter
-
-template <typename T>
-struct Is_finite {
-
-  const T* t_;
-
-  Is_finite()
-    : t_(NULL)
-  {}
-
-  Is_finite(const T& t)
-    : t_(&t)
-  { }
-
-  template <typename VertexOrEdge>
-  bool operator()(const VertexOrEdge& voe) const {
-    return ! t_->is_infinite(voe);
-  }
-};
-
-typedef Is_finite<Triangulation> Filter;
-typedef boost::filtered_graph<Triangulation,Filter,Filter> Finite_triangulation;
-typedef boost::graph_traits<Finite_triangulation>::vertex_descriptor vertex_descriptor;
-typedef boost::graph_traits<Finite_triangulation>::vertex_iterator vertex_iterator;
-typedef boost::graph_traits<Finite_triangulation>::edge_descriptor edge_descriptor;
-
-// The BGL makes use of indices associated to the vertices
-// We use a std::map to store the index
-typedef std::map<vertex_descriptor,int> VertexIndexMap;
-VertexIndexMap vertex_id_map;
-
-// A std::map is not a property map, because it is not lightweight
-typedef boost::associative_property_map<VertexIndexMap> VertexIdPropertyMap;
-VertexIdPropertyMap vertex_index_pmap(vertex_id_map);
-
-int
-main(int,char*[])
-{
-  Triangulation t;
-  Filter is_finite(t);
-  Finite_triangulation ft(t, is_finite, is_finite);
-
-  Point p ;
-  while(std::cin >> p){
-    t.insert(p);
-  }
-
-  vertex_iterator vit, ve;
-  // Associate indices to the vertices
-  int index = 0;
-  // boost::tie assigns the first and second element of the std::pair
-  // returned by boost::vertices to the variables vit and ve
-  for(boost::tie(vit,ve)=boost::vertices(ft); vit!=ve; ++vit ){
-    vertex_descriptor  vd = *vit;
-    vertex_id_map[vd]= index++;
-    }
-
-
-  // We use the default edge weight which is the squared length of the edge
-  // This property map is defined in graph_traits_Triangulation_2.h
-
-  // In the function call you can see a named parameter: vertex_index_map
-   std::list<edge_descriptor> mst;
-   boost::kruskal_minimum_spanning_tree(ft,
-					std::back_inserter(mst),
-					vertex_index_map(vertex_index_pmap));
-
-
-   std::cout << "The edges of the Euclidean mimimum spanning tree:" << std::endl;
-
-   for(std::list<edge_descriptor>::iterator it = mst.begin(); it != mst.end(); ++it){
-     edge_descriptor ed = *it;
-     vertex_descriptor svd = source(ed,t);
-     vertex_descriptor tvd = target(ed,t);
-     Triangulation::Vertex_handle sv = svd;
-     Triangulation::Vertex_handle tv = tvd;
-     std::cout << "[ " << sv->point() << "  |  " << tv->point() << " ] " << std::endl;
-   }
-
-   return 0;
-}
diff --git a/3rdparty/CGAL-4.8/examples/Barycentric_coordinates_2/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Barycentric_coordinates_2/CMakeLists.txt
deleted file mode 100644
index 9de385a..0000000
--- a/3rdparty/CGAL-4.8/examples/Barycentric_coordinates_2/CMakeLists.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Barycentric_coordinates_2_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "Discrete_harmonic_coordinates_example.cpp" )
-  create_single_source_cgal_program( "Mean_value_coordinates_example.cpp" )
-  create_single_source_cgal_program( "Segment_coordinates_example.cpp" )
-  create_single_source_cgal_program( "Terrain_height_modeling.cpp" )
-  create_single_source_cgal_program( "Triangle_coordinates_example.cpp" )
-  create_single_source_cgal_program( "Triangle_coordinates_speed_test.cpp" )
-  create_single_source_cgal_program( "Wachspress_coordinates_example.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/CMakeLists.txt
deleted file mode 100644
index d33b944..0000000
--- a/3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/CMakeLists.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Boolean_set_operations_2_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "bezier_traits_adapter.cpp" )
-  create_single_source_cgal_program( "bezier_traits_adapter2.cpp" )
-  create_single_source_cgal_program( "circle_segment.cpp" )
-  create_single_source_cgal_program( "conic_traits_adapter.cpp" )
-  create_single_source_cgal_program( "connect_polygon.cpp" )
-  create_single_source_cgal_program( "do_intersect.cpp" )
-  create_single_source_cgal_program( "dxf_union.cpp" )
-  create_single_source_cgal_program( "sequence.cpp" )
-  create_single_source_cgal_program( "set_union.cpp" )
-  create_single_source_cgal_program( "simple_join_intersect.cpp" )
-  create_single_source_cgal_program( "symmetric_difference.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Box_intersection_d/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Box_intersection_d/CMakeLists.txt
deleted file mode 100644
index fbe3084..0000000
--- a/3rdparty/CGAL-4.8/examples/Box_intersection_d/CMakeLists.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Box_intersection_d_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "box_grid.cpp" )
-  create_single_source_cgal_program( "custom_box_grid.cpp" )
-  create_single_source_cgal_program( "minimal.cpp" )
-  create_single_source_cgal_program( "minimal_self.cpp" )
-  create_single_source_cgal_program( "proximity_custom_box_traits.cpp" )
-  create_single_source_cgal_program( "triangle_self_intersect.cpp" )
-  create_single_source_cgal_program( "triangle_self_intersect_pointers.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/CGAL_ipelets/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/CGAL_ipelets/CMakeLists.txt
deleted file mode 100644
index bf0bd4b..0000000
--- a/3rdparty/CGAL-4.8/examples/CGAL_ipelets/CMakeLists.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( CGAL_ipelets_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "test_grabbers.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/CGALimageIO/test_imageio.cpp b/3rdparty/CGAL-4.8/examples/CGALimageIO/test_imageio.cpp
deleted file mode 100644
index b7a5b40..0000000
--- a/3rdparty/CGAL-4.8/examples/CGALimageIO/test_imageio.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-#include <CGAL/ImageIO.h>
-#include <iostream>
-
-#define SHOW(attribut) "\n  "#attribut": " << image->attribut
-#define SHOWENUM(enumitem) #enumitem"=" << enumitem
-
-int main(int argc, char** argv)
-{
-  if(argc > 1)
-  {
-    _image* image = ::_readImage(argv[1]);
-    if(image)
-    {
-      std::cerr 
-	<< "Image infos:"
-	<< "\ndimensions"
-	<< SHOW(xdim)
-	<< SHOW(ydim)
-	<< SHOW(zdim)
-	<< SHOW(vdim)
-	<< "\nvoxel size"
-	<< SHOW(vx)
-	<< SHOW(vy)
-	<< SHOW(vz)
-	<<"\nrotation vector"
-	<< SHOW(rx)
-	<< SHOW(ry)
-	<< SHOW(rz)
-	<<"\nimage center"
-	<< SHOW(cx)
-	<< SHOW(cy)
-	<< SHOW(cz)
-	<< "\nword size (in bytes)"
-	<< SHOW(wdim)
-	<< "\nimage format"
-	<< "\n  " << image->imageFormat->realName 
-	<< " (extension list: " << image->imageFormat->fileExtension << ")" 
-	<< "\nvectors interlaced or not ("
-        << SHOWENUM(VM_INTERLACED) << ", "
-        << SHOWENUM(VM_NON_INTERLACED) << ", "
-        << SHOWENUM(VM_SCALAR) << ")"
-	<< SHOW(vectMode)
-	<< "\nword kind ("
-	<< SHOWENUM(WK_FIXED) << ", "
-	<< SHOWENUM(WK_FLOAT) << ", "
-	<< SHOWENUM(WK_UNKNOWN)
-	<< ")"
-	<< SHOW(wordKind)
-	<< "\nword sign ("
-	<< SHOWENUM(SGN_SIGNED) << ", "
-	<< SHOWENUM(SGN_UNSIGNED) << ", "
-	<< SHOWENUM(SGN_UNKNOWN)
-	<< ")"
-	<< SHOW(sign)
-	<< "\n";
-      
-      ::_freeImage(image);
-    }
-    else
-      std::cerr << "\"" << argv[1] << "\" is not a supported file.\n";
-  }
-  else
-    ::printSupportedFileFormat();
-}
diff --git a/3rdparty/CGAL-4.8/examples/Circular_kernel_2/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Circular_kernel_2/CMakeLists.txt
deleted file mode 100644
index 5bf5465..0000000
--- a/3rdparty/CGAL-4.8/examples/Circular_kernel_2/CMakeLists.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Circular_kernel_2_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "functor_has_on_2.cpp" )
-  create_single_source_cgal_program( "intersecting_arcs.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Circular_kernel_3/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Circular_kernel_3/CMakeLists.txt
deleted file mode 100644
index 3d355fa..0000000
--- a/3rdparty/CGAL-4.8/examples/Circular_kernel_3/CMakeLists.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Circular_kernel_3_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "functor_compare_theta_3.cpp" )
-  create_single_source_cgal_program( "functor_has_on_3.cpp" )
-  create_single_source_cgal_program( "intersecting_spheres.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Circulator/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Circulator/CMakeLists.txt
deleted file mode 100644
index ebabfbc..0000000
--- a/3rdparty/CGAL-4.8/examples/Circulator/CMakeLists.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Circulator_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "circulator_prog1.cpp" )
-  create_single_source_cgal_program( "circulator_prog2.cpp" )
-  create_single_source_cgal_program( "circulator_prog3.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Combinatorial_map/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Combinatorial_map/CMakeLists.txt
deleted file mode 100644
index e6039e3..0000000
--- a/3rdparty/CGAL-4.8/examples/Combinatorial_map/CMakeLists.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Combinatorial_map_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "map_3_dynamic_onmerge.cpp" )
-  create_single_source_cgal_program( "map_3_foreach.cpp" )
-  create_single_source_cgal_program( "map_3_marks.cpp" )
-  create_single_source_cgal_program( "map_3_operations.cpp" )
-  create_single_source_cgal_program( "map_3_simple_example.cpp" )
-  create_single_source_cgal_program( "map_3_with_colored_facets.cpp" )
-  create_single_source_cgal_program( "map_4_simple_example.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Combinatorial_map/map_3_dynamic_onmerge.cpp b/3rdparty/CGAL-4.8/examples/Combinatorial_map/map_3_dynamic_onmerge.cpp
deleted file mode 100644
index 78af540..0000000
--- a/3rdparty/CGAL-4.8/examples/Combinatorial_map/map_3_dynamic_onmerge.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-#include <CGAL/Combinatorial_map.h>
-#include <CGAL/Combinatorial_map_constructors.h>
-#include <CGAL/Combinatorial_map_operations.h>
-#include <CGAL/Cell_attribute.h>
-#include <iostream>
-#include <cstdlib>
-
-// My item class: no functor is associated with Face_attribute.
-struct Myitem
-{
-  template<class CMap>
-  struct Dart_wrapper
-  {
-    typedef CGAL::Dart<3, CMap> Dart;
-    typedef CGAL::Cell_attribute<CMap, int> Face_attribute;
-    typedef CGAL::cpp11::tuple<void,void,Face_attribute> Attributes;
-  };
-};
-
-// Definition of my combinatorial map.
-typedef CGAL::Combinatorial_map<3,Myitem> CMap_3;
-typedef CMap_3::Dart_handle               Dart_handle;
-typedef CMap_3::Attribute_type<2>::type   Face_attribute;
-
-// Functor called when two faces are merged.
-struct Merge_functor
-{
-  // operator() automatically called before a merge.
-  void operator()(Face_attribute& ca1, Face_attribute& ca2)
-  {
-    ca1.info()=ca1.info()+ca2.info();
-    std::cout<<"After on merge faces: info of face1="<<ca1.info()
-             <<", info of face2="<<ca2.info()<<std::endl;
-  }
-};
-
-// Functor called when one face is split in two.
-struct Split_functor
-{
-  Split_functor(CMap_3& amap) : mmap(amap)
-  {}
-
-  // operator() automatically called after a split.
-  void operator()(Face_attribute& ca1, Face_attribute& ca2)
-  {
-    set_color_of_face(ca1.dart());
-    set_color_of_face(ca2.dart());
-    std::cout<<"After on split faces: info of face1="<<ca1.info()
-             <<", info of face2="<<ca2.info()<<std::endl;
-  }
-
-private:
-
-  // The info of a face is the mean of the info of all its neighboors faces.
-  void set_color_of_face(CMap_3::Dart_handle dh)
-  {
-    int nb=0;
-    int sum=0;
-    for (CMap_3::Dart_of_orbit_range<1>::iterator
-           it=mmap.darts_of_orbit<1>(dh).begin(),
-           itend=mmap.darts_of_orbit<1>(dh).end();
-         it!=itend; ++it, ++nb)
-    { sum+=mmap.info<2>(mmap.beta<2>(it)); }
-
-    mmap.info<2>(dh)=(sum/nb);
-  }
-
-  CMap_3& mmap;
-};
-
-// Function allowing to display all the 2-attributes, and the characteristics
-// of a given combinatorial map.
-void display_map_and_2attributes(CMap_3& cm)
-{
-  for (CMap_3::Attribute_range<2>::type::iterator
-       it=cm.attributes<2>().begin(), itend=cm.attributes<2>().end();
-       it!=itend; ++it)
-  {
-    std::cout<<cm.info_of_attribute<2>(it)<<"; ";
-  }
-  std::cout<<std::endl;
-  cm.display_characteristics(std::cout);
-  std::cout<<", valid="<<cm.is_valid()<<std::endl;
-}
-
-int main()
-{
-  CMap_3 cm;
-
-  // 0) Create 2 hexahedra.
-  Dart_handle dh1 = CGAL::make_combinatorial_hexahedron(cm);
-  Dart_handle dh2 = CGAL::make_combinatorial_hexahedron(cm);
-
-  // 1) Create 2-attributes of the first hexahedron, info()==7.
-  for (CMap_3::One_dart_per_incident_cell_range<2, 3>::iterator
-       it=cm.one_dart_per_incident_cell<2,3>(dh1).begin(),
-       itend=cm.one_dart_per_incident_cell<2,3>(dh1).end(); it!=itend; ++it)
-  { cm.set_attribute<2>(it, cm.create_attribute<2>(7)); }
-
-  // 2) Create 2-attributes of the second hexahedron, info()==13.
-  for (CMap_3::One_dart_per_incident_cell_range<2, 3>::iterator it=
-       cm.one_dart_per_incident_cell<2,3>(dh2).begin(),
-       itend=cm.one_dart_per_incident_cell<2,3>(dh2).end(); it!=itend; ++it)
-  { cm.set_attribute<2>(it, cm.create_attribute<2>(13)); }
-
-  // 3) Set the onsplit and onmerge functors.
-  cm.onsplit_functor<2>()=Split_functor(cm);
-  cm.onmerge_functor<2>()=Merge_functor();
-
-  // 4) 3-Sew the two hexahedra along one face. This calls 1 onmerge.
-  cm.sew<3>(dh1, dh2);
-
-  // 5) Display all the values of 2-attributes.
-  display_map_and_2attributes(cm);
-
-  // 6) Insert a vertex in the face between the two hexahedra.
-  //    This calls 4 onsplit.
-  Dart_handle resdart=CGAL::insert_cell_0_in_cell_2(cm, dh2);
-
-  // 7) Display all the values of 2-attributes.
-  display_map_and_2attributes(cm);
-
-  // 8) "Remove" the dynamic onmerge functor.
-  cm.onmerge_functor<2>()=boost::function<void(Face_attribute&,
-                                               Face_attribute&)>();
-
-  // 9) Remove one edge: this merges two faces, however no dynamic
-  //    functor is called (because it was removed).
-  CGAL::remove_cell<CMap_3, 1>(cm, resdart);
-
-  // 10) Display all the values of 2-attributes.
-  display_map_and_2attributes(cm);
-
-  return EXIT_SUCCESS;
-}
diff --git a/3rdparty/CGAL-4.8/examples/Combinatorial_map/map_3_foreach.cpp b/3rdparty/CGAL-4.8/examples/Combinatorial_map/map_3_foreach.cpp
deleted file mode 100644
index e011769..0000000
--- a/3rdparty/CGAL-4.8/examples/Combinatorial_map/map_3_foreach.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-#include <CGAL/Combinatorial_map.h>
-#include <CGAL/Combinatorial_map_operations.h>
-#include <CGAL/Combinatorial_map_constructors.h>
-#include <iostream>
-#include <algorithm>
-
-typedef CGAL::Combinatorial_map<3> CMap_3;
-typedef CMap_3::Dart_handle        Dart_handle;
-
-// Functor used to display all the vertices of a given volume
-template<class CMap, unsigned int i>
-struct Display_vertices_of_cell : public std::unary_function<CMap, void>
-{
-  Display_vertices_of_cell(const CMap& acmap) :
-    cmap(acmap),
-    nb_cell(0)
-  {}
-
-  void operator() (const typename CMap::Dart& d)
-  {
-    std::cout<<i<<"-cell "<<++nb_cell<<" : ";
-    for (typename CMap::template One_dart_per_incident_cell_range<0,i>::
-           const_iterator it=cmap.template one_dart_per_incident_cell<0,i>
-           (cmap.dart_handle(d)).begin(),
-           itend=cmap.template one_dart_per_incident_cell<0,i>
-           (cmap.dart_handle(d)).end();
-         it!=itend; ++it)
-    {
-      std::cout << &*it << "; ";
-    }
-    std::cout<<std::endl;
-  }
-
-  void operator() (const typename CMap::Dart* ptr)
-  { operator() (*ptr); }
-  
-private:
-  const CMap& cmap;
-  unsigned int nb_cell;
-};
-
-// Functor used to remove a face
-template<class CMap>
-struct Remove_face : public std::unary_function<CMap, void>
-{
-  Remove_face(CMap& acmap) : cmap(acmap)
-  {}
-
-  void operator() (typename CMap::Dart* d)
-  {
-    CGAL::remove_cell<CMap,2>(cmap, cmap.dart_handle(*d));
-    std::cout<<"CMap characteristics: ";
-    cmap.display_characteristics(std::cout) << ", valid=" << cmap.is_valid() 
-                                            << std::endl;
-  }
-  
-private:
-  CMap& cmap;
-};
-
-
-// Functor allowing to transform a variable into its address.
-template<typename T>
-struct Take_adress : public std::unary_function<T, T*>
-{
-  T* operator() (T& t) const
-  { return &t; }
-};
-
-int main()
-{
-  CMap_3 cmap;
-
-  // Create two tetrahedra.
-  Dart_handle d1 = CGAL::make_combinatorial_tetrahedron(cmap);
-  Dart_handle d2 = CGAL::make_combinatorial_tetrahedron(cmap);
-
-  // Display the vertices of each volume by iterating on darts.
-  std::cout<<"********Volumes********"<<std::endl;
-  std::for_each(cmap.one_dart_per_cell<3>().begin(),
-                cmap.one_dart_per_cell<3>().end(),
-                Display_vertices_of_cell<CMap_3,3>(cmap));
-  
-  // 3-Sew the 2 tetrahedra along one facet
-  cmap.sew<3>(d1, d2);
-
-  // Display the vertices of each face by iterating on darts.
-  std::cout<<"********Faces********"<<std::endl;
-  std::for_each(cmap.one_dart_per_cell<2>().begin(),
-                cmap.one_dart_per_cell<2>().end(),
-                Display_vertices_of_cell<CMap_3,2>(cmap));
-
-    // We display the map characteristics.
-  std::cout<<"CMap characteristics: ";
-  cmap.display_characteristics(std::cout) << ", valid=" << cmap.is_valid() 
-                                          << std::endl << std::endl;
-
-  std::vector<CMap_3::Dart*> toremove;
-
-  // Copy in vector toremove one dart per face
-  std::copy(boost::transform_iterator<Take_adress<CMap_3::Dart>,
-                                      CMap_3::One_dart_per_cell_range<2>::iterator>
-            (cmap.one_dart_per_cell<2>().begin(),
-             Take_adress<CMap_3::Dart>()),
-            boost::transform_iterator<Take_adress<CMap_3::Dart>,
-                                      CMap_3::One_dart_per_cell_range<2>::iterator>
-            (cmap.one_dart_per_cell<2>().end(),
-             Take_adress<CMap_3::Dart>()),
-            back_inserter(toremove));
-  
-  // Remove each face sequentially.
-  std::for_each(toremove.begin(), toremove.end(), Remove_face<CMap_3>(cmap));
-  
-  return EXIT_SUCCESS;
-}
diff --git a/3rdparty/CGAL-4.8/examples/Combinatorial_map/map_3_marks.cpp b/3rdparty/CGAL-4.8/examples/Combinatorial_map/map_3_marks.cpp
deleted file mode 100644
index d4fc0f9..0000000
--- a/3rdparty/CGAL-4.8/examples/Combinatorial_map/map_3_marks.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-#include <CGAL/Combinatorial_map.h>
-#include <CGAL/Combinatorial_map_constructors.h>
-#include <CGAL/Combinatorial_map_operations.h>
-#include <iostream>
-#include <cstdlib>
-
-typedef CGAL::Combinatorial_map<3> CMap_3;
-typedef CMap_3::Dart_handle Dart_handle;
-typedef CMap_3::size_type size_type;
-
-int main()
-{
-  CMap_3 cm;
-
-  // 1) Reserve a mark.
-  size_type amark;
-  try
-  {
-    amark = cm.get_new_mark();
-  }
-  catch (CMap_3::Exception_no_more_available_mark)
-  {
-    std::cerr<<"No more free mark, exit."<<std::endl;
-    exit(-1);
-  }
-  
-  // 2) Create two tetrahedra.
-  Dart_handle dh1 = CGAL::make_combinatorial_tetrahedron(cm);  
-  Dart_handle dh2 = CGAL::make_combinatorial_tetrahedron(cm);
-
-  // 3) 3-sew them.
-  cm.sew<3>(dh1, dh2);
-  
-  // 4) Mark the darts belonging to the first tetrahedron.
-  for  (CMap_3::Dart_of_cell_range<3>::iterator 
-          it(cm.darts_of_cell<3>(dh1).begin()),
-          itend(cm.darts_of_cell<3>(dh1).end()); it!=itend; ++it)
-    cm.mark(it, amark);
-
-  // 4) Remove the common 2-cell between the two cubes:
-  // the two tetrahedra are merged.
-  CGAL::remove_cell<CMap_3, 2>(cm, dh1);
-
-  // 5) Thanks to the mark, we know which darts come from the first tetrahedron.
-  unsigned int res=0;
-  for (CMap_3::Dart_range::iterator it(cm.darts().begin()),
-	 itend(cm.darts().end()); it!=itend; ++it)
-  {
-    if ( cm.is_marked(it, amark) )
-      ++res;
-  }
-  
-  std::cout<<"Number of darts from the first tetrahedron: "<<res<<std::endl;
-  cm.free_mark(amark);
-
-  return EXIT_SUCCESS;
-}
-
diff --git a/3rdparty/CGAL-4.8/examples/Combinatorial_map/map_3_operations.cpp b/3rdparty/CGAL-4.8/examples/Combinatorial_map/map_3_operations.cpp
deleted file mode 100644
index f9ded2b..0000000
--- a/3rdparty/CGAL-4.8/examples/Combinatorial_map/map_3_operations.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-#include <CGAL/Combinatorial_map.h>
-#include <CGAL/Combinatorial_map_constructors.h>
-#include <CGAL/Combinatorial_map_operations.h>
-#include <iostream>
-#include <cstdlib>
-
-typedef CGAL::Combinatorial_map<3> CMap_3;
-typedef CMap_3::Dart_handle        Dart_handle;
-
-int main()
-{
-  CMap_3 cm;
-
-  // Create one combinatorial hexahedron.
-  Dart_handle dh1 = CGAL::make_combinatorial_hexahedron(cm);
-
-  // Add two edges along two opposite facets.
-  CGAL_assertion( CGAL::is_insertable_cell_1_in_cell_2
-                        (cm,cm.beta(dh1,1),cm.beta(dh1,0)) );
-
-  CGAL::insert_cell_1_in_cell_2(cm,cm.beta(dh1,1),cm.beta(dh1,0));
-  CGAL_assertion( cm.is_valid() );
-
-  Dart_handle dh2=cm.beta(dh1,2,1,1,2);
-
-  CGAL_assertion( CGAL::is_insertable_cell_1_in_cell_2
-                        (cm,dh2,cm.beta(dh2,1,1)) );
-  
-  CGAL::insert_cell_1_in_cell_2(cm,dh2,cm.beta(dh2,1,1));
-  CGAL_assertion( cm.is_valid() );
-
-  // Insert a facet along these two new edges plus two initial edges
-  // of the hexahedron.
-  std::vector<Dart_handle> path;
-  path.push_back(cm.beta(dh1,1));
-  path.push_back(cm.beta(dh1,0,2,1));
-  path.push_back(cm.beta(dh2,0));
-  path.push_back(cm.beta(dh2,2,1));
-  
-  CGAL_assertion( (CGAL::is_insertable_cell_2_in_cell_3
-		   (cm,path.begin(),path.end())) );
-
-  Dart_handle dh3=CGAL::insert_cell_2_in_cell_3(cm,path.begin(),path.end());
-  CGAL_assertion( cm.is_valid() );
-  
-  // Display the combinatorial map characteristics.
-  cm.display_characteristics(std::cout) << ", valid=" << 
-    cm.is_valid() << std::endl;
-
-  // We use the removal operations to get back to the initial hexahedron.
-  CGAL_assertion( (CGAL::is_removable<CMap_3, 2>(cm,dh3)) );
-  CGAL::remove_cell<CMap_3,2>(cm,dh3);
-  CGAL_assertion( cm.is_valid() );
-
-  CGAL_assertion( (CGAL::is_removable<CMap_3, 1>(cm,cm.beta(dh1,1))) );
-  CGAL::remove_cell<CMap_3,1>(cm,cm.beta(dh1,1));
-  CGAL_assertion( cm.is_valid() );
-  
-  CGAL_assertion( (CGAL::is_removable<CMap_3, 1>(cm,cm.beta(dh2,0))) );
-  CGAL::remove_cell<CMap_3,1>(cm,cm.beta(dh2,0));
-  CGAL_assertion( cm.is_valid() );
-  
-  // Display the combinatorial map characteristics.
-  cm.display_characteristics(std::cout) << ", valid=" 
-					<< cm.is_valid() << std::endl;
-
-  return EXIT_SUCCESS;
-}
-
diff --git a/3rdparty/CGAL-4.8/examples/Combinatorial_map/map_3_simple_example.cpp b/3rdparty/CGAL-4.8/examples/Combinatorial_map/map_3_simple_example.cpp
deleted file mode 100644
index 91d4d17..0000000
--- a/3rdparty/CGAL-4.8/examples/Combinatorial_map/map_3_simple_example.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-#include <CGAL/Combinatorial_map.h>
-#include <CGAL/Combinatorial_map_constructors.h>
-#include <iostream>
-#include <cstdlib>
-
-typedef CGAL::Combinatorial_map<3> CMap_3;
-typedef CMap_3::Dart_const_handle Dart_const_handle;
-
-  int main() 
-  { 
-    CMap_3 cm;
-
-    // Create two tetrahedra.  
-    Dart_const_handle dh1 = CGAL::make_combinatorial_tetrahedron(cm); 
-    Dart_const_handle dh2 = CGAL::make_combinatorial_tetrahedron(cm);
-  
-    // Display the combinatorial map characteristics.
-    cm.display_characteristics(std::cout); 
-    std::cout<<", valid="<<cm.is_valid()<<std::endl;
-  
-    unsigned int res = 0; 
-    // Iterate over all the darts of the first tetrahedron.  
-    // Note that CMap_3::Dart_of_orbit_range<1,2> in 3D is equivalent to 
-    // CMap_3::Dart_of_cell_range<3>.  
-    for  (CMap_3::Dart_of_orbit_range<1,2>::const_iterator
-          it(cm.darts_of_orbit<1,2>(dh1).begin()),
-          itend(cm.darts_of_orbit<1,2>(dh1).end()); it!=itend; ++it) 
-       ++res;
-
-    std::cout<<"Number of darts of the first tetrahedron: "
-             <<res<<std::endl;
-
-    res = 0; 
-    // Iterate over all the darts of the facet containing dh2.  
-    for (CMap_3::Dart_of_orbit_range<1>::const_iterator
-         it(cm.darts_of_orbit<1>(dh2).begin()),
-         itend(cm.darts_of_orbit<1>(dh2).end()); it!=itend; ++it) 
-       ++res;
-  
-    std::cout<<"Number of darts of the facet containing dh2: "
-             <<res<<std::endl; 
-
-    return EXIT_SUCCESS;
-}
-
diff --git a/3rdparty/CGAL-4.8/examples/Combinatorial_map/map_3_with_colored_facets.cpp b/3rdparty/CGAL-4.8/examples/Combinatorial_map/map_3_with_colored_facets.cpp
deleted file mode 100644
index 7fd5573..0000000
--- a/3rdparty/CGAL-4.8/examples/Combinatorial_map/map_3_with_colored_facets.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-#include <CGAL/Combinatorial_map.h>
-#include <CGAL/Combinatorial_map_constructors.h>
-#include <CGAL/Combinatorial_map_operations.h>
-#include <CGAL/Cell_attribute.h>
-#include <iostream>
-#include <algorithm>
-#include <cstdlib>
-
-struct Sum_functor
-{
-  template<class Cell_attribute>
-  void operator()(Cell_attribute& ca1,Cell_attribute& ca2)
-  { ca1.info()=ca1.info()+ca2.info(); }
-};
-struct Divide_by_two_functor
-{
-  template<class Cell_attribute>
-  void operator()(Cell_attribute& ca1,Cell_attribute& ca2)
-  {
-    ca1.info()=(ca1.info()/2);
-    ca2.info()=(ca1.info());
-  }
-};
-
-struct Myitem
-{
-  template<class CMap>
-  struct Dart_wrapper
-  {
-    typedef CGAL::Dart<3, CMap> Dart;
-    typedef CGAL::Cell_attribute<CMap, int, CGAL::Tag_true,
-     Sum_functor, Divide_by_two_functor> Facet_attribute;
-    typedef CGAL::cpp11::tuple<void,void,Facet_attribute> Attributes;
-  };
-};
-
-typedef CGAL::Combinatorial_map<3,Myitem> CMap_3;
-typedef CMap_3::Dart_handle               Dart_handle;
-
-int main()
-{
-  CMap_3 cm;
-
-  // Create 2 hexahedra.
-  Dart_handle dh1 = CGAL::make_combinatorial_hexahedron(cm);
-  Dart_handle dh2 = CGAL::make_combinatorial_hexahedron(cm);
-
-  // 1) Create all 2-attributes and associated them to darts.
-  for (CMap_3::Dart_range::iterator
-       it=cm.darts().begin(), itend=cm.darts().end();
-       it!=itend; ++it)
-  {
-    if ( cm.attribute<2>(it)==NULL )
-      cm.set_attribute<2>(it, cm.create_attribute<2>());
-  }
-
-  // 2) Set the color of all facets of the first hexahedron to 7.
-  for (CMap_3::One_dart_per_incident_cell_range<2, 3>::iterator
-       it=cm.one_dart_per_incident_cell<2,3>(dh1).begin(),
-       itend=cm.one_dart_per_incident_cell<2,3>(dh1).end(); it!=itend; ++it)
-  { cm.info<2>(it)=7; }
-
-  // 3) Set the color of all facets of the second hexahedron to 13.
-  for (CMap_3::One_dart_per_incident_cell_range<2, 3>::iterator it=
-       cm.one_dart_per_incident_cell<2,3>(dh2).begin(),
-       itend=cm.one_dart_per_incident_cell<2,3>(dh2).end(); it!=itend; ++it)
-  { cm.info<2>(it)=13; }
-
-  // 4) 3-Sew the two hexahedra along one facet.
-  cm.sew<3>(dh1, dh2);
-
-  // 5) Display all the values of 2-attributes.
-  for (CMap_3::Attribute_range<2>::type::iterator
-       it=cm.attributes<2>().begin(), itend=cm.attributes<2>().end();
-       it!=itend; ++it)
-  {
-    std::cout<<cm.info_of_attribute<2>(it)<<"; ";
-  }
-  std::cout<<std::endl;
-
-  // 6) Insert a vertex in the facet between the two hexahedra.
-  CGAL::insert_cell_0_in_cell_2(cm, dh2);
-
-  // 7) Display all the values of 2-attributes.
-  for (CMap_3::Attribute_range<2>::type::iterator
-       it=cm.attributes<2>().begin(), itend=cm.attributes<2>().end();
-       it!=itend; ++it)
-  {
-    std::cout<<cm.info_of_attribute<2>(it)<<"; ";
-  }
-  std::cout<<std::endl;
-  cm.display_characteristics(std::cout);
-  std::cout<<", valid="<<cm.is_valid()<<std::endl;
-
-  return EXIT_SUCCESS;
-}
diff --git a/3rdparty/CGAL-4.8/examples/Combinatorial_map/map_4_simple_example.cpp b/3rdparty/CGAL-4.8/examples/Combinatorial_map/map_4_simple_example.cpp
deleted file mode 100644
index fc3e8fa..0000000
--- a/3rdparty/CGAL-4.8/examples/Combinatorial_map/map_4_simple_example.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-#include <CGAL/Combinatorial_map.h>
-#include <CGAL/Combinatorial_map_constructors.h>
-#include <iostream>
-#include <cstdlib>
-
-typedef CGAL::Combinatorial_map<4> CMap_4;
-typedef CMap_4::Dart_handle Dart_handle;
-
-Dart_handle make_triangle(CMap_4& amap)
-{
- Dart_handle d1 = amap.create_dart();
- Dart_handle d2 = amap.create_dart();
- Dart_handle d3 = amap.create_dart();
- amap.link_beta<1>(d1,d2);
- amap.link_beta<1>(d2,d3);
- amap.link_beta<1>(d3,d1);
- return d1;
-}
- 
-Dart_handle make_tetrahedral(CMap_4& amap)
-{
-  Dart_handle d1 = make_triangle(amap);
-  Dart_handle d2 = make_triangle(amap);
-  Dart_handle d3 = make_triangle(amap);
-  Dart_handle d4 = make_triangle(amap);
-  amap.link_beta<2>(d1, d2);
-  amap.link_beta<2>(d3, amap.beta(d2,0));
-  amap.link_beta<2>(amap.beta(d1,1), amap.beta(d3,0));
-  amap.link_beta<2>(d4, amap.beta(d2,1));
-  amap.link_beta<2>(amap.beta(d4,0), amap.beta(d3,1));
-  amap.link_beta<2>(amap.beta(d4,1), amap.beta(d1,0));
-  return d1;
-}
-
-int main()
-{
-  CMap_4 cm;
-  Dart_handle d1 = make_tetrahedral(cm);
-  Dart_handle d2 = make_tetrahedral(cm);
-  
-  cm.sew<4>(d1,d2);
-  
-  cm.display_characteristics(std::cout);
-  std::cout<<", valid="<<cm.is_valid()<<std::endl;
-
-  return EXIT_SUCCESS;
-}
-
diff --git a/3rdparty/CGAL-4.8/examples/Convex_decomposition_3/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Convex_decomposition_3/CMakeLists.txt
deleted file mode 100644
index 904019d..0000000
--- a/3rdparty/CGAL-4.8/examples/Convex_decomposition_3/CMakeLists.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Convex_decomposition_3_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "list_of_convex_parts.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Convex_hull_2/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Convex_hull_2/CMakeLists.txt
deleted file mode 100644
index cffc3a6..0000000
--- a/3rdparty/CGAL-4.8/examples/Convex_hull_2/CMakeLists.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Convex_hull_2_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-    include_directories (BEFORE "include")
-
-  create_single_source_cgal_program( "array_convex_hull_2.cpp" )
-  create_single_source_cgal_program( "ch_from_cin_to_cout.cpp" )
-  create_single_source_cgal_program( "ch_graham_anderson.cpp" )
-  create_single_source_cgal_program( "ch_timing.cpp" )
-  create_single_source_cgal_program( "convex_hull_yz.cpp" )
-  create_single_source_cgal_program( "iostream_convex_hull_2.cpp" )
-  create_single_source_cgal_program( "vector_convex_hull_2.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Convex_hull_3/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Convex_hull_3/CMakeLists.txt
deleted file mode 100644
index e41901c..0000000
--- a/3rdparty/CGAL-4.8/examples/Convex_hull_3/CMakeLists.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Convex_hull_3_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "dynamic_hull_3.cpp" )
-  create_single_source_cgal_program( "halfspace_intersection_3.cpp" )
-  create_single_source_cgal_program( "lloyd_algorithm.cpp" )
-  create_single_source_cgal_program( "quickhull_3.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Envelope_2/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Envelope_2/CMakeLists.txt
deleted file mode 100644
index 966f865..0000000
--- a/3rdparty/CGAL-4.8/examples/Envelope_2/CMakeLists.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Envelope_2_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "convex_hull.cpp" )
-  create_single_source_cgal_program( "envelope_circles.cpp" )
-  create_single_source_cgal_program( "envelope_segments.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Envelope_3/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Envelope_3/CMakeLists.txt
deleted file mode 100644
index 759cd30..0000000
--- a/3rdparty/CGAL-4.8/examples/Envelope_3/CMakeLists.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Envelope_3_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "envelope_planes.cpp" )
-  create_single_source_cgal_program( "envelope_spheres.cpp" )
-  create_single_source_cgal_program( "envelope_triangles.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Filtered_kernel/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Filtered_kernel/CMakeLists.txt
deleted file mode 100644
index c85ee47..0000000
--- a/3rdparty/CGAL-4.8/examples/Filtered_kernel/CMakeLists.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Filtered_kernel_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "Filtered_predicate.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Generator/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Generator/CMakeLists.txt
deleted file mode 100644
index 2997c09..0000000
--- a/3rdparty/CGAL-4.8/examples/Generator/CMakeLists.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Generator_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "ball_d.cpp" )
-  create_single_source_cgal_program( "combination_enumerator.cpp" )
-  create_single_source_cgal_program( "cube_d.cpp" )
-  create_single_source_cgal_program( "grid_d.cpp" )
-  create_single_source_cgal_program( "name_pairs.cpp" )
-  create_single_source_cgal_program( "random_convex_hull_2.cpp" )
-  create_single_source_cgal_program( "random_convex_set.cpp" )
-  create_single_source_cgal_program( "random_degenerate_point_set.cpp" )
-  create_single_source_cgal_program( "random_grid.cpp" )
-  create_single_source_cgal_program( "random_points_tetrahedron_and_triangle_3.cpp" )
-  create_single_source_cgal_program( "random_points_triangle_2.cpp" )
-  create_single_source_cgal_program( "random_polygon.cpp" )
-  create_single_source_cgal_program( "random_polygon2.cpp" )
-  create_single_source_cgal_program( "random_segments1.cpp" )
-  create_single_source_cgal_program( "random_segments2.cpp" )
-  create_single_source_cgal_program( "sphere_d.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/HalfedgeDS/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/HalfedgeDS/CMakeLists.txt
deleted file mode 100644
index 929724d..0000000
--- a/3rdparty/CGAL-4.8/examples/HalfedgeDS/CMakeLists.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( HalfedgeDS_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "hds_prog_color.cpp" )
-  create_single_source_cgal_program( "hds_prog_compact.cpp" )
-  create_single_source_cgal_program( "hds_prog_compact2.cpp" )
-  create_single_source_cgal_program( "hds_prog_default.cpp" )
-  create_single_source_cgal_program( "hds_prog_edge_iterator.cpp" )
-  create_single_source_cgal_program( "hds_prog_graph.cpp" )
-  create_single_source_cgal_program( "hds_prog_graph2.cpp" )
-  create_single_source_cgal_program( "hds_prog_halfedge_iterator.cpp" )
-  create_single_source_cgal_program( "hds_prog_vector.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Inscribed_areas/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Inscribed_areas/CMakeLists.txt
deleted file mode 100644
index 4df3c67..0000000
--- a/3rdparty/CGAL-4.8/examples/Inscribed_areas/CMakeLists.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Inscribed_areas_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "extremal_polygon_2_area.cpp" )
-  create_single_source_cgal_program( "extremal_polygon_2_perimeter.cpp" )
-  create_single_source_cgal_program( "largest_empty_rectangle.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Interpolation/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Interpolation/CMakeLists.txt
deleted file mode 100644
index c1f76e5..0000000
--- a/3rdparty/CGAL-4.8/examples/Interpolation/CMakeLists.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Interpolation_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "interpolation_2.cpp" )
-  create_single_source_cgal_program( "linear_interpolation_2.cpp" )
-  create_single_source_cgal_program( "nn_coordinates_2.cpp" )
-  create_single_source_cgal_program( "nn_coordinates_3.cpp" )
-  create_single_source_cgal_program( "rn_coordinates_2.cpp" )
-  create_single_source_cgal_program( "sibson_interpolation_2.cpp" )
-  create_single_source_cgal_program( "surface_neighbor_coordinates_3.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Interval_skip_list/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Interval_skip_list/CMakeLists.txt
deleted file mode 100644
index 0808858..0000000
--- a/3rdparty/CGAL-4.8/examples/Interval_skip_list/CMakeLists.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Interval_skip_list_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "intervals.cpp" )
-  create_single_source_cgal_program( "isl_terrain.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Jet_fitting_3/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Jet_fitting_3/CMakeLists.txt
deleted file mode 100644
index c75cc60..0000000
--- a/3rdparty/CGAL-4.8/examples/Jet_fitting_3/CMakeLists.txt
+++ /dev/null
@@ -1,56 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Jet_fitting_3_example )
-
-cmake_minimum_required(VERSION 2.8.11)
-
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  # use either Eigen or BLAS/LAPACK
-  find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater)
-  if (NOT EIGEN3_FOUND)
-    find_package(LAPACK)
-    if(LAPACK_FOUND)
-      include( ${LAPACK_USE_FILE} )
-    endif(LAPACK_FOUND)
-  else()
-    include( ${EIGEN3_USE_FILE} )
-  endif()
-    
-  if(EIGEN3_FOUND OR LAPACK_FOUND)
-    # Link with Boost.ProgramOptions (optional)
-    find_package(Boost QUIET COMPONENTS program_options)
-    if(Boost_PROGRAM_OPTIONS_FOUND)
-      if( CGAL_AUTO_LINK_ENABLED )
-        message( STATUS "Boost.ProgramOptions library: found" )
-      else()
-        message( STATUS "Boost.ProgramOptions library: ${Boost_PROGRAM_OPTIONS_LIBRARY}" )
-      endif()
-      add_definitions( "-DCGAL_USE_BOOST_PROGRAM_OPTIONS" )
-      list(APPEND CGAL_3RD_PARTY_LIBRARIES ${Boost_LIBRARIES})
-   endif()
-
-    create_single_source_cgal_program( "Mesh_estimation.cpp" )
-    create_single_source_cgal_program( "Single_estimation.cpp" )
-
-  else(EIGEN3_FOUND OR LAPACK_FOUND)
-
-    message(STATUS "NOTICE: This program requires either Eigen 3.1 (or greater) or LAPACK, and will not be compiled.")
-
-  endif(EIGEN3_FOUND OR LAPACK_FOUND)
-
-else()
-
-    message(STATUS "NOTICE: This program requires the CGAL library, and will not be compiled.")
-
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Kernel_23/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Kernel_23/CMakeLists.txt
deleted file mode 100644
index e1b3bac..0000000
--- a/3rdparty/CGAL-4.8/examples/Kernel_23/CMakeLists.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Kernel_23_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "MyKernel.cpp" )
-  create_single_source_cgal_program( "cartesian_converter.cpp" )
-  create_single_source_cgal_program( "exact.cpp" )
-  create_single_source_cgal_program( "intersection_get.cpp" )
-  create_single_source_cgal_program( "intersection_visitor.cpp" )
-  create_single_source_cgal_program( "intersections.cpp" )
-  create_single_source_cgal_program( "points_and_segment.cpp" )
-  create_single_source_cgal_program( "surprising.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Kernel_23/MyPointC2_iostream.h b/3rdparty/CGAL-4.8/examples/Kernel_23/MyPointC2_iostream.h
deleted file mode 100644
index 462ea20..0000000
--- a/3rdparty/CGAL-4.8/examples/Kernel_23/MyPointC2_iostream.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef MYPOINTC2_IOSTREAM_H
-#define MYPOINTC2_IOSTREAM_H
-
-std::ostream &
-operator<<(std::ostream &os, const MyPointC2 &p)
-{
-    switch(os.iword(CGAL::IO::mode)) {
-    case CGAL::IO::ASCII :
-        return os << p.x() << ' ' << p.y() << ' ' << p.color();
-    case CGAL::IO::BINARY :
-        CGAL::write(os, p.x());
-        CGAL::write(os, p.y());
-        CGAL::write(os, p.color());
-        return os;
-    default:
-        return os << "MyPointC2(" << p.x() << ", " << p.y() << ", " << p.color() << ')';
-    }
-}
-
-
-
-std::istream &
-operator>>(std::istream &is, MyPointC2 &p)
-{
-    double x, y;
-    int c;
-    switch(is.iword(CGAL::IO::mode)) {
-    case CGAL::IO::ASCII :
-      is >> x >> y >> c;
-        break;
-    case CGAL::IO::BINARY :
-        CGAL::read(is, x);
-        CGAL::read(is, y);
-	CGAL::read(is, c);
-        break;
-    default:
-        std::cerr << "" << std::endl;
-        std::cerr << "Stream must be in ascii or binary mode" << std::endl;
-        break;
-    }
-    if (is) {
-      p = MyPointC2(x, y, c);
-    }
-    return is;
-}
-#endif //MYPOINTC2_IOSTREAM_H
diff --git a/3rdparty/CGAL-4.8/examples/Kernel_23/MySegmentC2.h b/3rdparty/CGAL-4.8/examples/Kernel_23/MySegmentC2.h
deleted file mode 100644
index e83009c..0000000
--- a/3rdparty/CGAL-4.8/examples/Kernel_23/MySegmentC2.h
+++ /dev/null
@@ -1,254 +0,0 @@
-#ifndef MY_SEGMENT_2_H
-#define MY_SEGMENT_2_H
-
-#include <boost/config.hpp>
-
-template < class R_ >
-class MySegmentC2
-{
-  typedef typename R_::FT                   FT;
-  typedef typename R_::Point_2              Point_2;
-  typedef typename R_::Vector_2             Vector_2;
-  typedef typename R_::Direction_2          Direction_2;
-  typedef typename R_::Line_2               Line_2;
-  typedef typename R_::Segment_2            Segment_2;
-  typedef typename R_::Aff_transformation_2 Aff_transformation_2;
-
-  Point_2 sp_, tp_;
-public:
-  typedef R_                                     R;
-
-  MySegmentC2() {}
-
-  MySegmentC2(const Point_2 &sp, const Point_2 &tp)
-    : sp_(sp), tp_(tp) {}
-
-  bool        is_horizontal() const;
-  bool        is_vertical() const;
-  bool        has_on(const Point_2 &p) const;
-  bool        collinear_has_on(const Point_2 &p) const;
-
-  bool        operator==(const MySegmentC2 &s) const;
-  bool        operator!=(const MySegmentC2 &s) const;
-
-  const Point_2 &   source() const
-  {
-      return sp_;
-  }
-
-  const Point_2 &   target() const
-  {
-      return tp_;
-  }
-  const Point_2 &    start() const;
-  const Point_2 &    end() const;
-
-  const Point_2 &   min BOOST_PREVENT_MACRO_SUBSTITUTION () const;
-  const Point_2 &   max BOOST_PREVENT_MACRO_SUBSTITUTION () const;
-  const Point_2 &   vertex(int i) const;
-  const Point_2 &   point(int i) const;
-  const Point_2 &   operator[](int i) const;
-
-  FT          squared_length() const;
-
-  Direction_2 direction() const;
-  Vector_2    to_vector() const;
-  Line_2      supporting_line() const;
-  Segment_2   opposite() const;
-
-  Segment_2   transform(const Aff_transformation_2 &t) const
-  {
-    return Segment_2(t.transform(source()), t.transform(target()));
-  }
-
-  bool        is_degenerate() const;
-  CGAL::Bbox_2      bbox() const;
-};
-
-template < class R >
-inline
-bool
-MySegmentC2<R>::operator==(const MySegmentC2<R> &s) const
-{
-  return source() == s.source() && target() == s.target();
-}
-
-template < class R >
-inline
-bool
-MySegmentC2<R>::operator!=(const MySegmentC2<R> &s) const
-{
-  return !(*this == s);
-}
-
-
-
-template < class R >
-CGAL_KERNEL_INLINE
-const typename MySegmentC2<R>::Point_2 &
-MySegmentC2<R>::min BOOST_PREVENT_MACRO_SUBSTITUTION () const
-{
-  typename R::Less_xy_2 less_xy;
-  return less_xy(source(),target()) ? source() : target();
-}
-
-template < class R >
-CGAL_KERNEL_INLINE
-const typename MySegmentC2<R>::Point_2 &
-MySegmentC2<R>::max BOOST_PREVENT_MACRO_SUBSTITUTION() const
-{
-  typename R::Less_xy_2 less_xy;
-  return less_xy(source(),target()) ? target() : source();
-}
-
-template < class R >
-CGAL_KERNEL_INLINE
-const typename MySegmentC2<R>::Point_2 &
-MySegmentC2<R>::vertex(int i) const
-{
-  return (i%2 == 0) ? source() : target();
-}
-
-template < class R >
-CGAL_KERNEL_INLINE
-const typename MySegmentC2<R>::Point_2 &
-MySegmentC2<R>::point(int i) const
-{
-  return (i%2 == 0) ? source() : target();
-}
-
-template < class R >
-inline
-const typename MySegmentC2<R>::Point_2 &
-MySegmentC2<R>::operator[](int i) const
-{
-  return vertex(i);
-}
-
-template < class R >
-CGAL_KERNEL_INLINE
-typename MySegmentC2<R>::FT
-MySegmentC2<R>::squared_length() const
-{
-  typename R::Compute_squared_distance_2 squared_distance;
-  return squared_distance(source(), target());
-}
-
-template < class R >
-CGAL_KERNEL_INLINE
-typename MySegmentC2<R>::Direction_2
-MySegmentC2<R>::direction() const
-{
-  typename R::Construct_vector_2 construct_vector;
-  return Direction_2( construct_vector( source(), target()));
-}
-
-template < class R >
-CGAL_KERNEL_INLINE
-typename MySegmentC2<R>::Vector_2
-MySegmentC2<R>::to_vector() const
-{
-  typename R::Construct_vector_2 construct_vector;
-  return construct_vector( source(), target());
-}
-
-template < class R >
-inline
-typename MySegmentC2<R>::Line_2
-MySegmentC2<R>::supporting_line() const
-{
-  typename R::Construct_line_2 construct_line;
-
-  return construct_line(*this);
-}
-
-template < class R >
-inline
-typename MySegmentC2<R>::Segment_2
-MySegmentC2<R>::opposite() const
-{
-  return MySegmentC2<R>(target(), source());
-}
-
-template < class R >
-CGAL_KERNEL_INLINE
-CGAL::Bbox_2
-MySegmentC2<R>::bbox() const
-{
-  return source().bbox() + target().bbox();
-}
-
-template < class R >
-inline
-bool
-MySegmentC2<R>::is_degenerate() const
-{
-  return R().equal_y_2_object()(source(), target());
-}
-
-template < class R >
-CGAL_KERNEL_INLINE
-bool
-MySegmentC2<R>::is_horizontal() const
-{
-  return R().equal_y_2_object()(source(), target());
-}
-
-template < class R >
-CGAL_KERNEL_INLINE
-bool
-MySegmentC2<R>::is_vertical() const
-{
-  return R().equal_x_2_object()(source(), target());
-}
-
-template < class R >
-CGAL_KERNEL_INLINE
-bool
-MySegmentC2<R>::
-has_on(const typename MySegmentC2<R>::Point_2 &p) const
-{
-  return R().collinear_are_ordered_along_line_2_object()(source(), p, target());
-}
-
-template < class R >
-inline
-bool
-MySegmentC2<R>::
-collinear_has_on(const typename MySegmentC2<R>::Point_2 &p) const
-{
-  return R().collinear_has_on_2_object()(*this, p);
-}
-
-template < class R >
-std::ostream &
-operator<<(std::ostream &os, const MySegmentC2<R> &s)
-{
-    switch(os.iword(CGAL::IO::mode)) {
-    case CGAL::IO::ASCII :
-        return os << s.source() << ' ' << s.target();
-    case CGAL::IO::BINARY :
-        return os << s.source() << s.target();
-    default:
-        return os << "MySegmentC2(" << s.source() <<  ", " << s.target() << ")";
-    }
-}
-
-
-
-template < class R >
-std::istream &
-operator>>(std::istream &is, MySegmentC2<R> &s)
-{
-    typename R::Point_2 p, q;
-
-    is >> p >> q;
-
-    if (is)
-	s = MySegmentC2<R>(p, q);
-    return is;
-}
-
-
-
-#endif // CARTESIAN_SEGMENT_2_H
diff --git a/3rdparty/CGAL-4.8/examples/Kinetic_data_structures/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Kinetic_data_structures/CMakeLists.txt
deleted file mode 100644
index 89addbd..0000000
--- a/3rdparty/CGAL-4.8/examples/Kinetic_data_structures/CMakeLists.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Kinetic_data_structures_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "Kinetic_Delaunay_triangulation_2.cpp" )
-  create_single_source_cgal_program( "Kinetic_Delaunay_triangulation_3.cpp" )
-  create_single_source_cgal_program( "Kinetic_insert_event.cpp" )
-  create_single_source_cgal_program( "Kinetic_regular_triangulation_3.cpp" )
-  create_single_source_cgal_program( "Kinetic_sort.cpp" )
-  create_single_source_cgal_program( "Kinetic_sweepline.cpp" )
-  create_single_source_cgal_program( "defining_a_simulation_traits.cpp" )
-  create_single_source_cgal_program( "trivial_kds.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Kinetic_framework/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Kinetic_framework/CMakeLists.txt
deleted file mode 100644
index 3cb06fd..0000000
--- a/3rdparty/CGAL-4.8/examples/Kinetic_framework/CMakeLists.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Kinetic_framework_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "adding_a_certificate.cpp" )
-  create_single_source_cgal_program( "listener.cpp" )
-  create_single_source_cgal_program( "pointer_queue.cpp" )
-  create_single_source_cgal_program( "ref_counted.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Linear_cell_complex/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Linear_cell_complex/CMakeLists.txt
deleted file mode 100644
index 390519e..0000000
--- a/3rdparty/CGAL-4.8/examples/Linear_cell_complex/CMakeLists.txt
+++ /dev/null
@@ -1,59 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-project( Linear_cell_complex_examples )
-
-cmake_minimum_required(VERSION 2.8.11)
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-# If you want to visualize a linear cell complex, you can use the following viewer
-# based on qt. Just uncomment the following two lines, plus the lines qt5_use_modules below
-
-# find_package(CGAL COMPONENTS Qt5)
-# include("CMakeLCCViewerQt.inc")
-
-# If you don't want to visualize, use the following line (otherwise comment it)
-find_package(CGAL QUIET COMPONENTS Core)
-
-# For Gprof.
-# ADD_DEFINITIONS("-pg")
-# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
-
-# To use valgrind, we must disable rounding math ckeck.
-# add_definition(-DCGAL_DISABLE_ROUNDING_MATH_CHECK)
-
-if ( CGAL_FOUND )
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-  include_directories(BEFORE ../../include)
-
-  create_single_source_cgal_program( "linear_cell_complex_3.cpp" )
-  create_single_source_cgal_program( "linear_cell_complex_4.cpp" )
-  create_single_source_cgal_program(
-                  "linear_cell_complex_3_with_colored_vertices.cpp" )
-  create_single_source_cgal_program(
-                  "linear_cell_complex_3_with_mypoint.cpp" )
-
-  create_single_source_cgal_program("plane_graph_to_lcc_2.cpp")
-  create_single_source_cgal_program("linear_cell_complex_3_attributes_management.cpp")
-
-  add_executable(voronoi_2 voronoi_2.cpp)
-  target_link_libraries(voronoi_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES}
-                                  ${MAP_VIEWER_LIBRARIES})
-  # qt5_use_modules(voronoi_2 ${MAP_VIEWER_MODULES})
-
-  add_executable(voronoi_3 voronoi_3.cpp)
-  target_link_libraries(voronoi_3 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES}
-                                  ${MAP_VIEWER_LIBRARIES})
-  # qt5_use_modules(voronoi_3 ${MAP_VIEWER_MODULES})
-
-else()
-
-  message(STATUS "This program requires the CGAL library, "
-                  "and will not be compiled.")
-
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Linear_cell_complex/linear_cell_complex_3_attributes_management.cpp b/3rdparty/CGAL-4.8/examples/Linear_cell_complex/linear_cell_complex_3_attributes_management.cpp
deleted file mode 100644
index 38ba1fa..0000000
--- a/3rdparty/CGAL-4.8/examples/Linear_cell_complex/linear_cell_complex_3_attributes_management.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-#include <CGAL/Linear_cell_complex.h>
-#include <CGAL/Linear_cell_complex_operations.h>
-#include <CGAL/Linear_cell_complex_constructors.h>
-#include <CGAL/Timer.h>
-#include <iostream>
-#include <fstream>
-
-typedef CGAL::Linear_cell_complex<2,3> LCC_3;
-typedef LCC_3::Dart_handle             Dart_handle;
-typedef LCC_3::Point                   Point;
-typedef LCC_3::FT                      FT;
-
-void load_and_simplify_off(LCC_3& lcc, const std::string& filename,
-                           bool updateattribs, int percent)
-{
-  std::ifstream ifile(filename.c_str());
-  if (ifile)
-  {
-    CGAL::load_off(lcc, ifile);
-    CGAL::Timer timer;
-    Dart_handle dh;
-    std::size_t nb=(lcc.number_of_darts()*percent)/200;
-    timer.start();
-
-    if (!updateattribs) lcc.set_automatic_attributes_management(false);
-    for (LCC_3::Dart_range::iterator it=lcc.darts().begin(),
-           itend=lcc.darts().end(); it!=itend && nb>0; )
-    {
-      dh=it++;
-      if ( it!=itend && it==lcc.beta<2>(dh) ) ++it;
-      CGAL::remove_cell<LCC_3, 1>(lcc, dh);
-      --nb;
-    }
-    if ( !updateattribs ) lcc.set_automatic_attributes_management(true);
-
-    timer.stop();
-    lcc.display_characteristics(std::cout);
-    std::cout<<", valid="<< lcc.is_valid()
-             <<" time: "<<timer.time()<<" seconds." << std::endl;
-  }
-}
-
-int main(int narg, char** argv)
-{
-  if (narg>1 && (!strcmp(argv[1],"-h") || !strcmp(argv[1],"-?")) )
-  {
-    std::cout<<"Usage: a.out file.off [percentage]"<<std::endl;
-    return EXIT_FAILURE;
-  }
-
-  std::string filename;
-  if ( narg==1 )
-  {
-    filename=std::string("data/armadillo.off");
-    std::cout<<"No filename given: use data/armadillo.off by default."<<std::endl;
-  }
-  else filename=std::string(argv[1]);
-
-  int percent = 30; // remove 30 percent of edges
-  if ( narg>2 ) { percent = atoi(argv[2]); }
-  std::cout<<percent<<"% edges to remove."<<std::endl;
-
-  LCC_3 lcc;
-  std::cout<<"Update attribute DURING operations: ";
-  load_and_simplify_off(lcc, filename, true, percent);
-
-  LCC_3 lcc2;
-  std::cout<<"Update attribute AFTER operations: ";
-  load_and_simplify_off(lcc2, filename, false, percent);
-
-  return EXIT_SUCCESS;
-}
diff --git a/3rdparty/CGAL-4.8/examples/Linear_cell_complex/linear_cell_complex_3_viewer_qt.h b/3rdparty/CGAL-4.8/examples/Linear_cell_complex/linear_cell_complex_3_viewer_qt.h
deleted file mode 100644
index 1a16423..0000000
--- a/3rdparty/CGAL-4.8/examples/Linear_cell_complex/linear_cell_complex_3_viewer_qt.h
+++ /dev/null
@@ -1,932 +0,0 @@
-// Copyright (c) 2011 CNRS and LIRIS' Establishments (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Guillaume Damiand <guillaume.damiand at liris.cnrs.fr>
-
-#ifndef CGAL_LCC_3_VIEWER_QT_H
-#define CGAL_LCC_3_VIEWER_QT_H
-
-#include <QApplication>
-#include <QKeyEvent>
-
-#include <QGLViewer/qglviewer.h>
-#include <QKeyEvent>
-#include <QOpenGLFunctions_2_1>
-#include <QOpenGLVertexArrayObject>
-#include <QGLBuffer>
-#include <QOpenGLShaderProgram>
-
-#include <CGAL/Linear_cell_complex.h>
-#include <CGAL/Cartesian_converter.h>
-#include <CGAL/Triangulation_2_filtered_projection_traits_3.h>
-#include <CGAL/Triangulation_vertex_base_with_info_2.h>
-#include <CGAL/Triangulation_face_base_with_info_2.h>
-#include <CGAL/Constrained_Delaunay_triangulation_2.h>
-#include <CGAL/Constrained_triangulation_plus_2.h>
-#include <CGAL/Qt/CreateOpenGLContext.h>
-
-#include <vector>
-
-typedef CGAL::Exact_predicates_inexact_constructions_kernel Local_kernel;
-typedef Local_kernel::Point_3  Local_point;
-typedef Local_kernel::Vector_3 Local_vector;
-
-template<class LCC, int dim=LCC::ambient_dimension>
-struct Geom_utils;
-
-template<class LCC>
-struct Geom_utils<LCC,3>
-{
-  Local_point get_point(LCC& lcc, typename LCC::Vertex_attribute_const_handle vh)
-  { return converter(lcc.point_of_vertex_attribute(vh)); }
-
-  Local_point get_point(LCC& lcc, typename LCC::Dart_const_handle dh)
-  { return converter(lcc.point(dh)); }
-
-  Local_vector get_facet_normal(LCC& lcc, typename LCC::Dart_const_handle dh)
-  {
-    Local_vector n = converter(CGAL::compute_normal_of_cell_2<LCC>(lcc,dh));
-    n = n/(CGAL::sqrt(n*n));
-    return n;
-  }
-
-  Local_vector get_vertex_normal(LCC& lcc, typename LCC::Dart_const_handle dh)
-  {
-    Local_vector n = converter(CGAL::compute_normal_of_cell_0<LCC>(lcc,dh));
-    n = n/(CGAL::sqrt(n*n));
-    return n;
-  }
-protected:
-  CGAL::Cartesian_converter<typename LCC::Traits, Local_kernel> converter;
-};
-
-template<class LCC>
-struct Geom_utils<LCC,2>
-{
-  Local_point get_point(LCC& lcc, typename LCC::Vertex_attribute_const_handle vh)
-  {
-    Local_point p(converter(lcc.point_of_vertex_attribute(vh).x()),0,
-                  converter(lcc.point_of_vertex_attribute(vh).y()));
-    return p;
-  }
-
-  Local_point get_point(LCC& lcc, typename LCC::Dart_const_handle dh)
-  { return get_point(lcc, lcc.vertex_attribute(dh)); }
-
-  Local_vector get_facet_normal(LCC&, typename LCC::Dart_const_handle)
-  {
-    Local_vector n(0,1,0);
-    return n;
-  }
-
-  Local_vector get_vertex_normal(LCC&, typename LCC::Dart_const_handle)
-  {
-    Local_vector n(0,1,0);
-    return n;
-  }
-protected:
-  CGAL::Cartesian_converter<typename LCC::Traits, Local_kernel> converter;
-};
-
-template<class LCC>
-CGAL::Bbox_3 bbox(LCC& lcc)
-{
-  CGAL::Bbox_3 bb;
-  Geom_utils<LCC> geomutils;
-
-  typename LCC::Vertex_attribute_range::const_iterator
-    it=lcc.vertex_attributes().begin(), itend=lcc.vertex_attributes().end();
-  if ( it!=itend )
-  {
-    bb = geomutils.get_point(lcc, it).bbox();
-    for( ++it; it!=itend; ++it)
-    {
-      bb = bb + geomutils.get_point(lcc, it).bbox();
-    }
-  }
-
-  return bb;
-}
-
-template<class LCC>
-class SimpleLCCViewerQt : public QGLViewer, public QOpenGLFunctions_2_1
-{
-  typedef typename LCC::Dart_handle Dart_handle;
-
-  struct Vertex_info
-  {
-    Dart_handle dh;
-    Local_vector v;
-  };
-
-  struct Face_info
-  {
-    bool exist_edge[3];
-    bool is_external;
-    bool is_process;
-  };
-
-  typedef CGAL::Triangulation_2_filtered_projection_traits_3<CGAL::Exact_predicates_inexact_constructions_kernel> P_traits;
-  typedef CGAL::Triangulation_vertex_base_with_info_2<Vertex_info, P_traits> Vb;
-
-  typedef CGAL::Triangulation_face_base_with_info_2<Face_info, P_traits> Fb1;
-
-  typedef CGAL::Constrained_triangulation_face_base_2<P_traits, Fb1>    Fb;
-  typedef CGAL::Triangulation_data_structure_2<Vb,Fb>                   TDS;
-  typedef CGAL::No_intersection_tag                                     Itag;
-  typedef CGAL::Constrained_Delaunay_triangulation_2<P_traits, TDS,
-                                                     Itag>              CDT;
-
-public:
-  // Constructor/Destructor
-  SimpleLCCViewerQt(LCC& alcc) :
-    QGLViewer(CGAL::Qt::createOpenGLContext()),
-    lcc(alcc),
-    wireframe(false),
-    flatShading(true),
-    edges(true),
-    vertices(true),
-    are_buffers_initialized(false)
-  {
-    setWindowTitle("3D lcc viewer");
-    resize(500, 450);
-
-    QGLFormat newFormat = this->format();
-    newFormat.setSampleBuffers(true);
-    newFormat.setSamples(16);
-    this->setFormat(newFormat);
-  }
-
-  ~SimpleLCCViewerQt()
-  {
-    buffers[0].destroy();
-    buffers[1].destroy();
-    buffers[2].destroy();
-    buffers[3].destroy();
-    buffers[4].destroy();
-    buffers[5].destroy();
-    vao[0].destroy();
-    vao[1].destroy();
-    vao[2].destroy();
-    vao[3].destroy();
-  }
-
-protected:
-  void compile_shaders()
-  {
-    if(!buffers[0].create() || !buffers[1].create() || !buffers[2].create() ||
-       !buffers[3].create() || !buffers[4].create() || !buffers[5].create())
-    {
-      std::cerr<<"VBO Creation FAILED"<<std::endl;
-    }
-
-    if(!vao[0].create() || !vao[1].create() || !vao[2].create() || !vao[3].create())
-    {
-      std::cerr<<"VAO Creation FAILED"<<std::endl;
-    }
-
-    //The Facets
-
-    //Vertex source code
-// "attribute highp vec3 color;\n"
-//        "uniform highp vec4 color;\n"
-        //        "varying highp vec4 fColor; \n"
-        //        "   fColor = vec4(color, 1.0); \n"
-    const char vertex_source[] =
-      {
-        "#version 120 \n"
-        "attribute highp vec4 vertex;\n"
-        "attribute highp vec3 normal;\n"
-
-        "uniform highp mat4 mvp_matrix;\n"
-        "uniform highp mat4 mv_matrix; \n"
-
-        "varying highp vec4 fP; \n"
-        "varying highp vec3 fN; \n"
-        "void main(void)\n"
-        "{\n"
-        "   fP = mv_matrix * vertex; \n"
-        "   fN = mat3(mv_matrix)* normal; \n"
-        "   gl_Position = mvp_matrix * vertex;\n"
-        "}"
-      };
-    //Vertex source code
-// "varying highp vec4 fColor; \n"
-    const char fragment_source[] =
-      {
-        "#version 120 \n"
-        "varying highp vec4 fP; \n"
-        "varying highp vec3 fN; \n"
-        "uniform highp vec4 color; \n"
-        "uniform vec4 light_pos;  \n"
-        "uniform vec4 light_diff; \n"
-        "uniform vec4 light_spec; \n"
-        "uniform vec4 light_amb;  \n"
-        "uniform float spec_power ; \n"
-
-        "void main(void) { \n"
-
-        "   vec3 L = light_pos.xyz - fP.xyz; \n"
-        "   vec3 V = -fP.xyz; \n"
-
-        "   vec3 N = normalize(fN); \n"
-        "   L = normalize(L); \n"
-        "   V = normalize(V); \n"
-
-        "   vec3 R = reflect(-L, N); \n"
-        "   vec4 diffuse = max(dot(N,L), 0.0) * light_diff * color; \n"
-        "   vec4 specular = pow(max(dot(R,V), 0.0), spec_power) * light_spec; \n"
-
-        "gl_FragColor = light_amb*color + diffuse  ; \n"
-        "} \n"
-        "\n"
-      };
-
-    QOpenGLShader *vertex_shader = new QOpenGLShader(QOpenGLShader::Vertex);
-    if(!vertex_shader->compileSourceCode(vertex_source))
-    {
-      std::cerr<<"Compiling vertex source FAILED"<<std::endl;
-    }
-
-    QOpenGLShader *fragment_shader= new QOpenGLShader(QOpenGLShader::Fragment);
-    if(!fragment_shader->compileSourceCode(fragment_source))
-    {
-      std::cerr<<"Compiling fragmentsource FAILED"<<std::endl;
-    }
-
-    if(!rendering_program.addShader(vertex_shader))
-    {
-      std::cerr<<"adding vertex shader FAILED"<<std::endl;
-    }
-    if(!rendering_program.addShader(fragment_shader))
-    {
-      std::cerr<<"adding fragment shader FAILED"<<std::endl;
-    }
-    if(!rendering_program.link())
-    {
-      std::cerr<<"linking Program FAILED"<<std::endl;
-    }
-    rendering_program.bind();
-
-    //Vertex source code
-    const char vertex_source_p_l[] =
-      {
-        "#version 120 \n"
-        "attribute highp vec4 vertex;\n"
-        "uniform highp mat4 mvp_matrix;\n"
-        "void main(void)\n"
-        "{\n"
-        "   gl_Position = mvp_matrix * vertex;\n"
-        "}"
-      };
-    //Vertex source code
-    const char fragment_source_p_l[] =
-      {
-        "#version 120 \n"
-        "uniform highp vec4 color; \n"
-        "void main(void) { \n"
-        "gl_FragColor = color; \n"
-        "} \n"
-        "\n"
-      };
-
-    vertex_shader = new QOpenGLShader(QOpenGLShader::Vertex);
-    if(!vertex_shader->compileSourceCode(vertex_source_p_l))
-    {
-      std::cerr<<"Compiling vertex source FAILED"<<std::endl;
-    }
-
-    fragment_shader= new QOpenGLShader(QOpenGLShader::Fragment);
-    if(!fragment_shader->compileSourceCode(fragment_source_p_l))
-    {
-      std::cerr<<"Compiling fragmentsource FAILED"<<std::endl;
-    }
-
-    if(!rendering_program_p_l.addShader(vertex_shader))
-    {
-      std::cerr<<"adding vertex shader FAILED"<<std::endl;
-    }
-    if(!rendering_program_p_l.addShader(fragment_shader))
-    {
-      std::cerr<<"adding fragment shader FAILED"<<std::endl;
-    }
-    if(!rendering_program_p_l.link())
-    {
-      std::cerr<<"linking Program FAILED"<<std::endl;
-    }
-    rendering_program_p_l.bind();
-  }
-
-  void initialize_buffers()
-  {
-    //points of the facets
-    vao[0].bind();
-    buffers[0].bind();
-    buffers[0].allocate(pos_facets.data(),
-                        static_cast<int>(pos_facets.size()*sizeof(float)));
-    vertexLocation[0] = rendering_program.attributeLocation("vertex");
-    rendering_program.bind();
-    rendering_program.enableAttributeArray(vertexLocation[0]);
-    rendering_program.setAttributeBuffer(vertexLocation[0],GL_FLOAT,0,3);
-    rendering_program.release();
-    buffers[0].release();
-
-    //normals of the facets
-    buffers[1].bind();
-    buffers[1].allocate(flat_normals.data(),
-                        static_cast<int>(flat_normals.size()*sizeof(float)));
-    normalsLocation = rendering_program.attributeLocation("normal");
-    rendering_program.bind();
-    rendering_program.enableAttributeArray(normalsLocation);
-    rendering_program.setAttributeBuffer(normalsLocation,GL_FLOAT,0,3);
-    rendering_program.release();
-    buffers[1].release();
-
-    vao[0].release();
-
-    vao[1].bind();
-
-    //points of the facets
-    buffers[2].bind();
-    buffers[2].allocate(pos_facets.data(),
-                        static_cast<int>(pos_facets.size()*sizeof(float)));
-    vertexLocation[1] = rendering_program.attributeLocation("vertex");
-    rendering_program.bind();
-    rendering_program.enableAttributeArray(vertexLocation[1]);
-    rendering_program.setAttributeBuffer(vertexLocation[1],GL_FLOAT,0,3);
-    rendering_program.release();
-    buffers[2].release();
-
-    //normals of the facets
-    buffers[3].bind();
-    buffers[3].allocate(smooth_normals.data(),
-                        static_cast<int>(smooth_normals.size()*sizeof(float)));
-    normalsLocation = rendering_program.attributeLocation("normal");
-    rendering_program.bind();
-    rendering_program.enableAttributeArray(normalsLocation);
-    rendering_program.setAttributeBuffer(normalsLocation,GL_FLOAT,0,3);
-    rendering_program.release();
-    buffers[3].release();
-
-    vao[1].release();
-
-    //The lines
-    vao[2].bind();
-
-    buffers[4].bind();
-    buffers[4].allocate(pos_lines.data(), static_cast<int>(pos_lines.size()*sizeof(float)));
-    vertexLocation[2] = rendering_program_p_l.attributeLocation("vertex");
-    rendering_program_p_l.bind();
-    rendering_program_p_l.enableAttributeArray(vertexLocation[2]);
-    rendering_program_p_l.setAttributeBuffer(vertexLocation[2],GL_FLOAT,0,3);
-    buffers[4].release();
-    rendering_program_p_l.release();
-
-    vao[2].release();
-
-    //The points
-    vao[3].bind();
-    buffers[5].bind();
-    buffers[5].allocate(pos_points.data(), static_cast<int>(pos_points.size()*sizeof(float)));
-    vertexLocation[3] = rendering_program_p_l.attributeLocation("vertex");
-    rendering_program_p_l.bind();
-    rendering_program_p_l.enableAttributeArray(vertexLocation[3]);
-    rendering_program_p_l.setAttributeBuffer(vertexLocation[3],GL_FLOAT,0,3);
-    buffers[5].release();
-    rendering_program_p_l.release();
-    vao[3].release();
-
-    are_buffers_initialized = true;
-  }
-
-  void compute_face(Dart_handle dh)
-  {
-    //compute flat normals
-    Local_vector normal = geomutils.get_facet_normal(lcc, dh);
-    normal = normal/(CGAL::sqrt(normal*normal));
-
-    if (lcc.template beta<1,1,1>(dh)!=dh)
-    {
-      P_traits cdt_traits(normal);
-      CDT cdt(cdt_traits);
-
-      // Iterates on the vector of facet handles
-      typename CDT::Vertex_handle previous = NULL, first = NULL;
-      for (typename LCC::template Dart_of_orbit_range<1>::const_iterator
-             he_circ = lcc.template darts_of_orbit<1>(dh).begin(),
-             he_circ_end = lcc.template darts_of_orbit<1>(dh).end();
-           he_circ!=he_circ_end; ++he_circ)
-      {
-        typename CDT::Vertex_handle vh = cdt.insert(geomutils.get_point(lcc, he_circ));
-        if(first == NULL)
-        { first = vh; }
-        vh->info().v = geomutils.get_vertex_normal(lcc, he_circ);
-        if(previous!=NULL && previous != vh)
-        { cdt.insert_constraint(previous, vh); }
-        previous = vh;
-      }
-      if (previous!=NULL)
-        cdt.insert_constraint(previous, first);
-
-      // sets mark is_external
-      for(typename CDT::All_faces_iterator fit = cdt.all_faces_begin(),
-            fitend = cdt.all_faces_end(); fit!=fitend; ++fit)
-      {
-        fit->info().is_external = true;
-        fit->info().is_process = false;
-      }
-      //check if the facet is external or internal
-      std::queue<typename CDT::Face_handle> face_queue;
-      typename CDT::Face_handle face_internal = NULL;
-      face_queue.push(cdt.infinite_vertex()->face());
-      while(! face_queue.empty() )
-      {
-        typename CDT::Face_handle fh = face_queue.front();
-        face_queue.pop();
-        if(!fh->info().is_process)
-        {
-          fh->info().is_process = true;
-          for(int i = 0; i <3; ++i)
-          {
-            if(!cdt.is_constrained(std::make_pair(fh, i)))
-            {
-              face_queue.push(fh->neighbor(i));
-            }
-            else if (face_internal==NULL)
-            {
-              face_internal = fh->neighbor(i);
-            }
-          }
-        }
-      }
-
-      if ( face_internal!=NULL )
-        face_queue.push(face_internal);
-
-      while(! face_queue.empty() )
-      {
-        typename CDT::Face_handle fh = face_queue.front();
-        face_queue.pop();
-        if(!fh->info().is_process)
-        {
-          fh->info().is_process = true;
-          fh->info().is_external = false;
-          for(int i = 0; i <3; ++i)
-          {
-            if(!cdt.is_constrained(std::make_pair(fh, i)))
-            {
-              face_queue.push(fh->neighbor(i));
-            }
-          }
-        }
-      }
-
-      //iterates on the internal faces to add the vertices to the positions
-      //and the normals to the appropriate vectors
-      for(typename CDT::Finite_faces_iterator ffit = cdt.finite_faces_begin(),
-            ffitend = cdt.finite_faces_end(); ffit != ffitend; ++ffit)
-      {
-        if(!ffit->info().is_external)
-        {
-          flat_normals.push_back(normal.x());
-          flat_normals.push_back(normal.y());
-          flat_normals.push_back(normal.z());
-
-          flat_normals.push_back(normal.x());
-          flat_normals.push_back(normal.y());
-          flat_normals.push_back(normal.z());
-
-          flat_normals.push_back(normal.x());
-          flat_normals.push_back(normal.y());
-          flat_normals.push_back(normal.z());
-
-          smooth_normals.push_back(ffit->vertex(0)->info().v.x());
-          smooth_normals.push_back(ffit->vertex(0)->info().v.y());
-          smooth_normals.push_back(ffit->vertex(0)->info().v.z());
-
-          smooth_normals.push_back(ffit->vertex(1)->info().v.x());
-          smooth_normals.push_back(ffit->vertex(1)->info().v.y());
-          smooth_normals.push_back(ffit->vertex(1)->info().v.z());
-
-          smooth_normals.push_back(ffit->vertex(2)->info().v.x());
-          smooth_normals.push_back(ffit->vertex(2)->info().v.y());
-          smooth_normals.push_back(ffit->vertex(2)->info().v.z());
-
-          pos_facets.push_back(ffit->vertex(0)->point().x());
-          pos_facets.push_back(ffit->vertex(0)->point().y());
-          pos_facets.push_back(ffit->vertex(0)->point().z());
-
-          pos_facets.push_back(ffit->vertex(1)->point().x());
-          pos_facets.push_back(ffit->vertex(1)->point().y());
-          pos_facets.push_back(ffit->vertex(1)->point().z());
-
-          pos_facets.push_back(ffit->vertex(2)->point().x());
-          pos_facets.push_back(ffit->vertex(2)->point().y());
-          pos_facets.push_back(ffit->vertex(2)->point().z());
-        }
-      }
-    }
-    else
-    {
-      flat_normals.push_back(normal.x());
-      flat_normals.push_back(normal.y());
-      flat_normals.push_back(normal.z());
-
-      flat_normals.push_back(normal.x());
-      flat_normals.push_back(normal.y());
-      flat_normals.push_back(normal.z());
-
-      flat_normals.push_back(normal.x());
-      flat_normals.push_back(normal.y());
-      flat_normals.push_back(normal.z());
-
-      for (typename LCC::template Dart_of_orbit_range<1>::const_iterator
-             orbitIter = lcc.template darts_of_orbit<1>(dh).begin();
-           orbitIter.cont(); ++orbitIter)
-      {
-        //compute Smooth normals
-        Local_vector normal = geomutils.get_vertex_normal(lcc, orbitIter);
-        normal = normal/(CGAL::sqrt(normal*normal));
-
-        smooth_normals.push_back(normal.x());
-        smooth_normals.push_back(normal.y());
-        smooth_normals.push_back(normal.z());
-
-        Local_point p = geomutils.get_point(lcc, orbitIter);
-        pos_facets.push_back(p.x());
-        pos_facets.push_back(p.y());
-        pos_facets.push_back(p.z());
-      }
-    }
-  }
-
-  void compute_edge(Dart_handle dh)
-  {
-    Local_point p =  geomutils.get_point(lcc, dh);
-    Dart_handle d2 = lcc.other_extremity(dh);
-    if ( d2!=NULL )
-    {
-      Local_point p2 = geomutils.get_point(lcc, d2);
-      pos_lines.push_back(p.x());
-      pos_lines.push_back(p.y());
-      pos_lines.push_back(p.z());
-
-      pos_lines.push_back(p2.x());
-      pos_lines.push_back(p2.y());
-      pos_lines.push_back(p2.z());
-    }
-  }
-
-  void compute_vertex(Dart_handle dh, bool empty)
-  {
-    Local_point p =  geomutils.get_point(lcc, dh);
-    pos_points.push_back(p.x());
-    pos_points.push_back(p.y());
-    pos_points.push_back(p.z());
-
-    if ( empty )
-    {
-      bb = p.bbox();
-      empty = false;
-    }
-    else
-      bb = bb + p.bbox();
-  }
-
-  void compute_elements()
-  {
-    pos_facets.clear();
-    flat_normals.clear();
-    smooth_normals.clear();
-    pos_lines.clear();
-    pos_points.clear();
-
-    if ( lcc.is_empty() )
-    {
-      bb = Local_point(CGAL::ORIGIN).bbox();
-      bb = bb + Local_point(1,1,1).bbox(); // To avoid a warning from Qglviewer
-      return;
-    }
-
-    unsigned int markfaces    = lcc.get_new_mark();
-    unsigned int markedges    = lcc.get_new_mark();
-    unsigned int markvertices = lcc.get_new_mark();
-
-    bool empty = true;
-    for (typename LCC::Dart_range::iterator it=lcc.darts().begin(),
-           itend=lcc.darts().end(); it!=itend; ++it )
-    {
-      if ( !lcc.is_marked(it, markfaces) )
-      {
-        compute_face(it);
-        CGAL::mark_cell<LCC, 2>(lcc, it, markfaces);
-      }
-
-      if ( !lcc.is_marked(it, markedges) )
-      {
-        compute_edge(it);
-        CGAL::mark_cell<LCC, 1>(lcc, it, markedges);
-      }
-
-      if ( !lcc.is_marked(it, markvertices) )
-      {
-        compute_vertex(it, empty);
-        empty = false;
-        CGAL::mark_cell<LCC, 0>(lcc, it, markvertices);
-      }
-    }
-
-    lcc.free_mark(markfaces);
-    lcc.free_mark(markedges);
-    lcc.free_mark(markvertices);
-
-  }
-
-  void attrib_buffers(QGLViewer* viewer)
-  {
-    QMatrix4x4 mvpMatrix;
-    QMatrix4x4 mvMatrix;
-    double mat[16];
-    viewer->camera()->getModelViewProjectionMatrix(mat);
-    for(int i=0; i < 16; i++)
-    {
-      mvpMatrix.data()[i] = (float)mat[i];
-    }
-    viewer->camera()->getModelViewMatrix(mat);
-    for(int i=0; i < 16; i++)
-    {
-      mvMatrix.data()[i] = (float)mat[i];
-    }
-    // define material
-    QVector4D ambient(0.4f, 0.4f, 0.4f, 0.4f);
-    QVector4D diffuse( 0.9f,
-                       0.9f,
-                       0.9f,
-                       0.9f );
-
-    QVector4D specular( 0.0f,
-                        0.0f,
-                        0.0f,
-                        1.0f );
-
-    QVector4D position((bb.xmax()-bb.xmin())/2, (bb.ymax()-bb.ymin())/2,bb.zmax(), 0.0 );
-    GLfloat shininess =  1.0f;
-
-    rendering_program.bind();
-    mvpLocation[0] = rendering_program.uniformLocation("mvp_matrix");
-    mvLocation = rendering_program.uniformLocation("mv_matrix");
-    lightLocation[0] = rendering_program.uniformLocation("light_pos");
-    lightLocation[1] = rendering_program.uniformLocation("light_diff");
-    lightLocation[2] = rendering_program.uniformLocation("light_spec");
-    lightLocation[3] = rendering_program.uniformLocation("light_amb");
-    lightLocation[4] = rendering_program.uniformLocation("spec_power");
-
-    rendering_program.setUniformValue(lightLocation[0], position);
-    rendering_program.setUniformValue(lightLocation[1], diffuse);
-    rendering_program.setUniformValue(lightLocation[2], specular);
-    rendering_program.setUniformValue(lightLocation[3], ambient);
-    rendering_program.setUniformValue(lightLocation[4], shininess);
-    rendering_program.setUniformValue(mvpLocation[0], mvpMatrix);
-    rendering_program.setUniformValue(mvLocation, mvMatrix);
-
-    colorLocation2 = rendering_program.uniformLocation("color");
-    rendering_program.release();
-
-    rendering_program_p_l.bind();
-    mvpLocation[1] = rendering_program_p_l.uniformLocation("mvp_matrix");
-    colorLocation = rendering_program_p_l.uniformLocation("color");
-    rendering_program.setUniformValue(mvpLocation[1], mvpMatrix);
-    rendering_program_p_l.release();
-  }
-
-  virtual void draw()
-  {
-    glEnable(GL_DEPTH_TEST);
-    if(!are_buffers_initialized)
-      initialize_buffers();
-
-    QColor color;
-    if ( !wireframe )
-    {
-      if(flatShading)
-      {
-        vao[0].bind();
-        attrib_buffers(this);
-        color.setRgbF(0.1f, 0.7f, 0.1f);
-        rendering_program.bind();
-        rendering_program.setUniformValue(colorLocation2,color);
-        glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(pos_facets.size()/3));
-        rendering_program.release();
-        vao[0].release();
-      }
-      else
-      {
-        vao[1].bind();
-        attrib_buffers(this);
-        color.setRgbF(0.1f, 0.7f, 0.1f);
-        rendering_program.bind();
-        rendering_program.setUniformValue(colorLocation2,color);
-        glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(pos_facets.size()/3));
-        rendering_program.release();
-        vao[1].release();
-      }
-    }
-    if(edges)
-    {
-      vao[2].bind();
-      attrib_buffers(this);
-      color.setRgbF(0.2f, 0.2f, 0.7f);
-      rendering_program_p_l.bind();
-      rendering_program_p_l.setAttributeValue(colorLocation,color);
-      glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(pos_lines.size()/3));
-      rendering_program_p_l.release();
-      vao[2].release();
-    }
-    if(vertices)
-    {
-      ::glPointSize(7.f);
-      vao[3].bind();
-      attrib_buffers(this);
-      color.setRgbF(.2f,.2f,.6f);
-      rendering_program_p_l.bind();
-      rendering_program_p_l.setAttributeValue(colorLocation,color);
-      glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(pos_points.size()/3));
-      rendering_program_p_l.release();
-      vao[3].release();
-    }
-  }
-
-  virtual void init()
-  {
-    // Restore previous viewer state.
-    restoreStateFromFile();
-
-    // Define 'Control+Q' as the new exit shortcut (default was 'Escape')
-    setShortcut(EXIT_VIEWER, Qt::CTRL+Qt::Key_Q);
-
-    // Add custom key description (see keyPressEvent).
-    setKeyDescription(Qt::Key_W, "Toggles wire frame display");
-    setKeyDescription(Qt::Key_F, "Toggles flat shading display");
-    setKeyDescription(Qt::Key_E, "Toggles edges display");
-    setKeyDescription(Qt::Key_V, "Toggles vertices display");
-
-    // Light default parameters
-    ::glLineWidth(2.4f);
-    ::glPointSize(7.f);
-    ::glEnable(GL_POLYGON_OFFSET_FILL);
-    ::glPolygonOffset(1.f,1.f);
-    ::glClearColor(1.0f,1.0f,1.0f,0.0f);
-    ::glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
-
-    ::glEnable(GL_LIGHTING);
-
-    ::glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
-
-    ::glShadeModel(GL_FLAT);
-    ::glDisable(GL_BLEND);
-    ::glDisable(GL_LINE_SMOOTH);
-    ::glDisable(GL_POLYGON_SMOOTH_HINT);
-    ::glBlendFunc(GL_ONE, GL_ZERO);
-    ::glHint(GL_LINE_SMOOTH_HINT, GL_FASTEST);
-
-    initializeOpenGLFunctions();
-    compile_shaders();
-    compute_elements();
-
-    this->camera()->setSceneBoundingBox(qglviewer::Vec(bb.xmin(),
-                                                       bb.ymin(),
-                                                       bb.zmin()),
-                                        qglviewer::Vec(bb.xmax(),
-                                                       bb.ymax(),
-                                                       bb.zmax()));
-
-    this->showEntireScene();
-  }
-
-  void keyPressEvent(QKeyEvent *e)
-  {
-    const Qt::KeyboardModifiers modifiers = e->modifiers();
-
-    if ((e->key()==Qt::Key_W) && (modifiers==Qt::NoButton))
-    {
-      wireframe = !wireframe;
-      if (wireframe)
-        glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
-      else
-        glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
-      updateGL();
-    }
-    else if ((e->key()==Qt::Key_F) && (modifiers==Qt::NoButton))
-    {
-      flatShading = !flatShading;
-      updateGL();
-    }
-    else if ((e->key()==Qt::Key_E) && (modifiers==Qt::NoButton))
-    {
-      edges = !edges;
-      updateGL();
-    }
-    else if ((e->key()==Qt::Key_V) && (modifiers==Qt::NoButton))
-    {
-      vertices = !vertices;
-      updateGL();
-    }
-    else
-      QGLViewer::keyPressEvent(e);
-  }
-
-
-  virtual QString helpString() const
-  {
-    QString text("<h2>L C C   V i e w e r</h2>");
-    text += "Use the mouse to move the camera around the object. ";
-    text += "You can respectively revolve around, zoom and translate with "
-      "the three mouse buttons. ";
-    text += "Left and middle buttons pressed together rotate around the "
-      "camera view direction axis<br><br>";
-    text += "Pressing <b>Alt</b> and one of the function keys "
-      "(<b>F1</b>..<b>F12</b>) defines a camera keyFrame. ";
-    text += "Simply press the function key again to restore it. "
-      "Several keyFrames define a ";
-    text += "camera path. Paths are saved when you quit the application "
-      "and restored at next start.<br><br>";
-    text += "Press <b>F</b> to display the frame rate, <b>A</b> for the "
-      "world axis, ";
-    text += "<b>Alt+Return</b> for full screen mode and <b>Control+S</b> "
-      "to save a snapshot. ";
-    text += "See the <b>Keyboard</b> tab in this window for a complete "
-      "shortcut list.<br><br>";
-    text += "Double clicks automates single click actions: A left button "
-      "double click aligns the closer axis with the camera (if close enough). ";
-    text += "A middle button double click fits the zoom of the camera and "
-      "the right button re-centers the scene.<br><br>";
-    text += "A left button double click while holding right button pressed "
-      "defines the camera <i>Revolve Around Point</i>. ";
-    text += "See the <b>Mouse</b> tab and the documentation web pages for "
-      "details.<br><br>";
-    text += "Press <b>Escape</b> to exit the viewer.";
-    return text;
-  }
-
-private:
-  LCC& lcc;
-  bool wireframe;
-  bool flatShading;
-  bool edges;
-  bool vertices;
-  Geom_utils<LCC> geomutils;
-
-  CGAL::Bbox_3 bb;
-  bool are_buffers_initialized;
-
-  //Shaders elements
-  int vertexLocation[4];
-  int normalsLocation;
-  int mvpLocation[2];
-  int mvLocation;
-  int colorLocation;
-  int colorLocation2;
-  int lightLocation[5];
-
-  std::vector<float> pos_points;
-  std::vector<float> pos_lines;
-  std::vector<float> pos_facets;
-  std::vector<float> smooth_normals;
-  std::vector<float> flat_normals;
-
-  QGLBuffer buffers[6];
-  QOpenGLVertexArrayObject vao[4];
-
-  QOpenGLShaderProgram rendering_program;
-  QOpenGLShaderProgram rendering_program_p_l;
-};
-
-template<class LCC>
-void display_lcc(LCC& alcc)
-{
-  int argc=1;
-
-  const char* argv[2]={"lccviewer","\0"};
-  QApplication app(argc,const_cast<char**>(argv));
-
-  SimpleLCCViewerQt<LCC> mainwindow(alcc,&app);
-  mainwindow.show();
-
-  app.exec();
-}
-
-#endif // CGAL_LCC_3_VIEWER_QT_H
diff --git a/3rdparty/CGAL-4.8/examples/Linear_cell_complex/linear_cell_complex_4.cpp b/3rdparty/CGAL-4.8/examples/Linear_cell_complex/linear_cell_complex_4.cpp
deleted file mode 100644
index bdb2d66..0000000
--- a/3rdparty/CGAL-4.8/examples/Linear_cell_complex/linear_cell_complex_4.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-#include <CGAL/Linear_cell_complex.h>
-#include <CGAL/Linear_cell_complex_constructors.h>
-#include <iostream>
-#include <vector>
-
-typedef CGAL::Linear_cell_complex<4,5> LCC_4;
-typedef LCC_4::Dart_handle             Dart_handle;
-typedef LCC_4::Point                   Point;
-typedef LCC_4::Vector                  Vector;
-typedef LCC_4::FT                      FT;
-
-int main()
-{
-  LCC_4 lcc;
-  
-  // Create two tetrahedra.
-  FT p1[5]={ 0, 0, 0, 0, 0}; std::vector<FT> v1(p1,p1+5);
-  FT p2[5]={ 0, 2, 0, 0, 0}; std::vector<FT> v2(p2,p2+5);
-  FT p3[5]={ 0, 1, 2, 0, 0}; std::vector<FT> v3(p3,p3+5);
-  FT p4[5]={ 2, 1, 0, 0, 0}; std::vector<FT> v4(p4,p4+5);
-  FT p5[5]={-1, 0, 0, 0, 0}; std::vector<FT> v5(p5,p5+5);
-  FT p6[5]={-1, 2, 0, 0, 0}; std::vector<FT> v6(p6,p6+5);
-  FT p7[5]={-1, 1, 2, 0, 0}; std::vector<FT> v7(p7,p7+5);
-  FT p8[5]={-3, 1, 2, 0, 0}; std::vector<FT> v8(p8,p8+5);
-  
-  Dart_handle d1 = lcc.make_tetrahedron(Point(5, v1.begin(), v1.end()),
-                                        Point(5, v2.begin(), v2.end()),
-                                        Point(5, v3.begin(), v3.end()),
-                                        Point(5, v4.begin(), v4.end()));  
-  
-  Dart_handle d2 = lcc.make_tetrahedron(Point(5, v5.begin(), v5.end()),
-                                        Point(5, v6.begin(), v6.end()),
-                                        Point(5, v7.begin(), v7.end()),
-                                        Point(5, v8.begin(), v8.end()));
-
-  lcc.display_characteristics(std::cout);
-  std::cout<<", valid="<<lcc.is_valid()<<std::endl;
-
-  lcc.sew<4>(d1,d2);
-  
-  lcc.display_characteristics(std::cout);
-  std::cout<<", valid="<<lcc.is_valid()<<std::endl;
-
-  // Add one vertex on the middle of the edge containing dart d1.
-  Dart_handle d3 = lcc.insert_barycenter_in_cell<1>(d1);
-  CGAL_assertion( lcc.is_valid() );
-
-  lcc.display_characteristics(std::cout);
-  std::cout<<", valid="<<lcc.is_valid()<<std::endl;
-
-  // Add one edge to cut the face containing dart d3 in two.
-  Dart_handle d4 = CGAL::insert_cell_1_in_cell_2(lcc,d3,lcc.beta(d1, 0));
-  CGAL_assertion( lcc.is_valid() );
-  
-  lcc.display_characteristics(std::cout);
-  std::cout<<", valid="<<lcc.is_valid()<<std::endl;
-
-  // We use removal operations to get back to the initial configuration.
-  CGAL::remove_cell<LCC_4,1>(lcc,d4);
-  CGAL_assertion( lcc.is_valid() );
-
-  CGAL::remove_cell<LCC_4,0>(lcc,d3);
-  CGAL_assertion( lcc.is_valid() );
-
-  lcc.unsew<4>(d1);
-
-  lcc.display_characteristics(std::cout);
-  std::cout<<", valid="<<lcc.is_valid()<<std::endl;
-
-  return EXIT_SUCCESS;
-}
-
diff --git a/3rdparty/CGAL-4.8/examples/Linear_cell_complex/voronoi_2.cpp b/3rdparty/CGAL-4.8/examples/Linear_cell_complex/voronoi_2.cpp
deleted file mode 100644
index 78c6788..0000000
--- a/3rdparty/CGAL-4.8/examples/Linear_cell_complex/voronoi_2.cpp
+++ /dev/null
@@ -1,174 +0,0 @@
-#include <CGAL/Linear_cell_complex.h>
-#include <CGAL/Linear_cell_complex_constructors.h>
-#include <CGAL/Linear_cell_complex_operations.h>
-#include <CGAL/Delaunay_triangulation_2.h>
-#include <iostream>
-#include <fstream>
-
-/* If you want to use a viewer, you can use qglviewer. */
-#ifdef CGAL_LCC_USE_QT
-#include "linear_cell_complex_3_viewer_qt.h"
-#endif
-
-/* // If you want to use exact constructions.
-#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
-typedef CGAL::Linear_cell_complex<2,2,
-  CGAL::Linear_cell_complex_traits<2, CGAL::Exact_predicates_exact_constructions_kernel> > LCC_2;
-*/
-
-typedef CGAL::Linear_cell_complex<2> LCC_2;
-typedef LCC_2::Dart_handle           Dart_handle;
-typedef LCC_2::Point                 Point;
-
-typedef CGAL::Delaunay_triangulation_2<LCC_2::Traits> Triangulation;
-
-// Function used to display the voronoi diagram.
-void display_voronoi(LCC_2& alcc, Dart_handle adart)
-{
-  // We remove the infinite face plus all the faces adjacent to it.
-  // Indeed, we cannot view these faces since they do not have
-  // a "correct geometry". 
-  std::stack<Dart_handle> toremove;
-  LCC_2::size_type mark_toremove=alcc.get_new_mark();
-
-  // adart belongs to the infinite face.
-  toremove.push(adart);
-  CGAL::mark_cell<LCC_2,2>(alcc, adart, mark_toremove);
-
-  // Now we get all the faces adjacent to the infinite face.
-  for (LCC_2::Dart_of_cell_range<2>::iterator
-         it=alcc.darts_of_cell<2>(adart).begin(),
-         itend=alcc.darts_of_cell<2>(adart).end(); it!=itend; ++it)
-  {
-    if ( !alcc.is_marked(alcc.beta(it,2), mark_toremove) )
-    {
-      CGAL::mark_cell<LCC_2,2>(alcc, alcc.beta(it,2), mark_toremove);
-      toremove.push(alcc.beta(it,2));
-    }    
-  }
-  
-  while( !toremove.empty() )
-  {
-    CGAL::remove_cell<LCC_2, 2>(alcc, toremove.top());
-    toremove.pop();
-  }
-
-  CGAL_assertion(alcc.is_without_boundary(1));
-    
-  std::cout<<"Voronoi subdvision, only finite faces:"<<std::endl<<"  ";
-  alcc.display_characteristics(std::cout) << ", valid=" 
-                                          << alcc.is_valid()
-                                          << std::endl;
-  
-#ifdef CGAL_LCC_USE_VIEWER
-  display_lcc(alcc);
-#endif // CGAL_LCC_USE_VIEWER
-}
-
-template<typename LCC, typename TR>
-void transform_dart_to_their_dual(LCC& alcc, LCC& adual,
-                                  std::map<typename TR::Face_handle,
-                                           typename LCC::Dart_handle>& assoc)
-{
-  typename LCC::Dart_range::iterator it1=alcc.darts().begin();
-  typename LCC::Dart_range::iterator it2=adual.darts().begin();
-
-  std::map<typename LCC::Dart_handle, typename LCC::Dart_handle> dual;
-  
-  for ( ; it1!=alcc.darts().end(); ++it1, ++it2 )
-  {
-    dual[it1]=it2;
-  }
-
-  for ( typename std::map<typename TR::Face_handle, typename LCC::Dart_handle>
-          ::iterator it=assoc.begin(), itend=assoc.end(); it!=itend; ++it)
-  {
-    assoc[it->first]=dual[it->second];
-  } 
-}
-
-template<typename LCC, typename TR>
-void set_geometry_of_dual(LCC& alcc, TR& tr,
-                          std::map<typename TR::Face_handle,
-                                   typename LCC::Dart_handle>& assoc)
-{
-  for ( typename std::map<typename TR::Face_handle, typename LCC::Dart_handle>
-          ::iterator it=assoc.begin(), itend=assoc.end(); it!=itend; ++it)
-  {
-    if ( !tr.is_infinite(it->first) )
-      alcc.set_vertex_attribute
-        (it->second,alcc.create_vertex_attribute(tr.circumcenter(it->first)));
-    else
-      alcc.set_vertex_attribute(it->second,alcc.create_vertex_attribute());
-  }
-}
-
-int main(int narg, char** argv)
-{
-  if (narg>1 && (!strcmp(argv[1],"-h") || !strcmp(argv[1],"-?")) )
-  {
-    std::cout<<"Usage : voronoi_2 filename"<<std::endl   
-             <<"   filename being a fine containing 2D points used to "
-             <<" compute the Delaunay_triangulation_2."<<std::endl;
-    return EXIT_FAILURE;
-  }
-
-  std::string filename;
-  if ( narg==1 )
-  {
-    filename=std::string("data/points_2");
-    std::cout<<"No filename given: use data/points_2 by default."<<std::endl;
-  }
-  else
-    filename=std::string(argv[1]);
-  
-  // 1) Compute the Delaunay_triangulation_2.
-  Triangulation T;
-
-  std::ifstream iFile(filename.c_str());
-  if (!iFile)
-  {
-    std::cout << "Problem reading file " << filename << std::endl;
-    return EXIT_FAILURE;
-  }
-  
-  std::istream_iterator<Point> begin(iFile), end;
-  T.insert(begin, end);
-  CGAL_assertion(T.is_valid(false));
- 
-  // 2) Convert the triangulation into a 2D lcc.
-  LCC_2 lcc;
-  std::map<Triangulation::Face_handle,
-           LCC_2::Dart_handle > face_to_dart;
-  
-  Dart_handle dh=CGAL::import_from_triangulation_2<LCC_2, Triangulation>
-    (lcc, T, &face_to_dart);
-  CGAL_assertion(lcc.is_without_boundary());
-
-  std::cout<<"Delaunay triangulation :"<<std::endl<<"  ";
-  lcc.display_characteristics(std::cout) << ", valid=" 
-                                         << lcc.is_valid() << std::endl;
-
-  // 3) Compute the dual lcc.
-  LCC_2 dual_lcc;
-  Dart_handle ddh=lcc.dual(dual_lcc, dh);
-  // Here, dual_lcc is the 2D Voronoi diagram.
-  CGAL_assertion(dual_lcc.is_without_boundary());
-
-  // 4) We update the geometry of dual_lcc by using the std::map
-  //    face_to_dart.
-  transform_dart_to_their_dual<LCC_2,Triangulation>
-    (lcc, dual_lcc, face_to_dart);
-  set_geometry_of_dual<LCC_2,Triangulation>(dual_lcc, T, face_to_dart);
-  
-  // 5) Display the dual_lcc characteristics.
-  std::cout<<"Voronoi subdvision :"<<std::endl<<"  ";
-  dual_lcc.display_characteristics(std::cout) << ", valid=" 
-                                              << dual_lcc.is_valid()
-                                              << std::endl;
-
-  display_voronoi(dual_lcc, ddh);
-
-  return EXIT_SUCCESS;
-}
-
diff --git a/3rdparty/CGAL-4.8/examples/Linear_cell_complex/voronoi_3.cpp b/3rdparty/CGAL-4.8/examples/Linear_cell_complex/voronoi_3.cpp
deleted file mode 100644
index 8afe5d4..0000000
--- a/3rdparty/CGAL-4.8/examples/Linear_cell_complex/voronoi_3.cpp
+++ /dev/null
@@ -1,173 +0,0 @@
-#include <CGAL/Linear_cell_complex.h>
-#include <CGAL/Linear_cell_complex_constructors.h>
-#include <CGAL/Linear_cell_complex_operations.h>
-#include <CGAL/Delaunay_triangulation_3.h>
-#include <iostream>
-#include <fstream>
-
-/* If you want to use a viewer, you can use one qglviewer. */
-#ifdef CGAL_LCC_USE_QT
-#include "linear_cell_complex_3_viewer_qt.h"
-#endif
-
-/* // If you want to use exact constructions.
-#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
-typedef CGAL::Linear_cell_complex<3,3,
-  CGAL::Linear_cell_complex_traits<3, CGAL::Exact_predicates_exact_constructions_kernel> > LCC_3;
-*/
-
-typedef CGAL::Linear_cell_complex<3> LCC_3;
-typedef LCC_3::Dart_handle           Dart_handle;
-typedef LCC_3::Point                 Point;
-
-typedef CGAL::Delaunay_triangulation_3<LCC_3::Traits> Triangulation;
-
-// Function used to display the voronoi diagram.
-void display_voronoi(LCC_3& alcc, Dart_handle adart)
-{
-  // We remove the infinite volume plus all the volumes adjacent to it.
-  // Indeed, we cannot view these volumes since they do not have
-  // a "correct geometry". 
-  std::stack<Dart_handle> toremove;
-  LCC_3::size_type mark_toremove=alcc.get_new_mark();
-
-  // adart belongs to the infinite volume.
-  toremove.push(adart);
-  CGAL::mark_cell<LCC_3,3>(alcc, adart, mark_toremove);
- 
-  // Now we get all the volumes adjacent to the infinite volume.
-  for (LCC_3::Dart_of_cell_range<3>::iterator
-         it=alcc.darts_of_cell<3>(adart).begin(),
-         itend=alcc.darts_of_cell<3>(adart).end(); it!=itend; ++it)
-  {
-    if ( !alcc.is_marked(alcc.beta(it,3), mark_toremove) )
-    {
-      CGAL::mark_cell<LCC_3,3>(alcc, alcc.beta(it,3), mark_toremove);
-      toremove.push(alcc.beta(it,3));
-    }
-  }
-  
-  while( !toremove.empty() )
-  {
-    CGAL::remove_cell<LCC_3, 3>(alcc, toremove.top());
-    toremove.pop();
-  }
-
-  CGAL_assertion(alcc.is_without_boundary(1) && alcc.is_without_boundary(2));
-  
-  std::cout<<"Voronoi subdvision, only finite volumes:"<<std::endl<<"  ";
-  alcc.display_characteristics(std::cout) << ", valid=" 
-                                          << alcc.is_valid()
-                                          << std::endl;
-
-#ifdef CGAL_LCC_USE_VIEWER
-  display_lcc(alcc);
-#endif // CGAL_LCC_USE_VIEWER
-}
-
-template<typename LCC, typename TR>
-void transform_dart_to_their_dual(LCC& alcc, LCC& adual,
-                                  std::map<typename TR::Cell_handle,
-                                           typename LCC::Dart_handle>& assoc)
-{
-  typename LCC::Dart_range::iterator it1=alcc.darts().begin();
-  typename LCC::Dart_range::iterator it2=adual.darts().begin();
-
-  std::map<typename LCC::Dart_handle, typename LCC::Dart_handle> dual;
-  
-  for ( ; it1!=alcc.darts().end(); ++it1, ++it2 )
-  {
-    dual[it1]=it2;
-  }
-
-  for ( typename std::map<typename TR::Cell_handle, typename LCC::Dart_handle>
-          ::iterator it=assoc.begin(), itend=assoc.end(); it!=itend; ++it)
-  {
-    assoc[it->first]=dual[it->second];
-  }
-}
-
-template<typename LCC, typename TR>
-void set_geometry_of_dual(LCC& alcc, TR& tr,
-                          std::map<typename TR::Cell_handle,
-                                   typename LCC::Dart_handle>& assoc)
-{
-  for ( typename std::map<typename TR::Cell_handle, typename LCC::Dart_handle>
-          ::iterator it=assoc.begin(), itend=assoc.end(); it!=itend; ++it)
-  {
-    if ( !tr.is_infinite(it->first) )
-      alcc.set_vertex_attribute
-        (it->second,alcc.create_vertex_attribute(tr.dual(it->first)));
-    else
-      alcc.set_vertex_attribute(it->second,alcc.create_vertex_attribute());
-  }
-}
-
-
-int main(int narg, char** argv)
-{
-  if (narg>1 && (!strcmp(argv[1],"-h") || !strcmp(argv[1],"-?")) )
-  {
-    std::cout<<"Usage : voronoi_3 filename"<<std::endl   
-             <<"   filename being a fine containing 3D points used to "
-             <<" compute the Delaunay_triangulation_3."<<std::endl;
-    return EXIT_FAILURE;
-  }
-
-  std::string filename;
-  if ( narg==1 )
-  {
-    filename=std::string("data/points_3");
-    std::cout<<"No filename given: use data/points_3 by default."<<std::endl;
-  }
-  else
-    filename=std::string(argv[1]);
-  
-  // 1) Compute the Delaunay_triangulation_3.
-  Triangulation T;
-
-  std::ifstream iFile(filename.c_str());
-  if (!iFile)
-  {
-    std::cout << "Problem reading file " << filename << std::endl;
-    return EXIT_FAILURE;
-  }
-  
-  std::istream_iterator<Point> begin(iFile), end;
-  T.insert(begin, end);
-  CGAL_assertion(T.is_valid(false));
- 
-  // 2) Convert the triangulation into a 3D lcc.
-  LCC_3 lcc;
-  std::map<Triangulation::Cell_handle,
-           LCC_3::Dart_handle > vol_to_dart;
-
-  Dart_handle dh=CGAL::import_from_triangulation_3<LCC_3, Triangulation>
-    (lcc, T, &vol_to_dart);
-
-  std::cout<<"Delaunay triangulation :"<<std::endl<<"  ";
-  lcc.display_characteristics(std::cout) << ", valid=" 
-                                         << lcc.is_valid() << std::endl;
-
-  // 3) Compute the dual lcc.
-  LCC_3 dual_lcc;
-  Dart_handle ddh=lcc.dual(dual_lcc, dh);
-  // Here, dual_lcc is the 3D Voronoi diagram.
-  CGAL_assertion(dual_lcc.is_without_boundary());
-
-  // 4) We update the geometry of dual_lcc by using the std::map
-  //    face_to_dart.
-  transform_dart_to_their_dual<LCC_3,Triangulation>
-    (lcc, dual_lcc, vol_to_dart);
-  set_geometry_of_dual<LCC_3,Triangulation>(dual_lcc, T, vol_to_dart);
-  
-  // 5) Display the dual_lcc characteristics.
-  std::cout<<"Voronoi subdvision :"<<std::endl<<"  ";
-  dual_lcc.display_characteristics(std::cout) << ", valid=" 
-                                              << dual_lcc.is_valid()
-                                              << std::endl;
-  display_voronoi(dual_lcc, ddh);
-
-  return EXIT_SUCCESS;
-}
-
diff --git a/3rdparty/CGAL-4.8/examples/Matrix_search/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Matrix_search/CMakeLists.txt
deleted file mode 100644
index e2dc164..0000000
--- a/3rdparty/CGAL-4.8/examples/Matrix_search/CMakeLists.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Matrix_search_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "sorted_matrix_search.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Matrix_search/sorted_matrix_search.cpp b/3rdparty/CGAL-4.8/examples/Matrix_search/sorted_matrix_search.cpp
deleted file mode 100644
index ddc1884..0000000
--- a/3rdparty/CGAL-4.8/examples/Matrix_search/sorted_matrix_search.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-#include <CGAL/Random.h>
-#include <CGAL/Cartesian_matrix.h>
-#include <CGAL/sorted_matrix_search.h>
-#include <vector>
-#include <algorithm>
-#include <iterator>
-#include <functional>
-
-typedef int                                     Value;
-typedef std::vector<Value>                      Vector;
-typedef Vector::iterator                        Value_iterator;
-typedef std::vector<Vector>                     Vector_cont;
-typedef CGAL::Cartesian_matrix<std::plus<int>,
-                               Value_iterator,
-                               Value_iterator>  Matrix;
-
-int main()
-{
-  // set of vectors the matrices are build from:
-  Vector_cont vectors;
-
-  // generate a random vector and sort it:
-  Vector a;
-  const int n = 5;
-  for (int i = 0; i < n; ++i)
-    a.push_back(CGAL::default_random(100));
-  std::sort(a.begin(), a.end());
-  std::cout << "a = ( ";
-  std::copy(a.begin(), a.end(), std::ostream_iterator<int>(std::cout," "));
-  std::cout << ")\n";
-
-  // build a Cartesian matrix from a:
-  Matrix M(a.begin(), a.end(), a.begin(), a.end());
-
-  // search for an upper bound for max(a):
-  Value bound = a[n-1];
-  Value upper_bound =
-  CGAL::sorted_matrix_search(
-    &M, &M + 1,
-    CGAL::sorted_matrix_search_traits_adaptor(
-      std::bind2nd(std::greater_equal<Value>(), bound), M));
-  std::cout << "Upper bound for " << bound << " is "
-            << upper_bound << "." << std::endl;
-
-  return 0;
-}
diff --git a/3rdparty/CGAL-4.8/examples/Mesh_2/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Mesh_2/CMakeLists.txt
deleted file mode 100644
index a72d50e..0000000
--- a/3rdparty/CGAL-4.8/examples/Mesh_2/CMakeLists.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Mesh_2_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "conforming.cpp" )
-  create_single_source_cgal_program( "mesh_class.cpp" )
-  create_single_source_cgal_program( "mesh_global.cpp" )
-  create_single_source_cgal_program( "mesh_optimization.cpp" )
-  create_single_source_cgal_program( "mesh_with_seeds.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Mesh_3/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Mesh_3/CMakeLists.txt
deleted file mode 100644
index 2f1baa9..0000000
--- a/3rdparty/CGAL-4.8/examples/Mesh_3/CMakeLists.txt
+++ /dev/null
@@ -1,105 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Mesh_3_example )
-
-cmake_minimum_required(VERSION 2.8.11)
-
-
-include_directories(../../include)
-add_definitions(-DCGAL_MESH_3_NO_DEPRECATED_SURFACE_INDEX
-                -DCGAL_MESH_3_NO_DEPRECATED_C3T3_ITERATORS)
-
-if ( MESH_3_VERBOSE )
-  add_definitions(-DCGAL_MESH_3_VERBOSE)
-endif()
-
-find_package(CGAL COMPONENTS ImageIO)
-
-if ( CGAL_FOUND )
-  include( ${CGAL_USE_FILE} )
-  find_package(Boost)
-
-  # Activate concurrency ? (turned OFF by default)
-  option(ACTIVATE_CONCURRENT_MESH_3
-    "Activate parallelism in Mesh_3"
-    OFF)
-    
-  # And add -DCGAL_CONCURRENT_MESH_3 if that option is ON
-  if( ACTIVATE_CONCURRENT_MESH_3 OR ENV{ACTIVATE_CONCURRENT_MESH_3} )
-    add_definitions( -DCGAL_CONCURRENT_MESH_3 )
-    find_package( TBB REQUIRED )
-  else( ACTIVATE_CONCURRENT_MESH_3 OR ENV{ACTIVATE_CONCURRENT_MESH_3} )
-    option( LINK_WITH_TBB
-      "Link with TBB anyway so we can use TBB timers for profiling"
-      ON)
-    if( LINK_WITH_TBB )
-      find_package( TBB )
-    endif( LINK_WITH_TBB )
-  endif()
-  
-  if( TBB_FOUND )
-    include(${TBB_USE_FILE})
-    list(APPEND CGAL_3RD_PARTY_LIBRARIES ${TBB_LIBRARIES})
-  endif()
-
-
- set(VTK_LIBS "")
-      find_package(VTK QUIET COMPONENTS vtkImagingGeneral  vtkIOImage NO_MODULE)
-      if(VTK_FOUND)
-          include(${VTK_USE_FILE})
-          if ("${VTK_VERSION_MAJOR}" GREATER "5")
-            message(STATUS "VTK found")
-            set( VTK_LIBS vtkImagingGeneral vtkIOImage )
-          else()
-            message(STATUS "VTK version 6.0 or greater is required")
-          endif()
-      else()
-        message(STATUS "VTK was not found")
-      endif()
-
-
-  if ( Boost_FOUND AND Boost_VERSION GREATER 103400 )
-    include( CGAL_CreateSingleSourceCGALProgram )
-
-    # Compilable examples
-    create_single_source_cgal_program( "mesh_implicit_sphere.cpp" )
-    create_single_source_cgal_program( "mesh_implicit_sphere_variable_size.cpp" )
-    create_single_source_cgal_program( "mesh_two_implicit_spheres_with_balls.cpp" )
-    create_single_source_cgal_program( "mesh_implicit_domains_2.cpp" "implicit_functions.cpp" )
-    create_single_source_cgal_program( "mesh_cubes_intersection.cpp" )
-    create_single_source_cgal_program( "mesh_cubes_intersection_with_features.cpp" )
-    create_single_source_cgal_program( "mesh_implicit_domains.cpp" "implicit_functions.cpp" )
-   create_single_source_cgal_program( "mesh_polyhedral_domain.cpp" )
-    create_single_source_cgal_program( "mesh_polyhedral_domain_with_features.cpp" )
-    if( WITH_CGAL_ImageIO )
-      if( VTK_FOUND AND "${VTK_VERSION_MAJOR}" GREATER "5" )
-        add_executable ( mesh_3D_gray_vtk_image mesh_3D_gray_vtk_image.cpp )
-        target_link_libraries(  mesh_3D_gray_vtk_image ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ${VTK_LIBS}) 
-      endif()
- 
-      if( CGAL_ImageIO_USE_ZLIB )
-        create_single_source_cgal_program( "mesh_optimization_example.cpp" )
-        create_single_source_cgal_program( "mesh_optimization_lloyd_example.cpp" )
-        create_single_source_cgal_program( "mesh_3D_image.cpp" )
-        create_single_source_cgal_program( "mesh_3D_gray_image.cpp" )
-        create_single_source_cgal_program( "mesh_3D_image_variable_size.cpp" )
-      else()
-        message( STATUS "NOTICE: The examples mesh_3D_image.cpp, mesh_3D_image_variable_size.cpp, mesh_optimization_example.cpp and mesh_optimization_lloyd_example.cpp need CGAL_ImageIO to be configured with ZLIB support, and will not be compiled." )
-      endif()
-    else()
-      message( STATUS "NOTICE: Some examples need the CGAL_ImageIO library, and will not be compiled." )
-    endif()
-#    create_single_source_cgal_program( "mesh_polyhedral_implicit_function.cpp" )
-#    create_single_source_cgal_program( "mesh_polyhedral_surface_tolerance_region.cpp" )
-#    create_single_source_cgal_program( "mesh_polyhedral_edge_tolerance_region.cpp" )
-
-  else()
-    message(STATUS "NOTICE: This program requires Boost >= 1.34.1, and will not be compiled.")
-  endif()
-
-else()
-  message(STATUS "This program requires the CGAL library, and will not be compiled.")
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Mesh_3/mesh_3D_image.cpp b/3rdparty/CGAL-4.8/examples/Mesh_3/mesh_3D_image.cpp
deleted file mode 100644
index b7c10bb..0000000
--- a/3rdparty/CGAL-4.8/examples/Mesh_3/mesh_3D_image.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-
-#include <CGAL/Mesh_triangulation_3.h>
-#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
-#include <CGAL/Mesh_criteria_3.h>
-
-#include <CGAL/Labeled_image_mesh_domain_3.h>
-#include <CGAL/make_mesh_3.h>
-#include <CGAL/Image_3.h>
-
-// Domain
-typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
-typedef CGAL::Labeled_image_mesh_domain_3<CGAL::Image_3,K> Mesh_domain;
-
-// Triangulation
-#ifdef CGAL_CONCURRENT_MESH_3
-  typedef CGAL::Mesh_triangulation_3<
-    Mesh_domain,
-    CGAL::Kernel_traits<Mesh_domain>::Kernel, // Same as sequential
-    CGAL::Parallel_tag                        // Tag to activate parallelism
-  >::type Tr;
-#else
-  typedef CGAL::Mesh_triangulation_3<Mesh_domain>::type Tr;
-#endif
-typedef CGAL::Mesh_complex_3_in_triangulation_3<Tr> C3t3;
-
-// Criteria
-typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;
-
-// To avoid verbose function and named parameters call
-using namespace CGAL::parameters;
-
-int main(int argc, char* argv[])
-{
-  const char* fname = (argc>1)?argv[1]:"data/liver.inr.gz";
-  // Loads image
-  CGAL::Image_3 image;
-  if(!image.read(fname)){
-    std::cerr << "Error: Cannot read file " <<  fname << std::endl;
-    return EXIT_FAILURE;
-  }
-
-  // Domain
-  Mesh_domain domain(image);
-
-  // Mesh criteria
-  Mesh_criteria criteria(facet_angle=30, facet_size=6, facet_distance=4,
-                         cell_radius_edge_ratio=3, cell_size=8);
-
-  // Meshing
-  C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria);
-
-  // Output
-  std::ofstream medit_file("out.mesh");
-  c3t3.output_to_medit(medit_file);
-
-  return 0;
-}
diff --git a/3rdparty/CGAL-4.8/examples/Mesh_3/mesh_3D_image_variable_size.cpp b/3rdparty/CGAL-4.8/examples/Mesh_3/mesh_3D_image_variable_size.cpp
deleted file mode 100644
index 7c01e75..0000000
--- a/3rdparty/CGAL-4.8/examples/Mesh_3/mesh_3D_image_variable_size.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-#define CGAL_MESH_3_VERBOSE
-
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-
-#include <CGAL/Mesh_triangulation_3.h>
-#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
-#include <CGAL/Mesh_criteria_3.h>
-#include <CGAL/Mesh_constant_domain_field_3.h>
-
-#include <CGAL/Labeled_image_mesh_domain_3.h>
-#include <CGAL/make_mesh_3.h>
-#include <CGAL/Image_3.h>
-
-// Domain
-typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
-typedef CGAL::Labeled_image_mesh_domain_3<CGAL::Image_3,K> Mesh_domain;
-
-// Triangulation
-#ifdef CGAL_CONCURRENT_MESH_3
-  typedef CGAL::Mesh_triangulation_3<
-    Mesh_domain,
-    CGAL::Kernel_traits<Mesh_domain>::Kernel, // Same as sequential
-    CGAL::Parallel_tag                        // Tag to activate parallelism
-  >::type Tr;
-#else
-  typedef CGAL::Mesh_triangulation_3<Mesh_domain>::type Tr;
-#endif
-typedef CGAL::Mesh_complex_3_in_triangulation_3<Tr> C3t3;
-
-// Criteria
-typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;
-typedef CGAL::Mesh_constant_domain_field_3<Mesh_domain::R,
-                                           Mesh_domain::Index> Sizing_field;
-
-// To avoid verbose function and named parameters call
-using namespace CGAL::parameters;
-
-int main(int argc, char* argv[])
-{
-  const char* fname = (argc>1)?argv[1]:"data/liver.inr.gz";
-  // Loads image
-  CGAL::Image_3 image;
-  if(!image.read(fname)){
-    std::cerr << "Error: Cannot read file " <<  fname << std::endl;
-    return EXIT_FAILURE;
-  }
-
-  // Domain
-  Mesh_domain domain(image);
-
-  // Sizing field: set global size to 8 and kidney size (label 127) to 3
-  double kidney_size = 3.;
-  int volume_dimension = 3;
-  Sizing_field size(8);
-  size.set_size(kidney_size, volume_dimension, 
-                domain.index_from_subdomain_index(127));
-  
-  // Mesh criteria
-  Mesh_criteria criteria(facet_angle=30, facet_size=6, facet_distance=2,
-                         cell_radius_edge_ratio=3, cell_size=size);
-
-  // Meshing
-  C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria);
-
-  // Output
-  std::ofstream medit_file("out.mesh");
-  c3t3.output_to_medit(medit_file);
-
-  return 0;
-}
diff --git a/3rdparty/CGAL-4.8/examples/Mesh_3/mesh_implicit_sphere.cpp b/3rdparty/CGAL-4.8/examples/Mesh_3/mesh_implicit_sphere.cpp
deleted file mode 100644
index c4f5a66..0000000
--- a/3rdparty/CGAL-4.8/examples/Mesh_3/mesh_implicit_sphere.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-
-#include <CGAL/Mesh_triangulation_3.h>
-#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
-#include <CGAL/Mesh_criteria_3.h>
-
-#include <CGAL/Implicit_mesh_domain_3.h>
-#include <CGAL/make_mesh_3.h>
-
-// Domain
-typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
-typedef K::FT FT;
-typedef K::Point_3 Point;
-typedef FT (Function)(const Point&);
-typedef CGAL::Implicit_mesh_domain_3<Function,K> Mesh_domain;
-
-// Triangulation
-#ifdef CGAL_CONCURRENT_MESH_3
-  typedef CGAL::Mesh_triangulation_3<
-    Mesh_domain,
-    CGAL::Kernel_traits<Mesh_domain>::Kernel, // Same as sequential
-    CGAL::Parallel_tag                        // Tag to activate parallelism
-  >::type Tr;
-#else
-  typedef CGAL::Mesh_triangulation_3<Mesh_domain>::type Tr;
-#endif
-typedef CGAL::Mesh_complex_3_in_triangulation_3<Tr> C3t3;
-
-// Criteria
-typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;
-
-// To avoid verbose function and named parameters call
-using namespace CGAL::parameters;
-
-// Function
-FT sphere_function (const Point& p)
-{ return CGAL::squared_distance(p, Point(CGAL::ORIGIN))-1; }
-
-int main()
-{
-  // Domain (Warning: Sphere_3 constructor uses squared radius !)
-  Mesh_domain domain(sphere_function,
-                     K::Sphere_3(CGAL::ORIGIN, 2.));
-
-  // Mesh criteria
-  Mesh_criteria criteria(facet_angle=30, facet_size=0.1, facet_distance=0.025,
-                         cell_radius_edge_ratio=2, cell_size=0.1);
-  
-  // Mesh generation
-  C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria);
-
-  // Output
-  std::ofstream medit_file("out.mesh");
-  c3t3.output_to_medit(medit_file);
-
-  return 0;
-}
-
diff --git a/3rdparty/CGAL-4.8/examples/Mesh_3/mesh_implicit_sphere_variable_size.cpp b/3rdparty/CGAL-4.8/examples/Mesh_3/mesh_implicit_sphere_variable_size.cpp
deleted file mode 100644
index 24bacf2..0000000
--- a/3rdparty/CGAL-4.8/examples/Mesh_3/mesh_implicit_sphere_variable_size.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-
-#include <CGAL/Mesh_triangulation_3.h>
-#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
-#include <CGAL/Mesh_criteria_3.h>
-
-#include <CGAL/Implicit_mesh_domain_3.h>
-#include <CGAL/make_mesh_3.h>
-
-// Domain
-typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
-typedef K::FT FT;
-typedef K::Point_3 Point;
-typedef FT (Function)(const Point&);
-typedef CGAL::Implicit_mesh_domain_3<Function,K> Mesh_domain;
-
-// Triangulation
-#ifdef CGAL_CONCURRENT_MESH_3
-  typedef CGAL::Mesh_triangulation_3<
-    Mesh_domain,
-    CGAL::Kernel_traits<Mesh_domain>::Kernel, // Same as sequential
-    CGAL::Parallel_tag                        // Tag to activate parallelism
-  >::type Tr;
-#else
-  typedef CGAL::Mesh_triangulation_3<Mesh_domain>::type Tr;
-#endif
-typedef CGAL::Mesh_complex_3_in_triangulation_3<Tr> C3t3;
-
-// Criteria
-typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;
-
-// Sizing field
-struct Spherical_sizing_field
-{
-  typedef ::FT FT;
-  typedef Point Point_3;
-  typedef Mesh_domain::Index Index;
-  
-  FT operator()(const Point_3& p, const int, const Index&) const
-  {
-    FT sq_d_to_origin = CGAL::squared_distance(p, Point(CGAL::ORIGIN));
-    return CGAL::abs( CGAL::sqrt(sq_d_to_origin)-0.5 ) / 5. + 0.025; 
-  }
-};
-
-// To avoid verbose function and named parameters call
-using namespace CGAL::parameters;
-
-// Function
-FT sphere_function (const Point& p)
-{ return CGAL::squared_distance(p, Point(CGAL::ORIGIN))-1; }
-
-int main()
-{
-  // Domain (Warning: Sphere_3 constructor uses squared radius !)
-  Mesh_domain domain(sphere_function,
-                     K::Sphere_3(CGAL::ORIGIN, 2.));
-
-  // Mesh criteria
-  Spherical_sizing_field size;
-  Mesh_criteria criteria(facet_angle=30, facet_size=0.1, facet_distance=0.025,
-                         cell_radius_edge_ratio=2, cell_size=size);
-  
-  // Mesh generation
-  C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria, no_exude(), no_perturb());
-
-  // Output
-  std::ofstream medit_file("out.mesh");
-  c3t3.output_to_medit(medit_file);
-
-  return 0;
-}
-
diff --git a/3rdparty/CGAL-4.8/examples/Mesh_3/mesh_optimization_example.cpp b/3rdparty/CGAL-4.8/examples/Mesh_3/mesh_optimization_example.cpp
deleted file mode 100644
index 5737faa..0000000
--- a/3rdparty/CGAL-4.8/examples/Mesh_3/mesh_optimization_example.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-
-#include <CGAL/Mesh_triangulation_3.h>
-#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
-#include <CGAL/Mesh_criteria_3.h>
-
-#include <CGAL/Labeled_image_mesh_domain_3.h>
-#include <CGAL/make_mesh_3.h>
-#include <CGAL/Image_3.h>
-
-// Domain
-typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
-typedef CGAL::Labeled_image_mesh_domain_3<CGAL::Image_3,K> Mesh_domain;
-
-// Triangulation
-#ifdef CGAL_CONCURRENT_MESH_3
-  typedef CGAL::Mesh_triangulation_3<
-    Mesh_domain,
-    CGAL::Kernel_traits<Mesh_domain>::Kernel, // Same as sequential
-    CGAL::Parallel_tag                        // Tag to activate parallelism
-  >::type Tr;
-#else
-  typedef CGAL::Mesh_triangulation_3<Mesh_domain>::type Tr;
-#endif
-typedef CGAL::Mesh_complex_3_in_triangulation_3<Tr> C3t3;
-
-// Mesh Criteria
-typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;
-
-// To avoid verbose function and named parameters call
-using namespace CGAL::parameters;
-
-int main(int argc, char* argv[])
-{
-  const char* fname = (argc>1)?argv[1]:"data/liver.inr.gz";
-  // Domain
-  CGAL::Image_3 image;
-  if(!image.read(fname)){
-    std::cerr << "Error: Cannot read file " <<  fname << std::endl;
-    return EXIT_FAILURE;
-  }
-
-  Mesh_domain domain(image);
-
-  // Mesh criteria
-  Mesh_criteria criteria(facet_angle=30, facet_size=5, facet_distance=1.5,
-                         cell_radius_edge_ratio=2, cell_size=7);
-
-  // Mesh generation and optimization in one call (sliver_bound is the
-  // targeted dihedral angle in degree)
-  C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria,
-                                      no_exude(),
-                                      perturb(sliver_bound=10, time_limit=15));
-  
-  // Mesh generation and optimization in several call
-  C3t3 c3t3_bis = CGAL::make_mesh_3<C3t3>(domain, criteria,
-                                          no_perturb(), no_exude());
-  
-  CGAL::perturb_mesh_3(c3t3_bis, domain, time_limit=15);
-
-  // Output
-  std::ofstream medit_file("out.mesh");
-  c3t3.output_to_medit(medit_file);
-  
-  std::ofstream medit_file_bis("out_bis.mesh");
-  c3t3_bis.output_to_medit(medit_file_bis);
-
-  return 0;
-}
diff --git a/3rdparty/CGAL-4.8/examples/Mesh_3/mesh_optimization_lloyd_example.cpp b/3rdparty/CGAL-4.8/examples/Mesh_3/mesh_optimization_lloyd_example.cpp
deleted file mode 100644
index c283261..0000000
--- a/3rdparty/CGAL-4.8/examples/Mesh_3/mesh_optimization_lloyd_example.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-
-#include <CGAL/Mesh_triangulation_3.h>
-#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
-#include <CGAL/Mesh_criteria_3.h>
-
-#include <CGAL/Labeled_image_mesh_domain_3.h>
-#include <CGAL/make_mesh_3.h>
-#include <CGAL/Image_3.h>
-
-// Domain
-typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
-typedef CGAL::Labeled_image_mesh_domain_3<CGAL::Image_3,K> Mesh_domain;
-
-// Triangulation
-#ifdef CGAL_CONCURRENT_MESH_3
-  typedef CGAL::Mesh_triangulation_3<
-    Mesh_domain,
-    CGAL::Kernel_traits<Mesh_domain>::Kernel, // Same as sequential
-    CGAL::Parallel_tag                        // Tag to activate parallelism
-  >::type Tr;
-#else
-  typedef CGAL::Mesh_triangulation_3<Mesh_domain>::type Tr;
-#endif
-typedef CGAL::Mesh_complex_3_in_triangulation_3<Tr> C3t3;
-
-// Mesh Criteria
-typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;
-
-// To avoid verbose function and named parameters call
-using namespace CGAL::parameters;
-
-int main(int argc, char*argv[])
-{
-  const char* fname = (argc>1)?argv[1]:"data/liver.inr.gz";
-  // Domain
-  CGAL::Image_3 image;
-  if(!image.read(fname)){
-    std::cerr << "Error: Cannot read file " <<  fname << std::endl;
-    return EXIT_FAILURE;
-  }
-  Mesh_domain domain(image);
-
-  // Mesh criteria
-  Mesh_criteria criteria(facet_angle=30, facet_distance=1.2,
-                         cell_radius_edge_ratio=2);
-
-  // Mesh generation and optimization in one call
-  C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria,
-                                      lloyd(time_limit=30),
-                                      no_perturb(),
-                                      exude(time_limit=10, sliver_bound=10));
-  
-  // Mesh generation and optimization in several call
-  C3t3 c3t3_bis = CGAL::make_mesh_3<C3t3>(domain, criteria,
-                                          no_perturb(), no_exude());
-  
-  CGAL::lloyd_optimize_mesh_3(c3t3_bis, domain, time_limit=30);
-  CGAL::exude_mesh_3(c3t3_bis, sliver_bound=10, time_limit=10);
-  
-  // Output
-  std::ofstream medit_file("out.mesh");
-  c3t3.output_to_medit(medit_file);
-  
-  std::ofstream medit_file_bis("out_bis.mesh");
-  c3t3_bis.output_to_medit(medit_file_bis);
-
-  return 0;
-}
diff --git a/3rdparty/CGAL-4.8/examples/Mesh_3/mesh_polyhedral_domain.cpp b/3rdparty/CGAL-4.8/examples/Mesh_3/mesh_polyhedral_domain.cpp
deleted file mode 100644
index a8e1a02..0000000
--- a/3rdparty/CGAL-4.8/examples/Mesh_3/mesh_polyhedral_domain.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-
-#include <CGAL/Mesh_triangulation_3.h>
-#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
-#include <CGAL/Mesh_criteria_3.h>
-
-#include <CGAL/Polyhedral_mesh_domain_3.h>
-#include <CGAL/make_mesh_3.h>
-#include <CGAL/refine_mesh_3.h>
-
-// IO
-#include <CGAL/IO/Polyhedron_iostream.h>
-
-// Domain
-typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
-typedef CGAL::Polyhedron_3<K> Polyhedron;
-typedef CGAL::Polyhedral_mesh_domain_3<Polyhedron, K> Mesh_domain;
-
-// Triangulation
-#ifdef CGAL_CONCURRENT_MESH_3
-  typedef CGAL::Mesh_triangulation_3<
-    Mesh_domain,
-    CGAL::Kernel_traits<Mesh_domain>::Kernel, // Same as sequential
-    CGAL::Parallel_tag                        // Tag to activate parallelism
-  >::type Tr;
-#else
-  typedef CGAL::Mesh_triangulation_3<Mesh_domain>::type Tr;
-#endif
-typedef CGAL::Mesh_complex_3_in_triangulation_3<Tr> C3t3;
-
-// Criteria
-typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;
-
-// To avoid verbose function and named parameters call
-using namespace CGAL::parameters;
-
-int main(int argc, char*argv[])
-{
-  const char* fname = (argc>1)?argv[1]:"data/elephant.off";
-  // Create input polyhedron
-  Polyhedron polyhedron;
-  std::ifstream input(fname);
-  input >> polyhedron;
-  if(input.bad()){
-    std::cerr << "Error: Cannot read file " <<  fname << std::endl;
-    return EXIT_FAILURE;
-  }
-  input.close();
-   
-  // Create domain
-  Mesh_domain domain(polyhedron);
-  
-  // Mesh criteria (no cell_size set)
-  Mesh_criteria criteria(facet_angle=25, facet_size=0.15, facet_distance=0.008,
-                         cell_radius_edge_ratio=3);
-  
-  // Mesh generation
-  C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria, no_perturb(), no_exude());
-
-  // Output
-  std::ofstream medit_file("out_1.mesh");
-  c3t3.output_to_medit(medit_file);
-  medit_file.close();
-
-  // Set tetrahedron size (keep cell_radius_edge_ratio), ignore facets
-  Mesh_criteria new_criteria(cell_radius_edge_ratio=3, cell_size=0.03);
-
-  // Mesh refinement
-  CGAL::refine_mesh_3(c3t3, domain, new_criteria);
-
-  // Output
-  medit_file.open("out_2.mesh");
-  c3t3.output_to_medit(medit_file);
-
-  return 0;
-}
diff --git a/3rdparty/CGAL-4.8/examples/Mesh_3/mesh_polyhedral_domain_with_features.cpp b/3rdparty/CGAL-4.8/examples/Mesh_3/mesh_polyhedral_domain_with_features.cpp
deleted file mode 100644
index 7e4f4a1..0000000
--- a/3rdparty/CGAL-4.8/examples/Mesh_3/mesh_polyhedral_domain_with_features.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-
-#include <CGAL/Mesh_triangulation_3.h>
-#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
-#include <CGAL/Mesh_criteria_3.h>
-
-#include <CGAL/Polyhedral_mesh_domain_with_features_3.h>
-#include <CGAL/make_mesh_3.h>
-
-// Domain 
-typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
-typedef CGAL::Polyhedral_mesh_domain_with_features_3<K> Mesh_domain;
-
-// Triangulation
-#ifdef CGAL_CONCURRENT_MESH_3
-  typedef CGAL::Mesh_triangulation_3<
-    Mesh_domain,
-    CGAL::Kernel_traits<Mesh_domain>::Kernel, // Same as sequential
-    CGAL::Parallel_tag                        // Tag to activate parallelism
-  >::type Tr;
-#else
-  typedef CGAL::Mesh_triangulation_3<Mesh_domain>::type Tr;
-#endif
-typedef CGAL::Mesh_complex_3_in_triangulation_3<
-  Tr,Mesh_domain::Corner_index,Mesh_domain::Curve_segment_index> C3t3;
-
-// Criteria
-typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;
-
-// To avoid verbose function and named parameters call
-using namespace CGAL::parameters;
-
-int main(int argc, char*argv[])
-{
-  const char* fname = (argc>1)?argv[1]:"data/fandisk.off";
-  // Create domain
-  Mesh_domain domain(fname);
-  
-  // Get sharp features
-  domain.detect_features();
-
-  // Mesh criteria
-  Mesh_criteria criteria(edge_size = 0.025,
-                         facet_angle = 25, facet_size = 0.05, facet_distance = 0.005,
-                         cell_radius_edge_ratio = 3, cell_size = 0.05);
-  
-  // Mesh generation
-  C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria);
-
-  // Output
-  std::ofstream medit_file("out.mesh");
-  c3t3.output_to_medit(medit_file);
-}
diff --git a/3rdparty/CGAL-4.8/examples/Mesh_3/mesh_two_implicit_spheres_with_balls.cpp b/3rdparty/CGAL-4.8/examples/Mesh_3/mesh_two_implicit_spheres_with_balls.cpp
deleted file mode 100644
index 6d439d3..0000000
--- a/3rdparty/CGAL-4.8/examples/Mesh_3/mesh_two_implicit_spheres_with_balls.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-
-#include <CGAL/Mesh_triangulation_3.h>
-#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
-#include <CGAL/Mesh_criteria_3.h>
-
-#include <CGAL/Implicit_mesh_domain_3.h>
-#include <CGAL/Mesh_domain_with_polyline_features_3.h>
-#include <CGAL/make_mesh_3.h>
-
-// Kernel
-typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
-
-// Domain
-typedef K::FT FT;
-typedef K::Point_3 Point;
-typedef FT (Function)(const Point&);
-typedef CGAL::Mesh_domain_with_polyline_features_3<
-  CGAL::Implicit_mesh_domain_3<Function,K> >              Mesh_domain;
-
-// Polyline
-typedef std::vector<Point>        Polyline_3;
-typedef std::list<Polyline_3>       Polylines;
-
-// Triangulation
-#ifdef CGAL_CONCURRENT_MESH_3
-  typedef CGAL::Mesh_triangulation_3<
-    Mesh_domain,
-    CGAL::Kernel_traits<Mesh_domain>::Kernel, // Same as sequential
-    CGAL::Parallel_tag                        // Tag to activate parallelism
-  >::type Tr;
-#else
-  typedef CGAL::Mesh_triangulation_3<Mesh_domain>::type Tr;
-#endif
-typedef CGAL::Mesh_complex_3_in_triangulation_3<
-  Tr,Mesh_domain::Corner_index,Mesh_domain::Curve_segment_index> C3t3;
-
-// Criteria
-typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;
-
-// To avoid verbose function and named parameters call
-using namespace CGAL::parameters;
-
-// Function
-FT sphere_function1 (const Point& p)
-{ return CGAL::squared_distance(p, Point(CGAL::ORIGIN))-2; }
-
-FT sphere_function2 (const Point& p)
-{ return CGAL::squared_distance(p, Point(2, 0, 0))-2; }
-
-FT sphere_function (const Point& p)
-{
-  if(sphere_function1(p) < 0 || sphere_function2(p) < 0)
-    return -1;
-  else 
-    return 1;
-}
-
-#include <cmath>
-
-int main()
-{
-  // Domain (Warning: Sphere_3 constructor uses squared radius !)
-  Mesh_domain domain(sphere_function,
-                     K::Sphere_3(Point(1, 0, 0), 6.));
-
-  // Mesh criteria
-  Mesh_criteria criteria(edge_size = 0.15,
-                         facet_angle = 25, facet_size = 0.15,
-                         cell_radius_edge_ratio = 2, cell_size = 0.15);
-  
-  // Create edge that we want to preserve
-  Polylines polylines (1);
-  Polyline_3& polyline = polylines.front();
-  
-  for(int i = 0; i < 360; ++i)
-  {
-    Point p (1, std::cos(i*CGAL_PI/180), std::sin(i*CGAL_PI/180));
-    polyline.push_back(p);
-  }
-  polyline.push_back(polyline.front()); // close the line
-
-  // Insert edge in domain
-  domain.add_features(polylines.begin(), polylines.end());
-  
-  // Mesh generation without feature preservation
-  C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria,
-                                      CGAL::parameters::no_features());
-
-  std::ofstream medit_file("out-no-protection.mesh");
-  c3t3.output_to_medit(medit_file);
-  medit_file.close();
-  c3t3.clear();
-
-  // Mesh generation with feature preservation
-  c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria);
-  
-  // Output
-  medit_file.open("out-with-protection.mesh");
-  c3t3.output_to_medit(medit_file);
-  medit_file.close();
-
-  return 0;
-}
diff --git a/3rdparty/CGAL-4.8/examples/Min_annulus_d/min_annulus_d.cpp b/3rdparty/CGAL-4.8/examples/Min_annulus_d/min_annulus_d.cpp
deleted file mode 100644
index 801f88c..0000000
--- a/3rdparty/CGAL-4.8/examples/Min_annulus_d/min_annulus_d.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-// computes the smallest enclosing annulus of two point
-// sets on nested squares in R^2, using double
-// as input type and some internal EXACT floating point type
-#include <iostream>
-#include <cassert>
-#include <CGAL/Homogeneous.h>
-#include <CGAL/Min_annulus_d.h>
-#include <CGAL/Min_sphere_annulus_d_traits_2.h>
-
-#ifdef CGAL_USE_GMP
-#include <CGAL/Gmpzf.h>
-typedef CGAL::Gmpzf ET;
-#else
-#include <CGAL/MP_Float.h>
-typedef CGAL::MP_Float ET;
-#endif
-
-// use an EXACT kernel...
-typedef CGAL::Homogeneous<ET>                  K;
-typedef K::Point_2                             Point;
-// ...and the traits class based on the exact kernel
-typedef CGAL::Min_sphere_annulus_d_traits_2<K> Traits;
-typedef CGAL::Min_annulus_d<Traits>            Min_annulus;
-
-int main()
-{
-  // points on the squares [-1,1]^2 and [-2,2]^2
-  Point P[8] = { Point(-1,-1), Point(-1,1), Point(1,-1), Point(1,1),
-                 Point(-2,-2), Point(-2,2), Point(2,-2), Point(2,2)};
-
-  Min_annulus ma(P, P+8);
-  assert (ma.is_valid());
-
-  // get center of annulus
-  Min_annulus::Coordinate_iterator coord_it;
-
-  std::cout << "center:"; // homogeneous point, (0,0,1)
-  for (coord_it = ma.center_coordinates_begin();
-       coord_it != ma.center_coordinates_end();
-       ++coord_it)
-    std::cout << " " << *coord_it;
-  std::cout << std::endl;
-
-  // get inner squared radius, 1^2+1^2 = 2
-  std::cout << "Inner squared radius: " <<
-    CGAL::to_double(ma.squared_inner_radius_numerator()) /
-    CGAL::to_double(ma.squared_radii_denominator()) << std::endl;
-
-  // get outer squared radius, 2^2+2^2 = 8
-  std::cout << "Outer squared radius: " <<
-    CGAL::to_double(ma.squared_outer_radius_numerator()) /
-    CGAL::to_double(ma.squared_radii_denominator()) << std::endl;
-
-  return 0;
-
-}
diff --git a/3rdparty/CGAL-4.8/examples/Min_annulus_d/min_annulus_d_fast_exact.cpp b/3rdparty/CGAL-4.8/examples/Min_annulus_d/min_annulus_d_fast_exact.cpp
deleted file mode 100644
index ccde18b..0000000
--- a/3rdparty/CGAL-4.8/examples/Min_annulus_d/min_annulus_d_fast_exact.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-// computes the smallest enclosing annulus of two point
-// sets on nested squares in R^2,  using double
-// as input type and some internal EXACT floating point type;
-// the fast type double is also safely used for many of the
-// internal computations
-#include <iostream>
-#include <cassert>
-#include <CGAL/Homogeneous.h>
-#include <CGAL/Min_annulus_d.h>
-#include <CGAL/Min_sphere_annulus_d_traits_2.h>
-
-#include <CGAL/Exact_integer.h>
-typedef CGAL::Exact_integer ET;
-
-// use an inexact kernel...
-typedef CGAL::Homogeneous<double>                          K;
-typedef K::Point_2                                         Point;
-// ... and the EXACT traits class based on the inexcat kernel
-typedef CGAL::Min_sphere_annulus_d_traits_2<K, ET, double> Traits;
-typedef CGAL::Min_annulus_d<Traits>                        Min_annulus;
-
-
-
-int main()
-{
-  // points on the squares [-1,1]^2 and [-2,2]^2
-  Point P[8] = { Point(-1,-1), Point(-1,1), Point(1,-1), Point(1,1),
-                 Point(-2,-2), Point(-2,2), Point(2,-2), Point(2,2)};
-
-  Min_annulus ma(P, P+8);
-  assert (ma.is_valid());
-
-  // get center of annulus
-  Min_annulus::Coordinate_iterator coord_it;
-
-  std::cout << "center:"; // homogeneous point, (0,0,1)
-  for (coord_it = ma.center_coordinates_begin();
-       coord_it != ma.center_coordinates_end();
-       ++coord_it)
-    std::cout << " " << CGAL::to_double(*coord_it);
-  std::cout << std::endl;
-
-  // get inner squared radius, 1^2+1^2 = 2
-  std::cout << "Inner squared radius: " <<
-    CGAL::to_double(ma.squared_inner_radius_numerator()) /
-    CGAL::to_double(ma.squared_radii_denominator()) << std::endl;
-
-  // get outer squared radius, 2^2+2^2 = 8
-  std::cout << "Outer squared radius: " <<
-    CGAL::to_double(ma.squared_outer_radius_numerator()) /
-    CGAL::to_double(ma.squared_radii_denominator()) << std::endl;
-
-  return 0;
-
-}
diff --git a/3rdparty/CGAL-4.8/examples/Minkowski_sum_2/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Minkowski_sum_2/CMakeLists.txt
deleted file mode 100644
index 544940c..0000000
--- a/3rdparty/CGAL-4.8/examples/Minkowski_sum_2/CMakeLists.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Minkowski_sum_2_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "approx_inset.cpp" )
-  create_single_source_cgal_program( "approx_offset.cpp" )
-  create_single_source_cgal_program( "exact_inset.cpp" )
-  create_single_source_cgal_program( "exact_offset.cpp" )
-  create_single_source_cgal_program( "sum_by_decomposition.cpp" )
-  create_single_source_cgal_program( "sum_of_holes.cpp" )
-  create_single_source_cgal_program( "sum_triangle_square.cpp" )
-  create_single_source_cgal_program( "sum_with_holes.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Minkowski_sum_3/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Minkowski_sum_3/CMakeLists.txt
deleted file mode 100644
index c0b30d0..0000000
--- a/3rdparty/CGAL-4.8/examples/Minkowski_sum_3/CMakeLists.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Minkowski_sum_3_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "cube_offset.cpp" )
-  create_single_source_cgal_program( "glide.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Modular_arithmetic/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Modular_arithmetic/CMakeLists.txt
deleted file mode 100644
index a5c7523..0000000
--- a/3rdparty/CGAL-4.8/examples/Modular_arithmetic/CMakeLists.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Modular_arithmetic_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "modular_filter.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Nef_2/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Nef_2/CMakeLists.txt
deleted file mode 100644
index cbe11d8..0000000
--- a/3rdparty/CGAL-4.8/examples/Nef_2/CMakeLists.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Nef_2_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "nef_2_construction.cpp" )
-  create_single_source_cgal_program( "nef_2_intersection.cpp" )
-  create_single_source_cgal_program( "nef_2_polylines.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Nef_3/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Nef_3/CMakeLists.txt
deleted file mode 100644
index 3e8ec17..0000000
--- a/3rdparty/CGAL-4.8/examples/Nef_3/CMakeLists.txt
+++ /dev/null
@@ -1,42 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Nef_3_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "comparison.cpp" )
-  create_single_source_cgal_program( "complex_construction.cpp" )
-  create_single_source_cgal_program( "exploration_SM.cpp" )
-  create_single_source_cgal_program( "extended_kernel.cpp" )
-  create_single_source_cgal_program( "handling_double_coordinates.cpp" )
-  create_single_source_cgal_program( "interface_polyhedron.cpp" )
-  create_single_source_cgal_program( "nefIO.cpp" )
-  create_single_source_cgal_program( "nef_3_construction.cpp" )
-  create_single_source_cgal_program( "nef_3_point_location.cpp" )
-  create_single_source_cgal_program( "nef_3_simple.cpp" )
-  create_single_source_cgal_program( "offIO.cpp" )
-  create_single_source_cgal_program( "point_set_operations.cpp" )
-  create_single_source_cgal_program( "polyline_construction.cpp" )
-  create_single_source_cgal_program( "set_operations.cpp" )
-  create_single_source_cgal_program( "shell_exploration.cpp" )
-  create_single_source_cgal_program( "topological_operations.cpp" )
-  create_single_source_cgal_program( "transformation.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Nef_S2/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Nef_S2/CMakeLists.txt
deleted file mode 100644
index 90eb939..0000000
--- a/3rdparty/CGAL-4.8/examples/Nef_S2/CMakeLists.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Nef_S2_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-    include_directories (BEFORE "include")
-
-  create_single_source_cgal_program( "nef_s2_construction.cpp" )
-  create_single_source_cgal_program( "nef_s2_exploration.cpp" )
-  create_single_source_cgal_program( "nef_s2_point_location.cpp" )
-  create_single_source_cgal_program( "nef_s2_simple.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Optimal_transportation_reconstruction_2/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Optimal_transportation_reconstruction_2/CMakeLists.txt
deleted file mode 100644
index 060c0de..0000000
--- a/3rdparty/CGAL-4.8/examples/Optimal_transportation_reconstruction_2/CMakeLists.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-project( Optimal_transportation_reconstruction_2_example )
-
-cmake_minimum_required(VERSION 2.6.2)
-if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_GREATER 2.6)
-  if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
-    cmake_policy(VERSION 2.8.4)
-  else()
-    cmake_policy(VERSION 2.6)
-  endif()
-endif()
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  include_directories (BEFORE "include")
-
-  create_single_source_cgal_program( "otr2_simplest_example.cpp" )
-  create_single_source_cgal_program( "otr2_list_output_example.cpp" )
-  create_single_source_cgal_program( "otr2_indexed_output_example.cpp" )
-  create_single_source_cgal_program( "otr2_mass_example.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Optimal_transportation_reconstruction_2/otr2_simplest_example.cpp b/3rdparty/CGAL-4.8/examples/Optimal_transportation_reconstruction_2/otr2_simplest_example.cpp
deleted file mode 100644
index 4def459..0000000
--- a/3rdparty/CGAL-4.8/examples/Optimal_transportation_reconstruction_2/otr2_simplest_example.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-// Simplest example for Optimal_transportation_reconstruction_2, with no mass
-// attributes for the input points
-
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-#include <CGAL/point_generators_2.h>
-#include <CGAL/Optimal_transportation_reconstruction_2.h>
-
-#include <fstream>
-#include <iostream>
-#include <vector>
-
-typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
-typedef K::Point_2                                          Point;
-
-typedef CGAL::Optimal_transportation_reconstruction_2<K>    Otr;
-
-int main ()
-{
-  // Generate a set of random points on the boundary of a square.
-  std::vector<Point> points;
-  CGAL::Random_points_on_square_2<Point> point_generator(1.);
-  CGAL::cpp11::copy_n(point_generator, 100, std::back_inserter(points));
-
-  Otr otr(points);
-  otr.run(100); // 100 steps
-
-  return 0;
-}
diff --git a/3rdparty/CGAL-4.8/examples/Partition_2/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Partition_2/CMakeLists.txt
deleted file mode 100644
index 82f699e..0000000
--- a/3rdparty/CGAL-4.8/examples/Partition_2/CMakeLists.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Partition_2_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "approx_convex_partition_2.cpp" )
-  create_single_source_cgal_program( "greene_approx_convex_partition_2.cpp" )
-  create_single_source_cgal_program( "optimal_convex_partition_2.cpp" )
-  create_single_source_cgal_program( "y_monotone_partition_2.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Periodic_2_triangulation_2/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Periodic_2_triangulation_2/CMakeLists.txt
deleted file mode 100644
index 7c6d9c3..0000000
--- a/3rdparty/CGAL-4.8/examples/Periodic_2_triangulation_2/CMakeLists.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Periodic_2_triangulation_2_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "p2t2_adding_handles.cpp" )
-  create_single_source_cgal_program( "p2t2_colored_vertices.cpp" )
-  create_single_source_cgal_program( "p2t2_covering.cpp" )
-  create_single_source_cgal_program( "p2t2_find_conflicts.cpp" )
-  create_single_source_cgal_program( "p2t2_geometric_access.cpp" )
-  create_single_source_cgal_program( "p2t2_hierarchy.cpp" )
-  create_single_source_cgal_program( "p2t2_info_insert_with_pair_iterator_2.cpp" )
-  create_single_source_cgal_program( "p2t2_info_insert_with_transform_iterator_2.cpp" )
-  create_single_source_cgal_program( "p2t2_info_insert_with_zip_iterator_2.cpp" )
-  create_single_source_cgal_program( "p2t2_large_point_set.cpp" )
-  create_single_source_cgal_program( "p2t2_simple_example.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Periodic_3_triangulation_3/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Periodic_3_triangulation_3/CMakeLists.txt
deleted file mode 100644
index fa8c24b..0000000
--- a/3rdparty/CGAL-4.8/examples/Periodic_3_triangulation_3/CMakeLists.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Periodic_3_triangulation_3_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "colored_vertices.cpp" )
-  create_single_source_cgal_program( "covering.cpp" )
-  create_single_source_cgal_program( "find_conflicts.cpp" )
-  create_single_source_cgal_program( "geometric_access.cpp" )
-  create_single_source_cgal_program( "large_point_set.cpp" )
-  create_single_source_cgal_program( "periodic_adding_handles.cpp" )
-  create_single_source_cgal_program( "simple_example.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Periodic_3_triangulation_3/colored_vertices.cpp b/3rdparty/CGAL-4.8/examples/Periodic_3_triangulation_3/colored_vertices.cpp
deleted file mode 100644
index 6d27f5a..0000000
--- a/3rdparty/CGAL-4.8/examples/Periodic_3_triangulation_3/colored_vertices.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-#include <CGAL/Periodic_3_Delaunay_triangulation_filtered_traits_3.h>
-#include <CGAL/Periodic_3_Delaunay_triangulation_3.h>
-#include <CGAL/Triangulation_vertex_base_with_info_3.h>
-#include <CGAL/IO/Color.h>
-
-typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
-typedef CGAL::Periodic_3_Delaunay_triangulation_filtered_traits_3<K> GT;
-
-typedef CGAL::Periodic_3_triangulation_ds_vertex_base_3<> VbDS;
-typedef CGAL::Triangulation_vertex_base_3<GT,VbDS> Vb;
-
-typedef CGAL::Periodic_3_triangulation_ds_cell_base_3<> CbDS;
-typedef CGAL::Triangulation_cell_base_3<GT,CbDS> Cb;
-
-typedef CGAL::Triangulation_vertex_base_with_info_3<CGAL::Color, GT, Vb> VbInfo;
-typedef CGAL::Triangulation_data_structure_3<VbInfo, Cb>    TDS;
-typedef CGAL::Periodic_3_Delaunay_triangulation_3<GT, TDS>  PDT;
-
-typedef PDT::Point   Point;
-
-int main()
-{
-  PDT T;
-
-  T.insert(Point(0,0,0));
-  T.insert(Point(.1,0,0));
-  T.insert(Point(0,.1,0));
-  T.insert(Point(0,0,.1));
-  T.insert(Point(.2,.2,.2));
-  T.insert(Point(.9,0,.1));
-
-  // Set the color of finite vertices of degree 6 to red.
-  PDT::Vertex_iterator vit;
-  for (vit = T.vertices_begin(); vit != T.vertices_end(); ++vit)
-    if (T.degree(vit) == 6)
-      vit->info() = CGAL::RED;
-
-  return 0;
-}
diff --git a/3rdparty/CGAL-4.8/examples/Periodic_3_triangulation_3/find_conflicts.cpp b/3rdparty/CGAL-4.8/examples/Periodic_3_triangulation_3/find_conflicts.cpp
deleted file mode 100644
index 87c810f..0000000
--- a/3rdparty/CGAL-4.8/examples/Periodic_3_triangulation_3/find_conflicts.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-#include <CGAL/Periodic_3_Delaunay_triangulation_filtered_traits_3.h>
-#include <CGAL/Periodic_3_Delaunay_triangulation_3.h>
-#include <CGAL/point_generators_3.h>
-
-#include <vector>
-#include <cassert>
-
-typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
-typedef CGAL::Periodic_3_Delaunay_triangulation_filtered_traits_3<K> GT;
-
-typedef CGAL::Periodic_3_Delaunay_triangulation_3<GT> Delaunay;
-typedef Delaunay::Point                               Point;
-typedef Delaunay::Cell_handle                         Cell_handle;
-typedef Delaunay::Facet                               Facet;
-
-int main()
-{
-  Delaunay T;
-  CGAL::Random_points_in_cube_3<Point> rnd(0.5);
-  GT::Vector_3 v(0.5,0.5,0.5);
-
-  // First, make sure the triangulation is 3D.
-  T.insert(Point(0,0,0));
-  T.insert(Point(.1,0,0));
-  T.insert(Point(0,.1,0));
-  T.insert(Point(0,0,.1));
-
-  // Gets the conflict region of 100 random points
-  // in the Delaunay tetrahedralization
-  for (int i = 0; i != 100; ++i) {
-    Point p = (*rnd++)+v;
-
-    // Locate the point
-    Delaunay::Locate_type lt;
-    int li, lj;
-    Cell_handle c = T.locate(p, lt, li, lj);
-    if (lt == Delaunay::VERTEX)
-      continue; // Point already exists
-
-    // Get the cells that conflict with p in a vector V,
-    // and a facet on the boundary of this hole in f.
-    std::vector<Cell_handle> V;
-    Facet f;
-
-    T.find_conflicts(p, c,
-		     CGAL::Oneset_iterator<Facet>(f), // Get one boundary facet
-		     std::back_inserter(V));          // Conflict cells in V
-    }
-
-  std::cout << "Final triangulation has " << T.number_of_vertices()
-            << " vertices." << std::endl;
-
-  return 0;
-}
diff --git a/3rdparty/CGAL-4.8/examples/Periodic_3_triangulation_3/periodic_adding_handles.cpp b/3rdparty/CGAL-4.8/examples/Periodic_3_triangulation_3/periodic_adding_handles.cpp
deleted file mode 100644
index d0de0f6..0000000
--- a/3rdparty/CGAL-4.8/examples/Periodic_3_triangulation_3/periodic_adding_handles.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-#include <CGAL/Periodic_3_Delaunay_triangulation_filtered_traits_3.h>
-#include <CGAL/Periodic_3_Delaunay_triangulation_3.h>
-#include <CGAL/Periodic_3_triangulation_ds_vertex_base_3.h>
-#include <CGAL/Triangulation_vertex_base_3.h>
-
-template < class GT, class VbDS,
-	   class Vb = CGAL::Triangulation_vertex_base_3<GT,VbDS> >
-class My_vertex_base
-  : public Vb
-{
-public:
-  typedef typename Vb::Vertex_handle  Vertex_handle;
-  typedef typename Vb::Cell_handle    Cell_handle;
-  typedef typename Vb::Point          Point;
-
-  template < class TDS2 >
-  struct Rebind_TDS {
-    typedef typename Vb::template Rebind_TDS<TDS2>::Other  Vb2;
-    typedef My_vertex_base<GT, Vb2>                        Other;
-  };
-
-  My_vertex_base() {}
-
-  My_vertex_base(const Point& p)
-    : Vb(p) {}
-
-  My_vertex_base(const Point& p, Cell_handle c)
-    : Vb(p, c) {}
-
-  Vertex_handle   vh;
-  Cell_handle     ch;
-};
-
-
-typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
-typedef CGAL::Periodic_3_Delaunay_triangulation_filtered_traits_3<K> GT;
-
-typedef CGAL::Periodic_3_triangulation_ds_vertex_base_3<> VbDS;
-typedef CGAL::Periodic_3_triangulation_ds_cell_base_3<> CbDS;
-typedef CGAL::Triangulation_cell_base_3<GT,CbDS> Cb;
-
-typedef CGAL::Triangulation_data_structure_3<My_vertex_base<GT,VbDS>, Cb> TDS;
-typedef CGAL::Periodic_3_Delaunay_triangulation_3<GT,TDS> PDT;
-
-typedef PDT::Vertex_handle    Vertex_handle;
-typedef PDT::Point            Point;
-
-int main()
-{
-  PDT T;
-
-  Vertex_handle v0 = T.insert(Point(0,0,0));
-  Vertex_handle v1 = T.insert(Point(.1,0,0));
-  Vertex_handle v2 = T.insert(Point(0,.1,0));
-  Vertex_handle v3 = T.insert(Point(0,0,.1));
-  Vertex_handle v4 = T.insert(Point(.2,.2,.2));
-  Vertex_handle v5 = T.insert(Point(.9,0,.1));
-
-  // Now we can link the vertices as we like.
-  v0->vh = v1;
-  v1->vh = v2;
-  v2->vh = v3;
-  v3->vh = v4;
-  v4->vh = v5;
-  v5->vh = v0;
-
-  return 0;
-}
diff --git a/3rdparty/CGAL-4.8/examples/Point_set_2/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Point_set_2/CMakeLists.txt
deleted file mode 100644
index 4d40263..0000000
--- a/3rdparty/CGAL-4.8/examples/Point_set_2/CMakeLists.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Point_set_2_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "nearest_neighbor.cpp" )
-  create_single_source_cgal_program( "range_search.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Point_set_processing_3/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Point_set_processing_3/CMakeLists.txt
deleted file mode 100644
index e6a0ef7..0000000
--- a/3rdparty/CGAL-4.8/examples/Point_set_processing_3/CMakeLists.txt
+++ /dev/null
@@ -1,81 +0,0 @@
-# This is the CMake script for compiling this folder.
-
-project( Point_set_processing_3_example )
-
-cmake_minimum_required(VERSION 2.8.11)
-
-
-# Find CGAL
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  find_package(Boost QUIET)
-
-  # VisualC++ optimization for applications dealing with large data
-  if (MSVC)
-  
-    # Allow Windows 32bit applications to use up to 3GB of RAM
-    SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
-
-    # Prints new compilation options
-    message( STATUS "USING DEBUG CXXFLAGS   = '${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}'" )
-    message( STATUS "USING DEBUG EXEFLAGS   = '${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_DEBUG}'" )
-    message( STATUS "USING RELEASE CXXFLAGS = '${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}'" )
-    message( STATUS "USING RELEASE EXEFLAGS = '${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_RELEASE}'" )
-  endif()
-
-  # Activate concurrency?
-  option(ACTIVATE_CONCURRENT_PSP3
-         "Enable concurrency"
-         OFF)
-     
-  if( ACTIVATE_CONCURRENT_PSP3 OR ENV{ACTIVATE_CONCURRENT_PSP3} )
-    find_package( TBB REQUIRED )
-    if( TBB_FOUND )
-      include(${TBB_USE_FILE})
-      list(APPEND CGAL_3RD_PARTY_LIBRARIES ${TBB_LIBRARIES})
-    endif()
-  endif()
-
-  # Executables that do *not* require EIGEN or LAPACK
-  create_single_source_cgal_program( "average_spacing_example.cpp" )
-  create_single_source_cgal_program( "bilateral_smooth_point_set_example.cpp" )
-  create_single_source_cgal_program( "grid_simplification_example.cpp" )
-  create_single_source_cgal_program( "grid_simplify_indices.cpp" )
-  create_single_source_cgal_program( "hierarchy_simplification_example.cpp" )
-  create_single_source_cgal_program( "normals_example.cpp" )
-  create_single_source_cgal_program( "property_map.cpp" )
-  create_single_source_cgal_program( "random_simplification_example.cpp" )
-  create_single_source_cgal_program( "read_write_xyz_point_set_example.cpp" )
-  create_single_source_cgal_program( "remove_outliers_example.cpp" )
-  create_single_source_cgal_program( "wlop_simplify_and_regularize_point_set_example.cpp" )
-  create_single_source_cgal_program( "edge_aware_upsample_point_set_example.cpp" )
-  
-  # Use Eigen or BLAS and LAPACK (optional)
-  find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater)
-  if (NOT EIGEN3_FOUND)
-    find_package(LAPACK)
-    if(LAPACK_FOUND)
-      include( ${LAPACK_USE_FILE} )
-    endif(LAPACK_FOUND)
-  else()
-    include( ${EIGEN3_USE_FILE} )
-  endif()
-
-  if(EIGEN3_FOUND OR LAPACK_FOUND)
-    # Executables that require Eigen or BLAS and LAPACK
-    create_single_source_cgal_program( "jet_smoothing_example.cpp" )
-    create_single_source_cgal_program( "normal_estimation.cpp" )
-    create_single_source_cgal_program( "edges_example.cpp" )
-  else(EIGEN3_FOUND OR LAPACK_FOUND)
-
-    message(STATUS "NOTICE: Some of the executables in this directory need either Eigen 3.1 (or greater) or LAPACK, and will not be compiled.")
-
-  endif(EIGEN3_FOUND OR LAPACK_FOUND)
-else()
-    message(STATUS "NOTICE: This program requires the CGAL library, and will not be compiled.")
-endif()
diff --git a/3rdparty/CGAL-4.8/examples/Point_set_processing_3/grid_simplify_indices.cpp b/3rdparty/CGAL-4.8/examples/Point_set_processing_3/grid_simplify_indices.cpp
deleted file mode 100644
index 5f72af0..0000000
--- a/3rdparty/CGAL-4.8/examples/Point_set_processing_3/grid_simplify_indices.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-#include <CGAL/grid_simplify_point_set.h>
-#include <CGAL/IO/read_xyz_points.h>
-#include <CGAL/property_map.h>
-
-#include <vector>
-#include <fstream>
-
-// types
-typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
-typedef Kernel::Point_3 Point;
-typedef Kernel::Vector_3 Vector;
-
-int main(int argc, char*argv[])
-{
-  // Reads a .xyz point set file in points[].
-  std::vector<Point> points;
-  std::vector<Vector> normals;
-  const char* fname = (argc>1)?argv[1]:"data/fin90_with_PCA_normals.xyz";
-  std::ifstream stream(fname);
-  Point p;
-  Vector v;
-  while(stream >> p >> v){
-    points.push_back(p);
-    normals.push_back(v);
-  } 
-
-  std::cout << points.size() << " input points" << std::endl;
-  std::vector<std::size_t> indices(points.size());
-  for(std::size_t i = 0; i < points.size(); ++i){
-    indices[i] = i;
-  }
-  // simplification by clustering using erase-remove idiom
-  double cell_size = 0.05;
-  std::vector<std::size_t>::iterator end;
-  end = CGAL::grid_simplify_point_set(indices.begin(), indices.end(), &(points[0]),cell_size);
-
-  std::size_t k = end - indices.begin();
-
-  std::cerr << "Keep " << k << " of " << indices.size() <<  "indices" << std::endl;
-
-  {
-    std::vector<Point> tmp_points(k);
-    std::vector<Vector> tmp_normals(k);
-    for(std::size_t i=0; i<k; ++i){
-      tmp_points[i] = points[indices[i]];
-      tmp_normals[i] = normals[indices[i]];
-    }
-    points.swap(tmp_points);
-    normals.swap(tmp_normals);
-  }
-
-  std::cout << points.size() << " points after the simplification" << std::endl;
-
-  return EXIT_SUCCESS;
-}
-
diff --git a/3rdparty/CGAL-4.8/examples/Point_set_shape_detection_3/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Point_set_shape_detection_3/CMakeLists.txt
deleted file mode 100644
index 6e1d154..0000000
--- a/3rdparty/CGAL-4.8/examples/Point_set_shape_detection_3/CMakeLists.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Point_set_shape_detection_3_example )
-
-cmake_minimum_required(VERSION 2.6.2)
-if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_GREATER 2.6)
-  if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
-    cmake_policy(VERSION 2.8.4)
-  else()
-    cmake_policy(VERSION 2.6)
-  endif()
-endif()
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "efficient_RANSAC_basic.cpp" )
-  create_single_source_cgal_program( "efficient_RANSAC_custom_shape.cpp" )
-  create_single_source_cgal_program( "efficient_RANSAC_parameters.cpp" )
-  create_single_source_cgal_program( "efficient_RANSAC_point_access.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Point_set_shape_detection_3/efficient_RANSAC_parameters.cpp b/3rdparty/CGAL-4.8/examples/Point_set_shape_detection_3/efficient_RANSAC_parameters.cpp
deleted file mode 100644
index 25cb49c..0000000
--- a/3rdparty/CGAL-4.8/examples/Point_set_shape_detection_3/efficient_RANSAC_parameters.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-#include <CGAL/IO/read_xyz_points.h>
-#include <CGAL/Point_with_normal_3.h>
-#include <CGAL/property_map.h>
-
-#include <CGAL/Shape_detection_3.h>
-
-#include <iostream>
-#include <fstream>
-
-
-// Type declarations
-typedef CGAL::Exact_predicates_inexact_constructions_kernel  Kernel;
-typedef Kernel::FT                                           FT;
-typedef std::pair<Kernel::Point_3, Kernel::Vector_3>         Point_with_normal;
-typedef std::vector<Point_with_normal>                       Pwn_vector;
-typedef CGAL::First_of_pair_property_map<Point_with_normal>  Point_map;
-typedef CGAL::Second_of_pair_property_map<Point_with_normal> Normal_map;
-
-// In Efficient_RANSAC_traits the basic types, i.e., Point and Vector types
-// as well as iterator type and property maps, are defined.
-typedef CGAL::Shape_detection_3::Efficient_RANSAC_traits<Kernel,
-  Pwn_vector, Point_map, Normal_map>            Traits;
-typedef CGAL::Shape_detection_3::Efficient_RANSAC<Traits> Efficient_ransac;
-typedef CGAL::Shape_detection_3::Cone<Traits>             Cone;
-typedef CGAL::Shape_detection_3::Cylinder<Traits>         Cylinder;
-typedef CGAL::Shape_detection_3::Plane<Traits>            Plane;
-typedef CGAL::Shape_detection_3::Sphere<Traits>           Sphere;
-typedef CGAL::Shape_detection_3::Torus<Traits>            Torus;
-
-
-int main() 
-{
-  // Points with normals.
-  Pwn_vector points;
-
-  // Loads point set from a file. 
-  // read_xyz_points_and_normals takes an OutputIterator for storing the points
-  // and a property map to store the normal vector with each point.
-  std::ifstream stream("data/cube.pwn");
-
-  if (!stream ||
-    !CGAL::read_xyz_points_and_normals(stream,
-      std::back_inserter(points),
-      Point_map(),
-      Normal_map()))
-  {
-    std::cerr << "Error: cannot read file cube.pwn" << std::endl;
-    return EXIT_FAILURE;
-  }
-
-  std::cout << points.size() << " points" << std::endl;
-
-  // Instantiates shape detection engine.
-  Efficient_ransac ransac;
-
-  // Provides the input data.
-  ransac.set_input(points);
-    
-  // Register shapes for detection
-  ransac.add_shape_factory<Plane>();
-  ransac.add_shape_factory<Sphere>();
-  ransac.add_shape_factory<Cylinder>();
-  ransac.add_shape_factory<Cone>();
-  ransac.add_shape_factory<Torus>();
-
-  // Sets parameters for shape detection.
-  Efficient_ransac::Parameters parameters;
-
-  // Sets probability to miss the largest primitive at each iteration.
-  parameters.probability = 0.05;
- 
-  // Detect shapes with at least 500 points.
-  parameters.min_points = 200;
-
-  // Sets maximum Euclidean distance between a point and a shape.
-  parameters.epsilon = 0.002;
- 
-  // Sets maximum Euclidean distance between points to be clustered.
-  parameters.cluster_epsilon = 0.01;
- 
-  // Sets maximum normal deviation.
-  // 0.9 < dot(surface_normal, point_normal); 
-  parameters.normal_threshold = 0.9;   
-  
-  // Detects shapes
-  ransac.detect(parameters);
-
-  // Prints number of detected shapes and unassigned points.
-   std::cout << ransac.shapes().end() - ransac.shapes().begin() << " detected shapes, "
-     << ransac.number_of_unassigned_points()
-     << " unassigned points." << std::endl;
-  
-  // Efficient_ransac::shapes() provides
-  // an iterator range to the detected shapes.
-  Efficient_ransac::Shape_range shapes = ransac.shapes();
-  Efficient_ransac::Shape_range::iterator it = shapes.begin();
-
-  while (it != shapes.end()) {
-    // Prints the parameters of the detected shape.
-    std::cout << (*it)->info() << std::endl;
-
-    // Proceeds with next detected shape.
-    it++;
-  }
-
-  return EXIT_SUCCESS;
-}
diff --git a/3rdparty/CGAL-4.8/examples/Polygon/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Polygon/CMakeLists.txt
deleted file mode 100644
index 8c44552..0000000
--- a/3rdparty/CGAL-4.8/examples/Polygon/CMakeLists.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Polygon_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "Example.cpp" )
-  create_single_source_cgal_program( "Polygon.cpp" )
-  create_single_source_cgal_program( "polygon_algorithms.cpp" )
-  create_single_source_cgal_program( "projected_polygon.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Polyhedron/CMakeLists.txt
deleted file mode 100644
index 4e6a91b..0000000
--- a/3rdparty/CGAL-4.8/examples/Polyhedron/CMakeLists.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Polyhedron_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "polyhedron_prog_color.cpp" )
-  create_single_source_cgal_program( "polyhedron_prog_cube.cpp" )
-  create_single_source_cgal_program( "polyhedron_prog_cut_cube.cpp" )
-  create_single_source_cgal_program( "polyhedron_prog_incr_builder.cpp" )
-  create_single_source_cgal_program( "polyhedron_prog_normals.cpp" )
-  create_single_source_cgal_program( "polyhedron_prog_off.cpp" )
-  create_single_source_cgal_program( "polyhedron_prog_planes.cpp" )
-  create_single_source_cgal_program( "polyhedron_prog_simple.cpp" )
-  create_single_source_cgal_program( "polyhedron_prog_subdiv.cpp" )
-  create_single_source_cgal_program( "polyhedron_prog_subdiv_with_boundary.cpp" )
-  create_single_source_cgal_program( "polyhedron_prog_tetra.cpp" )
-  create_single_source_cgal_program( "polyhedron_prog_traits.cpp" )
-  create_single_source_cgal_program( "polyhedron_prog_vector.cpp" )
-  create_single_source_cgal_program( "polyhedron_prog_vertex_color.cpp" )
-  create_single_source_cgal_program( "polyhedron_prog_vertex_normal.cpp" )
-  create_single_source_cgal_program( "polyhedron_self_intersection.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron_IO/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Polyhedron_IO/CMakeLists.txt
deleted file mode 100644
index c05285d..0000000
--- a/3rdparty/CGAL-4.8/examples/Polyhedron_IO/CMakeLists.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Polyhedron_IO_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "iv2off.cpp" )
-  create_single_source_cgal_program( "off2iv.cpp" )
-  create_single_source_cgal_program( "off2off.cpp" )
-  create_single_source_cgal_program( "off2stl.cpp" )
-  create_single_source_cgal_program( "off2vrml.cpp" )
-  create_single_source_cgal_program( "off2wav.cpp" )
-  create_single_source_cgal_program( "off_bbox.cpp" )
-  create_single_source_cgal_program( "off_glue.cpp" )
-  create_single_source_cgal_program( "off_transform.cpp" )
-  create_single_source_cgal_program( "polyhedron2vrml.cpp" )
-  create_single_source_cgal_program( "polyhedron_copy.cpp" )
-  create_single_source_cgal_program( "terr_trian.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Polyline_simplification_2/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Polyline_simplification_2/CMakeLists.txt
deleted file mode 100644
index cf2336d..0000000
--- a/3rdparty/CGAL-4.8/examples/Polyline_simplification_2/CMakeLists.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Polyline_simplification_2_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "points_and_vertices.cpp" )
-  create_single_source_cgal_program( "simplify.cpp" )
-  create_single_source_cgal_program( "simplify_polygon.cpp" )
-  create_single_source_cgal_program( "simplify_polyline.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Polynomial/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Polynomial/CMakeLists.txt
deleted file mode 100644
index c60a4c1..0000000
--- a/3rdparty/CGAL-4.8/examples/Polynomial/CMakeLists.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Polynomial_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "coefficient_access.cpp" )
-  create_single_source_cgal_program( "construction.cpp" )
-  create_single_source_cgal_program( "degree.cpp" )
-  create_single_source_cgal_program( "gcd_up_to_constant_factor.cpp" )
-  create_single_source_cgal_program( "subresultants.cpp" )
-  create_single_source_cgal_program( "substitute.cpp" )
-  create_single_source_cgal_program( "swap_move.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Polytope_distance_d/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Polytope_distance_d/CMakeLists.txt
deleted file mode 100644
index 7d6bc94..0000000
--- a/3rdparty/CGAL-4.8/examples/Polytope_distance_d/CMakeLists.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Polytope_distance_d_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "all_furthest_neighbors_2.cpp" )
-  create_single_source_cgal_program( "polytope_distance_d.cpp" )
-  create_single_source_cgal_program( "polytope_distance_d_fast_exact.cpp" )
-  create_single_source_cgal_program( "width_simplex.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Polytope_distance_d/polytope_distance_d.cpp b/3rdparty/CGAL-4.8/examples/Polytope_distance_d/polytope_distance_d.cpp
deleted file mode 100644
index ca1d6f5..0000000
--- a/3rdparty/CGAL-4.8/examples/Polytope_distance_d/polytope_distance_d.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-// computes the distance between two cubes in R^3 using double
-// as input type and some internal EXACT floating point type
-#include <iostream>
-#include <cassert>
-#include <CGAL/Homogeneous.h>
-#include <CGAL/Polytope_distance_d.h>
-#include <CGAL/Polytope_distance_d_traits_3.h>
-
-#ifdef CGAL_USE_GMP
-#include <CGAL/Gmpzf.h>
-typedef CGAL::Gmpzf ET;
-#else
-#include <CGAL/MP_Float.h>
-typedef CGAL::MP_Float ET;
-#endif
-
-// use an EXACT kernel...
-typedef CGAL::Homogeneous<ET>                 K;
-typedef K::Point_3                            Point;
-// ...and the traits class based on the exact kernel
-typedef CGAL::Polytope_distance_d_traits_3<K> Traits;
-typedef CGAL::Polytope_distance_d<Traits>     Polytope_distance;
-
-
-int main()
-{
-  // the cube [0,1]^3
-  Point P[8] = { Point(0,0,0), Point(0,0,1), Point(0,1,0), Point(0,1,1),
-                 Point(1,0,0), Point(1,0,1), Point(1,1,0), Point(1,1,1)};
-
-  // the cube [2,3]^3
-  Point Q[8] = { Point(2,2,2), Point(2,2,3), Point(2,3,2), Point(2,3,3),
-                 Point(3,2,2), Point(3,2,3), Point(3,3,2), Point(3,3,3)};
-
-  Polytope_distance pd(P, P+8, Q, Q+8);
-  assert (pd.is_valid());
-
-  // get squared distance (2,2,2)-(1,1,1))^2 = 3
-  std::cout << "Squared distance: " <<
-    CGAL::to_double (pd.squared_distance_numerator()) /
-    CGAL::to_double (pd.squared_distance_denominator()) << std::endl;
-
-  // get points that realize the distance
-  Polytope_distance::Coordinate_iterator  coord_it;
-
-  std::cout << "p:"; // homogeneous point from first cube, (1,1,1,1)
-  for (coord_it = pd.realizing_point_p_coordinates_begin();
-       coord_it != pd.realizing_point_p_coordinates_end();
-       ++coord_it)
-    std::cout << " " << *coord_it;
-  std::cout << std::endl;
-
-  std::cout << "q:"; // homogeneous point from second cube, (2,2,2,1)
-  for (coord_it = pd.realizing_point_q_coordinates_begin();
-       coord_it != pd.realizing_point_q_coordinates_end();
-       ++coord_it)
-    std::cout << " " << *coord_it;
-  std::cout << std::endl;
-
-  return 0;
-
-}
diff --git a/3rdparty/CGAL-4.8/examples/Polytope_distance_d/polytope_distance_d_fast_exact.cpp b/3rdparty/CGAL-4.8/examples/Polytope_distance_d/polytope_distance_d_fast_exact.cpp
deleted file mode 100644
index a6ab432..0000000
--- a/3rdparty/CGAL-4.8/examples/Polytope_distance_d/polytope_distance_d_fast_exact.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-// computes the distance between two cubes in R^3 using double
-// as input type and some internal EXACT floating point type;
-// the fast type double is also safely used for many of the
-// internal computations
-#include <iostream>
-#include <cassert>
-#include <CGAL/Homogeneous.h>
-#include <CGAL/Polytope_distance_d.h>
-#include <CGAL/Polytope_distance_d_traits_3.h>
-
-#ifdef CGAL_USE_GMP
-#include <CGAL/Gmpzf.h>
-typedef CGAL::Gmpzf ET;
-#else
-#include <CGAL/MP_Float.h>
-typedef CGAL::MP_Float ET;
-#endif
-
-// use an inexact kernel...
-typedef CGAL::Homogeneous<double>                         K;
-typedef K::Point_3                                        Point;
-// ... and the EXACT traits class based on the inexcat kernel
-typedef CGAL::Polytope_distance_d_traits_3<K, ET, double> Traits;
-typedef CGAL::Polytope_distance_d<Traits>                 Polytope_distance;
-
-
-int main()
-{
-  // the cube [0,1]^3
-  Point P[8] = { Point(0,0,0), Point(0,0,1), Point(0,1,0), Point(0,1,1),
-                 Point(1,0,0), Point(1,0,1), Point(1,1,0), Point(1,1,1)};
-
-  // the cube [2,3]^3
-  Point Q[8] = { Point(2,2,2), Point(2,2,3), Point(2,3,2), Point(2,3,3),
-                 Point(3,2,2), Point(3,2,3), Point(3,3,2), Point(3,3,3)};
-
-  Polytope_distance pd(P, P+8, Q, Q+8);
-  assert (pd.is_valid());
-
-  // get squared distance (2,2,2)-(1,1,1))^2 = 3
-  std::cout << "Squared distance: " <<
-    CGAL::to_double (pd.squared_distance_numerator()) /
-    CGAL::to_double (pd.squared_distance_denominator()) << std::endl;
-
-  // get points that realize the distance
-  Polytope_distance::Coordinate_iterator  coord_it;
-
-  std::cout << "p:"; // homogeneous point from first cube, (1,1,1,1)
-  for (coord_it = pd.realizing_point_p_coordinates_begin();
-       coord_it != pd.realizing_point_p_coordinates_end();
-       ++coord_it)
-    std::cout << " " << *coord_it;
-  std::cout << std::endl;
-
-  std::cout << "q:"; // homogeneous point from second cube, (2,2,2,1)
-  for (coord_it = pd.realizing_point_q_coordinates_begin();
-       coord_it != pd.realizing_point_q_coordinates_end();
-       ++coord_it)
-    std::cout << " " << *coord_it;
-  std::cout << std::endl;
-
-  return 0;
-
-}
diff --git a/3rdparty/CGAL-4.8/examples/Principal_component_analysis/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Principal_component_analysis/CMakeLists.txt
deleted file mode 100644
index 04ab171..0000000
--- a/3rdparty/CGAL-4.8/examples/Principal_component_analysis/CMakeLists.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Principal_component_analysis_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "barycenter.cpp" )
-  create_single_source_cgal_program( "bounding_box.cpp" )
-  create_single_source_cgal_program( "centroid.cpp" )
-  create_single_source_cgal_program( "linear_least_squares_fitting_points_2.cpp" )
-  create_single_source_cgal_program( "linear_least_squares_fitting_triangles_3.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Profiling_tools/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Profiling_tools/CMakeLists.txt
deleted file mode 100644
index 3c162c7..0000000
--- a/3rdparty/CGAL-4.8/examples/Profiling_tools/CMakeLists.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Profiling_tools_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "Profile_counter.cpp" )
-  create_single_source_cgal_program( "Profile_histogram_counter.cpp" )
-  create_single_source_cgal_program( "Profile_timer.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/QP_solver/CMakeLists.txt
deleted file mode 100644
index 0764ef9..0000000
--- a/3rdparty/CGAL-4.8/examples/QP_solver/CMakeLists.txt
+++ /dev/null
@@ -1,51 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( QP_solver_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "convex_hull_containment.cpp" )
-  create_single_source_cgal_program( "convex_hull_containment2.cpp" )
-  create_single_source_cgal_program( "convex_hull_containment_benchmarks.cpp" )
-  create_single_source_cgal_program( "cycling.cpp" )
-  create_single_source_cgal_program( "first_lp.cpp" )
-  create_single_source_cgal_program( "first_lp_from_iterators.cpp" )
-  create_single_source_cgal_program( "first_lp_from_mps.cpp" )
-  create_single_source_cgal_program( "first_nonnegative_lp.cpp" )
-  create_single_source_cgal_program( "first_nonnegative_lp_from_iterators.cpp" )
-  create_single_source_cgal_program( "first_nonnegative_lp_from_mps.cpp" )
-  create_single_source_cgal_program( "first_nonnegative_qp.cpp" )
-  create_single_source_cgal_program( "first_nonnegative_qp_from_iterators.cpp" )
-  create_single_source_cgal_program( "first_nonnegative_qp_from_mps.cpp" )
-  create_single_source_cgal_program( "first_qp.cpp" )
-  create_single_source_cgal_program( "first_qp_basic_constraints.cpp" )
-  create_single_source_cgal_program( "first_qp_from_iterators.cpp" )
-  create_single_source_cgal_program( "first_qp_from_mps.cpp" )
-  create_single_source_cgal_program( "important_variables.cpp" )
-  create_single_source_cgal_program( "infeasibility_certificate.cpp" )
-  create_single_source_cgal_program( "invert_matrix.cpp" )
-  create_single_source_cgal_program( "optimality_certificate.cpp" )
-  create_single_source_cgal_program( "print_first_lp.cpp" )
-  create_single_source_cgal_program( "print_first_nonnegative_lp.cpp" )
-  create_single_source_cgal_program( "print_first_nonnegative_qp.cpp" )
-  create_single_source_cgal_program( "print_first_qp.cpp" )
-  create_single_source_cgal_program( "unboundedness_certificate.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/STL_Extension/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/STL_Extension/CMakeLists.txt
deleted file mode 100644
index 5501caa..0000000
--- a/3rdparty/CGAL-4.8/examples/STL_Extension/CMakeLists.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( STL_Extension_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "Default.cpp" )
-  create_single_source_cgal_program( "Dispatch_output_iterator.cpp" )
-  create_single_source_cgal_program( "in_place_list_prog.cpp" )
-  create_single_source_cgal_program( "min_element_if_example.cpp" )
-  create_single_source_cgal_program( "min_max_element_example.cpp" )
-  create_single_source_cgal_program( "unordered_map.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Scale_space_reconstruction_3/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Scale_space_reconstruction_3/CMakeLists.txt
deleted file mode 100644
index 392adad..0000000
--- a/3rdparty/CGAL-4.8/examples/Scale_space_reconstruction_3/CMakeLists.txt
+++ /dev/null
@@ -1,40 +0,0 @@
-project( Scale_space )
-
-cmake_minimum_required(VERSION 2.8.11)
-
-find_package( CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-  include( ${CGAL_USE_FILE} )
-
-  # Activate concurrency?
-  option(ACTIVATE_CONCURRENCY
-         "Enable concurrency"
-         ON)
- 
-  if( ACTIVATE_CONCURRENCY )
-    find_package( TBB )
-    if( TBB_FOUND )
-      include( ${TBB_USE_FILE} )
-      list( APPEND CGAL_3RD_PARTY_LIBRARIES ${TBB_LIBRARIES} )
-    else()
-      message( STATUS "NOTICE: Intel TBB NOT found! The example is faster if TBB is linked." )
-    endif()
-  endif()
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  find_package( Eigen3 3.1.0 )
-  if( EIGEN3_FOUND )
-    include( ${EIGEN3_USE_FILE} )
-    create_single_source_cgal_program( "scale_space.cpp" )
-    create_single_source_cgal_program( "scale_space_incremental.cpp" )
-    create_single_source_cgal_program( "scale_space_manifold.cpp" )
-  else()
-    message( STATUS "NOTICE: The example needs Eigen 3.1 (or greater) and will not be compiled." )
-  endif()
-else()
-  
-  message( STATUS "This program requires the CGAL library, and will not be compiled." )
-  
-endif()
diff --git a/3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_2/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_2/CMakeLists.txt
deleted file mode 100644
index 4be5765..0000000
--- a/3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_2/CMakeLists.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Segment_Delaunay_graph_2_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "sdg-count-sites.cpp" )
-  create_single_source_cgal_program( "sdg-fast-sp-polygon.cpp" )
-  create_single_source_cgal_program( "sdg-fast-sp.cpp" )
-  create_single_source_cgal_program( "sdg-filtered-traits.cpp" )
-  create_single_source_cgal_program( "sdg-info-set.cpp" )
-  create_single_source_cgal_program( "sdg-red-blue-info.cpp" )
-  create_single_source_cgal_program( "sdg-voronoi-edges.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_Linf_2/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_Linf_2/CMakeLists.txt
deleted file mode 100644
index 84632aa..0000000
--- a/3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_Linf_2/CMakeLists.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Segment_Delaunay_graph_Linf_2_example )
-
-cmake_minimum_required(VERSION 2.8.11)
-
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "sdg-count-sites-linf.cpp" )
-  create_single_source_cgal_program( "sdg-fast-sp-linf.cpp" )
-  create_single_source_cgal_program( "sdg-fast-sp-polygon-linf.cpp" )
-  create_single_source_cgal_program( "sdg-filtered-traits-linf.cpp" )
-  create_single_source_cgal_program( "sdg-info-set-linf.cpp" )
-  create_single_source_cgal_program( "sdg-red-blue-info-linf.cpp" )
-  create_single_source_cgal_program( "sdg-voronoi-edges-linf.cpp" )
-  create_single_source_cgal_program( "sdg-voronoi-edges-exact-linf.cpp" )
-  create_single_source_cgal_program( "print-sdg-linf.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Snap_rounding_2/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Snap_rounding_2/CMakeLists.txt
deleted file mode 100644
index 1c56168..0000000
--- a/3rdparty/CGAL-4.8/examples/Snap_rounding_2/CMakeLists.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Snap_rounding_2_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "snap_rounding.cpp" )
-  create_single_source_cgal_program( "snap_rounding_data.cpp" )
-  create_single_source_cgal_program( "snap_rounding_to_integer.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Solver_interface/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Solver_interface/CMakeLists.txt
deleted file mode 100644
index be8c1e3..0000000
--- a/3rdparty/CGAL-4.8/examples/Solver_interface/CMakeLists.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( examples_ )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../include")
-  
-  # Use Eigen
-  find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater)
-
-  if (EIGEN3_FOUND)
-    include( ${EIGEN3_USE_FILE} )
-    create_single_source_cgal_program( "singular_value_decomposition.cpp" )
-    create_single_source_cgal_program( "sparse_solvers.cpp" )
-  endif()
-
-  create_single_source_cgal_program( "diagonalize_matrix.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Spatial_searching/searching_with_point_with_info_inplace.cpp b/3rdparty/CGAL-4.8/examples/Spatial_searching/searching_with_point_with_info_inplace.cpp
deleted file mode 100644
index 22ebb98..0000000
--- a/3rdparty/CGAL-4.8/examples/Spatial_searching/searching_with_point_with_info_inplace.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-#include <CGAL/Search_traits_3.h>
-#include <CGAL/Search_traits_adapter.h>
-#include <CGAL/point_generators_3.h>
-#include <CGAL/Orthogonal_k_neighbor_search.h>
-#include <boost/iterator/counting_iterator.hpp>
-#include <utility>
-
-typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
-typedef Kernel::Point_3 Point_3;
-
-typedef std::size_t Point;
-
-//definition of a non-mutable lvalue property map,
-//with the get function as a friend function to give it
-//access to the private member
-class My_point_property_map{
-  const std::vector<Point_3>& points;
-public:
-  typedef Point_3 value_type;
-  typedef const value_type& reference;
-  typedef Point key_type;
-  typedef boost::lvalue_property_map_tag category;  
-
-  My_point_property_map(const std::vector<Point_3>& pts):points(pts){}
-
-  reference operator[](key_type k) const {return points[k];}
-
-  friend reference get(const My_point_property_map& ppmap,key_type i) 
-  {return ppmap[i];}
-};
-
-
-typedef CGAL::Random_points_in_cube_3<Point_3>                               Random_points_iterator;
-typedef CGAL::Search_traits_3<Kernel>                                        Traits_base;
-typedef CGAL::Search_traits_adapter<Point,My_point_property_map,Traits_base> Traits;
-
-
-typedef CGAL::Orthogonal_k_neighbor_search<Traits>                      K_neighbor_search;
-typedef K_neighbor_search::Tree                                         Tree;
-typedef Tree::Splitter                                                  Splitter;
-typedef K_neighbor_search::Distance                                     Distance;
-
-int main() {
-  const unsigned int K = 5;
-  // generator for random data points in the cube ( (-1,-1,-1), (1,1,1) )
-  Random_points_iterator rpit( 1.0);
-  std::vector<Point_3> points;
-  
-  points.push_back(Point_3(*rpit++));
-  points.push_back(Point_3(*rpit++));
-  points.push_back(Point_3(*rpit++));
-  points.push_back(Point_3(*rpit++));
-  points.push_back(Point_3(*rpit++));
-  points.push_back(Point_3(*rpit++));
-  points.push_back(Point_3(*rpit++));
-
-  My_point_property_map ppmap(points);
-
-  // Insert number_of_data_points in the tree
-  Tree tree(
-    boost::counting_iterator<std::size_t>(0),
-    boost::counting_iterator<std::size_t>(points.size()),
-    Splitter(),
-    Traits(ppmap)
-  );
-  Point_3 query(0.0, 0.0, 0.0);
-  Distance tr_dist(ppmap);
-
-  // search K nearest neighbours
-  K_neighbor_search search(tree, query, K,0,true,tr_dist);
-  for(K_neighbor_search::iterator it = search.begin(); it != search.end(); it++){
-    std::cout << " d(q, nearest neighbor)=  "
-	      << tr_dist.inverse_of_transformed_distance(it->second) << " " 
-              << points[it->first] << " " << it->first << std::endl;
-  }
-  return 0;
-}
diff --git a/3rdparty/CGAL-4.8/examples/Spatial_searching/searching_with_point_with_info_pmap.cpp b/3rdparty/CGAL-4.8/examples/Spatial_searching/searching_with_point_with_info_pmap.cpp
deleted file mode 100644
index 32a9654..0000000
--- a/3rdparty/CGAL-4.8/examples/Spatial_searching/searching_with_point_with_info_pmap.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-#include <CGAL/Search_traits_3.h>
-#include <CGAL/Search_traits_adapter.h>
-#include <CGAL/point_generators_3.h>
-#include <CGAL/Orthogonal_k_neighbor_search.h>
-#include <boost/iterator/counting_iterator.hpp>
-#include <utility>
-
-typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
-typedef Kernel::Point_3 Point_3;
-
-typedef std::size_t Point;
-
-typedef boost::const_associative_property_map<std::map<Point,Point_3> >                 My_point_property_map;
-  
-typedef CGAL::Random_points_in_cube_3<Point_3>                                          Random_points_iterator;
-typedef CGAL::Search_traits_3<Kernel>                                                   Traits_base;
-typedef CGAL::Search_traits_adapter<Point,My_point_property_map,Traits_base>            Traits;
-
-
-typedef CGAL::Orthogonal_k_neighbor_search<Traits>                      K_neighbor_search;
-typedef K_neighbor_search::Tree                                         Tree;
-typedef Tree::Splitter                                                  Splitter;
-typedef K_neighbor_search::Distance                                     Distance;
-
-int main() {
-  const unsigned int K = 5;
-  // generator for random data points in the cube ( (-1,-1,-1), (1,1,1) )
-  Random_points_iterator rpit( 1.0);
-  std::map<Point,Point_3> points;
-  
-  points[0]=Point_3(*rpit++);
-  points[1]=Point_3(*rpit++);
-  points[2]=Point_3(*rpit++);
-  points[3]=Point_3(*rpit++);
-  points[4]=Point_3(*rpit++);
-  points[5]=Point_3(*rpit++);
-  points[6]=Point_3(*rpit++);
-
-  My_point_property_map ppmap(points);
-
-  // Insert number_of_data_points in the tree
-  Tree tree(
-    boost::counting_iterator<std::size_t>(0),
-    boost::counting_iterator<std::size_t>(points.size()),
-    Splitter(),
-    Traits(ppmap)
-  );
-  Point_3 query(0.0, 0.0, 0.0);
-  Distance tr_dist(ppmap);
-
-  // search K nearest neighbours
-  K_neighbor_search search(tree, query, K,0,true,tr_dist);
-  for(K_neighbor_search::iterator it = search.begin(); it != search.end(); it++){
-    std::cout << " d(q, nearest neighbor)=  "
-	      << tr_dist.inverse_of_transformed_distance(it->second) << " "
-              << points[it->first] << " " << it->first << std::endl;
-  }
-  return 0;
-}
diff --git a/3rdparty/CGAL-4.8/examples/Spatial_sorting/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Spatial_sorting/CMakeLists.txt
deleted file mode 100644
index b928eb1..0000000
--- a/3rdparty/CGAL-4.8/examples/Spatial_sorting/CMakeLists.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Spatial_sorting_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "example_delaunay_2.cpp" )
-  create_single_source_cgal_program( "hilbert.cpp" )
-  create_single_source_cgal_program( "hilbert_policies.cpp" )
-  create_single_source_cgal_program( "hilbert_sort_on_sphere.cpp" )
-  create_single_source_cgal_program( "myPoint.cpp" )
-  create_single_source_cgal_program( "small_example_delaunay_2.cpp" )
-  create_single_source_cgal_program( "sort_indices.cpp" )
-  create_single_source_cgal_program( "sp_sort_using_property_map_2.cpp" )
-  create_single_source_cgal_program( "sp_sort_using_property_map_3.cpp" )
-  create_single_source_cgal_program( "sp_sort_using_property_map_d.cpp" )
-  create_single_source_cgal_program( "spatial_sort_on_sphere.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Spatial_sorting/sp_sort_using_property_map_3.cpp b/3rdparty/CGAL-4.8/examples/Spatial_sorting/sp_sort_using_property_map_3.cpp
deleted file mode 100644
index ab48fea..0000000
--- a/3rdparty/CGAL-4.8/examples/Spatial_sorting/sp_sort_using_property_map_3.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-#include <CGAL/Simple_cartesian.h>
-#include <CGAL/spatial_sort.h>
-#include <CGAL/Spatial_sort_traits_adapter_3.h>
-#include <vector>
-#include <boost/iterator/counting_iterator.hpp>
-
-typedef CGAL::Simple_cartesian<double>                  Kernel;
-typedef Kernel::Point_3                                 Point_3;
-//using a pointer as a special property map type
-typedef 
-  CGAL::Spatial_sort_traits_adapter_3<Kernel,Point_3*>  Search_traits_3;
-
-int main()
-{
-  std::vector<Point_3> points;
-  points.push_back(Point_3(1,3,11));
-  points.push_back(Point_3(14,34,46));
-  points.push_back(Point_3(414,34,4));
-  points.push_back(Point_3(4,2,56));
-  points.push_back(Point_3(744,4154,43));
-  points.push_back(Point_3(74,44,1));
-  
-  std::vector<std::ptrdiff_t> indices;
-  indices.reserve(points.size());
-  
-  std::copy(boost::counting_iterator<std::ptrdiff_t>(0),
-            boost::counting_iterator<std::ptrdiff_t>(points.size()),
-            std::back_inserter(indices));
-  
-  CGAL::spatial_sort( indices.begin(),indices.end(),Search_traits_3(&(points[0])) );
-
-  for (std::vector<std::ptrdiff_t>::iterator it=indices.begin();it!=indices.end();++it)
-    std::cout << points[*it] << "\n";
-
-  std::cout << "done" << std::endl;
-  
-  return 0;
-}
diff --git a/3rdparty/CGAL-4.8/examples/Straight_skeleton_2/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Straight_skeleton_2/CMakeLists.txt
deleted file mode 100644
index 454e393..0000000
--- a/3rdparty/CGAL-4.8/examples/Straight_skeleton_2/CMakeLists.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Straight_skeleton_2_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "Create_offset_polygons_2.cpp" )
-  create_single_source_cgal_program( "Create_saop_from_polygon_with_holes_2.cpp" )
-  create_single_source_cgal_program( "Create_skeleton_and_offset_polygons_2.cpp" )
-  create_single_source_cgal_program( "Create_skeleton_and_offset_polygons_with_holes_2.cpp" )
-  create_single_source_cgal_program( "Create_straight_skeleton_2.cpp" )
-  create_single_source_cgal_program( "Create_straight_skeleton_from_polygon_with_holes_2.cpp" )
-  create_single_source_cgal_program( "Low_level_API.cpp" )
-  create_single_source_cgal_program( "Show_offset_polygon.cpp" )
-  create_single_source_cgal_program( "Show_straight_skeleton.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Stream_lines_2/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Stream_lines_2/CMakeLists.txt
deleted file mode 100644
index 66a4245..0000000
--- a/3rdparty/CGAL-4.8/examples/Stream_lines_2/CMakeLists.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Stream_lines_2_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "stl_regular_field.cpp" )
-  create_single_source_cgal_program( "stl_triangular_field.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Subdivision_method_3/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Subdivision_method_3/CMakeLists.txt
deleted file mode 100644
index 63f68f4..0000000
--- a/3rdparty/CGAL-4.8/examples/Subdivision_method_3/CMakeLists.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Subdivision_method_3_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "CatmullClark_subdivision.cpp" )
-  create_single_source_cgal_program( "Customized_subdivision.cpp" )
-  create_single_source_cgal_program( "DooSabin_subdivision.cpp" )
-  create_single_source_cgal_program( "Loop_subdivision.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Surface_mesh/CMakeLists.txt
deleted file mode 100644
index d8b3eea..0000000
--- a/3rdparty/CGAL-4.8/examples/Surface_mesh/CMakeLists.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Surface_mesh_ )
-
-cmake_minimum_required(VERSION 2.8.11)
-
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "sm_join.cpp" )
-  create_single_source_cgal_program( "sm_aabbtree.cpp" )
-  create_single_source_cgal_program( "sm_bgl.cpp" )
-  create_single_source_cgal_program( "sm_circulators.cpp" )
-  create_single_source_cgal_program( "sm_do_intersect.cpp" )
-  create_single_source_cgal_program( "sm_iterators.cpp" )
-  create_single_source_cgal_program( "sm_kruskal.cpp" )
-  create_single_source_cgal_program( "sm_memory.cpp" )
-  create_single_source_cgal_program( "sm_properties.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh/sm_properties.cpp b/3rdparty/CGAL-4.8/examples/Surface_mesh/sm_properties.cpp
deleted file mode 100644
index 0fb9585..0000000
--- a/3rdparty/CGAL-4.8/examples/Surface_mesh/sm_properties.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-#include <string>
-
-#include <CGAL/Simple_cartesian.h>
-#include <CGAL/Surface_mesh.h>
-
-#include <boost/foreach.hpp>
-
-typedef CGAL::Simple_cartesian<double> K;
-typedef CGAL::Surface_mesh<K::Point_3> Mesh;
-typedef Mesh::Vertex_index vertex_descriptor;
-typedef Mesh::Face_index face_descriptor;
-
-int main()
-{
-
-  Mesh m;
-  vertex_descriptor v0 = m.add_vertex(K::Point_3(0,2,0));
-  vertex_descriptor v1 = m.add_vertex(K::Point_3(2,2,0));
-  vertex_descriptor v2 = m.add_vertex(K::Point_3(0,0,0));
-  vertex_descriptor v3 = m.add_vertex(K::Point_3(2,0,0));
-  vertex_descriptor v4 = m.add_vertex(K::Point_3(1,1,0));
-  m.add_face(v3, v1, v4);
-  m.add_face(v0, v4, v1);
-  m.add_face(v0, v2, v4);
-  m.add_face(v2, v3, v4);
-
-
-  // give each vertex a name, the default is empty
-  Mesh::Property_map<vertex_descriptor,std::string> name;
-  bool created;
-  boost::tie(name, created) = m.add_property_map<vertex_descriptor,std::string>("v:name","");
-  assert(created);
-  // add some names to the vertices
-  name[v0] = "hello";
-  name[v2] = "world";
-
-  {
-    // You get an existing property, and created will be false
-    Mesh::Property_map<vertex_descriptor,std::string> name;
-    bool created;
-    boost::tie(name, created) = m.add_property_map<vertex_descriptor,std::string>("v:name", "");
-    assert(! created);
-  }
-
-  //  You can't get a property that does not exist
-  Mesh::Property_map<face_descriptor,std::string> gnus;
-  bool found;
-  boost::tie(gnus, found) = m.property_map<face_descriptor,std::string>("v:gnus");
-  assert(! found);
-
-  // retrieve the point property for which exists a convenience function
-  Mesh::Property_map<vertex_descriptor, K::Point_3> location = m.points();
-  BOOST_FOREACH( vertex_descriptor vd, m.vertices()) { 
-    std::cout << name[vd] << " @ " << location[vd] << std::endl;
-  }
-  
-  // delete the string property again
-  m.remove_property_map(name);
-
-  return 0;
-}
-
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_deformation/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Surface_mesh_deformation/CMakeLists.txt
deleted file mode 100644
index 62e7605..0000000
--- a/3rdparty/CGAL-4.8/examples/Surface_mesh_deformation/CMakeLists.txt
+++ /dev/null
@@ -1,48 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Surface_mesh_deformation_ )
-
-cmake_minimum_required(VERSION 2.8.11)
-
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  find_package(Eigen3 3.1.91) #(requires 3.2.0 or greater)
-  if (EIGEN3_FOUND)
-    include( ${EIGEN3_USE_FILE} )
-    include( CGAL_CreateSingleSourceCGALProgram )
-
-    include_directories (BEFORE "../../include")
-
-    create_single_source_cgal_program( "all_roi_assign_example.cpp" )
-    create_single_source_cgal_program( "all_roi_assign_example_custom_polyhedron.cpp" )
-    create_single_source_cgal_program( "all_roi_assign_example_Surface_mesh.cpp" )
-    create_single_source_cgal_program( "custom_weight_for_edges_example.cpp" )
-    create_single_source_cgal_program( "deform_polyhedron_with_custom_pmap_example.cpp" )
-    create_single_source_cgal_program( "k_ring_roi_translate_rotate_example.cpp" )
-    create_single_source_cgal_program( "k_ring_roi_translate_rotate_Surface_mesh.cpp" )
-
-    find_package( OpenMesh QUIET )
-    if ( OpenMesh_FOUND )
-    include( UseOpenMesh )
-      create_single_source_cgal_program( "all_roi_assign_example_with_OpenMesh.cpp" )
-      target_link_libraries( all_roi_assign_example_with_OpenMesh ${OPENMESH_LIBRARIES} )
-    else()
-      message(STATUS "Example that use OpenMesh will not be compiled.")
-    endif()
-
-  else()
-    message(STATUS "NOTICE: These examples require the Eigen library, version 3.2 or later and will not be compiled.")
-  endif()
-else()
-  
-    message(STATUS "NOTICE: These exmaples require the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/CMakeLists.txt
deleted file mode 100644
index 59271e5..0000000
--- a/3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/CMakeLists.txt
+++ /dev/null
@@ -1,75 +0,0 @@
-# This is the CMake script for compiling this folder.
-
-
-project( Surface_mesh_parameterization_example )
-
-cmake_minimum_required(VERSION 2.8.11)
-
-
-# Include this package's headers first
-include_directories (BEFORE . include ../../include)
-
-# Find CGAL
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  # VisualC++ optimization for applications dealing with large data
-  if (MSVC)
-    # Use /FR to turn on IntelliSense
-    SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /FR")
-
-    # Allow Windows applications to use up to 3GB of RAM
-    SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
-
-    # Turn off stupid VC++ warnings
-    SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267 /wd4311 /wd4800 /wd4503 /wd4244 /wd4345 /wd4996 /wd4396 /wd4018")
-    
-    # Print new compilation options
-    message( STATUS "USING DEBUG CXXFLAGS   = '${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}'" )
-    message( STATUS "USING DEBUG EXEFLAGS   = '${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_DEBUG}'" )
-    message( STATUS "USING RELEASE CXXFLAGS = '${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}'" )
-    message( STATUS "USING RELEASE EXEFLAGS = '${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_RELEASE}'" )
-  endif()
-
-
-  # Link with Boost.ProgramOptions (optional)
-  find_package(Boost QUIET COMPONENTS program_options)
-  if(Boost_PROGRAM_OPTIONS_FOUND)
-    if( CGAL_AUTO_LINK_ENABLED )
-      message( STATUS "Boost.ProgramOptions library: found" )
-    else()
-      message( STATUS "Boost.ProgramOptions library: ${Boost_PROGRAM_OPTIONS_LIBRARY}" )
-    endif()
-    add_definitions( "-DCGAL_USE_BOOST_PROGRAM_OPTIONS" )
-    list(APPEND CGAL_3RD_PARTY_LIBRARIES ${Boost_PROGRAM_OPTIONS_LIBRARY})
- endif()
-
- 
-  find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater)
- 
-  if (EIGEN3_FOUND)
-    # Executables that require Eigen 3.1
-    include( ${EIGEN3_USE_FILE} ) 
-  create_single_source_cgal_program( "Authalic_parameterization.cpp" )
-  create_single_source_cgal_program( "Mesh_cutting_parameterization.cpp" )
-  create_single_source_cgal_program( "Simple_parameterization.cpp" )
-  create_single_source_cgal_program( "Square_border_parameterization.cpp" )
-
-    create_single_source_cgal_program( "Complete_parameterization_example.cpp" )
-
-  create_single_source_cgal_program( "polyhedron_ex_parameterization.cpp" )
-
-  else(EIGEN3_FOUND)
-    message(STATUS "NOTICE: Some examples require Eigen 3.1 (or greater) and will not be compiled.")  
-  endif(EIGEN3_FOUND)
-
-else()
-
-  message(STATUS "NOTICE: This program requires the CGAL library, and will not be compiled.")
-
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_shortest_path/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Surface_mesh_shortest_path/CMakeLists.txt
deleted file mode 100644
index ff2cb11..0000000
--- a/3rdparty/CGAL-4.8/examples/Surface_mesh_shortest_path/CMakeLists.txt
+++ /dev/null
@@ -1,38 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Surface_mesh_shortest_path_ )
-
-cmake_minimum_required(VERSION 2.8.11)
-
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "shortest_path_sequence.cpp" )
-  create_single_source_cgal_program( "shortest_paths_multiple_sources.cpp" )
-  create_single_source_cgal_program( "shortest_paths_no_id.cpp" )
-  create_single_source_cgal_program( "shortest_paths_with_id.cpp" )
-  
-  find_package( OpenMesh QUIET )
-  if ( OpenMesh_FOUND )
-    include( UseOpenMesh )
-    create_single_source_cgal_program( "shortest_paths_OpenMesh.cpp" )
-    target_link_libraries( shortest_paths_OpenMesh ${OPENMESH_LIBRARIES} )
-  else()
-    message(STATUS "Examples that use OpenMesh will not be compiled.")
-  endif()
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_skeletonization/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Surface_mesh_skeletonization/CMakeLists.txt
deleted file mode 100644
index b27bc6a..0000000
--- a/3rdparty/CGAL-4.8/examples/Surface_mesh_skeletonization/CMakeLists.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Surface_mesh_skeletonization_ )
-
-cmake_minimum_required(VERSION 2.8.11)
-
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  find_package(Eigen3 3.2.0) #(requires 3.2.0 or greater)
-
-  if(EIGEN3_FOUND)
-    include( ${EIGEN3_USE_FILE} )
-
-    include( CGAL_CreateSingleSourceCGALProgram )
-
-    include_directories (BEFORE "../../include")
-
-    create_single_source_cgal_program( "simple_mcfskel_example.cpp" )
-    create_single_source_cgal_program( "simple_mcfskel_sm_example.cpp" )
-    create_single_source_cgal_program( "MCF_Skeleton_example.cpp" )
-    create_single_source_cgal_program( "MCF_Skeleton_sm_example.cpp" )
-    create_single_source_cgal_program( "segmentation_example.cpp" )
-  else()
-    message(STATUS "These programs require the Eigen library (3.2 or greater), and will not be compiled.")
-  endif()
-
-else()
-
-  message(STATUS "This program requires the CGAL library, and will not be compiled.")
-
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/TDS_3/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/TDS_3/CMakeLists.txt
deleted file mode 100644
index 618ccfb..0000000
--- a/3rdparty/CGAL-4.8/examples/TDS_3/CMakeLists.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( TDS_3_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "linking_2d_and_3d.cpp" )
-  create_single_source_cgal_program( "tds.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Triangulation/CMakeLists.txt
deleted file mode 100644
index a11f3ea..0000000
--- a/3rdparty/CGAL-4.8/examples/Triangulation/CMakeLists.txt
+++ /dev/null
@@ -1,38 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Triangulation_example )
-
-cmake_minimum_required(VERSION 2.8.11)
-
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-  
-  find_package(Eigen3 3.1.0) 
-  if (EIGEN3_FOUND) 
-    include( ${EIGEN3_USE_FILE} ) 
-    include_directories (BEFORE "../../include")
-
-    create_single_source_cgal_program( "barycentric_subdivision.cpp" )
-    create_single_source_cgal_program( "delaunay_triangulation.cpp" )
-    create_single_source_cgal_program( "triangulation.cpp" )
-    create_single_source_cgal_program( "triangulation_data_structure_dynamic.cpp" )
-    create_single_source_cgal_program( "triangulation_data_structure_static.cpp" )
-
-  else()
-    message(STATUS "NOTICE: Some of the executables in this directory need Eigen 3.1 (or greater) and will not be compiled.")
-  endif()
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_2/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Triangulation_2/CMakeLists.txt
deleted file mode 100644
index 8a225d5..0000000
--- a/3rdparty/CGAL-4.8/examples/Triangulation_2/CMakeLists.txt
+++ /dev/null
@@ -1,43 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Triangulation_2_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "adding_handles.cpp" )
-  create_single_source_cgal_program( "colored_face.cpp" )
-  create_single_source_cgal_program( "constrained.cpp" )
-  create_single_source_cgal_program( "constrained_hierarchy_plus.cpp" )
-  create_single_source_cgal_program( "constrained_plus.cpp" )
-  create_single_source_cgal_program( "copy_triangulation_2.cpp" )
-  create_single_source_cgal_program( "hierarchy.cpp" )
-  create_single_source_cgal_program( "info_insert_with_pair_iterator_2.cpp" )
-  create_single_source_cgal_program( "info_insert_with_pair_iterator_regular_2.cpp" )
-  create_single_source_cgal_program( "info_insert_with_transform_iterator_2.cpp" )
-  create_single_source_cgal_program( "info_insert_with_zip_iterator_2.cpp" )
-  create_single_source_cgal_program( "polygon_triangulation.cpp" )
-  create_single_source_cgal_program( "polylines_triangulation.cpp" )
-  create_single_source_cgal_program( "print_cropped_voronoi.cpp" )
-  create_single_source_cgal_program( "regular.cpp" )
-  create_single_source_cgal_program( "terrain.cpp" )
-  create_single_source_cgal_program( "triangulation_prog1.cpp" )
-  create_single_source_cgal_program( "voronoi.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_2/constrained.cpp b/3rdparty/CGAL-4.8/examples/Triangulation_2/constrained.cpp
deleted file mode 100644
index 5c5f123..0000000
--- a/3rdparty/CGAL-4.8/examples/Triangulation_2/constrained.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-#include <CGAL/Constrained_Delaunay_triangulation_2.h>
-
-#include <cassert>
-#include <iostream>
-
-typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
-
-typedef CGAL::Triangulation_vertex_base_2<K>                     Vb;
-typedef CGAL::Constrained_triangulation_face_base_2<K>           Fb;
-typedef CGAL::Triangulation_data_structure_2<Vb,Fb>              TDS;
-typedef CGAL::Exact_predicates_tag                               Itag;
-typedef CGAL::Constrained_Delaunay_triangulation_2<K, TDS, Itag> CDT;
-typedef CDT::Point          Point;
-
-int
-main( )
-{
-  CDT cdt;
-  std::cout << "Inserting a grid of 5x5 constraints " << std::endl;
-  for (int i = 1; i < 6; ++i)
-    cdt.insert_constraint( Point(0,i), Point(6,i));
-  for (int j = 1; j < 6; ++j)
-    cdt.insert_constraint( Point(j,0), Point(j,6));
-
-  assert(cdt.is_valid());
-  int count = 0;
-  for (CDT::Finite_edges_iterator eit = cdt.finite_edges_begin();
-       eit != cdt.finite_edges_end();
-       ++eit)
-    if (cdt.is_constrained(*eit)) ++count;
-  std::cout << "The number of resulting constrained edges is  ";
-  std::cout <<  count << std::endl;
-  return 0;
-}
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_2/constrained_plus.cpp b/3rdparty/CGAL-4.8/examples/Triangulation_2/constrained_plus.cpp
deleted file mode 100644
index 5586921..0000000
--- a/3rdparty/CGAL-4.8/examples/Triangulation_2/constrained_plus.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
-#include <CGAL/intersections.h>
-#include <CGAL/Constrained_Delaunay_triangulation_2.h>
-#include <CGAL/Constrained_triangulation_plus_2.h>
-
-#include <cassert>
-#include <iostream>
-
-typedef CGAL::Exact_predicates_exact_constructions_kernel K;
-
-typedef CGAL::Triangulation_vertex_base_2<K>              Vb;
-typedef CGAL::Constrained_triangulation_face_base_2<K>    Fb;
-typedef CGAL::Triangulation_data_structure_2<Vb,Fb>       TDS;
-typedef CGAL::Exact_intersections_tag                     Itag;
-typedef CGAL::Constrained_Delaunay_triangulation_2<K,TDS,Itag> CDT;
-typedef CGAL::Constrained_triangulation_plus_2<CDT>       CDTplus;
-typedef CDTplus::Point                                    Point;
-
-int
-main( )
-{
-  CDTplus cdt;
-  std::cout  << "Inserting a grid 5 x 5 of constraints " << std::endl;
-  for (int i = 1; i < 6; ++i)
-    cdt.insert_constraint( Point(0,i), Point(6,i));
-  for (int j = 1; j < 6; ++j)
-    cdt.insert_constraint( Point(j,0), Point(j,6));
-
-  assert(cdt.is_valid());
-  int count = 0;
-  for (CDTplus::Subconstraint_iterator scit = cdt.subconstraints_begin();
-       scit != cdt.subconstraints_end();
-       ++scit)  ++count;
-  std::cout << "The number of resulting constrained edges is  "
-	    <<  count << std::endl;
-  return 0;
-}
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_2/polylines_triangulation.cpp b/3rdparty/CGAL-4.8/examples/Triangulation_2/polylines_triangulation.cpp
deleted file mode 100644
index d68bf28..0000000
--- a/3rdparty/CGAL-4.8/examples/Triangulation_2/polylines_triangulation.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
-#include <CGAL/Polygon_2.h>
-#include <CGAL/Constrained_Delaunay_triangulation_2.h>
-#include <CGAL/Constrained_triangulation_plus_2.h>
-
-#include <vector>
-
-typedef CGAL::Exact_predicates_exact_constructions_kernel        K;
-typedef CGAL::Polygon_2<K>                                       Polygon_2;
-typedef CGAL::Triangulation_vertex_base_2<K>                     Vb;
-typedef CGAL::Constrained_triangulation_face_base_2<K>           Fb;
-typedef CGAL::Triangulation_data_structure_2<Vb,Fb>              TDS;
-typedef CGAL::Exact_intersections_tag                            Itag;
-typedef CGAL::Constrained_Delaunay_triangulation_2<K,TDS, Itag>  CDT;
-typedef CGAL::Constrained_triangulation_plus_2<CDT>              CDTP;
-
-typedef CDTP::Point                                              Point;
-typedef CDTP::Constraint_id                                      Cid;
-typedef CDTP::Vertex_handle                                      Vertex_handle;
-
-void 
-print(const CDTP& cdtp, Cid cid)
-{
-  typedef CDTP::Vertices_in_constraint Vertices_in_constraint;
-
-  std::cout << "Polyline constraint:" << std::endl;
-  for(Vertices_in_constraint it = cdtp.vertices_in_constraint_begin(cid);
-      it !=cdtp.vertices_in_constraint_end(cid);
-      it++){
-    Vertex_handle vh = *it;
-    std::cout << vh->point() << std::endl;
-  }
-}
-
-
-void 
-contexts(const CDTP& cdtp)
-{
-  CDTP::Subconstraint_iterator
-    beg = cdtp.subconstraints_begin(),
-    end = cdtp.subconstraints_end();
-
-  for(; beg!=end; ++beg){
-    Vertex_handle vp = beg->first.first, vq = beg->first.second;
-
-    if(cdtp.number_of_enclosing_constraints(vp, vq) == 2){
-      CDTP::Context_iterator cbeg = cdtp.contexts_begin(vp,vq),
-        cend = cdtp.contexts_end(vp,vq);
-      std::cout << "subconstraint " << vp->point() << " " << vq->point() 
-                << " is on constraints starting at:\n";
-      for(; cbeg !=  cend; ++cbeg){
-        CDTP::Context c = *cbeg;
-        std::cout << (*(c.vertices_begin()))->point() << std::endl;
-      }
-    }
-  }
-}
-
-int
-main( )
-{
-  CDTP cdtp;
-
-  cdtp.insert_constraint(Point(0,0), Point(1,1));
-
-  std::vector<Point> points;
-  points.push_back(Point(1,1));
-  points.push_back(Point(5,2));
-  points.push_back(Point(6,0));
-  points.push_back(Point(3,0));
-  Cid id1 = cdtp.insert_constraint(points.begin(), points.end());
-
-  print(cdtp, id1);
-
-  Polygon_2 poly;
-  poly.push_back(Point(2,3));
-  poly.push_back(Point(4,0));
-  poly.push_back(Point(5,0));
-  poly.push_back(Point(6,2));
-
-  Cid id2 = cdtp.insert_constraint(poly.vertices_begin(), poly.vertices_end(), true);
-
-  print(cdtp, id1);
-  print(cdtp, id2);
-
-  contexts(cdtp);
-
-  return 0;
-}
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_3/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Triangulation_3/CMakeLists.txt
deleted file mode 100644
index 8f33ffa..0000000
--- a/3rdparty/CGAL-4.8/examples/Triangulation_3/CMakeLists.txt
+++ /dev/null
@@ -1,48 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Triangulation_3_example )
-
-cmake_minimum_required(VERSION 2.8.11)
-
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-  
-  find_package( TBB QUIET )
-
-  if( TBB_FOUND )
-    include(${TBB_USE_FILE})
-    list(APPEND CGAL_3RD_PARTY_LIBRARIES ${TBB_LIBRARIES})
-  endif()
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "adding_handles_3.cpp" )
-  create_single_source_cgal_program( "color.cpp" )
-  create_single_source_cgal_program( "copy_triangulation_3.cpp" )
-  create_single_source_cgal_program( "fast_location_3.cpp" )
-  create_single_source_cgal_program( "find_conflicts_3.cpp" )
-  create_single_source_cgal_program( "info_insert_with_pair_iterator.cpp" )
-  create_single_source_cgal_program( "info_insert_with_pair_iterator_regular.cpp" )
-  create_single_source_cgal_program( "info_insert_with_transform_iterator.cpp" )
-  create_single_source_cgal_program( "info_insert_with_zip_iterator.cpp" )
-  create_single_source_cgal_program( "parallel_insertion_and_removal_in_regular_3.cpp" )
-  create_single_source_cgal_program( "parallel_insertion_in_delaunay_3.cpp" )
-  create_single_source_cgal_program( "regular_3.cpp" )
-  create_single_source_cgal_program( "sequential_parallel.cpp" )
-  create_single_source_cgal_program( "simple_triangulation_3.cpp" )
-  create_single_source_cgal_program( "simplex.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Visibility_2/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Visibility_2/CMakeLists.txt
deleted file mode 100644
index 7625f49..0000000
--- a/3rdparty/CGAL-4.8/examples/Visibility_2/CMakeLists.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Visibility_2_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "general_polygon_example.cpp" )
-  create_single_source_cgal_program( "simple_polygon_visibility_2.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/examples/Voronoi_diagram_2/CMakeLists.txt b/3rdparty/CGAL-4.8/examples/Voronoi_diagram_2/CMakeLists.txt
deleted file mode 100644
index 7658da0..0000000
--- a/3rdparty/CGAL-4.8/examples/Voronoi_diagram_2/CMakeLists.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-# Created by the script cgal_create_cmake_script
-# This is the CMake script for compiling a CGAL application.
-
-
-project( Voronoi_diagram_2_example )
-
-cmake_minimum_required(VERSION 2.8.10)
-
-find_package(CGAL QUIET COMPONENTS Core )
-
-if ( CGAL_FOUND )
-
-  include( ${CGAL_USE_FILE} )
-
-  include( CGAL_CreateSingleSourceCGALProgram )
-
-  include_directories (BEFORE "../../include")
-
-  create_single_source_cgal_program( "vd_2_point_location.cpp" )
-  create_single_source_cgal_program( "vd_2_point_location_sdg_linf.cpp" )
-
-else()
-  
-    message(STATUS "This program requires the CGAL library, and will not be compiled.")
-  
-endif()
-
diff --git a/3rdparty/CGAL-4.8/include/CGAL/AABB_face_graph_triangle_primitive.h b/3rdparty/CGAL-4.8/include/CGAL/AABB_face_graph_triangle_primitive.h
deleted file mode 100644
index 4ffe06c..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/AABB_face_graph_triangle_primitive.h
+++ /dev/null
@@ -1,178 +0,0 @@
-// Copyright (c) 2012 INRIA Sophia-Antipolis (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
-// 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(s)     : Sebastien Loriot
-//
-
-#ifndef CGAL_AABB_FACE_GRAPH_TRIANGLE_PRIMITIVE_H
-#define CGAL_AABB_FACE_GRAPH_TRIANGLE_PRIMITIVE_H
-
-#include <CGAL/AABB_primitive.h>
-#include <CGAL/internal/AABB_tree/Halfedge_and_face_graph_property_maps.h>
-#include <CGAL/Default.h>
-
-namespace CGAL {
-
-/*!
- * \ingroup PkgAABB_tree
- * Primitive type for a facet of a polyhedral surface.
- * It wraps a handle to a facet of a polyhedron to a 3D triangle.
- * The polyhedron from which the primitive is built should not be deleted
- * while the AABB tree holding the primitive is in use.
- *
- * \cgalModels `AABBPrimitiveWithSharedData`
- *
- *\tparam FaceGraph is a model of the face graph concept.
- *\tparam VertexPointPMap  is a property map with `boost::graph_traits<FaceGraph>::%vertex_descriptor`
- *   as key type and a \cgal Kernel `Point_3` as value type.
- *                         The default is `typename boost::property_map< FaceGraph,vertex_point_t>::%type`.
- *\tparam OneFaceGraphPerTree is either `CGAL::Tag_true` or `CGAL::Tag_false`.
- * In the former case, we guarantee that all the primitives will be from a
- * common polyhedron and some data will be factorized so that the size of
- * the primitive is reduced. In the latter case, the primitives can be from
- * different polyhedra and extra storage is required in the primitives. The default is `CGAL::Tag_true`.
- *        This parameter is useless for the moment and will be useful in an upcoming release of \cgal.
- *\tparam CacheDatum is either `CGAL::Tag_true` or `CGAL::Tag_false`. In the former case, the datum is stored
- *        in the primitive, while in the latter it is constructed on the fly to reduce the memory footprint.
- *        The default is `CGAL::Tag_false` (datum is not stored).
- *\sa `AABBPrimitive`
- *\sa `AABB_primitive<Id,ObjectPropertyMap,PointPropertyMapPolyhedron,ExternalPropertyMaps,CacheDatum>`
- *\sa `AABB_halfedge_graph_segment_primitive<HalfedgeGraph,OneHalfedgeGraphPerTree,CacheDatum>`
- */
-template < class FaceGraph,
-           class VertexPointPMap = Default,
-           class OneFaceGraphPerTree = Tag_true,
-           class CacheDatum=Tag_false >
-class AABB_face_graph_triangle_primitive
-#ifndef DOXYGEN_RUNNING
-  : public AABB_primitive<typename boost::graph_traits<FaceGraph>::face_descriptor,
-                        Triangle_from_face_descriptor_property_map<
-                          FaceGraph,
-                          typename Default::Get<VertexPointPMap,
-                                                typename boost::property_map< FaceGraph,
-                                                                              vertex_point_t>::type >::type>,
-                        One_point_from_face_descriptor_property_map<
-                          FaceGraph,
-                          typename Default::Get<VertexPointPMap,
-                                                typename boost::property_map< FaceGraph,
-                                                                              vertex_point_t>::type >::type>,
-                        OneFaceGraphPerTree,
-                        CacheDatum >
-#endif
-{
-  typedef typename Default::Get<VertexPointPMap, typename boost::property_map< FaceGraph, vertex_point_t>::type >::type VertexPointPMap_;
-
-  typedef typename boost::graph_traits<FaceGraph>::face_descriptor Id_;
-  typedef Triangle_from_face_descriptor_property_map<FaceGraph,VertexPointPMap_>  Triangle_property_map;
-  typedef One_point_from_face_descriptor_property_map<FaceGraph,VertexPointPMap_> Point_property_map;
-
-  typedef AABB_primitive< Id_,
-                          Triangle_property_map,
-                          Point_property_map,
-                          OneFaceGraphPerTree,
-                          CacheDatum > Base;
-
-public:
-  #ifdef DOXYGEN_RUNNING
-  /// \name Types
-  /// @{
-  /*!
-  The point type.
-  */
-  typedef boost::property_traits<VertexPointPMap>::value_type Point;
-  /*!
-  Geometric data type.
-  */
-  typedef Kernel_traits<Point>::Kernel::Triangle_3 Datum;
-  /*!
-  Id type.
-  */
-  typedef boost::graph_traits<FaceGraph>::face_descriptor Id;
-  /// @}
-
-  /*!
-  If `OneFaceGraphPerTree` is CGAL::Tag_true, constructs a `Shared_data` object from a reference to the polyhedon `graph`.
-  */
-  static unspecified_type construct_shared_data( FaceGraph& graph );
-  #else
-  typedef typename Base::Id Id;
-  #endif
-
-  // constructors
-  /*!
-    \tparam Iterator an input iterator with `Id` as value type.
-    Constructs a primitive.
-    If `VertexPointPMap` is the default of the class, an additional constructor
-    is available with `vppm` set to `boost::get(vertex_point, graph)`.
-  */
-  template <class Iterator>
-  AABB_face_graph_triangle_primitive(Iterator it, const FaceGraph& graph, VertexPointPMap_ vppm)
-    : Base( Id_(*it),
-            Triangle_property_map(const_cast<FaceGraph*>(&graph),vppm),
-            Point_property_map(const_cast<FaceGraph*>(&graph),vppm) )
-  {}
-
-  /*!
-    Constructs a primitive.
-    If `VertexPointPMap` is the default of the class, an additional constructor
-    is available with `vppm` set to `boost::get(vertex_point, graph)`.
-  */
-  AABB_face_graph_triangle_primitive(Id id, const FaceGraph& graph, VertexPointPMap_ vppm)
-    : Base( Id_(id),
-            Triangle_property_map(const_cast<FaceGraph*>(&graph),vppm),
-            Point_property_map(const_cast<FaceGraph*>(&graph),vppm) )
-  {}
-
-#ifndef DOXYGEN_RUNNING
-  template <class Iterator>
-  AABB_face_graph_triangle_primitive(Iterator it, const FaceGraph& graph)
-    : Base( Id_(*it),
-            Triangle_property_map(const_cast<FaceGraph*>(&graph)),
-            Point_property_map(const_cast<FaceGraph*>(&graph)) )
-  {}
-
-  AABB_face_graph_triangle_primitive(Id id, const FaceGraph& graph)
-    : Base( Id_(id),
-            Triangle_property_map(const_cast<FaceGraph*>(&graph)),
-            Point_property_map(const_cast<FaceGraph*>(&graph)) )
-  {}
-#endif
-
-  /// \internal
-  typedef internal::Cstr_shared_data<FaceGraph, Base, Triangle_property_map, Point_property_map, OneFaceGraphPerTree> Cstr_shared_data;
-  /// \internal
-  static
-  typename Cstr_shared_data::Shared_data
-  construct_shared_data(const FaceGraph& graph)
-  {
-    return Cstr_shared_data::construct_shared_data(const_cast<FaceGraph&>(graph));
-  }
-
-  static
-  typename Cstr_shared_data::Shared_data
-  construct_shared_data(const FaceGraph& graph, const VertexPointPMap_& vpm)
-  {
-    return Cstr_shared_data::construct_shared_data(const_cast<FaceGraph&>(graph), vpm);
-  }
-
-};
-
-}  // end namespace CGAL
-
-#endif // CGAL_AABB_FACE_GRAPH_TRIANGLE_PRIMITIVE_H
-
diff --git a/3rdparty/CGAL-4.8/include/CGAL/AABB_traits.h b/3rdparty/CGAL-4.8/include/CGAL/AABB_traits.h
deleted file mode 100644
index 4a2189c..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/AABB_traits.h
+++ /dev/null
@@ -1,420 +0,0 @@
-// Copyright (c) 2009 INRIA Sophia-Antipolis (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
-// 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(s) : Stéphane Tayeb, Pierre Alliez, Camille Wormser
-//
-
-#ifndef CGAL_AABB_TRAITS_H_
-#define CGAL_AABB_TRAITS_H_
-
-#include <CGAL/Bbox_3.h>
-#include <CGAL/AABB_intersections.h>
-#include <CGAL/internal/AABB_tree/Has_nested_type_Shared_data.h>
-#include <CGAL/internal/AABB_tree/Primitive_helper.h>
-
-#include <boost/optional.hpp>
-#include <boost/bind.hpp>
-
-/// \file AABB_traits.h
-
-namespace CGAL {
-
-namespace internal{  namespace AABB_tree {
-
-template <class T>
-struct Remove_optional  { typedef T type; };
-
-template <class T>
-struct Remove_optional< ::boost::optional<T> >  { typedef T type; };
-
-//helper controlling whether extra data should be stored in the AABB_tree traits class
-template <class Primitive, bool has_shared_data=Has_nested_type_Shared_data<Primitive>::value>
-struct AABB_traits_base;
-
-template <class Primitive>
-struct AABB_traits_base<Primitive,false>{};
-
-template <class Primitive>
-struct AABB_traits_base<Primitive,true>{
-  typename  Primitive::Shared_data m_primitive_data;
-
-  #if !defined(CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES) && !defined(CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE)
-  template <typename ... T>
-  void set_shared_data(T&& ... t){
-    m_primitive_data=Primitive::construct_shared_data(std::forward<T>(t)...);
-  }
-  #else
-  void set_shared_data(){
-    m_primitive_data=Primitive::construct_shared_data();
-  }
-
-  template <class T1>
-  void set_shared_data(T1& t1){
-    m_primitive_data=Primitive::construct_shared_data(t1);
-  }
-
-  template <class T1,class T2>
-  void set_shared_data(T1& t1, T2& t2){
-    m_primitive_data=Primitive::construct_shared_data(t1,t2);
-  }
-
-  template <class T1,class T2,class T3>
-  void set_shared_data(T1& t1,T2& t2,T3& t3){
-    m_primitive_data=Primitive::construct_shared_data(t1,t2,t3);
-  }
-
-  template <class T1,class T2,class T3,class T4>
-  void set_shared_data(T1& t1,T2& t2,T3& t3,T4& t4){
-    m_primitive_data=Primitive::construct_shared_data(t1,t2,t3,t4);
-  }
-
-  template <class T1,class T2,class T3,class T4,class T5>
-  void set_shared_data(T1& t1,T2& t2,T3& t3,T4& t4,T5& t5){
-    m_primitive_data=Primitive::construct_shared_data(t1,t2,t3,t4,t5);
-  }
-  #endif
-  const typename Primitive::Shared_data& shared_data() const {return m_primitive_data;}
-};
-
-} } //end of namespace internal::AABB_tree
-
-/// \addtogroup PkgAABB_tree
-/// @{
-
-/// This traits class handles any type of 3D geometric
-/// primitives provided that the proper intersection tests and
-/// constructions are implemented. It handles points, rays, lines and
-/// segments as query types for intersection detection and
-/// computations, and it handles points as query type for distance
-/// queries.
-/// \cgalModels AABBTraits
-/// \tparam GeomTraits must  be a model of the concept \ref AABBGeomTraits,
-/// snd provide the geometric types as well as the intersection tests and computations.
-/// \tparam Primitive provide the type of primitives stored in the AABB_tree.
-///   It is a model of the concept `AABBPrimitive` or `AABBPrimitiveWithSharedData`.
-///
-/// \sa `AABBTraits`
-/// \sa `AABB_tree`
-/// \sa `AABBPrimitive`
-/// \sa `AABBPrimitiveWithSharedData`
-template<typename GeomTraits, typename AABBPrimitive>
-class AABB_traits:
-  public internal::AABB_tree::AABB_traits_base<AABBPrimitive>
-{
-  typedef typename CGAL::Object Object;
-public:
-  typedef AABB_traits<GeomTraits, AABBPrimitive> AT;
-  // AABBTraits concept types
-  typedef typename GeomTraits::FT FT;
-  typedef AABBPrimitive Primitive;
-
-  typedef typename std::pair<Object,typename Primitive::Id> Object_and_primitive_id;
-
-  typedef typename std::pair<typename GeomTraits::Point_3, typename Primitive::Id> Point_and_primitive_id;
-
-  /// `Intersection_and_primitive_id<Query>::%Type::first_type` is found according to
-  /// the result type of `GeomTraits::Intersect_3::operator()`,
-  /// (that is cpp11::result_of<GeomTraits::Intersect_3(Query, Primitive::Datum)>::type). If it is
-  /// `boost::optional<T>` then it is `T`, and the result type otherwise.
-  template<typename Query>
-  struct Intersection_and_primitive_id {
-    typedef typename cpp11::result_of<
-      typename GeomTraits::Intersect_3(Query, typename Primitive::Datum)
-    >::type Intersection_type;
-
-    typedef std::pair<
-      typename internal::AABB_tree::Remove_optional<Intersection_type>::type,
-      typename Primitive::Id > Type;
-  };
-
-  // types for search tree
-  /// \name Types
-  /// @{
-
-  /// Point query type.
-  typedef typename GeomTraits::Point_3 Point_3;
-
-  /// additionnal types for the search tree, required by the RangeSearchTraits concept
-  /// \bug This is not documented for now in the AABBTraits concept.
-  typedef typename GeomTraits::Iso_cuboid_3 Iso_cuboid_3;
-
-  ///
-  typedef typename CGAL::Bbox_3 Bounding_box;
-
-  /// @}
-
-  typedef typename GeomTraits::Sphere_3 Sphere_3;
-  typedef typename GeomTraits::Cartesian_const_iterator_3 Cartesian_const_iterator_3;
-  typedef typename GeomTraits::Construct_cartesian_const_iterator_3 Construct_cartesian_const_iterator_3;
-  typedef typename GeomTraits::Construct_center_3 Construct_center_3;
-  typedef typename GeomTraits::Compute_squared_radius_3 Compute_squared_radius_3;
-  typedef typename GeomTraits::Construct_min_vertex_3 Construct_min_vertex_3;
-  typedef typename GeomTraits::Construct_max_vertex_3 Construct_max_vertex_3;
-  typedef typename GeomTraits::Construct_iso_cuboid_3 Construct_iso_cuboid_3;
-
-
-  /// Default constructor.
-  AABB_traits() { };
-
-
-  typedef typename GeomTraits::Compute_squared_distance_3 Squared_distance;
-  Squared_distance squared_distance_object() const { return GeomTraits().compute_squared_distance_3_object(); }
-
-  /**
-   * @internal
-   * @brief Sorts [first,beyond[
-   * @param first iterator on first element
-   * @param beyond iterator on beyond element
-   * @param bbox the bounding box of [first,beyond[
-   *
-   * Sorts the range defined by [first,beyond[. Sort is achieved on bbox longuest
-   * axis, using the comparison function `<dim>_less_than` (dim in {x,y,z})
-   */
-  class Sort_primitives
-  {
-    const AABB_traits<GeomTraits,AABBPrimitive>& m_traits;
-  public:
-    Sort_primitives(const AABB_traits<GeomTraits,AABBPrimitive>& traits)
-      : m_traits(traits) {}
-
-    template<typename PrimitiveIterator>
-    void operator()(PrimitiveIterator first,
-                    PrimitiveIterator beyond,
-                    const typename AT::Bounding_box& bbox) const
-      {
-        PrimitiveIterator middle = first + (beyond - first)/2;
-        switch(longest_axis(bbox))
-        {
-        case AT::CGAL_AXIS_X: // sort along x
-          std::nth_element(first, middle, beyond, boost::bind(less_x,_1,_2,m_traits));
-          break;
-        case AT::CGAL_AXIS_Y: // sort along y
-          std::nth_element(first, middle, beyond, boost::bind(less_y,_1,_2,m_traits));
-          break;
-        case AT::CGAL_AXIS_Z: // sort along z
-          std::nth_element(first, middle, beyond, boost::bind(less_z,_1,_2,m_traits));
-          break;
-        default:
-          CGAL_error();
-        }
-      }
-  };
-
-  Sort_primitives sort_primitives_object() const {return Sort_primitives(*this);}
-
-
-  /*
-   * Computes the bounding box of a set of primitives
-   * @param first an iterator on the first primitive
-   * @param beyond an iterator on the past-the-end primitive
-   * @return the bounding box of the primitives of the iterator range
-   */
-  class Compute_bbox {
-    const AABB_traits<GeomTraits,AABBPrimitive>& m_traits;
-  public:
-    Compute_bbox(const AABB_traits<GeomTraits,AABBPrimitive>& traits)
-      :m_traits (traits) {}
-
-    template<typename ConstPrimitiveIterator>
-    typename AT::Bounding_box operator()(ConstPrimitiveIterator first,
-                                         ConstPrimitiveIterator beyond) const
-      {
-        typename AT::Bounding_box bbox = compute_bbox(*first,m_traits);
-        for(++first; first != beyond; ++first)
-        {
-          bbox = bbox + compute_bbox(*first,m_traits);
-        }
-        return bbox;
-      }
-  };
-
-  Compute_bbox compute_bbox_object() const {return Compute_bbox(*this);}
-
-
-  class Do_intersect {
-    const AABB_traits<GeomTraits,AABBPrimitive>& m_traits;
-  public:
-    Do_intersect(const AABB_traits<GeomTraits,AABBPrimitive>& traits)
-      :m_traits(traits) {}
-
-    template<typename Query>
-    bool operator()(const Query& q, const Bounding_box& bbox) const
-    {
-      return CGAL::do_intersect(q, bbox);
-    }
-
-    template<typename Query>
-    bool operator()(const Query& q, const Primitive& pr) const
-    {
-      return GeomTraits().do_intersect_3_object()(q, internal::Primitive_helper<AT>::get_datum(pr,m_traits));
-    }
-  };
-
-  Do_intersect do_intersect_object() const {return Do_intersect(*this);}
-
-class Intersection {
-  const AABB_traits<GeomTraits,AABBPrimitive>& m_traits;
-public:
-  Intersection(const AABB_traits<GeomTraits,AABBPrimitive>& traits)
-    :m_traits(traits) {}
-    #if CGAL_INTERSECTION_VERSION < 2
-template<typename Query>
-boost::optional<typename AT::Object_and_primitive_id>
-operator()(const Query& query, const typename AT::Primitive& primitive) const
-{
-  typedef boost::optional<Object_and_primitive_id> Intersection;
-
-  CGAL::Object object = GeomTraits().intersect_3_object()(internal::Primitive_helper<AT>::get_datum(primitive,m_traits),query);
-  if ( object.empty() )
-    return Intersection();
-  else
-    return Intersection(Object_and_primitive_id(object,primitive.id()));
-}
-    #else
-    template<typename Query>
-    boost::optional< typename Intersection_and_primitive_id<Query>::Type >
-    operator()(const Query& query, const typename AT::Primitive& primitive) const {
-      typename cpp11::result_of<typename GeomTraits::Intersect_3(Query, typename Primitive::Datum) >::type
-        inter_res = GeomTraits().intersect_3_object()(internal::Primitive_helper<AT>::get_datum(primitive,m_traits),query);
-      if (!inter_res)
-          return boost::optional<typename Intersection_and_primitive_id<Query>::Type>();
-      return boost::make_optional( std::make_pair(*inter_res, primitive.id()) );
-    }
-    #endif
-};
-
-Intersection intersection_object() const {return Intersection(*this);}
-
-  // This should go down to the GeomTraits, i.e. the kernel
-  class Closest_point {
-      typedef typename AT::Point_3 Point;
-      typedef typename AT::Primitive Primitive;
-    const AABB_traits<GeomTraits,AABBPrimitive>& m_traits;
-  public:
-    Closest_point(const AABB_traits<GeomTraits,AABBPrimitive>& traits)
-      : m_traits(traits) {}
-
-
-    Point operator()(const Point& p, const Primitive& pr, const Point& bound) const
-    {
-        return CGAL::nearest_point_3(p, internal::Primitive_helper<AT>::get_datum(pr,m_traits), bound);
-    }
-  };
-
-  // This should go down to the GeomTraits, i.e. the kernel
-  // and the internal implementation should change its name from
-  // do_intersect to something like does_contain (this is what we compute,
-  // this is not the same do_intersect as the spherical kernel)
-  class Compare_distance {
-      typedef typename AT::Point_3 Point;
-      typedef typename AT::FT FT;
-      typedef typename AT::Primitive Primitive;
-  public:
-      template <class Solid>
-      CGAL::Comparison_result operator()(const Point& p, const Solid& pr, const Point& bound) const
-      {
-          return GeomTraits().do_intersect_3_object()
-          (GeomTraits().construct_sphere_3_object()
-          (p, GeomTraits().compute_squared_distance_3_object()(p, bound)), pr)?
-          CGAL::SMALLER : CGAL::LARGER;
-      }
-
-      template <class Solid>
-      CGAL::Comparison_result operator()(const Point& p, const Solid& pr, const FT& sq_distance) const
-      {
-        return GeomTraits().do_intersect_3_object()
-          (GeomTraits().construct_sphere_3_object()(p, sq_distance),
-           pr) ?
-          CGAL::SMALLER :
-          CGAL::LARGER;
-      }
-  };
-
-  Closest_point closest_point_object() const {return Closest_point(*this);}
-  Compare_distance compare_distance_object() const {return Compare_distance();}
-
-
-private:
-  /**
-   * @brief Computes bounding box of one primitive
-   * @param pr the primitive
-   * @return the bounding box of the primitive \c pr
-   */
-  static Bounding_box compute_bbox (const Primitive& pr,
-                                    const AABB_traits<GeomTraits,AABBPrimitive>& traits)
-  {
-    return internal::Primitive_helper<AT>::get_datum(pr,traits).bbox();
-  }
-
-  typedef enum { CGAL_AXIS_X = 0,
-                 CGAL_AXIS_Y = 1,
-                 CGAL_AXIS_Z = 2} Axis;
-
-  static Axis longest_axis(const Bounding_box& bbox);
-
-  /// Comparison functions
-  static bool less_x(const Primitive& pr1, const Primitive& pr2,const AABB_traits<GeomTraits,AABBPrimitive>& traits)
-  { return internal::Primitive_helper<AT>::get_reference_point(pr1,traits).x() < internal::Primitive_helper<AT>::get_reference_point(pr2,traits).x(); }
-  static bool less_y(const Primitive& pr1, const Primitive& pr2,const AABB_traits<GeomTraits,AABBPrimitive>& traits)
-  { return internal::Primitive_helper<AT>::get_reference_point(pr1,traits).y() < internal::Primitive_helper<AT>::get_reference_point(pr2,traits).y(); }
-  static bool less_z(const Primitive& pr1, const Primitive& pr2,const AABB_traits<GeomTraits,AABBPrimitive>& traits)
-  { return internal::Primitive_helper<AT>::get_reference_point(pr1,traits).z() < internal::Primitive_helper<AT>::get_reference_point(pr2,traits).z(); }
-
-};  // end class AABB_traits
-
-
-//-------------------------------------------------------
-// Private methods
-//-------------------------------------------------------
-template<typename GT, typename P>
-typename AABB_traits<GT,P>::Axis
-AABB_traits<GT,P>::longest_axis(const Bounding_box& bbox)
-{
-  const double dx = bbox.xmax() - bbox.xmin();
-  const double dy = bbox.ymax() - bbox.ymin();
-  const double dz = bbox.zmax() - bbox.zmin();
-
-  if(dx>=dy)
-  {
-    if(dx>=dz)
-    {
-      return CGAL_AXIS_X;
-    }
-    else // dz>dx and dx>=dy
-    {
-      return CGAL_AXIS_Z;
-    }
-  }
-  else // dy>dx
-  {
-    if(dy>=dz)
-    {
-      return CGAL_AXIS_Y;
-    }
-    else  // dz>dy and dy>dx
-    {
-      return CGAL_AXIS_Z;
-    }
-  }
-}
-
-/// @}
-
-}  // end namespace CGAL
-
-#endif // CGAL_AABB_TRAITS_H_
diff --git a/3rdparty/CGAL-4.8/include/CGAL/AABB_tree.h b/3rdparty/CGAL-4.8/include/CGAL/AABB_tree.h
deleted file mode 100644
index d605c02..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/AABB_tree.h
+++ /dev/null
@@ -1,1239 +0,0 @@
-// Copyright (c) 2008,2011  INRIA Sophia-Antipolis (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
-// 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(s) : Camille Wormser, Pierre Alliez, Stephane Tayeb
-
-#ifndef CGAL_AABB_TREE_H
-#define CGAL_AABB_TREE_H
-
-#include <vector>
-#include <iterator>
-#include <CGAL/internal/AABB_tree/AABB_traversal_traits.h>
-#include <CGAL/internal/AABB_tree/AABB_node.h>
-#include <CGAL/internal/AABB_tree/AABB_search_tree.h>
-#include <CGAL/internal/AABB_tree/Has_nested_type_Shared_data.h>
-#include <CGAL/internal/AABB_tree/Primitive_helper.h>
-#include <boost/optional.hpp>
-
-#ifdef CGAL_HAS_THREADS
-#include <CGAL/mutex.h>
-#endif
-
-/// \file AABB_tree.h
-
-namespace CGAL {
-
-/// \addtogroup PkgAABB_tree
-/// @{
-
-	/**
-   * Class AABB_tree is a static data structure for efficient
-   * intersection and distance computations in 3D. It builds a
-   * hierarchy of axis-aligned bounding boxes (an AABB tree) from a set
-   * of 3D geometric objects, and can receive intersection and distance
-   * queries, provided that the corresponding predicates are
-   * implemented in the traits class AABBTraits.
-   * An instance of the class `AABBTraits` is internally stored.
-   *
-   * \sa `AABBTraits`
-   * \sa `AABBPrimitive`
-   *
-   */
-	template <typename AABBTraits>
-	class AABB_tree
-	{
-	private:
-		// internal KD-tree used to accelerate the distance queries
-		typedef AABB_search_tree<AABBTraits> Search_tree;
-
-		// type of the primitives container
-		typedef std::vector<typename AABBTraits::Primitive> Primitives;
-
-	public:
-    typedef AABBTraits AABB_traits;
-    
-    /// \name Types
-    ///@{
-
-    /// Number type returned by the distance queries.
-		typedef typename AABBTraits::FT FT;
-
-
-    /// Type of 3D point.
-		typedef typename AABBTraits::Point_3 Point;
-
-    /// Type of input primitive.
-		typedef typename AABBTraits::Primitive Primitive;
-		/// Identifier for a primitive in the tree.
-		typedef typename Primitive::Id Primitive_id;
-		/// Unsigned integral size type.
-		typedef typename Primitives::size_type size_type; 
-    /// Type of bounding box.
-		typedef typename AABBTraits::Bounding_box Bounding_box;
-    /// 
-		typedef typename AABBTraits::Point_and_primitive_id Point_and_primitive_id;
-    /// \deprecated 
-		typedef typename AABBTraits::Object_and_primitive_id Object_and_primitive_id;
-
-    /*!
-    An alias to `AABBTraits::Intersection_and_primitive_id<Query>`
-    */
-    #ifdef DOXYGEN_RUNNING
-    template<typename Query>
-    using Intersection_and_primitive_id = AABBTraits::Intersection_and_primitive_id<Query>;
-    #else
-    template<typename Query>
-    struct Intersection_and_primitive_id {
-      typedef typename AABBTraits::template Intersection_and_primitive_id<Query>::Type Type;
-    };
-    #endif
-
-    
-    ///@}
-
-	public:
-    /// \name Creation
-    ///@{
-
-    /// Constructs an empty tree, and initializes the internally stored traits
-    /// class using `traits`.
-    AABB_tree(const AABBTraits& traits = AABBTraits());
-
-    /**
-     * @brief Builds the datastructure from a sequence of primitives.
-     * @param first iterator over first primitive to insert
-     * @param beyond past-the-end iterator
-     *
-     * It is equivalent to constructing an empty tree and calling `insert(first,last,t...)`.
-     * For compilers that do not support variadic templates, overloads up to 
-     * 5 template arguments are provided.
-     * The tree stays empty if the memory allocation is not successful.
-     */
-    #if !defined(CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES) && !defined(CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE)
-		template<typename InputIterator,typename ... T>
-		AABB_tree(InputIterator first, InputIterator beyond,T&& ...);  
-    #else
-		template<typename InputIterator>
-		AABB_tree(InputIterator first, InputIterator beyond);
-    template<typename InputIterator, typename T1>
-		AABB_tree(InputIterator first, InputIterator beyond, T1&);
-    template<typename InputIterator, typename T1, typename T2>
-    AABB_tree(InputIterator first, InputIterator beyond,T1&,T2&);
-    template<typename InputIterator, typename T1, typename T2, typename T3>
-		AABB_tree(InputIterator first, InputIterator beyond,T1&,T2&,T3&);
-    template<typename InputIterator, typename T1, typename T2, typename T3, typename T4>
-		AABB_tree(InputIterator first, InputIterator beyond,T1&,T2&,T3&,T4&);
-    template<typename InputIterator, typename T1, typename T2, typename T3, typename T4, typename T5>
-		AABB_tree(InputIterator first, InputIterator beyond,T1&,T2&,T3&,T4&,T5&);
-    #endif
-
-    ///@}
-
-		/// \name Operations
-		///@{
-
-    /// Equivalent to calling `clear()` and then `insert(first,last,t...)`.
-    /// For compilers that do not support variadic templates, overloads up
-    /// to 5 template arguments are provided.
-    #if !defined(CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES) && !defined(CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE)
-		template<typename ConstPrimitiveIterator,typename ... T>
-		void rebuild(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond,T&& ...);
-    #else
-		template<typename ConstPrimitiveIterator>
-		void rebuild(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond);
-    template<typename ConstPrimitiveIterator, typename T1>
-		void rebuild(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond, T1&);
-    template<typename ConstPrimitiveIterator, typename T1, typename T2>
-		void rebuild(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond,T1&,T2&);
-    template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3>
-		void rebuild(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond,T1&,T2&,T3&);
-    template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3, typename T4>
-		void rebuild(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond,T1&,T2&,T3&,T4&);
-    template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3, typename T4, typename T5>
-		void rebuild(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond,T1&,T2&,T3&,T4&,T5&);
-    #endif
-
-
-    /// Add a sequence of primitives to the set of primitives of the AABB tree.
-    /// `%InputIterator` is any iterator and the parameter pack `T` are any types
-    /// such that `Primitive` has a constructor with the following signature:
-    /// `Primitive(%InputIterator, T...)`. If `Primitive` is a model of the concept
-    /// `AABBPrimitiveWithSharedData`, a call to `AABBTraits::set_shared_data(t...)`
-    /// is made using the internally stored traits.
-    /// For compilers that do not support variadic templates,
-    /// overloads up to 5 template arguments are provided.
-    #if !defined(CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES) && !defined(CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE)
-		template<typename InputIterator,typename ... T>
-		void insert(InputIterator first, InputIterator beyond,T&& ...);
-    #else
-		template<typename InputIterator>
-		void insert(InputIterator first, InputIterator beyond);
-    template<typename InputIterator, typename T1>
-		void insert(InputIterator first, InputIterator beyond,T1&);
-    template<typename InputIterator, typename T1, typename T2>
-		void insert(InputIterator first, InputIterator beyond,T1&, T2&);
-    template<typename InputIterator, typename T1, typename T2, typename T3>
-		void insert(InputIterator first, InputIterator beyond,T1&,T2&,T3&);
-    template<typename InputIterator, typename T1, typename T2, typename T3, typename T4>
-		void insert(InputIterator first, InputIterator beyond,T1&,T2&,T3&,T4&);
-    template<typename InputIterator, typename T1, typename T2, typename T3, typename T4, typename T5>
-		void insert(InputIterator first, InputIterator beyond,T1&,T2&,T3&,T4&,T5&);
-    #endif
-
-    /// Adds a primitive to the set of primitives of the tree.
-    inline void insert(const Primitive& p);
-
-		/// Clears and destroys the tree.
-		~AABB_tree()
-		{
-			clear();
-		}
-    /// Returns a const reference to the internally stored traits class.
-    const AABBTraits& traits() const{
-      return m_traits; 
-    }
-    
-		/// Clears the tree.
-		void clear()
-		{
-			// clear AABB tree
-      clear_nodes();
-			m_primitives.clear();
-			clear_search_tree();
-		}
-
-		/// Returns the axis-aligned bounding box of the whole tree.
-		/// \pre `!empty()`
-		const Bounding_box bbox() const { 
-			CGAL_precondition(!empty());
-			if(size() > 1)
-				return root_node()->bbox(); 
-			else
-				return AABB_traits().compute_bbox_object()(m_primitives.begin(), 
-																									 m_primitives.end());
-		}
-    
-    /// Returns the number of primitives in the tree.
-		size_type size() const { return m_primitives.size(); }
-    
-    /// Returns \c true, iff the tree contains no primitive.
-		bool empty() const { return m_primitives.empty(); }
-		///@}
-
-    /// \name Advanced
-    ///@{
-
-    /// After one or more calls to `AABB_tree::insert()` the internal data
-    /// structure of the tree must be reconstructed. This procedure
-    /// has a complexity of \f$O(n log(n))\f$, where \f$n\f$ is the number of
-    /// primitives of the tree.  This procedure is called implicitly
-    /// at the first call to a query member function. You can call
-    /// AABB_tree::build() explicitly to ensure that the next call to
-    /// query functions will not trigger the reconstruction of the
-    /// data structure.
-    void build();
-
-    ///@}
-
-private:
-    #if !defined(CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES) && !defined(CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE)
-    template <typename ... T>
-    void set_primitive_data_impl(CGAL::Boolean_tag<false>,T ... ){}
-    template <typename ... T>
-    void set_primitive_data_impl(CGAL::Boolean_tag<true>,T&& ... t)
-    {m_traits.set_shared_data(std::forward<T>(t)...);}
-
-    template <typename ... T>
-    void set_shared_data(T&& ...t){
-      set_primitive_data_impl(CGAL::Boolean_tag<internal::Has_nested_type_Shared_data<Primitive>::value>(),std::forward<T>(t)...);
-    }
-    #else
-    void set_primitive_data_impl(CGAL::Boolean_tag<false>){}
-    void set_primitive_data_impl(CGAL::Boolean_tag<true>)
-    {m_traits.set_shared_data();}
-    void set_shared_data(){
-      set_primitive_data_impl(CGAL::Boolean_tag<internal::Has_nested_type_Shared_data<Primitive>::value>());
-    }
-    
-    template <typename T1>
-    void set_primitive_data_impl(CGAL::Boolean_tag<false>,T1){}
-    template <typename T1>
-    void set_primitive_data_impl(CGAL::Boolean_tag<true>,T1& t1)
-    {m_traits.set_shared_data(t1);}
-    template <typename T1>
-    void set_shared_data(T1& t1){
-      set_primitive_data_impl(Boolean_tag<internal::Has_nested_type_Shared_data<Primitive>::value>(),t1);
-    }
-    
-    template <typename T1, typename T2>
-    void set_primitive_data_impl(CGAL::Boolean_tag<false>,T1,T2){}
-    template <typename T1, typename T2>
-    void set_primitive_data_impl(CGAL::Boolean_tag<true>,T1& t1,T2& t2)
-    {m_traits.set_shared_data(t1,t2);}
-    template <typename T1, typename T2>
-    void set_shared_data(const T1& t1,const T2& t2){
-      set_primitive_data_impl(Boolean_tag<internal::Has_nested_type_Shared_data<Primitive>::value>(),t1,t2);
-    }
-    
-    template <typename T1, typename T2, typename T3>
-    void set_primitive_data_impl(CGAL::Boolean_tag<false>,T1,T2,T3){}
-    template <typename T1, typename T2, typename T3>
-    void set_primitive_data_impl(CGAL::Boolean_tag<true>,T1& t1,T2& t2,T3& t3)
-    {m_traits.set_shared_data(t1,t2,t3);}
-    template <typename T1, typename T2, typename T3>
-    void set_shared_data(T1& t1,T2& t2,T3& t3){
-      set_primitive_data_impl(Boolean_tag<internal::Has_nested_type_Shared_data<Primitive>::value>(),t1,t2,t3);
-    }
-    
-    template <typename T1, typename T2, typename T3, typename T4>
-    void set_primitive_data_impl(CGAL::Boolean_tag<false>,T1,T2,T3,T4){}
-    template <typename T1, typename T2, typename T3, typename T4>
-    void set_primitive_data_impl(CGAL::Boolean_tag<true>,T1& t1,T2& t2,T3& t3,T4& t4)
-    {m_traits.set_shared_data(t1,t2,t3,t4);}
-    template <typename T1, typename T2, typename T3, typename T4>
-    void set_shared_data(T1& t1,T2& t2,T3& t3,T4& t4){
-      set_primitive_data_impl(Boolean_tag<internal::Has_nested_type_Shared_data<Primitive>::value>(),t1,t2,t3,t4);
-    }
-    
-    template <typename T1, typename T2, typename T3, typename T4, typename T5>
-    void set_primitive_data_impl(CGAL::Boolean_tag<false>,T1,T2,T3,T4,T5){}
-    template <typename T1, typename T2, typename T3, typename T4, typename T5>
-    void set_primitive_data_impl(CGAL::Boolean_tag<true>,T1& t1,T2& t2,T3& t3,T4& t4,T5& t5)
-    {m_traits.set_shared_data(t1,t2,t3,t4,t5);}
-    template <typename T1, typename T2, typename T3, typename T4, typename T5>
-    void set_shared_data(T1& t1,T2& t2,T3& t3,T4& t4,T5& t5){
-      set_primitive_data_impl(Boolean_tag<internal::Has_nested_type_Shared_data<Primitive>::value>(),t1,t2,t3,t4,t5);
-    }
-    #endif
-
-		template<typename ConstPointIterator>
-		bool accelerate_distance_queries_impl(ConstPointIterator first,
-                                          ConstPointIterator beyond) const;
-public:
-
-    /// \name Intersection Tests
-    ///@{
-
-		/// Returns `true`, iff the query intersects at least one of
-		/// the input primitives. \tparam Query must be a type for
-		/// which `do_intersect` predicates are
-		/// defined in the traits class `AABBTraits`.
-		template<typename Query>
-		bool do_intersect(const Query& query) const;
-
-    /// Returns the number of primitives intersected by the
-    /// query. \tparam Query must be a type for which
-    /// `do_intersect` predicates are defined
-    /// in the traits class `AABBTraits`.
-		template<typename Query>
-		size_type number_of_intersected_primitives(const Query& query) const;
-
-    /// Outputs to the iterator the list of all intersected primitives
-    /// ids. This function does not compute the intersection points
-    /// and is hence faster than the function `all_intersections()`
-    /// function below. \tparam Query must be a type for which
-    /// `do_intersect` predicates are defined
-    /// in the traits class `AABBTraits`.
-		template<typename Query, typename OutputIterator>
-		OutputIterator all_intersected_primitives(const Query& query, OutputIterator out) const;
-
-
-    /// Returns the first encountered intersected primitive id, iff
-    /// the query intersects at least one of the input primitives. No
-    /// particular order is guaranteed over the tree traversal, such
-    /// that, e.g, the primitive returned is not necessarily the
-    /// closest from the source point of a ray query. \tparam Query
-    /// must be a type for which
-    /// `do_intersect` predicates are defined
-    /// in the traits class `AABBTraits`.
-		template <typename Query>
-		boost::optional<Primitive_id> any_intersected_primitive(const Query& query) const;
-    
-    ///@}
-
-    /// \name Intersections
-    ///@{
-
-    /// Outputs the list of all intersections, as objects of
-    /// `Intersection_and_primitive_id<Query>::%Type`,
-    /// between the query and the input data to
-    /// the iterator. `do_intersect()`
-    /// predicates and intersections must be defined for `Query`
-    /// in the `AABBTraits` class.
-		template<typename Query, typename OutputIterator>
-		OutputIterator all_intersections(const Query& query, OutputIterator out) const;
-
-
-    /// Returns the first encountered intersection. No particular
-    /// order is guaranteed over the tree traversal, e.g, the
-    /// primitive returned is not necessarily the closest from the
-    /// source point of a ray query. Type `Query` must be a type
-    /// for which `do_intersect` predicates
-    /// and intersections are defined in the traits class AABBTraits.
-		template <typename Query>
-    #if CGAL_INTERSECTION_VERSION < 2 && !defined(DOXYGEN_RUNNING)
-		boost::optional<Object_and_primitive_id> 
-    #else
-    boost::optional< typename Intersection_and_primitive_id<Query>::Type >
-    #endif
-    any_intersection(const Query& query) const;
-
-    ///@}
-
-    /// \name Distance Queries
-    ///@{
-
-    /// Returns the minimum squared distance between the query point
-    /// and all input primitives. Method
-    /// `accelerate_distance_queries()` should be called before the
-    /// first distance query, so that an internal secondary search
-    /// structure is build, for improving performance.
-		/// \pre `!empty()`
-		FT squared_distance(const Point& query) const;
-
-    /// Returns the point in the union of all input primitives which
-    /// is closest to the query. In case there are several closest
-    /// points, one arbitrarily chosen closest point is
-    /// returned. Method `accelerate_distance_queries()` should be
-    /// called before the first distance query, so that an internal
-    /// secondary search structure is build, for improving
-    /// performance.
-		/// \pre `!empty()`
-		Point closest_point(const Point& query) const;
-
-    
-    /// Returns a `Point_and_primitive_id` which realizes the
-    /// smallest distance between the query point and all input
-    /// primitives. Method `accelerate_distance_queries()` should be
-    /// called before the first distance query, so that an internal
-    /// secondary search structure is build, for improving
-    /// performance.
-		/// \pre `!empty()`
-		Point_and_primitive_id closest_point_and_primitive(const Point& query) const;
-
-
-    ///@}
-
-    /// \name Accelerating the Distance Queries
-    /// 
-    /// In the following paragraphs, we discuss details of the
-    /// implementation of the distance queries. We explain the
-    /// internal use of hints, how the user can pass his own hints to
-    /// the tree, and how the user can influence the construction of
-    /// the secondary data structure used for accelerating distance
-    /// queries.
-    /// Internally, the distance queries algorithms are initialized
-    /// with some hint, which has the same type as the return type of
-    /// the query, and this value is refined along a traversal of the
-    /// tree, until it is optimal, that is to say until it realizes
-    /// the shortest distance to the primitives. In particular, the
-    /// exact specification of these internal algorithms is that they
-    /// minimize the distance to the object composed of the union of
-    /// the primitives and the hint.
-    /// It follows that 
-    /// - in order to return the exact distance to the set of
-    /// primitives, the algorithms need the hint to be exactly on the
-    /// primitives;
-    /// - if this is not the case, and if the hint happens to be closer
-    /// to the query point than any of the primitives, then the hint
-    /// is returned.
-    ///
-    /// This second observation is reasonable, in the sense that
-    /// providing a hint to the algorithm means claiming that this
-    /// hint belongs to the union of the primitives. These
-    /// considerations about the hints being exactly on the primitives
-    /// or not are important: in the case where the set of primitives
-    /// is a triangle soup, and if some of the primitives are large,
-    /// one may want to provide a much better hint than a vertex of
-    /// the triangle soup could be. It could be, for example, the
-    /// barycenter of one of the triangles. But, except with the use
-    /// of an exact constructions kernel, one cannot easily construct
-    /// points other than the vertices, that lie exactly on a triangle
-    /// soup. Hence, providing a good hint sometimes means not being
-    /// able to provide it exactly on the primitives. In rare
-    /// occasions, this hint can be returned as the closest point.
-    /// In order to accelerate distance queries significantly, the
-    /// AABB tree builds an internal KD-tree containing a set of
-    /// potential hints, when the method
-    /// `accelerate_distance_queries()` is called. This KD-tree
-    /// provides very good hints that allow the algorithms to run much
-    /// faster than with a default hint (such as the
-    /// `reference_point` of the first primitive). The set of
-    /// potential hints is a sampling of the union of the primitives,
-    /// which is obtained, by default, by calling the method
-    /// `reference_point` of each of the primitives. However, such
-    /// a sampling with one point per primitive may not be the most
-    /// relevant one: if some primitives are very large, it helps
-    /// inserting more than one sample on them. Conversely, a sparser
-    /// sampling with less than one point per input primitive is
-    /// relevant in some cases.
-    ///@{
-
-		/// Constructs internal search tree from
-		/// a point set taken on the internal primitives
-		/// returns `true` iff successful memory allocation
-		bool accelerate_distance_queries() const;
-
-    /// Constructs an internal KD-tree containing the specified point
-    /// set, to be used as the set of potential hints for accelerating
-    /// the distance queries. 
-		/// \tparam ConstPointIterator is an iterator with
-    /// value type `Point_and_primitive_id`.
-		template<typename ConstPointIterator>
-		bool accelerate_distance_queries(ConstPointIterator first,
-                                     ConstPointIterator beyond) const
-    {
-      #ifdef CGAL_HAS_THREADS
-      //this ensures that this is done once at a time
-      CGAL_SCOPED_LOCK(kd_tree_mutex);
-      #endif
-      clear_search_tree();
-      return accelerate_distance_queries_impl(first,beyond);
-      
-    }
-    
-    /// Returns the minimum squared distance between the query point
-    /// and all input primitives. The internal KD-tree is not used.
-		/// \pre `!empty()`
-		FT squared_distance(const Point& query, const Point& hint) const;
-
-    /// Returns the point in the union of all input primitives which
-    /// is closest to the query. In case there are several closest
-    /// points, one arbitrarily chosen closest point is returned. The
-    /// internal KD-tree is not used.
-		/// \pre `!empty()`
-		Point closest_point(const Point& query, const Point& hint) const;
-    
-    /// Returns a `Point_and_primitive_id` which realizes the
-    /// smallest distance between the query point and all input
-    /// primitives. The internal KD-tree is not used.
-		/// \pre `!empty()`
-		Point_and_primitive_id closest_point_and_primitive(const Point& query, const Point_and_primitive_id& hint) const;
-
-    ///@}
-
-	private:
-    // clear nodes
-    void clear_nodes()
-    {
-			if( size() > 1 ) {
-				delete [] m_p_root_node;
-			}
-			m_p_root_node = NULL;
-    }
-
-		// clears internal KD tree
-		void clear_search_tree() const
-		{
-			if ( m_search_tree_constructed )
-			{
-				CGAL_assertion( m_p_search_tree!=NULL );
-				delete m_p_search_tree;
-				m_p_search_tree = NULL;
-				m_search_tree_constructed = false;
-				m_default_search_tree_constructed = false;
-                        }
-		}
-
-	public:
-
-    /// \internal
-		template <class Query, class Traversal_traits>
-		void traversal(const Query& query, Traversal_traits& traits) const
-		{
-			switch(size())
-			{
-			case 0:
-				break;
-			case 1:
-				traits.intersection(query, singleton_data());
-				break;
-			default: // if(size() >= 2)
-				root_node()->template traversal<Traversal_traits,Query>(query, traits, m_primitives.size());
-			}
-		}
-
-	private:
-		typedef AABB_node<AABBTraits> Node;
-
-
-	public:
-		// returns a point which must be on one primitive
-		Point_and_primitive_id any_reference_point_and_id() const
-		{
-			CGAL_assertion(!empty());
-			return Point_and_primitive_id(
-        internal::Primitive_helper<AABB_traits>::get_reference_point(m_primitives[0],m_traits), m_primitives[0].id()
-      );
-		}
-
-	public:
-		Point_and_primitive_id best_hint(const Point& query) const
-		{
-			if(m_search_tree_constructed)
-				return m_p_search_tree->closest_point(query);
-			else
-				return this->any_reference_point_and_id();
-		}
-
-	private:
-    //Traits class
-    AABBTraits m_traits;
-		// set of input primitives
-		Primitives m_primitives;
-		// single root node
-		Node* m_p_root_node;
-    #ifdef CGAL_HAS_THREADS
-    mutable CGAL_MUTEX internal_tree_mutex;//mutex used to protect const calls inducing build()
-    mutable CGAL_MUTEX kd_tree_mutex;//mutex used to protect calls to accelerate_distance_queries
-    #endif
-  
-    const Node* root_node() const {
-			CGAL_assertion(size() > 1);
-      if(m_need_build){
-        #ifdef CGAL_HAS_THREADS
-        //this ensures that build() will be called once
-        CGAL_SCOPED_LOCK(internal_tree_mutex);
-        if(m_need_build)
-        #endif
-          const_cast< AABB_tree<AABBTraits>* >(this)->build(); 
-      }
-      return m_p_root_node;
-    }
-
-		const Primitive& singleton_data() const {
-			CGAL_assertion(size() == 1);
-			return *m_primitives.begin();
-		}
-
-		// search KD-tree
-		mutable const Search_tree* m_p_search_tree;
-		mutable bool m_search_tree_constructed;
-    mutable bool m_default_search_tree_constructed;
-    bool m_need_build;
-
-	private:
-		// Disabled copy constructor & assignment operator
-		typedef AABB_tree<AABBTraits> Self;
-		AABB_tree(const Self& src);
-		Self& operator=(const Self& src);
-
-	};  // end class AABB_tree
-
-/// @}
-
-  template<typename Tr>
-  AABB_tree<Tr>::AABB_tree(const Tr& traits)
-    : m_traits(traits)
-    , m_primitives()
-    , m_p_root_node(NULL)
-    , m_p_search_tree(NULL)
-    , m_search_tree_constructed(false)
-    , m_default_search_tree_constructed(false)
-    , m_need_build(false)
-  {}
-
-  #if !defined(CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES) && !defined(CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE) 
- 	template<typename Tr>
-	template<typename ConstPrimitiveIterator, typename ... T>
-	AABB_tree<Tr>::AABB_tree(ConstPrimitiveIterator first,
-                           ConstPrimitiveIterator beyond,
-                           T&& ... t)
-		: m_traits()
-    , m_primitives()
-		, m_p_root_node(NULL)
-		, m_p_search_tree(NULL)
-		, m_search_tree_constructed(false)
-    , m_default_search_tree_constructed(false)
-    , m_need_build(false)
-	{
-		// Insert each primitive into tree
-    insert(first, beyond,std::forward<T>(t)...);
- 	}
-  
-	template<typename Tr>
-	template<typename ConstPrimitiveIterator, typename ... T>
-	void AABB_tree<Tr>::insert(ConstPrimitiveIterator first,
-                             ConstPrimitiveIterator beyond,
-                             T&& ... t)
-	{
-    set_shared_data(std::forward<T>(t)...);
-		while(first != beyond)
-		{
-			m_primitives.push_back(Primitive(first,std::forward<T>(t)...));
-			++first;
-		}
-    m_need_build = true;
-  }
-  
-  // Clears tree and insert a set of primitives
-	template<typename Tr>
-	template<typename ConstPrimitiveIterator, typename ... T>
-	void AABB_tree<Tr>::rebuild(ConstPrimitiveIterator first,
-                              ConstPrimitiveIterator beyond,
-                              T&& ... t)
-	{
-		// cleanup current tree and internal KD tree
-		clear();
-
-		// inserts primitives
-    insert(first, beyond,std::forward<T>(t)...);
-
-    build();
-	}  
-  #else
-  //=============constructor======================
-	template<typename Tr>
-	template<typename ConstPrimitiveIterator>
-	AABB_tree<Tr>::AABB_tree(ConstPrimitiveIterator first,
-                           ConstPrimitiveIterator beyond)
-		: m_traits()
-    , m_primitives()
-		, m_p_root_node(NULL)
-		, m_p_search_tree(NULL)
-		, m_search_tree_constructed(false)
-    , m_default_search_tree_constructed(false)
-    , m_need_build(false)
-	{
-		// Insert each primitive into tree
-    insert(first, beyond);
- 	}
-
-	template<typename Tr>
-	template<typename ConstPrimitiveIterator, typename T1>
-	AABB_tree<Tr>::AABB_tree(ConstPrimitiveIterator first,
-                           ConstPrimitiveIterator beyond,
-                           T1& t1)
-		: m_traits()
-    , m_primitives()
-		, m_p_root_node(NULL)
-		, m_p_search_tree(NULL)
-		, m_search_tree_constructed(false)
-    , m_default_search_tree_constructed(false)
-    , m_need_build(false)
-	{
-		// Insert each primitive into tree
-    insert(first, beyond,t1);
- 	}
-
-	template<typename Tr>
-	template<typename ConstPrimitiveIterator, typename T1, typename T2>
-	AABB_tree<Tr>::AABB_tree(ConstPrimitiveIterator first,
-                           ConstPrimitiveIterator beyond,
-                           T1& t1,T2& t2)
-		: m_traits()
-    , m_primitives()
-		, m_p_root_node(NULL)
-		, m_p_search_tree(NULL)
-		, m_search_tree_constructed(false)
-    , m_default_search_tree_constructed(false)
-    , m_need_build(false)
-	{
-		// Insert each primitive into tree
-    insert(first, beyond,t1,t2);
- 	}
-
-	template<typename Tr>
-	template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3>
-	AABB_tree<Tr>::AABB_tree(ConstPrimitiveIterator first,
-                           ConstPrimitiveIterator beyond,
-                           T1& t1,T2& t2,T3& t3)
-		: m_traits()
-    , m_primitives()
-		, m_p_root_node(NULL)
-		, m_p_search_tree(NULL)
-		, m_search_tree_constructed(false)
-    , m_default_search_tree_constructed(false)
-    , m_need_build(false)
-	{
-		// Insert each primitive into tree
-    insert(first, beyond,t1,t2,t3);
- 	}
-
-	template<typename Tr>
-	template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3, typename T4>
-	AABB_tree<Tr>::AABB_tree(ConstPrimitiveIterator first,
-                           ConstPrimitiveIterator beyond,
-                           T1& t1,T2& t2,T3& t3,T4& t4)
-		: m_traits()
-    , m_primitives()
-		, m_p_root_node(NULL)
-		, m_p_search_tree(NULL)
-		, m_search_tree_constructed(false)
-    , m_default_search_tree_constructed(false)
-    , m_need_build(false)
-	{
-		// Insert each primitive into tree
-    insert(first, beyond,t1,t2,t3,t4);
- 	}
-
-  template<typename Tr>
-	template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3, typename T4, typename T5>
-	AABB_tree<Tr>::AABB_tree(ConstPrimitiveIterator first,
-                           ConstPrimitiveIterator beyond,
-                           T1& t1,T2& t2,T3& t3,T4& t4,T5& t5)
-		: m_traits()
-    , m_primitives()
-		, m_p_root_node(NULL)
-		, m_p_search_tree(NULL)
-		, m_search_tree_constructed(false)
-    , m_default_search_tree_constructed(false)
-    , m_need_build(false)
-	{
-		// Insert each primitive into tree
-    insert(first, beyond,t1,t2,t3,t4,t5);
- 	}
-  //=============insert======================
-	template<typename Tr>
-	template<typename ConstPrimitiveIterator>
-	void AABB_tree<Tr>::insert(ConstPrimitiveIterator first,
-                             ConstPrimitiveIterator beyond)
-	{
-    set_shared_data();
-		while(first != beyond)
-		{
-			m_primitives.push_back(Primitive(first));
-			++first;
-		}
-    m_need_build = true;
-  }
-
-	template<typename Tr>
-	template<typename ConstPrimitiveIterator, typename T1>
-	void AABB_tree<Tr>::insert(ConstPrimitiveIterator first,
-                             ConstPrimitiveIterator beyond,
-                             T1& t1)
-	{
-    set_shared_data(t1);
-		while(first != beyond)
-		{
-			m_primitives.push_back(Primitive(first,t1));
-			++first;
-		}
-    m_need_build = true;
-  }
-  
-	template<typename Tr>
-	template<typename ConstPrimitiveIterator, typename T1, typename T2>
-	void AABB_tree<Tr>::insert(ConstPrimitiveIterator first,
-                             ConstPrimitiveIterator beyond,
-                             T1& t1, T2& t2)
-	{
-    set_shared_data(t1,t2);
-		while(first != beyond)
-		{
-			m_primitives.push_back(Primitive(first,t1,t2));
-			++first;
-		}
-    m_need_build = true;
-  }
-
-  template<typename Tr>
-	template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3>
-	void AABB_tree<Tr>::insert(ConstPrimitiveIterator first,
-                             ConstPrimitiveIterator beyond,
-                             T1& t1,T2& t2,T3& t3)
-	{
-    set_shared_data(t1,t2,t3);
-		while(first != beyond)
-		{
-			m_primitives.push_back(Primitive(first,t1,t2,t3));
-			++first;
-		}
-    m_need_build = true;
-  }
-
-  template<typename Tr>
-	template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3, typename T4>
-	void AABB_tree<Tr>::insert(ConstPrimitiveIterator first,
-                             ConstPrimitiveIterator beyond,
-                             T1& t1,T2& t2,T3& t3,T4& t4)
-	{
-    set_shared_data(t1,t2,t3,t4);
-		while(first != beyond)
-		{
-			m_primitives.push_back(Primitive(first,t1,t2,t3,t4));
-			++first;
-		}
-    m_need_build = true;
-  }
-
-  template<typename Tr>
-	template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3, typename T4, typename T5>
-	void AABB_tree<Tr>::insert(ConstPrimitiveIterator first,
-                             ConstPrimitiveIterator beyond,
-                             T1& t1,T2& t2,T3& t3,T4& t4,T5& t5)
-	{
-    set_shared_data(t1,t2,t3,t4,t5);
-		while(first != beyond)
-		{
-			m_primitives.push_back(Primitive(first,t1,t2,t3,t4,t5));
-			++first;
-		}
-    m_need_build = true;
-  }
-
-  //=============rebuild======================
-	template<typename Tr>
-	template<typename ConstPrimitiveIterator>
-	void AABB_tree<Tr>::rebuild(ConstPrimitiveIterator first,
-                              ConstPrimitiveIterator beyond)
-	{
-		// cleanup current tree and internal KD tree
-		clear();
-
-		// inserts primitives
-    insert(first, beyond);
-
-    build();
-	}
-
-	template<typename Tr>
-	template<typename ConstPrimitiveIterator, typename T1>
-	void AABB_tree<Tr>::rebuild(ConstPrimitiveIterator first,
-                              ConstPrimitiveIterator beyond,
-                              T1& t1)
-	{
-		// cleanup current tree and internal KD tree
-		clear();
-
-		// inserts primitives
-    insert(first, beyond,t1);
-
-    build();
-	}
-  
-	template<typename Tr>
-	template<typename ConstPrimitiveIterator, typename T1, typename T2>
-	void AABB_tree<Tr>::rebuild(ConstPrimitiveIterator first,
-                              ConstPrimitiveIterator beyond,
-                              T1& t1, T2& t2)
-	{
-		// cleanup current tree and internal KD tree
-		clear();
-
-		// inserts primitives
-    insert(first, beyond,t1,t2);
-
-    build();
-	}
-
-  template<typename Tr>
-	template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3>
-	void AABB_tree<Tr>::rebuild(ConstPrimitiveIterator first,
-                              ConstPrimitiveIterator beyond,
-                              T1& t1,T2& t2,T3& t3)
-	{
-		// cleanup current tree and internal KD tree
-		clear();
-
-		// inserts primitives
-    insert(first, beyond,t1,t2,t3);
-
-    build();
-	}
-
-  template<typename Tr>
-	template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3, typename T4>
-	void AABB_tree<Tr>::rebuild(ConstPrimitiveIterator first,
-                              ConstPrimitiveIterator beyond,
-                              T1& t1,T2& t2,T3& t3,T4& t4)
-	{
-		// cleanup current tree and internal KD tree
-		clear();
-
-		// inserts primitives
-    insert(first, beyond,t1,t2,t3,t4);
-
-    build();
-	}
-
-  template<typename Tr>
-	template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3, typename T4, typename T5>
-	void AABB_tree<Tr>::rebuild(ConstPrimitiveIterator first,
-                              ConstPrimitiveIterator beyond,
-                              T1& t1,T2& t2,T3& t3,T4& t4,T5& t5)
-	{
-		// cleanup current tree and internal KD tree
-		clear();
-
-		// inserts primitives
-    insert(first, beyond,t1,t2,t3,t4,t5);
-
-    build();
-	}
-  #endif
-
-	template<typename Tr>
-	void AABB_tree<Tr>::insert(const Primitive& p)
-	{
-    m_primitives.push_back(p);
-    m_need_build = true;
-  }
-
-	// Build the data structure, after calls to insert(..)
-	template<typename Tr>
-	void AABB_tree<Tr>::build()
-	{
-    clear_nodes();
-
-    if(m_primitives.size() > 1) {
-
-			// allocates tree nodes
-			m_p_root_node = new Node[m_primitives.size()-1]();
-			if(m_p_root_node == NULL)
-			{
-				std::cerr << "Unable to allocate memory for AABB tree" << std::endl;
-				CGAL_assertion(m_p_root_node != NULL);
-				m_primitives.clear();
-				clear();
-			}
-
-			// constructs the tree
-			m_p_root_node->expand(m_primitives.begin(), m_primitives.end(),
-														m_primitives.size(), m_traits);
-		}
-
-    // In case the users has switched on the accelerated distance query
-    // data structure with the default arguments, then it has to be
-    // rebuilt.
-    if(m_default_search_tree_constructed)
-      accelerate_distance_queries();
-
-    m_need_build = false;    
-	}
-
-
-	// constructs the search KD tree from given points
-	// to accelerate the distance queries
-	template<typename Tr>
-	template<typename ConstPointIterator>
-	bool AABB_tree<Tr>::accelerate_distance_queries_impl(ConstPointIterator first,
-		ConstPointIterator beyond) const
-	{
-		m_p_search_tree = new Search_tree(first, beyond);
-		if(m_p_search_tree != NULL)
-		{
-			m_search_tree_constructed = true;
-			return true;
-		}
-		else
-    {
-			std::cerr << "Unable to allocate memory for accelerating distance queries" << std::endl;
-			return false;
-    }
-	}
-
-	// constructs the search KD tree from internal primitives
-	template<typename Tr>
-	bool AABB_tree<Tr>::accelerate_distance_queries() const
-	{
-		if(m_primitives.empty()) return true;
-    #ifdef CGAL_HAS_THREADS
-    //this ensures that this function will be done once
-    CGAL_SCOPED_LOCK(kd_tree_mutex);
-    #endif
-
-    //we only redo computation only if needed 
-    if (!m_need_build && m_default_search_tree_constructed)
-      return m_search_tree_constructed;
-    
-		// iterate over primitives to get reference points on them
-		std::vector<Point_and_primitive_id> points;
-		points.reserve(m_primitives.size());
-		typename Primitives::const_iterator it;
-		for(it = m_primitives.begin(); it != m_primitives.end(); ++it)
-			points.push_back(
-        Point_and_primitive_id(
-          internal::Primitive_helper<AABB_traits>::get_reference_point(*it,m_traits), it->id()
-        )
-      );
-
-    // clears current KD tree
-    clear_search_tree();
-    m_default_search_tree_constructed = true;
-		return accelerate_distance_queries_impl(points.begin(), points.end());
-	}
-
-	template<typename Tr>
-	template<typename Query>
-	bool
-		AABB_tree<Tr>::do_intersect(const Query& query) const
-	{
-    using namespace CGAL::internal::AABB_tree;
-    typedef typename AABB_tree<Tr>::AABB_traits AABBTraits;
-		Do_intersect_traits<AABBTraits, Query> traversal_traits(m_traits);
-		this->traversal(query, traversal_traits);
-		return traversal_traits.is_intersection_found();
-	}
-
-	template<typename Tr>
-	template<typename Query>
-	typename AABB_tree<Tr>::size_type
-		AABB_tree<Tr>::number_of_intersected_primitives(const Query& query) const
-	{
-    using namespace CGAL::internal::AABB_tree;
-    using CGAL::internal::AABB_tree::Counting_output_iterator;
-    typedef typename AABB_tree<Tr>::AABB_traits AABBTraits;
-    typedef Counting_output_iterator<Primitive_id, size_type> Counting_iterator;
-
-    size_type counter = 0;
-    Counting_iterator out(&counter);
-
-		Listing_primitive_traits<AABBTraits, 
-      Query, Counting_iterator> traversal_traits(out,m_traits);
-		this->traversal(query, traversal_traits);
-		return counter;
-	}
-
-	template<typename Tr>
-	template<typename Query, typename OutputIterator>
-	OutputIterator
-		AABB_tree<Tr>::all_intersected_primitives(const Query& query,
-		OutputIterator out) const
-	{
-    using namespace CGAL::internal::AABB_tree;
-    typedef typename AABB_tree<Tr>::AABB_traits AABBTraits;
-		Listing_primitive_traits<AABBTraits, 
-      Query, OutputIterator> traversal_traits(out,m_traits);
-		this->traversal(query, traversal_traits);
-		return out;
-	}
-
-	template<typename Tr>
-	template<typename Query, typename OutputIterator>
-	OutputIterator
-		AABB_tree<Tr>::all_intersections(const Query& query,
-		OutputIterator out) const
-	{
-    using namespace CGAL::internal::AABB_tree;
-    typedef typename AABB_tree<Tr>::AABB_traits AABBTraits;
-		Listing_intersection_traits<AABBTraits, 
-      Query, OutputIterator> traversal_traits(out,m_traits);
-		this->traversal(query, traversal_traits);
-		return out;
-	}
-
-
-	template <typename Tr>
-	template <typename Query>
-  #if CGAL_INTERSECTION_VERSION < 2
-	boost::optional<typename AABB_tree<Tr>::Object_and_primitive_id>
-  #else
-  boost::optional< typename AABB_tree<Tr>::template Intersection_and_primitive_id<Query>::Type >
-  #endif
-		AABB_tree<Tr>::any_intersection(const Query& query) const
-	{
-    using namespace CGAL::internal::AABB_tree;
-    typedef typename AABB_tree<Tr>::AABB_traits AABBTraits;
-		First_intersection_traits<AABBTraits, Query> traversal_traits(m_traits);
-		this->traversal(query, traversal_traits);
-		return traversal_traits.result();
-	}
-
-	template <typename Tr>
-	template <typename Query>
-	boost::optional<typename AABB_tree<Tr>::Primitive_id>
-		AABB_tree<Tr>::any_intersected_primitive(const Query& query) const
-	{
-    using namespace CGAL::internal::AABB_tree;
-    typedef typename AABB_tree<Tr>::AABB_traits AABBTraits;
-		First_primitive_traits<AABBTraits, Query> traversal_traits(m_traits);
-		this->traversal(query, traversal_traits);
-		return traversal_traits.result();
-	}
-
-	// closest point with user-specified hint
-	template<typename Tr>
-	typename AABB_tree<Tr>::Point
-		AABB_tree<Tr>::closest_point(const Point& query,
-		const Point& hint) const
-	{
-		CGAL_precondition(!empty());
-		typename Primitive::Id hint_primitive = m_primitives[0].id();
-    using namespace CGAL::internal::AABB_tree;
-    typedef typename AABB_tree<Tr>::AABB_traits AABBTraits;
-		Projection_traits<AABBTraits> projection_traits(hint,hint_primitive,m_traits);
-		this->traversal(query, projection_traits);
-		return projection_traits.closest_point();
-	}
-
-	// closest point without hint, the search KD-tree is queried for the
-	// first closest neighbor point to get a hint
-	template<typename Tr>
-	typename AABB_tree<Tr>::Point
-		AABB_tree<Tr>::closest_point(const Point& query) const
-	{
-		CGAL_precondition(!empty());
-		const Point_and_primitive_id hint = best_hint(query);
-		return closest_point(query,hint.first);
-	}
-
-	// squared distance with user-specified hint
-	template<typename Tr>
-	typename AABB_tree<Tr>::FT
-		AABB_tree<Tr>::squared_distance(const Point& query,
-		const Point& hint) const
-	{
-		CGAL_precondition(!empty());
-		const Point closest = this->closest_point(query, hint);
-		return Tr().squared_distance_object()(query, closest);
-	}
-
-	// squared distance without user-specified hint
-	template<typename Tr>
-	typename AABB_tree<Tr>::FT
-		AABB_tree<Tr>::squared_distance(const Point& query) const
-	{
-		CGAL_precondition(!empty());
-		const Point closest = this->closest_point(query);
-		return Tr().squared_distance_object()(query, closest);
-	}
-
-	// closest point with user-specified hint
-	template<typename Tr>
-	typename AABB_tree<Tr>::Point_and_primitive_id
-		AABB_tree<Tr>::closest_point_and_primitive(const Point& query) const
-	{
-		CGAL_precondition(!empty());
-		return closest_point_and_primitive(query,best_hint(query));
-	}
-
-	// closest point with user-specified hint
-	template<typename Tr>
-	typename AABB_tree<Tr>::Point_and_primitive_id
-		AABB_tree<Tr>::closest_point_and_primitive(const Point& query,
-		const Point_and_primitive_id& hint) const
-	{
-		CGAL_precondition(!empty());
-    using namespace CGAL::internal::AABB_tree;
-    typedef typename AABB_tree<Tr>::AABB_traits AABBTraits;
-		Projection_traits<AABBTraits> projection_traits(hint.first,hint.second,m_traits);
-		this->traversal(query, projection_traits);
-		return projection_traits.closest_point_and_primitive();
-	}
-
-} // end namespace CGAL
-
-#endif // CGAL_AABB_TREE_H
-
-/***EMACS SETTINGS**    */
-/* Local Variables:     */
-/* tab-width: 2         */
-/* indent-tabs-mode: t  */
-/* End:                 */
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h b/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h
deleted file mode 100644
index 2e2d76d..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h
+++ /dev/null
@@ -1,2886 +0,0 @@
-// Copyright (c) 2006-2009 Max-Planck-Institute Saarbruecken (Germany).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Eric Berberich <eric at mpi-inf.mpg.de>
-//                 Pavel Emeliyanenko <asm at mpi-sb.mpg.de>
-//                 Michael Kerber <mkerber at mpi-inf.mpg.de>
-//
-// ============================================================================
-
-/*! \file Algebraic_curve_kernel_2.h
- *  \brief defines class \c Algebraic_curve_kernel_2
- *
- * A model for CGAL's AlgebraicKernelWithAnalysis_d_2 concept
- */
-
-#ifndef CGAL_ALGEBRAIC_CURVE_KERNEL_D_2_H
-#define CGAL_ALGEBRAIC_CURVE_KERNEL_D_2_H
-
-#include <limits>
-
-#include <CGAL/assertions.h>
-#include <boost/type_traits/is_same.hpp>
-#include <boost/optional.hpp>
-
-#include <CGAL/basic.h>
-#include <CGAL/config.h>
-#include <CGAL/array.h>
-#include <CGAL/Handle_with_policy.h>
-#include <CGAL/Algebraic_kernel_d/flags.h>
-#include <CGAL/Polynomial_traits_d.h>
-
-#include <CGAL/Algebraic_kernel_d/LRU_hashed_map.h>
-#include <CGAL/Algebraic_kernel_d/Xy_coordinate_2.h>
-#include <CGAL/Algebraic_kernel_d/Interval_evaluate_1.h>
-#include <CGAL/Algebraic_kernel_d/Interval_evaluate_2.h>
-
-#if CGAL_ACK_WITH_ROTATIONS
-#include <CGAL/Algebraic_curve_kernel_2/trigonometric_approximation.h>
-#endif
-
-#include <CGAL/Polynomial_type_generator.h>
-#include <CGAL/polynomial_utils.h>
-
-#if CGAL_ACK_USE_EXACUS
-#include <CGAL/Algebraic_curve_kernel_2/Curve_analysis_2_exacus.h>
-#include <CGAL/Algebraic_curve_kernel_2/Curve_pair_analysis_2_exacus.h>
-#else
-#include <CGAL/Algebraic_kernel_d/Curve_analysis_2.h>
-#include <CGAL/Algebraic_kernel_d/Curve_pair_analysis_2.h>
-#endif
-
-#include <boost/shared_ptr.hpp>
-
-
-namespace CGAL {
-
-
-/*!
- * \b Algebraic_curve_kernel_2 is a model of CGAL's concept \c
- * AlgebraicKernelWithAnalysis_d_2 which itself refines \c AlgebraicKernel_d_2.
- * As such, it contains functionality
- * for solving and manipulating (systems of) bivariate polynomials,
- * of arbitrary degree,
- * as required by the \c AlgebraicKernel_d_2 concept. 
- * Additionally, it contains functionality for the topological-geometric
- * analysis of a single algebraic curve 
- * (given as the vanishing set of the polynomial), 
- * and of a pair of curves (given as a pair of polynomials), as required by the
- * \c AlgebraicKernelWithAnalysis_d_2 concept. These two analyses are
- * available via the types \c Curve_analysis_2 and Curve_pair_analysis_2.
- *
- * The given class is also a model of the \c CurveKernel_2 concept that is
- * in turn required by the \c CurvedKernelViaAnalysis_2 concept
- * (see the documentation of the corresponding package). Therefore,
- * some types and methods of the class have both an "algebraic" name
- * (demanded by \c CurveKernelWithAnalysis_d_2) and an "non-algebraic name
- * (demanded by \c CurveKernel_2).
- *
- * \b Algebraic_curve_kernel_2 is a template class, and needs a model
- * of the \c AlgebraicKernel_d_1 concept as parameter.
- *
- * Internally, the curve- and curve-pair analysis 
- * are the computational fundament of the kernel. That means, whenever
- * a polynomial is considered within the kernel, the curve analysis
- * of the corresponding algebraic curve is performed.
- * The same holds for the curve pair analysis,
- * when a kernel function deals with two polynomials,
- * implicitly or explicitly (e.g. \c Solve_2, \c Sign_at_2).
- */
-#if CGAL_ACK_USE_EXACUS
-template < class AlgebraicCurvePair_2, class AlgebraicKernel_d_1 >
-#else
-template < class AlgebraicKernel_d_1 >
-#endif
-class Algebraic_curve_kernel_2 : public AlgebraicKernel_d_1{
-
-// for each predicate functor defines a member function returning an instance
-// of this predicate
-#define CGAL_Algebraic_Kernel_pred(Y,Z) \
-    Y Z() const { return Y((const Algebraic_kernel_d_2*)this); }
-
-// the same for construction functors
-#define CGAL_Algebraic_Kernel_cons(Y,Z) CGAL_Algebraic_Kernel_pred(Y,Z)
-
-protected:    
-    // temporary types
-    
-public:
-    //!\name public typedefs
-    //!@{
-
-    //! type of 1D algebraic kernel
-    typedef AlgebraicKernel_d_1 Algebraic_kernel_d_1;
-    
-#if CGAL_ACK_USE_EXACUS    
-    // type of an internal curve pair
-    typedef AlgebraicCurvePair_2 Internal_curve_pair_2;
-    
-    // type of an internal curve
-    typedef typename AlgebraicCurvePair_2::Algebraic_curve_2 Internal_curve_2;
-#endif
-
-    //! type of x-coordinate
-#if CGAL_ACK_USE_EXACUS
-    typedef typename Internal_curve_2::X_coordinate Algebraic_real_1;
-#else
-    typedef typename Algebraic_kernel_d_1::Algebraic_real_1 Algebraic_real_1;
-#endif
-
-    //! type of polynomial coefficient
-    typedef typename Algebraic_kernel_d_1::Coefficient Coefficient;
-
-    // myself
-#if CGAL_ACK_USE_EXACUS
-    typedef Algebraic_curve_kernel_2<AlgebraicCurvePair_2, AlgebraicKernel_d_1>
-       Self;
-#else
-    typedef Algebraic_curve_kernel_2<AlgebraicKernel_d_1> Self;
-#endif
-
-    typedef Self Algebraic_kernel_d_2;
-    
-    // Bound type
-    typedef typename Algebraic_kernel_d_1::Bound Bound;
-
-    typedef typename Algebraic_kernel_d_1::size_type size_type;
-    typedef typename Algebraic_kernel_d_1::Multiplicity_type Multiplicity_type;
-        
-    typedef typename CGAL::Get_arithmetic_kernel<Bound>::Arithmetic_kernel
-      Arithmetic_kernel;
-    
-    typedef typename Arithmetic_kernel::Bigfloat Bigfloat;
-    typedef typename Arithmetic_kernel::Bigfloat_interval Bigfloat_interval;
-    
-    //! Univariate polynomial type 
-    typedef typename Algebraic_kernel_d_1::Polynomial_1 Polynomial_1;
-    
-    //! Bivariate polynomial type
-    typedef typename CGAL::Polynomial_traits_d<Polynomial_1>
-    :: template Rebind<Coefficient,2>::Other::Type Polynomial_2;
-    
-    //! bivariate polynomial traits
-    typedef ::CGAL::Polynomial_traits_d< Polynomial_2 >
-        Polynomial_traits_2;
-
-    /*!
-     * \brief  type of a curve point, a model for the 
-     * \c AlgebraicKernel_d_2::AlgebraicReal_2 concept
-     */
-    typedef internal::Xy_coordinate_2<Self> Algebraic_real_2;
-
-    /*! 
-     * type of the curve analysis, a model for the
-     * \c AlgebraicKernelWithAnalysis_d_2::CurveAnalysis_2 concept
-     */
-#if CGAL_ACK_USE_EXACUS
-    typedef internal::Curve_analysis_2<Self> Curve_analysis_2; 
-#else
-    typedef CGAL::Curve_analysis_2<Self> Curve_analysis_2; 
-#endif
-
-    /*! 
-     * type of the curve pair analysis, a model for the
-     * \c AlgebraicKernelWithAnalysis_d_2::CurvePairAnalysis_2 concept
-     */
-#if CGAL_ACK_USE_EXACUS
-    typedef internal::Curve_pair_analysis_2<Self> Curve_pair_analysis_2;
-#else
-    typedef CGAL::Curve_pair_analysis_2<Self> Curve_pair_analysis_2;
-#endif
-
-    //! traits class used for approximations of y-coordinates
-
-
-    //  berfriending representations to make protected typedefs available
-    friend class internal::Curve_analysis_2_rep<Self>;
-    friend class internal::Curve_pair_analysis_2_rep<Self>;
-    
-    //!@}
-    //! \name rebind operator
-    //!@{
-#if CGAL_ACK_USE_EXACUS
-    template <class NewCurvePair, class NewAlgebraicKernel>
-    struct rebind {
-        typedef Algebraic_curve_kernel_2<NewCurvePair,NewAlgebraicKernel> 
-            Other;
-    };
-#else
-    template <class NewAlgebraicKernel> 
-    struct rebind { 
-        typedef Algebraic_curve_kernel_2<NewAlgebraicKernel> Other;        
-    };
-#endif
-
-    //!@}
-protected:
-    //! \name private functors
-    //!@{
- 
-#if 0
-   
-    //! polynomial canonicalizer, needed for the cache
-    template <class Poly> 
-    struct Poly_canonicalizer : public std::unary_function< Poly, Poly >
-    {
-    // use Polynomial_traits_d<>::Canonicalize ?
-        Poly operator()(Poly p) 
-        {
-            typedef CGAL::Scalar_factor_traits<Poly> Sf_traits;
-            typedef typename Sf_traits::Scalar Scalar;
-            typename Sf_traits::Scalar_factor scalar_factor;
-            typename Sf_traits::Scalar_div scalar_div;
-            Scalar g = scalar_factor(p);
-            if (g == Scalar(0)) {
-                     CGAL_assertion(p == Poly(Scalar(0)));
-                     return p;
-            }
-            CGAL_assertion(g != Scalar(0));
-            if(g != Scalar(1)) 
-                scalar_div(p,g);
-            if(CGAL::leading_coefficient(CGAL::leading_coefficient(p))) < 0) 
-                scalar_div(p,Scalar(-1));
-            return p;        
-        }
-           
-    };
-#endif
-
-    // NOT a curve pair in our notation, simply a std::pair of Curve_analysis_2
-    typedef std::pair<Curve_analysis_2, Curve_analysis_2> Pair_of_curves_2;
-    
-    //! orders pair items by ids
-    struct Pair_id_order {
-
-        template<class T1, class T2>
-        std::pair<T1, T2> operator()(const std::pair<T1, T2>& p) const {
-            
-            if(p.first.id() > p.second.id())
-                return std::make_pair(p.second, p.first);
-            return p;
-        }
-    };
-    
-    class Curve_creator {
-
-    public:
-
-        Curve_creator(Algebraic_kernel_d_2* kernel) : _m_kernel(kernel) {}
-        Curve_analysis_2 operator()(const Polynomial_2& f) const {
-          return Curve_analysis_2(_m_kernel,f);
-        }
-
-    protected:
-        
-        Algebraic_kernel_d_2* _m_kernel;
-        
-    };
-
-    template <class Result>
-    class Pair_creator {
-
-    public:
-
-        Pair_creator(Algebraic_kernel_d_2* kernel) : _m_kernel(kernel) {}
-
-        template<class T1, class T2>
-        Result operator()(const std::pair<T1, T2>& p) const {
-            return Result(_m_kernel, p.first, p.second);
-        }
-
-    protected:
-        
-        Algebraic_kernel_d_2* _m_kernel;
-        
-    };
-    
-    struct Pair_id_equal_to {
-
-        template <class T1, class T2>
-        bool operator()(const std::pair<T1, T2>& p1,
-                const std::pair<T1, T2>& p2) const {
-            return (p1.first.id() == p2.first.id() &&
-                 p1.second.id() == p2.second.id());
-        }
-    };
-
-    //! type of curve analysis cache
-    typedef internal::LRU_hashed_map_with_kernel<Self,Polynomial_2,
-        Curve_analysis_2, internal::Poly_hasher,
-        std::equal_to<Polynomial_2>,
-        typename Polynomial_traits_2::Canonicalize,
-        Curve_creator > Curve_cache_2;
-
-    //! type of curve pair analysis cache 
-    typedef internal::LRU_hashed_map_with_kernel<Self,Pair_of_curves_2,
-        Curve_pair_analysis_2, internal::Pair_hasher, Pair_id_equal_to,
-        Pair_id_order,
-        Pair_creator<Curve_pair_analysis_2> > Curve_pair_cache_2;
-    
-    typedef std::pair<Polynomial_2, Polynomial_2>
-        Pair_of_polynomial_2;
-
-    template<typename T> struct Gcd {
-    
-        T operator() (std::pair<T,T> pair) {
-            return typename CGAL::Polynomial_traits_d<Polynomial_2>
-                ::Gcd_up_to_constant_factor()(pair.first,pair.second);
-        }
-    } ;     
-
-
-    template<typename T> struct Pair_cannonicalize {
-    
-        std::pair<T,T> operator() (std::pair<T,T> pair) {
-        
-            if(pair.first > pair.second) 
-                return std::make_pair(pair.second,pair.first);
-            return pair;
-        }
-    };
-
-    typedef CGAL::Pair_lexicographical_less_than
-    <Polynomial_2, Polynomial_2,
-            std::less<Polynomial_2>,
-            std::less<Polynomial_2> > Polynomial_2_compare;
-    
-    //! Cache for gcd computations
-    typedef CGAL::Cache<Pair_of_polynomial_2,
-                        Polynomial_2,
-                        Gcd<Polynomial_2>,
-                        Pair_cannonicalize<Polynomial_2>,
-                        Polynomial_2_compare> Gcd_cache_2;
-
-    //!@}
-
-public:
-    //!\name cache access functions
-    //!@{
-                        
-    //! access to the gcd_cache
-    Gcd_cache_2& gcd_cache_2() const {
-        return *_m_gcd_cache_2;
-    }
-
-    //! access to the curve cache
-    Curve_cache_2& curve_cache_2() const 
-    {
-        return *_m_curve_cache_2;
-    }
-    
-    //! access to the curve pair cache
-    Curve_pair_cache_2& curve_pair_cache_2() const 
-    {
-        return *_m_curve_pair_cache_2;
-    }
-
-    // Composition of two unary functors
-    template<typename InnerFunctor,typename OuterFunctor>
-      class Unary_compose 
-      : public std::unary_function<typename InnerFunctor::argument_type,
-                                   typename OuterFunctor::result_type> {
-				     
-    public:
-	     
-       Unary_compose(const InnerFunctor& inner,
-		     const OuterFunctor& outer) 
-	 : _inner(inner), _outer(outer) {}
-	 
-       Unary_compose(const Unary_compose& other)
-	 : _inner(other._inner), _outer(other._outer) {}
-
-	 Unary_compose() : _inner(::boost::none),_outer(::boost::none) {}
-
-       typedef typename InnerFunctor::argument_type argument_type;
-       typedef typename OuterFunctor::result_type result_type;
-			     
-
-       result_type operator() (const argument_type& arg) const {
-	 CGAL_assertion(bool(_inner));
-	 CGAL_assertion(bool(_outer));
-	 return _outer.get()(_inner.get()(arg));
-       }
-    private:
-       ::boost::optional<InnerFunctor> _inner;
-       ::boost::optional<OuterFunctor> _outer;
-    };
-
-    template<typename InnerFunctor,typename OuterFunctor>
-      Unary_compose<InnerFunctor,OuterFunctor>
-      unary_compose(const InnerFunctor& inner, const OuterFunctor& outer) 
-      const {
-      return Unary_compose<InnerFunctor,OuterFunctor>(inner, outer);
-    }
-
-
-    //!@}
-    //! \name public functors and predicates
-    //!@{
-       
-                
-public:
-    //! \brief default constructor 
-    Algebraic_curve_kernel_2() 
-      : _m_gcd_cache_2(new Gcd_cache_2())
-    {  
-      _m_curve_cache_2 = boost::shared_ptr<Curve_cache_2>(new Curve_cache_2(this)); 
-      _m_curve_pair_cache_2 =  boost::shared_ptr<Curve_pair_cache_2> (new Curve_pair_cache_2(this)); 
-      // std::cout << "CONSTRUCTION  Algebraic_curve_kernel_2 " << std::endl; 
-    }
-    
-public: 
-    static Algebraic_curve_kernel_2& get_static_instance(){
-      // a default constructed ack_2 instance
-      static Algebraic_curve_kernel_2 ack_2_instance;
-      return ack_2_instance;
-    }
-
-    /*! \brief
-     * constructs \c Curve_analysis_2 from bivariate polynomial, uses caching
-     * when appropriate
-     */
-    class Construct_curve_2 :
-        public std::unary_function< Polynomial_2, Curve_analysis_2 > {
-
-    public:
-
-        Construct_curve_2(const Algebraic_kernel_d_2* kernel) : _m_kernel(kernel) {}
-            
-#if CGAL_ACK_WITH_ROTATIONS
-
-        Curve_analysis_2 operator()(const Polynomial_2& f, 
-                                    Bound angle,
-                                    long final_prec) {
-            
-#if CGAL_ACK_DEBUG_FLAG
-            CGAL_ACK_DEBUG_PRINT << "angle=" << angle << std::endl;
-            CGAL_ACK_DEBUG_PRINT << "final_prec=" << final_prec << std::endl;
-#endif          
-            std::pair<Bound,Bound> sin_cos
-                = approximate_sin_and_cos_of_angle(angle,final_prec);
-
-            Bound sine = sin_cos.first, cosine = sin_cos.second;            
-
-            
-            typedef typename CGAL::Polynomial_traits_d<Polynomial_2>
-                ::template Rebind<Bound,1>::Other::Type
-                Poly_rat_1;
-
-            typedef typename CGAL::Polynomial_traits_d<Polynomial_2>
-                ::template Rebind<Bound,2>::Other::Type
-                Poly_rat_2;
-
-            Poly_rat_2 
-                sub_x(Poly_rat_1(Bound(0), cosine), Poly_rat_1(sine)), 
-                    sub_y(Poly_rat_1(Bound(0), -sine), Poly_rat_1(cosine)), 
-                res;
-            
-            std::vector<Poly_rat_2> subs;
-            subs.push_back(sub_x);
-            subs.push_back(sub_y);
-            
-            res = typename CGAL::Polynomial_traits_d<Polynomial_2>
-                ::Substitute() (f, subs.begin(), subs.end());
-
-            CGAL::simplify(res);
-            
-            // integralize polynomial
-            typedef CGAL::Fraction_traits<Poly_rat_2> FT;
-            typename FT::Denominator_type dummy;
-            Polynomial_2 num;
-            typename FT::Decompose()(res, num, dummy);
-
-#if CGAL_ACK_DEBUG_FLAG
-            CGAL_ACK_DEBUG_PRINT << "integralized poly: " << num << std::endl; 
-#endif
-            
-            return _m_kernel->curve_cache_2()(num);
-        }
-
-#endif //CGAL_ACK_WITH_ROTATIONS
-      Curve_analysis_2 operator()
-        (const Polynomial_2& f) const {
-        return _m_kernel->curve_cache_2()(f);
-      }
-
-    protected:
-
-        const Algebraic_kernel_d_2* _m_kernel;
-        
-
-    };
-    CGAL_Algebraic_Kernel_cons(Construct_curve_2, construct_curve_2_object);
-
-    /*! \brief
-     * constructs \c Curve_pair_analysis_2 from pair of one curve analyses,
-     * caching is used when appropriate
-     */
-    class Construct_curve_pair_2 :
-            public std::binary_function<Curve_analysis_2, Curve_analysis_2,
-                Curve_pair_analysis_2> {
-
-    public:
-
-        Construct_curve_pair_2(const Algebraic_kernel_d_2* kernel) 
-            : _m_kernel(kernel) {}
-           
-        Curve_pair_analysis_2 operator()
-           (const Curve_analysis_2& ca1, const Curve_analysis_2& ca2) const {
-                
-            Curve_pair_analysis_2 cpa_2 =
-                _m_kernel->curve_pair_cache_2()(std::make_pair(ca1, ca2));
-            return cpa_2;
-        }
-
-    protected:
-
-        const Algebraic_kernel_d_2* _m_kernel;
-
-    };
-    CGAL_Algebraic_Kernel_cons(Construct_curve_pair_2,
-        construct_curve_pair_2_object);
-
-    class Construct_algebraic_real_2 {
-
-    private:
-
-      Curve_analysis_2 _construct_defining_polynomial_from(Bound b) const {
-	typedef CGAL::Fraction_traits<Bound> FT;
-	// We rely on the fact that the Bound is a fraction
-	CGAL_static_assertion((::boost::is_same<typename FT::Is_fraction,
-			                     CGAL::Tag_true>::value));
-	typedef typename FT::Numerator_type Numerator;
-	typedef typename FT::Denominator_type Denominator;
-	typedef CGAL::Coercion_traits<Numerator,Coefficient> Num_coercion;
-	CGAL_static_assertion((::boost::is_same
-			      <Coefficient,
-   			       typename Num_coercion::Type>::value));
-	typedef CGAL::Coercion_traits<Denominator,Coefficient> Denom_coercion;
-	CGAL_static_assertion((::boost::is_same
-			       <Coefficient,
-			        typename Denom_coercion::Type>::value));
-	typename Num_coercion::Cast num_cast;
-	typename Denom_coercion::Cast denom_cast;
-	typename FT::Decompose decompose;
-	
-	Numerator num_uncasted;
-	Denominator denom_uncasted;
-	decompose(b,num_uncasted,denom_uncasted);
-
-	Coefficient num = num_cast(num_uncasted);
-	Coefficient denom = denom_cast(denom_uncasted);
-
-	typedef CGAL::Exponent_vector Exponent;
-	std::pair<Exponent,Coefficient> coeffs[2] 
-	  = {std::make_pair(Exponent(0,0),num),
-	     std::make_pair(Exponent(0,1),-denom)};
-	Polynomial_2 pol = typename Polynomial_traits_2
-	  ::Construct_polynomial()(coeffs,coeffs+2);
-	return _m_kernel->construct_curve_2_object()(pol);
-      }
-	
-      Curve_analysis_2 _construct_defining_polynomial_from
-	(typename CGAL::First_if_different<Coefficient,Bound>::Type c) const {
-	typedef CGAL::Exponent_vector Exponent;
-	std::pair<Exponent,Coefficient> coeffs[2] 
-	  = {std::make_pair(Exponent(0,0),c),std::make_pair(Exponent(0,1),-1)};
-	Polynomial_2 pol = typename Polynomial_traits_2
-	  ::Construct_polynomial()(coeffs,coeffs+2);
-	return _m_kernel->construct_curve_2_object()(pol);
-      }
-
-
-    public:
-      
-      typedef Algebraic_real_2 result_type;
-
-      Construct_algebraic_real_2(const Algebraic_kernel_d_2* kernel) 
-	: _m_kernel(kernel) {}
-	
-
-      result_type operator() (int x,int y) const {
-	return this->operator()(Bound(x),Bound(y));
-      }
-
-      result_type operator() (Bound x,Bound y) const {
-	Algebraic_real_1 x_alg 
-	  = _m_kernel->construct_algebraic_real_1_object()(x);
-	Curve_analysis_2 ca
-	  = this->_construct_defining_polynomial_from(y);
-	return Algebraic_real_2(x_alg,ca,0);
-      }
-
-      result_type operator() 
-	(typename CGAL::First_if_different<Coefficient,Bound>::Type x,
-	 typename CGAL::First_if_different<Coefficient,Bound>::Type y) const {
-	Algebraic_real_1 x_alg 
-	  = _m_kernel->construct_algebraic_real_1_object()(x);
-	Curve_analysis_2 ca 
-	  = this->_construct_defining_polynomial_from(y);
-	return Algebraic_real_2(x_alg,ca,0);
-      }
-      
-      result_type operator() (Algebraic_real_1 x, Algebraic_real_1 y) const {
-	std::vector< Algebraic_real_1> roots;
-	Polynomial_1 y_pol =_m_kernel->compute_polynomial_1_object()(y); 
-	_m_kernel->solve_1_object()(y_pol,true,std::back_inserter(roots));
-	std::pair<typename std::vector< Algebraic_real_1>::iterator,
-            	  typename std::vector< Algebraic_real_1>::iterator>
-	  it_pair = std::equal_range(roots.begin(),roots.end(),y);
-	CGAL_assertion(std::distance(it_pair.first,it_pair.second)==1);
-	int index = std::distance(roots.begin(),it_pair.first);
-	
-	int degree = CGAL::degree(y_pol);
-	std::vector<std::pair<CGAL::Exponent_vector,Coefficient> > coeffs;
-	for(int i=0;i<=degree;i++) {
-	  Coefficient c = CGAL::get_coefficient(y_pol,i);
-	  coeffs.push_back(std::make_pair(CGAL::Exponent_vector(0,i),c));
-	}
-	Polynomial_2 y_pol_in_xy
-	  = typename Polynomial_traits_2::Construct_polynomial()
-	      (coeffs.begin(),coeffs.end());
-	Curve_analysis_2 ca 
-	  = _m_kernel->construct_curve_2_object()(y_pol_in_xy);
-	return Algebraic_real_2(x,ca,index);
-      }
-      
-      result_type operator() (Polynomial_2 f,Polynomial_2 g,size_type i) 
-	const {
-	CGAL_precondition(_m_kernel->is_square_free_2_object()(f));
-	CGAL_precondition(_m_kernel->is_square_free_2_object()(g));
-	CGAL_precondition(_m_kernel->is_coprime_2_object()(f,g));
-	std::vector<std::pair<Algebraic_real_2,Multiplicity_type> > roots;
-	this->_m_kernel->solve_2_object()(f,g,std::back_inserter(roots));
-	CGAL_assertion(roots.size()>static_cast<size_t>(i));
-	return roots[i].first;
-      }
-
-      result_type operator() (Polynomial_2 f,Polynomial_2 g,
-			      Bound x_l, Bound x_u, 
-			      Bound y_l, Bound y_u) const {
-	CGAL_precondition(x_l<x_u);
-	CGAL_precondition(y_l<y_u);
-	CGAL_precondition(_m_kernel->is_square_free_2_object()(f));
-	CGAL_precondition(_m_kernel->is_square_free_2_object()(g));
-	CGAL_precondition(_m_kernel->is_coprime_2_object()(f,g));
-	std::vector<std::pair<Algebraic_real_2,Multiplicity_type> > roots;
-	this->_m_kernel->solve_2_object()(f,g,x_l,x_u,y_l,y_u,
-					 std::back_inserter(roots));
-	CGAL_precondition(roots.size()==1);
-	CGAL_precondition(_m_kernel->compare_x_2_object()(roots[0].first,x_l)
-          	          == CGAL::LARGER);
-	CGAL_precondition(_m_kernel->compare_x_2_object()(roots[0].first,x_u)
-          	          == CGAL::SMALLER);
-	CGAL_precondition(_m_kernel->compare_y_2_object()(roots[0].first,y_l)
-          	          == CGAL::LARGER);
-	CGAL_precondition(_m_kernel->compare_y_2_object()(roots[0].first,y_u)
-          	          == CGAL::SMALLER);
-	return roots[0].first;
-      }
-
-      // These are not part of the concept, but used internally
-
-      result_type operator() (Algebraic_real_1 x,int y) const {
-	return this->operator()(x,Bound(y));
-      }
-
-      result_type operator() (Algebraic_real_1 x,Bound y) const {
-	Curve_analysis_2 ca 
-	  = this->_construct_defining_polynomial_from(y);
-	return Algebraic_real_2(x,ca,0);
-      }
-
-      result_type operator() 
-	(Algebraic_real_1 x,
-	 typename CGAL::First_if_different<Coefficient,Bound>::Type y) const {
-	Curve_analysis_2 ca 
-	  = this->_construct_defining_polynomial_from(y);
-	return Algebraic_real_2(x,ca,0);
-      }
-      
-
-    protected:
-      const Algebraic_kernel_d_2* _m_kernel;
-
-    };
-    CGAL_Algebraic_Kernel_cons(Construct_algebraic_real_2, 
-			       construct_algebraic_real_2_object);
-      
-
-    
-    class Compute_polynomial_x_2 :
-      public std::unary_function<Algebraic_real_2, Polynomial_1> {
-
-    public:
-
-      Compute_polynomial_x_2(const Algebraic_kernel_d_2* kernel) 
-	: _m_kernel(kernel) {}
-	  
-      Polynomial_1 operator()(const Algebraic_real_2& xy) const {
-	return _m_kernel->compute_polynomial_1_object()(xy.x());
-      }
-
-    protected:
-        
-      const Algebraic_kernel_d_2* _m_kernel;
-
-    };
-    CGAL_Algebraic_Kernel_cons(Compute_polynomial_x_2, 
-			       compute_polynomial_x_2_object);
-
-    class Compute_polynomial_y_2 :
-      public std::unary_function<Algebraic_real_2, Polynomial_1> {
-
-    public:
-
-      Compute_polynomial_y_2(const Algebraic_kernel_d_2* kernel) 
-	: _m_kernel(kernel) {}
-	  
-      Polynomial_1 operator()(const Algebraic_real_2& xy) const {
-	return _m_kernel->compute_polynomial_1_object()(xy.y());
-      }
-
-    protected:
-        
-      const Algebraic_kernel_d_2* _m_kernel;
-
-    };
-    CGAL_Algebraic_Kernel_cons(Compute_polynomial_y_2, 
-			       compute_polynomial_y_2_object);
-
-
-    class Isolate_x_2 : public std::binary_function<Algebraic_real_2,
-                                                    Polynomial_1,
-                                                    std::pair<Bound,Bound> > {
-      
-    public:
-
-      Isolate_x_2(const Algebraic_kernel_d_2* kernel) 
-	: _m_kernel(kernel) {}
-	  
-	std::pair<Bound,Bound> operator()(Algebraic_real_2 a,
-					  Polynomial_1 p) const {
-	  return _m_kernel->isolate_1_object()
-	    (_m_kernel->compute_x_2_object()(a),p);
-	}
-    
-    protected:
-        
-      const Algebraic_kernel_d_2* _m_kernel;
-
-    };
-    CGAL_Algebraic_Kernel_cons(Isolate_x_2, 
-			       isolate_x_2_object);
-
-    class Isolate_y_2 : public std::binary_function<Algebraic_real_2,
-                                                    Polynomial_1,
-                                                    std::pair<Bound,Bound> > {
-      
-    public:
-
-      Isolate_y_2(const Algebraic_kernel_d_2* kernel) 
-	: _m_kernel(kernel) {}
-	  
-	std::pair<Bound,Bound> operator()(Algebraic_real_2 a,
-					  Polynomial_1 p) const {
-	  // Note: One can avoid to compute the y-coordinate:
-	  // 1.) Construct a Polynomial_2 out of p (with no x-variable)
-	  // 2.) Check whether a lies on p
-	  // 3.) If no, approx the y-coordinate until it is isolated
-	  //     from all roots of p
-	  // 4.) If yes, return the isolating interval of the
-	  //     corresponding roots of p
-	  // 
-	  // It is not clear, however, whether this is less expensive,
-	  // especially if p has high degree
-	  return _m_kernel->isolate_1_object()
-	    (_m_kernel->compute_y_2_object()(a),p);
-	}
-    
-    protected:
-        
-      const Algebraic_kernel_d_2* _m_kernel;
-
-    };
-    CGAL_Algebraic_Kernel_cons(Isolate_y_2, 
-			       isolate_y_2_object);
-
-    class Isolate_2 {
-      
-    public:
-
-      typedef CGAL::cpp11::array<Bound,4> result_type;
-
-      Isolate_2(const Algebraic_kernel_d_2* kernel) 
-	: _m_kernel(kernel) {}
-	  
-    protected:
-
-      // refines the approximation of a until the box is away from all
-      // common solutions of f and g
-      result_type _approx_interval(Algebraic_real_2 a,
-				   Polynomial_2 f,
-				   Polynomial_2 g) const {
-	CGAL_precondition(!_m_kernel->is_zero_at_2_object()(f,a));
-        
-        typename Algebraic_curve_kernel_2::Approximate_absolute_x_2
-	  approx_x = _m_kernel->approximate_absolute_x_2_object();
-	typename Algebraic_curve_kernel_2::Approximate_absolute_y_2
-	  approx_y = _m_kernel->approximate_absolute_y_2_object();
-        
-        typedef CGAL::internal::Interval_evaluate_2< Polynomial_2, Bound > 
-          Interval_evaluate_2;
-        typedef typename Interval_evaluate_2::result_type 
-          Interval_result_type;
-        Interval_evaluate_2 interval_evaluate_2;
-
-        long prec = 4;
-        
-	while(true) {
-	  std::pair<Bound,Bound> x_pair = approx_x(a,prec);
-	  std::pair<Bound,Bound> y_pair = approx_y(a,prec);
-	  result_type curr_box = CGAL::make_array(x_pair.first,
-						  x_pair.second,
-						  y_pair.first,
-						  y_pair.second);
-	  Interval_result_type eval_f = interval_evaluate_2(f,curr_box);
-	  if((CGAL::sign(eval_f.first)==CGAL::sign(eval_f.second)) &&
-	     (CGAL::sign(eval_f.first)!=CGAL::ZERO)) {
-	    return curr_box;
-	  } 
-	  Interval_result_type eval_g = interval_evaluate_2(g,curr_box);
-	  if((CGAL::sign(eval_g.first)==CGAL::sign(eval_g.second)) &&
-	     (CGAL::sign(eval_g.first)!=CGAL::ZERO)) {
-	    return curr_box;
-	  } 
-	  prec*=2;
-	  
-	}
-      }
-
-    public:
-
-      result_type operator()(Algebraic_real_2 a,
-			     Polynomial_2 f) const {
-	return this->_approx_interval(a,f,Polynomial_2(Coefficient(0)));
-      }
-	
-
-      result_type operator()(Algebraic_real_2 a,
-			     Polynomial_2 f,
-			     Polynomial_2 g) const {
-
-	Curve_analysis_2 ca1 = _m_kernel->construct_curve_2_object()(f);
-	Curve_analysis_2 ca2 = _m_kernel->construct_curve_2_object()(g);
-	Curve_pair_analysis_2 cpa_2
-	  = _m_kernel->construct_curve_pair_2_object()(ca1,ca2);
-	int idx; bool event;
-	cpa_2.x_to_index(_m_kernel->compute_x_2_object()(a),idx,event);
-	if(! event) { // No critical point, no intersection
-	  return this->_approx_interval(a,f,g);
-	}
-	std::vector<std::pair<Algebraic_real_2,Multiplicity_type> > roots;
-	_m_kernel->solve_at_x_2_object()(cpa_2,idx,std::back_inserter(roots));
-	if(roots.size()==0) {
-	  // easy case: No intersection at a's x-coordinate:
-	  return this->_approx_interval(a,f,g);
-	}
-	// Check whether a is really an intersection
-	if(!_m_kernel->is_zero_at_2_object()(f,a)) {
-	  return this->operator()(a,f); 
-	}
-	if(!_m_kernel->is_zero_at_2_object()(g,a)) {
-	  return this->operator()(a,g);
-	}
-	// At this point, a is a common solution of f and g, it must
-	// be one of the points in roots
-	// Isolating x-interval is immediately available from CPA:
-	Bound xl = cpa_2.bound_value_in_interval(idx),
-	  xu  = cpa_2.bound_value_in_interval(idx+1);
-	// Often, there is just one point, so filter this easy case
-	if(roots.size()==1) {
-	  // Any y-interval containing roots[0].first is isolating
-	  std::pair<Bound,Bound> y_pair 
-	    = _m_kernel->approximate_absolute_y_2_object()(roots[0].first,4);
-	  return CGAL::make_array(xl,xu,y_pair.first,y_pair.second);
-	} else { 
-	  // more work! We should not assume that each
-	  // roots[i].first has f or g as defining polynomial, because
-	  // the representation might have been simplifed
-
-	  // Here's the safe way: Take the simpler of the curves
-	  // (but the one without vertical component!)
-	  Curve_analysis_2 ca;
-	  typedef typename Curve_analysis_2::Status_line_1 Status_line_CA_1;
-	  Status_line_CA_1 status_line;
-	  Status_line_CA_1 status_line1
-	    = ca1.status_line_at_exact_x(_m_kernel->compute_x_2_object()(a));
-	  Status_line_CA_1 status_line2
-	    = ca2.status_line_at_exact_x(_m_kernel->compute_x_2_object()(a));
-	  if(status_line1.covers_line()) {
-	    ca=ca2;
-	    status_line=status_line2;
-	  } else if(status_line2.covers_line()) {
-	    ca=ca1;
-	    status_line=status_line1;
-	  } else if(CGAL::total_degree(f)<CGAL::total_degree(g)) {
-	    ca=ca1;
-	    status_line=status_line1;
-	  } else {
-	    ca=ca2;
-	    status_line=status_line2;
-	  }
-	  // binary search is possible, but does not help here,
-	  // since the Curve_pair_analysis is the costly operation
-	  for(int i=0; i<status_line.number_of_events();i++) {
-	    if(status_line.algebraic_real_2(i)==a) {
-	      // Now, we can simply take the isolating interval
-	      return CGAL::make_array(xl,xu,
-				      status_line.lower_bound(i),
-				      status_line.upper_bound(i));
-	    }
-	  }
-	  
-	  CGAL_error_msg("Bug in Isolate_2, please contact developers"); 
-	  // We should never reach this point
-	
-	}
-	// Never reached, but make pedantics happy
-	return CGAL::make_array(Bound(0),Bound(0),Bound(0),Bound(0));
-      }
-
-    protected:
-        
-      const Algebraic_kernel_d_2* _m_kernel;
-
-    };
-    CGAL_Algebraic_Kernel_cons(Isolate_2, 
-			       isolate_2_object);
-
-            
-    //! returns the x-coordinate of an \c Algebraic_real_2 object
-    class Compute_x_2 :
-        public std::unary_function<Algebraic_real_2, Algebraic_real_1> {
-
-    public:
-
-        Compute_x_2(const Algebraic_kernel_d_2* kernel) 
-            : _m_kernel(kernel) {}
-        
-        Algebraic_real_1 operator()(const Algebraic_real_2& xy) const {
-            return xy.x();
-        }
-
-    protected:
-        
-        const Algebraic_kernel_d_2* _m_kernel;
-
-    };
-    CGAL_Algebraic_Kernel_cons(Compute_x_2, compute_x_2_object);
-    
-#if CGAL_AK_ENABLE_DEPRECATED_INTERFACE
-    typedef Compute_x_2 Get_x_2;
-    CGAL_Algebraic_Kernel_cons(Get_x_2, get_x_2_object);
-#endif
-
-    /*! 
-     * \brief returns the y-coordinate of \c Algebraic_real_2 object
-     *
-     * \attention{This method returns the y-coordinate in isolating interval
-     * representation. Calculating such a representation is usually a time-
-     * consuming taks, since it is against the "y-per-x"-view that we take
-     * in our kernel. Therefore, it is recommended, if possible,
-     *  to use the functors
-     * \c Approximate_absolute_y_2 and \c Approximate_relative_y_2 that 
-     * return approximation of the y-coordinate. 
-     */
-    class Compute_y_2 :
-        public std::unary_function<Algebraic_real_2, Algebraic_real_1> {
-        
-    public:
-        
-        Compute_y_2(const Algebraic_kernel_d_2* kernel) 
-            : _m_kernel(kernel) {}
-
-        Algebraic_real_1 operator()(const Algebraic_real_2& xy) const {
-            return xy.y();
-        }
-    protected:
-        
-        const Algebraic_kernel_d_2* _m_kernel;
-
-    };
-    CGAL_Algebraic_Kernel_cons(Compute_y_2, compute_y_2_object);
-    
-#if CGAL_AK_ENABLE_DEPRECATED_INTERFACE
-    typedef Compute_x_2 Get_y_2;
-    CGAL_Algebraic_Kernel_cons(Get_y_2, get_y_2_object);
-#endif
-
-    class Approximate_absolute_x_2 
-    : public std::binary_function<Algebraic_real_2,int,std::pair<Bound,Bound> >{
-    
-    public:
-
-        Approximate_absolute_x_2(const Algebraic_kernel_d_2* kernel) 
-            : _m_kernel(kernel) {}
-
-        std::pair<Bound,Bound> operator() (Algebraic_real_2 xy,
-                                    int prec) const {
-            Compute_x_2 get_x = _m_kernel->compute_x_2_object();
-            return _m_kernel->approximate_absolute_1_object() 
-	      (get_x(xy),prec);
-        }
-
-    protected:
-        
-        const Algebraic_kernel_d_2* _m_kernel;
-        
-    };
-    CGAL_Algebraic_Kernel_cons(Approximate_absolute_x_2, 
-                               approximate_absolute_x_2_object);
-
-    class Approximate_relative_x_2 
-    : public std::binary_function<Algebraic_real_2,int,std::pair<Bound,Bound> >{
-    
-    public:
-        
-        Approximate_relative_x_2(const Algebraic_kernel_d_2* kernel) 
-            : _m_kernel(kernel) {}
-
-        std::pair<Bound,Bound> operator() (Algebraic_real_2 xy,
-                                           int prec) const {
-            Compute_x_2 get_x = _m_kernel->compute_x_2_object();
-            return _m_kernel->approximate_relative_1_object() (get_x(xy),prec);
-        }
-
-    protected:
-        
-        const Algebraic_kernel_d_2* _m_kernel;
-
-    };
-    CGAL_Algebraic_Kernel_cons(Approximate_relative_x_2, 
-                               approximate_relative_x_2_object);
-
-    class Approximate_absolute_y_2 
-    : public std::binary_function<Algebraic_real_2,int,std::pair<Bound,Bound> >{
-
-    public:
-
-        Approximate_absolute_y_2(const Algebraic_kernel_d_2* kernel) 
-            : _m_kernel(kernel) {}
-        
-        std::pair<Bound,Bound> operator() (Algebraic_real_2 xy,
-                                    int prec) const {
-            
-            Bound l = xy.lower_bound_y();  
-            Bound u = xy.upper_bound_y();
-            Bound error = CGAL::ipower(Bound(2),CGAL::abs(prec));
-            while((u-l)*error>Bound(1)) {
-                xy.refine_y();
-                u = xy.upper_bound_y();
-                l = xy.lower_bound_y();
-          }
-          return std::make_pair(l,u);
-        }
-    
-    protected:
-
-        const Algebraic_kernel_d_2* _m_kernel;
-
-    };
-    CGAL_Algebraic_Kernel_cons(Approximate_absolute_y_2, 
-                               approximate_absolute_y_2_object);
-
-    class Approximate_relative_y_2 
-    : public std::binary_function<Algebraic_real_2,int,std::pair<Bound,Bound> >{
-        
-    public:
-        
-        Approximate_relative_y_2(const Algebraic_kernel_d_2* kernel) 
-            : _m_kernel(kernel) {}
-
-        std::pair<Bound,Bound> operator() (Algebraic_real_2 xy,
-                                           int prec) const {
-            if(xy.is_y_zero()) {
-                return std::make_pair(Bound(0),Bound(0));
-            }
-            while(CGAL::sign(xy.lower_bound_y())*CGAL::sign(xy.upper_bound_y())
-                  !=CGAL::POSITIVE) {
-                xy.refine_y();
-            }
-            Bound l = xy.lower_bound_y();  
-            Bound u = xy.upper_bound_y();
-            Bound error = CGAL::ipower(Bound(2),CGAL::abs(prec));
-            Bound min_b = (CGAL::min)(CGAL::abs(u),CGAL::abs(l));
-            while((prec>0)?((u-l)*error>min_b):((u-l)>error*min_b)){
-                xy.refine_y();
-                u = xy.upper_bound_y();
-                l = xy.lower_bound_y();
-                min_b = (CGAL::min)(CGAL::abs(u),CGAL::abs(l));
-          }
-          return std::make_pair(l,u);
-        }
-
-    protected:
-
-        const Algebraic_kernel_d_2* _m_kernel;
-
-    };
-    CGAL_Algebraic_Kernel_cons(Approximate_relative_y_2, 
-                               approximate_relative_y_2_object);
-
-    
-    /*! 
-     * \brief returns a value of type \c Bound that lies between
-     * the x-coordinates of the \c Algebraic_real_2s.
-     *
-     * \pre{The x-coordinates must not be equal}
-     */
-    class Bound_between_x_2 {
-
-    public:
-        
-        Bound_between_x_2(const Algebraic_kernel_d_2* kernel) 
-            : _m_kernel(kernel) {}
-       
-        typedef Algebraic_real_2 first_argument_type;
-        typedef Algebraic_real_2 second_argument_type;
-        typedef Bound result_type;
-            
-        result_type operator()(const Algebraic_real_2& r1, 
-                const Algebraic_real_2& r2) const {
- 	  return this->_m_kernel->bound_between_1_object()
-                (r1.x(), r2.x());
-        }
-
-    protected:
-
-        const Algebraic_kernel_d_2* _m_kernel;
-
-    };
-    CGAL_Algebraic_Kernel_cons(Bound_between_x_2, 
-            bound_between_x_2_object);
-            
-    /*! 
-     * \brief returns a value of type \c Bound that lies between
-     * the y-coordinates of the \c Algebraic_real_2s.
-     *
-     * \pre{The y-coordinates must not be equal}
-     */
-    class Bound_between_y_2 {
-       
-    public:
-        
-        Bound_between_y_2(const Algebraic_kernel_d_2* kernel) 
-            : _m_kernel(kernel) {}
-
-        typedef Algebraic_real_2 first_argument_type;
-        typedef Algebraic_real_2 second_argument_type;
-        typedef Bound result_type;
-
-	typedef typename Algebraic_kernel_d_2::Curve_analysis_2
-	  ::Status_line_1::Bitstream_descartes Isolator;
-
-        result_type operator()(const Algebraic_real_2& r1, 
-                const Algebraic_real_2& r2) const {
-
-            CGAL_precondition(r1.y() != r2.y());
-
-            Bound res(0);
-
-            Isolator isol1 =
-                r1.curve().status_line_at_exact_x(r1.x()).isolator();
-
-            Isolator isol2 =
-                r2.curve().status_line_at_exact_x(r2.x()).isolator();
-            
-            Bound low1, low2, high1, high2;
-            
-            while (true) {
-                low1 = isol1.left_bound(r1.arcno());
-                high1 = isol1.right_bound(r1.arcno());
-                
-                low2 = isol2.left_bound(r2.arcno());
-                high2 = isol2.right_bound(r2.arcno());
-                
-                if (low1 > high2) {
-                    res = ((low1 + high2)/Bound(2));
-                    break;
-                }
-                if (low2 > high1) {
-                    res = ((low2 + high1)/Bound(2));
-                    break;
-                }
-                
-                // else
-                isol1.refine_interval(r1.arcno());
-                isol2.refine_interval(r2.arcno());
-            }
-
-            CGAL::simplify(res);
-
-            CGAL_postcondition_code(
-                    CGAL::Comparison_result exp = CGAL::SMALLER
-            );
-            CGAL_postcondition_code(
-                    if (r1.y() > r2.y()) {
-                        exp = CGAL::LARGER;
-                    }
-            );
-            CGAL_postcondition(r1.y().compare(res) == exp);
-            CGAL_postcondition(r2.y().compare(res) == -exp);
-
-            return res;
-        }
-
-    protected:
-
-        const Algebraic_kernel_d_2* _m_kernel;
-
-    };
-    CGAL_Algebraic_Kernel_cons(Bound_between_y_2, 
-            bound_between_y_2_object);
-    
-    //! \brief comparison of x-coordinates 
-    class Compare_x_2 :
-         public std::binary_function<Algebraic_real_2, Algebraic_real_2, 
-                Comparison_result > {
-
-    public:
-        
-        Compare_x_2(const Algebraic_kernel_d_2* kernel) 
-            : _m_kernel(kernel) {}
-
-        Comparison_result operator()(const Algebraic_real_2& xy1, 
-                                     const Algebraic_real_2& xy2) const {
-	  return _m_kernel->compare_1_object()(xy1.x(), xy2.x());
-        }
-
-#if CGAL_AK_ENABLE_DEPRECATED_INTERFACE
-        Comparison_result operator()(const Algebraic_real_1& xy1, 
-                                     const Algebraic_real_1& xy2) const {
-	  return _m_kernel->compare_1_object()(xy1, xy2);
-        }
-
-#endif
-
-        Comparison_result operator()(const Algebraic_real_2& xy, 
-                                     int i) const {
-	  return _m_kernel->compare_1_object()
-	    ( _m_kernel->compute_x_2_object()(xy), 
-	      _m_kernel->construct_algebraic_real_1_object()(i) );
-        }
-        Comparison_result operator()(int i, const Algebraic_real_2& xy) const {
-	  return _m_kernel->compare_1_object()
-	    ( _m_kernel->construct_algebraic_real_1_object()(i),
-	      _m_kernel->compute_x_2_object()(xy) );
-        }
-
-
-        Comparison_result operator()(const Algebraic_real_2& xy, 
-                                     Bound b) const {
-	  return _m_kernel->compare_1_object()
-	    ( _m_kernel->compute_x_2_object()(xy), 
-	      _m_kernel->construct_algebraic_real_1_object()(b) );
-        }
-        Comparison_result operator()(Bound b, 
-				     const Algebraic_real_2& xy) const {
-	  return _m_kernel->compare_1_object()
-	    ( _m_kernel->construct_algebraic_real_1_object()(b),
-	      _m_kernel->compute_x_2_object()(xy) );
-        }
-
-        Comparison_result operator()
-	  (const Algebraic_real_2& xy, 
-	   typename CGAL::First_if_different<Coefficient,Bound>::Type c) 
-	  const {
-	  return _m_kernel->compare_1_object()
-	    ( _m_kernel->compute_x_2_object()(xy), 
-	      _m_kernel->construct_algebraic_real_1_object()(c) );
-        }
-        Comparison_result operator()
-	  (typename CGAL::First_if_different<Coefficient,Bound>::Type c, 
-	   const Algebraic_real_2& xy) const {
-	  return _m_kernel->compare_1_object()
-	    ( _m_kernel->construct_algebraic_real_1_object()(c),
-	      _m_kernel->compute_x_2_object()(xy) );
-        }
-
-        Comparison_result operator()(const Algebraic_real_2& xy, 
-                                     const Algebraic_real_1 a) const {
-	  return _m_kernel->compare_1_object()
-	    ( _m_kernel->compute_x_2_object()(xy),a );
-        }
-        Comparison_result operator()(const Algebraic_real_1& a, 
-				     const Algebraic_real_2& xy) const {
-	  return _m_kernel->compare_1_object()
-	    ( a,_m_kernel->compute_x_2_object()(xy) );
-        }
-
-
-
-    protected:
-
-        const Algebraic_kernel_d_2* _m_kernel;
-
-    };
-    CGAL_Algebraic_Kernel_pred(Compare_x_2, compare_x_2_object);
-
-    /*! 
-     * \brief comparison of y-coordinates of two points
-     *
-     * \attention{If both points have different x-coordinates, this method
-     * has to translate both y-coordinates 
-     * into isolating interval representations which is a time-consuming
-     * operation (compare the documentation of the \c Get_y_2 functor)
-     * If possible, it is recommended to avoid this functor for efficiency.}
-     */
-    class Compare_y_2 :
-        public std::binary_function< Algebraic_real_2, Algebraic_real_2, 
-                Comparison_result > {
-    
-    public:
-
-        Compare_y_2(const Algebraic_kernel_d_2* kernel) 
-            : _m_kernel(kernel) {}
-    
-        Comparison_result operator()(const Algebraic_real_2& xy1, 
-                                     const Algebraic_real_2& xy2) const {
-            
-	  // It is easier if the x coordinates are equal!
-	  if(_m_kernel->compare_x_2_object()(xy1, xy2) ==
-	     CGAL::EQUAL) 
-	    return _m_kernel->compare_xy_2_object()(xy1, xy2, true);
-	  
-	  return _m_kernel->compare_1_object()(xy1.y(), xy2.y());
-        }
-	
-	Comparison_result operator()(const Algebraic_real_2& xy, 
-                                     int i) const {
-	  
-	  Algebraic_real_1 x = _m_kernel->compute_x_2_object()(xy);
-	  Algebraic_real_2 xy_from_i			       
-	    = _m_kernel->construct_algebraic_real_2_object()(x,i);
-	  return _m_kernel->compare_xy_2_object()(xy, xy_from_i, true);
-          
-        }
-
-	Comparison_result operator()(int i,const Algebraic_real_2& xy) const {
-	  
-	  Algebraic_real_1 x = _m_kernel->compute_x_2_object()(xy);
-	  Algebraic_real_2 xy_from_i			       
-	    = _m_kernel->construct_algebraic_real_2_object()(x,i);
-	  return _m_kernel->compare_xy_2_object()(xy_from_i, xy, true);
-          
-        }
-
-	Comparison_result operator()(const Algebraic_real_2& xy, 
-                                     Bound b) const {
-	  
-	  Algebraic_real_1 x = _m_kernel->compute_x_2_object()(xy);
-	  Algebraic_real_2 xy_from_b			       
-	    = _m_kernel->construct_algebraic_real_2_object()(x,b);
-	  return _m_kernel->compare_xy_2_object()(xy, xy_from_b, true);
-          
-        }
-
-	Comparison_result operator()(Bound b,
-				     const Algebraic_real_2& xy) const {
-	  
-	  Algebraic_real_1 x = _m_kernel->compute_x_2_object()(xy);
-	  Algebraic_real_2 xy_from_b			       
-	    = _m_kernel->construct_algebraic_real_2_object()(x,b);
-	  return _m_kernel->compare_xy_2_object()(xy_from_b, xy, true);
-	}
-
-	Comparison_result operator()
-	  (const Algebraic_real_2& xy, 
-	   typename CGAL::First_if_different<Coefficient,Bound>::Type c) 
-	  const {
-	  
-	  Algebraic_real_1 x = _m_kernel->compute_x_2_object()(xy);
-	  Algebraic_real_2 xy_from_c			       
-	    = _m_kernel->construct_algebraic_real_2_object()(x,c);
-	  return _m_kernel->compare_xy_2_object()(xy, xy_from_c, true);
-	}
-
-	Comparison_result operator()
-	  (typename CGAL::First_if_different<Coefficient,Bound>::Type c,
-	   const Algebraic_real_2& xy) 
-	  const {
-	  
-	  Algebraic_real_1 x = _m_kernel->compute_x_2_object()(xy);
-	  Algebraic_real_2 xy_from_c			       
-	    = _m_kernel->construct_algebraic_real_2_object()(x,c);
-	  return _m_kernel->compare_xy_2_object()(xy_from_c, xy, true);
-	}
-
-	Comparison_result operator()(const Algebraic_real_2& xy, 
-                                     const Algebraic_real_1& a) const {
-	  
-	  Algebraic_real_1 x = _m_kernel->compute_x_2_object()(xy);
-	  Algebraic_real_2 xy_from_a			       
-	    = _m_kernel->construct_algebraic_real_2_object()(x,a);
-	  return _m_kernel->compare_xy_2_object()(xy, xy_from_a, true);
-          
-        }
-
-	Comparison_result operator()(const Algebraic_real_1& a,
-				     const Algebraic_real_2& xy) const {
-	  
-	  Algebraic_real_1 x = _m_kernel->compute_x_2_object()(xy);
-	  Algebraic_real_2 xy_from_a			       
-	    = _m_kernel->construct_algebraic_real_2_object()(x,a);
-	  return _m_kernel->compare_xy_2_object()(xy_from_a, xy, true);
-	}
-
-    protected:
-        
-        const Algebraic_kernel_d_2* _m_kernel;
-        
-    };
-    CGAL_Algebraic_Kernel_pred(Compare_y_2, compare_y_2_object);
-    
-    /*! 
-     * \brief lexicographical comparison of two \c Algebraic_real_2 objects
-     *
-     * \param equal_x if set, the points are assumed 
-     * to have equal x-coordinates, thus only the y-coordinates are compared.
-     */
-    class Compare_xy_2 :
-          public std::binary_function<Algebraic_real_2, Algebraic_real_2, 
-                Comparison_result > {
-
-    public:
-
-         Compare_xy_2(const Algebraic_kernel_d_2* kernel) 
-            : _m_kernel(kernel) {}
-    
-         Comparison_result operator()(const Algebraic_real_2& xy1, 
-             const Algebraic_real_2& xy2, bool equal_x = false) const {
-
-             // handle easy cases first
-             /*if(xy1.is_identical(xy2))
-                return CGAL::EQUAL;
-                
-             if(equal_x && xy1.curve().is_identical(xy2.curve()))
-                return CGAL::sign(xy1.arcno() - xy2.arcno());
-                
-             bool swap = (xy1.id() > xy2.id());
-             std::pair<Algebraic_real_2, Algebraic_real_2> p(xy1, xy2);
-             if(swap) {
-                 p.first = xy2;
-                 p.second = xy1;
-             }
-           
-             typename Cmp_xy_map::Find_result r =
-                _m_kernel->_m_cmp_xy.find(p);
-             if(r.second) {
-               //std::cerr << "Xy_coordinate2: precached compare_xy result\n";
-                 return (swap ? -(r.first->second) : r.first->second);
-             }*/
-
-            return xy1.compare_xy(xy2, equal_x);             
-             //_m_kernel->_m_cmp_xy.insert(std::make_pair(p, res));
-             //return (swap ? -res : res);
-	 }
-
-	 Comparison_result operator() (const Algebraic_real_2& xy,
-				       int x, int y) const {
-	   Comparison_result comp_x
-	     = _m_kernel->compare_x_2_object()(xy,x);
-	   return (comp_x != CGAL::EQUAL 
-		   ? comp_x 
-		   : _m_kernel->compare_y_2_object()(xy,y) );
-	 }
-
-	 Comparison_result operator() (int x,int y,
-				       const Algebraic_real_2& xy) const {
-	   Comparison_result comp_x
-	     = _m_kernel->compare_x_2_object()(x,xy);
-	   return (comp_x != CGAL::EQUAL 
-		   ? comp_x 
-		   : _m_kernel->compare_y_2_object()(y,xy) );
-	 }
-
-	 Comparison_result operator() (const Algebraic_real_2& xy,
-				       Bound x, Bound y) const {
-	   Comparison_result comp_x
-	     = _m_kernel->compare_x_2_object()(xy,x);
-	   return (comp_x != CGAL::EQUAL 
-		   ? comp_x 
-		   : _m_kernel->compare_y_2_object()(xy,y) );
-	 }
-
-	 Comparison_result operator() (Bound x,Bound y,
-				       const Algebraic_real_2& xy) const {
-	   Comparison_result comp_x
-	     = _m_kernel->compare_x_2_object()(x,xy);
-	   return (comp_x != CGAL::EQUAL 
-		   ? comp_x 
-		   : _m_kernel->compare_y_2_object()(y,xy) );
-	 }
-
-	 Comparison_result operator() 
-	   (const Algebraic_real_2& xy,
-	    typename CGAL::First_if_different<Coefficient,Bound>::Type x, 
-	    typename CGAL::First_if_different<Coefficient,Bound>::Type y) 
-	   const {
-	   Comparison_result comp_x
-	     = _m_kernel->compare_x_2_object()(xy,x);
-	   return (comp_x != CGAL::EQUAL 
-		   ? comp_x 
-		   : _m_kernel->compare_y_2_object()(xy,y) );
-	 }
-
-	 Comparison_result operator() 
-	   (typename CGAL::First_if_different<Coefficient,Bound>::Type x,
-	    typename CGAL::First_if_different<Coefficient,Bound>::Type y,
-	    const Algebraic_real_2& xy) const {
-	   Comparison_result comp_x
-	     = _m_kernel->compare_x_2_object()(x,xy);
-	   return (comp_x != CGAL::EQUAL 
-		   ? comp_x 
-		   : _m_kernel->compare_y_2_object()(y,xy) );
-	 }
-
-	 Comparison_result operator() (const Algebraic_real_2& xy,
-				       const Algebraic_real_1& x, 
-				       const Algebraic_real_1& y) const {
-	   Comparison_result comp_x
-	     = _m_kernel->compare_x_2_object()(xy,x);
-	   return (comp_x != CGAL::EQUAL 
-		   ? comp_x 
-		   : _m_kernel->compare_y_2_object()(xy,y) );
-	 }
-
-	 Comparison_result operator() (const Algebraic_real_1& x, 
-				       const Algebraic_real_1& y,
-				       const Algebraic_real_2& xy) const {
-	   Comparison_result comp_x
-	     = _m_kernel->compare_x_2_object()(x,xy);
-	   return (comp_x != CGAL::EQUAL 
-		   ? comp_x 
-		   : _m_kernel->compare_y_2_object()(y,xy) );
-	 }
-
-    protected:
-
-        const Algebraic_kernel_d_2* _m_kernel;
-
-    };
-    CGAL_Algebraic_Kernel_pred(Compare_xy_2, compare_xy_2_object);
-    
-    /*!
-     * \brief checks whether the curve induced by \c p 
-     * has only finitely many self-intersection points
-     *
-     * In algebraic terms, it is checked whether  
-     * the polynomial \c p is square free.
-     */
-    class Has_finite_number_of_self_intersections_2 :
-            public std::unary_function< Polynomial_2, bool > {
-        
-    public:
-
-        Has_finite_number_of_self_intersections_2(const Algebraic_kernel_d_2* kernel) 
-            : _m_kernel(kernel) {}
-        
-        bool operator()(const Polynomial_2& p) const {
-
-            typename Polynomial_traits_2::Is_square_free is_square_free;
-            return is_square_free(p);
-        }
-
-    protected:
-        
-        const Algebraic_kernel_d_2* _m_kernel;
-        
-    };
-    CGAL_Algebraic_Kernel_pred(Has_finite_number_of_self_intersections_2, 
-            has_finite_number_of_self_intersections_2_object);
-            
-    /*! 
-     * \brief checks whether two curves induced bt \c f and \c g 
-     * habe finitely many intersections.
-     *
-     * In algebraic terms, it is checked whether 
-     * the two polynomials \c f and \c g are coprime.
-     */ 
-    class Has_finite_number_of_intersections_2 :
-        public std::binary_function< Polynomial_2, Polynomial_2, bool > {
-         
-    public:
-
-        Has_finite_number_of_intersections_2(const Algebraic_kernel_d_2* kernel) 
-            : _m_kernel(kernel) {}
-
-        bool operator()(const Polynomial_2& f,
-                        const Polynomial_2& g) const {
-            // if curve ids are the same - non-decomposable
-            if(f.id() == g.id())
-                return true;
-            typename Polynomial_traits_2::Gcd_up_to_constant_factor gcd_utcf;
-            typename Polynomial_traits_2::Total_degree total_degree;
-             return (total_degree(gcd_utcf(f, g)) == 0);
-        }
-
-    protected:
-        
-        const Algebraic_kernel_d_2* _m_kernel;
-        
-    };
-  CGAL_Algebraic_Kernel_pred(Has_finite_number_of_intersections_2, 
-            has_finite_number_of_intersections_2_object);
-    
-  // Square_free_factorize_2
-  class Square_free_factorize_2 {
-
-  public:
-      
-      Square_free_factorize_2(const Algebraic_kernel_d_2* kernel) 
-          : _m_kernel(kernel) {}
-      
-      typedef Polynomial_2 first_argument_type;
-      template< class OutputIterator>
-      OutputIterator operator()( const Polynomial_2& p, OutputIterator it) 
-          const {
-          return CGAL::square_free_factorize_up_to_constant_factor(p,it);
-      } 
-  
-  protected:
-
-        const Algebraic_kernel_d_2* _m_kernel;
-
-  };
-  CGAL_Algebraic_Kernel_cons(
-          Square_free_factorize_2, square_free_factorize_2_object);
-
-  //this is deprecated ! 
-    //! Various curve and curve pair decomposition functions
-  class Decompose_2 {
-    
-    public:
-
-        typedef bool result_type;
-
-        Decompose_2(const Algebraic_kernel_d_2* kernel) 
-            : _m_kernel(kernel) {}
-
-        //! returns the square free part of the curve induced by \c p
-        Polynomial_2 operator()(const Polynomial_2& p) {
-            typename Polynomial_traits_2::Make_square_free msf;
-            return msf(p);
-        }
-        
-        /*! 
-         * \brief computes a square-free factorization of a curve \c c, 
-         * returns the number of pairwise coprime square-free factors
-         * 
-         * returns square-free pairwise coprime factors in \c fit and
-         * multiplicities in \c mit. The value type of \c fit is
-         * \c Curve_analysis_2, the value type of \c mit is \c int
-         */
-        template< class OutputIterator1, class OutputIterator2 >
-        int operator()(const Curve_analysis_2& ca,
-                     OutputIterator1 fit, OutputIterator2 mit ) const {
-                        
-            typename Polynomial_traits_2::
-                Square_free_factorize_up_to_constant_factor factorize;
-            std::vector<Polynomial_2> factors;
-            
-            int n_factors = factorize(ca.polynomial_2(),
-                                      std::back_inserter(factors), mit);
-            Construct_curve_2 cc_2 = _m_kernel->construct_curve_2_object();
-            for(int i = 0; i < static_cast<int>(factors.size()); i++) 
-                *fit++ = cc_2(factors[i]);
-            
-            return n_factors;
-        }
-
-        /*!\brief
-         * Decomposes two curves \c ca1 and \c ca2 into common part
-         * and coprime parts
-         *
-         * The common part of the curves \c ca1 and \c ca2 is written in
-         * \c oib, the coprime parts are written to \c oi1 and \c oi2,
-         * respectively.
-         *         
-         * \return {true, if the two curves were not coprime (i.e., have a 
-         * non-trivial common part}
-         *
-         * The value type of \c oi{1,2,b} is \c Curve_analysis_2
-         */
-        template < class OutputIterator > 
-        bool operator()(const Curve_analysis_2& ca1,
-            const Curve_analysis_2& ca2, OutputIterator oi1,
-                OutputIterator oi2, OutputIterator oib) const {
-
-#if CGAL_ACK_DONT_CHECK_POLYNOMIALS_FOR_COPRIMALITY
-        return false;  
-#else 
-
-            Construct_curve_2 cc_2 = _m_kernel->construct_curve_2_object();
-#if CGAL_ACK_USE_EXACUS
-            typedef std::vector<Internal_curve_2> Curves;
-
-            Curves parts_f, parts_g;
-
-            if(Internal_curve_2::decompose(ca1._internal_curve(),
-                                           ca2._internal_curve(), 
-                                           std::back_inserter(parts_f),
-                                           std::back_inserter(parts_g))) {
-                typename Curves::const_iterator cit;
-                // this is temporary solution while curves are cached on
-                // AlciX level
-                CGAL_precondition(parts_f[0].polynomial_2() == 
-                                  parts_g[0].polynomial_2());
-                *oib++ = cc_2(parts_f[0].polynomial_2());
-                
-                if(parts_f.size() > 1)
-                    for(cit = parts_f.begin() + 1; cit != parts_f.end(); cit++)
-                        *oi1++ = cc_2(cit->polynomial_2());
-                if(parts_g.size() > 1)
-                    for(cit = parts_g.begin() + 1; cit != parts_g.end(); cit++)
-                        *oi2++ = cc_2(cit->polynomial_2());
-                return true;
-            }
-                
-                
-#else          
-
-            if (ca1.id() == ca2.id()) {
-                return false;
-            }
-
-            const Polynomial_2& f = ca1.polynomial_2();
-            const Polynomial_2& g = ca2.polynomial_2();
-            
-            if(f == g) {
-              // both curves are equal, but have different representations!
-              // std::cout <<"f: " << f <<std::endl;
-              // std::cout <<"g: " << g <<std::endl;
-              CGAL_assertion(false);
-              return false;
-            }
-            Gcd_cache_2& gcd_cache = _m_kernel->gcd_cache_2();
-            typedef typename Curve_analysis_2::size_type size_type;
-            Polynomial_2 gcd = gcd_cache(std::make_pair(f,g));
-            size_type n = CGAL::degree(gcd);
-            size_type nc = CGAL::degree(
-                    CGAL::univariate_content_up_to_constant_factor(gcd));
-            if( n!=0 || nc!=0 ) {
-                Curve_analysis_2 common_curve = cc_2(gcd);
-                *oib++ = common_curve;
-                Polynomial_2 divided_curve 
-                    = CGAL::integral_division(f,gcd);
-                if( CGAL::degree(divided_curve)>=1 || 
-                    CGAL::degree(
-                            CGAL::univariate_content_up_to_constant_factor
-                            (divided_curve)) >=1 ) {
-                    Curve_analysis_2 divided_c = cc_2(divided_curve);
-                    *oi1++ = divided_c;
-                }
-                divided_curve = CGAL::integral_division(g,gcd);
-                if(CGAL::degree(divided_curve) >= 1 ||
-                   CGAL::degree(
-                           CGAL::univariate_content_up_to_constant_factor
-                           ( divided_curve )) >=1 ) {
-                    Curve_analysis_2 divided_c = cc_2(divided_curve);
-                    *oi2++ = divided_c;
-                }
-                return true;
-            }
-
-#endif
-                
-            // copy original curves to the output iterator:
-            *oi1++ = ca1;
-            *oi2++ = ca2;
-            return false;
-#endif
-        }
-
-    protected:
-
-        const Algebraic_kernel_d_2* _m_kernel;
-
-  };
-    CGAL_Algebraic_Kernel_cons(Decompose_2, decompose_2_object);
-    
-    //!@}
-public:
-    //! \name types and functors for \c CurvedKernelViaAnalysis_2
-    //!@{
-    
-    //! Algebraic name
-    typedef Algebraic_real_1 Coordinate_1;
-
-    //! Non-Algebraic name
-    typedef Algebraic_real_2 Coordinate_2;
-
-    class Is_square_free_2 : public std::unary_function<Polynomial_2,bool> {
-
-    public:
-
-      Is_square_free_2(const Algebraic_kernel_d_2* kernel) 
-            : _m_kernel(kernel) {}
-
-      bool operator()(const Polynomial_2& p) const {
-	return typename Polynomial_traits_2::Is_square_free() (p);
-      }
-      
-    private:
-
-      const Algebraic_kernel_d_2* _m_kernel;
-
-    };
-    CGAL_Algebraic_Kernel_cons(Is_square_free_2, is_square_free_2_object);
-
-    //! Algebraic name
-    typedef Has_finite_number_of_intersections_2 Is_coprime_2;
-    CGAL_Algebraic_Kernel_cons(Is_coprime_2, is_coprime_2_object);
-
-    class Make_square_free_2 : public std::unary_function<Polynomial_2,
-                                                          Polynomial_2> {
-
-    public:
-      Make_square_free_2(const Algebraic_kernel_d_2* kernel) 
-            : _m_kernel(kernel) {}
-
-      Polynomial_2 operator()(const Polynomial_2& p) const {
-	return typename Polynomial_traits_2::Make_square_free() (p);
-      }
-      
-    private:
-
-      const Algebraic_kernel_d_2* _m_kernel;
-
-    };
-    CGAL_Algebraic_Kernel_cons(Make_square_free_2, make_square_free_2_object);
-
-    class Make_coprime_2 {
-
-    public:
-
-      typedef bool result_type;
-
-      Make_coprime_2(const Algebraic_kernel_d_2* kernel) 
-	: _m_kernel(kernel) {}
-	
-      bool operator()(const Polynomial_2& p1,
-		      const Polynomial_2& p2,
-		      Polynomial_2& g,
-		      Polynomial_2& q1,
-		      Polynomial_2& q2) const {
-	
-	Polynomial_2 one(Coefficient(1));
-	
-	if (p1==p2) {
-	  g=p1; q1=one; q2=one;
-	  return false;
-	}
-	Gcd_cache_2& gcd_cache = _m_kernel->gcd_cache_2();
-	g = gcd_cache(std::make_pair(p1,p2));
-	q1=CGAL::integral_division_up_to_constant_factor(p1,g);
-	q2=CGAL::integral_division_up_to_constant_factor(p2,g);
-	return CGAL::total_degree(g)==0;
-      }
-      
-    private:
-      
-      const Algebraic_kernel_d_2* _m_kernel;
-      
-    };
-    CGAL_Algebraic_Kernel_cons(Make_coprime_2, make_coprime_2_object);
-
-
-#if CGAL_AK_ENABLE_DEPRECATED_INTERFACE
-
-    /*!
-     * \brief computes the x-critical points of of a curve/a polynomial
-     *
-     * An x-critical point (x,y) of \c f (or its induced curve) 
-     * satisfies f(x,y) = f_y(x,y) = 0, 
-     * where f_y means the derivative w.r.t. y.
-     * In pariticular, each singular point is x-critical.
-     */
-    class X_critical_points_2 : 
-        public std::binary_function< Curve_analysis_2, 
-            std::iterator<std::output_iterator_tag, Algebraic_real_2>,
-            std::iterator<std::output_iterator_tag, Algebraic_real_2> > {
-       
-    public:
-        
-        X_critical_points_2(const Algebraic_kernel_d_2* kernel) 
-            : _m_kernel(kernel) {}
-        /*! 
-         * \brief writes the x-critical points of \c ca_2 into \c oi 
-         */
-        template <class OutputIterator>
-        OutputIterator operator()(const Curve_analysis_2& ca_2,
-                OutputIterator oi) const {
-                
-            typename Polynomial_traits_2::Differentiate diff;
-            Construct_curve_2 cc_2 = _m_kernel->construct_curve_2_object();
-            Construct_curve_pair_2 ccp_2 
-                = _m_kernel->construct_curve_pair_2_object();
-            // construct curve analysis of a derivative in y
-            Curve_analysis_2 ca_2x = cc_2(diff(ca_2.polynomial_2(),0));
-            Curve_pair_analysis_2 cpa_2 = ccp_2(ca_2, ca_2x);
-            typename Curve_pair_analysis_2::Status_line_1 cpv_line;
-            typename Curve_analysis_2::Status_line_1 cv_line;
-            
-            int i, j, n_arcs, n_events =
-                cpa_2.number_of_status_lines_with_event();
-            std::pair<int,int> ipair;
-            bool vline_constructed = false;
-            
-            for(i = 0; i < n_events; i++) {
-                cpv_line = cpa_2.status_line_at_event(i);
-                // no 2-curve intersections over this status line
-                if(!cpv_line.is_intersection())
-                    continue;
-                n_arcs = cpv_line.number_of_events();
-                for(j = 0; j < n_arcs; j++) {
-                    ipair = cpv_line.curves_at_event(j, ca_2,ca_2x);
-                    if(ipair.first == -1|| ipair.second == -1) 
-                        continue;
-                    if(!vline_constructed) {
-                        cv_line = ca_2.status_line_at_exact_x(cpv_line.x());
-                        vline_constructed = true;
-                    }
-                    // ipair.first is an arcno over status line of the
-                    // curve p
-                    *oi++ = cv_line.algebraic_real_2(ipair.first);
-                }
-                vline_constructed = false;
-            }
-            return oi;
-        }
-        
-        //! \brief computes the \c i-th x-critical point of  \c ca
-        Algebraic_real_2 operator()(const Curve_analysis_2& ca, int i) const
-        {
-            std::vector<Algebraic_real_2> x_points;
-            (*this)(ca, std::back_inserter(x_points));
-            CGAL_precondition(0 >= i&&i < x_points.size());
-            return x_points[i];
-        }
-    
-    protected:
-
-        const Algebraic_kernel_d_2* _m_kernel;
-
-    };
-    CGAL_Algebraic_Kernel_cons(X_critical_points_2,
-        x_critical_points_2_object);
-    
-    /*!
-     * \brief computes the y-critical points of of a curve/a polynomial
-     *
-     * An y-critical point (x,y) of \c f (or its induced curve) 
-     * satisfies f(x,y) = f_x(x,y) = 0, 
-     * where f_x means the derivative w.r.t. x.
-     * In pariticular, each singular point is y-critical.
-     */
-    class Y_critical_points_2 :
-        public std::binary_function< Curve_analysis_2, 
-            std::iterator<std::output_iterator_tag, Algebraic_real_2>,
-            std::iterator<std::output_iterator_tag, Algebraic_real_2> > {
-        
-
-    public:
-
-        Y_critical_points_2(const Algebraic_kernel_d_2* kernel) 
-            : _m_kernel(kernel) {}
-
-        /*! 
-         * \brief writes the y-critical points of \c ca_2 into \c oi 
-         */
-        template <class OutputIterator>
-        OutputIterator operator()(const Curve_analysis_2& ca_2, 
-            OutputIterator oi) const
-        {
-            Construct_curve_2 cc_2 = _m_kernel->construct_curve_2_object();
-            Construct_curve_pair_2 ccp_2 
-                = _m_kernel->construct_curve_pair_2_object();
-            
-            typename Curve_analysis_2::Status_line_1 cv_line;
-            std::pair<int,int> ipair;
-            int i, j, k, n_arcs, n_events =
-                ca_2.number_of_status_lines_with_event();
-            
-            bool cpa_constructed = false, vline_constructed = false; 
-            typename Curve_pair_analysis_2::Status_line_1
-                cpv_line;
-            Curve_pair_analysis_2 cpa_2;
-            
-            for(i = 0; i < n_events; i++) {
-                cv_line = ca_2.status_line_at_event(i);
-                n_arcs = cv_line.number_of_events();
-                for(j = 0; j < n_arcs; j++) {
-                    ipair = cv_line.number_of_incident_branches(j);
-                    // general case: no special tests required
-                    if(!(ipair.first == 1&&ipair.second == 1)) {
-                        *oi++ = cv_line.algebraic_real_2(j);
-                        continue;
-                    }
-                    if(!cpa_constructed) {
-                        typename Polynomial_traits_2::Differentiate diff;
-                        // construct curve analysis of a derivative in y
-                        Curve_analysis_2 ca_2y =
-                            cc_2(diff(ca_2.polynomial_2(),1));
-                        cpa_2 = ccp_2(ca_2, ca_2y);
-                        cpa_constructed = true;
-                    }
-                    if(!vline_constructed) {
-                        cpv_line = cpa_2.status_line_for_x(cv_line.x());
-                        vline_constructed = true;
-                    }
-                    if(!cpv_line.is_intersection())
-                        continue;
-                    // obtain the y-position of j-th event of curve p
-                    k = cpv_line.event_of_curve(j, ca_2);
-                    ipair = cpv_line.curves_at_event(k);
-                    
-                    // pick up only event comprised of both curve and its der
-                    if(ipair.first != -1&&ipair.second != -1)
-                        *oi++ = cv_line.algebraic_real_2(j);
-                }
-                vline_constructed = false;
-            }
-            return oi;
-        }
-
-        //! \brief computes the \c i-th x-critical point of  \c ca
-        Algebraic_real_2 operator()(const Curve_analysis_2& ca, int i) const
-        {
-            std::vector<Algebraic_real_2> y_points;
-            (*this)(ca, std::back_inserter(y_points));
-            CGAL_precondition(0 >= i&&i < y_points.size());
-            return y_points[i];
-        }
-
-    protected:
-
-        const Algebraic_kernel_d_2* _m_kernel;
-
-    };
-    CGAL_Algebraic_Kernel_cons(Y_critical_points_2,
-        y_critical_points_2_object);
-
-#endif
-
- protected:
-
-// TODO typedef Interval_evaluate_2?
- public:
-
-    // Overload the Sign_at_1 functor, to enable filter steps in the
-    // Curve analysis in a coherent way
-    class Sign_at_1 
-      : public::std::binary_function<Polynomial_1,Algebraic_real_1,Sign> {
-
-      
-    public:
-        
-        Sign_at_1(const Algebraic_kernel_d_2* kernel) 
-            : _m_kernel(kernel) {}
-       
-
-	// Version that refines r up to a certain precision. 
-	// If the (non-zero) sign was not computed until this
-	// precision, CGAL::ZERO is returned. This can be used internally
-	// as a filter to detect easy cases	
-	Sign operator()(const Polynomial_1& p,
-			const Algebraic_real_1& r,
-			int max_prec) const {
-	    typename Algebraic_kernel_d_2::Approximate_absolute_1 approx_x
-	      = _m_kernel->approximate_absolute_1_object();
-
-            typedef CGAL::internal::Interval_evaluate_1< Polynomial_1, Bound > 
-              Interval_evaluate_1;
-            typedef typename Interval_evaluate_1::result_type 
-              Interval_result_type;
-            Interval_evaluate_1 interval_evaluate_1;
-	    
-	    long prec = 1;
-
-            while(prec<=max_prec) {
-  	        std::pair<Bound,Bound> x_pair = approx_x(r,prec);
-		
-		Interval_result_type iv
-                  = interval_evaluate_1(p,
-					std::make_pair(x_pair.first,
-						       x_pair.second));
-                CGAL::Sign s_lower = CGAL::sign(iv.first);
-                if(s_lower == sign(iv.second)) {
-		  return s_lower;
-		} else {
-		  prec*=2;
-		}
-	    }
-	    return CGAL::ZERO;
-	  
-	}
-
-        Sign operator()(const Polynomial_1& p,
-                        const Algebraic_real_1& r,
-			bool known_to_be_non_zero=false) const {
-                
-	    if(!known_to_be_non_zero &&
-	       _m_kernel->is_zero_at_1_object()(p, r)) {
-	      return CGAL::ZERO;
-	    }
-	    CGAL::Sign result = this->operator()
-	      (p,r,(std::numeric_limits<int>::max)());
-	    CGAL_assertion(result != CGAL::ZERO);
-	    return result;	    
-        }
-        
-    protected:
-        
-        const Algebraic_kernel_d_2* _m_kernel;
-
-
-
-    };
-    CGAL_Algebraic_Kernel_pred(Sign_at_1, sign_at_1_object);    
-
-
-    /*!
-     * \brief sign computation of a point and a curve
-     *
-     * computes the sign of a point \c p, evaluate at the polynomial
-     * that defines a curve \c c. If the result is 0, the point lies on the
-     * curve. Returns a value convertible to \c CGAL::Sign
-     */
-    class Sign_at_2 :
-        public std::binary_function<Polynomial_2, Algebraic_real_2, Sign > {
-
-    public:
-        
-        Sign_at_2(const Algebraic_kernel_d_2* kernel) 
-            : _m_kernel(kernel) {}
-       
-	Sign operator()(const Polynomial_2& f,
-                        const Algebraic_real_2& r,
-			bool known_to_be_non_zero=false) const {
-
-	  return this->operator()(_m_kernel->construct_curve_2_object()(f),r,
-				  known_to_be_non_zero);
-        }
-
-	// Version that refines x- and y-coordinate up to a certain
-	// precision. If the non-zero sign was not computed until this
-	// precision, CGAL::ZERO is returned. This can used internally
-	// as a filter to detect easy cases	
-	Sign operator()(const Polynomial_2& f,
-			const Algebraic_real_2& r,
-			int max_prec) const {
-	  return this->operator()(_m_kernel->construct_curve_2_object()(f),r,
-				  max_prec);
-	}
-
-	// Version that refines x- and y-coordinate up to a certain
-	// precision. If the non-zero sign was not computed until this
-	// precision, CGAL::ZERO is returned. This can be used internally
-	// as a filter to detect easy cases	
-	Sign operator()(const Curve_analysis_2& ca_2,
-			const Algebraic_real_2& r,
-			int max_prec) const {
-	    if(ca_2.is_identical(r.curve())) {
-	      return CGAL::ZERO;
-	    }
-	    typename Algebraic_kernel_d_2::Approximate_absolute_x_2 approx_x
-	      = _m_kernel->approximate_absolute_x_2_object();
-	    typename Algebraic_kernel_d_2::Approximate_absolute_y_2 approx_y
-	      = _m_kernel->approximate_absolute_y_2_object();
-
-            typedef CGAL::internal::Interval_evaluate_2< Polynomial_2, Bound > 
-              Interval_evaluate_2;
-            typedef typename Interval_evaluate_2::result_type 
-              Interval_result_type;
-            Interval_evaluate_2 interval_evaluate_2;
-	    
-	    long prec = 4;
-
-            while(prec<=max_prec) {
-  	        std::pair<Bound,Bound> x_pair = approx_x(r,prec);
-  	        std::pair<Bound,Bound> y_pair = approx_y(r,prec);
-		
-		Interval_result_type iv
-                  = interval_evaluate_2(ca_2.polynomial_2(),
-					CGAL::make_array(x_pair.first,
-							 x_pair.second,
-							 y_pair.first,
-							 y_pair.second));
-                CGAL::Sign s_lower = CGAL::sign(iv.first);
-                if(s_lower == sign(iv.second)) {
-		  return s_lower;
-		} else {
-		  prec*=2;
-		}
-	    }
-	    return CGAL::ZERO;
-	  
-	}
-
-        Sign operator()(const Curve_analysis_2& ca_2,
-                        const Algebraic_real_2& r,
-			bool known_to_be_non_zero=false) const {
-                
- 	    if(ca_2.is_identical(r.curve())) {
-	      return CGAL::ZERO;
-	    }
-	    if(!known_to_be_non_zero &&
-	       _m_kernel->is_zero_at_2_object()(ca_2, r)) {
-	      return CGAL::ZERO;
-	    }
-	    CGAL::Sign result = this->operator()
-	      (ca_2,r,(std::numeric_limits<int>::max)());
-	    CGAL_assertion(result != CGAL::ZERO);
-	    return result;	    
-        }
-        
-    protected:
-        
-        const Algebraic_kernel_d_2* _m_kernel;
-
-    
-    };
-    CGAL_Algebraic_Kernel_pred(Sign_at_2, sign_at_2_object);
-
-    class Is_zero_at_2 
-      : public std::binary_function<Polynomial_2,Algebraic_real_2,bool> {
-    
-    public:
-      
-      Is_zero_at_2(const Algebraic_kernel_d_2* kernel) 
-	: _m_kernel(kernel) {}
-	
-      bool operator() (const Polynomial_2& f, const Algebraic_real_2& r) const {
-	return this->operator() (_m_kernel->construct_curve_2_object()(f),r);
-      }
-
-      bool operator() (const Curve_analysis_2& ca_2, 
-		       const Algebraic_real_2& r) const {
-
-
-	if (CGAL::is_zero(ca_2.polynomial_2())) {
-	  return true;
-	}
-	
-	Construct_curve_2 cc_2 = _m_kernel->construct_curve_2_object();
-	Construct_curve_pair_2 ccp_2 
-	  = _m_kernel->construct_curve_pair_2_object();
-
-	typename Curve_analysis_2::Status_line_1
-	  cv_line = ca_2.status_line_for_x(r.x());
-	// fast check for the presence of status line at r.x()
-	if(cv_line.covers_line())    
-	  return true;
-	
-	// Handle non-coprime polynomial
-	Polynomial_2 gcd = _m_kernel->gcd_cache_2()
-	  (std::make_pair(ca_2.polynomial_2(), r.curve().polynomial_2()));
-	
-	Curve_analysis_2 gcd_curve = cc_2(gcd);
-	if(CGAL::total_degree(gcd)>0) {
-	  
-	  Construct_curve_pair_2 ccp_2
-	    = _m_kernel->construct_curve_pair_2_object();
-	  Curve_analysis_2 r_curve_remainder =
-	    cc_2(CGAL::integral_division_up_to_constant_factor
-		 (r.curve().polynomial_2(), gcd));
-                    
-	  r.simplify_by(ccp_2(gcd_curve, r_curve_remainder));
-	  if(r.curve().polynomial_2() == gcd) 
-	    return true;
-	}
-
-	Curve_pair_analysis_2 cpa_2 = ccp_2(ca_2, r.curve());
-	typename Curve_pair_analysis_2::Status_line_1
-	  cpv_line = cpa_2.status_line_for_x(r.x());
-	
-	if(cpv_line.is_event() && cpv_line.is_intersection()) {
-	  // get an y-position of the point r
-	  int idx = cpv_line.event_of_curve(r.arcno(), r.curve());
-	  std::pair<int, int> ipair =
-	    cpv_line.curves_at_event(idx);
-	  if(ipair.first != -1 && ipair.second != -1)
-	    return true;
-	}
-	return false;
-      }
-
-    protected:
-
-        const Algebraic_kernel_d_2* _m_kernel;
-
-    };
-    CGAL_Algebraic_Kernel_cons(Is_zero_at_2, 
-			       is_zero_at_2_object);
-
-
- protected:
-
-    // Internal Functor to get all solutions at a certain x-coordinate
-    class Solve_at_x_2 {
-
-    public:
-
-        Solve_at_x_2(const Algebraic_kernel_d_2* kernel) 
-            : _m_kernel(kernel) {}
-
-
-	//! Version with Algebraic_real_1
-        template <class OutputIterator>
-	  OutputIterator
-           operator()(const Curve_pair_analysis_2& cpa_2, 
-		      Algebraic_real_1 a,
-		      OutputIterator res) const {
-	  int idx; bool event;
-	  cpa_2.x_to_index(a,idx,event);
-	  if(! event) {
-	    return res; // no intersections at a
-	  } else {
-	    return this->operator()(cpa_2,idx,res);
-	  }
-	}
-
-        //! Version with index (faster)
-        template <class OutputIterator>
-	  OutputIterator
-           operator()(const Curve_pair_analysis_2& cpa_2, 
-		      size_type index,
-		      OutputIterator res) const 
-        {
-  	    Curve_analysis_2 ca1 = cpa_2.curve_analysis(true),
-	      ca2 = cpa_2.curve_analysis(false);
-            typename Curve_pair_analysis_2::Status_line_1 cpv_line;
-            // do we need to check which supporting curve is simpler ?    
-            typename Polynomial_traits_2::Total_degree total_degree;
-
-            Polynomial_2 f1 = ca1.polynomial_2(),
-                f2 = ca2.polynomial_2();
-            bool first_curve = (total_degree(f1) < total_degree(f2));
-            
-            CGAL_assertion(index<cpa_2.number_of_status_lines_with_event());
-	    cpv_line = cpa_2.status_line_at_event(index);
-	    Algebraic_real_1 x = cpv_line.x(); 
-	    bool ca1_covers_line 
-	      = ca1.status_line_at_exact_x(x).covers_line();
-	    bool ca2_covers_line 
-	      = ca2.status_line_at_exact_x(x).covers_line();
-	    
-	    for(int j = 0; j < cpv_line.number_of_events(); j++) {
-	      std::pair<int,int> ipair = cpv_line.curves_at_event(j,ca1,ca2);
-	      if(ipair.first != -1 && ipair.second != -1) {
-		Algebraic_real_2 new_root   
-		  = Algebraic_real_2(x, 
-				     (first_curve ? ca1 : ca2),
-				     (first_curve ? ipair.first
-				      : ipair.second));
-		Multiplicity_type new_mult
-		  = cpv_line.multiplicity_of_intersection(j);
-		*res++ = std::make_pair(new_root,new_mult);
-		continue;
-	      }
-	      if(ipair.first!=-1 && ca2_covers_line) {
-		Algebraic_real_2 new_root   
-		  = Algebraic_real_2(x,ca1,ipair.first);
-		Multiplicity_type new_mult=-1;
-		*res++ = std::make_pair(new_root,new_mult);
-		continue;
-	      }
-	      if(ipair.second!=-1 && ca1_covers_line) {
-		Algebraic_real_2 new_root   
-		  = Algebraic_real_2(x,ca2,ipair.second);
-		Multiplicity_type new_mult=-1;
-		*res++ = std::make_pair(new_root,new_mult);
-		continue;
-	      }
-	    }
-	    return res;
-        }
-
-    protected:
-
-        const Algebraic_kernel_d_2* _m_kernel;
-
-    };
-    CGAL_Algebraic_Kernel_cons(Solve_at_x_2, solve_at_x_2_object);
-
-
- public:
-
-    /*!
-     * \brief computes solutions of systems of two 2 equations and 2 variables
-     *
-     * \pre the polynomials must be square-free and coprime
-     */  
-    class Solve_2 {
-    
-    public:
-
-        Solve_2(const Algebraic_kernel_d_2* kernel) 
-            : _m_kernel(kernel) {}
-
-#if CGAL_AK_ENABLE_DEPRECATED_INTERFACE
-        template <class OutputIteratorRoots, class OutputIteratorMult>
-        std::pair<OutputIteratorRoots, OutputIteratorMult>
-           operator()
-               (const Polynomial_2& f, const Polynomial_2& g,
-                OutputIteratorRoots roots, OutputIteratorMult mults) const {
-	  std::vector<std::pair<Algebraic_real_2,Multiplicity_type> > 
-	    roots_vec;
-	  this->operator()(f,g,std::back_inserter(roots_vec));
-	  typename Algebraic_kernel_d_1::template Pair_first
-	    <Algebraic_real_2,Multiplicity_type> pair_first;	  
-	  typename Algebraic_kernel_d_1::template Pair_second
-	    <Algebraic_real_2,Multiplicity_type> pair_second;	  
-	  std::copy(::boost::make_transform_iterator
-		      (roots_vec.begin(),pair_first),
-		    ::boost::make_transform_iterator
-		      (roots_vec.end(),pair_first),
-		    roots);
-	  std::copy(::boost::make_transform_iterator
-		      (roots_vec.begin(),pair_second),
-		    ::boost::make_transform_iterator
-		      (roots_vec.end(),pair_second),
-		    mults);
-	  return std::make_pair(roots,mults);
-	}
-	  
-#endif
-
-        /*! 
-         * \brief solves the system (f=0,g=0)
-         *
-         * All solutions of the system are written into \c roots 
-         * (whose value type is \c Algebraic_real_2). The multiplicities
-         * are written into \c mults (whose value type is \c int)
-         */
-        template <class OutputIterator> OutputIterator
-           operator()
-               (const Polynomial_2& f, const Polynomial_2& g,
-                OutputIterator res) const {
-            return 
-                (*this)(_m_kernel->construct_curve_2_object()(f),
-                        _m_kernel->construct_curve_2_object()(g),
-                        res);
-        }
-
-#if CGAL_AK_ENABLE_DEPRECATED_INTERFACE
-        template <class OutputIteratorRoots, class OutputIteratorMult>
-        std::pair<OutputIteratorRoots, OutputIteratorMult>
-           operator()
-               (const Curve_analysis_2& f, const Curve_analysis_2& g,
-                OutputIteratorRoots roots, OutputIteratorMult mults) const {
-	  std::vector<std::pair<Algebraic_real_2,Multiplicity_type> > 
-	    roots_vec;
-	  this->operator()(f,g,std::back_inserter(roots_vec));
-	  typename Algebraic_kernel_d_1::template Pair_first
-	    <Algebraic_real_2,Multiplicity_type> pair_first;	  
-	  typename Algebraic_kernel_d_1::template Pair_second
-	    <Algebraic_real_2,Multiplicity_type> pair_second;	  
-	  std::copy(::boost::make_transform_iterator
-		      (roots_vec.begin(),pair_first),
-		    ::boost::make_transform_iterator
-		      (roots_vec.end(),pair_first),
-		    roots);
-	  std::copy(::boost::make_transform_iterator
-		      (roots_vec.begin(),pair_second),
-		    ::boost::make_transform_iterator
-		      (roots_vec.end(),pair_second),
-		    mults);
-	  return std::make_pair(roots,mults);
-	}
-	  
-#endif
-
-
-        //! Version with curve analyses
-        template <class OutputIterator>
-	  OutputIterator
-           operator()(const Curve_analysis_2& ca1, 
-		      const Curve_analysis_2& ca2,
-		      OutputIterator res) const 
-        {
-            // these tests are quite expensive... do we really need them ??
-            /*
-            CGAL_precondition_code (
-                typename Self::Has_finite_number_of_self_intersections_2 
-                    not_self_overlapped;
-                typename Self::Has_finite_number_of_intersections_2 
-                    do_not_overlap;
-                CGAL_precondition(not_self_overlapped(ca1) &&
-                    not_self_overlapped(ca2));
-                CGAL_precondition(do_not_overlap(ca1, ca2));
-            );
-            */
-            Construct_curve_pair_2 ccp_2
-                = _m_kernel->construct_curve_pair_2_object();
-            Curve_pair_analysis_2 cpa_2 = ccp_2(ca1, ca2);
-            typename Curve_pair_analysis_2::Status_line_1 cpv_line;
-            // do we need to check which supporting curve is simpler ?    
-            //typename Polynomial_traits_2::Total_degree total_degree;
-
-            //Polynomial_2 f1 = ca1.polynomial_2(),
-            //    f2 = ca2.polynomial_2();
-            //bool first_curve = (total_degree(f1) < total_degree(f2));
-            
-            int i, n = cpa_2.number_of_status_lines_with_event();
-	    for(i = 0; i < n; i++) {
-              _m_kernel->solve_at_x_2_object()(cpa_2,i,res);
-            }
-            return res;
-        }
-
-	template <class OutputIterator> OutputIterator
-	  operator()
-	  (const Polynomial_2& f, const Polynomial_2& g,
-	   Bound xl, Bound xu, Bound yl, Bound yu,
-	   OutputIterator res) const {
-	  // Note: This could be improved by not computing all solutions
-	  //       but only those in [xl,xu] (lazy evaluation)
-	  std::vector<std::pair<Algebraic_real_2,Multiplicity_type> > roots;
-	  this->operator() (f,g,std::back_inserter(roots));
-	  // Find the x-values using binary search:
-	  typename Algebraic_kernel_d_1::template Pair_first
-	    <Algebraic_real_2,Multiplicity_type> pair_first;
-	  typedef typename
-	    std::vector<std::pair<Algebraic_real_2,Multiplicity_type> >
-	    ::iterator Iterator;
-	  Iterator roots_start = std::lower_bound
-	    (::boost::make_transform_iterator
-	     (roots.begin(),
-	      _m_kernel->unary_compose(pair_first,
-				       _m_kernel->compute_x_2_object())),
-	     ::boost::make_transform_iterator
-	     (roots.end(),
-	      _m_kernel->unary_compose(pair_first,
-				       _m_kernel->compute_x_2_object())),
-	     _m_kernel->construct_algebraic_real_1_object()(xl)).base();
-	  Iterator roots_end = std::upper_bound
-	    (::boost::make_transform_iterator
-	     (roots_start,
-	      _m_kernel->unary_compose(pair_first,
-				       _m_kernel->compute_x_2_object())),
-	     ::boost::make_transform_iterator
-	     (roots.end(),
-	      _m_kernel->unary_compose(pair_first,
-				       _m_kernel->compute_x_2_object())),
-	     _m_kernel->construct_algebraic_real_1_object()(xu)).base();
-	  // Now check y-coordinate. Binary search is not possible here!
-	  // Note that compare_y is not too expensive here because we
-	  // only compare with rationals
-	  for(Iterator it=roots_start;it!=roots_end;it++) {
-	    if(_m_kernel->compare_y_2_object()(yl,it->first)==CGAL::LARGER) {
-	      continue;
-	    }
-	    if(_m_kernel->compare_y_2_object()(it->first,yu)==CGAL::LARGER) {
-	      continue;
-	    }
-	    *res++ = *it;
-	  }
-	  return res;
-	}
-	     
-    protected:
-
-        const Algebraic_kernel_d_2* _m_kernel;
-
-    };
-    CGAL_Algebraic_Kernel_cons(Solve_2, solve_2_object);
-
-    class Number_of_solutions_2 
-      : public std::binary_function<Polynomial_2,Polynomial_2,size_type> {
-    
-    public:
-      
-      Number_of_solutions_2(const Algebraic_kernel_d_2* kernel) 
-	: _m_kernel(kernel) {}
-	
-      size_type operator() 
-	(const Polynomial_2& f, const Polynomial_2& g) const {
-
-	std::vector<std::pair<Algebraic_real_2,Multiplicity_type> > roots;
-	_m_kernel->solve_2_object()(f,g,std::back_inserter(roots));
-	return roots.size(); 
-      }
-
-    protected:
-
-        const Algebraic_kernel_d_2* _m_kernel;
-
-    };
-    CGAL_Algebraic_Kernel_cons(Number_of_solutions_2, 
-			       number_of_solutions_2_object);
-
-    // Functor used to evaluate a Polynomial_2 in a Bound, up to a
-    // constant factor
-    class Evaluate_utcf_2 
-      : public std::binary_function<Polynomial_2,Bound,Polynomial_1> {
-    
-    public:
-      
-      Evaluate_utcf_2(const Algebraic_kernel_d_2* kernel) 
-	: _m_kernel(kernel) {}
-	
-      Polynomial_1 operator() (const Polynomial_2& f, Bound b) const {
-	typedef CGAL::Fraction_traits<Bound> FT;
-	// We rely on the fact that the Bound is a fraction
-	CGAL_static_assertion((::boost::is_same<typename FT::Is_fraction,
-			                     CGAL::Tag_true>::value));
-	typedef typename FT::Numerator_type Numerator;
-	typedef typename FT::Denominator_type Denominator;
-	typedef CGAL::Coercion_traits<Numerator,Coefficient> Num_coercion;
-	CGAL_static_assertion((::boost::is_same
-			      <Coefficient,
-   			       typename Num_coercion::Type>::value));
-	typedef CGAL::Coercion_traits<Denominator,Coefficient> Denom_coercion;
-	CGAL_static_assertion((::boost::is_same
-			       <Coefficient,
-			        typename Denom_coercion::Type>::value));
-	typename Num_coercion::Cast num_cast;
-	typename Denom_coercion::Cast denom_cast;
-	typename FT::Decompose decompose;
-	
-	Numerator num_uncasted;
-	Denominator denom_uncasted;
-	decompose(b,num_uncasted,denom_uncasted);
-
-	Coefficient num = num_cast(num_uncasted);
-	Coefficient denom = denom_cast(denom_uncasted);
-	return CGAL::evaluate_homogeneous(f,num,denom);
-      }
-
-    protected:
-
-        const Algebraic_kernel_d_2* _m_kernel;
-
-    };
-    CGAL_Algebraic_Kernel_cons(Evaluate_utcf_2, 
-			       evaluate_utcf_2_object);
-
-#if CGAL_AK_ENABLE_DEPRECATED_INTERFACE
-    /*!
-     * \brief Construct a curve with the roles of x and y interchanged.
-     */
-    class Swap_x_and_y_2 {
-
-    public:
-
-        Swap_x_and_y_2(const Algebraic_kernel_d_2* kernel) 
-            : _m_kernel(kernel) {}
-        
-        typedef Polynomial_2 argument_type;
-        typedef Curve_analysis_2 result_type;
-
-        Curve_analysis_2 operator() (const Curve_analysis_2& ca) {
-            return this->operator() (ca.polynomial_2());
-        }
-
-        Curve_analysis_2 operator() (const Polynomial_2& f) {
-            Polynomial_2 f_yx
-                = typename Polynomial_traits_2::Swap() (f,0,1);
-            return _m_kernel->construct_curve_2_object() (f_yx);
-        }
-    
-    protected:
-
-        const Algebraic_kernel_d_2* _m_kernel;
-
-    };
-    CGAL_Algebraic_Kernel_cons(Swap_x_and_y_2, swap_x_and_y_2_object);
-
-    //! Refines the x-coordinate of an Algebraic_real_2 object
-    class Refine_x_2 :
-        public std::unary_function<Algebraic_real_2, void> {
-
-    public:
-        
-        Refine_x_2(const Algebraic_kernel_d_2* kernel) 
-            : _m_kernel(kernel) {}
-      
-        void operator()(const Algebraic_real_2& r) const {
-            r.refine_x();            
-        }
-	/* TODO: if needed, include
-        void operator()(Algebraic_real_2& r, int rel_prec) const {  
-            r.refine_x(rel_prec);
-        }
-	*/
-        
-    protected:
-
-        const Algebraic_kernel_d_2* _m_kernel;
-
-    };
-    CGAL_Algebraic_Kernel_pred(Refine_x_2, refine_x_2_object);
-    
-    class Refine_y_2 :
-        public std::unary_function<Algebraic_real_2, void> {
-
-    public:
-
-        Refine_y_2(const Algebraic_kernel_d_2* kernel) 
-            : _m_kernel(kernel) {}
-      
-        void operator()(const Algebraic_real_2& r) const {
-  	    return r.refine_y();
-        }
-        
-	/* TODO: if needed, include
-        void operator()(Algebraic_real_2& r, int rel_prec) const {  
-            return r.refine_y(rel_prec);
-        }
-	*/
-    
-    protected:
-
-        const Algebraic_kernel_d_2* _m_kernel;
-
-    };
-    CGAL_Algebraic_Kernel_pred(Refine_y_2, refine_y_2_object);
-    
-    class Lower_bound_x_2 {
-       
-    public:
-
-        Lower_bound_x_2(const Algebraic_kernel_d_2* kernel) 
-            : _m_kernel(kernel) {}
-
-        typedef Algebraic_real_2 argument_type;
-        typedef Bound result_type;
-            
-        result_type operator()(const Algebraic_real_2& r) {
-	    return r.lower_bound_x();
-	}
-        
-    protected:
-
-        const Algebraic_kernel_d_2* _m_kernel;
-
-    };
-    CGAL_Algebraic_Kernel_cons(Lower_bound_x_2, lower_bound_x_2_object);
-    
-    class Upper_bound_x_2 {
-       
-    public:
-
-        Upper_bound_x_2(const Algebraic_kernel_d_2* kernel) 
-            : _m_kernel(kernel) {}
-
-        typedef Algebraic_real_2 argument_type;
-        typedef Bound result_type;
-            
-        result_type operator()(const Algebraic_real_2& r) {
-            return r.upper_bound_x();
-        }
-    
-    protected:
-
-        const Algebraic_kernel_d_2* _m_kernel;
-
-    };
-    CGAL_Algebraic_Kernel_cons(Upper_bound_x_2, upper_bound_x_2_object);
-
-    class Lower_bound_y_2 {
-    
-    public:
-
-        Lower_bound_y_2(const Algebraic_kernel_d_2* kernel) 
-            : _m_kernel(kernel) {}
-        
-        typedef Algebraic_real_2 argument_type;
-        typedef Bound result_type;
-            
-        result_type operator()(const Algebraic_real_2& r) {
-	  return r.lower_bound_y();
-	}
-
-    protected:
-
-        const Algebraic_kernel_d_2* _m_kernel;
-
-    };
-    CGAL_Algebraic_Kernel_cons(Lower_bound_y_2, lower_bound_y_2_object);
-    
-    //! an upper bound of the y-coordinate of \c r
-    class Upper_bound_y_2 {
-    
-    public:
-
-        Upper_bound_y_2(const Algebraic_kernel_d_2* kernel) 
-            : _m_kernel(kernel) {}
-   
-        typedef Algebraic_real_2 argument_type;
-        typedef Bound result_type;
-            
-        result_type operator()(const Algebraic_real_2& r) {
- 	  return r.upper_bound_y();
-	}
-
-    protected:
-
-        const Algebraic_kernel_d_2* _m_kernel;
-
-    };
-    CGAL_Algebraic_Kernel_cons(Upper_bound_y_2, upper_bound_y_2_object);
-    
-
-
-  typedef Bound Boundary; 
-  typedef Lower_bound_x_2 Lower_boundary_x_2;
-  typedef Lower_bound_y_2 Lower_boundary_y_2;
-  typedef Upper_bound_x_2 Upper_boundary_x_2;
-  typedef Upper_bound_y_2 Upper_boundary_y_2;
-  typedef Bound_between_x_2 Boundary_between_x_2;
-  typedef Bound_between_y_2 Boundary_between_y_2;
-
-  CGAL_Algebraic_Kernel_cons(Lower_boundary_x_2,lower_boundary_x_2_object);
-  CGAL_Algebraic_Kernel_cons(Lower_boundary_y_2,lower_boundary_y_2_object);
-  CGAL_Algebraic_Kernel_cons(Upper_boundary_x_2,upper_boundary_x_2_object);
-  CGAL_Algebraic_Kernel_cons(Upper_boundary_y_2,upper_boundary_y_2_object);
-  CGAL_Algebraic_Kernel_cons(Boundary_between_x_2,boundary_between_x_2_object);
-  CGAL_Algebraic_Kernel_cons(Boundary_between_y_2,boundary_between_y_2_object);
-#endif
-
-
-#undef CGAL_Algebraic_Kernel_pred    
-#undef CGAL_Algebraic_Kernel_cons 
-    
-    //!@}
-
-protected:
-
-mutable boost::shared_ptr<Curve_cache_2> _m_curve_cache_2;
-mutable boost::shared_ptr<Curve_pair_cache_2> _m_curve_pair_cache_2;
-mutable boost::shared_ptr<Gcd_cache_2> _m_gcd_cache_2;
-
-    
-}; // class Algebraic_curve_kernel_2
-
-} // namespace CGAL
-
-#endif // CGAL_ALGEBRAIC_CURVE_KERNEL_D_2_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_E08_tree.h b/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_E08_tree.h
deleted file mode 100644
index 5367ebd..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_E08_tree.h
+++ /dev/null
@@ -1,1054 +0,0 @@
-// Copyright (c) 2006-2009 Max-Planck-Institute Saarbruecken (Germany).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Arno Eigenwillig <arno at mpi-inf.mpg.de>
-//
-// ============================================================================
-
-// TODO: The comments are all original EXACUS comments and aren't adapted. So
-//         they may be wrong now.
-
-
-#ifndef CGAL_BITSTREAM_DESCARTES_E08_TREE_H
-#define CGAL_BITSTREAM_DESCARTES_E08_TREE_H
-
-#include <vector>
-#include <list>
-#include <utility>
-#include <iterator>
-#include <algorithm>
-
-#include <CGAL/basic.h>
-#include <CGAL/Algebraic_kernel_d/Bitstream_descartes_rndl_tree.h> // TODO remove
-#include <CGAL/Handle_with_policy.h>
-#include <CGAL/Random.h>
-
-#include <boost/optional.hpp>
-
-/*
- *  AUXILIARY CLASSES AND FUNCTIONS
- */
-
-namespace CGAL {
-
-namespace internal {
-
-template <class Integer>
-Integer caching_binomial(int n, int k) {
-    CGAL_precondition(n >= 0);
-    if (k < 0 || k > n) return Integer(0);
-
-    // Pascal's triangle; augment if necessary
-    // TODO flat array with manual index computation should be slightly faster
-    typedef std::vector< Integer > Row;
-    typedef std::vector< Row > Triangle;
-    // MSVC uses "pascal" as a keyword or defines it as a macro!
-    static Triangle my_pascal;
-
-    int old_size = int(my_pascal.size());
-    if (n >= old_size) {
-        my_pascal.resize(n+1);
-        if (old_size == 0) {
-            my_pascal[0].push_back(Integer(1));
-            old_size = 1;
-        }
-        for (int i = old_size; i <= n; ++i) {
-            Row& prev = my_pascal[i-1];
-            Row& curr = my_pascal[i];
-            curr.reserve(i+1);
-            curr.push_back(Integer(1));
-            for (int j = 1; j < i; ++j) {
-                curr.push_back(prev[j-1] + prev[j]);
-            }
-            curr.push_back(Integer(1));
-        }
-    }
-    return my_pascal[n][k];
-}
-
-
-template <class Integer_>
-class Power_to_Bernstein_pm1_nofrac_matrix {
-public:
-    typedef Integer_ Integer;
-
-private:
-    int dim_;
-    std::vector<Integer> m_;
-    int ij_to_idx(int i, int j) const { return i*dim_ + j; }
-    void init_m();
-
-public:
-    Power_to_Bernstein_pm1_nofrac_matrix(int degree = -1)
-        : dim_(degree + 1), m_(dim_ * dim_)
-    {
-        CGAL_assertion(degree >= -1);
-        init_m();
-    }
-
-    void set_degree(int degree) {
-        CGAL_assertion(degree >= -1);
-        dim_ = degree + 1;
-        m_.resize(dim_ * dim_);
-        init_m();
-    }
-
-    Integer operator()(int i, int j) const {
-        CGAL_assertion(0 <= i && i < dim_);
-        CGAL_assertion(0 <= j && j < dim_);
-        return m_[ij_to_idx(i,j)];
-    }
-
-    int degree() const { return dim_ - 1; }
-}; // class Power_to_Bernstein_pm1_nofrac_matrix
-
-template <class Integer_>
-void Power_to_Bernstein_pm1_nofrac_matrix<Integer_>::init_m() {
-    // TODO: this implements the definition, but [E08] describes a faster way
-    int degree = dim_ - 1;
-    for (int i = 0; i < dim_; ++i) {
-        for (int j = 0; j < dim_; ++j) {
-            Integer sum(0);
-            int nu_lo = (std::max)(0, i+j-degree);
-            int nu_hi = (std::min)(i, j);
-            for (int nu = nu_lo; nu <= nu_hi; ++nu) {
-                Integer term = caching_binomial<Integer>(j, nu)
-                             * caching_binomial<Integer>(degree-j, i-nu);
-                if ((j - nu) & 1) { sum -= term; }
-                else              { sum += term; }
-            }
-            m_[ij_to_idx(i,j)] =
-                sum 
-              * CGAL::internal::caching_factorial<Integer>(i)
-              * CGAL::internal::caching_factorial<Integer>(degree - i);
-        }
-    }
-}
-
-template <class Traits_>
-class Bitstream_bernstein_from_power {
-public:
-    typedef Traits_  Traits;
-    typedef typename Traits::Coefficient           Coefficient;
-    typedef typename Traits::Integer               Integer;
-    typedef typename Traits::Approximator          Approximator;
-    typedef typename Traits::Lower_bound_log2_abs  Lower_bound_log2_abs;
-    typedef typename Traits::Ceil_log2_abs_Integer Ceil_log2_abs_Integer;
-    typedef typename Traits::Ceil_log2_abs_long    Ceil_log2_abs_long;
-
-    typedef std::vector<Coefficient> Coefficient_vector;
-    typedef std::vector<Integer>     Integer_vector;
-    typedef Power_to_Bernstein_pm1_nofrac_matrix<Integer> Mn;
-    typedef std::map<int, Mn> Mn_cache;
-
-private:
-    Coefficient_vector input_power_coeff_;
-    int degree_;        // $ =   n $ in [E08]
-    long log_radius_;   // $ = r+1 $ in [E08]
-    Approximator approximator_;
-    Lower_bound_log2_abs lower_bound_log2_abs_;
-    long ceil_log_degfac_, floor_log_degfac_, ceil_log_degp1_;
-    long lbd_log_lcoeff_;
-    long log_lcfscale_; // $ =   l $ in [E08]
-
-    Integer_vector bernstein_coeff_; // empty if uninitialized
-    long bernstein_coeff_prec_; // $ = p+1 $ in [E08]
-
-    static Mn_cache mn_cache_;
-    static const Mn& get_mn(int n) {
-        Mn& mn = mn_cache_[n];
-        if (mn.degree() == -1) mn.set_degree(n);
-        return mn;
-    }
-
-public:
-    Bitstream_bernstein_from_power() : degree_(-1) { }
-
-    template <class InputIterator>
-    Bitstream_bernstein_from_power(
-            InputIterator first, InputIterator beyond,
-            long log_radius,
-            const Traits_& traits = Traits_()
-    );
-
-    template <class OutputIterator>
-    OutputIterator operator()(OutputIterator oi, long prec);
-
-    int degree() const { return degree_; }
-
-    void set_traits(Traits& traits) {
-        approximator_ = traits.approximator_object();
-        lower_bound_log2_abs_ = traits.lower_bound_log2_abs_object();
-    }
-}; // class Bitstream_bernstein_from_power
-
-// static member definition
-template <class Traits_>
-std::map<int, Power_to_Bernstein_pm1_nofrac_matrix<typename Traits_::Integer> >
-Bitstream_bernstein_from_power<Traits_>::mn_cache_;
-
-// non-member functions
-template <class Traits_>
-template <class InputIterator>
-Bitstream_bernstein_from_power<Traits_>::Bitstream_bernstein_from_power(
-        InputIterator first, InputIterator beyond,
-        long log_radius,
-        const Traits_& traits // = Traits_()
-) : input_power_coeff_(first, beyond),
-    degree_(int(input_power_coeff_.size() - 1)),
-    log_radius_(log_radius),
-    approximator_(traits.approximator_object()),
-    lower_bound_log2_abs_(traits.lower_bound_log2_abs_object())
-{ 
-    CGAL_assertion(degree_ >= 0);
-    lbd_log_lcoeff_ = lower_bound_log2_abs_(input_power_coeff_[degree_]);
-    if (degree_ == 2) {
-        ceil_log_degfac_ = floor_log_degfac_ = 1;
-        ceil_log_degp1_ = 2;
-    } else {
-        ceil_log_degfac_
-            = Ceil_log2_abs_Integer()
-                (CGAL::internal::
-                 caching_factorial<Integer>(degree_));
-        floor_log_degfac_
-            = ceil_log_degfac_ - 1;
-        ceil_log_degp1_
-            = Ceil_log2_abs_long()(degree_ + 1);
-    }
-    log_lcfscale_
-        = lbd_log_lcoeff_ + floor_log_degfac_ + degree_ * (log_radius+1);
-}
-
-template <class Traits_>
-template <class OutputIterator>
-OutputIterator
-Bitstream_bernstein_from_power<Traits_>::operator()(
-        OutputIterator oi,
-        long prec // $ = p+1$ in [E08]
-) {
-    CGAL_precondition(degree_ >= 0);
-
-    // try to produce output from existing coefficient approximations
-    if (!bernstein_coeff_.empty()) {
-        long delta_prec = bernstein_coeff_prec_ - prec;
-        if (delta_prec == 0) {
-            for (int i = 0; i <= degree_; ++i) {
-                *oi = bernstein_coeff_[i];
-                ++oi;
-            }
-            return oi;
-        } else if (delta_prec > 0) {
-            Integer half = Integer(1) << (delta_prec-1);
-            for (int i = 0; i <= degree_; ++i) {
-                *oi = (bernstein_coeff_[i] + half) >> delta_prec;
-                ++oi;
-            }
-            return oi;
-        }
-        // else delta_prec < 0: fall through to precision increase
-    } else {
-        bernstein_coeff_.resize(degree_ + 1);
-    }
-
-    // compute coefficients at new precision
-    Integer_vector c(degree_ + 1);
-    long q = prec + ceil_log_degfac_ + ceil_log_degp1_ + 1;
-    for (int j = 0; j <= degree_; ++j) {
-        c[j] = approximator_(
-                input_power_coeff_[j],
-                j*log_radius_ - log_lcfscale_ + q
-        );
-    }
-    const Mn& mn = get_mn(degree_);
-    long shift = q - prec;
-    Integer half = Integer(1) << (shift-1);
-    for (int i = 0; i <= degree_; ++i) {
-        Integer bi(0);
-        for (int j = 0; j <= degree_; ++j) bi += mn(i,j) * c[j];
-        bernstein_coeff_[i] = (bi + half) >> shift;
-    }
-    bernstein_coeff_prec_ = prec;
-
-    // output new approximations
-    for (int i = 0; i <= degree_; ++i) {
-        *oi = bernstein_coeff_[i];
-        ++oi;
-    }
-    return oi;
-}
-
-} // namespace internal
-
-
-/*
- * The generic de Casteljau method
- */
-
-template <class Integer_>
-class Convex_combinator_approx_Integer_log {
-public:
-    typedef Integer_ Integer;
-
-private:
-    Integer alpha_num_, beta_num_, half_;
-    int log_denom_;
-
-public:
-    Convex_combinator_approx_Integer_log(
-            Integer alpha_num = Integer(1), int log_denom = 1
-    ) : alpha_num_(alpha_num),
-        beta_num_((Integer(1) << log_denom) - alpha_num),
-        half_((log_denom > 0) ? (Integer(1) << log_denom-1) : 0),
-        log_denom_(log_denom)
-    {
-        CGAL_precondition(log_denom_ >= 0);
-    }
-    void into_first(Integer& a, const Integer& b) const {
-        a *= alpha_num_; a += beta_num_*b;
-        a += half_; a >>= log_denom_;  // round to nearest
-    }
-    void into_second(const Integer& a, Integer& b) const {
-        b *= beta_num_; b += alpha_num_*a;
-        b += half_; b >>= log_denom_;  // round to nearest
-    }
-    void into_third(const Integer& a, const Integer& b, Integer& c) const {
-        c = a; c *= alpha_num_; c += beta_num_*b; // c might alias a but not b
-        c += half_; c >>= log_denom_;  // round to nearest
-    }
-};
-
-template <class NT_>
-class Convex_combinator_approx_fraction {
-public:
-    typedef NT_ NT;
-private:
-    NT alpha_num_, beta_num_, denom_, half_;
-public:
-    Convex_combinator_approx_fraction(NT alpha_num, NT denom)
-        : alpha_num_(alpha_num), beta_num_(denom - alpha_num),
-          denom_(denom), half_(denom >> 1)
-    { }
-    void into_first(NT& a, const NT& b) const {
-        a *= alpha_num_; a += beta_num_*b;
-        a += half_; a /= denom_;  // round to nearest
-    }
-    void into_second(const NT& a, NT& b) const {
-        b *= beta_num_; b += alpha_num_*a;
-        b += half_; b /= denom_;  // round to nearest
-    }
-    void into_third(const NT& a, const NT& b, NT& c) const {
-        c = a; c *= alpha_num_; c += beta_num_*b; // c might alias a but not b
-        c += half_; c /= denom_;  // round to nearest
-    }
-}; // class Convex_combinator_approx_fraction
-
-namespace internal {
-
-/*
- * THE ACTUAL TREE CLASSES
- */
-template <class BitstreamDescartesE08TreeTraits>
-class Bitstream_descartes_E08_tree;
-
-template <class BitstreamDescartesE08TreeTraits>
-        struct Bitstream_descartes_E08_node;
-
-        template <class BitstreamDescartesE08TreeTraits>
-        class Bitstream_descartes_E08_tree_rep;
-} // namespace internal
-
-} //namespace CGAL
-
-/* The template argument supplied as BitstreamDescartesE08TreeTraits
- * shall be a class containing the following types in its scope:
- *   Coefficient:           caller-supplied coefficient type
- *   Bound:              type for interval bound output (exact)
- *   Integer:               integer type for actual calculations, needs >>, <<
- *   Approximator:          functor to get Integer approx to x*2^p from coeff x
- *   Lower_bound_log2_abs:  functor for lower bound to log|x| for coeff x
- *   Bound_creator:      functor to create bound x*2^p from x and p
- *   Sign:                  functor to get sign of Integer x
- *   Ceil_log2_abs_Integer: functor to get smallest long >= log|x| for Integer
- *   Ceil_log2_abs_long:    functor to get smallest long >= log|x| for long
- */
-
-/*
- * macros for common typedefs
- */
-
-// bring types from traits into local scope
-#define CGAL_SNAP_BITSTREAM_DESCARTES_E08_TREE_TRAITS_TYPEDEFS(TRAITS)  \
-  typedef typename TRAITS::Coefficient           Coefficient;           \
-  typedef typename TRAITS::Bound                 Bound;                 \
-  typedef typename TRAITS::Integer               Integer;               \
-  typedef typename TRAITS::Approximator          Approximator;          \
-  typedef typename TRAITS::Lower_bound_log2_abs  Lower_bound_log2_abs;  \
-  typedef typename TRAITS::Bound_creator      Bound_creator;            \
-  typedef typename TRAITS::Sign                  Sign;                  \
-  typedef typename TRAITS::Ceil_log2_abs_Integer Ceil_log2_abs_Integer; \
-  typedef typename TRAITS::Ceil_log2_abs_long    Ceil_log2_abs_long     \
-
-// end #define
-
-// common typedefs for all Bitstream_descartes_E08_* classes
-#define CGAL_BITSTREAM_DESCARTES_E08_TREE_COMMON_TYPEDEFS               \
-  typedef BitstreamDescartesE08TreeTraits TRAITS;                       \
-  typedef TRAITS Bitstream_descartes_E08_tree_traits;                   \
-  CGAL_SNAP_BITSTREAM_DESCARTES_E08_TREE_TRAITS_TYPEDEFS(TRAITS);       \
-  typedef CGAL::internal::Bitstream_bernstein_from_power<TRAITS> B_from_p; \
-  typedef std::vector<Integer> Integer_vector;                          \
-  typedef CGAL::internal::Abs_le_pow2<Ceil_log2_abs_Integer>            \
-  Abs_le_pow2;                                                          \
-  typedef CGAL::internal::Sign_eps_log2                                 \
-  <Integer, Abs_le_pow2, Sign>                                          \
-  Sign_eps_log2                                                         \
-  
-// end #define
-
-// typedefs for Bitstream_descartes_E08_tree{,_rep}
-#define CGAL_BITSTREAM_DESCARTES_E08_TREE_TYPEDEFS                     \
-  CGAL_BITSTREAM_DESCARTES_E08_TREE_COMMON_TYPEDEFS;                   \
-  typedef CGAL::internal::Bitstream_descartes_E08_node<TRAITS> Node;   \
-  typedef std::list<Node> Node_list                                    \
-  
-// end #define
-
-
-namespace CGAL {
-
-namespace internal {
-
-/*
- * class Bitstream_descartes_E08_node
- */
-
-template <class BitstreamDescartesE08TreeTraits>
-struct Bitstream_descartes_E08_node {
-public:
-  typedef Bitstream_descartes_E08_node Self;
-  CGAL_BITSTREAM_DESCARTES_E08_TREE_COMMON_TYPEDEFS;
-  
-  friend class CGAL::internal::Bitstream_descartes_E08_tree<TRAITS>;
-  friend class CGAL::internal::Bitstream_descartes_E08_tree_rep<TRAITS>;
-
-private:
-    // "node data" (set individually in subdivision)
-    Integer lower_num_, upper_num_; // TODO use lower_num_, width_num_ instead
-    long log_bdry_den_;
-    Integer_vector coeff_; // wrt [lower_, upper_], approximate
-    int min_var_, max_var_;
-    bool coeff_update_delayed_;
-    // "state data" (copied en bloc by .copy_state_from())
-    long subdepth_bound_, subdepth_current_;
-    long log_eps_;   // $q - p$
-    long log_C_eps_; // $q - p + 4n$
-
-    Bitstream_descartes_E08_node(int degree = -1,
-            Integer lower_num = Integer(0), Integer upper_num = Integer(0),
-            long log_bdry_den = 0, int min_var = -1, int max_var = -1
-    ) : lower_num_(lower_num), upper_num_(upper_num),
-          log_bdry_den_(log_bdry_den),
-          coeff_(degree+1),
-          min_var_(min_var), max_var_(max_var),
-          coeff_update_delayed_(false),
-          subdepth_bound_(0), subdepth_current_(0),
-           log_eps_(0), log_C_eps_(0)
-    { }
-
-    void copy_state_from(const Self& n) {
-        subdepth_bound_   = n.subdepth_bound_;
-        subdepth_current_ = n.subdepth_current_;
-        log_eps_          = n.log_eps_;
-        log_C_eps_        = n.log_C_eps_;
-    }
-
-    // const Self& operator= (const Self&); // assignment is forbidden
-}; // struct Bitstream_descartes_E08_node
-
-
-/*
- * class Bitstream_descartes_E08_tree_rep
- */
-
-template <class BitstreamDescartesE08TreeTraits>
-class Bitstream_descartes_E08_tree_rep {
-public:
-    typedef Bitstream_descartes_E08_tree_rep Self;
-    CGAL_BITSTREAM_DESCARTES_E08_TREE_TYPEDEFS;
-
-    class Monomial_basis_tag { };
-
-    friend class CGAL::internal::Bitstream_descartes_E08_tree<TRAITS>;
-
-private:
-    B_from_p b_from_p_;
-    long log_radius_;
-    int degree_;
-    long ceil_log_degree_;
-    Node_list node_list_;
-
-    long payload_prec_;
-    int subdiv_tries_, subdiv_fails_;
-    int bisect_tries_, bisect_fails_;
-
-    // temporary data fields for subdivision
-    Integer_vector tmp1_coeff_, tmp2_coeff_;
-    Integer splitpoint_num_;
-    long log_splitpoint_den_;
-
-public:
-    Bitstream_descartes_E08_tree_rep() : degree_(-1) { }
-
-    template <class InputIterator>
-    Bitstream_descartes_E08_tree_rep(
-            long log_radius,
-            InputIterator first, InputIterator beyond, Monomial_basis_tag,
-            const TRAITS& traits
-    ) : b_from_p_(first, beyond, log_radius, traits),
-        log_radius_(log_radius),
-        subdiv_tries_(0), subdiv_fails_(0),
-        bisect_tries_(0), bisect_fails_(0),
-        splitpoint_num_(0), log_splitpoint_den_(0)
-    {
-        degree_ = b_from_p_.degree();
-        CGAL_precondition(degree_ >= 0);
-        ceil_log_degree_ = (degree_ > 0) ? Ceil_log2_abs_long()(degree_) : -1;
-        node_list_.push_front(
-                Node(degree_, Integer(-1), Integer(1), -log_radius)
-        );
-        payload_prec_ = 6 * degree_ + 20;
-        tmp1_coeff_.resize(degree_ + 1);
-        tmp2_coeff_.resize(degree_ + 1);
-    }
-}; // class Bitstream_descartes_E08_tree_rep
-
-/*
- * class Bitstream_descartes_E08_tree
- */
-
-/*! \ingroup CGAL_Bitstream_descartes_tree
- *  \brief Subdivision tree of the BitstreamDescartes method (E08 variant)
- */
-template <class BitstreamDescartesE08TreeTraits>
-class Bitstream_descartes_E08_tree
-    : public
-        ::CGAL::Handle_with_policy<
-                 internal::Bitstream_descartes_E08_tree_rep<
-                         BitstreamDescartesE08TreeTraits
-                 >
-         >
-{
-public:
-    typedef Bitstream_descartes_E08_tree Self;
-    CGAL_BITSTREAM_DESCARTES_E08_TREE_TYPEDEFS;
-    typedef internal::Bitstream_descartes_E08_tree_rep<TRAITS> Rep;
-    typedef ::CGAL::Handle_with_policy<Rep> Base;
-
-    //! node iterator.
-    typedef typename Node_list::iterator       Node_iterator;
-    //! node iterator (for STL compatibility only).
-    typedef typename Node_list::iterator       iterator;
-    //! const node iterator.
-    typedef typename Node_list::const_iterator Node_const_iterator;
-    //! const node iterator (for STL compatibility only).
-    typedef typename Node_list::const_iterator const_iterator;
-
-    //! tag type to distinguish a certain constructor.
-    typedef typename Rep::Monomial_basis_tag Monomial_basis_tag;
-
-public:
-    //! default constructor (makes <tt>degree() == -1</tt>)
-    Bitstream_descartes_E08_tree() : Base(Rep()) { }
-
-    //! copy constructor
-    Bitstream_descartes_E08_tree(const Self& p)
-        : Base(static_cast<const Base&>(p))
-    { }
-
-    /*! \brief construct from initial interval and coefficients
-     *
-     *  The initial interval is
-     *  [\c lower_num, \c upper_num] / 2^(\c log_bdry_den ).
-     *
-     *  The iterator range [\c first, \c beyond ) gives the
-     *  coefficients of 1, <i>x</i>, <i>x</i><sup>2</sup>, ...
-     *  The leading coefficient (last in sequence) must be non-zero.
-     *
-     *  The \c Monomial_basis_tag is required for the benefit of
-     *  future extensions to coefficients w.r.t. other bases.
-     */
-    template <class InputIterator>
-    Bitstream_descartes_E08_tree(
-            long log_radius,
-            InputIterator first, InputIterator beyond, Monomial_basis_tag tag,
-            const BitstreamDescartesE08TreeTraits& traits
-                                        = BitstreamDescartesE08TreeTraits()
-    ) : Base(Rep(log_radius, first, beyond, tag, traits))
-    {
-        Node_iterator n = this->ptr()->node_list_.begin();
-        if (this->ptr()->degree_ > 0) {
-            bool init_ok = reinit_from_prec(n);
-            CGAL_assertion(init_ok); (void)init_ok;
-            if (n->min_var_ == 0) this->ptr()->node_list_.erase(n);
-        } else {
-            this->ptr()->node_list_.erase(n);
-        }
-    }
-
-    //! return degree of polynomial
-    int degree() const { return this->ptr()->degree_; }
-
-    //! iterator to first node
-    Node_iterator begin() {
-        return this->ptr()->node_list_.begin();
-    }
-    //! iterator beyond last node
-    Node_iterator end() {
-        return this->ptr()->node_list_.end();
-    }
-    //! const iterator to first node
-    Node_const_iterator begin() const {
-        return this->ptr()->node_list_.begin();
-    }
-    //! const iterator beyond last node
-    Node_const_iterator end() const {
-        return this->ptr()->node_list_.end();
-    }
-
-    //! get lower bound of interval at node \c n.
-    Bound lower(Node_iterator n) const {
-        CGAL_assertion(is_iterator_valid(n));
-        return Bound_creator()(n->lower_num_, -n->log_bdry_den_);
-    }
-    //! get lower bound of interval at node \c n.
-    Bound lower(Node_const_iterator n) const {
-        CGAL_assertion(is_iterator_valid(n));
-        return Bound_creator()(n->lower_num_, -n->log_bdry_den_);
-    }
-    //! get upper bound of interval at node \c n.
-    Bound upper(Node_iterator n) const {
-        CGAL_assertion(is_iterator_valid(n));
-        return Bound_creator()(n->upper_num_, -n->log_bdry_den_);
-    }
-    //! get upper bound of interval at node \c n.
-    Bound upper(Node_const_iterator n) const {
-        CGAL_assertion(is_iterator_valid(n));
-        return Bound_creator()(n->upper_num_, -n->log_bdry_den_);
-    }
-
-    //! get boundaries: interval at node \c n is
-    //! [\c lower_num, \c upper_num] / 2^(\c log_bdry_den ).
-    void boundaries(Node_iterator n,
-            Integer& lower_num, Integer& upper_num, long& log_bdry_den
-    ) {
-        CGAL_assertion(is_iterator_valid(n));
-        lower_num    = n->lower_num_;
-        upper_num    = n->upper_num_;
-        log_bdry_den = n->log_bdry_den_;
-    }
-
-    //! get minimum number of sign variations in Descartes Test
-    //! for approximate polynomial at node \c n
-    int min_var(Node_const_iterator n) const {
-        CGAL_assertion(is_iterator_valid(n));
-        return n->min_var_;
-    }
-    //! get maximum number of sign variations in Descartes Test
-    //! for approximate polynomial at node \c n
-    int max_var(Node_const_iterator n) const {
-        CGAL_assertion(is_iterator_valid(n));
-        return n->max_var_;
-    }
-
-    /*! \brief subdivide interval at node \c n.
-     *
-     *  The node representing interval \c n is replaced in the list
-     *  of nodes by 0, 1, or 2 nodes that represent those among the
-     *  two subintervals that have \c min_var() greater than 0.
-     *  The number of new nodes is returned as result.
-     *  The subrange of nodes consisting of the new nodes is
-     *  returned in the arguments \c first and \c beyond
-     *
-     *  Subdividing a node invalidates all iterators to it;
-     *  both for the object where \c subdivide() was called
-     *  and all copies of it (since they share the same
-     *  representation and state).
-     *
-     *  The parameter \c n is passed by value.  Hence you can
-     *  implement depth-first search for isolating intervals like this:
-     *  \code
-     *    Node_iterator dummy, curr = tree.begin();
-     *    while (curr != tree.end()) {
-     *        if (tree.max_var(curr) == 1) ++curr;
-     *        else tree.subdivide(curr, curr, dummy);
-     *    }
-     *  \endcode
-     */
-    int subdivide(
-            Node_iterator n, Node_iterator& first, Node_iterator& beyond
-    );
-
-    /*! \brief erase node \c n.
-     *
-     *  Erasing a node invalidates all iterators to it;
-     *  both for the object where \c subdivide() was called
-     *  and all copies of it (since they share the same
-     *  representation and state).
-     */
-    void erase(Node_iterator n) {
-        CGAL_assertion(is_iterator_valid(n));
-        this->ptr()->node_list_.erase(n);
-    }
-
-    /*! \brief Replace traits class
-     */
-    void set_traits(TRAITS& traits) {
-        this->ptr()->b_from_p_.set_traits(traits);
-    }
-
-    /*! \brief Returns a copy of this with its own representation
-     */
-    Self make_unique() const {
-      Self tmp = *this;
-      tmp.copy_on_write();
-      return tmp;
-    }
-
-protected:
-    int subdivide_at_midpoint(
-            Node_iterator n, Node_iterator& first, Node_iterator& beyond
-    );
-
-    int subdivide_at(
-            Node_iterator n, Node_iterator& first, Node_iterator& beyond,
-            long alpha_num, int log_alpha_den
-    );
-
-    bool is_iterator_valid(Node_const_iterator n) const {
-        Node_const_iterator it  = this->ptr()->node_list_.begin();
-        Node_const_iterator end = this->ptr()->node_list_.end();
-        while (it != end) {
-            if (it == n) return true;
-            ++it;
-        }
-        return false;
-    }
-
-private:
-    int replace_by_tmp(
-            Node_iterator n, Node_iterator& first, Node_iterator& beyond
-    );
-
-    static const long log_subdepth_bound_init_ = 6;
-
-    bool reinit_from_prec(Node_iterator n);
-    void global_prec_increase(Node_iterator n);
-
-}; // class Bitstream_descartes_E08_tree
-
-template <class BitstreamDescartesE08TreeTraits>
-const long
-Bitstream_descartes_E08_tree<BitstreamDescartesE08TreeTraits>
-::log_subdepth_bound_init_;
-
-
-
-/*
- * Non-inline member functions of class Bitstream_descartes_E08_tree
- */
-
-template <class BitstreamDescartesE08TreeTraits>
-bool
-Bitstream_descartes_E08_tree<BitstreamDescartesE08TreeTraits>
-::reinit_from_prec(Node_iterator n) {
-
-    n->subdepth_bound_   = 1L << log_subdepth_bound_init_;
-    n->subdepth_current_ = 0;
-    n->log_eps_ = this->ptr()->ceil_log_degree_
-                + log_subdepth_bound_init_
-                + 1;
-    n->log_C_eps_ = n->log_eps_ + 4*this->degree();
-
-    this->ptr()->b_from_p_(
-            this->ptr()->tmp1_coeff_.begin(),
-            this->ptr()->payload_prec_ + 1
-    );
-    for (int i = 0; i <= degree(); ++i) { // TODO avoid preceding rshift
-        this->ptr()->tmp1_coeff_[i] <<= (n->log_eps_ - 1);
-    }
-
-    Integer alpha_num =
-        (Integer(1) << (n->log_bdry_den_ + this->ptr()->log_radius_))
-        -  n->lower_num_;
-    long log_alpha_den = n->log_bdry_den_ + this->ptr()->log_radius_ + 1;
-    if (alpha_num != Integer(1) << log_alpha_den) {
-        de_casteljau_generic(
-            this->ptr()->tmp1_coeff_.begin(), this->ptr()->tmp1_coeff_.end(),
-            this->ptr()->tmp2_coeff_.begin(), this->ptr()->tmp1_coeff_.begin(),
-            Convex_combinator_approx_Integer_log<Integer>(
-                    alpha_num, log_alpha_den
-            )
-        );
-        ++(n->subdepth_current_);
-    }
-    alpha_num =
-        (Integer(1) << (n->log_bdry_den_ + this->ptr()->log_radius_))
-        -  n->upper_num_;
-    if (alpha_num != Integer(0)) {
-        Integer alpha_den =
-            (Integer(1) << (n->log_bdry_den_ + this->ptr()->log_radius_))
-            - n->lower_num_;
-        de_casteljau_generic(
-            this->ptr()->tmp1_coeff_.begin(), this->ptr()->tmp1_coeff_.end(),
-            n->coeff_.begin(), this->ptr()->tmp1_coeff_.begin(),
-            Convex_combinator_approx_fraction<Integer>(alpha_num, alpha_den)
-        );
-        ++(n->subdepth_current_);
-    } else {
-        n->coeff_.swap(this->ptr()->tmp1_coeff_);
-    }
-
-    if (Abs_le_pow2()(n->coeff_[degree()], n->log_C_eps_)
-            || Abs_le_pow2()(n->coeff_[0], n->log_C_eps_)
-    ) {
-        return false;
-    } else {
-        internal::var_eps(n->coeff_.begin(), n->coeff_.end(),
-                n->min_var_, n->max_var_, Sign_eps_log2(n->log_eps_)
-        );
-        return true;
-    }
-} // Bitstream_descartes_E08_tree::reinit_from_sep()
-
-template <class BitstreamDescartesE08TreeTraits>
-int
-Bitstream_descartes_E08_tree<BitstreamDescartesE08TreeTraits>
-::subdivide_at_midpoint(
-        Node_iterator n, Node_iterator& first, Node_iterator& beyond
-) {
-    de_casteljau_generic(n->coeff_.begin(), n->coeff_.end(),
-            this->ptr()->tmp1_coeff_.begin(), this->ptr()->tmp2_coeff_.begin(),
-            CGAL::internal::Convex_combinator_approx_midpoint<Integer>()
-    );
-    this->ptr()->splitpoint_num_     = n->lower_num_ + n->upper_num_;
-    this->ptr()->log_splitpoint_den_ = n->log_bdry_den_ + 1;
-
-    if (Abs_le_pow2()(this->ptr()->tmp2_coeff_[0], n->log_C_eps_)) {
-        return -1;
-    } else {
-        return replace_by_tmp(n, first, beyond);
-    }
-} // Bitstream_descartes_E08_tree::subdivide_at()
-
-template <class BitstreamDescartesE08TreeTraits>
-int
-Bitstream_descartes_E08_tree<BitstreamDescartesE08TreeTraits>
-::subdivide_at(
-        Node_iterator n, Node_iterator& first, Node_iterator& beyond,
-        long alpha_num, int log_alpha_den
-) {
-    de_casteljau_generic(n->coeff_.begin(), n->coeff_.end(),
-        this->ptr()->tmp1_coeff_.begin(), this->ptr()->tmp2_coeff_.begin(),
-        CGAL::internal::Convex_combinator_approx_long_log<Integer>
-            (alpha_num, log_alpha_den)
-    );
-    this->ptr()->splitpoint_num_ =
-        alpha_num * n->lower_num_
-            + ((1L << log_alpha_den) - alpha_num) * n->upper_num_;
-    this->ptr()->log_splitpoint_den_ = n->log_bdry_den_ + log_alpha_den;
-
-    if (Abs_le_pow2()(this->ptr()->tmp2_coeff_[0], n->log_C_eps_)) {
-        return -1;
-    } else {
-        return replace_by_tmp(n, first, beyond);
-    }
-} // Bitstream_descartes_E08_tree::subdivide_at()
-
-
-template <class BitstreamDescartesE08TreeTraits>
-int
-Bitstream_descartes_E08_tree<BitstreamDescartesE08TreeTraits>
-::replace_by_tmp(
-        Node_iterator n, Node_iterator& first, Node_iterator& beyond
-) {
-
-    ++(n->subdepth_current_);
-
-    long delta_log_bdry_den =
-        this->ptr()->log_splitpoint_den_ - n->log_bdry_den_;
-    CGAL_assertion(delta_log_bdry_den >= 0);
-
-    int l_min_var, l_max_var, r_min_var, r_max_var;
-    internal::var_eps(this->ptr()->tmp1_coeff_.begin(),
-                                     this->ptr()->tmp1_coeff_.end(),
-                                     l_min_var, l_max_var, 
-                                     Sign_eps_log2(n->log_eps_)
-    );
-    internal::var_eps(this->ptr()->tmp2_coeff_.begin(),
-            this->ptr()->tmp2_coeff_.end(),
-            r_min_var, r_max_var, Sign_eps_log2(n->log_eps_)
-    );
-    CGAL_assertion(0 <= l_min_var && l_min_var <= l_max_var);
-    CGAL_assertion(0 <= r_min_var && r_min_var <= r_max_var);
-
-    beyond = first = n;
-    ++beyond;
-
-    if (l_min_var > 0) {
-        int children = 1;
-        if (r_min_var > 0) {
-            // create new node for right child
-            Node_iterator r = 
-                this->ptr()->node_list_.insert(beyond, Node(degree(),
-                            this->ptr()->splitpoint_num_,        // lower
-                            n->upper_num_ << delta_log_bdry_den, // upper
-                            this->ptr()->log_splitpoint_den_,
-                            r_min_var, r_max_var
-                ));
-            r->coeff_.swap(this->ptr()->tmp2_coeff_);
-            r->copy_state_from(*n);
-            ++children;
-        }
-        // put left child into n
-        n->lower_num_  <<= delta_log_bdry_den;
-        n->upper_num_    = this->ptr()->splitpoint_num_;
-        n->log_bdry_den_ = this->ptr()->log_splitpoint_den_;
-        n->min_var_      = l_min_var;
-        n->max_var_      = l_max_var;
-        n->coeff_.swap(this->ptr()->tmp1_coeff_);
-        return children;
-    } else if (r_min_var > 0) {
-        // put right child into n
-        n->lower_num_    = this->ptr()->splitpoint_num_;
-        n->upper_num_  <<= delta_log_bdry_den;
-        n->log_bdry_den_ = this->ptr()->log_splitpoint_den_;
-        n->min_var_      = r_min_var;
-        n->max_var_      = r_max_var;
-        n->coeff_.swap(this->ptr()->tmp2_coeff_);
-        return 1;
-    } else /* l_min_var == 0 && r_min_var == 0 */ {
-        // delete n
-        first = beyond;
-        this->ptr()->node_list_.erase(n);
-        return 0;
-    }
-} // Bitstream_descartes_E08_tree::replace_by_tmp()
-
-template <class BitstreamDescartesE08TreeTraits>
-int
-Bitstream_descartes_E08_tree<BitstreamDescartesE08TreeTraits>
-::subdivide(
-        Node_iterator n, Node_iterator& first, Node_iterator& beyond
-) {
-    long alpha_num;
-    int  log_alpha_den;
-    long alpha_den_4;
-    int  ret;
-
-    CGAL_assertion(is_iterator_valid(n));
-
-    // check for delayed update
-    if (n->coeff_update_delayed_) {
-        reinit_from_prec(n);
-        n->coeff_update_delayed_ = false;
-    }
-
-    // apply Zeno trap
-    if (n->subdepth_current_ == n->subdepth_bound_) {
-        for (int i = 0; i <= degree(); ++i)  n->coeff_[i] <<= 2;
-        // n->working_prec_ += 2;
-        n->log_eps_ += 2;
-        n->log_C_eps_ += 2;
-        n->subdepth_bound_ <<= 1;
-        n->subdepth_current_ = 0;
-    }
-
-    for (;;) {
-        if (true) { // used to be recdepth > 0
-            // first try heuristic alpha = 1/2 (failures don't count)
-            ++(this->ptr()->bisect_tries_);
-            ret = subdivide_at_midpoint(n, first, beyond);
-            if (ret >= 0) { return ret; } else { ++(this->ptr()->bisect_fails_); }
-
-            // next try heuristic alpha with small denom (failures don't count)
-            log_alpha_den = 4;
-            alpha_den_4 = 1L << (log_alpha_den - 2);
-            alpha_num = CGAL::default_random.get_int(  // TODO .get_long
-                    alpha_den_4, 3*alpha_den_4 + 1
-            );
-            ++(this->ptr()->subdiv_tries_);
-            ret = subdivide_at(n, first, beyond, alpha_num, log_alpha_den);
-            if (ret >= 0) { return ret; } else { --(this->ptr()->subdiv_tries_); }
-
-            // now try alpha properly randomized, counting failure rate
-            log_alpha_den = 4 + this->ptr()->ceil_log_degree_;
-            alpha_den_4 = 1L << (log_alpha_den - 2);
-            do {
-                alpha_num = CGAL::default_random.get_int(  // TODO .get_long
-                        alpha_den_4, 3*alpha_den_4 + 1
-                );
-                ++(this->ptr()->subdiv_tries_);
-                ret = subdivide_at(n, first, beyond, alpha_num, log_alpha_den);
-                if (ret >= 0) {
-                    return ret;
-                } else {
-                    ++(this->ptr()->subdiv_fails_);
-                }
-            } while (
-(this->ptr()->subdiv_fails_ < 2 || 2 * this->ptr()->subdiv_fails_ < this->ptr()->subdiv_tries_)
-&& (this->ptr()->bisect_fails_ < degree())
-            );
-        } // if (true) // used to be recdepth > 0
-
-        // if failure rate too high, decrease guess of prec and restart
-        global_prec_increase(n);
-        // TODO what if now  n->max_var_ == 1  ??
-    } // for (;;)
-} // Bitstream_descartes_E08_tree::subdivide()
-
-template <class BitstreamDescartesE08TreeTraits>
-void
-Bitstream_descartes_E08_tree<BitstreamDescartesE08TreeTraits>
-::global_prec_increase(Node_iterator n)
-{
-    this->ptr()->payload_prec_ *= 2;
-
-    this->ptr()->subdiv_tries_ = this->ptr()->subdiv_fails_ = 0;
-    this->ptr()->bisect_tries_ = this->ptr()->bisect_fails_ = 0;
-
-    Node_iterator it  = this->ptr()->node_list_.begin();
-    Node_iterator end = this->ptr()->node_list_.end();
-    while (it != end) {
-        if (it != n && it->min_var_ == it->max_var_) {
-            it->coeff_update_delayed_ = true;
-        } else {
-            bool reinit_ok = reinit_from_prec(it);
-            CGAL_assertion(reinit_ok); (void)reinit_ok;
-            it->coeff_update_delayed_ = false;
-        }
-        ++it;
-    }
-} // Bitstream_descartes_E08_tree::global_prec_increase()
-
-} // namespace internal
-
-} //namespace CGAL
-
-#endif // CGAL_BITSTREAM_DESCARTES_E08_TREE_H
-
-// EOF
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_rndl_tree.h b/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_rndl_tree.h
deleted file mode 100644
index 3e26f0d..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_rndl_tree.h
+++ /dev/null
@@ -1,1572 +0,0 @@
-// Copyright (c) 2006-2009 Max-Planck-Institute Saarbruecken (Germany).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Arno Eigenwillig <arno at mpi-inf.mpg.de>
-//
-// ============================================================================
-
-// TODO: The comments are all original EXACUS comments and aren't adapted. So
-//         they may be wrong now.
-
-/*! \file NiX/Bitstream_descartes_rndl_tree.h
-    \brief Definition of \c NiX::Bitstream_descartes_rndl_tree.
-*/
-
-#ifndef CGAL_ALGEBRAIC_KERNEL_D_BITSTREAM_DESCARTES_RNDL_TREE_H
-#define CGAL_ALGEBRAIC_KERNEL_D_BITSTREAM_DESCARTES_RNDL_TREE_H
-
-#include <vector>
-#include <list>
-#include <utility>
-#include <iterator>
-#include <algorithm>
-
-#include <CGAL/basic.h>
-#include <CGAL/Random.h>
-
-#include <CGAL/Algebraic_kernel_d/Real_embeddable_extension.h>
-/*#include <CGAL/Handle.h>
-#include <CGAL/Random.h>*/
-
-/*
- *  AUXILIARY CLASSES AND FUNCTIONS
- */
-
-namespace CGAL {
-
-namespace internal {
-
-// TODO: Copied from CGAL/enums.h:
-enum Three_valued_estimate {
-    CLEARLY_NEGATIVE         = -1, //!< = -1. Sign of a value is clearly
-                                   //!<       negative.
-    UNCLEAR_SIGN             =  0, //!< =  0. It is unclear whether value
-                                   //!<       has negative, zero, or positive
-                                   //!<       sign.
-    CLEARLY_POSITIVE         =  1, //!< = +1. Sign of a value is clearly
-                                   //!<       positive.
-
-    CLEARLY_LESS             = -1, //!< = -1. First value is clearly less
-                                   //!<       than second value.
-    UNCLEAR_COMPARISON       =  0, //!< =  0. It is unclear whether first value
-                                   //!<       is less than, equal to, or
-                                   //!<       greater than second value.
-    CLEARLY_GREATER          =  1, //!< = +1. First value is clearly greater
-                                   //!<       than second value.
-
-    CLEARLY_CLOCKWISE        = -1, //!< = -1. Points in the plane or space are
-                                   //!<       clearly oriented clockwise.
-    CLEAR_RIGHT_TURN         = -1, //!< = -1. Points in the plane or space
-                                   //!<       clearly form a right turn.
-    UNCLEAR_ORIENTATION      =  0, //!< =  0. It is not clear whether points in
-                                   //!<       the plane or space are oriented
-                                   //!<       clockwise, counterclockwise, or
-                                   //!<       are in degenerate position.
-
-    UNCLEAR_TURN             =  0, //!< =  0. It is not clear whether points in
-                                   //!<       the plane or space form a left
-                                   //!<       turn, a right turn, or are in
-                                   //!<       degenerate position.
-    CLEAR_LEFT_TURN          =  1, //!< = +1. Points in the plane or space
-                                   //!<       clearly form a left turn.
-    CLEARLY_COUNTERCLOCKWISE =  1, //!< = +1. Points in the plane or space are
-                                   //!<       clearly oriented
-                                   //!<       counterclockwise.
-
-    CLEARLY_ON_NEGATIVE_SIDE  = -1, //!< = -1. Point is clearly on the negative
-                                    //!<       side of an oriented surface.
-    ON_UNCLEAR_ORIENTED_SIDE  =  0, //!< =  0. It is unclear whether point is
-                                    //!<       outside, on, or inside an
-                                    //!<       oriented surface.
-    CLEARLY_ON_POSITIVE_SIDE  =  1, //!< = +1. Point is clearly on the positive
-                                    //!<       side of an oriented surface.
-
-    CLEARLY_ON_UNBOUNDED_SIDE = -1, //!< = -1. Point is clearly in the
-                                    //!<       exterior of a closed surface.
-    ON_UNCLEAR_SIDE           =  0, //!< =  0. It is unclear whether point is
-                                    //!<       outside, on, or inside a closed
-                                    //!<       surface.
-    CLEARLY_ON_BOUNDED_SIDE   =  1  //!< =  1. Point is clearly in the
-                                    //!<       interior of a closed surface.
-};
-
-//! reverses the \a sign (from plus to minus and minus to plus ;-)
-inline Three_valued_estimate operator- ( Three_valued_estimate sign ) {
-    return Three_valued_estimate( - int( sign));
-}
-
-
-// END: Copied from CGAL/enums.h
-
-/*
- * Helper functions
- */
-
-// compute g(x) = 2^p f((ax+b)/c) for c = 2^log_c with absolute error <= 1
-template <class Integer, class RandomAccessIterator, class OutputIterator,
-class Approximator, class CeilLog2AbsInteger, class CeilLog2AbsLong>
-OutputIterator
-polynomial_affine_transform_approx_log_denom(
-        RandomAccessIterator first, RandomAccessIterator beyond,
-        OutputIterator out,
-        Integer a, Integer b, long log_c,
-        long p,
-        Approximator approx,
-        CeilLog2AbsInteger log, CeilLog2AbsLong logl
-) {
-    // degree of input polynomial
-    const int n = int((beyond-first)-1);
-    CGAL_precondition(n >= 0);
-
-    // u[i][j] = \binom{i}{j} a^j b^{i-j}  (0 <= i <= n; 0 <= j <= i)
-    long max_log_u; // = \max_{i,j} \log\abs{u[i][j]}
-    std::vector< std::vector< Integer > > u(n+1);
-    u[0].push_back(Integer(1));
-    max_log_u = 0; // = log(1)
-    for (int i = 1; i <= n; ++i) {
-        u[i].reserve(i+1);
-        u[i].push_back(b*u[i-1][0]);
-        if (u[i][0] != 0) max_log_u = (std::max)(max_log_u, log(u[i][0]));
-        for (int j = 1; j <= i-1; ++j) {
-            u[i].push_back(a*u[i-1][j-1] + b*u[i-1][j]);
-            if (u[i][j] != 0) max_log_u = (std::max)(max_log_u, log(u[i][j]));
-        }
-        u[i].push_back(a*u[i-1][i-1]);
-        if (u[i][i] != 0) max_log_u = (std::max)(max_log_u, log(u[i][i]));
-    }
-
-    long q = logl(n+1) + max_log_u + 1;
-    Integer half = Integer(1) << q-1;
-    std::vector< Integer > h(n+1);
-    RandomAccessIterator it = first;
-    for (int i = 0; i <= n; ++i, ++it) {
-        h[i] = approx(*it, -i*log_c + p + q);
-    }
-    Integer sum;
-    for (int j = 0; j <= n; ++j) {
-        sum = 0;
-        for (int i = j; i <= n; ++i) {
-            sum += u[i][j]*h[i];
-        }
-        sum += half; sum >>= q;  // round to nearest
-        *out++ = sum;
-    }
-    return out;
-} // polynomial_affine_transform_approx_log_denom()
-
-
-template <class Integer>
-Integer caching_factorial(int n) {
-    CGAL_precondition(n >= 0);
-
-    // table of factorials; augment if necessary
-    static std::vector< Integer > factorial;
-    factorial.reserve(n+1);
-    if (factorial.empty()) {
-        factorial.push_back(Integer(1)); // 0! = 1
-        factorial.push_back(Integer(1)); // 1! = 1
-    }
-    for (int i = int(factorial.size()); i <= n; ++i) {
-        factorial.push_back(i*factorial[i-1]);
-    }
-
-    return factorial[n];
-}
-
-
-// Bernst coeff of 2^p n! f(x) wrt [lwr_num,upr_num]/2^log_den w/ abs err <= 1
-template <class Integer,
-    class RandomAccessIterator, class OutputIterator,
-    class Approximator, class CeilLog2AbsInteger, class CeilLog2AbsLong
->
-OutputIterator
-polynomial_power_to_bernstein_approx(
-        RandomAccessIterator first, RandomAccessIterator beyond,
-        OutputIterator out,
-        Integer lower_num, Integer upper_num, long log_denom,
-        long p,
-        Approximator approx, CeilLog2AbsInteger log, CeilLog2AbsLong logl
-) {
-    // degree of input polynomial
-    const int n = int((beyond-first)-1);
-    CGAL_precondition(n >= 0);
-
-    long q = log(caching_factorial<Integer>(n)) + logl(n+1) + 1;
-    Integer half = Integer(1) << q-1;
-    std::vector<Integer> f(n+1);
-    polynomial_affine_transform_approx_log_denom(
-            first, beyond, f.begin(),
-            upper_num - lower_num, lower_num, log_denom,
-            p+q,
-            approx, log, logl
-    );
-    Integer sum, lprod;
-    for (int l = 0; l <= n; ++l) {
-        sum = 0;
-        lprod = 1; // = l*(l-1)*(l-2)*...*(l-(k-1))
-        for (int k = 0; k <= l; ++k) {
-            sum += lprod * caching_factorial<Integer>(n-k) * f[k];
-            lprod *= l-k;
-        }
-        sum += half; sum >>= q;  // round to nearest
-        *out++ = sum;
-    }
-    return out;
-} // polynomial_power_to_bernstein_approx()
-
-
-// min/max number of variations in epsilon-sign
-template <class InputIterator, class UnaryFunction>
-void var_eps( 
-        InputIterator first, InputIterator beyond,
-        int& min_var, int& max_var,
-        const UnaryFunction& sign_eps
-) {
-    min_var = max_var = 0;
-    InputIterator it = first;
-    CGAL_precondition(it != beyond);
-
-    internal::Three_valued_estimate last_sign_min, last_sign_max; // always non-zero
-    last_sign_min = last_sign_max = sign_eps(*it);
-    CGAL_assertion(last_sign_min != internal::UNCLEAR_SIGN);
-
-    while (++it != beyond) {
-        internal::Three_valued_estimate cur_sign = sign_eps(*it);
-        if (cur_sign == internal::UNCLEAR_SIGN) {
-            last_sign_max = -last_sign_max;
-            ++max_var;
-        } else {
-            if (last_sign_max != cur_sign) ++max_var;
-            if (last_sign_min != cur_sign) ++min_var;
-            last_sign_min = last_sign_max = cur_sign;
-        }
-    }
-} // var_eps()
-
-/*
- * The generic de Casteljau method
- */
-
-template <class NT_>
-class Convex_combinator_generic {
-public:
-    typedef NT_ NT;
-private:
-    NT alpha_, beta_;
-public:
-    Convex_combinator_generic(NT alpha) : alpha_(alpha), beta_(NT(1)-alpha) { }
-    void into_first (NT& a, const NT& b) const { a *= alpha_; a +=  beta_*b; }
-    void into_second(const NT& a, NT& b) const { b *=  beta_; b += alpha_*a; }
-    void into_third (const NT& a, const NT& b, NT& c) const {
-        c = a; c *= alpha_; c += beta_*b; // c might alias a but not b
-    }
-};
-
-template <class NT_>
-class Convex_combinator_approx_long_log {
-public:
-    typedef NT_ NT;
-
-private:
-    long alpha_num_, beta_num_, half_;
-    int log_denom_;
-
-public:
-    Convex_combinator_approx_long_log(
-            long alpha_num = 1, int log_denom = 1
-    ) : alpha_num_(alpha_num),
-        beta_num_((1L<<log_denom) - alpha_num),
-        half_((log_denom > 0) ? (1L << (log_denom-1)) : 0),
-        log_denom_(log_denom)
-    {
-        CGAL_precondition(log_denom_ >= 0);
-    }
-    void into_first(NT& a, const NT& b) const {
-        a *= alpha_num_; a += beta_num_*b;
-        a += half_; a >>= log_denom_;  // round to nearest
-    }
-    void into_second(const NT& a, NT& b) const {
-        b *= beta_num_; b += alpha_num_*a;
-        b += half_; b >>= log_denom_;  // round to nearest
-    }
-    void into_third(const NT& a, const NT& b, NT& c) const {
-        c = a; c *= alpha_num_; c += beta_num_*b; // c might alias a but not b
-        c += half_; c >>= log_denom_;  // round to nearest
-    }
-};
-
-template <class NT_>
-class Convex_combinator_approx_midpoint {
-public:
-    typedef NT_ NT;
-
-public:
-    void into_first(NT& a, const NT& b) const {
-        a += b;
-        a += 1; a >>= 1;  // round to nearest
-    }
-    void into_second(const NT& a, NT& b) const {
-        b += a;
-        b += 1; b >>= 1;  // round to nearest
-    }
-    void into_third(const NT& a, const NT& b, NT& c) const {
-        c = a; c += b;  // c might alias a but not b
-        c += 1; c >>= 1;  // round to nearest
-    }
-};
-
-template <class ForwardIterator1, class ForwardIterator2,
-    class ForwardIterator3, class Combinator
->
-std::pair<ForwardIterator2, ForwardIterator3>
-de_casteljau_generic(
-        ForwardIterator1 first, ForwardIterator1 beyond,
-        ForwardIterator2 left, ForwardIterator3 right,
-        const Combinator& combine
-) {
-    // left may not alias any of the other two
-    CGAL_assertion((void*)(&(*left)) != (void*)(&(*first)));
-    CGAL_assertion((void*)(&(*left)) != (void*)(&(*right)));
-
-    /* In the sequel, we think of de Casteljau's algorithm as
-     * filling out a triangular array of numbers:
-     *
-     *     * * * .. *   row 0
-     *      * * .. *    row 1
-     *       .   .       .
-     *        . .        .
-     *         *
-     *
-     * The inputs [first, beyond) form row 0 (at the top).
-     * Row 1 (below row 0) consists of combinations of any two
-     * adjacent elements from row 0.
-     * Inductively, row i+1 consists of combinations of any two
-     * adjacent elements from row i, until we arrive at a row
-     * of length 1.
-     *
-     * We output through iterator left the values appearing
-     * on the triangle's left side.
-     *
-     * We use the container pointed to by iterator right as
-     * storage for the rows (one after the other).
-     * Since each row is one element shorter than the preceding
-     * one, towards the end of this container the values appearing
-     * on the triangle's right accumulate. When we terminate,
-     * the container pointed to by iterator right contains
-     * the triangle's right side, from bottom to top.
-     */
-
-    *left = *first; ++left; // output leftmost element of row 0
-
-    // to compute row 1, we iterate over pairs (*iit1, *iit2)
-    // of adjacent elements of row 0 and combine them into *rit1
-    ForwardIterator1 iit1 = first, iit2 = first; ++iit2; // source
-    ForwardIterator3 rit1 = right;                       // target
-    for (;;) {
-        combine.into_third(*iit1, *iit2, *rit1);
-        ++iit1; ++iit2;
-        if (iit2 == beyond) break;
-        ++rit1;
-    }
-    ForwardIterator3 right_end = rit1;   // point to rightmost element of row 1
-    *++rit1 = *iit1;                     // output rightmost element of row 0
-    ForwardIterator3 right_beyond = ++rit1; // past-the-end
-    *left = *right; ++left;              // output leftmost element of row 1
-
-    // compute rows 2 and later in the same style
-    // invariant: right_end is the rightmost element of the previous row
-    ForwardIterator3 rit2;
-    while (right != right_end) { // prev row was longer than 1 element
-        rit1 = rit2 = right; ++rit2;
-        combine.into_first(*rit1, *rit2);
-        *left = *rit1; ++left;           // output leftmost element
-        while (rit2 != right_end) {
-            ++rit1; ++rit2;
-            combine.into_first(*rit1, *rit2);
-        } 
-        right_end = rit1;
-    }
-
-    return std::make_pair(left, right_beyond);
-} // de_casteljau_generic()
-
-
-
-/*
- * Helper functors
- */
-
-template <class CeilLog2Abs>
-class Abs_le_pow2 {
-public:
-    typedef CeilLog2Abs Ceil_log2_abs;
-    typedef bool result_type;
-    typedef typename Ceil_log2_abs::argument_type first_argument_type;
-    typedef typename Ceil_log2_abs::result_type   second_argument_type;
-    result_type operator() (first_argument_type x, second_argument_type p) {
-        return x == 0 || Ceil_log2_abs()(x) <= p;
-    }
-};
-
-template <class Integer_, class AbsLePow2, class Sign_>
-class Sign_eps_log2 {
-private:
-    long log_eps_;
-
-public:
-    typedef Integer_ Integer;
-    typedef AbsLePow2 Abs_le_pow2;
-    typedef Sign_ Sign;
-    typedef internal::Three_valued_estimate result_type;
-    typedef Integer argument_type;
-
-    Sign_eps_log2(long log_eps = 0) : log_eps_(log_eps) { }
-    long log_eps() const { return log_eps_; }
-    void set_log_eps(long log_eps) { log_eps_ = log_eps; }
-
-    result_type operator() (argument_type x) const {
-        if (Abs_le_pow2()(x, log_eps_)) {
-            return internal::UNCLEAR_SIGN;
-        } else {
-            return internal::Three_valued_estimate(Sign()(x));
-        }
-    }
-}; // class Sign_eps_log2
-
-} // namespace internal
-
-
-namespace internal {
-    template <class BitstreamDescartesRndlTreeTraits>
-    class Bitstream_descartes_rndl_tree;
-
-    template <class BitstreamDescartesRndlTreeTraits>
-    struct Bitstream_descartes_rndl_node;
-
-    template <class BitstreamDescartesRndlTreeTraits>
-    class Bitstream_descartes_rndl_tree_rep;
-} // namespace internal
-
-/* The template argument supplied as BitstreamDescartesRndlTreeTraits
- * shall be a class containing the following types in its scope:
- *   Coefficient:           caller-supplied coefficient type
- *   Bound:              type for interval bound output (exact)
- *   Integer:               integer type for actual calculations, needs >>, <<
- *   Approximator:          functor to get Integer approx to x*2^p from coeff x
- *   Lower_bound_log2_abs:  functor for lower bound to log|x| for coeff x
- *   Bound_creator:      functor to create bound x*2^p from x and p
- *   Sign:                  functor to get sign of Integer x
- *   Ceil_log2_abs_Integer: functor to get smallest long >= log|x| for Integer
- *   Ceil_log2_abs_long:    functor to get smallest long >= log|x| for long
- */
-
-/*
- * macros for common typedefs
- */
-
-// bring types from traits into local scope
-#define CGAL_SNAP_BITSTREAM_DESCARTES_RNDL_TREE_TRAITS_TYPEDEFS(TRAITS) \
-  typedef typename TRAITS::Coefficient           Coefficient;           \
-  typedef typename TRAITS::Bound              Bound;                    \
-  typedef typename TRAITS::Integer               Integer;               \
-  typedef typename TRAITS::Approximator          Approximator;          \
-  typedef typename TRAITS::Lower_bound_log2_abs  Lower_bound_log2_abs;  \
-  typedef typename TRAITS::Bound_creator      Bound_creator;            \
-  typedef typename TRAITS::Sign                  Sign;                  \
-  typedef typename TRAITS::Ceil_log2_abs_Integer Ceil_log2_abs_Integer; \
-  typedef typename TRAITS::Ceil_log2_abs_long    Ceil_log2_abs_long     \
-
-// end #define
-
-// common typedefs for all Bitstream_descartes_rndl_* classes
-#define CGAL_BITSTREAM_DESCARTES_RNDL_TREE_COMMON_TYPEDEFS              \
-  typedef BitstreamDescartesRndlTreeTraits TRAITS;                      \
-  typedef TRAITS Bitstream_descartes_rndl_tree_traits;                  \
-  CGAL_SNAP_BITSTREAM_DESCARTES_RNDL_TREE_TRAITS_TYPEDEFS(TRAITS);      \
-  typedef std::vector<Coefficient> Coefficient_vector;                  \
-  typedef std::vector<Integer> Integer_vector;                          \
-  typedef internal::Abs_le_pow2<Ceil_log2_abs_Integer> Abs_le_pow2;     \
-  typedef internal::Sign_eps_log2<Integer, Abs_le_pow2, Sign>           \
-  Sign_eps_log2                                                         \
-  
-// end #define
-
-// typedefs for Bitstream_descartes_rndl_tree{,_rep}
-#define CGAL_BITSTREAM_DESCARTES_RNDL_TREE_TYPEDEFS                   \
-  CGAL_BITSTREAM_DESCARTES_RNDL_TREE_COMMON_TYPEDEFS;                 \
-  typedef internal::Bitstream_descartes_rndl_node<TRAITS> Node;       \
-  typedef std::list<Node> Node_list                                   \
-
-// end #define
-
-
-namespace internal {
-
-/*
- * class Bitstream_descartes_rndl_node
- */
-
-template <class BitstreamDescartesRndlTreeTraits>
-struct Bitstream_descartes_rndl_node {
-public:
-    typedef Bitstream_descartes_rndl_node Self;
-    CGAL_BITSTREAM_DESCARTES_RNDL_TREE_COMMON_TYPEDEFS;
-
-    friend class internal::Bitstream_descartes_rndl_tree<TRAITS>;
-    friend class internal::Bitstream_descartes_rndl_tree_rep<TRAITS>;
-
-private:
-    // "node data" (set individually in subdivision)
-    Integer lower_num_, upper_num_; // TODO use lower_num_, width_num_ instead
-    long log_bdry_den_;
-    Integer_vector coeff_; // wrt [lower_, upper_], approximate
-    int min_var_, max_var_;
-    // "state data" (copied en bloc by .copy_state_from())
-    long subdiv_tries_, subdiv_fails_;
-    long recdepth_;
-    long log_sep_, delta_log_sep_, log_eps_, log_C_eps_;
-
-    Bitstream_descartes_rndl_node(int degree = -1,
-            Integer lower_num = Integer(0), Integer upper_num = Integer(0),
-            long log_bdry_den = 0, int min_var = -1, int max_var = -1
-    ) : lower_num_(lower_num), upper_num_(upper_num),
-          log_bdry_den_(log_bdry_den),
-          coeff_(degree+1),
-          min_var_(min_var), max_var_(max_var),
-          subdiv_tries_(0), subdiv_fails_(0),
-          recdepth_(-1),
-          log_sep_(0), delta_log_sep_(0), log_eps_(0), log_C_eps_(0)
-    { }
-
-    void copy_state_from(const Self& n) {
-        subdiv_tries_  = n.subdiv_tries_;
-        subdiv_fails_  = n.subdiv_fails_;
-        recdepth_      = n.recdepth_;
-        log_sep_       = n.log_sep_;
-        delta_log_sep_ = n.delta_log_sep_;
-        log_eps_       = n.log_eps_;
-        log_C_eps_     = n.log_C_eps_;
-    }
-
-    // const Self& operator= (const Self&); // assignment is forbidden
-}; // struct Bitstream_descartes_rndl_node
-
-
-/*
- * class Bitstream_descartes_rndl_tree_rep
- */
-
-template <class BitstreamDescartesRndlTreeTraits>
-class Bitstream_descartes_rndl_tree_rep {
-public:
-    typedef Bitstream_descartes_rndl_tree_rep Self;
-    CGAL_BITSTREAM_DESCARTES_RNDL_TREE_TYPEDEFS;
-
-    class Monomial_basis_tag { };
-
-    friend class internal::Bitstream_descartes_rndl_tree<TRAITS>;
-
-private:
-    Coefficient_vector input_monomial_coeff_;
-    int degree_;
-    long ceil_log_degree_;
-    long lbd_log_lcoeff_;
-    Node_list node_list_;
-
-    // temporary data fields for subdivision
-    Integer_vector tmp1_coeff_, tmp2_coeff_;
-    Integer splitpoint_num_;
-    long log_splitpoint_den_;
-
-    // function objects
-    Approximator         approximator_;
-    Lower_bound_log2_abs lower_bound_log2_abs_;
-
-public:
-    Bitstream_descartes_rndl_tree_rep() : degree_(-1) { }
-
-    template <class InputIterator>
-    Bitstream_descartes_rndl_tree_rep(
-            Integer lower_num,  Integer upper_num, long log_bdry_den,
-            InputIterator first, InputIterator beyond, Monomial_basis_tag,
-            const TRAITS& traits
-    ) : input_monomial_coeff_(first, beyond),
-        splitpoint_num_(0), log_splitpoint_den_(0),
-        approximator_(traits.approximator_object()),
-        lower_bound_log2_abs_(traits.lower_bound_log2_abs_object())
-    {
-        degree_ = int(input_monomial_coeff_.size() - 1);
-        CGAL_precondition(degree_ >= 0);
-        ceil_log_degree_ = (degree_ > 0) ? Ceil_log2_abs_long()(degree_) : -1;
-        lbd_log_lcoeff_
-            = lower_bound_log2_abs_(input_monomial_coeff_[degree_]);
-        node_list_.push_front(
-                Node(degree_, lower_num, upper_num, log_bdry_den)
-        );
-        tmp1_coeff_.resize(degree_ + 1);
-        tmp2_coeff_.resize(degree_ + 1);
-    }
-}; // class Bitstream_descartes_rndl_tree_rep
-
-/*
- * class Bitstream_descartes_rndl_tree
- */
-
-/*! \ingroup NiX_Bitstream_descartes_tree
-    \brief Subdivision tree of the BitstreamDescartes method (rndl variant)
-
-    Before you try to understand this class fully, you might want
-    to have a look at the paper on the BitstreamDescartes method
-    mentioned \link NiX_Bitstream_descartes here \endlink.
-    The next paragraph gives a brief summary;
-    the description of this class follows after it.
-
-    <b>The BitstreamDescartes method</b>
-
-    The BitstreamDescartes method searches the real roots of
-    a polynomial in some initial interval by subdividing this
-    interval recursively into open subintervals.
-    Each subinterval is subjected to the Descartes Test,
-    which gives an integer that is an upper bound on the
-    number of real roots in the interval.
-    For efficiency, the BitstreamDescartes method does not compute
-    with the coefficients given by the caller, only approximations of them.
-    Therefore, the result of the Descartes Test may only be known
-    in the form of lower and upper bounds on the exact test,
-    called min_var and max_var.
-    However, the approximation quality of the input coefficients
-    and the choice of the subdivision points are automatically
-    controlled in a way that allows the following conclusions:
-     - If min_var 0 for some interval, this interval
-       does not contain any real root.
-     - If max_var is 1 for some interval, this interval
-       contains exactly one simple real root.
-     - If all real roots of the input polynomial are simple,
-       repeated subdivision will eventually produce intervals
-       that all have min_var equal to max_var equal to 0 or 1.
-
-    Hence we have an algorithm for isolating the real roots
-    of square-free polynomials.  We think of it as constructing
-    a binary tree:
-    Each subinterval considered by the algorithm is a node of the tree.
-    The children of a node are the two subintervals created by subdivision.
-    The root of the tree is the initial interval.
-    At each stage of the algorithm, the interesting nodes are
-    the leaves of the tree.  Subdivision of a leaf turns it
-    into an internal node whose children are leaves.
-
-    <b>Description of class</b>
-
-    This class lets you interactively explore the subdivision
-    tree of the BitstreamDescartes method (or more precisely,
-    its variant called "rndL" in the paper).
-    An object \c T of this class is constructed from an
-    initial interval and the polynomial.
-    The polynomial is read from an iterator range,
-    whose first element is the constant coefficient and whose
-    last element is the leading coefficient (which has to be
-    non-zero).
-
-    After construction, \c T represents the list of leaves
-    in the current subdivision tree.  (Initially, there is
-    only one leaf: the node representing the initial interval.)
-    You can iterate through this list in the style of an
-    \c std::list; that is, a \c Node_iterator is a
-    \c BidirectionalIterator.
-    At any time, the nodes are sorted in the order of the intervals
-    they stand for.
-
-    You cannot dereference an iterator into anything meaningful;
-    however, you can pass it to various member functions
-    that tell you the relevant data about the interval
-    represented by the node, e.g., \c lower() and \c upper()
-    bound and \c min_var() and \c max_var().
-
-    Most importantly, you can \c subdivide() a node.
-    Conceptually, this replaces the interval by two subintervals.
-    However, subintervals with \c min_var() equal to 0
-    are immediately discarded; so \c subdivide() may
-    actually replace one node by zero, one or two new nodes.
-    In fact, if \c min_var() is 0 already for the initial interval,
-    a newly constructed object \c T has an empty list of leaves.
-    (In particular, this happens if the polynomial supplied in
-    construction is constant.)
-
-    Unlike STL containers, this class is implemented using
-    \c CGAL::Handle.  That means, an object is just a ref-counted
-    pointer to the actual representation.  Thus, copying an
-    object is cheap.  However, all copies of an object alias
-    each other.  If you modify one, this changes the state
-    of all copies; including invalidation of iterators pointing
-    to destroyed nodes.
-
-    A \c Node_iterator remains valid until the node it points to
-    is destroyed by \c subdivide() or \c erase().  Destruction
-    of one node does not affect validity of iterators pointing
-    to other nodes.
-
-    <b>Example</b> (root isolation (square-free case))
-
-    Once you have constructed \c T, implementing the BitstreamDescartes
-    method by exploring \c T is a matter of a few lines:
-    \code
-    Node_iterator it = T.begin();
-    Node_iterator chld_first, chld_beyond;
-    while (it != T.end()) {
-        if (T.max_var(it) == 1) {
-            cout << "found [" << T.lower(it) << ", " << T.upper(it) << "]\n"; 
-            ++it;
-        } else {
-            T.subdivide(it, chld_first, chld_beyond);
-            it = chld_first;
-        }
-    }
-    \endcode
-
-    <b>Supplying a traits class</b>
-
-    This class is actually a class template.
-    To use it, you need to instanciate it with a traits class
-    that defines the following three types and the various
-    functors on them listed below.
-     - \c Coefficient: The type of coefficients supplied
-       during construction. Must be \c Assignable .
-     - \c Integer: A type for infinite-precision integer arithmetic
-       (such as \c leda::integer or \c CORE::BigInt ).
-       All internal computations are done using this type.
-       Must be a model of \c Ring and additionally provide
-       operators \c >> and \c << with the usual semantics.
-     - \c Bound:  \c lower() and \c upper() return
-       interval boundaries in this type.  Must be \c Assignable.
-       The canonical choice is \c NiX::Exact_float_number<Integer>.
-       If you never instanciate \c lower() and \c upper()
-       (maybe use \c boundaries() instead), you might be lucky
-       and get away with typedef'ing this to \c void.
-
-    The traits class must also contain the following functors
-    and member functions for their construction:
-     - \c Approximator: A \c BinaryFunction with signature
-       <tt>Integer y = Approximator()(Coefficient x, long p)</tt>
-       that computes an \c Integer approximation
-       to 2<sup><i>p</i></sup> <tt>*</tt> <i>x</i> satisfying
-       |<i>y</i> - 2<sup><i>p</i></sup> <tt>*</tt> <i>x</i>| <= 1.
-     - \c approximator_object(): A \c const member function
-       taking no arguments and returning a function object
-       of class \c Approximator.  This function is called once
-       at construction of \c T to initialize one \c Approximator
-       that is used for all subsequent coefficient approximations.
-       It is only applied to arguments \c x that have had one
-       of the coefficients assigned to them that were supplied
-       during construction of \c T. Hence it can
-       keep state and maybe cache some knowledge about coefficients.
-     - \c Lower_bound_log2_abs: A \c UnaryFunction with signature
-       <tt>long l = Lower_bound_log2_abs()(Coefficient x)</tt>.
-       The result \c l must be a lower bound to log<sub>2</sub>(|<i>x</i>|).
-       If \c Coefficient posesses \c NiX::NT_traits::Floor_log2_abs,
-       you can simply use that.
-     - \c lower_bound_log2_abs_object(): A \c const member function
-       taking no arguments and returning a function object
-       of class \c Lower_bound_log2_abs.  This function is called once
-       at construction of \c T to get a \c Lower_bound_log2_abs
-       on the polynomial's leading coefficient.
-     - \c Bound_creator: A functor with signature
-       <tt>Bound b = Bound_creator()(Integer x, long p)</tt>
-       to construct \c b with value
-       <i>x</i> <tt>*</tt> 2<sup><i>p</i></sup>.
-       If \c Bound has a matching constructor
-       (as \c NiX::Exact_float_number<Integer> does), you can simply
-       <tt>typedef CGAL::Creator_2 <Integer, long, Bound>
-       Bound_creator;</tt>.
-     - \c Sign: A functor working identically to
-       \c NiX::NT_traits::Sign for \c NT equal to \c Integer.
-       (You can just typedef to that.)
-     - \c Ceil_log2_abs_Integer: A functor working identically to
-       \c NiX::NT_traits::Ceil_log2_abs for \c NT equal to \c Integer.
-       (You can just typedef to that.)
-     - \c Ceil_log2_abs_long: A functor working identically to
-       \c NiX::NT_traits::Ceil_log2_abs for \c NT equal to \c long.
-       (You can just typedef to that.)
-
-    In brief, the core requirement is that you can approximate
-    \c Coefficient to any arbitrarily small absolute error
-    2<sup><i>-p</i></sup> (for integral <i>p</i>)
-    and deliver that approximation scaled with 2<sup><i>p</i></sup>
-    as an \c Integer.
-    For the leading coefficient, you also need to be able to locate
-    the leading 1-bit in its binary expansion.
-    The functors dealing with \c Coefficient are accessed
-    through \c _object() member functions so that the user of
-    this class can supply them with an internal state, because
-    \c Coefficient might hide some non-trivial
-    approximation or evaluation process.
-    For the functors dealing with \c Integer, this does not
-    seem necessary.
-
-    <b>Example</b> (traits class)
-
-    You can use the BitstreamDescartes method for polynomials with
-    integer coefficients.  If the coefficients are very long, this
-    saves time over the exact Descartes method, because they are
-    only needed in truncated form. A suitable traits class looks
-    like this:
-    \code
-    template <class Integer_>
-    class Bitstream_descartes_rndl_tree_traits_from_Integer_coeff {
-    public:
-        typedef Integer_ Coefficient;
-        typedef Integer_ Integer;
-        typedef NiX::Exact_float_number<Integer> Bound;
-
-        class Approximator {
-        public:
-            Integer operator() (Coefficient x, long p) {
-                if (p >= 0) return x << p; else return x >> -p;
-            }
-        };
-        Approximator approximator_object() const { return Approximator(); }
-
-        typedef typename NiX::NT_traits<Coefficient>::Floor_log2_abs Lower_bound_log2_abs;
-        Lower_bound_log2_abs lower_bound_log2_abs_object() const { return Lower_bound_log2_abs(); }
-
-        typedef CGAL::Creator_2<Integer, long, Bound> Bound_creator;
-        typedef typename NiX::NT_traits<Integer>::Sign Sign;
-        typedef typename NiX::NT_traits<Integer>::Ceil_log2_abs Ceil_log2_abs_Integer;
-        typedef typename NiX::NT_traits<long>::Ceil_log2_abs Ceil_log2_abs_long;
-    };
-    \endcode
-
-    <b>Technical remarks</b>
-
-    This class implements essentially the "rndL" variant
-    of the BitstreamDescartes method. The following remarks apply:
-
-    It is an invariant that for all nodes, the first and
-    last Bernstein coefficient are larger in magnitude than C eps.
-    Consequently, Lemma 5 of the paper allow us to conclude
-    right away from \c min_var() being 0 what would happen
-    after one further subdivision (namely: there are no roots).
-    We don't have to do this extra subdivision, we know right away.
-    Unfortunately, the analogous argument for Lemma 6 doesn't work,
-    because we still would have to verify that the value at the
-    bisection point is large.
-
-    Subdivision points with value larger than C eps are found
-    by trying randomly and checking.  This randomization means
-    the same polynomial and same initial interval may give rise
-    to different intervals each time this class is used.
-    As indicated in the paper, we favour subdivision ratios
-    with a small denominator. Hence we first try denominator
-    2 (subdivision at midpoint), then denominator 16, and
-    only then the "proper" denominator prescribed by theory.
-    Failures are only counted for the "proper" tries.
-
-    Unlike the algorithm in the paper, we do not have one global
-    estimate for the separation of roots, and we do not restart
-    globally if that estimate turns out wrong.  Instead, each node
-    maintains an estimate.  Upon subdivision, its children
-    inherit it, including the counts of tried and failed
-    subdivisions. If fails/tries >= 1/2 and tries >= 2,
-    the estimate of separation (and all other parameters
-    coming out of it) are updated only for this one node.
-    The node's interval does not change; subdivision
-    resumes from this interval with an improved estimate of
-    separation.  All other nodes are unaffected.
-    Global restart is not an option for this class, because the user has
-    already observed the subintervals found up to this point,
-    so we cannot simply switch to other intervals.
-
-    This implementation relies on the assumption that the
-    <i>logarithms</i> of certain relevant quantities, in particular
-    the degree times the logarithm of the estimated separation,
-    are small enough to be representable in a <tt>long int</tt>.
-    Also, the degree of the input polynomial and related quantities
-    are assumed to fit into an \c int.
- */
-template <class BitstreamDescartesRndlTreeTraits>
-class Bitstream_descartes_rndl_tree
-// TODO: Replaced CGAL::Handle by following CGAL::Handle_with_policy, is this correct?
-    : public ::CGAL::Handle_with_policy< Bitstream_descartes_rndl_tree_rep<
-        BitstreamDescartesRndlTreeTraits
-    >, ::CGAL::Handle_policy_no_union >
-{
-public:
-    typedef Bitstream_descartes_rndl_tree Self;
-    CGAL_BITSTREAM_DESCARTES_RNDL_TREE_TYPEDEFS;
-    typedef Bitstream_descartes_rndl_tree_rep<TRAITS> Rep;
-    typedef ::CGAL::Handle_with_policy< Rep, ::CGAL::Handle_policy_no_union > Base;
-
-    //! node iterator.
-    typedef typename Node_list::iterator       Node_iterator;
-    //! node iterator (for STL compatibility only).
-    typedef typename Node_list::iterator       iterator;
-    //! const node iterator.
-    typedef typename Node_list::const_iterator Node_const_iterator;
-    //! const node iterator (for STL compatibility only).
-    typedef typename Node_list::const_iterator const_iterator;
-
-    //! tag type to distinguish a certain constructor.
-    typedef typename Rep::Monomial_basis_tag Monomial_basis_tag;
-
-public:
-    //! default constructor (makes <tt>degree() == -1</tt>)
-    Bitstream_descartes_rndl_tree() : Base(Rep()) { }
-
-    //! copy constructor
-    Bitstream_descartes_rndl_tree(const Self& p)
-        : Base(static_cast<const Base&>(p))
-    { }
-
-    //! Internal function called by constructor. Avoids code duplication
-    void init_tree() {
-        Node_iterator n = this->ptr()->node_list_.begin();
-        if (this->ptr()->degree_ > 0) {
-            initial_guess_sep(n);
-            while (!reinit_from_sep(n)) next_guess_sep(n);
-            if (n->min_var_ == 0) this->ptr()->node_list_.erase(n);
-        } else {
-            this->ptr()->node_list_.erase(n);
-        }
-    }
-        
-
-    /*! \brief construct from initial interval and coefficients
-     *
-     *  The initial interval is
-     *  [\c lower_num, \c upper_num] / 2^(\c log_bdry_den ).
-     *
-     *  The iterator range [\c first, \c beyond ) gives the
-     *  coefficients of 1, <i>x</i>, <i>x</i><sup>2</sup>, ...
-     *  The leading coefficient (last in sequence) must be non-zero.
-     *
-     *  The \c Monomial_basis_tag is required for the benefit of
-     *  future extensions to coefficients w.r.t. other bases.
-     */
-    template <class InputIterator>
-    Bitstream_descartes_rndl_tree(
-            Integer lower_num,  Integer upper_num, long log_bdry_den,
-            InputIterator first, InputIterator beyond, Monomial_basis_tag tag,
-            const BitstreamDescartesRndlTreeTraits& traits
-                                        = BitstreamDescartesRndlTreeTraits()
-    ) : Base(Rep(lower_num, upper_num, log_bdry_den,
-                    first, beyond, tag, traits))
-    {
-        CGAL_precondition(lower_num < upper_num);
-        init_tree();
-        
-    }
-
-    /*! 
-     * This is needed for compatibility with other tree implementations
-     * The initial interval is
-     *  [-1, 1] / 2^(\c -log_bdry_den ).
-     * Be aware that log_bdry_den is negated here!
-     */
-    template <class InputIterator>
-    Bitstream_descartes_rndl_tree(
-            long log_bdry_den,
-            InputIterator first, InputIterator beyond, Monomial_basis_tag tag,
-            const BitstreamDescartesRndlTreeTraits& traits
-                                        = BitstreamDescartesRndlTreeTraits()
-    )
-        : Base(Rep(Integer(-1), Integer(1), -log_bdry_den, 
-                   first, beyond, tag, traits))
-    {
-        init_tree();
-    }
-
-    //! return degree of polynomial
-    int degree() const { return this->ptr()->degree_; }
-
-    //! iterator to first node
-    Node_iterator begin() {
-        return this->ptr()->node_list_.begin();
-    }
-    //! iterator beyond last node
-    Node_iterator end() {
-        return this->ptr()->node_list_.end();
-    }
-    //! const iterator to first node
-    Node_const_iterator begin() const {
-        return this->ptr()->node_list_.begin();
-    }
-    //! const iterator beyond last node
-    Node_const_iterator end() const {
-        return this->ptr()->node_list_.end();
-    }
-
-    //! get lower bound of interval at node \c n.
-    Bound lower(Node_iterator n) const {
-        return Bound_creator()(n->lower_num_, -n->log_bdry_den_);
-    }
-    //! get lower bound of interval at node \c n.
-    Bound lower(Node_const_iterator n) const {
-        return Bound_creator()(n->lower_num_, -n->log_bdry_den_);
-    }
-    //! get upper bound of interval at node \c n.
-    Bound upper(Node_iterator n) const {
-        return Bound_creator()(n->upper_num_, -n->log_bdry_den_);
-    }
-    //! get upper bound of interval at node \c n.
-    Bound upper(Node_const_iterator n) const {
-        return Bound_creator()(n->upper_num_, -n->log_bdry_den_);
-    }
-
-    //! get boundaries: interval at node \c n is
-    //! [\c lower_num, \c upper_num] / 2^(\c log_bdry_den ).
-    void boundaries(Node_iterator n,
-            Integer& lower_num, Integer& upper_num, long& log_bdry_den
-    ) {
-        lower_num    = n->lower_num_;
-        upper_num    = n->upper_num_;
-        log_bdry_den = n->log_bdry_den_;
-    }
-
-    //! get minimum number of sign variations in Descartes Test
-    //! for approximate polynomial at node \c n
-    int min_var(Node_const_iterator n) const { return n->min_var_; }
-    //! get maximum number of sign variations in Descartes Test
-    //! for approximate polynomial at node \c n
-    int max_var(Node_const_iterator n) const { return n->max_var_; }
-
-    /*! \brief subdivide interval at node \c n.
-     *
-     *  The node representing interval \c n is replaced in the list
-     *  of nodes by 0, 1, or 2 nodes that represent those among the
-     *  two subintervals that have \c min_var() greater than 0.
-     *  The number of new nodes is returned as result.
-     *  The subrange of nodes consisting of the new nodes is
-     *  returned in the arguments \c first and \c beyond
-     *
-     *  Subdividing a node invalidates all iterators to it;
-     *  both for the object where \c subdivide() was called
-     *  and all copies of it (since they share the same
-     *  representation and state).
-     *
-     *  The parameter \c n is passed by value.  Hence you can
-     *  implement depth-first search for isolating intervals like this:
-     *  \code
-     *    Node_iterator dummy, curr = tree.begin();
-     *    while (curr != tree.end()) {
-     *        if (tree.max_var(curr) == 1) ++curr;
-     *        else tree.subdivide(curr, curr, dummy);
-     *    }
-     *  \endcode
-     */
-    int subdivide(
-            Node_iterator n, Node_iterator& first, Node_iterator& beyond
-    );
-
-    /*! \brief erase node \c n.
-     *
-     *  Erasing a node invalidates all iterators to it;
-     *  both for the object where \c subdivide() was called
-     *  and all copies of it (since they share the same
-     *  representation and state).
-     */
-    void erase(Node_iterator n) {
-        this->ptr()->node_list_.erase(n);
-    }
-
-    /*! \brief Replace traits class
-     */
-    void set_traits(TRAITS& traits) {
-
-      this->ptr()->approximator_ 
-        = traits.approximator_object();
-      this->ptr()->lower_bound_log2_abs_ 
-        = traits.lower_bound_log2_abs_object();
-
-    }
-
-    /*! \brief Returns a copy of this with its own representation
-     */
-    Self make_unique() const {
-      Self tmp = *this;
-      tmp.copy_on_write();
-      return tmp;
-    }
-
-
-protected:
-    int subdivide_at_midpoint(
-            Node_iterator n, Node_iterator& first, Node_iterator& beyond
-    );
-
-    int subdivide_at(
-            Node_iterator n, Node_iterator& first, Node_iterator& beyond,
-            long alpha_num, int log_alpha_den
-    );
-
-private:
-    int replace_by_tmp(
-            Node_iterator n, Node_iterator& first, Node_iterator& beyond
-    );
-
-    void initial_guess_sep(Node_iterator n) {
-        Ceil_log2_abs_Integer log;
-        long log_I = log(n->upper_num_-n->lower_num_) - n->log_bdry_den_;
-        n->delta_log_sep_ = -5;
-        n->log_sep_ = log_I + n->delta_log_sep_;
-    }
-
-    void next_guess_sep(Node_iterator n) {
-        n->delta_log_sep_ *= 2;
-        CGAL_warning_msg(-n->delta_log_sep_ < 1L<<24, "delta_log_sep >= 1L<<24");
-        n->log_sep_ += n->delta_log_sep_;
-    }
-
-    bool reinit_from_sep(Node_iterator n);
-
-}; // class Bitstream_descartes_rndl_tree
-
-
-/*
- * Non-inline member functions of class Bitstream_descartes_rndl_tree
- */
-
-template <class BitstreamDescartesRndlTreeTraits>
-bool
-Bitstream_descartes_rndl_tree<BitstreamDescartesRndlTreeTraits>
-::reinit_from_sep(Node_iterator n) {
-    n->subdiv_tries_ = n->subdiv_fails_ = 0;
-
-    Ceil_log2_abs_Integer log;
-    /* We want to set recdepth to
-     *   floor( (log(|I|/sep) / log(4/3)) + 5/2 )
-     * or something slightly larger.
-     * Using the continued fractions expansion [2,2,2,3],
-     * we find an upper bound of 41/17 = 82/34 = 2.41176...
-     * for the exact multiplier     1/log(4/3) = 2.40942...
-     * which is off by less than 0.1%, namely    0.00234...
-     * Noting 5/2 = 85/34, we hence set recdepth to
-     *   floor( (log|I| - log(sep))*82 + 85) / 34 )
-     */
-    n->recdepth_ = (
-            (log(n->upper_num_ - n->lower_num_) - n->log_bdry_den_ // log|I|
-            - n->log_sep_
-        )*82 + 85) / 34;
-    if (n->recdepth_ < 6) n->recdepth_ = 6; // TODO find rationale
-
-    n->log_eps_ = this->ptr()->ceil_log_degree_
-        + Ceil_log2_abs_long()(n->recdepth_);
-    n->log_C_eps_ = n->log_eps_ + 4*degree(); // C = 16^n
-    long target_log_lcf = (4 - n->log_sep_)*this->ptr()->degree_
-        + n->log_eps_ + 2*this->ptr()->ceil_log_degree_ + 10;
-    long log_lcf_scale = target_log_lcf - this->ptr()->lbd_log_lcoeff_
-        - (log(caching_factorial<Integer>(this->ptr()->degree_)) - 1);
-
-    polynomial_power_to_bernstein_approx(
-            this->ptr()->input_monomial_coeff_.begin(),
-            this->ptr()->input_monomial_coeff_.end(),
-            n->coeff_.begin(),
-            n->lower_num_, n->upper_num_, n->log_bdry_den_,
-            log_lcf_scale - (n->log_eps_ - 1),
-            this->ptr()->approximator_,
-            Ceil_log2_abs_Integer(), Ceil_log2_abs_long()
-    );
-    for (int i = 0; i <= degree(); ++i) {
-        n->coeff_[i] <<= (n->log_eps_ - 1); // TODO avoid preceding rshift
-    }
-
-    if (Abs_le_pow2()(n->coeff_[ degree()], n->log_C_eps_)
-            ||  Abs_le_pow2()(n->coeff_[0], n->log_C_eps_)
-    ) {
-        return false;
-    } else {
-        var_eps(n->coeff_.begin(), n->coeff_.end(),
-                n->min_var_, n->max_var_, Sign_eps_log2(n->log_eps_)
-        );
-        return true;
-    }
-} // Bitstream_descartes_rndl_tree::reinit_from_sep()
-
-template <class BitstreamDescartesRndlTreeTraits>
-int
-Bitstream_descartes_rndl_tree<BitstreamDescartesRndlTreeTraits>
-::subdivide_at_midpoint(
-        Node_iterator n, Node_iterator& first, Node_iterator& beyond
-) {
-    de_casteljau_generic(n->coeff_.begin(), n->coeff_.end(),
-            this->ptr()->tmp1_coeff_.begin(), this->ptr()->tmp2_coeff_.begin(),
-            Convex_combinator_approx_midpoint<Integer>()
-    );
-    this->ptr()->splitpoint_num_     = n->lower_num_ + n->upper_num_;
-    this->ptr()->log_splitpoint_den_ = n->log_bdry_den_ + 1;
-
-    if (Abs_le_pow2()(this->ptr()->tmp2_coeff_[0], n->log_C_eps_)) {
-        return -1;
-    } else {
-        return replace_by_tmp(n, first, beyond);
-    }
-} // Bitstream_descartes_rndl_tree::subdivide_at()
-
-template <class BitstreamDescartesRndlTreeTraits>
-int
-Bitstream_descartes_rndl_tree<BitstreamDescartesRndlTreeTraits>
-::subdivide_at(
-        Node_iterator n, Node_iterator& first, Node_iterator& beyond,
-        long alpha_num, int log_alpha_den
-) {
-    de_casteljau_generic(n->coeff_.begin(), n->coeff_.end(),
-        this->ptr()->tmp1_coeff_.begin(), this->ptr()->tmp2_coeff_.begin(),
-        Convex_combinator_approx_long_log<Integer>(alpha_num, log_alpha_den)
-    );
-    this->ptr()->splitpoint_num_ =
-        alpha_num * n->lower_num_
-            + ((1L << log_alpha_den) - alpha_num) * n->upper_num_;
-    this->ptr()->log_splitpoint_den_ = n->log_bdry_den_ + log_alpha_den;
-
-    if (Abs_le_pow2()(this->ptr()->tmp2_coeff_[0], n->log_C_eps_)) {
-        return -1;
-    } else {
-        return replace_by_tmp(n, first, beyond);
-    }
-} // Bitstream_descartes_rndl_tree::subdivide_at()
-
-
-template <class BitstreamDescartesRndlTreeTraits>
-int
-Bitstream_descartes_rndl_tree<BitstreamDescartesRndlTreeTraits>
-::replace_by_tmp(
-        Node_iterator n, Node_iterator& first, Node_iterator& beyond
-) {
-    --(n->recdepth_);
-
-    long delta_log_bdry_den =
-        this->ptr()->log_splitpoint_den_ - n->log_bdry_den_;
-    CGAL_assertion(delta_log_bdry_den >= 0);
-
-    int l_min_var, l_max_var, r_min_var, r_max_var;
-    var_eps(this->ptr()->tmp1_coeff_.begin(),
-            this->ptr()->tmp1_coeff_.end(),
-            l_min_var, l_max_var, Sign_eps_log2(n->log_eps_)
-    );
-    var_eps(this->ptr()->tmp2_coeff_.begin(),
-            this->ptr()->tmp2_coeff_.end(),
-            r_min_var, r_max_var, Sign_eps_log2(n->log_eps_)
-    );
-    CGAL_assertion(l_min_var >= 0 && l_max_var >= 0);
-    CGAL_assertion(r_min_var >= 0 && r_max_var >= 0);
-
-    beyond = first = n;
-    ++beyond;
-
-    if (l_min_var > 0) {
-        int children = 1;
-        if (r_min_var > 0) {
-            // create new node for right child
-            Node_iterator r = 
-                this->ptr()->node_list_.insert(beyond, Node(degree(),
-                            this->ptr()->splitpoint_num_,        // lower
-                            n->upper_num_ << delta_log_bdry_den, // upper
-                            this->ptr()->log_splitpoint_den_,
-                            r_min_var, r_max_var
-                ));
-            r->coeff_.swap(this->ptr()->tmp2_coeff_);
-            r->copy_state_from(*n);
-            ++children;
-        }
-        // put left child into n
-        n->lower_num_  <<= delta_log_bdry_den;
-        n->upper_num_    = this->ptr()->splitpoint_num_;
-        n->log_bdry_den_ = this->ptr()->log_splitpoint_den_;
-        n->min_var_      = l_min_var;
-        n->max_var_      = l_max_var;
-        n->coeff_.swap(this->ptr()->tmp1_coeff_);
-        return children;
-    } else if (r_min_var > 0) {
-        // put right child into n
-        n->lower_num_    = this->ptr()->splitpoint_num_;
-        n->upper_num_  <<= delta_log_bdry_den;
-        n->log_bdry_den_ = this->ptr()->log_splitpoint_den_;
-        n->min_var_      = r_min_var;
-        n->max_var_      = r_max_var;
-        n->coeff_.swap(this->ptr()->tmp2_coeff_);
-        return 1;
-    } else /* l_min_var == 0 && r_min_var == 0 */ {
-        // delete n
-        first = beyond;
-        this->ptr()->node_list_.erase(n);
-        return 0;
-    }
-} // Bitstream_descartes_rndl_tree::replace_by_tmp()
-
-template <class BitstreamDescartesRndlTreeTraits>
-int
-Bitstream_descartes_rndl_tree<BitstreamDescartesRndlTreeTraits>
-::subdivide(
-        Node_iterator n, Node_iterator& first, Node_iterator& beyond
-) {
-    long alpha_num;
-    int  log_alpha_den;
-    long alpha_den_4;
-    int  ret;
-
-    for (;;) {
-        if (n->recdepth_ > 0) { // TODO decouple recdepth from guess_sep
-            // first try heuristic alpha = 1/2 (failures don't count)
-            ++(n->subdiv_tries_);
-            ret = subdivide_at_midpoint(n, first, beyond);
-            if (ret >= 0) { return ret; } else { --(n->subdiv_tries_); }
-
-            // next try heuristic alpha with small denom (failures don't count)
-            log_alpha_den = 4;
-            alpha_den_4 = 1L << (log_alpha_den - 2);
-            alpha_num = CGAL::default_random.get_int(  // TODO .get_long
-                    alpha_den_4, 3*alpha_den_4 + 1
-            );
-            ++(n->subdiv_tries_);
-            ret = subdivide_at(n, first, beyond, alpha_num, log_alpha_den);
-            if (ret >= 0) { return ret; } else { --(n->subdiv_tries_); }
-
-            // now try alpha properly randomized, counting failure rate
-            log_alpha_den = 5 + this->ptr()->ceil_log_degree_;
-            alpha_den_4 = 1L << (log_alpha_den - 2);
-            do {
-                alpha_num = CGAL::default_random.get_int(  // TODO .get_long
-                        alpha_den_4, 3*alpha_den_4 + 1
-                );
-                ++(n->subdiv_tries_);
-                ret = subdivide_at(n, first, beyond, alpha_num, log_alpha_den);
-                if (ret >= 0) {
-                    return ret;
-                } else {
-                    ++(n->subdiv_fails_);
-                }
-            } while (n->subdiv_fails_ < 2  // Arno says: 2 (not 6) is enough
-                    || 2 * n->subdiv_fails_ < n->subdiv_tries_);
-        } // if (n->recdepth_ > 0)
-
-        // if failure rate too high or recdepth exceeded,
-        // decrease guess of sep and restart
-        next_guess_sep(n);
-        bool reinit_success = reinit_from_sep(n);
-        CGAL_assertion(reinit_success); (void)reinit_success;
-    } // for (;;)
-} // Bitstream_descartes_rndl_tree::subdivide()
-
-} // namespace internal
-
-
-/*
- * FUJIWARA ROOT BOUND
- */
-
-namespace internal {
-
-struct Fujiwara_root_bound_queue_entry {
-    typedef Fujiwara_root_bound_queue_entry Self;
-
-    int n_minus_i;
-    long ub_log2_qi;
-    bool is_certainly_zero;
-    bool is_tight;
-
-    bool operator < (Self& rhs) {
-        if (is_certainly_zero) return !rhs.is_certainly_zero;
-        if (rhs.is_certainly_zero) return false;
-        return ub_log2_qi * rhs.n_minus_i < rhs.ub_log2_qi * n_minus_i;
-    }
-};
-
-class Fujiwara_root_bound_queue_entry_ptr_less {
-public:
-    typedef bool result_type;
-    typedef Fujiwara_root_bound_queue_entry* first_argument_type;
-    typedef Fujiwara_root_bound_queue_entry* second_argument_type;
-    result_type operator() (first_argument_type a, second_argument_type b) {
-        return *a < *b;
-    }
-};
-
-template <class CeilLog2Abs>
-class Upper_bound_log2_abs_approximator_from_ceil_log2_abs {
-public:
-    typedef Upper_bound_log2_abs_approximator_from_ceil_log2_abs Self;
-    typedef CeilLog2Abs Ceil_log2_abs;
-    typedef typename Ceil_log2_abs::argument_type NT;
-    bool initial_upper_bound(NT x, long& ub_log2, bool& is_certainly_zero) {
-        is_certainly_zero = (x == NT(0));
-        if (!is_certainly_zero) ub_log2 = Ceil_log2_abs()(x);
-        return true; // reported bound is tight
-    }
-    bool improve_upper_bound(NT, long&, bool&) { return true; }
-};
-
-/*! \ingroup NiX_Bitstream_descartes_tree
-    \brief Fujiwara root bound (as logarithm wrt base 2)
-
-    All complex roots of a polynomial
-    <i>A</i>(<i>X</i>) = <i>a<sub>n</sub>X<sup>n</sup></i> + ... + <i>a</i><sub>0</sub>
-    are bounded in magnitude by
-    F(<i>A</i>) = 2 max<sub><i>i</i><<i>n</i></sub> <i>q<sub>i</sub></i><sup>1/(<i>n</i>-<i>i</i>)</sup>
-    where <i>q<sub>i</sub></i> = |<i>a<sub>i</sub></i>/<i>a<sub>n</sub></i>|
-    for 0 < <i>i</i> < <i>n</i>
-    and <i>q</i><sub>0</sub>
-    = |<i>a</i><sub>0</sub>/(2<i>a<sub>n</sub></i>)|.
-    This bound goes back to M. Fujiwara
-    [<i>Tohoku Math. J.</i> <b>10</b> (1916) 167-171],
-    cited here after P. Batra's PhD thesis [TU Hamburg-Harburg, Germany, 1999].
-
-    This function computes an integer upper bound for
-    log<sub>2</sub>(F(<i>A</i>)) from an iterator range [first, beyond)
-    over values of some type \c Coefficient
-    where <tt>*(first+i)</tt> is <i>a<sub>i</sub></i>.
-    This function does not operate on type \c Coefficient
-    except through the two function objects passed to it:
-
-    <tt>LowerBoundLog2Abs lblog2</tt> has to be a function object
-    with a function call operator taking an argument
-    <tt>*(beyond-1)</tt> of type \c Coefficient
-    and returning a \c long which is a lower bound for
-    log<sub>2</sub>(|<i>a<sub>n</sub></i>|).
-    This functor is called once and should return a bound as
-    good as possible.
-
-    <tt>UpperBoundLog2AbsApproximator ublog2apx</tt> has to be an
-    object with two member functions
-    \c initial_upper_bound() and \c improve_upper_bound().
-    Both of them take three arguments:
-    <tt>(Coefficient ai, long& ub_log2, bool& is_certainly_zero)</tt>
-    and return <tt>bool</tt>. \c ai is one of the coefficients.
-    First, the member function \c initial_upper_bound() is invoked
-    on \c ai and uninitialized arguments \c ub_log2 and \c is_certainly_zero.
-    Then, \c improve_upper_bound() is invoked repeatedly on \c ai and
-    arguments \c ub_log2 and \c is_certainly_zero as set by the
-    previous call.  This sequence of calls has to create a
-    sequence of estimates of upper bounds for
-    log<sub>2</sub>(|<tt>ai</tt>|).  As long as
-    a later call will return a better approximation,
-    the function returns \c false. If the current bound is to be
-    regarded as best possible, the function returns \c true.
-    If, while improving the bound, it is discovered that
-    <tt>ai</tt> is zero, in which case the correct estimate would be
-    "minus infinity", \c is_certainly_zero is set to \c true;
-    otherwise it is always \c false.
-    If \c is_certainly_zero is set to \c true,
-    the value of \c ub_log2 is ignored.
-
-    Internally, this function works as follows:
-    It improves upper bounds of log<sub>2</sub>(|<i>a<sub>i</sub></i>|)
-    for all <i>i</i> < <i>n</i> until it has found one that
-    is designated as best possible (i.e., has returned \c true)
-    and that realizes the maximum in the definition
-    of the Fujiwara bound. Unlike \c LowerBoundLog2Abs, which is
-    called only once, namely for the leading coefficient, and should
-    provide the best possible bound at once,
-    \c UpperBoundLog2AbsApproximator is called repeatedly,
-    and each call should perform only a limited amount of work
-    (e.g., one round of interval refinement for its argument)
-    so that this function can distribute the approximation work
-    evenly over all coefficients until the maximum is found.
-
-    The leading coefficient <tt>*(beyond-1)</tt> has to be non-zero.
-    In the special case that all other coefficients are zero,
-    the result 0 (standing for 2<sup>0</sup>=1) is returned.
-    Obviously, this cannot happen for a square-free polynomial
-    of degree larger than 1.
-
-    <b>Warning:</b> This bound is tight for certain polynomials
-    (e.g., (<i>X</i>-2)(<i>X<sup>n</sup></i>-1)/(<i>X</i>-1)).
-    The BitstreamDescartes method, however, needs an initial interval
-    whose boundaries are far away from the zeroes. Hence you should
-    add 1 to the result of this function before using it there.
-    Also bear in mind that this function returns a logarithm of
-    the bound, whereas certain other functions may expect a
-    logarithm of a denominator, necessitating a negation.
-
-    For coefficients that are known explicitly (e.g., big integers)
-    and possess <tt>NiX::NT_traits::{Floor,Ceil}_log2_abs</tt> functors,
-    the lower and upper bound function objects for this function
-    should be constructed from them.  This is done automatically
-    by an overloaded version of this functions that takes only the
-    first two arguments.
- */
-template<class RandomAccessIterator,
-    class LowerBoundLog2Abs,
-    class UpperBoundLog2AbsApproximator
->
-long Fujiwara_root_bound_log(
-    RandomAccessIterator first, RandomAccessIterator beyond,
-    LowerBoundLog2Abs lblog2, UpperBoundLog2AbsApproximator ublog2apx
-) {
-    int n = beyond - first - 1; // degree
-    if (n < 1) return 0;
-    long lblog2_lcoeff = lblog2(*(beyond - 1));
-
-    Fujiwara_root_bound_queue_entry_ptr_less less;
-    typedef Fujiwara_root_bound_queue_entry QE;
-    std::vector<QE>  entries(n); // entries are never copied
-    std::vector<QE*> heap(n);    // heap is built from pointers to them
-    for (int i = 0; i < n; ++i) {
-        QE& entry = entries[i];
-        entry.n_minus_i = n - i;
-        entry.is_tight = ublog2apx.initial_upper_bound(
-                *(first + i), entry.ub_log2_qi, entry.is_certainly_zero
-        );
-        CGAL_assertion(entry.is_tight || !entry.is_certainly_zero);
-        if (!entry.is_certainly_zero) entry.ub_log2_qi -= lblog2_lcoeff;
-        heap[i] = &(entry);
-    }
-    entries[0].ub_log2_qi -= 1;
-
-    std::make_heap(heap.begin(), heap.end(), less);
-    while (!heap[0]->is_tight) {
-        std::pop_heap(heap.begin(), heap.end(), less);
-        QE& popped = **(heap.end() - 1);
-        int i = n - popped.n_minus_i;
-        CGAL_assertion(i >= 0 && i < n);
-        CGAL_assertion(&popped == &(entries[i]));
-        popped.is_tight = ublog2apx.improve_upper_bound(
-                *(first + i),
-                popped.ub_log2_qi, popped.is_certainly_zero
-        );
-        if (!popped.is_certainly_zero) {
-            popped.ub_log2_qi -= lblog2_lcoeff;
-            if (i == 0) popped.ub_log2_qi -= 1;
-        }
-        std::push_heap(heap.begin(), heap.end(), less);
-    }
-    QE& maxi = *(heap[0]);
-    if (maxi.is_certainly_zero) return 0;
-    long max_log2_qi_div_n_minus_i = maxi.ub_log2_qi / maxi.n_minus_i;
-    if (maxi.ub_log2_qi % maxi.n_minus_i > 0) ++max_log2_qi_div_n_minus_i;
-    return 1 + max_log2_qi_div_n_minus_i; // = log ( 2 * max_i q_i^{1/(n-i)} )
-}
-
-template<class RandomAccessIterator>
-inline
-long Fujiwara_root_bound_log(
-    RandomAccessIterator first, RandomAccessIterator beyond
-) {
-    typedef typename RandomAccessIterator::value_type NT;
-    typedef typename internal::Real_embeddable_extension<NT>::Floor_log2_abs Lbd;
-    typedef Upper_bound_log2_abs_approximator_from_ceil_log2_abs<
-                typename internal::Real_embeddable_extension<NT>::Ceil_log2_abs
-            > Ubd;
-    return Fujiwara_root_bound_log(first, beyond, Lbd(), Ubd());
-}
-
-
-} // namespace internal
-
-} //namespace CGAL
-
-#endif // CGAL_ALGEBRAIC_KERNEL_D_BITSTREAM_DESCARTES_RNDL_TREE_H
-
-// EOF
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/uncertain/Apollonius_graph_uncertain_filtered_traits_2.h b/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/uncertain/Apollonius_graph_uncertain_filtered_traits_2.h
deleted file mode 100644
index 5a77072..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/uncertain/Apollonius_graph_uncertain_filtered_traits_2.h
+++ /dev/null
@@ -1,509 +0,0 @@
-// Copyright (c) 2003,2004  INRIA Sophia-Antipolis (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
-// 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(s)     : Menelaos Karavelas <mkaravel at iacm.forth.gr>
-
-
-
-#ifndef CGAL_APOLLONIUS_GRAPH_UNCERTAIN_FILTERED_TRAITS_2_H
-#define CGAL_APOLLONIUS_GRAPH_UNCERTAIN_FILTERED_TRAITS_2_H
-
-
-#include <CGAL/Apollonius_graph_traits_2.h>
-#include <CGAL/Apollonius_graph_2/new_traits/Apollonius_graph_new_traits_2.h>
-
-#include <CGAL/Filtered_predicate.h>
-#include <CGAL/Filtered_construction.h>
-
-// includes for the default parameters of the filtered traits
-#include <CGAL/Simple_cartesian.h>
-#include <CGAL/MP_Float.h>
-#include <CGAL/Interval_arithmetic.h>
-#include <CGAL/Cartesian_converter.h>
-#include <CGAL/number_utils_classes.h>
-
-
-// new includes
-
-#include <CGAL/Apollonius_graph_2/uncertain/Uncertain_is_hidden_C2.h>
-#include <CGAL/Apollonius_graph_2/uncertain/Uncertain_oriented_side_of_bisector_C2.h>
-#include <CGAL/Apollonius_graph_2/uncertain/Uncertain_vertex_conflict_2.h>
-
-
-namespace CGAL {
-
-
-//-----------------------------------------------------------------------
-//-----------------------------------------------------------------------
-//-----------------------------------------------------------------------
-//-----------------------------------------------------------------------
-// the filtered Traits class
-//-----------------------------------------------------------------------
-//-----------------------------------------------------------------------
-//-----------------------------------------------------------------------
-//-----------------------------------------------------------------------
-
-template<class CK_t,
-	 class CK_MTag = Integral_domain_without_division_tag,
-	 class EK_t    = Simple_cartesian< MP_Float >,
-	 class EK_MTag = CK_MTag,
-	 class FK_t    = Simple_cartesian< Interval_nt<false> >,
-	 class FK_MTag = CK_MTag,
-         class C2E_t   = Cartesian_converter<CK_t, EK_t>,
-         class C2F_t   =
-         Cartesian_converter<CK_t, FK_t, To_interval<typename CK_t::RT> > >
-class Apollonius_graph_uncertain_filtered_traits_2
-{
-private:
-  typedef Apollonius_graph_traits_2<CK_t, CK_MTag>    CK_traits;
-  typedef Apollonius_graph_traits_2<FK_t, FK_MTag>    FK_traits;
-  typedef Apollonius_graph_traits_2<EK_t, EK_MTag>    EK_traits;
-
-  typedef
-  CGAL_APOLLONIUS_GRAPH_2_NS::Apollonius_graph_kernel_wrapper_2<CK_t>     CK;
-
-  typedef
-  CGAL_APOLLONIUS_GRAPH_2_NS::Apollonius_graph_kernel_wrapper_2<FK_t>     FK;
-
-  typedef
-  CGAL_APOLLONIUS_GRAPH_2_NS::Apollonius_graph_kernel_wrapper_2<EK_t>     EK;
-
-  typedef
-  CGAL_APOLLONIUS_GRAPH_2_NS::
-  Apollonius_graph_cartesian_converter<CK, EK, C2E_t>   C2E;
-
-  typedef
-  CGAL_APOLLONIUS_GRAPH_2_NS::
-  Apollonius_graph_cartesian_converter<CK, FK, C2F_t>   C2F;
-
-#if 0
-  // the following typedefs have been made in the direction of
-  // providing filtered constructions; however, there is a problem,
-  // namely, the Construct_Apollonius_site_2 functor has two
-  // different operator()'s with two different return types; this
-  // functor should be split in two (along with the appropriate
-  // changes in the spec/concept); see also changes needed for the
-  // filtered construction below.
-  typedef Cartesian_converter<FK, CK, To_double<typename FK::RT> > F2C_t;
-  typedef Cartesian_converter<EK, CK, To_double<typename EK::RT> > E2C_t;
-
-  typedef
-  Apollonius_graph_cartesian_converter<FK, CK, F2C_t>   F2C;
-  typedef
-  Apollonius_graph_cartesian_converter<EK, CK, E2C_t>   E2C;
-#endif
-
-  // Types for the construction kernel
-  typedef typename CK::Point_2                CK_Point_2;
-  typedef typename CK::Site_2                 CK_Site_2;
-
-  typedef typename CK::Line_2                 CK_Line_2;
-  typedef typename CK::Ray_2                  CK_Ray_2;
-  typedef typename CK::Segment_2              CK_Segment_2;
-
-  typedef typename CK::FT                     CK_FT;
-  typedef typename CK::RT                     CK_RT;
-
-  // Types for the exact kernel
-  typedef typename EK::Point_2                EK_Point_2;
-  typedef typename EK::Site_2                 EK_Site_2;
-
-  typedef typename EK::Line_2                 EK_Line_2;
-  typedef typename EK::Ray_2                  EK_Ray_2;
-  typedef typename EK::Segment_2              EK_Segment_2;
-
-  typedef typename EK::FT                     EK_FT;
-  typedef typename EK::RT                     EK_RT;
-
-  // Types for the filtering kernel
-  typedef typename FK::Point_2                FK_Point_2;
-  typedef typename FK::Site_2                 FK_Site_2;
-
-  typedef typename FK::Line_2                 FK_Line_2;
-  typedef typename FK::Ray_2                  FK_Ray_2;
-  typedef typename FK::Segment_2              FK_Segment_2;
-
-  typedef typename FK::FT                     FK_FT;
-  typedef typename FK::RT                     FK_RT;
-
-public:
-  //-----------------------------------------------------------------------
-  //                  TYPE DEFINITIONS
-  //-----------------------------------------------------------------------
-
-  // BASIC TYPES
-  //------------
-  typedef CK_t                          R;
-  typedef CK_MTag                       Method_tag;
-
-  typedef CK_traits                     Construction_traits;
-  typedef FK_traits                     Filtering_traits;
-  typedef EK_traits                     Exact_traits;
-
-  typedef CK_MTag                       Construction_traits_method_tag;
-  typedef FK_MTag                       Filtering_traits_method_tag;
-  typedef EK_MTag                       Exact_traits_method_tag;
-
-  typedef typename CK::Point_2          Point_2;
-  typedef typename CK::Site_2           Site_2;
-
-  typedef typename CK::Line_2           Line_2;
-  typedef typename CK::Ray_2            Ray_2;
-  typedef typename CK::Segment_2        Segment_2;
-
-  typedef typename CK::Object_2         Object_2;
-  typedef typename CK::FT               FT;
-  typedef typename CK::RT               RT;
-
-
-public:
-  // OBJECT CONSTRUCTION & ASSIGNMENT
-  //---------------------------------
-  typedef typename CK_traits::Construct_object_2     Construct_object_2;
-  typedef typename CK_traits::Assign_2               Assign_2;
-
-  // CONSTRUCTIONS
-  //--------------
-  // vertex and dual site
-protected:
-  typedef typename CK_traits::Construct_Apollonius_vertex_2
-  CK_Construct_Apollonius_vertex_2;
-
-  typedef typename CK_traits::Construct_Apollonius_site_2
-  CK_Construct_Apollonius_site_2;
-
-  typedef typename FK_traits::Construct_Apollonius_vertex_2
-  FK_Construct_Apollonius_vertex_2;
-
-  typedef typename FK_traits::Construct_Apollonius_site_2
-  FK_Construct_Apollonius_site_2;
-
-  typedef typename EK_traits::Construct_Apollonius_vertex_2
-  EK_Construct_Apollonius_vertex_2;
-
-  typedef typename EK_traits::Construct_Apollonius_site_2
-  EK_Construct_Apollonius_site_2;
-
-public:
-#if 0
-  // the following typedefs have been made in the direction of
-  // providing filtered constructions; however, there is a problem,
-  // namely, the Construct_Apollonius_site_2 functor has two
-  // different operator()'s with two different return types; this
-  // functor should be split in two (along with the appropriate
-  // changes in the spec/concept); see also changes needed for the
-  // filtered construction above.
-  typedef Filtered_construction<CK_Construct_Apollonius_vertex_2,
-				EK_Construct_Apollonius_vertex_2,
-				FK_Construct_Apollonius_vertex_2,
-				C2E, C2F, E2C, F2C>
-  Construct_Apollonius_vertex_2;
-
-  typedef Filtered_construction<CK_Construct_Apollonius_site_2,
-				EK_Construct_Apollonius_site_2,
-				FK_Construct_Apollonius_site_2,
-				C2E, C2F, E2C, F2C>
-  Construct_Apollonius_site_2;
-#else
-  typedef typename CK_traits::Construct_Apollonius_vertex_2
-  Construct_Apollonius_vertex_2;
-
-  typedef typename CK_traits::Construct_Apollonius_site_2
-  Construct_Apollonius_site_2;
-#endif
-
-private:
-  // PREDICATES FOR THE TWO KERNELS
-  //-------------------------------
-
-#if 0
-  // Predicates for the filtering kernel
-  typedef typename FK_traits::Compare_x_2        FK_Compare_x_2;
-  typedef typename FK_traits::Compare_y_2        FK_Compare_y_2;
-  typedef typename FK_traits::Compare_weight_2   FK_Compare_weight_2;
-  typedef typename FK_traits::Orientation_2      FK_Orientation_2;
-  typedef typename FK_traits::Is_hidden_2        FK_Is_hidden_2;
-
-  typedef typename FK_traits::Oriented_side_of_bisector_2
-  FK_Oriented_side_of_bisector_2;
-
-  typedef typename FK_traits::Vertex_conflict_2  FK_Vertex_conflict_2;
-
-  typedef typename FK_traits::Finite_edge_interior_conflict_2
-  FK_Finite_edge_interior_conflict_2;
-
-  typedef typename FK_traits::Infinite_edge_interior_conflict_2
-  FK_Infinite_edge_interior_conflict_2;
-
-  typedef typename FK_traits::Is_degenerate_edge_2
-  FK_Is_degenerate_edge_2;
-
-
-  // Predicates for the exact kernel
-  typedef typename EK_traits::Compare_x_2        EK_Compare_x_2;
-  typedef typename EK_traits::Compare_y_2        EK_Compare_y_2;
-  typedef typename EK_traits::Compare_weight_2   EK_Compare_weight_2;
-  typedef typename EK_traits::Orientation_2      EK_Orientation_2;
-  typedef typename EK_traits::Is_hidden_2        EK_Is_hidden_2;
-
-  typedef typename EK_traits::Oriented_side_of_bisector_2
-  EK_Oriented_side_of_bisector_2;
-
-  typedef typename EK_traits::Vertex_conflict_2  EK_Vertex_conflict_2;
-
-  typedef typename EK_traits::Finite_edge_interior_conflict_2
-  EK_Finite_edge_interior_conflict_2;
-
-  typedef typename EK_traits::Infinite_edge_interior_conflict_2
-  EK_Infinite_edge_interior_conflict_2;
-
-  typedef typename EK_traits::Is_degenerate_edge_2
-  EK_Is_degenerate_edge_2;
-#else
-  // Predicates for the filtering kernel
-  typedef
-  CGAL_APOLLONIUS_GRAPH_2_NS::Compare_x_2<FK>
-  FK_Compare_x_2;
-
-  typedef
-  CGAL_APOLLONIUS_GRAPH_2_NS::Compare_y_2<FK>
-  FK_Compare_y_2;
-
-  typedef
-  CGAL_APOLLONIUS_GRAPH_2_NS::Compare_weight_2<FK>
-  FK_Compare_weight_2;
-
-  typedef
-  CGAL_APOLLONIUS_GRAPH_2_NS::Orientation_2<FK,FK_MTag>
-  FK_Orientation_2;
-
-  //  typedef Ag2_uncertain_is_hidden_C2<FK,FK_MTag> FK_Is_hidden_2;
-  typedef
-  CGAL_APOLLONIUS_GRAPH_2_NS::Is_hidden_2<FK,FK_MTag>
-  FK_Is_hidden_2;
-
-  //  typedef Uncertain_vertex_conflict_new_2<FK,FK_MTag>
-  typedef
-  CGAL_APOLLONIUS_GRAPH_2_NS::Vertex_conflict_new_2<FK,FK_MTag>
-  FK_Vertex_conflict_2;
-
-  //  typedef Ag2_uncertain_oriented_side_of_bisector_C2<FK,FK_MTag>
-  typedef
-  CGAL_APOLLONIUS_GRAPH_2_NS::Oriented_side_of_bisector_2<FK,FK_MTag>
-  FK_Oriented_side_of_bisector_2;
-
-  //  typedef Finite_edge_interior_conflict_new_2<FK,FK_MTag>   
-  typedef
-  CGAL_APOLLONIUS_GRAPH_2_NS::Finite_edge_interior_conflict_2<FK,FK_MTag>   
-  FK_Finite_edge_interior_conflict_2;
-
-  //  typedef Infinite_edge_interior_conflict_new_2<FK,FK_MTag>
-  typedef
-  CGAL_APOLLONIUS_GRAPH_2_NS::Infinite_edge_interior_conflict_2<FK,FK_MTag>
-  FK_Infinite_edge_interior_conflict_2;
-
-  typedef
-  CGAL_APOLLONIUS_GRAPH_2_NS::Is_degenerate_edge_2<FK,FK_MTag>
-  FK_Is_degenerate_edge_2;
-
-  // Predicates for the exact kernel
-  typedef
-  CGAL_APOLLONIUS_GRAPH_2_NS::Compare_x_2<EK>
-  EK_Compare_x_2;
-
-  typedef
-  CGAL_APOLLONIUS_GRAPH_2_NS::Compare_y_2<EK>
-  EK_Compare_y_2;
-
-  typedef
-  CGAL_APOLLONIUS_GRAPH_2_NS::Compare_weight_2<EK>
-  EK_Compare_weight_2;
-
-  typedef
-  CGAL_APOLLONIUS_GRAPH_2_NS::Orientation_2<EK,EK_MTag>
-  EK_Orientation_2;
-
-  //  typedef Ag2_uncertain_is_hidden_C2<EK,EK_MTag> EK_Is_hidden_2;
-  typedef
-  CGAL_APOLLONIUS_GRAPH_2_NS::Is_hidden_2<EK,EK_MTag>
-  EK_Is_hidden_2;
-
-  //  typedef Uncertain_vertex_conflict_new_2<EK,EK_MTag>
-  typedef
-  CGAL_APOLLONIUS_GRAPH_2_NS::Vertex_conflict_new_2<EK,EK_MTag>
-  EK_Vertex_conflict_2;
-
-  //  typedef Ag2_uncertain_oriented_side_of_bisector_C2<EK,EK_MTag>
-  typedef
-  CGAL_APOLLONIUS_GRAPH_2_NS::Oriented_side_of_bisector_2<EK,EK_MTag>
-  EK_Oriented_side_of_bisector_2;
-
-  //  typedef Finite_edge_interior_conflict_new_2<EK,EK_MTag>   
-  typedef
-  CGAL_APOLLONIUS_GRAPH_2_NS::Finite_edge_interior_conflict_2<EK,EK_MTag>   
-  EK_Finite_edge_interior_conflict_2;
-
-  //  typedef Infinite_edge_interior_conflict_new_2<EK,EK_MTag>
-  typedef
-  CGAL_APOLLONIUS_GRAPH_2_NS::Infinite_edge_interior_conflict_2<EK,EK_MTag>
-  EK_Infinite_edge_interior_conflict_2;
-
-  typedef
-  CGAL_APOLLONIUS_GRAPH_2_NS::Is_degenerate_edge_2<EK,EK_MTag>
-  EK_Is_degenerate_edge_2;
-#endif
-
-public:
-  // PREDICATES
-  //-----------
-
-  typedef
-  Filtered_predicate<EK_Compare_x_2, FK_Compare_x_2, C2E, C2F>
-  Compare_x_2;
-
-  typedef
-  Filtered_predicate<EK_Compare_y_2, FK_Compare_y_2, C2E, C2F>
-  Compare_y_2;
-
-  typedef
-  Filtered_predicate<EK_Compare_weight_2, FK_Compare_weight_2,
-		     C2E, C2F>
-  Compare_weight_2;
-
-  typedef
-  Filtered_predicate<EK_Orientation_2, FK_Orientation_2, C2E, C2F>
-  Orientation_2;
-
-  typedef
-  Filtered_predicate<EK_Is_hidden_2, FK_Is_hidden_2, C2E, C2F>
-  Is_hidden_2;
-
-  typedef
-  Filtered_predicate<EK_Oriented_side_of_bisector_2,
-			FK_Oriented_side_of_bisector_2, C2E, C2F>
-  Oriented_side_of_bisector_2;
-
-  typedef
-  Filtered_predicate<EK_Vertex_conflict_2,
-			FK_Vertex_conflict_2, C2E, C2F>
-  Vertex_conflict_2;
-
-  typedef
-  Filtered_predicate<EK_Finite_edge_interior_conflict_2,
-		     FK_Finite_edge_interior_conflict_2, C2E, C2F>
-  Finite_edge_interior_conflict_2;
-
-  typedef
-  Filtered_predicate<EK_Infinite_edge_interior_conflict_2,
-		     FK_Infinite_edge_interior_conflict_2, C2E, C2F>
-  Infinite_edge_interior_conflict_2;
-
-  typedef
-  Filtered_predicate<EK_Is_degenerate_edge_2,
-		     FK_Is_degenerate_edge_2, C2E, C2F>
-  Is_degenerate_edge_2;
-
-public:
-  //-----------------------------------------------------------------------
-  //                  ACCESS TO OBJECTS
-  //-----------------------------------------------------------------------
-
-  // OBJECT CONSTRUCTION & ASSIGNMENT
-  Assign_2
-  assign_2_object() const {
-    return Assign_2();
-  }
-
-  Construct_object_2
-  construct_object_2_object() const { 
-    return Construct_object_2();
-  }
-
-
-  // CONSTRUCTIONS
-  //--------------
-  Construct_Apollonius_vertex_2
-  construct_Apollonius_vertex_2_object() const { 
-    return Construct_Apollonius_vertex_2();
-  }
-
-  Construct_Apollonius_site_2
-  construct_Apollonius_site_2_object() const {
-    return Construct_Apollonius_site_2();
-  }
-
-  // PREDICATES
-  //-----------
-  Compare_x_2
-  compare_x_2_object() const {
-    return Compare_x_2();
-  }
-
-  Compare_y_2
-  compare_y_2_object() const {
-    return Compare_y_2();
-  }
-
-  Compare_weight_2
-  compare_weight_2_object() const {
-    return Compare_weight_2();
-  }
-
-  Orientation_2
-  orientation_2_object() const {
-    return Orientation_2();
-  }
-
-  Is_hidden_2
-  is_hidden_2_object() const {
-    return Is_hidden_2();
-  }
-
-  Oriented_side_of_bisector_2
-  oriented_side_of_bisector_2_object() const {
-    return Oriented_side_of_bisector_2();
-  }
-
-  Vertex_conflict_2
-  vertex_conflict_2_object() const {
-    return Vertex_conflict_2();
-  }
-
-  Finite_edge_interior_conflict_2
-  finite_edge_interior_conflict_2_object() const {
-    return Finite_edge_interior_conflict_2();
-  }
-
-  Infinite_edge_interior_conflict_2
-  infinite_edge_interior_conflict_2_object() const {
-    return Infinite_edge_interior_conflict_2();
-  }
-
-  Is_degenerate_edge_2
-  is_degenerate_edge_2_object() const {
-    return Is_degenerate_edge_2();
-  }
-
-};
-
-
-
-} //namespace CGAL
-
-
-#endif // CGAL_APOLLONIUS_GRAPH_UNCERTAIN_FILTERED_TRAITS_2_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_face_index_map.h b/3rdparty/CGAL-4.8/include/CGAL/Arr_face_index_map.h
deleted file mode 100644
index 68f20ba..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Arr_face_index_map.h
+++ /dev/null
@@ -1,281 +0,0 @@
-// Copyright (c) 2010,2011 Tel-Aviv University (Israel).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Ron Wein          <wein at post.tau.ac.il>
-
-#ifndef CGAL_ARR_FACE_INDEX_MAP_H
-#define CGAL_ARR_FACE_INDEX_MAP_H
-
-/*! \file
- * Definition of the Arr_face_index_map<Arrangement> class.
- */
-
-#include <CGAL/Arr_observer.h>
-#include <CGAL/Unique_hash_map.h>
-#include <boost/version.hpp>
-#if BOOST_VERSION >= 104000
-#include <boost/property_map/property_map.hpp>
-#else
-#include <boost/property_map.hpp>
-#endif
-#include <boost/graph/properties.hpp>
-
-namespace CGAL {
-
-/*! \class
- * An auxiliary class that automatically maintains a mapping of the
- * arrangement faces to the indices 0, ..., (n -1), where n is the number
- * of faces in the arrangement.
- */
-template <class Arrangement_>
-class Arr_face_index_map : public Arr_observer<Arrangement_>
-{
-public:
-
-  typedef Arrangement_                            Arrangement_2;
-  typedef typename Arrangement_2::Face_handle     Face_handle;
-
-  // Boost property type definitions:
-  typedef boost::readable_property_map_tag        category;
-  typedef unsigned int                            value_type;
-  typedef value_type                              reference;
-  typedef Face_handle                             key_type;
-
-private:
-
-  typedef Arr_face_index_map<Arrangement_2>       Self;
-  typedef Arr_observer<Arrangement_2>             Base;
-
-  typedef Unique_hash_map<Face_handle, unsigned int>     Index_map;
-
-  // Data members:
-  unsigned int                n_faces;     // The current number of faces.
-  Index_map                   index_map;   // Mapping faces to indices.
-  std::vector<Face_handle>    rev_map;     // Mapping indices to faces.
-
-  enum {MIN_REV_MAP_SIZE = 32};
-
-public:
-
-  /*! Default constructor. */
-  Arr_face_index_map () :
-    Base (),
-    n_faces (0),
-    rev_map (MIN_REV_MAP_SIZE)
-  {}
-
-  /*! Constructor with an associated arrangement. */
-  Arr_face_index_map (const Arrangement_2& arr) :
-    Base (const_cast<Arrangement_2&> (arr))
-  {
-    _init();
-  }
-
-  /*! Copy constructor. */
-  Arr_face_index_map (const Self& other) :
-    Base (const_cast<Arrangement_2&> (*(other.arrangement())))
-  {
-    _init();
-  }
-
-  /*! Assignment operator. */
-  Self& operator= (const Self& other)
-  {
-    if (this == &other)
-      return (*this);
-
-    this->detach();
-    this->attach (const_cast<Arrangement_2&> (*(other.arrangement())));
-
-    return (*this);
-  }
-
-  /*!
-   * Get the index of a given face.
-   * \param f A handle to the face.
-   * \pre f is a valid face in the arrangement.
-   */
-  unsigned int operator[] (Face_handle f) const
-  {
-    return (index_map[f]);
-  }
-
-  /*!
-   * Get the face given its index.
-   * \param i The index of the face.
-   * \pre i is less than the number of faces in the arrangement.
-   */
-  Face_handle face (const int i) const
-  {
-    CGAL_precondition((unsigned int) i < n_faces);
-
-    return (rev_map[i]);
-  }
-
-  /// \name Notification functions, to keep the mapping up-to-date.
-  //@{
-
-  /*!
-   * Update the mapping after the arrangement has been assigned with another
-   * arrangement.
-   */
-  virtual void after_assign ()
-  {
-    _init();
-  }
-
-  /*!
-   * Update the mapping after the arrangement is cleared.
-   */
-  virtual void after_clear ()
-  {
-    _init();
-  }
-
-  /*!
-   * Update the mapping after attaching to a new arrangement.
-   */
-  virtual void after_attach ()
-  {
-    _init();
-  }
-
-  /*!
-   * Update the mapping after detaching the arrangement.
-   */
-  virtual void after_detach ()
-  {
-    n_faces = 0;
-    index_map.clear();
-  }
-
-  /*!
-   * Update the mapping after the creation of a new face is split from another
-   * face.
-   * \param f A handle to the existing face.
-   * \param new_f A handle to the newly created face.
-   */
-  virtual void after_split_face (Face_handle /* f */,
-                                 Face_handle new_f,
-                                 bool /* is_hole */)
-  {
-    // Update the number of vertices.
-    n_faces++;
-
-    // If necessary, allocate memory for the reverse mapping.
-    if (rev_map.size() < n_faces)
-      rev_map.resize(2 * n_faces);
-
-    // Update the mapping of the newly created face.
-    index_map[new_f] = n_faces - 1;
-    rev_map[n_faces - 1] = new_f;
-
-    return;
-  }
-
-  /*!
-   * Update the mapping before the merge of two faces.
-   * \param f1 A handle to the face that is going to remain.
-   * \param f2 A handle to the face that is about to be removed.
-   */
-  virtual void before_merge_face (Face_handle /* f1 */,
-                                  Face_handle f2,
-                                  typename
-				  Arrangement_2::Halfedge_handle /* e */)
-  {
-    // Update the number of faces.
-    n_faces--;
-    
-    // Reduce memory consumption in case the number of faces has
-    // drastically decreased.
-    if (2*n_faces+1 < rev_map.size() && 
-	rev_map.size() / 2 >= MIN_REV_MAP_SIZE)
-    {
-      rev_map.resize (rev_map.size() / 2);
-    }
-
-    // Get the current face index, and assign this index to the face
-    // currently indexed (n - 1).
-    unsigned int   index = index_map[f2];
-
-    if (index == n_faces)
-      return;
-    
-    Face_handle    last_f = rev_map[n_faces];
-    index_map[last_f] = index;
-    rev_map[index] = last_f;
-
-    // Clear the reverse mapping for the last face.
-    rev_map[n_faces] = Face_handle();
-
-    return;
-  }
-  //@}
-
-private:
-  
-  /*! Initialize the map for the given arrangement. */
-  void _init ()
-  {
-    // Get the number of faces and allocate the reverse map accordingly.
-    n_faces = static_cast<unsigned int>(this->arrangement()->number_of_faces());
-    
-    if (n_faces < MIN_REV_MAP_SIZE)
-      rev_map.resize (MIN_REV_MAP_SIZE);
-    else
-      rev_map.resize (n_faces);
-
-    // Clear the current mapping.
-    index_map.clear();
-
-    // Create the initial mapping. 
-    typename Arrangement_2::Face_iterator     fit;
-    Face_handle                               fh;
-    unsigned int                              index = 0;
-
-    for (fit = this->arrangement()->faces_begin();
-	 fit != this->arrangement()->faces_end(); ++fit, ++index)
-    {
-      // Map the current face to the current index.
-      fh = fit;
-      index_map[fh] = index;
-      rev_map[index] = fh;
-    }
-
-    return;
-  }  
-
-};
-
-/*!
- * Get the index property-map function. Provided so that boost is able to
- * access the Arr_face_index_map above.
- * \param index_map The index map.
- * \param f A face handle.
- * \return The face index.
- */
-template<class Arrangement>
-unsigned int get (const CGAL::Arr_face_index_map<Arrangement>& index_map,
-		  typename Arrangement::Face_handle f) 
-{ 
-  return (index_map[f]);
-}
-
-} //namespace CGAL
-
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_polycurve_basic_traits_2.h b/3rdparty/CGAL-4.8/include/CGAL/Arr_polycurve_basic_traits_2.h
deleted file mode 100644
index 38a7fb7..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Arr_polycurve_basic_traits_2.h
+++ /dev/null
@@ -1,2713 +0,0 @@
-// Copyright (c) 2006,2007,2008,2009,2010,2011 Tel-Aviv University(Israel).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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.
-//
-// Author(s)     : Efi Fogel <efif at post.tau.ac.il>
-//                 Ron Wein  <wein at post.tau.ac.il>
-//                 Dror Atariah <dror.atariah at fu-berlin.de>
-//                 Waqar Khan <wkhan at mpi-inf.mpg.de>
-
-#ifndef CGAL_ARR_POLYCURVE_BASIC_TRAITS_2_H
-#define CGAL_ARR_POLYCURVE_BASIC_TRAITS_2_H
-
-/*! \file
- * The traits-class for the general piece-wise (polycurve) type of curves of the
- * arrangement package.
- */
-
-#include <iterator>
-#include <boost/type_traits/is_same.hpp>
-#include <boost/utility/enable_if.hpp>
-
-#include <CGAL/basic.h>
-#include <CGAL/tags.h>
-#include <CGAL/Arr_non_caching_segment_traits_2.h>
-#include <CGAL/Arr_geometry_traits/Polycurve_2.h>
-#include <CGAL/Arr_geometry_traits/IO/Polycurve_2_iostream.h>
-#include <CGAL/Arr_tags.h>
-#include <CGAL/Arr_enums.h>
-
-namespace CGAL {
-
-template <typename SubcurveTraits_2 = Arr_non_caching_segment_traits_2<> >
-class Arr_polycurve_basic_traits_2 {
-public:
-  typedef SubcurveTraits_2                                 Subcurve_traits_2;
-
-  /// \name Types and functors inherited from the subcurve geometry traits.
-  //@{
-
-  typedef typename Subcurve_traits_2::Has_left_category    Has_left_category;
-  typedef typename Subcurve_traits_2::Has_do_intersect_category
-    Has_do_intersect_category;
-
-  typedef typename Subcurve_traits_2::Left_side_category   Left_side_category;
-  typedef typename Subcurve_traits_2::Bottom_side_category Bottom_side_category;
-  typedef typename Subcurve_traits_2::Top_side_category    Top_side_category;
-  typedef typename Subcurve_traits_2::Right_side_category  Right_side_category;
-
-  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;
-
-  typedef typename Subcurve_traits_2::Point_2              Point_2;
-  typedef typename Subcurve_traits_2::X_monotone_curve_2   X_monotone_subcurve_2;
-
-  //@}
-
-  // Backward compatibility:
-  typedef X_monotone_subcurve_2                            X_monotone_segment_2;
-
-private:
-  typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>  Self;
-
-  // Data members:
-  const Subcurve_traits_2* m_subcurve_traits;  // The base segment-traits class.
-  bool m_own_traits;
-
-protected:
-  enum { INVALID_INDEX = 0xffffffff };
-
-public:
-  /*! Construct default. */
-  Arr_polycurve_basic_traits_2() :
-    m_subcurve_traits(new Subcurve_traits_2()),
-    m_own_traits(true)
-  {}
-
-  /*! Construct from a subcurve traits.
-   * \param seg_traits an already existing subcurve tarits which is passed will
-   *        be used by the class.
-   */
-  Arr_polycurve_basic_traits_2(const Subcurve_traits_2* geom_traits) :
-    m_subcurve_traits(geom_traits), m_own_traits(false) {}
-
-  /*! Construct copy.
-   * If the 'other' polycurve traits owns its subcurve traits, then make
-   * this polycurve traits own its subcurve traits as well
-   * \param other the other traits.
-   */
-  Arr_polycurve_basic_traits_2(const Arr_polycurve_basic_traits_2& other)
-  {
-    m_subcurve_traits = (other.m_own_traits) ?
-      new Subcurve_traits_2() : other.m_subcurve_traits;
-    m_own_traits = other.m_own_traits;
-  }
-
-  /* Destructor
-   * Deletes the subcurve tarits class in case it was constructed during the
-   * construction of this.
-   */
-  ~Arr_polycurve_basic_traits_2()
-  { if (m_own_traits) delete m_subcurve_traits; }
-
-  /*! Obtain the subcurve traits.
-   * \return the subcurve traits.
-   */
-  const Subcurve_traits_2* subcurve_traits_2() const
-  { return m_subcurve_traits; }
-
-  /// \name Types and functors defined here, required by the
-  // ArrangementBasicTraits concept.
-  //@{
-
-  /*! An x monotone polycurve represents a continuous piecewise-linear
-   * curve which is either strongly x-monotone or vertical. Again,
-   * the polycurve is without degenerated subcurves.
-   */
-  typedef internal::X_monotone_polycurve_2<X_monotone_subcurve_2, Point_2>
-                                                           X_monotone_curve_2;
-  typedef typename X_monotone_curve_2::Size                Size;
-  typedef typename X_monotone_curve_2::size_type           size_type;
-
-
-  /*! Compare the x-coordinates of two points. */
-  class Compare_x_2 {
-  protected:
-    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
-      Polycurve_basic_traits_2;
-
-    /*! The polycurve traits (in case it has state). */
-    const Polycurve_basic_traits_2& m_poly_traits;
-
-  public:
-    /*! Constructor. */
-    Compare_x_2(const Polycurve_basic_traits_2& traits) :
-      m_poly_traits(traits)
-    {}
-
-    /*! Compare the x-coordinates of two directional points.
-     * \param p1 the first directional point.
-     * \param p2 the second directional point.
-     * \return SMALLER - x(p1) < x(p2);
-     *         EQUAL   - x(p1) = x(p2);
-     *         LARGER  - x(p1) > x(p2).
-     * \pre p1 does not lie on the boundary.
-     * \pre p2 does not lie on the boundary.
-     */
-    Comparison_result operator()(const Point_2& p1, const Point_2& p2) const
-    { return m_poly_traits.subcurve_traits_2()->compare_x_2_object()(p1, p2); }
-
-    /*! Compare two ends of x-monotone curves in x.
-     * \param xs1 the first curve.
-     * \param ce1 the curve-end indicator of the first x-monotone curve xs1:
-     *            ARR_MIN_END - the minimal end of xs1 or
-     *            ARR_MAX_END - the maximal end of xs1.
-     * \param p2 the second curve end.
-     */
-    Comparison_result operator()(const X_monotone_subcurve_2& xs1,
-                                 Arr_curve_end ce1,
-                                 const Point_2& p2)
-    { return operator()(xs1, ce1, p2, Are_all_sides_oblivious_tag()); }
-
-    /*! Compare two ends of x-monotone curves in x.
-     * \param xs1 the first curve.
-     * \param ce1 the curve-end indicator of the first x-monotone curve xs1:
-     *            ARR_MIN_END - the minimal end of xs1 or
-     *            ARR_MAX_END - the maximal end of xs1.
-     * \param xs2 the second curve.
-     * \param ce2 the curve-end indicator of the second x-monoton curve xs2:
-     *            ARR_MIN_END - the minimal end of xs2 or
-     *            ARR_MAX_END - the maximal end of xs2.
-     */
-    Comparison_result operator()(const X_monotone_subcurve_2& xs1,
-                                 Arr_curve_end ce1,
-                                 const X_monotone_subcurve_2& xs2,
-                                 Arr_curve_end ce2)
-    { return operator()(xs1, ce1, xs2, ce2, Are_all_sides_oblivious_tag()); }
-
-  private:
-    // Oblivious implementation
-    Comparison_result operator()(const X_monotone_subcurve_2& xs1,
-                                 Arr_curve_end ce1,
-                                 const Point_2& p2,
-                                 Arr_all_sides_oblivious_tag) const
-    {
-      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
-      const Point_2& p1 = (ce1 == ARR_MAX_END) ?
-        geom_traits->construct_max_vertex_2_object()(xs1) :
-        geom_traits->construct_min_vertex_2_object()(xs1);
-      return geom_traits->compare_x_2_object()(p1, p2);
-    }
-
-    // Boundary implementation
-    Comparison_result operator()(const X_monotone_subcurve_2& xs1,
-                                 Arr_curve_end ce1,
-                                 const Point_2& p2,
-                                 Arr_not_all_sides_oblivious_tag) const
-    {
-      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
-      typename Subcurve_traits_2::Parameter_space_in_x_2 ps_x =
-        geom_traits->parameter_space_in_x_2_object();
-      const Arr_parameter_space ps_x1 = ps_x(xs1, ce1);
-
-      if (ps_x1 != ARR_INTERIOR) {
-        if (ps_x1 == ARR_LEFT_BOUNDARY) return SMALLER;
-        if (ps_x1 == ARR_RIGHT_BOUNDARY) return LARGER;
-      }
-
-      typename Subcurve_traits_2::Parameter_space_in_y_2 ps_y =
-        geom_traits->parameter_space_in_y_2_object();
-      const Arr_parameter_space ps_y1 = ps_y(xs1, ce1);
-      if (ps_y1 == ARR_INTERIOR) {
-        const Point_2& p1 = (ce1 == ARR_MAX_END) ?
-          geom_traits->construct_max_vertex_2_object()(xs1) :
-          geom_traits->construct_min_vertex_2_object()(xs1);
-        return geom_traits->compare_x_2_object()(p1, p2);
-      }
-      typename Subcurve_traits_2::Compare_x_on_boundary_2 cmp_x_on_bnd =
-        geom_traits->compare_x_on_boundary_2_object();
-      return opposite(cmp_x_on_bnd(p2, xs1, ce1));
-    }
-
-    // Oblivious implementation
-    Comparison_result operator()(const X_monotone_subcurve_2& xs1,
-                                 Arr_curve_end ce1,
-                                 const X_monotone_subcurve_2& xs2,
-                                 Arr_curve_end ce2,
-                                 Arr_all_sides_oblivious_tag) const
-    {
-      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
-      const Point_2& p1 = (ce1 == ARR_MAX_END) ?
-        geom_traits->construct_max_vertex_2_object()(xs1) :
-        geom_traits->construct_min_vertex_2_object()(xs1);
-      const Point_2& p2 = (ce2 == ARR_MAX_END) ?
-        geom_traits->construct_max_vertex_2_object()(xs2) :
-        geom_traits->construct_min_vertex_2_object()(xs2);
-      return geom_traits->compare_x_2_object()(p1, p2);
-    }
-
-    // Boundary implementation
-    Comparison_result operator()(const X_monotone_subcurve_2& xs1,
-                                 Arr_curve_end ce1,
-                                 const X_monotone_subcurve_2& xs2,
-                                 Arr_curve_end ce2,
-                                 Arr_not_all_sides_oblivious_tag) const
-    {
-      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
-      typename Subcurve_traits_2::Parameter_space_in_x_2 ps_x =
-        geom_traits->parameter_space_in_x_2_object();
-      const Arr_parameter_space ps_x1 = ps_x(xs1, ce1);
-      const Arr_parameter_space ps_x2 = ps_x(xs2, ce2);
-
-      if (ps_x1 != ps_x2) {
-        if (ps_x1 == ARR_LEFT_BOUNDARY) return SMALLER;
-        if (ps_x1 == ARR_RIGHT_BOUNDARY) return LARGER;
-        if (ps_x2 == ARR_LEFT_BOUNDARY) return LARGER;
-        if (ps_x2 == ARR_RIGHT_BOUNDARY) return SMALLER;
-      }
-
-      // ps_x1 == ps_x2
-      if (ps_x1 != ARR_INTERIOR) return EQUAL;
-
-      typename Subcurve_traits_2::Parameter_space_in_y_2 ps_y =
-        geom_traits->parameter_space_in_y_2_object();
-      const Arr_parameter_space ps_y1 = ps_y(xs1, ce1);
-      const Arr_parameter_space ps_y2 = ps_y(xs2, ce2);
-      if (ps_y1 == ARR_INTERIOR) {
-        const Point_2& p1 = (ce1 == ARR_MAX_END) ?
-          geom_traits->construct_max_vertex_2_object()(xs1) :
-          geom_traits->construct_min_vertex_2_object()(xs1);
-        if (ps_y2 == ARR_INTERIOR) {
-          const Point_2& p2 = (ce2 == ARR_MAX_END) ?
-            geom_traits->construct_max_vertex_2_object()(xs2) :
-            geom_traits->construct_min_vertex_2_object()(xs2);
-          return geom_traits->compare_x_2_object()(p1, p2);
-        }
-        typename Subcurve_traits_2::Compare_x_on_boundary_2 cmp_x_on_bnd =
-          geom_traits->compare_x_on_boundary_2_object();
-        return cmp_x_on_bnd(p1, xs2, ce2);
-      }
-      if (ps_y2 == ARR_INTERIOR) {
-        const Point_2& p2 = (ce2 == ARR_MAX_END) ?
-          geom_traits->construct_max_vertex_2_object()(xs2) :
-          geom_traits->construct_min_vertex_2_object()(xs2);
-        typename Subcurve_traits_2::Compare_x_on_boundary_2 cmp_x_on_bnd =
-          geom_traits->compare_x_on_boundary_2_object();
-        return opposite(cmp_x_on_bnd(p2, xs1, ce1));
-      }
-      return geom_traits->compare_x_on_boundary_2_object()(xs1, ce1, xs2, ce2);
-    }
-  };
-
-  /*! Obtain a Compare_x_2 functor object. */
-  Compare_x_2 compare_x_2_object() const
-  { return Compare_x_2(*this); }
-
-  /*! Compare two curve-ends or points lexigoraphically: by x, then by y. */
-  class Compare_xy_2 {
-  protected:
-    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
-      Polycurve_basic_traits_2;
-
-    /*! The polycurve traits (in case it has state). */
-    const Polycurve_basic_traits_2& m_poly_traits;
-
-  public:
-    /*! Constructor. */
-    Compare_xy_2(const Polycurve_basic_traits_2& traits) :
-      m_poly_traits(traits)
-    {}
-
-    /*! Compare two directional points lexigoraphically: by x, then by y.
-     * \param p1 the first enpoint directional point.
-     * \param p2 the second endpoint directional point.
-     * \return SMALLER - x(p1) < x(p2);
-     *         SMALLER - x(p1) = x(p2) and y(p1) < y(p2);
-     *         EQUAL   - x(p1) = x(p2) and y(p1) = y(p2);
-     *         LARGER  - x(p1) = x(p2) and y(p1) > y(p2);
-     *         LARGER  - x(p1) > x(p2).
-     * \pre p1 does not lie on the boundary.
-     * \pre p2 does not lie on the boundary.
-     */
-    Comparison_result operator()(const Point_2& p1, const Point_2& p2) const
-    { return m_poly_traits.subcurve_traits_2()->compare_xy_2_object()(p1, p2); }
-
-    /*! Compare two ends of x-monotone curves lexicographically.
-     * \param xs1 the first curve.
-     * \param ce1 the curve-end indicator of the first x-monotone curve xs1:
-     *            ARR_MIN_END - the minimal end of xs1 or
-     *            ARR_MAX_END - the maximal end of xs1.
-     * \param p2 the second curve end.
-     */
-    Comparison_result operator()(const X_monotone_subcurve_2& xs1,
-                                 Arr_curve_end ce1,
-                                 const Point_2& p2)
-    { return operator()(xs1, ce1, p2, Are_all_sides_oblivious_tag()); }
-
-    /*! Compare two ends of x-monotone curves lexicographically.
-     * \param xs1 the first curve.
-     * \param ce1 the curve-end indicator of the first x-monotone curve xs1:
-     *            ARR_MIN_END - the minimal end of xs1 or
-     *            ARR_MAX_END - the maximal end of xs1.
-     * \param xs2 the second curve.
-     * \param ce2 the curve-end indicator of the second x-monoton curve xs2:
-     *            ARR_MIN_END - the minimal end of xs2 or
-     *            ARR_MAX_END - the maximal end of xs2.
-     */
-    Comparison_result operator()(const X_monotone_subcurve_2& xs1,
-                                 Arr_curve_end ce1,
-                                 const X_monotone_subcurve_2& xs2,
-                                 Arr_curve_end ce2)
-    { return operator()(xs1, ce1, xs2, ce2, Are_all_sides_oblivious_tag()); }
-
-  private:
-    // Oblivious implementation
-    Comparison_result operator()(const X_monotone_subcurve_2& xs1,
-                                 Arr_curve_end ce1,
-                                 const Point_2& p2,
-                                 Arr_all_sides_oblivious_tag) const
-    {
-      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
-      const Point_2& p1 = (ce1 == ARR_MAX_END) ?
-        geom_traits->construct_max_vertex_2_object()(xs1) :
-        geom_traits->construct_min_vertex_2_object()(xs1);
-      return geom_traits->compare_xy_2_object()(p1, p2);
-    }
-
-    // Boundary implementation
-    Comparison_result operator()(const X_monotone_subcurve_2& xs1,
-                                 Arr_curve_end ce1,
-                                 const Point_2& p2,
-                                 Arr_not_all_sides_oblivious_tag) const
-    {
-      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
-      typename Subcurve_traits_2::Parameter_space_in_x_2 ps_x =
-        geom_traits->parameter_space_in_x_2_object();
-      typename Subcurve_traits_2::Parameter_space_in_y_2 ps_y =
-        geom_traits->parameter_space_in_y_2_object();
-      const Arr_parameter_space ps_x1 = ps_x(xs1, ce1);
-      const Arr_parameter_space ps_y1 = ps_y(xs1, ce1);
-
-      if (ps_x1 != ARR_INTERIOR) {
-        if (ps_x1 == ARR_LEFT_BOUNDARY) return SMALLER;
-        if (ps_x1 == ARR_RIGHT_BOUNDARY) return LARGER;
-      }
-
-      if (ps_y1 == ARR_INTERIOR) {
-        const Point_2& p1 = (ce1 == ARR_MAX_END) ?
-          geom_traits->construct_max_vertex_2_object()(xs1) :
-          geom_traits->construct_min_vertex_2_object()(xs1);
-        return geom_traits->compare_xy_2_object()(p1, p2);
-      }
-
-      // EFEF: missing implementation for open boundary.
-      typename Subcurve_traits_2::Compare_x_on_boundary_2 cmp_x_on_bnd =
-        geom_traits->compare_x_on_boundary_2_object();
-      Comparison_result res = opposite(cmp_x_on_bnd(p2, xs1, ce1));
-      if (res != EQUAL) return res;
-      if (ps_y1 == ARR_TOP_BOUNDARY) return LARGER;
-      CGAL_assertion(ps_y1 == ARR_BOTTOM_BOUNDARY);
-      return SMALLER;
-    }
-
-    // Oblivious implementation
-    Comparison_result operator()(const X_monotone_subcurve_2& xs1,
-                                 Arr_curve_end ce1,
-                                 const X_monotone_subcurve_2& xs2,
-                                 Arr_curve_end ce2,
-                                 Arr_all_sides_oblivious_tag) const
-    {
-      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
-      const Point_2& p1 = (ce1 == ARR_MAX_END) ?
-        geom_traits->construct_max_vertex_2_object()(xs1) :
-        geom_traits->construct_min_vertex_2_object()(xs1);
-      const Point_2& p2 = (ce2 == ARR_MAX_END) ?
-        geom_traits->construct_max_vertex_2_object()(xs2) :
-        geom_traits->construct_min_vertex_2_object()(xs2);
-      return geom_traits->compare_xy_2_object()(p1, p2);
-    }
-
-    // Boundary implementation
-    Comparison_result operator()(const X_monotone_subcurve_2& xs1,
-                                 Arr_curve_end ce1,
-                                 const X_monotone_subcurve_2& xs2,
-                                 Arr_curve_end ce2,
-                                 Arr_not_all_sides_oblivious_tag) const
-    {
-      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
-      typename Subcurve_traits_2::Parameter_space_in_x_2 ps_x =
-        geom_traits->parameter_space_in_x_2_object();
-      typename Subcurve_traits_2::Parameter_space_in_y_2 ps_y =
-        geom_traits->parameter_space_in_y_2_object();
-      const Arr_parameter_space ps_x1 = ps_x(xs1, ce1);
-      const Arr_parameter_space ps_y1 = ps_y(xs1, ce1);
-      const Arr_parameter_space ps_x2 = ps_x(xs2, ce2);
-      const Arr_parameter_space ps_y2 = ps_y(xs2, ce2);
-
-      if (ps_x1 != ps_x2) {
-        if (ps_x1 == ARR_LEFT_BOUNDARY) return SMALLER;
-        if (ps_x1 == ARR_RIGHT_BOUNDARY) return LARGER;
-        if (ps_x2 == ARR_LEFT_BOUNDARY) return LARGER;
-        if (ps_x2 == ARR_RIGHT_BOUNDARY) return SMALLER;
-      }
-
-      if ((ps_x1 == ARR_INTERIOR) && (ps_y1 == ARR_INTERIOR)) {
-        const Point_2& p1 = (ce1 == ARR_MAX_END) ?
-          geom_traits->construct_max_vertex_2_object()(xs1) :
-          geom_traits->construct_min_vertex_2_object()(xs1);
-        // ps1 == ARR_INTERIOR
-
-        if ((ps_x2 == ARR_INTERIOR) && (ps_y2 == ARR_INTERIOR)) {
-          const Point_2& p2 = (ce2 == ARR_MAX_END) ?
-            geom_traits->construct_max_vertex_2_object()(xs2) :
-            geom_traits->construct_min_vertex_2_object()(xs2);
-
-          // ps1 == ARR_INTERIOR
-          // ps2 == ARR_INTERIOR
-          return geom_traits->compare_xy_2_object()(p1, p2);
-        }
-
-        // The cases ps_x2 == ARR_{LEFT,RIGHT}_BOUNDARY are handled above
-
-        // ps1 == ARR_INTERIOR
-        // ps_x2 == ARR_INTERIOR
-        // ps_y2 != ARR_INTERIOR
-        CGAL_assertion(ps_x2 == ARR_INTERIOR);
-        // EFEF: missing implementation for open boundary.
-        typename Subcurve_traits_2::Compare_x_on_boundary_2 cmp_x_on_bnd =
-          geom_traits->compare_x_on_boundary_2_object();
-        Comparison_result res = cmp_x_on_bnd(p1, xs2, ce2);
-        if (res != EQUAL) return res;
-        if (ps_y2 == ARR_TOP_BOUNDARY) return SMALLER;
-        CGAL_assertion(ps_y2 == ARR_BOTTOM_BOUNDARY);
-        return LARGER;
-      }
-
-      // ps1 != ARR_INTERIOR
-      if ((ps_x2 == ARR_INTERIOR) && (ps_y2 == ARR_INTERIOR)) {
-        const Point_2& p2 = (ce2 == ARR_MAX_END) ?
-          geom_traits->construct_max_vertex_2_object()(xs2) :
-          geom_traits->construct_min_vertex_2_object()(xs2);
-
-        // The cases ps_x1 == ARR_{LEFT,RIGHT}_BOUNDARY are handled above
-
-        // ps_x1 == ARR_INTERIOR
-        // ps_y1 != ARR_INTERIOR
-        // ps2 == ARR_INTERIOR
-        CGAL_assertion(ps_x1 == ARR_INTERIOR);
-        typename Subcurve_traits_2::Compare_x_on_boundary_2 cmp_x_on_bnd =
-          geom_traits->compare_x_on_boundary_2_object();
-        Comparison_result res = cmp_x_on_bnd(p2, xs1, ce1);
-        if (res != EQUAL) return opposite(res);
-        if (ps_y1 == ARR_TOP_BOUNDARY) return LARGER;
-        CGAL_assertion(ps_y1 == ARR_BOTTOM_BOUNDARY);
-        return SMALLER;
-      }
-
-      // ps1 != ARR_INTERIOR
-      // ps2 != ARR_INTERIOR
-      // ps_x1 == ps_x2
-      if (ps_x1 == ARR_INTERIOR) {
-        // ps_y1 != ARR_INTERIOR
-        // ps_y2 != ARR_INTERIOR
-        Comparison_result res =
-          geom_traits->compare_x_on_boundary_2_object()(xs1, ce1, xs2, ce2);
-        if (res != EQUAL) return res;
-        if (ps_y1 == ps_y2) return EQUAL;
-        return (ps_y1 == ARR_BOTTOM_BOUNDARY) ? SMALLER : LARGER;
-      }
-
-      CGAL_assertion(ce1 == ce2);
-      const Point_2& p1 = (ce1 == ARR_MAX_END) ?
-        geom_traits->construct_max_vertex_2_object()(xs1) :
-        geom_traits->construct_min_vertex_2_object()(xs1);
-      const Point_2& p2 = (ce2 == ARR_MAX_END) ?
-        geom_traits->construct_max_vertex_2_object()(xs2) :
-        geom_traits->construct_min_vertex_2_object()(xs2);
-      return geom_traits->compare_y_on_boundary_2_object()(p1, p2);
-    }
-  };
-
-  /*! Obtain a Compare_xy_2 functor object. */
-  Compare_xy_2 compare_xy_2_object() const
-  { return Compare_xy_2(*this); }
-
-  class Construct_min_vertex_2 {
-  protected:
-    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
-      Polycurve_basic_traits_2;
-
-    /*! The polycurve traits (in case it has state). */
-    const Polycurve_basic_traits_2& m_poly_traits;
-
-  public:
-    /* Constructor. */
-    Construct_min_vertex_2(const Polycurve_basic_traits_2& traits) :
-      m_poly_traits(traits)
-    {}
-
-    /*! Obtain the left endpoint of the x-monotone polycurve.
-     * \todo: is it possible to make the return type const reference if the
-     *        return type of the subcurve traits is const reference?
-     * \param cv The polycurve curve.
-     * \return The left endpoint.
-     */
-    Point_2 operator()(const X_monotone_curve_2& cv) const
-    {
-      CGAL_assertion(cv.number_of_subcurves() > 0);
-
-      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
-
-      if (geom_traits->compare_endpoints_xy_2_object()(cv[0]) == SMALLER)
-        return geom_traits->construct_min_vertex_2_object()(cv[0]);
-      else
-        return geom_traits->
-          construct_min_vertex_2_object()(cv[cv.number_of_subcurves()-1]);
-    }
-  };
-
-  /*! Obtain a Construct_min_vertex_2 functor object. */
-  Construct_min_vertex_2 construct_min_vertex_2_object() const
-  { return Construct_min_vertex_2(*this); }
-
-  class Construct_max_vertex_2 {
-  protected:
-    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
-      Polycurve_basic_traits_2;
-
-    /*! The polycurve traits (in case it has state). */
-    const Polycurve_basic_traits_2& m_poly_traits;
-
-  public:
-    /*! Constructor. */
-    Construct_max_vertex_2(const Polycurve_basic_traits_2& traits) :
-      m_poly_traits(traits)
-    {}
-
-    /*! Obtain the right endpoint of the x-monotone polycurve.
-     * \todo: is it possible to make the return type const reference if the
-     *        return type of the subcurve traits is const reference?
-     * \param cv The polycurve.
-     * \return The right endpoint.
-     */
-    Point_2 operator()(const X_monotone_curve_2& cv) const
-    {
-      CGAL_assertion(cv.number_of_subcurves() > 0);
-
-      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
-
-      if (geom_traits->compare_endpoints_xy_2_object()(cv[0]) == SMALLER)
-        return geom_traits->
-          construct_max_vertex_2_object()(cv[cv.number_of_subcurves()-1]);
-      else
-        return geom_traits->construct_max_vertex_2_object()(cv[0]);
-    }
-  };
-
-  /*! Obtain a Construct_max_vertex_2 functor object. */
-  Construct_max_vertex_2 construct_max_vertex_2_object() const
-  { return Construct_max_vertex_2(*this); }
-
-  class Is_vertical_2 {
-  protected:
-    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
-    Polycurve_basic_traits_2;
-
-    /*! The polycurve traits (in case it has state). */
-    const Polycurve_basic_traits_2& m_poly_traits;
-
-  public:
-    /*! Constructor. */
-    Is_vertical_2(const Polycurve_basic_traits_2& traits) :
-      m_poly_traits(traits)
-    {}
-
-    /*! Check whether the given x-monotone curve is a vertical segment.
-     * \param cv The curve.
-     * \return (true) if the curve is a vertical segment;(false) otherwise.
-     */
-    bool operator()(const X_monotone_curve_2& cv) const
-    {
-      // An x-monotone polycurve can represent a vertical segment only if it
-      // is comprised of vertical segments. If the first subcurve is vertical,
-      // all subcurves are vertical in an x-monotone polycurve
-      return m_poly_traits.subcurve_traits_2()->is_vertical_2_object()(cv[0]);
-    }
-  };
-
-  /*! Obtain an Is_vertical_2 functor object. */
-  Is_vertical_2 is_vertical_2_object() const
-  { return Is_vertical_2(*this); }
-
-  class Compare_y_at_x_2 {
-  private:
-    // Oblivious implementation
-    Comparison_result operator()(const X_monotone_subcurve_2& xs1,
-                                 Arr_curve_end ce1,
-                                 const X_monotone_subcurve_2& xs2,
-                                 Arr_all_sides_oblivious_tag) const
-    {
-      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
-      const Point_2& p = (ce1 == ARR_MAX_END) ?
-        geom_traits->construct_max_vertex_2_object()(xs1) :
-        geom_traits->construct_min_vertex_2_object()(xs1);
-      return geom_traits->compare_y_at_x_2_object()(p, xs2);
-    }
-
-    // Boundary implementation
-    Comparison_result operator()(const X_monotone_subcurve_2& xs1,
-                                 Arr_curve_end ce1,
-                                 const X_monotone_subcurve_2& xs2,
-                                 Arr_not_all_sides_oblivious_tag) const
-    {
-      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
-      typename Subcurve_traits_2::Parameter_space_in_x_2 ps_x =
-        geom_traits->parameter_space_in_x_2_object();
-      typename Subcurve_traits_2::Parameter_space_in_y_2 ps_y =
-        geom_traits->parameter_space_in_y_2_object();
-      typename Subcurve_traits_2::Construct_min_vertex_2 min_vertex =
-        geom_traits->construct_min_vertex_2_object();
-      typename Subcurve_traits_2::Construct_max_vertex_2 max_vertex =
-        geom_traits->construct_max_vertex_2_object();
-
-      const Arr_parameter_space ps_x1 = ps_x(xs1, ce1);
-      const Arr_parameter_space ps_y1 = ps_y(xs1, ce1);
-
-      CGAL_assertion(((ce1 == ARR_MAX_END) && (ps_x1 != ARR_LEFT_BOUNDARY)) ||
-                     ((ce1 == ARR_MIN_END) && (ps_x1 != ARR_RIGHT_BOUNDARY)));
-
-      if (ps_x1 == ARR_INTERIOR) {
-        if (ps_y1 == ARR_TOP_BOUNDARY) {
-          typename Subcurve_traits_2::Equal_2 equal =
-            geom_traits->equal_2_object();
-          const Point_2& p = (ce1 == ARR_MAX_END) ?
-            max_vertex(xs1) : min_vertex(xs1);
-          if (equal(p, max_vertex(xs2))) return EQUAL;
-          if (equal(p, min_vertex(xs2))) return EQUAL;
-          return LARGER;
-        }
-        if (ps_y1 == ARR_BOTTOM_BOUNDARY) {
-          typename Subcurve_traits_2::Equal_2 equal =
-            geom_traits->equal_2_object();
-          const Point_2& p = (ce1 == ARR_MAX_END) ?
-            max_vertex(xs1) : min_vertex(xs1);
-          if (equal(p, max_vertex(xs2))) return EQUAL;
-          if (equal(p, min_vertex(xs2))) return EQUAL;
-          return SMALLER;
-        }
-        // ps_y1 == ARR_INTERIOR
-        const Point_2& p = (ce1 == ARR_MAX_END) ?
-          max_vertex(xs1) : min_vertex(xs1);
-        return geom_traits->compare_y_at_x_2_object()(p, xs2);
-      }
-      // ps_x1 == ARR_RIGHT_BOUNDARY || ARR_LEFT_BOUNDARY
-      const Point_2& p1 = (ce1 == ARR_MAX_END) ?
-        max_vertex(xs1) : min_vertex(xs1);
-      const Point_2& p2 = (ce1 == ARR_MAX_END) ?
-        max_vertex(xs2) : min_vertex(xs2);
-      return geom_traits->compare_y_on_boundary_2_object()(p1, p2);
-    }
-
-  protected:
-    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
-      Polycurve_basic_traits_2;
-
-    /*! The polycurve traits (in case it has state). */
-    const Polycurve_basic_traits_2& m_poly_traits;
-
-  public:
-    /*! Constructor. */
-    Compare_y_at_x_2(const Polycurve_basic_traits_2& traits) :
-      m_poly_traits(traits) {}
-
-    /*! Obtain the location of the given point with respect to the input curve.
-     * \param p The point.
-     * \param xcv The polycurve curve.
-     * \pre p is in the x-range of cv.
-     * \return SMALLER if y(p) < cv(x(p)), i.e. the point is below the curve;
-     *         LARGER if y(p) > cv(x(p)), i.e. the point is above the curve;
-     *         EQUAL if p lies on the curve.
-     */
-    Comparison_result operator()(const Point_2& p,
-                                 const X_monotone_curve_2& xcv) const
-    {
-      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
-      if (! m_poly_traits.is_vertical_2_object()(xcv)) {
-        // Get the index of the subcurve in xcv containing p.
-        std::size_t i =
-          m_poly_traits.locate_impl(xcv, p, Are_all_sides_oblivious_tag());
-        CGAL_precondition(i != INVALID_INDEX);
-
-        // Compare the subcurve xcv[i] and p.
-        return geom_traits->compare_y_at_x_2_object()(p, xcv[i]);
-      }
-      // The curve is vertical
-      Comparison_result rc = geom_traits->compare_y_at_x_2_object()(p, xcv[0]);
-      if (rc == SMALLER) return SMALLER;
-      std::size_t n = xcv.number_of_subcurves();
-      rc = geom_traits->compare_y_at_x_2_object()(p, xcv[n-1]);
-      if (rc == LARGER) return LARGER;
-      return EQUAL;
-    }
-
-    /*! Obtain the location of the given curve_end with respect to the input
-     * curve.
-     * \param xcv The polycurve curve.
-     * \param ce the curve-end indicator of the x-monotone subcurve xl:
-     *            ARR_MIN_END - the minimal end of xl or
-     *            ARR_MAX_END - the maximal end of xl.
-     * \param xcv The polycurve curve.
-     * \pre the curve-end is in the x-range of xcv.
-     * \return SMALLER if if y(xs, ce) < cv(x(xs, ce)), i.e.  the curve-end
-     *           is below the curve xcv;
-     *         LARGER if y(xs, ce) > cv(x(xs, ce)), i.e. the curve-end is
-     *           above the curve xcv;
-     *         EQUAL if the curve-end lies on the curve xcv.
-     */
-    Comparison_result operator()(const X_monotone_subcurve_2& xs1,
-                                 Arr_curve_end ce1,
-                                 const X_monotone_subcurve_2& xs2) const
-    { return operator()(xs1, ce1, xs2, Are_all_sides_oblivious_tag()); }
-  };
-
-  /*! Obtain a Compare_y_at_x_2 functor object. */
-  Compare_y_at_x_2 compare_y_at_x_2_object() const
-  { return Compare_y_at_x_2(*this); }
-
-  class Compare_y_at_x_left_2 {
-  protected:
-    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
-      Polycurve_basic_traits_2;
-
-    /*! The polycurve traits (in case it has state). */
-    const Polycurve_basic_traits_2& m_poly_traits;
-
-  public:
-    /*! Constructor. */
-    Compare_y_at_x_left_2(const Polycurve_basic_traits_2& traits) :
-      m_poly_traits(traits)
-    {}
-
-    /*! Compare the y value of two x-monotone curves immediately to the left
-     * of their intersection point.
-     * \param cv1 The first polycurve curve.
-     * \param cv2 The second polycurve curve.
-     * \param p The intersection point.
-     * \pre The point p lies on both curves, and both of them must be also be
-     *      defined(lexicographically) to its left.
-     * \return The relative position of cv1 with respect to cv2 immdiately to
-     *         the left of p: SMALLER, LARGER or EQUAL.
-     */
-    Comparison_result operator()(const X_monotone_curve_2& cv1,
-                                 const X_monotone_curve_2& cv2,
-                                 const Point_2& p) const
-    {
-      // Get the indices of the subcurves in cv1 and cv2 containing p and
-      // defined to its left.
-      std::size_t i1 = m_poly_traits.locate_side(cv1, p, false);
-      std::size_t i2 = m_poly_traits.locate_side(cv2, p, false);
-
-      CGAL_precondition(i1 != INVALID_INDEX);
-      CGAL_precondition(i2 != INVALID_INDEX);
-
-      // Compare cv1[i1] and cv2[i2] at p's left.
-      return m_poly_traits.subcurve_traits_2()->
-        compare_y_at_x_left_2_object()(cv1[i1], cv2[i2], p);
-    }
-  };
-
-  /*! Obtain a Compare_y_at_x_left_2 functor object. */
-  Compare_y_at_x_left_2 compare_y_at_x_left_2_object() const
-  { return Compare_y_at_x_left_2(*this); }
-
-  class Compare_y_at_x_right_2 {
-  protected:
-    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
-      Polycurve_basic_traits_2;
-
-    /*! The polycurve traits (in case it has state). */
-    const Polycurve_basic_traits_2& m_poly_traits;
-
-  public:
-    /*! Constructor. */
-    Compare_y_at_x_right_2(const Polycurve_basic_traits_2& traits) :
-      m_poly_traits(traits)
-    {}
-
-    /*! Compare the y value of two x-monotone curves immediately to the right
-     * of their intersection point.
-     * \param cv1 The first curve.
-     * \param cv2 The second curve.
-     * \param p The intersection point.
-     * \pre The point p lies on both curves, and both of them must be also be
-     *      defined(lexicographically) to its right.
-     * \return The relative position of cv1 with respect to cv2 immdiately to
-     *         the right of p: SMALLER, LARGER or EQUAL.
-     */
-    Comparison_result operator()(const X_monotone_curve_2& cv1,
-                                 const X_monotone_curve_2& cv2,
-                                 const Point_2& p) const
-    {
-      // Get the indices of the subcurves in cv1 and cv2 containing p and
-      // defined to its right.
-      std::size_t i1=m_poly_traits.locate_side(cv1, p, true);
-      std::size_t i2=m_poly_traits.locate_side(cv2, p, true);
-
-      CGAL_precondition(i1 != INVALID_INDEX);
-      CGAL_precondition(i2 != INVALID_INDEX);
-
-      // Compare cv1[i1] and cv2[i2] at p's right.
-      return m_poly_traits.subcurve_traits_2()->
-        compare_y_at_x_right_2_object()(cv1[i1], cv2[i2], p);
-    }
-  };
-
-  /*! Obtain a Compare_y_at_x_right_2 functor object.
-   */
-  Compare_y_at_x_right_2 compare_y_at_x_right_2_object() const
-  { return Compare_y_at_x_right_2(*this); }
-
-  class Equal_2 {
-  protected:
-    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
-      Polycurve_basic_traits_2;
-
-    /*! The polycurve traits (in case it has state). */
-    const Polycurve_basic_traits_2& m_poly_traits;
-
-  public:
-    /*! Constructor. */
-    Equal_2(const Polycurve_basic_traits_2& poly_tr) : m_poly_traits(poly_tr) {}
-
-    /*! Check whether the two points are the same.
-     * \param p1 The first point.
-     * \param p2 The second point.
-     * \return (true) if the two point are the same;(false) otherwise.
-     */
-    bool operator()(const Point_2& p1, const Point_2& p2) const
-    { return m_poly_traits.subcurve_traits_2()->equal_2_object()(p1, p2); }
-
-    /*! Check whether the two x-monotone curves are the same (have the same
-     * graph).
-     * \param cv1 The first curve.
-     * \param cv2 The second curve.
-     * \return(true) if the two curves are the same;(false) otherwise.
-     */
-    bool operator()(const X_monotone_curve_2& cv1,
-                    const X_monotone_curve_2& cv2) const
-    {
-      // Check the pairwise equality of the contained subcurves.
-      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
-      typename Subcurve_traits_2::Equal_2 equal =
-        geom_traits->equal_2_object();
-      typename Subcurve_traits_2::Compare_x_2 compare_x =
-        geom_traits->compare_x_2_object();
-      typename Subcurve_traits_2::Compare_y_at_x_2 compare_y_at_x =
-        geom_traits->compare_y_at_x_2_object();
-      typename Subcurve_traits_2::Construct_max_vertex_2 max_vertex =
-        geom_traits->construct_max_vertex_2_object();
-      typename Subcurve_traits_2::Compare_endpoints_xy_2 comp_endpt =
-        geom_traits->compare_endpoints_xy_2_object();
-      Is_vertical_2 is_vertical = m_poly_traits.is_vertical_2_object();
-      Construct_min_vertex_2 xpoly_min_v =
-        m_poly_traits.construct_min_vertex_2_object();
-      Construct_max_vertex_2 xpoly_max_v =
-        m_poly_traits.construct_max_vertex_2_object();
-
-      // The first and last points of the subcurves should be equal.
-      bool res = equal(xpoly_min_v(cv1), xpoly_min_v(cv2));
-      if (!res) return false;
-      res = equal(xpoly_max_v(cv1), xpoly_max_v(cv2));
-      if (!res) return false;
-
-      // If the first and last points are equal and the curves are vertical,
-      // it means that it is equal.
-      bool ver1 = is_vertical(cv1);
-      bool ver2 = is_vertical(cv2);
-      // both curves are vertical and therefore equal.
-      if (ver1 && ver2) return true;
-      // one is vertical and the other is not - hence not equal.
-      if (ver1 || ver2) return false;
-
-      // If we arrived here it means that the first and last point of the
-      // curve are equal.
-      std::size_t i = 0;
-      std::size_t j = 0;
-      std::size_t n1 = cv1.number_of_subcurves();
-      std::size_t n2 = cv2.number_of_subcurves();
-      Comparison_result is_cv1_left_to_right = comp_endpt(cv1[0]);
-      Comparison_result is_cv2_left_to_right = comp_endpt(cv2[0]);
-
-      while ((i < (n1-1)) || (j < (n2-1))) {
-        Point_2 point1, point2;
-        std::size_t cv1_seg_ind, cv2_seg_ind;
-        if (SMALLER == is_cv1_left_to_right) {
-          cv1_seg_ind = i;
-          point1 = max_vertex(cv1[cv1_seg_ind]);
-        }
-        else {
-          cv1_seg_ind = n1 - 1 - i;
-          point1 = max_vertex(cv1[cv1_seg_ind]);
-        }
-        if (SMALLER == is_cv2_left_to_right) {
-          cv2_seg_ind = j;
-          point2 = max_vertex(cv2[cv2_seg_ind]);
-        }
-        else {
-          cv2_seg_ind = n2 - 1 - j;
-          point2 = max_vertex(cv2[cv2_seg_ind]);
-        }
-
-        bool res = equal(point1, point2);
-        // Easy case - the two points are equal
-        if (res) {
-          ++i;
-          ++j;
-        }
-        else {
-          Comparison_result res_x = compare_x(point1,point2);
-          // Check if the different point is a collinear point situated on
-          // the line between its two neighbors.
-          if (SMALLER == res_x) {
-            Comparison_result res_y_at_x =
-              compare_y_at_x(point1, cv2[cv2_seg_ind]);
-            if (EQUAL == res_y_at_x) ++i;
-            else return false;
-          }
-          else if (LARGER == res_x) {
-            Comparison_result res_y_at_x =
-              compare_y_at_x(point2,cv1[cv1_seg_ind]);
-            if (EQUAL == res_y_at_x) ++j;
-            else return false;
-          }
-          else return false;
-        }
-      }
-      return true;
-    }
-  };
-
-  /*! Obtain an Equal_2 functor object. */
-  Equal_2 equal_2_object() const { return Equal_2(*this); }
-
-  class Compare_endpoints_xy_2 {
-  protected:
-    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
-      Polycurve_basic_traits_2;
-
-    /*! The traits (in case it has state). */
-    const Polycurve_basic_traits_2& m_poly_traits;
-
-  public:
-    /*! Constructor. */
-    Compare_endpoints_xy_2(const Polycurve_basic_traits_2& traits) :
-      m_poly_traits(traits)
-    {}
-
-    /*! Compare the endpoints of an \(x\)-monotone curve lexicographically.
-     * (assuming the curve has a designated source and target points).
-     * \param cv The curve.
-     * \return SMALLER if the curve is oriented left-to-right;
-     *         LARGER if the curve is oriented right-to-left.
-     */
-    Comparison_result operator()(const X_monotone_curve_2& xcv) const
-    {
-      return (m_poly_traits.subcurve_traits_2()->
-              compare_endpoints_xy_2_object()(xcv[0]) == SMALLER) ?
-        (SMALLER) : (LARGER);
-    }
-  };
-  //@}
-
-  /// \name Types and functors defined here, required by the
-  // ArrangementDirectionalXMonotoneTraits_2 concept.
-  //@{
-
-  Compare_endpoints_xy_2 compare_endpoints_xy_2_object() const
-  { return Compare_endpoints_xy_2(*this); }
-
-  class Construct_opposite_2 {
-  protected:
-    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
-      Polycurve_basic_traits_2;
-
-    /*! The traits (in case it has state). */
-    const Polycurve_basic_traits_2& m_poly_traits;
-
-  public:
-    /*! Constructor */
-    Construct_opposite_2(const Polycurve_basic_traits_2& traits) :
-      m_poly_traits(traits)
-    {}
-
-    /*! Construct the reversed \(x\)-monotone polycurve of the input.
-     * Note that the functor constructs the opposites of _all_ subcurves
-     * constituting xcv.
-     * \param xcv the \(x\)-monotone polycurve to be reveres
-     * \pre xcv contains at least one subcurve
-     * \return An \(x\)-monotone polycurve with the same graph as the input xcv
-     *         only with a reverse orientation.
-     */
-    X_monotone_curve_2 operator()(const X_monotone_curve_2& xcv) const
-    {
-      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
-      typename Subcurve_traits_2::Construct_opposite_2 const_op =
-        geom_traits->construct_opposite_2_object();
-      std::vector<X_monotone_subcurve_2> rev_segs(xcv.number_of_subcurves());;
-      typename X_monotone_curve_2::Subcurve_const_iterator sit;
-      typename X_monotone_curve_2::Subcurve_iterator tit = rev_segs.begin();
-      for (sit = xcv.subcurves_begin(); sit != xcv.subcurves_end(); ++sit)
-        *tit++ = const_op(*sit);
-      return X_monotone_curve_2(rev_segs.rbegin(), rev_segs.rend());
-    }
-  };
-
-  Construct_opposite_2 construct_opposite_2_object() const
-  { return Construct_opposite_2(*this); }
-
-  ///@}
-
-  /// \name Types and functors defined here, required by the
-  // ArrangementLandmarkTraits concept.
-  //@{
-
-#if 0
-  // The following block assumes that the subcurve traits template parameter
-  // is a model of the ArrangementLandmarkTraits concept; in other words, it
-  // defines the nested types Approximate_number_type and Approximate_2 and
-  // the member function approximate_2_object(). It cannot be used as is if
-  // the subcurve traits does not model the ArrangementLandmarkTraits concept.
-  // The functor Construct_x_monotone_curve_2 is provided regardless of the
-  // subcurve traits.
-
-  typedef typename Subcurve_traits_2::Approximate_number_type
-  Approximate_number_type;
-  typedef typename Subcurve_traits_2::Approximate_2    Approximate_2;
-
-  /*! Obtain an Approximate_2 functor object. */
-  Approximate_2 approximate_2_object() const
-  { return subcurve_traits_2()->approximate_2_object(); }
-#else
-  // The following block defines the nested types Approximate_number_type and
-  // Approximate_2 and the member function approximate_2_object() based on the
-  // corresponding types and function definitions of the subcurve traits. If
-  // the subcurve traits does not provide these definitions, they are defined
-  // as dummies. Essentially, the polycurve traits becomes a practical model of
-  // the ArrangementLandmarkTraits concept only if the subcurve traits is a
-  // model of this concept.
-  //
-  // The following implementation is inspired by
-  // http://stackoverflow.com/a/11816999/1915421
-
-  template <typename T>
-  struct Void {
-    typedef void type;
-  };
-
-  template <typename T, typename _ = void>
-  struct has_approximate_2 {
-    // Generic implementation
-    typedef void                        Approximate_number_type;
-    typedef void                        Approximate_2;
-  };
-
-  template <typename T>
-  struct has_approximate_2<T, typename Void<typename T::Approximate_2>::type>
-  {
-    // Specialization for types holding a nested type T::Approximate_2
-    typedef typename T::Approximate_number_type
-                                        Approximate_number_type;
-    typedef typename T::Approximate_2   Approximate_2;
-  };
-
-  typedef typename has_approximate_2<Subcurve_traits_2>::Approximate_number_type
-                                        Approximate_number_type;
-  typedef typename has_approximate_2<Subcurve_traits_2>::Approximate_2
-                                        Approximate_2;
-
-  /*! Obtain an Approximate_2 functor object. */
-  Approximate_2 approximate_2_object_impl(boost::false_type) const
-  { return subcurve_traits_2()->approximate_2_object(); }
-
-  Approximate_2 approximate_2_object_impl(boost::true_type) const { }
-
-  Approximate_2 approximate_2_object() const
-  {
-    typedef typename boost::is_same<void, Approximate_2>::type      Is_void;
-    return approximate_2_object_impl(Is_void());
-  }
-#endif
-
-  class Construct_x_monotone_curve_2 {
-  protected:
-    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
-      Polycurve_basic_traits_2;
-
-    /*! The polycurve traits (in case it has state). */
-    const Polycurve_basic_traits_2& m_poly_traits;
-
-  public:
-    /*! Constructor. */
-    Construct_x_monotone_curve_2(const Polycurve_basic_traits_2& traits) :
-      m_poly_traits(traits)
-    {}
-
-    /*! Obtain an x-monotone polycurve that consists of one given subcurve.
-     * \param seg input subcurve.
-     * \pre seg is not degenerated.
-     * \return An x-monotone polycurve with one subcurve.
-     */
-    X_monotone_curve_2 operator()(const X_monotone_subcurve_2& seg) const
-    {
-      CGAL_precondition_code
-        (
-         /* Test that the subcurve is not degenerated. We do this test
-          * independently from the subcurve traits in use, as we do not
-          * allow a polycurve with degenerated subcurves.
-          */
-         const Subcurve_traits_2* geom_traits =
-           m_poly_traits.subcurve_traits_2();
-         typename Subcurve_traits_2::Construct_min_vertex_2 get_min_v =
-           geom_traits->construct_min_vertex_2_object();
-         typename Subcurve_traits_2::Construct_max_vertex_2 get_max_v =
-           geom_traits->construct_max_vertex_2_object();
-         typename Subcurve_traits_2::Equal_2 equal =
-           geom_traits->equal_2_object();
-
-         CGAL_precondition_msg(!equal(get_min_v(seg),get_max_v(seg)),
-                               "Cannot construct a degenerated subcurve");
-         );
-
-#ifdef CGAL_ALWAYS_LEFT_TO_RIGHT
-      if (m_poly_traits.subcurve_traits_2()->
-          compare_endpoints_xy_2_object()(seg) == LARGER)
-        return X_monotone_subcurve_2(m_poly_traits.subcurve_traits_2()->
-                                    construct_opposite_2_object()(seg));
-#endif
-
-      return X_monotone_curve_2(seg);
-    }
-
-    /*! Construct an x-monotone polycurve which is well-oriented from a range of
-     * elements.
-     * \pre Range should from a continuous well-oriented x-monotone polycurve.
-     */
-    template <typename ForwardIterator>
-    X_monotone_curve_2 operator()(ForwardIterator begin,
-                                  ForwardIterator end) const
-    {
-      typedef typename std::iterator_traits<ForwardIterator>::value_type VT;
-      typedef typename boost::is_same<VT,Point_2>::type Is_point;
-
-      // Dispatch the range to the appropriate implementation.
-      return constructor_impl(begin, end, Is_point());
-    }
-
-    /*! Construct an x-monotone polycurve from a range of points.
-     * The polycurve may be oriented left-to-right or right-to-left
-     * depending on the lexicographical order of the points in the
-     * input.
-     * \pre Range contains at least two points.
-     * \pre No two consecutive points are the same.
-     * \pre The points form an continuous well-oriented x-monotone polycurve.
-     * \post By the construction the returned polycurve is well-oriented.
-     */
-    template <typename ForwardIterator>
-    X_monotone_curve_2 constructor_impl(ForwardIterator /* begin */,
-                                        ForwardIterator /* end */,
-                                        boost::true_type) const
-    { CGAL_error_msg("Cannot construct a polycurve from a range of points!"); }
-
-    /*! Obtain an x-monotone polycurve from a range of subcurves.
-     * \param begin An iterator pointing to the first subcurve in the range.
-     * \param end An iterator pointing to the past-the-end subcurve
-     * in the range.
-     * \pre The range contains at least one subcurve.
-     * \pre Subcurves correspond to a well-oriented polycurve. That
-     *      is, the target of the i-th subcurve is an source of the
-     *      (i+1)th subcurve.
-     * \pre The sequence of subcurves in the range forms a weak x-monotone
-     *      polycurve.
-     * \pre The container should support bidirectional iteration.
-     * \return A continuous, well-oriented x-monotone polycurve which
-     *         is directed either left-to-right or right-to-left
-     *         depending on the subcurves in the input.
-     */
-    template <typename ForwardIterator>
-    X_monotone_curve_2 constructor_impl(ForwardIterator begin,
-                                        ForwardIterator end,
-                                        boost::false_type) const
-    {
-      CGAL_precondition_msg
-        (
-         begin != end,
-         "Input range of subcurves has to contain at least one subcurve"
-         );
-
-      CGAL_precondition_code
-        (
-         const Subcurve_traits_2* geom_traits =
-           m_poly_traits.subcurve_traits_2();
-         typename Subcurve_traits_2::Compare_endpoints_xy_2 cmp_seg_endpts =
-           geom_traits->compare_endpoints_xy_2_object();
-         typename Subcurve_traits_2::Construct_min_vertex_2 get_min_v =
-           geom_traits->construct_min_vertex_2_object();
-         typename Subcurve_traits_2::Construct_max_vertex_2 get_max_v =
-           geom_traits->construct_max_vertex_2_object();
-         typename Subcurve_traits_2::Equal_2 equal =
-           geom_traits->equal_2_object();
-
-         ForwardIterator curr = begin;
-         ForwardIterator next = begin;
-         ++next;
-         );
-
-
-      CGAL_precondition_msg
-        (
-         (next != end) || !equal(get_max_v(*curr),get_min_v(*curr)),
-         "Cannot construct a polycurve with degenerated subcurve"
-         );
-
-      CGAL_precondition_code
-        (
-         // Range contains at least two subcurves
-
-         Comparison_result init_dir = cmp_seg_endpts(*curr);
-         while (next != end){
-           CGAL_precondition_msg
-             (!equal(get_min_v(*next),get_max_v(*next)),
-              "Cannot construct a polycurve with degenerated subcurve"
-              );
-           CGAL_precondition_msg
-             (
-              init_dir == cmp_seg_endpts(*next),
-              "Subcurves must form x-monotone polycurve"
-              );
-           if (init_dir == SMALLER){
-             CGAL_precondition_msg
-               (
-                equal(get_max_v(*curr),get_min_v(*next)),
-                "Subcurves should concatenate in source->target manner"
-                );
-           }
-           else{
-             CGAL_precondition_msg
-               (
-                equal(get_min_v(*curr),get_max_v(*next)),
-                "Subcurves should concatenate in source->target manner"
-                );
-           }
-           ++curr;
-           ++next;
-         }
-         );
-
-#ifdef CGAL_ALWAYS_LEFT_TO_RIGHT
-      if (m_poly_traits.subcurve_traits_2()->
-          compare_endpoints_xy_2_object()(*begin) == LARGER)
-      {
-        X_monotone_curve_2 xcv(begin, end);
-        return m_poly_traits.construct_opposite_2_object()(xcv);
-      }
-#endif
-
-      return X_monotone_curve_2(begin, end);
-    }
-  };
-
-  /*! Obtain a Construct_x_monotone_curve_2 functor object. */
-  Construct_x_monotone_curve_2 construct_x_monotone_curve_2_object() const
-  { return Construct_x_monotone_curve_2(*this); }
-
-  //@}
-
-  /// \name Types and functors defined here, required by the
-  // ArrangementOpenBoundaryTraits_2 concept.
-  //@{
-
-  /*! A function object that obtains the parameter space of a geometric
-   * entity along the x-axis
-   */
-  class Parameter_space_in_x_2 {
-  protected:
-    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
-      Polycurve_basic_traits_2;
-
-    /*! The polycurve traits (in case it has state). */
-    const Polycurve_basic_traits_2& m_poly_traits;
-
-  public:
-    /*! Constructor. */
-    Parameter_space_in_x_2(const Polycurve_basic_traits_2& traits) :
-      m_poly_traits(traits)
-    {}
-
-    /*! Obtains the parameter space at the end of a curve along the x-axis .
-     * Note that if the curve-end coincides with a pole, then unless the curve
-     * coincides with the identification curve, the curve-end is considered to
-     * be approaching the boundary, but not on the boundary.
-     * If the curve coincides with the identification curve, it is assumed to
-     * be smaller than any other object.
-     * \param xcv the curve
-     * \param ce the curve-end indicator:
-     *     ARR_MIN_END - the minimal end of xc or
-     *     ARR_MAX_END - the maximal end of xc
-     * \return the parameter space at the ce end of the curve xcv.
-     *   ARR_LEFT_BOUNDARY  - the curve approaches the identification curve
-     *                        from the right at the curve left end.
-     *   ARR_INTERIOR       - the curve does not approache the identification
-     *                        curve.
-     *   ARR_RIGHT_BOUNDARY - the curve approaches the identification curve
-     *                        from the left at the curve right end.
-     * \pre xcv does not coincide with the vertical identification curve.
-     */
-    Arr_parameter_space operator()(const X_monotone_curve_2& xcv,
-                                   Arr_curve_end ce) const
-    {
-      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
-      Comparison_result direction =
-        geom_traits->compare_endpoints_xy_2_object()(xcv[0]);
-      const X_monotone_subcurve_2& xs =
-        (((direction == SMALLER) && (ce == ARR_MAX_END)) ||
-         ((direction == LARGER) && (ce == ARR_MIN_END))) ?
-        xcv[xcv.number_of_subcurves()-1] : xcv[0];
-      return geom_traits->parameter_space_in_x_2_object()(xs, ce);
-    }
-
-    /*! Obtains the parameter space at a point along the x-axis.
-     * \param p the point.
-     * \return the parameter space at p.
-     * \pre p does not lie on the vertical identification curve.
-     */
-    Arr_parameter_space operator()(const Point_2 p) const
-    {
-      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
-      return geom_traits->parameter_space_in_x_2_object()(p);
-    }
-  };
-
-  /*! Obtain a Parameter_space_in_x_2 function object */
-  Parameter_space_in_x_2 parameter_space_in_x_2_object() const
-  { return Parameter_space_in_x_2(*this); }
-
-  /*! A function object that obtains the parameter space of a geometric
-   * entity along the y-axis
-   */
-  class Parameter_space_in_y_2 {
-  protected:
-    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
-      Polycurve_basic_traits_2;
-
-    /*! The polycurve traits (in case it has state). */
-    const Polycurve_basic_traits_2& m_poly_traits;
-
-  public:
-    /*! Constructor. */
-    Parameter_space_in_y_2(const Polycurve_basic_traits_2& traits) :
-      m_poly_traits(traits)
-    {}
-
-    /*! Obtains the parameter space at the end of an curve along the y-axis .
-     * Note that if the curve-end coincides with a pole, then unless the curve
-     * coincides with the identification curve, the curve-end is considered to
-     * be approaching the boundary, but not on the boundary.
-     * If the curve coincides with the identification curve, it is assumed to
-     * be smaller than any other object.
-     * \param xcv the curve
-     * \param ce the curve-end indicator:
-     *     ARR_MIN_END - the minimal end of xcv or
-     *     ARR_MAX_END - the maximal end of xcv
-     * \return the parameter space at the ce end of the curve xcv.
-     *   ARR_BOTTOM_BOUNDARY  - the curve approaches the south pole at the
-     *                          curve left end.
-     *   ARR_INTERIOR         - the curve does not approache a contraction
-     *                          point.
-     *   ARR_TOP_BOUNDARY     - the curve approaches the north pole at the
-     *                          curve right end.
-     * There are no horizontal identification curves!
-     */
-    Arr_parameter_space operator()(const X_monotone_curve_2& xcv,
-                                   Arr_curve_end ce) const
-    {
-      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
-      Comparison_result direction =
-        geom_traits->compare_endpoints_xy_2_object()(xcv[0]);
-      const X_monotone_subcurve_2& xs =
-        (((direction == SMALLER) && (ce == ARR_MAX_END)) ||
-         ((direction == LARGER) && (ce == ARR_MIN_END))) ?
-        xcv[xcv.number_of_subcurves()-1] : xcv[0];
-      return geom_traits->parameter_space_in_y_2_object()(xs, ce);
-    }
-
-    /*! Obtains the parameter space at a point along the y-axis.
-     * \param p the point.
-     * \return the parameter space at p.
-     * \pre p does not lie on the horizontal identification curve.
-     * There are no horizontal identification curves!
-     */
-    Arr_parameter_space operator()(const Point_2 p) const
-    {
-      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
-      return geom_traits->parameter_space_in_y_2_object()(p);
-    }
-  };
-
-  /*! Obtain a Parameter_space_in_y_2 function object */
-  Parameter_space_in_y_2 parameter_space_in_y_2_object() const
-  { return Parameter_space_in_y_2(*this); }
-
-  /*! A functor that compares the x-coordinate of curve-ends and points on the
-   * boundary of the parameter space.
-   */
-  class Compare_x_on_boundary_2 {
-  protected:
-    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
-      Polycurve_basic_traits_2;
-
-    /*! The polycurve traits (in case it has state). */
-    const Polycurve_basic_traits_2& m_poly_traits;
-
-  public:
-    /*! Constructor. */
-    Compare_x_on_boundary_2(const Polycurve_basic_traits_2& traits) :
-      m_poly_traits(traits)
-    {}
-
-    /*! Compare the x-limit of a point with the x-coordinate of an
-     * x-curve-end on the boundary.
-     * \param point the point.
-     * \param xcv the x-curve, the endpoint of which is compared.
-     * \param ce the x-curve-end indicator:
-     *            ARR_MIN_END - the minimal end of xcv or
-     *            ARR_MAX_END - the maximal end of xcv.
-     * \return the comparison result:
-     *         SMALLER - x(p) < x(xcv, ce);
-     *         EQUAL   - x(p) = x(xcv, ce);
-     *         LARGER  - x(p) > x(xcv, ce).
-     * \pre p lies in the interior of the parameter space.
-     * \pre the ce end of the x-curve xcv lies on the top boundary.
-     * \pre xcv does not coincide with the vertical identification curve.
-     */
-    Comparison_result operator()(const Point_2& point,
-                                 const X_monotone_curve_2& xcv,
-                                 Arr_curve_end ce) const
-    {
-      const Subcurve_traits_2* geom_traits =
-        m_poly_traits.subcurve_traits_2();
-      Comparison_result direction =
-        geom_traits->compare_endpoints_xy_2_object()(xcv[0]);
-      const X_monotone_subcurve_2& xs =
-        (((direction == SMALLER) && (ce == ARR_MAX_END)) ||
-         ((direction == LARGER) && (ce == ARR_MIN_END))) ?
-        xcv[0] : xcv[xcv.number_of_subcurves()-1];
-      return geom_traits->compare_x_on_boundary_2_object()(point, xs, ce);
-    }
-
-    /*! Compare the x-coordinates of 2 curve-ends near the boundary of the
-     * parameter space.
-     * \param xcv1 the first curve.
-     * \param ce1 the first curve-end indicator:
-     *            ARR_MIN_END - the minimal end of xcv1 or
-     *            ARR_MAX_END - the maximal end of xcv1.
-     * \param xcv2 the second curve.
-     * \param ce2 the second  curve-end indicator:
-     *            ARR_MIN_END - the minimal end of xcv2 or
-     *            ARR_MAX_END - the maximal end of xcv2.
-     * \return the second comparison result:
-     *         SMALLER - x(xcv1, ce1) < x(xcv2, ce2);
-     *         EQUAL   - x(xcv1, ce1) = x(xcv2, ce2);
-     *         LARGER  - x(xcv1, ce1) > x(xcv2, ce2).
-     * \pre the ce1 end of the curve xcv1 lies on a pole (implying ce1 is
-     *      vertical).
-     * \pre the ce2 end of the curve xcv2 lies on a pole (implying ce2 is
-     *      vertical).
-     * \pre xcv1 does not coincide with the vertical identification curve.
-     * \pre xcv2 does not coincide with the vertical identification curve.
-     */
-    Comparison_result operator()(const X_monotone_curve_2& xcv1,
-                                 Arr_curve_end ce1,
-                                 const X_monotone_curve_2& xcv2,
-                                 Arr_curve_end ce2) const
-    {
-      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
-      Comparison_result direction1 =
-        geom_traits->compare_endpoints_xy_2_object()(xcv1[0]);
-      const X_monotone_subcurve_2& xs1 =
-        (((direction1 == SMALLER) && (ce1 == ARR_MAX_END)) ||
-         ((direction1 == LARGER) && (ce1 == ARR_MIN_END))) ?
-        xcv1[0] : xcv1[xcv1.number_of_subcurves()-1];
-      Comparison_result direction2 =
-        geom_traits->compare_endpoints_xy_2_object()(xcv2[0]);
-      const X_monotone_subcurve_2& xs2 =
-        (((direction2 == SMALLER) && (ce2 == ARR_MAX_END)) ||
-         ((direction2 == LARGER) && (ce2 == ARR_MIN_END))) ?
-        xcv2[0] : xcv2[xcv2.number_of_subcurves()-1];
-      return geom_traits->compare_x_on_boundary_2_object()(xs1, ce1, xs2, ce2);
-    }
-  };
-
-  /*! Obtain a Compare_x_on_boundary_2 function object. */
-  Compare_x_on_boundary_2 compare_x_on_boundary_2_object() const
-  { return Compare_x_on_boundary_2(*this); }
-
-  class Compare_x_at_limit_2{
-  protected:
-    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
-      Polycurve_basic_traits_2;
-
-    /*! The polycurve traits (in case it has state). */
-    const Polycurve_basic_traits_2& m_poly_traits;
-
-  public:
-    Compare_x_at_limit_2(const Polycurve_basic_traits_2& traits) :
-      m_poly_traits(traits)
-    {}
-
-    unsigned int get_curve_index (const X_monotone_curve_2& xcv,
-                                  const Arr_curve_end ce) const
-    {
-      //waqar:: dont know why it is opposite in Parameter_space_in_x...
-      // I think this is because of the way the subcurves are stored in the
-      // curve_vector.
-      // I am assuming that min end depends upon the direction and not the
-      // x-value.
-      // and also that min end subcurve is always placed at position 0 of the
-      // vector.
-      // Comfirm with Eric.
-      return (ce == ARR_MIN_END) ? 0 : xcv.number_of_subcurves() - 1;
-    }
-
-    Comparison_result operator()(const Point_2& p,
-                                 const X_monotone_curve_2& xcv,
-                                 Arr_curve_end ce) const
-    {
-      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
-      typename Subcurve_traits_2::Compare_x_at_limit_2 compare_x_at_limit =
-        geom_traits->compare_x_at_limit_2_object();
-
-      unsigned int index = this->get_curve_index(xcv, ce);
-      return compare_x_at_limit(p, xcv[index], ce );
-    }
-
-    Comparison_result operator()(const X_monotone_curve_2& xcv1,
-                                 Arr_curve_end ce1/* for xcv1 */,
-                                 const X_monotone_curve_2 & xcv2,
-                                 Arr_curve_end ce2/*! for xcv2 */) const
-    {
-      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
-      typename Subcurve_traits_2::Compare_x_at_limit_2 compare_x_at_limit =
-        geom_traits->compare_x_at_limit_2_object();
-
-      unsigned int index_1 = this->get_curve_index(xcv1, ce1);
-      unsigned int index_2 = this->get_curve_index(xcv2, ce2);
-
-      return compare_x_at_limit(xcv1[index_1], ce1, xcv2[index_2], ce2);
-    }
-
-    Comparison_result operator()(const X_monotone_curve_2& xcv,
-                                 Arr_curve_end ce1/* for xcv */,
-                                 const X_monotone_subcurve_2& xseg,
-                                 Arr_curve_end ce2/*! for xseg */) const
-    {
-      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
-      typename Subcurve_traits_2::Compare_x_at_limit_2
-        compare_x_at_limit = geom_traits->compare_x_at_limit_2_object();
-
-      unsigned int index = this->get_curve_index(xcv, ce1 );
-
-      return compare_x_at_limit(xcv[index], ce1, xseg, ce2 );
-    }
-  };
-
-  Compare_x_at_limit_2 compare_x_at_limit_2_object() const
-  { return Compare_x_at_limit_2(*this); }
-
-  class Compare_x_near_limit_2{
-  protected:
-    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
-      Polycurve_basic_traits_2;
-
-    /*! The polycurve traits (in case it has state). */
-    const Polycurve_basic_traits_2& m_poly_traits;
-
-  public:
-    Compare_x_near_limit_2(const Polycurve_basic_traits_2& traits) :
-      m_poly_traits(traits)
-    {}
-
-    unsigned int get_curve_index (const X_monotone_curve_2& xcv,
-                                  const Arr_curve_end ce) const
-    {
-      //waqar:: dont know why it is opposite in Parameter_space_in_x...
-      // I think this is because of the way the subcurves are stored in the
-      // curve_vector.
-      // I am assuming that min end depends upon the direction and not the
-      // x-value.
-      // and also that min end subcurve is always placed at position 0 of the
-      // vector.
-      // Comfirm with Eric.
-      unsigned int index =
-        (ce == ARR_MIN_END) ? 0 : xcv.number_of_subcurves() - 1;
-      return index;
-    }
-
-    Comparison_result operator()(const X_monotone_curve_2 xcv1,
-                                 const X_monotone_curve_2 xcv2,
-                                 Arr_curve_end ce) const
-    {
-      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
-      typename Subcurve_traits_2::Compare_x_near_limit_2
-        cmp_x_near_limit = geom_traits->compare_x_near_limit_2_object();
-
-      unsigned int index_1 = this->get_curve_index(xcv1, ce);
-      unsigned int index_2 = this->get_curve_index(xcv2, ce);
-
-      return cmp_x_near_limit(xcv1[index_1], xcv2[index_2], ce);
-    }
-  };
-
-  Compare_x_near_limit_2 compare_x_near_limit_2_object() const
-  { return Compare_x_near_limit_2(*this); }
-
-  /*! A functor that compares the y-coordinate of two given points
-   * that lie on the vertical identification curve.
-   */
-  class Compare_y_on_boundary_2 {
-  protected:
-    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
-      Polycurve_basic_traits_2;
-
-    /*! The polycurve traits (in case it has state). */
-    const Polycurve_basic_traits_2& m_poly_traits;
-
-  public:
-    /*! Constructor. */
-    Compare_y_on_boundary_2(const Polycurve_basic_traits_2& traits) :
-      m_poly_traits(traits)
-    {}
-
-    /*! Compare the y-coordinate of two given points that lie on the vertical
-     * identification curve.
-     * \param p1 the first point.
-     * \param p2 the second point.
-     * \return SMALLER - p1 is lexicographically smaller than p2;
-     *         EQUAL   - p1 and p2 coincides;
-     *         LARGER  - p1 is lexicographically larger than p2;
-     * \pre p1 lies on the vertical identification curve.
-     * \pre p2 lies on the vertical identification curve.
-     */
-    Comparison_result operator()(const Point_2& p1, const Point_2& p2) const
-    {
-      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
-      return geom_traits->compare_y_on_boundary_2_object()(p1, p2);
-    }
-  };
-
-  /*! Obtain a Compare_y_on_boundary_2 function object */
-  Compare_y_on_boundary_2 compare_y_on_boundary_2_object() const
-  { return Compare_y_on_boundary_2(*this); }
-
-  /*! A functor that compares the y-coordinates of curve-ends near the
-   * boundary of the parameter space.
-   */
-  class Compare_y_near_boundary_2 {
-  protected:
-    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
-      Polycurve_basic_traits_2;
-
-    /*! The polycurve traits (in case it has state). */
-    const Polycurve_basic_traits_2& m_poly_traits;
-
-  public:
-    /*! Constructor. */
-    Compare_y_near_boundary_2(const Polycurve_basic_traits_2& traits) :
-      m_poly_traits(traits)
-    {}
-
-    /*! Compare the y-coordinates of 2 curves at their ends near the boundary
-     * of the parameter space.
-     * \param xcv1 the first curve.
-     * \param xcv2 the second curve.
-     * \param ce the curve-end indicator:
-     *     ARR_MIN_END - the minimal end or
-     *     ARR_MAX_END - the maximal end
-     * \return the second comparison result.
-     * \pre the ce ends of the curves xcv1 and xcv2 lie either on the left
-     *      boundary or on the right boundary of the parameter space (implying
-     *      that they cannot be vertical).
-     * There is no horizontal identification curve!
-     */
-    Comparison_result operator()(const X_monotone_curve_2& xcv1,
-                                 const X_monotone_curve_2& xcv2,
-                                 Arr_curve_end ce) const
-    {
-      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
-      Comparison_result direction1 =
-        geom_traits->compare_endpoints_xy_2_object()(xcv1[0]);
-      const X_monotone_subcurve_2& xs1 =
-        (((direction1 == SMALLER) && (ce == ARR_MAX_END)) ||
-         ((direction1 == LARGER) && (ce == ARR_MIN_END))) ?
-        xcv1[0] : xcv1[xcv1.number_of_subcurves()-1];
-      Comparison_result direction2 =
-        geom_traits->compare_endpoints_xy_2_object()(xcv2[0]);
-      const X_monotone_subcurve_2& xs2 =
-        (((direction2 == SMALLER) && (ce == ARR_MAX_END)) ||
-         ((direction2 == LARGER) && (ce == ARR_MIN_END))) ?
-        xcv2[0] : xcv2[xcv2.number_of_subcurves()-1];
-      return geom_traits->compare_y_near_boundary_2_object()(xs1, xs2, ce);
-    }
-  };
-
-  /*! Obtain a Compare_y_near_boundary_2 function object */
-  Compare_y_near_boundary_2 compare_y_near_boundary_2_object() const
-  { return Compare_y_near_boundary_2(*this); }
-
-  /*! A functor that indicates whether a geometric object lies on the
-   * vertical identification curve.
-   */
-  class Is_on_y_identification_2 {
-  protected:
-    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
-      Polycurve_basic_traits_2;
-
-    /*! The polycurve traits (in case it has state). */
-    const Polycurve_basic_traits_2& m_poly_traits;
-
-  public:
-    /*! Constructor. */
-    Is_on_y_identification_2(const Polycurve_basic_traits_2& traits) :
-      m_poly_traits(traits)
-    {}
-
-    /*! Determine whether a point lies in the vertical boundary.
-     * \param p the point.
-     * \return a Boolean indicating whether p lies in the vertical boundary.
-     */
-    bool operator()(const Point_2& p) const
-    {
-      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
-      return geom_traits->is_on_y_identification_2_object()(p);
-    }
-
-    /*! Determine whether an x-monotone curve lies in the vertical boundary.
-     * \param xcv the x-monotone curve.
-     * \return a Boolean indicating whether xcv lies in the vertical boundary.
-     */
-    bool operator()(const X_monotone_curve_2& xcv) const
-    {
-      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
-      typename X_monotone_curve_2::Subcurve_const_iterator it;
-      for (it = xcv.subcurves_begin(); it != xcv.subcurves_end(); ++it)
-        if (! geom_traits->is_on_y_identification_2_object()(*it)) return false;
-      return true;
-    }
-  };
-
-  /*! Obtain a Is_on_y_identification_2 function object */
-  Is_on_y_identification_2 is_on_y_identification_2_object() const
-  { return Is_on_y_identification_2(*this); }
-
-  /*! A functor that indicates whether a geometric object lies on the
-   * horizontal identification curve.
-   */
-  class Is_on_x_identification_2 {
-  protected:
-    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
-      Polycurve_basic_traits_2;
-
-    /*! The polycurve traits (in case it has state). */
-    const Polycurve_basic_traits_2& m_poly_traits;
-
-  public:
-    /*! Constructor. */
-    Is_on_x_identification_2(const Polycurve_basic_traits_2& traits) :
-      m_poly_traits(traits)
-    {}
-
-    /*! Determine whether a point lies in the vertical boundary.
-     * \param p the point.
-     * \return a Boolean indicating whether p lies in the vertical boundary.
-     */
-    bool operator()(const Point_2& p) const
-    {
-      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
-      return geom_traits->is_on_x_identification_2_object()(p);
-    }
-
-    /*! Determine whether an x-monotone curve lies in the vertical boundary.
-     * \param xcv the x-monotone curve.
-     * \return a Boolean indicating whether xcv lies in the vertical boundary.
-     */
-    bool operator()(const X_monotone_curve_2& xcv) const
-    {
-      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
-      typename X_monotone_curve_2::Subcurve_const_iterator it;
-      for (it = xcv.subcurves_begin(); it != xcv.subcurves_end(); ++it)
-        if (! geom_traits->is_on_x_identification_2_object()(*it)) return false;
-      return true;
-    }
-  };
-
-  /*! Obtain a Is_on_x_identification_2 function object */
-  Is_on_x_identification_2 is_on_x_identification_2_object() const
-  { return Is_on_x_identification_2(*this); }
-
-  //@}
-
-  /// \name Types and functors defined here not required by any concept.
-  //@{
-
-  /*! \class
-   * A functor that obtains the number of points of a polycurve.
-   */
-  class Number_of_points_2 {
-  public:
-    size_type operator()(const X_monotone_curve_2& cv) const
-    {
-      size_type num_seg = cv.number_of_subcurves();
-      return (num_seg == 0) ? 0 : num_seg + 1;
-    }
-  };
-
-  Number_of_points_2 number_of_points_2_object() const
-  { return Number_of_points_2(); }
-
-  /* Functor to augment a polycurve by adding a subcurve at the back.
-   * TODO: Test all the operator()'s. (Don't forget vertical cases!)
-   */
-  class Push_back_2 {
-  protected:
-    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
-      Polycurve_basic_traits_2;
-
-    /*! The traits (in case it has state). */
-    const Polycurve_basic_traits_2& m_poly_traits;
-
-  public:
-    /*! Constructor. */
-    Push_back_2(const Polycurve_basic_traits_2& traits) :
-      m_poly_traits(traits)
-    {}
-
-    /*! Append a subcurve to an existing x-monotone polycurve at the back.
-     */
-    void operator()(X_monotone_curve_2& xcv, const X_monotone_subcurve_2& seg)
-      const
-    { push_back_2_impl<void*>(xcv, seg, Are_all_sides_oblivious_tag()); }
-
-  private:
-    // Oblivious implementation
-    template<typename>
-    void push_back_2_impl(X_monotone_curve_2& xcv,
-                          const X_monotone_subcurve_2& seg,
-                          Arr_all_sides_oblivious_tag) const
-    {
-      CGAL_precondition_code
-        (
-         typedef typename X_monotone_curve_2::size_type size_type;
-         size_type num_seg = xcv.number_of_subcurves();
-         const Subcurve_traits_2* geom_traits =
-           m_poly_traits.subcurve_traits_2();
-         typename Subcurve_traits_2::Compare_endpoints_xy_2 cmp_seg_endpts =
-           geom_traits->compare_endpoints_xy_2_object();
-         Comparison_result dir = cmp_seg_endpts(seg);
-         typename Subcurve_traits_2::Construct_max_vertex_2 get_max_v =
-           geom_traits->construct_max_vertex_2_object();
-         typename Subcurve_traits_2::Construct_min_vertex_2 get_min_v =
-           geom_traits->construct_min_vertex_2_object();
-         typename Subcurve_traits_2::Equal_2 equal =
-           geom_traits->equal_2_object();
-         typename Subcurve_traits_2::Is_vertical_2 is_vertical =
-           geom_traits->is_vertical_2_object();
-
-         CGAL_precondition_msg((num_seg == 0) ||
-                               ((is_vertical(xcv[0]) && is_vertical(seg)) ||
-                                (!is_vertical(xcv[0]) && !is_vertical(seg))),
-                               "xcv is vertical and seg is not or vice versa!");
-
-         CGAL_precondition_msg((num_seg == 0) ||
-                               (cmp_seg_endpts(xcv[0]) == dir),
-                               "xcv and seg do not have the same orientation!");
-
-           CGAL_precondition_msg((num_seg == 0) ||
-                                 !equal(get_min_v(seg), get_max_v(seg)),
-                                 "Seg degenerates to a point!");
-
-           CGAL_precondition_msg((num_seg == 0) ||
-                                 (((dir != SMALLER) ||
-                                   equal(get_max_v(xcv[num_seg-1]),
-                                         get_min_v(seg)))),
-                                 "Seg does not connect to the right!");
-
-           CGAL_precondition_msg((num_seg == 0) ||
-                                 (((dir != LARGER) ||
-                                   equal(get_min_v(xcv[num_seg-1]),
-                                         get_max_v(seg)))),
-                                 "Seg does not connect to the left!");
-         ); // precondition code ends
-
-      xcv.push_back(seg);
-    }
-
-    // Boundary implementation
-    template<typename>
-    void push_back_2_impl(X_monotone_curve_2& xcv,
-                          const X_monotone_subcurve_2& seg,
-                          Arr_not_all_sides_oblivious_tag) const
-    {
-      CGAL_precondition_code
-        (
-         typedef typename X_monotone_curve_2::size_type size_type;
-         size_type num_seg = xcv.number_of_subcurves();
-         const Subcurve_traits_2* geom_traits =
-           m_poly_traits.subcurve_traits_2();
-         typename Subcurve_traits_2::Compare_endpoints_xy_2 cmp_seg_endpts =
-           geom_traits->compare_endpoints_xy_2_object();
-         Comparison_result dir = cmp_seg_endpts(seg);
-         typename Subcurve_traits_2::Construct_max_vertex_2 get_max_v =
-           geom_traits->construct_max_vertex_2_object();
-         typename Subcurve_traits_2::Construct_min_vertex_2 get_min_v =
-           geom_traits->construct_min_vertex_2_object();
-         typename Subcurve_traits_2::Equal_2 equal =
-           geom_traits->equal_2_object();
-         typename Subcurve_traits_2::Is_vertical_2 is_vertical =
-           geom_traits->is_vertical_2_object();
-         typename Subcurve_traits_2::Parameter_space_in_x_2 ps_x =
-           geom_traits->parameter_space_in_x_2_object();
-         typename Subcurve_traits_2::Parameter_space_in_y_2 ps_y =
-           geom_traits->parameter_space_in_y_2_object();
-
-         CGAL_precondition_msg((num_seg == 0) ||
-                               ((is_vertical(xcv[0]) && is_vertical(seg)) ||
-                                (!is_vertical(xcv[0]) && !is_vertical(seg))),
-                               "xcv is vertical and seg is not or vice versa!");
-
-         CGAL_precondition_msg((num_seg == 0) ||
-                               (cmp_seg_endpts(xcv[0]) == dir),
-                               "xcv and seg do not have the same orientation!");
-
-         const Arr_parameter_space min_x_seg = ps_x(seg, ARR_MIN_END);
-         const Arr_parameter_space min_y_seg = ps_y(seg, ARR_MIN_END);
-         const Arr_parameter_space max_x_seg = ps_x(seg, ARR_MAX_END);
-         const Arr_parameter_space max_y_seg = ps_y(seg, ARR_MAX_END);
-
-         CGAL_precondition_code(const Arr_parameter_space min_x_cv =
-                                ((num_seg>0) ?
-                                 ps_x(xcv[num_seg-1], ARR_MIN_END) :
-                                 ARR_INTERIOR));
-         CGAL_precondition_code(const Arr_parameter_space min_y_cv =
-                                ((num_seg>0) ?
-                                 ps_y(xcv[num_seg-1], ARR_MIN_END) :
-                                 ARR_INTERIOR));
-         CGAL_precondition_code(const Arr_parameter_space max_x_cv =
-                                ((num_seg>0) ?
-                                 ps_x(xcv[num_seg-1], ARR_MAX_END) :
-                                 ARR_INTERIOR));
-         CGAL_precondition_code(const Arr_parameter_space max_y_cv =
-                                ((num_seg>0) ?
-                                 ps_y(xcv[num_seg-1], ARR_MAX_END) :
-                                 ARR_INTERIOR));
-
-         // A subcurve should not be pushed if the polycurve is directed to
-         // the right and reaches the boundary.
-         CGAL_precondition_msg(((dir != SMALLER) ||
-                                ((max_x_cv == ARR_INTERIOR) &&
-                                 (max_y_cv == ARR_INTERIOR))),
-                               "Polycurve reaches the boundary to the right."
-                               "Can not push back any subcurve further." );
-
-         // A subcurve should not be pushed if the polycurve is directed to
-         // the left and reaches the boundary.
-         CGAL_precondition_msg(((dir != LARGER) ||
-                                ((min_x_cv == ARR_INTERIOR) &&
-                                 (min_y_cv == ARR_INTERIOR))),
-                               "Polycurve reaches the boundary to the left."
-                               "Can not push back any subcurve further." );
-
-         // Something like a line should not be pushed if there is already a
-         // subcurve present in the polycurve.
-         CGAL_precondition_msg((((min_x_seg == ARR_INTERIOR) &&
-                                 (min_y_seg == ARR_INTERIOR)) ||
-                                ((max_x_seg == ARR_INTERIOR) &&
-                                 (max_y_seg == ARR_INTERIOR)) ||
-                                (num_seg == 0) ),
-                               "Subcurve reaching the boundary at both ends "
-                               "can not be pushed if there is already one or "
-                               "more subcurves present in the polycurve.");
-
-         if ((min_x_seg == ARR_INTERIOR) && (min_y_seg == ARR_INTERIOR) &&
-             (max_x_seg == ARR_INTERIOR) && (max_y_seg == ARR_INTERIOR))
-         {
-           CGAL_precondition_msg((num_seg == 0) ||
-                                 !equal(get_min_v(seg), get_max_v(seg)),
-                                 "Seg degenerates to a point!");
-         }
-
-         if ((min_x_seg == ARR_INTERIOR) && (min_y_seg == ARR_INTERIOR)) {
-           CGAL_precondition_msg((num_seg == 0) ||
-                                 (((dir != SMALLER) ||
-                                   equal(get_max_v(xcv[num_seg-1]),
-                                         get_min_v(seg)))),
-                                 "Seg does not connect to the right!");
-         }
-
-         if ((max_x_seg == ARR_INTERIOR) && (max_y_seg == ARR_INTERIOR) ) {
-           CGAL_precondition_msg((num_seg == 0) ||
-                                 (((dir != LARGER) ||
-                                   equal(get_min_v(xcv[num_seg-1]),
-                                         get_max_v(seg)))),
-                                 "Seg does not connect to the left!");
-         }
-         ); // precondition code ends
-
-      xcv.push_back(seg);
-    }
-  };
-
-  /*! Obtain a Push_back_2 functor object. */
-  Push_back_2 push_back_2_object() const { return Push_back_2(*this); }
-
-  /* Functor to augment a polycurve by adding a subcurve at the front.
-   * TODO: Test all the operator()'s. (Don't forget vertical cases!)
-   */
-  class Push_front_2 {
-  protected:
-    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
-      Polycurve_basic_traits_2;
-
-    /*! The traits (in case it has state). */
-    const Polycurve_basic_traits_2& m_poly_traits;
-
-  public:
-    /*! Constructor. */
-    Push_front_2(const Polycurve_basic_traits_2& traits) :
-      m_poly_traits(traits)
-    {}
-
-    /* Append a subcurve `seg` to an existing polycurve `xcv` at the front. */
-    void operator()(X_monotone_curve_2& xcv, const X_monotone_subcurve_2& seg)
-      const
-    { push_front_2_impl<void*>(xcv, seg, Are_all_sides_oblivious_tag()); }
-
-  private:
-    // Oblivious implementation
-    template<typename>
-    void push_front_2_impl(X_monotone_curve_2& xcv,
-                           const X_monotone_subcurve_2& seg,
-                           Arr_all_sides_oblivious_tag)
-      const
-    {
-      CGAL_precondition_code
-        (
-         typedef typename X_monotone_curve_2::size_type size_type;
-         size_type num_seg = xcv.number_of_subcurves();
-         const Subcurve_traits_2* geom_traits =
-           m_poly_traits.subcurve_traits_2();
-         typename Subcurve_traits_2::Compare_endpoints_xy_2 cmp_seg_endpts =
-           geom_traits->compare_endpoints_xy_2_object();
-         Comparison_result dir = cmp_seg_endpts(seg);
-         typename Subcurve_traits_2::Construct_max_vertex_2 get_max_v =
-           geom_traits->construct_max_vertex_2_object();
-         typename Subcurve_traits_2::Construct_min_vertex_2 get_min_v =
-           geom_traits->construct_min_vertex_2_object();
-         typename Subcurve_traits_2::Equal_2 equal =
-           geom_traits->equal_2_object();
-         typename Subcurve_traits_2::Is_vertical_2 is_vertical =
-           geom_traits->is_vertical_2_object();
-
-         CGAL_precondition_msg((num_seg == 0) ||
-                               ((is_vertical(xcv[0]) && is_vertical(seg)) ||
-                                (!is_vertical(xcv[0]) && !is_vertical(seg))),
-                               "xcv is vertical and seg is not or vice versa!");
-
-         CGAL_precondition_msg((num_seg == 0) ||
-                               (cmp_seg_endpts(xcv[0]) == dir),
-                               "xcv and seg do not have the same orientation!");
-
-
-           CGAL_precondition_msg((num_seg == 0) ||
-                                 !equal(get_min_v(seg), get_max_v(seg)),
-                                 "Seg degenerates to a point!");
-           CGAL_precondition_msg((num_seg == 0) ||
-                                 (((dir != SMALLER) ||
-                                   equal(get_min_v(xcv[0]), get_max_v(seg)))),
-                                 "Seg does not connect to the left!");
-
-           CGAL_precondition_msg((num_seg == 0) ||
-                                 (((dir != LARGER) ||
-                                   equal(get_max_v(xcv[0]), get_min_v(seg)))),
-                                 "Seg does not connect to the right!");
-         ); // precondition code ends
-      xcv.push_front(seg);
-    }
-
-    // Boundary implementation
-    template<typename>
-    void push_front_2_impl(X_monotone_curve_2& xcv,
-                           const X_monotone_subcurve_2& seg,
-                           Arr_not_all_sides_oblivious_tag)
-      const
-    {
-      CGAL_precondition_code
-        (
-         typedef typename X_monotone_curve_2::size_type size_type;
-         size_type num_seg = xcv.number_of_subcurves();
-         const Subcurve_traits_2* geom_traits =
-           m_poly_traits.subcurve_traits_2();
-         typename Subcurve_traits_2::Compare_endpoints_xy_2 cmp_seg_endpts =
-           geom_traits->compare_endpoints_xy_2_object();
-         Comparison_result dir = cmp_seg_endpts(seg);
-         typename Subcurve_traits_2::Construct_max_vertex_2 get_max_v =
-           geom_traits->construct_max_vertex_2_object();
-         typename Subcurve_traits_2::Construct_min_vertex_2 get_min_v =
-           geom_traits->construct_min_vertex_2_object();
-         typename Subcurve_traits_2::Equal_2 equal =
-           geom_traits->equal_2_object();
-         typename Subcurve_traits_2::Parameter_space_in_x_2 ps_x =
-           geom_traits->parameter_space_in_x_2_object();
-         typename Subcurve_traits_2::Parameter_space_in_y_2 ps_y =
-           geom_traits->parameter_space_in_y_2_object();
-         typename Subcurve_traits_2::Is_vertical_2 is_vertical =
-           geom_traits->is_vertical_2_object();
-
-         CGAL_precondition_msg((num_seg == 0) ||
-                               ((is_vertical(xcv[0]) && is_vertical(seg)) ||
-                                (!is_vertical(xcv[0]) && !is_vertical(seg))),
-                               "xcv is vertical and seg is not or vice versa!");
-
-         CGAL_precondition_msg((num_seg == 0) ||
-                               (cmp_seg_endpts(xcv[0]) == dir),
-                               "xcv and seg do not have the same orientation!");
-
-         const Arr_parameter_space min_x_seg = ps_x(seg, ARR_MIN_END);
-         const Arr_parameter_space min_y_seg = ps_y(seg, ARR_MIN_END);
-         const Arr_parameter_space max_x_seg = ps_x(seg, ARR_MAX_END);
-         const Arr_parameter_space max_y_seg = ps_y(seg, ARR_MAX_END);
-
-         // Something like line should not be pushed if there is already a
-         // subcurve present in the polycurve.
-         CGAL_precondition_msg((((min_x_seg == ARR_INTERIOR) &&
-                                 (min_y_seg == ARR_INTERIOR)) ||
-                                ((max_x_seg == ARR_INTERIOR) &&
-                                 (max_y_seg == ARR_INTERIOR)) ||
-                                (num_seg == 0)),
-                               "Subcurve reaching the boundary at both ends"
-                               "can not be pushed if there is already one "
-                               "or more subcurves present in the polycurve.");
-
-         // Something like Ray should not be pushed front if there
-         // is already one or more subcurves present in polycurve.
-         CGAL_precondition_msg((((dir == SMALLER) &&
-                                 (max_x_seg == ARR_INTERIOR) &&
-                                 (max_y_seg == ARR_INTERIOR)) ||
-                                ((dir == LARGER) &&
-                                 (min_x_seg == ARR_INTERIOR) &&
-                                 (min_y_seg == ARR_INTERIOR)) ||
-                                (num_seg == 0)),
-                               "Subcurve reaching the boundary at the "
-                               "connecting end can not be pushed ");
-
-         if ((min_x_seg == ARR_INTERIOR) && (min_y_seg == ARR_INTERIOR) &&
-             (max_x_seg == ARR_INTERIOR) && (max_y_seg == ARR_INTERIOR))
-         {
-           CGAL_precondition_msg((num_seg == 0) ||
-                                 !equal(get_min_v(seg), get_max_v(seg)),
-                                 "Seg degenerates to a point!");
-         }
-
-         if ((max_x_seg == ARR_INTERIOR) && (max_y_seg == ARR_INTERIOR)) {
-           CGAL_precondition_msg((num_seg == 0) ||
-                                 (((dir != SMALLER) ||
-                                   equal(get_min_v(xcv[0]), get_max_v(seg)))),
-                                 "Seg does not connect to the left!");
-         }
-
-         if ((min_x_seg == ARR_INTERIOR) && (min_y_seg == ARR_INTERIOR)) {
-           CGAL_precondition_msg((num_seg == 0) ||
-                                 (((dir != LARGER) ||
-                                   equal(get_max_v(xcv[0]), get_min_v(seg)))),
-                                 "Seg does not connect to the right!");
-         }
-         ); // precondition code ends
-
-      xcv.push_front(seg);
-    }
-  };
-
-  /*! Obtain a Push_front_2 functor object. */
-  Push_front_2 push_front_2_object() const { return Push_front_2(*this); }
-
-  class Trim_2 {
-  protected:
-    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
-      Polycurve_basic_traits_2;
-
-    /* The polycurve traits (in case it has state). */
-    const Polycurve_basic_traits_2& m_poly_traits;
-
-    /*! \brief returns a trimmed version of the polycurve with src and tgt as
-     * end points.
-     */
-  public:
-    /*! Constructor. */
-    Trim_2(const Polycurve_basic_traits_2& traits) :
-      m_poly_traits(traits)
-    {}
-
-    X_monotone_curve_2 operator()(const X_monotone_curve_2& xcv,
-                                  const Point_2& src,
-                                  const Point_2& tgt)const
-    {
-      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
-      typename Subcurve_traits_2::Trim_2 trim = geom_traits->trim_2_object();
-
-      //check whether src and tgt lies on the polycurve/polycurve.
-      CGAL_precondition(m_poly_traits.compare_y_at_x_2_object()(src, xcv) ==
-                        EQUAL);
-      CGAL_precondition(m_poly_traits.compare_y_at_x_2_object()(tgt, xcv) ==
-                        EQUAL);
-
-      /* Check whether the source and the target conform with the
-       * direction of the polycurve.
-       * since the direction of the poly-line/curve should not be changed.
-       * we will interchange the source and the target.
-       */
-      Point_2 source = src;
-      Point_2 target = tgt;
-
-      // If curve is oriented from right to left but points are left to right.
-      if (m_poly_traits.compare_endpoints_xy_2_object()(xcv) == LARGER &&
-          m_poly_traits.compare_x_2_object()(src, tgt) == SMALLER )
-      {
-        source = tgt;
-        target = src;
-      }
-
-      /* If curve is oriented from left to right but points are from right
-       * to left.
-       */
-      else if (m_poly_traits.compare_endpoints_xy_2_object()(xcv) == SMALLER &&
-               m_poly_traits.compare_x_2_object()(src, tgt) == LARGER )
-      {
-        source = tgt;
-        target = src;
-      }
-
-      // std::cout << "**************the new sourc: " << source
-      //           << "the new target: " << target << std::endl;
-      /*
-       * Get the source and target subcurve numbers from the polycurve.
-       * The trimmed polycurve will have trimmed end subcurves(containing
-       * source and target) along with complete
-       * subcurves in between them.
-       */
-      std::size_t source_id = m_poly_traits.locate(xcv, source);
-      std::size_t target_id = m_poly_traits.locate(xcv, target);
-      // std::cout << "source number: " << source_id << "  Target number : "
-      //           << target_id << std::endl;
-      // std::cout << "target subcurve: " << xcv[target_id] << std::endl;
-
-      std::vector<X_monotone_subcurve_2> trimmed_subcurves;
-
-      Comparison_result orientation =
-        m_poly_traits.compare_endpoints_xy_2_object()(xcv);
-
-      Point_2 source_max_vertex =
-        geom_traits->construct_max_vertex_2_object()(xcv[source_id]);
-      Point_2 source_min_vertex =
-        geom_traits->construct_min_vertex_2_object()(xcv[source_id]);
-      Point_2 target_min_vertex =
-        geom_traits->construct_min_vertex_2_object()(xcv[target_id]);
-      Point_2 target_max_vertex =
-        geom_traits->construct_max_vertex_2_object()(xcv[target_id]);
-
-      //push the trimmed version of the source subcurve.
-      // if(sorientation == SMALLER && source != source_max_vertex)
-      if ((orientation == SMALLER) &&
-          ! geom_traits->equal_2_object()(source, source_max_vertex) )
-      {
-        if (source_id != target_id )
-          trimmed_subcurves.push_back(trim(xcv[source_id],
-                                           source, source_max_vertex));
-        else trimmed_subcurves.push_back(trim(xcv[source_id], source, target));
-      }
-      //else if(orientation == LARGER && source != source_min_vertex)
-      else if ((orientation == LARGER) &&
-               ! geom_traits->equal_2_object()(source, source_min_vertex))
-      {
-        if (source_id != target_id )
-          trimmed_subcurves.push_back(trim(xcv[source_id],
-                                          source, source_min_vertex));
-        else trimmed_subcurves.push_back(trim(xcv[source_id], source, target));
-      }
-
-      //push the middle subcurves as they are.
-      for (size_t i = source_id+1; i<target_id; ++i)
-        trimmed_subcurves.push_back(xcv[i] );
-
-      //push the appropriately trimmed target subcurve.
-      if (source_id != target_id) {
-        //if(orientation == SMALLER && target != target_min_vertex)
-        if ((orientation == SMALLER) &&
-            ! geom_traits->equal_2_object()(target, target_min_vertex))
-          trimmed_subcurves.push_back(trim(xcv[target_id],
-                                          target_min_vertex, target));
-
-        //else if (orientation == LARGER && target != target_max_vertex)
-        else if ((orientation == LARGER) &&
-                 ! geom_traits->equal_2_object()(target, target_max_vertex))
-          trimmed_subcurves.push_back(trim(xcv[target_id],
-                                          target_max_vertex, target));
-      }
-
-      return X_monotone_curve_2(trimmed_subcurves.begin(),
-                                trimmed_subcurves.end());
-    }
-  };
-
-  /*! Obtain a Trim_2 functor object. */
-  Trim_2 trim_2_object() const { return Trim_2(*this); }
-
-  ///@}
-
-protected:
-  /*
-   * Roadmap: locate() should return an iterator to the located subcurve
-   */
-
-  /*! Obtain the index of the subcurve in the polycurve that contains the
-   * point q in its x-range. The function performs a binary search, so if the
-   * point q is in the x-range of the polycurve with n subcurves, the subcurve
-   * containing it can be located in O(log n) operations.
-   * \param cv The polycurve curve.
-   * \param q The point.
-   * \return An index i such that q is in the x-range of cv[i].
-   *         If q is not in the x-range of cv, returns INVALID_INDEX.
-   */
-  template <typename Compare>
-  std::size_t locate_gen(const X_monotone_curve_2& cv, Compare compare) const
-  {
-    // The direction of cv. SMALLER means left-to-right and
-    // otherwise right-to-left
-    Comparison_result direction =
-      subcurve_traits_2()->compare_endpoints_xy_2_object()(cv[0]);
-    std::size_t from, to;
-    if (direction == SMALLER) {
-      from = 0;
-      to = cv.number_of_subcurves() - 1;
-    }
-    else {
-      from = cv.number_of_subcurves() - 1;
-      to = 0;
-    }
-
-    // Test if q is one of cv's end points
-    Comparison_result res_from = compare(cv[from], ARR_MIN_END);
-    if (res_from == EQUAL) return from;
-
-    Comparison_result res_to = compare(cv[to], ARR_MAX_END);
-    if (res_to == EQUAL) return to;
-
-    if (res_to == res_from) return INVALID_INDEX;
-
-    // Perform a binary search to locate the subcurve that contains q in its
-    // range:
-    while (((direction == SMALLER) && (to > from)) ||
-           ((direction == LARGER) && (to < from)))
-    {
-      std::size_t mid = (from + to) / 2;
-      if (((direction == SMALLER) && (mid > from)) ||
-          ((direction == LARGER) && (mid < from)))
-      {
-        Comparison_result res_mid = compare(cv[mid], ARR_MIN_END);
-        if (res_mid == EQUAL) {
-          // Ensure that the returned subcurve contains the query point
-          // on its right end (if possible)
-          if ((direction == SMALLER) && (mid > 0)) --mid;
-          else if ((direction == LARGER) &&
-                   ((mid + 1) < cv.number_of_subcurves()))
-            ++mid;
-          return mid;
-        }
-        if (res_mid == res_from) from = mid;
-        else to = (direction == SMALLER) ? mid - 1 : mid + 1;
-      }
-      else {
-        CGAL_assertion(((direction == SMALLER) && (mid < to)) ||
-                       ((direction == LARGER) && (mid > to)));
-        Comparison_result res_mid = compare(cv[mid], ARR_MAX_END);
-        if (res_mid == EQUAL) return mid;
-        if (res_mid == res_to) to = mid;
-        else from = (direction == SMALLER) ? mid + 1 : mid - 1;
-      }
-    }
-    // In case (from == to), and we know that the polycurve contains the q:
-    CGAL_assertion(from == to);
-    return from;
-  }
-
-  // A utility class that compare a curve-end with a point.
-  template <typename Comparer>
-  class Compare_points {
-  private:
-    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
-      Polycurve_basic_traits_2;
-
-    /*! The polycurve traits (in case it has state). */
-    const Polycurve_basic_traits_2& m_poly_traits;
-
-    const Point_2& m_point;
-
-    Comparer m_compare;
-
-  public:
-    // Constructor
-    Compare_points(const Polycurve_basic_traits_2& traits, Comparer compare,
-                   const Point_2& p) :
-      m_poly_traits(traits),
-      m_point(p),
-      m_compare(compare)
-    {}
-
-    // Compare the given curve-end with the stored point.
-    Comparison_result operator()(const X_monotone_subcurve_2& xs,
-                                 Arr_curve_end ce)
-    {
-      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
-      const Point_2& p = (ce == ARR_MAX_END) ?
-        geom_traits->construct_max_vertex_2_object()(xs) :
-        geom_traits->construct_min_vertex_2_object()(xs);
-      return m_compare(p, m_point);
-    }
-  };
-
-  // A utility class that compares two curve-ends.
-  template <typename Comparer>
-  class Compare_point_curve_end {
-  private:
-    const Point_2& m_point;
-
-    Comparer m_compare;
-
-  public:
-    // Constructor
-    Compare_point_curve_end(Comparer compare, const Point_2& p) :
-      m_point(p),
-      m_compare(compare)
-    {}
-
-    // Compare a given curve-end with the stored point.
-    Comparison_result operator()(const X_monotone_subcurve_2& xs,
-                                 Arr_curve_end ce)
-    { return m_compare(xs, ce, m_point); }
-  };
-
-  // A utility class that compare two curve-ends.
-  template <typename Comparer>
-  class Compare_curve_ends {
-  private:
-    const X_monotone_subcurve_2& m_x_monotone_subcurve;
-
-    Arr_curve_end m_curve_end;
-
-    Comparer m_compare;
-
-  public:
-    // Constructor
-    Compare_curve_ends(Comparer compare,
-                       const X_monotone_subcurve_2& xs, Arr_curve_end ce) :
-      m_x_monotone_subcurve(xs),
-      m_curve_end(ce),
-      m_compare(compare)
-    {}
-
-    // Compare the given curve-end with the stored curve end.
-    Comparison_result operator()(const X_monotone_subcurve_2& xs,
-                                 Arr_curve_end ce)
-    { return m_compare(xs, ce, m_x_monotone_subcurve, m_curve_end); }
-  };
-
-  /*! Locate the index of a curve in a polycurve that contains an endpoint
-   * of a curve.
-   * This implementation is used in the case where at least one side of the
-   * parameter space is not oblivious.
-   * \param xcv (in) the given polycurve.
-   * \param xs (in) the given curve.
-   * \param cd (in) the curve-end indicator.
-   */
-  std::size_t locate_impl(const X_monotone_curve_2& xcv,
-                          const X_monotone_subcurve_2& xs,
-                          Arr_curve_end ce,
-                          Arr_not_all_sides_oblivious_tag) const
-  {
-    const Subcurve_traits_2* geom_traits = subcurve_traits_2();
-    if (geom_traits->is_vertical_2_object()(xcv[0])) {
-      // Verify that q has the same x-coord as xcv (which is vertical)
-      Compare_x_2 compare_x = compare_x_2_object();
-      Comparison_result res = compare_x(xcv[0], ARR_MIN_END, xs, ce);
-      if (res != EQUAL) return INVALID_INDEX;
-
-      Compare_curve_ends<Compare_xy_2> compare(compare_xy_2_object(), xs, ce);
-      return locate_gen(xcv, compare);
-    }
-
-    Compare_curve_ends<Compare_x_2> compare(compare_x_2_object(), xs, ce);
-    return locate_gen(xcv, compare);
-  }
-
-  /*! Locate the index of a curve in a polycurve that contains an endpoint
-   * of a curve.
-   * This implementation is used in the case where all sides of the parameter
-   * space is oblivious.
-   * \param xcv (in) the given polycurve.
-   * \param xs (in) the given curve.
-   * \param cd (in) the curve-end indicator.
-   */
-  std::size_t locate_impl(const X_monotone_curve_2& xcv,
-                          const X_monotone_subcurve_2& xs,
-                          Arr_curve_end ce,
-                          Arr_all_sides_oblivious_tag) const
-  {
-    const Subcurve_traits_2* geom_traits = subcurve_traits_2();
-    const Point_2& p = (ce == ARR_MAX_END) ?
-      geom_traits->construct_max_vertex_2_object()(xs) :
-      geom_traits->construct_min_vertex_2_object()(xs);
-    return locate(xcv, p);
-  }
-
-  /*! Locate the index of a curve in a polycurve that contains an endpoint
-   * of a curve.
-   * This implementation is used in the case where at least one side of the
-   * parameter space is not oblivious.
-   * \param xcv (in) the given polycurve.
-   * \param p (in) the endpoint of a curve.
-   */
-  std::size_t locate_impl(const X_monotone_curve_2& xcv,
-                          const Point_2& p,
-                          Arr_not_all_sides_oblivious_tag) const
-  {
-    const Subcurve_traits_2* geom_traits = subcurve_traits_2();
-    if (geom_traits->is_vertical_2_object()(xcv[0])) {
-      // Verify that q has the same x-coord as xcv (which is vertical)
-      Compare_x_2 compare_x = compare_x_2_object();
-      Comparison_result res = compare_x(xcv[0], ARR_MIN_END, p);
-      if (res != EQUAL) return INVALID_INDEX;
-
-      Compare_point_curve_end<Compare_xy_2> compare(compare_xy_2_object(), p);
-      return locate_gen(xcv, compare);
-    }
-
-    Compare_point_curve_end<Compare_x_2> compare(compare_x_2_object(), p);
-    return locate_gen(xcv, compare);
-  }
-
-  /*! Locate the index of a curve in a polycurve that contains an endpoint
-   * of a curve.
-   * This implementation is used in the case where all sides of the parameter
-   * space is oblivious.
-   * \param xcv (in) the given polycurve.
-   * \param p (in) the endpoint of a curve.
-   */
-  std::size_t locate_impl(const X_monotone_curve_2& xcv, const Point_2& p,
-                          Arr_all_sides_oblivious_tag) const
-  { return locate(xcv, p); }
-
-  //
-  std::size_t locate(const X_monotone_curve_2& xcv, const Point_2& q) const
-  {
-    const Subcurve_traits_2* geom_traits = subcurve_traits_2();
-    if (geom_traits->is_vertical_2_object()(xcv[0])) {
-      // Verify that q has the same x-coord as cv (which is vertical)
-      typename Subcurve_traits_2::Construct_min_vertex_2 min_vertex =
-        geom_traits->construct_min_vertex_2_object();
-      typename Subcurve_traits_2::Compare_x_2 compare_x =
-        geom_traits->compare_x_2_object();
-      Comparison_result res = compare_x(min_vertex(xcv[0]), q);
-      if (res != EQUAL) return INVALID_INDEX;
-
-      Compare_points<Compare_xy_2> compare(geom_traits,
-                                           compare_xy_2_object(), q);
-      return locate_gen(xcv, compare);
-    }
-
-    Compare_points<Compare_x_2> compare(geom_traits, compare_x_2_object(), q);
-    return locate_gen(xcv, compare);
-  }
-
-  /*! Find the index of the subcurve in the polycurve that is defined to the
-   * left(or to the right) of the point q.
-   * \param cv The polycurve curve.
-   * \param q The point.
-   * \param to_right(true) if we wish to locate a subcurve to the right of q,
-   *               (false) if we wish to locate a subcurve to its right.
-   * \return An index i such that subcurves[i] is defined to the left(or to the
-   *         right) of q, or INVALID_INDEX if no such subcurve exists.
-   */
-  std::size_t locate_side(const X_monotone_curve_2& cv,
-                          const Point_2& q, const bool& to_right) const
-  {
-    // First locate a subcurve subcurves[i] that contains q in its x-range.
-    std::size_t i = locate(cv, q);
-    if (i == INVALID_INDEX) return INVALID_INDEX;
-
-    typename Subcurve_traits_2::Equal_2 equal =
-      subcurve_traits_2()->equal_2_object();
-    typename Subcurve_traits_2::Compare_endpoints_xy_2 cmp_seg_endpts =
-      subcurve_traits_2()->compare_endpoints_xy_2_object();
-    typename Subcurve_traits_2::Compare_x_2 comp_x =
-      subcurve_traits_2()->compare_x_2_object();
-    typename Subcurve_traits_2::Is_vertical_2 is_vert =
-      subcurve_traits_2()->is_vertical_2_object();
-    typename Subcurve_traits_2::Construct_max_vertex_2 get_max_v =
-      subcurve_traits_2()->construct_max_vertex_2_object();
-    typename Subcurve_traits_2::Construct_min_vertex_2 get_min_v =
-      subcurve_traits_2()->construct_min_vertex_2_object();
-
-    Comparison_result direction = cmp_seg_endpts(cv[i]);
-
-    if ((!is_vert(cv[0]) && (comp_x(get_min_v(cv[i]), q) == EQUAL)) ||
-        (is_vert(cv[0]) && equal(get_min_v(cv[i]), q))){
-      // q is the left endpoint of the i'th subcurve:
-      if (to_right) return i;
-      else {
-        // to_left
-        if (direction == SMALLER) {
-          if (i == 0) return INVALID_INDEX;
-          else return i - 1;
-        }
-        else {
-          if (i == cv.number_of_subcurves()-1) return INVALID_INDEX;
-          else return i+1;
-        }
-      }
-    }
-
-    if ((!is_vert(cv[0]) && (comp_x(get_max_v(cv[i]), q) == EQUAL)) ||
-        (is_vert(cv[0]) && equal(get_max_v(cv[i]), q)))
-    {
-      // q is the right endpoint of the i'th subcurve:
-      if (!to_right) return i;
-      else {
-        if (direction == SMALLER) {
-          if (i == (cv.number_of_subcurves() - 1)) return INVALID_INDEX;
-          else return i + 1;
-        }
-        else {
-          if (i == 0) return INVALID_INDEX;
-          else return i-1;
-        }
-      }
-    }
-
-    // In case q is in cv[i]'s interior:
-    return i;
-  }
-};
-
-} //namespace CGAL
-
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_polyline_traits_2.h b/3rdparty/CGAL-4.8/include/CGAL/Arr_polyline_traits_2.h
deleted file mode 100644
index d491668..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Arr_polyline_traits_2.h
+++ /dev/null
@@ -1,600 +0,0 @@
-// Copyright (c) 2000-2014
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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.
-//
-// Author(s)     : Waqar Khan <wkhan at mpi-inf.mpg.de>
-
-#ifndef CGAL_ARR_POLYLINE_TRAITS_2_H
-#define CGAL_ARR_POLYLINE_TRAITS_2_H
-
-/*! \file
- * The traits-class for the linear piece-wiese(polyline) type of curves of the
- * arrangement package.
- */
-
-#include <list>
-#include <iterator>
-#include <boost/type_traits/is_same.hpp>
-#include <boost/utility/enable_if.hpp>
-
-#include <CGAL/basic.h>
-#include <CGAL/tags.h>
-#include <CGAL/Arr_segment_traits_2.h>
-#include <CGAL/Arr_polycurve_traits_2.h>
-#include <CGAL/Arr_tags.h>
-#include <CGAL/Arr_enums.h>
-
-namespace CGAL {
-
-// If no template instantiation is provided, it will be instantiated
-// with Arr_segment_traits.
-template <typename SegmentTraits_2 = Arr_segment_traits_2<> >
-class Arr_polyline_traits_2 : public Arr_polycurve_traits_2<SegmentTraits_2> {
-public:
-  typedef SegmentTraits_2                             Segment_traits_2;
-
-private:
-  typedef Arr_polyline_traits_2<Segment_traits_2>     Self;
-  typedef Arr_polycurve_traits_2<Segment_traits_2>    Base;
-
-public:
-  /// \name Types inherited from the polycurve traits class.
-  //@{
-
-  // Tag definitions:
-  typedef typename Base::Has_left_category            Has_left_category;
-  typedef typename Base::Has_merge_category           Has_merge_category;
-  typedef typename Base::Has_do_intersect_category
-    Has_do_intersect_category;
-
-  typedef typename Base::Left_side_category           Left_side_category;
-  typedef typename Base::Bottom_side_category         Bottom_side_category;
-  typedef typename Base::Top_side_category            Top_side_category;
-  typedef typename Base::Right_side_category          Right_side_category;
-
-  typedef typename Base::Are_all_sides_oblivious_tag
-    Are_all_sides_oblivious_tag;
-
-  typedef typename Base::X_monotone_subcurve_2         X_monotone_subcurve_2;
-  typedef typename Base::Subcurve_2                   Subcurve_2;
-
-  typedef typename Base::Point_2                      Point_2;
-  typedef typename Base::Curve_2                      Curve_2;
-  typedef typename Base::X_monotone_curve_2           X_monotone_curve_2;
-
-  typedef typename Base::Multiplicity                 Multiplicity;
-
-  typedef typename Base::Compare_x_2                  Compare_x_2;
-  typedef typename Base::Compare_xy_2                 Compare_xy_2;
-  typedef typename Base::Construct_min_vertex_2       Construct_min_vertex_2;
-  typedef typename Base::Construct_max_vertex_2       Construct_max_vertex_2;
-  typedef typename Base::Is_vertical_2                Is_vertical_2;
-  typedef typename Base::Compare_y_at_x_2             Compare_y_at_x_2;
-  typedef typename Base::Compare_y_at_x_left_2        Compare_y_at_x_left_2;
-  typedef typename Base::Compare_y_at_x_right_2       Compare_y_at_x_right_2;
-  typedef typename Base::Equal_2                      Equal_2;
-  typedef typename Base::Compare_endpoints_xy_2       Compare_endpoints_xy_2;
-  typedef typename Base::Construct_opposite_2         Construct_opposite_2;
-  typedef typename Base::Approximate_2                Approximate_2;
-  typedef typename Base::Parameter_space_in_x_2       Parameter_space_in_x_2;
-  typedef typename Base::Parameter_space_in_y_2       Parameter_space_in_y_2;
-  typedef typename Base::Compare_x_on_boundary_2      Compare_x_on_boundary_2;
-  typedef typename Base::Compare_x_at_limit_2         Compare_x_at_limit_2;
-  typedef typename Base::Compare_x_near_limit_2       Compare_x_near_limit_2;
-  typedef typename Base::Compare_y_on_boundary_2      Compare_y_on_boundary_2;
-  typedef typename Base::Compare_y_near_boundary_2    Compare_y_near_boundary_2;
-  typedef typename Base::Is_on_y_identification_2     Is_on_y_identification_2;
-  typedef typename Base::Is_on_x_identification_2     Is_on_x_identification_2;
-
-  typedef typename Base::Split_2                      Split_2;
-  typedef typename Base::Intersect_2                  Intersect_2;
-  typedef typename Base::Are_mergeable_2              Are_mergeable_2;
-  typedef typename Base::Merge_2                      Merge_2;
-
-  typedef typename Base::Number_of_points_2           Number_of_points_2;
-  typedef typename Base::Trim_2                       Trim_2;
-
-  //@}
-
-public:
-  /*! Construct default. */
-  Arr_polyline_traits_2() : Base() {}
-
-  /*! Construct from a segment traits
-   * \param geom_traits an already existing segment tarits which is passed will
-   *        be used by the class.
-   */
-  Arr_polyline_traits_2(const Segment_traits_2* geom_traits) :
-    Base(geom_traits)
-  {}
-
-  /// \name Types and functors defined here.
-  //@{
-
-  /* Functor to augment a polyline by either adding a vertex or a segment
-   * at the back.
-   */
-  class Push_back_2 : public Base::Push_back_2 {
-  protected:
-    typedef Arr_polyline_traits_2<SegmentTraits_2>     Polyline_traits_2;
-
-  public:
-    /*! Constructor. */
-    Push_back_2(const Polyline_traits_2& traits) :
-      Base::Push_back_2(traits)
-    {}
-
-    // Normally, the moment the compiler finds a name, it stops looking. In
-    // other words, the compiler first finds the operator() in the current
-    // class and stops looking, never finding the one in the base class.
-    // Explicitly bring the base operator() into scope, unnecesitating the
-    // code below.
-    using Base::Push_back_2::operator();
-
-    // /*! Append a segment `seg` to an existing polyline `cv` at the back. */
-    // void operator()(Curve_2& cv, const Segment_2& seg) const
-    // { Base::Push_back_2::operator() (cv, seg); }
-
-    // /* Append a segment `seg` to an existing polyline `xcv` at the back. */
-    // void operator()(X_monotone_curve_2& xcv,
-    //                 const X_monotone_subcurve_2& seg) const
-    // { Base::Push_back_2::operator()(xcv, seg); }
-
-    /* Append a point `p` to an existing polyline `cv` at the back. */
-    void operator()(Curve_2& cv, const Point_2& p) const
-    {
-      typedef typename Curve_2::size_type size_type;
-      size_type num_seg = cv.number_of_subcurves();
-      CGAL_precondition(num_seg > 0);
-      int last_seg = num_seg-1;
-
-      const Segment_traits_2* seg_traits =
-        this->m_poly_traits.subcurve_traits_2();
-      typename Segment_traits_2::Compare_endpoints_xy_2 cmp_seg_endpts =
-        seg_traits->compare_endpoints_xy_2_object();
-
-      /* Since it is desired to maintain `cv` well-oriented, we have
-       * to append the segment [cv[last_seg].target(),p]. The
-       * following test determines which end of the last segment is
-       * the target, i.e. the actual end of `cv`.
-       */
-      if (cmp_seg_endpts(cv[last_seg]) == SMALLER) {
-        typename Segment_traits_2::Construct_max_vertex_2 get_max_v =
-          seg_traits->construct_max_vertex_2_object();
-        cv.push_back(Subcurve_2(get_max_v(cv[last_seg]), p));
-      }
-      else {
-        typename Segment_traits_2::Construct_min_vertex_2 get_min_v =
-          seg_traits->construct_min_vertex_2_object();
-        cv.push_back(Subcurve_2(get_min_v(cv[last_seg]), p));
-      }
-    }
-
-    /* Append a point `p` to an existing polyline `xcv` at the back. */
-    void operator()(X_monotone_curve_2& xcv, const Point_2& p) const
-    {
-      typedef typename X_monotone_curve_2::size_type size_type;
-      size_type num_seg = xcv.number_of_subcurves();
-      CGAL_precondition(num_seg > 0);
-
-      const Segment_traits_2* seg_traits =
-        this->m_poly_traits.subcurves_traits_2();
-      CGAL_precondition_code
-        (
-         typename Segment_traits_2::Compare_x_2 comp_x =
-           seg_traits->compare_x_2_object();
-         typename Segment_traits_2::Compare_xy_2 comp_xy =
-           seg_traits->compare_xy_2_object();
-         typename Base::Is_vertical_2 is_vertical =
-           this->m_poly_traits.is_vertical_2_object();
-         );
-
-      if (seg_traits->compare_endpoints_xy_2_object()(xcv[0]) == SMALLER) {
-        // xcv is oriented left-to-right
-        typename Segment_traits_2::Construct_max_vertex_2 get_max_v =
-          seg_traits->construct_max_vertex_2_object();
-        CGAL_precondition
-          (
-           (!is_vertical(xcv) &&
-            (comp_x(get_max_v(xcv[num_seg-1]), p) == SMALLER)) ||
-           (is_vertical(xcv) &&
-            (comp_x(get_max_v(xcv[num_seg-1]), p) == EQUAL) &&
-            (comp_xy(get_max_v(xcv[num_seg-1]), p) == SMALLER))
-           );
-        xcv.push_back(X_monotone_subcurve_2(get_max_v(xcv[num_seg-1]), p));
-      }
-      else {
-        // xcv is oriented right-to-left
-        typename Segment_traits_2::Construct_min_vertex_2 get_min_v =
-          seg_traits->construct_min_vertex_2_object();
-        CGAL_precondition
-          (
-           (!is_vertical(xcv) &&
-            (comp_x(get_min_v(xcv[num_seg-1]), p) == LARGER)) ||
-           (is_vertical(xcv) &&
-            (comp_x(get_min_v(xcv[num_seg-1]), p) == EQUAL) &&
-            (comp_xy(get_min_v(xcv[num_seg-1]), p) == LARGER))
-           );
-        xcv.push_back(X_monotone_subcurve_2(get_min_v(xcv[num_seg-1]), p));
-      }
-    }
-  };
-
-  /*! Obtain a Push_back_2 functor object. */
-  Push_back_2 push_back_2_object() const { return Push_back_2(*this); }
-
-  /* Functor to augment a polyline by either adding a vertex or a segment
-   * at the front.
-   * TODO: Test all the operator()'s. (Don't forget vertical cases!)
-   */
-  class Push_front_2 : public Base::Push_front_2 {
-  protected:
-    typedef Arr_polyline_traits_2<SegmentTraits_2>     Polyline_traits_2;
-
-  public:
-    /*! Constructor. */
-    Push_front_2(const Polyline_traits_2& traits) :
-      Base::Push_front_2(traits)
-    {}
-
-    // Normally, the moment the compiler finds a name, it stops looking. In
-    // other words, the compiler first finds the operator() in the current
-    // class and stops looking, never finding the one in the base class.
-    // Explicitly bring the base operator() into scope, unnecesitating the
-    // code below.
-    using Base::Push_front_2::operator();
-
-    // /*! Append a segment `seg` to an existing polyline `cv` at the front. */
-    // void operator()(Curve_2& cv, const Subcurve_2& seg) const
-    // { Base::Push_front_2::operator()(cv, seg); }
-
-    // /*! Append a segment `seg` to an existing polyline `xcv` at the front. */
-    // void operator()(X_monotone_curve_2& xcv,
-    //                 const X_monotone_subcurve_2& seg) const
-    // { Base::Push_front_2::operator()(xcv, seg); }
-
-    /* Append a point `p` to an existing polyline `cv` at the front. */
-    void operator()(Curve_2& cv, const Point_2& p) const
-    {
-      CGAL_precondition_code
-        (
-         typedef typename Curve_2::size_type size_type;
-         size_type num_seg = cv.number_of_subcurves();
-         );
-      CGAL_precondition(num_seg > 0);
-
-      const Segment_traits_2* geom_traits =
-        this->m_poly_traits.subcurve_traits_2();
-      typename Segment_traits_2::Compare_endpoints_xy_2 cmp_seg_endpts =
-        geom_traits->compare_endpoints_xy_2_object();
-
-      if (cmp_seg_endpts(cv[0]) == SMALLER) {
-        typename Segment_traits_2::Construct_min_vertex_2 get_min_v =
-          geom_traits->construct_min_vertex_2_object();
-        cv.push_front(Subcurve_2(p, get_min_v(cv[0])));
-      }
-      else {
-        typename Segment_traits_2::Construct_max_vertex_2 get_max_v =
-          geom_traits->construct_max_vertex_2_object();
-        cv.push_front(Subcurve_2(p, get_max_v(cv[0])));
-      }
-    }
-
-    /*! Append a point `p` to an existing polyline `xcv` at the front. */
-    void operator()(const X_monotone_curve_2& xcv, Point_2& p) const
-    {
-      const SegmentTraits_2* geom_traits =
-        this->m_poly_traits.subcurve_traits_2();
-      CGAL_precondition_code
-        (
-         typedef typename X_monotone_curve_2::size_type size_type;
-         size_type num_seg = xcv.number_of_subcurves();
-         typename Segment_traits_2::Compare_x_2 comp_x =
-         geom_traits->compare_x_2_object();
-         typename Segment_traits_2::Compare_xy_2 comp_xy =
-         geom_traits->compare_xy_2_object();
-         typename Base::Is_vertical_2 is_vertical =
-           this->m_poly_traits.is_vertical_2_object();
-         );
-      CGAL_precondition(num_seg > 0);
-
-      if (geom_traits->compare_endpoints_xy_2_object()(xcv[0]) == SMALLER) {
-        // xcv is oriented left-to-right
-        typename Segment_traits_2::Construct_max_vertex_2 get_max_v =
-          geom_traits->construct_max_vertex_2_object();
-        CGAL_precondition
-          (
-           (!is_vertical(xcv) &&
-            (comp_x(get_max_v(xcv[0]), p) == LARGER)) ||
-           (is_vertical(xcv) &&
-            (comp_x(get_max_v(xcv[0]), p) == EQUAL) &&
-            (comp_xy(get_max_v(xcv[0]), p) == LARGER))
-           );
-        xcv.push_front(X_monotone_subcurve_2(p, get_max_v(xcv[0])));
-      }
-      else {
-        // xcv is oriented right-to-left
-        typename Segment_traits_2::Construct_min_vertex_2 get_min_v =
-          geom_traits->construct_min_vertex_2_object();
-        CGAL_precondition
-          (
-           (!is_vertical(xcv) &&
-            (comp_x(get_min_v(xcv[0]), p) == SMALLER)) ||
-           (is_vertical(xcv) &&
-            (comp_x(get_min_v(xcv[0]), p) == EQUAL) &&
-            (comp_xy(get_min_v(xcv[0]), p) == SMALLER))
-           );
-        xcv.push_front(X_monotone_subcurve_2(p, get_min_v(xcv[0])));
-      }
-    }
-  };
-
-  /*! Obtain a Push_front_2 functor object. */
-  Push_front_2 push_front_2_object() const { return Push_front_2(*this); }
-
-  /*! Construct a general curve. */
-  class Construct_curve_2 : public Base::Construct_curve_2 {
-  protected:
-    typedef Arr_polyline_traits_2<Segment_traits_2>         Polyline_traits_2;
-
-  public:
-    /*! Constructor.
-     */
-    Construct_curve_2(const Polyline_traits_2& traits) :
-      Base::Construct_curve_2(traits)
-    {}
-
-    /* Obtain an polyline connecting two given endpoints.
-     */
-    Curve_2 operator()(const Point_2& p, const Point_2& q) const
-    { return Curve_2(Subcurve_2(p, q)); }
-
-    /* Obtain a polyline consists of one given segment.
-     */
-    Curve_2 operator()(const Subcurve_2& seg) const
-    { return Base::Construct_curve_2::operator()(seg); }
-
-    /* Construct a well-oriented polyline from a range of either
-     * `Segment_traits::Point_2` or `Segment_traits::Subcurve_2`.
-     */
-    template <typename ForwardIterator>
-    Curve_2 operator()(ForwardIterator begin, ForwardIterator end) const
-    {
-      typedef typename std::iterator_traits<ForwardIterator>::value_type VT;
-      typedef typename boost::is_same<VT, Point_2>::type Is_point;
-      // Dispatch the range to the appropriate implementation.
-      return constructor_impl(begin, end, Is_point());
-    }
-
-    /*! Construction implementation from a range of segments.
-     *  Note that the segments in the range are NOT necessarily x-monotone,
-     *  thus it is impossible to test (even in precondition) whether the input
-     *  forms a continuous and well oriented polyline.
-     *  \pre Range should contain at least one segment.
-     */
-    template <typename ForwardIterator>
-    Curve_2 constructor_impl(ForwardIterator begin, ForwardIterator end,
-                             boost::false_type) const
-    { return Base::Construct_curve_2::operator()(begin, end); }
-
-    /*! Construction of a polyline from a range of points.
-     * \pre The range contains at least two points
-     * \pre Consecutive points are disjoint.
-     * \return Well-oriented polyline connecting the given points. The order
-     *         of the vertices is determined by their order in the range.
-     *         Furthermore, the orientation of the polyline is induced by
-     *         their order.
-     */
-    template <typename ForwardIterator>
-    Curve_2 constructor_impl(ForwardIterator begin, ForwardIterator end,
-                             boost::true_type) const
-    {
-      // The range must contain at least two points.
-      CGAL_precondition_msg(std::distance(begin, end) > 1,
-                            "Range of points must contain at least 2 points");
-
-      // Container of the segments to be constructed from the range of points
-      std::list<Subcurve_2> segs;
-
-      CGAL_precondition_code
-        (
-         typename Segment_traits_2::Equal_2 equal =
-         this->m_poly_traits.subcurve_traits_2()->equal_2_object();
-         );
-
-      // Check whether there are no points in the range:
-      ForwardIterator next = begin;
-      ForwardIterator curr = next++;
-
-      // Construct a segment from each two adjacent points.
-      Curve_2 cv;
-      while (next != end) {
-        CGAL_precondition_msg(!equal(*curr,*next),
-                              "Cannot construct a degenerated segment");
-        segs.push_back(Subcurve_2(*curr, *next));
-        curr = next++;
-      }
-
-      return operator()(segs.begin(), segs.end());
-    }
-  };
-
-  /*! Obtain a Construct_curve_2 functor object. */
-  Construct_curve_2 construct_curve_2_object() const
-  { return Construct_curve_2(*this); }
-
-  /*! Construct an x-monotone curve. */
-  class Construct_x_monotone_curve_2 :
-    public Base::Construct_x_monotone_curve_2
-  {
-  protected:
-    typedef Arr_polyline_traits_2<Segment_traits_2>     Polyline_traits_2;
-
-  public:
-    /*! Constructor.
-     */
-    Construct_x_monotone_curve_2(const Polyline_traits_2& traits) :
-      Base::Construct_x_monotone_curve_2(traits)
-    {}
-
-    /*! Obtain an x-monotone polyline connecting two given endpoints.
-     * \param p The first point.
-     * \param q The second point.
-     * \pre p and q must not be the same.
-     * \return A segment connecting p and q.
-     */
-    X_monotone_curve_2 operator()(const Point_2& p, const Point_2& q) const
-    {
-      CGAL_precondition_msg
-        (!this->m_poly_traits.subcurve_traits_2()->equal_2_object()(p,q),
-         "Cannot construct a degenerated segment as a polyline");
-      X_monotone_subcurve_2 seg =  this->m_poly_traits.subcurve_traits_2()->
-        construct_x_monotone_curve_2_object()(p, q);
-
-#ifdef CGAL_ALWAYS_LEFT_TO_RIGHT
-      if (this->m_poly_traits.subcurve_traits_2()->compare_xy_2_object()(p,q) ==
-          LARGER)
-        seg = m_poly_traits.subcurve_traits_2()->
-          construct_opposite_2_object()(seg);
-#endif
-
-      return X_monotone_curve_2(seg);
-    }
-
-    /*! Obtain an x-monotone polyline that consists of one given segment.
-     * \param seg input segment.
-     * \pre seg is not degenerated.
-     * \return An x-monotone polyline with one segment.
-     */
-    X_monotone_curve_2 operator()(const X_monotone_subcurve_2& seg) const
-    { return Base::Construct_x_monotone_curve_2::operator()(seg); }
-
-    /*! Construct an x-monotone polyline from a range of elements.
-     * \pre Range should from a continuous well-oriented x-monotone polyline.
-     */
-    template <typename ForwardIterator>
-    X_monotone_curve_2 operator()(ForwardIterator begin, ForwardIterator end)
-      const
-    {
-      typedef typename std::iterator_traits<ForwardIterator>::value_type VT;
-      typedef typename boost::is_same<VT, Point_2>::type Is_point;
-      // Dispatch the range to the appropriate implementation.
-      return constructor_impl(begin, end, Is_point());
-    }
-
-    /*! Construction implementation from a range of segments.
-     * \param begin An iterator pointing to the first segment in the range.
-     * \param end An iterator pointing to the past-the-end segment
-     * in the range.
-     * \pre The range contains at least one segment.
-     * \pre Segments correspond to a well-oriented polyline. That
-     *      is, the target of the i-th segment is an source of the
-     *      (i+1)th segment.
-     * \pre The sequence of segments in the range forms a weak x-monotone
-     *      polyline.
-     * \pre The container should support bidirectional iteration.
-     * \return A continuous, well-oriented x-monotone polyline which
-     *         is directed either left-to-right or right-to-left
-     *         depending on the segments in the input.
-     */
-    template <typename ForwardIterator>
-    X_monotone_curve_2 constructor_impl(ForwardIterator begin,
-                                        ForwardIterator end,
-                                        boost::false_type) const
-    { return Base::Construct_x_monotone_curve_2::operator()(begin, end); }
-
-    /*! Construction of an x-monotone polyline from a range of points.
-     * The polyline may be oriented left-to-right or right-to-left
-     * depending on the lexicographical order of the points in the
-     * input.
-     * \pre Range contains at least two points.
-     * \pre No two consecutive points are the same.
-     * \pre The points form an continuous well-oriented x-monotone polyline.
-     * \post By the construction the returned polyline is well-oriented.
-     */
-    template <typename ForwardIterator>
-    X_monotone_curve_2 constructor_impl(ForwardIterator begin,
-                                        ForwardIterator end,
-                                        boost::true_type) const
-    {
-      // The range must contain at least two points.
-      CGAL_precondition_msg(std::distance(begin, end) > 1,
-                            "Range of points must contain at least 2 points");
-
-      // Container of the segments to be constructed from the range of points
-      std::list<X_monotone_subcurve_2> segs;
-      // Make sure the range of points contains at least two points.
-      ForwardIterator next = begin;
-      ForwardIterator curr = next++;
-
-      CGAL_precondition_code
-        (
-         const Segment_traits_2* geom_traits =
-           this->m_poly_traits.subcurve_traits_2();
-         // Initialize two comparison functors
-         typename Segment_traits_2::Compare_x_2 compare_x =
-           geom_traits->compare_x_2_object();
-         typename Segment_traits_2::Compare_xy_2 compare_xy =
-           geom_traits->compare_xy_2_object();
-         // Make sure there is no changed of directions.
-         // Saves the comp_x between the first two points
-         const Comparison_result cmp_x_res = compare_x(*curr, *next);
-         // Save the comp_xy between the first two points
-         const Comparison_result cmp_xy_res = compare_xy(*curr, *next);
-         );
-
-      // Assure that the first two points are not the same.
-      // Note that this also assures that non of the consecutive
-      // points are equal in the whole range.
-      CGAL_precondition(cmp_xy_res != EQUAL);
-
-      while (next != end) {
-        CGAL_precondition(compare_xy(*curr, *next) == cmp_xy_res);
-        CGAL_precondition(compare_x(*curr, *next) == cmp_x_res);
-
-        segs.push_back(X_monotone_subcurve_2(*curr, *next));
-        curr = next++;
-      }
-
-#ifdef CGAL_ALWAYS_LEFT_TO_RIGHT
-      if (m_poly_traits.subcurve_traits_2()->
-          compare_endpoints_xy_2_object()(*segs.begin()) == LARGER)
-      {
-        X_monotone_curve_2 xcv(segs.begin(), segs.end());
-        return m_poly_traits.construct_opposite_2_object()(xcv);
-      }
-#endif
-
-      return operator()(segs.begin(), segs.end());
-    }
-  };
-
-  /*! Obtain a Construct_x_monotone_curve_2 functor object. */
-  Construct_x_monotone_curve_2 construct_x_monotone_curve_2_object() const
-  { return Construct_x_monotone_curve_2(*this); }
-
-  /*! Deprecated!
-   * Obtain the segment traits.
-   * \return the segment traits.
-   */
-  CGAL_DEPRECATED const Segment_traits_2* segment_traits_2() const
-  { return this->subcurve_traits_2(); }
-};
-
-} // namespace CGAL
-
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_spherical_gaussian_map_3/Arr_spherical_gaussian_map_3.h b/3rdparty/CGAL-4.8/include/CGAL/Arr_spherical_gaussian_map_3/Arr_spherical_gaussian_map_3.h
deleted file mode 100644
index 3e8f798..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Arr_spherical_gaussian_map_3/Arr_spherical_gaussian_map_3.h
+++ /dev/null
@@ -1,408 +0,0 @@
-// Copyright (c) 2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s): Efi Fogel         <efif at post.tau.ac.il>
-//            Naama mayer       <naamamay at post.tau.ac.il>
-
-#ifndef CGAL_ARR_SPHERICAL_GAUSSIAN_MAP_3_H
-#define CGAL_ARR_SPHERICAL_GAUSSIAN_MAP_3_H
-
-/*! \file
- * Spherical_gaussian_map is a data dtructure that represents a Gaussinal map
- * embedded on the sphere.
- *
- * This file consists of the definition of the main type, namely
- * Arr_spherical_gaussian_map_2 and a service tye,
- * namely Arr_sgm_initializer, that initializes an object of the main type.
- */
-
-#include <string>
-#include <vector>
-#include <list>
-#include <iostream>
-
-#include <CGAL/Arrangement_on_surface_2.h>
-#include <CGAL/intersections.h>
-#include <CGAL/Polygon_2_algorithms.h>
-#include <CGAL/Arr_default_dcel.h>
-#include <CGAL/Arr_spherical_topology_traits_2.h>
-
-#if defined(CGAL_USE_LEDA)
-#if CGAL_LEDA_VERSION < 500
-#include <LEDA/rational.h>
-#else
-#include <LEDA/numbers/rational.h>
-#endif
-#endif
-
-namespace CGAL {
-
-// #define CGAL_ARR_SPHERICAL_GAUSSIAN_MAP_3_DEBUG 1
-
-/*! Sgm_normalizer normalizes the two coordinates of a point in tow-
- * dimensional cartesian coordinate-system. It is parameterized by the
- * field number-type of the point coordinates and by the type of the point
- * which coordinates are to be normalized. Normalization is performed through
- * a call an operator that accepts the point as a parameter.
- * The normalization of field number-types that initiate normalization
- * automatically (e.g., Gmpq) do not need to be initiated. Therefore, the
- * default instance does nothing. Normalizers for field number-types that
- * do not initiate normalization automatically, must be specialed.
- */
-template <class FT, class Point_2>
-class Sgm_normalizer {
-public:
-  /*! Normalize the coordinates of the given point, but in fact does
-   * nothing.
-   * \param p the point which coordinates are to be normalized
-   */ 
-  void operator()(Point_2 & p) {}
-};
-
-#if defined(CGAL_USE_LEDA)
-/*! Sgm_normalizer normalizes the two coordinates of a point in tow-
- * dimensional cartesian coordinate-system. It is parameterized by the
- * type of the point which coordinates are to be normalized, and
- * specialized for the leda::rational field number-type.
- */
-template <class Point_2>
-class Sgm_normalizer<leda::rational, Point_2> {
-public:
-  /*! Normalize the coordinates of the given point
-   * \param p the point which coordinates are to be normalized
-   */
-  void operator()(Point_2 & p)
-  {
-    leda::rational x = p.x();
-    x.normalize();
-    leda::rational y = p.y();
-    y.normalize();
-    leda::rational z = p.z();
-    z.normalize();
-    p = Point_2(x, y, z);
-  }
-};
-#endif
-
-/*! Arr_sgm_initializer is an algorothmic framework that initializes a
- * Arr_spherical_gaussian_map_3 structure. It is parameterized by the SGM to
- * be initialized and by a visitor class.
- */
-template <typename Sgm, typename T_Traits = typename Sgm::Traits>
-class Arr_sgm_initializer {
-public:
-  typedef T_Traits                                        Traits;
-  typedef typename Traits::Vector_3                       Vector_3;
-
-  typedef typename Sgm::Geometry_traits_2                 Geometry_traits_2;
-  typedef typename Geometry_traits_2::Point_2             Point_2;
-  typedef typename Geometry_traits_2::X_monotone_curve_2  X_monotone_curve_2;
-  typedef typename Geometry_traits_2::Curve_2             Curve_2;
-
-  typedef typename Sgm::Vertex_handle                     Vertex_handle;
-  typedef typename Sgm::Halfedge_handle                   Halfedge_handle;
-  typedef typename Sgm::Face_handle                       Face_handle;
-
-  /*! Constructor */
-  Arr_sgm_initializer(Sgm & sgm) : m_sgm(sgm) { }
-
-  /*! Destructor */
-  virtual ~Arr_sgm_initializer() {}
-  
-  /*! Insert a great arc whose angle is less than Pi and is represented by two
-   * normals into the SGM. Each normal defines an end point of the greate arc.
-   * \param normal1 represents the source normal.
-   * \param normal2 represents the target normal.
-   */
-  Halfedge_handle insert_non_intersecting(const Vector_3 & normal1,
-                                          const Vector_3 & normal2)
-  {
-    X_monotone_curve_2 xc(normal1.direction(), normal2.direction());
-    return insert_non_intersecting_curve(m_sgm, xc);
-  }
-
-  /*! Make x-monotone
-   */
-  template<typename OutputIterator>
-  OutputIterator make_x_monotone(const Vector_3 & normal1,
-                                 const Vector_3 & normal2,
-                                 OutputIterator oi)
-  {
-    Curve_2 cv(normal1.direction(), normal2.direction());
-    const Geometry_traits_2 * traits = this->m_sgm.geometry_traits();
-    oi = traits->make_x_monotone_2_object()(cv, oi);
-    return oi;
-  }
-  
-  /*! Insert a great arc whose angle is less than Pi and is represented by two
-   * normals into the SGM. Each normal defines an end point of the greate arc.
-   * \param normal1 represents the source normal.
-   * \param normal2 represents the target normal.
-   * \return the handle for the halfedge directed from the endpoint
-   * represented by normal1 toward the endpoint represented by normal2
-   * \pre the SGM is empty.
-   */
-  template<typename OutputIterator>
-  OutputIterator insert(const Vector_3 & normal1, const Vector_3 & normal2,
-                        OutputIterator oi)
-  {
-    std::list<CGAL::Object> x_objects;
-    make_x_monotone(normal1, normal2, std::back_inserter(x_objects));
-
-    typename std::list<CGAL::Object>::iterator it = x_objects.begin();
-    const X_monotone_curve_2 * xc = object_cast<X_monotone_curve_2>(&(*it));
-#if CGAL_ARR_SPHERICAL_GAUSSIAN_MAP_3_DEBUG==1
-    std::cout << "1.a. insert_in_face_interior(" << *xc << ")" << std::endl;
-#endif
-    Halfedge_handle he =
-      m_sgm.insert_in_face_interior(*xc, m_sgm.faces_begin());
-    if (!xc->is_directed_right()) he = he->twin();
-    *oi++ = he;
-
-    ++it;
-    if (it == x_objects.end()) return oi;
-
-    xc = object_cast<X_monotone_curve_2>(&(*it));
-#if CGAL_ARR_SPHERICAL_GAUSSIAN_MAP_3_DEBUG==1
-    std::cout << "1.b. insert_from_vertex(" << *xc << ")" << std::endl;
-#endif
-    *oi++ = (xc->is_directed_right()) ?
-      m_sgm.insert_from_left_vertex(*xc, he->target()) :     
-      m_sgm.insert_from_right_vertex(*xc, he->target());
-    return oi;
-  }
-
-  /*! Insert a great arc whose angle is less than Pi and is represented by two
-   * normals into the SGM. Each normal defines an end point of the greate arc.
-   * \param normal1 represents the source normal.
-   * \param normal2 represents the target normal.
-   * \return the handle for the halfedge directed from the endpoint
-   * represented by normal1 toward the endpoint represented by normal2
-   * \param vertex the handle of the vertex that is the source of the arc
-   */
-  template<typename OutputIterator>
-  OutputIterator insert(const Vector_3 & normal1, Vertex_handle vertex1,
-                        const Vector_3 & normal2,
-                        OutputIterator oi)
-  {
-    std::list<CGAL::Object> x_objects;
-    make_x_monotone(normal1, normal2, std::back_inserter(x_objects));
-
-    typename std::list<CGAL::Object>::iterator it = x_objects.begin();
-    const X_monotone_curve_2 * xc = object_cast<X_monotone_curve_2>(&(*it));
-#if CGAL_ARR_SPHERICAL_GAUSSIAN_MAP_3_DEBUG==1
-    std::cout << "2.a. insert_from_vertex(" << *xc << ", "
-              << vertex1->point() << ")" << std::endl;
-#endif
-
-    Halfedge_handle he = (xc->is_directed_right()) ?
-      m_sgm.insert_from_left_vertex(*xc, vertex1) :
-      m_sgm.insert_from_right_vertex(*xc, vertex1);
-    *oi++ = he;
-
-    ++it;
-    if (it == x_objects.end()) return oi;
-
-    xc = object_cast<X_monotone_curve_2>(&(*it));
-#if CGAL_ARR_SPHERICAL_GAUSSIAN_MAP_3_DEBUG==1
-    std::cout << "2.b. insert_from_vertex(" << *xc << ")" << std::endl;
-#endif
-    *oi++ = (xc->is_directed_right()) ?
-      m_sgm.insert_from_left_vertex(*xc, he->target()) :
-      m_sgm.insert_from_right_vertex(*xc, he->target());
-    return oi;
-  }
-
-  /*! Insert a great arc whose angle is less than Pi and is represented by two
-   * normals into the SGM. Each normal defines an end point of the greate arc.
-   * \param normal1 represents the source normal.
-   * \param normal2 represents the target normal.
-   * \param vertex the handle of the vertex that is the source of the arc
-   * \return the handle for the halfedge directed from the endpoint
-   * represented by normal1 toward the endpoint represented by normal2
-   */
-  template<typename OutputIterator>
-  OutputIterator insert(const Vector_3 & normal1, 
-                        const Vector_3 & normal2, Vertex_handle vertex2,
-                        OutputIterator oi)
-  {
-    std::list<CGAL::Object> x_objects;
-    make_x_monotone(normal1, normal2, std::back_inserter(x_objects));
-
-    typename std::list<CGAL::Object>::iterator it = x_objects.begin();
-    if (x_objects.size() == 1) {
-      const X_monotone_curve_2 * xc = object_cast<X_monotone_curve_2>(&(*it));
-#if CGAL_ARR_SPHERICAL_GAUSSIAN_MAP_3_DEBUG==1
-      std::cout << "3. insert_from_vertex(" << *xc << ")" << std::endl;
-#endif
-      Halfedge_handle he = (xc->is_directed_right()) ?
-        m_sgm.insert_from_right_vertex(*xc, vertex2) :
-        m_sgm.insert_from_left_vertex(*xc, vertex2);
-      *oi++ = he->twin();
-      return oi;
-    }
-
-    const X_monotone_curve_2 * xc1 = object_cast<X_monotone_curve_2>(&(*it++));
-    const X_monotone_curve_2 * xc2 = object_cast<X_monotone_curve_2>(&(*it));
-
-#if CGAL_ARR_SPHERICAL_GAUSSIAN_MAP_3_DEBUG==1
-    std::cout << "3.a. insert_from_vertex(" << *xc2 << ")" << std::endl;
-#endif
-    Halfedge_handle he2 = (xc2->is_directed_right()) ?
-      m_sgm.insert_from_right_vertex(*xc2, vertex2) :
-      m_sgm.insert_from_left_vertex(*xc2, vertex2);
-    he2 = he2->twin();
-#if CGAL_ARR_SPHERICAL_GAUSSIAN_MAP_3_DEBUG==1
-    std::cout << "3.b. insert_from_vertex(" << *xc1 << ")" << std::endl;
-#endif
-    Halfedge_handle he1 = (xc1->is_directed_right()) ?
-      m_sgm.insert_from_right_vertex(*xc1, he2->source()) :
-      m_sgm.insert_from_left_vertex(*xc1, he2->source());
-    he1 = he1->twin();
-    *oi++ = he1;
-    *oi++ = he2;
-    return oi;
-  }
-
-  /*! Insert a great arc whose angle is less than Pi and is represented by two
-   * normals into the SGM. Each normal defines an end point of the greate arc.
-   * \param normal1 represents the source normal.
-   * \param normal2 represents the target normal.
-   * \param vertex1 the handle of the vertex that is the source of the arc
-   * \param vertex2 the handle of the vertex that is the target of the arc
-   * \return the handle for the halfedge directed from the endpoint
-   * represented by normal1 toward the endpoint represented by normal2
-   */
-  template<typename OutputIterator>
-  OutputIterator insert(const Vector_3 & normal1, Vertex_handle vertex1,
-                        const Vector_3 & normal2, Vertex_handle vertex2,
-                        OutputIterator oi)
-  {
-    std::list<CGAL::Object> x_objects;
-    make_x_monotone(normal1, normal2, std::back_inserter(x_objects));
-    typename std::list<CGAL::Object>::iterator it = x_objects.begin();
-    if (x_objects.size() == 1) {
-      const X_monotone_curve_2 * xc = object_cast<X_monotone_curve_2>(&(*it));
-#if CGAL_ARR_SPHERICAL_GAUSSIAN_MAP_3_DEBUG==1
-      std::cout << "4. insert_at_vertices(" << *xc << ")" << std::endl;
-#endif
-      *oi++ = m_sgm.insert_at_vertices(*xc, vertex1, vertex2);
-      return oi;
-    }
-
-    const X_monotone_curve_2 * xc1 = object_cast<X_monotone_curve_2>(&(*it++));
-    const X_monotone_curve_2 * xc2 = object_cast<X_monotone_curve_2>(&(*it));
-
-#if CGAL_ARR_SPHERICAL_GAUSSIAN_MAP_3_DEBUG==1
-    std::cout << "4.a. insert_from_vertex(" << *xc1
-              << "," << vertex1->point() << ")" << std::endl;
-#endif
-    Halfedge_handle he = (xc1->is_directed_right()) ?
-      m_sgm.insert_from_left_vertex(*xc1, vertex1) :
-      m_sgm.insert_from_right_vertex(*xc1, vertex1);
-    *oi++ = he;
-#if CGAL_ARR_SPHERICAL_GAUSSIAN_MAP_3_DEBUG==1
-    std::cout << "4.b. insert_at_vertices(" << *xc2 << ")" << std::endl;
-#endif
-    *oi++ = m_sgm.insert_at_vertices(*xc2, he->target(), vertex2);
-    return oi;
-  }
-
-protected:
-  /*! The SGM to initialize */
-  Sgm & m_sgm;
-};
-
-/* Spherical_gaussian_map is a data dtructure that represents a Gaussinal map
- * embedded on the sphere.
- */
-template <class T_Traits,
-          template <class T>
-          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,
-      T_Dcel<T_Traits>
-    >
-  >
-{
-private:
-  typedef Arr_spherical_gaussian_map_3<T_Traits, T_Dcel>    Self;
-  
-public:
-  typedef T_Traits                                          Traits;
-  typedef Traits                                            Geometry_traits_2;
-  
-  typedef Arrangement_on_surface_2<Traits, 
-	Arr_spherical_topology_traits_2<Traits, T_Dcel<Traits> > >
-															Base;
-
-  /*! Parameter-less Constructor */
-  Arr_spherical_gaussian_map_3() { }
-
-  /*! Copy Constructor */
-  Arr_spherical_gaussian_map_3
-  (const Arr_spherical_gaussian_map_3 & gaussian_map)
-  {
-    // Not implemented yet!
-    CGAL_error();
-  }
-
-  /*! Destructor */
-  virtual ~Arr_spherical_gaussian_map_3() { this->clear(); }
-
-#if 0
-  /*! Clear the internal representation and auxiliary data structures */
-  void clear()
-  {
-    CGAL_error_msg( "Not implemented yet!");
-  }
-  
-  /*! returns true if the representation is empty */
-  bool is_empty() const
-  {
-    CGAL_error_msg( "Not implemented yet!");
-    return true;
-  }
-
-  /*! Return the degree of a vertex
-   * \param vh the vertex handle
-   * \return the degree
-   */
-  unsigned int degree(Vertex_const_handle vh) const
-  {
-    CGAL_error_msg( "Not implemented yet!");
-    return vh->degree();
-  }
-#endif
-  
-  /*! Print statistics */
-  void print_stat()
-  {
-    std::cout << "No. vertices: " << this->number_of_vertices()
-              << ",  no. halfedges: " << this->number_of_halfedges()
-              << ",  no. faces: " << this->number_of_faces()
-              << std::endl;
-  }
-
-  /*! Allow the initializer to update the SGM data members */
-  friend class CGAL::Arr_sgm_initializer<Self>;
-};
-
-} //namespace CGAL
-
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_vertex_index_map.h b/3rdparty/CGAL-4.8/include/CGAL/Arr_vertex_index_map.h
deleted file mode 100644
index d64f350..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Arr_vertex_index_map.h
+++ /dev/null
@@ -1,285 +0,0 @@
-// Copyright (c) 2010,2011 Tel-Aviv University (Israel).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Ron Wein          <wein at post.tau.ac.il>
-//                 Efi Fogel         <efif at post.tau.ac.il>
-
-#ifndef CGAL_ARR_VERTEX_INDEX_MAP_H
-#define CGAL_ARR_VERTEX_INDEX_MAP_H
-
-/*! \file
- * Definition of the Arr_vertex_index_map<Arrangement> class.
- */
-#include <CGAL/Arr_observer.h>
-#include <CGAL/Unique_hash_map.h>
-#include <boost/version.hpp>
-#if BOOST_VERSION >= 104000
-#include <boost/property_map/property_map.hpp>
-#else
-#include <boost/property_map.hpp>
-#endif
-#include <boost/graph/properties.hpp>
-
-namespace CGAL {
-
-/*! \class
- * An auxiliary class that automatically maintains a mapping of the
- * arrangement vertices to the indices 0, ..., (n -1), where n is the number
- * of vertices in the arrangement.
- */
-template <class Arrangement_>
-class Arr_vertex_index_map : public Arr_observer<Arrangement_>
-{
-public:
-
-  typedef Arrangement_                            Arrangement_2;
-  typedef typename Arrangement_2::Vertex_handle   Vertex_handle;
-
-  // Boost property type definitions:
-  typedef boost::readable_property_map_tag        category;
-  typedef unsigned int                            value_type;
-  typedef value_type                              reference;
-  typedef Vertex_handle                           key_type;
-
-private:
-
-  typedef Arr_vertex_index_map<Arrangement_2>     Self;
-  typedef Arr_observer<Arrangement_2>             Base;
-
-  typedef Unique_hash_map<Vertex_handle, unsigned int>     Index_map;
-
-  // Data members:
-  unsigned int                n_vertices;  // The current number of vertices.
-  Index_map                   index_map;   // Mapping vertices to indices.
-  std::vector<Vertex_handle>  rev_map;     // Mapping indices to vertices.
-
-  enum {MIN_REV_MAP_SIZE = 32};
-
-public:
-
-  /*! Default constructor. */
-  Arr_vertex_index_map () :
-    Base (),
-    n_vertices (0),
-    rev_map (MIN_REV_MAP_SIZE)
-  {}
-
-  /*! Constructor with an associated arrangement. */
-  Arr_vertex_index_map (const Arrangement_2& arr) :
-    Base (const_cast<Arrangement_2&> (arr))
-  {
-    _init();
-  }
-
-  /*! Copy constructor. */
-  Arr_vertex_index_map (const Self& other) :
-    Base (const_cast<Arrangement_2&> (*(other.arrangement())))
-  {
-    _init();
-  }
-
-  /*! Assignment operator. */
-  Self& operator= (const Self& other)
-  {
-    if (this == &other)
-      return (*this);
-
-    this->detach();
-    this->attach (const_cast<Arrangement_2&> (*(other.arrangement())));
-
-    return (*this);
-  }
-
-  /*!
-   * Get the index of a given vertex.
-   * \param v A handle to the vertex.
-   * \pre v is a valid vertex in the arrangement.
-   */
-  unsigned int operator[] (Vertex_handle v) const
-  {
-    return index_map[v];
-  }
-
-  /*!
-   * Get the vertex given its index.
-   * \param i The index of the vertex.
-   * \pre i is less than the number of vertices in the graph.
-   */
-  Vertex_handle vertex (const int i) const
-  {
-    CGAL_precondition (i < n_vertices);
-
-    return rev_map[i];
-  }
-
-  /// \name Notification functions, to keep the mapping up-to-date.
-  //@{
-
-  /*!
-   * Update the mapping after the arrangement has been assigned with another
-   * arrangement.
-   */
-  virtual void after_assign ()
-  {
-    _init();
-  }
-
-  /*!
-   * Update the mapping after the arrangement is cleared.
-   */
-  virtual void after_clear ()
-  {
-    _init();
-  }
-
-  /*!
-   * Update the mapping after attaching to a new arrangement.
-   */
-  virtual void after_attach ()
-  {
-    _init();
-  }
-
-  /*!
-   * Update the mapping after detaching the arrangement.
-   */
-  virtual void after_detach ()
-  {
-    n_vertices = 0;
-    index_map.clear();
-  }
-
-  /*!
-   * Update the mapping after the creation of a new vertex.
-   * \param v A handle to the created vertex.
-   */
-  virtual void after_create_vertex (Vertex_handle v)
-  {
-    // Update the number of vertices.
-    n_vertices++;
-
-    // If necessary, allocate memory for the reverse mapping.
-    if (rev_map.size() < n_vertices)
-      rev_map.resize (2 * n_vertices);
-
-    // Update the mapping of the newly created vertex.
-    index_map[v] = n_vertices - 1;
-    rev_map[n_vertices - 1] = v;
-  }
-
-  /*!
-   * Update the mapping after the creation of a new boundary vertex.
-   * \param v A handle to the created vertex.
-   */
-  virtual void after_create_boundary_vertex (Vertex_handle v)
-  {
-    // Update the number of vertices.
-    n_vertices++;
-
-    // If necessary, allocate memory for the reverse mapping.
-    if (rev_map.size() < n_vertices)
-      rev_map.resize (2 * n_vertices);
-
-    // Update the mapping of the newly created vertex.
-    index_map[v] = n_vertices - 1;
-    rev_map[n_vertices - 1] = v;
-  }
-
-  /*!
-   * Update the mapping before the removal of a vertex.
-   * \param v A handle to the vertex to be removed.
-   */
-  virtual void before_remove_vertex (Vertex_handle v)
-  {
-    // Update the number of vertices.
-    n_vertices--;
-    
-    // Reduce memory consumption in case the number of vertices has
-    // drastically decreased.
-    if (2*n_vertices+1 < rev_map.size() && 
-	rev_map.size() / 2 >= MIN_REV_MAP_SIZE)
-    {
-      rev_map.resize (rev_map.size() / 2);
-    }
-
-    // Get the current vertex index, and assign this index to the vertex
-    // currently indexed (n - 1).
-    unsigned int   index = index_map[v];
-
-    if (index == n_vertices)
-      return;
-    
-    Vertex_handle  last_v = rev_map[n_vertices];
-    index_map[last_v] = index;
-    rev_map[index] = last_v;
-
-    // Clear the reverse mapping for the last vertex.
-    rev_map[n_vertices] = Vertex_handle();
-  }
-  //@}
-
-private:
-  
-  /*! Initialize the map for the given arrangement. */
-  void _init ()
-  {
-    // Get the number of vertices and allocate the reverse map accordingly.
-    n_vertices = static_cast<unsigned int>(this->arrangement()->number_of_vertices());
-    
-    if (n_vertices < MIN_REV_MAP_SIZE)
-      rev_map.resize (MIN_REV_MAP_SIZE);
-    else
-      rev_map.resize (n_vertices);
-
-    // Clear the current mapping.
-    index_map.clear();
-
-    // Create the initial mapping. 
-    typename Arrangement_2::Vertex_iterator   vit;
-    Vertex_handle                             vh;
-    unsigned int                              index = 0;
-
-    for (vit = this->arrangement()->vertices_begin();
-	 vit != this->arrangement()->vertices_end(); ++vit, ++index)
-    {
-      // Map the current vertex to the current index.
-      vh = vit;
-      index_map[vh] = index;
-      rev_map[index] = vh;
-    }
-  }  
-
-};
-
-/*!
- * Get the index property-map function. Provided so that boost is able to
- * access the Arr_vertex_index_map above.
- * \param index_map The index map.
- * \param v A vertex handle.
- * \return The vertex index.
- */
-template<class Arrangement>
-unsigned int get (const CGAL::Arr_vertex_index_map<Arrangement>& index_map,
-		  typename Arrangement::Vertex_handle v) 
-{ 
-  return index_map[v];
-}
-
-} //namespace CGAL
-
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/BigFloat_impl.h b/3rdparty/CGAL-4.8/include/CGAL/CORE/BigFloat_impl.h
deleted file mode 100644
index 75c33c8..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/CORE/BigFloat_impl.h
+++ /dev/null
@@ -1,1327 +0,0 @@
-/****************************************************************************
- * Core Library Version 1.7, August 2004
- * Copyright (c) 1995-2004 Exact Computation Project
- * 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.
- *
- *
- * File: BigFloat.cpp
- * Synopsis:
- *       BigFloat numbers with error bounds 
- *
- *       EXACTNESS PROPERTY:
- *       ==================
- *       For BigFloats that are exact (i.e., error=0),
- *       addition/subtraction and multiplication return the
- *       exact result (i.e., error=0).  We also introduce the operation
- *       div2(), which simply divides a BigFloat by 2,
- *       but this again preserves exactness.  Such exactness
- *       properties are used in our Newton iteration/Sturm Sequences.
- *
- * Written by 
- *       Chee Yap <yap at cs.nyu.edu>
- *       Chen Li <chenli at cs.nyu.edu>
- *       Zilin Du <zilin at cs.nyu.edu>
- *
- * WWW URL: http://cs.nyu.edu/exact/
- * Email: exact at cs.nyu.edu
- *
- * $URL$
- * $Id$
- ***************************************************************************/
-
-#ifdef CGAL_HEADER_ONLY
-#define CGAL_INLINE_FUNCTION inline
-#else
-#define CGAL_INLINE_FUNCTION
-#endif
-
-#include <ctype.h>
-#include <CGAL/CORE/BigFloat.h>
-#include <CGAL/CORE/Expr.h>
-
-namespace CORE { 
-
-
-////////////////////////////////////////////////////////////
-// Misc Helper Functions
-////////////////////////////////////////////////////////////
-
-CGAL_INLINE_FUNCTION
-BigInt FiveTo(unsigned long exp) {
-  if (exp == 0)
-    return BigInt(1);
-  else if (exp == 1)
-    return BigInt(5);
-  else {
-    BigInt x = FiveTo(exp / 2);
-
-    x = x * x;
-
-    if (exp & 1)
-      x *= 5;
-
-    return x;
-  }
-}
-
-////////////////////////////////////////////////////////////
-//  class BigFloat
-////////////////////////////////////////////////////////////
-
-// STATIC BIGFLOAT CONSTANTS
-// ZERO
-CGAL_INLINE_FUNCTION
-const BigFloat& BigFloat::getZero() {
-  static BigFloat Zero(0);
-  return Zero;
-}
-// ONE
-CGAL_INLINE_FUNCTION
-const BigFloat& BigFloat::getOne() {
-  static BigFloat One(1);
-  return One;
-}
-
-// A special constructor for BigFloat from Expr
-// -- this method is somewhat of an anomaly (we normally do not expect
-//    BigFloats to know about Expr).
-CGAL_INLINE_FUNCTION
-BigFloat::BigFloat(const Expr& E, const extLong& r, const extLong& a)
-  : RCBigFloat(new BigFloatRep()) {
-  *this = E.approx(r, a).BigFloatValue(); // lazy implementaion, any other way?
-}
-
-////////////////////////////////////////////////////////////
-//  class BigFloatRep
-////////////////////////////////////////////////////////////
-
-CGAL_INLINE_FUNCTION
-BigFloatRep::BigFloatRep(double d) : m(0), err(0), exp(0) {
-  if (d != 0.0) {
-    int isNegative = 0;
-
-    if (d < 0.0) {
-      isNegative = 1;
-      d          = - d;
-    }
-
-    int    binExp;
-    double f = frexp(d, &binExp);
-
-    exp = chunkFloor(binExp);
-
-    long s = binExp - bits(exp);
-
-    long   stop = 0;
-    double intPart;
-
-    // convert f into a BigInt
-    while (f != 0.0 && stop < DBL_MAX_CHUNK) {
-      f =   ldexp(f, (int)CHUNK_BIT);
-      f =   modf(f, &intPart);
-      m <<= CHUNK_BIT;
-      m +=  (long)intPart;
-      exp--;
-      stop++;
-    }
-#ifdef CORE_DEBUG
-    assert (s >= 0);
-#endif
-
-    if (s)
-      m <<= s;
-    if (isNegative)
-      negate(m);
-  }
-}//BigFloatRep constructor
-
-//  approximation
-CGAL_INLINE_FUNCTION
-void BigFloatRep::trunc(const BigInt& I, const extLong& r, const extLong& a) {
-  if (sign(I)) {
-    long tr = chunkFloor((- r + bitLength(I)).asLong());
-    long ta = chunkFloor(- a.asLong());
-    long t;
-
-    if (r.isInfty() || a.isTiny())
-      t = ta;
-    else if (a.isInfty())
-      t = tr;
-    else
-      t = ta < tr ? tr : ta;
-
-    if (t > 0) {  // BigInt remainder;
-      m   = chunkShift(I, - t);
-      err = 1;
-      exp = t;
-    } else { //  t <= 0
-      m   = I;
-      err = 0;
-      exp = 0;
-    }
-  } else {//  I == 0
-    m   = 0;
-    err = 0;
-    exp = 0;
-  }
-}
-
-CGAL_INLINE_FUNCTION
-void BigFloatRep :: truncM(const BigFloatRep& B, const extLong& r, const extLong& a) {
-  if (sign(B.m)) {
-    long tr = chunkFloor((- 1 - r + bitLength(B.m)).asLong());
-    long ta = chunkFloor(- 1 - a.asLong()) - B.exp;
-    long t;
-
-    if (r.isInfty() || a.isTiny())
-      t = ta;
-    else if (a.isInfty())
-      t = tr;
-    else
-      t = ta < tr ? tr : ta;
-
-    if (t >= chunkCeil(clLg(B.err))) {
-      m   = chunkShift(B.m, - t);
-      err = 2;
-      exp = B.exp + t;
-    } else //  t < chunkCeil(clLg(B.err))
-      core_error(std::string("BigFloat error: truncM called with stricter")
-	  + "precision than current error.", __FILE__, __LINE__, true);
-  } else {//  B.m == 0
-    long t = chunkFloor(- a.asLong()) - B.exp;
-
-    if (t >= chunkCeil(clLg(B.err))) {
-      m   = 0;
-      err = 1;
-      exp = B.exp + t;
-    } else //  t < chunkCeil(clLg(B.err))
-      core_error(std::string("BigFloat error: truncM called with stricter")
-	  + "precision than current error.", __FILE__, __LINE__, true);
-  }
-}
-
-// This is the main approximation function
-// REMARK: would be useful to have a self-modifying version
-// 		of this function (e.g., for Newton).
-CGAL_INLINE_FUNCTION
-void BigFloatRep::approx(const BigFloatRep& B,
-              const extLong& r, const extLong& a) {
-  if (B.err) {
-    if (1 + clLg(B.err) <= bitLength(B.m))
-      truncM(B, r + 1, a);
-    else //  1 + clLg(B.err) > lg(B.m)
-      truncM(B, CORE_posInfty, a);
-  } else {//  B.err == 0
-    trunc(B.m, r, a - bits(B.exp));
-    exp += B.exp;
-  }
-  // Call normalization globally     -- IP 10/9/98
-  normal();
-}
-
-CGAL_INLINE_FUNCTION
-void BigFloatRep::div(const BigInt& N, const BigInt& D,
-              const extLong& r, const extLong& a) {
-  if (sign(D)) {
-    if (sign(N)) {
-      long tr = chunkFloor((- r + bitLength(N) - bitLength(D) - 1).asLong());
-      long ta = chunkFloor(- a.asLong());
-
-      if (r.isInfty() || a.isTiny())
-        exp = ta;
-      else if (a.isInfty())
-        exp = tr;
-      else
-        exp = ta < tr ? tr : ta;
-
-      BigInt remainder;
-
-      // divide(chunkShift(N, - exp), D, m, remainder);
-      div_rem(m, remainder, chunkShift(N, - exp), D);
-
-      if (exp <= 0 && sign(remainder) == 0)
-        err = 0;
-      else
-        err = 1;
-    } else {//  N == 0
-      m   = 0;
-      err = 0;
-      exp = 0;
-    }
-  } else //  D == 0
-    core_error( "BigFloat error: zero divisor.", __FILE__, __LINE__, true);
-
-  // Call normalization globally     -- IP 10/9/98
-  normal();
-}//div
-
-//  error-normalization
-CGAL_INLINE_FUNCTION
-void BigFloatRep::normal() {
-  long le = flrLg(err);
-
-  if (le >= CHUNK_BIT + 2) { // so we do not carry more than 16 = CHUNK_BIT + 2
-	                     // bits of error
-    long f = chunkFloor(--le); // f is roughly equal to floor(le/CHUNK_BIT)
-    long bits_f = bits(f);   // f chunks will have bits_f many bits
-#ifdef CORE_DEBUG
-    assert (bits_f >= 0);
-#endif
-
-    m   >>= bits_f;  // reduce mantissa by bits_f many bits
-    err >>= bits_f;  // same for err
-    err +=  2;       // why 2?
-    exp +=  f;       
-  }
-  if (err == 0)      // unlikely, if err += 2 above
-    eliminateTrailingZeroes();
-}
-
-// bigNormal(err) 
-//     convert a bigInt error value (=err) into an error that fits into
-//     a long number.  This is done by
-//     by increasing the exponent, and corresponding decrease
-//     in the bit lengths of the mantissa and error.
-//
-CGAL_INLINE_FUNCTION
-void BigFloatRep::bigNormal(BigInt& bigErr) {
-  long le = bitLength(bigErr);
-
-  if (le < CHUNK_BIT + 2) {
-    err = ulongValue(bigErr);
-  } else {
-    long f = chunkFloor(--le);
-    long bits_f = bits(f);
-#ifdef CORE_DEBUG
-    assert(bits_f >= 0);
-#endif
-
-    m      >>= bits_f;
-    bigErr >>= bits_f;
-    err    = ulongValue(bigErr) + 2; // you need to add "2" because "1" comes
-    		// from truncation error in the mantissa, and another
-		// "1" comes from the truncation error in the bigErr.
-		// (But there is danger of overflow...)
-    exp    += f;
-  }
-
-  if (err == 0)
-    eliminateTrailingZeroes();
-}
-
-// ARITHMETIC:
-//  Addition
-CGAL_INLINE_FUNCTION
-void BigFloatRep::add(const BigFloatRep& x, const BigFloatRep& y) {
-  long expDiff = x.exp - y.exp;
-
-  if (expDiff > 0) {//  x.exp > y.exp
-    if (!x.err) {
-      m   = chunkShift(x.m, expDiff) + y.m;
-      err = y.err;
-      exp = y.exp;
-    } else {//  x.err > 0
-      m   = x.m + chunkShift(y.m, - expDiff); // negative shift!
-      err = x.err + 5; // To account for y.err (but why 5?)
-      exp = x.exp;     // 
-      // normal();
-    }
-  } else if (!expDiff) {//  x.exp == y.exp
-    m   = x.m + y.m;
-    err = x.err + y.err;
-    exp = x.exp;
-    // normal();
-  } else {//  x.exp < y.exp
-    if (!y.err) {
-      m   = x.m + chunkShift(y.m, - expDiff);
-      err = x.err;
-      exp = x.exp;
-    } else {//  y.err > 0
-      m   = chunkShift(x.m, expDiff) + y.m;
-      err = y.err + 5;
-      exp = y.exp;
-      // normal();
-    }
-  }
-  // Call normalization globally     -- IP 10/9/98
-  normal();
-}
-
-//  Subtraction
-CGAL_INLINE_FUNCTION
-void BigFloatRep::sub(const BigFloatRep& x, const BigFloatRep& y) {
-  long expDiff = x.exp - y.exp;
-
-  if (expDiff > 0) {//  x.exp > y.exp
-    if (!x.err) {
-      m   = chunkShift(x.m, expDiff) - y.m;
-      err = y.err;
-      exp = y.exp;
-    } else {//  x.err > 0
-      m   = x.m - chunkShift(y.m, - expDiff);
-      err = x.err + 5;
-      exp = x.exp;
-      // normal();
-    }
-  } else if (!expDiff) {
-    m   = x.m - y.m;
-    err = x.err + y.err;
-    exp = x.exp;
-    // normal();
-  } else { //  x.exp < y.exp
-    if (!y.err) {
-      m   = x.m - chunkShift(y.m, - expDiff);
-      err = x.err;
-      exp = x.exp;
-    } else {//  y.err > 0
-      m   = chunkShift(x.m, expDiff) - y.m;
-      err = y.err + 5;
-      exp = y.exp;
-      // normal();
-    }
-  }
-  // Call normalization globally     -- IP 10/9/98
-  normal();
-}
-
-CGAL_INLINE_FUNCTION
-void BigFloatRep::mul(const BigFloatRep& x, const BigFloatRep& y) {
-  m = x.m * y.m;
-  exp = x.exp + y.exp;
-  // compute error (new code, much faster. Zilin Du, Nov 2003)
-  if (x.err == 0 && y.err == 0) {
-    err = 0;
-    eliminateTrailingZeroes();
-  } else {
-    BigInt bigErr(0);
-    if (y.err != 0)
-      bigErr += abs(x.m)*y.err;
-    if (x.err != 0)
-      bigErr += abs(y.m)*x.err;
-    if (x.err !=0 && y.err != 0)
-      bigErr += x.err*y.err;
-    bigNormal(bigErr);
-  }
-}
-// BigFloat div2 will half the value of x, exactly with NO error
-// 	REMARK: should generalize this to dividing by any power of 2
-// 	We need this in our use of BigFloats to maintain isolation
-// 	intervals (e.g., in Sturm sequences)	--Chee/Vikram 4/2003
-//
-CGAL_INLINE_FUNCTION
-void BigFloatRep :: div2(const BigFloatRep& x) {
-  if (isEven(x.m)) {
-    m = (x.m >> 1);
-    exp = x.exp ;
-  } else {
-    m = (x.m << static_cast<unsigned long>(CHUNK_BIT-1));
-    exp = x.exp -1;
-  }
-}
-
-// Converts a BigFloat interval into one BigFloat with almost same error bound
-// This routine ignores the errors in inputs a and b.
-// But you cannot really ignore them since, they are taken into account
-// when you compute "r.sub(a,b)"...
-CGAL_INLINE_FUNCTION
-void BigFloatRep::centerize(const BigFloatRep& a, const BigFloatRep& b) {
-  if ((a.m == b.m) && (a.err == b.err) && (a.exp == b.exp)) {
-    m = a.m;
-    err = a.err;
-    exp = a.exp;
-    return;
-  }
-
-  BigFloatRep r;
-  r.sub(a, b);
-  r.div2(r);
-
-  //setup mantissa and exponent, but not error bits
-  // But this already sets the error bits? Chee
-  add(a,b);
-  div2(*this);
-  // error bits = ceil ( B^{-exp}*|a-b|/2 )
-
-  // bug fixed: possible overflow on converting
-  // Zilin & Vikram, 08/24/04
-  // err = 1 + longValue(chunkShift(r.m, r.exp - exp));
-  BigInt E = chunkShift(r.m, r.exp - exp);
-  bigNormal(E);
-}
-
-// BigFloat Division, computing x/y:
-//      Unlike +,-,*, this one takes a relative precision bound R
-//	Note that R is only used when x and y are error-free!
-//	(This remark means that we may be less efficient than we could be)
-//
-//  	Assert( R>0  && R< CORE_Infty )
-//
-CGAL_INLINE_FUNCTION
-void BigFloatRep :: div(const BigFloatRep& x, const BigFloatRep& y,
-                        const extLong& R) {
-  if (!y.isZeroIn()) { //  y.m > y.err, so we are not dividing by 0
-    if (!x.err && !y.err) {
-      if (R < 0 || R.isInfty()) //Oct 9, 2002: fixed major bug! [Zilin/Chee]
-        div(x.m, y.m, get_static_defBFdivRelPrec(), CORE_posInfty);
-      else
-        div(x.m, y.m, R, CORE_posInfty);
-      exp += x.exp - y.exp; // chen: adjust exp.
-    } else {//  x.err > 0 or y.err > 0
-      BigInt bigErr, errRemainder;
-
-      if (x.isZeroIn()) { //  x.m <= x.err
-        m   = 0;
-        exp = x.exp - y.exp;
-
-        div_rem(bigErr, errRemainder, abs(x.m) + static_cast<long>(x.err),
-                abs(y.m) - static_cast<long>(y.err));
-      } else { //  x.m > x.err
-        long lx = bitLength(x.m);
-        long ly = bitLength(y.m);
-        long r;
-
-        if (!x.err) //  x.err == 0 and y.err > 0
-          r = ly + 2;
-        else if(!y.err)  //  x.err > 0 and y.err == 0
-          r = lx + 2;
-        else  //  x.err > 0 and y.err > 0
-          r = lx < ly ? lx + 2: ly + 2;
-
-        long   t = chunkFloor(- r + lx - ly - 1);
-        BigInt remainder;
-
-        div_rem(m, remainder, chunkShift(x.m, - t), y.m);
-        exp = t + x.exp - y.exp;
-
-        long delta = ((t > 0) ? 2 : 0);
-
-        // Chen Li: 9/9/99
-        // here again, it use ">>" operator with a negative
-        // right operand. So the result is not well defined.
-        // Erroneous code:
-        //   divide(abs(remainder) + (static_cast<long>(x.err) >> bits(t))
-        //                     + delta + static_cast<long>(y.err) * abs(m),
-        //                     abs(y.m) - static_cast<long>(y.err),
-        //                     bigErr,
-        //                     errRemainder);
-        // New code:
-        BigInt errx_over_Bexp = x.err;
-        long bits_Bexp = bits(t);
-        if (bits_Bexp >= 0) {
-          errx_over_Bexp >>= bits_Bexp;
-        } else {
-          errx_over_Bexp <<= (-bits_Bexp);
-        }
-
-        // divide(abs(remainder) + errx_over_Bexp
-        //        + delta + static_cast<long>(y.err) * abs(m),
-        //        abs(y.m) - static_cast<long>(y.err),
-        //        bigErr,
-        //        errRemainder);
-        div_rem(bigErr, errRemainder,
-                abs(remainder) + errx_over_Bexp + delta + static_cast<long>(y.err) * abs(m),
-                abs(y.m) - static_cast<long>(y.err));
-      }
-
-      if (sign(errRemainder))
-        ++bigErr;
-
-      bigNormal(bigErr);
-    }
-  } else {//  y.m <= y.err
-    core_error("BigFloat error: possible zero divisor.",
-		    __FILE__, __LINE__, true);
-  }
-
-  // Call normalization globally     -- IP 10/9/98
-  // normal(); -- Chen: after calling bigNormal, this call is redundant.
-}// BigFloatRep::div
-
-//  squareroot for BigInt argument, without initial approximation
-//  sqrt(x,a) computes sqrt of x to absolute precision a.
-//      -- this is where Newton is applied
-//      -- this is called by BigFloatRep::sqrt(BigFloat, extLong)
-CGAL_INLINE_FUNCTION
-void BigFloatRep::sqrt(const BigInt& x, const extLong& a) {
-  sqrt(x, a, BigFloat(x, 0, 0));
-} // sqrt(BigInt x, extLong a) , without initial approx
-
-//  sqrt(x,a,A) where
-//      x = bigInt whose sqrt is to be computed
-//      a = absolute precision bound
-//      A = initial approximation in BigFloat
-//  -- this is where Newton is applied
-//  -- it is called by BigFloatRep::sqrt(BigFloatRep, extLong, BigFloat)
-CGAL_INLINE_FUNCTION
-void BigFloatRep::sqrt(const BigInt& x, const extLong& a, const BigFloat& A) {
-  if (sign(x) == 0) {
-    m = 0;
-    err = 0;
-    exp = 0;
-  } else if (x == 1) {
-    m = 1;
-    err = 0;
-    exp = 0;
-  } else  {// main case
-    // here is where we use the initial approximation
-    m = A.m();
-    err = 0;
-    exp = A.exp();
-
-    BigFloatRep q, z;
-    extLong     aa;
-    // need this to make sure that in case the
-    // initial approximation A is less than sqrt(x)
-    // then Newton iteration will still proceed at
-    // least one step.
-    bool firstTime = true;
-    for (;;) {
-      aa    = a - bits(exp);
-      q.div(x, m, CORE_posInfty, aa);
-      q.err = 0;
-      q.exp -= exp;
-
-      z.sub(*this, q);  // this=current approximation, so z = this - q
-      /*if (sign(z.m) <= 0 || z.MSB() < - a)  // justification: see Koji's
-          break;                              // thesis (p. 28) which states
-                                              // that we can exit when
-                                              // " (*this) <= q + 2**(-a)"
-      */
-      // The preceding code is replaced by what follows:
-      if (z.MSB() < -a)
-        break;
-      if (sign(z.m) <= 0) {
-        if (firstTime)
-          firstTime = false;
-        else
-          break;
-      }
-
-      z.add(*this, q);
-      // Chen Li: a bug fixed here.
-      //      m   = z.m >> 1;
-      //      err = 0;
-      //      exp = z.exp;
-      if ((z.m > 1) && isEven(z.m)) {
-        m = z.m >> 1;               // exact division by 2
-        err = 0;
-        exp = z.exp;
-      } else {                      // need to shift left before division by 2
-        m = chunkShift(z.m, 1) >> 1;
-        err = 0;
-        exp = z.exp - 1;
-      }//else
-    }//for
-  }//else
-} // sqrt of BigInt, with initial approx
-
-// MAIN ENTRY INTO SQRT FUNCTION (BIGFLOAT ARGUMENT, WITHOUT INITIAL APPROX)
-CGAL_INLINE_FUNCTION
-void BigFloatRep::sqrt(const BigFloatRep& x, const extLong& a) {
-  sqrt(x, a, BigFloat(x.m, 0, x.exp));
-} //sqrt(BigFloat, extLong a)
-
-// MAIN ENTRY INTO SQRT FUNCTION (BIGFLOAT ARGUMENT WITH INITIAL APPROXIMATION)
-CGAL_INLINE_FUNCTION
-void BigFloatRep::sqrt(const BigFloatRep& x, const extLong& a, const BigFloat& A) {
-  // This computes the sqrt of x to absolute precision a, starting with
-  // the initial approximation A
-  if (sign(x.m) >= 0) {          //  x.m >= 0
-    int delta = x.exp & 1;    // delta=0 if x.exp is even, otherwise delta=1
-
-    if (x.isZeroIn()) {         //  x.m <= x.err
-      m = 0;
-      if (!x.err)
-        err = 0;
-      else {                  //  x.err > 0
-        err = (long)(std::sqrt((double)x.err));
-        err++;
-        err <<= 1;
-        if (delta)
-          err <<= HALF_CHUNK_BIT;
-      }
-      exp = x.exp >> 1;
-      normal();
-    } else {
-      long aExp = A.exp() - (x.exp >> 1);
-      BigFloat AA( chunkShift(A.m(), delta), 0, aExp);
-
-      if (!x.err) {             //  x.m > x.err = 0 (ERROR FREE CASE)
-        BigFloatRep z;
-        extLong ppp;
-        if (a.isInfty())        //Oct 9, 2002: fixed major bug! [Zilin/Chee]
-          ppp = get_static_defBFsqrtAbsPrec();
-        else
-          ppp = a + EXTLONG_ONE;
-        extLong absp  = ppp + bits(x.exp >> 1);
-
-        z.sqrt(chunkShift(x.m, delta), absp, AA); // call sqrt(BigInt, a, AA)
-
-        long p = (absp + bits(z.exp)).asLong();
-
-        // Next, normalize the error:
-        if (p <= 0) {
-          m = z.m;
-          // Chen Li: a bug fixed
-          //    BigInt bigErr = 1 << (-p);
-          BigInt bigErr(1);
-          bigErr = bigErr << static_cast<unsigned long>(-p);
-          exp = z.exp + (x.exp >> 1);
-          bigNormal(bigErr);
-        } else {                  //  p > 0
-          m = chunkShift(z.m, chunkCeil(p));
-          long r = CHUNK_BIT - 1 - (p + CHUNK_BIT - 1) % CHUNK_BIT;
-#ifdef CORE_DEBUG
-          assert(r >= 0);
-#endif
-
-          err = 1 >> r;
-          exp = - chunkCeil(ppp.asLong());
-          normal();
-        }
-      } else {                      //  x.m > x.err > 0 (mantissa has error)
-        BigFloatRep z;
-        extLong absp=-flrLg(x.err)+bitLength(x.m)-(bits(delta) >> 1)+EXTLONG_FOUR;
-
-        z.sqrt(chunkShift(x.m, delta), absp, AA);
-
-        long qqq = - 1 + (bitLength(x.m) >> 1) - delta * HALF_CHUNK_BIT;
-        long qq  = qqq - clLg(x.err);
-        long q   = qq + bits(z.exp);
-
-        if (q <= 0) {
-          m = z.m;
-          long   qqqq   = - qqq - bits(z.exp);
-          // Chen Li (09/08/99), a bug fixed here:
-          //        BigInt bigErr = x.err << - qqqq;
-          // when (-qqqq) is negative, the result is not correct.
-          // how "<<" and ">>" process negative second operand is
-          // not well defined. Seems it just take it as a unsigned
-          // integer and extract the last few bits.
-          // x.err is a long number which easily overflows.
-          // From page 22 of Koji's paper, I think the exponent is
-          // wrong here. So I rewrote it as:
-          BigInt bigErr = x.err;
-          if (qqqq >= 0) {
-            bigErr <<= qqqq;
-          } else {
-            bigErr >>= (-qqqq);
-            ++bigErr; // we need to keep its ceiling.
-          }
-
-          exp = z.exp + (x.exp >> 1);
-          bigNormal(bigErr);
-        } else {         //  q > 0
-          m = chunkShift(z.m, chunkCeil(q));
-          long r = CHUNK_BIT - 1 - (q + CHUNK_BIT - 1) % CHUNK_BIT;
-#ifdef CORE_DEBUG
-          assert(r >= 0);
-#endif
-
-          err = 1 >> r;
-          exp = (x.exp >> 1) - chunkCeil(qq);
-          normal();
-        }
-      }  // end of case with error in mantissa
-    }//else
-  } else
-    core_error("BigFloat error: squareroot called with negative operand.",
-		    __FILE__, __LINE__, true);
-} //sqrt with initial approximation
-
-//  compareMExp(x)
-//    returns  1 if *this > x
-//             0 if *this = x,
-//            -1 if *this < x,
-//
-//      Main comparison method for BigFloat
-//      This is called by BigFloat::compare()
-//      BE CAREFUL:  The error bits are ignored!
-//      Need another version if we want to take care of error bits
-
-CGAL_INLINE_FUNCTION
-int BigFloatRep :: compareMExp(const BigFloatRep& x) const {
-  int st = sign(m);
-  int sx = sign(x.m);
-
-  if (st > sx)
-    return 1;
-  else if (st == 0 && sx == 0)
-    return 0;
-  else if (st < sx)
-    return - 1;
-  else { //  need to compare m && exp
-    long expDiff = exp - x.exp;
-
-    if (expDiff > 0) //  exp > x.exp
-      return cmp(chunkShift(m, expDiff), x.m);
-    else if (!expDiff)
-      return cmp(m, x.m);
-    else  //  exp < x.exp
-      return cmp(m, chunkShift(x.m, - expDiff));
-  }
-}
-
-// 3/6/2000:
-// This is a private function used by BigFloatRep::operator<<
-// to get the exact value
-// of floor(log10(M * 2^ e)) where E is an initial guess.
-// We will return the correct E which satisfies
-//              10^E <= M * 2^e < 10^{E+1}
-// But we convert this into
-//              mm <= M < 10.mm
-
-CGAL_INLINE_FUNCTION
-long BigFloatRep :: adjustE( long E, BigInt M, long ee) const {
-  if (M<0)
-    M=-M;
-  BigInt mm(1);
-  if (ee > 0)
-    M = (M<<static_cast<unsigned long>(ee));
-  else
-    mm = (mm << static_cast<unsigned long>(-ee));
-  if (E > 0)
-    mm *= (FiveTo(E)<< static_cast<unsigned long>(E));
-  else
-    M *= (FiveTo(-E) << static_cast<unsigned long>(-E));
-
-  if (M < mm) {
-    do {
-      E--;
-      M *= 10;
-    } while (M < mm);
-  } else if (M >= 10*mm) {
-    mm *= 10;
-    do {
-      E++;
-      mm *= 10;
-    } while (M >= mm);
-  }
-  return E;
-}
-
-CGAL_INLINE_FUNCTION
-BigFloatRep::DecimalOutput
-BigFloatRep::toDecimal(unsigned int width, bool Scientific) const {
-  BigFloatRep::DecimalOutput decOut;                // to be returned
-  if (err > 0) {
-    decOut.isExact = false;
-  } else { // err == 0
-    decOut.isExact = true;
-  }
-
-  if (err > 0 && err >= abs(m)) {
-    // if err is larger than mantissa, sign and significant values
-    // can not be determined.
-    core_error("BigFloat error: Error is too big!",
-		    __FILE__, __LINE__, false);
-    decOut.rep = "0.0e0";          // error is too big
-    decOut.isScientific = false;
-    decOut.noSignificant = 0;
-    decOut.errorCode = 1;          // sign of this number is unknown
-    return decOut;
-  }
-
-  decOut.sign = sign(m);
-  decOut.errorCode = 0;
-
-  BigInt M(m);                  // temporary mantissa
-  long lm = bitLength(M);       // binary length of mantissa
-  long e2 = bits(exp);          // binary shift length represented by exponent
-  long le = clLg(err);          // binary length of err
-  if (le == -1)
-    le = 0;
-
-  long L10 = 0;
-  if (M != 0) {
-    L10 = (long)std::floor((lm + e2) / lgTenM);
-    L10 = adjustE(L10, m, e2);     // L10: floor[log10(M 2^(e2))], M != 0
-  } else {
-    L10 = 0;
-  }
-  // Convention: in the positional format, when the output is
-  // the following string of 8 characters:
-  //             (d0, d1, d2, d3, ".", d4, d5, d6, d7)
-  // then the decimal point is said to be in the 4th position.
-  // E.g., (d0, ".", d1, d2) has the decimal point in the 1st position.
-  // The value of L10 says that the decimal point of output should be at
-  // the (L10 + 1)st position. This is
-  // true regardingless of whether M = 0 or not. For zero, we output
-  // {0.0*} so L10=0.  In general, the |value| is less than 10
-  // if and only if L10 is 0 and the
-  // decimal point is in the 1st place.  Note that L10 is defined even if
-  // the output is an integer (in which case it does not physically appear
-  // but conceptually terminates the sequence of digits).
-
-  // First, get the decimal representaion of (m * B^(exp)).
-  if (e2 < 0) {
-    M *= FiveTo(-e2); // M = x * 10^(-e2)
-  } else if (e2 > 0) {
-    M <<= e2;         // M = x * 2^(e2)
-  }
-
-  std::string decRep = M.get_str();
-  // Determine the "significant part" of this string, i.e. the part which
-  // is guaranteed to be correct in the presence of error,
-  // except that the last digit which might be subject to +/- 1.
-
-  if (err != 0) {     // valid = number of significant digits
-    unsigned long valid = floorlg10(m) - (long)std::floor(std::log10(float(err)));
-    if (decRep.length() > valid) {
-      decRep.erase(valid);
-    }
-  }
-
-  // All the digits in decM are correct, except the last one might
-  // subject to an error +/- 1.
-
-  if ((decRep[0] == '+') || (decRep[0] == '-')) {
-    decRep.erase(0, 1);
-  }
-
-  // Second, make choice between positional representation
-  // and scientific notation.  Use scientific notation when:
-  // 0) if scientific notation flag is on
-  // 1) err * B^exp >= 1, the error contribute to the integral part.
-  // 2) (1 + L10) >= width, there is not have enough places to hold the
-  //    positional representation, not including decimal point.
-  // 3) The distance between the first significant digit and decimal
-  //    point is too large for the width limit. This is equivalent to
-  //            Either ((L10 >= 0 and (L10 + 1) > width))
-  //            Or  ((L10 < 0) and (-L10 + 1) > width).
-
-  if (Scientific ||
-      ((err > 0) && (le + e2) >= 0) ||          // if err*B^exp >= 1
-      ((L10 >= 0) && (L10 + 1 >= (long)width )) ||
-      ((L10 < 0) && (-L10 + 1 > (long)width ))) {
-    // use scientific notation
-    decRep = round(decRep, L10, width);
-    decOut.noSignificant = width;
-    decRep.insert(1, ".");
-    if (L10 != 0) {
-      decRep += 'e';
-      if (L10 > 0) {
-        decRep += '+';
-      } else { // L10 < 0
-        decRep += '-';
-      }
-      char eBuf[48]; // enought to hold long number L10
-      int ne = 0;
-      if ((ne = sprintf(eBuf, "%ld", labs(L10))) >= 0) {
-        eBuf[ne] = '\0';
-      } else {
-        //perror("BigFloat.cpp: Problem in outputing the exponent!");
-        core_error("BigFloat error: Problem in outputing the exponent",
-			__FILE__, __LINE__, true);
-      }
-      decRep += eBuf;
-      decOut.isScientific = true;
-    }
-  } else {
-    // use conventional positional notation.
-    if (L10 >= 0) { // x >= 1 or x == 0 and L10 + 1 <= width
-      // round when necessary
-      if (decRep.length() > width ) {
-        decRep = round(decRep, L10, width );
-        if (decRep.length() > width ) {
-          // overflow happens! use scientific notation
-          return toDecimal(width, true);
-        }
-      }
-      decOut.noSignificant = decRep.length();
-      if (L10 + 1 < (long)width ) {
-        decRep.insert(L10 + 1, ".");
-      } else { // L10 + 1 == width
-        // do nothing
-      }
-    } else { // L10 < 0, 0 < x < 1
-      // (-L10) leading zeroes, including one to the left of decimal dot
-      // need to be added in beginning.
-      decRep = std::string(-L10, '0') + decRep;
-      // then round when necessary
-      if (decRep.length() > width ) {
-        decRep = round(decRep, L10, width );
-        // cannot overflow since there are L10 leading zeroes.
-      }
-      decOut.noSignificant = decRep.length() - (-L10);
-      decRep.insert(1, ".");
-    }
-    decOut.isScientific = false;
-  }
-#ifdef CORE_DEBUG
-  assert(decOut.noSignificant >= 0);
-#endif
-
-  decOut.rep = decRep;
-  return decOut;
-}//toDecimal
-
-CGAL_INLINE_FUNCTION
-std::string BigFloatRep::round(std::string inRep, long& L10, unsigned int width) const {
-  // round inRep so that the length would not exceed width.
-  if (inRep.length() <= width)
-    return inRep;
-
-  int i = width; // < length
-  bool carry = false;
-
-  if ((inRep[i] >= '5') && (inRep[i] <= '9')) {
-    carry = true;
-    i--;
-    while ((i >= 0) && carry) {
-      if (carry) {
-        inRep[i] ++;
-        if (inRep[i] > '9') {
-          inRep[i] = '0';
-          carry = true;
-        } else {
-          carry = false;
-        }
-      }
-      i-- ;
-    }
-
-    if ((i < 0) && carry) { // overflow
-      inRep.insert(inRep.begin(), '1');
-      L10 ++;
-      width ++;
-    }
-  }
-
-  return inRep.substr(0, width);
-}//round(string,width)
-
-
-// This function fromString(str, prec) is similar to the
-//      constructor Real(char * str, extLong prec)
-// See the file Real.cc for the differences
-
-CGAL_INLINE_FUNCTION
-void BigFloatRep :: fromString(const char *str, const extLong & prec ) {
-  // NOTE: prec defaults to get_static_defBigFloatInputDigits() (see BigFloat.h)
-  // check that prec is not INFTY
-  if (prec.isInfty())
-    core_error("BigFloat error: infinite precision not allowed",
-			__FILE__, __LINE__, true);
-
-  const char *e = strchr(str, 'e');
-  int dot = 0;
-  long e10 = 0;
-  if (e != NULL)
-    e10 = atol(e+1);    // e10 is decimal precision of the input string
-  // i.e., input is A/10^{e10}.
-  else {
-    e = str + strlen(str);
-#ifdef CORE_DEBUG
-    assert(*e == '\0');
-#endif
-
-  }
-
-  const char *p = str;
-  if (*p == '-' || *p == '+')
-    p++;
-  m = 0;
-  exp = 0;
-
-  for (; p < e; p++) {
-    if (*p == '.') {
-      dot = 1;
-      continue;
-    }
-    m = m * 10 + (*p - '0');
-    if (dot)
-      e10--;
-  }
-
-  BigInt one = 1;
-  long t = (e10 < 0) ? -e10 : e10;
-  BigInt ten = FiveTo(t) * (one << static_cast<unsigned long>(t));
-
-  // HERE IS WHERE WE USE THE SYSTEM CONSTANT
-  //           defBigFloatInputDigits
-  // Note: this constant is rather similar to defInputDigits which
-  //     is used by Real and Expr for controlling
-  //     input accuracy.  The difference is that defInputDigits can
-  //     be CORE_INFTY, but defBigFloatInputDigits must be finite.
-
-  if (e10 < 0)
-    div(m, ten, CORE_posInfty, 4 * prec);
-  else
-    m *= ten;
-  if (*str == '-')
-    m = -m;
-}//BigFloatRep::fromString
-
-CGAL_INLINE_FUNCTION
-std::istream& BigFloatRep :: operator >>(std::istream& i) {
-  int size = 20;
-  char *str = new char[size];
-  char *p = str;
-  char c;
-  int d = 0, e = 0, s = 0;
-  // d=1 means dot is found
-  // e=1 means 'e' or 'E' is found
-  //  int done = 0;
-
-  // Chen Li: fixed a bug, the original statement is
-  //  for (i.get(c); c == ' '; i.get(c));
-  // use isspace instead of testing c == ' ', since it must also
-  // skip tab, catridge/return, etc.
-  // Change to:
-  //  int status;
-  do {
-    c = i.get();
-  } while (isspace(c)); /* loop if met end-of-file, or
-                               char read in is white-space. */
-  // Chen Li, "if (c == EOF)" is unsafe since c is of char type and
-  // EOF is of int tyep with a negative value -1
-  if (i.eof()) {
-    i.clear(std::ios::eofbit | std::ios::failbit);
-    return i;
-  }
-
-  // the current content in "c" should be the first non-whitespace char
-  if (c == '-' || c == '+') {
-    *p++ = c;
-    i.get(c);
-  }
-
-  for (; isdigit(c) || (!d && c=='.') ||
-       (!e && ((c=='e') || (c=='E'))) || (!s && (c=='-' || c=='+')); i.get(c)) {
-    if (!e && (c == '-' || c == '+'))
-      break;
-    // Chen Li: put one more rule to prohibite input like
-    //  xxxx.xxxe+xxx.xxx:
-    if (e && (c == '.'))
-      break;
-    if (p - str == size) {
-      char *t = str;
-      str = new char[size*2];
-      memcpy(str, t, size);
-      delete [] t;
-      p = str + size;
-      size *= 2;
-    }
-#ifdef CORE_DEBUG
-    assert((p-str) < size);
-#endif
-
-    *p++ = c;
-    if (c == '.')
-      d = 1;
-    // Chen Li: fix a bug -- the sign of exponent can not happen before
-    // the character "e" appears! It must follow the "e' actually.
-    //    if (e || c == '-' || c == '+') s = 1;
-    if (e)
-      s = 1;
-    if ((c == 'e') || (c=='E'))
-      e = 1;
-  }
-
-  // chenli: make sure that the p is still in the range
-  if (p - str >= size) {
-    int len = p - str;
-    char *t = str;
-    str = new char[len + 1];
-    memcpy(str, t, len);
-    delete [] t;
-    p = str + len;
-  }
-
-#ifdef CORE_DEBUG
-  assert(p - str < size);
-#endif
-
-  *p = '\0';
-  i.putback(c);
-  fromString(str);
-  delete [] str;
-  return i;
-}//operator >>
-
-
-// BigFloatRep::toDouble()
-//      converts the BigFloat to a machine double
-//      This is a dangerous function as the method
-//      is silent when it does not fit into a machine double!
-// ToDo: fix this by return a machine NaN, +/- Infinity, +/- 0,
-//      when appropriate.
-//      Return NaN when error is larger than mantissa
-//      Return +/- Infinity if BigFloat is too big
-//      Return +/- 0 if BigFloat is too small
-#ifdef _MSC_VER
-#pragma warning(disable: 4723)
-#endif
-CGAL_INLINE_FUNCTION
-double BigFloatRep :: toDouble() const {
-  if (m == 0)
-    return (sign(m) * 0.0);
-
-  long e2 = bits(exp);
-  long le = clLg(err);  // if err=0, le will be -1
-  if (le == -1)
-    le = 0;
-
-  BigInt M = m >> static_cast<unsigned long>(le);// remove error bits in mantissa
-
-  // Below, we want to return NaN by computing 0.0/0.0.
-  // To avoid compiler warnings about divide by zero, we do this:
-
-  double foolCompilerZero;
-  foolCompilerZero = 0.0;
-
-  // COMMENT: we should directly store the
-  //    special IEEE values NaN, +/-Infinity, +/-0 in the code!!
-
-  if (M == 0)
-    return ( 0.0/foolCompilerZero ) ; // return NaN
-
-  e2 += le;             // adjust exponent corresponding to error bits
-
-  int len = bitLength(M) - 53;  // this is positive if M is too large
-
-  if (len > 0) {
-    M >>= len;
-    e2 += len;
-  }
-
-  double tt = doubleValue(M);
-
-  int ee = e2 + bitLength(M) - 1; // real exponent.
-
-  if (ee >= 1024)       // overflow!
-    return (  sign(m)/foolCompilerZero  );      // return a signed infinity
-
-  if (ee <= -1075)      // underflow!
-    // NOTE: if (-52 < ee <= 0) get denormalized number
-    return ( sign(m) * 0.0 );  // return signed zero.
-
-  // Execute this loop if e2 < 0;
-  for (int i = 0; i > e2; i--)
-    tt /= 2;
-
-  // Execute this loop if e2 > 0;
-  for (int j = 0; j < e2; j++)
-    tt *= 2;
-
-  return tt;
-}//toDouble
-#ifdef _MSC_VER
-#pragma warning(default: 4723)
-#endif
-CGAL_INLINE_FUNCTION
-BigInt BigFloatRep::toBigInt() const {
-  long e2 = bits(exp);
-  long le = clLg(err);
-  if (le == -1)
-    le = 0;
-#ifdef CORE_DEBUG
-  assert (le >= 0);
-#endif
-
-  BigInt M = m >> static_cast<unsigned long>(le); // discard the contaminated bits.
-  e2 += le;           // adjust the exponent
-
-  if (e2 < 0)
-    return M >> static_cast<unsigned long>(-e2);
-  else if (e2 > 0)
-    return M << static_cast<unsigned long>(e2);
-  else
-    return M;
-}
-
-CGAL_INLINE_FUNCTION
-long BigFloatRep :: toLong() const {
-  // convert a BigFloat to a long integer, rounded toward -\infty.
-  long e2 = bits(exp);
-  long le = clLg(err);
-#ifdef CORE_DEBUG
-  assert (le >= 0);
-#endif
-
-  BigInt M = m >> static_cast<unsigned long>(le); // discard the contaminated bits.
-  e2 += le;           // adjust the exponent
-  long t;
-  if (e2 < 0)
-    t = ulongValue(M >> static_cast<unsigned long>(-e2));
-  else if (e2 > 0)
-    t = ulongValue(M << static_cast<unsigned long>(e2));
-  else
-    t = ulongValue(M);
-  // t = M.as_long();
-  // Note: as_long() will return LONG_MAX in case of overflow.
-
-  return t;
-}
-
-// pow(r,n) function for BigFloat
-// Note: power(r,n) calls pow(r,n)
-CGAL_INLINE_FUNCTION
-BigFloat pow(const BigFloat& r, unsigned long n) {
-  if (n == 0)
-    return BigFloat(1);
-  else if (n == 1)
-    return r;
-  else {
-    BigFloat x = r;
-    while ((n % 2) == 0) { // n is even
-      x *= x;
-      n >>= 1;
-    }
-    BigFloat u = x;
-    while (true) {
-      n >>= 1;
-      if (n == 0)
-        return u;
-      x *= x;
-      if ((n % 2) == 1) // n is odd
-        u *= x;
-    }
-    //return u; // unreachable
-  }
-}//pow
-
-// experimental
-CGAL_INLINE_FUNCTION
-BigFloat root(const BigFloat& x, unsigned long k,
-         const extLong& a, const BigFloat& A) {
-  if (x.sign() == 0) {
-    return BigFloat(0);
-  } else if (x == 1) {
-    return BigFloat(1);
-  } else  {
-    BigFloat q, del, zz;
-    BigFloat z = A;
-    BigFloat bk = long(k);
-    for (; ;) {
-      zz = pow(z, k-1);
-      q = x.div(zz, a);
-      q.makeExact();
-      del = z - q;
-      del.makeExact();
-      if (del.MSB() < -a)
-        break;
-      z = ((bk-1)*z + q).div(bk, a);
-          // newton's iteration: z_{n+1}=((k-1)z_n+x/z_n^{k-1})/k
-      z.makeExact();
-    }
-    return z;
-  }
-}//root
-
-  CORE_MEMORY_IMPL(BigFloatRep)
-
-} //namespace CORE
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/CoreAux.h b/3rdparty/CGAL-4.8/include/CGAL/CORE/CoreAux.h
deleted file mode 100644
index 37eb1e3..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/CORE/CoreAux.h
+++ /dev/null
@@ -1,189 +0,0 @@
-/****************************************************************************
- * Core Library Version 1.7, August 2004
- * Copyright (c) 1995-2004 Exact Computation Project
- * 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.
- *
- *
- * File: CoreAux.h
- * Synopsis:
- *      Auxilliary functions
- *
- * Written by 
- *       Chee Yap <yap at cs.nyu.edu>
- *       Chen Li <chenli at cs.nyu.edu>
- *       Zilin Du <zilin at cs.nyu.edu>
- *
- * WWW URL: http://cs.nyu.edu/exact/
- * Email: exact at cs.nyu.edu
- *
- * $URL$
- * $Id$
- ***************************************************************************/
-
-#ifndef _CORE_COREAUX_H_
-#define _CORE_COREAUX_H_
-
-#include <iostream>
-#include <fstream>
-#include "CGAL/CORE/Impl.h"
-
-namespace CORE { 
-
-#ifndef LONG_BIT // such as in Linux
-  #define LONG_BIT (sizeof(long) * 8)
-#endif
-
-/// CORE_EPS is unit roundoff for IEEE standard double, i.e., 2^{-53}.
-// NOTES:
-// (1) CORE_EPS is used in our Floating Point Filter (Filter.h)
-// (2) 2^{-53} is called "unit roundoff" and
-// 	is the roundoff error for numbers in the range [1,2).
-//  	"Machine epsilon" is 2*CORE_EPS = 2^{-52}.  It is the
-//  	smallest gap between two normal machine numbers  --Chee 8/2003
-//
-// const double eps = (ldexp(1.0, -53)); // fails to link on SunPro
-#define CORE_EPS ((1.0/(1<<30))/(1<<23))
-// 
-#define CORE_MACHINE_EPS ((1.0/(1<<30))/(1<<22))
-
-/// relEps is relative error for IEEE standard double, 1+2^{-52}.
-const double relEps = (1.0 + std::ldexp(1.0, -52));
-
-/// CORE_DIAGFILE is used for all warning and error messages
-extern const char* CORE_DIAGFILE;
-
-/// template function returns the maximum value of two
-template <class T>
-inline const T& core_max(const T& a, const T& b) {
-  return ((a > b) ? a : b);
-}
-
-/// template function returns the minimum value of two
-template <class T>
-inline const T& core_min(const T& a, const T& b) {
-  return ((a < b) ? a : b);
-}
-
-/// template function returns the maximum value of three
-template <class T>
-inline const T& core_max(const T& a, const T& b, const T& c) {
-  return ((a > b) ? core_max(a, c) : core_max(b, c));
-}
-
-/// template function swaps two values
-template <class T>
-inline  void core_swap(T& a, T& b) {
-  T tmp;
-  tmp = a;
-  a = b;
-  b = tmp;
-}
-
-/// template function rotate three values
-template <class T>
-inline  void core_rotate(T& a, T& b, T& c) {
-  T tmp;
-  tmp = a;
-  a = b;
-  b = c;
-  c = tmp;
-}
-
-/// template function returns the minimum value of three
-template <class T>
-inline const T& core_min(const T& a, const T& b, const T& c) {
-  return ((a < b) ? core_min(a, c) : core_min(b, c));
-}
-
-/// template function returns the absolute value
-template <class T>
-inline const T core_abs(const T& a) {
-  return ((a < T(0)) ? -a : a);
-}
-
-/// returns floor log base 2 of abs(x)
-/**  CONVENTION: lg(0) = -1 */
-CGAL_CORE_EXPORT int flrLg(long x);
-
-/// returns floor log base 2 of unsigned long x
-/**  CONVENTION: lg(0) = -1 */
-CGAL_CORE_EXPORT int flrLg(unsigned long x);
-
-/// returns ceiling log base 2 of abs(x)
-/**  CONVENTION: lg(0) = -1 */
-CGAL_CORE_EXPORT int clLg(long x);
-
-/// returns ceiling log base 2 of unsigned long x
-/**  CONVENTION: lg(0) = -1 */
-CGAL_CORE_EXPORT int clLg(unsigned long x);
-
-/// gcd for machine type long
-CGAL_CORE_EXPORT long gcd(long m, long n);
-
-/// abs for int type
-inline int abs(int x) {
-  return (x>=0) ? x : (-x);
-}
-
-/// abs for long type
-inline long abs(long x) {
-  return (x>=0) ? x : (-x);
-}
-
-/// sign for int type
-inline int sign(int x) {
-  return (x==0) ? 0 : ((x>0) ? 1 : (-1));
-}
-
-/// sign for long type
-inline long sign(long x) {
-  return (x==0) ? 0 : ((x>0) ? 1 : (-1));
-}
-
-/// overloaded << to print out std::string
-inline std::ostream& operator<< (std::ostream& o, const std::string& s) {
-  o << s.c_str();
-  return o;
-}
-
-/// implements the "integer mantissa" function
-//      (See CORE_PATH/progs/ieee/frexp.cpp for details)
-CGAL_CORE_EXPORT double IntMantissa(double d);
-
-/// implements the "integer exponent" function
-//      (See CORE_PATH/progs/ieee/frexp.cpp for details)
-CGAL_CORE_EXPORT int IntExponent(double d);
-
-/// Writes out an error or warning message in the local file CORE_DIAGFILE
-/** If last argument (err) is TRUE, then this is considered an error 
- *  (not just warning).  In this case, the message is also printed in
- *  std::cerr, using std::perror(). 
- *  */
-CGAL_CORE_EXPORT void core_error(std::string msg, std::string file, int lineno, bool err);
-
-/// This is for debugging messages
-inline void core_debug(std::string msg){
-  std::cout << __FILE__ << "::" << __LINE__ << ": " << msg
-	    << std::endl;
-}
-
-
-} //namespace CORE
-
-#ifdef CGAL_HEADER_ONLY
-#include <CGAL/CORE/CoreAux_impl.h>
-#endif // CGAL_HEADER_ONLY
-
-#endif // _CORE_COREAUX_H_
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/CoreAux_impl.h b/3rdparty/CGAL-4.8/include/CGAL/CORE/CoreAux_impl.h
deleted file mode 100644
index cfb72ec..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/CORE/CoreAux_impl.h
+++ /dev/null
@@ -1,229 +0,0 @@
-/****************************************************************************
- * Core Library Version 1.7, August 2004
- * Copyright (c) 1995-2004 Exact Computation Project
- * 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.
- *
- *
- * File: CoreAux.cpp
- * Synopsis:
- *       Auxiliary routines such as ceiling of log_2, etc. 
- *       they are not specific to any Core classes.
- *
- * Written by 
- *       Chee Yap <yap at cs.nyu.edu>
- *       Chen Li <chenli at cs.nyu.edu>
- *       Zilin Du <zilin at cs.nyu.edu>
- *
- * WWW URL: http://cs.nyu.edu/exact/
- * Email: exact at cs.nyu.edu
- *
- * $URL$
- * $Id$
- ***************************************************************************/
-
-#ifdef CGAL_HEADER_ONLY
-#define CGAL_INLINE_FUNCTION inline
-#else
-#define CGAL_INLINE_FUNCTION
-#endif
-
-#include <CGAL/CORE/CoreAux.h>
-#include <gmp.h>
-
-namespace CORE { 
-
-////////////////////////////////////////////////////////////
-//  More useful functions to implement:
-//
-//  To convert digits into bits:
-//      given X, compute X * log_2(10)
-//  To convert bits into digits:
-//      given X, compute X * log_10(2)
-//
-////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////
-// flrLg(x)
-//      returns floor log base 2 of abs(x)
-// CONVENTION lg(0) = -1	(Slight improvement, Zilin/Chee 8/5/02)
-////////////////////////////////////////////////////////////
-CGAL_INLINE_FUNCTION
-int flrLg(long x) {
-  if (x == LONG_MIN) {
-    // special treatment as -LONG_MIN would be not representable as "long"
-    return LONG_BIT - 1;
-  } else {
-    //  1 <= |x| <= LONG_MAX
-    if (x < 0)
-      x = - x;
-
-    int lg = -1;
-    while (x > 0) {
-      lg++;
-      x >>= 1;
-    }
-    return lg;
-  }
-}
-
-////////////////////////////////////////////////////////////
-// floor log base 2 of unsigned long x
-// CONVENTION lg(0) = -1	(Slight improvement, Zilin/Chee 8/5/02)
-////////////////////////////////////////////////////////////
-CGAL_INLINE_FUNCTION
-int flrLg(unsigned long x) {
-  int lg = -1;
-  while (x > 0) {
-    lg++;
-    x >>= 1;
-  }
-  return lg;
-}
-
-////////////////////////////////////////////////////////////
-// ceiling log base 2 of abs(x)
-// CONVENTION lg(0) = -1	(Slight improvement, Zilin/Chee 8/5/02)
-////////////////////////////////////////////////////////////
-CGAL_INLINE_FUNCTION
-int clLg(long x) {
-  if (x == LONG_MIN)
-    return LONG_BIT - 1;
-  if (x < 0)
-    x = -x; 		// use absolute value
-  if (x > (LONG_MAX >> 1)) 	// the leading data bit is 1
-    return (LONG_BIT - 1);	// exclude the sign bit
-  if (x >= 2)
-    return flrLg((unsigned long)((x << 1) - 1));
-  // SINCE ceilLog_2(x) = floorLog_2(2x-1) for x>=2
-  if (x == 1)
-    return 0;
-  return -1;			// x must be 0 here
-}
-
-////////////////////////////////////////////////////////////
-// ceiling log base 2 of unsigned long x
-// CONVENTION lg(0) = -1
-////////////////////////////////////////////////////////////
-CGAL_INLINE_FUNCTION
-int clLg(unsigned long x) {
-  if (x > (ULONG_MAX >> 1))	// the leading bit is 1
-    return LONG_BIT;
-  if (x >= 2)
-    return flrLg((x << 1) - 1);
-  // SINCE ceilLog_2(x) = floorLog_2(2x-1) for x>=2.
-  if (x == 1)
-    return 0;
-  return -1;	// x must be equal to 0
-}
-
-/// gcd for machine type long
-/** This is needed when we construct Polynomials with int or long coefficients */
-CGAL_INLINE_FUNCTION
-long gcd(long m, long n) {
-  if (m == 0)
-    return core_abs(n);
-  if (n == 0)
-    return core_abs(m);
-  long p = core_abs(m);
-  long q = core_abs(n);
-  if (p<q)
-    core_swap(p, q);
-  while (q>0) {
-    long r = p % q;
-    p = q;
-    q = r;
-  }
-  return p;
-}
-
-// return a gmp_randstate_t structure
-CGAL_INLINE_FUNCTION
-gmp_randstate_t* getRandstate() {
-  static gmp_randstate_t rstate;
-  static bool initialized = false;
-  if (!initialized) {
-    gmp_randinit(rstate, GMP_RAND_ALG_DEFAULT, 32L);
-    initialized = true;
-  }
-  return &rstate;
-}
-
-// char* core_itoa(int n, char* buffer)
-//      returns a pointer to the null-terminated string in buffer
-// NOTES:
-// 0. Buffer size should be 17 bytes (resp., 33 bytes, 65 bytes) on 16-bit
-//      (resp., 32-bit, 64-bit) machines.  Formula: 1+sizeof(int)*8 bytes.
-// 1. itoa(...) is available on some stdlib.h, but it is
-//      not defined by ANSI-C and so not all compilers support it.
-// 2. Our use of sprintf(...) to do the job is known to
-//      be inefficient, but this is hardly critical for our usage.
-// 3. A more general program should take a 3rd argument (the radix of
-//      output number).  We assume radix 10.
-CGAL_INLINE_FUNCTION
-char * core_itoa(int n, char* buffer) {
-	std::sprintf(buffer, "%d", n);
-	return buffer;
-}
-
-/// implements the "integer mantissa" function
-//      (See CORE_PATH/progs/ieee/frexp.cpp for details)
-CGAL_INLINE_FUNCTION
-double IntMantissa(double d) {
-	int e;
-	return std::ldexp(std::frexp(d, &e), 53);
-}
-
-/// implements the "integer exponent" function
-//      (See CORE_PATH/progs/ieee/frexp.cpp for details)
-CGAL_INLINE_FUNCTION
-int IntExponent(double d) {
-	int e;
-	std::frexp(d, &e);
-	return e-53;
-}
-
-/// CORE_DIAGFILE is file name for core_error(..) output.
-const char* CORE_DIAGFILE = "Core_Diagnostics";  // global file name 
-
-/// core_error is the method to write Core Library warning or error messages
-/** 	Both warnings and errors are written to a file called CORE_DIAGFILE.
- *	But errors are also written on std:cerr (similar to std::perror()).
- * */
-// Usage: core_error(message, file_with_error, line_number, err_type)
-//   where err_type=0 means WARNING, error_type=0 means ERROR
-CGAL_INLINE_FUNCTION 
-void core_error(std::string msg, std::string file, int lineno, bool err) {
-  std::ofstream outFile(CORE_DIAGFILE, std::ios::app);  // open to append
-  if (!outFile) {
-     // perror("CORE ERROR: cannot open Core Diagnostics file");
-     std::cerr << "CORE ERROR: can't open Core Diagnostics file"<<std::endl;
-     std::exit(1); //Note: do not call abort()
-  }
-  outFile << "CORE " << (err? "ERROR" : "WARNING")
-     << " (at " << file << ": " << lineno << "): "
-     << msg << std::endl;
-  outFile.close();
-  if (err) {
-     char buf[65];
-     // perror((std::string("CORE ERROR") + " (file " + file + ", line "
-     //        + core_itoa(lineno,buf) +"):" + msg + "\n").c_str());
-     std::cerr << (std::string("CORE ERROR") + " (file " + file + ", line "
-             + core_itoa(lineno,buf) +"):" + msg + "\n").c_str();
-     std::exit(1); //Note: do not call abort()
-  }
-}
-
-
-} //namespace CORE
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/Expr_impl.h b/3rdparty/CGAL-4.8/include/CGAL/CORE/Expr_impl.h
deleted file mode 100644
index 5cd7a68..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/CORE/Expr_impl.h
+++ /dev/null
@@ -1,1255 +0,0 @@
-/****************************************************************************
- * Core Library Version 1.7, August 2004
- * Copyright (c) 1995-2004 Exact Computation Project
- * 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.
- *
- *
- * File: Expr.cpp
- *
- * Written by 
- *       Koji Ouchi <ouchi at simulation.nyu.edu>
- *       Chee Yap <yap at cs.nyu.edu>
- *       Igor Pechtchanski <pechtcha at cs.nyu.edu>
- *       Vijay Karamcheti <vijayk at cs.nyu.edu>
- *       Chen Li <chenli at cs.nyu.edu>
- *       Zilin Du <zilin at cs.nyu.edu>
- *       Sylvain Pion <pion at cs.nyu.edu> 
- *
- * WWW URL: http://cs.nyu.edu/exact/
- * Email: exact at cs.nyu.edu
- *
- * $URL$
- * $Id$
- ***************************************************************************/
-
-#ifdef CGAL_HEADER_ONLY
-#define CGAL_INLINE_FUNCTION inline
-#else
-#define CGAL_INLINE_FUNCTION
-#endif
-
-#include <CGAL/CORE/Expr.h>
-#include <cmath>
-
-namespace CORE { 
-
-#if defined(CORE_DEBUG_BOUND) && !defined(CGAL_HEADER_ONLY)
-unsigned int BFMSS_counter = 0;
-unsigned int BFMSS_only_counter = 0;
-unsigned int Measure_counter = 0;
-unsigned int Measure_only_counter = 0;
-unsigned int Cauchy_counter = 0;
-unsigned int Cauchy_only_counter = 0;
-unsigned int LiYap_counter = 0;
-unsigned int LiYap_only_counter = 0;
-unsigned int rootBoundHitCounter = 0;
-unsigned int computeBoundCallsCounter = 0;
-#endif
-
-#ifndef CGAL_HEADER_ONLY
-const char* Add::name = "+";
-const char* Sub::name = "-";
-#endif
-
-/********************************************************
- *  class Expr
- ********************************************************/
-CGAL_INLINE_FUNCTION
-const Expr& Expr::getZero() {
-  static Expr Zero(0);
-  return Zero;
-}
-CGAL_INLINE_FUNCTION
-const Expr& Expr::getOne() {
-  static Expr One(1);
-  return One;
-}
-
-// computes an interval comprising a pair of doubles
-// Note:
-//
-// This function returns are two consecutive representable binary
-// IEEE double values whichs contain the real value, but when you print out
-// them, you might be confused by the decimal represention due to round.
-//
-CGAL_INLINE_FUNCTION
-void Expr::doubleInterval(double & lb, double & ub) const {
-  double d = doubleValue();
-  if (! CGAL_CORE_finite(d)) {	// if overflow, underflow or NaN
-    lb = ub = d;
-    return;
-  }
-  int sign = ((* this) -Expr(d)).sign();
-  // Seems like doubleValue() always give a lower bound,
-  // 	so sign = 0 or 1 (never -1).
-  //std::cout << "Sign = " << sign << std::endl;
-  if (sign == 0) {
-    lb = ub = d;
-    return;
-  }
-  int exp;
-  frexp(d, & exp);  	// get the exponent of d
-  exp--;		// the exp from frexp satisfies
-  //     2^{exp-1} <= d < 2^{exp}
-  // But, we want exp to satisfy
-  //     2^{exp} <= d < 2^{exp+1}
-  if (sign > 0) {
-    lb = d;
-    ub = d + ldexp(1.0, -52+exp);
-    return;
-  } else {
-    ub = d;
-    lb = d - ldexp(1.0, -52+exp);
-    return;
-  }
-}
-
-// floor(e, sub) returns the floor(e), and puts the
-//      remainder into sub.
-CGAL_INLINE_FUNCTION
-BigInt floor(const Expr& e, Expr &sub) {
-  if (e==0) {
-	  return 0;
-  }
-  BigInt f = e.approx(CORE_INFTY, 2).BigIntValue();
-  sub = e-f;
-  // Adjustment
-  if (sub<0)
-    ++sub, --f;
-  if (sub>=1)
-    --sub, ++f;
-  assert(sub >=0 && sub<1); // got an assertion error? (Chee 3/24/04)
-  return f;
-}
-
-// Chenli: implemented algorithm from Goldberg's article.
-// 7/01: Thanks to Serge Pashkov for fixing infinite loop when n=0.
-CGAL_INLINE_FUNCTION
-Expr pow(const Expr& e, unsigned long n) {
-  if (n == 0)
-    return Expr(1);
-  else if (n == 1)
-    return e;
-  else {
-    Expr x = e;
-    while ((n % 2) == 0) { // n is even
-      x *= x;
-      n >>= 1;
-    }
-    Expr u = x;
-    while (true) {
-      n >>= 1;
-      if (n == 0)
-        return u;
-      x *= x;
-      if ((n % 2) == 1) // n is odd
-        u *= x;
-    }
-    //return u; // unreachable
-  }
-}//pow
-
-CGAL_INLINE_FUNCTION
-NodeInfo::NodeInfo() : appValue(CORE_REAL_ZERO), appComputed(false),
-    flagsComputed(false), knownPrecision(CORE_negInfty),
-#ifdef CORE_DEBUG
-    relPrecision(EXTLONG_ZERO), absPrecision(CORE_negInfty), numNodes(0),
-#endif
-    // Most of the following data members don't need to be
-    // initialized here.
-    d_e(EXTLONG_ZERO), visited(false), sign(0),
-    uMSB(CORE_negInfty), lMSB(CORE_negInfty),
-    // length(0),
-    measure(EXTLONG_ZERO), high(EXTLONG_ZERO), low(EXTLONG_ONE),
-    lc(EXTLONG_ZERO), tc(EXTLONG_ZERO),
-    v2p(EXTLONG_ZERO), v2m(EXTLONG_ZERO),
-    v5p(EXTLONG_ZERO), v5m(EXTLONG_ZERO),
-    u25(EXTLONG_ZERO), l25(EXTLONG_ZERO),
-    ratFlag(0), ratValue(NULL) { }
-
-/********************************************************
- *  class ExprRep
- ********************************************************/
-//  constructor
-CGAL_INLINE_FUNCTION
-ExprRep::ExprRep() : refCount(1), nodeInfo(NULL), ffVal(0.0) { }
-
-// Computes the root bit bound of the expression.
-// In effect, computeBound() returns the current value of low.
-CGAL_INLINE_FUNCTION
-extLong ExprRep::computeBound() {
-  extLong measureBd = measure();
-  // extLong cauchyBd = length();
-  extLong ourBd = (d_e() - EXTLONG_ONE) * high() + lc();
-  // BFMSS[2,5] bound.
-  extLong bfmsskBd;
-  if (v2p().isInfty() || v2m().isInfty())
-    bfmsskBd = CORE_INFTY;
-  else
-    bfmsskBd = l25() + u25() * (d_e() - EXTLONG_ONE) - v2() - ceilLg5(v5());
-
-  // since we might compute \infty - \infty for this bound
-  if (bfmsskBd.isNaN())
-    bfmsskBd = CORE_INFTY;
-
-  extLong bd = core_min(measureBd,
-                        // core_min(cauchyBd,
-                        core_min(bfmsskBd, ourBd));
-#ifdef CORE_SHOW_BOUNDS
-    std::cout << "Bounds (" << measureBd <<
-                    "," << bfmsskBd << ", " << ourBd << "),  ";
-    std::cout << "MIN = " << bd << std::endl;
-    std::cout << "d_e= " << d_e() << std::endl;
-#endif
-
-#if defined(CORE_DEBUG_BOUND) && !defined(CGAL_HEADER_ONLY)
-  // Some statistics about which one is/are the winner[s].
-  computeBoundCallsCounter++;
-  int number_of_winners = 0;
-  std::cerr << " New contest " << std::endl;
-  if (bd == bfmsskBd) {
-    BFMSS_counter++;
-    number_of_winners++;
-    std::cerr << " BFMSS is the winner " << std::endl;
-  }
-  if (bd == measureBd) {
-    Measure_counter++;
-    number_of_winners++;
-    std::cerr << " measureBd is the winner " << std::endl;
-  }
-  /*  if (bd == cauchyBd) {
-      Cauchy_counter++;
-      number_of_winners++;
-      std::cerr << " cauchyBd is the winner " << std::endl;
-    }
-   */
-  if (bd == ourBd) {
-    LiYap_counter++;
-    number_of_winners++;
-    std::cerr << " ourBd is the winner " << std::endl;
-  }
-
-  assert(number_of_winners >= 1);
-
-  if (number_of_winners == 1) {
-    if (bd == bfmsskBd) {
-      BFMSS_only_counter++;
-      std::cerr << " BFMSSBd is the only winner " << std::endl;
-    } else if (bd == measureBd) {
-      Measure_only_counter++;
-      std::cerr << " measureBd is the only winner " << std::endl;
-    }
-    /* else if (bd == cauchyBd) {
-      Cauchy_only_counter++;
-      std::cerr << " cauchyBd is the only winner " << std::endl;
-    } */
-    else if (bd == ourBd) {
-      LiYap_only_counter++;
-      std::cerr << " ourBd is the only winner " << std::endl;
-    }
-  }
-#endif
-
-  return bd;
-}//computeBound()
-
-CGAL_INLINE_FUNCTION
-void ExprRep::reduceToBigRat(const BigRat& rat) {
-  Real value(rat);
-
-  //appValue() = value;
-  appComputed() = false; // since appValue is not assigned until approx() is called
-  flagsComputed() = true;
-  knownPrecision() = CORE_negInfty;
-
-#ifdef CORE_DEBUG
-  relPrecision() = EXTLONG_ZERO;
-  absPrecision() = CORE_negInfty;
-  //numNodes() = numNodes();
-#endif
-
-  d_e() = EXTLONG_ONE;
-  //visited() = e->visited();
-  sign() = value.sign();
-  uMSB() = value.MSB();
-  lMSB() = value.MSB();
-  // length() = value.length(); 	// fixed? original = 1
-  measure() = value.height();		// measure <= height for rational value
-
-  // BFMSS[2,5] bound.
-  value.ULV_E(u25(), l25(), v2p(), v2m(), v5p(), v5m());
-
-  extLong u_e = u25() + v2p();
-  extLong l_e = l25() + v2m();
-
-  u_e = u_e + ceilLg5(v5p());
-  l_e = l_e + ceilLg5(v5m());
-
-  if (l_e == EXTLONG_ZERO) {           // no divisions introduced
-    high() = u_e;
-    low() = EXTLONG_ONE - u_e; // - (u_e - 1)
-  } else {
-    high() = u_e - l_e + EXTLONG_ONE;
-    low() = 2 - high();
-  }
-
-  lc() = l_e;
-  tc() = u_e;
-
-  if (ratValue() == NULL)
-    ratValue() = new BigRat(rat);
-  else
-    *(ratValue()) = rat;
-}
-
-// This only copies the current information of the argument e to
-// 	*this ExprRep.
-CGAL_INLINE_FUNCTION
-void ExprRep::reduceTo(const ExprRep *e) {
-  if (e->appComputed()) {
-    appValue() = e->appValue();
-    appComputed() = true;
-    flagsComputed() = true;
-    knownPrecision() = e->knownPrecision();
-#ifdef CORE_DEBUG
-    relPrecision() = e->relPrecision();
-    absPrecision() = e->absPrecision();
-    numNodes() = e->numNodes();
-#endif
-
-  }
-  d_e() = e->d_e();
-  //visited() = e->visited();
-  sign() = e->sign();
-  uMSB() = e->uMSB();
-  lMSB() = e->lMSB();
-  // length() = e->length(); 	// fixed? original = 1
-  measure() = e->measure();
-
-  // BFMSS[2,5] bound.
-  u25() = e->u25();
-  l25() = e->l25();
-  v2p() = e->v2p();
-  v2m() = e->v2m();
-  v5p() = e->v5p();
-  v5m() = e->v5m();
-
-  high() = e->high();
-  low() = e->low();		// fixed? original = 0
-  lc() = e->lc();
-  tc() = e->tc();
-
-  // Chee (Mar 23, 2004), Notes on ratFlag():
-  // ===============================================================
-  // For more information on the use of this flag, see progs/pentagon.
-  // This is an integer valued member of the NodeInfo class.
-  // Its value is used to determine whether
-  // we can ``reduce'' an Expression to a single node containing
-  // a BigRat value.  This reduction is done if the global variable
-  // get_static_rationalReduceFlag()=true.  The default value is false.
-  // This is the intepretation of ratFlag:
-  //	ratFlag < 0 means irrational
-  //	ratFlag = 0 means not initialized
-  //	ratFlag > 0 means rational
-  // Currently, ratFlag>0 is an upper bound on the size of the expression,
-  // since we recursively compute
-  // 		ratFlag(v) = ratFlag(v.lchild)+ratFlag(v.rchild) + 1.
-  // PROPOSAL: if ratFlag() > RAT_REDUCE_THRESHHOLD
-  // 	then we automatically do a reduction.  We must determine
-  // 	an empirical value for RAT_REDUCE_THRESHOLD
-
-  if (get_static_rationalReduceFlag()) {
-    ratFlag() = e->ratFlag();
-
-    if (e->ratFlag() > 0 && e->ratValue() != NULL) {
-      ratFlag() ++;
-      if (ratValue() == NULL)
-        ratValue() = new BigRat(*(e->ratValue()));
-      else
-        *(ratValue()) = *(e->ratValue());
-    } else
-      ratFlag() = -1;
-  }
-}
-
-CGAL_INLINE_FUNCTION
-void ExprRep::reduceToZero() {
-  appValue() = CORE_REAL_ZERO;
-  appComputed() = true;
-  flagsComputed() = true;
-  knownPrecision() = CORE_negInfty;
-#ifdef CORE_DEBUG
-  relPrecision() = EXTLONG_ZERO;
-  absPrecision() = CORE_negInfty;
-  //  numNodes() = 0;
-#endif
-
-  d_e() = EXTLONG_ONE;
-  visited() = false;
-  sign() = 0;
-  uMSB() = CORE_negInfty;
-  lMSB() = CORE_negInfty;
-  // length() = 0; 	// fixed? original = 1
-  measure() = EXTLONG_ZERO;
-
-  // BFMSS[2,5] bound.
-  u25() = l25() = v2p() = v2m() = v5p() = v5m() = EXTLONG_ZERO;
-
-  low() = EXTLONG_ONE;		// fixed? original = 0
-  high() = lc() = tc() = EXTLONG_ZERO;
-
-  if (get_static_rationalReduceFlag()) {
-    if (ratFlag() > 0) {
-      ratFlag() ++;
-      if (ratValue() == NULL)
-        ratValue() = new BigRat(0);
-      else
-        *(ratValue()) = 0;
-    } else
-      ratFlag() = 1;
-  }
-}
-
-////////////////////////////////////////////////////////////
-//  Test whether the current approximate value satisfies
-//  the composite precision requirements [relPrec, absPrec].
-////////////////////////////////////////////////////////////
-
-CGAL_INLINE_FUNCTION
-bool ExprRep::withinKnownPrecision(const extLong& relPrec,
-                                   const extLong& absPrec) {
-  if (appComputed()) { // an approximate value has been evaluated.
-    if (appValue().isExact()) {
-      return true;
-    } else { // approximation has certain error.
-      // decide to which position it is required to compute correctly.
-      extLong required = core_max(-absPrec, appValue().lMSB()-relPrec);
-      // see whether the existing error is smaller than the requirement.
-      return (knownPrecision() <= required);
-    }
-  } else
-    return false;
-}//withinKnownPrecision(a, r)
-
-// approximate the expression to certain precisions when
-// necessary (either no approximate value available or
-// the existing one is not accurate enough).
-CGAL_INLINE_FUNCTION
-void ExprRep::approx(const extLong& relPrec = get_static_defRelPrec(),
-                     const extLong& absPrec = get_static_defAbsPrec()) {
-  if (!getSign())
-    return; // if it is exactly zero...
-
-  // NOTE: The Filter might give a precise enough approximation already.
-  if (!getExactSign())
-    return;
-
-  if (!appComputed() || (!withinKnownPrecision(relPrec, absPrec))) {
-    // it's necessary to re-evaluate.
-    // to avoid huge lMSB which would cause long time and problems.
-
-    // if it is a rational node
-    if (get_static_rationalReduceFlag() && ratFlag() > 0 && ratValue() != NULL)
-      appValue() = Real(*(ratValue())).approx(relPrec, absPrec); //< shouldn't
-                         // this case be done by computeApproxValue()?
-    else
-      computeApproxValue(relPrec, absPrec);
-
-    // update flags
-    appComputed() = true;
-    knownPrecision() = appValue().clLgErr();
-#ifdef CORE_DEBUG
-    if (relPrecision() < relPrec)
-      relPrecision() = relPrec;
-    if (absPrecision() < absPrec)
-      absPrecision() = absPrec;
-#endif
-
-  }
-}
-
-// return an approximate value to certain precision.
-CGAL_INLINE_FUNCTION
-const Real& ExprRep::getAppValue(const extLong& relPrec,
-		const extLong& absPrec) {
-  if (getSign()) {
-    approx(relPrec, absPrec);
-    return appValue();
-  } else
-    return CORE_REAL_ZERO;
-}
-
-CGAL_INLINE_FUNCTION
-std::ostream& operator<<(std::ostream& o, ExprRep& rep) {
-  if (rep.getSign()) {
-    rep.approx(get_static_defRelPrec(), get_static_defAbsPrec());
-    o << rep.appValue();
-  } else {
-    o << "0";
-  }
-  return o;
-}
-
-// Chee, Zilin: July 17, 2002
-//  Original algorithm is wrongly implemented, and can take time
-//	 exponential in the size of the dag.
-//
-//  METHOD:
-//	Inductively assume that all "visited" flags are false.
-//	This calls for a reimplementation of "count()" and "clearFlag()".
-//	Actually, we did not have to fix the count() function.
-//
-//  (1) First recursively compute d_e for each node
-//		by calling the count() function.
-//	Important thing is count() will turn the "visited" flags
-//		to be true, so that there is no double counting.
-//	Furthermore, if d_e had already been computed, the
-//		arithmetic for d_e can be avoided (in this case,
-//		it is only the setting of "visited" flag that we
-//		are interested in!
-//  (2) At the end of count(), we have set all reachable nodes
-//		to "visited", and their d_e have been computed.
-//  (3) Now, call clearFlag() to recursively clear all reachable
-//		nodes.  NOTE THAT PREVIOUSLY, clearFlag() was called
-//		first!  This obvious is wrong
-
-CGAL_INLINE_FUNCTION
-extLong ExprRep::degreeBound() {
-  if (d_e() == EXTLONG_ONE) // no radical nodes below
-    return EXTLONG_ONE;
-  count();
-  clearFlag();
-  return d_e();
-}
-//  class ConstRealRep
-//  constructor
-CGAL_INLINE_FUNCTION
-ConstRealRep::ConstRealRep(const Real & r) : value(r) {
-  if (!value.isExact()) {
-    // clone the BigFloat and set its error to zero.
-    value = value.BigFloatValue().makeExact();
-  }
-  ffVal = filteredFp(value);
-}
-
-// initialize nodeInfo
-CGAL_INLINE_FUNCTION
-void ConstRep::initNodeInfo() {
-  nodeInfo = new NodeInfo();
-  d_e() = EXTLONG_ONE;
-}
-CGAL_INLINE_FUNCTION
-void UnaryOpRep::initNodeInfo() {
-  if (child->nodeInfo == NULL)
-    child->initNodeInfo();
-  nodeInfo = new NodeInfo();
-}
-CGAL_INLINE_FUNCTION
-void BinOpRep::initNodeInfo() {
-  if (first->nodeInfo == NULL)
-    first->initNodeInfo();
-  if (second->nodeInfo == NULL)
-    second->initNodeInfo();
-  nodeInfo = new NodeInfo();
-}
-
-#ifdef CORE_DEBUG
-CGAL_INLINE_FUNCTION
-unsigned long ConstRep::dagSize() {
-  if (!visited()) {
-    visited() = true;
-    numNodes() = 1;
-  } else
-    numNodes() = 0;
-  return numNodes();
-}
-
-CGAL_INLINE_FUNCTION
-unsigned long UnaryOpRep::dagSize() {
-  if (!visited()) {
-    visited() = true;
-    numNodes() = child->dagSize() + 1;
-  } else
-    numNodes() = 0;
-  return numNodes();
-}
-
-CGAL_INLINE_FUNCTION
-unsigned long BinOpRep::dagSize() {
-  if (!visited()) {
-    visited() = true;
-    numNodes() = first->dagSize() + second->dagSize() + 1;
-  } else
-    numNodes() = 0;
-  return numNodes();
-}
-
-CGAL_INLINE_FUNCTION
-void ConstRep::fullClearFlag() {
-  if (visited())
-    visited() = false;
-}
-
-CGAL_INLINE_FUNCTION
-void UnaryOpRep::fullClearFlag() {
-  if (visited()) {
-    child->fullClearFlag();
-    visited() = false;
-  }
-}
-
-CGAL_INLINE_FUNCTION
-void BinOpRep::fullClearFlag() {
-  if (visited()) {
-    first->fullClearFlag();
-    second->fullClearFlag();
-    visited() = false;
-  }
-}
-#endif
-
-//
-// clear visited flag
-//
-/* see Expr.h
-  void ConstRep::clearFlag()
-  { visited = false; }
-*/
-CGAL_INLINE_FUNCTION
-void UnaryOpRep::clearFlag() {
-  if (d_e() == EXTLONG_ONE)
-    return; // no radicals below.
-  if (visited()) {
-    visited() = false;
-    child->clearFlag();
-  }
-}
-//  class BinOpRep
-CGAL_INLINE_FUNCTION
-void BinOpRep::clearFlag() {
-  if (d_e() == EXTLONG_ONE)
-    return; // rational below
-  if (visited()) {
-    visited() = false;
-    first->clearFlag();
-    second->clearFlag();
-  }
-}
-
-//
-// count # of squareroot
-//
-CGAL_INLINE_FUNCTION
-extLong ConstRep::count() {
-  if (visited())
-    return EXTLONG_ONE;
-  visited() = true;
-  return d_e();
-}
-
-CGAL_INLINE_FUNCTION
-extLong NegRep::count() {
-  if (d_e() == EXTLONG_ONE)
-    return EXTLONG_ONE;
-  if (visited())
-    return EXTLONG_ONE;
-  visited() = true;
-  d_e() = child->count();
-  return d_e();
-}
-
-CGAL_INLINE_FUNCTION
-extLong SqrtRep::count() {
-  if (d_e() == EXTLONG_ONE)
-    return EXTLONG_ONE;
-  if (visited())
-    return EXTLONG_ONE;
-  visited() = true;
-  d_e() = child->count() * EXTLONG_TWO;
-  return d_e();
-}
-
-CGAL_INLINE_FUNCTION
-extLong BinOpRep::count() {
-  if (d_e() == EXTLONG_ONE)
-    return EXTLONG_ONE;
-  if (visited())
-    return EXTLONG_ONE;
-  visited() = true;
-  d_e() = first->count() * second->count();
-  return d_e();
-}
-
-//
-// compute exact flags functions
-//
-//  exact value
-
-CGAL_INLINE_FUNCTION
-void computeExactFlags_temp(ConstRep* t, const Real &value) {
-  // Chen Li: the following is incorrect:
-  //    uMSB = lMSB = value.MSB();
-  // because the value could be a BigFloat which is an interval.
-  if (value.isExact()) {
-    t->uMSB() = t->lMSB() = value.MSB();
-  } else {
-    t->uMSB() = value.uMSB();
-    t->lMSB() = value.lMSB();
-    core_error("Leaves in DAG is not exact!", __FILE__, __LINE__, true);
-  }
-
-  t->sign() = value.sign();
-  // t->length() = value.length();
-  t->measure() = value.height(); // for rationals and integers,
-  // measure = height.
-
-  // BFMSS[2,5] bound.
-  value.ULV_E(t->u25(), t->l25(), t->v2p(), t->v2m(), t->v5p(), t->v5m());
-
-  // The original BFMSS parameters can be set from the BFMSS[2,5] parameters.
-  // Here we just need them locally.
-  extLong u_e = t->u25() + t->v2p() + ceilLg5(t->v5p());
-  extLong l_e = t->l25() + t->v2m() + ceilLg5(t->v5m());
-
-#ifdef ORIGINAL_BFMSS
-  // To go back to the original BFMSS :
-  t->u25() = u_e;
-  t->l25() = l_e;
-  t->v2p() = t->v2m() = t->v5p() = t->v5m() = EXTLONG_ZERO;
-#elif defined BFMSS_2_ONLY
-  // To go back to BFMSS[2] only :
-  t->u25() = t->u25() + ceilLg5(t->v5p());
-  t->l25() = t->l25() + ceilLg5(t->v5m());
-  t->v5p() = t->v5m() = EXTLONG_ZERO;
-#endif
-
-  if (l_e == EXTLONG_ZERO) {           // no divisions introduced
-    t->high() = u_e;
-    t->low() = EXTLONG_ONE - u_e; // - (u_e - 1)
-  } else {
-    t->high() = u_e - l_e + EXTLONG_ONE;
-    t->low() = EXTLONG_TWO - t->high();
-  }
-
-  t->lc() = l_e;
-  t->tc() = u_e;
-
-  // set BigRat value
-  if (get_static_rationalReduceFlag()) {
-    t->ratFlag() = 1;
-    t->ratValue() = new BigRat(value.BigRatValue());
-  }
-
-  t->flagsComputed() = true;
-}
-
-CGAL_INLINE_FUNCTION
-void ConstDoubleRep::computeExactFlags() {// can be made more efficient
-  computeExactFlags_temp(this, Real(ffVal.getValue()));
-}
-
-CGAL_INLINE_FUNCTION
-void ConstRealRep::computeExactFlags() {
-  computeExactFlags_temp(this, value);
-}
-
-CGAL_INLINE_FUNCTION
-void NegRep::computeExactFlags() {
-  if (!child->flagsComputed())
-    child->computeExactFlags();
-
-  if (child->sign() == 0) {
-    reduceToZero();
-    return;
-  }
-
-  if (get_static_rationalReduceFlag()) {
-    if (child->ratFlag()>0 && child->ratValue() != NULL) {
-      BigRat val = -(*(child->ratValue()));
-      reduceToBigRat(val);
-      ratFlag() = child->ratFlag()+1;
-      return;
-    } else
-      ratFlag() = -1;
-  }
-
-  sign() = -child->sign();
-  uMSB() = child->uMSB();
-  lMSB() = child->lMSB();
-
-  // length() = child->length();
-  measure() = child->measure();
-  u25() = child->u25();
-  l25() = child->l25();
-  v2p() = child->v2p();
-  v2m() = child->v2m();
-  v5p() = child->v5p();
-  v5m() = child->v5m();
-  high() = child->high();
-  low() = child->low();
-  lc()  = child->lc();
-  tc()  = child->tc();
-  flagsComputed() = true;
-}//NegRep::computeExactFlags
-
-CGAL_INLINE_FUNCTION
-void SqrtRep::computeExactFlags() {
-  if (!child->flagsComputed())
-    child->computeExactFlags();
-
-  if (get_static_rationalReduceFlag())
-    ratFlag() = -1;
-
-  sign() = child->sign();
-  if (sign() < 0)
-    core_error("squareroot is called with negative operand.",
-               __FILE__, __LINE__, true);
-
-  uMSB() = child->uMSB() / EXTLONG_TWO;
-  lMSB() = child->lMSB() / EXTLONG_TWO;
-
-  // length() = child->length();
-  measure() = child->measure();
-
-  // BFMSS[2,5] bound.
-  if (child->v2p() + ceilLg5(child->v5p()) + child->u25() >=
-      child->v2m() + ceilLg5(child->v5m()) + child->l25()) {
-    extLong vtilda2 = child->v2p() + child->v2m();
-    v2p() = vtilda2 / EXTLONG_TWO;
-    v2m() = child->v2m();
-    extLong vmod2;
-    if (v2p().isInfty())
-      vmod2 = CORE_INFTY;
-    else
-      vmod2 = vtilda2 - EXTLONG_TWO*v2p(); // == vtilda2 % 2
-    extLong vtilda5 = child->v5p() + child->v5m();
-    v5p() = vtilda5 / EXTLONG_TWO;
-    v5m() = child->v5m();
-    extLong vmod5;
-    if (v5p().isInfty())
-      vmod5 = CORE_INFTY;
-    else
-      vmod5 = vtilda5 - EXTLONG_TWO*v5p(); // == vtilda5 % 2
-    u25() = (child->u25() + child->l25() + vmod2 + ceilLg5(vmod5) + EXTLONG_ONE) / EXTLONG_TWO;
-    l25() = child->l25();
-  } else {
-    extLong vtilda2 = child->v2p() + child->v2m();
-    v2p() = child->v2p();
-    v2m() = vtilda2 / EXTLONG_TWO;
-    extLong vmod2;
-    if (v2m().isInfty())
-      vmod2 = CORE_INFTY;
-    else
-      vmod2 = vtilda2 - EXTLONG_TWO*v2m(); // == vtilda2 % 2
-    extLong vtilda5 = child->v5p() + child->v5m();
-    v5p() = child->v5p();
-    v5m() = vtilda5 / EXTLONG_TWO;
-    u25() = child->u25();
-    extLong vmod5;
-    if (v5m().isInfty())
-      vmod5 = CORE_INFTY;
-    else
-      vmod5 = vtilda5 - EXTLONG_TWO*v5m(); // == vtilda5 % 2
-    l25() = (child->u25() + child->l25() + vmod2 + ceilLg5(vmod5) + EXTLONG_ONE) / EXTLONG_TWO;
-  }
-
-  high() = (child->high() +EXTLONG_ONE)/EXTLONG_TWO;
-  low() = child->low() / EXTLONG_TWO;
-  lc() = child->lc();
-  tc() = child->tc();
-  flagsComputed() = true;
-}// SqrtRep::computeExactFlags
-
-CGAL_INLINE_FUNCTION
-void MultRep::computeExactFlags() {
-  if (!first->flagsComputed())
-    first->computeExactFlags();
-  if (!second->flagsComputed())
-    second->computeExactFlags();
-
-  if ((!first->sign()) || (!second->sign())) {
-    // value must be exactly zero.
-    reduceToZero();
-    return;
-  }
-  // rational node
-  if (get_static_rationalReduceFlag()) {
-    if (first->ratFlag() > 0 && second->ratFlag() > 0) {
-      BigRat val = (*(first->ratValue()))*(*(second->ratValue()));
-      reduceToBigRat(val);
-      ratFlag() = first->ratFlag() + second->ratFlag();
-      return;
-    } else
-      ratFlag() = -1;
-  }
-
-  // value is irrational.
-  uMSB() = first->uMSB() + second->uMSB() + EXTLONG_ONE;
-  lMSB() = first->lMSB() + second->lMSB();
-  sign() = first->sign() * second->sign();
-
-  extLong df = first->d_e();
-  extLong ds = second->d_e();
-  // extLong lf = first->length();
-  // extLong ls = second->length();
-
-  // length() = df * ls + ds * lf;
-  measure() = (first->measure()) * ds+(second->measure()) * df;
-
-  // BFMSS[2,5] bound.
-  v2p() = first->v2p() + second->v2p();
-  v2m() = first->v2m() + second->v2m();
-  v5p() = first->v5p() + second->v5p();
-  v5m() = first->v5m() + second->v5m();
-  u25() = first->u25() + second->u25();
-  l25() = first->l25() + second->l25();
-
-  high() = first->high() + second->high();
-  low() = first->low() + second->low();
-
-  lc() = ds * first->lc() + df * second->lc();
-  tc() = core_min(ds * first->tc() + df * second->tc(), measure());
-
-  flagsComputed() = true;
-}// MultRep::computeExactFlags
-
-CGAL_INLINE_FUNCTION
-void DivRep::computeExactFlags() {
-  if (!first->flagsComputed())
-    first->computeExactFlags();
-  if (!second->flagsComputed())
-    second->computeExactFlags();
-
-  if (!second->sign())
-    core_error("zero divisor.", __FILE__, __LINE__, true);
-
-  if (!first->sign()) {// value must be exactly zero.
-    reduceToZero();
-    return;
-  }
-
-  // rational node
-  if (get_static_rationalReduceFlag()) {
-    if (first->ratFlag() > 0 && second->ratFlag() > 0) {
-      BigRat val = (*(first->ratValue()))/(*(second->ratValue()));
-      reduceToBigRat(val);
-      ratFlag() = first->ratFlag() + second->ratFlag();
-      return;
-    } else
-      ratFlag() = -1;
-  }
-
-  // value is irrational.
-  uMSB() = first->uMSB() - second->lMSB();
-  lMSB() = first->lMSB() - second->uMSB() - EXTLONG_ONE;
-  sign() = first->sign() * second->sign();
-
-  extLong df = first->d_e();
-  extLong ds = second->d_e();
-  // extLong lf = first->length();
-  // extLong ls = second->length();
-
-  // length() = df * ls + ds * lf;
-  measure() = (first->measure())*ds + (second->measure())*df;
-
-  // BFMSS[2,5] bound.
-  v2p() = first->v2p() + second->v2m();
-  v2m() = first->v2m() + second->v2p();
-  v5p() = first->v5p() + second->v5m();
-  v5m() = first->v5m() + second->v5p();
-  u25() = first->u25() + second->l25();
-  l25() = first->l25() + second->u25();
-
-  high() = first->high() + second->low();
-  low() = first->low() + second->high();
-
-  lc() = ds * first->lc() + df * second->tc();
-  tc() = core_min(ds * first->tc() + df * second->lc(), measure());
-
-  flagsComputed() = true;
-}
-
-//
-//  approximation functions
-//
-CGAL_INLINE_FUNCTION
-void ConstDoubleRep::computeApproxValue(const extLong& /*relPrec*/,
-                                        const extLong& /*absPrec*/)
-// can ignore precision bounds since ffVal.getValue() returns exact value
-{
-  appValue() = Real(ffVal.getValue());
-}
-
-CGAL_INLINE_FUNCTION
-void ConstRealRep::computeApproxValue(const extLong& relPrec,
-                                      const extLong& absPrec) {
-  appValue() = value.approx(relPrec, absPrec);
-}
-
-CGAL_INLINE_FUNCTION
-void NegRep::computeApproxValue(const extLong& relPrec,
-                                const extLong& absPrec) {
-  appValue() = -child->getAppValue(relPrec, absPrec);
-}
-
-CGAL_INLINE_FUNCTION
-void SqrtRep::computeApproxValue(const extLong& relPrec,
-                                 const extLong& absPrec) {
-  extLong r = relPrec + relPrec + EXTLONG_EIGHT; // chenli: ???
-  extLong a = absPrec + absPrec + EXTLONG_EIGHT;
-  extLong pr = - lMSB() + r;
-  extLong p  = pr < a ? pr : a;
-
-  Real val = child->getAppValue(r, a);
-  if (get_static_incrementalEvalFlag()) {
-    if (appValue() == CORE_REAL_ZERO)
-      appValue() = val;
-    appValue() = val.sqrt(p, appValue().BigFloatValue());
-  } else
-    appValue() = val.sqrt(p);
-}
-
-CGAL_INLINE_FUNCTION
-void MultRep::computeApproxValue(const extLong& relPrec,
-                                 const extLong& absPrec) {
-  if (lMSB() < EXTLONG_BIG && lMSB() > EXTLONG_SMALL) {
-    extLong r   = relPrec + EXTLONG_FOUR;
-    extLong  afr = - first->lMSB() + EXTLONG_ONE;
-    extLong  afa = second->uMSB() + absPrec + EXTLONG_FIVE;
-    extLong  af  = afr > afa ? afr : afa;
-    extLong  asr = - second->lMSB() + EXTLONG_ONE;
-    extLong  asa = first->uMSB() + absPrec + EXTLONG_FIVE;
-    extLong  as  = asr > asa ? asr : asa;
-    appValue() = first->getAppValue(r, af)*second->getAppValue(r, as);
-  } else {
-    std::cerr << "lMSB = " << lMSB() << std::endl;
-    core_error("a huge lMSB in MulRep", __FILE__, __LINE__, false);
-  }
-}
-
-CGAL_INLINE_FUNCTION
-void DivRep::computeApproxValue(const extLong& relPrec,
-                                const extLong& absPrec) {
-  if (lMSB() < EXTLONG_BIG && lMSB() > EXTLONG_SMALL) {
-    extLong rr  = relPrec + EXTLONG_SEVEN;		// These rules come from
-    extLong ra  = uMSB() + absPrec + EXTLONG_EIGHT;	// Koji's Master Thesis, page 65
-    extLong ra2 = core_max(ra, EXTLONG_TWO);
-    extLong r   = core_min(rr, ra2);
-    extLong  af  = - first->lMSB() + r;
-    extLong  as  = - second->lMSB() + r;
-
-    extLong pr = relPrec + EXTLONG_SIX;
-    extLong pa = uMSB() + absPrec + EXTLONG_SEVEN;
-    extLong p  = core_min(pr, pa);	// Seems to be an error:
-    // p can be negative here!
-    // Also, this does not conform to
-    // Koji's thesis which has a default
-    // relative precision (p.65).
-
-    appValue() = first->getAppValue(r, af).div(second->getAppValue(r, as), p);
-  } else {
-    std::cerr << "lMSB = " << lMSB() << std::endl;
-    core_error("a huge lMSB in DivRep", __FILE__, __LINE__, false);
-  }
-}
-
-//
-// Debug Help Functions
-//
-CGAL_INLINE_FUNCTION
-void Expr::debug(int mode, int level, int depthLimit) const {
-  std::cout << "-------- Expr debug() -----------" << std::endl;
-  std::cout << "rep = " << rep << std::endl;
-  if (mode == Expr::LIST_MODE)
-    rep->debugList(level, depthLimit);
-  else if (mode == Expr::TREE_MODE)
-    rep->debugTree(level, 0, depthLimit);
-  else
-    core_error("unknown debugging mode", __FILE__, __LINE__, false);
-  std::cout << "---- End Expr debug(): " << std::endl;
-}
-
-
-CGAL_INLINE_FUNCTION
-const std::string ExprRep::dump(int level) const {
-  std::ostringstream ost;
-  if (level == OPERATOR_ONLY) {
-    ost << op();
-  } else if (level == VALUE_ONLY) {
-    ost << appValue();
-  } else if (level == OPERATOR_VALUE) {
-    ost << op() << "[val: " << appValue() << "]";
-  } else if (level == FULL_DUMP) {
-    ost << op()
-    << "[val: "  << appValue() << "; "
-    << "kp: " << knownPrecision() << "; "
-#ifdef CORE_DEBUG
-    << "r: " << relPrecision() << "; "
-    << "a: " << absPrecision() << "; "
-#endif
-    << "lMSB: " << lMSB() << "; "
-    << "uMSB: " << uMSB() << "; "
-    << "sign: " << sign() << "; "
-    // << "length: " << length() << "; "
-    << "measure: " << measure() << "; "
-    << "d_e: " << d_e() << "; "
-    << "u25: " << u25() << "; "
-    << "l25: " << l25() << "; "
-    << "v2p: " << v2p() << "; "
-    << "v2m: " << v2m() << "; "
-    << "v5p: " << v5p() << "; "
-    << "v5m: " << v5m() << "; "
-    << "high: " << high() << "; "
-    << "low: " << low() << "; "
-    << "lc: " << lc() << "; "
-    << "tc: " << tc()
-    << "]";
-  }
-  return std::string(ost.str());
-  // note that str() return an array not properly terminated!
-}
-
-
-CGAL_INLINE_FUNCTION
-void UnaryOpRep::debugList(int level, int depthLimit) const {
-  if (depthLimit <= 0)
-    return;
-  if (level == Expr::SIMPLE_LEVEL) {
-    std::cout << "(" << dump(OPERATOR_VALUE);
-    child->debugList(level, depthLimit - 1);
-    std::cout << ")";
-  } else if (level == Expr::DETAIL_LEVEL) {
-    std::cout << "(" << dump(FULL_DUMP);
-    child->debugList(level, depthLimit - 1);
-    std::cout << ")";
-  }
-}
-
-CGAL_INLINE_FUNCTION
-void UnaryOpRep::debugTree(int level, int indent, int depthLimit) const {
-  if (depthLimit <= 0)
-    return;
-  for (int i = 0; i<indent; i++ )
-    std::cout << "  ";
-  std::cout << "|_";
-  if (level == Expr::SIMPLE_LEVEL)
-    std::cout << dump(OPERATOR_VALUE);
-  else if (level == Expr::DETAIL_LEVEL)
-    std::cout << dump(FULL_DUMP);
-  std::cout << std::endl;
-  child->debugTree(level, indent + 2, depthLimit - 1);
-}
-
-CGAL_INLINE_FUNCTION
-void ConstRep::debugList(int level, int depthLimit) const {
-  if (depthLimit <= 0)
-    return;
-  if (level == Expr::SIMPLE_LEVEL) {
-    std::cout << "(" << dump(OPERATOR_VALUE) << ")";
-  } else if (level == Expr::DETAIL_LEVEL) {
-    std::cout << "(" << dump(FULL_DUMP) << ")";
-  }
-}
-
-CGAL_INLINE_FUNCTION
-void ConstRep::debugTree(int level, int indent, int depthLimit) const {
-  if (depthLimit <= 0)
-    return;
-  for (int i=0; i<indent; i++)
-    std::cout << "  ";
-  std::cout << "|_";
-  if (level == Expr::SIMPLE_LEVEL)
-    std::cout << dump(OPERATOR_VALUE);
-  else if (level == Expr::DETAIL_LEVEL)
-    std::cout << dump(FULL_DUMP);
-  std::cout << std::endl;
-}
-
-CGAL_INLINE_FUNCTION
-void BinOpRep::debugList(int level, int depthLimit) const {
-  if (depthLimit <= 0 )
-    return;
-  std::cout << "(";
-  if (level == Expr::SIMPLE_LEVEL) {
-    std::cout << dump(OPERATOR_VALUE);
-  } else if (level == Expr::DETAIL_LEVEL) {
-    std::cout << dump(FULL_DUMP);
-  }
-  first->debugList(level, depthLimit - 1);
-  std::cout << ", ";
-  second->debugList(level, depthLimit - 1);
-  std::cout << ")" ;
-}
-
-CGAL_INLINE_FUNCTION
-void BinOpRep::debugTree(int level, int indent, int depthLimit) const {
-  if (depthLimit <= 0)
-    return;
-  for (int i=0; i<indent; i++)
-    std::cout << "  ";
-  std::cout << "|_";
-  if (level == Expr::SIMPLE_LEVEL) {
-    std::cout << dump(OPERATOR_VALUE);
-  } else if (level == Expr::DETAIL_LEVEL) {
-    std::cout << dump(FULL_DUMP);
-  }
-  std::cout << std::endl;
-  first->debugTree(level, indent + 2, depthLimit - 1);
-  second->debugTree(level, indent + 2, depthLimit - 1);
-}
-
-CORE_MEMORY_IMPL(BigIntRep)
-CORE_MEMORY_IMPL(BigRatRep)
-CORE_MEMORY_IMPL(ConstDoubleRep)
-CORE_MEMORY_IMPL(ConstRealRep)
-
-CORE_MEMORY_IMPL(NegRep)
-CORE_MEMORY_IMPL(SqrtRep)
-
-CORE_MEMORY_IMPL(MultRep)
-CORE_MEMORY_IMPL(DivRep)
-
-template <typename O>
-void * AddSubRep<O>::operator new( size_t size)
-{ return MemoryPool<AddSubRep<O> >::global_allocator().allocate(size); }
-
-template <typename O>
-void AddSubRep<O>::operator delete( void *p, size_t )
-{ MemoryPool<AddSubRep<O> >::global_allocator().free(p); }
-
-
-
-template <class T>
-void * Realbase_for<T>::operator new( size_t size)
-{ return MemoryPool<Realbase_for<T> >::global_allocator().allocate(size); }
-
-template <class T>
-void Realbase_for<T>::operator delete( void *p, size_t )
-{ MemoryPool<Realbase_for<T> >::global_allocator().free(p); }
-
- template class AddSubRep<Add>;
- template class AddSubRep<Sub>;
-
-template class Realbase_for<long>;
-template class Realbase_for<double>;
-template class Realbase_for<BigInt>;
-template class Realbase_for<BigRat>;
-template class Realbase_for<BigFloat>;
-
- template class ConstPolyRep<Expr>;
- template class ConstPolyRep<BigFloat>;
- template class ConstPolyRep<BigInt>;
- template class ConstPolyRep<BigRat>;
-} //namespace CORE
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/Impl.h b/3rdparty/CGAL-4.8/include/CGAL/CORE/Impl.h
deleted file mode 100644
index 57d47a3..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/CORE/Impl.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
- * Core Library Version 1.7, August 2004
- * Copyright (c) 1995-2004 Exact Computation Project
- * 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$
- ***************************************************************************/
-
-#ifndef _CORE_IMPL_H_
-#define _CORE_IMPL_H_
-
-#include <CGAL/CORE/Config.h>
-
-// The following lines only for MS Visual C++
-#ifdef _MSC_VER
-  #pragma warning(disable: 4291) // no matching operator delete found
-  #pragma warning(disable: 4146) 
-  #pragma warning(disable: 4267)
-  #pragma warning(disable: 4244) 
-#endif
-
-// condition preprocessor for inline function
-#ifndef CORE_DISABLE_INLINE
-  #define CORE_INLINE inline
-#else
-  #define CORE_INLINE
-#endif
-
-// Macros for memory pool
-#ifdef CORE_DISABLE_MEMORY_POOL
-  #define CORE_NEW(T)
-  #define CORE_DELETE(T)
-  #define CORE_MEMORY_IMPL(T)
-#else
-  #include <CGAL/CORE/MemoryPool.h>
-  #define CORE_NEW(T)  void *operator new( size_t size);
-  #define CORE_DELETE(T)  void operator delete( void *p, size_t );
-
-  #define CORE_MEMORY_IMPL(T)                                            \
-    void *T::operator new( size_t size)                                  \
-    { return MemoryPool<T>::global_allocator().allocate(size); }         \
-    void T::operator delete( void *p, size_t )                           \
-    { MemoryPool<T>::global_allocator().free(p); }
-#endif
-
-// include some common header files
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-#include <cmath>
-#include <cfloat>
-#include <cassert>
-#include <cctype>
-#include <climits>
-#include <iostream>
-#include <iomanip>
-#include <sstream>
-#include <string>
-
-#endif // _CORE_IMPL_H_
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/MemoryPool.h b/3rdparty/CGAL-4.8/include/CGAL/CORE/MemoryPool.h
deleted file mode 100644
index 4bb17e2..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/CORE/MemoryPool.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/****************************************************************************
- * Core Library Version 1.7, August 2004
- * Copyright (c) 1995-2004 Exact Computation Project
- * 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.
- *
- *
- * File: MemoryPool.h
- * Synopsis:
- *      a memory pool template class.
- * 
- * Written by 
- *       Zilin Du <zilin at cs.nyu.edu>
- *       Chee Yap <yap at cs.nyu.edu>
- *       Sylvain Pion <pion at cs.nyu.edu>
- *
- * WWW URL: http://cs.nyu.edu/exact/
- * Email: exact at cs.nyu.edu
- *
- * $URL$
- * $Id$
- ***************************************************************************/
-#ifndef _CORE_MEMORYPOOL_H_
-#define _CORE_MEMORYPOOL_H_
-
-#include <new>           // for placement new
-#include <cassert>
-#include <CGAL/assertions.h>
-#include <vector>
-
-namespace CORE { 
-
-#define CORE_EXPANSION_SIZE 1024
-template< class T, int nObjects = CORE_EXPANSION_SIZE >
-class MemoryPool {
-private:
-   struct Thunk {
-      T object;
-      Thunk* next;
-   };
-
-public:
-   MemoryPool() : head( 0 ) {}
-
-  ~MemoryPool()
-  {
-    //CGAL_warning_code(
-      std::size_t count = 0;
-      Thunk* t = head;
-      while(t!=0){
-	++count;
-	t = t->next;
-      }
-    //);
-    //CGAL_warning_msg(count ==  nObjects * blocks.size(),
-    //                 "Cannot delete memory as there are cyclic references");
-
-    if(count ==  nObjects * blocks.size()){
-      for(std::size_t i=0; i < blocks.size();i++){
-        ::operator delete(blocks[i]);
-      }
-    }
-  }
-
-
-   void* allocate(std::size_t size);
-   void free(void* p);
-
-  // Access the corresponding static global allocator.
-  static MemoryPool<T>& global_allocator() {
-    return memPool;
-  }
- 
-private:
-   Thunk* head; // next available block in the pool
-  std::vector<void*> blocks;
-
-private:
-  // Static global allocator.
-  static MemoryPool<T, nObjects> memPool;   
-};
-
-template <class T, int nObjects >
-MemoryPool<T, nObjects> MemoryPool<T, nObjects>::memPool;
-
-template< class T, int nObjects >
-void* MemoryPool< T, nObjects >::allocate(std::size_t) {
-   if ( head == 0 ) { // if no more memory in the pool
-      const int last = nObjects - 1;
-
-      // use the global operator new to allocate a block for the pool
-      Thunk* pool = reinterpret_cast<Thunk*>(
-	 ::operator new(nObjects * sizeof(Thunk)));
-
-      blocks.push_back(pool);
-      // initialize the chain (one-directional linked list)
-      head = pool;
-      for (int i = 0; i < last; ++i ) {
-	 pool[i].next = &pool[i+1];
-      }
-      pool[last].next = 0;
-   }
-
-   // set head to point to the next object in the list
-   Thunk* currentThunk = head;
-   head = currentThunk->next;
-
-   return currentThunk;
-}
-
-template< class T, int nObjects >
-void MemoryPool< T, nObjects >::free(void* t) {
-   CGAL_assertion(t != 0);     
-   if (t == 0) return; // for safety
-   if(blocks.empty()){
-     std::cerr << typeid(T).name() << std::endl;
-   }
-   assert (! blocks.empty());
-
-   // recycle the object memory, by putting it back into the chain
-   reinterpret_cast<Thunk*>(t)->next = head;
-   head = reinterpret_cast<Thunk*>(t);
-}
-
-} //namespace CORE
-
-#endif // _CORE_MEMORYPOOL_H_
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/Real_impl.h b/3rdparty/CGAL-4.8/include/CGAL/CORE/Real_impl.h
deleted file mode 100644
index 8da773d..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/CORE/Real_impl.h
+++ /dev/null
@@ -1,292 +0,0 @@
-/****************************************************************************
- * Core Library Version 1.7, August 2004
- * Copyright (c) 1995-2004 Exact Computation Project
- * 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.
- *
- *
- * File: Real.cpp
- * Synopsis: The Real class is a superclass for all the number 
- *           systems in the Core Library (int, long, float, double,
- *           BigInt, BigRat, BigFloat, etc)
- *           
- * Written by 
- *       Koji Ouchi <ouchi at simulation.nyu.edu>
- *       Chee Yap <yap at cs.nyu.edu>
- *       Chen Li <chenli at cs.nyu.edu>
- *       Zilin Du <zilin at cs.nyu.edu>
- *       Sylvain Pion <pion at cs.nyu.edu> 
- *
- * WWW URL: http://cs.nyu.edu/exact/
- * Email: exact at cs.nyu.edu
- *
- * $URL$
- * $Id$
- ***************************************************************************/
-
-#ifdef CGAL_HEADER_ONLY
-#define CGAL_INLINE_FUNCTION inline
-#else
-#define CGAL_INLINE_FUNCTION
-#endif
-
-#include <ctype.h>
-#include <CGAL/CORE/Real.h>
-
-#ifdef CGAL_HEADER_ONLY
-#include <CGAL/CORE/BigFloat.h> // for FiveTo
-#endif
-
-namespace CORE { 
-
-CGAL_INLINE_FUNCTION
-const Real& Real::getZero() {
-  static Real Zero(0);
-  return Zero;
-}
-
-CGAL_INLINE_FUNCTION
-BigInt floor(const Real& r, Real &sub) {
-  BigInt f = r.approx(CORE_INFTY, 2).BigIntValue();
-  sub = r-f;
-  // Adjustment
-  if (sub<0)
-    ++sub, --f;
-  if (sub>=1)
-    --sub, ++f;
-  assert(sub >=0 && sub<1);
-  return f;
-}
-
-// pow(r,n) and power(r, n) are the same function
-//
-CGAL_INLINE_FUNCTION
-Real pow(const Real& r, unsigned long n) {
-  if (n == 0)
-    return Real(1);
-  else if (n == 1)
-    return r;
-  else {
-    Real x = r;
-    while ((n % 2) == 0) { // n is even
-      x *= x;
-      n >>= 1;
-    }
-    Real u = x;
-    while (true) {
-      n >>= 1;
-      if (n == 0)
-        return u;
-      x *= x;
-      if ((n % 2) == 1) // n is odd
-        u *= x;
-    }
-    //return u; // unreachable
-  }
-}//pow
-
-extern BigInt FiveTo(unsigned long exp);
-
-// Construct Real from String
-// Note:
-// 	-- Zilin Du: 06/03/2003
-// 	-- Original it is the code for Real's constructor for "const char*".
-// 	   I change it to a function so that two constrcutors can share the code.
-// 	   now it is private and no default value.
-//
-//   --Default value of the argument "prec" is get_static_defInputDigits()
-//   --If prec is CORE_posInfty, then the input is
-//	read in exactly.  Otherwise, we convert to a RealBigFloat
-//	with absolute error at most 10^{-prec}
-
-// Constructor Real( char *str, extLong& prec)
-//	is very similar to
-//		BigFloatRep::fromString( char *str, extLong& prec);
-// Differences:
-//	In BigFloat(str, prec), the value of prec cannot be infinity, and
-//		it defaults to defBigFloatInputDigits;
-//	In Real(str, prec), the value of prec is allowed to be infinity, and
-//		it defaults to defInputDigits.
-//
-// Why do we have the two versions?  It allows us to use the BigFloat class
-//	directly, without relying on Real class.
-
-CGAL_INLINE_FUNCTION
-void Real::constructFromString(const char *str, const extLong& prec )
-// NOTE: prec defaults to get_static_defInputDigits() (see Real.h)
-{
-  //	8/8/01, Chee and Zilin: add a new rational string format:
-  //		this format is indicated by the presence of a slash "/"
-  //		Moreover, the value of prec is ignored (basically
-  //		assumed to be infinity).
-
-  if (std::strchr(str, '/') != NULL) {	// this is a rational number
-    rep = new RealBigRat(BigRat(str));
-    return;
-  }
-
-  const char *e = std::strchr(str, 'e');
-  int dot = 0;
-  long e10 = 0;
-  if (e != NULL)
-    e10 = std::atol(e+1);	// e10 is decimal precision of the input string
-  // i.e., input is A/10^{e10}.
-  else {
-    e = str + std::strlen(str);
-#ifdef CORE_DEBUG
-    assert(*e == '\0');
-#endif
-  }
-
-  const char *p = str;
-  if (*p == '-' || *p == '+')
-    p++;
-  BigInt m(0);
-
-  for (; p < e; p++) {
-    if (*p == '.') {
-      dot = 1;
-      continue;
-    }
-    m = m * 10 + (*p - '0');
-    if (dot)
-      e10--;
-  }
-
-  long t = (e10 < 0) ? -e10 : e10;
-  BigInt one(1);
-  BigInt ten = FiveTo(t) * (one << static_cast<unsigned long>(t));
-  if (*str == '-')
-    m = -m;
-  if (e10 >= 0) {
-    // convert exactly from integer numbers
-    m *= ten;
-    rep = new RealBigInt(m);
-  } else { // e10 < 0,  fractional numbers
-    // HERE IS WHERE WE USE THE SYSTEM CONSTANT
-    //	       get_static_defInputDigits()
-    // Note: get_static_defInputDigits() should be at least log_2(10).
-    //       We default get_static_defInputDigits() to 4.
-    //std::cout << "(m,ten)=" << m << "," << ten << std::endl;
-    BigRat r(m, ten);
-    if (prec.isInfty()) { // convert exactly! to a big rational
-      rep = new RealBigRat(r);
-    } else {
-      // convert approximately, to a BigFloat within the
-      // specified precision:
-      // BigFloat bf(r, CORE_posInfty, prec * lgTenM) ;
-      BigFloat bf(r, CORE_posInfty, prec * 4) ;
-      rep = new RealBigFloat(bf);
-    }
-  }
-}// Real(str, prec)
-
-// The operator >>(i,x) calls the constructor Real(char*)
-CGAL_INLINE_FUNCTION
-std::istream& operator >>(std::istream& i, Real& x) {
-  int size = 20;
-  char *str = new char[size];
-  char *p = str;
-  char c;
-  int d = 0, e = 0, s = 0;
-  //  int done = 0;
-
-  // Chen Li: fixed a bug, the original statement is
-  //  for (i.get(c); c == ' '; i.get(c));
-  // use isspace instead of testing c == ' ', since it must also
-  // skip tab, catridge/return, etc.
-  // Change to:
-  //  int status;
-  do {
-    i.get(c);
-  } while (!i.eof() && isspace(c)); /* loop if met end-of-file, or
-  			   char read in is white-space. */
-  // Chen Li,
-  // original "if (c == EOF) ..." is unsafe since c is of char type and
-  // EOF is of int tyep with a negative value -1
-
-  if (i.eof()) {
-    i.clear(std::ios::eofbit | std::ios::failbit);
-    delete [] str;
-    return i;
-  }
-
-  // the current content in "c" should be the first non-whitespace char
-  if (c == '-' || c == '+') {
-    *p++ = c;
-    i.get(c);
-  }
-
-  for (; isdigit(c) || (!d && c=='.') ||
-       (!e && c=='e') || (!s && (c=='-' || c=='+')); i.get(c)) {
-    if (!i) break;
-    if (!e && (c == '-' || c == '+'))
-      break;
-    // Chen Li: put one more rule to prohibite input like
-    //  xxxx.xxxe+xxx.xxx:
-    if (e && (c == '.'))
-      break;
-    if (p - str == size) {
-      char *t = str;
-      str = new char[size*2];
-      std::memcpy(str, t, size);
-      delete [] t;
-      p = str + size;
-      size *= 2;
-    }
-#ifdef CORE_DEBUG
-    assert((p-str) < size);
-#endif
-
-    *p++ = c;
-    if (c == '.')
-      d = 1;
-    // Chen Li: fix a bug -- the sign of exponent can not happen before
-    // the character "e" appears! It must follow the "e' actually.
-    //    if (e || c == '-' || c == '+') s = 1;
-    if (e)
-      s = 1;
-    if (c == 'e')
-      e = 1;
-  }
-
-  if (!i && !i.eof()) {
-    delete [] str;
-    return i;
-  }
-  // chenli: make sure that the p is still in the range
-  if (p - str >= size) {
-    int len = p - str;
-    char *t = str;
-    str = new char[len + 1];
-    std::memcpy(str, t, len);
-    delete [] t;
-    p = str + len;
-  }
-
-#ifdef CORE_DEBUG
-  assert(p - str < size);
-#endif
-
-  *p = '\0';
-  i.putback(c);
-  i.clear();
-  // old: x = Real(str, i.precision()); // use precision of input stream.
-  x = Real(str);  // default precision = get_static_defInputDigits()
-  delete [] str;
-  return i;
-}//operator >> (std::istream&, Real&)
-
-
-} //namespace CORE
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE_BigFloat.h b/3rdparty/CGAL-4.8/include/CGAL/CORE_BigFloat.h
deleted file mode 100644
index 2488af7..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/CORE_BigFloat.h
+++ /dev/null
@@ -1,550 +0,0 @@
-// Copyright (c) 2006-2008 Max-Planck-Institute Saarbruecken (Germany).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Michael Hemmer   <hemmer at mpi-inf.mpg.de>
-//============================================================================
-
-#ifndef CGAL_CORE_BIGFLOAT_H
-#define CGAL_CORE_BIGFLOAT_H
-
-#include <CGAL/basic.h>
-#include <CGAL/number_type_basic.h>
-#include <CGAL/CORE/BigFloat.h>
-#include <CGAL/CORE_coercion_traits.h>
-#include <CGAL/Interval_traits.h> 
-#include <CGAL/Bigfloat_interval_traits.h> 
-
-namespace CGAL {
-
-// ######### Interval_traits 
-
-template<> 
-class Interval_traits<CORE::BigFloat> 
-    : public internal::Interval_traits_base<CORE::BigFloat>{
-    typedef CORE::BigFloat Interval;
-public: 
-    typedef Interval_traits<CORE::BigFloat> Self; 
-    typedef CORE::BigFloat Type;
-    typedef CORE::BigFloat Bound;
-    typedef CGAL::Tag_true Is_interval; 
-    typedef CGAL::Tag_true Is_bigfloat_interval; 
-  
- 
-    struct Lower :public std::unary_function<Interval,Bound>{
-        Bound operator() ( Interval x ) const {   
-            CORE::BigFloat result = ::CORE::BigFloat(x.m()-x.err(),0,x.exp());
-            CGAL_postcondition(result <= x);
-            return result; 
-        }
-    };
-    
-    struct Upper :public std::unary_function<Interval,Bound>{
-        Bound operator() ( Interval x ) const {     
-            CORE::BigFloat result = ::CORE::BigFloat(x.m()+x.err(),0,x.exp());
-            CGAL_postcondition(result >= x);
-            return result; 
-        }
-    };
-
-    struct Width :public std::unary_function<Interval,Bound>{
-         
-        Bound operator() ( Interval x ) const {    
-            unsigned long err = 2*x.err();
-            return Bound(CORE::BigInt(err),0,x.exp());
-        }
-    };
-
-    struct Median :public std::unary_function<Interval,Bound>{
-         
-        Bound operator() ( Interval x ) const {   
-            return Bound(x.m(),0,x.exp());
-        }
-    };
-
-    struct Norm :public std::unary_function<Interval,Bound>{
-        Bound operator() ( Interval x ) const {
-          BOOST_USING_STD_MAX();
-          return max BOOST_PREVENT_MACRO_SUBSTITUTION (Upper()(x).abs(),Lower()(x).abs());
-        }
-    };
-    
-    struct Zero_in :public std::unary_function<Interval,bool>{
-        bool operator() ( Interval x ) const {      
-            return x.isZeroIn(); 
-        }
-    };
-
-    struct In :public std::binary_function<Bound,Interval,bool>{  
-        bool operator()( Bound x, const Interval& a ) const {    
-            CGAL_precondition(CGAL::singleton(x));
-            return (Lower()(a) <= x && x <= Upper()(a));
-        }
-    };
-
-    struct Equal :public std::binary_function<Interval,Interval,bool>{  
-        bool operator()( const Interval& a, const Interval& b ) const { 
-            return (Upper()(a) == Upper()(b) &&  Lower()(a) == Lower()(b));
-        }
-    };
-    
-    struct Subset :public std::binary_function<Interval,Interval,bool>{  
-        bool operator()( const Interval& a, const Interval& b ) const {   
-            return Lower()(b) <= Lower()(a) && Upper()(a) <= Upper()(b);
-        }
-    };
-    
-    struct Proper_subset :public std::binary_function<Interval,Interval,bool>{ 
-        bool operator()( const Interval& a, const Interval& b ) const { 
-            return Subset()(a,b) && (!Equal()(a,b));
-        }
-    };
-    
-    struct Intersection :public std::binary_function<Interval,Interval,Interval>{ 
-      Interval operator()( const Interval& a, const Interval& b ) const {
-            BOOST_USING_STD_MAX();
-            BOOST_USING_STD_MIN();
-            // std::cout <<"a= (" << a.m() << "+-" << a.err() << ")*2^" << a.exp() << std::endl;
-            Bound l(max BOOST_PREVENT_MACRO_SUBSTITUTION (Lower()(a),Lower()(b)));
-            Bound u(min BOOST_PREVENT_MACRO_SUBSTITUTION (Upper()(a),Upper()(b)));
-
-            if(u < l ) throw Exception_intersection_is_empty();
-            return Construct()(l,u);
-        }
-    };
- 
-
-    struct Overlap :public std::binary_function<Interval,Interval,bool>{
-        bool operator() ( Interval x, Interval y ) const {       
-            Self::Zero_in Zero_in;
-            bool result = Zero_in(x-y);
-            return result;
-        }
-    };
-   
-    struct Hull :public std::binary_function<Interval,Interval,Interval>{
-
-      // for debugging
-/*      void print_bf(CORE::BigFloat bf, std::string s) const {
-        
-        std::cout << s << ".m()=" << bf.m() << ","
-                  << s << ".err()=" << bf.err() << ","
-                  << s << ".exp()=" << bf.exp() << ","
-                  << "td=" << bf << std::endl;
-      }
-*/
-
-        Interval operator() ( Interval x, Interval y ) const {
-            BOOST_USING_STD_MAX();
-            BOOST_USING_STD_MIN();
-#if 0
-            // this is not possible since CORE::centerize has a bug.
-            Interval result = CORE::centerize(x,y);
-#else 
-
-            //print_bf(x,"x");
-            //print_bf(y,"y");
-            
-             CORE::BigFloat result;
-             
-            // Unfortunately, CORE::centerize(x,y) has bugs. 
-            if ((x.m() == y.m()) && (x.err() == y.err()) && (x.exp() == y.exp())) { 
-                return x;
-            }
-                         
-            CORE::BigFloat lower = min BOOST_PREVENT_MACRO_SUBSTITUTION (CGAL::lower(x), CGAL::lower(y));
-            CORE::BigFloat upper = max BOOST_PREVENT_MACRO_SUBSTITUTION (CGAL::upper(x), CGAL::upper(y));
-
-            CORE::BigFloat mid = (lower + upper)/2;
-             
-            //print_bf(lower,"lower");
-            //print_bf(upper,"upper");
-            //print_bf(mid,"mid");
-
-            // Now we have to compute the error. The problem is that .err() is just a long
-            CORE::BigFloat err = (upper - lower)/CORE::BigFloat(2);
-                   
-            //print_bf(err,"err");
-
-            //std::cout << "lower    " << lower << std::endl;
-            //std::cout << "upper    " << upper << std::endl;
-            //std::cout << "mid      " << mid << std::endl;
-            //std::cout << "err I    " << err << std::endl;
-            
-            // shift such that err.m()+err.err() fits into long 
-            int digits_long = std::numeric_limits<long>::digits;
-            if(::CORE::bitLength(err.m()+err.err()) >= digits_long){
-                long shift = ::CORE::bitLength(err.m()) - digits_long + 1 ; 
-                //std::cout << "shift " << shift<< std::endl;
-                long new_err = ((err.m()+err.err()) >> shift).longValue()+1; 
-                err = CORE::BigFloat(0,new_err,0) * CORE::BigFloat::exp2(err.exp()*CORE::CHUNK_BIT+shift);
-            }else{           
-                err = CORE::BigFloat(0,err.m().longValue()+err.err(),err.exp());
-            }
-            //print_bf(err,"new_err");
-
-            // TODO: This is a workaround for a bug in operator+ 
-            // of CORE::Bigfloat. If the exponent difference is too big,
-            // this might cause problems, since the error is a long
-            if(mid.exp() > err.exp()) {
-                long mid_err = mid.err();
-                CORE::BigInt mid_m = mid.m();
-                mid_err = mid_err << (mid.exp()-err.exp())*CORE::CHUNK_BIT;
-                mid_m = mid_m << (mid.exp()-err.exp())*CORE::CHUNK_BIT;
-                mid = CORE::BigFloat(mid_m,mid_err,err.exp());
-                //print_bf(mid,"corr_mid");
-            }
-            
-            //print_bf(result,"result");        
-
-            result = mid + err;  
-             
-#endif 
-
-            CGAL_postcondition( 
-                    CGAL::lower(result) 
-                    <=  min BOOST_PREVENT_MACRO_SUBSTITUTION (CGAL::lower(x), CGAL::lower(y)));
-            CGAL_postcondition( 
-                    CGAL::upper(result) 
-                    >= max BOOST_PREVENT_MACRO_SUBSTITUTION (CGAL::upper(x), CGAL::upper(y)));
-
-            
-
-            return result ;
-        }
-    };
-
-    struct Singleton :public std::unary_function<Interval,bool> {
-        bool operator() ( Interval x ) const {       
-            return (x.err() == 0); 
-        }
-    };
-
-    struct Construct :public std::binary_function<Bound,Bound,Interval>{
-        Interval operator()( const Bound& l,const Bound& r) const {
-            CGAL_precondition( l < r ); 
-            return Hull()(l,r);
-        }
-    };
-};
-
-
-// ########### Bigfloat_interval_traits 
-
-
-// template<typename BFI> long relative_precision(BFI bfi);
-namespace internal{
-
-CORE::BigFloat 
-inline 
-round(const CORE::BigFloat& x, long rel_prec = CORE::get_static_defRelPrec().toLong() ){
-    CGAL_postcondition(rel_prec >= 0);   
-
-    // since there is not rel prec defined if Zero_in(x)
-    if (x.isZeroIn()) return x; 
-    // if (CGAL::get_significant_bits(x) <= rel_prec) return x;
-   
-// if 1 
-//    CORE::BigFloat xr;
-//    xr.approx(x,rel_prec,1024);
-//    typedef CORE::BigFloat BF; 
-// else       
-    typedef CORE::BigFloat BF; 
-    BF xr;
-   
-    CORE::BigInt m = x.m();
-    long         err = x.err();
-    long         exp = x.exp(); 
-   
-
-//    std::cout <<"(" << m << "+-" <<err << ")*2^"<<(CORE::CHUNK_BIT*exp) << std::endl; 
-//    if (err != 0) 
-//      std::cout <<"current prec: " <<  CGAL::relative_precision(x) << std::endl;
-//    else 
-//      std::cout <<"current prec: " << " SINGLETON " << std::endl;
-//    std::cout <<"desired prec: " << rel_prec << std::endl; 
-//    std::cout <<"bitLength: " << CORE::bitLength(m) << std::endl; 
-//    long shift = ::CORE::bitLength(m) - rel_prec - 1;
-   
-    long shift ;
-    if (err == 0)
-      shift = ::CORE::bitLength(m) - rel_prec - 3;
-    else      
-      shift = CGAL::relative_precision(x) - rel_prec -1; 
-    
-    if( shift > 0 ){    
-      m   >>= shift ; 
-      err >>= shift; 
-      xr = BF(m,err+1,0)*BF::exp2(exp*CORE::CHUNK_BIT+shift);     
-    }else{    // noting to do
-        xr = x; 
-    }
-
-//    std::cout <<"(" <<m << "+-" <<err+1 << ")*2^"<<(CORE::CHUNK_BIT*exp) << std::endl; 
-//    if (xr.err() != 0) 
-//      std::cout <<"current prec: " <<  CGAL::relative_precision(xr) << std::endl;
-//    else 
-//      std::cout <<"current prec: " << " SINGLETON "<< std::endl;
-//    std::cout <<"desired prec: " << rel_prec << std::endl; 
-    
-// endif     
-    CGAL_postcondition(singleton(xr) || CGAL::relative_precision(xr) - rel_prec >= 0); 
-    CGAL_postcondition(singleton(xr) || CGAL::relative_precision(xr) - rel_prec <= 32);   
-    CGAL_postcondition(BF(xr.m()-xr.err(),0,xr.exp()) <= BF(x.m()-x.err(),0,x.exp()));
-    CGAL_postcondition(BF(xr.m()+xr.err(),0,xr.exp()) >= BF(x.m()+x.err(),0,x.exp()));
-    return xr;     
-}
-}
-
-template<> class Bigfloat_interval_traits<CORE::BigFloat> 
-:public Interval_traits<CORE::BigFloat>
-{
-
-    typedef CORE::BigFloat NT;
-    typedef CORE::BigFloat BF;
-public:
-  typedef Bigfloat_interval_traits<NT> Self;
-  
-   struct Relative_precision {
-        // type for the \c AdaptableUnaryFunction concept.
-        typedef NT  argument_type;
-        // type for the \c AdaptableUnaryFunction concept.
-        typedef long  result_type;
-
-        long operator()( NT x) const { 
-          CGAL_precondition(!Singleton()(x));
-          CGAL_precondition(!CGAL::zero_in(x));
-          
-          x = x.abs();
-          NT w = Width()(x);
-          w /= ::CORE::BigFloat(x.m()-x.err(),0,x.exp());    
-          w = w.abs();
-          return -(CORE::ceilLg(w.m()+w.err())+w.exp()*CORE::CHUNK_BIT);
-        }
-    };
-       
-    struct Set_precision {
-        // type for the \c AdaptableUnaryFunction concept.
-        typedef long  argument_type;
-        // type for the \c AdaptableUnaryFunction concept.
-        typedef long  result_type;  
-     
-        long operator() ( long prec ) const {    
-            long result =  ::CORE::get_static_defRelPrec().toLong();
-            ::CORE::get_static_defRelPrec() = prec; 
-            ::CORE::get_static_defBFdivRelPrec() = prec;
-            return result; 
-        }
-    };
-     
-    struct Get_precision {
-        // type for the \c AdaptableGenerator concept.
-        typedef long  result_type;  
-     
-        long operator() () const {
-            return  ::CORE::get_static_defRelPrec().toLong(); 
-        }
-    };
-};
-
-
-
-
-//
-// Algebraic structure traits
-//
-template <> class Algebraic_structure_traits< CORE::BigFloat >
-  : public Algebraic_structure_traits_base< CORE::BigFloat,
-                                            Field_with_kth_root_tag >  {
-  public:
-    typedef Tag_false          Is_exact;
-    typedef Tag_true           Is_numerical_sensitive;
-
-    class Sqrt
-      : public std::unary_function< Type, Type > {
-      public:
-        Type operator()( const Type& x ) const {
-            // What I want is a sqrt computed with 
-            // ::CORE::get_static_defRelPrec() bits.
-            // And not ::CORE::defBFsqrtAbsPrec as CORE does. 
-            
-            CGAL_precondition(::CORE::get_static_defRelPrec().toLong() > 0);
-            CGAL_precondition(x > 0);
-            
-            Type a = CGAL::internal::round(
-              x, ::CORE::get_static_defRelPrec().toLong()*2);
-            CGAL_postcondition(a > 0); 
-
-            Type tmp1 = CORE::BigFloat(
-                a.m(),0,0).sqrt(::CORE::get_static_defRelPrec().toLong());
-            Type err  =  
-                Type(0,long(std::sqrt(double(a.err()))),0) 
-                * CORE::BigFloat::exp2(a.exp()*7);
-            Type result = tmp1*CORE::BigFloat::exp2(a.exp()*7) + err;
-           
-            CGAL_postcondition(result >= 0);
-            CGAL_postcondition(CGAL::lower(result*result) <= CGAL::lower(x));
-            CGAL_postcondition(CGAL::upper(result*result) >= CGAL::upper(x));
-
-            return result;
-        }
-    };
-
-    class Kth_root
-      : public std::binary_function<int, Type, Type> {
-      public:
-        Type operator()( int k,
-                                        const Type& x) const {
-            CGAL_precondition_msg( k > 0, "'k' must be positive for k-th roots");
-            // CORE::radical isn't implemented for negative values of x, so we
-            //  have to handle this case separately
-            if( x < 0 && k%2 != 0) {
-              return Type(-CORE::radical( -x, k ) );
-            }
-
-            return Type( CORE::radical( x, k ) );
-        }
-    };
-};
-
-//
-// Real embeddable traits
-//
-template <> class Real_embeddable_traits< CORE::BigFloat >
-  : public INTERN_RET::Real_embeddable_traits_base< CORE::BigFloat , CGAL::Tag_true  > {
-  public:
-    class Abs
-      : public std::unary_function< Type, Type > {
-      public:
-        Type operator()( const Type& x ) const {
-            Type result; 
-          
-            if(x.isZeroIn()){
-                CORE::BigInt m; 
-                if(x.m() < 0 ){
-                    m = -(x.m()-x.err());
-                }else{
-                    m =  x.m()+x.err();
-                }
-                if(m % 2 == 1) m += 1;
-                
-                Type upper(m,0,x.exp());
-                result = CORE::centerize(CORE::BigFloat(0),upper);
-                
-                CGAL_postcondition(result.m()-result.err() <= 0); 
-                if(result.m()-result.err() != 0){
-                    result = this->operator()(result);
-                }
-                CGAL_postcondition(result.m()-result.err() == 0); 
-            }else{
-                result = CORE::abs(x);
-            }
-            CGAL_postcondition(result.m()-result.err() >= 0); 
-            CGAL_postcondition(Type(result.m()+result.err(),0,result.exp()) 
-                         >= Type(x.m()+x.err(),0,x.exp()));       
-            return result;
-        }
-    };
-
-    class Sgn
-      : public std::unary_function< Type, ::CGAL::Sign > {
-      public:
-        ::CGAL::Sign operator()( const Type& x ) const {
-            ::CGAL::Sign result =  sign( x.sign());
-            return result; 
-        }
-    };
-
-    class Compare
-      : public std::binary_function< Type, Type,
-                                Comparison_result > {
-      public:
-        Comparison_result operator()( const Type& x,
-                                            const Type& y ) const {
-          return (Comparison_result) sign( (x-y).sign());
-        }
-        CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT( Type, 
-                Comparison_result )
-    };
-
-    class To_double
-      : public std::unary_function< Type, double > {
-      public:
-        double operator()( const Type& x ) const {
-          // this call is required to get reasonable values for the double
-          // approximation
-          return x.doubleValue();
-        }
-    };
-
-    class To_interval
-      : public std::unary_function< Type, std::pair< double, double > > {
-    public:
-        std::pair<double, double> operator()( const Type& x ) const {
-                        
-            double lb,ub;
-           
-            Type x_lower = CGAL::lower(CGAL::internal::round(CGAL::lower(x),50));
-            Type x_upper = CGAL::upper(CGAL::internal::round(CGAL::upper(x),50));
-            
-            // since matissa has 50 bits only, conversion to double is exact 
-            lb = x_lower.doubleValue();
-            CGAL_postcondition(lb == x_lower);
-            ub = x_upper.doubleValue();
-            CGAL_postcondition(ub == x_upper);             
-            
-            std::pair<double, double> result(lb,ub);
-            CGAL_postcondition( result.first  <=  CORE::Expr(CGAL::lower(x)));
-            CGAL_postcondition( result.second >=  CORE::Expr(CGAL::upper(x)));
-            return result;      
-        }
-    };
-};
-
-} //namespace CGAL
-
-//since types are included by CORE_coercion_traits.h:
-#include <CGAL/CORE_Expr.h>
-#include <CGAL/CORE_BigInt.h>
-#include <CGAL/CORE_BigRat.h>
-#include <CGAL/CORE_BigFloat.h>
-#include <CGAL/CORE_arithmetic_kernel.h>
-
-namespace Eigen {
-  template<class> struct NumTraits;
-  template<> struct NumTraits<CORE::BigFloat>
-  {
-    typedef CORE::BigFloat Real;
-    typedef CORE::BigFloat NonInteger;
-    typedef CORE::BigFloat Nested;
-
-    static inline Real epsilon() { return 0; }
-    static inline Real dummy_precision() { return 0; }
-
-    enum {
-      IsInteger = 0,
-      IsSigned = 1,
-      IsComplex = 0,
-      RequireInitialization = 1,
-      ReadCost = 6,
-      AddCost = 60,
-      MulCost = 60
-    };
-  };
-}
-
-#endif // CGAL_CORE_BIGFLOAT_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE_BigInt.h b/3rdparty/CGAL-4.8/include/CGAL/CORE_BigInt.h
deleted file mode 100644
index 288ebed..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/CORE_BigInt.h
+++ /dev/null
@@ -1,226 +0,0 @@
-// Copyright (c) 2006-2008 Max-Planck-Institute Saarbruecken (Germany).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Michael Hemmer   <hemmer at mpi-inf.mpg.de>
-
-
-#ifndef CGAL_CORE_BIGINT_H
-#define CGAL_CORE_BIGINT_H
-
-#include <CGAL/config.h>
-#include <CGAL/number_type_basic.h>
-#include <CGAL/CORE/BigInt.h>
-#include <CGAL/CORE/Expr.h>
-#include <CGAL/CORE_coercion_traits.h>
-
-#include <CGAL/Residue.h>
-#include <CGAL/Modular_traits.h>
-
-namespace CGAL {
-
-//
-// Algebraic structure traits
-//
-template <> class Algebraic_structure_traits< CORE::BigInt >
-  : public Algebraic_structure_traits_base< CORE::BigInt,
-                                            Euclidean_ring_tag >  {
-  public:
-    typedef Tag_true            Is_exact;
-    typedef Tag_false           Is_numerical_sensitive;
-
-    typedef INTERN_AST::Is_square_per_sqrt< Type >
-                                                                 Is_square;
-
-    typedef INTERN_AST::Div_per_operator< Type > Div;
-    typedef INTERN_AST::Mod_per_operator< Type > Mod;
-
-    class Sqrt
-      : public std::unary_function< Type, Type > {
-      public:
-        //! computes the largest NT not larger than the square root of \a a.
-        Type operator()( const Type& x) const {
-          Type result;
-          mpz_sqrt(result.get_mp(), x.get_mp());
-          return result;
-        }
-    };
-
-
-    class Gcd
-      : public std::binary_function< Type, Type,
-                                Type > {
-      public:
-        Type operator()( const Type& x,
-                                        const Type& y) const {
-          if ( x == Type(0) && y == Type(0) )
-              return Type(0);
-          Type result;
-          mpz_gcd(result.get_mp(), x.get_mp(), y.get_mp());
-          return result;
-        }
-    };
-};
-
-//
-// Real embeddable traits
-//
-template <> class Real_embeddable_traits< CORE::BigInt >
-  : public INTERN_RET::Real_embeddable_traits_base< CORE::BigInt , CGAL::Tag_true > {
-
-  public:
-
-    class Abs
-      : public std::unary_function< Type, Type > {
-      public:
-        Type operator()( const Type& x ) const {
-          return CORE::abs( x );
-        }
-    };
-
-    class Sgn
-      : public std::unary_function< Type, ::CGAL::Sign > {
-      public:
-        ::CGAL::Sign operator()( const Type& x ) const {
-          return (::CGAL::Sign) CORE::sign( x );
-        }
-    };
-
-    class Compare
-      : public std::binary_function< Type, Type,
-                                Comparison_result > {
-      public:
-        Comparison_result operator()( const Type& x,
-                                            const Type& y ) const {
-          return CGAL::sign(::CORE::cmp(x,y));
-        }
-    };
-
-    class To_double
-      : public std::unary_function< Type, double > {
-      public:
-        double operator()( const Type& x ) const {
-          // this call is required to get reasonable values for the double
-          // approximation
-          return x.doubleValue();
-        }
-    };
-
-    class To_interval
-      : public std::unary_function< Type, std::pair< double, double > > {
-      public:
-        std::pair<double, double> operator()( const Type& x_ ) const {
-            CORE::Expr x(x_);
-            std::pair<double,double> result;
-            x.doubleInterval(result.first, result.second);
-            CGAL_expensive_assertion(result.first  <= x);
-            CGAL_expensive_assertion(result.second >= x);
-            return result;
-        }
-    };
-};
-
-/*! \ingroup NiX_Modular_traits_spec
- *  \brief a model of concept ModularTraits, 
- *  specialization of NiX::Modular_traits. 
- */
-template<>
-class Modular_traits< ::CORE::BigInt > {
-  typedef Residue RES;
- public:
-    typedef ::CORE::BigInt NT;
-    typedef CGAL::Tag_true Is_modularizable;
-    typedef Residue Residue_type;
-
-    struct Modular_image{
-        Residue_type operator()(const NT& a){
-            NT tmp = a % NT(RES::get_current_prime());
-// TODO: reactivate this assertion
-// it fails with core_v1.6x_20040329
-//            NiX_assert(tmp.isInt());
-            int mi(tmp.longValue());
-            if (mi < 0) mi += RES::get_current_prime();
-            return Residue_type(mi);
-        }
-    };
-    struct Modular_image_representative{
-        NT operator()(const Residue_type& x){
-            return NT(x.get_value());
-        }
-    };    
-};
-
-
-template<>
-struct Needs_parens_as_product<CORE::BigInt>{
-    bool operator()(const CORE::BigInt& x){
-        return CGAL_NTS is_negative(x);
-    }
-};
-
-// Benchmark_rep specialization 
-template<>
-class Benchmark_rep< CORE::BigInt > {
-    const CORE::BigInt& t;
-public:
-    //! initialize with a const reference to \a t.
-    Benchmark_rep( const CORE::BigInt& tt) : t(tt) {}
-    //! perform the output, calls \c operator\<\< by default.
-    std::ostream& operator()( std::ostream& out) const { 
-            out << t;
-            return out;
-    }
-    
-    static std::string get_benchmark_name() {
-        return "Integer";
-    }
-};
-
-
-} //namespace CGAL
-
-//since types are included by CORE_coercion_traits.h:
-#include <CGAL/CORE_Expr.h>
-#include <CGAL/CORE_BigInt.h>
-#include <CGAL/CORE_BigRat.h>
-#include <CGAL/CORE_BigFloat.h>
-#include <CGAL/CORE_arithmetic_kernel.h>
-
-namespace Eigen {
-  template<class> struct NumTraits;
-  template<> struct NumTraits<CORE::BigInt>
-  {
-    typedef CORE::BigInt Real;
-    typedef CORE::BigRat NonInteger;
-    typedef CORE::BigInt Nested;
-
-    static inline Real epsilon() { return 0; }
-    static inline Real dummy_precision() { return 0; }
-
-    enum {
-      IsInteger = 1,
-      IsSigned = 1,
-      IsComplex = 0,
-      RequireInitialization = 1,
-      ReadCost = 6,
-      AddCost = 30,
-      MulCost = 50
-    };
-  };
-}
-
-#endif // CGAL_CORE_BIGINT_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE_BigRat.h b/3rdparty/CGAL-4.8/include/CGAL/CORE_BigRat.h
deleted file mode 100644
index 0be849b..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/CORE_BigRat.h
+++ /dev/null
@@ -1,260 +0,0 @@
-// Copyright (c) 2006-2008 Max-Planck-Institute Saarbruecken (Germany).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Michael Hemmer   <hemmer at mpi-inf.mpg.de>
-
-
-#ifndef CGAL_CORE_BIGRAT_H
-#define CGAL_CORE_BIGRAT_H
-
-#include <CGAL/config.h>
-#include <CGAL/number_type_basic.h>
-#include <CGAL/CORE/BigRat.h>
-#include <CGAL/CORE_coercion_traits.h>
-#include <CGAL/CORE_Expr.h> // used for To_interval-functor
-
-//#if defined(CGAL_CORE_BIGRAT_NUMER_DENOM_ARE_MEMBERS)
-//  #define CGAL_CORE_NUMERATOR(X) ((X).numerator())
-//  #define CGAL_CORE_DENOMINATOR(X) ((X).denominator())
-//#elif defined(CGAL_CORE_BIGRAT_NUMER_DENOM_ARE_NONMEMBERS)
-  #define CGAL_CORE_NUMERATOR(X) (numerator((X)))
-  #define CGAL_CORE_DENOMINATOR(X) (denominator((X)))
-//#else
-
-namespace CGAL {
-
-//
-// Algebraic structure traits
-//
-template <> class Algebraic_structure_traits< CORE::BigRat >
-  : public Algebraic_structure_traits_base< CORE::BigRat,
-                                            Field_tag >  {
-  public:
-    typedef Tag_true            Is_exact;
-    typedef Tag_false           Is_numerical_sensitive;
-
-    // BigRat are always normalized, so no special simplify-functor is needed
-
-    // Nothing new...
-};
-
-
-
-
-//
-// Real embeddable traits
-//
-template <> class Real_embeddable_traits< CORE::BigRat >
-  : public INTERN_RET::Real_embeddable_traits_base< CORE::BigRat , CGAL::Tag_true > {
-  public:
-
-    class Abs
-      : public std::unary_function< Type, Type > {
-      public:
-        Type operator()( const Type& x ) const {
-          return CORE::abs( x );
-        }
-    };
-
-    class Sgn
-      : public std::unary_function< Type, ::CGAL::Sign > {
-      public:
-        ::CGAL::Sign operator()( const Type& x ) const {
-          return (::CGAL::Sign) CORE::sign( x );
-        }
-    };
-
-    class Compare
-      : public std::binary_function< Type, Type,
-                                Comparison_result > {
-      public:
-        Comparison_result operator()( const Type& x,
-                                            const Type& y ) const {
-          return CGAL::sign( ::CORE::cmp(x,y));
-        }
-        CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT(Type,Comparison_result)
-    };
-
-    class To_double
-      : public std::unary_function< Type, double > {
-      public:
-        double operator()( const Type& x ) const {
-          // this call is required to get reasonable values for the double
-          // approximation
-          return x.doubleValue();
-        }
-    };
-
-    class To_interval
-      : public std::unary_function< Type, std::pair< double, double > > {
-      public:
-        std::pair<double, double> operator()( const Type& x_ ) const {
-            CORE::Expr x(x_);
-            std::pair<double,double> result;
-            x.doubleInterval(result.first, result.second);
-            CGAL_expensive_assertion(result.first  <= x);
-            CGAL_expensive_assertion(result.second >= x);
-            return result;
-        }
-    };
-};
-
-/*! \ingroup NiX_Fraction_traits_spec
- *  \brief Specialization of Fraction_traits for ::leda::rational
- */
-template <>
-class Fraction_traits< CORE::BigRat > {
-public:
-    typedef CORE::BigRat Type;
-    typedef ::CGAL::Tag_true Is_fraction;
-    typedef CORE::BigInt Numerator_type;
-    typedef Numerator_type Denominator_type;
-
-    typedef Algebraic_structure_traits< Numerator_type >::Gcd Common_factor;
-
-    class Decompose {
-    public:
-        typedef Type first_argument_type;
-        typedef Numerator_type& second_argument_type;
-        typedef Numerator_type& third_argument_type;
-        void operator () (
-                const Type& rat,
-                Numerator_type& num,
-                Numerator_type& den) {
-            num = CGAL_CORE_NUMERATOR(rat);
-            den = CGAL_CORE_DENOMINATOR(rat);
-        }
-    };
-
-    class Compose {
-    public:
-        typedef Numerator_type first_argument_type;
-        typedef Numerator_type second_argument_type;
-        typedef Type result_type;
-        Type operator ()(
-                const Numerator_type& num ,
-                const Numerator_type& den ) {
-            return Type(num, den);
-        }
-    };
-};
-
-template <class F>
-class Output_rep< ::CORE::BigRat, F> {
-    const ::CORE::BigRat& t;
-public:
-    //! initialize with a const reference to \a t.
-    Output_rep( const ::CORE::BigRat& tt) : t(tt) {}
-    //! perform the output, calls \c operator\<\< by default.
-    std::ostream& operator()( std::ostream& out) const {
-        switch (get_mode(out)) {
-        case IO::PRETTY:{
-            if(CGAL_CORE_DENOMINATOR(t) == ::CORE::BigRat(1))
-                return out <<CGAL_CORE_NUMERATOR(t);
-            else
-                return out << CGAL_CORE_NUMERATOR(t)
-                           << "/"
-                           << CGAL_CORE_DENOMINATOR(t);
-            //break; // unreachable
-        }
-
-        default:
-            return out << CGAL_CORE_NUMERATOR(t)
-                       << "/"
-                       << CGAL_CORE_DENOMINATOR(t);
-        }
-    }
-};
-
-template <>
-struct Needs_parens_as_product< ::CORE::BigRat >{
-    bool operator()( ::CORE::BigRat t){
-        if (CGAL_CORE_DENOMINATOR(t) != 1 )
-            return true;
-        else
-            return needs_parens_as_product(CGAL_CORE_NUMERATOR(t)) ;
-    }
-};
-
-template <>
-class Output_rep< ::CORE::BigRat, Parens_as_product_tag > {
-    const ::CORE::BigRat& t;
-public:
-    // Constructor
-    Output_rep( const ::CORE::BigRat& tt) : t(tt) {}
-    // operator
-    std::ostream& operator()( std::ostream& out) const {
-        Needs_parens_as_product< ::CORE::BigRat > needs_parens_as_product;
-        if (needs_parens_as_product(t))
-            return out <<"("<< oformat(t) <<")";
-        else
-            return out << oformat(t);
-    }
-};
-
-// Benchmark_rep specialization 
-template<>
-class Benchmark_rep< CORE::BigRat > {
-    const CORE::BigRat& t;
-public:
-    //! initialize with a const reference to \a t.
-    Benchmark_rep( const CORE::BigRat& tt) : t(tt) {}
-    //! perform the output, calls \c operator\<\< by default.
-    std::ostream& operator()( std::ostream& out) const { 
-            out << "Rational(" << numerator(t) << "," << denominator(t) << ")";
-            return out;
-    }
-    
-    static std::string get_benchmark_name() {
-        return "Rational";
-    }
-};
-
-} //namespace CGAL
-
-//since types are included by CORE_coercion_traits.h:
-#include <CGAL/CORE_Expr.h>
-#include <CGAL/CORE_BigInt.h>
-#include <CGAL/CORE_BigRat.h>
-#include <CGAL/CORE_BigFloat.h>
-#include <CGAL/CORE_arithmetic_kernel.h>
-
-namespace Eigen {
-  template<class> struct NumTraits;
-  template<> struct NumTraits<CORE::BigRat>
-  {
-    typedef CORE::BigRat Real;
-    typedef CORE::BigRat NonInteger;
-    typedef CORE::BigRat Nested;
-
-    static inline Real epsilon() { return 0; }
-    static inline Real dummy_precision() { return 0; }
-
-    enum {
-      IsInteger = 0,
-      IsSigned = 1,
-      IsComplex = 0,
-      RequireInitialization = 1,
-      ReadCost = 6,
-      AddCost = 150,
-      MulCost = 100
-    };
-  };
-}
-
-#endif // CGAL_CORE_BIGRAT_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE_Expr.h b/3rdparty/CGAL-4.8/include/CGAL/CORE_Expr.h
deleted file mode 100644
index 579a209..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/CORE_Expr.h
+++ /dev/null
@@ -1,215 +0,0 @@
-// Copyright (c) 2002-2004,2007  
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved. 
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Sylvain Pion, Michael Hemmer
-
-#ifndef CGAL_CORE_EXPR_H
-#define CGAL_CORE_EXPR_H
-
-#include <CGAL/number_type_basic.h>
-#include <CGAL/CORE_coercion_traits.h>
-#include <CGAL/CORE/Expr.h>
-#include <utility>
-
-
-namespace CGAL {
-
-template <> class Algebraic_structure_traits< CORE::Expr >
-  : public Algebraic_structure_traits_base< CORE::Expr,
-                                            Field_with_root_of_tag >  {
-  public:
-    typedef Tag_true            Is_exact;
-    typedef Tag_true            Is_numerical_sensitive;
-
-    class Sqrt
-      : public std::unary_function< Type, Type > {
-      public:
-        Type operator()( const Type& x ) const {
-          return CORE::sqrt( x );
-        }
-    };
-
-    class Kth_root
-      : public std::binary_function<int, Type, Type> {
-      public:
-        Type operator()( int k,
-                                        const Type& x) const {
-          CGAL_precondition_msg( k > 0, "'k' must be positive for k-th roots");
-          // CORE::radical isn't implemented for negative values of x, so we
-          //  have to handle this case separately
-          if( x < 0 && k%2 != 0)
-            return -CORE::radical( -x, k );
-
-          return CORE::radical( x, k );
-        }
-    };
-
-    class Root_of {
-      public:
-//        typedef CORE::BigRat Boundary;
-        typedef Type   result_type;
-
-
-      public:
-        // constructs the kth roots of the polynomial
-        // given by the iterator range, starting from 0.
-        template< class ForwardIterator >
-        Type operator()( int k,
-                                        ForwardIterator begin,
-                                        ForwardIterator end) const {
-            std::vector<Type> coeffs;
-            for(ForwardIterator it = begin; it != end; it++){
-                coeffs.push_back(*it);
-            }
-            CORE::Polynomial<Type> polynomial(coeffs);
-            return Type(polynomial,k);
-        }
-
-// TODO: Need to be fixed: polynomial<CORE::Expr>.eval() cannot return
-//       CORE::BigFloat, so this does not compile.
-
-/*        template <class ForwardIterator>
-        Type operator()( CORE::BigRat lower,
-                                        CORE::BigRat upper,
-                                        ForwardIterator begin,
-                                        ForwardIterator end) const {
-            std::vector<Type> coeffs;
-            for(ForwardIterator it = begin; it != end; it++){
-                 coeffs.push_back(*it);
-            }
-            CORE::Polynomial<Type> polynomial(coeffs);
-            CORE::BigFloat lower_bf, upper_bf;
-            CORE::BigFloat eval_at_lower(0), eval_at_upper(0);
-
-            CORE::extLong r(16),a(16);
-            while((eval_at_lower.isZeroIn() ||
-                   eval_at_upper.isZeroIn())){
-                //std::cout << "while"<<std::endl;
-                r*=2;
-                a*=2;
-                lower_bf.approx(lower,r,a);
-                upper_bf.approx(upper,r,a);
-                // The most expensive precond I've ever seen :)),
-                // since the coefficients of the polynomial are CORE::Expr
-                // TODO: be sure that lower_bf, upper_bf contain exactly one root
-                //NiX_expensive_precond(
-                //     CORE::Sturm(polynomial).numberOfRoots(lower_bf,upper_bf)==1);
-                eval_at_lower = polynomial.eval(lower_bf);
-                eval_at_upper = polynomial.eval(upper_bf);
-            }
-            CORE::BFInterval interval(lower_bf,upper_bf);
-
-            return Type(polynomial,interval);
-        };  */
-    };
-
-};
-
-template <> class Real_embeddable_traits< CORE::Expr >
-  : public INTERN_RET::Real_embeddable_traits_base< CORE::Expr , CGAL::Tag_true > {
-  public:
-    class Abs
-      : public std::unary_function< Type, Type > {
-      public:
-        Type operator()( const Type& x ) const {
-            return CORE::abs( x );
-        }
-    };
-
-    class Sgn
-      : public std::unary_function< Type, ::CGAL::Sign > {
-      public:
-        ::CGAL::Sign operator()( const Type& x ) const {
-          return (::CGAL::Sign) CORE::sign( x );
-        }
-    };
-
-    class Compare
-      : public std::binary_function< Type, Type,
-                                Comparison_result > {
-      public:
-        Comparison_result operator()( const Type& x,
-                                            const Type& y ) const {
-          return (Comparison_result) CORE::cmp( x, y );
-        }
-
-        CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT( Type,
-                                                      Comparison_result )
-
-    };
-
-    class To_double
-      : public std::unary_function< Type, double > {
-      public:
-        double operator()( const Type& x ) const {
-          x.approx(53,1075);
-          return x.doubleValue();
-        }
-    };
-
-    class To_interval
-      : public std::unary_function< Type, std::pair< double, double > > {
-      public:
-        std::pair<double, double> operator()( const Type& x ) const {
-            std::pair<double,double> result;
-            x.approx(53,1075);
-            x.doubleInterval(result.first, result.second);
-            CGAL_expensive_assertion(result.first  <= x);
-            CGAL_expensive_assertion(result.second >= x);
-            return result;
-        }
-    };
-};
-
-} //namespace CGAL
-
-//since types are included by CORE_coercion_traits.h:
-#include <CGAL/CORE_Expr.h>
-#include <CGAL/CORE_BigInt.h> 
-#include <CGAL/CORE_BigRat.h>
-#include <CGAL/CORE_BigFloat.h>
-#include <CGAL/CORE_arithmetic_kernel.h>
-
-namespace Eigen {
-  template<class> struct NumTraits;
-  template<> struct NumTraits<CORE::Expr>
-  {
-    typedef CORE::Expr Real;
-    typedef CORE::Expr NonInteger;
-    typedef CORE::Expr Nested;
-
-    static inline Real epsilon() { return 0; }
-    static inline Real dummy_precision() { return 0; }
-
-    enum {
-      IsInteger = 0,
-      IsSigned = 1,
-      IsComplex = 0,
-      RequireInitialization = 1,
-      ReadCost = 6,
-      AddCost = 200,
-      MulCost = 200
-    };
-  };
-}
-
-#endif // CGAL_CORE_EXPR_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/Vector_2.h b/3rdparty/CGAL-4.8/include/CGAL/Cartesian/Vector_2.h
deleted file mode 100644
index cbaae74..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/Vector_2.h
+++ /dev/null
@@ -1,153 +0,0 @@
-// Copyright (c) 2000  
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved. 
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Andreas Fabri, Herve Bronnimann
-
-#ifndef CGAL_CARTESIAN_VECTOR_2_H
-#define CGAL_CARTESIAN_VECTOR_2_H
-
-#include <CGAL/Origin.h>
-#include <CGAL/array.h>
-#include <CGAL/constant.h>
-#include <CGAL/Handle_for.h>
-
-namespace CGAL {
-
-template < class R_ >
-class VectorC2
-{
-  typedef typename R_::FT                   FT;
-  typedef typename R_::Point_2              Point_2;
-  typedef typename R_::Vector_2             Vector_2;
-  typedef typename R_::Segment_2            Segment_2;
-  typedef typename R_::Ray_2                Ray_2;
-  typedef typename R_::Line_2               Line_2;
-  typedef typename R_::Direction_2          Direction_2;
-
-  typedef cpp11::array<FT, 2>               Rep;
-  typedef typename R_::template Handle<Rep>::type  Base;
-
-  Base base;
-
-public:
-
-  typedef typename Rep::const_iterator      Cartesian_const_iterator;
-
-  typedef R_                                R;
-
-  VectorC2() {}
- 
-  VectorC2(const FT &x, const FT &y)
-    : base(CGAL::make_array(x, y)) {}
-
-  VectorC2(const FT &hx, const FT &hy, const FT &hw)
-    : base( hw != FT(1) ? CGAL::make_array(hx/hw, hy/hw)
-                        : CGAL::make_array(hx, hy) ) {}
-
-  const FT & x() const
-  {
-      return CGAL::get_pointee_or_identity(base)[0];
-  }
-
-  const FT & y() const
-  {
-      return CGAL::get_pointee_or_identity(base)[1];
-  }
-
-  const FT & hx() const
-  {
-      return x();
-  }
-
-  const FT & hy() const
-  {
-      return y();
-  }
-
-  const FT& hw() const
-  {
-    return constant<FT, 1>();
-  }
-
-  Cartesian_const_iterator cartesian_begin() const
-  {
-    return CGAL::get_pointee_or_identity(base).begin();
-  }
-
-  Cartesian_const_iterator cartesian_end() const
-  {
-    return CGAL::get_pointee_or_identity(base).end();
-  }
-
-};
-
-template < class R >
-CGAL_KERNEL_INLINE
-bool 
-operator==(const VectorC2<R> &v, const VectorC2<R> &w)
-{
-  return w.x() == v.x() && w.y() == v.y();
-}
-
-template < class R >
-inline
-bool 
-operator!=(const VectorC2<R> &v, const VectorC2<R> &w)
-{
-  return !(v == w);
-}
-
-template < class R >
-inline
-bool
-operator==(const VectorC2<R> &v, const Null_vector &)
-{
-  return CGAL_NTS is_zero(v.x()) && CGAL_NTS is_zero(v.y());
-}
-
-template < class R >
-inline
-bool
-operator==(const Null_vector &n, const VectorC2<R> &v)
-{
-  return v == n;
-}
-
-template < class R >
-inline
-bool
-operator!=(const VectorC2<R> &v, const Null_vector &n)
-{
-  return !(v == n);
-}
-
-template < class R >
-inline
-bool
-operator!=(const Null_vector &n, const VectorC2<R> &v)
-{
-  return !(v == n);
-}
-
-} //namespace CGAL
-
-#endif // CGAL_CARTESIAN_VECTOR_2_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/function_objects.h b/3rdparty/CGAL-4.8/include/CGAL/Cartesian/function_objects.h
deleted file mode 100644
index 71b30a5..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/function_objects.h
+++ /dev/null
@@ -1,4064 +0,0 @@
-// Copyright (c) 1999-2005  
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved. 
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Stefan Schirra, Sylvain Pion, Michael Hoffmann
-
-#ifndef CGAL_CARTESIAN_FUNCTION_OBJECTS_H
-#define CGAL_CARTESIAN_FUNCTION_OBJECTS_H
-
-#include <CGAL/Kernel/function_objects.h>
-#include <CGAL/predicates/kernel_ftC2.h>
-#include <CGAL/predicates/kernel_ftC3.h>
-#include <CGAL/constructions/kernel_ftC2.h>
-#include <CGAL/constructions/kernel_ftC3.h>
-#include <CGAL/Cartesian/solve_3.h>
-
-namespace CGAL {
-
-namespace CartesianKernelFunctors {
-
-  using namespace CommonKernelFunctors;
-
-  template <typename K>
-  class Angle_2
-  {
-    typedef typename K::Point_2  Point_2;
-    typedef typename K::Vector_2 Vector_2;
-  public:
-    typedef typename K::Angle   result_type;
-
-    result_type
-    operator()(const Vector_2& u, const Vector_2& v) const
-    { return angleC2(u.x(), u.y(), v.x(), v.y()); }
-
-    result_type
-    operator()(const Point_2& p, const Point_2& q, const Point_2& r) const
-    { return angleC2(p.x(), p.y(), q.x(), q.y(), r.x(), r.y()); }
-
-    result_type
-    operator()(const Point_2& p, const Point_2& q, 
-               const Point_2& r, const Point_2& s) const
-    {
-      return angleC2(p.x(), p.y(),
-		     q.x(), q.y(),
-		     r.x(), r.y(),
-                     s.x(), s.y());
-    }
-  };
-
-  template <typename K>
-  class Angle_3
-  {
-    typedef typename K::Point_3  Point_3;
-    typedef typename K::Vector_3 Vector_3;
-  public:
-    typedef typename K::Angle    result_type;
-
-    result_type
-    operator()(const Vector_3& u, const Vector_3& v) const
-    {
-      return angleC3(u.x(), u.y(), u.z(),
-		     v.x(), v.y(), v.z());
-    }
-    result_type
-    operator()(const Point_3& p, const Point_3& q, const Point_3& r) const
-    {
-      return angleC3(p.x(), p.y(), p.z(),
-		     q.x(), q.y(), q.z(),
-		     r.x(), r.y(), r.z());
-    }
-
-    result_type
-    operator()(const Point_3& p, const Point_3& q,
-               const Point_3& r, const Point_3& s) const
-    {
-      return angleC3(p.x(), p.y(), p.z(),
-		     q.x(), q.y(), q.z(),
-		     r.x(), r.y(), r.z(),
-		     s.x(), s.y(), s.z());
-    }
-  };
-
-  template <typename K>
-  class Are_parallel_2
-  {
-    typedef typename K::Line_2          Line_2;
-    typedef typename K::Segment_2       Segment_2;
-    typedef typename K::Ray_2           Ray_2;
-
-  public:
-    typedef typename K::Boolean         result_type;
-
-    result_type
-    operator()(const Line_2& l1, const Line_2& l2) const
-    { return parallelC2(l1.a(), l1.b(), l2.a(), l2.b()); }
-
-    result_type
-    operator()(const Segment_2& s1, const Segment_2& s2) const
-    { return parallelC2(s1.source().x(), s1.source().y(),
-                        s1.target().x(), s1.target().y(),
-                        s2.source().x(), s2.source().y(),
-                        s2.target().x(), s2.target().y());
-    }
-
-    result_type
-    operator()(const Ray_2& r1, const Ray_2& r2) const
-    { return parallelC2(r1.source().x(), r1.source().y(),
-                        r1.second_point().x(), r1.second_point().y(),
-                        r2.source().x(), r2.source().y(),
-                        r2.second_point().x(), r2.second_point().y());
-    }
-  };
-
-  template <typename K>
-  class Are_parallel_3
-  {
-    typedef typename K::Line_3          Line_3;
-    typedef typename K::Segment_3       Segment_3;
-    typedef typename K::Ray_3           Ray_3;
-    typedef typename K::Plane_3         Plane_3;
-
-  public:
-    typedef typename K::Boolean         result_type;
-
-    result_type
-    operator()(const Line_3& l1, const Line_3& l2) const
-    { return parallelC3(
-                l1.to_vector().x(), l1.to_vector().y(), l1.to_vector().z(),
-                l2.to_vector().x(), l2.to_vector().y(), l2.to_vector().z());
-    }
-
-    result_type
-    operator()(const Plane_3& h1, const Plane_3& h2) const
-    { return parallelC3(h1.a(), h1.b(), h1.c(),
-                        h2.a(), h2.b(), h2.c());
-    }
-
-    result_type
-    operator()(const Segment_3& s1, const Segment_3& s2) const
-    { return parallelC3(s1.source().x(), s1.source().y(), s1.source().z(),
-                        s1.target().x(), s1.target().y(), s1.target().z(),
-                        s2.source().x(), s2.source().y(), s2.source().z(),
-                        s2.target().x(), s2.target().y(), s2.target().z());
-    }
-
-    result_type
-    operator()(const Ray_3& r1, const Ray_3& r2) const
-    { return parallelC3(r1.source().x(), r1.source().y(), r1.source().z(),
-	r1.second_point().x(), r1.second_point().y(), r1.second_point().z(),
-                        r2.source().x(), r2.source().y(), r2.source().z(),
-	r2.second_point().x(), r2.second_point().y(), r2.second_point().z());
-    }
-  };
-
-  template <typename K>
-  class Bounded_side_2
-  {
-    typedef typename K::Point_2         Point_2;
-    typedef typename K::Circle_2        Circle_2;
-    typedef typename K::Triangle_2      Triangle_2;
-    typedef typename K::Iso_rectangle_2 Iso_rectangle_2;
-  public:
-    typedef typename K::Bounded_side    result_type;
-
-    result_type
-    operator()( const Circle_2& c, const Point_2& p) const
-    {
-      typename K::Compute_squared_distance_2 squared_distance;
-      return enum_cast<Bounded_side>(CGAL::compare(c.squared_radius(),
-                                                   squared_distance(c.center(),p)));
-    }
-
-    result_type
-    operator()( const Triangle_2& t, const Point_2& p) const
-    {
-      typename K::Collinear_are_ordered_along_line_2
-	collinear_are_ordered_along_line;
-      typename K::Orientation_2 orientation;
-      typename K::Orientation o1 = orientation(t.vertex(0), t.vertex(1), p),
-	                      o2 = orientation(t.vertex(1), t.vertex(2), p),
-	                      o3 = orientation(t.vertex(2), t.vertex(3), p);
-
-      if (o2 == o1 && o3 == o1)
-	return ON_BOUNDED_SIDE;
-      return
-	(o1 == COLLINEAR
-	 && collinear_are_ordered_along_line(t.vertex(0), p, t.vertex(1))) ||
-	(o2 == COLLINEAR
-	 && collinear_are_ordered_along_line(t.vertex(1), p, t.vertex(2))) ||
-	(o3 == COLLINEAR
-	 && collinear_are_ordered_along_line(t.vertex(2), p, t.vertex(3)))
-	? ON_BOUNDARY
-	: ON_UNBOUNDED_SIDE;
-    }
-
-    result_type
-    operator()( const Iso_rectangle_2& r, const Point_2& p) const
-    {
-      bool x_incr = (r.xmin() < p.x()) && (p.x() < r.xmax()),
-	   y_incr = (r.ymin() < p.y()) && (p.y() < r.ymax());
-      if (x_incr)
-	{
-	  if (y_incr)
-	    return ON_BOUNDED_SIDE;
-	  if ( (p.y() == r.ymin()) || (r.ymax() == p.y()) )
-	    return ON_BOUNDARY;
-	}
-      if ( (p.x() == r.xmin()) || (r.xmax() == p.x()) )
-	if ( y_incr || (p.y() == r.ymin()) || (r.ymax() == p.y()) )
-          return ON_BOUNDARY;
-
-      return ON_UNBOUNDED_SIDE;
-    }
-  };
-
-  template <typename K>
-  class Bounded_side_3
-  {
-    typedef typename K::FT              FT;
-    typedef typename K::Point_3         Point_3;
-    typedef typename K::Sphere_3        Sphere_3;
-    typedef typename K::Circle_3        Circle_3;
-    typedef typename K::Tetrahedron_3   Tetrahedron_3;
-    typedef typename K::Iso_cuboid_3    Iso_cuboid_3;
-  public:
-    typedef typename K::Bounded_side    result_type;
-
-    result_type
-    operator()( const Sphere_3& s, const Point_3& p) const
-    { return s.rep().bounded_side(p); }
-
-    result_type
-    operator()( const Circle_3& s, const Point_3& p) const
-    { return s.rep().bounded_side(p); }
-
-    result_type
-    operator()( const Tetrahedron_3& t, const Point_3& p) const
-    {
-      FT alpha, beta, gamma;
-
-      Cartesian_internal::solve(t.vertex(1)-t.vertex(0),
-                                t.vertex(2)-t.vertex(0),
-                                t.vertex(3)-t.vertex(0),
-                                p - t.vertex(0), alpha, beta, gamma);
-      if (   (alpha < 0) || (beta < 0) || (gamma < 0)
-          || (alpha + beta + gamma > 1) )
-          return ON_UNBOUNDED_SIDE;
-
-      if (   (alpha == 0) || (beta == 0) || (gamma == 0)
-          || (alpha+beta+gamma == 1) )
-        return ON_BOUNDARY;
-
-      return ON_BOUNDED_SIDE;
-    }
-
-    result_type
-    operator()( const Iso_cuboid_3& c, const Point_3& p) const
-    {
-      return c.rep().bounded_side(p);
-    }
-
-  };
-
-  template <typename K>
-  class Collinear_are_ordered_along_line_2
-  {
-    typedef typename K::Point_2         Point_2;
-  public:
-    typedef typename K::Boolean         result_type;
-
-    result_type
-    operator()(const Point_2& p, const Point_2& q, const Point_2& r) const
-    {
-      CGAL_kernel_exactness_precondition( collinear(p, q, r) );
-      return collinear_are_ordered_along_lineC2
-	(p.x(), p.y(), q.x(), q.y(), r.x(), r.y());
-    }
-  };
-
-  template <typename K>
-  class Collinear_are_ordered_along_line_3
-  {
-    typedef typename K::Point_3         Point_3;
-  public:
-    typedef typename K::Boolean         result_type;
-
-    result_type
-    operator()(const Point_3& p, const Point_3& q, const Point_3& r) const
-    {
-      CGAL_kernel_exactness_precondition( collinear(p, q, r) );
-      return collinear_are_ordered_along_lineC3(p.x(), p.y(), p.z(),
-						q.x(), q.y(), q.z(),
-						r.x(), r.y(), r.z());
-    }
-  };
-
-  template <typename K>
-  class Collinear_are_strictly_ordered_along_line_2
-  {
-    typedef typename K::Point_2         Point_2;
-  public:
-    typedef typename K::Boolean         result_type;
-
-    result_type
-    operator()(const Point_2& p, const Point_2& q, const Point_2& r) const
-    {
-      CGAL_kernel_exactness_precondition( collinear(p, q, r) );
-      return collinear_are_strictly_ordered_along_lineC2
-	(p.x(), p.y(), q.x(), q.y(), r.x(), r.y());
-    }
-  };
-
-  template <typename K>
-  class Collinear_are_strictly_ordered_along_line_3
-  {
-    typedef typename K::Point_3         Point_3;
-  public:
-    typedef typename K::Boolean         result_type;
-
-    result_type
-    operator()(const Point_3& p, const Point_3& q, const Point_3& r) const
-    {
-      CGAL_kernel_exactness_precondition( collinear(p, q, r) );
-      return collinear_are_strictly_ordered_along_lineC3(p.x(), p.y(), p.z(),
-							 q.x(), q.y(), q.z(),
-							 r.x(), r.y(), r.z());
-    }
-  };
-
-  template <typename K>
-  class Collinear_has_on_2
-  {
-    typedef typename K::Point_2               Point_2;
-    typedef typename K::Ray_2                 Ray_2;
-    typedef typename K::Segment_2             Segment_2;
-  public:
-    typedef typename K::Boolean               result_type;
-
-    result_type
-    operator()( const Ray_2& r, const Point_2& p) const
-    {
-      const Point_2 & source = r.source();
-      const Point_2 & second = r.second_point();
-      switch(make_certain(compare_x(source, second))) {
-      case SMALLER:
-        return compare_x(source, p) != LARGER;
-      case LARGER:
-        return compare_x(p, source) != LARGER;
-      default:
-        switch(make_certain(compare_y(source, second))){
-        case SMALLER:
-	  return compare_y(source, p) != LARGER;
-        case LARGER:
-	  return compare_y(p, source) != LARGER;
-        default:
-	  return true; // p == source
-        }
-      } // switch
-    }
-
-    result_type
-    operator()( const Segment_2& s, const Point_2& p) const
-    {
-      return collinear_are_ordered_along_line(s.source(), p, s.target());
-    }
-  };
-
-  template <typename K>
-  class Collinear_2
-  {
-    typedef typename K::Point_2        Point_2;
-    typedef typename K::Orientation_2  Orientation_2;
-    Orientation_2 o;
-  public:
-    typedef typename K::Boolean        result_type;
-
-    Collinear_2() {}
-    Collinear_2(const Orientation_2 o_) : o(o_) {}
-
-    result_type
-    operator()(const Point_2& p, const Point_2& q, const Point_2& r) const
-    { return o(p, q, r) == COLLINEAR; }
-  };
-
-  template <typename K>
-  class Collinear_3
-  {
-    typedef typename K::Point_3    Point_3;
-  public:
-    typedef typename K::Boolean    result_type;
-
-    result_type
-    operator()(const Point_3& p, const Point_3& q, const Point_3& r) const
-    {
-      return collinearC3(p.x(), p.y(), p.z(),
-			 q.x(), q.y(), q.z(),
-			 r.x(), r.y(), r.z());
-    }
-  };
-
-  template <typename K>
-  class Compare_angle_with_x_axis_2
-  {
-    typedef typename K::Direction_2        Direction_2;
-  public:
-    typedef typename K::Comparison_result  result_type;
-
-    result_type
-    operator()(const Direction_2& d1, const Direction_2& d2) const
-    {
-      return compare_angle_with_x_axisC2(d1.dx(), d1.dy(), d2.dx(), d2.dy());
-    }
-  };
-
-  template <typename K>
-  class Compare_distance_2
-  {
-    typedef typename K::Point_2            Point_2;
-  public:
-    typedef typename K::Comparison_result  result_type;
-
-    result_type
-    operator()(const Point_2& p, const Point_2& q, const Point_2& r) const
-    {
-      return cmp_dist_to_pointC2(p.x(), p.y(), q.x(), q.y(), r.x(), r.y());
-    }
-
-    template <class T1, class T2, class T3>
-    result_type
-    operator()(const T1& p, const T2& q, const T3& r) const
-    {
-      return CGAL::compare(squared_distance(p, q), squared_distance(p, r));
-    }
-
-    template <class T1, class T2, class T3, class T4>
-    result_type
-    operator()(const T1& p, const T2& q, const T3& r, const T4& s) const
-    {
-      return CGAL::compare(squared_distance(p, q), squared_distance(r, s));
-    }
-  };
-
-  template <typename K>
-  class Compare_distance_3
-  {
-    typedef typename K::Point_3            Point_3;
-  public:
-    typedef typename K::Comparison_result  result_type;
-
-    result_type
-    operator()(const Point_3& p, const Point_3& q, const Point_3& r) const
-    {
-      return cmp_dist_to_pointC3(p.x(), p.y(), p.z(),
-				 q.x(), q.y(), q.z(),
-				 r.x(), r.y(), r.z());
-    }
-
-    template <class T1, class T2, class T3>
-    result_type
-    operator()(const T1& p, const T2& q, const T3& r) const
-    {
-      return CGAL::compare(squared_distance(p, q), squared_distance(p, r));
-    }
-
-    template <class T1, class T2, class T3, class T4>
-    result_type
-    operator()(const T1& p, const T2& q, const T3& r, const T4& s) const
-    {
-      return CGAL::compare(squared_distance(p, q), squared_distance(r, s));
-    }
-  };
-
-  template <typename K>
-  class Compare_squared_radius_3
-  {
-    typedef typename K::Point_3            Point_3;
-    typedef typename K::FT                 FT;
-  public:
-    typedef typename K::Comparison_result  result_type;
-
-    result_type
-    operator()(const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& s, const FT& ft) const
-    {
-      return CGAL::compare(squared_radiusC3(p.x(), p.y(), p.z(), 
-                                            q.x(), q.y(), q.z(), 
-                                            r.x(), r.y(), r.z(), 
-                                            s.x(), s.y(), s.z() ),
-                           ft);
-    }
-
-    result_type
-    operator()(const Point_3& p, const Point_3& q, const Point_3& r, const FT& ft) const
-    {
-      return CGAL::compare(squared_radiusC3(p.x(), p.y(), p.z(), 
-                                            q.x(), q.y(), q.z(), 
-                                            r.x(), r.y(), r.z()),
-                           ft);
-    }
-
-    result_type
-    operator()(const Point_3& p, const Point_3& q, const FT& ft) const
-    {
-      return CGAL::compare(squared_radiusC3(p.x(), p.y(), p.z(), 
-                                            q.x(), q.y(), q.z() ),
-                           ft);
-    }
-    
-    result_type
-    operator()(const Point_3&, const FT& ft) const
-    {
-      return - CGAL_NTS sign(ft);
-    }    
-  };
-
-
-
-  template <typename K>
-  class Compare_slope_2
-  {
-    typedef typename K::Line_2             Line_2;
-    typedef typename K::Segment_2          Segment_2;
-  public:
-    typedef typename K::Comparison_result  result_type;
-
-    result_type
-    operator()(const Line_2& l1, const Line_2& l2) const
-    {
-      return compare_slopesC2(l1.a(), l1.b(), l2.a(), l2.b());
-    }
-
-    result_type
-    operator()(const Segment_2& s1, const Segment_2& s2) const
-    {
-      return compare_slopesC2(s1.source().x(), s1.source().y(),
-			      s1.target().x(), s1.target().y(),
-			      s2.source().x(), s2.source().y(),
-			      s2.target().x(), s2.target().y());
-    }
-  };
-
-  template <typename K>
-  class Compare_x_at_y_2
-  {
-    typedef typename K::Point_2             Point_2;
-    typedef typename K::Line_2              Line_2;
-  public:
-    typedef typename K::Comparison_result   result_type;
-
-    result_type
-    operator()( const Point_2& p, const Line_2& h) const
-    { return compare_y_at_xC2(p.y(), p.x(), h.b(), h.a(), h.c()); }
-
-    result_type
-    operator()( const Point_2& p, const Line_2& h1, const Line_2& h2) const
-    {
-      return compare_y_at_xC2(p.y(), h1.b(), h1.a(), h1.c(),
-			      h2.b(), h2.a(), h2.c());
-    }
-
-    result_type
-    operator()( const Line_2& l1, const Line_2& l2, const Line_2& h) const
-    {
-      return compare_y_at_xC2(l1.b(), l1.a(), l1.c(), l2.b(), l2.a(), l2.c(),
-			      h.b(), h.a(), h.c());
-    }
-
-    result_type
-    operator()( const Line_2& l1, const Line_2& l2,
-	        const Line_2& h1, const Line_2& h2) const
-    {
-      return compare_y_at_xC2(l1.b(), l1.a(), l1.c(), l2.b(), l2.a(), l2.c(),
-			      h1.b(), h1.a(), h1.c(), h2.b(), h2.a(), h2.c());
-    }
-  };
-
-  template <typename K>
-  class Compare_xyz_3
-  {
-    typedef typename K::Point_3             Point_3;
-  public:
-    typedef typename K::Comparison_result   result_type;
-
-    result_type
-    operator()( const Point_3& p, const Point_3& q) const
-    {
-      return compare_lexicographically_xyzC3(p.x(), p.y(), p.z(),
-					     q.x(), q.y(), q.z());
-    }
-  };
-
-  template <typename K>
-  class Compare_xy_2
-  {
-    typedef typename K::Point_2            Point_2;
-  public:
-    typedef typename K::Comparison_result  result_type;
-
-    result_type
-    operator()( const Point_2& p, const Point_2& q) const
-    { return compare_lexicographically_xyC2(p.x(), p.y(), q.x(), q.y()); }
-  };
-
-  template <typename K>
-  class Compare_xy_3
-  {
-    typedef typename K::Point_3            Point_3;
-  public:
-    typedef typename K::Comparison_result  result_type;
-
-    result_type
-    operator()( const Point_3& p, const Point_3& q) const
-    { return compare_lexicographically_xyC2(p.x(), p.y(), q.x(), q.y()); }
-  };
-
-  template <typename K>
-  class Compare_x_2
-  {
-    typedef typename K::Point_2             Point_2;
-    typedef typename K::Line_2              Line_2;
-  public:
-    typedef typename K::Comparison_result   result_type;
-
-    result_type
-    operator()( const Point_2& p, const Point_2& q) const
-    { return CGAL::compare(p.x(), q.x()); }
-
-    result_type
-    operator()( const Point_2& p, const Line_2& l, const Line_2& h) const
-    { return compare_xC2(p.x(), l.a(), l.b(), l.c(), h.a(), h.b(), h.c()); }
-
-    result_type
-    operator()( const Line_2& l, const Line_2& h1, const Line_2& h2) const
-    {
-      return compare_xC2(l.a(), l.b(), l.c(), h1.a(), h1.b(), h1.c(),
-			 h2.a(), h2.b(), h2.c());
-    }
-
-    result_type
-    operator()( const Line_2& l1, const Line_2& l2,
-	        const Line_2& h1, const Line_2& h2) const
-    {
-      return compare_xC2(l1.a(), l1.b(), l1.c(), l2.a(), l2.b(), l2.c(),
-			 h1.a(), h1.b(), h1.c(), h2.a(), h2.b(), h2.c());
-    }
-  };
-
-  template <typename K>
-  class Compare_x_3
-  {
-    typedef typename K::Point_3             Point_3;
-  public:
-    typedef typename K::Comparison_result   result_type;
-
-    result_type
-    operator()( const Point_3& p, const Point_3& q) const
-    { return CGAL::compare(p.x(), q.x()); }
-  };
-
-  template <typename K>
-  class Compare_yx_2
-  {
-    typedef typename K::Point_2            Point_2;
-  public:
-    typedef typename K::Comparison_result  result_type;
-
-    result_type
-    operator()( const Point_2& p, const Point_2& q) const
-    { return compare_lexicographically_xyC2(p.y(), p.x(), q.y(), q.x()); }
-  };
-
-  template <typename K>
-  class Compare_y_at_x_2
-  {
-    typedef typename K::Point_2             Point_2;
-    typedef typename K::Line_2              Line_2;
-    typedef typename K::Segment_2           Segment_2;
-  public:
-    typedef typename K::Comparison_result   result_type;
-
-    result_type
-    operator()( const Point_2& p, const Line_2& h) const
-    { return compare_y_at_xC2(p.x(), p.y(), h.a(), h.b(), h.c()); }
-
-    result_type
-    operator()( const Point_2& p, const Line_2& h1, const Line_2& h2) const
-    {
-      return compare_y_at_xC2(p.x(), h1.a(), h1.b(), h1.c(),
-			      h2.a(), h2.b(), h2.c());
-    }
-
-    result_type
-    operator()( const Line_2& l1, const Line_2& l2, const Line_2& h) const
-    {
-      return compare_y_at_xC2(l1.a(), l1.b(), l1.c(), l2.a(), l2.b(), l2.c(),
-			      h.a(), h.b(), h.c());
-    }
-
-    result_type
-    operator()( const Line_2& l1, const Line_2& l2,
-	        const Line_2& h1, const Line_2& h2) const
-    {
-      return compare_y_at_xC2(l1.a(), l1.b(), l1.c(), l2.a(), l2.b(), l2.c(),
-			      h1.a(), h1.b(), h1.c(), h2.a(), h2.b(), h2.c());
-    }
-
-    result_type
-    operator()( const Point_2& p, const Segment_2& s) const
-    {
-      return compare_y_at_xC2(p.x(), p.y(),
-			      s.source().x(), s.source().y(),
-			      s.target().x(), s.target().y());
-    }
-
-    result_type
-    operator()( const Point_2& p,
-	        const Segment_2& s1, const Segment_2& s2) const
-    {
-      return compare_y_at_x_segment_C2(p.x(),
-				       s1.source().x(), s1.source().y(),
-				       s1.target().x(), s1.target().y(),
-				       s2.source().x(), s2.source().y(),
-				       s2.target().x(), s2.target().y());
-    }
-  };
-
-  template <typename K>
-  class Compare_y_2
-  {
-    typedef typename K::Point_2             Point_2;
-    typedef typename K::Line_2              Line_2;
-  public:
-    typedef typename K::Comparison_result   result_type;
-
-    result_type
-    operator()( const Point_2& p, const Point_2& q) const
-    { return CGAL::compare(p.y(), q.y()); }
-
-    result_type
-    operator()( const Point_2& p, const Line_2& l1, const Line_2& l2) const
-    {
-      return compare_xC2(p.y(),
-			 l1.b(), l1.a(), l1.c(),
-			 l2.b(), l2.a(), l2.c());
-    }
-
-    result_type
-    operator()( const Line_2& l, const Line_2& h1, const Line_2& h2) const
-    {
-      return compare_xC2(l.b(), l.a(), l.c(), h1.b(), h1.a(), h1.c(),
-			 l.b(), l.a(), l.c(), h2.b(), h2.a(), h2.c());
-    }
-
-    result_type
-    operator()( const Line_2& l1, const Line_2& l2,
-	        const Line_2& h1, const Line_2& h2) const
-    {
-      return compare_xC2(l1.b(), l1.a(), l1.c(), l2.b(), l2.a(), l2.c(),
-			 h1.b(), h1.a(), h1.c(), h2.b(), h2.a(), h2.c());
-    }
-  };
-
-  template <typename K>
-  class Compare_y_3
-  {
-    typedef typename K::Point_3             Point_3;
-  public:
-    typedef typename K::Comparison_result   result_type;
-
-    result_type
-    operator()( const Point_3& p, const Point_3& q) const
-    { return CGAL::compare(p.y(), q.y()); }
-  };
-
-  template <typename K>
-  class Compare_z_3
-  {
-    typedef typename K::Point_3            Point_3;
-  public:
-    typedef typename K::Comparison_result  result_type;
-
-    result_type
-    operator()( const Point_3& p, const Point_3& q) const
-    { return CGAL::compare(p.z(), q.z()); }
-  };
-
-  template <class K>
-  class Compute_approximate_area_3
-  {
-    typedef typename K::Circle_3                  Circle_3;
-    typedef typename K::FT                        FT;
-
-  public:
-
-    typedef double result_type;
-
-    result_type 
-    operator() (const Circle_3 & c) const
-    // { return c.rep().approximate_area(); }
-    { return CGAL_PI * to_double(c.squared_radius()); }
-  };
-
-  template <class K>
-  class Compute_approximate_squared_length_3
-  {
-    typedef typename K::Circle_3                  Circle_3;
-    typedef typename K::FT                        FT;
-
-  public:
-
-    typedef double result_type;
-
-    result_type 
-    operator() (const Circle_3 & c) const
-    // { return c.rep().approximate_squared_length(); }
-    { return CGAL_PI * CGAL_PI * 4.0 * to_double(c.squared_radius()); }
-  };
-
-
-  template <typename K>
-  class Compute_area_2
-  {
-    typedef typename K::FT                FT;
-    typedef typename K::Iso_rectangle_2   Iso_rectangle_2;
-    typedef typename K::Triangle_2        Triangle_2;
-    typedef typename K::Point_2           Point_2;
-  public:
-    typedef FT               result_type;
-
-    result_type
-    operator()( const Point_2& p, const Point_2& q, const Point_2& r ) const
-    {
-      FT v1x = q.x() - p.x();
-      FT v1y = q.y() - p.y();
-      FT v2x = r.x() - p.x();
-      FT v2y = r.y() - p.y();
-      return determinant(v1x, v1y, v2x, v2y)/2;
-    }
-
-    result_type
-    operator()( const Iso_rectangle_2& r ) const
-    { return (r.xmax()-r.xmin()) * (r.ymax()-r.ymin()); }
-
-    result_type
-    operator()( const Triangle_2& t ) const
-    { return t.area(); }
-  };
-
-  template <typename K>
-  class Compute_area_divided_by_pi_3
-  {
-    typedef typename K::Circle_3                  Circle_3;
-    typedef typename K::FT                        FT;
-
-  public:
-
-    typedef FT result_type;
-
-    result_type 
-    operator()(const Circle_3 & c) const
-    { return c.rep().area_divided_by_pi(); }
-
-  };
-
-  template <typename K>
-  class Compute_determinant_2
-  {
-    typedef typename K::FT                FT;
-    typedef typename K::Vector_2          Vector_2;
-  public:
-    typedef FT               result_type;
-
-    result_type
-    operator()(const Vector_2& v, const Vector_2& w) const
-    {
-	return determinant(v.x(), v.y(), w.x(), w.y());
-    }
-  };
-
-  template <typename K>
-  class Compute_determinant_3
-  {
-    typedef typename K::FT                FT;
-    typedef typename K::Vector_3          Vector_3;
-  public:
-    typedef FT               result_type;
-
-    result_type
-    operator()(const Vector_3& v, const Vector_3& w, const Vector_3& t) const
-    {
-	return determinant(v.x(), v.y(), v.z(),
-                                 w.x(), w.y(), w.z(),
-                                 t.x(), t.y(), t.z());
-    }
-  };
-
-  template <typename K>
-  class Compute_scalar_product_2
-  {
-    typedef typename K::FT                FT;
-    typedef typename K::Vector_2          Vector_2;
-  public:
-    typedef FT               result_type;
-
-    result_type
-    operator()(const Vector_2& v, const Vector_2& w) const
-    {
-	return v.x() * w.x() + v.y() * w.y();
-    }
-  };
-
-  template <typename K>
-  class Compute_scalar_product_3
-  {
-    typedef typename K::FT                FT;
-    typedef typename K::Vector_3          Vector_3;
-  public:
-    typedef FT               result_type;
-
-    result_type
-    operator()(const Vector_3& v, const Vector_3& w) const
-    {
-	return v.x() * w.x() + v.y() * w.y() + v.z() * w.z();
-    }
-  };
-
-  template <typename K>
-  class Compute_squared_area_3
-  {
-    typedef typename K::FT                FT;
-    typedef typename K::Point_3           Point_3;
-    typedef typename K::Triangle_3        Triangle_3;
-  public:
-    typedef FT               result_type;
-
-    result_type
-    operator()( const Triangle_3& t ) const
-    {
-	return this->operator()(t.vertex(0), t.vertex(1), t.vertex(2));
-    }
-
-    result_type
-    operator()( const Point_3& p, const Point_3& q, const Point_3& r ) const
-    {
-	return squared_areaC3(p.x(), p.y(), p.z(),
-                              q.x(), q.y(), q.z(),
-                              r.x(), r.y(), r.z());
-    }
-  };
-
-  // FIXME
-  template <typename K>
-  class Compute_squared_distance_Point_Point_2
-  {
-    typedef typename K::FT       FT;
-    typedef typename K::Point_2  Point_2;
-  public:
-    typedef FT               result_type;
-
-    result_type
-    operator()( const Point_2& p, const Point_2& q) const
-    {
-      return squared_distanceC2(p.x(), p.y(), q.x(), q.y());
-    }
-  };
-
-  template <class K>
-  class Compute_squared_length_divided_by_pi_square_3
-  {
-    typedef typename K::Circle_3                  Circle_3;
-    typedef typename K::FT                        FT;
-
-  public:
-
-    typedef FT result_type;
-
-    result_type 
-    operator() (const Circle_3 & c) const
-    { return c.rep().squared_length_divided_by_pi_square(); }
-
-  };
-
-  // TODO ...
-  template <typename K>
-  class Compute_squared_radius_2
-  {
-    typedef typename K::FT          FT;
-    typedef typename K::Point_2     Point_2;
-    typedef typename K::Circle_2    Circle_2;
-  public:
-    template<class>
-    struct result {
-      typedef FT type;
-    };
-    
-    template<typename F>
-    struct result<F(Circle_2)> {
-      typedef const FT& type;
-    };
-
-    const FT&
-    operator()( const Circle_2& c) const
-    { return c.rep().squared_radius(); }
-
-    FT
-    operator()( const Point_2& /*p*/) const
-    { return FT(0); }
-
-    FT
-    operator()( const Point_2& p, const Point_2& q) const
-    { return squared_radiusC2(p.x(), p.y(), q.x(), q.y()); }
-
-    FT
-    operator()( const Point_2& p, const Point_2& q, const Point_2& r) const
-    { return squared_radiusC2(p.x(), p.y(), q.x(), q.y(), r.x(), r.y()); }
-  };
-
-} //namespace CartesianKernelFunctors
-
-// For the non specialized template will do the right thing,
-// namely return a copy of an FT
-
-namespace CartesianKernelFunctors {
-
-  template <typename K>
-  class Compute_squared_radius_3
-  {
-    typedef typename K::FT          FT;
-    typedef typename K::Point_3     Point_3;
-    typedef typename K::Sphere_3    Sphere_3;
-    typedef typename K::Circle_3    Circle_3;
-  public:
-    typedef FT               result_type;
-
-    result_type
-    operator()( const Sphere_3& s) const
-    { return s.rep().squared_radius(); }
-
-    result_type
-    operator()( const Circle_3& c) const
-    { return c.rep().squared_radius(); }
-
-    result_type
-    operator()( const Point_3& /*p*/) const
-    { return FT(0); }
-
-    result_type
-    operator()( const Point_3& p, const Point_3& q) const
-    {
-      return squared_radiusC3(p.x(), p.y(), p.z(),
-			      q.x(), q.y(), q.z());
-    }
-
-    result_type
-    operator()( const Point_3& p, const Point_3& q, const Point_3& r) const
-    {
-      return squared_radiusC3(p.x(), p.y(), p.z(),
-			      q.x(), q.y(), q.z(),
-			      r.x(), r.y(), r.z());
-    }
-
-    result_type
-    operator()( const Point_3& p, const Point_3& q,
-	        const Point_3& r, const Point_3& s) const
-    {
-      return squared_radiusC3(p.x(), p.y(), p.z(),
-			      q.x(), q.y(), q.z(),
-			      r.x(), r.y(), r.z(),
-			      s.x(), s.y(), s.z());
-    }
-  };
-
-  template <typename K>
-  class Compute_volume_3
-  {
-    typedef typename K::FT             FT;
-    typedef typename K::Point_3        Point_3;
-    typedef typename K::Tetrahedron_3  Tetrahedron_3;
-    typedef typename K::Iso_cuboid_3   Iso_cuboid_3;
-  public:
-    typedef FT               result_type;
-
-    result_type
-    operator()(const Point_3& p0, const Point_3& p1,
-	       const Point_3& p2, const Point_3& p3) const
-    {
-      return determinant<FT>(p1.x()-p0.x(), p1.y()-p0.y(), p1.z()-p0.z(),
-                             p2.x()-p0.x(), p2.y()-p0.y(), p2.z()-p0.z(),
-                             p3.x()-p0.x(), p3.y()-p0.y(), p3.z()-p0.z())/6;
-    }
-
-    result_type
-    operator()( const Tetrahedron_3& t ) const
-    {
-      return this->operator()(t.vertex(0), t.vertex(1),
-		              t.vertex(2), t.vertex(3));
-    }
-
-    result_type
-    operator()( const Iso_cuboid_3& c ) const
-    { return c.rep().volume(); }
-  };
-
-
-  template <typename K>
-  class Compute_x_2
-  {
-    typedef typename K::FT             FT;
-    typedef typename K::Point_2        Point_2;
-    typedef typename K::Vector_2       Vector_2;
-
-  public:
-    typedef const FT&                  result_type;
-
-    result_type
-    operator()(const Point_2& p) const
-    {
-      return p.rep().x();
-    }
-
-    result_type
-    operator()(const Vector_2& v) const
-    {
-      return v.rep().x();
-    }
-  };
-
-  template <typename K>
-  class Compute_x_3
-  {
-    typedef typename K::FT             FT;
-    typedef typename K::Point_3        Point_3;
-    typedef typename K::Vector_3       Vector_3;
-
-  public:
-    typedef const FT&                  result_type;
-
-    result_type
-    operator()(const Point_3& p) const
-    {
-      return p.rep().x();
-    }
-
-    result_type
-    operator()(const Vector_3& v) const
-    {
-      return v.rep().x();
-    }
-  };
-
-
-  template <typename K>
-  class Compute_y_2
-  {
-    typedef typename K::FT             FT;
-    typedef typename K::Point_2        Point_2;
-    typedef typename K::Vector_2       Vector_2;
-
-  public:
-    typedef const FT&                  result_type;
-
-    result_type
-    operator()(const Point_2& p) const
-    {
-      return p.rep().y();
-    }
-
-    result_type
-    operator()(const Vector_2& v) const
-    {
-      return v.rep().y();
-    }
-  };
-
-
-  template <typename K>
-  class Compute_y_3
-  {
-    typedef typename K::FT             FT;
-    typedef typename K::Point_3        Point_3;
-    typedef typename K::Vector_3       Vector_3;
-
-  public:
-    typedef const FT&                  result_type;
-
-    result_type
-    operator()(const Point_3& p) const
-    {
-      return p.rep().y();
-    }
-
-    result_type
-    operator()(const Vector_3& v) const
-    {
-      return v.rep().y();
-    }
-  };
-
-  template <typename K>
-  class Compute_z_3
-  {
-    typedef typename K::FT             FT;
-    typedef typename K::Point_3        Point_3;
-    typedef typename K::Vector_3       Vector_3;
-
-  public:
-    typedef const FT&                  result_type;
-
-    result_type
-    operator()(const Point_3& p) const
-    {
-      return p.rep().z();
-    }
-
-    result_type
-    operator()(const Vector_3& v) const
-    {
-      return v.rep().z();
-    }
-  };
-
-
-
-  template <typename K>
-  class Compute_dx_2
-  {
-    typedef typename K::FT             FT;
-    typedef typename K::Direction_2    Direction_2;
-
-  public:
-    typedef const FT&                  result_type;
-
-    result_type
-    operator()(const Direction_2& d) const
-    {
-      return d.rep().dx();
-    }
-  };
-
-  template <typename K>
-  class Compute_dx_3
-  {
-    typedef typename K::FT             FT;
-    typedef typename K::Direction_3    Direction_3;
-
-  public:
-    typedef const FT&                  result_type;
-
-    result_type
-    operator()(const Direction_3& d) const
-    {
-      return d.rep().dx();
-    }
-  };
-
-  template <typename K>
-  class Compute_dy_2
-  {
-    typedef typename K::FT             FT;
-    typedef typename K::Direction_2    Direction_2;
-
-  public:
-    typedef const FT&                  result_type;
-
-    result_type
-    operator()(const Direction_2& d) const
-    {
-      return d.rep().dy();
-    }
-  };
-
-  template <typename K>
-  class Compute_dy_3
-  {
-    typedef typename K::FT             FT;
-    typedef typename K::Direction_3    Direction_3;
-
-  public:
-    typedef const FT&                  result_type;
-
-    result_type
-    operator()(const Direction_3& d) const
-    {
-      return d.rep().dy();
-    }
-  };
-
-  template <typename K>
-  class Compute_dz_3
-  {
-    typedef typename K::FT             FT;
-    typedef typename K::Direction_3        Direction_3;
-
-  public:
-    typedef const FT&               result_type;
-
-    result_type
-    operator()(const Direction_3& d) const
-    {
-      return d.rep().dz();
-    }
-  };
-
-  template <typename K>
-  class Compute_hx_2
-  {
-    typedef typename K::FT             FT;
-    typedef typename K::Point_2        Point_2;
-    typedef typename K::Vector_2       Vector_2;
-
-  public:
-    typedef const FT&                  result_type;
-
-    result_type
-    operator()(const Point_2& p) const
-    {
-      return p.rep().hx();
-    }
-
-    result_type
-    operator()(const Vector_2& v) const
-    {
-      return v.rep().hx();
-    }
-  };
-
-  template <typename K>
-  class Compute_hx_3
-  {
-    typedef typename K::FT             FT;
-    typedef typename K::Point_3        Point_3;
-    typedef typename K::Vector_3       Vector_3;
-
-  public:
-    typedef const FT&                  result_type;
-
-    result_type
-    operator()(const Point_3& p) const
-    {
-      return p.rep().hx();
-    }
-
-    result_type
-    operator()(const Vector_3& v) const
-    {
-      return v.rep().hx();
-    }
-  };
-
-  template <typename K>
-  class Compute_hy_2
-  {
-    typedef typename K::FT             FT;
-    typedef typename K::Point_2        Point_2;
-    typedef typename K::Vector_2       Vector_2;
-
-  public:
-    typedef const FT&                  result_type;
-
-    result_type
-    operator()(const Point_2& p) const
-    {
-      return p.rep().hy();
-    }
-
-    result_type
-    operator()(const Vector_2& v) const
-    {
-      return v.rep().hy();
-    }
-  };
-
-  template <typename K>
-  class Compute_hy_3
-  {
-    typedef typename K::FT             FT;
-    typedef typename K::Point_3        Point_3;
-    typedef typename K::Vector_3       Vector_3;
-
-  public:
-    typedef const FT&                  result_type;
-
-    result_type
-    operator()(const Point_3& p) const
-    {
-      return p.rep().hy();
-    }
-
-    result_type
-    operator()(const Vector_3& v) const
-    {
-      return v.rep().hy();
-    }
-  };
-
-  template <typename K>
-  class Compute_hz_3
-  {
-    typedef typename K::FT             FT;
-    typedef typename K::Point_3        Point_3;
-    typedef typename K::Vector_3       Vector_3;
-
-  public:
-    typedef const FT&                  result_type;
-
-    result_type
-    operator()(const Point_3& p) const
-    {
-      return p.rep().hz();
-    }
-
-    result_type
-    operator()(const Vector_3& v) const
-    {
-      return v.rep().hz();
-    }
-  };
-
-  template <typename K>
-  class Compute_hw_2
-  {
-    typedef typename K::FT             FT;
-    typedef typename K::Point_2        Point_2;
-    typedef typename K::Vector_2       Vector_2;
-
-  public:
-    typedef const FT&                  result_type;
-
-    result_type
-    operator()(const Point_2& p) const
-    {
-      return p.rep().hw();
-    }
-
-    result_type
-    operator()(const Vector_2& v) const
-    {
-      return v.rep().hw();
-    }
-  };
-
-  template <typename K>
-  class Compute_hw_3
-  {
-    typedef typename K::FT             FT;
-    typedef typename K::Point_3        Point_3;
-    typedef typename K::Vector_3       Vector_3;
-
-  public:
-    typedef const FT&                 result_type;
-
-    result_type
-    operator()(const Point_3& p) const
-    {
-      return p.rep().hw();
-    }
-
-    result_type
-    operator()(const Vector_3& v) const
-    {
-      return v.rep().hw();
-    }
-  };
-
-
-  template <typename K>
-  class Compute_xmin_2
-  {
-    typedef typename K::FT              FT;
-    typedef typename K::Iso_rectangle_2 Iso_rectangle_2;
-
-  public:
-    typedef const FT&                   result_type;
-
-    result_type
-    operator()(const Iso_rectangle_2& r) const
-    {
-      return (r.min)().x();
-    }
-  };
-
-  template <typename K>
-  class Compute_xmax_2
-  {
-    typedef typename K::FT              FT;
-    typedef typename K::Iso_rectangle_2 Iso_rectangle_2;
-
-  public:
-    typedef const FT&                   result_type;
-
-    result_type
-    operator()(const Iso_rectangle_2& r) const
-    {
-      return (r.max)().x();
-    }
-  };
-
-  template <typename K>
-  class Compute_ymin_2
-  {
-    typedef typename K::FT              FT;
-    typedef typename K::Iso_rectangle_2 Iso_rectangle_2;
-
-  public:
-    typedef const FT&                   result_type;
-
-    result_type
-    operator()(const Iso_rectangle_2& r) const
-    {
-      return (r.min)().y();
-    }
-  };
-
-  template <typename K>
-  class Compute_ymax_2
-  {
-    typedef typename K::FT              FT;
-    typedef typename K::Iso_rectangle_2 Iso_rectangle_2;
-
-  public:
-    typedef const FT&                   result_type;
-
-    result_type
-    operator()(const Iso_rectangle_2& r) const
-    {
-      return (r.max)().y();
-    }
-  };
-
-
-  template <typename K>
-  class Construct_barycenter_2
-  {
-    typedef typename K::FT          FT;
-    typedef typename K::Point_2     Point_2;
-  public:
-    typedef Point_2                 result_type;
-
-    result_type
-    operator()(const Point_2& p1, const FT&w1, const Point_2& p2) const
-    {
-      typename K::Construct_point_2 construct_point_2;
-      FT x, y;
-      barycenterC2(p1.x(), p1.y(), w1, p2.x(), p2.y(), x, y);
-      return construct_point_2(x, y);
-    }
-
-    result_type
-    operator()(const Point_2& p1, const FT& w1, const Point_2& p2, const FT& w2) const
-    {
-      typename K::Construct_point_2 construct_point_2;
-      FT x, y;
-      barycenterC2(p1.x(), p1.y(), w1, p2.x(), p2.y(), w2, x, y);
-      return construct_point_2(x, y);
-    }
-
-    result_type
-    operator()(const Point_2& p1, const FT& w1, const Point_2& p2, const FT& w2,
-               const Point_2& p3) const
-    {
-      typename K::Construct_point_2 construct_point_2;
-      FT x, y;
-      barycenterC2(p1.x(), p1.y(), w1, p2.x(), p2.y(), w2, p3.x(), p3.y(), x, y);
-      return construct_point_2(x, y);
-    }
-
-    result_type
-    operator()(const Point_2& p1, const FT& w1, const Point_2& p2, const FT& w2,
-               const Point_2& p3, const FT& w3) const
-    {
-      typename K::Construct_point_2 construct_point_2;
-      FT x, y;
-      barycenterC2(p1.x(), p1.y(), w1, p2.x(), p2.y(), w2, p3.x(), p3.y(), w3, x, y);
-      return construct_point_2(x, y);
-    }
-
-    result_type
-    operator()(const Point_2& p1, const FT& w1, const Point_2& p2, const FT& w2,
-               const Point_2& p3, const FT& w3, const Point_2& p4) const
-    {
-      typename K::Construct_point_2 construct_point_2;
-      FT x, y;
-      barycenterC2(p1.x(), p1.y(), w1, p2.x(), p2.y(), w2, p3.x(), p3.y(), w3, p4.x(), p4.y(), x, y);
-      return construct_point_2(x, y);
-    }
-
-    result_type
-    operator()(const Point_2& p1, const FT& w1, const Point_2& p2, const FT& w2,
-               const Point_2& p3, const FT& w3, const Point_2& p4, const FT& w4) const
-    {
-      typename K::Construct_point_2 construct_point_2;
-      FT x, y;
-      barycenterC2(p1.x(), p1.y(), w1, p2.x(), p2.y(), w2, p3.x(), p3.y(), w3, p4.x(), p4.y(), w4, x, y);
-      return construct_point_2(x, y);
-    }
-
-  };
-
-  template <typename K>
-  class Construct_barycenter_3
-  {
-    typedef typename K::FT          FT;
-    typedef typename K::Point_3     Point_3;
-  public:
-    typedef Point_3                 result_type;
-    
-    result_type
-    operator()(const Point_3& p1, const FT&w1, const Point_3& p2) const
-    {
-      typename K::Construct_point_3 construct_point_3;
-      FT x, y, z;
-      barycenterC3(p1.x(), p1.y(), p1.z(), w1, p2.x(), p2.y(), p2.z(), x, y, z);
-      return construct_point_3(x, y, z);
-    }
-
-    result_type
-    operator()(const Point_3& p1, const FT& w1, const Point_3& p2, const FT& w2) const
-    {
-      typename K::Construct_point_3 construct_point_3;
-      FT x, y, z;
-      barycenterC3(p1.x(), p1.y(), p1.z(), w1, p2.x(), p2.y(), p2.z(), w2, x, y, z);
-      return construct_point_3(x, y, z);
-    }
-
-    result_type
-    operator()(const Point_3& p1, const FT& w1, const Point_3& p2, const FT& w2,
-               const Point_3& p3) const
-    {
-      typename K::Construct_point_3 construct_point_3;
-      FT x, y, z;
-      barycenterC3(p1.x(), p1.y(), p1.z(), w1, p2.x(), p2.y(), p2.z(), w2, p3.x(), p3.y(), p3.z(), x, y, z);
-      return construct_point_3(x, y, z);
-    }
-    
-    result_type
-    operator()(const Point_3& p1, const FT& w1, const Point_3& p2, const FT& w2,
-               const Point_3& p3, const FT& w3) const
-    {
-      typename K::Construct_point_3 construct_point_3;
-      FT x, y, z;
-      barycenterC3(p1.x(), p1.y(), p1.z(), w1, p2.x(), p2.y(), p2.z(), w2,
-                   p3.x(), p3.y(), p3.z(), w3, x, y, z);
-      return construct_point_3(x, y, z);
-    }
-    
-    result_type
-    operator()(const Point_3& p1, const FT& w1, const Point_3& p2, const FT& w2,
-               const Point_3& p3, const FT& w3, const Point_3& p4) const
-    {
-      typename K::Construct_point_3 construct_point_3;
-      FT x, y, z;
-      barycenterC3(p1.x(), p1.y(), p1.z(), w1, p2.x(), p2.y(), p2.z(), w2,
-                   p3.x(), p3.y(), p3.z(), w3, p4.x(), p4.y(), p4.z(), x, y, z);
-      return construct_point_3(x, y, z);
-    }
-
-    result_type
-    operator()(const Point_3& p1, const FT& w1, const Point_3& p2, const FT& w2,
-               const Point_3& p3, const FT& w3, const Point_3& p4, const FT& w4) const
-    {
-      typename K::Construct_point_3 construct_point_3;
-      FT x, y, z;
-      barycenterC3(p1.x(), p1.y(), p1.z(), w1, p2.x(), p2.y(), p2.z(), w2,
-                   p3.x(), p3.y(), p3.z(), w3, p4.x(), p4.y(), p4.z(), w4, x, y, z);
-      return construct_point_3(x, y, z);
-    }
-    
-  };
-
-
-  template <typename K>
-  class Construct_base_vector_3
-  {
-    typedef typename K::Vector_3   Vector_3;
-    typedef typename K::Plane_3    Plane_3;
-    typedef typename K::FT         FT;
-    typedef typename K::Construct_cross_product_vector_3
-    Construct_cross_product_vector_3;
-    typedef typename K::Construct_orthogonal_vector_3
-    Construct_orthogonal_vector_3;
-    Construct_cross_product_vector_3 cp;
-    Construct_orthogonal_vector_3 co;
-  public:
-    typedef Vector_3         result_type;
-
-    Construct_base_vector_3() {}
-    Construct_base_vector_3(const Construct_cross_product_vector_3& cp_,
-			    const Construct_orthogonal_vector_3& co_)
-      : cp(cp_), co(co_)
-    {}
-
-    result_type
-    operator()( const Plane_3& h, int index ) const
-    {
-      if (index == 1) {
-	if ( CGAL_NTS is_zero(h.a()) )  // parallel to x-axis
-	  return Vector_3(FT(1), FT(0), FT(0));
-	
-	if ( CGAL_NTS is_zero(h.b()) )  // parallel to y-axis
-	  return Vector_3(FT(0), FT(1), FT(0));
-	
-	if ( CGAL_NTS is_zero(h.c()) )  // parallel to z-axis
-	  return Vector_3(FT(0), FT(0), FT(1));
-	
-	return Vector_3(-h.b(), h.a(), FT(0));
-      } else {
-	return cp(co(h), this->operator()(h,1));
-      }
-    }
-  };
-
-
-  template <typename K>
-  class Construct_bbox_2
-  {
-    typedef typename K::Point_2          Point_2;
-    typedef typename K::Segment_2        Segment_2;
-    typedef typename K::Iso_rectangle_2  Iso_rectangle_2;
-    typedef typename K::Triangle_2       Triangle_2;
-    typedef typename K::Circle_2         Circle_2;
-  public:
-    typedef Bbox_2                       result_type;
-
-    result_type
-    operator()(const Point_2& p) const
-    {
-      std::pair<double,double> xp = CGAL_NTS to_interval(p.x());
-      std::pair<double,double> yp = CGAL_NTS to_interval(p.y());
-      return Bbox_2(xp.first, yp.first, xp.second, yp.second);
-    }
-
-    result_type
-    operator()(const Segment_2& s) const
-    { return s.source().bbox() + s.target().bbox(); }
-
-    result_type
-    operator()(const Triangle_2& t) const
-    {
-      typename K::Construct_bbox_2 construct_bbox_2;
-      return construct_bbox_2(t.vertex(0))
-	   + construct_bbox_2(t.vertex(1))
-	   + construct_bbox_2(t.vertex(2));
-    }
-
-    result_type
-    operator()(const Iso_rectangle_2& r) const
-    {
-      typename K::Construct_bbox_2 construct_bbox_2;
-      return construct_bbox_2((r.min)()) + construct_bbox_2((r.max)());
-    }
-
-    result_type
-    operator()(const Circle_2& c) const
-    {
-      typename K::Construct_bbox_2 construct_bbox_2;
-      Bbox_2 b = construct_bbox_2(c.center());
-
-      Interval_nt<> x (b.xmin(), b.xmax());
-      Interval_nt<> y (b.ymin(), b.ymax());
-
-      Interval_nt<> sqr = CGAL_NTS to_interval(c.squared_radius());
-      Interval_nt<> r = CGAL::sqrt(sqr);
-      Interval_nt<> minx = x-r;
-      Interval_nt<> maxx = x+r;
-      Interval_nt<> miny = y-r;
-      Interval_nt<> maxy = y+r;
-
-      return Bbox_2(minx.inf(), miny.inf(), maxx.sup(), maxy.sup());
-    }
-  };
-
-
-  template <typename K>
-  class Construct_bbox_3
-  {
-    typedef typename K::Point_3          Point_3;
-    typedef typename K::Segment_3        Segment_3;
-    typedef typename K::Iso_cuboid_3     Iso_cuboid_3;
-    typedef typename K::Triangle_3       Triangle_3;
-    typedef typename K::Tetrahedron_3    Tetrahedron_3;
-    typedef typename K::Sphere_3         Sphere_3;
-    typedef typename K::Circle_3         Circle_3;
-  public:
-    typedef Bbox_3          result_type;
-
-    Bbox_3
-    operator()(const Point_3& p) const
-    {
-      std::pair<double,double> xp = CGAL_NTS to_interval(p.x());
-      std::pair<double,double> yp = CGAL_NTS to_interval(p.y());
-      std::pair<double,double> zp = CGAL_NTS to_interval(p.z());
-      return Bbox_3(xp.first, yp.first, zp.first,
-                    xp.second, yp.second, zp.second);
-    }
-
-    Bbox_3
-    operator()(const Segment_3& s) const
-    { return s.source().bbox() + s.target().bbox(); }
-
-    Bbox_3
-    operator()(const Triangle_3& t) const
-    {
-      typename K::Construct_bbox_3 construct_bbox_3;
-      return construct_bbox_3(t.vertex(0))
-	   + construct_bbox_3(t.vertex(1))
-	   + construct_bbox_3(t.vertex(2));
-    }
-
-    Bbox_3
-    operator()(const Iso_cuboid_3& r) const
-    {
-      typename K::Construct_bbox_3 construct_bbox_3;
-      return construct_bbox_3((r.min)()) + construct_bbox_3((r.max)());
-    }
-
-    Bbox_3
-    operator()(const Tetrahedron_3& t) const
-    {
-      typename K::Construct_bbox_3 construct_bbox_3;
-      return construct_bbox_3(t.vertex(0)) + construct_bbox_3(t.vertex(1))
-           + construct_bbox_3(t.vertex(2)) + construct_bbox_3(t.vertex(3));
-    }
-
-    Bbox_3
-    operator()(const Sphere_3& s) const
-    {
-      typename K::Construct_bbox_3 construct_bbox_3;
-      Bbox_3 b = construct_bbox_3(s.center());
-
-      Interval_nt<> x (b.xmin(), b.xmax());
-      Interval_nt<> y (b.ymin(), b.ymax());
-      Interval_nt<> z (b.zmin(), b.zmax());
-
-      Interval_nt<> sqr = CGAL_NTS to_interval(s.squared_radius());
-      Interval_nt<> r = CGAL::sqrt(sqr);
-      Interval_nt<> minx = x-r;
-      Interval_nt<> maxx = x+r;
-      Interval_nt<> miny = y-r;
-      Interval_nt<> maxy = y+r;
-      Interval_nt<> minz = z-r;
-      Interval_nt<> maxz = z+r;
-
-      return Bbox_3(minx.inf(), miny.inf(), minz.inf(), 
-                    maxx.sup(), maxy.sup(), maxz.sup());
-    }
-
-    Bbox_3
-    operator()(const Circle_3& c) const
-    { return c.rep().bbox(); }
-
-  };
-
-
-  template <typename K>
-  class Construct_bisector_2
-  {
-    typedef typename K::FT      FT;
-    typedef typename K::Point_2 Point_2;
-    typedef typename K::Line_2  Line_2;
-  public:
-    typedef Line_2              result_type;
-
-    result_type
-    operator()(const Point_2& p, const Point_2& q) const
-    {
-      FT a, b, c;
-      bisector_of_pointsC2(p.x(), p.y(), q.x(), q.y(), a, b, c);
-      return Line_2(a, b, c);
-    }
-
-    result_type
-    operator()(const Line_2& p, const Line_2& q) const
-    {
-      FT a, b, c;
-      bisector_of_linesC2(p.a(), p.b(), p.c(),
-                          q.a(), q.b(), q.c(),
-                          a, b, c);
-      return Line_2(a, b, c);
-    }
-  };
-
-  template <typename K>
-  class Construct_bisector_3
-  {
-    typedef typename K::FT        FT;
-    typedef typename K::Point_3   Point_3;
-    typedef typename K::Plane_3   Plane_3;
-  public:
-    typedef Plane_3               result_type;
-
-    result_type
-    operator()(const Point_3& p, const Point_3& q) const
-    {
-      FT a, b, c, d;
-      bisector_of_pointsC3(p.x(), p.y(), p.z(),
-	                   q.x(), q.y(), q.z(),
-			   a, b, c, d);
-      return Plane_3(a, b, c, d);
-    }
-
-    result_type
-    operator()(const Plane_3& p, const Plane_3& q) const
-    {
-      FT a, b, c, d;
-      bisector_of_planesC3(p.a(), p.b(), p.c(), p.d(),
-                           q.a(), q.b(), q.c(), q.d(),
-                           a, b, c, d);
-      return Plane_3(a, b, c, d);
-    }
-  };
-
-  template <typename K>
-  class Construct_centroid_2
-  {
-    typedef typename K::FT          FT;
-    typedef typename K::Point_2     Point_2;
-    typedef typename K::Triangle_2  Triangle_2;
-  public:
-    typedef Point_2                 result_type;
-
-    result_type
-    operator()(const Point_2& p, const Point_2& q, const Point_2& r) const
-    {
-      typename K::Construct_point_2 construct_point_2;
-      FT x, y;
-      centroidC2(p.x(), p.y(), q.x(), q.y(), r.x(), r.y(), x, y);
-      return construct_point_2(x, y);
-    }
-
-    result_type
-    operator()(const Triangle_2& t) const
-    {
-      return this->operator()(t.vertex(0), t.vertex(1), t.vertex(2));
-    }
-
-    result_type
-    operator()(const Point_2& p, const Point_2& q,
-               const Point_2& r, const Point_2& s) const
-    {
-      typename K::Construct_point_2 construct_point_2;
-      FT x, y;
-      centroidC2(p.x(), p.y(), q.x(), q.y(), r.x(), r.y(), s.x(), s.y(), x, y);
-      return construct_point_2(x, y);
-    }
-  };
-
-  template <typename K>
-  class Construct_centroid_3
-  {
-    typedef typename K::FT             FT;
-    typedef typename K::Point_3        Point_3;
-    typedef typename K::Triangle_3     Triangle_3;
-    typedef typename K::Tetrahedron_3  Tetrahedron_3;
-  public:
-    typedef Point_3                    result_type;
-
-    result_type
-    operator()(const Point_3& p, const Point_3& q, const Point_3& r) const
-    {
-      typename K::Construct_point_3 construct_point_3;
-      FT x, y, z;
-      centroidC3(p.x(), p.y(), p.z(),
-		 q.x(), q.y(), q.z(),
-		 r.x(), r.y(), r.z(),
-		 x, y, z);
-      return construct_point_3(x, y, z);
-    }
-
-    result_type
-    operator()(const Point_3& p, const Point_3& q,
-               const Point_3& r, const Point_3& s) const
-    {
-      typename K::Construct_point_3 construct_point_3;
-      FT x, y, z;
-      centroidC3(p.x(), p.y(), p.z(),
-		 q.x(), q.y(), q.z(),
-		 r.x(), r.y(), r.z(),
-		 s.x(), s.y(), s.z(),
-		 x, y, z);
-      return construct_point_3(x, y, z);
-    }
-
-    result_type
-    operator()(const Triangle_3& t) const
-    {
-      return this->operator()(t.vertex(0), t.vertex(1), t.vertex(2));
-    }
-
-    result_type
-    operator()(const Tetrahedron_3& t) const
-    {
-      return this->operator()(t.vertex(0), t.vertex(1),
-                              t.vertex(2), t.vertex(3));
-    }
-  };
-
-  template <typename K>
-  class Construct_circumcenter_2
-  {
-    typedef typename K::Point_2     Point_2;
-    typedef typename K::Triangle_2  Triangle_2;
-  public:
-    typedef Point_2                 result_type;
-
-    Point_2
-    operator()(const Point_2& p, const Point_2& q) const
-    {
-      typename K::Construct_midpoint_2 construct_midpoint_2;
-      return construct_midpoint_2(p, q);
-    }
-
-    result_type
-    operator()(const Point_2& p, const Point_2& q, const Point_2& r) const
-    {
-      typename K::Construct_point_2 construct_point_2;
-      typedef typename K::FT        FT;
-      FT x, y;
-      circumcenterC2(p.x(), p.y(), q.x(), q.y(), r.x(), r.y(), x, y);
-      return construct_point_2(x, y);
-    }
-
-    result_type
-    operator()(const Triangle_2& t) const
-    {
-      return this->operator()(t.vertex(0), t.vertex(1), t.vertex(2));
-    }
-  };
-
-  template <typename K>
-  class Construct_circumcenter_3
-  {
-    typedef typename K::FT             FT;
-    typedef typename K::Tetrahedron_3  Tetrahedron_3;
-    typedef typename K::Triangle_3     Triangle_3;
-    typedef typename K::Point_3        Point_3;
-  public:
-    typedef Point_3                    result_type;
-
-    Point_3
-    operator()(const Point_3& p, const Point_3& q) const
-    {
-      typename K::Construct_midpoint_3 construct_midpoint_3;
-      return construct_midpoint_3(p, q);
-    }
-
-    Point_3
-    operator()(const Point_3& p, const Point_3& q, const Point_3& s) const
-    {
-      typename K::Construct_point_3 construct_point_3;
-      // Translate s to origin to simplify the expression.
-      FT psx = p.x()-s.x();
-      FT psy = p.y()-s.y();
-      FT psz = p.z()-s.z();
-      FT ps2 = CGAL_NTS square(psx) + CGAL_NTS square(psy) + CGAL_NTS square(psz);
-      FT qsx = q.x()-s.x();
-      FT qsy = q.y()-s.y();
-      FT qsz = q.z()-s.z();
-      FT qs2 = CGAL_NTS square(qsx) + CGAL_NTS square(qsy) + CGAL_NTS square(qsz);
-      FT rsx = psy*qsz-psz*qsy;
-      FT rsy = psz*qsx-psx*qsz;
-      FT rsz = psx*qsy-psy*qsx;
-
-      // The following determinants can be developped and simplified.
-      //
-      // FT num_x = determinant(psy,psz,ps2,
-      //                              qsy,qsz,qs2,
-      //                              rsy,rsz,0);
-      // FT num_y = determinant(psx,psz,ps2,
-      //                              qsx,qsz,qs2,
-      //                              rsx,rsz,0);
-      // FT num_z = determinant(psx,psy,ps2,
-      //                              qsx,qsy,qs2,
-      //                              rsx,rsy,0);
-
-      FT num_x = ps2 * determinant(qsy,qsz,rsy,rsz)
-	       - qs2 * determinant(psy,psz,rsy,rsz);
-      FT num_y = ps2 * determinant(qsx,qsz,rsx,rsz)
-	       - qs2 * determinant(psx,psz,rsx,rsz);
-      FT num_z = ps2 * determinant(qsx,qsy,rsx,rsy)
-	       - qs2 * determinant(psx,psy,rsx,rsy);
-
-      FT den   = determinant(psx,psy,psz,
-                             qsx,qsy,qsz,
-                             rsx,rsy,rsz);
-
-      CGAL_kernel_assertion( den != 0 );
-      FT inv = 1 / (2 * den);
-
-      FT x = s.x() + num_x*inv;
-      FT y = s.y() - num_y*inv;
-      FT z = s.z() + num_z*inv;
-      return construct_point_3(x, y, z);
-    }
-
-    Point_3
-    operator()(const Triangle_3& t) const
-    {
-      return this->operator()(t.vertex(0), t.vertex(1), t.vertex(2));
-    }
-
-    Point_3
-    operator()(const Point_3& p, const Point_3& q,
-	       const Point_3& r, const Point_3& s) const
-    {
-      typename K::Construct_point_3 construct_point_3;
-      // Translate p to origin to simplify the expression.
-      FT qpx = q.x()-p.x();
-      FT qpy = q.y()-p.y();
-      FT qpz = q.z()-p.z();
-      FT qp2 = CGAL_NTS square(qpx) + CGAL_NTS square(qpy) + CGAL_NTS square(qpz);
-      FT rpx = r.x()-p.x();
-      FT rpy = r.y()-p.y();
-      FT rpz = r.z()-p.z();
-      FT rp2 = CGAL_NTS square(rpx) + CGAL_NTS square(rpy) + CGAL_NTS square(rpz);
-      FT spx = s.x()-p.x();
-      FT spy = s.y()-p.y();
-      FT spz = s.z()-p.z();
-      FT sp2 = CGAL_NTS square(spx) + CGAL_NTS square(spy) + CGAL_NTS square(spz);
-
-      FT num_x = determinant(qpy,qpz,qp2,
-                             rpy,rpz,rp2,
-                             spy,spz,sp2);
-      FT num_y = determinant(qpx,qpz,qp2,
-                             rpx,rpz,rp2,
-                             spx,spz,sp2);
-      FT num_z = determinant(qpx,qpy,qp2,
-                             rpx,rpy,rp2,
-                             spx,spy,sp2);
-      FT den   = determinant(qpx,qpy,qpz,
-                             rpx,rpy,rpz,
-                             spx,spy,spz);
-      CGAL_kernel_assertion( ! CGAL_NTS is_zero(den) );
-      FT inv = 1 / (2 * den);
-
-      FT x = p.x() + num_x*inv;
-      FT y = p.y() - num_y*inv;
-      FT z = p.z() + num_z*inv;
-      return construct_point_3(x, y, z);
-    }
-
-    Point_3
-    operator()(const Tetrahedron_3& t) const
-    {
-      return this->operator()(t.vertex(0), t.vertex(1),
-                              t.vertex(2), t.vertex(3));
-    }
-  };
-
-  template <typename K>
-  class Construct_cross_product_vector_3
-  {
-    typedef typename K::Vector_3  Vector_3;
-  public:
-    typedef Vector_3              result_type;
-
-    Vector_3
-    operator()(const Vector_3& v, const Vector_3& w) const
-    {
-      return Vector_3(v.y() * w.z() - v.z() * w.y(),
-		      v.z() * w.x() - v.x() * w.z(),
-		      v.x() * w.y() - v.y() * w.x());
-    }
-  };
-
-  template <typename K>
-  class Construct_lifted_point_3
-  {
-    typedef typename K::Point_2                    Point_2;
-    typedef typename K::Point_3                    Point_3;
-    typedef typename K::Plane_3                    Plane_3;
-    typedef typename K::Construct_base_vector_3    Construct_base_vector_3;
-    typedef typename K::Construct_point_on_3       Construct_point_on_3;
-    typedef typename K::Construct_scaled_vector_3  Construct_scaled_vector_3;
-    typedef typename K::Construct_translated_point_3
-    Construct_translated_point_3;
-    Construct_base_vector_3 cb;
-    Construct_point_on_3 cp;
-    Construct_scaled_vector_3 cs;
-    Construct_translated_point_3 ct;
-  public:
-    typedef Point_3          result_type;
-
-    Construct_lifted_point_3() {}
-    Construct_lifted_point_3(const Construct_base_vector_3& cb_,
-			     const Construct_point_on_3& cp_,
-			     const Construct_scaled_vector_3& cs_,
-			     const Construct_translated_point_3& ct_)
-      : cb(cb_), cp(cp_), cs(cs_), ct(ct_)
-    {}
-
-    Point_3
-    operator()(const Plane_3& h, const Point_2& p) const
-    {
-      return ct(ct(cp(h), cs(cb(h,1), p.x())), cs(cb(h,2), p.y()));
-    }
-  };
-
-  template <typename K>
-  class Construct_direction_2
-  {
-    typedef typename K::Direction_2     Direction_2;
-    typedef typename Direction_2::Rep   Rep;
-    typedef typename K::Point_2         Point_2;
-    typedef typename K::Vector_2        Vector_2;
-    typedef typename K::Line_2          Line_2;
-    typedef typename K::Ray_2           Ray_2;
-    typedef typename K::Segment_2       Segment_2;
-    typedef typename K::RT              RT;
-
-  public:
-    typedef Direction_2                 result_type;
-
-    Rep // Direction_2
-    operator()(Return_base_tag, const RT& x, const RT& y) const
-    { return Rep(x, y); }
-
-    Rep // Direction_2
-    operator()(Return_base_tag, const Vector_2& v) const
-    {
-      return Rep(v.x(),v.y()); }
-
-    Rep // Direction_2
-    operator()(Return_base_tag, const Line_2& l) const
-    { return Rep(l.b(), -l.a()); }
-
-    Rep // Direction_2
-    operator()(Return_base_tag, const Point_2& p, const Point_2& q) const
-    {
-      return Rep(q.x() - p.x(), q.y() - p.y());
-    }
-
-    Rep // Direction_2
-    operator()(Return_base_tag, const Ray_2& r) const
-    {
-      return this->operator()(Return_base_tag(), r.source(), r.second_point());
-    }
-
-    Rep // Direction_2
-    operator()(Return_base_tag, const Segment_2& s) const
-    {
-      return this->operator()(Return_base_tag(), s.source(), s.target());
-    }
-
-
-    Direction_2
-    operator()(const RT& x, const RT& y) const
-    { return this->operator()(Return_base_tag(), x, y); }
-
-    Direction_2
-    operator()(const Vector_2& v) const
-    {
-      return this->operator()(Return_base_tag(), v); }
-
-    Direction_2
-    operator()(const Line_2& l) const
-    { return this->operator()(Return_base_tag(), l); }
-
-    Direction_2
-    operator()(const Point_2& p, const Point_2& q) const
-    {
-      return this->operator()(Return_base_tag(), p, q);
-    }
-
-    Direction_2
-    operator()(const Ray_2& r) const
-    {
-      return this->operator()(Return_base_tag(), r);
-    }
-
-    Direction_2
-    operator()(const Segment_2& s) const
-    {
-      return this->operator()(Return_base_tag(), s);
-    }
-  };
-
-  template <typename K>
-  class Construct_direction_3
-  {
-    typedef typename K::Direction_3     Direction_3;
-    typedef typename K::Vector_3        Vector_3;
-    typedef typename K::Line_3          Line_3;
-    typedef typename K::Ray_3           Ray_3;
-    typedef typename K::Segment_3       Segment_3;
-    typedef typename K::RT              RT;
-    typedef typename Direction_3::Rep   Rep;
-  public:
-    typedef Direction_3       result_type;
-
-    Rep // Direction_3
-    operator()(Return_base_tag, const RT& x, const RT& y, const RT& z) const
-    { return Rep(x, y, z); }
-
-    Rep // Direction_3
-    operator()(Return_base_tag, const Vector_3& v) const
-    { return Rep(v); }
-
-    Rep // Direction_3
-    operator()(Return_base_tag, const Line_3& l) const
-    { return Rep(l); }
-
-    Rep // Direction_3
-    operator()(Return_base_tag, const Ray_3& r) const
-    { return Rep(r); }
-
-    Rep // Direction_3
-    operator()(Return_base_tag, const Segment_3& s) const
-    { return Rep(s); }
-
-
-    Direction_3
-    operator()(const RT& x, const RT& y, const RT& z) const
-    { return this->operator()(Return_base_tag(), x, y, z); }
-
-    Direction_3
-    operator()(const Vector_3& v) const
-    { return this->operator()(Return_base_tag(), v); }
-
-    Direction_3
-    operator()(const Line_3& l) const
-    { return this->operator()(Return_base_tag(), l); }
-
-    Direction_3
-    operator()(const Ray_3& r) const
-    { return this->operator()(Return_base_tag(), r); }
-
-    Direction_3
-    operator()(const Segment_3& s) const
-    { return this->operator()(Return_base_tag(), s); }
-  };
-
-  template <typename K>
-  class Construct_equidistant_line_3
-  {
-    typedef typename K::FT          FT;
-    typedef typename K::Point_3     Point_3;
-    typedef typename K::Vector_3    Vector_3;
-    typedef typename K::Line_3      Line_3;
-    typedef typename Line_3::Rep    Rep;
-  public:
-    typedef Line_3           result_type;
-
-    Line_3
-    operator()( const Point_3& p, const Point_3& q, const Point_3& s) const
-    {
-      CGAL_kernel_precondition(! collinear(p, q, s));
-
-      // Translate s to origin to simplify the expression.
-      FT psx = p.x()-s.x();
-      FT psy = p.y()-s.y();
-      FT psz = p.z()-s.z();
-      FT ps2 = CGAL_NTS square(psx) + CGAL_NTS square(psy) + CGAL_NTS square(psz);
-      FT qsx = q.x()-s.x();
-      FT qsy = q.y()-s.y();
-      FT qsz = q.z()-s.z();
-      FT qs2 = CGAL_NTS square(qsx) + CGAL_NTS square(qsy) + CGAL_NTS square(qsz);
-      FT rsx = psy*qsz-psz*qsy;
-      FT rsy = psz*qsx-psx*qsz;
-      FT rsz = psx*qsy-psy*qsx;
-
-      // The following determinants can be developped and simplified.
-      //
-      // FT num_x = determinant(psy,psz,ps2,
-      //                              qsy,qsz,qs2,
-      //                              rsy,rsz,0);
-      // FT num_y = determinant(psx,psz,ps2,
-      //                              qsx,qsz,qs2,
-      //                              rsx,rsz,0);
-      // FT num_z = determinant(psx,psy,ps2,
-      //                              qsx,qsy,qs2,
-      //                              rsx,rsy,0);
-
-      FT num_x = ps2 * determinant(qsy,qsz,rsy,rsz)
-	       - qs2 * determinant(psy,psz,rsy,rsz);
-      FT num_y = ps2 * determinant(qsx,qsz,rsx,rsz)
-	       - qs2 * determinant(psx,psz,rsx,rsz);
-      FT num_z = ps2 * determinant(qsx,qsy,rsx,rsy)
-	       - qs2 * determinant(psx,psy,rsx,rsy);
-
-      FT den   = determinant(psx,psy,psz,
-                             qsx,qsy,qsz,
-                             rsx,rsy,rsz);
-
-      CGAL_kernel_assertion( den != 0 );
-      FT inv = 1 / (2 * den);
-
-      FT x = s.x() + num_x*inv;
-      FT y = s.y() - num_y*inv;
-      FT z = s.z() + num_z*inv;
-      return Rep(Point_3(x, y, z), Vector_3(rsx, rsy, rsz));
-    }
-
-  };
-
-  template <typename K>
-  class Construct_iso_rectangle_2
-  {
-    typedef typename K::RT               RT;
-    typedef typename K::FT               FT;
-    typedef typename K::Point_2          Point_2;
-    typedef typename K::Iso_rectangle_2  Iso_rectangle_2;
-    typedef typename Iso_rectangle_2::Rep     Rep;
-
-  public:
-    typedef Iso_rectangle_2              result_type;
-
-    Rep // Iso_rectangle_2
-    operator()(Return_base_tag, const Point_2& p, const Point_2& q, int) const
-    {
-      // I have to remove the assertions, because of Cartesian_converter.
-      // CGAL_kernel_assertion(p.x()<=q.x());
-      // CGAL_kernel_assertion(p.y()<=q.y());
-      return Rep(p, q, 0);
-    }
-
-    Rep // Iso_rectangle_2
-    operator()(Return_base_tag, const Point_2& p, const Point_2& q) const
-    {
-      FT minx, maxx, miny, maxy;
-      if (p.x() < q.x()) { minx = p.x(); maxx = q.x(); }
-      else               { minx = q.x(); maxx = p.x(); }
-      if (p.y() < q.y()) { miny = p.y(); maxy = q.y(); }
-      else               { miny = q.y(); maxy = p.y(); }
-
-      return Rep(Point_2(minx, miny),
-	         Point_2(maxx, maxy), 0);
-    }
-
-    Rep // Iso_rectangle_2
-    operator()(Return_base_tag, const Point_2 &left,   const Point_2 &right,
-               const Point_2 &bottom, const Point_2 &top) const
-    {
-      CGAL_kernel_assertion_code(typename K::Less_x_2 less_x;)
-      CGAL_kernel_assertion_code(typename K::Less_y_2 less_y;)
-      CGAL_kernel_assertion(!less_x(right, left));
-      CGAL_kernel_assertion(!less_y(top, bottom));
-      return Rep(Point_2(left.x(), bottom.y()),
-		 Point_2(right.x(), top.y()), 0);
-    }
-
-    Rep // Iso_rectangle_2
-    operator()(Return_base_tag, const RT& min_hx, const RT& min_hy,
-	       const RT& max_hx, const RT& max_hy) const
-    {
-      CGAL_kernel_precondition(min_hx <= max_hx);
-      CGAL_kernel_precondition(min_hy <= max_hy);
-      return Rep(Point_2(min_hx, min_hy),
-		 Point_2(max_hx, max_hy), 0);
-    }
-
-    Rep // Iso_rectangle_2
-    operator()(Return_base_tag, const RT& min_hx, const RT& min_hy,
-	       const RT& max_hx, const RT& max_hy, const RT& hw) const
-    {
-      if (hw == 1)
-	return Rep(Point_2(min_hx, min_hy),
-		   Point_2(max_hx, max_hy), 0);
-      return Rep(Point_2(min_hx/hw, min_hy/hw),
-		 Point_2(max_hx/hw, max_hy/hw), 0);
-    }
-
-
-    Iso_rectangle_2
-    operator()(const Point_2& p, const Point_2& q, int i) const
-    {
-      return this->operator()(Return_base_tag(), p, q, i);
-    }
-
-    Iso_rectangle_2
-    operator()(const Point_2& p, const Point_2& q) const
-    {
-      return this->operator()(Return_base_tag(), p, q);
-    }
-
-    Iso_rectangle_2
-    operator()(const Point_2 &left,   const Point_2 &right,
-               const Point_2 &bottom, const Point_2 &top) const
-    {
-      return this->operator()(Return_base_tag(), left, right, bottom, top);
-    }
-
-    Iso_rectangle_2
-    operator()(const RT& min_hx, const RT& min_hy,
-	       const RT& max_hx, const RT& max_hy) const
-    {
-      return this->operator()(Return_base_tag(), min_hx, min_hy, max_hx, max_hy);
-    }
-
-    Iso_rectangle_2
-    operator()(const RT& min_hx, const RT& min_hy,
-	       const RT& max_hx, const RT& max_hy, const RT& hw) const
-    {
-      return this->operator()(Return_base_tag(), min_hx, min_hy, max_hx, max_hy, hw);
-    }
-  };
-
-  template <typename K>
-  class Construct_line_2
-  {
-    typedef typename K::RT                        RT;
-    typedef typename K::FT                        FT;
-    typedef typename K::Point_2                   Point_2;
-    typedef typename K::Direction_2               Direction_2;
-    typedef typename K::Vector_2                  Vector_2;
-    typedef typename K::Segment_2                 Segment_2;
-    typedef typename K::Ray_2                     Ray_2;
-    typedef typename K::Line_2                    Line_2;
-    typedef typename Line_2::Rep                  Rep;
-    typedef typename K::Construct_point_on_2      Construct_point_on_2;
-    Construct_point_on_2 c;
-  public:
-    typedef Line_2            result_type;
-
-    Construct_line_2() {}
-    Construct_line_2(const Construct_point_on_2& c_) : c(c_) {}
-
-    Rep // Line_2
-    operator()(Return_base_tag, const RT& a, const RT& b, const RT& cc) const
-    { return Rep(a, b, cc); }
-
-    Rep // Line_2
-    operator()(Return_base_tag, const Point_2& p, const Point_2& q) const
-    {
-      FT a, b, cc;
-      line_from_pointsC2(p.x(), p.y(), q.x(), q.y(), a, b, cc);
-      return Rep(a, b, cc);
-    }
-
-    Rep // Line_2
-    operator()(Return_base_tag, const Point_2& p, const Direction_2& d) const
-    {
-      FT a, b, cc;
-      line_from_point_directionC2(p.x(), p.y(), d.dx(), d.dy(), a, b, cc);
-      return Rep(a, b, cc);
-    }
-
-    Rep // Line_2
-    operator()(Return_base_tag, const Point_2& p, const Vector_2& v) const
-    {
-      FT a, b, cc;
-      line_from_point_directionC2(p.x(), p.y(), v.x(), v.y(), a, b, cc);
-      return Rep(a, b, cc);
-    }
-
-    Rep // Line_2
-    operator()(Return_base_tag, const Segment_2& s) const
-    { return this->operator()(Return_base_tag(), c(s, 0), c(s, 1)); }
-
-    Rep // Line_2
-    operator()(Return_base_tag, const Ray_2& r) const
-    { return this->operator()(Return_base_tag(), c(r, 0), c(r, 1)); }
-
-
-    Line_2
-    operator()(const RT& a, const RT& b, const RT& cc) const
-    { return this->operator()(Return_base_tag(), a, b, cc); }
-
-    Line_2
-    operator()(const Point_2& p, const Point_2& q) const
-    { return this->operator()(Return_base_tag(), p, q); }
-
-    Line_2
-    operator()(const Point_2& p, const Direction_2& d) const
-    { return this->operator()(Return_base_tag(), p, d); }
-
-    Line_2
-    operator()(const Point_2& p, const Vector_2& v) const
-    { return this->operator()(Return_base_tag(), p, v); }
-
-    Line_2
-    operator()(const Segment_2& s) const
-    { return this->operator()(Return_base_tag(), s); }
-
-    Line_2
-    operator()(const Ray_2& r) const
-    { return this->operator()(Return_base_tag(), r); }
-  };
-
-  template <typename K>
-  class Construct_line_3
-  {
-    typedef typename K::Point_3                   Point_3;
-    typedef typename K::Direction_3               Direction_3;
-    typedef typename K::Segment_3                 Segment_3;
-    typedef typename K::Ray_3                     Ray_3;
-    typedef typename K::Line_3                    Line_3;
-    typedef typename K::Vector_3                  Vector_3;
-    typedef typename Line_3::Rep                  Rep;
-  public:
-    typedef Line_3            result_type;
-
-    Rep // Line_3
-    operator()(Return_base_tag, const Point_3& p, const Point_3& q) const
-    { return Rep(p, Vector_3(p, q)); }
-
-    Rep // Line_3
-    operator()(Return_base_tag, const Point_3& p, const Direction_3& d) const
-    { return operator()(Return_base_tag(), p, Vector_3(d.dx(), d.dy(), d.dz())); }
-
-    Rep // Line_3
-    operator()(Return_base_tag, const Point_3& p, const Vector_3& v) const
-    { return Rep(p, v); }
-
-    Rep // Line_3
-    operator()(Return_base_tag, const Segment_3& s) const
-    { return Rep(s.source(), Vector_3(s.source(), s.target())); }
-
-    Rep // Line_3
-    operator()(Return_base_tag, const Ray_3& r) const
-    { return Rep(r.source(), Vector_3(r.source(), r.second_point())); }
-
-
-    Line_3
-    operator()(const Point_3& p, const Point_3& q) const
-    { return this->operator()(Return_base_tag(), p, q); }
-
-    Line_3
-    operator()(const Point_3& p, const Direction_3& d) const
-    { return this->operator()(Return_base_tag(), p, d); }
-
-    Line_3
-    operator()(const Point_3& p, const Vector_3& v) const
-    { return this->operator()(Return_base_tag(), p, v); }
-
-    Line_3
-    operator()(const Segment_3& s) const
-    { return this->operator()(Return_base_tag(), s); }
-
-    Line_3
-    operator()(const Ray_3& r) const
-    { return this->operator()(Return_base_tag(), r); }
-  };
-
-  template <typename K>
-  class Construct_midpoint_2
-  {
-    typedef typename K::FT        FT;
-    typedef typename K::Point_2   Point_2;
-  public:
-    typedef Point_2          result_type;
-
-    Point_2
-    operator()(const Point_2& p, const Point_2& q) const
-    {
-      typename K::Construct_point_2 construct_point_2;
-      FT x, y;
-      midpointC2(p.x(), p.y(), q.x(), q.y(), x, y);
-      return construct_point_2(x, y);
-    }
-  };
-
-  template <typename K>
-  class Construct_midpoint_3
-  {
-    typedef typename K::FT        FT;
-    typedef typename K::Point_3   Point_3;
-  public:
-    typedef Point_3               result_type;
-
-    Point_3
-    operator()(const Point_3& p, const Point_3& q) const
-    {
-      typename K::Construct_point_3 construct_point_3;
-      FT x, y, z;
-      midpointC3(p.x(), p.y(), p.z(), q.x(), q.y(), q.z(), x, y, z);
-      return construct_point_3(x, y, z);
-    }
-  };
-
-  template <typename K>
-  class Construct_opposite_vector_2
-  {
-    typedef typename K::Vector_2    Vector_2;
-  public:
-    typedef Vector_2                result_type;
-
-    Vector_2
-    operator()( const Vector_2& v) const
-    { return Vector_2(-v.x(), -v.y()); }
-  };
-
-  template <typename K>
-  class Construct_difference_of_vectors_2
-  {
-    typedef typename K::Vector_2    Vector_2;
-  public:
-    typedef Vector_2                result_type;
-
-    Vector_2
-    operator()( const Vector_2& v, const Vector_2& w) const
-    { return Vector_2(v.x()-w.x(), v.y()-w.y()); }
-  };
-
-  template <typename K>
-  class Construct_difference_of_vectors_3
-  {
-    typedef typename K::Vector_3    Vector_3;
-  public:
-    typedef Vector_3                result_type;
-
-    Vector_3
-    operator()( const Vector_3& v, const Vector_3& w) const
-    { return Vector_3(v.x()-w.x(), v.y()-w.y(), v.z()-w.z()); }
-  };
-
-  template <typename K>
-  class Construct_sum_of_vectors_2
-  {
-    typedef typename K::Vector_2    Vector_2;
-  public:
-    typedef Vector_2                result_type;
-
-    Vector_2
-    operator()( const Vector_2& v, const Vector_2& w) const
-    { return Vector_2(v.x()+w.x(), v.y()+w.y()); }
-  };
-
-  template <typename K>
-  class Construct_sum_of_vectors_3
-  {
-    typedef typename K::Vector_3    Vector_3;
-  public:
-    typedef Vector_3                result_type;
-
-    Vector_3
-    operator()( const Vector_3& v, const Vector_3& w) const
-    { return Vector_3(v.x()+w.x(), v.y()+w.y(), v.z()+w.z()); }
-  };
-
-  template <typename K>
-  class Construct_opposite_vector_3
-  {
-    typedef typename K::Vector_3    Vector_3;
-  public:
-    typedef Vector_3                result_type;
-
-    Vector_3
-    operator()( const Vector_3& v) const
-    { return Vector_3(-v.x(), -v.y(), -v.z()); }
-  };
-
-  template <typename K>
-  class Construct_orthogonal_vector_3
-  {
-    typedef typename K::FT FT;
-    typedef typename K::Point_3     Point_3;
-    typedef typename K::Vector_3    Vector_3;
-    typedef typename K::Plane_3     Plane_3;
-  public:
-    typedef Vector_3                result_type;
-
-    Vector_3
-    operator()( const Plane_3& p ) const
-    { return Vector_3(p.a(), p.b(), p.c()); }
-
-    Vector_3
-    operator()( const Point_3& p, const Point_3& q, const Point_3& r ) const
-    {
-      FT rpx = p.x()-r.x();
-      FT rpy = p.y()-r.y();
-      FT rpz = p.z()-r.z();
-      FT rqx = q.x()-r.x();
-      FT rqy = q.y()-r.y();
-      FT rqz = q.z()-r.z();
-      // Cross product rp * rq
-      FT vx = rpy*rqz - rqy*rpz;
-      FT vy = rpz*rqx - rqz*rpx;
-      FT vz = rpx*rqy - rqx*rpy;
-      typename K::Construct_vector_3 construct_vector;
-
-      return construct_vector(vx, vy, vz);
-    }
-  };
-
-  template <typename K>
-  class Construct_perpendicular_vector_2
-  {
-    typedef typename K::Vector_2   Vector_2;
-  public:
-    typedef Vector_2               result_type;
-
-    Vector_2
-    operator()( const Vector_2& v, Orientation o) const
-    {
-      CGAL_kernel_precondition( o != COLLINEAR );
-      if (o == COUNTERCLOCKWISE)
-	return K().construct_vector_2_object()(-v.y(), v.x());
-      else
-	return K().construct_vector_2_object()(v.y(), -v.x());
-    }
-  };
-
-  template <typename K>
-  class Construct_perpendicular_direction_2
-  {
-    typedef typename K::Direction_2   Direction_2;
-  public:
-    typedef Direction_2               result_type;
-
-    Direction_2
-    operator()( const Direction_2& d, Orientation o) const
-    {
-      CGAL_kernel_precondition( o != COLLINEAR );
-      if (o == COUNTERCLOCKWISE)
-	return K().construct_direction_2_object()(-d.dy(), d.dx());
-      else
-	return K().construct_direction_2_object()(d.dy(), -d.dx());
-    }
-  };
-
-
-  template <typename K>
-  class Construct_perpendicular_line_2
-  {
-    typedef typename K::Line_2    Line_2;
-    typedef typename K::Point_2   Point_2;
-  public:
-    typedef Line_2                result_type;
-
-    Line_2
-    operator()( const Line_2& l, const Point_2& p) const
-    {
-      typename K::FT fta, ftb, ftc;
-      perpendicular_through_pointC2(l.a(), l.b(), p.x(), p.y(), fta, ftb, ftc);
-      return Line_2(fta, ftb, ftc);
-    }
-  };
-
-
-  template <typename K>
-  class Construct_point_2
-  {
-    typedef typename K::RT         RT;
-    typedef typename K::Point_2    Point_2;
-    typedef typename K::Line_2     Line_2;
-    typedef typename Point_2::Rep  Rep;
-  public:
-    typedef Point_2                result_type;
-
-    Rep // Point_2
-    operator()(Return_base_tag, Origin o) const
-    { return Rep(o); }
-
-    Rep // Point_2
-    operator()(Return_base_tag, const RT& x, const RT& y) const
-    { return Rep(x, y); }
-
-    Rep // Point_2
-    operator()(Return_base_tag, const RT& x, const RT& y, const RT& w) const
-    { return Rep(x, y, w); }
-
-    Point_2
-    operator()(const Line_2& l) const
-    {
-      typename K::Construct_point_2 construct_point_2;
-      typename K::FT x, y;
-      line_get_pointC2(l.a(), l.b(), l.c(), 0, x, y);
-      return construct_point_2(x,y);
-    }
-
-    Point_2
-    operator()(const Line_2& l, int i) const
-    {
-      typename K::Construct_point_2 construct_point_2;
-      typename K::FT x, y;
-      line_get_pointC2(l.a(), l.b(), l.c(), i, x, y);
-      return construct_point_2(x,y);
-    }
-
-
-    Point_2
-    operator()(Origin o) const
-    { return Point_2(o); }
-
-    Point_2
-    operator()(const RT& x, const RT& y) const
-    { return Point_2(x, y); }
-
-    Point_2
-    operator()(const RT& x, const RT& y, const RT& w) const
-    { return Point_2(x, y, w); }
-  };
-
-  template <typename K>
-  class Construct_point_3
-  {
-    typedef typename K::RT         RT;
-    typedef typename K::Point_3    Point_3;
-    typedef typename Point_3::Rep  Rep;
-  public:
-    typedef Point_3          result_type;
-
-    Rep // Point_3
-    operator()(Return_base_tag, Origin o) const
-    { return Rep(o); }
-
-    Rep // Point_3
-    operator()(Return_base_tag, const RT& x, const RT& y, const RT& z) const
-    { return Rep(x, y, z); }
-
-    Rep // Point_3
-    operator()(Return_base_tag, const RT& x, const RT& y, const RT& z, const RT& w) const
-    { return Rep(x, y, z, w); }
-
-
-    Point_3
-    operator()(Origin o) const
-    { return Point_3(o); }
-
-    Point_3
-    operator()(const RT& x, const RT& y, const RT& z) const
-    { return Point_3(x, y, z); }
-
-    Point_3
-    operator()(const RT& x, const RT& y, const RT& z, const RT& w) const
-    { return Point_3(x, y, z, w); }
-  };
-
-
-  template <typename K>
-  class Construct_projected_point_2
-  {
-    typedef typename K::Point_2    Point_2;
-    typedef typename K::Line_2     Line_2;
-  public:
-    typedef Point_2                result_type;
-
-    Point_2
-    operator()( const Line_2& l, const Point_2& p ) const
-    {
-      typename K::FT x, y;
-      typename K::Construct_point_2 construct_point_2;
-      line_project_pointC2(l.a(), l.b(), l.c(), p.x(), p.y(), x, y);
-      return construct_point_2(x, y);
-    }
-  };
-
-
-  template <typename K>
-  class Construct_projected_point_3
-  {
-    typedef typename K::Point_3    Point_3;
-    typedef typename K::Plane_3    Plane_3;
-    typedef typename K::Line_3     Line_3;
-    typedef typename K::FT         FT;
-  public:
-    typedef Point_3                result_type;
-
-    Point_3
-    operator()( const Line_3& l, const Point_3& p ) const
-    {
-      // projects p on the line l
-      FT lpx = l.point().x();
-      FT lpy = l.point().y();
-      FT lpz = l.point().z();
-      FT ldx = l.direction().dx();
-      FT ldy = l.direction().dy();
-      FT ldz = l.direction().dz();
-      FT dpx = p.x()-lpx;
-      FT dpy = p.y()-lpy;
-      FT dpz = p.z()-lpz;
-      FT lambda = (ldx*dpx+ldy*dpy+ldz*dpz) / (ldx*ldx+ldy*ldy+ldz*ldz);
-      return Point_3(lpx + lambda * ldx,
-                     lpy + lambda * ldy,
-                     lpz + lambda * ldz);
-    }
-
-    Point_3
-    operator()( const Plane_3& h, const Point_3& p ) const
-    { return h.rep().projection(p); }
-  };
-
-  template <class K> 
-  class Construct_radical_line_2
-  {
-    typedef typename K::Line_2            Line_2;
-    typedef typename K::Circle_2          Circle_2;
-    typedef typename K::FT                 FT;
-
-  public:
-
-    typedef Line_2 result_type;
-
-    result_type 
-    operator() (const Circle_2 & c1, const Circle_2 & c2) const
-	  {
-      // Concentric Circles don't have radical line
-      CGAL_kernel_precondition (c1.center() != c2.center());
-      const FT a = 2*(c2.center().x() - c1.center().x());
-      const FT b = 2*(c2.center().y() - c1.center().y());
-      const FT c = CGAL::square(c1.center().x()) + 
-        CGAL::square(c1.center().y()) - c1.squared_radius() -
-        CGAL::square(c2.center().x()) -
-        CGAL::square(c2.center().y()) + c2.squared_radius();
-      return Line_2(a, b, c);
-    }
-  };
-
-  template <class K> 
-  class Construct_radical_plane_3
-  {
-    typedef typename K::Plane_3            Plane_3;
-    typedef typename K::Sphere_3           Sphere_3;
-    typedef typename K::FT                 FT;
-
-  public:
-
-    typedef Plane_3 result_type;
-
-    result_type 
-    operator() (const Sphere_3 & s1, const Sphere_3 & s2) const
-    {
-      // Concentric Spheres don't have radical plane
-      CGAL_kernel_precondition (s1.center() != s2.center());
-      const FT a = 2*(s2.center().x() - s1.center().x());
-      const FT b = 2*(s2.center().y() - s1.center().y());
-      const FT c = 2*(s2.center().z() - s1.center().z());
-      const FT d = CGAL::square(s1.center().x()) + 
-        CGAL::square(s1.center().y()) +
-        CGAL::square(s1.center().z()) - s1.squared_radius() -
-        CGAL::square(s2.center().x()) -
-        CGAL::square(s2.center().y()) -
-        CGAL::square(s2.center().z()) + s2.squared_radius();
-      return Plane_3(a, b, c, d);
-    }
-  };
-
-
-  template <typename K>
-  class Construct_scaled_vector_2
-  {
-    typedef typename K::FT         FT;
-    typedef typename K::Vector_2   Vector_2;
-  public:
-    typedef Vector_2               result_type;
-
-    Vector_2
-    operator()( const Vector_2& v, const FT& c) const
-    {
-      return Vector_2(c * v.x(), c * v.y());
-    }
-  };
-
-  template <typename K>
-  class Construct_divided_vector_2
-  {
-    typedef typename K::FT         FT;
-    typedef typename K::Vector_2   Vector_2;
-  public:
-    typedef Vector_2               result_type;
-
-    Vector_2
-    operator()( const Vector_2& v, const FT& c) const
-    {
-      return Vector_2(v.x()/c, v.y()/c);
-    }
-  };
-
-  template <typename K>
-  class Construct_divided_vector_3
-  {
-    typedef typename K::FT         FT;
-    typedef typename K::Vector_3   Vector_3;
-  public:
-    typedef Vector_3               result_type;
-
-    Vector_3
-    operator()( const Vector_3& v, const FT& c) const
-    {
-      return Vector_3(v.x()/c, v.y()/c, v.z()/c);
-    }
-  };
-
-  template <typename K>
-  class Construct_scaled_vector_3
-  {
-    typedef typename K::FT         FT;
-    typedef typename K::Vector_3   Vector_3;
-  public:
-    typedef Vector_3               result_type;
-
-    Vector_3
-    operator()( const Vector_3& w, const FT& c) const
-    {
-      return Vector_3(c * w.x(), c * w.y(), c * w.z());
-    }
-  };
-
-  template <typename K>
-  class Construct_translated_point_2
-  {
-    typedef typename K::Point_2   Point_2;
-    typedef typename K::Vector_2  Vector_2;
-  public:
-    typedef Point_2               result_type;
-
-    Point_2
-    operator()( const Point_2& p, const Vector_2& v) const
-    {
-      typename K::Construct_point_2 construct_point_2;
-      return construct_point_2(p.x() + v.x(), p.y() + v.y());
-    }
-
-    Point_2
-    operator()( const Origin& , const Vector_2& v) const
-    {
-      typename K::Construct_point_2 construct_point_2;
-      return construct_point_2(v.x(), v.y());
-    }
-  };
-
-  template <typename K>
-  class Construct_translated_point_3
-  {
-    typedef typename K::Point_3   Point_3;
-    typedef typename K::Vector_3  Vector_3;
-  public:
-    typedef Point_3               result_type;
-
-    Point_3
-    operator()( const Point_3& p, const Vector_3& v) const
-    {
-      typename K::Construct_point_3 construct_point_3;
-      return construct_point_3(p.x() + v.x(), p.y() + v.y(), p.z() + v.z());
-    }
-
-    Point_3
-    operator()( const Origin& , const Vector_3& v) const
-    {
-      typename K::Construct_point_3 construct_point_3;
-      return construct_point_3(v.x(), v.y(), v.z());
-    }
-  };
-
-  template <typename K>
-  class Construct_vector_2
-  {
-    typedef typename K::RT           RT;
-    typedef typename K::FT           FT;
-    typedef typename K::Segment_2    Segment_2;
-    typedef typename K::Ray_2        Ray_2;
-    typedef typename K::Line_2       Line_2;
-    typedef typename K::Vector_2     Vector_2;
-    typedef typename K::Point_2      Point_2;
-    typedef typename K::Direction_2  Direction_2;
-    typedef typename Vector_2::Rep   Rep;
-  public:
-    typedef Vector_2                 result_type;
-
-    Rep // Vector_2
-    operator()(Return_base_tag, const Point_2& p, const Point_2& q) const
-    { return Rep(q.x() - p.x(), q.y() - p.y()); }
-
-    Rep // Vector_2
-    operator()(Return_base_tag, const Origin&, const Point_2& q) const
-    { return Rep(q.x(), q.y()); }
-
-    Rep // Vector_2
-    operator()(Return_base_tag, const Point_2& p, const Origin& ) const
-    { return Rep(-p.x(), -p.y()); }
-
-    Rep // Vector_2
-    operator()(Return_base_tag, const Direction_2& d ) const
-    { return Rep(d.dx(), d.dy()); }
-
-    Vector_2
-    operator()(Return_base_tag, const Segment_2& s) const
-    { return s.to_vector(); }
-
-    Vector_2
-    operator()(Return_base_tag, const Ray_2& r) const
-    { return r.to_vector(); }
-
-    Rep // Vector_2
-    operator()(Return_base_tag, const Line_2& l) const
-    { return Rep(l.b(), -l.a()); }
-
-    Rep // Vector_2
-    operator()(Return_base_tag, Null_vector) const
-    { return Rep(FT(0), FT(0)); }
-
-    Rep // Vector_2
-    operator()(Return_base_tag, const RT& x, const RT& y) const
-    { return Rep(x, y); }
-
-    Rep // Vector_2
-    operator()(Return_base_tag, const RT& x, const RT& y, const RT& w) const
-    { return Rep(x, y, w); }
-
-
-
-    Vector_2
-    operator()( const Point_2& p, const Point_2& q) const
-    { return this->operator()(Return_base_tag(), p, q); }
-
-    Vector_2
-    operator()( const Origin& o, const Point_2& q) const
-    { return this->operator()(Return_base_tag(), o, q); }
-
-    Vector_2
-    operator()( const Point_2& p, const Origin& o) const
-    { return this->operator()(Return_base_tag(), p, o); }
-
-    Vector_2
-    operator()( const Direction_2& d ) const
-    { return this->operator()(Return_base_tag(), d); }
-
-    Vector_2
-    operator()( const Segment_2& s) const
-    { return this->operator()(Return_base_tag(), s); }
-
-    Vector_2
-    operator()( const Ray_2& r) const
-    { return this->operator()(Return_base_tag(), r); }
-
-    Vector_2
-    operator()( const Line_2& l) const
-    { return this->operator()(Return_base_tag(), l); }
-
-    Vector_2
-    operator()( Null_vector n) const
-    { return this->operator()(Return_base_tag(), n); }
-
-    Vector_2
-    operator()( const RT& x, const RT& y) const
-    { return this->operator()(Return_base_tag(), x, y); }
-
-    Vector_2
-    operator()( const RT& x, const RT& y, const RT& w) const
-    { return this->operator()(Return_base_tag(), x, y, w); }
-  };
-
-  template <typename K>
-  class Construct_vector_3
-  {
-    typedef typename K::RT           RT;
-    typedef typename K::FT           FT;
-    typedef typename K::Segment_3    Segment_3;
-    typedef typename K::Direction_3  Direction_3;
-    typedef typename K::Ray_3        Ray_3;
-    typedef typename K::Line_3       Line_3;
-    typedef typename K::Vector_3     Vector_3;
-    typedef typename K::Point_3      Point_3;
-    typedef typename Vector_3::Rep   Rep;
-  public:
-    typedef Vector_3                 result_type;
-
-    Rep // Vector_3
-    operator()(Return_base_tag, const Point_3& p, const Point_3& q) const
-    {
-      return Rep(q.x() - p.x(), q.y() - p.y(), q.z() - p.z());
-    }
-
-    Rep // Vector_3
-    operator()(Return_base_tag, const Origin&, const Point_3& q) const
-    {
-      return Rep(q.x(), q.y(), q.z());
-    }
-
-    Rep // Vector_3
-    operator()(Return_base_tag, const Point_3& p, const Origin&) const
-    {
-      return Rep(- p.x(), - p.y(), - p.z());
-    }
-
-    Rep // Vector_3
-    operator()(Return_base_tag, const Direction_3& d) const
-    { return d.rep().to_vector(); }
-
-    Rep // Vector_3
-    operator()(Return_base_tag, const Segment_3& s) const
-    { return s.rep().to_vector(); }
-
-    Rep // Vector_3
-    operator()(Return_base_tag, const Ray_3& r) const
-    { return r.rep().to_vector(); }
-
-    Rep // Vector_3
-    operator()(Return_base_tag, const Line_3& l) const
-    { return l.rep().to_vector(); }
-
-    Rep // Vector_3
-    operator()(Return_base_tag, const Null_vector&) const
-    { return Rep(FT(0), FT(0), FT(0)); }
-
-    Rep // Vector_3
-    operator()(Return_base_tag, const RT& x, const RT& y, const RT& z) const
-    { return Rep(x, y, z); }
-
-    Rep // Vector_3
-    operator()(Return_base_tag, const RT& x, const RT& y, const RT& z, const RT& w) const
-    { return Rep(x, y, z, w); }
-
-
-    Vector_3
-    operator()( const Point_3& p, const Point_3& q) const
-    { return this->operator()(Return_base_tag(), p, q); }
-
-    Vector_3
-    operator()( const Origin& o, const Point_3& q) const
-    { return this->operator()(Return_base_tag(), o, q); }
-
-    Vector_3
-    operator()( const Point_3& p, const Origin& q) const
-    { return this->operator()(Return_base_tag(), p, q); }
-
-    Vector_3
-    operator()( const Direction_3& d) const
-    { return this->operator()(Return_base_tag(), d); }
-
-    Vector_3
-    operator()( const Segment_3& s) const
-    { return this->operator()(Return_base_tag(), s); }
-
-    Vector_3
-    operator()( const Ray_3& r) const
-    { return this->operator()(Return_base_tag(), r); }
-
-    Vector_3
-    operator()( const Line_3& l) const
-    { return this->operator()(Return_base_tag(), l); }
-
-    Vector_3
-    operator()( const Null_vector& n) const
-    { return this->operator()(Return_base_tag(), n); }
-
-    Vector_3
-    operator()( int x, int y, int z) const
-    { return this->operator()(Return_base_tag(), x, y, z); }
-
-    Vector_3
-    operator()( const RT& x, const RT& y, const RT& z) const
-    { return this->operator()(Return_base_tag(), x, y, z); }
-
-    Vector_3
-    operator()( const RT& x, const RT& y, const RT& z, const RT& w) const
-    { return this->operator()(Return_base_tag(), x, y, z, w); }
-  };
-
-  template <typename K>
-  class Construct_vertex_2
-  {
-    typedef typename K::Point_2          Point_2;
-    typedef typename K::Segment_2        Segment_2;
-    typedef typename K::Iso_rectangle_2  Iso_rectangle_2;
-    typedef typename K::Triangle_2       Triangle_2;
-  public:
-    template<class>
-    struct result {
-      typedef const Point_2& type;
-    };
-    
-    template<typename F>
-    struct result<F(Iso_rectangle_2, int)> {
-      typedef Point_2 type;
-    };
-
-    const Point_2 &
-    operator()( const Segment_2& s, int i) const
-    { return s.vertex(i); }
-
-    const Point_2 &
-    operator()( const Triangle_2& t, int i) const
-    { return t.rep().vertex(i); }
-
-    Point_2
-    operator()( const Iso_rectangle_2& r, int i) const
-    {
-      switch (i%4) {
-      case 0: return (r.min)();
-      case 1: return Point_2(r.xmax(), r.ymin());
-      case 2: return (r.max)();
-      default: return Point_2(r.xmin(), r.ymax());
-      }
-    }
-  };
-
-} //namespace CartesianKernelFunctors
-
-namespace CartesianKernelFunctors {
-
-  template <typename K>
-  class Coplanar_orientation_3
-  {
-    typedef typename K::Point_3      Point_3;
-#ifdef CGAL_kernel_exactness_preconditions
-    typedef typename K::Coplanar_3   Coplanar_3;
-    typedef typename K::Collinear_3  Collinear_3;
-    Coplanar_3 cp;
-    Collinear_3 cl;
-#endif // CGAL_kernel_exactness_preconditions
-  public:
-    typedef typename K::Orientation  result_type;
-
-#ifdef CGAL_kernel_exactness_preconditions
-    Coplanar_orientation_3() {}
-    Coplanar_orientation_3(const Coplanar_3& cp_, const Collinear_3& cl_)
-      : cp(cp_), cl(cl_)
-    {}
-#endif // CGAL_kernel_exactness_preconditions
-
-    result_type
-    operator()(const Point_3& p, const Point_3& q, const Point_3& r) const
-    {
-      return coplanar_orientationC3(p.x(), p.y(), p.z(),
-				    q.x(), q.y(), q.z(),
-				    r.x(), r.y(), r.z());
-    }
-
-    result_type
-    operator()( const Point_3& p, const Point_3& q,
-	        const Point_3& r, const Point_3& s) const
-    {
-      // p,q,r,s supposed to be coplanar
-      // p,q,r supposed to be non collinear
-      // tests whether s is on the same side of p,q as r
-      // returns :
-      // COLLINEAR if pqr collinear
-      // POSITIVE if qrp and qrs have the same orientation
-      // NEGATIVE if qrp and qrs have opposite orientations
-      CGAL_kernel_exactness_precondition( ! cl(p, q, r) );
-      CGAL_kernel_exactness_precondition( cp(p, q, r, s) );
-      return coplanar_orientationC3(p.x(), p.y(), p.z(),
-				    q.x(), q.y(), q.z(),
-				    r.x(), r.y(), r.z(),
-				    s.x(), s.y(), s.z());
-    }
-  };
-
-  template <typename K>
-  class Coplanar_side_of_bounded_circle_3
-  {
-    typedef typename K::Point_3   Point_3;
-#ifdef CGAL_kernel_exactness_preconditions
-    typedef typename K::Coplanar_3   Coplanar_3;
-    typedef typename K::Collinear_3  Collinear_3;
-    Coplanar_3 cp;
-    Collinear_3 cl;
-#endif // CGAL_kernel_exactness_preconditions
-  public:
-    typedef typename K::Bounded_side     result_type;
-
-#ifdef CGAL_kernel_exactness_preconditions
-    Coplanar_side_of_bounded_circle_3() {}
-    Coplanar_side_of_bounded_circle_3(const Coplanar_3& cp_,
-				      const Collinear_3& cl_)
-      : cp(cp_), cl(cl_)
-    {}
-#endif // CGAL_kernel_exactness_preconditions
-
-    result_type
-    operator()( const Point_3& p, const Point_3& q,
-	        const Point_3& r, const Point_3& t) const
-    {
-      // p,q,r,t are supposed to be coplanar.
-      // p,q,r determine an orientation of this plane (not collinear).
-      // returns the equivalent of side_of_bounded_circle(p,q,r,t)
-      // in this plane
-      CGAL_kernel_exactness_precondition( cp(p,q,r,t) );
-      CGAL_kernel_exactness_precondition( !cl(p,q,r) );
-      return coplanar_side_of_bounded_circleC3(p.x(), p.y(), p.z(),
-					       q.x(), q.y(), q.z(),
-					       r.x(), r.y(), r.z(),
-					       t.x(), t.y(), t.z());
-    }
-  };
-
-  template <typename K>
-  class Equal_xy_3
-  {
-    typedef typename K::Point_3    Point_3;
-  public:
-    typedef typename K::Boolean    result_type;
-
-    result_type
-    operator()( const Point_3& p, const Point_3& q) const
-    {
-      return CGAL_AND( p.x() == q.x() , p.y() == q.y() );
-    }
-  };
-
-  template <typename K>
-  class Equal_x_2
-  {
-    typedef typename K::Point_2    Point_2;
-  public:
-    typedef typename K::Boolean    result_type;
-
-    result_type
-    operator()( const Point_2& p, const Point_2& q) const
-    { return p.x() == q.x(); }
-  };
-
-  template <typename K>
-  class Equal_x_3
-  {
-    typedef typename K::Point_3    Point_3;
-  public:
-    typedef typename K::Boolean    result_type;
-
-    result_type
-    operator()( const Point_3& p, const Point_3& q) const
-    { return p.x() == q.x(); }
-  };
-
-  template <typename K>
-  class Equal_y_2
-  {
-    typedef typename K::Point_2    Point_2;
-  public:
-    typedef typename K::Boolean    result_type;
-
-    result_type
-    operator()( const Point_2& p, const Point_2& q) const
-    { return p.y() == q.y(); }
-  };
-
-  template <typename K>
-  class Equal_y_3
-  {
-    typedef typename K::Point_3    Point_3;
-  public:
-    typedef typename K::Boolean    result_type;
-
-    result_type
-    operator()( const Point_3& p, const Point_3& q) const
-    { return p.y() == q.y(); }
-  };
-
-  template <typename K>
-  class Equal_z_3
-  {
-    typedef typename K::Point_3    Point_3;
-  public:
-    typedef typename K::Boolean    result_type;
-
-    result_type
-    operator()( const Point_3& p, const Point_3& q) const
-    { return p.z() == q.z(); }
-  };
-
-  template <typename K>
-  class Has_on_3
-  {
-    typedef typename K::FT               FT;
-    typedef typename K::Point_3          Point_3;
-    typedef typename K::Vector_3         Vector_3;
-    typedef typename K::Line_3           Line_3;
-    typedef typename K::Ray_3            Ray_3;
-    typedef typename K::Segment_3        Segment_3;
-    typedef typename K::Plane_3          Plane_3;
-    typedef typename K::Triangle_3       Triangle_3;
-    typedef typename K::Circle_3         Circle_3;
-    typedef typename K::Sphere_3         Sphere_3;
-  public:
-    typedef typename K::Boolean          result_type;
-
-    result_type
-    operator()( const Line_3& l, const Point_3& p) const
-    { return l.rep().has_on(p); }
-
-    result_type
-    operator()( const Ray_3& r, const Point_3& p) const
-    { return r.rep().has_on(p); }
-
-    result_type
-    operator()( const Segment_3& s, const Point_3& p) const
-    { return s.has_on(p); }
-
-    result_type
-    operator()( const Plane_3& pl, const Point_3& p) const
-    { return pl.rep().has_on(p); }
-
-    result_type
-    operator()( const Plane_3& pl, const Line_3& l) const
-    { return pl.rep().has_on(l); }
-
-    result_type
-    operator()( const Triangle_3& t, const Point_3& p) const
-    {
-      Point_3  o  = t.vertex(0) + t.supporting_plane().orthogonal_vector();
-      Vector_3 v0 = t.vertex(0)-o,
-               v1 = t.vertex(1)-o,
-               v2 = t.vertex(2)-o;
-
-      FT alpha, beta, gamma;
-      Cartesian_internal::solve(v0, v1, v2, p-o, alpha, beta, gamma);
-      return (alpha >= FT(0)) && (beta >= FT(0)) && (gamma >= FT(0))
-          && ((alpha+beta+gamma == FT(1)));
-    }
-
-    result_type
-    operator()(const Circle_3 &a, const Point_3 &p) const
-    { return a.rep().has_on(p); }
-
-    result_type
-    operator()(const Sphere_3 &a, const Circle_3 &p) const
-    { return a.rep().has_on(p); }
-
-    result_type
-    operator()(const Sphere_3 &a, const Point_3 &p) const
-    { return a.rep().has_on(p); }    
-    
-    result_type
-    operator()(const Plane_3 &a, const Circle_3 &p) const
-    { return a.rep().has_on(p); }
-
-
-  };
-
-  template <typename K>
-  class Less_distance_to_point_2
-  {
-    typedef typename K::Point_2   Point_2;
-  public:
-    typedef typename K::Boolean   result_type;
-
-    result_type
-    operator()(const Point_2& p, const Point_2& q, const Point_2& r) const
-    {
-      return has_smaller_dist_to_pointC2(p.x(), p.y(),
-					 q.x(), q.y(),
-					 r.x(), r.y());
-    }
-  };
-
-  template <typename K>
-  class Less_distance_to_point_3
-  {
-    typedef typename K::Point_3   Point_3;
-  public:
-    typedef typename K::Boolean   result_type;
-
-    result_type
-    operator()(const Point_3& p, const Point_3& q, const Point_3& r) const
-    {
-      return has_smaller_dist_to_pointC3(p.x(), p.y(), p.z(),
-					 q.x(), q.y(), q.z(),
-					 r.x(), r.y(), r.z());
-    }
-  };
-
-  // TODO ...
-  template <typename K>
-  class Less_signed_distance_to_line_2
-  {
-    typedef typename K::Point_2   Point_2;
-    typedef typename K::Line_2    Line_2;
-    typedef typename K::Equal_2   Equal_2;
-  public:
-    typedef typename K::Boolean   result_type;
-
-    result_type
-    operator()(const Point_2& a, const Point_2& b,
-               const Point_2& c, const Point_2& d) const
-    {
-      CGAL_kernel_precondition_code(Equal_2 equal;)
-      CGAL_kernel_precondition(! equal(a,b));
-      return cmp_signed_dist_to_lineC2( a.x(), a.y(),
-					b.x(), b.y(),
-					c.x(), c.y(),
-					d.x(), d.y()) == SMALLER;
-    }
-
-    result_type
-    operator()(const Line_2& l, const Point_2& p, const Point_2& q) const
-    {
-      return has_smaller_signed_dist_to_directionC2(l.a(), l.b(),
-						    p.x(), p.y(),
-						    q.x(), q.y());
-    }
-  };
-
-  template <typename K>
-  class Less_signed_distance_to_plane_3
-  {
-    typedef typename K::Point_3       Point_3;
-    typedef typename K::Plane_3       Plane_3;
-    typedef typename K::Collinear_3   Collinear_3;
-  public:
-    typedef typename K::Boolean       result_type;
-
-    result_type
-    operator()( const Plane_3& h, const Point_3& p, const Point_3& q) const
-    {
-      return has_smaller_signed_dist_to_directionC3(h.a(), h.b(), h.c(),
-						    p.x(), p.y(), p.z(),
-						    q.x(), q.y(), q.z());
-    }
-
-    result_type
-    operator()( const Point_3& hp, const Point_3& hq,  const Point_3& hr,
-		const Point_3& p, const Point_3& q) const
-    {
-      CGAL_kernel_precondition_code(Collinear_3 collinear_3;)
-      CGAL_kernel_precondition(! collinear_3(hp, hq, hr));
-      return has_smaller_signed_dist_to_planeC3(hp.x(), hp.y(), hp.z(),
-						hq.x(), hq.y(), hq.z(),
-						hr.x(), hr.y(), hr.z(),
-						p.x(),  p.y(),  p.z(),
-						q.x(),  q.y(),  q.z());;
-    }
-  };
-
-  template <typename K>
-  class Less_xyz_3
-  {
-    typedef typename K::Point_3         Point_3;
-    typedef typename K::Compare_xyz_3   Compare_xyz_3;
-    Compare_xyz_3 c;
-  public:
-    typedef typename K::Boolean         result_type;
-
-    Less_xyz_3() {}
-    Less_xyz_3(const Compare_xyz_3& c_) : c(c_) {}
-
-    result_type
-    operator()( const Point_3& p, const Point_3& q) const
-    { return c(p, q) == SMALLER; }
-  };
-
-  template <typename K>
-  class Less_xy_2
-  {
-    typedef typename K::Point_2        Point_2;
-    typedef typename K::Compare_xy_2   Compare_xy_2;
-    Compare_xy_2 c;
-  public:
-    typedef typename K::Boolean        result_type;
-
-    Less_xy_2() {}
-    Less_xy_2(const Compare_xy_2& c_) : c(c_) {}
-
-    result_type
-    operator()( const Point_2& p, const Point_2& q) const
-    { return c(p, q) == SMALLER; }
-  };
-
-  template <typename K>
-  class Less_xy_3
-  {
-    typedef typename K::Point_3        Point_3;
-    typedef typename K::Compare_xy_3   Compare_xy_3;
-    Compare_xy_3 c;
-  public:
-    typedef typename K::Boolean        result_type;
-
-    Less_xy_3() {}
-    Less_xy_3(const Compare_xy_3& c_) : c(c_) {}
-
-    result_type
-    operator()( const Point_3& p, const Point_3& q) const
-    { return c(p, q) == SMALLER; }
-  };
-
-  template <typename K>
-  class Less_x_2
-  {
-    typedef typename K::Point_2        Point_2;
-  public:
-    typedef typename K::Boolean        result_type;
-
-    result_type
-    operator()( const Point_2& p, const Point_2& q) const
-    { return p.x() < q.x(); }
-  };
-
-  template <typename K>
-  class Less_x_3
-  {
-    typedef typename K::Point_3        Point_3;
-  public:
-    typedef typename K::Boolean        result_type;
-
-    result_type
-    operator()( const Point_3& p, const Point_3& q) const
-    { return p.x() < q.x(); }
-  };
-
-  template <typename K>
-  class Less_yx_2
-  {
-    typedef typename K::Point_2        Point_2;
-  public:
-    typedef typename K::Boolean        result_type;
-
-    result_type
-    operator()( const Point_2& p, const Point_2& q) const
-    {
-      return compare_lexicographically_xyC2(p.y(), p.x(),
-					    q.y(), q.x()) == SMALLER;
-    }
-  };
-
-  template <typename K>
-  class Less_y_2
-  {
-    typedef typename K::Point_2        Point_2;
-  public:
-    typedef typename K::Boolean        result_type;
-
-    result_type
-    operator()( const Point_2& p, const Point_2& q) const
-    { return p.y() < q.y(); }
-  };
-
-  template <typename K>
-  class Less_y_3
-  {
-    typedef typename K::Point_3        Point_3;
-  public:
-    typedef typename K::Boolean        result_type;
-
-    result_type
-    operator()( const Point_3& p, const Point_3& q) const
-    { return p.y() < q.y(); }
-  };
-
-  template <typename K>
-  class Less_z_3
-  {
-    typedef typename K::Point_3        Point_3;
-  public:
-    typedef typename K::Boolean        result_type;
-
-    result_type
-    operator()( const Point_3& p, const Point_3& q) const
-    { return p.z() < q.z(); }
-  };
-
-  template <typename K>
-  class Orientation_2
-  {
-    typedef typename K::Point_2       Point_2;
-    typedef typename K::Vector_2      Vector_2;
-    typedef typename K::Circle_2      Circle_2;
-  public:
-    typedef typename K::Orientation   result_type;
-
-    result_type
-    operator()(const Point_2& p, const Point_2& q, const Point_2& r) const
-    {
-      return orientationC2(p.x(), p.y(), q.x(), q.y(), r.x(), r.y());
-    }
-
-    result_type
-    operator()(const Vector_2& u, const Vector_2& v) const
-    {
-      return orientationC2(u.x(), u.y(), v.x(), v.y());
-    }
-
-    result_type
-    operator()(const Circle_2& c) const
-    {
-      return c.rep().orientation();
-    }
-  };
-
-  template <typename K>
-  class Orientation_3
-  {
-    typedef typename K::Point_3        Point_3;
-    typedef typename K::Vector_3       Vector_3;
-    typedef typename K::Tetrahedron_3  Tetrahedron_3;
-    typedef typename K::Sphere_3       Sphere_3;
-  public:
-    typedef typename K::Orientation    result_type;
-
-    result_type
-    operator()( const Point_3& p, const Point_3& q,
-	        const Point_3& r, const Point_3& s) const
-    {
-      return orientationC3(p.x(), p.y(), p.z(),
-			   q.x(), q.y(), q.z(),
-			   r.x(), r.y(), r.z(),
-			   s.x(), s.y(), s.z());
-    }
-
-    result_type
-    operator()( const Vector_3& u, const Vector_3& v, const Vector_3& w) const
-    {
-      return orientationC3(u.x(), u.y(), u.z(),
-			   v.x(), v.y(), v.z(),
-			   w.x(), w.y(), w.z());
-    }
-
-    result_type
-    operator()( const Tetrahedron_3& t) const
-    {
-      return t.rep().orientation();
-    }
-
-    result_type
-    operator()(const Sphere_3& s) const
-    {
-      return s.rep().orientation();
-    }
-  };
-
-  template <typename K>
-  class Oriented_side_2
-  {
-    typedef typename K::Point_2        Point_2;
-    typedef typename K::Circle_2       Circle_2;
-    typedef typename K::Line_2         Line_2;
-    typedef typename K::Triangle_2     Triangle_2;
-  public:
-    typedef typename K::Oriented_side  result_type;
-
-    result_type
-    operator()( const Circle_2& c, const Point_2& p) const
-    { return enum_cast<Oriented_side>(c.bounded_side(p)) * c.orientation(); }
-
-    result_type
-    operator()( const Line_2& l, const Point_2& p) const
-    { return side_of_oriented_lineC2(l.a(), l.b(), l.c(), p.x(), p.y()); }
-
-    result_type
-    operator()( const Triangle_2& t, const Point_2& p) const
-    {
-      typename K::Collinear_are_ordered_along_line_2
-	collinear_are_ordered_along_line;
-      typename K::Orientation_2 orientation;
-      // depends on the orientation of the vertices
-      typename K::Orientation
-                  o1 = orientation(t.vertex(0), t.vertex(1), p),
-	          o2 = orientation(t.vertex(1), t.vertex(2), p),
-	          o3 = orientation(t.vertex(2), t.vertex(3), p),
-	          ot = orientation(t.vertex(0), t.vertex(1), t.vertex(2));
-
-      if (o1 == ot && o2 == ot && o3 == ot) // ot cannot be COLLINEAR
-	return ot;
-      return
-	(o1 == COLLINEAR
-	 && collinear_are_ordered_along_line(t.vertex(0), p, t.vertex(1))) ||
-	(o2 == COLLINEAR
-	 && collinear_are_ordered_along_line(t.vertex(1), p, t.vertex(2))) ||
-	(o3 == COLLINEAR
-	 && collinear_are_ordered_along_line(t.vertex(2), p, t.vertex(3)))
-	? result_type(ON_ORIENTED_BOUNDARY)
-	: opposite(ot);
-    }
-  };
-
-  template <typename K>
-  class Side_of_bounded_circle_2
-  {
-    typedef typename K::Point_2        Point_2;
-  public:
-    typedef typename K::Bounded_side   result_type;
-
-    result_type
-    operator()( const Point_2& p, const Point_2& q, const Point_2& t) const
-    {
-      return side_of_bounded_circleC2(p.x(), p.y(),
-				      q.x(), q.y(),
-				      t.x(), t.y());
-    }
-
-    result_type
-    operator()( const Point_2& p, const Point_2& q,
-	        const Point_2& r, const Point_2& t) const
-    {
-      return side_of_bounded_circleC2(p.x(), p.y(), q.x(), q.y(), r.x(), r.y(),
-				      t.x(), t.y());
-    }
-  };
-
-  template <typename K>
-  class Side_of_bounded_sphere_3
-  {
-    typedef typename K::Point_3        Point_3;
-  public:
-    typedef typename K::Bounded_side   result_type;
-
-    result_type
-    operator()( const Point_3& p, const Point_3& q, const Point_3& test) const
-    {
-      return side_of_bounded_sphereC3(p.x(), p.y(), p.z(),
-				      q.x(), q.y(), q.z(),
-				      test.x(), test.y(), test.z());
-    }
-
-    result_type
-    operator()( const Point_3& p, const Point_3& q,
-	        const Point_3& r, const Point_3& test) const
-    {
-      return side_of_bounded_sphereC3(p.x(), p.y(), p.z(),
-				      q.x(), q.y(), q.z(),
-				      r.x(), r.y(), r.z(),
-				      test.x(), test.y(), test.z());
-    }
-
-    result_type
-    operator()( const Point_3& p, const Point_3& q, const Point_3& r,
-	        const Point_3& s, const Point_3& test) const
-    {
-      return side_of_bounded_sphereC3(p.x(), p.y(), p.z(),
-				      q.x(), q.y(), q.z(),
-				      r.x(), r.y(), r.z(),
-				      s.x(), s.y(), s.z(),
-				      test.x(), test.y(), test.z());
-    }
-  };
-
-  template <typename K>
-  class Side_of_oriented_circle_2
-  {
-    typedef typename K::Point_2        Point_2;
-  public:
-    typedef typename K::Oriented_side  result_type;
-
-    result_type
-    operator()( const Point_2& p, const Point_2& q,
-	        const Point_2& r, const Point_2& t) const
-    {
-      return side_of_oriented_circleC2(p.x(), p.y(),
-				       q.x(), q.y(),
-				       r.x(), r.y(),
-				       t.x(), t.y());
-    }
-  };
-
-  template <typename K>
-  class Side_of_oriented_sphere_3
-  {
-    typedef typename K::Point_3        Point_3;
-  public:
-    typedef typename K::Oriented_side  result_type;
-
-    result_type
-    operator()( const Point_3& p, const Point_3& q, const Point_3& r,
-	        const Point_3& s, const Point_3& test) const
-    {
-      return side_of_oriented_sphereC3(p.x(), p.y(), p.z(),
-				       q.x(), q.y(), q.z(),
-				       r.x(), r.y(), r.z(),
-				       s.x(), s.y(), s.z(),
-				       test.x(), test.y(), test.z());
-    }
-  };
-
-} // namespace CartesianKernelFunctors
-
-} //namespace CGAL
-
-#endif // CGAL_CARTESIAN_FUNCTION_OBJECTS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Combinatorial_map.h b/3rdparty/CGAL-4.8/include/CGAL/Combinatorial_map.h
deleted file mode 100644
index c4089b3..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Combinatorial_map.h
+++ /dev/null
@@ -1,3814 +0,0 @@
-// Copyright (c) 2010-2011 CNRS and LIRIS' Establishments (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Guillaume Damiand <guillaume.damiand at liris.cnrs.fr>
-//
-#ifndef CGAL_COMBINATORIAL_MAP_H
-#define CGAL_COMBINATORIAL_MAP_H 1
-
-#include <CGAL/Compact_container.h>
-#include <CGAL/internal/Combinatorial_map_utility.h>
-#include <CGAL/internal/Combinatorial_map_group_functors.h>
-#include <CGAL/internal/Combinatorial_map_copy_functors.h>
-#include <CGAL/internal/Combinatorial_map_sewable.h>
-#include <CGAL/Combinatorial_map_functors.h>
-#include <CGAL/Combinatorial_map_min_items.h>
-#include <CGAL/Dart_const_iterators.h>
-#include <CGAL/Cell_const_iterators.h>
-#include <CGAL/Combinatorial_map_basic_operations.h>
-#include <CGAL/Combinatorial_map_storages.h>
-#include <CGAL/Unique_hash_map.h>
-#include <bitset>
-#include <vector>
-#include <deque>
-
-#include <boost/type_traits/is_same.hpp>
-
-#include <CGAL/config.h>
-
-#if defined( __INTEL_COMPILER )
-// Workarounf for warning in function basic_link_beta_0
-#pragma warning disable 1017
-#endif
-
-namespace CGAL {
-
-  /** @file Combinatorial_map.h
-   * Definition of generic dD Combinatorial map.
-   */
-
-
-  /** Generic definition of combinatorial map in dD.
-   * The Combinatorial_map class describes an dD combinatorial map. It allows
-   * mainly to create darts, to use marks onto these darts, to get and set
-   * the beta links, and to manage enabled attributes.
-   */
-  template < unsigned int d_, class Refs,
-             class Items_=Combinatorial_map_min_items<d_>,
-             class Alloc_=CGAL_ALLOCATOR(int),
-             class Storage_= Combinatorial_map_storage_1<d_, Items_, Alloc_> >
-  class Combinatorial_map_base: public Storage_
-  {
-    template<typename CMap,unsigned int i,typename Enabled>
-    friend struct CGAL::internal::Call_merge_functor;
-    template<typename CMap,unsigned int i,typename Enabled>
-    friend struct CGAL::internal::Call_split_functor;
-    template<class Map, unsigned int i, unsigned int nmi>
-    friend struct Remove_cell_functor;
-    template<class Map, unsigned int i>
-    friend struct Contract_cell_functor;
-    template <typename CMap, typename Attrib>
-    friend struct internal::Reverse_orientation_of_map_functor;
-    template <typename CMap, typename Attrib>
-    friend struct internal::Reverse_orientation_of_connected_component_functor;
-    template<typename CMap>
-    friend struct internal::Init_attribute_functor;
-
-  public:
-    template < unsigned int A, class B, class I, class D, class S >
-    friend class Combinatorial_map_base;
-
-    /// Types definition
-    typedef Storage_                                                    Storage;
-    typedef Storage                                                     Base;
-    typedef Combinatorial_map_base<d_, Refs, Items_, Alloc_, Storage_ > Self;
-
-    typedef typename Base::Dart Dart;
-    typedef typename Base::Dart_handle Dart_handle;
-    typedef typename Base::Dart_const_handle Dart_const_handle;
-    typedef typename Base::Dart_container Dart_container;
-    typedef typename Base::Dart_wrapper Dart_wrapper;
-    typedef typename Base::size_type size_type;
-    typedef typename Base::Helper Helper;
-    typedef typename Base::Attributes Attributes;
-    typedef typename Base::Items Items;
-    typedef typename Base::Alloc Alloc;
-    typedef typename Base::Use_index Use_index;
-
-    static const size_type NB_MARKS = Base::NB_MARKS;
-    static const size_type INVALID_MARK = NB_MARKS;
-
-    static const unsigned int dimension = Base::dimension;
-
-    typedef typename Base::Null_handle_type Null_handle_type;
-
-    using Base::null_handle;
-    using Base::null_dart_handle;
-    using Base::mdarts;
-    using Base::get_beta;
-    using Base::is_free;
-    using Base::set_dart_mark;
-    using Base::get_dart_mark;
-    using Base::flip_dart_mark;
-    using Base::set_dart_marks;
-    using Base::get_dart_marks;
-    using Base::dart_link_beta;
-    using Base::dart_unlink_beta;
-    using Base::attribute;
-    using Base::mattribute_containers;
-    using Base::get_attribute;
-    using Base::dart_of_attribute;
-    using Base::set_dart_of_attribute;
-    using Base::info_of_attribute;
-    using Base::info;
-    using Base::dart;
-
-    /// Typedef for Dart_range, a range through all the darts of the map.
-    typedef Dart_container       Dart_range;
-    typedef const Dart_container Dart_const_range;
-
-    /// Typedef for attributes
-    template<int i>
-    struct Attribute_type: public Base::template Attribute_type<i>
-    {};
-    template<int i>
-    struct Attribute_handle: public Base::template Attribute_handle<i>
-    {};
-    template<int i>
-    struct Attribute_const_handle:
-      public Base::template Attribute_const_handle<i>
-    {};
-    template<int i>
-    struct Attribute_range: public Base::template Attribute_range<i>
-    {};
-    template<int i>
-    struct Attribute_const_range:
-      public Base::template Attribute_const_range<i>
-    {};
-
-    class Exception_no_more_available_mark {};
-
-  public:
-    /** Default Combinatorial_map constructor.
-     * The map is empty.
-     */
-    Combinatorial_map_base()
-    {
-      CGAL_static_assertion_msg(Dart::dimension==dimension,
-                  "Dimension of dart different from dimension of map");
-
-      CGAL_static_assertion_msg(Helper::nb_attribs<=dimension+1,
-                  "Too many attributes in the tuple Attributes_enabled");
-      this->init_storage();
-
-      this->mnb_used_marks = 0;
-      this->mmask_marks.reset();
-
-      for ( size_type i = 0; i < NB_MARKS; ++i)
-      {
-        this->mfree_marks_stack[i]        = i;
-        this->mindex_marks[i]             = i;
-        this->mnb_marked_darts[i]         = 0;
-        this->mnb_times_reserved_marks[i] = 0;
-      }
-
-      this->automatic_attributes_management = true;
-
-      init_dart(null_dart_handle);
-
-      CGAL_assertion(number_of_darts()==0);
-    }
-
-    /** Copy the given combinatorial map into *this.
-     *  Note that both CMap can have different dimensions and/or non void attributes.
-     *  @param amap the combinatorial map to copy.
-     *  @post *this is valid.
-     */
-    template <typename CMap2, typename Converters, typename Pointconverter>
-    void copy(const CMap2& amap, const Converters& converters,
-              const Pointconverter& pointconverter)
-    {
-      this->clear();
-
-      this->mnb_used_marks = amap.mnb_used_marks;
-      this->mmask_marks    = amap.mmask_marks;
-
-      for (size_type i = 0; i < NB_MARKS; ++i)
-      {
-        this->mfree_marks_stack[i]        = amap.mfree_marks_stack[i];
-        this->mindex_marks[i]             = amap.mindex_marks[i];
-        this->mnb_marked_darts[i]         = amap.mnb_marked_darts[i];
-        this->mnb_times_reserved_marks[i] = amap.mnb_times_reserved_marks[i];
-      }
-
-      init_dart(null_dart_handle, amap.get_marks(amap.null_dart_handle));
-
-      // Create an mapping between darts of the two maps (originals->copies).
-      // TODO: replace the std::map by a boost::unordered_map
-      // (here we cannot use CGAL::Unique_hash_map because it does not provide
-      // iterators...
-      std::map<typename CMap2::Dart_const_handle, Dart_handle> dartmap;
-
-      for (typename CMap2::Dart_const_range::const_iterator
-             it=amap.darts().begin(), itend=amap.darts().end();
-           it!=itend; ++it)
-      {
-        dartmap[it]=mdarts.emplace();
-        init_dart(dartmap[it], amap.get_marks(it));
-      }
-
-      unsigned int min_dim=(dimension<amap.dimension?dimension:amap.dimension);
-
-      typename std::map<typename CMap2::Dart_const_handle,Dart_handle>
-        ::iterator dartmap_iter, dartmap_iter_end=dartmap.end();
-      for (dartmap_iter=dartmap.begin(); dartmap_iter!=dartmap_iter_end;
-           ++dartmap_iter)
-      {
-        for (unsigned int i=0; i<=min_dim; i++)
-        {
-          if (!amap.is_free(dartmap_iter->first,i) &&
-              (dartmap_iter->first)<(amap.beta(dartmap_iter->first,i)))
-          {
-            basic_link_beta(dartmap_iter->second,
-                            dartmap[amap.beta(dartmap_iter->first,i)], i);
-          }
-        }
-      }
-
-      /** Copy attributes */
-      for (dartmap_iter=dartmap.begin(); dartmap_iter!=dartmap_iter_end;
-           ++dartmap_iter)
-      {
-        Helper::template Foreach_enabled_attributes
-          < internal::Copy_attributes_functor <CMap2, Refs, Converters,
-            Pointconverter> >::
-          run(&amap, static_cast<Refs*>(this),
-              dartmap_iter->first, dartmap_iter->second,
-              converters, pointconverter);
-      }
-
-      CGAL_assertion (is_valid () == 1);
-    }
-
-    template <typename CMap2>
-    void copy(const CMap2& amap)
-    {
-      CGAL::cpp11::tuple<> converters;
-      Default_converter_cmap_0attributes_with_point<CMap2, Refs> pointconverter;
-      return copy< CMap2, CGAL::cpp11::tuple<>,
-          Default_converter_cmap_0attributes_with_point<CMap2, Refs> >
-          (amap, converters, pointconverter);
-    }
-
-    template <typename CMap2, typename Converters>
-    void copy(const CMap2& amap, const Converters& converters)
-    {
-      Default_converter_cmap_0attributes_with_point<CMap2, Refs> pointconverter;
-      return copy< CMap2, Converters,
-          Default_converter_cmap_0attributes_with_point<CMap2, Refs> >
-          (amap, converters, pointconverter);
-    }
-
-    // Copy constructor from a map having exactly the same type.
-    Combinatorial_map_base (const Self & amap)
-    { copy<Self>(amap); }
-
-    // "Copy constructor" from a map having different type.
-    template <typename CMap2>
-    Combinatorial_map_base(const CMap2& amap)
-    { copy<CMap2>(amap); }
-
-    // "Copy constructor" from a map having different type.
-    template <typename CMap2, typename Converters>
-    Combinatorial_map_base(const CMap2& amap, Converters& converters)
-    { copy<CMap2,Converters>(amap, converters); }
-
-    // "Copy constructor" from a map having different type.
-    template <typename CMap2, typename Converters, typename Pointconverter>
-    Combinatorial_map_base(const CMap2& amap, Converters& converters,
-                           const Pointconverter& pointconverter)
-    { copy<CMap2,Converters, Pointconverter>
-          (amap, converters, pointconverter); }
-
-    /** Affectation operation. Copies one map to the other.
-     * @param amap a combinatorial map.
-     * @return A copy of that combinatorial map.
-     */
-    Self & operator= (const Self & amap)
-    {
-      if (this!=&amap)
-      {
-        Self tmp(amap);
-        this->swap(tmp);
-      }
-      return *this;
-    }
-
-    /** Swap this combinatorial map with amap, a second combinatorial map.
-     * Note that the two maps have exactly the same type.
-     * @param amap a combinatorial map.
-     */
-    void swap(Self & amap)
-    {
-      if (this!=&amap)
-      {
-        amap.mdarts.swap(mdarts);
-
-        std::swap_ranges(mnb_times_reserved_marks,
-                         mnb_times_reserved_marks+NB_MARKS,
-                         amap.mnb_times_reserved_marks);
-        std::swap(mmask_marks,amap.mmask_marks);
-        std::swap(mnb_used_marks, amap.mnb_used_marks);
-        std::swap_ranges(mindex_marks,mindex_marks+NB_MARKS,
-                         amap.mindex_marks);
-        std::swap_ranges(mfree_marks_stack, mfree_marks_stack+NB_MARKS,
-                         amap.mfree_marks_stack);
-        std::swap_ranges(mused_marks_stack,mused_marks_stack+NB_MARKS,
-                         amap.mused_marks_stack);
-        std::swap_ranges(mnb_marked_darts,mnb_marked_darts+NB_MARKS,
-                         amap.mnb_marked_darts);
-        mattribute_containers.swap(amap.mattribute_containers);
-#ifndef CGAL_CMAP_DEPRECATED
-        std::swap(null_dart_handle, amap.null_dart_handle);
-        this->mnull_dart_container.swap(amap.mnull_dart_container);
-#endif // CGAL_CMAP_DEPRECATED
-      }
-    }
-
-    /** Clear the combinatorial map. Remove all darts and all attributes.
-     *  Note that reserved marks are not free.
-     */
-    void clear()
-    {
-      mdarts.clear();
-      for ( size_type i = 0; i < NB_MARKS; ++i)
-        this->mnb_marked_darts[i]  = 0;
-
-      internal::Clear_all::run(mattribute_containers);
-      this->init_storage();
-      init_dart(null_dart_handle);
-    }
-
-    /** Test if the map is empty.
-     *  @return true iff the map is empty.
-     */
-    bool is_empty() const
-    { return mdarts.empty(); }
-
-    friend std::ostream& operator<< (std::ostream& os, const Self& amap)
-    {
-      save_combinatorial_map(amap, os);
-      return os;
-    }
-
-    friend std::ifstream& operator>> (std::ifstream& is, Self& amap)
-    {
-      load_combinatorial_map(is, amap);
-      return is;
-    }
-
-    /** Create a new dart and add it to the map.
-     * The marks of the darts are initialised with mmask_marks, i.e. the dart
-     * is unmarked for all the marks.
-     * @return a Dart_handle on the new dart.
-     */
-#ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
-    template < typename... Args >
-    Dart_handle create_dart(const Args&... args)
-    {
-      Dart_handle res=mdarts.emplace(args...);
-      init_dart(res);
-      return res;
-    }
-#else
-    Dart_handle create_dart()
-    {
-      Dart_handle res=mdarts.emplace();
-      init_dart(res);
-      return res;
-    }
-    template < typename T1 >
-    Dart_handle create_dart(const T1 &t1)
-    {
-      Dart_handle res=mdarts.emplace(t1);
-      init_dart(res);
-      return res;
-    }
-    template < typename T1, typename T2 >
-    Dart_handle create_dart(const T1 &t1, const T2 &t2)
-    {
-      Dart_handle res=mdarts.emplace(t1, t2);
-      init_dart(res);
-      return res;
-    }
-    template < typename T1, typename T2, typename T3 >
-    Dart_handle create_dart(const T1 &t1, const T2 &t2, const T3 &t3)
-    {
-      Dart_handle res=mdarts.emplace(t1, t2, t3);
-      init_dart(res);
-      return res;
-    }
-    template < typename T1, typename T2, typename T3, typename T4 >
-    Dart_handle create_dart(const T1 &t1, const T2 &t2, const T3 &t3,
-                            const T4 &t4)
-    {
-      Dart_handle res=mdarts.emplace(t1, t2, t3, t4);
-      init_dart(res);
-      return res;
-    }
-    template < typename T1, typename T2, typename T3, typename T4, typename T5 >
-    Dart_handle create_dart(const T1 &t1, const T2 &t2, const T3 &t3,
-                            const T4 &t4, const T5 &t5)
-    {
-      Dart_handle res=mdarts.emplace(t1, t2, t3, t4, t5);
-      init_dart(res);
-      return res;
-    }
-    template < typename T1, typename T2, typename T3, typename T4, typename T5,
-               typename T6 >
-    Dart_handle create_dart(const T1 &t1, const T2 &t2, const T3 &t3,
-                            const T4 &t4, const T5 &t5, const T6 &t6)
-    {
-      Dart_handle res=mdarts.emplace(t1, t2, t3, t4, t5, t6);
-      init_dart(res);
-      return res;
-    }
-    template < typename T1, typename T2, typename T3, typename T4, typename T5,
-               typename T6, typename T7 >
-    Dart_handle create_dart(const T1 &t1, const T2 &t2, const T3 &t3,
-                            const T4 &t4, const T5 &t5, const T6 &t6,
-                            const T7 &t7)
-    {
-      Dart_handle res=mdarts.emplace(t1, t2, t3, t4, t5, t6, t7);
-      init_dart(res);
-      return res;
-    }
-    template < typename T1, typename T2, typename T3, typename T4, typename T5,
-               typename T6, typename T7, typename T8 >
-    Dart_handle create_dart(const T1 &t1, const T2 &t2, const T3 &t3,
-                            const T4 &t4, const T5 &t5, const T6 &t6,
-                            const T7 &t7, const T8 &t8)
-    {
-      Dart_handle res=mdarts.emplace(t1, t2, t3, t4, t5, t6, t7, t8);
-      init_dart(res);
-      return res;
-    }
-    template < typename T1, typename T2, typename T3, typename T4, typename T5,
-               typename T6, typename T7, typename T8, typename T9 >
-    Dart_handle create_dart(const T1 &t1, const T2 &t2, const T3 &t3,
-                            const T4 &t4, const T5 &t5, const T6 &t6,
-                            const T7 &t7, const T8 &t8, const T9 &t9)
-    {
-      Dart_handle res=mdarts.emplace(t1, t2, t3, t4, t5, t6, t7, t8, t9);
-      init_dart(res);
-      return res;
-    }
-#endif
-
-    /** Erase a dart from the list of darts.
-     * @param adart the dart to erase.
-     */
-    void erase_dart(Dart_handle adart)
-    {
-      // 1) We update the number of marked darts.
-      for ( size_type i = 0; i < mnb_used_marks; ++i)
-      {
-        if (is_marked(adart, mused_marks_stack[i]))
-          --mnb_marked_darts[mused_marks_stack[i]];
-      }
-
-      // 2) We update the attribute_ref_counting.
-      Helper::template Foreach_enabled_attributes
-        <internal::Decrease_attribute_functor<Self> >::run(this,adart);
-
-      // 3) We erase the dart.
-      mdarts.erase(adart);
-    }
-
-    /// @return true if dh points to a used dart (i.e. valid).
-    bool is_dart_used(Dart_const_handle dh) const
-    { return mdarts.is_used(dh); }
-
-    /// @return a Dart_range (range through all the darts of the map).
-    Dart_range& darts()             { return mdarts;}
-    Dart_const_range& darts() const { return mdarts; }
-
-    /** Get the first dart of this map.
-     * @return the first dart.
-     */
-    Dart_handle first_dart()
-    {
-      if (darts().begin() == darts().end()) return null_handle;
-      return mdarts.begin();
-    }
-    Dart_const_handle first_dart() const
-    {
-      if (darts().begin() == darts().end()) return null_handle;
-      return mdarts.begin();
-    }
-
-    /// @return the Dart_handle corresponding to the given dart.
-    Dart_handle dart_handle(Dart& adart)
-    { return mdarts.iterator_to(adart); }
-    Dart_const_handle dart_handle(const Dart& adart) const
-    { return mdarts.iterator_to(adart); }
-
-    /** Return the highest dimension for which dh is not free.
-     * @param dh a dart handle
-     * @return the dimension d such that dh is not d-free but k-free for
-     *         all k>d. -1 if the dart is free for all d in {0..n}
-     */
-    int highest_nonfree_dimension(Dart_const_handle dh) const
-    {
-      for (int i=(int)dimension; i>=0; --i)
-      { if ( !is_free(dh, i) ) return i; }
-      return -1;
-    }
-
-    /** Return a dart belonging to the same edge and to the second vertex
-     * of the current edge (NULL if such a dart does not exist).
-     * @return An handle to the opposite dart.
-     */
-    Dart_handle opposite(Dart_handle dh)
-    {
-      for (unsigned int i = 2; i <= dimension; ++i)
-        if (!is_free(dh, i)) return beta(dh, i);
-      return null_handle;
-    }
-    Dart_const_handle opposite(Dart_const_handle dh) const
-    {
-      for (unsigned int i = 2; i <= dimension; ++i)
-        if (!is_free(dh, i)) return beta(dh, i);
-      return null_handle;
-    }
-
-    /** Return a dart incident to the other extremity of the current edge,
-     *  but contrary to opposite, non necessary to the same edge
-     *  (NULL if such a dart does not exist).
-     * @return An handle to the opposite dart.
-     */
-    Dart_handle other_extremity(Dart_handle dh)
-    {
-      for (unsigned int i = 1; i <= dimension; ++i)
-        if (!is_free(dh, i)) return beta(dh, i);
-      return null_handle;
-    }
-    Dart_const_handle other_extremity(Dart_const_handle dh) const
-    {
-      for (unsigned int i = 1; i <= dimension; ++i)
-        if (!is_free(dh, i)) return beta(dh, i);
-      return null_handle;
-    }
-
-    // Set the handle on the i th attribute
-    template<unsigned int i>
-    void set_dart_attribute(Dart_handle dh,
-                            typename Attribute_handle<i>::type ah)
-    {
-      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
-                     "set_dart_attribute<i> called but i-attributes are disabled.");
-
-      if ( this->template attribute<i>(dh)==ah ) return;
-
-      if ( this->template attribute<i>(dh)!=null_handle )
-      {
-        this->template get_attribute<i>(this->template attribute<i>(dh)).
-          dec_nb_refs();
-        if ( this->template get_attribute<i>(this->template attribute<i>(dh)).
-             get_nb_refs()==0 )
-          this->template erase_attribute<i>(this->template attribute<i>(dh));
-      }
-
-      this->template basic_set_dart_attribute<i>(dh, ah);
-
-      if ( ah!=null_handle )
-      {
-        this->template set_dart_of_attribute<i>(ah, dh);
-        this->template get_attribute<i>(ah).inc_nb_refs();
-      }
-    }
-
-  protected:
-    /// Marks can be modified even for const handle; otherwise it is not
-    /// possible to iterate through const combinatorial maps.
-
-    // Initialize a given dart: all beta to null_dart_handle and all
-    // attributes to null, all marks unmarked.
-    void init_dart(Dart_handle adart)
-    {
-      set_dart_marks(adart, mmask_marks);
-
-      for (unsigned int i = 0; i <= dimension; ++i)
-        dart_unlink_beta(adart, i);
-
-      Helper::template Foreach_enabled_attributes
-          <internal::Init_attribute_functor<Self> >::run(this, adart);
-    }
-    // Initialize a given dart: all beta to null_dart_handle and all
-    // attributes to null, marks are given.
-    void init_dart(Dart_handle adart,
-                   const std::bitset<NB_MARKS>& amarks)
-    {
-      set_marks(adart, amarks);
-
-      for (unsigned int i = 0; i <= dimension; ++i)
-        dart_unlink_beta(adart, i);
-
-      Helper::template Foreach_enabled_attributes
-          <internal::Init_attribute_functor<Self> >::run(this, adart);
-    }
-
-  public:
-
-    /// @return the betas of ADart (beta are used in the same order than
-    ///         they are given as parameters)
-
-#ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
-    template<typename ...Betas>
-    Dart_handle beta(Dart_handle ADart, Betas... betas)
-    { return CGAL::internal::Beta_functor<Self, Dart_handle, Betas...>::
-        run(this, ADart, betas...); }
-    template<typename ...Betas>
-    Dart_const_handle beta(Dart_const_handle ADart, Betas... betas) const
-    { return CGAL::internal::Beta_functor<const Self, Dart_const_handle, Betas...>::
-        run(this, ADart, betas...); }
-    template<int... Betas>
-    Dart_handle beta(Dart_handle ADart)
-    { return CGAL::internal::Beta_functor_static<Self, Dart_handle, Betas...>::
-        run(this, ADart); }
-    template<int... Betas>
-    Dart_const_handle beta(Dart_const_handle ADart) const
-    { return CGAL::internal::Beta_functor_static<const Self, Dart_const_handle, Betas...>::
-        run(this, ADart); }
-#else
-    Dart_handle beta(Dart_handle ADart, int B1)
-    { return this->get_beta(ADart, B1); }
-    Dart_handle beta(Dart_handle ADart, int B1, int B2)
-    { return beta(beta(ADart, B1), B2); }
-    Dart_handle beta(Dart_handle ADart, int B1, int B2, int B3)
-    { return beta(beta(ADart, B1), B2, B3); }
-    Dart_handle beta(Dart_handle ADart, int B1, int B2, int B3,
-                           int B4)
-    { return beta(beta(ADart, B1), B2, B3, B4); }
-    Dart_handle beta(Dart_handle ADart, int B1, int B2, int B3,
-                           int B4, int B5)
-    { return beta(beta(ADart, B1), B2, B3, B4, B5); }
-    Dart_handle beta(Dart_handle ADart, int B1, int B2, int B3,
-                           int B4, int B5, int B6)
-    { return beta(beta(ADart, B1), B2, B3, B4, B5, B6); }
-    Dart_handle beta(Dart_handle ADart, int B1, int B2, int B3,
-                           int B4, int B5, int B6, int B7)
-    { return beta(beta(ADart, B1), B2, B3, B4, B5, B6, B7); }
-    Dart_handle beta(Dart_handle ADart, int B1, int B2, int B3,
-                           int B4, int B5, int B6, int B7, int B8)
-    { return beta(beta(ADart, B1), B2, B3, B4, B5, B6, B7, B8); }
-    Dart_handle beta(Dart_handle ADart, int B1, int B2, int B3,
-                           int B4, int B5, int B6, int B7, int B8, int B9)
-    { return beta(beta(ADart, B1), B2, B3, B4, B5, B6, B7, B8, B9); }
-
-    template<int B1>
-    Dart_handle beta(Dart_handle ADart)
-    { return this->template get_beta<B1>(ADart); }
-    template<int B1, int B2>
-    Dart_handle beta(Dart_handle ADart)
-    { return beta<B2>(beta<B1>(ADart)); }
-    template<int B1, int B2, int B3>
-    Dart_handle beta(Dart_handle ADart)
-    { return beta<B2, B3>(beta<B1>(ADart)); }
-    template<int B1, int B2, int B3, int B4>
-    Dart_handle beta(Dart_handle ADart)
-    { return beta<B2, B3, B4>(beta<B1>(ADart)); }
-    template<int B1, int B2, int B3, int B4, int B5>
-    Dart_handle beta(Dart_handle ADart)
-    { return beta<B2, B3, B4, B5>(beta<B1>(ADart)); }
-    template<int B1, int B2, int B3, int B4, int B5, int B6>
-    Dart_handle beta(Dart_handle ADart)
-    { return beta<B2, B3, B4, B5, B6>(beta<B1>(ADart)); }
-    template<int B1, int B2, int B3, int B4, int B5, int B6,
-             int B7>
-    Dart_handle beta(Dart_handle ADart)
-    { return beta<B2, B3, B4, B5, B6, B7>(beta<B1>(ADart)); }
-    template<int B1, int B2, int B3, int B4, int B5, int B6,
-             int B7, int B8>
-    Dart_handle beta(Dart_handle ADart)
-    { return beta<B2, B3, B4, B5, B6, B7, B8>(beta<B1>(ADart)); }
-    template<int B1, int B2, int B3, int B4, int B5, int B6,
-             int B7, int B8, int B9>
-     Dart_handle beta(Dart_handle ADart)
-    { return beta<B2, B3, B4, B5, B6, B7, B8, B9>(beta<B1>(ADart)); }
-
-    Dart_const_handle beta(Dart_const_handle ADart, int B1) const
-    { return this->get_beta(ADart, B1); }
-    Dart_const_handle beta(Dart_const_handle ADart, int B1, int B2) const
-    { return beta(beta(ADart, B1), B2); }
-    Dart_const_handle beta(Dart_const_handle ADart, int B1, int B2, int B3) const
-    { return beta(beta(ADart, B1), B2, B3); }
-    Dart_const_handle beta(Dart_const_handle ADart, int B1, int B2, int B3,
-                           int B4) const
-    { return beta(beta(ADart, B1), B2, B3, B4); }
-    Dart_const_handle beta(Dart_const_handle ADart, int B1, int B2, int B3,
-                           int B4, int B5) const
-    { return beta(beta(ADart, B1), B2, B3, B4, B5); }
-    Dart_const_handle beta(Dart_const_handle ADart, int B1, int B2, int B3,
-                           int B4, int B5, int B6) const
-    { return beta(beta(ADart, B1), B2, B3, B4, B5, B6); }
-    Dart_const_handle beta(Dart_const_handle ADart, int B1, int B2, int B3,
-                           int B4, int B5, int B6, int B7) const
-    { return beta(beta(ADart, B1), B2, B3, B4, B5, B6, B7); }
-    Dart_const_handle beta(Dart_const_handle ADart, int B1, int B2, int B3,
-                           int B4, int B5, int B6, int B7, int B8) const
-    { return beta(beta(ADart, B1), B2, B3, B4, B5, B6, B7, B8); }
-    Dart_const_handle beta(Dart_const_handle ADart, int B1, int B2, int B3,
-                           int B4, int B5, int B6, int B7, int B8, int B9) const
-    { return beta(beta(ADart, B1), B2, B3, B4, B5, B6, B7, B8, B9); }
-
-    template<int B1>
-    Dart_const_handle beta(Dart_const_handle ADart) const
-    { return this->template get_beta<B1>(ADart); }
-    template<int B1, int B2>
-    Dart_const_handle beta(Dart_const_handle ADart) const
-    { return beta<B2>(beta<B1>(ADart)); }
-    template<int B1, int B2, int B3>
-    Dart_const_handle beta(Dart_const_handle ADart) const
-    { return beta<B2, B3>(beta<B1>(ADart)); }
-    template<int B1, int B2, int B3, int B4>
-    Dart_const_handle beta(Dart_const_handle ADart) const
-    { return beta<B2, B3, B4>(beta<B1>(ADart)); }
-    template<int B1, int B2, int B3, int B4, int B5>
-    Dart_const_handle beta(Dart_const_handle ADart) const
-    { return beta<B2, B3, B4, B5>(beta<B1>(ADart)); }
-    template<int B1, int B2, int B3, int B4, int B5, int B6>
-    Dart_const_handle beta(Dart_const_handle ADart) const
-    { return beta<B2, B3, B4, B5, B6>(beta<B1>(ADart)); }
-    template<int B1, int B2, int B3, int B4, int B5, int B6,
-              int B7>
-    Dart_const_handle beta(Dart_const_handle ADart) const
-    { return beta<B2, B3, B4, B5, B6, B7>(beta<B1>(ADart)); }
-    template<int B1, int B2, int B3, int B4, int B5, int B6,
-              int B7, int B8>
-    Dart_const_handle beta(Dart_const_handle ADart) const
-    { return beta<B2, B3, B4, B5, B6, B7, B8>(beta<B1>(ADart)); }
-    template<int B1, int B2, int B3, int B4, int B5, int B6,
-              int B7, int B8, int B9>
-    Dart_const_handle beta(Dart_const_handle ADart) const
-    { return beta<B2, B3, B4, B5, B6, B7, B8, B9>(beta<B1>(ADart)); }
-#endif
-
-    /** Count the number of used marks.
-     * @return the number of used marks.
-     */
-    size_type number_of_used_marks() const
-    { return mnb_used_marks; }
-
-    /** Test if a given mark is reserved.
-     *  @return true iff the mark is reserved (ie in used).
-     */
-    bool is_reserved(size_type amark) const
-    {
-      CGAL_assertion(amark<NB_MARKS);
-
-      return (mnb_times_reserved_marks[amark]!=0);
-    }
-
-    /**  Count the number of marked darts for a given mark.
-     * @param amark the mark index.
-     * @return the number of marked darts for amark.
-     */
-    size_type number_of_marked_darts(size_type amark) const
-    {
-      CGAL_assertion( is_reserved(amark) );
-
-      return mnb_marked_darts[amark];
-    }
-
-    /**  Count the number of unmarked darts for a given mark.
-     * @param amark the mark index.
-     * @return the number of unmarked darts for amark.
-     */
-    size_type number_of_unmarked_darts(size_type amark) const
-    {
-      CGAL_assertion( is_reserved(amark) );
-      return number_of_darts() - number_of_marked_darts(amark);
-    }
-
-    /** Test if all the darts are unmarked for a given mark.
-     * @param amark the mark index.
-     * @return true iff all the darts are unmarked for amark.
-     */
-    bool is_whole_map_unmarked(size_type amark) const
-    { return number_of_marked_darts(amark) == 0; }
-
-    /** Test if all the darts are marked for a given mark.
-     * @param amark the mark index.
-     * @return true iff all the darts are marked for amark.
-     */
-    bool is_whole_map_marked(size_type amark) const
-    {  return number_of_marked_darts(amark) == number_of_darts(); }
-
-    /** Reserve a new mark.
-     * Get a new free mark and return its index.
-     * All the darts are unmarked for this mark.
-     * @return the index of the new mark.
-     * @pre mnb_used_marks < NB_MARKS
-     */
-    size_type get_new_mark() const
-    {
-      if (mnb_used_marks == NB_MARKS)
-      {
-        std::cerr << "Not enough Boolean marks: "
-          "increase NB_MARKS in item class." << std::endl;
-        std::cerr << "  (exception launched)" << std::endl;
-        throw Exception_no_more_available_mark();
-      }
-
-      size_type m = mfree_marks_stack[mnb_used_marks];
-      mused_marks_stack[mnb_used_marks] = m;
-
-      mindex_marks[m] = mnb_used_marks;
-      mnb_times_reserved_marks[m]=1;
-
-      ++mnb_used_marks;
-      CGAL_assertion(is_whole_map_unmarked(m));
-
-      return m;
-    }
-
-    /** Increase the number of times a mark is reserved.
-     *  @param amark the mark to share.
-     */
-    void share_a_mark(size_type amark) const
-    {
-      CGAL_assertion( is_reserved(amark) );
-
-      ++mnb_times_reserved_marks[amark];
-    }
-
-    /** @return the number of times a mark is reserved.
-     *  @param amark the mark to share.
-     */
-    size_type get_number_of_times_mark_reserved(size_type amark) const
-    {
-      CGAL_assertion( amark<NB_MARKS );
-
-      return mnb_times_reserved_marks[amark];
-    }
-
-    /** Negate the mark of all the darts for a given mark.
-     * After this call, all the marked darts become unmarked and all the
-     * unmarked darts become marked (in constant time operation).
-     * @param amark the mark index
-     */
-    void negate_mark(size_type amark) const
-    {
-      CGAL_assertion( is_reserved(amark) );
-
-      mnb_marked_darts[amark] = number_of_darts() - mnb_marked_darts[amark];
-
-      mmask_marks.flip(amark);
-    }
-
-    /** Test if a given dart is marked for a given mark.
-     * @param adart the dart to test.
-     * @param amark the given mark.
-     * @return true iff adart is marked for the mark amark.
-     */
-    bool is_marked(Dart_const_handle adart, size_type amark) const
-    {
-      // CGAL_assertion( adart != null_dart_handle );
-      CGAL_assertion( is_reserved(amark) );
-
-      return get_dart_mark(adart, amark)!=mmask_marks[amark];
-    }
-
-    /** Set the mark of a given dart to a state (on or off).
-     * @param adart the dart.
-     * @param amark the given mark.
-     * @param astate the state of the mark (on or off).
-     */
-    void set_mark_to(Dart_const_handle adart, size_type amark,
-                     bool astate) const
-    {
-      CGAL_assertion( adart != null_dart_handle );
-      CGAL_assertion( is_reserved(amark) );
-
-      if (is_marked(adart, amark) != astate)
-      {
-        if (astate) ++mnb_marked_darts[amark];
-        else --mnb_marked_darts[amark];
-
-        flip_dart_mark(adart, amark);
-      }
-    }
-
-    /** Mark the given dart.
-     * @param adart the dart.
-     * @param amark the given mark.
-     */
-    void mark(Dart_const_handle adart, size_type amark) const
-    {
-      CGAL_assertion( adart != null_dart_handle );
-      CGAL_assertion( is_reserved(amark) );
-
-      if (is_marked(adart, amark)) return;
-
-      ++mnb_marked_darts[amark];
-      flip_dart_mark(adart, amark);
-    }
-
-    /** Unmark the given dart.
-     * @param adart the dart.
-     * @param amark the given mark.
-     */
-    void unmark(Dart_const_handle adart, size_type amark) const
-    {
-      CGAL_assertion( adart != null_dart_handle );
-      CGAL_assertion( is_reserved(amark) );
-
-      if (!is_marked(adart, amark)) return;
-
-      --mnb_marked_darts[amark];
-      flip_dart_mark(adart, amark);
-    }
-
-    /** Mark null_dart (used as a sentinel in iterators).
-     * As null dart does not belong to the set of darts, it is not counted
-     * as number of marked darts.
-     * @param amark the given mark.
-     */
-    void mark_null_dart(size_type amark) const
-    {
-      CGAL_assertion( is_reserved(amark) );
-
-#ifdef CGAL_CMAP_DEPRECATED
-      if ( null_dart_handle!=NULL ) // Pb with static null_dart_handle for windows
-#endif // CGAL_CMAP_DEPRECATED
-        set_dart_mark(null_dart_handle, amark, !mmask_marks[amark]);
-    }
-
-    /** Unmark null_dart.
-     * @param amark the given mark.
-     */
-    void unmark_null_dart(size_type amark) const
-    {
-      CGAL_assertion( is_reserved(amark) );
-
-#ifdef CGAL_CMAP_DEPRECATED
-      if ( null_dart_handle!=NULL ) // Pb with static null_dart_handle for windows
-#endif // CGAL_CMAP_DEPRECATED
-        set_dart_mark(null_dart_handle, amark, mmask_marks[amark]);
-    }
-
-    /** Unmark all the darts of the map for a given mark.
-     * If all the darts are marked or unmarked, this operation takes O(1)
-     * operations, otherwise it traverses all the darts of the map.
-     * @param amark the given mark.
-     */
-    void unmark_all(size_type amark) const
-    {
-      CGAL_assertion( is_reserved(amark) );
-
-      if ( is_whole_map_marked(amark) )
-      {
-        negate_mark(amark);
-      }
-      else if ( !is_whole_map_unmarked(amark) )
-      {
-        for ( typename Dart_range::const_iterator it(darts().begin()),
-               itend(darts().end()); it!=itend; ++it)
-          unmark(it, amark);
-      }
-      CGAL_assertion(is_whole_map_unmarked(amark));
-      unmark_null_dart(amark);
-    }
-
-    /** Free a given mark, previously calling unmark_all_darts.
-     * @param amark the given mark.
-     */
-    void free_mark(size_type amark) const
-    {
-      CGAL_assertion( is_reserved(amark) );
-
-      if ( mnb_times_reserved_marks[amark]>1 )
-      {
-        --mnb_times_reserved_marks[amark];
-        return;
-      }
-
-      unmark_all(amark);
-
-      // 1) We remove amark from the array mused_marks_stack by
-      //    replacing it with the last mark in this array.
-      mused_marks_stack[mindex_marks[amark]] =
-        mused_marks_stack[--mnb_used_marks];
-      mindex_marks[mused_marks_stack[mnb_used_marks]] =
-        mindex_marks[amark];
-
-      // 2) We add amark in the array mfree_marks_stack and update its index.
-      mfree_marks_stack[ mnb_used_marks ] = amark;
-      mindex_marks[amark] = mnb_used_marks;
-
-      mnb_times_reserved_marks[amark]=0;
-    }
-
-    /** Test if this map is without boundary for a given dimension.
-     * @param i the dimension.
-     * @return true iff all the darts are not i-free.
-     * @pre 1<=i<=n
-     */
-    bool is_without_boundary(unsigned int i) const
-    {
-      CGAL_assertion(1<=i && i<=dimension);
-      for ( typename Dart_const_range::const_iterator it(darts().begin()),
-             itend(darts().end()); it!=itend; ++it)
-        if (is_free(it, i)) return false;
-      return true;
-    }
-
-    /** Test if this map is without boundary for all the dimensions.
-     * @return true iff all the darts are non free.
-     */
-    bool is_without_boundary() const
-    {
-      for ( typename Dart_const_range::const_iterator it(darts().begin()),
-             itend(darts().end()); it!=itend; ++it)
-        for ( unsigned int i = 1; i<=dimension; ++i)
-          if (is_free(it, i)) return false;
-      return true;
-    }
-
-    /** Close the combinatorial map for a given dimension.
-     *  @param i the dimension to close
-     *  @return the number of new darts.
-     *  @pre 2<=i<=n (TODO case i==1)
-     *  @TODO move into Combinatorial_map_operations ?
-     */
-    template<unsigned int i>
-    unsigned int close()
-    {
-      CGAL_assertion( 2<=i && i<=dimension );
-      unsigned int res = 0;
-      Dart_handle d, d2;
-
-      for ( typename Dart_range::iterator it(darts().begin());
-           it!=darts().end(); ++it)
-      {
-        if ( this->template is_free<i>(it) )
-        {
-          d = create_dart();
-          ++res;
-
-          link_beta_for_involution<i>(it, d);
-
-          // Special cases for 0 and 1
-          if ( !this->template is_free<1>(it) && !this->template is_free<i>(beta<1>(it)) )
-            link_beta<1>(beta<1,i>(it),d);
-          if ( !this->template is_free<0>(it) && !this->template is_free<i>(beta<0>(it)) )
-            link_beta<0>(beta<0,i>(it),d);
-          // General case for 2...dimension
-          for ( unsigned int j=2; j<=dimension; ++j)
-          {
-            if ( j+1!=i && j!=i && j!=i+1 &&
-                 !is_free(it,j) && !this->template is_free<i>(beta(it, j)) )
-            {
-              basic_link_beta_for_involution(beta(it, j, i), d, j);
-            }
-          }
-
-          d2 = it;
-          while (d2 != null_dart_handle && !this->template is_free<i-1>(d2))
-          { d2 = beta<i-1, i>(d2); }
-          if (d2 != null_dart_handle)
-          {
-            if (i==2) basic_link_beta<1>(d2, d);
-            else basic_link_beta_for_involution<i-1>(d2, d);
-          }
-        }
-      }
-      return res;
-    }
-
-    /** Test if the map is valid.
-     * @return true iff the map is valid.
-     */
-    bool is_valid() const
-    {
-      bool valid = true;
-      unsigned int i = 0, j = 0;
-      std::vector<size_type> marks(dimension+1);
-      for ( i=0; i<=dimension; ++i)
-        marks[i] = INVALID_MARK;
-
-      Helper::template
-        Foreach_enabled_attributes<Reserve_mark_functor<Self> >::
-          run(this,&marks);
-
-      for ( typename Dart_range::const_iterator it(darts().begin()),
-             itend(darts().end()); it!=itend; ++it)
-      {
-        if ( !valid )
-        { // We continue the traversal to mark all the darts.
-          for ( i=0; i<=dimension; ++i)
-            if (marks[i]!=INVALID_MARK) mark(it,marks[i]);
-        }
-        else
-        {
-          // beta0 must be the inverse of beta1
-          if ((!is_free(it, 0) && beta(it, 0, 1)!=it) ||
-              (!is_free(it, 1) && beta(it, 1, 0)!=it ))
-          {
-            std::cerr << "Map not valid: beta(0) "
-              "is not the inverse of beta(1) for "
-                      <<&(*it) << std::endl;
-            valid = false;
-          }
-
-          // Each beta(i>=2) must be an involution
-          for ( i = 2; i <= dimension; ++i)
-            if (!is_free(it, i) && beta(it, i, i)!=it)
-            {
-              std::cerr << "Map not valid: beta(" << i
-                        << ") is not an involution for "
-                        <<&(*it) << std::endl;
-              valid = false;
-            }
-
-          // beta1 o betai and beta0 o betai (i>=3) must be involutions
-          if (!is_free(it, 0))
-          {
-            for ( i = 3; i <= dimension; ++i)
-              if ((is_free(it, i) != is_free(beta(it, 0), i)) ||
-                  (!is_free(it, i) && beta(it, 0, i)!=beta(it, i, 1)))
-              {
-                std::cerr << "Map not valid: beta(0) o beta(" << i
-                          << ") is not an involution for "
-                          <<&(*it) << std::endl;
-                valid = false;
-              }
-          }
-          if (!is_free(it, 1))
-          {
-            for ( i = 3; i <= dimension; ++i)
-              if ((is_free(it, i) != is_free(beta(it, 1), i)) ||
-                  (!is_free(it, i) && beta(it, 1, i)!=beta(it, i, 0)))
-              {
-                std::cerr << "Map not valid: beta(1) o beta(" << i
-                          << ") is not an involution for "
-                          <<&(*it)<< std::endl;
-                valid = false;
-              }
-          }
-
-          // beta(i>=2) o beta(j>=i+2) must be an involution
-          for ( i = 2; i <= dimension; ++i)
-          {
-            if (!is_free(it, i))
-            {
-              for ( j = i + 2; j <= dimension; ++j)
-                if ((is_free(it, j)!=is_free(beta(it, i), j)) ||
-                    (!is_free(it, j) && beta(it, i, j)!=beta(it, j, i)))
-                {
-                  std::cerr << "Map not valid: beta(" << i
-                            << ") o beta(" << j
-                            << ") is not an involution for "
-                            << &(*it)<< std::endl;
-                  valid = false;
-                }
-            }
-          }
-          Helper::template Foreach_enabled_attributes
-            <internal::Test_is_valid_attribute_functor<Self> >::
-            run(this,it,&marks,&valid);
-        }
-      }
-      for ( i=0; i<=dimension; ++i)
-        if ( marks[i]!=INVALID_MARK )
-        {
-          CGAL_assertion( is_whole_map_marked(marks[i]) );
-          free_mark(marks[i]);
-        }
-
-      return valid;
-    }
-
-    /// correct invalid attributes in the map
-    void correct_invalid_attributes()
-    {
-      std::vector<size_type> marks(dimension+1);
-      for ( unsigned int i=0; i<=dimension; ++i)
-        marks[i] = INVALID_MARK;
-
-      Helper::template
-        Foreach_enabled_attributes<Reserve_mark_functor<Self> >::
-          run(this,&marks);
-
-      for ( typename Dart_range::iterator it(darts().begin()),
-             itend(darts().end()); it!=itend; ++it)
-      {
-        Helper::template Foreach_enabled_attributes
-          <internal::Correct_invalid_attributes_functor<Self> >::
-          run(this,it,&marks);
-      }
-
-      for ( unsigned int i=0; i<=dimension; ++i)
-        if ( marks[i]!=INVALID_MARK )
-        {
-          CGAL_assertion( is_whole_map_marked(marks[i]) );
-          free_mark(marks[i]);
-        }
-    }
-
-    /// @return the number of darts.
-    size_type number_of_darts() const
-    { return mdarts.size(); }
-
-    /// @return an estimation of the bytes used by the combinatorial map.
-    size_type bytes() const
-    {
-      return mdarts.capacity() * sizeof(Dart) +
-        internal::Count_bytes_all_attributes_functor<Self>::run(*this);
-    }
-
-    /** Write the content of the map: each dart and each beta links.
-     * @param os the ostream.
-     * @return the ostream.
-     */
-    std::ostream& display_darts(std::ostream & os, bool attribs=false) const
-    {
-      unsigned int nb = 0;
-      for ( typename Dart_range::const_iterator it=darts().begin();
-           it!=darts().end(); ++it)
-      {
-        os << " dart " << &(*it) << "; beta[i]=";
-        for ( unsigned int i=0; i<=dimension; ++i)
-        {
-          os << &(*it->beta(i)) << ",\t";
-          if (it->is_free(i)) os << "\t";
-        }
-        if ( attribs )
-        {
-          Helper::template Foreach_enabled_attributes
-              <Display_attribute_functor<Self> >::run(this, it);
-        }
-        os << std::endl;
-        ++nb;
-      }
-      os << "Number of darts: " << nb <<"(sizeofdarts="
-         <<number_of_darts()<<")" << std::endl;
-      return os;
-    }
-
-    /** Write the content of each given orbit of the map.
-     * @param aos the ostream.
-     * @return the ostream.
-     */
-    template < class Ite >
-    std::ostream& display_orbits(std::ostream & aos) const
-    {
-      CGAL_static_assertion( (boost::is_same<typename Ite::Basic_iterator,
-                              Tag_true>::value) );
-      unsigned int nb = 0;
-      size_type amark = get_new_mark();
-      for ( typename Dart_range::const_iterator it1(darts().begin()),
-             itend(darts().end()); it1!=itend; ++it1)
-      {
-        if ( !is_marked(it1, amark) )
-        {
-          ++nb;
-          for ( Ite it2(*this, it1, amark); it2.cont(); ++it2 )
-          {
-            aos << &(**it2) << " - " << std::flush;
-            mark(*it2, amark);
-          }
-          aos << std::endl;
-        }
-      }
-      CGAL_assertion( is_whole_map_marked(amark) );
-      free_mark(amark);
-      aos << "Number of orbits: " << nb << std::endl;
-      return aos;
-    }
-
-    /** Write the content of each i-cell of the map.
-     * @param aos the ostream.
-     * @return the ostream.
-     */
-    template < unsigned int i >
-    std::ostream& display_cells(std::ostream & aos) const
-    {
-      return display_orbits<CMap_dart_const_iterator_basic_of_cell<Self,i> >
-        (aos);
-    }
-
-    /** Write the number of darts and cells of the map into a given ostream.
-     * @param os the ostream.
-     * @return the ostream.
-     */
-    std::ostream& display_characteristics(std::ostream & os) const
-    {
-      std::vector<unsigned int> cells(dimension+2);
-      for ( unsigned int i=0; i<=dimension+1; ++i)
-      { cells[i]=i; }
-
-      std::vector<unsigned int> res = count_cells(cells);
-
-      os << "#Darts=" << number_of_darts();
-      for ( unsigned int i=0; i<=dimension; ++i)
-        os<<", #"<<i<<"-cells="<<res[i];
-      os<<", #ccs="<<res[dimension+1];
-
-      return os;
-    }
-
-    /// Create a new attribute.
-    /// @return a handle on the new attribute.
-#ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
-    template<unsigned int i, typename ...Args>
-    typename Attribute_handle<i>::type create_attribute(const Args&... args)
-    {
-      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
-                  "create_attribute<i> but i-attributes are disabled");
-     typename Attribute_handle<i>::type res=
-       CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
-        (mattribute_containers).emplace(args...);
-     // Reinitialize the ref counting of the new attribute. This is normally
-     // not required except if create_attribute is used as "copy contructor".
-     this->template get_attribute<i>(res).mrefcounting = 0;
-     return res;
-    }
-#else
-    template<unsigned int i>
-    typename Attribute_handle<i>::type
-    create_attribute()
-    {
-      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
-                  "create_attribute<i> but i-attributes are disabled");
-      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
-        (mattribute_containers).emplace();
-    }
-    template<unsigned int i, typename T1>
-    typename Attribute_handle<i>::type
-    create_attribute(const T1 &t1)
-    {
-      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
-                  "create_attribute<i> but i-attributes are disabled");
-     typename Attribute_handle<i>::type res=
-       CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
-        (mattribute_containers).emplace(t1);
-     this->template get_attribute<i>(res).mrefcounting = 0;
-     return res;
-    }
-    template<unsigned int i, typename T1, typename T2>
-    typename Attribute_handle<i>::type
-    create_attribute(const T1 &t1, const T2 &t2)
-    {
-      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
-                  "create_attribute<i> but i-attributes are disabled");
-      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
-        (mattribute_containers).emplace(t1, t2);
-    }
-    template<unsigned int i, typename T1, typename T2, typename T3>
-    typename Attribute_handle<i>::type
-    create_attribute(const T1 &t1, const T2 &t2, const T3 &t3)
-    {
-      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
-                  "create_attribute<i> but i-attributes are disabled");
-      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
-        (mattribute_containers).emplace(t1, t2, t3);
-    }
-    template<unsigned int i, typename T1, typename T2, typename T3, typename T4>
-    typename Attribute_handle<i>::type
-    create_attribute(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4)
-    {
-      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
-                  "create_attribute<i> but i-attributes are disabled");
-      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
-        (mattribute_containers).emplace(t1, t2, t3, t4);
-    }
-    template<unsigned int i, typename T1, typename T2, typename T3, typename T4,
-             typename T5>
-    typename Attribute_handle<i>::type
-    create_attribute(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4,
-                     const T5 &t5)
-    {
-      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
-                  "create_attribute<i> but i-attributes are disabled");
-      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
-        (mattribute_containers).emplace(t1, t2, t3, t4, t5);
-    }
-    template<unsigned int i, typename T1, typename T2, typename T3, typename T4,
-             typename T5, typename T6>
-    typename Attribute_handle<i>::type
-    create_attribute(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4,
-                     const T5 &t5, const T6 &t6)
-    {
-      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
-                  "create_attribute<i> but i-attributes are disabled");
-      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
-        (mattribute_containers).emplace(t1, t2, t3, t4, t5, t6);
-    }
-    template<unsigned int i, typename T1, typename T2, typename T3, typename T4,
-             typename T5, typename T6, typename T7>
-    typename Attribute_handle<i>::type
-    create_attribute(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4,
-                     const T5 &t5, const T6 &t6, const T7 &t7)
-    {
-      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
-                  "create_attribute<i> but i-attributes are disabled");
-      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
-        (mattribute_containers).emplace(t1, t2, t3, t4, t5, t6, t7);
-    }
-    template<unsigned int i, typename T1, typename T2, typename T3, typename T4,
-             typename T5, typename T6, typename T7, typename T8>
-    typename Attribute_handle<i>::type
-    create_attribute(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4,
-                     const T5 &t5, const T6 &t6, const T7 &t7, const T8 &t8)
-    {
-      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
-                  "create_attribute<i> but i-attributes are disabled");
-      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
-        (mattribute_containers).emplace(t1, t2, t3, t4, t5, t6, t7, t8);
-    }
-    template<unsigned int i, typename T1, typename T2, typename T3, typename T4,
-             typename T5, typename T6, typename T7, typename T8, typename T9>
-    typename Attribute_handle<i>::type
-    create_attribute(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4,
-                     const T5 &t5, const T6 &t6, const T7 &t7, const T8 &t8,
-                     const T9 &t9)
-    {
-      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
-                  "create_attribute<i> but i-attributes are disabled");
-      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
-        (mattribute_containers).emplace(t1, t2, t3, t4, t5, t6, t7, t8, t9);
-    }
-#endif
-
-    /// Erase an attribute.
-    /// @param h a handle to the attribute to erase.
-    template<unsigned int i>
-    void erase_attribute(typename Attribute_handle<i>::type h)
-    {
-      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
-                  "erase_attribute<i> but i-attributes are disabled");
-      CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
-        (mattribute_containers).erase(h);
-    }
-
-    /// @return true if ah points to a used i-attribute (i.e. valid).
-    template<unsigned int i>
-    bool is_attribute_used(typename Attribute_const_handle< i >::type ah) const
-    {
-      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
-                                "is_attribute_used<i> but i-attributes are disabled");
-      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
-        (mattribute_containers).is_used(ah);
-    }
-
-    /// @return the number of attributes.
-    template <unsigned int i>
-    size_type number_of_attributes() const
-    {
-      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
-                  "number_of_attributes<i> but i-attributes are disabled");
-      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
-        (mattribute_containers).size();
-    }
-
-    /** Set the i th attribute of all the darts of a given i-cell.
-     * @param adart a dart of the i-cell.
-     * @param ah the vertex to set.
-     */
-    template<unsigned int i>
-    void set_attribute(Dart_handle dh,
-                       typename Attribute_handle<i>::type ah)
-    {
-      CGAL_static_assertion(i<=dimension);
-      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
-                  "set_attribute<i> but i-attributes are disabled");
-      for ( typename Dart_of_cell_range<i>::iterator it(*this, dh);
-            it.cont(); ++it)
-      {
-        this->template set_dart_attribute<i>(it, ah);
-      }
-    }
-
-    /// @return a Attributes_range<i> (range through all the
-    /// attributes<i> of the map).
-    template<unsigned int i>
-    typename Attribute_range<i>::type & attributes()
-    {
-      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
-                                "attributes<i> but i-attributes are disabled");
-      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
-        (mattribute_containers);
-    }
-
-    template<unsigned int i>
-    typename Attribute_const_range<i>::type & attributes() const
-    {
-      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
-                                "attributes<i> but i-attributes are disabled");
-      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
-        (mattribute_containers);
-    }
-
-    // Get the ith dynamic onsplit functor (by reference so that we can
-    // modify it directly).
-    template<int i>
-    boost::function<void(typename Attribute_type<i>::type&,
-                         typename Attribute_type<i>::type&)>&
-    onsplit_functor()
-    {
-      CGAL_static_assertion_msg
-          (Helper::template Dimension_index<i>::value>=0,
-           "onsplit_functor<i> but "
-           "i-attributes are disabled");
-
-      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
-        (m_onsplit_functors);
-    }
-
-    // Get the ith dynamic onsplit functor (by reference so that we can
-    // modify it directly).
-    template<int i>
-    const boost::function<void(typename Attribute_type<i>::type&,
-                               typename Attribute_type<i>::type&)>&
-    onsplit_functor() const
-    {
-      CGAL_static_assertion_msg
-          (Helper::template Dimension_index<i>::value>=0,
-           "onsplit_functor<i> but "
-           "i-attributes are disabled");
-
-      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
-        (m_onsplit_functors);
-    }
-
-    // Get the ith dynamic onmerge functor (by reference so that we can
-    // modify it directly).
-    template<int i>
-    boost::function<void(typename Attribute_type<i>::type&,
-                               typename Attribute_type<i>::type&)>&
-    onmerge_functor()
-    {
-      CGAL_static_assertion_msg
-          (Helper::template Dimension_index<i>::value>=0,
-           "onsplit_functor<i> but "
-           "i-attributes are disabled");
-
-      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
-        (m_onmerge_functors);
-    }
-    // Get the ith dynamic onmerge functor (by reference so that we can
-    // modify it directly).
-    template<int i>
-    const boost::function<void(typename Attribute_type<i>::type&,
-                               typename Attribute_type<i>::type&)>&
-    onmerge_functor() const
-    {
-      CGAL_static_assertion_msg
-          (Helper::template Dimension_index<i>::value>=0,
-           "onsplit_functor<i> but "
-           "i-attributes are disabled");
-
-      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
-        (m_onmerge_functors);
-    }
-
-    /** Double link a dart with beta 0 to a second dart.
-     * \em adart1 is 0-linked to \em adart2 and \em adart2 is 1-linked
-     * with \em adart1. Attributes are not updated, thus we can obtain
-     * a non-valid map with darts belonging to a same orbit and having
-     * different attributes.
-     * @param adart1 a first dart.
-     * @param adart2 a second dart.
-     */
-    void basic_link_beta_0(Dart_handle adart1, Dart_handle adart2)
-    {
-      // Intel warning #1017: name following "template" must be a template
-      this->template dart_link_beta<0>(adart1, adart2);
-      this->template dart_link_beta<1>(adart2, adart1);
-    }
-
-    /** Double link a dart with beta 0 to a second dart.
-     * \em adart1 is 0-linked to \em adart2 and \em adart2 is 1-linked
-     * with \em adart1. Attributes are not updated, thus we can obtain
-     * a non-valid map with darts belonging to a same orbit and having
-     * different attributes.
-     * @param adart1 a first dart.
-     * @param adart2 a second dart.
-     */
-    void basic_link_beta_1(Dart_handle adart1, Dart_handle adart2)
-    {
-      this->template dart_link_beta<1>(adart1, adart2);
-      this->template dart_link_beta<0>(adart2, adart1);
-    }
-
-    /** Double link a dart with beta i to a second dart, when i>=2.
-     * \em adart1 is i-linked to \em adart2 and \em adart2 is i-linked
-     * with \em adart1. Attributes are not updated, thus we can obtain
-     * a non-valid map with darts belonging to a same orbit and having
-     * different attributes.
-     * @param adart1 a first dart.
-     * @param adart2 a second dart.
-     * @param i the dimension of the beta.
-     */
-    template<unsigned int i>
-    void basic_link_beta_for_involution(Dart_handle adart1, Dart_handle adart2)
-    {
-      CGAL_assertion( i>=2 && i<=dimension );
-      this->template dart_link_beta<i>(adart1, adart2);
-      this->template dart_link_beta<i>(adart2, adart1);
-    }
-    void basic_link_beta_for_involution(Dart_handle adart1, Dart_handle adart2,
-                                        unsigned int i)
-    {
-      CGAL_assertion( i>=2 && i<=dimension );
-      CGAL_assertion( i>=2 && i<=dimension );
-      dart_link_beta(adart1, adart2, i);
-      dart_link_beta(adart2, adart1, i);
-    }
-
-    /** Double link a dart with betai to a second dart.
-     * \em adart1 is i-linked to \em adart2 and \em adart2 is i^-1-linked
-     * with \em adart1. Attributes are not updated, thus we can obtain
-     * a non-valid map with darts belonging to a same orbit and having
-     * different attributes.
-     * @param adart1 a first dart.
-     * @param adart2 a second dart.
-     */
-    template<unsigned int i>
-    void basic_link_beta(Dart_handle adart1, Dart_handle adart2)
-    {
-      if ( i==0 ) basic_link_beta_0(adart1, adart2);
-      else if ( i==1 ) basic_link_beta_1(adart1, adart2);
-      else basic_link_beta_for_involution<i>(adart1, adart2);
-    }
-    void basic_link_beta(Dart_handle adart1, Dart_handle adart2,
-                         unsigned int i)
-    {
-      if ( i==0 ) basic_link_beta_0(adart1, adart2);
-      else if ( i==1 ) basic_link_beta_1(adart1, adart2);
-      else basic_link_beta_for_involution(adart1, adart2, i);
-    }
-
-    /** Double link two darts, and update the NULL attributes.
-     * \em adart1 is 0-linked to \em adart2 and \em adart2 is 1-linked
-     * with \em adart1. The NULL attributes of \em adart1 are updated to
-     * non NULL attributes associated to \em adart2, and vice-versa.
-     * If both darts have an attribute, the attribute of adart1 is
-     * associated to adart2.
-     * We can obtain a non-valid map with darts belonging to a same cell
-     * and having different attributes.
-     * @param adart1 a first dart.
-     * @param adart2 a second dart.
-     */
-    void link_beta_0(Dart_handle adart1, Dart_handle adart2)
-    {
-      Helper::template Foreach_enabled_attributes_except
-        <internal::Group_attribute_functor_of_dart<Self, 0>, 1>::
-        run(this,adart1,adart2);
-      this->template dart_link_beta<0>(adart1, adart2);
-      this->template dart_link_beta<1>(adart2, adart1);
-    }
-
-    /** Double link two darts, and update the NULL attributes.
-     * \em adart1 is 1-linked to \em adart2 and \em adart2 is 0-linked
-     * with \em adart1. The NULL attributes of \em adart1 are updated to
-     * non NULL attributes associated to \em adart2, and vice-versa.
-     * If both darts have an attribute, the attribute of adart1 is
-     * associated to adart2.
-     * We can obtain a non-valid map with darts belonging to a same cell
-     * and having different attributes.
-     * @param adart1 a first dart.
-     * @param adart2 a second dart.
-     */
-    void link_beta_1(Dart_handle adart1, Dart_handle adart2)
-    {
-      Helper::template Foreach_enabled_attributes_except
-        <internal::Group_attribute_functor_of_dart<Self, 1>, 1>::
-        run(this,adart1,adart2);
-      this->template dart_link_beta<1>(adart1, adart2);
-      this->template dart_link_beta<0>(adart2, adart1);
-    }
-
-    /** Double link two darts, and update the NULL attributes.
-     * \em adart1 is i-linked to \em adart2 and \em adart2 is i^-1-linked
-     * with \em adart1. The NULL attributes of \em adart1 are updated to
-     * non NULL attributes associated to \em adart2, and vice-versa.
-     * If both darts have an attribute, the attribute of adart1 is
-     * associated to adart2.
-     * We can obtain a non-valid map with darts belonging to a same cell
-     * and having different attributes.
-     * @param adart1 a first dart.
-     * @param adart2 a second dart.
-     * @param i the dimension of the beta.
-     * @pre 2<=i<=dimension.
-     */
-    template<unsigned int i>
-    void link_beta_for_involution(Dart_handle adart1, Dart_handle adart2)
-    {
-      CGAL_assertion( 2<=i && i<=dimension );
-      Helper::template Foreach_enabled_attributes_except
-        <internal::Group_attribute_functor_of_dart<Self, i>, i>::
-        run(this,adart1,adart2);
-      this->template dart_link_beta<i>(adart1, adart2);
-      this->template dart_link_beta<i>(adart2, adart1);
-    }
-
-    /** Double link two darts, and update the NULL attributes.
-     * \em adart1 is i-linked to \em adart2 and \em adart2 is i^-1-linked
-     * with \em adart1. The NULL attributes of \em adart1 are updated to
-     * non NULL attributes associated to \em adart2, and vice-versa.
-     * If both darts have an attribute, the attribute of adart1 is
-     * associated to adart2.
-     * We can obtain a non-valid map with darts belonging to a same cell
-     * and having different attributes.
-     * @param adart1 a first dart.
-     * @param adart2 a second dart.
-     */
-    template<unsigned int i>
-    void link_beta(Dart_handle adart1, Dart_handle adart2)
-    {
-      if ( are_attributes_automatically_managed() )
-      {
-        if ( i==0 ) link_beta_0(adart1, adart2);
-        else if ( i==1 ) link_beta_1(adart1, adart2);
-        else link_beta_for_involution<i>(adart1, adart2);
-      }
-      else basic_link_beta<i>(adart1, adart2);
-    }
-
-    /** Double link a dart with betai to a second dart.
-     * \em adart1 is i-linked to \em adart2 and \em adart2 is i^-1-linked
-     * with \em adart1. The NULL attributes of \em adart1 are updated to
-     * non NULL attributes associated to \em adart2, and vice-versa,
-     * if both darts have an attribute, the attribute of adart1 is
-     * associated to adart2 (only if update_attributes==true).
-     * @param adart1 a first dart.
-     * @param adart2 a second dart.
-     * @param update_attributes a boolean to update the enabled attributes.
-     *         (deprecated, now we use are_attributes_automatically_managed())
-     */
-    template<unsigned int i>
-    void link_beta(Dart_handle adart1, Dart_handle adart2,
-                   bool update_attributes)
-    {
-      if ( update_attributes ) link_beta<i>(adart1, adart2);
-      else basic_link_beta<i>(adart1, adart2);
-    }
-
-    /** Double unlink a dart with beta 0.
-     * beta0(\em adart) is 1-unlinked and \em adart is 0-unlinked.
-     * The attributes are not updated, thus we can obtain a non-valid map
-     * with darts belonging to different orbits and having the same
-     * attributes.
-     * @param adart a dart.
-     */
-    void unlink_beta_0(Dart_handle adart)
-    {
-      CGAL_assertion(!this->template is_free<0>(adart));
-      this->template dart_unlink_beta<1>(beta<0>(adart));
-      this->template dart_unlink_beta<0>(adart);
-    }
-
-    /** Double unlink a dart with beta 1.
-     * beta1(\em adart) is 0-unlinked and \em adart is 1-unlinked.
-     * The attributes are not updated, thus we can obtain a non-valid map
-     * with darts belonging to different orbits and having the same
-     * attributes.
-     * @param adart a dart.
-     */
-    void unlink_beta_1(Dart_handle adart)
-    {
-      CGAL_assertion(!this->template is_free<1>(adart));
-      this->template dart_unlink_beta<0>(beta<1>(adart));
-      this->template dart_unlink_beta<1>(adart);
-    }
-
-    /** Double unlink a dart with beta i, for i>=2.
-     * betai(\em adart) is i-unlinked and \em adart is i-unlinked.
-     * The attributes are not updated, thus we can obtain a non-valid map
-     * with darts belonging to different orbits and having the same
-     * attributes.
-     * @param adart a dart.
-     * @param i the dimension of the beta.
-     */
-    template<unsigned int i>
-    void unlink_beta_for_involution(Dart_handle adart)
-    {
-      CGAL_assertion(!this->template is_free<i>(adart));
-      CGAL_assertion(2<=i && i<=dimension);
-      this->template dart_unlink_beta<i>(beta<i>(adart));
-      this->template dart_unlink_beta<i>(adart);
-    }
-    void unlink_beta_for_involution(Dart_handle adart, unsigned int i)
-    {
-      CGAL_assertion(!is_free(adart,i));
-      CGAL_assertion(2<=i && i<=dimension);
-      dart_unlink_beta(beta(adart, i), i);
-      dart_unlink_beta(adart, i);
-    }
-
-    /** Double unlink a dart with beta i.
-     * betai(\em adart) is i-1-unlinked and \em adart is i-unlinked.
-     * The attributes are not updated, thus we can obtain a non-valid map
-     * with darts belonging to different orbits and having the same
-     * attributes.
-     * @param adart a dart.
-     * @param i the dimension of the beta.
-     */
-    template<unsigned int i>
-    void unlink_beta(Dart_handle adart)
-    {
-      if ( i==0 ) unlink_beta_0(adart);
-      else if ( i==1 ) unlink_beta_1(adart);
-      else unlink_beta_for_involution<i>(adart);
-    }
-    void unlink_beta(Dart_handle adart, unsigned int i)
-    {
-      if ( i==0 ) unlink_beta_0(adart);
-      else if ( i==1 ) unlink_beta_1(adart);
-      else unlink_beta_for_involution(adart, i);
-    }
-
-    /** Test if it is possible to sew by betai the two given darts
-     * @param adart1 the first dart.
-     * @param adart2 the second dart.
-     * @return true iff \em adart1 can be i-sewn with \em adart2.
-     */
-    template<unsigned int i>
-    bool is_sewable(Dart_const_handle adart1, Dart_const_handle adart2) const
-    {
-      return CGAL::internal::
-          Is_sewable_functor<Self, i>::run(this, adart1, adart2);
-    }
-
-    /** Topological sew by beta1 the two given darts plus all the required darts
-     * to satisfy the combinatorial map validity: but do not update attributes
-     * thus the map can be non valid.
-     * @param adart1 the first dart.
-     * @param adart2 the second dart.
-     * @pre is_sewable<1>(adart1, adart2).
-     */
-    void topo_sew_1(Dart_handle adart1, Dart_handle adart2)
-    {
-      CGAL_assertion( (is_sewable<1>(adart1,adart2)) );
-
-      if ( adart1==adart2 )
-      {
-        for ( CGAL::CMap_dart_iterator_of_involution<Self,1> it(*this, adart1);
-              it.cont(); ++it )
-        {
-          basic_link_beta_1(it, it);
-        }
-      }
-      else
-      {
-        size_type m = get_new_mark();
-        std::deque<Dart_handle> dartv;
-        for ( CGAL::CMap_dart_iterator_basic_of_cell<Self,0>
-              it(*this, adart1, m); it.cont(); ++it )
-        {
-          mark(it,m);
-          dartv.push_back(it);
-        }
-
-        CGAL::CMap_dart_iterator_of_involution<Self,1>     I1(*this, adart1);
-        CGAL::CMap_dart_iterator_of_involution_inv<Self,1> I2(*this, adart2);
-        for ( ; I1.cont(); ++I1, ++I2 )
-        {
-          if ( is_marked(I1,m) ) basic_link_beta_1(I1, I2);
-          else                   basic_link_beta_0(I1, I2);
-        }
-
-        for ( typename std::deque<Dart_handle>::iterator it=dartv.begin();
-              it!=dartv.end(); ++it)
-        { unmark(*it,m); }
-        CGAL_assertion( is_whole_map_unmarked(m) );
-        free_mark(m);
-      }
-    }
-
-    /** Topological sew by beta0 two given darts plus all the required darts
-     * to satisfy the combinatorial map validity: but do not update attributes
-     * thus the map can be non valid.
-     * @param adart1 the first dart.
-     * @param adart2 the second dart.
-     * @pre is_sewable<0>(adart1, adart2).
-     */
-    void topo_sew_0(Dart_handle adart1, Dart_handle adart2)
-    { topo_sew_1(adart2, adart1); }
-
-    /** Topological sew by betai two given darts plus all the required darts
-     * to satisfy the combinatorial map validity: but do not update attributes
-     * thus the map can be non valid.
-     * @param adart1 the first dart.
-     * @param adart2 the second dart.
-     * @pre 2<=i<=dimension.
-     * @pre is_sewable<i>(adart1, adart2).
-     */
-    template<unsigned int i>
-    void topo_sew_for_involution(Dart_handle adart1, Dart_handle adart2)
-    {
-      CGAL_assertion( 2<=i && i<=Self::dimension );
-      CGAL_assertion( (is_sewable<i>(adart1,adart2)) );
-
-      CGAL::CMap_dart_iterator_of_involution<Self,i>     I1(*this, adart1);
-      CGAL::CMap_dart_iterator_of_involution_inv<Self,i> I2(*this, adart2);
-      for ( ; I1.cont();  ++I1, ++I2 )
-      {
-        basic_link_beta_for_involution<i>(I1, I2);
-      }
-    }
-
-    /** Topological sew by betai two given darts plus all the required darts
-     * to satisfy the combinatorial map validity: but do not update attributes
-     * thus the map can be non valid.
-     * @param adart1 the first dart.
-     * @param adart2 the second dart.
-     * @pre is_sewable<i>(adart1, adart2).
-     */
-    template<unsigned int i>
-    void topo_sew(Dart_handle adart1, Dart_handle adart2)
-    {
-      if ( i==0 ) topo_sew_1(adart2, adart1);
-      else if ( i==1 ) topo_sew_1(adart1, adart2);
-      else topo_sew_for_involution<i>(adart1, adart2);
-    }
-
-    /** Sew by beta0 the two given darts plus all the required darts
-     * to satisfy the combinatorial map validity, and updates enabled
-     * attributes when necessary so that the final map is valid.
-     * @param adart1 the first dart.
-     * @param adart2 the second dart.
-     * @pre is_sewable<0>(adart1, adart2).
-     * @post is_valid()
-     */
-    void sew_0(Dart_handle adart1, Dart_handle adart2)
-    {
-      CGAL_assertion( (is_sewable<0>(adart1,adart2)) );
-
-      if ( adart1==adart2 )
-      {
-        for ( CGAL::CMap_dart_iterator_of_involution<Self,1> it(*this, adart1);
-              it.cont(); ++it )
-        {
-          basic_link_beta_1(it, it);
-        }
-        return;
-      }
-
-      size_type m = get_new_mark();
-      std::deque<Dart_handle> dartv;
-      for ( CGAL::CMap_dart_iterator_basic_of_cell<Self, 0>
-            it(*this, adart1, m); it.cont(); ++it )
-      {
-        mark(it,m);
-        dartv.push_back(it);
-      }
-
-      size_type mark = get_new_mark();
-
-      CGAL::CMap_dart_iterator_basic_of_involution<Self, 1>
-          I1(*this, adart1, mark);
-      CGAL::CMap_dart_iterator_basic_of_involution_inv<Self, 1>
-          I2(*this, adart2, mark);
-
-      // This first loop do not modify the map, but only the attributes
-      // (by calling when required the onmerge functors).
-      for ( ; I1.cont(); ++I1, ++I2 )
-      {
-        if ( is_marked(I1,m) )
-          Helper::template Foreach_enabled_attributes_except
-              <CGAL::internal::Group_attribute_functor<Self, 0>, 1>::
-              run(this, I1, I2);
-        else
-          Helper::template Foreach_enabled_attributes_except
-              <CGAL::internal::Group_attribute_functor<Self, 1>, 1>::
-              run(this, I1, I2);
-      }
-
-      // Now we update the beta links.
-      negate_mark( mark );
-      for ( I1.rewind(), I2.rewind(); I1.cont(); ++I1, ++I2 )
-      {
-        if ( is_marked(I1,m) ) basic_link_beta_0(I1, I2);
-        else                   basic_link_beta_1(I1, I2);
-      }
-
-      for ( typename std::deque<Dart_handle>::iterator it=dartv.begin();
-            it!=dartv.end(); ++it )
-      { unmark(*it,m); }
-      CGAL_assertion( is_whole_map_unmarked(m) );
-      free_mark(m);
-
-      negate_mark( mark );
-      CGAL_assertion( is_whole_map_unmarked(mark) );
-      free_mark(mark);
-    }
-
-    /** Sew by beta1 the two given darts plus all the required darts
-     * to satisfy the combinatorial map validity, and updates enabled
-     * attributes when necessary so that the final map is valid.
-     * @param adart1 the first dart.
-     * @param adart2 the second dart.
-     * @pre is_sewable<1>(adart1, adart2).
-     * @post is_valid()
-     */
-    void sew_1(Dart_handle adart1, Dart_handle adart2)
-    {
-      CGAL_assertion( (is_sewable<1>(adart1,adart2)) );
-
-      if ( adart1==adart2 )
-      {
-        for ( CGAL::CMap_dart_iterator_of_involution<Self, 1>
-              it(*this, adart1); it.cont(); ++it )
-        {
-          basic_link_beta_1(it, it);
-        }
-        return;
-      }
-
-      size_type m = get_new_mark();
-      std::deque<Dart_handle> dartv;
-      for ( CGAL::CMap_dart_iterator_basic_of_cell<Self, 0>
-            it(*this, adart1, m); it.cont(); ++it )
-      {
-        mark(it,m);
-        dartv.push_back(it);
-      }
-
-      size_type mark = get_new_mark();
-
-      CGAL::CMap_dart_iterator_basic_of_involution<Self, 1>
-          I1(*this, adart1, mark);
-      CGAL::CMap_dart_iterator_basic_of_involution_inv<Self, 1>
-          I2(*this, adart2, mark);
-
-      // This first loop do not modify the map, but only the attributes
-      // (by calling when required the onmerge functors).
-      for ( ; I1.cont(); ++I1, ++I2 )
-      {
-        CGAL_assertion( I2.cont() );
-        if ( is_marked(I1,m) )
-          Helper::template Foreach_enabled_attributes_except
-              <internal::Group_attribute_functor<Self, 1>, 1>::
-              run(this, I1, I2);
-        else
-          Helper::template Foreach_enabled_attributes_except
-              <internal::Group_attribute_functor<Self, 0>, 1>::
-              run(this, I1, I2);
-      }
-
-      // Now we update the beta links.
-      negate_mark( mark );
-      for ( I1.rewind(), I2.rewind(); I1.cont(); ++I1, ++I2 )
-      {
-        if ( is_marked(I1,m) ) basic_link_beta_1(I1, I2);
-        else                   basic_link_beta_0(I1, I2);
-      }
-
-      for ( typename std::deque<Dart_handle>::iterator it=dartv.begin();
-            it!=dartv.end(); ++it )
-      { unmark(*it,m); }
-      CGAL_assertion( is_whole_map_unmarked(m) );
-      free_mark(m);
-
-      negate_mark( mark );
-      CGAL_assertion( is_whole_map_unmarked(mark) );
-      free_mark(mark);
-    }
-
-    /** Sew by betai the two given darts plus all the required darts
-     * to satisfy the combinatorial map validity, and updates enabled
-     * attributes when necessary so that the final map is valid.
-     * @param adart1 the first dart.
-     * @param adart2 the second dart.
-     * @pre is_sewable<i>(adart1, adart2).
-     * @pre 2<=i<=dimension.
-     * @post is_valid()
-     */
-    template<unsigned int i>
-    void sew_for_involution(Dart_handle adart1, Dart_handle adart2)
-    {
-      CGAL_assertion( 2<=i && i<=dimension );
-      CGAL_assertion( (is_sewable<i>(adart1,adart2)) );
-
-      size_type mark=get_new_mark();
-
-      CGAL::CMap_dart_iterator_basic_of_involution<Self, i>
-          I1(*this, adart1, mark);
-      CGAL::CMap_dart_iterator_basic_of_involution_inv<Self, i>
-          I2(*this, adart2, mark);
-
-      // This first loop do not modify the map, but only the attributes
-      // (by calling when required the onmerge functors).
-      for ( ; I1.cont(); ++I1, ++I2 )
-      {
-        Helper::template Foreach_enabled_attributes_except
-            <CGAL::internal::Group_attribute_functor<Self, i>, i>::
-            run(this, I1, I2);
-      }
-
-      // Now we update the beta links.
-      negate_mark( mark );
-      for ( I1.rewind(), I2.rewind(); I1.cont(); ++I1, ++I2 )
-      {
-        basic_link_beta_for_involution<i>(I1, I2);
-      }
-
-      negate_mark( mark );
-      CGAL_assertion( is_whole_map_unmarked(mark) );
-      free_mark(mark);
-    }
-
-    /** Sew by betai the two given darts plus all the required darts
-     * to satisfy the combinatorial map validity, and updates enabled
-     * attributes when necessary so that the final map is valid.
-     * @param adart1 the first dart.
-     * @param adart2 the second dart.
-     * @pre is_sewable<i>(adart1, adart2).
-     * @post is_valid()
-     */
-    template<unsigned int i>
-    void sew(Dart_handle adart1, Dart_handle adart2)
-    {
-      if ( are_attributes_automatically_managed() )
-      {
-        if ( i==0 ) sew_0(adart1, adart2);
-        else if ( i==1 ) sew_1(adart1, adart2);
-        else sew_for_involution<i>(adart1, adart2);
-      }
-      else topo_sew<i>(adart1, adart2);
-    }
-
-    /** Sew by betai the two given darts plus all the required darts
-     * to satisfy the combinatorial map validity. Enabled attributes
-     * are updated only if update_attributes==true.
-     * @param adart1 the first dart.
-     * @param adart2 the second dart.
-     * @param update_attributes a boolean to update the enabled attributes
-     *         (deprecated, now we use are_attributes_automatically_managed())
-     * @pre is_sewable<i>(adart1, adart2).
-     */
-    template<unsigned int i>
-    void sew(Dart_handle adart1, Dart_handle adart2, bool update_attributes)
-    {
-      if ( update_attributes ) sew<i>(adart1, adart2);
-      else topo_sew<i>(adart1, adart2);
-    }
-
-    /** Topological unsew by beta1 the given dart plus all the required darts
-     * to satisfy the combinatorial map validity: but do not update attributes
-     * thus the map can be non valid
-     * @param adart first dart.
-     * @pre !adart->is_free(1).
-     */
-    void topo_unsew_1(Dart_handle adart)
-    {
-      CGAL_assertion( !this->template is_free<1>(adart) );
-
-      size_type m = get_new_mark();
-      std::deque<Dart_handle> dartv;
-      for ( CGAL::CMap_dart_iterator_basic_of_cell<Self,0> it(*this, adart, m);
-            it.cont(); ++it )
-      {
-        mark(it,m);
-        dartv.push_back(it);
-      }
-
-      for ( CGAL::CMap_dart_iterator_of_involution<Self,1> it(*this, adart);
-            it.cont(); ++it )
-      {
-        if ( is_marked(it,m) ) unlink_beta_1(it);
-        else unlink_beta_0(it);
-      }
-
-      for ( typename std::deque<Dart_handle>::iterator it=dartv.begin();
-            it!=dartv.end(); ++it )
-      { unmark(*it,m); }
-      CGAL_assertion( is_whole_map_unmarked(m) );
-      free_mark(m);
-    }
-
-    /** Topological unsew by beta0 the given dart plus all the required darts
-     * to satisfy the combinatorial map validity: but do not update attributes
-     * thus the map can be non valid
-     * @param adart first dart.
-     * @pre !adart->is_free(0).
-     */
-    void topo_unsew_0(Dart_handle adart)
-    {
-      CGAL_assertion( !this->template is_free<0>(adart) );
-      topo_unsew_1( adart->template beta<0>() );
-    }
-
-    /** Topological unsew by betai the given dart plus all the required darts
-     * to satisfy the combinatorial map validity: but do not update attributes
-     * thus the map can be non valid
-     * @param adart first dart.
-     * @pre !adart->is_free(i).
-     * @pre 2<=i<=dimension.
-     */
-    template<unsigned int i>
-    void topo_unsew_for_involution(Dart_handle adart)
-    {
-      CGAL_assertion( !this->template is_free<i>(adart) );
-      CGAL_assertion( 2<=i && i<=Self::dimension );
-
-      for ( CGAL::CMap_dart_iterator_of_involution<Self,i> it(*this, adart);
-            it.cont(); ++it )
-      { unlink_beta<i>(it); }
-    }
-
-    /** Topological unsew by betai the given dart plus all the required darts
-     * to satisfy the combinatorial map validity: but do not update attributes
-     * thus the map can be non valid
-     * @param adart first dart.
-     * @pre !adart->is_free(i).
-     */
-    template<unsigned int i>
-    void topo_unsew(Dart_handle adart)
-    {
-      if ( i==0 ) topo_unsew_0(adart);
-      else if ( i==1 ) topo_unsew_1(adart);
-      else topo_unsew_for_involution<i>(adart);
-    }
-
-    /** Unsew by beta0 the given dart plus all the required darts
-     * to satisfy the combinatorial map validity, and update enabled
-     * attributes when necessary so that the final map is valid.
-     * @param adart first dart.
-     * @pre !adart->is_free(0).
-     * @post is_valid()
-     */
-    void unsew_0(Dart_handle adart)
-    {
-      CGAL_assertion( !this->template is_free<0>(adart) );
-
-      size_type m=get_new_mark();
-      std::deque<Dart_handle> dartv;
-      std::deque<Dart_handle> modified_darts;
-      std::deque<Dart_handle> modified_darts2;
-
-      for ( CGAL::CMap_dart_iterator_basic_of_cell<Self,0> it(*this, adart, m);
-            it.cont(); ++it )
-      {
-        mark(it, m);
-        dartv.push_back(it);
-      }
-
-      for ( CGAL::CMap_dart_iterator_of_involution<Self,1> it(*this, adart);
-            it.cont(); ++it )
-      {
-        if ( is_marked(it, m) )
-        {
-          modified_darts.push_back(it);
-          modified_darts2.push_back(beta<0>(it));
-          unlink_beta_0(it);
-        }
-        else
-        {
-          modified_darts2.push_back(it);
-          modified_darts.push_back(beta<1>(it));
-          unlink_beta_1(it);
-        }
-      }
-
-      for ( typename std::deque<Dart_handle>::iterator it=dartv.begin();
-            it!=dartv.end(); ++it )
-      { unmark(*it,m); }
-
-      CGAL_assertion( is_whole_map_unmarked(m) );
-      free_mark(m);
-
-      // We test the split of all the incident cells for all the non
-      // void attributes.
-      Helper::template Foreach_enabled_attributes_except
-          <CGAL::internal::Test_split_attribute_functor<Self,0>, 1>::
-          run(this, modified_darts, modified_darts2);
-    }
-
-    /** Unsew by beta1 the given dart plus all the required darts
-     * to satisfy the combinatorial map validity, and update enabled
-     * attributes when necessary so that the final map is valid.
-     * @param adart first dart.
-     * @pre !adart->is_free(1).
-     * @post is_valid()
-     */
-    void unsew_1(Dart_handle adart)
-    {
-      CGAL_assertion( !this->template is_free<1>(adart) );
-
-      size_type m = get_new_mark();
-      std::deque<Dart_handle> dartv;
-      std::deque<Dart_handle> modified_darts;
-      std::deque<Dart_handle> modified_darts2;
-
-      for ( CGAL::CMap_dart_iterator_basic_of_cell<Self,0>
-            it(*this, adart, m); it.cont(); ++it)
-      {
-        mark(it, m);
-        dartv.push_back(it);
-      }
-
-      for ( CGAL::CMap_dart_iterator_of_involution<Self, 1> it(*this, adart);
-            it.cont(); ++it )
-      {
-        if ( is_marked(it, m) )
-        {
-          modified_darts2.push_back(it);
-          modified_darts.push_back(beta<1>(it));
-          unlink_beta_1(it);
-        }
-        else
-        {
-          modified_darts.push_back(it);
-          modified_darts2.push_back(beta<0>(it));
-          unlink_beta_0(it);
-        }
-      }
-
-      for ( typename std::deque<Dart_handle>::iterator
-             it=dartv.begin(); it!=dartv.end(); ++it)
-      { unmark(*it, m); }
-      CGAL_assertion( is_whole_map_unmarked(m) );
-      free_mark(m);
-
-      // We test the split of all the incident cells for all the non
-      // void attributes.
-      Helper::template Foreach_enabled_attributes_except
-          <CGAL::internal::Test_split_attribute_functor<Self,1>, 1>::
-          run(this, modified_darts, modified_darts2);
-    }
-
-    /** Unsew by betai the given dart plus all the required darts
-     * to satisfy the combinatorial map validity, and update enabled
-     * attributes when necessary so that the final map is valid.
-     * @param adart first dart.
-     * @pre !adart->is_free(i).
-     * @post is_valid()
-     * @pre 2<=i<=dimension
-     */
-    template<unsigned int i>
-    void unsew_for_involution(Dart_handle adart)
-    {
-      CGAL_assertion(2<=i && i<=Self::dimension);
-      CGAL_assertion( !this->template is_free<i>(adart) );
-
-      std::deque<Dart_handle> modified_darts;
-
-      for ( CGAL::CMap_dart_iterator_of_involution<Self, i> it(*this, adart);
-            it.cont(); ++it )
-      {
-        modified_darts.push_back(it);
-        modified_darts.push_back(beta<i>(it));
-        unlink_beta_for_involution<i>(it);
-      }
-
-      // We test the split of all the incident cells for all the non
-      // void attributes.
-      Helper::template Foreach_enabled_attributes_except
-          <CGAL::internal::Test_split_attribute_functor<Self, i>, i>::
-          run(this, modified_darts);
-    }
-
-    /** Unsew by betai the given dart plus all the required darts
-     * to satisfy the combinatorial map validity, and update enabled
-     * attributes when necessary so that the final map is valid.
-     * @param adart first dart.
-     * @pre !adart->is_free(i).
-     * @post is_valid()
-     */
-    template<unsigned int i>
-    void unsew(Dart_handle adart)
-    {
-      if ( are_attributes_automatically_managed() )
-      {
-        if ( i==0 ) unsew_0(adart);
-        else if ( i==1 ) unsew_1(adart);
-        else unsew_for_involution<i>(adart);
-      }
-      else topo_unsew<i>(adart);
-    }
-
-    /** Unsew by betai the given dart plus all the required darts
-     * to satisfy the combinatorial map validity. Enabled attributes
-     * are updated only if update_attributes==true.
-     * @param adart first dart.
-     * @param update_attributes a boolean to update the enabled attributes
-     *         (deprecated, now we use are_attributes_automatically_managed())
-     * @pre !adart->is_free(i).
-     */
-    template<unsigned int i>
-    void unsew(Dart_handle adart, bool update_attributes)
-    {
-      if ( update_attributes ) unsew<i>(adart);
-      else topo_unsew<i>(adart);
-    }
-
-    /** Reverse the orientation (swap beta 0 & 1 links) of the entire map.
-     * A valid map after this operation remains valid.
-     * @param none
-     * @return none
-     */
-    void reverse_orientation()
-    {
-      internal::Reverse_orientation_of_map_functor<Self>::run(this);
-    }
-
-    /** Reverse the orientation (swap beta 0 & 1 links) of the connected
-     * component containing the given dart.
-     * A valid map after this operation remains valid.
-     * @param adart handle to a dart
-     * @return none
-     */
-    void reverse_orientation_connected_component (Dart_handle adart)
-    {
-      internal::Reverse_orientation_of_connected_component_functor<Self>::
-          run(this, adart);
-    }
-
-    /** Count the marked cells (at least one marked dart).
-     * @param amark the mark to consider.
-     * @param avector containing the dimensions of the cells to count.
-     * @return a vector containing the number of cells.
-     */
-    std::vector<unsigned int>
-    count_marked_cells(size_type amark, const std::vector<unsigned int>& acells) const
-    {
-      std::vector<unsigned int> res(dimension+2);
-      std::vector<size_type> marks(dimension+2);
-
-      // Initialization of the result
-      for ( unsigned int i=0; i<dimension+2; ++i)
-      {
-        res[i]=0;
-        marks[i]=INVALID_MARK;
-      }
-
-      // Mark reservation
-      for ( unsigned int i=0; i<acells.size(); ++i)
-      {
-        CGAL_assertion(acells[i]<=dimension+1);
-        if ( marks[acells[i]]==INVALID_MARK )
-        {
-          marks[acells[i]] = get_new_mark();
-        }
-      }
-
-      // Counting and marking cells
-      for ( typename Dart_range::const_iterator it(darts().begin()),
-             itend(darts().end()); it!=itend; ++it)
-      {
-        if ( is_marked(it, amark) )
-        {
-          CGAL::internal::Foreach_static
-            <CGAL::internal::Count_cell_functor<Self>,dimension+1>::
-            run(this, it, &marks, &res);
-        }
-      }
-
-      // Unmarking darts
-      std::vector<size_type> tounmark;
-      for ( unsigned int i=0; i<acells.size(); ++i)
-      {
-        if ( is_whole_map_marked(marks[acells[i]]) ||
-             is_whole_map_unmarked(marks[acells[i]]))
-        {
-          free_mark(marks[acells[i]]);
-        }
-        else
-        {
-          tounmark.push_back(marks[acells[i]]);
-        }
-      }
-
-      if ( tounmark.size() > 0 )
-      {
-        for ( typename Dart_range::const_iterator it(darts().begin()),
-               itend(darts().end()); it!=itend; ++it)
-        {
-          for ( unsigned int i=0; i<tounmark.size(); ++i)
-            unmark(it, tounmark[i]);
-        }
-        for ( unsigned int i=0; i<tounmark.size(); ++i)
-        {
-          CGAL_assertion(is_whole_map_unmarked(tounmark[i]));
-          free_mark(tounmark[i]);
-        }
-      }
-
-      return res;
-    }
-
-    /** Count the number of given cells
-     * @param avector containing the dimensions of the cells to count.
-     * @return a vector containing the number of cells.
-     */
-    std::vector<unsigned int>
-    count_cells(const std::vector<unsigned int>& acells) const
-    {
-      std::vector<unsigned int> res;
-      size_type m = get_new_mark();
-      negate_mark(m); // We mark all the cells.
-
-      res = count_marked_cells(m, acells);
-
-      negate_mark(m); // We unmark the cells
-      free_mark(m);
-
-      return res;
-    }
-
-    /** Count the number of cells in each dimension.
-     * @return a vector containing the number of cells.
-     */
-    std::vector<unsigned int> count_all_cells() const
-    {
-      std::vector<unsigned int> dim(dimension+2);
-
-      for ( unsigned int i=0; i<dimension+2; ++i)
-        dim[i]=i;
-
-      return count_cells(dim);
-    }
-
-  protected:
-    /** Set simultaneously all the marks of a given dart.
-     * @param adart the dart.
-     * @param amarks the marks to set.
-     */
-    void set_marks(Dart_const_handle adart,
-                   const std::bitset<NB_MARKS> & amarks) const
-    { set_dart_marks(adart, amarks ^ mmask_marks); }
-
-    /** Get simultaneously all the marks of a given dart.
-     * @param adart the dart.
-     * @return allt the marks of adart.
-     */
-    std::bitset<NB_MARKS> get_marks(Dart_const_handle adart) const
-    { return get_dart_marks(adart) ^ mmask_marks; }
-
-    /** Get the mask associated to a given mark.
-     * @param amark the mark.
-     * @return the mask associated to mark amark.
-     */
-    bool get_mask_mark(size_type amark) const
-    {
-      CGAL_assertion(amark>=0 && amark<NB_MARKS);
-      return mmask_marks[amark];
-    }
-
-  public:
-    /** Erase marked darts from the map.
-     * Marked darts are unlinked before to be removed, thus surviving darts
-     * are correctly linked, but the map is not necessarily valid depending
-     * on the configuration of removed darts. User must check carefully marked
-     * darts before calling this method.
-     * @param amark the mark of darts to erase.
-     * @return the number of removed darts.
-     */
-    unsigned int erase_marked_darts(size_type amark)
-    {
-      unsigned int res = 0, i = 0;
-      Dart_handle d;
-      for ( typename Dart_range::iterator it(darts().begin()),
-             itend(darts().end()); it!=itend; )
-      {
-        d = it++;
-        if (is_marked(d, amark))
-        {
-          for ( i = 0; i <= dimension; ++i)
-          { if (!d->is_free(i)) unlink_beta(d, i); }
-          erase_dart(d); ++res;
-        }
-      }
-      return res;
-    }
-
-#ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
-    //**************************************************************************
-    // Dart_of_orbit_basic_range
-    template<unsigned int ... Beta>
-    struct Dart_of_orbit_basic_range : public CGAL::CMap_range
-    <Self, CGAL::CMap_dart_iterator_basic_of_orbit<Self,Beta...>,
-     CGAL::CMap_dart_const_iterator_basic_of_orbit<Self,Beta...> >
-    {
-      typedef CGAL::CMap_range
-      <Self, CGAL::CMap_dart_iterator_basic_of_orbit<Self,Beta...>,
-       CGAL::CMap_dart_const_iterator_basic_of_orbit<Self,Beta...> > Base;
-
-      Dart_of_orbit_basic_range(Self &amap, Dart_handle adart, size_type amark=INVALID_MARK):
-        Base(amap, adart, amark)
-      {}
-    };
-    //**************************************************************************
-    // Dart_of_orbit_basic_const_range
-    template<unsigned int ... Beta>
-    struct Dart_of_orbit_basic_const_range : public CGAL::CMap_const_range
-    <Self, CGAL::CMap_dart_const_iterator_basic_of_orbit<Self,Beta...> >
-    {
-      typedef CGAL::CMap_const_range
-      <Self, CGAL::CMap_dart_const_iterator_basic_of_orbit<Self,Beta...> >
-      Base;
-
-      Dart_of_orbit_basic_const_range(const Self &amap, Dart_const_handle
-                                      adart, size_type amark=INVALID_MARK):
-        Base(amap, adart, amark)
-      {}
-    };
-    //**************************************************************************
-    // Dart_of_orbit_range
-    template<unsigned int ... Beta>
-    struct Dart_of_orbit_range : public CGAL::CMap_range
-    <Self, CGAL::CMap_dart_iterator_of_orbit<Self,Beta...>,
-     CGAL::CMap_dart_const_iterator_of_orbit<Self,Beta...> >
-    {
-      typedef CGAL::CMap_range
-      <Self, CGAL::CMap_dart_iterator_of_orbit<Self,Beta...>,
-       CGAL::CMap_dart_const_iterator_of_orbit<Self,Beta...> > Base;
-
-      Dart_of_orbit_range(Self &amap, Dart_handle adart) : Base(amap,adart)
-      {}
-    };
-    //**************************************************************************
-    // Dart_of_orbit_const_range
-    template<unsigned int ... Beta>
-    struct Dart_of_orbit_const_range : public CGAL::CMap_const_range
-    <Self, CGAL::CMap_dart_const_iterator_of_orbit<Self,Beta...> >
-    {
-      typedef CGAL::CMap_const_range
-      <Self, CGAL::CMap_dart_const_iterator_of_orbit<Self,Beta...> > Base;
-
-      Dart_of_orbit_const_range(const Self &amap, Dart_const_handle adart):
-        Base(amap,adart)
-      {}
-    };
-    //**************************************************************************
-    /// @return a range on all the darts of the given orbit
-    template<unsigned int ... Beta>
-    Dart_of_orbit_range<Beta...> darts_of_orbit(Dart_handle adart)
-    { return Dart_of_orbit_range<Beta...>(*this,adart); }
-    //--------------------------------------------------------------------------
-    template<unsigned int ... Beta>
-    Dart_of_orbit_const_range<Beta...>
-    darts_of_orbit(Dart_const_handle adart) const
-    { return Dart_of_orbit_const_range<Beta...>(*this,adart); }
-    //--------------------------------------------------------------------------
-    template<unsigned int ... Beta>
-    Dart_of_orbit_basic_range<Beta...> darts_of_orbit_basic(Dart_handle adart,
-                                                            size_type amark=INVALID_MARK)
-    { return Dart_of_orbit_basic_range<Beta...>(*this,adart,amark); }
-    //--------------------------------------------------------------------------
-    template<unsigned int ... Beta>
-    Dart_of_orbit_basic_const_range<Beta...>
-    darts_of_orbit_basic(Dart_const_handle adart, size_type amark=INVALID_MARK) const
-    { return Dart_of_orbit_basic_const_range<Beta...>(*this,adart,amark); }
-    //**************************************************************************
-#else
-    //**************************************************************************
-    // Dart_of_orbit_basic_range
-    template<int B1=-1,int B2=-1,int B3=-1,int B4=-1,int B5=-1,
-             int B6=-1,int B7=-1,int B8=-1,int B9=-1>
-    struct Dart_of_orbit_basic_range: public CGAL::CMap_range
-    <Self, CGAL::CMap_dart_iterator_basic_of_orbit<Self,B1,B2,B3,B4,B5,B6,B7,
-        B8,B9>,
-     CGAL::CMap_dart_const_iterator_basic_of_orbit<Self,B1,B2,B3,B4,B5,B6,B7,
-        B8,B9> >
-    {
-      typedef CGAL::CMap_range
-      <Self, CGAL::CMap_dart_iterator_basic_of_orbit<Self,B1,B2,B3,B4,B5,B6,B7,
-      B8,B9>,
-       CGAL::CMap_dart_const_iterator_basic_of_orbit<Self,B1,B2,B3,B4,B5,
-                                               B6,B7,B8,B9> > Base;
-
-      Dart_of_orbit_basic_range(Self &amap, Dart_handle adart,
-                                size_type /*amark*/=INVALID_MARK):
-        Base(amap, adart)
-      {}
-    };
-    //**************************************************************************
-    // Dart_of_orbit_basic_const_range
-    template<int B1=-1,int B2=-1,int B3=-1,int B4=-1,int B5=-1,
-             int B6=-1,int B7=-1,int B8=-1,int B9=-1>
-    struct Dart_of_orbit_basic_const_range: public CMap_const_range
-    <Self,
-     CGAL::CMap_dart_const_iterator_basic_of_orbit<Self,B1,B2,B3,B4,B5,B6,B7,
-        B8,B9> >
-    {
-      typedef CMap_const_range
-      <Self, CGAL::CMap_dart_const_iterator_basic_of_orbit
-       <Self,B1,B2,B3,B4,B5,B6,B7,B8,B9> > Base;
-
-      Dart_of_orbit_basic_const_range(const Self &amap,
-                                      Dart_const_handle adart, size_type amark=INVALID_MARK):
-        Base(amap, adart, amark)
-      {}
-    };
-    //**************************************************************************
-    // Dart_of_orbit_range
-    template<int B1=-1,int B2=-1,int B3=-1,int B4=-1,int B5=-1,
-             int B6=-1,int B7=-1,int B8=-1,int B9=-1>
-    struct Dart_of_orbit_range: public CGAL::CMap_range
-    <Self, CGAL::CMap_dart_iterator_of_orbit<Self,B1,B2,B3,B4,B5,B6,B7,B8,B9>,
-     CGAL::CMap_dart_const_iterator_of_orbit<Self,B1,B2,B3,B4,B5,B6,B7,B8,B9> >
-    {
-      typedef CGAL::CMap_range
-      <Self, CGAL::CMap_dart_iterator_of_orbit<Self,B1,B2,B3,B4,B5,B6,B7,
-      B8,B9>,
-       CGAL::CMap_dart_const_iterator_of_orbit<Self,B1,B2,B3,B4,B5,B6,B7,
-      B8,B9> >
-      Base;
-
-      Dart_of_orbit_range(Self &amap, Dart_handle adart):
-        Base(amap, adart)
-      {}
-    };
-    //**************************************************************************
-    // Dart_of_orbit_const_range
-    template<int B1=-1,int B2=-1,int B3=-1,int B4=-1,int B5=-1,
-             int B6=-1,int B7=-1,int B8=-1,int B9=-1>
-    struct Dart_of_orbit_const_range: public CMap_const_range
-    <Self, CGAL::CMap_dart_const_iterator_of_orbit<Self,B1,B2,B3,B4,B5,B6,B7,
-        B8,B9> >
-    {
-      typedef CMap_const_range
-      <Self, CGAL::CMap_dart_const_iterator_of_orbit
-       <Self,B1,B2,B3,B4,B5,B6,B7,B8,B9> > Base;
-
-      Dart_of_orbit_const_range(const Self &amap, Dart_const_handle adart):
-        Base(amap, adart)
-      {}
-    };
-    //**************************************************************************
-    /// @return a range on all the darts of the given orbit
-    Dart_of_orbit_range<> darts_of_orbit(Dart_handle adart)
-    { return Dart_of_orbit_range<>(*this,adart); }
-    //--------------------------------------------------------------------------
-    template <unsigned int B1>
-    Dart_of_orbit_range<B1> darts_of_orbit(Dart_handle adart)
-    { return Dart_of_orbit_range<B1>(*this,adart); }
-    //--------------------------------------------------------------------------
-    template <unsigned int B1,unsigned int B2>
-    Dart_of_orbit_range<B1,B2> darts_of_orbit(Dart_handle adart)
-    { return Dart_of_orbit_range<B1,B2>(*this,adart); }
-    //--------------------------------------------------------------------------
-    template <unsigned int B1,unsigned int B2,unsigned int B3>
-    Dart_of_orbit_range<B1,B2,B3> darts_of_orbit(Dart_handle adart)
-    { return Dart_of_orbit_range<B1,B2,B3>(*this,adart); }
-    //--------------------------------------------------------------------------
-    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4>
-    Dart_of_orbit_range<B1,B2,B3,B4> darts_of_orbit(Dart_handle adart)
-    { return Dart_of_orbit_range<B1,B2,B3,B4>(*this,adart); }
-    //--------------------------------------------------------------------------
-    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
-              unsigned int B5>
-    Dart_of_orbit_range<B1,B2,B3,B4,B5> darts_of_orbit(Dart_handle adart)
-    { return Dart_of_orbit_range<B1,B2,B3,B4,B5>(*this,adart); }
-    //--------------------------------------------------------------------------
-    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
-              unsigned int B5,unsigned int B6>
-    Dart_of_orbit_range<B1,B2,B3,B4,B5,B6> darts_of_orbit(Dart_handle adart)
-    { return Dart_of_orbit_range<B1,B2,B3,B4,B5,B6>(*this,adart); }
-    //--------------------------------------------------------------------------
-    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
-              unsigned int B5,unsigned int B6,unsigned int B7>
-    Dart_of_orbit_range<B1,B2,B3,B4,B5,B6,B7> darts_of_orbit(Dart_handle adart)
-    { return Dart_of_orbit_range<B1,B2,B3,B4,B5,B6,B7>(*this,adart); }
-    //--------------------------------------------------------------------------
-    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
-              unsigned int B5,unsigned int B6,unsigned int B7,unsigned int B8>
-    Dart_of_orbit_range<B1,B2,B3,B4,B5,B6,B7,B8> darts_of_orbit
-    (Dart_handle adart)
-    { return Dart_of_orbit_range<B1,B2,B3,B4,B5,B6,B7,B8>(*this,adart); }
-    //--------------------------------------------------------------------------
-    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
-              unsigned int B5,unsigned int B6,unsigned int B7,unsigned int B8,
-              unsigned int B9>
-    Dart_of_orbit_range<B1,B2,B3,B4,B5,B6,B7,B8,B9>
-    darts_of_orbit(Dart_handle adart)
-    { return Dart_of_orbit_range<B1,B2,B3,B4,B5,B6,B7,B8,B9>(*this,adart); }
-    //--------------------------------------------------------------------------
-    // Const versions.
-    Dart_of_orbit_const_range<> darts_of_orbit(Dart_const_handle adart) const
-    { return Dart_of_orbit_const_range<>(*this,adart); }
-    //--------------------------------------------------------------------------
-    template <unsigned int B1>
-    Dart_of_orbit_const_range<B1> darts_of_orbit(Dart_const_handle
-                                                 adart) const
-    { return Dart_of_orbit_const_range<B1>(*this,adart); }
-    //--------------------------------------------------------------------------
-    template <unsigned int B1,unsigned int B2>
-    Dart_of_orbit_const_range<B1,B2> darts_of_orbit(Dart_const_handle
-                                                    adart) const
-    { return Dart_of_orbit_const_range<B1,B2>(*this,adart); }
-    //--------------------------------------------------------------------------
-    template <unsigned int B1,unsigned int B2,unsigned int B3>
-    Dart_of_orbit_const_range<B1,B2,B3> darts_of_orbit
-    (Dart_const_handle adart) const
-    { return Dart_of_orbit_const_range<B1,B2,B3>(*this,adart); }
-    //--------------------------------------------------------------------------
-    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4>
-    Dart_of_orbit_const_range<B1,B2,B3,B4>
-    darts_of_orbit(Dart_const_handle adart) const
-    { return Dart_of_orbit_const_range<B1,B2,B3,B4>(*this,adart); }
-    //--------------------------------------------------------------------------
-    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
-              unsigned int B5>
-    Dart_of_orbit_const_range<B1,B2,B3,B4,B5>
-    darts_of_orbit(Dart_const_handle adart) const
-    { return Dart_of_orbit_const_range<B1,B2,B3,B4,B5>(*this,adart); }
-    //--------------------------------------------------------------------------
-    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
-              unsigned int B5,unsigned int B6>
-    Dart_of_orbit_const_range<B1,B2,B3,B4,B5,B6>
-    darts_of_orbit(Dart_const_handle adart) const
-    { return Dart_of_orbit_const_range<B1,B2,B3,B4,B5,B6>(*this,adart); }
-    //--------------------------------------------------------------------------
-    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
-              unsigned int B5,unsigned int B6,unsigned int B7>
-    Dart_of_orbit_const_range<B1,B2,B3,B4,B5,B6,B7>
-    darts_of_orbit(Dart_const_handle adart) const
-    { return Dart_of_orbit_const_range<B1,B2,B3,B4,B5,B6,B7>(*this,adart); }
-    //--------------------------------------------------------------------------
-    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
-              unsigned int B5,unsigned int B6,unsigned int B7,unsigned int B8>
-    Dart_of_orbit_const_range<B1,B2,B3,B4,B5,B6,B7,B8>
-    darts_of_orbit(Dart_const_handle adart) const
-    { return Dart_of_orbit_const_range<B1,B2,B3,B4,B5,B6,B7,B8>(*this,adart); }
-    //--------------------------------------------------------------------------
-    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
-              unsigned int B5,unsigned int B6,unsigned int B7,unsigned int B8,
-              unsigned int B9>
-    Dart_of_orbit_const_range<B1,B2,B3,B4,B5,B6,B7,B8,B9>
-    darts_of_orbit(Dart_const_handle adart) const
-    { return Dart_of_orbit_const_range<B1,B2,B3,B4,B5,B6,B7,B8,B9>
-        (*this,adart); }
-    //--------------------------------------------------------------------------
-    // Basic versions
-    Dart_of_orbit_basic_range<> darts_of_orbit_basic(Dart_handle adart,
-                                                     size_type amark=INVALID_MARK)
-    { return Dart_of_orbit_basic_range<>(*this,adart,amark); }
-    //--------------------------------------------------------------------------
-    Dart_of_orbit_basic_const_range<> darts_of_orbit_basic
-    (Dart_const_handle adart,size_type amark=INVALID_MARK) const
-    { return Dart_of_orbit_basic_const_range<>(*this,adart,amark); }
-    //--------------------------------------------------------------------------
-    template <unsigned int B1>
-    Dart_of_orbit_basic_range<B1> darts_of_orbit_basic(Dart_handle adart,
-                                                       size_type amark=INVALID_MARK)
-    { return Dart_of_orbit_basic_range<B1>(*this,adart,amark); }
-    //--------------------------------------------------------------------------
-    template <unsigned int B1>
-    Dart_of_orbit_basic_const_range<B1> darts_of_orbit_basic
-    (Dart_const_handle adart, size_type amark=INVALID_MARK) const
-    { return Dart_of_orbit_basic_const_range<B1>(*this,adart,amark); }
-    //--------------------------------------------------------------------------
-    template <unsigned int B1,unsigned int B2>
-    Dart_of_orbit_basic_range<B1,B2> darts_of_orbit_basic(Dart_handle adart,
-                                                          size_type amark=INVALID_MARK)
-    { return Dart_of_orbit_basic_range<B1,B2>(*this,adart,amark); }
-    //--------------------------------------------------------------------------
-    template <unsigned int B1,unsigned int B2>
-    Dart_of_orbit_basic_const_range<B1,B2> darts_of_orbit_basic
-    (Dart_const_handle adart, size_type amark=INVALID_MARK) const
-    { return Dart_of_orbit_basic_const_range<B1,B2>(*this,adart,amark); }
-    //--------------------------------------------------------------------------
-    template <unsigned int B1,unsigned int B2,unsigned int B3>
-    Dart_of_orbit_basic_range<B1,B2,B3> darts_of_orbit_basic(Dart_handle adart,
-                                                             size_type amark=INVALID_MARK)
-    { return Dart_of_orbit_basic_range<B1,B2,B3>(*this,adart,amark); }
-    //--------------------------------------------------------------------------
-    template <unsigned int B1,unsigned int B2,unsigned int B3>
-    Dart_of_orbit_basic_const_range<B1,B2,B3> darts_of_orbit_basic
-    (Dart_const_handle adart, size_type amark=INVALID_MARK) const
-    { return Dart_of_orbit_basic_const_range<B1,B2,B3>(*this,adart,amark); }
-    //--------------------------------------------------------------------------
-    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4>
-    Dart_of_orbit_basic_range<B1,B2,B3,B4> darts_of_orbit_basic
-    (Dart_handle adart, size_type amark=INVALID_MARK)
-    { return Dart_of_orbit_basic_range<B1,B2,B3,B4>(*this,adart,amark); }
-    //--------------------------------------------------------------------------
-    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4>
-    Dart_of_orbit_basic_const_range<B1,B2,B3,B4>
-    darts_of_orbit_basic(Dart_const_handle adart, size_type amark=INVALID_MARK) const
-    { return Dart_of_orbit_basic_const_range<B1,B2,B3,B4>(*this,adart,amark); }
-    //--------------------------------------------------------------------------
-    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
-              unsigned int B5>
-    Dart_of_orbit_basic_range<B1,B2,B3,B4,B5> darts_of_orbit_basic
-    (Dart_handle adart, size_type amark=INVALID_MARK)
-    { return Dart_of_orbit_basic_range<B1,B2,B3,B4,B5>(*this,adart,amark); }
-    //--------------------------------------------------------------------------
-    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
-              unsigned int B5>
-    Dart_of_orbit_basic_const_range<B1,B2,B3,B4,B5>
-    darts_of_orbit_basic(Dart_const_handle adart, size_type amark=INVALID_MARK) const
-    { return Dart_of_orbit_basic_const_range<B1,B2,B3,B4,B5>
-        (*this,adart,amark); }
-    //--------------------------------------------------------------------------
-    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
-              unsigned int B5,unsigned int B6>
-    Dart_of_orbit_basic_range<B1,B2,B3,B4,B5,B6> darts_of_orbit_basic
-    (Dart_handle adart, size_type amark=INVALID_MARK)
-    { return Dart_of_orbit_basic_range<B1,B2,B3,B4,B5,B6>(*this,adart,amark); }
-    //--------------------------------------------------------------------------
-    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
-              unsigned int B5,unsigned int B6>
-    Dart_of_orbit_basic_const_range<B1,B2,B3,B4,B5,B6>
-    darts_of_orbit_basic(Dart_const_handle adart, size_type amark=INVALID_MARK) const
-    { return Dart_of_orbit_basic_const_range<B1,B2,B3,B4,B5,B6>
-        (*this,adart,amark); }
-    //--------------------------------------------------------------------------
-    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
-              unsigned int B5,unsigned int B6,unsigned int B7>
-    Dart_of_orbit_basic_range<B1,B2,B3,B4,B5,B6,B7> darts_of_orbit_basic
-    (Dart_handle adart, size_type amark=INVALID_MARK)
-    { return Dart_of_orbit_basic_range<B1,B2,B3,B4,B5,B6,B7>
-        (*this,adart,amark); }
-    //--------------------------------------------------------------------------
-    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
-              unsigned int B5,unsigned int B6,unsigned int B7>
-    Dart_of_orbit_basic_const_range<B1,B2,B3,B4,B5,B6,B7>
-    darts_of_orbit_basic(Dart_const_handle adart, size_type amark=INVALID_MARK) const
-    { return Dart_of_orbit_basic_const_range<B1,B2,B3,B4,B5,B6,B7>
-        (*this,adart,amark); }
-    //--------------------------------------------------------------------------
-    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
-              unsigned int B5,unsigned int B6,unsigned int B7,unsigned int B8>
-    Dart_of_orbit_basic_range<B1,B2,B3,B4,B5,B6,B7,B8> darts_of_orbit
-    (Dart_handle adart, size_type amark=INVALID_MARK)
-    { return Dart_of_orbit_basic_range<B1,B2,B3,B4,B5,B6,B7,B8>
-        (*this,adart,amark); }
-    //--------------------------------------------------------------------------
-    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
-              unsigned int B5,unsigned int B6,unsigned int B7,unsigned int B8>
-    Dart_of_orbit_basic_const_range<B1,B2,B3,B4,B5,B6,B7,B8>
-    darts_of_orbit_basic(Dart_const_handle adart, size_type amark=INVALID_MARK) const
-    { return Dart_of_orbit_basic_const_range<B1,B2,B3,B4,B5,B6,B7,B8>
-        (*this,adart,amark); }
-    //--------------------------------------------------------------------------
-    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
-              unsigned int B5,unsigned int B6,unsigned int B7,unsigned int B8,
-              unsigned int B9>
-    Dart_of_orbit_basic_range<B1,B2,B3,B4,B5,B6,B7,B8,B9>
-    darts_of_orbit_basic(Dart_handle adart, size_type amark=INVALID_MARK)
-    { return Dart_of_orbit_basic_range<B1,B2,B3,B4,B5,B6,B7,B8,B9>
-        (*this,adart,amark); }
-    //--------------------------------------------------------------------------
-    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
-              unsigned int B5,unsigned int B6,unsigned int B7,unsigned int B8,
-              unsigned int B9>
-    Dart_of_orbit_basic_const_range<B1,B2,B3,B4,B5,B6,B7,B8,B9>
-    darts_of_orbit_basic(Dart_const_handle adart, size_type amark=INVALID_MARK) const
-    { return Dart_of_orbit_basic_const_range<B1,B2,B3,B4,B5,B6,B7,B8,B9>
-        (*this,adart,amark); }
-    //**************************************************************************
-#endif //CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
-    //**************************************************************************
-    // Dart_of_cell_basic_range
-    template<unsigned int i,int dim=Self::dimension>
-    struct Dart_of_cell_basic_range: public CGAL::CMap_range
-    <Self, CGAL::CMap_dart_iterator_basic_of_cell<Self,i,dim>,
-     CGAL::CMap_dart_const_iterator_basic_of_cell<Self,i,dim> >
-    {
-      typedef CGAL::CMap_range
-      <Self, CGAL::CMap_dart_iterator_basic_of_cell<Self,i,dim>,
-       CGAL::CMap_dart_const_iterator_basic_of_cell<Self,i,dim> > Base;
-
-      Dart_of_cell_basic_range(Self &amap, Dart_handle adart, size_type amark=INVALID_MARK) :
-        Base(amap, adart, amark)
-      {}
-    };
-    //**************************************************************************
-    // Dart_of_cell_basic_const_range
-    template<unsigned int i,int dim=Self::dimension>
-    struct Dart_of_cell_basic_const_range: public CMap_const_range
-    <Self, CGAL::CMap_dart_const_iterator_basic_of_cell<Self,i,dim> >
-    {
-      typedef CMap_const_range
-      <Self, CGAL::CMap_dart_const_iterator_basic_of_cell<Self,i,dim> > Base;
-
-      Dart_of_cell_basic_const_range(const Self &amap, Dart_const_handle adart,
-                                     size_type amark=INVALID_MARK) :
-        Base(amap, adart, amark)
-      {}
-    };
-    //**************************************************************************
-    // Dart_of_cell_range
-    template<unsigned int i,int dim=Self::dimension>
-    struct Dart_of_cell_range: public CGAL::CMap_range
-    <Self,CMap_dart_iterator_of_cell<Self,i,dim>,
-     CGAL::CMap_dart_const_iterator_of_cell<Self,i,dim> >
-    {
-      typedef CGAL::CMap_range
-      <Self,CMap_dart_iterator_of_cell<Self,i,dim>,
-       CGAL::CMap_dart_const_iterator_of_cell<Self,i,dim> > Base;
-
-      Dart_of_cell_range(Self &amap, Dart_handle adart) :
-        Base(amap, adart)
-      {}
-    };
-    //**************************************************************************
-    // Dart_of_cell_const_range
-    template<unsigned int i,int dim=Self::dimension>
-    struct Dart_of_cell_const_range: public CMap_const_range
-    <Self, CGAL::CMap_dart_const_iterator_of_cell<Self,i,dim> >
-    {
-      typedef CMap_const_range
-      <Self, CGAL::CMap_dart_const_iterator_of_cell<Self,i,dim> > Base;
-
-      Dart_of_cell_const_range(const Self &amap, Dart_const_handle adart) :
-        Base(amap, adart)
-      {}
-    };
-    //--------------------------------------------------------------------------
-    /// @return a range on all the darts of the given i-cell
-    template<unsigned int i, int dim>
-    Dart_of_cell_basic_range<i,dim> darts_of_cell_basic(Dart_handle adart,
-                                                        size_type amark=INVALID_MARK)
-    { return Dart_of_cell_basic_range<i,dim>(*this,adart,amark); }
-    //--------------------------------------------------------------------------
-    template<unsigned int i, int dim>
-    Dart_of_cell_basic_const_range<i,dim> darts_of_cell_basic
-    (Dart_const_handle adart, size_type amark=INVALID_MARK) const
-    { return Dart_of_cell_basic_const_range<i,dim>(*this,adart,amark); }
-    //--------------------------------------------------------------------------
-    template<unsigned int i>
-    Dart_of_cell_basic_range<i,Self::dimension>
-    darts_of_cell_basic(Dart_handle adart, size_type amark=INVALID_MARK)
-    { return darts_of_cell_basic<i,Self::dimension>(adart,amark); }
-    //--------------------------------------------------------------------------
-    template<unsigned int i>
-    Dart_of_cell_basic_const_range<i,Self::dimension>
-    darts_of_cell_basic(Dart_const_handle adart, size_type amark=INVALID_MARK) const
-    { return darts_of_cell_basic<i,Self::dimension>(adart,amark); }
-    //--------------------------------------------------------------------------
-    template<unsigned int i, int dim>
-    Dart_of_cell_range<i,dim> darts_of_cell(Dart_handle adart)
-    { return Dart_of_cell_range<i,dim>(*this,adart); }
-    //--------------------------------------------------------------------------
-    template<unsigned int i, int dim>
-    Dart_of_cell_const_range<i,dim> darts_of_cell(Dart_const_handle adart) const
-    { return Dart_of_cell_const_range<i,dim>(*this,adart); }
-    //--------------------------------------------------------------------------
-    template<unsigned int i>
-    Dart_of_cell_range<i,Self::dimension> darts_of_cell(Dart_handle adart)
-    { return darts_of_cell<i,Self::dimension>(adart); }
-    //--------------------------------------------------------------------------
-    template<unsigned int i>
-    Dart_of_cell_const_range<i,Self::dimension>
-    darts_of_cell(Dart_const_handle adart) const
-    { return darts_of_cell<i,Self::dimension>(adart); }
-    //**************************************************************************
-    // Dart_of_involution_basic_range
-    template<unsigned int i,int dim=Self::dimension>
-    struct Dart_of_involution_basic_range: public CGAL::CMap_range
-    <Self, CGAL::CMap_dart_iterator_basic_of_involution<Self,i,dim>,
-     CGAL::CMap_dart_const_iterator_basic_of_involution<Self,i,dim> >
-    {
-      typedef CGAL::CMap_range
-      <Self, CGAL::CMap_dart_iterator_basic_of_involution<Self,i,dim>,
-       CGAL::CMap_dart_const_iterator_basic_of_involution<Self,i,dim> > Base;
-
-      Dart_of_involution_basic_range(Self &amap, Dart_handle adart,
-                                     size_type amark=INVALID_MARK):
-        Base(amap, adart, amark)
-      {}
-    };
-    //**************************************************************************
-    // Dart_of_involution_basic_const_range
-    template<unsigned int i,int dim=Self::dimension>
-    struct Dart_of_involution_basic_const_range: public CMap_const_range
-    <Self, CGAL::CMap_dart_const_iterator_basic_of_involution<Self,i,dim> >
-    {
-      typedef CMap_const_range
-      <Self, CGAL::CMap_dart_const_iterator_basic_of_involution<Self,i,dim> >
-      Base;
-
-      Dart_of_involution_basic_const_range(const Self &amap,
-                                           Dart_const_handle adart,
-                                           size_type amark=INVALID_MARK) :
-        Base(amap, adart, amark)
-      {}
-    };
-    //**************************************************************************
-    template<unsigned int i,int dim>
-    Dart_of_involution_basic_range<i,dim>
-    darts_of_involution_basic(Dart_handle adart, size_type amark=INVALID_MARK)
-    { return Dart_of_involution_basic_range<i,dim>(*this,adart,amark); }
-    //--------------------------------------------------------------------------
-    template<unsigned int i,int dim>
-    Dart_of_involution_basic_const_range<i,dim>
-    darts_of_involution_basic(Dart_const_handle adart, size_type amark=INVALID_MARK) const
-    { return Dart_of_involution_basic_const_range<i,dim>(*this,adart,amark); }
-    //--------------------------------------------------------------------------
-    template<unsigned int i>
-    Dart_of_involution_basic_range<i,Self::dimension>
-    darts_of_involution_basic(Dart_handle adart, size_type amark=INVALID_MARK)
-    { return Dart_of_involution_basic_range<i,Self::dimension>
-        (*this,adart,amark); }
-    //--------------------------------------------------------------------------
-    template<unsigned int i>
-    Dart_of_involution_basic_const_range<i,Self::dimension>
-    darts_of_involution_basic(Dart_const_handle adart, size_type amark=INVALID_MARK) const
-    { return Dart_of_involution_basic_const_range<i,Self::dimension>
-        (*this,adart,amark); }
-    //**************************************************************************
-    // Dart_of_involution_inv_basic_range
-    template<unsigned int i,int dim=Self::dimension>
-    struct Dart_of_involution_inv_basic_range: public CGAL::CMap_range
-    <Self, CGAL::CMap_dart_iterator_basic_of_involution_inv<Self,i,dim>,
-     CGAL::CMap_dart_const_iterator_basic_of_involution_inv<Self,i,dim> >
-    {
-      typedef CGAL::CMap_range
-      <Self, CGAL::CMap_dart_iterator_basic_of_involution_inv<Self,i,dim>,
-       CGAL::CMap_dart_const_iterator_basic_of_involution_inv<Self,i,dim> >
-      Base;
-
-      Dart_of_involution_inv_basic_range(Self &amap, Dart_handle adart,
-                                         size_type amark=INVALID_MARK):
-        Base(amap, adart, amark)
-      {}
-    };
-    //**************************************************************************
-    // Dart_of_involution_inv_basic_const_range
-    template<unsigned int i,int dim=Self::dimension>
-    struct Dart_of_involution_inv_basic_const_range: public CMap_const_range
-    <Self, CGAL::CMap_dart_const_iterator_basic_of_involution_inv<Self,i,dim> >
-    {
-      typedef CMap_const_range
-      <Self, CGAL::CMap_dart_const_iterator_basic_of_involution_inv
-      <Self,i,dim> >
-      Base;
-
-      Dart_of_involution_inv_basic_const_range(const Self &amap,
-                                               Dart_const_handle adart,
-                                               size_type amark=INVALID_MARK) :
-        Base(amap, adart, amark)
-      {}
-    };
-    //**************************************************************************
-    template<unsigned int i,int dim>
-    Dart_of_involution_inv_basic_range<i,dim>
-    darts_of_involution_inv_basic(Dart_handle adart, size_type amark=INVALID_MARK)
-    { return Dart_of_involution_inv_basic_range<i,dim>(*this,adart,amark); }
-    //--------------------------------------------------------------------------
-    template<unsigned int i,int dim>
-    Dart_of_involution_inv_basic_const_range<i,dim>
-    darts_of_involution_inv_basic(Dart_const_handle adart, size_type amark=INVALID_MARK) const
-    { return Dart_of_involution_inv_basic_const_range<i,dim>
-        (*this,adart,amark); }
-    //--------------------------------------------------------------------------
-    template<unsigned int i>
-    Dart_of_involution_inv_basic_range<i,Self::dimension>
-    darts_of_involution_inv_basic(Dart_handle adart, size_type amark=INVALID_MARK)
-    { return Dart_of_involution_inv_basic_range<i,Self::dimension>
-        (*this,adart,amark); }
-    //--------------------------------------------------------------------------
-    template<unsigned int i>
-    Dart_of_involution_inv_basic_const_range<i,Self::dimension>
-    darts_of_involution_inv_basic(Dart_const_handle adart, size_type amark=INVALID_MARK) const
-    { return Dart_of_involution_inv_basic_const_range<i,Self::dimension>
-        (*this,adart,amark); }
-    //**************************************************************************
-    // Dart_of_involution_range
-    template<unsigned int i,int dim=Self::dimension>
-    struct Dart_of_involution_range: public CGAL::CMap_range
-    <Self, CGAL::CMap_dart_iterator_of_involution<Self,i,dim>,
-     CGAL::CMap_dart_const_iterator_of_involution<Self,i,dim> >
-    {
-      typedef CGAL::CMap_range
-      <Self, CGAL::CMap_dart_iterator_of_involution<Self,i,dim>,
-       CGAL::CMap_dart_const_iterator_of_involution<Self,i,dim> > Base;
-
-      Dart_of_involution_range(Self &amap, Dart_handle adart) :
-        Base(amap, adart)
-      {}
-    };
-    //**************************************************************************
-    // Dart_of_involution_const_range
-    template<unsigned int i,int dim=Self::dimension>
-    struct Dart_of_involution_const_range: public CMap_const_range
-    <Self, CGAL::CMap_dart_const_iterator_of_involution<Self,i,dim> >
-    {
-      typedef CMap_const_range
-      <Self, CGAL::CMap_dart_const_iterator_of_involution<Self,i,dim> > Base;
-
-      Dart_of_involution_const_range(const Self &amap,
-                                     Dart_const_handle adart):
-        Base(amap, adart)
-      {}
-    };
-    //**************************************************************************
-    template<unsigned int i,int dim>
-    Dart_of_involution_range<i,dim>
-    darts_of_involution(Dart_handle adart)
-    { return Dart_of_involution_range<i,dim>(*this,adart); }
-    //--------------------------------------------------------------------------
-    template<unsigned int i,int dim>
-    Dart_of_involution_const_range<i,dim>
-    darts_of_involution(Dart_const_handle adart) const
-    { return Dart_of_involution_const_range<i,dim>(*this,adart); }
-    //--------------------------------------------------------------------------
-    template<unsigned int i>
-    Dart_of_involution_range<i,Self::dimension>
-    darts_of_involution(Dart_handle adart)
-    { return Dart_of_involution_range<i,Self::dimension>(*this,adart); }
-    //--------------------------------------------------------------------------
-    template<unsigned int i>
-    Dart_of_involution_const_range<i,Self::dimension>
-    darts_of_involution(Dart_const_handle adart) const
-    { return Dart_of_involution_const_range<i,Self::dimension>(*this,adart); }
-    //**************************************************************************
-    // Dart_of_involution_inv_range
-    template<unsigned int i,int dim=Self::dimension>
-    struct Dart_of_involution_inv_range: public CGAL::CMap_range
-    <Self, CGAL::CMap_dart_iterator_of_involution_inv<Self,i,dim>,
-     CGAL::CMap_dart_const_iterator_of_involution_inv<Self,i,dim> >
-    {
-      typedef CGAL::CMap_range
-      <Self, CGAL::CMap_dart_iterator_of_involution_inv<Self,i,dim>,
-       CGAL::CMap_dart_const_iterator_of_involution_inv<Self,i,dim> > Base;
-
-      Dart_of_involution_inv_range(Self &amap, Dart_handle adart) :
-        Base(amap, adart)
-      {}
-    };
-    //**************************************************************************
-    // Dart_of_involution_inv_const_range
-    template<unsigned int i,int dim=Self::dimension>
-    struct Dart_of_involution_inv_const_range: public CMap_const_range
-    <Self, CGAL::CMap_dart_const_iterator_of_involution_inv<Self,i,dim> >
-    {
-      typedef CMap_const_range
-      <Self, CGAL::CMap_dart_const_iterator_of_involution_inv<Self,i,dim> >
-      Base;
-
-      Dart_of_involution_inv_const_range(const Self &amap,
-                                         Dart_const_handle adart):
-        Base(amap, adart)
-      {}
-    };
-    //**************************************************************************
-    template<unsigned int i,int dim>
-    Dart_of_involution_inv_range<i,dim>
-    darts_of_involution_inv(Dart_handle adart)
-    { return Dart_of_involution_inv_range<i,dim>(*this,adart); }
-    //--------------------------------------------------------------------------
-    template<unsigned int i,int dim>
-    Dart_of_involution_inv_const_range<i,dim>
-    darts_of_involution_inv(Dart_const_handle adart) const
-    { return Dart_of_involution_inv_const_range<i,dim>(*this,adart); }
-    //--------------------------------------------------------------------------
-    template<unsigned int i>
-    Dart_of_involution_inv_range<i,Self::dimension>
-    darts_of_involution_inv(Dart_handle adart)
-    { return Dart_of_involution_inv_range<i,Self::dimension>(*this,adart); }
-    //--------------------------------------------------------------------------
-    template<unsigned int i>
-    Dart_of_involution_inv_const_range<i,Self::dimension>
-    darts_of_involution_inv(Dart_const_handle adart) const
-    { return Dart_of_involution_inv_const_range<i,Self::dimension>
-        (*this,adart); }
-    //**************************************************************************
-    // Dart_basic_range
-    struct Dart_basic_range {
-      typedef CGAL::CMap_dart_iterator_basic_of_all<Self> iterator;
-      typedef CGAL::CMap_dart_const_iterator_basic_of_all<Self> const_iterator;
-      Dart_basic_range(Self &amap) : mmap(amap)
-      {}
-      iterator begin() { return iterator(mmap); }
-      iterator end()   { return iterator(mmap,mmap.null_handle); }
-      const_iterator begin() const { return const_iterator(mmap); }
-      const_iterator end() const   { return const_iterator(mmap,mmap.null_handle); }
-      size_type size() const
-      { return mmap.number_of_darts(); }
-      bool empty() const
-      { return mmap.is_empty(); }
-    private:
-      Self & mmap;
-    };
-    //**************************************************************************
-    // Dart_basic_const_range
-    struct Dart_basic_const_range {
-      typedef CGAL::CMap_dart_const_iterator_basic_of_all<Self> const_iterator;
-      Dart_basic_const_range(Self &amap) : mmap(amap)
-      {}
-      const_iterator begin() const { return const_iterator(mmap); }
-      const_iterator end() const   { return const_iterator(mmap,mmap.null_handle); }
-      size_type size() const
-      { return mmap.number_of_darts(); }
-      bool empty() const
-      { return mmap.is_empty(); }
-    private:
-      const Self & mmap;
-    };
-    //**************************************************************************
-    Dart_basic_range darts_basic()
-    { return Dart_basic_range(*this); }
-    //--------------------------------------------------------------------------
-    Dart_basic_const_range darts_basic() const
-    { return Dart_basic_const_range(*this); }
-    //**************************************************************************
-    // One_dart_per_incident_cell_range
-    template<unsigned int i,unsigned int j,int dim=Self::dimension>
-    struct One_dart_per_incident_cell_range: public CGAL::CMap_range
-    <Self, CGAL::CMap_one_dart_per_incident_cell_iterator<Self,i,j,dim>,
-     CGAL::CMap_one_dart_per_incident_cell_const_iterator<Self,i,j,dim> >
-    {
-      typedef CGAL::CMap_range
-      <Self, CGAL::CMap_one_dart_per_incident_cell_iterator<Self,i,j,dim>,
-       CGAL::CMap_one_dart_per_incident_cell_const_iterator<Self,i,j,dim> >
-      Base;
-
-      One_dart_per_incident_cell_range(Self &amap, Dart_handle adart):
-        Base(amap, adart)
-      {}
-    };
-    //**************************************************************************
-    // One_dart_per_incident_cell_const_range
-    template<unsigned int i,unsigned int j,int dim=Self::dimension>
-    struct One_dart_per_incident_cell_const_range: public CMap_const_range
-    <Self, CGAL::CMap_one_dart_per_incident_cell_const_iterator<Self,i,j,dim> >
-    {
-      typedef CMap_const_range
-      <Self, CGAL::CMap_one_dart_per_incident_cell_const_iterator
-      <Self,i,j,dim> > Base;
-
-      One_dart_per_incident_cell_const_range(const Self &amap,
-                                             Dart_const_handle adart) :
-        Base(amap, adart)
-      {}
-    };
-    //**************************************************************************
-    // One_dart_per_cell_range
-    template<unsigned int i,int dim=Self::dimension>
-    struct One_dart_per_cell_range {
-      typedef CGAL::CMap_one_dart_per_cell_iterator<Self,i,dim> iterator;
-      typedef CGAL::CMap_one_dart_per_cell_const_iterator<Self,i,dim>
-      const_iterator;
-      One_dart_per_cell_range(Self &amap) : mmap(amap), msize(0)
-      {}
-      iterator begin() { return iterator(mmap); }
-      iterator end()   { return iterator(mmap,mmap.null_handle); }
-      const_iterator begin() const { return const_iterator(mmap); }
-      const_iterator end() const   { return const_iterator(mmap,mmap.null_handle); }
-      size_type size() const
-      {
-        if (msize==0)
-          for ( const_iterator it=begin(), itend=end(); it!=itend; ++it)
-            ++msize;
-        return msize;
-      }
-      bool empty() const
-      { return mmap.is_empty(); }
-    private:
-      Self & mmap;
-      mutable size_type msize;
-    };
-    //**************************************************************************
-    // One_dart_per_cell_const_range
-    template<unsigned int i,int dim=Self::dimension>
-    struct One_dart_per_cell_const_range {
-      typedef CGAL::CMap_one_dart_per_cell_const_iterator<Self,i,dim>
-      const_iterator;
-      One_dart_per_cell_const_range(const Self &amap) : mmap(amap), msize(0)
-      {}
-      const_iterator begin() const { return const_iterator(mmap); }
-      const_iterator end() const   { return const_iterator(mmap,mmap.null_handle); }
-      size_type size() const
-      {
-        if (msize==0)
-          for ( const_iterator it=begin(), itend=end(); it!=itend; ++it)
-            ++msize;
-        return msize;
-      }
-      bool empty() const
-      { return mmap.is_empty(); }
-    private:
-      const Self & mmap;
-      mutable size_type msize;
-    };
-    //**************************************************************************
-    /// @return a range on the i-cells incindent to the given j-cell.
-    template<unsigned int i, unsigned int j, int dim>
-    One_dart_per_incident_cell_range<i,j,dim>
-    one_dart_per_incident_cell(Dart_handle adart)
-    { return One_dart_per_incident_cell_range<i,j,dim>(*this,adart); }
-    //--------------------------------------------------------------------------
-    template<unsigned int i, unsigned int j, int dim>
-    One_dart_per_incident_cell_const_range<i,j,dim>
-    one_dart_per_incident_cell(Dart_const_handle adart) const
-    { return One_dart_per_incident_cell_const_range<i,j,dim>(*this,adart); }
-    //--------------------------------------------------------------------------
-    template<unsigned int i, unsigned int j>
-    One_dart_per_incident_cell_range<i,j,Self::dimension>
-    one_dart_per_incident_cell(Dart_handle adart)
-    { return one_dart_per_incident_cell<i,j,Self::dimension>(adart); }
-    //--------------------------------------------------------------------------
-    template<unsigned int i, unsigned int j>
-    One_dart_per_incident_cell_const_range<i,j,Self::dimension>
-    one_dart_per_incident_cell(Dart_const_handle adart) const
-    { return one_dart_per_incident_cell<i,j,Self::dimension>(adart); }
-    //--------------------------------------------------------------------------
-    /// @return a range on all the i-cells
-    template<unsigned int i, int dim>
-    One_dart_per_cell_range<i,dim> one_dart_per_cell()
-    { return One_dart_per_cell_range<i,dim>(*this); }
-    //--------------------------------------------------------------------------
-    template<unsigned int i, int dim>
-    One_dart_per_cell_const_range<i,dim> one_dart_per_cell() const
-    { return One_dart_per_cell_const_range<i,dim>(*this); }
-    //--------------------------------------------------------------------------
-    template<unsigned int i>
-    One_dart_per_cell_range<i,Self::dimension> one_dart_per_cell()
-    { return one_dart_per_cell<i,Self::dimension>(); }
-    //--------------------------------------------------------------------------
-    template<unsigned int i>
-    One_dart_per_cell_const_range<i,Self::dimension> one_dart_per_cell() const
-    { return one_dart_per_cell<i,Self::dimension>(); }
-    //--------------------------------------------------------------------------
-
-  public:
-
-    /** Compute the dual of a Combinatorial_map.
-     * @param amap the cmap in which we build the dual of this map.
-     * @param adart a dart of the initial map, NULL by default.
-     * @return adart of the dual map, the dual of adart if adart!=NULL,
-     *         any dart otherwise.
-     * As soon as we don't modify this map and amap map, we can iterate
-     * simultaneously through all the darts of the two maps and we have
-     * each time of the iteration two "dual" darts.
-     */
-    Dart_handle dual(Self& amap, Dart_handle adart=null_handle)
-    {
-      CGAL_assertion( is_without_boundary(dimension) );
-
-      CGAL::Unique_hash_map< Dart_handle, Dart_handle,
-        typename Self::Hash_function > dual;
-      Dart_handle d, d2, res = amap.null_handle;
-
-      // We clear amap. TODO return a new amap ?
-      amap.clear();
-
-      // We create a copy of all the dart of the map.
-      for ( typename Dart_range::iterator it=darts().begin();
-            it!=darts().end(); ++it)
-      {
-        dual[it] = amap.create_dart();
-        if ( it==adart && res==amap.null_handle ) res = dual[it];
-      }
-
-      // Then we link the darts by using the dual formula :
-      // G(B,b1,b2,...,bn-1,bn) =>
-      //    dual(G)=(B, b(n-1)obn, b(n-2)obn,...,b1obn, bn)
-      // We suppose darts are run in the same order for both maps.
-      typename Dart_range::iterator it2=amap.darts().begin();
-      for ( typename Dart_range::iterator it=darts().begin();
-            it!=darts().end(); ++it, ++it2)
-      {
-        d = it2; // The supposition on the order allows to avoid d=dual[it];
-        CGAL_assertion( it2==dual[it] );
-
-        // First case outside the loop since we need to use link_beta1
-        if ( amap.template is_free<1>(d) &&
-             beta<dimension, dimension-1>(it)!=null_dart_handle )
-          amap.basic_link_beta_1(d, dual[beta<dimension, dimension-1>(it)]);
-
-        // and during the loop we use link_beta(d1,d2,i)
-        for ( unsigned int i=dimension-2; i>=1; --i)
-        {
-          if ( amap.is_free(d,dimension-i) &&
-               beta(it, dimension, i)!=null_dart_handle )
-            amap.basic_link_beta(d, dual[beta(it, dimension, i)], dimension-i);
-        }
-        if ( amap.template is_free<dimension>(d) )
-        {
-          CGAL_assertion ( !this->template is_free<dimension>(it) );
-          amap.basic_link_beta(d, dual[beta<dimension>(it)], dimension);
-        }
-      }
-
-      //  CGAL_postcondition(amap2.is_valid());
-
-      if ( res==amap.null_handle ) res = amap.darts().begin();
-      return res;
-    }
-
-
-    /** Test if the connected component of cmap containing dart dh1 is
-     *  isomorphic to the connected component of map2 containing dart dh2,
-     *  starting from dh1 and dh2.
-     * @param dh1  initial dart for this map
-     * @param map2 the second combinatorial map
-     * @param dh2  initial dart for map2
-     * @param testAttributes Boolean to test the equality of attributes (true)
-     *                       or not (false)
-     * @return true iff the cc of map is isomorphic to the cc of map2 starting
-     *     from dh1 and dh2; by testing the equality of attributes if
-     *     testAttributes is true
-     */
-    template <unsigned int d2, typename Refs2, typename Items2, class Alloc2,
-              class Storage2>
-    bool are_cc_isomorphic(Dart_const_handle dh1,
-                           const Combinatorial_map_base
-                           <d2,Refs2,Items2,Alloc2, Storage2>& map2,
-                           typename Combinatorial_map_base
-                           <d2,Refs2,Items2,Alloc2, Storage2>::Dart_const_handle dh2,
-                           bool testAttributes=true) const
-    {
-      // CGAL_assertion(dimension==map2.dimension);
-      typedef Combinatorial_map_base<d2,Refs2,Items2,Alloc2, Storage2> Map2;
-
-      bool match = true;
-
-      // Two stacks used to run through the two maps.
-      std::deque< Dart_const_handle > toTreat1;
-      std::deque< typename Map2::Dart_const_handle > toTreat2;
-
-      size_type m1 = get_new_mark();
-      size_type m2 = map2.get_new_mark();
-
-      toTreat1.push_back(dh1);
-      toTreat2.push_back(dh2);
-
-      Dart_const_handle current;
-      typename Map2::Dart_const_handle other;
-
-      unsigned int i = 0;
-      CGAL::Unique_hash_map<Dart_const_handle,
-                            typename Map2::Dart_const_handle,
-                            typename Self::Hash_function> bijection;
-
-      if ( testAttributes )
-      {
-        internal::Test_is_same_attribute_functor<Self, Map2>::
-            value = true;
-        internal::Test_is_same_attribute_functor<Map2, Self>::
-            value = true;
-      }
-
-      while (match && !toTreat1.empty())
-      {
-        // Next dart
-        current = toTreat1.front();
-        toTreat1.pop_front();
-        other = toTreat2.front();
-        toTreat2.pop_front();
-
-        if (!is_marked(current, m1))
-        {
-          if (map2.is_marked(other, m2))
-            match=false;
-          else
-          {
-            bijection[current] = other;
-
-            mark(current, m1);
-            map2.mark(other, m2);
-
-            if (testAttributes)
-            {
-              // We need to test in both direction because
-              // Foreach_enabled_attributes only test non void attributes
-              // of Self.
-              Helper::template Foreach_enabled_attributes
-                < internal::Test_is_same_attribute_functor<Self, Map2> >::
-                run(this,&map2,current, other);
-              Map2::Helper::template Foreach_enabled_attributes
-                < internal::Test_is_same_attribute_functor<Map2, Self> >::
-                run(&map2,this,other, current);
-              if ( !internal::Test_is_same_attribute_functor<Self, Map2>::
-                   value ||
-                   !internal::Test_is_same_attribute_functor<Map2, Self>::
-                   value )
-                match=false;
-            }
-
-            // We test if the injection is valid with its neighboors.
-            // We go out as soon as it is not satisfied.
-            for (i = 0; match && i <= dimension; ++i)
-            {
-              if ( i>map2.dimension )
-              {
-                if (!is_free(current,i)) match=false;
-              }
-              else
-              {
-                if (is_free(current,i))
-                {
-                  if (!map2.is_free(other,i))
-                    match = false;
-                }
-                else
-                {
-                  if (map2.is_free(other,i))
-                    match = false;
-                  else
-                  {
-                    if (is_marked(beta(current,i), m1) !=
-                        map2.is_marked(map2.beta(other,i), m2))
-                      match = false;
-                    else
-                    {
-                      if (!is_marked(beta(current,i), m1))
-                      {
-                        toTreat1.push_back(beta(current,i));
-                        toTreat2.push_back(map2.beta(other,i));
-                      }
-                      else
-                      {
-                        if (bijection[beta(current,i)]!=map2.beta(other,i))
-                          match = false;
-                      }
-                    }
-                  }
-                }
-              }
-            }
-            // Now we test if the second map has more beta links than the first
-            for ( i=dimension+1; match && i<=map2.dimension; ++i )
-            {
-              if (!map2.is_free(other,i)) match=false;
-            }
-          }
-        }
-        else
-        {
-          if (!map2.is_marked(other, m2))
-            match = false;
-        }
-      }
-
-      // Here we test if both queue are empty
-      if ( !toTreat1.empty() || !toTreat2.empty() ) match = false;
-
-      // Here we unmark all the marked darts.
-      toTreat1.clear();
-      toTreat2.clear();
-
-      toTreat1.push_back(dh1);
-      toTreat2.push_back(dh2);
-
-      while (!toTreat1.empty())
-      {
-        current = toTreat1.front();
-        toTreat1.pop_front();
-        other = toTreat2.front();
-        toTreat2.pop_front();
-
-        unmark(current, m1);
-        map2.unmark(other, m2);
-
-        for (i = 0; match && i <= dimension; ++i)
-        {
-          if (!is_free(current,i) && is_marked(beta(current,i), m1))
-          {
-            CGAL_assertion(!map2.is_free(other,i) &&
-                           map2.is_marked(map2.beta(other,i), m2));
-            toTreat1.push_back(beta(current,i));
-            toTreat2.push_back(map2.beta(other,i));
-          }
-        }
-      }
-
-      free_mark(m1);
-      map2.free_mark(m2);
-
-      return match;
-    }
-
-    /** Test if this cmap is isomorphic to map2.
-     * @pre cmap is connected.
-     * @param map2 the second combinatorial map
-     * @param testAttributes Boolean to test the equality of attributes (true)
-     *                       or not (false)
-     * @return true iff this map is isomorphic to map2, testing the equality
-     *         of attributes if testAttributes is true
-     */
-    template <unsigned int d2, typename Refs2, typename Items2, class Alloc2,
-              class Storage2>
-    bool is_isomorphic_to(const Combinatorial_map_base
-                          <d2,Refs2,Items2,Alloc2, Storage2>& map2,
-                          bool testAttributes=true)
-    {
-      // if ( dimension!=map2.dimension ) return false;
-
-      Dart_const_handle d1=darts().begin();
-
-      for (typename Combinatorial_map_base<d2,Refs2,Items2,Alloc2, Storage2>::
-             Dart_range::const_iterator it(map2.darts().begin()),
-             itend(map2.darts().end()); it!=itend; ++it)
-      {
-        if (are_cc_isomorphic(d1, map2, it, testAttributes))
-        {
-          return true;
-        }
-      }
-
-      return false;
-    }
-
-    /** Test if the attributes of this map are automatically updated.
-     * @return true iff the boolean automatic_attributes_management is set to true.
-     */
-    bool are_attributes_automatically_managed() const
-    {
-      return automatic_attributes_management;
-    }
-
-    /** Sets the automatic_attributes_management boolean.
-     */
-    void set_automatic_attributes_management(bool newval)
-    {
-      if (this->automatic_attributes_management == false && newval == true)
-      {
-        correct_invalid_attributes();
-      }
-
-      this->automatic_attributes_management = newval;
-    }
-
-  protected:
-    /// Number of times each mark is reserved. 0 if the mark is free.
-    mutable size_type mnb_times_reserved_marks[NB_MARKS];
-
-    /// Mask marks to know the value of unmark dart, for each index i.
-    mutable std::bitset<NB_MARKS> mmask_marks;
-
-    /// Number of used marks.
-    mutable size_type mnb_used_marks;
-
-    /// Index of each mark, in mfree_marks_stack or in mfree_marks_stack.
-    mutable size_type mindex_marks[NB_MARKS];
-
-    /// "Stack" of free marks.
-    mutable size_type mfree_marks_stack[NB_MARKS];
-
-    /// "Stack" of used marks.
-    mutable size_type mused_marks_stack[NB_MARKS];
-
-    /// Number of marked darts for each used marks.
-    mutable size_type mnb_marked_darts[NB_MARKS];
-
-    /// Automatic management of the attributes:
-    /// true means attributes are always maintained updated during operations.
-    bool automatic_attributes_management;
-
-    /// Tuple of unary and binary functors (for all non void attributes).
-    typename Helper::Split_functors m_onsplit_functors;
-    typename Helper::Merge_functors m_onmerge_functors;
-  };
-
-  template < unsigned int d_,
-             class Items_=Combinatorial_map_min_items<d_>,
-             class Alloc_=CGAL_ALLOCATOR(int),
-             class Storage_= Combinatorial_map_storage_1<d_, Items_, Alloc_> >
-  class Combinatorial_map :
-    public Combinatorial_map_base<d_,
-                                  Combinatorial_map<d_,Items_,Alloc_, Storage_>,
-                                  Items_, Alloc_, Storage_ >
-  {
-  public:
-    typedef Combinatorial_map<d_, Items_,Alloc_, Storage_>  Self;
-    typedef Combinatorial_map_base<d_, Self, Items_, Alloc_, Storage_> Base;
-
-    typedef typename Base::Dart_handle Dart_handle;
-    typedef typename Base::Dart_const_handle Dart_const_handle;
-    typedef typename Base::Alloc Alloc;
-    typedef typename Base::Exception_no_more_available_mark
-    Exception_no_more_available_mark;
-
-    Combinatorial_map() : Base()
-    {}
-
-    Combinatorial_map(const Self & amap) : Base()
-    { Base::template copy<Self>(amap); }
-
-    template < class CMap >
-    Combinatorial_map(const CMap & amap)
-    { Base::template copy<CMap>(amap); }
-
-    template < class CMap, typename Converters >
-    Combinatorial_map(const CMap & amap, const Converters& converters)
-    { Base::template copy<CMap, Converters>
-          (amap, converters); }
-
-    template < class CMap, typename Converters, typename Pointconverter >
-    Combinatorial_map(const CMap & amap, const Converters& converters,
-                      const Pointconverter& pointconverter)
-    { Base::template copy<CMap, Converters, Pointconverter>
-          (amap, converters, pointconverter); }
-  };
-
-} // namespace CGAL
-
-
-#endif // CGAL_COMBINATORIAL_MAP_H //
-// EOF //
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Combinatorial_map_constructors.h b/3rdparty/CGAL-4.8/include/CGAL/Combinatorial_map_constructors.h
deleted file mode 100644
index e1b0bf5..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Combinatorial_map_constructors.h
+++ /dev/null
@@ -1,298 +0,0 @@
-// Copyright (c) 2010-2011 CNRS and LIRIS' Establishments (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Guillaume Damiand <guillaume.damiand at liris.cnrs.fr>
-//
-#ifndef CGAL_COMBINATORIAL_MAP_CONSTRUCTORS_H
-#define CGAL_COMBINATORIAL_MAP_CONSTRUCTORS_H 1
-
-#include <CGAL/Combinatorial_map_basic_operations.h>
-
-namespace CGAL {
-
-  /** @file Combinatorial_map_constructors.h
-   * Basic creation operations  for a combinatorial map.
-   * Create edge, triangle, quadrilateral, tetrahedron, hexahedron.
-   */
-
-  /** Create an edge.
-   * @param amap the used combinatorial map.
-   * @return a dart of the new edge.
-   */
-  template < class Map >
-  typename Map::Dart_handle make_edge(Map& amap)
-  {
-    typename Map::Dart_handle d1 = amap.create_dart();
-    typename Map::Dart_handle d2 = amap.create_dart();
-    amap.basic_link_beta_for_involution(d1, d2, 2);
-    return d1;
-  }
-
-  /** Create a combinatorial polygon of length alg 
-   * (a cycle of alg darts beta1 links together).
-   * @param amap the used combinatorial map.
-   * @return a new dart.
-   */
-  template < class Map >
-  typename Map::Dart_handle make_combinatorial_polygon(Map& amap, 
-                                                       unsigned int alg)
-  {
-    CGAL_assertion(alg>0);
-  
-    typename Map::Dart_handle start = amap.create_dart();
-    typename Map::Dart_handle prev = start;
-    for ( unsigned int nb=1; nb<alg; ++nb )
-    {
-      typename Map::Dart_handle cur = amap.create_dart();
-      amap.basic_link_beta_1(prev, cur);
-      prev=cur;
-    }
-  
-    amap.basic_link_beta_1(prev, start);
-    return start;
-  }
-
-/** Test if a face is a combinatorial polygon of length alg
- *  (a cycle of alg darts beta1 links together).
- * @param amap the used combinatorial map.
- * @param adart an intial dart
- * @return true iff the face containing adart is a polygon of length alg.
- */
-template < class Map >
-bool is_face_combinatorial_polygon(const Map& amap,
-                                   typename Map::Dart_const_handle adart,
-                                   unsigned int alg)
-{
-  CGAL_assertion(alg>0);
-
-  unsigned int nb = 0;
-  typename Map::Dart_const_handle cur = adart;
-  do
-  {
-    ++nb;
-    if ( cur==amap.null_dart_handle ) return false; // Open face
-    cur = amap.beta(cur,1);
-  }
-  while( cur!=adart );
-  return (nb==alg);
-}
-
-  /** Create a combinatorial tetrahedron from 4 triangles.
-   * @param amap the used combinatorial map.
-   * @param d1 a dart onto a first triangle.
-   * @param d2 a dart onto a second triangle.
-   * @param d3 a dart onto a third triangle.
-   * @param d4 a dart onto a fourth triangle.
-   * @return a new dart.
-   */
-  template < class Map >
-  typename Map::Dart_handle 
-  make_combinatorial_tetrahedron(Map& amap,
-                                 typename Map::Dart_handle d1,
-                                 typename Map::Dart_handle d2,
-                                 typename Map::Dart_handle d3,
-                                 typename Map::Dart_handle d4)
-  {
-    amap.basic_link_beta_for_involution(d1, d2, 2);
-    amap.basic_link_beta_for_involution(d3, amap.beta(d2, 0), 2);
-    amap.basic_link_beta_for_involution(amap.beta(d1, 1), amap.beta(d3, 0), 2);
-    amap.basic_link_beta_for_involution(d4, amap.beta(d2, 1), 2);
-    amap.basic_link_beta_for_involution(amap.beta(d4, 0), amap.beta(d3, 1), 2);
-    amap.basic_link_beta_for_involution(amap.beta(d4, 1), amap.beta(d1, 0), 2);
-
-    return d1;
-  }
-
-/** Test if a volume is a combinatorial tetrahedron.
- * @param amap the used combinatorial map.
- * @param adart an intial dart
- * @return true iff the volume containing adart is a combinatorial tetrahedron.
- */
-template < class Map >
-bool is_volume_combinatorial_tetrahedron(const Map& amap,
-                                         typename Map::Dart_const_handle d1)
-{
-  typename Map::Dart_const_handle d2 = amap.beta(d1, 2);
-  typename Map::Dart_const_handle d3 = amap.beta(d2, 0, 2);
-  typename Map::Dart_const_handle d4 = amap.beta(d2, 1, 2);
-
-  if ( d1==amap.null_dart_handle || d2==amap.null_dart_handle ||
-       d3==amap.null_dart_handle || d4==amap.null_dart_handle ) return false;
-
-  if ( !is_face_combinatorial_polygon(amap, d1, 3) ||
-       !is_face_combinatorial_polygon(amap, d2, 3) ||
-       !is_face_combinatorial_polygon(amap, d3, 3) ||
-       !is_face_combinatorial_polygon(amap, d4, 3) ) return false;
-
-  // TODO do better with marks (?).
-  if ( belong_to_same_cell<Map,2,1>(amap, d1, d2) ||
-       belong_to_same_cell<Map,2,1>(amap, d1, d3) ||
-       belong_to_same_cell<Map,2,1>(amap, d1, d4) ||
-       belong_to_same_cell<Map,2,1>(amap, d2, d3) ||
-       belong_to_same_cell<Map,2,1>(amap, d2, d4) ||
-       belong_to_same_cell<Map,2,1>(amap, d3, d4) ) return false;
-
-  if ( amap.beta(d1,1,2)!=amap.beta(d3,0) ||
-       amap.beta(d4,0,2)!=amap.beta(d3,1) ||
-       amap.beta(d4,1,2)!=amap.beta(d1,0) ) return false;
-
-  return true;
-}
-
-
-  /** Create a new combinatorial tetrahedron.
-   * @param amap the used combinatorial map.
-   * @return a new dart.
-   */
-  template < class Map >
-  typename Map::Dart_handle make_combinatorial_tetrahedron(Map& amap)
-  {
-    typename Map::Dart_handle d1 = make_combinatorial_polygon(amap,3);
-    typename Map::Dart_handle d2 = make_combinatorial_polygon(amap,3);
-    typename Map::Dart_handle d3 = make_combinatorial_polygon(amap,3);
-    typename Map::Dart_handle d4 = make_combinatorial_polygon(amap,3);
-
-    return make_combinatorial_tetrahedron(amap, d1, d2, d3, d4);
-  }
-
-  /** Create a combinatorial hexahedron from 6 quadrilaterals.
-   * @param amap the used combinatorial map.
-   * @param d1 a dart onto a first quadrilateral.
-   * @param d2 a dart onto a second quadrilateral.
-   * @param d3 a dart onto a third quadrilateral.
-   * @param d4 a dart onto a fourth quadrilateral.
-   * @param d5 a dart onto a fifth quadrilateral.
-   * @param d6 a dart onto a sixth quadrilateral.
-   * @return a dart of the new cuboidal_cell. 
-   */
-  template < class Map >
-  typename Map::Dart_handle 
-  make_combinatorial_hexahedron(Map& amap,
-                                typename Map::Dart_handle d1,
-                                typename Map::Dart_handle d2,
-                                typename Map::Dart_handle d3,
-                                typename Map::Dart_handle d4,
-                                typename Map::Dart_handle d5,
-                                typename Map::Dart_handle d6)
-  {
-    amap.basic_link_beta_for_involution(d1,
-                                        amap.beta(d4, 1, 1), 2);
-    amap.basic_link_beta_for_involution(amap.beta(d1, 1),
-                                        amap.beta(d6, 0)    , 2);
-    amap.basic_link_beta_for_involution(amap.beta(d1, 1, 1),
-                                        d2                  , 2);
-    amap.basic_link_beta_for_involution(amap.beta(d1, 0),
-                                        d5                  , 2);
-
-    amap.basic_link_beta_for_involution(d3,
-                                        amap.beta(d2, 1, 1), 2);
-    amap.basic_link_beta_for_involution(amap.beta(d3, 1),
-                                        amap.beta(d6, 1)         , 2);
-    amap.basic_link_beta_for_involution(amap.beta(d3, 1, 1),
-                                        d4                  , 2);
-    amap.basic_link_beta_for_involution(amap.beta(d3, 0),
-                                        amap.beta(d5, 1, 1), 2);
-
-    amap.basic_link_beta_for_involution(d6,
-                                        amap.beta(d4, 1)         , 2);
-    amap.basic_link_beta_for_involution(amap.beta(d6, 1, 1),
-                                        amap.beta(d2, 1)         , 2);
-
-    amap.basic_link_beta_for_involution(amap.beta(d5, 0),
-                                        amap.beta(d4, 0)         , 2);
-    amap.basic_link_beta_for_involution(amap.beta(d5, 1),
-                                        amap.beta(d2, 0)         , 2);
-
-    return d1;
-  }
-
-/** Test if a volume is a combinatorial hexahedron.
- * @param amap the used combinatorial map.
- * @param adart an intial dart
- * @return true iff the volume containing adart is a combinatorial hexahedron.
- */
-template < class Map >
-bool is_volume_combinatorial_hexahedron(const Map& amap,
-                                        typename Map::Dart_const_handle d1)
-{
-  typename Map::Dart_const_handle d2 = amap.beta(d1, 1, 1, 2);
-  typename Map::Dart_const_handle d3 = amap.beta(d2, 1, 1, 2);
-  typename Map::Dart_const_handle d4 = amap.beta(d3, 1, 1, 2);
-  typename Map::Dart_const_handle d5 = amap.beta(d1, 0, 2);
-  typename Map::Dart_const_handle d6 = amap.beta(d4, 1, 2);
-
-  if ( d1==amap.null_dart_handle || d2==amap.null_dart_handle ||
-       d3==amap.null_dart_handle || d4==amap.null_dart_handle ||
-       d5==amap.null_dart_handle || d6==amap.null_dart_handle ) return false;
-
-  if (!is_face_combinatorial_polygon(amap, d1, 4) ||
-      !is_face_combinatorial_polygon(amap, d2, 4) ||
-      !is_face_combinatorial_polygon(amap, d3, 4) ||
-      !is_face_combinatorial_polygon(amap, d4, 4) ||
-      !is_face_combinatorial_polygon(amap, d5, 4) ||
-      !is_face_combinatorial_polygon(amap, d6, 4) ) return false;
-
-  // TODO do better with marks.
-  if ( belong_to_same_cell<Map,2,1>(amap, d1, d2) ||
-       belong_to_same_cell<Map,2,1>(amap, d1, d3) ||
-       belong_to_same_cell<Map,2,1>(amap, d1, d4) ||
-       belong_to_same_cell<Map,2,1>(amap, d1, d5) ||
-       belong_to_same_cell<Map,2,1>(amap, d1, d6) ||
-       belong_to_same_cell<Map,2,1>(amap, d2, d3) ||
-       belong_to_same_cell<Map,2,1>(amap, d2, d4) ||
-       belong_to_same_cell<Map,2,1>(amap, d2, d5) ||
-       belong_to_same_cell<Map,2,1>(amap, d2, d6) ||
-       belong_to_same_cell<Map,2,1>(amap, d3, d4) ||
-       belong_to_same_cell<Map,2,1>(amap, d3, d5) ||
-       belong_to_same_cell<Map,2,1>(amap, d3, d6) ||
-       belong_to_same_cell<Map,2,1>(amap, d4, d5) ||
-       belong_to_same_cell<Map,2,1>(amap, d4, d6) ||
-       belong_to_same_cell<Map,2,1>(amap, d5, d6) )
-    return false;
-
-  if ( amap.beta(d1,2)    !=amap.beta(d4,1,1) ||
-       amap.beta(d1,1,2)  !=amap.beta(d6,0)   ||
-       amap.beta(d3,1,2)  !=amap.beta(d6,1)   ||
-       amap.beta(d3,0,2)  !=amap.beta(d5,1,1) ||
-       amap.beta(d6,1,1,2)!=amap.beta(d2,1)   ||
-       amap.beta(d5,0,2)  !=amap.beta(d4,0)   ||
-       amap.beta(d5,1,2)  !=amap.beta(d2,0) ) return false;
-
-  return true;
-}
-
-  /** Create a new combinatorial hexahedron.
-   * @param amap the used combinatorial map.
-   * @return a new dart. 
-   */
-  template < class Map >
-  typename Map::Dart_handle make_combinatorial_hexahedron(Map& amap)
-  {
-    typename Map::Dart_handle d1 = make_combinatorial_polygon(amap,4);
-    typename Map::Dart_handle d2 = make_combinatorial_polygon(amap,4);
-    typename Map::Dart_handle d3 = make_combinatorial_polygon(amap,4);
-    typename Map::Dart_handle d4 = make_combinatorial_polygon(amap,4);
-    typename Map::Dart_handle d5 = make_combinatorial_polygon(amap,4);
-    typename Map::Dart_handle d6 = make_combinatorial_polygon(amap,4);
-
-    return make_combinatorial_hexahedron(amap, d1, d2, d3, d4, d5, d6);
-  }
-  
-} // namespace CGAL
-
-#endif // CGAL_COMBINATORIAL_MAP_CONSTRUCTORS_H //
-// EOF //
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Combinatorial_map_insertions.h b/3rdparty/CGAL-4.8/include/CGAL/Combinatorial_map_insertions.h
deleted file mode 100644
index 613188a..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Combinatorial_map_insertions.h
+++ /dev/null
@@ -1,729 +0,0 @@
-// Copyright (c) 2010-2011 CNRS and LIRIS' Establishments (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Guillaume Damiand <guillaume.damiand at liris.cnrs.fr>
-//
-#ifndef CGAL_COMBINATORIAL_MAP_INSERTIONS_H
-#define CGAL_COMBINATORIAL_MAP_INSERTIONS_H
-
-#include <deque>
-
-namespace CGAL
-{
-/** @file Combinatorial_map_insertions.h
- * Insertion operations on combinatorial map.
- */
-
-/** Insert a vertex in a given edge.
- * @param amap the used combinatorial map.
- * @param adart a dart of the edge (!=NULL && !=null_dart_handle).
- * @param update_attributes a boolean to update the enabled attributes
- *        (deprecated, now we use are_attributes_automatically_managed())
- * @return a dart of the new vertex.
- */
-template<class CMap>
-typename CMap::Dart_handle
-insert_cell_0_in_cell_1( CMap& amap, typename CMap::Dart_handle adart,
-                         typename CMap::template
-                         Attribute_handle<0>::type ah=CMap::null_handle,
-                         bool update_attributes=true )
-{
-  typename CMap::Dart_handle d1, d2;
-  typename CMap::size_type  mark=amap.get_new_mark();
-
-  // 1) We store all the darts of the edge.
-  std::deque<typename CMap::Dart_handle> vect;
-  typename CMap::size_type m=amap.get_new_mark();
-  {
-    for ( typename CMap::template Dart_of_cell_basic_range<1>::iterator
-          it=amap.template darts_of_cell_basic<1>(adart, m).begin();
-          it != amap.template darts_of_cell_basic<1>(adart, m).end(); ++it )
-      vect.push_back(it);
-  }
-
-  // 2) For each dart of the cell, we modify link of neighbors.
-  typename std::deque<typename CMap::Dart_handle>::iterator it = vect.begin();
-  for (; it != vect.end(); ++it)
-  {
-    d1 = amap.create_dart();
-
-    if (!amap.template is_free<1>(*it))
-    { amap.basic_link_beta_1(d1, amap.template beta<1>(*it)); }
-
-    for ( unsigned int dim=2; dim<=CMap::dimension; ++dim )
-    {
-      if (!amap.is_free(*it, dim) && amap.is_marked(amap.beta(*it, dim), mark))
-      {
-        amap.basic_link_beta_for_involution(amap.beta(*it, dim), d1, dim);
-        amap.basic_link_beta_for_involution(*it, amap.beta(*it, dim, 1), dim);
-      }
-    }
-
-    amap.basic_link_beta_1(*it, d1);
-
-    if (amap.are_attributes_automatically_managed() && update_attributes)
-    {
-      // We copy all the attributes except for dim=0
-      CMap::Helper::template Foreach_enabled_attributes_except
-        <CGAL::internal::Group_attribute_functor_of_dart<CMap>, 0>::
-        run(&amap,*it,d1);
-    }
-    if (ah != CMap::null_handle)
-    {
-      // We initialise the 0-atttrib to ah
-      CGAL::internal::Set_i_attribute_of_dart_functor<CMap, 0>::
-          run(&amap, d1, ah);
-    }
-    amap.mark(*it, mark);
-  }
-
-  for (it = vect.begin(); it != vect.end(); ++it)
-  {
-    amap.unmark(*it, m);
-    amap.unmark(*it, mark);
-  }
-
-  CGAL_assertion(amap.is_whole_map_unmarked(m));
-  CGAL_assertion(amap.is_whole_map_unmarked(mark));
-
-  amap.free_mark(m);
-  amap.free_mark(mark);
-
-  if (amap.are_attributes_automatically_managed() && update_attributes)
-  {
-    CGAL::internal::Degroup_attribute_functor_run<CMap, 1>::
-      run(&amap, adart, amap.template beta<1>(adart));
-  }
-
-#ifdef CGAL_CMAP_TEST_VALID_INSERTIONS
-  CGAL_assertion( amap.is_valid() );
-#endif
-
-  return amap.template beta<1>(adart);
-}
-
-/** Insert a vertex in the given 2-cell which is splitted in triangles,
- * once for each inital edge of the facet.
- * @param amap the used combinatorial map.
- * @param adart a dart of the facet to triangulate.
- * @param update_attributes a boolean to update the enabled attributes
- *        (deprecated, now we use are_attributes_automatically_managed())
- * @return A dart incident to the new vertex.
- */
-template < class CMap >
-typename CMap::Dart_handle
-insert_cell_0_in_cell_2( CMap& amap, typename CMap::Dart_handle adart,
-                         typename CMap::template
-                         Attribute_handle<0>::type ah=CMap::null_handle,
-                         bool update_attributes=true )
-{
-  CGAL_assertion(adart!=amap.null_dart_handle);
-
-  typename CMap::Dart_handle first=adart, prev=amap.null_handle,
-    cur=amap.null_handle, next=amap.null_handle,
-    n1=amap.null_handle, n2=amap.null_handle,
-    nn1=amap.null_handle, nn2=amap.null_handle;
-
-  // If the facet is open, we search the dart 0-free
-  while ( !amap.template is_free<0>(first) &&
-          amap.template beta<0>(first)!=adart )
-    first = amap.template beta<0>(first);
-
-  // Mark used to mark darts already treated.
-  typename CMap::size_type treated = amap.get_new_mark();
-
-  // Stack of marked darts
-  std::deque<typename CMap::Dart_handle> tounmark;
-
-  // Now we run through the facet
-  cur = first;
-  do
-  {
-    next = amap.template beta<1>(cur);
-    amap.mark(cur, treated);
-    tounmark.push_back(cur);
-
-    if (!amap.template is_free<0>(cur))
-    {
-      n1=amap.create_dart();
-      amap.link_beta_0(cur, n1);
-    }
-    else n1 = amap.null_handle;
-
-    if (!amap.template is_free<1>(cur))
-    {
-      n2 = amap.create_dart();
-      amap.link_beta_1(cur, n2);
-    }
-    else n2 = amap.null_handle;
-
-    if ( n1!=amap.null_handle )
-    {
-      if ( n2!=amap.null_handle )
-        amap.basic_link_beta_0(n1, n2);
-
-      if ( prev!=amap.null_handle )
-        amap.template basic_link_beta_for_involution<2>(prev, n1);
-
-      if (amap.are_attributes_automatically_managed() && update_attributes)
-      {
-        CGAL::internal::Set_i_attribute_of_dart_functor<CMap, 0>::
-            run(&amap, n1, ah);
-      }
-    }
-
-    for (unsigned int dim=3; dim<=CMap::dimension; ++dim)
-    {
-      if ( !amap.is_free(adart, dim) )
-      {
-        if ( !amap.is_marked(amap.beta(cur, dim), treated) )
-        {
-          if (n1!=amap.null_handle)
-          {
-            nn1=amap.create_dart();
-            amap.link_beta_1(amap.beta(cur, dim), nn1);
-            amap.basic_link_beta_for_involution(n1, nn1, dim);
-          }
-          else nn1=amap.null_handle;
-
-          if (n2!=amap.null_handle)
-          {
-            nn2=amap.create_dart();
-            amap.link_beta_0(amap.beta(cur, dim), nn2);
-            amap.basic_link_beta_for_involution(n2, nn2, dim);
-            if (amap.are_attributes_automatically_managed() && update_attributes)
-            {
-              CGAL::internal::Set_i_attribute_of_dart_functor<CMap, 0>::
-                  run(&amap, nn2, ah);
-            }
-          }
-          else nn2=amap.null_handle;
-
-          if (nn1 != amap.null_handle && nn2 != amap.null_handle)
-            amap.basic_link_beta_1(nn1, nn2);
-
-          if (nn1 != amap.null_handle && prev != amap.null_handle)
-            amap.template basic_link_beta_for_involution<2>
-              (nn1, amap.beta(prev, dim));
-
-          amap.mark(amap.beta(cur, dim), treated);
-        }
-        else
-        {
-          if ( n1!=amap.null_handle )
-            amap.basic_link_beta_for_involution(n1,
-                                                amap.beta(cur, dim, 1), dim);
-          if ( n2!=amap.null_handle )
-            amap.basic_link_beta_for_involution(n2,
-                                                amap.beta(cur, dim, 0), dim);
-        }
-      }
-    }
-
-    prev = n2;
-    cur = next;
-  }
-  while(cur!=first && cur!=amap.null_dart_handle);
-
-  if (n2 != amap.null_handle)
-  {
-    amap.template basic_link_beta_for_involution<2>
-        (amap.template beta<0>(first), n2);
-    for (unsigned int dim=3; dim<=CMap::dimension; ++dim)
-    {
-      if ( !amap.is_free(adart, dim) )
-      {
-        amap.template basic_link_beta_for_involution<2>
-          (amap.beta(first, 0, dim), amap.beta(n2, dim));
-      }
-    }
-  }
-
-  // Now we unmark all marked darts, and we degroup the new faces with the
-  // initial one (if 2-attributes are non void).
-  for ( typename std::deque<typename CMap::Dart_handle>::iterator
-        itd=tounmark.begin(); itd!=tounmark.end(); ++itd )
-  {
-    amap.unmark(*itd, treated);
-    for (unsigned int dim=3; dim<=CMap::dimension; ++dim)
-    {
-      if ( !amap.is_free(*itd, dim) )
-        amap.unmark(amap.beta(*itd, dim), treated);
-    }
-    if ( *itd!=adart )
-      if (amap.are_attributes_automatically_managed() && update_attributes)
-      {
-        CGAL::internal::Degroup_attribute_functor_run<CMap, 2>::
-            run(&amap, adart, *itd);
-      }
-  }
-
-  CGAL_assertion(amap.is_whole_map_unmarked(treated));
-  amap.free_mark(treated);
-
-#ifdef CGAL_CMAP_TEST_VALID_INSERTIONS
-  CGAL_assertion( amap.is_valid() );
-#endif
-
-  return n1;
-}
-/** Insert a dangling edge in a 2-cell between given by a dart.
- * @param amap the used combinatorial map.
- * @param adart1 a first dart of the facet (!=NULL && !=null_dart_handle).
- * @param update_attributes a boolean to update the enabled attributes
- *        (deprecated, now we use are_attributes_automatically_managed())
- * @return a dart of the new edge, not incident to the vertex of adart1.
- */
-template<class CMap>
-typename CMap::Dart_handle
-insert_dangling_cell_1_in_cell_2( CMap& amap,
-                                  typename CMap::Dart_handle adart1,
-                                  typename CMap::template
-                                  Attribute_handle<0>::type ah=CMap::null_handle,
-                                  bool update_attributes=true )
-{
-  typename CMap::size_type mark1 = amap.get_new_mark();
-  std::deque<typename CMap::Dart_handle> to_unmark;
-  {
-    for ( CMap_dart_iterator_basic_of_cell<CMap,0> it(amap,adart1,mark1);
-          it.cont(); ++it )
-    {
-      to_unmark.push_back(it);
-      amap.mark(it,mark1);
-    }
-  }
-
-  typename CMap::Dart_handle d1 = amap.null_handle;
-  typename CMap::Dart_handle d2 = amap.null_handle;
-  unsigned int s1 = 0;
-
-  typename CMap::size_type treated=amap.get_new_mark();
-
-  CGAL::CMap_dart_iterator_basic_of_involution<CMap,1>
-      it1(amap, adart1, treated);
-
-  for ( ; it1.cont(); ++it1)
-  {
-    d1 = amap.create_dart();
-    d2 = amap.create_dart();
-
-    if ( amap.is_marked(it1, mark1) ) s1 = 0;
-    else s1 = 1;
-
-    if ( !amap.is_free(it1, s1) )
-    {
-      if ( s1==0 )
-        amap.link_beta_1(amap.template beta<0>(it1), d2);
-      else
-        amap.link_beta_0(amap.template beta<1>(it1), d2);
-    }
-
-    if (s1==0)
-    {
-      amap.link_beta_0(it1, d1);
-      amap.link_beta_0(d1, d2);
-    }
-    else
-    {
-      amap.link_beta_1(it1, d1);
-      amap.link_beta_1(d1, d2);
-    }
-
-    amap.template basic_link_beta_for_involution<2>(d1, d2);
-
-    for ( unsigned int dim=3; dim<=CMap::dimension; ++dim)
-    {
-      if ( !amap.is_free(it1, dim) &&
-           amap.is_marked(amap.beta(it1, dim), treated) )
-      {
-        amap.basic_link_beta_for_involution
-          (amap.beta(it1, dim, CGAL_BETAINV(s1)), d1, dim);
-        amap.basic_link_beta_for_involution
-          (amap.beta(it1, dim, CGAL_BETAINV(s1), 2), d2, dim);
-      }
-    }
-    if (amap.are_attributes_automatically_managed() && update_attributes)
-    {
-      CGAL::internal::Set_i_attribute_of_dart_functor<CMap, 0>::
-          run(&amap, d1, ah);
-    }
-    amap.mark(it1, treated);
-  }
-
-  amap.negate_mark(treated);
-  for ( it1.rewind(); it1.cont(); ++it1 )
-  { amap.mark(it1, treated); }
-
-  CGAL_assertion( amap.is_whole_map_marked(treated) );
-  amap.free_mark(treated);
-
-  for ( typename std::deque<typename CMap::Dart_handle>::iterator
-        it=to_unmark.begin(); it!=to_unmark.end(); ++it)
-  { amap.unmark(*it, mark1); }
-
-  CGAL_assertion( amap.is_whole_map_unmarked(mark1) );
-  amap.free_mark(mark1);
-
-#ifdef CGAL_CMAP_TEST_VALID_INSERTIONS
-  CGAL_assertion( amap.is_valid() );
-#endif
-
-  return amap.template beta<0>(adart1);
-}
-
-/** Test if an edge can be inserted onto a 2-cell between two given darts.
- * @param amap the used combinatorial map.
- * @param adart1 a first dart.
- * @param adart2 a second dart.
- * @return true iff an edge can be inserted between adart1 and adart2.
- */
-template < class CMap >
-bool is_insertable_cell_1_in_cell_2(const CMap& amap,
-                                    typename CMap::Dart_const_handle adart1,
-                                    typename CMap::Dart_const_handle adart2)
-{
-  if ( adart1==adart2 ) return false;
-  for ( CGAL::CMap_dart_const_iterator_of_orbit<CMap,1> it(amap,adart1);
-        it.cont(); ++it )
-  {
-    if ( it==adart2 )  return true;
-  }
-  return false;
-}
-
-/** Insert an edge in a 2-cell between two given darts.
- * @param amap the used combinatorial map.
- * @param adart1 a first dart of the facet (!=NULL && !=null_dart_handle).
- * @param adart2 a second dart of the facet. If NULL insert a dangling edge.
- * @param update_attributes a boolean to update the enabled attributes
- *        (deprecated, now we use are_attributes_automatically_managed())
- * @return a dart of the new edge, and not incident to the
- *         same vertex than adart1.
- */
-template<class CMap>
-typename CMap::Dart_handle
-insert_cell_1_in_cell_2(CMap& amap,
-                        typename CMap::Dart_handle adart1,
-                        typename CMap::Dart_handle adart2,
-                        bool update_attributes=true)
-{
-  if ( adart2==amap.null_handle )
-    return insert_dangling_cell_1_in_cell_2(amap,adart1);
-
-  CGAL_assertion(is_insertable_cell_1_in_cell_2<CMap>(amap, adart1, adart2));
-
-  typename CMap::size_type m1=amap.get_new_mark();
-  CGAL::CMap_dart_iterator_basic_of_involution<CMap,1> it1(amap, adart1, m1);
-
-  typename CMap::size_type m2=amap.get_new_mark();
-  CGAL::CMap_dart_iterator_basic_of_involution<CMap,1> it2(amap, adart2, m2);
-
-  typename CMap::size_type mark1=amap.get_new_mark();
-  std::deque<typename CMap::Dart_handle> to_unmark;
-  {
-    for ( CGAL::CMap_dart_iterator_basic_of_cell<CMap,0> it(amap,adart1,mark1);
-          it.cont(); ++it )
-    {
-      to_unmark.push_back(it);
-      amap.mark(it, mark1);
-    }
-  }
-
-  typename CMap::Dart_handle d1=amap.null_handle;
-  typename CMap::Dart_handle d2=amap.null_handle;
-  unsigned int s1=0;
-
-  typename CMap::size_type treated=amap.get_new_mark();
-
-  for ( ; it1.cont(); ++it1, ++it2)
-  {
-    CGAL_assertion (it2.cont() );
-    d1 = amap.create_dart();
-    d2 = amap.create_dart();
-
-    if ( amap.is_marked(it1, mark1) ) s1 = 0;
-    else s1 = 1;
-
-    if ( !amap.is_free(it1, s1) )
-    {
-      if ( s1==0 ) amap.link_beta_1(amap.template beta<0>(it1), d2);
-      else amap.link_beta_0(amap.template beta<1>(it1), d2);
-    }
-
-    if ( !amap.is_free(it2, s1) )
-    {
-      if ( s1==0 ) amap.link_beta_1(amap.template beta<0>(it2), d1);
-      else amap.link_beta_0(amap.template beta<1>(it2), d1);
-    }
-
-    if ( s1==0 )
-    {
-      amap.link_beta_0(it1, d1);
-      amap.link_beta_0(it2, d2);
-    }
-    else
-    {
-      amap.link_beta_1(it1, d1);
-      amap.link_beta_1(it2, d2);
-    }
-    amap.template basic_link_beta_for_involution<2>(d2, d1);
-
-    for ( unsigned int dim=3; dim<=CMap::dimension; ++dim)
-    {
-      if ( !amap.is_free(it1, dim) &&
-           amap.is_marked(amap.beta(it1, dim), treated) )
-      {
-        amap.basic_link_beta_for_involution
-          (amap.beta(it1, dim, CGAL_BETAINV(s1)), d1, dim);
-        amap.basic_link_beta_for_involution
-          (amap.beta(it1, dim, CGAL_BETAINV(s1), 2), d2, dim);
-      }
-    }
-
-    amap.mark(it1,treated);
-  }
-
-  if (amap.are_attributes_automatically_managed() && update_attributes)
-  {
-    CGAL::internal::Degroup_attribute_functor_run<CMap, 2>::run(&amap, d1, d2);
-  }
-
-  amap.negate_mark(m1);
-  amap.negate_mark(m2);
-  it1.rewind(); it2.rewind();
-  for ( ; it1.cont(); ++it1, ++it2)
-  {
-    amap.mark(it1,m1);
-    amap.unmark(it1,treated);
-    amap.mark(it2,m2);
-  }
-  amap.negate_mark(m1);
-  amap.negate_mark(m2);
-  CGAL_assertion( amap.is_whole_map_unmarked(m1) );
-  CGAL_assertion( amap.is_whole_map_unmarked(m2) );
-  CGAL_assertion( amap.is_whole_map_unmarked(treated) );
-  amap.free_mark(m1);
-  amap.free_mark(m2);
-  amap.free_mark(treated);
-
-  typename std::deque<typename CMap::Dart_handle>::iterator it =
-    to_unmark.begin();
-  for (; it != to_unmark.end(); ++it)
-  { amap.unmark(*it, mark1); }
-  CGAL_assertion( amap.is_whole_map_unmarked(mark1) );
-  amap.free_mark(mark1);
-
-#ifdef CGAL_CMAP_TEST_VALID_INSERTIONS
-  CGAL_assertion( amap.is_valid() );
-#endif
-
-  return amap.template beta<0>(adart1);
-}
-
-/** Test if a 2-cell can be inserted onto a given 3-cell along
- * a path of edges.
- * @param amap the used combinatorial map.
- * @param afirst iterator on the begining of the path.
- * @param alast  iterator on the end of the path.
- * @return true iff a 2-cell can be inserted along the path.
- */
-template <class CMap, class InputIterator>
-bool is_insertable_cell_2_in_cell_3(const CMap& amap,
-                                    InputIterator afirst,
-                                    InputIterator alast)
-{
-  CGAL_assertion( CMap::dimension>= 3 );
-
-  // The path must have at least one dart.
-  if (afirst==alast) return false;
-  typename CMap::Dart_const_handle prec = amap.null_handle;
-  typename CMap::Dart_const_handle od = amap.null_handle;
-
-  for (InputIterator it(afirst); it!=alast; ++it)
-  {
-    // The path must contain only non empty darts.
-    if (*it == amap.null_handle || *it==amap.null_dart_handle) return false;
-
-    // Two consecutive darts of the path must belong to two edges
-    // incident to the same vertex of the same volume.
-    if (prec != amap.null_handle)
-    {
-      od = amap.other_extremity(prec);
-      if ( od==amap.null_handle ) return false;
-
-      // of and *it must belong to the same vertex of the same volume
-      if ( !CGAL::belong_to_same_cell<CMap, 0, 2>(amap, od, *it) )
-        return false;
-    }
-    prec = *it;
-  }
-
-  // The path must be closed.
-  od = amap.other_extremity(prec);
-  if ( od==amap.null_handle ) return false;
-
-  if (!CGAL::belong_to_same_cell<CMap, 0, 2>(amap, od, *afirst))
-    return false;
-
-  return true;
-}
-
-/** Insert a 2-cell in a given 3-cell along a path of darts.
- * @param amap the used combinatorial map.
- * @param afirst iterator on the begining of the path.
- * @param alast  iterator on the end of the path.
- * @param update_attributes a boolean to update the enabled attributes
- *        (deprecated, now we use are_attributes_automatically_managed())
- * @return a dart of the new 2-cell.
- */
-template<class CMap, class InputIterator>
-typename CMap::Dart_handle
-insert_cell_2_in_cell_3(CMap& amap, InputIterator afirst, InputIterator alast,
-                        bool update_attributes=true)
-{
-  CGAL_assertion(is_insertable_cell_2_in_cell_3(amap,afirst,alast));
-
-  typename CMap::Dart_handle prec = amap.null_handle, d = amap.null_handle,
-    dd = amap.null_handle, first = amap.null_handle;
-  bool withBeta3 = false;
-
-  {
-    for (InputIterator it(afirst); !withBeta3 && it!=alast; ++it)
-    {
-      if (!amap.template is_free<2>(*it)) withBeta3 = true;
-    }
-  }
-
-  {
-    for (InputIterator it(afirst); it!=alast; ++it)
-    {
-      d = amap.create_dart();
-      if ( withBeta3 )
-        dd = amap.create_dart();
-
-      if (prec != amap.null_handle)
-      {
-        amap.basic_link_beta_0(prec, d);
-        if (withBeta3)
-          amap.basic_link_beta_1(amap.template beta<3>(prec), dd);
-      }
-      else first = d;
-
-      if ( !amap.template is_free<2>((*it)) )
-        amap.template basic_link_beta_for_involution<2>
-            (amap.template beta<2>(*it), dd);
-
-      amap.template link_beta_for_involution<2>(*it, d);
-      if ( withBeta3 )
-        amap.template link_beta_for_involution<3>(d, dd);
-
-      prec = d;
-    }
-  }
-
-  amap.basic_link_beta_0(prec, first);
-  if ( withBeta3 )
-  {
-    amap.basic_link_beta_1(amap.template beta<3>(prec),
-                           amap.template beta<3>(first));
-  }
-
-  // Make copies of the new facet for dimension >=4
-  for ( unsigned int dim=4; dim<=CMap::dimension; ++dim )
-  {
-    if ( !amap.is_free(first, dim) )
-    {
-      typename CMap::Dart_handle first2 = amap.null_handle;
-      prec = amap.null_handle;
-      for ( CMap_dart_iterator_basic_of_orbit<CMap, 1> it(amap, first);
-            it.cont(); ++it )
-      {
-        d = amap.create_dart();
-        amap.basic_link_beta_for_involution(amap.template beta<2>(it), d, dim);
-        if ( withBeta3 )
-        {
-          dd = amap.create_dart();
-          amap.basic_link_beta_for_involution
-            (amap.template beta<2,3>(it), dd, dim);
-          amap.template basic_link_beta_for_involution<3>(d, dd);
-        }
-        if ( prec!=amap.null_handle )
-        {
-          amap.link_beta_0(prec, d);
-          if ( withBeta3 )
-          {
-            amap.basic_link_beta_1(amap.template beta<3>(prec), dd);
-          }
-        }
-        else first2 = prec;
-
-        // We consider dim2=2 out of the loop to use link_beta instead of
-        // basic _link_beta (to modify non void attributes only once).
-        if ( !amap.template is_free<2>(it) &&
-             amap.is_free(amap.template beta<2>(it), dim) )
-          amap.template link_beta_for_involution<2>
-            (amap.beta(it,2,dim), d);
-        if ( withBeta3 &&
-             !amap.template is_free<2>(amap.template beta<3>(it)) &&
-             amap.is_free(amap.template beta<3,2>(it), dim) )
-          amap.template link_beta_for_involution<2>(amap.beta(it,3,2,dim), dd);
-
-        for ( unsigned int dim2=3; dim2<=CMap::dimension; ++dim2 )
-        {
-          if ( dim2+1!=dim && dim2!=dim && dim2!=dim+1 )
-          {
-            if ( !amap.is_free(it, dim2) && amap.is_free(amap.beta(it, dim2), dim) )
-              amap.basic_link_beta_for_involution(amap.beta(it, dim2, dim),
-                                                  d, dim2);
-            if ( withBeta3 && !amap.is_free(amap.template beta<3>(it), dim2) &&
-                 amap.is_free(amap.beta(it, 3, dim2), dim) )
-              amap.basic_link_beta_for_involution
-                (amap.beta(it, 3, dim2, dim), dd, dim2);
-          }
-        }
-        prec = d;
-      }
-      amap.basic_link_beta_0( prec, first2 );
-      if ( withBeta3 )
-      {
-        amap.basic_link_beta_1( amap.template beta<3>(prec),
-                                amap.template beta<3>(first2) );
-      }
-    }
-  }
-
-  // Degroup the attributes
-  if ( withBeta3 )
-  { // Here we cannot use Degroup_attribute_functor_run as new darts do not
-    // have their 3-attribute
-    if (amap.are_attributes_automatically_managed() && update_attributes)
-    {
-      CGAL::internal::Degroup_attribute_functor_run<CMap, 3>::
-          run(&amap, first, amap.template beta<3>(first));
-    }
-  }
-
-#ifdef CGAL_CMAP_TEST_VALID_INSERTIONS
-  CGAL_assertion( amap.is_valid() );
-#endif
-
-  return first;
-}
-
-} // namespace CGAL
-
-#endif // CGAL_COMBINATORIAL_MAP_INSERTIONS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Combinatorial_map_iterators_base.h b/3rdparty/CGAL-4.8/include/CGAL/Combinatorial_map_iterators_base.h
deleted file mode 100644
index 4ad8b8c..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Combinatorial_map_iterators_base.h
+++ /dev/null
@@ -1,616 +0,0 @@
-// Copyright (c) 2010-2011 CNRS and LIRIS' Establishments (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Guillaume Damiand <guillaume.damiand at liris.cnrs.fr>
-//
-#ifndef CGAL_COMBINATORIAL_MAP_ITERATORS_BASE_HH
-#define CGAL_COMBINATORIAL_MAP_ITERATORS_BASE_HH 1
-
-#include <CGAL/Compact_container.h>
-#include <queue>
-#include <boost/mpl/if.hpp>
-#include <boost/type_traits/is_same.hpp>
-
-namespace CGAL {
-
-  /** @file Combinatorial_map_iterators_base.h
-   * Basic classes that serve as tools for definition of iterators.
-   There are 3 classes:
-   *  - CMap_dart_iterator<Map,Const> is the basic generic class defining
-   *    what is an interator on darts.
-   *  - CMap_extend_iterator<Map,Ite,Bi> to extend the given iterator by adding
-   *    the involution Bi.
-   *  - CMap_non_basic_iterator<Map_,Ite> to transform the basic iterator Ite
-   *    into the corresponding non basic iterator.
-   *  - CMap_range<Map,It,ConstIt,BasicIt> generic definition of a range
-   *    given an iterator and its const version
-   *  - CMap_const_range<Map,It,ConstIt,BasicIt> generic definition of a const
-   *    range given an iterator and its const version
-   */
-  //****************************************************************************
-  /// OperationState: type to keep the last operation used by the previous ++.
-  typedef char OperationState;
-
-  /// Enum of all the possible operations used by the ++ operator.
-  enum
-  {
-    OP_NONE = -1, ///< Beginning of the iterator (there is not yet operator++).
-    OP_BETAI,     ///< Previous op was the first beta.
-    OP_BETAI_INV, ///< Previous op was the inverse of the first beta.
-    OP_BETAJ,     ///< Previous op was the second beta.
-    OP_BETAK,     ///< Previous op was the third beta.
-    OP_BETA0I,    ///< Previous op was beta0 o the first beta.
-    OP_BETAI1,    ///< Previous op was the first beta o beta1.
-    OP_BETAIJ,    ///< Previous op was the composition of two beta.
-    OP_BETAJI,    ///< Previous op was the composition of two beta.
-    OP_BETA21,     ///< Previous op was beta21.
-    OP_JUMP,      ///< Previous op was a jump .
-    OP_POP,       ///< Previous op pop a dart from a stack or a queue.
-    OP_END        ///< Previous op go out of the iterator.
-  };
-  //****************************************************************************
-  /** Generic class of iterator onto darts.
-   * Class CMap_dart_iterator is a generic iterator. All the combinatorial
-   * map iterator classes inherit from this class (or one of its subclass).
-   */
-  template < typename Map_,bool Const=false >
-  class CMap_dart_iterator: public boost::mpl::if_c< Const,
-      typename Map_::Dart_container::const_iterator,
-      typename Map_::Dart_container::iterator>::type
-    //public internal::CC_iterator<typename Map_::Dart_container,Const>
-  {
-  public:
-    typedef CMap_dart_iterator<Map_,Const> Self;
-
-    typedef typename boost::mpl::if_c< Const,
-          typename Map_::Dart_container::const_iterator,
-          typename Map_::Dart_container::iterator>::type Base;
-
-    typedef typename boost::mpl::if_c< Const,
-                                       typename Map_::Dart_const_handle,
-                                       typename Map_::Dart_handle>::type
-                                     Dart_handle;
-    typedef typename boost::mpl::if_c< Const, const Map_,
-                                       Map_>::type Map;
-
-    typedef std::input_iterator_tag iterator_category;
-    typedef typename Base::value_type value_type;
-    typedef typename Base::difference_type difference_type;
-    typedef typename Base::pointer pointer;
-    typedef typename Base::reference reference;
-
-    /// true iff this iterator is basic
-    typedef Tag_true Basic_iterator;
-
-    typedef typename Map::size_type size_type;
-
-  public:
-    /// Main constructor.
-    CMap_dart_iterator(Map& amap, Dart_handle adart):
-      Base(adart),
-      mmap(&amap),
-      mfirst_dart(adart),
-      mprev_op(OP_NONE)
-    {}
-
-    /// == operator.
-    bool operator==(const Self& aiterator) const
-    {
-      return ( ((*this==mmap->null_handle) && (aiterator==mmap->null_handle)) ||
-               (mfirst_dart == aiterator.mfirst_dart &&
-               static_cast<const Base&>(*this)==
-                static_cast<const Base&>(aiterator)) );
-    }
-
-    /// != operator.
-    bool operator!=(const Self& aiterator) const
-    { return !operator==(aiterator); }
-
-    /// Accessor to the initial dart of the iterator.
-    Dart_handle get_first_dart() const { return mfirst_dart; }
-
-    /// Accessor to the combinatorial map.
-    Map* get_combinatorial_map() const { return mmap; }
-
-    /// Rewind of the iterator to its beginning.
-    void rewind()
-    { set_current_dart(mfirst_dart); mprev_op = OP_NONE; }
-
-    /// Test if the iterator is at its end.
-    bool cont() const
-    { return static_cast<const Base&>(*this)!=mmap->null_handle; }
-
-    /// Get the previous operation used for the last ++.
-    OperationState prev_operation()  const { return mprev_op; }
-
-  protected:
-    /// Set the current dart to a given dart
-    void set_current_dart(Dart_handle adart)
-    { Base::operator=(adart); }
-
-  private:
-    /// operator -- in private to invalidate the base operator.
-    Self& operator--()
-    { return *this; }
-    /// operator -- in private to invalidate the base operator.
-    Self operator--(int)
-    { return *this; }
-
-  protected:
-    /// test if adart->beta(ai) exists and is not marked for amark
-    bool is_unmarked(Dart_handle adart, unsigned int ai, size_type amark) const
-    { return
-#ifdef CGAL_CMAP_DEPRECATED
-        !mmap->is_free(adart,ai) && // Pb with static null_dart_handle for windows
-#endif // CGAL_CMAP_DEPRECATED
-        !mmap->is_marked(mmap->beta(adart,ai), amark);
-    }
-
-    /// test if adart->beta(ai)->beta(aj) exists
-    bool exist_betaij(Dart_handle adart, unsigned int ai, unsigned int aj) const
-    { return !mmap->is_free(adart, ai) && !mmap->is_free(mmap->beta(adart, ai), aj); }
-
-    /// test if adart->beta(ai)->beta(aj) exists and is not marked for amark
-    bool is_unmarked2(Dart_handle adart, unsigned int ai, unsigned int aj,
-                      typename Map::size_type amark) const
-    { return
-#ifdef CGAL_CMAP_DEPRECATED
-         exist_betaij(adart, ai, aj) && // Pb with static null_dart_handle for windows
-#endif // CGAL_CMAP_DEPRECATED
-        !mmap->is_marked(mmap->beta(adart, ai, aj), amark);
-    }
-
-  protected:
-    /// The map containing the darts to iterate on.
-    Map* mmap;
-
-    /// The initial dart of the iterator.
-    Dart_handle mfirst_dart;
-
-    /// The last operation used for the ++ operator.
-    OperationState mprev_op;
-  };
-  //****************************************************************************
-  /* Class CMap_extend_iterator<Map,Ite,Bi> which extend a given iterator by
-   * adding Bi and by using a stack and a mark.
-   * General case when Ite does not have already a stack.
-   */
-  template <typename Map_,typename Ite,int Bi,
-            typename Ite_has_stack=typename Ite::Use_mark>
-  class CMap_extend_iterator: public Ite
-  {
-  public:
-    typedef CMap_extend_iterator<Map_,Ite,Bi, Ite_has_stack> Self;
-    typedef Ite Base;
-
-    typedef typename Base::Dart_handle Dart_handle;
-    typedef typename Base::Map Map;
-
-    typedef Tag_true Use_mark;
-
-    typedef typename Map::size_type size_type;
-
-    CGAL_static_assertion( (Bi<=Map::dimension &&
-                            boost::is_same<Ite_has_stack,Tag_false>::value) );
-
-  public:
-    /// Main constructor.
-    CMap_extend_iterator(Map& amap, Dart_handle adart, size_type amark):
-      Base(amap, adart),
-      mmark_number(amark),
-      minitial_dart(adart)
-    {
-      if ( minitial_dart!=amap.null_handle )
-      {
-        this->mmap->mark_null_dart(mmark_number);
-        this->mmap->mark(minitial_dart, mmark_number);
-        if (!this->mmap->is_free(minitial_dart, Bi) &&
-            this->mmap->beta(minitial_dart, Bi)!=minitial_dart )
-        {
-          mto_treat.push(this->mmap->beta(minitial_dart, Bi));
-        }
-      }
-    }
-
-    /// Rewind of the iterator to its beginning.
-    void rewind()
-    {
-      CGAL_assertion(mmark_number != Map::INVALID_MARK);
-      Base::operator= ( Base(*this->mmap,minitial_dart) );
-      mto_treat = std::queue<Dart_handle>();
-      this->mmap->mark(minitial_dart, mmark_number);
-      this->mmap->mark_null_dart(mmark_number);
-      if (!this->mmap->is_free(minitial_dart, Bi) &&
-          this->mmap->beta(minitial_dart, Bi)!=minitial_dart)
-      {
-        mto_treat.push(this->mmap->beta(minitial_dart, Bi));
-      }
-    }
-
-    /// Prefix ++ operator.
-    Self& operator++()
-    {
-      CGAL_assertion(mmark_number != Map::INVALID_MARK);
-      CGAL_assertion(this->cont());
-
-      do
-      {
-        Base::operator++();
-      }
-      while ( this->cont() &&
-              this->mmap->is_marked(*this, mmark_number) );
-
-      if ( !this->cont() )
-      {
-        while ( !mto_treat.empty() &&
-                this->mmap->is_marked(mto_treat.front(), mmark_number))
-        {
-          mto_treat.pop();
-        }
-
-        if ( !mto_treat.empty() )
-        {
-          Base::operator= ( Base(*this->mmap,mto_treat.front()) );
-          mto_treat.pop();
-          this->mprev_op = OP_POP;
-          CGAL_assertion( !this->mmap->is_marked((*this), mmark_number) );
-          this->mmap->mark((*this), mmark_number);
-
-          if (
-#ifdef CGAL_CMAP_DEPRECATED
-        !this->mmap->is_free(*this, Bi) && // Pb with static null_dart_handle for windows
-#endif // CGAL_CMAP_DEPRECATED
-               !this->mmap->is_marked(this->mmap->beta(*this, Bi), mmark_number) )
-          {
-            mto_treat.push(this->mmap->beta(*this, Bi));
-          }
-        }
-      }
-      else
-      {
-        this->mmap->mark((*this), mmark_number);
-        if (
-#ifdef CGAL_CMAP_DEPRECATED
-        !this->mmap->is_free(*this, Bi) && // Pb with static null_dart_handle for windows
-#endif // CGAL_CMAP_DEPRECATED
-             !this->mmap->is_marked(this->mmap->beta(*this, Bi), mmark_number) )
-        {
-          mto_treat.push(this->mmap->beta(*this, Bi));
-        }
-      }
-
-      return *this;
-    }
-
-    /// Postfix ++ operator.
-    Self operator++(int)
-    { Self res=*this; operator ++(); return res; }
-
-  protected:
-    /// Queue of darts to process.
-    std::queue<Dart_handle> mto_treat;
-
-    /// Index of the used mark.
-    size_type mmark_number;
-
-    /// Initial dart
-    Dart_handle minitial_dart;
-  };
-  //****************************************************************************
-  /* Class CMap_extend_iterator<Map,Ite,Bi> which extend a given iterator by
-   * adding Bi and by using a stack and a mark.
-   * Specialization when Ite has already a stack.
-   */
-  template <typename Map_,typename Ite,int Bi>
-  class CMap_extend_iterator<Map_,Ite,Bi,Tag_true>: public Ite
-  {
-  public:
-    typedef CMap_extend_iterator<Map_,Ite,Bi,Tag_true> Self;
-    typedef Ite Base;
-
-    typedef typename Base::Dart_handle Dart_handle;
-    typedef typename Base::Map Map;
-
-    typedef Tag_true Use_mark;
-
-    typedef typename Map::size_type size_type;
-
-    /// Main constructor.
-    CMap_extend_iterator(Map& amap, Dart_handle adart, size_type amark):
-      Base(amap, adart, amark)
-    {
-      if ( this->minitial_dart!=amap.null_handle &&
-           !this->mmap->is_free(this->minitial_dart, Bi) &&
-           this->mmap->beta(this->minitial_dart, Bi)!=this->minitial_dart )
-      {
-        this->mto_treat.push(this->mmap->beta(this->minitial_dart, Bi));
-      }
-    }
-
-    /// Rewind of the iterator to its beginning.
-    void rewind()
-    {
-      CGAL_assertion(this->mmark_number != Map::INVALID_MARK);
-      Base::rewind();
-      if ( !this->mmap->is_free(this->minitial_dart, Bi) &&
-           this->mmap->beta(this->minitial_dart, Bi)!=this->minitial_dart )
-      {
-        this->mto_treat.push(this->mmap->beta(this->minitial_dart, Bi));
-      }
-    }
-
-    /// Prefix ++ operator.
-    Self& operator++()
-    {
-      Base::operator++();
-
-      if ( this->cont() )
-      {
-        CGAL_assertion( this->mmap->is_marked(*this, this->mmark_number) );
-
-        if (
-#ifdef CGAL_CMAP_DEPRECATED
-            !this->mmap->is_free(*this, Bi) && // Pb with static null_dart_handle for windows
-#endif // CGAL_CMAP_DEPRECATED
-            !this->mmap->is_marked(this->mmap->beta(*this, Bi), this->mmark_number) )
-        {
-          this->mto_treat.push(this->mmap->beta(*this, Bi));
-        }
-      }
-      return *this;
-    }
-
-    /// Postfix ++ operator.
-    Self operator++(int)
-    { Self res=*this; operator ++(); return res; }
-  };
-  //****************************************************************************
-  //* Class CMap_non_basic_iterator allows to transform a basic_iterator onto
-  //* a non basic one, depending if the basic iterator uses mark or not.
-  template <typename Map_,typename Basic_iterator,
-            typename Use_mark=typename Basic_iterator::Use_mark>
-  class CMap_non_basic_iterator;
-  //****************************************************************************
-  template <typename Map_,typename Base_>
-  class CMap_non_basic_iterator<Map_,Base_,Tag_true>:
-    public Base_
-  {
-  public:
-    typedef CMap_non_basic_iterator<Map_,Base_,Tag_true> Self;
-    typedef Base_ Base;
-
-    typedef typename Base::Map Map;
-    typedef typename Base::Dart_handle Dart_handle;
-
-    /// True iff this iterator is basic
-    typedef Tag_false Basic_iterator;
-
-    typedef typename Map::size_type size_type;
-
-    CGAL_static_assertion( (boost::is_same<typename Base::Basic_iterator,
-                            Tag_true>::value) );
-
-    /// Main constructor.
-    CMap_non_basic_iterator(Map& amap, Dart_handle adart1):
-      Base(amap, adart1, amap.get_new_mark())
-    {}
-
-    /// Destructor.
-    ~CMap_non_basic_iterator() CGAL_NOEXCEPT(CGAL_NO_ASSERTIONS_BOOL)
-    {
-      CGAL_destructor_assertion( this->mmark_number!=Map::INVALID_MARK );
-      if (this->mmap->get_number_of_times_mark_reserved
-          (this->mmark_number)==1)
-        unmark_treated_darts();
-      this->mmap->free_mark(this->mmark_number);
-      this->mmark_number = Map::INVALID_MARK; // To avoid basic class to try to unmark darts.
-    }
-
-    /// Copy constructor.
-    CMap_non_basic_iterator(const Self& aiterator):
-      Base(aiterator)
-    { this->mmap->share_a_mark(this->mmark_number); }
-
-    /// Assignment operator.
-    Self& operator=(const Self& aiterator)
-    {
-      if (this != &aiterator)
-      {
-        if (this->mmap->get_number_of_times_mark_reserved
-            (this->mmark_number)==1)
-          unmark_treated_darts();
-        this->mmap->free_mark(this->mmark_number);
-        this->mmark_number = Map::INVALID_MARK;
-
-        Base::operator=(aiterator);
-        this->mmap->share_a_mark(this->mmark_number);
-      }
-      return *this;
-    }
-
-    /// Rewind of the iterator to its beginning.
-    void rewind()
-    {
-      unmark_treated_darts();
-      Base::rewind();
-    }
-
-    using Base::operator++;
-
-    /// Postfix ++ operator.
-    Self operator++(int)
-    { Self res=*this; operator ++(); return res; }
-
-  protected:
-    /// Unmark all the marked darts during the iterator.
-    void unmark_treated_darts()
-    {
-      if (this->mmap->is_whole_map_unmarked(this->mmark_number)) return;
-
-      this->mmap->negate_mark(this->mmark_number);
-
-      if (this->mmap->is_whole_map_unmarked(this->mmark_number)) return;
-
-      Base::rewind();
-      while (this->mmap->number_of_unmarked_darts(this->mmark_number) > 0)
-        this->operator++();
-      this->mmap->negate_mark(this->mmark_number);
-      CGAL_assertion(this->mmap->is_whole_map_unmarked(this->mmark_number));
-    }
-  };
-  //****************************************************************************
-  template <typename Map_,typename Base_>
-  class CMap_non_basic_iterator<Map_,Base_,Tag_false>:
-    public Base_
-  {
-  public:
-    typedef CMap_non_basic_iterator<Map_,Base_,Tag_false> Self;
-    typedef Base_ Base;
-
-    typedef typename Base::Map Map;
-    typedef typename Base::Dart_handle Dart_handle;
-
-    /// True iff this iterator is basic
-    typedef Tag_false Basic_iterator;
-
-    CGAL_static_assertion( (boost::is_same<typename Base::Basic_iterator,
-                            Tag_true>::value) );
-
-    /// Main constructor.
-    CMap_non_basic_iterator(Map& amap, Dart_handle adart):
-      Base(amap, adart)
-    {}
-  };
-  //****************************************************************************
-  template <typename Map_, typename It, typename Const_it,
-            typename Basic_iterator=typename It::Basic_iterator>
-  struct CMap_range
-  {
-    typedef It iterator;
-    typedef Const_it const_iterator;
-    CMap_range(Map_ &amap, typename Map_::Dart_handle adart) :
-      mmap(amap), mdart(adart), msize(0)
-    {}
-    iterator begin()             { return iterator(mmap,mdart); }
-    iterator end()               { return iterator(mmap,mmap.null_handle); }
-    const_iterator begin() const { return const_iterator(mmap,mdart); }
-    const_iterator end() const   { return const_iterator(mmap,mmap.null_handle); }
-    typename Map_::size_type size() const
-    {
-      if (msize==0)
-        for ( const_iterator it=begin(), itend=end(); it!=itend; ++it)
-          ++msize;
-      return msize;
-    }
-    bool empty() const
-    { return mmap.is_empty(); }
-  private:
-    Map_ & mmap;
-    typename Map_::Dart_handle mdart;
-    mutable typename Map_::size_type msize;
-  };
-  //****************************************************************************
-  template <typename Map_, typename It, typename Const_it>
-  struct CMap_range<Map_,It,Const_it,Tag_true>
-  {
-    typedef CMap_range<Map_,It,Const_it,Tag_true> Base_cmap_range;
-    typedef It iterator;
-    typedef Const_it const_iterator;
-
-    typedef typename Map_::size_type size_type;
-
-    CMap_range(Map_ &amap, typename Map_::Dart_handle adart, size_type amark=Map_::INVALID_MARK):
-      mmap(amap), mdart(adart), msize(0), mmark(amark)
-    {}
-    iterator begin()             { return iterator(mmap,mdart,mmark); }
-    iterator end()               { return iterator(mmap,mmap.null_handle,mmark); }
-    const_iterator begin() const { return const_iterator(mmap,mdart,mmark); }
-    const_iterator end() const   { return const_iterator(mmap,mmap.null_handle,mmark); }
-    typename Map_::size_type size() const
-    {
-      if (msize==0)
-        for ( CMap_non_basic_iterator<Map_,const_iterator> it(mmap,mdart);
-              it.cont(); ++it )
-          ++msize;
-      return msize;
-    }
-    bool empty() const
-    { return mmap.is_empty(); }
-  private:
-    Map_ & mmap;
-    typename Map_::Dart_handle mdart;
-    mutable typename Map_::size_type msize;
-    size_type mmark;
-  };
-  //****************************************************************************
-  template <typename Map_, typename Const_it,
-            typename Basic_iterator=typename Const_it::Basic_iterator>
-  struct CMap_const_range
-  {
-    typedef Const_it const_iterator;
-    CMap_const_range(const Map_ &amap, typename Map_::Dart_const_handle adart):
-      mmap(amap), mdart(adart), msize(0)
-    {}
-    const_iterator begin() const { return const_iterator(mmap,mdart); }
-    const_iterator end() const   { return const_iterator(mmap,mmap.null_handle); }
-    typename Map_::size_type size() const
-    {
-      if (msize==0)
-        for ( const_iterator it=begin(), itend=end(); it!=itend; ++it)
-          ++msize;
-      return msize;
-    }
-    bool empty() const
-    { return mmap.is_empty(); }
-  private:
-    const Map_ & mmap;
-    typename Map_::Dart_const_handle mdart;
-    mutable typename Map_::size_type msize;
-  };
-  //****************************************************************************
-  template <typename Map_, typename Const_it>
-  struct CMap_const_range<Map_,Const_it,Tag_true>
-  {
-    typedef Const_it const_iterator;
-    typedef typename Map_::size_type size_type;
-    CMap_const_range(const Map_ &amap, typename Map_::Dart_const_handle adart,
-                     size_type amark=Map_::INVALID_MARK):
-      mmap(amap), mdart(adart), msize(0), mmark(amark)
-    {}
-    const_iterator begin() const { return const_iterator(mmap,mdart,mmark); }
-    const_iterator end() const   { return const_iterator(mmap,mmap.null_handle,mmark); }
-    typename Map_::size_type size() const
-    {
-      if (msize==0)
-        for ( CMap_non_basic_iterator<Map_,const_iterator> it(mmap,mdart);
-              it.cont(); ++it )
-          ++msize;
-      return msize;
-    }
-    bool empty() const
-    { return mmap.is_empty(); }
-  private:
-    const Map_ & mmap;
-    typename Map_::Dart_const_handle mdart;
-    mutable typename Map_::size_type msize;
-    size_type mmark;
-  };
-  //****************************************************************************
-} // namespace CGAL
-//******************************************************************************
-#endif // CGAL_COMBINATORIAL_MAP_ITERATORS_BASE_HH
-//******************************************************************************
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Combinatorial_map_operations.h b/3rdparty/CGAL-4.8/include/CGAL/Combinatorial_map_operations.h
deleted file mode 100644
index 4481c2e..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Combinatorial_map_operations.h
+++ /dev/null
@@ -1,809 +0,0 @@
-// Copyright (c) 2010-2011 CNRS and LIRIS' Establishments (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Guillaume Damiand <guillaume.damiand at liris.cnrs.fr>
-//
-#ifndef CGAL_COMBINATORIAL_MAP_OPERATIONS_H
-#define CGAL_COMBINATORIAL_MAP_OPERATIONS_H 1
-
-#include <CGAL/Combinatorial_map_basic_operations.h>
-#include <CGAL/Combinatorial_map_insertions.h>
-#include <deque>
-#include <stack>
-
-namespace CGAL
-{
-  /** @file Combinatorial_map_operations.h
-   * Some operations to modify a combinatorial map.
-   */
-
-  /** Test if an i-cell can be removed.
-   *  An i-cell can be removed if i==CMap::dimension or i==CMap::dimension-1,
-   *     or if there are at most two (i+1)-cell incident to it.
-   * @param adart a dart of the i-cell.
-   * @return true iff the i-cell can be removed.
-   */
-  template <class CMap, unsigned int i, unsigned int nmi=CMap::dimension-i>
-  struct Is_removable_functor
-  {
-    static bool run(const CMap& amap, typename CMap::Dart_const_handle adart)
-    {
-      // TODO? Optimisation for dim-2, and to not test all the darts of the cell?
-      bool res = true;
-      for ( CGAL::CMap_dart_const_iterator_of_cell<CMap,i> it(amap, adart);
-            res && it.cont(); ++it )
-      {
-        if ( amap.template beta<i+2,i+1>(it)!=
-             amap.template beta<CGAL_BETAINV(i+1),i+2>(it) )
-          res = false;
-      }
-      return res;
-    }
-  };
-  // Specialization for i=CMap::dimension
-  template <class CMap, unsigned int i>
-  struct Is_removable_functor<CMap, i, 0>
-  {
-    static bool run(const CMap&, typename CMap::Dart_const_handle)
-    { return true; }
-  };
-  // Specialization for i=CMap::dimension-1
-  template <class CMap, unsigned int i>
-  struct Is_removable_functor<CMap, i, 1>
-  {
-    static bool run(const CMap&, typename CMap::Dart_const_handle)
-    { return true; }
-  };
-  /** Test if an i-cell can be removed.
-   *  An i-cell can be removed if i==CMap::dimension or i==CMap::dimension-1,
-   *     or if there are at most two (i+1)-cell incident to it.
-   * @param adart a dart of the i-cell.
-   * @return true iff the i-cell can be removed.
-   */
-  template < class CMap, unsigned int i >
-  bool is_removable(const CMap& amap, typename CMap::Dart_const_handle adart)
-  { return CGAL::Is_removable_functor<CMap, i>::run(amap,adart); }
-
-  /** Remove an i-cell, 0<i<dimension, and merge eventually both incident
-   *  (i+1)-cells.
-   *  @param amap the used combinatorial map.
-   *  @param adart a dart of the i-cell to remove.
-   *  @param update_attributes a boolean to update the enabled attributes
-   *         (deprecated, now we use are_attributes_automatically_managed())
-   *  @return the number of deleted darts.
-   */
-  template<class CMap, unsigned int i, unsigned int nmi>
-  struct Remove_cell_functor
-  {
-    static size_t run(CMap& amap, typename CMap::Dart_handle adart, bool update_attributes)
-    {
-      CGAL_static_assertion ( 1<=i && i<CMap::dimension );
-      CGAL_assertion( (is_removable<CMap,i>(amap, adart)) );
-
-      size_t res = 0;
-
-      typename CMap::Dart_handle d1, d2;
-      typename CMap::Dart_handle dg1=amap.null_handle, dg2=amap.null_handle;
-
-      typename CMap::size_type mark = amap.get_new_mark();
-      typename CMap::size_type mark_modified_darts = amap.get_new_mark();
-
-      std::deque<typename CMap::Dart_handle> to_erase;
-
-      const int iinv = CGAL_BETAINV(i);
-
-      // First we store and mark all the darts of the i-cell to remove.
-      for ( CGAL::CMap_dart_iterator_basic_of_cell<CMap,i> it(amap,adart,mark);
-            it.cont(); ++it )
-      {
-        to_erase.push_back(it);
-        if ( !amap.template is_free<i+1>(it) && dg1==amap.null_handle )
-        { dg1=it; dg2=amap.template beta<i+1>(it); }
-        amap.mark(it, mark);
-        ++res;
-      }
-
-      if (amap.are_attributes_automatically_managed() && update_attributes)
-      {
-        // We group the two (i+1)-cells incident if they exist.
-        if ( dg1!=amap.null_handle )
-          CGAL::internal::Group_attribute_functor_run<CMap, i+1>::
-              run(&amap, dg1, dg2);
-      }
-
-      // During the operation, we store in modified_darts the darts modified
-      // to test after the loop the non void attributes that are split.
-      std::deque<typename CMap::Dart_handle> modified_darts;
-
-      // If i==1, we modify beta1, thus in modified_darts we store all
-      // the darts having beta0 modified, and in modified_darts2 all the
-      // darts having beta1 modified. For i>1 all the modified darts are
-      // stored in modified_darts.
-      std::deque<typename CMap::Dart_handle> modified_darts2;
-      std::deque<typename CMap::Dart_handle> &first_modified_darts=
-          (i==1?modified_darts2:modified_darts);
-
-      // For each dart of the i-cell, we modify i-links of neighbors.
-      typename std::deque<typename CMap::Dart_handle>::iterator it =
-          to_erase.begin();
-      for ( ; it!=to_erase.end(); ++it )
-      {
-        d1=amap.template beta<iinv>(*it);
-        while ( d1!=amap.null_dart_handle && amap.is_marked(d1, mark) )
-        {
-          d1=amap.template beta<i+1, iinv>(d1);
-          if ( d1==amap. template beta<iinv>(*it) ) d1=amap.null_dart_handle;
-        }
-
-        if ( !amap.is_marked(d1, mark_modified_darts) )
-        {
-          d2=amap.template beta<i+1,i>(*it);
-          while ( d2!=amap.null_dart_handle && amap.is_marked(d2, mark) )
-          {
-            d2=amap.template beta<i+1,i>(d2);
-            if ( d2==amap.template beta<i+1,i>(*it) )
-              d2=amap.null_dart_handle;
-          }
-
-          if ( !amap.is_marked(d2, mark_modified_darts) )
-          {
-            if ( d1!=amap.null_dart_handle )
-            {
-              if ( d2!=amap.null_dart_handle && d1!=d2 )
-              {
-                //d1->basic_link_beta(d2, i);
-                amap.template basic_link_beta<i>(d1, d2);
-                amap.mark(d1, mark_modified_darts);
-                amap.mark(d2, mark_modified_darts);
-                first_modified_darts.push_back(d1);
-                modified_darts.push_back(d2);
-                // TODO push only one out of two dart ?
-
-                /*if ( i==1 )
-                {
-                  d2->basic_link_beta(d1, 0);
-                  modified_darts.push_back(d2);
-                }*/
-                //            modified_darts2.push_back(d1);
-              }
-              else
-              {
-                if ( !amap.template is_free<i>(d1) )
-                {
-                  amap.template unlink_beta<i>(d1);
-                  CGAL_assertion( !amap.is_marked(d1, mark_modified_darts) );
-                  amap.mark(d1, mark_modified_darts);
-                  first_modified_darts.push_back(d1);
-                }
-              }
-            }
-            else if ( d2!=amap.null_dart_handle )
-            {
-              if ( !amap.template is_free<iinv>(d2) )
-              {
-                amap.template unlink_beta<iinv>(d2);
-                CGAL_assertion( !amap.is_marked(d2, mark_modified_darts) );
-                amap.mark(d2, mark_modified_darts);
-                modified_darts.push_back(d2);
-              }
-            }
-          }
-        }
-        if ( amap.template is_free<i+1>(*it) &&
-             !amap.template is_free<i>(*it) )
-        {
-          d1 = amap.template beta<i>(*it);
-          if ( !amap.template is_free<iinv>(d1) )
-          {
-            amap.template unlink_beta<iinv>(d1);
-            CGAL_assertion( !amap.is_marked(d1, mark_modified_darts) );
-            amap.mark(d1, mark_modified_darts);
-            modified_darts.push_back(d1);
-          }
-        }
-      }
-
-      if (amap.are_attributes_automatically_managed() && update_attributes)
-      {
-        // We test the split of all the incident cells for all the non
-        // void attributes.
-        if ( i==1 )
-          CMap::Helper::template Foreach_enabled_attributes_except
-              <CGAL::internal::Test_split_attribute_functor<CMap,i>, i>::
-              run(&amap, modified_darts, modified_darts2,
-                  mark_modified_darts);
-        else
-          CMap::Helper::template Foreach_enabled_attributes_except
-              <CGAL::internal::Test_split_attribute_functor<CMap,i>, i>::
-              run(&amap, modified_darts, mark_modified_darts);
-      }
-
-      // We remove all the darts of the i-cell.
-      for ( it=to_erase.begin(); it!=to_erase.end(); ++it )
-      { amap.erase_dart(*it); }
-
-      CGAL_assertion( amap.is_whole_map_unmarked(mark) );
-      amap.free_mark(mark);
-
-      // If no attribute is enabled (or if only i-attributes are enabled),
-      // the darts are not unmark by Foreach_enabled_attributes_except.
-      // Thus we unmark them now.
-      if ( !amap.is_whole_map_unmarked(mark_modified_darts) )
-      {
-        for ( typename std::deque<typename CMap::Dart_handle>::
-                iterator it=modified_darts.begin();
-              it!=modified_darts.end(); ++it )
-          amap.unmark(*it, mark_modified_darts);
-        if ( i==1 )
-        {
-          for ( typename std::deque<typename CMap::Dart_handle>::
-                  iterator it=modified_darts2.begin();
-                it!=modified_darts2.end(); ++it )
-            amap.unmark(*it, mark_modified_darts);
-        }
-      }
-
-      CGAL_assertion ( amap.is_whole_map_unmarked(mark_modified_darts) );
-      amap.free_mark(mark_modified_darts);
-
-#ifdef CGAL_CMAP_TEST_VALID_REMOVALS
-      CGAL_assertion( amap.is_valid() );
-#endif
-
-      return res;
-    }
-  };
-
-  /** Remove a d-cell, in a d-map (special case).
-   *  @param amap the used combinatorial map.
-   *  @param adart a dart of the volume to remove.
-   *  @param update_attributes a boolean to update the enabled attributes
-   *         (deprecated, now we use are_attributes_automatically_managed())
-   *  @return the number of deleted darts.
-   */
-  template<class CMap,unsigned int i>
-  struct Remove_cell_functor<CMap,i,0>
-  {
-    static size_t run(CMap& amap, typename CMap::Dart_handle adart, bool update_attributes)
-    {
-      typename CMap::size_type mark = amap.get_new_mark();
-      std::deque<typename CMap::Dart_handle> to_erase;
-      size_t res = 0;
-
-      std::deque<typename CMap::Dart_handle> modified_darts;
-
-      // We mark all the darts of the d-cell.
-      for ( CGAL::CMap_dart_iterator_basic_of_cell<CMap,CMap::dimension>
-            it(amap,adart,mark); it.cont(); ++it )
-      {
-        to_erase.push_back(it);
-        amap.mark(it,mark);
-        ++res;
-      }
-
-      // We unlink all the darts of the volume for beta-d.
-      typename std::deque<typename CMap::Dart_handle>::iterator
-        it = to_erase.begin();
-      for ( it = to_erase.begin(); it != to_erase.end(); ++it )
-      {
-        if ( !amap.template is_free<CMap::dimension>(*it) &&
-             !amap.is_marked(amap.template beta<CMap::dimension>(*it), mark) )
-        {
-          if (amap.are_attributes_automatically_managed() && update_attributes)
-          {
-            modified_darts.push_back(amap.template beta<CMap::dimension>(*it));
-          }
-          amap.template unlink_beta_for_involution<CMap::dimension>(*it);
-        }
-      }
-
-      if (amap.are_attributes_automatically_managed() && update_attributes)
-      {
-        // We test the split of all the incident cells for all the non
-        // void attributes.
-        CMap::Helper::template Foreach_enabled_attributes_except
-          <CGAL::internal::Test_split_attribute_functor<CMap,i>,
-           CMap::dimension>::run(&amap, modified_darts);
-      }
-
-      // We remove all the darts of the d-cell.
-      for ( it = to_erase.begin(); it != to_erase.end(); ++it )
-      { amap.erase_dart(*it); }
-
-      CGAL_assertion( amap.is_whole_map_unmarked(mark) );
-      amap.free_mark(mark);
-
-#ifdef CGAL_CMAP_TEST_VALID_REMOVALS
-      CGAL_assertion( amap.is_valid() );
-#endif
-
-      return res;
-    }
-  };
-
-  /** Remove a vertex, and merge eventually both incident edges.
-   * @param amap the used combinatorial map.
-   * @param adart a dart of the vertex to remove.
-   * @param update_attributes a boolean to update the enabled attributes
-   *        (deprecated, now we use are_attributes_automatically_managed())
-   * @return the number of deleted darts.
-   */
-  template<class CMap,unsigned int nmi>
-  struct Remove_cell_functor<CMap,0,nmi>
-  {
-    static size_t run(CMap& amap, typename CMap::Dart_handle adart,
-                      bool update_attributes)
-    {
-      CGAL_assertion( (is_removable<CMap,0>(amap,adart)) );
-
-      size_t res = 0;
-
-      typename CMap::Dart_handle d1, d2;
-      typename CMap::Dart_handle dg1=amap.null_handle, dg2=amap.null_handle;
-
-      typename CMap::size_type mark = amap.get_new_mark();
-
-      // First we store and mark all the darts of the 0-cell to remove.
-      std::deque<typename CMap::Dart_handle> to_erase;
-      for ( CGAL::CMap_dart_iterator_basic_of_cell<CMap,0> it(amap,adart,mark);
-            it.cont(); ++it )
-      {
-        to_erase.push_back(it);
-        if ( !amap.template is_free<0>(it) && dg1==amap.null_handle )
-        { dg1=it; dg2=amap.template beta<0>(it); }
-        amap.mark(it, mark);
-        ++res;
-      }
-
-      if (amap.are_attributes_automatically_managed() && update_attributes )
-      {
-        // We group the two edges incident if they exist.
-        if ( dg1!=amap.null_handle )
-          CGAL::internal::Group_attribute_functor_run<CMap, 1>::
-              run(&amap, dg1, dg2);
-      }
-
-      // During the operation, we store in modified_darts the darts modified
-      // by beta0 to test after the loop non void attributes that are split.
-      std::deque<typename CMap::Dart_handle> modified_darts;
-      // And we store in modified_darts2 all the darts having beta1 modified.
-      std::deque<typename CMap::Dart_handle> modified_darts2;
-
-      // For each dart of the vertex, we modify 0 and 1-links of neighbors.
-      typename std::deque<typename CMap::Dart_handle>::iterator it =
-          to_erase.begin();
-      for ( ; it != to_erase.end(); ++it)
-      {
-        if ( !amap.template is_free<0>(*it) )
-        {
-          if ( !amap.template is_free<1>(*it) &&
-               amap.template beta<0>(*it)!=(*it) )
-          {
-            amap.basic_link_beta_1(amap.template beta<0>(*it),
-                                   amap.template beta<1>(*it));
-            if (amap.are_attributes_automatically_managed() && update_attributes)
-            {
-              modified_darts.push_back(amap.template beta<0>(*it));
-              modified_darts2.push_back(amap.template beta<1>(*it));
-              // TODO push only one out of two dart ?
-            }
-          }
-          else
-          {
-            amap.template dart_unlink_beta<1>(amap.template beta<0>(*it));
-            if (amap.are_attributes_automatically_managed() && update_attributes)
-            {
-              modified_darts.push_back(amap.template beta<0>(*it));
-            }
-          }
-
-          for ( unsigned int j=2; j<=CMap::dimension; ++j )
-          {
-            if ( !amap.is_free(*it,j) )
-            {
-              amap.basic_link_beta(amap.template beta<0>(*it),
-                                   amap.beta(*it,j), j);
-            //((*it)->beta(0))->basic_link_beta((*it)->beta(j),j);
-            }
-          }
-        }
-        else
-        {
-          if ( !amap.template is_free<1>(*it) )
-          {
-            amap.template dart_unlink_beta<0>(amap.template beta<1>(*it));
-            if (amap.are_attributes_automatically_managed() && update_attributes)
-            {
-              modified_darts2.push_back(amap.template beta<1>(*it));
-            }
-          }
-
-          for ( unsigned int j=2; j<=CMap::dimension; ++j )
-          {
-            if ( !amap.is_free(*it,j) )
-            { amap.unlink_beta(*it, j); }
-          }
-        }
-      }
-
-      if (amap.are_attributes_automatically_managed() && update_attributes)
-      {
-        // We test the split of all the incident cells for all the non
-        // void attributes.
-        CMap::Helper::template Foreach_enabled_attributes_except
-            <CGAL::internal::Test_split_attribute_functor<CMap,0>, 1>::
-            run(&amap,modified_darts, modified_darts2);
-      }
-
-      // We remove all the darts of the 0-cell.
-      for ( it=to_erase.begin(); it!=to_erase.end(); ++it )
-      { amap.erase_dart(*it); }
-
-      CGAL_assertion( amap.is_whole_map_unmarked(mark) );
-      amap.free_mark(mark);
-
-#ifdef CGAL_CMAP_TEST_VALID_REMOVALS
-      CGAL_assertion( amap.is_valid() );
-#endif
-
-      return res;
-    }
-  };
-
-  /** Remove an i-cell, 0<=i<=dimension.
-   * @param amap the used combinatorial map.
-   * @param adart a dart of the i-cell to remove.
-   * @param update_attributes a boolean to update the enabled attributes
-   * @return the number of deleted darts.
-   */
-  template < class CMap, unsigned int i >
-  size_t remove_cell(CMap& amap, typename CMap::Dart_handle adart, bool update_attributes = true)
-  {
-    return
-        CGAL::Remove_cell_functor<CMap,i,CMap::dimension-i>::run(amap,adart,update_attributes);
-  }
-
-  /** Test if an i-cell can be contracted.
-   *  An i-cell can be contracted if i==1
-   *     or if there are at most two (i-1)-cell incident to it.
-   * @param adart a dart of the i-cell.
-   * @return true iff the i-cell can be contracted.
-   */
-  template <class CMap, unsigned int i>
-  struct Is_contractible_functor
-  {
-    static bool run(const CMap& amap, typename CMap::Dart_const_handle adart)
-    {
-      // TODO ? Optimisation possible to not test all the darts of the cell ?
-      bool res = true;
-      for ( CGAL::CMap_dart_const_iterator_of_cell<CMap,i> it(amap, adart);
-            res && it.cont(); ++it )
-      {
-        if ( amap.template beta<i-2,i-1>(it)!=
-             amap.template beta<i-1,CGAL_BETAINV(i-2)>(it) )
-          res = false;
-      }
-      return res;
-    }
-  };
-  // Specialization for i=0
-  template <class CMap>
-  struct Is_contractible_functor<CMap, 0>
-  {
-    static bool run(const CMap&, typename CMap::Dart_const_handle)
-    { return false; }
-  };
-  // Specialization for i=1
-  template <class CMap>
-  struct Is_contractible_functor<CMap, 1>
-  {
-    static bool run(const CMap&, typename CMap::Dart_const_handle)
-    { return true; }
-  };
-  /** Test if an i-cell can be contracted.
-   *  An i-cell can be contracted if i==1
-   *     or if there are at most two (i-1)-cell incident to it.
-   * @param adart a dart of the i-cell.
-   * @return true iff the i-cell can be contracted.
-   */
-  template < class CMap, unsigned int i >
-  bool is_contractible(const CMap& amap, typename CMap::Dart_const_handle adart)
-  { return CGAL::Is_contractible_functor<CMap, i>::run(amap,adart); }
-
-  /** Contract an i-cell, 1<i<=dimension, and merge eventually both incident
-   *  (i-1)-cells.
-   * @param amap the used combinatorial map.
-   * @param adart a dart of the i-cell to contract.
-   * @return the number of deleted darts.
-   */
-  template<class CMap, unsigned int i>
-  struct Contract_cell_functor
-  {
-    static size_t run(CMap& amap, typename CMap::Dart_handle adart)
-    {
-      CGAL_static_assertion ( 2<=i && i<=CMap::dimension );
-      CGAL_assertion( (is_contractible<CMap,i>(amap, adart)) );
-
-      size_t res = 0;
-
-      typename CMap::Dart_handle d1, d2;
-      typename CMap::Dart_handle dg1=amap.null_handle, dg2=amap.null_handle;
-
-      typename CMap::size_type mark = amap.get_new_mark();
-      typename CMap::size_type mark_modified_darts = amap.get_new_mark();
-
-      const int imuinv = CGAL_BETAINV(i-1);
-
-      // First we store and mark all the darts of the i-cell to contract.
-      std::deque<typename CMap::Dart_handle> to_erase;
-      for ( CGAL::CMap_dart_iterator_basic_of_cell<CMap,i> it(amap,adart,mark);
-            it.cont(); ++it )
-      {
-        to_erase.push_back(it);
-        if ( !amap.template is_free<i-1>(it) && dg1==amap.null_handle )
-        { dg1=it; dg2=amap.template beta<i-1>(it); }
-        amap.mark(it, mark);
-        ++res;
-      }
-
-      if ( amap.are_attributes_automatically_managed() )
-      {
-        // We group the two (i+1)-cells incident if they exist.
-        if ( dg1!=amap.null_handle )
-          CGAL::internal::Group_attribute_functor_run<CMap,i-1>::
-            run(&amap, dg1, dg2);
-      }
-
-      // During the operation, we store in modified_darts the darts modified
-      // to test after the loop the non void attributes that are split.
-      std::deque<typename CMap::Dart_handle> modified_darts;
-
-      // For each dart of the i-cell, we modify i-links of neighbors.
-      typename std::deque<typename CMap::Dart_handle>::iterator it =
-          to_erase.begin();
-      for ( ; it!=to_erase.end(); ++it )
-      {
-        d1 = amap.template beta<i>(*it);
-        while ( d1!=amap.null_dart_handle && amap.is_marked(d1, mark) )
-        {
-          d1 = amap.template beta<imuinv,i>(d1);
-          if (d1 == amap.template beta<i>(*it)) d1 = amap.null_dart_handle;
-        }
-
-        if ( !amap.is_marked(d1, mark_modified_darts) )
-        {
-          d2 = amap.template beta<i-1,i>(*it);
-          while ( d2!=amap.null_dart_handle && amap.is_marked(d2, mark) )
-          {
-            d2 = amap.template beta<i-1,i>(d2);
-            if ( d2==amap.template beta<i-1,i>(*it) )
-              d2=amap.null_dart_handle;
-          }
-
-          if ( !amap.is_marked(d2, mark_modified_darts) )
-          {
-            if (d1 != amap.null_dart_handle)
-            {
-              if (d2 != amap.null_dart_handle && d1!=d2 )
-              {
-                amap.template basic_link_beta_for_involution<i>(d1, d2);
-                amap.mark(d1, mark_modified_darts);
-                amap.mark(d2, mark_modified_darts);
-                modified_darts.push_back(d1);
-                modified_darts.push_back(d2);
-                // TODO push only one out of two dart ?
-              }
-              else
-              {
-                if ( !amap.template is_free<i>(d1) )
-                {
-                  amap.template unlink_beta<i>(d1);
-                  CGAL_assertion( !amap.is_marked(d1, mark_modified_darts) );
-                  amap.mark(d1, mark_modified_darts);
-                  modified_darts.push_back(d1);
-                }
-              }
-            }
-            else if (d2 != amap.null_dart_handle)
-            {
-              if ( !amap.is_free(d2,i) )
-              {
-                amap.template unlink_beta<i>(d2);
-                CGAL_assertion( !amap.is_marked(d2, mark_modified_darts) );
-                amap.mark(d2, mark_modified_darts);
-                modified_darts.push_back(d2);
-              }
-            }
-          }
-        }
-        if (amap.is_free(*it,i-1) && !amap.is_free(*it,i))
-        {
-          d1 = amap.beta(*it,i);
-          if ( !amap.is_free(d1,i) )
-          {
-            amap.template unlink_beta<i>(d1);
-            CGAL_assertion( !amap.is_marked(d1, mark_modified_darts) );
-            amap.mark(d1, mark_modified_darts);
-            modified_darts.push_back(d1);
-          }
-        }
-      }
-
-      if ( amap.are_attributes_automatically_managed() )
-      {
-        // We test the split of all the incident cells for all the non
-        // void attributes.
-        CMap::Helper::template Foreach_enabled_attributes_except
-          <CGAL::internal::Test_split_attribute_functor<CMap,i>, i>::
-          run(&amap, modified_darts, mark_modified_darts);
-      }
-
-      // We remove all the darts of the i-cell.
-      for ( it=to_erase.begin(); it!=to_erase.end(); ++it )
-      { amap.erase_dart(*it); }
-
-      CGAL_assertion( amap.is_whole_map_unmarked(mark) );
-      amap.free_mark(mark);
-
-      // If no attribute is enabled (or if only i-attributes are enabled),
-      // the darts are not unmark by Foreach_enabled_attributes_except.
-      // Thus we unmark them now.
-      if ( !amap.is_whole_map_unmarked(mark_modified_darts) )
-      {
-        for ( typename std::deque<typename CMap::Dart_handle>::
-              iterator it=modified_darts.begin();
-              it!=modified_darts.end(); ++it )
-          amap.unmark(*it, mark_modified_darts);
-      }
-
-      CGAL_assertion ( amap.is_whole_map_unmarked(mark_modified_darts) );
-      amap.free_mark(mark_modified_darts);
-
-#ifdef CGAL_CMAP_TEST_VALID_CONTRACTIONS
-      CGAL_assertion( amap.is_valid() );
-#endif
-
-      return res;
-    }
-  };
-
-  /** Contract an edge, and merge eventually both incident vertices.
-   * @param amap the used combinatorial map.
-   * @param adart a dart of the edge to contract.
-   * @return the number of deleted darts.
-   */
-  template<class CMap>
-  struct Contract_cell_functor<CMap,1>
-  {
-    static size_t run(CMap& amap, typename CMap::Dart_handle adart)
-    {
-      CGAL_assertion( (is_contractible<CMap,1>(amap,adart)) );
-
-      size_t res = 0;
-
-      typename CMap::Dart_handle d1, d2;
-      typename CMap::Dart_handle dg1=amap.null_handle, dg2=amap.null_handle;
-
-      typename CMap::size_type mark = amap.get_new_mark();
-
-      // First we store and mark all the darts of the 1-cell to contract.
-      std::deque<typename CMap::Dart_handle> to_erase;
-      for ( CGAL::CMap_dart_iterator_basic_of_cell<CMap,1> it(amap,adart,mark);
-            it.cont(); ++it )
-      {
-        to_erase.push_back(it);
-        if ( dg1==amap.null_handle && !amap.template is_free<0>(it) &&
-             !amap.template is_free<1>(it) )
-        { dg1=amap.template beta<0>(it); dg2=amap.template beta<1>(it); }
-        amap.mark(it, mark);
-        ++res;
-      }
-
-      if ( amap.are_attributes_automatically_managed() )
-      {
-        // We group the two vertices incident if they exist.
-        if ( dg1!=amap.null_handle )
-          CGAL::internal::Group_attribute_functor_run<CMap, 0, 1>::
-            run(&amap, dg1, dg2);
-      }
-
-      // During the operation, we store in modified_darts the darts modified
-      // by beta0 to test after the loop non void attributes that are split.
-      std::deque<typename CMap::Dart_handle> modified_darts;
-      // And we store in modified_darts2 all the darts having beta1 modified.
-      std::deque<typename CMap::Dart_handle> modified_darts2;
-
-      // For each dart of the cell, we modify link of neighbors.
-      typename std::deque<typename CMap::Dart_handle>::iterator it =
-        to_erase.begin();
-      for ( ; it!=to_erase.end(); ++it )
-      {
-        if ( !amap.template is_free<0>(*it) )
-        {
-          if ( !amap.template is_free<1>(*it) )
-          {
-            if ( amap.template beta<1>(*it)!=*it )
-            {
-               /*modified_darts2.push_back((*it)->template beta<0>());
-              if ( (*it)->beta(0)!=(*it)->beta(1) )*/
-              if ( amap.are_attributes_automatically_managed() )
-              {
-                modified_darts.push_back(amap.template beta<1>(*it));
-              }
-              amap.basic_link_beta_1(amap.template beta<0>(*it),
-                                     amap.template beta<1>(*it));
-            }
-          }
-          else
-          {
-            if ( amap.are_attributes_automatically_managed() )
-            {
-              modified_darts2.push_back(amap.template beta<0>(*it));
-            }
-            amap.template dart_unlink_beta<1>(amap.template beta<0>(*it));
-          }
-        }
-        else
-        {
-          if ( !amap.template is_free<1>(*it) )
-          {
-            if ( amap.are_attributes_automatically_managed() )
-            {
-              modified_darts.push_back(amap.template beta<1>(*it));
-            }
-            amap.template dart_unlink_beta<0>(amap.template beta<1>(*it));
-          }
-        }
-      }
-
-      // We remove all the darts of the cell.
-      for ( it=to_erase.begin(); it!=to_erase.end(); ++it )
-      { amap.erase_dart(*it); }
-
-      CGAL_assertion( amap.is_whole_map_unmarked(mark) );
-      amap.free_mark(mark);
-
-      if ( amap.are_attributes_automatically_managed() )
-      {
-        // We test the split of all the incident cells for all the non
-        // void attributes.
-        CMap::Helper::template Foreach_enabled_attributes_except
-          <CGAL::internal::Test_split_attribute_functor<CMap,1>, 1>::
-          run(&amap, modified_darts, modified_darts2);
-      }
-
-#ifdef CGAL_CMAP_TEST_VALID_CONTRACTIONS
-      CGAL_assertion( amap.is_valid() );
-#endif
-
-      return res;
-    }
-  };
-
-  /** Contract an i-cell, 1<=i<=dimension.
-   * @param amap the used combinatorial map.
-   * @param adart a dart of the i-cell to remove.
-   * @return the number of deleted darts.
-   */
-  template < class CMap, unsigned int i >
-  size_t contract_cell(CMap& amap, typename CMap::Dart_handle adart)
-  { return CGAL::Contract_cell_functor<CMap,i>::run(amap,adart); }
-
-} // namespace CGAL
-
-#endif // CGAL_COMBINATORIAL_MAP_OPERATIONS_H //
-// EOF //
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Combinatorial_map_storages.h b/3rdparty/CGAL-4.8/include/CGAL/Combinatorial_map_storages.h
deleted file mode 100644
index 643dd99..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Combinatorial_map_storages.h
+++ /dev/null
@@ -1,419 +0,0 @@
-// Copyright (c) 2013 CNRS and LIRIS' Establishments (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Guillaume Damiand <guillaume.damiand at liris.cnrs.fr>
-//
-#ifndef CGAL_COMBINATORIAL_MAP_STORAGES_H
-#define CGAL_COMBINATORIAL_MAP_STORAGES_H 1
-
-#include <CGAL/Handle_hash_function.h>
-
-#include <CGAL/Compact_container.h>
-
-#include <boost/config.hpp>
-#if  (BOOST_GCC >= 50000)
-_Pragma("GCC diagnostic push")
-_Pragma("GCC diagnostic ignored \"-Warray-bounds\"")
-#endif
-
-namespace CGAL {
-
-  /** @file Combinatorial_map_storages.h
-   * Definition of storages for dD Combinatorial map.
-   */
-
-  struct Index_hash_function {
-    typedef std::size_t result_type;
-    template <class H>
-    std::size_t operator() (const H& h) const {
-      return h;
-    }
-  };
-
-  // Storage of darts with compact container, beta with handles
-  template<unsigned int d_, class Items_, class Alloc_ >
-  class Combinatorial_map_storage_1
-  {
-  public:
-    typedef Combinatorial_map_storage_1<d_, Items_, Alloc_> Self;
-    typedef CGAL::Tag_false Use_index;
-
-    typedef internal::Combinatorial_map_helper<Self> Helper;
-
-    typedef typename Items_::template Dart_wrapper<Self>  Dart_wrapper;
-    typedef typename Dart_wrapper::Dart                   Dart;
-    typedef typename Alloc_::template rebind<Dart>::other Dart_allocator;
-
-    typedef Compact_container<Dart,Dart_allocator>  Dart_container;
-
-    typedef typename Dart_container::iterator       Dart_handle;
-    typedef typename Dart_container::const_iterator Dart_const_handle;
-    typedef typename Dart_container::size_type      size_type;
-
-    typedef CGAL::Void* Null_handle_type;
-    static const Null_handle_type null_handle;
-
-    typedef Items_ Items;
-    typedef Alloc_ Alloc;
-
-    template <typename T>
-    struct Container_for_attributes :
-        public Compact_container<T, typename Alloc_::template rebind<T>::other>
-    {};
-
-    /// Typedef for attributes
-    typedef typename Dart_wrapper::Attributes Attributes;
-
-    template<int i>
-    struct Attribute_type: public Helper::template Attribute_type<i>
-    {};
-    template<int i>
-    struct Attribute_handle: public Helper::template Attribute_handle<i>
-    {};
-    template<int i>
-    struct Attribute_const_handle:
-      public Helper::template Attribute_const_handle<i>
-    {};
-    template<int i>
-    struct Attribute_range: public Helper::template Attribute_range<i>
-    {};
-    template<int i>
-    struct Attribute_const_range:
-      public Helper::template Attribute_const_range<i>
-    {};
-
-    /// Number of marks
-    static const size_type NB_MARKS = 32;
-
-    /// The dimension of the combinatorial map.
-    static const unsigned int dimension = d_;
-
-    typedef Handle_hash_function Hash_function;
-
-    // Init
-    void init_storage()
-    {
-#ifdef CGAL_CMAP_DEPRECATED
-      // We must do this ony once, but problem because null_dart_handle
-      // is static !
-      if ( mnull_dart_container.empty() )
-#endif // CGAL_CMAP_DEPRECATED
-      { // emplace null_dart; initialized in Combinatorial_map class
-        null_dart_handle = mnull_dart_container.emplace();
-      }
-    }
-
-   /** Return if this dart is free for adimension.
-     * @param dh a dart handle
-     * @param i the dimension.
-     * @return true iff dh is linked with NULL for \em adimension.
-     */
-    template<unsigned int i>
-    bool is_free(Dart_const_handle dh) const
-    {
-      CGAL_assertion( dh!=NULL );
-      CGAL_assertion(i <= dimension);
-      return dh->mbeta[i]==null_dart_handle;
-    }
-    bool is_free(Dart_const_handle dh, unsigned int i) const
-    {
-      CGAL_assertion( dh!=NULL );
-      CGAL_assertion(i <= dimension);
-      return dh->mbeta[i]==null_dart_handle;
-    }
-
-    /// Set simultaneously all the marks of this dart to a given value.
-    void set_dart_marks(Dart_const_handle ADart,
-                        const std::bitset<NB_MARKS>& amarks) const
-    {
-      CGAL_assertion( ADart!=NULL );
-      ADart->set_marks(amarks);
-    }
-    /// Return all the marks of a dart.
-    std::bitset<NB_MARKS> get_dart_marks(Dart_const_handle ADart) const
-    {
-      CGAL_assertion( ADart!=NULL );
-      return ADart->get_marks();
-    }
-    /// Return the mark value of dart a given mark number.
-    bool get_dart_mark(Dart_const_handle ADart, size_type amark) const
-    {
-      CGAL_assertion( ADart!=NULL );
-      return ADart->get_mark(amark);
-    }
-
-    /// Set the mark of a given mark number to a given value.
-    void set_dart_mark(Dart_const_handle ADart, size_type amark, bool avalue) const
-    {
-      CGAL_assertion( ADart!=NULL );
-      ADart->set_mark(amark, avalue);
-    }
-
-    /// Flip the mark of a given mark number to a given value.
-    void flip_dart_mark(Dart_const_handle ADart, size_type amark) const
-    {
-      CGAL_assertion( ADart!=NULL );
-      ADart->flip_mark(amark);
-    }
-
-    // Access to beta maps
-    Dart_handle get_beta(Dart_handle ADart, int B1)
-    {
-      CGAL_assertion(ADart!=NULL && B1>=0 && B1<=(int)dimension);
-      return ADart->mbeta[B1];
-    }
-    Dart_const_handle get_beta(Dart_const_handle ADart, int B1) const
-    {
-      CGAL_assertion(ADart!=NULL && B1>=0 && B1<=(int)dimension);
-      return  ADart->mbeta[B1];
-    }
-    template<int B1>
-    Dart_handle get_beta(Dart_handle ADart)
-    {
-      CGAL_assertion(ADart!=NULL && B1>=0 && B1<=(int)dimension);
-      return  ADart->mbeta[B1];
-    }
-    template<int B1>
-    Dart_const_handle get_beta(Dart_const_handle ADart) const
-    {
-      CGAL_assertion(ADart!=NULL && B1>=0 && B1<=(int)dimension);
-      return  ADart->mbeta[B1];
-    }
-
-    // return a handle on the i-attribute
-    template<unsigned int i>
-    typename Attribute_handle<i>::type attribute(Dart_handle ADart)
-    {
-      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
-                     "attribute<i> called but i-attributes are disabled.");
-      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
-        (ADart->mattribute_handles);
-    }
-    template<unsigned int i>
-    typename Attribute_const_handle<i>::type
-    attribute(Dart_const_handle ADart) const
-    {
-      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
-                     "attribute<i> called but i-attributes are disabled.");
-      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
-        (ADart->mattribute_handles);
-    }
-
-    // get the attribute given its handle
-    template<unsigned int i>
-    typename Attribute_type<i>::type&
-    get_attribute(typename Attribute_handle<i>::type ah)
-    {
-      CGAL_assertion( ah!=NULL );
-      return *ah;
-    }
-    template<unsigned int i>
-    const typename Attribute_type<i>::type&
-    get_attribute(typename Attribute_const_handle<i>::type ah) const
-    {
-      CGAL_assertion( ah!=NULL );
-      return *ah;
-    }
-
-    Dart & get_dart(Dart_handle ah)
-    {
-      CGAL_assertion( ah!=NULL );
-      return *ah;
-    }
-    const Dart & get_dart(Dart_const_handle ah) const
-    {
-      CGAL_assertion( ah!=NULL );
-      return *ah;
-    }
-
-    // Get the dart of the given attribute
-    template<unsigned int i>
-    Dart_handle dart_of_attribute(typename Attribute_handle<i>::type ah)
-    {
-      CGAL_assertion( ah!=NULL );
-      return ah->dart();
-    }
-    template<unsigned int i>
-    Dart_const_handle
-    dart_of_attribute(typename Attribute_const_handle<i>::type ah) const
-    {
-      CGAL_assertion( ah!=NULL );
-      return ah->dart();
-    }
-
-    // Set the dart of the given attribute
-    template<unsigned int i>
-    void set_dart_of_attribute(typename Attribute_handle<i>::type ah,
-                               Dart_handle adart)
-    {
-      CGAL_assertion( ah!=NULL );
-      ah->set_dart(adart);
-    }
-
-    // Get the info of the given attribute
-    template<unsigned int i>
-    typename Attribute_type<i>::type::Info &
-    info_of_attribute(typename Attribute_handle<i>::type ah)
-    {
-      CGAL_assertion( ah!=NULL );
-      return ah->info();
-    }
-    template<unsigned int i>
-    const typename Attribute_type<i>::type::Info &
-    info_of_attribute(typename Attribute_const_handle<i>::type ah) const
-    {
-      CGAL_assertion( ah!=NULL );
-      return ah->info();
-    }
-
-    // Get the info of the i-cell attribute associated with the given dart
-    template<unsigned int i>
-    typename Attribute_type<i>::type::Info & info(Dart_handle adart)
-    {
-      CGAL_assertion( adart!=NULL );
-      CGAL_assertion( attribute<i>(adart)!=NULL );
-      return info_of_attribute<i>(attribute<i>(adart));
-    }
-    template<unsigned int i>
-    const typename Attribute_type<i>::type::Info &
-    info(Dart_const_handle adart) const
-    {
-      CGAL_assertion( adart!=NULL );
-      CGAL_assertion( attribute<i>(adart)!=NULL );
-      return info_of_attribute<i>(attribute<i>(adart));
-    }
-
-    // Get the dart of the i-cell attribute associated with the given dart
-    template<unsigned int i>
-    Dart_handle & dart(Dart_handle adart)
-    {
-      CGAL_assertion( adart!=NULL );
-      CGAL_assertion( attribute<i>(adart)!=NULL );
-      return dart_of_attribute<i>(attribute<i>(adart));
-    }
-    template<unsigned int i>
-    Dart_const_handle dart(Dart_const_handle adart) const
-    {
-      CGAL_assertion( adart!=NULL );
-      CGAL_assertion( attribute<i>(adart)!=NULL );
-      return dart_of_attribute<i>(attribute<i>(adart));
-    }
-
-    void display_dart(Dart_const_handle ADart) const
-    { std::cout<<&*ADart; }
-
-    template<unsigned int i>
-    void display_attribute(typename Attribute_const_handle<i>::type ah) const
-    { std::cout<<&*ah; }
-
-  protected:
-    // Set the handle on the i th attribute
-    template<unsigned int i>
-    void basic_set_dart_attribute(Dart_handle dh,
-                                  typename Attribute_handle<i>::type ah)
-    {
-      CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
-        (dh->mattribute_handles) = ah;
-    }
-
-    /** Link a dart with a given dart for a given dimension.
-     * @param adart the dart to link.
-     * @param adart2 the dart to link with.
-     * @param i the dimension.
-     */
-    template<unsigned int i>
-    void dart_link_beta(Dart_handle adart, Dart_handle adart2)
-    {
-      CGAL_assertion(i <= dimension);
-      CGAL_assertion(adart!=NULL && adart2!=NULL);
-      CGAL_assertion(adart!=null_dart_handle);
-      adart->mbeta[i] = adart2;
-    }
-    void dart_link_beta(Dart_handle adart, Dart_handle adart2, unsigned int i)
-    {
-      CGAL_assertion(i <= dimension);
-      CGAL_assertion(adart!=NULL && adart2!=NULL);
-      CGAL_assertion(adart!=null_dart_handle);
-      adart->mbeta[i] = adart2;
-    }
-
-    /** Unlink a dart for a given dimension.
-     * @param adart a dart.
-     * @param i the dimension.
-     */
-    template<unsigned int i>
-    void dart_unlink_beta(Dart_handle adart)
-    {
-      CGAL_assertion(adart!=NULL && i <= dimension);
-      adart->mbeta[i] = null_dart_handle;
-    }
-    void dart_unlink_beta(Dart_handle adart, unsigned int i)
-    {
-      CGAL_assertion(adart!=NULL && i <= dimension);
-      adart->mbeta[i] = null_dart_handle;
-    }
-
-  public:
-    /// Void dart. A dart d is i-free if beta_i(d)=null_dart_handle.
-#ifdef CGAL_CMAP_DEPRECATED
-    static
-#endif // CGAL_CMAP_DEPRECATED
-    Dart_handle null_dart_handle; // Todo Dart_const_handle ??
-
-  protected:
-    /// Dart container.
-    Dart_container mdarts;
-
-    /// Container for the null_dart_handle, static data member.
-#ifdef CGAL_CMAP_DEPRECATED
-    static
-#endif // CGAL_CMAP_DEPRECATED
-    Dart_container mnull_dart_container;
-
-    /// Tuple of attributes containers
-    typename Helper::Attribute_containers mattribute_containers;
-  };
-
-  /// null_handle
-  template < unsigned int d_, class Items_, class Alloc_ >
-  const typename Combinatorial_map_storage_1<d_, Items_, Alloc_>::Null_handle_type
-  Combinatorial_map_storage_1<d_, Items_, Alloc_>::null_handle = NULL;
-
-#ifdef CGAL_CMAP_DEPRECATED
-  /// Allocation of static data members
-  /// mnull_dart_container
-  template<unsigned int d_, class Items_, class Alloc_ >
-  typename Combinatorial_map_storage_1<d_, Items_, Alloc_>::Dart_container
-  Combinatorial_map_storage_1<d_, Items_, Alloc_>::mnull_dart_container;
-
-  /// null_dart_handle
-  template < unsigned int d_, class Items_, class Alloc_ >
-  typename Combinatorial_map_storage_1<d_, Items_, Alloc_>::Dart_handle
-  Combinatorial_map_storage_1<d_, Items_, Alloc_>::null_dart_handle;
-  // =  mnull_dart_container.emplace( std::bitset<NB_MARKS>() );
-  // Does not work on windows => segfault
-  // Thus we initialize null_dart_handle in the Combinatorial_map constructor
-#endif // CGAL_CMAP_DEPRECATED
-
-} // namespace CGAL
-
-
-#if  (BOOST_GCC >= 50000)
- _Pragma("GCC diagnostic pop")
-#endif
-#endif // CGAL_COMBINATORIAL_MAP_H //
-// EOF //
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Compact_container.h b/3rdparty/CGAL-4.8/include/CGAL/Compact_container.h
deleted file mode 100644
index 5dbdd5b..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Compact_container.h
+++ /dev/null
@@ -1,1207 +0,0 @@
-// Copyright (c) 2003,2004,2007-2010  INRIA Sophia-Antipolis (France).
-// Copyright (c) 2014  GeometryFactory Sarl (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(s)     : Sylvain Pion
-
-#ifndef CGAL_COMPACT_CONTAINER_H
-#define CGAL_COMPACT_CONTAINER_H
-
-#include <CGAL/basic.h>
-#include <CGAL/Default.h>
-
-#include <iterator>
-#include <algorithm>
-#include <vector>
-#include <cstring>
-#include <functional>
-
-#include <CGAL/memory.h>
-#include <CGAL/iterator.h>
-#include <CGAL/CC_safe_handle.h>
-#include <CGAL/Time_stamper.h>
-
-#include <boost/mpl/if.hpp>
-
-// An STL like container with the following properties :
-// - to achieve compactness, it requires access to a pointer stored in T,
-//   specified by a traits.  This pointer is supposed to be 4 bytes aligned
-//   when the object is alive, otherwise, the container uses the 2 least
-//   significant bits to store information in the pointer.
-// - Ts are allocated in arrays of increasing size, which are linked together
-//   by their first and last element.
-// - the iterator looks at the famous 2 bits to know if it has to deal with
-//   a free/used/boundary element.
-
-// TODO :
-// - Add .resize() (and proper copy of capacity_).
-// - Add preconditions in input that real pointers need to have clean bits.
-//   Also for the allocated memory alignment, and sizeof().
-// - Do a benchmark before/after.
-// - Check the end result with Valgrind.
-// - The bit squatting mechanism will be reused for the conflict flag, maybe
-//   it could be put out of the class.
-
-// TODO low priority :
-// - rebind<> the allocator
-// - Exception safety guarantees
-// - Thread safety guarantees
-// - std requirements on iterators says all defined operations are constant
-//   time amortized (it's not true here, maybe it could be with some work...)
-// - all this is expected especially when there are not so many free objects
-//   compared to the allocated elements.
-// - Should block_size be selectable/hintable by .reserve() ?
-// - would be nice to have a temporary_free_list (still active elements, but
-//   which are going to be freed soon).  Probably it prevents compactness.
-// - eventually something to copy this data structure, providing a way to
-//   update the pointers (give access to a hash_map, at least a function that
-//   converts an old pointer to the new one ?).  Actually it doesn't have to
-//   be stuck to a particular DS, because for a list it's useful too...
-// - Currently, end() can be invalidated on insert() if a new block is added.
-//   It would be nice to fix this.  We could insert the new block at the
-//   beginning instead ?  That would drop the property that iterator order
-//   is preserved.  Maybe it's not a problem if end() is not preserved, after
-//   all nothing is going to dereference it, it's just for comparing with
-//   end() that it can be a problem.
-//   Another way would be to have end() point to the end of an always
-//   empty block (containing no usable element), and insert new blocks just
-//   before this one.
-//   Instead of having the blocks linked between them, the start/end pointers
-//   could point back to the container, so that we can do more interesting
-//   things (e.g. freeing empty blocks automatically) ?
-
-namespace CGAL {
-
-#define CGAL_GENERATE_MEMBER_DETECTOR(X)                                             \
-template<typename T> class has_##X {                                          \
-    struct Fallback { int X; };                                               \
-    struct Derived : T, Fallback { };                                         \
-                                                                              \
-    template<typename U, U> struct Check;                                     \
-                                                                              \
-    typedef char ArrayOfOne[1];                                               \
-    typedef char ArrayOfTwo[2];                                               \
-                                                                              \
-    template<typename U> static ArrayOfOne & func(                            \
-                                            Check<int Fallback::*, &U::X> *); \
-    template<typename U> static ArrayOfTwo & func(...);                       \
-  public:                                                                     \
-    typedef has_##X type;                                                     \
-    enum { value = sizeof(func<Derived>(0)) == 2 };                           \
-} // semicolon is after the macro call
-
-#define CGAL_INIT_COMPACT_CONTAINER_BLOCK_SIZE 14
-#define CGAL_INCREMENT_COMPACT_CONTAINER_BLOCK_SIZE 16
-
-template<unsigned int first_block_size_, unsigned int block_size_increment>
-struct Addition_size_policy
-{
-  static const unsigned int first_block_size = first_block_size_;
-
-  template<typename Compact_container>
-  static void increase_size(Compact_container& cc)
-  { cc.block_size += block_size_increment; }
-
-  template<typename Compact_container>
-  static void get_index_and_block(typename Compact_container::size_type i,
-                                  typename Compact_container::size_type& index,
-                                  typename Compact_container::size_type& block)
-  {
-    typedef typename Compact_container::size_type ST;
-    const ST TWO_M_N = 2*first_block_size_ - block_size_increment;
-    ST delta = TWO_M_N*TWO_M_N + 8*block_size_increment*i;
-    block= (static_cast<ST>(std::sqrt(static_cast<double>(delta))) - TWO_M_N)
-      / (2*block_size_increment);
-
-    if ( block==0 )
-    { index = i + 1; }
-    else
-    {
-      const typename Compact_container::size_type first_element_in_block =
-        block*(first_block_size_+ (block_size_increment*(block - 1))/2);
-
-      index=i - first_element_in_block + 1;
-    }
-  }
-};
-
-template<unsigned int k>
-struct Constant_size_policy
-{
-  static const unsigned int first_block_size = k;
-
-  template<typename Compact_container>
-  static void increase_size(Compact_container& /*cc*/)
-  {}
-
-  template<typename Compact_container>
-  static void get_index_and_block(typename Compact_container::size_type i,
-                                  typename Compact_container::size_type& index,
-                                  typename Compact_container::size_type& block)
-  {
-    block=i/k;
-    index=(i%k)+1;
-  }
-};
-
-// The following base class can be used to easily add a squattable pointer
-// to a class (maybe you loose a bit of compactness though).
-// TODO : Shouldn't adding these bits be done automatically and transparently,
-//        based on the traits class info ?
-class Compact_container_base
-{
-  void * p;
-public:
-  Compact_container_base()
-  : p(NULL) {}
-  void *   for_compact_container() const { return p; }
-  void * & for_compact_container()       { return p; }
-};
-
-// The traits class describes the way to access the pointer.
-// It can be specialized.
-template < class T >
-struct Compact_container_traits {
-  static void *   pointer(const T &t) { return t.for_compact_container(); }
-  static void * & pointer(T &t)       { return t.for_compact_container(); }
-};
-
-namespace internal {
-  template < class DSC, bool Const >
-  class CC_iterator;
-
-  CGAL_GENERATE_MEMBER_DETECTOR(increment_erase_counter);
-
-  // A basic "no erase counter" strategy
-  template <bool Has_erase_counter_tag>
-  class Erase_counter_strategy {
-  public:
-    // Do nothing
-    template <typename Element>
-    static unsigned int erase_counter(const Element &) { return 0; }
-    template <typename Element>
-    static void set_erase_counter(Element &, unsigned int) {}
-    template <typename Element>
-    static void increment_erase_counter(Element &) {}
-  };
-
-
-  // A strategy managing an internal counter
-  template <>
-  class Erase_counter_strategy<true>
-  {
-  public:
-    template <typename Element>
-    static unsigned int erase_counter(const Element &e)
-    {
-      return e.erase_counter();
-    }
-
-    template <typename Element>
-    static void set_erase_counter(Element &e, unsigned int c)
-    {
-      e.set_erase_counter(c);
-    }
-
-    template <typename Element>
-    static void increment_erase_counter(Element &e)
-    {
-      e.increment_erase_counter();
-    }
-  };
-}
-
-template < class T,
-           class Allocator_ = Default,
-           class Increment_policy_ = Default,
-           class TimeStamper_ = Default >
-class Compact_container
-{
-  typedef Allocator_                                Al;
-  typedef typename Default::Get< Al, CGAL_ALLOCATOR(T) >::type Allocator;
-  typedef Increment_policy_                         Ip;
-  typedef typename Default::Get< Ip, 
-            Addition_size_policy<CGAL_INIT_COMPACT_CONTAINER_BLOCK_SIZE,
-                             CGAL_INCREMENT_COMPACT_CONTAINER_BLOCK_SIZE> 
-          >::type                                   Increment_policy;
-  typedef TimeStamper_                              Ts;
-  typedef Compact_container <T, Al, Ip, Ts>         Self;
-  typedef Compact_container_traits <T>              Traits;
-public:
-  typedef typename Default::Get< TimeStamper_,
-                                 CGAL::Time_stamper_impl<T> >::type
-                                                    Time_stamper_impl;
-
-  typedef T                                         value_type;
-  typedef Allocator                                 allocator_type;
-  typedef typename Allocator::reference             reference;
-  typedef typename Allocator::const_reference       const_reference;
-  typedef typename Allocator::pointer               pointer;
-  typedef typename Allocator::const_pointer         const_pointer;
-  typedef typename Allocator::size_type             size_type;
-  typedef typename Allocator::difference_type       difference_type;
-  typedef internal::CC_iterator<Self, false> iterator;
-  typedef internal::CC_iterator<Self, true>  const_iterator;
-  typedef std::reverse_iterator<iterator>           reverse_iterator;
-  typedef std::reverse_iterator<const_iterator>     const_reverse_iterator;
-
-  friend class internal::CC_iterator<Self, false>;
-  friend class internal::CC_iterator<Self, true>;
-
-  template<unsigned int first_block_size_, unsigned int block_size_increment>
-    friend struct Addition_size_policy;
-  template<unsigned int k> friend struct Constant_size_policy;
-
-  explicit Compact_container(const Allocator &a = Allocator())
-  : alloc(a)
-  , time_stamper(new Time_stamper_impl())
-  {
-    init ();
-  }
-
-  template < class InputIterator >
-  Compact_container(InputIterator first, InputIterator last,
-                    const Allocator & a = Allocator())
-  : alloc(a)
-  , time_stamper(new Time_stamper_impl())
-  {
-    init();
-    std::copy(first, last, CGAL::inserter(*this));
-  }
-
-  // The copy constructor and assignment operator preserve the iterator order
-  Compact_container(const Compact_container &c)
-  : alloc(c.get_allocator())
-  , time_stamper(new Time_stamper_impl())
-  {
-    init();
-    block_size = c.block_size;
-    *time_stamper = *c.time_stamper;
-    std::copy(c.begin(), c.end(), CGAL::inserter(*this));
-  }
-
-  Compact_container & operator=(const Compact_container &c)
-  {
-    if (&c != this) {
-      Self tmp(c);
-      swap(tmp);
-    }
-    return *this;
-  }
-
-  ~Compact_container()
-  {
-    clear();
-    delete time_stamper;
-  }
-
-  bool is_used(const_iterator ptr) const
-  {
-    return (type(&*ptr)==USED);
-  }
-
-  bool is_used(size_type i) const
-  {
-    typename Self::size_type block_number, index_in_block;
-    Increment_policy::template get_index_and_block<Self>(i,
-                                                         index_in_block,
-                                                         block_number);
-    return (type(&all_items[block_number].first[index_in_block])
-                 == USED);
-  }
-
-  const T& operator[] (size_type i) const
-  {
-    CGAL_assertion( is_used(i) );
-
-    typename Self::size_type block_number, index_in_block;
-    Increment_policy::template get_index_and_block<Self>(i,
-                                                         index_in_block,
-                                                         block_number);
-    return all_items[block_number].first[index_in_block];
-  }
-
-  T& operator[] (size_type i)
-  {
-    CGAL_assertion( is_used(i) );
-
-    typename Self::size_type block_number, index_in_block;
-    Increment_policy::template get_index_and_block<Self>(i,
-                                                         index_in_block,
-                                                         block_number);
-    return all_items[block_number].first[index_in_block];
-  }
-
-  void swap(Self &c)
-  {
-    std::swap(alloc, c.alloc);
-    std::swap(capacity_, c.capacity_);
-    std::swap(size_, c.size_);
-    std::swap(block_size, c.block_size);
-    std::swap(first_item, c.first_item);
-    std::swap(last_item, c.last_item);
-    std::swap(free_list, c.free_list);
-    all_items.swap(c.all_items);
-    std::swap(time_stamper, c.time_stamper);
-  }
-
-  iterator begin() { return iterator(first_item, 0, 0); }
-  iterator end()   { return iterator(last_item, 0); }
-
-  const_iterator begin() const { return const_iterator(first_item, 0, 0); }
-  const_iterator end()   const { return const_iterator(last_item, 0); }
-
-  reverse_iterator rbegin() { return reverse_iterator(end()); }
-  reverse_iterator rend()   { return reverse_iterator(begin()); }
-
-  const_reverse_iterator
-  rbegin() const { return const_reverse_iterator(end()); }
-  const_reverse_iterator
-  rend()   const { return const_reverse_iterator(begin()); }
-
-  // Boost.Intrusive interface
-  iterator iterator_to(reference value) const {
-    return iterator(&value, 0);
-  }
-  const_iterator iterator_to(const_reference value) const {
-    return const_iterator(&value, 0);
-  }
-  static iterator s_iterator_to(reference value) {
-    return iterator(&value, 0);
-  }
-  static const_iterator s_iterator_to(const_reference value) {
-    return const_iterator(&value, 0);
-  }
-
-  // Special insert methods that construct the objects in place
-  // (just forward the arguments to the constructor, to optimize a copy).
-#ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
-  template < typename... Args >
-  iterator
-  emplace(const Args&... args)
-  {
-    if (free_list == NULL)
-      allocate_new_block();
-
-    pointer ret = free_list;
-    free_list = clean_pointee(ret);
-    new (ret) value_type(args...);
-    CGAL_assertion(type(ret) == USED);
-    ++size_;
-    time_stamper->set_time_stamp(ret);
-    return iterator(ret, 0);
-  }
-#else
-  // inserts a default constructed item.
-  iterator emplace()
-  {
-    if (free_list == NULL)
-      allocate_new_block();
-
-    pointer ret = free_list;
-    free_list = clean_pointee(ret);
-    new (ret) value_type();
-    CGAL_assertion(type(ret) == USED);
-    ++size_;
-    time_stamper->set_time_stamp(ret);
-    return iterator(ret, 0);
-  }
-
-  template < typename T1 >
-  iterator
-  emplace(const T1 &t1)
-  {
-    if (free_list == NULL)
-      allocate_new_block();
-
-    pointer ret = free_list;
-    free_list = clean_pointee(ret);
-    new (ret) value_type(t1);
-    CGAL_assertion(type(ret) == USED);
-    ++size_;
-    time_stamper->set_time_stamp(ret);
-    return iterator(ret, 0);
-  }
-
-  template < typename T1, typename T2 >
-  iterator
-  emplace(const T1 &t1, const T2 &t2)
-  {
-    if (free_list == NULL)
-      allocate_new_block();
-
-    pointer ret = free_list;
-    free_list = clean_pointee(ret);
-    new (ret) value_type(t1, t2);
-    CGAL_assertion(type(ret) == USED);
-    ++size_;
-    time_stamper->set_time_stamp(ret);
-    return iterator(ret, 0);
-  }
-
-  template < typename T1, typename T2, typename T3 >
-  iterator
-  emplace(const T1 &t1, const T2 &t2, const T3 &t3)
-  {
-    if (free_list == NULL)
-      allocate_new_block();
-
-    pointer ret = free_list;
-    free_list = clean_pointee(ret);
-    new (ret) value_type(t1, t2, t3);
-    CGAL_assertion(type(ret) == USED);
-    ++size_;
-    time_stamper->set_time_stamp(ret);
-    return iterator(ret, 0);
-  }
-
-  template < typename T1, typename T2, typename T3, typename T4 >
-  iterator
-  emplace(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4)
-  {
-    if (free_list == NULL)
-      allocate_new_block();
-
-    pointer ret = free_list;
-    free_list = clean_pointee(ret);
-    new (ret) value_type(t1, t2, t3, t4);
-    CGAL_assertion(type(ret) == USED);
-    ++size_;
-    time_stamper->set_time_stamp(ret);
-    return iterator(ret, 0);
-  }
-
-  template < typename T1, typename T2, typename T3, typename T4, typename T5 >
-  iterator
-  emplace(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4,
-          const T5 &t5)
-  {
-    if (free_list == NULL)
-      allocate_new_block();
-
-    pointer ret = free_list;
-    free_list = clean_pointee(ret);
-    new (ret) value_type(t1, t2, t3, t4, t5);
-    CGAL_assertion(type(ret) == USED);
-    ++size_;
-    time_stamper->set_time_stamp(ret);
-    return iterator(ret, 0);
-  }
-
-  template < typename T1, typename T2, typename T3, typename T4,
-             typename T5, typename T6 >
-  iterator
-  emplace(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4,
-          const T5 &t5, const T6 &t6)
-  {
-    if (free_list == NULL)
-      allocate_new_block();
-
-    pointer ret = free_list;
-    free_list = clean_pointee(ret);
-    new (ret) value_type(t1, t2, t3, t4, t5, t6);
-    CGAL_assertion(type(ret) == USED);
-    ++size_;
-    time_stamper->set_time_stamp(ret);
-    return iterator(ret, 0);
-  }
-
-  template < typename T1, typename T2, typename T3, typename T4,
-             typename T5, typename T6, typename T7 >
-  iterator
-  emplace(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4,
-          const T5 &t5, const T6 &t6, const T7 &t7)
-  {
-    if (free_list == NULL)
-      allocate_new_block();
-
-    pointer ret = free_list;
-    free_list = clean_pointee(ret);
-    new (ret) value_type(t1, t2, t3, t4, t5, t6, t7);
-    CGAL_assertion(type(ret) == USED);
-    ++size_;
-    time_stamper->set_time_stamp(ret);
-    return iterator(ret, 0);
-  }
-
-  template < typename T1, typename T2, typename T3, typename T4,
-             typename T5, typename T6, typename T7, typename T8 >
-  iterator
-  emplace(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4,
-          const T5 &t5, const T6 &t6, const T7 &t7, const T8 &t8)
-  {
-    if (free_list == NULL)
-      allocate_new_block();
-
-    pointer ret = free_list;
-    free_list = clean_pointee(ret);
-    new (ret) value_type(t1, t2, t3, t4, t5, t6, t7, t8);
-    CGAL_assertion(type(ret) == USED);
-    ++size_;
-    time_stamper->set_time_stamp(ret);
-    return iterator(ret, 0);
-  }
-#endif // CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
-
-  iterator insert(const T &t)
-  {
-    if (free_list == NULL)
-      allocate_new_block();
-
-    pointer ret = free_list;
-    free_list = clean_pointee(ret);
-    alloc.construct(ret, t);
-    CGAL_assertion(type(ret) == USED);
-    ++size_;
-    time_stamper->set_time_stamp(ret);
-    return iterator(ret, 0);
-  }
-
-  template < class InputIterator >
-  void insert(InputIterator first, InputIterator last)
-  {
-    for (; first != last; ++first)
-      insert(*first);
-  }
-
-  template < class InputIterator >
-  void assign(InputIterator first, InputIterator last)
-  {
-    clear(); // erase(begin(), end()); // ?
-    insert(first, last);
-  }
-
-  void erase(iterator x)
-  {
-    typedef internal::Erase_counter_strategy<
-      internal::has_increment_erase_counter<T>::value> EraseCounterStrategy;
-
-    CGAL_precondition(type(&*x) == USED);
-    EraseCounterStrategy::increment_erase_counter(*x);
-    alloc.destroy(&*x);
-/*#ifndef CGAL_NO_ASSERTIONS
-    std::memset(&*x, 0, sizeof(T));
-#endif*/
-    put_on_free_list(&*x);
-    --size_;
-  }
-
-  void erase(iterator first, iterator last) {
-    while (first != last)
-      erase(first++);
-  }
-
-  void clear();
-
-  // Merge the content of d into *this.  d gets cleared.
-  // The complexity is O(size(free list = capacity-size)).
-  void merge(Self &d);
-
-  size_type size() const
-  {
-    CGAL_expensive_assertion(size_ ==
-                             (size_type) std::distance(begin(), end()));
-    return size_;
-  }
-
-  size_type max_size() const
-  {
-    return alloc.max_size();
-  }
-
-  size_type capacity() const
-  {
-    return capacity_;
-  }
-
-  // void resize(size_type sz, T c = T()); // TODO  makes sense ???
-
-  bool empty() const
-  {
-    return size_ == 0;
-  }
-
-  allocator_type get_allocator() const
-  {
-    return alloc;
-  }
-
-  // Returns whether the iterator "cit" is in the range [begin(), end()].
-  // Complexity : O(#blocks) = O(sqrt(capacity())).
-  // This function is mostly useful for purposes of efficient debugging at
-  // higher levels.
-  bool owns(const_iterator cit) const
-  {
-    // We use the block structure to provide an efficient version :
-    // we check if the address is in the range of each block,
-    // and then test whether it is valid (not a free element).
-
-    if (cit == end())
-      return true;
-
-    const_pointer c = &*cit;
-
-    for (typename All_items::const_iterator it = all_items.begin(), itend = all_items.end();
-         it != itend; ++it) {
-      const_pointer p = it->first;
-      size_type s = it->second;
-
-      // Are we in the address range of this block (excluding first and last
-      // elements) ?
-      if (c <= p || (p+s-1) <= c)
-        continue;
-
-      CGAL_assertion_msg( (c-p)+p == c, "wrong alignment of iterator");
-
-      return type(c) == USED;
-    }
-    return false;
-  }
-
-  bool owns_dereferencable(const_iterator cit) const
-  {
-    return cit != end() && owns(cit);
-  }
-
-  /** Reserve method to ensure that the capacity of the Compact_container be
-   * greater or equal than a given value n.
-   */
-  void reserve(size_type n)
-  {
-    if ( capacity_>=n ) return;
-
-    size_type lastblock = all_items.size();
-
-    while ( capacity_<n )
-    { // Pb because the order of free list is no more the order of
-      // allocate_new_block();
-      pointer new_block = alloc.allocate(block_size + 2);
-      all_items.push_back(std::make_pair(new_block, block_size + 2));
-      capacity_ += block_size;
-      // We insert this new block at the end.
-      if (last_item == NULL) // First time
-      {
-        first_item = new_block;
-        last_item  = new_block + block_size + 1;
-        set_type(first_item, NULL, START_END);
-      }
-      else
-      {
-        set_type(last_item, new_block, BLOCK_BOUNDARY);
-        set_type(new_block, last_item, BLOCK_BOUNDARY);
-        last_item = new_block + block_size + 1;
-      }
-      set_type(last_item, NULL, START_END);
-      // Increase the block_size for the next time.
-      Increment_policy::increase_size(*this);
-    }
-
-    // Now we put all the new elements on freelist, starting from the last block
-    // inserted and mark them free in reverse order, so that the insertion order
-    // will correspond to the iterator order...
-    // We don't touch the first and the last one.
-    size_type curblock=all_items.size();
-    do
-    {
-      --curblock; // We are sure we have at least create a new block
-      pointer new_block = all_items[curblock].first;
-      for (size_type i = all_items[curblock].second-2; i >= 1; --i)
-        put_on_free_list(new_block + i);
-    }
-    while ( curblock>lastblock );
-  }
-
-private:
-
-  void allocate_new_block();
-
-  void put_on_free_list(pointer x)
-  {
-    set_type(x, free_list, FREE);
-    free_list = x;
-  }
-
-  // Definition of the bit squatting :
-  // =================================
-  // ptr is composed of a pointer part and the last 2 bits.
-  // Here is the meaning of each of the 8 cases.
-  //
-  //                          value of the last 2 bits as "Type"
-  // pointer part     0              1                2              3
-  //         NULL     user elt       unused           free_list end  start/end
-  //      != NULL     user elt       block boundary   free elt       unused
-  //
-  // meaning of ptr : user stuff     next/prev block  free_list      unused
-
-  enum Type { USED = 0, BLOCK_BOUNDARY = 1, FREE = 2, START_END = 3 };
-
-  // The bit squatting is implemented by casting pointers to (char *), then
-  // subtracting to NULL, doing bit manipulations on the resulting integer,
-  // and converting back.
-
-  static char * clean_pointer(char * p)
-  {
-    return ((p - (char *) NULL) & ~ (std::ptrdiff_t) START_END) + (char *) NULL;
-  }
-
-  // Returns the pointee, cleaned up from the squatted bits.
-  static pointer clean_pointee(const_pointer ptr)
-  {
-    return (pointer) clean_pointer((char *) Traits::pointer(*ptr));
-  }
-
-  // Get the type of the pointee.
-  static Type type(const_pointer ptr)
-  {
-    char * p = (char *) Traits::pointer(*ptr);
-    return (Type) (p - clean_pointer(p));
-  }
-
-  // Sets the pointer part and the type of the pointee.
-  static void set_type(pointer ptr, void * p, Type t)
-  {
-    // This out of range compare is always true and causes lots of
-    // unnecessary warnings.
-    // CGAL_precondition(0 <= t && t < 4);
-    Traits::pointer(*ptr) = (void *) ((clean_pointer((char *) p)) + (int) t);
-  }
-
-  // We store a vector of pointers to all allocated blocks and their sizes.
-  // Knowing all pointers, we don't have to walk to the end of a block to reach
-  // the pointer to the next block.
-  // Knowing the sizes allows to deallocate() without having to compute the size
-  // by walking through the block till its end.
-  // This opens up the possibility for the compiler to optimize the clear()
-  // function considerably when has_trivial_destructor<T>.
-  typedef std::vector<std::pair<pointer, size_type> >  All_items;
-
-  void init()
-  {
-    block_size = Increment_policy::first_block_size;
-    capacity_  = 0;
-    size_      = 0;
-    free_list  = NULL;
-    first_item = NULL;
-    last_item  = NULL;
-    all_items  = All_items();
-    time_stamper->reset();
-  }
-
-  allocator_type   alloc;
-  size_type        capacity_;
-  size_type        size_;
-  size_type        block_size;
-  pointer          free_list;
-  pointer          first_item;
-  pointer          last_item;
-  All_items        all_items;
-
-  // This is a pointer, so that the definition of Compact_container does
-  // not require a complete type `T`.
-  Time_stamper_impl* time_stamper;
-};
-
-template < class T, class Allocator, class Increment_policy, class TimeStamper >
-void Compact_container<T, Allocator, Increment_policy, TimeStamper>::merge(Self &d)
-{
-  CGAL_precondition(&d != this);
-
-  // Allocators must be "compatible" :
-  CGAL_precondition(get_allocator() == d.get_allocator());
-
-  // Concatenate the free_lists.
-  if (free_list == NULL) {
-    free_list = d.free_list;
-  } else if (d.free_list != NULL) {
-    pointer p = free_list;
-    while (clean_pointee(p) != NULL)
-      p = clean_pointee(p);
-    set_type(p, d.free_list, FREE);
-  }
-  // Concatenate the blocks.
-  if (last_item == NULL) { // empty...
-    first_item = d.first_item;
-    last_item  = d.last_item;
-  } else if (d.last_item != NULL) {
-    set_type(last_item, d.first_item, BLOCK_BOUNDARY);
-    set_type(d.first_item, last_item, BLOCK_BOUNDARY);
-    last_item = d.last_item;
-  }
-  all_items.insert(all_items.end(), d.all_items.begin(), d.all_items.end());
-  // Add the sizes.
-  size_ += d.size_;
-  // Add the capacities.
-  capacity_ += d.capacity_;
-  // It seems reasonnable to take the max of the block sizes.
-  block_size = (std::max)(block_size, d.block_size);
-  // Clear d.
-  d.init();
-}
-
-template < class T, class Allocator, class Increment_policy, class TimeStamper >
-void Compact_container<T, Allocator, Increment_policy, TimeStamper>::clear()
-{
-  for (typename All_items::iterator it = all_items.begin(), itend = all_items.end();
-       it != itend; ++it) {
-    pointer p = it->first;
-    size_type s = it->second;
-    for (pointer pp = p + 1; pp != p + s - 1; ++pp) {
-      if (type(pp) == USED)
-      {
-        alloc.destroy(pp);
-        set_type(pp, NULL, FREE);
-      }
-    }
-    alloc.deallocate(p, s);
-  }
-  init();
-}
-
-template < class T, class Allocator, class Increment_policy, class TimeStamper >
-void Compact_container<T, Allocator, Increment_policy, TimeStamper>::allocate_new_block()
-{
-  typedef internal::Erase_counter_strategy<
-    internal::has_increment_erase_counter<T>::value> EraseCounterStrategy;
-
-  pointer new_block = alloc.allocate(block_size + 2);
-  all_items.push_back(std::make_pair(new_block, block_size + 2));
-  capacity_ += block_size;
-  // We don't touch the first and the last one.
-  // We mark them free in reverse order, so that the insertion order
-  // will correspond to the iterator order...
-  for (size_type i = block_size; i >= 1; --i)
-  {
-    EraseCounterStrategy::set_erase_counter(*(new_block + i), 0);
-    put_on_free_list(new_block + i);
-  }
-  // We insert this new block at the end.
-  if (last_item == NULL) // First time
-  {
-      first_item = new_block;
-      last_item  = new_block + block_size + 1;
-      set_type(first_item, NULL, START_END);
-  }
-  else
-  {
-      set_type(last_item, new_block, BLOCK_BOUNDARY);
-      set_type(new_block, last_item, BLOCK_BOUNDARY);
-      last_item = new_block + block_size + 1;
-  }
-  set_type(last_item, NULL, START_END);
-  // Increase the block_size for the next time.
-  Increment_policy::increase_size(*this);
-}
-
-template < class T, class Allocator, class Increment_policy, class TimeStamper >
-inline
-bool operator==(const Compact_container<T, Allocator, Increment_policy, TimeStamper> &lhs,
-                const Compact_container<T, Allocator, Increment_policy, TimeStamper> &rhs)
-{
-  return lhs.size() == rhs.size() &&
-    std::equal(lhs.begin(), lhs.end(), rhs.begin());
-}
-
-template < class T, class Allocator, class Increment_policy, class TimeStamper >
-inline
-bool operator!=(const Compact_container<T, Allocator, Increment_policy, TimeStamper> &lhs,
-                const Compact_container<T, Allocator, Increment_policy, TimeStamper> &rhs)
-{
-  return ! (lhs == rhs);
-}
-
-template < class T, class Allocator, class Increment_policy, class TimeStamper >
-inline
-bool operator< (const Compact_container<T, Allocator, Increment_policy, TimeStamper> &lhs,
-                const Compact_container<T, Allocator, Increment_policy, TimeStamper> &rhs)
-{
-  return std::lexicographical_compare(lhs.begin(), lhs.end(),
-                                      rhs.begin(), rhs.end());
-}
-
-template < class T, class Allocator, class Increment_policy, class TimeStamper >
-inline
-bool operator> (const Compact_container<T, Allocator, Increment_policy, TimeStamper> &lhs,
-                const Compact_container<T, Allocator, Increment_policy, TimeStamper> &rhs)
-{
-  return rhs < lhs;
-}
-
-template < class T, class Allocator, class Increment_policy, class TimeStamper >
-inline
-bool operator<=(const Compact_container<T, Allocator, Increment_policy, TimeStamper> &lhs,
-                const Compact_container<T, Allocator, Increment_policy, TimeStamper> &rhs)
-{
-  return ! (lhs > rhs);
-}
-
-template < class T, class Allocator, class Increment_policy, class TimeStamper >
-inline
-bool operator>=(const Compact_container<T, Allocator, Increment_policy, TimeStamper> &lhs,
-                const Compact_container<T, Allocator, Increment_policy, TimeStamper> &rhs)
-{
-  return ! (lhs < rhs);
-}
-
-namespace internal {
-
-  template < class DSC, bool Const >
-  class CC_iterator
-  {
-    typedef typename DSC::iterator                    iterator;
-    typedef CC_iterator<DSC, Const>                   Self;
-  public:
-    typedef typename DSC::value_type                  value_type;
-    typedef typename DSC::size_type                   size_type;
-    typedef typename DSC::difference_type             difference_type;
-    typedef typename boost::mpl::if_c< Const, const value_type*,
-                                       value_type*>::type pointer;
-    typedef typename boost::mpl::if_c< Const, const value_type&,
-                                       value_type&>::type reference;
-    typedef std::bidirectional_iterator_tag           iterator_category;
-
-    // the initialization with NULL is required by our Handle concept.
-    CC_iterator()
-    {
-      m_ptr.p = NULL;
-    }
-
-    // Either a harmless copy-ctor,
-    // or a conversion from iterator to const_iterator.
-    CC_iterator (const iterator &it)
-    {
-      m_ptr.p = &(*it);
-    }
-
-    // Same for assignment operator (otherwise MipsPro warns)
-    CC_iterator & operator= (const iterator &it)
-    {
-      m_ptr.p = &(*it);
-      return *this;
-    }
-
-    // Construction from NULL
-    CC_iterator (Nullptr_t CGAL_assertion_code(n))
-    {
-      CGAL_assertion (n == NULL);
-      m_ptr.p = NULL;
-    }
-
-  private:
-
-    typedef typename DSC::Time_stamper_impl           Time_stamper_impl;
-
-    union {
-      pointer      p;
-      void        *vp;
-    } m_ptr;
-
-    // Only Compact_container should access these constructors.
-    friend class Compact_container<value_type,
-                                   typename DSC::Al,
-                                   typename DSC::Ip,
-                                   typename DSC::Ts>;
-
-
-    // For begin()
-    CC_iterator(pointer ptr, int, int)
-    {
-      m_ptr.p = ptr;
-      if (m_ptr.p == NULL) // empty container.
-        return;
-
-      ++(m_ptr.p); // if not empty, p = start
-      if (DSC::type(m_ptr.p) == DSC::FREE)
-        increment();
-    }
-
-    // Construction from raw pointer and for end().
-    CC_iterator(pointer ptr, int)
-    {
-      m_ptr.p = ptr;
-    }
-
-    // NB : in case empty container, begin == end == NULL.
-    void increment()
-    {
-      // It's either pointing to end(), or valid.
-      CGAL_assertion_msg(m_ptr.p != NULL,
-         "Incrementing a singular iterator or an empty container iterator ?");
-      CGAL_assertion_msg(DSC::type(m_ptr.p) != DSC::START_END,
-         "Incrementing end() ?");
-
-      // If it's not end(), then it's valid, we can do ++.
-      do {
-        ++(m_ptr.p);
-        if (DSC::type(m_ptr.p) == DSC::USED ||
-            DSC::type(m_ptr.p) == DSC::START_END)
-          return;
-
-        if (DSC::type(m_ptr.p) == DSC::BLOCK_BOUNDARY)
-          m_ptr.p = DSC::clean_pointee(m_ptr.p);
-      } while (true);
-    }
-
-    void decrement()
-    {
-      // It's either pointing to end(), or valid.
-      CGAL_assertion_msg(m_ptr.p != NULL,
-         "Decrementing a singular iterator or an empty container iterator ?");
-      CGAL_assertion_msg(DSC::type(m_ptr.p - 1) != DSC::START_END,
-         "Decrementing begin() ?");
-
-      // If it's not begin(), then it's valid, we can do --.
-      do {
-        --m_ptr.p;
-        if (DSC::type(m_ptr.p) == DSC::USED ||
-            DSC::type(m_ptr.p) == DSC::START_END)
-          return;
-
-        if (DSC::type(m_ptr.p) == DSC::BLOCK_BOUNDARY)
-          m_ptr.p = DSC::clean_pointee(m_ptr.p);
-      } while (true);
-    }
-
-  public:
-
-    Self & operator++()
-    {
-      CGAL_assertion_msg(m_ptr.p != NULL,
-         "Incrementing a singular iterator or an empty container iterator ?");
-      /* CGAL_assertion_msg(DSC::type(m_ptr.p) == DSC::USED,
-         "Incrementing an invalid iterator."); */
-      increment();
-      return *this;
-    }
-
-    Self & operator--()
-    {
-      CGAL_assertion_msg(m_ptr.p != NULL,
-         "Decrementing a singular iterator or an empty container iterator ?");
-      /*CGAL_assertion_msg(DSC::type(m_ptr.p) == DSC::USED
-                      || DSC::type(m_ptr.p) == DSC::START_END,
-                      "Decrementing an invalid iterator.");*/
-      decrement();
-      return *this;
-    }
-
-    Self operator++(int) { Self tmp(*this); ++(*this); return tmp; }
-    Self operator--(int) { Self tmp(*this); --(*this); return tmp; }
-
-    reference operator*() const { return *(m_ptr.p); }
-
-    pointer   operator->() const { return (m_ptr.p); }
-
-    // For std::less...
-    bool operator<(const CC_iterator& other) const
-    {
-      return Time_stamper_impl::less(m_ptr.p, other.m_ptr.p);
-    }
-
-    bool operator>(const CC_iterator& other) const
-    {
-      return Time_stamper_impl::less(other.m_ptr.p, m_ptr.p);
-    }
-
-    bool operator<=(const CC_iterator& other) const
-    {
-      return Time_stamper_impl::less(m_ptr.p, other.m_ptr.p)
-          || (*this == other);
-    }
-
-    bool operator>=(const CC_iterator& other) const
-    {
-      return Time_stamper_impl::less(other.m_ptr.p, m_ptr.p)
-          || (*this == other);
-    }
-
-    // Can itself be used for bit-squatting.
-    void *   for_compact_container() const { return (m_ptr.vp); }
-    void * & for_compact_container()       { return (m_ptr.vp); }
-  };
-
-  template < class DSC, bool Const1, bool Const2 >
-  inline
-  bool operator==(const CC_iterator<DSC, Const1> &rhs,
-                  const CC_iterator<DSC, Const2> &lhs)
-  {
-    return rhs.operator->() == lhs.operator->();
-  }
-
-  template < class DSC, bool Const1, bool Const2 >
-  inline
-  bool operator!=(const CC_iterator<DSC, Const1> &rhs,
-                  const CC_iterator<DSC, Const2> &lhs)
-  {
-    return rhs.operator->() != lhs.operator->();
-  }
-
-  // Comparisons with NULL are part of CGAL's Handle concept...
-  template < class DSC, bool Const >
-  inline
-  bool operator==(const CC_iterator<DSC, Const> &rhs,
-                  Nullptr_t CGAL_assertion_code(n))
-  {
-    CGAL_assertion( n == NULL);
-    return rhs.operator->() == NULL;
-  }
-
-  template < class DSC, bool Const >
-  inline
-  bool operator!=(const CC_iterator<DSC, Const> &rhs,
-                  Nullptr_t CGAL_assertion_code(n))
-  {
-    CGAL_assertion( n == NULL);
-    return rhs.operator->() != NULL;
-  }
-
-  template <class DSC, bool Const>
-  std::size_t hash_value(const CC_iterator<DSC, Const>&  i)
-  {
-    return reinterpret_cast<std::size_t>(&*i) / sizeof(typename DSC::value_type);
-  }
-
-} // namespace internal
-
-} //namespace CGAL
-
-namespace std {
-
-#if defined(BOOST_MSVC)
-#  pragma warning(push)
-#  pragma warning(disable:4099) // For VC10 it is class hash 
-#endif
-
-#ifndef CGAL_CFG_NO_STD_HASH
-  
-  template < class DSC, bool Const >
-  struct hash<CGAL::internal::CC_iterator<DSC, Const> >
-    : public std::unary_function<CGAL::internal::CC_iterator<DSC, Const>, std::size_t> {
-
-    std::size_t operator()(const CGAL::internal::CC_iterator<DSC, Const>& i) const
-    {
-      return reinterpret_cast<std::size_t>(&*i) / sizeof(typename DSC::value_type);
-    }
-  };
-#endif // CGAL_CFG_NO_STD_HASH
-
-#if defined(BOOST_MSVC)
-#  pragma warning(pop)
-#endif
-
-} // namespace std
-
-#endif // CGAL_COMPACT_CONTAINER_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Compact_mesh_cell_base_3.h b/3rdparty/CGAL-4.8/include/CGAL/Compact_mesh_cell_base_3.h
deleted file mode 100644
index 65ed83c..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Compact_mesh_cell_base_3.h
+++ /dev/null
@@ -1,713 +0,0 @@
-// Copyright (c) 2006-2007  INRIA Sophia-Antipolis (France).
-// Copyright (c) 2008,2011 GeometryFactory Sarl (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
-// 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: https://scm.gforge.inria.fr/svn/cgal/branches/features/Mesh_3-experimental-GF/Mesh_3/include/CGAL/Compact_mesh_cell_base_3.h $
-// $Id: Compact_mesh_cell_base_3.h 70288 2012-07-05 10:09:48Z jtournoi $
-//
-//
-// Author(s)     : Laurent Rineau, Stephane Tayeb, Andreas Fabri
-
-
-#ifndef CGAL_COMPACT_MESH_CELL_BASE_3_H
-#define CGAL_COMPACT_MESH_CELL_BASE_3_H
-
-#include <CGAL/Mesh_3/config.h>
-
-#include <CGAL/basic.h>
-#include <CGAL/array.h>
-#include <CGAL/triangulation_assertions.h>
-#include <CGAL/internal/Dummy_tds_3.h>
-#include <CGAL/tags.h>
-#include <CGAL/Has_timestamp.h>
-
-#include <CGAL/Regular_triangulation_cell_base_3.h>
-#include <CGAL/Mesh_3/io_signature.h>
-
-#ifdef CGAL_LINKED_WITH_TBB
-# include <tbb/atomic.h>
-#endif
-
-namespace CGAL {
-
-// Class Compact_mesh_cell_base_3_base
-// Base for Compact_mesh_cell_base_3, with specializations
-// for different values of Concurrency_tag
-// Sequential
-template <typename GT, typename Concurrency_tag>
-class Compact_mesh_cell_base_3_base
-{
-  typedef typename GT::Point_3 Point;
-
-protected:
-  Compact_mesh_cell_base_3_base()
-    : bits_(0)
-    , circumcenter_(NULL)
-  {}
-
-public:
-#if defined(CGAL_MESH_3_USE_LAZY_SORTED_REFINEMENT_QUEUE) \
- || defined(CGAL_MESH_3_USE_LAZY_UNSORTED_REFINEMENT_QUEUE)
-
-  // Erase counter (cf. Compact_container)
-  unsigned int erase_counter() const
-  {
-    return this->m_erase_counter;
-  }
-  void set_erase_counter(unsigned int c)
-  {
-    this->m_erase_counter = c;
-  }
-  void increment_erase_counter()
-  {
-    ++this->m_erase_counter;
-  }
-#endif
-
-  /// Marks \c facet as visited
-  void set_facet_visited (const int facet)
-  {
-    CGAL_precondition(facet>=0 && facet <4);
-    bits_ |= (1 << facet);
-  }
-
-  /// Marks \c facet as not visited
-  void reset_visited (const int facet)
-  {
-    CGAL_precondition(facet>=0 && facet<4);
-    bits_ &= (15 & ~(1 << facet));
-  }
-
-  /// Returns \c true if \c facet is marked as visited
-  bool is_facet_visited (const int facet) const
-  {
-    CGAL_precondition(facet>=0 && facet<4);
-    return ( (bits_ & (1 << facet)) != 0 );
-  }
-
-  /// Precondition circumcenter_ == NULL
-  void try_to_set_circumcenter(Point *cc) const
-  {
-    CGAL_precondition(circumcenter_ == NULL);
-    circumcenter_ = cc;
-  }
-
-private:
-  char bits_;
-
-#if defined(CGAL_MESH_3_USE_LAZY_SORTED_REFINEMENT_QUEUE) \
- || defined(CGAL_MESH_3_USE_LAZY_UNSORTED_REFINEMENT_QUEUE)
-
-  typedef unsigned int              Erase_counter_type;
-  Erase_counter_type                m_erase_counter;
-#endif
-
-protected:
-  mutable Point * circumcenter_;
-};
-
-
-#ifdef CGAL_LINKED_WITH_TBB
-// Class Compact_mesh_cell_base_3_base
-// Specialization for parallel
-template <typename GT>
-class Compact_mesh_cell_base_3_base<GT, Parallel_tag>
-{
-  typedef typename GT::Point_3 Point;
-
-protected:
-  Compact_mesh_cell_base_3_base()
-  {
-    bits_ = 0;
-    circumcenter_ = NULL;
-  }
-
-public:
-  // Erase counter (cf. Compact_container)
-  unsigned int erase_counter() const
-  {
-    return this->m_erase_counter;
-  }
-  void set_erase_counter(unsigned int c)
-  {
-    this->m_erase_counter = c;
-  }
-  void increment_erase_counter()
-  {
-    ++this->m_erase_counter;
-  }
-
-  /// Marks \c facet as visited
-  void set_facet_visited (const int facet)
-  {
-    CGAL_precondition(facet>=0 && facet<4);
-    char current_bits = bits_;
-    while (bits_.compare_and_swap(current_bits | (1 << facet), current_bits) != current_bits)
-    {
-      current_bits = bits_;
-    }
-  }
-
-  /// Marks \c facet as not visited
-  void reset_visited (const int facet)
-  {
-    CGAL_precondition(facet>=0 && facet<4);
-    char current_bits = bits_;
-    while (bits_.compare_and_swap(current_bits & (15 & ~(1 << facet)), current_bits) != current_bits)
-    {
-      current_bits = bits_;
-    }
-  }
-
-  /// Returns \c true if \c facet is marked as visited
-  bool is_facet_visited (const int facet) const
-  {
-    CGAL_precondition(facet>=0 && facet<4);
-    return ( (bits_ & (1 << facet)) != 0 );
-  }
-
-  /// If the circumcenter is already set (circumcenter_ != NULL),
-  /// this function "deletes" cc
-  void try_to_set_circumcenter(Point *cc) const
-  {
-    if (circumcenter_.compare_and_swap(cc, NULL) != NULL)
-      delete cc;
-  }
-
-private:
-  typedef tbb::atomic<unsigned int> Erase_counter_type;
-  Erase_counter_type                m_erase_counter;
-  /// Stores visited facets (4 first bits)
-  tbb::atomic<char> bits_;
-
-protected:
-  mutable tbb::atomic<Point*> circumcenter_;
-};
-
-#endif // CGAL_LINKED_WITH_TBB
-
-
-// Class Compact_mesh_cell_base_3
-// Cell base class used in 3D meshing process.
-// Adds information to Cb about the cell of the input complex containing it
-template< class GT,
-          class MD,
-          class TDS = void >
-class Compact_mesh_cell_base_3
-  : public Compact_mesh_cell_base_3_base<GT, typename TDS::Concurrency_tag>
-{
-  typedef typename GT::FT FT;
-  typedef Compact_mesh_cell_base_3_base<GT,typename TDS::Concurrency_tag> Base;
-  using Base::circumcenter_;
-
-public:
-  typedef TDS                          Triangulation_data_structure;
-  typedef typename TDS::Vertex_handle  Vertex_handle;
-  typedef typename TDS::Cell_handle    Cell_handle;
-  typedef typename TDS::Vertex         Vertex;
-  typedef typename TDS::Cell           Cell;
-  typedef typename TDS::Cell_data      TDS_data;
-
-
-  template <typename TDS2>
-  struct Rebind_TDS {
-    typedef Compact_mesh_cell_base_3<GT, MD, TDS2> Other;
-  };
-
-
-  // Index Type
-  typedef typename MD::Subdomain_index      Subdomain_index;
-  typedef typename MD::Surface_patch_index  Surface_patch_index;
-  typedef typename MD::Index                Index;
-
-  typedef GT                   Geom_traits;
-  typedef typename GT::Point_3 Point;
-
-  typedef Point*           Point_container;
-  typedef Point*           Point_iterator;
-  typedef const Point*     Point_const_iterator;
-
-public:
-  void invalidate_circumcenter() const
-  {
-    if (circumcenter_) {
-      delete circumcenter_;
-      circumcenter_ = NULL;
-    }
-  }
-
-public:
-  // Constructors
-  Compact_mesh_cell_base_3()
-    : surface_index_table_()
-    , surface_center_table_()
-#ifdef CGAL_INTRUSIVE_LIST
-    , next_intrusive_()
-    , previous_intrusive_()
-#endif
-    , time_stamp_(-1)
-    , surface_center_index_table_()
-    , sliver_value_(FT(0.))
-    , subdomain_index_()  
-    , sliver_cache_validity_(false)
-  {}
-
-  Compact_mesh_cell_base_3(const Compact_mesh_cell_base_3& rhs)
-    : N(rhs.N)
-    , V(rhs.V)
-#ifdef CGAL_INTRUSIVE_LIST
-    , next_intrusive_(rhs.next_intrusive_)
-    , previous_intrusive_(rhs.previous_intrusive_)
-#endif
-    , time_stamp_(rhs.time_stamp_)
-    , sliver_value_(rhs.sliver_value_)
-    , subdomain_index_(rhs.subdomain_index_)
-    , sliver_cache_validity_(false)
-  {
-    for(int i=0; i <4; i++){
-      surface_index_table_[i] = rhs.surface_index_table_[i];
-      surface_center_table_[i]= rhs.surface_center_table_[i];
-      surface_center_index_table_[i] = rhs.surface_center_index_table_[i];
-    }
-  }
-
-  Compact_mesh_cell_base_3 (Vertex_handle v0,
-                            Vertex_handle v1,
-                            Vertex_handle v2,
-                            Vertex_handle v3)
-    : surface_index_table_()
-    , surface_center_table_()
-    , V(CGAL::make_array(v0, v1, v2, v3))
-#ifdef CGAL_INTRUSIVE_LIST
-    , next_intrusive_()
-    , previous_intrusive_()
-#endif
-    , time_stamp_(-1)
-    , surface_center_index_table_()
-    , sliver_value_(FT(0.))
-    , subdomain_index_()
-    , sliver_cache_validity_(false)
-  {
-  }
-
-
-  Compact_mesh_cell_base_3 (Vertex_handle v0,
-                            Vertex_handle v1,
-                            Vertex_handle v2,
-                            Vertex_handle v3,
-                            Cell_handle n0,
-                            Cell_handle n1,
-                            Cell_handle n2,
-                            Cell_handle n3)
-    : surface_index_table_()
-    , surface_center_table_()
-    , N(CGAL::make_array(n0, n1, n2, n3))
-    , V(CGAL::make_array(v0, v1, v2, v3))
-#ifdef CGAL_INTRUSIVE_LIST
-    , next_intrusive_()
-    , previous_intrusive_()
-#endif
-    , time_stamp_(-1)
-    , surface_center_index_table_()
-    , sliver_value_(FT(0.))
-    , subdomain_index_()
-    , sliver_cache_validity_(false)
-  {
-  }
-
-  ~Compact_mesh_cell_base_3()
-  {
-    if(circumcenter_ != NULL){
-      delete circumcenter_;
-    }
-  }
-
-  // ACCESS FUNCTIONS
-
-  Vertex_handle vertex(int i) const
-  {
-    CGAL_triangulation_precondition( i >= 0 && i <= 3 );
-    return V[i];
-  }
-
-  bool has_vertex(Vertex_handle v) const
-  {
-    return (V[0] == v) || (V[1] == v) || (V[2]== v) || (V[3]== v);
-  }
-
-  bool has_vertex(Vertex_handle v, int & i) const
-  {
-    if (v == V[0]) { i = 0; return true; }
-    if (v == V[1]) { i = 1; return true; }
-    if (v == V[2]) { i = 2; return true; }
-    if (v == V[3]) { i = 3; return true; }
-    return false;
-  }
-
-  int index(Vertex_handle v) const
-  {
-    if (v == V[0]) { return 0; }
-    if (v == V[1]) { return 1; }
-    if (v == V[2]) { return 2; }
-    CGAL_triangulation_assertion( v == V[3] );
-    return 3;
-  }
-
-  Cell_handle neighbor(int i) const
-  {
-    CGAL_triangulation_precondition( i >= 0 && i <= 3);
-    return N[i];
-  }
-
-  bool has_neighbor(Cell_handle n) const
-  {
-    return (N[0] == n) || (N[1] == n) || (N[2] == n) || (N[3] == n);
-  }
-
-  bool has_neighbor(Cell_handle n, int & i) const
-  {
-    if(n == N[0]){ i = 0; return true; }
-    if(n == N[1]){ i = 1; return true; }
-    if(n == N[2]){ i = 2; return true; }
-    if(n == N[3]){ i = 3; return true; }
-    return false;
-  }
-
-  int index(Cell_handle n) const
-  {
-    if (n == N[0]) return 0;
-    if (n == N[1]) return 1;
-    if (n == N[2]) return 2;
-    CGAL_triangulation_assertion( n == N[3] );
-    return 3;
-  }
-
-  // SETTING
-
-
-  void set_neighbor(int i, Cell_handle n)
-  {
-    CGAL_triangulation_precondition( i >= 0 && i <= 3);
-    CGAL_triangulation_precondition( this != &*n );
-    N[i] = n;
-  }
-
-
-  void set_neighbors()
-  {
-    N[0] = N[1] = N[2] = N[3] = Cell_handle();
-  }
-
-  void set_neighbors(Cell_handle n0, Cell_handle n1,
-                     Cell_handle n2, Cell_handle n3)
-  {
-    CGAL_triangulation_precondition( this != &*n0 );
-    CGAL_triangulation_precondition( this != &*n1 );
-    CGAL_triangulation_precondition( this != &*n2 );
-    CGAL_triangulation_precondition( this != &*n3 );
-    N[0] = n0;
-    N[1] = n1;
-    N[2] = n2;
-    N[3] = n3;
-  }
-
-  // CHECKING
-
-  // the following trivial is_valid allows
-  // the user of derived cell base classes
-  // to add their own purpose checking
-  bool is_valid(bool = false, int = 0) const
-  { return true; }
-
-  // For use by Compact_container.
-  void * for_compact_container() const { return N[0].for_compact_container(); }
-  void * & for_compact_container()     { return N[0].for_compact_container(); }
-
-  // TDS internal data access functions.
-        TDS_data& tds_data()       { return _tds_data; }
-  const TDS_data& tds_data() const { return _tds_data; }
-
-
-  Point_iterator hidden_points_begin() const { return hidden_points_end(); }
-  Point_iterator hidden_points_end() const { return NULL; }
-  void hide_point (const Point &) const { }
-
-
-  // We must override the functions that modify the vertices.
-  // And if the point inside a vertex is modified, we fail,
-  // but there's not much we can do for this now.
-  void set_vertex(int i, Vertex_handle v)
-  {
-    CGAL_triangulation_precondition( i >= 0 && i <= 3);
-    invalidate_circumcenter();
-    V[i] = v;
-  }
-
-  void set_vertices()
-  {
-    invalidate_circumcenter();
-    V[0] = V[1] = V[2] = V[3] = Vertex_handle();
-  }
-
-  void set_vertices(Vertex_handle v0, Vertex_handle v1,
-                    Vertex_handle v2, Vertex_handle v3)
-  {
-    invalidate_circumcenter();
-    V[0] = v0;
-    V[1] = v1;
-    V[2] = v2;
-    V[3] = v3;
-  }
-
-  const Point &
-  weighted_circumcenter(const Geom_traits& gt = Geom_traits()) const
-  {
-    if (circumcenter_ == NULL) {
-      this->try_to_set_circumcenter(
-        new Point(gt.construct_weighted_circumcenter_3_object()
-                  (this->vertex(0)->point(),
-                   this->vertex(1)->point(),
-                   this->vertex(2)->point(),
-                   this->vertex(3)->point())));
-    } else {
-      CGAL_expensive_assertion(gt.construct_weighted_circumcenter_3_object()
-                                (this->vertex(0)->point(),
-                                 this->vertex(1)->point(),
-                                 this->vertex(2)->point(),
-                                 this->vertex(3)->point()) == *circumcenter_);
-    }
-    return *circumcenter_;
-  }
-
-
-  // Returns the index of the cell of the input complex that contains the cell
-  Subdomain_index subdomain_index() const { return subdomain_index_; }
-
-  // Sets the index of the cell of the input complex that contains the cell
-  void set_subdomain_index(const Subdomain_index& index)
-  { subdomain_index_ = index; }
-
-  void set_sliver_value(const FT& value)
-  {
-    sliver_cache_validity_ = true;
-    sliver_value_ = value;
-  }
-
-  const FT& sliver_value() const
-  {
-    CGAL_assertion(is_cache_valid());
-    return sliver_value_;
-  }
-
-  bool is_cache_valid() const { return sliver_cache_validity_; }
-  void reset_cache_validity() const { sliver_cache_validity_ = false;  }
-
-  /// Set surface index of \c facet to \c index
-  void set_surface_patch_index(const int facet, const Surface_patch_index& index)
-  {
-    CGAL_precondition(facet>=0 && facet<4);
-    surface_index_table_[facet] = index;
-  }
-
-  /// Returns surface index of facet \c facet
-  Surface_patch_index surface_patch_index(const int facet) const
-  {
-    CGAL_precondition(facet>=0 && facet<4);
-    return surface_index_table_[facet];
-  }
-
-  /// Sets surface center of \c facet to \c point
-  void set_facet_surface_center(const int facet, const Point& point)
-  {
-    CGAL_precondition(facet>=0 && facet<4);
-    surface_center_table_[facet] = point;
-  }
-
-  /// Returns surface center of \c facet
-  Point get_facet_surface_center(const int facet) const
-  {
-    CGAL_precondition(facet>=0 && facet<4);
-    return surface_center_table_[facet];
-  }
-
-  /// Sets surface center index of \c facet to \c index
-  void set_facet_surface_center_index(const int facet, const Index& index)
-  {
-    CGAL_precondition(facet>=0 && facet<4);
-    surface_center_index_table_[facet] = index;
-  }
-
-  /// Returns surface center of \c facet
-  Index get_facet_surface_center_index(const int facet) const
-  {
-    CGAL_precondition(facet>=0 && facet<4);
-    return surface_center_index_table_[facet];
-  }
-
-  /// Returns true if facet lies on a surface patch
-  bool is_facet_on_surface(const int facet) const
-  {
-    CGAL_precondition(facet>=0 && facet<4);
-    return ( !( Surface_patch_index() == surface_index_table_[facet] ));
-  }
-
-  // -----------------------------------
-  // Backward Compatibility
-  // -----------------------------------
-#ifndef CGAL_MESH_3_NO_DEPRECATED_SURFACE_INDEX
-  typedef Surface_patch_index   Surface_index;
-
-  void set_surface_index(const int facet, const Surface_index& index)
-  { set_surface_patch_index(facet,index); }
-
-  /// Returns surface index of facet \c facet
-  Surface_index surface_index(const int facet) const
-  { return surface_patch_index(facet); }
-#endif // CGAL_MESH_3_NO_DEPRECATED_SURFACE_INDEX
-  // -----------------------------------
-  // End backward Compatibility
-  // -----------------------------------
-
-  static
-  std::string io_signature()
-  {
-    return
-      Get_io_signature<Subdomain_index>()() + "+" +
-      Get_io_signature<Regular_triangulation_cell_base_3<Geom_traits> >()()
-      + "+(" + Get_io_signature<Surface_patch_index>()() + ")[4]";
-  }
-
-#ifdef CGAL_INTRUSIVE_LIST
-public:
-  Cell_handle next_intrusive() const { return next_intrusive_; }
-  void set_next_intrusive(Cell_handle c)
-  { 
-    next_intrusive_ = c; 
-  }
-
-  Cell_handle previous_intrusive() const { return previous_intrusive_; }
-  void set_previous_intrusive(Cell_handle c)
-  { 
-    previous_intrusive_ = c; 
-  }
-#endif // CGAL_INTRUSIVE_LIST
-
-  /// For the determinism of Compact_container iterators
-  ///@{
-  typedef Tag_true Has_timestamp;
-
-  std::size_t time_stamp() const {
-    return time_stamp_;
-  }
-  void set_time_stamp(const std::size_t& ts) {
-    time_stamp_ = ts;
-  }
-  ///@}
-
-private:
-
-
-  /// Stores surface_index for each facet of the cell
-  CGAL::cpp11::array<Surface_patch_index, 4> surface_index_table_;
-  /// Stores surface center of each facet of the cell
-  CGAL::cpp11::array<Point, 4> surface_center_table_;
-  /// Stores surface center index of each facet of the cell
-
-  CGAL::cpp11::array<Cell_handle, 4> N;
-  CGAL::cpp11::array<Vertex_handle, 4> V;
-
-#ifdef CGAL_INTRUSIVE_LIST
-  Cell_handle next_intrusive_, previous_intrusive_;
-#endif
-  std::size_t time_stamp_;
-
-  CGAL::cpp11::array<Index, 4> surface_center_index_table_;
-  /// Stores visited facets (4 first bits)
-
-  //  Point_container _hidden;
-
-  FT sliver_value_;
-
-  // The index of the cell of the input complex that contains me
-  Subdomain_index subdomain_index_;
-
-  TDS_data      _tds_data;
-  mutable bool sliver_cache_validity_;
-
-
-};  // end class Compact_mesh_cell_base_3
-
-template < class GT, class MT, class Cb >
-std::istream&
-operator>>(std::istream &is,
-           Compact_mesh_cell_base_3<GT, MT, Cb> &c)
-{
-  typename Compact_mesh_cell_base_3<GT, MT, Cb>::Subdomain_index index;
-  if(is_ascii(is))
-    is >> index;
-  else
-    read(is, index);
-  if(is) {
-    c.set_subdomain_index(index);
-    for(int i = 0; i < 4; ++i)
-    {
-      typename Compact_mesh_cell_base_3<GT, MT, Cb>::Surface_patch_index i2;
-      if(is_ascii(is))
-        is >> i2;
-      else
-      {
-        read(is, i2);
-      }
-      c.set_surface_patch_index(i, i2);
-    }
-  }
-  return is;
-}
-
-template < class GT, class MT, class Cb >
-std::ostream&
-operator<<(std::ostream &os,
-           const Compact_mesh_cell_base_3<GT, MT, Cb> &c)
-{
-  if(is_ascii(os))
-     os << c.subdomain_index();
-  else
-    write(os, c.subdomain_index());
-  for(int i = 0; i < 4; ++i)
-  {
-    if(is_ascii(os))
-      os << ' ' << c.surface_patch_index(i);
-    else
-      write(os, c.surface_patch_index(i));
-  }
-  return os;
-}
-
-
-// Specialization for void.
-template <typename GT, typename MD>
-class Compact_mesh_cell_base_3<GT, MD, void>
-{
-public:
-  typedef internal::Dummy_tds_3                         Triangulation_data_structure;
-  typedef Triangulation_data_structure::Vertex_handle   Vertex_handle;
-  typedef Triangulation_data_structure::Cell_handle     Cell_handle;
-  template <typename TDS2>
-  struct Rebind_TDS { typedef Compact_mesh_cell_base_3<GT, MD, TDS2> Other; };
-};
-
-}  // end namespace CGAL
-
-
-#endif // CGAL_COMPACT_MESH_CELL_BASE_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Constrained_Delaunay_triangulation_2.h b/3rdparty/CGAL-4.8/include/CGAL/Constrained_Delaunay_triangulation_2.h
deleted file mode 100644
index 752b86f..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Constrained_Delaunay_triangulation_2.h
+++ /dev/null
@@ -1,982 +0,0 @@
-// Copyright (c) 1997  INRIA Sophia-Antipolis (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
-// 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(s)     : Mariette Yvinec, Jean Daniel Boissonnat
- 
-#ifndef CGAL_CONSTRAINED_DELAUNAY_TRIANGULATION_2_H
-#define CGAL_CONSTRAINED_DELAUNAY_TRIANGULATION_2_H
-
-#include <CGAL/triangulation_assertions.h>
-#include <CGAL/Constrained_triangulation_2.h>
-#include <CGAL/Triangulation_2/insert_constraints.h>
-
-#ifndef CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
-#include <CGAL/Spatial_sort_traits_adapter_2.h>
-#include <CGAL/internal/info_check.h>
-#include <CGAL/is_iterator.h>
-
-#include <boost/iterator/zip_iterator.hpp>
-#include <boost/mpl/and.hpp>
-
-namespace CGAL {
-
-namespace internal{
-
-template <class T,bool has_info=is_iterator<T>::value>
-struct Get_iterator_value_type{
- struct type{};
-};
-
-template <class T>
-struct Get_iterator_value_type<T,true>{
- typedef typename std::iterator_traits<T>::value_type type;
-};
-
-} } //namespace CGAL::internal
-#endif //CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
-
-
-
-namespace CGAL {
-
-
-template <class Gt, 
-          class Tds = Triangulation_data_structure_2 <
-                      Triangulation_vertex_base_2<Gt>,
-		      Constrained_triangulation_face_base_2<Gt> >,
-	  class Itag = No_intersection_tag >		
-class Constrained_Delaunay_triangulation_2
-  : public  Constrained_triangulation_2<Gt, Tds, Itag> 
-{
-public:
-  typedef Constrained_triangulation_2<Gt,Tds,Itag>             Ctr;
-  typedef Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>    CDt;
-  typedef typename Ctr::Geom_traits      Geom_traits;
-  typedef typename Ctr::Intersection_tag Intersection_tag;
-
-  typedef typename Ctr::Constraint    Constraint;
-  typedef typename Ctr::Vertex_handle Vertex_handle;
-  typedef typename Ctr::Face_handle   Face_handle;
-  typedef typename Ctr::Edge          Edge;
-  typedef typename Ctr::Finite_faces_iterator Finite_faces_iterator;
-  typedef typename Ctr::Face_circulator       Face_circulator;
-  typedef typename Ctr::size_type             size_type;
-  typedef typename Ctr::Locate_type           Locate_type;
- 
-  typedef typename Ctr::List_edges List_edges;  
-  typedef typename Ctr::List_faces List_faces;
-  typedef typename Ctr::List_vertices  List_vertices;
-  typedef typename Ctr::List_constraints List_constraints;
-  typedef typename Ctr::Less_edge less_edge;
-  typedef typename Ctr::Edge_set Edge_set;
-
-#ifndef CGAL_CFG_USING_BASE_MEMBER_BUG_2
-  using Ctr::geom_traits;
-  using Ctr::number_of_vertices;
-  using Ctr::finite_faces_begin;
-  using Ctr::finite_faces_end;
-  using Ctr::dimension;
-  using Ctr::cw;
-  using Ctr::ccw;
-  using Ctr::infinite_vertex;
-  using Ctr::side_of_oriented_circle;
-  using Ctr::is_infinite;
-  using Ctr::collinear_between;
-  using Ctr::are_there_incident_constraints;
-  using Ctr::make_hole;
-  // The next using statement makes trouble for VC++ with the version
-  // of the method that is templated with PointIterator
-  // VC++ cannot disambiguate between this method and the method of the base class
-  // using Ctr::insert_constraint;
-  using Ctr::locate;
-  using Ctr::test_dim_down;
-  using Ctr::fill_hole_delaunay;
-  using Ctr::update_constraints;
-  using Ctr::delete_vertex;
-  using Ctr::push_back;
-#endif
-
-  typedef typename Geom_traits::Point_2  Point;
-
-  Constrained_Delaunay_triangulation_2(const Geom_traits& gt=Geom_traits()) 
-    : Ctr(gt) { }
-
-  Constrained_Delaunay_triangulation_2(const CDt& cdt)
-    : Ctr(cdt) {}
-
-  Constrained_Delaunay_triangulation_2(List_constraints& lc, 
-				       const Geom_traits& gt=Geom_traits())
-    : Ctr(gt) 
-    {   
-      typename List_constraints::iterator itc = lc.begin();
-      for( ; itc != lc.end(); ++itc) {
-	insert((*itc).first, (*itc).second);
-      }
-      CGAL_triangulation_postcondition( is_valid() );
-    }
-
-  template<class InputIterator>
-  Constrained_Delaunay_triangulation_2(InputIterator it,
-				       InputIterator last,
-				       const Geom_traits& gt=Geom_traits() )
-    : Ctr(gt) 
-    {
-      for ( ; it != last; it++) {
-      	insert((*it).first, (*it).second);
-      }
-      CGAL_triangulation_postcondition( is_valid() );
-    }
-
-  virtual ~Constrained_Delaunay_triangulation_2() {}
-  
-
-  // FLIPS
-  bool is_flipable(Face_handle f, int i, bool perturb = true) const;
-  void flip(Face_handle& f, int i);
-  void flip_around(Vertex_handle va);
-  void flip_around(List_vertices & new_vertices);
-#ifndef CGAL_CDT2_USE_RECURSIVE_PROPAGATING_FLIP
-  void non_recursive_propagating_flip(Face_handle f,int i);
-  void propagating_flip(Face_handle f,int i, int depth=0);
-#else
-  void propagating_flip(Face_handle f,int i);
-#endif
-  void propagating_flip(List_edges & edges);
-
-  // CONFLICTS
-  bool test_conflict(Face_handle fh, const Point& p) const; //deprecated
-  bool test_conflict(const Point& p, Face_handle fh) const;
-  void find_conflicts(const Point& p, std::list<Edge>& le,  //deprecated
-		      Face_handle hint= Face_handle()) const;
-  //  //template member functions, declared and defined at the end 
-  // template <class OutputItFaces, class OutputItBoundaryEdges> 
-  // std::pair<OutputItFaces,OutputItBoundaryEdges>
-  // get_conflicts_and_boundary(const Point  &p, 
-  // 		                OutputItFaces fit, 
-  // 		                OutputItBoundaryEdges eit,
-  // 		                Face_handle start) const;
-  // template <class OutputItFaces>
-  // OutputItFaces
-  // get_conflicts (const Point  &p, 
-  //                OutputItFaces fit, 
-  // 		    Face_handle start ) const;
-  // template <class OutputItBoundaryEdges>
-  // OutputItBoundaryEdges
-  // get_boundary_of_conflicts(const Point  &p, 
-  // 			       OutputItBoundaryEdges eit, 
-  // 			       Face_handle start ) const;
-
-  // INSERTION-REMOVAL
-  Vertex_handle insert(const Point & a, Face_handle start = Face_handle());
-  Vertex_handle insert(const Point& p,
-		       Locate_type lt,
-		       Face_handle loc, int li );
-  Vertex_handle push_back(const Point& a);
-//   template < class InputIterator >
-//   std::ptrdiff_t insert(InputIterator first, InputIterator last);
-
-  void remove(Vertex_handle v);
-  void remove_incident_constraints(Vertex_handle v);
-  void remove_constrained_edge(Face_handle f, int i);
-//  template <class OutputItFaces>
-//  OutputItFaces
-//  remove_constrained_edge(Face_handle f, int i, OutputItFaces out)
- 
-  //for backward compatibility
-  void insert(Point a, Point b) { insert_constraint(a, b);}
-
-  void insert(Vertex_handle va, Vertex_handle  vb) {insert_constraint(va,vb);}
-
-  void insert_constraint(Vertex_handle va, Vertex_handle  vb)
-  {
-    ((Ctr*)this)->insert_constraint(va,vb);
-  }
-
-  void
-  insert_constraint(const Point& a, const Point& b)
-  {
-    ((Ctr*)this)->insert_constraint(a,b);
-  }
-
-  template <class PointIterator>
-  void insert_constraint(PointIterator first, PointIterator last, bool close=false)
-  {
-    if(first == last){
-      return;
-    }
-    const Point& p0 = *first;
-    Point p = p0;
-    Vertex_handle v0 = insert(p0), v(v0), w(v0);
-    ++first;
-    for(; first!=last; ++first){
-      const Point& q = *first;
-      if(p != q){
-        w = insert(q);
-        insert_constraint(v,w);
-        v = w;
-        p = q;
-      }
-    }
-    if(close && (p != p0)){
-      insert(w,v0);
-    }
-  }
-
-
-  void remove_constraint(Face_handle f, int i){remove_constrained_edge(f,i);}
-
-  // CHECK
-  bool is_valid(bool verbose = false, int level = 0) const;
- 
-protected:
-  virtual Vertex_handle virtual_insert(const Point & a, 
-				       Face_handle start = Face_handle());
-  virtual Vertex_handle virtual_insert(const Point& a,
-				       Locate_type lt,
-				       Face_handle loc, 
-				       int li );
-//Vertex_handle special_insert_in_edge(const Point & a, Face_handle f, int i);
-  void remove_2D(Vertex_handle v );
-  virtual void triangulate_hole(List_faces& intersected_faces,
-				List_edges& conflict_boundary_ab,
-				List_edges& conflict_boundary_ba);
-
-public:
-  // MESHING 
-  // suppressed meshing functions from here
-
-  //template member functions
-public:
-  template < class InputIterator >
-#ifndef CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
-  std::ptrdiff_t
-  insert( InputIterator first, InputIterator last,
-          typename boost::enable_if<
-            boost::is_convertible<
-                typename internal::Get_iterator_value_type< InputIterator >::type,
-                Point
-            >
-          >::type* = NULL
-  )
-#else
-#if defined(_MSC_VER)
-  std::ptrdiff_t insert(InputIterator first, InputIterator last, int i = 0)
-#else
-    std::ptrdiff_t insert(InputIterator first, InputIterator last) 
-#endif
-#endif
-    {
-      size_type n = number_of_vertices();
-
-      std::vector<Point> points (first, last);
-      spatial_sort (points.begin(), points.end(), geom_traits());
-      Face_handle f;
-      for (typename std::vector<Point>::const_iterator p = points.begin(), end = points.end();
-              p != end; ++p)
-          f = insert (*p, f)->face();
-
-      return number_of_vertices() - n;
-    }
-
-#ifndef CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
-private:
-  //top stands for tuple-or-pair
-  template <class Info>
-  const Point& top_get_first(const std::pair<Point,Info>& pair) const { return pair.first; }
-  template <class Info>
-  const Info& top_get_second(const std::pair<Point,Info>& pair) const { return pair.second; }
-  template <class Info>
-  const Point& top_get_first(const boost::tuple<Point,Info>& tuple) const { return boost::get<0>(tuple); }
-  template <class Info>
-  const Info& top_get_second(const boost::tuple<Point,Info>& tuple) const { return boost::get<1>(tuple); }
-
-  template <class Tuple_or_pair,class InputIterator>
-  std::ptrdiff_t insert_with_info(InputIterator first,InputIterator last)
-  {
-    size_type n = this->number_of_vertices();
-    std::vector<std::ptrdiff_t> indices;
-    std::vector<Point> points;
-    std::vector<typename Tds::Vertex::Info> infos;
-    std::ptrdiff_t index=0;
-    for (InputIterator it=first;it!=last;++it){
-      Tuple_or_pair value=*it;
-      points.push_back( top_get_first(value)  );
-      infos.push_back ( top_get_second(value) );
-      indices.push_back(index++);
-    }
-
-    typedef Spatial_sort_traits_adapter_2<Geom_traits,Point*> Search_traits;
-
-    spatial_sort(indices.begin(),indices.end(),Search_traits(&(points[0]),geom_traits()));
-
-    Vertex_handle v_hint;
-    Face_handle hint;
-    for (typename std::vector<std::ptrdiff_t>::const_iterator
-      it = indices.begin(), end = indices.end();
-      it != end; ++it){
-      v_hint = insert(points[*it], hint);
-      if (v_hint!=Vertex_handle()){
-        v_hint->info()=infos[*it];
-        hint=v_hint->face();
-      }
-    }
-
-    return this->number_of_vertices() - n;
-  }
-
-public:
-
-  template < class InputIterator >
-  std::ptrdiff_t
-  insert( InputIterator first,
-          InputIterator last,
-          typename boost::enable_if<
-            boost::is_convertible<
-              typename internal::Get_iterator_value_type< InputIterator >::type,
-              std::pair<Point,typename internal::Info_check<typename Tds::Vertex>::type>
-            >
-          >::type* =NULL
-  )
-  {
-    return insert_with_info< std::pair<Point,typename internal::Info_check<typename Tds::Vertex>::type> >(first,last);
-  }
-
-  template <class  InputIterator_1,class InputIterator_2>
-  std::ptrdiff_t
-  insert( boost::zip_iterator< boost::tuple<InputIterator_1,InputIterator_2> > first,
-          boost::zip_iterator< boost::tuple<InputIterator_1,InputIterator_2> > last,
-          typename boost::enable_if<
-            boost::mpl::and_<
-              boost::is_convertible< typename std::iterator_traits<InputIterator_1>::value_type, Point >,
-              boost::is_convertible< typename std::iterator_traits<InputIterator_2>::value_type, typename internal::Info_check<typename Tds::Vertex>::type >
-            >
-          >::type* =NULL
-  )
-  {
-    return insert_with_info< boost::tuple<Point,typename internal::Info_check<typename Tds::Vertex>::type> >(first,last);
-  }
-#endif //CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
-
-
-  template <class PointIterator, class IndicesIterator>
-  std::size_t insert_constraints(PointIterator points_first,
-                                 PointIterator points_beyond,
-                                 IndicesIterator indices_first,
-                                 IndicesIterator indices_beyond)
-  {
-    std::vector<Point> points(points_first, points_beyond);
-    return internal::insert_constraints(*this,points, indices_first, indices_beyond);
-  }
-
-
- template <class ConstraintIterator>
-  std::size_t insert_constraints(ConstraintIterator first,
-                                 ConstraintIterator beyond)
-  {
-    return internal::insert_constraints(*this,first,beyond);
-  }
-
-
-  template <class OutputItFaces, class OutputItBoundaryEdges> 
-  std::pair<OutputItFaces,OutputItBoundaryEdges>
-  get_conflicts_and_boundary(const Point  &p, 
-			     OutputItFaces fit, 
-			     OutputItBoundaryEdges eit,
-			     Face_handle start = Face_handle()) const {
-    CGAL_triangulation_precondition( dimension() == 2);
-    int li;
-    Locate_type lt;
-    Face_handle fh = locate(p,lt,li, start);
-    switch(lt) {
-    case Ctr::OUTSIDE_AFFINE_HULL:
-    case Ctr::VERTEX:
-      return std::make_pair(fit,eit);
-    case Ctr::FACE:
-    case Ctr::EDGE:
-    case Ctr::OUTSIDE_CONVEX_HULL:
-      *fit++ = fh; //put fh in OutputItFaces
-      std::pair<OutputItFaces,OutputItBoundaryEdges>
-	pit = std::make_pair(fit,eit);
-      pit = propagate_conflicts(p,fh,0,pit);
-      pit = propagate_conflicts(p,fh,1,pit);
-      pit = propagate_conflicts(p,fh,2,pit);
-      return pit;
-    }
-    CGAL_triangulation_assertion(false);
-    return std::make_pair(fit,eit);
-  } 
-
-  template <class OutputItFaces>
-  OutputItFaces
-  get_conflicts (const Point  &p, 
-		 OutputItFaces fit, 
-		 Face_handle start= Face_handle()) const {
-    std::pair<OutputItFaces,Emptyset_iterator> pp = 
-      get_conflicts_and_boundary(p,fit,Emptyset_iterator(),start);
-    return pp.first;
-  }
-
-  template <class OutputItBoundaryEdges> 
-  OutputItBoundaryEdges
-  get_boundary_of_conflicts(const Point  &p, 
-			    OutputItBoundaryEdges eit, 
-			    Face_handle start= Face_handle()) const {
-    std::pair<Emptyset_iterator, OutputItBoundaryEdges> pp = 
-      get_conflicts_and_boundary(p,Emptyset_iterator(),eit,start);
-    return pp.second;
-  }
-
-
-public:
-// made  public for the need of Mesh_2
-// but not documented
-#ifdef CGAL_CDT2_USE_RECURSIVE_PROPAGATE_CONFLICTS
-  template <class OutputItFaces, class OutputItBoundaryEdges> 
-  std::pair<OutputItFaces,OutputItBoundaryEdges>
-  propagate_conflicts (const Point  &p,
-                      Face_handle fh, 
-                      int i,
-                      std::pair<OutputItFaces,OutputItBoundaryEdges>  pit)  const 
-  {
-     Face_handle fn = fh->neighbor(i);
-     
-     if ( fh->is_constrained(i) || ! test_conflict(p,fn)) {
-       *(pit.second)++ = Edge(fn, fn->index(fh));
-     } else {
-       *(pit.first)++ = fn;
-       int j = fn->index(fh);
-       pit = propagate_conflicts(p,fn,ccw(j),pit);
-       pit = propagate_conflicts(p,fn,cw(j), pit);
-     }
-     return pit;
-  }
-#else // NO CGAL_CDT2_USE_RECURSIVE_PROPAGATE_CONFLICTS
-  template <class OutputItFaces, class OutputItBoundaryEdges> 
-  std::pair<OutputItFaces,OutputItBoundaryEdges>
-  non_recursive_propagate_conflicts (const Point  &p,
-                                     Face_handle fh, 
-                                     int i,
-                                     std::pair<OutputItFaces,OutputItBoundaryEdges>  pit)  const 
-  {
-    std::stack<std::pair<Face_handle, int> > stack;
-    stack.push(std::make_pair(fh, i));
-    while(!stack.empty()) {
-      const Face_handle fh = stack.top().first;
-      const int i = stack.top().second;
-      stack.pop();
-      const Face_handle fn = fh->neighbor(i);
-      if ( fh->is_constrained(i) || ! test_conflict(p,fn)) {
-        *(pit.second)++ = Edge(fn, fn->index(fh));
-      } else {
-        *(pit.first)++ = fn;
-        int j = fn->index(fh);
-        stack.push(std::make_pair(fn, cw(j)));
-        stack.push(std::make_pair(fn,ccw(j)));
-      }
-    }
-    return pit;
-  }
-
-  template <class OutputItFaces, class OutputItBoundaryEdges> 
-  std::pair<OutputItFaces,OutputItBoundaryEdges>
-  propagate_conflicts (const Point  &p,
-                      Face_handle fh, 
-                      int i,
-                      std::pair<OutputItFaces,OutputItBoundaryEdges>  pit,
-                      int depth=0)  const 
-  {
-    if ( depth==100) return non_recursive_propagate_conflicts(p,fh,i,pit);
-    Face_handle fn = fh->neighbor(i);
- 
-    if ( fh->is_constrained(i) || ! test_conflict(p,fn)) {
-      *(pit.second)++ = Edge(fn, fn->index(fh));
-    } else {
-      *(pit.first)++ = fn;
-      int j = fn->index(fh);
-      pit = propagate_conflicts(p,fn,ccw(j),pit,depth+1);
-      pit = propagate_conflicts(p,fn,cw(j), pit,depth+1);
-    }
-     return pit;
-  }
-#endif // NO CGAL_CDT2_USE_RECURSIVE_PROPAGATE_CONFLICTS
-
-
-
-
-public:
- template <class OutputItFaces>
- OutputItFaces
- propagating_flip(List_edges & edges, 
-		  OutputItFaces out = Emptyset_iterator()) {
-  // makes the triangulation Delaunay by flipping 
-  // List edges contains an initial list of edges to be flipped
-  // Precondition : the output triangulation is Delaunay if the list 
-  // edges contains all edges of the input triangulation that need to be
-  // flipped (plus possibly others)
-  int i, ii, indf, indn;
-  Face_handle ni, f,ff;
-  Edge ei,eni; 
-  typename Ctr::Edge_set edge_set;
-  typename Ctr::Less_edge less_edge;
-  Edge e[4];
-  typename List_edges::iterator itedge=edges.begin();
-
-  // initialization of the set of edges to be flip
-  while (itedge != edges.end()) {
-    f=(*itedge).first;
-    i=(*itedge).second;
-    if (is_flipable(f,i)) {
-      eni=Edge(f->neighbor(i),this->mirror_index(f,i));
-      if (less_edge(*itedge,eni)) edge_set.insert(*itedge);
-      else edge_set.insert(eni);
-    }
-    ++itedge;
-  }
-
-  // flip edges and updates the set of edges to be flipped
-  while (!(edge_set.empty())) {
-    f=(*(edge_set.begin())).first;
-    indf=(*(edge_set.begin())).second;
- 
-    // erase from edge_set the 4 edges of the wing of the edge to be
-    // flipped (edge_set.begin) , i.e. the edges of the faces f and
-    // f->neighbor(indf) that are distinct from the edge to be flipped
-
-    ni = f->neighbor(indf); 
-    indn=this->mirror_index(f,indf);
-    ei= Edge(f,indf);
-    edge_set.erase(ei);
-    e[0]= Edge(f,cw(indf));
-    e[1]= Edge(f,ccw(indf));
-    e[2]= Edge(ni,cw(indn));
-    e[3]= Edge(ni,ccw(indn));
-
-    for(i=0;i<4;i++) { 
-      ff=e[i].first;
-      ii=e[i].second;
-      eni=Edge(ff->neighbor(ii),this->mirror_index(ff,ii));
-      if (less_edge(e[i],eni)) {edge_set.erase(e[i]);}
-      else { edge_set.erase(eni);} 
-    } 
-
-    // here is the flip 
-    *out++ = f;
-    *out++ = f->neighbor(indf);
-    flip(f, indf); 
-    
-
-    //insert in edge_set the 4 edges of the wing of the edge that
-    //have been flipped 
-    e[0]= Edge(f,indf);
-    e[1]= Edge(f,cw(indf));
-    e[2]= Edge(ni,indn);
-    e[3]= Edge(ni,cw(indn));
-
-    for(i=0;i<4;i++) { 
-      ff=e[i].first;
-      ii=e[i].second;
-      if (is_flipable(ff,ii)) {
-	eni=Edge(ff->neighbor(ii),this->mirror_index(ff,ii));
-	if (less_edge(e[i],eni)) { 
-	  edge_set.insert(e[i]);}
-	else {
-	  edge_set.insert(eni);} 
-      }
-    } 
-  }
-  return out;
- }
-
- template <class OutputItFaces>
- OutputItFaces
- remove_constrained_edge(Face_handle f, int i, OutputItFaces out) {
-  Ctr::remove_constrained_edge(f,i);
-  if(dimension() == 2) {
-    List_edges le;
-    le.push_back(Edge(f,i));
-    propagating_flip(le,out);
-  }
-  return out;  
- }
- 
-};
-
-
-template < class Gt, class Tds, class Itag >
-bool 
-Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
-is_flipable(Face_handle f, int i, bool perturb /* = true */) const
-  // determines if edge (f,i) can be flipped 
-{
-  Face_handle ni = f->neighbor(i); 
-  if (is_infinite(f) || is_infinite(ni)) return false; 
-  if (f->is_constrained(i)) return false;
-  return (side_of_oriented_circle(ni, f->vertex(i)->point(), perturb) 
-                                        == ON_POSITIVE_SIDE);
-}
-
-template < class Gt, class Tds, class Itag >
-void 
-Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
-flip (Face_handle& f, int i)
-{
-  Face_handle g = f->neighbor(i);
-  int j = this->mirror_index(f,i);
-
-  // save wings neighbors to be able to restore contraint status
-  Face_handle f1 = f->neighbor(cw(i));
-  int i1 = this->mirror_index(f,cw(i));
-  Face_handle f2 = f->neighbor(ccw(i));
-  int i2 = this->mirror_index(f,ccw(i));
-  Face_handle f3 = g->neighbor(cw(j));
-  int i3 = this->mirror_index(g,cw(j));
-  Face_handle f4 = g->neighbor(ccw(j));
-  int i4 = this->mirror_index(g,ccw(j));
-
-  // The following precondition prevents the test suit 
-  // of triangulation to work on constrained Delaunay triangulation
-  //CGAL_triangulation_precondition(is_flipable(f,i));
-  this->_tds.flip(f, i);
-   
-  // restore constraint status
-  f->set_constraint(f->index(g), false);
-  g->set_constraint(g->index(f), false);
-  f1->neighbor(i1)->set_constraint(this->mirror_index(f1,i1),
-				   f1->is_constrained(i1));
-  f2->neighbor(i2)->set_constraint(this->mirror_index(f2,i2),
-				   f2->is_constrained(i2));
-  f3->neighbor(i3)->set_constraint(this->mirror_index(f3,i3),
-				   f3->is_constrained(i3));
-  f4->neighbor(i4)->set_constraint(this->mirror_index(f4,i4),
-				   f4->is_constrained(i4));
-  return;
-}
-
-template < class Gt, class Tds, class Itag >
-void 
-Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
-flip_around(Vertex_handle va)
-  // makes the triangles incident to vertex va Delaunay using flips
-{
-  if (dimension() <= 1) return;
-  Face_handle f=va->face();
-  Face_handle next;    
-  Face_handle start(f);
-  int i;
-  do {
-    i = f->index(va); // FRAGILE : DIM 1
-    next = f->neighbor(ccw(i));  // turns ccw around a
-    propagating_flip(f,i);
-    f=next;
-  } while(next != start);
-}
-
-template < class Gt, class Tds, class Itag >
-void 
-Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
-flip_around(List_vertices& new_vertices)
-{
-  typename List_vertices::iterator itv=new_vertices.begin();
-  for( ; itv != new_vertices.end(); itv++) {
-    flip_around(*itv);
-  }
-  return;
-}
-
-
-#ifndef CGAL_CDT2_USE_RECURSIVE_PROPAGATING_FLIP
-template <class Gt, class Tds, class Itag >
-void
-Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
-non_recursive_propagating_flip(Face_handle f , int i)
-{
-  std::stack<Edge> edges;
-  const Vertex_handle& vp = f->vertex(i);
-  edges.push(Edge(f,i));
-
-  while(! edges.empty()){
-    const Edge& e = edges.top();
-    f = e.first;
-    i = e.second;
-
-    Face_handle ni = f->neighbor(i);
-    flip(f,i);
-    if ( !is_flipable(f,i) ) edges.pop();
-
-    i = ni->index(vp);
-    if ( is_flipable(ni,i) ) edges.push( Edge(ni,i) );
-  }
-}
-
-template <class Gt, class Tds, class Itag >
-void
-Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
-propagating_flip(Face_handle f,int i, int depth)
-{
-  if (!is_flipable(f,i)) return;
-#ifdef CGAL_CDT2_IMMEDIATELY_NON_RECURSIVE_PROPAGATING_FLIP
-  non_recursive_propagating_flip(f,i);
-#else
-  int max_depth = 100;
-  if(depth==max_depth){
-    non_recursive_propagating_flip(f,i);
-    return;
-  }
-
-  Face_handle ni = f->neighbor(i);
-  flip(f, i); // flip for constrained triangulations
-  propagating_flip(f,i);
-  i = ni->index(f->vertex(i));
-  propagating_flip(ni,i);
-#endif
-}
-#else 
-template < class Gt, class Tds, class Itag >
-void
-Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
-propagating_flip(Face_handle f,int i)
-// similar to the corresponding function in Delaunay_triangulation_2.h
-{
-  if (!is_flipable(f,i)) return;
-  Face_handle ni = f->neighbor(i);
-  flip(f, i); // flip for constrained triangulations
-  propagating_flip(f,i);
-  i = ni->index(f->vertex(i));
-  propagating_flip(ni,i);
-}
-#endif
-
- template < class Gt, class Tds, class Itag > 
- void
- Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>:: 
- propagating_flip(List_edges & edges) {
-    propagating_flip(edges,Emptyset_iterator());
- }
-
-
-template < class Gt, class Tds, class Itag >
-inline bool
-Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
-test_conflict(const Point& p, Face_handle fh) const
-  // true if point P lies inside the circle circumscribing face fh
-{
-  // return true  if P is inside the circumcircle of fh
-  // if fh is infinite, return true when p is in the positive
-  // halfspace or on the boundary and in the  finite edge of fh
-  Oriented_side os = side_of_oriented_circle(fh,p,true);
-  if (os == ON_POSITIVE_SIDE) return true;
- 
-  if (os == ON_ORIENTED_BOUNDARY && is_infinite(fh)) {
-    int i = fh->index(infinite_vertex());
-    return collinear_between(fh->vertex(cw(i))->point(), p,
-			     fh->vertex(ccw(i))->point() );
-  }
-
-  return false;
-}
-
-template < class Gt, class Tds, class Itag >
-inline bool
-Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
-test_conflict(Face_handle fh, const Point& p) const
-  // true if point P lies inside the circle circumscribing face fh
-{
-  return test_conflict(p,fh);
-}
-
-template < class Gt, class Tds, class Itag >    
-void 
-Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
-find_conflicts(const Point& p, std::list<Edge>& le, Face_handle hint) const
-{
-  // sets in le the counterclocwise list of the edges of the boundary of the 
-  // union of the faces in conflict with p
-  // an edge is represented by the incident face that is not in conflict with p
-  get_boundary_of_conflicts(p, std::back_inserter(le), hint);
-}
-  
-template < class Gt, class Tds, class Itag >  
-inline 
-typename Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::Vertex_handle 
-Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
-virtual_insert(const Point & a, Face_handle start)
-  // virtual version of the insertion
-{
-  return insert(a,start);
-}
-
-template < class Gt, class Tds, class Itag >  
-inline 
-typename Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::Vertex_handle 
-Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
-virtual_insert(const Point& a,
-	       Locate_type lt,
-	       Face_handle loc, 
-	       int li )
-// virtual version of insert
-{
-  return insert(a,lt,loc,li);
-}
-
-template < class Gt, class Tds, class Itag >  
-inline 
-typename Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::Vertex_handle 
-Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
-insert(const Point & a, Face_handle start)
- // inserts a in the triangulation
-// constrained edges are updated
-// Delaunay property is restored
-{
-  Vertex_handle va= Ctr::insert(a, start);
-  flip_around(va); 
-  return va;
-}
-
-template < class Gt, class Tds, class Itag >
-typename Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::Vertex_handle
-Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
-insert(const Point& a, Locate_type lt, Face_handle loc, int li)
-// insert a point p, whose localisation is known (lt, f, i)
-// constrained edges are updated
-// Delaunay property is restored
-{
-  Vertex_handle va= Ctr::insert(a,lt,loc,li);
-  flip_around(va); 
-  return va;
-}
-
-template < class Gt, class Tds, class Itag >
-inline
-typename Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::Vertex_handle
-Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
-push_back(const Point &p)
-{
-  return insert(p);
-}
-
-template < class Gt, class Tds, class Itag >
-void 
-Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
-triangulate_hole(List_faces& intersected_faces,
-		 List_edges& conflict_boundary_ab,
-		 List_edges& conflict_boundary_ba)
-{
-  List_edges new_edges;
-  Ctr::triangulate_hole(intersected_faces,
-		       conflict_boundary_ab,
-		       conflict_boundary_ba,
-		       new_edges);
-  propagating_flip(new_edges);
-  return;
-}
-
-
-template < class Gt, class Tds, class Itag >  
-inline void 
-Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
-remove(Vertex_handle v)
-  // remove a vertex and updates the constrained edges of the new faces
-  // precondition : there is no incident constraints
-{
-  CGAL_triangulation_precondition( v != Vertex_handle() );
-  CGAL_triangulation_precondition( ! is_infinite(v));
-  CGAL_triangulation_precondition( ! are_there_incident_constraints(v));
-  if  (dimension() <= 1)    Ctr::remove(v);
-  else  remove_2D(v);
-  return;
-}
-
-// template < class Gt, class Tds, class Itag >  
-// typename
-// Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::Vertex_handle
-// Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
-// special_insert_in_edge(const Point & a, Face_handle f, int i)
-//   // insert  point p in edge(f,i)
-//   // bypass the precondition for point a to be in edge(f,i)
-//   // update constrained status
-//   // this member fonction is not robust with exact predicates 
-//   // and approximate construction. Should be removed 
-// {
-//   Vertex_handle vh=Ctr::special_insert_in_edge(a,f,i);
-//   flip_around(vh);
-//   return vh;
-// }
-
-template < class Gt, class Tds, class Itag >  
-void 
-Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
-remove_2D(Vertex_handle v)
-{
- if (test_dim_down(v)) {  this->_tds.remove_dim_down(v);  }
-  else {
-     std::list<Edge> hole;
-    make_hole(v, hole);
-    std::list<Edge> shell=hole; //because hole will be emptied by fill_hole
-    fill_hole_delaunay(hole);
-    update_constraints(shell);
-    delete_vertex(v);
-  }
-  return;
-}
-
-template < class Gt, class Tds, class Itag >
-void
-Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
-remove_incident_constraints(Vertex_handle v)
-{
-   List_edges iconstraints;
-   if (are_there_incident_constraints(v,
-				      std::back_inserter(iconstraints))) {
-     Ctr::remove_incident_constraints(v);
-     if (dimension()==2) propagating_flip(iconstraints);
-   }
-   return;
-}
-
-template < class Gt, class Tds, class Itag >
-void
-Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
-remove_constrained_edge(Face_handle f, int i)
-{
-  remove_constrained_edge(f,i,Emptyset_iterator());
-  return;  
-}
-
-
-template < class Gt, class Tds, class Itag >  
-bool 
-Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
-is_valid(bool verbose, int level) const
-{
-  bool result = Ctr::is_valid(verbose, level);
-  CGAL_triangulation_assertion( result );
-
-    Finite_faces_iterator fit= finite_faces_begin();
-    for (; fit != finite_faces_end(); fit++) {
-      for(int i=0;i<3;i++) {
-	result = result && !is_flipable(fit,i, false);
-	CGAL_triangulation_assertion( result );
-      }
-    }
-    return result;
-}
-
-
-
-} //namespace CGAL
-#endif // CGAL_CONSTRAINED_DELAUNAY_TRIANGULATION_2_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Constrained_triangulation_2.h b/3rdparty/CGAL-4.8/include/CGAL/Constrained_triangulation_2.h
deleted file mode 100644
index 4ffa918..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Constrained_triangulation_2.h
+++ /dev/null
@@ -1,1433 +0,0 @@
-// Copyright (c) 1997  INRIA Sophia-Antipolis (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
-// 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(s)     : Mariette Yvinec, Jean-Daniel Boissonnat
-
-
-#ifndef CGAL_CONSTRAINED_TRIANGULATION_2_H
-#define CGAL_CONSTRAINED_TRIANGULATION_2_H
-
-#include <set>
-
-#include <CGAL/triangulation_assertions.h>
-#include <CGAL/Triangulation_2.h> 
-#include <CGAL/Constrained_triangulation_face_base_2.h>
-#include <CGAL/iterator.h>
-
-#include <CGAL/intersections.h>
-#include <CGAL/squared_distance_2.h>
-
-namespace CGAL {
-
-struct No_intersection_tag{};
-struct Exact_intersections_tag{}; // to be used with an exact number type
-struct Exact_predicates_tag{}; // to be used with filtered exact number
-
-
-template < class Gt, 
-           class Tds = Triangulation_data_structure_2 <
-                       Triangulation_vertex_base_2<Gt>,
-		       Constrained_triangulation_face_base_2<Gt> >, 
-           class Itag = No_intersection_tag >
-class Constrained_triangulation_2  : public Triangulation_2<Gt,Tds>
-{
-
-public:
-  typedef Triangulation_2<Gt,Tds> Triangulation;
-  typedef Constrained_triangulation_2<Gt,Tds,Itag>  Constrained_triangulation;
-  
-  typedef typename Triangulation::Edge Edge;
-  typedef typename Triangulation::Vertex Vertex;
-  typedef typename Triangulation::Vertex_handle Vertex_handle;
-  typedef typename Triangulation::Face_handle Face_handle;
-  typedef typename Triangulation::size_type size_type;
-  typedef typename Triangulation::Locate_type Locate_type;
-  typedef typename Triangulation::All_faces_iterator All_faces_iterator;
-  typedef typename Triangulation::Face_circulator Face_circulator;
-  typedef typename Triangulation::Edge_circulator Edge_circulator;
-  typedef typename Triangulation::Vertex_circulator Vertex_circulator;
-  typedef typename Triangulation::Line_face_circulator Line_face_circulator;
-
-#ifndef CGAL_CFG_USING_BASE_MEMBER_BUG_2
-  using Triangulation::number_of_vertices;
-  using Triangulation::cw;
-  using Triangulation::ccw;
-  using Triangulation::dimension;
-  using Triangulation::geom_traits;
-  using Triangulation::all_faces_begin;
-  using Triangulation::all_faces_end;
-  using Triangulation::side_of_oriented_circle;
-  using Triangulation::is_infinite;
-  using Triangulation::collinear_between;
-  using Triangulation::incident_edges;
-  using Triangulation::test_dim_down;
-  using Triangulation::make_hole;
-  using Triangulation::fill_hole;
-  using Triangulation::delete_vertex;
-  using Triangulation::delete_face;
-  using Triangulation::create_face;
-  using Triangulation::incident_faces;
-  using Triangulation::locate;
-  using Triangulation::includes_edge;
-  using Triangulation::remove_first;
-  using Triangulation::remove_second;
-#endif
-
-  typedef Gt                                 Geom_traits;
-  typedef Itag                               Intersection_tag;
-  typedef typename Geom_traits::Point_2      Point;
-  typedef typename Geom_traits::Segment_2    Segment;
-  typedef std::pair<Point,Point>             Constraint;
-  typedef std::list<Edge>                    List_edges;
-  typedef std::list<Face_handle>             List_faces;
-  typedef std::list<Vertex_handle>           List_vertices;
-  typedef std::list<Constraint>              List_constraints;
-
-  // Tag to mark the presence of a hierarchy of constraints
- typedef Tag_false                           Constraint_hierarchy_tag;
-   
-
-  class Less_edge;
-  typedef std::set<Edge,Less_edge> Edge_set;
-
-
-  Constrained_triangulation_2(const Gt& gt = Gt()) : Triangulation(gt) { }
-
-  Constrained_triangulation_2(const Constrained_triangulation_2& ct)
-    : Triangulation(ct) {}
-
-  Constrained_triangulation_2(std::list<Constraint>& lc, const Gt& gt=Gt())
-      : Triangulation_2<Gt,Tds>(gt)
-  {
-    typename List_constraints::iterator lcit=lc.begin();
-    for( ;lcit != lc.end(); lcit++) {
-      insert( (*lcit).first, (*lcit).second);
-    }
-     CGAL_triangulation_postcondition( this->is_valid() );
-  }
-
-  template<class InputIterator>
-  Constrained_triangulation_2(InputIterator it,
-			      InputIterator last,
-			      const Gt& gt=Gt() )
-     : Triangulation_2<Gt,Tds>(gt)
-  {
-    for ( ; it != last; it++) {
-      	insert_constraint((*it).first, (*it).second);
-      }
-      CGAL_triangulation_postcondition( this->is_valid() );
-  }
-
-  //TODO Is that destructor correct ?
-  virtual ~Constrained_triangulation_2() {}
-
-  // INSERTION
-  Vertex_handle insert(const Point& p, 
-			       Face_handle start = Face_handle() );
-  Vertex_handle insert(const Point& p,
-		       Locate_type lt,
-		       Face_handle loc, 
-		       int li );
-  Vertex_handle push_back(const Point& a);
-//   template < class InputIterator >
-//   std::ptrdiff_t insert(InputIterator first, InputIterator last);
-
-
-
-  // The iterator range [edge_it, edge_pteit) is a set of edges
-  // that delimit areas in the triangulation.
-  // This function writes the face handles that cover this
-  // area to the output iterator faces_it
-  template <class InputIterator, class OutputIterator>
-  void
-  get_bounded_faces(InputIterator edge_it, InputIterator edge_pteit,
-		    OutputIterator faces_it) const
-  {
-    Edge e;
-    Unique_hash_map<Face_handle,bool> visited;
-    std::stack<Face_handle> st;
-
-    for(; edge_it != edge_pteit; edge_it++){
-      e = *edge_it;
-      visited[e.first] = true;
-      st.push(e.first->neighbor(e.second));
-    }
-
-    while(! st.empty()){
-      Face_handle fh = st.top();
-      st.pop();
-      typename CGAL::Unique_hash_map<Face_handle, bool>::Data& data = visited[fh];    
-      if(! data) {
-	data = true;
-	*faces_it++ = fh;
-	for(int i = 0 ; i < 3 ; ++i){
-	  Face_handle n = fh->neighbor(i);
-	  if(! visited[n]) {
-	    st.push(n);
-	  }
-	}
-      }
-    }
-
-  }
-
-#if 1
-  template <class Segment_2>
-  static const Point& get_source(const Segment_2& segment){
-    return segment.source();
-  }
-  template <class Segment_2>
-  static const Point& get_target(const Segment_2& segment){
-    return segment.target();
-  }
-
-  static const Point& get_source(const Constraint& cst){
-    return cst.first;
-  }
-  static const Point& get_target(const Constraint& cst){
-    return cst.second;
-  }
-#endif
-
-  // A version of insert_constraint, that additionally writes
-  // the new faces in an output iterator
-  // We duplicate code, as to run this one with an Emptyset_iterator 
-  // is still too much overhead 
-template <class OutputIterator>
-void
-insert_constraint(Vertex_handle  vaa, Vertex_handle vbb, OutputIterator out)
-// forces the constrained [va,vb]
-// [va,vb] will eventually be splitted into several edges
-// if a vertex vc of t lies on segment ab
-// of if ab intersect some constrained edges
-{
-  CGAL_triangulation_precondition( vaa != vbb);
-  Vertex_handle vi;
-
-  Face_handle fr;
-  int i;
-  if(includes_edge(vaa,vbb,vi,fr,i)) {
-    mark_constraint(fr,i);
-    if (vi != vbb)  {
-      insert_constraint(vi,vbb,out);
-    }
-    return;
-  }
-
-  List_faces intersected_faces;
-  List_edges conflict_boundary_ab, conflict_boundary_ba;
-
-  bool intersection  = find_intersected_faces( vaa, vbb,
-			                       intersected_faces,
-					       conflict_boundary_ab,
-					       conflict_boundary_ba,
-					       vi);
-  if ( intersection) {
-    if (vi != vaa && vi != vbb) {
-      insert_constraint(vaa,vi,out); 
-      insert_constraint(vi,vbb,out); 
-     }
-    else {
-      insert_constraint(vaa,vbb,out);
-    }
-    return;
-  }
-  List_edges edges(conflict_boundary_ab);
-  std::copy(conflict_boundary_ba.begin(), conflict_boundary_ba.end(), std::back_inserter(edges));
-
-  typename List_edges::iterator last = edges.end();
-  --last;
-  for(typename List_edges::iterator it = edges.begin();
-      it != last;
-      ){
-    typename List_edges::iterator n = it;
-    ++n;
-    if(it->first == n->first->neighbor(n->second) ){
-      // remove dangling edge
-      edges.erase(it);
-      it = n;
-      ++n;
-      edges.erase(it);
-    }
-    it = n;
-  }
-  triangulate_hole(intersected_faces,
-		   conflict_boundary_ab,
-		   conflict_boundary_ba);
-
-  get_bounded_faces(edges.begin(),
-		    edges.end(),
-		    out);
-  
-  if (vi != vbb) {
-    insert_constraint(vi,vbb,out); 
-  }
-  return;
-
-}
- 
-  void insert_constraint(const Point& a, const Point& b);
-  void insert_constraint(Vertex_handle va, Vertex_handle  vb);
-  void push_back(const Constraint& c);
-
-
-  template <class PointIterator>
-  void insert_constraint(PointIterator first, PointIterator last, bool close=false)
-  {
-    if(first == last){
-      return;
-    }
-    const Point& p0 = *first;
-    Point p = p0;
-    Vertex_handle v0 = insert(p0), v(v0), w(v0);
-    ++first;
-    for(; first!=last; ++first){
-      const Point& q = *first;
-      if(p != q){
-        w = insert(q);
-        insert_constraint(v,w);
-        v = w;
-        p = q;
-      }
-    }
-    if(close && (p != p0)){
-      insert(w,v0);
-    }
-  }
-
-  void remove(Vertex_handle  v);
-  void remove_constrained_edge(Face_handle f, int i);
-  void remove_incident_constraints(Vertex_handle  v);
-  // to be used by Constrained_triangulation_plus_2
- template <class OutputItFaces>
- OutputItFaces 
- remove_constrained_edge(Face_handle f, int i, OutputItFaces out) 
- {
-   remove_constrained_edge(f, i);
-   return out;
- }
-
-  //for backward compatibility
-  void remove_constraint(Face_handle f, int i) {remove_constrained_edge(f,i);}
-  void insert(Point a, Point b) { insert_constraint(a, b);}
-  void insert(Vertex_handle va, Vertex_handle  vb) {insert_constraint(va,vb);}
-
-  // QUERY
-  bool is_constrained(Edge e) const;
-  bool are_there_incident_constraints(Vertex_handle v) const;
-  bool is_valid(bool verbose = false, int level = 0) const;
-  // template<class OutputItEdges>
-  // OutputItEdges incident_constraints(Vertex_handle v, 
-  //                                     OutputItEdges out) const;
-  
-
-  class Less_edge 
-    :  public std::binary_function<Edge, Edge, bool>
-  {
-  public:
-    Less_edge() {}
-    bool operator() (const Edge& e1, const Edge& e2) const
-      {
-	int ind1=e1.second, ind2=e2.second;
- 	return( (&(*e1.first) < &(*e2.first))
- 		|| ( (&(*e1.first) == &(*e2.first)) && (ind1 < ind2)));
-      } 
-  };
-
-
-  void file_output(std::ostream& os) const;
-
-protected:
-  virtual Vertex_handle virtual_insert(const Point& a, 
-				       Face_handle start = Face_handle());
-  virtual Vertex_handle virtual_insert(const Point& a,
-				       Locate_type lt,
-				       Face_handle loc, 
-				       int li );
-//Vertex_handle special_insert_in_edge(const Point & a, Face_handle f, int i);
-  void update_constraints_incident(Vertex_handle va, 
-				   Vertex_handle c1,
-				   Vertex_handle c2);
-  void clear_constraints_incident(Vertex_handle va);
-  void update_constraints_opposite(Vertex_handle va);
-  void update_constraints(const List_edges &hole);
-
-  void mark_constraint(Face_handle fr, int i);
-
-  virtual Vertex_handle intersect(Face_handle f, int i, 
-			  Vertex_handle vaa,
-			  Vertex_handle vbb);
-  Vertex_handle intersect(Face_handle f, int i, 
-			  Vertex_handle vaa,
-			  Vertex_handle vbb,
-			  No_intersection_tag);
-  Vertex_handle intersect(Face_handle f, int i, 
-			  Vertex_handle vaa,
-			  Vertex_handle vbb,
-			   Exact_intersections_tag);
-  Vertex_handle intersect(Face_handle f, int i, 
-			  Vertex_handle vaa,
-			  Vertex_handle vbb,
-			  Exact_predicates_tag);
-private:
-  //made private to avoid using the Triangulation_2 version
-  Vertex_handle move(Vertex_handle v, const Point &)
-  {
-    CGAL_error_msg("Do not use that function!");
-    return v;
-  }
-
-public:
-// made public for Laurent  to find out deleted faces
-// when inserting a constraint with most probably 
-// no intersection
-  bool find_intersected_faces(Vertex_handle va, 
-			      Vertex_handle vb,
-			      List_faces & intersected_faces,
-			      List_edges & list_ab, 
-			      List_edges & list_ba,
-			      Vertex_handle& vi);
-protected:
-  virtual void triangulate_hole(List_faces& intersected_faces,
-				List_edges& conflict_boundary_ab,
-				List_edges& conflict_boundary_ba);
-  
-  void triangulate_hole(List_faces& intersected_faces,
-			List_edges& conflict_boundary_ab,
-			List_edges& conflict_boundary_ba,
-			List_edges& new_edges);
-  
-  void triangulate_half_hole(List_edges & list_edges, 
-			     List_edges & new_edges);
-
-  void remove_1D(Vertex_handle v);
-  void remove_2D(Vertex_handle v);
-
-  //templated member function
-public:
-  // the int parameter is a work around for VC7 to compile
-  template < class InputIterator >
-#if defined(_MSC_VER)
-  std::ptrdiff_t insert(InputIterator first, InputIterator last, int i = 0)
-#else
-    std::ptrdiff_t insert(InputIterator first, InputIterator last) 
-#endif
-    {
-      size_type n = number_of_vertices(); 
-
-      std::vector<Point> points (first, last);
-      CGAL::spatial_sort (points.begin(), points.end(), geom_traits());
-
-      Face_handle hint;
-      for (typename std::vector<Point>::const_iterator p = points.begin(), end = points.end();
-              p != end; ++p)
-          hint = insert (*p, hint)->face();
-
-      return number_of_vertices() - n;
-    }
-
-  //deprecated
- template<class OutputIterator>
-  bool are_there_incident_constraints(Vertex_handle v, 
-				      OutputIterator out) const
-    {
-      Edge_circulator ec=incident_edges(v), done(ec);
-      bool are_there = false;
-      if (ec == 0) return are_there;
-      do {
-	if(is_constrained(*ec)) {
-	  *out++ = *ec;
-	  are_there = true;
-	}
-	ec++;
-      } while (ec != done);
-      return are_there;
-    }
-
-  
- template<class OutputItEdges>
- OutputItEdges  incident_constraints(Vertex_handle v, 
-				      OutputItEdges out) const {
-   Edge_circulator ec=incident_edges(v), done(ec);
-   if (ec == 0) return  out;
-   do {
-     if(is_constrained(*ec))    *out++ = *ec;
-     ec++;
-   } while (ec != done);
-   return out;
- }
- 
-  // the following fonctions are overloaded 
-  // to take care of constraint marks 
-  template<class EdgeIt>
-  Vertex_handle star_hole( const Point& p, 
-			   EdgeIt edge_begin,  
-			   EdgeIt edge_end) {
-    std::list<Face_handle> empty_list;
-    return star_hole(p, 
-		     edge_begin, 
-		     edge_end, 
-		     empty_list.begin(),
-		     empty_list.end());
-  }
-
-  template<class EdgeIt, class FaceIt>
-  Vertex_handle star_hole( const Point& p, 
-			   EdgeIt edge_begin,
-			   EdgeIt edge_end,
-			   FaceIt face_begin,
-			   FaceIt face_end)
-{
-    Vertex_handle v =  Triangulation::star_hole(p, 
-						edge_begin, 
-						edge_end, 
-						face_begin,
-						face_end);
-    // restore constraint status for new faces.
-    int vindex;
-    Face_handle fh;
-    int ih;
-    Face_circulator fc = incident_faces(v), done(fc);
-    do {
-      vindex = fc->index(v);
-      fc->set_constraint(cw(vindex), false);
-      fc->set_constraint(ccw(vindex), false);
-      fh = fc->neighbor(vindex);
-      ih = this->mirror_index(fc,vindex);
-      fc->set_constraint(vindex, fh->is_constrained(ih));
-    } while (++fc != done);
-    return v;
-}
- 
-};
-
-template < class Gt, class Tds, class Itag >
-inline
-typename Constrained_triangulation_2<Gt,Tds,Itag>::Vertex_handle
-Constrained_triangulation_2<Gt,Tds,Itag>::
-virtual_insert(const Point& a, Face_handle start)
-// virtual version of insert
-{
-  return insert(a,start);
-}
-
-template < class Gt, class Tds, class Itag >
-inline
-typename Constrained_triangulation_2<Gt,Tds,Itag>::Vertex_handle
-Constrained_triangulation_2<Gt,Tds,Itag>::
-virtual_insert(const Point& a,
-	       Locate_type lt,
-	       Face_handle loc, 
-	       int li )
-// virtual version of insert
-{
-  return insert(a,lt,loc,li);
-}
-    
-template < class Gt, class Tds, class Itag >
-inline
-typename Constrained_triangulation_2<Gt,Tds,Itag>::Vertex_handle
-Constrained_triangulation_2<Gt,Tds,Itag>::
-insert(const Point& a, Face_handle start)
-// inserts point a 
-// in addition to what is done for non constrained triangulations
-// constrained edges are updated
-{
-  Face_handle loc;
-  int li;
-  Locate_type lt;
-  loc = locate(a, lt, li, start);
-  return Constrained_triangulation::insert(a,lt,loc,li);
-}
-
-template < class Gt, class Tds, class Itag >
-typename Constrained_triangulation_2<Gt,Tds,Itag>::Vertex_handle
-Constrained_triangulation_2<Gt,Tds,Itag>::
-insert(const Point& a, Locate_type lt, Face_handle loc, int li)
-// insert a point p, whose localisation is known (lt, f, i)
-// in addition to what is done for non constrained triangulations
-// constrained edges are updated
-{
-  Vertex_handle va;
-  Vertex_handle v1, v2;
-  bool insert_in_constrained_edge = false;
-
-  if ( lt == Triangulation::EDGE && loc->is_constrained(li) ){
-    insert_in_constrained_edge = true;
-    v1=loc->vertex(ccw(li)); //endpoint of the constraint
-    v2=loc->vertex(cw(li)); // endpoint of the constraint
-  }
-
-  va = Triangulation::insert(a,lt,loc,li);
-  if (insert_in_constrained_edge) update_constraints_incident(va, v1,v2);
-  else if(lt != Triangulation::VERTEX) clear_constraints_incident(va);
-  if (dimension() == 2) update_constraints_opposite(va);
-  return va;
-}
-
-// template < class Gt, class Tds, class Itag >  
-// typename Constrained_triangulation_2<Gt,Tds,Itag>::Vertex_handle 
-// Constrained_triangulation_2<Gt, Tds, Itag>::
-// special_insert_in_edge(const Point & a, Face_handle f, int i)
-//   // insert  point p in edge(f,i)
-//   // bypass the precondition for point a to be in edge(f,i)
-//   // update constrained status
-// {
-//   Vertex_handle va;
-//   Vertex_handle c1,c2;
-//   c1 = f->vertex(cw(i));  //endpoint of edge
-//   c2 = f->vertex(ccw(i)); //endpoint of edge
-//   bool insert_in_constrained_edge = f->is_constrained(i);
- 
-//   va = this->_tds.insert_in_edge(f, i);
-//   va->set_point(a);
-
-//   if (insert_in_constrained_edge) update_constraints_incident(va, c1,c2);
-//   else clear_constraints_incident(va);
-//   if (dimension() == 2) update_constraints_opposite(va);
-//   return va;
-// }
-
-
-template < class Gt, class Tds, class Itag >
-inline void
-Constrained_triangulation_2<Gt,Tds,Itag>::
-insert_constraint(const Point& a, const Point& b)
-// the algorithm first inserts a and b, 
-// and then forces the constraint [va,vb]
-{
-  Vertex_handle va= virtual_insert(a);
-  Vertex_handle vb= virtual_insert(b);
-  if ( va != vb)   insert_constraint(va,vb);
-}
-
-
-template <class Gt, class Tds, class Itag >
-inline void
-Constrained_triangulation_2<Gt,Tds,Itag>::
-insert_constraint(Vertex_handle  vaa, Vertex_handle vbb)
-// forces the constraint [va,vb]
-// [va,vb] will eventually be split into several edges
-// if a vertex vc of t lies on segment ab
-// or if ab intersect some constrained edges
-{
-  CGAL_triangulation_precondition( vaa != vbb);
-  Vertex_handle vi;
-
-  Face_handle fr;
-  int i;
-  if(includes_edge(vaa,vbb,vi,fr,i)) {
-    mark_constraint(fr,i);
-    if (vi != vbb)  {
-      insert_constraint(vi,vbb);
-    }
-    return;
-  }
-      
-  List_faces intersected_faces;
-  List_edges conflict_boundary_ab, conflict_boundary_ba;
-     
-  bool intersection  = find_intersected_faces( vaa, vbb,
-			                       intersected_faces,
-					       conflict_boundary_ab,
-					       conflict_boundary_ba,
-					       vi);
-  if ( intersection) {
-    if (vi != vaa && vi != vbb) {
-      insert_constraint(vaa,vi); 
-      insert_constraint(vi,vbb); 
-     }
-    else insert_constraint(vaa,vbb);
-    return;
-  }
-
-  //no intersection
-  triangulate_hole(intersected_faces,
-		   conflict_boundary_ab,
-		   conflict_boundary_ba);
-
-  if (vi != vbb) {
-    insert_constraint(vi,vbb); 
-  }
-  return;
-
-}
-
-template <class Gt, class Tds, class Itag >
-bool
-Constrained_triangulation_2<Gt,Tds,Itag>::
-find_intersected_faces(Vertex_handle vaa,
-		       Vertex_handle vbb,
-		       List_faces & intersected_faces,
-		       List_edges & list_ab, 
-		       List_edges & list_ba,
-		       Vertex_handle & vi) 
-  // vi is set to the first vertex of the triangulation on [vaa,vbb].
-  // Return true if an intersection with a constrained edge is
-  // encountered, false otherwise
-  // When false : 
-  // intersected_faces contains the list if faces intersected by [va,vi]
-  // list_ab and list_ba represents the boundary of the union
-  // of the intersected faces oriented cw
-  // list_ab consists of the edges from vaa to vi (i.e. on the left of a->b)
-  // list_ba    "         "        from vi to vaa (i.e. on the right of a->b)
-{
-  const Point& aa = vaa->point();
-  const Point& bb = vbb->point();
-  Line_face_circulator current_face=Line_face_circulator(vaa, this, bb);
-  int ind=current_face->index(vaa);
-      
-  // to deal with the case where the first crossed edge
-  // is constrained
-  if(current_face->is_constrained(ind)) {
-    vi=intersect(current_face, ind, vaa, vbb);
-    return true;
-  }
-
-  Face_handle lf= current_face->neighbor(ccw(ind)); 
-  Face_handle rf= current_face->neighbor(cw(ind));
-  Orientation orient;
-  Face_handle previous_face;
-  Vertex_handle current_vertex;	
-
-  list_ab.push_back(Edge(lf, lf->index(current_face)));
-  list_ba.push_front(Edge(rf, rf->index(current_face)));
-  intersected_faces.push_front(current_face);
-
-  // initcd
-  previous_face=current_face; 
-  ++current_face;
-  ind=current_face->index(previous_face);  
-  current_vertex=current_face->vertex(ind);  
-
-  // loop over triangles intersected by ab
-  bool done = false;
-  while (current_vertex != vbb && !done)  { 
-    orient = this->orientation(aa,bb,current_vertex->point());
-    int i1, i2;
-    switch (orient) {
-    case COLLINEAR :  
-      done = true; // current_vertex is the new endpoint
-      break;
-    case LEFT_TURN :
-    case RIGHT_TURN :
-      if (orient == LEFT_TURN) {
-	i1 = ccw(ind) ; //index of second intersected edge of current_face
-	i2 = cw(ind); //index of non intersected edge of current_face
-      }
-      else {
-	i1 = cw(ind) ; //index of second intersected edge of current_face
-	i2 = ccw(ind); //index of non intersected edge of current_face
-      }
-      if(current_face->is_constrained(i1)) {
-	vi = intersect(current_face, i1, vaa,vbb);
-	return true;
-      }
-      else {
-	lf= current_face->neighbor(i2);
-	intersected_faces.push_front(current_face);
-	if (orient == LEFT_TURN) 
-	  list_ab.push_back(Edge(lf, lf->index(current_face)));
-	else // orient == RIGHT_TURN
-	  list_ba.push_front(Edge(lf, lf->index(current_face)));
-	previous_face=current_face;
-	++current_face;
-	ind=current_face->index(previous_face); 
-	current_vertex=current_face->vertex(ind);
-      }
-      break;
-    }
-  }
-    
-  // last triangle 
-  vi = current_vertex;
-  intersected_faces.push_front(current_face);
-  lf= current_face->neighbor(cw(ind));
-  list_ab.push_back(Edge(lf, lf->index(current_face))); 
-  rf= current_face->neighbor(ccw(ind));
-  list_ba.push_front(Edge(rf, rf->index(current_face)));
-  return false;
-}
-
-
-template <class Gt, class Tds, class Itag >
-typename Constrained_triangulation_2<Gt,Tds,Itag>::Vertex_handle 
-Constrained_triangulation_2<Gt,Tds,Itag>::
-intersect(Face_handle f, int i, 
-	  Vertex_handle vaa,
-	  Vertex_handle vbb) 
-{
-  return intersect(f, i, vaa, vbb, Itag());
-}
-
-template <class Gt, class Tds, class Itag >
-typename Constrained_triangulation_2<Gt,Tds,Itag>::Vertex_handle 
-Constrained_triangulation_2<Gt,Tds,Itag>::
-intersect(Face_handle , int , 
-	  Vertex_handle ,
-	  Vertex_handle ,
-	  No_intersection_tag)
-{
-  //SL: I added that to be able to throw while we find a better solution
-  #ifdef CGAL_CT2_WANTS_TO_HAVE_EXTRA_ACTION_FOR_INTERSECTING_CONSTRAINTS
-  CGAL_CDT2_EXTRA_ACTION_FOR_INTERSECTING_CONSTRAINTS
-  #endif
-  
-  std::cerr << " sorry, this triangulation does not deal with" 
-	    <<    std::endl
-	    << " intersecting constraints" << std::endl;
-  CGAL_triangulation_assertion(false);
-  return Vertex_handle() ;
-}
-
-template <class Gt, class Tds, class Itag >
-typename Constrained_triangulation_2<Gt,Tds,Itag>::Vertex_handle 
-Constrained_triangulation_2<Gt,Tds,Itag>::
-intersect(Face_handle f, int i, 
-	  Vertex_handle vaa,
-	  Vertex_handle vbb,
-	  Exact_intersections_tag)
-// compute the intersection of the constraint edge (f,i) 
-// with the subconstraint (vaa,vbb) being inserted
-// insert the intersection point
-// split constraint edge (f,i) 
-// and return the Vertex_handle of the new Vertex
-{ 
-  std::cerr << "You are using an exact number types" << std::endl;
-  std::cerr << "using a Constrained_triangulation_plus_2 class" << std::endl;
-  std::cerr << "would avoid cascading intersection computation" << std::endl;
-  std::cerr << " and be much more efficient" << std::endl;
-  const Point& pa = vaa->point();
-  const Point& pb = vbb->point();
-  const Point& pc = f->vertex(cw(i))->point();
-  const Point& pd = f->vertex(ccw(i))->point();
-  Point pi;
-  Itag itag = Itag();
-  CGAL_triangulation_assertion_code( bool ok = )
-  intersection(geom_traits(), pa, pb, pc, pd, pi, itag );
-  CGAL_triangulation_assertion(ok);
-  Vertex_handle vi = virtual_insert(pi, Triangulation::EDGE, f, i);
-  return vi; 
-}
-
-template <class Gt, class Tds, class Itag >
-typename Constrained_triangulation_2<Gt,Tds,Itag>::Vertex_handle 
-Constrained_triangulation_2<Gt,Tds,Itag>::
-intersect(Face_handle f, int i, 
-	  Vertex_handle vaa,
-	  Vertex_handle vbb,
-	  Exact_predicates_tag)
-{
-  Vertex_handle  vcc, vdd;
-  vcc = f->vertex(cw(i));
-  vdd = f->vertex(ccw(i));
-
-  const Point& pa = vaa->point();
-  const Point& pb = vbb->point();
-  const Point& pc = vcc->point();
-  const Point& pd = vdd->point();
-
-  Point pi; //creator for point is required here
-  Itag itag = Itag();
-  bool ok  = intersection(geom_traits(), pa, pb, pc, pd, pi, itag );
-
-  Vertex_handle vi;
-  if ( !ok) {  //intersection detected but not computed
-    int i = limit_intersection(geom_traits(), pa, pb, pc, pd, itag);
-    switch(i){
-    case 0 : vi = vaa; break;
-    case 1 : vi = vbb; break;
-    case 2 : vi = vcc; break;
-    case 3 : vi = vdd; break; 
-    }
-    if(vi == vaa || vi == vbb) {
-      remove_constrained_edge(f, i);
-    }
-  }
-  else{ //intersection computed
-    remove_constrained_edge(f, i);
-    vi = virtual_insert(pi, f);
-  }
-
-  // vi == vc or vi == vd may happen even if intersection==true
-  // due to approximate construction of the intersection
-  if (vi != vcc && vi != vdd) { 
-    insert_constraint(vcc,vi); 
-    insert_constraint(vi, vdd);
-  } 
-  else {
-    insert_constraint(vcc,vdd);
-  }
-  return vi; 
-}
-
-template <class Gt, class Tds, class Itag >
-inline
-typename Constrained_triangulation_2<Gt,Tds,Itag>::Vertex_handle
-Constrained_triangulation_2<Gt,Tds,Itag>::
-push_back(const Point &p)
-{
-  return insert(p);
-}
-
-
-template <class Gt, class Tds, class Itag >
-inline
-void
-Constrained_triangulation_2<Gt,Tds,Itag>::
-push_back(const Constraint &c)
-{
-  insert(c.first, c.second);
-}
-
-
-template < class Gt, class Tds, class Itag >
-void
-Constrained_triangulation_2<Gt,Tds,Itag>::
-update_constraints_incident(Vertex_handle va, 
-			    Vertex_handle c1,
-			    Vertex_handle c2)
-  // update status of edges incident to a 
-  // after insertion in the  constrained edge c1c2
-{
-  if (dimension() == 0) return;
-  if (dimension()== 1) {
-    Edge_circulator ec=this->incident_edges(va), done(ec);
-    do {
-      ((*ec).first)->set_constraint(2,true);
-    }while (++ec != done);
-  }
-  else{
-    //dimension() ==2
-    int cwi, ccwi, indf;
-    Face_circulator fc=this->incident_faces(va), done(fc);  
-    CGAL_triangulation_assertion(fc != 0);
-    do {
-      indf = fc->index(va);
-      cwi=cw(indf);
-      ccwi=ccw(indf); 
-      if ((fc->vertex(cwi) == c1)||(fc->vertex(cwi) == c2)) {
-	  fc->set_constraint(ccwi,true);
-	  fc->set_constraint(cwi,false);
-	}	
-	else {
-	  fc->set_constraint(ccwi,false);
-	  fc->set_constraint(cwi,true);
-	}
-	++fc;
-      } while (fc != done);
-  }
-}
-
-template < class Gt, class Tds ,class Itag >
-void
-Constrained_triangulation_2<Gt,Tds,Itag>::
-clear_constraints_incident(Vertex_handle va)
-// make the edges incident to a newly created vertex unconstrained
-{
- Edge_circulator ec=this->incident_edges(va), done(ec);
- Face_handle f;
- int indf;
-  if ( ec != 0){
-    do {
-      f = (*ec).first ;
-      indf = (*ec).second;
-      f->set_constraint(indf,false);
-      if (dimension() == 2) {
-	f->neighbor(indf)->set_constraint(this->mirror_index(f,indf),false);
-      }
-    } while (++ec != done);
-  }
-  return;
-}
-
-
-template < class Gt, class Tds, class Itag >
-void
-Constrained_triangulation_2<Gt,Tds,Itag>::  
-update_constraints_opposite(Vertex_handle va)
-  // update status of edges opposite to a
-  // after insertion of a
-{
-  CGAL_triangulation_assertion(dimension()==2); 
-  Face_handle f=va->face(), start=f;
-  int indf;
-  do {
-    indf = f->index(va);
-    if (f->neighbor(indf)->is_constrained(this->mirror_index(f,indf)) ) {
-      f->set_constraint(indf,true);
-    }
-    else {
-      f->set_constraint(indf,false);
-    }
-    f= f->neighbor(ccw(indf)); // turns ccw around va 
-  } while (f != start);
-  return;
-}
-
-template < class Gt, class Tds, class Itag >
-void
-Constrained_triangulation_2<Gt,Tds,Itag>:: 
-update_constraints( const List_edges &hole)
-{
-  typename List_edges::const_iterator it = hole.begin();
-  Face_handle f;
-  int i;
-  for ( ; it != hole.end(); it ++) {
-    f =(*it).first;
-    i = (*it).second;
-    if ( f->is_constrained(i) ) 
-      (f->neighbor(i))->set_constraint(this->mirror_index(f,i),true);
-    else (f->neighbor(i))->set_constraint(this->mirror_index(f,i),false);
-  }
-}
-
-
-template < class Gt, class Tds, class Itag >
-inline void
-Constrained_triangulation_2<Gt,Tds,Itag>::
-mark_constraint(Face_handle fr, int i)
-{
-  if (dimension()==1) fr->set_constraint(2, true);
-  else{
-    fr->set_constraint(i,true);
-    fr->neighbor(i)->set_constraint(this->mirror_index(fr,i),true);
-  }
-  return;
-}
-
-template < class Gt, class Tds, class Itag >
-inline void
-Constrained_triangulation_2<Gt,Tds,Itag>::
-triangulate_hole(List_faces& intersected_faces,
-		 List_edges& conflict_boundary_ab,
-		 List_edges& conflict_boundary_ba)
-{
-  List_edges new_edges;
-  triangulate_hole(intersected_faces,
-		   conflict_boundary_ab,
-		   conflict_boundary_ba,
-		   new_edges);
-}
-
-
-
-template < class Gt, class Tds, class Itag >
-void
-Constrained_triangulation_2<Gt,Tds,Itag>::
-triangulate_hole(List_faces& intersected_faces,
-		 List_edges& conflict_boundary_ab,
-		 List_edges& conflict_boundary_ba,
-		 List_edges& new_edges)
-  // triangulate the hole limited by conflict_boundary_ab
-  // and conflict_boundary_ba
-  // insert the new edges in new-edges 
-  // delete the faces of intersected_faces
-{
-  if ( !conflict_boundary_ab.empty() ) {
-    triangulate_half_hole(conflict_boundary_ab, new_edges);
-    triangulate_half_hole(conflict_boundary_ba, new_edges);
-	
-    // the two faces that share edge ab are neighbors
-    // their common edge ab is a constraint
-    Face_handle fr,fl;
-    fl=(*conflict_boundary_ab.begin()).first;
-    fr=(*conflict_boundary_ba.begin()).first;
-    fl->set_neighbor(2, fr);
-    fr->set_neighbor(2, fl);
-    fl->set_constraint(2, true);
-    fr->set_constraint(2, true);
-   
-    // delete intersected faces
-    while( ! intersected_faces.empty()) {
-      fl = intersected_faces.front();
-      intersected_faces.pop_front();
-      delete_face(fl);
-    }
-  }
-}
-
-
-
-template < class Gt, class Tds, class Itag >
-void
-Constrained_triangulation_2<Gt,Tds,Itag>::
-remove(Vertex_handle  v)
-  // remove a vertex and updates the constrained edges of the new faces
-  // precondition : there is no incident constraints
-{
-  CGAL_triangulation_precondition( v != Vertex_handle() );
-  CGAL_triangulation_precondition( ! is_infinite(v));
-  CGAL_triangulation_precondition( ! are_there_incident_constraints(v));
-    
-  if  (number_of_vertices() == 1)     remove_first(v);
-  else if (number_of_vertices() == 2) remove_second(v);
-  else   if ( dimension() == 1) remove_1D(v);
-  else  remove_2D(v);
-  return;
-}
-
-
-template < class Gt, class Tds, class Itag >
-void
-Constrained_triangulation_2<Gt,Tds,Itag>::
-remove_1D(Vertex_handle  v)
-{
-  Edge_circulator ec = incident_edges(v), done(ec);
-  do {
-    (*ec).first->set_constraint(2,false);
-  } while (++ec != done);
-  Triangulation::remove_1D(v);
-}
-
-template < class Gt, class Tds, class Itag >
-void
-Constrained_triangulation_2<Gt,Tds,Itag>::
-remove_2D(Vertex_handle v)
-{
-  if (test_dim_down(v)) { this->_tds.remove_dim_down(v);}
-  else {
-    List_edges hole;
-    make_hole(v, hole);
-    List_edges shell=hole; //save hole because it will be emptied by fill_hole
-    fill_hole(v, hole);
-    update_constraints(shell);
-    delete_vertex(v);
-  }
-  return;       
-}
-
-
-template < class Gt, class Tds, class Itag >
-void
-Constrained_triangulation_2<Gt,Tds,Itag>::
-remove_constrained_edge(Face_handle f, int i)
-{
-  f->set_constraint(i, false);
-  if (dimension() == 2)
-    (f->neighbor(i))->set_constraint(this->mirror_index(f,i), false);
-  return;
-}
-
-template < class Gt, class Tds, class Itag >
-void
-Constrained_triangulation_2<Gt,Tds,Itag>::
-remove_incident_constraints(Vertex_handle v)
-{
-   Edge_circulator ec=incident_edges(v), done(ec);
-   if (ec == 0) return;
-   do {
-	if(is_constrained(*ec)) { remove_constrained_edge((*ec).first,
-						   (*ec).second);}
-	ec++;
-   } while (ec != done);
-   return;	
-}
-
-template < class Gt, class Tds, class Itag >
-inline  bool 
-Constrained_triangulation_2<Gt,Tds,Itag>::
-are_there_incident_constraints(Vertex_handle v) const
-{
-  return are_there_incident_constraints(v, Emptyset_iterator());
-}
-
-template < class Gt, class Tds, class Itag >
-inline  bool 
-Constrained_triangulation_2<Gt,Tds,Itag>::
-is_valid(bool verbose, int level) const
-{
-    bool result = Triangulation::is_valid(verbose,level);
-    for( All_faces_iterator it = all_faces_begin(); 
-	                    it != all_faces_end() ; it++) {
-      for(int i=0; i<3; i++) {
-	Face_handle n = it->neighbor(i);
-	result = result && 
-	  it->is_constrained(i) == n->is_constrained(n->index(it));
-      }
-    }
-    return result;
-}
-
-template < class Gt, class Tds, class Itag >
-inline  bool 
-Constrained_triangulation_2<Gt,Tds,Itag>::
-is_constrained(Edge e) const
-{
-  return (e.first)->is_constrained(e.second);
-}
-    
-template < class Gt, class Tds, class Itag >
-void
-Constrained_triangulation_2<Gt,Tds,Itag>::
-triangulate_half_hole(List_edges & list_edges,  List_edges & new_edges)
-  // triangulates the  polygon whose boundary consists of list_edges
-  // plus the edge ab joining the two endpoints of list_edges
-  // the orientation of the polygon (as provided by list_edges) must
-  // be cw
-  // the edges of list_edges are assumed to be edges of a
-  // triangulation that will be updated by the procedure
-  // the edges that are created are put in list new_edges
-  // takes linear time
-{
-  Vertex_handle va; // first vertex of list_edges 
-  Face_handle newlf;
-  Face_handle n1,n2,n;
-  int ind1, ind2,ind;
-  Orientation orient;
-    
-  typename List_edges::iterator current, next, tempo;
-  current=list_edges.begin();
-
-  va=((*current).first)->vertex(ccw((*current).second));
-  next=current; 
-  ++next;
-
-  do
-    {
-      n1=(*current).first;
-      ind1=(*current).second;
-      // in case n1 is no longer a triangle of the new triangulation
-      if ( n1->neighbor(ind1) != Face_handle() ) {
-	n=n1->neighbor(ind1);
-	//ind=this->mirror_index(n1,ind1); 
-	// mirror_index does not work in this case
-	ind = cw(n->index(n1->vertex(cw(ind1))));
-	n1=n->neighbor(ind); 
-	ind1= this->mirror_index(n,ind);
-      }
-      n2=(*next).first;
-      ind2=(*next).second;
-      // in case n2 is no longer a triangle of the new triangulation
-      if (n2->neighbor(ind2) != Face_handle() ) {
-	n=n2->neighbor(ind2); 
-	// ind=this->mirror_index(n2,ind2);
-	// mirror_index does not work in this case
-	ind = cw(n->index(n2->vertex(cw(ind2))));
-	n2=n->neighbor(ind); 
-	ind2= this->mirror_index(n,ind);
-      }
-
-      Vertex_handle v0=n1->vertex(ccw(ind1));
-      Vertex_handle v1=n1->vertex(cw(ind1));
-      Vertex_handle v2=n2->vertex(cw(ind2));
-      orient = this->orientation(v0->point(),v1->point(),v2->point());
-      switch (orient) {
-      case RIGHT_TURN : 	  		
-	// creates the new triangle v0v1v2
-	// updates the neighbors, the constraints 
-	//and the list of new edges
-	newlf = create_face(v0,v2,v1);
-	new_edges.push_back(Edge(newlf,2));
-	newlf->set_neighbor(1, n1);
-	newlf->set_neighbor(0, n2);
-	n1->set_neighbor(ind1, newlf);
-	n2->set_neighbor(ind2, newlf);
-	if (n1->is_constrained(ind1)) {
-	  newlf->set_constraint(1,true);
-	}
-	if (n2->is_constrained(ind2)) {
-	  newlf->set_constraint(0,true);
-	}
-	// v0, v1 or v2.face() may have been removed
-	v0->set_face(newlf); 
-	v1->set_face(newlf);
-	v2->set_face(newlf);
-	// update list_edges
-	tempo=current;
-	current=list_edges.insert(current, Edge(newlf,2));
-	list_edges.erase(tempo);
-	list_edges.erase(next);
-	next=current;
-	if (v0 != va) {--current;} 
-	else {++next;} 
-	break;
-      case LEFT_TURN : 	  
-	++current; ++next;
-	break;
-      case COLLINEAR : 
-	++current; ++next;
-	break;
-      }
-    } while (next != list_edges.end());
-}
-
-template < class Gt, class Tds, class Itag >
-void
-Constrained_triangulation_2<Gt, Tds, Itag>::
-file_output(std::ostream& os) const
-{
-  Triangulation_2<Gt, Tds>::file_output(os);
-
-  // write constrained status
-  typename Tds::Face_iterator ib = this->_tds.face_iterator_base_begin();
-  for( ; ib != this->_tds.face_iterator_base_end(); ++ib) {
-    for(int j = 0; j < 3; ++j){
-      if (ib->is_constrained(j)) { os << "C";}
-      else { os << "N";}
-      if(is_ascii(os)){
-	if(j==2) {
-	  os << "\n";
-	} else {
-	  os <<  ' ';
-	}
-      }
-    }
-  }
-}
-
-template < class Gt, class Tds, class Itag >
-std::ostream &
-operator<<(std::ostream& os, 
-	   const Constrained_triangulation_2<Gt,Tds,Itag> &ct)
-{
-  ct.file_output(os);
-  return os ;
-}
-
-template < class Gt, class Tds, class Itag >
-std::istream &
-operator>>(std::istream& is, 
-	         Constrained_triangulation_2<Gt,Tds,Itag> &ct)
-{
-  typedef Constrained_triangulation_2<Gt,Tds,Itag> CDT;
-  ct.clear();
-  is >> static_cast<typename CDT::Triangulation&>(ct);
-  for (typename CDT::All_faces_iterator fit=ct.all_faces_begin(),
-                                        fit_end=ct.all_faces_end();fit_end!=fit;++fit){
-    char c[3];
-    is >> c[0] >>  c[1] >> c[2];
-    for (int k=0;k<3;++k){
-      fit->set_constraint(k,c[k]=='C');
-    }
-  }  
-  return is;
-}
-
-//Helping functions to compute intersections of constrained edges
-template<class Gt>
-bool
-intersection(const Gt& ,
-	     const typename Gt::Point_2& , 
-	     const typename Gt::Point_2& , 
-	     const typename Gt::Point_2& , 
-	     const typename Gt::Point_2& ,
-	     typename Gt::Point_2& ,
-	     No_intersection_tag)
-{
-  return false;
-}
-	     
-template<class Gt>
-bool
-intersection(const Gt& gt,
-	     const typename Gt::Point_2& pa, 
-	     const typename Gt::Point_2& pb, 
-	     const typename Gt::Point_2& pc, 
-	     const typename Gt::Point_2& pd,
-	     typename Gt::Point_2& pi,
-	     Exact_intersections_tag)
-{
-  return compute_intersection(gt,pa,pb,pc,pd,pi);
-}
-
-
-template<class Gt>
-inline bool
-intersection(const Gt& gt,
-	     const typename Gt::Point_2& pa, 
-	     const typename Gt::Point_2& pb, 
-	     const typename Gt::Point_2& pc, 
-	     const typename Gt::Point_2& pd,
-	     typename Gt::Point_2& pi,
-	     Exact_predicates_tag)
-{
-  return compute_intersection(gt,pa,pb,pc,pd,pi);
-}
-
-
-template<class Gt>
-bool
-compute_intersection(const Gt& gt,
-	     const typename Gt::Point_2& pa, 
-	     const typename Gt::Point_2& pb, 
-	     const typename Gt::Point_2& pc, 
-	     const typename Gt::Point_2& pd,
-	     typename Gt::Point_2& pi)
-{
-  typename Gt::Intersect_2 compute_intersec=gt.intersect_2_object();
-   typename Gt::Construct_segment_2  
-    construct_segment=gt.construct_segment_2_object();
-  Object result = compute_intersec(construct_segment(pa,pb),
-				   construct_segment(pc,pd));
-  return assign(pi, result);
-}
-
-
-template<class Gt>
-int
-limit_intersection(const Gt& ,
-		   const typename Gt::Point_2& , 
-		   const typename Gt::Point_2& , 
-		   const typename Gt::Point_2& , 
-		   const typename Gt::Point_2& ,
-		   No_intersection_tag)
-{
-  return 0;
-}
-
-template<class Gt>
-int
-limit_intersection(const Gt& ,
-		   const typename Gt::Point_2& , 
-		   const typename Gt::Point_2& , 
-		   const typename Gt::Point_2& , 
-		   const typename Gt::Point_2& ,
-		   Exact_intersections_tag)
-{
-  return 0;
-}
-
-template<class Gt>
-int
-limit_intersection(const Gt& gt,
-	     const typename Gt::Point_2& pa, 
-	     const typename Gt::Point_2& pb, 
-	     const typename Gt::Point_2& pc, 
-	     const typename Gt::Point_2& pd,
-	     Exact_predicates_tag)
-{
-  typename Gt::Construct_line_2 line = gt.construct_line_2_object();
-  typename Gt::Compute_squared_distance_2 
-    distance = gt.compute_squared_distance_2_object();
-  typename Gt::Line_2 l1 = line(pa,pb);
-  typename Gt::Line_2 l2 = line(pc,pd);
-  int i = 0;
-  typename Gt::FT dx = distance(l2,pa);
-  typename Gt::FT db = distance(l2,pb);
-  typename Gt::FT dc = distance(l1,pc);
-  typename Gt::FT dd = distance(l1,pd);
-  if ( db < dx  ) { dx = db; i = 1;}
-  if ( dc < dx  ) { dx = dc; i = 2;}
-  if ( dd < dx  ) { i = 3;}
-  return i;
-}
-
-} //namespace CGAL
-
-#endif //CGAL_CONSTRAINED_TRIANGULATION_2_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Constrained_triangulation_plus_2.h b/3rdparty/CGAL-4.8/include/CGAL/Constrained_triangulation_plus_2.h
deleted file mode 100644
index 21db1b0..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Constrained_triangulation_plus_2.h
+++ /dev/null
@@ -1,1233 +0,0 @@
-// Copyright (c) 2012  INRIA Sophia-Antipolis (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
-// 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(s)     : Andreas Fabri, Mariette Yvinec
-
-#ifndef CGAL_CONSTRAINED_TRIANGULATION_PLUS_2_H
-#define CGAL_CONSTRAINED_TRIANGULATION_PLUS_2_H
-
-#include <CGAL/triangulation_assertions.h>
-#include <CGAL/Polygon_2.h>
-#include <CGAL/Polyline_constraint_hierarchy_2.h>
-#include <boost/tuple/tuple.hpp>
-
-#include <CGAL/Default.h>
-#include <CGAL/Constrained_Delaunay_triangulation_2.h>
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-#include <CGAL/Triangulation_2/insert_constraints.h>
-
-#if defined(BOOST_MSVC) && (BOOST_VERSION == 105500)
-#include <set>
-#else
-#include <boost/container/flat_set.hpp>
-#endif
-
-#if defined(BOOST_MSVC)
-#  pragma warning(push)
-#  pragma warning(disable:4355)
-//warning C4355: 'this' : used in base member initializer list
-#endif
-
-namespace CGAL {
-
-// Comparison functor that compares two Vertex_handle.
-// Used as 'Compare' functor for the constraint hierarchy.
-template < class Tr >
-class Pct2_vertex_handle_less_xy {
-  const Tr* tr_p;
-
-public:
-  Pct2_vertex_handle_less_xy(const Tr* tr_p) : tr_p(tr_p) {}
-
-  typedef typename Tr::Vertex_handle Vertex_handle;
-
-  bool operator()(const Vertex_handle& va,
-                  const Vertex_handle& vb) const
-  {
-    return tr_p->compare_xy(va->point(), vb->point()) == SMALLER;
-  }
-}; // end class template Pct2_vertex_handle_less_xy
-
-// Tr the base triangulation class 
-// Tr has to be Constrained or Constrained_Delaunay with Constrained_triangulation_plus_vertex_base
-
-template < class Tr_ = Default >
-class Constrained_triangulation_plus_2  
-  : public  
-Default::Get< Tr_, Constrained_Delaunay_triangulation_2< 
-                      Exact_predicates_inexact_constructions_kernel
-                      , Triangulation_data_structure_2< 
-                            Triangulation_vertex_base_2<Exact_predicates_inexact_constructions_kernel>
-                          , Constrained_triangulation_face_base_2<Exact_predicates_inexact_constructions_kernel>
-                          >
-                      , CGAL::Exact_predicates_tag
-                      > >::type
-{
-  typedef typename 
-  Default::Get< Tr_, Constrained_Delaunay_triangulation_2< 
-                  Exact_predicates_inexact_constructions_kernel
-                  , Triangulation_data_structure_2< 
-                        Triangulation_vertex_base_2<Exact_predicates_inexact_constructions_kernel>
-                      , Constrained_triangulation_face_base_2<Exact_predicates_inexact_constructions_kernel>
-                      >
-                  , CGAL::Exact_predicates_tag
-                  > >::type Tr;
-
-
-  template<class CDT>
-  class Face_container
-  {
-    typedef typename CDT::Vertex_handle Vertex_handle;
-    typedef typename CDT::Face_handle Face_handle;
-  private:
-    typedef boost::tuple<Vertex_handle, Vertex_handle, Vertex_handle> TFace; 
-    std::vector<TFace> faces;
-    CDT& cdt;
-
-  public:
-    typedef Face_handle value_type;
-    typedef Face_handle& reference;
-    typedef const Face_handle& const_reference;
-
-    Face_container(CDT& cdt_ ) : cdt(cdt_) {}
-
-    void push_back(Face_handle fh)
-    {
-      faces.push_back(boost::make_tuple(fh->vertex(0),
-                                        fh->vertex(1),
-                                        fh->vertex(2)));
-    }
-
-    template <class OutputIterator>
-    void
-    write_faces(OutputIterator out)
-    {
-      for(typename std::vector<TFace>::reverse_iterator 
-            it = faces.rbegin(); it != faces.rend(); ++it) { 
-        Face_handle fh;
-        if(cdt.is_face(boost::get<0>(*it), boost::get<1>(*it), boost::get<2>(*it), fh)){
-          *out++ = fh;
-        }
-      }
-    }
-  };
-
-public:
-  typedef Tr                                   Triangulation;
-  typedef typename Tr::Intersection_tag        Intersection_tag;
-  typedef Constrained_triangulation_plus_2<Tr_> Self;
-  typedef Tr                                   Base;
-
-  typedef typename Triangulation::Edge             Edge;
-  typedef typename Triangulation::Vertex           Vertex;
-  typedef typename Triangulation::Vertex_handle    Vertex_handle;
-  typedef typename Triangulation::Face_handle      Face_handle;
-  typedef typename Triangulation::Face_circulator  Face_circulator ;
-  typedef typename Triangulation::Vertex_iterator  Vertex_iterator;
-  typedef typename Triangulation::Vertex_circulator  Vertex_circulator;
-  typedef typename Triangulation::Locate_type      Locate_type;
-  typedef typename Triangulation::Line_face_circulator Line_face_circulator;
-  typedef typename Triangulation::Geom_traits      Geom_traits;
-  typedef typename Geom_traits::Point_2            Point;
-  typedef typename Geom_traits::Segment_2          Segment;
-  typedef typename Triangulation::Constraint       Constraint;
-  typedef typename Triangulation::size_type        size_type;
-
-  typedef typename Triangulation::List_edges       List_edges;
-  typedef typename Triangulation::List_faces       List_faces;
-  typedef typename Triangulation::List_vertices    List_vertices;
-  typedef typename Triangulation::List_constraints List_constraints;
-
-  typedef Pct2_vertex_handle_less_xy<Self>         Vh_less_xy;
-  typedef Polyline_constraint_hierarchy_2<Vertex_handle, Vh_less_xy, Point>
-                                                   Constraint_hierarchy;
-public:
-  typedef Tag_true                                Constraint_hierarchy_tag;
-
-  // for user interface with the constraint hierarchy
-
-  typedef typename Constraint_hierarchy::Vertex_it 
-                                            Vertices_in_constraint_iterator;
-  
-  typedef typename Constraint_hierarchy::Point_it
-                                            Points_in_constraint_iterator;
-
-  typedef typename Constraint_hierarchy::Context      Context;
-  typedef typename Constraint_hierarchy::Context_iterator  Context_iterator;
-  typedef typename Constraint_hierarchy::C_iterator   Constraint_iterator;
-  typedef typename Constraint_hierarchy::Subconstraint_iterator  Subconstraint_iterator;
-  typedef typename Constraint_hierarchy::Constraint_id Constraint_id;   
-                                            
-  typedef std::pair<Vertex_handle, Vertex_handle> Subconstraint;
-  
-  //for backward compatibility
-  typedef Vertices_in_constraint_iterator     Vertices_in_constraint;
-
-  using Triangulation::geom_traits;
-  using Triangulation::cw;
-  using Triangulation::ccw;
-  using Triangulation::incident_faces;
-
-protected:
-  Constraint_hierarchy hierarchy;
- 
-public:
-  Constraint_hierarchy& hierarchy_ref()
-  {
-    return hierarchy;
-  }
-
-  Constrained_triangulation_plus_2(const Geom_traits& gt=Geom_traits()) 
-    : Triangulation(gt)
-    , hierarchy(Vh_less_xy(this))
-  { }
-
-  Constrained_triangulation_plus_2(const Constrained_triangulation_plus_2& ctp)
-    : Triangulation()
-    , hierarchy(Vh_less_xy(this))
-  { copy_triangulation(ctp);}
-
-  virtual ~Constrained_triangulation_plus_2() {}
-
-  Constrained_triangulation_plus_2 & operator=(const Constrained_triangulation_plus_2& ctp)
-  {
-    copy_triangulation(ctp);
-    return *this;
-  }
-
-  template<class InputIterator>
-  Constrained_triangulation_plus_2(InputIterator first,
-				   InputIterator last,
-				   const Geom_traits& gt=Geom_traits() )
-     : Triangulation(gt)
-     , hierarchy(Vh_less_xy(this))
-  {
-    insert_constraints(first, last);
-    CGAL_triangulation_postcondition( this->is_valid() );
-  }
-
-
-  Constrained_triangulation_plus_2(std::list<std::pair<Point,Point> > constraints,
-				   const Geom_traits& gt=Geom_traits() )
-    : Triangulation(gt)
-     , hierarchy(Vh_less_xy(this))
-  {
-    insert_constraints(constraints.begin(), constraints.end());
-    CGAL_triangulation_postcondition( this->is_valid() );
-  }
-  //Helping
-  void clear() { Base::clear(); hierarchy.clear(); }
-  void copy_triangulation(const Constrained_triangulation_plus_2 &ctp);
-  void swap(Constrained_triangulation_plus_2 &ctp);
-
-  // INSERTION
-  Vertex_handle insert(const Point& a, 
-		       Face_handle start = Face_handle() );
-  Vertex_handle insert(const Point& p,
-		       Locate_type lt,
-		       Face_handle loc, int li );
-  
-  Constraint_id insert_constraint(const Point& a, const Point& b)
-  {
-    Vertex_handle va= insert(a);
-    // If the segment is "short" it is a good idea to start the next insertion
-    // close to point a
-    // Otherwise, to start here is as good as elsewhere
-    Vertex_handle vb = insert(b, va->face());
-    return insert_constraint(va, vb); 
-  }
-
-  Constraint_id insert_constraint(const Constraint& c) 
-  {
-    return insert_constraint(c.first, c.second);
-  }
-  
-  Constraint_id insert_constraint(Vertex_handle va, Vertex_handle vb)
-  {
-    // protects against inserting a zero length constraint
-    if(va == vb){
-    return Constraint_id(NULL);
-    }
-    // protects against inserting twice the same constraint
-    Constraint_id cid = hierarchy.insert_constraint(va, vb);
-    if (va != vb && (cid != Constraint_id(NULL)) )  insert_subconstraint(va,vb); 
-
-    return cid;
-  }
-
-  template < class InputIterator>
-  Constraint_id insert_constraint(InputIterator first, InputIterator last, bool close=false)
-  {
-    return insert_constraint_seq_impl(first, last, close);
-  }
-
-  template<typename Range>
-  Constraint_id insert_constraint(const Range& r)
-  {
-    return insert_constraint_seq_impl(r.begin(), r.end(), false);
-  }
-
-  template < class PolygonTraits_2, class Container>
-  Constraint_id insert_constraint(const Polygon_2<PolygonTraits_2,Container>& polygon)
-  {
-    return insert_constraint_seq_impl(polygon.vertices_begin(), polygon.vertices_end(), true);
-  }
-  /*
-  template<typename InputIterator>
-  size_type insert_constraints(InputIterator first, InputIterator last)
-  {
-    size_type n = 0;
-
-    for(; first != last; ++first)
-    {
-      if(insert_constraint(*first))
-        ++n;
-    }
-    return n;
-  }
-  */
-  Vertex_handle push_back(const Point& p)
-  {
-    return insert(p);
-  }
-
-  Constraint_id push_back(const Constraint& c)
-  {
-    return insert_constraint(c.first, c.second);
-  }
-
-  // for backward compatibility
-  // not const Point&, because otherwise VC6/7 messes it up with 
-  // the insert that takes an iterator range
-  Constraint_id insert(Point a, Point b) { return insert_constraint(a, b); }
-  Constraint_id insert(Vertex_handle va, Vertex_handle  vb) { return insert_constraint(va,vb); }
-
-
-
-  template <class PointIterator, class IndicesIterator>
-  std::size_t insert_constraints(PointIterator points_first,
-                                 PointIterator points_beyond,
-                                 IndicesIterator indices_first,
-                                 IndicesIterator indices_beyond)
-  {
-    std::vector<Point> points(points_first, points_beyond);
-    return internal::insert_constraints(*this,points, indices_first, indices_beyond);
-  }
-
-
- template <class ConstraintIterator>
-  std::size_t insert_constraints(ConstraintIterator first,
-                                 ConstraintIterator beyond)
-  {
-    return internal::insert_constraints(*this,first,beyond);
-  }
-
-
-  Vertices_in_constraint_iterator
-  insert_vertex_in_constraint(Constraint_id cid, Vertices_in_constraint_iterator pos, 
-			      Vertex_handle vh)
-  {
-    return insert_vertex_in_constraint(cid, pos, vh, Emptyset_iterator());
-  }
-
-  Vertices_in_constraint_iterator
-  remove_vertex_from_constraint(Constraint_id cid, Vertices_in_constraint_iterator pos)
-  {
-    return remove_vertex_from_constraint(cid, pos, Emptyset_iterator());
-  }
-
-
-  template <class OutputIterator>
-  Vertices_in_constraint_iterator
-  remove_vertex_from_constraint(Constraint_id cid, Vertices_in_constraint_iterator pos, 
-				OutputIterator out)
-  {
-    if(pos == vertices_in_constraint_begin(cid)){
-      ++pos;
-      Constraint_id aux = hierarchy.split2(cid,pos);
-      remove_constraint(aux, out);
-      return pos;
-    }
-
-    Vertices_in_constraint_iterator it = vertices_in_constraint_end(cid);
-    it--;
-    if(pos == it){
-      --pos;
-      Constraint_id aux = hierarchy.split(cid, pos);
-      remove_constraint(aux, out);
-      return vertices_in_constraint_end(cid);
-    }
-
-    Vertices_in_constraint_iterator pp = pos;
-    --pp;
-    Vertex_handle a = *pp;
-    pp = pos;
-    ++pp;
-    Vertex_handle b = *pp;
-    --it;
-    Vertices_in_constraint_iterator beg = vertices_in_constraint_begin(cid);
-    ++beg;
-    Face_container<Constrained_triangulation_plus_2> fc(*this);
-
-    Constraint_id head = 0, tail = 0;
-    if(pos != beg){
-      // split off head
-      --pos;
-      head = hierarchy.split2(cid, pos);
-      ++pos;
-    }
-    if(pos != it){
-      // split off tail
-      ++pos;
-      tail = hierarchy.split(cid,pos);
-    }
-  
-    Constraint_id aux = insert_constraint(a, b, std::back_inserter(fc));
-    pos = vertices_in_constraint_end(aux);
-    --pos;
-    --pos; // this is not necessarily == vertices_in_constraint_begin(aux);
-    hierarchy.swap(cid, aux);
-    remove_constraint(aux, std::back_inserter(fc));
-
-    if(head.vl_ptr()){
-      hierarchy.concatenate2(head, cid);
-    }
-
-    if(tail.vl_ptr()){
-      hierarchy.concatenate(cid, tail);
-    }
-    fc.write_faces(out);
-    ++pos; // we went one too far back because the last vertex gets removed by concatenate
-    return pos;
-  }
-
-  // Inserts vh before pos
-  // Returns an iterator pointing on the newly inserted vertex
-  // Writes the modified faces to out
-  template <class OutputIterator>
-  Vertices_in_constraint_iterator
-  insert_vertex_in_constraint(Constraint_id cid, Vertices_in_constraint_iterator pos, 
-			      Vertex_handle vh, OutputIterator out)
-  {
-    // Insertion before the first vertex
-    if(pos == vertices_in_constraint_begin(cid)){
-      //std::cout << "insertion before first vertex" << std::endl;
-      Constraint_id head = insert_constraint(vh, *pos, out);
-      hierarchy.concatenate2(head, cid);
-      return vertices_in_constraint_begin(cid);
-    } 
-
-    // Insertion after the last vertex
-    if(pos == vertices_in_constraint_end(cid)){
-      //std::cout << "insertion after last vertex" << std::endl;
-      pos--;
-      Constraint_id tail = insert_constraint(*pos, vh, out);
-      pos = vertices_in_constraint_end(tail);
-      --pos;
-      hierarchy.concatenate(cid, tail);
-      return pos;
-    }
-    Vertex_handle b = *pos;
-    --pos;    
-    Vertex_handle a = *pos;
-    ++pos;
-    Face_container<Constrained_triangulation_plus_2> fc(*this);
-    Vertices_in_constraint_iterator beg = vertices_in_constraint_begin(cid), vcit;
-    ++beg;
-    vcit = beg;
-    ++beg;
-    // If the constraint consists only of a segment, and we want to insert
-    // in the middle 
-    if((pos == vcit) && (beg == vertices_in_constraint_end(cid))){
-      //std::cout << "insertion in constraint which is a segment" << std::endl;
-      Constraint_id aux1 = insert_constraint(a, vh, std::back_inserter(fc));
-      Constraint_id aux2 = insert_constraint(vh, b, std::back_inserter(fc));
-      pos = vertices_in_constraint_begin(aux2);
-      concatenate(aux1, aux2);
-      hierarchy.swap(cid, aux1);
-      remove_constraint(aux1, std::back_inserter(fc));
-      fc.write_faces(out);
-      return pos;
-      
-    }
-    Constraint_id head = 0, tail = 0;
-    Vertices_in_constraint_iterator bit = vertices_in_constraint_begin(cid);
-    Vertices_in_constraint_iterator pred = pos;
-    --pred;
-    ++bit;
-    if(pos != bit){
-      //std::cout << "split head" << std::endl;
-      head = split(cid, pred);
-      std::swap(head,cid); // split2 does the job
-      pred = vertices_in_constraint_begin(cid);
-      pos = pred;
-      ++pos;
-    }
-    Vertices_in_constraint_iterator eit = vertices_in_constraint_end(cid);
-    --eit;
-    if(pos != eit){
-      //std::cout << "split tail" << std::endl;
-      tail = split(cid, pos);    
-    }
-    
-    // make the new constraint
-    Constraint_id aux1 = insert_constraint(a, vh, std::back_inserter(fc));
-    Constraint_id aux2 = insert_constraint(vh, b, std::back_inserter(fc));
-    pos = vertices_in_constraint_begin(aux2);
-    concatenate(aux1, aux2);
-
-    if(head.vl_ptr()){
-      //std::cout << "concatenate head" << std::endl;
-      remove_constraint(cid, std::back_inserter(fc));
-      hierarchy.concatenate(head, aux1);
-    } else {
-      hierarchy.swap(cid, aux1);
-      remove_constraint(aux1, std::back_inserter(fc));
-      head = cid;
-    }
-
-    if(tail.vl_ptr()){
-      //std::cout << "concatenate tail" << std::endl;
-      concatenate(head, tail);
-    }
-    fc.write_faces(out);
-    return pos;
-  }
-
-  template < class InputIterator, class OutputIterator>
-  Constraint_id insert_constraint(InputIterator first, InputIterator last, OutputIterator out)
-  {
-    Face_handle hint;
-    Face_container<Constrained_triangulation_plus_2> fc(*this);
-    std::vector<Vertex_handle> vertices;
-    for(;first!= last; first++){
-      Vertex_handle vh = insert(*first, hint);
-      hint = vh->face();
-      // no duplicates
-      if(vertices.empty() || (vertices.back() != vh)){
-	vertices.push_back(vh);
-      }
-    }
-    int n = vertices.size();
-    if(n == 1){
-      return NULL;
-    }
-    Constraint_id ca = hierarchy.insert_constraint(vertices[0],vertices[1]);
-    insert_subconstraint(vertices[0],vertices[1], std::back_inserter(fc)); 
-
-    if(n>2){
-      for(int j=1; j<n-1; j++){
-	hierarchy.append_constraint(ca, vertices[j], vertices[j+1]);
-	insert_subconstraint(vertices[j], vertices[j+1], std::back_inserter(fc));
-      }
-    }
-    for(Vertices_in_constraint_iterator vcit = vertices_in_constraint_begin(ca);
-	vcit != vertices_in_constraint_end(ca);
-	vcit++){
-      insert_incident_faces(vcit, out);
-    }
-    //AF    vertices_in_constraint_begin(ca)->fixed() = true;
-    // Vertices_in_constraint_iterator end = boost::prior(vertices_in_constraint_end(ca));
-    // end->fixed() = true;
-    fc.write_faces(out);
-    
-    return ca;
-  }
-
-
-private:
-  template < class InputIterator>
-  Constraint_id insert_constraint_seq_impl(InputIterator first, InputIterator last, bool is_polygon)
-  {
-    Face_handle hint;
-    std::vector<Vertex_handle> vertices;
-    for(;first!= last; first++){
-      Vertex_handle vh = insert(*first, hint);
-      hint = vh->face();
-      // no duplicates
-      if(vertices.empty() || (vertices.back() != vh)){
-	vertices.push_back(vh);
-      }
-    }
-    if(is_polygon && (vertices.size()>1) && (vertices.front() != vertices.back())){
-      vertices.push_back(vertices.front());
-    }
-
-    std::size_t n = vertices.size();
-    if(n == 1){
-      return NULL;
-    }
-    CGAL_assertion(n >= 2);
-    
-    Constraint_id ca = hierarchy.insert_constraint(vertices[0],vertices[1]);
-    insert_subconstraint(vertices[0],vertices[1]); 
-
-    if(n>2){
-      for(std::size_t j=1; j<n-1; j++){
-	hierarchy.append_constraint(ca, vertices[j], vertices[j+1]);
-	insert_subconstraint(vertices[j], vertices[j+1]);
-      }
-    }
- 
-    // fix first and last, one is redundant for is_polygon == true
-    // vertices.front()->fixed() = true;
-    // vertices.back()->fixed() = true;
-
-    return ca;
-  }
-public:
-  template <class OutputIterator>
-  typename Constrained_triangulation_plus_2<Tr>::Constraint_id
-  insert_constraint(Vertex_handle va, Vertex_handle vb, OutputIterator out)
-  {
-    // protects against inserting a zero length constraint
-    if(va == vb){
-    return Constraint_id(NULL);
-    }
-    // protects against inserting twice the same constraint
-    Constraint_id cid = hierarchy.insert_constraint(va, vb);
-    if (va != vb && (cid != NULL) )  insert_subconstraint(va,vb,out); 
-  
-    for(Vertices_in_constraint_iterator vcit = vertices_in_constraint_begin(cid);
-	vcit != vertices_in_constraint_end(cid);
-	vcit++){
-      insert_incident_faces(vcit, out);
-    }
-    return cid;
-  }
-
-  virtual Vertex_handle intersect(Face_handle f, int i, 
-			  Vertex_handle vaa,
-			  Vertex_handle vbb);
-  Vertex_handle intersect(Face_handle f, int i, 
-			  Vertex_handle vaa,
-			  Vertex_handle vbb,
-			  No_intersection_tag);
-  Vertex_handle intersect(Face_handle f, int i, 
-			  Vertex_handle vaa,
-			  Vertex_handle vbb,
-			  Exact_intersections_tag);
-  Vertex_handle intersect(Face_handle f, int i, 
-			  Vertex_handle vaa,
-			  Vertex_handle vbb,
-			  Exact_predicates_tag);
- 
-  // REMOVAL
-
-  template <class OutputIterator>
-  void remove_constraint(Constraint_id cid, OutputIterator out)
-  {
-    std::list<Vertex_handle> vertices(hierarchy.vertices_in_constraint_begin(cid),
-				      hierarchy.vertices_in_constraint_end(cid));
-
-    hierarchy.remove_constraint(cid);
-    for(typename std::list<Vertex_handle>::iterator it = vertices.begin(), 
-	  succ = it; 
-	++succ != vertices.end(); 
-	++it){
-      if(! is_subconstraint(*it, *succ)){ // this checks whether other constraints pass
-	Face_handle fh;
-	int i;
-        CGAL_triangulation_assertion_code(bool b =)
-          Triangulation::is_edge(*it, *succ, fh, i);
-	CGAL_triangulation_assertion(b);
-	Triangulation::remove_constrained_edge(fh,i, out); // this does also flipping if necessary.
-      }
-    }
-  }
-  void remove_constraint(Constraint_id cid)
-  {
-    remove_constraint(cid, Emptyset_iterator());
-  }
-
-  void remove_constraint(Vertex_handle va, Vertex_handle vb)
-  {
-    hierarchy.remove_constraint(va,vb);
-  }
-
-  void simplify(Vertices_in_constraint_iterator v)
-  {
-    Vertices_in_constraint_iterator u = boost::prior(v);
-    Vertices_in_constraint_iterator w = boost::next(v);
-    hierarchy.simplify(u,v,w);
-    
-    Triangulation::remove_incident_constraints(*v);
-  
-    Triangulation::remove(*v);
-  
-    Triangulation::insert_constraint(*u, *w);
-  }
-
-  std::size_t remove_points_without_corresponding_vertex(Constraint_id cid)
-  {
-    return hierarchy.remove_points_without_corresponding_vertex(cid);
-  }
-  std::size_t remove_points_without_corresponding_vertex()
-  {
-    return hierarchy.remove_points_without_corresponding_vertex();
-  }
-
-
-  // CONCATENATE AND SPLIT
-
-  // concatenates two constraints
-  Constraint_id
-  concatenate(Constraint_id first, Constraint_id second);
-
-  // split a constraint in two constraints, so that vcit becomes the first
-  // vertex of the new constraint
-  // returns the new constraint 
-  Constraint_id
-  split(Constraint_id first, Vertices_in_constraint_iterator vcit);
-  
-  // Query of the constraint hierarchy
-  Constraint_iterator constraints_begin() const;
-  Constraint_iterator constraints_end()   const;
-  Subconstraint_iterator subconstraints_begin() const;
-  Subconstraint_iterator subconstraints_end() const;
-  Context   context(Vertex_handle va, Vertex_handle vb); //AF: const; 
-
-  bool is_subconstraint(Vertex_handle va, 
-			Vertex_handle vb);
-  size_type number_of_enclosing_constraints(Vertex_handle va, 
-                                            Vertex_handle vb) const;
-  Context_iterator   contexts_begin(Vertex_handle va, 
-				    Vertex_handle vb) const;
-  Context_iterator   contexts_end(Vertex_handle va, 
-				  Vertex_handle vb) const;
-
-  Vertices_in_constraint_iterator vertices_in_constraint_begin(Constraint_id cid) const;
-  Vertices_in_constraint_iterator vertices_in_constraint_end(Constraint_id cid) const ;  
-  Vertices_in_constraint_iterator vertices_in_constraint_begin(Vertex_handle va, Vertex_handle vb) const;
-  Vertices_in_constraint_iterator vertices_in_constraint_end(Vertex_handle va, Vertex_handle vb) const ;
-  Points_in_constraint_iterator points_in_constraint_begin(Constraint_id cid) const;
-  Points_in_constraint_iterator points_in_constraint_end(Constraint_id cid) const ;
-
-
-  size_type number_of_constraints() {
-    return static_cast<size_type> (hierarchy.number_of_constraints());}
-  size_type number_of_subconstraints(){
-    return static_cast<size_type> (hierarchy.number_of_subconstraints());}
-
-  // public member, used by Mesh_2::Refine_edges
-  void split_constraint(Vertex_handle v1, Vertex_handle v2,
-                        Vertex_handle va) {
-    hierarchy.split_constraint(v1,v2,va);
-  }
-
-protected:
-  template <class OutputItertator>
-  void insert_incident_faces(Vertices_in_constraint_iterator vcit, OutputItertator out)
-  {
-    Vertex_handle vh = *vcit;
-    Face_circulator fc = incident_faces(vh), done = fc;
-    Face_circulator null ;
-    if ( fc != null )
-    {
-      do {
-        Face_handle fh = fc;
-        out = fh;
-        out++;
-        fc++;
-      }while(fc != done);
-    }
-  }  
-
-
-void
-insert_subconstraint(Vertex_handle vaa,
-		     Vertex_handle vbb)
-  {
-    insert_subconstraint(vaa,vbb,Emptyset_iterator());
-  }
-
-
-
-
-template <class OutputItertator>
-void
-insert_subconstraint(Vertex_handle vaa,
-		     Vertex_handle vbb,
-		     OutputItertator out)
-  // insert the subconstraint [vaa vbb] 
-  // it will eventually be splitted into several subconstraints
-{
-  CGAL_triangulation_precondition( vaa != vbb);
-  Vertex_handle vi;
-
-  Face_handle fr;
-  int i;
-  if(this->includes_edge(vaa,vbb,vi,fr,i)) {
-    this->mark_constraint(fr,i);
-    if (vi != vbb)  {
-      hierarchy.split_constraint(vaa,vbb,vi);
-      insert_subconstraint(vi,vbb, out);
-    }
-    return;
-  }
-      
-  List_faces intersected_faces;
-  List_edges conflict_boundary_ab, conflict_boundary_ba;
-     
-  bool intersection  = this->find_intersected_faces( 
-    vaa, vbb,
-    intersected_faces,
-    conflict_boundary_ab,
-    conflict_boundary_ba,
-    vi);
-
-  if ( intersection) {
-    if (vi != vaa && vi != vbb) {
-      hierarchy.split_constraint(vaa,vbb,vi);
-      insert_subconstraint(vaa,vi, out); 
-      insert_subconstraint(vi,vbb, out); 
-     }
-    else insert_subconstraint(vaa,vbb,out);  
-
-    
-    return;
-  }
-
-
-  //no intersection
-
-  List_edges edges(conflict_boundary_ab);
-  std::copy(conflict_boundary_ba.begin(), conflict_boundary_ba.end(), std::back_inserter(edges));
-
-  // edges may contain mirror edges. They no longer exist after triangulate_hole
-  // so we have to remove them before calling get_bounded_faces
-  if(! edges.empty()){
-
-#if defined(BOOST_MSVC) && (BOOST_VERSION == 105500)
-    std::set<Face_handle> faces(intersected_faces.begin(), intersected_faces.end());
-#else
-    boost::container::flat_set<Face_handle> faces(intersected_faces.begin(), intersected_faces.end());
-#endif
-    typename List_edges::iterator it2;
-    for(typename List_edges::iterator it = edges.begin(); it!= edges.end();){
-      if(faces.find(it->first) != faces.end()){
-        typename List_edges::iterator it2 = it;
-        ++it;
-        edges.erase(it2);
-      }else {
-        ++it;
-      }
-    }
-  }
-
-  this->triangulate_hole(intersected_faces,
-                         conflict_boundary_ab,
-                         conflict_boundary_ba);
-
-  this->get_bounded_faces(edges.begin(),
-                          edges.end(),
-                          out);
-
-  if (vi != vbb) {
-    hierarchy.split_constraint(vaa,vbb,vi);
-    insert_subconstraint(vi,vbb, out); 
-  }
-  return;
-}
-
-
-
-  //to debug
-public:
-  void print_hierarchy() { hierarchy.print(); }
-
-  //template member functions
-public:
-  template < class InputIterator >
-#if defined(_MSC_VER)
-  std::ptrdiff_t insert(InputIterator first, InputIterator last, int i = 0)
-#else
-    std::ptrdiff_t insert(InputIterator first, InputIterator last) 
-#endif
-  {
-    size_type n = this->number_of_vertices();
-
-    std::vector<Point> points (first, last);
-
-    spatial_sort (points.begin(), points.end(), geom_traits());
-
-    Face_handle hint;
-    for (typename std::vector<Point>::const_iterator p = points.begin(), end = points.end();
-            p != end; ++p)
-        hint = insert (*p, hint)->face();
-
-    return this->number_of_vertices() - n;
-  }
-
-};
-
-template <class Tr>
-void
-Constrained_triangulation_plus_2<Tr>::
-copy_triangulation(const Constrained_triangulation_plus_2 &ctp)
-{
-  Base::copy_triangulation(ctp);
-  //the following assumes that the triangulation and its copy
-  // iterate on their vertices in the same order 
-  std::map<Vertex_handle,Vertex_handle> vmap;
-  Vertex_iterator vit = ctp.vertices_begin();
-  Vertex_iterator vvit = this->vertices_begin();
-  for( ; vit != ctp.vertices_end(); ++vit, ++vvit) {
-    CGAL_triangulation_assertion(vit->point() == vvit->point());
-    vmap[vit] = vvit;
-  }
-  hierarchy.copy(ctp.hierarchy, vmap);
-}
-
-template <class Tr>
-void
-Constrained_triangulation_plus_2<Tr>::
-swap(Constrained_triangulation_plus_2 &ctp)
-{
-  Base::swap(ctp);
-  hierarchy.swap(ctp.hierarchy);
-}
-
-template < class Tr >
-inline 
-typename Constrained_triangulation_plus_2<Tr>::Vertex_handle
-Constrained_triangulation_plus_2<Tr>::
-insert(const Point& a, Face_handle start)
-{
-  Locate_type lt;
-  int li;
-  Face_handle loc = this->locate(a, lt, li, start);
-  return insert(a,lt,loc,li);
-}
-
-template < class Tr>
-typename Constrained_triangulation_plus_2<Tr>::Vertex_handle
-Constrained_triangulation_plus_2<Tr>::
-insert(const Point& a, Locate_type lt, Face_handle loc, int li)
-{
-  Vertex_handle v1, v2;
-  bool insert_in_constrained_edge = false;
-
-  if ( lt == Triangulation::EDGE && loc->is_constrained(li) ){
-    insert_in_constrained_edge = true;
-    v1=loc->vertex(ccw(li)); //endpoint of the constraint
-    v2=loc->vertex(cw(li)); // endpoint of the constraint
-  }
-  Vertex_handle va = Triangulation::insert(a,lt,loc,li);
-  // update the hierarchy
-  if (insert_in_constrained_edge) {
-    hierarchy.split_constraint(v1,v2,va);
-  }
-  return va;
-}
-
-template <class Tr>
-typename Constrained_triangulation_plus_2<Tr>:: Vertex_handle 
-Constrained_triangulation_plus_2<Tr>::
-intersect(Face_handle f, int i, 
-	  Vertex_handle vaa,
-	  Vertex_handle vbb) 
-{
-  return intersect(f, i, vaa, vbb, Intersection_tag());
-}
-
-template <class Tr>
-typename Constrained_triangulation_plus_2<Tr>:: Vertex_handle 
-Constrained_triangulation_plus_2<Tr>::
-
-intersect(Face_handle , int , 
-	  Vertex_handle ,
-	  Vertex_handle ,
-	  No_intersection_tag)
-{
-  std::cerr << " sorry, this triangulation does not deal with" 
-	    <<    std::endl
-	    << " intersecting constraints" << std::endl;
-  CGAL_triangulation_assertion(false);
-  return Vertex_handle();
-}
-
-template <class Tr>
-typename Constrained_triangulation_plus_2<Tr>:: Vertex_handle 
-Constrained_triangulation_plus_2<Tr>::
-intersect(Face_handle f, int i, 
-	  Vertex_handle vaa,
-	  Vertex_handle vbb,
-	  Exact_intersections_tag)
-// compute the intersection of the constraint edge (f,i) 
-// with the subconstraint (vaa,vbb) being inserted
-// insert the intersection point
-// (the  constraint edge (f,i) will be split in hierarchy by insert)
-// and return the Vertex_handle of the new Vertex
-{
-  Vertex_handle  vc, vd, va, vb;
-  Vertex_handle  vcc, vdd;
-  vcc = f->vertex(cw(i));
-  vdd = f->vertex(ccw(i));
-  CGAL_triangulation_assertion_code( bool b1 = )
-  hierarchy.enclosing_constraint(vcc,vdd,vc,vd);
-  CGAL_triangulation_assertion_code( bool b2 = )
-  hierarchy.enclosing_constraint(vaa,vbb,va,vb);
-  CGAL_triangulation_assertion(b1);
-  CGAL_triangulation_assertion(b2);
-
-  const Point& pa = va->point();
-  const Point& pb = vb->point();
-  const Point& pc = vc->point();
-  const Point& pd = vd->point();
-  Point pi;
-  Intersection_tag itag = Intersection_tag();
-  CGAL_triangulation_assertion_code( bool ok = )
-  intersection(geom_traits(), pa, pb, pc, pd, pi, itag );
-  CGAL_triangulation_assertion(ok);
-
-  Vertex_handle vi = insert(pi, Triangulation::EDGE, f, i);
-  return vi; 
-}
-
-template <class Tr>
-typename Constrained_triangulation_plus_2<Tr>::Vertex_handle 
-Constrained_triangulation_plus_2<Tr>::
-intersect(Face_handle f, int i, 
-	  Vertex_handle vaa,
-	  Vertex_handle vbb,
-	  Exact_predicates_tag)
-{
-  Vertex_handle  vcc, vdd;
-  vcc = f->vertex(cw(i));
-  vdd = f->vertex(ccw(i));
-
-  const Point& pa = vaa->point();
-  const Point& pb = vbb->point();
-  const Point& pc = vcc->point();
-  const Point& pd = vdd->point();
-
-  Point pi; //creator for point is required here
-  Intersection_tag itag = Intersection_tag();
-  bool ok  = intersection(geom_traits(), pa, pb, pc, pd, pi, itag );
-
-  Vertex_handle vi;
-  if ( !ok) {  //intersection detected but not computed
-    int i = limit_intersection(geom_traits(), pa, pb, pc, pd, itag);
-    switch(i){
-    case 0 : vi = vaa; break;
-    case 1 : vi = vbb; break;
-    case 2 : vi = vcc; break;
-    case 3 : vi = vdd; break; 
-    }
-    if(vi == vaa || vi == vbb) {
-      Triangulation::remove_constrained_edge(f, i);
-    }
-  }
-  else{ //computed
-    Triangulation::remove_constrained_edge(f, i);
-    vi = insert(pi, f);
-  }
-
-  // vi == vc or vi == vd may happen even if intersection==true
-  // due to approximate construction of the intersection
-  if (vi != vcc && vi != vdd) { 
-    hierarchy.split_constraint(vcc,vdd,vi);
-    insert_subconstraint(vcc,vi); 
-    insert_subconstraint(vi, vdd);
-  } 
-  else {
-    insert_subconstraint(vcc,vdd);
-  }
-  return vi; 
-}
-
-  // CONCATENATE AND SPLIT
-
-  // concatenates two constraints
-template <class Tr>
-typename Constrained_triangulation_plus_2<Tr>::Constraint_id
-Constrained_triangulation_plus_2<Tr>::concatenate(Constraint_id first, Constraint_id second)
-{
-  return hierarchy.concatenate(first,second);
-}
-
-  // split a constraint in two constraints, so that vcit becomes the first
-  // vertex of the new constraint
-  // returns the new constraint 
-template <class Tr>
-typename Constrained_triangulation_plus_2<Tr>::Constraint_id
-Constrained_triangulation_plus_2<Tr>::split(Constraint_id first, Vertices_in_constraint_iterator vcit)
-{
-  return hierarchy.split(first, vcit);
-}
-
-
-template <class Tr>
-std::ostream &
-operator<<(std::ostream& os, 
-	   const Constrained_triangulation_plus_2<Tr> &ct)
-{
-  ct.file_output(os);
-  return os ;
-}
-
-// Constraint Hierarchy Queries
-
-template <class Tr>
-inline
-typename
-Constrained_triangulation_plus_2<Tr>::Constraint_iterator
-Constrained_triangulation_plus_2<Tr>::
-constraints_begin() const
-{
-  return hierarchy.c_begin();
-}
-
-template <class Tr>
-inline
-typename
-Constrained_triangulation_plus_2<Tr>::Constraint_iterator
-Constrained_triangulation_plus_2<Tr>::
-constraints_end() const
-{
-  return hierarchy.c_end();
-}
-
-template <class Tr>
-inline
-typename
-Constrained_triangulation_plus_2<Tr>::Subconstraint_iterator
-Constrained_triangulation_plus_2<Tr>::
-subconstraints_begin() const
-{
-  return hierarchy.subconstraint_begin();
-}
-
-template <class Tr>
-inline
-typename
-Constrained_triangulation_plus_2<Tr>::Subconstraint_iterator
-Constrained_triangulation_plus_2<Tr>::
-subconstraints_end() const
-{
-  return hierarchy.subconstraint_end();
-}
-
-
-template <class Tr>
-inline
-typename Constrained_triangulation_plus_2<Tr>::Context
-Constrained_triangulation_plus_2<Tr>::
-context(Vertex_handle va, Vertex_handle vb) // AF: const
-{
-  return hierarchy.context(va,vb);
-}
-
-
-template <class Tr>
-inline 
-typename Constrained_triangulation_plus_2<Tr>::size_type
-Constrained_triangulation_plus_2<Tr>::
-number_of_enclosing_constraints(Vertex_handle va, Vertex_handle vb) const
-{
- return static_cast<size_type> 
-   (hierarchy.number_of_enclosing_constraints(va,vb)); 
-}
-
-template <class Tr>
-inline bool
-Constrained_triangulation_plus_2<Tr>::
-is_subconstraint(Vertex_handle va, Vertex_handle vb)
-{
- return hierarchy.is_subconstrained_edge(va,vb); 
-}
-
-
-template <class Tr>
-inline
-typename Constrained_triangulation_plus_2<Tr>::Context_iterator
-Constrained_triangulation_plus_2<Tr>::
-contexts_begin(Vertex_handle va, Vertex_handle vb) const
-{
-  return hierarchy.contexts_begin(va,vb);
-}
-
-template <class Tr>
-inline
-typename Constrained_triangulation_plus_2<Tr>::Context_iterator
-Constrained_triangulation_plus_2<Tr>::
-contexts_end(Vertex_handle va, Vertex_handle vb) const
-{
-  return hierarchy.contexts_end(va,vb);
-}
-
-template <class Tr>
-inline
-typename Constrained_triangulation_plus_2<Tr>::Vertices_in_constraint_iterator
-Constrained_triangulation_plus_2<Tr>::
-vertices_in_constraint_begin(Constraint_id cid) const
-{
-  return  hierarchy.vertices_in_constraint_begin(cid);
-}
-
-template <class Tr>
-inline
-typename Constrained_triangulation_plus_2<Tr>::Vertices_in_constraint_iterator
-Constrained_triangulation_plus_2<Tr>::
-vertices_in_constraint_end(Constraint_id cid) const
-{
-  return  hierarchy.vertices_in_constraint_end(cid);
-}
-template <class Tr>
-inline
-typename Constrained_triangulation_plus_2<Tr>::Vertices_in_constraint_iterator
-Constrained_triangulation_plus_2<Tr>::
-vertices_in_constraint_begin(Vertex_handle va, Vertex_handle vb) const
-{
-  return  hierarchy.vertices_in_constraint_begin(va,vb);
-}
-
-template <class Tr>
-inline
-typename Constrained_triangulation_plus_2<Tr>::Vertices_in_constraint_iterator
-Constrained_triangulation_plus_2<Tr>::
-vertices_in_constraint_end(Vertex_handle va, Vertex_handle vb) const
-{
-  return  hierarchy.vertices_in_constraint_end(va,vb);
-}
-
-template <class Tr>
-inline
-typename Constrained_triangulation_plus_2<Tr>::Points_in_constraint_iterator
-Constrained_triangulation_plus_2<Tr>::
-points_in_constraint_begin(Constraint_id cid) const
-{
-  return  hierarchy.points_in_constraint_begin(cid);
-}
-
-template <class Tr>
-inline
-typename Constrained_triangulation_plus_2<Tr>::Points_in_constraint_iterator
-Constrained_triangulation_plus_2<Tr>::
-points_in_constraint_end(Constraint_id cid) const
-{
-  return  hierarchy.points_in_constraint_end(cid);
-}
-
-} //namespace CGAL
-
-#if defined(BOOST_MSVC)
-#  pragma warning(pop)
-#endif
-#endif //CGAL_CONSTRAINED_TRIANGULATION_PLUS_2_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/Non_x_monotone_arc_2.h b/3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/Non_x_monotone_arc_2.h
deleted file mode 100644
index b4d12ba..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/Non_x_monotone_arc_2.h
+++ /dev/null
@@ -1,314 +0,0 @@
-// Copyright (c) 2008,2009,2010,2011 Max-Planck-Institute Saarbruecken (Germany), 
-// and Tel-Aviv University (Israel).  All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// 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(s)     : Pavel Emeliyanenko <asm at mpi-sb.mpg.de>
-
-#ifndef CGAL_CURVED_KERNEL_VIA_ANALYSIS_2_NON_X_MONOTONE_ARC_2_H
-#define CGAL_CURVED_KERNEL_VIA_ANALYSIS_2_NON_X_MONOTONE_ARC_2_H
-
-/*!\file include/CGAL/Curved_kernel_via_analysis_2/Non_x_monotone_arc_2.h
- * \brief defines class \c Non_x_monotone_arc_2
- *  
- * non x-monotone arc of a generic curve
- */
-
-#include <CGAL/config.h>
-#include <CGAL/Handle_with_policy.h>
-
-#include <CGAL/Curved_kernel_via_analysis_2/Arc_2.h>
-
-//#include <CGAL/IO/Qt_widget.h>
-
-namespace CGAL {
-
-namespace internal {
-
-template < class CurvedKernelViaAnalysis_2 >
-class Non_x_monotone_arc_2_rep { 
-
-public:
-
-    // this instance's first template parameter
-    typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2;
-    
-    // myself
-    typedef Non_x_monotone_arc_2_rep< Curved_kernel_via_analysis_2 > Self;
-
-    // type of an arc on generic curve
-    typedef typename Curved_kernel_via_analysis_2::Arc_2 Arc_2;
-
-    // a list of x-monotone arcs
-    typedef std::vector< Arc_2 > Arc_vector;
-
-public:    
-
-    /*!\brief
-     * Default constructor
-     */
-    Non_x_monotone_arc_2_rep() {
-    }
-
-    /*!\brief 
-     * constructs from one x-monotone arc
-     */
-    Non_x_monotone_arc_2_rep(const Arc_2& arc) {
-        _m_x_monotone_arcs.push_back(arc);
-    }
-
-    /*!\brief 
-     * constructs a non x-monotone arc from the list of x-monotone pieces
-     */
-    template <class InputIterator>
-    Non_x_monotone_arc_2_rep(InputIterator start, InputIterator end) :
-        _m_x_monotone_arcs(std::distance(start, end)) {
-
-        std::copy(start, end, _m_x_monotone_arcs.begin());
-    }
-
-    //! a list of x-monotone pieces this arc consists of
-    mutable Arc_vector _m_x_monotone_arcs;
-
-}; // Non_x_monotone_arc_2_rep
-
-/*! \brief
- * Class representing a (not necessary x-monotone) curve arc
- *
- * This class represents a not necessarily x-monotone curve arc. The arc is
- * given as a list of connected x-monotone pieces.
- *
- * By constructing a new arc, its validity is checked to ensure that its
- * x-monotone pieces form a single chain
- */
-template < class CurvedKernelViaAnalysis_2,
-        class Rep_  = Non_x_monotone_arc_2_rep< CurvedKernelViaAnalysis_2 > >
-class Non_x_monotone_arc_2 :
-    public CGAL::Handle_with_policy< Rep_ > {
-    
-public:
-    //!\name public typedefs
-    //!@{
-    
-    //! this instance's first template parameter
-    typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2;
-
-    //! this instance's second template parameter
-    typedef Rep_ Rep;
-
-    //! this instance itself
-    typedef Non_x_monotone_arc_2< Curved_kernel_via_analysis_2, Rep > Self;
-    
-    //! type of curve kernel
-    typedef typename Curved_kernel_via_analysis_2::Curve_kernel_2
-        Curve_kernel_2;
-       
-    //! type of analysis of a pair of curves
-    typedef typename Curve_kernel_2::Curve_analysis_2 Curve_analysis_2;
-    
-    //! type of a point on generic curve
-    typedef typename Curved_kernel_via_analysis_2::Point_2 Point_2;
-
-    //! type of an x-monotone arc on generic curve
-    typedef typename Curved_kernel_via_analysis_2::Arc_2 Arc_2;
-
-    //! iterator type to range through the list of x-monotone arcs
-    typedef typename Rep::Arc_vector::const_iterator Arc_const_iterator;
-    
-    //! the handle superclass
-    typedef ::CGAL::Handle_with_policy< Rep > Base;
-
-    //!@}
-public:
-    //!\name basic constructors
-    //!@{
-
-    /*!\brief
-     * Default constructor
-     */
-    Non_x_monotone_arc_2() : 
-        Base(Rep()) {   
-    }
-
-    /*!\brief
-     * copy constructor
-     */
-    Non_x_monotone_arc_2(const Self& a) :
-        Base(static_cast<const Base&>(a)) {  
-    }
-
-    /*! \brief
-     * constructs an arc from one x-monotone piece
-     */
-    Non_x_monotone_arc_2(const Arc_2& arc) :
-        Base(Rep(arc)) {
-    }
-
-    /*! \brief
-     * constructs an arc from a list x-monotone pieces specified by
-     * iterator range <tt>[start; end)</tt>
-     *
-     * template argument type of \c InputIterator is \c Arc_2
-     * 
-     * \pre the x-monotone arcs must be connected into a single chain
-     * \pre either all x-monotone arcs must be vertical or non-vertical
-     */
-    template <class InputIterator>
-    Non_x_monotone_arc_2(InputIterator start, InputIterator end) :
-        Base(Rep(start, end)) {
-
-        CGAL_precondition(start != end);
-        CGAL_precondition_code(
-            InputIterator oi = start;
-            InputIterator next = ++oi;
-            bool vertical = oi->is_vertical();
-            Curve_analysis_2 curve = oi->curve();
-            for(; next != end; next++) {
-                // ensure that supporting curves are identical for all arcs
-                CGAL_precondition(next->curve().is_identical(curve));
-                // either all arcs are vertical or not
-                CGAL_precondition(vertical == next->is_vertical());
-                /* this condition is hard to check because end-points can be
-                 reordered in Arc_2 constructor
-                CGAL_precondition(oi->curve_end(CGAL::ARR_MAX_END).
-                    compare_xy(next->curve_end(CGAL::ARR_MIN_END)) ==
-                            CGAL::EQUAL);*/
-                oi = next;
-            }
-        );
-    }
-
-    //!@}
-public:
-    //! \name Access functions
-    //!@{
-    
-    /*!\brief
-     * returns the number of x-monotone arcs this object consists of
-     */
-    int number_of_x_monotone_arcs() const {
-        return static_cast<int>(this->ptr()->_m_x_monotone_arcs.size());
-    }
-    
-    /*!\brief
-     * returns iterator pointing to the first x-monotone arc in the list
-     */
-    Arc_const_iterator begin() const {
-        return this->ptr()->_m_x_monotone_arcs.begin(); 
-    }
-
-    /*!\brief
-     * returns iterator pointing to beyond the last x-monotone arc in the list
-     */
-    Arc_const_iterator end() const {
-        return this->ptr()->_m_x_monotone_arcs.end();
-    }
-
-#if 1 // not needed
-    /*!\brief
-     * returns a distinct \c ith x-monotone piece of the arc
-     */
-    const Arc_2& x_monotone_arc(int i) const {
-        CGAL_precondition(i >= 0);
-        CGAL_precondition(i < number_of_x_monotone_arcs());
-        return this->ptr()->_m_x_monotone_arcs[i];
-    }
-#endif	
-
-    /*!\brief
-     * returns the supporting curve
-     */
-    Curve_analysis_2 curve() const {
-        CGAL_precondition(number_of_x_monotone_arcs() > 0);
-        return this->ptr()->_m_x_monotone_arcs[0].curve();
-    }
-
-    /*!\brief
-     * returns \c true if this arc consists of vertical segments
-     */
-    bool is_vertical() const {
-        CGAL_precondition(number_of_x_monotone_arcs() > 0);
-        return this->ptr()->_m_x_monotone_arcs[0].is_vertical();
-    } 
-    
-    //!@}
-}; // Non_x_monotone_arc_2
-
-/*!\relates Non_x_monotone_arc_2
- * \brief 
- * output operator
- */
-template < class CurvedKernelViaAnalysis_2, class Rep_>
-std::ostream& operator <<(std::ostream& os,
-    const Non_x_monotone_arc_2<CurvedKernelViaAnalysis_2, Rep_>& arc) {
-
-    os << "List of x-monotone arcs: [\n";
-    int i = 0;
-
-    typename Non_x_monotone_arc_2<CurvedKernelViaAnalysis_2, Rep_>::
-        Arc_const_iterator ait;
-    for(ait = arc.begin(); ait != arc.end(); ait++, i++)
-        os << i << ": " << *ait << std::endl;
-    os << "]\n\n";
-    return os;
-}
-
-#if DOXYGEN_RUNNING
-
-/*!\relates Non_x_monotone_arc_2
- * \brief
- * draws an arc to Qt window \c qt
- */
-template < class CurvedKernelViaAnalysis_2, class Rep_>
-CGAL::Qt_widget& operator <<(CGAL::Qt_widget& ws,
-        const Non_x_monotone_arc_2<CurvedKernelViaAnalysis_2, Rep_>& arc) {
-
-    QPainter *ppnt = &ws.get_painter();
-
-    int n_arcs = arc.number_of_x_monotone_arcs();
-
-    QBrush defbrush = ppnt->brush();
-    // forbid drawing connection points between x-monotone pieces
-    if(n_arcs > 1)
-        ppnt->setBrush(Qt::NoBrush);
-
-    typename Non_x_monotone_arc_2<CurvedKernelViaAnalysis_2, Rep_>::
-        Arc_const_iterator ait;
-    for(ait = arc.begin(); ait != arc.end(); ait++)
-        ws << *ait;
-
-    if(n_arcs > 1) {
-        ppnt->setBrush(defbrush);
-
-        typeof(arc.x_monotone_arc(0)) const *xarc = &arc.x_monotone_arc(0);
-        if(xarc->location(CGAL::ARR_MIN_END) == CGAL::ARR_INTERIOR)
-            ws << xarc->curve_end(CGAL::ARR_MIN_END);
-
-        xarc = &arc.x_monotone_arc(n_arcs-1);
-        if(xarc->location(CGAL::ARR_MAX_END) == CGAL::ARR_INTERIOR)
-            ws << xarc->curve_end(CGAL::ARR_MAX_END);
-    }
-    return ws;
-};
-
-#endif // DOXYGEN_RUNNING
-
-} // namespace internal
-
-} //namespace CGAL
-
-#endif // CGAL_CURVED_KERNEL_VIA_ANALYSIS_2_NON_X_MONOTONE_ARC_2_H
-// EOF
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Dart.h b/3rdparty/CGAL-4.8/include/CGAL/Dart.h
deleted file mode 100644
index c098057..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Dart.h
+++ /dev/null
@@ -1,343 +0,0 @@
-// Copyright (c) 2010-2011 CNRS and LIRIS' Establishments (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Guillaume Damiand <guillaume.damiand at liris.cnrs.fr>
-//
-#ifndef CGAL_DART_H
-#define CGAL_DART_H 1
-
-#include <CGAL/Compact_container.h>
-#include <CGAL/assertions.h>
-#include <bitset>
-
-namespace CGAL {
-
-  /** @file Dart.h
-   * Definition of nD dart.
-   */
-
-  namespace internal {
-    template <typename Map,unsigned int i>
-    struct basic_link_beta_functor;
-
-    template <typename CMap,unsigned int i>
-    struct link_beta_functor;
-  }
-
-#define CGAL_BETAINV(i) (i>1?i:(i==1?0:1))
-
-  /** Definition of nD dart.
-   * The Dart class describes an nD dart (basic element of a
-   * combinatorial map). A dart is composed with handle towards its neighbors,
-   * a bitset containing Boolean marks, and handle towards enabled attributes.
-   * n is the dimension of the space (2 for 2D, 3 for 3D...)
-   * Refs the ref class
-   */
-  template <unsigned int d, typename Refs>
-  struct Dart
-  {
-    template < unsigned int, class, class, class, class >
-    friend class Combinatorial_map_base;
-
-    template<unsigned int, class, class>
-    friend class Combinatorial_map_storage_1;
-
-    template<unsigned int, class, class>
-    friend class Combinatorial_map_storage_2;
-
-    template<unsigned int, unsigned int, class, class, class>
-    friend class Linear_cell_complex_storage_1;
-
-    template<unsigned int, unsigned int, class, class, class>
-    friend class Linear_cell_complex_storage_2;
-
-    template <class, class, class, class>
-    friend class Compact_container;
-
-    template<class, unsigned int, unsigned int>
-    friend struct Remove_cell_functor;
-
-    template<class, unsigned int>
-    friend struct Contract_cell_functor;
-
-    template <typename,unsigned int>
-    friend struct internal::link_beta_functor;
-
-    template <typename, typename>
-    friend struct internal::Reverse_orientation_of_map_functor;
-
-    template <typename, typename>
-    friend struct internal::Reverse_orientation_of_connected_component_functor;
-
-  public:
-    typedef Dart<d,Refs>                     Self;
-    typedef typename Refs::Dart_handle       Dart_handle;
-    typedef typename Refs::size_type         size_type;
-    typedef typename Refs::Dart_const_handle Dart_const_handle;
-    typedef typename Refs::Helper            Helper;
-    /// Typedef for attributes
-    template<int i>
-    struct Attribute_handle: public Refs::template Attribute_handle<i>
-    {};
-    template<int i>
-    struct Attribute_const_handle:
-      public Refs::template Attribute_const_handle<i>
-    {};
-
-    /// The number of used marks.
-    static const size_type NB_MARKS = Refs::NB_MARKS;
-
-    /// The dimension of the combinatorial map.
-    static const unsigned int dimension = d;
-
-#ifdef CGAL_CMAP_DEPRECATED
-
-    /** Return if this dart is free for adimension.
-     * @param i the dimension.
-     * @return true iff the dart is linked with NULL for \em adimension.
-     */
-    template<unsigned int i>
-    bool is_free() const
-    {
-      CGAL_assertion(i <= dimension);
-      return mbeta[i] == Refs::null_dart_handle;
-    }
-    bool is_free(unsigned int i) const
-    {
-      CGAL_assertion(i <= dimension);
-      return mbeta[i] == Refs::null_dart_handle;
-    }
-
-    /** Return the highest dimension for which the dart is not free.
-     * @return the dimension d such that the dart is not d-free but k-free for
-     *         all k>d. -1 if the dart is free for all d in {0..n}
-     */
-    int highest_nonfree_dimension() const
-    {
-      for (int i=(int)dimension; i>=0; --i)
-      { if ( !is_free(i) ) return i; }
-      return -1;
-    }
-
-    /** Return a dart belonging to the same edge and to the second vertex
-     * of the current edge (NULL if such a dart does not exist).
-     * @return An handle to the opposite dart.
-     */
-    Dart_handle opposite()
-    {
-      for (unsigned int i = 2; i <= dimension; ++i)
-        if (!is_free(i)) return beta(i);
-      return NULL;
-    }
-    Dart_const_handle opposite() const
-    {
-      for (unsigned int i = 2; i <= dimension; ++i)
-        if (!is_free(i)) return beta(i);
-      return NULL;
-    }
-
-    /** Return a dart incident to the other extremity of the current edge,
-     *  but contrary to opposite, non necessary to the same edge
-     *  (NULL if such a dart does not exist).
-     * @return An handle to the opposite dart.
-     */
-    Dart_handle other_extremity()
-    {
-      for (unsigned int i = 1; i <= dimension; ++i)
-        if (!is_free(i)) return beta(i);
-      return NULL;
-    }
-    Dart_const_handle other_extremity() const
-    {
-      for (unsigned int i = 1; i <= dimension; ++i)
-        if (!is_free(i)) return beta(i);
-      return NULL;
-    }
-
-    /** Link this dart with a given dart for a given dimension.
-     * @param adart the dart to link with.
-     * @param i the dimension.
-     */
-    template<unsigned int i>
-    void basic_link_beta(Dart_handle adart)
-    {
-      CGAL_assertion(i <= dimension);
-      CGAL_assertion(this!=&*Refs::null_dart_handle);
-      mbeta[i] = adart;
-    }
-    void basic_link_beta(Dart_handle adart, unsigned int i)
-    {
-      CGAL_assertion(i <= dimension);
-      CGAL_assertion(this!=&*Refs::null_dart_handle);
-      mbeta[i] = adart;
-    }
-
-    /** Unlink this dart for a given dimension.
-     * @param i the dimension.
-     */
-    template<unsigned int i>
-    void unlink_beta()
-    {
-      CGAL_assertion(i <= dimension);
-      mbeta[i] = Refs::null_dart_handle;
-    }
-    void unlink_beta(unsigned int i)
-    {
-      CGAL_assertion(i <= dimension);
-      mbeta[i] = Refs::null_dart_handle;
-    }
-
-#endif // CGAL_CMAP_DEPRECATED
-
-    /** Return the beta of this dart for a given dimension.
-     * @param i the dimension.
-     * @return beta(\em i).
-     */
-    template<unsigned int i>
-    Dart_handle beta()
-    {
-      CGAL_assertion(i <= dimension);
-      return mbeta[i];
-    }
-    Dart_handle beta(unsigned int i)
-    {
-      CGAL_assertion(i <= dimension);
-      return mbeta[i];
-    }
-    template<unsigned int i>
-    Dart_const_handle beta() const
-    {
-      CGAL_assertion(i <= dimension);
-      return mbeta[i];
-    }
-    Dart_const_handle beta(unsigned int i) const
-    {
-      CGAL_assertion(i <= dimension);
-      return mbeta[i];
-    }
-
-    /** Return the beta inverse of this dart for a given dimension.
-     * @param i the dimension.
-     * @return beta^{-1}(\em i).
-     */
-    template<unsigned int i>
-    Dart_handle beta_inv()
-    { return beta<CGAL_BETAINV(i)>(); }
-    Dart_handle beta_inv(unsigned int i)
-    { return beta(CGAL_BETAINV(i)); }
-    template<unsigned int i>
-    Dart_const_handle beta_inv() const
-    { return beta<CGAL_BETAINV(i)>(); }
-    Dart_const_handle beta_inv(unsigned int i) const
-    { return beta(CGAL_BETAINV(i)); }
-
-    /// @return a handle on the i-attribute
-    template<int i>
-    typename Attribute_handle<i>::type attribute()
-    {
-      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
-                     "attribute<i> called but i-attributes are disabled.");
-      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
-        (mattribute_handles);
-    }
-    template<int i>
-    typename Attribute_const_handle<i>::type attribute() const
-    {
-      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
-                     "attribute<i> called but i-attributes are disabled.");
-      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
-        (mattribute_handles);
-    }
-
-    /** Return the mark value of a given mark number.
-     * @param amark the mark number.
-     * @return the value for this number.
-     */
-    bool get_mark(size_type amark) const
-    {
-      CGAL_assertion(amark>=0 && amark<NB_MARKS);
-      return mmarks[amark];
-    }
-
-    /** Set the mark of a given mark number to a given value.
-     * @param amark the mark number.
-     * @param AValue the value.
-     */
-    void set_mark(size_type amark, bool avalue) const
-    {
-      CGAL_assertion(amark>=0 && amark<NB_MARKS);
-      mmarks.set(amark, avalue);
-    }
-    /** Flip the mark of a given mark number.
-     * @param amark the mark number.
-     */
-    void flip_mark(size_type amark) const
-    {
-      CGAL_assertion(amark>=0 && amark<NB_MARKS);
-      mmarks.flip(amark);
-    }
-
-    /** Return all the marks of this dart.
-     * @return the marks.
-     */
-     std::bitset<NB_MARKS> get_marks() const
-    { return mmarks; }
-
-    /** Set simultaneously all the marks of this dart to a given value.
-     * @param amarks the value of the marks.
-     */
-     void set_marks(const std::bitset<NB_MARKS>& amarks) const
-    { mmarks = amarks; }
-
-  protected:
-    /** Default constructor: no real initialisation,
-     *  because this is done in the combinatorial map class.
-     */
-    Dart()
-    {}
-
-    /** Copy constructor:
-     * @param adart a dart.
-     */
-    Dart(const Dart& adart) : mmarks(adart.mmarks),
-    mattribute_handles(adart.mattribute_handles)
-    {
-      for (unsigned int i = 0; i <= dimension; ++i)
-        mbeta[i] = adart.mbeta[i];
-    }
-
-   public:
-    void * for_compact_container() const
-    { return mbeta[0].for_compact_container(); }
-    void * & for_compact_container()
-    { return mbeta[0].for_compact_container(); }
-
-  protected:
-    /// Beta for each dimension +1 (from 0 to dimension).
-    Dart_handle mbeta[dimension+1];
-
-    /// Values of Boolean marks.
-    mutable std::bitset<NB_MARKS> mmarks;
-
-    /// Attributes enabled
-    typename Helper::Attribute_handles mattribute_handles;
-  };
-
-} // namespace CGAL
-
-#endif // CGAL_DART_H //
-// EOF //
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Delaunay_triangulation.h b/3rdparty/CGAL-4.8/include/CGAL/Delaunay_triangulation.h
deleted file mode 100644
index 21e0cc8..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Delaunay_triangulation.h
+++ /dev/null
@@ -1,895 +0,0 @@
-// Copyright (c) 2009-2014 INRIA Sophia-Antipolis (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
-// 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(s)    : Samuel Hornus
-
-#ifndef CGAL_DELAUNAY_COMPLEX_H
-#define CGAL_DELAUNAY_COMPLEX_H
-
-#include <CGAL/Triangulation.h>
-#include <CGAL/Dimension.h>
-#include <CGAL/Default.h>
-
-#include <boost/iterator/transform_iterator.hpp>
-
-#include <algorithm>
-
-namespace CGAL {
-
-template< typename DCTraits, typename _TDS = Default >
-class Delaunay_triangulation
-: public Triangulation<DCTraits,
-            typename Default::Get<_TDS, Triangulation_data_structure<
-                             typename DCTraits::Dimension,
-                             Triangulation_vertex<DCTraits>,
-                             Triangulation_full_cell<DCTraits> >
-                    >::type >
-{
-    typedef typename DCTraits::Dimension            Maximal_dimension_;
-    typedef typename Default::Get<_TDS, Triangulation_data_structure<
-                         Maximal_dimension_,
-                         Triangulation_vertex<DCTraits>,
-                         Triangulation_full_cell<DCTraits> >
-                >::type                             TDS;
-    typedef Triangulation<DCTraits, TDS>            Base;
-    typedef Delaunay_triangulation<DCTraits, _TDS>  Self;
-
-    typedef typename DCTraits::Side_of_oriented_sphere_d
-                                                    Side_of_oriented_sphere_d;
-    typedef typename DCTraits::Orientation_d        Orientation_d;
-
-public: // PUBLIC NESTED TYPES
-
-    typedef DCTraits                                Geom_traits;
-    typedef typename Base::Triangulation_ds          Triangulation_ds;
-
-    typedef typename Base::Vertex                   Vertex;
-    typedef typename Base::Full_cell                Full_cell;
-    typedef typename Base::Facet                    Facet;
-    typedef typename Base::Face                     Face;
-
-    typedef typename Base::Maximal_dimension        Maximal_dimension;
-    typedef typename DCTraits::Point_d              Point;
-    typedef typename DCTraits::Point_d              Point_d;
-
-    typedef typename Base::Vertex_handle            Vertex_handle;
-    typedef typename Base::Vertex_iterator          Vertex_iterator;
-    typedef typename Base::Vertex_const_handle      Vertex_const_handle;
-    typedef typename Base::Vertex_const_iterator    Vertex_const_iterator;
-
-    typedef typename Base::Full_cell_handle           Full_cell_handle;
-    typedef typename Base::Full_cell_iterator         Full_cell_iterator;
-    typedef typename Base::Full_cell_const_handle     Full_cell_const_handle;
-    typedef typename Base::Full_cell_const_iterator   Full_cell_const_iterator;
-
-    typedef typename Base::size_type                size_type;
-    typedef typename Base::difference_type          difference_type;
-
-    typedef typename Base::Locate_type              Locate_type;
-
-protected: // DATA MEMBERS
-
-
-public:
-    
-    using Base::maximal_dimension;
-    using Base::are_incident_full_cells_valid;
-    using Base::coaffine_orientation_predicate;
-    using Base::reset_flat_orientation;
-    using Base::current_dimension;
-    //using Base::star;
-    //using Base::incident_full_cells;
-    using Base::geom_traits;
-    using Base::index_of_covertex;
-    using Base::infinite_vertex;
-    using Base::insert_in_hole;
-    using Base::insert_outside_convex_hull_1;
-    using Base::is_infinite;
-    using Base::is_valid;
-    using Base::locate;
-    using Base::points_begin;
-    using Base::set_neighbors;
-    using Base::new_full_cell;
-    using Base::number_of_vertices;
-    using Base::orientation;
-    using Base::tds;
-    using Base::reorient_full_cells;
-    using Base::full_cell;
-    using Base::full_cells_begin;
-    using Base::full_cells_end;
-    using Base::vertices_begin;
-    using Base::vertices_end;
-    // using Base::
-    
-private:
-    //*** Side_of_oriented_subsphere_d ***
-    typedef typename Base::Flat_orientation_d Flat_orientation_d;
-    typedef typename Base::Construct_flat_orientation_d Construct_flat_orientation_d;
-    typedef typename DCTraits::In_flat_side_of_oriented_sphere_d In_flat_side_of_oriented_sphere_d;
-    // Wrapper
-    struct Side_of_oriented_subsphere_d
-    {
-      boost::optional<Flat_orientation_d>* fop;
-      Construct_flat_orientation_d cfo;
-      In_flat_side_of_oriented_sphere_d ifsoos;
-
-      Side_of_oriented_subsphere_d(
-        boost::optional<Flat_orientation_d>& x,
-        Construct_flat_orientation_d const&y,
-        In_flat_side_of_oriented_sphere_d const&z)
-      : fop(&x), cfo(y), ifsoos(z) {}
-
-      template<class Iter>
-      CGAL::Orientation operator()(Iter a, Iter b, const Point & p)const
-      {
-        if(!*fop)
-          *fop=cfo(a,b);
-        return ifsoos(fop->get(),a,b,p);
-      }
-    };
-public:
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - UTILITIES
-
-    // A co-dimension 2 sub-simplex. called a Rotor because we can rotate
-    // the two "covertices" around the sub-simplex. Useful for traversing the
-    // boundary of a hole. NOT DOCUMENTED
-    typedef cpp11::tuple<Full_cell_handle, int, int>    Rotor;
-
-    /*Full_cell_handle full_cell(const Rotor & r) const // NOT DOCUMENTED
-    {
-        return cpp11::get<0>(r);
-    }
-    int index_of_covertex(const Rotor & r) const // NOT DOCUMENTED
-    {
-        return cpp11::get<1>(r);
-    }
-    int index_of_second_covertex(const Rotor & r) const // NOT DOCUMENTED
-    {
-        return cpp11::get<2>(r);
-    }*/
-    Rotor rotate_rotor(Rotor & r) // NOT DOCUMENTED...
-    {
-        int opposite = cpp11::get<0>(r)->mirror_index(cpp11::get<1>(r));
-        Full_cell_handle s = cpp11::get<0>(r)->neighbor(cpp11::get<1>(r));
-        int new_second = s->index(cpp11::get<0>(r)->vertex(cpp11::get<2>(r)));
-        return Rotor(s, new_second, opposite);
-    }
-    
-// - - - - - - - - - - - - - - - - - - - - - - - - - - CREATION / CONSTRUCTORS
-
-    Delaunay_triangulation(int dim, const Geom_traits k = Geom_traits())
-    : Base(dim, k)
-    {
-    }
-
-    // With this constructor,
-    // the user can specify a Flat_orientation_d object to be used for 
-    // orienting simplices of a specific dimension 
-    // (= preset_flat_orientation_.first)
-    // It it used by the dark triangulations created by DT::remove
-    Delaunay_triangulation(
-      int dim, 
-      const std::pair<int, const Flat_orientation_d *> &preset_flat_orientation,
-      const Geom_traits k = Geom_traits())
-    : Base(dim, preset_flat_orientation, k)
-    {
-    }
-
-    ~Delaunay_triangulation() {}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ACCESS
-
-    // Not Documented
-    Side_of_oriented_subsphere_d side_of_oriented_subsphere_predicate() const
-    {
-      return Side_of_oriented_subsphere_d (
-        flat_orientation_, 
-        geom_traits().construct_flat_orientation_d_object(), 
-        geom_traits().in_flat_side_of_oriented_sphere_d_object()
-      );
-    }
-
-
-    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - REMOVALS
-
-    Full_cell_handle remove(Vertex_handle);
-    Full_cell_handle remove(const Point & p, Full_cell_handle hint = Full_cell_handle())
-    {
-        Locate_type lt;
-        Face f(maximal_dimension());
-        Facet ft;
-        Full_cell_handle s = locate(p, lt, f, ft, hint);
-        if( Base::ON_VERTEX == lt )
-        {
-            return remove(s->vertex(f.index(0)));
-        }
-        return Full_cell_handle();
-    }
-
-    template< typename ForwardIterator >
-    void remove(ForwardIterator start, ForwardIterator end)
-    {
-        while( start != end )
-            remove(*start++);
-    }
-
-    // Not documented
-    void remove_decrease_dimension(Vertex_handle);
-
-    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - INSERTIONS
-
-    template< typename ForwardIterator >
-    size_type insert(ForwardIterator start, ForwardIterator end)
-    {
-        size_type n = number_of_vertices();
-        std::vector<Point> points(start, end);
-        spatial_sort(points.begin(), points.end(), geom_traits());
-        Full_cell_handle hint;
-        for( typename std::vector<Point>::const_iterator p = points.begin(); p != points.end(); ++p )
-        {
-            hint = insert(*p, hint)->full_cell();
-        }
-        return number_of_vertices() - n;
-    }
-    Vertex_handle insert(const Point &, const Locate_type, const Face &, const Facet &, const Full_cell_handle);
-    Vertex_handle insert(const Point & p, const Full_cell_handle start = Full_cell_handle())
-    {
-        Locate_type lt;
-        Face f(maximal_dimension());
-        Facet ft;
-        Full_cell_handle s = locate(p, lt, f, ft, start);
-        return insert(p, lt, f, ft, s);
-    }
-    Vertex_handle insert(const Point & p, const Vertex_handle hint)
-    {
-        CGAL_assertion( Vertex_handle() != hint );
-        return insert(p, hint->full_cell());
-    }
-    Vertex_handle insert_outside_affine_hull(const Point &);
-    Vertex_handle insert_in_conflicting_cell(const Point &, const Full_cell_handle);
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - GATHERING CONFLICTING SIMPLICES
-
-    bool is_in_conflict(const Point &, Full_cell_const_handle) const;
-    template< class OrientationPredicate >
-    Oriented_side perturbed_side_of_positive_sphere(const Point &,
-            Full_cell_const_handle, const OrientationPredicate &) const;
-
-    template< typename OutputIterator >
-    Facet compute_conflict_zone(const Point &, const Full_cell_handle, OutputIterator) const;
-
-    template < typename OrientationPredicate, typename SideOfOrientedSpherePredicate >
-    class Conflict_predicate
-    {
-        const Self & dc_;
-        const Point & p_;
-        OrientationPredicate ori_;
-        SideOfOrientedSpherePredicate side_of_s_;
-        int cur_dim_;
-    public:
-        Conflict_predicate(
-                const Self & dc,
-                const Point & p,
-                const OrientationPredicate & ori,
-                const SideOfOrientedSpherePredicate & side)
-        : dc_(dc), p_(p), ori_(ori), side_of_s_(side), cur_dim_(dc.current_dimension()) {}
-
-        inline
-        bool operator()(Full_cell_const_handle s) const
-        {
-            bool ok;
-            if( ! dc_.is_infinite(s) )
-            {
-                Oriented_side side = side_of_s_(dc_.points_begin(s), dc_.points_begin(s) + cur_dim_ + 1, p_);
-                if( ON_POSITIVE_SIDE == side )
-                    ok = true;
-                else if( ON_NEGATIVE_SIDE == side )
-                    ok = false;
-                else
-                    ok = ON_POSITIVE_SIDE == dc_.perturbed_side_of_positive_sphere<OrientationPredicate>(p_, s, ori_);
-            }
-            else
-            {
-                typedef typename Full_cell::Vertex_handle_const_iterator VHCI;
-                typedef Substitute_point_in_vertex_iterator<VHCI> F;
-                F spivi(dc_.infinite_vertex(), &p_);
-
-                Orientation o =  ori_(
-                  boost::make_transform_iterator(s->vertices_begin(), spivi),
-                  boost::make_transform_iterator(s->vertices_begin() + cur_dim_ + 1, 
-                                                 spivi));
-
-                if( POSITIVE == o )
-                    ok = true;
-                else if( o == NEGATIVE )
-                    ok = false;
-                else
-                    ok = (*this)(s->neighbor( s->index( dc_.infinite_vertex() ) ));
-            }
-            return ok;
-        }
-    };
-
-    template < typename ConflictPredicate >
-    class Conflict_traversal_predicate
-    {
-        const Self & dc_;
-        const ConflictPredicate & pred_;
-    public:
-        Conflict_traversal_predicate(const Self & dc, const ConflictPredicate & pred)
-        : dc_(dc), pred_(pred)
-        {}
-        inline
-        bool operator()(const Facet & f) const
-        {
-            return pred_(dc_.full_cell(f)->neighbor(dc_.index_of_covertex(f)));
-        }
-    };
-
-private:
-    // Some internal types to shorten notation
-    typedef typename Base::Coaffine_orientation_d Coaffine_orientation_d;
-    using Base::flat_orientation_;
-    typedef Conflict_predicate<Coaffine_orientation_d, Side_of_oriented_subsphere_d>
-            Conflict_pred_in_subspace;
-    typedef Conflict_predicate<Orientation_d, Side_of_oriented_sphere_d>
-            Conflict_pred_in_fullspace;
-    typedef Conflict_traversal_predicate<Conflict_pred_in_subspace>
-            Conflict_traversal_pred_in_subspace;
-    typedef Conflict_traversal_predicate<Conflict_pred_in_fullspace>
-            Conflict_traversal_pred_in_fullspace;
-
-    // This is used in the |remove(v)| member function to manage sets of Full_cell_handles
-    template< typename FCH >
-    struct Full_cell_set : public std::vector<FCH>
-    {
-        typedef std::vector<FCH> Base_set;
-        using Base_set::begin;
-        using Base_set::end;
-        void make_searchable()
-        {   // sort the full cell handles
-            std::sort(begin(), end());
-        }
-        bool contains(const FCH & fch) const
-        {
-            return std::binary_search(begin(), end(), fch);
-        }
-        bool contains_1st_and_not_2nd(const FCH & fst, const FCH & snd) const
-        {
-            return ( ! contains(snd) ) && ( contains(fst) );
-        }
-    };
-};
-
-// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
-// FUNCTIONS THAT ARE MEMBER METHODS:
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - REMOVALS
-
-template< typename DCTraits, typename TDS >
-typename Delaunay_triangulation<DCTraits, TDS>::Full_cell_handle
-Delaunay_triangulation<DCTraits, TDS>
-::remove( Vertex_handle v )
-{
-    CGAL_precondition( ! is_infinite(v) );
-    CGAL_expensive_precondition( is_vertex(v) );
-
-    // THE CASE cur_dim == 0
-    if( 0 == current_dimension() )
-    {
-        remove_decrease_dimension(v);
-        return Full_cell_handle();
-    }
-    else if( 1 == current_dimension() )
-    {   // THE CASE cur_dim == 1
-        if( 2 == number_of_vertices() )
-        {
-            remove_decrease_dimension(v);
-            return Full_cell_handle();
-        }
-        Full_cell_handle left = v->full_cell();
-        if( is_infinite(left) && left->neighbor(0)->index(left) == 0 ) // we are on the infinite right.
-            left = left->neighbor(0);
-        if( 0 == left->index(v) )
-            left = left->neighbor(1);
-        CGAL_assertion( 1 == left->index(v) );
-        Full_cell_handle right = left->neighbor(0);
-        if( ! is_infinite(right) )
-        {
-            tds().associate_vertex_with_full_cell(left, 1, right->vertex(1));
-            set_neighbors(left, 0, right->neighbor(0), right->mirror_index(0));
-        }
-        else
-        {
-            tds().associate_vertex_with_full_cell(left, 1, left->vertex(0));
-            tds().associate_vertex_with_full_cell(left, 0, infinite_vertex());
-            set_neighbors(left, 0, left->neighbor(1), left->mirror_index(1));
-            set_neighbors(left, 1, right->neighbor(1), right->mirror_index(1));
-        }
-        tds().delete_vertex(v);
-        tds().delete_full_cell(right);
-        return left;
-    }
-
-    // THE CASE cur_dim >= 2
-    // Gather the finite vertices sharing an edge with |v|
-    typedef Full_cell_set<Full_cell_handle> Simplices;
-    Simplices simps;
-    std::back_insert_iterator<Simplices> out(simps);
-    tds().incident_full_cells(v, out);
-    typedef std::set<Vertex_handle> Vertex_set;
-    Vertex_set verts;
-    Vertex_handle vh;
-    for( typename Simplices::iterator it = simps.begin(); it != simps.end(); ++it )
-        for( int i = 0; i <= current_dimension(); ++i )
-        {
-            vh = (*it)->vertex(i);
-            if( is_infinite(vh) )
-                continue;
-            if( vh == v )
-                continue;
-            verts.insert(vh);
-        }
-
-    // After gathering finite neighboring vertices, create their Dark Delaunay triangulation
-    typedef Triangulation_vertex<Geom_traits, Vertex_handle> Dark_vertex_base;
-    typedef Triangulation_full_cell<Geom_traits,
-        internal::Triangulation::Dark_full_cell_data<Self> > Dark_full_cell_base;
-    typedef Triangulation_data_structure<Maximal_dimension, Dark_vertex_base, Dark_full_cell_base> Dark_tds;
-    typedef Delaunay_triangulation<DCTraits, Dark_tds>   Dark_triangulation;
-    typedef typename Dark_triangulation::Face             Dark_face;
-    typedef typename Dark_triangulation::Facet            Dark_facet;
-    typedef typename Dark_triangulation::Vertex_handle    Dark_v_handle;
-    typedef typename Dark_triangulation::Full_cell_handle   Dark_s_handle;
-
-    // If flat_orientation_ is defined, we give it the Dark triangulation
-    // so that the orientation it uses for "current_dimension()"-simplices is
-    // coherent with the global triangulation
-    Dark_triangulation dark_side(
-      maximal_dimension(),
-      flat_orientation_ ?
-      std::pair<int, const Flat_orientation_d *>(current_dimension(), flat_orientation_.get_ptr())
-      : std::pair<int, const Flat_orientation_d *>((std::numeric_limits<int>::max)(), (Flat_orientation_d*) NULL) );
-
-    Dark_s_handle dark_s;
-    Dark_v_handle dark_v;
-    typedef std::map<Vertex_handle, Dark_v_handle> Vertex_map;
-    Vertex_map light_to_dark;
-    typename Vertex_set::iterator vit = verts.begin();
-    while( vit != verts.end() )
-    {
-        dark_v = dark_side.insert((*vit)->point(), dark_s);
-        dark_s = dark_v->full_cell();
-        dark_v->data() = *vit;
-        light_to_dark[*vit] = dark_v;
-        ++vit;
-    }
-
-    if( dark_side.current_dimension() != current_dimension() )
-    {
-        CGAL_assertion( dark_side.current_dimension() + 1 == current_dimension() );
-        // Here, the finite neighbors of |v| span a affine subspace of
-        // dimension one less than the current dimension. Two cases are possible:
-        if( (size_type)(verts.size() + 1) == number_of_vertices() )
-        {
-            remove_decrease_dimension(v);
-            return Full_cell_handle();
-        }
-        else
-        {   // |v| is strictly outside the convex hull of the rest of the points. This is an
-            // easy case: first, modify the finite full_cells, then, delete the infinite ones.
-            // We don't even need the Dark triangulation.
-            Simplices infinite_simps;
-            {
-                Simplices finite_simps;
-                for( typename Simplices::iterator it = simps.begin(); it != simps.end(); ++it )
-                    if( is_infinite(*it) )
-                        infinite_simps.push_back(*it);
-                    else
-                        finite_simps.push_back(*it);
-                simps.swap(finite_simps);
-            } // now, simps only contains finite simplices
-            // First, modify the finite full_cells:
-            for( typename Simplices::iterator it = simps.begin(); it != simps.end(); ++it )
-            {
-                int v_idx = (*it)->index(v);
-                tds().associate_vertex_with_full_cell(*it, v_idx, infinite_vertex());
-                if( v_idx != 0 )
-                {
-                    // we must put the infinite vertex at index 0.
-                    // OK, now with the new convention that the infinite vertex
-                    // does not have to be at index 0, this is not necessary,
-                    // but still, I prefer to keep this piece of code here. [-- Samuel Hornus]
-                    (*it)->swap_vertices(0, v_idx);
-                    // Now, we preserve the positive orientation of the full_cell
-                    (*it)->swap_vertices(current_dimension() - 1, current_dimension());
-                }
-            }
-            // Make the handles to infinite full cells searchable
-            infinite_simps.make_searchable();
-            // Then, modify the neighboring relation
-            for( typename Simplices::iterator it = simps.begin(); it != simps.end(); ++it )
-            {
-                for( int i = 1; i <= current_dimension(); ++i )
-                {
-                    (*it)->vertex(i)->set_full_cell(*it);
-                    Full_cell_handle n = (*it)->neighbor(i);
-                    // Was |n| a finite full cell prior to removing |v| ?
-                    if( ! infinite_simps.contains(n) )
-                        continue;
-                    int n_idx = n->index(v);
-                    set_neighbors(*it, i, n->neighbor(n_idx), n->neighbor(n_idx)->index(n));
-                }
-            }
-            Full_cell_handle ret_s;
-            // Then, we delete the infinite full_cells
-            for( typename Simplices::iterator it = infinite_simps.begin(); it != infinite_simps.end(); ++it )
-                tds().delete_full_cell(*it);
-            tds().delete_vertex(v);
-            return simps.front();
-        }
-    }
-    else //  From here on, dark_side.current_dimension() == current_dimension()
-    {
-        dark_side.infinite_vertex()->data() = infinite_vertex();
-        light_to_dark[infinite_vertex()] = dark_side.infinite_vertex();
-    }
-
-    // Now, compute the conflict zone of v->point() in
-    // the dark side. This is precisely the set of full_cells
-    // that we have to glue back into the light side.
-    Dark_face       dark_f(dark_side.maximal_dimension());
-    Dark_facet      dark_ft;
-    typename Dark_triangulation::Locate_type     lt;
-    dark_s = dark_side.locate(v->point(), lt, dark_f, dark_ft);
-    CGAL_assertion( lt != Dark_triangulation::ON_VERTEX
-        && lt != Dark_triangulation::OUTSIDE_AFFINE_HULL );
-
-    // |ret_s| is the full_cell that we return
-    Dark_s_handle dark_ret_s = dark_s;
-    Full_cell_handle ret_s;
-
-    typedef Full_cell_set<Dark_s_handle> Dark_full_cells;
-    Dark_full_cells conflict_zone;
-    std::back_insert_iterator<Dark_full_cells> dark_out(conflict_zone);
-    
-    dark_ft = dark_side.compute_conflict_zone(v->point(), dark_s, dark_out);
-    // Make the dark simplices in the conflict zone searchable
-    conflict_zone.make_searchable();
-
-    // THE FOLLOWING SHOULD MAYBE GO IN TDS.
-    // Here is the plan:
-    // 1. Pick any Facet from boundary of the light zone
-    // 2. Find corresponding Facet on boundary of dark zone
-    // 3. stitch.
-
-    // 1. Build a facet on the boudary of the light zone:
-    Full_cell_handle light_s = *simps.begin();
-    Facet light_ft(light_s, light_s->index(v));
-
-    // 2. Find corresponding Dark_facet on boundary of the dark zone
-    Dark_full_cells dark_incident_s;
-    for( int i = 0; i <= current_dimension(); ++i )
-    {
-        if( index_of_covertex(light_ft) == i )
-            continue;
-        Dark_v_handle dark_v = light_to_dark[full_cell(light_ft)->vertex(i)];
-        dark_incident_s.clear();
-        dark_out = std::back_inserter(dark_incident_s);
-        dark_side.tds().incident_full_cells(dark_v, dark_out);
-        for( typename Dark_full_cells::iterator it = dark_incident_s.begin(); it != dark_incident_s.end(); ++it )
-        {
-            (*it)->data().count_ += 1;
-        }
-    }
-
-    for( typename Dark_full_cells::iterator it = dark_incident_s.begin(); it != dark_incident_s.end(); ++it )
-    {
-        if( current_dimension() != (*it)->data().count_ )
-            continue;
-        if( ! conflict_zone.contains(*it) )
-            continue;
-        // We found a full_cell incident to the dark facet corresponding to the light facet |light_ft|
-        int ft_idx = 0;
-        while( light_s->has_vertex( (*it)->vertex(ft_idx)->data() ) )
-            ++ft_idx;
-        dark_ft = Dark_facet(*it, ft_idx);
-        break;
-    }
-    // Pre-3. Now, we are ready to traverse both boundary and do the stiching.
-
-    // But first, we create the new full_cells in the light triangulation,
-    // with as much adjacency information as possible.
-
-    // Create new full_cells with vertices
-    for( typename Dark_full_cells::iterator it = conflict_zone.begin(); it != conflict_zone.end(); ++it )
-    {
-        Full_cell_handle new_s = new_full_cell();
-        (*it)->data().light_copy_ = new_s;
-        for( int i = 0; i <= current_dimension(); ++i )
-            tds().associate_vertex_with_full_cell(new_s, i, (*it)->vertex(i)->data());
-        if( dark_ret_s == *it )
-            ret_s = new_s;
-    }
-
-    // Setup adjacencies inside the hole
-    for( typename Dark_full_cells::iterator it = conflict_zone.begin(); it != conflict_zone.end(); ++it )
-    {
-        Full_cell_handle new_s = (*it)->data().light_copy_;
-        for( int i = 0; i <= current_dimension(); ++i )
-            if( conflict_zone.contains((*it)->neighbor(i)) )
-                tds().set_neighbors(new_s, i, (*it)->neighbor(i)->data().light_copy_, (*it)->mirror_index(i));
-    }
-
-    // 3. Stitch
-    simps.make_searchable();
-    typedef std::queue<std::pair<Facet, Dark_facet> > Queue;
-    Queue q;
-    q.push(std::make_pair(light_ft, dark_ft));
-    dark_s = dark_side.full_cell(dark_ft);
-    int dark_i = dark_side.index_of_covertex(dark_ft);
-    // mark dark_ft as visited:
-    // TODO try by marking with Dark_v_handle (vertex)
-    dark_s->neighbor(dark_i)->set_neighbor(dark_s->mirror_index(dark_i), Dark_s_handle());
-    while( ! q.empty() )
-    {
-        std::pair<Facet, Dark_facet> p = q.front();
-        q.pop();
-        light_ft = p.first;
-        dark_ft = p.second;
-        light_s = full_cell(light_ft);
-        int light_i = index_of_covertex(light_ft);
-        dark_s = dark_side.full_cell(dark_ft);
-        int dark_i = dark_side.index_of_covertex(dark_ft);
-        Full_cell_handle light_n = light_s->neighbor(light_i);
-        set_neighbors(dark_s->data().light_copy_, dark_i, light_n, light_s->mirror_index(light_i));
-        for( int di = 0; di <= current_dimension(); ++di )
-        {
-            if( di == dark_i )
-                continue;
-            int li = light_s->index(dark_s->vertex(di)->data());
-            Rotor light_r(light_s, li, light_i);
-            typename Dark_triangulation::Rotor dark_r(dark_s, di, dark_i);
-            
-            while (simps.contains(cpp11::get<0>(light_r)->neighbor(cpp11::get<1>(light_r))))
-                light_r = rotate_rotor(light_r);
-
-            while (conflict_zone.contains(cpp11::get<0>(dark_r)->neighbor(cpp11::get<1>(dark_r))))
-                dark_r = dark_side.rotate_rotor(dark_r);
-
-            Dark_s_handle dark_ns = cpp11::get<0>(dark_r);
-            int dark_ni = cpp11::get<1>(dark_r);
-            Full_cell_handle light_ns = cpp11::get<0>(light_r);
-            int light_ni = cpp11::get<1>(light_r);
-            // mark dark_r as visited:
-            // TODO try by marking with Dark_v_handle (vertex)
-            Dark_s_handle outside = dark_ns->neighbor(dark_ni);
-            Dark_v_handle mirror = dark_ns->mirror_vertex(dark_ni, current_dimension());
-            int dn = outside->index(mirror);
-            if( Dark_s_handle() == outside->neighbor(dn) )
-                continue;
-            outside->set_neighbor(dn, Dark_s_handle());
-            q.push(std::make_pair(Facet(light_ns, light_ni), Dark_facet(dark_ns, dark_ni)));
-        }
-    }
-    tds().delete_full_cells(simps.begin(), simps.end());
-    tds().delete_vertex(v);
-    return ret_s;
-}
-
-template< typename DCTraits, typename TDS >
-void
-Delaunay_triangulation<DCTraits, TDS>
-::remove_decrease_dimension(Vertex_handle v)
-{
-    CGAL_precondition( current_dimension() >= 0 );
-    tds().remove_decrease_dimension(v, infinite_vertex());
-    // reset the predicates:
-    reset_flat_orientation();
-    if( 1 <= current_dimension() )
-    {
-        Full_cell_handle inf_v_cell = infinite_vertex()->full_cell();
-        int inf_v_index = inf_v_cell->index(infinite_vertex());
-        Full_cell_handle s = inf_v_cell->neighbor(inf_v_index);
-        Orientation o = orientation(s);
-        CGAL_assertion( ZERO != o );
-        if( NEGATIVE == o )
-            reorient_full_cells();
-    }
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - INSERTIONS
-
-template< typename DCTraits, typename TDS >
-typename Delaunay_triangulation<DCTraits, TDS>::Vertex_handle
-Delaunay_triangulation<DCTraits, TDS>
-::insert(const Point & p, const Locate_type lt, const Face & f, const Facet &, const Full_cell_handle s)
-{
-    switch( lt )
-    {
-        case Base::OUTSIDE_AFFINE_HULL:
-            return insert_outside_affine_hull(p);
-            break;
-        case Base::ON_VERTEX:
-        {
-            Vertex_handle v = s->vertex(f.index(0));
-            v->set_point(p);
-            return v;
-            break;
-        }
-        default:
-            if( 1 == current_dimension() )
-            {
-                if( Base::OUTSIDE_CONVEX_HULL == lt )
-                {
-                    return insert_outside_convex_hull_1(p, s);
-                }
-                Vertex_handle v = tds().insert_in_full_cell(s);
-                v->set_point(p);
-                return v;
-            }
-            else
-                return insert_in_conflicting_cell(p, s);
-            break;
-    }
-}
-
-template< typename DCTraits, typename TDS >
-typename Delaunay_triangulation<DCTraits, TDS>::Vertex_handle
-Delaunay_triangulation<DCTraits, TDS>
-::insert_outside_affine_hull(const Point & p)
-{
-    // we don't use Base::insert_outside_affine_hull(...) because here, we
-    // also need to reset the side_of_oriented_subsphere functor.
-    CGAL_precondition( current_dimension() < maximal_dimension() );
-    Vertex_handle v = tds().insert_increase_dimension(infinite_vertex());
-    // reset the predicates:
-    reset_flat_orientation();
-    v->set_point(p);
-    if( current_dimension() >= 1 )
-    {
-        Full_cell_handle inf_v_cell = infinite_vertex()->full_cell();
-        int inf_v_index = inf_v_cell->index(infinite_vertex());
-        Full_cell_handle s = inf_v_cell->neighbor(inf_v_index);
-        Orientation o = orientation(s);
-        CGAL_assertion( ZERO != o );
-            if( NEGATIVE == o )
-                reorient_full_cells();
-    }
-    return v;
-}
-
-template< typename DCTraits, typename TDS >
-typename Delaunay_triangulation<DCTraits, TDS>::Vertex_handle
-Delaunay_triangulation<DCTraits, TDS>
-::insert_in_conflicting_cell(const Point & p, const Full_cell_handle s)
-{
-    typedef std::vector<Full_cell_handle> Full_cell_h_vector;
-    static Full_cell_h_vector cs; // for storing conflicting full_cells.
-    cs.clear();
-    // cs.reserve(64);
-    std::back_insert_iterator<Full_cell_h_vector> out(cs);
-    Facet ft = compute_conflict_zone(p, s, out);
-    return insert_in_hole(p, cs.begin(), cs.end(), ft);
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - GATHERING CONFLICTING SIMPLICES
-
-// NOT DOCUMENTED
-template< typename DCTraits, typename TDS >
-template< typename OrientationPred >
-Oriented_side
-Delaunay_triangulation<DCTraits, TDS>
-::perturbed_side_of_positive_sphere(const Point & p, Full_cell_const_handle s,
-        const OrientationPred & ori) const
-{
-    CGAL_precondition_msg( ! is_infinite(s), "full cell must be finite");
-    CGAL_expensive_precondition( POSITIVE == orientation(s) );
-    typedef std::vector<const Point *> Points;
-    Points points(current_dimension() + 2);
-    int i(0);
-    for( ; i <= current_dimension(); ++i )
-        points[i] = &(s->vertex(i)->point());
-    points[i] = &p;
-    std::sort(points.begin(), points.end(),
-            internal::Triangulation::Compare_points_for_perturbation<Self>(*this));
-    typename Points::const_reverse_iterator cut_pt = points.rbegin();
-    Points test_points;
-    while( cut_pt != points.rend() )
-    {
-        if( &p == *cut_pt )
-            // because the full_cell "s" is assumed to be positively oriented
-            return ON_NEGATIVE_SIDE; // we consider |p| to lie outside the sphere
-        test_points.clear();
-        typename Base::Point_const_iterator spit = points_begin(s);
-        int adjust_sign = -1;
-        for( i = 0; i < current_dimension(); ++i )
-        {
-            if( &(*spit) == *cut_pt )
-            {
-                ++spit;
-                adjust_sign = (((current_dimension() + i) % 2) == 0) ? -1 : +1;
-            }
-            test_points.push_back(&(*spit));
-            ++spit;
-        }
-        test_points.push_back(&p);
-
-        typedef typename CGAL::Iterator_project<typename Points::iterator,
-                        internal::Triangulation::Point_from_pointer<Self>,
-                const Point &, const Point *> Point_pointer_iterator;
-
-        Orientation ori_value = ori(
-                Point_pointer_iterator(test_points.begin()),
-                Point_pointer_iterator(test_points.end()));
-
-        if( ZERO != ori_value )
-            return Oriented_side( - adjust_sign * ori_value );
-
-        ++cut_pt;
-    }
-    CGAL_assertion(false); // we should never reach here
-    return ON_NEGATIVE_SIDE;
-}
-
-template< typename DCTraits, typename TDS >
-bool
-Delaunay_triangulation<DCTraits, TDS>
-::is_in_conflict(const Point & p, Full_cell_const_handle s) const
-{
-    CGAL_precondition( 2 <= current_dimension() );
-    if( current_dimension() < maximal_dimension() )
-    {
-        Conflict_pred_in_subspace c(*this, p, coaffine_orientation_predicate(), side_of_oriented_subsphere_predicate());
-        return c(s);
-    }
-    else
-    {
-        Orientation_d ori = geom_traits().orientation_d_object();
-        Side_of_oriented_sphere_d side = geom_traits().side_of_oriented_sphere_d_object();
-        Conflict_pred_in_fullspace c(*this, p, ori, side);
-        return c(s);
-    }
-}
-
-template< typename DCTraits, typename TDS >
-template< typename OutputIterator >
-typename Delaunay_triangulation<DCTraits, TDS>::Facet
-Delaunay_triangulation<DCTraits, TDS>
-::compute_conflict_zone(const Point & p, const Full_cell_handle s, OutputIterator out) const
-{
-    CGAL_precondition( 2 <= current_dimension() );
-    if( current_dimension() < maximal_dimension() )
-    {
-        Conflict_pred_in_subspace c(*this, p, coaffine_orientation_predicate(), side_of_oriented_subsphere_predicate());
-        Conflict_traversal_pred_in_subspace tp(*this, c);
-        return tds().gather_full_cells(s, tp, out);
-    }
-    else
-    {
-        Orientation_d ori = geom_traits().orientation_d_object();
-        Side_of_oriented_sphere_d side = geom_traits().side_of_oriented_sphere_d_object();
-        Conflict_pred_in_fullspace c(*this, p, ori, side);
-        Conflict_traversal_pred_in_fullspace tp(*this, c);
-        return tds().gather_full_cells(s, tp, out);
-    }
-}
-
-} //namespace CGAL
-
-#endif // CGAL_DELAUNAY_COMPLEX_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Delaunay_triangulation_2.h b/3rdparty/CGAL-4.8/include/CGAL/Delaunay_triangulation_2.h
deleted file mode 100644
index 7d1500d..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Delaunay_triangulation_2.h
+++ /dev/null
@@ -1,2485 +0,0 @@
-// Copyright (c) 1997  INRIA Sophia-Antipolis (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
-// 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(s)     : Mariette Yvinec
-//               : Olivier Devillers  (remove)
-//               : Pedro de Castro (displacement)
-
-
-
-#ifndef CGAL_DELAUNAY_TRIANGULATION_2_H
-#define CGAL_DELAUNAY_TRIANGULATION_2_H
-
-#include <CGAL/Triangulation_2.h>
-#include <CGAL/iterator.h>
-
-#ifndef CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
-#include <CGAL/Spatial_sort_traits_adapter_2.h>
-#include <CGAL/internal/info_check.h>
-#include <CGAL/tss.h>
-#include <boost/iterator/zip_iterator.hpp>
-#include <boost/mpl/and.hpp>
-
-
-#endif //CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
-
-namespace CGAL {
-
-template < class Gt, 
-           class Tds = Triangulation_data_structure_2 <
-                           Triangulation_vertex_base_2<Gt> > >
-class Delaunay_triangulation_2 : public Triangulation_2<Gt,Tds>
-{
-public:
-  typedef Gt Geom_traits;
-  typedef typename Geom_traits::Point_2       Point;
-  typedef typename Geom_traits::Segment_2     Segment;
-  typedef typename Geom_traits::Triangle_2    Triangle;
-
-  typedef typename Geom_traits::Orientation_2 Orientation_2;
-  typedef typename Geom_traits::Compare_x_2   Compare_x;
-  typedef typename Geom_traits::Compare_y_2   Compare_y;
-  typedef typename Geom_traits::Side_of_oriented_circle_2 
-                                              Side_of_oriented_circle;
-
-  
-  typedef Triangulation_2<Gt,Tds>                       Triangulation;
-  typedef typename Triangulation::size_type             size_type;
-  typedef typename Triangulation::Locate_type           Locate_type;
-  typedef typename Triangulation::Face_handle           Face_handle;
-  typedef typename Triangulation::Vertex_handle         Vertex_handle;
-  typedef typename Triangulation::Edge                  Edge;
-  typedef typename Triangulation::Edge_circulator       Edge_circulator;
-  typedef typename Triangulation::Face_circulator       Face_circulator;
-  typedef typename Triangulation::Vertex_circulator     Vertex_circulator;
-  typedef typename Triangulation::Finite_edges_iterator Finite_edges_iterator;
-  typedef typename Triangulation::Finite_faces_iterator Finite_faces_iterator;
-  typedef typename Triangulation::Finite_vertices_iterator 
-                                                     Finite_vertices_iterator;
-  typedef typename Triangulation::All_faces_iterator    All_faces_iterator;
- 
-#ifndef CGAL_CFG_USING_BASE_MEMBER_BUG_2
-  using Triangulation::side_of_oriented_circle;
-  using Triangulation::circumcenter;
-  using Triangulation::collinear_between;
-  using Triangulation::test_dim_down;
-  using Triangulation::make_hole;
-  using Triangulation::fill_hole_delaunay;
-  using Triangulation::delete_vertex;
-#endif
-
- Delaunay_triangulation_2(const Gt& gt = Gt())
-  : Triangulation_2<Gt,Tds>(gt) {}
-  
-  Delaunay_triangulation_2(
-	       const Delaunay_triangulation_2<Gt,Tds> &tr)
-       : Triangulation_2<Gt,Tds>(tr)
-  {   CGAL_triangulation_postcondition( is_valid() );  }
-
- template <class InputIterator>
- Delaunay_triangulation_2(InputIterator first, InputIterator last,
-                          const Gt& gt = Gt())
- : Triangulation_2<Gt,Tds>(gt)
- {
-  insert(first,last);
- }
-
-// CHECK -QUERY
-  bool is_valid(bool verbose = false, int level = 0) const;
-
-  Vertex_handle
-  nearest_vertex(const Point& p, Face_handle f= Face_handle()) const;
-  
-  bool does_conflict(const Point  &p, Face_handle fh) const;// deprecated
-  bool test_conflict(const Point  &p, Face_handle fh, bool strict = true) const;
-  bool find_conflicts(const Point  &p,                //deprecated
-		      std::list<Face_handle>& conflicts,
-		      Face_handle start= Face_handle() ) const;
-  //  //template member functions, declared and defined at the end 
-  // template <class OutputItFaces, class OutputItBoundaryEdges> 
-  // std::pair<OutputItFaces,OutputItBoundaryEdges>
-  // get_conflicts_and_boundary(const Point  &p, 
-  // 		                OutputItFaces fit, 
-  // 		                OutputItBoundaryEdges eit,
-  // 		                Face_handle start) const;
-  // template <class OutputItFaces>
-  // OutputItFaces
-  // get_conflicts (const Point  &p, 
-  //                OutputItFaces fit, 
-  // 		    Face_handle start ) const;
-  // template <class OutputItBoundaryEdges>
-  // OutputItBoundaryEdges
-  // get_boundary_of_conflicts(const Point  &p, 
-  // 			       OutputItBoundaryEdges eit, 
-  // 			       Face_handle start ) const;
-   
- 
-  // DUAL
-  Point dual (Face_handle f) const;
-  Object dual(const Edge &e) const ;
-  Object dual(const Edge_circulator& ec) const;
-  Object dual(const Finite_edges_iterator& ei) const;
-
-  //INSERTION-REMOVAL
-  Vertex_handle insert(const Point  &p, 
-		       Face_handle start = Face_handle() );
-  Vertex_handle insert(const Point& p,
-		       Locate_type lt,
-		       Face_handle loc, int li );
-  Vertex_handle push_back(const Point &p);
-
-  void  remove(Vertex_handle v );
-
-  // DISPLACEMENT
-  void restore_Delaunay(Vertex_handle v);
-
-  Vertex_handle move_if_no_collision(Vertex_handle v, const Point &p);
-  Vertex_handle move(Vertex_handle v, const Point &p);
-
-protected: // some internal stuffs
-
-  template <class OutputItFaces>
-  Vertex_handle insert_and_give_new_faces(const Point  &p, 
-                                          OutputItFaces fit,
-                                          Face_handle start = Face_handle() );
-  template <class OutputItFaces>
-  Vertex_handle insert_and_give_new_faces(const Point& p,
-                                          Locate_type lt,
-                                          Face_handle loc, int li, 
-                                          OutputItFaces fit);
-
-  template <class OutputItFaces>
-  Vertex_handle move_if_no_collision_and_give_new_faces(Vertex_handle v, 
-                                                        const Point &p, 
-                                                        OutputItFaces fit);
-
-  template <class OutputItFaces>
-  void remove_and_give_new_faces(Vertex_handle v, 
-                                 OutputItFaces fit);
-public:
-
-  bool is_delaunay_after_displacement(Vertex_handle v, 
-                                      const Point &p) const;
-
-#ifndef CGAL_CFG_USING_BASE_MEMBER_BUG_2  
-  using Triangulation::cw;
-  using Triangulation::ccw;
-  using Triangulation::geom_traits;
-#endif
-
-private:
-#ifndef CGAL_DT2_USE_RECURSIVE_PROPAGATING_FLIP
-  void non_recursive_propagating_flip(Face_handle f,int i);
-  void propagating_flip(const Face_handle& f,int i, int depth=0);
-#else
-  void propagating_flip(const Face_handle& f,int i);
-#endif
-
-
-// auxilliary functions for remove
-  void remove_degree_init(Vertex_handle v, std::vector<Face_handle> &f,
-         std::vector<Vertex_handle> &w, std::vector<int> &i,int&d,int&maxd);
-  void remove_degree_triangulate(Vertex_handle v, std::vector<Face_handle> &f,
-		      std::vector<Vertex_handle> &w, std::vector<int> &i,int d);
-  void remove_degree_d(Vertex_handle v, std::vector<Face_handle> &f,
-		      std::vector<Vertex_handle> &w, std::vector<int> &i,int d);
-  void remove_degree3(Vertex_handle v, std::vector<Face_handle> &f,
-		      std::vector<Vertex_handle> &w, std::vector<int> &i);
-  void remove_degree4(Vertex_handle v, std::vector<Face_handle> &f,
-		      std::vector<Vertex_handle> &w, std::vector<int> &i);
-  void remove_degree5(Vertex_handle v, std::vector<Face_handle> &f,
-		      std::vector<Vertex_handle> &w, std::vector<int> &i );
-  void remove_degree5_star   (Vertex_handle &v, 
-     Face_handle & ,Face_handle & ,Face_handle & ,Face_handle & ,Face_handle & ,
-     Vertex_handle&,Vertex_handle&,Vertex_handle&,Vertex_handle&,Vertex_handle&,
-     int           ,int           ,int           ,int           ,int );
-  void remove_degree6(Vertex_handle v , std::vector<Face_handle> &f,
-		      std::vector<Vertex_handle> &w, std::vector<int> &i);
-  void remove_degree6_star   (Vertex_handle &v,
-			      Face_handle & ,Face_handle & ,Face_handle & ,
-			      Face_handle & ,Face_handle & ,Face_handle & ,
-			      Vertex_handle&,Vertex_handle&,Vertex_handle&,
-			      Vertex_handle&,Vertex_handle&,Vertex_handle&,
-			      int           ,int           ,int           ,
-			      int           ,int           ,int );
-  void remove_degree6_N      (Vertex_handle &v,
-			      Face_handle & ,Face_handle & ,Face_handle & ,
-			      Face_handle & ,Face_handle & ,Face_handle & ,
-			      Vertex_handle&,Vertex_handle&,Vertex_handle&,
-			      Vertex_handle&,Vertex_handle&,Vertex_handle&,
-			      int           ,int           ,int           ,
-			      int           ,int           ,int  );
-  void remove_degree6_antiN  (Vertex_handle &v,
-			      Face_handle & ,Face_handle & ,Face_handle & ,
-			      Face_handle & ,Face_handle & ,Face_handle & ,
-			      Vertex_handle&,Vertex_handle&,Vertex_handle&,
-			      Vertex_handle&,Vertex_handle&,Vertex_handle&,
-			      int           ,int           ,int           ,
-			      int           ,int           ,int  );
-  void remove_degree6_diamond(Vertex_handle &v,
-			      Face_handle & ,Face_handle & ,Face_handle & ,
-			      Face_handle & ,Face_handle & ,Face_handle & ,
-			      Vertex_handle&,Vertex_handle&,Vertex_handle&,
-			      Vertex_handle&,Vertex_handle&,Vertex_handle&,
-			      int           ,int           ,int           ,
-			      int           ,int           ,int  );
-  void remove_degree7(Vertex_handle v,std::vector<Face_handle> &f,
-		      std::vector<Vertex_handle> &w, std::vector<int> &i);
-  bool incircle(int x, int j, int, int l, std::vector<Face_handle> &f,
-		std::vector<Vertex_handle> &w, std::vector<int> &i){
-    // k is supposed to be j+1 modulo degree, x is supposed to be finite
-    //test if w[x] inside circle w[j]w[k]w[l] (f[j] has vertices w[j]w[k])
-    // THE FOLLOWING LINE IS TO BE REMOVED. JUST THERE FOR STUPID PRECONDITION
-    //if (geom_traits().orientation_2_object()(w[j]->point(),w[k]->point(),w[l]->point())!=POSITIVE) return true;
-    f[j]->set_vertex( i[j], w[l]) ; // change vertex v for another one
-    return (test_conflict( w[x]->point(), f[j]) );
-  }
-  void rotate7(int j, std::vector<Vertex_handle> &w, 
-	       std::vector<Face_handle> &f, std::vector<int> &i);
-  void remove_degree7_star      (Vertex_handle&,int,std::vector<Face_handle> &f,
-		      std::vector<Vertex_handle> &w, std::vector<int> &i);
-  void remove_degree7_zigzag    (Vertex_handle&,int,std::vector<Face_handle> &f,
-		      std::vector<Vertex_handle> &w, std::vector<int> &i);
-  void remove_degree7_leftdelta (Vertex_handle&,int,std::vector<Face_handle> &f,
-		      std::vector<Vertex_handle> &w, std::vector<int> &i);
-  void remove_degree7_rightdelta(Vertex_handle&,int,std::vector<Face_handle> &f,
-		      std::vector<Vertex_handle> &w, std::vector<int> &i);
-  void remove_degree7_leftfan   (Vertex_handle&,int,std::vector<Face_handle> &f,
-		      std::vector<Vertex_handle> &w, std::vector<int> &i);
-  void remove_degree7_rightfan  (Vertex_handle&,int,std::vector<Face_handle> &f,
-		      std::vector<Vertex_handle> &w, std::vector<int> &i);
-// end of auxilliary functions for remove
-
-
-
-  Vertex_handle nearest_vertex_2D(const Point& p, Face_handle f) const;
-  Vertex_handle nearest_vertex_1D(const Point& p) const;
-
-  void  look_nearest_neighbor(const Point& p,
-			      Face_handle f,
-			      int i,
-			      Vertex_handle& nn) const;
-
-public:
-  template < class Stream>
-  Stream& draw_dual(Stream & ps)
-    {
-      Finite_edges_iterator eit= this->finite_edges_begin();
-      for (; eit != this->finite_edges_end(); ++eit) {
-	Object o = dual(eit);
-	typename Geom_traits::Line_2  l;
-	typename Geom_traits::Ray_2   r;
-	Segment s;
-	if (CGAL::assign(s,o)) ps << s;
-	if (CGAL::assign(r,o)) ps << r;
-	if (CGAL::assign(l,o)) ps << l;
-      }
-      return ps;
-    }
-#ifndef CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
-  template < class InputIterator >
-  std::ptrdiff_t
-  insert( InputIterator first, InputIterator last,
-          typename boost::enable_if<
-            boost::is_convertible<
-                typename std::iterator_traits<InputIterator>::value_type,
-                Point
-            >
-          >::type* = NULL
-  )
-#else
-  template < class InputIterator >
-  std::ptrdiff_t
-  insert(InputIterator first, InputIterator last)
-#endif //CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO 
-    {
-      size_type n = this->number_of_vertices();
-
-      std::vector<Point> points (first, last);
-      spatial_sort (points.begin(), points.end(), geom_traits());
-      Face_handle f;
-      for (typename std::vector<Point>::const_iterator p = points.begin(), end = points.end();
-              p != end; ++p)
-          f = insert (*p, f)->face();
-
-      return this->number_of_vertices() - n;
-    }
-
-#ifndef CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
-private:  
-  //top stands for tuple-or-pair
-  template <class Info>
-  const Point& top_get_first(const std::pair<Point,Info>& pair) const { return pair.first; }
-  template <class Info>
-  const Info& top_get_second(const std::pair<Point,Info>& pair) const { return pair.second; }
-  template <class Info>
-  const Point& top_get_first(const boost::tuple<Point,Info>& tuple) const { return boost::get<0>(tuple); }
-  template <class Info>
-  const Info& top_get_second(const boost::tuple<Point,Info>& tuple) const { return boost::get<1>(tuple); }
-
-  template <class Tuple_or_pair,class InputIterator>
-  std::ptrdiff_t insert_with_info(InputIterator first,InputIterator last)
-  {
-    size_type n = this->number_of_vertices();
-    std::vector<std::ptrdiff_t> indices;
-    std::vector<Point> points;
-    std::vector<typename Tds::Vertex::Info> infos;
-    std::ptrdiff_t index=0;
-    for (InputIterator it=first;it!=last;++it){
-      Tuple_or_pair value=*it;
-      points.push_back( top_get_first(value)  );
-      infos.push_back ( top_get_second(value) );
-      indices.push_back(index++);
-    }
-
-    typedef Spatial_sort_traits_adapter_2<Geom_traits,Point*> Search_traits;
-    
-    spatial_sort(indices.begin(),indices.end(),Search_traits(&(points[0]),geom_traits()));
-
-    Vertex_handle v_hint;
-    Face_handle hint;
-    for (typename std::vector<std::ptrdiff_t>::const_iterator
-      it = indices.begin(), end = indices.end();
-      it != end; ++it){
-      v_hint = insert(points[*it], hint);
-      if (v_hint!=Vertex_handle()){
-        v_hint->info()=infos[*it];
-        hint=v_hint->face();
-      }
-    }
-    
-    return this->number_of_vertices() - n;
-  }
-  
-public:
-
-  template < class InputIterator >
-  std::ptrdiff_t
-  insert( InputIterator first,
-          InputIterator last,
-          typename boost::enable_if<
-            boost::is_convertible<
-              typename std::iterator_traits<InputIterator>::value_type,
-              std::pair<Point,typename internal::Info_check<typename Tds::Vertex>::type>
-            > >::type* =NULL
-  )
-  {
-    return insert_with_info< std::pair<Point,typename internal::Info_check<typename Tds::Vertex>::type> >(first,last);
-  }
-
-  template <class  InputIterator_1,class InputIterator_2>
-  std::ptrdiff_t
-  insert( boost::zip_iterator< boost::tuple<InputIterator_1,InputIterator_2> > first,
-          boost::zip_iterator< boost::tuple<InputIterator_1,InputIterator_2> > last,
-          typename boost::enable_if<
-            boost::mpl::and_<
-              boost::is_convertible< typename std::iterator_traits<InputIterator_1>::value_type, Point >,
-              boost::is_convertible< typename std::iterator_traits<InputIterator_2>::value_type, typename internal::Info_check<typename Tds::Vertex>::type >
-            >
-          >::type* =NULL
-  )
-  {
-    return insert_with_info< boost::tuple<Point,typename internal::Info_check<typename Tds::Vertex>::type> >(first,last);
-  }
-#endif //CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
-
-  template <class OutputItFaces, class OutputItBoundaryEdges> 
-  std::pair<OutputItFaces,OutputItBoundaryEdges>
-  get_conflicts_and_boundary(const Point  &p, 
-			     OutputItFaces fit, 
-			     OutputItBoundaryEdges eit,
-			     Face_handle start = Face_handle(),
-                             bool strict = true) const {
-    CGAL_triangulation_precondition( this->dimension() == 2);
-    int li;
-    Locate_type lt;
-    Face_handle fh = this->locate(p,lt,li, start);
-    switch(lt) {
-    case Triangulation::OUTSIDE_AFFINE_HULL:
-    case Triangulation::VERTEX:
-      return std::make_pair(fit,eit);
-    case Triangulation::FACE:
-    case Triangulation::EDGE:
-    case Triangulation::OUTSIDE_CONVEX_HULL:
-      *fit++ = fh; //put fh in OutputItFaces
-      std::pair<OutputItFaces,OutputItBoundaryEdges>
-	pit = std::make_pair(fit,eit);
-      pit = propagate_conflicts(p,fh,0,pit, strict);
-      pit = propagate_conflicts(p,fh,1,pit, strict);
-      pit = propagate_conflicts(p,fh,2,pit, strict);
-      return pit;    
-    }
-    CGAL_triangulation_assertion(false);
-    return std::make_pair(fit,eit);
-  } 
-
-  template <class OutputItFaces> 
-  OutputItFaces
-  get_conflicts (const Point  &p, 
-		 OutputItFaces fit, 
-		 Face_handle start= Face_handle(),
-                 bool strict = true) const {
-    std::pair<OutputItFaces,Emptyset_iterator> pp = 
-      get_conflicts_and_boundary(p,fit,Emptyset_iterator(),start, strict);
-    return pp.first;
-  }
-
-  template <class OutputItBoundaryEdges> 
-  OutputItBoundaryEdges
-  get_boundary_of_conflicts(const Point  &p, 
-			    OutputItBoundaryEdges eit, 
-			    Face_handle start= Face_handle(),
-                            bool strict = true) const {
-    std::pair<Emptyset_iterator, OutputItBoundaryEdges> pp = 
-      get_conflicts_and_boundary(p,Emptyset_iterator(),eit,start,strict);
-    return pp.second;
-  }
-
-private:
-  
-
-
-
-#ifdef CGAL_DT2_USE_RECURSIVE_PROPAGATE_CONFLICTS
-  template <class OutputItFaces, class OutputItBoundaryEdges> 
-  std::pair<OutputItFaces,OutputItBoundaryEdges>
-  propagate_conflicts (const Point  &p,
-		       const Face_handle fh, 
-		       const int i,
-		       std::pair<OutputItFaces,OutputItBoundaryEdges>
-		       pit,
-                       bool strict = true)  const {
-    Face_handle fn = fh->neighbor(i);
-    if (! test_conflict(p,fn,strict)) {
-      *(pit.second)++ = Edge(fn, fn->index(fh));
-    } else {
-      *(pit.first)++ = fn;
-      int j = fn->index(fh);
-      pit = propagate_conflicts(p,fn,ccw(j),pit,strict);
-      pit = propagate_conflicts(p,fn,cw(j), pit,strict);
-    }
-    return pit;
-  }
-#else // NO CGAL_DT2_USE_RECURSIVE_PROPAGATE_CONFLICTS
-  template <class OutputItFaces, class OutputItBoundaryEdges> 
-  std::pair<OutputItFaces,OutputItBoundaryEdges>
-  non_recursive_propagate_conflicts ( const Point  &p,
-                                      const Face_handle fh, 
-                                      const int i,
-		                      std::pair<OutputItFaces,OutputItBoundaryEdges> pit,
-                                      bool strict = true)  const 
-  {
-    std::stack<std::pair<Face_handle, int> > stack;
-    stack.push( std::make_pair(fh,i) );
-    while ( !stack.empty() )
-    {
-      const Face_handle fh=stack.top().first;
-      const int i=stack.top().second;
-      stack.pop();
-      Face_handle fn = fh->neighbor(i);
-      if (! test_conflict(p,fn,strict)) {
-        *(pit.second)++ = Edge(fn, fn->index(fh));
-      } else {
-        *(pit.first)++ = fn;
-        int j = fn->index(fh);
-        stack.push( std::make_pair(fn,ccw(j)) );
-        stack.push( std::make_pair(fn,cw(j)) );
-      }
-    }
-    return pit;
-  }
-
-  template <class OutputItFaces, class OutputItBoundaryEdges> 
-  std::pair<OutputItFaces,OutputItBoundaryEdges>
-  propagate_conflicts (const Point  &p,
-		       const Face_handle fh, 
-		       const int i,
-		       std::pair<OutputItFaces,OutputItBoundaryEdges>
-		       pit,
-                       bool strict = true,
-                       int depth=0)  const 
-  {
-    if (depth == 100)
-      return non_recursive_propagate_conflicts(p, fh, i, pit, strict);
-
-    Face_handle fn = fh->neighbor(i);
-    if (! test_conflict(p,fn,strict)) {
-      *(pit.second)++ = Edge(fn, fn->index(fh));
-    } else {
-      *(pit.first)++ = fn;
-      int j = fn->index(fh);
-      pit = propagate_conflicts(p,fn,ccw(j),pit, strict, depth+1);
-      pit = propagate_conflicts(p,fn,cw(j), pit, strict, depth+1);
-    }
-    return pit;
-  }
-#endif // NO CGAL_DT2_USE_RECURSIVE_PROPAGATE_CONFLICTS
-
-protected:
-
-  void restore_edges(Vertex_handle v)
-  {
-    std::list<Edge> edges;
-    Face_circulator fc = this->incident_faces(v), done(fc);
-    int degree = 0;
-    do {
-      if((++degree) > 3) break;
-    } while(++fc != done);
-    fc = this->incident_faces(v);
-    done = fc;
-    if(degree == 3) {
-      do {
-        int i = fc->index(v);
-        edges.push_back(Edge(fc, i));
-      } while(++fc != done);
-    } else {
-      do {
-        int i = fc->index(v);
-        edges.push_back(Edge(fc, i));
-        edges.push_back(Edge(fc, this->cw(i)));
-      } while(++fc != done);
-    }
-    while(!edges.empty()) {
-      const Edge &e = edges.front();
-      Face_handle f = e.first;
-      int i = e.second;
-      edges.pop_front();
-      if(this->is_infinite(f->vertex(i))) continue;
-      Face_handle fi = f->neighbor(i);
-      int mi = this->_tds.mirror_index(f, i);
-      Vertex_handle vm = this->_tds.mirror_vertex(f, i);
-      if(this->is_infinite(vm)) continue;
-      if(this->side_of_oriented_circle(f, vm->point(),true) == ON_POSITIVE_SIDE) {
-        this->_tds.flip(f, i);
-        edges.push_back(Edge(f, i));
-        edges.push_back(Edge(f, this->cw(i)));
-        edges.push_back(Edge(fi, this->cw(mi)));
-        edges.push_back(Edge(fi, mi));
-      }
-    }
-  }
-
-  void restore_edges(Vertex_handle v, std::set<Face_handle> &faces)
-  {
-    typedef std::list<Edge> Edges_list;	
-    Edges_list edges;
-    Face_circulator fc = this->incident_faces(v), done(fc);
-    int degree = 0;
-    do {
-      if((++degree) > 3) break;
-    } while(++fc != done);
-    fc = this->incident_faces(v);
-    done = fc;
-    if(degree == 3) {
-      do {
-        int i = fc->index(v);
-        edges.push_back(Edge(fc, i));
-      } while(++fc != done);
-    } else {
-      do {
-        int i = fc->index(v);
-        edges.push_back(Edge(fc, i));
-        edges.push_back(Edge(fc, this->cw(i)));
-      } while(++fc != done);
-    }
-    while(!edges.empty()) {
-      const Edge &e = edges.front();
-      Face_handle f = e.first;
-      int i = e.second;
-      edges.pop_front();
-      faces.insert(f);
-      if(this->is_infinite(f->vertex(i))) continue;
-      Face_handle fi = f->neighbor(i);
-      int mi = this->_tds.mirror_index(f, i);
-      Vertex_handle vm = this->_tds.mirror_vertex(f, i);
-      if(this->is_infinite(vm)) continue;
-      if(this->side_of_oriented_circle(f, vm->point()) == ON_POSITIVE_SIDE) {
-        this->_tds.flip(f, i);
-        edges.push_back(Edge(f, i));
-        edges.push_back(Edge(f, this->cw(i)));
-        edges.push_back(Edge(fi, this->cw(mi)));
-        edges.push_back(Edge(fi, mi));
-      }
-    }
-  }
-
-};
-
-template < class Gt, class Tds >
-inline bool
-Delaunay_triangulation_2<Gt,Tds>::
-test_conflict(const Point  &p, Face_handle fh, bool strict) const
-{
-  if(! strict){
-    Oriented_side os = side_of_oriented_circle(fh,p,false);
-    return os == ON_POSITIVE_SIDE;
-  }
-  // return true  if P is inside the circumcircle of fh
-  // if fh is infinite, return true when p is in the positive
-  // halfspace or on the boundary and in the  finite edge of fh
-  Oriented_side os = side_of_oriented_circle(fh,p,true);
-  if (os == ON_POSITIVE_SIDE) return true;
- 
-  if (os == ON_ORIENTED_BOUNDARY && this->is_infinite(fh)) {
-    int i = fh->index(this->infinite_vertex());
-    return collinear_between(fh->vertex(cw(i))->point(), p,
-			     fh->vertex(ccw(i))->point() );
-  }
-
-  return false;
-}
-
-template < class Gt, class Tds >
-inline bool
-Delaunay_triangulation_2<Gt,Tds>::
-does_conflict(const Point  &p, Face_handle fh) const
-{
-  return test_conflict(p,fh);
-}
-
-template < class Gt, class Tds >
-inline bool
-Delaunay_triangulation_2<Gt,Tds>::
-find_conflicts(const Point  &p, 
-	       std::list<Face_handle>& conflicts,
-	       Face_handle start ) const
-{
-  get_conflicts(p, std::back_inserter(conflicts), start);
-  return (! conflicts.empty());
-}
-
-template < class Gt, class Tds >
-bool
-Delaunay_triangulation_2<Gt,Tds>::
-is_valid(bool verbose, int level) const
-{
-  bool result = Triangulation_2<Gt,Tds>::is_valid(verbose, level);
-
-  for( Finite_faces_iterator it = this->finite_faces_begin(); 
-       it != this->finite_faces_end() ; it++) {
-    for(int i=0; i<3; i++) {
-      if ( ! this->is_infinite( this->mirror_vertex(it,i))) {
-	result = result &&  ON_POSITIVE_SIDE != 
-	  side_of_oriented_circle( it, this->mirror_vertex(it,i)->point(), false);
-      }
-      CGAL_triangulation_assertion( result );
-    }
-  }
-  return result;
-}
-
-template < class Gt, class Tds >
-typename Delaunay_triangulation_2<Gt,Tds>::Vertex_handle
-Delaunay_triangulation_2<Gt,Tds>:: 
-nearest_vertex(const Point  &p, Face_handle f) const
-{
-  switch (this->dimension()) {
-  case 0:
-    if (this->number_of_vertices() == 0) return Vertex_handle();
-    if (this->number_of_vertices() == 1) return this->finite_vertex();
-    //break;
-  case 1:
-    return nearest_vertex_1D(p);
-    //break;      
-  case 2:
-    return nearest_vertex_2D(p,f);
-    //break;
-  }
-  return Vertex_handle();
-}
-  
-template < class Gt, class Tds >
-typename Delaunay_triangulation_2<Gt,Tds>::Vertex_handle
-Delaunay_triangulation_2<Gt,Tds>:: 
-nearest_vertex_2D(const Point& p, Face_handle f) const
-{
-  CGAL_triangulation_precondition(this->dimension() == 2);
-  f = this->locate(p,f);
-
-  typename Geom_traits::Compare_distance_2 
-    compare_distance =  this->geom_traits().compare_distance_2_object();
-  Vertex_handle nn =  !this->is_infinite(f->vertex(0)) ? f->vertex(0):f->vertex(1);
-  if ( !this->is_infinite(f->vertex(1)) && compare_distance(p,
-					    f->vertex(1)->point(),
-					    nn->point()) == SMALLER) 
-    nn=f->vertex(1);
-  if ( !this->is_infinite(f->vertex(2)) && compare_distance(p,
-					    f->vertex(2)->point(), 
-					    nn->point()) == SMALLER) 
-    nn=f->vertex(2);
-       
-  look_nearest_neighbor(p,f,0,nn);
-  look_nearest_neighbor(p,f,1,nn);
-  look_nearest_neighbor(p,f,2,nn);
-  return nn;
-}
-
-template < class Gt, class Tds >
-typename Delaunay_triangulation_2<Gt,Tds>::Vertex_handle
-Delaunay_triangulation_2<Gt,Tds>:: 
-nearest_vertex_1D(const Point& p) const
-{
-  typename Geom_traits::Compare_distance_2 
-    compare_distance =  this->geom_traits().compare_distance_2_object();
-  Vertex_handle nn;
-  
-  Finite_vertices_iterator vit=this->finite_vertices_begin();
-  nn = vit;
-  for ( ; vit != this->finite_vertices_end(); ++vit){
-    if (compare_distance(p, vit->point(), nn->point()) == SMALLER) 
-      nn = vit;
-  } 
-  return nn;
-}
-  
-template < class Gt, class Tds >
-void
-Delaunay_triangulation_2<Gt,Tds>::
-look_nearest_neighbor(const Point& p,
-                      Face_handle f,
-		      int i,
-		      Vertex_handle& nn) const
-{
-  Face_handle  ni=f->neighbor(i);
-  if ( ON_POSITIVE_SIDE != side_of_oriented_circle(ni,p,true) ) return;
-
-  typename Geom_traits::Compare_distance_2 
-    compare_distance =  this->geom_traits().compare_distance_2_object();
-  i = ni->index(f);
-  if ( !this->is_infinite(ni->vertex(i)) &&
-       compare_distance(p, 
-	      ni->vertex(i)->point(),
-	      nn->point())  == SMALLER)  nn=ni->vertex(i);
-    
-  // recursive exploration of triangles whose circumcircle contains p
-  look_nearest_neighbor(p, ni, ccw(i), nn);
-  look_nearest_neighbor(p, ni, cw(i), nn);
-} 
-
-//DUALITY
-template<class Gt, class Tds>
-inline
-typename Delaunay_triangulation_2<Gt,Tds>::Point
-Delaunay_triangulation_2<Gt,Tds>::
-dual (Face_handle f) const
-{
-  CGAL_triangulation_precondition(this->_tds.is_face(f));
-  CGAL_triangulation_precondition (this->dimension()==2);
-  return circumcenter(f);
-}
-
-  
-template < class Gt, class Tds >
-Object
-Delaunay_triangulation_2<Gt,Tds>::
-dual(const Edge &e) const
-{
-  CGAL_triangulation_precondition(this->_tds.is_edge(e.first,e.second));
-  
-  typedef typename Geom_traits::Line_2        Line;
-  typedef typename Geom_traits::Ray_2         Ray;
-
-  CGAL_triangulation_precondition (!this->is_infinite(e));
-  if( this->dimension()== 1 ){
-    const Point& p = (e.first)->vertex(cw(e.second))->point();
-    const Point& q = (e.first)->vertex(ccw(e.second))->point();
-    Line l  = this->geom_traits().construct_bisector_2_object()(p,q);
-    return make_object(l);
-  }
-		    
-  // dimension==2
-  if( (!this->is_infinite(e.first)) &&
-      (!this->is_infinite(e.first->neighbor(e.second))) ) {
-    Segment s = this->geom_traits().construct_segment_2_object()
-                          (dual(e.first),dual(e.first->neighbor(e.second)));
-    return make_object(s);
-  } 
-  // one of the adjacent faces is infinite
-  Face_handle f; int i;
-  if (this->is_infinite(e.first)) {
-    f=e.first->neighbor(e.second); i=f->index(e.first);
-  }
-  else {
-    f=e.first; i=e.second;
-  }
-  const Point& p = f->vertex(cw(i))->point();
-  const Point& q = f->vertex(ccw(i))->point();
-  Line l = this->geom_traits().construct_bisector_2_object()(p,q);
-  Ray r = this->geom_traits().construct_ray_2_object()(dual(f), l);
-  return make_object(r);
-}
-  
-template < class Gt, class Tds >
-inline Object
-Delaunay_triangulation_2<Gt,Tds>::  
-dual(const Edge_circulator& ec) const
-{
-  return dual(*ec);
-}
-
-template < class Gt, class Tds >
-inline Object
-Delaunay_triangulation_2<Gt,Tds>::
-dual(const Finite_edges_iterator& ei) const
-{
-  return dual(*ei);
-}
-
-
-///////////////////////////////////////////////////////////////
-//  INSERT
-
-template < class Gt, class Tds >
-inline
-typename Delaunay_triangulation_2<Gt,Tds>::Vertex_handle
-Delaunay_triangulation_2<Gt,Tds>::
-insert(const Point  &p,  Face_handle start)
-{
-  Locate_type lt;
-  int li;
-  Face_handle loc = this->locate (p, lt, li, start);
-  return insert(p, lt, loc, li);
-}
-  
-template < class Gt, class Tds >
-inline
-typename Delaunay_triangulation_2<Gt,Tds>::Vertex_handle
-Delaunay_triangulation_2<Gt,Tds>::
-push_back(const Point &p)
-{
-  return insert(p);
-}
-  
-template < class Gt, class Tds >
-inline
-typename Delaunay_triangulation_2<Gt,Tds>::Vertex_handle
-Delaunay_triangulation_2<Gt,Tds>::
-insert(const Point  &p, Locate_type lt, Face_handle loc, int li)
-{
-  Vertex_handle v = Triangulation_2<Gt,Tds>::insert(p,lt,loc,li);
-  restore_Delaunay(v);
-  return(v);
-}
-
-template < class Gt, class Tds >
-template < class OutputItFaces >
-inline
-typename Delaunay_triangulation_2<Gt,Tds>::Vertex_handle 
-Delaunay_triangulation_2<Gt,Tds>::
-insert_and_give_new_faces(const Point  &p, 
-                          OutputItFaces oif,
-                          Face_handle start)
-{
-  Vertex_handle v = insert(p, start);
-  int dimension = this->dimension();
-  if(dimension == 2)
-  {
-    Face_circulator fc = this->incident_faces(v), done(fc);
-    do {
-      *oif++ = fc;
-    } while(++fc != done);
-  }
-  else if(dimension == 1)
-  {
-    Face_handle c = v->face();
-    *oif++ = c;
-    *oif++ = c->neighbor((~(c->index(v)))&1);
-  }
-  else *oif++ = v->face(); // dimension == 0
-  return v;
-}
-		
-template < class Gt, class Tds >
-template < class OutputItFaces >
-inline
-typename Delaunay_triangulation_2<Gt,Tds>::Vertex_handle 
-Delaunay_triangulation_2<Gt,Tds>::
-insert_and_give_new_faces(const Point  &p,
-                          Locate_type lt,
-                          Face_handle loc, int li, 
-                          OutputItFaces oif)
-{
-  Vertex_handle v = insert(p, lt, loc, li);
-  int dimension = this->dimension();
-  if(dimension == 2)
-  {
-    Face_circulator fc = this->incident_faces(v), done(fc);
-    do {
-      *oif++ = fc;
-    } while(++fc != done);
-  }
-  else if(dimension == 1)
-  {
-    Face_handle c = v->face();
-    *oif++ = c;
-    *oif++ = c->neighbor((~(c->index(v)))&1);
-  }
-  else *oif++ = v->face(); // dimension == 0	
-  return v;	
-}
-
-template < class Gt, class Tds >
-void
-Delaunay_triangulation_2<Gt,Tds>::
-restore_Delaunay(Vertex_handle v)
-{
-  if(this->dimension() <= 1) return;
-
-  Face_handle f=v->face();
-  Face_handle next;
-  int i;
-  Face_handle start(f);
-  do {
-    i = f->index(v);
-    next = f->neighbor(ccw(i));  // turn ccw around v
-    propagating_flip(f,i);
-    f=next;
-  } while(next != start);
-  return;
-}
-
-#ifndef CGAL_DT2_USE_RECURSIVE_PROPAGATING_FLIP
-template < class Gt, class Tds >
-void
-Delaunay_triangulation_2<Gt,Tds>::
-non_recursive_propagating_flip(Face_handle f , int i)
-{
-  std::stack<Edge> edges;
-  const Vertex_handle& vp = f->vertex(i);
-  const Point& p = vp->point();
-  edges.push(Edge(f,i));
-
-  while(! edges.empty()){
-    const Edge& e = edges.top();
-    f = e.first; 
-    i = e.second;
-    const Face_handle& n = f->neighbor(i);
-    
-    if ( ON_POSITIVE_SIDE != 
-         side_of_oriented_circle(n,  p, true) ) {
-      edges.pop();
-      continue;
-    }
-    this->flip(f, i);
-    // As we haven't popped it, we don't have to push it
-    edges.push(Edge(n,n->index(vp)));
-  }
-}
-
-template < class Gt, class Tds >
-void
-Delaunay_triangulation_2<Gt,Tds>::
-propagating_flip(const Face_handle& f,int i, int depth)
-{
-#ifdef CGAL_DT2_IMMEDIATELY_NON_RECURSIVE_PROPAGATING_FLIP
-  non_recursive_propagating_flip(f,i);
-#else
-  int max_depth = 100;
-  if(depth==max_depth){
-    non_recursive_propagating_flip(f,i);
-    return;
-  }
-  Face_handle n = f->neighbor(i);
-      
-  if ( ON_POSITIVE_SIDE != 
-       side_of_oriented_circle(n,  f->vertex(i)->point(), true) ) {
-    return;
-  }
-  this->flip(f, i);
-  propagating_flip(f,i,depth+1);
-  i = n->index(f->vertex(i));
-  propagating_flip(n,i,depth+1);
-#endif
-}
-#else 
-template < class Gt, class Tds >
-void
-Delaunay_triangulation_2<Gt,Tds>::
-propagating_flip(const Face_handle& f,int i)
-{
- 
-  Face_handle n = f->neighbor(i);
-      
-  if ( ON_POSITIVE_SIDE != 
-       side_of_oriented_circle(n,  f->vertex(i)->point(), true) ) {
-    return;
-  }
-  this->flip(f, i);
-  propagating_flip(f,i);
-  i = n->index(f->vertex(i));
-  propagating_flip(n,i);
-}
-#endif
-
-///////////////////////////////////////////////////////////////
-//  REMOVE    see INRIA RResearch Report 7104
-
-template < class Gt, class Tds >
-template <class OutputItFaces>
-void
-Delaunay_triangulation_2<Gt,Tds>::
-remove_and_give_new_faces(Vertex_handle v, OutputItFaces fit)
-{
-  CGAL_triangulation_precondition( v != Vertex_handle());
-  CGAL_triangulation_precondition( !this->is_infinite(v));
-    
-  if(this->number_of_vertices() == 1) this->remove_first(v);
-  else if(this->number_of_vertices() == 2) this->remove_second(v);
-  else if( this->dimension() == 1) 
-  {
-    Point p = v->point();
-    Triangulation::remove(v);
-    *fit++ = this->locate(p);
-  }
-  else if (this->test_dim_down(v)) {  
-    this->_tds.remove_dim_down(v);  
-    for(All_faces_iterator afi = this-> all_faces_begin(); 
-        afi != this->all_faces_end(); 
-        afi++) *fit++ = afi;
-  }
-  else {
-    CGAL_STATIC_THREAD_LOCAL_VARIABLE(int, maxd,30);
-    CGAL_STATIC_THREAD_LOCAL_VARIABLE(std::vector<Face_handle> , f, maxd);
-    CGAL_STATIC_THREAD_LOCAL_VARIABLE(std::vector<int>, i, maxd);
-    CGAL_STATIC_THREAD_LOCAL_VARIABLE(std::vector<Vertex_handle>, w, maxd);
-
-    int d;
-    remove_degree_init(v,f,w,i,d,maxd);
-    remove_degree_triangulate(v,f,w,i,d);
-    this->delete_vertex(v);
-    Face_circulator fc(v[0]),done;
-    do *fit++ = fc++; while (fc!=done);
-  }
-  return;		
-}
-
-
-template < class Gt, class Tds >
-void
-Delaunay_triangulation_2<Gt,Tds>::
-remove(Vertex_handle v)
-{
-  int d;
-
-  CGAL_triangulation_precondition( v != Vertex_handle());
-  CGAL_triangulation_precondition( !this->is_infinite(v));
-
-  if ( this->dimension() <= 1) { Triangulation::remove(v); return; }
-
-  CGAL_STATIC_THREAD_LOCAL_VARIABLE(int, maxd,30);
-  CGAL_STATIC_THREAD_LOCAL_VARIABLE(std::vector<Face_handle> , f, maxd);
-  CGAL_STATIC_THREAD_LOCAL_VARIABLE(std::vector<int>, i, maxd);
-  CGAL_STATIC_THREAD_LOCAL_VARIABLE(std::vector<Vertex_handle>, w, maxd);
-
-  remove_degree_init(v,f,w,i,d,maxd);
-  if (d == 0) return; //  dim is going down
-  remove_degree_triangulate(v,f,w,i,d);
-  this->delete_vertex(v);
-}
-
-template < class Gt, class Tds >
-void
-Delaunay_triangulation_2<Gt,Tds>::
-remove_degree_init(Vertex_handle v, std::vector<Face_handle> &f,
-		   std::vector<Vertex_handle> &w, std::vector<int> &i,
-		   int &d, int &maxd)
-{
-  f[0] = v->face();d=0;
-  do{
-    i[d] = f[d]->index(v);
-    w[d] = f[d]->vertex( ccw(i[d]) );
-    if(this->is_infinite(w[d])) {
-      f[0] = f[d]; i[0]=i[d]; w[0]=w[d];
-      w[0]->set_face( f[0]->neighbor(i[0]));
-      f[1] = f[0]->neighbor( ccw(i[0]) );
-      i[1] = f[1]->index(v);
-      w[1] = f[1]->vertex( ccw(i[1]) );
-      if ( this->is_infinite( f[1]->neighbor( i[1] ) ) ){//otherwise dim remains 2
-	if ( this->test_dim_down(v) ) {
-	  d=0;
-	  this->tds().remove_dim_down(v);
-	  return; 
-	}
-      }
-      d=1;
-    }
-    w[d]->set_face( f[d]->neighbor(i[d]));//do no longer bother about set_face 
-    ++d;
-    if ( d==maxd) { maxd *=2; f.resize(maxd); w.resize(maxd); i.resize(maxd);}
-    f[d] = f[d-1]->neighbor( ccw(i[d-1]) );
-  } while(f[d]!=f[0]);
-  // all vertices finite but possibly w[0]
-}
-
-
-
-template < class Gt, class Tds >
-void
-Delaunay_triangulation_2<Gt,Tds>::
-remove_degree_triangulate(Vertex_handle v,
-                          std::vector<Face_handle> &f,
-                          std::vector<Vertex_handle> &w, 
-                          std::vector<int> &i,int d)
-{
-  switch (d) {
-  case 3:
-    remove_degree3(v,f,w,i);    break;
-  case 4:
-    remove_degree4(v,f,w,i);    break;
-  case 5:
-    remove_degree5(v,f,w,i);    break;
-  case 6:
-    remove_degree6(v,f,w,i);    break;
-  case 7:
-    remove_degree7(v,f,w,i);    break;
-  default:
-    remove_degree_d(v,f,w,i,d);    break;
-  }
-}
-
-template < class Gt, class Tds >
-void
-Delaunay_triangulation_2<Gt,Tds>::
-remove_degree_d(Vertex_handle v, std::vector<Face_handle> &,
-                std::vector<Vertex_handle> &, 
-                std::vector<int> &,int)
-{
-  // removing a degree d vertex, (dim is not going down)
-  // this is the old removal procedure that is used now only if d > 7
-
-    std::list<Edge> hole;
-    make_hole(v, hole);
-    fill_hole_delaunay(hole);
-    return;
-}
-
-template < class Gt, class Tds >
-void
-Delaunay_triangulation_2<Gt,Tds>::
-remove_degree3(Vertex_handle, std::vector<Face_handle> &f,
-	       std::vector<Vertex_handle> &, std::vector<int> &i)
-{
-  // removing a degree 3 vertex
-  // only w[0] can be infinite
-
-  // modify the triangulation
-  Face_handle nn= f[1]->neighbor( i[1] );
-  this->tds().set_adjacency(f[0], ccw(i[0]) , nn , nn->index(f[1])  );
-  nn= f[2]->neighbor( i[2] );
-  this->tds().set_adjacency(f[0], cw(i[0]) , nn , nn->index(f[2])  );
-  f[0]->set_vertex  (            i[0] , f[1]->vertex( cw(i[1]) ) );
-  
-  // clean container
-  this->tds().delete_face(f[1]);
-  this->tds().delete_face(f[2]);
-  
-  return;
-}
-
-template < class Gt, class Tds >
-void
-Delaunay_triangulation_2<Gt,Tds>::
-remove_degree4(Vertex_handle, std::vector<Face_handle> &f,
-	       std::vector<Vertex_handle> &w, std::vector<int> &i )
-{
-  // removing a degree 4 vertex
-  // only w[0] can be infinite
-
-  Face_handle nn;
-  // modify f[0] f[1] for incircle test
-  f[0]->set_vertex( i[0], w[3] ); //w0 w1 w3
-
-  if ( !test_conflict( w[2]->point(), f[0]) )  {
-    // diagonal 1 3
-    f[1]->set_vertex( i[1], w[3] ); //w1 w2 w3
-    nn = f[3]->neighbor( i[3] );
-    this->tds().set_adjacency(f[0], cw(i[0]) , nn , nn->index(f[3])  );
-    nn = f[2]->neighbor( i[2] );
-    this->tds().set_adjacency(f[1], ccw(i[1]) , nn , nn->index(f[2]) );
-    // clean container
-    this->tds().delete_face(f[2]);
-    this->tds().delete_face(f[3]);
-  }else{
-    // diagonal 0 2
-    f[0]->set_vertex( i[0], w[2]); //w0 w1 w2
-    f[3]->set_vertex( i[3], w[2]); //w3 w0 w2
-    nn = f[1]->neighbor( i[1] );
-    this->tds().set_adjacency(f[0], ccw(i[0]) , nn , nn->index(f[1])  );
-    nn = f[2]->neighbor( i[2] );
-    this->tds().set_adjacency(f[3], cw(i[3]) , nn , nn->index(f[2])  );
-    // clean container
-    this->tds().delete_face(f[1]);
-    this->tds().delete_face(f[2]);
-  }
-
-  return;
-}
-
-template < class Gt, class Tds >
-void
-Delaunay_triangulation_2<Gt,Tds>::
-remove_degree5(Vertex_handle v, std::vector<Face_handle> &f,
-	       std::vector<Vertex_handle> &w, std::vector<int> &i )
-{  
-  // removing a degree 5 vertex
-  // only w[0] can be infinite
-
-  if (incircle(3,0,1,2,f,w,i)) {
-    if (incircle(4,0,1,3,f,w,i)) {
-      if (incircle(4,1,2,3,f,w,i)) {
-	// star from 4
-	remove_degree5_star(v,f[4],f[0],f[1],f[2],f[3],
-			      w[4],w[0],w[1],w[2],w[3],
-			      i[4],i[0],i[1],i[2],i[3]);
-      }else{
-	//star from 1
-	remove_degree5_star(v,f[1],f[2],f[3],f[4],f[0],
-			      w[1],w[2],w[3],w[4],w[0],
-			      i[1],i[2],i[3],i[4],i[0]);
-			      
-			      
-      }
-    }else{
-      // star from 3
-      remove_degree5_star(v,f[3],f[4],f[0],f[1],f[2],
-			    w[3],w[4],w[0],w[1],w[2],
-			    i[3],i[4],i[0],i[1],i[2]);
-    }
-  } else {
-    if (incircle(4,2,3,0,f,w,i)){
-      if (incircle(4,0,1,2,f,w,i)){
-	// star from 4
-	remove_degree5_star(v,f[4],f[0],f[1],f[2],f[3],
-			      w[4],w[0],w[1],w[2],w[3],
-			      i[4],i[0],i[1],i[2],i[3]);
-      }else{
-	//star from 2
-	remove_degree5_star(v,f[2],f[3],f[4],f[0],f[1],
-			      w[2],w[3],w[4],w[0],w[1],
-			      i[2],i[3],i[4],i[0],i[1]);
-      }
-    }else{
-      // star from 0
-      remove_degree5_star(v,f[0],f[1],f[2],f[3],f[4],
-			    w[0],w[1],w[2],w[3],w[4],
-			    i[0],i[1],i[2],i[3],i[4]);
-    }
-  }
-  
-  return;
-}
-
-template < class Gt, class Tds >
-inline void
-Delaunay_triangulation_2<Gt,Tds>::remove_degree5_star
-(
- Vertex_handle &,
- Face_handle &  f0, Face_handle &  f1, Face_handle &  f2,
- Face_handle &  f3, Face_handle &  f4,
- Vertex_handle &v0, Vertex_handle &, Vertex_handle &,
- Vertex_handle &, Vertex_handle &,
- int i0, int i1, int i2, int i3, int i4 )
-{ // removing a degree 5 vertex, staring from v0
-  Face_handle nn;
-  f1->set_vertex( i1, v0) ;  // f1 = v1v2v0
-  f2->set_vertex( i2, v0) ;  // f2 = v2v3v0
-  f3->set_vertex( i3, v0) ;  // f3 = v3v4v0
-  nn = f0->neighbor( i0 );
-  this->tds().set_adjacency(f1, cw(i1) , nn , nn->index(f0) );
-  nn = f4->neighbor( i4 );
-  this->tds().set_adjacency(f3, ccw(i3) , nn , nn->index(f4) );
-  this->tds().delete_face(f0);
-  this->tds().delete_face(f4);
-}
-
-template < class Gt, class Tds >
-void
-Delaunay_triangulation_2<Gt,Tds>::
-remove_degree6(Vertex_handle v, std::vector<Face_handle> &f,
-		      std::vector<Vertex_handle> &w, std::vector<int> &i)
-{
-  // removing a degree 6 vertex
-  // only w[0] can be infinite
-
-  if(incircle(1,2,3,0,f,w,i)){
-    if(incircle(4,2,3,5,f,w,i)){
-      if(incircle(1,2,3,4,f,w,i)){
-	if(incircle(4,0,1,3,f,w,i)){
-	  if(incircle(5,0,1,4,f,w,i)){
-	    remove_degree6_star(v,f[1],f[2],f[3],f[4],f[5],f[0],
-				w[1],w[2],w[3],w[4],w[5],w[0],
-				i[1],i[2],i[3],i[4],i[5],i[0]);
-	  }else{
-	    remove_degree6_N(v,f[1],f[2],f[3],f[4],f[5],f[0],
-				w[1],w[2],w[3],w[4],w[5],w[0],
-				i[1],i[2],i[3],i[4],i[5],i[0]);
-	  }}else{
-	  remove_degree6_antiN(v,f[0],f[1],f[2],f[3],f[4],f[5],
-			       w[0],w[1],w[2],w[3],w[4],w[5],
-			       i[0],i[1],i[2],i[3],i[4],i[5]);
-	}}else{
-	if(incircle(5,1,2,4,f,w,i)){
-	  remove_degree6_N(v,f[2],f[3],f[4],f[5],f[0],f[1],
-			   w[2],w[3],w[4],w[5],w[0],w[1],
-			   i[2],i[3],i[4],i[5],i[0],i[1]);
-	}else{
-	  if(incircle(5,0,1,4,f,w,i)){
-	    remove_degree6_antiN(v,f[1],f[2],f[3],f[4],f[5],f[0],
-				w[1],w[2],w[3],w[4],w[5],w[0],
-				i[1],i[2],i[3],i[4],i[5],i[0]);
-	  }else{
-	    remove_degree6_star(v,f[4],f[5],f[0],f[1],f[2],f[3],
-				w[4],w[5],w[0],w[1],w[2],w[3],
-				i[4],i[5],i[0],i[1],i[2],i[3]);
-	  }}}}else{
-      if(incircle(1,2,3,5,f,w,i)){
-	if(incircle(1,3,4,5,f,w,i)){
-	  if(incircle(4,0,1,3,f,w,i)){
-	    if(incircle(5,0,1,4,f,w,i)){
-	    remove_degree6_star(v,f[1],f[2],f[3],f[4],f[5],f[0],
-				w[1],w[2],w[3],w[4],w[5],w[0],
-				i[1],i[2],i[3],i[4],i[5],i[0]);
-	    }else{
-	    remove_degree6_N(v,f[1],f[2],f[3],f[4],f[5],f[0],
-				w[1],w[2],w[3],w[4],w[5],w[0],
-				i[1],i[2],i[3],i[4],i[5],i[0]);
-	    }}else{
-	  remove_degree6_antiN(v,f[0],f[1],f[2],f[3],f[4],f[5],
-			       w[0],w[1],w[2],w[3],w[4],w[5],
-			       i[0],i[1],i[2],i[3],i[4],i[5]);
-	  }}else{
-	  if(incircle(5,0,1,3,f,w,i)){
-	    remove_degree6_diamond(v,f[1],f[2],f[3],f[4],f[5],f[0],
-				w[1],w[2],w[3],w[4],w[5],w[0],
-				i[1],i[2],i[3],i[4],i[5],i[0]);
-	  }else{
-	    if(incircle(4,5,0,3,f,w,i)){
-	  remove_degree6_antiN(v,f[0],f[1],f[2],f[3],f[4],f[5],
-			       w[0],w[1],w[2],w[3],w[4],w[5],
-			       i[0],i[1],i[2],i[3],i[4],i[5]);
-	    }else{
-	    remove_degree6_star(v,f[3],f[4],f[5],f[0],f[1],f[2],
-				w[3],w[4],w[5],w[0],w[1],w[2],
-				i[3],i[4],i[5],i[0],i[1],i[2]);
-	    }}}}else{
-	    remove_degree6_star(v,f[5],f[0],f[1],f[2],f[3],f[4],
-				w[5],w[0],w[1],w[2],w[3],w[4],
-				i[5],i[0],i[1],i[2],i[3],i[4]);
-      }}}else{
-    if(incircle(4,2,3,5,f,w,i)){
-      if(incircle(4,2,3,0,f,w,i)){
-	if(incircle(4,0,1,2,f,w,i)){
-	  if(incircle(4,1,2,5,f,w,i)){
-	    if(incircle(4,0,1,5,f,w,i)){
-	    remove_degree6_star(v,f[4],f[5],f[0],f[1],f[2],f[3],
-				w[4],w[5],w[0],w[1],w[2],w[3],
-				i[4],i[5],i[0],i[1],i[2],i[3]);
-	    }else{
-	    remove_degree6_antiN(v,f[1],f[2],f[3],f[4],f[5],f[0],
-				w[1],w[2],w[3],w[4],w[5],w[0],
-				i[1],i[2],i[3],i[4],i[5],i[0]);
-	    }}else{
-	  remove_degree6_N(v,f[2],f[3],f[4],f[5],f[0],f[1],
-			   w[2],w[3],w[4],w[5],w[0],w[1],
-			   i[2],i[3],i[4],i[5],i[0],i[1]);
-	  }}else{
-	  if(incircle(4,5,0,2,f,w,i)){
-	  remove_degree6_diamond(v,f[0],f[1],f[2],f[3],f[4],f[5],
-			       w[0],w[1],w[2],w[3],w[4],w[5],
-			       i[0],i[1],i[2],i[3],i[4],i[5]);
-	  }else{
-	    if(incircle(5,0,1,2,f,w,i)){
-	  remove_degree6_N(v,f[2],f[3],f[4],f[5],f[0],f[1],
-			   w[2],w[3],w[4],w[5],w[0],w[1],
-			   i[2],i[3],i[4],i[5],i[0],i[1]);
-	    }else{
-	  remove_degree6_star(v,f[2],f[3],f[4],f[5],f[0],f[1],
-			   w[2],w[3],w[4],w[5],w[0],w[1],
-			   i[2],i[3],i[4],i[5],i[0],i[1]);
-	    }}}}else{
-	  remove_degree6_star(v,f[0],f[1],f[2],f[3],f[4],f[5],
-			       w[0],w[1],w[2],w[3],w[4],w[5],
-			       i[0],i[1],i[2],i[3],i[4],i[5]);
-      }}else{
-      if(incircle(5,2,3,0,f,w,i)){
-	if(incircle(5,0,1,2,f,w,i)){
-	  remove_degree6_star(v,f[5],f[0],f[1],f[2],f[3],f[4],
-			       w[5],w[0],w[1],w[2],w[3],w[4],
-			      i[5],i[0],i[1],i[2],i[3],i[4]);
-	}else{
-	  remove_degree6_antiN(v,f[2],f[3],f[4],f[5],f[0],f[1],
-			   w[2],w[3],w[4],w[5],w[0],w[1],
-			   i[2],i[3],i[4],i[5],i[0],i[1]);
-	}}else{
-	  if(incircle(4,5,0,3,f,w,i)){
-	  remove_degree6_star(v,f[0],f[1],f[2],f[3],f[4],f[5],
-			       w[0],w[1],w[2],w[3],w[4],w[5],
-			       i[0],i[1],i[2],i[3],i[4],i[5]);
-	  }else{
-	  remove_degree6_N(v,f[0],f[1],f[2],f[3],f[4],f[5],
-			       w[0],w[1],w[2],w[3],w[4],w[5],
-			       i[0],i[1],i[2],i[3],i[4],i[5]);
-	  }}}}
-}
-
-template < class Gt, class Tds >
-inline void
-Delaunay_triangulation_2<Gt,Tds>::remove_degree6_star
-(
- Vertex_handle &,
- Face_handle &  f0, Face_handle &  f1, Face_handle &  f2,
- Face_handle &  f3, Face_handle &  f4, Face_handle &  f5,
- Vertex_handle &v0, Vertex_handle &, Vertex_handle &,
- Vertex_handle &, Vertex_handle &, Vertex_handle &,
- int i0, int i1, int i2, int i3, int i4, int i5 )
-{ // removing a degree 6 vertex, staring from v0
-  Face_handle nn;
-  f1->set_vertex( i1, v0) ;  // f1 = v1v2v0
-  f2->set_vertex( i2, v0) ;  // f2 = v2v3v0
-  f3->set_vertex( i3, v0) ;  // f3 = v3v4v0
-  f4->set_vertex( i4, v0) ;  // f4 = v4v5v0
-  nn = f0->neighbor( i0 );
-  this->tds().set_adjacency(f1, cw(i1), nn, nn->index(f0));
-  nn = f5->neighbor( i5 );
-  this->tds().set_adjacency(f4, ccw(i4), nn,  nn->index(f5));
-  this->tds().delete_face(f0);
-  this->tds().delete_face(f5);
-}
-
-template < class Gt, class Tds >
-inline void
-Delaunay_triangulation_2<Gt,Tds>::remove_degree6_N
-(
- Vertex_handle &,
- Face_handle &  f0, Face_handle &  f1, Face_handle &  f2,
- Face_handle &  f3, Face_handle &  f4, Face_handle &  f5,
- Vertex_handle &v0, Vertex_handle &, Vertex_handle &,
- Vertex_handle &v3, Vertex_handle &, Vertex_handle &,
- int i0, int i1, int i2, int i3, int i4, int i5 )
-{ // removing a degree 6 vertex, N configuration with diagonal v0v3
-  Face_handle nn;
-  f1->set_vertex( i1, v0) ;  // f1 = v1v2v0
-  f2->set_vertex( i2, v0) ;  // f2 = v2v3v0
-  f4->set_vertex( i4, v3) ;  // f4 = v4v5v3
-  f5->set_vertex( i5, v3) ;  // f5 = v5v0v3
-  nn = f0->neighbor( i0 );
-  this->tds().set_adjacency(f1, cw(i1) , nn , nn->index(f0)  );
-  nn = f3->neighbor( i3 );
-  this->tds().set_adjacency(f4, cw(i4) , nn, nn->index(f3) );
-  this->tds().set_adjacency(f2, ccw(i2) , f5 , ccw(i5)  );
-  this->tds().delete_face(f0);
-  this->tds().delete_face(f3);
-}
-
-template < class Gt, class Tds >
-inline void
-Delaunay_triangulation_2<Gt,Tds>::remove_degree6_antiN
-(
- Vertex_handle &,
- Face_handle &  f0, Face_handle &  f1, Face_handle &  f2,
- Face_handle &  f3, Face_handle &  f4, Face_handle &  f5,
- Vertex_handle &v0, Vertex_handle &, Vertex_handle &,
- Vertex_handle &v3, Vertex_handle &, Vertex_handle &,
- int i0, int i1, int i2, int i3, int i4, int i5 )
-{ // removing a degree 6 vertex, antiN configuration with diagonal v0v3
-  Face_handle nn;
-  f0->set_vertex( i0, v3) ;  // f0 = v0v1v3
-  f1->set_vertex( i1, v3) ;  // f1 = v1v2v3
-  f3->set_vertex( i3, v0) ;  // f3 = v3v4v0
-  f4->set_vertex( i4, v0) ;  // f4 = v4v5v0
-  nn = f2->neighbor( i2 );
-  this->tds().set_adjacency(f1, ccw(i1) , nn , nn->index(f2)  );
-  nn = f5->neighbor( i5 );
-  this->tds().set_adjacency(f4, ccw(i4) , nn , nn->index(f5) );
-  this->tds().set_adjacency(f0, cw(i0) , f3, cw(i3) );
-  this->tds().delete_face(f2);
-  this->tds().delete_face(f5);
-}
-
-template < class Gt, class Tds >
-inline void
-Delaunay_triangulation_2<Gt,Tds>::remove_degree6_diamond
-(
- Vertex_handle &,
- Face_handle &  f0, Face_handle &  f1, Face_handle &  f2,
- Face_handle &  f3, Face_handle &  f4, Face_handle &  f5,
- Vertex_handle &v0, Vertex_handle &, Vertex_handle &v2,
- Vertex_handle &, Vertex_handle &v4, Vertex_handle &,
- int i0, int i1, int i2, int i3, int i4, int i5 )
-{ // removing a degree 6 vertex, with chords v0v2 v2v4 v4v0
-  Face_handle nn;
-  f0->set_vertex( i0, v2) ;  // f0 = v0v1v2
-  f2->set_vertex( i2, v4) ;  // f2 = v2v3v4
-  f4->set_vertex( i4, v0) ;  // f4 = v4v5v0
-  f1->set_vertex( i1, v4) ; 
-  f1->set_vertex( ccw(i1), v0) ;  // f1 = v0v2v4
-  nn = f1->neighbor( i1 );
-  this->tds().set_adjacency(f0, ccw(i0) , nn , nn->index(f1) );
-  nn = f3->neighbor( i3 );
-  this->tds().set_adjacency(f2, ccw(i2) , nn , nn->index(f3) );
-  nn = f5->neighbor( i5 );
-  this->tds().set_adjacency(f4, ccw(i4) , nn , nn->index(f5) );
-  this->tds().set_adjacency(f0, cw(i0) , f1 , i1  );
-  this->tds().set_adjacency(f4, cw(i4) , f1 , cw(i1) );
-
-  this->tds().delete_face(f3);
-  this->tds().delete_face(f5);
-}
-
-
-template < class Gt, class Tds >
-void
-Delaunay_triangulation_2<Gt,Tds>::
-remove_degree7(Vertex_handle v,std::vector<Face_handle> &f,
-		      std::vector<Vertex_handle> &w, std::vector<int> &i)
-{ 
-  // removing a degree 7 vertex
-  // only w[0] can be infinite
-
-  if (incircle(2,0,1,3,f,w,i)) { // sweeping from above
-    if (incircle(2,3,4,0,f,w,i)) {
-      if (incircle(5,3,4,6,f,w,i)) {
-	if (incircle(5,3,4,2,f,w,i)) {
-	  if (incircle(6,2,3,5,f,w,i)) {
-	    if (incircle(6,0,1,2,f,w,i)) {
-	      remove_degree7_leftfan(v,  6  ,f,w,i);
-	    }else{
-	      remove_degree7_zigzag(v,  6  ,f,w,i);
-	    }}else{
-	    if (incircle(5,0,1,2,f,w,i)) {
-	      if (incircle(6,1,2,5,f,w,i)) {
-		remove_degree7_zigzag(v, 2   ,f,w,i);
-	      }else{
-		if (incircle(6,0,1,5,f,w,i)) {
-		  remove_degree7_rightfan(v, 5   ,f,w,i);
-		}else{
-		  remove_degree7_star(v,  5  ,f,w,i);
-		}}}else{
-	      if (incircle(2,5,6,0,f,w,i)) {
-		if (incircle(6,0,1,2,f,w,i)) {
-		  remove_degree7_zigzag(v,  2  ,f,w,i);
-		}else{
-		  remove_degree7_rightfan(v,  2  ,f,w,i);
-		}}else{
-		remove_degree7_rightdelta(v,  5  ,f,w,i);
-	      }}}}else{
-	  if (incircle(4,0,1,2,f,w,i)) {
-	    if (incircle(5,1,2,4,f,w,i)) {
-	      if (incircle(6,1,2,5,f,w,i)) {
-		remove_degree7_leftfan(v,  2  ,f,w,i);
-	      }else{
-		if (incircle(6,0,1,5,f,w,i)) {
-		  remove_degree7_zigzag(v,  5  ,f,w,i);
-		}else{
-		  remove_degree7_leftfan(v,  5  ,f,w,i);
-		}}}else{
-	      if (incircle(5,0,1,4,f,w,i)) {
-		if (incircle(6,0,1,5,f,w,i)) {
-		  remove_degree7_rightfan(v,  1  ,f,w,i);
-		}else{
-		  remove_degree7_zigzag(v,  1  ,f,w,i);
-		}}else{
-		remove_degree7_rightfan(v,  4  ,f,w,i);
-	      }}}else{
-	    if (incircle(2,4,5,0,f,w,i)) {
-	      if (incircle(5,0,1,2,f,w,i)) {
-		if (incircle(6,1,2,5,f,w,i)) {
-		  remove_degree7_leftfan(v,  2  ,f,w,i);
-		}else{
-		  if (incircle(6,0,1,5,f,w,i)) {
-		    remove_degree7_zigzag(v,  5  ,f,w,i);
-		  }else{
-		    remove_degree7_leftfan(v,  5  ,f,w,i);
-		  }}}else{
-		if (incircle(2,5,6,0,f,w,i)) {
-		  if (incircle(6,0,1,2,f,w,i)) {
-		    remove_degree7_leftfan(v,  2  ,f,w,i);
-		  }else{
-		    remove_degree7_star(v,  2  ,f,w,i);
-		  }}else{
-		  remove_degree7_leftdelta(v,  2  ,f,w,i);
-		}}}else{
-	      remove_degree7_rightdelta(v,  0  ,f,w,i);
-	    }}}}else{
-	if (incircle(6,3,4,2,f,w,i)) {
-	  if (incircle(6,0,1,2,f,w,i)) {
-	    remove_degree7_star(v,  6  ,f,w,i);
-	  }else{
-	    remove_degree7_rightfan(v,  6  ,f,w,i);
-	  }}else{
-	  if (incircle(4,0,1,2,f,w,i)) {
-	    if (incircle(2,4,5,6,f,w,i)) {
-	      if (incircle(5,1,2,4,f,w,i)) {
-		if (incircle(6,1,2,5,f,w,i)) {
-		  remove_degree7_leftfan(v,  2  ,f,w,i);
-		}else{
-		  if (incircle(6,0,1,5,f,w,i)) {
-		    remove_degree7_zigzag(v,  5  ,f,w,i);
-		  }else{
-		    remove_degree7_leftfan(v,  5  ,f,w,i);
-		  }}}else{
-		if (incircle(5,0,1,4,f,w,i)) {
-		  if (incircle(6,0,1,5,f,w,i)) {
-		    remove_degree7_rightfan(v,  1  ,f,w,i);
-		  }else{
-		    remove_degree7_zigzag(v,  1  ,f,w,i);
-		  }} else{
-		  remove_degree7_rightfan(v,  4  ,f,w,i);
-		}}} else {
-	      if (incircle(6,1,2,4,f,w,i)) {
-		remove_degree7_leftdelta(v,  6  ,f,w,i);
-	      }else{
-		if (incircle(1,4,5,6,f,w,i)) {
-		  if (incircle(1,4,5,0,f,w,i)) {
-		    if (incircle(6,0,1,5,f,w,i)) {
-		      remove_degree7_rightfan(v,  1  ,f,w,i);
-		    }else{
-		      remove_degree7_zigzag(v,  1  ,f,w,i);
-		    }}else{
-		    remove_degree7_rightfan(v,  4  ,f,w,i);
-		  }} else {
-		  if (incircle(6,0,1,4,f,w,i)) {
-		    remove_degree7_rightdelta(v,  4  ,f,w,i);
-		  }else{
-		    if (incircle(6,4,5,0,f,w,i)) {
-		      remove_degree7_star(v,  4  ,f,w,i);
-		    }else{
-		      remove_degree7_rightfan(v,  4  ,f,w,i);
-		    }}}}}}else{
-	    if (incircle(2,4,5,6,f,w,i)) {
-	      if (incircle(2,4,5,0,f,w,i)) {
-		if (incircle(5,0,1,2,f,w,i)) {
-		  if (incircle(6,1,2,5,f,w,i)) {
-		    remove_degree7_leftfan(v,  2  ,f,w,i);
-		  }else{
-		    if (incircle(6,0,1,5,f,w,i)) {
-		      remove_degree7_zigzag(v,  5  ,f,w,i);
-		    }else{
-		      remove_degree7_leftfan(v,  5  ,f,w,i);
-		    }}}else{
-		  if (incircle(2,5,6,0,f,w,i)) {
-		    if (incircle(6,0,1,2,f,w,i)) {
-		      remove_degree7_leftfan(v,  2  ,f,w,i);
-		    }else{
-		      remove_degree7_star(v,  2  ,f,w,i);
-		    }}else{
-		    remove_degree7_leftdelta(v,  2  ,f,w,i);
-		  }}}else{
-		remove_degree7_rightdelta(v,  0  ,f,w,i);
-	      }}else{
-	      if (incircle(2,6,0,4,f,w,i)) {
-		if (incircle(6,0,1,2,f,w,i)) {
-		  remove_degree7_leftdelta(v,  6  ,f,w,i);
-		}else{
-		  remove_degree7_rightdelta(v,  2  ,f,w,i);
-		}}else{
-		if (incircle(6,4,5,0,f,w,i)) {
-		  remove_degree7_leftdelta(v,  4  ,f,w,i);
-		}else{
-		  remove_degree7_rightdelta(v,  0  ,f,w,i);
-		}}}}}}} else{
-      if (incircle(5,3,4,6,f,w,i)) {
-	if (incircle(5,3,4,0,f,w,i)) {
-	  if (incircle(5,2,3,0,f,w,i)) {
-	    if (incircle(6,2,3,5,f,w,i)) {
-	      if (incircle(6,0,1,2,f,w,i)) {
-		remove_degree7_leftfan(v,  6  ,f,w,i);
-	      }else{
-		remove_degree7_zigzag(v,  6  ,f,w,i);
-	      }}else
-	      if (incircle(5,0,1,2,f,w,i)) {
-	  	if (incircle(6,1,2,5,f,w,i)) {
-		  remove_degree7_zigzag(v,  2  ,f,w,i);
-		}else{
-		  if (incircle(6,0,1,5,f,w,i)) {
-		    remove_degree7_rightfan(v,  5  ,f,w,i);
-		  }else{
-		    remove_degree7_star(v,  5  ,f,w,i);
-		  }}}else{
-		if (incircle(2,5,6,0,f,w,i)) {
-		  if (incircle(6,0,1,2,f,w,i)) {
-		    remove_degree7_zigzag(v,  2  ,f,w,i);
-		  }else{
-		    remove_degree7_rightfan(v,  2  ,f,w,i);
-		  }}else{
-		  remove_degree7_rightdelta(v,  5  ,f,w,i);
-		}}}else{
-	    if (incircle(3,5,6,0,f,w,i)) {
-	      if (incircle(6,2,3,0,f,w,i)) {
-		if (incircle(6,0,1,2,f,w,i)) {
-		  remove_degree7_leftfan(v,  6  ,f,w,i);
-		}else{
-		  remove_degree7_zigzag(v,  6  ,f,w,i);
-		}}else{
-		remove_degree7_leftfan(v,  3  ,f,w,i);
-	      }}else{
-	      remove_degree7_leftdelta(v,  0  ,f,w,i);
-	    }}}else{
-	  remove_degree7_star(v,  0  ,f,w,i);
-	}}else{
-	if (incircle(6,3,4,0,f,w,i)) {
-	  if (incircle(6,2,3,0,f,w,i)) {
-	    if (incircle(6,0,1,2,f,w,i)) {
-	      remove_degree7_star(v,  6  ,f,w,i);
-	    }else{
-	      remove_degree7_rightfan(v,  6  ,f,w,i);
-	    }}else{
-	    remove_degree7_zigzag(v,  3  ,f,w,i);
-	  }}else{
-	  if (incircle(6,4,5,0,f,w,i)) {
-	    remove_degree7_leftfan(v,  0  ,f,w,i);
-	  }else{
-	    remove_degree7_star(v,  0  ,f,w,i);
-	  }}}}}else{  //sweeping from below
-    if (incircle(1,6,0,3,f,w,i)) {
-      if (incircle(5,6,0,4,f,w,i)) {
-	if (incircle(5,6,0,1,f,w,i)) {
-	  if (incircle(4,0,1,5,f,w,i)) {
-	    if (incircle(4,2,3,1,f,w,i)) {
-	      remove_degree7_rightfan(v,  4  ,f,w,i);
-	    }else{
-	      remove_degree7_zigzag(v,  4  ,f,w,i);
-	    }}else{
-	    if (incircle(5,2,3,1,f,w,i)) {
-	      if (incircle(4,1,2,5,f,w,i)) {
-		remove_degree7_zigzag(v, 1   ,f,w,i);
-	      }else{
-		if (incircle(4,2,3,5,f,w,i)) {
-		  remove_degree7_leftfan(v, 5   ,f,w,i);
-		}else{
-		  remove_degree7_star(v,  5  ,f,w,i);
-		}}}else{
-	      if (incircle(1,4,5,3,f,w,i)) {
-		if (incircle(4,2,3,1,f,w,i)) {
-		  remove_degree7_zigzag(v,  1  ,f,w,i);
-		}else{
-		  remove_degree7_leftfan(v,  1  ,f,w,i);
-		}}else{
-		remove_degree7_leftdelta(v,  5  ,f,w,i);
-	      }}}}else{
-	  if (incircle(6,2,3,1,f,w,i)) {
-	    if (incircle(5,1,2,6,f,w,i)) {
-	      if (incircle(4,1,2,5,f,w,i)) {
-		remove_degree7_rightfan(v,  1  ,f,w,i);
-	      }else{
-		if (incircle(4,2,3,5,f,w,i)) {
-		  remove_degree7_zigzag(v,  5  ,f,w,i);
-		}else{
-		  remove_degree7_rightfan(v,  5  ,f,w,i);
-		}}}else{
-	      if (incircle(5,2,3,6,f,w,i)) {
-		if (incircle(4,2,3,5,f,w,i)) {
-		  remove_degree7_leftfan(v,  2  ,f,w,i);
-		}else{
-		  remove_degree7_zigzag(v,  2  ,f,w,i);
-		}}else{
-		remove_degree7_leftfan(v,  6  ,f,w,i);
-	      }}}else{
-	    if (incircle(1,5,6,3,f,w,i)) {
-	      if (incircle(5,2,3,1,f,w,i)) {
-		if (incircle(4,1,2,5,f,w,i)) {
-		  remove_degree7_rightfan(v,  1  ,f,w,i);
-		}else{
-		  if (incircle(4,2,3,5,f,w,i)) {
-		    remove_degree7_zigzag(v,  5  ,f,w,i);
-		  }else{
-		    remove_degree7_rightfan(v,  5  ,f,w,i);
-		  }}}else{
-		if (incircle(1,4,5,3,f,w,i)) {
-		  if (incircle(4,2,3,1,f,w,i)) {
-		    remove_degree7_rightfan(v,  1  ,f,w,i);
-		  }else{
-		    remove_degree7_star(v,  1  ,f,w,i);
-		  }}else{
-		  remove_degree7_rightdelta(v,  1  ,f,w,i);
-		}}}else{
-	      remove_degree7_leftdelta(v,  3  ,f,w,i);
-	    }}}}else{
-	if (incircle(4,6,0,1,f,w,i)) {
-	  if (incircle(4,2,3,1,f,w,i)) {
-	    remove_degree7_star(v,  4  ,f,w,i);
-	  }else{
-	    remove_degree7_leftfan(v,  4  ,f,w,i);
-	  }}else{
-	  if (incircle(6,2,3,1,f,w,i)) {
-	    if (incircle(1,5,6,4,f,w,i)) {
-	      if (incircle(5,1,2,6,f,w,i)) {
-		if (incircle(4,1,2,5,f,w,i)) {
-		  remove_degree7_rightfan(v,  1  ,f,w,i);
-		}else{
-		  if (incircle(4,2,3,5,f,w,i)) {
-		    remove_degree7_zigzag(v,  5  ,f,w,i);
-		  }else{
-		    remove_degree7_rightfan(v,  5  ,f,w,i);
-		  }}}else{
-		if (incircle(5,2,3,6,f,w,i)) {
-		  if (incircle(4,2,3,5,f,w,i)) {
-		    remove_degree7_leftfan(v,  2  ,f,w,i);
-		  }else{
-		    remove_degree7_zigzag(v,  2  ,f,w,i);
-		  }} else{
-		  remove_degree7_leftfan(v,  6  ,f,w,i);
-		}}} else {
-	      if (incircle(4,1,2,6,f,w,i)) {
-		remove_degree7_rightdelta(v,  4  ,f,w,i);
-	      }else{
-		if (incircle(2,5,6,4,f,w,i)) {
-		  if (incircle(2,5,6,3,f,w,i)) {
-		    if (incircle(4,2,3,5,f,w,i)) {
-		      remove_degree7_leftfan(v,  2  ,f,w,i);
-		    }else{
-		      remove_degree7_zigzag(v,  2  ,f,w,i);
-		    }}else{
-		    remove_degree7_leftfan(v,  6  ,f,w,i);
-		  }} else {
-		  if (incircle(4,2,3,6,f,w,i)) {
-		    remove_degree7_leftdelta(v,  6  ,f,w,i);
-		  }else{
-		    if (incircle(4,5,6,3,f,w,i)) {
-		      remove_degree7_star(v,  6  ,f,w,i);
-		    }else{
-		      remove_degree7_leftfan(v,  6  ,f,w,i);
-		    }}}}}}else{
-	    if (incircle(1,5,6,4,f,w,i)) {
-	      if (incircle(1,5,6,3,f,w,i)) {
-		if (incircle(5,2,3,1,f,w,i)) {
-		  if (incircle(4,1,2,5,f,w,i)) {
-		    remove_degree7_rightfan(v,  1  ,f,w,i);
-		  }else{
-		    if (incircle(4,2,3,5,f,w,i)) {
-		      remove_degree7_zigzag(v,  5  ,f,w,i);
-		    }else{
-		      remove_degree7_rightfan(v,  5  ,f,w,i);
-		    }}}else{
-		  if (incircle(1,4,5,3,f,w,i)) {
-		    if (incircle(4,2,3,1,f,w,i)) {
-		      remove_degree7_rightfan(v,  1  ,f,w,i);
-		    }else{
-		      remove_degree7_star(v,  1  ,f,w,i);
-		    }}else{
-		    remove_degree7_rightdelta(v,  1  ,f,w,i);
-		  }}}else{
-		remove_degree7_leftdelta(v,  3  ,f,w,i);
-	      }}else{
-	      if (incircle(1,3,4,6,f,w,i)) {
-		if (incircle(4,2,3,1,f,w,i)) {
-		  remove_degree7_rightdelta(v,  4  ,f,w,i);
-		}else{
-		  remove_degree7_leftdelta(v,  1  ,f,w,i);
-		}}else{
-		if (incircle(4,5,6,3,f,w,i)) {
-		  remove_degree7_rightdelta(v,  6  ,f,w,i);
-		}else{
-		  remove_degree7_leftdelta(v,  3  ,f,w,i);
-		}}}}}}} else{
-      if (incircle(5,6,0,4,f,w,i)) {
-	if (incircle(5,6,0,3,f,w,i)) {
-	  if (incircle(5,0,1,3,f,w,i)) {
-	    if (incircle(4,0,1,5,f,w,i)) {
-	      if (incircle(4,2,3,1,f,w,i)) {
-		remove_degree7_rightfan(v,  4  ,f,w,i);
-	      }else{
-		remove_degree7_zigzag(v,  4  ,f,w,i);
-	      }}else
-	      if (incircle(5,2,3,1,f,w,i)) {
-	  	if (incircle(4,1,2,5,f,w,i)) {
-		  remove_degree7_zigzag(v,  1  ,f,w,i);
-		}else{
-		  if (incircle(4,2,3,5,f,w,i)) {
-		    remove_degree7_leftfan(v,  5  ,f,w,i);
-		  }else{
-		    remove_degree7_star(v,  5  ,f,w,i);
-		  }}}else{
-		if (incircle(1,4,5,3,f,w,i)) {
-		  if (incircle(4,2,3,1,f,w,i)) {
-		    remove_degree7_zigzag(v,  1  ,f,w,i);
-		  }else{
-		    remove_degree7_leftfan(v,  1  ,f,w,i);
-		  }}else{
-		  remove_degree7_leftdelta(v,  5  ,f,w,i);
-		}}}else{
-	    if (! incircle(3,4,5,0,f,w,i)) {
-	      if (incircle(4,0,1,3,f,w,i)) {
-		if (incircle(4,2,3,1,f,w,i)) {
-		  remove_degree7_rightfan(v,  4  ,f,w,i);
-		}else{
-		  remove_degree7_zigzag(v,  4  ,f,w,i);
-		}}else{
-		remove_degree7_rightfan(v,  0  ,f,w,i);
-	      }}else{
-	      remove_degree7_rightdelta(v,  3  ,f,w,i);
-	    }}}else{
-	  remove_degree7_star(v,  3  ,f,w,i);
-	}}else{
-	if (incircle(4,6,0,3,f,w,i)) {
-	  if (incircle(4,0,1,3,f,w,i)) {
-	    if (incircle(4,2,3,1,f,w,i)) {
-	      remove_degree7_star(v,  4  ,f,w,i);
-	    }else{
-	      remove_degree7_leftfan(v,  4  ,f,w,i);
-	    }}else{
-	    remove_degree7_zigzag(v,  0  ,f,w,i);
-	  }}else{
-	  if (incircle(4,5,6,3,f,w,i)) {
-	    remove_degree7_rightfan(v,  3  ,f,w,i);
-	  }else{
-	    remove_degree7_star(v,  3  ,f,w,i);    
-	  }}}}}
-}
-
-
-
-template < class Gt, class Tds >
-inline void
-Delaunay_triangulation_2<Gt,Tds>::
-rotate7(int j,  std::vector<Vertex_handle> &w, 
-	       std::vector<Face_handle> &f, std::vector<int> &i)
-{
-  if (j==0) return;
-  Face_handle ff=f[0];
-  int ii=i[0],k=0,kk=(6*j)%7;
-  Vertex_handle ww=w[0];
-  for (int jj=0; k!=kk; jj=k) { // 7 is prime
-    k=(jj+j)%7;
-    w[jj]=w[k]; f[jj]=f[k]; i[jj]=i[k];
-  }
-  w[kk]=ww;f[kk]=ff;i[kk]=ii;
-}
-
-template < class Gt, class Tds >
-inline void
-Delaunay_triangulation_2<Gt,Tds>::
-remove_degree7_star   (Vertex_handle &, int j,
-std::vector<Face_handle> &f, std::vector<Vertex_handle> &w, std::vector<int> &i)
-{ // removing a degree 7 vertex, staring from w[j]
-
-  rotate7(j,w,f,i);
-
-  Face_handle nn;
-  f[1]->set_vertex( i[1], w[0]) ;  // f1 = w1w2w0
-  f[2]->set_vertex( i[2], w[0]) ;  // f2 = w2w3w0
-  f[3]->set_vertex( i[3], w[0]) ;  // f3 = w3w4w0
-  f[4]->set_vertex( i[4], w[0]) ;  // f4 = w4w5w0
-  f[5]->set_vertex( i[5], w[0]) ;  // f5 = w5w6w0
-
-  nn = f[0]->neighbor( i[0] );
-  this->tds().set_adjacency(f[1], cw(i[1]) , nn , nn->index(f[0])  );
-  nn = f[6]->neighbor( i[6] );
-  this->tds().set_adjacency(f[5], ccw(i[5]) , nn , nn->index(f[6]) );
-  this->tds().delete_face(f[0]);
-  this->tds().delete_face(f[6]);
-}
-template < class Gt, class Tds >
-inline void
-Delaunay_triangulation_2<Gt,Tds>::
-remove_degree7_zigzag (Vertex_handle &, int j,
- std::vector<Face_handle> &f,std::vector<Vertex_handle> &w, std::vector<int> &i)
-{ // removing a degree 7 vertex, zigzag, w[j] = middle point
-
- rotate7(j,w,f,i);
-
-  Face_handle nn;
-  f[1]->set_vertex(    i[1] , w[3]) ;  // f1 = w1w2w3
-  f[2]->set_vertex(ccw(i[2]), w[1]) ;  
-  f[2]->set_vertex(    i[2] , w[0]) ;  // f2 = w1w3w0
-  f[3]->set_vertex(    i[3] , w[0]) ;  // f3 = w3w4w0
-  f[4]->set_vertex( cw(i[4]), w[6]) ;  
-  f[4]->set_vertex(    i[4] , w[0]) ;  // f4 = w4w6w0
-  f[5]->set_vertex(    i[5] , w[4]) ;  // f5 = w5w6w4
-
-  nn = f[2]->neighbor( i[2] );
-  this->tds().set_adjacency(f[1], ccw(i[1]) , nn, nn->index(f[2]) );
-  nn = f[0]->neighbor( i[0] );
-  this->tds().set_adjacency(f[2], cw(i[2]) , nn , nn->index(f[0]) );
-  nn = f[6]->neighbor( i[6] );
-  this->tds().set_adjacency(f[4], ccw(i[4]) , nn , nn->index(f[6])  );
-  nn = f[4]->neighbor( i[4] );
-  this->tds().set_adjacency(f[5], cw(i[5]) , nn , nn->index(f[4])  );
-  this->tds().set_adjacency(f[1], cw(i[1]) , f[2] , i[2]   );
-  this->tds().set_adjacency(f[4], i[4]  , f[5] , ccw(i[5])  );
-
-  this->tds().delete_face(f[0]);
-  this->tds().delete_face(f[6]);
-}
-template < class Gt, class Tds >
-inline void
-Delaunay_triangulation_2<Gt,Tds>::
-remove_degree7_leftdelta(Vertex_handle &, int j,
- std::vector<Face_handle> &f,std::vector<Vertex_handle> &w, std::vector<int> &i)
-{ // removing a degree 7 vertex, left delta from w[j]
- rotate7(j,w,f,i);
-
-  Face_handle nn;
-  f[1]->set_vertex(    i[1] , w[0]) ;  // f1 = w1w2w0
-  f[2]->set_vertex(    i[2] , w[0]) ;  // f2 = w2w3w0
-  f[3]->set_vertex( cw(i[3]), w[5]) ;  
-  f[3]->set_vertex(    i[3] , w[0]) ;  // f3 = w3w5w0
-  f[4]->set_vertex(    i[4] , w[3]) ;  // f4 = w4w5w3
-  f[5]->set_vertex(    i[5] , w[0]) ;  // f5 = w5w6w0
-
-  nn = f[0]->neighbor( i[0] );
-  this->tds().set_adjacency(f[1], cw(i[1]) , nn , nn->index(f[0])  );
-  nn = f[3]->neighbor( i[3] );
-  this->tds().set_adjacency(f[4], cw(i[4]) , nn , nn->index(f[3]) );
-  nn = f[6]->neighbor( i[6] );
-  this->tds().set_adjacency(f[5], ccw(i[5]) , nn , nn->index(f[6])  );
-  this->tds().set_adjacency(f[3], i[3]  , f[4] , ccw(i[4])  );
-  this->tds().set_adjacency(f[3], ccw(i[3]) , f[5] ,  cw(i[5]) );
-
-  this->tds().delete_face(f[0]);
-  this->tds().delete_face(f[6]);
-}
-template < class Gt, class Tds >
-inline void
-Delaunay_triangulation_2<Gt,Tds>::
-remove_degree7_rightdelta(Vertex_handle &, int j,
- std::vector<Face_handle> &f,std::vector<Vertex_handle> &w, std::vector<int> &i)
-{ // removing a degree 7 vertex, right delta from w[j]
-  rotate7(j,w,f,i);
-
-  Face_handle nn;
-  f[1]->set_vertex(    i[1] , w[0]) ;  // f1 = w1w2w0
-  f[2]->set_vertex(    i[2] , w[4]) ;  // f2 = w2w3w4
-  f[3]->set_vertex(ccw(i[3]), w[2]) ;  
-  f[3]->set_vertex(    i[3] , w[0]) ;  // f3 = w2w4w0
-  f[4]->set_vertex(    i[4] , w[0]) ;  // f4 = w4w5w0
-  f[5]->set_vertex(    i[5] , w[0]) ;  // f5 = w5w6w0
-
-  nn = f[0]->neighbor( i[0] );
-  this->tds().set_adjacency(f[1], cw(i[1]) , nn , nn->index(f[0]) );
-  nn = f[3]->neighbor( i[3] );
-  this->tds().set_adjacency(f[2], ccw(i[2]) , nn, nn->index(f[3]) );
-  nn = f[6]->neighbor( i[6] );
-  this->tds().set_adjacency(f[5], ccw(i[5]) , nn , nn->index(f[6]) );
-  this->tds().set_adjacency(f[1], ccw(i[1]) , f[3], cw(i[3])  );
-  this->tds().set_adjacency(f[3], i[3]  , f[2], cw(i[2]) );
-
-  this->tds().delete_face(f[0]);
-  this->tds().delete_face(f[6]);
-}
-template < class Gt, class Tds >
-inline void
-Delaunay_triangulation_2<Gt,Tds>::
-remove_degree7_leftfan(Vertex_handle &, int j,
- std::vector<Face_handle> &f,std::vector<Vertex_handle> &w, std::vector<int> &i)
-{ // removing a degree 7 vertex, left fan from w[j]
-  rotate7(j,w,f,i);
-
-  Face_handle nn;
-  f[1]->set_vertex(    i[1] , w[0]) ;  // f1 = w1w2w0
-  f[2]->set_vertex(    i[2] , w[0]) ;  // f2 = w2w3w0
-  f[3]->set_vertex(    i[3] , w[0]) ;  // f3 = w3w4w0
-  f[4]->set_vertex(    i[4] , w[6]) ;  // f4 = w4w5w6
-  f[6]->set_vertex(    i[6] , w[4]) ;  // f6 = w6w0w4
-
-  nn = f[0]->neighbor( i[0] );
-  this->tds().set_adjacency(f[1], cw(i[1]) , nn, nn->index(f[0]) );
-  nn = f[5]->neighbor( i[5] );
-  this->tds().set_adjacency(f[4], ccw(i[4]) , nn, nn->index(f[5]) );
-  this->tds().set_adjacency(f[3], ccw(i[3]) , f[6], ccw(i[6]) );
-  this->tds().set_adjacency(f[6], cw(i[6]) , f[4], cw(i[4]) );
-
-  this->tds().delete_face(f[0]);
-  this->tds().delete_face(f[5]);
-}
-template < class Gt, class Tds >
-inline void
-Delaunay_triangulation_2<Gt,Tds>::
-remove_degree7_rightfan(Vertex_handle &, int j,
- std::vector<Face_handle> &f,std::vector<Vertex_handle> &w, std::vector<int> &i)
-{ // removing a degree 7 vertex, right fan from w[j]
-
-  rotate7(j,w,f,i);
-
-  Face_handle nn;
-  f[0]->set_vertex(    i[0] , w[3]) ;  // f0 = w0w1w3
-  f[2]->set_vertex(    i[2] , w[1]) ;  // f2 = w2w3w1
-  f[3]->set_vertex(    i[3] , w[0]) ;  // f3 = w3w4w0
-  f[4]->set_vertex(    i[4] , w[0]) ;  // f4 = w4w5w0
-  f[5]->set_vertex(    i[5] , w[0]) ;  // f5 = w5w6w0
-
-  nn = f[1]->neighbor( i[1] );
-  this->tds().set_adjacency(f[2], cw(i[2]) , nn, nn->index(f[1]) );
-  nn = f[6]->neighbor( i[6] );
-  this->tds().set_adjacency(f[5], ccw(i[5]) , nn, nn->index(f[6]) );
-  this->tds().set_adjacency(f[2], ccw(i[2]) , f[0], ccw(i[0])  );
-  this->tds().set_adjacency(f[0], cw(i[0]) , f[3] , cw(i[3]) );
-
-  this->tds().delete_face(f[1]);
-  this->tds().delete_face(f[6]);
-}
-
-
-
-
-///////////////////////////////////////////////////////////////
-//  DISPLACEMENT
-
-template <class Gt, class Tds >
-typename Delaunay_triangulation_2<Gt,Tds>::Vertex_handle
-Delaunay_triangulation_2<Gt,Tds>::
-move_if_no_collision(Vertex_handle v, const Point &p) {
-  CGAL_triangulation_precondition(!this->is_infinite(v));
-  if(v->point() == p) return v;
-  const int dim = this->dimension();
-
-  if(dim == 2) {
-    Point ant = v->point();
-    v->set_point(p);
-		// This option optimizes only when most of the
-	  // displacements would not break the orientation
-	  // of the faces.. we will consider this as an a priori,
-	  // because otherwise it is pointless to just do
-	  // not rebuild from scratch.
-    if(this->well_oriented(v)) {
-      restore_edges(v);
-      return v;
-    }
-    v->set_point(ant);
-  }
-
-  Locate_type lt;
-  int li;
-  Vertex_handle inserted;
-  Face_handle loc = this->locate(p, lt, li, v->face());
-
-  if(lt == Triangulation_2<Gt,Tds>::VERTEX) return loc->vertex(li);
-
-  if(dim == 0) {
-    v->point() = p;
-    return v;
-  }
-
-  size_type n_vertices = this->tds().number_of_vertices();
-
-  if((lt == Triangulation::OUTSIDE_AFFINE_HULL) && 
-     (dim == 1) && (n_vertices == 3)) {
-    v->point() = p;
-    return v;
-  }
-
-  if((lt != Triangulation::OUTSIDE_AFFINE_HULL) && (dim == 1)) {
-    if(loc->has_vertex(v)) {
-      v->point() = p;
-    } else {
-      inserted = insert(p, lt, loc, li);
-      Face_handle f = v->face();
-      int i = f->index(v);
-      if (i==0) {f = f->neighbor(1);}
-      CGAL_triangulation_assertion(f->index(v) == 1);
-      Face_handle g= f->neighbor(0);
-      f->set_vertex(1, g->vertex(1));
-      f->set_neighbor(0,g->neighbor(0));
-      g->neighbor(0)->set_neighbor(1,f);
-      g->vertex(1)->set_face(f);
-      this->delete_face(g);
-      Face_handle f_ins = inserted->face();
-      i = f_ins->index(inserted);
-      if (i==0) {f_ins = f_ins->neighbor(1);}
-      CGAL_triangulation_assertion(f_ins->index(inserted) == 1);
-      Face_handle g_ins = f_ins->neighbor(0);
-      f_ins->set_vertex(1, v);
-      g_ins->set_vertex(0, v);
-    	v->set_point(p);
-      v->set_face(inserted->face());
-      this->delete_vertex(inserted);
-    }
-    return v;
-  }
-
-  if((lt != Triangulation::OUTSIDE_AFFINE_HULL) && this->test_dim_down(v)) {
-    // verify if p and two static vertices are collinear in this case
-    int iinf = 0;
-    Face_circulator finf = this->incident_faces(this->infinite_vertex()), 
-      fdone(finf);
-    do { 
-      if(!finf->has_vertex(v))
-      {
-        iinf = ~(finf->index(this->infinite_vertex()));
-        break;
-      }
-    } while(++finf != fdone);
-    if(this->orientation(finf->vertex(iinf&1)->point(),
-                         finf->vertex(iinf&2)->point(),
-                         p) == COLLINEAR)
-    {
-      v->point() = p;
-      this->tds().dim_down(loc, loc->index(v));
-      return v;
-    }
-  }
-
-  inserted = insert(p, lt, loc, li);
-
-  {
-    int d;
-    CGAL_STATIC_THREAD_LOCAL_VARIABLE(int, maxd,30);
-    CGAL_STATIC_THREAD_LOCAL_VARIABLE(std::vector<Face_handle> , f, maxd);
-    CGAL_STATIC_THREAD_LOCAL_VARIABLE(std::vector<int>, i, maxd);
-    CGAL_STATIC_THREAD_LOCAL_VARIABLE(std::vector<Vertex_handle>, w, maxd);
-
-    remove_degree_init(v,f,w,i,d,maxd);
-    remove_degree_triangulate(v,f,w,i,d);
-  }
-
-  // fixing pointer
-  Face_circulator fc = this->incident_faces(inserted), done(fc);
-  std::vector<Face_handle> faces_pt;
-  faces_pt.reserve(16);
-  do { faces_pt.push_back(fc); } while(++fc != done);
-  std::size_t ss = faces_pt.size();
-  for(std::size_t k=0; k<ss; k++)
-    {
-      Face_handle f = faces_pt[k];
-      int i = f->index(inserted);
-      f->set_vertex(i, v);
-    }
-  
-  v->set_point(p);
-  v->set_face(inserted->face());
-  
-  this->delete_vertex(inserted);
-
-  return v;
-}
-
-template <class Gt, class Tds >
-typename Delaunay_triangulation_2<Gt,Tds>::Vertex_handle
-Delaunay_triangulation_2<Gt,Tds>::
-move(Vertex_handle v, const Point &p) {
-  CGAL_triangulation_precondition(!this->is_infinite(v));
-  if(v->point() == p) return v;
-  Vertex_handle w = move_if_no_collision(v,p);
-  if(w != v) {
-    remove(v);
-    return w;
-  }
-  return v;
-}
-
-template <class Gt, class Tds >
-bool 
-Delaunay_triangulation_2<Gt,Tds>::
-is_delaunay_after_displacement(Vertex_handle v, const Point &p) const
-{
-  CGAL_triangulation_precondition(!this->is_infinite(v));		
-  CGAL_triangulation_precondition(this->dimension() == 2);	
-  CGAL_triangulation_precondition(!this->test_dim_down(v));	
-	if(v->point() == p) return true;
-  Point ant = v->point();
-  v->set_point(p);
-  if(!this->well_oriented(v))
-  {
-    v->set_point(ant);
-    return false;
-  }
-  std::list<Edge> edges;
-  Face_circulator fc = this->incident_faces(v), done(fc);
-  int degree = 0;
-  do {
-    if((++degree) > 3) break;
-  } while(++fc != done);
-  fc = this->incident_faces(v);
-  done = fc;
-  if(degree == 3) {
-    do {
-      int i = fc->index(v);
-      edges.push_back(Edge(fc, i));
-    } while(++fc != done);
-  } else {
-    do {
-      int i = fc->index(v);
-      edges.push_back(Edge(fc, i));
-      edges.push_back(Edge(fc, this->cw(i)));
-    } while(++fc != done);
-  }
-  while(!edges.empty()) {
-    const Edge &e = edges.front();
-    Face_handle f = e.first;
-    int i = e.second;
-    edges.pop_front();
-    if(this->is_infinite(f->vertex(i))) continue;
-    Vertex_handle vm = this->_tds.mirror_vertex(f, i);
-    if(this->is_infinite(vm)) continue;
-    if(this->side_of_oriented_circle(f, vm->point()) == ON_POSITIVE_SIDE) {
-      v->set_point(ant);
-      return false;
-    }
-  }
-  v->set_point(ant);
-  return true;
-}
-
-template <class Gt, class Tds >
-template <class OutputItFaces>
-typename Delaunay_triangulation_2<Gt,Tds>::Vertex_handle 
-Delaunay_triangulation_2<Gt,Tds>::
-move_if_no_collision_and_give_new_faces(Vertex_handle v, 
-                                        const Point &p,
-                                        OutputItFaces oif)
-{
-  CGAL_triangulation_precondition(!this->is_infinite(v));	
-  if(v->point() == p) return v;
-
-  const int dim = this->dimension();
-
-  if(dim == 2) {
-    Point ant = v->point();
-    v->set_point(p);
-    // This option optimizes only when most of the
-    // displacements would not break the orientation
-    // of the faces.. we will consider this as an a priori,
-    // because otherwise it is pointless to just do
-    // not rebuild from scratch.
-    if(well_oriented(v)) {
-      std::set<Face_handle> faces_set;
-      restore_edges(v, faces_set);
-      for(typename std::set<Face_handle>::iterator ib = faces_set.begin(),
-            iend = faces_set.end(); ib != iend; ib++) *oif++ = *ib;
-      return v;
-    }
-    v->set_point(ant);
-  }
-
-  Locate_type lt;
-  int li;
-  Vertex_handle inserted;
-  Face_handle loc = this->locate(p, lt, li, v->face());
-
-  if(lt == Triangulation::VERTEX) return loc->vertex(li);
-
-  if(dim == 0) {
-    v->point() = p;
-    return v;
-  }
-
-  size_type n_vertices = this->tds().number_of_vertices();
-
-  if((lt == Triangulation::OUTSIDE_AFFINE_HULL) && 
-     (dim == 1) && (n_vertices == 3)) {
-    v->point() = p;
-    for(All_faces_iterator afi = this-> all_faces_begin(); 
-        afi != this->all_faces_end(); 
-        afi++) *oif++ = afi;	
-    return v;
-  }
-
-  if((lt != Triangulation::OUTSIDE_AFFINE_HULL) && (dim == 1)) {
-    if(loc->has_vertex(v)) {
-      v->point() = p;
-    } else {
-      inserted = insert(p, lt, loc, li);
-      Face_handle f = v->face();
-      int i = f->index(v);
-      if (i==0) {f = f->neighbor(1);}
-      CGAL_triangulation_assertion(f->index(v) == 1);
-      Face_handle g= f->neighbor(0);
-      f->set_vertex(1, g->vertex(1));
-      f->set_neighbor(0,g->neighbor(0));
-      g->neighbor(0)->set_neighbor(1,f);
-      g->vertex(1)->set_face(f);
-      this->delete_face(g);
-      *oif++ = f;
-      Face_handle f_ins = inserted->face();
-      i = f_ins->index(inserted);
-      if (i==0) {f_ins = f_ins->neighbor(1);}
-      CGAL_triangulation_assertion(f_ins->index(inserted) == 1);
-      Face_handle g_ins = f_ins->neighbor(0);
-      f_ins->set_vertex(1, v);
-      g_ins->set_vertex(0, v);
-      v->set_face(inserted->face());
-    	v->set_point(p);
-      this->delete_vertex(inserted);
-    }
-    *oif++ = v->face();
-    if(v->face()->neighbor(0)->has_vertex(v)) 
-      *oif++ = v->face()->neighbor(0);
-    if(v->face()->neighbor(1)->has_vertex(v)) 
-      *oif++ = v->face()->neighbor(1);			
-    return v;
-  }
-
-  if((lt != Triangulation::OUTSIDE_AFFINE_HULL) && this->test_dim_down(v)) {
-    // verify if p and two static vertices are collinear in this case
-    int iinf;
-    Face_circulator finf = incident_faces(this->infinite_vertex()), 
-      fdone(finf);
-    do { 
-      if(!finf->has_vertex(v))
-      {
-        iinf = ~(finf->index(this->infinite_vertex()));
-        break;
-      }
-    } while(++finf != fdone);
-    if(this->orientation(finf->vertex(iinf&1)->point(),
-                         finf->vertex(iinf&2)->point(),
-                         p) == COLLINEAR)
-    {
-      v->point() = p;
-      this->tds().dim_down(loc, loc->index(v));
-      for(All_faces_iterator afi = this-> all_faces_begin(); 
-          afi != this->all_faces_end(); 
-          afi++) *oif++ = afi;
-      return v;
-    }
-  }
-
-  std::set<Face_handle> faces_set;
-  inserted = Delaunay_triangulation_2<Gt,Tds>::insert(p, lt, loc, li);
-  Face_circulator fc = this->incident_faces(inserted), done(fc);
-  do { faces_set.insert(fc); } while(++fc != done);
-
-
-  {
-    CGAL_STATIC_THREAD_LOCAL_VARIABLE(int, maxd,30);
-    CGAL_STATIC_THREAD_LOCAL_VARIABLE(std::vector<Face_handle> , f, maxd);
-    CGAL_STATIC_THREAD_LOCAL_VARIABLE(std::vector<int>, i, maxd);
-    CGAL_STATIC_THREAD_LOCAL_VARIABLE(std::vector<Vertex_handle>, w, maxd);
-
-    int d;
-    remove_degree_init(v,f,w,i,d,maxd);
-    remove_degree_triangulate(v,f,w,i,d);
-    this->delete_vertex(v);
-    Face_circulator fc(v[0]),done;
-    do *oif++ = fc++; while (fc!=done);    
-  }
-
-  fc = this->incident_faces(inserted), done(fc);
-  std::vector<Face_handle> faces_pt;
-  faces_pt.reserve(16);
-  do { faces_pt.push_back(fc); } while(++fc != done);
-  int ss = faces_pt.size();
-  for(int k=0; k<ss; k++)
-  {
-    Face_handle f = faces_pt[k];
-    int i = f->index(inserted);
-    f->set_vertex(i, v);
-  }
-  v->set_point(p);
-  v->set_face(inserted->face());
-  this->delete_vertex(inserted);
-
-  for(typename std::set<Face_handle>::const_iterator ib = faces_set.begin(),
-        iend = faces_set.end(); ib != iend; ib++) *oif++ = *ib;
-
-  return v;
-}
-
-} //namespace CGAL
-
-#endif // CGAL_DELAUNAY_TRIANGULATION_2_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Delaunay_triangulation_3.h b/3rdparty/CGAL-4.8/include/CGAL/Delaunay_triangulation_3.h
deleted file mode 100644
index 2630dbd..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Delaunay_triangulation_3.h
+++ /dev/null
@@ -1,2081 +0,0 @@
-// Copyright (c) 1999-2004   INRIA Sophia-Antipolis (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
-// 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(s)     : Monique Teillaud <Monique.Teillaud at sophia.inria.fr>
-//                 Sylvain Pion
-//                 Andreas Fabri <Andreas.Fabri at sophia.inria.fr>
-//                 Clement Jamin
-
-#ifndef CGAL_DELAUNAY_TRIANGULATION_3_H
-#define CGAL_DELAUNAY_TRIANGULATION_3_H
-
-#include <CGAL/basic.h>
-
-#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
-# define CGAL_PROFILE
-# include <CGAL/Profile_counter.h>
-#endif
-
-#include <utility>
-#include <vector>
-
-#include <CGAL/Triangulation_3.h>
-#include <CGAL/iterator.h>
-#include <CGAL/Location_policy.h>
-#ifdef CGAL_TRIANGULATION_3_PROFILING
-# include <CGAL/Mesh_3/Profiling_tools.h>
-#endif
-
-#ifndef CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
-#include <CGAL/Spatial_sort_traits_adapter_3.h>
-#include <CGAL/internal/info_check.h>
-
-#include <boost/tuple/tuple.hpp>
-#include <boost/iterator/zip_iterator.hpp>
-#include <boost/mpl/and.hpp>
-#endif //CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
-
-#ifdef CGAL_LINKED_WITH_TBB
-# include <CGAL/point_generators_3.h>
-# include <tbb/parallel_for.h>
-# include <tbb/enumerable_thread_specific.h>
-# include <tbb/concurrent_vector.h>
-#endif
-
-#ifdef CGAL_DELAUNAY_3_OLD_REMOVE
-#  error "The old remove() code has been removed.  Please report any issue you may have with the current one."
-#endif
-
-#ifdef CGAL_CONCURRENT_TRIANGULATION_3_ADD_TEMPORARY_POINTS_ON_FAR_SPHERE
-#include <CGAL/point_generators_3.h>
-#endif
-
-namespace CGAL {
-
-// Here is the declaration of a class template with three arguments, one
-// having a default value. There is no definition of that class template.
-template < class Gt,
-           class Tds_ = Default,
-           class Location_policy = Default,
-           class Lock_data_structure_ = Default >
-class Delaunay_triangulation_3;
-
-// There is a specialization Delaunay_triangulation_3<Gt, Tds, Fast_location>
-// defined in <CGAL/internal/Delaunay_triangulation_hierarchy_3.h>.
-
-// Here is the specialization Delaunay_triangulation_3<Gt, Tds>, with two
-// arguments, that is if Location_policy being the default value 'Default'.
-template < class Gt, class Tds_,
-           class Lock_data_structure_ >
-class Delaunay_triangulation_3<Gt, Tds_, Default, Lock_data_structure_>
-  : public Triangulation_3<Gt, Tds_, Lock_data_structure_>
-{
-  typedef Delaunay_triangulation_3<Gt, Tds_, Default,
-                                   Lock_data_structure_> Self;
-  typedef Triangulation_3<Gt,Tds_,Lock_data_structure_>  Tr_Base;
-
-public:
-
-  typedef typename Tr_Base::Triangulation_data_structure
-                                     Triangulation_data_structure;
-  typedef Gt                         Geom_traits;
-  typedef Compact_location           Location_policy;
-
-  typedef typename Tr_Base::Lock_data_structure Lock_data_structure;
-
-  typedef typename Gt::Point_3       Point;
-  typedef typename Gt::Segment_3     Segment;
-  typedef typename Gt::Triangle_3    Triangle;
-  typedef typename Gt::Tetrahedron_3 Tetrahedron;
-
-  // types for dual:
-  typedef typename Gt::Line_3        Line;
-  typedef typename Gt::Ray_3         Ray;
-  //typedef typename Gt::Plane_3       Plane;
-  typedef typename Gt::Object_3      Object;
-
-  typedef typename Tr_Base::Cell_handle   Cell_handle;
-  typedef typename Tr_Base::Vertex_handle Vertex_handle;
-
-  typedef typename Tr_Base::Cell   Cell;
-  typedef typename Tr_Base::Vertex Vertex;
-  typedef typename Tr_Base::Facet  Facet;
-  typedef typename Tr_Base::Edge   Edge;
-
-  typedef typename Tr_Base::Cell_circulator  Cell_circulator;
-  typedef typename Tr_Base::Facet_circulator Facet_circulator;
-  typedef typename Tr_Base::Cell_iterator    Cell_iterator;
-  typedef typename Tr_Base::Facet_iterator   Facet_iterator;
-  typedef typename Tr_Base::Edge_iterator    Edge_iterator;
-  typedef typename Tr_Base::Vertex_iterator  Vertex_iterator;
-
-  typedef typename Tr_Base::Finite_vertices_iterator Finite_vertices_iterator;
-  typedef typename Tr_Base::Finite_cells_iterator    Finite_cells_iterator;
-  typedef typename Tr_Base::Finite_facets_iterator   Finite_facets_iterator;
-  typedef typename Tr_Base::Finite_edges_iterator    Finite_edges_iterator;
-
-  typedef typename Tr_Base::All_cells_iterator       All_cells_iterator;
-
-  typedef typename Tr_Base::size_type size_type;
-  typedef typename Tr_Base::Locate_type Locate_type;
-
-
-#ifndef CGAL_CFG_USING_BASE_MEMBER_BUG_2
-  using Tr_Base::cw;
-  using Tr_Base::ccw;
-  using Tr_Base::geom_traits;
-  using Tr_Base::number_of_vertices;
-  using Tr_Base::dimension;
-  using Tr_Base::finite_facets_begin;
-  using Tr_Base::finite_facets_end;
-  using Tr_Base::finite_vertices_begin;
-  using Tr_Base::finite_vertices_end;
-  using Tr_Base::finite_cells_begin;
-  using Tr_Base::finite_cells_end;
-  using Tr_Base::finite_edges_begin;
-  using Tr_Base::finite_edges_end;
-  using Tr_Base::tds;
-  using Tr_Base::infinite_vertex;
-  using Tr_Base::next_around_edge;
-  using Tr_Base::vertex_triple_index;
-  using Tr_Base::mirror_vertex;
-  using Tr_Base::coplanar;
-  using Tr_Base::coplanar_orientation;
-  using Tr_Base::orientation;
-  using Tr_Base::adjacent_vertices;
-  using Tr_Base::construct_segment;
-  using Tr_Base::incident_facets;
-  using Tr_Base::insert_in_conflict;
-  using Tr_Base::is_infinite;
-  using Tr_Base::is_valid_finite;
-  using Tr_Base::locate;
-  using Tr_Base::side_of_edge;
-  using Tr_Base::side_of_segment;
-  using Tr_Base::find_conflicts;
-#endif
-
-protected:
-
-  Oriented_side
-  side_of_oriented_sphere(const Point &p0, const Point &p1, const Point &p2,
-         const Point &p3, const Point &t, bool perturb = false) const;
-
-  Bounded_side
-  coplanar_side_of_bounded_circle(const Point &p, const Point &q,
-                  const Point &r, const Point &s, bool perturb = false) const;
-
-  // for dual:
-  Point
-  construct_circumcenter(const Point &p, const Point &q, const Point &r) const
-  {
-      return geom_traits().construct_circumcenter_3_object()(p, q, r);
-  }
-
-  Line
-  construct_equidistant_line(const Point &p1, const Point &p2,
-                             const Point &p3) const
-  {
-      return geom_traits().construct_equidistant_line_3_object()(p1, p2, p3);
-  }
-
-  Ray
-  construct_ray(const Point &p, const Line &l) const
-  {
-      return geom_traits().construct_ray_3_object()(p, l);
-  }
-
-  Object
-  construct_object(const Point &p) const
-  {
-      return geom_traits().construct_object_3_object()(p);
-  }
-
-  Object
-  construct_object(const Segment &s) const
-  {
-      return geom_traits().construct_object_3_object()(s);
-  }
-
-  Object
-  construct_object(const Ray &r) const
-  {
-      return geom_traits().construct_object_3_object()(r);
-  }
-
-  bool
-  less_distance(const Point &p, const Point &q, const Point &r) const
-  {
-      return geom_traits().compare_distance_3_object()(p, q, r) == SMALLER;
-  }
-
-public:
-
-  Delaunay_triangulation_3(const Gt& gt = Gt(), Lock_data_structure *lock_ds = NULL)
-    : Tr_Base(gt, lock_ds)
-  {}
-
-  Delaunay_triangulation_3(Lock_data_structure *lock_ds, const Gt& gt = Gt())
-    : Tr_Base(lock_ds, gt)
-  {}
-
-  // Create a 3D triangulation from 4 points which must be well-oriented
-  // AND non-coplanar
-  Delaunay_triangulation_3(const Point &p0, const Point &p1,
-                           const Point &p2, const Point &p3,
-                           const Gt& gt = Gt(),
-                           Lock_data_structure *lock_ds = NULL)
-    : Tr_Base(p0, p1, p2, p3, gt, lock_ds)
-  {}
-
-
-  // copy constructor duplicates vertices and cells
-  Delaunay_triangulation_3(const Delaunay_triangulation_3 & tr)
-    : Tr_Base(tr)
-  {
-    CGAL_triangulation_postcondition( is_valid() );
-  }
-
-  template < typename InputIterator >
-  Delaunay_triangulation_3(InputIterator first, InputIterator last,
-                           const Gt& gt = Gt(), Lock_data_structure *lock_ds = NULL)
-    : Tr_Base(gt, lock_ds)
-  {
-      insert(first, last);
-  }
-
-  template < typename InputIterator >
-  Delaunay_triangulation_3(InputIterator first, InputIterator last,
-                           Lock_data_structure *lock_ds,
-                           const Gt& gt = Gt())
-    : Tr_Base(gt, lock_ds)
-  {
-      insert(first, last);
-  }
-
-private:
-  #ifdef CGAL_CONCURRENT_TRIANGULATION_3_ADD_TEMPORARY_POINTS_ON_FAR_SPHERE
-  std::vector<Vertex_handle> 
-  add_temporary_points_on_far_sphere(const size_t num_points)
-  {
-      std::vector<Vertex_handle> far_sphere_vertices;
-
-      const size_t MIN_NUM_POINTS_FOR_FAR_SPHERE_POINTS = 1000000;
-      if (num_points >= MIN_NUM_POINTS_FOR_FAR_SPHERE_POINTS)
-      {
-          // Add temporary vertices on a "far sphere" to reduce contention on
-          // the infinite vertex
-
-          // Get bbox
-          const Bbox_3 &bbox = *this->get_bbox();
-          // Compute radius for far sphere
-          const double& xdelta = bbox.xmax() - bbox.xmin();
-          const double& ydelta = bbox.ymax() - bbox.ymin();
-          const double& zdelta = bbox.zmax() - bbox.zmin();
-          const double radius = 1.3 * 0.5 * std::sqrt(xdelta*xdelta +
-                                                      ydelta*ydelta +
-                                                      zdelta*zdelta);
-          // WARNING - TODO: this code has to be fixed because Vector_3 is not
-          // required by the traits concept
-          const typename Gt::Vector_3 center(
-                  bbox.xmin() + 0.5*xdelta,
-                  bbox.ymin() + 0.5*ydelta,
-                  bbox.zmin() + 0.5*zdelta);
-          Random_points_on_sphere_3<Point> random_point(radius);
-          const int NUM_PSEUDO_INFINITE_VERTICES = static_cast<int>(
-                  tbb::task_scheduler_init::default_num_threads() * 3.5);
-          std::vector<Point> points_on_far_sphere;
-
-          points_on_far_sphere.reserve(NUM_PSEUDO_INFINITE_VERTICES);
-          far_sphere_vertices.reserve(NUM_PSEUDO_INFINITE_VERTICES);
-
-          for (int i = 0 ; i < NUM_PSEUDO_INFINITE_VERTICES ; ++i, ++random_point)
-              points_on_far_sphere.push_back(*random_point + center);
-
-          spatial_sort(points_on_far_sphere.begin(),
-                       points_on_far_sphere.end(),
-                       geom_traits());
-
-          typename std::vector<Point>::const_iterator it_p = points_on_far_sphere.begin();
-          typename std::vector<Point>::const_iterator it_p_end = points_on_far_sphere.end();
-
-          Vertex_handle hint;
-          for ( ; it_p != it_p_end ; ++it_p)
-          {
-              hint = insert(*it_p, hint);
-              far_sphere_vertices.push_back(hint);
-          }
-      }
-
-      return far_sphere_vertices;
-  }
-
-  void remove_temporary_points_on_far_sphere(
-    const std::vector<Vertex_handle> & far_sphere_vertices)
-  {
-      if(!far_sphere_vertices.empty())
-      {
-          // Remove the temporary vertices on far sphere
-          remove(far_sphere_vertices.begin(), far_sphere_vertices.end());
-      }
-  }
-  #endif
-
-public:
-
-#ifndef CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
-  template < class InputIterator >
-  std::ptrdiff_t
-  insert( InputIterator first, InputIterator last,
-          typename boost::enable_if<
-            boost::is_convertible<
-                typename std::iterator_traits<InputIterator>::value_type,
-                Point
-            >
-          >::type* = NULL
-  )
-#else
-  template < class InputIterator >
-  std::ptrdiff_t
-  insert( InputIterator first, InputIterator last)
-#endif //CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
-  {
-#ifdef CGAL_TRIANGULATION_3_PROFILING
-    WallClockTimer t;
-#endif
-
-    size_type n = number_of_vertices();
-    std::vector<Point> points (first, last);
-    spatial_sort (points.begin(), points.end(), geom_traits());
-
-    // Parallel
-#ifdef CGAL_LINKED_WITH_TBB
-    if (this->is_parallel())
-    {
-      size_t num_points = points.size();
-
-      Vertex_handle hint;
-      
-#ifdef CGAL_CONCURRENT_TRIANGULATION_3_ADD_TEMPORARY_POINTS_ON_FAR_SPHERE
-      std::vector<Vertex_handle> far_sphere_vertices =
-        add_temporary_points_on_far_sphere(num_points);
-#endif // CGAL_CONCURRENT_TRIANGULATION_3_ADD_TEMPORARY_POINTS_ON_FAR_SPHERE
-      
-      size_t i = 0;
-      // Insert "num_points_seq" points sequentially
-      // (or more if dim < 3 after that)
-      size_t num_points_seq = (std::min)(num_points, (size_t)100);
-      while (dimension() < 3 || i < num_points_seq)
-      {
-        hint = insert(points[i], hint);
-        ++i;
-      }
-
-      tbb::enumerable_thread_specific<Vertex_handle> tls_hint(hint);
-      tbb::parallel_for(
-        tbb::blocked_range<size_t>( i, num_points ),
-        Insert_point<Self>(*this, points, tls_hint)
-      );
-      
-#ifdef CGAL_CONCURRENT_TRIANGULATION_3_ADD_TEMPORARY_POINTS_ON_FAR_SPHERE
-      remove_temporary_points_on_far_sphere(far_sphere_vertices);
-#endif // CGAL_CONCURRENT_TRIANGULATION_3_ADD_TEMPORARY_POINTS_ON_FAR_SPHERE
-    }
-    // Sequential
-    else
-#endif // CGAL_LINKED_WITH_TBB
-    {
-      Vertex_handle hint;
-      for (typename std::vector<Point>::const_iterator p = points.begin(), end = points.end();
-              p != end; ++p)
-          hint = insert(*p, hint);
-    }
-
-#ifdef CGAL_TRIANGULATION_3_PROFILING
-    std::cerr << "Triangulation computed in " << t.elapsed() << " seconds." << std::endl;
-#endif
-
-    return number_of_vertices() - n;
-  }
-
-
-#ifndef CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
-private:
-  //top stands for tuple-or-pair
-  template <class Info>
-  const Point& top_get_first(const std::pair<Point,Info>& pair) const { return pair.first; }
-  template <class Info>
-  const Info& top_get_second(const std::pair<Point,Info>& pair) const { return pair.second; }
-  template <class Info>
-  const Point& top_get_first(const boost::tuple<Point,Info>& tuple) const { return boost::get<0>(tuple); }
-  template <class Info>
-  const Info& top_get_second(const boost::tuple<Point,Info>& tuple) const { return boost::get<1>(tuple); }
-
-  template <class Tuple_or_pair,class InputIterator>
-  std::ptrdiff_t insert_with_info(InputIterator first,InputIterator last)
-  {
-    size_type n = number_of_vertices();
-    std::vector<std::ptrdiff_t> indices;
-    std::vector<Point> points;
-    std::vector<typename Triangulation_data_structure::Vertex::Info> infos;
-    std::ptrdiff_t index=0;
-    for (InputIterator it=first;it!=last;++it){
-      Tuple_or_pair value=*it;
-      points.push_back( top_get_first(value)  );
-      infos.push_back ( top_get_second(value) );
-      indices.push_back(index++);
-    }
-
-    typedef Spatial_sort_traits_adapter_3<Geom_traits,Point*> Search_traits;
-
-    spatial_sort(indices.begin(),indices.end(),Search_traits(&(points[0]),geom_traits()));
-
-#ifdef CGAL_LINKED_WITH_TBB
-      if(this->is_parallel()){
-
-        size_t num_points = points.size();
-        Vertex_handle hint;
-
-#ifdef CGAL_CONCURRENT_TRIANGULATION_3_ADD_TEMPORARY_POINTS_ON_FAR_SPHERE
-        std::vector<Vertex_handle> far_sphere_vertices =
-          add_temporary_points_on_far_sphere(num_points);
-#endif // CGAL_CONCURRENT_TRIANGULATION_3_ADD_TEMPORARY_POINTS_ON_FAR_SPHERE
-
-        size_t i = 0;
-        // Insert "num_points_seq" points sequentially
-        // (or more if dim < 3 after that)
-        size_t num_points_seq = (std::min)(num_points, (size_t)100);
-        while (dimension() < 3 || i < num_points_seq)
-        {
-          hint = insert(points[indices[i]], hint);
-          if (hint != Vertex_handle()) hint->info() = infos[indices[i]];
-          ++i;
-        }
-
-        tbb::enumerable_thread_specific<Vertex_handle> tls_hint(hint);
-        tbb::parallel_for(
-          tbb::blocked_range<size_t>( i, num_points ),
-          Insert_point_with_info<Self>(*this, points, infos, indices, tls_hint)
-        );
-
-#ifdef CGAL_CONCURRENT_TRIANGULATION_3_ADD_TEMPORARY_POINTS_ON_FAR_SPHERE
-      remove_temporary_points_on_far_sphere(far_sphere_vertices);
-#endif // CGAL_CONCURRENT_TRIANGULATION_3_ADD_TEMPORARY_POINTS_ON_FAR_SPHERE
-
-      }
-      // Sequential
-      else
-#endif
-      {
-          Vertex_handle hint;
-          for (typename std::vector<std::ptrdiff_t>::const_iterator
-                       it = indices.begin(), end = indices.end();
-               it != end; ++it) {
-              hint = insert(points[*it], hint);
-              if (hint != Vertex_handle()) hint->info() = infos[*it];
-          }
-      }
-
-    return number_of_vertices() - n;
-  }
-
-public:
-
-  template < class InputIterator >
-  std::ptrdiff_t
-  insert( InputIterator first,
-          InputIterator last,
-          typename boost::enable_if<
-            boost::is_convertible<
-              typename std::iterator_traits<InputIterator>::value_type,
-              std::pair<Point,typename internal::Info_check<typename Triangulation_data_structure::Vertex>::type>
-            > >::type* =NULL
-  )
-  {
-    return insert_with_info< std::pair<Point,typename internal::Info_check<typename Triangulation_data_structure::Vertex>::type> >(first,last);
-  }
-
-  template <class  InputIterator_1,class InputIterator_2>
-  std::ptrdiff_t
-  insert( boost::zip_iterator< boost::tuple<InputIterator_1,InputIterator_2> > first,
-          boost::zip_iterator< boost::tuple<InputIterator_1,InputIterator_2> > last,
-          typename boost::enable_if<
-            boost::mpl::and_<
-              boost::is_convertible< typename std::iterator_traits<InputIterator_1>::value_type, Point >,
-              boost::is_convertible< typename std::iterator_traits<InputIterator_2>::value_type, typename internal::Info_check<typename Triangulation_data_structure::Vertex>::type >
-            >
-          >::type* =NULL
-  )
-  {
-    return insert_with_info< boost::tuple<Point,typename internal::Info_check<typename Triangulation_data_structure::Vertex>::type> >(first,last);
-  }
-#endif //CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
-
-  Vertex_handle insert(const Point & p, Vertex_handle hint,
-                       bool *could_lock_zone = NULL)
-  {
-    return insert(p, hint == Vertex_handle() ? this->infinite_cell() : hint->cell(),
-                  could_lock_zone);
-  }
-
-  Vertex_handle insert(const Point & p, Cell_handle start = Cell_handle(),
-                       bool *could_lock_zone = NULL);
-
-  Vertex_handle insert(const Point & p, Locate_type lt,
-                       Cell_handle c, int li, int,
-                 bool *could_lock_zone = NULL);
-
-public: // internal methods
-
-  template <class OutputItCells>
-  Vertex_handle insert_and_give_new_cells(const Point  &p,
-                                          OutputItCells fit,
-                                          Cell_handle start = Cell_handle() );
-
-  template <class OutputItCells>
-  Vertex_handle insert_and_give_new_cells(const Point& p,
-                                          OutputItCells fit,
-                                          Vertex_handle hint);
-
-  template <class OutputItCells>
-  Vertex_handle insert_and_give_new_cells(const Point& p,
-                                          Locate_type lt,
-                                          Cell_handle c, int li, int lj,
-                                          OutputItCells fit);
-
-public:
-
-#ifndef CGAL_NO_DEPRECATED_CODE
-  CGAL_DEPRECATED Vertex_handle move_point(Vertex_handle v, const Point & p);
-#endif
-
-  template <class OutputIteratorBoundaryFacets,
-            class OutputIteratorCells,
-            class OutputIteratorInternalFacets>
-  Triple<OutputIteratorBoundaryFacets,
-         OutputIteratorCells,
-         OutputIteratorInternalFacets>
-  find_conflicts(const Point &p, Cell_handle c,
-                 OutputIteratorBoundaryFacets bfit,
-                 OutputIteratorCells cit,
-                 OutputIteratorInternalFacets ifit,
-                 bool *could_lock_zone = NULL) const
-  {
-      CGAL_triangulation_precondition(dimension() >= 2);
-
-      std::vector<Cell_handle> cells;
-      cells.reserve(32);
-      std::vector<Facet> facets;
-      facets.reserve(64);
-
-      if (dimension() == 2) {
-          Conflict_tester_2 tester(p, this);
-          ifit = Tr_Base::find_conflicts
-            (c, tester,
-             make_triple(std::back_inserter(facets),
-                         std::back_inserter(cells),
-                         ifit), could_lock_zone).third;
-      }
-      else {
-          Conflict_tester_3 tester(p, this);
-          ifit = Tr_Base::find_conflicts
-            (c, tester,
-             make_triple(std::back_inserter(facets),
-                         std::back_inserter(cells),
-                         ifit), could_lock_zone).third;
-      }
-
-      // Reset the conflict flag on the boundary.
-      for(typename std::vector<Facet>::iterator fit=facets.begin();
-          fit != facets.end(); ++fit) {
-        fit->first->neighbor(fit->second)->tds_data().clear();
-        *bfit++ = *fit;
-      }
-
-      // Reset the conflict flag in the conflict cells.
-      for(typename std::vector<Cell_handle>::iterator ccit=cells.begin();
-        ccit != cells.end(); ++ccit) {
-        (*ccit)->tds_data().clear();
-        *cit++ = *ccit;
-      }
-      return make_triple(bfit, cit, ifit);
-  }
-
-  template <class OutputIteratorBoundaryFacets, class OutputIteratorCells>
-  std::pair<OutputIteratorBoundaryFacets, OutputIteratorCells>
-  find_conflicts(const Point &p, Cell_handle c,
-                 OutputIteratorBoundaryFacets bfit,
-                 OutputIteratorCells cit,
-                 bool *could_lock_zone = NULL) const
-  {
-      Triple<OutputIteratorBoundaryFacets,
-             OutputIteratorCells,
-             Emptyset_iterator> t = find_conflicts(p, c, bfit, cit,
-                                                   Emptyset_iterator(),
-                                                   could_lock_zone);
-      return std::make_pair(t.first, t.second);
-  }
-
-#ifndef CGAL_NO_DEPRECATED_CODE
-  // Returns the vertices on the boundary of the conflict hole.
-  template <class OutputIterator>
-  OutputIterator
-  vertices_in_conflict(const Point&p, Cell_handle c, OutputIterator res) const
-  {
-    return vertices_on_conflict_zone_boundary(p, c, res);
-  }
-#endif // CGAL_NO_DEPRECATED_CODE
-
-  // Returns the vertices on the boundary of the conflict hole.
-  template <class OutputIterator>
-  OutputIterator
-  vertices_on_conflict_zone_boundary(const Point&p, Cell_handle c,
-                                     OutputIterator res) const
-  {
-      CGAL_triangulation_precondition(dimension() >= 2);
-
-      // Get the facets on the boundary of the hole.
-      std::vector<Facet> facets;
-      find_conflicts(p, c, std::back_inserter(facets),
-                     Emptyset_iterator(), Emptyset_iterator());
-
-      // Then extract uniquely the vertices.
-      std::set<Vertex_handle> vertices;
-      if (dimension() == 3) {
-          for (typename std::vector<Facet>::const_iterator i = facets.begin();
-               i != facets.end(); ++i) {
-              vertices.insert(i->first->vertex((i->second+1)&3));
-              vertices.insert(i->first->vertex((i->second+2)&3));
-              vertices.insert(i->first->vertex((i->second+3)&3));
-          }
-      } else {
-          for (typename std::vector<Facet>::const_iterator i = facets.begin();
-               i != facets.end(); ++i) {
-              vertices.insert(i->first->vertex(cw(i->second)));
-              vertices.insert(i->first->vertex(ccw(i->second)));
-          }
-      }
-
-      return std::copy(vertices.begin(), vertices.end(), res);
-  }
-
-  // REMOVE
-  void remove(Vertex_handle v);
-  // Concurrency-safe
-  // See Triangulation_3::remove for more information
-  bool remove(Vertex_handle v, bool *could_lock_zone);
-
-  // return new cells (internal)
-  template <class OutputItCells>
-  void remove_and_give_new_cells(Vertex_handle v,
-                                 OutputItCells fit);
-
-  template < typename InputIterator >
-  size_type remove(InputIterator first, InputIterator beyond)
-  {
-    CGAL_triangulation_precondition(!this->does_repeat_in_range(first, beyond));
-    size_type n = number_of_vertices();
-
-#ifdef CGAL_TRIANGULATION_3_PROFILING
-    WallClockTimer t;
-#endif
-
-    // Parallel
-#ifdef CGAL_LINKED_WITH_TBB
-    if (this->is_parallel())
-    {
-      // TODO: avoid that by asking for random-access iterators?
-      std::vector<Vertex_handle> vertices(first, beyond);
-      tbb::concurrent_vector<Vertex_handle> vertices_to_remove_sequentially;
-
-      tbb::parallel_for(
-        tbb::blocked_range<size_t>( 0, vertices.size()),
-        Remove_point<Self>(*this, vertices, vertices_to_remove_sequentially)
-      );
-
-      // Do the rest sequentially
-      for ( typename tbb::concurrent_vector<Vertex_handle>::const_iterator
-              it = vertices_to_remove_sequentially.begin(),
-              it_end = vertices_to_remove_sequentially.end()
-          ; it != it_end
-          ; ++it)
-      {
-        remove(*it);
-      }
-    }
-    // Sequential
-    else
-#endif // CGAL_LINKED_WITH_TBB
-    {
-      while (first != beyond) {
-        remove(*first);
-        ++first;
-      }
-    }
-
-#ifdef CGAL_TRIANGULATION_3_PROFILING
-    double elapsed = t.elapsed();
-    std::cerr << "Points removed in " << elapsed << " seconds." << std::endl;
-#endif
-    return n - number_of_vertices();
-  }
-
-  template < typename InputIterator >
-  size_type remove_cluster(InputIterator first, InputIterator beyond)
-  {
-    Self tmp;
-    Vertex_remover<Self> remover (tmp);
-    return Tr_Base::remove(first, beyond, remover);
-  }
-
-  // MOVE
-  Vertex_handle move_if_no_collision(Vertex_handle v, const Point &p);
-
-  Vertex_handle move(Vertex_handle v, const Point &p);
-
-  // return new cells (internal)
-  template <class OutputItCells>
-  Vertex_handle move_if_no_collision_and_give_new_cells(Vertex_handle v,
-                                                        const Point &p,
-                                                        OutputItCells fit);
-
-private:
-
-  Bounded_side
-  side_of_sphere(Vertex_handle v0, Vertex_handle v1,
-                 Vertex_handle v2, Vertex_handle v3,
-                 const Point &p, bool perturb) const;
-public:
-
-  // Queries
-  Bounded_side
-  side_of_sphere(Cell_handle c, const Point & p,
-                 bool perturb = false) const
-  {
-      return side_of_sphere(c->vertex(0), c->vertex(1),
-                            c->vertex(2), c->vertex(3), p, perturb);
-  }
-
-  Bounded_side
-  side_of_circle( const Facet & f, const Point & p, bool perturb = false) const
-  {
-      return side_of_circle(f.first, f.second, p, perturb);
-  }
-
-  Bounded_side
-  side_of_circle( Cell_handle c, int i, const Point & p,
-                  bool perturb = false) const;
-
-  Vertex_handle
-  nearest_vertex_in_cell(const Point& p, Cell_handle c) const;
-
-  Vertex_handle
-  nearest_vertex(const Point& p, Cell_handle c = Cell_handle()) const;
-
-  bool is_Gabriel(Cell_handle c, int i) const;
-  bool is_Gabriel(Cell_handle c, int i, int j) const;
-  bool is_Gabriel(const Facet& f)const ;
-  bool is_Gabriel(const Edge& e) const;
-
-  bool is_delaunay_after_displacement(Vertex_handle v,
-                                      const Point &p) const;
-
-// Dual functions
-  Point dual(Cell_handle c) const;
-
-  Object dual(const Facet & f) const
-  { return dual( f.first, f.second ); }
-
-  Object dual(Cell_handle c, int i) const;
-
-  Line dual_support(Cell_handle c, int i) const;
-
-  bool is_valid(bool verbose = false, int level = 0) const;
-
-  bool is_valid(Cell_handle c, bool verbose = false, int level = 0) const;
-
-  template < class Stream>
-  Stream& draw_dual(Stream & os)
-    {
-      for (Finite_facets_iterator fit = finite_facets_begin(),
-                                  end = finite_facets_end();
-           fit != end; ++fit) {
-        Object o = dual(*fit);
-        if      (const Segment *s = object_cast<Segment>(&o)) os << *s;
-        else if (const Ray *r     = object_cast<Ray>(&o))     os << *r;
-        else if (const Point *p   = object_cast<Point>(&o))   os << *p;
-      }
-      return os;
-    }
-
-protected:
-
-  Vertex_handle
-  nearest_vertex(const Point &p, Vertex_handle v, Vertex_handle w) const
-  {
-      // In case of equality, v is returned.
-      CGAL_triangulation_precondition(v != w);
-
-      if (is_infinite(v))
-          return w;
-      if (is_infinite(w))
-          return v;
-      return less_distance(p, w->point(), v->point()) ? w : v;
-  }
-
-  class Conflict_tester_3
-  {
-      const Point &p;
-      const Self *t;
-
-  public:
-
-    Conflict_tester_3(const Point &pt, const Self *tr)
-      : p(pt), t(tr) {}
-
-    bool operator()(const Cell_handle c) const
-    {
-      return t->side_of_sphere(c, p, true) == ON_BOUNDED_SIDE;
-    }
-    Oriented_side compare_weight(const Point &, const Point &) const
-    {
-      return ZERO;
-    }
-    bool test_initial_cell(Cell_handle) const
-    {
-      return true;
-    }
-  };
-
-  class Conflict_tester_2
-  {
-      const Point &p;
-      const Self *t;
-
-  public:
-
-    Conflict_tester_2(const Point &pt, const Self *tr)
-      : p(pt), t(tr) {}
-
-    bool operator()(const Cell_handle c) const
-    {
-      return t->side_of_circle(c, 3, p, true) == ON_BOUNDED_SIDE;
-    }
-    Oriented_side compare_weight(const Point &, const Point &) const
-    {
-      return ZERO;
-    }
-    bool test_initial_cell(Cell_handle) const
-    {
-      return true;
-    }
-  };
-  class Hidden_point_visitor
-  {
-  public:
-
-    Hidden_point_visitor() {}
-
-    template <class InputIterator>
-    void process_cells_in_conflict(InputIterator, InputIterator) const {}
-    void reinsert_vertices(Vertex_handle ) {}
-    Vertex_handle replace_vertex(Cell_handle c, int index,
-                                 const Point &) {
-      return c->vertex(index);
-    }
-    void hide_point(Cell_handle, const Point &) {}
-  };
-
-  class Perturbation_order {
-      const Self *t;
-
-  public:
-      Perturbation_order(const Self *tr)
-          : t(tr) {}
-
-      bool operator()(const Point *p, const Point *q) const {
-          return t->compare_xyz(*p, *q) == SMALLER;
-      }
-  };
-
-#ifdef CGAL_LINKED_WITH_TBB
-  // Functor for parallel insert(begin, end) function
-  template <typename DT>
-  class Insert_point
-  {
-    typedef typename DT::Point                          Point;
-    typedef typename DT::Vertex_handle                  Vertex_handle;
-
-    DT                                                  & m_dt;
-    const std::vector<Point>                            & m_points;
-    tbb::enumerable_thread_specific<Vertex_handle>      & m_tls_hint;
-
-  public:
-    // Constructor
-    Insert_point(DT & dt,
-                 const std::vector<Point> & points,
-                 tbb::enumerable_thread_specific<Vertex_handle> & tls_hint)
-    : m_dt(dt), m_points(points), m_tls_hint(tls_hint)
-    {}
-
-    // Constructor
-    Insert_point(const Insert_point &ip)
-    : m_dt(ip.m_dt), m_points(ip.m_points), m_tls_hint(ip.m_tls_hint)
-    {}
-
-    // operator()
-    void operator()( const tbb::blocked_range<size_t>& r ) const
-    {
-#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
-      static Profile_branch_counter_3 bcounter(
-        "early withdrawals / late withdrawals / successes [Delaunay_tri_3::insert]");
-#endif
-
-      Vertex_handle &hint = m_tls_hint.local();
-      for( std::size_t i_point = r.begin() ; i_point != r.end() ; ++i_point)
-      {
-        bool success = false;
-        while(!success)
-        {
-          if (m_dt.try_lock_vertex(hint) && m_dt.try_lock_point(m_points[i_point]))
-          {
-            bool could_lock_zone;
-            Vertex_handle new_hint = m_dt.insert(
-              m_points[i_point], hint, &could_lock_zone);
-
-            m_dt.unlock_all_elements();
-
-            if (could_lock_zone)
-            {
-              hint = new_hint;
-              success = true;
-#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
-              ++bcounter;
-#endif
-            }
-#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
-            else
-            {
-              bcounter.increment_branch_1(); // THIS is a late withdrawal!
-            }
-#endif
-          }
-          else
-          {
-            m_dt.unlock_all_elements();
-
-#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
-            bcounter.increment_branch_2(); // THIS is an early withdrawal!
-#endif
-          }
-        }
-
-      }
-    }
-  };
-
-  // Functor for parallel insert_with_info(begin, end) function
-  template <typename DT>
-  class Insert_point_with_info
-  {
-    typedef typename DT::Point                                  Point;
-    typedef typename DT::Vertex_handle                          Vertex_handle;
-    typedef typename DT::Triangulation_data_structure::Vertex::Info Info;
-
-    DT                                                  & m_dt;
-    const std::vector<Point>                            & m_points;
-    const std::vector<Info>                             & m_infos;
-    const std::vector<std::ptrdiff_t>                   & m_indices;
-    tbb::enumerable_thread_specific<Vertex_handle>      & m_tls_hint;
-
-  public:
-    // Constructor
-    Insert_point_with_info(DT & dt,
-                 const std::vector<Point> & points,
-                 const std::vector<Info> & infos,
-                 const std::vector<std::ptrdiff_t> & indices,
-                 tbb::enumerable_thread_specific<Vertex_handle> & tls_hint)
-    : m_dt(dt), m_points(points), m_infos(infos), m_indices(indices), 
-      m_tls_hint(tls_hint)
-    {}
-
-    // Constructor
-    Insert_point_with_info(const Insert_point_with_info &ip)
-      : m_dt(ip.m_dt), m_points(ip.m_points), m_infos(ip.m_infos),
-      m_indices(ip.m_indices), m_tls_hint(ip.m_tls_hint)
-    {}
-
-    // operator()
-    void operator()( const tbb::blocked_range<size_t>& r ) const
-    {
-#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
-      static Profile_branch_counter_3 bcounter(
-        "early withdrawals / late withdrawals / successes [Delaunay_tri_3::insert_with_info]");
-#endif
-
-      Vertex_handle &hint = m_tls_hint.local();
-      for( std::size_t i_idx = r.begin() ; i_idx != r.end() ; ++i_idx)
-      {
-        bool success = false;
-        std::ptrdiff_t i_point = m_indices[i_idx];
-        const Point &p = m_points[i_point];
-        while(!success)
-        {
-          if (m_dt.try_lock_vertex(hint) && m_dt.try_lock_point(p))
-          {
-            bool could_lock_zone;
-            Vertex_handle new_hint = m_dt.insert(
-              p, hint, &could_lock_zone);
-
-            m_dt.unlock_all_elements();
-
-            if (could_lock_zone)
-            {
-              hint = new_hint;
-              if (hint!=Vertex_handle()) hint->info()=m_infos[i_point];
-              success = true;
-#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
-              ++bcounter;
-#endif
-            }
-#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
-            else
-            {
-              bcounter.increment_branch_1(); // THIS is a late withdrawal!
-            }
-#endif
-          }
-          else
-          {
-            m_dt.unlock_all_elements();
-
-#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
-            bcounter.increment_branch_2(); // THIS is an early withdrawal!
-#endif
-          }
-        }
-
-      }
-    }
-  };
-
-  // Functor for parallel remove(begin, end) function
-  template <typename DT>
-  class Remove_point
-  {
-    typedef typename DT::Point                          Point;
-    typedef typename DT::Vertex_handle                  Vertex_handle;
-
-    DT                                    & m_dt;
-    const std::vector<Vertex_handle>      & m_vertices;
-    tbb::concurrent_vector<Vertex_handle> & m_vertices_to_remove_sequentially;
-
-  public:
-    // Constructor
-    Remove_point(DT & dt,
-                 const std::vector<Vertex_handle> & vertices,
-                 tbb::concurrent_vector<Vertex_handle> & 
-                   vertices_to_remove_sequentially)
-    : m_dt(dt), m_vertices(vertices), 
-      m_vertices_to_remove_sequentially(vertices_to_remove_sequentially)
-    {}
-
-    // Constructor
-    Remove_point(const Remove_point &rp)
-    : m_dt(rp.m_dt), m_vertices(rp.m_vertices),
-      m_vertices_to_remove_sequentially(rp.m_vertices_to_remove_sequentially)
-    {}
-
-    // operator()
-    void operator()( const tbb::blocked_range<size_t>& r ) const
-    {
-      for( size_t i_vertex = r.begin() ; i_vertex != r.end() ; ++i_vertex)
-      {
-        Vertex_handle v = m_vertices[i_vertex];
-        bool could_lock_zone, needs_to_be_done_sequentially;
-        do
-        {
-          needs_to_be_done_sequentially =
-            !m_dt.remove(v, &could_lock_zone);
-          m_dt.unlock_all_elements();
-        } while (!could_lock_zone);
-
-        if (needs_to_be_done_sequentially)
-          m_vertices_to_remove_sequentially.push_back(v);
-      }
-    }
-  };
-#endif // CGAL_LINKED_WITH_TBB
-
-  template < class DelaunayTriangulation_3 >
-  class Vertex_remover;
-
-  template < class DelaunayTriangulation_3 >
-  class Vertex_inserter;
-
-  friend class Perturbation_order;
-  friend class Conflict_tester_3;
-  friend class Conflict_tester_2;
-
-  Hidden_point_visitor hidden_point_visitor;
-};
-
-template < class Gt, class Tds, class Lds >
-typename Delaunay_triangulation_3<Gt,Tds,Default,Lds>::Vertex_handle
-Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
-insert(const Point & p, Cell_handle start, bool *could_lock_zone)
-{
-  Locate_type lt;
-  int li, lj;
-
-  // Parallel
-  if (could_lock_zone)
-  {
-    Cell_handle c = locate(p, lt, li, lj, start, could_lock_zone);
-    if (*could_lock_zone)
-      return insert(p, lt, c, li, lj, could_lock_zone);
-    else
-      return Vertex_handle();
-  }
-  // Sequential
-  else
-  {
-    Cell_handle c = locate(p, lt, li, lj, start);
-    return insert(p, lt, c, li, lj);
-  }
-
-}
-
-template < class Gt, class Tds, class Lds >
-typename Delaunay_triangulation_3<Gt,Tds,Default,Lds>::Vertex_handle
-Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
-insert(const Point & p, Locate_type lt, Cell_handle c, int li, int lj,
-       bool *could_lock_zone)
-{
-  switch (dimension()) {
-  case 3:
-    {
-      Conflict_tester_3 tester(p, this);
-      Vertex_handle v = insert_in_conflict(p, lt, c, li, lj,
-                                           tester, hidden_point_visitor, could_lock_zone);
-      return v;
-    }// dim 3
-  case 2:
-    {
-      Conflict_tester_2 tester(p, this);
-      return insert_in_conflict(p, lt, c, li, lj,
-                                tester, hidden_point_visitor, could_lock_zone);
-    }//dim 2
-  default :
-    // dimension <= 1
-    // Do not use the generic insert.
-    return Tr_Base::insert(p, c);
-  }
-}
-
-template < class Gt, class Tds, class Lds >
-template <class OutputItCells>
-typename Delaunay_triangulation_3<Gt,Tds,Default,Lds>::Vertex_handle
-Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
-insert_and_give_new_cells(const Point  &p,
-                          OutputItCells fit,
-                          Cell_handle start)
-{
-  Vertex_handle v = insert(p, start);
-  int dimension = this->dimension();
-  if(dimension == 3) this->incident_cells(v, fit);
-  else if(dimension == 2)
-  {
-    Cell_handle c = v->cell(), end = c;
-    do {
-      *fit++ = c;
-      int i = c->index(v);
-      c = c->neighbor((i+1)%3);
-    } while(c != end);
-  }
-  else if(dimension == 1)
-  {
-    Cell_handle c = v->cell();
-    *fit++ = c;
-    *fit++ = c->neighbor((~(c->index(v)))&1);
-  }
-  else *fit++ = v->cell(); // dimension = 0
-  return v;
-}
-
-template < class Gt, class Tds, class Lds >
-template <class OutputItCells>
-typename Delaunay_triangulation_3<Gt,Tds,Default,Lds>::Vertex_handle
-Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
-insert_and_give_new_cells(const Point& p,
-                          OutputItCells fit,
-                          Vertex_handle hint)
-{
-  Vertex_handle v = insert(p, hint);
-  int dimension = this->dimension();
-  if(dimension == 3) this->incident_cells(v, fit);
-  else if(dimension == 2)
-  {
-    Cell_handle c = v->cell(), end = c;
-    do {
-      *fit++ = c;
-      int i = c->index(v);
-      c = c->neighbor((i+1)%3);
-    } while(c != end);
-  }
-  else if(dimension == 1)
-  {
-    Cell_handle c = v->cell();
-    *fit++ = c;
-    *fit++ = c->neighbor((~(c->index(v)))&1);
-  }
-  else *fit++ = v->cell(); // dimension = 0
-  return v;
-}
-
-template < class Gt, class Tds, class Lds >
-template <class OutputItCells>
-typename Delaunay_triangulation_3<Gt,Tds,Default,Lds>::Vertex_handle
-Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
-insert_and_give_new_cells(const Point& p,
-                          Locate_type lt,
-                          Cell_handle c, int li, int lj,
-                          OutputItCells fit)
-{
-  Vertex_handle v = insert(p, lt, c, li, lj);
-  int dimension = this->dimension();
-  if(dimension == 3) this->incident_cells(v, fit);
-  else if(dimension == 2)
-  {
-    Cell_handle c = v->cell(), end = c;
-    do {
-      *fit++ = c;
-      int i = c->index(v);
-      c = c->neighbor((i+1)%3);
-    } while(c != end);
-  }
-  else if(dimension == 1)
-  {
-    Cell_handle c = v->cell();
-    *fit++ = c;
-    *fit++ = c->neighbor((~(c->index(v)))&1);
-  }
-  else *fit++ = v->cell(); // dimension = 0
-  return v;
-}
-
-#ifndef CGAL_NO_DEPRECATED_CODE
-template < class Gt, class Tds, class Lds >
-typename Delaunay_triangulation_3<Gt,Tds,Default,Lds>::Vertex_handle
-Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
-move_point(Vertex_handle v, const Point & p)
-{
-    CGAL_triangulation_precondition(! is_infinite(v));
-    CGAL_triangulation_expensive_precondition(is_vertex(v));
-
-    // Dummy implementation for a start.
-
-    // Remember an incident vertex to restart
-    // the point location after the removal.
-    Cell_handle c = v->cell();
-    Vertex_handle old_neighbor = c->vertex(c->index(v) == 0 ? 1 : 0);
-    CGAL_triangulation_assertion(old_neighbor != v);
-
-    remove(v);
-
-    if (dimension() <= 0)
-        return insert(p);
-    return insert(p, old_neighbor->cell());
-}
-#endif
-
-template <class Gt, class Tds, class Lds >
-template <class DelaunayTriangulation_3>
-class Delaunay_triangulation_3<Gt,Tds,Default,Lds>::Vertex_remover {
-  typedef DelaunayTriangulation_3 Delaunay;
-public:
-  typedef Nullptr_t Hidden_points_iterator;
-
-  Vertex_remover(Delaunay &tmp_) : tmp(tmp_) {}
-
-  Delaunay &tmp;
-
-  void add_hidden_points(Cell_handle) {}
-  Hidden_points_iterator hidden_points_begin() { return NULL; }
-  Hidden_points_iterator hidden_points_end() { return NULL; }
-
-  Bounded_side side_of_bounded_circle(const Point &p, const Point &q,
-    const Point &r, const Point &s, bool perturb = false) const {
-    return tmp.coplanar_side_of_bounded_circle(p,q,r,s,perturb);
-  }
-};
-
-template <class Gt, class Tds, class Lds >
-template <class DelaunayTriangulation_3>
-class Delaunay_triangulation_3<Gt,Tds,Default,Lds>::Vertex_inserter {
-  typedef DelaunayTriangulation_3 Delaunay;
-public:
-  typedef Nullptr_t Hidden_points_iterator;
-
-  Vertex_inserter(Delaunay &tmp_) : tmp(tmp_) {}
-
-  Delaunay &tmp;
-
-  void add_hidden_points(Cell_handle) {}
-  Hidden_points_iterator hidden_points_begin() { return NULL; }
-  Hidden_points_iterator hidden_points_end() { return NULL; }
-
-  Vertex_handle insert(const Point& p,
-                       Locate_type lt, Cell_handle c, int li, int lj) {
-    return tmp.insert(p, lt, c, li, lj);
-  }
-
-  Vertex_handle insert(const Point& p, Cell_handle c) {
-    return tmp.insert(p, c);
-  }
-
-  Vertex_handle insert(const Point& p) {
-    return tmp.insert(p);
-  }
-};
-
-template < class Gt, class Tds, class Lds >
-void
-Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
-remove(Vertex_handle v)
-{
-  Self tmp;
-  Vertex_remover<Self> remover (tmp);
-  Tr_Base::remove(v, remover);
-
-  CGAL_triangulation_expensive_postcondition(is_valid());
-}
-
-template < class Gt, class Tds, class Lds >
-bool
-Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
-remove(Vertex_handle v, bool *could_lock_zone)
-{
-  Self tmp;
-  Vertex_remover<Self> remover (tmp);
-  bool ret = Tr_Base::remove(v, remover, could_lock_zone);
-
-  CGAL_triangulation_expensive_postcondition(is_valid());
-  return ret;
-}
-
-template < class Gt, class Tds, class Lds >
-typename Delaunay_triangulation_3<Gt,Tds,Default,Lds>::Vertex_handle
-Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
-move_if_no_collision(Vertex_handle v, const Point &p)
-{
-  Self tmp;
-  Vertex_remover<Self> remover (tmp);
-  Vertex_inserter<Self> inserter (*this);
-  Vertex_handle res = Tr_Base::move_if_no_collision(v,p,remover,inserter);
-
-  CGAL_triangulation_expensive_postcondition(is_valid());
-        return res;
-}
-
-template <class Gt, class Tds, class Lds >
-typename Delaunay_triangulation_3<Gt,Tds,Default,Lds>::Vertex_handle
-Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
-move(Vertex_handle v, const Point &p) {
-  CGAL_triangulation_precondition(!is_infinite(v));
-  if(v->point() == p) return v;
-  Self tmp;
-  Vertex_remover<Self> remover (tmp);
-  Vertex_inserter<Self> inserter (*this);
-        return Tr_Base::move(v,p,remover,inserter);
-}
-
-template < class Gt, class Tds, class Lds >
-template <class OutputItCells>
-void
-Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
-remove_and_give_new_cells(Vertex_handle v, OutputItCells fit)
-{
-  Self tmp;
-  Vertex_remover<Self> remover (tmp);
-  Tr_Base::remove_and_give_new_cells(v,remover,fit);
-
-  CGAL_triangulation_expensive_postcondition(is_valid());
-}
-
-template < class Gt, class Tds, class Lds >
-template <class OutputItCells>
-typename Delaunay_triangulation_3<Gt,Tds,Default,Lds>::Vertex_handle
-Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
-move_if_no_collision_and_give_new_cells(Vertex_handle v, const Point &p,
-  OutputItCells fit)
-{
-  Self tmp;
-  Vertex_remover<Self> remover (tmp);
-  Vertex_inserter<Self> inserter (*this);
-  Vertex_handle res =
-    Tr_Base::move_if_no_collision_and_give_new_cells(v,p,
-      remover,inserter,fit);
-
-  CGAL_triangulation_expensive_postcondition(is_valid());
-        return res;
-}
-
-template < class Gt, class Tds, class Lds >
-Oriented_side
-Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
-side_of_oriented_sphere(const Point &p0, const Point &p1, const Point &p2,
-                        const Point &p3, const Point &p, bool perturb) const
-{
-    CGAL_triangulation_precondition( orientation(p0, p1, p2, p3) == POSITIVE );
-
-    Oriented_side os =
-        geom_traits().side_of_oriented_sphere_3_object()(p0, p1, p2, p3, p);
-
-    if (os != ON_ORIENTED_BOUNDARY || !perturb)
-        return os;
-
-    // We are now in a degenerate case => we do a symbolic perturbation.
-
-    // We sort the points lexicographically.
-    const Point * points[5] = {&p0, &p1, &p2, &p3, &p};
-    std::sort(points, points+5, Perturbation_order(this) );
-
-    // We successively look whether the leading monomial, then 2nd monomial
-    // of the determinant has non null coefficient.
-    // 2 iterations are enough (cf paper)
-    for (int i=4; i>2; --i) {
-        if (points[i] == &p)
-            return ON_NEGATIVE_SIDE; // since p0 p1 p2 p3 are non coplanar
-                                     // and positively oriented
-        Orientation o;
-        if (points[i] == &p3 && (o = orientation(p0,p1,p2,p)) != COPLANAR )
-            return o;
-        if (points[i] == &p2 && (o = orientation(p0,p1,p,p3)) != COPLANAR )
-            return o;
-        if (points[i] == &p1 && (o = orientation(p0,p,p2,p3)) != COPLANAR )
-            return o;
-        if (points[i] == &p0 && (o = orientation(p,p1,p2,p3)) != COPLANAR )
-            return o;
-    }
-
-    CGAL_triangulation_assertion(false);
-    return ON_NEGATIVE_SIDE;
-}
-
-template < class Gt, class Tds, class Lds >
-Bounded_side
-Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
-coplanar_side_of_bounded_circle(const Point &p0, const Point &p1,
-               const Point &p2, const Point &p, bool perturb) const
-{
-    // In dim==2, we should even be able to assert orient == POSITIVE.
-    CGAL_triangulation_precondition( coplanar_orientation(p0, p1, p2)
-                                     != COLLINEAR );
-
-    Bounded_side bs =
-      geom_traits().coplanar_side_of_bounded_circle_3_object()(p0, p1, p2, p);
-
-    if (bs != ON_BOUNDARY || !perturb)
-        return bs;
-
-    // We are now in a degenerate case => we do a symbolic perturbation.
-
-    // We sort the points lexicographically.
-    const Point * points[4] = {&p0, &p1, &p2, &p};
-    std::sort(points, points+4, Perturbation_order(this) );
-
-    Orientation local = coplanar_orientation(p0, p1, p2);
-
-    // we successively look whether the leading monomial, then 2nd monimial,
-    // then 3rd monomial, of the determinant which has non null coefficient
-    // [syl] : TODO : Probably it can be stopped earlier like the 3D version
-    for (int i=3; i>0; --i) {
-        if (points[i] == &p)
-            return Bounded_side(NEGATIVE); // since p0 p1 p2 are non collinear
-                                   // but not necessarily positively oriented
-        Orientation o;
-        if (points[i] == &p2
-                && (o = coplanar_orientation(p0,p1,p)) != COLLINEAR )
-            // [syl] : TODO : I'm not sure of the signs here (nor the rest :)
-            return Bounded_side(o*local);
-        if (points[i] == &p1
-                && (o = coplanar_orientation(p0,p,p2)) != COLLINEAR )
-            return Bounded_side(o*local);
-        if (points[i] == &p0
-                && (o = coplanar_orientation(p,p1,p2)) != COLLINEAR )
-            return Bounded_side(o*local);
-    }
-
-    // case when the first non null coefficient is the coefficient of
-    // the 4th monomial
-    // moreover, the tests (points[] == &p) were false up to here, so the
-    // monomial corresponding to p is the only monomial with non-zero
-    // coefficient, it is equal to coplanar_orient(p0,p1,p2) == positive
-    // so, no further test is required
-    return Bounded_side(-local); //ON_UNBOUNDED_SIDE;
-}
-
-template < class Gt, class Tds, class Lds >
-Bounded_side
-Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
-side_of_sphere(Vertex_handle v0, Vertex_handle v1,
-               Vertex_handle v2, Vertex_handle v3,
-               const Point &p, bool perturb) const
-{
-    CGAL_triangulation_precondition( dimension() == 3 );
-
-    if (is_infinite(v0)) {
-        Orientation o = orientation(v2->point(), v1->point(), v3->point(), p);
-        if (o != COPLANAR)
-            return Bounded_side(o);
-        return coplanar_side_of_bounded_circle(v2->point(), v1->point(), v3->point(), p, perturb);
-    }
-
-    if (is_infinite(v1)) {
-        Orientation o = orientation(v2->point(), v3->point(), v0->point(), p);
-        if (o != COPLANAR)
-            return Bounded_side(o);
-        return coplanar_side_of_bounded_circle(v2->point(), v3->point(), v0->point(), p, perturb);
-    }
-
-    if (is_infinite(v2)) {
-        Orientation o = orientation(v1->point(), v0->point(), v3->point(), p);
-        if (o != COPLANAR)
-            return Bounded_side(o);
-        return coplanar_side_of_bounded_circle(v1->point(), v0->point(), v3->point(), p, perturb);
-    }
-
-    if (is_infinite(v3)) {
-        Orientation o = orientation(v0->point(), v1->point(), v2->point(), p);
-        if (o != COPLANAR)
-            return Bounded_side(o);
-        return coplanar_side_of_bounded_circle(v0->point(), v1->point(), v2->point(), p, perturb);
-    }
-
-    return (Bounded_side) side_of_oriented_sphere(v0->point(), v1->point(), v2->point(), v3->point(), p, perturb);
-}
-
-template < class Gt, class Tds, class Lds >
-Bounded_side
-Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
-side_of_circle(Cell_handle c, int i,
-               const Point & p, bool perturb) const
-  // precondition : dimension >=2
-  // in dimension 3, - for a finite facet
-  // returns ON_BOUNDARY if the point lies on the circle,
-  // ON_UNBOUNDED_SIDE when exterior, ON_BOUNDED_SIDE
-  // interior
-  // for an infinite facet, considers the plane defined by the
-  // adjacent finite facet of the same cell, and does the same as in
-  // dimension 2 in this plane
-  // in dimension 2, for an infinite facet
-  // in this case, returns ON_BOUNDARY if the point lies on the
-  // finite edge (endpoints included)
-  // ON_BOUNDED_SIDE for a point in the open half-plane
-  // ON_UNBOUNDED_SIDE elsewhere
-{
-  CGAL_triangulation_precondition( dimension() >= 2 );
-  int i3 = 5;
-
-  if ( dimension() == 2 ) {
-    CGAL_triangulation_precondition( i == 3 );
-    // the triangulation is supposed to be valid, ie the facet
-    // with vertices 0 1 2 in this order is positively oriented
-    if ( ! c->has_vertex( infinite_vertex(), i3 ) )
-      return coplanar_side_of_bounded_circle( c->vertex(0)->point(),
-                                              c->vertex(1)->point(),
-                                              c->vertex(2)->point(),
-                                              p, perturb);
-    // else infinite facet
-    // v1, v2 finite vertices of the facet such that v1,v2,infinite
-    // is positively oriented
-    Vertex_handle v1 = c->vertex( ccw(i3) ),
-                  v2 = c->vertex( cw(i3) );
-    CGAL_triangulation_assertion(coplanar_orientation(v1->point(), v2->point(),
-                                 mirror_vertex(c, i3)->point()) == NEGATIVE);
-    Orientation o = coplanar_orientation(v1->point(), v2->point(), p);
-    if ( o != COLLINEAR )
-        return Bounded_side( o );
-    // because p is in f iff
-    // it does not lie on the same side of v1v2 as vn
-    int i_e;
-    Locate_type lt;
-    // case when p collinear with v1v2
-    return side_of_segment( p,
-                            v1->point(), v2->point(),
-                            lt, i_e );
-  }
-
-  // else dimension == 3
-  CGAL_triangulation_precondition( i >= 0 && i < 4 );
-  if ( ( ! c->has_vertex(infinite_vertex(),i3) ) || ( i3 != i ) ) {
-    // finite facet
-    // initialization of i0 i1 i2, vertices of the facet positively
-    // oriented (if the triangulation is valid)
-    int i0 = (i>0) ? 0 : 1;
-    int i1 = (i>1) ? 1 : 2;
-    int i2 = (i>2) ? 2 : 3;
-    CGAL_triangulation_precondition( coplanar( c->vertex(i0)->point(),
-                                               c->vertex(i1)->point(),
-                                               c->vertex(i2)->point(),
-                                               p ) );
-    return coplanar_side_of_bounded_circle( c->vertex(i0)->point(),
-                                            c->vertex(i1)->point(),
-                                            c->vertex(i2)->point(),
-                                            p, perturb);
-  }
-
-  //else infinite facet
-  // v1, v2 finite vertices of the facet such that v1,v2,infinite
-  // is positively oriented
-  Vertex_handle v1 = c->vertex( next_around_edge(i3,i) ),
-                v2 = c->vertex( next_around_edge(i,i3) );
-  Orientation o = (Orientation)
-                  (coplanar_orientation( v1->point(), v2->point(),
-                                         c->vertex(i)->point()) *
-                  coplanar_orientation( v1->point(), v2->point(), p ));
-  // then the code is duplicated from 2d case
-  if ( o != COLLINEAR )
-      return Bounded_side( -o );
-  // because p is in f iff
-  // it is not on the same side of v1v2 as c->vertex(i)
-  int i_e;
-  Locate_type lt;
-  // case when p collinear with v1v2
-  return side_of_segment( p,
-                          v1->point(), v2->point(),
-                          lt, i_e );
-}
-
-template < class Gt, class Tds, class Lds >
-typename Delaunay_triangulation_3<Gt,Tds,Default,Lds>::Vertex_handle
-Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
-nearest_vertex_in_cell(const Point& p, Cell_handle c) const
-// Returns the finite vertex of the cell c which is the closest to p.
-{
-    CGAL_triangulation_precondition(dimension() >= 0);
-
-    Vertex_handle nearest = nearest_vertex(p, c->vertex(0), c->vertex(1));
-    if (dimension() >= 2) {
-        nearest = nearest_vertex(p, nearest, c->vertex(2));
-        if (dimension() == 3)
-            nearest = nearest_vertex(p, nearest, c->vertex(3));
-    }
-    return nearest;
-}
-
-template < class Gt, class Tds, class Lds >
-typename Delaunay_triangulation_3<Gt,Tds,Default,Lds>::Vertex_handle
-Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
-nearest_vertex(const Point& p, Cell_handle start) const
-{
-    if (number_of_vertices() == 0)
-        return Vertex_handle();
-
-    // Use a brute-force algorithm if dimension < 3.
-    if (dimension() < 3) {
-        Finite_vertices_iterator vit = finite_vertices_begin();
-        Vertex_handle res = vit;
-        ++vit;
-        for (Finite_vertices_iterator end = finite_vertices_end(); vit != end; ++vit)
-            res = nearest_vertex(p, res, vit);
-        return res;
-    }
-
-    Locate_type lt;
-    int li, lj;
-    Cell_handle c = locate(p, lt, li, lj, start);
-    if (lt == Tr_Base::VERTEX)
-        return c->vertex(li);
-
-    // - start with the closest vertex from the located cell.
-    // - repeatedly take the nearest of its incident vertices if any
-    // - if not, we're done.
-    Vertex_handle nearest = nearest_vertex_in_cell(p, c);
-    std::vector<Vertex_handle> vs;
-    vs.reserve(32);
-    while (true) {
-        Vertex_handle tmp = nearest;
-        adjacent_vertices(nearest, std::back_inserter(vs));
-        for (typename std::vector<Vertex_handle>::const_iterator
-                vsit = vs.begin(); vsit != vs.end(); ++vsit)
-            tmp = nearest_vertex(p, tmp, *vsit);
-        if (tmp == nearest)
-            break;
-        vs.clear();
-        nearest = tmp;
-    }
-
-    return nearest;
-}
-
-// This is not a fast version.
-// The optimized version needs an int for book-keeping in
-// tds() so as to avoiding the need to clear
-// the tds marker in each cell (which is an unsigned char)
-// Also the visitor in TDS could be more clever.
-// The Delaunay triangulation which filters displacements
-// will do these optimizations.
-template <class Gt, class Tds, class Lds >
-bool
-Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
-is_delaunay_after_displacement(Vertex_handle v, const Point &p) const
-{
-  CGAL_triangulation_precondition(!this->is_infinite(v));
-  CGAL_triangulation_precondition(this->dimension() == 2);
-  CGAL_triangulation_precondition(!this->test_dim_down(v));
-        if(v->point() == p) return true;
-  Point ant = v->point();
-  v->set_point(p);
-
-  std::size_t size;
-
-  // are incident cells well-oriented
-  std::vector<Cell_handle> cells;
-  cells.reserve(64);
-  this->incident_cells(v, std::back_inserter(cells));
-  size = cells.size();
-  for(std::size_t i=0; i<size; i++)
-  {
-    Cell_handle c = cells[i];
-    if(this->is_infinite(c)) continue;
-    if(this->orientation(c->vertex(0)->point(), c->vertex(1)->point(),
-                         c->vertex(2)->point(), c->vertex(3)->point())
-       != POSITIVE)
-    {
-      v->set_point(ant);
-      return false;
-    }
-  }
-
-  // are incident bi-cells Delaunay?
-  std::vector<Facet> facets;
-  facets.reserve(128);
-  this->incident_facets(v, std::back_inserter(facets));
-  size = facets.size();
-  for(std::size_t i=0; i<size; i++)
-  {
-    const Facet &f = facets[i];
-    Cell_handle c = f.first;
-    int j = f.second;
-    Cell_handle cj = c->neighbor(j);
-    int mj = this->mirror_index(c, j);
-    Vertex_handle h1 = c->vertex(j);
-    if(this->is_infinite(h1)) {
-      if(this->side_of_sphere(c, cj->vertex(mj)->point(), true)
-         != ON_UNBOUNDED_SIDE) {
-        v->set_point(ant);
-        return false;
-      }
-    } else {
-      if(this->side_of_sphere(cj, h1->point(), true) != ON_UNBOUNDED_SIDE) {
-        v->set_point(ant);
-        return false;
-      }
-    }
-  }
-
-  v->set_point(ant);
-  return true;
-}
-
-template < class Gt, class Tds, class Lds >
-bool
-Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
-is_Gabriel(const Facet& f) const
-{
-  return is_Gabriel(f.first, f.second);
-}
-
-template < class Gt, class Tds, class Lds >
-bool
-Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
-is_Gabriel(Cell_handle c, int i) const
-{
-  CGAL_triangulation_precondition(dimension() == 3 && !is_infinite(c,i));
-  typename Geom_traits::Side_of_bounded_sphere_3
-    side_of_bounded_sphere =
-    geom_traits().side_of_bounded_sphere_3_object();
-
-  if ((!is_infinite(c->vertex(i))) &&
-      side_of_bounded_sphere (
-        c->vertex(vertex_triple_index(i,0))->point(),
-        c->vertex(vertex_triple_index(i,1))->point(),
-        c->vertex(vertex_triple_index(i,2))->point(),
-        c->vertex(i)->point()) == ON_BOUNDED_SIDE ) return false;
-    Cell_handle neighbor = c->neighbor(i);
-  int in = neighbor->index(c);
-
-  if ((!is_infinite(neighbor->vertex(in))) &&
-      side_of_bounded_sphere(
-         c->vertex(vertex_triple_index(i,0))->point(),
-         c->vertex(vertex_triple_index(i,1))->point(),
-         c->vertex(vertex_triple_index(i,2))->point(),
-         neighbor->vertex(in)->point()) == ON_BOUNDED_SIDE ) return false;
-
-  return true;
-}
-
-template < class Gt, class Tds, class Lds >
-bool
-Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
-is_Gabriel(const Edge& e) const
-{
-  return is_Gabriel(e.first, e.second, e.third);
-}
-
-template < class Gt, class Tds, class Lds >
-bool
-Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
-is_Gabriel(Cell_handle c, int i, int j) const
-{
-  CGAL_triangulation_precondition(dimension() == 3 && !is_infinite(c,i,j));
-  typename Geom_traits::Side_of_bounded_sphere_3
-    side_of_bounded_sphere =
-    geom_traits().side_of_bounded_sphere_3_object();
-
-  Facet_circulator fcirc = incident_facets(c,i,j),
-                   fdone(fcirc);
-  Vertex_handle v1 = c->vertex(i);
-  Vertex_handle v2 = c->vertex(j);
-  do {
-      // test whether the vertex of cc opposite to *fcirc
-      // is inside the sphere defined by the edge e = (s, i,j)
-      Cell_handle cc = (*fcirc).first;
-      int ii = (*fcirc).second;
-      if (!is_infinite(cc->vertex(ii)) &&
-           side_of_bounded_sphere( v1->point(),
-                                   v2->point(),
-                                   cc->vertex(ii)->point())
-          == ON_BOUNDED_SIDE ) return false;
-  } while(++fcirc != fdone);
-  return true;
-}
-
-template < class Gt, class Tds, class Lds >
-typename Delaunay_triangulation_3<Gt,Tds,Default,Lds>::Point
-Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
-dual(Cell_handle c) const
-{
-  CGAL_triangulation_precondition(dimension()==3);
-  CGAL_triangulation_precondition( ! is_infinite(c) );
-  return c->circumcenter(geom_traits());
-}
-
-
-template < class Gt, class Tds, class Lds >
-typename Delaunay_triangulation_3<Gt,Tds,Default,Lds>::Object
-Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
-dual(Cell_handle c, int i) const
-{
-  CGAL_triangulation_precondition(dimension()>=2);
-  CGAL_triangulation_precondition( ! is_infinite(c,i) );
-
-  if ( dimension() == 2 ) {
-    CGAL_triangulation_precondition( i == 3 );
-    return construct_object( construct_circumcenter(c->vertex(0)->point(),
-                                                    c->vertex(1)->point(),
-                                                    c->vertex(2)->point()) );
-  }
-
-  // dimension() == 3
-  Cell_handle n = c->neighbor(i);
-  if ( ! is_infinite(c) && ! is_infinite(n) )
-    return construct_object(construct_segment( dual(c), dual(n) ));
-
-  // either n or c is infinite
-  int in;
-  if ( is_infinite(c) )
-    in = n->index(c);
-  else {
-    n = c;
-    in = i;
-  }
-  // n now denotes a finite cell, either c or c->neighbor(i)
-  int ind[3] = {(in+1)&3,(in+2)&3,(in+3)&3};
-  if ( (in&1) == 1 )
-      std::swap(ind[0], ind[1]);
-  // in=0: 1 2 3
-  // in=1: 3 2 0
-  // in=2: 3 0 1
-  // in=3: 1 0 2
-  const Point& p = n->vertex(ind[0])->point();
-  const Point& q = n->vertex(ind[1])->point();
-  const Point& r = n->vertex(ind[2])->point();
-
-  Line l = construct_equidistant_line( p, q, r );
-  return construct_object(construct_ray( dual(n), l));
-}
-
-
-
-template < class Gt, class Tds, class Lds >
-typename Delaunay_triangulation_3<Gt,Tds,Default,Lds>::Line
-Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
-dual_support(Cell_handle c, int i) const
-{
-  CGAL_triangulation_precondition(dimension()>=2);
-  CGAL_triangulation_precondition( ! is_infinite(c,i) );
-
-  if ( dimension() == 2 ) {
-    CGAL_triangulation_precondition( i == 3 );
-    return construct_equidistant_line( c->vertex(0)->point(),
-                                       c->vertex(1)->point(),
-                                       c->vertex(2)->point() );
-  }
-
-  return construct_equidistant_line( c->vertex((i+1)&3)->point(),
-                                     c->vertex((i+2)&3)->point(),
-                                     c->vertex((i+3)&3)->point() );
-}
-
-
-template < class Gt, class Tds, class Lds >
-bool
-Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
-is_valid(bool verbose, int level) const
-{
-  if ( ! tds().is_valid(verbose,level) ) {
-    if (verbose)
-        std::cerr << "invalid data structure" << std::endl;
-    CGAL_triangulation_assertion(false);
-    return false;
-  }
-
-  if ( infinite_vertex() == Vertex_handle() ) {
-    if (verbose)
-        std::cerr << "no infinite vertex" << std::endl;
-    CGAL_triangulation_assertion(false);
-    return false;
-  }
-
-  switch ( dimension() ) {
-  case 3:
-    {
-      for(Finite_cells_iterator it = finite_cells_begin(), end = finite_cells_end(); it != end; ++it) {
-        is_valid_finite(it);
-        for(int i=0; i<4; i++ ) {
-          if ( !is_infinite
-               (it->neighbor(i)->vertex(it->neighbor(i)->index(it))) ) {
-            if ( side_of_sphere
-                 (it,
-                  it->neighbor(i)->vertex(it->neighbor(i)->index(it))->point())
-                 == ON_BOUNDED_SIDE ) {
-              if (verbose)
-                std::cerr << "non-empty sphere " << std::endl;
-              CGAL_triangulation_assertion(false);
-              return false;
-            }
-          }
-        }
-      }
-      break;
-    }
-  case 2:
-    {
-      for(Finite_facets_iterator it = finite_facets_begin(), end = finite_facets_end(); it != end; ++it) {
-        is_valid_finite((*it).first);
-        for(int i=0; i<3; i++ ) {
-          if( !is_infinite
-              ((*it).first->neighbor(i)->vertex( (((*it).first)->neighbor(i))
-                                                 ->index((*it).first))) ) {
-            if ( side_of_circle ( (*it).first, 3,
-                                  (*it).first->neighbor(i)->
-                                  vertex( (((*it).first)->neighbor(i))
-                                          ->index((*it).first) )->point() )
-                 == ON_BOUNDED_SIDE ) {
-              if (verbose)
-                std::cerr << "non-empty circle " << std::endl;
-              CGAL_triangulation_assertion(false);
-              return false;
-            }
-          }
-        }
-      }
-      break;
-    }
-  case 1:
-    {
-      for(Finite_edges_iterator it = finite_edges_begin(), end = finite_edges_end(); it != end; ++it)
-        is_valid_finite((*it).first);
-      break;
-    }
-  }
-  if (verbose)
-      std::cerr << "Delaunay valid triangulation" << std::endl;
-  return true;
-}
-
-template < class Gt, class Tds, class Lds >
-bool
-Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
-is_valid(Cell_handle c, bool verbose, int level) const
-{
-  if ( ! Tr_Base::is_valid(c,verbose,level) ) {
-    if (verbose) {
-      std::cerr << "combinatorically invalid cell" ;
-      for (int i=0; i <= dimension(); i++ )
-        std::cerr << c->vertex(i)->point() << ", " ;
-      std::cerr << std::endl;
-    }
-    CGAL_triangulation_assertion(false);
-    return false;
-  }
-  switch ( dimension() ) {
-  case 3:
-    {
-      if ( ! is_infinite(c) ) {
-        is_valid_finite(c,verbose,level);
-        for (int i=0; i<4; i++ ) {
-          if (side_of_sphere(c, c->vertex((c->neighbor(i))->index(c))->point())
-              == ON_BOUNDED_SIDE ) {
-            if (verbose)
-                std::cerr << "non-empty sphere " << std::endl;
-            CGAL_triangulation_assertion(false);
-            return false;
-          }
-        }
-      }
-      break;
-    }
-  case 2:
-    {
-      if ( ! is_infinite(c,3) ) {
-        for (int i=0; i<2; i++ ) {
-          if (side_of_circle(c, 3, c->vertex(c->neighbor(i)->index(c))->point())
-               == ON_BOUNDED_SIDE ) {
-            if (verbose)
-                std::cerr << "non-empty circle " << std::endl;
-            CGAL_triangulation_assertion(false);
-            return false;
-          }
-        }
-      }
-      break;
-    }
-  }
-  if (verbose)
-      std::cerr << "Delaunay valid cell" << std::endl;
-  return true;
-}
-
-} //namespace CGAL
-
-#include <CGAL/internal/Delaunay_triangulation_hierarchy_3.h>
-
-#endif // CGAL_DELAUNAY_TRIANGULATION_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Diagonalize_traits.h b/3rdparty/CGAL-4.8/include/CGAL/Diagonalize_traits.h
deleted file mode 100644
index 16773f1..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Diagonalize_traits.h
+++ /dev/null
@@ -1,271 +0,0 @@
-// Copyright (c) 2015 GeometryFactory (France), All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Simon Giraudot
-
-
-#ifndef CGAL_DIAGONALIZE_TRAITS_H
-#define CGAL_DIAGONALIZE_TRAITS_H
-
-#include <CGAL/array.h>
-
-namespace CGAL {
-
-  /// A model of the concept `DiagonalizeTraits` 
-  /// \cgalModels `DiagonalizeTraits`
-
-template <typename FT, unsigned int dim = 3>
-class Diagonalize_traits{
-
-public:
-  
-    typedef cpp11::array<FT, dim> Vector;
-    typedef cpp11::array<FT, dim*dim> Matrix;
-    typedef cpp11::array<FT, (dim * (dim+1) / 2)> Covariance_matrix;
-
-    static bool
-    diagonalize_selfadjoint_covariance_matrix
-      (const Covariance_matrix& cov,
-       Vector& eigenvalues)
-    {
-      Matrix eigenvectors;
-      return diagonalize_selfadjoint_covariance_matrix (cov, eigenvalues, eigenvectors);
-    }
-
-    // Extract the eigenvector associated to the largest eigenvalue
-    static bool
-    extract_largest_eigenvector_of_covariance_matrix
-      (const Covariance_matrix& cov,
-       Vector& normal)
-    {
-      Vector eigenvalues;
-      Matrix eigenvectors;
-
-      diagonalize_selfadjoint_covariance_matrix (cov, eigenvalues, eigenvectors);
-
-      for (std::size_t i = 0; i < dim; ++ i)
-	normal[i] = static_cast<FT> (eigenvectors[(dim*(dim-1))+i]);
-
-      return true;
-    }
-
-    static bool diagonalize_selfadjoint_covariance_matrix
-       (const Covariance_matrix& mat,
-	Vector& eigen_values,
-	Matrix& eigen_vectors)
-    {
-      const int n = dim;
-      
-      const int MAX_ITER = 100;
-      static const FT EPSILON = (FT)0.00001;
-      
-      // number of entries in mat
-      int nn = (n*(n+1))/2;
-      
-      // copy matrix
-      FT *a = new FT[nn];
-      int ij;
-
-      // This function requires lower triangular, so we switch
-      for (int i = 0; i < n; ++ i)
-	for (int j = i; j < n; ++ j)
-	  a[(n * i) + j - ((i * (i+1)) / 2)]
-	    = mat[i + (j * (j+1) / 2)];
-
-      // Fortran-porting
-      a--;
-      
-      // init diagonalization matrix as the unit matrix
-      FT *v = new FT[n*n];
-      ij = 0;
-      int i;
-      for(i=0; i<n; i++)
-	for(int j=0; j<n; j++) 
-	  if(i==j)
-	    v[ij++] = 1.0;
-	  else
-	    v[ij++] = 0.0;
-      // Fortran-porting
-      v--;
-      
-      // compute weight of the non diagonal terms 
-      ij = 1;
-      FT a_norm = 0.0;
-      for(i=1; i<=n; i++)
-	for(int j=1; j<=i; j++) 
-	  {
-	    if( i!=j ) 
-	      {
-		FT a_ij = a[ij];
-		a_norm += a_ij * a_ij;
-	      }
-	    ij++;
-	  }
-      
-      if(a_norm != 0.0) 
-	{
-	  FT a_normEPS = a_norm * EPSILON;
-	  FT thr = a_norm;
-  
-	  // rotations
-	  int nb_iter = 0;
-	  while(thr > a_normEPS && nb_iter < MAX_ITER) 
-	    {
-	      nb_iter++;
-	      FT thr_nn = thr / nn;
-          
-	      for(int l=1; l< n; l++) 
-		{
-		  for(int m=l+1; m<=n; m++) 
-		    {
-		      // compute sinx and cosx 
-		      int lq = (l*l-l)/2;
-		      int mq = (m*m-m)/2;
-          
-		      int lm = l + mq;
-		      FT a_lm = a[lm];
-		      FT a_lm_2 = a_lm * a_lm;
-          
-		      if(a_lm_2 < thr_nn)
-			continue;
-          
-		      int ll   = l + lq;
-		      int mm   = m + mq;
-		      FT a_ll = a[ll];
-		      FT a_mm = a[mm];
-          
-		      FT delta = a_ll - a_mm;
-          
-		      FT x;
-		      if(delta == 0.0)
-			x = (FT) - CGAL_PI / 4; 
-		      else 
-			x = (FT)(- std::atan( (a_lm+a_lm) / delta ) / 2.0);
-
-		      FT sinx    = std::sin(x);
-		      FT cosx    = std::cos(x);
-		      FT sinx_2  = sinx * sinx;
-		      FT cosx_2  = cosx * cosx;
-		      FT sincos  = sinx * cosx;
-          
-		      // rotate L and M columns 
-		      int ilv = n*(l-1);
-		      int imv = n*(m-1);
-          
-		      int i;
-		      for( i=1; i<=n;i++ ) 
-			{
-			  if( (i!=l) && (i!=m) ) 
-			    {
-			      int iq = (i*i-i)/2;
-              
-			      int im;
-			      if( i<m )  
-				im = i + mq; 
-			      else
-				im = m + iq;
-			      FT a_im = a[im];
-              
-			      int il;
-			      if( i<l ) 
-				il = i + lq; 
-			      else 
-				il = l + iq;
-			      FT a_il = a[il];
-              
-			      a[il] = a_il * cosx - a_im * sinx;
-			      a[im] = a_il * sinx + a_im * cosx;
-			    }
-            
-			  ilv++;
-			  imv++;
-            
-			  FT v_ilv = v[ilv];
-			  FT v_imv = v[imv];
-            
-			  v[ilv] = cosx * v_ilv - sinx * v_imv;
-			  v[imv] = sinx * v_ilv + cosx * v_imv;
-			} 
-          
-		      x = a_lm * sincos; 
-		      x += x;
-          
-		      a[ll] =  a_ll * cosx_2 + a_mm * sinx_2 - x;
-		      a[mm] =  a_ll * sinx_2 + a_mm * cosx_2 + x;
-		      a[lm] =  0.0;
-          
-		      thr = CGAL::abs(thr - a_lm_2);
-		    }
-		}
-	    }         
-	}
-      
-      // convert indices and copy eigen values 
-      a++;
-      for(i=0; i<n; i++) 
-	{
-	  int k = i + (i*(i+1))/2;
-	  eigen_values[i] = a[k];
-	}
-      delete [] a;
-      
-      // sort eigen values and vectors 
-      int *index = new int[n];
-      for(i=0; i<n; i++)
-	index[i] = i;
-      
-      for(i=0; i<(n-1); i++)
-	{
-	  FT x = eigen_values[i];
-	  int k = i;
-        
-	  for(int j=i+1; j<n; j++) 
-	    if(x > eigen_values[j]) 
-	      {
-		k = j;
-		x = eigen_values[j];
-	      }
-        
-	  eigen_values[k] = eigen_values[i];
-	  eigen_values[i] = x;
-      
-	  int jj = index[k];
-	  index[k] = index[i];
-	  index[i] = jj;
-	}
-
-
-      // save eigen vectors 
-      v++; // back to C++
-      ij = 0;
-      for(int k=0; k<n; k++ ) 
-	{
-	  int ik = index[k]*n;
-	  for(int i=0; i<n; i++) 
-	    eigen_vectors[ij++] = v[ik++];
-	}
-  
-      delete [] v;
-      delete [] index;
-
-      return true;
-    }
-
-  };
-
-} // namespace CGAL
-
-#endif // CGAL_DIAGONALIZE_TRAITS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Envelope_3/set_dividors.h b/3rdparty/CGAL-4.8/include/CGAL/Envelope_3/set_dividors.h
deleted file mode 100644
index 0bd1143..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Envelope_3/set_dividors.h
+++ /dev/null
@@ -1,120 +0,0 @@
-// Copyright (c) 2005  Tel-Aviv University (Israel).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Michal Meyerovitch     <gorgymic at post.tau.ac.il>
-//                 Baruch Zukerman        <baruchzu at post.tau.ac.il>
-
-#ifndef CGAL_ENVELOPE_SET_DIVIDORS_H
-#define CGAL_ENVELOPE_SET_DIVIDORS_H
-
-#include <CGAL/Random.h>
-
-namespace CGAL
-{
-namespace Envelope_3
-{
-
-//! All even-indexed elements are stored in the first sequence and all the 
-//  odd-indexed are stored in the second sequence.
-class Arbitrary_dividor
-{
-public:
-
-  template <class InputIterator, class OutputIterator>
-  void operator()(InputIterator begin, InputIterator end,
-                  OutputIterator set1, OutputIterator set2)
-  {
-    bool set_first = true;
-    for(; begin != end; ++begin, set_first = !set_first)
-      if (set_first)
-        *set1++ = *begin;
-      else
-        *set2++ = *begin;
-
-  }
-  
-};
-
-//! The last element is stored in the second sequence and all the other (n-1) 
-//  elments are stored in the first sequence.
-class Incremental_dividor
-{
-public:
-
-  template <class InputIterator, class OutputIterator>
-  void operator()(InputIterator begin, InputIterator end,
-                  OutputIterator set1, OutputIterator set2)
-  {
-    std::size_t i, n = std::distance(begin, end);
-    // all items but the last go to the first set
-    for(i=0; i<(n-1); ++i, ++begin)
-      *set1++ = *begin;
-    // the last item goes to the second set
-    *set2++ = *begin;
-  }
-
-};
-
-//! The elements are divided exactly in the middle.
-class Middle_dividor
-{
-public:
-
-  template <class InputIterator, class OutputIterator>
-  void operator()(InputIterator begin, InputIterator end,
-                  OutputIterator set1, OutputIterator set2)
-  {
-    std::size_t i, n = std::distance(begin, end);
-
-    for(i=0; i < n; ++i, ++begin)
-    {
-      if (i < n/2)
-        *set1++ = *begin;
-      else
-        *set2++ = *begin;
-    }
-  }
-
-};
-
-//! The elements are divided randomly
-class Random_dividor
-{
-public:
-  
-  template <class InputIterator, class OutputIterator>
-  void operator()(InputIterator begin, InputIterator end,
-                  OutputIterator set1, OutputIterator set2)
-  {
-    while (begin != end)
-    {
-      
-      if (CGAL::default_random.get_bool())
-        *set1++ = *begin++;
-      else
-        *set2++ = *begin++;
-    }
-  }
-
-};
-
-
-} // namespace Envelope_3
-} // namespace CGAL
-
-#endif 
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Euclidean_distance.h b/3rdparty/CGAL-4.8/include/CGAL/Euclidean_distance.h
deleted file mode 100644
index f67359d..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Euclidean_distance.h
+++ /dev/null
@@ -1,205 +0,0 @@
-// Copyright (c) 2002,2011 Utrecht University (The Netherlands).
-// 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
-// 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(s)     : Hans Tangelder (<hanst at cs.uu.nl>)
-
-
-#ifndef CGAL_EUCLIDEAN_DISTANCE_H
-#define CGAL_EUCLIDEAN_DISTANCE_H
-
-#include <CGAL/Kd_tree_rectangle.h>
-#include <CGAL/number_utils.h>
-#include <CGAL/internal/Get_dimension_tag.h>
-
-
-namespace CGAL {
-
-  template <class SearchTraits>
-  class Euclidean_distance;
-
-    
-  namespace internal{
-    template <class SearchTraits>
-    struct Spatial_searching_default_distance{
-      typedef ::CGAL::Euclidean_distance<SearchTraits> type;
-    };
-  } //namespace internal
-
-  template <class SearchTraits>
-  class Euclidean_distance {
-    
-    SearchTraits traits;
-    
-    public:
-
-    typedef typename SearchTraits::FT    FT;
-    typedef typename SearchTraits::Point_d Point_d;
-    typedef Point_d Query_item;
-
-    typedef typename internal::Get_dimension_tag<SearchTraits>::Dimension D;
-	
-
-    // default constructor
-    Euclidean_distance(const SearchTraits& traits_=SearchTraits()):traits(traits_) {}
-
-    
-    inline FT transformed_distance(const Query_item& q, const Point_d& p) const {
-        return transformed_distance(q,p, D());
-    }
-
-    //Dynamic version for runtime dimension
-    inline FT transformed_distance(const Query_item& q, const Point_d& p, Dynamic_dimension_tag) const {
-        FT distance = FT(0);
-	typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object();
-        typename SearchTraits::Cartesian_const_iterator_d qit = construct_it(q),
-	qe = construct_it(q,1), pit = construct_it(p);
-	for(; qit != qe; qit++, pit++){
-	    distance += ((*qit)-(*pit))*((*qit)-(*pit));
-	}
-        return distance;
-    }
-
-    //Generic version for DIM > 3
-    template < int DIM >
-    inline FT transformed_distance(const Query_item& q, const Point_d& p, Dimension_tag<DIM>) const {
-        FT distance = FT(0);
-        typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object();
-        typename SearchTraits::Cartesian_const_iterator_d qit = construct_it(q),
-          qe = construct_it(q,1), pit = construct_it(p);
-        for(; qit != qe; qit++, pit++){
-	  distance += ((*qit)-(*pit))*((*qit)-(*pit));
-        }
-        return distance;
-    }
-
-    //DIM = 2 loop unrolled
-    inline FT transformed_distance(const Query_item& q, const Point_d& p, Dimension_tag<2> ) const {
-        typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object();
-        typename SearchTraits::Cartesian_const_iterator_d qit = construct_it(q),pit = construct_it(p);
-        FT distance = square(*qit - *pit);
-        qit++;pit++;
-        distance += square(*qit - *pit);
-        return distance;
-    }
-
-    //DIM = 3 loop unrolled
-    inline FT transformed_distance(const Query_item& q, const Point_d& p, Dimension_tag<3> ) const {
-        typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object();
-        typename SearchTraits::Cartesian_const_iterator_d qit = construct_it(q),pit = construct_it(p);
-        FT distance = square(*qit - *pit);
-        qit++;pit++;
-        distance += square(*qit - *pit);
-        qit++;pit++;
-        distance += square(*qit - *pit);
-        return distance;
-    }
-
- 
-
-
-	inline FT min_distance_to_rectangle(const Query_item& q,
-					    const Kd_tree_rectangle<FT,D>& r) const {
-		FT distance = FT(0);
-		typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object();
-                typename SearchTraits::Cartesian_const_iterator_d qit = construct_it(q),
-		  qe = construct_it(q,1);
-		for(unsigned int i = 0;qit != qe; i++, qit++){
-		  if((*qit) < r.min_coord(i))
-				distance += 
-				(r.min_coord(i)-(*qit))*(r.min_coord(i)-(*qit));
-		  else if ((*qit) > r.max_coord(i))
-				distance +=  
-				((*qit)-r.max_coord(i))*((*qit)-r.max_coord(i));
-			
-		}
-		return distance;
-	}
-
-        inline FT min_distance_to_rectangle(const Query_item& q,
-					    const Kd_tree_rectangle<FT,D>& r,std::vector<FT>& dists) {
-		FT distance = FT(0);
-		typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object();
-                typename SearchTraits::Cartesian_const_iterator_d qit = construct_it(q),
-		  qe = construct_it(q,1);
-		for(unsigned int i = 0;qit != qe; i++, qit++){
-		  if((*qit) < r.min_coord(i)){
-                                dists[i] = (r.min_coord(i)-(*qit));
-				distance += dists[i] * dists[i];
-                  }
-		  else if ((*qit) > r.max_coord(i)){
-                                dists[i] = ((*qit)-r.max_coord(i));
-				distance +=  dists[i] * dists[i];
-                  }
-			
-		}
-		return distance;
-	}
-
-	inline FT max_distance_to_rectangle(const Query_item& q,
-					     const Kd_tree_rectangle<FT,D>& r) const {
-		FT distance=FT(0);
-		typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object();
-                typename SearchTraits::Cartesian_const_iterator_d qit = construct_it(q),
-		  qe = construct_it(q,1);
-		for(unsigned int i = 0;qit != qe; i++, qit++){
-				if ((*qit) <= (r.min_coord(i)+r.max_coord(i))/FT(2.0))
-					distance += (r.max_coord(i)-(*qit))*(r.max_coord(i)-(*qit));
-				else
-					distance += ((*qit)-r.min_coord(i))*((*qit)-r.min_coord(i));
-		};
-		return distance;
-	}
-
-        inline FT max_distance_to_rectangle(const Query_item& q,
-					     const Kd_tree_rectangle<FT,D>& r,std::vector<FT>& dists ) {
-		FT distance=FT(0);
-		typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object();
-                typename SearchTraits::Cartesian_const_iterator_d qit = construct_it(q),
-		  qe = construct_it(q,1);
-		for(unsigned int i = 0;qit != qe; i++, qit++){
-				if ((*qit) <= (r.min_coord(i)+r.max_coord(i))/FT(2.0)){
-                                        dists[i] = (r.max_coord(i)-(*qit));
-					distance += dists[i] * dists[i];
-                                }
-				else{
-                                        dists[i] = ((*qit)-r.min_coord(i));
-					distance += dists[i] * dists[i];
-                                }
-		};
-		return distance;
-	}
-
-	inline FT new_distance(FT dist, FT old_off, FT new_off,
-			       int /* cutting_dimension */)  const {
-		
-		FT new_dist = dist + (new_off*new_off - old_off*old_off);
-                return new_dist;
-	}
-
-  inline FT transformed_distance(FT d) const {
-		return d*d;
-	}
-
-  inline FT inverse_of_transformed_distance(FT d) const {
-		return CGAL::sqrt(d);
-	}
-
-  }; // class Euclidean_distance
-
-} // namespace CGAL
-#endif // EUCLIDEAN_DISTANCE_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Euclidean_distance_sphere_point.h b/3rdparty/CGAL-4.8/include/CGAL/Euclidean_distance_sphere_point.h
deleted file mode 100644
index 180cd93..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Euclidean_distance_sphere_point.h
+++ /dev/null
@@ -1,167 +0,0 @@
-// Copyright (c) 2002,2011 Utrecht University (The Netherlands).
-// 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
-// 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(s)     : Hans Tangelder (<hanst at cs.uu.nl>)
-
-
-#ifndef CGAL_EUCLIDEAN_DISTANCE_SPHERE_POINT_H
-#define CGAL_EUCLIDEAN_DISTANCE_SPHERE_POINT_H
-
-#include <CGAL/Kd_tree_rectangle.h>
-#include <CGAL/number_utils.h>
-#include <CGAL/internal/Get_dimension_tag.h>
-
-namespace CGAL {
-
-  template <class SearchTraits>
-  class Euclidean_distance_sphere_point {
-   
-    
-    SearchTraits traits;
-    
-    public:
-
-    typedef typename SearchTraits::Point_d Point_d;
-    typedef typename SearchTraits::Sphere_d Sphere_d;
-    typedef typename SearchTraits::FT    FT;
-    typedef typename SearchTraits::Construct_center_d Construct_center_d;
-    typedef typename SearchTraits::Compute_squared_radius_d Compute_squared_radius_d;
-    typedef typename SearchTraits::Construct_cartesian_const_iterator_d Construct_cartesian_const_iterator_d;
-    typedef typename SearchTraits::Cartesian_const_iterator_d Cartesian_const_iterator_d;
-    typedef Sphere_d Query_item;   
-    typedef typename internal::Get_dimension_tag<SearchTraits>::Dimension Dimension;
-    public:
-
-    	// default constructor
-    	Euclidean_distance_sphere_point(const SearchTraits& traits_=SearchTraits()):traits(traits_) {}
-
-
-	inline FT transformed_distance(const Sphere_d& q, const Point_d& p) const {
-                Point_d c= Construct_center_d()(q);
-		FT distance = FT(0);
-		Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object();
-                Cartesian_const_iterator_d cit = construct_it(c),
-		  ce = construct_it(c,1), pit = construct_it(p);
-		for(; cit != ce; cit++, pit++){
-		  distance += ((*cit)-(*pit))*((*cit)-(*pit));
-		}
-                distance += - Compute_squared_radius_d()(q);
-                if (distance<0) distance=FT(0);
-        	return distance;
-	}
-
-
-	inline FT min_distance_to_rectangle(const Sphere_d& q,
-					     const Kd_tree_rectangle<FT,Dimension>& r) const {
-                Point_d c= Construct_center_d()(q);
-		FT distance = FT(0);
-		Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object();
-                Cartesian_const_iterator_d cit = construct_it(c),
-		  ce = construct_it(c,1);
-		for (unsigned int i = 0; cit != ce; ++i, ++cit) {
-			if ((*cit) < r.min_coord(i))
-				distance += 
-				(r.min_coord(i)-(*cit))*(r.min_coord(i)-(*cit));
-			else if ((*cit) > r.max_coord(i))
-				distance +=  
-				((*cit)-r.max_coord(i))*((*cit)-r.max_coord(i));
-			
-		};
-                distance += - Compute_squared_radius_d()(q);
-                if (distance<0) distance=FT(0);
-		return distance;
-	}
-
-        inline FT min_distance_to_rectangle(const Sphere_d& q,
-					     const Kd_tree_rectangle<FT,Dimension>& r,std::vector<FT>& dists) {
-                Point_d c= Construct_center_d()(q);
-		FT distance = FT(0);
-		Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object();
-                Cartesian_const_iterator_d cit = construct_it(c),
-		  ce = construct_it(c,1);
-		for (unsigned int i = 0; cit != ce; ++i, ++cit) {
-			if ((*cit) < r.min_coord(i)){
-                                dists[i] =(r.min_coord(i)-(*cit));
-				distance += dists[i] * dists[i];
-                        }
-			else if ((*cit) > r.max_coord(i)){
-                                dists[i] = ((*cit)-r.max_coord(i));
-				distance +=  dists[i] * dists[i];
-                        }			
-		};
-                distance += - Compute_squared_radius_d()(q);
-                if (distance<0) distance=FT(0);
-		return distance;
-	}
-
-	inline FT max_distance_to_rectangle(const Sphere_d& q,
-					      const Kd_tree_rectangle<FT,Dimension>& r) const {
-	  Construct_center_d construct_center_d;
-                Point_d c = construct_center_d(q);
-		FT distance=FT(0);
-		Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object();
-                Cartesian_const_iterator_d cit = construct_it(c),
-		  ce = construct_it(c,1);
-		for (unsigned int i = 0; cit != ce; ++i, ++cit) {
-				if ((*cit) <= (r.min_coord(i)+r.max_coord(i))/FT(2.0))
-					distance += (r.max_coord(i)-(*cit))*(r.max_coord(i)-(*cit));
-				else
-					distance += ((*cit)-r.min_coord(i))*((*cit)-r.min_coord(i));
-		};
-		distance += - Compute_squared_radius_d()(q);
-                if (distance<0) distance=FT(0);
-		return distance;
-	}
-
-        inline FT max_distance_to_rectangle(const Sphere_d& q,
-					      const Kd_tree_rectangle<FT,Dimension>& r,std::vector<FT>& dists) {
-	  Construct_center_d construct_center_d;
-                Point_d c = construct_center_d(q);
-		FT distance=FT(0);
-		Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object();
-                Cartesian_const_iterator_d cit = construct_it(c),
-		  ce = construct_it(c,1);
-		for (unsigned int i = 0; cit != ce; ++i, ++cit) {
-				if ((*cit) <= (r.min_coord(i)+r.max_coord(i))/FT(2.0)){
-                                        dists[i] = (r.max_coord(i)-(*cit));
-					distance += dists[i] * dists[i];
-                                }
-				else{
-                                        dists[i] = ((*cit)-r.min_coord(i));
-					distance += dists[i] * dists[i];
-                                }
-		};
-		distance += - Compute_squared_radius_d()(q);
-                if (distance<0) distance=FT(0);
-		return distance;
-	}
-
-
-
-  inline FT transformed_distance(FT d) const {
-		return d*d;
-	}
-
-  inline FT inverse_of_transformed_distance(FT d) const {
-		return CGAL::sqrt(d);
-	}
-
-  }; // class Euclidean_distance_sphere_point
-
-} // namespace CGAL
-#endif // EUCLIDEAN_DISTANCE_SPHERE_POINT_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Exact_circular_kernel_2.h b/3rdparty/CGAL-4.8/include/CGAL/Exact_circular_kernel_2.h
deleted file mode 100644
index b253711..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Exact_circular_kernel_2.h
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright (c) 2003-2008  INRIA Sophia-Antipolis (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
-// 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(s)     : Monique Teillaud, Sylvain Pion, Pedro Machado
-
-// Partially supported by the IST Programme of the EU as a Shared-cost
-// RTD (FET Open) Project under Contract No  IST-2000-26473 
-// (ECG - Effective Computational Geometry for Curves and Surfaces) 
-// and a STREP (FET Open) Project under Contract No  IST-006413 
-// (ACS -- Algorithms for Complex Shapes)
-
-#ifndef CGAL_EXACT_CIRCULAR_2_KERNEL_H
-#define CGAL_EXACT_CIRCULAR_2_KERNEL_H
-
-#include <CGAL/Cartesian.h>
-#include <CGAL/Algebraic_kernel_for_circles_2_2.h>
-#include <CGAL/Circular_kernel_2.h>
-
-
-//TODO: CORRECT THE MAKE_ROOT_OF_2 of GMPq GMPz
-#ifdef CGAL_USE_GMP
-#  include <CGAL/Gmpq.h>
-#else
-
-#  include <CGAL/MP_Float.h>
-#  include <CGAL/Quotient.h>
-
-#endif
-
-
-// maybe it is better to change to the bbox filtered one
-//#include <CGAL/Lazy_circular_kernel_2.h>
-#include <CGAL/Filtered_bbox_circular_kernel_2.h>
-
-namespace CGAL {
-
-namespace internal {
-
-#ifdef CGAL_USE_GMP
-  typedef CGAL::Gmpq                                           NT1;
-#else
-
-  typedef Quotient<MP_Float>                       NT1;
-
-#endif
-
-  typedef Cartesian<NT1>                                 Linear_k1;
-  typedef Algebraic_kernel_for_circles_2_2<NT1>          Algebraic_k1;
-  typedef Circular_kernel_2<Linear_k1, Algebraic_k1>     CK1;
-
-//   typedef CGAL::Interval_nt_advanced                           NT2;
-//   typedef CGAL::Cartesian<NT2>                                 Linear_k2;
-//   typedef CGAL::Algebraic_kernel_for_circles_2_2<NT2>          Algebraic_k2;
-//   typedef CGAL::Circular_kernel_2<Linear_k2,Algebraic_k2>      CK2;
-
-//  typedef CGAL::Lazy_circular_kernel_2<CK1,CK2>
-//  Exact_circular_kernel_2;
-
-} // namespace internal
-
-typedef Filtered_bbox_circular_kernel_2<internal::CK1>   Exact_circular_kernel_2;
-
-} //namespace CGAL
-
-#endif // CGAL_EXACT_CIRCULAR_2_KERNEL_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/FPU.h b/3rdparty/CGAL-4.8/include/CGAL/FPU.h
deleted file mode 100644
index 94bedba..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/FPU.h
+++ /dev/null
@@ -1,539 +0,0 @@
-// Copyright (c) 1998-2008
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Sylvain Pion
-
-#ifndef CGAL_FPU_H
-#define CGAL_FPU_H
-
-#include <CGAL/assertions.h>
-
-#ifndef __INTEL_COMPILER
-#include <cmath> // for HUGE_VAL
-#endif
-
-// This file specifies some platform dependant functions, regarding the FPU
-// directed rounding modes.  There is only support for double precision.
-//
-// It also contains the definition of the Protect_FPU_rounding<> class,
-// which helps to protect blocks of code needing a particular rounding mode.
-
-#if defined __alpha__  && defined __linux__
-extern "C" {
-#  include <fenv.h>
-}
-#elif defined __SUNPRO_CC && defined __sun
-#  include <ieeefp.h>
-#elif defined __osf || defined __osf__
-#  ifdef __GNUG__
-     // GCC seems to remove (fixincludes) read_rnd/write_rnd...
-#    include "/usr/include/float.h"
-#  else
-#    include <cfloat>
-#  endif
-#elif defined _MSC_VER || defined __sparc__ || \
-     (defined __i386__ && !defined __PGI && !defined __SUNPRO_CC \
-      && !defined __SSE2__)
-   // Nothing to include.
-#else
-   // By default we use the ISO C99 version.
-#  include <fenv.h>
-#endif
-
-
-// Some useful constants
-
-#if defined CGAL_CFG_NO_LIMITS
-#  if defined CGAL_CFG_DENORMALS_COMPILE_BUG
-     // For compilers crashing when dealing with denormalized values.
-     // So we have to generate it at run time instead.
-#ifdef CGAL_HEADER_ONLY
-#    define CGAL_IA_MIN_DOUBLE (CGAL::internal::get_static_minimin())
-#else
-#    define CGAL_IA_MIN_DOUBLE (CGAL::internal::minimin)
-#endif // CGAL_HEADER_ONLY
-#  else
-#    define CGAL_IA_MIN_DOUBLE (5e-324)
-#  endif
-#  define CGAL_IA_MAX_DOUBLE (1.7976931348623157081e+308)
-#else
-#  include <limits>
-#  define CGAL_IA_MIN_DOUBLE std::numeric_limits<double>::denorm_min()
-#  define CGAL_IA_MAX_DOUBLE (std::numeric_limits<double>::max)()
-#endif
-
-
-// Pure and safe SSE2 mode (g++ -mfpmath=sse && (-msse2 || -march=pentium4))
-// can be detected by :
-// TODO : see what Intel and VC++ have to say about this.
-#if defined __FLT_EVAL_METHOD__ && defined __SSE2_MATH__ && \
-      (__FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == 1)
-#  define CGAL_SAFE_SSE2
-#  include <xmmintrin.h>
-#endif
-
-// The CGAL_FPU_HAS_EXCESS_PRECISION macro is defined if some computations with
-// double can use more than the 53bits of precision of IEEE754, and/or if the
-// exponent has a wider range.  This can produce double rounding effects and
-// other bad things that we need to protect against.
-// The typical offender is the traditional FPU of x86 (SSE2-only mode is not affected).
-// Are there others, besides itanium and m68k?
-#if !defined CGAL_IA_NO_X86_OVER_UNDER_FLOW_PROTECT && \
-  (((defined __i386__ || defined __x86_64__) && !defined CGAL_SAFE_SSE2) \
-   || defined __ia64__ \
-   || defined _M_IX86 || defined _M_X64 || defined _M_IA64 \
-   || (defined FLT_EVAL_METHOD && FLT_EVAL_METHOD != 0 && FLT_EVAL_METHOD != 1))
-#  define CGAL_FPU_HAS_EXCESS_PRECISION
-#endif
-
-// Presence of SSE2 (for explicit use)
-#if  defined(__SSE2__) \
-  || (defined(_M_IX86_FP) && _M_IX86_FP >= 2) \
-  || defined(_M_X64)
-#  include <emmintrin.h>
-#  define CGAL_HAS_SSE2 1
-#endif
-
-// Only define CGAL_USE_SSE2 for 64 bits where malloc has a suitable
-// alignment, 32 bits is too dangerous.
-#if defined(CGAL_HAS_SSE2) && (defined(__x86_64__) || defined(_M_X64))
-#  define CGAL_USE_SSE2 1
-#endif
-
-#ifdef CGAL_CFG_DENORMALS_COMPILE_BUG
-
-#ifdef CGAL_HEADER_ONLY
-#include <CGAL/Interval_arithmetic_impl.h> // To define get_static_minimin();
-#else // CGAL_HEADER_ONLY
-namespace CGAL {
-namespace internal {
-CGAL_EXPORT extern double minimin;
-}
-}
-#endif // CGAL_HEADER_ONLY
-
-#endif
-
-namespace CGAL {
-namespace internal {
-#ifdef __INTEL_COMPILER
-const double infinity = std::numeric_limits<double>::infinity();
-#else
-const double infinity = HUGE_VAL;
-#endif
-
-} // namespace internal
-
-// Inline function to stop compiler optimizations that shouldn't happen with
-// pragma fenv on.
-// - constant propagation
-// - migration of fesetround across floating point operations
-// - (-a)-b -> -(a+b)
-// - (-a)*b -> -(a*b)
-// etc
-inline double IA_opacify(double x)
-{
-#ifdef __llvm__
-  // LLVM's support for inline asm is completely messed up:
-  // http://llvm.org/bugs/show_bug.cgi?id=17958
-  // http://llvm.org/bugs/show_bug.cgi?id=17959
-  // etc.
-  // This seems to produce code that is ok (not optimal but better than
-  // volatile). In case of trouble, use volatile instead.
-# ifdef CGAL_HAS_SSE2
-  asm volatile ("" : "+x"(x) );
-# elif (defined __VFP_FP__ && !defined __SOFTFP__) || defined __aarch64__
-  // ARM
-  asm volatile ("" : "+w"(x) );
-# else
-  asm volatile ("" : "+m"(x) );
-# endif
-  return x;
-#elif defined __xlC__
-  // PowerPC - XL C++ (the z/OS version supposedly does not define this macro)
-  // If we give it an alternative "+fm", it gets confused and generates worse code.
-  asm volatile ("" : "+f"(x) );
-  return x;
-#elif defined __GNUG__
-  // Intel used not to emulate this perfectly, we'll see.
-  // If we create a version of IA_opacify for vectors, note that gcc < 4.8
-  // fails with "+g" and we need to use "+mx" instead.
-  // "+X" ICEs ( http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59155 ) and
-  // may not be safe?
-  // The constraint 'g' doesn't include floating point registers ???
-  // Intel has a bug where -mno-sse still defines __SSE__ and __SSE2__
-  // (-mno-sse2 works though), no work-around for now.
-# if defined __SSE2_MATH__ || (defined __INTEL_COMPILER && defined __SSE2__)
-#  if __GNUC__ * 100 + __GNUC_MINOR__ >= 409
-  // ICEs in reload/LRA with older versions.
-  asm volatile ("" : "+gx"(x) );
-#  else
-  asm volatile ("" : "+mx"(x) );
-#  endif
-# elif (defined __i386__ || defined __x86_64__)
-  // "+f" doesn't compile on x86(_64)
-  // ( http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59157 )
-  // Don't mix "t" with "g": http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59180
-  // We can't put "t" with "x" either, prefer "x" for -mfpmath=sse,387.
-  // ( http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59181 )
-  asm volatile ("" : "+mt"(x) );
-# elif (defined __VFP_FP__ && !defined __SOFTFP__) || defined __aarch64__
-  // ARM
-  asm volatile ("" : "+gw"(x) );
-# elif defined __powerpc__ || defined __POWERPC__
-  // PowerPC
-  asm volatile ("" : "+gd"(x) );
-# elif defined __sparc
-  // Sparc
-  asm volatile ("" : "+ge"(x) );
-# elif defined __ia64
-  // Itanium
-  asm volatile ("" : "+gf"(x) );
-# else
-  asm volatile ("" : "+g"(x) );
-# endif
-  return x;
-#else
-  volatile double e = x;
-  return e;
-#endif
-}
-
-// Inline function to drop excess precision before we forget the rounding mode,
-// and stop compiler optimizations at the same time.
-inline double IA_force_to_double(double x)
-{
-#ifndef CGAL_FPU_HAS_EXCESS_PRECISION
-  return IA_opacify (x);
-#else
-#if defined __GNUG__
-#  ifdef CGAL_HAS_SSE2
-  // For an explanation of volatile:
-  // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56027
-  asm volatile ("" : "+mx"(x) );
-#  else
-  // Similar to writing to a volatile and reading back, except that calling
-  // it k times in a row only goes through memory once.
-  asm volatile ("" : "+m"(x) );
-#  endif
-  return x;
-#else
-  volatile double e = x;
-  return e;
-#endif
-#endif
-}
-
-// Interval arithmetic needs to protect against double-rounding effects
-// caused by excess FPU precision, even if it forces the 53bit mantissa
-// precision, because there is no way to fix the problem for the exponent
-// which has the same problem.  This affects underflow and overflow cases.
-// In case one does not care about such "extreme" situations, one can
-// set CGAL_IA_NO_X86_OVER_UNDER_FLOW_PROTECT to pretend there is no excess
-// precision.
-#if defined CGAL_FPU_HAS_EXCESS_PRECISION
-#  define CGAL_IA_FORCE_TO_DOUBLE(x) CGAL::IA_force_to_double(x)
-#elif 1
-// LLVM doesn't have -frounding-math so needs extra protection.
-// GCC also migrates fesetround calls over FP instructions, so protect
-// everyone.
-#  define CGAL_IA_FORCE_TO_DOUBLE(x) CGAL::IA_opacify(x)
-#else
-// Unused, reserved to compilers without excess precision and pragma fenv on.
-// ??? Should we trust Visual Studio not to optimize too much and let it use
-// this when CGAL_IA_NO_X86_OVER_UNDER_FLOW_PROTECT?
-#  define CGAL_IA_FORCE_TO_DOUBLE(x) (x)
-#endif
-
-// We sometimes need to stop constant propagation,
-// because operations are done with a wrong rounding mode at compile time.
-#ifndef CGAL_IA_DONT_STOP_CONSTANT_PROPAGATION
-#  define CGAL_IA_STOP_CPROP(x)    CGAL::IA_opacify(x)
-#else
-#  define CGAL_IA_STOP_CPROP(x)    (x)
-#endif
-
-// std::sqrt(double) on VC++ and CygWin is buggy when not optimizing.
-#if defined ( _MSC_VER ) && ! defined ( _WIN64 )
-inline double IA_bug_sqrt(double d)
-{
-  _asm
-  {
-    fld d
-    fsqrt
-    fstp d
-  }
-  return d;
-}
-
-#  define CGAL_BUG_SQRT(d) IA_bug_sqrt(d)
-
-
-#elif defined __SSE2_MATH__
-// For SSE2, we need to call __builtin_sqrt() instead of libc's sqrt().
-#  define CGAL_BUG_SQRT(d) __builtin_sqrt(d)
-#elif defined __CYGWIN__
-inline double IA_bug_sqrt(double d)
-{
-  double r;
-  asm volatile ("fsqrt" : "=t"(r) : "0"(d));
-  return r;
-}
-#  define CGAL_BUG_SQRT(d) IA_bug_sqrt(d)
-#else
-#  define CGAL_BUG_SQRT(d) std::sqrt(d)
-#endif
-
-// Here are the operator macros that make use of the above.
-// With GCC, we can do slightly better : test with __builtin_constant_p()
-// that both arguments are constant before stopping one of them.
-// Use inline functions instead ?
-#define CGAL_IA_ADD(a,b) CGAL_IA_FORCE_TO_DOUBLE((a)+CGAL_IA_STOP_CPROP(b))
-#define CGAL_IA_SUB(a,b) CGAL_IA_FORCE_TO_DOUBLE(CGAL_IA_STOP_CPROP(a)-(b))
-#define CGAL_IA_MUL(a,b) CGAL_IA_FORCE_TO_DOUBLE((a)*CGAL_IA_STOP_CPROP(b))
-#define CGAL_IA_DIV(a,b) CGAL_IA_FORCE_TO_DOUBLE((a)/CGAL_IA_STOP_CPROP(b))
-#define CGAL_IA_SQUARE(a) CGAL_IA_MUL(a,a)
-#define CGAL_IA_SQRT(a) \
-        CGAL_IA_FORCE_TO_DOUBLE(CGAL_BUG_SQRT(CGAL_IA_STOP_CPROP(a)))
-
-
-#if defined CGAL_SAFE_SSE2
-
-#define CGAL_IA_SETFPCW(CW) _MM_SET_ROUNDING_MODE(CW)
-#define CGAL_IA_GETFPCW(CW) CW = _MM_GET_ROUNDING_MODE()
-typedef unsigned int FPU_CW_t;
-#define CGAL_FE_TONEAREST    _MM_ROUND_NEAREST
-#define CGAL_FE_TOWARDZERO   _MM_ROUND_TOWARD_ZERO
-#define CGAL_FE_UPWARD       _MM_ROUND_UP
-#define CGAL_FE_DOWNWARD     _MM_ROUND_DOWN
-
-#elif defined __i386__ && !defined __PGI && !defined __SUNPRO_CC \
-      && !defined CGAL_HAS_SSE2
-// If we use both 387 and sse2, be safe and drop to fe[gs]etround.
-// Can we test CGAL_USE_SSE2 instead?
-
-// The GNU libc version (cf powerpc) is nicer, but doesn't work on libc 5 :(
-// This one also works with CygWin.
-// Note that the ISO C99 version may not be enough because of the extended
-// mantissa issue on x86 (may be required by some kinds of computation, but
-// as far as CGAL::Interval_nt<> is concerned, the double-rounding issues
-// are taking care of there).
-#define CGAL_IA_SETFPCW(CW) asm volatile ("fldcw %0" : :"m" (CW))
-#define CGAL_IA_GETFPCW(CW) asm volatile ("fnstcw %0" : "=m" (CW))
-typedef unsigned short FPU_CW_t;
-#define CGAL_FE_TONEAREST    (0x000 | 0x127f)
-#define CGAL_FE_TOWARDZERO   (0xc00 | 0x127f)
-#define CGAL_FE_UPWARD       (0x800 | 0x127f)
-#define CGAL_FE_DOWNWARD     (0x400 | 0x127f)
-
-#elif defined __SUNPRO_CC && defined __sun
-#define CGAL_IA_SETFPCW(CW) fpsetround(fp_rnd(CW))
-#define CGAL_IA_GETFPCW(CW) CW = fpgetround()
-typedef unsigned int FPU_CW_t;
-#define CGAL_FE_TONEAREST    FP_RN
-#define CGAL_FE_TOWARDZERO   FP_RZ
-#define CGAL_FE_UPWARD       FP_RP
-#define CGAL_FE_DOWNWARD     FP_RM
-
-#elif defined __sparc__
-#define CGAL_IA_SETFPCW(CW) asm volatile ("ld %0,%%fsr" : :"m" (CW))
-#define CGAL_IA_GETFPCW(CW) asm volatile ("st %%fsr,%0" : "=m" (CW))
-typedef unsigned int FPU_CW_t;
-#define CGAL_FE_TONEAREST    (0x0        | 0x20000000 | 0x1f)
-#define CGAL_FE_TOWARDZERO   (0x40000000 | 0x20000000 | 0x1f)
-#define CGAL_FE_UPWARD       (0x80000000 | 0x20000000 | 0x1f)
-#define CGAL_FE_DOWNWARD     (0xc0000000 | 0x20000000 | 0x1f)
-
-#elif defined __mips__
-#define CGAL_IA_SETFPCW(CW) asm volatile ("ctc1 %0,$31" : :"r" (CW))
-#define CGAL_IA_GETFPCW(CW) asm volatile ("cfc1 %0,$31" : "=r" (CW))
-typedef unsigned int FPU_CW_t;
-#define CGAL_FE_TONEAREST    (0x0)
-#define CGAL_FE_TOWARDZERO   (0x1)
-#define CGAL_FE_UPWARD       (0x2)
-#define CGAL_FE_DOWNWARD     (0x3)
-
-#elif defined __osf || defined __osf__  // Not yet supported.
-#define CGAL_IA_SETFPCW(CW) write_rnd(CW)
-#define CGAL_IA_GETFPCW(CW) CW = read_rnd()
-typedef unsigned int FPU_CW_t;
-#define CGAL_FE_TONEAREST    FP_RND_RN
-#define CGAL_FE_TOWARDZERO   FP_RND_RZ
-#define CGAL_FE_UPWARD       FP_RND_RP
-#define CGAL_FE_DOWNWARD     FP_RND_RM
-
-#elif defined ( _MSC_VER )
-#if ( _MSC_VER < 1400)
-#define CGAL_IA_SETFPCW(CW) _controlfp (CW, _MCW_RC )
-#define CGAL_IA_GETFPCW(CW) CW = _controlfp (0, 0 ) &  _MCW_RC
-typedef unsigned short FPU_CW_t;
-#else
-#define CGAL_IA_SETFPCW(CW) unsigned int dummy; _controlfp_s (&dummy, CW, _MCW_RC )
-#define CGAL_IA_GETFPCW(CW)_controlfp_s (&CW, 0, 0 ); CW  &=  _MCW_RC
-typedef unsigned int FPU_CW_t;
-#endif
-
-#define CGAL_FE_TONEAREST    _RC_NEAR
-#define CGAL_FE_TOWARDZERO   _RC_CHOP
-#define CGAL_FE_UPWARD       _RC_UP
-#define CGAL_FE_DOWNWARD     _RC_DOWN
-
-#else
-// This is a version following the ISO C99 standard, which aims at portability.
-// The drawbacks are speed on one hand, and also, on x86, it doesn't fix the
-// extended mantissa issue (this is not a problem for IA, but it is one for
-// some future modular computations).
-#define CGAL_IA_SETFPCW(CW)  fesetround(CW)
-#define CGAL_IA_GETFPCW(CW)  CW = fegetround()
-typedef int FPU_CW_t;
-#define CGAL_FE_TONEAREST    FE_TONEAREST
-#define CGAL_FE_TOWARDZERO   FE_TOWARDZERO
-#define CGAL_FE_UPWARD       FE_UPWARD
-#define CGAL_FE_DOWNWARD     FE_DOWNWARD
-#endif
-
-// User interface:
-
-inline
-FPU_CW_t
-FPU_get_cw (void)
-{
-    FPU_CW_t cw;
-    CGAL_IA_GETFPCW(cw);
-    return cw;
-}
-
-} // namespace CGAL
-
-#ifdef CGAL_HEADER_ONLY
-#include <CGAL/test_FPU_rounding_mode_impl.h>
-#endif // CGAL_HEADER_ONLY
-
-namespace CGAL {
-
-// User interface (cont):
-
-inline
-void
-FPU_set_cw (FPU_CW_t cw)
-{
-#ifndef CGAL_NDEBUG
-#ifdef CGAL_HEADER_ONLY
-  const Check_FPU_rounding_mode_is_restored & tmp = get_static_check_fpu_rounding_mode_is_restored();
-#endif
-#endif
-
-  CGAL_IA_SETFPCW(cw);
-}
-
-inline
-FPU_CW_t
-FPU_get_and_set_cw (FPU_CW_t cw)
-{
-    FPU_CW_t old = FPU_get_cw();
-    FPU_set_cw(cw);
-    return old;
-}
-
-
-// A class whose constructor sets the FPU mode to +inf, saves a backup of it,
-// and whose destructor resets it back to the saved state.
-
-template <bool Protected = true> struct Protect_FPU_rounding;
-
-template <>
-struct Protect_FPU_rounding<true>
-{
-  Protect_FPU_rounding(FPU_CW_t r = CGAL_FE_UPWARD)
-    : backup( FPU_get_and_set_cw(r) ) {}
-
-  ~Protect_FPU_rounding()
-  {
-     FPU_set_cw(backup);
-  }
-
-private:
-  FPU_CW_t backup;
-};
-
-template <>
-struct Protect_FPU_rounding<false>
-{
-  Protect_FPU_rounding() {}
-  Protect_FPU_rounding(FPU_CW_t /*= CGAL_FE_UPWARD*/) {}
-};
-
-
-// A wrapper on top of the Protect_FPU_rounding to add "expensive" checks
-// of the rounding mode.  It is used internally, to benefit from the
-// protector declarations to add checks in non-protected mode.
-
-template <bool Protected = true>
-struct Checked_protect_FPU_rounding
-  : Protect_FPU_rounding<Protected>
-{
-  Checked_protect_FPU_rounding()
-  {
-    CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_UPWARD);
-  }
-
-  Checked_protect_FPU_rounding(FPU_CW_t r)
-    : Protect_FPU_rounding<Protected>(r)
-  {
-    CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_UPWARD);
-  }
-};
-
-
-// The class Set_ieee_double_precision forces the double precision (53bit mantissa),
-// to protect from double rounding effects on x86 FPU.
-// ( Note that it also sets the rounding mode to nearest. )
-// Its destructor restores the FPU state as it was previously.
-// Note that this affects "long double" as well, and other potential side effects.
-// And note that it does not (cannot) "fix" the same problem for the exponent.
-
-struct Set_ieee_double_precision
-#ifdef CGAL_FPU_HAS_EXCESS_PRECISION
-  : public Protect_FPU_rounding<>
-{
-  Set_ieee_double_precision()
-    : Protect_FPU_rounding<>(CGAL_FE_TONEAREST) {}
-};
-#else
-{
-  Set_ieee_double_precision() {} // only to kill compiler warnings.
-};
-#endif
-
-
-// The following function serves the same goal as Set_ieee_double_precision but
-// does the change globally (no destructor resets the previous behavior).
-inline void force_ieee_double_precision()
-{
-#ifdef CGAL_FPU_HAS_EXCESS_PRECISION
-    FPU_set_cw(CGAL_FE_TONEAREST);
-#endif
-}
-
-} //namespace CGAL
-
-#endif // CGAL_FPU_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/FaceGraph_to_Polyhedron_3.h b/3rdparty/CGAL-4.8/include/CGAL/FaceGraph_to_Polyhedron_3.h
deleted file mode 100644
index 4981c4b..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/FaceGraph_to_Polyhedron_3.h
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright (c) 2014  GeometryFactory (France). All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Sebastien Loriot
-//
-
-
-#ifndef CGAL_FACEGRAPH_POLYHEDRON_3_H
-#define CGAL_FACEGRAPH_POLYHEDRON_3_H 1
-
-#include <CGAL/basic.h>
-#include <CGAL/Modifier_base.h>
-#include <CGAL/Polyhedron_incremental_builder_3.h>
-#include <CGAL/Cartesian_converter.h>
-#include <CGAL/Kernel_traits.h>
-
-#include <boost/graph/graph_traits.hpp>
-#include <boost/foreach.hpp>
-
-namespace CGAL {
-
-template < class FaceGraph, class PointPMap, class HDS, bool clear_target_before = true >
-class FaceGraph_to_Polyhedron_3 : public Modifier_base<HDS> {
-    FaceGraph& fg;
-    PointPMap ppmap;
-public:
-    typedef HDS  Halfedge_data_structure;
-    FaceGraph_to_Polyhedron_3(const FaceGraph& src, PointPMap map)
-    : fg(const_cast<FaceGraph&>(src))
-    , ppmap(map)
-    {}
-    void operator()( HDS& target);
-};
-
-template < class FaceGraph, class PointPMap, class HDS, bool clear_target_before>
-void
-FaceGraph_to_Polyhedron_3<FaceGraph, PointPMap, HDS, clear_target_before>::
-operator()(HDS& tgt)
-{
-  typedef typename boost::graph_traits<FaceGraph>::vertex_descriptor vertex_descriptor;
-  typedef typename boost::graph_traits<FaceGraph>::face_descriptor face_descriptor;
-  typedef typename boost::graph_traits<FaceGraph>::halfedge_descriptor halfedge_descriptor;
-
-  Cartesian_converter<
-    typename Kernel_traits<typename boost::property_traits<PointPMap>::value_type>::Kernel,
-    typename Kernel_traits<typename HDS::Vertex::Point>::Kernel
-  > convert;
-
-  if ( clear_target_before )
-    tgt.clear();
-
-  Polyhedron_incremental_builder_3<HDS> B(tgt);
-  B.begin_surface( num_vertices(fg),
-                   num_faces(fg),
-                   num_halfedges(fg));
-  std::map<vertex_descriptor, std::size_t> indices;
-  std::size_t i=0;
-  BOOST_FOREACH(vertex_descriptor vd, vertices(fg) )
-  {
-    B.add_vertex( convert( get(ppmap, vd) ) );
-    indices[vd]=i++;
-  }
-
-  BOOST_FOREACH(face_descriptor fd, faces(fg))
-  {
-    B.begin_facet();
-    halfedge_descriptor hd=halfedge(fd, fg), first=hd;
-    do {
-        B.add_vertex_to_facet( indices[target(edge(hd,fg), fg)] );
-        hd=next(hd,fg);;
-    } while( hd != first);
-    B.end_facet();
-  }
-  B.end_surface();
-}
-
-} //namespace CGAL
-#endif // CGAL_FACEGRAPH_POLYHEDRON_3_H //
-// EOF //
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Filtered_extended_homogeneous.h b/3rdparty/CGAL-4.8/include/CGAL/Filtered_extended_homogeneous.h
deleted file mode 100644
index 40541db..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Filtered_extended_homogeneous.h
+++ /dev/null
@@ -1,1287 +0,0 @@
-// Copyright (c) 1997-2000  Max-Planck-Institute Saarbruecken (Germany).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Michael Seel <seel at mpi-sb.mpg.de>
-#ifndef CGAL_FILTERED_EXTENDED_HOMOGENEOUS_H
-#define CGAL_FILTERED_EXTENDED_HOMOGENEOUS_H
-
-#include <CGAL/basic.h>
-#include <CGAL/Handle_for.h>
-#include <CGAL/Interval_arithmetic.h>
-#include <CGAL/Homogeneous.h>
-#include <CGAL/number_utils.h>
-#undef CGAL_NEF_DEBUG
-#define CGAL_NEF_DEBUG 5
-#include <CGAL/Nef_2/debug.h>
-
-#define REDUCE_INTERSECTION_POINTS
-//#define KERNEL_ANALYSIS
-//#define KERNEL_CHECK
-
-#ifdef  KERNEL_CHECK
-#include <CGAL/Extended_homogeneous.h>
-#define CHECK(c1,c2) CGAL_assertion((c1) == (c2));
-#define PRINT_CHECK_ENABLED std::cout << "kernel check enabled!\n"
-#else
-#define CHECK(c1,c2)
-#define PRINT_CHECK_ENABLED std::cout << "no kernel check!\n"
-#endif
-
-#ifdef KERNEL_ANALYSIS
-#define DEFCOUNTER(c) \
-  static int c##_total=0; static int c##_exception=0;
-#define INCTOTAL(c) c##_total++
-#define INCEXCEPTION(c) c##_exception++
-#define PRINT_STATISTICS(c) \
-std::cout << #c##" " << c##_exception << "/" << c##_total << std::endl
-#else
-#define DEFCOUNTER(c)
-#define INCTOTAL(c)
-#define INCEXCEPTION(c)
-#define PRINT_STATISTICS(c)
-#endif
-
-namespace CGAL {
-
-template <typename RT>
-class SPolynomial {
-  RT _m,_n;
-public:
-  SPolynomial() : _m(),_n() {}
-  SPolynomial(const RT& m, const RT& n) : _m(m),_n(n) {}
-  SPolynomial(const RT& n) : _m(),_n(n) {}
-  SPolynomial(const SPolynomial<RT>& p) : _m(p._m),_n(p._n) {}
-  SPolynomial<RT>& operator=(const SPolynomial<RT>& p)
-  { _m=p._m; _n=p._n; return *this; }
-
-  const RT& m() const { return _m; }
-  const RT& n() const { return _n; }
-  void negate() { _m=-_m; _n=-_n; }
-
-  SPolynomial<RT> operator*(const RT& c) const
-  { return SPolynomial<RT>(c*_m,c*_n); }
-  SPolynomial<RT> operator+(const SPolynomial<RT>& p) const
-  { return SPolynomial<RT>(_m+p._m,_n+p._n); }
-  SPolynomial<RT> operator-(const SPolynomial<RT>& p) const
-  { return SPolynomial<RT>(_m-p._m,_n-p._n); }
-  SPolynomial<RT> operator-() const
-  { return SPolynomial<RT>(-_m,-_n); }
-  void operator /= (const RT& c) 
-  { _m /= c; _n /= c; } 
-  const RT& operator[](int i) { return (i%2 ? _n : _m); }
-  const RT& operator[](int i) const { return (i%2 ? _n : _m); }
-  bool is_zero() const { return (_m==0 && _n==0); }
-  int sign() const
-  { if ( _m != 0 ) return CGAL_NTS sign(_m); 
-    return CGAL_NTS sign(_n); 
-  }
-
-
-  // only for visualization:
-  static void set_R(const RT& R) { R_ = R; }
-  RT eval_at(const RT& r) const { return _m*r+_n; }
-  RT eval_at_R() const { return _m*R_+_n; }
-protected:
-  static RT R_;
-};
-
-template <class RT> RT SPolynomial<RT>::R_;
-
-template <typename RT>
-int sign(const SPolynomial<RT>& p)
-{ 
-  return p.sign(); 
-}
-
-
-template <typename RT>
-bool operator==(const SPolynomial<RT>& p1, const SPolynomial<RT>& p2)
-{ return (p1-p2).is_zero(); }
-
-template <typename RT>
-bool operator>(const SPolynomial<RT>& p1, const SPolynomial<RT>& p2)
-{ return (p1-p2).sign()>0; }
-
-template <typename RT>
-bool operator<(const SPolynomial<RT>& p1, const SPolynomial<RT>& p2)
-{ return (p1-p2).sign()<0; }
-
-template <typename RT>
-bool operator<(int i, const SPolynomial<RT>& p2)
-{ 
-  SPolynomial<RT> p1(i);
-  return (p1-p2).sign()<0; 
-}
-
-
-template <typename RT>
-bool operator<(const SPolynomial<RT>& p1, int i)
-{ 
-  SPolynomial<RT> p2(i);
-  return (p1-p2).sign()<0; 
-}
-
-template <class RT> 
-inline double to_double(const SPolynomial<RT>& p) 
-{ return (CGAL::to_double(p.eval_at(SPolynomial<RT>::R_))); }
-
-template <class RT> 
-std::ostream& operator<<(std::ostream& os, const SPolynomial<RT>& p)
-{ 
-  switch( os.iword(CGAL::IO::mode) ) {
-    case CGAL::IO::ASCII : 
-      os << p.m() << " " << p.n(); break;
-    case CGAL::IO::BINARY :
-      CGAL::write(os,p.m());CGAL::write(os,p.n()); break;
-    default:
-      if ( p.m() == 0 ) os<<"["<<p.n()<<"]";
-      else os<<"["<<p.m()<<" R + "<<p.n()<<"]"; 
-  } 
-  return os; 
-}
-template <class RT> 
-std::istream& operator>>(std::istream& is, SPolynomial<RT>& p)
-{ RT m,n; 
-  switch( is.iword(CGAL::IO::mode) ){ 
-    case CGAL::IO::ASCII : 
-      is >> m >> n; p = SPolynomial<RT>(m,n); break;
-    case CGAL::IO::BINARY :
-      CGAL::read(is,m);CGAL::read(is,n);break;
-    default:
-    CGAL_error_msg("\nStream must be in ascii or binary mode\n");
-      break;  
-  }
-  return is; 
-}
-
-template <class RT> /*CGAL_KERNEL_INLINE*/ 
-CGAL::io_Operator io_tag(const SPolynomial<RT>&) 
-{ return CGAL::io_Operator(); }
-
-
-template <typename RT>
-class SQuotient {
-  SPolynomial<RT> _p;
-  RT              _n;
-public:
-  SQuotient() : _p(),_n() {}
-  SQuotient(const SPolynomial<RT>& p, const RT& n) : _p(p),_n(n) {}
-  SQuotient(const SQuotient<RT>& p) : _p(p._p),_n(p._n) {}
-  SQuotient<RT>& operator=(const SQuotient<RT>& p)
-  { _p=p._p; _n=p._n; return *this; }
-  const SPolynomial<RT>& numerator() const { return _p; }
-  const RT&              denominator() const { return _n; }
-};
-
-template <class RT> 
-inline double to_double(const SQuotient<RT>& q) 
-{ return (CGAL::to_double(q.numerator().eval_at_R())/
-          CGAL::to_double(q.denominator())); }
-
-
-template <typename RT> class Extended_point;
-template <typename RT> class Extended_point_rep;
-
-template <typename RT>
-class Extended_point_rep {
-  friend class Extended_point<RT>;
-  SPolynomial<RT> x_,y_; RT w_;
-  typedef Interval_nt_advanced DT;
-  DT mxd,myd,nxd,nyd,wd;
-public:
-  Extended_point_rep(const RT& x, const RT& y, const RT& w) :
-    x_(x),y_(y),w_(w)
-  { CGAL_assertion_msg(w!=0,"denominator is zero.");
-    nxd=CGAL::to_interval(x);
-    nyd=CGAL::to_interval(y);
-    wd=CGAL::to_interval(w);
-    mxd=myd=0;
-  }
-
-  Extended_point_rep(const SPolynomial<RT>& x, 
-                     const SPolynomial<RT>& y, 
-                     const RT& w) : x_(x),y_(y),w_(w)
-  { CGAL_assertion_msg(w!=0,"denominator is zero.");
-    mxd=CGAL::to_interval(x.m());
-    myd=CGAL::to_interval(y.m());
-    nxd=CGAL::to_interval(x.n());
-    nyd=CGAL::to_interval(y.n());
-    wd=CGAL::to_interval(w);
-  }
-
-  Extended_point_rep() : x_(),y_(),w_() {}
-  ~Extended_point_rep() {}
-  void negate() 
-  { x_ = -x_; y_ = -y_; w_ = -w_; 
-    mxd = -mxd; myd = -myd; nxd = -nxd; nyd = -nyd; wd = -wd; }
-
-};
-
-template <typename RT_>
-class Extended_point : public Handle_for< Extended_point_rep<RT_> > {
-  typedef Extended_point_rep<RT_> Rep;
-  typedef Handle_for< Rep >       Base;
-
-  using Base::ptr;
-
-public:
-  typedef typename Rep::DT DT;
-  typedef RT_ RT;
-  typedef SPolynomial<RT>  SP;
-
-  Extended_point() : Base( Rep() ) {}
-
-  Extended_point(const RT& x, const RT& y, const RT& w) :
-    Base( Rep(x,y,w) )
-  { if (w < 0) this->ptr()->negate(); }
-  
-  Extended_point(const SPolynomial<RT>& x, 
-                 const SPolynomial<RT>& y, 
-                 const RT& w) : Base( Rep(x,y,w) )
-  { if (w < 0) this->ptr()->negate(); }
-
-  Extended_point(const RT& mx, const RT& nx,
-                 const RT& my, const RT& ny, const RT& w) :
-    Base( Rep(SP(mx,nx), SP(my,ny), w) )
-  { if (w < 0) this->ptr()->negate(); }
-  
-  Extended_point(const Extended_point<RT>& p) : Base(p) {}
-  ~Extended_point() {}
-
-  Extended_point& operator=(const Extended_point<RT>& p) 
-  { Base::operator=(p); return *this; }
-
-  const RT& mx() const { return this->ptr()->x_.m(); }
-  const RT& nx() const { return this->ptr()->x_.n(); }
-  const RT& my() const { return this->ptr()->y_.m(); }
-  const RT& ny() const { return this->ptr()->y_.n(); }
-  const RT& hw()  const { return this->ptr()->w_; }
-  const DT& mxD() const { return this->ptr()->mxd; }
-  const DT& nxD() const { return this->ptr()->nxd; }
-  const DT& myD() const { return this->ptr()->myd; }
-  const DT& nyD() const { return this->ptr()->nyd; }
-  const DT& hwD() const { return this->ptr()->wd; }
-
-  SQuotient<RT> x() const 
-  { return SQuotient<RT>(this->ptr()->x_, this->ptr()->w_); }
-  SQuotient<RT> y() const 
-  { return SQuotient<RT>(this->ptr()->y_, this->ptr()->w_); }
-
-  const SPolynomial<RT> hx() const { return this->ptr()->x_; }
-  const SPolynomial<RT> hy() const { return this->ptr()->y_; }
-
-  bool is_standard() const { return (mx()==0)&&(my()==0); }
-  Extended_point<RT> opposite() const 
-  { return Extended_point<RT>(-mx(),nx(),-my(),ny(),this->w()); }
-
-#ifdef KERNEL_CHECK
-typedef CGAL::Extended_homogeneous<RT_> CheckKernel;
-typedef typename CheckKernel::Point_2   CheckPoint;
-typedef typename CheckKernel::RT        CheckRT;
-
-CheckRT convert(const CGAL::SPolynomial<RT_>& p) const
-{ return CheckRT(p.n(),p.m()); }
-CheckRT convert(const RT_& t) const
-{ return CheckRT(t); }
-CheckPoint checkrep() const
-{ return CheckPoint(convert(hx()),convert(hy()),convert(w())); }
-
-#endif // KERNEL_CHECK
-
-
-};
-
-template <class RT> 
-std::ostream& operator<<(std::ostream& os, const Extended_point<RT>& p)
-{ switch( os.iword(CGAL::IO::mode) ) {
-    case CGAL::IO::ASCII : 
-      os << p.hx() << " " << p.hy() << " " << p.hw(); break;
-    case CGAL::IO::BINARY :
-      CGAL::write(os,p.hx());CGAL::write(os,p.hy()); 
-      CGAL::write(os,p.hw()); break;
-    default:
-      os << "(" << p.hx() << "," << p.hy() << "," << p.hw() << ")"; 
-#if 0
-      os << "((" << CGAL::to_double(p.nx())/CGAL::to_double(p.hw()) << "," 
-         << CGAL::to_double(p.ny())/CGAL::to_double(p.hw()) << "))"; 
-#endif
-  } 
-  return os; 
-}
-template <class RT> 
-std::istream& operator>>(std::istream& is, Extended_point<RT>& p)
-{ SPolynomial<RT> x,y; RT w;
-  switch( is.iword(CGAL::IO::mode) ){ 
-    case CGAL::IO::ASCII : 
-      is >> x >> y >> w; break;
-    case CGAL::IO::BINARY :
-      CGAL::read(is,x);CGAL::read(is,y);CGAL::read(is,w); break;
-    default:
-    CGAL_error_msg("\nStream must be in ascii or binary mode\n");
-      break;  
-  }
-  p = Extended_point<RT>(x,y,w); 
-  return is; 
-}
-
-
-template <typename NT> inline
-int orientation_coeff2(const NT& mx1, const NT& /*nx1*/, 
-                       const NT& my1, const NT& /*ny1*/, const NT& w1,
-                       const NT& mx2, const NT& /*nx2*/, 
-                       const NT& my2, const NT& /*ny2*/, const NT& w2,
-                       const NT& mx3, const NT& /*nx3*/, 
-                       const NT& my3, const NT& /*ny3*/, const NT& w3) 
-{
-  NT coeff2 = mx1*w3*my2-mx1*w2*my3+mx3*w2*my1-
-              mx2*w3*my1-mx3*w1*my2+mx2*w1*my3;
-  return CGAL_NTS sign(coeff2);
-}
-
-template <typename NT> inline 
-int orientation_coeff1(const NT& mx1, const NT& nx1, 
-                       const NT& my1, const NT& ny1, const NT& w1,
-                       const NT& mx2, const NT& nx2, 
-                       const NT& my2, const NT& ny2, const NT& w2,
-                       const NT& mx3, const NT& nx3, 
-                       const NT& my3, const NT& ny3, const NT& w3) 
-{
-  NT coeff1 = mx1*w3*ny2-mx1*w2*ny3+nx1*w3*my2-mx2*w3*ny1-
-              nx1*w2*my3+mx2*w1*ny3-nx2*w3*my1+mx3*w2*ny1+
-              nx2*w1*my3-mx3*w1*ny2+nx3*w2*my1-nx3*w1*my2;
-  return CGAL_NTS sign(coeff1);
-}
-
-template <typename NT> inline
-int orientation_coeff0(const NT& /*mx1*/, const NT& nx1, 
-                       const NT& /*my1*/, const NT& ny1, const NT& w1,
-                       const NT& /*mx2*/, const NT& nx2, 
-                       const NT& /*my2*/, const NT& ny2, const NT& w2,
-                       const NT& /*mx3*/, const NT& nx3, 
-                       const NT& /*my3*/, const NT& ny3, const NT& w3) 
-{
-  NT coeff0 = -nx2*w3*ny1+nx1*w3*ny2+nx2*w1*ny3-
-               nx1*w2*ny3+nx3*w2*ny1-nx3*w1*ny2;
-  return CGAL_NTS sign(coeff0);
-}
-
-DEFCOUNTER(or0)
-DEFCOUNTER(or1)
-DEFCOUNTER(or2)
-template <typename RT>
-int orientation(const Extended_point<RT>& p1, 
-                const Extended_point<RT>& p2, 
-                const Extended_point<RT>& p3) 
-{ CGAL_NEF_TRACEN("orientation "<<p1<<p2<<p3);
-  int res;
-  try { INCTOTAL(or2); Protect_FPU_rounding<true> Protection;
-    res = orientation_coeff2(p1.mxD(),p1.nxD(),p1.myD(),p1.nyD(),p1.hwD(),
-                             p2.mxD(),p2.nxD(),p2.myD(),p2.nyD(),p2.hwD(),
-                             p3.mxD(),p3.nxD(),p3.myD(),p3.nyD(),p3.hwD());
-  }
-  catch (Uncertain_conversion_exception) { INCEXCEPTION(or2);
-    res = orientation_coeff2(p1.mx(),p1.nx(),p1.my(),p1.ny(),p1.hw(),
-                             p2.mx(),p2.nx(),p2.my(),p2.ny(),p2.hw(),
-                             p3.mx(),p3.nx(),p3.my(),p3.ny(),p3.hw());
-  }
-  if ( res != 0 ) return res; 
-
-  try { INCTOTAL(or1); Protect_FPU_rounding<true> Protection;
-    res = orientation_coeff1(p1.mxD(),p1.nxD(),p1.myD(),p1.nyD(),p1.hwD(),
-                             p2.mxD(),p2.nxD(),p2.myD(),p2.nyD(),p2.hwD(),
-                             p3.mxD(),p3.nxD(),p3.myD(),p3.nyD(),p3.hwD());
-  }
-  catch (Uncertain_conversion_exception) { INCEXCEPTION(or1);
-    res = orientation_coeff1(p1.mx(),p1.nx(),p1.my(),p1.ny(),p1.hw(),
-                             p2.mx(),p2.nx(),p2.my(),p2.ny(),p2.hw(),
-                             p3.mx(),p3.nx(),p3.my(),p3.ny(),p3.hw());
-  }
-  if ( res != 0 ) return res; 
-
-  try { INCTOTAL(or0); Protect_FPU_rounding<true> Protection;
-    res = orientation_coeff0(p1.mxD(),p1.nxD(),p1.myD(),p1.nyD(),p1.hwD(),
-                             p2.mxD(),p2.nxD(),p2.myD(),p2.nyD(),p2.hwD(),
-                             p3.mxD(),p3.nxD(),p3.myD(),p3.nyD(),p3.hwD());
-  }
-  catch (Uncertain_conversion_exception) { INCEXCEPTION(or0);
-    res = orientation_coeff0(p1.mx(),p1.nx(),p1.my(),p1.ny(),p1.hw(),
-                             p2.mx(),p2.nx(),p2.my(),p2.ny(),p2.hw(),
-                             p3.mx(),p3.nx(),p3.my(),p3.ny(),p3.hw());
-  }
-  return res;
-}
-
-template <typename NT> 
-inline
-int compare_expr(const NT& n1, const NT& d1, 
-                 const NT& n2, const NT& d2)
-{ return CGAL_NTS sign( n1*d2 - n2*d1 ); }
-
-DEFCOUNTER(cmpx0)
-DEFCOUNTER(cmpx1)
-
-template <typename RT>
-int compare_x(const Extended_point<RT>& p1, 
-              const Extended_point<RT>& p2) 
-{
-  int res;
-  try { INCTOTAL(cmpx1); Protect_FPU_rounding<true> Protection;
-    res = compare_expr(p1.mxD(),p1.hwD(),p2.mxD(),p2.hwD());
-  }
-  catch (Uncertain_conversion_exception) { INCEXCEPTION(cmpx1);
-    res = compare_expr(p1.mx(),p1.hw(),p2.mx(),p2.hw());
-  }
-  if ( res != 0 ) return res; 
-
-  try { INCTOTAL(cmpx0); Protect_FPU_rounding<true> Protection;
-    res = compare_expr(p1.nxD(),p1.hwD(),p2.nxD(),p2.hwD());
-  }
-  catch (Uncertain_conversion_exception) { INCEXCEPTION(cmpx0);
-    res = compare_expr(p1.nx(),p1.hw(),p2.nx(),p2.hw());
-  }
-  return res;  
-}
-
-DEFCOUNTER(cmpy0)
-DEFCOUNTER(cmpy1)
-
-template <typename RT>
-int compare_y(const Extended_point<RT>& p1, 
-              const Extended_point<RT>& p2) 
-{
-  int res;
-  try { INCTOTAL(cmpy1); Protect_FPU_rounding<true> Protection;
-    res = compare_expr(p1.myD(),p1.hwD(),p2.myD(),p2.hwD());
-  }
-  catch (Uncertain_conversion_exception) { INCEXCEPTION(cmpy1);
-    res = compare_expr(p1.my(),p1.hw(),p2.my(),p2.hw());
-  }
-  if ( res != 0 ) return res; 
-
-  try { INCTOTAL(cmpy0); Protect_FPU_rounding<true> Protection;
-    res = compare_expr(p1.nyD(),p1.hwD(),p2.nyD(),p2.hwD());
-  }
-  catch (Uncertain_conversion_exception) { INCEXCEPTION(cmpy0);
-    res = compare_expr(p1.ny(),p1.hw(),p2.ny(),p2.hw());
-  }
-  return res;  
-}
-
-
-template <typename RT>
-inline
-int compare_xy(const Extended_point<RT>& p1, 
-               const Extended_point<RT>& p2) 
-{ int c1 = compare_x(p1,p2);
-  if ( c1 != 0 ) return c1;
-  else return compare_y(p1,p2);
-}
-
-template <typename RT>
-inline
-bool strictly_ordered_along_line(const Extended_point<RT>& p1, 
-                                 const Extended_point<RT>& p2, 
-                                 const Extended_point<RT>& p3) 
-{ return ( orientation(p1,p2,p3) == 0 ) &&
-         ( compare_xy(p1,p2) * compare_xy(p2,p3) == 1 );
-}
-
-template <typename RT>
-inline bool operator==(const Extended_point<RT>& p1, 
-                       const Extended_point<RT>& p2) 
-{ CHECK(bool(compare_xy(p1,p2) == 0),p1.checkrep()==p2.checkrep())
-  return (p1.identical(p2) || compare_xy(p1,p2) == 0); }
-
-template <typename RT>
-inline bool operator!=(const Extended_point<RT>& p1, 
-                       const Extended_point<RT>& p2) 
-{ return !(p1==p2); }
-
-
-template <typename NT> 
-inline
-int cmppd_coeff2(const NT& mx1, const NT& /*nx1*/, 
-                 const NT& my1, const NT& /*ny1*/, const NT& w1,
-                 const NT& mx2, const NT& /*nx2*/, 
-                 const NT& my2, const NT& /*ny2*/, const NT& w2,
-                 const NT& mx3, const NT& /*nx3*/, 
-                 const NT& my3, const NT& /*ny3*/, const NT& w3, 
-                 const NT& mx4, const NT& /*nx4*/, 
-                 const NT& my4, const NT& /*ny4*/, const NT& w4) 
-{ 
-  NT w1Q(w1*w1), w2Q(w2*w2), w3Q(w3*w3), w4Q(w4*w4);
-  NT w1w2Q(w1Q*w2Q), w3w4Q(w3Q*w4Q), two(2);
-  NT coeff2 =    w3w4Q * w2Q *mx1*mx1-
-                 two* w3w4Q  *w2*mx1*w1*mx2+
-                 w3w4Q * w1Q *mx2*mx2+
-                 w3w4Q * w2Q *my1*my1-
-                 two* w3w4Q  *w2*my1*w1*my2+
-                 w3w4Q * w1Q *my2*my2-
-                 w1w2Q * w4Q *mx3*mx3+
-                 two* w1w2Q  *w4*mx3*w3*mx4-
-                 w1w2Q * w3Q *mx4*mx4-
-                 w1w2Q * w4Q *my3*my3+
-                 two* w1w2Q  *w4*my3*w3*my4-
-                 w1w2Q * w3Q *my4*my4;
-  return CGAL_NTS sign(coeff2);  
-}
-
-
-template <typename NT> 
-inline
-int cmppd_coeff1(const NT& mx1, const NT& nx1, 
-                 const NT& my1, const NT& ny1, const NT& w1,
-                 const NT& mx2, const NT& nx2, 
-                 const NT& my2, const NT& ny2, const NT& w2,
-                 const NT& mx3, const NT& nx3, 
-                 const NT& my3, const NT& ny3, const NT& w3, 
-                 const NT& mx4, const NT& nx4, 
-                 const NT& my4, const NT& ny4, const NT& w4) 
-{ 
-  NT w1Q(w1*w1), w2Q(w2*w2), w3Q(w3*w3), w4Q(w4*w4);
-  NT w1w2Q(w1Q*w2Q), w3w4Q(w3Q*w4Q), two(2);
-  NT coeff1 = two * (w3w4Q * w1Q * mx2*nx2-
-                     w3w4Q * w2*my1*w1*ny2+
-                     w3w4Q * w1Q * my2*ny2+
-                     w1w2Q * w4*nx3*w3*mx4-
-                     w1w2Q * w4Q *mx3*nx3+
-                     w3w4Q * w2Q *mx1*nx1-
-                     w3w4Q * w2*mx1*w1*nx2-
-                     w3w4Q * w2*nx1*w1*mx2-
-                     w3w4Q * w2*ny1*w1*my2-
-                     w1w2Q * w4Q *my3*ny3+
-                     w1w2Q * w4*my3*w3*ny4+
-                     w1w2Q * w4*ny3*w3*my4+
-                     w3w4Q * w2Q *my1*ny1-
-                     w1w2Q * w3Q *my4*ny4+
-                     w1w2Q * w4*mx3*w3*nx4-
-                     w1w2Q * w3Q *mx4*nx4);
-  return CGAL_NTS sign(coeff1);
-}
-
-template <typename NT> 
-inline
-int cmppd_coeff0(const NT& /*mx1*/, const NT& nx1, 
-                 const NT& /*my1*/, const NT& ny1, const NT& w1,
-                 const NT& /*mx2*/, const NT& nx2, 
-                 const NT& /*my2*/, const NT& ny2, const NT& w2,
-                 const NT& /*mx3*/, const NT& nx3, 
-                 const NT& /*my3*/, const NT& ny3, const NT& w3, 
-                 const NT& /*mx4*/, const NT& nx4, 
-                 const NT& /*my4*/, const NT& ny4, const NT& w4) 
-{ 
-  NT w1Q(w1*w1), w2Q(w2*w2), w3Q(w3*w3), w4Q(w4*w4);
-  NT w1w2Q(w1Q*w2Q), w3w4Q(w3Q*w4Q), two(2);
-  NT coeff0 = w3w4Q * (w1Q * ( nx2*nx2 + ny2*ny2 ) +
-                       w2Q * ( ny1*ny1 + nx1*nx1 )) -
-              w1w2Q * (w4Q * ( nx3*nx3 + ny3*ny3 ) +
-                       w3Q * ( nx4*nx4 + ny4*ny4 )) +
-              two* (- w3w4Q * (w2*nx1*w1*nx2 + w2*ny1*w1*ny2) 
-                    + w1w2Q * (w4*ny3*w3*ny4 + w4*nx3*w3*nx4));
-  return CGAL_NTS sign(coeff0);
-}
-
-DEFCOUNTER(cmppd2)
-DEFCOUNTER(cmppd1)
-DEFCOUNTER(cmppd0)
-
-// leghth.mws
-template <typename RT>
-int compare_pair_dist(
-  const Extended_point<RT>& p1, const Extended_point<RT>& p2, 
-  const Extended_point<RT>& p3, const Extended_point<RT>& p4) 
-{ 
-  int res;
-  try { INCTOTAL(cmppd2); Protect_FPU_rounding<true> Protection;
-    res = cmppd_coeff2(p1.mxD(),p1.nxD(),p1.myD(),p1.nyD(),p1.hwD(),
-                       p2.mxD(),p2.nxD(),p2.myD(),p2.nyD(),p2.hwD(),
-                       p3.mxD(),p3.nxD(),p3.myD(),p3.nyD(),p3.hwD(),
-                       p4.mxD(),p4.nxD(),p4.myD(),p4.nyD(),p4.hwD());
-  }
-  catch (Uncertain_conversion_exception) { INCEXCEPTION(cmppd2);
-    res = cmppd_coeff2(p1.mx(),p1.nx(),p1.my(),p1.ny(),p1.hw(),
-                       p2.mx(),p2.nx(),p2.my(),p2.ny(),p2.hw(),
-                       p3.mx(),p3.nx(),p3.my(),p3.ny(),p3.hw(),
-                       p4.mx(),p4.nx(),p4.my(),p4.ny(),p4.hw());
-  }
-  if ( res != 0 ) return res; 
-
-  try { INCTOTAL(cmppd1); Protect_FPU_rounding<true> Protection;
-    res = cmppd_coeff1(p1.mxD(),p1.nxD(),p1.myD(),p1.nyD(),p1.hwD(),
-                       p2.mxD(),p2.nxD(),p2.myD(),p2.nyD(),p2.hwD(),
-                       p3.mxD(),p3.nxD(),p3.myD(),p3.nyD(),p3.hwD(),
-                       p4.mxD(),p4.nxD(),p4.myD(),p4.nyD(),p4.hwD());
-  }
-  catch (Uncertain_conversion_exception) { INCEXCEPTION(cmppd1);
-    res = cmppd_coeff1(p1.mx(),p1.nx(),p1.my(),p1.ny(),p1.hw(),
-                       p2.mx(),p2.nx(),p2.my(),p2.ny(),p2.hw(),
-                       p3.mx(),p3.nx(),p3.my(),p3.ny(),p3.hw(),
-                       p4.mx(),p4.nx(),p4.my(),p4.ny(),p4.hw());
-  }
-  if ( res != 0 ) return res; 
-
-  try { INCTOTAL(cmppd0); Protect_FPU_rounding<true> Protection;
-    res = cmppd_coeff0(p1.mxD(),p1.nxD(),p1.myD(),p1.nyD(),p1.hwD(),
-                       p2.mxD(),p2.nxD(),p2.myD(),p2.nyD(),p2.hwD(),
-                       p3.mxD(),p3.nxD(),p3.myD(),p3.nyD(),p3.hwD(),
-                       p4.mxD(),p4.nxD(),p4.myD(),p4.nyD(),p4.hwD());
-  }
-  catch (Uncertain_conversion_exception) { INCEXCEPTION(cmppd0);
-    res = cmppd_coeff0(p1.mx(),p1.nx(),p1.my(),p1.ny(),p1.hw(),
-                       p2.mx(),p2.nx(),p2.my(),p2.ny(),p2.hw(),
-                       p3.mx(),p3.nx(),p3.my(),p3.ny(),p3.hw(),
-                       p4.mx(),p4.nx(),p4.my(),p4.ny(),p4.hw());
-  }
-  return res;
-}
-
-
-template <typename RT>
-class Extended_segment {
-  Extended_point<RT> _p1,_p2;
-public:
-  Extended_segment() : _p1(),_p2() {}
-  Extended_segment(const Extended_point<RT>& p1,
-                   const Extended_point<RT>& p2) : 
-    _p1(p1), _p2(p2) {}
-  Extended_segment(const Extended_segment<RT>& s) :
-    _p1(s._p1), _p2(s._p2) {}
-  Extended_segment<RT>& operator=(const Extended_segment<RT>& s)
-  { _p1 = s._p1; _p2 = s._p2; return *this; }
-
-  const Extended_point<RT>& source() const { return _p1; }
-  const Extended_point<RT>& target() const { return _p2; }
-
-  void line_equation(RT& a, RT& b, SPolynomial<RT>& c) const;
-};
-
-template <class RT> 
-std::ostream& operator<<(std::ostream& os, const Extended_segment<RT>& s)
-{ os << s.source() << s.target(); return os; }
-template <class RT> 
-std::istream& operator>>(std::istream& is, Extended_segment<RT>& s)
-{ Extended_point<RT> p1,p2;
-  is >> p1 >> p2; s=Extended_segment<RT>(p1,p2); return is; }
-
-template <typename RT>
-void Extended_segment<RT>::
-line_equation(RT& a, RT& b, SPolynomial<RT>& c) const
-{
-  bool sstandard = _p1.is_standard();
-  bool tstandard = _p2.is_standard();
-  if (sstandard && tstandard) {
-    a = _p1.ny()*_p2.hw() - _p2.ny()*_p1.hw();
-    b = _p1.hw()*_p2.nx() - _p2.hw()*_p1.nx();
-    c = SPolynomial<RT>(_p1.nx()*_p2.ny() - _p2.nx()*_p1.ny());
-    return;
-
-  }
-  Extended_point<RT> p;
-  bool correct_orientation=true;
-  if (!sstandard && !tstandard) {
-    bool x_equal = (_p1.hx()*_p2.hw() - _p2.hx()*_p1.hw()).is_zero();
-    bool y_equal = (_p1.hy()*_p2.hw() - _p2.hy()*_p1.hw()).is_zero();
-    if (x_equal && CGAL_NTS abs(_p1.mx())==_p1.hw() && _p1.nx()==0 ) 
-    { int dy = (_p2.hy()-_p1.hy()).sign(); 
-      a=-dy; b=0; c = SPolynomial<RT>(dy*_p1.hx().sign(),0); return; }
-    if (y_equal && CGAL_NTS abs(_p1.my())==_p1.hw() && _p1.ny()==0 ) 
-    { int dx = (_p2.hx()-_p1.hx()).sign(); 
-      a=0; b=dx; c = SPolynomial<RT>(-dx*_p1.hy().sign(),0); return; }
-    p = _p2; // evaluation according to mixed case
-
-  } 
-  else if (sstandard && !tstandard) 
-  { p = _p2; }
-  else if (!sstandard && tstandard) 
-  { p = _p1; correct_orientation=false; }
-  RT w = p.hw();
-  RT ci;
-  if ( correct_orientation ) {
-    a = -p.my();
-    b =  p.mx();
-    ci = (p.nx()*p.my()-p.ny()*p.mx())/w;
-  } else {
-    a =  p.my();
-    b = -p.mx();
-    ci = (p.ny()*p.mx()-p.nx()*p.my())/w;
-  }
-  c = SPolynomial<RT>(ci);
-
-
-
-}
-
-template <typename RT>
-Extended_point<RT> intersection(
-  const Extended_segment<RT>& s1, const Extended_segment<RT>& s2)
-{ 
-  RT a1,b1,a2,b2;
-  SPolynomial<RT> c1,c2;
-  s1.line_equation(a1,b1,c1);
-  s2.line_equation(a2,b2,c2);
-  SPolynomial<RT> x = c2*b1 - c1*b2;
-  SPolynomial<RT> y = c1*a2 - c2*a1;
-  RT w = a1*b2 - a2*b1; CGAL_assertion(w!=0);
-  #ifdef REDUCE_INTERSECTION_POINTS
-  RT xgcd,ygcd;
-  if ( x.m() == RT(0) )  xgcd = ( x.n() == 0 ? RT(1) : x.n() ); 
-  else /* != 0 */    xgcd = ( x.n() == 0 ? x.m() : CGAL_NTS gcd(x.m(),x.n()) );
-  if ( y.m() == RT(0) )  ygcd = ( y.n() == 0 ? RT(1) : y.n() ); 
-  else /* != 0 */    ygcd = ( y.n() == 0 ? y.m() : CGAL_NTS gcd(y.m(),y.n()) );
-  RT d = CGAL_NTS gcd(w,CGAL_NTS gcd(xgcd,ygcd));
-  x /= d;
-  y /= d;
-  w /= d;
-  #endif // REDUCE_INTERSECTION_POINTS
-  return Extended_point<RT>(x,y,w);
-}
-
-template <typename RT>
-inline
-int orientation(const Extended_segment<RT>& s, const Extended_point<RT>& p) 
-{ return orientation(s.source(),s.target(),p); }
-
-template <typename RT>
-inline
-bool is_degenerate(const Extended_segment<RT>& s)
-{ return s.source()==s.target(); }
-
-template <typename RT>
-inline
-bool contains(const Extended_segment<RT>& s, 
-              const Extended_point<RT>& p) 
-{ int p_rel_source = compare_xy(p,s.source());
-  int p_rel_target = compare_xy(p,s.target());
-  return ( orientation(s,p) == 0 ) &&
-    ( ( p_rel_source >= 0 && p_rel_target <= 0 ) ||
-      ( p_rel_source <= 0 && p_rel_target >= 0 ) );
-}
-
-
-template <typename RT>
-class Extended_direction {
-  Extended_point<RT> _p1,_p2;
-public:
-  Extended_direction() : _p1(),_p2() {}
-  Extended_direction(const Extended_direction<RT>& d) :
-    _p1(d._p1),_p2(d._p2) {}
-  Extended_direction<RT>& operator=(const Extended_direction<RT>& d) 
-  { _p1 = d._p1; _p2 = d._p2; return *this; }
-
-  Extended_direction(const Extended_point<RT>& p1,
-                     const Extended_point<RT>& p2) :
-    _p1(p1),_p2(p2) {}
-
-  Extended_direction(const RT& x, const RT& y) :
-    _p1(0,0,1),_p2(x,y,1) {}
-  
-  const Extended_point<RT>& p1() const { return _p1; }
-  const Extended_point<RT>& p2() const { return _p2; }
-  int dx_sign() const 
-  { return (_p2.hx()*_p1.hw()-_p1.hx()*_p2.hw()).sign(); }
-  int dy_sign() const 
-  { return (_p2.hy()*_p1.hw()-_p1.hy()*_p2.hw()).sign(); }
-};
-
-template <class RT> 
-std::ostream& operator<<(std::ostream& os, const Extended_direction<RT>& d)
-{ os << d.p1() << "," << d.p2(); 
-  return os; }
-template <class RT> 
-std::istream& operator>>(std::istream& is, Extended_direction<RT>& d)
-{ Extended_point<RT> x,y;
-  is >> x >> y; d = Extended_direction<RT>(x,y); 
-  return is; }
-
-
-template <typename NT>
-inline
-int coeff2_dor(const NT& mx1, const NT& /*nx1*/, 
-               const NT& my1, const NT& /*ny1*/, const NT& w1,
-               const NT& mx2, const NT& /*nx2*/, 
-               const NT& my2, const NT& /*ny2*/, const NT& w2,
-               const NT& mx3, const NT& /*nx3*/, 
-               const NT& my3, const NT& /*ny3*/, const NT& w3, 
-               const NT& mx4, const NT& /*nx4*/, 
-               const NT& my4, const NT& /*ny4*/, const NT& w4) 
-{
-  NT coeff2 = w1*mx2*w3*my4-w1*mx2*w4*my3-w2*mx1*w3*my4+w2*mx1*w4*my3-
-              w1*my2*w3*mx4+w1*my2*w4*mx3+w2*my1*w3*mx4-w2*my1*w4*mx3;
-  return CGAL_NTS sign(coeff2);
-}
-
-template <typename NT>
-inline
-int coeff1_dor(const NT& mx1, const NT& nx1, 
-               const NT& my1, const NT& ny1, const NT& w1,
-               const NT& mx2, const NT& nx2, 
-               const NT& my2, const NT& ny2, const NT& w2,
-               const NT& mx3, const NT& nx3, 
-               const NT& my3, const NT& ny3, const NT& w3, 
-               const NT& mx4, const NT& nx4, 
-               const NT& my4, const NT& ny4, const NT& w4)
-{
-  NT coeff1 = -w1*my2*w3*nx4+w1*mx2*w3*ny4+w1*my2*w4*nx3-w1*mx2*w4*ny3+
-               w1*nx2*w3*my4-w1*nx2*w4*my3+w2*my1*w3*nx4-w2*mx1*w3*ny4-
-               w2*my1*w4*nx3+w2*mx1*w4*ny3-w2*nx1*w3*my4+w2*nx1*w4*my3-
-               w1*ny2*w3*mx4+w1*ny2*w4*mx3+w2*ny1*w3*mx4-w2*ny1*w4*mx3;
-  return CGAL_NTS sign(coeff1);
-}
-
-template <typename NT>
-inline
-int coeff0_dor(const NT& /*mx1*/, const NT& nx1, 
-               const NT& /*my1*/, const NT& ny1, const NT& w1,
-               const NT& /*mx2*/, const NT& nx2, 
-               const NT& /*my2*/, const NT& ny2, const NT& w2,
-               const NT& /*mx3*/, const NT& nx3, 
-               const NT& /*my3*/, const NT& ny3, const NT& w3, 
-               const NT& /*mx4*/, const NT& nx4, 
-               const NT& /*my4*/, const NT& ny4, const NT& w4)
-{
-  NT coeff0 = w1*nx2*w3*ny4-w1*nx2*w4*ny3-w2*nx1*w3*ny4+w2*nx1*w4*ny3-
-              w1*ny2*w3*nx4+w1*ny2*w4*nx3+w2*ny1*w3*nx4-w2*ny1*w4*nx3;
-  return CGAL_NTS sign(coeff0);
-}
-
-DEFCOUNTER(ord2)
-DEFCOUNTER(ord1)
-DEFCOUNTER(ord0)
-
-
-template <typename RT>
-inline
-int orientation(const Extended_direction<RT>& d1,
-                const Extended_direction<RT>& d2)
-{ 
-  Extended_point<RT> p1(d1.p1()), p2(d1.p2()),
-                     p3(d2.p1()), p4(d2.p2());
-  int res;
-  try { INCTOTAL(ord2); Protect_FPU_rounding<true> Protection;
-    res = coeff2_dor(p1.mxD(),p1.nxD(),p1.myD(),p1.nyD(),p1.hwD(),
-                     p2.mxD(),p2.nxD(),p2.myD(),p2.nyD(),p2.hwD(),
-                     p3.mxD(),p3.nxD(),p3.myD(),p3.nyD(),p3.hwD(),
-                     p4.mxD(),p4.nxD(),p4.myD(),p4.nyD(),p4.hwD());
-  } catch (Uncertain_conversion_exception) { INCEXCEPTION(ord2);
-    res = coeff2_dor(p1.mx(),p1.nx(),p1.my(),p1.ny(),p1.hw(),
-                     p2.mx(),p2.nx(),p2.my(),p2.ny(),p2.hw(),
-                     p3.mx(),p3.nx(),p3.my(),p3.ny(),p3.hw(),
-                     p4.mx(),p4.nx(),p4.my(),p4.ny(),p4.hw());
-  }
-  if ( res != 0 ) return res; 
-
-  try { INCTOTAL(ord1); Protect_FPU_rounding<true> Protection;
-    res = coeff1_dor(p1.mxD(),p1.nxD(),p1.myD(),p1.nyD(),p1.hwD(),
-                     p2.mxD(),p2.nxD(),p2.myD(),p2.nyD(),p2.hwD(),
-                     p3.mxD(),p3.nxD(),p3.myD(),p3.nyD(),p3.hwD(),
-                     p4.mxD(),p4.nxD(),p4.myD(),p4.nyD(),p4.hwD());
-  } catch (Uncertain_conversion_exception) { INCEXCEPTION(ord1);
-    res = coeff1_dor(p1.mx(),p1.nx(),p1.my(),p1.ny(),p1.hw(),
-                     p2.mx(),p2.nx(),p2.my(),p2.ny(),p2.hw(),
-                     p3.mx(),p3.nx(),p3.my(),p3.ny(),p3.hw(),
-                     p4.mx(),p4.nx(),p4.my(),p4.ny(),p4.hw());
-  }
-  if ( res != 0 ) return res; 
-  try { INCTOTAL(ord0); Protect_FPU_rounding<true> Protection;
-    res = coeff0_dor(p1.mxD(),p1.nxD(),p1.myD(),p1.nyD(),p1.hwD(),
-                     p2.mxD(),p2.nxD(),p2.myD(),p2.nyD(),p2.hwD(),
-                     p3.mxD(),p3.nxD(),p3.myD(),p3.nyD(),p3.hwD(),
-                     p4.mxD(),p4.nxD(),p4.myD(),p4.nyD(),p4.hwD());
-  } catch (Uncertain_conversion_exception) { INCEXCEPTION(ord0);
-    res = coeff0_dor(p1.mx(),p1.nx(),p1.my(),p1.ny(),p1.hw(),
-                     p2.mx(),p2.nx(),p2.my(),p2.ny(),p2.hw(),
-                     p3.mx(),p3.nx(),p3.my(),p3.ny(),p3.hw(),
-                     p4.mx(),p4.nx(),p4.my(),p4.ny(),p4.hw());
-  }
-  return res;
-}
-
-template <typename RT>
-inline
-bool operator==(const Extended_direction<RT>& d1,
-                const Extended_direction<RT>& d2)
-{
-  return orientation(d1,d2) == 0 &&
-         d1.dx_sign() == d2.dx_sign() &&
-         d1.dy_sign() == d2.dy_sign();
-}
-
-template <typename RT>
-inline
-bool operator!=(const Extended_direction<RT>& d1,
-                const Extended_direction<RT>& d2)
-{ return !(d1==d2); }
-
-
-template <typename RT>
-bool strictly_ordered_ccw(const Extended_direction<RT>& d1,
-                          const Extended_direction<RT>& d2,
-                          const Extended_direction<RT>& d3)
-{ 
-  if (d1 == d3) return (d1 != d2);
-  int or12 = orientation(d1,d2);
-  int or13 = orientation(d1,d3);
-  int or32 = orientation(d3,d2);
-  if ( or13 >= 0 ) // not right_turn
-    return ( or12 > 0 && or32 < 0 );
-  else // ( or13 < 0 ) right_turn
-    return ( or12 > 0 || or32 < 0 );
-}
-
-template <typename RT>
-inline
-bool operator<(const Extended_direction<RT>& d1,
-               const Extended_direction<RT>& d2)
-{ Extended_direction<RT> d0(1,0);
-  bool d0d1eq = (d1 == d0);
-  bool d0d2eq = (d2 == d0);
-  return ( (d0d1eq && !d0d2eq) ||
-           ( strictly_ordered_ccw(d0,d1,d2) && (! d0d2eq) ) );
-}
-
-
-
-template<class Kernel>
-struct Is_extended_kernel;
-template <typename RT_>
-class Filtered_extended_homogeneous;
-
-template<class T>
-struct Is_extended_kernel<Filtered_extended_homogeneous<T> > {
-       typedef Tag_true value_type;
-};
-
-
-template <typename RT_>
-class Filtered_extended_homogeneous {
-typedef Filtered_extended_homogeneous<RT_> Self;
-
-public:
-typedef CGAL::Homogeneous<RT_> Standard_kernel;
-typedef typename Standard_kernel::RT           Standard_RT;
-typedef typename Standard_kernel::FT           Standard_FT;
-typedef typename Standard_kernel::Point_2      Standard_point_2;
-typedef typename Standard_kernel::Segment_2    Standard_segment_2;
-typedef typename Standard_kernel::Line_2       Standard_line_2;
-typedef typename Standard_kernel::Direction_2  Standard_direction_2;
-typedef typename Standard_kernel::Ray_2        Standard_ray_2;
-typedef typename Standard_kernel::Aff_transformation_2 
-  Standard_aff_transformation_2;
-
-typedef SPolynomial<RT_>        RT;
-typedef SQuotient<RT_>          FT;
-typedef Extended_point<RT_>     Point_2;
-typedef Extended_segment<RT_>   Segment_2;
-typedef Extended_direction<RT_> Direction_2;
-#ifdef KERNEL_CHECK
-typedef Extended_homogeneous<RT_>         CheckKernel;
-typedef typename CheckKernel::Point_2     CheckPoint;
-typedef typename CheckKernel::Direction_2 CheckDirection;
-typedef typename CheckKernel::Segment_2   CheckSegment;
-CheckKernel K;
-
-CheckSegment convert(const Segment_2& s) const
-{ return CheckSegment(s.source().checkrep(),
-                      s.target().checkrep()); }
-CheckDirection convert(const Direction_2& d) const
-{ return K.construct_direction(d.p2().checkrep(),d.p1().checkrep()); }
-
-#endif // KERNEL_CHECK
-
-
-
-
-enum Point_type { SWCORNER=1, LEFTFRAME, NWCORNER, 
-                  BOTTOMFRAME, STANDARD, TOPFRAME,
-                  SECORNER, RIGHTFRAME, NECORNER };
-
-Standard_RT dx(const Standard_line_2& l) const { return l.b(); }
-Standard_RT dy(const Standard_line_2& l) const { return -l.a(); }
-Standard_FT abscissa_distance(const Standard_line_2& l) const {
-  typename CGAL::Rational_traits<typename Standard_kernel::FT> rat_traits;
-  return rat_traits.make_rational(-l.c(), l.b());
-  //  return -l.c() / l.b();
-}
-
-Point_type determine_type(const Standard_line_2& l) const
-{
-  // CGAL_NEF_TRACEN("determine_type "<<l);
-  Standard_RT adx = CGAL_NTS abs(dx(l)), ady = CGAL_NTS abs(dy(l));
-  int sdx = CGAL_NTS sign(dx(l)), sdy = CGAL_NTS sign(dy(l));
-  int cmp_dx_dy = CGAL_NTS compare(adx,ady), s(1);
-  // CGAL_NEF_TRACEN("   "<<cmp_dx_dy<<" "<<sdx<<" "<<sdy);
-  if (sdx < 0 && ( cmp_dx_dy > 0 || ( cmp_dx_dy == 0 && 
-                                      sdy != (s=CGAL_NTS sign(abscissa_distance(l)))))) {
-    if (0 == s) return ( sdy < 0 ? SWCORNER : NWCORNER );
-    else        return LEFTFRAME;
-  } else if (sdx > 0 && ( cmp_dx_dy > 0 || ( cmp_dx_dy == 0 && 
-                                             sdy != (s=CGAL_NTS sign(abscissa_distance(l)))))) { 
-    if (0 == s) return ( sdy < 0 ? SECORNER : NECORNER );
-    else        return RIGHTFRAME;
-  } else if (sdy < 0 && ( cmp_dx_dy < 0 || ( cmp_dx_dy == 0 && 
-                                             abscissa_distance(l) < Standard_FT(0)))) {
-    return BOTTOMFRAME;
-  } else if (sdy > 0 && ( cmp_dx_dy < 0 || ( cmp_dx_dy == 0 && 
-                                             abscissa_distance(l) > Standard_FT(0)))) {
-    return TOPFRAME;
-  }
-  CGAL_error_msg(" determine_type: degenerate line.");
-  return (Point_type)-1; // never come here
-}
-
-Point_2 epoint(const Standard_RT& m1, const Standard_RT& n1, 
-                  const Standard_RT& m2, const Standard_RT& n2, 
-                                 const Standard_RT& n3) const
-{ return Point_2(m1,n1,m2,n2,n3); }
-
-public:
-
-Point_2 construct_point(const Standard_point_2& p) const
-{ return Point_2(p.hx(), p.hy(), p.hw()); }
-
-Point_2 construct_point(const Standard_line_2& l, Point_type& t) const
-{
-  t = determine_type(l);
-  // CGAL_NEF_TRACEN("construct_point(line)"<<l<<" "<<t);
-  Point_2 res;
-  switch (t) {
-    case SWCORNER:   res = epoint(-1, 0, -1, 0, 1); break;
-    case NWCORNER:   res = epoint(-1, 0,  1, 0, 1); break;
-    case SECORNER:   res = epoint( 1, 0, -1, 0, 1); break; 
-    case NECORNER:   res = epoint( 1, 0,  1, 0, 1); break;  
-    case LEFTFRAME:  res = epoint(-l.b(), 0,  l.a(), -l.c(), l.b()); 
-                     break; 
-    case RIGHTFRAME: res = epoint( l.b(), 0, -l.a(), -l.c(), l.b()); 
-                     break; 
-    case BOTTOMFRAME: res = epoint( l.b(), -l.c(), -l.a(), 0, l.a()); 
-                     break; 
-    case TOPFRAME: res = epoint(-l.b(), -l.c(),  l.a(), 0, l.a()); 
-                     break; 
-    default: CGAL_error_msg("EPoint type not correct!");
-  }
-  return res;
-}
-
-Point_2 construct_point(const Standard_point_2& p1, 
-                        const Standard_point_2& p2, 
-                        Point_type& t) const
-{ return construct_point(Standard_line_2(p1,p2),t); }
-Point_2 construct_point(const Standard_line_2& l) const
-{ Point_type dummy; return construct_point(l,dummy); }
-Point_2 construct_point(const Standard_point_2& p1, 
-                        const Standard_point_2& p2) const
-{ return construct_point(Standard_line_2(p1,p2)); }
-Point_2 construct_point(const Standard_point_2& p, 
-                        const Standard_direction_2& d) const
-{ return construct_point(Standard_line_2(p,d)); }
-Point_2 construct_opposite_point(const Standard_line_2& l) const
-{ Point_type dummy; return construct_point(l.opposite(),dummy); }
-
-Point_type type(const Point_2& p) const
-{
-  if (p.is_standard()) return STANDARD;
-  // now we are on the square frame
-  RT rx = p.hx();
-  RT ry = p.hy();
-  int sx = CGAL_NTS sign(rx);
-  int sy = CGAL_NTS sign(ry);
-  if (sx < 0) rx = -rx;
-  if (sy < 0) ry = -ry;
-  if (rx>ry) {
-    if (sx > 0) return RIGHTFRAME;
-    else        return LEFTFRAME;
-  }
-  if (rx<ry) {
-    if (sy > 0) return TOPFRAME;
-    else        return BOTTOMFRAME;
-  }
-  // now (rx == ry) 
-  if (sx==sy) {
-    if (sx < 0) return SWCORNER;
-    else        return NECORNER;
-  } else { CGAL_assertion(sx==-sy);
-    if (sx < 0) return NWCORNER;
-    else        return SECORNER;
-  }
-}
-
-
-bool is_standard(const Point_2& p) const
-{ return p.is_standard();  }
-
-Standard_point_2 standard_point(const Point_2& p) const
-{ CGAL_assertion(is_standard(p));
-  return Standard_point_2(p.nx(),p.ny(),p.hw());
-}
-
-Standard_line_2 standard_line(const Point_2& p) const
-{ CGAL_assertion(!p.is_standard());
-  Standard_point_2 p0(p.nx(),p.ny(),p.hw());
-  Standard_point_2 p1(p.mx()+p.nx(),p.my()+p.ny(),p.hw());
-  return Standard_line_2(p0,p1);
-}
-
-Standard_ray_2 standard_ray(const Point_2& p) const
-{ CGAL_assertion(!p.is_standard());
-  Standard_line_2 l = standard_line(p);
-  Standard_direction_2 d = l.direction();
-  Standard_point_2 q = l.point(0);
-  return Standard_ray_2(q,d);
-}
-
-Point_2 NE() const { return construct_point(Standard_line_2(-1, 1,0)); }
-Point_2 SE() const { return construct_point(Standard_line_2( 1, 1,0)); }
-Point_2 NW() const { return construct_point(Standard_line_2(-1,-1,0)); }
-Point_2 SW() const { return construct_point(Standard_line_2( 1,-1,0)); }
-
-int orientation(const Point_2& p1, const Point_2& p2, const Point_2& p3) 
-const
-{ CHECK(K.orientation(p1.checkrep(),p2.checkrep(),p3.checkrep()),
-        CGAL::orientation(p1,p2,p3))
-  return CGAL::orientation(p1,p2,p3); }
-
-bool left_turn(const Point_2& p1, const Point_2& p2, const Point_2& p3) 
-const
-{ return orientation(p1,p2,p3) > 0; }
-
-bool first_pair_closer_than_second(
-  const Point_2& p1, const Point_2& p2, 
-  const Point_2& p3, const Point_2& p4) const
-{ CHECK(K.first_pair_closer_than_second(p1.checkrep(),p2.checkrep(),
-                                        p3.checkrep(),p4.checkrep()),
-        CGAL::compare_pair_dist(p1,p2,p3,p4)<0)
-  return CGAL::compare_pair_dist(p1,p2,p3,p4)<0; }
-
-int compare_xy(const Point_2& p1, const Point_2& p2) const
-{ CHECK(K.compare_xy(p1.checkrep(),p2.checkrep()),
-        CGAL::compare_xy(p1,p2))
-  return CGAL::compare_xy(p1,p2); }
-
-int compare_x(const Point_2& p1, const Point_2& p2) const
-{ CHECK(K.compare_x(p1.checkrep(),p2.checkrep()),
-        CGAL::compare_x(p1,p2))
-  return CGAL::compare_x(p1,p2); }
-
-int compare_y(const Point_2& p1, const Point_2& p2) const
-{ CHECK(K.compare_y(p1.checkrep(),p2.checkrep()),
-        CGAL::compare_y(p1,p2))
-  return CGAL::compare_y(p1,p2); }
-
-bool strictly_ordered_along_line(
-  const Point_2& p1, const Point_2& p2, const Point_2& p3) const
-{ CHECK(K.strictly_ordered_along_line(
-          p1.checkrep(),p2.checkrep(),p3.checkrep()),
-        CGAL::strictly_ordered_along_line(p1,p2,p3))
-  return CGAL::strictly_ordered_along_line(p1,p2,p3); }
-
-
-Segment_2 construct_segment(const Point_2& p, const Point_2& q) const
-{ return Segment_2(p,q); }
-
-Point_2 source(const Segment_2& s) const
-{ return s.source(); }
-
-Point_2 target(const Segment_2& s) const
-{ return s.target(); }
-
-bool is_degenerate(const Segment_2& s) const
-{ return s.source()==s.target(); }
-
-int orientation(const Segment_2& s, const Point_2& p) const
-{ return orientation(s.source(),s.target(),p); }
-
-Point_2 intersection(const Segment_2& s1, const Segment_2& s2) const
-{ CHECK(CGAL::intersection(s1,s2).checkrep(),
-        K.intersection(convert(s1),convert(s2)))
-  return CGAL::intersection(s1,s2); }
-
-bool contains(const Segment_2& s, const Point_2& p) const
-/*{\Mop returns true iff |s| contains |p|.}*/
-{ return CGAL::contains(s,p); }
-
-Direction_2 construct_direction(
-  const Point_2& p1, const Point_2& p2) const
-{ return Direction_2(p1,p2); }
-
-bool strictly_ordered_ccw(const Direction_2& d1, 
-  const Direction_2& d2, const Direction_2& d3) const
-{ CHECK(K.strictly_ordered_ccw(convert(d1),convert(d2),convert(d3)),
-        CGAL::strictly_ordered_ccw(d1,d2,d3));
-  return CGAL::strictly_ordered_ccw(d1,d2,d3); }
-
-void print_statistics() const
-{
-  std::cout << "Statistics of filtered kernel:\n";
-  std::cout << "total failed double filter stages = (now needs CGAL_PROFILE)\n";
-  PRINT_CHECK_ENABLED;
-  PRINT_STATISTICS(or2);
-  PRINT_STATISTICS(or1);
-  PRINT_STATISTICS(or0);
-  PRINT_STATISTICS(cmpx1);
-  PRINT_STATISTICS(cmpx0);
-  PRINT_STATISTICS(cmpy1);
-  PRINT_STATISTICS(cmpy0);
-  PRINT_STATISTICS(cmppd2);
-  PRINT_STATISTICS(cmppd1);
-  PRINT_STATISTICS(cmppd0);
-  PRINT_STATISTICS(ord2);
-  PRINT_STATISTICS(ord1);
-  PRINT_STATISTICS(ord0);
-}
-
-template <class Forward_iterator>
-void determine_frame_radius(Forward_iterator start, Forward_iterator end,
-                            Standard_RT& R0) const
-{ Standard_RT R;
-  while ( start != end ) {
-    Point_2 p = *start;
-    if ( is_standard(p) ) {
-      R = (CGAL::max)(CGAL_NTS abs(p.mx())/p.hw(), 
-		      CGAL_NTS abs(p.my())/p.hw());
-    } else {
-      RT rx = CGAL_NTS abs(p.hx()), ry = CGAL_NTS abs(p.hy());
-      if ( rx[1] > ry[1] )      R = CGAL_NTS abs(ry[0]-rx[0])/(rx[1]-ry[1]);
-      else if ( rx[1] < ry[1] ) R = CGAL_NTS abs(rx[0]-ry[0])/(ry[1]-rx[1]);
-      else /* rx[1] == ry[1] */ R = CGAL_NTS abs(rx[0]-ry[0])/(2*p.hw());
-    }
-    R0 = (CGAL::max)(R+1,R0); ++start;
-  }
-}
-
-const char* output_identifier() const 
-{ return "Filtered_extended_homogeneous"; }
-
-
-
-};
-
-
-
-} //namespace CGAL
-
-#undef CHECK
-#undef KERNEL_CHECK
-#undef REDUCE_INTERSECTION_POINTS
-#undef KERNEL_ANALYSIS
-#undef COUNTER
-#undef INCTOTAL
-#undef INCEXCEPTION
-#undef PRINT_STATISTICS
-#undef PRINT_CHECK_ENABLED
-
-#endif // CGAL_FILTERED_EXTENDED_HOMOGENEOUS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/GMP/Gmpfr_type.h b/3rdparty/CGAL-4.8/include/CGAL/GMP/Gmpfr_type.h
deleted file mode 100644
index a4ea9eb..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/GMP/Gmpfr_type.h
+++ /dev/null
@@ -1,1341 +0,0 @@
-// Copyright (c) 2007-2010 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 at gmx.com>
-
-#ifndef CGAL_GMPFR_TYPE_H
-#define CGAL_GMPFR_TYPE_H
-
-#include <CGAL/gmp.h>
-#include <mpfr.h>
-#include <boost/operators.hpp>
-#include <CGAL/Handle_for.h>
-#include <CGAL/GMP/Gmpz_type.h>
-#include <CGAL/GMP/Gmpzf_type.h>
-#include <limits>
-#include <CGAL/Uncertain.h>
-#include <CGAL/ipower.h>
-#include <CGAL/IO/io.h>
-
-#if MPFR_VERSION_MAJOR < 3
-        typedef mp_rnd_t mpfr_rnd_t;
-        typedef mp_prec_t mpfr_prec_t;
-        typedef mp_exp_t mpfr_exp_t;
-        #define MPFR_RNDN GMP_RNDN
-        #define MPFR_RNDZ GMP_RNDZ
-        #define MPFR_RNDU GMP_RNDU
-        #define MPFR_RNDD GMP_RNDD
-        #define CGAL_GMPFR_GET_Z_2EXP mpfr_get_z_exp
-#else
-        #define CGAL_GMPFR_GET_Z_2EXP mpfr_get_z_2exp
-#endif
-
-namespace CGAL{
-
-class Gmpfr;
-
-bool operator<(const Gmpfr&,const Gmpfr&);
-bool operator==(const Gmpfr&,const Gmpfr&);
-
-bool operator<(const Gmpfr&,long);
-bool operator>(const Gmpfr&,long);
-bool operator==(const Gmpfr&,long);
-
-bool operator<(const Gmpfr&,unsigned long);
-bool operator>(const Gmpfr&,unsigned long);
-bool operator==(const Gmpfr&,unsigned long);
-
-bool operator<(const Gmpfr&,int);
-bool operator>(const Gmpfr&,int);
-bool operator==(const Gmpfr&,int);
-
-bool operator<(const Gmpfr&,double);
-bool operator>(const Gmpfr&,double);
-bool operator==(const Gmpfr&,double);
-
-bool operator<(const Gmpfr&,long double);
-bool operator>(const Gmpfr&,long double);
-bool operator==(const Gmpfr&,long double);
-
-bool operator<(const Gmpfr&,const Gmpz&);
-bool operator>(const Gmpfr&,const Gmpz&);
-bool operator==(const Gmpfr&,const Gmpz&);
-
-struct Gmpfr_rep{
-        mpfr_t floating_point_number;
-        bool clear_on_destruction;
-        Gmpfr_rep():clear_on_destruction(true){}
-        ~Gmpfr_rep(){
-                if(clear_on_destruction)
-                        mpfr_clear(floating_point_number);
-        }
-};
-
-namespace internal{
-        template <>
-        struct Minmax_traits<mpfr_rnd_t>{
-                static const mpfr_rnd_t min=MPFR_RNDN;
-        #if MPFR_VERSION_MAJOR < 3
-                static const mpfr_rnd_t max=GMP_RND_MAX;
-        #else
-                static const mpfr_rnd_t max=MPFR_RNDF;
-        #endif
-        };
-} // namespace internal
-
-// The class Gmpfr is reference-counted using CGAL's handle mechanism. This
-// behavior may be changed, setting the flag CGAL_GMPFR_NO_REFCOUNT. A
-// non-reference-counted class is slightly more efficient in case the
-// implementation does not need to copy numbers (this is not usually the
-// case). Nevertheless, setting the flag may be useful for debugging
-// purposes.
-
-class Gmpfr:
-#ifdef CGAL_GMPFR_NO_REFCOUNT
-        Gmpfr_rep,
-#else
-        Handle_for<Gmpfr_rep>,
-#endif
-        boost::ordered_euclidian_ring_operators1<Gmpfr,
-        boost::ordered_euclidian_ring_operators2<Gmpfr,long,
-        boost::ordered_euclidian_ring_operators2<Gmpfr,unsigned long,
-        boost::ordered_euclidian_ring_operators2<Gmpfr,int,
-        boost::totally_ordered2<Gmpfr,double,
-        boost::totally_ordered2<Gmpfr,long double,
-        boost::ordered_euclidian_ring_operators2<Gmpfr,Gmpz
-        > > > > > > >
-{
-        private:
-
-#ifndef CGAL_GMPFR_NO_REFCOUNT
-        typedef Handle_for<Gmpfr_rep>   Base;
-#endif
-
-        static Uncertain<mpfr_rnd_t> _gmp_rnd(std::float_round_style r){
-                switch(r){
-                        case std::round_toward_infinity: return MPFR_RNDU;
-                        case std::round_toward_neg_infinity: return MPFR_RNDD;
-                        case std::round_toward_zero: return MPFR_RNDZ;
-                        case std::round_to_nearest: return MPFR_RNDN;
-                        default: return Uncertain<mpfr_rnd_t>::indeterminate();
-                }
-        };
-
-        static std::float_round_style _cgal_rnd(mpfr_rnd_t r){
-                switch(r){
-                        case MPFR_RNDU: return std::round_toward_infinity;
-                        case MPFR_RNDD: return std::round_toward_neg_infinity;
-                        case MPFR_RNDZ: return std::round_toward_zero;
-                        case MPFR_RNDN: return std::round_to_nearest;
-                        default: return std::round_indeterminate;
-                }
-        };
-
-        public:
-
-        typedef mpfr_prec_t             Precision_type;
-
-        // access
-
-        mpfr_srcptr fr()const{
-#ifdef CGAL_GMPFR_NO_REFCOUNT
-                return floating_point_number;
-#else
-                return Ptr()->floating_point_number;
-#endif
-        }
-
-        mpfr_ptr fr(){
-#ifdef CGAL_GMPFR_NO_REFCOUNT
-                return floating_point_number;
-#else
-                return ptr()->floating_point_number;
-#endif
-        }
-
-        // The function dont_clear_on_destruction() is used to tell the
-        // object that the mpfr_t must not be cleared at object destruction
-        // (the destructor contrasts with that of the GMP types, where the
-        // structure is always cleared). The reason to do this is that,
-        // sometimes, the object is constructed from a mpfr_t structure and
-        // we know that the structure will be cleared somewhere else. The
-        // mpfr_t will not need to be cleared in case the object A is
-        // constructed from another Gmpfr object B, specifying the
-        // precision, and it happens that this precision is the same as the
-        // precision of A. In this case, a shallow copy is constructed.
-
-        void dont_clear_on_destruction(){
-#ifdef CGAL_GMPFR_NO_REFCOUNT
-                clear_on_destruction=false;
-#else
-                ptr()->clear_on_destruction=false;
-#endif
-        }
-
-        bool is_unique(){
-#ifdef CGAL_GMPFR_NO_REFCOUNT
-                return true;
-#else
-                return unique();
-#endif
-        }
-
-        // construction
-
-        Gmpfr(){
-                mpfr_init(fr());
-        }
-
-        Gmpfr(mpfr_srcptr f){
-                mpfr_custom_init_set(
-                        fr(),
-                        mpfr_custom_get_kind(f),
-                        mpfr_custom_get_exp(f),
-                        mpfr_get_prec(f),
-                        mpfr_custom_get_mantissa(f));
-                dont_clear_on_destruction();
-                CGAL_assertion((mpfr_nan_p(f)!=0 && mpfr_nan_p(fr())!=0) ||
-                               (mpfr_unordered_p(f,fr())==0 &&
-                                mpfr_equal_p(f,fr())!=0));
-        }
-
-        Gmpfr(mpfr_srcptr f,
-              std::float_round_style r,
-              Gmpfr::Precision_type p=Gmpfr::get_default_precision()){
-                CGAL_assertion(p>=MPFR_PREC_MIN&&p<=MPFR_PREC_MAX);
-                if(p==mpfr_get_prec(f)){
-                        mpfr_custom_init_set(
-                                fr(),
-                                mpfr_custom_get_kind(f),
-                                mpfr_custom_get_exp(f),
-                                mpfr_get_prec(f),
-                                mpfr_custom_get_mantissa(f));
-                        dont_clear_on_destruction();
-                        CGAL_assertion((mpfr_nan_p(f)!=0&&mpfr_nan_p(fr())!=0)||
-                                       (mpfr_unordered_p(f,fr())==0&&
-                                        mpfr_equal_p(f,fr())!=0));
-                }else{
-                        mpfr_init2(fr(),p);
-                        mpfr_set(fr(),f,_gmp_rnd(r));
-                        CGAL_assertion(mpfr_get_prec(fr())<mpfr_get_prec(f)||
-                                       mpfr_equal_p(fr(),f)!=0);
-                }
-        }
-
-        Gmpfr(mpfr_srcptr f,Gmpfr::Precision_type p){
-                CGAL_assertion(p>=MPFR_PREC_MIN&&p<=MPFR_PREC_MAX);
-                if(p==mpfr_get_prec(f)){
-                        mpfr_custom_init_set(
-                                fr(),
-                                mpfr_custom_get_kind(f),
-                                mpfr_custom_get_exp(f),
-                                mpfr_get_prec(f),
-                                mpfr_custom_get_mantissa(f));
-                        dont_clear_on_destruction();
-                        CGAL_assertion((mpfr_nan_p(f)!=0&&mpfr_nan_p(fr())!=0)||
-                                       (mpfr_unordered_p(f,fr())==0&&
-                                        mpfr_equal_p(f,fr())!=0));
-                }else{
-                        mpfr_init2(fr(),p);
-                        mpfr_set(fr(),f,mpfr_get_default_rounding_mode());
-                        CGAL_assertion(p<mpfr_get_prec(f)||
-                                       mpfr_equal_p(fr(),f)!=0);
-                }
-        }
-
-        Gmpfr(const Gmpzf &f,
-              std::float_round_style r,
-              Gmpfr::Precision_type p=Gmpfr::get_default_precision()){
-                CGAL_assertion(p>=MPFR_PREC_MIN&&p<=MPFR_PREC_MAX);
-                mpfr_init2(fr(),p);
-                mpfr_set_z(fr(),f.man(),_gmp_rnd(r));
-                mpfr_mul_2si(fr(),fr(),f.exp(),_gmp_rnd(r));
-        }
-
-        Gmpfr(const Gmpzf &f,Gmpfr::Precision_type p){
-                CGAL_assertion(p>=MPFR_PREC_MIN&&p<=MPFR_PREC_MAX);
-                mpfr_init2(fr(),p);
-                mpfr_set_z(fr(),f.man(),mpfr_get_default_rounding_mode());
-                mpfr_mul_2si(fr(),
-                             fr(),
-                             f.exp(),
-                             mpfr_get_default_rounding_mode());
-        }
-
-        Gmpfr(const Gmpzf &f){
-                mpfr_init2(fr(),
-                           static_cast<Gmpfr::Precision_type>(
-                                   mpz_sizeinbase(f.man(),2)<MPFR_PREC_MIN?
-                                   MPFR_PREC_MIN:
-                                   mpz_sizeinbase(f.man(),2)));
-                mpfr_set_z(fr(),f.man(),MPFR_RNDN);
-                CGAL_assertion_msg(mpfr_cmp_z(fr(),f.man())==0,
-                                   "inexact conversion of a Gmpzf mantissa");
-                CGAL_assertion_code(int inexact=)
-                mpfr_mul_2si(fr(),fr(),f.exp(),MPFR_RNDN);
-                CGAL_assertion_msg(inexact==0,"inexact conversion from Gmpzf");
-        }
-
-        Gmpfr(const std::pair<Gmpz,long> &intexp,
-              std::float_round_style r=Gmpfr::get_default_rndmode(),
-              Gmpfr::Precision_type p=Gmpfr::get_default_precision()){
-                CGAL_assertion(p>=MPFR_PREC_MIN&&p<=MPFR_PREC_MAX);
-                mpfr_init2(fr(),p);
-                mpfr_set_z(fr(),intexp.first.mpz(),_gmp_rnd(r));
-                mpfr_mul_2si(fr(),fr(),intexp.second,_gmp_rnd(r));
-        }
-
-        Gmpfr(const std::pair<Gmpz,long> &intexp,Gmpfr::Precision_type p){
-                CGAL_assertion(p>=MPFR_PREC_MIN&&p<=MPFR_PREC_MAX);
-                mpfr_init2(fr(),p);
-                mpfr_set_z(fr(),
-                           intexp.first.mpz(),
-                           mpfr_get_default_rounding_mode());
-                mpfr_mul_2si(fr(),
-                             fr(),
-                             intexp.second,
-                             mpfr_get_default_rounding_mode());
-        }
-
-#define CGAL_GMPFR_CONSTRUCTOR_FROM_TYPE(_type,_fun) \
-        Gmpfr(_type x, \
-              std::float_round_style r, \
-              Gmpfr::Precision_type p=Gmpfr::get_default_precision()){ \
-                CGAL_assertion(p>=MPFR_PREC_MIN&&p<=MPFR_PREC_MAX); \
-                mpfr_init2(fr(),p); \
-                _fun(fr(),x,_gmp_rnd(r)); \
-        } \
-        Gmpfr(_type x,Gmpfr::Precision_type p){ \
-                CGAL_assertion(p>=MPFR_PREC_MIN&&p<=MPFR_PREC_MAX); \
-                mpfr_init2(fr(),p); \
-                _fun(fr(),x,mpfr_get_default_rounding_mode()); \
-        } \
-        Gmpfr(_type x){ \
-                mpfr_init2(fr(),mp_bits_per_limb*sizeof(_type)); \
-                _fun(fr(),x,mpfr_get_default_rounding_mode()); \
-        }
-
-        CGAL_GMPFR_CONSTRUCTOR_FROM_TYPE(int,mpfr_set_si);
-        CGAL_GMPFR_CONSTRUCTOR_FROM_TYPE(long,mpfr_set_si);
-        CGAL_GMPFR_CONSTRUCTOR_FROM_TYPE(unsigned,mpfr_set_ui);
-        CGAL_GMPFR_CONSTRUCTOR_FROM_TYPE(unsigned long,mpfr_set_ui);
-        CGAL_GMPFR_CONSTRUCTOR_FROM_TYPE(double,mpfr_set_d);
-
-        // With the MSVC compiler, 'long double' and 'double' are two
-        // different types, but with the same size: sizeof(long double)==8.
-        // For that reason, the cast of a long double to a double is
-        // exact.
-        // What is more, if one compile the mpfr library with mingw(32|64),
-        // on Windows, this compiler has sizeof(long double)==16, as
-        // gcc/g++ on Linux, and the produces libmpfr-1.dll has a symbol
-        // mpfr_set_ld which is binary incompatible with a call from MSVC.
-        // For those two reason, the constructor from 'long
-        // double' calls 'mpfr_set_l' on MSVC, instead of 'mpfr_set_ld'.
-        // That should not modify the semantic of a CGAL program, but
-        // only avoid the binary incompatibility of a CGAL program compiled
-        // with MSVC with the libmpfr-1.dll compiled with mingw.
-#ifdef _MSC_VER
-        CGAL_GMPFR_CONSTRUCTOR_FROM_TYPE(long double,mpfr_set_d);
-#else
-        CGAL_GMPFR_CONSTRUCTOR_FROM_TYPE(long double,mpfr_set_ld);
-#endif
-#undef CGAL_GMPFR_CONSTRUCTOR_FROM_TYPE
-
-#define CGAL_GMPFR_CONSTRUCTOR_FROM_OBJECT(_class,_member,_fun,_preccode) \
-        Gmpfr(const _class &x, \
-              std::float_round_style r, \
-              Gmpfr::Precision_type p=Gmpfr::get_default_precision()){ \
-                CGAL_assertion(p>=MPFR_PREC_MIN&&p<=MPFR_PREC_MAX); \
-                mpfr_init2(fr(),p); \
-                _fun(fr(),x._member,_gmp_rnd(r)); \
-        } \
-        Gmpfr(const _class &x,Gmpfr::Precision_type p){ \
-                CGAL_assertion(p<=MPFR_PREC_MAX); \
-                mpfr_init2(fr(),MPFR_PREC_MIN<p?p:MPFR_PREC_MIN); \
-                _fun(fr(),x._member,mpfr_get_default_rounding_mode()); \
-        } \
-        Gmpfr(const _class &x){ \
-                Gmpfr::Precision_type p=(_preccode); \
-                mpfr_init2(fr(),MPFR_PREC_MIN<p?p:MPFR_PREC_MIN); \
-                _fun(fr(),x._member,MPFR_RNDN); \
-        }
-
-        CGAL_GMPFR_CONSTRUCTOR_FROM_OBJECT(Gmpz,
-                                           mpz(),
-                                           mpfr_set_z,
-                                           static_cast<Gmpfr::Precision_type>(
-                                                x.bit_size()));
-
-#undef CGAL_GMPFR_CONSTRUCTOR_FROM_OBJECT
-
-        // When Gmpfr is refence counted, we inherit the assignment
-        // operator and the copy constructor from Handle_for.
-#ifdef CGAL_GMPFR_NO_REFCOUNT
-        Gmpfr& operator=(const Gmpfr &a){
-                mpfr_set_prec(fr(),a.get_precision());
-                mpfr_set(fr(),a.fr(),mpfr_get_default_rounding_mode());
-                return *this;
-        }
-
-        Gmpfr(const Gmpfr &a){
-                mpfr_init2(fr(),a.get_precision());
-                mpfr_set(fr(),a.fr(),MPFR_RNDN);
-        }
-#endif
-
-        Gmpfr(const Gmpfr &a,
-              std::float_round_style r,
-              Gmpfr::Precision_type p=Gmpfr::get_default_precision()){
-                CGAL_assertion(p>=MPFR_PREC_MIN&&p<=MPFR_PREC_MAX);
-#ifndef CGAL_GMPFR_NO_REFCOUNT
-                if(p==a.get_precision()){
-                        Gmpfr temp(a);
-                        // we use dont_clear_on_destruction because the
-                        // mpfr_t pointed to by fr() was never initialized
-                        dont_clear_on_destruction();
-                        swap(temp);
-                }else
-#endif
-                {
-                        mpfr_init2(fr(),p);
-                        mpfr_set(fr(),a.fr(),_gmp_rnd(r));
-                }
-        }
-
-        Gmpfr(const Gmpfr &a,Gmpfr::Precision_type p){
-                CGAL_assertion(p>=MPFR_PREC_MIN&&p<=MPFR_PREC_MAX);
-#ifndef CGAL_GMPFR_NO_REFCOUNT
-                if(p==a.get_precision()){
-                        Gmpfr temp(a);
-                        // we use dont_clear_on_destruction because the
-                        // mpfr_t pointed to by fr() was never initialized
-                        dont_clear_on_destruction();
-                        swap(temp);
-                }else
-#endif
-                {
-                        mpfr_init2(fr(),p);
-                        mpfr_set(fr(),a.fr(),mpfr_get_default_rounding_mode());
-                }
-        }
-
-        // default rounding mode
-
-        static std::float_round_style get_default_rndmode();
-        static std::float_round_style
-                set_default_rndmode(std::float_round_style);
-
-        // default precision
-
-        static Gmpfr::Precision_type get_default_precision();
-        static Gmpfr::Precision_type
-                set_default_precision(Gmpfr::Precision_type);
-
-        // precision of a single Gmpfr object
-
-        Gmpfr::Precision_type get_precision()const;
-        Gmpfr round(Gmpfr::Precision_type,std::float_round_style)const;
-
-        // mpfr global inexact flags
-
-        static void clear_flags();
-        static bool underflow_flag();
-        static bool overflow_flag();
-        static bool nan_flag();
-        static bool inex_flag();
-        static bool erange_flag();
-
-        // arithmetics
-
-        Gmpfr operator+()const;
-        Gmpfr operator-()const;
-
-#define CGAL_GMPFR_DECLARE_OPERATORS(_type) \
-        Gmpfr& operator+=(_type); \
-        Gmpfr& operator-=(_type); \
-        Gmpfr& operator*=(_type); \
-        Gmpfr& operator/=(_type);
-
-        CGAL_GMPFR_DECLARE_OPERATORS(const Gmpfr&)
-        Gmpfr& operator%=(const Gmpfr&);
-        CGAL_GMPFR_DECLARE_OPERATORS(long)
-        CGAL_GMPFR_DECLARE_OPERATORS(unsigned long)
-        CGAL_GMPFR_DECLARE_OPERATORS(int)
-        CGAL_GMPFR_DECLARE_OPERATORS(const Gmpz&)
-
-#undef CGAL_GMPFR_DECLARE_OPERATORS
-
-#define CGAL_GMPFR_DECLARE_STATIC_FUNCTION(_f,_t1,_t2) \
-        static Gmpfr _f (_t1, \
-                         _t2, \
-                         std::float_round_style=Gmpfr::get_default_rndmode()); \
-        static Gmpfr _f (_t1, \
-                         _t2, \
-                         Gmpfr::Precision_type, \
-                         std::float_round_style=Gmpfr::get_default_rndmode());
-
-#define CGAL_GMPFR_DECLARE_STATIC_FUNCTIONS(_t2) \
-        CGAL_GMPFR_DECLARE_STATIC_FUNCTION(add,const Gmpfr&,_t2) \
-        CGAL_GMPFR_DECLARE_STATIC_FUNCTION(sub,const Gmpfr&,_t2) \
-        CGAL_GMPFR_DECLARE_STATIC_FUNCTION(mul,const Gmpfr&,_t2) \
-        CGAL_GMPFR_DECLARE_STATIC_FUNCTION(div,const Gmpfr&,_t2)
-
-        CGAL_GMPFR_DECLARE_STATIC_FUNCTIONS(const Gmpfr&)
-        CGAL_GMPFR_DECLARE_STATIC_FUNCTIONS(long)
-        CGAL_GMPFR_DECLARE_STATIC_FUNCTIONS(unsigned long)
-        CGAL_GMPFR_DECLARE_STATIC_FUNCTIONS(int)
-        CGAL_GMPFR_DECLARE_STATIC_FUNCTIONS(const Gmpz&)
-
-#undef CGAL_GMPFR_DECLARE_STATIC_FUNCTION
-#undef CGAL_GMPFR_DECLARE_STATIC_FUNCTIONS
-
-#define CGAL_GMPFR_DECLARE_NO_ARGUMENT_FUNCTION(_f) \
-        Gmpfr _f (std::float_round_style=Gmpfr::get_default_rndmode()) const; \
-        Gmpfr _f (Gmpfr::Precision_type,\
-                  std::float_round_style=Gmpfr::get_default_rndmode()) const;
-
-        CGAL_GMPFR_DECLARE_NO_ARGUMENT_FUNCTION(abs)
-        CGAL_GMPFR_DECLARE_NO_ARGUMENT_FUNCTION(sqrt)
-        CGAL_GMPFR_DECLARE_NO_ARGUMENT_FUNCTION(cbrt)
-        Gmpfr kthroot
-                (int,std::float_round_style=Gmpfr::get_default_rndmode()) const;
-        Gmpfr kthroot
-                (int,
-                 Gmpfr::Precision_type,
-                 std::float_round_style=Gmpfr::get_default_rndmode()) const;
-        CGAL_GMPFR_DECLARE_NO_ARGUMENT_FUNCTION(square)
-
-#undef CGAL_GMPFR_DECLARE_NO_ARGUMENT_FUNCTION
-
-        // comparison and query functions
-
-        bool is_zero()const;
-        bool is_one()const;
-        bool is_nan()const;
-        bool is_inf()const;
-        bool is_number()const;
-        Sign sign()const;
-        bool is_square()const;
-        bool is_square(Gmpfr&)const;
-        Comparison_result compare(const Gmpfr&)const;
-
-        // conversion functions
-
-        double to_double(std::float_round_style=Gmpfr::get_default_rndmode())
-                const;
-        std::pair<double,double> to_interval()const;
-        std::pair<double,long> to_double_exp(std::float_round_style=
-                                             Gmpfr::get_default_rndmode())const;
-        std::pair<std::pair<double,double>,long> to_interval_exp()const;
-        std::pair<Gmpz,long> to_integer_exp()const;
-};
-
-
-
-
-// --------------
-// implementation
-// --------------
-
-// default rounding mode, handled by mpfr
-inline
-std::float_round_style Gmpfr::get_default_rndmode(){
-        return _cgal_rnd(mpfr_get_default_rounding_mode());
-}
-
-inline
-std::float_round_style
-Gmpfr::set_default_rndmode(std::float_round_style rnd_mode){
-        std::float_round_style old_rnd_mode=Gmpfr::get_default_rndmode();
-        mpfr_set_default_rounding_mode(_gmp_rnd(rnd_mode));
-        return old_rnd_mode;
-}
-
-// default precision, handled by mpfr
-inline
-Gmpfr::Precision_type Gmpfr::get_default_precision(){
-        return static_cast<Gmpfr::Precision_type>(mpfr_get_default_prec());
-}
-
-inline
-Gmpfr::Precision_type Gmpfr::set_default_precision(Gmpfr::Precision_type prec){
-        Gmpfr::Precision_type old_prec=Gmpfr::get_default_precision();
-        CGAL_assertion(prec>=MPFR_PREC_MIN&&prec<=MPFR_PREC_MAX);
-        mpfr_set_default_prec(prec);
-        return old_prec;
-}
-
-// precision of a single Gmpfr object
-
-inline
-Gmpfr::Precision_type Gmpfr::get_precision()const{
-        return mpfr_get_prec(fr());
-}
-
-inline
-Gmpfr Gmpfr::round(Gmpfr::Precision_type p,std::float_round_style r)const{
-        CGAL_assertion(p>=MPFR_PREC_MIN&&p<=MPFR_PREC_MAX);
-        return Gmpfr(*this,r,p);
-}
-
-// mpfr global inexact flags
-
-inline
-void Gmpfr::clear_flags(){
-        mpfr_clear_flags();
-}
-
-inline
-bool Gmpfr::underflow_flag(){
-        return mpfr_underflow_p()!=0;
-}
-
-inline
-bool Gmpfr::overflow_flag(){
-        return mpfr_overflow_p()!=0;
-}
-
-inline
-bool Gmpfr::nan_flag(){
-        return mpfr_nanflag_p()!=0;
-}
-
-inline
-bool Gmpfr::inex_flag(){
-        return mpfr_inexflag_p()!=0;
-}
-
-inline
-bool Gmpfr::erange_flag(){
-        return mpfr_erangeflag_p()!=0;
-}
-
-// arithmetics
-
-inline
-Gmpfr Gmpfr::operator+()const{
-        return(*this);
-}
-
-inline
-Gmpfr Gmpfr::operator-()const{
-        Gmpfr result(0,get_precision());
-        mpfr_neg(result.fr(),fr(),MPFR_RNDN);
-        return result;
-}
-
-// CGAL_GMPFR_MEMBER_PREC returns the precision to be used to operate between
-// *this and a number of another type or class. Currently, the maximum of
-// *this' precision and the default precision is returned.
-#define CGAL_GMPFR_MEMBER_PREC() \
-        (get_precision()>Gmpfr::get_default_precision()? \
-         get_precision(): \
-         Gmpfr::get_default_precision())
-
-// CGAL_GMPFR_MEMBER_PREC_2 returns the precision for the operation between Gmpfr
-// objects *this and _b. Currently, it is the maximum of the precisions of
-// *this and _b and the default precision.
-// TODO: maybe we can rewrite this define optimally, maybe with an inline
-#define CGAL_GMPFR_MEMBER_PREC_2(_b) \
-        ( get_precision() >= mpfr_get_prec(_b.fr()) ? \
-                ( get_precision()>(Gmpfr::get_default_precision())? \
-                        get_precision():(Gmpfr::get_default_precision())): \
-                ( mpfr_get_prec(_b.fr())>(Gmpfr::get_default_precision())? \
-                        mpfr_get_prec(_b.fr()): \
-                        (Gmpfr::get_default_precision())) \
-        )
-
-// CGAL_GMPFR_OBJECT_BINARY_OPERATOR defines an overloaded binary operator of
-// the Gmpfr class, where the second parameter of the operator is an
-// object. It behaves differently when the Gmpfr class is reference-counted
-// or not.
-#ifdef CGAL_GMPFR_NO_REFCOUNT
-#define CGAL_GMPFR_OBJECT_BINARY_OPERATOR(_op,_class,_member,_fun) \
-        inline \
-        Gmpfr& Gmpfr::_op(const _class &b){ \
-                if(get_precision()>=Gmpfr::get_default_precision()) { \
-                        _fun(fr(), \
-                             fr(), \
-                             b._member, \
-                             mpfr_get_default_rounding_mode()); \
-                }else{ \
-                        Gmpfr _temp(0,Gmpfr::get_default_precision()); \
-                        _fun(_temp.fr(), \
-                             fr(), \
-                             b._member, \
-                             mpfr_get_default_rounding_mode()); \
-                        mpfr_swap(_temp.fr(),fr()); \
-                } \
-                return *this; \
-        }
-#else
-#define CGAL_GMPFR_OBJECT_BINARY_OPERATOR(_op,_class,_member,_fun) \
-        inline \
-        Gmpfr& Gmpfr::_op(const _class &b){ \
-                if(unique()){ \
-                        if(get_precision()>Gmpfr::get_default_precision()) { \
-                                _fun(fr(), \
-                                     fr(), \
-                                     b._member, \
-                                     mpfr_get_default_rounding_mode()); \
-                        }else{ \
-                                Gmpfr _temp(0,Gmpfr::get_default_precision()); \
-                                _fun(_temp.fr(), \
-                                     fr(), \
-                                     b._member, \
-                                     mpfr_get_default_rounding_mode()); \
-                                swap(_temp); \
-                        } \
-                }else{ \
-                        Gmpfr result(0,CGAL_GMPFR_MEMBER_PREC()); \
-                        _fun(result.fr(), \
-                             fr(), \
-                             b._member, \
-                             mpfr_get_default_rounding_mode()); \
-                        swap(result); \
-                } \
-                return *this; \
-        }
-#endif
-
-// CGAL_GMPFR_GMPFR_BINARY_OPERATOR is analogous to
-// CGAL_GMPFR_OBJECT_BINARY_OPERATOR, and it is used when the second operand is
-// another Gmpfr. The difference is the computation of the operation
-// precision.
-#ifdef CGAL_GMPFR_NO_REFCOUNT
-#define CGAL_GMPFR_GMPFR_BINARY_OPERATOR(_op,_fun) \
-        inline \
-        Gmpfr& Gmpfr::_op(const Gmpfr &b){ \
-                Gmpfr::Precision_type _p=CGAL_GMPFR_MEMBER_PREC_2(b); \
-                if(_p==get_precision()) { \
-                        _fun(fr(), \
-                             fr(), \
-                             b.fr(), \
-                             mpfr_get_default_rounding_mode()); \
-                }else{ \
-                        Gmpfr _temp(0,_p); \
-                        _fun(_temp.fr(), \
-                             fr(), \
-                             b.fr(), \
-                             mpfr_get_default_rounding_mode()); \
-                        mpfr_swap(_temp.fr(),fr()); \
-                } \
-                return *this; \
-        }
-#else
-#define CGAL_GMPFR_GMPFR_BINARY_OPERATOR(_op,_fun) \
-        inline \
-        Gmpfr& Gmpfr::_op(const Gmpfr &b){ \
-                Gmpfr::Precision_type _p=CGAL_GMPFR_MEMBER_PREC_2(b); \
-                if(unique()&&(_p==get_precision())){ \
-                        _fun(fr(), \
-                             fr(), \
-                             b.fr(), \
-                             mpfr_get_default_rounding_mode()); \
-                }else{ \
-                        Gmpfr result(0,_p); \
-                        _fun(result.fr(), \
-                             fr(), \
-                             b.fr(), \
-                             mpfr_get_default_rounding_mode()); \
-                        swap(result); \
-                } \
-                return *this; \
-        }
-#endif
-
-// CGAL_GMPFR_TYPE_BINARY_OPERATOR is analogous to the
-// CGAL_GMPFR_OBJECT_BINARY_OPERATOR, where the second parameter is a type
-// instead of an object.
-#ifdef CGAL_GMPFR_NO_REFCOUNT
-#define CGAL_GMPFR_TYPE_BINARY_OPERATOR(_op,_type,_fun) \
-        inline \
-        Gmpfr& Gmpfr::_op(_type x){ \
-                if(get_precision()>=Gmpfr::get_default_precision()) { \
-                        _fun(fr(),fr(),x,mpfr_get_default_rounding_mode()); \
-                }else{ \
-                        Gmpfr _temp(0,Gmpfr::get_default_precision()); \
-                        _fun(_temp.fr(), \
-                             fr(), \
-                             x, \
-                             mpfr_get_default_rounding_mode()); \
-                        mpfr_swap(_temp.fr(),fr()); \
-                } \
-                return *this; \
-        }
-#else
-#define CGAL_GMPFR_TYPE_BINARY_OPERATOR(_op,_type,_fun) \
-        inline \
-        Gmpfr& Gmpfr::_op(_type x){ \
-                if(unique()){ \
-                        if(get_precision()>Gmpfr::get_default_precision()) { \
-                                _fun(fr(), \
-                                     fr(), \
-                                     x, \
-                                     mpfr_get_default_rounding_mode()); \
-                        }else{ \
-                                Gmpfr _temp(0,Gmpfr::get_default_precision()); \
-                                _fun(_temp.fr(), \
-                                     fr(), \
-                                     x, \
-                                     mpfr_get_default_rounding_mode()); \
-                                swap(_temp); \
-                        } \
-                }else{ \
-                        Gmpfr result(0,CGAL_GMPFR_MEMBER_PREC()); \
-                        _fun(result.fr(), \
-                             fr(), \
-                             x, \
-                             mpfr_get_default_rounding_mode()); \
-                        swap(result); \
-                } \
-                return *this; \
-        }
-#endif
-
-CGAL_GMPFR_GMPFR_BINARY_OPERATOR(operator+=,mpfr_add)
-CGAL_GMPFR_GMPFR_BINARY_OPERATOR(operator-=,mpfr_sub)
-CGAL_GMPFR_GMPFR_BINARY_OPERATOR(operator*=,mpfr_mul)
-CGAL_GMPFR_GMPFR_BINARY_OPERATOR(operator/=,mpfr_div)
-#if(defined(MPFR_VERSION)&&(MPFR_VERSION>=MPFR_VERSION_NUM(2,3,0)))
-CGAL_GMPFR_GMPFR_BINARY_OPERATOR(operator%=,mpfr_remainder)
-#else
-//#  warning "Gmpfr::operator%= is optimized in MPFR 2.3.0."
-inline
-Gmpfr& Gmpfr::operator%=(const Gmpfr &b){
-        Gmpfr::Precision_type _p=CGAL_GMPFR_MEMBER_PREC_2(b);
-        Gmpfr result(*this,_p);
-        result/=b;
-        mpfr_trunc(result.fr(),result.fr());
-        result*=b;
-        result-=*this;
-        mpfr_neg(result.fr(),result.fr(),MPFR_RNDN);
-#  ifdef CGAL_GMPFR_NO_REFCOUNT
-        mpfr_swap(result.fr(),fr());
-#  else
-        if(unique())
-                mpfr_swap(result.fr(),fr());
-        else
-                swap(result);
-#  endif
-        return *this;
-}
-#endif
-
-CGAL_GMPFR_TYPE_BINARY_OPERATOR(operator+=,long,mpfr_add_si)
-CGAL_GMPFR_TYPE_BINARY_OPERATOR(operator-=,long,mpfr_sub_si)
-CGAL_GMPFR_TYPE_BINARY_OPERATOR(operator*=,long,mpfr_mul_si)
-CGAL_GMPFR_TYPE_BINARY_OPERATOR(operator/=,long,mpfr_div_si)
-
-CGAL_GMPFR_TYPE_BINARY_OPERATOR(operator+=,unsigned long,mpfr_add_ui)
-CGAL_GMPFR_TYPE_BINARY_OPERATOR(operator-=,unsigned long,mpfr_sub_ui)
-CGAL_GMPFR_TYPE_BINARY_OPERATOR(operator*=,unsigned long,mpfr_mul_ui)
-CGAL_GMPFR_TYPE_BINARY_OPERATOR(operator/=,unsigned long,mpfr_div_ui)
-
-CGAL_GMPFR_TYPE_BINARY_OPERATOR(operator+=,int,mpfr_add_si)
-CGAL_GMPFR_TYPE_BINARY_OPERATOR(operator-=,int,mpfr_sub_si)
-CGAL_GMPFR_TYPE_BINARY_OPERATOR(operator*=,int,mpfr_mul_si)
-CGAL_GMPFR_TYPE_BINARY_OPERATOR(operator/=,int,mpfr_div_si)
-
-CGAL_GMPFR_OBJECT_BINARY_OPERATOR(operator+=,Gmpz,mpz(),mpfr_add_z)
-CGAL_GMPFR_OBJECT_BINARY_OPERATOR(operator-=,Gmpz,mpz(),mpfr_sub_z)
-CGAL_GMPFR_OBJECT_BINARY_OPERATOR(operator*=,Gmpz,mpz(),mpfr_mul_z)
-CGAL_GMPFR_OBJECT_BINARY_OPERATOR(operator/=,Gmpz,mpz(),mpfr_div_z)
-
-#undef CGAL_GMPFR_OBJECT_BINARY_OPERATOR
-#undef CGAL_GMPFR_GMPFR_BINARY_OPERATOR
-#undef CGAL_GMPFR_TYPE_BINARY_OPERATOR
-
-// the static arithmetic functions are defined in a separate file
-#include <CGAL/GMP/Gmpfr_type_static.h>
-
-#define CGAL_GMPFR_ARITHMETIC_FUNCTION(_name,_fun) \
-        inline \
-        Gmpfr Gmpfr::_name (std::float_round_style r)const{ \
-                Gmpfr result(0,CGAL_GMPFR_MEMBER_PREC()); \
-                _fun(result.fr(),fr(),_gmp_rnd(r)); \
-                return result; \
-        } \
-        inline \
-        Gmpfr Gmpfr::_name (Gmpfr::Precision_type p, \
-                            std::float_round_style r)const{ \
-                CGAL_assertion(p>=MPFR_PREC_MIN&&p<=MPFR_PREC_MAX); \
-                Gmpfr result(0,p); \
-                _fun(result.fr(),fr(),_gmp_rnd(r)); \
-                return result; \
-        }
-
-CGAL_GMPFR_ARITHMETIC_FUNCTION(abs,mpfr_abs)
-CGAL_GMPFR_ARITHMETIC_FUNCTION(sqrt,mpfr_sqrt)
-CGAL_GMPFR_ARITHMETIC_FUNCTION(cbrt,mpfr_cbrt)
-
-inline
-Gmpfr Gmpfr::kthroot(int k,std::float_round_style r)const{
-        Gmpfr result(0,CGAL_GMPFR_MEMBER_PREC());
-        mpfr_root(result.fr(),fr(),k,_gmp_rnd(r));
-        return result;
-}
-
-inline
-Gmpfr Gmpfr::kthroot(int k,
-                     Gmpfr::Precision_type p,
-                     std::float_round_style r)const{
-        CGAL_assertion(p>=MPFR_PREC_MIN&&p<=MPFR_PREC_MAX);
-        Gmpfr result(0,p);
-        mpfr_root(result.fr(),fr(),k,_gmp_rnd(r));
-        return result;
-}
-
-CGAL_GMPFR_ARITHMETIC_FUNCTION(square,mpfr_sqr)
-
-#undef CGAL_GMPFR_ARITHMETIC_FUNCTION
-#undef CGAL_GMPFR_MEMBER_PREC
-#undef CGAL_GMPFR_MEMBER_PREC_2
-
-// comparison and query functions
-
-inline
-bool Gmpfr::is_zero()const{
-        return mpfr_zero_p(fr())!=0;
-}
-
-inline
-bool Gmpfr::is_one()const{
-        return mpfr_cmp_ui(fr(),1)==0;
-}
-
-inline
-bool Gmpfr::is_nan()const{
-        return mpfr_nan_p(fr())!=0;
-}
-
-inline
-bool Gmpfr::is_inf()const{
-        return mpfr_inf_p(fr())!=0;
-}
-
-inline
-bool Gmpfr::is_number()const{
-        return mpfr_number_p(fr())!=0;
-}
-
-inline
-Sign Gmpfr::sign()const{
-        int s=mpfr_sgn(fr());
-        return(s==0?ZERO:(s>0?POSITIVE:NEGATIVE));
-}
-
-inline
-bool Gmpfr::is_square()const{
-        Sign s=sign();
-        if(s==NEGATIVE)
-                return false;
-        if(s==ZERO)
-                return true;
-        std::pair<Gmpz,long> r=Gmpfr::to_integer_exp();
-        if(r.second%2)
-                r.first=r.first*2;
-        return mpz_perfect_square_p(r.first.mpz())!=0;
-}
-
-inline
-bool Gmpfr::is_square(Gmpfr &y)const{
-        bool ret=is_square();
-        if(ret)
-                y=sqrt();
-        return ret;
-}
-
-inline
-Comparison_result Gmpfr::compare(const Gmpfr& b)const{
-        int c=mpfr_cmp(fr(),b.fr());
-        return(c?(c>0?LARGER:SMALLER):EQUAL);
-}
-
-// conversion functions
-
-inline
-double Gmpfr::to_double(std::float_round_style r)const{
-        return mpfr_get_d(fr(),_gmp_rnd(r));
-}
-
-inline
-std::pair<double,double>Gmpfr::to_interval()const{
-        return std::make_pair(
-                        mpfr_get_d(fr(),MPFR_RNDD),
-                        mpfr_get_d(fr(),MPFR_RNDU));
-}
-
-inline
-std::pair<double,long> Gmpfr::to_double_exp(std::float_round_style r)const{
-        long e;
-        double d=mpfr_get_d_2exp(&e,fr(),_gmp_rnd(r));
-        return std::make_pair(d,e);
-}
-
-inline
-std::pair<std::pair<double,double>,long> Gmpfr::to_interval_exp()const{
-        long e1,e2;
-        double d_low=mpfr_get_d_2exp(&e1,fr(),MPFR_RNDD);
-        double d_upp=mpfr_get_d_2exp(&e2,fr(),MPFR_RNDU);
-        CGAL_assertion(e1==e2);
-        return std::make_pair(std::make_pair(d_low,d_upp),e1);
-}
-
-inline
-std::pair<Gmpz,long> Gmpfr::to_integer_exp()const{
-        if(this->is_zero())
-                return std::make_pair(Gmpz(0),long(0));
-
-        Gmpz z;
-        long e=CGAL_GMPFR_GET_Z_2EXP(z.mpz(),this->fr());
-
-        long zeros=mpz_scan1(z.mpz(),0);
-        CGAL_assertion(z==(z>>zeros)<<zeros);
-        z>>=zeros;
-        CGAL_assertion(z%2!=0);
-        e+=zeros;
-
-        CGAL_postcondition_code(if(e>=0))
-        CGAL_postcondition(
-              (*this)==(Gmpfr(z,(mpfr_prec_t)z.bit_size())*CGAL::ipower(Gmpfr(2),e)));
-        CGAL_postcondition_code(else)
-        CGAL_postcondition(((*this)*(Gmpz(1)<<(-e)))==z);
-
-        return std::make_pair(z,e);
-}
-
-
-// input/output
-
-// This function was based on the Gmpq's one. It reads a number in the form
-// MeE, where M and E are integers. The read number is M.2^E. The number
-// may contain spaces between integers and the 'e', but not in the middle
-// of the numbers.
-inline
-std::istream& operator>>(std::istream& is,Gmpfr &f){
-        std::istream::int_type c;
-        std::ios::fmtflags old_flags = is.flags();
-
-        is.unsetf(std::ios::skipws);
-        internal::eat_white_space(is);
-
-        // 1. read the mantissa, it starts in +, - or a digit and ends in e
-        Gmpz mant(0);           // the mantissa of the number
-        Gmpz exp(0);            // the exponent of the number
-        bool neg_mant=false;    // true iff the mantissa is negative
-        bool neg_exp=false;     // true iff the exponent is negative
-        c=is.peek();
-        switch(c){
-                case '-':
-                        neg_mant=true;
-                        is.get();
-                        internal::eat_white_space(is);
-                        break;
-                case '+':
-                        is.get();
-                        internal::eat_white_space(is);
-                        break;
-                case 'n':       // this is NaN
-                        is.get();
-                        if(is.get()=='a'&&is.get()=='n'){
-                                f=Gmpfr();
-                                return is;
-                        }
-                        else
-                                goto invalid_number;
-                default:
-                        if(c!='i'&&(c<'0'||c>'9')){     // invalid number
-                                invalid_number:
-                                is.setstate(std::ios_base::failbit);
-                                is.flags(old_flags);
-                                return is;
-                        }
-        }
-
-        // at this point, we have the sign of the number and we are ready
-        // to read the mantissa
-        c=is.get();
-        if(c=='i'){     // infinity comes
-                if(is.get()=='n'&&is.get()=='f'){
-                        f=Gmpfr();
-                        mpfr_set_inf(f.fr(),neg_mant?-1:1);
-                        return is;
-                }
-                else
-                        goto invalid_number;
-        }
-
-        while(c>='0'&&c<='9'){
-                mant=10*mant+(c-'0');
-                c=is.get();
-        }
-
-        // set the correct sign of the mantissa
-        if(neg_mant)
-                mant=-mant;
-
-        is.putback(c);
-        internal::eat_white_space(is);
-
-        switch(c=is.get()){
-                case 'e':
-                        break;
-                default:
-                        is.setstate(std::ios_base::failbit);
-                        is.flags(old_flags);
-                        return is;
-        }
-        c=is.peek();
-        switch(c){
-                case '-':
-                        neg_exp=true;
-                        is.get();
-                        internal::eat_white_space(is);
-                        break;
-                case '+':
-                        is.get();
-                        internal::eat_white_space(is);
-                        break;
-                default:
-                        if(c<'0'||c>'9')
-                                goto invalid_number;
-        }
-        internal::eat_white_space(is);
-        while((c=is.get())>='0'&&c<='9')
-                exp=10*exp+(c-'0');
-        is.putback(c);
-        if(exp.bit_size()>8*sizeof(mpfr_exp_t))
-                mpfr_set_erangeflag();
-
-        // we have now both exponent and mantissa
-        f=Gmpfr(mant,
-                static_cast<Gmpfr::Precision_type>(
-                        mant.bit_size()>MPFR_PREC_MIN?
-                        mant.bit_size():
-                        MPFR_PREC_MIN));
-        if(neg_exp)
-                mpfr_div_2ui(f.fr(),f.fr(),mpz_get_ui(exp.mpz()),MPFR_RNDN);
-        else
-                mpfr_mul_2ui(f.fr(),f.fr(),mpz_get_ui(exp.mpz()),MPFR_RNDN);
-
-        // this expensive assertion checks that we didn't lose bits when
-        // multiplying or dividing by 2^exp
-        CGAL_expensive_assertion_code( \
-                Gmpfr g(0,static_cast<Gmpfr::Precision_type>( \
-                                MPFR_PREC_MIN<mant.bit_size()? \
-                                mant.bit_size(): \
-                                MPFR_PREC_MIN)); \
-                if(neg_exp) \
-                        mpfr_div_2ui(g.fr(), \
-                                     f.fr(), \
-                                     mpz_get_ui(exp.mpz()), \
-                                     MPFR_RNDN); \
-                else \
-                        mpfr_mul_2ui(g.fr(), \
-                                     f.fr(), \
-                                     mpz_get_ui(exp.mpz()), \
-                                     MPFR_RNDN); \
-        )
-        CGAL_expensive_assertion(g==mant);
-
-        return is;
-}
-
-inline
-std::ostream& operator<<(std::ostream& os,const Gmpfr &a){
-        if(a.is_nan())
-                return os<<"nan";
-        if(a.is_inf())
-                return os<<(a<0?"-inf":"+inf");
-        // The rest of the function was written by George Tzoumas.
-        if (!is_pretty(os)) {
-                std::pair<Gmpz,long> ie=a.to_integer_exp();
-                os << ie.first << 'e' << ie.second;
-                return os;
-        } else {
-                // human-readable format
-                mpfr_exp_t expptr;
-                char *str = mpfr_get_str(NULL, &expptr, 10, 0, a.fr(),
-                                mpfr_get_default_rounding_mode());
-                if (str == NULL) return os << "@err@";
-                std::string s(str);
-                mpfr_free_str(str);
-                int i = 0;
-                size_t n = s.length();
-                size_t k = 0;
-                while (k < n && s[n-k-1] == '0') k++; // count trailing zeros
-                if (k == n) return os << "0";
-                else if (k) {
-                        s.erase(n-k, k);  // remove trailing zeros
-                        n = s.length();
-                }
-                bool exp = false;
-                if(s[0] == '-') { os << "-"; i++; n--; } // sign
-                if (expptr < -5) {              // .125e-99
-                        s.insert(i, 1, '.'); exp = true;
-                } else if (expptr < 0) {
-                        s.insert(i, -expptr, '0');  // .00000125 -- .0125
-                        s.insert(i, 1, '.');
-                // The following cast of expptr is done for avoiding some
-                // compiler warnings. The cast is exact, because we know
-                // expptr is not negative here.
-                } else if ((size_t)expptr < n) {        // .125 -- 12.5
-                        s.insert(i+expptr, 1, '.');
-                } else if (expptr - n <= 5) {   // 125 -- 12500000
-                        s.append(expptr - n, '0');
-                } else {                        // .125e99
-                        s.insert(i, 1, '.'); exp = true;
-                }
-                os << s.substr(i);
-                if (exp) os << "e" << expptr;
-                return os;
-        }
-}
-
-// comparisons
-
-inline
-bool operator<(const Gmpfr &a,const Gmpfr &b){
-        return mpfr_less_p(a.fr(),b.fr())!=0;
-}
-
-inline
-bool operator==(const Gmpfr &a,const Gmpfr &b){
-        return mpfr_equal_p(a.fr(),b.fr())!=0;
-}
-
-inline
-bool operator<(const Gmpfr &a,long b){
-        return(mpfr_cmp_si(a.fr(),b)<0);
-}
-
-inline
-bool operator>(const Gmpfr &a,long b){
-        return(mpfr_cmp_si(a.fr(),b)>0);
-}
-
-inline
-bool operator==(const Gmpfr &a,long b){
-        return !mpfr_cmp_si(a.fr(),b);
-}
-
-inline
-bool operator<(const Gmpfr &a,unsigned long b){
-        return(mpfr_cmp_ui(a.fr(),b)<0);
-}
-
-inline
-bool operator>(const Gmpfr &a,unsigned long b){
-        return(mpfr_cmp_ui(a.fr(),b)>0);
-}
-
-inline
-bool operator==(const Gmpfr &a,unsigned long b){
-        return !mpfr_cmp_ui(a.fr(),b);
-}
-
-inline
-bool operator<(const Gmpfr &a,int b){
-        return(mpfr_cmp_si(a.fr(),b)<0);
-}
-
-inline
-bool operator>(const Gmpfr &a,int b){
-        return(mpfr_cmp_si(a.fr(),b)>0);
-}
-
-inline
-bool operator==(const Gmpfr &a,int b){
-        return !mpfr_cmp_si(a.fr(),b);
-}
-
-inline
-bool operator<(const Gmpfr &a,double b){
-        return(mpfr_cmp_d(a.fr(),b)<0);
-}
-
-inline
-bool operator>(const Gmpfr &a,double b){
-        return(mpfr_cmp_d(a.fr(),b)>0);
-}
-
-inline
-bool operator==(const Gmpfr &a,double b){
-        return !mpfr_cmp_d(a.fr(),b);
-}
-
-// See the comment about mpfr_set_ld and MSVC++, above.
-#ifdef _MSC_VER
-inline
-bool operator<(const Gmpfr &a,long double b){
-        return(mpfr_cmp_d(a.fr(),b)<0);
-}
-
-inline
-bool operator>(const Gmpfr &a,long double b){
-        return(mpfr_cmp_d(a.fr(),b)>0);
-}
-
-inline
-bool operator==(const Gmpfr &a,long double b){
-        return !mpfr_cmp_d(a.fr(),b);
-}
-#else
-inline
-bool operator<(const Gmpfr &a,long double b){
-        return(mpfr_cmp_ld(a.fr(),b)<0);
-}
-
-inline
-bool operator>(const Gmpfr &a,long double b){
-        return(mpfr_cmp_ld(a.fr(),b)>0);
-}
-
-inline
-bool operator==(const Gmpfr &a,long double b){
-        return !mpfr_cmp_ld(a.fr(),b);
-}
-#endif
-
-inline
-bool operator<(const Gmpfr &a,const Gmpz &b){
-        return(mpfr_cmp_z(a.fr(),b.mpz())<0);
-}
-
-inline
-bool operator>(const Gmpfr &a,const Gmpz &b){
-        return(mpfr_cmp_z(a.fr(),b.mpz())>0);
-}
-
-inline
-bool operator==(const Gmpfr &a,const Gmpz &b){
-        return !mpfr_cmp_z(a.fr(),b.mpz());
-}
-
-inline
-Gmpfr min BOOST_PREVENT_MACRO_SUBSTITUTION(const Gmpfr& x,const Gmpfr& y){
-        return (x<=y)?x:y;
-}
-
-inline
-Gmpfr max BOOST_PREVENT_MACRO_SUBSTITUTION(const Gmpfr& x,const Gmpfr& y){
-        return (x>=y)?x:y;
-}
-
-} // namespace CGAL
-
-#endif  // CGAL_GMPFR_TYPE_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/GMP/Gmpz_type.h b/3rdparty/CGAL-4.8/include/CGAL/GMP/Gmpz_type.h
deleted file mode 100644
index 86e7263..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/GMP/Gmpz_type.h
+++ /dev/null
@@ -1,438 +0,0 @@
-// Copyright (c) 1999,2003,2004  
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved. 
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Andreas Fabri, Stefan Schirra, Sylvain Pion, Michael Hemmer
-
-
-#ifndef CGAL_GMPZ_TYPE_H
-#define CGAL_GMPZ_TYPE_H
-
-#include <CGAL/basic.h>
-#include <CGAL/IO/io.h>
-
-#include <CGAL/gmp.h>
-#include <mpfr.h>
-
-#include <boost/operators.hpp>
-#include <CGAL/Handle_for.h>
-
-#include <string>
-#include <locale>
-
-namespace CGAL {
-
-// TODO : benchmark without ref-counting, and maybe give the possibility
-// to select ref-counting or not, then... => template class.
-
-// Wrapper around mpz_t to get the destructor call mpz_clear.
-struct Gmpz_rep
-{
-// FIXME : bug if ~() is called before an mpz_init*() is called.
-// not a problem in practice, but not nice.
-// maybe the mpz_init_set* functions should move back to Gmpz_rep.
-// But then we should use the Storage_traits::construct/get...
-
-  mpz_t mpZ;
-
-  Gmpz_rep() {}
-  ~Gmpz_rep() { mpz_clear(mpZ); }
-
-private:
-  // Make sure it does not get accidentally copied.
-  Gmpz_rep(const Gmpz_rep &);
-  Gmpz_rep & operator= (const Gmpz_rep &);
-};
-
-
-class Gmpz
-  : Handle_for<Gmpz_rep>,
-    boost::ordered_euclidian_ring_operators1< Gmpz
-  , boost::ordered_euclidian_ring_operators2< Gmpz, int
-  , boost::ordered_euclidian_ring_operators2< Gmpz, long
-  , boost::ordered_euclidian_ring_operators2< Gmpz, unsigned long
-  , boost::shiftable< Gmpz , long
-  , boost::unit_steppable<Gmpz
-  , boost::bitwise<Gmpz
-> > > > > > >
-{
-  typedef Handle_for<Gmpz_rep> Base;
-public:
-  typedef Tag_true  Has_gcd;
-  typedef Tag_true  Has_division;
-  typedef Tag_true  Has_sqrt;
-
-  typedef Tag_true  Has_exact_ring_operations;
-  typedef Tag_true  Has_exact_division;
-  typedef Tag_false Has_exact_sqrt;
-
-  Gmpz()
-  { mpz_init(mpz()); }
-
-  Gmpz(const mpz_t z)
-  { mpz_init_set(mpz(), z); }
-
-  Gmpz(int i)
-  { mpz_init_set_si(mpz(), i); }
-
-  Gmpz(long l)
-  { mpz_init_set_si(mpz(), l); }
-
-  Gmpz(unsigned long l)
-  { mpz_init_set_ui(mpz(), l); }
-
-  Gmpz(double d)
-  {
-     CGAL_warning_msg(is_integer(d), "Gmpz constructed from non-integer double value");
-     CGAL_assertion(is_finite(d));
-     mpz_init_set_d(mpz(), d);
-   }
-
-  Gmpz(const std::string& str, int base = 10)
-  { mpz_init_set_str(mpz(), str.c_str(), base); }
-
-  // returns the number of bits used to represent this number
-  size_t bit_size() const { return mpz_sizeinbase(mpz(),2); }
-
-  // returns the memory size in bytes
-  size_t size() const { return mpz_size(mpz()) / (mp_bits_per_limb/8); }
-
-  // returns the number of decimal digits needed to represent this number
-  size_t approximate_decimal_length() const { return mpz_sizeinbase(mpz(),10); }
-
-  double to_double() const {return mpz_get_d(mpz());}
-  Sign sign() const { return static_cast<Sign>(mpz_sgn(mpz()));}
-
-  const mpz_t & mpz() const { return Ptr()->mpZ; }
-  mpz_t & mpz() { return ptr()->mpZ; }
-
-  #ifdef CGAL_ROOT_OF_2_ENABLE_HISTOGRAM_OF_NUMBER_OF_DIGIT_ON_THE_COMPLEX_CONSTRUCTOR
-  int tam() const { return 0; }  // put here a code
-                                 // measuring the number of digits
-                                 // of the Gmpz
-#endif
-
-#define CGAL_GMPZ_OBJECT_OPERATOR(_op,_class,_fun)    \
-  Gmpz& _op(const _class& z){                        \
-    Gmpz Res;                                         \
-    _fun(Res.mpz(), mpz(), z.mpz());                  \
-    swap(Res);                                        \
-    return *this;                                     \
-  }
-
-  CGAL_GMPZ_OBJECT_OPERATOR(operator+=,Gmpz,mpz_add);
-  CGAL_GMPZ_OBJECT_OPERATOR(operator-=,Gmpz,mpz_sub);
-  CGAL_GMPZ_OBJECT_OPERATOR(operator*=,Gmpz,mpz_mul);
-  CGAL_GMPZ_OBJECT_OPERATOR(operator/=,Gmpz,mpz_tdiv_q);
-  CGAL_GMPZ_OBJECT_OPERATOR(operator%=,Gmpz,mpz_tdiv_r);
-  CGAL_GMPZ_OBJECT_OPERATOR(operator&=,Gmpz,mpz_and);
-  CGAL_GMPZ_OBJECT_OPERATOR(operator|=,Gmpz,mpz_ior);
-  CGAL_GMPZ_OBJECT_OPERATOR(operator^=,Gmpz,mpz_xor);
-#undef CGAL_GMPZ_OBJECT_OPERATOR
-
-  bool operator<(const Gmpz &b) const
-  { return mpz_cmp(this->mpz(), b.mpz()) < 0; }
-  bool operator==(const Gmpz &b) const
-  { return mpz_cmp(this->mpz(), b.mpz()) == 0; }
-
-
-  Gmpz operator+() const {return Gmpz( mpz() );}
-  Gmpz operator-() const {
-    Gmpz Res;
-    mpz_neg(Res.mpz(), mpz());
-    return Res;
-  }
-
-  Gmpz& operator <<= (const unsigned long& i){
-    Gmpz Res;
-    mpz_mul_2exp(Res.mpz(),this->mpz(), i);
-    swap(Res);
-    return *this;
-  }
-  Gmpz& operator >>= (const unsigned long& i){
-    Gmpz Res;
-    mpz_tdiv_q_2exp(Res.mpz(),this->mpz(), i);
-    swap(Res);
-    return *this;
-  }
-
-  Gmpz& operator++(){return *this+=1;}
-  Gmpz& operator--(){return *this-=1;}
-
-
-  // interoperability with int
-  Gmpz& operator+=(int i);
-  Gmpz& operator-=(int i);
-  Gmpz& operator*=(int i);
-  Gmpz& operator/=(int i);
-  bool  operator==(int i) const {return mpz_cmp_si(this->mpz(), i) == 0;};
-  bool  operator< (int i) const {return mpz_cmp_si(this->mpz(), i) < 0;};
-  bool  operator> (int i) const {return mpz_cmp_si(this->mpz(), i) > 0;};
-
-  // interoperability with long
-  Gmpz& operator+=(long i);
-  Gmpz& operator-=(long i);
-  Gmpz& operator*=(long i);
-  Gmpz& operator/=(long i);
-  bool  operator==(long i) const {return mpz_cmp_si(this->mpz(), i) == 0;};
-  bool  operator< (long i) const {return mpz_cmp_si(this->mpz(), i) < 0;};
-  bool  operator> (long i) const {return mpz_cmp_si(this->mpz(), i) > 0;};
-
-  // interoperability with unsigned long
-  Gmpz& operator+=(unsigned long i);
-  Gmpz& operator-=(unsigned long i);
-  Gmpz& operator*=(unsigned long i);
-  Gmpz& operator/=(unsigned long i);
-  bool  operator==(unsigned long i) const {return mpz_cmp_ui(this->mpz(), i) == 0;};
-  bool  operator< (unsigned long i) const {return mpz_cmp_ui(this->mpz(), i) < 0;};
-  bool  operator> (unsigned long i) const {return mpz_cmp_ui(this->mpz(), i) > 0;};
-};
-
-
-
-#define CGAL_GMPZ_SCALAR_OPERATOR(_op,_type,_fun)   \
-  inline Gmpz& Gmpz::_op(_type z) {                 \
-    Gmpz Res;                                       \
-    _fun(Res.mpz(), mpz(), z);                      \
-    swap(Res);                                      \
-    return *this;                                   \
-  }
-
-CGAL_GMPZ_SCALAR_OPERATOR(operator*=,int,mpz_mul_si)
-CGAL_GMPZ_SCALAR_OPERATOR(operator*=,long,mpz_mul_si)
-
-CGAL_GMPZ_SCALAR_OPERATOR(operator+=,unsigned long,mpz_add_ui)
-CGAL_GMPZ_SCALAR_OPERATOR(operator-=,unsigned long,mpz_sub_ui)
-CGAL_GMPZ_SCALAR_OPERATOR(operator*=,unsigned long,mpz_mul_ui)
-CGAL_GMPZ_SCALAR_OPERATOR(operator/=,unsigned long,mpz_tdiv_q_ui)
-#undef CGAL_GMPZ_SCALAR_OPERATOR
-
-
-inline Gmpz& Gmpz::operator+=(int i)
-{
-  Gmpz Res;
-  if (i >= 0)
-    mpz_add_ui(Res.mpz(), mpz(), i);
-  else
-    mpz_sub_ui(Res.mpz(), mpz(), -i);
-  swap(Res);
-  return *this;
-}
-
-inline Gmpz& Gmpz::operator+=(long i)
-{
-  Gmpz Res;
-  if (i >= 0)
-    mpz_add_ui(Res.mpz(), mpz(), i);
-  else
-    mpz_sub_ui(Res.mpz(), mpz(), -i);
-  swap(Res);
-  return *this;
-}
-
-
-
-inline Gmpz& Gmpz::operator-=(int  i){return *this+=-i;}
-inline Gmpz& Gmpz::operator-=(long i){return *this+=-i;}
-
-inline Gmpz& Gmpz::operator/=(int b) {
-  if (b>0) {
-    Gmpz Res;
-    mpz_tdiv_q_ui(Res.mpz(), mpz(), b);
-    swap(Res);
-    return *this;
-  }
-  return *this /= Gmpz(b);
-}
-
-inline Gmpz& Gmpz::operator/=(long b) {
-  if (b>0) {
-    Gmpz Res;
-    mpz_tdiv_q_ui(Res.mpz(), mpz(), b);
-    swap(Res);
-    return *this;
-  }
-  return *this /= Gmpz(b);
-}
-
-inline
-std::ostream&
-operator<<(std::ostream& os, const Gmpz &z)
-{
-  char *str = new char [mpz_sizeinbase(z.mpz(),10) + 2];
-  str = mpz_get_str(str, 10, z.mpz());
-  os << str ;
-  delete[] str;
-  return os;
-}
-
-
-inline
-std::istream &
-gmpz_new_read(std::istream &is, Gmpz &z)
-{
-  bool negative = false;
-  const std::istream::char_type zero = '0';
-  std::istream::int_type c;
-  Gmpz r;
-  std::ios::fmtflags old_flags = is.flags();
-
-  is.unsetf(std::ios::skipws);
-  internal::eat_white_space(is);
-
-  c=is.peek();
-  if (c=='-' || c=='+'){
-      is.get();
-      CGAL_assertion(!is.fail());
-      negative=(c=='-');
-      internal::eat_white_space(is);
-      c=is.peek();
-  }
-
-  std::istream::char_type cc= c;
-
-  if (c== std::istream::traits_type::eof() ||
-      !std::isdigit(cc, std::locale::classic() ) ){
-    is.setstate(std::ios_base::failbit);
-  } else {
-    CGAL_assertion(cc==c);
-    r= cc-zero;
-    is.get();
-    CGAL_assertion(!is.fail());
-
-    // The following loop was supposed to be an infinite loop with:
-    //   while (true)
-    // where the break condition is that is.peek() returns and EOF or a
-    // non-digit character.
-    //
-    // Unfortunately, the wording of the C++03 and C++11 standard was not
-    // well understood by the authors of libc++ (the STL of clang++) and,
-    // in the version of libc++ shipped with Apple-clang-3.2,
-    // istream::peek() set the flag eofbit when it reads the last character
-    // of the stream *instead* of setting it only when it *tries to read
-    // past the last character*. For that reason, to avoid that the next
-    // peek() sets also the failbit, one has to check for EOL twice.
-    //
-    // See the LWG C++ Issue 2036, classified as Not-A-Defect:
-    //   http://lwg.github.com/issues/lwg-closed.html#2036
-    // and a StackOverflow related question:
-    //   http://stackoverflow.com/a/9020292/1728537
-    // --
-    // Laurent Rineau, 2013/10/10
-    while (!is.eof()) {
-      c=is.peek();
-      if (c== std::istream::traits_type::eof()) {
-        break;
-      }
-      cc=c;
-      if  ( !std::isdigit(cc, std::locale::classic() )) {
-        break;
-      }
-      is.get();
-      CGAL_assertion(!is.fail());
-      CGAL_assertion(cc==c);
-      r= r*10+(cc-zero);
-    }
-  }
-
-  is.flags(old_flags);
-  if (!is.fail()) {
-    if (negative) {
-      z=-r;
-    } else {
-      z=r;
-    }
-  }
-  return is;
-}
-
-/*inline
-std::istream&
-read_gmpz(std::istream& is, Gmpz &z) {
-  bool negative = false;
-  bool good = false;
-  const int null = '0';
-  char c;
-  Gmpz tmp;
-  std::ios::fmtflags old_flags = is.flags();
-
-  is.unsetf(std::ios::skipws);
-  while (is.get(c) && std::isspace(c, std::locale::classic() ))
-  {}
-
-  if (c == '-')
-  {
-        negative = true;
-        while (is.get(c) && std::isspace(c, std::locale::classic() ))
-        {}
-  }
-  if (std::isdigit(c, std::locale::classic() ))
-  {
-        good = true;
-        tmp = c - null;
-        while (is.get(c) && std::isdigit(c, std::locale::classic() ))
-        {
-            tmp = 10*tmp + (c-null);
-        }
-  }
-  if (is)
-        is.putback(c);
-  if (sign(tmp) != ZERO && negative)
-      tmp = -tmp;
-  if (good){
-      z = tmp;
-      }
-   else
-    is.clear(is.rdstate() | std::ios::failbit);
-
-  is.flags(old_flags);
-  return is;
-  }*/
-
-inline
-std::istream&
-operator>>(std::istream& is, Gmpz &z)
-{
-  return gmpz_new_read(is, z);
-}
-
-template <>
-struct Split_double<Gmpz>
-{
-  void operator()(double d, Gmpz &num, Gmpz &den) const
-  {
-    std::pair<double, double> p = split_numerator_denominator(d);
-    num = Gmpz(p.first);
-    den = Gmpz(p.second);
-  }
-};
-
-inline Gmpz min BOOST_PREVENT_MACRO_SUBSTITUTION(const Gmpz& x,const Gmpz& y){
-  return (x<=y)?x:y;
-}
-inline Gmpz max BOOST_PREVENT_MACRO_SUBSTITUTION(const Gmpz& x,const Gmpz& y){
-  return (x>=y)?x:y;
-}
-
-
-} //namespace CGAL
-
-#endif // CGAL_GMPZ_TYPE_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/GMP/Gmpzf_type.h b/3rdparty/CGAL-4.8/include/CGAL/GMP/Gmpzf_type.h
deleted file mode 100644
index b5e943e..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/GMP/Gmpzf_type.h
+++ /dev/null
@@ -1,591 +0,0 @@
-// Copyright (c) 1997-2001  ETH Zurich (Switzerland).
-// 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(s)     : Bernd Gaertner <gaertner at inf.ethz.ch>
-
-#ifndef CGAL_GMPZF_TYPE_H
-#define CGAL_GMPZF_TYPE_H
-
-// includes
-#include <CGAL/basic.h>
-#include <CGAL/Handle_for.h>
-#include <CGAL/gmp.h>
-#include <mpfr.h>
-#include <CGAL/Quotient.h>
-#include <CGAL/GMP/Gmpz_type.h>
-#include <boost/operators.hpp>
-#include <iostream>
-#include <cmath>
-#include <limits>
-#include <string>
-#include <utility>
-
-namespace CGAL {
-
-//internal fwd
-class Gmpzf;
-bool operator<(const Gmpzf &a, const Gmpzf &b);
-bool operator==(const Gmpzf &a, const Gmpzf &b);
-bool operator<(const Gmpzf &a, int b);
-bool operator==(const Gmpzf &a, int b);
-bool operator>(const Gmpzf &a, int b);
-Gmpzf approximate_sqrt(const Gmpzf &f);
-
-struct Gmpzf_rep // as in Gmpz.h
-{
-// FIXME : bug if ~() is called before an mpz_init*() is called.
-// not a problem in practice, but not nice.
-// maybe the mpz_init_set* functions should move back to Gmpz_rep.
-// But then we should use the Storage_traits::construct/get...
-
-  mpz_t mpZ;
-
-  Gmpzf_rep() {}
-  ~Gmpzf_rep() { mpz_clear(mpZ); }
-
-private:
-  // Make sure it does not get accidentally copied.
-  Gmpzf_rep(const Gmpzf_rep &);
-  Gmpzf_rep & operator= (const Gmpzf_rep &);
-};
-
-// class declaration
-// =================
-// This is an exact floating point type; it can represent numbers
-// of the form m*2^e, where m is of type mpz_t and e (currently)
-// of type long
-
-class Gmpzf :
-  Handle_for<Gmpzf_rep>,
-    boost::ordered_euclidian_ring_operators1< Gmpzf
-  , boost::ordered_euclidian_ring_operators2< Gmpzf, int
-    > >
-{
-  typedef Handle_for<Gmpzf_rep> Base;
-
-public:
-
-  // exponent type
-  // --------------------
-  typedef long Exponent; // may overflow, but if it does, the mantissa is
-                         // potentially too large to be useful, anyway;
-                         // still, repeated squaring of a power of two
-                         // quickly brings this type to its limits...
-
-  friend Gmpzf approximate_sqrt(const Gmpzf &f);
-
-private:
-  // data members (mantissa is from Gmpzf_rep)
-  // ----------------------------------------
-  // Invariant:
-  // - number is in canonical form, i.e.(m,e) == 0 or m is odd
-  Exponent  e;
-
-public:
-  // access
-  // ------
-  const mpz_t& man() const
-  {
-    return Ptr()->mpZ;
-  }
-
-  mpz_t& man()
-  {
-    return ptr()->mpZ;
-  }
-
-  const Exponent& exp() const
-  {
-    return e;
-  }
-
-  // construction
-  // ------------
-
-  Gmpzf( )
-    : e(0)
-  {
-    mpz_init(man());
-    CGAL_postcondition(is_canonical());
-  }
-
-
-  Gmpzf(const mpz_t z)
-    : e(0)
-  {
-    mpz_init_set(man(), z);
-    canonicalize();
-  }
-
-
-  Gmpzf(const Gmpz& n )
-    : e(0)
-  {
-    mpz_init_set(man(), n.mpz());
-    canonicalize();
-  }
-
-
-  Gmpzf( int i)
-    : e(0)
-  {
-    mpz_init_set_si( man(), i);
-    canonicalize();
-  }
-
-  Gmpzf( long l)
-    : e(0)
-  {
-    mpz_init_set_si( man(), l);
-    canonicalize();
-  }
-
-  Gmpzf( double d)
-  {
-    Protect_FPU_rounding<> P(CGAL_FE_TONEAREST);
-    if (d == 0) {
-      mpz_init (man());
-      e = 0;
-      return;
-    }
-    const int p = std::numeric_limits<double>::digits;
-    CGAL_assertion(CGAL_NTS is_finite(d) & is_valid(d));
-    int exp;
-    double x = std::frexp(d, &exp); // x in [1/2, 1], x*2^exp = d
-    mpz_init_set_d (man(), // to the following integer:
-		    std::ldexp( x, p));
-    e = exp - p;
-    canonicalize();
-  }
-
-  // arithmetics
-  // -----------
-  Gmpzf operator+() const;
-  Gmpzf operator-() const;
-  Gmpzf& operator+=( const Gmpzf& b);
-  Gmpzf& operator+=( int i);
-  Gmpzf& operator-=( const Gmpzf& b);
-  Gmpzf& operator-=( int i);
-  Gmpzf& operator*=( const Gmpzf& b);
-  Gmpzf& operator*=( int i);
-  Gmpzf& div(const Gmpzf& b);
-  Gmpzf& operator%= (const Gmpzf& b);
-  Gmpzf& div(int i);
-  Gmpzf& operator%= (int i);
-  bool is_zero() const;
-  Sign sign() const;
-  Gmpzf integral_division(const Gmpzf& b) const;
-  Gmpzf gcd (const Gmpzf& b) const;
-  Comparison_result compare (const Gmpzf &b) const;
-  double to_double() const ;
-  std::pair<double, double> to_interval() const ;
-  std::pair<double, long> to_double_exp() const;
-  std::pair<std::pair<double, double>, long> to_interval_exp() const ;
-private:
-  void canonicalize();
-  bool is_canonical() const;
-  static void align ( const mpz_t*& a_aligned, const mpz_t*& b_aligned,
-		     Exponent& rexp, const Gmpzf& a, const Gmpzf& b);
-};
-
-
-
-
-
-// implementation
-// ==============
-
-// arithmetics
-// -----------
-
-inline
-Gmpzf Gmpzf::operator+() const
-{
-    return *this;
-}
-
-inline
-Gmpzf Gmpzf::operator-() const
-{
-  Gmpzf result;
-  mpz_neg (result.man(), man());
-  result.e = exp();
-  CGAL_postcondition(is_canonical());
-  return result;
-}
-
-inline
-Gmpzf& Gmpzf::operator+=( const Gmpzf& b)
-{
-  Gmpzf result;
-  if (b.is_zero()) return *this; // important in sparse contexts
-  const mpz_t *a_aligned, *b_aligned;
-  align (a_aligned, b_aligned, e, *this, b);
-  mpz_add(result.man(), *a_aligned, *b_aligned);
-  swap(result);
-  canonicalize();
-  return(*this);
-}
-
-inline
-Gmpzf& Gmpzf::operator+=( int i)
-{
-  return operator+=(Gmpzf (i));   // could be optimized, but why?
-}
-
-inline
-Gmpzf& Gmpzf::operator-=( const Gmpzf& b)
-{
-  Gmpzf result;
-  if (b.is_zero()) return *this; // important in sparse contexts
-  const mpz_t *a_aligned, *b_aligned;
-  align (a_aligned, b_aligned, e, *this, b);
-  mpz_sub(result.man(), *a_aligned, *b_aligned);
-  swap(result);
-  canonicalize();
-  return(*this);
-}
-
-inline
-Gmpzf& Gmpzf::operator-=( int i)
-{
-  return operator-=(Gmpzf (i));   // could be optimized, but why?
-}
-
-inline
-Gmpzf& Gmpzf::operator*=( const Gmpzf& b)
-{
-  Gmpzf result;
-  mpz_mul(result.man(), man(), b.man());
-  e += b.exp();
-  swap (result);
-  if(is_zero()) e=0; // product is 0 or odd, so we can skip canonicalize()
-  CGAL_postcondition(is_canonical());
-  return *this;
-}
-
-inline
-Gmpzf& Gmpzf::operator*=( int i)
-{
-  Gmpzf result;
-  mpz_mul_si(result.man(), man(), i);
-  swap (result);
-  canonicalize();
-  return *this;
-}
-
-// *this = m1 * 2 ^ e1 = a_aligned * 2 ^ rexp
-//     b = m2 * 2 ^ e2 = b_aligned * 2 ^ rexp,   where rexp = min (e1, e2)
-//
-// => a / b = a div b = (a_aligned div b_aligned)
-//            a mod b = (a_aligned mod b_aligned) * 2 ^ rexp
-inline
-Gmpzf& Gmpzf::div(const Gmpzf& b)
-{
-  CGAL_precondition(!b.is_zero());
-  Gmpzf result;
-  const mpz_t *a_aligned, *b_aligned;
-  align (a_aligned, b_aligned, e, *this, b);
-  mpz_tdiv_q (result.man(), *a_aligned, *b_aligned); // round towards zero
-  e = 0;
-  swap(result);
-  canonicalize();
-  return(*this);
-}
-
-inline
-Gmpzf& Gmpzf::operator%= (const Gmpzf& b)
-{
-  CGAL_precondition(!b.is_zero());
-  Gmpzf result;
-  const mpz_t *a_aligned, *b_aligned;
-  align (a_aligned, b_aligned, e, *this, b);
-  mpz_tdiv_r (result.man(), *a_aligned, *b_aligned);
-  swap(result);
-  canonicalize();
-  return(*this);
-}
-
-inline
-Gmpzf& Gmpzf::div(int i)
-{
-  return div(Gmpzf(i));
-}
-
-inline
-Gmpzf& Gmpzf::operator%= (int i)
-{
-  return operator%= (Gmpzf(i));
-}
-
-inline
-bool Gmpzf::is_zero() const
-{
-  return mpz_sgn( man()) == 0;
-}
-
-inline
-Sign Gmpzf::sign() const
-{
-  return static_cast<Sign>(mpz_sgn( man()));
-}
-
-inline
-Gmpzf Gmpzf::integral_division(const Gmpzf& b) const
-{
-  Gmpzf result;
-  mpz_divexact(result.man(), man(), b.man());
-  result.e = exp()-b.exp();
-  result.canonicalize();
-  CGAL_postcondition (*this == b * result);
-  return result;
-}
-
-inline
-Gmpzf Gmpzf::gcd (const Gmpzf& b) const
-{
-  Gmpzf result;
-  mpz_gcd (result.man(), man(), b.man()); // exponent is 0
-  result.canonicalize();
-  return result;
-}
-
-inline
-Gmpzf approximate_sqrt(const Gmpzf &f)
-{
-  // is there a well-defined sqrt at all?? Here we do the
-  // following: write *this as m * 2 ^ e with e even, and
-  // then return sqrt(m) * 2 ^ (e/2)
-  Gmpzf result;
-  // make exponent even
-  if (f.exp() % 2 == 0) {
-    mpz_set (result.man(), f.man());
-  } else {
-    mpz_mul_2exp (result.man(), f.man(), 1);
-  }
-  mpz_sqrt(result.man(), result.man());
-  result.e = f.exp() / 2;
-  result.canonicalize();
-  return result;
-}
-
-inline
-Comparison_result Gmpzf::compare (const Gmpzf &b) const
-{
-  const mpz_t *a_aligned, *b_aligned;
-  Exponent rexp; // ignored
-  align (a_aligned, b_aligned, rexp, *this, b);
-  int c = mpz_cmp(*a_aligned, *b_aligned);
-  if (c < 0) return SMALLER;
-  if (c > 0) return LARGER;
-  return EQUAL;
-}
-
-inline
-double Gmpzf::to_double() const
-{
-  Exponent k;                                 // exponent
-  double l = mpz_get_d_2exp (&k, man());      // mantissa in [0.5,1)
-  return std::ldexp(l, k+exp());
-}
-
-
-
-// internal functions
-inline
-std::pair<double, long> Gmpzf::to_double_exp() const
-{
-  Exponent k = 0;
-  double l = mpz_get_d_2exp (&k, man());
-  return std::pair<double, long>(l, k+exp());
-}
-
-inline
-std::pair<std::pair<double, double>, long> Gmpzf::to_interval_exp() const
-{
-  // get surrounding interval of the form [l * 2 ^ k, u * 2^ k]
-  // first get mantissa in the form l*2^k, with 0.5 <= d < 1;
-  // truncation is guaranteed to go towards zero
-  long k = 0;
-  double l = mpz_get_d_2exp (&k, man());
-  // l = +/- 0.1*...*
-  //           ------
-  //           53 digits
-  // in order to round away from zero, it suffices to add/subtract 2^-53
-  double u = l;
-  if (l < 0)
-    // u is already the upper bound, decrease l to get lower bound
-    l -= std::ldexp(1.0, -53);
-  else
-    // l is already the lower bound, increase u to get upper bound
-    u += std::ldexp(1.0, -53);
-  // the interval is now [l * 2^(k + exp()), u * 2^(k + exp())]
-  // we may cast the exponents to int, since if that's going to
-  // create an overflow, we correctly get infinities
-  return std::pair<std::pair<double, double>, long>
-    (std::pair<double, double>(l, u), k + exp());
-}
-
-inline
-std::pair<double, double> Gmpzf::to_interval() const
-{
-  std::pair<std::pair<double, double>, long> lue = to_interval_exp();
-  double l = lue.first.first;
-  double u = lue.first.second;
-  long k = lue.second;
-  return std::pair<double,double> (std::ldexp (l, k), std::ldexp (u, k));
-}
-
-inline
-void Gmpzf::canonicalize()
-{
-  if (!is_zero()) {
-    // chop off trailing zeros in m
-    unsigned long zeros = mpz_scan1(man(), 0);
-    if (zeros != 0) {
-      mpz_tdiv_q_2exp( man(), man(), zeros);  // bit-wise right-shift
-      e += zeros;
-    }
-  } else {
-    e = 0;
-  }
-  CGAL_postcondition(is_canonical());
-}
-
-inline
-bool Gmpzf::is_canonical() const
-{
-  return (is_zero() && e==0) || mpz_odd_p (man());
-}
-
-// align a and b such that they have the same exponent:
-// a = m1 * 2 ^ e1 -> a_aligned * 2 ^ rexp,
-// b = m2 * 2 ^ e2 -> b_aligned * 2 ^ rexp,   where rexp = min (e1, e2)
-//
-// function sets (pointers to) a_aligned and b_aligned and rexp;
-// it uses the static s to store the shifted number
-inline
-void Gmpzf::align ( const mpz_t*& a_aligned,
-			   const mpz_t*& b_aligned,
-			   Exponent& rexp,
-			   const Gmpzf& a, const Gmpzf& b) {
-  static Gmpz s;
-  switch (CGAL_NTS compare (b.exp(), a.exp())) {
-  case SMALLER:
-    {
-      // leftshift of a to reach b.exp()
-      mpz_mul_2exp (s.mpz(), a.man(), a.exp() - b.exp());
-      const mpz_t& smpzref = s.mpz();  // leftshifted a
-      a_aligned = &smpzref;  // leftshifted a
-      const mpz_t& bmanref = b.man();
-      b_aligned = &bmanref;  // b
-      rexp = b.exp();
-      break;
-    }
-  case LARGER:
-    {
-      // leftshift of b to reach a.exp()
-      mpz_mul_2exp (s.mpz(), b.man(), b.exp() - a.exp());
-      const mpz_t& amanref = a.man();
-      a_aligned = &amanref; // a
-      const mpz_t& smpzref = s.mpz();  // leftshifted b
-      b_aligned = &smpzref; // leftshifted b
-      rexp = a.exp();
-      break;
-    }
-  default:
-  case EQUAL:
-    {
-      const mpz_t& amanref = a.man();
-      a_aligned = &amanref;
-      const mpz_t& bmanref = b.man();
-      b_aligned = &bmanref;
-      rexp = a.exp();
-    }
-  }
-}
-
-// input/output
-// ------------
-inline
-std::ostream& operator<< (std::ostream& os, const Gmpzf& a)
-{
-    return os << a.to_double();
-}
-
-inline
-std::ostream& print (std::ostream& os, const Gmpzf& a)
-{
-  return os << a.man() << "*2^" << a.exp();
-}
-
-inline
-std::istream&  operator>> ( std::istream& is, Gmpzf& a)
-{
-  // simply read from double
-  double d;
-  is >> d;
-  if (is)
-    a = Gmpzf(d);
-  return is;
-}
-
-// comparisons
-// -----------
-
-inline
-bool operator<(const Gmpzf &a, const Gmpzf &b)
-{
-  return a.compare(b) == SMALLER;
-}
-
-inline
-bool operator==(const Gmpzf &a, const Gmpzf &b)
-{
-  return ( (mpz_cmp(a.man(), b.man()) == 0) && a.exp() == b.exp() );
-}
-
-// mixed operators
-inline
-bool operator<(const Gmpzf &a, int b)
-{
-  return operator<(a, Gmpzf(b));
-}
-
-inline
-bool operator==(const Gmpzf &a, int b)
-{
-  return operator==(a, Gmpzf(b));
-}
-
-inline
-bool operator>(const Gmpzf &a, int b)
-{
-  return operator>(a, Gmpzf(b));
-}
-
-inline Gmpzf min BOOST_PREVENT_MACRO_SUBSTITUTION(const Gmpzf& x,const Gmpzf& y){
-  return (x<=y)?x:y; 
-}
-inline Gmpzf max BOOST_PREVENT_MACRO_SUBSTITUTION(const Gmpzf& x,const Gmpzf& y){
-  return (x>=y)?x:y; 
-}
-
-} //namespace CGAL
-
-#endif // CGAL_GMPZF_TYPE_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/General_polygon_2.h b/3rdparty/CGAL-4.8/include/CGAL/General_polygon_2.h
deleted file mode 100644
index 4616075..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/General_polygon_2.h
+++ /dev/null
@@ -1,221 +0,0 @@
-// Copyright (c) 2005  Tel-Aviv University (Israel).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Baruch Zukerman <baruchzu at post.tau.ac.il>
-
-#ifndef CGAL_GENERAL_POLYGON_2_H
-#define CGAL_GENERAL_POLYGON_2_H
-
-#include <list>
-#include <CGAL/Boolean_set_operations_2/Gps_traits_adaptor.h>
-#include <CGAL/Bbox_2.h>
-
-
-namespace CGAL {
-
-template <class Arr_traits>
-class General_polygon_2
-{
-public:
-
-  typedef Arr_traits                                 Traits_2;
-  typedef typename Traits_2::Point_2                 Point_2;
-  typedef typename Traits_2::X_monotone_curve_2      X_monotone_curve_2;
-  typedef std::list<X_monotone_curve_2>              Containter;
-  typedef typename Containter::iterator              Curve_iterator;
-  typedef typename Containter::const_iterator        Curve_const_iterator;
-
-protected:
-  std::list<X_monotone_curve_2>    m_xcurves;
-
-public:
-
-  General_polygon_2(){}
-
-  template <class CurveIterator>
-  General_polygon_2(CurveIterator begin,
-                    CurveIterator end) : m_xcurves (begin, end)
-  {}
-
-  template <class CurveIterator>
-  void init(CurveIterator begin, CurveIterator end)
-  {
-    m_xcurves.clear();
-    m_xcurves.insert(m_xcurves.end(), begin, end);
-  }
-
-  template <class CurveIterator>
-  void insert(CurveIterator begin, CurveIterator end)
-  {
-    m_xcurves.insert(m_xcurves.end(), begin, end);
-  }
-
-  bool is_empty() const
-  {
-    return m_xcurves.empty();
-  }
-
-  unsigned int size() const
-  {
-    return static_cast<unsigned int>(m_xcurves.size());
-  }
-
-  Curve_iterator curves_begin()
-  {
-    return m_xcurves.begin();
-  }
-
-  Curve_iterator curves_end()
-  {
-    return m_xcurves.end();
-  }
-
-  Curve_const_iterator curves_begin() const
-  {
-    return m_xcurves.begin();
-  }
-
-  Curve_const_iterator curves_end() const
-  {
-    return m_xcurves.end();
-  }
-
-  void push_back(const X_monotone_curve_2& cv)
-  {
-    m_xcurves.push_back(cv);
-  }
-
-  void clear()
-  {
-    m_xcurves.clear();
-  }
-
-  Curve_iterator erase(Curve_iterator it)
-  {
-    return (m_xcurves.erase(it));
-  }
-
-  Orientation orientation() const
-  {
-    Gps_traits_adaptor<Traits_2>  tr;
-    return (tr.orientation_2_object()(m_xcurves.begin(), m_xcurves.end()));
-  }
-  
-  void reverse_orientation()
-  {
-    m_xcurves.reverse();
-    Traits_2 tr;
-    typename Traits_2::Construct_opposite_2 ctr_opp =
-      tr.construct_opposite_2_object();
-    for(Curve_iterator ci = m_xcurves.begin(); ci != m_xcurves.end(); ++ci)
-    {
-      const X_monotone_curve_2& opp_cv = ctr_opp(*ci);
-      *ci = opp_cv;
-    }
-  }
-
-  template <class OutputIterator>
-  void approximate(OutputIterator oi, unsigned int n) const
-  {
-    for(Curve_const_iterator itr = m_xcurves.begin();
-        itr != m_xcurves.end();
-        ++itr)
-    {
-      itr->approximate(oi, n);
-    }
-  }
-
-  Bbox_2 bbox() const
-  {
-    Bbox_2 result;
-    if(m_xcurves.empty())
-      return (result);
-
-    Curve_const_iterator first = m_xcurves.begin();
-    result = first->bbox();
-
-    for(++first; first != m_xcurves.end(); ++first)
-    {
-      result = result + first->bbox();
-    }
-      
-    return result;
-  }
-};
-
-
-//-----------------------------------------------------------------------//
-//                          operator>>
-//-----------------------------------------------------------------------//
-
-template <class Traits>
-std::istream &operator>>(std::istream &is, General_polygon_2<Traits>& p)
-{
-  int n; // number of edges
-  is >> n;
-  typename Traits::X_monotone_curve_2 cv;
- 
-  if (is) {
-      p.clear();
-      for (int i=0; i<n; i++) {
-        is >> cv;
-        p.push_back(cv);
-      }
-  }
- 
-  return is;
-}
-
-//-----------------------------------------------------------------------//
-//                          operator<<
-//-----------------------------------------------------------------------//
-
-template <class Traits>
-std::ostream
-&operator<<(std::ostream &os, const General_polygon_2<Traits>& p)
-{
-  typename General_polygon_2<Traits>::Curve_const_iterator i;
-
-  switch(os.iword(IO::mode)) {
-    case IO::ASCII :
-      os << p.size() << ' ';
-      for (i = p.curves_begin(); i != p.curves_end(); ++i) {
-        os << *i << ' ';
-      }
-      return os;
-
-    case IO::BINARY :
-      os << p.size();
-      for (i = p.curves_begin(); i != p.curves_end(); ++i) {
-        os << *i;
-      }
-      return os;
-
-    default:
-      os << "Polygon_2(" << std::endl;
-      for (i = p.curves_begin(); i != p.curves_end(); ++i) {
-        os << "  " << *i << std::endl;
-      }
-      os << ")" << std::endl;
-      return os;
-  }
-}
-
-} //namespace CGAL
-
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/General_polygon_with_holes_2.h b/3rdparty/CGAL-4.8/include/CGAL/General_polygon_with_holes_2.h
deleted file mode 100644
index e989187..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/General_polygon_with_holes_2.h
+++ /dev/null
@@ -1,200 +0,0 @@
-// Copyright (c) 2005  Tel-Aviv University (Israel).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Baruch Zukerman <baruchzu at post.tau.ac.il>
-
-#ifndef CGAL_GENERAL_POLYGON_WITH_HOLES_2_H
-#define CGAL_GENERAL_POLYGON_WITH_HOLES_2_H
-
-#include <list>
-#include <iostream>
-#include <CGAL/IO/io.h>
-
-namespace CGAL {
-
-template <class Polygon_>
-class General_polygon_with_holes_2
-{
-
-public:
-  typedef General_polygon_with_holes_2<Polygon_> 		Self;
-  typedef Polygon_                                    Polygon_2;
-  typedef typename Self::Polygon_2							General_polygon_2;  
-  typedef std::list<Polygon_>                         Holes_container;
-
-  typedef typename Holes_container::iterator          Hole_iterator;
-  typedef typename Holes_container::const_iterator    Hole_const_iterator;
-
-  typedef unsigned int                                 Size;
-
-  General_polygon_with_holes_2() : m_pgn()
-  {}
-
-
-  explicit General_polygon_with_holes_2(const General_polygon_2& pgn_boundary) 
-  : m_pgn(pgn_boundary)
-  {}
-
-
-  template <class HolesInputIterator>
-  General_polygon_with_holes_2(const General_polygon_2& pgn_boundary,
-                       HolesInputIterator h_begin,
-                       HolesInputIterator h_end) : m_pgn(pgn_boundary),
-                                                   m_holes(h_begin, h_end)
-  {}
-
-  Hole_iterator holes_begin()
-  {
-    return m_holes.begin();
-  }
-
-  Hole_iterator holes_end()
-  {
-    return m_holes.end();
-  }
-
-  Hole_const_iterator holes_begin() const
-  {
-    return m_holes.begin();
-  }
-
-  Hole_const_iterator holes_end() const
-  {
-    return m_holes.end();
-  }
-
-  bool is_unbounded() const
-  {
-    return m_pgn.is_empty();
-  }
-
-  General_polygon_2& outer_boundary()
-  {
-    return m_pgn;
-  }
-
-  const General_polygon_2& outer_boundary() const
-  {
-    return m_pgn;
-  }
-
-  void add_hole(const General_polygon_2& pgn_hole)
-  {
-    m_holes.push_back(pgn_hole);
-  }
-
-  void erase_hole(Hole_iterator hit)
-  {
-    m_holes.erase(hit);
-  }
-
-  bool has_holes() const
-  {
-    return (!m_holes.empty());
-  }
-
-  Size number_of_holes() const
-  {
-    return static_cast<Size>(m_holes.size());
-  }
-
-  void clear()
-  {
-    m_pgn.clear();
-    m_holes.clear();
-  }
-
-  bool is_plane() const
-  {
-    return (m_pgn.is_empty() && m_holes.empty());
-  }
-
-
-
-protected:
-
-  General_polygon_2           m_pgn;
-  Holes_container            m_holes;
-};
-
-
-//-----------------------------------------------------------------------//
-//                          operator<<
-//-----------------------------------------------------------------------//
-
-template <class Polygon_>
-std::ostream
-&operator<<(std::ostream &os, const General_polygon_with_holes_2<Polygon_>& p)
-{
-  typename General_polygon_with_holes_2<Polygon_>::Hole_const_iterator hit;
-
-  switch(os.iword(IO::mode)) {
-    case IO::ASCII :
-      os << p.outer_boundary() << ' ' << p.number_of_holes()<< ' ';
-      for (hit = p.holes_begin(); hit != p.holes_end(); ++hit) {
-        os << *hit << ' ';
-      }
-      return os;
-
-    case IO::BINARY :
-      os << p.outer_boundary()  << p.number_of_holes();
-      for (hit = p.holes_begin(); hit != p.holes_end(); ++hit) {
-        os << *hit;
-      }
-      return os;
-     
-
-    default:
-      os << "General_polygon_with_holes_2( " << std::endl;
-      os << p.outer_boundary() << " " << p.number_of_holes()<< " ";
-      for (hit = p.holes_begin(); hit != p.holes_end(); ++hit) {
-        os << *hit << " )";
-      }
-      return os;
-  }
-}
-
-//-----------------------------------------------------------------------//
-//                          operator>>
-//-----------------------------------------------------------------------//
-
-template <class Polygon_>
-std::istream &operator>>(std::istream &is, General_polygon_with_holes_2<Polygon_>& p)
-{
-  p.clear();
-  is >> p.outer_boundary();
-
-  unsigned int n_holes;
-  is >> n_holes;
-  if (is) 
-  {
-    Polygon_ pgn_hole;
-    for (unsigned int i=0; i<n_holes; i++) 
-    {
-      is >> pgn_hole;
-      p.add_hole(pgn_hole);
-    }
-  }
- 
-  return is;
-}
-
-
-} //namespace CGAL
-
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Gmpfi.h b/3rdparty/CGAL-4.8/include/CGAL/Gmpfi.h
deleted file mode 100644
index 97bb80d..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Gmpfi.h
+++ /dev/null
@@ -1,368 +0,0 @@
-// Copyright (c) 2007-2009 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 at gmx.com>
-//         Michael Hemmer <Michael.Hemmer at sophia.inria.fr>
-
-#ifndef CGAL_GMPFI_H
-#define CGAL_GMPFI_H
-
-#include <CGAL/config.h>
-#ifdef CGAL_USE_MPFI
-
-#include <CGAL/GMP/Gmpfi_type.h>
-#include <CGAL/number_type_basic.h>
-#include <CGAL/mpfi_coercion_traits.h>
-#include <CGAL/Interval_traits.h>
-#include <CGAL/Bigfloat_interval_traits.h>
-
-namespace CGAL{
-
-template <>
-class Algebraic_structure_traits<Gmpfi>:
-public Algebraic_structure_traits_base<Gmpfi,Field_with_kth_root_tag>{
-public:
-
-        typedef Tag_false       Is_exact;
-        typedef Tag_true        Is_numerical_sensitive;
-        typedef Uncertain<bool> Boolean;
-
-        struct Is_zero:
-        public std::unary_function<Type,Boolean>{
-                Boolean operator()(const Type &x)const{
-                        return x.is_zero();
-                }
-        };
-
-        struct Is_one:
-        public std::unary_function<Type,Boolean>{
-                Boolean operator()(const Type &x)const{
-                        return x.is_one();
-                }
-        };
-
-        struct Square:
-        public std::unary_function<Type,Type>{
-                Type operator()(const Type &x)const{
-                        return x.square();
-                };
-        };
-
-        struct Is_square:
-        public std::binary_function<Type,Type&,Boolean>{
-                Boolean operator()(const Type &x)const{
-                        return x.is_square();
-                };
-                Boolean operator()(const Type &x,Type &y)const{
-                        return x.is_square(y);
-                };
-        };
-
-        struct Sqrt:
-        public std::unary_function<Type,Type>{
-                Type operator()(const Type &x)const{
-                        return x.sqrt();
-                };
-        };
-
-        struct Kth_Root:
-        public std::binary_function<int,Type,Type>{
-                Type operator()(int k,const Type &x)const{
-                        return (k==3?x.cbrt():x.kthroot(k));
-                };
-        };
-
-        struct Divides:
-        public std::binary_function<Type,Type,Boolean>{
-                Boolean operator()(const Type &d,const Type &n)const{
-                        // Avoid compiler warning
-		        (void)n;
-                        return !(d.is_zero());
-                };
-                Boolean operator()(const Type &d,const Type &n,Type &c)const{
-                        return d.divides(n,c);
-                };
-        };
-};
-
-template <>
-class Real_embeddable_traits<Gmpfi>:
-public INTERN_RET::Real_embeddable_traits_base<Gmpfi,CGAL::Tag_true>{
-
-        typedef Algebraic_structure_traits<Type>        AST;
-
-        public:
-
-        typedef Tag_true                                Is_real_embeddable;
-        typedef Uncertain<bool>                         Boolean;
-        typedef Uncertain<CGAL::Comparison_result>      Comparison_result;
-        typedef Uncertain<CGAL::Sign>                   Sign;
- 
-        typedef AST::Is_zero    Is_zero;
-
-        struct Is_finite:
-        public std::unary_function<Type,Boolean>{
-                inline Boolean operator()(const Type &x)const{
-                        return(x.is_number());
-                };
-        };
-
-        struct Abs:
-        public std::unary_function<Type,Type>{
-                inline Type operator()(const Type &x)const{
-                        return x.abs();
-                };
-        };
-
-        struct Sgn:
-        public std::unary_function<Type,Sign>{
-                inline Sign operator()(const Type &x)const{
-                        return x.sign();
-                };
-        };
-
-        struct Is_positive:
-        public std::unary_function<Type,Boolean>{
-                inline Boolean operator()(const Type &x)const{
-                        return x.is_positive();
-                };
-        };
-
-        struct Is_negative:
-        public std::unary_function<Type,Boolean>{
-                inline Boolean operator()(const Type &x)const{
-                        return x.is_negative();
-                };
-        };
-
-        struct Compare:
-        public std::binary_function<Type,Type,Comparison_result>{
-                inline Comparison_result operator()
-                        (const Type &x,const Type &y)const{
-                                return x.compare(y);
-                        };
-          CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT(Type,Comparison_result)
-        };
-
-        struct To_double:
-        public std::unary_function<Type,double>{
-                inline double operator()(const Type &x)const{
-                        return x.to_double();
-                };
-        };
-
-        struct To_interval:
-        public std::unary_function<Type,std::pair<double,double> >{
-                inline std::pair<double,double> operator()(const Type &x)const{
-                                return x.to_interval();
-                        };
-                };
-};
-
-
-
-template<>
-class Interval_traits<Gmpfi>
-  : public internal::Interval_traits_base<Gmpfi>{
-public: 
-  typedef Interval_traits<Gmpfi> Self; 
-  typedef Gmpfi Interval; 
-  typedef CGAL::Gmpfr Bound; 
-  typedef CGAL::Tag_false With_empty_interval; 
-  typedef CGAL::Tag_true  Is_interval; 
-
-  struct Construct :public std::binary_function<Bound,Bound,Interval>{
-    Interval operator()( const Bound& l,const Bound& r) const {
-      CGAL_precondition( l < r ); 
-      return Interval(std::make_pair(l,r));
-    }
-  };
-
-  struct Lower :public std::unary_function<Interval,Bound>{
-    Bound operator()( const Interval& a ) const {
-      return a.inf();
-    }
-  };
-
-  struct Upper :public std::unary_function<Interval,Bound>{
-    Bound operator()( const Interval& a ) const {
-      return a.sup();
-    }
-  };
-
-  struct Width :public std::unary_function<Interval,Bound>{
-    Bound operator()( const Interval& a ) const {
-      return Gmpfr::sub(a.sup(),a.inf(),std::round_toward_infinity);
-    }
-  };
-
-  struct Median :public std::unary_function<Interval,Bound>{
-    Bound operator()( const Interval& a ) const {
-      return (a.inf()+a.sup())/2;
-    }
-  };
-    
-  struct Norm :public std::unary_function<Interval,Bound>{
-    Bound operator()( const Interval& a ) const {
-      return a.abs().sup();
-    }
-  };
-
-  struct Singleton :public std::unary_function<Interval,bool>{
-    bool operator()( const Interval& a ) const {
-      return a.inf() == a.sup();
-    }
-  };
-
-  struct Zero_in :public std::unary_function<Interval,bool>{
-    bool operator()( const Interval& a ) const {
-      return a.inf() <= 0  &&  0 <= a.sup();
-    }
-  };
-
-  struct In :public std::binary_function<Bound,Interval,bool>{
-    bool operator()( Bound x, const Interval& a ) const {
-      return a.inf() <= x && x <= a.sup();
-    }
-  };
-
-  struct Equal :public std::binary_function<Interval,Interval,bool>{
-    bool operator()( const Interval& a, const Interval& b ) const {
-      return a.is_same(b);
-    }
-  };
-    
-  struct Overlap :public std::binary_function<Interval,Interval,bool>{
-    bool operator()( const Interval& a, const Interval& b ) const {
-      return a.do_overlap(b);
-    }
-  };
-    
-  struct Subset :public std::binary_function<Interval,Interval,bool>{
-    bool operator()( const Interval& a, const Interval& b ) const {
-      return b.inf() <= a.inf() && a.sup() <= b.sup() ;  
-    }
-  };
-    
-  struct Proper_subset :public std::binary_function<Interval,Interval,bool>{
-    bool operator()( const Interval& a, const Interval& b ) const {
-      return Subset()(a,b) && ! Equal()(a,b); 
-    }
-  };
-    
-  struct Hull :public std::binary_function<Interval,Interval,Interval>{
-    Interval operator()( const Interval& a, const Interval& b ) const {
-      BOOST_USING_STD_MAX();
-      BOOST_USING_STD_MIN();
-      return Interval( 
-          std::make_pair(
-              min BOOST_PREVENT_MACRO_SUBSTITUTION (a.inf(),b.inf()), 
-              max BOOST_PREVENT_MACRO_SUBSTITUTION (a.sup(),b.sup())));
-    }
-  };
-    
-  
-//  struct Empty is Null_functor 
-  
-  struct Intersection :public std::binary_function<Interval,Interval,Interval>{
-    Interval operator()( const Interval& a, const Interval& b ) const {
-      BOOST_USING_STD_MAX();
-      BOOST_USING_STD_MIN();
-      Bound l(max BOOST_PREVENT_MACRO_SUBSTITUTION (Lower()(a),Lower()(b)));
-      Bound u(min BOOST_PREVENT_MACRO_SUBSTITUTION (Upper()(a),Upper()(b)));
-      if(u < l ) throw Exception_intersection_is_empty();
-      return Construct()(l,u);
-    }
-  };
-};
-
-template<>
-class Bigfloat_interval_traits<Gmpfi>
-  :public Interval_traits<Gmpfi>
-{
-  typedef Gmpfi NT;
-  typedef CGAL::Gmpfr BF;
-public:
-  typedef Bigfloat_interval_traits<Gmpfi> Self; 
-  typedef CGAL::Tag_true                  Is_bigfloat_interval; 
-  
-  struct Relative_precision: public std::unary_function<NT,long>{
-
-    long operator()(const NT& x) const {
-      CGAL_precondition(!Singleton()(x));
-      CGAL_precondition(!CGAL::zero_in(x));
-      
-      // w = |x| * 2^-p (return p)
-      BF w(CGAL::width(x));
-      mpfr_div(w.fr(), w.fr(), CGAL::lower(CGAL::abs(x)).fr(), GMP_RNDU);
-      mpfr_log2(w.fr(), w.fr(), GMP_RNDU);
-      return -mpfr_get_si(w.fr(), GMP_RNDU);
-    }
-  };
-   
-  struct Set_precision {
-    // type for the \c AdaptableUnaryFunction concept.
-    typedef long  argument_type;
-    // type for the \c AdaptableUnaryFunction concept.
-    typedef long  result_type;  
-     
-    long operator()( long prec ) const {
-      return Gmpfi::set_default_precision(prec); 
-    }
-  };
-  
-  struct Get_precision {
-    // type for the \c AdaptableGenerator concept.
-    typedef long  result_type;  
-    long operator()() const {
-      return Gmpfi::get_default_precision(); 
-    }
-  };
-};
-
-} // namespace CGAL
-
-namespace Eigen {
-  template<class> struct NumTraits;
-  template<> struct NumTraits<CGAL::Gmpfi>
-  {
-    typedef CGAL::Gmpfi Real;
-    typedef CGAL::Gmpfi NonInteger;
-    typedef CGAL::Gmpfi Nested;
-
-    static inline Real epsilon() { return 0; }
-    static inline Real dummy_precision() { return 0; }
-
-    enum {
-      IsInteger = 0,
-      IsSigned = 1,
-      IsComplex = 0,
-      RequireInitialization = 1,
-      ReadCost = 12,
-      AddCost = 100,
-      MulCost = 100
-    };
-  };
-}
-
-#include <CGAL/GMP/Gmpfi_type.h>
-#include <CGAL/GMP_arithmetic_kernel.h>
-
-#endif
-
-#endif  // CGAL_GMPFI_H
-
-// vim: tabstop=8: softtabstop=8: smarttab: shiftwidth=8: expandtab
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Gmpfr.h b/3rdparty/CGAL-4.8/include/CGAL/Gmpfr.h
deleted file mode 100644
index 5179425..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Gmpfr.h
+++ /dev/null
@@ -1,186 +0,0 @@
-// Copyright (c) 2007-2009 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 at gmx.com>
-
-#ifndef CGAL_GMPFR_H
-#define CGAL_GMPFR_H
-
-#include <CGAL/number_type_basic.h>
-#include <CGAL/mpfr_coercion_traits.h>
-
-namespace CGAL{
-
-template <>
-class Algebraic_structure_traits<Gmpfr>:
-public Algebraic_structure_traits_base<Gmpfr,Field_with_kth_root_tag>{
-public:
-
-        typedef Tag_false       Is_exact;
-        typedef Tag_true        Is_numerical_sensitive;
-        typedef bool            Boolean;
-
-        struct Is_zero:
-        public std::unary_function<Type,Boolean>{
-                Boolean operator()(const Type &x)const{
-                        return x.is_zero();
-                }
-        };
-
-        struct Is_one:
-        public std::unary_function<Type,Boolean>{
-                Boolean operator()(const Type &x)const{
-                        return x.is_one();
-                }
-        };
-
-        struct Square:
-        public std::unary_function<Type,Type>{
-                Type operator()(const Type &x)const{
-                        return x.square();
-                };
-        };
-
-        struct Is_square:
-        public std::binary_function<Type,Type&,Boolean>{
-                Boolean operator()(const Type &x,Type &y)const{
-                        return x.is_square(y);
-                };
-                Boolean operator()(const Type &x)const{
-                        return x.is_square();
-                };
-        };
-
-        struct Sqrt:
-        public std::unary_function<Type,Type>{
-                Type operator()(const Type &x)const{
-                        return x.sqrt();
-                };
-        };
-
-        struct Kth_Root:
-        public std::binary_function<int,Type,Type>{
-                Type operator()(int k,const Type &x)const{
-                        return (k==3?x.cbrt():x.kthroot(k));
-                };
-        };
-};
-
-template <>
-class Real_embeddable_traits<Gmpfr>:
-public INTERN_RET::Real_embeddable_traits_base<Gmpfr,CGAL::Tag_true>{
-  
-        typedef Algebraic_structure_traits<Type>        AST;
-
-        public:
-
-        typedef Tag_true                Is_real_embeddable;
-        typedef bool                    Boolean;
-        typedef CGAL::Comparison_result Comparison_result;
-        typedef CGAL::Sign              Sign;
-
-        typedef AST::Is_zero    Is_zero;
-
-        struct Is_finite:
-        public std::unary_function<Type,Boolean>{
-                inline Boolean operator()(const Type &x)const{
-                        return(x.is_number());
-                };
-        };
-
-        struct Abs:
-        public std::unary_function<Type,Type>{
-                inline Type operator()(const Type &x)const{
-                        return x.abs();
-                };
-        };
-
-        struct Sgn:
-        public std::unary_function<Type,Sign>{
-                inline Sign operator()(const Type &x)const{
-                        return x.sign();
-                };
-        };
-
-        struct Is_positive:
-        public std::unary_function<Type,Boolean>{
-                inline Boolean operator()(const Type &x)const{
-                        return(x.sign()==POSITIVE);
-                };
-        };
-
-        struct Is_negative:
-        public std::unary_function<Type,Boolean>{
-                inline Boolean operator()(const Type &x)const{
-                        return(x.sign()==NEGATIVE);
-                };
-        };
-
-        struct Compare:
-        public std::binary_function<Type,Type,Comparison_result>{
-                inline Comparison_result operator()
-                        (const Type &x,const Type &y)const{
-                                return x.compare(y);
-                        }; 
-          CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT(Type,Comparison_result)
-        };
-
-        struct To_double:
-        public std::unary_function<Type,double>{
-                inline double operator()(const Type &x)const{
-                        return x.to_double();
-                };
-        };
-
-        struct To_interval:
-        public std::unary_function<Type,std::pair<double,double> >{
-                inline std::pair<double,double>operator()(const Type &x)const{
-                                return x.to_interval();
-                };
-        };
-};
-
-}
-
-namespace Eigen {
-  template<class> struct NumTraits;
-  template<> struct NumTraits<CGAL::Gmpfr>
-  {
-    typedef CGAL::Gmpfr Real;
-    typedef CGAL::Gmpfr NonInteger;
-    typedef CGAL::Gmpfr Nested;
-
-    static inline Real epsilon() { return 0; }
-    static inline Real dummy_precision() { return 0; }
-
-    enum {
-      IsInteger = 0,
-      IsSigned = 1,
-      IsComplex = 0,
-      RequireInitialization = 1,
-      ReadCost = 6,
-      AddCost = 50,
-      MulCost = 50
-    };
-  };
-}
-
-#include <CGAL/GMP/Gmpfr_type.h>
-#include <CGAL/GMP_arithmetic_kernel.h>
-
-#endif  // CGAL_GMPFR_H
-
-// vim: tabstop=8: softtabstop=8: smarttab: shiftwidth=8: expandtab
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Gmpq.h b/3rdparty/CGAL-4.8/include/CGAL/Gmpq.h
deleted file mode 100644
index 38fd092..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Gmpq.h
+++ /dev/null
@@ -1,166 +0,0 @@
-// Copyright (c) 2006-2008 Max-Planck-Institute Saarbruecken (Germany).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Michael Hemmer   <hemmer at mpi-inf.mpg.de>
-
-#ifndef CGAL_GMPQ_H
-#define CGAL_GMPQ_H
-
-#include <CGAL/number_type_basic.h>
-#include <CGAL/Gmpz.h>
-#include <CGAL/Gmp_coercion_traits.h>
-
-namespace CGAL {
-
-// AST for Gmpq-class
-template <> class Algebraic_structure_traits< Gmpq >
-  : public Algebraic_structure_traits_base< Gmpq, Field_tag >  {
-  public:
-    typedef Tag_true            Is_exact;
-    typedef Tag_false            Is_numerical_sensitive;
-
-    class Is_square
-      : public std::binary_function< Type, Type&,
-                                bool > {
-      public:
-        bool operator()( const Type& x_, Type& y ) const {
-          Gmpq x( x_ );
-          mpq_canonicalize( x.mpq() );
-          Algebraic_structure_traits< Gmpz >::Sqrt sqrt;
-          y = Gmpq( sqrt( x.numerator() ), sqrt( x.denominator() ) );
-          return y*y == x;
-        }
-        bool operator()( const Type& x) const {
-            Type y;
-            return operator()(x,y);
-        }
-
-    };
-
-    class Simplify
-      : public std::unary_function< Type&, void > {
-      public:
-        void operator()( Type& x) const {
-          mpq_canonicalize( x.mpq() );
-        }
-    };
-
-};
-
-// RET for Gmpq-class
-
-template <> class Real_embeddable_traits< Gmpq >
-  : public INTERN_RET::Real_embeddable_traits_base< Gmpq , CGAL::Tag_true > {
-  public:
-  
-    class Sgn
-      : public std::unary_function< Type, ::CGAL::Sign > {
-      public:
-        ::CGAL::Sign operator()( const Type& x ) const {
-          return x.sign();
-        }
-    };
-
-    class To_double
-      : public std::unary_function< Type, double > {
-      public:
-        double operator()( const Type& x ) const {
-          return x.to_double();
-        }
-    };
-
-    class To_interval
-      : public std::unary_function< Type, std::pair< double, double > > {
-      public:
-        std::pair<double, double> operator()( const Type& x ) const {
-          mpfr_t y;
-          mpfr_init2 (y, 53); /* Assume IEEE-754 */
-          mpfr_set_q (y, x.mpq(), GMP_RNDD);
-          double i = mpfr_get_d (y, GMP_RNDD); /* EXACT but can overflow */
-          mpfr_set_q (y, x.mpq(), GMP_RNDU);
-          double s = mpfr_get_d (y, GMP_RNDU); /* EXACT but can overflow */
-          mpfr_clear (y);
-          return std::pair<double, double>(i, s);
-        }
-    };
-};
-
-/*! \ingroup NiX_Fraction_traits_spec
- *  \brief Specialization of Fraction_traits for Gmpq
- */
-template <>
-class Fraction_traits< Gmpq > {
-public:
-    typedef Gmpq Type;
-    typedef ::CGAL::Tag_true Is_fraction;
-    typedef Gmpz Numerator_type;
-    typedef Gmpz Denominator_type;
-    typedef Algebraic_structure_traits< Gmpz >::Gcd Common_factor;
-    class Decompose {
-    public:
-        typedef Gmpq first_argument_type;
-        typedef Gmpz& second_argument_type;
-        typedef Gmpz& third_argument_type;
-        void operator () (const Gmpq& rat, Gmpz& num,Gmpz& den) {
-            num = rat.numerator();
-            den = rat.denominator();
-        }
-    };
-    class Compose {
-    public:
-        typedef Gmpz first_argument_type;
-        typedef Gmpz second_argument_type;
-        typedef Gmpq result_type;
-        Gmpq operator () (const Gmpz& num,const Gmpz& den) {
-            return Gmpq(num, den);
-        }
-    };
-};
-
-} //namespace CGAL
-
-namespace Eigen {
-  template<class> struct NumTraits;
-  template<> struct NumTraits<CGAL::Gmpq>
-  {
-    typedef CGAL::Gmpq Real;
-    typedef CGAL::Gmpq NonInteger;
-    typedef CGAL::Gmpq Nested;
-
-    static inline Real epsilon() { return 0; }
-    static inline Real dummy_precision() { return 0; }
-
-    enum {
-      IsInteger = 0,
-      IsSigned = 1,
-      IsComplex = 0,
-      RequireInitialization = 1,
-      ReadCost = 6,
-      AddCost = 150,
-      MulCost = 100
-    };
-  };
-}
-
-//since types are included by Gmp_coercion_traits.h:
-#include <CGAL/Gmpz.h>
-#include <CGAL/Gmpq.h>
-#include <CGAL/Gmpzf.h>
-#include <CGAL/GMP_arithmetic_kernel.h>
-
-#endif // CGAL_GMPQ_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Gmpz.h b/3rdparty/CGAL-4.8/include/CGAL/Gmpz.h
deleted file mode 100644
index b196789..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Gmpz.h
+++ /dev/null
@@ -1,241 +0,0 @@
-// Copyright (c) 2006-2008 Max-Planck-Institute Saarbruecken (Germany),
-// INRIA Sophia-Antipolis (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(s)     : Michael Hemmer   <hemmer at mpi-inf.mpg.de>
-//                 Sylvain Pion
-
-#ifndef CGAL_GMPZ_H
-#define CGAL_GMPZ_H
-
-#include <CGAL/config.h>
-#if defined(BOOST_MSVC)
-#  pragma warning(push)
-#  pragma warning(disable:4800) // complaint about performance in std::map where we can't do anything
-#endif
-
-#include <CGAL/number_type_basic.h>
-#include <CGAL/Gmp_coercion_traits.h>
-#include <CGAL/Quotient.h> // spec of AST for Quotient<Gmpz>
-
-#include <string>
-#include <locale>
-
-#include <CGAL/Modular_traits.h>
-
-namespace CGAL {
-
-// Algebraic structure traits
-template <> class Algebraic_structure_traits< Gmpz >
-    : public Algebraic_structure_traits_base< Gmpz,
-                                            Euclidean_ring_tag >  {
-public:
-    typedef Tag_true            Is_exact;
-    typedef Tag_false           Is_numerical_sensitive;
-
-    typedef INTERN_AST::Is_square_per_sqrt< Type >
-    Is_square;
-    class Integral_division
-        : public std::binary_function< Type, Type,
-                                Type > {
-    public:
-        Type operator()( const Type& x,
-                const Type& y ) const {
-            Gmpz result;
-            mpz_divexact(result.mpz(), x.mpz(), y.mpz());
-            CGAL_postcondition_msg(result * y == x, "exact_division failed\n");
-            return result;
-        }
-    };
-
-    class Gcd
-        : public std::binary_function< Type, Type,
-                                Type > {
-    public:
-        Type operator()( const Type& x,
-                const Type& y ) const {
-            Gmpz result;
-            mpz_gcd(result.mpz(), x.mpz(), y.mpz());
-            return result;
-
-        }
-
-        Type operator()( const Type& x,
-                                        const int& y ) const {
-          if (y > 0)
-          {
-              Gmpz Res;
-              mpz_gcd_ui(Res.mpz(), x.mpz(), y);
-              return Res;
-          }
-          return CGAL_NTS gcd(x, Gmpz(y));
-        }
-
-        Type operator()( const int& x,
-                                        const Type& y ) const {
-          return CGAL_NTS gcd(Gmpz(x), y );
-        }
-    };
-
-    typedef INTERN_AST::Div_per_operator< Type > Div;
-    typedef INTERN_AST::Mod_per_operator< Type > Mod;
-
-    class Sqrt
-        : public std::unary_function< Type, Type > {
-    public:
-        Type operator()( const Type& x ) const {
-            Gmpz result;
-            mpz_sqrt(result.mpz(), x.mpz());
-            return result;
-        }
-    };
-};
-
-template <> class Real_embeddable_traits< Gmpz >
-    : public INTERN_RET::Real_embeddable_traits_base< Gmpz , CGAL::Tag_true > {
-public:
-    class Sgn
-        : public std::unary_function< Type, ::CGAL::Sign > {
-    public:
-        ::CGAL::Sign operator()( const Type& x ) const {
-            return x.sign();
-        }
-    };
-
-    class To_double
-        : public std::unary_function< Type, double > {
-    public:
-        double operator()( const Type& x ) const {
-            return x.to_double();
-        }
-    };
-
-    class To_interval
-        : public std::unary_function< Type, std::pair< double, double > > {
-    public:
-        std::pair<double, double> operator()( const Type& x ) const {
-
-            mpfr_t y;
-            mpfr_init2 (y, 53); /* Assume IEEE-754 */
-            mpfr_set_z (y, x.mpz(), GMP_RNDD);
-            double i = mpfr_get_d (y, GMP_RNDD); /* EXACT but can overflow */
-            mpfr_set_z (y, x.mpz(), GMP_RNDU);
-            double s = mpfr_get_d (y, GMP_RNDU); /* EXACT but can overflow */
-            mpfr_clear (y);
-            return std::pair<double, double>(i, s);
-        }
-    };
-};
-
-template<> class Algebraic_structure_traits< Quotient<Gmpz> >
-    : public INTERN_QUOTIENT::Algebraic_structure_traits_quotient_base<Quotient<Gmpz> >{
-    // specialization of to double functor
-public:
-    typedef Quotient<Gmpz> Type;
-
-    struct To_double: public std::unary_function<Quotient<Gmpz>, double>{
-        double operator()(const Quotient<Gmpz>& quot){
-            mpq_t  mpQ;
-            mpq_init(mpQ);
-            const Gmpz& n = quot.numerator();
-            const Gmpz& d = quot.denominator();
-            mpz_set(mpq_numref(mpQ), n.mpz());
-            mpz_set(mpq_denref(mpQ), d.mpz());
-
-            mpq_canonicalize(mpQ);
-
-            double ret = mpq_get_d(mpQ);
-            mpq_clear(mpQ);
-            return ret;
-        }
-    };
-};
-
-//
-// Needs_parens_as_product
-//
-template <>
-struct Needs_parens_as_product<Gmpz> {
-  bool operator()(const Gmpz& x) {
-    return CGAL_NTS is_negative(x);
-  }
-};
-
-
-/*! \ingroup NiX_Modular_traits_spec
- *  \brief a model of concept ModularTraits, 
- *  specialization of NiX::Modular_traits. 
- */
-template<>
-class Modular_traits< Gmpz > {
-  typedef Residue RES;
- public:
-    typedef Gmpz NT;
-    typedef CGAL::Tag_true Is_modularizable;
-    typedef Residue Residue_type;
-
-    struct Modular_image{
-        Residue_type operator()(const NT& a){
-          NT tmp_1(a % NT(RES::get_current_prime()));
-          return CGAL::Residue(int(mpz_get_si(tmp_1.mpz())));
-        }
-    };
-    struct Modular_image_representative{
-        NT operator()(const Residue_type& x){
-          return NT(x.get_value());
-        }
-    };    
-};
-
-} //namespace CGAL
-
-#if defined(BOOST_MSVC)
-#  pragma warning(pop)
-#endif
-
-namespace Eigen {
-  template<class> struct NumTraits;
-  template<> struct NumTraits<CGAL::Gmpz>
-  {     
-    typedef CGAL::Gmpz Real;
-    typedef CGAL::Gmpq NonInteger;
-    typedef CGAL::Gmpz Nested;
-
-    static inline Real epsilon() { return 0; }
-    static inline Real dummy_precision() { return 0; }
-
-    enum {
-      IsInteger = 1,
-      IsSigned = 1,
-      IsComplex = 0,
-      RequireInitialization = 1,
-      ReadCost = 6,
-      AddCost = 30,
-      MulCost = 50
-    };
-  };
-}
-
-
-//since types are included by Gmp_coercion_traits.h:
-#include <CGAL/Gmpz.h>
-#include <CGAL/Gmpq.h>
-#include <CGAL/Gmpzf.h>
-#include <CGAL/GMP_arithmetic_kernel.h>
-
-#endif // CGAL_GMPZ_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Gmpzf.h b/3rdparty/CGAL-4.8/include/CGAL/Gmpzf.h
deleted file mode 100644
index 779bf7b..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Gmpzf.h
+++ /dev/null
@@ -1,185 +0,0 @@
-// Copyright (c) 2006-2008 Max-Planck-Institute Saarbruecken (Germany).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Michael Hemmer   <hemmer at mpi-inf.mpg.de>
-
-#ifndef CGAL_GMPZF_H
-#define CGAL_GMPZF_H
-
-// includes
-#include <CGAL/number_type_basic.h>
-#include <CGAL/Gmp_coercion_traits.h>
-#include <CGAL/Gmpz.h>
-#include <CGAL/Interval_nt.h>
-
-namespace CGAL {
-
-// Algebraic structure traits
-template <> class Algebraic_structure_traits< Gmpzf >
-    : public Algebraic_structure_traits_base< Gmpzf, Euclidean_ring_tag >  {
-public:
-    typedef Tag_true            Is_exact;
-
-    struct Is_zero
-        : public std::unary_function< Type, bool > {
-    public:
-        bool operator()( const Type& x ) const {
-            return x.is_zero();
-        }
-    };
-
-    struct Integral_division
-        : public std::binary_function< Type,
-                                Type,
-                                Type > {
-    public:
-        Type operator()(
-                const Type& x,
-                const Type& y ) const {
-            return x.integral_division(y);
-        }
-    };
-
-    struct Gcd
-        : public std::binary_function< Type,
-                                Type,
-                                Type > {
-    public:
-        Type operator()(
-                const Type& x,
-                const Type& y ) const {
-            return x.gcd(y);
-        }
-        CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR(int)
-    };
-
-    class Div
-        : public std::binary_function< Type, Type, Type > {
-    public:
-        Type operator()( const Type& x, const Type& y ) const {
-            return Type(x).div( y );
-	}
-    };
-
-    typedef INTERN_AST::Mod_per_operator< Type > Mod;
-  
-  class Is_square
-    : public std::binary_function< Type, Type&, bool > {
-  public:      
-    bool operator()( const Type& x, Type& y ) const {
-      y = CGAL::approximate_sqrt(x);
-      return y * y == x;
-    }
-    bool operator()( const Type& x) const {
-      Type dummy;
-      return operator()(x,dummy);
-    }
-  };
-};
-
-
-// Real embeddable traits
-template <>
-class Real_embeddable_traits< Gmpzf >
-    : public INTERN_RET::Real_embeddable_traits_base< Gmpzf , CGAL::Tag_true > {
-
-    typedef Algebraic_structure_traits<Gmpzf> AST;
-public:
-  typedef AST::Is_zero Is_zero;
-  
-    struct Sgn
-        : public std::unary_function< Type, ::CGAL::Sign > {
-    public:
-        ::CGAL::Sign operator()( const Type& x ) const {
-            return x.sign();
-        }
-    };
-
-    struct Compare
-        : public std::binary_function< Type,
-                                  Type,
-                                  Comparison_result > {
-    public:
-        Comparison_result operator()(
-                const Type& x,
-                const Type& y ) const {
-            return x.compare(y);
-        }
-    };
-
-    struct To_double
-        : public std::unary_function< Type, double > {
-    public:
-        double operator()( const Type& x ) const {
-            return x.to_double();
-        }
-    };
-
-    struct To_interval
-        : public std::unary_function< Type, std::pair< double, double > > {
-    public:
-        std::pair<double, double> operator()( const Type& x ) const {
-	    return x.to_interval();
-        }
-    };
-};
-
-// specialization of to double functor
-template<>
-class Real_embeddable_traits< Quotient<Gmpzf> >
-    : public
-INTERN_QUOTIENT::Real_embeddable_traits_quotient_base< Quotient<Gmpzf> >
-{
-public:
-    struct To_double: public std::unary_function<Quotient<Gmpzf>, double>{
-        inline
-        double operator()(const Quotient<Gmpzf>& q) const {
-	  std::pair<double, long> n = q.numerator().to_double_exp();
-	  std::pair<double, long> d = q.denominator().to_double_exp();
-	  double scale = std::ldexp(1.0, n.second - d.second);
-	  return (n.first / d.first) * scale;
-	}
-    };
-    struct To_interval
-        : public std::unary_function<Quotient<Gmpzf>, std::pair<double,double> >{
-        inline
-        std::pair<double,double> operator()(const Quotient<Gmpzf>& q) const {
-	  // do here as MP_Float does
-	  std::pair<std::pair<double, double>, long> n =
-	    q.numerator().to_interval_exp();
-	  std::pair<std::pair<double, double>, long> d =
-	    q.denominator().to_interval_exp();
-
-	  CGAL_assertion_msg(CGAL::abs(1.0*n.second - d.second) < (1<<30)*2.0,
-                     "Exponent overflow in Quotient<MP_Float> to_interval");
-	  return ldexp(Interval_nt<>(n.first) / Interval_nt<>(d.first),
-               n.second - d.second).pair();
-        }
-    };
-};
-
-} //namespace CGAL
-
-//since types are included by Gmp_coercion_traits.h:
-#include <CGAL/Gmpz.h>
-#include <CGAL/Gmpq.h>
-#include <CGAL/Gmpzf.h>
-
-#endif // CGAL_GMPZF_H
-
-// ===== EOF ==================================================================
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Gray_image_mesh_domain_3.h b/3rdparty/CGAL-4.8/include/CGAL/Gray_image_mesh_domain_3.h
deleted file mode 100644
index 9d351af..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Gray_image_mesh_domain_3.h
+++ /dev/null
@@ -1,132 +0,0 @@
-// Copyright (c) 2009 INRIA Sophia-Antipolis (France).
-// Copyright (c) 2012  GeometryFactory Sarl (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
-// 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(s)     : Stephane Tayeb, Laurent Rineau
-//
-
-#ifndef CGAL_GRAY_IMAGE_MESH_DOMAIN_3_H
-#define CGAL_GRAY_IMAGE_MESH_DOMAIN_3_H
-
-#include <CGAL/Random.h>
-#include <CGAL/Labeled_mesh_domain_3.h>
-#include <CGAL/Mesh_3/Image_to_labeled_function_wrapper.h>
-
-#include <functional>
-
-namespace CGAL {
-
-namespace internal {
-
-  template<typename T>
-  struct Greater_than {
-    typedef T argument_type;
-    Greater_than(const T& second) : second(second) {}
-    bool operator()(const T& first) const {
-      return std::greater<T>()(first, second);
-    }
-    T second;
-  };
-
-}
-
-/**
- * @class Gray_image_mesh_domain_3
- *
- *
- */
-template<class Image,
-         class BGT,
-         typename Image_word_type = float,
-         typename Transform = internal::Greater_than<Image_word_type>,
-         typename Subdomain_index = int>
-class Gray_image_mesh_domain_3
-  : public Labeled_mesh_domain_3<
-  Mesh_3::Image_to_labeled_function_wrapper<Image, BGT,
-                                            Image_word_type,
-                                            Subdomain_index,
-                                            Transform,
-                                            false> ,
-  BGT>
-{
-public:
-  typedef Mesh_3::Image_to_labeled_function_wrapper<Image, BGT,
-                                                    Image_word_type,
-                                                    Subdomain_index,
-                                                    Transform,
-                                                    false>           Wrapper;
-
-  typedef Labeled_mesh_domain_3<Wrapper, BGT>                        Base;
-
-  typedef typename Base::Sphere_3 Sphere_3;
-  typedef typename Base::FT FT;
-  typedef BGT Geom_traits;
-  typedef CGAL::Bbox_3 Bbox_3;
-
-  /// Constructor
-  Gray_image_mesh_domain_3(const Image& image,
-                           const Image_word_type iso_value,
-                           const Image_word_type value_outside = 0.,
-                           const FT& error_bound = FT(1e-3),
-                           CGAL::Random* p_rng = NULL)
-    : Base(Wrapper(image, 
-                   Transform(iso_value),
-                   value_outside),
-           compute_bounding_box(image),
-           error_bound,
-           p_rng)
-  {}
-
-  Gray_image_mesh_domain_3(const Image& image,
-                           const Transform& transform,
-                           const Image_word_type value_outside = 0.,
-                           const FT& error_bound = FT(1e-3),
-                           CGAL::Random* p_rng = NULL)
-    : Base(Wrapper(image, transform, value_outside),
-           compute_bounding_box(image),
-           error_bound,
-           p_rng)
-  {}
-
-  /// Destructor
-  virtual ~Gray_image_mesh_domain_3() {}
-
-
-private:
-  /// Returns a box enclosing image \c im
-  Bbox_3 compute_bounding_box(const Image& im) const
-  {
-    return Bbox_3(-1,-1,-1,
-                  im.xdim()*im.vx()+1, im.ydim()*im.vy()+1, im.zdim()*im.vz()+1);
-  }
-
-private:
-  // Disabled copy constructor & assignment operator
-  typedef Gray_image_mesh_domain_3<Image, BGT> Self;
-  Gray_image_mesh_domain_3(const Self& src);
-  Self& operator=(const Self& src);
-
-};  // end class Gray_image_mesh_domain_3
-
-
-
-}  // end namespace CGAL
-
-
-
-#endif // CGAL_GRAY_IMAGE_MESH_DOMAIN_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Handle_with_policy.h b/3rdparty/CGAL-4.8/include/CGAL/Handle_with_policy.h
deleted file mode 100644
index 905a543..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Handle_with_policy.h
+++ /dev/null
@@ -1,1405 +0,0 @@
-// Copyright (c) 2001-2007 Max-Planck-Institute Saarbruecken (Germany).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Michael Seel <seel at mpi-inf.mpg.de>
-//                 Arno Eigenwillig <arno at mpi-inf.mpg.de>
-//                 Lutz Kettner <kettner at mpi-inf.mpg.de>
-
-#ifndef CGAL_HANDLE_WITH_POLICY_H
-#define CGAL_HANDLE_WITH_POLICY_H
-
-#include <CGAL/basic.h>
-#include <CGAL/memory.h>
-#include <CGAL/type_traits.h>
-
-#include <CGAL/assertions.h>
-#include <CGAL/use.h>
-
-#include <boost/mpl/if.hpp>
-
-#include <cstddef>
-
-#ifdef CGAL_USE_LEDA
-#  if CGAL_LEDA_VERSION < 500
-#    include <LEDA/memory.h>
-#  else
-#    include <LEDA/system/memory.h>
-#  endif
-#endif
-
-
-
-namespace CGAL {
-
-/*! \brief <tt>\#include <CGAL/Handle_with_policy.h></tt> for handles with policy
-    parameter for reference counting and union-find strategy. Uses 
-    \c LEDA_MEMORY if available. 
-
-    There are two fundamentally different usages of this base class:
-
-        - with a single representation class. In this case the handle
-          manages allocation and deallocation and the type \c T can
-          be an arbitrary type---the handle adds the necessary reference
-          counter internally.
-
-        - with a hierarchy of representation classes. Type \c T will be 
-          the common base class of this hierarchy and it has to be derived
-          itself from a specific base class, which can be accessed directly
-          or generically from the policy class. The allocator in the 
-          handle will not be used in this scenario, since the handle class
-          does not allocate any representations. Instead, the handle class
-          derived from this handle base class is allocating the different
-          representations with the \c new operator. In this case, 
-          the allocator in the base class of \c T is used.
-
-    We give an example for each usage. See also the documentation
-    of \c Handle_with_policy.
-
-\b Example
-
-We use a single representation class to store an integer. The second
-constructor makes use of one of the forwarding template constructors
-that simply forward their parameter list to the representation
-constructors. They exist for up to ten parameters.  The third
-constructor illustrates how the \c USE_WITH_INITIALIZE_WITH can be
-used. It is useful if extensive computations are necessary before the
-representation can be created.
-
-\code
-struct Int_rep {
-    int val;
-    Int_rep( int i = 0) : val(i) {}
-    Int_rep( int i, int j) : val(i+j) {}
-    Int_rep( int i, int j, int k) : val(i+j+k) {}
-};
-
-template < class Unify>
-struct Int_t : public Handle_with_policy< Int_rep, Unify > {
-    typedef Handle_with_policy< Int_rep, Unify > Base;
-    Int_t( int i = 0) : Base( i) {}
-    Int_t( int i, int j) : Base( i, j) {}     // template constructors
-    Int_t( int i, int j, int k) : Base( Base::USE_WITH_INITIALIZE_WITH) {
-        initialize_with( i, j + k);
-    }
-    int  value() const { return ptr()->val; }
-    void set_value( int i) {
-        copy_on_write();
-        ptr()->val = i;
-    }
-    bool operator==( const Int_t<Unify>& i) const {
-        bool equal = (value() == i.value());
-        if ( equal)
-            Base::unify(i);
-        return equal;
-    }
-};
-\endcode
-
-\b Example
-
-We use a class hierarchy of two representation classes: one base class
-for representing one integer, and a derived class to represent an
-additional integer. To also added virtual get and set functions to
-make this example similar to the one above. 
-
-We use the generic solution to pick the base class for \c Int_vrep
-from the policy class. So all representations are class templates with
-a policy and an allocator as parameter and the handle class
-instantiates them. If this flexibility is not needed, one could derive
-directly from the appropriate base class, i.e., \c
-::CGAL::Reference_counted_hierarchy<Alloc> or \c
-::CGAL::Reference_counted_hierarchy_with_union<Alloc>. \c Alloc is an
-allocator of \c char's here.
-
-\code
-template <class Policy, class Alloc>
-struct Int_vrep : public Policy::Hierarchy_base< Alloc>::Type {
-    int val;
-    virtual ::CGAL::Reference_counted_hierarchy<Alloc>* clone() { 
-        return new Int_vrep( *this); 
-    }
-    virtual int  get_val() const { return val; }
-    virtual void set_val( int i) { val = i; }
-    Int_vrep( int i = 0) : val(i) {}
-};
-
-template <class Policy, class Alloc>
-struct Int_vrep2 : public Int_vrep<Policy,Alloc> {
-    int val2;
-    virtual ::CGAL::Reference_counted_hierarchy<Alloc>* clone() { 
-        return new Int_vrep2( *this);
-    }
-    virtual int get_val() const { return val + val2; }
-    virtual void set_val( int i) { val = i - val2; }
-    Int_vrep2( int i, int j) : Int_vrep<Policy,Alloc>(i), val2(j) {}
-};
-
-template < class Unify, class Alloc = CGAL_ALLOCATOR(char) >
-struct Int_vt : public Handle_with_policy< Int_vrep<Unify,Alloc>, Unify > {
-    typedef Handle_with_policy< Int_vrep<Unify,Alloc>, Unify > Base;
-    Int_vt( int i = 0) : Base( new Int_vrep<Unify,Alloc>(i)) {}
-    Int_vt( int i, int j) : Base( new Int_vrep2<Unify,Alloc>(i,j)) {}
-
-    int  value() const { return ptr()->get_val(); }
-    void set_value( int i) {
-        copy_on_write();
-        ptr()->set_val(i);
-    }
-    bool operator==( const Int_vt<Unify>& i) const {
-        bool equal = (value() == i.value());
-        if ( equal)
-            Base::unify(i);
-        return equal;
-    }
-};
-\endcode
-
-*/
-//@{
-
-// Forward declarations of HandlePolicy classes
-class Handle_policy_in_place;
-class Handle_policy_no_union;
-class Handle_policy_union;
-class Handle_policy_union_and_reset;
-
-// Reference counted representation
-// ================================
-
-//! the base class for bodies of reference counted representations \c T.
-template <class T_>
-class Reference_counted {
-public:
-    typedef T_                          rep_type;
-    typedef Reference_counted<rep_type> Self;
-    typedef rep_type*                   Rep_pointer;
-private:
-    mutable unsigned int count;  // reference counter
-    rep_type             rep;
-public:
-    Reference_counted() : count(1) {}
-    Reference_counted( const rep_type& t) : count(1), rep(t) {}
-    Reference_counted( const Self& r) : count(1), rep(r.rep) {}
-
-    void clear() { rep = rep_type(); }
-    Rep_pointer  base_ptr()  { return &rep; }
-    void add_reference()     { ++count; }
-    void remove_reference()  { --count; }
-    bool is_shared() const   { return count > 1; }
-    int  union_size() const  { return 1+count; }
-    void add_union_size(int) {}
-};
-
-/*!\brief
- * Base class for bodies of reference counted representations \c T
- * with a forwarding pointer for identical representations.
- */
-template <class T_>
-class Reference_counted_with_forwarding {
-public:
-    typedef T_ rep_type;
-    typedef Reference_counted_with_forwarding<rep_type> Self;
-    typedef rep_type*  Rep_pointer;
-    friend class Handle_policy_union;
-    friend class Handle_policy_union_and_reset;
-private:
-    mutable unsigned int count;  // reference counter
-    mutable Self*        next;   // forwarding pointer to valid rep or 0
-    mutable int          u_size; // union set size incl this rep and its handle
-    mutable rep_type     rep;
-public:
-    Reference_counted_with_forwarding()
-        : count(1), next(0), u_size(2) {}
-    Reference_counted_with_forwarding( const rep_type& t)
-        : count(1), next(0), u_size(2), rep(t) {}
-    Reference_counted_with_forwarding( const Self& r)
-        : count(1), next(0), u_size(2), rep(r.rep) {}
-
-    void clear() { rep = rep_type(); }
-    Rep_pointer  base_ptr()    { return &rep; }
-    void add_reference()       { ++count; }
-    void remove_reference()    { --count; }
-    bool is_shared() const     { return count > 1; }
-    bool is_forwarding() const { return next != 0; }
-    int  union_size() const    { return u_size; }
-    void add_union_size(int a) {  
-        CGAL_precondition( u_size + a > 0);
-        u_size += a;
-    }
-};
-
-
-struct Reference_counted_hierarchy_base {};
-
-
-/*!\brief Base class for reference counted representations with a class 
- * hierarchy of different representations. Needs an allocator for \c char's
- * as parameter.
- */
-template <class Allocator_  = CGAL_ALLOCATOR(char)>
-class Reference_counted_hierarchy : public Reference_counted_hierarchy_base {
-    // make sure it's always a char allocator
-    typedef typename Allocator_::template rebind< char> Char_alloc_rebind;
-    typedef typename Char_alloc_rebind::other   Char_allocator;
-
-    static Char_allocator alloc;
-
-public:
-    void* operator new(size_t bytes) { return alloc.allocate( bytes); }
-    void  operator delete(void* p, size_t bytes) { 
-        alloc.deallocate((char*)p, bytes);
-    }
-
-public:
-    typedef Allocator_ Allocator;
-    typedef Reference_counted_hierarchy<Allocator> Self;
-    typedef Self*  Rep_pointer;
-private:
-    mutable unsigned int count;  // reference counter
-public:
-    Reference_counted_hierarchy() : count(1) {}
-    Reference_counted_hierarchy( const Self&) : count(1) {}
-
-    Rep_pointer base_ptr()   { return this; }
-    void add_reference()     { ++count; }
-    void remove_reference()  { --count; }
-    bool is_shared() const   { return count > 1; }
-    int  union_size() const  { return 1+count; }
-    void add_union_size(int) {}
-
-    //! returns a copy of \c this. Can be implemented like
-    //! <tt>return new Derived_type( *this);</tt>
-    virtual Self* clone() = 0;
-    //! the virtual destructor is essential for proper memory management here.
-    virtual ~Reference_counted_hierarchy() {}
-    //! can be used to minimize memory consumption once it is known that this
-    //! representation is not used anymore and only needed to keep a fowarding
-    //! pointer. One example would be cleaning up dynamically allocated
-    //! data, or another example would be overwriting a \c leda::real with 
-    //! a default constructed value to free its old expression tree. However,
-    //! this function can also be savely ignored and kept empty.
-    virtual void clear() {}
-};
-
-template <class Alloc>
-typename Reference_counted_hierarchy<Alloc>::Char_allocator
-    Reference_counted_hierarchy<Alloc>::alloc;
-
-/*!\brief Base class for reference counted representations with a class 
- * hierarchy of different representations. Needs an allocator for \c char's
- * as parameter.
- */
-template <class Allocator_  = CGAL_ALLOCATOR(char)>
-class Reference_counted_hierarchy_with_union 
-    : public Reference_counted_hierarchy<Allocator_> 
-{
-    friend class Handle_policy_union;
-    friend class Handle_policy_union_and_reset;
-public:
-    typedef Allocator_ Allocator;
-    typedef Reference_counted_hierarchy_with_union<Allocator> Self;
-private:
-    mutable Self*        next;   // forwarding pointer to valid rep or 0
-    mutable int          u_size; // union set size incl this rep and its handle
-public:
-    Reference_counted_hierarchy_with_union() : 
-        Reference_counted_hierarchy<Allocator_>(), next(0), u_size(2) {}
-    bool is_forwarding() const { return next != 0; }
-    int  union_size() const    { return u_size; }
-    void add_union_size(int a) {  
-        CGAL_precondition( u_size + a > 0);
-        u_size += a;
-    }
-};
-
-
-// Handle for reference counted representation
-// ===========================================
-
-namespace Intern {
-    // Some helper classes to select representation between single class
-    // representations and class hierarchy representations.
-
-    // the representation type including a reference counter. 
-    // The handle allocates objects of this type. This is the version
-    // for the single representation type.
-    template <class T, int HandleHierarchyPolicy>
-    struct Rep_bind_reference_counted {
-        typedef Reference_counted<T> Rep;
-    };
-
-    // the representation type including a reference counter. 
-    // The handle allocates objects of this type. This is the version
-    // for the class hierarchy of representation types.
-    template <class T>
-    struct Rep_bind_reference_counted<T, true> {
-        typedef T Rep;
-    };
-
-    // the two versions for Reference_counted_with_forwarding
-    template <class T, int HandleHierarchyPolicy>
-    struct Rep_bind_reference_counted_with_forwarding {
-        typedef Reference_counted_with_forwarding<T> Rep;
-    };
-
-    // the representation type including a reference counter. 
-    // The handle allocates objects of this type. This is the version
-    // for the class hierarchy of representation types.
-    template <class T>
-    struct Rep_bind_reference_counted_with_forwarding<T, true> {
-        Rep_bind_reference_counted_with_forwarding() {
-            // make sure we derived from the right type 
-            typedef typename T::Allocator Alloc;
-            typedef ::CGAL::Reference_counted_hierarchy_with_union<Alloc> 
-                Reference_counted_hierarchy_with_union;
-            CGAL_USE_TYPE(Reference_counted_hierarchy_with_union);
-            CGAL_static_assertion((
-              ::CGAL::is_same_or_derived< Reference_counted_hierarchy_with_union, T >::value ));
-        }
-        typedef T Rep;
-    };
-
-}
-
-/*! \brief Policy class for \c Handle_with_policy that stores the
-    representation directly without reference counting and without dynamic 
-    memory allocation, is actually \e not a model of the \c HandlePolicy
-    concept, but can be  used instead of one. It selects a different
-    specialized implementation of \c Handle_with_policy. It works only with
-    the single representation type, not with a class hierarchy of 
-    representation types since they need the pointer in the handle
-    for the polymorphy.
-*/
-class Handle_policy_in_place {};
-
-/*!\brief
- * Policy class for \c Handle_with_policy<T> that ignores unifying of
- * identical representations \c T, is a model of the \c HandlePolicy concept.
- */
-class Handle_policy_no_union {
-public:
-    /*!\brief
-     * A rebind mechanism to create the representation type.
-     */
-    template <class T, int hierarchy>
-    struct Rep_bind {
-        //! the representation type including a reference counter. 
-        //! The handle allocates objects of this type.
-        typedef typename 
-            Intern::Rep_bind_reference_counted<T,hierarchy>::Rep Rep;
-    };
-
-    /*!\brief
-     * A rebind mechanism to access the base class for class hierarchies
-     * of representations. 
-     * 
-     * The base classes can be used directly, but this
-     * rebind mechamism allows the implementation of handle-rep classes
-     * that are parameterized with the policy class only and adapt to
-     * the necessary base class.
-     */
-    template <class Alloc>
-    struct Hierarchy_base {
-        //! type that can be used as base class for the representation type.
-        typedef Reference_counted_hierarchy<Alloc> Type;
-    };
-    
-    /*! \brief unifies the representations of the two handles \a h and \a g.
-     *  The effect is void here.
-     * 
-     * \pre The representations represent the same value and one could be 
-     *  replaced by the other.
-    */
-    template <class H>
-    static void unify( const H& h, const H& g) {
-        (void)h; // avoid warnings for unused parameters
-        (void)g; // but keep the names in the definition for the doc.
-    }
-
-    //! finds the currently valid representation for the handle \a h
-    //! and returns a pointer to its stored value of type \a T.
-    template <class H>
-    static typename H::Rep_pointer find( const H& h) {
-        return h.ptr_->base_ptr();
-    }
-};
-
-/*!\brief
- * Policy class for \c Handle_with_policy that implements unifying of
- * identical representations \c T with trees and path compression, is a
- * model of the \c HandlePolicy concept.
- */
-class Handle_policy_union {
-public:
-    /*!\brief
-     * A rebind mechanism to create the representation type.
-     */
-    template <class T, int hierarchy>
-    struct Rep_bind {
-        //! this default constructor contains some compile-time checks.
-        Rep_bind() {
-	  //Intern::Rep_bind_reference_counted_with_forwarding<T, hierarchy>
-	  //     check;
-          //  (void)check;
-	  (void)Intern::Rep_bind_reference_counted_with_forwarding<T, hierarchy>();
-        }
-        //! the representation type including a reference counter. 
-        //! The handle allocates objects of this type.
-        typedef typename Intern::Rep_bind_reference_counted_with_forwarding<T,
-            hierarchy>::Rep Rep;
-    };
-
-    /*!\brief
-     * A rebind mechanism to access the base class for class hierarchies
-     * of representations. 
-     * 
-     * The base classes can be used directly, but this
-     * rebind mechamism allows the implementation of handle-rep classes
-     * that are parameterized with the policy class only and adapt to
-     * the necessary base class.
-     */
-    template <class Alloc>
-    struct Hierarchy_base {
-        //! type that can be used as base class for the representation type.
-        typedef Reference_counted_hierarchy_with_union<Alloc> Type;
-    };
-    
-    /*! \brief unifies the representations of the two handles \a h and \a g.
-        Performs union.
-        \pre The representations represent the same value and one can be 
-        replaced by the other. The handles \a h and \a g are already
-        the representatives found by the find operation and \a h is not
-        equal to \a g. The tree representing the union of \a h has size
-        not smaller than the corresponding tree size of \a g.
-    */
-    template <class H>
-    static void unify_large_small( const H& h, const H& g) {
-        typename H::Rep* hrep = h.ptr_;
-        typename H::Rep* grep = g.ptr_;
-        CGAL_precondition( ! grep->is_forwarding());
-        CGAL_precondition( hrep->union_size() >= grep->union_size());
-        grep->add_union_size(-1);
-        // make g point to h's rep.
-        if ( grep->is_shared()) {
-            // grep survises the loss of one reference 
-            // and hrep gets one more reference
-            grep->remove_reference();
-            hrep->add_reference();
-            hrep->add_union_size( grep->union_size());
-            grep->next = hrep;
-        } else {
-            g.delete_rep( grep); // did not survive loss of handle g
-        }
-        // redirect handle g and incr. hrep's counter
-        g.ptr_ = hrep;
-        hrep->add_reference();
-        hrep->add_union_size(1);
-    }
-
-    /*! \brief unifies the representations of the two handles \a h and \a g.
-        Performs union with path compression.
-        \pre The representations represent the same value and one can be 
-        replaced by the other.
-    */
-    template <class H>
-    static void unify( const H& h, const H& g) {
-        if ( find(h) !=  find(g)) {
-            if ( h.ptr_->union_size() > g.ptr_->union_size())
-                unify_large_small( h, g); // make g point to h's rep.
-            else
-                unify_large_small( g, h); // make h point to g's rep.
-        }
-    }
-
-    /*! \brief finds the currently valid representation for the handle \a h
-        and returns a pointer to its stored value of type \a T. Performs
-        path-compression to speed-up later union operations.
-    */
-    template <class H>
-    static typename H::Rep_pointer find( const H& h) {
-        typedef typename H::Rep Rep;
-        if ( h.ptr_->is_forwarding()) {
-            // find new valid representation
-            Rep* new_rep = h.ptr_;
-            while ( new_rep->next != 0)
-                new_rep = static_cast<Rep*>(new_rep->next);
-            // path compression: assign new rep to all reps seen on the path
-            // update reference count properly: all reps on the path loose
-            // one reference, and the new_rep gains all of them unless
-            // the rep on the path get actually deleted.
-            Rep* rep = h.ptr_;
-            while ( rep != new_rep) {
-                Rep* tmp = static_cast<Rep*>(rep->next);
-                if ( rep->is_shared()) {
-                    // rep survives the loss of one reference 
-                    // and new_rep gets one more reference
-                    rep->remove_reference();
-                    if ( tmp != new_rep) {
-                        // re-link rep to the new_rep
-                        rep->next = new_rep;
-                        new_rep->add_reference();
-                    }
-                } else {
-                    h.delete_rep( rep); // we have to delete the current rep
-		    tmp->remove_reference();
-                }                
-                rep = tmp;
-            }
-            // hook h to new_rep
-            h.ptr_ = new_rep;
-            new_rep->add_reference();
-        }
-        return h.ptr_->base_ptr();
-    }
-};
-
-/*!\brief Policy class for \c Handle_with_policy that implements unifying of
- * identical representations \c T with trees and path compression. 
- * 
- * It also 
- * sets the unused representation immediately to the default constructed
- * representation \c T(), which can help to free memory if the 
- * representation is dynamically allocated and potentially large, e.g.,
- * \c leda::real. This class is a model of the \c HandlePolicy concept.
- */
-class Handle_policy_union_and_reset {
-public:
-    /*!\brief
-     * A rebind mechanism to create the representation type.
-     */
-    template <class T, int hierarchy>
-    struct Rep_bind {
-        //! this default constructor contains some compile-time checks.
-        Rep_bind() {
-	  //Intern::Rep_bind_reference_counted_with_forwarding<T, hierarchy>
-	  //     check;
-	  // (void)check;
-	  (void)Intern::Rep_bind_reference_counted_with_forwarding<T, hierarchy>();
-        }
-        //! the representation type including a reference counter. 
-        //! The handle allocates objects of this type.
-        typedef typename Intern::Rep_bind_reference_counted_with_forwarding<T,
-            hierarchy>::Rep Rep;
-    };
-
-    /*!\brief
-     * A rebind mechanism to access the base class for class hierarchies
-     * of representations. 
-     *
-     * The base classes can be used directly, but this
-     * rebind mechamism allows the implementation of handle-rep classes
-     * that are parameterized with the policy class only and adapt to
-     * the necessary base class.
-     */
-    template <class Alloc>
-    struct Hierarchy_base {
-        //! type that can be used as base class for the representation type.
-        typedef Reference_counted_hierarchy_with_union<Alloc> Type;
-    };
-
-    // abbreviation to re-use its implementation below.
-    typedef Handle_policy_union U;
-
-    /*! \brief unifies the representations of the two handles \a h and \a g.
-        Performs union with path compression and assigns a default
-        constructed value of the representation type \c Rep to the
-        superfluous representation.
-        \pre The representations represent the same value and one can be 
-        replaced by the other.
-    */
-    template <class H>
-    static void unify( const H& h, const H& g) {
-        if ( find(h) !=  find(g)) {
-            if ( h.ptr_->union_size() > g.ptr_->union_size()) {
-                // reset representation in g to default construction of T
-                if ( g.ptr_->is_shared())
-                    g.ptr_->clear();
-                U::unify_large_small( h, g); // make g point to h's rep.
-            } else {
-                // reset representation in h to default construction of T
-                if ( h.ptr_->is_shared())
-                    h.ptr_->clear();
-                U::unify_large_small( g, h); // make h point to g's rep.
-            }
-        }
-    }
-
-    /*! \brief finds the currently valid representation for the handle \a h
-        and returns a pointer to its stored value of type \a T. Performs
-        path-compression to speed-up later union operations.
-    */
-    template <class H>
-    static typename H::Rep_pointer find( const H& h) { return U::find(h); }
-};
-
-
-/*! \brief the base class for handles of reference counted representations of
-    \c T. 
-
-    There are two fundamentally different usages of this base class:
-
-        - with a single representation class. In this case the handle
-          manages allocation and deallocation and the type \c T can
-          be an arbitrary type---the handle adds the necessary reference
-          counter internally.
-
-        - with a hierarchy of representation classes. Type \c T will be 
-          the common base class of this hierarchy and it has to be derived
-          itself from either \c ::CGAL::Reference_counted_hierarchy or
-          \c ::CGAL::Reference_counted_hierarchy_with_union, both parameterized 
-          with an allocator. The allocator in the handle will not be used in 
-          this scenario, since the handle class does not allocate any 
-          representations. Instead, the handle class derived from this handle
-          base class is allocating the different representations with the
-          \c new operator. In this case, the allocator in the base class
-          of \c T is used.
-
-    The handle class distinguishes between these two alternative
-    usages by checking if \c T is derived from one of the two base
-    classes mentioned for the second alternative. If not, it picks the
-    first alternative.
-
-    In the second alternative, the correct base class, \c 
-    ::CGAL::Reference_counted_hierarchy_with_union, has to be used
-    if the policy class is one of \c class Handle_policy_union r \c 
-    Handle_policy_union_and_reset. Otherwise, the other base class can 
-    be used to save space.
-
-    The policy class \c Handle_policy_in_place is incompatible with the class
-    hierarchy for representation classes since the pointer in the
-    handle class would be missing.
-
-    The dependency of the base classes for \c T and the policy classes
-    is also encoded in the policy classes and can be used to write
-    generic handle-rep scheme classes. To do that one can derive \c T
-    from the expressions \c Policy::Hierarchy_base<Alloc>::Type
-    assuming that \c Policy is the handle policy and \c Alloc is the
-    allocator. Btw, the allocator is used as an allocator of character
-    arrays here.
-
-    \see \link Handle Handle for Reference Counting\endlink for 
-    an example for each of the two alternative usages.
-
-    The template parameters are:
-        - \b T: is one of the two following:
-            - an arbitrary type but it must be a model of the
-              \c DefaultConstructible concept if the default constructor
-              of the handle is used.
-            - a type derived from \c Reference_counted_hierarchy<Alloc> or
-              \c Reference_counted_hierarchy_with_union<Alloc> implementing
-              their virtual member function interface, namely a \c clone()
-              function.
-
-        - \b HandlePolicy: a model of the \c HandlePolicy concept or the
-              \c Handle_policy_in_place class template that selects a specialized
-              implementation without reference counting. Has the
-              default \c Handle_policy_no_union.
-
-        - \b Allocator_: a model of the \c Allocator concept,
-          has the default \c CGAL_ALLOCATOR(T).
-
-*/
-template <class T_, 
-          class HandlePolicy = Handle_policy_no_union, 
-          class Allocator_ = CGAL_ALLOCATOR(T_)>
-class Handle_with_policy {
-public:
-
-    //! first template parameter
-    typedef T_ Handled_type;
-
-    //! the handle type itself.
-    typedef Handle_with_policy< Handled_type, HandlePolicy, Allocator_>    Self;
-
-    //! the instantiated model of the \c HandlePolicy concept.
-    typedef HandlePolicy                Handle_policy;
-
-    //! the allocator type.
-    typedef Allocator_                  Allocator;
-
-    enum { is_class_hierarchy  = 
-        ::CGAL::is_same_or_derived< Reference_counted_hierarchy_base, Handled_type>::value };
-        
-    typedef typename Handle_policy::template Rep_bind< Handled_type, is_class_hierarchy > Bind;
-    
-    // instantiate Rep_bind to activate compile time check in there
-    static Bind bind;
-    
-    // Define type that is used for function matching 
-    typedef typename ::boost::mpl::if_c< 
-         is_class_hierarchy, 
-           ::CGAL::Tag_true, 
-           ::CGAL::Tag_false >::type 
-         Class_hierarchy;
-
-    //! the internal representation, i.e., \c T plus a reference count
-    //! (if needed), or just \c T if we derived from the base class to
-    //! support a class hierarchy for the representations.    
-    typedef typename Bind::Rep  Rep;
-
-    typedef typename Rep::Rep_pointer  Rep_pointer;
-
-    typedef typename Allocator_::template rebind<Rep>::other  Rep_allocator;
-
-
-    //! integer type for identifying a representation.
-    typedef std::ptrdiff_t              Id_type;
-
-    friend class Handle_policy_no_union;
-    friend class Handle_policy_union;
-    friend class Handle_policy_union_and_reset;
-private:
-    mutable Rep*  ptr_;
-
-    // We have to distinguish between allocating single representations
-    // and where we have a class hierarchy of representations, where the
-    // user is responsible for allocating the first representations
-    // and we can just \c clone and delete them.
-    static Rep_allocator allocator;
-
-    static Rep* new_rep( const Rep& rep) { 
-        CGAL_static_assertion( !(
-           ::CGAL::is_same_or_derived< Reference_counted_hierarchy_base, Handled_type >::value ));
-        Rep* p = allocator.allocate(1);
-        allocator.construct(p, rep);
-        return p;
-    }
-    static void delete_rep( Rep* p, ::CGAL::Tag_false ) {
-        allocator.destroy( p);
-        allocator.deallocate( p, 1);
-    }
-    static void delete_rep( Rep* p, ::CGAL::Tag_true ) {
-        delete p;
-    }
-    static void delete_rep( Rep* p) { delete_rep(p, Class_hierarchy()); }
-
-    static Rep* clone_rep( Rep* p, ::CGAL::Tag_false ) {
-        return new_rep( *p);
-    }
-    static Rep* clone_rep( Rep* p, ::CGAL::Tag_true ) {
-        return static_cast<Rep*>(p->clone());
-    }
-    static Rep* clone_rep( Rep* p) { return clone_rep( p, Class_hierarchy()); }
-
-    void remove_reference() {
-        // cleans up the possible chain of forwarding reps
-        Handle_policy::find( *this);
-        if ( ! is_shared()) {
-            delete_rep( ptr_);
-        } else {
-            ptr_->remove_reference();
-            ptr_->add_union_size( -1);
-        }
-    }
-
-    template <class TT>
-    Rep* make_from_single_arg( const TT& t, ::CGAL::Tag_false ) {
-        return new_rep( Rep( Handled_type(t)));
-    }
-    template <class TT>
-    Rep* make_from_single_arg( TT t, ::CGAL::Tag_true ) {
-      //Bind bind_; // trigger compile-time check
-      // (void)bind_;
-      (void)Bind(); // shouldn't this be enough to trigger?
-        return t; // has to be a pointer convertible to Rep*
-    }
-
-protected:
-    //! protected access to the stored representation
-    Handled_type*       ptr()       { return static_cast<Handled_type*>(Handle_policy::find(*this));}
-    //! protected access to the stored representation
-    const Handled_type* ptr() const { 
-        return static_cast<const Handled_type*>(Handle_policy::find( *this));
-    }
-
-    //! unify two representations. \pre The two representations describe
-    //! the same value  and one can be replaced by the other, i.e., the 
-    //! values are immutable, or protected from changes with \c copy_on_write()
-    //! calls!
-    void unify( const Self& h) const { Handle_policy::unify( *this, h); }
-
-    //! can be called before modifying a shared representation
-    //! to get an own copy of the representation which avoids effecting the
-    //! other sharing handles. Does nothing if representation is actually
-    //! not shared.
-    void copy_on_write() {
-        Handle_policy::find( *this);
-        if ( is_shared() ) {
-            Rep* tmp_ptr = clone_rep( ptr_);
-            ptr_->remove_reference();
-            ptr_->add_union_size( -1);
-            ptr_ = tmp_ptr;
-        }
-    }
-
-    //! used with special protected constructor
-    enum Use_with_initialize_with {
-        USE_WITH_INITIALIZE_WITH //!< used with special protected constructor
-                                 //!< of \c Handle_with_policy.
-    };
-
-    //! special constructor, postpones the construction of the representation
-    //! to one of the \c initialize_with() functions. An object is in an
-    //! invalid state (and will report a failed precondition later) if
-    //! it is not initialized with an \c initialize_with() function call
-    //! after this constructor. Applicable for single representation but 
-    //! also for a class hierarchy of representations.
-    Handle_with_policy( Use_with_initialize_with) : ptr_( 0) {}
-
-    //! constructor used for class hierarchies of representations, where
-    //! the handle class derived from this handle creates the different 
-    //! representations itself with the \c new operator. Except for this
-    //! constructor, the the one with the \c Use_with_initialize_with
-    //! argument, and the single argument template constructor no other 
-    //! constructor will work for class hierarchies of representations.
-    Handle_with_policy( Rep* p) : ptr_( p) {
-        CGAL_static_assertion((
-           ::CGAL::is_same_or_derived< Reference_counted_hierarchy_base, Handled_type >::value ));
-        //Bind bind_; // trigger compile-time check
-        //(void)bind_;
-	(void)Bind();
-    }
-
-    //! initializes the representation after the constructor from 
-    //! \c USE_WITH_INITIALIZE_WITH has been used. Applicable for a
-    //! class hierarchy of representations only, where the derived handle class
-    //! created the representation \c p with the \c new operator. No other
-    //! version of \c initialize_with is applicable in this case except
-    //! the template version with one argument.
-    void initialize_with( Rep* p) {
-        CGAL_static_assertion((
-           ::CGAL::is_same_or_derived< Reference_counted_hierarchy_base, Handled_type >::value ));
-        //Bind bind_; // trigger compile-time check
-        //(void)bind_;
-	(void)Bind();
-        CGAL_precondition_msg( ptr_ == 0, "Handle_with_policy::initialize_with(): the "
-                         "representation has already been initialized.");
-        ptr_ = p;
-    }
-
-    //! initializes the representation after the constructor from 
-    //! \c USE_WITH_INITIALIZE_WITH has been used.
-    //! In case of the class hierarchy of representation classes,
-    //! this function is also chosen for pointers to newly allocated
-    //! representations that are types derived from \c T. In that case,
-    //! the pointer is just assigned to the internal pointer.
-    template <class T1>
-    void initialize_with( const T1& t1) {
-        CGAL_precondition_msg( ptr_ == 0, "Handle_with_policy::initialize_with(): the "
-                         "representation has already been initialized.");
-        ptr_ = make_from_single_arg( t1, Class_hierarchy());
-    }
-
-    //! initializes the representation after the constructor from 
-    //! \c USE_WITH_INITIALIZE_WITH has been used.
-    template <class T1, class T2>
-    void initialize_with( const T1& t1, const T2& t2) {
-        CGAL_precondition_msg( ptr_ == 0, "Handle_with_policy::initialize_with(): the "
-                         "representation has already been initialized.");
-        ptr_ = new_rep( Rep( Handled_type(t1,t2)));
-    }
-
-    //! initializes the representation after the constructor from 
-    //! \c USE_WITH_INITIALIZE_WITH has been used.
-    template <class T1, class T2, class T3>
-    void initialize_with( const T1& t1, const T2& t2, const T3& t3) {
-        CGAL_precondition_msg( ptr_ == 0, "Handle_with_policy::initialize_with(): the "
-                         "representation has already been initialized.");
-        ptr_ = new_rep( Rep( Handled_type(t1,t2,t3)));
-    }
-
-    //! initializes the representation after the constructor from 
-    //! \c USE_WITH_INITIALIZE_WITH has been used.
-    template <class T1, class T2, class T3, class T4>
-    void initialize_with( const T1& t1, const T2& t2, const T3& t3,
-                          const T4& t4) {
-        CGAL_precondition_msg( ptr_ == 0, "Handle_with_policy::initialize_with(): the "
-                         "representation has already been initialized.");
-        ptr_ = new_rep( Rep( Handled_type(t1,t2,t3,t4)));
-    }
-
-    //! initializes the representation after the constructor from 
-    //! \c USE_WITH_INITIALIZE_WITH has been used.
-    template <class T1, class T2, class T3, class T4, class T5>
-    void initialize_with( const T1& t1, const T2& t2, const T3& t3,
-                          const T4& t4, const T5& t5) {
-        CGAL_precondition_msg( ptr_ == 0, "Handle_with_policy::initialize_with(): the "
-                         "representation has already been initialized.");
-        ptr_ = new_rep( Rep( Handled_type(t1,t2,t3,t4,t5)));
-    }
-
-    //! initializes the representation after the constructor from 
-    //! \c USE_WITH_INITIALIZE_WITH has been used.
-    template <class T1, class T2, class T3, class T4, class T5, class T6>
-    void initialize_with( const T1& t1, const T2& t2, const T3& t3,
-                          const T4& t4, const T5& t5, const T6& t6) {
-        CGAL_precondition_msg( ptr_ == 0, "Handle_with_policy::initialize_with(): the "
-                         "representation has already been initialized.");
-        ptr_ = new_rep( Rep( Handled_type(t1,t2,t3,t4,t5,t6)));
-    }
-
-    //! initializes the representation after the constructor from 
-    //! \c USE_WITH_INITIALIZE_WITH has been used.
-    template <class T1, class T2, class T3, class T4, class T5, class T6,
-              class T7>
-    void initialize_with( const T1& t1, const T2& t2, const T3& t3,
-                          const T4& t4, const T5& t5, const T6& t6,
-                          const T7& t7) {
-        CGAL_precondition_msg( ptr_ == 0, "Handle_with_policy::initialize_with(): the "
-                         "representation has already been initialized.");
-        ptr_ = new_rep( Rep( Handled_type(t1,t2,t3,t4,t5,t6,t7)));
-    }
-
-    //! initializes the representation after the constructor from 
-    //! \c USE_WITH_INITIALIZE_WITH has been used.
-    template <class T1, class T2, class T3, class T4, class T5, class T6,
-              class T7, class T8>
-    void initialize_with( const T1& t1, const T2& t2, const T3& t3,
-                          const T4& t4, const T5& t5, const T6& t6,
-                          const T7& t7, const T8& t8) {
-        CGAL_precondition_msg( ptr_ == 0, "Handle_with_policy::initialize_with(): the "
-                         "representation has already been initialized.");
-        ptr_ = new_rep( Rep( Handled_type(t1,t2,t3,t4,t5,t6,t7,t8)));
-    }
-
-    //! initializes the representation after the constructor from 
-    //! \c USE_WITH_INITIALIZE_WITH has been used.
-    template <class T1, class T2, class T3, class T4, class T5, class T6,
-              class T7, class T8, class T9>
-    void initialize_with( const T1& t1, const T2& t2, const T3& t3,
-                          const T4& t4, const T5& t5, const T6& t6,
-                          const T7& t7, const T8& t8, const T9& t9) {
-        CGAL_precondition_msg( ptr_ == 0, "Handle_with_policy::initialize_with(): the "
-                         "representation has already been initialized.");
-        ptr_ = new_rep( Rep( Handled_type(t1,t2,t3,t4,t5,t6,t7,t8,t9)));
-    }
-
-public:
-    //! default constructor.
-    Handle_with_policy() : ptr_( new_rep( Rep())) {}
-
-    //! copy constructor, increments reference count.
-    Handle_with_policy(const Self& h) {
-        CGAL_precondition_msg( h.ptr_ != 0, "Handle_with_policy::Handle_with_policy( Self): probably "
-                         "used special protected constructor and not the "
-                         "'initialize_with()' function.");
-        Handle_policy::find( h);
-        ptr_ = h.ptr_;
-        ptr_->add_reference();
-        ptr_->add_union_size( 1);
-    }
-
-    //! forwarding constructor passing its parameter to the representation
-    //! constructor. In case of the class hierarchy of representation classes,
-    //! this constructor is also chosen for pointers to newly allocated
-    //! representations that are types derived from \c T. In that case,
-    //! the pointer is just assigned to the internal pointer.
-    template <class T1>
-    explicit Handle_with_policy( const T1& t) 
-        : ptr_( make_from_single_arg( t, Class_hierarchy())) {}
-
-    //! forwarding constructor passing its parameters to the representation
-    //! constructor.
-    template <class T1, class T2>
-    Handle_with_policy( const T1& t1, const T2& t2) : ptr_( new_rep( Rep( Handled_type( t1, t2)))) {}
-
-    //! forwarding constructor passing its parameters to the representation
-    //! constructor.
-    template <class T1, class T2, class T3>
-    Handle_with_policy( const T1& t1, const T2& t2, const T3& t3) 
-        : ptr_( new_rep( Rep( Handled_type( t1, t2, t3)))) {}
-
-    //! forwarding constructor passing its parameters to the representation
-    //! constructor.
-    template <class T1, class T2, class T3, class T4>
-    Handle_with_policy( const T1& t1, const T2& t2, const T3& t3, const T4& t4) 
-        : ptr_( new_rep( Rep( Handled_type( t1, t2, t3, t4)))) {}
-
-    //! forwarding constructor passing its parameters to the representation
-    //! constructor.
-    template <class T1, class T2, class T3, class T4, class T5>
-    Handle_with_policy( const T1& t1, const T2& t2, const T3& t3, const T4& t4,
-            const T5& t5) 
-        : ptr_( new_rep( Rep( Handled_type( t1, t2, t3, t4, t5)))) {}
-
-    //! forwarding constructor passing its parameters to the representation
-    //! constructor.
-    template <class T1, class T2, class T3, class T4, class T5, class T6>
-    Handle_with_policy( const T1& t1, const T2& t2, const T3& t3, const T4& t4,
-            const T5& t5, const T6& t6) 
-        : ptr_( new_rep( Rep( Handled_type( t1, t2, t3, t4, t5, t6)))) {}
-
-    //! forwarding constructor passing its parameters to the representation
-    //! constructor.
-    template <class T1, class T2, class T3, class T4, class T5, class T6, 
-              class T7>
-    Handle_with_policy( const T1& t1, const T2& t2, const T3& t3, const T4& t4,
-            const T5& t5, const T6& t6, const T7& t7) 
-        : ptr_( new_rep( Rep( Handled_type( t1, t2, t3, t4, t5, t6, t7)))) {}
-
-    //! forwarding constructor passing its parameters to the representation
-    //! constructor.
-    template <class T1, class T2, class T3, class T4, class T5, class T6, 
-              class T7, class T8>
-    Handle_with_policy( const T1& t1, const T2& t2, const T3& t3, const T4& t4,
-            const T5& t5, const T6& t6, const T7& t7, const T8& t8) 
-        : ptr_( new_rep( Rep( Handled_type( t1, t2, t3, t4, t5, t6, t7, t8)))) {}
-
-    //! forwarding constructor passing its parameters to the representation
-    //! constructor.
-    template <class T1, class T2, class T3, class T4, class T5, class T6, 
-              class T7, class T8, class T9>
-    Handle_with_policy( const T1& t1, const T2& t2, const T3& t3, const T4& t4,
-            const T5& t5, const T6& t6, const T7& t7, const T8& t8,
-            const T9& t9) 
-        : ptr_( new_rep( Rep( Handled_type( t1, t2, t3, t4, t5, t6, t7, t8, t9)))) {}
-
-    //! destructor, decrements reference count.
-    ~Handle_with_policy() {
-      //Bind bind_; // trigger compile-time check
-      //(void)bind_;
-      (void)Bind();
-        CGAL_precondition_msg( ptr_ != 0, "Handle_with_policy::~Handle_with_policy(): probably used "
-                         "special protected constructor and not the "
-                         "'initialize_with()' function.");
-        remove_reference();
-    }
-
-    //! assignment, updates reference count correspondingly.
-    Self& operator=( const Self& h) {
-        CGAL_precondition_msg( h.ptr_ != 0, "Handle_with_policy::operator=(): probably "
-                         "used special protected constructor and not the "
-                         "'initialize_with()' function.");
-        Handle_policy::find( h);
-        h.ptr_->add_reference();
-        h.ptr_->add_union_size( 1);
-        remove_reference();
-        ptr_ = h.ptr_;
-        return *this;
-    }
-
-    //! returns \c true if both share the same representation.
-    bool is_identical( const Self& h) const { return ptr() == h.ptr(); }
-
-    //! returns a unique id value. Two handles share their representation
-    //! is their id values are identical.
-    Id_type id() const { return reinterpret_cast<Id_type>(&*ptr()); }
-
-    //! returns true if the representation is shared, i.e., the reference
-    //! counter is greater than one.
-    bool is_shared() const { return ptr_->is_shared(); }
-
-    //! returns \c true if the representation is actually forwarding to
-    //! another equivalent representation (happens only with the
-    //! union-find policies).
-    bool is_forwarding() const { return ptr_->is_forwarding(); }
-
-    //! returns the size of the union set including all reference counts that
-    //! have been accumulated so far for this representation.
-    int  union_size() const { return ptr_->union_size(); }
-
-    // backwards compatible
-    bool identical( const Self& h) const { return is_identical(h); }
-
-#ifdef CGAL_HANDLE_WITH_POLICY_INTERNAL_TEST
-    // provide access to pointer for testing only!!
-    const Rep* test_ptr() const { return ptr_; }
-    // provide access to pointer for testing only!!
-    bool test_identical_ptr( const Self& h) const { return ptr_ == h.ptr_; }
-#endif // CGAL_HANDLE_WITH_POLICY_INTERNAL_TEST
-};
-
-// instantiate Rep_bind to activate compile time check in there
-template <class T, class Policy, class Alloc>
-typename Handle_with_policy<T,Policy,Alloc>::Bind Handle_with_policy<T,Policy,Alloc>::bind;
-
-
-//! alternative syntax for \c h.id() to allow use with LEDA
-/*! This is only provided for \c Handle_policy_no_union because
- *  ID numbers have to be fixed throughout an object's lifetime.
- */
-template <class T, class A>
-typename Handle_with_policy<T, Handle_policy_no_union, A>::Id_type
-ID_Number(const Handle_with_policy<T, Handle_policy_no_union, A>& h)
-    { return h.id(); }
-
-template <class T, class Policy, class Alloc>
-typename Handle_with_policy<T, Policy, Alloc>::Rep_allocator 
-    Handle_with_policy<T, Policy, Alloc>::allocator;
-
-
-/*! \brief specialization of the base class for handles for non-reference
-    counted representations.
-    Uses \c LEDA_MEMORY if available.
-*/
-template <class T_, class Allocator_>
-class Handle_with_policy<T_, Handle_policy_in_place, Allocator_> {
-public:
-
-    //! first template paramter
-    typedef T_ Handled_type;
-
-    //! the handle type itself.
-    typedef Handle_with_policy< Handled_type, Handle_policy_in_place, Allocator_>   Self;
-
-    //! the model of the \c HandlePolicy concept.
-    typedef Handle_policy_in_place                           Handle_policy;
-
-    //! the allocator type.
-    typedef Allocator_                                Allocator;
-
-    //! identify \c T with the internal representation \c Rep.
-    typedef Handled_type                              Rep;
-
-    //! integer type for identifying a representation.
-    typedef std::ptrdiff_t                            Id_type;
-private:
-    // store the rep in place
-    Rep  rep;
-
-protected:
-    //! protected access to the stored representation
-    Handled_type*       ptr()       { return &rep; }
-    //! protected access to the stored representation
-    const Handled_type* ptr() const { return &rep; }
-
-    //! unify two representations, a null op here.
-    void unify( const Self&) const {}
-
-    //! can be called before modifying a shared representation
-    //! to get an own copy of the representation, a null op here.
-    void copy_on_write() {}
-
-    //! used with special protected constructor
-    enum Use_with_initialize_with {
-        USE_WITH_INITIALIZE_WITH //!< used with special protected constructor
-    };
-
-    //! special constructor, postpones the construction of the representation
-    //! to one of the \c initialize_with() functions. Requires default
-    //! constructor for \c T.
-    Handle_with_policy( Use_with_initialize_with) {}
-    
-    //! initializes the representation after the constructor from 
-    //! \c USE_WITH_INITIALIZE_WITH has been used.
-    template <class T1>
-    void initialize_with( const T1& t1) { rep = Rep(t1); }
-
-    //! initializes the representation after the constructor from 
-    //! \c USE_WITH_INITIALIZE_WITH has been used.
-    template <class T1, class T2>
-    void initialize_with( const T1& t1, const T2& t2) { rep = Rep(t1,t2); }
-
-    //! initializes the representation after the constructor from 
-    //! \c USE_WITH_INITIALIZE_WITH has been used.
-    template <class T1, class T2, class T3>
-    void initialize_with( const T1& t1, const T2& t2, const T3& t3) {
-        rep = Rep(t1,t2,t3);
-    }
-
-    //! initializes the representation after the constructor from 
-    //! \c USE_WITH_INITIALIZE_WITH has been used.
-    template <class T1, class T2, class T3, class T4>
-    void initialize_with( const T1& t1, const T2& t2, const T3& t3,
-                          const T4& t4) {
-        rep = Rep(t1,t2,t3,t4);
-    }
-
-    //! initializes the representation after the constructor from 
-    //! \c USE_WITH_INITIALIZE_WITH has been used.
-    template <class T1, class T2, class T3, class T4, class T5>
-    void initialize_with( const T1& t1, const T2& t2, const T3& t3,
-                          const T4& t4, const T5& t5) {
-        rep = Rep(t1,t2,t3,t4,t5);
-    }
-
-    //! initializes the representation after the constructor from 
-    //! \c USE_WITH_INITIALIZE_WITH has been used.
-    template <class T1, class T2, class T3, class T4, class T5, class T6>
-    void initialize_with( const T1& t1, const T2& t2, const T3& t3,
-                          const T4& t4, const T5& t5, const T6& t6) {
-        rep = Rep(t1,t2,t3,t4,t5,t6);
-    }
-
-    //! initializes the representation after the constructor from 
-    //! \c USE_WITH_INITIALIZE_WITH has been used.
-    template <class T1, class T2, class T3, class T4, class T5, class T6,
-              class T7>
-    void initialize_with( const T1& t1, const T2& t2, const T3& t3,
-                          const T4& t4, const T5& t5, const T6& t6,
-                          const T7& t7) {
-        rep = Rep(t1,t2,t3,t4,t5,t6,t7);
-    }
-
-    //! initializes the representation after the constructor from 
-    //! \c USE_WITH_INITIALIZE_WITH has been used.
-    template <class T1, class T2, class T3, class T4, class T5, class T6,
-              class T7, class T8>
-    void initialize_with( const T1& t1, const T2& t2, const T3& t3,
-                          const T4& t4, const T5& t5, const T6& t6,
-                          const T7& t7, const T8& t8) {
-        rep = Rep(t1,t2,t3,t4,t5,t6,t7,t8);
-    }
-
-    //! initializes the representation after the constructor from 
-    //! \c USE_WITH_INITIALIZE_WITH has been used.
-    template <class T1, class T2, class T3, class T4, class T5, class T6,
-              class T7, class T8, class T9>
-    void initialize_with( const T1& t1, const T2& t2, const T3& t3,
-                          const T4& t4, const T5& t5, const T6& t6,
-                          const T7& t7, const T8& t8, const T9& t9) {
-        rep = Rep(t1,t2,t3,t4,t5,t6,t7,t8,t9);
-    }
-
-public:
-    //! default constructor.
-    Handle_with_policy() {}
-
-    //! copy constructor.
-    Handle_with_policy(const Self& h) : rep( h.rep) {}
-
-    //! forwarding constructor passing its parameter to the representation
-    //! constructor.
-    template <class T1>
-    explicit Handle_with_policy( const T1& t) : rep( Rep(t)) {}
-
-    //! forwarding constructor passing its parameters to the representation
-    //! constructor.
-    template <class T1, class T2>
-    Handle_with_policy( const T1& t1, const T2& t2) : rep( Rep(t1,t2)) {}
-
-    //! forwarding constructor passing its parameters to the representation
-    //! constructor.
-    template <class T1, class T2, class T3>
-    Handle_with_policy( const T1& t1, const T2& t2, const T3& t3) : rep( Rep(t1,t2,t3)) {}
-
-    //! forwarding constructor passing its parameters to the representation
-    //! constructor.
-    template <class T1, class T2, class T3, class T4>
-    Handle_with_policy( const T1& t1, const T2& t2, const T3& t3, const T4& t4) 
-        : rep( Rep( t1, t2, t3, t4)) {}
-
-    //! forwarding constructor passing its parameters to the representation
-    //! constructor.
-    template <class T1, class T2, class T3, class T4, class T5>
-    Handle_with_policy( const T1& t1, const T2& t2, const T3& t3, const T4& t4,
-            const T5& t5) 
-        : rep( Rep( t1, t2, t3, t4, t5)) {}
-
-    //! forwarding constructor passing its parameters to the representation
-    //! constructor.
-    template <class T1, class T2, class T3, class T4, class T5, class T6>
-    Handle_with_policy( const T1& t1, const T2& t2, const T3& t3, const T4& t4,
-            const T5& t5, const T6& t6) 
-        : rep( Rep( t1, t2, t3, t4, t5, t6)) {}
-
-    //! forwarding constructor passing its parameters to the representation
-    //! constructor.
-    template <class T1, class T2, class T3, class T4, class T5, class T6, 
-              class T7>
-    Handle_with_policy( const T1& t1, const T2& t2, const T3& t3, const T4& t4,
-            const T5& t5, const T6& t6, const T7& t7) 
-        : rep( Rep( t1, t2, t3, t4, t5, t6, t7)) {}
-
-    //! forwarding constructor passing its parameters to the representation
-    //! constructor.
-    template <class T1, class T2, class T3, class T4, class T5, class T6, 
-              class T7, class T8>
-    Handle_with_policy( const T1& t1, const T2& t2, const T3& t3, const T4& t4,
-            const T5& t5, const T6& t6, const T7& t7, const T8& t8) 
-        : rep( Rep( t1, t2, t3, t4, t5, t6, t7, t8)) {}
-
-    //! forwarding constructor passing its parameters to the representation
-    //! constructor.
-    template <class T1, class T2, class T3, class T4, class T5, class T6, 
-              class T7, class T8, class T9>
-    Handle_with_policy( const T1& t1, const T2& t2, const T3& t3, const T4& t4,
-            const T5& t5, const T6& t6, const T7& t7, const T8& t8,
-            const T9& t9) 
-        : rep( Rep( t1, t2, t3, t4, t5, t6, t7, t8, t9)) {}
-
-    //! returns \c true if both share the same representation.
-    bool is_identical( const Self& h) const { return this == &h; }
-
-    //! returns a unique id value. Two handles share their representation
-    //! is their id values are identical.
-    Id_type id() const { return ptr() - static_cast<Handled_type const*>(0); }
-
-    //! returns \c false since the representation is not shared for
-    //! this specialization.
-    bool is_shared() const { return false; }
-
-    //! returns \c false since the representation is not forwarding for
-    //! this specialization.
-    bool is_forwarding() const { return false; }
-
-    //! returns \c 1 as the union size for this specialization.
-    int  union_size() const { return 1; }
-
-    // backwards compatible
-    bool identical( const Self& h) const { return is_identical(h); }
-
-#ifdef CGAL_HANDLE_WITH_POLICY_INTERNAL_TEST
-    // provide access to pointer for testing only!!
-    const Rep* test_ptr() const { return *rep; }
-    // provide access to pointer for testing only!!
-    bool test_identical_ptr( const Self& h) const { return this == &h; }
-#endif // CGAL_HANDLE_WITH_POLICY_INTERNAL_TEST
-
-#ifdef CGAL_USE_LEDA
-    LEDA_MEMORY( Self)
-#endif
-};
-
-template <class T, class HandlePolicy, class Allocator>
-inline bool identical(const Handle_with_policy<T,HandlePolicy,Allocator> &h1, const Handle_with_policy<T,HandlePolicy,Allocator> &h2) { return h1.is_identical(h2); }
-
-
-/*\brief
- * This class' function call operator test whether one handle's \c id is
- * less than the \c id of the other handle.
- *
- * "Less" is defined in terms of the second template argument,
- * which defaults to \c std::less<Handle::Id_type>
- */
-template <class Handle, class Less = std::less<typename Handle::Id_type> >
-class Handle_id_less_than {
-public:
-    //! result_type
-    typedef bool result_type;
-    //! type of first argument
-    typedef Handle first_argument_type;
-    //! type of second argument
-    typedef Handle second_argument_type;
-    //! returns \c true iff \c h1.id() < \c h2.id()
-    bool operator () (Handle h1, Handle h2) {
-        Less is_less;
-        return is_less(h1.id(), h2.id());
-    }
-    //! returns \c true iff \c h1.id() < \c h2.id()
-    bool operator () (Handle h1, Handle h2) const {
-        Less is_less;
-        return is_less(h1.id(), h2.id());
-    }
-};
-
-
-//@}
-
-} //namespace CGAL
-
-#endif // CGAL_HANDLE_WITH_POLICY_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Color.h b/3rdparty/CGAL-4.8/include/CGAL/IO/Color.h
deleted file mode 100644
index 2696ce8..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/IO/Color.h
+++ /dev/null
@@ -1,104 +0,0 @@
-// Copyright (c) 1997
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Andreas Fabri
-
-#include <CGAL/config.h>
-
-#ifndef CGAL_COLOR_H
-#define CGAL_COLOR_H
-
-namespace CGAL {
-
-class Color {
-public:
-  Color() {}
-  Color(unsigned char red,
-	unsigned char green,
-	unsigned char blue,
-	unsigned char alpha = 120)
-    : _red(red), _green(green), _blue(blue), _alpha(alpha)
-  {}
-
-  unsigned char r() const {return _red;}
-  unsigned char g() const {return _green;}
-  unsigned char b() const {return _blue;}
-
-  unsigned char red() const {return _red;}
-  unsigned char green() const {return _green;}
-  unsigned char blue() const {return _blue;}
-  unsigned char alpha() const {return _alpha;}
-  void set_alpha(unsigned char a) {_alpha=a;}
-  bool operator==(const Color &c) const
-  {
-    return ( (red() == c.red()) &&
-             (green() == c.green()) &&
-             (blue() == c.blue()) );
-  }
-
-  bool operator!=(const Color &c) const
-  {
-    return !( (*this) == c);
-  }
-
-  Color& operator=(const Color &c)
-  {
-    _red = c.red();
-    _green = c.green();
-    _blue = c.blue();
-    _alpha = c.alpha();
-    return *this;
-  }
-
-private:
-  unsigned char _red;
-  unsigned char _green;
-  unsigned char _blue;
-  unsigned char _alpha;
-};
-
-#ifndef CGAL_HEADER_ONLY
-
-CGAL_EXPORT extern const Color BLACK  ;
-CGAL_EXPORT extern const Color WHITE  ;
-CGAL_EXPORT extern const Color GRAY   ;
-
-CGAL_EXPORT extern const Color RED    ;
-CGAL_EXPORT extern const Color GREEN  ;
-
-CGAL_EXPORT extern const Color DEEPBLUE;
-CGAL_EXPORT extern const Color BLUE   ;
-CGAL_EXPORT extern const Color PURPLE ;
-CGAL_EXPORT extern const Color VIOLET ;
-
-CGAL_EXPORT extern const Color ORANGE ;
-CGAL_EXPORT extern const Color YELLOW ;
-
-#endif // CGAL_HEADER_ONLY
-
-} //namespace CGAL
-
-#ifdef CGAL_HEADER_ONLY
-#include <CGAL/IO/Color_impl.h>
-#endif // CGAL_HEADER_ONLY
-
-#endif  // CGAL_COLOR_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/File_binary_mesh_3.h b/3rdparty/CGAL-4.8/include/CGAL/IO/File_binary_mesh_3.h
deleted file mode 100644
index 060c5ec..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/IO/File_binary_mesh_3.h
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright (c) 2012  GeometryFactory Sarl (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
-// 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(s)     : Laurent Rineau
-
-#ifndef CGAL_IO_FILE_BINARY_MESH_3_H
-#define CGAL_IO_FILE_BINARY_MESH_3_H
-
-#include <iostream>
-#include <string>
-#include <CGAL/Mesh_3/io_signature.h>
-
-namespace CGAL {
-
-namespace Mesh_3 {
-
-template <class C3T3>
-bool
-save_binary_file(std::ostream& os,
-                 const C3T3& c3t3)
-{
-  os << "binary CGAL c3t3 " << CGAL::Get_io_signature<C3T3>()() << "\n";
-  CGAL::set_binary_mode(os);
-  return !!(os << c3t3);
-  // call operator!() twice, because operator bool() is C++11
-}
-
-template <class C3T3>
-bool load_binary_file(std::istream& is, C3T3& c3t3)
-{
-  std::string s;
-  is >> s;
-  if (s != "binary" ||
-      !(is >> s) ||
-      s != "CGAL" ||
-      !(is >> s) ||
-      s != "c3t3") 
-  {
-    return false;
-  }
-  std::getline(is, s);
-  if(s != "") {
-    if(s != std::string(" ") + CGAL::Get_io_signature<C3T3>()()) {
-      std::cerr << "load_binary_file:"
-                << "\n  expected format: " << CGAL::Get_io_signature<C3T3>()()
-                << "\n       got format:" << s << std::endl;
-      return false;
-    }
-  }
-  CGAL::set_binary_mode(is);
-  is >> c3t3;
-  return !!is;
-  // call operator!() twice, because operator bool() is C++11
-}
-
-} // end namespace Mesh_3
-} // end namespace CGAL
-
-#endif // CGAL_IO_FILE_BINARY_MESH_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/File_header_OFF_impl.h b/3rdparty/CGAL-4.8/include/CGAL/IO/File_header_OFF_impl.h
deleted file mode 100644
index 9ac3e1f..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/IO/File_header_OFF_impl.h
+++ /dev/null
@@ -1,409 +0,0 @@
-// Copyright (c) 1997
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Lutz Kettner  <kettner at mpi-sb.mpg.de>
-
-#ifdef CGAL_HEADER_ONLY
-#define CGAL_INLINE_FUNCTION inline
-#else
-#define CGAL_INLINE_FUNCTION
-#endif
-
-#include <CGAL/basic.h>
-#include <cstdlib>
-#include <cctype>
-#include <cstring>
-#include <iostream>
-#include <CGAL/IO/binary_file_io.h>
-#include <CGAL/IO/File_header_OFF.h>
-#include <algorithm>
-#include <boost/cstdint.hpp>
-
-namespace CGAL {
-
-CGAL_INLINE_FUNCTION
-File_header_OFF::File_header_OFF( bool verbose)
-:   File_header_extended_OFF( verbose),
-    n_vertices(0),
-    n_facets(0),
-    m_skel(false),
-    m_binary(false),
-    m_no_comments(false),
-    m_offset(0),
-    m_colors(false),
-    m_normals(false),
-    m_tag4(false),
-    m_tagDim(false),
-    m_dim(3)
-{}
-CGAL_INLINE_FUNCTION
-File_header_OFF::File_header_OFF(
-                     bool binary, bool noc, bool skel, bool verbose)
-:   File_header_extended_OFF( verbose),
-    n_vertices(0),
-    n_facets(0),
-    m_skel(skel),
-    m_binary(binary),
-    m_no_comments(noc),
-    m_offset(0),
-    m_colors(false),
-    m_normals(false),
-    m_tag4(false),
-    m_tagDim(false),
-    m_dim(3)
-{}
-//CGAL_INLINE_FUNCTION
-//File_header_OFF::File_header_OFF( int v, int h, int f,
-//                                          bool verbose)
-//:   File_header_extended_OFF( verbose),
-//    n_vertices(v),
-//    n_facets(f),
-//    m_skel(false),
-//    m_binary(false),
-//    m_no_comments(false),
-//    m_offset(0),
-//    m_colors(false),
-//    m_normals(false),
-//    m_tag4(false),
-//    m_tagDim(false),
-//    m_dim(3)
-//{
-//    set_halfedges(h);
-//}
-CGAL_INLINE_FUNCTION
-File_header_OFF::File_header_OFF( std::size_t v, std::size_t h, std::size_t f,
-                     bool binary, bool noc, bool skel, bool verbose)
-:   File_header_extended_OFF( verbose),
-    n_vertices(v),
-    n_facets(f),
-    m_skel(skel),
-    m_binary(binary),
-    m_no_comments(noc),
-    m_offset(0),
-    m_colors(false),
-    m_normals(false),
-    m_tag4(false),
-    m_tagDim(false),
-    m_dim(3)
-{
-    set_halfedges(h);
-}
-CGAL_INLINE_FUNCTION
-File_header_OFF::File_header_OFF(
-                     const File_header_extended_OFF& ext_header)
-:   File_header_extended_OFF( ext_header),
-    n_vertices(0),
-    n_facets(0),
-    m_skel(false),
-    m_binary(false),
-    m_no_comments(false),
-    m_offset(0),
-    m_colors(false),
-    m_normals(false),
-    m_tag4(false),
-    m_tagDim(false),
-    m_dim(3)
-{}
-CGAL_INLINE_FUNCTION
-File_header_OFF::File_header_OFF(
-                     const File_header_extended_OFF& ext_header,
-                     bool binary, bool noc, bool skel)
-:   File_header_extended_OFF( ext_header),
-    n_vertices(0),
-    n_facets(0),
-    m_skel(skel),
-    m_binary(binary),
-    m_no_comments(noc),
-    m_offset(0),
-    m_colors(false),
-    m_normals(false),
-    m_tag4(false),
-    m_tagDim(false),
-    m_dim(3)
-{}
-CGAL_INLINE_FUNCTION
-File_header_OFF::File_header_OFF(
-                                 std::size_t v, std::size_t h, std::size_t f,
-                     const File_header_extended_OFF& ext_header)
-:   File_header_extended_OFF( ext_header),
-    n_vertices(v),
-    n_facets(f),
-    m_skel(false),
-    m_binary(false),
-    m_no_comments(false),
-    m_offset(0),
-    m_colors(false),
-    m_normals(false),
-    m_tag4(false),
-    m_tagDim(false),
-    m_dim(3)
-{
-    set_halfedges(h);
-}
-CGAL_INLINE_FUNCTION
-File_header_OFF::File_header_OFF(
-                                 std::size_t v, std::size_t h, std::size_t f,
-                     const File_header_extended_OFF& ext_header,
-                     bool binary, bool noc, bool skel)
-:   File_header_extended_OFF( ext_header),
-    n_vertices(v),
-    n_facets(f),
-    m_skel(skel),
-    m_binary(binary),
-    m_no_comments(noc),
-    m_offset(0),
-    m_colors(false),
-    m_normals(false),
-    m_tag4(false),
-    m_tagDim(false),
-    m_dim(3)
-{
-    set_halfedges(h);
-}
-
-CGAL_INLINE_FUNCTION
-File_header_OFF& File_header_OFF::
-operator+=( const File_header_OFF& header) {
-    (File_header_extended_OFF&)(*this) = header;
-    n_vertices += header.n_vertices;
-    n_facets   += header.n_facets;
-    return *this;
-}
-
-// Write header.
-CGAL_INLINE_FUNCTION
-std::ostream& operator<<( std::ostream& out, const File_header_OFF& h) {
-    if ( h.comments()) {
-        out << "# Output of a CGAL tool\n";
-        out << static_cast<const File_header_extended_OFF&>( h);
-    }
-    if ( h.has_normals())
-        out << 'N';
-    if ( h.skel())
-        out << "SKEL";
-    else
-        out << "OFF";
-    if ( h.binary()) {
-        out << " BINARY\n";
-        I_Binary_write_big_endian_integer32( out, static_cast<int>(h.size_of_vertices()));
-        I_Binary_write_big_endian_integer32( out, static_cast<int>(h.size_of_facets()));
-        if ( h.off())
-            I_Binary_write_big_endian_integer32( out, 0);
-    } else {
-        out << '\n';
-        out << h.size_of_vertices() << ' '<< h.size_of_facets();
-        if ( h.off())
-            out << " 0";
-        if ( h.comments()) {
-            out << "\n\n# " << h.size_of_vertices() << " vertices\n";
-            out << "# ------------------------------------------\n";
-        }
-        out << std::endl;
-    }
-    return out;
-}
-
-// Scan header. Marks streams badbit if not in SKEL format nor in OFF.
-CGAL_INLINE_FUNCTION
-std::istream& operator>>( std::istream& in, File_header_OFF& h) {
-    // read in the first character and scan for comments, `OFF', or `NOFF',
-    // or `SKEL', or `4SKEL'.
-    h.set_off_header( false);
-    char c;
-    while ( (in >> c) && c == '#') {
-        if ( in.get(c) && c == 'C' &&
-             in.get(c) && c == 'B' &&
-             in.get(c) && c == 'P') {
-            in >> static_cast<File_header_extended_OFF&>( h);
-        } else if ( c != '\n')
-            in >> skip_until_EOL;
-    }
-    if ( ! in)
-        return in;
-    h.set_skel( false);
-    h.set_binary( false);
-    h.set_index_offset( 1);
-    h.set_colors( false);
-    h.set_normals( false);
-    h.set_homogeneous( false);
-    h.set_dimensional( false);
-    h.set_dimension( 3);
-
-    const int max_keyword = 42;
-    char keyword[max_keyword] = "";
-    int i = 0;
-    keyword[i++] = c;
-    while( i < max_keyword - 1 && in.get(c) && std::isalnum(c))
-        keyword[i++] = c;
-    keyword[i] = '\0';
-    if ( i < 2 || (std::isdigit(keyword[0]) && keyword[0] != '4')
-               || std::isdigit(keyword[1])) {
-        h.set_vertices( std::atoi( keyword));
-    } else {
-        h.set_index_offset( 0);
-        int j = 0;
-        if ( j < i && keyword[j] == 'C') {
-            h.set_colors( true);
-            j++;
-        }
-        if ( j < i && keyword[j] == 'N') {
-            h.set_normals( true);
-            j++;
-        }
-        if ( j < i && keyword[j] == '4') {
-            h.set_homogeneous( true);
-            j++;
-        }
-        if ( j < i && keyword[j] == 'n') {
-            h.set_dimensional( true);
-            j++;
-        }
-        if ( i-j != 3 || keyword[j]   != 'O'
-                      || keyword[j+1] != 'F'
-                      || keyword[j+2] != 'F') {
-            if ( i-j != 4 || keyword[j]   != 'S'
-                          || keyword[j+1] != 'K'
-                          || keyword[j+2] != 'E'
-                          || keyword[j+3] != 'L') {
-                in.clear( std::ios::badbit);
-                if ( h.verbose()) {
-                    std::cerr << " " << std::endl;
-                    std::cerr << "error: File_header_OFF: "
-                                  "wrong format: neither OFF nor SKEL."
-                              << std::endl;
-                }
-                return in;
-            } else {
-                h.set_skel( true);
-            }
-        }
-        in >> skip_comment_OFF >> c;
-        if ( std::isdigit(c)) {
-            in.putback(c);
-            int n;
-            in >> n;
-            h.set_vertices(n);
-        } else {
-            i = 0;
-            keyword[i++] = c;
-            while( i < max_keyword - 1 && in.get(c) &&
-                   std::isalnum(c))
-                keyword[i++] = c;
-            keyword[i] = '\0';
-            if ( std::strcmp( keyword, "BINARY") == 0) {
-                h.set_binary( true);
-                if ( c != '\n')
-                    in >> skip_until_EOL;
-            } else {
-                in.clear( std::ios::badbit);
-                if ( h.verbose()) {
-                    std::cerr << " " << std::endl;
-                    std::cerr << "error: File_header_OFF(): "
-                                 "wrong format: neither OFF nor SKEL."
-                              << std::endl;
-                }
-                return in;
-            }
-        }
-    }
-    // Read remaining size value(s).
-    int n_h;
-    if ( h.binary()) {
-        boost::int32_t a, b, c;
-        I_Binary_read_big_endian_integer32( in, a);
-        if ( h.n_dimensional()) {
-            h.set_dimension( a);
-            I_Binary_read_big_endian_integer32( in, a);
-        }
-        I_Binary_read_big_endian_integer32( in, b);
-        if ( h.off())
-            I_Binary_read_big_endian_integer32( in, c);
-        else
-            c = 0;
-        h.set_vertices( a);
-        if (b<0){
-          in.clear( std::ios::badbit );
-          if ( h.verbose()) {
-              std::cerr << " " << std::endl;
-              std::cerr << "error: File_header_OFF(): File contains < 0 facets."
-                        << std::endl;
-          }
-          return in;
-        }
-        h.set_facets( b);
-        n_h = c;
-    } else {
-        int n;
-        if ( h.n_dimensional()) {
-            h.set_dimension( static_cast<int>(h.size_of_vertices()));
-            in >> n;
-            h.set_vertices(n);
-        }
-        in >> n;
-        if (n < 0){
-          in.clear( std::ios::badbit );
-          if ( h.verbose()) {
-              std::cerr << " " << std::endl;
-              std::cerr << "error: File_header_OFF(): File contains < 0 facets."
-                        << std::endl;
-          }
-          return in;
-        }
-        h.set_facets(n);
-        if ( h.off())
-            in >> n_h;
-        else
-            n_h = 0;
-    }
-    if ( n_h == 0)
-        h.set_index_offset( 0);
-    if ( ! in || h.size_of_vertices() <= 0 ) {
-        in.clear( std::ios::badbit);
-        if ( h.verbose()) {
-            std::cerr << " " << std::endl;
-            std::cerr << "error: File_header_OFF(): File contains <= 0 vertices."
-                      << std::endl;
-        }
-        return in;
-    }
-    if ( h.size_of_halfedges() == 0) {
-        // be careful, because border edges count twice
-        h.set_halfedges( 2 * n_h);
-        // check against the Eulerian equation for connected planar graphs.
-        // We do not know the number of holes we must represent as dummy
-        // facets and we do not know the genus of the surface.
-        // So we add 12 and a factor of 5 percent.
-        if (    h.size_of_halfedges() == 0
-             || h.size_of_halfedges() > (h.size_of_vertices()
-                + h.size_of_facets() - 2 + 12) * 2.1
-             || h.size_of_halfedges() < (h.size_of_vertices()
-                + h.size_of_facets() - 2) * 2
-        )
-            h.set_halfedges( int((h.size_of_vertices() +
-                                  h.size_of_facets() - 2 + 12) * 2.1));
-    }
-    h.set_off_header( h.off());
-    return in;
-}
-
-} //namespace CGAL
-// EOF //
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/File_medit.h b/3rdparty/CGAL-4.8/include/CGAL/IO/File_medit.h
deleted file mode 100644
index 452fe54..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/IO/File_medit.h
+++ /dev/null
@@ -1,907 +0,0 @@
-// Copyright (c) 2004-2006  INRIA Sophia-Antipolis (France).
-// Copyright (c) 2009  INRIA Sophia-Antipolis (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
-// 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(s)     : Laurent RINEAU, Stephane Tayeb
-
-#ifndef CGAL_IO_FILE_MEDIT_H
-#define CGAL_IO_FILE_MEDIT_H
-
-#include <CGAL/Mesh_3/config.h>
-
-#include <iostream>
-#include <map>
-#include <set>
-#include <vector>
-#include <string>
-#include <CGAL/utility.h>
-
-namespace CGAL {
-
-namespace Mesh_3 {
-
-
-//-------------------------------------------------------
-// Needed in verbose mode
-//-------------------------------------------------------
-#ifdef CGAL_MESH_3_IO_VERBOSE
-template<class T>
-inline
-std::ostream&
-operator<<(std::ostream &os, const std::pair<T,T>& pair)
-{
-  return os << "<" << pair.first << "," << pair.second << ">";
-}
-#endif
-
-// -----------------------------------
-// Rebind_cell_pmap
-// -----------------------------------
-template <typename C3T3>
-class Rebind_cell_pmap
-{
-  typedef typename C3T3::Subdomain_index Subdomain_index;
-  typedef std::map<Subdomain_index,int> Subdomain_map;
-  typedef typename C3T3::Cell_handle Cell_handle;
-  typedef unsigned int size_type;
-
-public:
-  Rebind_cell_pmap(const C3T3& c3t3)
-    : r_c3t3_(c3t3)
-  {
-    typedef typename C3T3::Cells_in_complex_iterator Cell_iterator;
-
-    int first_index = 0;
-    int index_counter = first_index + 1;
-
-    for( Cell_iterator cell_it = r_c3t3_.cells_in_complex_begin();
-         cell_it != r_c3t3_.cells_in_complex_end();
-         ++cell_it)
-    {
-      // Add subdomain index in internal map if needed
-      if ( subdomain_map_.end() ==
-              subdomain_map_.find(r_c3t3_.subdomain_index(cell_it)) )
-      {
-        subdomain_map_.insert(std::make_pair(r_c3t3_.subdomain_index(cell_it),
-                                             index_counter));
-        ++index_counter;
-      }
-    }
-    
-    // Rebind indices in alphanumeric order
-    index_counter = first_index + 1;
-    for ( typename Subdomain_map::iterator mit = subdomain_map_.begin() ;
-          mit != subdomain_map_.end() ;
-          ++mit )
-    {
-      mit->second = index_counter++;
-    }
-
-#ifdef CGAL_MESH_3_IO_VERBOSE
-    std::cerr << "Nb of subdomains: " << subdomain_map_.size() << "\n";
-    std::cerr << "Subdomain mapping:\n\t" ;
-
-    typedef typename Subdomain_map::iterator Subdomain_map_iterator;
-    for ( Subdomain_map_iterator sub_it = subdomain_map_.begin() ;
-          sub_it != subdomain_map_.end() ;
-          ++sub_it )
-    {
-      std::cerr << "[" << (*sub_it).first << ":" << (*sub_it).second << "] ";
-    }
-    std::cerr << "\n";
-#endif
-  }
-
-  int subdomain_index(const Cell_handle& ch) const
-  {
-    return subdomain_index(r_c3t3_.subdomain_index(ch));
-  }
-
-  size_type subdomain_number() const
-  {
-    return subdomain_map_.size();
-  }
-
-private:
-  int subdomain_index(const Subdomain_index& index) const
-  {
-    typedef typename Subdomain_map::const_iterator Smi;
-    Smi elt_it = subdomain_map_.find(index);
-    if ( elt_it != subdomain_map_.end() )
-      return elt_it->second;
-    else
-      return -1;
-  }
-  
-private:
-  const C3T3& r_c3t3_;
-  Subdomain_map subdomain_map_;
-};
-  
-// Accessor  
-template <typename C3T3>
-int
-get(const Rebind_cell_pmap<C3T3>& cmap,
-    const typename C3T3::Cell_handle& ch)
-{
-  return cmap.subdomain_index(ch);
-}
-
-template <typename C3T3>
-unsigned int get_size(const Rebind_cell_pmap<C3T3>& cmap)
-{
-  return cmap.subdomain_number();
-}
-  
-
-// -----------------------------------
-// No_rebind_cell_pmap
-// -----------------------------------
-template <typename C3T3>
-class No_rebind_cell_pmap
-{
-  typedef typename C3T3::Subdomain_index Subdomain_index;
-  typedef typename C3T3::Cell_handle Cell_handle;
-  typedef unsigned int size_type;
-  
-public:
-  No_rebind_cell_pmap(const C3T3& c3t3)
-    : r_c3t3_(c3t3) {}
-  
-  int subdomain_index(const Cell_handle& ch) const
-  {
-    return static_cast<int>(r_c3t3_.subdomain_index(ch));
-  }
-  
-  size_type subdomain_number() const
-  {
-    typedef typename C3T3::Cells_in_complex_iterator Cell_iterator;
-    std::set<Subdomain_index> subdomain_set;
-    
-    for( Cell_iterator cell_it = r_c3t3_.cells_in_complex_begin();
-        cell_it != r_c3t3_.cells_in_complex_end();
-        ++cell_it)
-    {
-      // Add subdomain index in set if new
-      if ( subdomain_set.end() == subdomain_set.find(subdomain_index(cell_it)) )
-      {
-        subdomain_set.insert(subdomain_index(cell_it));
-      }
-    }
-    
-    return subdomain_set.size();
-  }
-  
-private:
-  const C3T3& r_c3t3_;
-};
-  
-// Accessor  
-template <typename C3T3>
-int
-get(const No_rebind_cell_pmap<C3T3>& cmap,
-    const typename C3T3::Cell_handle& ch)
-{
-  return cmap.subdomain_index(ch);
-}
-  
-  
-// -----------------------------------
-// Rebind_facet_pmap
-// -----------------------------------
-template <typename C3T3, typename Cell_pmap>
-class Rebind_facet_pmap
-{
-  typedef typename C3T3::Surface_patch_index Surface_patch_index;
-  typedef std::map<Surface_patch_index,int> Surface_map;
-  typedef typename C3T3::Facet Facet;
-  typedef unsigned int size_type;
-  
-public:
-  Rebind_facet_pmap(const C3T3& c3t3, const Cell_pmap& cell_pmap)
-    : r_c3t3_(c3t3)
-    , cell_pmap_(cell_pmap)
-  {
-    typedef typename C3T3::Facets_in_complex_iterator Facet_iterator;
-    
-    int first_index = 1;
-    int index_counter = first_index;
-    
-    for( Facet_iterator facet_it = r_c3t3_.facets_in_complex_begin();
-        facet_it != r_c3t3_.facets_in_complex_end();
-        ++facet_it)
-    {
-      // Add surface index in internal map if needed
-      if ( surface_map_.end() ==
-          surface_map_.find(c3t3.surface_patch_index((*facet_it).first,
-                                                     (*facet_it).second)) )
-      {
-        surface_map_.insert(std::make_pair(r_c3t3_.surface_patch_index(*facet_it),
-                                           index_counter));
-        ++index_counter;
-      }
-    }
-    
-    // Find cell_pmap_ unused indices
-    typedef typename C3T3::Cells_in_complex_iterator Cell_iterator;
-    std::set<int> cell_label_set;
-    
-    for( Cell_iterator cell_it = r_c3t3_.cells_in_complex_begin();
-        cell_it != r_c3t3_.cells_in_complex_end();
-        ++cell_it)
-    {
-      // Add subdomain index in set if new
-      if ( cell_label_set.end()
-          == cell_label_set.find(get(cell_pmap_,cell_it)) )
-      {
-        cell_label_set.insert(get(cell_pmap_,cell_it));
-      }
-    }
-    
-    // Rebind indices
-    index_counter = get_first_unused_label(cell_label_set,first_index);
-    for ( typename Surface_map::iterator mit = surface_map_.begin() ;
-         mit != surface_map_.end() ;
-         ++mit )
-    {
-      mit->second = index_counter++;
-      index_counter = get_first_unused_label(cell_label_set,index_counter);
-    }
-    
-#ifdef CGAL_MESH_3_IO_VERBOSE
-    std::cerr << "Nb of surface patches: " << surface_map_.size() << "\n";
-    std::cerr << "Surface mapping:\n\t" ;
-    
-    typedef typename Surface_map::iterator Surface_map_iterator;
-    for ( Surface_map_iterator surf_it = surface_map_.begin() ;
-         surf_it != surface_map_.end() ;
-         ++surf_it )
-    {
-      std::cerr << "[" << (*surf_it).first
-      << ":" << (*surf_it).second << "] ";
-    }
-    std::cerr << "\n";
-#endif
-  }
-  
-  int surface_index(const Facet& f) const
-  {
-    return surface_index(r_c3t3_.surface_patch_index(f));
-  }
-  
-  size_type surface_number() const
-  {
-    return surface_map_.size();
-  }
-  
-private:
-  int surface_index(const Surface_patch_index& index) const
-  {
-    typedef typename Surface_map::const_iterator Smi;
-    Smi elt_it = surface_map_.find(index);
-    if ( elt_it != surface_map_.end() )
-      return elt_it->second;
-    else
-      return -1;
-  }
-  
-  int get_first_unused_label(const std::set<int>& label_set,
-                             int search_start) const
-  {
-    while ( label_set.end() != label_set.find(search_start) )
-      ++search_start;
-    
-    return search_start;
-  }
-  
-private:
-  const C3T3& r_c3t3_;
-  const Cell_pmap& cell_pmap_;
-  Surface_map surface_map_;
-};
-
-  
-// Accessors
-template <typename C3T3, typename Cell_pmap>
-int
-get(const Rebind_facet_pmap<C3T3,Cell_pmap>& fmap,
-    const typename C3T3::Facet& f)
-{
-  return fmap.surface_index(f);
-}
-  
-template <typename C3T3, typename Cell_pmap>
-unsigned int
-get_size(const Rebind_facet_pmap<C3T3,Cell_pmap>& fmap,
-         const typename C3T3::Facet& f)
-{
-  return fmap.surface_number(f);
-}
-
-  
-// -----------------------------------
-// No_rebind_facet_pmap
-// -----------------------------------
-template <typename C3T3, typename Cell_pmap>
-class No_rebind_facet_pmap
-{
-  typedef typename C3T3::Surface_patch_index Surface_patch_index;
-  typedef typename C3T3::Facet Facet;
-  typedef unsigned int size_type;
-  
-public:
-  No_rebind_facet_pmap(const C3T3& c3t3, const Cell_pmap& /*cell_pmap*/)
-    : r_c3t3_(c3t3) {}
-
-  int surface_index(const Facet& f) const
-  {
-    return static_cast<int>(r_c3t3_.surface_patch_index(f));
-  }
-  
-private:
-  const C3T3& r_c3t3_;
-};
-
-
-// Accessors
-template <typename C3T3, typename Cell_pmap>
-int
-get(const No_rebind_facet_pmap<C3T3,Cell_pmap>& fmap,
-    const typename C3T3::Facet& f)
-{
-return fmap.surface_index(f);
-}
-
-// -----------------------------------
-// No_rebind_facet_pmap_first
-// -----------------------------------
-template <typename C3T3, typename Cell_pmap>
-class No_rebind_facet_pmap_first
-{
-  typedef typename C3T3::Surface_patch_index Surface_patch_index;
-  typedef typename C3T3::Facet Facet;
-  typedef unsigned int size_type;
-  
-public:
-  No_rebind_facet_pmap_first(const C3T3& c3t3, const Cell_pmap& /*cell_pmap*/)
-    : r_c3t3_(c3t3) {}
-  
-  int surface_index(const Facet& f) const
-  {
-    return static_cast<int>(r_c3t3_.surface_patch_index(f).first);
-  }
-  
-private:
-  const C3T3& r_c3t3_;
-};
-
-
-// Accessors
-template <typename C3T3, typename Cell_pmap>
-int
-get(const No_rebind_facet_pmap_first<C3T3,Cell_pmap>& fmap,
-  const typename C3T3::Facet& f)
-{
-  return fmap.surface_index(f);
-}
-  
-  
-// -----------------------------------
-// No_rebind_facet_pmap_second
-// -----------------------------------
-template <typename C3T3, typename Cell_pmap>
-class No_rebind_facet_pmap_second
-{
-  typedef typename C3T3::Surface_patch_index Surface_patch_index;
-  typedef typename C3T3::Facet Facet;
-  typedef unsigned int size_type;
-  
-public:
-  No_rebind_facet_pmap_second(const C3T3& c3t3, const Cell_pmap& /*cell_pmap*/)
-  : r_c3t3_(c3t3) {}
-  
-  int surface_index(const Facet& f) const
-  {
-    return static_cast<int>(r_c3t3_.surface_patch_index(f).second);
-  }
-  
-private:
-  const C3T3& r_c3t3_;
-};
-
-
-// Accessors
-template <typename C3T3, typename Cell_pmap>
-int
-get(const No_rebind_facet_pmap_second<C3T3,Cell_pmap>& fmap,
-    const typename C3T3::Facet& f)
-{
-  return fmap.surface_index(f);
-}
-  
-  
-  
-// -----------------------------------
-// No_patch_facet_pmap_first
-// -----------------------------------
-template <typename C3T3, typename Cell_pmap>
-class No_patch_facet_pmap_first
-{
-  typedef typename C3T3::Surface_patch_index Surface_patch_index;
-  typedef typename C3T3::Facet Facet;
-  typedef typename C3T3::Cell_handle Cell_handle;
-  
-public:
-  No_patch_facet_pmap_first(const C3T3&, const Cell_pmap& cell_pmap)
-    : cell_pmap_(cell_pmap) { }
-  
-  int surface_index(const Facet& f) const
-  {
-    Cell_handle c1 = f.first;
-    Cell_handle c2 = c1->neighbor(f.second);
-    
-    int label1 = get(cell_pmap_,c1);
-    int label2 = get(cell_pmap_,c2);
-    
-    if ( 0 == label1 || -1 == label1 )
-      label1 = label2;
-    if ( 0 == label2 || -1 == label2 )
-      label2 = label1;
-    
-    return (std::min)(label1,label2);
-  }
-  
-private:
-  const Cell_pmap& cell_pmap_;
-};
-
-// Accessors 
-template <typename C3T3, typename Cell_pmap>
-int
-get(const No_patch_facet_pmap_first<C3T3,Cell_pmap>& fmap,
-    const typename C3T3::Facet& f)
-{
-  return fmap.surface_index(f);
-}
-
-// -----------------------------------
-// No_patch_facet_pmap_second
-// -----------------------------------
-template <typename C3T3, typename Cell_pmap>
-class No_patch_facet_pmap_second
-{
-  typedef typename C3T3::Surface_patch_index Surface_patch_index;
-  typedef typename C3T3::Facet Facet;
-  typedef typename C3T3::Cell_handle Cell_handle;
-  
-public:
-  No_patch_facet_pmap_second(const C3T3&, const Cell_pmap& cell_pmap)
-    : cell_pmap_(cell_pmap) { }
-  
-  int surface_index(const Facet& f) const
-  {
-    Cell_handle c1 = f.first;
-    Cell_handle c2 = c1->neighbor(f.second);
-    
-    int label1 = get(cell_pmap_,c1);
-    int label2 = get(cell_pmap_,c2);
-    
-    if ( 0 == label1 || -1 == label1 )
-      label1 = label2;
-    if ( 0 == label2 || -1 == label2 )
-      label2 = label1;
-    
-    return (std::max)(label1,label2);
-  }
-  
-private:
-  const Cell_pmap& cell_pmap_;
-};
-
-// Accessors 
-template <typename C3T3, typename Cell_pmap>
-int
-get(const No_patch_facet_pmap_second<C3T3,Cell_pmap>& fmap,
-    const typename C3T3::Facet& f)
-{
-  return fmap.surface_index(f);
-}
-  
-  
-// -----------------------------------
-// Default_vertex_index_pmap
-// ----------------------------------- 
-template <typename C3T3, typename Cell_pmap, typename Facet_pmap>
-class Default_vertex_pmap
-{
-  typedef typename C3T3::Surface_patch_index Surface_patch_index;
-  typedef typename C3T3::Subdomain_index Subdomain_index;
-  typedef typename C3T3::Index Index;
-  typedef typename C3T3::Vertex_handle Vertex_handle;
-  typedef typename C3T3::Cell_handle Cell_handle;
-  typedef typename C3T3::Facet Facet;
-
-public:
-  Default_vertex_pmap(const C3T3& c3t3,
-                      const Cell_pmap& c_pmap,
-                      const Facet_pmap& f_pmap)
-    : c_pmap_(c_pmap)
-    , f_pmap_(f_pmap)
-    , r_c3t3_(c3t3)
-    , edge_index_(0) {}
-
-  int index(const Vertex_handle& vh) const
-  {
-    switch ( r_c3t3_.in_dimension(vh) )
-    {
-    case 2:
-      {
-        // Check if each incident surface facet of vh has the same surface index
-        typename std::vector<Facet> facets;
-        r_c3t3_.triangulation().finite_incident_facets(
-            vh, std::back_inserter(facets));
-
-        if ( facets.begin() == facets.end() )
-          return -1;
-
-        // Look for the first surface facet
-        typename std::vector<Facet>::iterator it_facet = facets.begin();
-        while ( ! r_c3t3_.is_in_complex(*it_facet) )
-        {
-          if ( ++it_facet == facets.end() )
-            return -1;
-        }
-
-        Surface_patch_index facet_index = r_c3t3_.surface_patch_index(*it_facet);
-        Facet facet = *it_facet;
-        ++it_facet;
-
-        for( ; it_facet != facets.end() ; ++it_facet)
-        {
-          // If another index is found, return value for edge vertice
-          if (   r_c3t3_.is_in_complex(*it_facet)
-              && !( facet_index == r_c3t3_.surface_patch_index(*it_facet) ) )
-            return edge_index_;
-        }
-
-        return get(f_pmap_,facet);
-      }
-      break;
-
-    case 3:
-      {
-        // Returns value of any incident cell
-        typename std::vector<Cell_handle> cells;
-        r_c3t3_.triangulation().finite_incident_cells(
-            vh,std::back_inserter(cells));
-
-        if ( cells.begin() != cells.end() )
-          return get(c_pmap_, *cells.begin());
-        else
-          return -1;
-      }
-      break;
-
-    default:
-      // should not happen
-      return -1;
-      break;
-    }
-  }
-
-private:
-  const Cell_pmap& c_pmap_;
-  const Facet_pmap& f_pmap_;
-  const C3T3& r_c3t3_;
-  const unsigned int edge_index_;
-};
-
-template <typename C3T3, typename Cell_pmap, typename Facet_pmap>
-int
-get(const Default_vertex_pmap<C3T3,Cell_pmap,Facet_pmap>& vmap,
-    const typename C3T3::Vertex_handle& vh)
-{
-  return vmap.index(vh);
-}
-
-
-// -----------------------------------
-// Null pmap
-// -----------------------------------  
-template <typename C3T3, typename Cell_pmap>
-struct Null_facet_pmap
-{
-  Null_facet_pmap(const C3T3&, const Cell_pmap&) {}
-};
-  
-template <typename C3T3, typename Cell_pmap>
-int get(const Null_facet_pmap<C3T3,Cell_pmap>&,
-        const typename C3T3::Facet&)
-{
-  return 0;
-}
-  
-template <typename C3T3, typename Cell_pmap, typename Facet_pmap>
-struct Null_vertex_pmap
-{
-  Null_vertex_pmap(const C3T3&, const Cell_pmap&, const Facet_pmap&) {}
-};
-  
-template <typename C3T3, typename Cell_pmap, typename Facet_pmap>
-int get(const Null_vertex_pmap<C3T3, Cell_pmap, Facet_pmap>&,
-        const typename C3T3::Vertex_handle&)
-{
-  return 0;
-}
-
-
-// -----------------------------------
-// Generator
-// -----------------------------------
-template <typename C3T3, bool rebind, bool no_patch>
-struct Medit_pmap_generator{};
-
-  
-template <typename C3T3>
-struct Medit_pmap_generator<C3T3, true, false>
-{
-  typedef Rebind_cell_pmap<C3T3>                            Cell_pmap;
-  typedef Rebind_facet_pmap<C3T3, Cell_pmap>                Facet_pmap;
-  typedef Null_facet_pmap<C3T3, Cell_pmap>                  Facet_pmap_twice;
-  typedef Default_vertex_pmap<C3T3, Cell_pmap, Facet_pmap>  Vertex_pmap;
-  
-  bool print_twice() { return false; }
-};
-  
-  
-template <typename C3T3>
-struct Medit_pmap_generator<C3T3, true, true>
-{
-  typedef Rebind_cell_pmap<C3T3>                            Cell_pmap;
-  typedef No_patch_facet_pmap_first<C3T3,Cell_pmap>         Facet_pmap;
-  typedef No_patch_facet_pmap_second<C3T3,Cell_pmap>        Facet_pmap_twice;
-  typedef Default_vertex_pmap<C3T3, Cell_pmap, Facet_pmap>  Vertex_pmap;
-  
-  bool print_twice() { return true; }
-};
-
-
-template <typename C3T3>
-struct Medit_pmap_generator<C3T3, false, true>
-{
-  typedef No_rebind_cell_pmap<C3T3>                         Cell_pmap;
-  typedef No_patch_facet_pmap_first<C3T3,Cell_pmap>         Facet_pmap;
-  typedef No_patch_facet_pmap_second<C3T3,Cell_pmap>        Facet_pmap_twice;
-  typedef Default_vertex_pmap<C3T3, Cell_pmap, Facet_pmap>  Vertex_pmap;
-  
-  bool print_twice() { return true; }
-};
-  
-template <typename C3T3>
-struct Medit_pmap_generator<C3T3, false, false>
-{
-  typedef No_rebind_cell_pmap<C3T3>                         Cell_pmap;
-  typedef Rebind_facet_pmap<C3T3,Cell_pmap>                 Facet_pmap;
-  typedef Null_facet_pmap<C3T3, Cell_pmap>                  Facet_pmap_twice;
-  typedef Null_vertex_pmap<C3T3, Cell_pmap, Facet_pmap>     Vertex_pmap;
-  
-  bool print_twice() { return false; }
-};
-
-  
-//-------------------------------------------------------
-// IO functions
-//-------------------------------------------------------
-
-
-  
-template <class C3T3, bool rebind, bool no_patch>
-void
-output_to_medit(std::ostream& os,
-                const C3T3& c3t3)
-{
-#ifdef CGAL_MESH_3_IO_VERBOSE
-  std::cerr << "Output to medit:\n";
-#endif
-  
-  typedef Medit_pmap_generator<C3T3,rebind,no_patch> Generator;
-  typedef typename Generator::Cell_pmap Cell_pmap;
-  typedef typename Generator::Facet_pmap Facet_pmap;
-  typedef typename Generator::Facet_pmap_twice Facet_pmap_twice;
-  typedef typename Generator::Vertex_pmap Vertex_pmap;
-  
-  Cell_pmap cell_pmap(c3t3);
-  Facet_pmap facet_pmap(c3t3,cell_pmap);
-  Facet_pmap_twice facet_pmap_twice(c3t3,cell_pmap);
-  Vertex_pmap vertex_pmap(c3t3,cell_pmap,facet_pmap);
-  
-  output_to_medit(os,
-                  c3t3,
-                  vertex_pmap,
-                  facet_pmap,
-                  cell_pmap,
-                  facet_pmap_twice,
-                  Generator().print_twice());
-  
-#ifdef CGAL_MESH_3_IO_VERBOSE
-  std::cerr << "done.\n";
-#endif
-}
-
-
-  
-template <class C3T3,
-          class Vertex_index_property_map,
-          class Facet_index_property_map,
-          class Facet_index_property_map_twice,
-          class Cell_index_property_map>
-void
-output_to_medit(std::ostream& os,
-                const C3T3& c3t3,
-                const Vertex_index_property_map& vertex_pmap,
-                const Facet_index_property_map& facet_pmap,
-                const Cell_index_property_map& cell_pmap,
-                const Facet_index_property_map_twice& facet_twice_pmap = Facet_index_property_map_twice(),
-                const bool print_each_facet_twice = false)
-{
-  typedef typename C3T3::Triangulation Tr;
-  typedef typename C3T3::Facets_in_complex_iterator Facet_iterator;
-  typedef typename C3T3::Cells_in_complex_iterator Cell_iterator;
-
-  typedef typename Tr::Finite_vertices_iterator Finite_vertices_iterator;
-  typedef typename Tr::Vertex_handle Vertex_handle;
-  typedef typename Tr::Point Point_3;
-
-  const Tr& tr = c3t3.triangulation();
-
-  //-------------------------------------------------------
-  // File output
-  //-------------------------------------------------------
-
-  //-------------------------------------------------------
-  // Header
-  //-------------------------------------------------------
-  os << std::setprecision(17);
-
-  os << "MeshVersionFormatted 1\n"
-     << "Dimension 3\n";
-
-
-  //-------------------------------------------------------
-  // Vertices
-  //-------------------------------------------------------
-  os << "Vertices\n" << tr.number_of_vertices() << '\n';
-
-  std::map<Vertex_handle, int> V;
-  int inum = 1;
-  for( Finite_vertices_iterator vit = tr.finite_vertices_begin();
-       vit != tr.finite_vertices_end();
-       ++vit)
-  {
-    V[vit] = inum++;
-    Point_3 p = vit->point();
-    os << CGAL::to_double(p.x()) << ' '
-       << CGAL::to_double(p.y()) << ' '
-       << CGAL::to_double(p.z()) << ' '
-       << get(vertex_pmap, vit)
-       << '\n';
-  }
-
-  //-------------------------------------------------------
-  // Facets
-  //-------------------------------------------------------
-  typename C3T3::size_type number_of_triangles = c3t3.number_of_facets_in_complex();
-  
-  if ( print_each_facet_twice )
-    number_of_triangles += number_of_triangles;
-  
-  os << "Triangles\n" 
-     << number_of_triangles << '\n';
-
-  for( Facet_iterator fit = c3t3.facets_in_complex_begin();
-       fit != c3t3.facets_in_complex_end();
-       ++fit)
-  {
-    for (int i=0; i<4; i++)
-    {
-      if (i != fit->second)
-      {
-        const Vertex_handle& vh = (*fit).first->vertex(i);
-        os << V[vh] << ' ';
-      }
-    }
-    os << get(facet_pmap, *fit) << '\n';
-    
-    // Print triangle again if needed
-    if ( print_each_facet_twice )
-    {
-      for (int i=0; i<4; i++)
-      {
-        if (i != fit->second)
-        {
-          const Vertex_handle& vh = (*fit).first->vertex(i);
-          os << V[vh] << ' ';
-        }
-      }
-      os << get(facet_twice_pmap, *fit) << '\n';
-    }
-  }
-
-  //-------------------------------------------------------
-  // Tetrahedra
-  //-------------------------------------------------------
-  os << "Tetrahedra\n"
-     << c3t3.number_of_cells_in_complex() << '\n';
-
-  for( Cell_iterator cit = c3t3.cells_in_complex_begin() ;
-       cit != c3t3.cells_in_complex_end() ;
-       ++cit )
-  {
-    for (int i=0; i<4; i++)
-      os << V[cit->vertex(i)] << ' ';
-
-    os << get(cell_pmap, cit) << '\n';
-  }
-
-  //-------------------------------------------------------
-  // End
-  //-------------------------------------------------------
-  os << "End\n";
-
-} // end output_to_medit(...)
-
-} // end namespace Mesh_3
-
-  
-
-  
-/**
- * @brief outputs mesh to medit format
- * @param os the stream
- * @param c3t3 the mesh
- * @param rebind if true, labels of cells are rebinded into [1..nb_of_labels]
- * @param show_patches if true, patches are labeled with different labels than
- * cells. If false, each surface facet is written twice, using label of
- * each adjacent cell.
- */
-template <class C3T3>
-void
-output_to_medit(std::ostream& os,
-                const C3T3& c3t3,
-                bool rebind = false,
-                bool show_patches = false) 
-{
-  if ( rebind )
-  {
-    if ( show_patches )
-      Mesh_3::output_to_medit<C3T3,true,false>(os,c3t3);
-    else
-      Mesh_3::output_to_medit<C3T3,true,true>(os,c3t3);
-  }
-  else
-  {
-    if ( show_patches )
-      Mesh_3::output_to_medit<C3T3,false,false>(os,c3t3);
-    else
-      Mesh_3::output_to_medit<C3T3,false,true>(os,c3t3);
-  }
-}
-
-} // end namespace CGAL
-
-#endif // CGAL_IO_FILE_MEDIT_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/File_scanner_OFF.h b/3rdparty/CGAL-4.8/include/CGAL/IO/File_scanner_OFF.h
deleted file mode 100644
index a8a6dc9..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/IO/File_scanner_OFF.h
+++ /dev/null
@@ -1,470 +0,0 @@
-// Copyright (c) 1997  
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved. 
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Lutz Kettner  <kettner at mpi-sb.mpg.de>
-
-#ifndef CGAL_IO_FILE_SCANNER_OFF_H
-#define CGAL_IO_FILE_SCANNER_OFF_H 1
-
-#include <CGAL/basic.h>
-#include <cstddef>
-#include <CGAL/IO/binary_file_io.h>
-#include <CGAL/IO/File_header_OFF.h>
-#include <iostream>
-#include <boost/cstdint.hpp>
-
-#include <CGAL/Point_3.h>
-#include <CGAL/Vector_3.h>
-
-namespace CGAL {
-
-class CGAL_EXPORT File_scanner_OFF : public File_header_OFF {
-    std::istream&  m_in;
-    bool           normals_read;
-    void skip_comment() { m_in >> skip_comment_OFF; }
-public:
-    File_scanner_OFF( std::istream& in, bool verbose = false)
-      : File_header_OFF(verbose), m_in(in), normals_read(false) {
-        in >> static_cast<File_header_OFF&>( *this);
-    }
-    File_scanner_OFF( std::istream& in, const File_header_OFF& header)
-      : File_header_OFF(header), m_in(in), normals_read(false) {}
-
-    std::istream& in() { return m_in; }
-
-    // The scan_vertex() routine is provided for multiple
-    // coordinate types to support parameterized polytopes.
-    void scan_vertex( float&  x, float&  y, float&  z) {
-        if ( binary()) {
-            I_Binary_read_big_endian_float32( m_in, x);
-            I_Binary_read_big_endian_float32( m_in, y);
-            I_Binary_read_big_endian_float32( m_in, z);
-            if ( is_homogeneous()) {
-                float w;
-                I_Binary_read_big_endian_float32( m_in, w);
-                x /= w;
-                y /= w;
-                z /= w;
-            }
-        } else {
-            skip_comment();
-            m_in >> iformat(x) >> iformat(y) >> iformat(z);
-            if ( is_homogeneous()) {
-                float w;
-                m_in >> iformat(w);
-                x /= w;
-                y /= w;
-                z /= w;
-            }
-        }
-    }
-    void scan_vertex( double& x, double& y, double& z) {
-        if ( binary()) {
-            float f;
-            I_Binary_read_big_endian_float32( m_in, f);
-            x = f;
-            I_Binary_read_big_endian_float32( m_in, f);
-            y = f;
-            I_Binary_read_big_endian_float32( m_in, f);
-            z = f;
-            if ( is_homogeneous()) {
-                I_Binary_read_big_endian_float32( m_in, f);
-                x /= f;
-                y /= f;
-                z /= f;
-            }
-        } else {
-            skip_comment();
-            m_in >> iformat(x) >> iformat(y) >> iformat(z);
-            if ( is_homogeneous()) {
-                double w;
-                m_in >> iformat(w);
-                x /= w;
-                y /= w;
-                z /= w;
-            }
-        }
-    }
-    void scan_vertex( int& x, int& y, int& z) {
-        if ( binary()) {
-            float fx, fy, fz;
-            I_Binary_read_big_endian_float32( m_in, fx);
-            I_Binary_read_big_endian_float32( m_in, fy);
-            I_Binary_read_big_endian_float32( m_in, fz);
-            if ( is_homogeneous()) {
-                float fw;
-                I_Binary_read_big_endian_float32( m_in, fw);
-                x = int( fx / fw);
-                y = int( fy / fw);
-                z = int( fz / fw);
-            } else {
-                x = int(fx);
-                y = int(fy);
-                z = int(fz);
-            }
-        } else {
-            skip_comment();
-            if ( is_homogeneous()) {
-                double fx, fy, fz, fw;
-                m_in >> iformat(fx) >> iformat(fy) >> iformat(fz) >> iformat(fw);
-                x = int( fx / fw);
-                y = int( fy / fw);
-                z = int( fz / fw);
-            } else {
-                double d;
-                m_in >> iformat(d);
-                x = int(d);
-                m_in >> iformat(d);
-                y = int(d);
-                m_in >> iformat(d);
-                z = int(d);
-            }
-        }
-    }
-
-    void scan_vertex( float&  x, float&  y, float&  z, float&  w) {
-        w = 1;
-        if ( binary()) {
-            I_Binary_read_big_endian_float32( m_in, x);
-            I_Binary_read_big_endian_float32( m_in, y);
-            I_Binary_read_big_endian_float32( m_in, z);
-            if ( is_homogeneous())
-                I_Binary_read_big_endian_float32( m_in, w);
-        } else {
-            skip_comment();
-            m_in >> iformat(x) >> iformat(y) >> iformat(z);
-            if ( is_homogeneous())
-              m_in >> iformat(w);
-        }
-    }
-    void scan_vertex( double& x, double& y, double& z, double& w) {
-        w = 1;
-        if ( binary()) {
-            float f;
-            I_Binary_read_big_endian_float32( m_in, f);
-            x = f;
-            I_Binary_read_big_endian_float32( m_in, f);
-            y = f;
-            I_Binary_read_big_endian_float32( m_in, f);
-            z = f;
-            if ( is_homogeneous()) {
-                I_Binary_read_big_endian_float32( m_in, f);
-                w = f;
-            }
-        } else {
-            skip_comment();
-            m_in >> iformat(x);
-            m_in >> iformat(y);
-            m_in >> iformat(z);
-            if ( is_homogeneous())
-              m_in >> iformat(w);
-        }
-    }
-    void scan_vertex( int& x, int& y, int& z, int& w) {
-        w = 1;
-        if ( binary()) {
-            float f;
-            I_Binary_read_big_endian_float32( m_in, f);
-            x = int(f);
-            I_Binary_read_big_endian_float32( m_in, f);
-            y = int(f);
-            I_Binary_read_big_endian_float32( m_in, f);
-            z = int(f);
-            if ( is_homogeneous()) {
-                I_Binary_read_big_endian_float32( m_in, f);
-                w = int(f);
-            }
-        } else {
-            skip_comment();
-            double d;
-            m_in >> iformat(d);
-            x = int(d);
-            m_in >> iformat(d);
-            y = int(d);
-            m_in >> iformat(d);
-            z = int(d);
-            if ( is_homogeneous()) {
-                m_in >> iformat(d);
-                w = int(d);
-            }
-        }
-    }
-
-    void scan_normal( float&  x, float&  y, float&  z) {
-        if ( has_normals()) {
-            normals_read = true;
-            if ( binary()) {
-                I_Binary_read_big_endian_float32( m_in, x);
-                I_Binary_read_big_endian_float32( m_in, y);
-                I_Binary_read_big_endian_float32( m_in, z);
-                if ( is_homogeneous()) {
-                    float w;
-                    I_Binary_read_big_endian_float32( m_in, w);
-                    x /= w;
-                    y /= w;
-                    z /= w;
-                }
-            } else {
-                m_in >> iformat(x) >> iformat(y) >> iformat(z);
-                if ( is_homogeneous()) {
-                    float w;
-                    m_in >> iformat(w);
-                    x /= w;
-                    y /= w;
-                    z /= w;
-                }
-            }
-        }
-    }
-    void scan_normal( double& x, double& y, double& z) {
-        if ( has_normals()) {
-            normals_read = true;
-            if ( binary()) {
-                float fx, fy, fz;
-                I_Binary_read_big_endian_float32( m_in, fx);
-                I_Binary_read_big_endian_float32( m_in, fy);
-                I_Binary_read_big_endian_float32( m_in, fz);
-                if ( is_homogeneous()) {
-                    float fw;
-                    I_Binary_read_big_endian_float32( m_in, fw);
-                    x = fx / fw;
-                    y = fy / fw;
-                    z = fz / fw;
-                } else {
-                    x = fx;
-                    y = fy;
-                    z = fz;
-                }
-            } else {
-                if ( is_homogeneous()) {
-                    float fx, fy, fz, fw;
-                    m_in >> iformat(fx) >> iformat(fy) >> iformat(fz) >> iformat(fw);
-                    x = fx / fw;
-                    y = fy / fw;
-                    z = fz / fw;
-                } else
-                    m_in >> iformat(x) >> iformat(y) >> iformat(z);
-            }
-        }
-    }
-    void scan_normal( int& x, int& y, int& z) {
-        if ( has_normals()) {
-            normals_read = true;
-            if ( binary()) {
-                float fx, fy, fz;
-                I_Binary_read_big_endian_float32( m_in, fx);
-                I_Binary_read_big_endian_float32( m_in, fy);
-                I_Binary_read_big_endian_float32( m_in, fz);
-                if ( is_homogeneous()) {
-                    float fw;
-                    I_Binary_read_big_endian_float32( m_in, fw);
-                    x = int( fx / fw);
-                    y = int( fy / fw);
-                    z = int( fz / fw);
-                } else {
-                    x = int(fx);
-                    y = int(fy);
-                    z = int(fz);
-                }
-            } else {
-                if ( is_homogeneous()) {
-                    float fx, fy, fz, fw;
-                    m_in >> iformat(fx) >> iformat(fy) >> iformat(fz) >> iformat(fw);
-                    x = int( fx / fw);
-                    y = int( fy / fw);
-                    z = int( fz / fw);
-                } else {
-                    double d;
-                    m_in >> iformat(d);
-                    x = int(d);
-                    m_in >> iformat(d);
-                    y = int(d);
-                    m_in >> iformat(d);
-                    z = int(d);
-                }
-            }
-        }
-    }
-
-    void scan_normal( float&  x, float&  y, float&  z, float&  w) {
-        w = 1;
-        if ( has_normals()) {
-            normals_read = true;
-            if ( binary()) {
-                I_Binary_read_big_endian_float32( m_in, x);
-                I_Binary_read_big_endian_float32( m_in, y);
-                I_Binary_read_big_endian_float32( m_in, z);
-                if ( is_homogeneous())
-                    I_Binary_read_big_endian_float32( m_in, w);
-            } else {
-                m_in >> iformat(x) >> iformat(y) >> iformat(z);
-                if ( is_homogeneous())
-                    m_in >> iformat(w);
-            }
-        }
-    }
-    void scan_normal( double& x, double& y, double& z, double& w) {
-        w = 1;
-        if ( has_normals()) {
-            normals_read = true;
-            if ( binary()) {
-                float f;
-                I_Binary_read_big_endian_float32( m_in, f);
-                x = f;
-                I_Binary_read_big_endian_float32( m_in, f);
-                y = f;
-                I_Binary_read_big_endian_float32( m_in, f);
-                z = f;
-                if ( is_homogeneous()) {
-                    I_Binary_read_big_endian_float32( m_in, f);
-                    w = f;
-                }
-            } else {
-                m_in >> iformat(x) >> iformat(y) >> iformat(z);
-                if ( is_homogeneous())
-                    m_in >> iformat(w);
-            }
-        }
-    }
-    void scan_normal( int& x, int& y, int& z, int& w) {
-        w = 1;
-        if ( has_normals()) {
-            normals_read = true;
-            if ( binary()) {
-                float f;
-                I_Binary_read_big_endian_float32( m_in, f);
-                x = int(f);
-                I_Binary_read_big_endian_float32( m_in, f);
-                y = int(f);
-                I_Binary_read_big_endian_float32( m_in, f);
-                z = int(f);
-                if ( is_homogeneous()) {
-                    I_Binary_read_big_endian_float32( m_in, f);
-                    w = int(f);
-                }
-            } else {
-                double d;
-                m_in >> iformat(d);
-                x = int(d);
-                m_in >> iformat(d);
-                y = int(d);
-                m_in >> iformat(d);
-                z = int(d);
-                if ( is_homogeneous()) {
-                    m_in >> iformat(d);
-                    w = int(d);
-                }
-            }
-        }
-    }
-
-  void skip_to_next_vertex( std::size_t current_vertex);
-
-  void scan_facet( std::size_t& size, std::size_t CGAL_assertion_code(current_facet)) {
-        CGAL_assertion( current_facet < size_of_facets());
-        if ( binary()){
-            boost::int32_t i32;
-            I_Binary_read_big_endian_integer32( m_in, i32);
-            size = i32;
-        } else {
-            skip_comment();
-            m_in >> size;
-        }
-    }
-
-  void scan_facet_vertex_index( std::size_t& index,
-                                std::size_t current_facet) {
-    if ( binary()){
-      boost::int32_t i32;
-      I_Binary_read_big_endian_integer32( m_in, i32);
-      index = i32;
-    } else
-      m_in >> index;
-
-    if( m_in.fail()) {
-      if ( verbose()) {
-        std::cerr << " " << std::endl;
-        std::cerr << "File_scanner_OFF::" << std::endl;
-        std::cerr << "scan_facet_vertex_index(): input error:  "
-          "cannot read OFF file beyond facet "
-                  << current_facet << "." << std::endl;
-      }
-      set_off_header( false);
-      return;
-    }
-    bool error  = index < index_offset();
-    index -= index_offset();
-
-    if(error || (index >= size_of_vertices())) {
-      m_in.clear( std::ios::failbit);
-      if ( verbose()) {
-        std::cerr << " " << std::endl;
-        std::cerr << "File_scanner_OFF::" << std::endl;
-        std::cerr << "scan_facet_vertex_index(): input error: "
-          "facet " << current_facet << ": vertex index "
-                  << index + index_offset() << ": is out of range."
-                  << std::endl;
-      }
-      set_off_header( false);
-      return;
-    }
-  }
-
-  void skip_to_next_facet( std::size_t current_facet);
-};
-
-template < class Point> inline
-Point&
-file_scan_vertex( File_scanner_OFF& scanner, Point& p) {
-    typedef typename Point::R R;
-    typedef typename R::RT    RT;
-    double x, y, z, w;
-    scanner.scan_vertex( x, y, z, w);
-    if ( w == 1)
-        p = Point( RT(x), RT(y), RT(z));
-    else
-        p = Point( RT(x), RT(y), RT(z), RT(w));
-    return p;
-}
-
-template < class Vector> inline
-Vector&
-file_scan_normal( File_scanner_OFF& scanner, Vector& v) {
-    typedef typename Vector::R R;
-    typedef typename R::RT     RT;
-    double x, y, z, w;
-    scanner.scan_normal( x, y, z, w);
-    if ( w == 1)
-        v = Vector( RT(x), RT(y), RT(z));
-    else
-        v = Vector( RT(x), RT(y), RT(z), RT(w));
-    return v;
-}
-
-} //namespace CGAL
-
-#ifdef CGAL_HEADER_ONLY
-#include <CGAL/IO/File_scanner_OFF_impl.h>
-#endif // CGAL_HEADER_ONLY
-
-#endif // CGAL_IO_FILE_SCANNER_OFF_H //
-// EOF //
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Geomview_stream_impl.h b/3rdparty/CGAL-4.8/include/CGAL/IO/Geomview_stream_impl.h
deleted file mode 100644
index 7eb8dd2..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/IO/Geomview_stream_impl.h
+++ /dev/null
@@ -1,612 +0,0 @@
-// Copyright (c) 1999-2004  
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved. 
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Andreas Fabri, Herve Bronnimann, Sylvain Pion
-
-#ifdef CGAL_USE_GEOMVIEW
-
-#ifdef CGAL_HEADER_ONLY
-#define CGAL_INLINE_FUNCTION inline
-#else
-#define CGAL_INLINE_FUNCTION
-#endif
-
-#include <sstream>
-#include <csignal>
-#include <cerrno>
-#include <cstring>
-#include <cstdlib>
-#include <unistd.h>
-
-#include <sys/types.h> // kill() on SunPro requires these 2 #includes.
-#include <signal.h>
-
-#include <CGAL/IO/binary_file_io.h>
-
-namespace CGAL {
-
-CGAL_INLINE_FUNCTION
-Geomview_stream::Geomview_stream(const Bbox_3 &bbox,
-				 const char *machine,
-				 const char *login)
-    : bb(bbox), vertex_color(BLACK), edge_color(BLACK), face_color(BLACK),
-      wired_flag(false), echo_flag(true), raw_flag(false),
-      trace_flag(false), binary_flag(false),
-      line_width(1)
-{
-    setup_geomview(machine, login);
-    frame(bbox);
-    pickplane(bbox);
-    set_vertex_radius((bbox.xmax() - bbox.xmin())/100.0);
-}
-
-CGAL_INLINE_FUNCTION
-Geomview_stream::~Geomview_stream()
-{
-    kill(pid, SIGKILL);  // kills geomview
-}
-
-CGAL_INLINE_FUNCTION
-void Geomview_stream::setup_geomview(const char *machine, const char *login)
-{
-    int pipe_out[2], pipe_in[2];
-
-    // Communication between CGAL and geomview should be possible
-    // in two directions. To achieve this we open two pipes
-
-    std::cout << "Starting Geomview..." << std::flush;
-    if (pipe(pipe_out) < 0) {
-        CGAL_error_msg( "out pipe failed" );
-    }
-
-    if (pipe(pipe_in) < 0) {
-        CGAL_error_msg(  "in pipe failed" );
-    }
-
-    switch (pid = fork()){
-    case -1:
-        CGAL_error_msg( "fork failed" );
-    case 0:               // The child process
-        close(pipe_out[1]); // does not write to the out pipe,
-        close(pipe_in[0]);  // does not read from the in pipe.
-
-	if (dup2(pipe_out[0], 0) != 0)
-	    std::cerr << "Connect pipe to stdin failed." << std::endl;
-	if (dup2(pipe_in[1], 1) != 1)
-	    std::cerr << "Connect pipe to stdout failed." << std::endl;
-
-        if (machine && (std::strlen(machine)>0)) {
-	    std::string s (" rgeomview ");
-	    s += machine;
-	    s += ":0.0";
-            execlp("rsh", "rsh", machine, "-l", login, s.data(),
-                   static_cast<void *>(NULL)); // cast to stop gcc warning
-        } else {
-            execlp("geomview", "geomview", "-c", "-",
-                   static_cast<void *>(NULL)); // cast to stop gcc warning
-        }
-
-        // if we get to this point something went wrong.
-        std::cerr << "execl geomview failed" << std::endl;
-        switch(errno) {
-        case EACCES:
-            std::cerr << "please check your environment variable PATH"
-		      << std::endl;
-            std::cerr << "make sure the file `geomview' is contained in it"
-		      << std::endl;
-            std::cerr << "and is executable" << std::endl;
-            break;
-        case ELOOP:
-            std::cerr << "too many links for filename `geomview'" << std::endl;
-            break;
-        default:
-            std::cerr << "error number " << errno << " (check `man execlp')"
-		      << std::endl;
-        };
-        CGAL_error();
-    default:              // The parent process
-        close(pipe_out[0]); // does not read from the out pipe,
-        close(pipe_in[1]);  // does not write to the in pipe.
-
-        in = pipe_in[0];
-        out = pipe_out[1];
-
-	// Necessary to wait a little bit for Geomview,
-        // otherwise you won't be able to ask for points...
-        sleep(1);
-
-#if 1
-        // We want to get rid of the requirement in the CGAL doc about
-	// (echo "started").  But we want to be backward compatible, that is,
-	// people who have this echo in their .geomview must still have CGAL
-	// working, at least for a few public releases.
-        // So the plan is to send, from CGAL, the command : (echo "CGAL-3D")
-        // It's the same length as "started", 7.
-        // Then we read 7 chars from Geomview, and test which string it is.
-        // If it's "CGAL-3D", then fine, the user doesn't have .geomview with
-        // the back-compatible echo command.
-        // In the very long run, we'll be able to get rid of all this code as
-        // well.
-	// Maybe we should simply read the pipe, till we find "CGAL-3D" ?
-
-        *this << "(echo \"CGAL-3D\")";
-
-        char inbuf[10];
-        std::size_t retread=::read(in, inbuf, 7);
-        (void)retread;
-
-        if (std::strncmp(inbuf, "started", 7) == 0)
-        {
-            // std::cerr << "You still have a .geomview file with the\n"
-                   // << "(echo \"started\") command. Note that this is not\n"
-                   // << "compulsory anymore, since CGAL 2.3" << std::endl;
-
-            // Then the next one is supposed to be CGAL-3D.
-            retread=::read(in, inbuf, 7);
-            (void)retread;
-            if (std::strncmp(inbuf, "CGAL-3D", 7) != 0)
-                std::cerr << "Unexpected string from Geomview !" << std::endl;
-        }
-        else if (std::strncmp(inbuf, "CGAL-3D", 7) == 0)
-        {
-            // std::cerr << "Good, you don't have a .geomview file with the\n"
-                      // << "(echo \"started\") command" << std::endl;
-        }
-        else
-        {
-            std::cerr << "Unexcepted string from Geomview at initialization!\n"
-                      << "Going on nevertheless !" << std::endl;
-        }
-#else
-        // Old original version
-        char inbuf[10];
-        // Waits for "started" from the .geomview file.
-        retread=::read(in, inbuf, 7);
-        (void)retread;
-#endif
-
-        std::cout << "done." << std::endl;
-
-        (*this) << "(normalization g* none)(bbox-draw g* no)";
-    }
-}
-
-CGAL_INLINE_FUNCTION
-void
-Geomview_stream::pickplane(const Bbox_3 &bbox)
-{
-    bool bin_bak = set_binary_mode();
-    (*this) << "(geometry pickplane {QUAD BINARY\n"
-            << 1
-    // here are the four corners
-            << bbox.xmin() << bbox.ymin() << bbox.zmin()
-            << bbox.xmin() << bbox.ymax() << bbox.zmin()
-            << bbox.xmax() << bbox.ymax() << bbox.zmin()
-            << bbox.xmax() << bbox.ymin() << bbox.zmin()
-
-    // close the text bracket
-            << "}) (pickable pickplane no)";
-    set_ascii_mode(bin_bak);
-}
-
-CGAL_INLINE_FUNCTION
-void
-Geomview_stream::clear()
-{
-    (*this) << "(delete World)";
-    id.clear();
-}
-
-CGAL_INLINE_FUNCTION
-void
-Geomview_stream::look_recenter()
-{
-    (*this) << "(look-recenter World)";
-}
-
-CGAL_INLINE_FUNCTION
-Geomview_stream&
-Geomview_stream::operator<<(const std::string & s)
-{
-    if ((int)s.length() != ::write(out, s.data(), s.length())) {
-        CGAL_error_msg( "write problem in the pipe while sending data to geomview" );
-    }
-    trace(s);
-
-    return *this;
-}
-
-CGAL_INLINE_FUNCTION
-Geomview_stream&
-Geomview_stream::operator<<(int i)
-{
-    // Depending on the mode chosen
-    if (get_binary_mode()) {
-        // we write raw binary data to the stream.
-        int num = i;
-        I_swap_to_big_endian(num);
-        std::size_t retwrite=::write(out, (char*)&num, sizeof(num));
-        (void)retwrite;
-        trace(i);
-    } else {
-        // transform the int in a character sequence and put whitespace around
-        std::ostringstream str;
-        str << i << ' ' << std::ends;
-        *this << str.str().c_str();
-    }
-
-    return *this;
-}
-
-CGAL_INLINE_FUNCTION
-Geomview_stream&
-Geomview_stream::operator<<(unsigned int i)
-{
-    // Depending on the mode chosen
-    if (get_binary_mode()) {
-        // we write raw binary data to the stream.
-        unsigned int num = i;
-        I_swap_to_big_endian(num);
-        std::size_t retwrite=::write(out, (char*)&num, sizeof(num));
-        (void)retwrite;
-        trace(i);
-    } else {
-        // transform the int in a character sequence and put whitespace around
-        std::ostringstream str;
-        str << i << ' ' << std::ends;
-        *this << str.str().c_str();
-    }
-
-    return *this;
-}
-
-CGAL_INLINE_FUNCTION
-Geomview_stream&
-Geomview_stream::operator<<(long i)
-{
-    return operator<<((int) i);
-}
-
-CGAL_INLINE_FUNCTION
-Geomview_stream&
-Geomview_stream::operator<<(unsigned long i)
-{
-    return operator<<((unsigned int) i);
-}
-
-CGAL_INLINE_FUNCTION
-Geomview_stream&
-Geomview_stream::operator<<(double d)
-{
-    float f = d;
-    if (get_binary_mode()) {
-        float num = d;
-        I_swap_to_big_endian(num);
-        std::size_t retwrite= ::write(out, (char*)&num, sizeof(num));
-        (void)retwrite;
-        trace(f);
-    } else {
-        // 'copy' the float in a string and append a blank
-        std::ostringstream str;
-        str << f << ' ' << std::ends;
-        *this << str.str().c_str();
-    }
-    return *this;
-}
-
-CGAL_INLINE_FUNCTION
-Geomview_stream&
-operator<<(Geomview_stream &gv, const Bbox_2 &bbox)
-{
-    bool ascii_bak = gv.set_ascii_mode();
-    gv << "(geometry " << gv.get_new_id("Bbox")
-       << " {VECT 1 5 0 5 0 ";
-    // here are the four corners
-
-    gv << bbox.xmin() << bbox.ymin() << 0.0
-       << bbox.xmin() << bbox.ymax() << 0.0
-       << bbox.xmax() << bbox.ymax() << 0.0
-       << bbox.xmax() << bbox.ymin() << 0.0
-       << bbox.xmin() << bbox.ymin() << 0.0;
-
-    // close the text bracket
-    gv << "})";
-    gv.set_ascii_mode(ascii_bak);
-
-    return gv;
-}
-
-CGAL_INLINE_FUNCTION
-Geomview_stream&
-operator<<(Geomview_stream &gv, const Bbox_3 &bbox)
-{
-    bool ascii_bak = gv.set_ascii_mode();
-    gv << "(geometry " << gv.get_new_id("Bbox")
-       << " {appearance {material {edgecolor "
-       << gv.ecr() << gv.ecg() << gv.ecb() <<  "}}{SKEL 8 4 "
-    // here are the corners
-       << bbox.xmin() << bbox.ymin() << bbox.zmin()
-       << bbox.xmin() << bbox.ymax() << bbox.zmin()
-       << bbox.xmax() << bbox.ymax() << bbox.zmin()
-       << bbox.xmax() << bbox.ymin() << bbox.zmin()
-       << bbox.xmax() << bbox.ymin() << bbox.zmax()
-       << bbox.xmax() << bbox.ymax() << bbox.zmax()
-       << bbox.xmin() << bbox.ymax() << bbox.zmax()
-       << bbox.xmin() << bbox.ymin() << bbox.zmax()
-
-       << "10 0 1 2 3 4 5 6 7 0 3\n"
-       << "2 1 6\n"
-       << "2 2 5\n"
-       << "2 4 7\n"
-
-    // close the text bracket
-       << "}})";
-    gv.set_ascii_mode(ascii_bak);
-
-    return gv;
-}
-
-CGAL_INLINE_FUNCTION
-void
-Geomview_stream::set_bg_color(const Color &c)
-{
-    bool ascii_bak = set_ascii_mode();
-    *this << "(backcolor \"Camera\" "
-          << double(c.r())/255.0
-          << double(c.g())/255.0
-          << double(c.b())/255.0
-          << ")";
-    set_ascii_mode(ascii_bak);
-}
-
-CGAL_INLINE_FUNCTION
-Geomview_stream&
-Geomview_stream::operator<<(const Color &c)
-{
-    vertex_color = edge_color = face_color = c;
-    return (*this);
-}
-
-CGAL_INLINE_FUNCTION
-Color
-Geomview_stream::get_vertex_color() const
-{
-    return vertex_color;
-}
-
-CGAL_INLINE_FUNCTION
-Color
-Geomview_stream::get_edge_color() const
-{
-    return edge_color;
-}
-
-CGAL_INLINE_FUNCTION
-Color
-Geomview_stream::get_face_color() const
-{
-    return face_color;
-}
-
-CGAL_INLINE_FUNCTION
-Color
-Geomview_stream::set_vertex_color(const Color &c)
-{
-    Color old = vertex_color;
-    vertex_color = c;
-    return old;
-}
-
-CGAL_INLINE_FUNCTION
-Color
-Geomview_stream::set_edge_color(const Color &c)
-{
-    Color old = edge_color;
-    edge_color = c;
-    return old;
-}
-
-CGAL_INLINE_FUNCTION
-Color
-Geomview_stream::set_face_color(const Color &c)
-{
-    Color old = face_color;
-    face_color = c;
-    return old;
-}
-
-CGAL_INLINE_FUNCTION
-double
-Geomview_stream::vcr() const
-{
-    return double(vertex_color.r())/255.0;
-}
-
-CGAL_INLINE_FUNCTION
-double
-Geomview_stream::vcg() const
-{
-    return double(vertex_color.g())/255.0;
-}
-
-CGAL_INLINE_FUNCTION
-double
-Geomview_stream::vcb() const
-{
-    return double(vertex_color.b())/255.0;
-}
-
-CGAL_INLINE_FUNCTION
-double
-Geomview_stream::ecr() const
-{
-    return double(edge_color.r())/255.0;
-}
-
-CGAL_INLINE_FUNCTION
-double
-Geomview_stream::ecg() const
-{
-    return double(edge_color.g())/255.0;
-}
-
-CGAL_INLINE_FUNCTION
-double
-Geomview_stream::ecb() const
-{
-    return double(edge_color.b())/255.0;
-}
-
-CGAL_INLINE_FUNCTION
-double
-Geomview_stream::fcr() const
-{
-    return double(face_color.r())/255.0;
-}
-
-CGAL_INLINE_FUNCTION
-double
-Geomview_stream::fcg() const
-{
-    return double(face_color.g())/255.0;
-}
-
-CGAL_INLINE_FUNCTION
-double
-Geomview_stream::fcb() const
-{
-    return double(face_color.b())/255.0;
-}
-
-CGAL_INLINE_FUNCTION
-void
-Geomview_stream::frame(const Bbox_3 &bbox)
-{
-    (*this) << bbox << "(look-recenter g0 c0)";
-}
-
-CGAL_INLINE_FUNCTION
-Geomview_stream&
-Geomview_stream::operator>>(char *expr)
-{
-    // Skip whitespaces
-    do {
-      std::size_t retread=::read(in, expr, 1);
-      (void)retread;
-    } while (expr[0] != '(');
-
-    int pcount = 1;
-    int i = 1;
-    while (1) {
-        std::size_t retread=::read(in, &expr[i], 1);
-        (void)retread;
-        if (expr[i] == ')'){
-            pcount--;
-        } else if (expr[i] == '('){
-            pcount++;
-        }
-        if (pcount == 0){
-            expr[i+1]='\0';
-            break;  // we encountered a balanced number of parantheses
-        }
-        i++;
-    }
-    return *this;
-}
-
-// Parse a Lisp expression, return a pointer to the beginning of the
-// nth subexpression, and terminate it by '\0'.
-// It's either a word terminated by ' ' or ')', or a well parenthesed
-// expression, or a quoted "string".
-CGAL_INLINE_FUNCTION
-char*
-Geomview_stream::nth(char* s, int count)
-{
-    s++; // skip first character (always a parenthesis)
-
-    // Skip "count" words.
-    for(; count != 0; count--) {
-        while (*s == ' ')       // skip whitespaces
-            s++;
-        s++;
-        while (*s != ' ')       // skip a word
-            s++;
-    }
-    while (*s == ' ')           // skip whitespaces
-        s++;
-
-    // Now we have the beginning of the searched sub-expression.
-    int j = 1;
-    if (*s == '(')              // Case of a well-parenthesed expression.
-        for (int pcount = 1; pcount != 0;) {
-            if (s[j] == ')') pcount--;
-            if (s[j] == '(') pcount++;
-            j++;
-        }
-    else if (*s == '"') {       // Case of a quoted "string".
-        while (s[j] != '"')
-            j++;
-        j++;
-    }
-    else                        // Case of a word terminated by ' ' or ')'.
-        while (s[j] != ' ' && s[j] != ')')
-            j++;
-
-    s[j] = '\0';
-    return s;
-}
-
-CGAL_INLINE_FUNCTION
-void
-Geomview_stream::parse_point(const char* pickpoint,
-		     double &x, double &y, double &z, double &w)
-{
-    std::stringstream ss;
-    ss << pickpoint << std::ends;
-
-    char parenthesis;
-    ss >> parenthesis >> x >> y >> z >> w;
-}
-
-CGAL_INLINE_FUNCTION
-std::string
-Geomview_stream::get_new_id(const std::string & s)
-{
-    std::ostringstream str;
-    str << s << id[s]++ << std::ends;
-    return str.str();
-}
-
-} //namespace CGAL
-
-#else
-
-#ifndef CGAL_HEADER_ONLY
-// Add a dummy symbol to prevent warnings of empty translation unit.
-namespace CGAL {
-namespace {
-int dummy;
-}
-} //namespace CGAL
-#endif
-
-#endif // CGAL_USE_GEOMVIEW
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Nef_polyhedron_2_PS_stream.h b/3rdparty/CGAL-4.8/include/CGAL/IO/Nef_polyhedron_2_PS_stream.h
deleted file mode 100644
index 58206b4..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/IO/Nef_polyhedron_2_PS_stream.h
+++ /dev/null
@@ -1,122 +0,0 @@
-// Copyright (c) 1997-2000  Max-Planck-Institute Saarbruecken (Germany).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Michael Seel <seel at mpi-sb.mpg.de>
-
-#ifndef CGAL_NEF_POLYHEDRON_2_PS_STREAM_H
-#define CGAL_NEF_POLYHEDRON_2_PS_STREAM_H
-
-#include <CGAL/Nef_polyhedron_2.h>
-#if CGAL_LEDA_VERSION < 500
-#include <LEDA/gen_polygon.h>
-#include <LEDA/ps_file.h>
-#include <LEDA/color.h>
-#else
-#include <LEDA/geo/gen_polygon.h>
-#include <LEDA/graphics/ps_file.h>
-#include <LEDA/graphics/color.h>
-#endif
-
-namespace CGAL {
-static int frame_default = 100;
-
-template <typename CIRC>
-leda_list<leda_point>
-face_cycle(CIRC c)
-{
-  leda_list<leda_point> L;
-  CIRC c_end(c);
-  CGAL_For_all(c,c_end) {
-    L.append(leda_point(CGAL::to_double(c->vertex()->point().x()),
-                        CGAL::to_double(c->vertex()->point().y())));
-  }
-  return L;
-}
-
-
-template <typename T>
-ps_file& operator<<(ps_file& PS, const Nef_polyhedron_2<T>& P)
-{
-  typedef Nef_polyhedron_2<T> NefPoly;
-  typedef typename NefPoly::Const_decorator  PMCDec;
-  typedef typename NefPoly::Point            Point;
-  typedef typename NefPoly::Line             Line;
-  typedef typename T::RT  RT;
-  typedef typename T::Standard_RT Standard_RT;
-
-  PMCDec D = P.explorer(); 
-  const T& E = Nef_polyhedron_2<T>::EK;
-
-  Standard_RT frame_radius = frame_default;
-  E.determine_frame_radius(D.points_begin(),D.points_end(),frame_radius);
-  RT::set_R(frame_radius);
-  double r = CGAL::to_double(frame_radius);
-  PS.init(-r,r,-r);
-
-  typedef typename PMCDec::Vertex_const_iterator   Vertex_const_iterator;
-  typedef typename PMCDec::Halfedge_const_iterator Halfedge_const_iterator;
-  typedef typename PMCDec::Face_const_iterator     Face_const_iterator;
-  typedef typename PMCDec::Hole_const_iterator     Hole_const_iterator;
-  typedef typename PMCDec::Halfedge_around_face_const_circulator
-    Halfedge_around_face_const_circulator;
-
-  Face_const_iterator fit = D.faces_begin();
-  for (++fit; fit != D.faces_end(); ++fit) {
-    leda_list<leda_polygon> LP;
-    Halfedge_around_face_const_circulator hfc(fit->halfedge());
-    LP.append(leda_polygon(face_cycle(hfc),leda_polygon::NO_CHECK));
-    Hole_const_iterator hit;
-    for (hit = fit->fc_begin(); hit != fit->fc_end(); ++hit) {
-      hfc = Halfedge_around_face_const_circulator(hit);
-      LP.append(leda_polygon(face_cycle(hfc),leda_polygon::NO_CHECK));
-    }
-    leda_gen_polygon GP(LP,leda_gen_polygon::NO_CHECK);
-    if ( fit->mark() ) PS.set_fill_color(leda_grey3);
-    else               PS.set_fill_color(leda_white);
-    PS << GP;
-  }
-
-  Halfedge_const_iterator hit;
-  for (hit = D.halfedges_begin(); hit != D.halfedges_end(); ++(++hit)) {
-    leda_segment s(CGAL::to_double(hit->vertex()->point().x()),
-		   CGAL::to_double(hit->vertex()->point().y()),
-		   CGAL::to_double(hit->opposite()->vertex()->point().x()),
-		   CGAL::to_double(hit->opposite()->vertex()->point().y()));
-    if ( hit->mark() ) PS.set_color(leda_black);
-    else               PS.set_color(leda_grey1);
-    PS << s;
-  }
-
-  PS.set_node_width(3);
-  Vertex_const_iterator v;
-  for (v = D.vertices_begin(); v != D.vertices_end(); ++v) {
-    leda_point p(CGAL::to_double(v->point().x()),
-		 CGAL::to_double(v->point().y()));
-    leda_color pc;
-    if ( v->mark() ) pc = leda_black;
-    else             pc = leda_grey1;
-    PS.draw_filled_node(p,pc);
-  }
-
-
-  return PS;
-}
-
-} //namespace CGAL
-
-#endif // CGAL_NEF_POLYHEDRON_2_PS_STREAM_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Nef_polyhedron_S2_OGLUT_stream.h b/3rdparty/CGAL-4.8/include/CGAL/IO/Nef_polyhedron_S2_OGLUT_stream.h
deleted file mode 100644
index b7634d0..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/IO/Nef_polyhedron_S2_OGLUT_stream.h
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright (c) 1997-2000  Max-Planck-Institute Saarbruecken (Germany).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Michael Seel <seel at mpi-sb.mpg.de>
-
-#ifndef CGAL_NEF_POLYHEDRON_S2_OGLUT_STREAM_H
-#define CGAL_NEF_POLYHEDRON_S2_OGLUT_STREAM_H
-
-#include <CGAL/Nef_polyhedron_S2.h>
-#include <CGAL/Nef_S2/SM_visualizor.h>
-#include <string>
-
-namespace CGAL {
-
-
-struct OGLUT_stream { // dummy class
-  OGLUT_stream() {}
-  void display() { CGAL::OGL::start_viewer(); }
-};
-
-static OGLUT_stream ogl;
-
-template <typename K,typename I,typename M>
-CGAL::OGLUT_stream& operator<<(CGAL::OGLUT_stream& ogls, 
-			       const Nef_polyhedron_S2<K,I,M>& P)
-{
-  typedef Nef_polyhedron_S2<K,I,M> Polyhedron;
-  typedef typename Polyhedron::Sphere_map Sphere_map;
-  typedef typename Polyhedron::Sphere_kernel Sphere_kernel;
-  typedef CGAL::SM_visualizor<Polyhedron> Visualizor;
-  CGAL::OGL::add_sphere();
-  Visualizor V(&P,CGAL::OGL::spheres_.back()); V.draw_map();
-  // CGAL::OGL::spheres_.back().print();
-  return ogls;
-}
-
-static CGAL::OGLUT_stream& operator<<(CGAL::OGLUT_stream& ogls, 
-			              const char* s)
-{
-  CGAL::OGL::titles_.push_back(std::string(s));
-  return ogls;
-}
-
-} //namespace CGAL
-
-#endif // CGAL_NEF_POLYHEDRON_S2_OGLUT_STREAM_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Nef_polyhedron_iostream_S2.h b/3rdparty/CGAL-4.8/include/CGAL/IO/Nef_polyhedron_iostream_S2.h
deleted file mode 100644
index 2be0d48..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/IO/Nef_polyhedron_iostream_S2.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) 1997-2000  Max-Planck-Institute Saarbruecken (Germany).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Peter Hachenberger <hachenberger at mpi-sb.mpg.de>
-
-#ifndef CGAL_NEF_POLYHEDRON_IOSTREAM_3_H
-#define CGAL_NEF_POLYHEDRON_IOSTREAM_3_H
-
-#include <CGAL/Nef_polyhedron_S2.h>
-#include <CGAL/Nef_3/SM_io_parser.h>
-
-namespace CGAL {
-
-/*
-template <typename Kernel, typename Items, typename Mark, typename Map>
-std::ostream& operator<<
- (std::ostream& os, Nef_polyhedron_3<Kernel,Items,Mark>& NP)
-{
-  typedef typename Nef_polyhedron_3<Kernel,Items, Mark>::SNC_structure SNC_structure;
-#ifdef CGAL_NEF3_SORT_OUTPUT
-  CGAL::SNC_io_parser<SNC_structure> O(os, NP.snc(), true, true);
-#else
-  CGAL::SNC_io_parser<SNC_structure> O(os, NP.snc(), false, true);
-#endif
-  O.print();
-  return os;
-}
-*/
-
-template <typename Kernel, typename Items, typename Mark, typename SMap>
-std::istream& operator>>
-  (std::istream& is, Nef_polyhedron_S2<Kernel,Items, Mark, SMap>& NP)
-{
-  typedef typename Nef_polyhedron_S2<Kernel,Items,Mark, SMap>::Sphere_map Sphere_map;
-  CGAL::SM_io_parser<Sphere_map> I(is, NP.sphere_map());
-  I.read();
-  return is;
-}
-
-} //namespace CGAL
-
-#endif //CGAL_NEF_POLYHEDRON_IOSTREAM_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/OFF_reader.h b/3rdparty/CGAL-4.8/include/CGAL/IO/OFF_reader.h
deleted file mode 100644
index 75fb783..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/IO/OFF_reader.h
+++ /dev/null
@@ -1,100 +0,0 @@
-// Copyright (c) 2015 GeometryFactory
-//
-// 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(s)     : Laurent Rineau and Sebastien Loriot
-
-#ifndef CGAL_IO_OFF_READER_H
-#define CGAL_IO_OFF_READER_H
-
-#include <CGAL/IO/File_scanner_OFF.h>
-
-#include <vector>
-#include <iostream>
-#include <CGAL/array.h>
-#include <CGAL/assertions.h>
-#include <CGAL/use.h>
-
-namespace CGAL{
-
-  namespace read_OFF_internal{
-    template <class Point_3>
-    void fill_point(double x, double y, double z, Point_3& pt)
-    {
-      pt = Point_3(x, y, z);
-    }
-
-    void fill_point(double x, double y, double z, CGAL::cpp11::array<double,3>& p)
-    {
-      p = CGAL::make_array(x,y,z);
-    }
-
-    template <class Polygon_3>
-    void resize(Polygon_3& p, std::size_t size)
-    {
-      p.resize(size);
-    }
-
-    template <std::size_t N, class INT>
-    void resize(CGAL::cpp11::array<INT, N>&, std::size_t size)
-    {
-      CGAL_USE(size);
-      CGAL_assertion( size>=N );
-    }
-  }
-
-  template <class Point_3, class Polygon_3>
-  bool
-  read_OFF( std::istream& in,
-            std::vector< Point_3 >& points,
-            std::vector< Polygon_3 >& polygons,
-            bool /* verbose */ = false)
-  {
-    CGAL::File_scanner_OFF scanner(in);
-
-    points.resize(scanner.size_of_vertices());
-    polygons.resize(scanner.size_of_facets());
-    for (std::size_t i = 0; i < scanner.size_of_vertices(); ++i) {
-      double x, y, z, w;
-      scanner.scan_vertex( x, y, z, w);
-      CGAL_assertion(w!=0);
-      read_OFF_internal::fill_point( x/w, y/w, z/w, points[i] );
-      scanner.skip_to_next_vertex( i);
-    }
-    if(!in)
-      return false;
-
-    for (std::size_t i = 0; i < scanner.size_of_facets(); ++i) {
-      std::size_t no;
-
-      scanner.scan_facet( no, i);
-      read_OFF_internal::resize(polygons[i], no);
-      for(std::size_t j = 0; j < no; ++j) {
-        std::size_t id;
-        scanner.scan_facet_vertex_index(id, i);
-        if(id < scanner.size_of_vertices())
-        {
-          polygons[i][j] = id;
-        }
-        else
-          return false;
-      }
-    }
-    return in.good();
-  }
-
-} // namespace CGAL
-
-#endif // CGAL_IO_OFF_READER_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Polyhedron_scan_OFF.h b/3rdparty/CGAL-4.8/include/CGAL/IO/Polyhedron_scan_OFF.h
deleted file mode 100644
index 0d23b13..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/IO/Polyhedron_scan_OFF.h
+++ /dev/null
@@ -1,144 +0,0 @@
-// Copyright (c) 1997  ETH Zurich (Switzerland).
-// 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
-// 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(s)     : Lutz Kettner  <kettner at mpi-sb.mpg.de>
-
-#ifndef CGAL_IO_POLYHEDRON_SCAN_OFF_H
-#define CGAL_IO_POLYHEDRON_SCAN_OFF_H 1
-
-#include <CGAL/basic.h>
-#include <CGAL/IO/File_header_OFF.h>
-#include <CGAL/IO/File_scanner_OFF.h>
-#include <CGAL/Modifier_base.h>
-#include <CGAL/Polyhedron_incremental_builder_3.h>
-#include <CGAL/Polyhedron_3.h>
-#include <iostream>
-#include <cstddef>
-
-namespace CGAL {
-
-template < class HDS>
-class Polyhedron_scan_OFF :  public Modifier_base<HDS> {
-protected:
-    std::istream&    m_in;
-    File_header_OFF  m_file_header;
-public:
-
-    typedef HDS Halfedge_data_structure;
-
-// DEFINITION
-//
-// Polyhedron_scan_OFF<Traits> is a polyhedral surface builder.
-// It scans a polyhedron given in OFF from a stream and appends it
-// incrementally using the incremental builder.
-
-    Polyhedron_scan_OFF( std::istream& in, bool verbose = false)
-        : m_in(in), m_file_header( verbose) {}
-
-    // Activation
-    void operator()( HDS& hds);
-
-    const File_header_OFF&  header() const { return m_file_header; }
-};
-
-template < class HDS >
-void
-Polyhedron_scan_OFF<HDS>:: operator()( HDS& target) {
-    File_scanner_OFF scanner( m_in, m_file_header.verbose());
-    if ( ! m_in) {
-        if ( scanner.verbose()) {
-            std::cerr << " " << std::endl;
-            std::cerr << "Polyhedron_scan_OFF<HDS>::" << std::endl;
-            std::cerr << "operator(): input error: file format is not in "
-                         "OFF." << std::endl;
-        }
-        return;
-    }
-    m_file_header = scanner;  // Remember file header after return.
-
-    Polyhedron_incremental_builder_3<HDS> B( target, scanner.verbose());
-    B.begin_surface( scanner.size_of_vertices(),
-                     scanner.size_of_facets(),
-                     scanner.size_of_halfedges());
-
-    typedef typename HDS::Traits     Traits;
-    typedef typename Traits::Point_3 Point;
-
-    // read in all vertices
-    std::size_t  i;
-    for ( i = 0; i < scanner.size_of_vertices(); i++) {
-        Point p;
-        file_scan_vertex( scanner, p);
-        B.add_vertex( p);
-        scanner.skip_to_next_vertex( i);
-    }
-    if ( ! m_in  || B.error()) {
-        B.rollback();
-        m_in.clear( std::ios::badbit);
-        return;
-    }
-
-    // read in all facets
-    for ( i = 0; i < scanner.size_of_facets(); i++) {
-        B.begin_facet();
-        std::size_t no;
-        scanner.scan_facet( no, i);
-        if( ! m_in || B.error() || no < 3) {
-            if ( scanner.verbose()) {
-                std::cerr << " " << std::endl;
-                std::cerr << "Polyhedron_scan_OFF<Traits>::" << std::endl;
-                std::cerr << "operator()(): input error: facet " << i
-                     << " has less than 3 vertices." << std::endl;
-            }
-            B.rollback();
-            m_in.clear( std::ios::badbit);
-            return;
-        }
-        for ( std::size_t j = 0; j < no; j++) {
-            std::size_t index;
-            scanner.scan_facet_vertex_index( index, i);
-            B.add_vertex_to_facet( index);
-        }
-        B.end_facet();
-        scanner.skip_to_next_facet( i);
-    }
-    if ( ! m_in  || B.error()) {
-        B.rollback();
-        m_in.clear( std::ios::badbit);
-        return;
-    }
-    if ( B.check_unconnected_vertices()) {
-        if ( ! B.remove_unconnected_vertices()) {
-            if ( scanner.verbose()) {
-                std::cerr << " " << std::endl;
-                std::cerr << "Polyhedron_scan_OFF<Traits>::" << std::endl;
-                std::cerr << "operator()(): input error: cannot "
-                             "successfully remove isolated vertices."
-                          << std::endl;
-            }
-            B.rollback();
-            m_in.clear( std::ios::badbit);
-            return;
-        }
-    }
-    B.end_surface();
-}
-
-} //namespace CGAL
-#endif // CGAL_IO_POLYHEDRON_SCAN_OFF_H //
-// EOF //
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/STL_reader.h b/3rdparty/CGAL-4.8/include/CGAL/IO/STL_reader.h
deleted file mode 100644
index 04eae64..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/IO/STL_reader.h
+++ /dev/null
@@ -1,148 +0,0 @@
-// Copyright (c) 2015 GeometryFactory
-//
-// 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(s)     : Andreas Fabri
-
-#ifndef CGAL_IO_STL_READER_H
-#define CGAL_IO_STL_READER_H
-
-#include <CGAL/array.h>
-#include <boost/cstdint.hpp> 
-#include <vector>
-#include <map>
-#include <iostream>
-#include <string>
-
-namespace CGAL{
-
-  bool
-  read_STL( std::istream& input,
-            std::vector< cpp11::array<double,3> >& points,
-            std::vector< cpp11::array<int,3> >& facets,
-            bool verbose = false)
-  {
-    std::string s, solid("solid");
-    std::map<cpp11::array<double,3>, int> pmap;
-    int index = 0;
-    cpp11::array<int,3> ijk;
-    cpp11::array<double,3> p;
-
-    char line[80];
-    for(int i=0;i < 80; i++){
-      boost::uint8_t c;
-      input.read(reinterpret_cast<char*>(&c), sizeof(c));
-      line[i]=c;
-      if(i==5){
-        s = std::string(line,5);
-        if(s == solid){
-          break;
-        }
-      }
-    }
-
-    if(s!= solid){
-      boost::uint32_t N32;
-      input.read(reinterpret_cast<char*>(&N32), sizeof(N32));
-      unsigned int N = N32;
-
-      for(unsigned int i=0; i < N; i++){
-        float normal[3];
-        input.read(reinterpret_cast<char*>(&normal[0]), sizeof(normal[0]));
-        input.read(reinterpret_cast<char*>(&normal[1]), sizeof(normal[1]));
-        input.read(reinterpret_cast<char*>(&normal[2]), sizeof(normal[2]));
-
-        for(int j=0; j < 3; j++){
-          float x,y,z;
-          input.read(reinterpret_cast<char*>(&x), sizeof(x));
-          input.read(reinterpret_cast<char*>(&y), sizeof(y));
-          input.read(reinterpret_cast<char*>(&z), sizeof(z));
-          p[0]=x; p[1]=y; p[2]=z;
-          std::map<cpp11::array<double,3>, int>::iterator iti=
-            pmap.insert(std::make_pair(p,-1)).first;
-          if(iti->second==-1){
-            ijk[j] = index;
-            iti->second = index++;
-            points.push_back(p);
-          } else {
-            ijk[j] = iti->second;
-          }
-        }
-        facets.push_back(ijk);
-        char c;
-        input.read(reinterpret_cast<char*>(&c), sizeof(c));
-        input.read(reinterpret_cast<char*>(&c), sizeof(c));
-      }
-      return true;
-    } else {
-      std::string facet("facet"),
-        outer("outer"),
-        loop("loop"),
-        vertex("vertex"),
-        endloop("endloop"),
-        endsolid("endsolid");
-
-      while(input >> s){
-        if(s == endsolid){
-          //std::cerr << "found endsolid" << std::endl;
-        } else if(s == facet){
-          //std::cerr << "found facet" << std::endl;
-          std::getline(input, s); // ignore the normal
-          input >> s;
-          if(s != outer){
-            if (verbose)
-              std::cerr << "Expect 'outer' and got " << s << std::endl;
-            return false;
-          }
-          input >> s;
-          if(s != loop){
-            if (verbose)
-              std::cerr << "Expect 'loop' and got " << s << std::endl;
-            return false;
-          }
-          int count = 0;
-          do {
-            input >> s;
-            if(s == vertex){
-              //      std::cerr << "found vertex" << std::endl;
-              if(count < 3){
-                input >> p[0] >> p[1] >> p[2];
-                std::map<cpp11::array<double,3>, int>::iterator iti=
-                  pmap.insert(std::make_pair(p,-1)).first;
-                if(iti->second==-1){
-                  ijk[count] = index;
-                  iti->second = index++;
-                  points.push_back(p);
-                } else {
-                  ijk[count] = iti->second;
-                }
-                ++count;
-              } else {
-                if (verbose)
-                  std::cerr << "We can only read triangulated surfaces" << std::endl;
-                return false;
-              }
-            }
-          }while(s != endloop);
-          
-          facets.push_back(ijk);
-        }
-      }
-      return true;
-    }
-  }
-} // namespace CGAL
-
-#endif // CGAL_IO_STL_READER_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/io.h b/3rdparty/CGAL-4.8/include/CGAL/IO/io.h
deleted file mode 100644
index 9f7be26..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/IO/io.h
+++ /dev/null
@@ -1,535 +0,0 @@
-// Copyright (c) 1997  
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved. 
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Andreas Fabri
-
-
-#ifndef CGAL_IO_H
-#define CGAL_IO_H
-
-
-#include <cstdio>
-#include <cctype>
-#include <string>
-#include <locale>
-#include <iostream>
-#include <CGAL/tags.h>
-#include <CGAL/IO/io_tags.h>
-#include <CGAL/IO/Color.h>
-#include <CGAL/assertions.h>
-
-
-namespace CGAL {
-
-class IO {
-public:
-#ifndef CGAL_HEADER_ONLY
-  CGAL_EXPORT static int mode;
-  static int& get_static_mode()
-  { return IO::mode; }
-#else // CGAL_HEADER_ONLY
-  static int& get_static_mode()
-  {
-    static int mode = std::ios::xalloc();
-    return mode;
-  }
-#endif // CGAL_HEADER_ONLY
-    enum Mode {ASCII = 0, PRETTY, BINARY};
-};
-
-template <class T, class F = ::CGAL::Null_tag >
-class Output_rep {
-    const T& t;
-public:
-    //! initialize with a const reference to \a t.
-    Output_rep( const T& tt) : t(tt) {}
-    //! perform the output, calls \c operator\<\< by default.
-    std::ostream& operator()( std::ostream& out) const { return (out << t); }
-};
-
-/*! \relates Output_rep
-    \brief stream output of the \c Output_rep calls its \c operator().
-*/
-template <class T, class F>
-std::ostream&
-operator<<( std::ostream& out, Output_rep<T,F> rep) {
-    return rep( out);
-}
-
-//! generic IO output format manipulator.
-template <class T>
-Output_rep<T>
-oformat( const T& t) { return Output_rep<T>(t); }
-
-//! generic IO output format manipulator with formatting tag.
-template <class T, class F>
-Output_rep<T,F>
-oformat( const T& t, F) { return Output_rep<T,F>(t); }
-
-
-
-/*!\brief
- * input functor class created by the generic IO input manipulator.
- *
- * It holds a reference to the input object. Default implementation
- * calls the stream input operator. Specializations can be written
- * for external types not supporting our stream IO format.
- */
-template <class T>
-class Input_rep {
-    T& t;
-public:
-    //! initialize with a reference to \a t.
-    Input_rep( T& tt) : t(tt) {}
-    //! perform the input, calls \c operator\>\> by default.
-    std::istream& operator()( std::istream& in) const { return (in >> t); }
-};
-
-#if CGAL_FORCE_IFORMAT_DOUBLE || \
-  ( ( _MSC_VER > 1600 ) && (! defined( CGAL_NO_IFORMAT_DOUBLE )) )
-template <>
-class Input_rep<double> {
-    double& t;
-public:
-  //! initialize with a reference to \a t.
-  Input_rep( double& tt) : t(tt) {}
-
-  std::istream& operator()( std::istream& is) const 
-  {
-    typedef std::istream istream;
-    typedef istream::char_type char_type;
-    typedef istream::int_type int_type;
-    typedef istream::traits_type traits_type;
-
-    std::string buffer;
-    buffer.reserve(32);
-
-    char_type c;
-    do {
-      const int_type i = is.get();
-      if(i == traits_type::eof()) {
-	return is;
-      }
-      c = static_cast<char_type>(i);
-    }while (std::isspace(c));
-    if(c == '-'){
-      buffer += '-';
-    } else if(c != '+'){
-      is.unget();
-    }
-    do {
-      const int_type i = is.get();
-      if(i == traits_type::eof()) {
-	is.clear(is.rdstate() & ~std::ios_base::failbit);
-	break;
-      }
-      c = static_cast<char_type>(i);
-      if(std::isdigit(c) || (c =='.') || (c =='E') || (c =='e') || (c =='+') || (c =='-')){
-        buffer += c;
-      }else{
-	is.unget();
-	break;
-      }
-    }while(true);
-
-    if(sscanf(buffer.c_str(), "%lf", &t) != 1) {
-      // if a 'buffer' does not contain a double, set the fail bit.
-      is.setstate(std::ios_base::failbit);
-    }
-    return is; 
-  }
-};
-#endif
-
-/*! \relates Input_rep
-    \brief stream input to the \c Input_rep calls its \c operator().
-*/
-template <class T>
-std::istream&
-operator>>( std::istream& in, Input_rep<T> rep) {
-    return rep( in);
-}
-
-//! generic IO input format manipulator.
-template <class T>
-Input_rep<T>
-iformat( T& t) { return Input_rep<T>(t); }
-
-
-template <class T, class F = Null_tag >
-class Benchmark_rep {
-    const T& t;
-public:
-    //! initialize with a const reference to \a t.
-    Benchmark_rep( const T& tt) : t(tt) {}
-    //! perform the output, calls \c operator\<\< by default.
-    std::ostream& operator()( std::ostream& out) const {
-        return out << t;
-    }
-    
-    // static function to get the benchmark name
-    static std::string get_benchmark_name() {
-        return "";
-    }
-};
-
-template <class T, class F>
-std::ostream& operator<<( std::ostream& out, Benchmark_rep<T,F> rep) {
-    return rep( out);
-}
-
-template <class T>
-Benchmark_rep<T> bmformat( const T& t) { return Benchmark_rep<T>(t); }
-
-template <class T, class F>
-Benchmark_rep<T,F> bmformat( const T& t, F) { return Benchmark_rep<T,F>(t); }
-
-
-CGAL_EXPORT
-IO::Mode
-get_mode(std::ios& i);
-
-CGAL_EXPORT
-IO::Mode
-set_ascii_mode(std::ios& i);
-
-CGAL_EXPORT
-IO::Mode
-set_binary_mode(std::ios& i);
-
-CGAL_EXPORT
-IO::Mode
-set_pretty_mode(std::ios& i);
-
-CGAL_EXPORT
-IO::Mode
-set_mode(std::ios& i, IO::Mode m);
-
-CGAL_EXPORT
-bool
-is_pretty(std::ios& i);
-
-CGAL_EXPORT
-bool
-is_ascii(std::ios& i);
-
-CGAL_EXPORT
-bool
-is_binary(std::ios& i);
-
-
-template < class T >
-inline
-void
-write(std::ostream& os, const T& t, const io_Read_write&)
-{
-    os.write(reinterpret_cast<const char*>(&t), sizeof(t));
-}
-
-
-template < class T >
-inline
-void
-write(std::ostream& os, const T& t, const io_Operator&)
-{
-    os << oformat(t);
-}
-
-
-template < class T >
-inline
-void
-write(std::ostream& os, const T& t, const io_Extract_insert&)
-{
-    insert(os, t);
-}
-
-
-template < class T >
-inline
-void
-write(std::ostream& os, const T& t)
-{
-    write(os, t, typename Io_traits<T>::Io_tag());
-}
-
-
-template < class T >
-inline
-void
-read(std::istream& is, T& t, const io_Read_write&)
-{
-    is.read(reinterpret_cast<char*>(&t), sizeof(t));
-}
-
-
-template < class T >
-inline
-void
-read(std::istream& is, T& t, const io_Operator&)
-{
-    is >> iformat(t);
-}
-
-
-template < class T >
-inline
-void
-read(std::istream& is, T& t, const io_Extract_insert&)
-{
-    extract(is, t);
-}
-
-
-template < class T >
-inline
-void
-read(std::istream& is, T& t)
-{
-    read(is, t, typename Io_traits<T>::Io_tag());
-}
-
-
-inline
-std::ostream& operator<<( std::ostream& out, const Color& col)
-{
-    switch(get_mode(out)) {
-    case IO::ASCII :
-        return out << static_cast<int>(col.red())   << ' '
-		   << static_cast<int>(col.green()) << ' '
-		   << static_cast<int>(col.blue());
-    case IO::BINARY :
-        write(out, static_cast<int>(col.red()));
-        write(out, static_cast<int>(col.green()));
-        write(out, static_cast<int>(col.blue()));
-        return out;
-    default:
-        return out << "Color(" << static_cast<int>(col.red()) << ", "
-		   << static_cast<int>(col.green()) << ", "
-                   << static_cast<int>(col.blue()) << ')';
-    }
-}
-
-inline
-std::istream &operator>>(std::istream &is, Color& col)
-{
-    int r = 0, g = 0, b = 0;
-    switch(get_mode(is)) {
-    case IO::ASCII :
-        is >> r >> g >> b;
-        break;
-    case IO::BINARY :
-        read(is, r);
-        read(is, g);
-        read(is, b);
-        break;
-    default:
-        std::cerr << "" << std::endl;
-        std::cerr << "Stream must be in ascii or binary mode" << std::endl;
-        break;
-    }
-    col = Color((unsigned char)r,(unsigned char)g,(unsigned char)b);
-    return is;
-}
-
-CGAL_EXPORT
-const char* mode_name( IO::Mode m );
-
-// From polynomial.h TODO: Where to put this?
-CGAL_EXPORT
-void swallow(std::istream &is, char d);
-
-CGAL_EXPORT
-void swallow(std::istream &is, const std::string& s );
-
-
-  namespace internal {
-inline
-void eat_white_space(std::istream &is)
-{
-  std::istream::int_type c;
-  do {
-    c= is.peek();
-    if (c== std::istream::traits_type::eof())
-      return;
-    else {
-      std::istream::char_type cc= c;
-      if ( std::isspace(cc, std::locale::classic()) ) {
-        is.get();
-        // since peek succeeded, this should too
-        CGAL_assertion(!is.fail());
-      } else {
-        return;
-      }
-    }
-  } while (true);
-}
- 
-
-  inline
-  bool is_space (const std::istream& /*is*/, std::istream::int_type c)
-  {
-    std::istream::char_type cc= c;
-    return (c == std::istream::traits_type::eof()) ||
-           std::isspace(cc, std::locale::classic() );
-  }
-
-  inline
-  bool is_eof (const std::istream& /*is*/, std::istream::int_type c)
-  {
-    return c == std::istream::traits_type::eof();
-  }
-
-  inline
-  bool is_digit (const std::istream& /*is*/, std::istream::int_type c)
-  {
-    std::istream::char_type cc= c;
-    return std::isdigit(cc, std::locale::classic() );
-  }
-
-  inline std::istream::int_type peek(std::istream& is)
-  {
-    // Workaround for a bug in the version of libc++ that is shipped with
-    // Apple-clang-3.2. See the long comment in the function
-    // gmpz_new_read() in <CGAL/GMP/Gmpz_type.h>.
-
-    if(is.eof())
-      return std::istream::traits_type::eof();
-    else
-      return is.peek();
-  }
-   
-    
-template <typename ET>
-inline void read_float_or_quotient(std::istream & is, ET& et)
-{
-  is >> et;
-}   
-
-
-
-template <typename Int, typename Rat>
-inline void read_float_or_quotient(std::istream& is, Rat &z)
-{
-  // reads rational and floating point literals.
-  const std::istream::char_type zero = '0';
-  std::istream::int_type c;
-  std::ios::fmtflags old_flags = is.flags();
-
-  is.unsetf(std::ios::skipws);
-  internal::eat_white_space(is);
-
-  Int n(0);             // unsigned number before '/' or '.'
-  Int d(1);             // number after '/', or denominator (fp-case)
-  bool negative = false; // do we have a leading '-'?
-  bool digits = false;   // for fp-case: are there any digits at all?
-
-  c = internal::peek(is);
-  if (c != '.') {
-    // is there a sign?
-    if (c == '-' || c == '+') {
-      is.get();
-      negative = (c == '-');
-      internal::eat_white_space(is);
-      c=internal::peek(is);
-    }
-    // read n (could be empty)
-    while (!internal::is_eof(is, c) && internal::is_digit(is, c)) {
-      digits = true;
-      n = n*10 + (c-zero);
-      is.get();
-      c = internal::peek(is);
-    }
-    // are we done?
-    if (internal::is_eof(is, c) || internal::is_space(is, c)) {
-      is.flags(old_flags);
-      if (digits && !is.fail())
-        z = negative? Rat(-n,1): Rat(n,1);
-      return;
-    }
-  } else
-    n = 0;
-
-  // now we have read n, we are not done, and c is the next character
-  // in the stream
-  if (c == '/' || c == '.') {
-    is.get();
-    if (c == '/') {
-      // rational case
-      is >> d;
-      is.flags(old_flags);
-      if (!is.fail())
-        z = negative? Rat(-n,d): Rat(n,d);
-      return;
-    }
-
-    // floating point case; read number after '.' (may be empty)
-    while (true) {
-      c = internal::peek(is);
-      if (internal::is_eof(is, c) || !internal::is_digit(is, c))
-        break;
-      // now we have a digit
-      is.get();
-      digits = true;
-      d *= 10;
-      n = n*10 + (c-zero);
-    }
-  }
-
-  // now we have read all digits after '.', and c is the next character;
-  // read the exponential part (optional)
-  int e = 0;
-  if (c == 'e' || c == 'E') {
-    is.get();
-    is >> e;
-  }
-
-  // now construct the Gmpq
-  if (!digits) {
-    // illegal floating-point number
-    is.setstate(std::ios_base::failbit);
-    is.flags(old_flags);
-    return;
-  }
-
-  // handle e
-  if (e > 0)
-    while (e--) n *= 10;
-  else
-    while (e++) d *= 10;
-  is.flags(old_flags);
-  if (!is.fail())
-    z = (negative ? Rat(-n,d) : Rat(n,d));
-
-} 
-    
-    
-  } // namespace internal
-
-} //namespace CGAL
-
-
-#ifdef CGAL_HEADER_ONLY
-#include <CGAL/IO/io_impl.h>
-#endif // CGAL_HEADER_ONLY
-
-#endif // CGAL_IO_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/read_off_points.h b/3rdparty/CGAL-4.8/include/CGAL/IO/read_off_points.h
deleted file mode 100644
index 3292385..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/IO/read_off_points.h
+++ /dev/null
@@ -1,436 +0,0 @@
-// Copyright (c) 2007-09  INRIA Sophia-Antipolis (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
-// 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(s) : Pierre Alliez and Laurent Saboret
-
-#ifndef CGAL_READ_OFF_POINTS_H
-#define CGAL_READ_OFF_POINTS_H
-
-#include <CGAL/property_map.h>
-#include <CGAL/value_type_traits.h>
-#include <CGAL/point_set_processing_assertions.h>
-
-#include <boost/version.hpp>
-#if BOOST_VERSION >= 104000
-  #include <boost/property_map/property_map.hpp>
-#else
-  #include <boost/property_map.hpp>
-#endif
-
-#include <iostream>
-#include <sstream>
-#include <string>
-
-namespace CGAL {
-
-
-//===================================================================================
-/// \ingroup PkgPointSetProcessing
-/// Reads points (positions + normals, if available) from a .off ASCII stream.
-/// The function expects for each point a line with the x y z position,
-/// optionally followed by the nx ny nz normal.
-/// Faces are ignored.
-///
-/// @tparam OutputIteratorValueType type of objects that can be put in `OutputIterator`.
-///         It is default to `value_type_traits<OutputIterator>::%type` and can be omitted when the default is fine.
-/// @tparam OutputIterator iterator over output points.
-/// @tparam PointPMap is a model of `WritablePropertyMap` with  value type `Point_3<Kernel>`.
-///        It can be omitted if the value type of `OutputIterator` is convertible to `Point_3<Kernel>`.
-/// @tparam NormalPMap is a model of `WritablePropertyMap` with value type `Vector_3<Kernel>`.
-/// @tparam Kernel Geometric traits class.
-///        It can be omitted and deduced automatically from the value type of `PointPMap`.
-///
-/// @return true on success.
-
-// This variant requires all parameters.
-//-----------------------------------------------------------------------------------
-template <typename OutputIteratorValueType,
-          typename OutputIterator,
-          typename PointPMap,
-          typename NormalPMap,
-          typename Kernel
->
-bool
-read_off_points_and_normals(
-    std::istream& stream, ///< input stream.
-    OutputIterator output, ///< output iterator over points.
-    PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
-    NormalPMap normal_pmap, ///< property map: value_type of OutputIterator -> Vector_3.
-    const Kernel& /*kernel*/) ///< geometric traits.
-{
-  // value_type_traits is a workaround as back_insert_iterator's value_type is void
-  // typedef typename value_type_traits<OutputIterator>::type Enriched_point;
-  typedef OutputIteratorValueType Enriched_point;
-
-  typedef typename Kernel::Point_3 Point;
-  typedef typename Kernel::Vector_3 Vector;
-
-  if(!stream)
-  {
-    std::cerr << "Error: cannot open file" << std::endl;
-    return false;
-  }
-
-  // scan points
-  long pointsCount = 0, facesCount = 0, edgesCount = 0; // number of items in file
-  int pointsRead = 0; // current number of points read
-  int lineNumber = 0; // current line number
-  std::string line;
-  std::istringstream iss;
-  while(getline(stream,line))
-  {
-    iss.clear();
-    iss.str(line);
-
-    // Ignore empty lines and comments
-    if (line.empty () || line[0] == '#')
-      continue;
-
-    lineNumber++;
-
-    // Reads file signature on first line
-    if (lineNumber == 1)
-    {
-      std::string signature;
-      if ( !(iss >> signature)
-        || (signature != "OFF" && signature != "NOFF") )
-      {
-        // if wrong file format
-        std::cerr << "Incorrect file format line " << lineNumber << " of file" << std::endl;
-        return false;
-      }
-    }
-
-    // Reads number of points on 2nd line
-    else if (lineNumber == 2)
-    {
-      if ( !(iss >> pointsCount >> facesCount >> edgesCount) )
-      {
-        std::cerr << "Error line " << lineNumber << " of file" << std::endl;
-        return false;
-      }
-    }
-
-    // Reads 3D points on next lines
-    else if (pointsRead < pointsCount)
-    {
-      // Reads position + normal...
-      double x,y,z;
-      double nx,ny,nz;
-      if (iss >> iformat(x) >> iformat(y) >> iformat(z))
-      {
-        Point point(x,y,z);
-        Vector normal = CGAL::NULL_VECTOR;
-        // ... + normal...
-        if (iss >> iformat(nx))
-        {
-          // In case we could read one number, we expect that there are two more
-          if(iss  >> iformat(ny) >> iformat(nz)){
-            normal = Vector(nx,ny,nz);
-          } else {
-            std::cerr << "Error line " << lineNumber << " of file" << std::endl;
-            return false;
-          }
-        }
-        Enriched_point pwn;
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-        put(point_pmap,  &pwn, point);  // point_pmap[&pwn] = point
-        put(normal_pmap, &pwn, normal); // normal_pmap[&pwn] = normal
-#else
-        put(point_pmap,  pwn, point);  // point_pmap[&pwn] = point
-        put(normal_pmap, pwn, normal); // normal_pmap[&pwn] = normal
-#endif
-        *output++ = pwn;
-        pointsRead++;
-      }
-      // ...or skip comment line
-    }
-    // Skip remaining lines
-  }
-
-  return true;
-}
-
-/// @cond SKIP_IN_MANUAL
-template <typename OutputIterator,
-          typename PointPMap,
-          typename NormalPMap,
-          typename Kernel
->
-bool
-read_off_points_and_normals(
-  std::istream& stream, ///< input stream.
-  OutputIterator output, ///< output iterator over points.
-  PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
-  NormalPMap normal_pmap, ///< property map: value_type of OutputIterator -> Vector_3.
-  const Kernel& kernel) ///< geometric traits.
-{
-  // just deduce value_type of OutputIterator
-  return read_off_points_and_normals
-    <typename value_type_traits<OutputIterator>::type>(
-    stream,
-    output,
-    point_pmap,
-    normal_pmap,
-    kernel);
-}
-//-----------------------------------------------------------------------------------
-/// @endcond
-
-/// @cond SKIP_IN_MANUAL
-// This variant deduces the kernel from the point property map.
-//-----------------------------------------------------------------------------------
-template <typename OutputIteratorValueType,
-          typename OutputIterator,
-          typename PointPMap,
-          typename NormalPMap
->
-bool
-read_off_points_and_normals(
-  std::istream& stream, ///< input stream.
-  OutputIterator output, ///< output iterator over points.
-  PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
-  NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
-{
-  typedef typename boost::property_traits<PointPMap>::value_type Point;
-  typedef typename Kernel_traits<Point>::Kernel Kernel;
-  return read_off_points_and_normals
-    <OutputIteratorValueType>(
-    stream,
-    output,
-    point_pmap,
-    normal_pmap,
-    Kernel());
-}
-
-template <typename OutputIterator,
-          typename PointPMap,
-          typename NormalPMap
->
-bool
-read_off_points_and_normals(
-  std::istream& stream, ///< input stream.
-  OutputIterator output, ///< output iterator over points.
-  PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
-  NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
-{
-  // just deduce value_type of OutputIterator
-  return read_off_points_and_normals
-    <typename value_type_traits<OutputIterator>::type>(
-    stream,
-    output,
-    point_pmap,
-    normal_pmap);
-}
-//-----------------------------------------------------------------------------------
-/// @endcond
-
-/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Identity_property_map.
-//-----------------------------------------------------------------------------------
-template <typename OutputIteratorValueType,
-          typename OutputIterator,
-          typename NormalPMap
->
-bool
-read_off_points_and_normals(
-  std::istream& stream, ///< input stream.
-  OutputIterator output, ///< output iterator over points.
-  NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
-{
-  return read_off_points_and_normals
-    <OutputIteratorValueType>(
-    stream,
-    output,
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-    make_dereference_property_map(output),
-#else
-    make_identity_property_map(OutputIteratorValueType()),
-#endif
-    normal_pmap);
-}
-
-template <typename OutputIterator,
-          typename NormalPMap
->
-bool
-read_off_points_and_normals(
-  std::istream& stream, ///< input stream.
-  OutputIterator output, ///< output iterator over points.
-  NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
-{
-  // just deduce value_type of OutputIterator
-  return read_off_points_and_normals
-    <typename value_type_traits<OutputIterator>::type>(
-    stream,
-    output,
-    normal_pmap);
-}
-//-----------------------------------------------------------------------------------
-/// @endcond
-
-
-//===================================================================================
-/// \ingroup PkgPointSetProcessing
-/// Reads points (position only) from a .off ASCII stream.
-/// The function expects for each point a line with the x y z position.
-/// If the position is followed by the nx ny nz normal, then the normal will be ignored.
-/// Faces are ignored.
-///
-/// @tparam OutputIteratorValueType type of objects that can be put in `OutputIterator`.
-///         It is default to `value_type_traits<OutputIterator>::%type` and can be omitted when the default is fine.
-/// @tparam OutputIterator iterator over output points.
-/// @tparam PointPMap is a model of `WritablePropertyMap` with  value_type `Point_3<Kernel>`.
-///        It can be omitted if the value type of `OutputIterator` is convertible to `Point_3<Kernel>`.
-/// @tparam Kernel Geometric traits class.
-///        It can be omitted and deduced automatically from  the value type of `PointPMap`.
-///
-/// @return `true` on success.
-
-// This variant requires all parameters.
-//-----------------------------------------------------------------------------------
-template <typename OutputIteratorValueType,
-          typename OutputIterator,
-          typename PointPMap,
-          typename Kernel
->
-bool
-read_off_points(
-  std::istream& stream, ///< input stream.
-  OutputIterator output, ///< output iterator over points.
-  PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
-  const Kernel& kernel) ///< geometric traits.
-{
-  // Calls read_off_points_and_normals() with a normal property map = boost::dummy_property_map
-  return read_off_points_and_normals
-    <OutputIteratorValueType>(
-    stream,
-    output,
-    point_pmap,
-    boost::dummy_property_map(),
-    kernel);
-}
-
-/// @cond SKIP_IN_MANUAL
-template <typename OutputIterator,
-          typename PointPMap,
-          typename Kernel
->
-bool
-read_off_points(
-  std::istream& stream, ///< input stream.
-  OutputIterator output, ///< output iterator over points.
-  PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
-  const Kernel& kernel) ///< geometric traits.
-{
-  // just deduce value_type of OutputIterator
-  return read_off_points
-    <typename value_type_traits<OutputIterator>::type>(
-    stream,
-    output,
-    point_pmap,
-    kernel);
-}
-//-----------------------------------------------------------------------------------
-/// @endcond
-
-/// @cond SKIP_IN_MANUAL
-// This variant deduces the kernel from the point property map.
-//-----------------------------------------------------------------------------------
-template <typename OutputIteratorValueType,
-          typename OutputIterator,
-          typename PointPMap
->
-bool
-read_off_points(
-  std::istream& stream, ///< input stream.
-  OutputIterator output, ///< output iterator over points.
-  PointPMap point_pmap) ///< property map: value_type of OutputIterator -> Point_3.
-{
-  typedef typename boost::property_traits<PointPMap>::value_type Point;
-  typedef typename Kernel_traits<Point>::Kernel Kernel;
-  return read_off_points
-    <OutputIteratorValueType>(
-    stream,
-    output,
-    point_pmap,
-    Kernel());
-}
-
-template <typename OutputIterator,
-          typename PointPMap
->
-bool
-read_off_points(
-  std::istream& stream, ///< input stream.
-  OutputIterator output, ///< output iterator over points.
-  PointPMap point_pmap) ///< property map: value_type of OutputIterator -> Point_3.
-{
-  // just deduce value_type of OutputIterator
-  return read_off_points
-    <typename value_type_traits<OutputIterator>::type>(
-    stream,
-    output,
-    point_pmap);
-}
-//-----------------------------------------------------------------------------------
-/// @endcond
-
-/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Identity_property_map.
-//-----------------------------------------------------------------------------------
-template <typename OutputIteratorValueType,
-          typename OutputIterator
->
-bool
-read_off_points(
-  std::istream& stream, ///< input stream.
-  OutputIterator output) ///< output iterator over points.
-{
-  return read_off_points
-    <OutputIteratorValueType>(
-    stream,
-    output,
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-    make_dereference_property_map(output)
-#else
-    make_identity_property_map(OutputIteratorValueType())
-#endif
-    );
-}
-
-template <typename OutputIterator
->
-bool
-read_off_points(
-  std::istream& stream, ///< input stream.
-  OutputIterator output) ///< output iterator over points.
-{
-  // just deduce value_type of OutputIterator
-  return read_off_points
-    <typename value_type_traits<OutputIterator>::type>(
-    stream,
-    output);
-}
-//-----------------------------------------------------------------------------------
-
-/// @endcond
-
-
-} //namespace CGAL
-
-#endif // CGAL_READ_OFF_POINTS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/read_ply_points.h b/3rdparty/CGAL-4.8/include/CGAL/IO/read_ply_points.h
deleted file mode 100644
index ad772f2..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/IO/read_ply_points.h
+++ /dev/null
@@ -1,615 +0,0 @@
-// Copyright (c) 2015  Geometry Factory
-// 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
-// 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(s) : Simon Giraudot
-
-#ifndef CGAL_READ_PLY_POINTS_H
-#define CGAL_READ_PLY_POINTS_H
-
-#include <CGAL/property_map.h>
-#include <CGAL/value_type_traits.h>
-#include <CGAL/point_set_processing_assertions.h>
-
-#include <boost/version.hpp>
-#include <boost/cstdint.hpp>
-
-#include <iostream>
-#include <sstream>
-#include <string>
-
-
-namespace CGAL {
-
-
-// PLY types:
-// name        type        number of bytes
-// ---------------------------------------
-// char       character                 1
-// uchar      unsigned character        1
-// short      short integer             2
-// ushort     unsigned short integer    2
-// int        integer                   4
-// uint       unsigned integer          4
-// float      single-precision float    4
-// double     double-precision float    8
-
-namespace internal {
-
-  class Ply_read_number
-  {
-  protected:
-    std::string m_name;
-    std::size_t m_format;
-    
-  public:
-    Ply_read_number (std::string name, std::size_t format)
-      : m_name (name), m_format (format) { }
-    virtual ~Ply_read_number() { }
-
-    const std::string& name () const { return m_name; }
-
-    virtual double operator() (std::istream& stream) const = 0;
-
-    // The two following functions prevent the stream to only extract
-    // ONE character (= what the types char imply) by requiring
-    // explicitely an integer object when reading the stream
-    void read_ascii (std::istream& stream, boost::int8_t& c) const
-    {
-      short s;
-      stream >> s;
-      c = static_cast<char>(s);
-    }
-    void read_ascii (std::istream& stream, boost::uint8_t& c) const
-    {
-      unsigned short s;
-      stream >> s;
-      c = static_cast<unsigned char>(s);
-    }
-
-    // Default template when Type is not a char type
-    template <typename Type>
-    void read_ascii (std::istream& stream, Type& t) const
-    {
-      stream >> t;
-    }
-    
-    template <typename Type>
-    Type read (std::istream& stream) const
-    {
-      if (m_format == 0) // Ascii
-        {
-          Type t;
-          read_ascii (stream, t);
-          return t;
-        }
-      else // Binary (2 = little endian)
-        {
-          union
-          {
-            char uChar[sizeof (Type)];
-            Type type;
-          } buffer;
-          
-          std::size_t size = sizeof (Type);
-
-          stream.read(buffer.uChar, size);
-      
-          if (m_format == 2) // Big endian
-            {
-              for (std::size_t i = 0; i < size / 2; ++ i)
-                {
-                  unsigned char tmp = buffer.uChar[i];
-                  buffer.uChar[i] = buffer.uChar[size - 1 - i];
-                  buffer.uChar[size - 1 - i] = tmp;
-                }
-            }
-          return buffer.type;
-        }
-      return Type();
-    }
-  };
-
-  class Ply_read_char : public Ply_read_number
-  {
-  public:
-    Ply_read_char (std::string name, std::size_t format) : Ply_read_number (name, format) { }
-    double operator() (std::istream& stream) const
-    { return static_cast<double> (this->read<boost::int8_t> (stream)); }
-  };
-  class Ply_read_uchar : public Ply_read_number
-  {
-  public:
-    Ply_read_uchar (std::string name, std::size_t format) : Ply_read_number (name, format) { }
-    double operator() (std::istream& stream) const
-    { return static_cast<double> (this->read<boost::uint8_t> (stream)); }
-  };
-  class Ply_read_short : public Ply_read_number
-  {
-  public:
-    Ply_read_short (std::string name, std::size_t format) : Ply_read_number (name, format) { }
-    double operator() (std::istream& stream) const
-    { return static_cast<double> (this->read<boost::int16_t> (stream)); }
-  };
-  class Ply_read_ushort : public Ply_read_number
-  {
-  public:
-    Ply_read_ushort (std::string name, std::size_t format) : Ply_read_number (name, format) { }
-    double operator() (std::istream& stream) const
-    { return static_cast<double> (this->read<boost::uint16_t> (stream)); }
-  };
-  class Ply_read_int : public Ply_read_number
-  {
-  public:
-    Ply_read_int (std::string name, std::size_t format) : Ply_read_number (name, format) { }
-    double operator() (std::istream& stream) const
-    { return static_cast<double> (this->read<boost::int32_t> (stream)); }
-  };
-  class Ply_read_uint : public Ply_read_number
-  {
-  public:
-    Ply_read_uint (std::string name, std::size_t format) : Ply_read_number (name, format) { }
-    double operator() (std::istream& stream) const
-    { return static_cast<double> (this->read<boost::uint32_t> (stream)); }
-  };
-  class Ply_read_float : public Ply_read_number
-  {
-  public:
-    Ply_read_float (std::string name, std::size_t format) : Ply_read_number (name, format) { }
-    double operator() (std::istream& stream) const
-    { return static_cast<double> (this->read<float> (stream)); }
-  };
-  class Ply_read_double : public Ply_read_number
-  {
-  public:
-    Ply_read_double (std::string name, std::size_t format) : Ply_read_number (name, format) { }
-    double operator() (std::istream& stream) const
-    { return this->read<float> (stream); }
-  };
-
-
-
-} //namespace CGAL
-  
-//===================================================================================
-/// \ingroup PkgPointSetProcessing
-/// Reads points (positions + normals, if available) from a .ply
-/// stream (ASCII or binary).
-/// Potential additional point properties and faces are ignored.
-///
-/// @tparam OutputIteratorValueType type of objects that can be put in `OutputIterator`.
-///         It is default to `value_type_traits<OutputIterator>::%type` and can be omitted when the default is fine.
-/// @tparam OutputIterator iterator over output points.
-/// @tparam PointPMap is a model of `WritablePropertyMap` with  value type `Point_3<Kernel>`.
-///        It can be omitted if the value type of `OutputIterator` is convertible to `Point_3<Kernel>`.
-/// @tparam NormalPMap is a model of `WritablePropertyMap` with value type `Vector_3<Kernel>`.
-/// @tparam Kernel Geometric traits class.
-///        It can be omitted and deduced automatically from the value type of `PointPMap`.
-///
-/// @return true on success.
-
-// This variant requires all parameters.
-//-----------------------------------------------------------------------------------
-template < typename OutputIteratorValueType,
-           typename OutputIterator,
-           typename PointPMap,
-           typename NormalPMap,
-           typename Kernel >
-bool read_ply_points_and_normals(std::istream& stream, ///< input stream.
-                                 OutputIterator output, ///< output iterator over points.
-                                 PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
-                                 NormalPMap normal_pmap, ///< property map: value_type of OutputIterator -> Vector_3.
-                                 const Kernel& /*kernel*/) ///< geometric traits.
-{
-  // value_type_traits is a workaround as back_insert_iterator's value_type is void
-  // typedef typename value_type_traits<OutputIterator>::type Enriched_point;
-  typedef OutputIteratorValueType Enriched_point;
-
-  typedef typename Kernel::Point_3 Point;
-  typedef typename Kernel::Vector_3 Vector;
-  typedef typename Kernel::FT FT;
-
-  if(!stream)
-  {
-    std::cerr << "Error: cannot open file" << std::endl;
-    return false;
-  }
-
-  // scan points
-  std::size_t pointsCount = 0,  // number of items in file
-    pointsRead = 0, // current number of points read
-    lineNumber = 0; // current line number
-  enum Format { ASCII = 0, BINARY_LITTLE_ENDIAN = 1, BINARY_BIG_ENDIAN = 2};
-  Format format = ASCII;
-    
-  std::string line;
-  std::istringstream iss;
-
-  // Check the order of the properties of the point set
-  bool reading_properties = false;
-  std::vector<internal::Ply_read_number*> readers;
-  
-  while (getline (stream,line))
-  {
-    iss.clear();
-    iss.str (line);
-    ++ lineNumber;
-
-    // Reads file signature on first line
-    if (lineNumber == 1)
-      {
-        std::string signature;
-        if (!(iss >> signature) || (signature != "ply"))
-          {
-            // if wrong file format
-            std::cerr << "Incorrect file format line " << lineNumber << " of file" << std::endl;
-            return false;
-          }
-      }
-
-    // Reads format on 2nd line
-    else if (lineNumber == 2)
-      {
-        std::string tag, format_string, version;
-        if ( !(iss >> tag >> format_string >> version) )
-          {
-            std::cerr << "Error line " << lineNumber << " of file" << std::endl;
-            return false;
-          }
-        if (format_string == "ascii") format = ASCII;
-        else if (format_string == "binary_little_endian") format = BINARY_LITTLE_ENDIAN;
-        else if (format_string == "binary_big_endian") format = BINARY_BIG_ENDIAN;
-        else
-          {
-            std::cerr << "Unknown file format \"" << format_string << "\" line " << lineNumber << std::endl;
-            return false;
-          }
-      }
-
-    // Comments and vertex properties
-    else
-      {
-        std::string keyword;
-        if (!(iss >> keyword))
-          {
-            std::cerr << "Error line " << lineNumber << " of file" << std::endl;
-            return false;
-          }
-
-        if (keyword == "property")
-          {
-            if (!reading_properties)
-              continue;
-
-            std::string type, name;
-            if (!(iss >> type >> name))
-              {
-                std::cerr << "Error line " << lineNumber << " of file" << std::endl;
-                return false;
-              }
-
-            if (     type == "char"   || type == "int8")
-              readers.push_back (new internal::Ply_read_char (name, format));
-            else if (type == "uchar"  || type == "uint8")
-              readers.push_back (new internal::Ply_read_uchar (name, format));
-            else if (type == "short"  || type == "int16")
-              readers.push_back (new internal::Ply_read_short (name, format));
-            else if (type == "ushort" || type == "uint16")
-              readers.push_back (new internal::Ply_read_ushort (name, format));
-            else if (type == "int"    || type == "int32")
-              readers.push_back (new internal::Ply_read_int (name, format));
-            else if (type == "uint"   || type == "uint32")
-              readers.push_back (new internal::Ply_read_uint (name, format));
-            else if (type == "float"  || type == "float32")
-              readers.push_back (new internal::Ply_read_float (name, format));
-            else if (type == "double" || type == "float64")
-              readers.push_back (new internal::Ply_read_double (name, format));
-                
-            continue;
-          }
-        else
-          reading_properties = false;
-            
-        // ignore comments and properties (if not in element
-        // vertex - cf below - properties are useless in our case)
-        if (keyword == "comment" || keyword == "property")
-          continue;
-
-        // When end_header is reached, stop loop and begin reading points
-        if (keyword == "end_header")
-          break;
-            
-        if (keyword == "element")
-          {
-            std::string type;
-            std::size_t number;
-            if (!(iss >> type >> number))
-              {
-                std::cerr << "Error line " << lineNumber << " of file" << std::endl;
-                return false;
-              }
-                
-            if (type == "vertex")
-              {
-                pointsCount = number;
-                reading_properties = true;
-              }
-            else
-              continue;
-          }
-            
-      }
-  }
-  
-  while (!(stream.eof()) && pointsRead < pointsCount)
-    {
-
-      FT x = 0., y = 0., z = 0., nx = 0., ny = 0., nz = 0.;
-      for (std::size_t i = 0; i < readers.size (); ++ i)
-        {
-          FT value = (*readers[i])(stream);
-          if (readers[i]->name () == "x") x = value;
-          else if (readers[i]->name () == "y") y = value;
-          else if (readers[i]->name () == "z") z = value;
-          else if (readers[i]->name () == "nx") nx = value;
-          else if (readers[i]->name () == "ny") ny = value;
-          else if (readers[i]->name () == "nz") nz = value;
-        }
-      Point point(x,y,z);
-      Vector normal(nx,ny,nz);
-      Enriched_point pwn;
-      
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-      put(point_pmap,  &pwn, point);  // point_pmap[&pwn] = point
-      put(normal_pmap, &pwn, normal); // normal_pmap[&pwn] = normal
-#else
-      put(point_pmap,  pwn, point);  // point_pmap[&pwn] = point
-      put(normal_pmap, pwn, normal); // normal_pmap[&pwn] = normal
-#endif
-      *output++ = pwn;
-      pointsRead++;
-    }
-    // Skip remaining lines
-
-  for (std::size_t i = 0; i < readers.size (); ++ i)
-    delete readers[i];
-  
-  return true;
-}
-
-/// @cond SKIP_IN_MANUAL
-template < typename OutputIterator,
-           typename PointPMap,
-           typename NormalPMap,
-           typename Kernel >
-bool read_ply_points_and_normals(std::istream& stream, ///< input stream.
-                                 OutputIterator output, ///< output iterator over points.
-                                 PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
-                                 NormalPMap normal_pmap, ///< property map: value_type of OutputIterator -> Vector_3.
-                                 const Kernel& kernel) ///< geometric traits.
-{
-  // just deduce value_type of OutputIterator
-  return read_ply_points_and_normals
-    <typename value_type_traits<OutputIterator>::type>(stream,
-                                                       output,
-                                                       point_pmap,
-                                                       normal_pmap,
-                                                       kernel);
-}
-//-----------------------------------------------------------------------------------
-/// @endcond
-
-/// @cond SKIP_IN_MANUAL
-// This variant deduces the kernel from the point property map.
-//-----------------------------------------------------------------------------------
-template < typename OutputIteratorValueType,
-           typename OutputIterator,
-           typename PointPMap,
-           typename NormalPMap >
-bool read_ply_points_and_normals(std::istream& stream, ///< input stream.
-                                 OutputIterator output, ///< output iterator over points.
-                                 PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
-                                 NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
-{
-  typedef typename boost::property_traits<PointPMap>::value_type Point;
-  typedef typename Kernel_traits<Point>::Kernel Kernel;
-  return read_ply_points_and_normals
-    <OutputIteratorValueType>(stream,
-                              output,
-                              point_pmap,
-                              normal_pmap,
-                              Kernel());
-}
-
-template < typename OutputIterator,
-           typename PointPMap,
-           typename NormalPMap >
-bool read_ply_points_and_normals(std::istream& stream, ///< input stream.
-                                 OutputIterator output, ///< output iterator over points.
-                                 PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
-                                 NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
-{
-  // just deduce value_type of OutputIterator
-  return read_ply_points_and_normals
-    <typename value_type_traits<OutputIterator>::type>(stream,
-                                                       output,
-                                                       point_pmap,
-                                                       normal_pmap);
-}
-//-----------------------------------------------------------------------------------
-/// @endcond
-
-/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Identity_property_map.
-//-----------------------------------------------------------------------------------
-template < typename OutputIteratorValueType,
-           typename OutputIterator,
-           typename NormalPMap >
-bool read_ply_points_and_normals(std::istream& stream, ///< input stream.
-                                 OutputIterator output, ///< output iterator over points.
-                                 NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
-{
-  return read_ply_points_and_normals
-    <OutputIteratorValueType>(stream,
-                              output,
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-                              make_dereference_property_map(output),
-#else
-                              make_identity_property_map(OutputIteratorValueType()),
-#endif
-                              normal_pmap);
-}
-
-template < typename OutputIterator,
-           typename NormalPMap >
-bool read_ply_points_and_normals(std::istream& stream, ///< input stream.
-                                 OutputIterator output, ///< output iterator over points.
-                                 NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
-{
-  // just deduce value_type of OutputIterator
-  return read_ply_points_and_normals
-    <typename value_type_traits<OutputIterator>::type>(stream,
-                                                       output,
-                                                       normal_pmap);
-}
-//-----------------------------------------------------------------------------------
-/// @endcond
-
-
-//===================================================================================
-/// \ingroup PkgPointSetProcessing
-/// Reads points (position only) from a .ply stream (ASCII or binary).
-/// Potential additional point properties (including normals) and faces are ignored.
-///
-/// @tparam OutputIteratorValueType type of objects that can be put in `OutputIterator`.
-///         It is default to `value_type_traits<OutputIterator>::%type` and can be omitted when the default is fine.
-/// @tparam OutputIterator iterator over output points.
-/// @tparam PointPMap is a model of `WritablePropertyMap` with  value_type `Point_3<Kernel>`.
-///        It can be omitted if the value type of `OutputIterator` is convertible to `Point_3<Kernel>`.
-/// @tparam Kernel Geometric traits class.
-///        It can be omitted and deduced automatically from  the value type of `PointPMap`.
-///
-/// @return `true` on success.
-
-// This variant requires all parameters.
-//-----------------------------------------------------------------------------------
-template < typename OutputIteratorValueType,
-           typename OutputIterator,
-           typename PointPMap,
-           typename Kernel >
-bool read_ply_points(std::istream& stream, ///< input stream.
-                     OutputIterator output, ///< output iterator over points.
-                     PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
-                     const Kernel& kernel) ///< geometric traits.
-{
-  // Calls read_ply_points_and_normals() with a normal property map = boost::dummy_property_map
-  return read_ply_points_and_normals
-    <OutputIteratorValueType>(stream,
-                              output,
-                              point_pmap,
-                              boost::dummy_property_map(),
-                              kernel);
-}
-
-/// @cond SKIP_IN_MANUAL
-template < typename OutputIterator,
-           typename PointPMap,
-           typename Kernel >
-bool read_ply_points(std::istream& stream, ///< input stream.
-                     OutputIterator output, ///< output iterator over points.
-                     PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
-                     const Kernel& kernel) ///< geometric traits.
-{
-  // just deduce value_type of OutputIterator
-  return read_ply_points
-    <typename value_type_traits<OutputIterator>::type>(stream,
-                                                       output,
-                                                       point_pmap,
-                                                       kernel);
-}
-//-----------------------------------------------------------------------------------
-/// @endcond
-
-/// @cond SKIP_IN_MANUAL
-// This variant deduces the kernel from the point property map.
-//-----------------------------------------------------------------------------------
-template < typename OutputIteratorValueType,
-           typename OutputIterator,
-           typename PointPMap >
-bool read_ply_points(std::istream& stream, ///< input stream.
-                     OutputIterator output, ///< output iterator over points.
-                     PointPMap point_pmap) ///< property map: value_type of OutputIterator -> Point_3.
-{
-  typedef typename boost::property_traits<PointPMap>::value_type Point;
-  typedef typename Kernel_traits<Point>::Kernel Kernel;
-  return read_ply_points
-    <OutputIteratorValueType>(stream,
-                              output,
-                              point_pmap,
-                              Kernel());
-}
-
-template < typename OutputIterator,
-           typename PointPMap >
-bool read_ply_points(std::istream& stream, ///< input stream.
-                     OutputIterator output, ///< output iterator over points.
-                     PointPMap point_pmap) ///< property map: value_type of OutputIterator -> Point_3.
-{
-  // just deduce value_type of OutputIterator
-  return read_ply_points
-    <typename value_type_traits<OutputIterator>::type>(stream,
-                                                       output,
-                                                       point_pmap);
-}
-//-----------------------------------------------------------------------------------
-/// @endcond
-
-/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Identity_property_map.
-//-----------------------------------------------------------------------------------
-template < typename OutputIteratorValueType,
-           typename OutputIterator >
-bool read_ply_points(std::istream& stream, ///< input stream.
-                     OutputIterator output) ///< output iterator over points.
-{
-  return read_ply_points
-    <OutputIteratorValueType>(stream,
-                              output,
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-                              make_dereference_property_map(output)
-#else
-                              make_identity_property_map(OutputIteratorValueType())
-#endif
-                              );
-}
-
-template < typename OutputIterator>
-bool read_ply_points(std::istream& stream, ///< input stream.
-                     OutputIterator output) ///< output iterator over points.
-{
-  // just deduce value_type of OutputIterator
-  return read_ply_points
-    <typename value_type_traits<OutputIterator>::type>(stream,
-                                                       output);
-}
-//-----------------------------------------------------------------------------------
-
-/// @endcond
-
-
-} //namespace CGAL
-
-#endif // CGAL_READ_PLY_POINTS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/read_xyz_points.h b/3rdparty/CGAL-4.8/include/CGAL/IO/read_xyz_points.h
deleted file mode 100644
index 0984d78..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/IO/read_xyz_points.h
+++ /dev/null
@@ -1,428 +0,0 @@
-// Copyright (c) 2007-09  INRIA Sophia-Antipolis (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
-// 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(s) : Pierre Alliez and Laurent Saboret
-
-#ifndef CGAL_READ_XYZ_POINTS_H
-#define CGAL_READ_XYZ_POINTS_H
-
-#include <CGAL/property_map.h>
-#include <CGAL/value_type_traits.h>
-#include <CGAL/point_set_processing_assertions.h>
-
-#include <boost/version.hpp>
-#if BOOST_VERSION >= 104000
-  #include <boost/property_map/property_map.hpp>
-#else
-  #include <boost/property_map.hpp>
-#endif
-
-#include <iostream>
-#include <sstream>
-#include <string>
-
-namespace CGAL {
-
-
-//===================================================================================
-/// \ingroup PkgPointSetProcessing
-/// Reads points (positions + normals, if available) from a .xyz ASCII stream.
-/// The function expects for each point a line with the x y z position,
-/// optionally followed by the nx ny nz normal.
-/// The first line may contain the number of points in the file.
-/// Empty lines and comments starting by # character are allowed.
-///
-/// @tparam OutputIteratorValueType type of objects that can be put in `OutputIterator`.
-///         It is default to `value_type_traits<OutputIterator>::%type` and can be omitted when the default is fine.
-/// @tparam OutputIterator iterator over output points.
-/// @tparam PointPMap is a model of `WritablePropertyMap` with  value type `Point_3<Kernel>`.
-///        It can be omitted if the value type of OutputIterator value_type is convertible to `Point_3<Kernel>`.
-/// @tparam NormalPMap is a model of `WritablePropertyMap` with value type  `Vector_3<Kernel>`.
-/// @tparam Kernel Geometric traits class.
-///        It can be omitted and deduced automatically from the value type of `PointPMap`.
-///
-/// @return true on success.
-
-// This variant requires all parameters.
-//-----------------------------------------------------------------------------------
-template <typename OutputIteratorValueType,
-          typename OutputIterator,
-          typename PointPMap,
-          typename NormalPMap,
-          typename Kernel
->
-bool
-read_xyz_points_and_normals(
-  std::istream& stream, ///< input stream.
-  OutputIterator output, ///< output iterator over points.
-  PointPMap point_pmap,  ///< property map: value_type of OutputIterator -> Point_3.
-  NormalPMap normal_pmap, ///< property map: value_type of OutputIterator -> Vector_3.
-  const Kernel& /*kernel*/) ///< geometric traits.
-{
-  // value_type_traits is a workaround as back_insert_iterator's value_type is void
-  //typedef typename value_type_traits<OutputIterator>::type Enriched_point;
-  typedef OutputIteratorValueType Enriched_point;
-  
-  typedef typename Kernel::FT FT;
-  typedef typename Kernel::Point_3 Point;
-  typedef typename Kernel::Vector_3 Vector;
-
-  if(!stream)
-  {
-    std::cerr << "Error: cannot open file" << std::endl;
-    return false;
-  }
-
-  // scan points
-  long pointsCount; // number of points in file
-  int lineNumber = 0; // line counter
-  std::string line; // line buffer
-  std::istringstream iss;
-
-  while(getline(stream,line))
-  {
-    // position + normal
-    FT x,y,z;
-    FT nx,ny,nz;
-
-    lineNumber++;
-
-    // Trims line buffer
-    line.erase(line.find_last_not_of (" ")+1);
-    line.erase(0, line.find_first_not_of (" "));
-
-    // Skips comment or empty line...
-    if (line.length() == 0 || line[0] == '#')
-    {
-      continue;
-    }
-    // ...or reads position...
-    else {
-      iss.clear();
-      iss.str(line);
-      if (iss >> iformat(x) >> iformat(y) >> iformat(z))
-        {
-          Point point(x,y,z);
-          Vector normal = CGAL::NULL_VECTOR;
-          // ... + normal...
-          if (iss >> iformat(nx))
-            {
-              // In case we could read one number, we expect that there are two more
-              if(iss  >> iformat(ny) >> iformat(nz)){
-                normal = Vector(nx,ny,nz);
-              } else {
-                std::cerr << "Error line " << lineNumber << " of file" << std::endl;
-                return false;
-              }
-            }
-          Enriched_point pwn;
-        #ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-          put(point_pmap,  &pwn, point);  // point_pmap[&pwn] = point
-          put(normal_pmap, &pwn, normal); // normal_pmap[&pwn] = normal
-        #else
-          put(point_pmap,  pwn, point);  // point_pmap[pwn] = point
-          put(normal_pmap, pwn, normal); // normal_pmap[pwn] = normal
-        #endif
-          *output++ = pwn;
-          continue;
-        } 
-      
-    }
-    // ...or skips number of points on first line (optional)
-    if (lineNumber == 1 && std::istringstream(line) >> pointsCount)
-    {
-      continue;
-    }
-    else // if wrong file format
-    {
-      std::cerr << "Error line " << lineNumber << " of file" << std::endl;
-      return false;
-    }
-  }
-
-  return true;
-}
-
-/// @cond SKIP_IN_MANUAL
-template <typename OutputIterator,
-          typename PointPMap,
-          typename NormalPMap,
-          typename Kernel
->
-bool
-read_xyz_points_and_normals(
-  std::istream& stream, ///< input stream.
-  OutputIterator output, ///< output iterator over points.
-  PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
-  NormalPMap normal_pmap, ///< property map: value_type of OutputIterator -> Vector_3.
-  const Kernel& kernel) ///< geometric traits.
-{
-  // just deduce value_type of OutputIterator
-  return read_xyz_points_and_normals
-    <typename value_type_traits<OutputIterator>::type>(
-    stream,
-    output,
-    point_pmap,
-    normal_pmap,
-    kernel);
-}
-//-----------------------------------------------------------------------------------
-/// @endcond
-
-/// @cond SKIP_IN_MANUAL
-// This variant deduces the kernel from the point property map.
-//-----------------------------------------------------------------------------------
-template <typename OutputIteratorValueType,
-          typename OutputIterator,
-          typename PointPMap,
-          typename NormalPMap
->
-bool
-read_xyz_points_and_normals(
-  std::istream& stream, ///< input stream.
-  OutputIterator output, ///< output iterator over points.
-  PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
-  NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
-{
-  typedef typename boost::property_traits<PointPMap>::value_type Point;
-  typedef typename Kernel_traits<Point>::Kernel Kernel;
-  return read_xyz_points_and_normals
-    <OutputIteratorValueType>(
-    stream,
-    output,
-    point_pmap,
-    normal_pmap,
-    Kernel());
-}
-
-template <typename OutputIterator,
-          typename PointPMap,
-          typename NormalPMap
->
-bool
-read_xyz_points_and_normals(
-  std::istream& stream, ///< input stream.
-  OutputIterator output, ///< output iterator over points.
-  PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
-  NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
-{
-  // just deduce value_type of OutputIterator
-  return read_xyz_points_and_normals
-    <typename value_type_traits<OutputIterator>::type>(
-    stream,
-    output,
-    point_pmap,
-    normal_pmap);
-}
-//-----------------------------------------------------------------------------------
-/// @endcond
-
-/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Identity_property_map.
-//-----------------------------------------------------------------------------------
-template <typename OutputIteratorValueType,
-          typename OutputIterator,
-          typename NormalPMap
->
-bool
-read_xyz_points_and_normals(
-  std::istream& stream, ///< input stream.
-  OutputIterator output, ///< output iterator over points.
-  NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
-{
-  return read_xyz_points_and_normals
-    <OutputIteratorValueType>(
-    stream,
-    output,
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-    make_dereference_property_map(output),
-#else
-    make_identity_property_map(OutputIteratorValueType()),
-#endif
-    normal_pmap);
-}
-
-template <typename OutputIterator,
-          typename NormalPMap
->
-bool
-read_xyz_points_and_normals(
-  std::istream& stream, ///< input stream.
-  OutputIterator output, ///< output iterator over points.
-  NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
-{
-  // just deduce value_type of OutputIterator
-  return read_xyz_points_and_normals
-    <typename value_type_traits<OutputIterator>::type>(
-    stream,
-    output,
-    normal_pmap);
-}
-//-----------------------------------------------------------------------------------
-/// @endcond
-
-
-//===================================================================================
-/// \ingroup PkgPointSetProcessing
-/// Reads points (positions only) from a .xyz ASCII stream.
-/// The function expects for each point a line with the x y z position.
-/// If the position is followed by the nx ny nz normal, then the normal will be ignored.
-/// The first line may contain the number of points in the file.
-/// Empty lines and comments starting by # character are allowed.
-///
-/// @tparam OutputIteratorValueType type of objects that can be put in `OutputIterator`.
-///         It is default to `value_type_traits<OutputIterator>::%type` and can be omitted when the default is fine.
-/// @tparam OutputIterator iterator over output points.
-/// @tparam PointPMap is a model of `WritablePropertyMap` with value type  `Point_3<Kernel>`.
-///        It can be omitted if the value type of `OutputIterator` is convertible to `Point_3<Kernel>`.
-/// @tparam Kernel Geometric traits class.
-///        It can be omitted and deduced automatically from the value type of `PointPMap`.
-///
-/// @return true on success.
-
-// This variant requires all parameters.
-//-----------------------------------------------------------------------------------
-template <typename OutputIteratorValueType,
-          typename OutputIterator,
-          typename PointPMap,
-          typename Kernel
->
-bool
-read_xyz_points(
-  std::istream& stream, ///< input stream.
-  OutputIterator output, ///< output iterator over points.
-  PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
-  const Kernel& kernel) ///< geometric traits.
-{
-  // Calls read_xyz_points_and_normals() with a normal property map = boost::dummy_property_map
-  return read_xyz_points_and_normals
-    <OutputIteratorValueType>(
-    stream,
-    output,
-    point_pmap,
-    boost::dummy_property_map(),
-    kernel);
-}
-
-/// @cond SKIP_IN_MANUAL
-template <typename OutputIterator,
-          typename PointPMap,
-          typename Kernel
->
-bool
-read_xyz_points(
-  std::istream& stream, ///< input stream.
-  OutputIterator output, ///< output iterator over points.
-  PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
-  const Kernel& kernel) ///< geometric traits.
-{
-  // just deduce value_type of OutputIterator
-  return read_xyz_points
-    <typename value_type_traits<OutputIterator>::type>(
-    stream,
-    output,
-    point_pmap,
-    kernel);
-}
-/// @endcond
-//-----------------------------------------------------------------------------------
-
-/// @cond SKIP_IN_MANUAL
-// This variant deduces the kernel from the point property map.
-//-----------------------------------------------------------------------------------
-template <typename OutputIteratorValueType,
-          typename OutputIterator,
-          typename PointPMap
->
-bool
-read_xyz_points(
-  std::istream& stream, ///< input stream.
-  OutputIterator output, ///< output iterator over points.
-  PointPMap point_pmap) ///< property map: value_type of OutputIterator -> Point_3.
-{
-  typedef typename boost::property_traits<PointPMap>::value_type Point;
-  typedef typename Kernel_traits<Point>::Kernel Kernel;
-  return read_xyz_points
-    <OutputIteratorValueType>(
-    stream,
-    output,
-    point_pmap,
-    Kernel());
-}
-
-template <typename OutputIterator,
-          typename PointPMap
->
-bool
-read_xyz_points(
-  std::istream& stream, ///< input stream.
-  OutputIterator output, ///< output iterator over points.
-  PointPMap point_pmap) ///< property map: value_type of OutputIterator -> Point_3.
-{
-  // just deduce value_type of OutputIterator
-  return read_xyz_points
-    <typename value_type_traits<OutputIterator>::type>(
-    stream,
-    output,
-    point_pmap);
-}
-//-----------------------------------------------------------------------------------
-/// @endcond
-
-/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Identity_property_map.
-//-----------------------------------------------------------------------------------
-template <typename OutputIteratorValueType,
-          typename OutputIterator
->
-bool
-read_xyz_points(
-  std::istream& stream, ///< input stream.
-  OutputIterator output) ///< output iterator over points.
-{
-  return read_xyz_points
-    <OutputIteratorValueType>(
-    stream,
-    output,
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-    make_dereference_property_map(output)
-#else
-    make_identity_property_map(OutputIteratorValueType())
-#endif
-    );
-}
-
-template <typename OutputIterator
->
-bool
-read_xyz_points(
-  std::istream& stream, ///< input stream.
-  OutputIterator output) ///< output iterator over points.
-{
-  // just deduce value_type of OutputIterator
-  return read_xyz_points
-    <typename value_type_traits<OutputIterator>::type>(
-    stream,
-    output);
-}
-//-----------------------------------------------------------------------------------
-/// @endcond
-
-
-} //namespace CGAL
-
-#endif // CGAL_READ_XYZ_POINTS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/write_off_points.h b/3rdparty/CGAL-4.8/include/CGAL/IO/write_off_points.h
deleted file mode 100644
index c404e97..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/IO/write_off_points.h
+++ /dev/null
@@ -1,259 +0,0 @@
-// Copyright (c) 2007-09  INRIA Sophia-Antipolis (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
-// 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(s) : Pierre Alliez and Laurent Saboret
-
-#ifndef CGAL_WRITE_OFF_POINTS_H
-#define CGAL_WRITE_OFF_POINTS_H
-
-#include <CGAL/property_map.h>
-#include <CGAL/point_set_processing_assertions.h>
-
-#include <boost/version.hpp>
-#if BOOST_VERSION >= 104000
-  #include <boost/property_map/property_map.hpp>
-#else
-  #include <boost/property_map.hpp>
-#endif
-
-#include <iostream>
-#include <iterator>
-
-namespace CGAL {
-
-
-//===================================================================================
-/// \ingroup PkgPointSetProcessing
-/// Saves the [first, beyond) range of points (positions + normals) to a .off ASCII stream.
-/// The function writes for each point a line with the x y z position
-/// followed by the nx ny nz normal.
-///
-/// \pre normals must be unit vectors
-///
-/// @tparam ForwardIterator iterator over input points.
-/// @tparam PointPMap is a model of `ReadablePropertyMap` with  value type `Point_3<Kernel>`.
-///        It can be omitted if the value type of `ForwardIterator` is convertible to `Point_3<Kernel>`.
-/// @tparam NormalPMap is a model of `ReadablePropertyMap` with a value type  `Vector_3<Kernel>`.
-/// @tparam Kernel Geometric traits class.
-///        It can be omitted and deduced automatically from the value type of `PointPMap`.
-///
-/// @return true on success.
-
-// This variant requires all parameters.
-template <typename ForwardIterator,
-          typename PointPMap,
-          typename NormalPMap,
-          typename Kernel
->
-bool
-write_off_points_and_normals(
-  std::ostream& stream, ///< output stream.
-  ForwardIterator first,  ///< iterator over the first input point.
-  ForwardIterator beyond, ///< past-the-end iterator over the input points.
-  PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3. 
-  NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3. 
-  const Kernel& /*kernel*/) ///< geometric traits.
-{
-  // basic geometric types
-  typedef typename Kernel::Point_3 Point;
-  typedef typename Kernel::Vector_3 Vector;
-
-  CGAL_point_set_processing_precondition(first != beyond);
-
-  if(!stream)
-  {
-    std::cerr << "Error: cannot open file" << std::endl;
-    return false;
-  }
-
-  // Write header
-  const std::size_t num_input_points = std::distance(first, beyond);
-  stream << "NOFF" << std::endl;
-  stream << num_input_points << " 0 0" << std::endl;
-
-  // Write positions + normals
-  for(ForwardIterator it = first; it != beyond; it++)
-  {
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-    Point p = get(point_pmap, it);
-    Vector n = get(normal_pmap, it);
-#else
-    Point p = get(point_pmap, *it);
-    Vector n = get(normal_pmap, *it);
-#endif
-    stream << p << " " << n << std::endl;
-  }
-
-  return ! stream.fail();
-}
-
-/// @cond SKIP_IN_MANUAL
-// This variant deduces the kernel from the point property map.
-template <typename ForwardIterator,
-          typename PointPMap,
-          typename NormalPMap
->
-bool
-write_off_points_and_normals(
-  std::ostream& stream, ///< output stream.
-  ForwardIterator first, ///< first input point.
-  ForwardIterator beyond, ///< past-the-end input point.
-  PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
-  NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
-{
-  typedef typename boost::property_traits<PointPMap>::value_type Point;
-  typedef typename Kernel_traits<Point>::Kernel Kernel;
-  return write_off_points_and_normals(
-    stream,
-    first, beyond,
-    point_pmap,
-    normal_pmap,
-    Kernel());
-}
-/// @endcond
-
-/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Identity_property_map.
-template <typename ForwardIterator,
-          typename NormalPMap
->
-bool
-write_off_points_and_normals(
-  std::ostream& stream, ///< output stream.
-  ForwardIterator first, ///< first input point.
-  ForwardIterator beyond, ///< past-the-end input point.
-  NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
-{
-  return write_off_points_and_normals(
-    stream,
-    first, beyond,
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-    make_dereference_property_map(first),
-#else
-    make_identity_property_map(
-    typename std::iterator_traits<ForwardIterator>::value_type()),
-#endif
-    normal_pmap);
-}
-/// @endcond
-
-
-//===================================================================================
-/// \ingroup PkgPointSetProcessing
-/// Saves the [first, beyond) range of points (positions only) to a .off ASCII stream.
-/// The function writes for each point a line with the x y z position.
-///
-/// @tparam ForwardIterator iterator over input points.
-/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = `Point_3<Kernel>`.
-///        It can be omitted if the value type of `ForwardIterator` is convertible to `Point_3<Kernel>`.
-/// @tparam Kernel Geometric traits class.
-///        It can be omitted and deduced automatically from the value type of `PointPMap`.
-///
-/// @return true on success.
-
-// This variant requires all parameters.
-template <typename ForwardIterator,
-          typename PointPMap,
-          typename Kernel
->
-bool
-write_off_points(
-  std::ostream& stream, ///< output stream.
-  ForwardIterator first,  ///< iterator over the first input point.
-  ForwardIterator beyond, ///< past-the-end iterator over the input points.
-  PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3.
-  const Kernel& ) ///< geometric traits.
-{
-  // basic geometric types
-  typedef typename Kernel::Point_3 Point;
-
-  CGAL_point_set_processing_precondition(first != beyond);
-
-  if(!stream)
-  {
-    std::cerr << "Error: cannot open file" << std::endl;
-    return false;
-  }
-
-  // Write header
-  const std::size_t num_input_points = std::distance(first, beyond);
-  stream << "OFF" << std::endl;
-  stream << num_input_points << " 0 0" << std::endl;
-
-  // Write positions
-  for(ForwardIterator it = first; it != beyond; it++)
-  {
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-    Point p = get(point_pmap, it);
-#else
-    Point p = get(point_pmap, *it);
-#endif
-    stream << p << std::endl;
-  }
-
-  return ! stream.fail();
-}
-
-/// @cond SKIP_IN_MANUAL
-// This variant deduces the kernel from the point property map.
-template <typename ForwardIterator,
-          typename PointPMap
->
-bool
-write_off_points(
-  std::ostream& stream, ///< output stream.
-  ForwardIterator first, ///< first input point.
-  ForwardIterator beyond, ///< past-the-end input point.
-  PointPMap point_pmap) ///< property map: value_type of OutputIterator -> Point_3.
-{
-  typedef typename boost::property_traits<PointPMap>::value_type Point;
-  typedef typename Kernel_traits<Point>::Kernel Kernel;
-  return write_off_points(
-    stream,
-    first, beyond,
-    point_pmap,
-    Kernel());
-}
-/// @endcond
-
-/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Identity_property_map.
-template <typename ForwardIterator
->
-bool
-write_off_points(
-  std::ostream& stream, ///< output stream.
-  ForwardIterator first, ///< first input point.
-  ForwardIterator beyond) ///< past-the-end input point.
-{
-  return write_off_points(
-    stream,
-    first, beyond,
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-    make_dereference_property_map(first)
-#else
-    make_identity_property_map(
-    typename std::iterator_traits<ForwardIterator>::value_type())
-#endif
-    );
-}
-/// @endcond
-
-
-} //namespace CGAL
-
-#endif // CGAL_WRITE_OFF_POINTS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/write_ply_points.h b/3rdparty/CGAL-4.8/include/CGAL/IO/write_ply_points.h
deleted file mode 100644
index 274713e..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/IO/write_ply_points.h
+++ /dev/null
@@ -1,260 +0,0 @@
-// Copyright (c) 2015  Geometry Factory
-// 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
-// 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(s) : Simon Giraudot
-
-#ifndef CGAL_WRITE_PLY_POINTS_H
-#define CGAL_WRITE_PLY_POINTS_H
-
-#include <CGAL/property_map.h>
-#include <CGAL/point_set_processing_assertions.h>
-
-#include <boost/version.hpp>
-
-#include <iostream>
-#include <iterator>
-
-namespace CGAL {
-
-
-//===================================================================================
-/// \ingroup PkgPointSetProcessing
-/// Saves the [first, beyond) range of points (positions + normals) to a .ply ASCII stream.
-///
-/// \pre normals must be unit vectors
-///
-/// @tparam ForwardIterator iterator over input points.
-/// @tparam PointPMap is a model of `ReadablePropertyMap` with  value type `Point_3<Kernel>`.
-///        It can be omitted if the value type of `ForwardIterator` is convertible to `Point_3<Kernel>`.
-/// @tparam NormalPMap is a model of `ReadablePropertyMap` with a value type  `Vector_3<Kernel>`.
-/// @tparam Kernel Geometric traits class.
-///        It can be omitted and deduced automatically from the value type of `PointPMap`.
-///
-/// @return true on success.
-
-// This variant requires all parameters.
-template < typename ForwardIterator,
-           typename PointPMap,
-           typename NormalPMap,
-           typename Kernel >
-bool
-write_ply_points_and_normals(
-  std::ostream& stream, ///< output stream.
-  ForwardIterator first,  ///< iterator over the first input point.
-  ForwardIterator beyond, ///< past-the-end iterator over the input points.
-  PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3. 
-  NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3. 
-  const Kernel& /*kernel*/) ///< geometric traits.
-{
-  // basic geometric types
-  typedef typename Kernel::Point_3 Point;
-  typedef typename Kernel::Vector_3 Vector;
-
-  CGAL_point_set_processing_precondition(first != beyond);
-
-  if(!stream)
-  {
-    std::cerr << "Error: cannot open file" << std::endl;
-    return false;
-  }
-
-  // Write header
-  stream << "ply" << std::endl
-         << "format ascii 1.0" << std::endl
-         << "comment Generated by the CGAL library" << std::endl
-         << "element vertex " << std::distance (first, beyond) << std::endl
-         << "property double x" << std::endl
-         << "property double y" << std::endl
-         << "property double z" << std::endl
-         << "property double nx" << std::endl
-         << "property double ny" << std::endl
-         << "property double nz" << std::endl
-         << "end_header" << std::endl;
-  
-
-  // Write positions + normals
-  for(ForwardIterator it = first; it != beyond; it++)
-  {
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-    Point p = get(point_pmap, it);
-    Vector n = get(normal_pmap, it);
-#else
-    Point p = get(point_pmap, *it);
-    Vector n = get(normal_pmap, *it);
-#endif
-    stream << p << " " << n << std::endl;
-  }
-
-  return ! stream.fail();
-}
-
-/// @cond SKIP_IN_MANUAL
-// This variant deduces the kernel from the point property map.
-template < typename ForwardIterator,
-           typename PointPMap,
-           typename NormalPMap >
-bool
-write_ply_points_and_normals(
-  std::ostream& stream, ///< output stream.
-  ForwardIterator first, ///< first input point.
-  ForwardIterator beyond, ///< past-the-end input point.
-  PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
-  NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
-{
-  typedef typename boost::property_traits<PointPMap>::value_type Point;
-  typedef typename Kernel_traits<Point>::Kernel Kernel;
-  return write_ply_points_and_normals(
-    stream,
-    first, beyond,
-    point_pmap,
-    normal_pmap,
-    Kernel());
-}
-/// @endcond
-
-/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Identity_property_map.
-template <typename ForwardIterator,
-          typename NormalPMap
->
-bool
-write_ply_points_and_normals(
-  std::ostream& stream, ///< output stream.
-  ForwardIterator first, ///< first input point.
-  ForwardIterator beyond, ///< past-the-end input point.
-  NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
-{
-  return write_ply_points_and_normals(
-    stream,
-    first, beyond,
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-    make_dereference_property_map(first),
-#else
-    make_identity_property_map(
-    typename std::iterator_traits<ForwardIterator>::value_type()),
-#endif
-    normal_pmap);
-}
-/// @endcond
-
-
-//===================================================================================
-/// \ingroup PkgPointSetProcessing
-/// Saves the [first, beyond) range of points (positions only) to a .ply ASCII stream.
-///
-/// @tparam ForwardIterator iterator over input points.
-/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = `Point_3<Kernel>`.
-///        It can be omitted if the value type of `ForwardIterator` is convertible to `Point_3<Kernel>`.
-/// @tparam Kernel Geometric traits class.
-///        It can be omitted and deduced automatically from the value type of `PointPMap`.
-///
-/// @return true on success.
-
-// This variant requires all parameters.
-template < typename ForwardIterator,
-           typename PointPMap,
-           typename Kernel >
-bool
-write_ply_points(
-  std::ostream& stream, ///< output stream.
-  ForwardIterator first,  ///< iterator over the first input point.
-  ForwardIterator beyond, ///< past-the-end iterator over the input points.
-  PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3.
-  const Kernel& ) ///< geometric traits.
-{
-  // basic geometric types
-  typedef typename Kernel::Point_3 Point;
-
-  CGAL_point_set_processing_precondition(first != beyond);
-
-  if(!stream)
-  {
-    std::cerr << "Error: cannot open file" << std::endl;
-    return false;
-  }
-
-  // Write header
-  stream << "ply" << std::endl
-         << "format ascii 1.0" << std::endl
-         << "comment Generated by the CGAL library" << std::endl
-         << "element vertex " << std::distance (first, beyond) << std::endl
-         << "property double x" << std::endl
-         << "property double y" << std::endl
-         << "property double z" << std::endl
-         << "end_header" << std::endl;
-
-  // Write positions
-  for(ForwardIterator it = first; it != beyond; it++)
-  {
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-    Point p = get(point_pmap, it);
-#else
-    Point p = get(point_pmap, *it);
-#endif
-    stream << p << std::endl;
-  }
-
-  return ! stream.fail();
-}
-
-/// @cond SKIP_IN_MANUAL
-// This variant deduces the kernel from the point property map.
-template < typename ForwardIterator,
-           typename PointPMap >
-bool
-write_ply_points(
-  std::ostream& stream, ///< output stream.
-  ForwardIterator first, ///< first input point.
-  ForwardIterator beyond, ///< past-the-end input point.
-  PointPMap point_pmap) ///< property map: value_type of OutputIterator -> Point_3.
-{
-  typedef typename boost::property_traits<PointPMap>::value_type Point;
-  typedef typename Kernel_traits<Point>::Kernel Kernel;
-  return write_ply_points(
-    stream,
-    first, beyond,
-    point_pmap,
-    Kernel());
-}
-/// @endcond
-
-/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Identity_property_map.
-template < typename ForwardIterator >
-bool
-write_ply_points(
-  std::ostream& stream, ///< output stream.
-  ForwardIterator first, ///< first input point.
-  ForwardIterator beyond) ///< past-the-end input point.
-{
-  return write_ply_points(
-    stream,
-    first, beyond,
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-    make_dereference_property_map(first)
-#else
-    make_identity_property_map(
-    typename std::iterator_traits<ForwardIterator>::value_type())
-#endif
-    );
-}
-/// @endcond
-
-
-} //namespace CGAL
-
-#endif // CGAL_WRITE_PLY_POINTS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/write_xyz_points.h b/3rdparty/CGAL-4.8/include/CGAL/IO/write_xyz_points.h
deleted file mode 100644
index b8b75c7..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/IO/write_xyz_points.h
+++ /dev/null
@@ -1,250 +0,0 @@
-// Copyright (c) 2007-09  INRIA Sophia-Antipolis (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
-// 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(s) : Pierre Alliez and Laurent Saboret
-
-#ifndef CGAL_WRITE_XYZ_POINTS_H
-#define CGAL_WRITE_XYZ_POINTS_H
-
-#include <CGAL/property_map.h>
-#include <CGAL/point_set_processing_assertions.h>
-
-#include <boost/version.hpp>
-#if BOOST_VERSION >= 104000
-  #include <boost/property_map/property_map.hpp>
-#else
-  #include <boost/property_map.hpp>
-#endif
-
-#include <iostream>
-#include <iterator>
-
-namespace CGAL {
-
-
-//===================================================================================
-/// \ingroup PkgPointSetProcessing
-/// Saves the [first, beyond) range of points (positions + normals) to a .xyz ASCII stream.
-/// The function writes for each point a line with the x y z position
-/// followed by the nx ny nz normal.
-///
-/// \pre normals must be unit vectors
-///
-/// @tparam ForwardIterator iterator over input points.
-/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value type = `Point_3<Kernel>`.
-///        It can be omitted if the value type of `ForwardIterator` is convertible to `Point_3<Kernel>`.
-/// @tparam NormalPMap is a model of `ReadablePropertyMap` with a value type  `Vector_3<Kernel>`.
-/// @tparam Kernel Geometric traits class.
-///        It can be omitted and deduced automatically from the value type of `PointPMap`.
-///
-/// @return true on success.
-
-// This variant requires all parameters.
-template <typename ForwardIterator,
-          typename PointPMap,
-          typename NormalPMap,
-          typename Kernel
->
-bool
-write_xyz_points_and_normals(
-  std::ostream& stream, ///< output stream.
-  ForwardIterator first,  ///< iterator over the first input point.
-  ForwardIterator beyond, ///< past-the-end iterator over the input points.
-  PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3.
-  NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3.
-  const Kernel& /*kernel*/) ///< geometric traits.
-{
-  // basic geometric types
-  typedef typename Kernel::Point_3 Point;
-  typedef typename Kernel::Vector_3 Vector;
-
-  CGAL_point_set_processing_precondition(first != beyond);
-
-  if(!stream)
-  {
-    std::cerr << "Error: cannot open file" << std::endl;
-    return false;
-  }
-
-  // Write positions + normals
-  for(ForwardIterator it = first; it != beyond; it++)
-  {
-  #ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-    Point p = get(point_pmap, it);
-    Vector n = get(normal_pmap, it);
-  #else
-    Point p = get(point_pmap, *it);
-    Vector n = get(normal_pmap, *it);
-  #endif
-    stream << p << " " << n << std::endl;
-  }
-
-  return ! stream.fail();
-}
-
-/// @cond SKIP_IN_MANUAL
-// This variant deduces the kernel from the point property map.
-template <typename ForwardIterator,
-          typename PointPMap,
-          typename NormalPMap
->
-bool
-write_xyz_points_and_normals(
-  std::ostream& stream, ///< output stream.
-  ForwardIterator first, ///< first input point.
-  ForwardIterator beyond, ///< past-the-end input point.
-  PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
-  NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
-{
-  typedef typename boost::property_traits<PointPMap>::value_type Point;
-  typedef typename Kernel_traits<Point>::Kernel Kernel;
-  return write_xyz_points_and_normals(
-    stream,
-    first, beyond,
-    point_pmap,
-    normal_pmap,
-    Kernel());
-}
-/// @endcond
-
-/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Identity_property_map.
-template <typename ForwardIterator,
-          typename NormalPMap
->
-bool
-write_xyz_points_and_normals(
-  std::ostream& stream, ///< output stream.
-  ForwardIterator first, ///< first input point.
-  ForwardIterator beyond, ///< past-the-end input point.
-  NormalPMap normal_pmap) ///< property map: value_type of ForwardIterator -> Vector_3.
-{
-  return write_xyz_points_and_normals(
-    stream,
-    first, beyond,
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-    make_dereference_property_map(output),
-#else
-    make_identity_property_map(
-      typename std::iterator_traits<ForwardIterator>::value_type()),
-#endif
-    normal_pmap);
-}
-/// @endcond
-
-
-//===================================================================================
-/// \ingroup PkgPointSetProcessing
-/// Saves the [first, beyond) range of points (positions only) to a .xyz ASCII stream.
-/// The function writes for each point a line with the x y z position.
-///
-/// @tparam ForwardIterator iterator over input points.
-/// @tparam PointPMap is a model of `ReadablePropertyMap` with value type  `Point_3<Kernel>`.
-///        It can be omitted if the value type of `ForwardIterator value_type is convertible to `Point_3<Kernel>`.
-/// @tparam Kernel Geometric traits class.
-///        It can be omitted and deduced automatically from the value type of `PointPMap`.
-///
-/// @return true on success.
-
-// This variant requires all parameters.
-template <typename ForwardIterator,
-          typename PointPMap,
-          typename Kernel
->
-bool
-write_xyz_points(
-  std::ostream& stream, ///< output stream.
-  ForwardIterator first,  ///< iterator over the first input point.
-  ForwardIterator beyond, ///< past-the-end iterator over the input points.
-  PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3.
-  const Kernel& /*kernel*/) ///< geometric traits.
-{
-  // basic geometric types
-  typedef typename Kernel::Point_3 Point;
-
-  CGAL_point_set_processing_precondition(first != beyond);
-
-  if(!stream)
-  {
-    std::cerr << "Error: cannot open file" << std::endl;
-    return false;
-  }
-
-  // Write positions
-  for(ForwardIterator it = first; it != beyond; it++)
-  {
-  #ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-    Point p = get(point_pmap, it);
-  #else
-    Point p = get(point_pmap, *it);
-  #endif
-    
-    stream << p << std::endl;
-  }
-
-  return ! stream.fail();
-}
-
-/// @cond SKIP_IN_MANUAL
-// This variant deduces the kernel from the point property map.
-template <typename ForwardIterator,
-          typename PointPMap
->
-bool
-write_xyz_points(
-  std::ostream& stream, ///< output stream.
-  ForwardIterator first, ///< first input point.
-  ForwardIterator beyond, ///< past-the-end input point.
-  PointPMap point_pmap) ///< property map: value_type of OutputIterator -> Point_3.
-{
-  typedef typename boost::property_traits<PointPMap>::value_type Point;
-  typedef typename Kernel_traits<Point>::Kernel Kernel;
-  return write_xyz_points(
-    stream,
-    first, beyond,
-    point_pmap,
-    Kernel());
-}
-/// @endcond
-
-/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Identity_property_map.
-template <typename ForwardIterator
->
-bool
-write_xyz_points(
-  std::ostream& stream, ///< output stream.
-  ForwardIterator first, ///< first input point.
-  ForwardIterator beyond) ///< past-the-end input point.
-{
-  return write_xyz_points(
-    stream,
-    first, beyond,
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-    make_dereference_property_map(output)
-#else
-    make_identity_property_map(
-      typename std::iterator_traits<ForwardIterator>::value_type())
-#endif
-    );
-}
-/// @endcond
-
-
-} //namespace CGAL
-
-#endif // CGAL_WRITE_XYZ_POINTS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/ImageIO.h b/3rdparty/CGAL-4.8/include/CGAL/ImageIO.h
deleted file mode 100644
index c296b99..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/ImageIO.h
+++ /dev/null
@@ -1,707 +0,0 @@
-// Copyright (c) 2005, 2006 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// Copyright (c) 2007 Geometrica Project, INRIA Sophia-Antipolis (France) 
-// Copyright (c) 2008 GeometryFactory, Sophia-Antipolis (France) 
-// All rights reserved.
-//
-// The files in this directory are part of the ImageIO Library.
-// You can redistribute them and/or  modify them 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-// $URL$
-// $Id$
-//
-
-#ifndef IMAGEIO_H
-#define IMAGEIO_H
-
-#include <CGAL/config.h>
-#include <CGAL/export/ImageIO.h>
-
-#include <CGAL/auto_link/ImageIO.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <boost/cstdint.hpp> // for uint32_t, etc.
-
-#ifdef CGAL_USE_ZLIB
-#include <zlib.h>
-/* see http://www.gzip.org/zlib/
-   for details and documentation
-*/
-#endif
-
-
-
-#if (defined(_LINUX_) || defined(_SOLARIS_))
-
-/* should be declared in stdio.h
- */
-extern int fileno( FILE *stream);
-extern FILE *fdopen (int fildes, const char *mode);
-/* should be declared in string.h
- */
-#ifndef __cplusplus
-extern char *strdup(const char *s);
-extern int strncasecmp(const char *s1, const char *s2, size_t n);
-#endif
-
-#endif
-
-
-
-
-
-#ifndef LONGINT
-
-#if (defined _ALPHA_ || (defined _SGI_ && (defined _64_ || defined _64_M4_ || defined _64_M3_)))
-/* the 64-bits type on 64-bits platform (long int) */
-#define LONGINT long  int
-#else
-#ifdef __GNUC__
-/* the 64-bits type on 32-bits platform (long long int) */
-#define LONGINT long long int
-#else
-/*#define LONGINT __int64 */
-#define LONGINT long int
-#endif
-#endif
-
-#endif
-
-
-
-
-
-
-
-
-/** file open mode */
-typedef enum {
-  /** no file open */
-  OM_CLOSE,
-  /** file is stdin or stdout */
-  OM_STD,
-  /** file is gzipped */
-#ifdef CGAL_USE_ZLIB
-  OM_GZ,
-#endif
-  /** normal file */
-  OM_FILE
-} OPEN_MODE;
-
-
-/** data mode */
-typedef enum {
-  /** data are binary */
-  DM_BINARY,
-  /** data are ascii */
-  DM_ASCII
-} DATA_MODE;
-
-
-/** kind of image word */
-typedef enum {
-  /** fixed type */
-  WK_FIXED,
-  /** floating point */
-  WK_FLOAT,
-  /** unknown (uninitialized) */
-  WK_UNKNOWN
-} WORD_KIND;
-
-
-/** image word sign */
-typedef enum {
-  /** signed */
-  SGN_SIGNED,
-  /** unsigned */
-  SGN_UNSIGNED,
-  /** unknown (uninitialized or floating point words) */
-  SGN_UNKNOWN
-} SIGN;
-
-
-/** endianness */
-typedef enum {
-  /** Little endian processor */
-  END_LITTLE,
-  /** Big endian processor */
-  END_BIG,
-  /** Unknown endianness (unopenned file) */
-  END_UNKNOWN
-} ENDIANNESS;
-
-
-/** inrimage vectorial storage mode */
-typedef enum {
-  /** interlaced vectors (i.e. x1, y1, z1, x2, y2, z2, x3, y3, z3, ...) */
-  VM_INTERLACED,
-  /** non interlaced vectors (i.e. x1, x2, x3, ..., y1, y2, y3, ..., z1, z2, z3...) */
-  VM_NON_INTERLACED,
-  /** scalar inrimage */
-  VM_SCALAR
-} VECTORIAL_MODE;
-
-
-
-#ifdef CGAL_USE_ZLIB
-typedef gzFile _ImageIO_file;
-#else
-typedef FILE*  _ImageIO_file;
-#endif
-
-#define IMAGE_FORMAT_NAME_LENGTH 100
-
-
-struct point_image;
-
-/** defines the type of function called to test if an image is of a given
-    format. The first parameter is an array of char of size 5 (ends with
-    character 0) that describes the first file character (magic string). The
-    second parameter is the filename. The output value is >=0 if the image is
-    of that given format and <0 otherwise */
-typedef int (*TEST_IMAGE_FORMAT)(char *,const char *);
-/** defines the type of function called to read an image or an image header
-    from a file corresponding to a given format. The first parameter is the
-    file name whereas the second parameter is an _image structure. Note that 
-    the file has been already opened (the file descriptor fd is valid). 
-    The output value is >0  if  the whole image has been read, it is 0 if 
-    only the header has been read and it is  <0 otherwise */
-typedef int (*READ_IMAGE_HEADER)(const char *, struct point_image *);
-/** defines the type of function called to write an image to a file
-    corresponding to a given format.  
-    The first parameter is the full file name whereas the second parameter
-    is an _image structure. 
-    Note that the file has to be opened and closed in the function.
-    The output value is >=0 if the whole image has been written
-    correctly and it is <0 otherwise */
-typedef int (*WRITE_IMAGE)(char *,struct point_image *);
-
-
-/** Image Format descriptor */
-typedef struct imformat {
-
-  /** a pointer on a function that tests if an image is of a given format */
-  TEST_IMAGE_FORMAT testImageFormat;
-
-  /** a pointer on a function that reads the header of an image file */
-  READ_IMAGE_HEADER readImageHeader;
-
-  /** a pointer on a function that writes  image of a given
-      format */
-  WRITE_IMAGE writeImage;
-
-  /* the file extension of format (including a dot ".": if several 
-     extensions may be used, they should be separed with a 
-     comma ".inr,.inr.gz" */
-  char fileExtension[IMAGE_FORMAT_NAME_LENGTH];
-  
-  /** the usual name given to a format : for instance "inrimage", "gif" */
-  char realName[IMAGE_FORMAT_NAME_LENGTH];
-  /* pointer towards the next image format*/
-  struct imformat *next;
-} IMAGE_FORMAT, *PTRIMAGE_FORMAT;
-
-/** Image descriptor */
-typedef struct point_image {
-  /** Image x dimension (number of columns) */
-  std::size_t xdim;
-  /** Image y dimension (number of rows) */
-  std::size_t ydim;
-  /** Image z dimension (number of planes) */
-  std::size_t zdim;
-  /** Image vectorial dimension */
-  std::size_t vdim;
-
-  /** Image voxel size in x dimension */
-  double vx;
-  /** Image voxel size in y dimension */
-  double vy;
-  /** Image voxel size in z dimension */
-  double vz;
-
-  /** Image offset in x dimension */
-  float tx;
-  /** Image offset in y dimension */
-  float ty;
-  /** Image offset in z dimension */
-  float tz;
-
-  /** Image rotation vector in x dimension */
-  float rx;
-  /** Image rotation vector in y dimension */
-  float ry;
-  /** Image rotation vector in z dimension */
-  float rz;
-
-  /** Image center in x dimension */
-  int cx;
-  /** Image center in y dimension */
-  int cy;
-  /** Image center in z dimension */
-  int cz;
-
-  /** spm */
-  float spm_offset;
-  float spm_scale;
-
-  /** Image data buffer */
-  void *data;
-
-  /** Image word size (in bytes) */
-  std::size_t wdim;
-  /** Image format to use for I/0. Should not be set by user */
-  PTRIMAGE_FORMAT imageFormat;
-  /** Data buffer vectors are interlaced or non interlaced */
-  VECTORIAL_MODE vectMode;
-  /** Image words kind */
-  WORD_KIND wordKind;
-  /** Image words sign */
-  SIGN sign;
-
-  /** User defined strings array. The user can use any internal purpose string.
-      Each string is written at then end of header after a '#' character. */
-  char **user;
-  /** Number of user defined strings */
-  unsigned int nuser;
-
-  /** Image file descriptor */
-  _ImageIO_file fd;
-
-
-  /** Kind of image file descriptor */
-  OPEN_MODE openMode;
-  /** Written words endianness */
-  ENDIANNESS endianness;
-  /** Kind of image data encoding */
-  DATA_MODE dataMode;
-
-} _image;
-
-
-
-/** Error codes */
-#define ImageIO_NO_ERROR 0
-#define ImageIO_UNKNOWN_TYPE -1
-#define ImageIO_OPENING -2
-#define ImageIO_READING_HEADER -3
-#define ImageIO_READING_IMAGE -4
-#define ImageIO_WRITING_HEADER -3
-#define ImageIO_WRITING_IMAGE -4
-#define ImageIO_WRITING_DATA  -5
-
-
-
-
-
-/** Allocates and initializes an image descriptor */
-CGAL_IMAGEIO_EXPORT _image *_initImage();
-
-/** Free an image descriptor
-    @param im image descriptor */
-CGAL_IMAGEIO_EXPORT void _freeImage(_image *im);
-
-/** creates an image descriptor from the given header information
-    @param x image x dimension (number of columns)
-    @param y image y dimension (number of rows)
-    @param z image z dimension (number of planes)
-    @param v image vectorial dimension
-    @param vx image voxel size in x dimension
-    @param vy image voxel size in y dimension
-    @param vz image voxel size in z dimension
-    @param w image word size in bytes
-    @param wk image word kind
-    @param sgn image word sign */
-CGAL_IMAGEIO_EXPORT _image *_createImage(int x, int y, int z, int v,
-                                         float vx, float vy, float vz, int w,
-                                         WORD_KIND wk, SIGN sgn);
-
-
-/** Reads an image from a file and returns an image descriptor or NULL if<br>
-    reading failed.<br>
-    Reads from stdin if image name is NULL.
-    The image data field points to a xdim * ydim * zdim * vdim buffer
-    containing voxels in order:
-    (Z1, Y1, X1, V1) (Z1, Y1, X1, V2), ... , (Z1, Y1, X1, Vt),
-    (Z1, Y1, X2, V1) ...         ...       , (Z1, Y1, X2, Vt),
-    ...
-    (Z1, Y1, Xn, V1) ...         ...       , (Z1, Y1, Xn, Vt),
-    (Z1, Y2, X1, V1) ...         ...       , (Z1, Y2, X1, Vt),
-    ...
-    (Z2, Y1, X1, V1) ...         ...       , (Z2, Y1, X1, Vt),
-    ...
-                     ...         ...       , (Zl, Ym, Xn, Vt)
-
-    Read the following format:
-    Inrimage,
-    GIF,
-    IRIS,
-    ANALYSE,
-    PGM,
-    PPM,
-    BMP,
-    GIS (CEA, IRISA, ENST 3D image format).
-    
-    See also:
-    http://www.dcs.ed.ac.uk/home/mxr/gfx/2d-hi.html and
-    http://www.gzip.org/zlib/
-    
-
-   @param name image file name or NULL for stdin */
-CGAL_IMAGEIO_EXPORT _image* _readImage(const char *name);
-
-/** Reads an image from a file and returns an image descriptor or NULL if<br>
-    reading failed.<br>
-    Reads from stdin if image name is NULL.
-    If the image is vectorial, it is uninterlaced, i.e. the image data
-    field points to a xdim * ydim * zdim * vdim buffer containing voxels
-    in order:
-     (V1, Z1, Y1, X1) (V1, Z1, Y1, X2), ... , (V1, Z1, Y1, Xn),
-     (V1, Z1, Y2, X1) ...         ...       , (V1, Z1, Y2, Xn),
-     ...
-     (V1, Z1, Ym, X1) ...         ...       , (V1, Z1, Ym, Xn),
-     (V1, Z2, Y1, X1) ...         ...       , (V1, Z2, Y1, Xn),
-     ...
-     (V2, Z1, Y1, X1) ...         ...       , (V2, Z1, Y1, Xn),
-     ...
-                      ...         ...       , (Vt, Zl, Ym, Xn)
-   @param name image file name or NULL */
-CGAL_IMAGEIO_EXPORT _image* _readNonInterlacedImage(const char *name);
-
-/** Read an image from a file. The word type is supposed to be unsigned
-    char, and the dimensions are (rx, ry, rz). */
-CGAL_IMAGEIO_EXPORT _image* _readImage_raw(const char *name,
-                                           const unsigned int rx,
-                                           const unsigned int ry,
-                                           const unsigned int rz,
-                                           const double vx = 1.,
-                                           const double vy = 1.,
-                                           const double vz = 1.,
-                                           const unsigned int offset = 0);
-
-
-/** Writes given image in file 'name'.<br>
-    If name ends with '.gz', file is gzipped.<br>
-    If name is NULL, image is sent to stdout.
-    @param im image descriptor 
-    @param name file name to store image or NULL */
-CGAL_IMAGEIO_EXPORT int _writeImage(_image *im, const char *name);
-
-/** Read one slice of given image whose header has already been read.<br>
-    File descriptor is let at the beginning of next slice and closed<br>
-    when end of file is encountered.<br>
-    If data buffer is NULL, it is allocated for one slice only.<br>
-    This funtion is dedicated to read huge inrimages.
-    @param im image descriptor */
-CGAL_IMAGEIO_EXPORT void _getNextSlice(_image *im);
-
-
-/** adds a format in the list of image format. Test if all mandatory
-    fields have been filled 
-    @param format : an image format 
-    @return -1 if it failed (missing information) and 0 if it succeeded */
-CGAL_IMAGEIO_EXPORT int addImageFormat( PTRIMAGE_FORMAT format);
-
-
-/** returns the first available image format */
-CGAL_IMAGEIO_EXPORT PTRIMAGE_FORMAT firstImageFormat();
-
-/** Reads header from an image file<br>
-    If file is an inrimage, only header is read. Otherwise, whole image<br>
-    is read and image file descriptor is closed.<br>
-    If name is NULL, header is read from STDIN
-    @param name image file name or NULL */
-CGAL_IMAGEIO_EXPORT _image* _readImageHeader(const char *name);
-CGAL_IMAGEIO_EXPORT _image *_readImageHeaderAndGetError( const char *name, int *error );
-
-/** Reads body from an inrmage whose header has been read by
-    _readImageHeader
-    @param im image to read */
-CGAL_IMAGEIO_EXPORT int _readImageData(_image *im);
-
-/** Reads body from a vectorial inrimage whose header has been read by
-    _readImageHeader. The image is uninterlaced
-    (see _readNonInterlacedImage for details).
-    @param im image descriptor*/
-CGAL_IMAGEIO_EXPORT int _readNonInterlacedImageData(_image *im);
-
-/** Reads body from a non-interlaced vectorial inrimage whose header has
-    been read by _readImageHeader. The image buffer is interlaced.
-    @param im image descriptor */
-CGAL_IMAGEIO_EXPORT int _readNonInterlacedFileData(_image *im);
-
-
-
-
-/** given an initialized file descriptor and a file name, open file
-   from stdout (if name == NULL), a gziped pipe (if file is gziped)
-   or a standard file otherwise.
-   @param im initialized image descriptor
-   @param name image file name */
-CGAL_IMAGEIO_EXPORT void _openWriteImage(_image* im, const char *name) ;
-   
-/** open an image file from stdin (if name == NULL), from a pipe
-   (piped with gzip if image was compressed) or from a standard file
-   @param im initialized image descriptor
-   @param name image file name */
-CGAL_IMAGEIO_EXPORT void _openReadImage(_image *im, const char *name);
-
-/** close an image file descriptor that was opened using _openImage
-    @param im opened image descriptor */
-
-
-/** return the bounding box of the image
-    @param im opened image descriptor */
-CGAL_IMAGEIO_EXPORT void _get_image_bounding_box(_image* im,
-                                                 double* x_min, double* y_min, double* z_min,
-                                                 double* x_max, double* y_max, double* z_max);
-
-/** returns the endianness of the hardware architecture */
-CGAL_IMAGEIO_EXPORT ENDIANNESS  _getEndianness(); 
-/** initializes the list of  supported image formats */
-CGAL_IMAGEIO_EXPORT void initSupportedFileFormat();
-/** prints supported image formats */
-CGAL_IMAGEIO_EXPORT void printSupportedFileFormat();
-/** free the list of  supported image formats */
-CGAL_IMAGEIO_EXPORT void removeSupportedFileFormat();
-
-
-/** return image type in given file
-    @param fileName image file name */
-CGAL_IMAGEIO_EXPORT PTRIMAGE_FORMAT imageType(const char *fileName);
-
-extern "C" {
-/** function prototype to allocate memory */
-typedef void *(*ALLOCATION_FUNCTION)(size_t);
-
-/** function prototype to free memory */
-typedef void (*DEALLOCATION_FUNCTION)(void *);
-}
-
-/** set allocation and deallocation routines
-    @param alloc new allocation routine
-    @param del new deallocation routine */
-CGAL_IMAGEIO_EXPORT void setImageIOAllocationRoutines(ALLOCATION_FUNCTION alloc,
-                                                      DEALLOCATION_FUNCTION del);
-
-
-
-/** call allocation routine */
-CGAL_IMAGEIO_EXPORT void *ImageIO_alloc(size_t);
-/** call deallocation routine */
-CGAL_IMAGEIO_EXPORT void ImageIO_free(void *);
-
-/** replaces fwrite function
-    @param im image to write
-    @param buf data buffer to write
-    @param len buffer length */
-CGAL_IMAGEIO_EXPORT size_t ImageIO_write(const _image *im, const void *buf, size_t len);
-
-
-/** replaces fread function
-    @param im image to read
-    @param buf data buffer to read
-    @param len buffer length */
-CGAL_IMAGEIO_EXPORT size_t ImageIO_read(const _image *im, void *buf, size_t len);
-
-/** replaces fgets function
- */
-CGAL_IMAGEIO_EXPORT char *ImageIO_gets( const _image *im, char *str, int size );
-
-/** replaces fseek function
- */
-CGAL_IMAGEIO_EXPORT int ImageIO_seek( const _image *im, long offset, int whence );
-
-/** replaces ferror function
- */
-CGAL_IMAGEIO_EXPORT int ImageIO_error( const _image *im );
-
-/** replaces fclose function
- */
-CGAL_IMAGEIO_EXPORT int ImageIO_close( _image *im );
-
-/** trilinear interpolation in an _image. The returned type is float (cast
-    are made if the image word type is different).
- */
-CGAL_IMAGEIO_EXPORT float triLinInterp(const _image* image, float posx, float posy, float posz,
-                                       const float value_outside = 0.);
-
-/** Alias for triLinInterp */
-CGAL_IMAGEIO_EXPORT inline float trilinear_interpolation(const _image* image,
-                                                         float posx, float posy, float posz)
-{
-  return triLinInterp(image, posx, posy, posz);
-}
-
-namespace CGAL {
-namespace IMAGEIO {
-
-//
-// The following definition are for the evaluate function.
-// 
-template <WORD_KIND wordKind, SIGN sign, std::size_t wdim>
-struct Word_type_generator
-{
-};
-
-template <SIGN sign>
-struct Word_type_generator<WK_FLOAT, sign, 4>
-{
-  typedef float type;
-};
-
-template <SIGN sign>
-struct Word_type_generator<WK_FLOAT, sign, 8>
-{
-  typedef double type;
-};
-
-template <>
-struct Word_type_generator<WK_FIXED, SGN_SIGNED, 1>
-{
-//   typedef boost::int8_t type;
-  typedef char type;
-};
-
-template <>
-struct Word_type_generator<WK_FIXED, SGN_UNSIGNED, 1>
-{
-  typedef boost::uint8_t type;
-};
-
-template <>
-struct Word_type_generator<WK_FIXED, SGN_SIGNED, 2>
-{
-  typedef boost::int16_t type;
-};
-
-template <>
-struct Word_type_generator<WK_FIXED, SGN_UNSIGNED, 2>
-{
-  typedef boost::uint16_t type;
-};
-
-template <>
-struct Word_type_generator<WK_FIXED, SGN_SIGNED, 4>
-{
-  typedef boost::int32_t type;
-};
-
-template <>
-struct Word_type_generator<WK_FIXED, SGN_UNSIGNED, 4>
-{
-  typedef boost::uint32_t type;
-};
-
-template <WORD_KIND wordKind, SIGN sign, std::size_t wdim>
-inline
-typename Word_type_generator<wordKind, sign, wdim>::type
-static_evaluate(const _image* image,
-                const std::size_t i,
-                const std::size_t j,
-                const std::size_t k)
-{
-  typedef typename Word_type_generator<wordKind, sign, wdim>::type Word;
-
-  return static_evaluate<Word>(image, i, j, k);
-}
-
-template <typename Word>
-inline
-Word
-static_evaluate(const _image* image,
-                const std::size_t i,
-                const std::size_t j,
-                const std::size_t k)
-{
-  return ((Word*)image->data)[(k * image->ydim + j) * image->xdim + i];
-}
-
-} // end namespace IMAGEIO
-} // end namespace CGAL
-
-#define CGAL_IMAGE_IO_CASE(image_ptr,code)                                                 \
-  switch(image_ptr->wordKind)                                                              \
-  {                                                                                        \
-  case WK_FLOAT:                                                                           \
-    switch(image_ptr->wdim)                                                                \
-    {                                                                                      \
-    case 4: {                                                                              \
-      typedef CGAL::IMAGEIO::Word_type_generator<WK_FLOAT, SGN_UNKNOWN, 4>::type Word;     \
-      code;                                                                                \
-      break;                                                                               \
-    }                                                                                      \
-    case 8: {                                                                              \
-      typedef CGAL::IMAGEIO::Word_type_generator<WK_FLOAT, SGN_UNKNOWN, 8>::type Word;     \
-      code;                                                                                \
-      break;                                                                               \
-    }                                                                                      \
-    default:                                                                               \
-      break;                                                                               \
-    }                                                                                      \
-    break;                                                                                 \
-  case WK_FIXED:                                                                           \
-    switch(image_ptr->wdim)                                                                \
-    {                                                                                      \
-    case 2: {                                                                              \
-      if(image_ptr->sign == SGN_SIGNED) {                                                  \
-        typedef CGAL::IMAGEIO::Word_type_generator<WK_FIXED, SGN_SIGNED, 2>::type Word;    \
-        code;                                                                              \
-        break;                                                                             \
-      }                                                                                    \
-      else {                                                                               \
-        typedef CGAL::IMAGEIO::Word_type_generator<WK_FIXED, SGN_UNSIGNED, 2>::type Word;  \
-        code;                                                                              \
-        break;                                                                             \
-      }                                                                                    \
-    }                                                                                      \
-    case 1: {                                                                              \
-      if(image_ptr->sign == SGN_SIGNED) {                                                  \
-        typedef CGAL::IMAGEIO::Word_type_generator<WK_FIXED, SGN_SIGNED, 1>::type Word;    \
-        code;                                                                              \
-        break;                                                                             \
-      }                                                                                    \
-      else {                                                                               \
-        typedef CGAL::IMAGEIO::Word_type_generator<WK_FIXED, SGN_UNSIGNED, 1>::type Word;  \
-        code;                                                                              \
-        break;                                                                             \
-      }                                                                                    \
-    }                                                                                      \
-    case 4: {                                                                              \
-      if(image_ptr->sign == SGN_SIGNED) {                                                  \
-        typedef CGAL::IMAGEIO::Word_type_generator<WK_FIXED, SGN_SIGNED, 4>::type Word;    \
-        code;                                                                              \
-        break;                                                                             \
-      }                                                                                    \
-      else {                                                                               \
-        typedef CGAL::IMAGEIO::Word_type_generator<WK_FIXED, SGN_UNSIGNED, 4>::type Word;  \
-        code;                                                                              \
-        break;                                                                             \
-      }                                                                                    \
-    }                                                                                      \
-    default:                                                                               \
-      break;                                                                               \
-    }                                                                                      \
-    break;                                                                                 \
-  default:                                                                                 \
-    break;                                                                                 \
-  }
-
-CGAL_IMAGEIO_EXPORT float evaluate(const _image* image,const std::size_t i,const std::size_t j,const std::size_t k);
-
-
-/** convert the data of the image to float 
-*/
-CGAL_IMAGEIO_EXPORT void convertImageTypeToFloat(_image* image);
-
-#ifdef CGAL_HEADER_ONLY
-#include <CGAL/ImageIO_impl.h>
-#endif // CGAL_HEADER_ONLY
-
-#endif // end IMAGEIO_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/ImageIO_impl.h b/3rdparty/CGAL-4.8/include/CGAL/ImageIO_impl.h
deleted file mode 100644
index 064e3d5..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/ImageIO_impl.h
+++ /dev/null
@@ -1,1633 +0,0 @@
-// Copyright (c) 2005, 2006 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// Copyright (c) 2007 Geometrica Project, INRIA Sophia-Antipolis (France) 
-// Copyright (c) 2008 GeometryFactory, Sophia-Antipolis (France) 
-// All rights reserved.
-//
-// The files in this directory are part of the ImageIO Library.
-// You can redistribute them and/or  modify them 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE.
-//
-// $URL$
-// $Id$
-//
-
-#ifdef CGAL_HEADER_ONLY
-#define CGAL_INLINE_FUNCTION inline
-#else
-#define CGAL_INLINE_FUNCTION
-#endif
-
-#ifdef _MSC_VER
-// Suppress deprecated warning for fileno and strdup
-#  pragma warning(disable:4996) 
-
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <io.h>
-#include <stdio.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdlib.h>
-#include <string.h>
-
-/* formats actuellement lus 
-
-   format     |   extension(s)   |  lecture  | ecriture 
-   INRIMAGE   |  .inr[.gz]       |     X     |     X     -> + .gradient[.gz] + .gradient_direction[.gz]
-   GIS        |  .dim, .ima[.gz] |     X     |     X
-   ANALYZE    |  .hdr, .img[.gz] |     X     |     X
-   PNM        |  .ppm, .pgm      |     X     |     X
-   GIF        |  .gif            |     X     |     
-   BMP        |  .gif            |     X     |     
-*/
-#include "inr.h"
-#include "gif.h"
-#include "gis.h"
-#include "pnm.h"
-#include "bmp.h"
-#include "iris.h"
-#include "analyze.h"
-#ifdef MINC_FILES
-#include "mincio.h"
-#endif
-
-
-
-/** the first file format is initialized to null */
-static PTRIMAGE_FORMAT firstFormat=NULL;
-
-/** the Inrimage file format (default format) is initialized to null */
-static PTRIMAGE_FORMAT InrimageFormat=NULL;
-
-struct Remove_supported_file_format {
-  ~Remove_supported_file_format()
-  {
-    removeSupportedFileFormat();
-  }
-};
-
-static Remove_supported_file_format rsff;
-
-
-
-/*--------------------------------------------------
- *
- * mimics standard routines
- *
- --------------------------------------------------*/
-
-
-
-extern "C" {
-  /* default allocation routine */
-  static void *(*allocRoutine)(size_t) = 0;
-  /* default deallocation routine */
-  static void (*deleteRoutine)(void *) = 0;
-}
-
-CGAL_INLINE_FUNCTION
-void *ImageIO_alloc(size_t s) {
-  if(!allocRoutine) allocRoutine = malloc;
-  return ( (*allocRoutine)(s) );
-}
-/* call allocation routine */
-CGAL_INLINE_FUNCTION
-void ImageIO_free(void *m) {
-  if(!deleteRoutine) deleteRoutine = free;
-  (*deleteRoutine)(m);
-}
-/* call deallocation routine */
-
-
-
-/* mimics fwrite() function.
-   According to _openWriteImage(), openMode will has one 
-   of the following value:
-   - OM_STD (for stdout)
-   - OM_GZ 
-   - OM_FILE
-*/
-CGAL_INLINE_FUNCTION
-size_t ImageIO_write(const _image *im, const void *buf, size_t len) {
-
-  switch(im->openMode) {
-  default :
-  case OM_CLOSE :
-    return 0;
-  case OM_STD :
-#ifdef CGAL_USE_ZLIB
-    return gzwrite(im->fd, (void *) buf, len);
-#else 
-    return fwrite(buf, 1, len, im->fd);
-#endif
-#ifdef CGAL_USE_ZLIB
-  case OM_GZ :
-    return gzwrite(im->fd, (void *) buf, len);
-#endif
-  case OM_FILE:
-    return fwrite(buf, 1, len, (FILE*)im->fd);
-  }
-  //return 0;
-}
-
-
-
-/* mimics fread() function.
-   According to _openReadImage(), openMode will has one 
-   of the following value:
-   - OM_STD (for stdin)
-   - OM_GZ *or* OM_FILE
-*/
-CGAL_INLINE_FUNCTION
-size_t ImageIO_read(const _image *im, void *buf, size_t len) 
-{
-  size_t to_be_read = len;
-  int l = -1;
-  char *b = (char*)buf;
-
-  switch(im->openMode) {
-  default :
-  case OM_CLOSE :
-    return 0;
-  case OM_STD :
-#ifdef CGAL_USE_ZLIB
-    while ( (to_be_read > 0) && ((l = gzread(im->fd, (void *) b, to_be_read)) > 0) ) {
-      to_be_read -= l;
-      b += l;
-    }
-#else 
-    while ( (to_be_read > 0) && ((l = fread( b, 1, to_be_read, im->fd )) > 0) ) {
-      to_be_read -= l;
-      b += l;
-    }
-#endif
-    return ( len - to_be_read );
-#ifdef CGAL_USE_ZLIB
-  case OM_GZ :
-    while ( (to_be_read > 0) && ((l = gzread(im->fd, (void *) b, to_be_read)) > 0) ) {
-      to_be_read -= l;
-      b += l;
-    }
-    if(l<0)
-    {
-      int errnum;
-      fprintf(stderr, "zlib error: %s\n", gzerror(im->fd, &errnum));
-    }
-    return ( len - to_be_read );
-#else
-  case OM_FILE :
-    while ( (to_be_read > 0) && ((l = fread( b, 1, to_be_read, im->fd )) > 0) ) {
-      to_be_read -= l;
-      b += l;
-    }
-    return ( len - to_be_read );
-#endif
-  }
-
-  //return 0;
-}
-
-
-
-/* mimics fgets() function.
-   According to _openReadImage(), openMode will has one 
-   of the following value:
-   - OM_STD (for stdout)
-   - OM_GZ *or* OM_FILE
-*/
-CGAL_INLINE_FUNCTION
-char *ImageIO_gets( const _image *im, char *str, int size )
-{
-  char *ret = NULL;
-  switch(im->openMode) {
-  default :
-  case OM_CLOSE :
-    return NULL;
-  case OM_STD :
-#ifdef CGAL_USE_ZLIB
-    ret = (char *) gzgets(im->fd, str, size );
-#else
-    ret = fgets(str, size, im->fd);
-#endif
-    break;
-#ifdef CGAL_USE_ZLIB
-  case OM_GZ :
-    ret = (char *) gzgets(im->fd, str, size);
-    break;
-#else
-  case OM_FILE :
-    ret = fgets(str, size, im->fd);
-    break;
-#endif
-  }
-  return ret;
-}
-
-
-
-CGAL_INLINE_FUNCTION
-int ImageIO_seek( const _image *im, long offset, int whence ) {
-  switch(im->openMode) {
-  case OM_CLOSE :
-  default :
-    return -1;
-#ifdef CGAL_USE_ZLIB
-  case OM_GZ:
-    return gzseek(im->fd, offset, whence );
-#endif
-  case OM_FILE:
-    return fseek( (FILE*)im->fd, offset, whence );
-  }
-}
-
-/* return non 0 in case of error
- */
-CGAL_INLINE_FUNCTION
-int ImageIO_error( const _image *im )
-{
-  switch(im->openMode) {
-  case OM_CLOSE :
-  default :
-    return 0;
-#ifdef CGAL_USE_ZLIB
-  case OM_GZ :
-    static int errnum;
-    (void)gzerror(im->fd, &errnum);
-    return( (errnum != Z_OK) || gzeof(im->fd) );
-#endif
-  case OM_FILE :
-    return( ferror( (FILE*)im->fd ) || feof( (FILE*)im->fd ) );
-  }
-  //return 0;
-}
-
-
-
-/* Upon successful completion 0 is returned.
-   
-   Closing the standard output with gzclose()
-   is necessary as it will flush the pending output.
- */
-CGAL_INLINE_FUNCTION
-int ImageIO_close( _image* im )
-{
-  int ret=0;
-  
-  switch ( im->openMode ) {
-  default :
-  case OM_CLOSE :
-    break;
-#ifdef CGAL_USE_ZLIB
-  case OM_GZ :
-  case OM_STD :
-    ret = gzclose( im->fd );
-    break;
-#else 
-  case OM_STD :
-    break;
-#endif
-  case OM_FILE :
-    ret = fclose( (FILE*)im->fd );
-  }
-  im->fd = NULL;
-  im->openMode = OM_CLOSE;
-  
-  return ret;
-}
-
-
-
-
-
-
-
-/* given an initialized file descriptor and a file name, 
-   open file from stdin (if name == NULL, or name == "-", or name == "<"), 
-   or a standard/gzipped file otherwise (gzipped files are handled assuming
-   that it is compiled and linked with zlib). 
-   openMode will have one of the following value:
-   - OM_STD (for stdin)
-   - OM_GZ *or* OM_FILE
-*/
-CGAL_INLINE_FUNCTION
-void _openReadImage(_image* im, const char *name) {
-  if(im->openMode == OM_CLOSE) {
-
-    /* open from stdin */
-    if( name == NULL || name[0] == '\0' 
-	|| (name[0] == '-' && name[1] == '\0') 
-	|| (name[0] == '<' && name[1] == '\0') ) {
-#ifdef CGAL_USE_ZLIB      
-      im->fd = gzdopen(fileno(stdin), "rb");
-#else
-      im->fd = fdopen(fileno(stdin), "rb");
-#endif
-      im->openMode = OM_STD;
-    }
-
-    else {
-#ifdef CGAL_USE_ZLIB     
-      im->fd = gzopen(name, "rb");
-      if(im->fd) im->openMode = OM_GZ;
-#else
-      im->fd = fopen(name, "rb");
-      if(im->fd) im->openMode = OM_FILE;
-#endif
-
-    }
-
-  }
-}
-
-
-
-
-
-/* given an initialized file descriptor and a file name, 
-   open file from stdout (if name == NULL, or name == "-", or name == ">"), 
-   a gzipped pipe (if name got the extension ".gz")
-   or a standard file otherwise.
-   openMode will have one of the following value:
-   - OM_STD (for stdout)
-   - OM_GZ 
-   - OM_FILE
-*/
-CGAL_INLINE_FUNCTION
-void _openWriteImage(_image* im, const char *name) 
-{
-  im->openMode = OM_CLOSE;
-
-  if( name == NULL || name[0] == '\0' 
-      || (name[0] == '-' && name[1] == '\0') 
-      || (name[0] == '>' && name[1] == '\0') ) {
-
-#ifdef CGAL_USE_ZLIB
-#if (defined _LINUX_) || (defined _SOLARIS_) || (defined _SGI_)
-    im->fd = gzdopen(1, "wb");
-#else
-    im->fd = gzdopen(fileno(stdout), "wb");
-#endif
-#else    
-    im->fd = (_ImageIO_file) stdout;
-#endif
-    im->openMode = OM_STD;
-  }
-
-  else{
-#ifdef CGAL_USE_ZLIB      
-    
-    /* from gzopen() doc:
-       ... The mode parameter is as in fopen ("rb" or "wb") but can
-       also include a compression level ("wb9") or a strategy: 'f' for
-       filtered data as in "wb6f", 'h' for Huffman only compression as
-       in "wb1h" ...
-       However, a small .gz header will be written ... thus gz(d)open can not
-       be used for rgular files.
-    */
-    
-    if( !strncmp(name+strlen(name)-3, ".gz", 3) )
-      {
-#ifdef _MSC_VER
-	int ffd=_open(name,_O_RDWR | _O_CREAT| _O_TRUNC | _O_BINARY, _S_IREAD|_S_IWRITE);
-	im->fd = gzdopen( ffd, "wb" );
-#else
-	im->fd = gzopen( name, "wb" );
-#endif
-	im->openMode = OM_GZ;
-      }
-    else 
-#endif
-    {
-      im->fd = (_ImageIO_file) fopen(name, "wb");
-      im->openMode = OM_FILE;
-    }
-  }
-}
-
-
-
-/* set allocation and deallocation routines */
-CGAL_INLINE_FUNCTION
-void setImageIOAllocationRoutines(ALLOCATION_FUNCTION alloc,
-				  DEALLOCATION_FUNCTION del) {
-  if(alloc != NULL) allocRoutine = alloc;
-  if(del != NULL) deleteRoutine = del;
-}
-
-
-
-
-
-/*--------------------------------------------------
- *
- *
- *
- --------------------------------------------------*/
-
-
-
-
-
-CGAL_INLINE_FUNCTION
-ENDIANNESS _getEndianness()
-{
-  union {
-    unsigned char uc[2];
-    unsigned short us;
-  } twobytes;
-  twobytes.us = 255;
-  /* on linux or dec
-   */
-  if ( twobytes.uc[1] == 0 ) return( END_LITTLE );
-  /* on solaris or sgi
-   */
-  return( END_BIG );
-}
-
-
-
-
-
-
-
-/* Allocates and initializes an image descriptor */
-CGAL_INLINE_FUNCTION
-_image *_initImage() {
-  _image *im;
-
-  im = (_image *) ImageIO_alloc(sizeof(_image));
-  if ( im == NULL ) return( im );
-
-  /* default image size is 1*1*1 */
-  im->xdim = im->ydim = im->zdim = im->vdim = 1;
-  /* default image voxel size is 1.0*1.0*1.0 */
-  im->vx = im->vy = im->vz = 1.0;
-
-  /* default image center  is 0 0 0 */
-  im->cx = im->cy = im->cz = 0;
-
-  /* default image offset  is 0 0 0 */
-  im->tx = im->ty = im->tz = 0.0;
-
-  /* default image rotation  is 0 0 0 */
-  im->rx = im->ry = im->rz = 0.0;
-
-  /* no data yet */
-  im->data = NULL;
-
-  /* no file associated to image */
-  im->fd = NULL;
-  im->openMode = OM_CLOSE;
-  im->endianness = END_UNKNOWN;
-
-  /* unknown data kind
-     default is binary
-   */
-  im->dataMode = DM_BINARY;
-
-  /* no user string */
-  im->user = NULL;
-  im->nuser = 0;
-
-  /* unknown word kind */
-  im->wdim = 0;
-  im->wordKind = WK_UNKNOWN;
-  im->vectMode = VM_SCALAR;
-  im->sign = SGN_UNKNOWN;
-  im->imageFormat = NULL;
-
-  /** eventually initializes the supported file formats */
-  if (firstFormat==NULL)
-    initSupportedFileFormat();
-  /* return image descriptor */
-  return im;
-}
-
-CGAL_INLINE_FUNCTION
-_image *_createImage(int x, int y, int z, int v,
-		     float vx, float vy, float vz, int w,
-		     WORD_KIND wk, SIGN sgn)
-{
-  _image *im;
-  
-  im = (_image *) ImageIO_alloc(sizeof(_image));
-  if ( im == NULL ) return( im );
-  
-  im->xdim = x;
-  im->ydim = y;
-  im->zdim = z;
-  im->vdim = v;
-  im->vx = vx;
-  im->vy = vy;
-  im->vz = vz;
-
-  /* default image center  is 0 0 0 */
-  im->cx = im->cy = im->cz = 0;
-
-  /* default image offset  is 0 0 0 */
-  im->tx = im->ty = im->tz = 0.0;
-
-  /* default image rotation  is 0 0 0 */
-  im->rx = im->ry = im->rz = 0.0;
-
-  /* no data yet */
-  im->data = ImageIO_alloc(x*y*z*v*w);
-
-  /* no file associated to image */
-  im->fd = NULL;
-  im->openMode = OM_CLOSE;
-  im->endianness = END_UNKNOWN;
-
-  /* unknown data kind
-     default is binary
-   */
-  im->dataMode = DM_BINARY;
-
-  /* no user string */
-  im->user = NULL;
-  im->nuser = 0;
-
-  /* unknown word kind */
-  im->wdim = w;
-  im->wordKind = wk;
-  im->vectMode = VM_SCALAR;
-  im->sign = sgn;
-  im->imageFormat = NULL;
-
-  /** eventually initializes the supported file formats */
-  if (firstFormat==NULL)
-    initSupportedFileFormat();
-  /* return image descriptor */
-  return im;
-}
-
-/* return the bounding box of the image */
-CGAL_INLINE_FUNCTION
-void _get_image_bounding_box(_image* im,
-			     double* x_min, double* y_min, double* z_min,
-			     double* x_max, double* y_max, double* z_max) {
-  *x_min = im->tx;
-  *y_min = im->ty;
-  *z_min = im->tz;
-  *x_max = (im->xdim - 1.0f)*(im->vx) + *x_min ;
-  *y_max = (im->ydim - 1.0f)*(im->vy) + *y_min ;
-  *z_max = (im->zdim - 1.0f)*(im->vz) + *z_min ;
-}
-
-/* Free an image descriptor */
-CGAL_INLINE_FUNCTION
-void _freeImage(_image *im) {
-  unsigned int i;
-
-  if ( im == NULL ) return;
-
-  /* close image if opened */
-  if(im->openMode != OM_CLOSE) ImageIO_close(im);
-
-  /* free data if any */
-  if(im->data != NULL) ImageIO_free(im->data);
-  im->data = NULL;
-
-  /* free user string array if any */
-  if( (im->nuser > 0) && (im->user != NULL) ) {
-    for(i = 0; i < im->nuser; i++)
-      if ( im->user[i] != NULL ) ImageIO_free(im->user[i]);
-    ImageIO_free(im->user);
-  }
-  im->nuser = 0;
-  im->user = NULL;
-
-  /* free given descriptor */
-  ImageIO_free(im);
-}
-
-
-
-
-
-/* Reads an image from a file and returns an image descriptor or NULL if
-   reading failed.
-   Reads from stdin if image name is NULL. */
-CGAL_INLINE_FUNCTION
-_image* _readImage(const char *name) {
-  _image *im;
-
-
-  /* read header */
-  im = _readImageHeader( name );
-
-  if(im != NULL && im->openMode != OM_CLOSE) {
-    /* read body */
-    if(_readImageData(im) < 0) {
-      fprintf(stderr, "_readImage: error: invalid data encountered in \'%s\'\n",
-	      name);
-      _freeImage(im);
-      return NULL;
-    }
-    ImageIO_close(im);
-  }
-
-  return im;
-}
-
-// raw
-CGAL_INLINE_FUNCTION
-_image* _readImage_raw(const char *name,
-                       const unsigned int rx,
-                       const unsigned int ry,
-                       const unsigned int rz,
-                       const double vx,
-                       const double vy,
-                       const double vz,
-		       const unsigned int offset)
-{
-  _image *im = NULL;
-  im = (_image *) ImageIO_alloc(sizeof(_image));
-  if ( im == NULL )
-    return NULL;
-
-  im->xdim = rx;
-  im->ydim = ry;
-  im->zdim = rz;
-  im->vdim = 1;
-  im->vx = vx;
-  im->vy = vy;
-  im->vz = vz;
-
-  // image center
-  im->cx = im->cy = im->cz = 0;
-
-  // image offset
-  im->tx = im->ty = im->tz = 0.0;
-
-  // image rotation
-  im->rx = im->ry = im->rz = 0.0;
-
-
-  im->fd = NULL;
-  im->openMode = OM_CLOSE;
-  im->endianness = END_UNKNOWN;
-
-  im->dataMode = DM_BINARY;
-
-  // no user string
-  im->user = NULL;
-  im->nuser = 0;
-
-  // word type (unsigned byte)
-  im->wdim = 1;
-  im->wordKind = WK_FIXED;
-  im->vectMode = VM_SCALAR;
-  im->sign = SGN_UNSIGNED;
-  im->imageFormat = NULL;
-
-  // read file
-  ::_openReadImage(im, name);
-  if(!im->fd) {
-    fprintf(stderr, "_readImage_raw: error: unable to open file \'%s\'\n", name);
-    _freeImage(im);
-    return NULL;
-  }
-
-  // read offset
-  if(offset > 0) {
-    im->data = ImageIO_alloc(offset+1);
-    ImageIO_read(im, im->data, offset);
-    ImageIO_free(im->data);
-  }
-  // allocate memory
-  im->data = ImageIO_alloc(rx*ry*rz);
-  if(im->data == NULL)
-    return NULL;
-
-  // read
-  ImageIO_read(im, im->data, rx*ry*rz);
-
-  ImageIO_close(im);
-  /*
-    unsigned int i,j,k;
-    unsigned char *data = (unsigned char *)im->data;
-    int dimxy = rx * ry;
-    for(i=0;i<rx;i++)
-    for(j=0;j<ry;j++)
-    for(k=0;k<rz;k++)
-    {
-    unsigned char voxel;
-    fread(&voxel,1,1,pFile);
-    data[k * dimxy + j * rx + i] = voxel;
-    }
-  */
-
-  return im;
-}
-
-/* Reads an image from a file and returns an image descriptor or NULL if<br>
-   reading failed.<br>
-   Reads from stdin if image name is NULL.
-   If the image is vectorial, it is uninterlaced. */
-CGAL_INLINE_FUNCTION
-_image* _readNonInterlacedImage(const char *name) {
-  _image *im;
-
-  /* read header */
-  im = _readImageHeader(name);
-
-  if(im && im->openMode != OM_CLOSE) {
-    /* read scalar image body */
-    if(im->vdim == 1) {
-      if(_readImageData(im) < 0) {
-	fprintf(stderr, "_readImage: error: invalid data encountered in \'%s\'\n",
-		name);
-	_freeImage(im);
-	return NULL;
-      }
-    }
-    /* read vectorial image body */
-    else {
-      im->vectMode = VM_NON_INTERLACED;
-      if(_readNonInterlacedImageData(im) < 0) {
-	fprintf(stderr, "_readImage: error: invalid data encountered in \'%s\'\n",
-		name);
-	_freeImage(im);
-	return NULL;
-      }
-    }
-    ImageIO_close(im);
-   }
-
-  return im;
-}
-
-
-
-
-
-
-
-
-
-
-
-/* Write inrimage given in inr in file name. If file name's suffix is
-   .gz, the image is gziped. If file name's suffix is .hdr, the image
-   is written in ANALYZE format. If file name is NULL, image is written
-   on stdout */
-CGAL_INLINE_FUNCTION
-int _writeImage(_image *im, const char *name_to_be_written ) {
-
-  int r = ImageIO_NO_ERROR;
-  int length = 0;
-  char *name = NULL;
-  char *baseName = NULL;
-
-  if ( im == NULL ) return -1;
-
-  /* different conventions for the standard input
-   */
-  if ( name_to_be_written == NULL || name_to_be_written[0] == '\0' 
-       || (name_to_be_written[0] == '-' && name_to_be_written[1] == '\0') 
-       || (name_to_be_written[0] == '>' && name_to_be_written[1] == '\0') ) {
-    name = NULL;
-  }
-  else {
-    name = strdup( name_to_be_written );
-  }
-
-  initSupportedFileFormat();
-
-  /* what is the wanted format
-   */
-  if ( name == NULL ) {
-    im->imageFormat = InrimageFormat;
-  } else {
-    int i,extLength;
-    PTRIMAGE_FORMAT f;
-    char ext[IMAGE_FORMAT_NAME_LENGTH];
-    char *ptr;
-    
-    
-    /* scan all formats; */
-    im->imageFormat=NULL;
-    length=strlen(name);
-
-    for(f=firstFormat;(f!=NULL)&& (im->imageFormat==NULL);f=f->next) {
-      /* scan all extensions for that format */
-      ptr=&f->fileExtension[0];
-
-      do {
-	/* get next file extension */
-	i=0;
-	for(i=0;((*ptr)!=',' && (*ptr)!='\0');i++,ptr++) {
-	  ext[i]=(*ptr);
-	}
-	if ((*ptr)==',') {
-	  ext[i]='\0';
-	  ptr++;
-	}
-	else {
-	  ext[i]='\0';
-	}
-	extLength=strlen(ext);
-
-	/* test if the tail of name matches the extension */
-	if ( (length > extLength) && (!strcmp( name + length - extLength, ext)) ) {
-	  im->imageFormat=f;
-	  /* copy original name and removes extension */
-	  baseName=strdup(name);
-	  for(i= length - extLength;i<length;++i)
-	    baseName[i]='\0';
-	}
-
-      } while (((*ptr)!='\0') && (im->imageFormat==NULL));
-    }
-
-    if (!im->imageFormat) { 
-      fprintf(stderr, "_writeImage: warning : unknown extension in %s = assuming Inrimage\n",name);
-      im->imageFormat=InrimageFormat;
-      baseName=strdup(name);
-    }
-  }
-
-
-  /* open file descriptor */
-  /* _openWriteImage( im, name ) ; 
-  
-  
-
-  if(!im->fd) {
-     fprintf(stderr, "_writeImage: error: open failed\n");
-     if ( name != NULL ) free( name );
-     if ( baseName != NULL ) free( baseName );
-     return ImageIO_OPENING;
-  }
-  */
-
-  if (im->imageFormat) {
-
-    if (im->imageFormat->writeImage==NULL) {
-      im->imageFormat=InrimageFormat;
-    }
-
-    if ( 0 ) {
-      fprintf(stderr, "_writeImage: will write '%s' with '%s' format\n",
-	      name, im->imageFormat->realName );
-    }
-
-    if ((*im->imageFormat->writeImage)(name, im)<0) {
-      fprintf(stderr, "_writeImage: error: unable to write \'%s\'\n",
-	      name);
-      r = ImageIO_WRITING_HEADER;
-    } 
-    
-  }
-  
-
-
-  /* close file descriptor */
-  ImageIO_close( im );
-
-  im->fd = NULL;
-  im->openMode = OM_CLOSE;
-
-  if ( baseName != NULL ) free( baseName );
-  if ( name != NULL ) free( name );
- 
-  return r;
-}
-
-
-
-
-
-
-
-
-
-
-
-
-/* read header from an image file 
-   
-   if standard input, it's an inrimage
-   if not, get a magic string
-   and try to find the good format
-
-   if data are in a separate file,
-   the header reading procedure will open
-   the data file.
-
-   error:
-   0  success
-   -1 unknown image type
-   -2 error while opening
-   -3 error while reading header
-   -4 error while reading header or data
- */
-CGAL_INLINE_FUNCTION
-_image *_readImageHeader( const char *name ) {
-  int error = 0;
-  return( _readImageHeaderAndGetError( name, &error ) );
-}
-
-
-
-CGAL_INLINE_FUNCTION
-_image *_readImageHeaderAndGetError( const char *name_to_be_read, int *error )
-{
-  _image *im;
-  char magic[5];
-  char *name = NULL;
-  PTRIMAGE_FORMAT f;
-  int res;
-
-  *error = ImageIO_NO_ERROR;
-  
-  /* open image file */
-  im = _initImage();
-  if ( name_to_be_read == NULL || name_to_be_read[0] == '\0' 
-       || (name_to_be_read[0] == '-' && name_to_be_read[1] == '\0') 
-       || (name_to_be_read[0] == '<' && name_to_be_read[1] == '\0') ) {
-    name = NULL;
-  }
-  else {
-    name = strdup( name_to_be_read );
-  }
-
-
-  _openReadImage(im, name);	
-
-  if(!im->fd) {
-    fprintf(stderr, "_readImageHeaderAndGetError: error: unable to open file \'%s\'\n", name);
-    _freeImage(im);
-    *error = ImageIO_OPENING;
-    if ( name != NULL ) free( name );
-    return NULL;
-  }
-
-  initSupportedFileFormat();
-  
-  /* what is the wanted format ?
-     assume that stdin is inrimage
-   */
-  if(im->openMode == OM_STD) {
-    im->imageFormat=InrimageFormat;
-  }
-  else {
-   /* get magic string for disk files
-    */
-    ImageIO_read(im, magic, 4);
-    magic[4] = '\0';
-    ImageIO_seek(im, 0L, SEEK_SET);
-    /** test each format */
-    for(f=firstFormat;(f!=NULL)&& (im->imageFormat==NULL);f=f->next) {
-      /* test if it is the correct format based on magic and file extension */
-      if (((*f->testImageFormat)(magic, name)) >=0) {
-	im->imageFormat=f;
-      }
-    }
-  }
-
-  if ( im->imageFormat == NULL ) {
-    fprintf(stderr, "_readImageHeaderAndGetError: does not find image format for \'%s\'\n", name);
-    ImageIO_close( im );
-    _freeImage(im);
-    *error = ImageIO_UNKNOWN_TYPE;
-    if ( name != NULL ) free( name );
-    return NULL;
-  }
-
-  /* now tests if the header can be read correctly */
-	
-  res=(*(im->imageFormat)->readImageHeader)(name,im);
-  /* could read header only */ 
-  if (res == 0) {
-    if ( name != NULL ) free( name );
-    return( im );
-  } 
-  /* could read header and data */
-  else if ( res > 0 ) {
-    ImageIO_close(im);
-    if ( name != NULL ) free( name );
-    return im;
-  }  
-
-  /* could not read error : throw error */
-  fprintf(stderr, "_readImageHeaderAndGetError: an error occurs when reading image\n" );
-  if ( name == NULL || im->openMode == OM_STD) {
-    fprintf(stderr, "\t from \'standard input\'" );
-  }
-  else {
-    fprintf(stderr, "\t from file \'%s\'", name );
-  }
-  fprintf(stderr, " using format \'%s\'\n", (im->imageFormat)->realName );
-  ImageIO_close( im );
-  _freeImage(im);
-  *error = ImageIO_READING_HEADER;
-  if ( name != NULL ) free( name );
-  return NULL;
-
-}
-
-
-
-
-
-
-
-CGAL_INLINE_FUNCTION
-static void _swapImageData( _image *im ) 
-{
-  unsigned char *ptr1, *ptr2, b[8];
-  unsigned short int si, *ptr3, *ptr4;
-  unsigned int        i, *ptr5, *ptr6;
-  int size, length;
-  
-  if( _getEndianness() != im->endianness) {
-
-    size = im->xdim * im->ydim * im->zdim * im->vdim * im->wdim;
-    if ( size <= 0 ) return;
-
-    length = size / im->wdim;
-    ptr1 = ptr2 = (unsigned char *) im->data;
-    
-    /* 2 bytes swap */
-    if(im->wdim == 2) {
-      /*
-	while(length--) {
-	b[0] = *ptr1++;
-	b[1] = *ptr1++;
-	*ptr2++ = b[1];
-	*ptr2++ = b[0];
-	}
-      */
-      ptr3 = ptr4 = (unsigned short int *) im->data;
-      while( length-- ) {
-	si = *ptr3++;
-	*ptr4++ = ((si >> 8) & 0xff) | (si << 8);
-      }
-    }
-    
-    /* 4 bytes swap */
-    else if(im->wdim == 4) {
-      /*
-	while(length--) {
-	b[0] = *ptr1++;
-	b[1] = *ptr1++;
-	b[2] = *ptr1++;
-	b[3] = *ptr1++;
-	*ptr2++ = b[3];
-	*ptr2++ = b[2];
-	*ptr2++ = b[1];
-	*ptr2++ = b[0];
-	}
-      */
-      ptr5 = ptr6 = (unsigned int *) im->data;
-      while( length-- ) {
-	i = *ptr5++;
-	*ptr6++ =  (i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | ((i >> 24) & 0xff);
-      }
-    }
-    /* 8 bytes swap */
-    else if(im->wdim == 8) {
-      while(length--) {
-	b[0] = *ptr1++;
-	b[1] = *ptr1++;
-	b[2] = *ptr1++;
-	b[3] = *ptr1++;
-	b[4] = *ptr1++;
-	b[5] = *ptr1++;
-	b[6] = *ptr1++;
-	b[7] = *ptr1++;
-	*ptr2++ = b[7];
-	*ptr2++ = b[6];
-	*ptr2++ = b[5];
-	*ptr2++ = b[4];
-	*ptr2++ = b[3];
-	*ptr2++ = b[2];
-	*ptr2++ = b[1];
-	*ptr2++ = b[0];
-      }
-    }
-  }
-}
-
-
-
-
-
-
-/* Read data of an inrimage.
-   If im->data is not NULL, assume that the buffer was previously allocated
-   Swap bytes depending on the endianness and the current architecture  */
-CGAL_INLINE_FUNCTION
-int _readImageData(_image *im) {
-  unsigned long size, nread;
-
-  if(im->openMode != OM_CLOSE) {
-    size = im->xdim * im->ydim * im->zdim * im->vdim * im->wdim;
-    
-    if ( size <= 0 ) return -3;
-
-    if(!im->data) {
-      im->data = (unsigned char *) ImageIO_alloc(size);
-      if(!im->data) return -2;
-    }
-
-    nread = ImageIO_read(im, im->data, size);
-    if(nread != size) return -1;
-
-
-    /* architecture is big endian and data little endian 
-       length = nb of points
-     */
-    _swapImageData( im );
-
-
-  }
-
-  return 1;
-}
-
-
-
-
-
-/* Read data of a vectorial inrimage, making the resulting buffer non-
-   inerlaced.
-   If im->data is not NULL, assume that the buffer was previously allocated
-   Swap bytes depending on the endianness and the current architecture. */
-CGAL_INLINE_FUNCTION
-int _readNonInterlacedImageData(_image *im) {
-  unsigned long size, nread;
-  unsigned char **vp, *buf;
-  unsigned int i, j, k, v, w;
-
-  if(im->vdim == 1) return _readImageData(im);
-  
-  if(im->openMode != OM_CLOSE) {
-    size = im->xdim * im->ydim * im->zdim * im->vdim * im->wdim;
-
-    if ( size <= 0 ) return -3;
-
-    if(!im->data) {
-      im->data = (unsigned char *) ImageIO_alloc(size);
-      if(!im->data) return -2;
-    }
-
-    vp = (unsigned char **) ImageIO_alloc(im->vdim * sizeof(unsigned char *));
-    buf = (unsigned char *) ImageIO_alloc(im->vdim * im->wdim);
-    size = im->xdim * im->ydim * im->zdim * im->wdim;
-    for(v = 0; v < im->vdim; v++)
-      vp[v] = (unsigned char *) im->data + v * size;
-
-    for(k = 0; k < im->zdim; k++) {
-      for(j = 0; j < im->ydim; j++) {
-	for(i = 0; i < im->xdim; i++) {
-	  nread = ImageIO_read(im, buf, im->vdim * im->wdim);
-	  if(nread != im->vdim * im->wdim) return -1;
-	  for(v = 0; v < im->vdim; v++)
-	    for(w = 0; w < im->wdim; w++)
-	      *vp[v]++ = *buf++;
-	  buf -= im->vdim * im->wdim;
-	}
-      }
-    }
-
-    ImageIO_free(buf);
-    ImageIO_free(vp);
-
-    /* architecture is big endian and data little endian */
-    _swapImageData( im );
-
-    
-    /* reorder lines */
-    /* no non-interlaced data for ANALYZE. But if ever... */
-/*     if( im->imageFormat == IF_ANALYZE ) { */
-/*        int v ; */
-/*        int vdim = im->vdim ; */
-/*        int lineSize = im->wdim * im->xdim ; */
-/*        int vsize = lineSize * im->ydim * im->zdim ; */
-/*        char* swapped = ImageIO_alloc(lineSize) ; */
-/*        for( v = 0 ; v < vdim ; ++v ) */
-/*        { */
-/* 	  char* buf1 = (char*)im->data + v*vsize ; */
-/* 	  char* buf2 = buf1 + vsize - lineSize ; */
-	  
-/* 	  while( buf1 < buf2 ) */
-/* 	  { */
-/* 	     memcpy( swapped, buf1, lineSize ) ; */
-/* 	     memcpy( buf1, buf2, lineSize ) ; */
-/* 	     memcpy( buf2, swapped, lineSize ) ; */
-/* 	     buf1 += lineSize ; */
-/* 	     buf2 -= lineSize ; */
-/* 	  } */
-
-/* 	  ImageIO_free( swapped ) ; */
-/*        } */
-/*     } */
-  }
-
-  return 1;
-}
-
-
-/* Reads body from a non-interlaced vectorial inrimage whose header has
-   been read by _readImageHeader. The image buffer is interlaced. */
-CGAL_INLINE_FUNCTION
-int _readNonInterlacedFileData(_image *im) {
-  unsigned long size, nread;
-  unsigned char *ptr1, *vp, *buf;
-  unsigned int i, j, k, v, w;
-
-  if(im->vdim == 1) return _readImageData(im);
-
-  if(im->openMode != OM_CLOSE) {
-    size = im->xdim * im->ydim * im->zdim * im->vdim * im->wdim;
-
-    if ( size <= 0 ) return -3;
-
-    if(!im->data) {
-      im->data = (unsigned char *) ImageIO_alloc(size);
-      if(!im->data) return -2;
-    }
-
-    size = im->xdim * im->ydim * im->zdim * im->wdim;
-    buf = ptr1 = (unsigned char *) ImageIO_alloc(size);
-
-    for(v = 0; v < im->vdim; v++) {
-      buf = ptr1;
-      nread = ImageIO_read(im, buf, size);
-      if(nread != size) return -1;
-      vp = (unsigned char *) im->data + (v * im->wdim);
-      for(k = 0; k < im->zdim; k++) {
-	for(j = 0; j < im->ydim; j++) {
-	  for(i = 0; i < im->xdim; i++) {
-	    for(w = 0; w < im->wdim; w++) *vp++ = *buf++;
-	    vp += (im->vdim - 1) * im->wdim;
-	  }
-	}
-      }
-    }
-
-    ImageIO_free(buf);
-
-    /* architecture is big endian and data little endian */
-    _swapImageData( im );
-    
-    
-    /* reorder lines */
-    /* no non-interlaced data for ANALYZE. But if ever... */
-/*     if( im->imageFormat == IF_ANALYZE ) { */
-/*        int v ; */
-/*        int vdim = im->vdim ; */
-/*        int lineSize = im->wdim * im->xdim ; */
-/*        int vsize = lineSize * im->ydim * im->zdim ; */
-/*        char* swapped = ImageIO_alloc(lineSize) ; */
-/*        for( v = 0 ; v < vdim ; ++v ) */
-/*        { */
-/* 	  char* buf1 = (char*)im->data + v*vsize ; */
-/* 	  char* buf2 = buf1 + vsize - lineSize ; */
-	  
-/* 	  while( buf1 < buf2 ) */
-/* 	  { */
-/* 	     memcpy( swapped, buf1, lineSize ) ; */
-/* 	     memcpy( buf1, buf2, lineSize ) ; */
-/* 	     memcpy( buf2, swapped, lineSize ) ; */
-/* 	     buf1 += lineSize ; */
-/* 	     buf2 -= lineSize ; */
-/* 	  } */
-
-/* 	  ImageIO_free( swapped ) ; */
-/*        } */
-/*     } */
-  }
-
-  return 1;  
-}
-
-
-
-
-
-
-
-
-
-
-/*--------------------------------------------------
- *
- * ?????
- *
- --------------------------------------------------*/
-
-
-
-
-
-/* check the type of image in fileName */
-CGAL_INLINE_FUNCTION
-PTRIMAGE_FORMAT imageType(const char *fileName) {
-  _ImageIO_file f;
-  char magic[5];
-  PTRIMAGE_FORMAT format;
-
-  if(!fileName) {
-#ifdef CGAL_USE_ZLIB    
-    f = gzdopen(fileno(stdin), "rb");
-#else
-    f = fdopen(fileno(stdin), "rb");
-#endif
-  }
-  else {
-#ifdef CGAL_USE_ZLIB      
-    f = gzopen(fileName, "rb");
-#else
-    f = fopen(fileName, "rb");
-#endif
-  }
-
-  if(!f) return NULL;
-  
-#ifdef CGAL_USE_ZLIB
-  gzread( f, (void *) magic, 4);
-#else
-  fread( (void *) magic, 1, 4, f );
-#endif
-
-
-  magic[4] = '\0';
-
-#ifdef CGAL_USE_ZLIB 
-  gzclose( f );
-#else
-  if(fileName) fclose( f );
-#endif
-
-  if (firstFormat==NULL)
-    initSupportedFileFormat();
-
-  for(format=firstFormat;(format!=NULL);format=format->next) {
-    /* test if it is the correct header based on magic and file extension */
-    if (((*format->testImageFormat)(magic,fileName)) >=0) {
-      return format;
-    }
-  }
-  return 0;
-
-}
-
-
-
-
-
-/*--------------------------------------------------
- *
- * Image Format Management
- *
- --------------------------------------------------*/
-
-
-
-
-
-/** adds a format at the beginning of the list of image formats. 
-    Test if all mandatory fields have been filled */
-CGAL_INLINE_FUNCTION
-int addImageFormat( PTRIMAGE_FORMAT format) 
-{
-  if ( (format->testImageFormat) &&
-       (format->readImageHeader) &&
-       (strlen(format->fileExtension)>0) &&
-       (strlen(format->realName)>0) ) {
-
-    format->next=firstFormat;
-    firstFormat=format;
-    
-    return 0;
-
-  } 
-  else {
-    fprintf(stderr,"addImageFormat: information missing in file format %s\n",
-	    format->realName);
-    return -1;
-  }
-}
-
-/** adds a format at the end of the list of image formats. 
-    Test if all mandatory fields have been filled */
-CGAL_INLINE_FUNCTION
-int addImageFormatAtEnd( PTRIMAGE_FORMAT format) 
-{
-  PTRIMAGE_FORMAT f;
-  if ( (format->testImageFormat) &&
-       (format->readImageHeader) &&
-       (strlen(format->fileExtension)>0) &&
-       (strlen(format->realName)>0) ) {
-
-    format->next = NULL;
-    
-    if (firstFormat == NULL) {
-      firstFormat=format;
-    }
-    else {
-      for(f=firstFormat;(f->next!=NULL);f=f->next)
-	;
-      f->next=format;    
-    }
-    
-    return 0;
-
-  } 
-  else {
-    fprintf(stderr,"addImageFormatAtEnd: information missing in file format %s\n",
-	    format->realName);
-    return -1;
-  }
-}
-
-
-/** creates supported image formats */
-CGAL_INLINE_FUNCTION
-void initSupportedFileFormat() 
-{
-  PTRIMAGE_FORMAT f;
-  if ( InrimageFormat == NULL ) {
-    f = createAnalyzeFormat();
-    addImageFormatAtEnd( f );
-    f = createBMPFormat();
-    addImageFormatAtEnd( f );
-    f = createGifFormat();
-    addImageFormatAtEnd( f );
-    f = createGisFormat();
-    addImageFormatAtEnd( f );
-    f = createIrisFormat();
-    addImageFormatAtEnd( f );
-    f = createPgmFormat();
-    addImageFormatAtEnd( f );
-    f = createPgmAscIIFormat();
-    addImageFormatAtEnd( f );
-    f = createPpmFormat();
-    addImageFormatAtEnd( f );
-    InrimageFormat = createInrimageFormat();
-    addImageFormat( InrimageFormat );
-  }
-}
-
-
-
-CGAL_INLINE_FUNCTION
-PTRIMAGE_FORMAT firstImageFormat() {
-  return firstFormat;
-}
-
-
-
-/** prints supported image formats */
-CGAL_INLINE_FUNCTION
-void printSupportedFileFormat() {    
-  PTRIMAGE_FORMAT f;
-  int i;
-
-  initSupportedFileFormat();
-
-  for(i=0, f=firstFormat;(f!=NULL);i++, f=f->next) {
-    if ( (f->testImageFormat) &&
-	 (f->readImageHeader) &&
-	 (strlen(f->fileExtension)>0) &&
-	 (strlen(f->realName)>0)) {
-      fprintf( stderr, "#%2d: format name ='%s', extensions='%s'",
-	      i, f->realName, f->fileExtension );
-      if (f->readImageHeader) 
-	fprintf( stderr, ", read" );
-      if (f->writeImage) 
-	fprintf( stderr, ", write" );
-      fprintf( stderr, "\n" );
-    }
-  }
-}
-
-
-/** remove supported image formats */
-CGAL_INLINE_FUNCTION
-void removeSupportedFileFormat() {    
-  PTRIMAGE_FORMAT f=firstFormat;
-  
-  while( f != NULL) {
-    PTRIMAGE_FORMAT f_old = f;
-    f = f->next;
-    ImageIO_free( f_old);
-  }
-  InrimageFormat=NULL;
-
-}
-
-
-/** trilinear interpolation in an _image float type
- */
-CGAL_INLINE_FUNCTION
-float triLinInterp(const _image* image,
-                   float posx, 
-                   float posy, 
-                   float posz,
-                   float value_outside /*= 0.f */)
-{
-  const int dimx = image->xdim;
-  const int dimy = image->ydim;
-  const int dimz = image->zdim;
-  const int dimxy = dimx*dimy;
-  
-  if(posx < 0.f || posy < 0.f || posz < 0.f )
-    return value_outside;
-
-  posx = static_cast<float>(posx /(image->vx));
-  posy = static_cast<float>(posy /(image->vy));
-  posz = static_cast<float>(posz /(image->vz));
-
-  //patch suggested by J.Cugnoni to prevent integer overflow
-  if(posz >= dimz-1 || posy >= dimy-1 || posx >= dimx-1)
-    return value_outside;
-  
-  const int i1 = (int)(posz);
-  const int j1 = (int)(posy);
-  const int k1 = (int)(posx);
-
-  const int i2 = i1 + 1;
-  const int j2 = j1 + 1;
-  const int k2 = k1 + 1;
-
-  const float KI2 = i2-posz;
-  const float KI1 = posz-i1;
-  const float KJ2 = j2-posy;
-  const float KJ1 = posy-j1;
-
-  CGAL_IMAGE_IO_CASE
-    (image,
-     Word *array = (Word *) image->data;
-     return (((float)array[i1 * dimxy + j1 * dimx + k1] * KI2 +
-              (float)array[i2 * dimxy + j1 * dimx + k1] * KI1) * KJ2 +
-             ((float)array[i1 * dimxy + j2 * dimx + k1] * KI2 +
-              (float)array[i2 * dimxy + j2 * dimx + k1] * KI1) * KJ1) * (k2-posx)+
-     (((float)array[i1 * dimxy + j1 * dimx + k2] * KI2 +
-       (float)array[i2 * dimxy + j1 * dimx + k2] * KI1) * KJ2 +
-      ((float)array[i1 * dimxy + j2 * dimx + k2] * KI2 +
-       (float)array[i2 * dimxy + j2 * dimx + k2] * KI1) * KJ1) * (posx-k1);
-     );
-  return 0.f;
-}
-
-// Gives the value of the image at pixel (i,j,k), converted in float.
-CGAL_INLINE_FUNCTION
-float evaluate(const _image* image,
-               const std::size_t i,
-               const std::size_t j,
-               const std::size_t k)
-{
-  using CGAL::IMAGEIO::static_evaluate;
-
-  CGAL_IMAGE_IO_CASE(image, return (float)static_evaluate<Word>(image, i, j, k); );
-
-  return 0.f;
-}
-
-/** convert the data of the image to float 
-*/
-CGAL_INLINE_FUNCTION
-void convertImageTypeToFloat(_image* image){ 
-  if(image->wordKind == WK_FLOAT && image->wdim == 4)
-    return;
-
-  const unsigned int dimx = image->xdim;
-  const unsigned int dimy = image->ydim;
-  const unsigned int dimz = image->zdim;
-  
-  float * array = (float*)ImageIO_alloc (dimx * dimy * dimz *sizeof(float));
-  if (array == NULL ) {
-    fprintf ( stderr, "allocation error\n" );
-    return;
-  }
-
-  CGAL_IMAGE_IO_CASE
-    (image, 
-     Word * typedArray  = (Word *)(image->data);
-     for(unsigned int i = 0; i<dimx * dimy * dimz;++i)
-       array[i] = (float)(typedArray[i]);
-     );
-
-  ImageIO_free ( image->data );
-  image->data = array;
-  
-  image->wordKind = WK_FLOAT;
-  image->wdim = 4;
-}
-
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Image_3.h b/3rdparty/CGAL-4.8/include/CGAL/Image_3.h
deleted file mode 100644
index 3e865b3..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Image_3.h
+++ /dev/null
@@ -1,515 +0,0 @@
-// Copyright (c) 2005-2008  INRIA Sophia-Antipolis (France).
-//               2008 GeometryFactory
-// 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(s)     : Laurent Rineau, Pierre Alliez
-
-#ifndef CGAL_IMAGE_3_H
-#define CGAL_IMAGE_3_H
-
-#include <CGAL/basic.h>
-#include <CGAL/array.h>
-
-#include <boost/shared_ptr.hpp>
-#include <boost/format.hpp>
-#include <boost/unordered_set.hpp>
-#include <CGAL/ImageIO.h>
-#include <CGAL/function_objects.h>
-
-#include <limits>
-#include <set>
-#include <cstdlib>
-
-#if defined(BOOST_MSVC)
-#  pragma warning(push)
-#  pragma warning(disable:4244 4251) // double float conversion loss of data and dll linkage
-#endif
-
-class vtkImageData;
-
-namespace CGAL {
-
-namespace ImageIO {
-
-template <typename T>
-class Indicator : public std::unary_function<T, double>
-{
-  const T label;
-public:
-  Indicator(T i) : label(i) {};
-  
-  double operator()(T x) const 
-  {
-    return (x == label) ? 1. : 0.;
-  }
-};
-
-} // end namespace CGAL::ImageIO
-
-class CGAL_IMAGEIO_EXPORT Image_3
-{
-
-  struct Image_deleter {
-    void operator()(_image* image)
-    {
-      ::_freeImage(image);
-    }
-  };
-public:
-  typedef boost::shared_ptr<_image> Image_shared_ptr;
-  typedef Image_shared_ptr Pointer;
-
-protected:
-  Image_shared_ptr image_ptr;
-
-   // implementation in src/CGAL_ImageIO/Image_3.cpp
-  bool private_read(_image* im);
-
-public:
-  Image_3()
-    : image_ptr()
-  {
-  }
-
-  Image_3(const Image_3& bi)
-    : image_ptr(bi.image_ptr)
-  {
-//     std::cerr << "Image_3::copy_constructor\n";
-  }
-
-  Image_3(_image* im) 
-  {
-    private_read(im);
-  }
-
-  ~Image_3()
-  {
-  }
-
-  const _image* image() const
-  {
-    return image_ptr.get();
-  }
-
-  _image* image()
-  {
-    return image_ptr.get();
-  }
-
-  const void* data() const
-  {
-    return image()->data;
-  }
-
-  void* data()
-  {
-    return image()->data;
-  }
-
-  void set_data(void* d)
-  {
-    image()->data = d;
-  }
-
-  std::size_t xdim() const { return image_ptr->xdim; }
-  std::size_t ydim() const { return image_ptr->ydim; }
-  std::size_t zdim() const { return image_ptr->zdim; }
-
-  std::size_t size() const { return xdim() * ydim() * zdim(); }
-
-  double vx() const { return image_ptr->vx; }
-  double vy() const { return image_ptr->vy; }
-  double vz() const { return image_ptr->vz; }
-
-  float value(const std::size_t i,
-              const std::size_t j,
-              const std::size_t k) const
-  {
-    return ::evaluate(image(),i,j,k);
-  }
-
-public:
-
-  bool read(const char* file)
-  {
-    return private_read(::_readImage(file));
-  }
-
-  bool read_raw(const char* file,
-                const unsigned int rx,
-                const unsigned int ry,
-                const unsigned int rz,
-                const double vx = 1,
-                const double vy = 1,
-                const double vz = 1,
-		const unsigned int offset = 0)
-  {
-    return private_read(::_readImage_raw(file,
-                                         rx,ry,rz,
-                                         vx,vy,vz,offset));
-  }
-
-  // implementation in src/CGAL_ImageIO/Image_3.cpp
-  void gl_draw(const float point_size,
-               const unsigned char r,
-               const unsigned char g,
-               const unsigned char b);
-
-  // implementation in src/CGAL_ImageIO/Image_3.cpp
-  void gl_draw_bbox(const float line_width,
-                    const unsigned char red,
-                    const unsigned char green,
-                    const unsigned char blue);
-
-public:
-  template <typename Image_word_type,
-	    typename Target_word_type,
-	    typename Coord_type,
-	    class Image_transform>
-  Target_word_type 
-  trilinear_interpolation(const Coord_type&x, 
-			  const Coord_type&y, 
-			  const Coord_type&z,
-			  const Image_word_type& value_outside = 
-			    Image_word_type(),
-			  Image_transform transform = 
-			    Image_transform() ) const;
-
-  // default Image_transform = CGAL::Identity
-  template <typename Image_word_type,
-	    typename Target_word_type,
-	    typename Coord_type>
-  Target_word_type 
-  trilinear_interpolation(const Coord_type&x, 
-			  const Coord_type&y, 
-			  const Coord_type&z,
-			  const Image_word_type& value_outside = 
-			  Image_word_type()) const 
-  {
-    return trilinear_interpolation<
-      Image_word_type,
-      Target_word_type>(x, y, z, value_outside,
-			  CGAL::Identity<Image_word_type>());
-  }
-
-  template <typename Image_word_type,
-	    typename Coord_type>
-  Image_word_type 
-  labellized_trilinear_interpolation(const Coord_type&x, 
-				     const Coord_type&y, 
-				     const Coord_type&z,
-				     const Image_word_type& value_outside = 
-  				       Image_word_type()) const;
-
-}; // end Image_3
-
-template <typename Image_word_type,
-	  typename Target_word_type,
-	  typename Coord_type,
-	  class Image_transform>
-Target_word_type 
-Image_3::trilinear_interpolation(const Coord_type& x, 
-				 const Coord_type& y, 
-				 const Coord_type& z,
-				 const Image_word_type& value_outside,
-				 Image_transform transform) const 
-{
-  // Check on double/float coordinates, because (int)-0.1 gives 0
-  if ( x < 0 || y < 0 || z < 0 )
-    return Target_word_type(value_outside);
-  
-  const Coord_type lx = x / image()->vx;
-  const Coord_type ly = y / image()->vy;
-  const Coord_type lz = z / image()->vz;
-  const std::size_t dimx = xdim();
-  const std::size_t dimy = ydim();
-  const std::size_t dimz = zdim();
-  const std::size_t dimxy = dimx*dimy;
-  
-  if(lx < 0 ||
-     ly < 0 ||
-     lz < 0 ||
-     lz >= dimz-1 ||
-     ly >= dimy-1 ||
-     lx >= dimx-1)
-  {
-    return Target_word_type(transform(value_outside));
-  }  
-
-  // images are indexed by (z,y,x)
-  const int i1 = (int)(lz); 
-  const int j1 = (int)(ly);
-  const int k1 = (int)(lx);
-  const int i2 = i1 + 1;
-  const int j2 = j1 + 1;
-  const int k2 = k1 + 1;
-
-  /*   We assume (x,y,z) lies in the following cube.
-   *   a, b, c, d, e, f, g, h are the value of the image at the corresponding
-   *   voxels:
-   *
-   *
-   *     x        z
-   *     |       /
-   *        f___ __ g
-   *       /|      /|
-   *     e/_|____h/ |
-   *     |  |    |  |
-   *     |  |b___|_c|
-   *     | /     | /
-   *    a|/_____d|/  _y
-   *    
-   *
-   * a = val(i1, j1, k1)
-   * b = val(i2, j1, k1)
-   * c = val(i2, j2, k1)
-   * d = val(i1, j2, k1)
-   * e = val(i1, j1, k2)
-   * f = val(i2, j1, k2)
-   * g = val(i2, j2, k2)
-   * h = val(i1, j2, k2)
-   */
-
-  Image_word_type* ptr = (Image_word_type*)image()->data;
-  ptr += i1 * dimxy + j1 * dimx + k1;
-  const Target_word_type a = Target_word_type(transform(*ptr));
-  const Target_word_type e = Target_word_type(transform(*(ptr+1)));
-  ptr += dimxy; // i2 * dimxy + j1 * dimx + k1;
-  const Target_word_type b = Target_word_type(transform(*ptr));
-  const Target_word_type f = Target_word_type(transform(*(ptr+1)));
-  ptr += dimx; // i2 * dimxy + j2 * dimx + k1
-  const Target_word_type c = Target_word_type(transform(*ptr));
-  const Target_word_type g = Target_word_type(transform(*(ptr+1)));
-  ptr -= dimxy; // i1 * dimxy + j2 * dimx + k1
-  const Target_word_type d = Target_word_type(transform(*ptr));
-  const Target_word_type h = Target_word_type(transform(*(ptr+1)));
-  
-
-//   const Target_word_type a = ((Image_word_type*)image()->data)[i1 * dimxy + j1 * dimx + k1];
-//   const Target_word_type b = ((Image_word_type*)image()->data)[i2 * dimxy + j1 * dimx + k1];
-//   const Target_word_type c = ((Image_word_type*)image()->data)[i2 * dimxy + j2 * dimx + k1];
-//   const Target_word_type d = ((Image_word_type*)image()->data)[i1 * dimxy + j2 * dimx + k1];
-//   const Target_word_type e = ((Image_word_type*)image()->data)[i1 * dimxy + j1 * dimx + k2];
-//   const Target_word_type f = ((Image_word_type*)image()->data)[i2 * dimxy + j1 * dimx + k2];
-//   const Target_word_type g = ((Image_word_type*)image()->data)[i2 * dimxy + j2 * dimx + k2];
-//   const Target_word_type h = ((Image_word_type*)image()->data)[i1 * dimxy + j2 * dimx + k2];
-
-//   const Target_word_type outside = Target_word_type(transform(value_outside);
-
-//   if(x < 0.f ||
-//      y < 0.f ||
-//      z < 0.f ||
-//      i1 >= dimz ||
-//      j1 >= dimy ||
-//      k1 >= dimx)
-//   {
-//     return outside;
-//   }
-
-//   Target_word_type a, b, c, d, e, f, g, h; 
-
-//   if(k1 < 0) {
-//     a = b = c = d = outside;
-//   }
-//   else {
-//     if(j1 < 0) {
-//       a = b = outside;
-//     }
-//     else {
-//       if(i1 < 0)
-// 	a = outside;
-//       else
-// 	a = ((Image_word_type*)image()->data)[i1 * dimxy + j1 * dimx + k1];
-
-//       if(i2 >= dimz)
-// 	b = outside;
-//       else 
-// 	b = ((Image_word_type*)image()->data)[i2 * dimxy + j1 * dimx + k1];
-//     }
-
-//     if(j2 >= dimy) {
-//       c = d = outside;
-//     }
-//     else {
-//       if(i1 < 0)
-// 	d = outside;
-//       else
-// 	d = ((Image_word_type*)image()->data)[i1 * dimxy + j2 * dimx + k1];
-
-//       if(i2 >= dimz)
-// 	c = outside;
-//       else
-// 	c = ((Image_word_type*)image()->data)[i2 * dimxy + j2 * dimx + k1];
-//     }
-//   }
-
-//   if(k2 >= dimx) {
-//     e = f = g = h = outside;
-//   }
-//   else {
-//     if(j1 < 0) {
-//       e = f = outside;
-//     }
-//     else {
-//       if(i1 < 0)
-// 	e = outside;
-//       else
-// 	e = ((Image_word_type*)image()->data)[i1 * dimxy + j1 * dimx + k2];
-
-//       if(i2 >= dimz)
-// 	f = outside;
-//       else 
-// 	f = ((Image_word_type*)image()->data)[i2 * dimxy + j1 * dimx + k2];
-//     }
-
-//     if(j2 >= dimy) {
-//       g = h = outside;
-//     }
-//     else {
-//       if(i1 < 0)
-// 	h = outside;
-//       else
-// 	h = ((Image_word_type*)image()->data)[i1 * dimxy + j2 * dimx + k2];
-
-//       if(i2 >= dimz)
-// 	g = outside;
-//       else
-// 	g = ((Image_word_type*)image()->data)[i2 * dimxy + j2 * dimx + k2];
-//     }
-//   }
-
-  const Target_word_type di2 = i2 - lz;
-  const Target_word_type di1 = lz - i1;
-  const Target_word_type dj2 = j2 - ly;
-  const Target_word_type dj1 = ly - j1;
-  const Target_word_type dk2 = k2 - lx;
-  const Target_word_type dk1 = lx - k1;
-//   std::cerr << di2 << " " << di1 << "\n";
-//   std::cerr << dj2 << " " << dj1 << "\n";
-//   std::cerr << dk2 << " " << dk1 << "\n";
-
-  return ( (  ( a * di2 + b * di1 ) * dj2 + 
-	      ( d * di2 + c * di1 ) * dj1   ) * dk2 +
-	   (  ( e * di2 + f * di1 ) * dj2 + 
-	      ( h * di2 + g * di1 ) * dj1   ) * dk1 );
-} // end trilinear_interpolation
-
-
-template <typename Image_word_type,
-	  typename Coord_type>
-Image_word_type 
-Image_3::labellized_trilinear_interpolation(const Coord_type& x, 
-					    const Coord_type& y, 
-					    const Coord_type& z,
-					    const Image_word_type& value_outside) const 
-{
-  // Check on double/float coordinates, because (int)-0.1 gives 0
-  if ( x < 0 || y < 0 || z < 0 ) return value_outside;
-  
-  Coord_type lx = x / image()->vx;
-  Coord_type ly = y / image()->vy;
-  Coord_type lz = z / image()->vz;
-  const std::size_t dimx = xdim();
-  const std::size_t dimy = ydim();
-  const std::size_t dimz = zdim();
-  
-  if( lx < 0 ||
-      ly < 0 ||
-      lz < 0 ||
-     lz >= dimz-1 ||
-     ly >= dimy-1 ||
-     lx >= dimx-1)
-  {
-    return value_outside;
-  }  
-
-  // images are indexed by (z,y,x)
-  const int i1 = (int)(lz); 
-  const int j1 = (int)(ly);
-  const int k1 = (int)(lx);
-  const int i2 = i1 + 1;
-  const int j2 = j1 + 1;
-
-  CGAL::cpp11::array<std::size_t,8> index;
-  index[0] = (i1 * dimy + j1) * dimx + k1;
-  index[1] = index[0] + 1;
-  index[2] = (i1 * dimy + j2) * dimx + k1;
-  index[3] = index[2] + 1;
-  index[4] = (i2 * dimy + j1) * dimx + k1;
-  index[5] = index[4] + 1;
-  index[6] = (i2 * dimy + j2) * dimx + k1;
-  index[7] = index[6] + 1;
-
-  CGAL::cpp11::array<Image_word_type,8> labels;
-  
-  labels[0] = ((Image_word_type*)image()->data)[index[0]];
-  int lc = 1;
-  for(int lci=1; lci<8; ++lci){
-    bool found = false;
-    Image_word_type iwt = ((Image_word_type*)image()->data)[index[lci]];
-    for(int lcj=0; lcj < lc; ++lcj){
-      if(iwt == labels[lcj]){
-        found = true;
-        break;
-      }
-    }
-    if(found) continue;
-    labels[lc] = iwt;
-    ++lc;
-  }
-
-  CGAL_HISTOGRAM_PROFILER(
-    "Number of labels around a vertex, Image_3::labellized_trilinear_interpolation()", 
-    static_cast<unsigned int>(lc));
-
-  if(lc == 1) {
-    return labels[0];
-  }
-    
-  typedef ImageIO::Indicator<Image_word_type> Indicator;
-  double best_value = 0.;
-  Image_word_type best = 0;
-  for(int i = 0; i < lc; ++i)
-  {
-    Image_word_type iwt = labels[i];
-    const double r = 
-      trilinear_interpolation<Image_word_type,double,Coord_type, Indicator>(
-        x, y, z, value_outside, Indicator(iwt));
-    CGAL_assertion(r >= 0.);
-    CGAL_assertion(r <= 1.);
-
-    if(r > best_value) {
-      best = iwt;
-      best_value = r;
-    }
-  }
-//   CGAL_assertion(best_value > 0.5);
-  return best;
-}
-
-} // end namespace CGAL
-
-#ifdef CGAL_HEADER_ONLY
-#include <CGAL/Image_3_impl.h>
-#endif // CGAL_HEADER_ONLY
-
-#if defined(BOOST_MSVC)
-#  pragma warning(pop)
-#endif
- 
-#endif // CGAL_IMAGE_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Image_3_impl.h b/3rdparty/CGAL-4.8/include/CGAL/Image_3_impl.h
deleted file mode 100644
index deeae53..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Image_3_impl.h
+++ /dev/null
@@ -1,232 +0,0 @@
-// Copyright (c) 2005-2008  INRIA Sophia-Antipolis (France).
-//               2008 GeometryFactory, Sophia Antipolis (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(s)     : Laurent Rineau, Pierre Alliez
-
-#ifdef CGAL_HEADER_ONLY
-#define CGAL_INLINE_FUNCTION inline
-#else
-#define CGAL_INLINE_FUNCTION
-#endif
-
-#include <CGAL/gl.h>
-#include <CGAL/basic.h>
-
-namespace CGAL {
-
-CGAL_INLINE_FUNCTION
-bool Image_3::private_read(_image* im)
-{
-  if(im != 0)
-  {
-    if(image() != 0)
-    {
-      ::_freeImage(image());
-    }
-    image_ptr = Image_shared_ptr(im, Image_deleter());
-
-//     std::cerr << 
-//       boost::format("image=%1% (xdim=%2%, ydim=%3%, zdim=%4%)\n")
-//       % image_ptr.get() % image_ptr->xdim % image_ptr->ydim % image_ptr->zdim;
-
-  }
-  return im != 0;
-}
-
-CGAL_INLINE_FUNCTION
-void Image_3::gl_draw(const float point_size,
-                      const unsigned char r,
-                      const unsigned char g,
-                      const unsigned char b)
-{
-  if(image_ptr.get() == NULL)
-    return;
-
-  glPointSize(point_size);
-  glColor3ub(r,g,b);
-  glBegin(GL_POINTS);
-  unsigned char *pData = (unsigned char*)image_ptr->data;
-  unsigned int xy = image_ptr->xdim * image_ptr->ydim;
-  for(unsigned int i=0;i<image_ptr->xdim;i+=5)
-    for(unsigned int j=0;j<image_ptr->ydim;j+=5)
-      for(unsigned int k=0;k<image_ptr->zdim;k+=5)
-      {
-        unsigned char value = pData[xy*k + j*image_ptr->xdim + i];
-        if(value > 0)
-        {
-          double x = image_ptr->vx * i;
-          double y = image_ptr->vy * j;
-          double z = image_ptr->vz * k;
-          glVertex3d(x,y,z);
-        }
-      }
-  glEnd();
-} // end Image_3::gl_draw
-
-
-CGAL_INLINE_FUNCTION
-void Image_3::gl_draw_bbox(const float line_width,
-                           const unsigned char red,
-                           const unsigned char green,
-                           const unsigned char blue)
-{
-  if(!image_ptr)
-    return;
-
-  glLineWidth(line_width);
-  glColor3ub(red,green,blue);
-  glBegin(GL_LINES);
-
-  struct Point {
-    double x_;
-    double y_;
-    double z_;
-    Point(double x, double y, double z) : x_(x), y_(y), z_(z) {};
-
-    double x() const { return x_; }
-    double y() const { return y_; }
-    double z() const { return z_; }
-  };
-
-  const double xmax = (image_ptr->xdim - 1.0)*(image_ptr->vx);
-  const double ymax = (image_ptr->ydim - 1.0)*(image_ptr->vy);
-  const double zmax = (image_ptr->zdim - 1.0)*(image_ptr->vz);
-
-  Point a(0.0, 0.0,    0.0);
-  Point b(0.0, ymax, 0.0);
-  Point c(0.0, ymax, zmax);
-  Point d(0.0, 0.0,    zmax);
-  Point e(xmax, 0.0,    0.0);
-  Point f(xmax, ymax, 0.0);
-  Point g(xmax, ymax, zmax);
-  Point h(xmax, 0.0,    zmax);
-
-  glVertex3d(a.x(),a.y(),a.z());
-  glVertex3d(b.x(),b.y(),b.z());
-
-  glVertex3d(b.x(),b.y(),b.z());
-  glVertex3d(c.x(),c.y(),c.z());
-
-  glVertex3d(c.x(),c.y(),c.z());
-  glVertex3d(d.x(),d.y(),d.z());
-
-  glVertex3d(d.x(),d.y(),d.z());
-  glVertex3d(a.x(),a.y(),a.z());
-
-  glVertex3d(e.x(),e.y(),e.z());
-  glVertex3d(f.x(),f.y(),f.z());
-
-  glVertex3d(f.x(),f.y(),f.z());
-  glVertex3d(g.x(),g.y(),g.z());
-
-  glVertex3d(g.x(),g.y(),g.z());
-  glVertex3d(h.x(),h.y(),h.z());
-
-  glVertex3d(h.x(),h.y(),h.z());
-  glVertex3d(e.x(),e.y(),e.z());
-
-  glVertex3d(a.x(),a.y(),a.z());
-  glVertex3d(e.x(),e.y(),e.z());
-
-  glVertex3d(d.x(),d.y(),d.z());
-  glVertex3d(h.x(),h.y(),h.z());
-
-  glVertex3d(c.x(),c.y(),c.z());
-  glVertex3d(g.x(),g.y(),g.z());
-
-  glVertex3d(b.x(),b.y(),b.z());
-  glVertex3d(f.x(),f.y(),f.z());
-
-  glEnd();
-} // end Image_3::gl_draw_bbox
-
-} // end namespace CGAL
-
-#if 0
-
-#include <vtkImageData.h>
-#include <CGAL/Image_3_vtk_interface.h>
-
-namespace CGAL {
-
-namespace {
-
-struct VTK_to_ImageIO_type_mapper {
-  WORD_KIND wordKind;
-  SIGN sign;
-  unsigned int wdim;
-};
-
-static const VTK_to_ImageIO_type_mapper VTK_to_ImageIO_type[VTK_ID_TYPE] = 
-  { { WK_UNKNOWN, SGN_UNKNOWN,  0}, //  0=VTK_VOID
-    { WK_UNKNOWN, SGN_UNKNOWN,  0}, //  1=VTK_BIT
-    { WK_FIXED,   SGN_SIGNED,   1}, //  2=VTK_CHAR
-    { WK_FIXED,   SGN_UNSIGNED, 1}, //  3=VTK_UNSIGNED_CHAR
-    { WK_FIXED,   SGN_SIGNED,   2}, //  4=VTK_SHORT 
-    { WK_FIXED,   SGN_UNSIGNED, 2}, //  5=VTK_UNSIGNED_SHORT
-    { WK_FIXED,   SGN_SIGNED,   4}, //  6=VTK_INT
-    { WK_FIXED,   SGN_UNSIGNED, 4}, //  7=VTK_UNSIGNED_INT
-    { WK_FIXED,   SGN_SIGNED,   8}, //  8=VTK_LONG
-    { WK_FIXED,   SGN_UNSIGNED, 8}, //  9=VTK_UNSIGNED_LONG
-    { WK_FLOAT,   SGN_SIGNED,   4}, // 10=VTK_FLOAT
-    { WK_FIXED,   SGN_SIGNED,   8}  // 11=VTK_DOUBLE
- }; 
-
-} //end anonymous namespace
-
-CGAL_INLINE_FUNCTION
-bool
-Image_3::read_vtk_image_data(vtkImageData* vtk_image)
-{
-  if(!vtk_image)
-    return false;
-
-  _image* image = ::_initImage();
-  const int* dims = vtk_image->GetDimensions();
-  const double* spacing = vtk_image->GetSpacing();
-  image->vectMode = VM_SCALAR;
-  image->xdim = dims[0];
-  image->ydim = dims[1];
-  image->zdim = dims[2];
-  image->vdim = 1;
-  image->vx = spacing[0];
-  image->vy = spacing[1];
-  image->vz = spacing[2];
-  image->endianness = ::_getEndianness();
-  int vtk_type = vtk_image->GetScalarType();
-  if(vtk_type == VTK_SIGNED_CHAR) vtk_type = VTK_CHAR;
-  if(vtk_type < 0 || vtk_type > VTK_DOUBLE)
-    vtk_type = VTK_DOUBLE;
-  const VTK_to_ImageIO_type_mapper& imageio_type = 
-    VTK_to_ImageIO_type[vtk_type];
-  image->wdim = imageio_type.wdim;
-  image->wordKind = imageio_type.wordKind;
-  image->sign = imageio_type.sign;
-  image->data = ::ImageIO_alloc(dims[0]*dims[1]*dims[2]*image->wdim);
-  std::cerr << "GetNumberOfTuples()=" << vtk_image->GetPointData()->GetScalars()->GetNumberOfTuples()
-            << "\nimage->size()=" << dims[0]*dims[1]*dims[2]
-            << "\nwdim=" << image->wdim << '\n';
-  CGAL_assertion(vtk_image->GetPointData()->GetScalars()->GetNumberOfTuples() == dims[0]*dims[1]*dims[2]);
-  vtk_image->GetPointData()->GetScalars()->ExportToVoidPointer(image->data);
-
-  return this->private_read(image);
-}
-
-} // end namespace CGAL
-
-#endif // CGAL_USE_VTK
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Implicit_mesh_domain_3.h b/3rdparty/CGAL-4.8/include/CGAL/Implicit_mesh_domain_3.h
deleted file mode 100644
index 1801e8b..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Implicit_mesh_domain_3.h
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright (c) 2009 INRIA Sophia-Antipolis (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
-// 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(s)     : Stéphane Tayeb
-//
-//******************************************************************************
-// File Description :
-// class Implicit_mesh_domain_3. See class description.
-//******************************************************************************
-
-#ifndef CGAL_IMPLICIT_MESH_DOMAIN_3_H
-#define CGAL_IMPLICIT_MESH_DOMAIN_3_H
-
-#if defined(BOOST_MSVC)
-#  pragma warning(push)
-#  pragma warning(disable:4180) // qualifier applied to function type has no meaning; ignored
-#endif
-
-#include <CGAL/Labeled_mesh_domain_3.h>
-#include <CGAL/Implicit_to_labeling_function_wrapper.h>
-#include <CGAL/Random.h>
-
-namespace CGAL {
-
-
-/**
- * @class Implicit_mesh_domain_3
- *
- * Implements mesh_traits for a domain defined as the negative values of
- * an implicit function.
- */
-template<class Function,
-  class BGT,
-  class Wrapper = Implicit_to_labeling_function_wrapper<Function,BGT> >
-class Implicit_mesh_domain_3
- : public Labeled_mesh_domain_3<Wrapper, BGT >
-{
-public:
-  /// Base type
-  typedef Labeled_mesh_domain_3<Wrapper, BGT> Base;
-
-  /// Public types
-  typedef typename Base::Sphere_3 Sphere_3;
-  typedef typename Base::FT FT;
-  typedef BGT Geom_traits;
-
-  /**
-   * Constructor
-   * @param f the function which negative values defines the domain
-   * @param bounding_sphere a bounding sphere of the domain
-   * @param error_bound the error bound relative to the sphere radius
-   */
-  Implicit_mesh_domain_3(const Function& f,
-                         const Sphere_3& bounding_sphere,
-                         const FT& error_bound = FT(1e-6),
-                         CGAL::Random* p_rng = NULL)
-    : Base(Wrapper(f), bounding_sphere, error_bound, p_rng)  {}
-
-  /// Destructor
-  virtual ~Implicit_mesh_domain_3() {}
-
-  using Base::bbox;
-private:
-  // Disabled copy constructor & assignment operator
-  typedef Implicit_mesh_domain_3<Function,BGT> Self;
-  Implicit_mesh_domain_3(const Self& src);
-  Self& operator=(const Self& src);
-
-};  // end class Implicit_mesh_domain_3
-
-
-}  // end namespace CGAL
-
-#if defined(BOOST_MSVC)
-#  pragma warning(pop)
-#endif
-
-#endif // CGAL_IMPLICIT_MESH_DOMAIN_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/In_place_list.h b/3rdparty/CGAL-4.8/include/CGAL/In_place_list.h
deleted file mode 100644
index b0fc2a8..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/In_place_list.h
+++ /dev/null
@@ -1,812 +0,0 @@
-// Copyright (c) 2003  
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved. 
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Michael Hoffmann <hoffmann at inf.ethz.ch>
-//                 Lutz Kettner <kettner at mpi-sb.mpg.de>
-//                 Sylvain Pion
-
-#ifndef CGAL_IN_PLACE_LIST_H
-#define CGAL_IN_PLACE_LIST_H 1
-
-#include <CGAL/basic.h>
-#include <cstddef>
-#include <iterator>
-#include <functional>
-#include <algorithm>
-#include <CGAL/memory.h>
-#include <boost/functional/hash.hpp>
-
-namespace CGAL {
-
-// Forward declarations
-namespace internal {
-  template <class T, class Alloc> class In_place_list_iterator;
-  template <class T, class Alloc> class In_place_list_const_iterator;
-}
-
-template <class T, bool managed, class Alloc = CGAL_ALLOCATOR(T)>
-class In_place_list;
-
-template < class T >
-class In_place_sl_list_base {
-public:
-  T* next_link;        // forward pointer
-};
-
-template < class T >
-class In_place_list_base {
-public:
-  T* next_link;        // forward pointer
-  T* prev_link;        // backwards pointer
-  //friend  class internal::In_place_list_iterator<T, Alloc>;
-  //friend  class internal::In_place_list_const_iterator<T, Alloc>;
-  //friend  class In_place_list<T,false, Alloc>;
-  //friend  class In_place_list<T,true, Alloc>;
-};
-
-
-namespace internal {
-  template <class T, class Alloc>
-  class In_place_list_iterator {
-  protected:
-    T* node;
-  public:
-    friend  class In_place_list<T,false, Alloc>;
-    friend  class In_place_list<T,true, Alloc>;
-
-    typedef In_place_list_iterator<T, Alloc>  Self;
-    typedef In_place_list_base<T>      Base;
-
-    typedef T               value_type;
-    typedef T*              pointer;
-    typedef T&              reference;
-    typedef std::size_t     size_type;
-    typedef std::ptrdiff_t  difference_type;
-    typedef std::bidirectional_iterator_tag   iterator_category;
-
-    In_place_list_iterator() : node(0) {}
-    In_place_list_iterator(T* x) : node(x) {}
-
-    bool  operator==( const Self& x) const { return node == x.node; }
-    bool  operator!=( const Self& x) const { return node != x.node; }
-    bool  operator< ( const Self& x) const { return node< x.node;   }
-    bool  operator<=( const Self& x) const { return node<= x.node;  }
-    bool  operator> ( const Self& x) const { return node> x.node;   }
-    bool  operator>=( const Self& x) const { return node>= x.node;  }
-    T&    operator*()  const { return *node; }
-    T*    operator->() const { return  node; }
-    Self& operator++() {
-      node = ((Base*)(node))->next_link;
-      return *this;
-    }
-    Self  operator++(int) {
-      Self tmp = *this;
-      ++*this;
-      return tmp;
-    }
-    Self& operator--() {
-      node = ((Base*)(node))->prev_link;
-      return *this;
-    }
-    Self  operator--(int) {
-      Self tmp = *this;
-      --*this;
-      return tmp;
-    }
-  };
-}
-
-namespace internal {
-  template <class T, class Alloc>
-  class In_place_list_const_iterator {
-  protected:
-    const T* node;  // It's not Ptr. Otherwise traversal won't work.
-  public:
-    friend  class In_place_list<T,false, Alloc>;
-    friend  class In_place_list<T,true, Alloc>;
-
-    typedef In_place_list_const_iterator<T, Alloc> Self;
-    typedef In_place_list_iterator<T, Alloc>       Iterator;
-    typedef In_place_list_base<T>           Base;
-
-    typedef T               value_type;
-    typedef const T*        pointer;
-    typedef const T&        reference;
-    typedef std::size_t     size_type;
-    typedef std::ptrdiff_t  difference_type;
-    typedef std::bidirectional_iterator_tag   iterator_category;
-
-    In_place_list_const_iterator() : node(0) {}
-    In_place_list_const_iterator( Iterator i) : node(&*i) {}
-    In_place_list_const_iterator(const T* x) : node(x) {}
-
-    bool     operator==( const Self& x) const { return node == x.node; }
-    bool     operator!=( const Self& x) const { return node != x.node; }
-    bool     operator< ( const Self& x) const { return node< x.node;   }
-    bool     operator<=( const Self& x) const { return node<= x.node;  }
-    bool     operator> ( const Self& x) const { return node> x.node;   }
-    bool     operator>=( const Self& x) const { return node>= x.node;  }
-    const T& operator*()  const { return *node; }
-    const T* operator->() const { return  node; }
-    Self& operator++() {
-      node = ((const Base*)(node))->next_link;
-      return *this;
-    }
-    Self  operator++(int) {
-      Self tmp = *this;
-      ++*this;
-      return tmp;
-    }
-    Self& operator--() {
-      node = ((const Base*)(node))->prev_link;
-      return *this;
-    }
-    Self  operator--(int) {
-      Self tmp = *this;
-      --*this;
-      return tmp;
-    }
-    In_place_list_iterator<T,Alloc>
-    remove_const() const
-    {
-      return In_place_list_iterator<T,Alloc>(const_cast<T*>(node));
-    }
-  };
-
-
-
-template <class T, class Alloc>
-  std::size_t hash_value(const In_place_list_iterator<T,Alloc>&  i)
-  {
-    T* ptr = &*i;
-    return reinterpret_cast<std::size_t>(ptr)/ sizeof(T);
-  }
-
-
-template <class T, class Alloc>
-  std::size_t hash_value(const In_place_list_const_iterator<T,Alloc>&  i)
-  {
-    T* ptr = &*i;
-    return reinterpret_cast<std::size_t>(ptr)/ sizeof(T);
-   }
-
-}
-
-
-template <class T, bool managed, class Alloc>
-class In_place_list {
-
-  // Bidirectional List Managing Objects in Place
-  // --------------------------------------------
-  //
-  // DEFINITION An object of the class In_place_list<T,bool> is a
-  // sequence that supports bidirectional iterators and allows constant time
-  // insert and erase operations anywhere within the sequence. The
-  // functionality is similar to the `list<T>' in the STL.
-  //
-  // The In_place_list<T,bool> manages element items in place. Two
-  // pointers `T*' are expected in the class. For example the base class
-  // `In_place_list_base<T>' can be used.
-  //
-  // The In_place_list<T,bool> does not copy element items during
-  // insertion (unless otherwise stated for a function). On removal or
-  // destruction of the list the element items are not deleted by default.
-  // The second template parameter `bool' has to be set to `false' in this
-  // case. If the In_place_list<T,bool> should take the responsibility
-  // for the stored objects the `bool' parameter could be set to `true', in
-  // which case the list will delete removed items and will delete all
-  // remaining items on destruction. In any case, the `destroy()' member
-  // function deletes all elements.
-  //
-  // On purpose, these two possible versions of In_place_list<T,bool>
-  // are not assignment compatible to avoid confusions between the different
-  // storage responsibilities.
-  //
-  // PARAMETERS
-  //
-  // The full classname is `In_place_list<T,bool managed = false, Alloc
-  // = CGAL_ALLOCATOR(T)>'.
-  //
-  // TYPES
-
-public:
-  typedef Alloc           Allocator;
-  typedef Alloc           allocator_type; // STL compliant
-
-  // Note: the standard requires the following types to be equivalent
-  // to T, T*, const T*, T&, const T&, size_t, and ptrdiff_t, respectively.
-  // So we don't pass these types to the iterators explicitly.
-  typedef typename Allocator::value_type          value_type;
-  typedef typename Allocator::pointer             pointer;
-  typedef typename Allocator::const_pointer       const_pointer;
-  typedef typename Allocator::reference           reference;
-  typedef typename Allocator::const_reference     const_reference;
-  typedef typename Allocator::size_type           size_type;
-  typedef typename Allocator::difference_type     difference_type;
-
-  typedef internal::In_place_list_iterator<T, Alloc> iterator;
-  typedef internal::In_place_list_const_iterator<T, Alloc> const_iterator;
-
-  typedef std::reverse_iterator<iterator>         reverse_iterator;
-  typedef std::reverse_iterator<const_iterator>   const_reverse_iterator;
-
-  typedef In_place_list<T,managed,Alloc>          Self;
-
-protected:
-  Allocator allocator;
-
-  pointer      node;
-  size_type    length;
-
-  // These are the only places where the allocator gets called.
-  pointer get_node() {
-    pointer p = allocator.allocate(1);
-#ifdef CGAL_USE_ALLOCATOR_CONSTRUCT_DESTROY
-    allocator.construct(p, value_type());
-#else
-    new (p) value_type;
-#endif
-    return p;
-  }
-  pointer get_node( const T& t) {
-    pointer p = allocator.allocate(1);
-#ifdef CGAL_USE_ALLOCATOR_CONSTRUCT_DESTROY
-    allocator.construct(p, t);
-#else
-    new (p) value_type(t);
-#endif
-    return p;
-  }
-  void put_node( pointer p) {
-#ifdef CGAL_USE_ALLOCATOR_CONSTRUCT_DESTROY  
-    allocator.destroy( p);
-#else 
-   p->~value_type();
-#endif
-    allocator.deallocate( p, 1);
-  }
-
-public:
-  // CREATION
-  //
-  // New creation variable is: `l'
-
-  explicit In_place_list() : length(0) {
-    // introduces an empty list.
-    node = get_node();
-    (*node).next_link = node;
-    (*node).prev_link = node;
-  }
-  void swap(Self& x) {
-    std::swap(node, x.node);
-    std::swap(length, x.length);
-  }
-
-  // ACCESS MEMBER FUNCTIONS
-
-  allocator_type get_allocator() const { return allocator; }
-
-  iterator       begin() { return (*node).next_link; }
-  const_iterator begin() const { return (*node).next_link; }
-  iterator       end() { return node; }
-  const_iterator end() const { return node; }
-
-  reverse_iterator       rbegin() { return reverse_iterator(end()); }
-  const_reverse_iterator rbegin() const {
-    return const_reverse_iterator(end());
-  }
-  reverse_iterator       rend() { return reverse_iterator(begin()); }
-  const_reverse_iterator rend() const {
-    return const_reverse_iterator(begin());
-  }
-
-  bool            empty() const    { return length == 0; }
-  size_type       size() const     { return length; }
-  size_type       max_size() const { return size_type(-1); }
-
-  reference       front()          { return *begin(); }
-  const_reference front() const    { return *begin(); }
-  reference       back()           { return *(--end()); }
-  const_reference back() const     { return *(--end()); }
-
-  // INSERTION
-
-  iterator insert(iterator position, T& x) {
-    // inserts `t' in front of iterator `pos'. The return value points
-    // to the inserted item.
-    x.next_link = position.node;
-    x.prev_link = (*position.node).prev_link;
-    (*((*position.node).prev_link)).next_link = &x;
-    (*position.node).prev_link = &x;
-    ++length;
-    return &x;
-  }
-  iterator insert(T* pos, T& x) {
-    return insert( iterator(pos), x);
-  }
-  void push_front(T& x) { insert(begin(), x); }
-  // inserts an item in front of list `l'.
-
-  void push_back(T& x)  { insert(end(), x); }
-  // inserts an item at the back of list `l'.
-
-  void insert(iterator position, size_type n);
-  // inserts n copies of `T()' in front of iterator `pos'.
-
-  void insert(iterator position, size_type n, const T& x);
-  // inserts n copies of `t' in front of iterator `pos'.
-
-  void insert( T* pos, size_type n) { insert( iterator(pos), n); }
-  void insert( T* pos, size_type n, const T& x) {
-    insert( iterator(pos), n, x);
-  }
-
-  template <class InputIterator>
-  void insert(iterator pos, InputIterator first, InputIterator last) {
-    // inserts the range [`first, last') in front of iterator `pos'.
-    while (first != last)
-      insert(pos, *get_node(*first++));
-  }
-
-  template <class InputIterator>
-  void insert(T* pos, InputIterator first, InputIterator last) {
-    // inserts the range [`first, last') in front of iterator `pos'.
-    while (first != last)
-      insert(pos, *get_node(*first++));
-  }
-
-  void insert(T* pos, const T* first, const T* last) {
-    insert( iterator(pos), const_iterator(first),
-            const_iterator(last));
-  }
-
-
-  // REMOVAL
-
-  void erase(iterator i) {
-    // removes the item from list `l', where `pos' refers to.
-    CGAL_assertion( length > 0);
-    (*((*i.node).prev_link)).next_link = (*i.node).next_link;
-    (*((*i.node).next_link)).prev_link = (*i.node).prev_link;
-    if (managed)
-      put_node(i.node);
-    --length;
-  }
-  void erase(T* pos)  { erase( iterator( pos)); }
-
-  void pop_front() { erase(begin()); }
-  // removes the first item from list `l'.
-
-  void pop_back() {
-    // removes the last item from list `l'.
-    iterator tmp = end();
-    erase(--tmp);
-  }
-
-  void erase(iterator first, iterator last);
-  // removes the items in the range [`first, last') from list `l'.
-
-  void erase(T* first, T* last) {
-    erase( iterator(first), iterator(last));
-  }
-
-  void clear() { erase( begin(), end()); }
-
-  // CREATION (Continued)
-
-  explicit In_place_list(size_type n, const T& value = T()) : length(0) {
-    // introduces a list with n items, all initialized with copies of
-    // value.
-    node = get_node();
-    (*node).next_link = node;
-    (*node).prev_link = node;
-    insert(begin(), n, value);
-  }
-
-  template <class InputIterator>
-  In_place_list( InputIterator first, InputIterator last) : length(0) {
-    // a list with copies from the range [`first,last').
-    node = get_node();
-    (*node).next_link = node;
-    (*node).prev_link = node;
-    insert( begin(), first, last);
-  }
-
-  In_place_list(const T* first, const T* last) : length(0) {
-    // a list with copies from the range [`first,last').
-    node = get_node();
-    (*node).next_link = node;
-    (*node).prev_link = node;
-    insert(begin(), first, last);
-  }
-  In_place_list(const Self& x) : length(0) {
-    // copy constructor. Each item in `l1' is copied.
-    node = get_node();
-    (*node).next_link = node;
-    (*node).prev_link = node;
-    insert(begin(), x.begin(), x.end());
-  }
-  ~In_place_list() {
-    erase(begin(), end());
-    put_node(node);
-  }
-
-  Self& operator=(const Self& x);
-
-  void destroy();
-
-  template <class InputIterator>
-  void assign( InputIterator first, InputIterator last) {
-    erase( begin(), end());
-    insert( begin(), first, last);
-  }
-
-  void assign( size_type n, const T& t) {
-    erase( begin(), end());
-    insert( begin(), n, t);
-  }
-
-  void resize( size_type sz, const T& c = T()) {
-    if ( sz > size())
-      insert( end(), sz - size(), c);
-    else if ( sz < size()) {
-      iterator i = begin();
-      while ( sz-- > 0)
-        ++i;
-      erase( i, end());
-    }  // else do nothing
-  }
-
-  // COMPARISON OPERATIONS
-
-  bool operator==( const Self& y) const {
-    return size() == y.size() && std::equal(begin(), end(), y.begin());
-  }
-
-  bool operator!=( const Self& y) const {
-    return size() != y.size() || ! std::equal(begin(),end(),y.begin());
-  }
-
-  bool operator<(const Self& y) const {
-    return std::lexicographical_compare( begin(),end(),
-                                         y.begin(),y.end());
-  }
-  bool operator> ( const Self& i) const { return i < *this; }
-  bool operator<=( const Self& i) const { return !(i < *this); }
-  bool operator>=( const Self& i) const { return !(*this < i); }
-
-  // SPECIAL LIST OPERATIONS
-
-protected:
-  void transfer(iterator position, iterator first, iterator last) {
-    // move the range [`first, last') before the position.
-    (*((*last.node).prev_link)).next_link = position.node;
-    (*((*first.node).prev_link)).next_link = last.node;
-    (*((*position.node).prev_link)).next_link = first.node;
-    T* tmp = (*position.node).prev_link;
-    (*position.node).prev_link = (*last.node).prev_link;
-    (*last.node).prev_link = (*first.node).prev_link;
-    (*first.node).prev_link = tmp;
-  }
-
-public:
-  void splice(iterator position, Self& x) {
-    // inserts the list x before position `pos' and x becomes empty.
-    // It takes constant time. Precondition: `&l != &x'.
-    if (!x.empty()) {
-      transfer(position, x.begin(), x.end());
-      length += x.length;
-      x.length = 0;
-    }
-  }
-  void splice(T* position, Self& x) {
-    splice( iterator(position), x);
-  }
-  void splice( iterator position, Self& x, iterator i) {
-    // inserts an element pointed to by i from list x before position
-    // `pos' and removes the element from x. It takes constant time. i
-    // is a valid dereferenceable iterator of x. The result is
-    // unchanged if `pos == i' or `pos == ++i'.
-    iterator j = i;
-    if (position == i || position == ++j) return;
-    transfer(position, i, j);
-    ++length;
-    --x.length;
-  }
-  void splice(T* position, Self& x, T* i) {
-    splice( iterator(position), x, iterator(i));
-  }
-  void splice(iterator pos, Self& x, iterator first, iterator last) {
-    // inserts elements in the range [`first, last') before position
-    // `pos' and removes the elements from x. It takes constant time
-    // if `&x == $l'; otherwise, it takes linear time. [`first,
-    // last') is a valid range in x. Precondition: `pos' is not in the
-    // range [`first, last').
-    if (first != last) {
-      if (&x != this) {
-        difference_type n = std::distance(first, last);
-        x.length -= n;
-        length += n;
-      }
-      transfer(pos, first, last);
-    }
-  }
-  void splice(T* p, Self& x, T* first, T* last) {
-    splice( iterator(p), x, iterator(first), iterator(last));
-  }
-
-  void remove(const T& value);
-  // erases all elements e in the list l for which `e == value'.
-  // It is stable. Precondition: a suitable `operator==' for the
-  // type T.
-
-  void reverse();
-  // reverses the order of the elements in `l' in linear time.
-
-  void unique();
-  // erases all but the first element from every consecutive group
-  // of equal elements in the list `l'. Precondition: a suitable
-  // `operator==' for the type T.
-
-  void merge(Self& x);
-  // merges the list x into the list `l' and x becomes empty. It is
-  // stable. Precondition: Both lists are increasingly sorted. A
-  // suitable `operator<' for the type T.
-
-  template < class StrictWeakOrdering >
-  void merge(Self& x, StrictWeakOrdering ord)
-  // merges the list x into the list `l' and x becomes empty.
-  // It is stable.
-  // Precondition: Both lists are increasingly sorted wrt. ord.
-  {
-    iterator first1 = begin();
-    iterator last1 = end();
-    iterator first2 = x.begin();
-    iterator last2 = x.end();
-    while (first1 != last1 && first2 != last2)
-      if (ord(*first2, *first1)) {
-        iterator next = first2;
-        transfer(first1, first2, ++next);
-        first2 = next;
-      } else
-        ++first1;
-    if (first2 != last2)
-      transfer(last1, first2, last2);
-    length += x.length;
-    x.length= 0;
-  }
-
-  void sort();
-  // sorts the list `l' according to the `operator<' in time O(n
-  // log n) where `n = size()'. It is stable. Precondition: a
-  // suitable `operator<' for the type T.
-
-  template < class StrictWeakOrdering >
-  void sort(StrictWeakOrdering ord)
-  // sorts the list `l' according to ord in time O(n log n)
-  // where `n = size()'. It is stable.
-  {
-    if (size() < 2) return;
-    In_place_list<T,managed,Alloc> carry;
-    In_place_list<T,managed,Alloc> counter[64];
-    int fill = 0;
-    while (!empty()) {
-      carry.splice(carry.begin(), *this, begin());
-      int i = 0;
-      while(i < fill && !counter[i].empty()) {
-        counter[i].merge(carry, ord);
-        carry.swap(counter[i++]);
-      }
-      carry.swap(counter[i]);
-      if (i == fill)
-        ++fill;
-    }
-    for (int i = 1; i < fill; ++i)
-      counter[i].merge(counter[i-1], ord);
-    swap(counter[fill-1]);
-  }
-
-};
-
-template <class T, bool managed, class Alloc>
-void In_place_list<T,managed,Alloc>::
-insert(internal::In_place_list_iterator<T, Alloc> position, size_type n) {
-  while (n--)
-    insert(position, *get_node());
-}
-
-template <class T, bool managed, class Alloc>
-void In_place_list<T,managed,Alloc>::
-insert(internal::In_place_list_iterator<T, Alloc> position, size_type n, const T& x) {
-  while (n--)
-    insert(position, *get_node(x));
-}
-
-template <class T, bool managed, class Alloc>
-void In_place_list<T,managed,Alloc>::
-erase(internal::In_place_list_iterator<T, Alloc> first,
-      internal::In_place_list_iterator<T, Alloc> last)
-{
-  while (first != last)
-    erase(first++);
-}
-
-template <class T, bool managed, class Alloc>
-In_place_list<T,managed,Alloc>&
-In_place_list<T,managed,Alloc>::
-operator=(const In_place_list<T,managed,Alloc>& x) {
-  if (this != &x) {
-    iterator first1 = begin();
-    iterator last1  = end();
-    const_iterator first2 = x.begin();
-    const_iterator last2  = x.end();
-    while (first1 != last1 && first2 != last2) {
-      // Save the pointer values before assignment.
-      // Assignment avoids unneccassary delete's and new's.
-      T* tmp1 = (*first1).next_link;
-      T* tmp2 = (*first1).prev_link;
-      *first1 = *first2++;
-      (*first1).next_link = tmp1;
-      (*first1).prev_link = tmp2;
-      ++first1;
-    }
-    if (first2 == last2)
-      erase(first1, last1);
-    else
-      insert(last1, first2, last2);
-  }
-  return *this;
-}
-
-template <class T, bool managed, class Alloc>
-void In_place_list<T,managed,Alloc>::
-destroy() {
-  iterator first = begin();
-  iterator last  = end();
-  while( first != last) {
-    iterator i = first++;
-    put_node(i.node);
-  }
-  length = 0;
-  (*node).next_link = node;
-  (*node).prev_link = node;
-}
-
-template <class T, bool managed, class Alloc>
-void In_place_list<T,managed,Alloc>::remove(const T& value) {
-  iterator first = begin();
-  iterator last = end();
-  while (first != last) {
-    iterator next = first;
-    ++next;
-    if (*first == value)
-      erase(first);
-    first = next;
-  }
-}
-
-template <class T, bool managed, class Alloc>
-void In_place_list<T,managed,Alloc>::reverse() {
-  if (size() < 2) return;
-  for (iterator first = ++begin(); first != end();) {
-    iterator old = first++;
-    transfer(begin(), old, first);
-  }
-}
-
-template <class T, bool managed, class Alloc>
-void In_place_list<T,managed,Alloc>::unique() {
-  iterator first = begin();
-  iterator last = end();
-  if (first == last) return;
-  iterator next = first;
-  while (++next != last) {
-    if (*first == *next)
-      erase(next);
-    else
-      first = next;
-    next = first;
-  }
-}
-
-template <class T, bool managed, class Alloc>
-void In_place_list<T,managed,Alloc>::merge(In_place_list<T,managed,Alloc>& x) {
-  iterator first1 = begin();
-  iterator last1 = end();
-  iterator first2 = x.begin();
-  iterator last2 = x.end();
-  while (first1 != last1 && first2 != last2)
-    if (*first2 < *first1) {
-      iterator next = first2;
-      transfer(first1, first2, ++next);
-      first2 = next;
-    } else
-      ++first1;
-  if (first2 != last2)
-    transfer(last1, first2, last2);
-  length += x.length;
-  x.length= 0;
-}
-
-template <class T, bool managed, class Alloc>
-void In_place_list<T,managed,Alloc>::sort() {
-  if (size() < 2) return;
-  In_place_list<T,managed,Alloc> carry;
-  In_place_list<T,managed,Alloc> counter[64];
-  int fill = 0;
-  while (!empty()) {
-    carry.splice(carry.begin(), *this, begin());
-    int i = 0;
-    while(i < fill && !counter[i].empty()) {
-      counter[i].merge(carry);
-      carry.swap(counter[i++]);
-    }
-    carry.swap(counter[i]);
-    if (i == fill)
-      ++fill;
-  }
-  for (int i = 1; i < fill; ++i)
-    counter[i].merge(counter[i-1]);
-  swap(counter[fill-1]);
-}
-
-} //namespace CGAL
-
-namespace std {
-
-#if defined(BOOST_MSVC)
-#  pragma warning(push)
-#  pragma warning(disable:4099) // For VC10 it is class hash 
-#endif
-
-#ifndef CGAL_CFG_NO_STD_HASH
-
-  template < class T, class Alloc >
-  struct hash<CGAL::internal::In_place_list_iterator<T, Alloc> >
-    : public std::unary_function<CGAL::internal::In_place_list_iterator<T, Alloc>, std::size_t>  {
-
-    std::size_t operator()(const CGAL::internal::In_place_list_iterator<T, Alloc>& i) const
-    {
-      const T* ptr = &*i;
-      return reinterpret_cast<std::size_t>(ptr)/ sizeof(T);
-    }
-  };
-
-  template < class T, class Alloc >
-  struct hash<CGAL::internal::In_place_list_const_iterator<T, Alloc> >
-    : public std::unary_function<CGAL::internal::In_place_list_const_iterator<T, Alloc>, std::size_t> {
-
-    std::size_t operator()(const CGAL::internal::In_place_list_const_iterator<T, Alloc>& i) const
-    {
-      const T* ptr = &*i;
-      return reinterpret_cast<std::size_t>(ptr)/ sizeof(T);
-    }
-  };
-#endif // CGAL_CFG_NO_STD_HASH
-
-#if defined(BOOST_MSVC)
-#  pragma warning(pop)
-#endif
-
-} // namespace std
-
-#endif // CGAL_IN_PLACE_LIST_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Index_property_map.h b/3rdparty/CGAL-4.8/include/CGAL/Index_property_map.h
deleted file mode 100644
index 1b29f42..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Index_property_map.h
+++ /dev/null
@@ -1,168 +0,0 @@
-// Copyright (c) 20009  INRIA Sophia-Antipolis (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
-// 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(s)     : Laurent Saboret
-
-#ifndef CGAL_INDEX_PROPERTY_MAP_H
-#define CGAL_INDEX_PROPERTY_MAP_H
-
-#include <CGAL/point_set_processing_assertions.h>
-#include <CGAL/trace.h>
-#include <CGAL/property_map.h>
-#include <boost/shared_ptr.hpp>
-
-#include <iterator>
-#include <map>
-
-namespace CGAL {
-
-/// \cond SKIP_IN_MANUAL
-  
-// ----------------------------------------------------------------------------
-// Private section
-// ----------------------------------------------------------------------------
-namespace internal {
-
-/// Functor for operator< that compares iterators address.
-template <typename Iterator>
-struct Compare_iterator_address
-{
-  bool operator()(const Iterator& lhs, const Iterator& rhs) const
-  {
-    return (&*lhs < &*rhs);
-  }
-};
-
-
-} /* namespace internal */
-
-
-// ----------------------------------------------------------------------------
-// Public section
-// ----------------------------------------------------------------------------
-
-
-/// Template class "index" property map, which associates a 0-based index (unsigned int) 
-/// to the `[first, beyond)` range of elements.
-/// 
-/// 2 specializations exist:
-/// - if Iter is a random access iterator (typically vector and deque), 
-/// get() just calls std::distance() and is very efficient;
-/// - else, the property map allocates a std::map to store indices
-/// and get() requires a lookup in the map.
-///
-/// @heading Is Model for the Concepts:
-/// Model of the `ReadablePropertyMap` concept.
-///
-/// @heading Parameters:
-/// @param Iter iterator over input elements.
-/// @param iterator_tag Iter's iterator category.
-
-// This is the default variant that creates a temporary std::map<Iter,unsigned int>.
-template <class Iter,
-          typename iterator_tag=typename std::iterator_traits<Iter>::iterator_category>
-class Index_property_map 
-  : public boost::associative_property_map< std::map<Iter,
-                                                     unsigned int,
-                                                     internal::Compare_iterator_address<Iter> > >
-{
-  // std::map to store indices
-  typedef typename std::map<Iter,
-                            unsigned int,
-                            internal::Compare_iterator_address<Iter> >
-                                            Index_map;
-  // base class = property map
-  typedef typename boost::associative_property_map<Index_map>
-                                            Base;
-public:
-  Index_property_map(
-    Iter first,  ///< iterator over the first element (index 0)
-    Iter beyond) ///< past-the-end iterator over the elements
-    
-  : m_index_map(new Index_map)  // Allocate std::map
-  {
-    CGAL_TRACE("  Index_property_map: index elements in temporary std::map\n");
-
-    // Index elements in std::map
-    Iter it;
-    unsigned int index;
-    for (it = first, index = 0; it != beyond; it++, index++)
-      (*m_index_map)[it] = index;
-      
-    // Wrap std::map in property map
-    (Base&)(*this) = *m_index_map;
-  }
-
-private:
-  // Property maps must be lightweight classes => share std::map
-  boost::shared_ptr<Index_map> m_index_map;
-};
-
-/// @cond SKIP_IN_MANUAL
-// This variant is optimized for a random access container.
-template <class Iter> 
-class Index_property_map<Iter,
-                         std::random_access_iterator_tag>
-{
-public:
-  // Property maps' required types
-  typedef boost::readable_property_map_tag  category;
-  typedef std::size_t                       value_type;
-  typedef value_type                        reference;
-  typedef Iter                              key_type;
-
-  Index_property_map(
-    Iter first,  ///< iterator over the first element (index 0)
-    Iter /*beyond*/) ///< past-the-end iterator over the elements
-  : m_first(first)
-  {
-    CGAL_TRACE("  Index_property_map: optimized version for a random access container\n");
-  }
-
-  /// Free function to access the map elements.
-  friend inline
-  reference get(const Index_property_map& map, key_type p)
-  {
-    return std::distance(map.m_first, p);
-  }
-
-private:
-  Iter m_first; // iterator over the first element (index 0)
-};
-/// @endcond
-
-
-/// Free function to create an Index_property_map property map.
-///
-/// @tparam Iter iterator over input elements.
-///
-/// @return an "index" property map, which associates a 0-based index (unsigned int) 
-/// to the `[first, beyond)` range of elements.
-template <class Iter>
-Index_property_map<Iter>
-make_index_property_map(
-    Iter first,  ///< iterator over the first element (index 0)
-    Iter beyond) ///< past-the-end iterator over the elements
-{
-  return Index_property_map<Iter>(first, beyond);
-}
-
-/// \endcond
-
-} // namespace CGAL
-
-#endif // CGAL_INDEX_PROPERTY_MAP_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Interval_arithmetic_impl.h b/3rdparty/CGAL-4.8/include/CGAL/Interval_arithmetic_impl.h
deleted file mode 100644
index 1d0ed47..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Interval_arithmetic_impl.h
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright (c) 1999-2004
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Sylvain Pion
-
-namespace CGAL {
-
-#ifdef CGAL_CFG_DENORMALS_COMPILE_BUG
-// For compilers which bug on denormalized values at compile time.
-// We generate CGAL_IA_MIN_DOUBLE at run time.
-namespace {
-double init_min_double()
-{
-    double d = 1;
-    double e = 1;
-    do {
-	d = e;
-	e = CGAL_IA_FORCE_TO_DOUBLE(e/2);
-    } while (e != 0);
-    return d;
-}
-} // anonymous namespace
-
-#ifndef CGAL_HEADER_ONLY
-
-namespace internal {
-double minimin = init_min_double();
-}
-
-#else // CGAL_HEADER_ONLY
-
-namespace internal {
-  double& get_static_minimin()
-  {
-    static double minimin = init_min_double();
-    return minimin;
-  }
-}
-#endif // CGAL_HEADER_ONLY
-
-#endif // CGAL_CFG_DENORMALS_COMPILE_BUG
-
-#ifndef CGAL_HEADER_ONLY
-
-#ifdef _MSC_VER
-namespace {
-int dummy_symbol_for_stopping_VC_linker_warning;
-} // namespace
-#endif
-
-#endif // CGAL_HEADER_ONLY
-
-} //namespace CGAL
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Interval_nt.h b/3rdparty/CGAL-4.8/include/CGAL/Interval_nt.h
deleted file mode 100644
index e725e74..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Interval_nt.h
+++ /dev/null
@@ -1,1288 +0,0 @@
-// Copyright (c) 1998-2005,2007  
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved. 
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Sylvain Pion, Michael Hemmer
-
-#ifndef CGAL_INTERVAL_NT_H
-#define CGAL_INTERVAL_NT_H
-
-// This file contains the description of the following classes:
-// - Interval_nt<false>  It's a number type that needs the FPU rounding mode
-//                       to be set to +inf.  It is also typedef'd to
-//                       Interval_nt_advanced for backward compatibility.
-// - Interval_nt<true>   Same but it does the rounding mode itself so you
-//                       don't have to worry about it.  But it's slower.
-//
-// Note: When rounding is towards +infinity, to make an operation rounded
-// towards -infinity, it's enough to take the opposite of some of the operand,
-// and the opposite of the result (see operator+, operator*,...).
-
-// TODO : 
-// - test whether stopping constant propagation only in functions taking
-//   double as arguments, improves performance.
-
-#include <utility> // for std::pair
-#include <CGAL/number_type_config.h>
-#include <CGAL/number_utils.h>
-#include <CGAL/utils_classes.h>
-#include <CGAL/number_utils.h>
-#include <CGAL/Uncertain.h>
-#include <CGAL/Interval_traits.h>
-#include <CGAL/double.h>
-#include <CGAL/FPU.h>
-#include <CGAL/IO/io.h>
-#include <iostream>
-
-namespace CGAL {
-
-template <bool Protected = true>
-class Interval_nt
-{
-  typedef Interval_nt<Protected>     IA;
-  typedef std::pair<double, double>  Pair;
-
-public:
-
-  typedef double      value_type;
-
-  typedef Uncertain_conversion_exception            unsafe_comparison;
-  typedef Checked_protect_FPU_rounding<Protected>   Internal_protector;
-  typedef Protect_FPU_rounding<!Protected>          Protector;
-
-  Interval_nt()
-#ifndef CGAL_NO_ASSERTIONS
-      : _inf(1), _sup(0)
-             // to early and deterministically detect use of uninitialized
-#endif
-    {}
-
-  Interval_nt(int i)
-    : _inf(i), _sup(i) {}
-
-  Interval_nt(unsigned i)
-    : _inf(i), _sup(i) {}
-
-  Interval_nt(long long i)
-    : _inf((double)i), _sup((double)i)
-  {
-    // gcc ignores -frounding-math when converting integers to floats.
-#ifdef __GNUC__
-    long long safe = 1LL << 52; // Use numeric_limits?
-    bool exact = ((long long)_inf == i) || (i <= safe && i >= -safe);
-    if (!(__builtin_constant_p(exact) && exact))
-#endif
-      *this += smallest();
-  }
-
-  Interval_nt(unsigned long long i)
-    : _inf((double)i), _sup((double)i)
-  {
-#ifdef __GNUC__
-    unsigned long long safe = 1ULL << 52; // Use numeric_limits?
-    bool exact = ((unsigned long long)_inf == i) || (i <= safe);
-    if (!(__builtin_constant_p(exact) && exact))
-#endif
-      *this += smallest();
-  }
-
-  Interval_nt(long i)
-  {
-    *this = (sizeof(int)==sizeof(long)) ?
-      Interval_nt((int)i) :
-      Interval_nt((long long)i);
-  }
-
-  Interval_nt(unsigned long i)
-  {
-    *this = (sizeof(int)==sizeof(long)) ?
-      Interval_nt((unsigned)i) :
-      Interval_nt((unsigned long long)i);
-  }
-
-  Interval_nt(double d)
-    : _inf(d), _sup(d) { CGAL_assertion(is_finite(d)); }
-
-// The Intel compiler on Linux is aggressive with constant propagation and
-// it seems there is no flag to stop it, so disable this check for it.
-#if !defined(CGAL_DISABLE_ROUNDING_MATH_CHECK) && \
-    defined(__INTEL_COMPILER) && defined(__linux)
-#  define CGAL_DISABLE_ROUNDING_MATH_CHECK
-#endif
-
-  Interval_nt(double i, double s)
-    : _inf(i), _sup(s)
-  {
-    // Previously it was:
-    //    CGAL_assertion_msg(!(i>s);
-    // But MSVC++ 2012 optimizes the test "!(i>s)" to "i<=s", even with
-    // /fp:strict. If 'i' or 's' is a NaN, that makes a difference.
-    CGAL_assertion_msg( (!is_valid(i)) || (!is_valid(s)) || (!(i>s)),
-	      " Variable used before being initialized (or CGAL bug)");
-#ifndef CGAL_DISABLE_ROUNDING_MATH_CHECK
-    CGAL_assertion_code((void) tester;) // Necessary to trigger a runtime test of rounding modes.
-#endif
-  }
-
-  Interval_nt(const Pair & p)
-    : _inf(p.first), _sup(p.second) {}
-
-  IA operator-() const { return IA (-sup(), -inf()); }
-
-  IA & operator+= (const IA &d) { return *this = *this + d; }
-  IA & operator-= (const IA &d) { return *this = *this - d; }
-  IA & operator*= (const IA &d) { return *this = *this * d; }
-  IA & operator/= (const IA &d) { return *this = *this / d; }
-
-  bool is_point() const
-  {
-    return sup() == inf();
-  }
-
-  bool is_same (const IA & d) const
-  {
-    return inf() == d.inf() && sup() == d.sup();
-  }
-
-  bool do_overlap (const IA & d) const
-  {
-    return !(d.inf() > sup() || d.sup() < inf());
-  }
-
-  const double & inf() const { return _inf; }
-  const double & sup() const { return _sup; }
-
-  std::pair<double, double> pair() const
-  {
-    return std::pair<double, double>(inf(), sup());
-  }
-
-  static IA largest()
-  {
-    return IA(-internal::infinity, internal::infinity);
-  }
-
-  static IA smallest()
-  {
-    return IA(-CGAL_IA_MIN_DOUBLE, CGAL_IA_MIN_DOUBLE);
-  }
-
-#if 0 // def CGAL_HISTOGRAM_PROFILER  // not yet ready
-  ~Interval_nt()
-  {
-    CGAL_HISTOGRAM_PROFILER("[Interval_nt relative precision in log2 scale]",
-                             (unsigned) ( ::log(relative_precision(*this))) / ::log(2.0) )  );
-  }
-#endif
-
-private:
-  // Pair inf_sup;
-  double _inf, _sup;
-
-  struct Test_runtime_rounding_modes {
-    Test_runtime_rounding_modes()
-    {
-      // We test whether GCC's -frounding-math option has been forgotten.
-      // The macros CGAL_IA_MUL and CGAL_IA_DIV stop constant propagation only
-      // on the second argument, so if -fno-rounding-math, the compiler optimizes
-      // the 2 negations and we get wrong rounding.
-      typename Interval_nt<>::Internal_protector P;
-      CGAL_assertion_msg(-CGAL_IA_MUL(-1.1, 10.1) != CGAL_IA_MUL(1.1, 10.1),
-                         "Wrong rounding: did you forget the  -frounding-math  option if you use GCC (or  -fp-model strict  for Intel)?");
-      CGAL_assertion_msg(-CGAL_IA_DIV(-1., 10) != CGAL_IA_DIV(1., 10),
-                         "Wrong rounding: did you forget the  -frounding-math  option if you use GCC (or  -fp-model strict  for Intel)?");
-    }
-  };
-
-#ifndef CGAL_DISABLE_ROUNDING_MATH_CHECK
-  static Test_runtime_rounding_modes tester;
-#endif
-};
-
-#ifndef CGAL_DISABLE_ROUNDING_MATH_CHECK
-template <bool Protected>
-typename Interval_nt<Protected>::Test_runtime_rounding_modes
-Interval_nt<Protected>::tester;
-#endif
-
-template <bool Protected>
-inline
-Uncertain<bool>
-operator<(const Interval_nt<Protected> &a, const Interval_nt<Protected> &b)
-{
-  if (a.sup()  < b.inf()) return true;
-  if (a.inf() >= b.sup()) return false;
-  return Uncertain<bool>::indeterminate();
-}
-
-template <bool Protected>
-inline
-Uncertain<bool>
-operator>(const Interval_nt<Protected> &a, const Interval_nt<Protected> &b)
-{ return b < a; }
-
-template <bool Protected>
-inline
-Uncertain<bool>
-operator<=(const Interval_nt<Protected> &a, const Interval_nt<Protected> &b)
-{
-  if (a.sup() <= b.inf()) return true;
-  if (a.inf() >  b.sup()) return false;
-  return Uncertain<bool>::indeterminate();
-}
-
-template <bool Protected>
-inline
-Uncertain<bool>
-operator>=(const Interval_nt<Protected> &a, const Interval_nt<Protected> &b)
-{ return b <= a; }
-
-template <bool Protected>
-inline
-Uncertain<bool>
-operator==(const Interval_nt<Protected> &a, const Interval_nt<Protected> &b)
-{
-  if (b.inf() >  a.sup() || b.sup() <  a.inf()) return false;
-  if (b.inf() == a.sup() && b.sup() == a.inf()) return true;
-  return Uncertain<bool>::indeterminate();
-}
-
-template <bool Protected>
-inline
-Uncertain<bool>
-operator!=(const Interval_nt<Protected> &a, const Interval_nt<Protected> &b)
-{ return ! (a == b); }
-
-
-// Mixed operators with double.
-
-template <bool Protected>
-inline
-Uncertain<bool>
-operator<(double a, const Interval_nt<Protected> &b)
-{
-  if (a < b.inf()) return true;
-  if (a >= b.sup()) return false;
-  return Uncertain<bool>::indeterminate();
-}
-
-template <bool Protected>
-inline
-Uncertain<bool>
-operator>(double a, const Interval_nt<Protected> &b)
-{ return b < a; }
-
-template <bool Protected>
-inline
-Uncertain<bool>
-operator<=(double a, const Interval_nt<Protected> &b)
-{
-  if (a <= b.inf()) return true;
-  if (a >  b.sup()) return false;
-  return Uncertain<bool>::indeterminate();
-}
-
-template <bool Protected>
-inline
-Uncertain<bool>
-operator>=(double a, const Interval_nt<Protected> &b)
-{ return b <= a; }
-
-template <bool Protected>
-inline
-Uncertain<bool>
-operator==(double a, const Interval_nt<Protected> &b)
-{
-  if (b.inf() >  a || b.sup() <  a) return false;
-  if (b.inf() == a && b.sup() == a) return true;
-  return Uncertain<bool>::indeterminate();
-}
-
-template <bool Protected>
-inline
-Uncertain<bool>
-operator!=(double a, const Interval_nt<Protected> &b)
-{ return ! (a == b); }
-
-template <bool Protected>
-inline
-Uncertain<bool>
-operator<(const Interval_nt<Protected> &a, double b)
-{
-  if (a.sup()  < b) return true;
-  if (a.inf() >= b) return false;
-  return Uncertain<bool>::indeterminate();
-}
-
-template <bool Protected>
-inline
-Uncertain<bool>
-operator>(const Interval_nt<Protected> &a, double b)
-{ return b < a; }
-
-template <bool Protected>
-inline
-Uncertain<bool>
-operator<=(const Interval_nt<Protected> &a, double b)
-{
-  if (a.sup() <= b) return true;
-  if (a.inf() >  b) return false;
-  return Uncertain<bool>::indeterminate();
-}
-
-template <bool Protected>
-inline
-Uncertain<bool>
-operator>=(const Interval_nt<Protected> &a, double b)
-{ return b <= a; }
-
-template <bool Protected>
-inline
-Uncertain<bool>
-operator==(const Interval_nt<Protected> &a, double b)
-{
-  if (b >  a.sup() || b <  a.inf()) return false;
-  if (b == a.sup() && b == a.inf()) return true;
-  return Uncertain<bool>::indeterminate();
-}
-
-template <bool Protected>
-inline
-Uncertain<bool>
-operator!=(const Interval_nt<Protected> &a, double b)
-{ return ! (a == b); }
-
-
-
-// Non-documented
-// Returns true if the interval is a unique representable double.
-template <bool Protected>
-inline
-bool
-fit_in_double (const Interval_nt<Protected> & d, double &r)
-{
-  bool b = d.is_point();
-  if (b)
-    r = d.inf();
-  return b;
-}
-
-// Non-documented
-template <bool Protected>
-inline
-bool
-is_singleton (const Interval_nt<Protected> & d)
-{
-  return d.is_point();
-}
-
-// Non-documented
-template <bool Protected>
-inline
-double
-magnitude (const Interval_nt<Protected> & d)
-{
-  return (std::max)(CGAL::abs(d.inf()), CGAL::abs(d.sup()));
-}
-
-// Non-documented
-template <bool Protected>
-inline
-double
-width (const Interval_nt<Protected> & d)
-{
-  return d.sup() - d.inf();
-}
-
-// Non-documented
-template <bool Protected>
-inline
-double
-radius (const Interval_nt<Protected> & d)
-{
-  return width(d)/2; // This could be improved to avoid overflow.
-}
-
-// Non-documented
-// This is the relative precision of to_double() (the center of the interval),
-// hence we use radius() instead of width().
-template <bool Protected>
-inline
-bool
-has_smaller_relative_precision(const Interval_nt<Protected> & d, double prec)
-{
-  return magnitude(d) == 0 || radius(d) < prec * magnitude(d);
-}
-
-// Non-documented
-template <bool Protected>
-double
-relative_precision(const Interval_nt<Protected> & d)
-{
-  if (magnitude(d) == 0.0)
-    return 0.0;
-  return radius(d) / magnitude(d);
-}
-
-
-template< bool Protected >
-class Is_valid< Interval_nt<Protected> >
-  : public std::unary_function< Interval_nt<Protected>, bool > {
-  public :
-    bool operator()( const Interval_nt<Protected>& x ) const {
-      return is_valid(x.inf()) &&
-             is_valid(x.sup()) &&
-             x.inf() <= x.sup();
-    }
-};
-
-template <bool Protected>
-std::ostream & operator<< (std::ostream &os, const Interval_nt<Protected> & I )
-{
-  return os << "[" << I.inf() << ";" << I.sup() << "]";
-}
-
-#define CGAL_SWALLOW(IS,CHAR)                           \
-    {                                                   \
-        char c;                                         \
-        do c = is.get(); while (isspace(c));            \
-        if (c != CHAR) {                                \
-            is.setstate(std::ios_base::failbit);        \
-        }                                               \
-    }                                                   \
-
-template <bool Protected>
-std::istream & operator>> (std::istream &is, Interval_nt<Protected> & I)
-{
-    char c;
-    do c = is.get(); while (isspace(c));
-    is.putback(c);
-    if(c == '['){ // read original output from operator <<
-        double inf,sup;
-        CGAL_SWALLOW(is, '[');// read the "["
-        is >> iformat(inf);
-        CGAL_SWALLOW(is, ';');// read the ";"
-        is >> iformat(sup);
-        CGAL_SWALLOW(is, ']');// read the "]"
-        I = Interval_nt<Protected>(inf,sup);
-    }else{ //read double (backward compatibility)
-        double d;
-        is >> d;
-        I = d;
-    }
-    return is;
-}
-#undef CGAL_SWALLOW
-
-typedef Interval_nt<false> Interval_nt_advanced;  // for backward-compatibility
-
-
-template <bool Protected>
-inline
-Interval_nt<Protected>
-operator+ (const Interval_nt<Protected> &a, const Interval_nt<Protected> & b)
-{
-  typename Interval_nt<Protected>::Internal_protector P;
-  return Interval_nt<Protected> (-CGAL_IA_SUB(-a.inf(), b.inf()),
-                                  CGAL_IA_ADD(a.sup(), b.sup()));
-}
-
-template <bool Protected>
-inline
-Interval_nt<Protected>
-operator+ (double a, const Interval_nt<Protected> & b)
-{
-  return Interval_nt<Protected>(a)+b;
-}
-
-template <bool Protected>
-inline
-Interval_nt<Protected>
-operator+ (const Interval_nt<Protected> & a, double b)
-{
-  return a+Interval_nt<Protected>(b);
-}
-
-template< bool Protected >
-inline
-Interval_nt<Protected>
-operator+( const Interval_nt<Protected>& a ) {
-  return a;
-}
-
-template <bool Protected>
-inline
-Interval_nt<Protected>
-operator- (const Interval_nt<Protected> &a, const Interval_nt<Protected> & b)
-{
-  typename Interval_nt<Protected>::Internal_protector P;
-  return Interval_nt<Protected>(-CGAL_IA_SUB(b.sup(), a.inf()),
-                                 CGAL_IA_SUB(a.sup(), b.inf()));
-}
-
-template <bool Protected>
-inline
-Interval_nt<Protected>
-operator- (double a, const Interval_nt<Protected> & b)
-{
-  return Interval_nt<Protected>(a)-b;
-}
-
-template <bool Protected>
-inline
-Interval_nt<Protected>
-operator- (const Interval_nt<Protected> & a, double b)
-{
-  return a-Interval_nt<Protected>(b);
-}
-
-template <bool Protected>
-inline
-Interval_nt<Protected>
-operator* (const Interval_nt<Protected> &a, const Interval_nt<Protected> & b)
-{
-  typedef Interval_nt<Protected> IA;
-  typename Interval_nt<Protected>::Internal_protector P;
-  if (a.inf() >= 0.0)					// a>=0
-  {
-    // b>=0     [a.inf()*b.inf(); a.sup()*b.sup()]
-    // b<=0     [a.sup()*b.inf(); a.inf()*b.sup()]
-    // b~=0     [a.sup()*b.inf(); a.sup()*b.sup()]
-    double aa = a.inf(), bb = a.sup();
-    if (b.inf() < 0.0)
-    {
-	aa = bb;
-	if (b.sup() < 0.0)
-	    bb = a.inf();
-    }
-    return IA(-CGAL_IA_MUL(aa, -b.inf()), CGAL_IA_MUL(bb, b.sup()));
-  }
-  else if (a.sup()<=0.0)				// a<=0
-  {
-    // b>=0     [a.inf()*b.sup(); a.sup()*b.inf()]
-    // b<=0     [a.sup()*b.sup(); a.inf()*b.inf()]
-    // b~=0     [a.inf()*b.sup(); a.inf()*b.inf()]
-    double aa = a.sup(), bb = a.inf();
-    if (b.inf() < 0.0)
-    {
-	aa=bb;
-	if (b.sup() < 0.0)
-	    bb=a.sup();
-    }
-    return IA(-CGAL_IA_MUL(bb, -b.sup()), CGAL_IA_MUL(aa, b.inf()));
-  }
-  else						// 0 \in a
-  {
-    if (b.inf()>=0.0)				// b>=0
-      return IA(-CGAL_IA_MUL(a.inf(), -b.sup()),
-                 CGAL_IA_MUL(a.sup(), b.sup()));
-    if (b.sup()<=0.0)				// b<=0
-      return IA(-CGAL_IA_MUL(a.sup(), -b.inf()),
-                 CGAL_IA_MUL(a.inf(), b.inf()));
-        					// 0 \in b
-    double tmp1 = CGAL_IA_MUL(a.inf(), -b.sup());
-    double tmp2 = CGAL_IA_MUL(a.sup(), -b.inf());
-    double tmp3 = CGAL_IA_MUL(a.inf(),  b.inf());
-    double tmp4 = CGAL_IA_MUL(a.sup(),  b.sup());
-    return IA(-(std::max)(tmp1,tmp2), (std::max)(tmp3,tmp4));
-  }
-}
-
-template <bool Protected>
-inline
-Interval_nt<Protected>
-operator* (double a, const Interval_nt<Protected> & b)
-{
-  return Interval_nt<Protected>(a)*b;
-}
-
-template <bool Protected>
-inline
-Interval_nt<Protected>
-operator* (const Interval_nt<Protected> & a, double b)
-{
-  return a*Interval_nt<Protected>(b);
-}
-
-template <bool Protected>
-inline
-Interval_nt<Protected>
-operator/ (const Interval_nt<Protected> &a, const Interval_nt<Protected> & b)
-{
-  typedef Interval_nt<Protected> IA;
-  typename Interval_nt<Protected>::Internal_protector P;
-  if (b.inf() > 0.0)				// b>0
-  {
-    // e>=0	[a.inf()/b.sup(); a.sup()/b.inf()]
-    // e<=0	[a.inf()/b.inf(); a.sup()/b.sup()]
-    // e~=0	[a.inf()/b.inf(); a.sup()/b.inf()]
-    double aa = b.sup(), bb = b.inf();
-    if (a.inf() < 0.0)
-    {
-	aa = bb;
-	if (a.sup() < 0.0)
-	    bb = b.sup();
-    }
-    return IA(-CGAL_IA_DIV(a.inf(), -aa), CGAL_IA_DIV(a.sup(), bb));
-  }
-  else if (b.sup()<0.0)			// b<0
-  {
-    // e>=0	[a.sup()/b.sup(); a.inf()/b.inf()]
-    // e<=0	[a.sup()/b.inf(); a.inf()/b.sup()]
-    // e~=0	[a.sup()/b.sup(); a.inf()/b.sup()]
-    double aa = b.sup(), bb = b.inf();
-    if (a.inf() < 0.0)
-    {
-	bb = aa;
-	if (a.sup() < 0.0)
-	    aa = b.inf();
-    }
-    return IA(-CGAL_IA_DIV(a.sup(), -aa), CGAL_IA_DIV(a.inf(), bb));
-  }
-  else					// b~0
-    return IA::largest();
-	   // We could do slightly better -> [0;infinity] when b.sup()==0,
-	   // but is this worth ?
-}
-
-template <bool Protected>
-inline
-Interval_nt<Protected>
-operator/ (double a, const Interval_nt<Protected> & b)
-{
-  return Interval_nt<Protected>(a)/b;
-}
-
-template <bool Protected>
-inline
-Interval_nt<Protected>
-operator/ (const Interval_nt<Protected> & a, double b)
-{
-  return a/Interval_nt<Protected>(b);
-}
-
-// TODO: What about these two guys? Where do they belong to?
-template <bool Protected>
-struct Min <Interval_nt<Protected> >
-    : public std::binary_function<Interval_nt<Protected>,
-                             Interval_nt<Protected>,
-                             Interval_nt<Protected> >
-{
-    Interval_nt<Protected> operator()( const Interval_nt<Protected>& d,
-                                       const Interval_nt<Protected>& e) const
-    {
-        return Interval_nt<Protected>(
-                (std::min)(d.inf(), e.inf()),
-                (std::min)(d.sup(), e.sup()));
-    }
-};
-
-template <bool Protected>
-struct Max <Interval_nt<Protected> >
-    : public std::binary_function<Interval_nt<Protected>,
-                             Interval_nt<Protected>,
-                             Interval_nt<Protected> >
-{
-    Interval_nt<Protected> operator()( const Interval_nt<Protected>& d,
-                                       const Interval_nt<Protected>& e) const
-    {
-        return Interval_nt<Protected>(
-                (std::max)(d.inf(), e.inf()),
-                (std::max)(d.sup(), e.sup()));
-    }
-};
-
-template<bool Protected> inline 
-Interval_nt<Protected> min BOOST_PREVENT_MACRO_SUBSTITUTION(
-const Interval_nt<Protected> & x,
-const Interval_nt<Protected> & y){
-  return CGAL::Min<Interval_nt<Protected> > ()(x,y);
-}
-template<bool Protected> inline 
-Interval_nt<Protected> max BOOST_PREVENT_MACRO_SUBSTITUTION(
-const Interval_nt<Protected> & x,
-const Interval_nt<Protected> & y){
-  return CGAL::Max<Interval_nt<Protected> > ()(x,y);
-}
-
-
-
-// TODO : document, when we are OK with the interface.
-// - should it allow other number types for the exponent ?
-template < bool b >
-Interval_nt<b>
-ldexp(const Interval_nt<b> &i, int e)
-{
-  double scale = std::ldexp(1.0, e);
-  Interval_nt<b> scale_interval (
-                      CGAL_NTS is_finite(scale) ? scale : CGAL_IA_MAX_DOUBLE,
-                      scale == 0 ? CGAL_IA_MIN_DOUBLE : scale);
-  return i * scale_interval;
-}
-
-
-// We also specialize some corresponding functors returning Uncertain<>.
-
-// TODO: To which concept do these functors belong? Can we remove them??
-template < bool b >
-struct Equal_to < Interval_nt<b>, Interval_nt<b> >
-  : public std::binary_function< Interval_nt<b>, Interval_nt<b>, Uncertain<bool> >
-{
-  Uncertain<bool> operator()( const Interval_nt<b>& x,
-                              const Interval_nt<b>& y) const
-  { return x == y; }
-};
-
-template < bool b >
-struct Not_equal_to < Interval_nt<b>, Interval_nt<b> >
-  : public std::binary_function< Interval_nt<b>, Interval_nt<b>, Uncertain<bool> >
-{
-  Uncertain<bool> operator()( const Interval_nt<b>& x,
-                              const Interval_nt<b>& y) const
-  { return x != y; }
-};
-
-template < bool b >
-struct Greater < Interval_nt<b>, Interval_nt<b> >
-  : public std::binary_function< Interval_nt<b>, Interval_nt<b>, Uncertain<bool> >
-{
-  Uncertain<bool> operator()( const Interval_nt<b>& x,
-                              const Interval_nt<b>& y) const
-  { return x > y; }
-};
-
-template < bool b >
-struct Less < Interval_nt<b>, Interval_nt<b> >
-  : public std::binary_function< Interval_nt<b>, Interval_nt<b>, Uncertain<bool> >
-{
-  Uncertain<bool> operator()( const Interval_nt<b>& x,
-                              const Interval_nt<b>& y) const
-  { return x < y; }
-};
-
-template < bool b >
-struct Greater_equal < Interval_nt<b>, Interval_nt<b> >
-  : public std::binary_function< Interval_nt<b>, Interval_nt<b>, Uncertain<bool> >
-{
-  Uncertain<bool> operator()( const Interval_nt<b>& x,
-                              const Interval_nt<b>& y) const
-  { return x >= y; }
-};
-
-template < bool b >
-struct Less_equal < Interval_nt<b>, Interval_nt<b> >
-  : public std::binary_function< Interval_nt<b>, Interval_nt<b>, Uncertain<bool> >
-{
-  Uncertain<bool> operator()( const Interval_nt<b>& x,
-                              const Interval_nt<b>& y) const
-  { return x <= y; }
-};
-
-
-// As in MP_float.h, the namespace INTERN_INTERVAL_NT contains (now) global
-// functions like square or sqrt which would have collided with the new
-// global functions from AST/RET
-//
-// TODO: IMHO, a better solution would be to put the INTERN_MP_FLOAT-functions
-//       into the MP_Float-class... But there is surely a reason why this is not
-//       the case..?
-
-
-namespace INTERN_INTERVAL_NT {
-
-  template <bool Protected>
-  inline
-  double
-  to_double (const Interval_nt<Protected> & d)
-  {
-    return (d.sup() + d.inf()) * 0.5;
-    // This may overflow...
-  }
-
-  template <bool Protected>
-  inline
-  std::pair<double, double>
-  to_interval (const Interval_nt<Protected> & d)
-  {
-    return d.pair();
-  }
-
-  template <bool Protected>
-  inline
-  Interval_nt<Protected>
-  sqrt (const Interval_nt<Protected> & d)
-  {
-    typename Interval_nt<Protected>::Internal_protector P;  // not optimal here.
-    // sqrt([+a,+b]) => [sqrt(+a);sqrt(+b)]
-    // sqrt([-a,+b]) => [0;sqrt(+b)] => assumes roundoff error.
-    // sqrt([-a,-b]) => [0;sqrt(-b)] => assumes user bug (unspecified result).
-    FPU_set_cw(CGAL_FE_DOWNWARD);
-    double i = (d.inf() > 0.0) ? CGAL_IA_SQRT(d.inf()) : 0.0;
-    FPU_set_cw(CGAL_FE_UPWARD);
-    return Interval_nt<Protected>(i, CGAL_IA_SQRT(d.sup()));
-  }
-
-  template <bool Protected>
-  inline
-  Interval_nt<Protected>
-  square (const Interval_nt<Protected> & d)
-  {
-    typename Interval_nt<Protected>::Internal_protector P;
-    if (d.inf()>=0.0)
-        return Interval_nt<Protected>(-CGAL_IA_MUL(d.inf(), -d.inf()),
-                                 CGAL_IA_MUL(d.sup(), d.sup()));
-    if (d.sup()<=0.0)
-        return Interval_nt<Protected>(-CGAL_IA_MUL(d.sup(), -d.sup()),
-                               CGAL_IA_MUL(d.inf(), d.inf()));
-    return Interval_nt<Protected>(0.0, CGAL_IA_SQUARE((std::max)(-d.inf(),
-                     d.sup())));
-  }
-
-  template <bool Protected>
-  inline
-  Interval_nt<Protected>
-  abs (const Interval_nt<Protected> & d)
-  {
-    if (d.inf() >= 0.0) return d;
-    if (d.sup() <= 0.0) return -d;
-    return Interval_nt<Protected>(0.0, (std::max)(-d.inf(), d.sup()));
-  }
-
-  template <bool Protected>
-  inline
-  Uncertain<Sign>
-  sign (const Interval_nt<Protected> & d)
-  {
-    if (d.inf() > 0.0) return POSITIVE;
-    if (d.sup() < 0.0) return NEGATIVE;
-    if (d.inf() == d.sup()) return ZERO;
-    return Uncertain<Sign>::indeterminate();
-  }
-
-  template <bool Protected>
-  inline
-  Uncertain<Comparison_result>
-  compare (const Interval_nt<Protected> & d, const Interval_nt<Protected> & e)
-  {
-    if (d.inf() > e.sup()) return LARGER;
-    if (e.inf() > d.sup()) return SMALLER;
-    if (e.inf() == d.sup() && d.inf() == e.sup()) return EQUAL;
-    return Uncertain<Comparison_result>::indeterminate();
-  }
-
-  template <bool Protected>
-  inline
-  Uncertain<bool>
-  is_zero (const Interval_nt<Protected> & d)
-  {
-    if (d.inf() > 0.0) return false;
-    if (d.sup() < 0.0) return false;
-    if (d.inf() == d.sup()) return true;
-    return Uncertain<bool>::indeterminate();
-  }
-
-  template <bool Protected>
-  inline
-  Uncertain<bool>
-  is_one (const Interval_nt<Protected> & d)
-  {
-    if (d.inf() > 1) return false;
-    if (d.sup() < 1) return false;
-    if (d.inf() == d.sup()) return true;
-    return Uncertain<bool>::indeterminate();
-  }
-
-  template <bool Protected>
-  inline
-  Uncertain<bool>
-  is_positive (const Interval_nt<Protected> & d)
-  {
-    if (d.inf() > 0.0) return true;
-    if (d.sup() <= 0.0) return false;
-    return Uncertain<bool>::indeterminate();
-  }
-
-  template <bool Protected>
-  inline
-  Uncertain<bool>
-  is_negative (const Interval_nt<Protected> & d)
-  {
-    if (d.inf() >= 0.0) return false;
-    if (d.sup() < 0.0) return true;
-    return Uncertain<bool>::indeterminate();
-  }
-
- // TODO: Whats this for? Why is this in this file??
-  inline
-  std::pair<double, double>
-  to_interval (const long & l)
-  {
-    if (sizeof(double) > sizeof(long)) {
-      // On 64bit platforms, a long doesn't fit exactly in a double.
-      // Well, a perfect fix would be to use std::numeric_limits<>, but...
-      Protect_FPU_rounding<true> P(CGAL_FE_TONEAREST);
-      Interval_nt<false> approx ((double) l);
-      FPU_set_cw(CGAL_FE_UPWARD);
-      approx += Interval_nt<false>::smallest();
-      return approx.pair();
-    }
-    else
-      return std::pair<double,double>(l,l);
-  }
-} // namespace INTERN_INTERVAL_NT
-
-
-template< bool B > class Real_embeddable_traits< Interval_nt<B> >
-  : public INTERN_RET::Real_embeddable_traits_base< Interval_nt<B> , CGAL::Tag_true> {
-  public:
-    typedef Interval_nt<B>  Type;
-  typedef Uncertain<CGAL::Sign> Sign;
-  typedef Uncertain<bool> Boolean;
-  typedef Uncertain<CGAL::Comparison_result> Comparison_result; 
-
-    class Abs
-      : public std::unary_function< Type, Type > {
-      public:
-        Type operator()( const Type& x ) const {
-            return INTERN_INTERVAL_NT::abs( x );
-        }
-    };
-
-    class Sgn
-        : public std::unary_function< Type, Uncertain< ::CGAL::Sign > > {
-      public:
-        Uncertain< ::CGAL::Sign > operator()( const Type& x ) const {
-            return INTERN_INTERVAL_NT::sign( x );
-        }
-    };
-
-    class Is_positive
-      : public std::unary_function< Type, Uncertain<bool> > {
-      public:
-        Uncertain<bool> operator()( const Type& x ) const {
-          return INTERN_INTERVAL_NT::is_positive( x );
-        }
-    };
-
-    class Is_negative
-      : public std::unary_function< Type, Uncertain<bool> > {
-      public:
-        Uncertain<bool> operator()( const Type& x ) const {
-          return INTERN_INTERVAL_NT::is_negative( x );
-        }
-    };
-
-    class Compare
-      : public std::binary_function< Type, Type, Comparison_result > {
-      public:
-      Comparison_result operator()( const Type& x, const Type& y ) const {
-        return INTERN_INTERVAL_NT::compare( x, y );
-      }
-      CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT( Type,
-          Comparison_result )
-    };
-
-    class To_double
-      : public std::unary_function< Type, double > {
-      public:
-        double operator()( const Type& x ) const {
-            return INTERN_INTERVAL_NT::to_double( x );
-        }
-    };
-
-    class To_interval
-      : public std::unary_function< Type, std::pair< double, double > > {
-      public:
-        std::pair<double, double> operator()( const Type& x ) const {
-            return INTERN_INTERVAL_NT::to_interval( x );
-        }
-    };
-
-    class Is_finite
-      : public std::unary_function< Type, Boolean > {
-      public :
-        Boolean operator()( const Type& x ) const {
-          return CGAL_NTS is_finite( x.inf() ) && CGAL_NTS is_finite( x.sup() );
-        }
-    };
-
-};
-
-// Algebraic structure traits
-template< bool B >
-class Algebraic_structure_traits< Interval_nt<B> >
-  : public Algebraic_structure_traits_base< Interval_nt<B>,
-                                            Field_with_sqrt_tag >  {
-  public:
-    typedef Interval_nt<B>      Type;
-    typedef Tag_false           Is_exact;
-    typedef Tag_true            Is_numerical_sensitive;
-    typedef Uncertain<bool>     Boolean; 
-
-    class Is_zero
-      : public std::unary_function< Type, Boolean > {
-      public:
-        Boolean operator()( const Type& x ) const {
-          return INTERN_INTERVAL_NT::is_zero( x );
-        }
-    };
-
-    class Is_one
-      : public std::unary_function< Type, Boolean > {
-      public:
-        Boolean operator()( const Type& x ) const {
-          return INTERN_INTERVAL_NT::is_one( x );
-        }
-    };
-
-    class Square
-      : public std::unary_function< Type, Type > {
-      public:
-        Type operator()( const Type& x ) const {
-          return INTERN_INTERVAL_NT::square( x );
-        }
-    };
-
-    class Sqrt
-      : public std::unary_function< Type, Type > {
-      public:
-        Type operator()( const Type& x ) const {
-          return INTERN_INTERVAL_NT::sqrt( x );
-        }
-    };
-
-    struct Is_square
-        :public std::binary_function<Interval_nt<B>,Interval_nt<B>&,Boolean >
-    {
-        Boolean operator()(const Interval_nt<B>& x) const {
-            return INTERN_INTERVAL_NT::is_positive( x );
-        }
-
-        Boolean operator()(
-                const Interval_nt<B>& x,
-                Interval_nt<B>      & result) const {
-            Boolean is_positive = INTERN_INTERVAL_NT::is_positive( x );
-            if ( is_positive.inf() == true ){
-                typename Algebraic_structure_traits<Interval_nt<B> >::Sqrt sqrt;
-                result = sqrt(x);
-            }else{
-                typename Real_embeddable_traits<Interval_nt<B> >::Abs  abs;
-                typename Algebraic_structure_traits<Interval_nt<B> >::Sqrt sqrt;
-                result = sqrt(abs(x));
-            }
-            return is_positive;
-        }
-    };
-
-  class Divides
-    : public std::binary_function< Type, Type, Boolean > { 
-  public:
-    Boolean operator()( const Type& x, const Type&) const {
-      return ! Is_zero()(x);
-    } 
-    // second operator computing q
-    Boolean operator()( const Type& x, const Type& y, Type& q) const {
-      if (! Is_zero()(x) )
-        q  = y/x ;
-      return Boolean(true);
-    }
-  };
-  
-};
-
-
-// COERCION_TRAITS BEGIN
-template < class A, class B , int > struct Coercion_traits_for_level;
-template < class A, class B, class C> struct Coercion_traits_interval_nt;
-
-template<class A ,bool P >
-struct Coercion_traits_for_level<A,Interval_nt<P>,CTL_INTERVAL>
-    :public Coercion_traits_interval_nt<A,Interval_nt<P>,
-            typename Real_embeddable_traits<A>::Is_real_embeddable>{};
-
-template<class A , bool P>
-struct Coercion_traits_for_level<Interval_nt<P>,A,CTL_INTERVAL>
-    :public Coercion_traits_for_level<A,Interval_nt<P>, CTL_INTERVAL>{};
-
-template<class A , bool P >
-struct Coercion_traits_interval_nt<A, Interval_nt<P>,Tag_false>
-    :public Coercion_traits_for_level<A,Interval_nt<P>,0>{};
-
-template<class A , bool P>
-struct Coercion_traits_interval_nt<A, Interval_nt<P>, Tag_true>{
-    typedef Tag_true Are_explicit_interoperable;
-    typedef Tag_false Are_implicit_interoperable;
-    typedef Interval_nt<P> Type;
-    struct Cast {
-        typedef Interval_nt<P> result_type;
-        Interval_nt<P> inline operator()(const Interval_nt<P>& x ) const {
-            return x;
-        }
-        Interval_nt<P> inline operator()(const A& x ) const {
-            return typename Real_embeddable_traits<A>::To_interval()(x);
-        }
-    };
-};
-
-// COERCION_TRAITS END
-
-template< bool B >
-class Interval_traits< Interval_nt<B> >
-  : public internal::Interval_traits_base< Interval_nt<B> >  {
-public: 
-  typedef Interval_traits<Interval_nt<B> > Self; 
-  typedef Interval_nt<B> Interval; 
-  typedef double Bound; 
-  typedef CGAL::Tag_false With_empty_interval; 
-  typedef CGAL::Tag_true  Is_interval; 
-
- struct Construct :public std::binary_function<Bound,Bound,Interval>{
-    Interval operator()( const Bound& l,const Bound& r) const {
-      CGAL_precondition( l < r ); 
-      return Interval(l,r);
-    }
-  };
-
-  struct Lower :public std::unary_function<Interval,Bound>{
-    Bound operator()( const Interval& a ) const {
-      return a.inf();
-    }
-  };
-
-  struct Upper :public std::unary_function<Interval,Bound>{
-    Bound operator()( const Interval& a ) const {
-      return a.sup();
-    }
-  };
-
-  struct Width :public std::unary_function<Interval,Bound>{
-    Bound operator()( const Interval& a ) const {
-      return width(a); 
-    }
-  };
-
-  struct Median :public std::unary_function<Interval,Bound>{
-    Bound operator()( const Interval& a ) const {
-      return (Lower()(a)+Upper()(a))/2.0;
-    }
-  };
-    
-  struct Norm :public std::unary_function<Interval,Bound>{
-    Bound operator()( const Interval& a ) const {
-      return magnitude(a);
-    }
-  };
-
-  struct Singleton :public std::unary_function<Interval,bool>{
-    bool operator()( const Interval& a ) const {
-      return Lower()(a) == Upper()(a);
-    }
-  };
-
-  struct Zero_in :public std::unary_function<Interval,bool>{
-    bool operator()( const Interval& a ) const {
-      return Lower()(a) <= 0  &&  0 <= Upper()(a);
-    }
-  };
-
-  struct In :public std::binary_function<Bound,Interval,bool>{
-    bool operator()( Bound x, const Interval& a ) const {
-      return Lower()(a) <= x && x <= Upper()(a);
-    }
-  };
-
-  struct Equal :public std::binary_function<Interval,Interval,bool>{
-    bool operator()( const Interval& a, const Interval& b ) const {
-      return a.is_same(b);
-    }
-  };
-    
-  struct Overlap :public std::binary_function<Interval,Interval,bool>{
-    bool operator()( const Interval& a, const Interval& b ) const {
-      return a.do_overlap(b);
-    }
-  };
-    
-  struct Subset :public std::binary_function<Interval,Interval,bool>{
-    bool operator()( const Interval& a, const Interval& b ) const {
-      return Lower()(b) <= Lower()(a) && Upper()(a) <= Upper()(b) ;  
-    }
-  };
-    
-  struct Proper_subset :public std::binary_function<Interval,Interval,bool>{
-    bool operator()( const Interval& a, const Interval& b ) const {
-      return Subset()(a,b) && ! Equal()(a,b); 
-    }
-  };
-    
-  struct Hull :public std::binary_function<Interval,Interval,Interval>{
-    Interval operator()( const Interval& a, const Interval& b ) const {
-      BOOST_USING_STD_MAX();
-      BOOST_USING_STD_MIN();
-      return Interval( 
-          std::make_pair(
-              min BOOST_PREVENT_MACRO_SUBSTITUTION (Lower()(a),b.inf()), 
-              max BOOST_PREVENT_MACRO_SUBSTITUTION (Upper()(a),b.sup())));
-    }
-  };
-    
-  
-//  struct Empty is Null_functor 
-  
-  struct Intersection :public std::binary_function<Interval,Interval,Interval>{
-    Interval operator()( const Interval& a, const Interval& b ) const {
-      BOOST_USING_STD_MAX();
-      BOOST_USING_STD_MIN();
-      Bound l(max BOOST_PREVENT_MACRO_SUBSTITUTION (Lower()(a),Lower()(b)));
-      Bound u(min BOOST_PREVENT_MACRO_SUBSTITUTION (Upper()(a),Upper()(b)));
-      if(u < l ) throw Exception_intersection_is_empty();
-      return Construct()(l,u);
-    }
-  };
-};
-
-} //namespace CGAL
-
-namespace Eigen {
-  template<class> struct NumTraits;
-  template<bool b> struct NumTraits<CGAL::Interval_nt<b> >
-  {
-    typedef CGAL::Interval_nt<b> Real;
-    typedef CGAL::Interval_nt<b> NonInteger;
-    typedef CGAL::Interval_nt<b> Nested;
-
-    static inline Real epsilon() { return 0; }
-    static inline Real dummy_precision() { return 0; }
-
-    // Costs could depend on b.
-    enum {
-      IsInteger = 0,
-      IsSigned = 1,
-      IsComplex = 0,
-      RequireInitialization = 0,
-      ReadCost = 2,
-      AddCost = 2,
-      MulCost = 10
-    };
-  };
-}
-
-#endif // CGAL_INTERVAL_NT_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Iterator_range.h b/3rdparty/CGAL-4.8/include/CGAL/Iterator_range.h
deleted file mode 100644
index 82ee9e8..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Iterator_range.h
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright (c) 2014  GeometryFactory (France).  All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Andreas Fabri
-
-#ifndef CGAL_ITERATOR_RANGE_H
-#define CGAL_ITERATOR_RANGE_H
-
-#include <CGAL/tuple.h>
-#include <utility>
-#include <boost/foreach.hpp>
-
-namespace CGAL {
-
-  /*!
-\ingroup PkgStlExtension
-  /// `CGAL::Iterator_range` is a...
-  */
-  template <typename I>
-  class Iterator_range
-    : public std::pair<I,I>{
-    
-    typedef std::pair<I,I> Base;
-
-  public:
-
-    typedef I iterator;
-    typedef I const_iterator;
-
-    Iterator_range(I b, I e)
-      : Base(b,e)
-    {}
-
-
-    // Iterator_range(const Iterator_range& ip)
-    //   : Base(ip)
-    // {}
-
-    Iterator_range(const std::pair<I,I>& ip)
-      : Base(ip)
-    {}
-
-  I begin() const
-  {
-    return this->first;
-  }
-
-  I end() const
-  {
-    return this->second;
-  }
-
-  /// returns `std::distance(begin(), end())`
-  typename std::iterator_traits<I>::difference_type
-  size() const
-  {
-    return std::distance(begin(), end());
-  }
-
-  /// returns `std::distance(begin(), end())==0`
-  bool empty() const
-  {
-    return std::distance(begin(), end())==0;
-  }
-
-};
-
-  template <typename T>
-  Iterator_range<T>
-  make_range(const T& b, const T&e)
-  {
-    return Iterator_range<T>(b,e);
-  }
-
-  template <typename T>
-  Iterator_range<T>
-  make_range(const std::pair<T,T>& p)
-  {
-    return Iterator_range<T>(p.first,p.second);
-  }
-
-
-} // namespace CGAL
-
-// At global scope...
-
-  template<typename T>
-inline boost::mpl::true_ *
-  boost_foreach_is_lightweight_proxy( CGAL::Iterator_range<T> *&, boost::foreach::tag )
-{
-    return 0;
-}
-namespace boost { namespace foreach
-{
-    template<typename T>
-    struct is_lightweight_proxy< CGAL::Iterator_range<T> >
-      : mpl::true_
-    {
-    };
-}}
-#endif // CGAL_ITERATOR_RANGE_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kd_tree.h b/3rdparty/CGAL-4.8/include/CGAL/Kd_tree.h
deleted file mode 100644
index 39a4b77..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Kd_tree.h
+++ /dev/null
@@ -1,464 +0,0 @@
-// Copyright (c) 2002,2011,2014 Utrecht University (The Netherlands), Max-Planck-Institute Saarbruecken (Germany).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Hans Tangelder (<hanst at cs.uu.nl>),
-//               : Waqar Khan <wkhan at mpi-inf.mpg.de>
-
-#ifndef CGAL_KD_TREE_H
-#define CGAL_KD_TREE_H
-
-#include <CGAL/basic.h>
-#include <CGAL/assertions.h>
-#include <vector>
-
-#include <CGAL/algorithm.h>
-#include <CGAL/Kd_tree_node.h>
-#include <CGAL/Splitters.h>
-#include <CGAL/internal/Get_dimension_tag.h>
-
-#include <deque>
-#include <boost/container/deque.hpp>
-#include <boost/optional.hpp>
-
-#ifdef CGAL_HAS_THREADS
-#include <CGAL/mutex.h>
-#endif
-
-namespace CGAL {
-
-//template <class SearchTraits, class Splitter_=Median_of_rectangle<SearchTraits>, class UseExtendedNode = Tag_true >
-template <class SearchTraits, class Splitter_=Sliding_midpoint<SearchTraits>, class UseExtendedNode = Tag_true >
-class Kd_tree {
-
-public:
-  typedef SearchTraits Traits;
-  typedef Splitter_ Splitter;
-  typedef typename SearchTraits::Point_d Point_d;
-  typedef typename Splitter::Container Point_container;
-
-  typedef typename SearchTraits::FT FT;
-  typedef Kd_tree_node<SearchTraits, Splitter, UseExtendedNode > Node;
-  typedef Kd_tree_leaf_node<SearchTraits, Splitter, UseExtendedNode > Leaf_node;
-  typedef Kd_tree_internal_node<SearchTraits, Splitter, UseExtendedNode > Internal_node;
-  typedef Kd_tree<SearchTraits, Splitter> Tree;
-  typedef Kd_tree<SearchTraits, Splitter,UseExtendedNode> Self;
-
-  typedef Node* Node_handle;
-  typedef const Node* Node_const_handle;
-  typedef Leaf_node* Leaf_node_handle;
-  typedef const Leaf_node* Leaf_node_const_handle;
-  typedef Internal_node* Internal_node_handle;
-  typedef const Internal_node* Internal_node_const_handle;
-  typedef typename std::vector<const Point_d*>::const_iterator Point_d_iterator;
-  typedef typename std::vector<const Point_d*>::const_iterator Point_d_const_iterator;
-  typedef typename Splitter::Separator Separator;
-  typedef typename std::vector<Point_d>::const_iterator iterator;
-  typedef typename std::vector<Point_d>::const_iterator const_iterator;
-
-  typedef typename std::vector<Point_d>::size_type size_type;
-
-  typedef typename internal::Get_dimension_tag<SearchTraits>::Dimension D;
-
-private:
-  SearchTraits traits_;
-  Splitter split;
-
-
-  // wokaround for https://svn.boost.org/trac/boost/ticket/9332
-#if   (_MSC_VER == 1800) && (BOOST_VERSION == 105500)
-  std::deque<Internal_node> internal_nodes;
-  std::deque<Leaf_node> leaf_nodes;
-#else
-  boost::container::deque<Internal_node> internal_nodes;
-  boost::container::deque<Leaf_node> leaf_nodes;
-#endif
-
-  Node_handle tree_root;
-
-  Kd_tree_rectangle<FT,D>* bbox;
-  std::vector<Point_d> pts;
-
-  // Instead of storing the points in arrays in the Kd_tree_node
-  // we put all the data in a vector in the Kd_tree.
-  // and we only store an iterator range in the Kd_tree_node.
-  //
-  std::vector<const Point_d*> data;
-
-
-  #ifdef CGAL_HAS_THREADS
-  mutable CGAL_MUTEX building_mutex;//mutex used to protect const calls inducing build()
-  #endif
-  bool built_;
-
-  // protected copy constructor
-  Kd_tree(const Tree& tree)
-    : traits_(tree.traits_),built_(tree.built_)
-  {};
-
-
-  // Instead of the recursive construction of the tree in the class Kd_tree_node
-  // we do this in the tree class. The advantage is that we then can optimize
-  // the allocation of the nodes.
-
-  // The leaf node
-  Node_handle
-  create_leaf_node(Point_container& c)
-  {
-    Leaf_node node(true , static_cast<unsigned int>(c.size()));
-    std::ptrdiff_t tmp = c.begin() - data.begin();
-    node.data = pts.begin() + tmp;
-
-    leaf_nodes.push_back(node);
-    Leaf_node_handle nh = &leaf_nodes.back();
-
-   
-    return nh;
-  }
-
-
-  // The internal node
-
-  Node_handle
-  create_internal_node(Point_container& c, const Tag_true&)
-  {
-    return create_internal_node_use_extension(c);
-  }
-
-  Node_handle
-  create_internal_node(Point_container& c, const Tag_false&)
-  {
-    return create_internal_node(c);
-  }
-
-
-
-  // TODO: Similiar to the leaf_init function above, a part of the code should be
-  //       moved to a the class Kd_tree_node.
-  //       It is not proper yet, but the goal was to see if there is
-  //       a potential performance gain through the Compact_container
-  Node_handle
-  create_internal_node_use_extension(Point_container& c)
-  {
-    Internal_node node(false);
-    internal_nodes.push_back(node);
-    Internal_node_handle nh = &internal_nodes.back();
-
-    Separator sep;
-    Point_container c_low(c.dimension(),traits_);
-    split(sep, c, c_low);
-    nh->set_separator(sep);
-
-    int cd  = nh->cutting_dimension();
-    if(!c_low.empty())
-      nh->low_val = c_low.tight_bounding_box().max_coord(cd);
-    else
-      nh->low_val = c_low.bounding_box().min_coord(cd);
-    if(!c.empty())
-      nh->high_val = c.tight_bounding_box().min_coord(cd);
-    else
-      nh->high_val = c.bounding_box().max_coord(cd);
-
-    CGAL_assertion(nh->cutting_value() >= nh->low_val);
-    CGAL_assertion(nh->cutting_value() <= nh->high_val);
-
-    if (c_low.size() > split.bucket_size()){
-      nh->lower_ch = create_internal_node_use_extension(c_low);
-    }else{
-      nh->lower_ch = create_leaf_node(c_low);
-    }
-    if (c.size() > split.bucket_size()){
-      nh->upper_ch = create_internal_node_use_extension(c);
-    }else{
-      nh->upper_ch = create_leaf_node(c);
-    }
-
-    
-    
-
-    return nh;
-  }
-
-
-  // Note also that I duplicated the code to get rid if the if's for
-  // the boolean use_extension which was constant over the construction
-  Node_handle
-  create_internal_node(Point_container& c)
-  {
-    Internal_node node(false);
-    internal_nodes.push_back(node);
-    Internal_node_handle nh = &internal_nodes.back();
-    Separator sep;
-
-    Point_container c_low(c.dimension(),traits_);
-    split(sep, c, c_low);
-    nh->set_separator(sep);
-
-    if (c_low.size() > split.bucket_size()){
-      nh->lower_ch = create_internal_node(c_low);
-    }else{
-      nh->lower_ch = create_leaf_node(c_low);
-    }
-    if (c.size() > split.bucket_size()){
-      nh->upper_ch = create_internal_node(c);
-    }else{
-      nh->upper_ch = create_leaf_node(c);
-    }
-
-   
-
-    return nh;
-  }
-
-
-
-public:
-
-  Kd_tree(Splitter s = Splitter(),const SearchTraits traits=SearchTraits())
-    : traits_(traits),split(s), built_(false)
-  {}
-
-  template <class InputIterator>
-  Kd_tree(InputIterator first, InputIterator beyond,
-	  Splitter s = Splitter(),const SearchTraits traits=SearchTraits())
-    : traits_(traits),split(s), built_(false)
-  {
-    pts.insert(pts.end(), first, beyond);
-  }
-
-  bool empty() const {
-    return pts.empty();
-  }
-
-  void
-  build()
-  {
-    const Point_d& p = *pts.begin();
-    typename SearchTraits::Construct_cartesian_const_iterator_d ccci=traits_.construct_cartesian_const_iterator_d_object();
-    int dim = static_cast<int>(std::distance(ccci(p), ccci(p,0)));
-
-    data.reserve(pts.size());
-    for(unsigned int i = 0; i < pts.size(); i++){
-      data.push_back(&pts[i]);
-    }
-    Point_container c(dim, data.begin(), data.end(),traits_);
-    bbox = new Kd_tree_rectangle<FT,D>(c.bounding_box());
-    if (c.size() <= split.bucket_size()){
-      tree_root = create_leaf_node(c);
-    }else {
-      tree_root = create_internal_node(c, UseExtendedNode());
-    }
-
-    //Reorder vector for spatial locality
-    std::vector<Point_d> ptstmp;
-    ptstmp.resize(pts.size());
-    for (std::size_t i = 0; i < pts.size(); ++i){
-      ptstmp[i] = *data[i];
-    }
-    for(std::size_t i = 0; i < leaf_nodes.size(); ++i){
-      std::ptrdiff_t tmp = leaf_nodes[i].begin() - pts.begin();
-      leaf_nodes[i].data = ptstmp.begin() + tmp;
-    }
-    pts.swap(ptstmp);
-
-    data.clear();
-
-    built_ = true;
-  }
-
-private:
-  //any call to this function is for the moment not threadsafe
-  void const_build() const {
-    #ifdef CGAL_HAS_THREADS
-    //this ensure that build() will be called once
-    CGAL_SCOPED_LOCK(building_mutex);
-    if(!is_built())
-    #endif
-      const_cast<Self*>(this)->build(); //THIS IS NOT THREADSAFE
-  }
-public:
-
-  bool is_built() const
-  {
-    return built_;
-  }
-
-  void invalidate_built()
-  {
-    if(is_built()){
-      internal_nodes.clear();
-      leaf_nodes.clear();
-      data.clear();
-      delete bbox;
-      built_ = false;
-    }
-  }
-
-  void clear()
-  {
-    invalidate_built();
-    pts.clear();
-  }
-
-  void
-  insert(const Point_d& p)
-  {
-    invalidate_built();
-    pts.push_back(p);
-  }
-
-  template <class InputIterator>
-  void
-  insert(InputIterator first, InputIterator beyond)
-  {
-    invalidate_built();
-    pts.insert(pts.end(),first, beyond);
-  }
-
-  //For efficiency; reserve the size of the points vectors in advance (if the number of points is already known).
-  void reserve(size_t size)
-  {
-    pts.reserve(size);
-  }
-
-  //Get the capacity of the underlying points vector.
-  size_t capacity()
-  {
-    return pts.capacity();
-  }
-
-
-  template <class OutputIterator, class FuzzyQueryItem>
-  OutputIterator
-  search(OutputIterator it, const FuzzyQueryItem& q) const
-  {
-    if(! pts.empty()){
-
-      if(! is_built()){
-	const_build();
-      }
-      Kd_tree_rectangle<FT,D> b(*bbox);
-      return tree_root->search(it,q,b);
-    }
-    return it;
-  }
-
-
-  template <class FuzzyQueryItem>
-  boost::optional<Point_d>
-  search_any_point(const FuzzyQueryItem& q) const
-  {
-    if(! pts.empty()){
-
-      if(! is_built()){
-	const_build();
-      }
-      Kd_tree_rectangle<FT,D> b(*bbox);
-      return tree_root->search_any_point(q,b);
-    }
-    return boost::none;
-  }
-
-
-  ~Kd_tree() {
-    if(is_built()){
-      delete bbox;
-    }
-  }
-
-
-  const SearchTraits&
-  traits() const
-  {
-    return traits_;
-  }
-
-  Node_const_handle
-  root() const
-  {
-    if(! is_built()){
-      const_build();
-    }
-    return tree_root;
-  }
-
-  Node_handle
-  root()
-  {
-    if(! is_built()){
-      build();
-    }
-    return tree_root;
-  }
-
-  void
-  print() const
-  {
-    if(! is_built()){
-      const_build();
-    }
-    root()->print();
-  }
-
-  const Kd_tree_rectangle<FT,D>&
-  bounding_box() const
-  {
-    if(! is_built()){
-      const_build();
-    }
-    return *bbox;
-  }
-
-  const_iterator
-  begin() const
-  {
-    return pts.begin();
-  }
-
-  const_iterator
-  end() const
-  {
-    return pts.end();
-  }
-
-  size_type
-  size() const
-  {
-    return pts.size();
-  }
-
-  // Print statistics of the tree.
-  std::ostream&
-  statistics(std::ostream& s) const
-  {
-    if(! is_built()){
-      const_build();
-    }
-    s << "Tree statistics:" << std::endl;
-    s << "Number of items stored: "
-      << root()->num_items() << std::endl;
-    s << "Number of nodes: "
-      << root()->num_nodes() << std::endl;
-    s << " Tree depth: " << root()->depth() << std::endl;
-    return s;
-  }
-
-
-};
-
-} // namespace CGAL
-
-#endif // CGAL_KD_TREE_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kd_tree_node.h b/3rdparty/CGAL-4.8/include/CGAL/Kd_tree_node.h
deleted file mode 100644
index 87f3b04..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Kd_tree_node.h
+++ /dev/null
@@ -1,551 +0,0 @@
-// Copyright (c) 2002,2011  Utrecht University (The Netherlands).
-// 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
-// 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$
-// 
-//
-// Authors       : Hans Tangelder (<hanst at cs.uu.nl>)
-
-#ifndef CGAL_KD_TREE_NODE_H
-#define CGAL_KD_TREE_NODE_H
-
-
-#include <CGAL/Splitters.h>
-#include <CGAL/Compact_container.h>
-#include <boost/cstdint.hpp>
-
-namespace CGAL {
-
-  template <class SearchTraits, class Splitter, class UseExtendedNode> 
-  class Kd_tree;
-
-  template < class TreeTraits, class Splitter, class UseExtendedNode > 
-  class Kd_tree_node {
-
-     friend class Kd_tree<TreeTraits,Splitter,UseExtendedNode>;
-
-    typedef typename Kd_tree<TreeTraits,Splitter,UseExtendedNode>::Node_handle Node_handle;
-    typedef typename Kd_tree<TreeTraits,Splitter,UseExtendedNode>::Node_const_handle Node_const_handle;
-     typedef typename Kd_tree<TreeTraits,Splitter,UseExtendedNode>::Internal_node_handle Internal_node_handle;
-    typedef typename Kd_tree<TreeTraits,Splitter,UseExtendedNode>::Internal_node_const_handle Internal_node_const_handle;
-     typedef typename Kd_tree<TreeTraits,Splitter,UseExtendedNode>::Leaf_node_handle Leaf_node_handle;
-    typedef typename Kd_tree<TreeTraits,Splitter,UseExtendedNode>::Leaf_node_const_handle Leaf_node_const_handle;
-    typedef typename TreeTraits::Point_d Point_d;
-
-    typedef typename TreeTraits::FT FT;
-    typedef typename Kd_tree<TreeTraits,Splitter,UseExtendedNode>::Separator Separator;
-    typedef typename Kd_tree<TreeTraits,Splitter,UseExtendedNode>::Point_d_iterator Point_d_iterator;
-    typedef typename Kd_tree<TreeTraits,Splitter,UseExtendedNode>::iterator iterator;
-    typedef typename Kd_tree<TreeTraits,Splitter,UseExtendedNode>::D D;
-
-    bool leaf;
-
-  public : 
-    Kd_tree_node(bool leaf_)
-      :leaf(leaf_){}
-
-    bool is_leaf() const{
-      return leaf;
-    }
-
-    std::size_t 
-    num_items() const
-    {
-      if (is_leaf()){
-        Leaf_node_const_handle node = 
-          static_cast<Leaf_node_const_handle>(this);
-        return node->size();
-      }
-      else {
-        Internal_node_const_handle node = 
-          static_cast<Internal_node_const_handle>(this);
-	return node->lower()->num_items() + node->upper()->num_items();
-      }
-    }
-
-    std::size_t
-    num_nodes() const
-    {
-      if (is_leaf()) return 1;
-      else {
-        Internal_node_const_handle node = 
-          static_cast<Internal_node_const_handle>(this);
-	return node->lower()->num_nodes() + node->upper()->num_nodes();
-      }
-    }
-
-    int 
-    depth(const int current_max_depth) const
-    {
-      if (is_leaf()){
-	return current_max_depth;
-      }
-      else {
-        Internal_node_const_handle node = 
-          static_cast<Internal_node_const_handle>(this);
-        return 
-	     (std::max)( node->lower()->depth(current_max_depth + 1),
-			 node->upper()->depth(current_max_depth + 1));
-      }
-    }
-
-    int 
-    depth() const
-    {
-      return depth(1); 
-    }
-
-    template <class OutputIterator>
-    OutputIterator 
-    tree_items(OutputIterator it) const {
-      if (is_leaf()) {
-         Leaf_node_const_handle node = 
-          static_cast<Leaf_node_const_handle>(this);
-	 if (node->size()>0) 
-	    for (iterator i=node->begin(); i != node->end(); i++) 
-	      {*it=*i; ++it;} 
-	}
-      else {
-         Internal_node_const_handle node = 
-          static_cast<Internal_node_const_handle>(this);
-	  it=node->lower()->tree_items(it);  
-	  it=node->upper()->tree_items(it); 
-      }
-      return it;
-    }
-
-
-    boost::optional<Point_d>
-    any_tree_item() const {
-      boost::optional<Point_d> result = boost::none;
-      if (is_leaf()) {
-         Leaf_node_const_handle node =
-          static_cast<Leaf_node_const_handle>(this);
-	 if (node->size()>0){
-           return boost::make_optional(*(node->begin()));
-         }
-	}
-      else {
-         Internal_node_const_handle node =
-          static_cast<Internal_node_const_handle>(this);
-	  result = node->lower()->any_tree_item();
-          if(! result){
-            result = node->upper()->any_tree_item();
-          }
-      }
-      return result;
-    }
-
-
-     void 
-    indent(int d) const
-    {
-      for(int i = 0; i < d; i++){
-	std::cout << " ";
-      }
-    }
-
-
-    void 
-    print(int d = 0) const 
-    {
-      if (is_leaf()) {
-        Leaf_node_const_handle node = 
-          static_cast<Leaf_node_const_handle>(this);
-	indent(d);
-	std::cout << "leaf" << std::endl;
-	if (node->size()>0)
-	  for (iterator i=node->begin(); i != node->end(); i++)
-	  {indent(d);std::cout << *i << std::endl;}
-      }
-      else {
-        Internal_node_const_handle node = 
-          static_cast<Internal_node_const_handle>(this);
-	indent(d);
-	std::cout << "lower tree" << std::endl;
-	node->lower()->print(d+1);
-	indent(d);
-	std::cout << "separator: dim = " << node->cutting_dimension() << "  val = " << node->cutting_value() << std::endl;
-	indent(d);
-	std::cout << "upper tree" << std::endl;
-	node->upper()->print(d+1); 
-      }
-    }
-
-
-    template <class OutputIterator, class FuzzyQueryItem>
-    OutputIterator 
-    search(OutputIterator it, const FuzzyQueryItem& q,
-	   Kd_tree_rectangle<FT,D>& b) const
-    {
-      if (is_leaf()) { 
-        Leaf_node_const_handle node = 
-          static_cast<Leaf_node_const_handle>(this);
-	if (node->size()>0) 
-	  for (iterator i=node->begin(); i != node->end(); i++) 
-	    if (q.contains(*i)) 
-	      {*it++=*i;}
-      }
-      else {
-         Internal_node_const_handle node = 
-          static_cast<Internal_node_const_handle>(this);
-	// after splitting b denotes the lower part of b
-	Kd_tree_rectangle<FT,D> b_upper(b);
-	b.split(b_upper, node->cutting_dimension(),
-		node->cutting_value());
-                             
-	if (q.outer_range_contains(b)) 	
-	  it=node->lower()->tree_items(it);
-	else
-	  if (q.inner_range_intersects(b)) 
-	    it=node->lower()->search(it,q,b);
-	if  (q.outer_range_contains(b_upper))     
-	  it=node->upper()->tree_items(it);
-	else
-	  if (q.inner_range_intersects(b_upper)) 
-	    it=node->upper()->search(it,q,b_upper);
-      };
-      return it;				
-    }
-
-
-    template <class FuzzyQueryItem>
-    boost::optional<Point_d>
-    search_any_point(const FuzzyQueryItem& q,
-                     Kd_tree_rectangle<FT,D>& b) const
-    {
-      boost::optional<Point_d> result = boost::none;
-      if (is_leaf()) { 
-        Leaf_node_const_handle node = 
-          static_cast<Leaf_node_const_handle>(this);
-	if (node->size()>0) 
-	  for (iterator i=node->begin(); i != node->end(); i++) 
-	    if (q.contains(*i)) 
-	      { result = boost::make_optional(*i);}
-      }
-      else {
-         Internal_node_const_handle node = 
-          static_cast<Internal_node_const_handle>(this);
-	// after splitting b denotes the lower part of b
-	Kd_tree_rectangle<FT,D> b_upper(b);
-	b.split(b_upper, node->cutting_dimension(),
-		node->cutting_value());
-                             
-	if (q.outer_range_contains(b)){ 	
-          result = node->lower()->any_tree_item();
-	}else{
-	  if (q.inner_range_intersects(b)){ 
-	    result = node->lower()->search_any_point(q,b);
-          }
-        }
-        if(result){
-          return result;
-        }
-	if  (q.outer_range_contains(b_upper)){     
-	  result = node->upper()->any_tree_item();
-	}else{
-	  if (q.inner_range_intersects(b_upper)) 
-	    result = node->upper()->search_any_point(q,b_upper);
-        }
-      }
-      return result;				
-    }
-
-  };
-
-
-  template < class TreeTraits, class Splitter, class UseExtendedNode > 
-  class Kd_tree_leaf_node : public Kd_tree_node< TreeTraits, Splitter, UseExtendedNode >{
-
-    friend class Kd_tree<TreeTraits,Splitter,UseExtendedNode>;
-    
-    typedef typename Kd_tree<TreeTraits,Splitter,UseExtendedNode>::iterator iterator;
-    typedef Kd_tree_node< TreeTraits, Splitter, UseExtendedNode> Base;
-    typedef typename TreeTraits::Point_d Point_d;
-
-  private:
-    
-    // private variables for leaf nodes
-    boost::int32_t n; // denotes number of items in a leaf node
-    iterator data; // iterator to data in leaf node
-
-                    
-  public:
-		
-    // default constructor
-    Kd_tree_leaf_node() 
-    {}
-
-    Kd_tree_leaf_node(bool leaf_ ) 
-      : Base(leaf_)
-    {}
-
-    Kd_tree_leaf_node(bool leaf_,unsigned int n_ ) 
-      : Base(leaf_), n(n_)
-    {}
-
-    // members for all nodes
-   
-    // members for leaf nodes only
-    inline 
-    unsigned int 
-    size() const 
-    { 
-      return n;
-    }
-  
-    inline 
-    iterator
-    begin() const  
-    {
-      return data;
-    }
-
-    inline 
-    iterator 
-    end() const 
-    {
-      return data + n;
-    }
- 
-  }; //leaf node
-
-
-
-  template < class TreeTraits, class Splitter, class UseExtendedNode> 
-  class Kd_tree_internal_node : public Kd_tree_node< TreeTraits, Splitter, UseExtendedNode >{
-
-    friend class Kd_tree<TreeTraits,Splitter,UseExtendedNode>;
-
-    typedef Kd_tree_node< TreeTraits, Splitter, UseExtendedNode> Base;
-    typedef typename Kd_tree<TreeTraits,Splitter,UseExtendedNode>::Node_handle Node_handle;
-    typedef typename Kd_tree<TreeTraits,Splitter,UseExtendedNode>::Node_const_handle Node_const_handle;
-
-    typedef typename TreeTraits::FT FT;
-    typedef typename Kd_tree<TreeTraits,Splitter,UseExtendedNode>::Separator Separator;
-
-  private:
-    
-       // private variables for internal nodes
-    boost::int32_t cut_dim;
-    FT cut_val;
-    Node_handle lower_ch, upper_ch;
-
-
-    // private variables for extended internal nodes
-    FT low_val;
-    FT high_val;
-                
-  public:
-
-    // default constructor
-    Kd_tree_internal_node() 
-    {}
-
-    Kd_tree_internal_node(bool leaf_) 
-      : Base(leaf_)
-    {}
-    
-    
-    // members for internal node and extended internal node
-
-    inline 
-    Node_const_handle 
-    lower() const 
-    {
-      return lower_ch; 
-    }
-
-    inline 
-    Node_const_handle 
-    upper() const 
-    {
-      return upper_ch; 
-    }
-
-    inline 
-    Node_handle 
-    lower()
-    {
-      return lower_ch; 
-    }
-
-    inline 
-    Node_handle 
-    upper()
-    {
-      return upper_ch; 
-    }
-  	
-    // inline Separator& separator() {return sep; }
-    // use instead
-    inline
-    void set_separator(Separator& sep){
-      cut_dim = sep.cutting_dimension();
-      cut_val = sep.cutting_value();
-    }
-  	
-    inline 
-    FT 
-    cutting_value() const 
-    {
-      return cut_val;
-    }
-  	
-    inline 
-    int 
-    cutting_dimension() const 
-    {
-      return cut_dim;
-    }
-
-    // members for extended internal node only
-    inline 
-    FT
-    low_value() const 
-    { 
-      return low_val; 
-    }
-    
-    inline 
-    FT
-    high_value() const 
-    {
-      return high_val; 
-    }
-       
-
-    /*Separator& 
-    separator() 
-    {
-      return Separator(cutting_dimension,cutting_value);
-    }*/
-	
-
-  };//internal node
-
- template < class TreeTraits, class Splitter> 
- class Kd_tree_internal_node<TreeTraits,Splitter,Tag_false> : public Kd_tree_node< TreeTraits, Splitter, Tag_false >{
-
-    friend class Kd_tree<TreeTraits,Splitter,Tag_false>;
-
-    typedef Kd_tree_node< TreeTraits, Splitter, Tag_false> Base;
-    typedef typename Kd_tree<TreeTraits,Splitter,Tag_false>::Node_handle Node_handle;
-    typedef typename Kd_tree<TreeTraits,Splitter,Tag_false>::Node_const_handle Node_const_handle;
-
-    typedef typename TreeTraits::FT FT;
-    typedef typename Kd_tree<TreeTraits,Splitter,Tag_false>::Separator Separator;
-
-  private:
-    
-       // private variables for internal nodes
-    boost::uint8_t cut_dim;
-    FT cut_val;
-
-    Node_handle lower_ch, upper_ch;
-                
-  public:
-
-    // default constructor
-    Kd_tree_internal_node() 
-    {}
-
-    Kd_tree_internal_node(bool leaf_) 
-      : Base(leaf_)
-    {}
-    
-    
-    // members for internal node and extended internal node
-
-    inline 
-    Node_const_handle 
-    lower() const 
-    {
-      return lower_ch; 
-    }
-
-    inline 
-    Node_const_handle 
-    upper() const 
-    {
-      return upper_ch; 
-    }
-
-    inline 
-    Node_handle 
-    lower()
-    {
-      return lower_ch; 
-    }
-
-    inline 
-    Node_handle 
-    upper()
-    {
-      return upper_ch; 
-    }
-  	
-    // inline Separator& separator() {return sep; }
-    // use instead
-
-    inline
-    void set_separator(Separator& sep){
-      cut_dim = sep.cutting_dimension();
-      cut_val = sep.cutting_value();
-    }
-  	
-    inline 
-    FT 
-    cutting_value() const 
-    {
-      return cut_val;
-    }
-  	
-    inline 
-    int 
-    cutting_dimension() const 
-    {
-      return cut_dim;
-    }
-
-    // members for extended internal node only
-    inline 
-    FT
-    low_value() const 
-    { 
-      return this->low_val;
-    }
-    
-    inline 
-    FT
-    high_value() const 
-    {
-      return this->high_val;
-    }
-       
-
-   /* Separator& 
-    separator() 
-    {
-      return Separator(cutting_dimension,cutting_value);
-    }*/
-	
-
-  };//internal node
-
-
-
-} // namespace CGAL
-#endif // CGAL_KDTREE_NODE_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel/global_functions_2.h b/3rdparty/CGAL-4.8/include/CGAL/Kernel/global_functions_2.h
deleted file mode 100644
index 72256da..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Kernel/global_functions_2.h
+++ /dev/null
@@ -1,1026 +0,0 @@
-// Copyright (c) 2003-2004  
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved. 
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Sylvain Pion
- 
-#ifndef CGAL_KERNEL_GLOBAL_FUNCTIONS_2_H
-#define CGAL_KERNEL_GLOBAL_FUNCTIONS_2_H
-
-// Generic functions taking "user classes" as parameters, calling the
-// internal functions (in *_internal*.h, namespace internal) taking a kernel as
-// additional parameter, which themselves call the corresponding kernel
-// functors.
-
-#include <CGAL/user_classes.h>
-#include <CGAL/Kernel/global_functions_internal_2.h>
-#include <CGAL/Kernel/mpl.h>
-
-namespace CGAL {
-
-template < class K >
-typename K::Boolean
-operator==(const Point_2<K> &p, const Origin& o)
-{
-  return p == Point_2<K>(o);
-}
-
-template < class K >
-typename K::Boolean
-operator!=(const Point_2<K> &p, const Origin& o)
-{
-  return p != Point_2<K>(o);
-}
-
-template < class K >
-inline
-Angle
-angle(const Vector_2<K> &u,
-      const Vector_2<K> &v)
-{
-  return internal::angle(u, v, K());
-}
-
-template < class K >
-inline
-Angle
-angle(const Point_2<K> &p,
-      const Point_2<K> &q,
-      const Point_2<K> &r)
-{
-  return internal::angle(p, q, r, K());
-}
-
-template < class K >
-inline
-Angle
-angle(const Point_2<K> &p,
-      const Point_2<K> &q,
-      const Point_2<K> &r,
-      const Point_2<K> &s)
-{
-  return internal::angle(p, q, r, s, K());
-}
-
-template < class K >
-inline
-typename K::Boolean
-are_ordered_along_line(const Point_2<K> &p,
-                       const Point_2<K> &q,
-                       const Point_2<K> &r)
-{
-  return internal::are_ordered_along_line(p, q, r, K());
-}
-
-template < class K >
-inline
-typename K::Boolean
-are_strictly_ordered_along_line(const Point_2<K> &p,
-                                const Point_2<K> &q,
-                                const Point_2<K> &r)
-{
-  return internal::are_strictly_ordered_along_line(p, q, r, K());
-}
-
-template < class K >
-inline
-typename K::FT
-area(const Point_2<K> &p, const Point_2<K> &q, const Point_2<K> &r)
-{
-  return internal::area(p, q, r, K());
-}
-
-template < class K >
-inline
-typename K::Point_2
-barycenter(const Point_2<K> &p1, const typename K::FT& w1,
-           const Point_2<K> &p2)
-{
-  return internal::barycenter(p1, w1, p2, K());
-}
-
-template < class K >
-inline
-typename K::Point_2
-barycenter(const Point_2<K> &p1, const typename K::FT& w1,
-           const Point_2<K> &p2, const typename K::FT& w2)
-{
-  return internal::barycenter(p1, w1, p2, w2, K());
-}
-
-template < class K >
-inline
-typename K::Point_2
-barycenter(const Point_2<K> &p1, const typename K::FT& w1,
-           const Point_2<K> &p2, const typename K::FT& w2,
-           const Point_2<K> &p3)
-{
-  return internal::barycenter(p1, w1, p2, w2, p3, K());
-}
-
-template < class K >
-inline
-typename K::Point_2
-barycenter(const Point_2<K> &p1, const typename K::FT& w1,
-           const Point_2<K> &p2, const typename K::FT& w2,
-           const Point_2<K> &p3, const typename K::FT& w3)
-{
-  return internal::barycenter(p1, w1, p2, w2, p3, w3, K());
-}
-
-template < class K >
-inline
-typename K::Point_2
-barycenter(const Point_2<K> &p1, const typename K::FT& w1,
-           const Point_2<K> &p2, const typename K::FT& w2,
-           const Point_2<K> &p3, const typename K::FT& w3,
-           const Point_2<K> &p4)
-{
-  return internal::barycenter(p1, w1, p2, w2, p3, w3, p4, K());
-}
-
-template < class K >
-inline
-typename K::Point_2
-barycenter(const Point_2<K> &p1, const typename K::FT& w1,
-           const Point_2<K> &p2, const typename K::FT& w2,
-           const Point_2<K> &p3, const typename K::FT& w3,
-           const Point_2<K> &p4, const typename K::FT& w4)
-{
-  return internal::barycenter(p1, w1, p2, w2, p3, w3, p4, w4, K());
-}
-
-template <typename K>
-inline
-typename K::Line_2
-bisector(const Point_2<K> &p, const Point_2<K> &q)
-{
-  return internal::bisector(p, q, K());
-}
-
-template <typename K>
-inline
-typename K::Line_2
-bisector(const Line_2<K> &l1, const Line_2<K> &l2)
-{
-  return internal::bisector(l1, l2, K());
-}
-
-template < class K >
-inline
-typename K::Point_2
-centroid(const Point_2<K> &p,
-         const Point_2<K> &q,
-         const Point_2<K> &r)
-{
-  return internal::centroid(p, q, r, K());
-}
-
-template < class K >
-inline
-typename K::Point_2
-centroid(const Triangle_2<K> &t)
-{
-  return internal::centroid(t, K());
-}
-
-template < class K >
-inline
-typename K::Point_2
-centroid(const Point_2<K> &p,
-         const Point_2<K> &q,
-         const Point_2<K> &r,
-         const Point_2<K> &s)
-{
-  return internal::centroid(p, q, r, s, K());
-}
-
-template < class K >
-inline
-typename K::Point_2
-circumcenter(const Point_2<K> &p,
-             const Point_2<K> &q)
-{
-  return internal::circumcenter(p, q, K());
-}
-
-template < class K >
-inline
-typename K::Point_2
-circumcenter(const Point_2<K> &p,
-             const Point_2<K> &q,
-             const Point_2<K> &r)
-{
-  return internal::circumcenter(p, q, r, K());
-}
-
-template < class K >
-inline
-typename K::Point_2
-circumcenter(const Triangle_2<K> &t)
-{
-  return internal::circumcenter(t, K());
-}
-
-template < class K >
-inline
-typename K::Boolean
-collinear(const Point_2<K> &p, const Point_2<K> &q, const Point_2<K> &r)
-{
-  return internal::collinear(p, q, r, K());
-}
-
-template < class K >
-inline
-typename K::Boolean
-collinear_are_ordered_along_line(const Point_2<K> &p,
-                                 const Point_2<K> &q,
-                                 const Point_2<K> &r)
-{
-  return internal::collinear_are_ordered_along_line(p, q, r, K());
-}
-
-template < class K >
-inline
-typename K::Boolean
-collinear_are_strictly_ordered_along_line(const Point_2<K> &p,
-                                          const Point_2<K> &q,
-                                          const Point_2<K> &r)
-{
-  return internal::collinear_are_strictly_ordered_along_line(p, q, r, K());
-}
-
-template < typename K >
-inline
-typename K::Comparison_result
-compare_angle_with_x_axis(const Direction_2<K>& d1,
-                          const Direction_2<K>& d2)
-{
-  return internal::compare_angle_with_x_axis(d1, d2, K());
-}
-
-template <class K >
-inline
-typename K::Comparison_result
-compare_distance_to_point(const Point_2<K>& p,
-                          const Point_2<K>& q,
-                          const Point_2<K>& r)
-{
-  return internal::compare_distance_to_point(p, q, r, K());
-}
-
-template <class K >
-inline
-typename K::Comparison_result
-compare_squared_distance(const Point_2<K>& p,
-                         const Point_2<K>& q,
-                         const typename K::FT& d2)
-{
-  return internal::compare_squared_distance(p, q, d2, K());
-}
-
-template <class K>
-inline
-typename K::Comparison_result
-compare_signed_distance_to_line(const Point_2<K>& p,
-				const Point_2<K>& q,
-				const Point_2<K>& r,
-				const Point_2<K>& s)
-{
-  return internal::compare_signed_distance_to_line(p, q, r, s, K());
-}
-
-template <class K>
-inline
-typename K::Comparison_result
-compare_signed_distance_to_line(const Line_2<K>& l,
-				const Point_2<K>& p,
-				const Point_2<K>& q)
-{
-  return internal::compare_signed_distance_to_line(l, p, q, K());
-}
-
-/* FIXME : Undocumented, obsolete...
-template < class K >
-inline
-typename K::Comparison_result
-compare_lexicographically_xy(const Point_2<K> &p,
-                             const Point_2<K> &q)
-{
-  return K().compare_xy_2_object()(p, q);
-}
-*/
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_slopes(const Line_2<K> &l1, const Line_2<K> &l2)
-{
-  return internal::compare_slopes(l1, l2, K());
-}
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_slopes(const Segment_2<K> &s1, const Segment_2<K> &s2)
-{
-  return internal::compare_slopes(s1, s2, K());
-}
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_x(const Point_2<K> &p, const Point_2<K> &q)
-{
-  return internal::compare_x(p, q, K());
-}
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_x(const Point_2<K>& p,
-          const Line_2<K>& l1,
-          const Line_2<K>& l2)
-{
-  return internal::compare_x(p, l1, l2, K());
-}
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_x(const Line_2<K> &l,
-          const Line_2<K> &h1,
-          const Line_2<K> &h2)
-{
-  return internal::compare_x(l, h1, h2, K());
-}
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_x(const Line_2<K> &l1,
-          const Line_2<K> &h1,
-          const Line_2<K> &l2,
-          const Line_2<K> &h2)
-{
-  return internal::compare_x(l1, h1, l2, h2, K());
-}
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_x_at_y(const Point_2<K>& p, const Line_2<K>& h)
-{
-  return internal::compare_x_at_y(p, h, K());
-}
-
-/* Undocumented
-template < class K >
-inline
-typename K::Comparison_result
-compare_x_at_y(const Point_2<K>& p, const Segment_2<K>& s)
-{
-  return internal::compare_x_at_y(p, s, K());
-}
-*/
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_x_at_y(const Point_2<K> &p,
-               const Line_2<K> &h1,
-               const Line_2<K> &h2)
-{
-  return internal::compare_x_at_y(p, h1, h2, K());
-}
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_x_at_y(const Line_2<K> &l1,
-               const Line_2<K> &l2,
-               const Line_2<K> &h)
-{
-  return internal::compare_x_at_y(l1, l2, h, K());
-}
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_x_at_y(const Line_2<K> &l1,
-               const Line_2<K> &l2,
-               const Line_2<K> &h1,
-               const Line_2<K> &h2)
-{
-  return internal::compare_x_at_y(l1, l2, h1, h2, K());
-}
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_xy(const Point_2<K> &p, const Point_2<K> &q)
-{
-  return internal::compare_xy(p, q, K());
-}
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_lexicographically(const Point_2<K> &p, const Point_2<K> &q)
-{
-  return internal::compare_xy(p, q, K());
-}
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_y(const Point_2<K> &p, const Point_2<K> &q)
-{
-  return internal::compare_y(p, q, K());
-}
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_y(const Point_2<K> &p,
-          const Line_2<K> &l1,
-          const Line_2<K> &l2)
-{
-  return internal::compare_y(p, l1, l2, K());
-}
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_y(const Line_2<K> &l1,
-          const Line_2<K> &l2,
-          const Line_2<K> &h1,
-          const Line_2<K> &h2)
-{
-  return internal::compare_y(l1, l2, h1, h2, K());
-}
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_y(const Line_2<K> &l,
-          const Line_2<K> &h1,
-          const Line_2<K> &h2)
-{
-  return internal::compare_y(l, h1, h2, K());
-}
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_y_at_x(const Point_2<K> &p, const Segment_2<K> &s)
-{
-  return internal::compare_y_at_x(p, s, K());
-}
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_y_at_x(const Point_2<K> &p,
-               const Segment_2<K> &s1,
-               const Segment_2<K> &s2)
-{
-  return internal::compare_y_at_x(p, s1, s2, K());
-}
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_y_at_x(const Point_2<K> &p, const Line_2<K> &h)
-{
-  return internal::compare_y_at_x(p, h, K());
-}  
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_y_at_x(const Point_2<K> &p,
-               const Line_2<K> &h1,
-               const Line_2<K> &h2)
-{
-  return internal::compare_y_at_x(p, h1, h2, K());
-}
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_y_at_x(const Line_2<K> &l1,
-               const Line_2<K> &l2,
-               const Line_2<K> &h)
-{
-  return internal::compare_y_at_x(l1, l2, h, K());
-}
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_y_at_x(const Line_2<K> &l1,
-               const Line_2<K> &l2,
-               const Line_2<K> &h1,
-               const Line_2<K> &h2)
-{
-  return internal::compare_y_at_x(l1, l2, h1, h2, K());
-}
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_yx(const Point_2<K> &p, const Point_2<K> &q)
-{
-  return internal::compare_yx(p, q, K());
-}
-
-template < class K >
-inline
-typename K::FT
-determinant(const Vector_2<K> &v0, const Vector_2<K> &v1)
-{
-  return internal::determinant(v0, v1, K());
-}
-
-template <class K>
-inline
-typename K::Boolean
-has_larger_distance_to_point(const Point_2<K>& p,
-			     const Point_2<K>& q,
-			     const Point_2<K>& r)
-{
-  return internal::has_larger_distance_to_point(p, q, r, K());
-}
-
-template <class K>
-inline
-typename K::Boolean
-has_smaller_distance_to_point(const Point_2<K>& p,
-                              const Point_2<K>& q,
-                              const Point_2<K>& r)
-{
-  return internal::has_smaller_distance_to_point(p, q, r, K());
-}
-
-template <class K>
-inline
-typename K::Boolean
-has_smaller_signed_distance_to_line(const Line_2<K>& l,
-                                    const Point_2<K>& p,
-                                    const Point_2<K>& q)
-{
-  return internal::has_smaller_signed_distance_to_line(l, p, q, K());
-}
-
-template <class K>
-inline
-typename K::Boolean
-has_larger_signed_distance_to_line(const Line_2<K>& l,
-				   const Point_2<K>& p,
-				   const Point_2<K>& q)
-{
-  return internal::has_larger_signed_distance_to_line(l, p, q, K());
-}
-
-template <class K>
-inline
-typename K::Boolean
-has_larger_signed_distance_to_line(const Point_2<K>& p,
-				   const Point_2<K>& q,
-				   const Point_2<K>& r,
-				   const Point_2<K>& s)
-{
-  return internal::has_larger_signed_distance_to_line(p, q, r, s, K());
-}
-
-template <class K>
-inline
-typename K::Boolean
-has_smaller_signed_distance_to_line(const Point_2<K>& p,
-                                    const Point_2<K>& q,
-                                    const Point_2<K>& r,
-                                    const Point_2<K>& s)
-{
-  return internal::has_smaller_signed_distance_to_line(p, q, r, s, K());
-}
-
-template < class K >
-inline
-typename K::Boolean
-left_turn(const Point_2<K> &p, const Point_2<K> &q, const Point_2<K> &r)
-{
-  return internal::left_turn(p, q, r, K());
-}
-
-template < class K >
-inline
-typename K::Boolean
-less_x(const Point_2<K> &p, const Point_2<K> &q)
-{
-  return internal::less_x(p, q, K());
-}
-
-template < class K >
-inline
-typename K::Boolean
-less_y(const Point_2<K> &p, const Point_2<K> &q)
-{
-  return internal::less_y(p, q, K());
-}
-
-template < class K >
-inline
-typename K::Boolean
-lexicographically_xy_larger(const Point_2<K> &p, const Point_2<K> &q)
-{
-  return internal::lexicographically_xy_larger(p, q, K());
-}
-
-template < class K >
-inline
-typename K::Boolean
-lexicographically_xy_larger_or_equal(const Point_2<K> &p, const Point_2<K> &q)
-{
-  return internal::lexicographically_xy_larger_or_equal(p, q, K());
-}
-
-template < class K >
-inline
-typename K::Boolean
-lexicographically_xy_smaller(const Point_2<K> &p, const Point_2<K> &q)
-{
-  return internal::lexicographically_xy_smaller(p, q, K());
-}
-
-template < class K >
-inline
-typename K::Boolean
-lexicographically_xy_smaller_or_equal(const Point_2<K> &p,
-                                      const Point_2<K> &q)
-{
-  return internal::lexicographically_xy_smaller_or_equal(p, q, K());
-}
-
-template < class K >
-inline
-typename K::Boolean
-lexicographically_yx_smaller(const Point_2<K> &p, const Point_2<K> &q)
-{
-  return internal::lexicographically_yx_smaller(p, q, K());
-}
-
-template < class K >
-inline
-typename K::Boolean
-lexicographically_yx_smaller_or_equal(const Point_2<K> &p, const Point_2<K> &q)
-{
-  return internal::lexicographically_yx_smaller_or_equal(p, q, K());
-}
-
-// FIXME : Undocumented
-template < class K >
-inline
-typename K::Boolean
-lexicographically_yx_larger(const Point_2<K> &p, const Point_2<K> &q)
-{
-  return internal::lexicographically_yx_larger(p, q, K());
-}
-
-// FIXME : Undocumented
-template < class K >
-inline
-typename K::Boolean
-lexicographically_yx_larger_or_equal(const Point_2<K> &p, const Point_2<K> &q)
-{
-  return internal::lexicographically_yx_larger_or_equal(p, q, K());
-}
-
-template < class K >
-inline
-typename K::Point_2
-midpoint(const Point_2<K> &p, const Point_2<K> &q)
-{
-  return internal::midpoint(p, q, K());
-}
-
-template < class K >
-inline
-typename K::Point_2
-max_vertex(const Iso_rectangle_2<K> &ir)
-{
-  return internal::max_vertex(ir, K());
-}
-
-template < class K >
-inline
-typename K::Point_2
-min_vertex(const Iso_rectangle_2<K> &ir)
-{
-  return internal::min_vertex(ir, K());
-}
-
-// FIXME TODO : What do we do with the operators ?
-// They have no counter part with the kernel argument...
-template < class K >
-inline
-typename K::Boolean
-operator<(const Direction_2<K>& d1, const Direction_2<K>& d2)
-{ return compare_angle_with_x_axis(d1, d2) == SMALLER; }
-
-template < class K >
-inline
-typename K::Boolean
-operator>(const Direction_2<K>& d1, const Direction_2<K>& d2)
-{ return compare_angle_with_x_axis(d1, d2) == LARGER; }
-
-template < class K >
-inline
-typename K::Boolean
-operator>=(const Direction_2<K>& d1, const Direction_2<K>& d2)
-{ return compare_angle_with_x_axis(d1, d2) != SMALLER; }
-
-template < class K >
-inline
-typename K::Boolean
-operator<=(const Direction_2<K>& d1, const Direction_2<K>& d2)
-{ return compare_angle_with_x_axis(d1, d2) != LARGER; }
-
-template < class K >
-inline
-typename K::Boolean
-operator==(const Point_2<K>& p, const Point_2<K>& q)
-{ return K().equal_2_object()(p, q); }
-
-template < class K >
-inline
-typename K::Boolean
-operator!=(const Point_2<K>& p, const Point_2<K>& q)
-{ return ! (p == q); }
-
-template < class K >
-inline
-typename K::Boolean
-operator<(const Point_2<K>& p, const Point_2<K>& q)
-{ return K().less_xy_2_object()(p, q); }
-
-template < class K >
-inline
-typename K::Boolean
-operator>(const Point_2<K>& p, const Point_2<K>& q)
-{ return K().less_xy_2_object()(q, p); }
-
-template < class K >
-inline
-typename K::Boolean
-operator<=(const Point_2<K>& p, const Point_2<K>& q)
-{ return ! K().less_xy_2_object()(q, p); }
-
-template < class K >
-inline
-typename K::Boolean
-operator>=(const Point_2<K>& p, const Point_2<K>& q)
-{ return ! K().less_xy_2_object()(p, q); }
-
-template < class K >
-inline
-typename K::Boolean
-operator==(const Vector_2<K>& v, const Vector_2<K>& w)
-{ return K().equal_2_object()(v, w); }
-
-template < class K >
-inline
-typename K::Boolean
-operator!=(const Vector_2<K>& v, const Vector_2<K>& w)
-{ return ! (v == w); }
-
-template < class K >
-inline
-typename K::Vector_2
-operator*(const typename K::FT &c, const Vector_2<K> &w)
-{
-  return K().construct_scaled_vector_2_object()(w, c);
-}
-
-template < class K >
-inline
-typename K::Vector_2
-operator*(const Vector_2<K> &w, const typename K::FT &c)
-{
-  return K().construct_scaled_vector_2_object()(w, c);
-}
-
-template < class K >
-inline
-typename K::Vector_2
-operator*(const typename First_if_different<typename K::RT,
-                                            typename K::FT>::Type &c,
-          const Vector_2<K> &w)
-{
-  return K().construct_scaled_vector_2_object()(w, c);
-}
-
-template < class K >
-inline
-typename K::Vector_2
-operator*(const Vector_2<K> &w,
-          const typename First_if_different<typename K::RT,
-                                            typename K::FT>::Type &c)
-{
-  return K().construct_scaled_vector_2_object()(w, c);
-}
-
-template < class K >
-inline
-typename K::FT
-operator*(const Vector_2<K> &v, const Vector_2<K> &w)
-{
-  return K().compute_scalar_product_2_object()(v, w);
-}
-
-template < class K >
-inline
-typename K::Point_2
-operator+(const Point_2<K> &p, const Vector_2<K> &v)
-{
-  return K().construct_translated_point_2_object()(p, v);
-}
-
-template < class K >
-inline
-typename K::Point_2
-operator+(const Origin &o, const Vector_2<K> &v)
-{
-  return K().construct_translated_point_2_object()(o, v);
-}
-
-template < class K >
-inline
-typename K::Point_2
-operator-(const Point_2<K> &p, const Vector_2<K> &v)
-{
-  return K().construct_translated_point_2_object()
-                (p, K().construct_opposite_vector_2_object()(v));
-}
-
-template < class K >
-inline
-typename K::Point_2
-operator-(const Origin &o, const Vector_2<K> &v)
-{
-  return K().construct_translated_point_2_object()
-               (o, K().construct_opposite_vector_2_object()(v));
-}
-
-template < class K >
-inline
-typename K::Vector_2
-operator-(const Point_2<K> &p, const Point_2<K> &q)
-{
-  return K().construct_vector_2_object()(q, p);
-}
-
-template < class K >
-inline
-typename K::Vector_2
-operator-(const Point_2<K> &p, const Origin &o)
-{
-  return K().construct_vector_2_object()(o, p);
-}
-
-template < class K >
-inline
-typename K::Vector_2
-operator-(const Origin &o, const Point_2<K> &q)
-{
-  return K().construct_vector_2_object()(q, o);
-}
-
-template <typename K>
-inline
-typename K::Orientation
-orientation(const Point_2<K> &p, const Point_2<K> &q, const Point_2<K> &r)
-{
-  return internal::orientation(p, q, r, K());
-}
-
-template <typename K>
-inline
-typename K::Orientation
-orientation(const Vector_2<K> &u, const Vector_2<K> &v)
-{
-  return internal::orientation(u, v, K());
-}
-
-// parallel() functions are in global_functions.h
-
-template <class K>
-inline
-typename K::Line_2
-radical_line(const Circle_2<K> &s1,
-              const Circle_2<K> &s2)
-{
-  return K().construct_radical_line_2_object()(s1,s2);
-}
-
-template <typename K>
-inline
-typename K::Boolean
-right_turn(const Point_2<K> &p, const Point_2<K> &q, const Point_2<K> &r)
-{
-  return internal::right_turn(p, q, r, K());
-}
-
-template <class K>
-inline
-typename K::Bounded_side
-side_of_bounded_circle(const Point_2<K> &p,
-                       const Point_2<K> &q,
-                       const Point_2<K> &r,
-                       const Point_2<K> &t)
-{
-  return internal::side_of_bounded_circle(p, q, r, t, K());
-}
-
-template <class K>
-inline
-typename K::Bounded_side
-side_of_bounded_circle(const Point_2<K> &p,
-                       const Point_2<K> &q,
-                       const Point_2<K> &r)
-{
-  return internal::side_of_bounded_circle(p, q, r, K());
-}
-
-template <class K>
-inline
-typename K::Oriented_side
-side_of_oriented_circle(const Point_2<K> &p,
-                        const Point_2<K> &q,
-                        const Point_2<K> &r,
-                        const Point_2<K> &t)
-{
-  return internal::side_of_oriented_circle(p, q, r, t, K());
-}
-
-template < class K >
-inline
-typename K::FT
-squared_radius(const Point_2<K> &p)
-{
-  return internal::squared_radius(p, K());
-}
-
-template < class K >
-inline
-typename K::FT
-squared_radius(const Point_2<K> &p, const Point_2<K> &q)
-{
-  return internal::squared_radius(p, q, K());
-}
-
-template < class K >
-CGAL_KERNEL_INLINE
-typename K::FT
-squared_radius(const Point_2<K>& p, const Point_2<K>& q, const Point_2<K>& r)
-{
-  return internal::squared_radius(p, q, r, K());
-}
-
-template < class K >
-inline
-typename K::Boolean
-x_equal(const Point_2<K> &p, const Point_2<K> &q)
-{
-  return internal::x_equal(p, q, K());
-}
-
-template < class K >
-inline
-typename K::Boolean
-y_equal(const Point_2<K> &p, const Point_2<K> &q)
-{
-  return internal::y_equal(p, q, K());
-}
-
-} //namespace CGAL
-
-#endif  // CGAL_KERNEL_GLOBAL_FUNCTIONS_2_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel/global_functions_3.h b/3rdparty/CGAL-4.8/include/CGAL/Kernel/global_functions_3.h
deleted file mode 100644
index 4f1112a..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Kernel/global_functions_3.h
+++ /dev/null
@@ -1,1126 +0,0 @@
-// Copyright (c) 2003-2004  
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved. 
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Sylvain Pion
- 
-#ifndef CGAL_KERNEL_GLOBAL_FUNCTIONS_3_H
-#define CGAL_KERNEL_GLOBAL_FUNCTIONS_3_H
-
-#include <CGAL/user_classes.h>
-#include <CGAL/Kernel/global_functions_internal_3.h>
-#include <CGAL/Kernel/mpl.h>
-
-// Generic functions calling the kernel functor.
-// See comments in CGAL/Kernel/global_functions_2.h.
-
-namespace CGAL {
-
-template <typename K>
-inline
-Angle
-angle(const Vector_3<K> &u, const Vector_3<K> &v)
-{
-  return internal::angle(u, v, K());
-}
-
-template <typename K>
-inline
-Angle
-angle(const Point_3<K> &p, const Point_3<K> &q, const Point_3<K> &r)
-{
-  return internal::angle(p, q, r, K());
-}
-
-template <typename K>
-inline
-Angle
-angle(const Point_3<K> &p, const Point_3<K> &q,
-      const Point_3<K> &r, const Point_3<K> &s)
-{
-  return internal::angle(p, q, r, s, K());
-}
-
-template < typename K >
-inline
-typename K::Boolean
-are_negative_oriented(const Point_3<K>& p, const Point_3<K>& q,
-                      const Point_3<K>& r, const Point_3<K>& s)
-{
-  return internal::are_negative_oriented(p, q, r, s, K());
-}
-
-template < class K >
-inline
-typename K::Boolean
-are_ordered_along_line(const Point_3<K> &p,
-                       const Point_3<K> &q,
-                       const Point_3<K> &r)
-{
-  return internal::are_ordered_along_line(p, q, r, K());
-}
-
-template < typename K >
-inline
-typename K::Boolean
-are_positive_oriented(const Point_3<K>& p, const Point_3<K>& q,
-                      const Point_3<K>& r, const Point_3<K>& s)
-{
-  return internal::are_positive_oriented(p, q, r, s, K());
-}
-
-template < class K >
-inline
-typename K::Boolean
-are_strictly_ordered_along_line(const Point_3<K> &p,
-                                const Point_3<K> &q,
-                                const Point_3<K> &r)
-{
-  return internal::are_strictly_ordered_along_line(p, q, r, K());
-}
-
-template < class K >
-inline
-typename K::Point_3
-barycenter(const Point_3<K> &p1, const typename K::FT& w1,
-           const Point_3<K> &p2)
-{
-  return internal::barycenter(p1, w1, p2, K());
-}
-
-template < class K >
-inline
-typename K::Point_3
-barycenter(const Point_3<K> &p1, const typename K::FT& w1,
-           const Point_3<K> &p2, const typename K::FT& w2)
-{
-  return internal::barycenter(p1, w1, p2, w2, K());
-}
-
-template < class K >
-inline
-typename K::Point_3
-barycenter(const Point_3<K> &p1, const typename K::FT& w1,
-           const Point_3<K> &p2, const typename K::FT& w2,
-           const Point_3<K> &p3)
-{
-  return internal::barycenter(p1, w1, p2, w2, p3, K());
-}
-
-template < class K >
-inline
-typename K::Point_3
-barycenter(const Point_3<K> &p1, const typename K::FT& w1,
-           const Point_3<K> &p2, const typename K::FT& w2,
-           const Point_3<K> &p3, const typename K::FT& w3)
-{
-  return internal::barycenter(p1, w1, p2, w2, p3, w3, K());
-}
-
-template < class K >
-inline
-typename K::Point_3
-barycenter(const Point_3<K> &p1, const typename K::FT& w1,
-           const Point_3<K> &p2, const typename K::FT& w2,
-           const Point_3<K> &p3, const typename K::FT& w3,
-           const Point_3<K> &p4)
-{
-  return internal::barycenter(p1, w1, p2, w2, p3, w3, p4, K());
-}
-
-template < class K >
-inline
-typename K::Point_3
-barycenter(const Point_3<K> &p1, const typename K::FT& w1,
-           const Point_3<K> &p2, const typename K::FT& w2,
-           const Point_3<K> &p3, const typename K::FT& w3,
-           const Point_3<K> &p4, const typename K::FT& w4)
-{
-  return internal::barycenter(p1, w1, p2, w2, p3, w3, p4, w4, K());
-}
-
-template <typename K>
-inline
-typename K::Plane_3
-bisector(const Point_3<K> &p, const Point_3<K> &q)
-{
-  return internal::bisector(p, q, K());
-}
-
-template <typename K>
-inline
-typename K::Plane_3
-bisector(const Plane_3<K> &h1, const Plane_3<K> &h2)
-{
-  return internal::bisector(h1, h2, K());
-}
-
-template < class K >
-inline
-Point_3<K>
-centroid(const Point_3<K> &p, const Point_3<K> &q,
-         const Point_3<K> &r, const Point_3<K> &s)
-{
-  return internal::centroid(p, q, r, s, K());
-}
-
-template < class K >
-inline
-Point_3<K>
-centroid(const Point_3<K> &p, const Point_3<K> &q, const Point_3<K> &r)
-{
-  return internal::centroid(p, q, r, K());
-}
-
-template < class K >
-inline
-Point_3<K>
-centroid(const Tetrahedron_3<K> &t)
-{
-  return internal::centroid(t, K());
-}
-
-template < class K >
-inline
-Point_3<K>
-centroid(const Triangle_3<K> &t)
-{
-  return internal::centroid(t, K());
-}
-
-template < class K >
-inline
-typename K::Point_3
-circumcenter(const Point_3<K> &p,
-             const Point_3<K> &q)
-{
-  return internal::circumcenter(p, q, K());
-}
-
-template < class K >
-inline
-typename K::Point_3
-circumcenter(const Point_3<K> &p,
-             const Point_3<K> &q,
-             const Point_3<K> &r)
-{
-  return internal::circumcenter(p, q, r, K());
-}
-
-template < class K >
-inline
-typename K::Point_3
-circumcenter(const Point_3<K> &p, const Point_3<K> &q,
-             const Point_3<K> &r, const Point_3<K> &s)
-{
-  return internal::circumcenter(p, q, r, s, K());
-}
-
-template < class K >
-inline
-typename K::Point_3
-circumcenter(const Tetrahedron_3<K> &t)
-{
-  return internal::circumcenter(t, K());
-}
-
-template < class K >
-inline
-typename K::Point_3
-circumcenter(const Triangle_3<K> &t)
-{
-  return internal::circumcenter(t, K());
-}
-
-template < class K >
-inline
-typename K::Boolean
-collinear(const Point_3<K> &p, const Point_3<K> &q, const Point_3<K> &r)
-{
-  return internal::collinear(p, q, r, K());
-}
-
-template < class K >
-inline
-typename K::Boolean
-collinear_are_ordered_along_line(const Point_3<K> &p,
-                                 const Point_3<K> &q,
-                                 const Point_3<K> &r)
-{
-  return internal::collinear_are_ordered_along_line(p, q, r, K());
-}
-
-template < class K >
-inline
-typename K::Boolean
-collinear_are_strictly_ordered_along_line(const Point_3<K> &p,
-                                          const Point_3<K> &q,
-                                          const Point_3<K> &r)
-{
-  return internal::collinear_are_strictly_ordered_along_line(p, q, r, K());
-}
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_dihedral_angle(const Point_3<K>& a1, const Point_3<K>& b1, 
-                       const Point_3<K>& c1, const Point_3<K>& d1, 
-                       const Point_3<K>& a2, const Point_3<K>& b2, 
-                       const Point_3<K>& c2, const Point_3<K>& d2)
-{
-  return internal::compare_dihedral_angle(a1, b1, c1, d1, a2, b2, c2, d2, K());
-}
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_dihedral_angle(const Point_3<K>& a1, const Point_3<K>& b1, 
-                       const Point_3<K>& c1, const Point_3<K>& d1, 
-                       const typename K::FT& cosine)
-{
-  return internal::compare_dihedral_angle(a1, b1, c1, d1, cosine, K());
-}
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_dihedral_angle(const Vector_3<K>& ab1, 
-                       const Vector_3<K>& ac1,
-                       const Vector_3<K>& ad1,
-                       const Vector_3<K>& ab2,
-                       const Vector_3<K>& ac2,
-                       const Vector_3<K>& ad2)
-{
-  return internal::compare_dihedral_angle(ab1, ac1, ad1, ab2, ac2, ad2, K());
-}
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_dihedral_angle(const Vector_3<K>& ab1, 
-                       const Vector_3<K>& ac1,
-                       const Vector_3<K>& ad1,
-                       const typename K::FT& cosine)
-{
-  return internal::compare_dihedral_angle(ab1, ac1, ad1, cosine, K());
-}
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_distance_to_point(const Point_3<K> &p,
-                          const Point_3<K> &q,
-                          const Point_3<K> &r)
-{
-  return internal::compare_distance_to_point(p, q, r, K());
-}
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_squared_distance(const Point_3<K> &p,
-                         const Point_3<K> &q,
-                         const typename K::FT &d2)
-{
-  return internal::compare_squared_distance(p, q, d2, K());
-}
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_squared_radius(const Point_3<K> &p,
-		       const typename K::FT &sr)
-{
-  return internal::compare_squared_radius(p, sr, K());
-}
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_squared_radius(const Point_3<K> &p,
-		       const Point_3<K> &q,
-		       const typename K::FT &sr)
-{
-  return internal::compare_squared_radius(p, q, sr, K());
-}
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_squared_radius(const Point_3<K> &p,
-		       const Point_3<K> &q,
-		       const Point_3<K> &r,
-		       const typename K::FT &sr)
-{
-  return internal::compare_squared_radius(p, q, r, sr, K());
-}
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_squared_radius(const Point_3<K> &p,
-		       const Point_3<K> &q,
-		       const Point_3<K> &r,
-		       const Point_3<K> &s,
-		       const typename K::FT &sr)
-{
-  return internal::compare_squared_radius(p, q, r, s, sr, K());
-}
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_lexicographically_xyz(const Point_3<K> &p,
-                              const Point_3<K> &q)
-{
-  return internal::compare_lexicographically_xyz(p, q, K());
-}
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_lexicographically(const Point_3<K> &p,
-                          const Point_3<K> &q)
-{
-    return internal::compare_lexicographically_xyz(p, q, K());
-}
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_signed_distance_to_plane(const Plane_3<K> &h,
-				 const Point_3<K> &p,
-				 const Point_3<K> &q)
-{ 
-  return internal::compare_signed_distance_to_plane(h, p, q, K());
-}
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_signed_distance_to_plane(const Point_3<K> &hp,
-				 const Point_3<K> &hq,
-				 const Point_3<K> &hr,
-				 const Point_3<K> &p,
-				 const Point_3<K> &q)
-{ 
-  return internal::compare_signed_distance_to_plane(hp, hq, hr, p, q, K());
-}
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_x(const Point_3<K> &p, const Point_3<K> &q)
-{ 
-  return internal::compare_x(p, q, K());
-}
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_y(const Point_3<K> &p, const Point_3<K> &q)
-{ 
-  return internal::compare_y(p, q, K());
-}
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_z(const Point_3<K> &p, const Point_3<K> &q)
-{ 
-  return internal::compare_z(p, q, K());
-}
-
-template < class K >
-inline
-typename K::Comparison_result
-compare_xyz(const Point_3<K> &p, const Point_3<K> &q)
-{ 
-  return internal::compare_xyz(p, q, K());
-}
-
-template < class K >
-inline
-typename K::Boolean
-coplanar(const Point_3<K> &p, const Point_3<K> &q,
-         const Point_3<K> &r, const Point_3<K> &s)
-{
-  return internal::coplanar(p, q, r, s, K());
-}
-
-
-template < class K >
-inline
-typename K::Orientation
-coplanar_orientation(const Point_3<K> &p,
-                     const Point_3<K> &q,
-                     const Point_3<K> &r,
-                     const Point_3<K> &s)
-{
-  return internal::coplanar_orientation(p, q, r, s, K());
-}
-
-template < class K >
-inline
-typename K::Orientation
-coplanar_orientation(const Point_3<K> &p,
-                     const Point_3<K> &q,
-                     const Point_3<K> &r)
-{
-  return internal::coplanar_orientation(p, q, r, K());
-}
-
-template < class K >
-inline
-typename K::Bounded_side
-coplanar_side_of_bounded_circle(const Point_3<K> &p,
-                                const Point_3<K> &q,
-                                const Point_3<K> &r,
-                                const Point_3<K> &t)
-{
-  return internal::coplanar_side_of_bounded_circle(p, q, r, t, K());
-}
-
-template < class K >
-inline
-typename K::Vector_3
-cross_product(const Vector_3<K> &v, const Vector_3<K> &w)
-{
-  return internal::cross_product(v, w, K());
-}
-
-template < class K >
-inline
-typename K::FT
-determinant(const Vector_3<K> &v0, const Vector_3<K> &v1,
-            const Vector_3<K> &v2)
-{
-  return internal::determinant(v0, v1, v2, K());
-}
-
-template < class K >
-inline
-typename K::Line_3
-equidistant_line(const Point_3<K> &p, const Point_3<K> &q, const Point_3<K> &r)
-{
-  return internal::equidistant_line(p, q, r, K());
-}
-
-template < class K >
-inline
-typename K::Boolean
-has_larger_distance_to_point(const Point_3<K> &p,
-			     const Point_3<K> &q,
-			     const Point_3<K> &r)
-{
-  return internal::has_larger_distance_to_point(p, q, r, K());
-}
-
-template < class K >
-inline
-typename K::Boolean
-has_larger_signed_distance_to_plane(const Point_3<K> &hp,
-				    const Point_3<K> &hq,
-				    const Point_3<K> &hr,
-				    const Point_3<K> &p,
-				    const Point_3<K> &q)
-{ 
-  return internal::has_larger_signed_distance_to_plane(hp, hq, hr, p, q, K());
-}
-
-template < class K >
-inline
-typename K::Boolean
-has_larger_signed_distance_to_plane(const Plane_3<K> &h,
-				    const Point_3<K> &p,
-				    const Point_3<K> &q)
-{ 
-  return internal::has_larger_signed_distance_to_plane(h, p, q, K());
-}
-
-template < class K >
-inline
-typename K::Boolean
-has_smaller_distance_to_point(const Point_3<K> &p,
-                              const Point_3<K> &q,
-                              const Point_3<K> &r)
-{
-  return internal::has_smaller_distance_to_point(p, q, r, K());
-}
-
-template < class K >
-inline
-typename K::Boolean
-has_smaller_signed_distance_to_plane(const Point_3<K> &hp,
-                                     const Point_3<K> &hq,
-                                     const Point_3<K> &hr,
-                                     const Point_3<K> &p,
-                                     const Point_3<K> &q)
-{ 
-  return internal::has_smaller_signed_distance_to_plane(hp, hq, hr, p, q, K());
-}
-
-template < class K >
-inline
-typename K::Boolean
-has_smaller_signed_distance_to_plane(const Plane_3<K> &h,
-                                     const Point_3<K> &p,
-                                     const Point_3<K> &q)
-{ 
-  return internal::has_smaller_signed_distance_to_plane(h, p, q, K());
-}
-
-template < class K >
-inline
-typename K::Boolean
-less_x(const Point_3<K> &p, const Point_3<K> &q)
-{ 
-  return internal::less_x(p, q, K());
-}
-
-template < class K >
-inline
-typename K::Boolean
-less_y(const Point_3<K> &p, const Point_3<K> &q)
-{ 
-  return internal::less_y(p, q, K());
-}
-
-template < class K >
-inline
-typename K::Boolean
-less_z(const Point_3<K> &p, const Point_3<K> &q)
-{ 
-  return internal::less_z(p, q, K());
-}
-
-template < class K >
-inline
-typename K::Boolean
-lexicographically_xyz_smaller(const Point_3<K> &p, const Point_3<K> &q)
-{
-  return internal::lexicographically_xyz_smaller(p, q, K());
-}
-
-template < class K >
-inline
-typename K::Boolean
-lexicographically_xyz_smaller_or_equal(const Point_3<K> &p,
-                                       const Point_3<K> &q)
-{
-  return internal::lexicographically_xyz_smaller_or_equal(p, q, K());
-}
-
-template < class K >
-inline
-typename K::Point_3
-midpoint(const Point_3<K> &p, const Point_3<K> &q)
-{
-  return internal::midpoint(p, q, K());
-}
-
-template < class K >
-inline
-typename K::Point_3
-max_vertex(const Iso_cuboid_3<K> &ic)
-{
-  return internal::max_vertex(ic, K());
-}
-
-template < class K >
-inline
-typename K::Point_3
-min_vertex(const Iso_cuboid_3<K> &ic)
-{
-  return internal::min_vertex(ic, K());
-}
-
-template < class K >
-inline
-typename K::Vector_3
-normal(const Point_3<K> &p, const Point_3<K> &q, const Point_3<K> &r)
-{
-  return internal::normal(p, q, r, K());
-}
-
-// FIXME TODO : what to do with the operators ?
-template < class K >
-inline
-typename K::Boolean
-operator==(const Point_3<K>& p, const Point_3<K>& q)
-{ return K().equal_3_object()(p, q); }
-
-template < class K >
-inline
-typename K::Boolean
-operator!=(const Point_3<K>& p, const Point_3<K>& q)
-{ return ! (p == q); }
-
-template < class K >
-inline
-typename K::Boolean
-operator==(const Point_3<K>& p, const Origin& o)
-{ return K().equal_3_object()(p, Point_3<K>(o)); }
-
-template < class K >
-inline
-typename K::Boolean
-operator!=(const Point_3<K>& p, const Origin& o)
-{ return ! (p == o); }
-
-template < class K >
-inline
-typename K::Boolean
-operator==(const Iso_cuboid_3<K>& p, const Iso_cuboid_3<K>& q)
-{ return K().equal_3_object()(p, q); }
-
-template < class K >
-inline
-typename K::Boolean
-operator!=(const Iso_cuboid_3<K>& p, const Iso_cuboid_3<K>& q)
-{ return ! (p == q); }
-
-template < class K >
-inline
-typename K::Boolean
-operator==(const Plane_3<K>& p, const Plane_3<K>& q)
-{ return K().equal_3_object()(p, q); }
-
-template < class K >
-inline
-typename K::Boolean
-operator!=(const Plane_3<K>& p, const Plane_3<K>& q)
-{ return ! (p == q); }
-
-template < class K >
-inline
-typename K::Boolean
-operator==(const Segment_3<K>& p, const Segment_3<K>& q)
-{ return K().equal_3_object()(p, q); }
-
-template < class K >
-inline
-typename K::Boolean
-operator!=(const Segment_3<K>& p, const Segment_3<K>& q)
-{ return ! (p == q); }
-
-template < class K >
-inline
-typename K::Boolean
-operator==(const Line_3<K>& p, const Line_3<K>& q)
-{ return K().equal_3_object()(p, q); }
-
-template < class K >
-inline
-typename K::Boolean
-operator!=(const Line_3<K>& p, const Line_3<K>& q)
-{ return ! (p == q); }
-
-template < class K >
-inline
-typename K::Boolean
-operator==(const Ray_3<K>& p, const Ray_3<K>& q)
-{ return K().equal_3_object()(p, q); }
-
-template < class K >
-inline
-typename K::Boolean
-operator!=(const Ray_3<K>& p, const Ray_3<K>& q)
-{ return ! (p == q); }
-
-template < class K >
-inline
-typename K::Boolean
-operator==(const Triangle_3<K>& p, const Triangle_3<K>& q)
-{ return K().equal_3_object()(p, q); }
-
-template < class K >
-inline
-typename K::Boolean
-operator!=(const Triangle_3<K>& p, const Triangle_3<K>& q)
-{ return ! (p == q); }
-
-template < class K >
-inline
-typename K::Boolean
-operator==(const Tetrahedron_3<K>& p, const Tetrahedron_3<K>& q)
-{ return K().equal_3_object()(p, q); }
-
-template < class K >
-inline
-typename K::Boolean
-operator!=(const Tetrahedron_3<K>& p, const Tetrahedron_3<K>& q)
-{ return ! (p == q); }
-
-template < class K >
-inline
-typename K::Boolean
-operator==(const Direction_3<K>& p, const Direction_3<K>& q)
-{ return K().equal_3_object()(p, q); }
-
-template < class K >
-inline
-typename K::Boolean
-operator!=(const Direction_3<K>& p, const Direction_3<K>& q)
-{ return ! (p == q); }
-
-template < class K >
-inline
-typename K::Boolean
-operator==(const Sphere_3<K>& p, const Sphere_3<K>& q)
-{ return K().equal_3_object()(p, q); }
-
-template < class K >
-inline
-typename K::Boolean
-operator!=(const Sphere_3<K>& p, const Sphere_3<K>& q)
-{ return ! (p == q); }
-
-template < class K >
-inline
-typename K::Boolean
-operator==(const Vector_3<K>& p, const Vector_3<K>& q)
-{ return K().equal_3_object()(p, q); }
-
-template < class K >
-inline
-typename K::Boolean
-operator!=(const Vector_3<K>& p, const Vector_3<K>& q)
-{ return ! (p == q); }
-
-template < class K >
-inline
-typename K::Boolean
-operator==(const Vector_3<K>& p, const Null_vector& o)
-{ return K().equal_3_object()(p, Vector_3<K>(o)); }
-
-template < class K >
-inline
-typename K::Boolean
-operator!=(const Vector_3<K>& p, const Null_vector& o)
-{ return ! (p == o); }
-
-
-template < class K >
-inline
-typename K::Boolean
-operator<(const Point_3<K>& p, const Point_3<K>& q)
-{ return K().less_xyz_3_object()(p, q); }
-
-template < class K >
-inline
-typename K::Boolean
-operator>(const Point_3<K>& p, const Point_3<K>& q)
-{ return K().less_xyz_3_object()(q, p); }
-
-template < class K >
-inline
-typename K::Boolean
-operator<=(const Point_3<K>& p, const Point_3<K>& q)
-{ return ! K().less_xyz_3_object()(q, p); }
-
-template < class K >
-inline
-typename K::Boolean
-operator>=(const Point_3<K>& p, const Point_3<K>& q)
-{ return ! K().less_xyz_3_object()(p, q); }
-
-template < class K >
-inline
-typename K::Vector_3
-operator*(const typename K::FT &c, const Vector_3<K> &w)
-{
-  return K().construct_scaled_vector_3_object()(w, c);
-}
-
-template < class K >
-inline
-typename K::Vector_3
-operator*(const Vector_3<K> &w, const typename K::FT &c)
-{
-  return K().construct_scaled_vector_3_object()(w, c);
-}
-
-template < class K >
-inline
-typename K::Vector_3
-operator*(const typename First_if_different<typename K::RT,
-                                            typename K::FT>::Type &c,
-          const Vector_3<K> &w)
-{
-  return K().construct_scaled_vector_3_object()(w, c);
-}
-
-template < class K >
-inline
-typename K::Vector_3
-operator*(const Vector_3<K> &w,
-          const typename First_if_different<typename K::RT,
-                                            typename K::FT>::Type &c)
-{
-  return K().construct_scaled_vector_3_object()(w, c);
-}
-
-template < class K >
-inline
-typename K::FT
-operator*(const Vector_3<K> &v, const Vector_3<K> &w)
-{
-  return K().compute_scalar_product_3_object()(v, w);
-}
-
-
-template < class K >
-inline
-typename K::Point_3
-operator+(const Point_3<K> &p, const Vector_3<K> &v)
-{
-  return K().construct_translated_point_3_object()(p, v);
-}
-
-template < class K >
-inline
-typename K::Point_3
-operator+(const Origin &o, const Vector_3<K> &v)
-{
-  return K().construct_translated_point_3_object()(o, v);
-}
-
-template < class K >
-inline
-typename K::Point_3
-operator-(const Point_3<K> &p, const Vector_3<K> &v)
-{
-  return K().construct_translated_point_3_object()
-               (p, K().construct_opposite_vector_3_object()(v));
-}
-
-template < class K >
-inline
-typename K::Point_3
-operator-(const Origin &o, const Vector_3<K> &v)
-{
-  return K().construct_translated_point_3_object()
-               (o, K().construct_opposite_vector_3_object()(v));
-}
-
-template < class K >
-inline
-typename K::Vector_3
-operator-(const Point_3<K> &p, const Point_3<K> &q)
-{
-  return K().construct_vector_3_object()(q, p);
-}
-
-template < class K >
-inline
-typename K::Vector_3
-operator-(const Point_3<K> &p, const Origin &o)
-{
-  return K().construct_vector_3_object()(o, p);
-}
-
-template < class K >
-inline
-typename K::Vector_3
-operator-(const Origin &o, const Point_3<K> &q)
-{
-  return K().construct_vector_3_object()(q, o);
-}
-
-template <class K >
-inline
-typename K::Orientation
-orientation(const Point_3<K> &p,
-            const Point_3<K> &q,
-            const Point_3<K> &r,
-            const Point_3<K> &s)
-{
-  return internal::orientation(p, q, r, s, K());
-}
-
-template <class K >
-inline
-typename K::Orientation
-orientation(const Vector_3<K> &u, const Vector_3<K> &v, const Vector_3<K> &w)
-{
-  return internal::orientation(u, v, w, K());
-}
-
-template <class K >
-inline
-typename K::Vector_3
-orthogonal_vector(const Point_3<K>& p,
-		  const Point_3<K>& q,
-		  const Point_3<K>& r)
-{
-  return internal::orthogonal_vector(p, q, r, K());
-}
-
-template <class K >
-inline
-typename K::Vector_3
-orthogonal_vector(const Plane_3<K>& p)
-{
-  return internal::orthogonal_vector(p, K());
-}
-
-// parallel() functions are in Kernel/global_functions.h
-
-template <class K>
-inline
-typename K::Plane_3
-radical_plane(const Sphere_3<K> &s1,
-              const Sphere_3<K> &s2)
-{
-  return K().construct_radical_plane_3_object()(s1,s2);
-}
-
-template <class K >
-inline
-typename K::Bounded_side
-side_of_bounded_sphere(const Point_3<K> &p,
-                       const Point_3<K> &q,
-                       const Point_3<K> &test)
-{
-  return internal::side_of_bounded_sphere(p, q, test, K());
-}
-
-template <class K >
-inline
-typename K::Bounded_side
-side_of_bounded_sphere(const Point_3<K> &p,
-                       const Point_3<K> &q,
-                       const Point_3<K> &r,
-                       const Point_3<K> &test)
-{
-  return internal::side_of_bounded_sphere(p, q, r, test, K());
-}
-
-template <class K >
-inline
-typename K::Bounded_side
-side_of_bounded_sphere(const Point_3<K> &p,
-                       const Point_3<K> &q,
-                       const Point_3<K> &r,
-                       const Point_3<K> &s,
-                       const Point_3<K> &test)
-{
-  return internal::side_of_bounded_sphere(p, q, r, s, test, K());
-}
-
-template <class K >
-inline
-typename K::Oriented_side
-side_of_oriented_sphere(const Point_3<K> &p,
-                        const Point_3<K> &q,
-                        const Point_3<K> &r,
-                        const Point_3<K> &s,
-                        const Point_3<K> &test)
-{
-  return internal::side_of_oriented_sphere(p, q, r, s, test, K());
-}
-
-template <typename K>
-inline
-typename K::FT
-squared_area(const Point_3<K> &p, const Point_3<K> &q, const Point_3<K> &r)
-{
-  return internal::squared_area(p, q, r, K());
-}
-
-template < class K >
-inline
-typename K::FT
-squared_radius(const Point_3<K> &p, const Point_3<K> &q,
-	       const Point_3<K> &r, const Point_3<K> &s)
-{
-  return internal::squared_radius(p, q, r, s, K());
-}
-
-template < class K >
-inline
-typename K::FT
-squared_radius(const Point_3<K> &p, const Point_3<K> &q, const Point_3<K> &r)
-{
-  return internal::squared_radius(p, q, r, K());
-}
-
-template < class K >
-inline
-typename K::FT
-squared_radius(const Point_3<K> &p, const Point_3<K> &q)
-{
-  return internal::squared_radius(p, q, K());
-}
-
-template < class K >
-inline
-typename K::FT
-squared_radius(const Point_3<K> &p)
-{
-  return internal::squared_radius(p, K());
-}
-
-template < class K >
-inline
-typename K::Vector_3
-unit_normal(const Point_3<K> &p, const Point_3<K> &q, const Point_3<K> &r)
-{
-  return internal::unit_normal(p, q, r, K());
-}
-
-template < class K >
-inline
-typename K::FT
-volume(const Point_3<K> &p, const Point_3<K> &q,
-       const Point_3<K> &r, const Point_3<K> &s)
-{
-  return internal::volume(p, q, r, s, K());
-}
-
-template < class K >
-inline
-typename K::Boolean
-x_equal(const Point_3<K> &p, const Point_3<K> &q)
-{
-  return internal::x_equal(p, q, K());
-}
-
-template < class K >
-inline
-typename K::Boolean
-y_equal(const Point_3<K> &p, const Point_3<K> &q)
-{
-  return internal::y_equal(p, q, K());
-}
-
-template < class K >
-inline
-typename K::Boolean
-z_equal(const Point_3<K> &p, const Point_3<K> &q)
-{
-  return internal::z_equal(p, q, K());
-}
-
-} //namespace CGAL
-
-#endif  // CGAL_KERNEL_GLOBAL_FUNCTIONS_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel/interface_macros.h b/3rdparty/CGAL-4.8/include/CGAL/Kernel/interface_macros.h
deleted file mode 100644
index 2a4587e..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Kernel/interface_macros.h
+++ /dev/null
@@ -1,563 +0,0 @@
-// Copyright (c) 2000-2004  
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved. 
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Herve Bronnimann, Sylvain Pion, Susan Hert
-
-// This file is intentionally not protected against re-inclusion.
-// It's aimed at being included from within a kernel traits class, this
-// way we share more code.
-
-// It is the responsability of the including file to correctly set the 2
-// macros CGAL_Kernel_pred, CGAL_Kernel_cons and CGAL_Kernel_obj.
-// And they are #undefed at the end of this file.
-
-#ifndef CGAL_Kernel_pred
-#  define CGAL_Kernel_pred(X, Y)
-#endif
-
-// Those predicates for which Simple_cartesian is guaranteed not to use
-// any division.
-#ifndef CGAL_Kernel_pred_RT
-#  define CGAL_Kernel_pred_RT(X, Y) CGAL_Kernel_pred(X, Y)
-#endif
-
-#ifndef CGAL_Kernel_cons
-#  define CGAL_Kernel_cons(X, Y)
-#endif
-
-#ifndef CGAL_Kernel_obj
-#  define CGAL_Kernel_obj(X)
-#endif
-
-CGAL_Kernel_obj(Point_2)
-CGAL_Kernel_obj(Vector_2)
-CGAL_Kernel_obj(Direction_2)
-CGAL_Kernel_obj(Segment_2)
-CGAL_Kernel_obj(Ray_2)
-CGAL_Kernel_obj(Line_2)
-CGAL_Kernel_obj(Triangle_2)
-CGAL_Kernel_obj(Iso_rectangle_2)
-CGAL_Kernel_obj(Circle_2)
-
-CGAL_Kernel_obj(Point_3)
-CGAL_Kernel_obj(Plane_3)
-CGAL_Kernel_obj(Vector_3)
-CGAL_Kernel_obj(Direction_3)
-CGAL_Kernel_obj(Segment_3)
-CGAL_Kernel_obj(Ray_3)
-CGAL_Kernel_obj(Line_3)
-CGAL_Kernel_obj(Triangle_3)
-CGAL_Kernel_obj(Tetrahedron_3)
-CGAL_Kernel_obj(Iso_cuboid_3)
-CGAL_Kernel_obj(Sphere_3)
-CGAL_Kernel_obj(Circle_3)
-
-
-CGAL_Kernel_pred(Angle_2,
-		 angle_2_object)
-CGAL_Kernel_pred(Angle_3,
-		 angle_3_object)
-CGAL_Kernel_pred(Are_ordered_along_line_2,
-		 are_ordered_along_line_2_object)
-CGAL_Kernel_pred(Are_ordered_along_line_3,
-		 are_ordered_along_line_3_object)
-CGAL_Kernel_pred(Are_parallel_2,
-		 are_parallel_2_object)
-CGAL_Kernel_pred(Are_parallel_3,
-		 are_parallel_3_object)
-CGAL_Kernel_pred(Are_strictly_ordered_along_line_2,
-		 are_strictly_ordered_along_line_2_object)
-CGAL_Kernel_pred(Are_strictly_ordered_along_line_3,
-		 are_strictly_ordered_along_line_3_object)
-CGAL_Kernel_cons(Assign_2,
-		 assign_2_object)
-CGAL_Kernel_cons(Assign_3,
-		 assign_3_object)
-CGAL_Kernel_pred(Bounded_side_2,
-		 bounded_side_2_object)
-CGAL_Kernel_pred(Bounded_side_3,
-		 bounded_side_3_object)
-CGAL_Kernel_pred(Collinear_are_ordered_along_line_2,
-		 collinear_are_ordered_along_line_2_object)
-CGAL_Kernel_pred(Collinear_are_ordered_along_line_3,
-		 collinear_are_ordered_along_line_3_object)
-CGAL_Kernel_pred(Collinear_are_strictly_ordered_along_line_2,
-		 collinear_are_strictly_ordered_along_line_2_object)
-CGAL_Kernel_pred(Collinear_are_strictly_ordered_along_line_3,
-		 collinear_are_strictly_ordered_along_line_3_object)
-CGAL_Kernel_pred(Collinear_has_on_2,
-		 collinear_has_on_2_object)
-CGAL_Kernel_pred(Collinear_2,
-		 collinear_2_object)
-CGAL_Kernel_pred(Collinear_3,
-		 collinear_3_object)
-CGAL_Kernel_pred(Compare_angle_with_x_axis_2,
-		 compare_angle_with_x_axis_2_object)
-CGAL_Kernel_pred(Compare_dihedral_angle_3,
-		 compare_dihedral_angle_3_object)
-CGAL_Kernel_pred(Compare_distance_2,
-		 compare_distance_2_object)
-CGAL_Kernel_pred(Compare_distance_3,
-		 compare_distance_3_object)
-CGAL_Kernel_pred(Compare_slope_2,
-		 compare_slope_2_object)
-CGAL_Kernel_pred(Compare_squared_distance_2,
-		 compare_squared_distance_2_object)
-CGAL_Kernel_pred(Compare_squared_distance_3,
-		 compare_squared_distance_3_object)
-CGAL_Kernel_pred(Compare_squared_radius_3,
-		 compare_squared_radius_3_object)
-CGAL_Kernel_pred(Compare_x_at_y_2,
-		 compare_x_at_y_2_object)
-CGAL_Kernel_pred(Compare_xyz_3,
-		 compare_xyz_3_object)
-CGAL_Kernel_pred(Compare_xy_2,
-		 compare_xy_2_object)
-CGAL_Kernel_pred(Compare_xy_3,
-		 compare_xy_3_object)
-CGAL_Kernel_pred(Compare_x_2,
-		 compare_x_2_object)
-CGAL_Kernel_pred(Compare_x_3,
-		 compare_x_3_object)
-CGAL_Kernel_pred(Compare_y_at_x_2,
-		 compare_y_at_x_2_object)
-CGAL_Kernel_pred(Compare_y_2,
-		 compare_y_2_object)
-CGAL_Kernel_pred(Compare_y_3,
-		 compare_y_3_object)
-CGAL_Kernel_pred(Compare_yx_2,
-		 compare_yx_2_object)
-CGAL_Kernel_pred(Compare_z_3,
-		 compare_z_3_object)
-CGAL_Kernel_cons(Compute_a_2,
-		 compute_a_2_object)
-CGAL_Kernel_cons(Compute_a_3,
-		 compute_a_3_object)
-CGAL_Kernel_cons(Compute_b_2,
-		 compute_b_2_object)
-CGAL_Kernel_cons(Compute_b_3,
-		 compute_b_3_object)
-CGAL_Kernel_cons(Compute_c_2,
-		 compute_c_2_object)
-CGAL_Kernel_cons(Compute_c_3,
-		 compute_c_3_object)
-CGAL_Kernel_cons(Compute_d_3,
-		 compute_d_3_object)
-CGAL_Kernel_cons(Compute_approximate_area_3,
-                 compute_approximate_area_3_object)
-CGAL_Kernel_cons(Compute_approximate_squared_length_3,
-                 compute_approximate_squared_length_3_object)
-CGAL_Kernel_cons(Compute_area_2,
-		 compute_area_2_object)
-CGAL_Kernel_cons(Compute_area_3,
-		 compute_area_3_object)
-CGAL_Kernel_cons(Compute_area_divided_by_pi_3,
-		 compute_area_divided_by_pi_3_object)
-CGAL_Kernel_cons(Compute_determinant_2,
-		 compute_determinant_2_object)
-CGAL_Kernel_cons(Compute_determinant_3,
-		 compute_determinant_3_object)
-CGAL_Kernel_cons(Compute_scalar_product_2,
-		 compute_scalar_product_2_object)
-CGAL_Kernel_cons(Compute_scalar_product_3,
-		 compute_scalar_product_3_object)
-CGAL_Kernel_cons(Compute_squared_area_3,
-		 compute_squared_area_3_object)
-CGAL_Kernel_cons(Compute_squared_distance_2,
-		 compute_squared_distance_2_object)
-CGAL_Kernel_cons(Compute_squared_distance_3,
-		 compute_squared_distance_3_object)
-CGAL_Kernel_cons(Compute_squared_length_2,
-		 compute_squared_length_2_object)
-CGAL_Kernel_cons(Compute_squared_length_3,
-		 compute_squared_length_3_object)
-CGAL_Kernel_cons(Compute_squared_length_divided_by_pi_square_3,
-                 compute_squared_length_divided_by_pi_square_3_object)
-CGAL_Kernel_cons(Compute_squared_radius_2,
-		 compute_squared_radius_2_object)
-CGAL_Kernel_cons(Compute_squared_radius_3,
-		 compute_squared_radius_3_object)
-CGAL_Kernel_cons(Compute_volume_3,
-		 compute_volume_3_object)
-CGAL_Kernel_cons(Compute_x_2,
-		 compute_x_2_object)
-CGAL_Kernel_cons(Compute_x_3,
-		 compute_x_3_object)
-CGAL_Kernel_cons(Compute_y_2,
-		 compute_y_2_object)
-CGAL_Kernel_cons(Compute_y_3,
-		 compute_y_3_object)
-CGAL_Kernel_cons(Compute_z_3,
-		 compute_z_3_object)
-CGAL_Kernel_cons(Compute_dx_2,
-		 compute_dx_2_object)
-CGAL_Kernel_cons(Compute_dx_3,
-		 compute_dx_3_object)
-CGAL_Kernel_cons(Compute_dy_2,
-		 compute_dy_2_object)
-CGAL_Kernel_cons(Compute_dy_3,
-		 compute_dy_3_object)
-CGAL_Kernel_cons(Compute_dz_3,
-		 compute_dz_3_object)
-CGAL_Kernel_cons(Compute_hx_2,
-		 compute_hx_2_object)
-CGAL_Kernel_cons(Compute_hx_3,
-		 compute_hx_3_object)
-CGAL_Kernel_cons(Compute_hy_2,
-		 compute_hy_2_object)
-CGAL_Kernel_cons(Compute_hy_3,
-		 compute_hy_3_object)
-CGAL_Kernel_cons(Compute_hz_3,
-		 compute_hz_3_object)
-CGAL_Kernel_cons(Compute_hw_2,
-		 compute_hw_2_object)
-CGAL_Kernel_cons(Compute_hw_3,
-		 compute_hw_3_object)
-CGAL_Kernel_cons(Compute_x_at_y_2,
-		 compute_x_at_y_2_object)
-CGAL_Kernel_cons(Compute_y_at_x_2,
-		 compute_y_at_x_2_object)
-CGAL_Kernel_cons(Compute_xmin_2,
-		 compute_xmin_2_object)
-CGAL_Kernel_cons(Compute_xmax_2,
-		 compute_xmax_2_object)
-CGAL_Kernel_cons(Compute_ymin_2,
-		 compute_ymin_2_object)
-CGAL_Kernel_cons(Compute_ymax_2,
-		 compute_ymax_2_object)
-CGAL_Kernel_cons(Compute_xmin_3,
-		 compute_xmin_3_object)
-CGAL_Kernel_cons(Compute_xmax_3,
-		 compute_xmax_3_object)
-CGAL_Kernel_cons(Compute_ymin_3,
-		 compute_ymin_3_object)
-CGAL_Kernel_cons(Compute_ymax_3,
-		 compute_ymax_3_object)
-CGAL_Kernel_cons(Compute_zmin_3,
-		 compute_zmin_3_object)
-CGAL_Kernel_cons(Compute_zmax_3,
-		 compute_zmax_3_object)
-CGAL_Kernel_cons(Construct_barycenter_2,
-		 construct_barycenter_2_object)
-CGAL_Kernel_cons(Construct_barycenter_3,
-		 construct_barycenter_3_object)
-CGAL_Kernel_cons(Construct_base_vector_3,
-		 construct_base_vector_3_object)
-CGAL_Kernel_cons(Construct_bisector_2,
-		 construct_bisector_2_object)
-CGAL_Kernel_cons(Construct_bisector_3,
-		 construct_bisector_3_object)
-CGAL_Kernel_cons(Construct_center_2,
-		 construct_center_2_object)
-CGAL_Kernel_cons(Construct_center_3,
-		 construct_center_3_object)
-CGAL_Kernel_cons(Construct_centroid_2,
-		 construct_centroid_2_object)
-CGAL_Kernel_cons(Construct_centroid_3,
-		 construct_centroid_3_object)
-CGAL_Kernel_cons(Construct_circle_2,
-		 construct_circle_2_object)
-CGAL_Kernel_cons(Construct_circle_3,
-		 construct_circle_3_object)
-CGAL_Kernel_cons(Construct_circumcenter_2,
-		 construct_circumcenter_2_object)
-CGAL_Kernel_cons(Construct_circumcenter_3,
-		 construct_circumcenter_3_object)
-CGAL_Kernel_cons(Construct_cross_product_vector_3,
-		 construct_cross_product_vector_3_object)
-CGAL_Kernel_cons(Construct_direction_2,
-		 construct_direction_2_object)
-CGAL_Kernel_cons(Construct_direction_3,
-		 construct_direction_3_object)
-CGAL_Kernel_cons(Construct_equidistant_line_3,
-		 construct_equidistant_line_3_object)
-CGAL_Kernel_cons(Construct_iso_cuboid_3,
-		 construct_iso_cuboid_3_object)
-CGAL_Kernel_cons(Construct_iso_rectangle_2,
-		 construct_iso_rectangle_2_object)
-CGAL_Kernel_cons(Construct_lifted_point_3,
-		 construct_lifted_point_3_object)
-CGAL_Kernel_cons(Construct_line_2,
-		 construct_line_2_object)
-CGAL_Kernel_cons(Construct_line_3,
-		 construct_line_3_object)
-CGAL_Kernel_cons(Construct_midpoint_2,
-		 construct_midpoint_2_object)
-CGAL_Kernel_cons(Construct_midpoint_3,
-		 construct_midpoint_3_object)
-CGAL_Kernel_cons(Construct_min_vertex_2,
-                 construct_min_vertex_2_object)
-CGAL_Kernel_cons(Construct_max_vertex_2,
-                 construct_max_vertex_2_object)
-CGAL_Kernel_cons(Construct_min_vertex_3,
-                 construct_min_vertex_3_object)
-CGAL_Kernel_cons(Construct_max_vertex_3,
-                 construct_max_vertex_3_object)
-CGAL_Kernel_cons(Construct_normal_3,
-                 construct_normal_3_object)
-CGAL_Kernel_cons(Construct_object_2,
-                 construct_object_2_object)
-CGAL_Kernel_cons(Construct_object_3,
-                 construct_object_3_object)
-CGAL_Kernel_cons(Construct_opposite_circle_2,
-		 construct_opposite_circle_2_object)
-CGAL_Kernel_cons(Construct_opposite_direction_2,
-		 construct_opposite_direction_2_object)
-CGAL_Kernel_cons(Construct_opposite_direction_3,
-		 construct_opposite_direction_3_object)
-CGAL_Kernel_cons(Construct_opposite_line_2,
-		 construct_opposite_line_2_object)
-CGAL_Kernel_cons(Construct_opposite_line_3,
-		 construct_opposite_line_3_object)
-CGAL_Kernel_cons(Construct_opposite_plane_3,
-		 construct_opposite_plane_3_object)
-CGAL_Kernel_cons(Construct_opposite_ray_2,
-		 construct_opposite_ray_2_object)
-CGAL_Kernel_cons(Construct_opposite_ray_3,
-		 construct_opposite_ray_3_object)
-CGAL_Kernel_cons(Construct_opposite_segment_2,
-		 construct_opposite_segment_2_object)
-CGAL_Kernel_cons(Construct_opposite_segment_3,
-		 construct_opposite_segment_3_object)
-CGAL_Kernel_cons(Construct_opposite_sphere_3,
-		 construct_opposite_sphere_3_object)
-CGAL_Kernel_cons(Construct_opposite_triangle_2,
-		 construct_opposite_triangle_2_object)
-CGAL_Kernel_cons(Construct_opposite_vector_2,
-		 construct_opposite_vector_2_object)
-CGAL_Kernel_cons(Construct_difference_of_vectors_2,
-		 construct_difference_of_vectors_2_object)
-CGAL_Kernel_cons(Construct_difference_of_vectors_3,
-		 construct_difference_of_vectors_3_object)
-CGAL_Kernel_cons(Construct_sum_of_vectors_2,
-		 construct_sum_of_vectors_2_object)
-CGAL_Kernel_cons(Construct_sum_of_vectors_3,
-		 construct_sum_of_vectors_3_object)
-CGAL_Kernel_cons(Construct_opposite_vector_3,
-		 construct_opposite_vector_3_object)
-CGAL_Kernel_cons(Construct_orthogonal_vector_3,
-		 construct_orthogonal_vector_3_object)
-CGAL_Kernel_cons(Construct_perpendicular_direction_2,
-		 construct_perpendicular_direction_2_object)
-CGAL_Kernel_cons(Construct_perpendicular_line_2,
-		 construct_perpendicular_line_2_object)
-CGAL_Kernel_cons(Construct_perpendicular_line_3,
-		 construct_perpendicular_line_3_object)
-CGAL_Kernel_cons(Construct_perpendicular_plane_3,
-		 construct_perpendicular_plane_3_object)
-CGAL_Kernel_cons(Construct_perpendicular_vector_2,
-		 construct_perpendicular_vector_2_object)
-CGAL_Kernel_cons(Construct_plane_3,
-		 construct_plane_3_object)
-CGAL_Kernel_cons(Construct_point_on_2,
-		 construct_point_on_2_object)
-CGAL_Kernel_cons(Construct_point_on_3,
-		 construct_point_on_3_object)
-CGAL_Kernel_cons(Construct_point_2,
-		 construct_point_2_object)
-CGAL_Kernel_cons(Construct_point_3,
-		 construct_point_3_object)
-CGAL_Kernel_cons(Construct_projected_point_2,
-		 construct_projected_point_2_object)
-CGAL_Kernel_cons(Construct_projected_point_3,
-		 construct_projected_point_3_object)
-CGAL_Kernel_cons(Construct_projected_xy_point_2,
-		 construct_projected_xy_point_2_object)
-CGAL_Kernel_cons(Construct_radical_line_2,
-     construct_radical_line_2_object)		
-CGAL_Kernel_cons(Construct_radical_plane_3,
-                 construct_radical_plane_3_object)
-CGAL_Kernel_cons(Construct_ray_2,
-		 construct_ray_2_object)
-CGAL_Kernel_cons(Construct_ray_3,
-		 construct_ray_3_object)
-CGAL_Kernel_cons(Construct_scaled_vector_2,
-		 construct_scaled_vector_2_object)
-CGAL_Kernel_cons(Construct_divided_vector_2,
-		 construct_divided_vector_2_object)
-CGAL_Kernel_cons(Construct_divided_vector_3,
-		 construct_divided_vector_3_object)
-CGAL_Kernel_cons(Construct_scaled_vector_3,
-		 construct_scaled_vector_3_object)
-CGAL_Kernel_cons(Construct_second_point_2,
-		 construct_second_point_2_object)
-CGAL_Kernel_cons(Construct_second_point_3,
-		 construct_second_point_3_object)
-CGAL_Kernel_cons(Construct_segment_2,
-		 construct_segment_2_object)
-CGAL_Kernel_cons(Construct_segment_3,
-		 construct_segment_3_object)
-CGAL_Kernel_cons(Construct_source_2,
-		 construct_source_2_object)
-CGAL_Kernel_cons(Construct_source_3,
-		 construct_source_3_object)
-CGAL_Kernel_cons(Construct_sphere_3,
-		 construct_sphere_3_object)
-CGAL_Kernel_cons(Construct_supporting_plane_3,
-		 construct_supporting_plane_3_object)
-CGAL_Kernel_cons(Construct_target_2,
-		 construct_target_2_object)
-CGAL_Kernel_cons(Construct_target_3,
-		 construct_target_3_object)
-CGAL_Kernel_cons(Construct_tetrahedron_3,
-		 construct_tetrahedron_3_object)
-CGAL_Kernel_cons(Construct_translated_point_2,
-		 construct_translated_point_2_object)
-CGAL_Kernel_cons(Construct_translated_point_3,
-		 construct_translated_point_3_object)
-CGAL_Kernel_cons(Construct_triangle_2,
-		 construct_triangle_2_object)
-CGAL_Kernel_cons(Construct_triangle_3,
-		 construct_triangle_3_object)
-CGAL_Kernel_cons(Construct_unit_normal_3,
-                 construct_unit_normal_3_object)
-CGAL_Kernel_cons(Construct_vector_2,
-		 construct_vector_2_object)
-CGAL_Kernel_cons(Construct_vector_3,
-		 construct_vector_3_object)
-CGAL_Kernel_cons(Construct_vertex_2,
-		 construct_vertex_2_object)
-CGAL_Kernel_cons(Construct_vertex_3,
-		 construct_vertex_3_object)
-CGAL_Kernel_cons(Construct_bbox_2,
-		 construct_bbox_2_object)
-CGAL_Kernel_cons(Construct_bbox_3,
-		 construct_bbox_3_object)
-CGAL_Kernel_cons(Construct_cartesian_const_iterator_2,
-		 construct_cartesian_const_iterator_2_object)
-CGAL_Kernel_cons(Construct_cartesian_const_iterator_3,
-		 construct_cartesian_const_iterator_3_object)
-CGAL_Kernel_pred(Coplanar_orientation_3,
-		 coplanar_orientation_3_object)
-CGAL_Kernel_pred(Coplanar_side_of_bounded_circle_3,
-		 coplanar_side_of_bounded_circle_3_object)
-CGAL_Kernel_pred(Coplanar_3,
-		 coplanar_3_object)
-CGAL_Kernel_pred(Counterclockwise_in_between_2,
-		 counterclockwise_in_between_2_object)
-CGAL_Kernel_pred(Do_intersect_2,
-		 do_intersect_2_object)
-CGAL_Kernel_pred(Do_intersect_3,
-		 do_intersect_3_object)
-CGAL_Kernel_pred(Equal_xy_3,
-		 equal_xy_3_object)
-CGAL_Kernel_pred(Equal_x_2,
-		 equal_x_2_object)
-CGAL_Kernel_pred(Equal_x_3,
-		 equal_x_3_object)
-CGAL_Kernel_pred(Equal_y_2,
-		 equal_y_2_object)
-CGAL_Kernel_pred(Equal_y_3,
-		 equal_y_3_object)
-CGAL_Kernel_pred(Equal_z_3,
-		 equal_z_3_object)
-CGAL_Kernel_pred(Equal_2,
-		 equal_2_object)
-CGAL_Kernel_pred(Equal_3,
-		 equal_3_object)
-CGAL_Kernel_pred(Has_on_boundary_2,
-		 has_on_boundary_2_object)
-CGAL_Kernel_pred(Has_on_boundary_3,
-		 has_on_boundary_3_object)
-CGAL_Kernel_pred(Has_on_bounded_side_2,
-		 has_on_bounded_side_2_object)
-CGAL_Kernel_pred(Has_on_bounded_side_3,
-		 has_on_bounded_side_3_object)
-CGAL_Kernel_pred(Has_on_negative_side_2,
-		 has_on_negative_side_2_object)
-CGAL_Kernel_pred(Has_on_negative_side_3,
-		 has_on_negative_side_3_object)
-CGAL_Kernel_pred(Has_on_positive_side_2,
-		 has_on_positive_side_2_object)
-CGAL_Kernel_pred(Has_on_positive_side_3,
-		 has_on_positive_side_3_object)
-CGAL_Kernel_pred(Has_on_unbounded_side_2,
-		 has_on_unbounded_side_2_object)
-CGAL_Kernel_pred(Has_on_unbounded_side_3,
-		 has_on_unbounded_side_3_object)
-CGAL_Kernel_pred(Has_on_2,
-		 has_on_2_object)
-CGAL_Kernel_pred(Has_on_3,
-		 has_on_3_object)
-CGAL_Kernel_cons(Intersect_2,
-		 intersect_2_object)
-CGAL_Kernel_cons(Intersect_3,
-		 intersect_3_object)
-CGAL_Kernel_pred(Is_degenerate_2,
-		 is_degenerate_2_object)
-CGAL_Kernel_pred(Is_degenerate_3,
-		 is_degenerate_3_object)
-CGAL_Kernel_pred(Is_horizontal_2,
-		 is_horizontal_2_object)
-CGAL_Kernel_pred(Is_vertical_2,
-		 is_vertical_2_object)
-CGAL_Kernel_pred(Left_turn_2,
-                 left_turn_2_object)
-CGAL_Kernel_pred(Less_distance_to_point_2,
-                 less_distance_to_point_2_object)
-CGAL_Kernel_pred(Less_distance_to_point_3,
-                 less_distance_to_point_3_object)
-CGAL_Kernel_pred(Less_rotate_ccw_2,
-		 less_rotate_ccw_2_object)
-CGAL_Kernel_pred(Less_signed_distance_to_line_2,
-                 less_signed_distance_to_line_2_object)
-CGAL_Kernel_pred(Less_signed_distance_to_plane_3,
-		 less_signed_distance_to_plane_3_object)
-CGAL_Kernel_pred(Less_xyz_3,
-		 less_xyz_3_object)
-CGAL_Kernel_pred(Less_xy_2,
-		 less_xy_2_object)
-CGAL_Kernel_pred(Less_xy_3,
-		 less_xy_3_object)
-CGAL_Kernel_pred(Less_x_2,
-		 less_x_2_object)
-CGAL_Kernel_pred(Less_x_3,
-		 less_x_3_object)
-CGAL_Kernel_pred(Less_yx_2,
-		 less_yx_2_object)
-CGAL_Kernel_pred(Less_y_2,
-		 less_y_2_object)
-CGAL_Kernel_pred(Less_y_3,
-		 less_y_3_object)
-CGAL_Kernel_pred(Less_z_3,
-		 less_z_3_object)
-CGAL_Kernel_pred_RT(Orientation_2,
-		    orientation_2_object)
-CGAL_Kernel_pred_RT(Orientation_3,
-		    orientation_3_object)
-CGAL_Kernel_pred(Oriented_side_2,
-		 oriented_side_2_object)
-CGAL_Kernel_pred(Oriented_side_3,
-		 oriented_side_3_object)
-CGAL_Kernel_pred_RT(Side_of_bounded_circle_2,
-		    side_of_bounded_circle_2_object)
-CGAL_Kernel_pred_RT(Side_of_bounded_sphere_3,
-		    side_of_bounded_sphere_3_object)
-CGAL_Kernel_pred_RT(Side_of_oriented_circle_2,
-		    side_of_oriented_circle_2_object)
-CGAL_Kernel_pred_RT(Side_of_oriented_sphere_3,
-		    side_of_oriented_sphere_3_object)
-
-#undef CGAL_Kernel_pred_RT
-#undef CGAL_Kernel_pred
-#undef CGAL_Kernel_cons
-#undef CGAL_Kernel_obj
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Iso_box_d.h b/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Iso_box_d.h
deleted file mode 100644
index 4a6fe9e..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Iso_box_d.h
+++ /dev/null
@@ -1,410 +0,0 @@
-// Copyright (c) 2002  
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved. 
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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$
-// 
-//
-// Authors       : Hans Tangelder <hanst at cs.uu.nl>, Michael Hoffmann
-
-#ifndef CGAL_ISO_BOX_D_H
-#define CGAL_ISO_BOX_D_H
-
-#include <CGAL/basic.h>
-#include <CGAL/Handle_for.h>
-#include <CGAL/representation_tags.h> 
-#include <CGAL/Dimension.h>
-#include <functional>
-#include <algorithm>
-#include <numeric>
-#include <cstddef>
-
-namespace CGAL {
-  
-  namespace Kernel_d {
-    struct Begin {};
-    struct End {};
-    struct Cartesian_end {};
-  } // namespace Kernel_d
-  
-  template < typename Point_, typename Functor_ >
-  struct Cartesian_iterator {
-    typedef Point_                                    Point;
-    typedef Functor_                                  Functor;
-    typedef typename Point::Cartesian_const_iterator  Iterator;
-    typedef Cartesian_iterator<Point,Functor>         Self;
-
-    typedef typename Functor::result_type  value_type;
-    typedef value_type&                    reference;
-    typedef value_type*                    pointer;
-    typedef std::ptrdiff_t                 difference_type;
-    typedef std::input_iterator_tag        iterator_category;
-      
-  protected:
-      
-    Iterator pb, qb;
-    Functor f;
-      
-  public:
-      
-    Cartesian_iterator(const Point& p, const Point& q, Kernel_d::Begin)
-      : pb(p.cartesian_begin()), qb(q.cartesian_begin())
-    {}
-    
-    Cartesian_iterator(const Point& p, const Point& q, Kernel_d::End)
-      : pb(p.cartesian_end()), qb(q.cartesian_end())
-    {}
-    
-    Cartesian_iterator(const Point& p, const Point& q, Kernel_d::Cartesian_end)
-      : pb(p.cartesian_end()), qb(q.cartesian_end())
-    {}
-    
-    Cartesian_iterator(const Point& p, const Point& q, const Functor& f_,
-		       Kernel_d::Begin) 
-      : pb(p.cartesian_begin()), qb(q.cartesian_begin()), f(f_) 
-    {}
-      
-    Cartesian_iterator(const Point& p, const Point& q, const Functor& f_,
-		       Kernel_d::End) 
-      : pb(p.cartesian_end()), qb(q.cartesian_end()), f(f_) 
-    {}
-      
-    Cartesian_iterator(const Point& p, const Point& q, const Functor& f_,
-		       Kernel_d::Cartesian_end) 
-      : pb(p.cartesian_end()), qb(q.cartesian_end()), f(f_) 
-    {}
-      
-    Self& operator++() { ++pb; ++qb; return *this; }
-      
-    Self operator++(int) {
-      Self tmp(*this);
-      ++(*this);
-      return tmp;
-    }
-    
-    value_type operator*()  const { return f(*pb, *qb); }
-    pointer    operator->() const { return &(**this); }
-      
-    const Functor& functor() const { return f; }
-    Iterator base_p() const { return pb; }
-    Iterator base_q() const { return qb; }
-  };
-  
-  template < typename Iterator, typename Functor > inline
-  bool operator==(const Cartesian_iterator<Iterator,Functor>& x, 
-		  const Cartesian_iterator<Iterator,Functor>& y)
-  {
-    return x.base_p() == y.base_p() && x.base_q() == y.base_q(); 
-  }
-  
-  template < typename Iterator, typename Functor > inline
-  bool operator!=(const Cartesian_iterator<Iterator,Functor>& x, 
-		  const Cartesian_iterator<Iterator,Functor>& y)
-  {
-    return ! (x == y);
-  }
-  
-  template < typename Point_, typename Functor_ >
-  struct Homogeneous_iterator {
-    typedef Point_                                      Point;
-    typedef Functor_                                    Functor;
-    typedef typename Point::Homogeneous_const_iterator  Iterator;
-    typedef Homogeneous_iterator<Point,Functor>         Self;
-
-    typedef typename Functor::result_type  value_type;
-    typedef value_type&                    reference;
-    typedef value_type*                    pointer;
-    typedef std::ptrdiff_t                 difference_type;
-    typedef std::input_iterator_tag        iterator_category;
-      
-  protected:
-      
-    Iterator pb, qb;
-    Functor f;
-    typedef typename Kernel_traits<Point>::Kernel::RT RT;
-    RT hp, hq; // homogenizing coordinates
-    
-  public:
-      
-    Homogeneous_iterator(const Point& p, const Point& q, Kernel_d::Begin)
-      : pb(p.homogeneous_begin()), qb(q.homogeneous_begin()),
-	hp(p.homogeneous(p.dimension())), hq(q.homogeneous(q.dimension()))
-    {}
-    
-    Homogeneous_iterator(const Point& p, const Point& q, Kernel_d::End)
-      : pb(p.homogeneous_end()), qb(q.homogeneous_end()),
-	hp(p.homogeneous(p.dimension())), hq(q.homogeneous(q.dimension()))
-    {}
-    
-    Homogeneous_iterator(const Point& p, const Point& q, 
-			 Kernel_d::Cartesian_end)
-      : pb(p.homogeneous_end()), qb(q.homogeneous_end()),
-	hp(p.homogeneous(p.dimension())), hq(q.homogeneous(q.dimension()))
-    {
-      --pb; --qb;
-    }
-    
-    Homogeneous_iterator(const Point& p, const Point& q, const Functor& f_,
-			 Kernel_d::Begin) 
-      : pb(p.homogeneous_begin()), qb(q.homogeneous_begin()), f(f_),
-	hp(p.homogeneous(p.dimension())), hq(q.homogeneous(q.dimension()))
-    {}
-    
-    Homogeneous_iterator(const Point& p, const Point& q, const Functor& f_,
-			 Kernel_d::End) 
-      : pb(p.homogeneous_end()), qb(q.homogeneous_end()), f(f_),
-	hp(p.homogeneous(p.dimension())), hq(q.homogeneous(q.dimension()))
-    {}
-      
-    Homogeneous_iterator(const Point& p, const Point& q, const Functor& f_,
-			 Kernel_d::Cartesian_end) 
-      : pb(p.homogeneous_end()), qb(q.homogeneous_end()), f(f_),
-	hp(p.homogeneous(p.dimension())), hq(q.homogeneous(q.dimension()))
-    {
-      --pb; --qb;
-    }
-      
-    Self& operator++() { ++pb; ++qb; return *this; }
-      
-    Self operator++(int) {
-      Self tmp(*this);
-      ++(*this);
-      return tmp;
-    }
-    
-    value_type operator*()  const { return f(*pb * hq, *qb * hp); }
-    pointer    operator->() const { return &(**this); }
-      
-    const Functor& functor() const { return f; }
-    Iterator base_p() const { return pb; }
-    Iterator base_q() const { return qb; }
-  };
-  
-  template < typename Iterator, typename Functor > inline
-  bool operator==(const Homogeneous_iterator<Iterator,Functor>& x, 
-		  const Homogeneous_iterator<Iterator,Functor>& y)
-  {
-    return x.base_p() == y.base_p() && x.base_q() == y.base_q(); 
-  }
-  
-  template < typename Iterator, typename Functor > inline
-  bool operator!=(const Homogeneous_iterator<Iterator,Functor>& x, 
-		  const Homogeneous_iterator<Iterator,Functor>& y)
-  {
-    return ! (x == y);
-  }
-  
-  template < typename Kernel_ > class Iso_box_d;
-  
-  namespace Kernel_d {
-
-    template < typename RepTag > struct Coordinate_iterator;
-    
-    template <> struct Coordinate_iterator<Cartesian_tag> {
-      template < typename Point, typename Functor > 
-      struct Iterator {
-	typedef Cartesian_iterator<Point,Functor>  type;
-      };
-    };
-    
-    template <> struct Coordinate_iterator<Homogeneous_tag> {
-      template < typename Point, typename Functor > 
-      struct Iterator {
-	typedef Homogeneous_iterator<Point,Functor>  type;
-      };
-    };
-
-    template < typename Kernel_ > 
-    struct Iso_box_d_rep {
-      typedef Kernel_                   Kernel;
-      friend class Iso_box_d<Kernel>;
-      
-    protected:
-
-      typedef typename Kernel::Point_d  Point_d;
-      Point_d lower, upper;
-
-    public:
-
-      Iso_box_d_rep() {}
-      
-      template < typename InputIteratorI, typename InputIteratorII >
-      Iso_box_d_rep(int dim,
-		    InputIteratorI b1, InputIteratorI e1,
-		    InputIteratorII b2, InputIteratorII e2)
-	: lower(dim, b1, e1), upper(dim, b2, e2)
-      {}
-      
-    };
-
-  } // namespace Kernel_d
-
-  template < typename Kernel_ > 
-  class Iso_box_d : public Handle_for< Kernel_d::Iso_box_d_rep<Kernel_> > 
-  { 
-
-  public:
-    typedef Kernel_                   Kernel;
-    typedef Kernel_                   R;
-    
-  protected:
-
-    typedef Kernel_d::Iso_box_d_rep<Kernel>  Rep;
-    typedef Handle_for<Rep>                  Base;
-    typedef Iso_box_d<Kernel>                Self;
-
-    using Base::ptr;
-
-    typedef typename Kernel::RT       RT;
-    typedef typename Kernel::FT       FT;
-    typedef typename Kernel::Point_d  Point_d;
-    typedef typename Kernel::Rep_tag  Rep_tag;
-   
-    typedef CGAL::Kernel_d::Coordinate_iterator<Rep_tag>           CIRT;
-    typedef typename CIRT::template Iterator<Point_d,Min<RT> >::type  MinIter;
-    typedef typename CIRT::template Iterator<Point_d,Max<RT> >::type  MaxIter;
-
-    typedef Kernel_d::Begin            Begin; 
-    typedef Kernel_d::End              End; 
-    typedef Kernel_d::Cartesian_end    Cartesian_end; 
-
-    RT volume_nominator() const
-    {
-      typedef typename CIRT::template Iterator<Point_d,std::minus<RT> >::type
-	      Iter;
-      Iter b(ptr()->upper, ptr()->lower, Begin());
-      Iter e(ptr()->upper, ptr()->lower, Cartesian_end());
-      return std::accumulate(b, e, RT(1), std::multiplies<RT>());
-    }
-    
-    RT volume_denominator() const
-    {
-      RT den = 
-	ptr()->lower.homogeneous(dimension()) * 
-	ptr()->upper.homogeneous(dimension());
-      RT prod = den;
-      for (int i = 1; i < dimension(); ++i)
-	prod *= den;
-      return prod;
-    }
-    
-    FT volume(Homogeneous_tag) const
-    { 
-      return FT(volume_nominator(), volume_denominator());
-    }
-    
-    FT volume(Cartesian_tag) const
-    { 
-      return volume_nominator();
-    }
-    
-public:
-
-    typedef CGAL::Dynamic_dimension_tag Ambient_dimension;
-    typedef CGAL::Dynamic_dimension_tag Feature_dimension;
-
-    Iso_box_d() {}
-    
-    Iso_box_d(const Point_d& p, const Point_d& q)
-      : Base(Rep(p.dimension(), 
-		 MinIter(p, q, Begin()), MinIter(p, q, End()),
-		 MaxIter(p, q, Begin()), MaxIter(p, q, End())))
-    { 
-      CGAL_precondition(p.dimension() == q.dimension());
-    }
-    
-    Bounded_side bounded_side(const Point_d& p) const
-    { 
-      CGAL_precondition(p.dimension() == dimension());
-      typedef typename CIRT::template Iterator<Point_d,Compare<RT> >::type
-	      Iter;
-      
-      Iter il(p, ptr()->lower, Begin());
-      Iter ilend(p, ptr()->lower, Cartesian_end());
-      Iter iu(p, ptr()->upper, Begin());
-      CGAL_assertion_code(Iter iuend(p, ptr()->upper, Cartesian_end()));
-      
-      for (; il != ilend; ++il, ++iu) {
-	CGAL_assertion(iu != iuend);
-	Comparison_result low = *il;
-	Comparison_result upp = *iu;
-	if (low == LARGER && upp == SMALLER) continue;
-	if (low == SMALLER || upp == LARGER) return ON_UNBOUNDED_SIDE;
-	return ON_BOUNDARY;
-      }
-      return ON_BOUNDED_SIDE;
-    }
-
-    bool has_on_bounded_side(const Point_d& p) const
-    { 
-      return (bounded_side(p)==ON_BOUNDED_SIDE);
-    } 
-
-    bool has_on_unbounded_side(const Point_d& p) const
-    {
-      return (bounded_side(p)==ON_UNBOUNDED_SIDE); 
-    } 
-
-    bool has_on_boundary(const Point_d& p) const
-    {
-      return (bounded_side(p)==ON_BOUNDARY); 
-    } 
-
-    int dimension() const { return ptr()->lower.dimension();}
-    
-    // FIXME!
-    FT min_coord(int i) const { return ptr()->lower[i]; }
-
-    FT max_coord(int i) const { return ptr()->upper[i]; }
-
-    const Point_d& min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return ptr()->lower; }
-
-    const Point_d& max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return ptr()->upper; }
-
-    FT volume() const { return volume(Rep_tag()); }
-    
-    bool is_degenerate() const
-    {
-      typedef typename CIRT::
-	      template Iterator<Point_d,std::equal_to<RT> >::type Iter;
-      // omit homogenizing coordinates
-      Iter e(ptr()->lower, ptr()->upper, Cartesian_end());
-      return 
-	e != std::find(Iter(ptr()->lower, ptr()->upper, Begin()), e, true);
-    }
-
-}; // end of class
-
-template < typename Kernel >
-inline bool
-operator==(const Iso_box_d<Kernel>& b1, Iso_box_d<Kernel>& b2)
-{
-  CGAL_precondition(b1.dimension() == b2.dimension());
-  return (b1.min)() == (b2.min)() && (b1.max)() == (b2.max)();
-}
-
-template < typename Kernel >
-inline bool
-operator!=(const Iso_box_d<Kernel>& b1, Iso_box_d<Kernel>& b2)
-{
-  return ! (b1 == b2); 
-}
-
-} // namespace CGAL
-
-#endif // CGAL_ISO_BOX_D_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/PVDHACd_impl.h b/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/PVDHACd_impl.h
deleted file mode 100644
index dd9213a..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/PVDHACd_impl.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (c) 1997-2000  
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved. 
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Michael Seel <seel at mpi-sb.mpg.de>
-
-#if defined(CGAL_POINTCD_H) && defined(CGAL_VECTORCD_H) && \
-    defined(CGAL_DIRECTIONCD_H) && defined(CGAL_HYPERPLANECD_H) && \
-    defined(CGAL_AFF_TRANSFORMATIONCD_H) && !defined(CGAL_PVDHACD_C)
-#define CGAL_PVDHACD_C
-
-#include <CGAL/Kernel_d/PointCd_impl.h>
-#include <CGAL/Kernel_d/VectorCd_impl.h>
-#include <CGAL/Kernel_d/DirectionCd_impl.h> 
-#include <CGAL/Kernel_d/HyperplaneCd_impl.h>
-#include <CGAL/Kernel_d/Aff_transformationCd_impl.h>
-
-#endif //CGAL_PVDHACD_C
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/PVDHAHd_impl.h b/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/PVDHAHd_impl.h
deleted file mode 100644
index 1173498..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/PVDHAHd_impl.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (c) 1997-2000  
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved. 
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Michael Seel <seel at mpi-sb.mpg.de>
-
-#if defined(CGAL_POINTHD_H) && defined(CGAL_VECTORHD_H) && \
-    defined(CGAL_DIRECTIONHD_H) && defined(CGAL_HYPERPLANEHD_H) && \
-    defined(CGAL_AFF_TRANSFORMATIONHD_H) && !defined(CGAL_PVDHAHD_C)
-#define CGAL_PVDHAHD_C
-
-#include <CGAL/Kernel_d/PointHd_impl.h>
-#include <CGAL/Kernel_d/VectorHd_impl.h>
-#include <CGAL/Kernel_d/DirectionHd_impl.h> 
-#include <CGAL/Kernel_d/HyperplaneHd_impl.h>
-#include <CGAL/Kernel_d/Aff_transformationHd_impl.h>
-
-#endif //CGAL_PVDHAHD_C
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Point_d.h b/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Point_d.h
deleted file mode 100644
index 6f94346..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Point_d.h
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright (c) 2000,2001  
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved. 
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Michael Seel
-
-#ifndef CGAL_POINT_D_H
-#define CGAL_POINT_D_H
-
-#include <CGAL/Dimension.h>
-#include <CGAL/Origin.h>
-
-namespace CGAL {
-
-
-template <class pR>
-  class Direction_d;
-
-template <class pR>
-  class Vector_d;
-
-
-template <class pR>
-class Point_d : public pR::Point_d_base
-{ public:
-  typedef typename pR::Point_d_base Base;
-  typedef Point_d<pR>               Self;
-  typedef pR R;
-private:
-  typedef typename R::RT RT;
-  typedef typename R::FT FT;
-  typedef typename R::LA LA;
-public:
-
-  typedef CGAL::Dynamic_dimension_tag Ambient_dimension;
-  typedef CGAL::Dimension_tag<0>      Feature_dimension;
-    template < typename Kernel2 >
-	struct WithAnotherKernel
-	{
-	    typedef Point_d<Kernel2>  Type;
-	};
-
-  Point_d(int d=0) : Base(d) {}
-  Point_d(int d, const Origin &o) : Base(d,o) {}
-
-  Point_d(int a, int b, int c = 1) : 
-    Base(RT(a),RT(b),RT(c)) {} 
-  Point_d(const RT& a, const RT& b, const RT& c = 1) :
-    Base(a,b,c) {}  
-  Point_d(int a, int b, int c, int d) : 
-    Base(RT(a),RT(b),RT(c),RT(d)) {}
-  Point_d(const RT& a, const RT& b, const RT& c, const RT& d) :
-    Base(a,b,c,d) {}
-
-  template <class InputIterator>
-  Point_d (int d, InputIterator first, InputIterator last)
-    : Base (d, first, last) {}
-  template <class InputIterator>
-  Point_d(int d, InputIterator first, InputIterator last, const RT& D)
-    : Base (d, first, last, D) {}
-
-  Point_d(const Self &p) : Base(p) {}
-  Point_d(const Base& p) : Base(p) {}
- 
-  Vector_d<R> operator-(const Origin& o) const 
-  { return Base::operator-(o); }
-  Vector_d<R> operator-(const Self& q) const
-  { return Base::operator-(q); }
-  Self operator+(const Vector_d<R>& v) const
-  { return Base::operator+(v); }
-  Self operator-(const Vector_d<R>& v) const
-  { return Base::operator-(v); }
-  Self& operator+=(const Vector_d<R>& v) 
-  { return static_cast<Self&>(Base::operator+=(v)); }
-  Self& operator-=(const Vector_d<R>& v)
-  { return static_cast<Self&>(Base::operator-=(v)); }
-  
-};
-
-} //namespace CGAL
-#endif //CGAL_POINT_D_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Cartesian.h b/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Cartesian.h
deleted file mode 100644
index 5b1a42b..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Cartesian.h
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright (c) 2005  Stanford University (USA).
-// 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(s)     : Daniel Russel <drussel at alumni.princeton.edu>
-
-#ifndef CGAL_KINETIC_KINETIC_KERNEL_H
-#define CGAL_KINETIC_KINETIC_KERNEL_H
-#include <CGAL/Kinetic/basic.h>
-#include <CGAL/Kinetic/internal/Kernel/Cartesian_kinetic_kernel_base.h>
-
-namespace CGAL { namespace Kinetic {
-
-//! A kinetic kernel using cartesian coordinates
-/*!  It takes a PolynomialKernel as a template parameter. The
-  PolynomialKernel is used to define the Motion_function and the
-  Certificate_function.
-*/
-template <class Function_kernel_k>
-class Cartesian:
-  public internal::Cartesian_kinetic_kernel_base<Function_kernel_k,
-						 Cartesian<Function_kernel_k> >
-{
-  typedef internal::Cartesian_kinetic_kernel_base<Function_kernel_k,
-						  Cartesian<Function_kernel_k> > P;
-public:
-  //typedef Function_kernel_k Function_kernel;
-  Cartesian(Function_kernel_k pk): P(pk){}
-  Cartesian(){}
-};
-
-} } //namespace CGAL::Kinetic
-
-//#include <CGAL/Kinetic_internals/kernel_undefs.h>
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Default_instantaneous_kernel.h b/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Default_instantaneous_kernel.h
deleted file mode 100644
index 9cb1f89..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Default_instantaneous_kernel.h
+++ /dev/null
@@ -1,388 +0,0 @@
-// Copyright (c) 2005  Stanford University (USA).
-// 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(s)     : Daniel Russel <drussel at alumni.princeton.edu>
-
-#ifndef CGAL_CARTESIAN_DEFAULT_INSTANTANEOUS_KERNEL_H
-#define CGAL_CARTESIAN_DEFAULT_INSTANTANEOUS_KERNEL_H
-
-#include <CGAL/Kinetic/basic.h>
-#include <CGAL/Kinetic/internal/Instantaneous_adaptor.h>
-#include <CGAL/Simple_cartesian.h>
-#include <CGAL/Filtered_kernel.h>
-#include <map>
-#include <iostream>
-#include <CGAL/Kinetic/Ref_counted.h>
-#include <CGAL/Kinetic/internal/To_static.h>
-//#include <CGAL/Kinetic/Cartesian_static_converter.h>
-
-#define CGAL_MSA(Pred, pred, Arg, d) typedef Instantaneous_adaptor<typename Static_kernel::Pred##_##d, typename Kinetic_kernel::Pred##_##d, Rep, Arg> Pred##_##d; \
-  Pred##_##d pred##_##d##_object() const				\
-  {									\
-    typename Static_kernel::Pred##_##d sp= rep_->static_kernel().pred##_##d##_object();	\
-    typename Kinetic_kernel::Pred##_##d kp= rep_->kinetic_kernel().pred##_##d##_object();	\
-    return Pred##_##d(rep_, sp, kp);		\
-  }
-
-#define CGAL_TSO(name) typedef typename Static_kernel::name name
-
-namespace CGAL { namespace Kinetic {
-
-template <class CIK>
-class Default_instantaneous_kernel_rep: public Ref_counted<Default_instantaneous_kernel_rep<CIK> >
-{
-public:
-  typedef typename CIK::Traits Traits;
-  typedef typename Traits::Static_kernel Static_kernel;
-  typedef typename Traits::Kinetic_kernel Kinetic_kernel;
-
-  typedef typename Kinetic_kernel::Point_1::template Static_traits<Static_kernel> Static_traits_point_1;
-  typedef typename Kinetic_kernel::Point_2::template Static_traits<Static_kernel> Static_traits_point_2;
-  typedef typename Kinetic_kernel::Point_3::template Static_traits<Static_kernel> Static_traits_point_3;
-  typedef typename Kinetic_kernel::Weighted_point_3::template Static_traits<Static_kernel> Static_traits_weighted_point_3;
-
-  typedef typename Static_kernel::FT NT;
-  typedef typename CIK::Traits::Simulator::Time Time;
-
-  Default_instantaneous_kernel_rep(Traits tr): tr_(tr) {
-    initialized_=false;
-    time_is_nt_=false;
-  }
-  
-  template <class T>
-  void set_time(const T &t, bool limit) {
-    if (!initialized_) {
-      time_is_nt_=false;
-      time_=t;
-    } else {
-      if ((!time_is_nt_ && time_ != t) || time_is_nt_) {
-	time_is_nt_=false;
-	time_=t;
-	cache_1_.clear();
-	cache_2_.clear();
-	cache_3_.clear();
-      }
-    }
-    initialized_=true;
-    after_=limit;
-  }
-
-  void set_time(const NT &t, bool limit)
-  {
- 
-    
-    if (initialized_ && ((time_is_nt_ && time_nt_ != t) || !time_is_nt_)) {
-      cache_1_.clear();
-      cache_2_.clear();
-      cache_3_.clear();
-    }
-    time_is_nt_=true;
-    time_nt_=t;
-    time_= Time(t);
-
-    initialized_=true;
-    after_=limit;
-  }
-
-  bool time_after() const {
-    return after_;
-  }
-
-  bool initialized() const {
-    return initialized_;
-  }
-  bool time_is_nt() const {
-    return time_is_nt_;
-  }
-
-  const NT & time_as_nt() const
-  {
-    CGAL_precondition(initialized_);
-    CGAL_precondition(time_is_nt());
-    return time_nt_;
-  }
-  
-  const Time &time() const
-  {
-    CGAL_precondition(initialized_);
-    return time_;
-  }
-  
-  void check_static_object() const {
-#ifndef NDEBUG
-    if (!initialized_) {
-      std::cerr << "The InstantaneousKernel (or one of its predicates) was\n";
-      std::cerr << "used without the time being set. This probably is the sign\n";
-      std::cerr << "of misusing it--specifically make sure you store a copy\n";
-      std::cerr << "from the SimulatorTraits and get predicates from it.\n";
-    }
-#endif
-    if (!time_is_nt()) {
-        std::cerr << "You can only compute static objects when the IK current\n";
-        std::cerr << "time is an FT, rather than a root.\n";
-	CGAL_error();
-    }
-  }
-
-  typedef typename CIK::Traits::Active_points_1_table::Data::template Static_traits<Static_kernel> Static_traits_1;
-
-  const typename Static_traits_1::Static_type&
-  static_object(typename CIK::Point_1 k) const {
-    check_static_object();
-    if (cache_1_.find(k) == cache_1_.end()) {
-      cache_1_[k]= Static_traits_1::to_static(tr_.active_points_1_table_handle()->at(k), 
-					      time_nt_, static_kernel());
-      //std::cout << "Point " << k << " is " << cache_1_[k] << std::endl;
-    }
-    return cache_1_[k];
-  }
-
-  typedef typename CIK::Traits::Active_points_2_table::Data::template Static_traits<Static_kernel> Static_traits_2;
-
-  const typename Static_traits_2::Static_type&
-  static_object(typename CIK::Point_2 k) const {
-    check_static_object();
-    if (cache_2_.find(k) == cache_2_.end()) {
-      cache_2_[k]= Static_traits_2::to_static(tr_.active_points_2_table_handle()->at(k), 
-					      time_nt_, static_kernel());
-    }
-    return cache_2_[k];
-  }
-
-  typedef typename CIK::Traits::Active_points_3_table::Data::template Static_traits<Static_kernel> Static_traits_3;
-
-  const typename Static_traits_3::Static_type&
-  static_object(typename CIK::Point_3 k) const {
-    check_static_object();
-    if (cache_3_.find(k) == cache_3_.end()) {
-      cache_3_[k]= Static_traits_3::to_static(tr_.active_points_3_table_handle()->at(k), 
-					      time_nt_, static_kernel());
-    }
-    return cache_3_[k];
-  }
-
-  /*const typename Static_kernel::Weighted_point_3&
-  static_object(typename CIK::Weighted_point_3 k) const {
-    check_static_object();
-    if (cache_w3_.find(k) == cache_w3_.end()) {
-      const typename Kinetic_kernel::Weighted_point_3 &wp= tr_.active_weighted_points_3_table_handle()->at(k);
-      cache_w3_[k]= typename Static_kernel::Weighted_point_2(Static_kernel::Point_2(wp.point().x()(time_),
-										    wp.point().y()(time_),
-										    wp.point().z()(time_)),
-							     wp.weight()(time_));
-    }
-    return cache_w3_[k];
-    }*/
-
-  const typename CIK::Traits::Active_points_1_table::Data&
-  kinetic_object(typename CIK::Point_1 k) const {
-    return tr_.active_points_1_table_handle()->at(k);
-    
-  }
-
-  const typename CIK::Traits::Active_points_2_table::Data&
-  kinetic_object(typename CIK::Point_2 k) const {
-    return tr_.active_points_2_table_handle()->at(k);
-  }
-
-  const typename CIK::Traits::Active_points_3_table::Data&
-  kinetic_object(typename CIK::Point_3 k) const {
-    return tr_.active_points_3_table_handle()->at(k);
-  }
-
-  
-  
-  const Static_kernel& static_kernel() const
-  {
-    return tr_.static_kernel_object();
-  }
-  
-  const Kinetic_kernel& kinetic_kernel() const
-  {
-    return tr_.kinetic_kernel_object();
-  }
-protected:
-  mutable bool initialized_;
-  bool time_is_nt_;
-  typename CIK::Traits tr_;
-  mutable std::map<typename CIK::Point_1,
-		   typename Static_traits_1::Static_type> cache_1_;
-  mutable std::map<typename CIK::Point_2,
-		   typename Static_traits_2::Static_type> cache_2_;
-  mutable std::map<typename CIK::Point_3,
-		   typename Static_traits_3::Static_type> cache_3_;
-  /*mutable std::map<typename CIK::Weighted_point_3,
-    typename Static_kernel::Weighted_point_3> cache_w3_;*/
-  NT time_nt_;
-  Time time_;
-  bool after_;
-};
-
-
-template <class Traitst >
-class Default_instantaneous_kernel
-{
-  typedef Default_instantaneous_kernel<Traitst> This;
-public:
-  typedef Traitst Traits;
-  typedef Default_instantaneous_kernel_rep< This>  Rep;
-  typedef typename Traits::Static_kernel Static_kernel;
-  typedef typename Traits::Kinetic_kernel Kinetic_kernel;
-  typedef typename Static_kernel::FT NT;
-  typedef typename Traits::Simulator::Time Time;
-
-  CGAL_static_assertion((boost::is_convertible<NT, Time>::value));
-  CGAL_static_assertion((boost::is_convertible<Time, typename Kinetic_kernel::Certificate::Time>::value));
-  CGAL_static_assertion((boost::is_convertible<typename Kinetic_kernel::Certificate::Time,
-  Time>::value));
-
-  Default_instantaneous_kernel(const Traits &tr):
-    rep_(new Rep(tr)) {
-  }
-  template <class N>
-  void set_time(const N &cur_time) const
-  {
-    rep_->set_time(cur_time, false);
-  }
-
-  void set_time(const Time &cur_time) const
-  {
-    rep_->set_time(cur_time, false);
-  }
-
-  template <class N>
-  void set_time_to_after(const N &cur_time) const
-  {
-    rep_->set_time(cur_time, true);
-  }
-
-  void set_time_to_after(const Time &cur_time) const
-  {
-    rep_->set_time(cur_time, true);
-  }
- 
-  bool time_is_nt() const {
-    return rep_->time_is_nt();
-  }
-
-  const NT & time_as_nt() const
-  {
-    return rep_->time_as_nt();
-  }
-  
-  const Time & time() const
-  {
-   
-    return rep_->time();
-   
-  }
-
-  bool has_time() const {
-    return rep_->initialized();
-  }
-
-  typedef typename Static_kernel::RT RT;
-  typedef typename Static_kernel::FT FT;
-
-  typedef typename Traits::Active_points_1_table::Key Point_1;
-  typedef typename Traits::Active_points_2_table::Key Point_2;
-  typedef typename Traits::Active_points_3_table::Key Point_3;
-  //typedef typename Traits::Active_points_3_table::Key Bare_point;
-  //typedef typename Traits::Active_weighted_points_3_table::Key Weighted_point_3;
-
-  struct Current_coordinates {
-    Current_coordinates(typename Rep::Handle rep): rep_(rep){}
-   
-    const FT  & operator()(Point_1 k) const {
-      return rep_->static_object(k);
-    }
-    const typename Static_kernel::Point_2  & operator()(Point_2 k) const {
-      return rep_->static_object(k);
-    }
-    const typename Static_kernel::Point_3  & operator()(Point_3 k) const {
-      return rep_->static_object(k);
-    }
-    /*const typename Static_kernel::Weighted_point_3  & operator()(Weighted_point_3 k) const {
-      return rep_->static_object(k);
-      }*/
-    typename Rep::Handle rep_;
-  };
-
-  Current_coordinates current_coordinates_object() const {
-    return Current_coordinates(rep_);
-  }
-
-
-  template <class T>
-  class Compare_static {
-  public:
-    typedef CGAL::Comparison_result result_type;
-    typedef T first_argument_type;
-    typedef T second_argument_type;
-    result_type operator()(const T &a, const T&b) const {
-      return CGAL::compare(a,b);
-    }
-  };
-
-  typedef Instantaneous_adaptor<Compare_static<RT>, typename Kinetic_kernel::Compare_x_1, Rep, Point_1> Compare_x_1;
-  Compare_x_1 compare_x_1_object() const
-  {
-    Compare_static<NT> sp;
-    return Compare_x_1(rep_, sp, rep_->kinetic_kernel().compare_x_1_object());
-  }
-
-  CGAL_MSA(Side_of_oriented_circle,side_of_oriented_circle, Point_2, 2);
-  CGAL_MSA(Orientation,orientation, Point_2, 2);
-  CGAL_MSA(Compare_x, compare_x, Point_2, 2);
-  CGAL_MSA(Compare_y,compare_y, Point_2, 2);
-  /*CGAL_MSA(Compare_x, compare_x, Point_2, 2);
-    CGAL_MSA(Compare_y, compare_y, Point_2, 2);*/
-  CGAL_MSA(Compare_distance, compare_distance, Point_2, 2);
-  CGAL_MSA(Compare_distance, compare_distance, Point_3, 3);
-  CGAL_TSO(Segment_2);
-  CGAL_TSO(Triangle_2);
-
-  CGAL_MSA(Side_of_oriented_sphere,side_of_oriented_sphere, Point_3, 3);
-  CGAL_MSA(Orientation,orientation, Point_3, 3);
-  CGAL_MSA(Compare_x,compare_x, Point_3, 3);
-  CGAL_MSA(Compare_y,compare_y, Point_3, 3);
-  CGAL_MSA(Compare_z,compare_z, Point_3, 3);
-  CGAL_MSA(Compare_xyz,compare_xyz, Point_3, 3);
-  /*CGAL_MSA(Less_x, less_x, Point_3, 3);
-  CGAL_MSA(Less_y, less_y, Point_3, 3);
-  CGAL_MSA(Less_z, less_z, Point_3, 3);*/
-  CGAL_MSA(Coplanar_orientation, coplanar_orientation, Point_3, 3);
-  CGAL_MSA(Coplanar_side_of_bounded_circle, coplanar_side_of_bounded_circle, Point_3, 3);
-  //CGAL_MSA(Power_test,power_test, Weighted_point_3, 3);
-
-
-  
-  CGAL_TSO(Segment_3);
-  CGAL_TSO(Triangle_3);
-  CGAL_TSO(Tetrahedron_3);
-  CGAL_TSO(Line_3);
-  CGAL_TSO(Ray_3);
-  CGAL_TSO(Object_3);
-  CGAL_TSO(Plane_3);
-protected:
-  typename Rep::Handle rep_;
-};
-#undef CGAL_MSA
-#undef CGAL_TSO
-} } //namespace CGAL::Kinetic
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Regular_triangulation_instantaneous_kernel.h b/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Regular_triangulation_instantaneous_kernel.h
deleted file mode 100644
index f058ad3..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Regular_triangulation_instantaneous_kernel.h
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright (c) 2005  Stanford University (USA).
-// 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(s)     : Daniel Russel <drussel at alumni.princeton.edu>
-
-#ifndef CGAL_CARTESIAN_REGULAR_INSTANTANEOUS_KERNEL_H
-#define CGAL_CARTESIAN_REGULAR_INSTANTANEOUS_KERNEL_H
-#include <CGAL/Kinetic/basic.h>
-#include <CGAL/Kinetic/Default_instantaneous_kernel.h>
-#include <CGAL/Simple_cartesian.h>
-#include <CGAL/Filtered_kernel.h>
-#include <map>
-#include <iostream>
-#include <CGAL/Kinetic/Ref_counted.h>
-#include <CGAL/Kinetic/internal/To_static.h>
-//#include <CGAL/Kinetic/Cartesian_static_converter.h>
-
-/*#define CGAL_MSA(Pred, pred, Arg, d) typedef Instantaneous_adaptor<typename Static_kernel::Pred##_##d, Current_coordinates, Arg> Pred##_##d; \
-  Pred##_##d pred##_##d##_object() const				\
-  {									\
-    typename Static_kernel::Pred##_##d sp= rep_->static_kernel().pred##_##d##_object();	\
-    return Pred##_##d(current_coordinates_object(), sp);		\
-    }*/
-
-/*#define CGAL_TSO(name) typedef typename Static_kernel::name name*/
-
-#define CGAL_MSA(Pred, pred, Arg, d) typedef Instantaneous_adaptor<typename P::Static_kernel::Pred##_##d, typename P::Kinetic_kernel::Pred##_##d, typename P::Rep, Arg> Pred##_##d; \
-  Pred##_##d pred##_##d##_object() const				\
-  {									\
-    typename P::Static_kernel::Pred##_##d sp= P::rep_->static_kernel().pred##_##d##_object(); \
-    typename P::Kinetic_kernel::Pred##_##d kp= P::rep_->kinetic_kernel().pred##_##d##_object(); \
-    return Pred##_##d(P::rep_, sp, kp);					\
-  }
-
-
-namespace CGAL { namespace Kinetic {
-
-
-template <class Traitst >
-class Regular_triangulation_instantaneous_kernel: public Default_instantaneous_kernel<Traitst>
-{
-  typedef Regular_triangulation_instantaneous_kernel<Traitst> This;
-public:
-  typedef Traitst Traits;
-  typedef Default_instantaneous_kernel<Traitst> P;
-
-  //using P::Time;
-  //using P::NT;
-
-  Regular_triangulation_instantaneous_kernel(const Traits &tr): P(tr) {
-  }
-
-  /*using typename P::Point_1;
-  using typename P::Point_2;
-  using typename P::Point_3;*/
-  typedef typename P::Point_3 Bare_point;
-  typedef typename P::Point_3 Weighted_point_3;
-  //typedef P::Static_kernel Static_kernel;
-
-  CGAL_MSA(Power_test,power_test, Weighted_point_3, 3);
-  CGAL_MSA(Equal, equal, Weighted_point_3, 3);
-};
-#undef CGAL_MSA
-
-} } //namespace CGAL::Kinetic
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Triangulation_2.h b/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Triangulation_2.h
deleted file mode 100644
index 6459da8..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Triangulation_2.h
+++ /dev/null
@@ -1,759 +0,0 @@
-// Copyright (c) 2005  Stanford University (USA).
-// 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(s)     : Daniel Russel <drussel at alumni.princeton.edu>
-
-#ifndef CGAL_KINETIC_KINETIC_TRIANGULATION_2_H
-#define CGAL_KINETIC_KINETIC_TRIANGULATION_2_H
-#include <CGAL/Kinetic/basic.h>
-
-#include <CGAL/Kinetic/Triangulation_face_base_2.h>
-#include <CGAL/Kinetic/Triangulation_vertex_base_2.h>
-#include <CGAL/Kinetic/Triangulation_visitor_base_2.h>
-#include <CGAL/Kinetic/Active_objects_batch_listener_helper.h>
-#include <CGAL/Kinetic/Simulator_kds_listener.h>
-#include <CGAL/Kinetic/internal/tds_2_helpers.h>
-#include <CGAL/Triangulation_2.h>
-#include <CGAL/Kinetic/Ref_counted.h>
-#include <iterator>
-#include <CGAL/Kinetic/Event_base.h>
-#include <CGAL/Kinetic/Triangulation_default_traits_2.h>
-
-namespace CGAL { namespace Kinetic {
-#ifdef NDEBUG
-#define CGAL_TRIANGULATION_2_DEBUG(x)
-#else
-#define CGAL_TRIANGULATION_2_DEBUG(x) x
-#endif
-
-template <class KDel>
-struct Triangulation_event: public Event_base<KDel*> {
-  typedef Event_base<KDel*>  P;
-  Triangulation_event(const typename KDel::Face_handle &e,
-		      KDel *kdel): P(kdel), e_(e) {}
-  const typename KDel::Face_handle face() const {
-    return e_;
-  }
-  KDel* kdel() {
-    return P::kds();
-  }
-
-  KDel* kdel() const {
-    return P::kds();
-  }
-  void process() {
-    kdel()->handle_failure(e_);
-  }
-
-  void audit(typename KDel::Event_key k) const {
-    kdel()->audit_event(k, e_);
-  }
-
-  CGAL::Comparison_result compare_concurrent(typename KDel::Event_key a,
-					     typename KDel::Event_key b) const {
-    return kdel()->compare_concurrent(a, b);
-  }	
-
-  std::ostream& write(std::ostream &out) const
-  {
-    out << "Face " << e_->vertex(0)->point() << ", "
-        << e_->vertex(1)->point() 
-        << ", " << e_->vertex(2)->point() ;
-    return out;
-  }
-  const typename KDel::Face_handle e_;
-};
-
-
-
-
-
-//! A 2D kinetic triangulation.
-/*!  There is one certificate for each face. For the internal faces
-  (inside the convex hull), that certificate is for the face
-  collapsing at which point we need to figure out which edge to flip.
-
-  For the faces outside the convex hull, the certificate is for the
-  edge that is CCW from the infinite vertex and for whether the other
-  vertex on the edge leaves the convex hull.
-
-  The annoying part is how to figure out which edge to flip when an
-  internal face collapses.  As far as I can tell this requires
-  evaluating which point is in the segment defined by which other two,
-  so four 1D orientation predicates.
-*/
-template <class Simulation_traits_t, 
-          class Visitor= Triangulation_visitor_base_2,
-          class Tri
-          = CGAL::Triangulation_2<typename Simulation_traits_t::Instantaneous_kernel,
-                                           CGAL::Triangulation_data_structure_2<
-            Triangulation_vertex_base_2<typename Simulation_traits_t::Instantaneous_kernel>,
-  CGAL::Kinetic::Triangulation_face_base_2<Simulation_traits_t > > >,
-          class Triangulation_traits_t= Triangulation_default_traits_2<Simulation_traits_t, Tri> >
-class Triangulation_2:
-  public Ref_counted<Triangulation_2<Simulation_traits_t, Visitor, Tri, Triangulation_traits_t> >
-{
-
-  typedef CGAL::Triangulation_2<typename Simulation_traits_t::Instantaneous_kernel,
-                                         CGAL::Triangulation_data_structure_2<
-    Triangulation_vertex_base_2<typename Simulation_traits_t::Instantaneous_kernel>,
-    CGAL::Kinetic::Triangulation_face_base_2<Simulation_traits_t > > > Basic_Delaunay;
-
-public:
-  typedef Triangulation_traits_t Traits;
-  typedef Simulation_traits_t Simulation_traits;
-  typedef Triangulation_2<Simulation_traits, Visitor, Tri, Traits> This;
-
-  typedef typename Simulation_traits::Kinetic_kernel Kinetic_kernel;
-  typedef typename Simulation_traits::Simulator Simulator;
-  typedef typename Simulation_traits::Active_points_2_table Moving_point_table;
-
-  typedef typename Moving_point_table::Key Point_key;
-  typedef typename Simulator::Event_key Event_key;
-  //typedef typename Simulator::Root_stack Root_stack;
-
-  typedef typename Traits::Triangulation Triangulation;
-
-  typedef typename Triangulation::Edge_circulator Edge_circulator;
-  typedef typename Triangulation::Face_circulator Face_circulator;
-  typedef typename Triangulation::Finite_edges_iterator Finite_edges_iterator;
-  //typedef typename Triangulation::Edge_iterator Edge_iterator;
-
-  typedef typename Triangulation::Geom_traits::Point_2 Del_point;
-
-  typedef typename Triangulation::Vertex_handle Vertex_handle;
-  typedef typename Triangulation::Face_handle Face_handle;
-  typedef typename Triangulation::Edge Edge;
-  typedef typename Triangulation::All_faces_iterator Face_iterator;
-  typedef typename Triangulation::All_edges_iterator Edge_iterator;
-  typedef typename Traits::Certificate_data Certificate_data;
-  typedef typename Traits::Time Time;
-  typedef internal::Triangulation_data_structure_helper_2<typename Triangulation::Triangulation_data_structure> TDS_helper;
-
-  typedef Triangulation_event<This> Event;
-  
-  //friend class Delaunay_edge_failure_event<This>;
-  //friend class Delaunay_hull_edge_failure_event<This>;
-
-  typedef typename CGAL::Kinetic::Simulator_kds_listener<typename Simulator::Listener, This> Simulator_listener;
-  friend  class CGAL::Kinetic::Simulator_kds_listener<typename Simulator::Listener, This>;
-  typedef typename CGAL::Kinetic::Active_objects_batch_listener_helper<typename Moving_point_table::Listener, This> Moving_point_table_listener;
-  friend class CGAL::Kinetic::Active_objects_batch_listener_helper<typename Moving_point_table::Listener, This>;
-
-  /*struct Compare_edges{
-    bool operator()(const Edge &a, const Edge &b) const {
-      Point_key a0, a1, b0, b1;
-      a0= a.first->vertex((a.second+1)%3)->point();
-      a1= a.first->vertex((a.second+2)%3)->point();
-      b0= b.first->vertex((b.second+1)%3)->point();
-      b1= b.first->vertex((b.second+2)%3)->point();
-      if (a0 > a1) std::swap(a0, a1);
-      if (b0 > b1) std::swap(b0, b1);
-      if (a0 < b0) return true;
-      else if (a0 > b0) return false;
-      else return a1 < b1;
-    }
-    };*/
-
-  void init_data(bool insert) {
-    siml_ = Simulator_listener(traits_.simulator_handle(), this);
-    motl_= Moving_point_table_listener(traits_.active_points_2_table_handle(), this, insert);
-    has_certificates_=false; 
-    clear_stats();
-   
-    batching_=false;
-  }
-
-public:
-
-  Triangulation_2(Traits st,
-                           Triangulation del,
-                           Visitor w= Visitor()): 
-    traits_(st),
-    watcher_(w),
-    del_(del) {
-    vhs_.resize(del_.number_of_vertices());
-    for (typename Triangulation::Vertex_iterator vit = del_.vertices_begin(); vit != del_.vertices_end(); ++vit) {
-      CGAL_assertion(vit->point().index() < del_.number_of_vertices());
-      vhs_[vit->point().index()]=vit;
-    }
-    init_data(false);
-  
-    set_has_certificates(true);
-  }
-
-  Triangulation_2(Simulation_traits st,
-		  Visitor w= Visitor()): 
-    traits_(st),
-    watcher_(w),
-    del_(traits_.instantaneous_kernel_object()) {
-    init_data(true);
-    set_has_certificates(true);
-  }
-
-
-
-  //! Just write the objects in order;
-  void write(std::ostream &out) const
-  {
-    out << del_;
-  }
-
-  void clear_stats() {
-    num_events_=0;
-    // num_single_certificates_=0;
-  }
-
-  void write_stats(std::ostream &out) const {
-    out << "Num events is " << num_events_ << std::endl;
-  }
-
-  const Triangulation &triangulation(const typename Simulator::NT &t) const
-  {
-    //update_instantaneous_kernel_time();
-    del_.geom_traits().set_time(t);
-    return del_;
-  }
-
-  const Triangulation &triangulation() const
-  {
-    return del_;
-  }
-
-
-  // for Qt_triangulation
-  /*Event_key null_event() const {
-    return traits_.simulator_handle()->null_event();
-    }*/
-
-  /*const Simulation_traits& simulation_traits_object() const {
-    return traits_;
-    }*/
-
-  typedef typename Triangulation::Triangulation_data_structure Triangulation_data_structure;
-  const Triangulation_data_structure &triangulation_data_structure() const
-  {
-    return del_.tds();
-  }
-
-  bool is_batch_editing() const {
-    return batching_;
-  }
-
-  void set_is_batch_editing(bool tf) {
-    if (tf) {
-      batching_=true;
-    } else if (batching_) {
-
-      //unsigned int num_certs= num_certificates_;
-      // this is important that it be before update
-      batching_=false;
-
-      //std::sort(batched_certs_.begin(), batched_certs_.end(), Compare_edges());
-     
-      /*batched_certs_.erase(std::unique(batched_certs_.begin(), 
-				       batched_certs_.end()), 
-				       batched_certs_.end());*/
-     
-      
-      for (unsigned int i=0; i< batched_certs_.size(); ++i){
-	//Point_key s=TDS_helper::origin(batched_certs_[i])->point();
-        //Point_key t=TDS_helper::destination(batched_certs_[i])->point();
-        
-        //std::cout << std::min(s,t) << "--" << std::max
-		//BOOST_PREVENT_MACRO_SUBSTITUTION(s,t) << std::endl;
-        update_face(batched_certs_[i]);
-      }
-      
-      batched_certs_.clear();
-      /*CGAL_LOG(CGAL::Kinetic::Log::SOME, 
-       *traits_.simulator_handle() << std::endl;);*/
-      //int dnum= num_certificates_-num_certs;
-      //std::cout << "Edit had " << dnum << " certificate computations" << std::endl;
-
-      //audit();
-    }
-  }
-  
-  /*const std::set<Edge>& recent_edges() const {
-    return new_edges_;
-    }*/
-
-  //! Verify that the current state of the
-  void audit()const;
-
-  void audit_event(Event_key k, Face_handle e) const {
-    if (e->event() !=k) {
-      std::cerr << "AUDIT FAILURE orphan event " << k << std::endl;
-    }
-    CGAL_assertion(e->event() ==k);
-  }
-
-  void set_has_certificates(bool tf, bool no_failures=false) {
-    if (tf == has_certificates_){
-
-    } else {
-      if (tf==true && del_.dimension()==2) {
-        CGAL_LOG(CGAL::Kinetic::Log::SOME, "DELAUNAY2: Creating certificates."<< std::endl);
-        if (no_failures) {
-          for (Face_iterator f = del_.all_faces_begin(); f != del_.all_faces_end(); ++f) {
-            f->set_event(traits_.simulator_handle()->null_event());
-          }
-        }  
-        /*for (typename Triangulation::All_vertices_iterator vit = del_.all_vertices_begin(); 
-	     vit != del_.all_vertices_end(); ++vit) {
-	  int deg=TDS_helper::low_degree(vit, del_.tds());
-	  CGAL_assertion(deg >=3);
-	  Vertex_handle vh= vit;
-	  vh->set_neighbors(deg);
-	  CGAL_TRIANGULATION_2_DEBUG(std::cout << "Set degree of " << vit->point() << " to " << deg << std::endl);
-          //vit->set_neighbors_is_changed(false);
-          }*/
-        if (!no_failures) {
-          for (Face_iterator eit = del_.all_faces_begin(); eit != del_.all_faces_end(); ++eit) {
-            eit->set_event(Event_key());
-            update_face(eit);
-          }
-        }
-
-        watcher_.create_faces(del_.all_faces_begin(), del_.all_faces_end());
-      } else if (tf==false) { 
-        for (Face_iterator f = del_.all_faces_begin(); f != del_.all_faces_end(); ++f) {
-          delete_certificate(f);
-        }
-      } 
-      CGAL_LOG(CGAL::Kinetic::Log::SOME, 
-		       *traits_.simulator_handle() << std::endl;);
-      has_certificates_=tf;
-    }
-  }
-  bool has_certificates() {
-    return has_certificates_;
-  }
-
-  void erase(Point_key k) {
-    CGAL_error();
-#if 0    
-    // erase all incident certificates
-    Vertex_handle vh= vertex_handle(k);
-    if (vh == Vertex_handle()) {
-      CGAL_LOG(CGAL::Kinetic::Log::SOME, "Point " << k << " is not in triangulation on removal."<< std::endl);
-      return;
-    }
-    watcher_.remove_vertex(vh);
-    Face_handle hull_cert;
-    if (has_certificates_) {
-      // have to clean up hull events which are not adjacent
-      Face_circulator fc= vh->incident_faces(), fe=fc;
-      if (fc != NULL) {
-	do {
-	  delete_certificate(fc);
-	  ++fc;
-	} while (fc != fe);
-      }
-      hull_cert= hull_face(k);
-      if (hull_cert != Face_handle()) {
-	delete_certificate(hull_cert);
-      }
-    }
-    // remove from triangulation
-    del_.geom_traits().set_time(traits_.rational_current_time());
-    del_.remove(vh);
-    //new_edges_.clear();
-    if (del_.dimension()==2 && has_certificates_) {
-      std::vector<Face_handle> faces;
-
-      del_.get_conflicts(k,std::back_inserter(faces));
-
-      if (hull_cert != Face_handle()) {
-	faces.push_back(hull_cert);
-      }
-      // update non-adjacent hull certificates
-      for (unsigned int i=0; i< faces.size(); ++i) {
-	update_face(faces[i]);
-      }
-      
-      watcher_.create_faces(faces.begin(), faces.end());
-    }
-#endif
-  }
-
-  //! The assertion will catch that the object is in the same sorted order
-  void set(Point_key k) {
-    std::cout << "Object changed " << k << std::endl;
-
-    //new_edges_.clear();
-    traits_.point_changed(k);
-    if (del_.dimension() != 2) {
-      CGAL_LOG(CGAL::Kinetic::Log::SOME,"Triangulation is still 1D.\n");
-      return;
-    }
-
-    Vertex_handle vh=vertex_handle(k);
-    if (vh == Vertex_handle()) {
-      CGAL_LOG(CGAL::Kinetic::Log::SOME, "Point " << k << " is not in triangulation on set."<< std::endl);
-      return;
-    }
-
-    if (has_certificates_) {
-      Face_circulator fc= vh->incident_faces(), fe=fc;
-      if (fc != NULL) {
-	do {
-	  delete_certificate(fc);
-	  update_face(fc);
-	  ++fc;
-	} while (fc != fe);
-      }
-      Face_handle hull_cert= hull_face(vh);
-      if (hull_cert != Face_handle()) {
-	std::cout << "Hull face is " << hull_cert->vertex(0)->point() 
-		  << ", " << hull_cert->vertex(1)->point() << ", " 
-		  << hull_cert->vertex(2)->point() << std::endl;
-	delete_certificate(hull_cert);
-	update_face(hull_cert);
-      }
-    }
-
-   
-    watcher_.modify_vertex(vh);
-
-    /*if (has_certificates_) {
-      Face_handle f= vh->face(), fe= vh->face();
-      int i= f->index(vh);
-      do {
-	//int i= fc->index(vh);
-	Edge e0(f, i);
-	update_edge(e0);
-	Edge e1=Edge(f, (i+1)%3);
-	update_edge(e1);
-	f= f->neighbor((i+1)%3);
-	i= f->index(vh);
-      } while (f != fe);
-      }*/
-    //write(std::cout);
-  }
-
-
-  void insert(Point_key k) {
-    // evil hack
-    CGAL_precondition(k.index() >= vhs_.size() || vertex_handle(k) == Vertex_handle());
-    CGAL_TRIANGULATION_2_DEBUG(std::cout << "Inserting " << k << std::endl);
-    bool was_2d= (del_.dimension()==2);
-
-    del_.geom_traits().set_time(traits_.rational_current_time());
-
-    Face_handle lf= del_.locate(k);
-
-    if (was_2d && has_certificates_) {
-      watcher_.remove_faces(&lf, &lf+1);
-      delete_certificate(lf);
-    }
-    Vertex_handle vh= del_.insert(k, lf);
-    set_vertex_handle(k, vh);
-    
-    CGAL_assertion(vertex_handle(k) != Vertex_handle());
-    
-    //CGAL_TRIANGULATION_2_DEBUG(std::cout << "Vertex " << vertex_handle(k)->point() << std::endl);
-    watcher_.create_vertex(vertex_handle(k));
-
-    // now have to update
-    if (has_certificates_) {
-      if (!was_2d && del_.dimension()==2) {
-	has_certificates_=false;
-	set_has_certificates(true); 
-      } else if (del_.dimension() == 2) {
-	set(k);
-      }
-    } 
-    //write(std::cout);
-    //if (del_.dimension()==2) audit();
-  }
-
-
-
-  Comparison_result compare_concurrent(Event_key a, Event_key b) const {
-    //Edge ea= traits_.simulator_handle()->template event<Event>(a).edge();
-    //Edge eb= traits_.simulator_handle()->template event<Event>(b).edge();
-    return traits_.compare_concurrent(a, b);
-  }
-
-
-
-  void handle_failure(Face_handle f) {
-    int infi=-1;
-    for (unsigned int i=0; i< 3; ++i) {
-      if (f->vertex(i)->point() == Point_key()) {
-	infi=i;
-	break;
-      }
-    }
-    if (infi != -1) {
-      flip(Edge(f, (infi+2)%3));
-    } else {
-      // determine which edge to flip
-      CGAL::Comparison_result cx01= traits_.compare(f->vertex(0)->point(), f->vertex(1)->point(), 0);
-      CGAL::Comparison_result cx12= traits_.compare(f->vertex(1)->point(), f->vertex(2)->point(), 0);
-      if (cx01== cx12) {
-	CGAL_precondition(cx01 != CGAL::EQUAL);
-	flip(Edge(f, 1));
-      } else {
-	CGAL::Comparison_result cx02= traits_.compare(f->vertex(0)->point(), f->vertex(2)->point(), 0);
-	if (cx02 == -cx12) {
-	  flip(Edge(f,2));
-	} else {
-	  flip(Edge(f,0));
-	}
-      }
-    }
-  }
-
-
-  void flip(const Edge &e) {
-    ++num_events_;
-    CGAL_precondition(!batching_);
-    CGAL_LOG(CGAL::Kinetic::Log::SOME, "\n\n\n\n\n\nFlipping edge "
-		     << TDS_helper::origin(e)->point()
-		     << TDS_helper::destination(e)->point() 
-		     << " to get " << TDS_helper::third_vertex(e)->point()
-		     << ", " << TDS_helper::mirror_vertex(e)->point()<< std::endl);
-    //CGAL_LOG(CGAL::Kinetic::Log::NONE, TDS_helper::destination(e)->point() << std::endl);
-    //CGAL_LOG(CGAL::Kinetic::Log::SOME, " at "  << traits_.simulator()->current_time() << std::endl);
-
-    Face_handle face= e.first;
-    int index= e.second;
-    Face_handle mirror_face = face->neighbor(index);
-    int mirror_index =face->mirror_index(index);
-    Edge em(mirror_face,mirror_index);
-    CGAL_precondition(mirror_face->neighbor(mirror_index) == face);
-
-    Face_handle bef;
-    int bei;
- 
-    CGAL_assertion (!del_.is_edge(TDS_helper::third_vertex(e), TDS_helper::mirror_vertex(e),
-				  bef, bei));/* {
-      std::cout << "Flipping edge out of the way" << std::endl;
-      flip(Edge(bef, bei));
-      }*/
-
-    //delete_certificate(face);
-    delete_certificate(mirror_face);
-    face->set_event(Event_key());
-
-   
-    watcher_.before_flip(e);
-    del_.tds().flip(face,index);
-   
-    // we also know that CGAL preserves the edge index of the flipped edge
-    //mirror_index = mirror_face->index(face);
-    //index= face->index(mirror_face);
-
-    watcher_.after_flip(Edge(face, index));
-
-    update_face(face);
-    update_face(mirror_face);
-    for (unsigned int i=0; i< 3; ++i) {
-      if (face->vertex(i)->point() == Point_key()) {
-	if (face->neighbor((i+1)%3) != mirror_face) {
-	  delete_certificate(face->neighbor((i+1)%3));
-	  update_face(face->neighbor((i+1)%3));
-	}
-      } 
-      if (mirror_face->vertex(i)->point() == Point_key()) {
-	if (mirror_face->neighbor((i+1)%3) != face) {
-	  delete_certificate(mirror_face->neighbor((i+1)%3));
-	  update_face(mirror_face->neighbor((i+1)%3));
-	}
-      }
-    }
-
-    //return flipped_edge;
-  }
-
-  Visitor &visitor() {
-    return watcher_;
-  }
-
-  const Visitor &visitor() const
-  {
-    return watcher_;
-  }
-
-  bool has_event(const Edge &e) const {
-    return e.first->event() != Event_key() || e.first->neighbor(e.second)->event() != Event_key();
-  }
-
-  bool has_finite_event(const Edge &e) const {
-    return e.first->event() != traits_.simulator_handle()->null_event()
-    || e.first->neighbor(e.second)->event() != traits_.simulator_handle()->null_event() ;
-  }
-  
-protected:
-  Traits traits_;
-  Visitor watcher_;
-  Triangulation del_;
-
-
-  Simulator_listener siml_;
-  Moving_point_table_listener motl_; 
-  std::vector<Vertex_handle> vhs_;
-
-  bool has_certificates_;
-  bool batching_;
-  std::vector<Face_handle> batched_certs_;
-
-
-  Face_handle hull_face(Vertex_handle v) const {
-    Face_circulator fc= v->incident_faces(), fe=fc;
-    if (fc != NULL) {
-      do {
-	int i= fc->index(v);
-	if (fc->vertex((i+2)%3)->point() == Point_key()) {
-	  return fc->neighbor(i);
-	}
-	++fc;
-      } while (fc != fe);
-    }
-    return Face_handle();
-  }
-
-  mutable unsigned int num_events_;
-  //mutable unsigned int num_single_certificates_;
-
-  const typename Traits::Point_2& point(Point_key k) const
-  {
-    return traits_.point(k);
-  }
-
-
-  Vertex_handle vertex_handle(Point_key k) const {
-    //if (k.index() >= vhs_.size()) return Vertex_handle();
-    CGAL_precondition(k.index() < vhs_.size());
-    return vhs_[k.index()];
-  }
-
-
-  void set_vertex_handle(Point_key k, Vertex_handle vh) {
-    vhs_.resize(std::max BOOST_PREVENT_MACRO_SUBSTITUTION(k.index()+1, vhs_.size()));
-    vhs_[k.index()]=vh;
-  }
-
-
-
-
-  void update_face_no_batch(const Face_handle e) {
-    CGAL_TRIANGULATION_2_DEBUG(std::cout << "Updating face " 
-			  << e->vertex(0)->point() << ", " << e->vertex(1)->point()
-			  << ", " << e->vertex(2)->point() << std::endl);
-
-    if (e->event() != Event_key()) {
-      CGAL_TRIANGULATION_2_DEBUG(std::cout << "Already has event " << std::endl);
-      // can't do this since I create all edges around vertex of degree 4 at once
-      // CGAL_error();
-    } else {
-      //CGAL_TRIANGULATION_2_DEBUG(std::cout << "New certificate" << std::endl);
-      new_certificate(e);
-    }
-  }
-
-
-
-  void update_face(const Face_handle e) {
-    if (batching_) {
-      //delete_certificate(e);
-      batched_certs_.push_back(e);
-    } else if (e->event() == Event_key()) {
-      update_face_no_batch(e);
-    }
-  }
-
-  // return true if hull
-  Vertex_handle points(const Face_handle e, Point_key ks[3]) const {
-    ks[0]= e->vertex(0)->point();
-    ks[1]= e->vertex(1)->point();
-    ks[2]= e->vertex(2)->point();
-
-    
-    Vertex_handle cv;
-    for (unsigned int i=0; i<3; ++i) {
-      if (ks[i]== Point_key()) {
-	cv=e->vertex((i+1)%3);
-	ks[i]= TDS_helper::mirror_vertex(Edge(e, (i+2)%3))->point();
-      }
-    }
-   
-    if (cv != Vertex_handle()) {
-      std::swap(ks[0], ks[1]);
-    }
-    return cv;
-  }
-
-  void new_certificate(Face_handle e) {
-    CGAL_precondition(e->event() == Event_key());
- 
-    Time t;
-    Point_key ks[3];
-    Vertex_handle cv= points(e,ks);
-    if (cv != Vertex_handle()) {
-      std::cout << "Center is " << cv->point() << std::endl;
-      if (cv->degree() ==3) {
-	std::cout << "Skipping set " << ks[0] << ", " << ks[1] << ", " << ks[2] << std::endl;
-	e->set_event(traits_.simulator_handle()->null_event());
-	return;
-      }
-    }
-    if (traits_.certificate_failure_time(e, ks, t)) {
-      Event_key k= traits_.simulator_handle()->new_event(t, Event(e, this));
-      e->set_event(k);
-    } else {
-      e->set_event(traits_.simulator_handle()->null_event());
-    }
-   
-  }
-
-  void delete_certificate(Face_handle e) {
-    //CGAL_TRIANGULATION_2_DEBUG(std::cout << "Cleaning edge " << TDS_helper::origin(e)->point() << " " << TDS_helper::destination(e)->point() << std::endl);
-    Event_key k=  e->event();
-    if (k != Event_key()) {
-      traits_.simulator_handle()->delete_event(k);
-      e->set_event(Event_key());
-    }
-  }
-};
-
-template <class Sim, class Del, class W, class T>
-std::ostream &operator<<(std::ostream &out, const Triangulation_2<Sim, Del, W, T> &kd)
-{
-  kd.write(out);
-  return out;
-}
-
-template <class Sim, class Del, class W, class T>
-void Triangulation_2<Sim, Del, W, T>::audit() const  {
-  del_.geom_traits().set_time(traits_.rational_current_time());
-  typename Simulation_traits::Instantaneous_kernel::Orientation_2 o2=
-    del_.geom_traits().orientation_2_object();
-  for (typename Triangulation::All_faces_iterator f = del_.all_faces_begin(); 
-       f != del_.all_faces_end(); ++f) {
-    Point_key ks[3];
-    points(f,ks);
-    CGAL_assertion(o2(ks[0],ks[1],ks[2])== CGAL::POSITIVE);
-  }
-}
-
-} } //namespace CGAL::Kinetic
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/Delaunay_triangulation_base_3.h b/3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/Delaunay_triangulation_base_3.h
deleted file mode 100644
index 1e510a8..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/Delaunay_triangulation_base_3.h
+++ /dev/null
@@ -1,1395 +0,0 @@
-// Copyright (c) 2005  Stanford University (USA).
-// 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$ $Date$
-// 
-//
-// Author(s)     : Daniel Russel <drussel at alumni.princeton.edu>
-
-#ifndef CGAL_KINETIC_INTERNAL_DELAUNAY_BASE_3_H
-#define CGAL_KINETIC_INTERNAL_DELAUNAY_BASE_3_H
-
-#include <CGAL/Kinetic/basic.h>
-
-#include <CGAL/Kinetic/internal/Triangulation_helper_3.h>
-#include <CGAL/Kinetic/internal/triangulation_helpers_3.h>
-#include <CGAL/Kinetic/Event_base.h>
-//#include <CGAL/Kinetic/internal/Delaunay_cache_3.h>
-
-// STL
-#include <map>
-#include <set>
-#include <iterator>
-#include <ostream>
-#include <iostream>
-
-//extern int too_late__;
-//extern int filtered__;
-
-namespace CGAL { namespace Kinetic { namespace internal {
-
-template <class KD, class RS>
-class Delaunay_event_base_3: public Event_base<KD*>
-{
-  typedef Event_base<KD*> P;
-public:
-  Delaunay_event_base_3(const RS &s,
-			KD *kdel):P(kdel), s_(s){
-  }
-  //! Default constructor
-  /*!  This really should not be used, but I need it for the
-    Simulator::event() call, due to the apparent gcc compiler bug.
-  */
-  Delaunay_event_base_3() {
-
-  }
-  void process() {
-    // for some reason VC insists that this be there
-    CGAL_assertion(0 && "Process called in Delaunay_event_base_3");
-  }
-  const RS& root_stack() const
-  {
-    return s_;
-  }
-  std::ostream& write(std::ostream &out) const
-  {
-    out << "Delaunay_event";
-    return out;
-  }
-  KD* kdel() const {
-    return P::kds();
-  }
-protected:
-  const RS s_;
-};
-
-/*template <class K, class R>
-std::ostream& operator<<(std::ostream &out, const Delaunay_event_base_3<K, R> &e)
-{
-  e.write(out);
-  return out;
-  }*/
-
-
-template <class KD, class RS>
-class Delaunay_3_edge_flip_event: public Delaunay_event_base_3<KD, RS>
-{
-public:
-  typedef Delaunay_event_base_3<KD, RS>   P;
-  Delaunay_3_edge_flip_event(const RS &s,
-			     const typename KD::Edge &e,
-			     KD *kdel):P(s, kdel), e_(e) {
-#ifndef NDEBUG
-    o_= edge_point(e_,0);
-    d_= edge_point(e_,1);
-#endif
-  }
-  void process() {
-    P::kdel()->flip(e_);
-  }
-
-  static typename KD::Point_key edge_point(const typename KD::Edge &e, int i) {
-    return vertex_of_edge(e, i)->point();
-  }
-
-  std::ostream& write(std::ostream &out) const
-  {
-    out << "Flip ";
-    internal::write_edge(e_, out);
-#if 0
-    out << "(" << o_ << d_<<")" << std::flush;
-    CGAL_postcondition(o_== vertex_of_edge(e_,static_cast<int>(0))->point());
-    CGAL_postcondition(d_== vertex_of_edge(e_,1)->point());
-#endif
-    return out;
-  }
- 
-
-  void audit(typename KD::Event_key k) const {
-    if (e_.first->edge_label(e_.second,e_.third) != k) {
-      CGAL_ERROR("Mismatch, for label " << k << " had event " << e_.first->edge_label(e_.second,e_.third));
-    }
-    CGAL_assertion(e_.first->edge_label(e_.second,e_.third) == k);
-  }
-protected:
-  const typename KD::Edge e_;
-#ifndef NDEBUG
-  typename KD::Point_key o_, d_;
-#endif
-};
-
-/*template <class B, class C, class D>
-std::ostream& operator<<(std::ostream &out, const Delaunay_3_edge_flip_event<B, C, D> &e)
-{
-  e.write(out);
-  return out;
-  }*/
-
-
-template <class KD, class RS>
-class Delaunay_3_facet_flip_event:  public Delaunay_event_base_3<KD, RS>
-{
-public:
-  typedef Delaunay_event_base_3<KD, RS>   P;
-  Delaunay_3_facet_flip_event(const RS &s,
-			      const typename KD::Facet &e,
-			      KD *kdel):  P(s, kdel),e_(e) {
-#ifndef NDEBUG
-    a_= vertex_of_facet(e_,0)->point();
-    b_= vertex_of_facet(e_,1)->point();
-    c_= vertex_of_facet(e_,2)->point();
-#endif
-  }
-  void process() {
-    P::kdel()->flip(e_);
-  }
-  std::ostream& write(std::ostream &out) const
-  {
-    out << "Flip ";
-    write_facet(e_, out);
-#if 0
-    out << "(" << a_ << b_<<c_ << ")";
-    CGAL_postcondition(a_== vertex_of_facet(e_,0)->point());
-    CGAL_postcondition(b_== vertex_of_facet(e_,1)->point());
-    CGAL_postcondition(c_== vertex_of_facet(e_,2)->point());
-#endif
-    return out;
-  }
- 
-  void audit(typename KD::Event_key k) const {
-    if (e_.first->facet_label(e_.second) != k) {
-      CGAL_ERROR("Mismatch, for label " << k << " had event " << e_.first->facet_label(e_.second));
-    }
-    CGAL_assertion(e_.first->facet_label(e_.second) == k);
-  }
-protected:
-  const typename KD::Facet e_;
-#ifndef NDEBUG
-  typename KD::Point_key a_, b_, c_;
-#endif
-};
-
-/*template <class T, class C, class D>
-std::ostream& operator<<(std::ostream &out, const Delaunay_3_facet_flip_event<T, C, D> &e)
-{
-  e.write(out);
-  return out;
-  }*/
-
-
-template <class TraitsT, class Visitor>
-class Delaunay_triangulation_base_3;
-
-template <class TraitsT, class Visitor>
-std::ostream &operator<<(std::ostream &out,
-			 const Delaunay_triangulation_base_3<TraitsT, Visitor> &dt);
-
-// Common base class for Delaunay and regular triangulations
-template <class TraitsT, class Visitor>
-class Delaunay_triangulation_base_3
-{
-public:
-  typedef Delaunay_triangulation_base_3<TraitsT, Visitor> This;
-
-  // KDS typedefs
-  typedef typename TraitsT::Simulator Simulator;
-  typedef typename TraitsT::Active_points_3_table Moving_object_table;
-  typedef typename TraitsT::Kinetic_kernel Kinetic_kernel;
-  typedef typename TraitsT::Instantaneous_kernel Instantaneous_kernel;
-  //typedef typename Simulator::Time Time;
-  typedef typename Moving_object_table::Key Point_key;
-  typedef typename Moving_object_table::Data Point;
-  typedef typename Simulator::Event_key Event_key;
-  typedef typename TraitsT::Side_of_oriented_sphere_3::result_type Certificate;
-  //typedef typename Simulator::NT NT;
-
-  // Delaunay typedefs
-  typedef Triangulation_helper_3<typename TraitsT::Triangulation> Tri;
-
-  // Triangulation members
-  typedef typename Tri::Facet Facet;
-  typedef typename Tri::Edge Edge;
-  typedef typename Tri::Facet_circulator Facet_circulator;
-  typedef typename Tri::Cell_circulator Cell_circulator;
-  typedef typename Tri::Finite_edges_iterator Finite_edges_iterator;
-  typedef typename Tri::Finite_facets_iterator Finite_facets_iterator;
-  typedef typename Tri::Edge_iterator Edge_iterator;
-  //typedef typename Tri::Facet_iterator Facet_iterator;
-  typedef typename Tri::Vertex_handle Vertex_handle;
-  typedef typename Tri::Cell_handle Cell_handle;
-  typedef typename Tri::All_cells_iterator All_cells_iterator;
-  typedef typename Tri::All_edges_iterator All_edges_iterator;
-  typedef typename Tri::All_facets_iterator All_facets_iterator;
-  typedef typename Tri::Finite_vertices_iterator Finite_vertices_iterator;
-
-  // accessory types
-  typedef typename TraitsT::Facet_flip Facet_flip_event;
-  typedef typename Facet_flip_event::P Event_base;
-  typedef typename TraitsT::Edge_flip Edge_flip_event;
-  typedef Tri Triangulation;
-
-  Delaunay_triangulation_base_3(TraitsT tr, Visitor v): tr_(tr),
-							triangulation_(tr.instantaneous_kernel_object()),
-							soc_(tr.side_of_oriented_sphere_3_object()),
-							o3_(tr.orientation_3_object()),
-							v_(v) {
-    if (0) print();
-    has_certificates_=false;
-  }
-
-  const TraitsT& simulation_traits_object() const {return tr_;}
-
-
-  const Visitor& visitor() const
-  {
-    return v_;
-  }
-  Visitor& visitor() {
-    return v_;
-  }
-
-  //! Just write the objects in order;
-  template <class Stream>
-  void write(Stream &out) const
-  {
-    //out << triangulation_;
-    for (All_cells_iterator cit= triangulation_.all_cells_begin(); cit != triangulation_.all_cells_end();
-	 ++cit) {
-      Cell_handle h= cit;
-      for (unsigned int i=0; i<4; ++i) {
-	out << h->vertex(i)->point() << " ";
-      }
-      out << "--";
-      for (unsigned int i=0; i<4; ++i) {
-	Facet f(h, i);
-	out << triangulation_.label(f) << " ";
-      }
-      out << std::endl;
-    }
-    for (All_edges_iterator eit = triangulation_.all_edges_begin(); eit != triangulation_.all_edges_end(); ++eit) {
-      triangulation_.write_labeled_edge(*eit, out);
-      if (is_degree_3(*eit)) {
-	//out << " " << triangulation_.label(*eit);
-      }
-      else {
-	if (has_event(*eit)) {
-	  out << " ?? " ;           //<< triangulation_.label(*eit);
-	}
-	//CGAL_assertion(triangulation_.label(*eit)== Event_key::null());
-      }
-      out << std::endl;
-    }
-    for (All_facets_iterator eit = triangulation_.all_facets_begin(); eit != triangulation_.all_facets_end(); ++eit) {
-      triangulation_.write_labeled_facet(*eit, out);
-      if (!has_degree_3_edge(*eit)) {
-	//out << " " << triangulation_.label(*eit);
-      }
-      else {
-	//CGAL_assertion(triangulation_.label(*eit)== Event_key::null());
-	if (has_event(*eit)) {
-	  out << " ?? ";            //<< triangulation_.label(*eit);
-	}
-      }
-      out << std::endl;
-    }
-  }
-  bool is_degree_3(const Edge &e) const {
-    return triangulation_.has_degree_3(e);
-  }
-
-  bool is_degree_4(Vertex_handle vh) const {
-    return triangulation_.degree(vh) == 4;
-  }
-
-  bool has_degree_3_edge(const Facet& f) const {
-    return triangulation_.has_degree_3(f);
-  }
-
-  bool has_degree_4_vertex(const Facet& f) const {
-    return is_degree_4(triangulation_.vertex(f,0))
-      || is_degree_4(triangulation_.vertex(f,1))
-      || is_degree_4(triangulation_.vertex(f,2));
-  }
-
-  bool has_degree_4_vertex(const Edge& f) const {
-    return is_degree_4(triangulation_.vertex(f,0))
-      || is_degree_4(triangulation_.vertex(f,1));
-  }
-
-  bool print() const
-  {
-    write(std::cout);
-    return true;
-  }
-
-  /*!
-    Delete all incident face and edge events (have to push edge events on to facets).
-    Insert point.
-    Set edges to never fails. Set outside facets.
-  */
-  /*Vertex_handle push_vertex(Point_key k, Cell_handle c) {
-    clean_cell(c);
-    v_.pre_insert_vertex(k, c);
-    // into max dim simplex?
-    Vertex_handle vh=triangulation_.tds().insert_in_cell( c);
-    vh->set_point(k);
-    set_vertex_handle(k, vh);
-    std::vector<Cell_handle> ics;
-    triangulation_.incident_cells(vh, std::back_insert_iterator<std::vector<Cell_handle> >(ics));
-    CGAL_postcondition(ics.size() == 4);
-    for (unsigned int j=0; j< ics.size(); ++j) {
-      Cell_handle cc= ics[j];
-      handle_new_cell(cc);
-    }
-    v_.post_insert_vertex(vh);
-    return vh;
-    }*/
-
-  Cell_handle pop_vertex(Vertex_handle v) {
-    v_.pre_remove_vertex(v);
-    CGAL_precondition(is_degree_4(v));
-    std::vector<Cell_handle> ics;
-    triangulation_.incident_cells(v, std::back_insert_iterator<std::vector<Cell_handle> >(ics));
-    Point_key k= v->point();
-    for (unsigned int j=0; j< ics.size(); ++j) {
-      clean_cell(ics[j]);
-    }
-   
-    set_vertex_handle(v->point(), NULL);
-
-    Cell_handle h= triangulation_.tds().remove_from_maximal_dimension_simplex(v);
-    handle_new_cell(h);
-    v_.post_remove_vertex(k);
-
-    return h;
-  }
-
-  void delete_vertex(Point_key) {
-    CGAL_error();
-  }
-
-
-  Vertex_handle change_vertex(Point_key k) {
-    if (!has_certificates()) return NULL;
-    //triangulation_.geom_traits().set_time(simulator()->current_time_as_nt());
-    std::vector<Cell_handle> incident_cells;
-    triangulation_.incident_cells(vertex_handle(k), back_inserter(incident_cells));
-    for (typename std::vector<Cell_handle>::iterator it= incident_cells.begin(); 
-	 it != incident_cells.end();
-	 ++it) {
-      clean_cell(*it);
-    }
-
-    for (typename std::vector<Cell_handle>::iterator it= incident_cells.begin();
-	 it != incident_cells.end(); ++it) {
-      handle_new_cell(*it);
-    }
-    v_.change_vertex(vertex_handle(k));
-    return vertex_handle(k);
-  }
-
-  /*typename Triangulation::Vertex_handle new_vertex_regular(Point_key k, Cell_handle h=NULL) {
-    CGAL_precondition(!has_certificates_);
-    typename Simulator::NT nt= simulator()->next_time_representable_as_nt();
-    CGAL_precondition(simulator()->current_time() == nt);
-    //simulator()->set_current_time(nt);
-    triangulation_.geom_traits().set_time(nt);
-    typename Triangulation::Vertex_handle vh= triangulation_.insert(k, h);
-    v_.create_vertex(vh);
-    return vh;
-    }*/
-
-  typename Triangulation::Vertex_handle insert(Point_key k) {
-    /* NT nt= simulator()->next_time_representable_as_nt();
-    simulator()->set_current_time(nt);
-    triangulation_.geom_traits().set_time(nt);*/
-    set_instantaneous_time();
-    //typename Simulator::NT nt= simulator()->next_time_representable_as_nt();
-    //simulator()->set_current_time(nt);
-    //std::cout << "Locating at time " << triangulation_.geom_traits().time() << std::endl;
-    Cell_handle h= triangulation_.locate(k);
-    /*if (h != Cell_handle() && h->vertex(0) != Vertex_handle()
-	       && h->vertex(1) != Vertex_handle()
-	       && h->vertex(2) != Vertex_handle()
-	       && h->vertex(3) != Vertex_handle()) {
-      std::cout << "Kinetic located in " << h->vertex(0)->point() << " "
-		<< h->vertex(1)->point() << " "
-		<< h->vertex(2)->point() << " "
-		<< h->vertex(3)->point() << std::endl;
-    } else {
-      std::cout << "Kinetic located outside hull" << std::endl;
-      }*/
-    return insert(k,h);
-  }
-
-  //!
-  /*!
-    Some old certificate edges will be lost, have to find all conflicts first.
-
-    An important problem case is the edges which were previously degree 3 but are no longer
-    after insertion. They can now be degree 4 and will have their certificate deleted properly.
-    However, this leaves a face with no certificate (the one or more not destroyed by the new vertex).
-
-    This occurs when a degree 3 edges has a facet added but none destroyed--i.e. a boundary edge
-    with degree 3.
-  */
-  typename Triangulation::Vertex_handle insert(Point_key k, Cell_handle h) {
-    //CGAL_precondition(h != NULL);
-
-    std::vector<Facet> bfacets;
-    std::vector<Cell_handle> cells;
-    std::vector<Facet> ifacets;
-    //typename Simulator::NT nt= simulator()->next_time_representable_as_nt();
-    //CGAL_precondition(simulator()->current_time() == nt);
-    //triangulation_.geom_traits().set_time(nt);
-    set_instantaneous_time();
-    CGAL_precondition(triangulation_.geom_traits().time() == simulator()->current_time());
-    Vertex_handle vh;
-    v_.pre_insert_vertex(k, h);
-    if (triangulation_.dimension() == 3) {
-      triangulation_.find_conflicts(k, h, back_inserter(bfacets), 
-				    back_inserter(cells),back_inserter(ifacets));
-      if (has_certificates_) {
-	for (unsigned int i=0; i < cells.size(); ++i) {
-	  clean_cell(cells[i]);
-	}
-      }
-      
-   
-      //! \todo replace by insert_in_hole
-
-      CGAL_LOG(Log::LOTS, "Inserting " << k << " at time " 
-		       << triangulation_.geom_traits().time() << "\n");
-      vh=triangulation_.insert_in_hole(k, cells.begin(), cells.end(), 
-						     bfacets.front().first, bfacets.front().second);
-    } else {
-      vh= triangulation_.insert(k,h);
-    }
-    set_vertex_handle(k,vh);
-    if (triangulation_.dimension() == 3 && vh != Vertex_handle()) {
-      change_vertex(k);
-    }
-    
-    CGAL_expensive_postcondition(audit_structure());
-    v_.post_insert_vertex(vh);
-    return vh;
-  }
-
-  bool has_certificates() const
-  {
-    return has_certificates_;
-  }
-
-  void set_instantaneous_time(bool after=false) const {
-    if (!triangulation_.geom_traits().has_time() || triangulation_.geom_traits().time() != simulator()->current_time()) {
-      typename Simulator::NT nt= simulator()->next_time_representable_as_nt();
-      
-      if (simulator()->current_time() == nt) {
-	if (after) {
-	  triangulation_.geom_traits().set_time_to_after(nt);
-	} else {
-	  triangulation_.geom_traits().set_time(nt);
-	}
-      } else {
-	CGAL_LOG(Log::SOME, "Warning, insertion of points at non-rational times is slow.\n");
-	if (after) {
-	  triangulation_.geom_traits().set_time_to_after(simulator()->current_time());
-	} else {
-	  triangulation_.geom_traits().set_time(simulator()->current_time());
-	}
-      }
-    }
-  }
-
-  void set_has_certificates(bool b) {
-    if (!has_certificates_ && b) {
-      if (triangulation().dimension() == 3) {
-	for (All_edges_iterator eit = triangulation_.all_edges_begin();
-	     eit != triangulation_.all_edges_end(); ++eit) {
-	  CGAL_assertion(!has_event(*eit));
-	}
-	for (All_facets_iterator eit = triangulation_.all_facets_begin();
-	     eit != triangulation_.all_facets_end(); ++eit) {
-	  CGAL_assertion(!has_event(*eit));
-	}
-	create_all_certificates();
-	has_certificates_=true;
-      }
-    } else if (has_certificates_ && !b) {
-      destroy_all_certificates();
-      has_certificates_=false;
-    }
-  }
-
- void create_all_certificates() {
-    CGAL_precondition(!has_certificates_);
- 
-    for (All_edges_iterator eit = triangulation_.all_edges_begin();
-	 eit != triangulation_.all_edges_end(); ++eit) {
-      if (is_degree_3(*eit) && !has_degree_4_vertex(*eit)) {
-	make_certificate(*eit);
-      }
-    }
-    for (All_facets_iterator eit = triangulation_.all_facets_begin();
-	 eit != triangulation_.all_facets_end(); ++eit) {
-      if (!has_degree_3_edge(*eit)) {
-	make_certificate(*eit);
-      }
-    }
-    for (All_cells_iterator cit= triangulation_.all_cells_begin(); 
-	 cit != triangulation_.all_cells_end(); ++cit) {
-      v_.create_cell(cit);
-    }
-  }
-
-
-  void destroy_all_certificates() {
-    //vhs_.clear();
-    CGAL_precondition(has_certificates_);
-    for (All_edges_iterator eit = triangulation_.all_edges_begin();
-	 eit != triangulation_.all_edges_end(); ++eit) {
-      Event_key k= triangulation_.label(*eit);
-      if ( k != Event_key() ) {
-	simulator()->delete_event(k);
-	triangulation_.set_label(*eit,Event_key());
-      }
-    }
-    for (All_facets_iterator eit = triangulation_.all_facets_begin();
-	 eit != triangulation_.all_facets_end(); ++eit) {
-      Event_key k= triangulation_.label(*eit);
-      if (k != Event_key() ) {
-	simulator()->delete_event(k);
-	triangulation_.set_label(*eit,Event_key());
-      }
-      //}
-    }
-    for (All_cells_iterator cit= triangulation_.all_cells_begin(); 
-	 cit != triangulation_.all_cells_end(); ++cit) {
-      v_.destroy_cell(cit);
-    }
-  }
- 
-
-
-  Facet flip(const Edge &edge) {
-    v_.pre_edge_flip(edge);
-    
-    CGAL_LOG(Log::LOTS,"\n\nFlipping edge ");
-    CGAL_LOG(Log::LOTS,edge.first->vertex(edge.second)->point() << "--" 
-		     << edge.first->vertex(edge.third)->point() << std::endl);
-    CGAL_assertion(triangulation_.tds().is_edge(edge.first, edge.second, edge.third) || print());
-    if (has_degree_4_vertex(edge)) {
-      CGAL_LOG(Log::LOTS,"dropping edge since endpoint is degree 4\n ");
-      triangulation_.set_label(edge, simulator()->null_event());
-      return Facet();
-    }
-    CGAL_assertion(!has_degree_4_vertex(edge));
-
-    Vertex_handle poles[2];
-    poles[0]= edge.first->vertex(edge.second);
-    poles[1]= edge.first->vertex(edge.third);
-    int polesi[2];
-    polesi[0] = edge.first->index(poles[0]);
-    polesi[1]= edge.first->index(poles[1]);
-
-    typename Simulator::Event_key failed_key = triangulation_.label(edge);
-    CGAL_precondition(failed_key.is_valid());
-    Certificate ore= extract_root_stack(failed_key);
-   
-    Facet neighboring_facet= triangulation_.opposite(Facet(edge.first, polesi[0]));
-
-    triangulation_.set_label(edge, typename Simulator::Event_key());
-
-    // handle the cross edges to make sure that they are no longer edge flips
-    {
-      Cell_circulator cc= triangulation_.incident_cells(edge), ce= cc;
-      do {
-	Cell_handle h=cc;
-	clean_cell(h);
-      } while (++cc != ce);
-    }
-
-    triangulation_.tds().flip_flippable(edge);
-    CGAL_expensive_assertion(labeling_is_valid());
-    /*if (verbose){
-      write_labeled_state();
-      }*/
-
-    CGAL_assertion(triangulation_.tds().is_facet(neighboring_facet.first, neighboring_facet.second));
-    Facet internal_facet= triangulation_.opposite(neighboring_facet);
-
-    Cell_handle cells[2];
-    cells[1]= internal_facet.first;
-    polesi[1]= cells[1]->index(poles[1]);
-    cells[0]= cells[1]->neighbor(polesi[1]);
-    polesi[0]= cells[0]->index(poles[0]);
-
-    Facet middle_facet(cells[0], polesi[0]);
-    triangulation_.clear_cell_labels(middle_facet.first);
-    triangulation_.clear_cell_labels(triangulation_.opposite(middle_facet).first);
-
-    if (ore.will_fail()) {
-      typename Simulator::Time t= ore.failure_time();
-      ore.pop_failure_time();
-      typename Simulator::Event_key k= simulator()->new_event(t, 
-							      Facet_flip_event(ore, middle_facet, tr_.wrapper_handle()));
-      
-      triangulation_.set_label(middle_facet, k);
-    } else {
-      triangulation_.set_label(middle_facet, simulator()->null_event());
-    }
-
-    for (int c=0; c<2; ++c) {
-      handle_new_cell(cells[c]);
-    }
-
-    CGAL_postcondition(audit_structure());
-    v_.post_edge_flip(middle_facet);
-    return middle_facet;
-  }
-
-
-
-
-
-
-
-
-
-
-
-  Edge flip(const Facet &flip_facet) {
-    v_.pre_facet_flip(flip_facet);
-    Vertex_handle poles[2];
-    Facet other_flip_facet= triangulation_.opposite(flip_facet);
-    poles[0]= flip_facet.first->vertex(flip_facet.second);
-    poles[1]= other_flip_facet.first->vertex(other_flip_facet.second);
-    
-    CGAL_LOG(Log::LOTS,"\n\nFlipping facet ");
-    CGAL_LOG(Log::LOTS,flip_facet.first->vertex((flip_facet.second+1)%4)->point() << "--"
-		     << flip_facet.first->vertex((flip_facet.second+2)%4)->point() << "--"
-		     << flip_facet.first->vertex((flip_facet.second+3)%4)->point() << std::endl);
-    //triangulation_.write_labeled_facet(flip_facet, log_lots() );
-    CGAL_LOG(Log::LOTS," with poles " << poles[0]->point() << ", " << poles[1]->point());
-    CGAL_LOG(Log::LOTS,std::endl);
-    
-    CGAL_assertion(triangulation_.tds().is_facet(flip_facet.first, flip_facet.second) || print());
-
-    Event_key failed_key= triangulation_.label(flip_facet);
-    Certificate ore= extract_root_stack(failed_key);
-    if (ore.will_fail()) {
-      CGAL_LOG(Log::LOTS, "Next root of certificate is " << ore.failure_time() << std::endl);
-    } else {
-      CGAL_LOG(Log::LOTS, "Certificate will never fail" << std::endl);
-    }
-    triangulation_.set_label(flip_facet, Event_key());
-
-    //typename P::Event_key index= triangulation_.label(flip_facet);
-
-    Facet inside_facet(flip_facet.first, (flip_facet.second+1)%4);
-    Facet neighbor_facet= triangulation_.opposite(inside_facet);
-    Cell_handle cells[2]= {flip_facet.first, other_flip_facet.first};
-    CGAL_assertion(neighbor_facet.first != cells[0] && neighbor_facet.first != cells[1]);
-
-    // go around and change the handler for each edge if it is degree 3. Don't have to look off cell
-    for (int c=0; c<2; ++c) {
-      clean_cell(cells[c]);
-    }
-   
-   
-    triangulation_.tds().flip_flippable(flip_facet);
-
-    CGAL_assertion(triangulation_.tds().is_facet(neighbor_facet.first, neighbor_facet.second));
-
-    Facet a_facet= triangulation_.opposite(neighbor_facet);
-    Cell_handle a_cell= a_facet.first;
-
-    Edge central_edge(a_cell, a_cell->index(poles[0]), a_cell->index(poles[1]));
-
-    Cell_circulator cc= triangulation_.incident_cells(central_edge), ce=cc;
-    do {
-      triangulation_.clear_cell_labels(cc);
-    } while (++cc != ce);
-
-
-    if (ore.will_fail()) {
-      typename Simulator::Time t= ore.failure_time();
-      ore.pop_failure_time();
-      typename Simulator::Event_key k= simulator()->new_event(t, Edge_flip_event(ore, central_edge, tr_.wrapper_handle()));
-      triangulation_.set_label(central_edge, k);
-    } else {
-      triangulation_.set_label(central_edge, simulator()->null_event());
-    }
-    
-    CGAL_expensive_assertion(labeling_is_valid());
-
-    {
-      Cell_circulator cc= triangulation_.incident_cells(central_edge), ce=cc;
-      do {
-	handle_new_cell(cc);
-      } while (++cc != ce);
-    }
-
-    CGAL_postcondition(audit_structure());
-    v_.post_facet_flip(central_edge);
-    return central_edge;
-  }
-
-
-
-
-
-
-
-
-
-
-
-  void audit() const
-  {
-    CGAL_LOG(Log::SOME, "Verifying at time " << simulator()->audit_time() << ".\n");
-    set_instantaneous_time();
-    //CGAL_precondition(triangulation_.geom_traits().time()== simulator()->audit_time());
-    //triangulation_.geom_traits().set_time(simulator().rational_current_time());
-    audit_structure();
-    triangulation_.is_valid(true);
-  }
-
-
-
-
-
-
-
-
-
-  const Triangulation& triangulation() const
-  {
-    return triangulation_;
-  }
-
-  Triangulation& triangulation() {
-    return triangulation_;
-  }
-
-  const Moving_object_table* moving_object_table() const
-  {
-    return tr_.active_points_3_table_handle();
-  }
-
-  Simulator* simulator() {
-    return tr_.simulator_handle();
-  }
-
-  const Simulator* simulator() const
-  {
-    return tr_.simulator_handle();
-  }
-
-  const Point& point(Point_key k) const
-  {
-    return moving_object_table()->at(k);
-  }
-
-  Vertex_handle vertex_handle(Point_key k) const
-  {
-    if (k.is_valid() && k.index() < vhs_.size()) {
-      return vhs_[k.index()];
-    }
-    else {
-      return NULL;
-    }
-  }
-
-  void set_vertex_handle(Point_key k, Vertex_handle vh) {
-    CGAL_precondition(k != Point_key());
-    unsigned int bin= k.index();
-    while (vhs_.size() <= bin) {
-      vhs_.push_back(Vertex_handle(NULL));
-    }
-    /*if (vhs_.size() <=bin){
-      vhs_.resize(bin+1);
-      }*/
-    vhs_[k.index()]=vh;
-  }
-
-  typename TraitsT::Side_of_oriented_sphere_3 power_test_object() const
-  {
-    return soc_;
-  };
-  typename TraitsT::Orientation_3 orientation_object() const
-  {
-    return o3_;
-  }
-  Certificate extract_root_stack(Event_key k) const
-  {
-    //typename Simulator::Event_handle<Event_base> eh(simulator()->event(k, Event_base()));
-    //typename Simulator::Root_stack s= eh.pointer()->root_stack();
-    return simulator()->template event<Event_base>(k/*, Event_base()*/).root_stack();
-  }
-  /*
-    typename Simulator::Time extract_time(Event_key k) const {
-    return simulator()->event<Facet_flip_event::Base>(k)->time();
-    }*/
-
-
-
-  void make_certificate( const Edge &e,
-			 const typename Simulator::Time& st) {
-    CGAL_LOG(Log::LOTS, "making certificate for edge ");
-    CGAL_LOG_WRITE(Log::LOTS, triangulation_.write_edge(e, LOG_STREAM));
-    CGAL_LOG(Log::LOTS, std::endl);
-    CGAL_precondition(is_degree_3(e));
-    CGAL_precondition_code(Facet_circulator fc= triangulation_.incident_facets(e));
-    CGAL_precondition_code(Facet_circulator fe= fc);
-    CGAL_precondition_code(do {
-      );
-			   CGAL_precondition(!has_event(*fc));
-			   CGAL_precondition_code(++fc);
-			   CGAL_precondition_code(
-						  }while(fc != fe));
-
-    CGAL_precondition(is_degree_3(e));
-    CGAL_precondition(!has_degree_4_vertex(e));
-    CGAL_precondition(!has_event(e));
-    
-    Certificate s= root_stack(e, st);
-   
-    if (s.will_fail()) {
-      CGAL_LOG(Log::LOTS,"Failure time is " << s.failure_time() << std::endl);
-      typename Simulator::Time t= s.failure_time();
-      s.pop_failure_time();
-      if (s.will_fail()) {
-	CGAL_LOG(Log::LOTS, "Next root of this cert is " << s.failure_time() << std::endl);
-      }
-      typename Simulator::Event_key k=  simulator()->new_event(t, Edge_flip_event(s, e, tr_.wrapper_handle()));
-      triangulation_.set_label(e, k);
-    } else {
-      CGAL_LOG(Log::LOTS,"Certificate will not fail "<< std::endl);
-      triangulation_.set_label(e, simulator()->null_event());
-    }
-  }
-  void make_certificate( const Edge &e) {
-    make_certificate(e, simulation_traits_object().simulator_handle()->current_time());
-  }
-
-
-
-
-
-  void make_certificate( const Facet &e,
-			 const typename Simulator::Time &st) {
-    CGAL_precondition(!has_event(e));
-    CGAL_LOG(Log::LOTS, "making certificate for facet ");
-    CGAL_LOG_WRITE(Log::LOTS, triangulation_.write_facet(e, LOG_STREAM ));
-    //triangulation_.write_facet(e, log_lots());
-    CGAL_LOG(Log::LOTS,  std::endl);
-
-    CGAL_precondition(!has_degree_3_edge(e));
-    for (int i=0; i<3; ++i) {
-      CGAL_precondition(triangulation_.label(triangulation_.edge(e, i)) == Event_key());
-    }
-    Certificate s= root_stack(e, st);
-    if (s.will_fail()) {
-      typename Simulator::Time t= s.failure_time();
-      CGAL_LOG(Log::LOTS, "Failure time is " << t << std::endl);
-      s.pop_failure_time();
-      if (s.will_fail()) {
-	CGAL_LOG(Log::LOTS, "Next root of this cert is " << s.failure_time() << std::endl);
-      }
-      typename Simulator::Event_key k= simulator()->new_event(t, Facet_flip_event(s, e, tr_.wrapper_handle()));
-      triangulation_.set_label(e, k);
-    } else {
-      CGAL_LOG(Log::LOTS, "Certificate will not fail" << std::endl);
-      triangulation_.set_label(e, simulator()->null_event());
-    }
-  }
-
-   void make_certificate( const Facet &e) {
-     make_certificate(e,
-		      simulation_traits_object().simulator_handle()->current_time());
-   }
-
- 
-
-  template <class Oit>
-  void point_keys(const Facet &f, Oit out) const
-  {
-    int hinf=-1;
-    for (unsigned int i=0; i<4; ++i) {
-      Point_key k= f.first->vertex(i)->point();
-      if (!k.is_valid()) {
-	hinf=i;
-	break;
-      }
-    }
-    if (hinf==-1) {
-      Point_key k= triangulation_.mirror_vertex(f.first, f.second)->point();
-      if ( ! k.is_valid() ) {
-	hinf=4;
-      }
-    }
-    if (hinf != -1) {
-      CGAL_LOG(Log::LOTS, "hinf is " << hinf << std::endl);
-      if (hinf ==4) {
-	for (unsigned int i=0; i<4; ++i) {
-	  Point_key k= f.first->vertex(i)->point();
-	  *out= k;
-	  ++out;
-	}
-	return;
-      }
-      else {
-	//Facet ff(f.first, hinf);
-	if (hinf%2!=0) {
-	  Point_key k= triangulation_.mirror_vertex(f.first, f.second)->point();
-	  *out= k;
-	  ++out;
-	}
-	for (int i=0; i<4; ++i) {
-	  // CGAL infinite cells seem to be misoriented
-	  if (i==hinf) continue;
-	  *out= f.first->vertex(i)->point();
-	  ++out;
-	}
-	if (hinf%2==0) {
-	  Point_key k= triangulation_.mirror_vertex(f.first, f.second)->point();
-	  *out= k;
-	  ++out;
-	}
-      }
-    }
-    else {
-      for (unsigned int i=0; i<4; ++i) {
-	Point_key k= f.first->vertex(i)->point();
-	*out= k;
-	++out;
-      }
-      Point_key k= triangulation_.mirror_vertex(f.first, f.second)->point();
-      *out= k;
-      ++out;
-    }
-  }
-
-
-
-
-private:
-  Certificate root_stack(const Edge &e, const typename Simulator::Time &st) const
-  {
-    return root_stack(*triangulation_.incident_facets(e), st);
-  }
-
-  
-
-  void make_no_events(const Edge &e) {
-    CGAL_precondition(triangulation_.has_degree_3(e));
-    Facet_circulator fc= triangulation_.incident_facets(e);
-    Facet_circulator fe= fc;
-    do {
-      if (has_event(*fc)) {
-	Event_key k= triangulation_.label(*fc);
-	simulator()->delete_event(k);
-	triangulation_.set_label(*fc, Event_key());
-      }
-    } while(++fc != fe);
-  }
-public:
-  Point_key replace_vertex(Vertex_handle vh, Point_key k) {
-    Point_key ok= vh->point();
-    vh->point()=k;
-    vhs_[ok.index()]= Vertex_handle();
-    vhs_[k.index()]= vh;
-    return ok;
-  }
-protected:
-  bool has_event(const Edge &e) const
-  {
-    return triangulation_.label(e) != Event_key();
-  }
-
-  bool has_event(const Facet &e) const
-  {
-    
-    return triangulation_.label(e) != Event_key();
-  }
-
-
-  void create_edge_flips(Vertex_handle v) {
-    CGAL_precondition(!is_degree_4(v));
-    std::vector<Cell_handle> ics;
-    triangulation().incident_cells(v, std::back_inserter(ics));
-    for (unsigned int i=0; i< ics.size(); ++i) {
-      int j=-1;// disable warning
-      CGAL_assertion_code(bool ret=)
-        ics[i]->has_vertex(v, j); // initializes j
-      CGAL_assertion(j != -1);
-      CGAL_assertion(ret);
-      for (int k=0; k<4 ; ++k) {
-	if (k==j) continue;
-	Edge e(ics[i], j, k);
-	if (is_degree_3(e) && !has_event(e) && !has_degree_4_vertex(e)) {
-	  // rather than make_certificate due to ordering dependencies
-	  make_edge_flip(e);
-	}
-      }
-    }
-  }
-
-  void suppress_edge_flips(Vertex_handle v) {
-    CGAL_precondition(is_degree_4(v));
-    std::vector<Cell_handle> ics;
-    triangulation().incident_cells(v, std::back_inserter(ics));
-    for (unsigned int i=0; i< ics.size(); ++i) {
-      int j=-1; // keep some dumb compiler happy
-      CGAL_assertion_code(bool ret=)
-        ics[i]->has_vertex(v, j);
-      CGAL_assertion(ret);
-      for (int k=0; k<4 ; ++k) {
-	if (k==j) continue;
-	Edge e(ics[i], j, k);
-	if (has_event(e)) {
-	  simulator()->delete_event(triangulation_.label(e));
-	  triangulation().set_label(e, Event_key());
-	}
-      }
-    }
-  }
-
-  void make_edge_flip(Edge &edge) {
-    CGAL_LOG(Log::LOTS, "Making edge flip ");
-    CGAL_LOG_WRITE(Log::LOTS, triangulation_.write_labeled_edge(edge, LOG_STREAM ));
-    CGAL_LOG(Log::LOTS,std::endl);
-    CGAL_assertion(triangulation_.has_degree_3(edge));
-    typename Simulator::Event_key k= typename Simulator::Event_key();
-    Facet_circulator fc= triangulation_.incident_facets(edge), fe=fc;
-    do {
-      if (has_event(*fc)) {
-	CGAL_assertion( k == Event_key() );
-	k=triangulation_.label(*fc);
-	triangulation_.set_label(*fc, typename Simulator::Event_key());
-	Event_key kk=change_to_edge_flip(edge, k);
-	triangulation_.set_label(edge, kk);
-	simulator()->audit_event(kk);
-	return;
-      }
-    } while (++fc != fe);
-
-
-    CGAL_LOG(Log::LOTS, "Making up edge event.\n");
-    make_certificate(edge);
-  }
-
-  void make_not_edge_flip(Edge &edge, Cell_handle h) {
-    if (true) {
-      CGAL_LOG(Log::LOTS, "Making edge ");
-      CGAL_LOG_WRITE(Log::LOTS, triangulation_.write_labeled_edge(edge, LOG_STREAM ));
-      CGAL_LOG(Log::LOTS, " not an edge flip.\n");
-    }
-    CGAL_assertion(is_degree_3(edge) || print());
-    typename Simulator::Event_key index = triangulation_.label(edge);
-    CGAL_precondition( index != Event_key() );
-
-    triangulation_.set_label(edge, typename Simulator::Event_key());
-
-    Cell_circulator fc=triangulation_.incident_cells(edge), pfc=fc, ef;
-    ++fc;
-    ef=fc;
-    do {
-      if( (h != fc) && ( h != pfc) ) {
-	for (unsigned int i=0; i< 4; ++i) {
-	  if (pfc->neighbor(i) == fc){
-	    Facet f(pfc, i);
-	    CGAL_precondition(!has_event(f));
-	    triangulation_.set_label(f, change_to_facet_flip(f, index));
-	    simulator()->audit_event(triangulation_.label(f));
-	  }
-	}
-      }
-      ++pfc; ++fc;
-    } while (ef != fc);
-  }
-
-  template <class C>
-  std::back_insert_iterator<C> back_inserter(C &c) const
-  {
-    return std::back_insert_iterator<C>(c);
-  }
-
-  bool contains(typename std::vector<Facet>::iterator beg,
-		typename std::vector<Facet>::iterator end, Facet f) {
-    Facet of = triangulation_.opposite(f);
-    for (; beg != end; ++beg) {
-      if (f.first == beg->first) {
-	if (f.second == beg->second) return true;
-      }
-      else if (of.first == beg->first) {
-	if (of.second == beg->second) return true;
-      }
-    }
-    return false;
-  }
-
-  bool labeling_is_valid() const
-  {
-    for (All_facets_iterator eit= triangulation_.all_facets_begin(); eit != triangulation_.all_facets_end();
-	 ++eit) {
-      Facet f= *eit;
-      Facet of= triangulation_.opposite(f);
-      if (triangulation_.label(f) != triangulation_.label(of)) {
-	triangulation_.write_labeled_facet(f, std::cerr);
-	std::cerr << " does not match ("<< triangulation_.label(f) << ", "
-		  << triangulation_.label(of) << ")\n";
-      }
-    }
-    for (All_edges_iterator eit= triangulation_.all_edges_begin(); eit != triangulation_.all_edges_end();
-	 ++eit) {
-      Edge e=*eit;
-      triangulation_.label(e);
-    }
-    return true;
-  }
-
-
-
-  bool audit_structure() const
-  {
-    if (triangulation_.dimension() != 3) return true;
-
-    std::set<Point_key> pks;
-    for (Finite_vertices_iterator eit = triangulation_.finite_vertices_begin();
-	  eit != triangulation_.finite_vertices_end(); ++eit) {
-      CGAL_assertion_code(Point_key k= eit->point());
-      CGAL_assertion(pks.find(k) == pks.end());
-      CGAL_assertion_code(pks.insert(k));
-    }
-    
-    if (!has_certificates()) {
-      for (All_edges_iterator eit = triangulation_.all_edges_begin();
-	   eit != triangulation_.all_edges_end(); ++eit) {
-	CGAL_assertion(!has_event(*eit));
-      }
-      for (All_facets_iterator eit = triangulation_.all_facets_begin();
-	   eit != triangulation_.all_facets_end(); ++eit) {
-	CGAL_assertion(!has_event(*eit));
-      }
-    } else {
-      CGAL_LOG(Log::SOME, "Auditing structure" << std::endl);
-      //print();
-      
-      for (All_edges_iterator eit = triangulation_.all_edges_begin();
-	   eit != triangulation_.all_edges_end(); ++eit) {
-	bool isd3= is_degree_3(*eit);
-	bool hd4= has_degree_4_vertex(*eit);
-	if (!isd3 || hd4) {
-	  if (has_event(*eit)) {
-	    std::cerr << "Edge should not have certificate ";
-	    triangulation_.write_labeled_edge(*eit, std::cerr);
-	    std::cerr << std::endl;
-	    simulator()->audit_event(triangulation_.label(*eit));
-	    CGAL_error();
-	  }
-	} else if ( isd3) {
-	  if (!has_event(*eit)) {
-	    std::cerr << "Edge should have certificate ";
-	    triangulation_.write_labeled_edge(*eit, std::cerr);
-	    std::cerr << std::endl;
-	    CGAL_error();
-	  } else {
-	    simulator()->audit_event(triangulation_.label(*eit));
-	  }
-	}
-      }
-
-      for (All_facets_iterator eit = triangulation_.all_facets_begin();
-	   eit != triangulation_.all_facets_end(); ++eit) {
-	bool hsd3= has_degree_3_edge(*eit);
-	bool hd4= has_degree_4_vertex(*eit);
-	if (hsd3 || hd4) {
-	  if (has_event(*eit)) {
-	    std::cerr << "Facet should not have certificate ";
-	    triangulation_.write_labeled_facet(*eit, std::cerr);
-	    std::cerr << std::endl;
-	    simulator()->audit_event(triangulation_.label(*eit));
-	    CGAL_error();
-	  }
-	} else {
-	  if (!has_event(*eit)) {
-	    std::cerr << "Facet should have certificate ";
-	    triangulation_.write_labeled_facet(*eit, std::cerr);
-	    std::cerr << std::endl;
-	    CGAL_error();
-	  } else {
-	    simulator()->audit_event(triangulation_.label(*eit));
-	  }
-	}
-      }
-    }
-    return true;
-  }
-
-  Event_key change_to_edge_flip(const Edge &e, Event_key k) {
-    if (k== simulator()->null_event()) return k;
-    Certificate s= extract_root_stack(k);
-    return simulator()->set_event(k, Edge_flip_event(s, e, tr_.wrapper_handle()));
-  }
-
-  Event_key change_to_facet_flip(const Facet &f, Event_key k) {
-    if (k== simulator()->null_event()) return k;
-    Certificate s= extract_root_stack(k);
-    return simulator()->set_event(k, Facet_flip_event(s, f, tr_.wrapper_handle()));
-  }
-
-  /*Moving_object_table* moving_object_table() {
-    return mpt_.pointer();
-    }*/
-
-public:
-  void clean_cell(Cell_handle h) {
-    CGAL_precondition(has_certificates_);
-    for (unsigned int i=0; i< 4; ++i) {
-      for (unsigned int j=0; j<i; ++j) {
-	Edge e(h, i, j);
-	if (has_event(e)) {
-	  make_not_edge_flip(e, h);
-	  //delete_event(triangulation_.label(e));
-	  //triangulation_.set_label(e, Event_key());
-	}
-      }
-    }
-    for (unsigned int i=0; i< 4; ++i) {
-      Facet f(h, i);
-      if (has_event(f)) {
-	simulator()->delete_event(triangulation_.label(f));
-	triangulation_.set_label(f, Event_key());
-      }
-    }
-    v_.destroy_cell(h);
-  }
-
-  void handle_new_cell(Cell_handle h) {
-    CGAL_precondition(has_certificates_);
-    for (unsigned int i=0; i<4; ++i) {
-      for (unsigned int j=0; j< i; ++j) {
-	Edge e(h, i, j);
-	if (is_degree_3(e) && !has_event(e) && !has_degree_4_vertex(e)) {
-	  make_edge_flip(e);
-	}
-      }
-      Facet f(h, i);
-      if (!has_event(f) && !has_degree_3_edge(f)) {
-	make_certificate(f);
-      }
-     
-    }
-    for (unsigned int i=0; i<4; ++i) {
-      Vertex_handle vh= h->vertex(i);
-      if (is_degree_4(vh)) {
-	suppress_edge_flips(vh);
-      } else {
-	create_edge_flips(vh);
-      }
-    }
-
-    v_.create_cell(h);
-  }
-protected:
-  void handle_changed_cell(Cell_handle) {
-    
-  }
-
-  Certificate root_stack(const Facet &f,
-			 const typename Simulator::Time &st) const
-  {
-    std::vector<Point_key> ids;
-    point_keys(f, back_inserter(ids));
-#ifndef NDEBUG
-    std::vector<Point_key> mids;
-    Facet of= triangulation_.opposite(f);
-    point_keys(of, back_inserter(mids));
-#endif
-#ifndef NDEBUG
-    CGAL_LOG(Log::LOTS, "Creating root_stack for points ");
-    for (typename std::vector<Point_key>::const_iterator cit= ids.begin(); cit != ids.end(); ++cit) {
-      CGAL_LOG(Log::LOTS, *cit);
-    }
-    CGAL_LOG(Log::LOTS, std::endl);
-#endif
-    bool is_const=true;
-    for (unsigned int i=0; i<ids.size(); ++i) {
-      if (!point(ids[i]).is_constant()) {
-	is_const=false;
-	break;
-      }
-    }
-    if (is_const) {
-      //typename Kinetic_kernel::Certificate_function cf(1.0);
-      return Certificate(); //simulator()->root_stack_object(cf);
-    }
-    else if (ids.size()==4) {
-      /*if (point(ids[0]).is_constant()){
-      // hack
-      std::swap(ids[0], ids[3]);
-      std::swap(ids[1], ids[2]);
-      }*/
-      return o3_(point(ids[0]),
-		 point(ids[1]),
-		 point(ids[2]),
-		 point(ids[3]),
-		 st,
-		 simulator()->end_time());
-    }
-    else {
-      CGAL_assertion(ids.size()==5);
-      /*if (point(ids[0]).is_constant()){
-      // hack for linear case
-      std::swap(ids[0], ids[4]);
-      std::swap(ids[1], ids[2]);
-      }*/
-      return soc_(point(ids[0]),
-		  point(ids[1]),
-		  point(ids[2]),
-		  point(ids[3]),
-		  point(ids[4]),
-		  st,
-		  simulator()->end_time());
-    }
-    // Some compilers give warnings without this
-    CGAL_postcondition(0);
-    return Certificate();
-    //return simulator()->root_stack_object(typename TraitsT::Simulator::Function_kernel::Function(0));
-  }
-
-  
-  TraitsT tr_;
-  Triangulation triangulation_;
-  std::vector<Vertex_handle> vhs_;
-  typename TraitsT::Side_of_oriented_sphere_3 soc_;
-  typename TraitsT::Orientation_3 o3_;
-  bool has_certificates_;
-  Visitor v_;
-};
-
-template <class TraitsT, class Visitor>
-inline std::ostream &operator<<(std::ostream &out,
-				const Delaunay_triangulation_base_3<TraitsT, Visitor> &dt)
-{
-  dt.write(out);
-  return out;
-}
-
-
-} } } //namespace CGAL::Kinetic::internal
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/Kernel/Cartesian_kinetic_kernel_base.h b/3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/Kernel/Cartesian_kinetic_kernel_base.h
deleted file mode 100644
index 78101fb..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/Kernel/Cartesian_kinetic_kernel_base.h
+++ /dev/null
@@ -1,259 +0,0 @@
-// Copyright (c) 2005  Stanford University (USA).
-// 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(s)     : Daniel Russel <drussel at alumni.princeton.edu>
-
-#ifndef CGAL_KINETIC_INTERNAL_KERNEL_CARTESIAN_KINETIC_KERNEL_BASE_H
-#define CGAL_KINETIC_INTERNAL_KERNEL_CARTESIAN_KINETIC_KERNEL_BASE_H
-#include <CGAL/Kinetic/basic.h>
-#include <CGAL/Kinetic/internal/Kernel/Cartesian_moving_point_1.h>
-#include <CGAL/Kinetic/internal/Kernel/Cartesian_moving_point_2.h>
-#include <CGAL/Kinetic/internal/Kernel/Cartesian_moving_point_3.h>
-#include <CGAL/Kinetic/internal/Kernel/Cartesian_moving_weighted_point_3.h>
-#include <CGAL/Kinetic/internal/Kernel/cartesian_predicates_2.h>
-#include <CGAL/Kinetic/internal/Kernel/cartesian_predicates_3.h>
-#include <CGAL/Kinetic/internal/Kernel/Reverse_time.h>
-#include <CGAL/Kinetic/internal/Kernel/Delaunay_lifting.h>
-#include <CGAL/Kinetic/Certificate_generator.h>
-#include <CGAL/Kinetic/internal/Kernel/Certificate.h>
-#include <CGAL/Kinetic/internal/Kernel/Center.h>
-
-namespace CGAL { namespace Kinetic { namespace internal {
-
-//! A kinetic kernel using cartesian coordinates
-/*!
-  It takes a PolynomialKernel as a template parameter. The PolynomialKernel is used to define the Motion_function and the Certificate_function.
-*/
-template <class Function_kernel_k, class This>
-class Cartesian_kinetic_kernel_base
-{
-public:
-  typedef Cartesian_kinetic_kernel_base<Function_kernel_k, This> Base;
-  Cartesian_kinetic_kernel_base(Function_kernel_k pk): k_(pk){};
-  Cartesian_kinetic_kernel_base(){};
-
-  //! The type of function used to represent coordinates.
-  typedef typename Function_kernel_k::Function Motion_function;
-  //! The type of function used to represent the results of certificate 
-  typedef typename Function_kernel_k::Function Certificate_function;
-
-  typedef CGAL::Kinetic::internal::Certificate<Function_kernel_k> Certificate;
-
-  //! I am not sure if I want to expose this.
-  typedef Function_kernel_k Function_kernel;
-
-  //! A 1d Point
-  typedef Cartesian_moving_point_1<Motion_function> Point_1;
-
-  //! A 2d Point
-  typedef Cartesian_moving_point_2<Motion_function> Point_2;
-
-  //! A 3d Point
-  typedef Cartesian_moving_point_3<Motion_function> Point_3;
-
-  //! A 3d weighted Point
-  typedef Cartesian_moving_weighted_point_3<Motion_function> Weighted_point_3;
-
-  //! A 3d lifted Point
-  // typedef internal::Cartesian_moving_lifted_point_3<Motion_function> Moving_lifted_point_3;
-
-
-  struct Is_constant {
-    template <class T>
-    bool operator()(const T&t) const {
-      return t.is_constant();
-    }
-  };
-
-  Is_constant is_constant_object() const {
-    return Is_constant();
-  }
-
-  //! 2D orientation
-  /*!
-    Takes 3 Point_2.
-  */
-  typedef Certificate_generator<This, Cartesian_orientation_2<This> > Orientation_2;
-  Orientation_2 orientation_2_object() const
-  {
-    return Orientation_2(k_);
-  }
-  //! 3D orientation
-  /*!
-    Takes 4 Point_3.
-  */
-  typedef Certificate_generator<This, Cartesian_weighted_orientation_3<This> > Orientation_3;
-  Orientation_3 orientation_3_object() const
-  {
-    return Orientation_3(k_);
-  }
-
-  /*typedef  Cartesian_orientation_3<This> Orientation_3;
-  Orientation_3 orientation_3_object() const
-  {
-    return Orientation_3(k_);
-    }*/
-
-  //! The in_circle test.
-  typedef Certificate_generator<This, Cartesian_side_of_oriented_circle_2<This> > Side_of_oriented_circle_2;
-  Side_of_oriented_circle_2 side_of_oriented_circle_2_object() const
-  {
-    return Side_of_oriented_circle_2(k_);
-  }
-
-  //! The 3D in_circle test.
-  typedef Certificate_generator<This, Cartesian_side_of_oriented_sphere_3<This> > Side_of_oriented_sphere_3;
-  Side_of_oriented_sphere_3 side_of_oriented_sphere_3_object() const
-  {
-    return Side_of_oriented_sphere_3(k_);
-  }
-
-  //! The power test for weighted points.
-  typedef Certificate_generator<This, Cartesian_power_test_3<This> > Power_test_3;
-  Power_test_3 power_test_3_object() const
-  {
-    return Power_test_3(k_);
-  }
-
-  //! An orientation test for weighted points.
-  typedef Certificate_generator<This, Cartesian_weighted_orientation_3<This> > Weighted_orientation_3;
-  Weighted_orientation_3 weighted_orientation_3_object() const
-  {
-    return Weighted_orientation_3(k_);
-  }
-
-  /*typedef  Cartesian_weighted_orientation_3<This> Weighted_orientation_3;
-  Weighted_orientation_3 weighted_orientation_3_object() const
-  {
-    return Weighted_orientation_3();
-    }*/
-
-  template <class Arg>
-  struct Null_generator {
-    typedef Arg argument_type;
-    typedef Arg first_argument_type;
-    typedef Arg second_argument_type;
-    typedef Arg third_argument_type;
-    typedef Arg fourth_argument_type;
-    typedef Certificate_function result_type;
-    
-    template <class AT>
-    result_type operator()(const AT &) const {
-      CGAL_error();
-      return result_type(0);
-    }
-    template <class AT0, class AT1>
-    result_type operator()(const AT0 &, const AT1 &) const {
-      CGAL_error();
-      return result_type(0);
-    }
-    template <class AT0, class AT1, class AT2>
-    result_type operator()(const AT0 &, const AT1 &,
-			   const AT2 &) const {
-      CGAL_error();
-      return result_type(0);
-    }
-    template <class AT0, class AT1, class AT2, class AT3>
-    result_type operator()(const AT0 &, const AT1 &,
-			   const AT2 &, const AT3 &) const {
-      CGAL_error();
-      return result_type(0);
-    }
-
-  };
-
-  typedef Certificate_generator<This, Null_generator<Point_3> > Compare_xyz_3;
-  Compare_xyz_3 compare_xyz_3_object() const {return Compare_xyz_3();}
-
-  typedef Certificate_generator<This, Cartesian_equal_3<This> > Equal_3;
-  Equal_3 equal_3_object() const {return Equal_3();}
-
-
-  typedef Certificate_generator<This, Null_generator<Point_3> > Coplanar_orientation_3;
-  Coplanar_orientation_3 coplanar_orientation_3_object() const {return Coplanar_orientation_3();}
-
-  typedef Certificate_generator<This, Null_generator<Point_3> > Coplanar_side_of_bounded_circle_3;
-  Coplanar_side_of_bounded_circle_3 coplanar_side_of_bounded_circle_3_object() const {return Coplanar_side_of_bounded_circle_3();}
-  
-
-  //! Compare the x coordinates of two points
-  typedef Certificate_generator<This, Cartesian_compare_distance_2<This> > Compare_distance_2;
-  Compare_distance_2 compare_distance_2_object() const {return Compare_distance_2();}
-
-  //! Compare the x coordinates of two points
-  typedef Certificate_generator<This, Cartesian_compare_distance_3<This> > Compare_distance_3;
-  Compare_distance_3 compare_distance_3_object() const {return Compare_distance_3();}
-
-  //! Compare the x coordinates of two points
-  typedef Certificate_generator<This, Cartesian_less_x_1<This> > Compare_x_1;
-  Compare_x_1 compare_x_1_object() const {return Compare_x_1(k_);}
-
-  //! Compare the x coordinates of two points
-  typedef Certificate_generator<This, Cartesian_less_x_2<This> > Compare_x_2;
-  Compare_x_2 compare_x_2_object() const {return Compare_x_2(k_);}
-
-  //! Compare the y coordinate of two points
-  typedef Certificate_generator<This, Cartesian_less_y_2<This> > Compare_y_2;
-  Compare_y_2 compare_y_2_object() const {return Compare_y_2(k_);}
-
-  //! Compare the x coordinate of two points
-  typedef Certificate_generator<This, Cartesian_less_x_3<This> > Compare_x_3;
-  Compare_x_3 compare_x_3_object() const {return Compare_x_3(k_);}
-
-  //! Compare the y coordinate of two points
-  typedef Certificate_generator<This, Cartesian_less_y_3<This> > Compare_y_3;
-  Compare_y_3 compare_y_3_object() const {return Compare_y_3(k_);}
-
-  //! Compare the z coordinate of two points
-  typedef Certificate_generator<This, Cartesian_less_z_3<This> > Compare_z_3;
-  Compare_z_3 compare_z_3_object() const {return Compare_z_3(k_);}
-
-
-
-  //! computes the lifted coordinate under the lifting map
-  typedef Delaunay_lifting<This> Delaunay_lifting_3;
-  Delaunay_lifting_3 Delaunay_lifting_3_object() const
-  {
-    return Delaunay_lifting_3();
-  }
-  //! Finds the center of an object
-  typedef Center<This> Center_3;
-  Center_3 center_3_object() const
-  {
-    return Center_3();
-  }
-  //! Return the PolynomialKernel
-  const Function_kernel &function_kernel_object() const
-  {
-    return k_;
-  }
-
-  typedef internal::Reverse_time<This> Reverse_time;
-  Reverse_time reverse_time_object() const
-  {
-    return Reverse_time(k_.negate_variable_object());
-  }
-
-protected:
-  Function_kernel k_;
-};
-
-} } } //namespace CGAL::Kinetic::internal
-
-//#include <CGAL/Kinetic_internals/kernel_undefs.h>
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/Kernel/Cartesian_moving_lifted_point_3.h b/3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/Kernel/Cartesian_moving_lifted_point_3.h
deleted file mode 100644
index a47f94b..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/Kernel/Cartesian_moving_lifted_point_3.h
+++ /dev/null
@@ -1,136 +0,0 @@
-// Copyright (c) 2005  Stanford University (USA).
-// 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(s)     : Daniel Russel <drussel at alumni.princeton.edu>
-
-#ifndef CGAL_KINETIC_CARTESIAN_WEIGHTED_MOVING_LIFTED_3_H_
-#define CGAL_KINETIC_CARTESIAN_WEIGHTED_MOVING_LIFTED_3_H_
-#include <CGAL/Kinetic/basic.h>
-#include <iostream>
-#include <CGAL/Kinetic/Kernel/Cartesian_moving_point_3.h>
-
-namespace CGAL { namespace Kinetic { namespace internal {;
-
-template <class Coordinate_t>
-class Cartesian_moving_lifted_point_3
-{
-    protected:
-        typedef Cartesian_moving_lifted_point_3<Coordinate_t> This;
-        typedef Cartesian_moving_point_3<Coordinate_t> Point;
-    public:
-
-        typedef Point Bare_point;
-//typedef Static_point_t Static_point;
-
-//! The cartesian coordinate type
-        typedef Coordinate_t Coordinate;
-
-//! What should I do for this
-        typedef typename Coordinate::NT NT;
-
-//! initialize it from polys
-        Cartesian_moving_lifted_point_3(const Point &pt, const Coordinate &w): point_(pt), lifted_(w) {
-        }
-
-//! initialize it from a still point
-        template <class Static_point>
-            Cartesian_moving_lifted_point_3(const Static_point &pt): point_(pt.point()),
-        lifted_(pt.weight()) {
-        }
-
-//! null
-        Cartesian_moving_lifted_point_3(){}
-
-        const Point &point() const
-        {
-            return point_;
-        }
-
-        const Coordinate &lifted() const
-        {
-            return lifted_;
-        }
-
-        bool is_constant() const
-        {
-            if (lifted_.degree() >0) return false;
-            return point_.is_constant();
-        }
-
-        Coordinate weight() const
-        {
-//if (weight_==Coordinate()){
-//	weight_=
-            return point().x()*point().x()+ point().y()*point().y() + point().z()*point().z() - lifted_;
-//}
-//return weight_;
-        }
-
-//! Reverse the motion
-        template <class CV>
-            This negated_time(const CV &cv) const
-        {
-            This ret(point_.negated_time(cv), cv(lifted_));
-            return ret;
-        }
-
-        template <class SK>
-            struct Static_traits
-        {
-            typedef typename SK::Weighted_point Static_type;
-            static Static_type to_static(const This &o, const typename Coordinate_t::NT &t, const SK&) {
-                typename Coordinate_t::NT x=o.point().x()(t),
-                    y= o.point().y()(t),
-                    z= o.point().z()(t);
-                return Static_type(typename SK::Bare_point(x,y,z),
-                    CGAL::square(x)
-                    + CGAL::square(y)
-                    + CGAL::square(z)- o.lifted()(t));
-            }
-        };
-        template <class Converter>
-            struct Coordinate_converter
-        {
-            Coordinate_converter(const Converter &c): c_(c), pc_(c){}
-            typedef Cartesian_moving_weighted_point_3<typename Converter::argument_type> argument_type;
-            typedef Cartesian_moving_weighted_point_3<typename Converter::result_type> result_type;
-
-            result_type operator()(const argument_type &i) const
-            {
-                return result_type(pc_(i.point()), c_(i.lifted()));
-            }
-
-            Converter c_;
-            typename Bare_point::template Coordinate_converter<Converter> pc_;
-        };
-    protected:
-        Point point_;
-        Coordinate lifted_;
-// Coordinate weight_;
-};
-
-template <class Coordinate>
-std::ostream &operator<<(std::ostream &out, const Cartesian_moving_lifted_point_3<Coordinate> &point)
-{
-    out << point.point() << ", " <<  point.lifted();
-    return out;
-}
-
-
-} } } //namespace CGAL::Kinetic::internal;
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/Kernel/cartesian_predicates_3.h b/3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/Kernel/cartesian_predicates_3.h
deleted file mode 100644
index 14f9deb..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/Kernel/cartesian_predicates_3.h
+++ /dev/null
@@ -1,815 +0,0 @@
-// Copyright (c) 2005  Stanford University (USA).
-// 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(s)     : Daniel Russel <drussel at alumni.princeton.edu>
-
-#ifndef CGAL_KINETIC_CARTESIAN_PREDICATES_3_H
-#define CGAL_KINETIC_CARTESIAN_PREDICATES_3_H
-#include <CGAL/Kinetic/basic.h>
-#include <CGAL/determinant.h>
-
-//#include <CGAL/Kinetic/kernel/Cartesian_moving_sphere_3.h>
-
-namespace CGAL { namespace Kinetic { namespace internal {
-
-
-
-template <class KK>
-struct Cartesian_side_of_oriented_sphere_3
-{
-  Cartesian_side_of_oriented_sphere_3(){}
-
-  typedef typename KK::Certificate_function result_type;
-  typedef typename KK::Point_3 first_argument_type;
-  typedef typename KK::Point_3 second_argument_type;
-  typedef typename KK::Point_3 third_argument_type;
-  typedef typename KK::Point_3 fourth_argument_type;
-  typedef typename KK::Point_3 fifth_argument_type;
-  result_type operator()(const first_argument_type &a,
-			 const second_argument_type &b,
-			 const third_argument_type &c,
-			 const fourth_argument_type &d,
-			 const fourth_argument_type &e)const
-  {
-    typedef typename KK::Motion_function FT;
-    // We translate the points so that T becomes the origin.
-    FT dpx = (a.x()) - (e.x());
-    FT dpy = (a.y()) - (e.y());
-    FT dpz = (a.z()) - (e.z());
-    FT dpt = dpx*dpx + dpy*dpy + dpz*dpz;
-    FT dqx = (b.x()) - (e.x());
-    FT dqy = (b.y()) - (e.y());
-    FT dqz = (b.z()) - (e.z());
-    FT dqt = dqx*dqx + dqy*dqy + dqz*dqz;
-    FT drx = (c.x()) - (e.x());
-    FT dry = (c.y()) - (e.y());
-    FT drz = (c.z()) - (e.z());
-    FT drt = drx*drx + dry*dry + drz*drz;
-    FT dsx = (d.x()) - (e.x());
-    FT dsy = (d.y()) - (e.y());
-    FT dsz = (d.z()) - (e.z());
-    FT dst = dsx*dsx + dsy*dsy + dsz*dsz;
-    FT ret= CGAL::determinant(dpx, dpy, dpz, dpt,
-				    dqx, dqy, dqz, dqt,
-				    drx, dry, drz, drt,
-				    dsx, dsy, dsz, dst);
-    /*  CGAL_KINETIC_MAPLE_LOG( << std::endl << std::endl;
-	CGAL_KINETIC_MAPLE_LOG( << "pt3\n";
-	CGAL_KINETIC_MAPLE_LOG( << "m:=matrix(5,5,[[";
-	CGAL_KINETIC_MAPLE_LOG(
-	<< a.x() << ", " << a.y() << ", " << a.z() << ", " << a.x()*a.x()+a.y()*a.y()+a.z()*a.z() << ", 1], ["
-	<< a.x() << ", " << b.y() << ", " << b.z() << ", " << b.x()*b.x()+b.y()*b.y()+b.z()*b.z() << ", 1], ["
-	<< c.x() << ", " << c.y() << ", " << c.z() << ", " << c.x()*c.x()+c.y()*c.y()+c.z()*c.z() << ", 1], ["
-	<< d.x() << ", " << d.y() << ", " << d.z() << ", " << d.x()*d.x()+d.y()*d.y()+d.z()*a.z() << ", 1], ["
-	<< e.x() << ", " << e.y() << ", " << e.z() << ", " << e.x()*e.x()+e.y()*e.y()+e.z()*e.z() << ", 1]]);\n";
-	CGAL_KINETIC_MAPLE_LOG( << "det(m)-( " << ret << ");\n";
-	::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << "m2:= matrix(4,4,[[";
-	::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << dpx << "," << dpy << "," << dpz << "," << dpt << "], [";
-	::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << dqx << "," << dqy << "," << dqz << "," << dqt << "], [";
-	::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << drx << "," << dry << "," << drz << "," << drt << "], [";
-	::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << dsx << "," << dsy << "," << dsz << "," << dst << "]]);\n";
-    */
-    return ret;
-  }
-};
-
-template <class KK>
-struct Cartesian_power_test_3
-{
-  typedef typename KK::Certificate_function result_type;
-  typedef typename KK::Weighted_point_3 first_argument_type;
-  typedef typename KK::Weighted_point_3 second_argument_type;
-  typedef typename KK::Weighted_point_3 third_argument_type;
-  typedef typename KK::Weighted_point_3 fourth_argument_type;
-  typedef typename KK::Weighted_point_3 fifth_argument_type;
-  Cartesian_power_test_3(){}
-  result_type operator()(const first_argument_type &a,
-			 const second_argument_type &b,
-			 const third_argument_type &c,
-			 const fourth_argument_type &d,
-			 const fourth_argument_type &e)const
-  {
-    typedef typename KK::Motion_function FT;
-    // We translate the points so that T becomes the origin.
-    FT dpx = (a.point().x()) - (e.point().x());
-    FT dpy = (a.point().y()) - (e.point().y());
-    FT dpz = (a.point().z()) - (e.point().z());
-    FT dpt = dpx*dpx + dpy*dpy
-      + dpz*dpz - (a.weight()) + (e.weight());
-    FT dqx = (b.point().x()) - (e.point().x());
-    FT dqy = (b.point().y()) - (e.point().y());
-    FT dqz = (b.point().z()) - (e.point().z());
-    FT dqt = dqx*dqx + dqy*dqy
-      + dqz*dqz - (b.weight()) + (e.weight());
-    FT drx = (c.point().x()) - (e.point().x());
-    FT dry = (c.point().y()) - (e.point().y());
-    FT drz = (c.point().z()) - (e.point().z());
-    FT drt = drx*drx + dry*dry
-      + drz*drz - (c.weight()) + (e.weight());
-    FT dsx = (d.point().x()) - (e.point().x());
-    FT dsy = (d.point().y()) - (e.point().y());
-    FT dsz = (d.point().z()) - (e.point().z());
-    FT dst = dsx*dsx + dsy*dsy
-      + dsz*dsz - (d.weight()) + (e.weight());
-
-    return ::CGAL::determinant(dpx, dpy, dpz, dpt,
-				     dqx, dqy, dqz, dqt,
-				     drx, dry, drz, drt,
-				     dsx, dsy, dsz, dst);
-  }
-
- result_type operator()(const first_argument_type &,
-			const second_argument_type &,
-			const third_argument_type &,
-			const fourth_argument_type &)const
-  {
-    CGAL_error();
-    return result_type();
-  }
-  result_type operator()(const first_argument_type &,
-			 const second_argument_type &,
-			 const third_argument_type &)const
-  {
-    CGAL_error();
-    return result_type();
-  }
-  result_type operator()(const first_argument_type &,
-			 const second_argument_type &)const
-  {
-    CGAL_error();
-    return result_type();
-  }
-};
-
-// Works for unweighted points.
-template <class KK>
-struct Cartesian_lifted_power_test_3
-{
-  Cartesian_lifted_power_test_3(){}
-  typedef typename KK::Certificate_function result_type;
-  typedef typename KK::Weighted_point_3 first_argument_type;
-  typedef typename KK::Weighted_point_3 second_argument_type;
-  typedef typename KK::Weighted_point_3 third_argument_type;
-  typedef typename KK::Weighted_point_3 fourth_argument_type;
-  typedef typename KK::Weighted_point_3 fifth_argument_type;
-  result_type operator()(const first_argument_type &a,
-			 const second_argument_type &b,
-			 const third_argument_type &c,
-			 const fourth_argument_type &d,
-			 const fourth_argument_type &e)const
-  {
-    typedef typename KK::Motion_function FT;
-
-    FT dpx = (a.point().x()) - (e.point().x());
-    FT dpy = (a.point().y()) - (e.point().y());
-    FT dpz = (a.point().z()) - (e.point().z());
-    FT dpt = (a.lifted()) - (e.lifted());
-    FT dqx = (b.point().x()) - (e.point().x());
-    FT dqy = (b.point().y()) - (e.point().y());
-    FT dqz = (b.point().z()) - (e.point().z());
-    FT dqt = (b.lifted()) - (e.lifted());
-    FT drx = (c.point().x()) - (e.point().x());
-    FT dry = (c.point().y()) - (e.point().y());
-    FT drz = (c.point().z()) - (e.point().z());
-    FT drt = (c.lifted()) - (e.lifted());
-    FT dsx = (d.point().x()) - (e.point().x());
-    FT dsy = (d.point().y()) - (e.point().y());
-    FT dsz = (d.point().z()) - (e.point().z());
-    FT dst = (d.lifted()) - (e.lifted());
-
-    return CGAL::determinant(dpx, dpy, dpz, dpt,
-				   dqx, dqy, dqz, dqt,
-				   drx, dry, drz, drt,
-				   dsx, dsy, dsz, dst);
-  }
-};
-
-template <class KK>
-struct Cartesian_linear_lifted_power_test_3
-{
-  Cartesian_linear_lifted_power_test_3(){}
-  typedef typename KK::Certificate_function result_type;
-  typedef typename KK::Weighted_point_3 first_argument_type;
-  typedef typename KK::Weighted_point_3 second_argument_type;
-  typedef typename KK::Weighted_point_3 third_argument_type;
-  typedef typename KK::Weighted_point_3 fourth_argument_type;
-  typedef typename KK::Weighted_point_3 fifth_argument_type;
-  result_type operator()(first_argument_type a,
-			 second_argument_type b,
-			 third_argument_type c,
-			 fourth_argument_type d,
-			 fourth_argument_type e)const
-  {
-    typedef typename KK::Motion_function FT;
-    typedef typename FT::NT NT;
-    /*if (a.is_constant()){
-      std::swap(a,e);
-      std::swap(b,c);
-      }*/
-
-    //typedef typename RT::NT FT;
-    // We translate the points so that T becomes the origin.
-    FT safe_ret;
-
-    {
-      FT dpx = (a.point().x()) - (e.point().x());
-      FT dpy = (a.point().y()) - (e.point().y());
-      FT dpz = (a.point().z()) - (e.point().z());
-      FT dpt = (a.lifted()) - (e.lifted());
-      FT dqx = (b.point().x()) - (e.point().x());
-      FT dqy = (b.point().y()) - (e.point().y());
-      FT dqz = (b.point().z()) - (e.point().z());
-      FT dqt = (b.lifted()) - (e.lifted());
-      FT drx = (c.point().x()) - (e.point().x());
-      FT dry = (c.point().y()) - (e.point().y());
-      FT drz = (c.point().z()) - (e.point().z());
-      FT drt = (c.lifted()) - (e.lifted());
-      FT dsx = (d.point().x()) - (e.point().x());
-      FT dsy = (d.point().y()) - (e.point().y());
-      FT dsz = (d.point().z()) - (e.point().z());
-      FT dst = (d.lifted()) - (e.lifted());
-
-      safe_ret = CGAL::determinant(dpx, dpy, dpz, dpt,
-					 dqx, dqy, dqz, dqt,
-					 drx, dry, drz, drt,
-					 dsx, dsy, dsz, dst);
-    }
-    FT ret;
-    {
-      if (!b.is_constant()) {
-	std::swap(a,b);
-	std::swap(c,d);
-      }
-      else if (! c.is_constant()) {
-	std::swap(a,c);
-	std::swap(b,d);
-      }
-      else if (! d.is_constant()) {
-	std::swap(a,d);
-	std::swap(b,c);
-      }
-      else if (! e.is_constant()) {
-	std::swap(a,e);
-	std::swap(b,c);
-      }
-      CGAL_precondition(b.is_constant());
-      CGAL_precondition(c.is_constant());
-      CGAL_precondition(d.is_constant());
-      CGAL_precondition(e.is_constant());
-
-      FT a00 = a.point().x() - e.point().x();
-      FT a01 = a.point().y() - e.point().y();
-      FT a02 = a.point().z() - e.point().z();
-      FT a03 = a.lifted() - e.lifted();
-      NT a10 = b.point().x()[0] - e.point().x()[0];
-      NT a11 = b.point().y()[0] - e.point().y()[0];
-      NT a12 = b.point().z()[0] - e.point().z()[0];
-      NT a13 = b.lifted()[0] - e.lifted()[0];
-      NT a20 = c.point().x()[0] - e.point().x()[0];
-      NT a21 = c.point().y()[0] - e.point().y()[0];
-      NT a22 = c.point().z()[0] - e.point().z()[0];
-      NT a23 = c.lifted()[0] - e.lifted()[0];
-      NT a30 = d.point().x()[0] - e.point().x()[0];
-      NT a31 = d.point().y()[0] - e.point().y()[0];
-      NT a32 = d.point().z()[0] - e.point().z()[0];
-      NT a33 = d.lifted()[0] - e.lifted()[0];
-      // First ompute the det2x2
-      const FT m01 = a10*a01 - a00*a11;
-      const FT m02 = a20*a01 - a00*a21;
-      const FT m03 = a30*a01 - a00*a31;
-      const NT m12 = a20*a11 - a10*a21;
-      const NT m13 = a30*a11 - a10*a31;
-      const NT m23 = a30*a21 - a20*a31;
-      // Now compute the minors of rank 3
-      const FT m012 = m12*a02 - m02*a12 + m01*a22;
-      const FT m013 = m13*a02 - m03*a12 + m01*a32;
-      const FT m023 = m23*a02 - m03*a22 + m02*a32;
-      const NT m123 = m23*a12 - m13*a22 + m12*a32;
-      // Now compute the minors of rank 4
-      const FT m0123 = m123*a03 - m023*a13 + m013*a23 - m012*a33;
-      ret= m0123;
-    }
-    if (ret != safe_ret) {
-      ret.print();
-      safe_ret.print();
-      std::cout << a << std::endl;
-      std::cout << b << std::endl;
-      std::cout << c << std::endl;
-      std::cout << d << std::endl;
-      std::cout << e << std::endl;
-    }
-    CGAL_exactness_postcondition(ret==safe_ret);
-    return ret;
-  }
-};
-
-template <class Pt>
-typename Pt::Coordinate co3(const Pt &a, const Pt &b, const Pt &c, const Pt &d)
-{
-  //std::cout << "Computing orientation of matrix(4,4, [[" << a << ",1], [" << b << ",1], [" << c << ",1], [" << d << ",1]]);\n";
-  typedef typename Pt::Coordinate RT;
-
-  RT px= (a.x());
-  RT py= (a.y());
-  RT pz= (a.z());
-  RT qx= (b.x());
-  RT qy= (b.y());
-  RT qz= (b.z());
-  RT rx= (c.x());
-  RT ry= (c.y());
-  RT rz= (c.z());
-  RT sx= (d.x());
-  RT sy= (d.y());
-  RT sz= (d.z());
-  if (d.is_constant()) {
-    std::swap(px, sx);
-    std::swap(py, sy);
-    std::swap(pz, sz);
-    std::swap(rx, qx);
-    std::swap(ry, qy);
-    std::swap(rz, qz);
-  }
-
-  RT a00= qx-px;
-  RT a01= rx-px;
-  RT a02= sx-px;
-  RT a10= qy-py;
-  RT a11= ry-py;
-  RT a12= sy-py;
-  RT a20= qz-pz;
-  RT a21= rz-pz;
-  RT a22= sz-pz;
-  RT ret= CGAL::determinant(a00, a01, a02,
-				  a10, a11, a12,
-				  a20, a21, a22);
-  /*CGAL_LOG_MAPLE(std::endl << std::endl);
-    CGAL_LOG_MAPLE( "co3\n");
-    CGAL_LOG_MAPLE( "m:= matrix(4,4, [[1," << a.x()<<","<<a.y() <<","<<a.z() << "], [1," << b.x()<<","<<b.y()<<","<<b.z());
-    CGAL_LOG_MAPLE( "], [1," << c.x() <<","<<c.y()<<","<<c.z() << "], [1,");
-    CGAL_LOG_MAPLE( d.x() << ","<<d.y()<<","<<d.z() << "]]);"<< std::endl);
-    CGAL_LOG_MAPLE( "det(m)- (" << ret << ");" << std::endl);
-    CGAL_LOG_MAPLE( "m2:= matrix(3,3,[[,");
-    CGAL_LOG_MAPLE( a00 << "," << a01 << "," << a02 << "], [");
-    CGAL_LOG_MAPLE( a10 << "," << a11 << "," << a12 << "], [");
-    CGAL_LOG_MAPLE( a20 << "," << a21 << "," << a22 << "]]);");*/
-
-  //std::cout << "returning " << ret << std::endl;
-  return ret;
-}
-
-
-
-
-template <class KK>
-struct Cartesian_orientation_3
-{
-  Cartesian_orientation_3(){}
-
-  typedef typename KK::Certificate_function result_type;
-
-  typedef typename KK::Point_3 first_argument_type;
-  typedef typename KK::Point_3 second_argument_type;
-  typedef typename KK::Point_3 third_argument_type;
-  typedef typename KK::Point_3 fourth_argument_type;
-  result_type operator()(const first_argument_type &a,
-			 const second_argument_type &b,
-			 const third_argument_type &c,
-			 const fourth_argument_type &d) const
-  {
-    return co3(a, b, c, d);
-  }
-};
-
-template <class KK>
-struct Cartesian_weighted_orientation_3: public Cartesian_orientation_3<KK>
-{
-  Cartesian_weighted_orientation_3(){}
-  typedef typename KK::Certificate_function result_type;
-
-  typedef typename KK::Weighted_point_3 first_argument_type;
-  typedef typename KK::Weighted_point_3 second_argument_type;
-  typedef typename KK::Weighted_point_3 third_argument_type;
-  typedef typename KK::Weighted_point_3 fourth_argument_type;
-  template <class NWP>
-    result_type operator()(const NWP &a,
-			   const NWP &b,
-			   const NWP &c,
-			   const NWP &d) const {
-    return Cartesian_orientation_3<KK>::operator()(a,b,c,d);
-  }
-  result_type operator()(const first_argument_type &a,
-			 const second_argument_type &b,
-			 const third_argument_type &c,
-			 const fourth_argument_type &d) const
-  {
-    return co3(a.point(), b.point(), c.point(), d.point());
-  }
-
-};
-
-template <class KK>
-struct Cartesian_less_x_3
-{
-  Cartesian_less_x_3(){}
-  typedef typename KK::Certificate_function result_type;
-  typedef typename KK::Point_3 first_argument_type;
-  typedef typename KK::Point_3 second_argument_type;
-  result_type operator()(const first_argument_type &a,
-			 const second_argument_type &b) const
-  {
-    return a.x() - b.x();
-  }
-  typedef typename KK::Motion_function::NT NT;  
-  result_type operator()( const NT &c, const first_argument_type &a) const {
-    return result_type(c) - a.x();
-  }
-
-  result_type operator()(const second_argument_type &b, const NT &c ) const {
-    return b.x() - result_type(c);
-  }
-};
-
-template <class KK>
-struct Cartesian_less_y_3
-{
-  Cartesian_less_y_3(){}
-  typedef typename KK::Certificate_function result_type;
-
-  typedef typename KK::Point_3 first_argument_type;
-  typedef typename KK::Point_3 second_argument_type;
-  result_type operator()(const first_argument_type &a,
-			 const second_argument_type &b) const
-  {
-    return a.y() - b.y();
-  }
-  typedef typename KK::Motion_function::NT NT;  
-  result_type operator()(const NT &c, const first_argument_type &a) const {
-    return result_type(c) - a.y();
-  }
-
-  result_type operator()( const second_argument_type &b, const NT &c) const {
-    return b.y() - result_type(c);
-  }
-};
-
-template <class KK>
-struct Cartesian_less_z_3
-{
-  Cartesian_less_z_3(){}
-  typedef typename KK::Certificate_function result_type;
-
-  typedef typename KK::Point_3 first_argument_type;
-  typedef typename KK::Point_3 second_argument_type;
-  result_type operator()(const first_argument_type &a,
-			 const second_argument_type &b) const
-  {
-    return a.z() - b.z();
-  }
-  typedef typename KK::Motion_function::NT NT;  
-  result_type operator()(const NT &c, const first_argument_type &a) const {
-    return result_type(c) - a.z();
-  }
-
-  result_type operator()( const second_argument_type &b, const NT &c) const {
-    return b.z() - result_type(c);
-  }
-
-};
-
-
-template <class KK>
-struct Cartesian_equal_3
-{
-  Cartesian_equal_3(){}
-  typedef typename KK::Certificate_function result_type;
-
-  typedef typename KK::Point_3 first_argument_type;
-  typedef typename KK::Point_3 second_argument_type;
-  template <class AT>
-  result_type operator()(const AT &a,
-			 const AT &b) const
-  {
-    if (a==b) return result_type(1);
-    else return result_type(-1);
-  }
- 
-
- 
-};
-
-/*PREDICATE_2_BEGIN(Point_sphere_orientation_3){
-  return ;
-  }
-  PREDICATE_2_END(Cartesian_less_z_3);*/
-
-#if 0
-template <class Pt, class CC>
-typename CC::result_type co3(const Pt &a, const Pt &b, const Pt &c, const Pt &d, CC cc)
-{
-  //std::cout << "Computing orientation of matrix(4,4, [[" << a << ",1], [" << b << ",1], [" << c << ",1], [" << d << ",1]]);\n";
-  typedef typename CC::result_type RT;
-
-  RT px= cc(a.x());
-  RT py= cc(a.y());
-  RT pz= cc(a.z());
-  RT qx= cc(b.x());
-  RT qy= cc(b.y());
-  RT qz= cc(b.z());
-  RT rx= cc(c.x());
-  RT ry= cc(c.y());
-  RT rz= cc(c.z());
-  RT sx= cc(d.x());
-  RT sy= cc(d.y());
-  RT sz= cc(d.z());
-  if (d.is_constant()) {
-    std::swap(px, sx);
-    std::swap(py, sy);
-    std::swap(pz, sz);
-    std::swap(rx, qx);
-    std::swap(ry, qy);
-    std::swap(rz, qz);
-  }
-
-  RT a00= qx-px;
-  RT a01= rx-px;
-  RT a02= sx-px;
-  RT a10= qy-py;
-  RT a11= ry-py;
-  RT a12= sy-py;
-  RT a20= qz-pz;
-  RT a21= rz-pz;
-  RT a22= sz-pz;
-  RT ret= CGAL::determinant(a00, a01, a02,
-				  a10, a11, a12,
-				  a20, a21, a22);
-  CGAL::Kinetic::log()->stream(CGAL::KDS::Log::MAPLE) << std::endl << std::endl;
-  CGAL::Kinetic::log()->stream(CGAL::KDS::Log::MAPLE) << "co3\n";
-  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << "m:= matrix(4,4, [[1," << a.x()<<","<<a.y() <<","<<a.z() << "], [1," << b.x()<<","<<b.y()<<","<<b.z();
-  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << "], [1," << c.x() <<","<<c.y()<<","<<c.z() << "], [1,";
-  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << d.x() << ","<<d.y()<<","<<d.z() << "]]);"<< std::endl;
-  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << "det(m)- (" << ret << ");" << std::endl;
-  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << "m2:= matrix(3,3,[[,";
-  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << a00 << "," << a01 << "," << a02 << "], [";
-  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << a10 << "," << a11 << "," << a12 << "], [";
-  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << a20 << "," << a21 << "," << a22 << "]]);";
-
-  //std::cout << "returning " << ret << std::endl;
-  return ret;
-}
-
-
-template <class Pt, class CC>
-typename CC::result_type pt3(const Pt &a, const Pt &b, const Pt &c, const Pt &d, const Pt &e, CC cc)
-{
-  typedef typename CC::result_type FT;
-  //typedef typename RT::NT FT;
-  // We translate the points so that T becomes the origin.
-  FT dpx = cc(a.point().x()) - cc(e.point().x());
-  FT dpy = cc(a.point().y()) - cc(e.point().y());
-  FT dpz = cc(a.point().z()) - cc(e.point().z());
-  FT dpt = dpx*dpx + dpy*dpy
-    + dpz*dpz - cc(a.weight()) + cc(e.weight());
-  FT dqx = cc(b.point().x()) - cc(e.point().x());
-  FT dqy = cc(b.point().y()) - cc(e.point().y());
-  FT dqz = cc(b.point().z()) - cc(e.point().z());
-  FT dqt = dqx*dqx + dqy*dqy
-    + dqz*dqz - cc(b.weight()) + cc(e.weight());
-  FT drx = cc(c.point().x()) - cc(e.point().x());
-  FT dry = cc(c.point().y()) - cc(e.point().y());
-  FT drz = cc(c.point().z()) - cc(e.point().z());
-  FT drt = drx*drx + dry*dry
-    + drz*drz - cc(c.weight()) + cc(e.weight());
-  FT dsx = cc(d.point().x()) - cc(e.point().x());
-  FT dsy = cc(d.point().y()) - cc(e.point().y());
-  FT dsz = cc(d.point().z()) - cc(e.point().z());
-  FT dst = dsx*dsx + dsy*dsy
-    + dsz*dsz - cc(d.weight()) + cc(e.weight());
-
-  return CGAL::determinant(dpx, dpy, dpz, dpt,
-				 dqx, dqy, dqz, dqt,
-				 drx, dry, drz, drt,
-				 dsx, dsy, dsz, dst);
-}
-
-
-template <class C, class CC>
-typename CC::result_type pt3(const Cartesian_moving_point_3<C>  &a,
-			     const Cartesian_moving_point_3<C>  &b,
-			     const Cartesian_moving_point_3<C>  &c,
-			     const Cartesian_moving_point_3<C>  &d,
-			     const Cartesian_moving_point_3<C>  &e, CC cc)
-{
-  typedef typename CC::result_type FT;
-  //typedef typename RT::NT FT;
-  // We translate the points so that T becomes the origin.
-  FT dpx = cc(a.x()) - cc(e.x());
-  FT dpy = cc(a.y()) - cc(e.y());
-  FT dpz = cc(a.z()) - cc(e.z());
-  FT dpt = dpx*dpx + dpy*dpy + dpz*dpz;
-  FT dqx = cc(b.x()) - cc(e.x());
-  FT dqy = cc(b.y()) - cc(e.y());
-  FT dqz = cc(b.z()) - cc(e.z());
-  FT dqt = dqx*dqx + dqy*dqy + dqz*dqz;
-  FT drx = cc(c.x()) - cc(e.x());
-  FT dry = cc(c.y()) - cc(e.y());
-  FT drz = cc(c.z()) - cc(e.z());
-  FT drt = drx*drx + dry*dry + drz*drz;
-  FT dsx = cc(d.x()) - cc(e.x());
-  FT dsy = cc(d.y()) - cc(e.y());
-  FT dsz = cc(d.z()) - cc(e.z());
-  FT dst = dsx*dsx + dsy*dsy + dsz*dsz;
-  FT ret= CGAL::determinant(dpx, dpy, dpz, dpt,
-				  dqx, dqy, dqz, dqt,
-				  drx, dry, drz, drt,
-				  dsx, dsy, dsz, dst);
-  CGAL::Kinetic::log()->stream(CGAL::KDS::Log::MAPLE) << std::endl << std::endl;
-  CGAL::Kinetic::log()->stream(CGAL::KDS::Log::MAPLE) << "pt3\n";
-  CGAL::Kinetic::log()->stream(CGAL::KDS::Log::MAPLE) << "m:=matrix(5,5,[[";
-  CGAL::Kinetic::log()->stream(CGAL::KDS::Log::MAPLE)
-    << a.x() << ", " << a.y() << ", " << a.z() << ", " << a.x()*a.x()+a.y()*a.y()+a.z()*a.z() << ", 1], ["
-    << a.x() << ", " << b.y() << ", " << b.z() << ", " << b.x()*b.x()+b.y()*b.y()+b.z()*b.z() << ", 1], ["
-    << c.x() << ", " << c.y() << ", " << c.z() << ", " << c.x()*c.x()+c.y()*c.y()+c.z()*c.z() << ", 1], ["
-    << d.x() << ", " << d.y() << ", " << d.z() << ", " << d.x()*d.x()+d.y()*d.y()+d.z()*a.z() << ", 1], ["
-    << e.x() << ", " << e.y() << ", " << e.z() << ", " << e.x()*e.x()+e.y()*e.y()+e.z()*e.z() << ", 1]]);\n";
-  CGAL::Kinetic::log()->stream(CGAL::KDS::Log::MAPLE) << "det(m)-( " << ret << ");\n";
-  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << "m2:= matrix(4,4,[[";
-  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << dpx << "," << dpy << "," << dpz << "," << dpt << "], [";
-  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << dqx << "," << dqy << "," << dqz << "," << dqt << "], [";
-  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << drx << "," << dry << "," << drz << "," << drt << "], [";
-  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << dsx << "," << dsy << "," << dsz << "," << dst << "]]);\n";
-
-  return ret;
-}
-
-
-template <class NT, class CC>
-typename CC::result_type pt3(Cartesian_moving_lifted_point_3<CGAL::Polynomial::Linear_polynomial<NT> > a,
-			     Cartesian_moving_lifted_point_3<CGAL::Polynomial::Linear_polynomial<NT> > b,
-			     Cartesian_moving_lifted_point_3<CGAL::Polynomial::Linear_polynomial<NT> > c,
-			     Cartesian_moving_lifted_point_3<CGAL::Polynomial::Linear_polynomial<NT> > d,
-			     Cartesian_moving_lifted_point_3<CGAL::Polynomial::Linear_polynomial<NT> > e,
-			     CC cc)
-{
-  typedef typename CC::result_type FT;
-  bool flip=false;
-  bool warning_this_doesnt_really_work;
-  if (!e.is_constant()) {
-    flip=!flip;
-    std::swap(a,e);
-  }
-  else if (!d.is_constant()) {
-    flip=!flip;
-    std::swap(d,a);
-  }
-  else if (!c.is_constant()) {
-    std::swap(c,a);
-    flip=!flip;
-  }
-  else if (!b.is_constant()) {
-    std::swap(b,a);
-    flip=!flip;
-  }
-  /*  if (a.is_constant()){
-      std::swap(a,e);
-      std::swap(b,c);
-      }*/
-
-  //typedef typename RT::NT FT;
-  // We translate the points so that T becomes the origin.
-  //FT m[4][4];
-  FT a03 = cc(a.point().x()) - cc(e.point().x());
-  FT a13 = cc(a.point().y()) - cc(e.point().y());
-  FT a23 = cc(a.point().z()) - cc(e.point().z());
-  FT a33 = cc(a.lifted()) - cc(e.lifted());
-  FT a02 = cc(b.point().x()) - cc(e.point().x());
-  FT a12 = cc(b.point().y()) - cc(e.point().y());
-  FT a22 = cc(b.point().z()) - cc(e.point().z());
-  FT a32 = cc(b.lifted()) - cc(e.lifted());
-  FT a01 = cc(c.point().x()) - cc(e.point().x());
-  FT a11 = cc(c.point().y()) - cc(e.point().y());
-  FT a21 = cc(c.point().z()) - cc(e.point().z());
-  FT a31 = cc(c.lifted()) - cc(e.lifted());
-  FT a00 = cc(d.point().x()) - cc(e.point().x());
-  FT a10 = cc(d.point().y()) - cc(e.point().y());
-  FT a20 = cc(d.point().z()) - cc(e.point().z());
-  FT a30 = cc(d.lifted()) - cc(e.lifted());
-
-  FT ret;
-  {
-    // First compute the det2x2
-    const NT m01 = a10[0]*a01[0] - a00[0]*a11[0];
-    const NT m02 = a20[0]*a01[0] - a00[0]*a21[0];
-    const NT m03 = a30[0]*a01[0] - a00[0]*a31[0];
-    const NT m12 = a20[0]*a11[0] - a10[0]*a21[0];
-    const NT m13 = a30[0]*a11[0] - a10[0]*a31[0];
-    const NT m23 = a30[0]*a21[0] - a20[0]*a31[0];
-    // Now compute the minors of rank 3
-    const NT m012 = m12*a02[0] - m02*a12[0] + m01*a22[0];
-    const NT m013 = m13*a02[0] - m03*a12[0] + m01*a32[0];
-    const NT m023 = m23*a02[0] - m03*a22[0] + m02*a32[0];
-    const NT m123 = m23*a12[0] - m13*a22[0] + m12*a32[0];
-    // Now compute the minors of rank 4
-    const FT m0123 = m123*a03 - m023*a13 + m013*a23 - m012*a33;
-    ret= m0123;
-  }
-  if (flip) ret=-ret;
-  /*FT ret = CGAL::determinant(dpx, dpy, dpz, dpt,
-    dqx, dqy, dqz, dqt,
-    drx, dry, drz, drt,
-    dsx, dsy, dsz, dst);*/
-
-#if 0
-  CGAL::Kinetic::log()->stream(CGAL::KDS::Log::MAPLE) << std::endl << std::endl;
-  CGAL::Kinetic::log()->stream(CGAL::KDS::Log::MAPLE) << "pt3 lifted\n";
-  CGAL::Kinetic::log()->stream(CGAL::KDS::Log::MAPLE) << "m:=matrix(5,5,[[";
-  CGAL::Kinetic::log()->stream(CGAL::KDS::Log::MAPLE)
-    << a.point().x() << ", " << a.point().y() << ", " << a.point().z() << ", " << a.lifted() << ", 1], ["
-    << b.point().x() << ", " << b.point().y() << ", " << b.point().z() << ", " << b.lifted() << ", 1], ["
-    << c.point().x() << ", " << c.point().y() << ", " << c.point().z() << ", " << c.lifted() << ", 1], ["
-    << d.point().x() << ", " << d.point().y() << ", " << d.point().z() << ", " << d.lifted() << ", 1], ["
-    << e.point().x() << ", " << e.point().y() << ", " << e.point().z() << ", " << e.lifted() << ", 1]]);\n";
-  CGAL::Kinetic::log()->stream(CGAL::KDS::Log::MAPLE) << "det(m)-( " << ret << ");\n";
-  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << "m2:= matrix(4,4,[[";
-  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << dpx << "," << dpy << "," << dpz << "," << dpt << "], [";
-  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << dqx << "," << dqy << "," << dqz << "," << dqt << "], [";
-  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << drx << "," << dry << "," << drz << "," << drt << "], [";
-  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << dsx << "," << dsy << "," << dsz << "," << dst << "]]);\n";
-#endif
-  return ret;
-}
-
-
-template <class C, class CC>
-typename CC::result_type pt3(Cartesian_moving_lifted_point_3<C> a,
-			     Cartesian_moving_lifted_point_3<C> b,
-			     Cartesian_moving_lifted_point_3<C> c,
-			     const Cartesian_moving_lifted_point_3<C> &d,
-			     Cartesian_moving_lifted_point_3<C> e,
-			     CC cc)
-{
-  typedef typename CC::result_type FT;
-
-  if (a.is_constant()) {
-    std::swap(a,e);
-    std::swap(b,c);
-  }
-
-  //typedef typename RT::NT FT;
-  // We translate the points so that T becomes the origin.
-  FT dpx = cc(a.point().x()) - cc(e.point().x());
-  FT dpy = cc(a.point().y()) - cc(e.point().y());
-  FT dpz = cc(a.point().z()) - cc(e.point().z());
-  FT dpt = cc(a.lifted()) - cc(e.lifted());
-  FT dqx = cc(b.point().x()) - cc(e.point().x());
-  FT dqy = cc(b.point().y()) - cc(e.point().y());
-  FT dqz = cc(b.point().z()) - cc(e.point().z());
-  FT dqt = cc(b.lifted()) - cc(e.lifted());
-  FT drx = cc(c.point().x()) - cc(e.point().x());
-  FT dry = cc(c.point().y()) - cc(e.point().y());
-  FT drz = cc(c.point().z()) - cc(e.point().z());
-  FT drt = cc(c.lifted()) - cc(e.lifted());
-  FT dsx = cc(d.point().x()) - cc(e.point().x());
-  FT dsy = cc(d.point().y()) - cc(e.point().y());
-  FT dsz = cc(d.point().z()) - cc(e.point().z());
-  FT dst = cc(d.lifted()) - cc(e.lifted());
-
-  FT ret = CGAL::determinant(dpx, dpy, dpz, dpt,
-				   dqx, dqy, dqz, dqt,
-				   drx, dry, drz, drt,
-				   dsx, dsy, dsz, dst);
-  CGAL::Kinetic::log()->stream(CGAL::KDS::Log::MAPLE) << std::endl << std::endl;
-  CGAL::Kinetic::log()->stream(CGAL::KDS::Log::MAPLE) << "pt3 lifted\n";
-  CGAL::Kinetic::log()->stream(CGAL::KDS::Log::MAPLE) << "m:=matrix(5,5,[[";
-  CGAL::Kinetic::log()->stream(CGAL::KDS::Log::MAPLE)
-    << a.point().x() << ", " << a.point().y() << ", " << a.point().z() << ", " << a.lifted() << ", 1], ["
-    << b.point().x() << ", " << b.point().y() << ", " << b.point().z() << ", " << b.lifted() << ", 1], ["
-    << c.point().x() << ", " << c.point().y() << ", " << c.point().z() << ", " << c.lifted() << ", 1], ["
-    << d.point().x() << ", " << d.point().y() << ", " << d.point().z() << ", " << d.lifted() << ", 1], ["
-    << e.point().x() << ", " << e.point().y() << ", " << e.point().z() << ", " << e.lifted() << ", 1]]);\n";
-  CGAL::Kinetic::log()->stream(CGAL::KDS::Log::MAPLE) << "det(m)-( " << ret << ");\n";
-  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << "m2:= matrix(4,4,[[";
-  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << dpx << "," << dpy << "," << dpz << "," << dpt << "], [";
-  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << dqx << "," << dqy << "," << dqz << "," << dqt << "], [";
-  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << drx << "," << dry << "," << drz << "," << drt << "], [";
-  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << dsx << "," << dsy << "," << dsz << "," << dst << "]]);\n";
-  return ret;
-}
-#endif
-
-} } } //namespace CGAL::Kinetic::internal
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/LEDA_basic.h b/3rdparty/CGAL-4.8/include/CGAL/LEDA_basic.h
deleted file mode 100644
index 5eec9bd..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/LEDA_basic.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright (c) 1999  
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved. 
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Matthias Baesken
-
-
-
-#ifndef CGAL_LEDA_BASIC_H
-#define CGAL_LEDA_BASIC_H
-
-#include <CGAL/config.h>
-
-#ifdef CGAL_USE_LEDA
-// The following is needed for LEDA 4.4 due to min/max problems...
-#  define LEDA_NO_MIN_MAX_TEMPL
-
-#if CGAL_LEDA_VERSION < 500
-#include <LEDA/basic.h>
-#else
-#include <LEDA/system/basic.h>
-#endif
-
-#ifdef LEDA_NAMESPACE
-#  define CGAL_LEDA_SCOPE  leda
-#else
-#  define CGAL_LEDA_SCOPE 
-#endif
-
-
-#endif
-
-
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Labeled_image_mesh_domain_3.h b/3rdparty/CGAL-4.8/include/CGAL/Labeled_image_mesh_domain_3.h
deleted file mode 100644
index c3c0f25..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Labeled_image_mesh_domain_3.h
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright (c) 2009 INRIA Sophia-Antipolis (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
-// 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(s)     : Stephane Tayeb
-//
-//******************************************************************************
-// File Description :
-//
-//
-//******************************************************************************
-
-#ifndef CGAL_LABELED_IMAGE_MESH_DOMAIN_3_H
-#define CGAL_LABELED_IMAGE_MESH_DOMAIN_3_H
-
-
-#include <CGAL/Random.h>
-#include <CGAL/Labeled_mesh_domain_3.h>
-#include <CGAL/Mesh_3/Image_to_labeled_function_wrapper.h>
-#include <CGAL/Bbox_3.h>
-
-namespace CGAL {
-
-/**
- * @class Labeled_image_mesh_domain_3
- *
- *
- */
-template<class Image,
-         class BGT,
-         typename Image_word_type = unsigned char,
-         typename Subdomain_index = int,
-         class Wrapper = Mesh_3::Image_to_labeled_function_wrapper<Image, BGT,
-                                                                   Image_word_type,
-                                                                   Subdomain_index> >
-class Labeled_image_mesh_domain_3
-: public Labeled_mesh_domain_3<Wrapper, BGT>
-{
-public:
-  typedef Labeled_mesh_domain_3<Wrapper, BGT> Base;
-
-  typedef typename Base::Sphere_3 Sphere_3;
-  typedef typename Base::FT FT;
-  typedef BGT Geom_traits;
-  typedef CGAL::Bbox_3 Bbox_3;
-
-  /// Constructor
-  Labeled_image_mesh_domain_3(const Image& image,
-                              const FT& error_bound = FT(1e-3),
-                              CGAL::Random* p_rng = NULL)
-    : Base(Wrapper(image),
-           compute_bounding_box(image),
-           error_bound,
-           p_rng)
-  {}
-
-  Labeled_image_mesh_domain_3(const Image& image,
-                              const CGAL::Bbox_3& bbox,
-                              const FT& error_bound = FT(1e-3),
-                              CGAL::Random* p_rng = NULL)
-    : Base(Wrapper(image),
-           bbox,
-           error_bound,
-           p_rng)
-  {}
-
-  /// Destructor
-  virtual ~Labeled_image_mesh_domain_3() {}
-
-  using Base::bbox;
-
-private:
-  /// Returns a box enclosing image \c im
-  Bbox_3 compute_bounding_box(const Image& im) const
-  {
-    return Bbox_3(-1,-1,-1,
-                  im.xdim()*im.vx()+1, im.ydim()*im.vy()+1, im.zdim()*im.vz()+1);
-  }
-
-private:
-  // Disabled copy constructor & assignment operator
-  typedef Labeled_image_mesh_domain_3<Image, BGT> Self;
-  Labeled_image_mesh_domain_3(const Self& src);
-  Self& operator=(const Self& src);
-
-};  // end class Labeled_image_mesh_domain_3
-
-
-
-}  // end namespace CGAL
-
-
-
-#endif // CGAL_LABELED_IMAGE_MESH_DOMAIN_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Labeled_mesh_domain_3.h b/3rdparty/CGAL-4.8/include/CGAL/Labeled_mesh_domain_3.h
deleted file mode 100644
index 7d85d1b..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Labeled_mesh_domain_3.h
+++ /dev/null
@@ -1,650 +0,0 @@
-// Copyright (c) 2009 INRIA Sophia-Antipolis (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
-// 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(s)     : Stéphane Tayeb, Aymeric PELLE
-//
-//******************************************************************************
-// File Description :
-// class Labeled_mesh_domain_3. See class description.
-//******************************************************************************
-
-#ifndef CGAL_LABELED_MESH_DOMAIN_3_H
-#define CGAL_LABELED_MESH_DOMAIN_3_H
-
-#include <CGAL/Mesh_3/config.h>
-
-#include <CGAL/Bbox_3.h>
-
-#include <CGAL/point_generators_3.h>
-#include <CGAL/Mesh_3/Creator_weighted_point_3.h>
-
-#include <boost/variant.hpp>
-#include <boost/format.hpp>
-#include <boost/optional.hpp>
-#include <CGAL/tuple.h>
-#include <CGAL/Origin.h>
-
-namespace CGAL {
-
-/**
- * \class Labeled_mesh_domain_3
- *
- * Function f must take his values into N.
- * Let p be a Point.
- *  - f(p)=0 means that p is outside domain.
- *  - f(p)=a, a!=0 means that p is inside subdomain a.
- *
- *  Any boundary facet is labelled <a,b>, a<b, where a and b are the
- *  tags of it's incident subdomain.
- *  Thus, a boundary facet of the domain is labelled <0,b>, where b!=0.
- */
-template<class Function, class BGT>
-class Labeled_mesh_domain_3
-{
-public:
-  /// Geometric object types
-  typedef typename BGT::Point_3    Point_3;
-  typedef typename BGT::Segment_3  Segment_3;
-  typedef typename BGT::Ray_3      Ray_3;
-  typedef typename BGT::Line_3     Line_3;
-  typedef typename BGT::Vector_3   Vector_3;
-  typedef typename BGT::Sphere_3   Sphere_3;
-  typedef CGAL::Bbox_3             Bbox_3;
-
-protected:
-  typedef typename BGT::Iso_cuboid_3 Iso_cuboid_3;
-
-public:
-  // Kernel_traits compatibility
-  typedef BGT R;
-  // access Function type from inherited class
-  typedef Function Fct;
-
-  //-------------------------------------------------------
-  // Index Types
-  //-------------------------------------------------------
-  /// Type of indexes for cells of the input complex
-  typedef typename Function::return_type Subdomain_index;
-  typedef boost::optional<Subdomain_index> Subdomain;
-  /// Type of indexes for surface patch of the input complex
-  typedef std::pair<Subdomain_index, Subdomain_index> Surface_patch_index;
-  typedef boost::optional<Surface_patch_index> Surface_patch;
-  /// Type of indexes to characterize the lowest dimensional face of the input
-  /// complex on which a vertex lie
-  typedef boost::variant<Subdomain_index, Surface_patch_index> Index;
-  typedef CGAL::cpp11::tuple<Point_3,Index,int> Intersection;
-
-
-  typedef typename BGT::FT FT;
-  typedef BGT Geom_traits;
-
-  /**
-   * @brief Constructor
-   */
-  Labeled_mesh_domain_3(const Function& f,
-                         const Sphere_3& bounding_sphere,
-                         const FT& error_bound = FT(1e-3),
-                         CGAL::Random* p_rng = NULL);
-
-  Labeled_mesh_domain_3(const Function& f,
-                         const Bbox_3& bbox,
-                         const FT& error_bound = FT(1e-3),
-                         CGAL::Random* p_rng = NULL);
-
-  Labeled_mesh_domain_3(const Function& f,
-                         const Iso_cuboid_3& bbox,
-                         const FT& error_bound = FT(1e-3),
-                         CGAL::Random* p_rng = NULL);
-
-  /// Destructor
-  virtual ~Labeled_mesh_domain_3()
-  {
-    if(delete_rng_)
-      delete p_rng_;
-  }
-
-
-  /**
-   * Constructs  a set of \ccc{n} points on the surface, and output them to
-   *  the output iterator \ccc{pts} whose value type is required to be
-   *  \ccc{std::pair<Points_3, Index>}.
-   */
-  struct Construct_initial_points
-  {
-    Construct_initial_points(const Labeled_mesh_domain_3& domain)
-      : r_domain_(domain) {}
-
-    template<class OutputIterator>
-    OutputIterator operator()(OutputIterator pts, const int n = 12) const;
-
-  private:
-    const Labeled_mesh_domain_3& r_domain_;
-  };
-
-  /// Returns Construct_initial_points object
-  Construct_initial_points construct_initial_points_object() const
-  {
-    return Construct_initial_points(*this);
-  }
-
-  /**
-   * Returns a bounding box of the domain
-   */
-  Bbox_3 bbox() const {
-    return bbox_.bbox();
-  }
-
-  /**
-   * Returns true if point~\ccc{p} is in the domain. If \ccc{p} is in the
-   *  domain, the parameter index is set to the index of the subdomain
-   *  including $p$. It is set to the default value otherwise.
-   */
-  struct Is_in_domain
-  {
-    Is_in_domain(const Labeled_mesh_domain_3& domain) : r_domain_(domain) {}
-
-    Subdomain operator()(const Point_3& p) const
-    {
-      // f(p)==0 means p is outside the domain
-      Subdomain_index index = (r_domain_.function_)(p);
-      if ( Subdomain_index() == index )
-        return Subdomain();
-      else
-        return Subdomain(index);
-    }
-  private:
-    const Labeled_mesh_domain_3& r_domain_;
-  };
-
-  /// Returns Is_in_domain object
-  Is_in_domain is_in_domain_object() const { return Is_in_domain(*this); }
-
-  /**
-   * Returns true is the element \ccc{type} intersect properly any of the
-   * surface patches describing the either the domain boundary or some
-   * subdomain boundary.
-   * \ccc{Type} is either \ccc{Segment_3}, \ccc{Ray_3} or \ccc{Line_3}.
-   * Parameter index is set to the index of the intersected surface patch
-   * if \ccc{true} is returned and to the default \ccc{Surface_patch_index}
-   * value otherwise.
-   */
-  struct Do_intersect_surface
-  {
-    Do_intersect_surface(const Labeled_mesh_domain_3& domain)
-      : r_domain_(domain) {}
-
-    Surface_patch operator()(const Segment_3& s) const
-    {
-      return this->operator()(s.source(), s.target());
-    }
-
-    Surface_patch operator()(const Ray_3& r) const
-    {
-      return clip_to_segment(r);
-    }
-
-    Surface_patch operator()(const Line_3& l) const
-    {
-      return clip_to_segment(l);
-    }
-
-  private:
-    /// Returns true if points \c a & \c b do not belong to the same subdomain
-    /// \c index is set to the surface index of subdomains f(a), f(b)
-    Surface_patch operator()(const Point_3& a, const Point_3& b) const
-    {
-      // If f(a) != f(b), then [a,b] intersects some surface. Here we consider
-      // [a,b] intersects surface_patch labelled <f(a),f(b)> (or <f(b),f(a)>).
-      // It may be false, further rafinement will improve precision
-      const Subdomain_index value_a = r_domain_.function_(a);
-      const Subdomain_index value_b = r_domain_.function_(b);
-
-      if ( value_a != value_b )
-        return Surface_patch(r_domain_.make_surface_index(value_a, value_b));
-      else
-        return Surface_patch();
-    }
-
-    /**
-     * Clips \c query to a segment \c s, and call operator()(s)
-     */
-    template<typename Query>
-    Surface_patch clip_to_segment(const Query& query) const
-    {
-      typename cpp11::result_of<typename BGT::Intersect_3(Query, Iso_cuboid_3)>::type
-        clipped = CGAL::intersection(query, r_domain_.bbox_);
-
-      if(clipped)
-#if CGAL_INTERSECTION_VERSION > 1
-        if(const Segment_3* s = boost::get<Segment_3>(&*clipped))
-          return this->operator()(*s);
-#else
-        if(const Segment_3* s = object_cast<Segment_3>(&clipped))
-          return this->operator()(*s);
-#endif
-        
-      return Surface_patch();
-    }
-
-  private:
-    const Labeled_mesh_domain_3& r_domain_;
-  };
-
-  /// Returns Do_intersect_surface object
-  Do_intersect_surface do_intersect_surface_object() const
-  {
-    return Do_intersect_surface(*this);
-  }
-
-  /**
-   * Returns a point in the intersection of the primitive \ccc{type}
-   * with some boundary surface.
-   * \ccc{Type1} is either \ccc{Segment_3}, \ccc{Ray_3} or \ccc{Line_3}.
-   * The integer \ccc{dimension} is set to the dimension of the lowest
-   * dimensional face in the input complex containing the returned point, and
-   * \ccc{index} is set to the index to be stored at a mesh vertex lying
-   * on this face.
-   */
-  struct Construct_intersection
-  {
-    Construct_intersection(const Labeled_mesh_domain_3& domain)
-      : r_domain_(domain) {}
-
-    Intersection operator()(const Segment_3& s) const
-    {
-#ifndef CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
-      CGAL_precondition(r_domain_.do_intersect_surface_object()(s));
-#endif // NOT CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
-      return this->operator()(s.source(),s.target());
-    }
-
-    Intersection operator()(const Ray_3& r) const
-    {
-      return clip_to_segment(r);
-    }
-
-    Intersection operator()(const Line_3& l) const
-    {
-      return clip_to_segment(l);
-    }
-
-  private:
-    /**
-     * Returns a point in the intersection of [a,b] with the surface
-     * \c a must be the source point, and \c b the out point. It's important
-     * because it drives bisection cuts.
-     * Indeed, the returned point is the first intersection from \c [a,b]
-     * with a subdomain surface.
-     */
-    Intersection operator()(const Point_3& a, const Point_3& b) const
-    {
-      // Functors
-      typename BGT::Compute_squared_distance_3 squared_distance =
-                                      BGT().compute_squared_distance_3_object();
-      typename BGT::Construct_midpoint_3 midpoint =
-                                      BGT().construct_midpoint_3_object();
-
-      // Non const points
-      Point_3 p1 = a;
-      Point_3 p2 = b;
-      Point_3 mid = midpoint(p1, p2);
-
-      // Cannot be const: those values are modified below.
-      Subdomain_index value_at_p1 = r_domain_.function_(p1);
-      Subdomain_index value_at_p2 = r_domain_.function_(p2);
-      Subdomain_index value_at_mid = r_domain_.function_(mid,true);
-
-      // If both extremities are in the same subdomain,
-      // there is no intersection.
-      // This should not happen...
-      if( value_at_p1 == value_at_p2 )
-      {
-        return Intersection();
-      }
-
-      // Construct the surface patch index and index from the values at 'a'
-      // and 'b'. Even if the bissection find out a different pair of
-      // values, the reported index will be constructed from the initial
-      // values.
-      const Surface_patch_index sp_index =
-        r_domain_.make_surface_index(value_at_p1, value_at_p2);
-      const Index index = r_domain_.index_from_surface_patch_index(sp_index);
-
-      // Else lets find a point (by bisection)
-      // Bisection ends when the point is near than error bound from surface
-      while(true)
-      {
-        // If the two points are enough close, then we return midpoint
-        if ( squared_distance(p1, p2) < r_domain_.squared_error_bound_ )
-        {
-          CGAL_assertion(value_at_p1 != value_at_p2);
-          return Intersection(mid, index, 2);
-        }
-
-        // Else we must go on
-        // Here we consider that p1(a) is the source point. Thus, we keep p1 and
-        // change p2 if f(p1)!=f(p2).
-        // That allows us to find the first intersection from a of [a,b] with
-        // a surface.
-        if ( value_at_p1 != value_at_mid )
-        {
-          p2 = mid;
-          value_at_p2 = value_at_mid;
-        }
-        else
-        {
-          p1 = mid;
-          value_at_p1 = value_at_mid;
-        }
-
-        mid = midpoint(p1, p2);
-        value_at_mid = r_domain_.function_(mid,true);
-      }
-    }
-
-    /// Clips \c query to a segment \c s, and call operator()(s)
-    template<typename Query>
-    Intersection clip_to_segment(const Query& query) const
-    {
-      typename cpp11::result_of<typename BGT::Intersect_3(Query, Iso_cuboid_3)>::type
-        clipped = CGAL::intersection(query, r_domain_.bbox_);
-
-      if(clipped)
-#if CGAL_INTERSECTION_VERSION > 1
-        if(const Segment_3* s = boost::get<Segment_3>(&*clipped))
-          return this->operator()(*s);
-#else
-        if(const Segment_3* s = object_cast<Segment_3>(&clipped))
-          return this->operator()(*s);
-#endif
-      
-      return Intersection();
-    }
-
-  private:
-    const Labeled_mesh_domain_3& r_domain_;
-  };
-
-  /// Returns Construct_intersection object
-  Construct_intersection construct_intersection_object() const
-  {
-    return Construct_intersection(*this);
-  }
-
-  /**
-   * Returns the index to be stored in a vertex lying on the surface identified
-   * by \c index.
-   */
-  Index index_from_surface_patch_index(const Surface_patch_index& index) const
-  { return Index(index); }
-
-  /**
-   * Returns the index to be stored in a vertex lying in the subdomain
-   * identified by \c index.
-   */
-  Index index_from_subdomain_index(const Subdomain_index& index) const
-  { return Index(index); }
-
-  /**
-   * Returns the \c Surface_patch_index of the surface patch
-   * where lies a vertex with dimension 2 and index \c index.
-   */
-  Surface_patch_index surface_patch_index(const Index& index) const
-  { return boost::get<Surface_patch_index>(index); }
-
-  /**
-   * Returns the index of the subdomain containing a vertex
-   *  with dimension 3 and index \c index.
-   */
-  Subdomain_index subdomain_index(const Index& index) const
-  { return boost::get<Subdomain_index>(index); }
-  
-  // -----------------------------------
-  // Backward Compatibility
-  // -----------------------------------
-#ifndef CGAL_MESH_3_NO_DEPRECATED_SURFACE_INDEX
-  typedef Surface_patch_index   Surface_index;
-  
-  Index index_from_surface_index(const Surface_index& index) const
-  { return index_from_surface_patch_index(index); }
-  
-  Surface_index surface_index(const Index& index) const
-  { return surface_patch_index(index); }
-#endif // CGAL_MESH_3_NO_DEPRECATED_SURFACE_INDEX
-  // -----------------------------------
-  // End backward Compatibility
-  // -----------------------------------
-
-
-private:
-  /// Returns Surface_patch_index from \c i and \c j
-  Surface_patch_index make_surface_index(const Subdomain_index i,
-                                   const Subdomain_index j) const
-  {
-    if ( i < j ) return Surface_patch_index(i,j);
-    else return Surface_patch_index(j,i);
-  }
-
-  /// Returns squared error bound from \c bbox and \c error
-  FT squared_error_bound(const Iso_cuboid_3& bbox, const FT& error) const
-  {
-    typename BGT::Compute_squared_distance_3 squared_distance =
-                                    BGT().compute_squared_distance_3_object();
-    return squared_distance((bbox.min)(), (bbox.max)())*error*error/4;
-  }
-
-  /// Returns squared error bound from \c sphere and \c error
-  FT squared_error_bound(const Sphere_3& sphere, const FT& error) const
-  {
-    typename BGT::Compute_squared_radius_3 squared_radius =
-                                    BGT().compute_squared_radius_3_object();
-    return squared_radius(sphere)*error*error;
-  }
-
-  /// Returns the bounding sphere of an Iso_cuboid_3
-  Sphere_3 bounding_sphere(const Iso_cuboid_3& bbox) const
-  {
-    typename BGT::Construct_sphere_3 sphere = BGT().construct_sphere_3_object();
-    return sphere((bbox.min)(), (bbox.max)());
-  }
-
-  /// Returns and Iso_cuboid_3 from a Bbox_3
-  Iso_cuboid_3 iso_cuboid(const Bbox_3& bbox)
-  {
-    const Point_3 p_min(bbox.xmin(), bbox.ymin(), bbox.zmin());
-    const Point_3 p_max(bbox.xmax(), bbox.ymax(), bbox.zmax());
-
-    return Iso_cuboid_3(p_min,p_max);
-  }
-
-protected:
-  /// Returns bounding box
-  const Iso_cuboid_3& bounding_box() const { return bbox_; }
-
-private:
-  /// The function which answers subdomain queries
-  const Function function_;
-  /// The bounding box
-  const Iso_cuboid_3 bbox_;
-  /// The random number generator used by Construct_initial_points
-  CGAL::Random* p_rng_;
-  bool delete_rng_;
-  /// Error bound relative to sphere radius
-  FT squared_error_bound_;
-
-
-private:
-  // Disabled copy constructor & assignment operator
-  typedef Labeled_mesh_domain_3<Function,BGT> Self;
-  Labeled_mesh_domain_3(const Self& src);
-  Self& operator=(const Self& src);
-
-};  // end class Labeled_mesh_domain_3
-
-
-
-
-//-------------------------------------------------------
-// Method implementation
-//-------------------------------------------------------
-template<class F, class BGT>
-Labeled_mesh_domain_3<F,BGT>::Labeled_mesh_domain_3(
-                       const F& f,
-                       const Sphere_3& bounding_sphere,
-                       const FT& error_bound,
-                       CGAL::Random* p_rng)
-: function_(f)
-, bbox_(iso_cuboid(bounding_sphere.bbox()))
-, p_rng_(p_rng)
-, delete_rng_(false)
-, squared_error_bound_(squared_error_bound(bounding_sphere,error_bound))
-{
-  // TODO : CGAL_ASSERT(0 < f(bounding_sphere.get_center()) ) ?
-  if(!p_rng_)
-  {
-    p_rng_ = new CGAL::Random(0);
-    delete_rng_ = true;
-  }
-}
-
-template<class F, class BGT>
-Labeled_mesh_domain_3<F,BGT>::Labeled_mesh_domain_3(
-                       const F& f,
-                       const Bbox_3& bbox,
-                       const FT& error_bound,
-                       CGAL::Random* p_rng)
-: function_(f)
-, bbox_(iso_cuboid(bbox))
-, p_rng_(p_rng)
-, delete_rng_(false)
-, squared_error_bound_(squared_error_bound(bbox_,error_bound))
-{
-  // TODO : CGAL_ASSERT(0 < f(bounding_sphere.get_center()) ) ?
-  if(!p_rng_)
-  {
-    p_rng_ = new CGAL::Random(0);
-    delete_rng_ = true;
-  }
-}
-
-template<class F, class BGT>
-Labeled_mesh_domain_3<F,BGT>::Labeled_mesh_domain_3(
-                       const F& f,
-                       const Iso_cuboid_3& bbox,
-                       const FT& error_bound,
-                       CGAL::Random* p_rng)
-: function_(f)
-, bbox_(bbox)
-, p_rng_(p_rng)
-, delete_rng_(false)
-, squared_error_bound_(squared_error_bound(bbox_,error_bound))
-{
-  // TODO : CGAL_ASSERT(0 < f( bbox.get_center()) ) ?
-  if(!p_rng_)
-  {
-    p_rng_ = new CGAL::Random(0);
-    delete_rng_ = true;
-  }
-}
-
-
-
-template<class F, class BGT>
-template<class OutputIterator>
-OutputIterator
-Labeled_mesh_domain_3<F,BGT>::Construct_initial_points::operator()(
-                                                    OutputIterator pts,
-                                                    const int nb_points) const
-{
-  // Create point_iterator on and in bounding_sphere
-  typedef Random_points_on_sphere_3<Point_3> Random_points_on_sphere_3;
-  typedef Random_points_in_sphere_3<Point_3> Random_points_in_sphere_3;
-
-
-  const FT squared_radius = BGT().compute_squared_radius_3_object()(
-      r_domain_.bounding_sphere(r_domain_.bbox_));
-
-  const double radius = std::sqrt(CGAL::to_double(squared_radius));
-
-  CGAL::Random& rng = *(r_domain_.p_rng_);
-  Random_points_on_sphere_3 random_point_on_sphere(radius, rng);
-  Random_points_in_sphere_3 random_point_in_sphere(radius, rng);
-
-  // Get some functors
-  typename BGT::Construct_segment_3 segment_3 =
-                              BGT().construct_segment_3_object();
-  typename BGT::Construct_vector_3 vector_3 =
-                              BGT().construct_vector_3_object();
-  typename BGT::Construct_translated_point_3 translate =
-                              BGT().construct_translated_point_3_object();
-  typename BGT::Construct_center_3 center = BGT().construct_center_3_object();
-
-  // Get translation from origin to sphere center
-  Point_3 center_pt = center(r_domain_.bounding_sphere(r_domain_.bbox_));
-  const Vector_3 sphere_translation = vector_3(CGAL::ORIGIN, center_pt);
-
-  // Create nb_point points
-  int n = nb_points;
-#ifdef CGAL_MESH_3_VERBOSE
-  std::cerr << "construct initial points:\n";
-#endif
-  while ( 0 != n )
-  {
-    // Get a random segment
-    const Point_3 random_point = translate(*random_point_on_sphere,
-                                           sphere_translation);
-    const Segment_3 random_seg = segment_3(center_pt, random_point);
-
-    // Add the intersection to the output if it exists
-    Surface_patch surface = r_domain_.do_intersect_surface_object()(random_seg);
-    if ( surface )
-    {
-      const Point_3 intersect_pt = CGAL::cpp11::get<0>(
-          r_domain_.construct_intersection_object()(random_seg));
-      *pts++ = std::make_pair(intersect_pt,
-                              r_domain_.index_from_surface_patch_index(*surface));
-      --n;
-
-#ifdef CGAL_MESH_3_VERBOSE
-      std::cerr << boost::format("\r             \r"
-                                 "%1%/%2% initial point(s) found...")
-                   % (nb_points - n)
-                   % nb_points;
-#endif
-    }
-    else
-    {
-      // Get a new random point into sphere as center of object
-      // It may be necessary if the center of the domain is empty, e.g. torus
-      // In general case, it is good for input point dispersion
-      ++random_point_in_sphere;
-      center_pt = translate(*random_point_in_sphere, sphere_translation);
-    }
-    ++random_point_on_sphere;
-  }
-
-#ifdef CGAL_MESH_3_VERBOSE
-  std::cerr << "\n";
-#endif
-  return pts;
-}
-
-
-}  // end namespace CGAL
-
-#endif // LABELLED_MESH_TRAITS_3_H_
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Lazy_exact_nt.h b/3rdparty/CGAL-4.8/include/CGAL/Lazy_exact_nt.h
deleted file mode 100644
index 4c0678a..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Lazy_exact_nt.h
+++ /dev/null
@@ -1,1447 +0,0 @@
-// Copyright (c) 1999-2007  INRIA Sophia-Antipolis (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(s)     : Sylvain Pion
-
-#ifndef CGAL_LAZY_EXACT_NT_H
-#define CGAL_LAZY_EXACT_NT_H
-
-#define CGAL_int(T)    typename First_if_different<int,    T>::Type
-#define CGAL_double(T) typename First_if_different<double, T>::Type
-#define CGAL_To_interval(T) To_interval<T>
-
-
-#include <CGAL/number_type_basic.h>
-#include <CGAL/assertions.h>
-
-#include <boost/iterator/transform_iterator.hpp> // for Root_of functor
-#include <boost/operators.hpp>
-#include <boost/type_traits/is_same.hpp>
-#include <boost/type_traits/is_arithmetic.hpp>
-#include <boost/utility/enable_if.hpp>
-
-#include <boost/mpl/if.hpp>
-#include <boost/mpl/logical.hpp>
-
-#include <CGAL/Interval_nt.h>
-#include <CGAL/Handle.h>
-#include <CGAL/NT_converter.h>
-
-#include <CGAL/Profile_counter.h>
-#include <CGAL/Lazy.h>
-
-#include <CGAL/Sqrt_extension_fwd.h>
-#include <CGAL/Kernel/mpl.h>
-
-#include <CGAL/IO/io.h>
-
-
-/*
- * This file contains the definition of the number type Lazy_exact_nt<ET>,
- * where ET is an exact number type (must provide the exact operations needed).
- *
- * Lazy_exact_nt<ET> provides a DAG-based lazy evaluation, like LEDA's real,
- * Core's Expr, LEA's lazy rationals...
- *
- * The values are first approximated using Interval_base.
- * The exactness is provided when needed by ET.
- *
- * Lazy_exact_nt<ET> is just a handle to the abstract base class
- * Lazy_exact_nt_rep which has pure virtual methods .approx() and .exact().
- * From this class derives one class per operation, with one constructor.
- *
- * The DAG is managed by :
- * - Handle and Rep.
- * - virtual functions to denote the various operators (instead of an enum).
- *
- * Other packages with vaguely similar design : APU, MetaCGAL, LOOK.
- */
-
-/*
- * TODO :
- * - Generalize it for constructions at the kernel level.
- * - Add mixed operations with ET too ?
- * - Interval refinement functionnality ?
- * - Separate the handle and the representation(s) in 2 files (?)
- *   maybe not a good idea, better if everything related to one operation is
- *   close together.
- * - Add a CT template parameter ?
- * - Add a string constant to provide an expression string (a la MetaCGAL) ?
- *   // virtual ostream operator<<() const = 0; // or string, like Core ?
- * - Have a template-expression (?) thing that evaluates a temporary element,
- *   and allocates stuff in memory only when really needs to convert to the
- *   NT.  (cf gmp++, and maybe other things, Blitz++, Synaps...)
- */
-
-/*
- * Interface of the rep classes:
- * - .approx()      returns Interval_nt<> (assumes rounding=nearest).
- *                  [ only called from the handle, and declared in the base ]
- * - .exact()       returns ET, if not already done, computes recursively
- *
- * - .rafine_approx()   ??
- */
-
-namespace CGAL {
-
-template <class NT> class Lazy_exact_nt;
-
-
-#ifdef CGAL_LAZY_KERNEL_DEBUG
-template <typename ET>
-inline
-void
-print_dag(const Lazy_exact_nt<ET>& l, std::ostream& os, int level=0)
-{
-  l.print_dag(os, level);
-}
-#endif
-
-// Abstract base representation class for lazy numbers
-template <typename ET>
-struct Lazy_exact_nt_rep : public Lazy_exact_nt<ET>::Self_rep
-{
-  typedef typename Lazy_exact_nt<ET>::Self_rep  Base;
-
-  Lazy_exact_nt_rep (const Interval_nt<false> & i)
-      : Base(i) {}
-
-#ifdef CGAL_LAZY_KERNEL_DEBUG
-  void
-  print_dag(std::ostream& os, int level) const
-  {
-    this->print_at_et(os, level);
-  }
-#endif
-};
-
-// int constant
-template <typename ET>
-struct Lazy_exact_Int_Cst : public Lazy_exact_nt_rep<ET>
-{
-  Lazy_exact_Int_Cst (int i)
-      : Lazy_exact_nt_rep<ET>(double(i)) {}
-
-  void update_exact() const { this->et = new ET((int)this->approx().inf()); }
-};
-
-// double constant
-template <typename ET, typename X>
-struct Lazy_exact_Cst : public Lazy_exact_nt_rep<ET>
-{
-  Lazy_exact_Cst (X x)
-      : Lazy_exact_nt_rep<ET>(x), cste(x) {}
-
-  void update_exact() const { this->et = new ET(cste); }
-
-  private:
-  X cste;
-};
-
-// Exact constant
-template <typename ET>
-struct Lazy_exact_Ex_Cst : public Lazy_exact_nt_rep<ET>
-{
-  Lazy_exact_Ex_Cst (const ET & e)
-      : Lazy_exact_nt_rep<ET>(CGAL_NTS to_interval(e))
-  {
-    this->et = new ET(e);
-  }
-
-  void update_exact() const { CGAL_error(); }
-};
-
-// Construction from a Lazy_exact_nt<ET1> (which keeps the lazyness).
-template <typename ET, typename ET1>
-class Lazy_lazy_exact_Cst : public Lazy_exact_nt_rep<ET>
-{
-  mutable Lazy_exact_nt<ET1> l;
-
-public:
-
-  Lazy_lazy_exact_Cst (const Lazy_exact_nt<ET1> &x)
-      : Lazy_exact_nt_rep<ET>(x.approx()), l(x)
-  {
-    this->set_depth(l.depth() + 1);
-  }
-
-  void update_exact() const
-  {
-    this->et = new ET(l.exact());
-    this->at = l.approx();
-    prune_dag();
-  }
-
-  void prune_dag() const { l = Lazy_exact_nt<ET1>(); }
-};
-
-
-// Unary  operations: abs, sqrt, square.
-// Binary operations: +, -, *, /, min, max.
-
-// Base unary operation
-template <typename ET>
-struct Lazy_exact_unary : public Lazy_exact_nt_rep<ET>
-{
-  mutable Lazy_exact_nt<ET> op1;
-
-  Lazy_exact_unary (const Interval_nt<false> &i, const Lazy_exact_nt<ET> &a)
-      : Lazy_exact_nt_rep<ET>(i), op1(a)
-  {
-    this->set_depth(op1.depth() + 1);
-  }
-
-  void prune_dag() const { op1 = Lazy_exact_nt<ET>(); }
-
-#ifdef CGAL_LAZY_KERNEL_DEBUG
-  void
-  print_dag(std::ostream& os, int level) const
-  {
-    this->print_at_et(os, level);
-    if(this->is_lazy()){
-      msg(os, level, "Unary number operator:");
-      CGAL::print_dag(op1, os, level+1);
-    }
-  }
-#endif
-};
-
-// Base binary operation
-template <typename ET, typename ET1 = ET, typename ET2 = ET>
-struct Lazy_exact_binary : public Lazy_exact_nt_rep<ET>
-{
-  mutable Lazy_exact_nt<ET1> op1;
-  mutable Lazy_exact_nt<ET2> op2;
-
-  Lazy_exact_binary (const Interval_nt<false> &i,
-		     const Lazy_exact_nt<ET1> &a, const Lazy_exact_nt<ET2> &b)
-      : Lazy_exact_nt_rep<ET>(i), op1(a), op2(b)
-  {
-    this->set_depth((std::max)(op1.depth(), op2.depth()) + 1);
-  }
-
-  void prune_dag() const
-  {
-    op1 = Lazy_exact_nt<ET1>();
-    op2 = Lazy_exact_nt<ET2>();
-  }
-
-#ifdef CGAL_LAZY_KERNEL_DEBUG
-  void
-  print_dag(std::ostream& os, int level) const
-  {
-    this->print_at_et(os, level);
-    if(this->is_lazy()){
-      msg(os, level, "Binary number operator:");
-      CGAL::print_dag(op1, os, level+1);
-      CGAL::print_dag(op2, os, level+1);
-    }
-  }
-#endif
-};
-
-// Here we could use a template class for all operations (STL provides
-// function objects plus, minus, multiplies, divides...).  But it would require
-// a template template parameter, and GCC 2.95 seems to crash easily with them.
-
-// Macro for unary operations
-#define CGAL_LAZY_UNARY_OP(OP, NAME)                                     \
-template <typename ET>                                                   \
-struct NAME : public Lazy_exact_unary<ET>                                \
-{                                                                        \
-  typedef typename Lazy_exact_unary<ET>::AT::Protector P;                \
-  NAME (const Lazy_exact_nt<ET> &a)                                      \
-      : Lazy_exact_unary<ET>((P(), OP(a.approx())), a) {}                \
-                                                                         \
-  void update_exact() const                                              \
-  {                                                                      \
-    this->et = new ET(OP(this->op1.exact()));                            \
-    if (!this->approx().is_point())                                      \
-      this->at = CGAL_NTS to_interval(*(this->et));                      \
-    this->prune_dag();                                                   \
-   }                                                                     \
-};
-
-CGAL_LAZY_UNARY_OP(opposite,  Lazy_exact_Opp)
-CGAL_LAZY_UNARY_OP(CGAL_NTS abs,    Lazy_exact_Abs)
-CGAL_LAZY_UNARY_OP(CGAL_NTS square, Lazy_exact_Square)
-CGAL_LAZY_UNARY_OP(CGAL_NTS sqrt,   Lazy_exact_Sqrt)
-
-// A macro for +, -, * and /
-#define CGAL_LAZY_BINARY_OP(OP, NAME)                                    \
-template <typename ET, typename ET1 = ET, typename ET2 = ET>             \
-struct NAME : public Lazy_exact_binary<ET, ET1, ET2>                     \
-{                                                                        \
-  typedef typename Lazy_exact_binary<ET,ET1,ET2>::AT::Protector P;	 \
-  NAME (const Lazy_exact_nt<ET1> &a, const Lazy_exact_nt<ET2> &b)        \
-    : Lazy_exact_binary<ET, ET1, ET2>((P(), a.approx() OP b.approx()), a, b) {} \
-                                                                         \
-  void update_exact() const                                              \
-  {                                                                      \
-    this->et = new ET(this->op1.exact() OP this->op2.exact());           \
-    if (!this->approx().is_point())                                      \
-      this->at = CGAL_NTS to_interval(*(this->et));                      \
-    this->prune_dag();                                                   \
-   }                                                                     \
-};
-
-CGAL_LAZY_BINARY_OP(+, Lazy_exact_Add)
-CGAL_LAZY_BINARY_OP(-, Lazy_exact_Sub)
-CGAL_LAZY_BINARY_OP(*, Lazy_exact_Mul)
-CGAL_LAZY_BINARY_OP(/, Lazy_exact_Div)
-
-// Minimum
-template <typename ET>
-struct Lazy_exact_Min : public Lazy_exact_binary<ET>
-{
-  Lazy_exact_Min (const Lazy_exact_nt<ET> &a, const Lazy_exact_nt<ET> &b)
-    : Lazy_exact_binary<ET>((CGAL::min)(a.approx(), b.approx()), a, b) {}
-
-  void update_exact() const
-  {
-    this->et = new ET((CGAL::min)(this->op1.exact(), this->op2.exact()));
-    if (!this->approx().is_point()) 
-      this->at = CGAL_NTS to_interval(*(this->et));
-    this->prune_dag();
-  }
-};
-
-// Maximum
-template <typename ET>
-struct Lazy_exact_Max : public Lazy_exact_binary<ET>
-{
-  Lazy_exact_Max (const Lazy_exact_nt<ET> &a, const Lazy_exact_nt<ET> &b)
-    : Lazy_exact_binary<ET>((CGAL::max)(a.approx(), b.approx()), a, b) {}
-
-  void update_exact() const
-  {
-    this->et = new ET((CGAL::max)(this->op1.exact(), this->op2.exact()));
-    if (!this->approx().is_point()) 
-      this->at = CGAL_NTS to_interval(*(this->et));
-    this->prune_dag();
-  }
-};
-
-
-// The real number type, handle class
-template <typename ET_>
-class Lazy_exact_nt
-  : public Lazy<Interval_nt<false>, ET_, Lazy_exact_nt<ET_>, To_interval<ET_> >
-  , boost::ordered_euclidian_ring_operators2< Lazy_exact_nt<ET_>, int >
-  , boost::ordered_euclidian_ring_operators2< Lazy_exact_nt<ET_>, double >
-{
-public:
-
-  typedef Lazy_exact_nt<ET_> Self;
-  typedef Lazy<Interval_nt<false>, ET_, Self, To_interval<ET_> > Base;
-  typedef typename Base::Self_rep  Self_rep;
-
-  typedef typename Base::ET ET; // undocumented
-  typedef typename Base::AT AT; // undocumented
-
-  typedef typename Base::Exact_type        Exact_type;
-  typedef typename Base::Approximate_type  Approximate_type;
-
-public :
-
-  Lazy_exact_nt () {}
-
-  Lazy_exact_nt (Self_rep *r)
-    : Base(r) {}
-
-  // Also check that ET and AT are constructible from T?
-  template<class T>
-  Lazy_exact_nt (T i, typename boost::enable_if<boost::mpl::and_<
-      boost::mpl::or_<boost::is_arithmetic<T>, boost::is_enum<T> >,
-      boost::mpl::not_<boost::is_same<T,ET> > >,void*>::type=0)
-    : Base(new Lazy_exact_Cst<ET,T>(i)) {}
-
-  Lazy_exact_nt (const ET & e)
-    : Base(new Lazy_exact_Ex_Cst<ET>(e)){}
-
-  template <class ET1>
-  Lazy_exact_nt (const Lazy_exact_nt<ET1> &x,
-      typename boost::enable_if<is_implicit_convertible<ET1,ET>,int>::type=0)
-    : Base(new Lazy_lazy_exact_Cst<ET, ET1>(x)){}
-
-  template <class ET1>
-  explicit Lazy_exact_nt (const Lazy_exact_nt<ET1> &x,
-  typename boost::disable_if<is_implicit_convertible<ET1,ET>,int>::type=0)
-    : Base(new Lazy_lazy_exact_Cst<ET, ET1>(x)){}
-
-  Self operator+ () const
-  { return *this; }
-
-  Self operator- () const
-  { return new Lazy_exact_Opp<ET>(*this); }
-
-  Self & operator+=(const Self& b)
-  { return *this = new Lazy_exact_Add<ET>(*this, b); }
-
-  Self & operator-=(const Self& b)
-  { return *this = new Lazy_exact_Sub<ET>(*this, b); }
-
-  Self & operator*=(const Self& b)
-  { return *this = new Lazy_exact_Mul<ET>(*this, b); }
-
-  Self & operator/=(const Self& b)
-  {
-    CGAL_precondition(b != 0);
-    return *this = new Lazy_exact_Div<ET>(*this, b);
-  }
-
-  // Mixed operators. (could be optimized ?)
-  Self & operator+=(CGAL_int(ET) b)
-  { return *this = new Lazy_exact_Add<ET>(*this, b); }
-
-  Self & operator-=(CGAL_int(ET) b)
-  { return *this = new Lazy_exact_Sub<ET>(*this, b); }
-
-  Self & operator*=(CGAL_int(ET) b)
-  { return *this = new Lazy_exact_Mul<ET>(*this, b); }
-
-  Self & operator/=(CGAL_int(ET) b)
-  {
-    CGAL_precondition(b != 0);
-    return *this = new Lazy_exact_Div<ET>(*this, b);
-  }
-
-  Self & operator+=(CGAL_double(ET) b)
-  { return *this = new Lazy_exact_Add<ET>(*this, b); }
-
-  Self & operator-=(CGAL_double(ET) b)
-  { return *this = new Lazy_exact_Sub<ET>(*this, b); }
-
-  Self & operator*=(CGAL_double(ET) b)
-  { return *this = new Lazy_exact_Mul<ET>(*this, b); }
-
-  Self & operator/=(CGAL_double(ET) b)
-  {
-    CGAL_precondition(b != 0);
-    return *this = new Lazy_exact_Div<ET>(*this, b);
-  }
-
-  // % kills filtering
-  Self & operator%=(const Self& b)
-  {
-    CGAL_precondition(b != 0);
-    ET res = this->exact();
-    res %= b.exact();
-    return *this = Lazy_exact_nt<ET>(res);
-  }
-
-  Self & operator%=(int b)
-  {
-    CGAL_precondition(b != 0);
-    ET res = this->exact();
-    res %= b;
-    return *this = Lazy_exact_nt<ET>(res);
-  }
-
-  Interval_nt<true> interval() const
-  {
-    const Interval_nt<false>& i = this->approx();
-    return Interval_nt<true>(i.inf(), i.sup());
-  }
-
-  Interval_nt_advanced approx_adv() const
-  { return this->ptr()->approx(); }
-
-  static const double & get_relative_precision_of_to_double()
-  {
-      return relative_precision_of_to_double;
-  }
-
-  static void set_relative_precision_of_to_double(const double & d)
-  {
-      CGAL_assertion((0 < d) & (d < 1));
-      relative_precision_of_to_double = d;
-  }
-
-  bool identical(const Self& b) const
-  {
-      return ::CGAL::identical(
-              static_cast<const Handle &>(*this),
-              static_cast<const Handle &>(b));
-  }
-
-  template < typename T >
-  bool identical(const T&) const
-  { return false; }
-
-private:
-  static double relative_precision_of_to_double;
-};
-
-
-template <typename ET>
-double Lazy_exact_nt<ET>::relative_precision_of_to_double = 0.00001;
-
-
-template <typename ET1, typename ET2>
-bool
-operator<(const Lazy_exact_nt<ET1>& a, const Lazy_exact_nt<ET2>& b)
-{
-  CGAL_BRANCH_PROFILER(std::string(" failures/calls to   : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
-  if (a.identical(b))
-    return false;
-  Uncertain<bool> res = a.approx() < b.approx();
-  if (is_certain(res))
-    return get_certain(res);
-  CGAL_BRANCH_PROFILER_BRANCH(tmp);
-  return a.exact() < b.exact();
-}
-
-template <typename ET1, typename ET2>
-bool
-operator==(const Lazy_exact_nt<ET1>& a, const Lazy_exact_nt<ET2>& b)
-{
-  CGAL_BRANCH_PROFILER(std::string(" failures/calls to   : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
-  if (a.identical(b))
-    return true;
-  Uncertain<bool> res = a.approx() == b.approx();
-  if (is_certain(res))
-    return get_certain(res);
-  CGAL_BRANCH_PROFILER_BRANCH(tmp);
-  return a.exact() == b.exact();
-}
-
-template <typename ET1, typename ET2>
-inline
-bool
-operator>(const Lazy_exact_nt<ET1>& a, const Lazy_exact_nt<ET2>& b)
-{ return b < a; }
-
-template <typename ET1, typename ET2>
-inline
-bool
-operator>=(const Lazy_exact_nt<ET1>& a, const Lazy_exact_nt<ET2>& b)
-{ return ! (a < b); }
-
-template <typename ET1, typename ET2>
-inline
-bool
-operator<=(const Lazy_exact_nt<ET1>& a, const Lazy_exact_nt<ET2>& b)
-{ return b >= a; }
-
-template <typename ET1, typename ET2>
-inline
-bool
-operator!=(const Lazy_exact_nt<ET1>& a, const Lazy_exact_nt<ET2>& b)
-{ return ! (a == b); }
-
-
-template <typename ET>
-inline
-Lazy_exact_nt<ET>
-operator%(const Lazy_exact_nt<ET>& a, const Lazy_exact_nt<ET>& b)
-{
-  CGAL_PROFILER(std::string("calls to    : ") + std::string(CGAL_PRETTY_FUNCTION));
-  CGAL_precondition(b != 0);
-  return Lazy_exact_nt<ET>(a) %= b;
-}
-
-
-
-// Mixed operators with int.
-template <typename ET>
-bool
-operator<(const Lazy_exact_nt<ET>& a, int b)
-{
-  CGAL_BRANCH_PROFILER(std::string(" failures/calls to   : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
-  Uncertain<bool> res = a.approx() < b;
-  if (is_certain(res))
-    return res;
-  CGAL_BRANCH_PROFILER_BRANCH(tmp);
-  return a.exact() < b;
-}
-
-template <typename ET>
-bool
-operator>(const Lazy_exact_nt<ET>& a, int b)
-{
-  CGAL_BRANCH_PROFILER(std::string(" failures/calls to   : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
-  Uncertain<bool> res = b < a.approx();
-  if (is_certain(res))
-    return get_certain(res);
-  CGAL_BRANCH_PROFILER_BRANCH(tmp);
-  return b < a.exact();
-}
-
-template <typename ET>
-bool
-operator==(const Lazy_exact_nt<ET>& a, int b)
-{
-  CGAL_BRANCH_PROFILER(std::string(" failures/calls to   : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
-  Uncertain<bool> res = b == a.approx();
-  if (is_certain(res))
-    return get_certain(res);
-  CGAL_BRANCH_PROFILER_BRANCH(tmp);
-  return b == a.exact();
-}
-
-
-// Mixed operators with double.
-template <typename ET>
-bool
-operator<(const Lazy_exact_nt<ET>& a, double b)
-{
-  CGAL_BRANCH_PROFILER(std::string(" failures/calls to   : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
-  Uncertain<bool> res = a.approx() < b;
-  if (is_certain(res))
-    return res;
-  CGAL_BRANCH_PROFILER_BRANCH(tmp);
-  return a.exact() < b;
-}
-
-template <typename ET>
-bool
-operator>(const Lazy_exact_nt<ET>& a, double b)
-{
-  CGAL_BRANCH_PROFILER(std::string(" failures/calls to   : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
-  Uncertain<bool> res = b < a.approx();
-  if (is_certain(res))
-    return res;
-  CGAL_BRANCH_PROFILER_BRANCH(tmp);
-  return b < a.exact();
-}
-
-template <typename ET>
-bool
-operator==(const Lazy_exact_nt<ET>& a, double b)
-{
-  CGAL_BRANCH_PROFILER(std::string(" failures/calls to   : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
-  Uncertain<bool> res = b == a.approx();
-  if (is_certain(res))
-    return res;
-  CGAL_BRANCH_PROFILER_BRANCH(tmp);
-  return b == a.exact();
-}
-
-
-
-template <typename ET1, typename ET2>
-Lazy_exact_nt< typename Coercion_traits<ET1, ET2>::Type >
-operator+(const Lazy_exact_nt<ET1>& a, const Lazy_exact_nt<ET2>& b)
-{
-  CGAL_PROFILER(std::string("calls to    : ") + std::string(CGAL_PRETTY_FUNCTION));
-  return new Lazy_exact_Add<typename Coercion_traits<ET1, ET2>::Type,
-                            ET1, ET2>(a, b);
-}
-
-template <typename ET1, typename ET2>
-Lazy_exact_nt< typename Coercion_traits<ET1, ET2>::Type >
-operator-(const Lazy_exact_nt<ET1>& a, const Lazy_exact_nt<ET2>& b)
-{
-  CGAL_PROFILER(std::string("calls to    : ") + std::string(CGAL_PRETTY_FUNCTION));
-  return new Lazy_exact_Sub<typename Coercion_traits<ET1, ET2>::Type,
-                            ET1, ET2>(a, b);
-}
-
-template <typename ET1, typename ET2>
-Lazy_exact_nt< typename Coercion_traits<ET1, ET2>::Type >
-operator*(const Lazy_exact_nt<ET1>& a, const Lazy_exact_nt<ET2>& b)
-{
-  CGAL_PROFILER(std::string("calls to    : ") + std::string(CGAL_PRETTY_FUNCTION));
-  return new Lazy_exact_Mul<typename Coercion_traits<ET1, ET2>::Type,
-                            ET1, ET2>(a, b);
-}
-
-template <typename ET1, typename ET2>
-Lazy_exact_nt< typename Coercion_traits<ET1, ET2>::Type >
-operator/(const Lazy_exact_nt<ET1>& a, const Lazy_exact_nt<ET2>& b)
-{
-  CGAL_PROFILER(std::string("calls to    : ") + std::string(CGAL_PRETTY_FUNCTION));
-  CGAL_precondition(b != 0);
-  return new Lazy_exact_Div<typename Coercion_traits<ET1, ET2>::Type,
-                            ET1, ET2>(a, b);
-}
-
-//
-// Algebraic structure traits
-//
-
-namespace INTERN_LAZY_EXACT_NT {
-
-template< class NT, class Functor >
-struct Simplify_selector {
-  struct Simplify : public std::unary_function<NT&, void> {
-    void operator()( NT& ) const {
-      // TODO: In the old implementation the Simplify-functor was the default
-      //       (which does nothing). But this cannot be the correct way!?
-    }
-  };
-};
-
-template< class NT >
-struct Simplify_selector< NT, Null_functor > {
-  typedef Null_functor Simplify;
-};
-
-template< class NT, class Functor >
-struct Unit_part_selector {
-  struct Unit_part : public std::unary_function<NT, NT > {
-    NT operator()( const NT& x ) const {
-      return NT( CGAL_NTS unit_part( x.exact() ) );
-    }
-  };
-};
-
-template< class NT >
-struct Unit_part_selector< NT, Null_functor > {
-  typedef Null_functor Unit_part;
-};
-
-template< class NT, class Functor >
-struct Is_zero_selector {
-  struct Is_zero : public std::unary_function<NT, bool > {
-    bool operator()( const NT& x ) const {
-      return CGAL_NTS is_zero( x.exact() );
-    }
-  };
-};
-
-template< class NT >
-struct Is_zero_selector< NT, Null_functor > {
-  typedef Null_functor Is_zero;
-};
-
-template< class NT, class Functor >
-struct Is_one_selector {
-  struct Is_one : public std::unary_function<NT, bool > {
-    bool operator()( const NT& x ) const {
-      return CGAL_NTS is_one( x.exact() );
-    }
-  };
-};
-
-template< class NT >
-struct Is_one_selector< NT, Null_functor > {
-  typedef Null_functor Is_one;
-};
-
-template< class NT, class Functor >
-struct Square_selector {
-  struct Square : public std::unary_function<NT, NT > {
-    NT operator()( const NT& x ) const {
-      CGAL_PROFILER(std::string("calls to    : ") + std::string(CGAL_PRETTY_FUNCTION));
-      return new Lazy_exact_Square<typename NT::ET>(x);
-    }
-  };
-};
-
-template< class NT >
-struct Square_selector< NT, Null_functor > {
-  typedef Null_functor Square;
-};
-
-template< class NT, class Functor >
-struct Integral_division_selector {
-  struct Integral_division : public std::binary_function<NT, NT, NT > {
-    NT operator()( const NT& x, const NT& y ) const {
-      return NT( CGAL_NTS integral_division( x.exact(), y.exact() ) );
-    }
-
-    CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( NT )
-  };
-};
-
-template< class NT >
-struct Integral_division_selector< NT, Null_functor > {
-  typedef Null_functor Integral_division;
-};
-
-template< class NT, class Functor >
-struct Is_square_selector {
-  struct Is_square : public std::binary_function<NT, NT&, bool > {
-      bool operator()( const NT& x, NT& y ) const {
-          typename NT::ET y_et;
-          bool result = CGAL_NTS is_square( x.exact(), y_et );
-          y = NT(y_et);
-          return result;
-      }
-      bool operator()( const NT& x) const {
-          typename NT::ET y_et;
-          return CGAL_NTS is_square( x.exact(), y_et );
-      }
-  };
-};
-
-template< class NT >
-struct Is_square_selector< NT, Null_functor > {
-  typedef Null_functor Is_square;
-};
-
-
-template <class NT, class AlgebraicStructureTag>
-struct Sqrt_selector{
-    struct Sqrt : public std::unary_function<NT, NT > {
-        NT operator ()(const NT& x) const {
-          CGAL_PROFILER(std::string("calls to    : ") + std::string(CGAL_PRETTY_FUNCTION));
-          CGAL_precondition(x >= 0);
-          return new Lazy_exact_Sqrt<typename NT::ET>(x);
-        }
-    };
-};
-template <class NT>
-struct Sqrt_selector<NT,Null_functor> {
-    typedef Null_functor Sqrt;
-};
-
-template< class NT, class Functor >
-struct Kth_root_selector {
-  struct Kth_root : public std::binary_function<int, NT, NT > {
-    NT operator()( int k, const NT& x ) const {
-      return NT( CGAL_NTS kth_root( k, x.exact() ) );
-    }
-  };
-};
-
-template< class NT >
-struct Kth_root_selector< NT, Null_functor > {
-  typedef Null_functor Kth_root;
-};
-
-template< class NT, class Functor >
-struct Root_of_selector {
-  private:
-      struct Cast{
-        typedef typename NT::ET result_type;
-        result_type operator()(const NT& lazy_exact) const {
-          return lazy_exact.exact();
-        }
-      };
-
-  public:
-    struct Root_of {
-//      typedef typename Functor::Boundary Boundary;
-      typedef NT result_type;
-      template< class Input_iterator >
-      NT operator()( int k, Input_iterator begin, Input_iterator end ) const {
-       Cast cast;
-       return NT( typename Algebraic_structure_traits<typename NT::ET>::
-                                 Root_of()( k,
-                              ::boost::make_transform_iterator( begin, cast ),
-                              ::boost::make_transform_iterator( end, cast ) ) );
-      }
-
-    };
-};
-
-template< class NT >
-struct Root_of_selector< NT, Null_functor > {
-  typedef Null_functor Root_of;
-};
-
-template< class NT, class Functor >
-struct Gcd_selector {
-  struct Gcd : public std::binary_function<NT, NT, NT > {
-    NT operator()( const NT& x, const NT& y ) const {
-     CGAL_PROFILER(std::string("calls to    : ") + std::string(CGAL_PRETTY_FUNCTION));
-     return NT( CGAL_NTS gcd( x.exact(), y.exact() ) );
-    }
-
-    CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( NT )
-  };
-};
-
-template< class NT >
-struct Gcd_selector< NT, Null_functor > {
-  typedef Null_functor Gcd;
-};
-
-template< class NT, class Functor >
-struct Div_selector {
-  struct Div : public std::binary_function<NT, NT, NT > {
-    NT operator()( const NT& x, const NT& y ) const {
-      return NT( CGAL_NTS div( x.exact(), y.exact() ) );
-    }
-
-    CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( NT )
-
-  };
-};
-
-template< class NT >
-struct Div_selector< NT, Null_functor > {
-  typedef Null_functor Div;
-};
-
-template< class NT, class Functor >
-struct Inverse_selector {
-  struct Inverse  {
-    typedef NT result_type;
-    NT operator()( const NT& x ) const {
-      return NT( 1 ) / x ;
-    }
-  };
-};
-
-template< class NT >
-struct Inverse_selector< NT, Null_functor > {
-  typedef Null_functor Inverse;
-};
-
-template< class NT, class Functor >
-struct Mod_selector {
-  struct Mod : public std::binary_function<NT, NT, NT > {
-    NT operator()( const NT& x, const NT& y ) const {
-      return NT( CGAL_NTS mod( x.exact(), y.exact() ) );
-    }
-
-    CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( NT )
-
-  };
-};
-
-template< class NT >
-struct Mod_selector< NT, Null_functor > {
-  typedef Null_functor Mod;
-};
-
-template< class NT, class Functor >
-struct Div_mod_selector {
-  struct Div_mod {
-    typedef void result_type;
-    typedef NT   first_argument_type;
-    typedef NT   second_argument_type;
-    typedef NT&  third_argument_type;
-    typedef NT&  fourth_argument_type;
-
-    void operator()( const NT& x, const NT& y, NT& q, NT& r ) const {
-      typename NT::ET q_et;
-      typename NT::ET r_et;
-      CGAL_NTS div_mod( x.exact(), y.exact(), q_et, r_et );
-      q = NT( q_et );
-      r = NT( r_et );
-    }
-
-    template< class NT1, class NT2 >
-    void operator()( const NT1& x, const NT2& y,
-                     NT& q,
-                     NT& r ) const {
-      CGAL_static_assertion((::boost::is_same<
-        typename Coercion_traits< NT1, NT2 >::Type, NT
-                                              >::value));
-
-      typename Coercion_traits< NT1, NT2 >::Cast cast;
-      operator()( cast(x), cast(y), q, r );
-    }
-  };
-};
-
-template< class NT >
-struct Div_mod_selector< NT, Null_functor >{
-  typedef Null_functor Div_mod;
-};
-} // namespace INTERN_LAZY_EXACT_NT
-
-template <class ET>
-class Algebraic_structure_traits< Lazy_exact_nt<ET> >
-    :public Algebraic_structure_traits_base
-      < Lazy_exact_nt<ET>,
-       typename Algebraic_structure_traits<ET>::Algebraic_category >
-{
-private:
-    typedef Algebraic_structure_traits<ET> AST_ET;
-    typedef typename AST_ET::Algebraic_category ET_as_tag;
-public:
-    typedef typename AST_ET::Is_exact               Is_exact;
-    typedef typename AST_ET::Is_numerical_sensitive Is_numerical_sensitive;
-
-    typedef typename INTERN_LAZY_EXACT_NT::Simplify_selector
-    <Lazy_exact_nt<ET>, typename AST_ET::Simplify > ::Simplify Simplify;
-
-    typedef typename INTERN_LAZY_EXACT_NT::Unit_part_selector
-    <Lazy_exact_nt<ET>, typename AST_ET::Unit_part > ::Unit_part Unit_part;
-
-    typedef typename INTERN_LAZY_EXACT_NT::Is_zero_selector
-    <Lazy_exact_nt<ET>, typename AST_ET::Is_zero > ::Is_zero Is_zero;
-
-    typedef typename INTERN_LAZY_EXACT_NT::Is_one_selector
-    <Lazy_exact_nt<ET>, typename AST_ET::Is_one > ::Is_one Is_one;
-
-    typedef typename INTERN_LAZY_EXACT_NT::Square_selector
-    <Lazy_exact_nt<ET>, typename AST_ET::Square > ::Square Square;
-
-    typedef typename INTERN_LAZY_EXACT_NT::Integral_division_selector
-    <Lazy_exact_nt<ET>, typename AST_ET::Integral_division> ::Integral_division Integral_division;
-
-    typedef typename INTERN_LAZY_EXACT_NT::Is_square_selector
-    <Lazy_exact_nt<ET>, typename AST_ET::Is_square > ::Is_square Is_square;
-
-    typedef typename INTERN_LAZY_EXACT_NT::Sqrt_selector
-    <Lazy_exact_nt<ET>, typename AST_ET::Sqrt> ::Sqrt Sqrt;
-
-    typedef typename INTERN_LAZY_EXACT_NT::Kth_root_selector
-    <Lazy_exact_nt<ET>, typename AST_ET::Kth_root > ::Kth_root Kth_root;
-
-    typedef typename INTERN_LAZY_EXACT_NT::Root_of_selector
-    <Lazy_exact_nt<ET>, typename AST_ET::Root_of > ::Root_of Root_of;
-
-    typedef typename INTERN_LAZY_EXACT_NT::Gcd_selector
-    <Lazy_exact_nt<ET>, typename AST_ET::Gcd > ::Gcd Gcd;
-
-    typedef typename INTERN_LAZY_EXACT_NT::Div_selector
-    <Lazy_exact_nt<ET>, typename AST_ET::Div > ::Div Div;
-
-    typedef typename INTERN_LAZY_EXACT_NT::Mod_selector
-    <Lazy_exact_nt<ET>, typename AST_ET::Mod > ::Mod Mod;
-
-    typedef typename INTERN_LAZY_EXACT_NT::Div_mod_selector
-    <Lazy_exact_nt<ET>, typename AST_ET::Div_mod > ::Div_mod Div_mod;
-    
-    typedef typename INTERN_LAZY_EXACT_NT::Inverse_selector
-    <Lazy_exact_nt<ET>, typename AST_ET::Inverse > ::Inverse Inverse;    
-};
-
-
-
-//
-// Real embeddalbe traits
-//
-
-template < typename ET > class Real_embeddable_traits< Lazy_exact_nt<ET> >
-  : public INTERN_RET::Real_embeddable_traits_base< Lazy_exact_nt<ET> , CGAL::Tag_true > {
-
-  // Every type ET of Lazy_exact_nt<ET> has to be real embeddable.
-  CGAL_static_assertion((::boost::is_same< typename Real_embeddable_traits< ET >
-                                ::Is_real_embeddable, Tag_true >::value));
-
-  public:
-    typedef Lazy_exact_nt<ET> Type;
-
-    class Abs
-      : public std::unary_function< Type, Type > {
-      public:
-        Type operator()( const Type& a ) const {
-            CGAL_PROFILER(std::string("calls to    : ") + std::string(CGAL_PRETTY_FUNCTION));
-            return new Lazy_exact_Abs<ET>(a);
-        }
-    };
-
-    class Sgn
-      : public std::unary_function< Type, ::CGAL::Sign > {
-      public:
-        ::CGAL::Sign operator()( const Type& a ) const {
-            CGAL_BRANCH_PROFILER(std::string(" failures/calls to   : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
-            Uncertain< ::CGAL::Sign> res = CGAL_NTS sign(a.approx());
-            if (is_certain(res))
-                return get_certain(res);
-            CGAL_BRANCH_PROFILER_BRANCH(tmp);
-            return CGAL_NTS sign(a.exact());
-        }
-    };
-
-    class Compare
-      : public std::binary_function< Type, Type,
-                                Comparison_result > {
-      public:
-        Comparison_result operator()( const Type& a,
-                                            const Type& b ) const {
-            CGAL_BRANCH_PROFILER(std::string(" failures/calls to   : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
-            if (a.identical(b))
-                return EQUAL;
-            Uncertain<Comparison_result> res = CGAL_NTS compare(a.approx(), b.approx());
-            if (is_certain(res))
-                return get_certain(res);
-            CGAL_BRANCH_PROFILER_BRANCH(tmp);
-            return CGAL_NTS compare(a.exact(), b.exact());
-        }
-
-        CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT( Type,
-                                                      Comparison_result )
-
-    };
-
-    class To_double
-      : public std::unary_function< Type, double > {
-      public:
-        double operator()( const Type& a ) const {
-            CGAL_BRANCH_PROFILER(std::string(" failures/calls to   : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
-
-            const Interval_nt<false>& app = a.approx();
-            double r;
-            if (fit_in_double(app, r))
-                return r;
-
-            // If it's precise enough, then OK.
-            if (has_smaller_relative_precision(app,
-                 Lazy_exact_nt<ET>::get_relative_precision_of_to_double()))
-                return CGAL_NTS to_double(app);
-
-            CGAL_BRANCH_PROFILER_BRANCH(tmp);
-
-            // Otherwise we trigger exact computation first,
-            // which will refine the approximation.
-            a.exact();
-            return CGAL_NTS to_double(a.approx());
-        }
-    };
-
-    class To_interval
-      : public std::unary_function< Type, std::pair< double, double > > {
-      public:
-        std::pair<double, double> operator()( const Type& a ) const {
-            CGAL_PROFILER(std::string("calls to    : ") + std::string(CGAL_PRETTY_FUNCTION));
-            return a.approx().pair();
-        }
-    };
-
-    class Is_finite
-      : public std::unary_function< Type, bool > {
-      public:
-        bool operator()( const Type& x ) const {
-          return CGAL_NTS is_finite(x.approx()) || CGAL_NTS is_finite(x.exact());
-        }
-    };
-
-};
-
-template <class ET1, class ET2, class F>
-class Lazy_exact_nt_coercion_traits_base {
-public:
-    typedef Tag_false Are_explicit_interoperable;
-    typedef Tag_false Are_implicit_interoperable;
-    //typedef Null_type    Type
-    typedef Null_functor Cast;
-};
-
-template <class ET1, class ET2>
-class Lazy_exact_nt_coercion_traits_base < Lazy_exact_nt<ET1>, Lazy_exact_nt<ET2>, Tag_true >
-{
-    typedef Coercion_traits<ET1,ET2> CT;
-    typedef Lazy_exact_nt<ET1> A;
-    typedef Lazy_exact_nt<ET2> B;
-public:
-    typedef Lazy_exact_nt<typename CT::Type> Type;
-    typedef typename CT::Are_implicit_interoperable Are_explicit_interoperable;
-    typedef typename CT::Are_implicit_interoperable Are_implicit_interoperable;
-
-    class Cast{
-    private:
-        template <class T>
-        Type cast(const T& x) const{ return Type(x); }
-        Type cast(const Type& x) const{ return x; }
-    public:
-        typedef Type result_type;
-        Type operator()(const A& x) const { return cast(x);}
-        Type operator()(const B& x) const { return cast(x);}
-    };
-};
-
-
-CGAL_DEFINE_COERCION_TRAITS_FOR_SELF_TEM(Lazy_exact_nt<ET>, class ET)
-CGAL_DEFINE_COERCION_TRAITS_FROM_TO_TEM(ET,Lazy_exact_nt<ET>,class ET)
-
-template<class ET1, class ET2 >
-struct Coercion_traits< Lazy_exact_nt<ET1>, Lazy_exact_nt<ET2> >
-    :public Lazy_exact_nt_coercion_traits_base
-           <Lazy_exact_nt<ET1>, Lazy_exact_nt<ET2>,
-            typename Coercion_traits<ET1,ET2>::Are_implicit_interoperable>{};
-
-
-#define CGAL_COERCION_TRAITS_LAZY_EXACT(NTX)                            \
-    template<class ET>                                                  \
-    struct Coercion_traits< NTX, Lazy_exact_nt<ET> >{                   \
-    private:                                                            \
-        typedef Coercion_traits<NTX,ET> CT;                             \
-        typedef Lazy_exact_nt<ET> NT;                                   \
-    public:                                                             \
-        typedef typename CT::Are_explicit_interoperable                 \
-        Are_explicit_interoperable;                                     \
-        typedef typename CT::Are_implicit_interoperable                 \
-        Are_implicit_interoperable;                                     \
-    private:                                                            \
-        static const  bool interoperable                                \
-        =boost::is_same< Are_implicit_interoperable, Tag_false>::value; \
-    public:                                                             \
-        typedef typename boost::mpl::if_c <interoperable,Null_tag,NT>   \
-        ::type  Type;                                          \
-        typedef typename boost::mpl::if_c <interoperable, Null_functor, \
-    INTERN_CT::Cast_from_to<NTX,NT> >::type Cast;                       \
-    };                                                                  \
-                                                                        \
-    template<class ET>                                                  \
-    struct Coercion_traits< Lazy_exact_nt<ET>, NTX >                    \
-        :public Coercion_traits<NTX, Lazy_exact_nt<ET> >{};             \
-
-
-CGAL_COERCION_TRAITS_LAZY_EXACT(int)
-CGAL_COERCION_TRAITS_LAZY_EXACT(short)
-CGAL_COERCION_TRAITS_LAZY_EXACT(double)
-CGAL_COERCION_TRAITS_LAZY_EXACT(float)
-#undef CGAL_COERCION_TRAITS_LAZY_EXACT
-
-namespace INTERN_LAZY_EXACT_NT {
-
-template < typename NT, typename TAG  > class Fraction_traits_base;
-
-template < class ET >
-class Fraction_traits_base <Lazy_exact_nt<ET> , CGAL::Tag_false>
-    : public Fraction_traits<ET> {
-public:
-    typedef Lazy_exact_nt<ET>  Type;
-};
-
-template < class ET >
-class Fraction_traits_base <Lazy_exact_nt<ET> , CGAL::Tag_true>{
-    typedef Fraction_traits<ET> ETT;
-    typedef typename ETT::Numerator_type ET_numerator;
-    typedef typename ETT::Denominator_type ET_denominator;
-public:
-    typedef Lazy_exact_nt<ET>  Type;
-    typedef Tag_true Is_fraction;
-    typedef Lazy_exact_nt<ET_numerator> Numerator_type;
-    typedef Lazy_exact_nt<ET_denominator> Denominator_type;
-
-    struct Common_factor : std::binary_function<Denominator_type,Denominator_type,Denominator_type>{
-        Denominator_type operator()(const Denominator_type& a, const Denominator_type& b) const {
-            typename ETT::Common_factor common_factor;
-            return Denominator_type(common_factor(a.exact(),b.exact()));
-        }
-    };
-    struct Compose : std::binary_function<Type,Numerator_type,Denominator_type>{
-        Type operator()(const Numerator_type& n, const Denominator_type& d) const {
-            typename ETT::Compose compose;
-            return Type(compose(n.exact(),d.exact()));
-        }
-    };
-    struct Decompose {
-        typedef void result_type;
-        typedef Type first_argument_type;
-        typedef Numerator_type second_argument_type;
-        typedef Denominator_type third_argument_type;
-        void operator()(const Type& f, Numerator_type& n, Denominator_type& d) const {
-            typename ETT::Decompose decompose;
-            ET_numerator nn;
-            ET_denominator dd;
-            decompose(f.exact(),nn,dd);
-            n = Numerator_type(nn);
-            d = Denominator_type(dd);
-        }
-    };
-};
-} // namespace INTERN_LAZY_EXACT_NT
-
-
-template < class ET >
-class Fraction_traits< Lazy_exact_nt< ET > >
-    :public INTERN_LAZY_EXACT_NT::Fraction_traits_base<Lazy_exact_nt<ET>,
-            typename Fraction_traits<ET>::Is_fraction>
-{};
-
-template < class ET >
-struct Min <Lazy_exact_nt<ET> >
-    : public std::binary_function<Lazy_exact_nt<ET>,Lazy_exact_nt<ET>,Lazy_exact_nt<ET> > {
-
-    Lazy_exact_nt<ET> operator()( const Lazy_exact_nt<ET>& x, const Lazy_exact_nt<ET>& y) const
-    {
-      if (x.identical(y)){
-        return x;
-      }
-      Uncertain<bool> res = x.approx() < y.approx();
-      if(is_certain(res)){
-        return res.make_certain() ? x : y;
-      }
-      CGAL_PROFILER(std::string("calls to    : ") + std::string(CGAL_PRETTY_FUNCTION));
-      return new Lazy_exact_Min<ET>(x, y);
-    }
-};
-
-template < class ET >
-struct Max <Lazy_exact_nt<ET> >
-    : public std::binary_function<Lazy_exact_nt<ET>,Lazy_exact_nt<ET>,Lazy_exact_nt<ET> > {
-
-    Lazy_exact_nt<ET> operator()( const Lazy_exact_nt<ET>& x, const Lazy_exact_nt<ET>& y) const
-    {
-      if (x.identical(y)){
-        return x;
-      }
-      Uncertain<bool> res = x.approx() > y.approx();
-      if(is_certain(res)){
-        return  res.make_certain() ? x : y;
-      }
-        CGAL_PROFILER(std::string("calls to    : ") + std::string(CGAL_PRETTY_FUNCTION));
-        return new Lazy_exact_Max<ET>(x, y);
-    }
-};
-
-template<typename ET> inline 
-Lazy_exact_nt<ET> min BOOST_PREVENT_MACRO_SUBSTITUTION(
-const Lazy_exact_nt<ET> & x,
-const Lazy_exact_nt<ET> & y){
-  return CGAL::Min<Lazy_exact_nt<ET> > ()(x,y);
-}
-template<typename ET> inline 
-Lazy_exact_nt<ET> max BOOST_PREVENT_MACRO_SUBSTITUTION(
-const Lazy_exact_nt<ET> & x,
-const Lazy_exact_nt<ET> & y){
-  return CGAL::Max<Lazy_exact_nt<ET> > ()(x,y);
-}
-
-template <typename ET>
-std::ostream &
-operator<< (std::ostream & os, const Lazy_exact_nt<ET> & a)
-{ return os << CGAL_NTS to_double(a); }
-
-template <typename ET>
-std::istream &
-operator>> (std::istream & is, Lazy_exact_nt<ET> & a)
-{
-  ET e;
-  internal::read_float_or_quotient(is, e);
-  if (is)
-    a = e;
-  return is;
-}
-
-template< class ET >
-class Is_valid< Lazy_exact_nt<ET> >
-  : public std::unary_function< Lazy_exact_nt<ET>, bool > {
-  public :
-    bool operator()( const Lazy_exact_nt<ET>& x ) const {
-      return is_valid(x.approx());
-    }
-};
-
-template < typename ET >
-struct NT_converter < Lazy_exact_nt<ET>, ET >
-{
-  const ET& operator()(const Lazy_exact_nt<ET> &a) const
-  { return a.exact(); }
-};
-
-// Forward declaration to break inclusion cycle
-namespace internal {
-template<class>struct Exact_field_selector;
-template<class>struct Exact_ring_selector;
-}
-// Compiler can deduce ET from the first argument.
-template < typename ET >
-struct NT_converter < Lazy_exact_nt<ET>,
-  typename First_if_different<
-    typename internal::Exact_field_selector<ET>::Type,
-    ET>::Type>
-{
-  typename internal::Exact_field_selector<ET>::Type
-    operator()(const Lazy_exact_nt<ET> &a) const
-  { return NT_converter<ET,typename internal::Exact_field_selector<ET>::Type>()(a.exact()); }
-};
-
-template < typename ET >
-struct NT_converter < Lazy_exact_nt<ET>,
-  typename First_if_different<
-   typename First_if_different<
-    typename internal::Exact_ring_selector<ET>::Type,
-    ET>::Type,
-   typename internal::Exact_field_selector<ET>::Type>::Type>
-{
-  typename internal::Exact_ring_selector<ET>::Type operator()(const Lazy_exact_nt<ET> &a) const
-  { return NT_converter<ET,typename internal::Exact_ring_selector<ET>::Type>()(a.exact()); }
-};
-
-namespace internal {
-// Returns true if the value is representable by a double and to_double()
-// would return it.  False means "don't know" (the exact number type is not
-// queried).
-template < typename ET >
-inline bool
-fit_in_double(const Lazy_exact_nt<ET>& l, double& r)
-{ return fit_in_double(l.approx(), r); }
-
-} // namespace internal
-
-template <class NT_,class ROOT_, class ACDE_TAG_, class FP_TAG>
-void
-print(std::ostream &os, const CGAL::Lazy_exact_nt< Sqrt_extension<NT_,ROOT_,ACDE_TAG_,FP_TAG> > &r)
-{
-  print(os,r.exact());
-}
-
-namespace INTERN_LAZY_EXACT_NT {
-template< typename ET , typename Tag>
-class Modular_traits_base{
-public:
-  typedef Lazy_exact_nt<ET> NT;
-  typedef ::CGAL::Tag_false Is_modularizable;
-  typedef ::CGAL::Null_functor Residue_type;
-  typedef ::CGAL::Null_functor Modular_image;  
-  typedef ::CGAL::Null_functor Modular_image_representative;    
-};
-
-template< typename ET >
-class Modular_traits_base<ET, Tag_true>{
-  typedef Modular_traits<ET> MT_ET;
-public:
-  typedef Lazy_exact_nt<ET> NT;
-  typedef CGAL::Tag_true Is_modularizable;
-  typedef typename MT_ET::Residue_type Residue_type;
-
-  struct Modular_image{
-    Residue_type operator()(const NT& a){
-      typename MT_ET::Modular_image modular_image;
-      return modular_image(a.exact());
-    }
-  };
-  struct Modular_image_representative{
-    NT operator()(const Residue_type& x){
-      typename MT_ET::Modular_image_representative modular_image_representative;
-      return NT(modular_image_representative(x));
-    }
-  };    
-};
-} // namespace INTERN_LAZY_EXACT_NT
-
-template < typename ET > 
-class Modular_traits<Lazy_exact_nt<ET> >
-  :public INTERN_LAZY_EXACT_NT::Modular_traits_base
-<ET,typename Modular_traits<ET>::Is_modularizable>{};
-
-
-#undef CGAL_double
-#undef CGAL_int
-#undef CGAL_To_interval
-
-} //namespace CGAL
-
-namespace Eigen {
-  template<class> struct NumTraits;
-  template<typename ET> struct NumTraits<CGAL::Lazy_exact_nt<ET> >
-  {
-    typedef CGAL::Lazy_exact_nt<ET> Real;
-    // typedef CGAL::Lazy_exact_nt<ET> NonInteger;
-    typedef CGAL::Lazy_exact_nt<typename NumTraits<ET>::NonInteger> NonInteger;
-    typedef CGAL::Lazy_exact_nt<ET> Nested;
-
-    static inline Real epsilon() { return 0; }
-    static inline Real dummy_precision() { return 0; }
-
-    enum {
-      IsInteger = NumTraits<ET>::IsInteger,
-      IsSigned = NumTraits<ET>::IsSigned,
-      IsComplex = NumTraits<ET>::IsComplex,
-      RequireInitialization = 1,
-      ReadCost = 8,
-      AddCost = 30,
-      MulCost = 30
-    };
-  };
-}
-
-#endif // CGAL_LAZY_EXACT_NT_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Linear_cell_complex.h b/3rdparty/CGAL-4.8/include/CGAL/Linear_cell_complex.h
deleted file mode 100644
index 01ad03d..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Linear_cell_complex.h
+++ /dev/null
@@ -1,936 +0,0 @@
-// Copyright (c) 2011 CNRS and LIRIS' Establishments (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Guillaume Damiand <guillaume.damiand at liris.cnrs.fr>
-//
-#ifndef CGAL_LINEAR_CELL_COMPLEX_H
-#define CGAL_LINEAR_CELL_COMPLEX_H 1
-
-#include <CGAL/Combinatorial_map.h>
-#include <CGAL/Combinatorial_map_constructors.h>
-#include <CGAL/Linear_cell_complex_operations.h>
-#include <CGAL/Linear_cell_complex_min_items.h>
-#include <CGAL/Linear_cell_complex_traits.h>
-#include <CGAL/Linear_cell_complex_storages.h>
-
-namespace CGAL {
-
-  /** @file Linear_cell_complex.h
-   * Definition of a linear cell complex, i.e. a combinatorial map with points
-   * associated to all vertices.
-   */
-
-  /**  Linear_cell_complex class.
-   * The Linear_cell_complex a nD object with linear geometry, ie
-   * an nD combinatorial map with point associated to each vertex.
-   */
-  template < unsigned int d_, unsigned int ambient_dim,
-             class Traits_,
-             class Items_,
-             class Alloc_,
-             template<unsigned int,class,class,class,class>
-             class CMap,
-             class Refs,
-             class Storage_>
-  class Linear_cell_complex_base:
-    public CMap<d_, Refs, Items_, Alloc_, Storage_>
-  {
-  public:
-    typedef Linear_cell_complex_base<d_, ambient_dim,
-                                Traits_, Items_, Alloc_, CMap,
-                                Refs, Storage_>  Self;
-    typedef CMap<d_, Refs, Items_, Alloc_, Storage_> Base;
-
-    typedef Traits_ Traits;
-    typedef Items_  Items;
-    typedef Alloc_  Alloc;
-    typedef Storage_ Storage;
-
-    static const unsigned int ambient_dimension = ambient_dim;
-    static const unsigned int dimension = Base::dimension;
-
-    typedef typename Storage::Dart_handle       Dart_handle;
-    typedef typename Storage::Dart_const_handle Dart_const_handle;
-    typedef typename Storage::Helper            Helper;
-
-    typedef typename Storage::Point  Point;
-    typedef typename Storage::Vector Vector;
-    typedef typename Storage::FT     FT;
-
-    typedef typename Base::Dart_range Dart_range;
-
-    /// Typedef for attributes
-    template<int i>
-    struct Attribute_type: public Base::template Attribute_type<i>
-    {};
-    template<int i>
-    struct Attribute_handle: public Base::template Attribute_handle<i>
-    {};
-    template<int i>
-    struct Attribute_const_handle:
-      public Base::template Attribute_const_handle<i>
-    {};
-    template<int i>
-    struct Attribute_range: public Base::template Attribute_range<i>
-    {};
-    template<int i>
-    struct Attribute_const_range:
-      public Base::template Attribute_const_range<i>
-    {};
-
-    typedef typename Base::template Attribute_type<0>::type Vertex_attribute;
-    typedef typename Base::template Attribute_handle<0>::type
-    Vertex_attribute_handle;
-    typedef typename Base::template Attribute_const_handle<0>::type
-    Vertex_attribute_const_handle;
-
-    typedef typename Base::template Attribute_range<0>::type
-    Vertex_attribute_range;
-    typedef typename Base::template Attribute_const_range<0>::type
-    Vertex_attribute_const_range;
-
-    typedef typename Base::size_type size_type;
-    typedef typename Base::Use_index Use_index;
-    typedef typename Base::Exception_no_more_available_mark
-    Exception_no_more_available_mark;
-
-    /// To use previous definition of create_dart methods.
-    using Base::create_dart;
-    using Base::beta;
-    using Base::is_free;
-    using Base::attribute;
-    using Base::null_handle;
-    using Base::point_of_vertex_attribute;
-
-    using Base::are_attributes_automatically_managed;
-    using Base::mark;
-    using Base::unmark;
-    using Base::free_mark;
-    using Base::get_new_mark;
-
-    Linear_cell_complex_base() : Base()
-    {}
-
-    /** Copy the given linear cell complex into *this.
-     *  Note that both LCC can have different dimensions and/or non void attributes.
-     *  @param alcc the linear cell complex to copy.
-     *  @post *this is valid.
-     */
-    Linear_cell_complex_base(const Self & alcc)
-    { Base::template copy<Self>(alcc); }
-
-    template < class LCC2 >
-    Linear_cell_complex_base(const LCC2& alcc)
-    { Base::template copy<LCC2>(alcc);}
-
-    template < class LCC2, typename Converters >
-    Linear_cell_complex_base(const LCC2& alcc, Converters& converters)
-    { Base::template copy<LCC2, Converters>(alcc, converters);}
-
-    template < class LCC2, typename Converters, typename Pointconverter >
-    Linear_cell_complex_base(const LCC2& alcc, Converters& converters,
-                        const Pointconverter& pointconverter)
-    { Base::template copy<LCC2, Converters, Pointconverter>
-          (alcc, converters, pointconverter);}
-
-    /** Create a vertex attribute.
-     * @return an handle on the new attribute.
-     */
-#ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
-    template<typename ...Args>
-    Vertex_attribute_handle create_vertex_attribute(const Args&... args)
-    { return Base::template create_attribute<0>(args...); }
-#else
-    Vertex_attribute_handle create_vertex_attribute()
-    { return Base::template create_attribute<0>(); }
-
-    template<typename T1>
-    Vertex_attribute_handle create_vertex_attribute(const T1& t1)
-    { return Base::template create_attribute<0>(t1); }
-
-    template<typename T1, typename T2>
-    Vertex_attribute_handle create_vertex_attribute
-    (const T1& t1, const T2 &t2)
-    { return Base::template create_attribute<0>(t1, t2); }
-
-    template<typename T1, typename T2, typename T3>
-    Vertex_attribute_handle create_vertex_attribute
-    (const T1& t1, const T2 &t2, const T3 &t3)
-    { return Base::template create_attribute<0>(t1, t2, t3); }
-
-    template<typename T1, typename T2, typename T3, typename T4>
-    Vertex_attribute_handle create_vertex_attribute
-    (const T1& t1, const T2 &t2, const T3 &t3, const T4 &t4)
-    { return Base::template create_attribute<0>(t1, t2, t3, t4); }
-
-    template<typename T1, typename T2, typename T3, typename T4, typename T5>
-    Vertex_attribute_handle create_vertex_attribute
-    (const T1& t1, const T2 &t2, const T3 &t3, const T4 &t4,
-     const T5 &t5)
-    { return Base::template create_attribute<0>(t1, t2, t3, t4, t5); }
-
-    template<typename T1, typename T2, typename T3, typename T4, typename T5,
-             typename T6>
-    Vertex_attribute_handle create_vertex_attribute
-    (const T1& t1, const T2 &t2, const T3 &t3, const T4 &t4,
-     const T5 &t5, const T6 &t6)
-    { return Base::template create_attribute<0>(t1, t2, t3, t4, t5, t6); }
-
-    template<typename T1, typename T2, typename T3, typename T4, typename T5,
-             typename T6, typename T7>
-    Vertex_attribute_handle create_vertex_attribute
-    (const T1& t1, const T2 &t2, const T3 &t3, const T4 &t4,
-     const T5 &t5, const T6 &t6, const T7 &t7)
-    { return Base::template create_attribute<0>(t1, t2, t3, t4, t5, t6, t7); }
-
-  template<typename T1, typename T2, typename T3, typename T4, typename T5,
-             typename T6, typename T7, typename T8>
-    Vertex_attribute_handle create_vertex_attribute
-    (const T1& t1, const T2 &t2, const T3 &t3, const T4 &t4,
-     const T5 &t5, const T6 &t6, const T7 &t7, const T8 &t8)
-    { return Base::template create_attribute<0>(t1, t2, t3, t4, t5, t6, t7,
-                                                t8); }
-
-  template<typename T1, typename T2, typename T3, typename T4, typename T5,
-           typename T6, typename T7, typename T8, typename T9>
-  Vertex_attribute_handle create_vertex_attribute
-    (const T1& t1, const T2 &t2, const T3 &t3, const T4 &t4,
-     const T5 &t5, const T6 &t6, const T7 &t7, const T8 &t8, const T9 &t9)
-    { return Base::template create_attribute<0>(t1, t2, t3, t4, t5, t6, t7,
-                                                t8, t9); }
-#endif // CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
-
-    /**
-     * Create a new dart associated with an handle through an attribute.
-     * @param ahandle the point handle to associated with the dart.
-     * @return a Dart_handle on the new dart.
-     */
-    Dart_handle create_dart(Vertex_attribute_handle ahandle)
-    {
-      Dart_handle res = create_dart();
-      set_vertex_attribute_of_dart(res,ahandle);
-      return res;
-    }
-
-    /** Create a new dart associated with a point.
-     * @param apoint the point to associated with the dart.
-     * @return a Dart_handle on the new dart.
-     */
-    Dart_handle create_dart(const Point& apoint)
-    { return create_dart(create_vertex_attribute(apoint)); }
-
-    /** Erase a given vertex attribute.
-     * @param ahandle the handle to the vertex attribute to erase.
-     */
-    void erase_vertex_attribute(Vertex_attribute_handle ahandle)
-    { Base::template erase_attribute<0>(ahandle); }
-
-    /** Set the vertex attribute of the given dart.
-     * @param adart a dart.
-     * @param ah the attribute to set.
-     */
-    void set_vertex_attribute_of_dart(Dart_handle adart,
-                                      Vertex_attribute_handle ah)
-    {
-      return CGAL::internal::Set_i_attribute_of_dart_functor<Self, 0>::
-          run(this, adart,ah);
-    }
-
-    /** Set the vertex attribute of all the darts of the vertex.
-     * @param adart a dart of the vertex.
-     * @param ah the attribute to set.
-     */
-    void set_vertex_attribute(Dart_handle adart,
-                              Vertex_attribute_handle ah)
-    { return CGAL::Set_i_attribute_functor<Self, 0>::run(this, adart,ah); }
-
-    /// @return the Vertex_attribute_range for all vertex_attributes.
-    Vertex_attribute_range& vertex_attributes()
-    { return this->template attributes<0>(); }
-
-    /// @return the Vertex_attribute_const_range for all vertex_attributes.
-    Vertex_attribute_const_range& vertex_attributes() const
-    { return this->template attributes<0>(); }
-
-    /// @return the size of the vertex_attribute container.
-    typename Base::size_type number_of_vertex_attributes() const
-    { return Base::template number_of_attributes<0>(); }
-
-#ifdef CGAL_CMAP_DEPRECATED
-    static Vertex_attribute_handle vertex_attribute(Dart_handle adart)
-    {
-      CGAL_assertion(adart!=NULL);
-      return adart->template attribute<0>();
-    }
-   static Vertex_attribute_const_handle vertex_attribute(Dart_const_handle
-                                                          adart)
-    {
-      CGAL_assertion(adart!=NULL);
-      return adart->template attribute<0>();
-    }
-    static Point& point(Dart_handle adart)
-    {
-      CGAL_assertion(adart!=NULL && adart->template attribute<0>()!=NULL );
-      return adart->template attribute<0>()->point();
-    }
-    static const Point& point(Dart_const_handle adart)
-    {
-      CGAL_assertion(adart!=NULL && adart->template attribute<0>()!=NULL );
-      return adart->template attribute<0>()->point();
-    }
-#else
-    /// Get the vertex_attribute associated with a dart.
-    /// @param a dart
-    /// @return the vertex_attribute.
-    Vertex_attribute_handle vertex_attribute(Dart_handle adart)
-    { return this->template attribute<0>(adart); }
-
-    /// Get the vertex_attribute associated with a const dart.
-    /// @param a dart
-    /// @return the vertex_const_attribute.
-    Vertex_attribute_const_handle
-    vertex_attribute(Dart_const_handle adart) const
-    { return this->template attribute<0>(adart); }
-
-    /// Get the point associated with a dart.
-    /// @param a dart
-    /// @return the point.
-    Point& point(Dart_handle adart)
-    {
-      CGAL_assertion(this->template attribute<0>(adart)!=null_handle );
-      return point_of_vertex_attribute(this->template attribute<0>(adart));
-    }
-
-    /// Get the point associated with a const dart.
-    /// @param a dart
-    /// @return the point.
-    const Point& point(Dart_const_handle adart) const
-    {
-      CGAL_assertion(this->template attribute<0>(adart)!=null_handle );
-      return point_of_vertex_attribute(this->template attribute<0>(adart));
-    }
-#endif // CGAL_CMAP_DEPRECATED
-
-    // Temporary methods to allow to write lcc->temp_vertex_attribute
-    // even with the old method. Depending if CGAL_CMAP_DEPRECATED is defined or not
-    // call the static method or the new method. To remove when we remove the
-    // old code.
-    Vertex_attribute_handle temp_vertex_attribute(Dart_handle adart)
-    {return vertex_attribute(adart); }
-    Vertex_attribute_const_handle
-    temp_vertex_attribute(Dart_const_handle adart) const
-    {return vertex_attribute(adart); }
-
-    /** Test if the lcc is valid.
-     * A Linear_cell_complex is valid if it is a valid Combinatorial_map with
-     * an attribute associated to each dart.
-     * @return true iff the map is valid.
-     */
-    bool is_valid() const
-    {
-      bool valid = Base::is_valid();
-      for (typename Dart_range::const_iterator it(this->darts().begin()),
-             itend(this->darts().end()); valid && it != itend; ++it)
-      {
-        if ( vertex_attribute(it)==null_handle )
-        {
-          std::cerr << "Map not valid: dart "<<&(*it)
-                    <<" does not have a vertex."<< std::endl;
-          valid = false;
-        }
-      }
-      return valid;
-    }
-
-    /** validate the lcc
-     */
-    void correct_invalid_attributes()
-    {
-      // Copy of the code in CMap::correct_invalid_attributes() to avoid
-      // 2 iterations through the darts of the map.
-
-      std::vector<size_type> marks(dimension+1);
-      for ( unsigned int i=0; i<=dimension; ++i)
-        marks[i] = Base::INVALID_MARK;
-
-      Helper::template
-        Foreach_enabled_attributes<Reserve_mark_functor<Self> >::
-          run(this,&marks);
-
-      for ( typename Dart_range::iterator it(this->darts().begin()),
-             itend(this->darts().end()); it!=itend; ++it)
-      {
-        Helper::template Foreach_enabled_attributes
-          <internal::Correct_invalid_attributes_functor<Self> >::
-          run(this,it,&marks);
-
-        if ( vertex_attribute(it)==null_handle )
-        {
-          // If a dart don't have a 0-attribute, we create a Point at the origin
-          set_vertex_attribute(it, create_vertex_attribute(CGAL::ORIGIN));
-        }
-      }
-
-      for ( unsigned int i=0; i<=dimension; ++i)
-        if ( marks[i]!=Base::INVALID_MARK )
-        {
-          CGAL_assertion( this->is_whole_map_marked(marks[i]) );
-          free_mark(marks[i]);
-        }
-    }
-
-    /** test if the two given facets have the same geometry
-     * @return true iff the two facets have the same geometry.
-     */
-    bool are_facets_same_geometry(Dart_const_handle d1,
-                                  Dart_const_handle d2) const
-    {
-      typename Base::template Dart_of_orbit_range<1>::const_iterator
-        it1(*this,d1);
-      typename Base::template Dart_of_orbit_range<0>::const_iterator
-        it2(*this,d2);
-      bool samegeometry = true;
-      for ( ; samegeometry && it1.cont() && it2.cont(); ++it1, ++it2)
-      {
-        if ( this->other_extremity(it2)!=null_handle &&
-             point(it1)!=point(this->other_extremity(it2)) )
-          samegeometry = false;
-      }
-      if ( it1.cont() != it2.cont() ) samegeometry = false;
-      return samegeometry;
-    }
-
-    /// Sew3 the marked facets having same geometry
-    /// (a facet is considered marked if one of its dart is marked).
-    unsigned int sew3_same_facets(size_type AMark)
-    {
-      unsigned int res = 0;
-
-      std::map<Point, std::vector<Dart_handle> > one_dart_per_facet;
-      size_type mymark = get_new_mark();
-
-      // First we fill the std::map by one dart per facet, and by using
-      // the minimal point as index.
-      for (typename Dart_range::iterator it(this->darts().begin()),
-             itend(this->darts().end()); it!=itend; ++it )
-      {
-        if ( !this->is_marked(it, mymark) && this->is_marked(it, AMark) )
-        {
-          Point min_point=point(it);
-          Dart_handle min_dart = it;
-          this->mark(it, mymark);
-          typename Base::template
-            Dart_of_orbit_range<1>::iterator it2(*this,it);
-          ++it2;
-          for ( ; it2.cont(); ++it2 )
-          {
-            Point cur_point=point(it2);
-            this->mark(it2, mymark);
-            if ( cur_point < min_point )
-            {
-              min_point = cur_point;
-              min_dart = it2;
-            }
-          }
-          one_dart_per_facet[min_point].push_back(min_dart);
-        }
-        else
-          this->mark(it, mymark);
-      }
-
-      // Second we run through the map: candidates for sew3 have necessary the
-      // same minimal point.
-      typename std::map<Point, std::vector<Dart_handle> >::iterator
-        itmap=one_dart_per_facet.begin(),
-        itmapend=one_dart_per_facet.end();
-
-      for ( ; itmap!=itmapend; ++itmap )
-      {
-        for ( typename std::vector<Dart_handle>::iterator
-                it1=(itmap->second).begin(),
-                it1end=(itmap->second).end(); it1!=it1end; ++it1 )
-        {
-          typename std::vector<Dart_handle>::iterator it2=it1;
-          for ( ++it2; it2!= it1end; ++it2 )
-          {
-            if ( *it1!=*it2 && is_free(*it1, 3) &&
-                 is_free(*it2, 3) &&
-                 are_facets_same_geometry(*it1,beta(*it2, 0)) )
-            {
-              ++res;
-              this->template sew<3>(*it1,beta(*it2, 0));
-            }
-          }
-        }
-      }
-
-      CGAL_assertion( this->is_whole_map_marked(mymark) );
-      this->free_mark(mymark);
-      return res;
-    }
-
-    /// Sew3 the facets having same geometry
-    /// (all the facets of the map are considered)
-    unsigned int sew3_same_facets()
-    {
-      size_type mark = this->get_new_mark();
-      this->negate_mark(mark);
-      unsigned int res=sew3_same_facets(mark);
-      this->free_mark(mark);
-      return res;
-    }
-
-    /** Create an edge given 2 Vertex_attribute_handle.
-     * @param h0 the first vertex handle.
-     * @param h1 the second vertex handle.
-     * @return the dart of the new edge incident to h0.
-     */
-    Dart_handle make_segment(Vertex_attribute_handle h0,
-                             Vertex_attribute_handle h1)
-    {
-      Dart_handle d1 = make_edge(*this);
-      set_vertex_attribute_of_dart(d1,h0);
-      set_vertex_attribute_of_dart(beta(d1, 2),h1);
-
-      return d1;
-    }
-
-    /** Create a segment given 2 points.
-     * @param p0 the first point.
-     * @param p1 the second point.
-     * @return the dart of the new segment incident to p0.
-     */
-    Dart_handle make_segment(const Point& p0,const Point& p1)
-    {
-      return make_segment(create_vertex_attribute(p0),
-                          create_vertex_attribute(p1));
-    }
-
-    /** Create a triangle given 3 Vertex_attribute_handle.
-     * @param h0 the first vertex handle.
-     * @param h1 the second vertex handle.
-     * @param h2 the third vertex handle.
-     * @return the dart of the new triangle incident to h0.
-     */
-    Dart_handle make_triangle(Vertex_attribute_handle h0,
-                              Vertex_attribute_handle h1,
-                              Vertex_attribute_handle h2)
-    {
-      Dart_handle d1 = make_combinatorial_polygon(*this,3);
-
-      set_vertex_attribute_of_dart(d1,h0);
-      set_vertex_attribute_of_dart(beta(d1, 1),h1);
-      set_vertex_attribute_of_dart(beta(d1, 0),h2);
-
-      return d1;
-    }
-
-    /** Create a triangle given 3 points.
-     * @param p0 the first point.
-     * @param p1 the second point.
-     * @param p2 the third point.
-     * @return the dart of the new triangle incident to p0.
-     */
-    Dart_handle make_triangle(const Point& p0,
-                              const Point& p1,
-                              const Point& p2)
-    {
-      return make_triangle(create_vertex_attribute(p0),
-                           create_vertex_attribute(p1),
-                           create_vertex_attribute(p2));
-    }
-
-    /** Create a quadrangle given 4 Vertex_attribute_handle.
-     * @param h0 the first vertex handle.
-     * @param h1 the second vertex handle.
-     * @param h2 the third vertex handle.
-     * @param h3 the fourth vertex handle.
-     * @return the dart of the new quadrilateral incident to h0.
-     */
-    Dart_handle make_quadrangle(Vertex_attribute_handle h0,
-                                Vertex_attribute_handle h1,
-                                Vertex_attribute_handle h2,
-                                Vertex_attribute_handle h3)
-    {
-      Dart_handle d1 = make_combinatorial_polygon(*this,4);
-
-      set_vertex_attribute_of_dart(d1,h0);
-      set_vertex_attribute_of_dart(beta(d1, 1),h1);
-      set_vertex_attribute_of_dart(beta(d1, 1, 1),h2);
-      set_vertex_attribute_of_dart(beta(d1, 0),h3);
-
-      return d1;
-    }
-
-    /** Create a quadrangle given 4 points.
-     * @param p0 the first point.
-     * @param p1 the second point.
-     * @param p2 the third point.
-     * @param p3 the fourth point.
-     * @return the dart of the new quadrangle incident to p0.
-     */
-    Dart_handle make_quadrangle(const Point& p0,
-                                const Point& p1,
-                                const Point& p2,
-                                const Point& p3)
-    {
-      return make_quadrangle(create_vertex_attribute(p0),
-                             create_vertex_attribute(p1),
-                             create_vertex_attribute(p2),
-                             create_vertex_attribute(p3));
-    }
-
-
-    /** Create a tetrahedron given 4 Vertex_attribute_handle.
-     * @param h0 the first vertex handle.
-     * @param h1 the second vertex handle.
-     * @param h2 the third vertex handle.
-     * @param h3 the fourth vertex handle.
-     * @return the dart of the new tetrahedron incident to h0 and to
-     *         facet h0,h1,h2.
-     */
-    Dart_handle make_tetrahedron(Vertex_attribute_handle h0,
-                                 Vertex_attribute_handle h1,
-                                 Vertex_attribute_handle h2,
-                                 Vertex_attribute_handle h3)
-    {
-      Dart_handle d1 = make_triangle(h0, h1, h2);
-      Dart_handle d2 = make_triangle(h1, h0, h3);
-      Dart_handle d3 = make_triangle(h1, h3, h2);
-      Dart_handle d4 = make_triangle(h3, h0, h2);
-
-      return make_combinatorial_tetrahedron(*this, d1, d2, d3, d4);
-    }
-
-    /** Create a tetrahedron given 4 points.
-     * @param p0 the first point.
-     * @param p1 the second point.
-     * @param p2 the third point.
-     * @param p3 the fourth point.
-     * @return the dart of the new tetrahedron incident to p0 and to
-     *         facet p0,p1,p2.
-     */
-    Dart_handle make_tetrahedron(const Point& p0,
-                                 const Point& p1,
-                                 const Point& p2,
-                                 const Point& p3)
-    {
-      return make_tetrahedron(create_vertex_attribute(p0),
-                              create_vertex_attribute(p1),
-                              create_vertex_attribute(p2),
-                              create_vertex_attribute(p3));
-    }
-
-    /** Create an hexahedron given 8 Vertex_attribute_handle.
-     *    (8 vertices, 12 edges and 6 facets)
-     * \verbatim
-     *       4----7
-     *      /|   /|
-     *     5----6 |
-     *     | 3--|-2
-     *     |/   |/
-     *     0----1
-     * \endverbatim
-     * @param h0 the first vertex handle.
-     * @param h1 the second vertex handle.
-     * @param h2 the third vertex handle.
-     * @param h3 the fourth vertex handle.
-     * @param h4 the fifth vertex handle.
-     * @param h5 the sixth vertex handle.
-     * @param h6 the seventh vertex handle.
-     * @param h7 the height vertex handle.
-     * @return the dart of the new hexahedron incident to h0 and to
-     *         the facet (h0,h5,h6,h1).
-     */
-    Dart_handle make_hexahedron(Vertex_attribute_handle h0,
-                                Vertex_attribute_handle h1,
-                                Vertex_attribute_handle h2,
-                                Vertex_attribute_handle h3,
-                                Vertex_attribute_handle h4,
-                                Vertex_attribute_handle h5,
-                                Vertex_attribute_handle h6,
-                                Vertex_attribute_handle h7)
-    {
-      Dart_handle d1 = make_quadrangle(h0, h5, h6, h1);
-      Dart_handle d2 = make_quadrangle(h1, h6, h7, h2);
-      Dart_handle d3 = make_quadrangle(h2, h7, h4, h3);
-      Dart_handle d4 = make_quadrangle(h3, h4, h5, h0);
-      Dart_handle d5 = make_quadrangle(h0, h1, h2, h3);
-      Dart_handle d6 = make_quadrangle(h5, h4, h7, h6);
-
-      return make_combinatorial_hexahedron(*this, d1, d2, d3, d4, d5, d6);
-    }
-
-    /** Create an hexahedron given 8 points.
-     * \verbatim
-     *       4----7
-     *      /|   /|
-     *     5----6 |
-     *     | 3--|-2
-     *     |/   |/
-     *     0----1
-     * \endverbatim
-     * @param p0 the first point.
-     * @param p1 the second point.
-     * @param p2 the third point.
-     * @param p3 the fourth point.
-     * @param p4 the fifth point.
-     * @param p5 the sixth point.
-     * @param p6 the seventh point.
-     * @param p7 the height point.
-     * @return the dart of the new hexahedron incident to p0
-     *         and to the facet (p0,p5,p6,p1).
-     */
-    Dart_handle make_hexahedron(const Point& p0,
-                                const Point& p1,
-                                const Point& p2,
-                                const Point& p3,
-                                const Point& p4,
-                                const Point& p5,
-                                const Point& p6,
-                                const Point& p7)
-    {
-      return make_hexahedron(create_vertex_attribute(p0),
-                             create_vertex_attribute(p1),
-                             create_vertex_attribute(p2),
-                             create_vertex_attribute(p3),
-                             create_vertex_attribute(p4),
-                             create_vertex_attribute(p5),
-                             create_vertex_attribute(p6),
-                             create_vertex_attribute(p7));
-    }
-
-    /** Compute the barycenter of a given cell.
-     * @param adart a dart incident to the cell.
-     * @param adim the dimension of the cell.
-     * @return the barycenter of the cell.
-     */
-    template<unsigned int i>
-    Point barycenter(Dart_const_handle adart) const
-    {
-      return CGAL::Barycenter_functor<Self, i>::run(*this, adart);
-    }
-
-    /** Insert a point in a given 1-cell.
-     * @param dh a dart handle to the 1-cell
-     * @param p the point to insert
-     * @param update_attributes a boolean to update the enabled attributes
-     * @return a dart handle to the new vertex containing p.
-     */
-    Dart_handle insert_point_in_cell_1(Dart_handle dh, const Point& p, bool update_attributes)
-    {
-      return CGAL::insert_cell_0_in_cell_1(*this, dh,
-                                           create_vertex_attribute(p),
-                                           update_attributes);
-    }
-
-    /** Insert a point in a given 2-cell.
-     * @param dh a dart handle to the 2-cell
-     * @param p the point to insert
-     * @param update_attributes a boolean to update the enabled attributes
-     * @return a dart handle to the new vertex containing p.
-     */
-    Dart_handle insert_point_in_cell_2(Dart_handle dh, const Point& p, bool update_attributes)
-    {
-      Vertex_attribute_handle v = create_vertex_attribute(p);
-
-      Dart_handle first = CGAL::insert_cell_0_in_cell_2(*this, dh, v, update_attributes);
-
-      if ( first==null_handle ) // If the triangulated facet was made of one dart
-        erase_vertex_attribute(v);
-
-#ifdef CGAL_CMAP_TEST_VALID_INSERTIONS
-      CGAL_assertion( is_valid() );
-#endif
-
-      return first;
-    }
-
-    /** Insert a point in a given i-cell.
-     * @param dh a dart handle to the i-cell
-     * @param p the point to insert
-     * @param update_attributes a boolean to update the enabled attributes
-     * @return a dart handle to the new vertex containing p.
-     */
-    template <unsigned int i>
-    Dart_handle insert_point_in_cell(Dart_handle dh, const Point& p, bool update_attributes = true)
-    {
-      CGAL_static_assertion(1<=i && i<=2);
-      if (i==1) return insert_point_in_cell_1(dh, p, update_attributes);
-      return insert_point_in_cell_2(dh, p, update_attributes);
-    }
-
-    /** Insert a dangling edge in a given facet.
-     * @param dh a dart of the facet (!=NULL).
-     * @param p the coordinates of the new vertex.
-     * @param update_attributes a boolean to update the enabled attributes
-     * @return a dart of the new edge, incident to the new vertex.
-     */
-    Dart_handle insert_dangling_cell_1_in_cell_2(Dart_handle dh,
-                                                 const Point& p,
-                                                 bool update_attributes = true)
-    {
-      return CGAL::insert_dangling_cell_1_in_cell_2
-          (*this, dh, create_vertex_attribute(p), update_attributes);
-    }
-
-    /** Insert a point in a given i-cell.
-     * @param dh a dart handle to the i-cell
-     * @param p the point to insert
-     * @param update_attributes a boolean to update the enabled attributes
-     * @return a dart handle to the new vertex containing p.
-     */
-    template <unsigned int i>
-    Dart_handle insert_barycenter_in_cell(Dart_handle dh, bool update_attributes = true)
-    { return insert_point_in_cell<i>(dh, barycenter<i>(dh), update_attributes); }
-
-    /** Compute the dual of a Linear_cell_complex.
-     * @param alcc the lcc in which we build the dual of this lcc.
-     * @param adart a dart of the initial lcc, NULL by default.
-     * @return adart of the dual lcc, the dual of adart if adart!=NULL,
-     *         any dart otherwise.
-     * As soon as we don't modify this lcc and alcc lcc, we can iterate
-     * simultaneously through all the darts of the two lcc and we have
-     * each time of the iteration two "dual" darts.
-     */
-    Dart_handle dual_points_at_barycenter(Self & alcc, Dart_handle adart=null_handle)
-    {
-      Dart_handle res = Base::dual(alcc, adart);
-
-      // Now the lcc alcc is topologically correct, we just need to add
-      // its geometry to each vertex (the barycenter of the corresponding
-      // dim-cell in the initial map).
-      typename Dart_range::iterator it2 = alcc.darts().begin();
-      for (typename Dart_range::iterator it(this->darts().begin());
-           it!=this->darts().end(); ++it, ++it2)
-      {
-        if (vertex_attribute(it2)==null_handle)
-        {
-          alcc.set_vertex_attribute(it2, alcc.create_vertex_attribute
-                                    (barycenter<dimension>(it)));
-        }
-      }
-
-      return res;
-    }
-
-    /** Set the status of the managment of the attributes of the CMap
-     */
-    void set_update_attributes(bool newval)
-    {
-      if (this->automatic_attributes_management == false && newval == true)
-      {
-        // We need to recode this function because correct_invalid_attributes
-        // is not a virtual function.
-        correct_invalid_attributes();
-      }
-
-      this->automatic_attributes_management = newval;
-    }
-  };
-
-  // Linear_cell_complex using compact container with handle.
-  // No difference with class Linear_cell_complex_base except the default
-  // template parameters for Refs class.
-  template < unsigned int d_, unsigned int ambient_dim = d_,
-             class Traits_ = Linear_cell_complex_traits<ambient_dim>,
-             class Items_ = Linear_cell_complex_min_items<d_>,
-             class Alloc_ = CGAL_ALLOCATOR(int),
-             template<unsigned int,class,class,class,class>
-             class CMap = Combinatorial_map_base,
-             class Storage_ = Linear_cell_complex_storage_1<d_, ambient_dim,
-                                                            Traits_, Items_,
-                                                            Alloc_> >
-    class Linear_cell_complex: public Linear_cell_complex_base<d_,
-        ambient_dim, Traits_, Items_, Alloc_, CMap,
-        Linear_cell_complex<d_, ambient_dim,
-               Traits_, Items_, Alloc_, CMap, Storage_>,
-        Storage_>
-    {
-    public:
-      typedef Linear_cell_complex<d_, ambient_dim,
-                          Traits_, Items_, Alloc_, CMap, Storage_>  Self;
-
-      typedef Linear_cell_complex_base<d_, ambient_dim,
-                          Traits_, Items_, Alloc_, CMap, Self, Storage_> Base;
-
-      typedef Traits_ Traits;
-      typedef Items_  Items;
-      typedef Alloc_  Alloc;
-
-      static const unsigned int ambient_dimension = Base::ambient_dimension;
-      static const unsigned int dimension = Base::dimension;
-
-      typedef typename Base::Dart_handle       Dart_handle;
-      typedef typename Base::Dart_const_handle Dart_const_handle;
-      typedef typename Base::Helper            Helper;
-
-      typedef typename Base::Point  Point;
-      typedef typename Base::Vector Vector;
-      typedef typename Base::FT     FT;
-
-      typedef typename Base::Dart_range Dart_range;
-
-      typedef typename Base::template Attribute_type<0>::type Vertex_attribute;
-      typedef typename Base::template Attribute_handle<0>::type
-      Vertex_attribute_handle;
-      typedef typename Base::template Attribute_const_handle<0>::type
-      Vertex_attribute_const_handle;
-
-      typedef typename Base::template Attribute_range<0>::type
-      Vertex_attribute_range;
-      typedef typename Base::template Attribute_const_range<0>::type
-      Vertex_attribute_const_range;
-
-      typedef typename Base::size_type size_type;
-
-      typedef typename Base::Use_index Use_index;
-      typedef typename Base::Storage Storage;
-      typedef typename Base::Exception_no_more_available_mark
-      Exception_no_more_available_mark;
-
-      Linear_cell_complex() : Base()
-      {}
-
-      /** Copy the given linear cell complex into *this.
-       *  Note that both LCC can have different dimensions and/or non void attributes.
-       *  @param alcc the linear cell complex to copy.
-       *  @post *this is valid.
-       */
-      Linear_cell_complex(const Self & alcc) : Base()
-      { Base::template copy<Self>(alcc); }
-
-      template < class LCC2 >
-      Linear_cell_complex(const LCC2& alcc)
-      { Base::template copy<LCC2>(alcc);}
-
-      template < class LCC2, typename Converters >
-      Linear_cell_complex(const LCC2& alcc, Converters& converters)
-      { Base::template copy<LCC2, Converters>(alcc, converters);}
-
-      template < class LCC2, typename Converters, typename Pointconverter >
-      Linear_cell_complex(const LCC2& alcc, Converters& converters,
-                                    const Pointconverter& pointconverter)
-      { Base::template copy<LCC2, Converters, Pointconverter>
-            (alcc, converters, pointconverter);}
-
-    };
-
-} // namespace CGAL
-
-#endif // CGAL_LINEAR_CELL_COMPLEX_H //
-// EOF //
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Linear_cell_complex_storages.h b/3rdparty/CGAL-4.8/include/CGAL/Linear_cell_complex_storages.h
deleted file mode 100644
index 0ef557b..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Linear_cell_complex_storages.h
+++ /dev/null
@@ -1,450 +0,0 @@
-// Copyright (c) 2013 CNRS and LIRIS' Establishments (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Guillaume Damiand <guillaume.damiand at liris.cnrs.fr>
-//
-#ifndef CGAL_LINEAR_CELL_COMPLEX_STORAGES_H
-#define CGAL_LINEAR_CELL_COMPLEX_STORAGES_H 1
-
-#include <CGAL/Combinatorial_map_storages.h>
-
-#include <boost/config.hpp>
-#if  (BOOST_GCC >= 50000)
-_Pragma("GCC diagnostic push")
-_Pragma("GCC diagnostic ignored \"-Warray-bounds\"")
-#endif
-
-namespace CGAL {
-
-  /** @file Linear_cell_complex_storages.h
-   * Definition of storages for dD Linear cell complex.
-   */
-
-  // Storage of darts with compact container, beta with handles
-  // Copy of Combinatorial_map_storage_1 and add new types related
-  // to geometry (not possible to inherith because we use Self type
-  // as template parameter of Dart_wrapper. If we inherit, Self is not
-  // the correct type.)
-  template<unsigned int d_, unsigned int ambient_dim,
-           class Traits_, class Items_, class Alloc_ >
-  class Linear_cell_complex_storage_1
-  {
-  public:
-    typedef typename Traits_::Point  Point;
-    typedef typename Traits_::Vector Vector;
-    typedef typename Traits_::FT     FT;
-
-    typedef Linear_cell_complex_storage_1<d_, ambient_dim, Traits_,
-    Items_, Alloc_> Self;
-    typedef CGAL::Tag_false Use_index;
-
-    typedef internal::Combinatorial_map_helper<Self> Helper;
-
-    typedef typename Items_::template Dart_wrapper<Self>  Dart_wrapper;
-    typedef typename Dart_wrapper::Dart                   Dart;
-    typedef typename Alloc_::template rebind<Dart>::other Dart_allocator;
-
-    typedef Compact_container<Dart,Dart_allocator>  Dart_container;
-
-    typedef typename Dart_container::iterator       Dart_handle;
-    typedef typename Dart_container::const_iterator Dart_const_handle;
-    typedef typename Dart_container::size_type      size_type;
-
-    typedef CGAL::Void* Null_handle_type;
-    static Null_handle_type null_handle;
-
-    typedef Items_ Items;
-    typedef Alloc_ Alloc;
-
-    template <typename T>
-    struct Container_for_attributes :
-        public Compact_container<T, typename Alloc_::template rebind<T>::other>
-    {};
-
-    /// Typedef for attributes
-    typedef typename Dart_wrapper::Attributes Attributes;
-
-    template<int i>
-    struct Attribute_type: public Helper::template Attribute_type<i>
-    {};
-    template<int i>
-    struct Attribute_handle: public Helper::template Attribute_handle<i>
-    {};
-    template<int i>
-    struct Attribute_const_handle:
-        public Helper::template Attribute_const_handle<i>
-    {};
-    template<int i>
-    struct Attribute_range: public Helper::template Attribute_range<i>
-    {};
-    template<int i>
-    struct Attribute_const_range:
-        public Helper::template Attribute_const_range<i>
-    {};
-
-    typedef typename Attribute_type<0>::type Vertex_attribute;
-    typedef typename Attribute_handle<0>::type Vertex_attribute_handle;
-    typedef typename Attribute_const_handle<0>::type
-    Vertex_attribute_const_handle;
-
-    typedef typename Attribute_range<0>::type Vertex_attribute_range;
-    typedef typename Attribute_const_range<0>::type
-    Vertex_attribute_const_range;
-
-    /// Number of marks
-    static const size_type NB_MARKS = 32;
-
-    /// The dimension of the combinatorial map.
-    static const unsigned int dimension = d_;
-
-    typedef Handle_hash_function Hash_function;
-
-    // Init
-    void init_storage()
-    {
-#ifdef CGAL_CMAP_DEPRECATED
-      // We must do this ony once, but problem because null_dart_handle
-      // is static !
-      if ( mnull_dart_container.empty() )
-#endif // CGAL_CMAP_DEPRECATED
-      { // emplace null_dart; initialized in Combinatorial_map class
-        null_dart_handle = mnull_dart_container.emplace();
-      }
-    }
-
-    /** Return if this dart is free for adimension.
-       * @param dh a dart handle
-       * @param i the dimension.
-       * @return true iff dh is linked with NULL for \em adimension.
-       */
-    template<unsigned int i>
-    bool is_free(Dart_const_handle dh) const
-    {
-      CGAL_assertion( dh!=NULL );
-      CGAL_assertion(i <= dimension);
-      return dh->mbeta[i]==null_dart_handle;
-    }
-    bool is_free(Dart_const_handle dh, unsigned int i) const
-    {
-      CGAL_assertion( dh!=NULL );
-      CGAL_assertion(i <= dimension);
-      return dh->mbeta[i]==null_dart_handle;
-    }
-
-    /// Set simultaneously all the marks of this dart to a given value.
-    void set_dart_marks(Dart_const_handle ADart,
-                        const std::bitset<NB_MARKS>& amarks) const
-    {
-      CGAL_assertion( ADart!=NULL );
-      ADart->set_marks(amarks);
-    }
-    /// Return all the marks of a dart.
-    std::bitset<NB_MARKS> get_dart_marks(Dart_const_handle ADart) const
-    {
-      CGAL_assertion( ADart!=NULL );
-      return ADart->get_marks();
-    }
-    /// Return the mark value of dart a given mark number.
-    bool get_dart_mark(Dart_const_handle ADart, size_type amark) const
-    {
-      CGAL_assertion( ADart!=NULL );
-      return ADart->get_mark(amark);
-    }
-
-    /// Set the mark of a given mark number to a given value.
-    void set_dart_mark(Dart_const_handle ADart, size_type amark, bool avalue) const
-    {
-      CGAL_assertion( ADart!=NULL );
-      ADart->set_mark(amark, avalue);
-    }
-
-    /// Flip the mark of a given mark number to a given value.
-    void flip_dart_mark(Dart_const_handle ADart, size_type amark) const
-    {
-      CGAL_assertion( ADart!=NULL );
-      ADart->flip_mark(amark);
-    }
-
-    // Access to beta maps
-    Dart_handle get_beta(Dart_handle ADart, int B1)
-    {
-      CGAL_assertion(ADart!=NULL && B1>=0 && B1<=(int)dimension);
-      return ADart->mbeta[B1];
-    }
-    Dart_const_handle get_beta(Dart_const_handle ADart, int B1) const
-    {
-      CGAL_assertion(ADart!=NULL && B1>=0 && B1<=(int)dimension);
-      return  ADart->mbeta[B1];
-    }
-    template<int B1>
-    Dart_handle get_beta(Dart_handle ADart)
-    {
-      CGAL_assertion(ADart!=NULL && B1>=0 && B1<=(int)dimension);
-      return  ADart->mbeta[B1];
-    }
-    template<int B1>
-    Dart_const_handle get_beta(Dart_const_handle ADart) const
-    {
-      CGAL_assertion(ADart!=NULL && B1>=0 && B1<=(int)dimension);
-      return  ADart->mbeta[B1];
-    }
-
-    // return a handle on the i-attribute
-    template<unsigned int i>
-    typename Attribute_handle<i>::type attribute(Dart_handle ADart)
-    {
-      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
-                       "attribute<i> called but i-attributes are disabled.");
-      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
-          (ADart->mattribute_handles);
-    }
-    template<unsigned int i>
-    typename Attribute_const_handle<i>::type
-    attribute(Dart_const_handle ADart) const
-    {
-      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
-                       "attribute<i> called but i-attributes are disabled.");
-      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
-          (ADart->mattribute_handles);
-    }
-
-    // get the attribute given its handle
-    template<unsigned int i>
-    typename Attribute_type<i>::type& get_attribute
-    (typename Attribute_handle<i>::type ah)
-    {
-      CGAL_assertion( ah!=NULL );
-      return *ah;
-    }
-    template<unsigned int i>
-    const typename Attribute_type<i>::type&
-    get_attribute(typename Attribute_const_handle<i>::type ah) const
-    {
-      CGAL_assertion( ah!=NULL );
-      return *ah;
-    }
-
-    Dart & get_dart(Dart_handle ah)
-    {
-      CGAL_assertion( ah!=NULL );
-      return *ah;
-    }
-    const Dart & get_dart(Dart_const_handle ah) const
-    {
-      CGAL_assertion( ah!=NULL );
-      return *ah;
-    }
-
-    // Get the dart of the given attribute
-    template<unsigned int i>
-    Dart_handle dart_of_attribute(typename Attribute_handle<i>::type ah)
-    {
-      CGAL_assertion( ah!=NULL );
-      return ah->dart();
-    }
-    template<unsigned int i>
-    Dart_const_handle dart_of_attribute
-    (typename Attribute_const_handle<i>::type ah) const
-    {
-      CGAL_assertion( ah!=NULL );
-      return ah->dart();
-    }
-
-    // Set the dart of the given attribute
-    template<unsigned int i>
-    void set_dart_of_attribute(typename Attribute_handle<i>::type ah,
-                               Dart_handle adart)
-    {
-      CGAL_assertion( ah!=NULL );
-      ah->set_dart(adart);
-    }
-
-    // Get the info of the given attribute
-    template<unsigned int i>
-    typename Attribute_type<i>::type::Info &
-    info_of_attribute(typename Attribute_handle<i>::type ah)
-    {
-      CGAL_assertion( ah!=NULL );
-      return ah->info();
-    }
-    template<unsigned int i>
-    const typename Attribute_type<i>::type::Info &
-    info_of_attribute(typename Attribute_const_handle<i>::type ah) const
-    {
-      CGAL_assertion( ah!=NULL );
-      return ah->info();
-    }
-
-    // Get the info of the given dart
-    template<unsigned int i>
-    typename Attribute_type<i>::type::Info & info(Dart_handle adart)
-    {
-      CGAL_assertion( adart!=NULL );
-      CGAL_assertion( attribute<i>(adart)!=NULL );
-      return info_of_attribute<i>(attribute<i>(adart));
-    }
-    template<unsigned int i>
-    const typename Attribute_type<i>::type::Info &
-    info(Dart_const_handle adart) const
-    {
-      CGAL_assertion( adart!=NULL );
-      CGAL_assertion( attribute<i>(adart)!=NULL );
-      return info_of_attribute<i>(attribute<i>(adart));
-    }
-
-    // Get the dart of the i-cell attribute associated with the given dart
-    template<unsigned int i>
-    Dart_handle & dart(Dart_handle adart)
-    {
-      CGAL_assertion( adart!=NULL );
-      CGAL_assertion( attribute<i>(adart)!=NULL );
-      return dart_of_attribute<i>(attribute<i>(adart));
-    }
-    template<unsigned int i>
-    Dart_const_handle dart(Dart_const_handle adart) const
-    {
-      CGAL_assertion( adart!=NULL );
-      CGAL_assertion( attribute<i>(adart)!=NULL );
-      return dart_of_attribute<i>(attribute<i>(adart));
-    }
-
-    // Get the dart of the given 0-attribute
-    Point & point_of_vertex_attribute(typename Attribute_handle<0>::type vh)
-    {
-      CGAL_assertion( vh!=NULL );
-      return get_attribute<0>(vh).point();
-    }
-
-    const Point & point_of_vertex_attribute
-    (typename Attribute_const_handle<0>::type vh) const
-    {
-      CGAL_assertion( vh!=NULL );
-      return get_attribute<0>(vh).point();
-    }
-
-    void display_dart(Dart_const_handle ADart) const
-    { std::cout<<&*ADart; }
-
-    template<unsigned int i>
-    void display_attribute(typename Attribute_const_handle<i>::type ah) const
-    { std::cout<<&*ah; }
-
-  protected:
-    // Set the handle on the i th attribute
-    template<unsigned int i>
-    void basic_set_dart_attribute(Dart_handle dh,
-                                  typename Attribute_handle<i>::type ah)
-    {
-      CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
-          (dh->mattribute_handles) = ah;
-    }
-
-    /** Link a dart with a given dart for a given dimension.
-       * @param adart the dart to link.
-       * @param adart2 the dart to link with.
-       * @param i the dimension.
-       */
-    template<unsigned int i>
-    void dart_link_beta(Dart_handle adart, Dart_handle adart2)
-    {
-      CGAL_assertion(i <= dimension);
-      CGAL_assertion(adart!=NULL && adart2!=NULL);
-      CGAL_assertion(adart!=null_dart_handle);
-      adart->mbeta[i] = adart2;
-    }
-    void dart_link_beta(Dart_handle adart, Dart_handle adart2, unsigned int i)
-    {
-      CGAL_assertion(i <= dimension);
-      CGAL_assertion(adart!=NULL && adart2!=NULL);
-      CGAL_assertion(adart!=null_dart_handle);
-      adart->mbeta[i] = adart2;
-    }
-
-    /** Unlink a dart for a given dimension.
-       * @param adart a dart.
-       * @param i the dimension.
-       */
-    template<unsigned int i>
-    void dart_unlink_beta(Dart_handle adart)
-    {
-      CGAL_assertion(adart!=NULL && i <= dimension);
-      adart->mbeta[i] = null_dart_handle;
-    }
-    void dart_unlink_beta(Dart_handle adart, unsigned int i)
-    {
-      CGAL_assertion(adart!=NULL && i <= dimension);
-      adart->mbeta[i] = null_dart_handle;
-    }
-
-  public:
-    /// Void dart. A dart d is i-free if beta_i(d)=null_dart_handle.
-#ifdef CGAL_CMAP_DEPRECATED
-    static
-#endif // CGAL_CMAP_DEPRECATED
-    Dart_handle null_dart_handle; // Todo Dart_const_handle ??
-
-  protected:
-    /// Dart container.
-    Dart_container mdarts;
-
-    /// Container for the null_dart_handle, static data member.
-#ifdef CGAL_CMAP_DEPRECATED
-    static
-#endif // CGAL_CMAP_DEPRECATED
-    Dart_container mnull_dart_container;
-
-    /// Tuple of attributes containers
-    typename Helper::Attribute_containers mattribute_containers;
-  };
-
-  /// null_handle
-  template <unsigned int d_, unsigned int ambient_dim,
-           class Traits_, class Items_, class Alloc_ >
-  typename Linear_cell_complex_storage_1<d_, ambient_dim, Traits_,
-                                         Items_, Alloc_>::Null_handle_type
-  Linear_cell_complex_storage_1<d_, ambient_dim, Traits_,
-                                Items_, Alloc_>::null_handle = NULL;
-
-#ifdef CGAL_CMAP_DEPRECATED
-  /// Allocation of static data members
-  /// mnull_dart_container
-  template <unsigned int d_, unsigned int ambient_dim,
-           class Traits_, class Items_, class Alloc_ >
-  typename Linear_cell_complex_storage_1<d_, ambient_dim, Traits_,
-                                         Items_, Alloc_>::Dart_container
-  Linear_cell_complex_storage_1<d_, ambient_dim, Traits_,
-                                         Items_, Alloc_>::mnull_dart_container;
-
-  /// null_dart_handle
-  template <unsigned int d_, unsigned int ambient_dim,
-           class Traits_, class Items_, class Alloc_ >
-  typename Linear_cell_complex_storage_1<d_, ambient_dim, Traits_,
-                                         Items_, Alloc_>::Dart_handle
-  Linear_cell_complex_storage_1<d_, ambient_dim, Traits_,
-                                         Items_, Alloc_>::null_dart_handle;
-  // =  mnull_dart_container.emplace( std::bitset<NB_MARKS>() );
-  // Does not work on windows => segfault
-  // Thus we initialize null_dart_handle in the Combinatorial_map constructor
-#endif // CGAL_CMAP_DEPRECATED
-
-} // namespace CGAL
-
-#if  (BOOST_GCC >= 50000)
- _Pragma("GCC diagnostic pop")
-#endif
-#endif // CGAL_LINEAR_CELL_COMPLEX_STORAGES_H //
-// EOF //
diff --git a/3rdparty/CGAL-4.8/include/CGAL/MP_Float.h b/3rdparty/CGAL-4.8/include/CGAL/MP_Float.h
deleted file mode 100644
index 0e1312b..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/MP_Float.h
+++ /dev/null
@@ -1,912 +0,0 @@
-// Copyright (c) 2001-2007  INRIA Sophia-Antipolis (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(s)     : Sylvain Pion
-
-#ifndef CGAL_MP_FLOAT_H
-#define CGAL_MP_FLOAT_H
-
-#include <CGAL/number_type_basic.h>
-#include <CGAL/Algebraic_structure_traits.h>
-#include <CGAL/Real_embeddable_traits.h>
-#include <CGAL/Coercion_traits.h>
-#include <CGAL/Quotient.h>
-#include <CGAL/Sqrt_extension.h>
-
-#include <CGAL/utils.h>
-
-#include <CGAL/Interval_nt.h>
-#include <iostream>
-#include <vector>
-#include <algorithm>
-
-// MP_Float : multiprecision scaled integers.
-
-// Some invariants on the internal representation :
-// - zero is represented by an empty vector, and whatever exp.
-// - no leading or trailing zero in the vector => unique
-
-// The main algorithms are :
-// - Addition/Subtraction
-// - Multiplication
-// - Integral division div(), gcd(), operator%().
-// - Comparison
-// - to_double() / to_interval()
-// - Construction from a double.
-// - IOs
-
-// TODO :
-// - The exponent really overflows sometimes -> make it multiprecision.
-// - Write a generic wrapper that adds an exponent to be used by MP integers.
-// - Karatsuba (or other) ?  Would be fun to implement at least.
-// - Division, sqrt... : different options :
-//   - nothing
-//   - convert to double, take approximation, compute over double, reconstruct
-
-namespace CGAL {
-
-class MP_Float;
-
-template < typename > class Quotient; // Needed for overloaded To_double
-
-namespace INTERN_MP_FLOAT {
-
-Comparison_result compare(const MP_Float&, const MP_Float&);
-
-MP_Float square(const MP_Float&);
-
-// to_double() returns, not the closest double, but a one bit error is allowed.
-// We guarantee : to_double(MP_Float(double d)) == d.
-
-double to_double(const MP_Float&);
-
-double to_double(const Quotient<MP_Float>&);
-
-std::pair<double,double> to_interval(const MP_Float &);
-
-std::pair<double,double> to_interval(const Quotient<MP_Float>&);
-
-MP_Float div(const MP_Float& n1, const MP_Float& n2);
-
-MP_Float gcd(const MP_Float& a, const MP_Float& b);
-  
-} //namespace INTERN_MP_FLOAT
-
-std::pair<double, int>
-to_double_exp(const MP_Float &b);
-
-// Returns (first * 2^second), an interval surrounding b.
-std::pair<std::pair<double, double>, int>
-to_interval_exp(const MP_Float &b);
-
-std::ostream &
-operator<< (std::ostream & os, const MP_Float &b);
-
-// This one is for debug.
-std::ostream &
-print (std::ostream & os, const MP_Float &b);
-
-std::istream &
-operator>> (std::istream & is, MP_Float &b);
-
-MP_Float operator+(const MP_Float &a, const MP_Float &b);
-
-MP_Float operator-(const MP_Float &a, const MP_Float &b);
-
-MP_Float operator*(const MP_Float &a, const MP_Float &b);
-
-MP_Float operator%(const MP_Float &a, const MP_Float &b);
-
-
-class MP_Float
-{
-public:
-  typedef short          limb;
-  typedef unsigned short unsigned_limb;
-  typedef int            limb2;
-  typedef double         exponent_type;
-
-  typedef std::vector<limb>  V;
-  typedef V::const_iterator  const_iterator;
-  typedef V::iterator        iterator;
-
-private:
-
-  void remove_leading_zeros()
-  {
-    while (!v.empty() && v.back() == 0)
-      v.pop_back();
-  }
-
-  void remove_trailing_zeros()
-  {
-    if (v.empty() || v.front() != 0)
-      return;
-
-    iterator i = v.begin();
-    for (++i; *i == 0; ++i)
-      ;
-    exp += i-v.begin();
-    v.erase(v.begin(), i);
-  }
-
-  // The constructors from float/double/long_double are factorized in the
-  // following template :
-  template < typename T >
-  void construct_from_builtin_fp_type(T d);
-
-public:
-#ifdef CGAL_ROOT_OF_2_ENABLE_HISTOGRAM_OF_NUMBER_OF_DIGIT_ON_THE_COMPLEX_CONSTRUCTOR
-    int tam() const { return v.size(); }
-#endif
-
-  // Splits a limb2 into 2 limbs (high and low).
-  static
-  void split(limb2 l, limb & high, limb & low)
-  {
-    const unsigned int sizeof_limb=8*sizeof(limb);
-    const limb2 mask = 0x0000ffff;
-   
-    //Note: For Integer type, if the destination type is signed, the value is unchanged 
-    //if it can be represented in the destination type)
-    low=static_cast<limb>(l & mask); //extract low bits from l 
-    high = (l - low) >> sizeof_limb; //extract high bits from l
-    
-    CGAL_postcondition ( l == low + ( static_cast<limb2>(high) << sizeof_limb ) );
-  }
-
-  // Given a limb2, returns the higher limb.
-  static
-  limb higher_limb(limb2 l)
-  {
-      limb high, low;
-      split(l, high, low);
-      return high;
-  }
-
-  void canonicalize()
-  {
-    remove_leading_zeros();
-    remove_trailing_zeros();
-  }
-
-  MP_Float()
-      : exp(0)
-  {
-    CGAL_assertion(sizeof(limb2)==4); // so that the above 0x0000ffff is correct
-    CGAL_assertion(sizeof(limb2) == 2*sizeof(limb));
-    CGAL_assertion(v.empty());
-    // Creates zero.
-  }
-
-#if 0
-  // Causes ambiguities
-  MP_Float(limb i)
-  : v(1,i), exp(0)
-  {
-    remove_leading_zeros();
-  }
-#endif
-
-  MP_Float(limb2 i)
-  : v(2), exp(0)
-  {
-    split(i, v[1], v[0]);
-    canonicalize();
-  }
-
-  MP_Float(float d);
-
-  MP_Float(double d);
-
-  MP_Float(long double d);
-
-  MP_Float operator+() const {
-    return *this;
-  }
-
-  MP_Float operator-() const
-  {
-    return MP_Float() - *this;
-  }
-
-  MP_Float& operator+=(const MP_Float &a) { return *this = *this + a; }
-  MP_Float& operator-=(const MP_Float &a) { return *this = *this - a; }
-  MP_Float& operator*=(const MP_Float &a) { return *this = *this * a; }
-  MP_Float& operator%=(const MP_Float &a) { return *this = *this % a; }
-
-  exponent_type max_exp() const
-  {
-    return v.size() + exp;
-  }
-
-  exponent_type min_exp() const
-  {
-    return exp;
-  }
-
-  limb of_exp(exponent_type i) const
-  {
-    if (i < exp || i >= max_exp())
-      return 0;
-    return v[static_cast<int>(i-exp)];
-  }
-
-  bool is_zero() const
-  {
-    return v.empty();
-  }
-
-  Sign sign() const
-  {
-    if (v.empty())
-      return ZERO;
-    if (v.back()>0)
-      return POSITIVE;
-    CGAL_assertion(v.back()<0);
-    return NEGATIVE;
-  }
-
-  void clear()
-  {
-    v.clear();
-    exp = 0;
-  }
-
-  void swap(MP_Float &m)
-  {
-    std::swap(v, m.v);
-    std::swap(exp, m.exp);
-  }
-
-  // Converts to a rational type (e.g. Gmpq).
-  template < typename T >
-  T to_rational() const
-  {
-    const unsigned log_limb = 8 * sizeof(MP_Float::limb);
-
-    if (is_zero())
-      return 0;
-
-    MP_Float::const_iterator i;
-    exponent_type exp2 = min_exp() * log_limb;
-    T res = 0;
-
-    for (i = v.begin(); i != v.end(); ++i)
-    {
-      res += T(std::ldexp(static_cast<double>(*i),static_cast<int>(exp2)));
-      exp2 += log_limb;
-    }
-
-    return res;
-  }
-
-  std::size_t size() const
-  {
-    return v.size();
-  }
-
-  // Returns a scaling factor (in limbs) which would be good to extract to get
-  // a value with an exponent close to 0.
-  exponent_type find_scale() const
-  {
-    return exp + v.size();
-  }
-
-  // Rescale the value by some factor (in limbs).  (substract the exponent)
-  void rescale(exponent_type scale)
-  {
-    if (v.size() != 0)
-      exp -= scale;
-  }
-
-  // Accessory function that finds the least significant bit set (its position).
-  static unsigned short 
-  lsb(limb l)
-  {
-    unsigned short nb = 0;
-    for (; (l&1)==0; ++nb, l>>=1)
-      ;
-    return nb;
-  }
-
-  // This one is needed for normalizing gcd so that the mantissa is odd
-  // and non-negative, and the exponent is 0.
-  void gcd_normalize()
-  {
-    const unsigned log_limb = 8 * sizeof(MP_Float::limb);
-    if (is_zero())
-      return;
-    // First find how many least significant bits are 0 in the last digit.
-    unsigned short nb = lsb(v[0]);
-    if (nb != 0)
-      *this = *this * (1<<(log_limb-nb));
-    CGAL_assertion((v[0]&1) != 0);
-    exp=0;
-    if (sign() == NEGATIVE)
-      *this = - *this;
-  }
-
-  MP_Float unit_part() const
-  {
-    if (is_zero())
-      return 1;
-    MP_Float r = (sign() > 0) ? *this : - *this;
-    CGAL_assertion(r.v.begin() != r.v.end());
-    unsigned short nb = lsb(r.v[0]);
-    r.v.clear();
-    r.v.push_back(1<<nb);
-    return (sign() > 0) ? r : -r;
-  }
-
-  bool is_integer() const
-  {
-    return is_zero() || (exp >= 0);
-  }
-
-  V v;
-  exponent_type exp;
-};
-
-namespace internal{
-std::pair<MP_Float, MP_Float> // <quotient, remainder>
-division(const MP_Float & n, const MP_Float & d);
-} // namespace internal
-
-inline
-void swap(MP_Float &m, MP_Float &n)
-{ m.swap(n); }
-
-inline
-bool operator<(const MP_Float &a, const MP_Float &b)
-{ return INTERN_MP_FLOAT::compare(a, b) == SMALLER; }
-
-inline
-bool operator>(const MP_Float &a, const MP_Float &b)
-{ return b < a; }
-
-inline
-bool operator>=(const MP_Float &a, const MP_Float &b)
-{ return ! (a < b); }
-
-inline
-bool operator<=(const MP_Float &a, const MP_Float &b)
-{ return ! (a > b); }
-
-inline
-bool operator==(const MP_Float &a, const MP_Float &b)
-{ return (a.v == b.v) && (a.v.empty() || (a.exp == b.exp)); }
-
-inline
-bool operator!=(const MP_Float &a, const MP_Float &b)
-{ return ! (a == b); }
-
-MP_Float
-approximate_sqrt(const MP_Float &d);
-
-MP_Float
-approximate_division(const MP_Float &n, const MP_Float &d);
-
-
-
-// Algebraic structure traits specialization
-template <> class Algebraic_structure_traits< MP_Float >
-  : public Algebraic_structure_traits_base< MP_Float,
-                                            Unique_factorization_domain_tag
-	    // with some work on mod/div it could be Euclidean_ring_tag
-                                          >  {
-  public:
-
-    typedef Tag_true            Is_exact;
-    typedef Tag_true            Is_numerical_sensitive;
-
-    struct Unit_part
-      : public std::unary_function< Type , Type >
-    {
-      Type operator()(const Type &x) const {
-        return x.unit_part();
-      }
-    };
-
-    struct Integral_division
-        : public std::binary_function< Type,
-                                 Type,
-                                 Type > {
-    public:
-        Type operator()(
-                const Type& x,
-                const Type& y ) const {
-            std::pair<MP_Float, MP_Float> res = internal::division(x, y);
-            CGAL_assertion_msg(res.second == 0,
-                "exact_division() called with operands which do not divide");
-            return res.first;
-        }
-    };
-
-
-    class Square
-      : public std::unary_function< Type, Type > {
-      public:
-        Type operator()( const Type& x ) const {
-          return INTERN_MP_FLOAT::square(x);
-        }
-    };
-
-    class Gcd
-      : public std::binary_function< Type, Type,
-                                Type > {
-      public:
-        Type operator()( const Type& x,
-                                        const Type& y ) const {
-          return INTERN_MP_FLOAT::gcd( x, y );
-        }
-    };
-
-    class Div
-      : public std::binary_function< Type, Type,
-                                Type > {
-      public:
-        Type operator()( const Type& x,
-                                        const Type& y ) const {
-          return INTERN_MP_FLOAT::div( x, y );
-        }
-    };
-
-  typedef INTERN_AST::Mod_per_operator< Type > Mod;
-// Default implementation of Divides functor for unique factorization domains
-  // x divides y if gcd(y,x) equals x up to inverses 
-  class Divides 
-    : public std::binary_function<Type,Type,bool>{ 
-  public:
-    bool operator()( const Type& x,  const Type& y) const {  
-      return internal::division(y,x).second == 0 ;
-    }
-    // second operator computing q = x/y 
-    bool operator()( const Type& x,  const Type& y, Type& q) const {    
-      std::pair<Type,Type> qr = internal::division(y,x);
-      q=qr.first;
-      return qr.second == 0;
-      
-    }
-    CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT( Type , bool)
-  };
-};
-
-// Real embeddable traits
-template <> class Real_embeddable_traits< MP_Float >
-  : public INTERN_RET::Real_embeddable_traits_base< MP_Float , CGAL::Tag_true > {
-  public:
-
-    class Sgn
-      : public std::unary_function< Type, ::CGAL::Sign > {
-      public:
-        ::CGAL::Sign operator()( const Type& x ) const {
-          return x.sign();
-        }
-    };
-
-    class Compare
-      : public std::binary_function< Type, Type,
-                                Comparison_result > {
-      public:
-        Comparison_result operator()( const Type& x,
-                                            const Type& y ) const {
-          return INTERN_MP_FLOAT::compare( x, y );
-        }
-    };
-
-    class To_double
-      : public std::unary_function< Type, double > {
-      public:
-        double operator()( const Type& x ) const {
-          return INTERN_MP_FLOAT::to_double( x );
-        }
-    };
-
-    class To_interval
-      : public std::unary_function< Type, std::pair< double, double > > {
-      public:
-        std::pair<double, double> operator()( const Type& x ) const {
-          return INTERN_MP_FLOAT::to_interval( x );
-        }
-    };
-};
-
-
-
-namespace INTERN_MP_FLOAT{
-
-//Sqrt_extension internally uses Algebraic_structure_traits
-template <class ACDE_TAG_, class FP_TAG>  
-double
-to_double(const Sqrt_extension<MP_Float,MP_Float,ACDE_TAG_,FP_TAG> &x)
-{
-  typedef MP_Float RT;
-  typedef Quotient<RT> FT;
-  typedef CGAL::Rational_traits< FT > Rational;
-  Rational r;
-  const RT r1 = r.numerator(x.a0());
-  const RT d1 = r.denominator(x.a0());
-
-  if(x.is_rational()) {
-    std::pair<double, int> n = to_double_exp(r1);
-    std::pair<double, int> d = to_double_exp(d1);
-    double scale = std::ldexp(1.0, n.second - d.second);
-    return (n.first / d.first) * scale;
-  }
-
-  const RT r2 = r.numerator(x.a1());
-  const RT d2 = r.denominator(x.a1());
-  const RT r3 = r.numerator(x.root());
-  const RT d3 = r.denominator(x.root());
-
-  std::pair<double, int> n1 = to_double_exp(r1);
-  std::pair<double, int> v1 = to_double_exp(d1);
-  double scale1 = std::ldexp(1.0, n1.second - v1.second);
-
-  std::pair<double, int> n2 = to_double_exp(r2);
-  std::pair<double, int> v2 = to_double_exp(d2);
-  double scale2 = std::ldexp(1.0, n2.second - v2.second);
-
-  std::pair<double, int> n3 = to_double_exp(r3);
-  std::pair<double, int> v3 = to_double_exp(d3);
-  double scale3 = std::ldexp(1.0, n3.second - v3.second);
-
-  return ((n1.first / v1.first) * scale1) + 
-         ((n2.first / v2.first) * scale2) *
-         std::sqrt((n3.first / v3.first) * scale3);
-}
-
-} //namespace INTERN_MP_FLOAT
-
-
-namespace internal {
-// This compares the absolute values of the odd-mantissa.
-// (take the mantissas, get rid of all powers of 2, compare
-// the absolute values)
-inline
-Sign
-compare_bitlength(const MP_Float &a, const MP_Float &b)
-{
-  if (a.is_zero())
-    return b.is_zero() ? EQUAL : SMALLER;
-  if (b.is_zero())
-    return LARGER;
-
-  //Real_embeddable_traits<MP_Float>::Abs abs;
-
-  MP_Float aa = CGAL_NTS abs(a);
-  MP_Float bb = CGAL_NTS abs(b);
-
-  if (aa.size() > (bb.size() + 2)) return LARGER;
-  if (bb.size() > (aa.size() + 2)) return SMALLER;
-
-  // multiply by 2 till last bit is 1.
-  while (((aa.v[0]) & 1) == 0) // last bit is zero
-    aa = aa + aa;
-
-  while (((bb.v[0]) & 1) == 0) // last bit is zero
-    bb = bb + bb;
-
-  // sizes might have changed
-  if (aa.size() > bb.size()) return LARGER;
-  if (aa.size() < bb.size()) return SMALLER;
-
-  for (std::size_t i = aa.size(); i > 0; --i)
-  {
-    if (aa.v[i-1] > bb.v[i-1]) return LARGER;
-    if (aa.v[i-1] < bb.v[i-1]) return SMALLER;
-  }
-  return EQUAL;
-}
-
-inline // Move it to libCGAL once it's stable.
-std::pair<MP_Float, MP_Float> // <quotient, remainder>
-division(const MP_Float & n, const MP_Float & d)
-{
-  typedef MP_Float::exponent_type  exponent_type;
-
-  MP_Float remainder = n, divisor = d;
-
-  CGAL_precondition(divisor != 0);
-
-  // Rescale d to have a to_double() value with reasonnable exponent.
-  exponent_type scale_d = divisor.find_scale();
-  divisor.rescale(scale_d);
-  const double dd = INTERN_MP_FLOAT::to_double(divisor);
-
-  MP_Float res = 0;
-  exponent_type scale_remainder = 0;
-
-  bool first_time_smaller_than_divisor = true;
-
-  // School division algorithm.
-
-  while ( remainder != 0 )
-  {
-    // We have to rescale, since remainder can diminish towards 0.
-    exponent_type tmp_scale = remainder.find_scale();
-    remainder.rescale(tmp_scale);
-    res.rescale(tmp_scale);
-    scale_remainder += tmp_scale;
-
-    // Compute a double approximation of the quotient
-    // (imagine school division with base ~2^53).
-    double approx = INTERN_MP_FLOAT::to_double(remainder) / dd;
-    CGAL_assertion(approx != 0);
-    res += approx;
-    remainder -= approx * divisor;
-
-    if (remainder == 0)
-      break;
-
-    // Then we need to fix it up by checking if neighboring double values
-    // are closer to the exact result.
-    // There should not be too many iterations, because approx is only a few ulps
-    // away from the optimal.
-    // If we don't do the fixup, then spurious bits can be introduced, which
-    // will require an unbounded amount of additional iterations to be eliminated.
-
-    // The direction towards which we need to try to move from "approx".
-    double direction = (CGAL_NTS sign(remainder) == CGAL_NTS sign(dd))
-                     ?  std::numeric_limits<double>::infinity()
-                     : -std::numeric_limits<double>::infinity();
-
-    while (true)
-    {
-      const double approx2 = nextafter(approx, direction);
-      const double delta = approx2 - approx;
-      MP_Float new_remainder = remainder - delta * divisor;
-      if (CGAL_NTS abs(new_remainder) < CGAL_NTS abs(remainder)) {
-        remainder = new_remainder;
-        res += delta;
-        approx = approx2;
-      }
-      else {
-        break;
-      }
-    }
-
-    if (remainder == 0)
-      break;
-
-    // Test condition for non-exact division (with remainder).
-    if (compare_bitlength(remainder, divisor) == SMALLER)
-    {
-      if (! first_time_smaller_than_divisor)
-      {
-        // Scale back.
-        res.rescale(scale_d - scale_remainder);
-        remainder.rescale(- scale_remainder);
-        CGAL_postcondition(res * d  + remainder == n);
-        return std::make_pair(res, remainder);
-      }
-      first_time_smaller_than_divisor = false;
-    }
-  }
-
-  // Scale back the result.
-  res.rescale(scale_d - scale_remainder);
-  CGAL_postcondition(res * d == n);
-  return std::make_pair(res, MP_Float(0));
-}
-
-inline // Move it to libCGAL once it's stable.
-bool
-divides(const MP_Float & d, const MP_Float & n)
-{
-  return internal::division(n, d).second == 0;
-}
-
-} // namespace internal
-
-inline
-bool
-is_integer(const MP_Float &m)
-{
-  return m.is_integer();
-}
-
-
-
-inline
-MP_Float
-operator%(const MP_Float& n1, const MP_Float& n2)
-{
-  return internal::division(n1, n2).second;
-}
-
-
-// The namespace INTERN_MP_FLOAT contains global functions like square or sqrt
-// which collide with the global functor adapting functions provided by the new
-// AST/RET concept.
-//
-// TODO: IMHO, a better solution would be to put the INTERN_MP_FLOAT-functions
-//       into the MP_Float-class... But there is surely a reason why this is not
-//       the case..?
-
-
-namespace INTERN_MP_FLOAT {
-  inline
-  MP_Float
-  div(const MP_Float& n1, const MP_Float& n2)
-  {
-    return internal::division(n1, n2).first;
-  }
-
-  inline
-  MP_Float
-  gcd( const MP_Float& a, const MP_Float& b)
-  {
-    if (a == 0) {
-      if (b == 0)
-        return 0;
-      MP_Float tmp=b;
-      tmp.gcd_normalize();
-      return tmp;
-    }
-    if (b == 0) {
-      MP_Float tmp=a;
-      tmp.gcd_normalize();
-      return tmp;
-    }
-
-    MP_Float x = a, y = b;
-    while (true) {
-      x = x % y;
-      if (x == 0) {
-        CGAL_postcondition(internal::divides(y, a) & internal::divides(y, b));
-        y.gcd_normalize();
-        return y;
-      }
-      swap(x, y);
-    }
-  }
-
-} // INTERN_MP_FLOAT
-
-
-inline
-void
-simplify_quotient(MP_Float & numerator, MP_Float & denominator)
-{
-  // Currently only simplifies the two exponents.
-#if 0
-  // This better version causes problems as the I/O is changed for
-  // Quotient<MP_Float>, which then does not appear as rational 123/345,
-  // 1.23/3.45, this causes problems in the T2 test-suite (to be investigated).
-  numerator.exp -= denominator.exp
-                    + (MP_Float::exponent_type) denominator.v.size();
-  denominator.exp = - (MP_Float::exponent_type) denominator.v.size();
-#elif 1
-  numerator.exp -= denominator.exp;
-  denominator.exp = 0;
-#else
-  if (numerator != 0 && denominator != 0) {
-    numerator.exp -= denominator.exp;
-    denominator.exp = 0;
-    const MP_Float g = gcd(numerator, denominator);
-    numerator = integral_division(numerator, g);
-    denominator = integral_division(denominator, g);
-  }
-  numerator.exp -= denominator.exp;
-  denominator.exp = 0;
-#endif
-}
-
-inline void simplify_root_of_2(MP_Float &/*a*/, MP_Float &/*b*/, MP_Float&/*c*/) {
-#if 0
-  if(is_zero(a)) {
-  	simplify_quotient(b,c); return;
-  } else if(is_zero(b)) {
-  	simplify_quotient(a,c); return;
-  } else if(is_zero(c)) {
-  	simplify_quotient(a,b); return;
-  }
-  MP_Float::exponent_type va = a.exp +
-    (MP_Float::exponent_type) a.v.size();
-  MP_Float::exponent_type vb = b.exp +
-    (MP_Float::exponent_type) b.v.size();
-  MP_Float::exponent_type vc = c.exp +
-    (MP_Float::exponent_type) c.v.size();
-  MP_Float::exponent_type min = (std::min)((std::min)(va,vb),vc);
-  MP_Float::exponent_type max = (std::max)((std::max)(va,vb),vc);
-  MP_Float::exponent_type med = (min+max)/2.0;
-  a.exp -= med;
-  b.exp -= med;
-  c.exp -= med;
-#endif
-}
-
-namespace internal {
-  inline void simplify_3_exp(int &a, int &b, int &c) {
-    int min = (std::min)((std::min)(a,b),c);
-    int max = (std::max)((std::max)(a,b),c);
-    int med = (min+max)/2;
-    a -= med;
-    b -= med;
-    c -= med;
-  }
-}
-
-
-// specialization of to double functor
-template<>
-class Real_embeddable_traits< Quotient<MP_Float> >
-    : public INTERN_QUOTIENT::Real_embeddable_traits_quotient_base<
-Quotient<MP_Float> >{
-public:
-    struct To_double: public std::unary_function<Quotient<MP_Float>, double>{
-         inline
-         double operator()(const Quotient<MP_Float>& q) const {
-            return INTERN_MP_FLOAT::to_double(q);
-        }
-    };
-    struct To_interval
-        : public std::unary_function<Quotient<MP_Float>, std::pair<double,double> > {
-        inline
-        std::pair<double,double> operator()(const Quotient<MP_Float>& q) const {
-            return INTERN_MP_FLOAT::to_interval(q);
-        }
-    };
-};
-
-inline MP_Float min BOOST_PREVENT_MACRO_SUBSTITUTION(const MP_Float& x,const MP_Float& y){
-  return (x<=y)?x:y; 
-}
-inline MP_Float max BOOST_PREVENT_MACRO_SUBSTITUTION(const MP_Float& x,const MP_Float& y){
-  return (x>=y)?x:y; 
-}
-
-
-// Coercion_traits
-CGAL_DEFINE_COERCION_TRAITS_FOR_SELF(MP_Float)
-CGAL_DEFINE_COERCION_TRAITS_FROM_TO(int, MP_Float)
-
-
-} //namespace CGAL
-
-namespace Eigen {
-  template<class> struct NumTraits;
-  template<> struct NumTraits<CGAL::MP_Float>
-  {
-    typedef CGAL::MP_Float Real;
-    typedef CGAL::Quotient<CGAL::MP_Float> NonInteger;
-    typedef CGAL::MP_Float Nested;
-
-    static inline Real epsilon() { return 0; }
-    static inline Real dummy_precision() { return 0; }
-
-    enum {
-      IsInteger = 1, // Is this lie right?
-      IsSigned = 1,
-      IsComplex = 0,
-      RequireInitialization = 1,
-      ReadCost = 6,
-      AddCost = 40,
-      MulCost = 40
-    };
-  };
-}
-
-#include <CGAL/MP_Float_impl.h>
-
-//specialization for Get_arithmetic_kernel
-#include <CGAL/MP_Float_arithmetic_kernel.h>
-
-#endif // CGAL_MP_FLOAT_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/MP_Float_impl.h b/3rdparty/CGAL-4.8/include/CGAL/MP_Float_impl.h
deleted file mode 100644
index c1f811b..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/MP_Float_impl.h
+++ /dev/null
@@ -1,512 +0,0 @@
-
-// Copyright (c) 2001-2006  INRIA Sophia-Antipolis (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(s)     : Sylvain Pion
-
-#ifndef CGAL_MP_FLOAT_IMPL_H
-#define CGAL_MP_FLOAT_IMPL_H
-
-#include <CGAL/basic.h>
-#include <CGAL/Quotient.h>
-#include <functional>
-#include <cmath>
-#include <CGAL/MP_Float.h>
-
-namespace CGAL {
-
-namespace INTERN_MP_FLOAT {
-const unsigned        log_limb         = 8 * sizeof(MP_Float::limb);
-const MP_Float::limb2 base             = 1 << log_limb;
-const MP_Float::V::size_type limbs_per_double = 2 + 53/log_limb;
-
-const double trunc_max = double(base)*(base/2-1)/double(base-1);
-const double trunc_min = double(-base)*(base/2)/double(base-1);
-} // namespace INTERN_MP_FLOAT
-
-// We face portability issues with the ISO C99 functions "nearbyint",
-// so I re-implement it for my need.
-template < typename T >
-inline 
-int my_nearbyint(const T& d)
-{
-  int z = int(d);
-  T frac = d - z;
-
-  CGAL_assertion(CGAL::abs(frac) < T(1.0));
-
-  if (frac > 0.5)
-    ++z;
-  else if (frac < -0.5)
-    --z;
-  else if (frac == 0.5 && (z&1) != 0) // NB: We also need the round-to-even rule.
-    ++z;
-  else if (frac == -0.5 && (z&1) != 0)
-    --z;
-
-  CGAL_assertion(CGAL::abs(T(z) - d) < T(0.5) ||
-                 (CGAL::abs(T(z) - d) == T(0.5) && ((z&1) == 0)));
-  return z;
-}
-
-
-template < typename T >
-inline
-void MP_Float::construct_from_builtin_fp_type(T d)
-{
-    if (d == 0)
-      return;
-
-    // Protection against rounding mode != nearest, and extended precision.
-    Set_ieee_double_precision P;
-
-    CGAL_assertion(is_finite(d));
-
-    // This is subtle, because ints are not symetric against 0.
-
-    // First, scale d, and adjust exp accordingly.
-    while (d <  INTERN_MP_FLOAT::trunc_min || d >  INTERN_MP_FLOAT::trunc_max) {
-      ++exp;
-      d /=  INTERN_MP_FLOAT::base;
-    }
-
-    while (d >=  INTERN_MP_FLOAT::trunc_min/ INTERN_MP_FLOAT::base && d <=  INTERN_MP_FLOAT::trunc_max/ INTERN_MP_FLOAT::base) {
-      --exp;
-      d *=  INTERN_MP_FLOAT::base;
-    }
-
-    // Then, compute the limbs.
-    // Put them in v (in reverse order temporarily).
-    T orig = d, sum = 0;
-    while (true) {
-      int r = my_nearbyint(d);
-      if (d-r >= T( INTERN_MP_FLOAT::base/2-1)/( INTERN_MP_FLOAT::base-1))
-        ++r;
-      v.push_back(r);
-      // We used to do simply "d -= v.back();", but when the most significant
-      // limb is 1 and the second is -32768, then it can happen that
-      // |d - v.back()| > |d|, hence a bit of precision can be lost.
-      //  Hence the need for sum/orig.
-      sum += v.back();
-      d = orig-sum;
-      if (d == 0)
-        break;
-      sum *=  INTERN_MP_FLOAT::base;
-      orig *=  INTERN_MP_FLOAT::base;
-      d *=  INTERN_MP_FLOAT::base;
-      --exp;
-    }
-
-    // Reverse v.
-    std::reverse(v.begin(), v.end());
-
-    CGAL_assertion(v.back() != 0);
-}
-
-inline
-MP_Float::MP_Float(float d):exp(0)
-{
-    construct_from_builtin_fp_type(d);
-    CGAL_expensive_assertion(CGAL::to_double(*this) == d);
-}
-
-inline
-MP_Float::MP_Float(double d):exp(0)
-{
-    construct_from_builtin_fp_type(d);
-    CGAL_expensive_assertion(CGAL::to_double(*this) == d);
-}
-
-inline
-MP_Float::MP_Float(long double d):exp(0)
-{
-    construct_from_builtin_fp_type(d);
-    // CGAL_expensive_assertion(CGAL::to_double(*this) == d);
-}
-
-inline
-Comparison_result
-INTERN_MP_FLOAT::compare (const MP_Float & a, const MP_Float & b)
-{
-  typedef MP_Float::exponent_type       exponent_type;
-  if (a.is_zero())
-    return (Comparison_result) - b.sign();
-  if (b.is_zero())
-    return (Comparison_result) a.sign();
-
-  for (exponent_type i = (std::max)(a.max_exp(), b.max_exp()) - 1;
-                    i >= (std::min)(a.min_exp(), b.min_exp()); i--)
-  {
-    if (a.of_exp(i) > b.of_exp(i))
-      return LARGER;
-    if (a.of_exp(i) < b.of_exp(i))
-      return SMALLER;
-  }
-  return EQUAL;
-}
-
-// Common code for operator+ and operator-.
-template <class BinOp>
-inline
-MP_Float
-Add_Sub(const MP_Float &a, const MP_Float &b, const BinOp &op)
-{
-  typedef MP_Float::exponent_type       exponent_type;
-  CGAL_assertion(!b.is_zero());
-
-  exponent_type min_exp, max_exp;
-
-  if (a.is_zero()) {
-    min_exp = b.min_exp();
-    max_exp = b.max_exp();
-  }
-  else {
-    min_exp = (std::min)(a.min_exp(), b.min_exp());
-    max_exp = (std::max)(a.max_exp(), b.max_exp());
-  }
-
-  MP_Float r;
-  r.exp = min_exp;
-  r.v.resize(static_cast<int>(max_exp - min_exp + 1)); // One more for carry.
-  r.v[0] = 0;
-  for(int i = 0; i < max_exp - min_exp; i++)
-  {
-    MP_Float::limb2 tmp = r.v[i] + op(a.of_exp(i+min_exp),
-                                      b.of_exp(i+min_exp));
-    MP_Float::split(tmp, r.v[i+1], r.v[i]);
-  }
-  r.canonicalize();
-  return r;
-}
-
-inline
-MP_Float
-operator+(const MP_Float &a, const MP_Float &b)
-{
-  if (a.is_zero())
-    return b;
-  if (b.is_zero())
-    return a;
-
-  return Add_Sub(a, b, std::plus<MP_Float::limb2>());
-}
-
-inline
-MP_Float
-operator-(const MP_Float &a, const MP_Float &b)
-{
-  if (b.is_zero())
-    return a;
-
-  return Add_Sub(a, b, std::minus<MP_Float::limb2>());
-}
-
-inline
-MP_Float
-operator*(const MP_Float &a, const MP_Float &b)
-{
-  if (a.is_zero() || b.is_zero())
-    return MP_Float();
-
-  // Disabled until square() is fixed.
-  // if (&a == &b)
-  //   return square(a);
-
-  MP_Float r;
-  r.exp = a.exp + b.exp;
-  CGAL_assertion_msg(CGAL::abs(r.exp) < (1<<30)*1.0*(1<<23),
-                     "Exponent overflow in MP_Float multiplication");
-  r.v.assign(a.v.size() + b.v.size(), 0);
-  for(unsigned i = 0; i < a.v.size(); ++i)
-  {
-    unsigned j;
-    MP_Float::limb carry = 0;
-    for(j = 0; j < b.v.size(); ++j)
-    {
-      MP_Float::limb2 tmp = carry + (MP_Float::limb2) r.v[i+j]
-                        + std::multiplies<MP_Float::limb2>()(a.v[i], b.v[j]);
-      MP_Float::split(tmp, carry, r.v[i+j]);
-    }
-    r.v[i+j] = carry;
-  }
-  r.canonicalize();
-  return r;
-}
-
-// Squaring simplifies things and is faster, so we specialize it.
-inline
-MP_Float
-INTERN_MP_FLOAT::square(const MP_Float &a)
-{
-  // There is a bug here (see test-case in test/NT/MP_Float.C).
-  // For now, I disable this small optimization.
-  // See also the comment code in operator*().
-  return a*a;
-#if 0
-  typedef MP_Float::limb limb;
-  typedef MP_Float::limb2 limb2;
-
-  if (a.is_zero())
-    return MP_Float();
-
-  MP_Float r;
-  r.exp = 2*a.exp;
-  r.v.assign(2*a.v.size(), 0);
-  for(unsigned i=0; i<a.v.size(); i++)
-  {
-    unsigned j;
-    limb2 carry = 0;
-    limb carry2 = 0;
-    for(j=0; j<i; j++)
-    {
-      // There is a risk of overflow here :(
-      // It can only happen when a.v[i] == a.v[j] == -2^15 (log_limb...)
-      limb2 tmp0 = std::multiplies<limb2>()(a.v[i], a.v[j]);
-      limb2 tmp1 = carry + (limb2) r.v[i+j] + tmp0;
-      limb2 tmp = tmp0 + tmp1;
-
-      limb tmpcarry;
-      MP_Float::split(tmp, tmpcarry, r.v[i+j]);
-      carry = tmpcarry + (limb2) carry2;
-
-      // Is there a more efficient way to handle this carry ?
-      if (tmp > 0 && tmp0 < 0 && tmp1 < 0)
-      {
-        // If my calculations are correct, this case should never happen.
-	CGAL_error();
-      }
-      else if (tmp < 0 && tmp0 > 0 && tmp1 > 0)
-        carry2 = 1;
-      else
-        carry2 = 0;
-    }
-    // last round for j=i :
-    limb2 tmp0 = carry + (limb2) r.v[i+i]
-                       + std::multiplies<limb2>()(a.v[i], a.v[i]);
-    MP_Float::split(tmp0, r.v[i+i+1], r.v[i+i]);
-    r.v[i+i+1] += carry2;
-  }
-  r.canonicalize();
-  return r;
-#endif
-}
-
-// Division by Newton (code by Valentina Marotta & Chee Yap) :
-/*
-Integer reciprocal(const Integer A, Integer k) {
-  Integer t, m, ld;
-  Integer e, X, X1, X2, A1;
-  if (k == 1)
-    return 2;
-
-  A1 = A >> k/2;   // k/2 most significant bits
-  X1 = reciprocal(A1, k/2);
-  // To avoid the adjustment :
-  Integer E = (1 << (2*k - 1)) - A*X1;
-  if (E > A)
-    X1 = X1 + 1;
-
-  e = 1 << 3*k/2; // 2^(3k/2)
-  X2 = X1*e - X1*X1*A;
-  X = X2 >> k-1;
-  return X;
-}
-*/
-
-inline
-MP_Float
-approximate_division(const MP_Float &a, const MP_Float &b)
-{
-  CGAL_assertion_msg(! b.is_zero(), " Division by zero");
-  return MP_Float(CGAL::to_double(a)/CGAL::to_double(b));
-}
-
-inline
-MP_Float
-approximate_sqrt(const MP_Float &d)
-{
-  return MP_Float(CGAL_NTS sqrt(CGAL::to_double(d)));
-}
-
-// Returns (first * 2^second), an approximation of b.
-inline
-std::pair<double, int>
-to_double_exp(const MP_Float &b)
-{
-  typedef MP_Float::exponent_type       exponent_type;
-  if (b.is_zero())
-    return std::make_pair(0.0, 0);
-
-  exponent_type exp = b.max_exp();
-  int steps = static_cast<int>((std::min)( INTERN_MP_FLOAT::limbs_per_double, b.v.size()));
-  double d_exp_1 = std::ldexp(1.0, - static_cast<int>( INTERN_MP_FLOAT::log_limb));
-  double d_exp   = 1.0;
-  double d = 0;
-
-  for (exponent_type i = exp - 1; i > exp - 1 - steps; i--) {
-    d_exp *= d_exp_1;
-    d += d_exp * b.of_exp(i);
-  }
-
-  CGAL_assertion_msg(CGAL::abs(exp* INTERN_MP_FLOAT::log_limb) < (1<<30)*2.0,
-                     "Exponent overflow in MP_Float to_double");
-
-  return std::make_pair(d, static_cast<int>(exp *  INTERN_MP_FLOAT::log_limb));
-}
-
-// Returns (first * 2^second), an interval surrounding b.
-inline
-std::pair<std::pair<double, double>, int>
-to_interval_exp(const MP_Float &b)
-{
-  typedef MP_Float::exponent_type       exponent_type;
-  if (b.is_zero())
-    return std::make_pair(std::pair<double, double>(0, 0), 0);
-
-  exponent_type exp = b.max_exp();
-  int steps = static_cast<int>((std::min)( INTERN_MP_FLOAT::limbs_per_double, b.v.size()));
-  double d_exp_1 = std::ldexp(1.0, - (int)  INTERN_MP_FLOAT::log_limb);
-  double d_exp   = 1.0;
-
-  Interval_nt_advanced::Protector P;
-  Interval_nt_advanced d = 0;
-
-  exponent_type i;
-  for (i = exp - 1; i > exp - 1 - steps; i--) {
-    d_exp *= d_exp_1;
-    if (d_exp == 0) // Take care of underflow.
-      d_exp = CGAL_IA_MIN_DOUBLE;
-    d += d_exp * b.of_exp(i);
-  }
-
-  if (i >= b.min_exp() && d.is_point()) {
-    if (b.of_exp(i) > 0)
-      d += Interval_nt_advanced(0, d_exp);
-    else if (b.of_exp(i) < 0)
-      d += Interval_nt_advanced(-d_exp, 0);
-    else
-      d += Interval_nt_advanced(-d_exp, d_exp);
-  }
-
-#ifdef CGAL_EXPENSIVE_ASSERTION // force it always in early debugging
-  if (d.is_point())
-    CGAL_assertion(MP_Float(d.inf()) == b);
-  else
-    CGAL_assertion(MP_Float(d.inf()) <= b & MP_Float(d.sup()) >= b);
-#endif
-
-  CGAL_assertion_msg(CGAL::abs(exp* INTERN_MP_FLOAT::log_limb) < (1<<30)*2.0,
-                     "Exponent overflow in MP_Float to_interval");
-  return std::make_pair(d.pair(), static_cast<int>(exp *  INTERN_MP_FLOAT::log_limb));
-}
-
-// to_double() returns, not the closest double, but a one bit error is allowed.
-// We guarantee : to_double(MP_Float(double d)) == d.
-inline
-double
-INTERN_MP_FLOAT::to_double(const MP_Float &b)
-{
-  std::pair<double, int> ap = to_double_exp(b);
-  return ap.first * std::ldexp(1.0, ap.second);
-}
-
-inline
-double
-INTERN_MP_FLOAT::to_double(const Quotient<MP_Float> &q)
-{
-    std::pair<double, int> n = to_double_exp(q.numerator());
-    std::pair<double, int> d = to_double_exp(q.denominator());
-    double scale = std::ldexp(1.0, n.second - d.second);
-    return (n.first / d.first) * scale;
-}
-
-// FIXME : This function deserves proper testing...
-inline
-std::pair<double,double>
-INTERN_MP_FLOAT::to_interval(const MP_Float &b)
-{
-  std::pair<std::pair<double, double>, int> ap = to_interval_exp(b);
-  return ldexp(Interval_nt<>(ap.first), ap.second).pair();
-}
-
-// FIXME : This function deserves proper testing...
-inline
-std::pair<double,double>
-INTERN_MP_FLOAT::to_interval(const Quotient<MP_Float> &q)
-{
-  std::pair<std::pair<double, double>, int> n = to_interval_exp(q.numerator());
-  std::pair<std::pair<double, double>, int> d = to_interval_exp(q.denominator());
-  CGAL_assertion_msg(CGAL::abs(1.0*n.second - d.second) < (1<<30)*2.0,
-                     "Exponent overflow in Quotient<MP_Float> to_interval");
-  return ldexp(Interval_nt<>(n.first) / Interval_nt<>(d.first),
-               n.second - d.second).pair();
-}
-
-inline
-std::ostream &
-operator<< (std::ostream & os, const MP_Float &b)
-{
-  os << CGAL::to_double(b);
-  return os;
-}
-
-inline
-std::ostream &
-print (std::ostream & os, const MP_Float &b)
-{
-  typedef MP_Float::exponent_type       exponent_type;
-  // Binary format would be nice and not hard to have too (useful ?).
-  if (b.is_zero())
-    return os << 0 << " [ double approx == " << 0.0 << " ]";
-
-  MP_Float::const_iterator i;
-  exponent_type exp = b.min_exp() *  INTERN_MP_FLOAT::log_limb;
-  double approx = 0; // only for giving an idea.
-
-  for (i = b.v.begin(); i != b.v.end(); i++)
-  {
-    os << ((*i > 0) ? " +" : " ") << *i;
-
-    if (exp != 0)
-      os << " * 2^" << exp;
-
-    approx += std::ldexp(static_cast<double>(*i),
-                                   static_cast<int>(exp));
-
-    exp +=  INTERN_MP_FLOAT::log_limb;
-  }
-
-  os << "  [ double approx == " << approx << " ]";
-
-  return os;
-}
-
-inline
-std::istream &
-operator>> (std::istream & is, MP_Float &b)
-{
-  double d;
-  is >> d;
-  if (is)
-    b = MP_Float(d);
-  return is;
-}
-
-} //namespace CGAL
-
-#endif // CGAL_MP_FLOAT_IMPL_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Manhattan_distance_iso_box_point.h b/3rdparty/CGAL-4.8/include/CGAL/Manhattan_distance_iso_box_point.h
deleted file mode 100644
index d2eb7d8..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Manhattan_distance_iso_box_point.h
+++ /dev/null
@@ -1,173 +0,0 @@
-// Copyright (c) 2002,2011 Utrecht University (The Netherlands).
-// 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
-// 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(s)     : Hans Tangelder (<hanst at cs.uu.nl>)
-
-
-#ifndef CGAL_MANHATTAN_DISTANCE_ISO_BOX_POINT_H
-#define CGAL_MANHATTAN_DISTANCE_ISO_BOX_POINT_H
-
-#include <CGAL/result_of.h>
-#include <CGAL/Kd_tree_rectangle.h>
-#include <CGAL/internal/Get_dimension_tag.h>
-
-namespace CGAL {
-
-  template <class SearchTraits>
-  class Manhattan_distance_iso_box_point {
-    SearchTraits traits;
-  public:
-
-    typedef typename SearchTraits::Point_d Point_d;
-    typedef typename SearchTraits::Iso_box_d Iso_box_d;
-    typedef typename SearchTraits::FT    FT;
-    typedef Iso_box_d                  Query_item;
-    typedef typename internal::Get_dimension_tag<SearchTraits>::Dimension Dimension;
-    typedef typename CGAL::cpp11::result_of<typename SearchTraits::Construct_max_vertex_d(Query_item)>::type Max_vertex;
-    
-    Manhattan_distance_iso_box_point(const SearchTraits& traits_=SearchTraits()):traits(traits_) {}
-      
-    
-    // obsolete as we no longer store dimension Manhattan_distance_iso_box_point(const int d) : the_dimension(d) {}
-
-    inline FT transformed_distance(const Query_item& q, const Point_d& p) const {
-		FT distance = FT(0);
-		typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=
-                  traits.construct_cartesian_const_iterator_d_object();
-		typename SearchTraits::Construct_min_vertex_d construct_min_vertex;
-		typename SearchTraits::Construct_max_vertex_d construct_max_vertex;
-                Max_vertex maxv = construct_max_vertex(q);
-                typename SearchTraits::Cartesian_const_iterator_d qmaxit = construct_it(maxv),
-		  qe = construct_it(maxv,1), qminit = construct_it(construct_min_vertex(q)),
-		  pit = construct_it(p);
-		for (; qmaxit != qe; ++pit,++qmaxit,++qminit) {
-			if ((*pit)>(*qmaxit)) distance += 
-			(*pit)-(*qmaxit); 
-			else if ((*pit)<(*qminit)) distance += 
-			(*qminit)-(*pit);	
-		}
-        	return distance;
-    }
-
-
-    inline FT min_distance_to_rectangle(const Query_item& q,
-					      const Kd_tree_rectangle<FT,Dimension>& r) const {
-		FT distance = FT(0);
-		typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=
-                  traits.construct_cartesian_const_iterator_d_object();
-		typename SearchTraits::Construct_min_vertex_d construct_min_vertex;
-		typename SearchTraits::Construct_max_vertex_d construct_max_vertex;
-                Max_vertex maxv = construct_max_vertex(q);
-                typename SearchTraits::Cartesian_const_iterator_d qmaxit = construct_it(maxv),
-		  qe = construct_it(maxv,1), qminit = construct_it(construct_min_vertex(q));
-		for (unsigned int i = 0; qmaxit != qe; ++ qmaxit, ++qminit, ++i)  {
-			if (r.min_coord(i)>(*qmaxit)) 
-			  distance +=(r.min_coord(i)-(*qmaxit)); 
-			if (r.max_coord(i)<(*qminit)) 
-			  distance += ((*qminit)-r.max_coord(i));
-	        }
-		return distance;
-	}
-
-     inline FT min_distance_to_rectangle(const Query_item& q,
-					      const Kd_tree_rectangle<FT,Dimension>& r,std::vector<FT>& dists) {
-		FT distance = FT(0);
-		typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=
-                  traits.construct_cartesian_const_iterator_d_object();
-		typename SearchTraits::Construct_min_vertex_d construct_min_vertex;
-		typename SearchTraits::Construct_max_vertex_d construct_max_vertex;
-                Max_vertex maxv = construct_max_vertex(q);
-                typename SearchTraits::Cartesian_const_iterator_d qmaxit = construct_it(maxv),
-		  qe = construct_it(maxv,1), qminit = construct_it(construct_min_vertex(q));
-		for (unsigned int i = 0; qmaxit != qe; ++ qmaxit, ++qminit, ++i)  {
-			if (r.min_coord(i)>(*qmaxit)) {
-                          dists[i]=(r.min_coord(i)-(*qmaxit)); 
-			  distance +=dists[i];
-                        }
-			if (r.max_coord(i)<(*qminit)) {
-                          dists[i]=((*qminit)-r.max_coord(i));
-			  distance += dists[i];
-                        }
-	        }
-		return distance;
-	}
-
-    inline 
-    FT 
-    max_distance_to_rectangle(const Query_item& q,
-			      const Kd_tree_rectangle<FT,Dimension>& r) const {
-      FT distance=FT(0);
-      typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=
-        traits.construct_cartesian_const_iterator_d_object();
-      typename SearchTraits::Construct_min_vertex_d construct_min_vertex;
-      typename SearchTraits::Construct_max_vertex_d construct_max_vertex;
-      Max_vertex maxv = construct_max_vertex(q);
-      typename SearchTraits::Cartesian_const_iterator_d qmaxit = construct_it(maxv),
-	qe = construct_it(maxv,1), qminit = construct_it(construct_min_vertex(q));
-      for (unsigned int i = 0; qmaxit != qe; ++ qmaxit, ++qminit, ++i)  {
-	if ( r.max_coord(i)-(*qminit) >(*qmaxit)-r.min_coord(i) )  
-	  distance += (r.max_coord(i)-(*qminit));
-	else 
-	  distance += ((*qmaxit)-r.min_coord(i));
-      }
-      return distance;
-    }
-
-     inline 
-    FT 
-    max_distance_to_rectangle(const Query_item& q,
-			      const Kd_tree_rectangle<FT,Dimension>& r,std::vector<FT>& dists) {
-      FT distance=FT(0);
-      typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=
-        traits.construct_cartesian_const_iterator_d_object();
-      typename SearchTraits::Construct_min_vertex_d construct_min_vertex;
-      typename SearchTraits::Construct_max_vertex_d construct_max_vertex;
-      Max_vertex maxv = construct_max_vertex(q);
-      typename SearchTraits::Cartesian_const_iterator_d qmaxit = construct_it(maxv),
-	qe = construct_it(maxv,1), qminit = construct_it(construct_min_vertex(q));
-      for (unsigned int i = 0; qmaxit != qe; ++ qmaxit, ++qminit, ++i)  {
-	if ( r.max_coord(i)-(*qminit) >(*qmaxit)-r.min_coord(i) )  {
-          dists[i]=(r.max_coord(i)-(*qminit));
-	  distance += dists[i];
-        }
-	else {
-          dists[i]=((*qmaxit)-r.min_coord(i));
-	  distance += dists[i];
-        }
-      }
-      return distance;
-    }
-	
-  inline 
-  FT 
-  transformed_distance(FT d) const
-  {
-    return d;
-  }
-
-  inline 
-  FT 
-  inverse_of_transformed_distance(FT d) const
-  {
-    return d;
-  }
-
-}; // class Manhattan_distance_iso_box_point
-
-} // namespace CGAL
-#endif // MANHATTAN_DISTANCE_ISO_BOX_POINT_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mean_curvature_flow_skeletonization.h b/3rdparty/CGAL-4.8/include/CGAL/Mean_curvature_flow_skeletonization.h
deleted file mode 100644
index 1fcecad..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Mean_curvature_flow_skeletonization.h
+++ /dev/null
@@ -1,1438 +0,0 @@
-// Copyright (c) 2013  GeometryFactory (France). All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Xiang Gao <gaox at ethz.ch>
-//
-
-#ifndef CGAL_MEAN_CURVATURE_FLOW_SKELETONIZATION_H
-#define CGAL_MEAN_CURVATURE_FLOW_SKELETONIZATION_H
-
-#include <CGAL/trace.h>
-#include <CGAL/Timer.h>
-#include <CGAL/Default.h>
-
-#include <CGAL/Polyhedron_3.h>
-#include <CGAL/Polyhedron_items_with_id_3.h>
-#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
-#include <CGAL/FaceGraph_to_Polyhedron_3.h>
-
-#include <boost/graph/graph_traits.hpp>
-#include <boost/graph/adjacency_list.hpp>
-#include <boost/graph/copy.hpp>
-
-#include <boost/iterator/transform_iterator.hpp>
-#include <boost/foreach.hpp>
-
-#include <CGAL/boost/graph/iterator.h>
-
-// Compute cotangent Laplacian
-#include <CGAL/Polygon_mesh_processing/Weights.h>
-
-// Compute the vertex normal
-#include <CGAL/internal/Surface_mesh_skeletonization/get_normal.h>
-
-// Simplification function
-#include <CGAL/boost/graph/Euler_operations.h>
-
-// Curve skeleton data structure
-#include <CGAL/internal/Surface_mesh_skeletonization/Curve_skeleton.h>
-
-// For Voronoi diagram
-#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
-#include <CGAL/Delaunay_triangulation_3.h>
-#include <CGAL/Triangulation_vertex_base_with_info_3.h>
-
-// For debugging macro
-#include <CGAL/internal/Surface_mesh_skeletonization/Debug.h>
-
-// Some helper functions
-#include <CGAL/Polygon_mesh_processing/measure.h>
-
-// For detect_degenarcy
-#include <CGAL/internal/Surface_mesh_skeletonization/Detect_degeneracy.h>
-
-// Inside mesh test
-#include <CGAL/Side_of_triangle_mesh.h>
-
-// Compute bounding box
-#include <CGAL/Bbox_3.h>
-
-#include <queue>
-
-// for default parameters
-#if defined(CGAL_EIGEN3_ENABLED)
-#include <CGAL/Eigen_solver_traits.h>  // for sparse linear system solver
-// #include <Eigen/CholmodSupport>
-#endif
-
-namespace CGAL {
-
-namespace internal{
-
-template < class Refs, class Point, class ID, class vertex_descriptor>
-struct Skel_HDS_vertex_type : public HalfedgeDS_vertex_max_base_with_id<Refs, Point, ID>
-{
-  typedef HalfedgeDS_vertex_max_base_with_id<Refs, Point, ID> Base;
-  Skel_HDS_vertex_type() : Base (), is_fixed(false)  {}
-  Skel_HDS_vertex_type( Point const& p) : Base(p), is_fixed(false) {}
-  std::vector<vertex_descriptor> vertices;
-  Point pole;
-  bool is_fixed;
-};
-
-template <class vertex_descriptor>
-struct Skel_polyhedron_items_3: CGAL::Polyhedron_items_with_id_3 {
-    template < class Refs, class Traits>
-    struct Vertex_wrapper {
-        typedef typename Traits::Point_3 Point;
-      typedef Skel_HDS_vertex_type< Refs, Point, std::size_t, vertex_descriptor> Vertex;
-    };
-};
-
-} //end of namespace internal
-
-
-/// \ingroup PkgMeanCurvatureSkeleton3
-/// Function object that enables to extract the mean curvature
-/// flow skeleton of a triangulated surface mesh.
-///
-/// The algorithm used takes as input a triangulated surface mesh and iteratively contracts the surface mesh
-/// following the mean curvature flow \cgalCite{tagliasacchi2012mean}. The intermediate contracted surface
-/// mesh is called the <em>meso-skeleton</em>.
-/// After each iteration, the meso-skeleton is locally remeshed using angle split and edge contraction.
-/// The process ends when the modification of the meso-skeleton between two iterations is small.
-///
-/// @tparam TriangleMesh
-///         a model of `FaceListGraph`
-///
-/// @tparam Traits
-///         a model of `MeanCurvatureSkeletonizationTraits`<br>
-///         <b>%Default:</b>
-/// \code
-///     CGAL::Kernel_traits<
-///       boost::property_traits<
-///          boost::property_map<TriangleMesh, CGAL::vertex_point_t>::type
-///        >::value_type
-///      >::Kernel
-/// \endcode
-///
-/// @tparam VertexPointMap
-///         a model of `ReadWritePropertyMap`
-///         with `boost::graph_traits<TriangleMesh>::%vertex_descriptor` as key and
-///         `Traits::Point_3` as value type.<br>
-///         <b>%Default:</b>
-/// \code
-///   boost::property_map<TriangleMesh, CGAL::vertex_point_t>::const_type.
-/// \endcode
-///
-/// @tparam SolverTraits_
-///         a model of `NormalEquationSparseLinearAlgebraTraits_d`.<br>
-///         <b>%Default:</b> If \ref thirdpartyEigen "Eigen" 3.2 (or greater) is available
-///         and `CGAL_EIGEN3_ENABLED` is defined, then an overload of `Eigen_solver_traits` is provided as default parameter:
-/// \code
-///      CGAL::Eigen_solver_traits<
-///        Eigen::SimplicialLDLT< Eigen::SparseMatrix<double> >
-///      >
-/// \endcode
-///
-/// @cond CGAL_DOCUMENT_INTERNAL
-/// @tparam Degeneracy_algorithm_tag
-///         tag for selecting the degeneracy detection algorithm
-/// @endcond
-template <class TriangleMesh,
-          class Traits_ = Default,
-          class VertexPointMap_ = Default,
-          class SolverTraits_ = Default>
-class Mean_curvature_flow_skeletonization
-{
-// Public types
-public:
-
-/// \name Types
-/// @{
-  // Template parameters
-  #ifndef DOXYGEN_RUNNING
-  typedef typename Default::Get<
-    VertexPointMap_,
-    typename boost::property_map<TriangleMesh, CGAL::vertex_point_t>::const_type
-  >::type VertexPointMap;
-
-  typedef typename Default::Get<
-    Traits_,
-    typename Kernel_traits<typename boost::property_traits<typename boost::property_map<TriangleMesh, CGAL::vertex_point_t>::type>::value_type>::Kernel
-  >::type Traits;
-  #endif
-
-  #ifndef DOXYGEN_RUNNING
-  typedef typename Default::Get<
-    SolverTraits_,
-  #if defined(CGAL_EIGEN3_ENABLED)
-      CGAL::Eigen_solver_traits<
-        Eigen::SimplicialLDLT< Eigen::SparseMatrix<double> >
-//        Eigen::CholmodDecomposition< Eigen::SparseMatrix<double> >
-      >
-  #else
-    SolverTraits_ // no parameter provided, and Eigen is not enabled: so don't compile!
-  #endif
-  >::type SolverTraits;
-  #endif
-
-  /// @cond CGAL_DOCUMENT_INTERNAL
-  typedef typename Traits::Point_3                                             Point;
-  typedef typename Traits::Vector_3                                             Vector;
-
-  typedef typename boost::graph_traits<TriangleMesh>::vertex_descriptor  Input_vertex_descriptor;
-  typedef CGAL::Polyhedron_3<Traits,internal::Skel_polyhedron_items_3<Input_vertex_descriptor> > mTriangleMesh;
-  typedef typename boost::property_map<mTriangleMesh, CGAL::vertex_point_t>::type mVertexPointMap;
-  typedef typename boost::property_map<mTriangleMesh, boost::vertex_index_t>::type VertexIndexMap;
-  typedef typename boost::property_map<mTriangleMesh, boost::halfedge_index_t>::type HalfedgeIndexMap;
-
-
-  struct Vmap {
-    Point point;
-    std::vector<Input_vertex_descriptor> vertices;
-  };
-  ///@endcond
-
-  /// The graph type representing the skeleton. The vertex property
-  /// `Vmap` is a struct with a member `point` of type `Traits::Point_3`
-  /// and a member `vertices` of type
-  /// `std::vector<boost::graph_traits<TriangleMesh>::%vertex_descriptor>`.
-  /// See  <a href="http://www.boost.org/doc/libs/release/libs/graph/doc/adjacency_list.html"><tt>the boost documentation</tt></a> page for more details
-  typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, Vmap> Skeleton;
-
-
-/// @}
-
-  // Repeat mTriangleMesh types
-  typedef typename boost::graph_traits<mTriangleMesh>::vertex_descriptor       vertex_descriptor;
-  typedef typename boost::graph_traits<mTriangleMesh>::halfedge_descriptor     halfedge_descriptor;
-  typedef typename boost::graph_traits<mTriangleMesh>::vertex_iterator         vertex_iterator;
-  typedef typename boost::graph_traits<mTriangleMesh>::edge_descriptor         edge_descriptor;
-  typedef typename boost::graph_traits<mTriangleMesh>::edge_iterator           edge_iterator;
-
-  // Cotangent weight calculator
-  typedef internal::Cotangent_weight<mTriangleMesh,
-    typename boost::property_map<mTriangleMesh, vertex_point_t>::type,
-    internal::Cotangent_value_minimum_zero<mTriangleMesh,
-      typename boost::property_map<mTriangleMesh, vertex_point_t>::type,
-      internal::Cotangent_value_Meyer_secure<mTriangleMesh> > >                Weight_calculator;
-
-  typedef internal::Curve_skeleton<mTriangleMesh,
-                                   VertexIndexMap,
-                                   HalfedgeIndexMap,
-                                   mVertexPointMap>                            Curve_skeleton;
-
-  // Repeat Triangulation types
-  typedef CGAL::Exact_predicates_exact_constructions_kernel                    Exact_kernel;
-  typedef CGAL::Triangulation_vertex_base_with_info_3
-                                            <vertex_descriptor, Exact_kernel>  Vb;
-  typedef CGAL::Triangulation_data_structure_3<Vb>                             Tds;
-  typedef CGAL::Delaunay_triangulation_3<Exact_kernel, Tds>                    Delaunay;
-  typedef typename Delaunay::Point                                             Exact_point;
-  typedef typename Delaunay::Cell_handle                                       Cell_handle;
-  typedef typename Delaunay::Vertex_handle                                     TriVertex_handle;
-  typedef typename Delaunay::Finite_cells_iterator                             Finite_cells_iterator;
-
-// Data members
-private:
-
-  /** The meso-skeleton */
-  mTriangleMesh m_tmesh;
-
-  /** Storing indices of all vertices. */
-  VertexIndexMap m_vertex_id_pmap;
-  /** Storing indices of all edges. */
-  HalfedgeIndexMap m_hedge_id_pmap;
-  /** Storing the point for mTriangleMesh vertex_descriptor. */
-  mVertexPointMap m_tmesh_point_pmap;
-  /** Traits class. */
-  Traits m_traits;
-
-  /** Controling the velocity of movement and approximation quality. */
-  double m_omega_H;
-  /** Controling the smoothness of the medial approximation. */
-  double m_omega_P;
-  /** Edges with length less than `min_edge_length` will be collapsed. */
-  double m_min_edge_length;
-  /** Triangles with angle greater than `alpha_TH` will be split. */
-  double m_alpha_TH;
-  /** Value very close to zero. */
-  double m_zero_TH;
-  /** `contract_until_convergence` will stop if the change of area in one iteration
-   *  is less than `delta_area`. */
-  double m_delta_area;
-  /** Surface area of original surface mesh. */
-  double m_original_area;
-  /** Maximum number of iterations. */
-  std::size_t m_max_iterations;
-  /** Should the skeleton be medially centered? */
-  bool m_is_medially_centered;
-  /** Are poles computed? */
-  bool m_are_poles_computed;
-
-  /** Cotangent weight calculator. */
-  Weight_calculator m_weight_calculator;
-  /** Storing the weights for edges. */
-  std::vector<double> m_edge_weight;
-  /** The sparse solver. */
-  SolverTraits m_solver;
-
-  /** Assign a unique id to a new vertex. */
-  int m_vertex_id_count;
-  /** The maximum id for original surface. vertices with ids
-   *  greater than `m_max_id` are created during split,
-   *  thus will not be considered in correspondence tracking. */
-  int m_max_id;
-  /** Used when assembling the matrix. */
-  std::map<int, int> m_new_id;
-
-  /** The incident angle for a halfedge. */
-  std::vector<double> m_halfedge_angle;
-
-  /** The normal of surface points. */
-  std::vector<Vector> m_normals;
-
-
-// Private functions and classes
-
-struct Vertex_to_point{
-  mVertexPointMap ppmap;
-  Vertex_to_point(mVertexPointMap ppmap): ppmap(ppmap){}
-  typedef typename boost::property_traits<mVertexPointMap>::reference result_type;
-  result_type
-  operator()(vertex_descriptor vd) const{
-    return get(ppmap, vd);
-  }
-};
-
-double diagonal_length(const Bbox_3& bbox)
-{
-  double dx = bbox.xmax() - bbox.xmin();
-  double dy = bbox.ymax() - bbox.ymin();
-  double dz = bbox.zmax() - bbox.zmin();
-
-  double diag = dx * dx + dy * dy + dz * dz;
-  return std::sqrt(diag);
-}
-
-
-double init_min_edge_length()
-{
-  vertex_iterator vb, ve;
-  boost::tie(vb, ve) = vertices(m_tmesh);
-  Vertex_to_point v_to_p(m_tmesh_point_pmap);
-  Bbox_3 bbox = CGAL::bbox_3(boost::make_transform_iterator(vb, v_to_p),
-                             boost::make_transform_iterator(ve, v_to_p));
-  return 0.002 * diagonal_length(bbox);
-}
-
-std::size_t collapse_short_edges();
-// Public methods
-public:
-
-  /// \name Constructor
-  ///@{
-  #ifdef DOXYGEN_RUNNING
-  /**
-   * The constructor of a skeletonization object.
-   *
-   * The algorithm parameters are initialized such that:
-   * - `max_triangle_angle() == 110`
-   * - `quality_speed_tradeoff() == 0.1`
-   * - `medially_centered_speed_tradeoff() == 0.2`
-   * - `area_variation_factor() == 0.0001`
-   * - `max_iterations() == 500`
-   * - `is_medially_centered() == true`
-   * - `min_edge_length()` == 0.002 * the length of the diagonal of the bounding box of `tmesh`
-   *
-   * @pre `tmesh` is a triangulated surface mesh without borders and has exactly one connected component.
-   * @param tmesh
-   *        input triangulated surface mesh.
-   * @param vertex_point_map
-   *        property map which associates a point to each vertex of the graph.
-   * @param traits
-   *        an instance of the traits class.
-   */
-  Mean_curvature_flow_skeletonization(const TriangleMesh& tmesh,
-                                      VertexPointMap vertex_point_map = get(CGAL::vertex_point, tmesh),
-                                      Traits traits = Traits());
-
-  #else
-
-  Mean_curvature_flow_skeletonization(const TriangleMesh& tmesh,
-                                      VertexPointMap vertex_point_map,
-                                      const Traits& traits = Traits())
-    : m_traits(traits), m_weight_calculator(m_tmesh)
-  {
-    init(tmesh, vertex_point_map);
-  }
-
-  Mean_curvature_flow_skeletonization(const TriangleMesh& tmesh,
-                                      const Traits& traits = Traits())
-    : m_traits(traits), m_weight_calculator(m_tmesh)
-  {
-    init(tmesh, get(vertex_point, tmesh));
-  }
-  #endif
-  /// @} Constructor
-
-  /// \name Local Remeshing Parameters
-  /// @{
-
-  /// During the local remeshing step, a triangle will be split
-  /// if it has an angle larger than `max_triangle_angle()`.
-  double max_triangle_angle()
-  {
-    return m_alpha_TH;
-  }
-
-  /// During the local remeshing step, an edge will be collapse
-  /// if it is length is less than `min_edge_length()`.
-  double min_edge_length()
-  {
-    return m_min_edge_length;
-  }
-
- void set_max_triangle_angle(double value)
-  {
-    m_alpha_TH = value;
-  }
-
-  void set_min_edge_length(double value)
-  {
-    m_min_edge_length = value;
-  }
-  /// @}
-
-  /// \name Algorithm Termination Parameters
-  /// @{
-
-  /// Maximum number of iterations performed by `contract_until_convergence()`.
-  std::size_t max_iterations()
-  {
-    return m_max_iterations;
-  }
-
-  /// The convergence is considered to be reached if the variation of the area of
-  /// the meso-skeleton after one iteration is smaller than
-  /// `area_variation_factor()*original_area` where `original_area` is the area of the input
-  /// triangle mesh.
-  double area_variation_factor()
-  {
-    return m_delta_area;
-  }
-
-  void set_max_iterations(std::size_t value)
-  {
-    m_max_iterations = value;
-  }
-
-  void set_area_variation_factor(double value)
-  {
-    m_delta_area = value;
-  }
-  /// @}
-
-  /// \name Vertex Motion Parameters
-  /// @{
-
-  /// \cgalAdvancedBegin
-  /// Controls the velocity of movement and approximation quality:
-  /// decreasing this value makes the mean curvature flow based contraction converge
-  /// faster, but results in a skeleton of lower quality.
-  /// This parameter corresponds to \f$ w_H \f$ in the original publication.
-  /// \cgalAdvancedEnd
-  double quality_speed_tradeoff()
-  {
-    return m_omega_H;
-  }
-
-  /// If `true`, the meso-skeleton placement will be attracted by an approximation
-  /// of the medial axis of the mesh during the contraction steps, so will be the result skeleton.
-  // (an additional energy is used during the contraction using the Voronoi poles of the input triangulated mesh
-  // as attractors).
-  bool is_medially_centered()
-  {
-    return m_is_medially_centered;
-  }
-
-  /// \cgalAdvancedBegin
-  /// Controls the smoothness of the medial approximation:
-  /// increasing this value results in a (less smooth) skeleton closer
-  /// to the medial axis, as well as a lower convergence speed.
-  /// It is only used if `is_medially_centered()==true`.
-  /// This parameter corresponds to \f$ w_M \f$ in the original publication.
-  /// \cgalAdvancedEnd
-  double medially_centered_speed_tradeoff()
-  {
-    return m_omega_P;
-  }
-
-  void set_quality_speed_tradeoff(double value)
-  {
-    m_omega_H = value;
-  }
-
-  void set_is_medially_centered(bool value)
-  {
-    m_is_medially_centered = value;
-  }
-
-  void set_medially_centered_speed_tradeoff(double value)
-  {
-    m_omega_P = value;
-  }
-
-  /// \cond SKIP_FROM_MANUAL
-  void set_zero_TH(double value)
-  {
-    m_zero_TH = value;
-  }
-
-  double zero_TH()
-  {
-    return m_zero_TH;
-  }
-
-  /// \endcond
-
-  /// @cond CGAL_DOCUMENT_INTERNAL
-
-  /**
-   * Get the positions of fixed(degenerate) points.
-   *
-   * @param fixed_points
-   *        return the positions of fixed points
-   */
-  void fixed_points(std::vector<Point>& fixed_points)
-  {
-    fixed_points.clear();
-    BOOST_FOREACH(vertex_descriptor vd, vertices(m_tmesh))
-    {
-      if (vd->is_fixed)
-        fixed_points.push_back(get(m_tmesh_point_pmap, vd));
-    }
-  }
-
-  /**
-   * Get the positions of non-fixed(non-degenerate) points.
-   *
-   * @param non_fixed_points
-   *        return the positions of non-fixed points
-   */
-  void non_fixed_points(std::vector<Point>& non_fixed_points)
-  {
-    non_fixed_points.clear();
-    BOOST_FOREACH(vertex_descriptor vd, vertices(m_tmesh))
-    {
-      if (!vd->is_fixed)
-        non_fixed_points.push_back(get(m_tmesh_point_pmap, vd));
-    }
-  }
-
-  /**
-   * Get the Voronoi pole for the polygonal mesh.
-   *
-   * @param max_poles
-   *        for each surface mesh vertex, record its correspondent Voronoi pole position
-   */
-  void poles(std::vector<Point>& max_poles)
-  {
-    max_poles.resize(num_vertices(m_tmesh));
-    int cnt = 0;
-    BOOST_FOREACH(vertex_descriptor v, vertices(m_tmesh))
-    {
-      max_poles[cnt++] = v->pole;
-    }
-  }
-
-  /// @endcond
-
-  /// @} Setter and Getter
-
-  /// \name High Level Function
-  /// @{
-
-
-  /**
-   * Creates the curve skeleton: the input surface mesh is iteratively
-   * contracted until convergence, and then turned into a curve skeleton.
-   *
-   * This is equivalent to calling `contract_until_convergence()` and `convert_to_skeleton()`.
-
-   * @param skeleton
-   *        graph that will contain the skeleton of the input triangulated surface mesh.
-   *        For each vertex descriptor `vd` of `skeleton`, the corresponding point
-   *        and the set of input vertices that contracted to `vd` can be retrieved
-   *        using `skeleton[vd].point` and `skeleton[vd].vertices` respectively.
-   */
-  void operator()(Skeleton& skeleton)
-  {
-    contract_until_convergence();
-    convert_to_skeleton(skeleton);
-  }
-  /// @}
-
-  /// \name Low Level Functions
-  /// \cgalAdvancedBegin
-  /// The following functions enable the user to run the mean curvature flow skeletonization algorithm step by step.
-  /// \cgalAdvancedEnd
-  /// @{
-
-  /**
-   * Runs one contraction step following the mean curvature flow.
-   */
-  void contract_geometry()
-  {
-    MCFSKEL_DEBUG(std::cerr << "before contract geometry";)
-
-    update_vertex_id();
-
-    compute_edge_weight();
-
-  // AF: attention: num_vertices will not decrease for a Surface_mesh
-    int nver = static_cast<int>(num_vertices(m_tmesh));
-    int nrows;
-    if (m_is_medially_centered)
-    {
-      nrows = nver * 3;
-      if (!m_are_poles_computed)
-      {
-        compute_voronoi_pole();
-      }
-    }
-    else
-    {
-      nrows = nver * 2;
-    }
-    // Assemble linear system At * A * X = At * B
-    typename SolverTraits::Matrix A(nrows, nver);
-    assemble_LHS(A);
-
-    typename SolverTraits::Vector X(nver), Bx(nrows);
-    typename SolverTraits::Vector Y(nver), By(nrows);
-    typename SolverTraits::Vector Z(nver), Bz(nrows);
-    assemble_RHS(Bx, By, Bz);
-
-    MCFSKEL_DEBUG(std::cerr << "before solve\n";)
-
-    // solve "At * A * X = At * B".
-    m_solver.normal_equation_factor(A);
-    m_solver.normal_equation_solver(Bx, X);
-    m_solver.normal_equation_solver(By, Y);
-    m_solver.normal_equation_solver(Bz, Z);
-
-    MCFSKEL_DEBUG(std::cerr << "after solve\n";)
-
-    // copy to surface mesh
-    BOOST_FOREACH(vertex_descriptor vd, vertices(m_tmesh))
-    {
-      int id = static_cast<int>(get(m_vertex_id_pmap, vd));
-      int i = m_new_id[id];
-      Point p =  m_traits.construct_point_3_object()(X[i], Y[i], Z[i]);
-      put(m_tmesh_point_pmap, vd, p);
-    }
-
-    MCFSKEL_DEBUG(std::cerr << "leave contract geometry\n";)
-  }
-
-  /**
-   * Collapses edges of the meso-skeleton with length less than `min_edge_length()` and returns the number of edges collapsed.
-   */
-  std::size_t collapse_edges()
-  {
-    return collapse_short_edges();
-  }
-
-  /**
-   * Splits faces of the meso-skeleton having one angle greater than `max_triangle_angle()` and returns the number of faces split.
-   */
-  std::size_t split_faces()
-  {
-    MCFSKEL_DEBUG(std::cerr << "before split\n";)
-
-    std::size_t num_splits = 0;
-    while (true)
-    {
-      if (num_vertices(m_tmesh) <= 3)
-      {
-        break;
-      }
-      std::size_t cnt = split_flat_triangles();
-      if (cnt == 0)
-      {
-        break;
-      }
-      else
-      {
-        num_splits += cnt;
-      }
-    }
-
-    MCFSKEL_DEBUG(std::cerr << "after split\n";)
-
-    return num_splits;
-  }
-
-#ifndef DOXYGEN_RUNNING
-  /**
-   * Sequentially calls `collapse_edges()` and `split_faces()` and returns the number of edges collapsed and faces split.
-   */
-  std::size_t remesh()
-  {
-    MCFSKEL_DEBUG(std::cerr << "before collapse edges\n";)
-
-    std::size_t num_collapses = collapse_edges();
-    MCFSKEL_INFO(std::cerr << "collapse " << num_collapses << " edges.\n";)
-
-    std::size_t num_splits = split_faces();
-    MCFSKEL_INFO(std::cerr << "split " << num_splits << " edges.\n";)
-
-    return num_collapses + num_splits;
-  }
-#endif
-
-  /**
-   * Prevents degenerate vertices to move during the following contraction steps and returns the number of newly fixed vertices.
-   */
-  std::size_t detect_degeneracies()
-  {
-    return detect_degeneracies_in_disk();
-  }
-
-  /// Performs subsequent calls to `contract_geometry()`, `collapse_edges()`, `split_faces()` and `detect_degeneracies()`
-  void contract()
-  {
-    contract_geometry();
-    remesh();
-    detect_degeneracies();
-
-    MCFSKEL_DEBUG(print_edges();)
-
-    MCFSKEL_INFO(double area = CGAL::Polygon_mesh_processing::area(m_tmesh,
-      CGAL::Polygon_mesh_processing::parameters::vertex_point_map(m_tmesh_point_pmap));)
-    MCFSKEL_INFO(std::cout << "area " << area << "\n";)
-  }
-
-
-  /**
-   * Iteratively calls `contract()`
-   * until the change of surface area of the meso-skeleton after one iteration is smaller than
-   * `area_variation_factor()*original_area` where `original_area` is the area of the input triangle mesh,
-   * or if the maximum number of iterations has been reached.
-   */
-  void contract_until_convergence()
-  {
-    double last_area = 0;
-    std::size_t num_iteration = 0;
-    while (true)
-    {
-      MCFSKEL_INFO(std::cout << "iteration " << num_iteration + 1 << "\n";)
-
-      contract_geometry();
-      remesh();
-      detect_degeneracies();
-
-      double area = CGAL::Polygon_mesh_processing::area(m_tmesh,
-        CGAL::Polygon_mesh_processing::parameters::vertex_point_map(m_tmesh_point_pmap)
-        .geom_traits(m_traits));
-      double area_ratio = fabs(last_area - area) / m_original_area;
-
-      MCFSKEL_INFO(std::cout << "area " << area << "\n";)
-      MCFSKEL_INFO(std::cout << "|area - last_area| / original_area "
-                             << area_ratio << "\n";)
-
-      if (area_ratio < m_delta_area)
-      {
-        break;
-      }
-      last_area = area;
-
-      num_iteration++;
-      if (num_iteration >= m_max_iterations)
-      {
-        break;
-      }
-    }
-  }
-
-  /**
-   * Converts the contracted surface mesh to a skeleton curve.
-   * @tparam Skeleton
-   *         an instantiation of <A href="http://www.boost.org/libs/graph/doc/adjacency_list.html">`boost::adjacency_list`</a>
-   *         as a data structure for the skeleton curve.
-   * @param skeleton
-   *        graph that will contain the skeleton of `tmesh`. It should be empty before passed to the function.
-   */
-  void convert_to_skeleton(Skeleton& skeleton)
-  {
-    skeleton.clear();
-    Curve_skeleton skeletonization(m_tmesh, m_vertex_id_pmap, m_hedge_id_pmap, m_tmesh_point_pmap);
-    skeletonization.extract_skeleton(skeleton);
-  }
-
-  /// @} Public Algorithm API
-
-
-  /// \name Access to the Meso-Skeleton
-  /// @{
-
-  /// When using the low level API it is possible to access the intermediate
-  /// results of the skeletonization process, called meso-skeleton.
-  /// It is a triangulated surface mesh which is model of `FaceListGraph`.
-#ifdef DOXYGEN_RUNNING
-  typedef unspecified_type Meso_skeleton;
-#else
-  typedef mTriangleMesh Meso_skeleton;
-#endif
-  /// Reference to the collapsed triangulated surface mesh.
-  Meso_skeleton& meso_skeleton()
-  {
-    return m_tmesh;
-  }
-
-  /// @}
-
-private:
-
-  // --------------------------------------------------------------------------
-  // Initialization
-  // --------------------------------------------------------------------------
-
-  /// Initialize the parameters for Mean_curvature_flow_skeletonization
-  void init_args()
-  {
-    m_omega_H = 0.1;
-    m_omega_P = 0.2;
-    m_delta_area = 0.0001;
-    m_max_iterations = 500;
-    m_is_medially_centered = true;
-    m_min_edge_length =  init_min_edge_length();
-    m_alpha_TH = 110 * (CGAL_PI / 180.0);
-    m_zero_TH = 1e-7;
-  }
-
-  /// Initialize some global data structures such as vertex id.
-  void init(const TriangleMesh& tmesh,
-            VertexPointMap vpm)
-  {
-    // copy the input FaceGraph into a mTriangleMesh
-    CGAL::FaceGraph_to_Polyhedron_3<TriangleMesh,
-                                    VertexPointMap,
-                                    typename mTriangleMesh::HalfedgeDS,
-                                    false> modifier(tmesh, vpm);
-
-    m_tmesh.delegate(modifier);
-
-    // copy input vertices to keep correspondance
-    typename boost::graph_traits<mTriangleMesh>::vertex_iterator vit=vertices(m_tmesh).first;
-    BOOST_FOREACH(Input_vertex_descriptor vd, vertices(tmesh) )
-      (*vit++)->vertices.push_back(vd);
-
-    //init indices
-    typedef typename boost::graph_traits<mTriangleMesh>::vertex_descriptor vertex_descriptor;
-    typedef typename boost::graph_traits<mTriangleMesh>::halfedge_descriptor halfedge_descriptor;
-    std::size_t i=0;
-    BOOST_FOREACH( vertex_descriptor vd, vertices(m_tmesh) )
-      vd->id()=i++;
-    i=0;
-    BOOST_FOREACH( halfedge_descriptor hd, halfedges(m_tmesh) )
-      hd->id()=i++;
-    m_hedge_id_pmap = get(boost::halfedge_index, m_tmesh);
-    m_vertex_id_pmap = get(boost::vertex_index, m_tmesh);
-      //, m_hedge_id_pmap(get(boost::halfedge_index, m_tmesh))
-    m_are_poles_computed = false;
-
-    m_original_area = CGAL::Polygon_mesh_processing::area(m_tmesh,
-      CGAL::Polygon_mesh_processing::parameters::vertex_point_map(m_tmesh_point_pmap)
-      .geom_traits(m_traits));
-
-    m_vertex_id_count = static_cast<int>(num_vertices(m_tmesh));
-    m_max_id = m_vertex_id_count;
-
-    if (m_is_medially_centered)
-      compute_voronoi_pole();
-
-    init_args();
-  }
-
-  // --------------------------------------------------------------------------
-  // Utilities
-  // --------------------------------------------------------------------------
-  double get_x(const Vector& v){ return m_traits.compute_x_3_object()(v); }
-  double get_y(const Vector& v){ return m_traits.compute_y_3_object()(v); }
-  double get_z(const Vector& v){ return m_traits.compute_z_3_object()(v); }
-  double get_x(const Point& v){ return m_traits.compute_x_3_object()(v); }
-  double get_y(const Point& v){ return m_traits.compute_y_3_object()(v); }
-  double get_z(const Point& v){ return m_traits.compute_z_3_object()(v); }
-  // --------------------------------------------------------------------------
-  // Contraction
-  // --------------------------------------------------------------------------
-
-  /// Compute cotangent weights of all edges.
-  void compute_edge_weight()
-  {
-    m_edge_weight.clear();
-    m_edge_weight.reserve(2 * num_edges(m_tmesh));
-    BOOST_FOREACH(halfedge_descriptor hd, halfedges(m_tmesh))
-    {
-      m_edge_weight.push_back(m_weight_calculator(hd));
-    }
-  }
-
-  /// Assemble the left hand side.
-  void assemble_LHS(typename SolverTraits::Matrix& A)
-  {
-    MCFSKEL_DEBUG(std::cerr << "start LHS\n";)
-
-    std::size_t nver = num_vertices(m_tmesh);
-
-    Side_of_triangle_mesh<mTriangleMesh, Traits> test_inside(m_tmesh);
-
-    BOOST_FOREACH(vertex_descriptor vd, vertices(m_tmesh))
-    {
-      int id = static_cast<int>(get(m_vertex_id_pmap, vd));
-
-      int i = m_new_id[id];
-      // if the vertex is fixed
-      if (vd->is_fixed)
-      {
-        A.set_coef(i + nver, i, 1.0 / m_zero_TH, true);
-      }
-      else
-      {
-        A.set_coef(i + nver, i, m_omega_H, true);
-        if (m_is_medially_centered)
-        {
-          if (id < m_max_id)
-          {
-            if (test_inside(vd->pole) == CGAL::ON_BOUNDED_SIDE)
-            {
-              A.set_coef(i + nver * 2, i, m_omega_P, true);
-            }
-          }
-        }
-      }
-    }
-
-    BOOST_FOREACH(vertex_descriptor vd, vertices(m_tmesh))
-    {
-      int id = static_cast<int>(get(m_vertex_id_pmap, vd));
-      int i = m_new_id[id];
-      double L = 1.0;
-      // if the vertex is fixed
-      if (vd->is_fixed)
-      {
-        L = 0;
-      }
-      double diagonal = 0;
-      BOOST_FOREACH(edge_descriptor ed, in_edges(vd, m_tmesh))
-      {
-        vertex_descriptor vj = source(ed, m_tmesh);
-        double wij = m_edge_weight[get(m_hedge_id_pmap, halfedge(ed, m_tmesh))] * 2.0;
-        int jd = static_cast<int>(get(m_vertex_id_pmap, vj));
-        int j = m_new_id[jd];
-        A.set_coef(i, j, wij * L, true);
-        diagonal += -wij;
-      }
-      A.set_coef(i, i, diagonal, true);
-    }
-
-    MCFSKEL_DEBUG(std::cerr << "end LHS\n";)
-  }
-
-  /// Assemble the right hand side.
-  void assemble_RHS(typename SolverTraits::Vector& Bx,
-                    typename SolverTraits::Vector& By,
-                    typename SolverTraits::Vector& Bz)
-  {
-    MCFSKEL_DEBUG(std::cerr << "start RHS\n";)
-
-    Side_of_triangle_mesh<mTriangleMesh, Traits> test_inside(m_tmesh);
-
-    // assemble right columns of linear system
-    int nver = static_cast<int>(num_vertices(m_tmesh));
-    for (int i = 0; i < nver; ++i)
-    {
-      Bx[i] = 0;
-      By[i] = 0;
-      Bz[i] = 0;
-    }
-
-    BOOST_FOREACH(vertex_descriptor vd, vertices(m_tmesh))
-    {
-      int id = static_cast<int>(get(m_vertex_id_pmap, vd));
-      int i = m_new_id[id];
-
-      double oh, op = 0.0;
-      if (vd->is_fixed)
-      {
-        oh = 1.0 / m_zero_TH;
-      }
-      else
-      {
-        oh = m_omega_H;
-        if (m_is_medially_centered)
-        {
-          if (id < m_max_id)
-          {
-            if (test_inside(vd->pole) == CGAL::ON_BOUNDED_SIDE)
-            {
-              op = m_omega_P;
-            }
-          }
-        }
-      }
-      Bx[i + nver] = get_x(get(m_tmesh_point_pmap, vd)) * oh;
-      By[i + nver] = get_y(get(m_tmesh_point_pmap, vd)) * oh;
-      Bz[i + nver] = get_z(get(m_tmesh_point_pmap, vd)) * oh;
-      if (m_is_medially_centered)
-      {
-        double x = get_x(vd->pole);
-        double y = get_y(vd->pole);
-        double z = get_z(vd->pole);
-        Bx[i + nver * 2] = x * op;
-        By[i + nver * 2] = y * op;
-        Bz[i + nver * 2] = z * op;
-      }
-    }
-
-    MCFSKEL_DEBUG(std::cerr << "end RHS\n";)
-  }
-
-  /// The order of vertex id is the same as the traverse order.
-  void update_vertex_id()
-  {
-    m_new_id.clear();
-    int cnt = 0;
-
-    BOOST_FOREACH(vertex_descriptor vd, vertices(m_tmesh))
-    {
-      int id = static_cast<int>(get(m_vertex_id_pmap, vd));
-      m_new_id[id] = cnt++;
-    }
-  }
-
-  // --------------------------------------------------------------------------
-  // Edge collapse
-  // --------------------------------------------------------------------------
-
-  /// Track correspondent original surface points during collapse.
-  void update_pole(vertex_descriptor v0, vertex_descriptor vkept)
-  {
-    if (m_is_medially_centered)
-    {
-      const Point& pole0 = v0->pole;
-      const Point& pole1 = vkept->pole;
-
-      Point p1 = get(m_tmesh_point_pmap, vkept);
-      double dis_to_pole0 = m_traits.compute_squared_distance_3_object()(pole0, p1);
-      double dis_to_pole1 = m_traits.compute_squared_distance_3_object()(pole1, p1);
-      if (dis_to_pole0 < dis_to_pole1)
-        vkept->pole = v0->pole;
-    }
-  }
-
-  bool edge_should_be_collapsed(edge_descriptor ed)
-  {
-    halfedge_descriptor h = halfedge(ed, m_tmesh);
-
-    vertex_descriptor vi = source(h, m_tmesh);
-    vertex_descriptor vj = target(h, m_tmesh);
-
-    // an edge cannot be collapsed if both vertices are degenerate.
-    if (vi->is_fixed && vj->is_fixed) return false;
-
-    double sq_edge_length = m_traits.compute_squared_distance_3_object()(
-                              get(m_tmesh_point_pmap, vi),
-                              get(m_tmesh_point_pmap, vj));
-    return sq_edge_length < m_min_edge_length * m_min_edge_length;
-  }
-
-  // --------------------------------------------------------------------------
-  // Triangle split
-  // --------------------------------------------------------------------------
-
-  /// Compute the incident angles for all the halfedges.
-  void compute_incident_angle()
-  {
-    m_halfedge_angle.clear();
-    int ne = 2 * static_cast<int>(num_edges(m_tmesh));
-    m_halfedge_angle.resize(ne, 0);
-
-    int idx = 0;
-    BOOST_FOREACH(halfedge_descriptor hd, halfedges(m_tmesh))
-    {
-      put(m_hedge_id_pmap, hd, idx++);
-    }
-
-    BOOST_FOREACH(halfedge_descriptor hd, halfedges(m_tmesh))
-    {
-      int e_id = static_cast<int>(get(m_hedge_id_pmap, hd));
-
-      if (is_border(hd, m_tmesh))
-      {
-        m_halfedge_angle[e_id] = -1;
-      }
-      else
-      {
-        vertex_descriptor vi = source(hd, m_tmesh);
-        vertex_descriptor vj = target(hd, m_tmesh);
-        halfedge_descriptor hd_next = next(hd, m_tmesh);
-        vertex_descriptor vk = target(hd_next, m_tmesh);
-        Point pi = get(m_tmesh_point_pmap, vi);
-        Point pj = get(m_tmesh_point_pmap, vj);
-        Point pk = get(m_tmesh_point_pmap, vk);
-
-        double dis2_ij = m_traits.compute_squared_distance_3_object()(pi, pj);
-        double dis2_ik = m_traits.compute_squared_distance_3_object()(pi, pk);
-        double dis2_jk = m_traits.compute_squared_distance_3_object()(pj, pk);
-        double dis_ij = std::sqrt(dis2_ij);
-        double dis_ik = std::sqrt(dis2_ik);
-        double dis_jk = std::sqrt(dis2_jk);
-
-        // A degenerate triangle will never undergo a split (but rather a collapse...)
-        if (dis_ij < m_zero_TH || dis_ik < m_zero_TH || dis_jk < m_zero_TH)
-        {
-          m_halfedge_angle[e_id] = -1;
-        }
-        else
-        {
-          m_halfedge_angle[e_id] =
-              acos((dis2_ik + dis2_jk - dis2_ij) / (2.0 * dis_ik * dis_jk));
-        }
-      }
-    }
-  }
-
-  void normalize(Vector& v)
-  {
-    double norm = std::sqrt(m_traits.compute_squared_length_3_object()(v));
-    v = m_traits.construct_divided_vector_3_object()(v, norm);
-  }
-
-  /// Project the vertex `vk` to the line of `vs` and `vt`.
-  Point project_vertex(const vertex_descriptor vs,
-                       const vertex_descriptor vt,
-                       const vertex_descriptor vk,
-                       const vertex_descriptor vnew)
-  {
-    Point ps = get(m_tmesh_point_pmap, vs);
-    Point pt = get(m_tmesh_point_pmap, vt);
-    Point pk = get(m_tmesh_point_pmap, vk);
-    Vector vec_st = m_traits.construct_vector_3_object()(ps, pt);
-    Vector vec_sk = m_traits.construct_vector_3_object()(ps, pk);
-
-    normalize(vec_st);
-    double t = m_traits.compute_scalar_product_3_object()(vec_st,vec_sk);
-    Point st = m_traits.construct_point_3_object()( get_x(vec_st) * t, get_y(vec_st) * t, get_z(vec_st) * t);
-    Point pn = m_traits.construct_point_3_object()( get_x(ps) + get_x(st), get_y(ps) + get_y(st), get_z(ps) + get_z(st));
-
-    // project the pole
-    if (m_is_medially_centered)
-    {
-      const Point& pole_s = vs->pole;
-      const Point& pole_t = vt->pole;
-      Vector pole_st = m_traits.construct_vector_3_object()(pole_s, pole_t );
-      normalize(pole_st);
-      vnew->pole =  m_traits.construct_translated_point_3_object()(
-                        pole_s,
-                        m_traits.construct_scaled_vector_3_object()(pole_st, t)
-                     );
-    }
-    return pn;
-  }
-
-  /// Split triangles with an angle greater than `alpha_TH`.
-  std::size_t split_flat_triangles()
-  {
-    compute_incident_angle();
-
-    // collect edges that should be split because
-    // both opposite angle are larger than the
-    // threshold
-    std::vector<edge_descriptor> edges_to_split;
-    BOOST_FOREACH(edge_descriptor ed, edges(m_tmesh))
-    {
-      halfedge_descriptor ei = halfedge(ed, m_tmesh);
-      halfedge_descriptor ej = opposite(ei, m_tmesh);
-      int ei_id = static_cast<int>(get(m_hedge_id_pmap, ei));
-      int ej_id = static_cast<int>(get(m_hedge_id_pmap, ej));
-
-      double angle_i = m_halfedge_angle[ei_id];
-      double angle_j = m_halfedge_angle[ej_id];
-      if (angle_i >= m_alpha_TH && angle_j >= m_alpha_TH)
-        edges_to_split.push_back( ed );
-    }
-
-    // now split the edge
-    std::size_t cnt = 0;
-    BOOST_FOREACH(edge_descriptor ed, edges_to_split)
-    {
-      halfedge_descriptor ei = halfedge(ed, m_tmesh);
-      halfedge_descriptor ej = opposite(ei, m_tmesh);
-      int ei_id = static_cast<int>(get(m_hedge_id_pmap, ei));
-      int ej_id = static_cast<int>(get(m_hedge_id_pmap, ej));
-
-      vertex_descriptor vs = source(ei, m_tmesh);
-      vertex_descriptor vt = target(ei, m_tmesh);
-
-      double angle_i = m_halfedge_angle[ei_id];
-      double angle_j = m_halfedge_angle[ej_id];
-
-      halfedge_descriptor ek = next(angle_i > angle_j ? ei : ej, m_tmesh);
-      vertex_descriptor vk = target(ek, m_tmesh);
-
-      // split the edge
-      halfedge_descriptor en = m_tmesh.split_edge(ei);
-      // split the incident faces
-      Euler::split_face(en, next(ei,m_tmesh), m_tmesh);
-      if (! is_border(ej,m_tmesh))
-      {
-        Euler::split_face(ej, next(next(ej,m_tmesh),m_tmesh), m_tmesh);
-      }
-
-      // set id for new vertex
-      put(m_vertex_id_pmap, target(en,m_tmesh), m_vertex_id_count++);
-      Point pn = project_vertex(vs, vt, vk, target(en, m_tmesh));
-      // set point of new vertex
-      put(m_tmesh_point_pmap, target(en,m_tmesh), pn);
-      target(en,m_tmesh)->vertices.clear(); // do no copy the info
-      ++cnt;
-    }
-    return cnt;
-  }
-
-  // --------------------------------------------------------------------------
-  // Degeneracy detection
-  // --------------------------------------------------------------------------
-
-  /// Test degeneracy of a vertex by counting the euler characteristic of
-  /// its local neighborhood disk.
-  std::size_t detect_degeneracies_in_disk()
-  {
-    std::size_t num_fixed = 0;
-    BOOST_FOREACH(vertex_descriptor v, vertices(m_tmesh))
-    {
-      if (!v->is_fixed)
-      {
-        bool willbefixed = internal::is_vertex_degenerate(m_tmesh, m_tmesh_point_pmap,
-                                                          v, m_min_edge_length, m_traits);
-        if (willbefixed)
-        {
-          v->is_fixed=true;
-          ++num_fixed;
-        }
-      }
-    }
-
-    MCFSKEL_INFO(std::cerr << "fixed " << num_fixed << " vertices.\n";)
-
-    return num_fixed;
-  }
-
-  // --------------------------------------------------------------------------
-  // Voronoi pole
-  // --------------------------------------------------------------------------
-
-  /// Compute the Voronoi pole for surface vertices. The pole is the furthest
-  /// vertex in the Voronoi cell containing the given vertex.
-  void compute_voronoi_pole()
-  {
-    MCFSKEL_DEBUG(std::cout << "start compute_voronoi_pole\n";)
-    compute_vertex_normal();
-
-    std::vector<std::pair<Exact_point, vertex_descriptor> > points;
-    std::vector<std::vector<int> > point_to_pole(num_vertices(m_tmesh));
-
-    BOOST_FOREACH(vertex_descriptor v, vertices(m_tmesh))
-    {
-      const Point& input_pt = get(m_tmesh_point_pmap, v);
-      Exact_point tp(get_x(input_pt), get_y(input_pt), get_z(input_pt));
-      points.push_back(std::make_pair(tp, v));
-    }
-
-    Delaunay T(points.begin(), points.end());
-
-    Finite_cells_iterator cit;
-    int cell_id = 0;
-    std::vector<Point> cell_dual;
-    cell_dual.reserve(T.number_of_cells());
-    for (cit = T.finite_cells_begin(); cit != T.finite_cells_end(); ++cit)
-    {
-      Cell_handle cell = cit;
-      Exact_point point = T.dual(cell);
-      cell_dual.push_back(
-        m_traits.construct_point_3_object()(
-          to_double(point.x()),
-          to_double(point.y()),
-          to_double(point.z())
-        )
-      );
-      // each cell has 4 incident vertices
-      for (int i = 0; i < 4; ++i)
-      {
-        TriVertex_handle vt = cell->vertex(i);
-        std::size_t id = get(m_vertex_id_pmap, vt->info());
-        point_to_pole[id].push_back(cell_id);
-      }
-      ++cell_id;
-    }
-
-    typedef std::pair<Exact_point, vertex_descriptor> Pair_type;
-    BOOST_FOREACH(const Pair_type& p, points)
-    {
-      std::size_t vid = get(m_vertex_id_pmap, p.second);
-      Point surface_point = get(m_tmesh_point_pmap, p.second);
-
-      double max_neg_t = 1;
-      int max_neg_i = -1;
-
-      for (size_t j = 0; j < point_to_pole[vid].size(); ++j)
-      {
-        int pole_id = point_to_pole[vid][j];
-        Point cell_point = cell_dual[pole_id];
-        Vector vt = m_traits.construct_vector_3_object()(surface_point, cell_point);
-        Vector n = m_normals[vid];
-
-        double t = m_traits.compute_scalar_product_3_object()(vt, n);
-
-        // choose the one with maximum distance along the normal
-        if (t < 0 && t < max_neg_t)
-        {
-          max_neg_i = pole_id;
-          max_neg_t = t;
-        }
-      }
-
-      p.second->pole = cell_dual[max_neg_i];
-    }
-    m_are_poles_computed = true;
-  }
-
-  /// Compute an approximate vertex normal for all vertices.
-  void compute_vertex_normal()
-  {
-    m_normals.resize(num_vertices(m_tmesh));
-
-    BOOST_FOREACH(vertex_descriptor v, vertices(m_tmesh))
-    {
-      int vid = static_cast<int>(get(m_vertex_id_pmap, v));
-      m_normals[vid] = internal::get_vertex_normal(*v, m_traits);
-    }
-  }
-
-  // --------------------------------------------------------------------------
-  // Debug
-  // --------------------------------------------------------------------------
-
-  void print_edges()
-  {
-    std::map<halfedge_descriptor, bool> visited;
-
-    BOOST_FOREACH(halfedge_descriptor hd, halfedges(m_tmesh))
-    {
-      if (!visited[hd])
-      {
-        vertex_descriptor vi = source(hd, m_tmesh);
-        vertex_descriptor vj = target(hd, m_tmesh);
-        size_t vi_idx = get(m_vertex_id_pmap, vi);
-        size_t vj_idx = get(m_vertex_id_pmap, vj);
-        std::cout << vi_idx << " " << vj_idx << "\n";
-
-        visited[hd] = true;
-        visited[opposite(hd,m_tmesh)] = true;
-      }
-    }
-  }
-};
-
-template <class TriangleMesh,
-          class Traits_,
-          class VertexPointMap_,
-          class SolverTraits_>
-std::size_t Mean_curvature_flow_skeletonization<TriangleMesh, Traits_, VertexPointMap_, SolverTraits_>::collapse_short_edges()
-{
-  std::size_t cnt=0, prev_cnt=0;
-
-  std::set<edge_descriptor> edges_to_collapse, non_topologically_valid_collapses;
-
-  BOOST_FOREACH(edge_descriptor ed, edges(m_tmesh))
-    if ( edge_should_be_collapsed(ed) )
-      edges_to_collapse.insert(ed);
-
-  do{
-    prev_cnt=cnt;
-    while(!edges_to_collapse.empty())
-    {
-      edge_descriptor ed = *edges_to_collapse.begin();
-      edges_to_collapse.erase(edges_to_collapse.begin());
-
-      // skip the edge is it became long enough
-      if ( !edge_should_be_collapsed(ed) ) continue;
-
-      if ( !Euler::does_satisfy_link_condition(ed,m_tmesh) )
-      {
-        non_topologically_valid_collapses.insert(ed);
-        continue;
-      }
-
-      halfedge_descriptor h = halfedge(ed, m_tmesh);
-
-      vertex_descriptor vi = source(h, m_tmesh);
-      vertex_descriptor vj = target(h, m_tmesh);
-
-      Point p = m_traits.construct_midpoint_3_object()(
-                  get(vertex_point, m_tmesh, vi),
-                  get(vertex_point, m_tmesh, vj) );
-
-      // invalidate the edges that will be collapsed
-      edges_to_collapse.erase(edge(prev(h, m_tmesh), m_tmesh));
-      edges_to_collapse.erase(edge(prev(opposite(h, m_tmesh), m_tmesh), m_tmesh));
-
-      non_topologically_valid_collapses.erase(ed);
-      non_topologically_valid_collapses.erase(edge(prev(h, m_tmesh), m_tmesh));
-      non_topologically_valid_collapses.erase(edge(prev(opposite(h, m_tmesh), m_tmesh), m_tmesh));
-
-      // the mesh is closed, the target of h is always the one kept
-      put(m_tmesh_point_pmap, vj, p);
-      std::vector<Input_vertex_descriptor>& vec_kept = vj->vertices;
-      std::vector<Input_vertex_descriptor>& vec_removed = vi->vertices;
-      vec_kept.insert(vec_kept.end(), vec_removed.begin(), vec_removed.end());
-      if (vi->is_fixed) vj->is_fixed=true;
-      update_pole(vi, vj);
-
-      vertex_descriptor v = Euler::collapse_edge(ed, m_tmesh);
-
-      CGAL_assertion(vj==v);
-
-      BOOST_FOREACH(edge_descriptor oed, out_edges(v, m_tmesh))
-        if ( edge_should_be_collapsed(oed) ) edges_to_collapse.insert(oed);
-
-      ++cnt;
-    }
-    if (prev_cnt==cnt) break;
-    edges_to_collapse.swap(non_topologically_valid_collapses);
-  } while(!edges_to_collapse.empty());
-
-  return cnt;
-}
-
-
-} //namespace CGAL
-
-#endif // CGAL_MEAN_CURVATURE_FLOW_SKELETONIZATION_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Dump_c3t3.h b/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Dump_c3t3.h
deleted file mode 100644
index aba5b56..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Dump_c3t3.h
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright (c) 2012  GeometryFactory Sarl (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
-// 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(s)     : Laurent Rineau
-
-#ifndef CGAL_MESH_3_DUMP_C3T3_H
-#define CGAL_MESH_3_DUMP_C3T3_H
-
-#include <string>
-#include <CGAL/Mesh_3/io_signature.h>
-#include <CGAL/Mesh_3/Mesh_complex_3_in_triangulation_3_base.h>
-#include <CGAL/is_streamable.h>
-#include <fstream>
-
-namespace CGAL {
-
-template <typename C3t3, 
-          bool is_streamable = 
-            is_streamable<typename C3t3::Triangulation::Vertex>::value &&
-            is_streamable<typename C3t3::Triangulation::Cell>::value &&
-            is_streamable<typename C3t3::Surface_patch_index>::value &&
-            is_streamable<typename C3t3::Subdomain_index>::value 
-          >
-struct Dump_c3t3 {
-  void dump_c3t3(const C3t3& c3t3, std::string prefix) const {
-    std::clog<<"======dump c3t3===== to: " << prefix << std::endl;
-    std::ofstream medit_file((prefix+".mesh").c_str());
-    medit_file.precision(17);
-    CGAL::output_to_medit(medit_file, c3t3, false, true);
-    medit_file.close();
-
-    std::string bin_filename = prefix;
-    bin_filename += ".binary.cgal";
-    std::ofstream bin_file(bin_filename.c_str(),
-                           std::ios_base::binary | std::ios_base::out);
-    bin_file << "binary CGAL c3t3 " << CGAL::Get_io_signature<C3t3>()() << "\n";
-    CGAL::set_binary_mode(bin_file);
-    bin_file << c3t3;
-  }
-}; // end struct template Dump_c3t3<C3t3, bool>
-
-template <typename C3t3>
-struct Dump_c3t3<C3t3, false> {
-  void dump_c3t3(const C3t3&, std::string) {
-    std::cerr << "Warning " << __FILE__ << ":" << __LINE__ << "\n"
-              << "  the c3t3 object of following type:\n"
-              << typeid(C3t3).name() << std::endl
-              << "  cannot be dumped because some types are not streamable:\n";
-    if(!is_streamable<typename C3t3::Triangulation::Vertex>::value) {
-      std::cerr << "     - C3t3::Triangulation::Vertex is not streamble\n";
-      std::cerr << "       "
-                << typeid(typename C3t3::Triangulation::Vertex).name()
-                << "\n";
-    }
-
-    if(!is_streamable<typename C3t3::Triangulation::Cell>::value) {
-      std::cerr << "     - C3t3::Triangulation::Cell is not streamble\n";
-      std::cerr << "       "
-                << typeid(typename C3t3::Triangulation::Cell).name()
-                << "\n";
-    }
-
-    if(!is_streamable<typename C3t3::Surface_patch_index>::value) {
-      std::cerr << "     - C3t3::Surface_patch_index is not streamable\n";
-      std::cerr << "       "
-                << typeid(typename C3t3::Surface_patch_index).name()
-                << "\n";
-    }
-    if(!is_streamable<typename C3t3::Subdomain_index>::value) {
-      std::cerr << "     - C3t3::Subdomain_index is not streamable\n";      
-      std::cerr << "       "
-                << typeid(typename C3t3::Subdomain_index).name()
-                << "\n";
-    }
-  }
-}; // end struct template specialization Dump_c3t3<C3t3, false>
-
-template <typename C3t3>
-void dump_c3t3(const C3t3& c3t3, std::string prefix) {
-  if(!prefix.empty()) {
-    Dump_c3t3<C3t3> dump;
-    dump.dump_c3t3(c3t3, prefix);
-  }
-}
-
-} // end namespace CGAL
-
-#endif // CGAL_MESH_3_DUMP_C3T3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Image_to_labeled_function_wrapper.h b/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Image_to_labeled_function_wrapper.h
deleted file mode 100644
index db2592b..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Image_to_labeled_function_wrapper.h
+++ /dev/null
@@ -1,142 +0,0 @@
-// Copyright (c) 2009 INRIA Sophia-Antipolis (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
-// 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(s)     : Stéphane Tayeb
-//
-//******************************************************************************
-// File Description :
-// Image_to_labeled_function_wrapper declaration and implementation. See
-// class description.
-//******************************************************************************
-
-#ifndef CGAL_MESH_3_IMAGE_TO_LABELED_FUNCTION_WRAPPER_H
-#define CGAL_MESH_3_IMAGE_TO_LABELED_FUNCTION_WRAPPER_H
-
-#include <CGAL/Image_3.h>
-#include <CGAL/function_objects.h>
-
-
-namespace CGAL {
-
-namespace Mesh_3 {
-
-/**
- * @class Image_to_labeled_function_wrapper
- *
- * Wraps a labeled image into a labeled function which takes his values into
- * N. Uses trilinear interpolation.
- * Note: Image has to be labeled with unsigned char
- */
-template<class Image_,
-         class BGT,
-         typename Image_word_type = unsigned char,
-         typename Return_type = int,
-         typename Transform = Identity<Image_word_type>,
-         bool labeled_image = true,
-         bool use_trilinear_interpolation=true>
-class Image_to_labeled_function_wrapper
-{
-public:
-  // Types
-  typedef Return_type return_type;
-  typedef Image_word_type word_type;
-  typedef typename BGT::Point_3   Point_3;
-
-  /// Constructor
-  Image_to_labeled_function_wrapper(const Image_& image, 
-                                    const Transform& transform = Transform(),
-                                    const Image_word_type value_outside = 0)
-    : r_im_(image)
-    , transform(transform)
-    , value_outside(value_outside)
-  {
-    CGAL_assertion(transform(value_outside) == return_type());
-  }
-
-  // Default copy constructor and assignment operator are ok
-
-  /// Destructor
-  ~Image_to_labeled_function_wrapper() {}
-
-  /**
-   * Returns an int corresponding to the label at point \c p
-   * @param p the input point
-   * @return the label at point \c p
-   */
-  return_type operator()(const Point_3& p, const bool = true) const
-  {
-    if ( use_trilinear_interpolation )
-    {
-      if ( labeled_image )
-      {
-        return static_cast<return_type>(transform(
-          r_im_.labellized_trilinear_interpolation(
-              CGAL::to_double(p.x()),
-              CGAL::to_double(p.y()),
-              CGAL::to_double(p.z()),
-              value_outside)));
-      } else {
-        return static_cast<return_type>(transform(
-          static_cast<typename Transform::argument_type>(
-            r_im_.template trilinear_interpolation<Image_word_type, double>(
-              CGAL::to_double(p.x()),
-              CGAL::to_double(p.y()),
-              CGAL::to_double(p.z()),
-              value_outside))));
-      }
-    }
-    else
-    {
-      const std::ptrdiff_t px = static_cast<std::ptrdiff_t>(p.x()/r_im_.vx());
-      const std::ptrdiff_t py = static_cast<std::ptrdiff_t>(p.y()/r_im_.vy());
-      const std::ptrdiff_t pz = static_cast<std::ptrdiff_t>(p.z()/r_im_.vz());
-
-      const std::ptrdiff_t dimx = static_cast<std::ptrdiff_t>(r_im_.xdim());
-      const std::ptrdiff_t dimy = static_cast<std::ptrdiff_t>(r_im_.ydim());
-      const std::ptrdiff_t dimz = static_cast<std::ptrdiff_t>(r_im_.zdim());
-
-      if(px < 0 ||
-         py < 0 ||
-         pz < 0 ||
-         px+1 >= dimx ||
-         py+1 >= dimy ||
-         pz+1 >= dimz)
-      {
-        return 0;
-      }
-
-      const word_type* data = static_cast<const word_type*>(r_im_.data());
-      return static_cast<return_type>(transform(
-                data[pz*dimy*dimx + py*dimx + px]));
-    }
-  }
-
-private:
-  /// Labeled image to wrap
-  const Image_& r_im_;
-  const Transform transform;
-  const Image_word_type value_outside;
-
-};  // end class Image_to_labeled_function_wrapper
-
-
-}  // end namespace Mesh_3
-
-}  // end namespace CGAL
-
-#endif // CGAL_MESH_3_IMAGE_TO_LABELED_FUNCTION_WRAPPER_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Implicit_to_labeled_function_wrapper.h b/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Implicit_to_labeled_function_wrapper.h
deleted file mode 100644
index 9f16d01..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Implicit_to_labeled_function_wrapper.h
+++ /dev/null
@@ -1,155 +0,0 @@
-// Copyright (c) 2009 INRIA Sophia-Antipolis (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
-// 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(s)     : Stéphane Tayeb
-//
-//******************************************************************************
-// File Description :
-// Implicit_to_labeling_function_wrapper and
-// Implicit_vector_to_labeling_function_wrapper class declaration
-// and implementation.
-//
-// See classes description to have more information.
-//******************************************************************************
-
-#ifndef CGAL_MESH_3_IMPLICIT_TO_LABELED_FUNCTION_WRAPPER_H
-#define CGAL_MESH_3_IMPLICIT_TO_LABELED_FUNCTION_WRAPPER_H
-
-#if defined(BOOST_MSVC)
-#  pragma warning(push)
-#  pragma warning(disable:4180) // qualifier applied to function type has no meaning; ignored
-#endif
-
-#define CGAL_DEPRECATED_HEADER "<CGAL/Mesh_3/Implicit_to_labeled_function_wrapper.h>"
-#define CGAL_REPLACEMENT_HEADER "<CGAL/Implicit_to_labeling_function_wrapper.h>"
-#include <CGAL/internal/deprecation_warning.h>
-
-#include <vector>
-
-namespace CGAL {
-
-namespace Mesh_3 {
-
-#include <CGAL/config.h>
-
-/**
- * @class Implicit_to_labeled_function_wrapper
- *
- * This class is designed to wrap an implicit function which describes a domain
- * by [p is inside if f(p)<0] to a function which takes its values into {0,1}.
- * f(p)=0 means that p is outside the domain.
- */
-template<class Function_, class BGT>
-class Implicit_to_labeled_function_wrapper
-{
-public:
-  // Types
-  typedef int                     return_type;
-  typedef typename BGT::Point_3   Point_3;
-
-  /// Constructor
-  Implicit_to_labeled_function_wrapper(const Function_& f)
-    : r_f_(f) {}
-
-  // Default copy constructor and assignment operator are ok
-
-  /// Destructor
-  ~Implicit_to_labeled_function_wrapper() {}
-
-  /// Operator ()
-  return_type operator()(const Point_3& p, const bool = true) const
-  {
-    return ( (r_f_(p)<0) ? 1 : 0 );
-  }
-
-private:
-  /// Function to wrap
-  const Function_& r_f_;
-
-};  // end class Implicit_to_labeled_function_wrapper
-
-
-
-/**
- * \deprecated
- *
- * @class Implicit_vector_to_labeled_function_wrapper
- *
- * Wraps a set of implicit function [f1,f2,...] to one function F which
- * takes its values into N.
- *
- * Let p be a point.
- * F(p) = 0b000000(f2(p)<0)(f1(p)<0)
- *
- * It can handle at most 8 functions.
- */
-template<class Function_, class BGT>
-class Implicit_vector_to_labeled_function_wrapper
-{
-public:
-  // Types
-  typedef int                       return_type;
-  typedef std::vector<Function_*>   Function_vector;
-  typedef typename BGT::Point_3     Point_3;
-
-  /// Constructor
-  Implicit_vector_to_labeled_function_wrapper(const std::vector<Function_*>& v)
-    : function_vector_(v) {}
-
-  // Default copy constructor and assignment operator are ok
-
-  /// Destructor
-  ~Implicit_vector_to_labeled_function_wrapper() {}
-
-  /// Operator ()
-  return_type operator()(const Point_3& p, const bool = true) const
-  {
-    int nb_func = static_cast<int>(function_vector_.size());
-    if ( nb_func > 8 )
-    {
-      CGAL_error_msg("We support at most 8 functions !");
-    }
-
-    char bits = 0;
-    for ( int i = 0 ; i < nb_func ; ++i )
-    {
-      // Insert value into bits : we compute fi(p) and insert result at
-      // bit i of bits
-      bits |= ( ((*function_vector_[i])(p) < 0) << i );
-    }
-
-    return ( static_cast<return_type>(bits) );
-  }
-
-private:
-  /// Functions to wrap
-  const Function_vector function_vector_;
-
-};  // end class Implicit_to_labeled_function_wrapper
-
-}  // end namespace Mesh_3
-
-}  // end namespace CGAL
-
-
-
-#if defined(BOOST_MSVC)
-#  pragma warning(pop)
-#endif
-
-#endif // CGAL_MESH_3_IMPLICIT_TO_LABELED_FUNCTION_WRAPPER_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Mesh_complex_3_in_triangulation_3_base.h b/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Mesh_complex_3_in_triangulation_3_base.h
deleted file mode 100644
index 0b9a670..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Mesh_complex_3_in_triangulation_3_base.h
+++ /dev/null
@@ -1,949 +0,0 @@
-// Copyright (c) 2003-2009  INRIA Sophia-Antipolis (France).
-// Copyright (c) 2013       GeometryFactory Sarl (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
-// 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(s)     : Laurent Rineau, Stéphane Tayeb
-//
-//******************************************************************************
-// File Description : Implements class Mesh_complex_3_in_triangulation_3.
-//******************************************************************************
-
-#ifndef CGAL_MESH_3_MESH_COMPLEX_3_IN_TRIANGULATION_3_BASE_H
-#define CGAL_MESH_3_MESH_COMPLEX_3_IN_TRIANGULATION_3_BASE_H
-
-#include <CGAL/Mesh_3/config.h>
-
-#include <CGAL/Mesh_3/utilities.h>
-#include <CGAL/iterator.h>
-#include <CGAL/IO/File_medit.h>
-#include <CGAL/IO/File_maya.h>
-#include <CGAL/Bbox_3.h>
-#include <iostream>
-#include <fstream>
-#include <CGAL/Mesh_3/io_signature.h>
-#include <CGAL/Union_find.h>
-
-#ifdef CGAL_LINKED_WITH_TBB
-  #include <tbb/atomic.h>
-#endif
-
-namespace CGAL {
-namespace Mesh_3 {
-
-  namespace details {
-
-    template <typename Tr>
-    class C3t3_helper_class
-    {
-    protected:
-      typedef typename Tr::Vertex_handle Vertex_handle;
-      typedef typename Tr::Cell_handle   Cell_handle;
-      typedef typename Tr::Facet         Facet;
-      typedef typename Tr::Edge          Edge;
-
-      typedef std::pair<Vertex_handle, Vertex_handle> Pair_of_vertices;
-
-      // computes and return an ordered pair of Vertex
-      Pair_of_vertices
-      make_ordered_pair(const Vertex_handle vh1, const Vertex_handle vh2) const {
-	if (vh1 < vh2) {
-	  return std::make_pair(vh1, vh2);
-	}
-	else {
-	  return std::make_pair(vh2, vh1);
-	}
-      }
-
-      // same from an Edge
-      Pair_of_vertices
-      make_ordered_pair(const Edge e) const {
-        return make_ordered_pair(e.first->vertex(e.second),
-                                 e.first->vertex(e.third));
-      }
-
-      Facet canonical_facet(Cell_handle c, int i) const {
-        Cell_handle c2 = c->neighbor(i);
-        return (c2 < c) ? std::make_pair(c2,c2->index(c)) : std::make_pair(c,i);
-      }
-
-    }; // end class template C3t3_helper_class
-
-  } // end namespace Mesh_3::details
-
-/**
- * @class Mesh_complex_3_in_triangulation_3_base
- * @brief A data-structure to represent and maintain a 3D complex embedded
- * in a 3D triangulation.
- */
-template<typename Tr, typename Concurrency_tag>
-class Mesh_complex_3_in_triangulation_3_base
-  : public details::C3t3_helper_class<Tr>
-{
-  typedef Mesh_complex_3_in_triangulation_3_base<Tr, Concurrency_tag> Self;
-  typedef details::C3t3_helper_class<Tr> Base;
-
-public:
-  // Triangulation types
-  typedef Tr                            Triangulation;
-  typedef typename Tr::Vertex_handle    Vertex_handle;
-  typedef typename Tr::Cell_handle      Cell_handle;
-  typedef typename Tr::Facet            Facet;
-  typedef typename Tr::Edge             Edge;
-  typedef typename Tr::size_type        size_type;
-
-  // Indices types
-  typedef typename Tr::Cell::Subdomain_index      Subdomain_index;
-  typedef typename Tr::Cell::Surface_patch_index  Surface_patch_index;
-  typedef typename Tr::Vertex::Index              Index;
-
-  enum Face_status{ NOT_IN_COMPLEX = 0,
-                    ISOLATED = 1, // - An ISOLATED edge is a marked edge,
-                                  //   without any incident facets.
-                    BOUNDARY,     // - An edge is on BOUNDARY if it has only
-                                  //   one incident facet.
-                                  // - A vertex is on BOUNDARY if all its
-                                  //   incident edges are REGULAR or on
-                                  //   BOUNDARY, at least one is on
-                                  //   BOUNDARY, and the incident facets
-                                  //   form only one connected component.
-                    REGULAR,      // - A facet that is in the complex is
-                                  //   REGULAR.
-                                  // - An edge is REGULAR if it has
-                                  //   exactly two incident facets.
-                                  // - A vertex is REGULAR if all it
-                                  //   incident edges are REGULAR, and the
-                                  //   incident facets form only one
-                                  //   connected component.
-                    SINGULAR};    // - SINGULAR is for all other cases.
-
-  //-------------------------------------------------------
-  // Constructors / Destructors
-  //-------------------------------------------------------
-  /**
-   * @brief Constructor
-   * Builds an empty 3D complex.
-   */
-  Mesh_complex_3_in_triangulation_3_base()
-    : Base()
-    , tr_()
-    , edge_facet_counter_() //TODO: parallel!
-    , manifold_info_initialized_(false) //TODO: parallel!
-  {
-    // We don't put it in the initialization list because
-    // tbb::atomic has no contructors
-    number_of_facets_ = 0;
-    number_of_cells_ = 0;
-  }
-
-  /// Copy constructor
-  Mesh_complex_3_in_triangulation_3_base(const Self& rhs)
-    : Base()
-    , tr_(rhs.tr_)
-    , edge_facet_counter_(rhs.edge_facet_counter_)
-    , manifold_info_initialized_(rhs.manifold_info_initialized_)
-  {
-    number_of_facets_ = rhs.number_of_facets_;
-    number_of_cells_ = rhs.number_of_cells_;
-  }
-
-  /// Destructor
-  ~Mesh_complex_3_in_triangulation_3_base() {}
-
-  void clear() {
-    number_of_cells_ = 0;
-    number_of_facets_ = 0;
-    tr_.clear();
-    manifold_info_initialized_ = false;
-    edge_facet_counter_.clear();
-  }
-
-  /// Assignment operator
-  Self& operator=(Self rhs)
-  {
-    swap(rhs);
-    return *this;
-  }
-
-  /// Returns the reference to the triangulation
-  Triangulation& triangulation() { return tr_; }
-  /// Returns a const reference to the triangulation
-  const Triangulation& triangulation() const { return tr_; }
-
-
-  /// Adds facet \c facet to the 2D complex, with surface index \c index
-  void add_to_complex(const Facet& facet, const Surface_patch_index& index)
-  {
-    add_to_complex(facet.first, facet.second, index);
-  }
-
-  /// Adds facet(\c cell, \c i) to the 2D complex, with surface index \c index
-  void add_to_complex(const Cell_handle& cell,
-                      const int i,
-                      const Surface_patch_index& index);
-
-  /// Removes facet \c facet from 2D complex
-  void remove_from_complex(const Facet& facet);
-
-  /// Removes facet(\c cell, \c i) from 2D complex
-  void remove_from_complex(const Cell_handle& c, const int i) {
-    remove_from_complex(Facet(c, i));
-  }
-
-  /// Sets surface index of facet \c facet to \c index
-  void set_surface_patch_index(const Facet& f, const Surface_patch_index& index)
-  {
-    set_surface_patch_index(f.first, f.second, index);
-  }
-
-  /// Sets surface index of facet(\c cell, \c i) to \c index
-  void set_surface_patch_index(const Cell_handle& cell,
-                         const int i,
-                         const Surface_patch_index& index) const
-  {
-    cell->set_surface_patch_index(i, index);
-  }
-
-  /// Returns `NOT_IN_COMPLEX`, `BOUNDARY`, `REGULAR`, or `SINGULAR`,
-  /// depending on the number of incident facets in the complex, and the
-  /// number of connected components of its link
-  Face_status face_status(const Vertex_handle v) const
-  {
-    if(!manifold_info_initialized_) init_manifold_info();
-    const std::size_t n = v->cached_number_of_incident_facets();
-
-    if(n == 0) return NOT_IN_COMPLEX;
-
-    //test incident edges for REGULARITY and count BOUNDARY edges
-    typename std::vector<Edge> edges;
-    edges.reserve(64);
-    tr_.incident_edges(v, std::back_inserter(edges));
-    int number_of_boundary_incident_edges = 0; // could be a bool
-    for (typename std::vector<Edge>::iterator
-           eit=edges.begin(), end = edges.end();
-	 eit != end; eit++)
-    {
-      switch( face_status(*eit) )
-      {
-      case NOT_IN_COMPLEX: case REGULAR: break;
-      case BOUNDARY: ++number_of_boundary_incident_edges; break;
-      default :
-#ifdef CGAL_MESHES_DEBUG_REFINEMENT_POINTS
-        std::cerr << "singular edge...\n";
-        std::cerr << v->point() << std::endl;
-#endif // CGAL_MESHES_DEBUG_REFINEMENT_POINTS
-        return SINGULAR;
-      }
-    }
-
-    // From here all incident edges (in complex) are REGULAR or BOUNDARY.
-    const std::size_t nb_components = union_find_of_incident_facets(v);
-    if(nb_components > 1) {
-#ifdef CGAL_MESHES_DEBUG_REFINEMENT_POINTS
-      std::cerr << "singular vertex: nb_components=" << nb_components << std::endl;
-      std::cerr << v->point() << std::endl;
-#endif // CGAL_MESHES_DEBUG_REFINEMENT_POINTS
-      return SINGULAR;
-    }
-    else { // REGULAR OR BOUNDARY
-#ifdef CGAL_MESHES_DEBUG_REFINEMENT_POINTS
-      std::cerr << "regular or boundary: " << v->point() << std::endl;
-#endif // CGAL_MESHES_DEBUG_REFINEMENT_POINTS
-      if (number_of_boundary_incident_edges != 0)
-        return BOUNDARY;
-      else
-        return REGULAR;
-    }
-  }
-
-  /// This function should be called only when incident edges
-  /// are known to be REGULAR OR BOUNDARY
-  bool is_regular_or_boundary_for_vertices(Vertex_handle v) const {
-    return union_find_of_incident_facets(v) == 1;
-  }
-
-  /// Returns `NOT_IN_COMPLEX`, `BOUNDARY`, `REGULAR`, or `SINGULAR`,
-  /// depending on the number of incident facets in the complex
-  Face_status face_status(const Edge& edge) const
-  {
-    if(!manifold_info_initialized_) init_manifold_info();
-
-    switch(edge_facet_counter_[this->make_ordered_pair(edge)])
-    {
-    case 0: return NOT_IN_COMPLEX;
-    case 1: return BOUNDARY;
-    case 2: return REGULAR;
-    default: return SINGULAR;
-    }
-  }
-
-  /// Returns true if the vertex \c v has is incident to at least a facet
-  /// of the complex
-  bool has_incident_facets_in_complex(const Vertex_handle& v) const
-  {
-    if(!manifold_info_initialized_) init_manifold_info();
-    return v->cached_number_of_incident_facets() > 0;
-  }
-
-  /// Returns true if facet \c facet is in complex
-  bool is_in_complex(const Facet& facet) const
-  {
-    return is_in_complex(facet.first, facet.second);
-  }
-
-  /// Returns true if facet (\c cell, \c i) is in 2D complex
-  bool is_in_complex(const Cell_handle& cell, const int i) const
-  {
-    return ( cell->is_facet_on_surface(i) );
-  }
-
-  /// Returns surface index of facet \c f
-  Surface_patch_index surface_patch_index(const Facet& f) const
-  {
-    return surface_patch_index(f.first,f.second);
-  }
-
-  /// Returns surface index of facet(\c cell, \c i)
-  Surface_patch_index surface_patch_index(const Cell_handle& cell,
-                                          const int i) const
-  {
-    return cell->surface_patch_index(i);
-  }
-
-  /// Returns the number of surface facets of the mesh
-  size_type number_of_facets_in_complex() const { return number_of_facets_; }
-
-  /// Adds cell \c cell to the 3D complex, with subdomain index \c index
-  void add_to_complex(const Cell_handle& cell, const Subdomain_index& index)
-  {
-    CGAL_precondition( !( index == Subdomain_index() ) );
-
-    if ( ! is_in_complex(cell) )
-    {
-      set_subdomain_index(cell, index);
-      ++number_of_cells_;
-    }
-  }
-
-  /// Removes cell \c cell from the 3D complex
-  void remove_from_complex(const Cell_handle& cell)
-  {
-    if ( is_in_complex(cell) )
-    {
-      set_subdomain_index(cell, Subdomain_index());
-      --number_of_cells_;
-    }
-  }
-
-
-  /// Sets subdomain index of cell \c cell to \c index
-  void set_subdomain_index(const Cell_handle& cell,
-                           const Subdomain_index& index) const
-  {
-    cell->set_subdomain_index(index);
-  }
-
-  /// Sets index of vertex \c vertex to \c index
-  void set_index(const Vertex_handle& vertex, const Index& index) const
-  {
-    vertex->set_index(index);
-  }
-
-  /// Sets dimension of vertex \c vertex to \c dimension
-  void set_dimension(const Vertex_handle& vertex, int dimension) const
-  {
-    vertex->set_dimension(dimension);
-  }
-
-  /// Returns the number of cells which belongs to the 3D complex
-  size_type number_of_cells_in_complex() const
-  {
-    return number_of_cells_;
-  }
-
-  /// Returns \c true if cell \c cell belongs to the 3D complex
-  bool is_in_complex(const Cell_handle& cell) const
-  {
-    return !( subdomain_index(cell) == Subdomain_index() );
-  }
-
-  /// Returns the subdomain index of cell \c cell
-  Subdomain_index subdomain_index(const Cell_handle& cell) const
-  {
-    return cell->subdomain_index();
-  }
-
-  /// Returns the dimension of the lowest dimensional face of the input 3D
-  /// complex that contains the vertex
-  int in_dimension(const Vertex_handle& v) const { return v->in_dimension(); }
-
-  /// Returns the index of vertex \c v
-  Index index(const Vertex_handle& v) const { return v->index(); }
-
-  /// Outputs the mesh to medit
-  void output_to_medit(std::ostream& os,
-                       bool rebind = true,
-                       bool show_patches = false) const
-  {
-    // Call global function
-    CGAL::output_to_medit(os,*this,rebind,show_patches);
-  }
-  
-  /// Outputs the mesh to maya
-  void output_to_maya(std::ofstream& os,
-                      bool surfaceOnly = true) const
-  {
-    // Call global function
-    CGAL::output_to_maya(os,*this,surfaceOnly);
-  }
-
-  //-------------------------------------------------------
-  // Undocumented features
-  //-------------------------------------------------------
-  /**
-   * @brief insert \c [first,last[ in the triangulation (with dimension 2)
-   * @param first the iterator on the first point to insert
-   * @param last the iterator past the last point to insert
-   *
-   * InputIterator value type must be \c std::pair<Tr::Point,Index>
-   */
-  template <typename InputIterator>
-  void insert_surface_points(InputIterator first, InputIterator last)
-  {
-    while ( first != last )
-    {
-      Vertex_handle vertex = tr_.insert((*first).first);
-      vertex->set_index((*first).second);
-      vertex->set_dimension(2);
-      ++first;
-    }
-  }
-
-  /**
-   * @brief insert \c [first,last[ in the triangulation (with dimension 2 and
-   * index \c default_index)
-   * @param first the iterator on the first point to insert
-   * @param last the iterator past the last point to insert
-   * @param default_index the index to be used to insert points
-   *
-   * InputIterator value type must be \c Tr::Point
-   */
-  template <typename InputIterator>
-  void insert_surface_points(InputIterator first,
-                             InputIterator last,
-                             const Index& default_index)
-  {
-    while ( first != last )
-    {
-      Vertex_handle vertex = tr_.insert(*first);
-      vertex->set_index(default_index);
-      vertex->set_dimension(2);
-      ++first;
-    }
-  }
-
-  /// Swaps this & rhs
-  void swap(Self& rhs)
-  {
-    std::swap(rhs.number_of_facets_, number_of_facets_);
-    tr_.swap(rhs.tr_);
-    std::swap(rhs.number_of_cells_, number_of_cells_);
-  }
-
-  /// Returns bbox
-  Bbox_3 bbox() const;
-
-  void clear_manifold_info() {
-    edge_facet_counter_.clear();
-    manifold_info_initialized_ = false;
-  }
-
-private:
-  void init_manifold_info() const {
-    for(typename Tr::All_vertices_iterator
-          vit = triangulation().finite_vertices_begin(),
-          end = triangulation().finite_vertices_end();
-        vit != end; ++vit)
-    {
-      vit->set_c2t3_cache(0, -1);
-    }
-
-    edge_facet_counter_.clear();
-
-    for(typename Tr::Finite_facets_iterator
-          fit = triangulation().finite_facets_begin(),
-          end = triangulation().finite_facets_end();
-        fit != end; ++fit)
-    {
-      if ( is_in_complex(*fit) ) {
-        const Cell_handle cell = fit->first;
-        const int i = fit->second;
-        for(int j = 0; j < 3; ++j)
-        {
-          const int edge_index_va = tr_.vertex_triple_index(i, j);
-          const int edge_index_vb = tr_.vertex_triple_index(i, (j == 2) ? 0 : (j+1));
-          const Vertex_handle edge_va = cell->vertex(edge_index_va);
-          const Vertex_handle edge_vb = cell->vertex(edge_index_vb);
-          ++edge_facet_counter_[this->make_ordered_pair(edge_va, edge_vb)];
-
-          const std::size_t n = edge_va->cached_number_of_incident_facets();
-          edge_va->set_c2t3_cache(n+1, -1);
-        }
-      }
-    }
-    manifold_info_initialized_ = true;
-  }
-
-  /// Extract the subset `F` of facets of the complex incident to `v` and
-  /// return the number of connected component of the adjacency graph of `F`.
-  std::size_t union_find_of_incident_facets(const Vertex_handle v) const
-  {
-    if( v->is_c2t3_cache_valid() )
-    {
-      const std::size_t n = v->cached_number_of_components();
-      if(n != std::size_t(-1)) return n;
-    }
-
-    Union_find<Facet> facets;
-    { // fill the union find
-      std::vector<Facet> non_filtered_facets;
-      tr_.incident_facets(v, std::back_inserter(non_filtered_facets));
-
-      for(typename std::vector<Facet>::iterator
-            fit = non_filtered_facets.begin(),
-            end = non_filtered_facets.end();
-          fit != end; ++fit)
-      {
-        if(is_in_complex(*fit)) facets.push_back(*fit);
-      }
-    }
-
-    typedef std::map<Vertex_handle,
-                     typename Union_find<Facet>::handle> Vertex_set_map;
-    typedef typename Vertex_set_map::iterator Vertex_set_map_iterator;
-
-    Vertex_set_map vsmap;
-
-    for(typename Union_find<Facet>::iterator
-          it = facets.begin(), end = facets.end();
-        it != end; ++it)
-    {
-      const Cell_handle& ch = (*it).first;
-      const int& i = (*it).second;
-      for(int j=0; j < 3; ++j) {
-	const Vertex_handle w = ch->vertex(tr_.vertex_triple_index(i,j));
-	if(w != v){
-	  Vertex_set_map_iterator vsm_it = vsmap.find(w);
-	  if(vsm_it != vsmap.end()){
-	    facets.unify_sets(vsm_it->second, it);
-	  } else {
-	    vsmap.insert(std::make_pair(w, it));
-	  }
-	}
-      }
-    }
-    const std::size_t nb_components = facets.number_of_sets();
-
-    const std::size_t n = v->cached_number_of_incident_facets();
-    v->set_c2t3_cache(n, nb_components);
-    return nb_components;
-  }
-  
-  //-------------------------------------------------------
-  // Traversal
-  //-------------------------------------------------------
-private:
-  typedef Mesh_3::internal::Iterator_not_in_complex<Self> Iterator_not_in_complex;
-
-  class Facet_iterator_not_in_complex
-  {
-    const Self* c3t3_;
-    Surface_patch_index index_; //need by SWIG: should be const Surface_patch_index
-  public:
-    Facet_iterator_not_in_complex(){} //need by SWIG
-    Facet_iterator_not_in_complex(const Self& c3t3,
-                                  const Surface_patch_index& index = Surface_patch_index())
-      : c3t3_(&c3t3)
-      , index_(index) { }
-
-    template <typename Iterator>
-    bool operator()(Iterator it) const
-    {
-      if ( index_ == Surface_patch_index() ) { return ! c3t3_->is_in_complex(*it); }
-      else { return !( c3t3_->surface_patch_index(*it) == index_ );  }
-    }
-  };
-
-  /**
-   * @class Cell_not_in_complex
-   * @brief A class to filter cells which do not belong to the complex
-   */
-  class Cell_not_in_complex
-  {
-    const Self* r_self_;
-    Subdomain_index index_;//needed by SWIG, should be const Subdomain_index
-  public:
-    Cell_not_in_complex(){}//needed by SWIG
-    Cell_not_in_complex(const Self& self,
-                        const Subdomain_index& index = Subdomain_index())
-      : r_self_(&self)
-      , index_(index) { }
-
-    bool operator()(Cell_handle ch) const
-    {
-      if ( index_ == Subdomain_index() ) { return !r_self_->is_in_complex(ch); }
-      else { return !( r_self_->subdomain_index(ch) == index_ ); }
-    }
-  }; // end class Cell_not_in_complex
-
-public:
-  /// Iterator type to visit the facets of the 2D complex.
-  typedef Filter_iterator<
-    typename Triangulation::Finite_facets_iterator,
-    Facet_iterator_not_in_complex >               Facets_in_complex_iterator;
-
-  /// Returns a Facets_in_complex_iterator to the first facet of the 2D complex
-  Facets_in_complex_iterator facets_in_complex_begin() const
-  {
-    return CGAL::filter_iterator(tr_.finite_facets_end(),
-                                 Facet_iterator_not_in_complex(*this),
-                                 tr_.finite_facets_begin());
-  }
-
-  /// Returns a Facets_in_complex_iterator to the first facet of the 2D complex
-  Facets_in_complex_iterator
-  facets_in_complex_begin(const Surface_patch_index& index) const
-  {
-    return CGAL::filter_iterator(tr_.finite_facets_end(),
-                                 Facet_iterator_not_in_complex(*this,index),
-                                 tr_.finite_facets_begin());
-  }
-
-  /// Returns past-the-end iterator on facet of the 2D complex
-  Facets_in_complex_iterator facets_in_complex_end(const Surface_patch_index = Surface_patch_index()) const
-  {
-    return CGAL::filter_iterator(tr_.finite_facets_end(),
-                                 Facet_iterator_not_in_complex(*this));
-  }
-
-  /**
-   * @class Cells_in_complex_iterator
-   * @brief Iterator type to visit the cells of triangulation belonging
-   * to the 3D complex
-   *
-   * This class is usefull to ensure that Cells_in_complex_iterator is convertible
-   * to Cell_handle
-   */
-  class Cells_in_complex_iterator :
-    public Filter_iterator<typename Triangulation::Finite_cells_iterator,
-                           Cell_not_in_complex>
-  {
-  private:
-    typedef typename Triangulation::Finite_cells_iterator Tr_iterator;
-    typedef Filter_iterator<typename Triangulation::Finite_cells_iterator,
-                            Cell_not_in_complex> Base;
-    typedef Cells_in_complex_iterator Self;
-
-  public:
-    Cells_in_complex_iterator() : Base() { }
-    Cells_in_complex_iterator(Base i) : Base(i) { }
-
-    Self& operator++() { Base::operator++(); return *this; }
-    Self& operator--() { Base::operator--(); return *this; }
-    Self operator++(int) { Self tmp(*this); ++(*this); return tmp; }
-    Self operator--(int) { Self tmp(*this); --(*this); return tmp; }
-
-    operator Cell_handle() const { return Cell_handle(this->base()); }
-  }; // end class Cells_in_complex_iterator
-
-
-  /// Returns a \c Cells_in_complex_iterator to the first cell of the 3D complex
-  Cells_in_complex_iterator cells_in_complex_begin() const
-  {
-    return CGAL::filter_iterator(tr_.finite_cells_end(),
-                                 Cell_not_in_complex(*this),
-                                 tr_.finite_cells_begin());
-  }
-
-  /// Returns a \c Cells_in_complex_iterator to the first cell of the 3D complex
-  Cells_in_complex_iterator
-  cells_in_complex_begin(const Subdomain_index& index) const
-  {
-    return CGAL::filter_iterator(tr_.finite_cells_end(),
-                                 Cell_not_in_complex(*this,index),
-                                 tr_.finite_cells_begin());
-  }
-
-  /// Returns the past-the-end iterator for the cells of the 3D complex
-  Cells_in_complex_iterator cells_in_complex_end() const
-  {
-    return CGAL::filter_iterator(tr_.finite_cells_end(),
-                                 Cell_not_in_complex(*this));
-  }
-
-  // -----------------------------------
-  // Backward Compatibility
-  // -----------------------------------
-#ifndef CGAL_MESH_3_NO_DEPRECATED_SURFACE_INDEX
-  typedef Surface_patch_index   Surface_index;
-
-  void set_surface_index(const Facet& f, const Surface_index& index)
-  { set_surface_patch_index(f, index); }
-
-  void set_surface_index(const Cell_handle& c, const int i, const Surface_index& index)
-  { set_surface_patch_index(c,i,index); }
-
-  Surface_index surface_index(const Facet& f) const
-  { return surface_patch_index(f); }
-
-  Surface_index surface_index(const Cell_handle& c, const int i) const
-  { return surface_patch_index(c,i); }
-#endif // CGAL_MESH_3_NO_DEPRECATED_SURFACE_INDEX
-
-#ifndef CGAL_MESH_3_NO_DEPRECATED_C3T3_ITERATORS
-  typedef Facets_in_complex_iterator  Facet_iterator;
-  typedef Cells_in_complex_iterator   Cell_iterator;
-
-  Facet_iterator facets_begin() const
-  { return facets_in_complex_begin(); }
-
-  Facet_iterator facets_end() const
-  { return facets_in_complex_end(); }
-
-  Cell_iterator cells_begin() const
-  { return cells_in_complex_begin(); }
-
-  Cell_iterator cells_end() const
-  { return cells_in_complex_end(); }
-#endif // CGAL_MESH_3_NO_DEPRECATED_C3T3_ITERATORS
-  // -----------------------------------
-  // End backward Compatibility
-  // -----------------------------------
-
-  size_type number_of_facets() const
-  { return number_of_facets_in_complex(); }
-
-  size_type number_of_cells() const
-  { return number_of_cells_in_complex(); }
-
-public:
-  template <typename Tr2, typename Ct2>
-  friend
-  std::istream &
-  operator>> (std::istream& is,
-              Mesh_complex_3_in_triangulation_3_base<Tr2,Ct2> &c3t3);
-
-  static
-  std::string io_signature()
-  {
-    return
-      Get_io_signature<Tr>()();
-  }
-private:
-
-  // Sequential: non-atomic
-  // "dummy" is here to allow the specialization (see below)
-  // See http://groups.google.com/group/comp.lang.c++.moderated/browse_thread/thread/285ab1eec49e1cb6
-  template<typename Concurrency_tag2, typename dummy = void>
-  struct Number_of_elements
-  {
-    typedef size_type type;
-  };
-#ifdef CGAL_LINKED_WITH_TBB
-  // Parallel: atomic
-  template<typename dummy>
-  struct Number_of_elements<Parallel_tag, dummy>
-  {
-    typedef tbb::atomic<size_type> type;
-  };
-#endif // CGAL_LINKED_WITH_TBB
-
-  // Private date members
-  Triangulation tr_;
-
-  typedef typename Base::Pair_of_vertices Pair_of_vertices;
-  typedef std::map<Pair_of_vertices, int> Edge_facet_counter;
-
-  mutable Edge_facet_counter edge_facet_counter_;
-
-  typename Number_of_elements<Concurrency_tag>::type number_of_facets_;
-  typename Number_of_elements<Concurrency_tag>::type number_of_cells_;
-
-  mutable bool manifold_info_initialized_;
-};  // end class Mesh_complex_3_in_triangulation_3_base
-
-
-template <typename Tr, typename Ct>
-void
-Mesh_complex_3_in_triangulation_3_base<Tr,Ct>::add_to_complex(
-    const Cell_handle& cell,
-    const int i,
-    const Surface_patch_index& index)
-{
-  CGAL_precondition( !( index == Surface_patch_index() ) );
-
-  if ( ! is_in_complex(cell,i) )
-  {
-    Facet mirror = tr_.mirror_facet(std::make_pair(cell,i));
-    set_surface_patch_index(cell, i, index);
-    set_surface_patch_index(mirror.first, mirror.second, index);
-    ++number_of_facets_;
-    if(manifold_info_initialized_) {
-      for(int j = 0; j < 3; ++j)
-      {
-        int edge_index_va = tr_.vertex_triple_index(i, j);
-        int edge_index_vb = tr_.vertex_triple_index(i, (j == 2) ? 0 : (j+1));
-        Vertex_handle edge_va = cell->vertex(edge_index_va);
-        Vertex_handle edge_vb = cell->vertex(edge_index_vb);
-        ++edge_facet_counter_[this->make_ordered_pair(edge_va, edge_vb)];
-
-        const std::size_t n = edge_va->cached_number_of_incident_facets();
-        const std::size_t m = edge_va->cached_number_of_components();
-        edge_va->set_c2t3_cache(n+1, m);
-      }
-      const int dimension_plus_1 = tr_.dimension() + 1;
-      // update c2t3 for vertices of f
-      for (int j = 0; j < dimension_plus_1; j++) {
-        if (j != i) {
-#ifdef CGAL_MESHES_DEBUG_REFINEMENT_POINTS
-          if(cell->vertex(j)->is_c2t3_cache_valid())
-            std::cerr << "(" << cell->vertex(j)->point() << ")->invalidate_c2t3_cache()\n";
-#endif // CGAL_MESHES_DEBUG_REFINEMENT_POINTS
-          cell->vertex(j)->invalidate_c2t3_cache();
-        }
-      }
-    }
-  }
-}
-
-
-template <typename Tr, typename Ct>
-void
-Mesh_complex_3_in_triangulation_3_base<Tr,Ct>::remove_from_complex(const Facet& facet)
-{
-  if ( is_in_complex(facet) )
-  {
-    Facet mirror = tr_.mirror_facet(facet);
-    set_surface_patch_index(facet.first, facet.second, Surface_patch_index());
-    set_surface_patch_index(mirror.first, mirror.second, Surface_patch_index());
-    --number_of_facets_;
-    if(manifold_info_initialized_) {
-      const Cell_handle cell = facet.first;
-      const int i = facet.second;
-      for(int j = 0; j < 3; ++j)
-      {
-        const int edge_index_va = tr_.vertex_triple_index(i, j);
-        const int edge_index_vb = tr_.vertex_triple_index(i, (j == 2) ? 0 : (j+1));
-        const Vertex_handle edge_va = cell->vertex(edge_index_va);
-        const Vertex_handle edge_vb = cell->vertex(edge_index_vb);
-        --edge_facet_counter_[this->make_ordered_pair(edge_va, edge_vb)];
-
-        const std::size_t n = edge_va->cached_number_of_incident_facets();
-        CGAL_assertion(n>0);
-        const std::size_t m = edge_va->cached_number_of_components();
-        edge_va->set_c2t3_cache(n-1, m);
-      }
-      const int dimension_plus_1 = tr_.dimension() + 1;
-      // update c2t3 for vertices of f
-      for (int j = 0; j < dimension_plus_1; j++) {
-        if (j != facet.second) {
-#ifdef CGAL_MESHES_DEBUG_REFINEMENT_POINTS
-          if(cell->vertex(j)->is_c2t3_cache_valid())
-            std::cerr << "(" << cell->vertex(j)->point() << ")->invalidate_c2t3_cache()\n";
-#endif // CGAL_MESHES_DEBUG_REFINEMENT_POINTS
-          cell->vertex(j)->invalidate_c2t3_cache();
-        }
-      }
-    }
-  }
-}
-
-
-// -----------------------------------
-// Undocumented
-// -----------------------------------
-template <typename Tr, typename Ct>
-Bbox_3
-Mesh_complex_3_in_triangulation_3_base<Tr,Ct>::
-bbox() const
-{
-  if ( 0 == triangulation().number_of_vertices() )
-  {
-    return Bbox_3();
-  }
-
-  typename Tr::Finite_vertices_iterator vit = tr_.finite_vertices_begin();
-  Bbox_3 result = (vit++)->point().bbox();
-
-  for(typename Tr::Finite_vertices_iterator end = tr_.finite_vertices_end();
-      vit != end ; ++vit)
-  {
-    result = result + vit->point().bbox();
-  }
-
-  return result;
-}
-
-template <typename Tr, typename Ct>
-std::ostream &
-operator<< (std::ostream& os,
-            const Mesh_complex_3_in_triangulation_3_base<Tr,Ct> &c3t3)
-{
-  return os << c3t3.triangulation();
-}
-
-
-template <typename Tr, typename Ct>
-std::istream &
-operator>> (std::istream& is,
-            Mesh_complex_3_in_triangulation_3_base<Tr,Ct> &c3t3)
-{
-  c3t3.clear();
-  is >> c3t3.triangulation();
-
-  if(!is) {
-    c3t3.clear();
-    return is;
-  }
-
-  for(typename Tr::Finite_facets_iterator
-        fit = c3t3.triangulation().finite_facets_begin(),
-        end = c3t3.triangulation().finite_facets_end();
-      fit != end; ++fit)
-  {
-    if ( c3t3.is_in_complex(*fit) ) {
-      ++c3t3.number_of_facets_;
-    }
-  }
-
-  for(typename Tr::Finite_cells_iterator
-        cit = c3t3.triangulation().finite_cells_begin(),
-        end = c3t3.triangulation().finite_cells_end();
-      cit != end; ++cit)
-  {
-    if ( c3t3.is_in_complex(cit) ) {
-      ++c3t3.number_of_cells_;
-    }
-  }
-
-  return is;
-}
-
-}  // end namespace Mesh_3
-}  // end namespace CGAL
-
-#endif // CGAL_MESH_3_MESH_COMPLEX_3_IN_TRIANGULATION_3_BASE_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Mesh_global_optimizer.h b/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Mesh_global_optimizer.h
deleted file mode 100644
index ee280da..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Mesh_global_optimizer.h
+++ /dev/null
@@ -1,1158 +0,0 @@
-// Copyright (c) 2009 INRIA Sophia-Antipolis (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
-// 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(s)     : Stephane Tayeb
-//
-//******************************************************************************
-// File Description :
-//******************************************************************************
-
-#ifndef CGAL_MESH_3_MESH_GLOBAL_OPTIMIZER_H
-#define CGAL_MESH_3_MESH_GLOBAL_OPTIMIZER_H
-
-#include <CGAL/Mesh_3/config.h>
-
-#include <CGAL/Real_timer.h>
-#include <CGAL/Mesh_3/C3T3_helpers.h>
-#include <CGAL/Mesh_3/Triangulation_helpers.h>
-#include <CGAL/Origin.h>
-#include <CGAL/Mesh_optimization_return_code.h>
-#include <CGAL/Mesh_3/Null_global_optimizer_visitor.h>
-#include <CGAL/Prevent_deref.h>
-#include <CGAL/tuple.h>
-
-#include <CGAL/Mesh_3/Concurrent_mesher_config.h>
-
-#ifdef CGAL_MESH_3_PROFILING
-  #include <CGAL/Mesh_3/Profiling_tools.h>
-#endif
-
-#include <vector>
-#include <list>
-#include <limits>
-
-#include <boost/type_traits/is_convertible.hpp>
-
-#ifdef CGAL_LINKED_WITH_TBB
-# include <tbb/atomic.h>
-# include <tbb/parallel_do.h>
-# include <tbb/concurrent_vector.h>
-#endif
-
-namespace CGAL {
-
-namespace Mesh_3 {
-
-
-/************************************************
-// Class Mesh_global_optimizer_base
-// Two versions: sequential / parallel
-************************************************/
-
-// Sequential
-template <typename Tr, typename Concurrency_tag>
-class Mesh_global_optimizer_base
-{
-protected:
-  typedef typename Tr::Geom_traits                          Gt;
-  typedef typename Gt::FT                                   FT;
-  typedef typename Tr::Lock_data_structure                  Lock_data_structure;
-
-  typedef std::vector<cpp11::tuple<
-    typename Tr::Vertex_handle, typename Tr::Point, FT> >   Moves_vector;
-  typedef unsigned int                                      Nb_frozen_points_type ;
-
-  Mesh_global_optimizer_base(const Bbox_3 &, int)
-    : big_moves_size_(0) {}
-
-  void update_big_moves(const FT& new_sq_move)
-  {
-    if (big_moves_.size() < big_moves_size_ )
-      big_moves_.insert(new_sq_move);
-    else
-    {
-      FT smallest = *(big_moves_.begin());
-      if( new_sq_move > smallest )
-      {
-        big_moves_.erase(big_moves_.begin());
-        big_moves_.insert(new_sq_move);
-      }
-    }
-  }
-
-  void clear_big_moves()
-  {
-    big_moves_.clear();
-  }
-
-  Lock_data_structure *get_lock_data_structure() { return 0; }
-  void unlock_all_elements() {}
-
-protected:
-  std::size_t big_moves_size_;
-  std::multiset<FT> big_moves_;
-};
-
-#ifdef CGAL_LINKED_WITH_TBB
-// Parallel
-template <typename Tr>
-class Mesh_global_optimizer_base<Tr, Parallel_tag>
-{
-protected:
-  typedef typename Tr::Geom_traits                          Gt;
-  typedef typename Gt::FT                                   FT;
-  typedef typename Tr::Lock_data_structure                  Lock_data_structure;
-  typedef tbb::concurrent_vector<cpp11::tuple<
-    typename Tr::Vertex_handle, typename Tr::Point, FT> >   Moves_vector;
-  typedef tbb::atomic<unsigned int>                         Nb_frozen_points_type ;
-
-  Mesh_global_optimizer_base(const Bbox_3 &bbox, int num_grid_cells_per_axis)
-    : big_moves_size_(0)
-    , m_lock_ds(bbox, num_grid_cells_per_axis)
-  {
-    big_moves_current_size_ = 0;
-    big_moves_smallest_ = std::numeric_limits<FT>::max();
-  }
-
-  void update_big_moves(const FT& new_sq_move)
-  {
-    if (++big_moves_current_size_ <= big_moves_size_ )
-    {
-      tbb::mutex::scoped_lock lock(m_big_moves_mutex);
-      typename std::multiset<FT>::const_iterator it = big_moves_.insert(new_sq_move);
-
-      // New smallest move of all big moves?
-      if (it == big_moves_.begin())
-        big_moves_smallest_ = new_sq_move;
-    }
-    else
-    {
-      --big_moves_current_size_;
-
-      if( new_sq_move > big_moves_smallest_ )
-      {
-        tbb::mutex::scoped_lock lock(m_big_moves_mutex);
-        // Test it again since it may have been modified by another
-        // thread in the meantime
-        if( new_sq_move > big_moves_smallest_ )
-        {
-          big_moves_.erase(big_moves_.begin());
-          typename std::multiset<FT>::const_iterator it = big_moves_.insert(new_sq_move);
-
-          // New smallest move of all big moves?
-          if (it == big_moves_.begin())
-            big_moves_smallest_ = new_sq_move;
-        }
-      }
-    }
-  }
-
-  void clear_big_moves()
-  {
-    big_moves_current_size_ = 0;
-    big_moves_smallest_ = std::numeric_limits<FT>::max();
-    big_moves_.clear();
-  }
-
-  Lock_data_structure *get_lock_data_structure()
-  {
-    return &m_lock_ds;
-  }
-
-  void unlock_all_elements()
-  {
-    m_lock_ds.unlock_all_points_locked_by_this_thread();
-  }
-
-public:
-
-protected:
-  tbb::atomic<std::size_t>  big_moves_current_size_;
-  tbb::atomic<FT>           big_moves_smallest_;
-  std::size_t               big_moves_size_;
-  std::multiset<FT>         big_moves_;
-  tbb::mutex                m_big_moves_mutex;
-
-  /// Lock data structure
-  Lock_data_structure m_lock_ds;
-};
-#endif // CGAL_LINKED_WITH_TBB
-
-
-
-
-/************************************************
-// Class Mesh_global_optimizer
-************************************************/
-
-template <typename C3T3,
-          typename MeshDomain,
-          typename MoveFunction,
-          typename Visitor_ = Null_global_optimizer_visitor<C3T3> >
-class Mesh_global_optimizer
-: public Mesh_global_optimizer_base<typename C3T3::Triangulation, typename C3T3::Concurrency_tag>
-{
-  // Types
-  typedef typename C3T3::Concurrency_tag Concurrency_tag;
-
-  typedef Mesh_global_optimizer<C3T3, MeshDomain, MoveFunction, Visitor_> Self;
-  typedef Mesh_global_optimizer_base<
-    typename C3T3::Triangulation, typename C3T3::Concurrency_tag>         Base;
-
-  using Base::get_lock_data_structure;
-  using Base::big_moves_;
-  using Base::big_moves_size_;
-
-  typedef typename C3T3::Triangulation  Tr;
-  typedef typename Tr::Geom_traits      Gt;
-
-  typedef typename Tr::Point            Point_3;
-  typedef typename Tr::Cell_handle      Cell_handle;
-  typedef typename Tr::Vertex_handle    Vertex_handle;
-  typedef typename Tr::Edge             Edge;
-  typedef typename Tr::Vertex           Vertex;
-
-  typedef typename Gt::FT               FT;
-  typedef typename Gt::Vector_3         Vector_3;
-
-  typedef typename std::vector<Cell_handle>                 Cell_vector;
-  typedef typename std::vector<Vertex_handle>               Vertex_vector;
-  typedef typename std::set<Vertex_handle>                  Vertex_set;
-  typedef typename Base::Moves_vector                       Moves_vector;
-  typedef typename Base::Nb_frozen_points_type              Nb_frozen_points_type;
-
-#ifdef CGAL_INTRUSIVE_LIST
-  typedef Intrusive_list<Cell_handle>   Outdated_cell_set;
-#else
-  typedef std::set<Cell_handle>         Outdated_cell_set;
-#endif //CGAL_INTRUSIVE_LIST
-
-#ifdef CGAL_INTRUSIVE_LIST
-  typedef Intrusive_list<Vertex_handle>  Moving_vertices_set;
-#else
-  typedef Vertex_set Moving_vertices_set;
-#endif
-
-  typedef typename MoveFunction::Sizing_field Sizing_field;
-
-  typedef class C3T3_helpers<C3T3,MeshDomain> C3T3_helpers;
-
-  // Visitor class
-  // Should define:
-  //  - after_compute_moves()
-  //  - after_move_points()
-  //  - after_rebuild_restricted_delaunay()
-  //  - end_of_iteration(int iteration_number)
-  typedef Visitor_ Visitor;
-
-public:
-  /**
-   * Constructor
-   */
-  Mesh_global_optimizer(C3T3& c3t3,
-                        const MeshDomain& domain,
-                        const FT& freeze_ratio,
-                        const bool do_freeze,
-                        const FT& convergence_ratio,
-                        const MoveFunction move_function = MoveFunction());
-
-  /**
-   * Launch optimization process
-   *
-   * @param nb_interations maximum number of iterations
-   */
-  Mesh_optimization_return_code operator()(int nb_iterations,
-                                           Visitor v = Visitor());
-
-  /**
-  * collects all vertices of the triangulation in moving_vertices
-  * (even the frozen ones)
-  */
-  void collect_all_vertices(Moving_vertices_set& moving_vertices);
-
-  /// Time accessors
-  void set_time_limit(double time) { time_limit_ = time; }
-  double time_limit() const { return time_limit_; }
-
-private:
-  /**
-   * Returns moves for vertices of set \c moving_vertices
-   */
-  Moves_vector compute_moves(Moving_vertices_set& moving_vertices)
-{
-  typename Gt::Construct_translated_point_3 translate =
-    Gt().construct_translated_point_3_object();
-
-  // Store new position of points which have to move
-  Moves_vector moves;
-
-
-  moves.reserve(moving_vertices.size());
-
-  // reset worst_move list
-  this->clear_big_moves();
-
-#ifdef CGAL_MESH_3_PROFILING
-  std::cerr << "Computing moves...";
-  WallClockTimer t;
-#endif
-
-
-#ifdef CGAL_LINKED_WITH_TBB
-  // Parallel
-  if (boost::is_convertible<Concurrency_tag, Parallel_tag>::value)
-  {
-    tbb::concurrent_vector<Vertex_handle> vertices_not_moving_any_more;
-
-    // Get move for each moving vertex
-    tbb::parallel_do(
-      moving_vertices.begin(), moving_vertices.end(),
-      Compute_move<Self, Sizing_field, Moves_vector,
-                   typename Gt::Construct_translated_point_3>(
-        *this, sizing_field_, moves, do_freeze_, vertices_not_moving_any_more,
-        translate)
-    );
-
-    typename tbb::concurrent_vector<Vertex_handle>::const_iterator it
-      = vertices_not_moving_any_more.begin();
-    typename tbb::concurrent_vector<Vertex_handle>::const_iterator it_end
-      = vertices_not_moving_any_more.end();
-    for ( ; it != it_end ; ++it)
-    {
-      moving_vertices.erase(*it);
-    }
-  }
-  // Sequential
-  else
-#endif // CGAL_LINKED_WITH_TBB
-  {
-    // Get move for each moving vertex
-    typename Moving_vertices_set::iterator vit = moving_vertices.begin();
-    for ( ; vit != moving_vertices.end() ; )
-    {
-      Vertex_handle oldv = *vit;
-      ++vit;
-      Vector_3 move = compute_move(oldv);
-
-      if ( CGAL::NULL_VECTOR != move )
-      {
-        Point_3 new_position = translate(oldv->point(),move);
-        FT size = (Sizing_field::is_vertex_update_needed ?
-          sizing_field_(new_position, oldv) : 0);
-        moves.push_back(cpp11::make_tuple(oldv,new_position,size));
-      }
-      else // CGAL::NULL_VECTOR == move
-      {
-        if(do_freeze_)
-          moving_vertices.erase(oldv); // TODO: if non-intrusive,
-                                       // we can optimize since we have the iterator,
-                                       // don't forget to do "vit = mv.erase(vit)" instead ++vit
-      }
-
-      // Stop if time_limit_ is reached
-      if ( is_time_limit_reached() )
-        break;
-    }
-  }
-
-#ifdef CGAL_MESH_3_PROFILING
-  std::cerr << "done in " << t.elapsed() << " seconds." << std::endl;
-#endif
-
-  return moves;
-}
-
-
-  /**
-   * Returns the move for vertex \c v
-   * warning : this function should be called only on moving vertices
-   *           even for frozen vertices, it could return a non-zero vector
-   */
-  Vector_3 compute_move(const Vertex_handle& v);
-
-  /**
-   * Updates mesh using moves of \c moves vector. Updates moving_vertices with
-   * the new set of moving vertices after the move.
-   */
-  void update_mesh(const Moves_vector& moves,
-                   Moving_vertices_set& moving_vertices,
-                   Visitor& visitor);
-
-  /**
-   * Fill sizing field using sizes (avg circumradius) contained in tr_
-   */
-  void fill_sizing_field();
-
-  /**
-   * Returns true if convergence is reached
-   */
-  bool check_convergence() const;
-
-  /**
-   * Returns the average circumradius length of cells incident to \c v
-   */
-  FT average_circumradius_length(const Vertex_handle& v) const;
-
-  /**
-   * Returns the minimum cicumradius length of cells incident to \c v
-   */
-  FT min_circumradius_sq_length(const Vertex_handle& v, const Cell_vector& incident_cells) const;
-
-  /**
-   * Returns the squared circumradius length of cell \c cell
-   */
-  FT sq_circumradius_length(const Cell_handle& cell,
-                            const Vertex_handle& v) const;
-
-  /**
-   * Returns true if time_limit is reached
-   */
-  bool is_time_limit_reached() const
-  {
-    return ( (time_limit() > 0) && (running_time_.time() > time_limit()) );
-  }
-
-private:
-
-#ifdef CGAL_LINKED_WITH_TBB
-  // Functor for compute_moves function
-  template <typename MGO, typename Sizing_field_, typename Moves_vector_,
-            typename CTOP3>
-  class Compute_move
-  {
-    typedef tbb::concurrent_vector<Vertex_handle> Vertex_conc_vector;
-
-    MGO                  & m_mgo;
-    const Sizing_field_  & m_sizing_field;
-    Moves_vector_        & m_moves;
-    bool                   m_do_freeze;
-    Vertex_conc_vector   & m_vertices_not_moving_any_more;
-    const CTOP3          & m_translate;
-
-  public:
-    // Constructor
-    Compute_move(MGO &mgo, 
-                 const Sizing_field_ &sizing_field,
-                 Moves_vector_ &moves,
-                 bool do_freeze,
-                 Vertex_conc_vector & vertices_not_moving_any_more,
-                 const CTOP3 & translate)
-    : m_mgo(mgo),
-      m_sizing_field(sizing_field),
-      m_moves(moves),
-      m_do_freeze(do_freeze),
-      m_vertices_not_moving_any_more(vertices_not_moving_any_more),
-      m_translate(translate)
-    {}
-
-    // Constructor
-    Compute_move(const Compute_move &cm)
-    : m_mgo(cm.m_mgo), 
-      m_sizing_field(cm.m_sizing_field), 
-      m_moves(cm.m_moves),
-      m_do_freeze(cm.m_do_freeze),
-      m_vertices_not_moving_any_more(cm.m_vertices_not_moving_any_more),
-      m_translate(cm.m_translate)
-    {}
-
-    // operator()
-    void operator()(const Vertex_handle& oldv) const
-    {
-      Vector_3 move = m_mgo.compute_move(oldv);
-
-      if ( CGAL::NULL_VECTOR != move )
-      {
-        Point_3 new_position = m_translate(oldv->point(), move);
-        FT size = (MGO::Sizing_field::is_vertex_update_needed ?
-          m_sizing_field(new_position, oldv) : 0);
-        // typedef Triangulation_helpers<typename C3T3::Triangulation> Th;
-        //if( !Th().inside_protecting_balls(tr_, oldv, new_position))
-        //note : this is not happening for Lloyd and ODT so it's commented
-        //       maybe for a new global optimizer it should be de-commented
-        m_moves.push_back(cpp11::make_tuple(oldv, new_position, size));
-      }
-      else // CGAL::NULL_VECTOR == move
-      {
-        if(m_do_freeze)
-        {
-          m_vertices_not_moving_any_more.push_back(oldv);
-        }
-      }
-
-      if ( m_mgo.is_time_limit_reached() )
-        tbb::task::self().cancel_group_execution();
-    }
-  };
-
-  // Functor for fill_sizing_field function
-  template <typename MGO, typename Tr_, typename Local_list_>
-  class Compute_sizing_field_value
-  {
-    MGO                  & m_mgo;
-    Local_list_          & m_local_lists;
-
-  public:
-    // Constructor
-    Compute_sizing_field_value(MGO &mgo, 
-                               Local_list_ & local_lists)
-    : m_mgo(mgo),
-      m_local_lists(local_lists)
-    {}
-
-    // Constructor
-    Compute_sizing_field_value(const Compute_sizing_field_value &csfv)
-    : m_mgo(csfv.m_mgo), 
-      m_local_lists(csfv.m_local_lists)
-    {}
-
-    // operator()
-    void operator()(Vertex& v) const
-    {
-      Vertex_handle vh 
-        = Tr_::Triangulation_data_structure::Vertex_range::s_iterator_to(v);
-      m_local_lists.local().push_back(
-        std::make_pair(v.point(), m_mgo.average_circumradius_length(vh)));
-    }
-  };
-
-  // Functor for update_mesh function
-  template <typename MGO, typename Helper, typename Tr_, typename Moves_vector_,
-            typename Moving_vertices_set_, typename Outdated_cell_set_>
-  class Move_vertex
-  {
-    MGO                                  & m_mgo;
-    const Helper                         & m_helper;
-    const Moves_vector_                  & m_moves;
-    Moving_vertices_set_                 & m_moving_vertices;
-    Outdated_cell_set_                   & m_outdated_cells;
-  
-    typedef typename Tr_::Point            Point_3;
-    typedef typename Tr_::Vertex_handle    Vertex_handle;
-
-  public:
-    // Constructor
-    Move_vertex(MGO &mgo, const Helper &helper, const Moves_vector_ &moves,
-                Moving_vertices_set_ &moving_vertices,
-                Outdated_cell_set_ &outdated_cells)
-    : m_mgo(mgo), m_helper(helper), m_moves(moves), 
-      m_moving_vertices(moving_vertices), m_outdated_cells(outdated_cells)
-    {}
-
-    // Constructor
-    Move_vertex(const Move_vertex &mv)
-    : m_mgo(mv.m_mgo), m_helper(mv.m_helper), m_moves(mv.m_moves),
-      m_moving_vertices(mv.m_moving_vertices),
-      m_outdated_cells(mv.m_outdated_cells)
-    {}
-
-    // operator()
-    void operator()( const tbb::blocked_range<size_t>& r ) const
-    {
-      for( size_t i = r.begin() ; i != r.end() ; ++i)
-      {
-        const Vertex_handle& v = cpp11::get<0>(m_moves[i]);
-        const Point_3& new_position = cpp11::get<1>(m_moves[i]);
-        // Get size at new position
-        if ( MGO::Sizing_field::is_vertex_update_needed )
-        {
-          //FT size = sizing_field_(new_position,v);
-          FT size = cpp11::get<2>(m_moves[i]);
-
-          // Move point
-          bool could_lock_zone;
-          Vertex_handle new_v = m_helper.move_point(
-            v, new_position, m_outdated_cells, m_moving_vertices, &could_lock_zone);
-          while (could_lock_zone == false)
-          {
-            new_v = m_helper.move_point(
-              v, new_position, m_outdated_cells, m_moving_vertices, &could_lock_zone);
-          }
-
-          // Restore size in meshing_info data
-          new_v->set_meshing_info(size);
-        }
-        else // Move point
-        {
-          bool could_lock_zone;
-          do {
-            m_helper.move_point(
-              v, new_position, m_outdated_cells, m_moving_vertices, &could_lock_zone);
-          } while (!could_lock_zone);
-        }
-
-        m_mgo.unlock_all_elements();
-
-        // Stop if time_limit_ is reached, here we can't return without rebuilding
-        // restricted delaunay
-        if ( m_mgo.is_time_limit_reached() )
-        {
-          tbb::task::self().cancel_group_execution();
-          break;
-        }
-      }
-    }
-  };
-#endif // CGAL_LINKED_WITH_TBB
-
-  // -----------------------------------
-  // Private data
-  // -----------------------------------
-  C3T3& c3t3_;
-  Tr& tr_;
-  const MeshDomain& domain_;
-  FT sq_freeze_ratio_;
-  FT convergence_ratio_;
-  C3T3_helpers helper_;
-  MoveFunction move_function_;
-  Sizing_field sizing_field_;
-  double time_limit_;
-  CGAL::Real_timer running_time_;
-
-  bool do_freeze_;
-  mutable Nb_frozen_points_type nb_frozen_points_;
-
-#ifdef CGAL_MESH_3_OPTIMIZER_VERBOSE
-  mutable FT sum_moves_;
-#endif
-};
-
-
-template <typename C3T3, typename Md, typename Mf, typename V_>
-Mesh_global_optimizer<C3T3,Md,Mf,V_>::
-Mesh_global_optimizer(C3T3& c3t3,
-                      const Md& domain,
-                      const FT& freeze_ratio,
-                      const bool do_freeze,
-                      const FT& convergence_ratio,
-                      const Mf move_function)
-: Base(c3t3.bbox(),
-       Concurrent_mesher_config::get().locking_grid_num_cells_per_axis)
-, c3t3_(c3t3)
-, tr_(c3t3_.triangulation())
-, domain_(domain)
-, sq_freeze_ratio_(freeze_ratio*freeze_ratio)
-, convergence_ratio_(convergence_ratio)
-, helper_(c3t3_,domain_, get_lock_data_structure())
-, move_function_(move_function)
-, sizing_field_(c3t3.triangulation())
-, time_limit_(-1)
-, running_time_()
-
-, do_freeze_(do_freeze)
-
-#ifdef CGAL_MESH_3_OPTIMIZER_VERBOSE
-, sum_moves_(0)
-#endif // CGAL_MESH_3_OPTIMIZER_VERBOSE
-{
-  nb_frozen_points_ = 0; // We put it here in case it's an "atomic"
-
-  // If we're multi-thread
-  tr_.set_lock_data_structure(get_lock_data_structure());
-
-#ifdef CGAL_MESH_3_OPTIMIZER_VERBOSE
-  std::cerr << "Fill sizing field...";
-  CGAL::Real_timer timer;
-  timer.start();
-#endif
-
-  fill_sizing_field();
-
-#ifdef CGAL_MESH_3_OPTIMIZER_VERBOSE
-  std::cerr << "done (" << timer.time() << "s)\n";
-#endif
-}
-
-
-
-template <typename C3T3, typename Md, typename Mf, typename V_>
-Mesh_optimization_return_code
-Mesh_global_optimizer<C3T3,Md,Mf,V_>::
-operator()(int nb_iterations, Visitor visitor)
-{
-  running_time_.reset();
-  running_time_.start();
-
-#ifdef CGAL_MESH_3_PROFILING
-  WallClockTimer t;
-#endif
-
-  // Fill set containing moving vertices
-  // first, take them all
-#ifdef  CGAL_CONSTRUCT_INTRUSIVE_LIST_RANGE_CONSTRUCTOR
-  typedef CGAL::Prevent_deref<typename Tr::Finite_vertices_iterator> It;
-  Moving_vertices_set moving_vertices(It(tr_.finite_vertices_begin()),
-                                      It(tr_.finite_vertices_end()));
-#else
-  Moving_vertices_set moving_vertices;
-  collect_all_vertices(moving_vertices);
-#endif
-
-  std::size_t initial_vertices_nb = moving_vertices.size();
-#ifdef CGAL_MESH_3_OPTIMIZER_VERBOSE
-  double step_begin = running_time_.time();
-  std::cerr << "Running " << Mf::name() << "-smoothing ("
-    << initial_vertices_nb << " vertices)" << std::endl;
-#endif //CGAL_MESH_3_OPTIMIZER_VERBOSE
-
-  // Initialize big moves (stores the largest moves)
-  this->clear_big_moves();
-  big_moves_size_ =
-    (std::max)(std::size_t(1), std::size_t(moving_vertices.size()/500));
-
-  std::size_t nb_vertices_moved = -1;
-  bool convergence_stop = false;
-
-  // Iterate
-  int i = -1;
-  while ( ++i < nb_iterations && ! is_time_limit_reached() )
-  {
-    if(!do_freeze_)
-      nb_frozen_points_ = 0;
-    else
-      nb_vertices_moved = moving_vertices.size();
-
-    // Compute move for each vertex
-    Moves_vector moves = compute_moves(moving_vertices);
-    visitor.after_compute_moves();
-
-    //Pb with Freeze : sometimes a few vertices continue moving indefinitely
-    //if the nb of moving vertices is < 1% of total nb AND does not decrease
-    if(do_freeze_
-      && nb_vertices_moved < 0.005 * initial_vertices_nb
-      && nb_vertices_moved == moving_vertices.size())
-    {
-      // we should stop because we are
-      // probably entering an infinite instable loop
-      convergence_stop = true;
-      break;
-    }
-
-    // Stop if time_limit is reached
-    if ( is_time_limit_reached() )
-      break;
-
-    // Update mesh with those moves
-    update_mesh(moves, moving_vertices, visitor);
-    visitor.end_of_iteration(i);
-
-#ifdef CGAL_MESH_3_OPTIMIZER_VERBOSE
-    std::size_t moving_vertices_size = moving_vertices.size();
-    std::cerr << boost::format("\r             \r"
-      "end iter.%1%, %2% / %3%, last step:%4$.2fs, step avg:%5$.2fs, avg big moves:%6$.3f ")
-    % (i+1)
-    % moving_vertices_size
-    % initial_vertices_nb
-    % (running_time_.time() - step_begin)
-    % (running_time_.time() / (i+1))
-    % sum_moves_;
-    step_begin = running_time_.time();
-#endif
-
-    if (do_freeze_ && nb_frozen_points_ == initial_vertices_nb )
-      break;
-
-    if(check_convergence())
-      break;
-  }
-#ifdef CGAL_MESH_3_OPTIMIZER_VERBOSE
-  std::cerr << std::endl;
-#endif
-
-  running_time_.stop();
-
-#ifdef CGAL_MESH_3_PROFILING
-  double optim_time = t.elapsed();
-# ifdef CGAL_MESH_3_EXPORT_PERFORMANCE_DATA
-  CGAL_MESH_3_SET_PERFORMANCE_DATA(std::string(Mf::name()) + "_optim_time", optim_time);
-# endif
-#endif
-
-#ifdef CGAL_MESH_3_OPTIMIZER_VERBOSE
-  if ( do_freeze_ && nb_frozen_points_ == initial_vertices_nb )
-    std::cerr << "All vertices frozen" << std::endl;
-  else if ( do_freeze_ && convergence_stop )
-    std::cerr << "Can't improve anymore" << std::endl;
-  else if ( is_time_limit_reached() )
-    std::cerr << "Time limit reached" << std::endl;
-  else if ( check_convergence() )
-    std::cerr << "Convergence reached" << std::endl;
-  else if( i >= nb_iterations )
-    std::cerr << "Max iteration number reached" << std::endl;
-
-  std::cerr << "Total optimization time: " << running_time_.time()
-            << "s" << std::endl << std::endl;
-#endif
-
-#ifdef CGAL_MESH_3_PROFILING
-  std::cerr << std::endl << "Total optimization 'wall-clock' time: "
-            << optim_time << "s" << std::endl;
-#endif
-
-  if ( do_freeze_ && nb_frozen_points_ == initial_vertices_nb )
-    return ALL_VERTICES_FROZEN;
-
-  else if ( do_freeze_ && convergence_stop )
-    return CANT_IMPROVE_ANYMORE;
-
-  else if ( is_time_limit_reached() )
-    return TIME_LIMIT_REACHED;
-
-  else if ( check_convergence() )
-    return CONVERGENCE_REACHED;
-
-  return MAX_ITERATION_NUMBER_REACHED;
-}
-
-template <typename C3T3, typename Md, typename Mf, typename V_>
-void
-Mesh_global_optimizer<C3T3,Md,Mf,V_>::
-collect_all_vertices(Moving_vertices_set& moving_vertices)
-{
-  typename Tr::Finite_vertices_iterator vit = tr_.finite_vertices_begin();
-  for(; vit != tr_.finite_vertices_end(); ++vit )
-    moving_vertices.insert(vit);
-}
-
-
-template <typename C3T3, typename Md, typename Mf, typename V_>
-typename Mesh_global_optimizer<C3T3,Md,Mf,V_>::Vector_3
-Mesh_global_optimizer<C3T3,Md,Mf,V_>::
-compute_move(const Vertex_handle& v)
-{
-  typename Gt::Compute_squared_length_3 sq_length =
-    Gt().compute_squared_length_3_object();
-
-  typename Gt::Construct_vector_3 vector =
-    Gt().construct_vector_3_object();
-
-  typename Gt::Construct_translated_point_3 translate =
-    Gt().construct_translated_point_3_object();
-
-  Cell_vector incident_cells;
-  incident_cells.reserve(64);
-#ifdef CGAL_LINKED_WITH_TBB
-  // Parallel
-  if (boost::is_convertible<Concurrency_tag, Parallel_tag>::value)
-  {
-    tr_.incident_cells_threadsafe(v, std::back_inserter(incident_cells));
-  }
-  else
-#endif //CGAL_LINKED_WITH_TBB
-  {
-    tr_.incident_cells(v, std::back_inserter(incident_cells));
-  }
-
-  // Get move from move function
-  Vector_3 move = move_function_(v, incident_cells, c3t3_, sizing_field_);
-
-  // Project surface vertex
-  if ( c3t3_.in_dimension(v) == 2 )
-  {
-    Point_3 new_position = translate(v->point(),move);
-    move = vector(v->point(), helper_.project_on_surface(new_position,v));
-  }
-
-  FT local_sq_size = min_circumradius_sq_length(v, incident_cells);
-  if ( FT(0) == local_sq_size )
-    return CGAL::NULL_VECTOR;
-
-  FT local_move_sq_ratio = sq_length(move) / local_sq_size;
-
-  // Move point only if displacement is big enough w.r.t local size
-  if ( local_move_sq_ratio < sq_freeze_ratio_ )
-  {
-    nb_frozen_points_++;
-    return CGAL::NULL_VECTOR;
-  }
-
-  // Update big moves
-  this->update_big_moves(local_move_sq_ratio);
-
-  return move;
-}
-
-
-template <typename C3T3, typename Md, typename Mf, typename V_>
-void
-Mesh_global_optimizer<C3T3,Md,Mf,V_>::
-update_mesh(const Moves_vector& moves,
-            Moving_vertices_set& moving_vertices,
-            Visitor& visitor)
-{
-  // Cells which have to be updated
-  Outdated_cell_set outdated_cells;
-
-#ifdef CGAL_MESH_3_PROFILING
-  std::cerr << "Moving vertices...";
-  WallClockTimer t;
-#endif
-
-#ifdef CGAL_LINKED_WITH_TBB
-  // Parallel
-  if (boost::is_convertible<Concurrency_tag, Parallel_tag>::value)
-  {
-    // Apply moves in triangulation
-    tbb::parallel_for(tbb::blocked_range<size_t>(0, moves.size()),
-      Move_vertex<
-        Self, C3T3_helpers, Tr, Moves_vector,
-        Moving_vertices_set, Outdated_cell_set>(
-          *this, helper_, moves, moving_vertices, outdated_cells)
-    );
-  }
-  // Sequential
-  else
-#endif // CGAL_LINKED_WITH_TBB
-  {
-    // Apply moves in triangulation
-    for ( typename Moves_vector::const_iterator it = moves.begin() ;
-         it != moves.end() ;
-         ++it )
-    {
-      const Vertex_handle& v = cpp11::get<0>(*it);
-      const Point_3& new_position = cpp11::get<1>(*it);
-      // Get size at new position
-      if ( Sizing_field::is_vertex_update_needed )
-      {
-        //FT size = sizing_field_(new_position,v);
-        FT size = cpp11::get<2>(*it);
-
-        // Move point
-        Vertex_handle new_v = helper_.move_point(v, new_position, outdated_cells, moving_vertices);
-
-        // Restore size in meshing_info data
-        new_v->set_meshing_info(size);
-      }
-      else // Move point
-      {
-        helper_.move_point(v, new_position, outdated_cells, moving_vertices);
-      }
-
-      // Stop if time_limit_ is reached, here we can't return without rebuilding
-      // restricted delaunay
-      if ( is_time_limit_reached() )
-        break;
-    }
-  }
-
-
-  visitor.after_move_points();
-
-#ifdef CGAL_MESH_3_PROFILING
-  std::cerr << "done in " << t.elapsed() << " seconds." << std::endl;
-#endif
-
-
-#ifdef CGAL_MESH_3_PROFILING
-  std::cerr << "Updating C3T3 (rebuilding restricted Delaunay)...";
-  t.reset();
-#endif
-
-  // Update c3t3
-#ifdef CGAL_INTRUSIVE_LIST
-  // AF:  rebuild_restricted_delaunay does more cell insertion/removal
-  //      which clashes with our inplace list
-  //      That's why we hand it in, and call clear() when we no longer need it
-  helper_.rebuild_restricted_delaunay(outdated_cells,
-                                      moving_vertices);
-#else
-  helper_.rebuild_restricted_delaunay(outdated_cells.begin(),
-                                      outdated_cells.end(),
-                                      moving_vertices);
-#endif
-
-  visitor.after_rebuild_restricted_delaunay();
-
-#ifdef CGAL_MESH_3_PROFILING
-  std::cerr << "Updating C3T3 done in " << t.elapsed() << " seconds." << std::endl;
-#endif
-
-}
-
-
-template <typename C3T3, typename Md, typename Mf, typename V_>
-void
-Mesh_global_optimizer<C3T3,Md,Mf,V_>::
-fill_sizing_field()
-{
-  std::map<Point_3,FT> value_map;
-
-#ifdef CGAL_LINKED_WITH_TBB
-  // Parallel
-  if (boost::is_convertible<Concurrency_tag, Parallel_tag>::value)
-  {
-    typedef tbb::enumerable_thread_specific<
-      std::vector< std::pair<Point_3, FT> > > Local_list;
-    Local_list local_lists;
-
-    tbb::parallel_do(
-      tr_.finite_vertices_begin(), tr_.finite_vertices_end(),
-      Compute_sizing_field_value<Self, Tr, Local_list>(*this, local_lists)
-    );
-
-    for(typename Local_list::iterator it_list = local_lists.begin() ;
-          it_list != local_lists.end() ;
-          ++it_list )
-    {
-      value_map.insert(it_list->begin(), it_list->end());
-    }
-  }
-  else
-#endif //CGAL_LINKED_WITH_TBB
-  {
-    // Fill map with local size
-    for(typename Tr::Finite_vertices_iterator vit = tr_.finite_vertices_begin();
-        vit != tr_.finite_vertices_end();
-        ++vit)
-    {
-      value_map.insert(std::make_pair(vit->point(),
-                                      average_circumradius_length(vit)));
-    }
-  }
-
-  // fill sizing field
-  sizing_field_.fill(value_map);
-}
-
-
-template <typename C3T3, typename Md, typename Mf, typename V_>
-bool
-Mesh_global_optimizer<C3T3,Md,Mf,V_>::
-check_convergence() const
-{
-  FT sum(0);
-  for( typename std::multiset<FT>::const_iterator
-       it = big_moves_.begin(), end = big_moves_.end() ; it != end ; ++it )
-  {
-    sum += CGAL::sqrt(*it);
-  }
-
-  FT average_move = sum/big_moves_size_;/*even if set is not full, divide*/
-       /*by max size so that if only 1 point moves, it goes to 0*/
-#ifdef CGAL_MESH_3_OPTIMIZER_VERBOSE
-  sum_moves_ = average_move;
-#endif
-
-  return ( average_move < convergence_ratio_ );
-}
-
-
-template <typename C3T3, typename Md, typename Mf, typename V_>
-typename Mesh_global_optimizer<C3T3,Md,Mf,V_>::FT
-Mesh_global_optimizer<C3T3,Md,Mf,V_>::
-average_circumradius_length(const Vertex_handle& v) const
-{
-  Cell_vector incident_cells;
-  incident_cells.reserve(64);
-#ifdef CGAL_LINKED_WITH_TBB
-  // Parallel
-  if (boost::is_convertible<Concurrency_tag, Parallel_tag>::value)
-  {
-    tr_.incident_cells_threadsafe(v, std::back_inserter(incident_cells));
-  }
-  else
-#endif //CGAL_LINKED_WITH_TBB
-  {
-    tr_.incident_cells(v, std::back_inserter(incident_cells));
-  }
-
-  FT sum_len (0);
-  unsigned int nb = 0;
-
-  for ( typename Cell_vector::iterator cit = incident_cells.begin() ;
-       cit != incident_cells.end() ;
-       ++cit)
-  {
-    if ( c3t3_.is_in_complex(*cit) )
-    {
-      sum_len += CGAL::sqrt(sq_circumradius_length(*cit,v));
-      ++nb;
-    }
-  }
-
-  // nb == 0 could happen if there is an isolated point.
-  if ( 0 != nb )
-  {
-    return sum_len/nb;
-  }
-  else
-  {
-    // Use outside cells to compute size of point
-    for ( typename Cell_vector::iterator cit = incident_cells.begin() ;
-         cit != incident_cells.end() ;
-         ++cit)
-    {
-      if ( !tr_.is_infinite(*cit) )
-      {
-        sum_len += CGAL::sqrt(sq_circumradius_length(*cit,v));
-        ++nb;
-      }
-    }
-
-    CGAL_assertion(nb!=0);
-    CGAL_assertion(sum_len!=0);
-    return sum_len/nb;
-  }
-}
-
-
-template <typename C3T3, typename Md, typename Mf, typename V_>
-typename Mesh_global_optimizer<C3T3,Md,Mf,V_>::FT
-Mesh_global_optimizer<C3T3,Md,Mf,V_>::
-min_circumradius_sq_length(const Vertex_handle& v, const Cell_vector& incident_cells) const
-{
-  // Get first cell sq_circumradius_length
-  typename Cell_vector::const_iterator cit = incident_cells.begin();
-  while ( incident_cells.end() != cit && !c3t3_.is_in_complex(*cit) ) { ++cit; }
-
-  // if vertex is isolated ...
-  if ( incident_cells.end() == cit )
-    return FT(0);
-
-  // Initialize min
-  FT min_sq_len = sq_circumradius_length(*cit++,v);
-
-  // Find the minimum value
-  for ( ; cit != incident_cells.end() ; ++cit )
-  {
-    if ( !c3t3_.is_in_complex(*cit) )
-      continue;
-
-    min_sq_len = (std::min)(min_sq_len,sq_circumradius_length(*cit,v));
-  }
-
-  return min_sq_len;
-}
-
-
-template <typename C3T3, typename Md, typename Mf, typename V_>
-typename Mesh_global_optimizer<C3T3,Md,Mf,V_>::FT
-Mesh_global_optimizer<C3T3,Md,Mf,V_>::
-sq_circumradius_length(const Cell_handle& cell, const Vertex_handle& v) const
-{
-  typename Gt::Compute_squared_distance_3 sq_distance =
-    Gt().compute_squared_distance_3_object();
-
-  const Point_3 circumcenter = tr_.dual(cell);
-  return ( sq_distance(v->point(), circumcenter) );
-}
-
-} // end namespace Mesh_3
-
-} //namespace CGAL
-
-#endif // CGAL_MESH_3_MESH_GLOBAL_OPTIMIZER_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Mesher_3.h b/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Mesher_3.h
deleted file mode 100644
index dfcae79..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Mesher_3.h
+++ /dev/null
@@ -1,714 +0,0 @@
-// Copyright (c) 2009-2014 INRIA Sophia-Antipolis (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
-// 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(s)     : Laurent Rineau, Stephane Tayeb, Clement Jamin
-//
-//******************************************************************************
-// File Description :
-// Implements a mesher_3 with two mesher levels : one for facets and one for
-// tets.
-//******************************************************************************
-
-#ifndef CGAL_MESH_3_MESHER_3_H
-#define CGAL_MESH_3_MESHER_3_H
-
-#include <CGAL/Mesh_3/config.h>
-
-#include <CGAL/Mesh_3/Dump_c3t3.h>
-
-#include<CGAL/Mesh_3/Refine_facets_3.h>
-#include<CGAL/Mesh_3/Refine_facets_manifold_base.h>
-#include<CGAL/Mesh_3/Refine_cells_3.h>
-#include <CGAL/Mesh_3/Refine_tets_visitor.h>
-#include <CGAL/Mesher_level_visitors.h>
-#include <CGAL/Kernel_traits.h>
-
-#ifdef CGAL_MESH_3_USE_OLD_SURFACE_RESTRICTED_DELAUNAY_UPDATE
-#include <CGAL/Surface_mesher/Surface_mesher_visitor.h>
-#endif
-
-#include <CGAL/Mesh_3/Concurrent_mesher_config.h>
-#include <CGAL/Real_timer.h>
-
-#ifdef CGAL_MESH_3_PROFILING
-  #include <CGAL/Mesh_3/Profiling_tools.h>
-#endif
-
-#ifdef CGAL_LINKED_WITH_TBB
-#  if TBB_IMPLEMENT_CPP0X
-#   include <tbb/compat/thread>
-#  else
-#   include <thread>
-#  endif
-#endif
-
-#include <boost/format.hpp>
-#include <boost/type_traits/is_convertible.hpp>
-#include <string>
-
-namespace CGAL {
-namespace Mesh_3 {
-
-/************************************************
-// Class Mesher_3_base
-// Two versions: sequential / parallel
-************************************************/
-
-// Sequential
-template <typename Tr, typename Concurrency_tag>
-class Mesher_3_base
-{
-protected:
-  typedef typename Tr::Lock_data_structure Lock_data_structure;
-
-  Mesher_3_base(const Bbox_3 &, int) {}
-
-  Lock_data_structure *get_lock_data_structure() { return 0; }
-  WorksharingDataStructureType *get_worksharing_data_structure() { return 0; }
-  void set_bbox(const Bbox_3 &) {}
-};
-
-#ifdef CGAL_LINKED_WITH_TBB
-// Parallel
-template <typename Tr>
-class Mesher_3_base<Tr, Parallel_tag>
-{
-protected:
-  typedef typename Tr::Lock_data_structure Lock_data_structure;
-
-  Mesher_3_base(const Bbox_3 &bbox, int num_grid_cells_per_axis)
-  : m_lock_ds(bbox, num_grid_cells_per_axis),
-    m_worksharing_ds(bbox)
-  {}
-
-  Lock_data_structure *get_lock_data_structure()
-  {
-    return &m_lock_ds;
-  }
-  WorksharingDataStructureType *get_worksharing_data_structure()
-  {
-    return &m_worksharing_ds;
-  }
-
-  void set_bbox(const Bbox_3 &bbox)
-  {
-    m_lock_ds.set_bbox(bbox);
-    m_worksharing_ds.set_bbox(bbox);
-  }
-
-  /// Lock data structure
-  Lock_data_structure m_lock_ds;
-  /// Worksharing data structure
-  WorksharingDataStructureType m_worksharing_ds;
-};
-#endif // CGAL_LINKED_WITH_TBB
-
-
-/************************************************
- *
- * Mesher_3 class
- *
- ************************************************/
-
-template<class C3T3, class MeshCriteria, class MeshDomain>
-class Mesher_3
-: public Mesher_3_base<
-    typename C3T3::Triangulation,
-#ifdef CGAL_DEBUG_FORCE_SEQUENTIAL_MESH_REFINEMENT
-    Sequential_tag
-#else
-    typename C3T3::Concurrency_tag
-#endif
-  >
-{
-public:
-#ifdef CGAL_DEBUG_FORCE_SEQUENTIAL_MESH_REFINEMENT
-  typedef Sequential_tag                            Concurrency_tag;
-#else
-  typedef typename C3T3::Concurrency_tag            Concurrency_tag;
-#endif
-  typedef typename C3T3::Triangulation              Triangulation;
-  typedef typename Triangulation::Point             Point;
-  typedef typename Kernel_traits<Point>::Kernel     Kernel;
-  typedef typename Kernel::Vector_3                 Vector;
-  typedef typename MeshDomain::Index                Index;
-
-  // Self
-  typedef Mesher_3<C3T3, MeshCriteria, MeshDomain>      Self;
-#ifdef CGAL_DEBUG_FORCE_SEQUENTIAL_MESH_REFINEMENT
-  typedef Mesher_3_base<Triangulation, Sequential_tag> Base;
-#else
-  typedef Mesher_3_base<Triangulation, typename C3T3::Concurrency_tag> Base;
-#endif
-
-  using Base::get_lock_data_structure;
-
-  //-------------------------------------------------------
-  // Mesher_levels
-  //-------------------------------------------------------
-  // typedef Refine_facets_manifold_base<Rf_base>      Rf_manifold_base;
-
-  /// Facets mesher level
-  typedef Refine_facets_3<
-      Triangulation,
-      typename MeshCriteria::Facet_criteria,
-      MeshDomain,
-      C3T3,
-      Null_mesher_level,
-      Concurrency_tag,
-      Refine_facets_manifold_base
-    >                                               Facets_level;
-
-  /// Cells mesher level
-  typedef Refine_cells_3<
-      Triangulation,
-      typename MeshCriteria::Cell_criteria,
-      MeshDomain,
-      C3T3,
-      Facets_level,
-      Concurrency_tag>                              Cells_level;
-
-  //-------------------------------------------------------
-  // Visitors
-  //-------------------------------------------------------
-  /// Facets visitor : to update cells when refining surface
-  typedef tets::Refine_facets_visitor<
-      Triangulation,
-      Cells_level,
-      Null_mesh_visitor>                            Facets_visitor;
-
-#ifndef CGAL_MESH_3_USE_OLD_SURFACE_RESTRICTED_DELAUNAY_UPDATE
-  /// Cells visitor : it just need to know previous level
-  typedef Null_mesh_visitor_level<Facets_visitor>   Cells_visitor;
-#else
-  /// Cells visitor : to update surface (restore restricted Delaunay)
-  /// when refining cells
-  typedef Surface_mesher::Visitor<
-      Triangulation,
-      Facets_level,
-      Facets_visitor>                               Cells_visitor;
-#endif
-
-  /// Constructor
-  Mesher_3(C3T3&               c3t3,
-           const MeshDomain&   domain,
-           const MeshCriteria& criteria);
-
-  /// Destructor
-  ~Mesher_3() 
-  {
-    // The lock data structure is going to be destroyed
-    r_c3t3_.triangulation().set_lock_data_structure(NULL);
-  }
-
-  /// Launch mesh refinement
-  double refine_mesh(std::string dump_after_refine_surface_prefix = "");
-
-  /// Debug
-  std::string debug_info() const;
-  std::string debug_info_header() const;
-
-  // Step-by-step methods
-  void initialize();
-  void fix_c3t3();
-  void display_number_of_bad_elements();
-  void one_step();
-  bool is_algorithm_done();
-
-#ifdef CGAL_MESH_3_MESHER_STATUS_ACTIVATED
-  struct Mesher_status
-  {
-    std::size_t vertices, facet_queue, cells_queue;
-
-    Mesher_status(std::size_t v, std::size_t f, std::size_t c)
-     : vertices(v), facet_queue(f), cells_queue(c) {}
-  };
-
-  Mesher_status status() const;
-#endif
-
-private:
-  void remove_cells_from_c3t3();
-
-private:
-  /// The oracle
-  const MeshDomain& r_oracle_;
-
-  /// Meshers
-  Null_mesher_level null_mesher_;
-  Facets_level facets_mesher_;
-  Cells_level cells_mesher_;
-
-  /// Visitors
-  Null_mesh_visitor null_visitor_;
-  Facets_visitor facets_visitor_;
-  Cells_visitor cells_visitor_;
-
-  /// The container of the resulting mesh
-  C3T3& r_c3t3_;
-
-private:
-  // Disabled copy constructor
-  Mesher_3(const Self& src);
-  // Disabled assignment operator
-  Self& operator=(const Self& src);
-
-};  // end class Mesher_3
-
-
-
-template<class C3T3, class MC, class MD>
-Mesher_3<C3T3,MC,MD>::Mesher_3(C3T3& c3t3,
-                               const MD& domain,
-                               const MC& criteria)
-: Base(c3t3.bbox(),
-       Concurrent_mesher_config::get().locking_grid_num_cells_per_axis)
-, r_oracle_(domain)
-, null_mesher_()
-, facets_mesher_(c3t3.triangulation(),
-                 criteria.facet_criteria_object(),
-                 domain,
-                 null_mesher_,
-                 c3t3)
-, cells_mesher_(c3t3.triangulation(),
-                criteria.cell_criteria_object(),
-                domain,
-                facets_mesher_,
-                c3t3)
-, null_visitor_()
-, facets_visitor_(&cells_mesher_, &null_visitor_)
-#ifndef CGAL_MESH_3_USE_OLD_SURFACE_RESTRICTED_DELAUNAY_UPDATE
-, cells_visitor_(facets_visitor_)
-#else
-, cells_visitor_(&facets_mesher_, &facets_visitor_)
-#endif
-, r_c3t3_(c3t3)
-{
-  facets_mesher_.set_lock_ds(this->get_lock_data_structure());
-  facets_mesher_.set_worksharing_ds(this->get_worksharing_data_structure());
-  cells_mesher_.set_lock_ds(this->get_lock_data_structure());
-  cells_mesher_.set_worksharing_ds(this->get_worksharing_data_structure());
-}
-
-
-
-template<class C3T3, class MC, class MD>
-double
-Mesher_3<C3T3,MC,MD>::refine_mesh(std::string dump_after_refine_surface_prefix)
-{
-  CGAL::Real_timer timer;
-  timer.start();
-  double elapsed_time = 0.;
-
-  // First surface mesh could modify c3t3 without notifying cells_mesher
-  // So we have to ensure that no old cell will be left in c3t3
-  remove_cells_from_c3t3();
-
-#ifndef CGAL_MESH_3_VERBOSE
-  // Scan surface and refine it
-  initialize();
-
-#ifdef CGAL_MESH_3_PROFILING
-  std::cerr << "Refining facets..." << std::endl;
-  WallClockTimer t;
-#endif
-  facets_mesher_.refine(facets_visitor_);
-#ifdef CGAL_MESH_3_PROFILING
-  double facet_ref_time = t.elapsed();
-  std::cerr << "==== Facet refinement: " << facet_ref_time << " seconds ===="
-            << std::endl << std::endl;
-# ifdef CGAL_MESH_3_EXPORT_PERFORMANCE_DATA
-    // If it's parallel but the refinement is forced to sequential, we don't
-    // output the value
-#   ifndef CGAL_DEBUG_FORCE_SEQUENTIAL_MESH_REFINEMENT
-  CGAL_MESH_3_SET_PERFORMANCE_DATA("Facets_time", facet_ref_time);
-#   endif
-# endif
-#endif
-
-#if defined(CHECK_AND_DISPLAY_THE_NUMBER_OF_BAD_ELEMENTS_IN_THE_END)
-  std::cerr << std::endl
-    << "===============================================================" << std::endl
-    << "=== CHECK_AND_DISPLAY_THE_NUMBER_OF_BAD_ELEMENTS_IN_THE_END ===" << std::endl;
-  display_number_of_bad_elements();
-  std::cerr
-    << "==============================================================="
-    << std::endl << std::endl;
-#endif
-
-  // Then activate facet to surface visitor (surface could be
-  // refined again if it is encroached)
-  facets_visitor_.activate();
-
-  dump_c3t3(r_c3t3_, dump_after_refine_surface_prefix);
-
-  // Then scan volume and refine it
-  cells_mesher_.scan_triangulation();
-#ifdef CGAL_MESH_3_PROFILING
-  std::cerr << "Refining cells..." << std::endl;
-  t.reset();
-#endif
-  cells_mesher_.refine(cells_visitor_);
-#ifdef CGAL_MESH_3_PROFILING
-  double cell_ref_time = t.elapsed();
-  std::cerr << "==== Cell refinement: " << cell_ref_time << " seconds ===="
-            << std::endl << std::endl;
-# ifdef CGAL_MESH_3_EXPORT_PERFORMANCE_DATA
-    // If it's parallel but the refinement is forced to sequential, we don't
-    // output the value
-#   ifndef CGAL_DEBUG_FORCE_SEQUENTIAL_MESH_REFINEMENT
-  CGAL_MESH_3_SET_PERFORMANCE_DATA("Cells_refin_time", cell_ref_time);
-#   endif
-# endif
-#endif
-
-#if defined(CGAL_MESH_3_VERBOSE) || defined(CGAL_MESH_3_PROFILING)
-  std::cerr
-    << "Vertices: " << r_c3t3_.triangulation().number_of_vertices() << std::endl
-    << "Facets  : " << r_c3t3_.number_of_facets_in_complex() << std::endl
-    << "Tets    : " << r_c3t3_.number_of_cells_in_complex() << std::endl;
-#endif
-
-#else // ifdef CGAL_MESH_3_VERBOSE
-  std::cerr << "Start surface scan...";
-  initialize();
-  std::cerr << "end scan. [Bad facets:" << facets_mesher_.size() << "]";
-  std::cerr << std::endl << std::endl;
-  elapsed_time += timer.time();
-  timer.stop(); timer.reset(); timer.start();
-
-  const Triangulation& r_tr = r_c3t3_.triangulation();
-  int nbsteps = 0;
-
-  std::cerr << "Refining Surface...\n";
-  std::cerr << "Legend of the following line: "
-            << "(#vertices,#steps," << cells_mesher_.debug_info_header()
-            << ")\n";
-
-  std::cerr << "(" << r_tr.number_of_vertices() << ","
-            << nbsteps << "," << cells_mesher_.debug_info() << ")";
-
-  while ( ! facets_mesher_.is_algorithm_done() )
-  {
-    facets_mesher_.one_step(facets_visitor_);
-    std::cerr
-    << boost::format("\r             \r"
-                     "(%1%,%2%,%3%) (%|4$.1f| vertices/s)")
-    % r_tr.number_of_vertices()
-    % nbsteps % cells_mesher_.debug_info()
-    % (nbsteps / timer.time());
-    ++nbsteps;
-  }
-  std::cerr << std::endl;
-  std::cerr << "Total refining surface time: " << timer.time() << "s" << std::endl;
-  std::cerr << std::endl;
-
-  elapsed_time += timer.time();
-  timer.stop(); timer.reset(); timer.start();
-  nbsteps = 0;
-
-  facets_visitor_.activate();
-  dump_c3t3(r_c3t3_, dump_after_refine_surface_prefix);
-  std::cerr << "Start volume scan...";
-  cells_mesher_.scan_triangulation();
-  std::cerr << "end scan. [Bad tets:" << cells_mesher_.size() << "]";
-  std::cerr << std::endl << std::endl;
-  elapsed_time += timer.time();
-  timer.stop(); timer.reset(); timer.start();
-
-  std::cerr << "Refining...\n";
-  std::cerr << "Legend of the following line: "
-            << "(#vertices,#steps," << cells_mesher_.debug_info_header()
-            << ")\n";
-  std::cerr << "(" << r_tr.number_of_vertices() << ","
-            << nbsteps << "," << cells_mesher_.debug_info() << ")";
-
-  while ( ! cells_mesher_.is_algorithm_done() )
-  {
-    cells_mesher_.one_step(cells_visitor_);
-    std::cerr
-        << boost::format("\r             \r"
-                     "(%1%,%2%,%3%) (%|4$.1f| vertices/s)")
-        % r_tr.number_of_vertices()
-        % nbsteps % cells_mesher_.debug_info()
-        % (nbsteps / timer.time());
-    ++nbsteps;
-  }
-  std::cerr << std::endl;
-
-  std::cerr << "Total refining volume time: " << timer.time() << "s" << std::endl;
-  std::cerr << "Total refining time: " << timer.time()+elapsed_time << "s" << std::endl;
-  std::cerr << std::endl;
-#endif
-
-  timer.stop();
-  elapsed_time += timer.time();
-
-#if defined(CHECK_AND_DISPLAY_THE_NUMBER_OF_BAD_ELEMENTS_IN_THE_END) \
- || defined(SHOW_REMAINING_BAD_ELEMENT_IN_RED)
-  std::cerr << std::endl
-    << "===============================================================" << std::endl
-    << "=== CHECK_AND_DISPLAY_THE_NUMBER_OF_BAD_ELEMENTS_IN_THE_END ===" << std::endl;
-  display_number_of_bad_elements();
-  std::cerr
-    << "==============================================================="
-    << std::endl << std::endl;
-#endif
-
-  return elapsed_time;
-}
-
-
-template<class C3T3, class MC, class MD>
-void
-Mesher_3<C3T3,MC,MD>::
-initialize()
-{
-#ifdef CGAL_MESH_3_PROFILING
-  std::cerr << "Initializing... ";
-  WallClockTimer t;
-#endif
-  //=====================================
-  // Bounding box estimation
-  //=====================================
-#if defined(CGAL_LINKED_WITH_TBB) || \
-    defined(CGAL_SEQUENTIAL_MESH_3_ADD_OUTSIDE_POINTS_ON_A_FAR_SPHERE)
-
-#ifndef CGAL_SEQUENTIAL_MESH_3_ADD_OUTSIDE_POINTS_ON_A_FAR_SPHERE
-  if(boost::is_convertible<Concurrency_tag, Parallel_tag>::value)
-#endif // If that macro is defined, then estimated_bbox must be initialized
-  {
-    Base::set_bbox(r_oracle_.bbox());
-  }
-#endif // CGAL_LINKED_WITH_TBB||"sequential use far sphere"
-
-  //========================================
-  // Initialization: parallel or sequential
-  //========================================
-
-#ifdef CGAL_LINKED_WITH_TBB
-  // Parallel
-  if (boost::is_convertible<Concurrency_tag, Parallel_tag>::value)
-  {
-    // we're not multi-thread, yet
-    r_c3t3_.triangulation().set_lock_data_structure(0);
-
-# ifndef CGAL_PARALLEL_MESH_3_DO_NOT_ADD_OUTSIDE_POINTS_ON_A_FAR_SPHERE
-
-    if (r_c3t3_.number_of_far_points() == 0 && r_c3t3_.number_of_facets() == 0)
-    {
-      const Bbox_3 &bbox = r_oracle_.bbox();
-
-      // Compute radius for far sphere
-      const double xdelta = bbox.xmax()-bbox.xmin();
-      const double ydelta = bbox.ymax()-bbox.ymin();
-      const double zdelta = bbox.zmax()-bbox.zmin();
-      const double radius = 5. * std::sqrt(xdelta*xdelta +
-                                           ydelta*ydelta +
-                                           zdelta*zdelta);
-      const Vector center(
-        bbox.xmin() + 0.5*xdelta,
-        bbox.ymin() + 0.5*ydelta,
-        bbox.zmin() + 0.5*zdelta);
-#  ifdef CGAL_CONCURRENT_MESH_3_VERBOSE
-      std::cerr << "Adding points on a far sphere (radius = " << radius <<")...";
-#  endif
-      Random_points_on_sphere_3<Point> random_point(radius);
-      const int NUM_PSEUDO_INFINITE_VERTICES = static_cast<int>(
-        tbb::task_scheduler_init::default_num_threads()
-        * Concurrent_mesher_config::get().num_pseudo_infinite_vertices_per_core);
-      for (int i = 0 ; i < NUM_PSEUDO_INFINITE_VERTICES ; ++i, ++random_point)
-        r_c3t3_.add_far_point(*random_point + center);
-    
-#  ifdef CGAL_CONCURRENT_MESH_3_VERBOSE
-      std::cerr << "done." << std::endl;
-#  endif
-    }
-# endif // CGAL_PARALLEL_MESH_3_DO_NOT_ADD_OUTSIDE_POINTS_ON_A_FAR_SPHERE
-
-#ifdef CGAL_MESH_3_PROFILING
-    double init_time = t.elapsed();
-    std::cerr << "done in " << init_time << " seconds." << std::endl;
-#endif
-
-    // Scan triangulation
-    facets_mesher_.scan_triangulation();
-
-    // From now on, we're multi-thread
-    r_c3t3_.triangulation().set_lock_data_structure(get_lock_data_structure());
-  }
-  // Sequential
-  else
-#endif // CGAL_LINKED_WITH_TBB
-  {
-#ifdef CGAL_SEQUENTIAL_MESH_3_ADD_OUTSIDE_POINTS_ON_A_FAR_SPHERE
-    if (r_c3t3_.number_of_far_points() == 0 && r_c3t3_.number_of_facets() == 0)
-    {
-      /*std::cerr << "A little bit of refinement... ";
-
-      // Start by a little bit of refinement to get a coarse mesh
-      // => Good approx of bounding box
-      const int NUM_VERTICES_OF_COARSE_MESH = 40;
-      facets_mesher_.refine_sequentially_up_to_N_vertices(
-        facets_visitor_, NUM_VERTICES_OF_COARSE_MESH);
-
-      std::cerr << "done." << std::endl;
-      std::cerr
-        << "Vertices: " << r_c3t3_.triangulation().number_of_vertices() << std::endl
-        << "Facets  : " << r_c3t3_.number_of_facets_in_complex() << std::endl
-        << "Tets    : " << r_c3t3_.number_of_cells_in_complex() << std::endl;*/
-
-      // Compute radius for far sphere
-      //const Bbox_3 &bbox = r_c3t3_.bbox();
-      CGAL_assertion(is_estimated_bbox_initialized);
-      const Bbox_3 &bbox = estimated_bbox;
-      const double xdelta = bbox.xmax()-bbox.xmin();
-      const double ydelta = bbox.ymax()-bbox.ymin();
-      const double zdelta = bbox.zmax()-bbox.zmin();
-      const double radius = 5. * std::sqrt(xdelta*xdelta +
-                                           ydelta*ydelta +
-                                           zdelta*zdelta);
-      const Vector center(
-        bbox.xmin() + 0.5*xdelta,
-        bbox.ymin() + 0.5*ydelta,
-        bbox.zmin() + 0.5*zdelta);
-# ifdef CGAL_MESH_3_VERBOSE
-      std::cerr << "Adding points on a far sphere (radius = " << radius << ")...";
-# endif
-      Random_points_on_sphere_3<Point> random_point(radius);
-      const int NUM_PSEUDO_INFINITE_VERTICES = 12*2;
-      for (int i = 0 ; i < NUM_PSEUDO_INFINITE_VERTICES ; ++i, ++random_point)
-        r_c3t3_.add_far_point(*random_point + center);
-# ifdef CGAL_MESH_3_VERBOSE
-      std::cerr << "done." << std::endl;
-# endif
-    }
-#endif // CGAL_SEQUENTIAL_MESH_3_ADD_OUTSIDE_POINTS_ON_A_FAR_SPHERE
-
-#ifdef CGAL_MESH_3_PROFILING
-    double init_time = t.elapsed();
-    std::cerr << "done in " << init_time << " seconds." << std::endl;
-#endif
-
-    // Scan triangulation
-    facets_mesher_.scan_triangulation();
-
-  }
-}
-
-
-template<class C3T3, class MC, class MD>
-void
-Mesher_3<C3T3,MC,MD>::
-fix_c3t3()
-{
-  if ( ! facets_visitor_.is_active() )
-  {
-    cells_mesher_.scan_triangulation();
-  }
-}
-
-
-template<class C3T3, class MC, class MD>
-void
-Mesher_3<C3T3,MC,MD>::
-display_number_of_bad_elements()
-{
-  int nf = facets_mesher_.number_of_bad_elements();
-  int nc = cells_mesher_.number_of_bad_elements();
-  std::cerr << "Bad facets: " << nf << " - Bad cells: " << nc << std::endl;
-}
-
-template<class C3T3, class MC, class MD>
-void
-Mesher_3<C3T3,MC,MD>::
-one_step()
-{
-  if ( ! facets_visitor_.is_active() )
-  {
-    facets_mesher_.one_step(facets_visitor_);
-
-    if ( facets_mesher_.is_algorithm_done() )
-    {
-      facets_visitor_.activate();
-      cells_mesher_.scan_triangulation();
-    }
-  }
-  else
-  {
-    cells_mesher_.one_step(cells_visitor_);
-  }
-}
-
-template<class C3T3, class MC, class MD>
-bool
-Mesher_3<C3T3,MC,MD>::
-is_algorithm_done()
-{
-  return cells_mesher_.is_algorithm_done();
-}
-
-
-#ifdef CGAL_MESH_3_MESHER_STATUS_ACTIVATED
-template<class C3T3, class MC, class MD>
-typename Mesher_3<C3T3,MC,MD>::Mesher_status
-Mesher_3<C3T3,MC,MD>::
-status() const
-{
-  return Mesher_status(r_c3t3_.triangulation().number_of_vertices(),
-                       facets_mesher_.queue_size(),
-                       cells_mesher_.queue_size());
-}
-#endif
-
-
-template<class C3T3, class MC, class MD>
-void
-Mesher_3<C3T3,MC,MD>::
-remove_cells_from_c3t3()
-{
-  for ( typename C3T3::Triangulation::Finite_cells_iterator
-    cit = r_c3t3_.triangulation().finite_cells_begin(),
-    end = r_c3t3_.triangulation().finite_cells_end() ; cit != end ; ++cit )
-  {
-    r_c3t3_.remove_from_complex(cit);
-  }
-}
-
-template<class C3T3, class MC, class MD>
-inline
-std::string
-Mesher_3<C3T3,MC,MD>::debug_info() const
-{
-  return cells_mesher_.debug_info();
-}
-
-template<class C3T3, class MC, class MD>
-inline
-std::string
-Mesher_3<C3T3,MC,MD>::debug_info_header() const
-{
-  return cells_mesher_.debug_info_header();
-}
-
-}  // end namespace Mesh_3
-
-}  // end namespace CGAL
-
-
-#endif // CGAL_MESH_3_MESHER_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Refine_facets_3.h b/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Refine_facets_3.h
deleted file mode 100644
index 1e950a9..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Refine_facets_3.h
+++ /dev/null
@@ -1,1965 +0,0 @@
-// Copyright (c) 2009 INRIA Sophia-Antipolis (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
-// 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(s)     : Laurent Rineau, Stéphane Tayeb
-//
-//******************************************************************************
-// File Description :
-// Implements a mesher level for facets.
-//******************************************************************************
-
-#ifndef CGAL_MESH_3_REFINE_FACETS_3_H
-#define CGAL_MESH_3_REFINE_FACETS_3_H
-
-#include <CGAL/Mesh_3/Mesher_level.h>
-#include <CGAL/Mesh_3/Mesher_level_default_implementations.h>
-#ifdef CGAL_LINKED_WITH_TBB
-  #include <tbb/tbb.h>
-#endif
-
-#include <CGAL/Meshes/Filtered_deque_container.h>
-#include <CGAL/Meshes/Filtered_multimap_container.h>
-#include <CGAL/Meshes/Double_map_container.h>
-
-#include <CGAL/Meshes/Triangulation_mesher_level_traits_3.h>
-
-#ifdef CGAL_MESH_3_PROFILING
-  #include <CGAL/Mesh_3/Profiling_tools.h>
-#endif
-
-#include <CGAL/Object.h>
-
-#include <boost/format.hpp>
-#include <boost/optional.hpp>
-#include <boost/mpl/has_xxx.hpp>
-#include <boost/mpl/if.hpp>
-#include <CGAL/tuple.h>
-#include <boost/type_traits/is_convertible.hpp>
-#include <sstream>
-
-namespace CGAL {
-
-namespace Mesh_3 {
-
-// Helper meta-programming functions, to allow backward compatibility.
-//
-//   - Has_Is_facet_bad and Had_Facet_badness are used to detect if a model
-//     of the MeshFacetCriteria_3 concept follows the specifications of
-//     CGAL-3.7 (with Facet_badness) or later (with Is_facet_bad).
-//
-//   - Then the meta-function Get_Is_facet_bad is used to get the actual
-//     type, either Facet_criteria::Facet_badness or
-//      Facet_criteria::Is_facet_bad.
-
-BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Has_Is_facet_bad, Is_facet_bad, true)
-BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Has_Facet_badness, Facet_badness, false)
-
-// template class, used when use_facet_badness = false
-template <typename Facet_criteria,
-          bool use_facet_badness = (!Has_Is_facet_bad<Facet_criteria>::value) &&
-                                    Has_Facet_badness<Facet_criteria>::value >
-struct Get_Is_facet_bad {
-  typedef typename Facet_criteria::Is_facet_bad Type;
-  typedef Type type; // compatibility with Boost
-};
-
-// partial specialization when use_facet_badness == true
-template <typename Facet_criteria>
-struct Get_Is_facet_bad<Facet_criteria, true> {
-  typedef typename Facet_criteria::Facet_badness Type;
-  typedef Type type;
-};
-
-  // Predicate to know if a facet in a refinement queue is a zombie
-  // A facet is a pair <cell, index of the opposite vertex>.
-  // A facet is a "zombie" if at least one of its two adjacent cells
-  // has been erased. We test it thanks to the "erase counter" which
-  // is inside each cell (incremented by the compact container).
-  // In the refinement queue, we store a tuple
-  // <facet1, facet1_erase counter, facet2, facet2_erase_counter>
-  // where facet2 = mirror_facet(facet1) and facetx_erase_counter is
-  // the erase_counter of facetx's cell when added to the queue>
-  template<typename Facet>
-  class Facet_to_refine_is_not_zombie
-  {
-  public:
-    Facet_to_refine_is_not_zombie() {}
-
-    bool operator()(const CGAL::cpp11::tuple<
-      Facet, unsigned int, Facet, unsigned int> &f) const
-    {
-#ifdef _DEBUG
-      int f1_current_erase_counter = CGAL::cpp11::get<0>(f).first->erase_counter();
-      int f1_saved_erase_counter = CGAL::cpp11::get<1>(f);
-      int f2_current_erase_counter = CGAL::cpp11::get<2>(f).first->erase_counter();
-      int f2_saved_erase_counter = CGAL::cpp11::get<3>(f);
-      //f1_current_erase_counter - f1_saved_erase_counter + f2_current_erase_counter - f2_saved_erase_counter == 1
-
-      /*if (f1_current_erase_counter - f1_saved_erase_counter + f2_current_erase_counter - f2_saved_erase_counter == 1)
-      {
-#ifdef CGAL_LINKED_WITH_TBB
-        tbb::queuing_mutex mut;
-        tbb::queuing_mutex::scoped_lock l(mut);
-#endif
-
-        std::stringstream sstr;
-        Facet facet = CGAL::cpp11::get<0>(f);
-        sstr << "Facet 1 { " << std::endl
-        << "  - " << *facet.first->vertex((facet.second+1)%4)  << std::endl
-        << "  - " << *facet.first->vertex((facet.second+2)%4)  << std::endl
-        << "  - " << *facet.first->vertex((facet.second+3)%4)  << std::endl
-        << "  - 4th vertex in cell: " << *facet.first->vertex(facet.second)  << std::endl
-        << "}" << std::endl;
-
-        facet = CGAL::cpp11::get<2>(f);
-        sstr << "Facet 2 { " << std::endl
-        << "  - " << *facet.first->vertex((facet.second+1)%4)  << std::endl
-        << "  - " << *facet.first->vertex((facet.second+2)%4)  << std::endl
-        << "  - " << *facet.first->vertex((facet.second+3)%4)  << std::endl
-        << "  - 4th vertex in cell: " << *facet.first->vertex(facet.second)  << std::endl
-        << "}" << std::endl;
-
-        std::string s = sstr.str();
-        //std::cerr << s << std::endl;
-      }*/
-#endif
-      return (CGAL::cpp11::get<0>(f).first->erase_counter() == CGAL::cpp11::get<1>(f)
-        && CGAL::cpp11::get<2>(f).first->erase_counter() == CGAL::cpp11::get<3>(f) );
-    }
-  };
-
-/************************************************
-// Class Refine_facets_3_handle_queue_base
-// Two versions: sequential / parallel
-************************************************/
-
-// Sequential
-template <typename Index, typename Facet, typename Concurrency_tag>
-class Refine_facets_3_handle_queue_base
-{
-protected:
-  Refine_facets_3_handle_queue_base() : m_last_vertex_index() {}
-
-  Index get_last_vertex_index() const
-  {
-    return m_last_vertex_index;
-  }
-
-  void set_last_vertex_index(Index i) const
-  {
-    m_last_vertex_index = i;
-  }
-
-#if defined(CGAL_MESH_3_USE_LAZY_SORTED_REFINEMENT_QUEUE) \
- || defined(CGAL_MESH_3_USE_LAZY_UNSORTED_REFINEMENT_QUEUE)
-
-  CGAL::cpp11::tuple<Facet, unsigned int, Facet, unsigned int>
-  from_facet_to_refinement_queue_element(const Facet &facet,
-                                         const Facet &mirror) const
-  {
-    return CGAL::cpp11::make_tuple(
-      facet, facet.first->erase_counter(),
-      mirror, mirror.first->erase_counter());
-  }
-
-public:
-  template<typename Container_element>
-  Facet extract_element_from_container_value(const Container_element &e) const
-  {
-    // We get the first Facet inside the tuple
-    return CGAL::cpp11::get<0>(e);
-  }
-
-#else
-
-  Facet
-  from_facet_to_refinement_queue_element(const Facet &facet,
-                                         const Facet &mirror) const
-  {
-    // Returns canonical facet
-    return (facet < mirror) ? facet : mirror;
-  }
-
-public:
-  template<typename Container_element>
-  Facet extract_element_from_container_value(const Container_element &e) const
-  {
-    return e;
-  }
-
-#endif
-
-protected:
-  /// Stores index of vertex that may be inserted into triangulation
-  mutable Index m_last_vertex_index;
-};
-
-#ifdef CGAL_LINKED_WITH_TBB
-// Parallel
-template <typename Index, typename Facet>
-class Refine_facets_3_handle_queue_base<Index, Facet, Parallel_tag>
-{
-protected:
-  Refine_facets_3_handle_queue_base() : m_last_vertex_index(Index()) {}
-
-  Index get_last_vertex_index() const
-  {
-    return m_last_vertex_index.local();
-  }
-
-  void set_last_vertex_index(Index i) const
-  {
-    m_last_vertex_index.local() = i;
-  }
-
-  CGAL::cpp11::tuple<Facet, unsigned int, Facet, unsigned int>
-  from_facet_to_refinement_queue_element(const Facet &facet,
-                                         const Facet &mirror) const
-  {
-    return CGAL::cpp11::make_tuple(
-      facet, facet.first->erase_counter(),
-      mirror, mirror.first->erase_counter());
-  }
-
-public:
-  template<typename Container_element>
-  Facet extract_element_from_container_value(const Container_element &e) const
-  {
-    // We get the first Facet inside the tuple
-    return CGAL::cpp11::get<0>(e);
-  }
-
-protected:
-  /// Stores index of vertex that may be inserted into triangulation
-  mutable tbb::enumerable_thread_specific<Index> m_last_vertex_index;
-};
-#endif // CGAL_LINKED_WITH_TBB
-
-template<class Tr,
-         class Criteria,
-         class MeshDomain,
-         class Complex3InTriangulation3,
-         class Concurrency_tag,
-         class Container_
-         >
-class Refine_facets_3_base
-  : public Refine_facets_3_handle_queue_base<typename MeshDomain::Index,
-                                             typename Tr::Facet,
-                                             Concurrency_tag>
-  , public Container_
-{
-  typedef typename Tr::Point Point;
-  typedef typename Tr::Facet Facet;
-  typedef typename Tr::Vertex_handle Vertex_handle;
-  typedef typename Tr::Cell_handle Cell_handle;
-  typedef typename Triangulation_mesher_level_traits_3<Tr>::Zone Zone;
-
-  typedef typename Tr::Geom_traits Gt;
-  typedef typename Gt::Segment_3 Segment_3;
-  typedef typename Gt::Ray_3 Ray_3;
-  typedef typename Gt::Line_3 Line_3;
-
-public:
-  Refine_facets_3_base(Tr& tr, Complex3InTriangulation3& c3t3,
-                       const MeshDomain& oracle,
-                       const Criteria& criteria)
-    : r_tr_(tr)
-    , r_criteria_(criteria)
-    , r_oracle_(oracle)
-    , r_c3t3_(c3t3)
-  {}
-
-  void scan_triangulation_impl_amendement() const {}
-
-  /// Gets the point to insert from the element to refine
-  Point refinement_point_impl(const Facet& facet) const
-  {
-#ifdef CGAL_MESHES_DEBUG_REFINEMENT_POINTS
-    const Cell_handle c = facet.first;
-    const int i = facet.second;
-    std::cerr << "Facet ("
-              << c->vertex((i+1)&3)->point() << " , "
-              << c->vertex((i+2)&3)->point() << " , "
-              << c->vertex((i+3)&3)->point() << ") : refinement point is "
-              << get_facet_surface_center(facet) << std::endl;
-#endif
-    CGAL_assertion (this->is_facet_on_surface(facet));
-    this->set_last_vertex_index(get_facet_surface_center_index(facet));
-    return get_facet_surface_center(facet);
-  };
-
-  Facet get_next_element_impl()
-  {
-    return this->extract_element_from_container_value(
-      Container_::get_next_element_impl());
-  }
-
-  /// Job to do before insertion
-  void before_insertion_impl(const Facet& facet,
-                             const Point& point,
-                             Zone& zone);
-
-  /// Job to do after insertion
-  void after_insertion_impl(const Vertex_handle& v)
-  {
-    restore_restricted_Delaunay(v);
-  }
-
-  /// debug info: class name
-  std::string debug_info_class_name_impl() const
-  {
-    return "Refine_facets_3";
-  }
-
-  /// debug info
-  std::string debug_info() const
-  {
-    std::stringstream s;
-    s << Container_::size();
-    return s.str();
-  }
-
-  /// debug_info_header
-  std::string debug_info_header() const
-  {
-    return "#facets to refine";
-  }
-
-  std::string debug_info_element_impl(const Facet &facet) const
-  {
-    std::stringstream sstr;
-    sstr << "Facet { " << std::endl
-    << "  - " << *facet.first->vertex((facet.second+1)%4)  << std::endl
-    << "  - " << *facet.first->vertex((facet.second+2)%4)  << std::endl
-    << "  - " << *facet.first->vertex((facet.second+3)%4)  << std::endl
-    << "  - 4th vertex in cell: " << *facet.first->vertex(facet.second)  << std::endl
-    << "}" << std::endl;
-
-    return sstr.str();
-  }
-
-protected:
-
-  // Functor for scan_triangulation_impl function
-  template <typename Refine_facets_>
-  class Scan_facet
-  {
-    Refine_facets_ & m_refine_facets;
-
-    typedef typename Refine_facets_::Facet Facet;
-
-  public:
-    // Constructor
-    Scan_facet(Refine_facets_ & rf)
-    : m_refine_facets(rf)
-    {}
-
-    // Constructor
-    Scan_facet(const Scan_facet &sf)
-    : m_refine_facets(sf.m_refine_facets)
-    {}
-
-    // operator()
-    // f cannot be const, see treat_new_facet signature
-    void operator()( Facet f ) const
-    {
-      m_refine_facets.treat_new_facet(f);
-    }
-  };
-
-
-protected:
-  //-------------------------------------------------------
-  // Private types
-  //-------------------------------------------------------
-  typedef typename Criteria::Facet_quality Quality;
-  typedef typename Get_Is_facet_bad<Criteria>::Type Is_facet_bad;
-  typedef typename MeshDomain::Surface_patch_index Surface_patch_index;
-  typedef typename MeshDomain::Index Index;
-  typedef typename Gt::Bare_point Bare_point;
-
-  typedef typename boost::optional<
-    CGAL::cpp11::tuple<Surface_patch_index, Index, Point> >
-                                                      Facet_properties;
-
-
-  /// Returns canonical facet of facet
-  Facet canonical_facet(const Facet& facet) const
-  {
-    const Facet mirror = mirror_facet(facet);
-    return ( (facet < mirror)?facet:mirror );
-  }
-
-  /// Returns true if f has already been visited
-  bool is_facet_visited(const Facet& f) const
-  {
-    return f.first->is_facet_visited(f.second);
-  }
-
-  /// Sets facet f to visited
-  void set_facet_visited(Facet& f) const
-  {
-    f.first->set_facet_visited(f.second);
-  }
-
-  /// Sets facet f and it's mirror one surface center to point p
-  void set_facet_surface_center(const Facet& f,
-                                const Point& p,
-                                const Index& index) const
-  {
-    const Facet mirror = mirror_facet(f);
-
-    f.first->set_facet_surface_center(f.second, p);
-    mirror.first->set_facet_surface_center(mirror.second, p);
-
-    f.first->set_facet_surface_center_index(f.second,index);
-    mirror.first->set_facet_surface_center_index(mirror.second,index);
-  }
-
-  /// Returns facet surface center of \c f
-  Point get_facet_surface_center(const Facet& f) const
-  {
-    return f.first->get_facet_surface_center(f.second);
-  }
-
-  /// Returns index of surface center of facet \c f
-  Index get_facet_surface_center_index(const Facet& f) const
-  {
-    return f.first->get_facet_surface_center_index(f.second);
-  }
-
-  /// Sets \c f to surface facets, with index \c index
-  void set_facet_on_surface(const Facet& f,
-                            const Surface_patch_index& index)
-  {
-    r_c3t3_.add_to_complex(f, index);
-  }
-
-  /// Returns index of facet \c f
-  Surface_patch_index get_facet_surface_index(const Facet& f) const
-  {
-    return r_c3t3_.surface_patch_index(f.first, f.second);
-  }
-
-  /// Sets index and dimension of vertex \v
-  void set_vertex_properties(Vertex_handle& v, const Index& index)
-  {
-    r_c3t3_.set_index(v, index);
-    // Set dimension of v: v is on surface by construction, so dimension=2
-    v->set_dimension(2);
-  }
-
-  /// Compute the (exact) dual of a facet
-  void dual_segment(const Facet & f, Bare_point& p1, Bare_point& p2) const;
-
-  void dual_segment_exact(const Facet & f, Bare_point& p1, Bare_point& p2) const;
-
-  void dual_ray(const Facet & f, Ray_3& ray) const;
-
-  void dual_ray_exact(const Facet & f, Ray_3& ray) const;
-
-  /// Returns true if point encroaches facet
-  bool is_facet_encroached(const Facet& facet, const Point& point) const;
-
-  /// Returns whethere an encroached facet is refinable or not
-  bool is_encroached_facet_refinable(Facet& facet) const;
-
-  /// Insert facet into refinement queue
-  void insert_bad_facet(Facet& facet, const Quality& quality)
-  {
-    // Insert the facet and its mirror
-    this->add_bad_element(
-      this->from_facet_to_refinement_queue_element(facet, mirror_facet(facet)),
-      quality);
-  }
-
-  /// Insert encroached facet into refinement queue
-  void insert_encroached_facet_in_queue(Facet& facet)
-  {
-    insert_bad_facet(facet,Quality());
-  }
-
-protected:
-  /**
-   * Action to perform on a facet inside the conflict zone before insertion
-   * @return true if source_facet is the same as facet or mirror(facet)
-   */
-  bool before_insertion_handle_facet_in_conflict_zone(Facet& facet,
-                                                     const Facet& source_facet);
-
-  /**
-   * Action to perform on a facet on the boundary of the conflict zone
-   * before insertion
-   * @return true if source_facet is the same as facet or mirror(facet)
-   */
-  bool before_insertion_handle_facet_on_conflict_zone(Facet& facet,
-                                                      const Facet& source_facet)
-  {
-    // perform the same operations as for an internal facet
-    return before_insertion_handle_facet_in_conflict_zone(facet, source_facet);
-  }
-
-  /// Restore restricted Delaunay ; may be call by Cells_mesher visitor
-  void restore_restricted_Delaunay(const Vertex_handle& v);
-
-  /// Action to perform on a facet incident to the new vertex
-  void after_insertion_handle_incident_facet(Facet& facet);
-
-  /// Action to perform on a facet opposite to the new vertex
-  void after_insertion_handle_opposite_facet(Facet& facet)
-  {
-    // perform the same operations as for a facet incident to the new vertex
-    after_insertion_handle_incident_facet(facet);
-  }
-
-  /// Get mirror facet
-  Facet mirror_facet(const Facet& f) const { return r_tr_.mirror_facet(f); };
-
-  /// for debugging
-  std::string display_dual(Facet f) const
-  {
-    std::stringstream stream;
-    stream.precision(17);
-    Object dual = r_tr_.dual(f);
-
-    if ( const Segment_3* p_segment = object_cast<Segment_3>(&dual) ) {
-      stream << "Segment(" << p_segment->source()
-             << " , " << p_segment->target() << ")";
-    }
-    else if ( const Ray_3* p_ray = object_cast<Ray_3>(&dual) ) {
-      stream << "Ray(" << p_ray->point(0)
-             << " , " << p_ray->point(1)
-             << "), with vector (" << p_ray->to_vector() << ")";
-    }
-    else if ( const Line_3* p_line = object_cast<Line_3>(&dual) ) {
-      stream << "Line(point=" << p_line->point(0)
-             << " , vector=" << p_line->to_vector() << ")";
-    }
-    return stream.str();
-  }
-
-  /// Returns to if f is on surface
-  bool is_facet_on_surface(const Facet& f) const
-  {
-    return r_c3t3_.is_in_complex(f) ;
-  }
-
-  /// Removes \c f from surface facets
-  void remove_facet_from_surface(const Facet& f)
-  {
-    r_c3t3_.remove_from_complex(f);
-  }
-
-  /// Removes facet from refinement queue
-  // Sequential
-  void remove_bad_facet(Facet& facet, Sequential_tag)
-  {
-    // If sequential AND NOT lazy, remove cell from refinement queue
-#if !defined(CGAL_MESH_3_USE_LAZY_SORTED_REFINEMENT_QUEUE) \
- && !defined(CGAL_MESH_3_USE_LAZY_UNSORTED_REFINEMENT_QUEUE)
-    // Remove canonical facet
-    Facet canonical_facet = this->canonical_facet(facet);
-    this->remove_element(canonical_facet);
-#endif
-  }
-#ifdef CGAL_LINKED_WITH_TBB
-  /// Removes facet from refinement queue
-  // Parallel: it's always lazy, so do nothing
-  void remove_bad_facet(Facet&, Parallel_tag) {}
-#endif // CGAL_LINKED_WITH_TBB
-
-  /// Sets facet f to not visited
-  void reset_facet_visited(Facet& f) const
-  {
-    f.first->reset_visited(f.second);
-  }
-
-  /// Computes facet properties and add facet to the refinement queue if needed
-  void treat_new_facet(Facet& facet);
-
-  /**
-   * Computes at once is_facet_on_surface and facet_surface_center.
-   * @param facet The input facet
-   * @return \c true if \c facet is on surface, \c false otherwise
-   */
-  void compute_facet_properties(const Facet& facet, Facet_properties& fp,
-                                bool force_exact = false ) const;
-
-protected:
-  /// The triangulation
-  Tr& r_tr_;
-  /// The facet criteria
-  const Criteria& r_criteria_;
-  /// The oracle
-  const MeshDomain& r_oracle_;
-  /// The mesh result
-  Complex3InTriangulation3& r_c3t3_;
-}; // end class template Refine_facets_3_base
-
-/************************************************
-// Class Refine_facets_3
-//
-// Template parameters should be models of
-// Tr         : MeshTriangulation_3
-// Criteria   : SurfaceMeshFacetsCriteria_3
-// MeshDomain : MeshTraits_3
-//
-// Implements a Mesher_level for facets
-************************************************/
-
-// TODO document Container_ requirements
-template<class Tr,
-         class Criteria,
-         class MeshDomain,
-         class Complex3InTriangulation3,
-         class Previous_level_,
-         class Concurrency_tag,
-         template<class Tr_, class Cr_, class MD_, class C3T3_2, class Ct_, class C_2>
-            class Base_ = Refine_facets_3_base,
-#ifdef CGAL_LINKED_WITH_TBB
-         class Container_ = typename boost::mpl::if_c // (parallel/sequential?)
-         <
-          boost::is_convertible<Concurrency_tag, Parallel_tag>::value,
-          // Parallel
-# ifdef CGAL_MESH_3_USE_LAZY_UNSORTED_REFINEMENT_QUEUE
-          Meshes::Filtered_deque_container
-# else
-          Meshes::Filtered_multimap_container
-# endif
-          <
-            CGAL::cpp11::tuple<typename Tr::Facet, unsigned int,
-                               typename Tr::Facet, unsigned int>,
-            typename Criteria::Facet_quality,
-            Facet_to_refine_is_not_zombie<typename Tr::Facet>,
-            Concurrency_tag
-          >,
-          // Sequential
-# ifdef CGAL_MESH_3_USE_LAZY_UNSORTED_REFINEMENT_QUEUE
-          Meshes::Filtered_deque_container
-          <
-            CGAL::cpp11::tuple<typename Tr::Facet, unsigned int,
-                               typename Tr::Facet, unsigned int>,
-            typename Criteria::Facet_quality,
-            Facet_to_refine_is_not_zombie<typename Tr::Facet>,
-            Concurrency_tag
-          >
-# elif defined(CGAL_MESH_3_USE_LAZY_SORTED_REFINEMENT_QUEUE)
-          Meshes::Filtered_multimap_container
-          <
-            CGAL::cpp11::tuple<typename Tr::Facet, unsigned int,
-                               typename Tr::Facet, unsigned int>,
-            typename Criteria::Facet_quality,
-            Facet_to_refine_is_not_zombie<typename Tr::Facet>,
-            Concurrency_tag
-          >
-# else
-          Meshes::Double_map_container<typename Tr::Facet,
-                                       typename Criteria::Facet_quality>
-# endif
-         >::type // boost::if (parallel/sequential)
-
-#else // !CGAL_LINKED_WITH_TBB
-
-         // Sequential
-         class Container_ =
-# ifdef CGAL_MESH_3_USE_LAZY_UNSORTED_REFINEMENT_QUEUE
-          Meshes::Filtered_deque_container
-          <
-            CGAL::cpp11::tuple<typename Tr::Facet, unsigned int,
-                               typename Tr::Facet, unsigned int>,
-            typename Criteria::Facet_quality,
-            Facet_to_refine_is_not_zombie<typename Tr::Facet>,
-            Concurrency_tag
-          >
-# elif defined(CGAL_MESH_3_USE_LAZY_SORTED_REFINEMENT_QUEUE)
-          Meshes::Filtered_multimap_container
-          <
-            CGAL::cpp11::tuple<typename Tr::Facet, unsigned int,
-                               typename Tr::Facet, unsigned int>,
-            typename Criteria::Facet_quality,
-            Facet_to_refine_is_not_zombie<typename Tr::Facet>,
-            Concurrency_tag
-          >
-# else
-          Meshes::Double_map_container<typename Tr::Facet,
-                                       typename Criteria::Facet_quality>
-# endif
-#endif // CGAL_LINKED_WITH_TBB
->
-class Refine_facets_3
-: public Base_<Tr,
-               Criteria,
-               MeshDomain,
-               Complex3InTriangulation3,
-               Concurrency_tag,
-               Container_>
-, public Mesh_3::Mesher_level<Tr,
-                      Refine_facets_3<Tr,
-                                      Criteria,
-                                      MeshDomain,
-                                      Complex3InTriangulation3,
-                                      Previous_level_,
-                                      Concurrency_tag,
-                                      Base_,
-                                      Container_>,
-                      typename Tr::Facet,
-                      Previous_level_,
-                      Triangulation_mesher_level_traits_3<Tr>,
-                      Concurrency_tag >
-, public No_after_no_insertion
-, public No_before_conflicts
-{
-  // Self
-  typedef Refine_facets_3<Tr,
-                          Criteria,
-                          MeshDomain,
-                          Complex3InTriangulation3,
-                          Previous_level_,
-                          Concurrency_tag,
-                          Base_,
-                          Container_> Self;
-
-  typedef Base_<Tr,
-                Criteria,
-                MeshDomain,
-                Complex3InTriangulation3,
-                Concurrency_tag,
-                Container_> Rf_base;
-
-  typedef Rf_base Base;
-
-  typedef Mesher_level<Tr,
-                       Self,
-                       typename Tr::Facet,
-                       Previous_level_,
-                       Triangulation_mesher_level_traits_3<Tr>,
-                       Concurrency_tag >               Base_ML;
-
-  typedef typename Tr::Lock_data_structure Lock_data_structure;
-
-public:
-  using Base_ML::add_to_TLS_lists;
-  using Base_ML::splice_local_lists;
-
-  typedef Container_ Container; // Because we need it in Mesher_level
-  typedef typename Container::Element Container_element;
-  typedef typename Tr::Point Point;
-  typedef typename Tr::Facet Facet;
-  typedef typename Tr::Vertex_handle Vertex_handle;
-  typedef typename Triangulation_mesher_level_traits_3<Tr>::Zone Zone;
-  typedef Complex3InTriangulation3 C3T3;
-
-  /// Constructor
-  // For sequential
-  Refine_facets_3(Tr& triangulation,
-                  const Criteria& criteria,
-                  const MeshDomain& oracle,
-                  Previous_level_& previous,
-                  C3T3& c3t3);
-  // For parallel
-  Refine_facets_3(Tr& triangulation,
-                  const Criteria& criteria,
-                  const MeshDomain& oracle,
-                  Previous_level_& previous,
-                  C3T3& c3t3,
-                  Lock_data_structure *lock_ds,
-                  WorksharingDataStructureType *worksharing_ds);
-
-  /// Destructor
-  virtual ~Refine_facets_3() { }
-
-  /// Get a reference on triangulation
-  Tr& triangulation_ref_impl() { return this->r_tr_; }
-  const Tr& triangulation_ref_impl() const { return this->r_tr_; }
-
-  /// Initialization function
-  void scan_triangulation_impl();
-
-  int number_of_bad_elements_impl();
-
-  Point circumcenter_impl(const Facet& facet) const
-  {
-    return get_facet_surface_center(facet);
-  }
-
-  template <typename Mesh_visitor>
-  void before_next_element_refinement_in_superior_impl(Mesh_visitor visitor)
-  {
-    // Before refining any cell, we refine the facets in the local refinement
-    // queue
-    this->treat_local_refinement_queue(visitor);
-  }
-
-  void before_next_element_refinement_impl()
-  {
-  }
-
-  Facet get_next_local_element_impl()
-  {
-    return extract_element_from_container_value(
-      Container_::get_next_local_element_impl());
-  }
-
-  /// Tests if p encroaches facet from zone
-  // For sequential
-  Mesher_level_conflict_status
-  test_point_conflict_from_superior_impl(const Point& p, Zone& zone);
-
-  /// Tests if p encroaches facet from zone
-  // For parallel
-  template <typename Mesh_visitor>
-  Mesher_level_conflict_status
-  test_point_conflict_from_superior_impl(const Point& p, Zone& zone,
-                                         Mesh_visitor &visitor);
-
-  /// Useless here
-  Mesher_level_conflict_status private_test_point_conflict_impl(
-      const Point& p,
-      Zone& zone)
-  {
-    if( zone.locate_type == Tr::VERTEX )
-    {
-      std::stringstream sstr;
-      sstr << "(" << p << ") is already inserted on surface.\n";
-      CGAL_error_msg(sstr.str().c_str());
-      return CONFLICT_AND_ELEMENT_SHOULD_BE_DROPPED;
-    }
-    else
-      return NO_CONFLICT;
-  }
-
-  /// Returns the conflicts zone
-  Zone conflicts_zone_impl(const Point& point
-                           , const Facet& facet
-                           , bool &facet_is_in_its_cz);
-  Zone conflicts_zone_impl(const Point& point
-                           , const Facet& facet
-                           , bool &facet_is_in_its_cz
-                           , bool &could_lock_zone);
-
-  /// Insert p into triangulation
-  Vertex_handle insert_impl(const Point& p, const Zone& zone);
-
-  bool try_lock_element(const Facet &f, int lock_radius = 0) const
-  {
-    return this->triangulation().try_lock_facet(f, lock_radius);
-  }
-
-#ifdef CGAL_MESH_3_MESHER_STATUS_ACTIVATED
-  std::size_t queue_size() const { return this->size(); }
-#endif
-
-
-private:
-  // private types
-  typedef typename Tr::Cell_handle Cell_handle;
-  typedef typename MeshDomain::Surface_patch_index Surface_patch_index;
-  typedef typename MeshDomain::Index Index;
-  typedef typename Tr::Geom_traits Gt;
-  typedef typename Gt::Bare_point Bare_point;
-  typedef typename Gt::Ray_3 Ray_3;
-
-private:
-  // Disabled copy constructor
-  Refine_facets_3(const Self& src);
-  // Disabled assignment operator
-  Self& operator=(const Self& src);
-};  // end class Refine_facets_3
-
-
-
-
-// For sequential
-template<class Tr, class Cr, class MD, class C3T3_, class P_, class Ct, template<class Tr_, class Cr_, class MD_, class C3T3_2, class Ct_, class C_2> class B_, class C_>
-Refine_facets_3<Tr,Cr,MD,C3T3_,P_,Ct,B_,C_>::
-Refine_facets_3(Tr& triangulation,
-                const Cr& criteria,
-                const MD& oracle,
-                P_& previous,
-                C3T3& c3t3)
-  : Rf_base(triangulation, c3t3, oracle, criteria)
-  , Mesher_level<Tr, Self, Facet, P_,
-      Triangulation_mesher_level_traits_3<Tr>, Ct>(previous)
-  , No_after_no_insertion()
-  , No_before_conflicts()
-{
-
-}
-
-// For parallel
-template<class Tr, class Cr, class MD, class C3T3_, class P_, class Ct, template<class Tr_, class Cr_, class MD_, class C3T3_2, class Ct_, class C_2> class B_, class C_>
-Refine_facets_3<Tr,Cr,MD,C3T3_,P_,Ct,B_,C_>::
-Refine_facets_3(Tr& triangulation,
-                const Cr& criteria,
-                const MD& oracle,
-                P_& previous,
-                C3T3& c3t3,
-                Lock_data_structure *lock_ds,
-                WorksharingDataStructureType *worksharing_ds)
-  : Rf_base(triangulation, c3t3, oracle, criteria)
-  , Mesher_level<Tr, Self, Facet, P_,
-      Triangulation_mesher_level_traits_3<Tr>, Ct>(previous)
-  , No_after_no_insertion()
-  , No_before_conflicts()
-{
-  Base::set_lock_ds(lock_ds);
-  Base::set_worksharing_ds(worksharing_ds);
-}
-
-
-template<class Tr, class Cr, class MD, class C3T3_, class P_, class Ct, template<class Tr_, class Cr_, class MD_, class C3T3_2, class Ct_, class C_2> class B_, class C_>
-void
-Refine_facets_3<Tr,Cr,MD,C3T3_,P_,Ct,B_,C_>::
-scan_triangulation_impl()
-{
-  typedef typename Tr::Finite_facets_iterator Finite_facet_iterator;
-
-#ifdef CGAL_MESH_3_PROFILING
-  WallClockTimer t;
-#endif
-
-#ifdef CGAL_MESH_3_VERY_VERBOSE
-  std::cerr
-    << "Vertices: " << this->r_c3t3_.triangulation().number_of_vertices() << std::endl
-    << "Facets  : " << this->r_c3t3_.number_of_facets_in_complex() << std::endl
-    << "Tets    : " << this->r_c3t3_.number_of_cells_in_complex() << std::endl;
-#endif
-
-#ifdef CGAL_LINKED_WITH_TBB
-  // Parallel
-  if (boost::is_convertible<Ct, Parallel_tag>::value)
-  {
-# if defined(CGAL_MESH_3_VERBOSE) || defined(CGAL_MESH_3_PROFILING)
-    std::cerr << "Scanning triangulation for bad facets (in parallel) - "
-      "number of finite facets = "
-      << this->r_c3t3_.triangulation().number_of_finite_facets() << "..."
-      << std::endl;
-# endif
-    add_to_TLS_lists(true);
-
-    // PARALLEL_DO
-    tbb::parallel_do(
-      this->r_tr_.finite_facets_begin(), this->r_tr_.finite_facets_end(),
-      typename Rf_base::template Scan_facet<Self>(*this) 
-    );
-
-    splice_local_lists();
-    add_to_TLS_lists(false);
-  }
-  // Sequential
-  else
-#endif // CGAL_LINKED_WITH_TBB
-  {
-#if defined(CGAL_MESH_3_VERBOSE) || defined(CGAL_MESH_3_PROFILING)
-    std::cerr << "Scanning triangulation for bad facets (sequential) - "
-      "number of finite facets = "
-      << this->r_c3t3_.triangulation().number_of_finite_facets() << "..."
-      << std::endl;
-#endif
-    for(Finite_facet_iterator facet_it = this->r_tr_.finite_facets_begin();
-        facet_it != this->r_tr_.finite_facets_end();
-        ++facet_it)
-    {
-      // Cannot be const, see treat_new_facet signature
-      Facet facet = *facet_it;
-      /*std::cerr << "*" << *facet.first->vertex((facet.second+1)%4)  << std::endl
-          << "  " << *facet.first->vertex((facet.second+2)%4)  << std::endl
-          << "  " << *facet.first->vertex((facet.second+3)%4)  << std::endl;*/
-      this->treat_new_facet(facet);
-    }
-  }
-
-#ifdef CGAL_MESH_3_PROFILING
-  std::cerr << "==== Facet scan: " << t.elapsed() << " seconds ===="
-            << std::endl << std::endl;
-#endif
-
-#if defined(CGAL_MESH_3_VERBOSE) || defined(CGAL_MESH_3_PROFILING)
-  std::cerr << "Number of bad facets: " << C_::size() << std::endl;
-#endif
-
-#ifdef CGAL_MESH_3_PROFILING
-  std::cerr << "Refining... ";
-  Base_ML::m_timer.reset();
-#endif
-  Base::scan_triangulation_impl_amendement();
-}
-
-
-
-template<class Tr, class Cr, class MD, class C3T3_, class P_, class Ct, template<class Tr_, class Cr_, class MD_, class C3T3_2, class Ct_, class C_2> class B_, class C_>
-int
-Refine_facets_3<Tr,Cr,MD,C3T3_,P_,Ct,B_,C_>::
-number_of_bad_elements_impl()
-{
-  typedef typename Tr::Finite_facets_iterator Finite_facet_iterator;
-
-  int count = 0, count_num_bad_surface_facets = 0;
-  int num_internal_facets_that_should_be_on_surface = 0;
-#if defined(CGAL_MESH_3_VERBOSE) || defined(CGAL_MESH_3_PROFILING)
-  std::cerr << "Scanning triangulation for bad facets - "
-    "number of finite facets = "
-    << this->r_c3t3_.triangulation().number_of_finite_facets() << "...";
-#endif
-  int num_tested_facets = 0;
-  for(Finite_facet_iterator facet_it = this->r_tr_.finite_facets_begin();
-      facet_it != this->r_tr_.finite_facets_end();
-      ++facet_it)
-  {
-    Facet facet = *facet_it;
-    typename Rf_base::Facet_properties properties;
-    compute_facet_properties(facet, properties);
-
-#ifdef SHOW_REMAINING_BAD_ELEMENT_IN_RED
-    //facet.first->mark = 0;
-#endif
-
-    // On surface?
-    if ( properties )
-    {
-      // This facet should be on surface...
-      if (!this->is_facet_on_surface(facet))
-      {
-        std::cerr << "\n\n*** The facet f is on surface but is NOT MARKED ON SURFACE. " << std::endl;
-
-        Cell_handle c = facet.first;
-        int ind = facet.second;
-        Cell_handle mc = mirror_facet(facet).first;
-        int mind = mirror_facet(facet).second;
-
-#ifdef SHOW_REMAINING_BAD_ELEMENT_IN_RED
-        c->mark2 = ind;
-#endif
-
-        // c and mc are the cells adjacent to f
-        // browse each facet ff of c and mc, and mark it if it is "on surface"
-        int num_erroneous_surface_facets_in_c = 0;
-        int num_erroneous_surface_facets_in_mc = 0;
-        int num_real_surface_facets_in_c = 0;
-        int num_real_surface_facets_in_mc = 0;
-        for (int i = 0 ; i < 4 ; ++i)
-        {
-          if (i != ind)
-          {
-            const Facet f1(c, i);
-            if (this->is_facet_on_surface(f1))
-            {
-              std::cerr << "*** f1 is " << (this->r_criteria_(f1) ? "bad" : "good") << std::endl;
-
-#ifdef SHOW_REMAINING_BAD_ELEMENT_IN_RED
-              c->mark = i;
-#endif
-              typename Rf_base::Facet_properties properties;
-              compute_facet_properties(f1, properties);
-              if (properties)
-                ++num_real_surface_facets_in_c;
-              else
-                ++num_erroneous_surface_facets_in_c;
-            }
-          }
-          if (i != mind)
-          {
-            const Facet f2(c, i);
-            if (this->is_facet_on_surface(f2))
-            {
-              std::cerr << "*** f2 is " << (this->r_criteria_(f2) ? "bad" : "good") << std::endl;
-
-#ifdef SHOW_REMAINING_BAD_ELEMENT_IN_RED
-              mc->mark = i;
-#endif
-              typename Rf_base::Facet_properties properties;
-              this->compute_facet_properties(f2, properties);
-              if (properties)
-                ++num_real_surface_facets_in_mc;
-              else
-                ++num_erroneous_surface_facets_in_mc;
-            }
-          }
-        }
-
-        std::cerr
-          << "*** Num of erroneous surface facets in c: " << num_erroneous_surface_facets_in_c << std::endl
-          << "*** Num of erroneous surface facets in mc: " << num_erroneous_surface_facets_in_mc << std::endl
-          << "*** Num of real surface facets in c: " << num_real_surface_facets_in_c << std::endl
-          << "*** Num of real surface facets in mc: " << num_real_surface_facets_in_mc << std::endl;
-
-        const bool is_c_in_domain = this->r_oracle_.is_in_domain_object()(this->r_tr_.dual(c));
-        const bool is_mc_in_domain = this->r_oracle_.is_in_domain_object()(this->r_tr_.dual(mc));
-
-        std::cerr << "*** Is in complex? c is marked in domain: " << this->r_c3t3_.is_in_complex(c)
-          << " / c is really in domain: " << is_c_in_domain
-          << " / mc is marked in domain: " << this->r_c3t3_.is_in_complex(mc)
-          << " / mc is really in domain: " << is_mc_in_domain
-          << std::endl;
-
-
-        // ... if it's not, count it
-        ++num_internal_facets_that_should_be_on_surface;
-
-      }
-
-      const Surface_patch_index& surface_index = CGAL::cpp11::get<0>(*properties);
-      const Index& surface_center_index = CGAL::cpp11::get<1>(*properties);
-      const Point& surface_center = CGAL::cpp11::get<2>(*properties);
-
-      // Facet is on surface: set facet properties
-      //set_facet_surface_center(facet, surface_center, surface_center_index);
-      //set_facet_on_surface(facet, surface_index);
-
-      const typename Rf_base::Is_facet_bad is_facet_bad = this->r_criteria_(facet);
-      if ( is_facet_bad )
-      {
-        ++count;
-        if (this->is_facet_on_surface(facet))
-          ++count_num_bad_surface_facets;
-
-#ifdef SHOW_REMAINING_BAD_ELEMENT_IN_RED
-        //facet.first->mark = facet.second;
-#endif
-      }
-      ++ num_tested_facets;
-    }
-    // Not on surface?
-    else
-    {
-      // Facet is not on surface
-      //remove_facet_from_surface(facet);
-
-      // Marked on surface?
-      if (this->is_facet_on_surface(facet))
-      {
-        std::cerr << "************** The facet is marked on surface whereas it's not! **************" << std::endl;
-#ifdef SHOW_REMAINING_BAD_ELEMENT_IN_RED
-        facet.first->mark = facet.second;
-#endif
-      }
-    }
-  }
-
-  /*std::cerr << "done (" << num_internal_facets_that_should_be_on_surface
-    << " facets which were internal facets were added to the surface)." << std::endl;*/
-  std::cerr << "done (" << num_internal_facets_that_should_be_on_surface
-    << " facets that should be on surface are actually internal facets)." << std::endl;
-  std::cerr << std::endl << "Num_tested_facets = " << num_tested_facets << std::endl;
-  std::cerr << std::endl << "Num bad surface-marked facets = " << count_num_bad_surface_facets << std::endl;
-
-  return count;
-}
-
-// For sequential
-template<class Tr, class Cr, class MD, class C3T3_, class P_, class Ct, template<class Tr_, class Cr_, class MD_, class C3T3_2, class Ct_, class C_2> class B_, class C_>
-Mesher_level_conflict_status
-Refine_facets_3<Tr,Cr,MD,C3T3_,P_,Ct,B_,C_>::
-test_point_conflict_from_superior_impl(const Point& point, Zone& zone)
-{
-  typedef typename Zone::Facets_iterator Facet_iterator;
-
-  for (Facet_iterator facet_it = zone.internal_facets.begin();
-       facet_it != zone.internal_facets.end();
-       ++facet_it)
-  {
-    // surface facets which are internal facets of the conflict zone are
-    // encroached
-    if( this->is_facet_on_surface(*facet_it) )
-    {
-      if ( this->is_encroached_facet_refinable(*facet_it) )
-      {
-        this->insert_encroached_facet_in_queue(*facet_it);
-        return CONFLICT_BUT_ELEMENT_CAN_BE_RECONSIDERED;
-      }
-      else
-        return CONFLICT_AND_ELEMENT_SHOULD_BE_DROPPED;
-    }
-  }
-
-  for (Facet_iterator facet_it = zone.boundary_facets.begin();
-       facet_it != zone.boundary_facets.end();
-       ++facet_it)
-  {
-    if( this->is_facet_encroached(*facet_it, point) )
-    {
-      // Insert already existing surface facet into refinement queue
-      if ( this->is_encroached_facet_refinable(*facet_it) )
-      {
-        this->insert_encroached_facet_in_queue(*facet_it);
-        return CONFLICT_BUT_ELEMENT_CAN_BE_RECONSIDERED;
-      }
-      else
-        return CONFLICT_AND_ELEMENT_SHOULD_BE_DROPPED;
-    }
-  }
-
-  return NO_CONFLICT;
-}
-
-// For parallel
-template<class Tr, class Cr, class MD, class C3T3_, class P_, class Ct, template<class Tr_, class Cr_, class MD_, class C3T3_2, class Ct_, class C_2> class B_, class C_>
-template <typename Mesh_visitor>
-Mesher_level_conflict_status
-Refine_facets_3<Tr,Cr,MD,C3T3_,P_,Ct,B_,C_>::
-test_point_conflict_from_superior_impl(const Point& point, Zone& zone,
-                                       Mesh_visitor &visitor)
-{
-  typedef typename Zone::Facets_iterator Facet_iterator;
-
-  for (Facet_iterator facet_it = zone.internal_facets.begin();
-       facet_it != zone.internal_facets.end();
-       ++facet_it)
-  {
-    // surface facets which are internal facets of the conflict zone are
-    // encroached
-    if( this->is_facet_on_surface(*facet_it) )
-    {
-      if ( this->is_encroached_facet_refinable(*facet_it) )
-      {
-        // Even if it doesn't succeed, it will be tried again
-        this->try_to_refine_element(*facet_it, visitor);
-        return CONFLICT_BUT_ELEMENT_CAN_BE_RECONSIDERED;
-      }
-      else
-        return CONFLICT_AND_ELEMENT_SHOULD_BE_DROPPED;
-    }
-  }
-
-  for (Facet_iterator facet_it = zone.boundary_facets.begin();
-       facet_it != zone.boundary_facets.end();
-       ++facet_it)
-  {
-    if( this->is_facet_encroached(*facet_it, point) )
-    {
-      // Insert already existing surface facet into refinement queue
-      if ( this->is_encroached_facet_refinable(*facet_it) )
-      {
-        // Even if it doesn't succeed, it will be tried again
-        this->try_to_refine_element(*facet_it, visitor);
-        return CONFLICT_BUT_ELEMENT_CAN_BE_RECONSIDERED;
-      }
-      else
-        return CONFLICT_AND_ELEMENT_SHOULD_BE_DROPPED;
-    }
-  }
-
-  return NO_CONFLICT;
-}
-
-
-template<class Tr, class Cr, class MD, class C3T3_, class P_, class Ct, template<class Tr_, class Cr_, class MD_, class C3T3_2, class Ct_, class C_2> class B_, class C_>
-typename Refine_facets_3<Tr,Cr,MD,C3T3_,P_,Ct,B_,C_>::Zone
-Refine_facets_3<Tr,Cr,MD,C3T3_,P_,Ct,B_,C_>::
-conflicts_zone_impl(const Point& point
-                    , const Facet& facet
-                    , bool &facet_is_in_its_cz)
-{
-  Zone zone;
-
-  // TODO may be avoid the locate here
-  zone.cell = this->r_tr_.locate(point,
-                                 zone.locate_type,
-                                 zone.i,
-                                 zone.j,
-                                 facet.first);
-
-  if(zone.locate_type != Tr::VERTEX)
-  {
-    const Facet *p_facet = (facet == Facet() ? 0 : &facet);
-
-    this->r_tr_.find_conflicts(point,
-                               zone.cell,
-                               std::back_inserter(zone.boundary_facets),
-                               std::back_inserter(zone.cells),
-                               std::back_inserter(zone.internal_facets)
-                               , 0
-                               , p_facet
-                               , &facet_is_in_its_cz);
-
-    if (p_facet != 0 && !facet_is_in_its_cz)
-    {
-# ifdef CGAL_MESH_3_VERBOSE
-      std::cerr << "Info: the facet is not in the conflict zone of (" << point
-                << "). Switching to exact computation." << std::endl;
-# endif
-      
-      typename Rf_base::Facet_properties properties;
-      this->compute_facet_properties(facet, properties, /*force_exact=*/true);
-      if ( properties )
-      {
-        const Surface_patch_index& surface_index = CGAL::cpp11::get<0>(*properties);
-        const Index& surface_center_index = CGAL::cpp11::get<1>(*properties);
-        const Point& surface_center = CGAL::cpp11::get<2>(*properties);
-
-        // Facet is on surface: set facet properties
-        this->set_facet_surface_center(facet, surface_center, surface_center_index);
-        this->set_facet_on_surface(facet, surface_index);
-      }
-      else
-      {
-        // Facet is not on surface
-        this->remove_facet_from_surface(facet);
-      }
-    }
-  }
-
-  return zone;
-}
-
-template<class Tr, class Cr, class MD, class C3T3_, class P_, class Ct, template<class Tr_, class Cr_, class MD_, class C3T3_2, class Ct_, class C_2> class B_, class C_>
-typename Refine_facets_3<Tr,Cr,MD,C3T3_,P_,Ct,B_,C_>::Zone
-Refine_facets_3<Tr,Cr,MD,C3T3_,P_,Ct,B_,C_>::
-conflicts_zone_impl(const Point& point
-                    , const Facet& facet
-                    , bool &facet_is_in_its_cz
-                    , bool &could_lock_zone)
-{
-  Zone zone;
-
-  // TODO may be avoid the locate here
-  zone.cell = this->r_tr_.locate(point,
-                                 zone.locate_type,
-                                 zone.i,
-                                 zone.j,
-                                 facet.first,
-                                 &could_lock_zone);
-
-  if(could_lock_zone && zone.locate_type != Tr::VERTEX)
-  {
-    const Facet *p_facet = (facet == Facet() ? 0 : &facet);
-
-    this->r_tr_.find_conflicts(point,
-                               zone.cell,
-                               std::back_inserter(zone.boundary_facets),
-                               std::back_inserter(zone.cells),
-                               std::back_inserter(zone.internal_facets)
-                               , &could_lock_zone
-                               , p_facet
-                               , &facet_is_in_its_cz);
-
-    if (could_lock_zone && p_facet != 0 && !facet_is_in_its_cz)
-    {
-#ifdef CGAL_MESH_3_VERBOSE
-      std::cerr << "Info: the facet is not in its conflict zone. "
-        "Switching to exact computation." << std::endl;
-#endif
-
-      typename Rf_base::Facet_properties properties;
-      this->compute_facet_properties(facet, properties, /*force_exact=*/true);
-      if ( properties )
-      {
-        const Surface_patch_index& surface_index = CGAL::cpp11::get<0>(*properties);
-        const Index& surface_center_index = CGAL::cpp11::get<1>(*properties);
-        const Point& surface_center = CGAL::cpp11::get<2>(*properties);
-
-        // Facet is on surface: set facet properties
-        this->set_facet_surface_center(facet, surface_center, surface_center_index);
-        this->set_facet_on_surface(facet, surface_index);
-      }
-      else
-      {
-        // Facet is not on surface
-        this->remove_facet_from_surface(facet);
-      }
-    }
-  }
-
-  return zone;
-}
-
-
-template<class Tr, class Cr, class MD, class C3T3_, class Ct, class C_>
-void
-Refine_facets_3_base<Tr,Cr,MD,C3T3_,Ct,C_>::
-before_insertion_impl(const Facet& facet,
-                      const Point& point,
-                      Zone& zone)
-{
-  typedef typename Zone::Facets_iterator Facets_iterator;
-
-  bool source_facet_is_in_conflict = false;
-
-  /*std::cerr << "before_insertion_impl:" << std::endl
-    << "* " << *facet.first->vertex((facet.second+1)%4)  << std::endl
-    << "  " << *facet.first->vertex((facet.second+2)%4)  << std::endl
-    << "  " << *facet.first->vertex((facet.second+3)%4)  << std::endl;*/
-
-  // Iterate on conflict zone facets
-  for (Facets_iterator facet_it = zone.internal_facets.begin();
-       facet_it != zone.internal_facets.end();
-       ++facet_it)
-  {
-    if (before_insertion_handle_facet_in_conflict_zone(*facet_it, facet) )
-    {
-      source_facet_is_in_conflict = true;
-    }
-  }
-
-  for (Facets_iterator facet_it = zone.boundary_facets.begin() ;
-       facet_it != zone.boundary_facets.end() ;
-       ++facet_it)
-  {
-    if (before_insertion_handle_facet_on_conflict_zone(*facet_it, facet))
-    {
-      source_facet_is_in_conflict = true;
-    }
-  }
-
-  // source_facet == Facet() when this->before_insertion_impl is
-  // called from a Mesh_3 visitor.
-  if ( !source_facet_is_in_conflict && facet != Facet()  )
-  {
-    const Facet source_other_side = mirror_facet(facet);
-
-    using boost::io::group;
-    using std::setprecision;
-
-    std::stringstream error_msg;
-    error_msg <<
-      boost::format("Mesh_3 ERROR: "
-                    "A facet is not in conflict with its refinement point!\n"
-                    "Debugging informations:\n"
-                    "  Facet: (%1%, %2%) = (%6%, %7%, %8%)\n"
-                    "  Dual: %3%\n"
-                    "  Refinement point: %5%\n"
-                    "  Cells adjacent to facet:\n"
-                    "    ( %9% , %10% , %11% , %12% )\n"
-                    "    ( %13% , %14% , %15% , %16% )\n")
-      % group(setprecision(17), (&*facet.first))
-      % group(setprecision(17), facet.second)
-      % display_dual(facet)
-      % 0 // dummy: %4% no longer used
-      % group(setprecision(17), point)
-      % group(setprecision(17), facet.first->vertex((facet.second + 1)&3)->point())
-      % group(setprecision(17), facet.first->vertex((facet.second + 2)&3)->point())
-      % group(setprecision(17), facet.first->vertex((facet.second + 3)&3)->point())
-      % facet.first->vertex(0)->point()
-      % facet.first->vertex(1)->point()
-      % facet.first->vertex(2)->point()
-      % facet.first->vertex(3)->point()
-      % source_other_side.first->vertex(0)->point()
-      % source_other_side.first->vertex(1)->point()
-      % source_other_side.first->vertex(2)->point()
-      % source_other_side.first->vertex(3)->point();
-
-    CGAL_error_msg(error_msg.str().c_str());
-  }
-}
-
-
-
-template<class Tr, class Cr, class MD, class C3T3_, class P_, class Ct, template<class Tr_, class Cr_, class MD_, class C3T3_2, class Ct_, class C_2> class B_, class C_>
-typename Refine_facets_3<Tr,Cr,MD,C3T3_,P_,Ct,B_,C_>::Vertex_handle
-Refine_facets_3<Tr,Cr,MD,C3T3_,P_,Ct,B_,C_>::
-insert_impl(const Point& point,
-            const Zone& zone)
-{
-  if( zone.locate_type == Tr::VERTEX )
-  {
-    // TODO look at this
-    std::cerr<<"VERTEX\n";
-    return zone.cell->vertex(zone.i);
-  }
-
-  const Facet& facet = *(zone.boundary_facets.begin());
-
-  Vertex_handle v = this->r_tr_.insert_in_hole(point,
-                                               zone.cells.begin(),
-                                               zone.cells.end(),
-                                               facet.first,
-                                               facet.second);
-
-  // Set index and dimension of v
-  this->set_vertex_properties(v, Base::get_last_vertex_index());
-
-  return v;
-}
-
-
-
-template<class Tr, class Cr, class MD, class C3T3_, class Ct, class C_>
-void
-Refine_facets_3_base<Tr,Cr,MD,C3T3_,Ct,C_>::
-restore_restricted_Delaunay(const Vertex_handle& vertex)
-{
-  typedef std::vector<Cell_handle> Cell_handle_vector;
-  typedef typename Cell_handle_vector::iterator Cell_handle_vector_iterator;
-
-  // Update incident facets
-  Cell_handle_vector cells;
-  r_tr_.incident_cells(vertex, std::back_inserter(cells));
-
-  for(Cell_handle_vector_iterator cell_it = cells.begin();
-      cell_it != cells.end();
-      ++cell_it)
-  {
-    // Look at all four facets of the cell, starting with the
-    // facet opposite to the new vertex
-    int index = (*cell_it)->index(vertex);
-
-    Facet opposite_facet(*cell_it, index);
-    after_insertion_handle_opposite_facet(opposite_facet);
-
-    for (int i = 1; i <= 3; ++i)
-    {
-      Facet incident_facet(*cell_it, (index+i)&3);
-      after_insertion_handle_incident_facet(incident_facet);
-    }
-  }
-}
-
-//-------------------------------------------------------
-// Private methods
-//-------------------------------------------------------
-template<class Tr, class Cr, class MD, class C3T3_, class Ct, class C_>
-void
-Refine_facets_3_base<Tr,Cr,MD,C3T3_,Ct,C_>::
-treat_new_facet(Facet& facet)
-{
-  // Treat facet
-  Facet_properties properties;
-  compute_facet_properties(facet, properties);
-  if ( properties )
-  {
-    const Surface_patch_index& surface_index = CGAL::cpp11::get<0>(*properties);
-    const Index& surface_center_index = CGAL::cpp11::get<1>(*properties);
-    const Point& surface_center = CGAL::cpp11::get<2>(*properties);
-
-    // Facet is on surface: set facet properties
-    set_facet_surface_center(facet, surface_center, surface_center_index);
-    set_facet_on_surface(facet, surface_index);
-
-    // Insert facet into refinement queue if needed
-    const Is_facet_bad is_facet_bad = r_criteria_(facet);
-
-    if ( is_facet_bad )
-    {
-      insert_bad_facet(facet, *is_facet_bad);
-
-      /*std::cerr << "INSERT BAD FACET : " << std::endl
-        << "* " << *facet.first->vertex((facet.second+1)%4)  << std::endl
-        << "  " << *facet.first->vertex((facet.second+2)%4)  << std::endl
-        << "  " << *facet.first->vertex((facet.second+3)%4)  << std::endl
-        << "  Quality=" << is_facet_bad->second << std::endl;*/
-    }
-  }
-  else
-  {
-    // Facet is not on surface
-    this->remove_facet_from_surface(facet);
-  }
-
-  // Set facet visited
-  Facet mirror = mirror_facet(facet);
-  set_facet_visited(facet);
-  set_facet_visited(mirror);
-}
-
-template<class Tr, class Cr, class MD, class C3T3_, class Ct, class C_>
-void
-Refine_facets_3_base<Tr,Cr,MD,C3T3_,Ct,C_>::
-dual_segment(const Facet & facet, Bare_point& p, Bare_point& q) const
-{
-  Cell_handle c = facet.first;
-  int i = facet.second;
-  Cell_handle n = c->neighbor(i);
-  CGAL_assertion( ! r_tr_.is_infinite(c) && ! r_tr_.is_infinite(n) );
-  p = Gt().construct_weighted_circumcenter_3_object()(
-      c->vertex(0)->point(),
-      c->vertex(1)->point(),
-      c->vertex(2)->point(),
-      c->vertex(3)->point());
-  q = Gt().construct_weighted_circumcenter_3_object()(
-      n->vertex(0)->point(),
-      n->vertex(1)->point(),
-      n->vertex(2)->point(),
-      n->vertex(3)->point());
-}
-
-template<class Tr, class Cr, class MD, class C3T3_, class Ct, class C_>
-void
-Refine_facets_3_base<Tr,Cr,MD,C3T3_,Ct,C_>::
-dual_segment_exact(const Facet & facet, Bare_point& p, Bare_point& q) const
-{
-  Cell_handle c = facet.first;
-  int i = facet.second;
-  Cell_handle n = c->neighbor(i);
-  CGAL_assertion( ! r_tr_.is_infinite(c) && ! r_tr_.is_infinite(n) );
-  p = Gt().construct_weighted_circumcenter_3_object()(
-      c->vertex(0)->point(),
-      c->vertex(1)->point(),
-      c->vertex(2)->point(),
-      c->vertex(3)->point(),
-      true);
-  q = Gt().construct_weighted_circumcenter_3_object()(
-      n->vertex(0)->point(),
-      n->vertex(1)->point(),
-      n->vertex(2)->point(),
-      n->vertex(3)->point(),
-      true);
-}
-
-template<class Tr, class Cr, class MD, class C3T3_, class Ct, class C_>
-void
-Refine_facets_3_base<Tr,Cr,MD,C3T3_,Ct,C_>::
-dual_ray(const Facet & facet, Ray_3& ray) const
-{
-  Cell_handle c = facet.first;
-  int i = facet.second;
-  Cell_handle n = c->neighbor(i);
-  // either n or c is infinite
-  int in;
-  if ( r_tr_.is_infinite(c) )
-    in = n->index(c);
-  else {
-    n = c;
-    in = i;
-  }
-  // n now denotes a finite cell, either c or c->neighbor(i)
-  int ind[3] = {(in+1)&3,(in+2)&3,(in+3)&3};
-  if ( (in&1) == 1 )
-    std::swap(ind[0], ind[1]);
-  const Point& p = n->vertex(ind[0])->point();
-  const Point& q = n->vertex(ind[1])->point();
-  const Point& r = n->vertex(ind[2])->point();
-
-  typename Gt::Line_3 l = Gt().construct_perpendicular_line_3_object()
-    ( Gt().construct_plane_3_object()(p,q,r),
-      Gt().construct_weighted_circumcenter_3_object()(p,q,r) );
-
- ray = Gt().construct_ray_3_object()(Gt().construct_weighted_circumcenter_3_object()(
-        n->vertex(0)->point(),
-        n->vertex(1)->point(),
-        n->vertex(2)->point(),
-        n->vertex(3)->point()), l);
-}
-
-template<class Tr, class Cr, class MD, class C3T3_, class Ct, class C_>
-void
-Refine_facets_3_base<Tr,Cr,MD,C3T3_,Ct,C_>::
-dual_ray_exact(const Facet & facet, Ray_3& ray) const
-{
-  Cell_handle c = facet.first;
-  int i = facet.second;
-  Cell_handle n = c->neighbor(i);
-  // either n or c is infinite
-  int in;
-  if ( r_tr_.is_infinite(c) )
-    in = n->index(c);
-  else {
-    n = c;
-    in = i;
-  }
-  // n now denotes a finite cell, either c or c->neighbor(i)
-  int ind[3] = {(in+1)&3,(in+2)&3,(in+3)&3};
-  if ( (in&1) == 1 )
-    std::swap(ind[0], ind[1]);
-  const Point& p = n->vertex(ind[0])->point();
-  const Point& q = n->vertex(ind[1])->point();
-  const Point& r = n->vertex(ind[2])->point();
-
-  typename Gt::Line_3 l = Gt().construct_perpendicular_line_3_object()
-    ( Gt().construct_plane_3_object()(p,q,r),
-      Gt().construct_weighted_circumcenter_3_object()(p,q,r) );
-
- ray = Gt().construct_ray_3_object()(Gt().construct_weighted_circumcenter_3_object()(
-        n->vertex(0)->point(),
-        n->vertex(1)->point(),
-        n->vertex(2)->point(),
-        n->vertex(3)->point(),
-        true), l);
-}
-
-
-
-
-
-template<class Tr, class Cr, class MD, class C3T3_, class Ct, class C_>
-void
-Refine_facets_3_base<Tr,Cr,MD,C3T3_,Ct,C_>::
-compute_facet_properties(const Facet& facet,
-                         Facet_properties& fp,
-                         bool force_exact) const
-{
-  //-------------------------------------------------------
-  // Facet must be finite
-  //-------------------------------------------------------
-  CGAL_assertion( ! r_tr_.is_infinite(facet) );
-  CGAL_assertion( r_tr_.dimension() == 3 );
-
-  // types
-  typedef boost::optional<typename MD::Surface_patch_index> Surface_patch;
-  typedef typename MD::Intersection Intersection;
-
-  // Functor
-  typename Gt::Is_degenerate_3 is_degenerate = Gt().is_degenerate_3_object();
-  typename Gt::Compare_xyz_3 compare_xyz = Gt().compare_xyz_3_object();
-#ifndef CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
-  typename MD::Do_intersect_surface do_intersect_surface =
-      r_oracle_.do_intersect_surface_object();
-#endif // not CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
-
-
- typedef typename Gt::Bare_point Bare_point;
-
-  Cell_handle c = facet.first;
-  int i = facet.second;
-  Cell_handle n = c->neighbor(i);
-  if ( ! r_tr_.is_infinite(c) && ! r_tr_.is_infinite(n) ){
-    // the dual is a segment
-    Bare_point p1, p2;
-    if(force_exact){
-      dual_segment_exact(facet, p1, p2);
-    } else {
-      dual_segment(facet, p1, p2);
-    }
-    if (p1 == p2) { fp = Facet_properties(); return; }
-
-    // Trick to have canonical vector : thus, we compute always the same
-    // intersection
-    Segment_3 segment = ( compare_xyz(p1,p2)== CGAL::SMALLER )
-      ? Segment_3(p1, p2)
-      : Segment_3(p2, p1);
-
-    // If facet is on surface, compute intersection point and return true
-#ifndef CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
-    Surface_patch surface = do_intersect_surface(segment);
-    if ( surface )
-#endif // not CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
-    {
-      typename MD::Construct_intersection construct_intersection =
-          r_oracle_.construct_intersection_object();
-
-      Intersection intersect = construct_intersection(segment);
-#ifdef CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
-      // In the following, CGAL::cpp11::get<2>(intersect) == 0 is a way to
-      // test "intersect == Intersection()" (aka empty intersection), but
-      // the later does not work.
-      Surface_patch surface =
-        (CGAL::cpp11::get<2>(intersect) == 0) ? Surface_patch() :
-        Surface_patch(
-          r_oracle_.surface_patch_index(CGAL::cpp11::get<1>(intersect)));
-      if(surface)
-#endif // CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
-      fp =  Facet_properties(CGAL::cpp11::make_tuple(*surface,
-                                    CGAL::cpp11::get<1>(intersect),
-                                    Point(CGAL::cpp11::get<0>(intersect))));
-    }
-  }
-  // If the dual is a ray
-  else
-  {
-    // If a facet is on the convex hull, and if its finite incident
-    // cell has a very big Delaunay ball, then the dual of the facet is
-    // a ray constructed with a point with very big coordinates, and a
-    // vector with small coordinates. Its can happen than the
-    // constructed ray is degenerate (the point(1) of the ray is
-    // point(0) plus a vector whose coordinates are epsilon).
-    Ray_3 ray;
-    if(force_exact){
-      dual_ray_exact(facet,ray);
-    } else {
-      dual_ray(facet,ray);
-    }
-    if (is_degenerate(ray)) { fp = Facet_properties(); return; }
-
-#ifndef CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
-    Surface_patch surface = do_intersect_surface(ray);
-    if ( surface )
-#endif // not CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
-    {
-      typename MD::Construct_intersection construct_intersection =
-          r_oracle_.construct_intersection_object();
-
-      Intersection intersect = construct_intersection(ray);
-#ifdef CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
-      Surface_patch surface =
-        (CGAL::cpp11::get<2>(intersect) == 0) ? Surface_patch() :
-        Surface_patch(
-          r_oracle_.surface_patch_index(CGAL::cpp11::get<1>(intersect)));
-      if(surface)
-#endif // CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
-      {
-        fp = Facet_properties(CGAL::cpp11::make_tuple(*surface,
-                                      CGAL::cpp11::get<1>(intersect),
-                                      Point(CGAL::cpp11::get<0>(intersect))));
-      }
-    }
-  }
-}
-
-
-template<class Tr, class Cr, class MD, class C3T3_, class Ct, class C_>
-bool
-Refine_facets_3_base<Tr,Cr,MD,C3T3_,Ct,C_>::
-is_facet_encroached(const Facet& facet,
-                    const Point& point) const
-{
-  if ( r_tr_.is_infinite(facet) || ! this->is_facet_on_surface(facet) )
-  {
-    return false;
-  }
-
-  typename Gt::Compare_power_distance_3 compare_distance =
-    r_tr_.geom_traits().compare_power_distance_3_object();
-
-  const Cell_handle& cell = facet.first;
-  const int& facet_index = facet.second;
-  const Point& center = get_facet_surface_center(facet);
-  const Point& reference_point = cell->vertex((facet_index+1)&3)->point();
-
-  // facet is encroached if the new point is near from center than
-  // one vertex of the facet
-  return ( compare_distance(center, reference_point, point) != CGAL::SMALLER );
-}
-
-template<class Tr, class Cr, class MD, class C3T3_, class Ct, class C_>
-bool
-Refine_facets_3_base<Tr,Cr,MD,C3T3_,Ct,C_>::
-is_encroached_facet_refinable(Facet& facet) const
-{
-  typedef typename Gt::Point_3 Point_3;
-  typedef typename Gt::FT      FT;
-
-  typename Gt::Compute_squared_radius_smallest_orthogonal_sphere_3 sq_radius =
-    Gt().compute_squared_radius_smallest_orthogonal_sphere_3_object();
-
-  typename Gt::Compare_weighted_squared_radius_3 compare =
-    Gt().compare_weighted_squared_radius_3_object();
-
-  const Cell_handle& c = facet.first;
-  const int& k = facet.second;
-
-  int k1 = (k+1)&3;
-  int k2 = (k+2)&3;
-  int k3 = (k+3)&3;
-
-  // Get number of weighted points, and ensure that they will be accessible
-  // using k1...ki, if i is the number of weighted points.
-  int wp_nb = 0;
-  if(c->vertex(k1)->point().weight() > FT(0))
-  {
-    ++wp_nb;
-  }
-
-  if(c->vertex(k2)->point().weight() > FT(0))
-  {
-    if ( 0 == wp_nb ) { std::swap(k1,k2); }
-    ++wp_nb;
-  }
-
-  if(c->vertex(k3)->point().weight() > FT(0))
-  {
-    if ( 0 == wp_nb ) { std::swap(k1,k3); }
-    if ( 1 == wp_nb ) { std::swap(k2,k3); }
-    ++wp_nb;
-  }
-
-  const Point_3& p1 = c->vertex(k1)->point();
-  const Point_3& p2 = c->vertex(k2)->point();
-  const Point_3& p3 = c->vertex(k3)->point();
-
-  const FT min_ratio (0.16); // (0.2*2)^2
-
-  // Check ratio
-  switch ( wp_nb )
-  {
-    case 1:
-    {
-      FT r = (std::max)(sq_radius(p1,p2),sq_radius(p1,p3));
-      if ( r < min_ratio*p1.weight() ) { return false; }
-      break;
-    }
-
-    case 2:
-    {
-      bool do_spheres_intersect = (compare(p1,p2,FT(0)) != CGAL::LARGER);
-      if ( do_spheres_intersect )
-      {
-        FT r13 = sq_radius(p1,p3) / p1.weight();
-        FT r23 = sq_radius(p2,p3) / p2.weight();
-        FT r = (std::max)(r13,r23);
-
-        if ( r < min_ratio ) { return false; }
-      }
-      break;
-    }
-
-    case 3:
-    {
-      bool do_spheres_intersect = (compare(p1,p2,p3,FT(0)) != CGAL::LARGER);
-      if ( do_spheres_intersect ) { return false; }
-      break;
-    }
-
-    default: break;
-  }
-
-  return true;
-}
-
-/**
-  * \c facet is an internal facet we are going to remove
-  * \c source_facet is the facet we want to refine by inserting a new point
-  */
-template<class Tr, class Cr, class MD, class C3T3_, class Ct, class C_>
-bool
-Refine_facets_3_base<Tr,Cr,MD,C3T3_,Ct,C_>::
-before_insertion_handle_facet_in_conflict_zone(Facet& facet,
-                                               const Facet& source_facet)
-{
-  Facet other_side = mirror_facet(facet);
-
-  // Is the facet on the surface of the complex
-  if ( this->is_facet_on_surface(facet) )
-  {
-    // Remove element (if needed - see remove_bad_facet implementation)
-    remove_bad_facet(facet, Ct());
-
-    // Remove facet from complex
-    remove_facet_from_surface(facet);
-
-    // Reset visited
-    reset_facet_visited(facet);
-    reset_facet_visited(other_side);
-  }
-
-  return ( (facet == source_facet) || (other_side == source_facet) );
-}
-
-
-
-template<class Tr, class Cr, class MD, class C3T3_, class Ct, class C_>
-void
-Refine_facets_3_base<Tr,Cr,MD,C3T3_,Ct,C_>::
-after_insertion_handle_incident_facet(Facet& facet)
-{
-  // If the facet is infinite or has been already visited,
-  // then there is nothing to do as for it or its edges
-  // Facet other_side = mirror_facet(facet);
-  if ( r_tr_.is_infinite(facet) || (is_facet_visited(facet)) ) // && is_facet_visited(other_side)) )
-  {
-    return;
-  }
-
-  treat_new_facet(facet);
-}
-
-
-}  // end namespace Mesh_3
-
-
-}  // end namespace CGAL
-
-#endif // CGAL_MESH_3_REFINE_FACETS_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/io_signature.h b/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/io_signature.h
deleted file mode 100644
index ed65005..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/io_signature.h
+++ /dev/null
@@ -1,275 +0,0 @@
-// Copyright (c) 2006  INRIA Sophia-Antipolis (France).
-// Copyright (c) 2011  GeometryFactory Sarl (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
-// 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: https://scm.gforge.inria.fr/svn/cgal/branches/features/Mesh_3-experimental-GF/Mesh_3/include/CGAL/Mesh_3/io_signature.h $
-// $Id: io_signature.h 68587 2012-04-17 16:00:12Z lrineau $
-// 
-//
-// Author(s)     : Laurent RINEAU
-
-#ifndef CGAL_MESH_3_IO_SIGNATURE_H
-#define CGAL_MESH_3_IO_SIGNATURE_H
-#define CGAL_MESH_3_IO_H // the old include macro, tested by other files
-
-#include <CGAL/Point_3.h>
-#include <CGAL/Weighted_point.h>
-#include <CGAL/Delaunay_triangulation_3.h>
-#include <CGAL/Triangulation_vertex_base_3.h>
-#include <CGAL/Triangulation_vertex_base_with_info_3.h>
-#include <CGAL/Triangulation_cell_base_3.h>
-#include <CGAL/Triangulation_cell_base_with_info_3.h>
-#include <CGAL/Regular_triangulation_3.h>
-#include <CGAL/Regular_triangulation_cell_base_3.h>
-#include <boost/variant.hpp>
-#include <boost/tuple/tuple.hpp>
-#include <utility>
-
-namespace CGAL { 
-
-// SFINAE test
-template <typename T, typename U>
-class has_io_signature
-{
-private:
-	template <U> struct helper;
-	template <typename V> static char check(helper<&V::io_signature> *);
-	template <typename V> static char (&check(...))[2];
-
-public:
-	enum { value = (sizeof(check<T>(0)) == sizeof(char)) };
-};
-
-template <class T, bool has_io_signature>
-struct Get_io_signature_aux
-{
-  std::string operator() () const
-  {
-    return T::io_signature();
-  }
-}; // end struct template Get_io_signature_aux
-
-template <class T>
-struct Get_io_signature_aux<T, false>
-{
-  std::string operator()() const
-  {
-    return std::string();
-  }
-}; // end template partial specialization Get_io_signature_aux<T, false>
-
-
-template <class T>
-struct Get_io_signature
-  : public Get_io_signature_aux<
-  T,
-  (has_io_signature<T, std::string (T::*)() >::value ||
-   has_io_signature<T, std::string (T::*)() const >::value ||
-   has_io_signature<T, std::string (*)() >::value )  // signature for
-                                                     // static mem func
-  >
-{
-};
-
-template <>
-struct Get_io_signature<int>
-{
-  std::string operator()() {
-    return "i";
-  }
-};
-
-template <>
-struct Get_io_signature<unsigned int>
-{
-  std::string operator()() {
-    return "ui";
-  }
-};
-
-template <>
-struct Get_io_signature<double>
-{
-  std::string operator()() {
-    return "d";
-  }
-};
-
-template <typename T, typename U>
-struct Get_io_signature<boost::variant<T,U> >
-{
-    std::string operator()() {
-      return std::string("boost::variant<") +
-        Get_io_signature<T>()() + "," +
-        Get_io_signature<U>()() + ">";
-  }
-};
-
-template <typename T, typename U>
-struct Get_io_signature<std::pair<T,U> >
-{
-    std::string operator()() {
-      return std::string("std::pair<") +
-        Get_io_signature<T>()() + "," +
-        Get_io_signature<U>()() + ">";
-  }
-};
-
-template <typename T, typename U>
-struct Get_io_signature<boost::tuple<T,U> >
-{
-    std::string operator()() {
-      return std::string("std::pair<") +
-        Get_io_signature<T>()() + "," +
-        Get_io_signature<U>()() + ">";
-  }
-};
-
-template <typename T, typename U, typename V>
-struct Get_io_signature<boost::variant<T,U,V> >
-{
-    std::string operator()() {
-      return std::string("boost::variant<") +
-        Get_io_signature<T>()() + "," +
-        Get_io_signature<U>()() + "," +
-        Get_io_signature<V>()() + ">";
-  }
-};
-
-template <typename T, typename U, 
-          typename V, typename W>
-struct Get_io_signature<boost::variant<T,U,V,W> >
-{
-    std::string operator()() {
-      return std::string("boost::variant<") +
-        Get_io_signature<T>()() + "," +
-        Get_io_signature<U>()() + "," +
-        Get_io_signature<V>()() + "," +
-        Get_io_signature<W>()() + ">";
-  }
-};
-
-template <class Kernel>
-struct Get_io_signature<Point_3<Kernel> >
-{
-  std::string operator()() {
-    return "Point_3";
-  }
-};
-
-template <class Point, typename FT>
-struct Get_io_signature<Weighted_point<Point, FT> >
-{
-  std::string operator()() {
-    return std::string("Weighted_point<") + Get_io_signature<Point>()() + ">";
-  }
-};
-
-#ifdef CGAL_TRIANGULATION_3_H
-template <class Gt, class Vb, class Cb>
-struct
-Get_io_signature<Triangulation_3<Gt, Triangulation_data_structure_3<Vb, Cb> > >
-{
-  typedef Triangulation_data_structure_3<Vb, Cb> Tds;
-
-  std::string operator()() {
-    return std::string("Triangulation_3(") +
-      Get_io_signature<typename Gt::Point_3>()() +
-      ",Vb(" + Get_io_signature<typename Tds::Vertex>()() +
-      "),Cb(" + Get_io_signature<typename Tds::Cell>()() +
-      "))";
-  }
-};
-#endif
-
-#ifdef CGAL_DELAUNAY_TRIANGULATION_3_H
-template <class Gt, class Tds>
-struct 
-Get_io_signature<Delaunay_triangulation_3<Gt, Tds> >
-{
-  std::string operator()() {
-    return Get_io_signature<Triangulation_3<Gt, Tds> >()();
-  }
-};
-#endif
-
-#ifdef CGAL_REGULAR_TRIANGULATION_3_H
-template <class Gt, class Tds>
-struct
-Get_io_signature<Regular_triangulation_3<Gt, Tds> >
-{
-  std::string operator()() {
-    return Get_io_signature<Triangulation_3<Gt, Tds> >()();
-  }
-};
-#endif
-
-#ifdef CGAL_TRIANGULATION_VERTEX_BASE_3_H
-template <class Gt, class Vb>
-struct Get_io_signature<Triangulation_vertex_base_3<Gt, Vb> >
-{
-  std::string operator()() {
-    return "Tvb_3";
-  }
-};
-#endif
-
-#ifdef CGAL_TRIANGULATION_VERTEX_BASE_WITH_INFO_3_H
-template <class Info, class Gt, class Vb>
-struct
-Get_io_signature<Triangulation_vertex_base_with_info_3<Info, Gt, Vb> >
-{
-  std::string operator()() {
-    return Get_io_signature<Vb>()();
-  }
-};
-#endif
-
-#ifdef CGAL_TRIANGULATION_CELL_BASE_3_H
-template <class Gt, class Cb>
-struct
-Get_io_signature<Triangulation_cell_base_3<Gt, Cb> >
-{
-  std::string operator()() {
-    return "Tcb_3";
-  }
-};
-#endif
-
-#ifdef CGAL_TRIANGULATION_CELL_BASE_WITH_INFO_3_H
-template <class Info, class Gt, class Cb>
-struct
-Get_io_signature<Triangulation_cell_base_with_info_3<Info, Gt, Cb> >
-{
-  std::string operator()() {
-    return Get_io_signature<Cb>()();
-  }
-};
-#endif
-
-#ifdef CGAL_REGULAR_TRIANGULATION_CELL_BASE_3_H
-template <class Gt, class Cb, class Container>
-struct
-Get_io_signature<Regular_triangulation_cell_base_3<Gt, Cb, Container> >
-{
-  std::string operator()() {
-    return "RTcb_3";
-  }
-};
-#endif
-
-} // end namespace CGAL
-
-
-#endif // CGAL_MESH_3_IO_SIGNATURE_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/mesh_standard_facet_criteria.h b/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/mesh_standard_facet_criteria.h
deleted file mode 100644
index d9ec9f0..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/mesh_standard_facet_criteria.h
+++ /dev/null
@@ -1,710 +0,0 @@
-// Copyright (c) 2009 INRIA Sophia-Antipolis (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
-// 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(s)     : Stephane Tayeb
-//
-//******************************************************************************
-// File Description :
-//
-//******************************************************************************
-
-
-#ifndef CGAL_MESH_3_MESH_STANDARD_FACET_CRITERIA_H
-#define CGAL_MESH_3_MESH_STANDARD_FACET_CRITERIA_H
-
-#include <CGAL/Mesh_3/config.h>
-
-#include <CGAL/number_utils.h> // for to_double
-#include <CGAL/Mesh_3/mesh_standard_criteria.h>
-#include <cmath>
-
-
-namespace CGAL {
-
-namespace Mesh_3 {
-
-namespace details {
-
-  template<typename K>
-  inline
-  typename K::FT
-  min_3(const typename K::FT& a,
-        const typename K::FT& b,
-        const typename K::FT& c)
-  {
-    return (std::min)(a, (std::min)(b,c));
-  }
-
-} // end namespace details
-
-
-
-// Aspect_ratio Criterion class
-template <typename Tr, typename Visitor_>
-class Aspect_ratio_criterion :
-  public Mesh_3::Abstract_criterion<Tr, Visitor_>
-{
-private:
-  typedef typename Tr::Facet Facet;
-  typedef typename Tr::Geom_traits::FT FT;
-
-  typedef Mesh_3::Abstract_criterion<Tr,Visitor_> Base;
-  typedef typename Base::Quality Quality;
-  typedef typename Base::Badness Badness;
-
-  typedef Aspect_ratio_criterion<Tr,Visitor_> Self;
-
-public:
-  // Nb: the default bound of the criterion is such that the criterion
-  // is always fulfilled
-  Aspect_ratio_criterion(const FT angle_min = 0.)
-  { // TODO: document that FT must constructible from a double!
-    set_angle_min(angle_min);
-  }
-
-protected:
-  virtual void do_accept(Visitor_& v) const
-  {
-    v.visit(*this);
-  }
-
-  virtual Self* do_clone() const
-  {
-    // Call copy ctor on this
-    return new Self(*this);
-  }
-
-  void set_angle_min(const FT angle_min)
-  {
-    if(angle_min == FT(0))
-    {
-      B_ = 0;
-    }
-    else
-    {
-      B_ = std::sin (CGAL_PI * CGAL::to_double(angle_min) / 180);
-      B_ = B_ * B_;
-    }
-  }
-
-  virtual Badness do_is_bad (const Facet& f) const
-  {
-    CGAL_assertion (f.first->is_facet_on_surface(f.second));
-    CGAL_assertion (B_ != 0);
-
-    typedef typename Tr::Geom_traits Gt;
-    typedef typename Tr::Point Point_3;
-
-    const typename Gt::Construct_triangle_3 triangle =
-        Gt().construct_triangle_3_object();
-    const typename Gt::Compute_squared_distance_3 distance =
-        Gt().compute_squared_distance_3_object();
-    const typename Gt::Compute_squared_area_3 area =
-        Gt().compute_squared_area_3_object();
-
-    const Point_3& p1 = f.first->vertex((f.second+1)&3)->point();
-    const Point_3& p2 = f.first->vertex((f.second+2)&3)->point();
-    const Point_3& p3 = f.first->vertex((f.second+3)&3)->point();
-
-    const FT triangle_area = area(triangle(p1,p2,p3));
-
-    const FT d12 = distance(p1,p2);
-    const FT d13 = distance(p1,p3);
-    const FT d23 = distance(p2,p3);
-    const FT min_d123 = details::min_3<Gt>(d12,d13,d23);
-
-    const FT aspect_ratio = 4 * triangle_area * min_d123 / (d12*d13*d23);
-
-    CGAL_assertion (aspect_ratio >= 0 && aspect_ratio <= 1);
-
-    if ( aspect_ratio < B_ )
-    {
-#ifdef CGAL_MESH_3_DEBUG_FACET_CRITERIA
-      std::cerr << "Bad facet (angle criterion): aspect_ratio[" << aspect_ratio
-                << "] bound[" << B_ << "]" << std::endl;
-#endif
-      return Badness(Quality(aspect_ratio));
-    }
-    else
-      return Badness();
-  }
-
-private:
-  FT B_;
-
-};  // end Aspect_ratio_criterion
-
-
-// Curvature_adapted size Criterion class
-template <typename Tr, typename Visitor_>
-class Curvature_size_criterion :
-  public Mesh_3::Abstract_criterion<Tr, Visitor_>
-{
-private:
-  typedef typename Tr::Facet Facet;
-  typedef typename Tr::Geom_traits::FT FT;
-
-  typedef Mesh_3::Abstract_criterion<Tr,Visitor_> Base;
-  typedef typename Base::Quality Quality;
-  typedef typename Base::Badness Badness;
-
-  typedef Curvature_size_criterion<Tr,Visitor_> Self;
-
-public:
-  // Nb: the default bound of the criterion is such that the criterion
-  // is always fulfilled
-  Curvature_size_criterion(const FT b = 0) : B_(b * b) {}
-
-protected:
-  virtual void do_accept(Visitor_& v) const
-  {
-    v.visit(*this);
-  }
-
-  virtual Self* do_clone() const
-  {
-    // Call copy ctor on this
-    return new Self(*this);
-  }
-
-  virtual Badness do_is_bad (const Facet& f) const
-  {
-    CGAL_assertion(f.first->is_facet_on_surface(f.second));
-    CGAL_assertion (B_ != 0);
-
-    typedef typename Tr::Geom_traits Gt;
-    typedef typename Tr::Point Point_3;
-
-    typename Gt::Compute_squared_distance_3 distance =
-        Gt().compute_squared_distance_3_object();
-    typename Gt::Construct_weighted_circumcenter_3 circumcenter =
-        Gt().construct_weighted_circumcenter_3_object();
-
-    const Point_3& p1 = f.first->vertex((f.second+1)&3)->point();
-    const Point_3& p2 = f.first->vertex((f.second+2)&3)->point();
-    const Point_3& p3 = f.first->vertex((f.second+3)&3)->point();
-
-    const Point_3 c = circumcenter(p1,p2,p3);
-
-    const FT sq_dist = distance(c, f.first->get_facet_surface_center(f.second));
-
-    if ( sq_dist > B_ )
-    {
-#ifdef CGAL_MESH_3_DEBUG_FACET_CRITERIA
-      std::cerr << "Bad facet (curvature size): sq_dist[" << sq_dist
-                << "] bound[" << B_ << "]\n";
-#endif
-      return Badness(Quality(B_/sq_dist));
-    }
-    else
-      return Badness();
-  }
-
-private:
-  FT B_;
-
-};  // end Curvature_size_criterion
-
-
-// Size Criterion base class
-template < typename Tr, typename Visitor_ >
-class Facet_size_criterion :
-  public Mesh_3::Abstract_criterion<Tr, Visitor_>
-{
-};
-  
-// Variable size Criterion class
-template <typename Tr, typename Visitor_, typename SizingField>
-class Variable_size_criterion :
-  public Facet_size_criterion<Tr, Visitor_>
-{
-private:
-  typedef typename Tr::Facet            Facet;
-  typedef typename Tr::Geom_traits::FT  FT;
-  typedef typename Tr::Vertex::Index    Index;
-  
-  typedef Mesh_3::Abstract_criterion<Tr,Visitor_> Base;
-  typedef typename Base::Quality Quality;
-  typedef typename Base::Badness Badness;
-  
-  typedef Variable_size_criterion<Tr,Visitor_,SizingField> Self;
-  typedef SizingField Sizing_field;
-  
-public:
-  // Nb: the default bound of the criterion is such that the criterion
-  // is always fulfilled
-  Variable_size_criterion(const Sizing_field& s) : size_(s) {}
-  
-protected:
-  virtual void do_accept(Visitor_& v) const
-  {
-    v.visit(*this);
-  }
-  
-  virtual Self* do_clone() const
-  {
-    // Call copy ctor on this
-    return new Self(*this);
-  }
-  
-  virtual Badness do_is_bad (const Facet& f) const
-  {
-    CGAL_assertion (f.first->is_facet_on_surface(f.second));
-    
-    typedef typename Tr::Geom_traits Gt;
-    typedef typename Tr::Point Point_3;
-    
-    typename Gt::Compute_squared_distance_3 distance =
-      Gt().compute_squared_distance_3_object();
-    
-    const Point_3& p1 = f.first->vertex((f.second+1)&3)->point();
-    const Point_3& ball_center = f.first->get_facet_surface_center(f.second);
-    const Index& index = f.first->get_facet_surface_center_index(f.second);
-    
-    const FT sq_radius = distance(p1,ball_center);
-    const FT sq_bound = CGAL::square(size_(ball_center, 2, index));
-    CGAL_assertion(sq_bound > FT(0));
-    
-    if ( sq_radius > sq_bound )
-    {
-#ifdef CGAL_MESH_3_DEBUG_FACET_CRITERIA
-      std::cerr << "Bad facet (uniform size): sq_radius[" << sq_radius
-      << "] bound[" << sq_bound << "]\n";
-#endif
-      return Badness(Quality(sq_bound/sq_radius));
-    }
-    else
-      return Badness();
-  }
-  
-private:
-  Sizing_field size_;
-  
-};  // end Variable_size_criterion
-  
-  
-  
-// Uniform size Criterion class
-template <typename Tr, typename Visitor_>
-class Uniform_size_criterion :
-  public Facet_size_criterion<Tr, Visitor_>
-{
-private:
-  typedef typename Tr::Facet Facet;
-  typedef typename Tr::Geom_traits::FT FT;
-
-  typedef Mesh_3::Abstract_criterion<Tr,Visitor_> Base;
-  typedef typename Base::Quality Quality;
-  typedef typename Base::Badness Badness;
-
-  typedef Uniform_size_criterion<Tr,Visitor_> Self;
-  
-public:
-  // Nb: the default bound of the criterion is such that the criterion
-  // is always fulfilled
-  Uniform_size_criterion(const FT b = 1e20) : B_(b * b) {}
-
-protected:
-  virtual void do_accept(Visitor_& v) const
-  {
-    v.visit(*this);
-  }
-
-  virtual Self* do_clone() const
-  {
-    // Call copy ctor on this
-    return new Self(*this);
-  }
-
-  virtual Badness do_is_bad (const Facet& f) const
-  {
-    CGAL_assertion (f.first->is_facet_on_surface(f.second));
-    CGAL_assertion (B_ != 0);
-
-    typedef typename Tr::Geom_traits Gt;
-    typedef typename Tr::Point Point_3;
-
-    typename Gt::Compute_squared_distance_3 distance =
-        Gt().compute_squared_distance_3_object();
-
-    const Point_3& p1 = f.first->vertex((f.second+1)&3)->point();
-
-    const FT sq_radius = distance(
-        p1, f.first->get_facet_surface_center(f.second));
-
-    if ( sq_radius > B_ )
-    {
-#ifdef CGAL_MESH_3_DEBUG_FACET_CRITERIA
-      std::cerr << "Bad facet (uniform size): sq_radius[" << sq_radius
-                << "] bound[" << B_ << "]\n";
-#endif
-      return Badness(Quality(B_/sq_radius));
-    }
-    else
-      return Badness();
-  }
-
-private:
-  FT B_;
-
-};  // end Uniform_size_criterion
-
-
-
-template <typename Tr, typename Visitor_>
-class Facet_on_surface_criterion :
-  public Mesh_3::Abstract_criterion<Tr, Visitor_>
-{
-private:
-  typedef typename Tr::Facet Facet;
-
-  typedef Mesh_3::Abstract_criterion<Tr,Visitor_> Base;
-  typedef typename Base::Quality Quality;
-  typedef typename Base::Badness Badness;
-
-  typedef Facet_on_surface_criterion<Tr,Visitor_> Self;
-
-public:
-  /// Constructor
-  Facet_on_surface_criterion() {}
-  /// Destructor
-  ~Facet_on_surface_criterion() {}
-
-protected:
-  virtual void do_accept(Visitor_& v) const
-  {
-    v.visit(*this);
-  }
-
-  virtual Self* do_clone() const
-  {
-    // Call copy ctor on this
-    return new Self(*this);
-  }
-
-  virtual Badness do_is_bad (const Facet& f) const
-  {
-    typedef typename Tr::Vertex_handle Vertex_handle;
-    typedef typename Tr::Cell_handle Cell_handle;
-
-    const Cell_handle& ch = f.first;
-    const int i = f.second;
-    const Vertex_handle& v1 = ch->vertex((i+1)&3);
-    const Vertex_handle& v2 = ch->vertex((i+2)&3);
-    const Vertex_handle& v3 = ch->vertex((i+3)&3);
-
-    // Look if vertex are on surface
-    if ( (v1->in_dimension() > 2) ||
-         (v2->in_dimension() > 2) ||
-         (v3->in_dimension() > 2) )
-    {
-#ifdef CGAL_MESH_3_DEBUG_FACET_CRITERIA
-      std::cerr << "Bad facet (on surface criterion)" << std::endl;
-#endif
-      return Badness(Quality(1));
-    }
-    else
-      return Badness();
-  }
-}; // end class Facet_on_surface_criterion
-
-  
-template <typename Tr, typename Visitor_>
-class Facet_on_same_surface_criterion :
-public Mesh_3::Abstract_criterion<Tr, Visitor_>
-{
-private:
-  typedef typename Tr::Facet Facet;
-  
-  typedef Mesh_3::Abstract_criterion<Tr,Visitor_> Base;
-  typedef typename Base::Quality Quality;
-  typedef typename Base::Badness Badness;
-  
-  typedef Facet_on_same_surface_criterion<Tr,Visitor_> Self;
-  
-public:
-  /// Constructor
-  Facet_on_same_surface_criterion() {}
-  /// Destructor
-  virtual ~Facet_on_same_surface_criterion() {}
-
-protected:
-  virtual void do_accept(Visitor_& v) const
-  {
-    v.visit(*this);
-  }
-  
-  virtual Self* do_clone() const
-  {
-    // Call copy ctor on this
-    return new Self(*this);
-  }
-  
-  virtual Badness do_is_bad (const Facet& f) const
-  {
-    typedef typename Tr::Vertex_handle  Vertex_handle;
-    typedef typename Tr::Cell_handle    Cell_handle;
-    typedef typename Tr::Vertex::Index  Index;
-    
-    const Cell_handle& ch = f.first;
-    const int& i = f.second;
-    
-    const Vertex_handle& v1 = ch->vertex((i+1)&3);
-    const Vertex_handle& v2 = ch->vertex((i+2)&3);
-    const Vertex_handle& v3 = ch->vertex((i+3)&3);
-    
-    Index index = Index();
-    bool is_index_initialized = false;
-    
-    if ( v1->in_dimension() == 2 )
-    { 
-      index = v1->index();
-      is_index_initialized = true;
-    }
-    
-    if ( v2->in_dimension() == 2 )
-    {
-      if ( is_index_initialized )
-      {
-        if ( !(v2->index() == index) )
-        {
-          return Badness(Quality(1));
-        }
-      }
-      else
-      {
-        index = v2->index();
-        is_index_initialized = true;        
-      }
-    }
-    
-    if ( v3->in_dimension() == 2 )
-    {
-      if ( is_index_initialized && !(v3->index() == index) )
-      {
-        return Badness(Quality(1));
-      } 
-    }
-    
-    return  Badness();			
-  }
-  
-}; // end class Facet_on_same_surface_criterion
-
-
-
-template <typename Tr>
-class Facet_criterion_visitor
-  : public Mesh_3::Criterion_visitor<Tr, typename Tr::Facet>
-{
-  typedef Mesh_3::Criterion_visitor<Tr, typename Tr::Facet> Base;
-  typedef Facet_criterion_visitor<Tr> Self;
-
-public:
-  typedef Mesh_3::Abstract_criterion<Tr, Self> Criterion;
-  typedef typename Base::Quality Facet_quality;
-  typedef typename Base::Badness Facet_badness;
-  typedef typename Base::Handle Handle;
-  typedef Handle Facet;
-
-  // Constructor
-  Facet_criterion_visitor(const Facet& f)
-    : Base(f) {}
-
-  // Destructor
-  ~Facet_criterion_visitor() {}
-
-  void visit(const Criterion& criterion)
-  {
-    Base::do_visit(criterion);
-  }
-
-};  // end class Facet_criterion_visitor
-  
-  
-  
-template <typename Tr>
-class Facet_criterion_visitor_with_features
-  : public Mesh_3::Criterion_visitor<Tr, typename Tr::Facet>
-{
-  typedef Mesh_3::Criterion_visitor<Tr, typename Tr::Facet> Base;
-  typedef Facet_criterion_visitor_with_features<Tr> Self;
-  
-  typedef Mesh_3::Abstract_criterion<Tr, Self>                Criterion;
-  typedef Mesh_3::Curvature_size_criterion<Tr, Self>          Curvature_size_criterion;
-  typedef Mesh_3::Aspect_ratio_criterion<Tr, Self>            Aspect_ratio_criterion;
-  typedef Mesh_3::Facet_on_surface_criterion<Tr, Self>        Facet_on_surface_criterion;
-  typedef Mesh_3::Facet_size_criterion<Tr, Self>              Facet_size_criterion;
-  typedef Mesh_3::Facet_on_same_surface_criterion<Tr, Self>   Facet_on_same_surface_criterion;
-
-  typedef typename Tr::Geom_traits  Gt;
-  typedef typename Gt::FT           FT;
-
-public:  
-  typedef typename Base::Quality  Facet_quality;
-  typedef typename Base::Badness  Facet_badness;
-  typedef typename Base::Handle   Handle;
-  typedef Handle                  Facet;
-  
-  // Constructor
-  Facet_criterion_visitor_with_features(const Facet& fh)
-    : Base(fh)
-    , wp_nb_(0)
-    , do_spheres_intersect_(false)
-    , ratio_(0.)
-    , approx_ratio_(0.1*0.1*4.)
-    , angle_ratio_(0.5*0.5*4.)
-    , size_ratio_(0.4*0.4*4.)
-  {
-    typedef typename Tr::Point        Point_3;
-    typedef typename Tr::Cell_handle  Cell_handle;
-    
-    typename Gt::Compare_weighted_squared_radius_3 compare =
-      Gt().compare_weighted_squared_radius_3_object();
-    
-    typename Gt::Compute_squared_radius_smallest_orthogonal_sphere_3 sq_radius =
-      Gt().compute_squared_radius_smallest_orthogonal_sphere_3_object();
-
-    const Cell_handle& c = fh.first;
-    const int& k = fh.second;
-    
-    int k1 = (k+1)&3;
-    int k2 = (k+2)&3;
-    int k3 = (k+3)&3;
-    
-    // Get number of weighted points, and ensure that they will be accessible
-    // using k1...ki, if i is the number of weighted points.
-    if(c->vertex(k1)->point().weight() > FT(0))
-    { 
-      ++wp_nb_;
-    }
-    
-    if(c->vertex(k2)->point().weight() > FT(0))
-    { 
-      if ( 0 == wp_nb_ ) { std::swap(k1,k2); }
-      ++wp_nb_;
-    }
-    
-    if(c->vertex(k3)->point().weight() > FT(0))
-    { 
-      if ( 0 == wp_nb_ ) { std::swap(k1,k3); }
-      if ( 1 == wp_nb_ ) { std::swap(k2,k3); }
-      ++wp_nb_;
-    }
-    
-    const Point_3& p1 = c->vertex(k1)->point();
-    const Point_3& p2 = c->vertex(k2)->point();
-    const Point_3& p3 = c->vertex(k3)->point();
-    
-    // Compute ratio
-    switch ( wp_nb_ )
-    {
-      case 1:
-      {
-        FT r = (std::max)(sq_radius(p1,p2),sq_radius(p1,p3));
-        ratio_ = r / p1.weight();
-        break;
-      }
-        
-      case 2:
-      {
-        FT r13 = sq_radius(p1,p3) / p1.weight();
-        FT r23 = sq_radius(p2,p3) / p2.weight();
-        ratio_ = (std::max)(r13, r23);
-        
-        do_spheres_intersect_ = (compare(p1,p2,FT(0)) != CGAL::LARGER);
-        break;
-      }
-
-      case 3:
-      {
-        do_spheres_intersect_ = (compare(p1,p2,p3,FT(0)) != CGAL::LARGER);
-        break;
-      }  
-      
-      default: break;
-    }
-  }
-  
-  // Destructor
-  ~Facet_criterion_visitor_with_features() {}
-
-  // visit functions
-  void visit(const Criterion& criterion)
-  {
-    if ( 3 == wp_nb_ && do_spheres_intersect_ )
-    { 
-      Base::increment_counter();
-      return;
-    }
-    
-    Base::do_visit(criterion);
-  }
-  
-  void visit(const Curvature_size_criterion& criterion)
-  {
-    if (   ratio_ < approx_ratio_
-        && (do_spheres_intersect_ || 1 == wp_nb_ ) )
-    {
-      Base::increment_counter();
-      return;
-    }
-    
-    Base::do_visit(criterion);
-  }
-  
-  void visit(const Aspect_ratio_criterion& criterion)
-  {
-    if (   ratio_ < angle_ratio_
-        && (do_spheres_intersect_ || 1 == wp_nb_) )
-    {
-      Base::increment_counter();
-      return;
-    }
-    
-    Base::do_visit(criterion);
-  }
-  
-  void visit(const Facet_size_criterion& criterion)
-  {
-    if (   ratio_ < size_ratio_
-        && (do_spheres_intersect_ || 1 == wp_nb_) )
-    {
-      Base::increment_counter();
-      return;
-    }
-    
-    Base::do_visit(criterion);
-  }
-  
-private:
-  int wp_nb_;
-  bool do_spheres_intersect_;
-  FT ratio_;
-  FT approx_ratio_;
-  FT angle_ratio_;
-  FT size_ratio_;
-  
-};  // end class Facet_criterion_visitor
-  
-
-}  // end namespace Mesh_3
-
-}  // end namespace CGAL
-
-#endif // CGAL_MESH_3_MESH_STANDARD_FACET_CRITERIA_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/polylines_to_protect.h b/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/polylines_to_protect.h
deleted file mode 100644
index f968c23..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/polylines_to_protect.h
+++ /dev/null
@@ -1,359 +0,0 @@
-// Copyright (c) 2015 GeometryFactory
-// 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
-// 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(s)     : Laurent Rineau
-
-#ifndef CGAL_POLYLINES_TO_PROTECT_H
-#define CGAL_POLYLINES_TO_PROTECT_H
-
-#include <vector>
-#include <map>
-#include <CGAL/tuple.h>
-#include <CGAL/Image_3.h>
-#include <CGAL/internal/Mesh_3/split_in_polylines.h>
-#include <CGAL/internal/Mesh_3/Graph_manipulations.h>
-#include <boost/graph/adjacency_list.hpp>
-
-namespace CGAL {
-
-
-  template <typename P>
-  void
-  polylines_to_protect(const CGAL::Image_3& cgal_image,
-                       const double, const double, const double,
-                       std::vector<std::vector<P> >& polylines)
-  {
-    typedef typename Kernel_traits<P>::Kernel K;
-    typedef P Point_3;
-    typedef boost::adjacency_list<boost::setS, boost::setS, boost::undirectedS, Point_3> Graph;
-    typedef typename boost::graph_traits<Graph>::vertex_descriptor vertex_descriptor;
-   // typedef typename boost::graph_traits<Graph>::edge_iterator edge_iterator;
-
-    const int xdim = static_cast<int>(cgal_image.xdim());
-    const int ydim = static_cast<int>(cgal_image.ydim());
-    const int zdim = static_cast<int>(cgal_image.zdim());
-
-  const int image_dims[3] = { xdim, ydim, zdim };
-
-  Graph graph;
-  internal::Mesh_3::Graph_manipulations<Graph, Point_3> g_manip(graph);
-
-  std::size_t
-    case4 = 0, // 4 colors
-    case211 = 0, case121 = 0, // 3 colors
-    case31 = 0, case22 = 0, // 2 colors
-    case1 = 0; // 1 color
-
-  for(int axis = 0; axis < 3; ++axis)
-  {
-    for(int i = 0; i < xdim; i+= (axis == 0 ? (xdim-1) : 1 ) )
-      for(int j = 0; j < ydim; j+= (axis == 1 ? (ydim-1) : 1 ) )
-        for(int k = 0; k < zdim; k+= (axis == 2 ? (zdim-1) : 1 ) )
-        {
-
-          using CGAL::cpp11::array;
-          using CGAL::cpp11::tuple;
-
-          typedef array<int, 3> Pixel;
-
-          Pixel pix00 = {{i  , j  , k  }},
-            pix10 = pix00, pix01 = pix00, pix11 = pix00;
-
-          const int axis_xx = (axis + 1) % 3;
-          const int axis_yy = (axis + 2) % 3;
-
-          ++pix10[axis_xx];
-          ++pix11[axis_xx];
-          ++pix01[axis_yy];
-          ++pix11[axis_yy];
-          if(pix11[0] >= xdim || pix11[1] >= ydim || pix11[2] >= zdim) {
-            // we have gone too far
-            continue;
-          }
-          typedef unsigned char Image_word_type;
-          typedef tuple<Pixel, Point_3, Image_word_type> Enriched_pixel;
-
-          array<array<Enriched_pixel, 2>, 2> square =
-            {{ {{ Enriched_pixel(pix00, Point_3(), Image_word_type()),
-                  Enriched_pixel(pix01, Point_3(), Image_word_type()) }},
-               {{ Enriched_pixel(pix10, Point_3(), Image_word_type()),
-                  Enriched_pixel(pix11, Point_3(), Image_word_type()) }} }};
-
-          std::map<Image_word_type, int> pixel_values_set;
-          for(int ii = 0; ii < 2; ++ii)
-            for(int jj = 0; jj < 2; ++jj)
-            {
-              const Pixel& pixel = get<0>(square[ii][jj]);
-              double x = pixel[0] * cgal_image.vx();
-              double y = pixel[1] * cgal_image.vy();
-              double z = pixel[2] * cgal_image.vz();
-              get<1>(square[ii][jj]) = Point_3(x, y, z);
-              get<2>(square[ii][jj]) = static_cast<Image_word_type>(cgal_image.value(pixel[0],
-                                                                                     pixel[1],
-                                                                                     pixel[2]));
-              ++pixel_values_set[get<2>(square[ii][jj])];
-            }
-          const Point_3& p00 = get<1>(square[0][0]);
-          const Point_3& p10 = get<1>(square[1][0]);
-          const Point_3& p01 = get<1>(square[0][1]);
-          const Point_3& p11 = get<1>(square[1][1]);
-
-          //
-          // Protect the edges of the cube
-          //
-          if(pix00[axis_xx] == 0) {
-            g_manip.try_add_edge(g_manip.get_vertex(p00),
-                                 g_manip.get_vertex(p01));
-          }
-          if(pix11[axis_xx] == image_dims[axis_xx]-1) {
-            g_manip.try_add_edge(g_manip.get_vertex(p10),
-                                 g_manip.get_vertex(p11));
-          }
-          if(pix00[axis_yy] == 0) {
-            g_manip.try_add_edge(g_manip.get_vertex(p00),
-                                 g_manip.get_vertex(p10));
-          }
-          if(pix11[axis_yy] == image_dims[axis_yy]-1) {
-            g_manip.try_add_edge(g_manip.get_vertex(p01),
-                                 g_manip.get_vertex(p11));
-          }
-
-          //
-          // Protect lines inside the square
-          //
-          switch(pixel_values_set.size()) {
-          case 4: {
-            assert(get<2>(square[0][0]) != get<2>(square[0][1]));
-            assert(get<2>(square[0][0]) != get<2>(square[1][0]));
-            assert(get<2>(square[0][0]) != get<2>(square[1][1]));
-            assert(get<2>(square[1][0]) != get<2>(square[1][1]));
-            assert(get<2>(square[0][1]) != get<2>(square[1][1]));
-            assert(get<2>(square[0][1]) != get<2>(square[1][0]));
-case_4:
-            // case 4 or case 2-2
-            ++case4;
-            vertex_descriptor left   = g_manip.split(p00, p01);
-            vertex_descriptor right  = g_manip.split(p10, p11);
-            vertex_descriptor top    = g_manip.split(p01, p11);
-            vertex_descriptor bottom = g_manip.split(p00, p10);
-            vertex_descriptor vmid   = g_manip.get_vertex(midpoint(p00, p11));
-            g_manip.try_add_edge(left   , vmid);
-            g_manip.try_add_edge(right  , vmid);
-            g_manip.try_add_edge(top    , vmid);
-            g_manip.try_add_edge(bottom , vmid);
-          }
-            break;
-          case 3: {
-            if(get<2>(square[0][0]) == get<2>(square[1][1])) {
-              // Diagonal, but the wrong one.
-              // Vertical swap
-              std::swap(square[0][1], square[0][0]);
-              std::swap(square[1][1], square[1][0]);
-            }
-            if(get<2>(square[0][1]) == get<2>(square[1][0])) {
-              // diagonal case 1-2-1
-              assert(get<2>(square[0][1]) == get<2>(square[1][0]));
-              assert(get<2>(square[1][1]) != get<2>(square[0][0]));
-              assert(get<2>(square[0][1]) != get<2>(square[0][0]));
-              assert(get<2>(square[0][1]) != get<2>(square[1][1]));
-              ++case121;
-              vertex_descriptor left   = g_manip.split(p00, p01);
-              vertex_descriptor right  = g_manip.split(p10, p11);
-              vertex_descriptor top    = g_manip.split(p01, p11);
-              vertex_descriptor bottom = g_manip.split(p00, p10);
-              Point_3 inter_left = p00 + (1./3.) * (p11 - p00);
-              Point_3 inter_right = p00 + (2./3.) * (p11 - p00);
-              vertex_descriptor v_int_left = g_manip.get_vertex(inter_left);
-              vertex_descriptor v_int_right = g_manip.get_vertex(inter_right);
-              g_manip.try_add_edge(left, v_int_left);
-              g_manip.try_add_edge(v_int_left, bottom);
-              g_manip.try_add_edge(top, v_int_right);
-              g_manip.try_add_edge(v_int_right, right);
-            } else {
-              // case 2-1-1
-              if(get<2>(square[0][0]) == get<2>(square[1][0])) {
-                // Diagonal swap
-                std::swap(square[0][1], square[1][0]);
-              } else
-              if(get<2>(square[0][1]) == get<2>(square[1][1])) {
-                // The other diagonal swap
-                std::swap(square[0][0], square[1][1]);
-              } else
-              if(get<2>(square[1][0]) == get<2>(square[1][1])) {
-                // Vertical swap
-                std::swap(square[0][0], square[1][0]);
-                std::swap(square[0][1], square[1][1]);
-              }
-              assert(get<2>(square[0][0]) == get<2>(square[0][1]));
-              assert(get<2>(square[0][0]) != get<2>(square[1][0]));
-              assert(get<2>(square[0][0]) != get<2>(square[1][1]));
-              ++case211;
-              Point_3 midleft =  midpoint(p00, p01);
-              Point_3 midright = midpoint(p10, p11);
-              Point_3 inter = midleft + (2./3)*(midright-midleft);
-              vertex_descriptor v_inter = g_manip.get_vertex(inter);
-              vertex_descriptor right  = g_manip.split(p10, p11);
-              vertex_descriptor top    = g_manip.split(p01, p11);
-              vertex_descriptor bottom = g_manip.split(p00, p10);
-              g_manip.try_add_edge(top,    v_inter);
-              g_manip.try_add_edge(bottom, v_inter);
-              g_manip.try_add_edge(right,  v_inter);
-            }
-          }
-            break;
-          case 2: {
-            if(pixel_values_set.begin()->second ==
-               pixel_values_set.rbegin()->second)
-            {
-              // Case of two colors with two pixels each.
-
-              if(get<2>(square[0][0])==get<2>(square[1][0])) {
-                // case 2-2, diagonal swap
-                std::swap(square[0][1], square[1][0]);
-                assert(get<2>(square[0][0])==get<2>(square[0][1]));
-              }
-              if(get<2>(square[1][0])==get<2>(square[1][1])) {
-                // case 2-2, vertical swap
-                std::swap(square[0][1], square[1][1]);
-                std::swap(square[0][0], square[1][0]);
-                assert(get<2>(square[0][0])==get<2>(square[0][1]));
-              }
-              if(get<2>(square[0][1])==get<2>(square[1][1])) {
-                // case 2-2, diagonal swap
-                std::swap(square[0][0], square[1][1]);
-                assert(get<2>(square[0][0])==get<2>(square[0][1]));
-              }
-
-              if(get<2>(square[0][0])==get<2>(square[0][1])) {
-                // vertical case 2-2
-                ++case22;
-                assert(get<2>(square[1][0])==get<2>(square[1][1]));
-                assert(get<2>(square[1][0])!=get<2>(square[0][1]));
-                vertex_descriptor top    = g_manip.split(p01, p11);
-                vertex_descriptor bottom = g_manip.split(p00, p10);
-                g_manip.try_add_edge(top, bottom);
-              } else {
-                // Else diagonal case case 2-2
-                // Same as the case with 4 colors
-                assert(get<2>(square[0][0])==get<2>(square[1][1]));
-                assert(get<2>(square[1][0])==get<2>(square[0][1]));
-                assert(get<2>(square[0][0])!=get<2>(square[0][1]));
-                goto case_4;
-              }
-            }
-            else {
-              // case of two colors with one pixel green and three red
-              Image_word_type value_alone;
-              if(pixel_values_set.begin()->second == 1) {
-                value_alone = pixel_values_set.begin()->first;
-              } else {
-                assert(pixel_values_set.begin()->second == 3);
-                assert(pixel_values_set.rbegin()->second ==1);
-                value_alone = pixel_values_set.rbegin()->first;
-              }
-              if(get<2>(square[0][1]) == value_alone) {
-                // central symmetry
-                std::swap(square[0][1], square[1][0]);
-                std::swap(square[0][0], square[1][1]);
-              assert(get<2>(square[1][0]) == value_alone);
-              }
-              if(get<2>(square[1][1]) == value_alone) {
-                // vertical swap
-                std::swap(square[0][0], square[0][1]);
-                std::swap(square[1][0], square[1][1]);
-              assert(get<2>(square[1][0]) == value_alone);
-              }
-              if(get<2>(square[0][0]) == value_alone) {
-                // horizontal swap
-                std::swap(square[0][1], square[1][1]);
-                std::swap(square[0][0], square[1][0]);
-              assert(get<2>(square[1][0]) == value_alone);
-              }
-              ++case31;
-              assert(get<2>(square[1][0]) == value_alone);
-              assert(get<2>(square[1][0]) != get<2>(square[0][0]));
-              assert(get<2>(square[1][1]) == get<2>(square[0][0]));
-              assert(get<2>(square[0][1]) == get<2>(square[0][0]));
-              vertex_descriptor bottom = g_manip.split(p00, p10);
-              vertex_descriptor old = bottom;
-
-              Point_3 inter;
-
-              vertex_descriptor v_int;
-              for(double x = 0.55; x < 1.; x+= 0.05)
-              {
-                inter = p00
-                  +      x         * (p10 - p00)  // x
-                  + (1.-1./(2.*x)) * (p01 - p00); // y
-                v_int = g_manip.get_vertex(inter);
-                g_manip.try_add_edge(old, v_int);
-                old = v_int;
-              }
-
-              vertex_descriptor right  = g_manip.split(p10, p11);
-              g_manip.try_add_edge(v_int, right);
-            }
-          }
-            break;
-          default: // case 1
-            ++case1;
-            // nothing to do
-            break;
-          }
-        }
-  }
-  // std::cerr << "case 4:     " << case4 << std::endl;
-  // std::cerr << "case 2-1-1: " << case211 << std::endl;
-  // std::cerr << "case 1-2-1: " << case121 << std::endl;
-  // std::cerr << "case 3-1:   " << case31 << std::endl;
-  // std::cerr << "case 2-2:   " << case22 << std::endl;
-  // std::cerr << "case 1:     " << case1 << std::endl;
-
-  const std::ptrdiff_t nb_facets =
-    case4 + case211 + case121 + case31 + case22 + case1;
-  const std::ptrdiff_t expected_nb_facets =
-    2*((xdim-1)*(ydim-1) + (ydim-1)*(zdim-1) + (xdim-1)*(zdim-1));
-
-  // std::cerr << "nb of facets:           " << nb_facets << std::endl
-  //           << " expected nb of facets: " << expected_nb_facets << std::endl;
-
-  CGAL_assertion(nb_facets == expected_nb_facets);
-  CGAL_USE(nb_facets); CGAL_USE(expected_nb_facets);
-
-
-  internal::Mesh_3::split_in_polylines(graph, polylines, K());
-  }
-
-
-  template <typename P>
-  void
-  polylines_to_protect(const CGAL::Image_3& cgal_image,
-                       std::vector<std::vector<P> >& polylines)
-  {
-    polylines_to_protect<P>
-      (cgal_image,
-       cgal_image.vx(), cgal_image.vy(),cgal_image.vz(),
-       polylines);
-  }
-
-
-} // namespace CGAL
-
-
-#endif // CGAL_POLYLINES_TO_PROTECT_H
-
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/squared_distance_Point_3_Triangle_3.h b/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/squared_distance_Point_3_Triangle_3.h
deleted file mode 100644
index 52d2bfb..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/squared_distance_Point_3_Triangle_3.h
+++ /dev/null
@@ -1,135 +0,0 @@
-// Copyright (c) 2010,2012 GeometryFactory Sarl (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
-// 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(s)     : Laurent Rineau
-//
-
-#ifndef CGAL_SQUARED_DISTANCE_POINT_3_TRIANGLE_3_H
-#define CGAL_SQUARED_DISTANCE_POINT_3_TRIANGLE_3_H
-
-#include <CGAL/squared_distance_3_0.h>
-#include <CGAL/squared_distance_3_1.h>
-#include <CGAL/wmult.h>
-
-#include <CGAL/Point_3.h>
-#include <CGAL/Triangle_3.h>
-
-namespace CGAL {
-namespace internal {
-
-template <class K>
-inline bool
-on_left_of_triangle_edge(const typename K::Point_3 & pt,
-                         const typename K::Vector_3 & normal,
-                         const typename K::Point_3 & ep0,
-                         const typename K::Point_3 & ep1,
-                         const K& k)
-{
-  // return true iff pt is on the negative side of the plane defined
-  // by (ep0, ep1) and normal
-  typename K::Construct_vector_3 vector;
-  typename K::Vector_3 edge = vector(ep0, ep1);
-  typename K::Vector_3 diff = vector(ep0, pt);
-
-  typedef typename K::RT RT;
-
-  const bool result = 
-    RT(wdot(wcross(edge,
-                   normal,
-                   k), 
-            diff,
-            k)) <= RT(0);
-  return result;
-}
-
-template <class K>
-inline typename K::FT
-squared_distance_to_triangle(
-    const typename K::Point_3 & pt,
-    const typename K::Point_3 & t0,
-    const typename K::Point_3 & t1,
-    const typename K::Point_3 & t2,
-    const K& k)
-{
-  typename K::Construct_vector_3 vector;
-  typedef typename K::Vector_3 Vector_3;
-  const Vector_3 e1 = vector(t0, t1);
-  const Vector_3 oe3 = vector(t0, t2);
-  const Vector_3 normal = wcross(e1, oe3, k);
-
-  if(normal != NULL_VECTOR
-     && on_left_of_triangle_edge(pt, normal, t0, t1, k)
-     && on_left_of_triangle_edge(pt, normal, t1, t2, k)
-     && on_left_of_triangle_edge(pt, normal, t2, t0, k))
-      {
-        // the projection of pt is inside the triangle
-        return squared_distance_to_plane(normal, vector(t0, pt), k);
-      }
-      else {
-        // The case normal==NULL_VECTOR covers the case when the triangle
-        // is colinear, or even more degenerate. In that case, we can
-        // simply take also the distance to the three segments.
-        typename K::FT d1 = squared_distance(pt, 
-                                             typename K::Segment_3(t2, t0),
-                                             k);
-        typename K::FT d2 = squared_distance(pt, 
-                                             typename K::Segment_3(t1, t2),
-                                             k);
-        typename K::FT d3 = squared_distance(pt, 
-                                             typename K::Segment_3(t0, t1),
-                                             k);
-       
-        return (std::min)( (std::min)(d1, d2), d3);
-      }
-}
-
-template <class K>
-inline typename K::FT
-squared_distance(
-    const typename K::Point_3 & pt,
-    const typename K::Triangle_3 & t,
-    const K& k)
-{
-  typename K::Construct_vertex_3 vertex;
-  return squared_distance_to_triangle(pt,
-                                      vertex(t, 0),
-                                      vertex(t, 1),
-                                      vertex(t, 2),
-                                      k);
-}
-
-} // end namespace CGAL::internal 
-
-template <class K>
-inline typename K::FT
-squared_distance(const Point_3<K> & pt,
-                 const Triangle_3<K> & t) {
-  return internal::squared_distance(pt, t, K());
-}
-
-
-template <class K>
-inline typename K::FT
-squared_distance(const Triangle_3<K> & t,
-                 const Point_3<K> & pt) {
-  return internal::squared_distance(pt, t, K());
-}
-
-} // end namespace CGAL
-
-#endif // CGAL_SQUARED_DISTANCE_POINT_3_TRIANGLE_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_complex_3_in_triangulation_3.h b/3rdparty/CGAL-4.8/include/CGAL/Mesh_complex_3_in_triangulation_3.h
deleted file mode 100644
index 37fae2d..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Mesh_complex_3_in_triangulation_3.h
+++ /dev/null
@@ -1,755 +0,0 @@
-// Copyright (c) 2009-2014 INRIA Sophia-Antipolis (France).
-// Copyright (c) 2010-2013 GeometryFactory Sarl (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
-// 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(s)     : Stephane Tayeb, Clement Jamin
-//
-//******************************************************************************
-// File Description :
-//******************************************************************************
-
-#ifndef CGAL_MESH_COMPLEX_3_IN_TRIANGULATION_3_H
-#define CGAL_MESH_COMPLEX_3_IN_TRIANGULATION_3_H
-
-
-#include <CGAL/iterator.h>
-
-#include <CGAL/Mesh_3/utilities.h>
-#include <CGAL/Mesh_3/Mesh_complex_3_in_triangulation_3_base.h>
-
-#include <map>
-#include <boost/bimap/bimap.hpp>
-#include <boost/bimap/multiset_of.hpp>
-#include <boost/iterator/transform_iterator.hpp>
-#include <boost/iterator/iterator_adaptor.hpp>
-#include <boost/mpl/if.hpp>
-#include <CGAL/internal/Mesh_3/Boundary_of_subdomain_of_complex_3_in_triangulation_3_to_off.h>
-
-namespace CGAL {
-
-
-template <typename Tr,
-          typename CornerIndex = int,
-          typename CurveSegmentIndex = int>
-class Mesh_complex_3_in_triangulation_3 :
-  public Mesh_3::Mesh_complex_3_in_triangulation_3_base<
-    Tr, typename Tr::Concurrency_tag>
-{
-public:
-  typedef typename Tr::Concurrency_tag                   Concurrency_tag;
-
-private:
-  typedef Mesh_complex_3_in_triangulation_3<
-    Tr,CornerIndex,CurveSegmentIndex>                             Self;
-  typedef Mesh_3::Mesh_complex_3_in_triangulation_3_base<
-                                          Tr,Concurrency_tag>     Base;
-
-public:
-  typedef typename Base::size_type                        size_type;
-  
-  typedef typename Tr::Point                              Point;
-  typedef typename Base::Edge                             Edge;
-  typedef typename Base::Facet                            Facet;
-  typedef typename Base::Vertex_handle                    Vertex_handle;
-  typedef typename Base::Cell_handle                      Cell_handle;
-  typedef CornerIndex                                     Corner_index;
-  typedef CurveSegmentIndex                               Curve_segment_index;
-
-  typedef typename Base::Triangulation                    Triangulation;
-  typedef typename Base::Subdomain_index                  Subdomain_index;
-
-  using Base::surface_patch_index;
-
-private:
-  // Type to store the edges:
-  //  - a set of std::pair<Vertex_handle,Vertex_handle> (ordered at insertion)
-  //  - which allows fast lookup from one Vertex_handle
-  //  - each element of the set has an associated info (Curve_segment_index) value
-  typedef boost::bimaps::bimap<
-    boost::bimaps::multiset_of<Vertex_handle>,
-    boost::bimaps::multiset_of<Vertex_handle>,
-    boost::bimaps::set_of_relation<>,
-    boost::bimaps::with_info<Curve_segment_index> >   Edge_map;
-
-  typedef typename Edge_map::value_type               Internal_edge;
-
-  // Type to store the corners
-  typedef std::map<Vertex_handle,Corner_index>        Corner_map;
-  // Type to store far vertices
-  typedef std::vector<Vertex_handle>                  Far_vertices_vec;
-
-public:
-  /**
-   * Constructor
-   */
-  Mesh_complex_3_in_triangulation_3()
-    : Base()
-    , edges_()
-    , corners_() {}
-
-  /**
-   * Copy constructor
-   */
-  Mesh_complex_3_in_triangulation_3(const Self& rhs);
-
-  /**
-   * Destructor
-   */
-  virtual ~Mesh_complex_3_in_triangulation_3() {}
-
-  /**
-   * Assignement operator
-   */
-  Self& operator=(Self rhs)
-  {
-    swap(rhs);
-    return *this;
-  }
-
-  /**
-   * Swaps this & rhs
-   */
-  void swap(Self& rhs)
-  {
-    Base::swap(rhs);
-    edges_.swap(rhs.edges_);
-    corners_.swap(rhs.corners_);
-    far_vertices_.swap(rhs.far_vertices_);
-  }
-
-  /**
-   * Clears data of c3t3
-   */
-  void clear()
-  {
-    Base::clear();
-    edges_.clear();
-    corners_.clear();
-  }
-
-  /// Import Base functions
-  using Base::is_in_complex;
-  using Base::add_to_complex;
-  using Base::remove_from_complex;
-  using Base::triangulation;
-  using Base::set_surface_patch_index;
-    
-
-
-  /**
-   * Add edge e to complex, with Curve_segment_index index
-   */
-  void add_to_complex(const Edge& e,
-                      const Curve_segment_index& index)
-  {
-    add_to_complex(e.first->vertex(e.second),
-                   e.first->vertex(e.third),
-                   index);
-  }
-
-  /**
-   * Add edge (v1,v2) to complex, with Curve_segment_index index
-   */
-  void add_to_complex(const Vertex_handle& v1,
-                      const Vertex_handle& v2,
-                      const Curve_segment_index& index)
-  {
-    add_to_complex(make_internal_edge(v1,v2), index);
-  }
-
-  /**
-   * Mark vertex \c v as a corner of the complex
-   */
-  void add_to_complex(const Vertex_handle& v, const Corner_index& index)
-  {
-    v->set_dimension(0);
-    corners_.insert(std::make_pair(v,index));
-  }
-
-  /**
-   * Remove edge \c e from complex
-   */
-  void remove_from_complex(const Edge& e)
-  {
-    remove_from_complex(e.first->vertex(e.second), e.first->vertex(e.third));
-  }
-
-  /**
-   * Remove edge (v1,v2) from complex
-   */
-  void remove_from_complex(const Vertex_handle& v1, const Vertex_handle& v2)
-  {
-    remove_from_complex(make_internal_edge(v1,v2));
-  }
-
-  /**
-   * Remove vertex \c v from complex
-   */
-  void remove_from_complex(const Vertex_handle& v)
-  {
-    corners_.erase(v);
-    v->set_dimension(-1);
-  }
-
-  std::size_t number_of_far_points() const
-  {
-    return far_vertices_.size();
-  }
-
-  void add_far_point(const Point &p)
-  {
-    far_vertices_.push_back(triangulation().insert(p));
-  }
-  
-  void add_far_point(Vertex_handle vh)
-  {
-    far_vertices_.push_back(vh);
-  }
-
-  void remove_far_points()
-  {
-    Triangulation &tr = triangulation();
-    //triangulation().remove(far_vertices_.begin(), far_vertices_.end());
-    typename Far_vertices_vec::const_iterator it = far_vertices_.begin();
-    typename Far_vertices_vec::const_iterator it_end = far_vertices_.end();
-    for ( ; it != it_end ; ++it)
-    {
-      std::vector<Cell_handle> new_cells;
-      new_cells.reserve(32);
-      tr.remove_and_give_new_cells(*it, std::back_inserter(new_cells));
-
-      typename std::vector<Cell_handle>::iterator nc_it = new_cells.begin();
-      typename std::vector<Cell_handle>::iterator nc_it_end = new_cells.end();
-      for ( ; nc_it != nc_it_end ; ++nc_it)
-      {
-        Cell_handle c = *nc_it;
-        for (int i = 0 ; i < 4 ; ++i)
-        {
-          Facet mirror_facet = tr.mirror_facet(std::make_pair(c, i));
-          if (is_in_complex(mirror_facet))
-          {
-            set_surface_patch_index(c, i, 
-                                    surface_patch_index(mirror_facet));
-            c->set_facet_surface_center(i,
-              mirror_facet.first->get_facet_surface_center(mirror_facet.second));
-          }
-        }
-        /*int i_inf;
-        if (c->has_vertex(tr.infinite_vertex(), i_inf))
-        {
-          Facet mirror_facet = tr.mirror_facet(std::make_pair(c, i_inf));
-          if (is_in_complex(mirror_facet))
-          {
-            set_surface_patch_index(c, i_inf, 
-                                    surface_patch_index(mirror_facet));
-          }
-        }*/
-      }
-    }
-    far_vertices_.clear();
-  }
-
-  /**
-   * Returns the number of edges of c3t3
-   */
-  size_type number_of_edges_in_complex() const
-  {
-    return edges_.size();
-  }
-  size_type number_of_edges() const
-  {
-    return edges_.size();
-  }
-
-  /**
-   * Returns the number of corners of c3t3
-   */
-  size_type number_of_vertices_in_complex() const
-  {
-    return corners_.size();
-  }
-
-  /**
-   * Returns true if edge \c e is in complex
-   */
-  bool is_in_complex(const Edge& e) const
-  {
-    return is_in_complex(e.first->vertex(e.second), e.first->vertex(e.third));
-  }
-
-  /**
-   * Returns true if edge (v1,v2) is in C3T3
-   */
-  bool is_in_complex(const Vertex_handle& v1, const Vertex_handle& v2) const
-  {
-    return is_in_complex(make_internal_edge(v1,v2));
-  }
-
-  /**
-   * Returns true if \c v is a 0-dimensionnal feature in the c3t3
-   */
-  bool is_in_complex(const Vertex_handle& v) const
-  {
-    return (corners_.find(v) != corners_.end());
-  }
-
-  /**
-   * Returns Curve_segment_index of edge \c e
-   */
-  Curve_segment_index curve_segment_index(const Edge& e) const
-  {
-    return curve_segment_index(e.first->vertex(e.second),
-                               e.first->vertex(e.third));
-  }
-
-  /**
-   * Returns Curve_segment_index of edge \c (v1,v2)
-   */
-  Curve_segment_index curve_segment_index(const Vertex_handle& v1,
-                                          const Vertex_handle& v2) const
-  {
-    return curve_index(make_internal_edge(v1,v2));
-  }
-
-  /**
-   * Returns Corner_index of vertex \c v
-   */
-  Corner_index corner_index(const Vertex_handle& v) const
-  {
-    typename Corner_map::const_iterator it = corners_.find(v);
-    if ( corners_.end() != it ) { return it->second; }
-    return Corner_index();
-  }
-
-  /**
-   * Outputs the outer boundary of the entire domain with facets oriented outward.
-   */
-  std::ostream& output_boundary_to_off(std::ostream& out) const
-  {
-    internal::output_boundary_of_c3t3_to_off(*this, 0, out, false);
-    return out;
-  }
-
-  /**
-   * Outputs the outer boundary of the selected subdomain with facets oriented outward.
-   */
-  std::ostream& output_boundary_to_off(std::ostream& out, Subdomain_index subdomain) const
-  {
-    output_boundary_of_c3t3_to_off(*this, subdomain, out);
-    return out;
-  }
-
-  /**
-   * Outputs the surface facets with a consistent orientation at the interface of two subdomains.
-   */
-  std::ostream& output_facets_in_complex_to_off(std::ostream& out) const
-  {
-    internal::output_facets_in_complex_to_off(*this, out);
-    return out;
-  }
-
-  /**
-   * Fills \c out with incident edges (1-dimensional features of \c v.
-   * OutputIterator value type is std::pair<Vertex_handle,Curve_segment_index>
-   * \pre v->in_dimension() < 2
-   */
-  template <typename OutputIterator>
-  OutputIterator
-  adjacent_vertices_in_complex(const Vertex_handle& v, OutputIterator out) const;
-
-  // -----------------------------------
-  // Undocumented
-  // -----------------------------------
-
-  /**
-   * Returns true if c3t3 is valid
-   */
-  bool is_valid(bool verbose = false) const;
-
-  // -----------------------------------
-  // Complex traversal
-  // -----------------------------------
-private:
-  class Edge_iterator_not_in_complex
-  {
-    const Self& c3t3_;
-    const Curve_segment_index index_;
-  public:
-    Edge_iterator_not_in_complex(const Self& c3t3,
-                                 const Curve_segment_index& index = Curve_segment_index())
-    : c3t3_(c3t3)
-    , index_(index) { }
-
-    template <typename Iterator>
-    bool operator()(Iterator it) const
-    {
-      if ( index_ == Curve_segment_index() ) { return ! c3t3_.is_in_complex(*it); }
-      else { return c3t3_.curve_segment_index(*it) != index_;  }
-    }
-  };
-
-  class Vertex_iterator_not_in_complex
-  {
-    const Self& c3t3_;
-    const Corner_index index_;
-  public:
-    Vertex_iterator_not_in_complex(const Self& c3t3,
-                                   const Corner_index& index = Corner_index())
-    : c3t3_(c3t3)
-    , index_(index) { }
-
-    template <typename ItMap>
-    bool operator()(const ItMap it) const
-    {
-      if ( index_ == Corner_index() ) { return false; }
-      else { return it->second != index_;  }
-    }
-  };
-
-  // Filtered iterator
-  typedef Filter_iterator<
-    typename Corner_map::const_iterator,
-    Vertex_iterator_not_in_complex >            Vertex_map_filter_iterator;
-
-  // Iterator type to get the first element of pair
-  typedef boost::transform_iterator <
-    Mesh_3::internal::First_of<typename Vertex_map_filter_iterator::value_type>,
-    Vertex_map_filter_iterator >                Vertex_map_iterator_first;
-
-  // Iterator type to remove a level of referencing
-  class Vertex_map_iterator_first_dereference
-    : public boost::iterator_adaptor <
-        Vertex_map_iterator_first_dereference,
-        Vertex_map_iterator_first,
-        typename Vertex_map_iterator_first::value_type::value_type,
-        boost::use_default,
-        typename Vertex_map_iterator_first::value_type::reference >
-  {
-    typedef Vertex_map_iterator_first_dereference Self;
-    typedef boost::iterator_adaptor <
-        Vertex_map_iterator_first_dereference,
-        Vertex_map_iterator_first,
-        typename Vertex_map_iterator_first::value_type::value_type,
-        boost::use_default,
-        typename Vertex_map_iterator_first::value_type::reference > iterator_adaptor_;
-  public:
-    typedef typename  Vertex_map_iterator_first::reference  pointer;
-    typedef typename iterator_adaptor_::reference           reference;
-
-    Vertex_map_iterator_first_dereference() : Self::iterator_adaptor_() { }
-
-    template < typename Iterator >
-    Vertex_map_iterator_first_dereference(Iterator i)
-      : Self::iterator_adaptor_(typename Self::iterator_adaptor_::base_type(i))
-    { }
-
-    pointer operator->() const { return *(this->base()); }
-    reference operator*() const { return **(this->base()); }
-
-    operator Vertex_handle() { return Vertex_handle(*(this->base())); }
-  };
-
-public:
-  /// Iterator type to visit the edges of the 1D complex.
-  typedef Filter_iterator<
-    typename Triangulation::Finite_edges_iterator,
-    Edge_iterator_not_in_complex >          Edges_in_complex_iterator;
-
-  /// Returns a Facets_in_complex_iterator to the first facet of the 1D complex
-  Edges_in_complex_iterator edges_in_complex_begin() const
-  {
-    return CGAL::filter_iterator(this->triangulation().finite_edges_end(),
-                                 Edge_iterator_not_in_complex(*this),
-                                 this->triangulation().finite_edges_begin());
-  }
-
-  /// Returns a Facets_in_complex_iterator to the first facet of the 1D complex
-  Edges_in_complex_iterator
-  edges_in_complex_begin(const Curve_segment_index& index) const
-  {
-    return CGAL::filter_iterator(this->triangulation().finite_edges_end(),
-                                 Edge_iterator_not_in_complex(*this,index),
-                                 this->triangulation().finite_edges_begin());
-  }
-
-  /// Returns past-the-end iterator on facet of the 1D complex
-  Edges_in_complex_iterator edges_in_complex_end(const Curve_segment_index& = Curve_segment_index()) const
-  {
-    return CGAL::filter_iterator(this->triangulation().finite_edges_end(),
-                                 Edge_iterator_not_in_complex(*this));
-  }
-
-  /// Iterator type to visit the edges of the 0D complex.
-  typedef Vertex_map_iterator_first_dereference Vertices_in_complex_iterator;
-
-  /// Returns a Vertices_in_complex_iterator to the first vertex of the 0D complex
-  Vertices_in_complex_iterator vertices_in_complex_begin() const
-  {
-    return CGAL::filter_iterator(corners_.end(),
-                                 Vertex_iterator_not_in_complex(*this),
-                                 corners_.begin());
-  }
-
-  /// Returns a Vertices_in_complex_iterator to the first vertex of the 0D complex
-  Vertices_in_complex_iterator
-  vertices_in_complex_begin(const Corner_index& index) const
-  {
-    return CGAL::filter_iterator(corners_.end(),
-                                 Vertex_iterator_not_in_complex(*this,index),
-                                 corners_.begin());
-  }
-
-  /// Returns past-the-end iterator on facet of the 0D complex
-  Vertices_in_complex_iterator vertices_in_complex_end() const
-  {
-    return CGAL::filter_iterator(corners_.end(),
-                                 Vertex_iterator_not_in_complex(*this));
-  }
-
-
-private:
-  /**
-   * Creates an Internal_edge object (i.e a pair of ordered Vertex_handle)
-   */
-  Internal_edge make_internal_edge(const Vertex_handle& v1,
-                                   const Vertex_handle& v2) const
-  {
-    if ( v1 < v2 ) { return Internal_edge(v1,v2); }
-    else { return Internal_edge(v2,v1); }
-  }
-
-  /**
-   * Returns true if \c edge is in C3T3
-   */
-  bool is_in_complex(const Internal_edge& edge) const
-  {
-    return (curve_index(edge) != Curve_segment_index() );
-  }
-
-  /**
-   * Add edge \c edge to complex, with Curve_segment_index index
-   */
-  void add_to_complex(const Internal_edge& edge, const Curve_segment_index& index)
-  {
-    CGAL_precondition(!is_in_complex(edge));
-#ifdef CGAL_MESH_3_PROTECTION_DEBUG
-    std::cerr << "Add edge ( " << edge.left->point()
-              << " , " << edge.right->point() << " ), curve_index=" << index
-              << " to c3t3.\n";
-#endif // CGAL_MESH_3_PROTECTION_DEBUG
-    std::pair<typename Edge_map::iterator, bool> it = edges_.insert(edge);
-    it.first->info = index;
-  }
-
-  /**
-   * Remove edge \c edge from complex
-   */
-  void remove_from_complex(const Internal_edge& edge)
-  {
-    edges_.erase(edge);
-  }
-
-  /**
-   * Returns Curve_segment_index of edge \c edge
-   */
-  Curve_segment_index curve_index(const Internal_edge& edge) const
-  {
-    typename Edge_map::const_iterator it = edges_.find(edge);
-    if ( edges_.end() != it ) { return it->info; }
-    return Curve_segment_index();
-  }
-
-private:
-  Edge_map edges_;
-  Corner_map corners_;
-  Far_vertices_vec far_vertices_;
-};
-
-
-template <typename Tr, typename CI_, typename CSI_>
-Mesh_complex_3_in_triangulation_3<Tr,CI_,CSI_>::
-Mesh_complex_3_in_triangulation_3(const Self& rhs)
-  : Base(rhs)
-  , edges_()
-  , corners_()
-{
-  // Copy edges
-  for ( typename Edge_map::const_iterator it = rhs.edges_.begin(),
-       end = rhs.edges_.end() ; it != end ; ++it )
-  {
-    const Vertex_handle& va = it->right;
-    const Vertex_handle& vb = it->left;
-
-    Vertex_handle new_va;
-    this->triangulation().is_vertex(va->point(), new_va);
-
-    Vertex_handle new_vb;
-    this->triangulation().is_vertex(vb->point(), new_vb);
-
-    this->add_to_complex(make_internal_edge(new_va,new_vb), it->info);
-  }
-
-  // Copy corners
-  for ( typename Corner_map::const_iterator it = rhs.corners_.begin(),
-       end = rhs.corners_.end() ; it != end ; ++it )
-  {
-    Vertex_handle new_v;
-    this->triangulation().is_vertex(it->first->point(), new_v);
-    this->add_to_complex(new_v, it->second);
-  }
-
-  // Parse vertices to identify far vertices
-  if (rhs.far_vertices_.size() > 0)
-  {
-    Triangulation &tr = triangulation();
-    typename Tr::Finite_vertices_iterator vit = tr.finite_vertices_begin();
-    for(typename Tr::Finite_vertices_iterator end = tr.finite_vertices_end();
-        vit != end ; ++vit)
-    {
-      if (vit->in_dimension() == -1)
-        far_vertices_.push_back(vit);
-    }
-    CGAL_assertion(far_vertices_.size() == rhs.far_vertices_.size());
-  }
-}
-
-
-template <typename Tr, typename CI_, typename CSI_>
-template <typename OutputIterator>
-OutputIterator
-Mesh_complex_3_in_triangulation_3<Tr,CI_,CSI_>::
-adjacent_vertices_in_complex(const Vertex_handle& v, OutputIterator out) const
-{
-  CGAL_precondition(v->in_dimension() < 2);
-
-  typedef typename Edge_map::right_const_iterator Rcit;
-  typedef typename Edge_map::left_const_iterator Lcit;
-
-  // Add edges containing v is on the left
-  std::pair<Rcit,Rcit> range_right = edges_.right.equal_range(v);
-  for ( Rcit rit = range_right.first ; rit != range_right.second ; ++rit )
-  {
-    *out++ = std::make_pair(rit->second, rit->info);
-  }
-
-  // Add edges containing v on the right
-  std::pair<Lcit,Lcit> range_left = edges_.left.equal_range(v);
-  for ( Lcit lit = range_left.first ; lit != range_left.second ; ++lit )
-  {
-    *out++ = std::make_pair(lit->second, lit->info);
-  }
-
-  return out;
-}
-
-
-template <typename Tr, typename CI_, typename CSI_>
-bool
-Mesh_complex_3_in_triangulation_3<Tr,CI_,CSI_>::
-is_valid(bool verbose) const
-{
-  typedef typename Tr::Point::Point    Bare_point;
-  typedef typename Tr::Point::Weight   Weight;
-  typedef Weight FT;
-
-  std::map<Vertex_handle, int> vertex_map;
-
-  // Fill map counting neighbor number for each vertex of an edge
-  for ( typename Edge_map::const_iterator it = edges_.begin(),
-       end = edges_.end() ; it != end ; ++it )
-  {
-    const Vertex_handle& v1 = it->right;
-    if ( vertex_map.find(v1) == vertex_map.end() ) { vertex_map[v1] = 1; }
-    else { vertex_map[v1] += 1; }
-
-    const Vertex_handle& v2 = it->left;
-    if ( vertex_map.find(v2) == vertex_map.end() ) { vertex_map[v2] = 1; }
-    else { vertex_map[v2] += 1; }
-  }
-
-  // Verify that each vertex has 2 neighbors if it's not a corner
-  for ( typename std::map<Vertex_handle, int>::iterator vit = vertex_map.begin(),
-       vend = vertex_map.end() ; vit != vend ; ++vit )
-  {
-    if ( vit->first->in_dimension() != 0 && vit->second != 2 )
-    {
-      if(verbose)
-        std::cerr << "Validity error: vertex " << (void*)(&*vit->first)
-                  << " (" << vit->first->point() << ") "
-                  << "is not a corner (dimension " << vit->first->in_dimension()
-                  << ") but has " << vit->second << " neighbor(s)!\n";
-      return false;
-    }
-  }
-
-  // Verify that balls of each edge intersect
-  for ( typename Edge_map::const_iterator it = edges_.begin(),
-       end = edges_.end() ; it != end ; ++it )
-  {
-    const Bare_point& p = it->right->point().point();
-    const Bare_point& q = it->left->point().point();
-
-    typename Tr::Geom_traits::Construct_sphere_3 sphere =
-      this->triangulation().geom_traits().construct_sphere_3_object();
-
-    typename Tr::Geom_traits::Do_intersect_3 do_intersect =
-      this->triangulation().geom_traits().do_intersect_3_object();
-
-    const FT& sq_rp = it->right->point().weight();
-    const FT& sq_rq = it->left->point().weight();
-
-    if ( ! do_intersect(sphere(p, sq_rp), sphere(q, sq_rq)) )
-    {
-      std::cerr << "Point p[" << p << "], dim=" << it->right->in_dimension()
-                << " and q[" << q << "], dim=" << it->left->in_dimension()
-                << " form an edge but do not intersect !\n";
-      return false;
-    }
-  }
-
-  return true;
-}
-
-
-template <typename Tr, typename CI_, typename CSI_>
-std::ostream &
-operator<< (std::ostream& os,
-            const Mesh_complex_3_in_triangulation_3<Tr,CI_,CSI_> &c3t3)
-{
-  // TODO: implement edge saving
-  typedef typename Mesh_complex_3_in_triangulation_3<Tr,CI_,CSI_>::Concurrency_tag Concurrency_tag;
-  return os << static_cast<
-    const Mesh_3::Mesh_complex_3_in_triangulation_3_base<Tr, Concurrency_tag>&>(c3t3);
-}
-
-
-template <typename Tr, typename CI_, typename CSI_>
-std::istream &
-operator>> (std::istream& is,
-            Mesh_complex_3_in_triangulation_3<Tr,CI_,CSI_> &c3t3)
-{
-  // TODO: implement edge loading
-  typedef typename Mesh_complex_3_in_triangulation_3<Tr,CI_,CSI_>::Concurrency_tag Concurrency_tag;
-  is >> static_cast<
-    Mesh_3::Mesh_complex_3_in_triangulation_3_base<Tr, Concurrency_tag>&>(c3t3);
-  return is;
-}
-
-} //namespace CGAL
-
-#endif // CGAL_MESH_COMPLEX_3_IN_TRIANGULATION_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_criteria_3.h b/3rdparty/CGAL-4.8/include/CGAL/Mesh_criteria_3.h
deleted file mode 100644
index 6e1feb3..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Mesh_criteria_3.h
+++ /dev/null
@@ -1,193 +0,0 @@
-// Copyright (c) 2009 INRIA Sophia-Antipolis (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
-// 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(s)     : Stéphane Tayeb
-//
-//******************************************************************************
-// File Description :
-// Implements default meshing criteria to drive Mesh_3 process
-//******************************************************************************
-
-
-#ifndef CGAL_MESH_CRITERIA_3_H
-#define CGAL_MESH_CRITERIA_3_H
-
-#include <CGAL/Mesh_3/config.h>
-#include <CGAL/Mesh_3/global_parameters.h>
-#include <CGAL/Mesh_edge_criteria_3.h>
-#include <CGAL/Mesh_facet_criteria_3.h>
-#include <CGAL/Mesh_cell_criteria_3.h>
-
-namespace CGAL {
-  
-namespace parameters {
-
-// see <CGAL/config.h>
-CGAL_PRAGMA_DIAG_PUSH
-// see <CGAL/Mesh_3/config.h>
-CGAL_MESH_3_IGNORE_BOOST_PARAMETER_NAME_WARNINGS
-
-  BOOST_PARAMETER_NAME( (edge_size, tag) edge_size_ )
-  BOOST_PARAMETER_NAME( (edge_sizing_field, tag) edge_sizing_field_ )
-  BOOST_PARAMETER_NAME( (facet_angle, tag) facet_angle_ )
-  BOOST_PARAMETER_NAME( (facet_size, tag) facet_size_ )
-  BOOST_PARAMETER_NAME( (facet_sizing_field, tag) facet_sizing_field_ )
-  BOOST_PARAMETER_NAME( (facet_distance, tag) facet_distance_ )
-  BOOST_PARAMETER_NAME( (facet_topology, tag) facet_topology_ )
-  BOOST_PARAMETER_NAME( (cell_radius_edge, tag) cell_radius_edge_ )
-  BOOST_PARAMETER_NAME( (cell_radius_edge_ratio, tag) cell_radius_edge_ratio_ )
-  BOOST_PARAMETER_NAME( (cell_size, tag) cell_size_ )
-  BOOST_PARAMETER_NAME( (cell_sizing_field, tag) cell_sizing_field_ )
-  BOOST_PARAMETER_NAME( (sizing_field, tag) sizing_field_ )
-
-CGAL_PRAGMA_DIAG_POP
-
-} // end namespace parameters
-  
-namespace internal {
-  
-// Class Mesh_criteria_3_impl
-template < typename Tr,
-           typename EdgeCriteria,
-           typename FacetCriteria,
-           typename CellCriteria >
-class Mesh_criteria_3_impl
-{
-  typedef typename Tr::Geom_traits::FT FT;
-  
-public:
-  typedef EdgeCriteria      Edge_criteria;
-  typedef FacetCriteria     Facet_criteria;
-  typedef CellCriteria      Cell_criteria;
-  
-  // Constructor
-  Mesh_criteria_3_impl(const Facet_criteria& facet_criteria,
-                       const Cell_criteria& cell_criteria)
-    : edge_criteria_(0)
-    , facet_criteria_(facet_criteria)
-    , cell_criteria_(cell_criteria)
-  { }
-  
-  // Constructor
-  Mesh_criteria_3_impl(const Edge_criteria& edge_criteria,
-                       const Facet_criteria& facet_criteria,
-                       const Cell_criteria& cell_criteria)
-    : edge_criteria_(edge_criteria)
-    , facet_criteria_(facet_criteria)
-    , cell_criteria_(cell_criteria)
-  { }
-  
-  // This template constructor is not instantiated when named parameters
-  // are not used, so Facet_criteria and Cell_criteria construction from FT
-  // is not a problem
-  template <class ArgumentPack>
-  Mesh_criteria_3_impl(const ArgumentPack& args)
-    : edge_criteria_(args[parameters::edge_size
-                          | args[parameters::edge_sizing_field
-                                 | args[parameters::sizing_field | FT(0)] ] ])
-    , facet_criteria_(args[parameters::facet_angle | FT(0)],
-                      args[parameters::facet_size
-                           | args[parameters::facet_sizing_field
-                                  | args[parameters::sizing_field | FT(0)] ] ],
-                      args[parameters::facet_distance | FT(0)],
-                      args[parameters::facet_topology | CGAL::FACET_VERTICES_ON_SURFACE])
-    , cell_criteria_(args[parameters::cell_radius_edge_ratio
-                          | args[parameters::cell_radius_edge | FT(0)] ],
-                     args[parameters::cell_size
-                          | args[parameters::cell_sizing_field
-                                 | args[parameters::sizing_field | FT(0)] ] ])
-  { }
-
-#ifndef CGAL_NO_DEPRECATED_CODE  
-  const Edge_criteria& edge_criteria() const { return edge_criteria_; }
-  const Facet_criteria& facet_criteria() const { return facet_criteria_; }
-  const Cell_criteria& cell_criteria() const { return cell_criteria_; }
-#endif
-
-  const Edge_criteria& edge_criteria_object() const { return edge_criteria_; }
-  const Facet_criteria& facet_criteria_object() const { return facet_criteria_; }
-  const Cell_criteria& cell_criteria_object() const { return cell_criteria_; }
-  
-private:
-  Edge_criteria edge_criteria_;
-  Facet_criteria facet_criteria_;
-  Cell_criteria cell_criteria_;
-  
-};  // end class Mesh_criteria_3_impl  
-
-} // end namespace internal
-  
-  
-  
-// Class Mesh_criteria_3
-// Provides default mesh criteria to drive Mesh_3 process
-template <typename Tr,
-          typename EdgeCriteria = Mesh_edge_criteria_3<Tr>,
-          typename FacetCriteria = Mesh_facet_criteria_3<Tr>,
-          typename CellCriteria = Mesh_cell_criteria_3<Tr> >
-class Mesh_criteria_3
-  : public internal::Mesh_criteria_3_impl< Tr,
-                                           EdgeCriteria,
-                                           FacetCriteria,
-                                           CellCriteria >
-{
-  typedef internal::Mesh_criteria_3_impl< Tr,
-                                          EdgeCriteria,
-                                          FacetCriteria,
-                                          CellCriteria>   Base;
-  
-public:
-  typedef typename Base::Edge_criteria    Edge_criteria;
-  typedef typename Base::Facet_criteria   Facet_criteria;
-  typedef typename Base::Cell_criteria    Cell_criteria;
-  
-  // Constructor
-  Mesh_criteria_3(const Facet_criteria& facet_criteria,
-                  const Cell_criteria& cell_criteria)
-    : Base(facet_criteria,
-           cell_criteria) {}
-  
-  // Constructor
-  Mesh_criteria_3(const Edge_criteria& edge_criteria,
-                  const Facet_criteria& facet_criteria,
-                  const Cell_criteria& cell_criteria)
-    : Base(edge_criteria,
-           facet_criteria,
-           cell_criteria) {}
-  
-  // For convenient constructor call (see examples)
-  BOOST_PARAMETER_CONSTRUCTOR(Mesh_criteria_3, (Base), parameters::tag,
-                              (optional (edge_size_,*)
-                                        (edge_sizing_field_,*)
-                                        (facet_angle_,*)
-                                        (facet_size_,*)
-                                        (facet_sizing_field_,*)
-                                        (facet_distance_,*)
-                                        (facet_topology_,*)
-                                        (cell_radius_edge_,*)
-                                        (cell_size_,*)
-                                        (cell_sizing_field_,*)
-                                        (sizing_field_,*)
-                              ))
-  
-};  // end class Mesh_criteria_3
-
-}  // end namespace CGAL
-
-
-#endif // CGAL_MESH_CRITERIA_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_domain_with_polyline_features_3.h b/3rdparty/CGAL-4.8/include/CGAL/Mesh_domain_with_polyline_features_3.h
deleted file mode 100644
index 0a9c2cb..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Mesh_domain_with_polyline_features_3.h
+++ /dev/null
@@ -1,1088 +0,0 @@
-// Copyright (c) 2009-2010 INRIA Sophia-Antipolis (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
-// 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(s)     : Stéphane Tayeb, Laurent Rineau
-//
-//******************************************************************************
-// File Description :
-//
-//******************************************************************************
-
-#ifndef CGAL_MESH_DOMAIN_WITH_POLYLINE_FEATURES_3_H
-#define CGAL_MESH_DOMAIN_WITH_POLYLINE_FEATURES_3_H
-
-#include <CGAL/iterator.h>
-#include <CGAL/enum.h>
-#include <CGAL/number_utils.h>
-#include <CGAL/AABB_tree.h>
-#include <CGAL/AABB_traits.h>
-#include <CGAL/is_streamable.h>
-
-#include <vector>
-#include <set>
-#include <map>
-#include <boost/next_prior.hpp> // for boost::prior and boost::next
-#include <boost/variant.hpp>
-#include <boost/foreach.hpp>
-
-namespace CGAL {
-
-
-namespace internal {
-namespace Mesh_3 {
-
-template <typename Kernel>
-class Polyline
-{
-  typedef typename Kernel::Point_3  Point_3;
-  typedef typename Kernel::Segment_3 Segment_3;
-  typedef typename Kernel::FT       FT;
-
-  typedef std::vector<Point_3>      Data;
-
-public:
-  typedef typename Data::const_iterator const_iterator;
-
-  Polyline() {}
-  ~Polyline() {}
-
-  /// Add a point at the end of the polyline
-  void add_point(const Point_3& p)
-  {
-    if( points_.empty() || p != end_point() ) {
-      points_.push_back(p);
-    }
-  }
-
-  /// Returns the starting point of the polyline
-  const Point_3& start_point() const
-  {
-    CGAL_assertion( ! points_.empty() );
-    return points_.front();
-  }
-
-  /// Returns the ending point of the polyline
-  const Point_3& end_point() const
-  {
-    CGAL_assertion( ! points_.empty() );
-    return points_.back();
-  }
-
-  /// Returns true if the polyline is not degenerated
-  bool is_valid() const
-  {
-    return points_.size() > 1;
-  }
-
-  /// Returns true if polyline is a cycle
-  bool is_cycle() const
-  {
-    return start_point() == end_point();
-  }
-
-  /// Returns the length of the polyline
-  FT length() const
-  {
-    //TODO: cache result
-    FT result (0);
-    const_iterator it = points_.begin();
-    const_iterator previous = it++;
-
-    for ( const_iterator end = points_.end() ; it != end ; ++it, ++previous )
-    {
-      result += distance(*previous,*it);
-    }
-
-    return result;
-  }
-
-  /// Returns signed geodesic distance between \c p and \c q
-  FT geodesic_distance(const Point_3& p, const Point_3& q,
-                       bool /*treat_cycle*/=true) const
-  {
-    CGAL_precondition(is_valid());
-
-    // Locate p & q on polyline
-    const_iterator pit = locate(p);
-    const_iterator qit = locate(q,false);
-
-    // Compute geodesic distance
-    FT result = (pit <= qit) ? geodesic_distance(p,q,pit,qit)
-                             : -geodesic_distance(q,p,qit,pit);
-
-    // Treat cycles: return a positive value
-    if ( is_cycle() && (p==q || result < FT(0)) )
-    {
-      result = length() + result;
-    }
-
-    return result;
-  }
-
-
-  /// Returns a point at geodesic distance \c distance from p along the
-  /// polyline. The polyline is oriented from starting point to end point.
-  /// The distance could be negative.
-  Point_3 point_at(const Point_3& p, FT distance) const
-  {
-    // use first point of the polyline instead of p
-    distance += geodesic_distance(start_point(),p,false);
-
-    // If polyline is a cycle, ensure that distance is given from start_point()
-    if ( is_cycle() )
-    {
-      if ( distance < FT(0) ) { distance += length(); }
-      else if ( distance > length() ) { distance -= length(); }
-    }
-
-    CGAL_assertion( distance >= FT(0) );
-    CGAL_assertion( distance <= length() );
-
-    // Initialize iterators
-    const_iterator pit = points_.begin();
-    const_iterator previous = pit++;
-
-    // Iterate to find which segment contains the point we want to construct
-    FT segment_length = this->distance(*previous,*pit);
-    while ( distance > segment_length )
-    {
-      distance -= segment_length;
-
-      // Increment iterators and update length
-      ++previous;
-      ++pit;
-
-      if (pit == points_.end())
-        return *previous;
-
-      segment_length = this->distance(*previous,*pit);
-    }
-
-    // return point at distance from current segment source
-    typedef typename Kernel::Vector_3 Vector_3;
-    Vector_3 v (*previous, *pit);
-
-    return (*previous) + (distance / CGAL::sqrt(v.squared_length())) * v;
-  }
-
-  bool are_ordered_along(const Point_3& p, const Point_3& q) const
-  {
-    CGAL_precondition(!is_cycle());
-
-    // Locate p & q on polyline
-    const_iterator pit = locate(p);
-    const_iterator qit = locate(q,true);
-
-    // Points are not located on the same segment
-    if ( pit != qit ) { return (pit <= qit); }
-
-    // pit == qit, then we have to sort p&q along (pit,pit+1)
-    return ( compare_distance(*pit,p,q) != CGAL::LARGER );
-  }
-
-private:
-  const_iterator first_segment_source() const
-  {
-    CGAL_precondition(is_valid());
-    return points_.begin();
-  }
-
-  const_iterator last_segment_source() const
-  {
-    CGAL_precondition(is_valid());
-    return (points_.end() - 2);
-  }
-
-  FT geodesic_distance(const Point_3& p, const Point_3& q,
-                       const_iterator pit, const_iterator qit) const
-  {
-    CGAL_precondition(std::distance(pit,qit) >= 0);
-
-    // If p and q are in the same segment of the polyline
-    if ( pit == qit )
-    {
-      FT result = distance(p,q);
-
-      // Find the closest point to *pit
-      if ( compare_distance(*pit,p,q) != CGAL::LARGER )
-      { return result; }
-      else
-      { return -result; }
-    }
-
-    // p is inside [pit,pit+1], pit+1 != qit, q is inside [qit,qit+1]
-    FT result = distance(p,*(pit+1));
-    result += distance(*qit,q);
-
-    // Add segments between pit+1 and qit to result
-    for ( const_iterator it = (pit+1) ; it != qit ; ++it )
-    {
-      result += distance(*it,*(it+1));
-    }
-
-    return result;
-  }
-
-  /// Returns an iterator on the starting point of the segment of the
-  /// polyline which contains p
-  /// if end_point_first is true, then --end is returned instead of begin
-  /// if p is the starting point of a cycle.
-  const_iterator locate(const Point_3& p, bool end_point_first=false) const
-  {
-    CGAL_precondition(is_valid());
-
-    // First look if p is one of the points of the polyline
-    const_iterator result = std::find(points_.begin(), points_.end(), p);
-    if ( result != points_.end() )
-    {
-      if ( result != points_.begin() )
-      { return --result; }
-      else
-      {
-        // Treat cycles
-        if ( end_point_first && p == end_point() )
-        { return last_segment_source(); }
-        else
-        { return result; }
-      }
-    }
-
-    CGAL_assertion(result == points_.end());
-
-    // Get result by projecting p on the polyline
-    const_iterator it = points_.begin();
-    const_iterator previous = it;
-    Segment_3 nearest_segment;
-    const_iterator nearest_vertex = it;
-    result = nearest_vertex;
-    bool nearest_is_a_segment = false;
-
-    while ( ++it != points_.end() )
-    {
-      Segment_3 seg (*previous, *it);
-
-      if(nearest_is_a_segment)
-      {
-        if(compare_distance(p, seg, nearest_segment) == CGAL::SMALLER)
-        {
-          nearest_segment = seg;
-          result = previous;
-        }
-        if(compare_distance(p, *it, nearest_segment) == CGAL::SMALLER)
-        {
-          nearest_vertex = it;
-          nearest_is_a_segment = false;
-          result = it;
-        }
-      }
-      else {
-        if(compare_distance(p, *it, *nearest_vertex) == CGAL::SMALLER)
-        {
-          nearest_vertex = it;
-          result = it;
-        }
-        if(compare_distance(p, seg, *nearest_vertex) == CGAL::SMALLER)
-        {
-          nearest_segment = seg;
-          nearest_is_a_segment = true;
-          result = previous;
-        }
-      }
-      previous = it;
-    } // end the while loop on the vertices of the polyline
-
-
-    if(result == points_.begin()) {
-      return (end_point_first && !nearest_is_a_segment) ? last_segment_source() : points_.begin();
-    } else {
-      return result;
-    }
-  }
-
-  // FT squared_distance(const Point_3& p, const Point_3& q) const
-  // {
-  //   typename Kernel::Compute_squared_distance_3 sq_distance =
-  //     Kernel().compute_squared_distance_3_object();
-  //   return sq_distance(p,q);
-  // }
-
-  FT distance(const Point_3& p, const Point_3& q) const
-  {
-    return CGAL::sqrt(squared_distance(p, q));
-  }
-
-  Angle angle(const Point_3& p,
-              const Point_3& angle_vertex_point,
-              const Point_3& q) const
-  {
-    typename Kernel::Angle_3 compute_angle =  Kernel().angle_3_object();
-    return compute_angle(p,angle_vertex_point,q);
-  }
-
-  template <typename T1, typename T2>
-  CGAL::Sign compare_distance(const Point_3& p,
-                              const T1& obj1,
-                              const T2& obj2) const
-  {
-    typename Kernel::Compare_distance_3 compare_distance =
-      Kernel().compare_distance_3_object();
-    return compare_distance(p,obj1,obj2);
-  }
-
-public:
-  Data points_;
-}; // end class Polyline
-
-
-template <typename Gt, typename MapIterator>
-struct Mesh_domain_segment_of_curve_primitive{
-  typedef typename std::iterator_traits<MapIterator>::value_type Map_value_type;
-  typedef typename Map_value_type::first_type Curve_id;
-  typedef typename Map_value_type::second_type Polyline;
-
-  typedef std::pair<MapIterator,
-                    typename Polyline::const_iterator> Id;
-
-  typedef typename std::iterator_traits<
-    typename Polyline::const_iterator>::value_type Point;
-
-  typedef typename Gt::Segment_3 Datum;
-
-  Id id_;
-
-  Mesh_domain_segment_of_curve_primitive(Id id) : id_(id) {}
-
-  const Id& id() const { return id_; }
-
-  const Point& reference_point() const {
-    return *(id_.second);
-  }
-
-  Datum datum() const {
-    return Datum(*id_.second, *(id_.second+1));
-  }
-}; // end Mesh_domain_segment_of_curve_primitive
-
-template <typename MDwPF, bool patch_id_is_streamable>
-struct Display_incidences_to_patches_aux {
-  template <typename Container>
-  void operator()(std::ostream& os, typename MDwPF::Curve_segment_index id,
-                  const Container&) const;
-};
-
-template <typename MDwPF> //specialization when patch_id_is_streamable == false
-struct Display_incidences_to_patches_aux<MDwPF, false> {
-  template <typename Container>
-  void operator()(std::ostream& os,
-                  typename MDwPF::Curve_segment_index id,
-                  const Container&) const;
-};
-
-template <typename MDwPF, bool curve_id_is_streamable>
-struct Display_incidences_to_curves_aux {
-  template <typename Container>
-  void operator()(std::ostream& os, typename MDwPF::Curve_segment_index id,
-                  const Container&) const;
-};
-
-template <typename MDwPF> //specialization when curve_id_is_streamable == false
-struct Display_incidences_to_curves_aux<MDwPF, false> {
-  template <typename Container>
-  void operator()(std::ostream& os, typename MDwPF::Curve_segment_index id,
-                  const Container&) const;
-};
-
-} // end of namespace CGAL::internal::Mesh_3
-} // end of namespace CGAL::internal
-
-
-
-
-
-/**
- * @class Mesh_domain_with_polyline_features_3
- *
- *
- */
-template < typename MeshDomain >
-class Mesh_domain_with_polyline_features_3
-  : public MeshDomain
-{
-  typedef MeshDomain Base;
-
-public:
-  // Index types
-  typedef typename Base::Index    Index;
-
-  typedef typename Base::Surface_patch_index
-                                  Surface_patch_index;
-
-  typedef int                     Curve_segment_index;
-  typedef int                     Corner_index;
-
-  typedef typename Base::R         Gt;
-  typedef Gt                       R;
-  typedef typename Base::Point_3   Point_3;
-  typedef typename Gt::FT          FT;
-
-  typedef CGAL::Tag_true           Has_features;
-
-
-#ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
-  template <typename ... T>
-  Mesh_domain_with_polyline_features_3(const T& ...t)
-    : Base(t...)
-    , current_corner_index_(1)
-    , current_curve_index_(1)
-    , curves_aabb_tree_is_built(false) {}
-#else
-  /// Constructors
-  /// Call the base class constructor
-  Mesh_domain_with_polyline_features_3()
-    : Base()
-    , current_corner_index_(1)
-    , current_curve_index_(1)
-    , curves_aabb_tree_is_built(false) {}
-
-  template <typename T1>
-  Mesh_domain_with_polyline_features_3(const T1& o1)
-    : Base(o1)
-    , current_corner_index_(1)
-    , current_curve_index_(1)
-    , curves_aabb_tree_is_built(false) {}
-
-  template <typename T1, typename T2>
-  Mesh_domain_with_polyline_features_3(const T1& o1, const T2& o2)
-    : Base(o1, o2)
-    , current_corner_index_(1)
-    , current_curve_index_(1)
-    , curves_aabb_tree_is_built(false) {}
-
-  template <typename T1, typename T2, typename T3>
-  Mesh_domain_with_polyline_features_3(const T1& o1, const T2& o2,
-                                       const T3& o3)
-    : Base(o1, o2, o3)
-    , current_corner_index_(1)
-    , current_curve_index_(1)
-    , curves_aabb_tree_is_built(false) {}
-#endif
-
-  /// Destructor
-  ~Mesh_domain_with_polyline_features_3() {}
-
-  /// OutputIterator value type is std::pair<Corner_index, Point_3>
-  template <typename OutputIterator>
-  OutputIterator get_corners(OutputIterator out) const;
-
-  /// OutputIterator value type is CGAL::cpp11::tuple<Curve_segment_index,
-  /// std::pair<Point_3,Index>, std::pair<Point_3,Index> >
-  template <typename OutputIterator>
-  OutputIterator get_curve_segments(OutputIterator out) const;
-
-  /// Returns the geodesic distance between points p and q of curve
-  /// \c curve_index
-  FT geodesic_distance(const Point_3& p, const Point_3& q,
-                       const Curve_segment_index& curve_index) const;
-
-  /// Construct a point on curve \c curve_index at geodesic distance \c distance
-  /// of \c starting_point
-  Point_3
-  construct_point_on_curve_segment(const Point_3& starting_point,
-                                   const Curve_segment_index& curve_index,
-                                   FT distance) const;
-
-  /// Returns the sign of the orientation of p,q,r along curve segment
-  /// of index \c index
-  CGAL::Sign distance_sign_along_cycle(const Point_3& p,
-                                       const Point_3& q,
-                                       const Point_3& r,
-                                       const Curve_segment_index& index) const;
-
-  /// Returns true if curve \c curve_index is a cycle
-  bool is_cycle(const Point_3&, const Curve_segment_index& index) const;
-
-  /// Returns an Index from a Curve_segment_index
-  Index index_from_curve_segment_index(const Curve_segment_index& index) const
-  { return Index(index); }
-
-  /// Returns an Curve_segment_index from an Index
-  Curve_segment_index curve_segment_index(const Index& index) const
-  { return boost::get<Curve_segment_index>(index); }
-
-  /// Returns an Index from a Corner_index
-  Index index_from_corner_index(const Corner_index& index) const
-  { return Index(index); }
-
-  /// Returns an Corner_index from an Index
-  Corner_index corner_index(const Index& index) const
-  { return boost::get<Corner_index>(index); }
-
-  /// Insert a bunch of edges into domain
-  ///   + InputIterator type should have begin() and end() function
-  ///   + InputIterator::iterator value type must be Point_3
-  //    + IndicesOutputIterator is an output iterator of value_type equal
-  ///   to Curve_segment_index
-  template <typename InputIterator, typename IndicesOutputIterator>
-  IndicesOutputIterator
-  add_features(InputIterator first, InputIterator last,
-               IndicesOutputIterator out /*= CGAL::Emptyset_iterator()*/);
-
-  template <typename InputIterator, typename IndicesOutputIterator>
-  IndicesOutputIterator
-  add_features_with_context(InputIterator first, InputIterator last,
-                            IndicesOutputIterator out /*=
-                                                        CGAL::Emptyset_iterator()*/);
-
-  template <typename IndicesOutputIterator>
-  IndicesOutputIterator
-  get_incidences(Curve_segment_index id, IndicesOutputIterator out) const;
-
-  template <typename IndicesOutputIterator>
-  IndicesOutputIterator
-  get_corner_incidences(Curve_segment_index id, IndicesOutputIterator out) const;
-
-  typedef std::set<Surface_patch_index> Surface_patch_index_set;
-
-  const Surface_patch_index_set&
-  get_incidences(Curve_segment_index id) const;
-
-  void display_corner_incidences(std::ostream& os, Corner_index id);
-
-  template <typename InputIterator>
-  void
-  add_features(InputIterator first, InputIterator last)
-  { add_features(first, last, CGAL::Emptyset_iterator()); }
-
-  /// Insert one edge into domain
-  /// InputIterator value type is Point_3
-  template <typename InputIterator>
-  Curve_segment_index insert_edge(InputIterator first, InputIterator last);
-
-private:
-  void register_corner(const Point_3& p, const Curve_segment_index& index);
-  void compute_corners_incidences();
-
-  /// Returns the sign of the geodesic distance between \c p and \c q
-  /// Precondition: index is not a cycle
-  CGAL::Sign distance_sign(const Point_3& p, const Point_3& q,
-                           const Curve_segment_index& index) const;
-
-  /// Returns Index associated to p (p must be the coordinates of a corner
-  /// point)
-  Index point_corner_index(const Point_3& p) const;
-
-private:
-  typedef std::map<Point_3,Corner_index> Corners;
-
-  typedef internal::Mesh_3::Polyline<Gt> Polyline;
-  typedef std::map<Curve_segment_index, Polyline> Edges;
-  typedef std::map<Curve_segment_index, Surface_patch_index_set > Edges_incidences;
-  typedef std::map<Corner_index, std::set<Curve_segment_index> > Corners_tmp_incidences;
-  typedef std::map<Corner_index, Surface_patch_index_set > Corners_incidences;
-
-  typedef internal::Mesh_3::Mesh_domain_segment_of_curve_primitive<
-    Gt,
-    typename Edges::const_iterator> Curves_primitives;
-
-  typedef CGAL::AABB_traits<Gt,
-                            Curves_primitives> AABB_curves_traits;
-
-  Corners corners_;
-  Corners_tmp_incidences corners_tmp_incidences_;
-  Corner_index current_corner_index_;
-  Corners_incidences corners_incidences_;
-
-  Edges edges_;
-  Curve_segment_index current_curve_index_;
-  Edges_incidences edges_incidences_;
-
-public:
-  typedef CGAL::AABB_tree<AABB_curves_traits> Curves_AABB_tree;
-
-private:
-  mutable Curves_AABB_tree curves_aabb_tree_;
-  mutable bool curves_aabb_tree_is_built;
-
-public:
-  const Curves_AABB_tree& curves_aabb_tree() const {
-    if(!curves_aabb_tree_is_built) build_curves_aabb_tree();
-    return curves_aabb_tree_;
-  }
-
-  void build_curves_aabb_tree() const {
-    std::cerr << "Building curves AABB tree...\n";
-    curves_aabb_tree_.clear();
-    for(typename Edges::const_iterator
-          edges_it = edges_.begin(),
-          edges_end = edges_.end();
-        edges_it != edges_end; ++edges_it)
-    {
-      const Polyline& polyline = edges_it->second;
-      for(typename Polyline::const_iterator
-            pit = polyline.points_.begin(),
-            end = polyline.points_.end() - 1;
-          pit != end; ++pit)
-      {
-        curves_aabb_tree_.insert(std::make_pair(edges_it, pit));
-      }
-    }
-    curves_aabb_tree_.build();
-    curves_aabb_tree_is_built = true;
-  } // end build_curves_aabb_tree()
-
-private:
-  // Disabled copy constructor & assignment operator
-  typedef Mesh_domain_with_polyline_features_3 Self;
-  Mesh_domain_with_polyline_features_3(const Self& src);
-  Self& operator=(const Self& src);
-
-};  // end class Mesh_domain_with_polyline_features_3
-
-
-
-template <class MD_>
-template <typename OutputIterator>
-OutputIterator
-Mesh_domain_with_polyline_features_3<MD_>::
-get_corners(OutputIterator out) const
-{
-  for ( typename Corners::const_iterator
-       cit = corners_.begin(), end = corners_.end() ; cit != end ; ++cit )
-  {
-    *out++ = std::make_pair(cit->second,cit->first);
-  }
-
-  return out;
-}
-
-template <class MD_>
-template <typename OutputIterator>
-OutputIterator
-Mesh_domain_with_polyline_features_3<MD_>::
-get_curve_segments(OutputIterator out) const
-{
-  for ( typename Edges::const_iterator
-       eit = edges_.begin(), end = edges_.end() ; eit != end ; ++eit )
-  {
-    CGAL_assertion( eit->second.is_valid() );
-
-    const Point_3& p = eit->second.start_point();
-    const Point_3& q = eit->second.end_point();
-
-    Index p_index, q_index;
-    if ( ! eit->second.is_cycle() )
-    {
-      p_index = point_corner_index(p);
-      q_index = point_corner_index(q);
-    }
-    else
-    {
-      p_index = index_from_curve_segment_index(eit->first);
-      q_index = p_index;
-    }
-
-    *out++ = CGAL::cpp11::make_tuple(eit->first,
-                                     std::make_pair(p,p_index),
-                                     std::make_pair(q,q_index));
-  }
-
-  return out;
-}
-
-
-template <class MD_>
-typename Mesh_domain_with_polyline_features_3<MD_>::Index
-Mesh_domain_with_polyline_features_3<MD_>::
-point_corner_index(const Point_3& p) const
-{
-  typename Corners::const_iterator p_index_it = corners_.find(p);
-  if ( p_index_it == corners_.end() )
-  {
-    CGAL_assertion(false);
-    return Index();
-  }
-
-  return p_index_it->second;
-}
-
-
-template <class MD_>
-typename Mesh_domain_with_polyline_features_3<MD_>::FT
-Mesh_domain_with_polyline_features_3<MD_>::
-geodesic_distance(const Point_3& p, const Point_3& q,
-                  const Curve_segment_index& curve_index) const
-{
-  // Get corresponding polyline
-  typename Edges::const_iterator eit = edges_.find(curve_index);
-  CGAL_assertion(eit != edges_.end());
-
-  // Compute geodesic_distance
-  return eit->second.geodesic_distance(p,q);
-}
-
-
-template <class MD_>
-typename Mesh_domain_with_polyline_features_3<MD_>::Point_3
-Mesh_domain_with_polyline_features_3<MD_>::
-construct_point_on_curve_segment(const Point_3& starting_point,
-                                 const Curve_segment_index& curve_index,
-                                 FT distance) const
-{
-  // Get corresponding polyline
-  typename Edges::const_iterator eit = edges_.find(curve_index);
-  CGAL_assertion(eit != edges_.end());
-
-  // Return point at geodesic_distance distance from starting_point
-  return eit->second.point_at(starting_point,distance);
-}
-
-
-
-template <class MD_>
-template <typename InputIterator, typename IndicesOutputIterator>
-IndicesOutputIterator
-Mesh_domain_with_polyline_features_3<MD_>::
-add_features(InputIterator first, InputIterator last,
-             IndicesOutputIterator indices_out)
-{
-  // Insert one edge for each element
-  while ( first != last )
-  {
-    *indices_out++ = insert_edge(first->begin(), first->end());
-    ++first;
-  }
-  compute_corners_incidences();
-  return indices_out;
-}
-
-template <class MD_>
-template <typename InputIterator, typename IndicesOutputIterator>
-IndicesOutputIterator
-Mesh_domain_with_polyline_features_3<MD_>::
-add_features_with_context(InputIterator first, InputIterator last,
-                          IndicesOutputIterator indices_out)
-{
-  // Insert one edge for each element
-  for( ; first != last ; ++first )
-  {
-    Curve_segment_index curve_id =
-      insert_edge(first->polyline_content.begin(), first->polyline_content.end());
-    edges_incidences_[curve_id] = first->context.adjacent_patches_ids;
-    *indices_out++ = curve_id;
-  }
-  compute_corners_incidences();
-  return indices_out;
-}
-
-template <class MD_>
-template <typename IndicesOutputIterator>
-IndicesOutputIterator
-Mesh_domain_with_polyline_features_3<MD_>::
-get_incidences(Curve_segment_index id,
-               IndicesOutputIterator indices_out) const
-{
-  typename Edges_incidences::const_iterator it = edges_incidences_.find(id);
-
-  if(it == edges_incidences_.end()) return indices_out;
-
-  const Surface_patch_index_set& incidences = it->second;
-
-  return std::copy(incidences.begin(), incidences.end(), indices_out);
-}
-
-template <class MD_>
-template <typename IndicesOutputIterator>
-IndicesOutputIterator
-Mesh_domain_with_polyline_features_3<MD_>::
-get_corner_incidences(Corner_index id,
-                      IndicesOutputIterator indices_out) const
-{
-  typename Corners_incidences::const_iterator it = corners_incidences_.find(id);
-  const Surface_patch_index_set& incidences = it->second;
-  return std::copy(incidences.begin(), incidences.end(), indices_out);
-}
-
-namespace internal { namespace Mesh_3 {
-
-template <typename MDwPF_, bool curve_id_is_streamable>
-// here 'curve_id_is_streamable' is true
-template <typename Container2>
-void
-Display_incidences_to_curves_aux<MDwPF_,curve_id_is_streamable>::
-operator()(std::ostream& os, typename MDwPF_::Curve_segment_index id,
-           const Container2& corners_tmp_incidences_of_id) const
-{
-  os << "Corner #" << id << " is incident to the following curves: {";
-  BOOST_FOREACH(typename MDwPF_::Curve_segment_index curve_index,
-                corners_tmp_incidences_of_id)
-  {
-    os << " " << curve_index;
-  }
-  os << " }\n";
-}
-
-template <class MDwPF_>
-// here 'curve_id_is_streamable' is false
-template <typename Container2>
-void
-Display_incidences_to_curves_aux<MDwPF_,false>::
-operator()(std::ostream& os, typename MDwPF_::Curve_segment_index id,
-           const Container2& corners_tmp_incidences_of_id) const
-{
-  os << "Corner #" << id << " is incident to "
-     << corners_tmp_incidences_of_id .size()
-     << " curve(s).\n";
-}
-
-template <typename MDwPF_, bool patch_id_is_streamable>
-// here 'patch_id_is_streamable' is true
-template <typename Container>
-void
-Display_incidences_to_patches_aux<MDwPF_,patch_id_is_streamable>::
-operator()(std::ostream& os, typename MDwPF_::Curve_segment_index id,
-           const Container& corners_incidences_of_id) const
-{
-  os << "Corner #" << id << " is incident to the following patches: {";
-  BOOST_FOREACH(typename MDwPF_::Surface_patch_index i,
-                corners_incidences_of_id)
-  {
-    os << " " << i;
-  }
-  os << " }\n";
-}
-
-template <class MDwPF_>
-// here 'patch_id_is_streamable' is false
-template <typename Container>
-void
-Display_incidences_to_patches_aux<MDwPF_,false>::
-operator()(std::ostream& os, typename MDwPF_::Curve_segment_index id,
-           const Container& corners_incidences_id) const
-{
-  os << "Corner #" << id << " is incident to "
-     << corners_incidences_id.size()
-     << " surface patch(es).\n";
-}
-
-}} // end namespaces internal::Mesh_3:: and internal::
-
-template <class MD_>
-void
-Mesh_domain_with_polyline_features_3<MD_>::
-display_corner_incidences(std::ostream& os, Corner_index id)
-{
-  typedef Mesh_domain_with_polyline_features_3<MD_> Mdwpf;
-  typedef is_streamable<Surface_patch_index> i_s_spi;
-  typedef is_streamable<Curve_segment_index> i_s_csi;
-
-  using namespace internal::Mesh_3;
-  typedef Display_incidences_to_curves_aux<Mdwpf,i_s_csi::value> D_i_t_c;
-  typedef Display_incidences_to_patches_aux<Mdwpf,i_s_spi::value> D_i_t_p;
-  D_i_t_c()(os, id, corners_tmp_incidences_[id]);
-  D_i_t_p()(os, id, corners_incidences_[id]);
-}
-
-template <class MD_>
-void
-Mesh_domain_with_polyline_features_3<MD_>::
-compute_corners_incidences()
-{
-  for(typename Corners::iterator
-        cit = corners_.begin(), end = corners_.end();
-      cit != end; /* the loop variable is incremented in the  body */)
-  {
-    const Corner_index id = cit->second;
-
-    const typename Corners_tmp_incidences::mapped_type&
-      corner_tmp_incidences = corners_tmp_incidences_[id];
-
-    // If the corner is incident to only one curve, and that curve is a
-    // cycle, then remove the corner from the set.
-    if(corner_tmp_incidences.size() == 1 &&
-       is_cycle(Point_3(), *corner_tmp_incidences.begin()))
-    {
-      typename Corners::iterator to_erase = cit;
-      ++cit;
-      corners_.erase(to_erase);
-      continue;
-    }
-
-    Surface_patch_index_set& incidences = corners_incidences_[id];
-    // That should be an empty set.
-
-    BOOST_FOREACH(Curve_segment_index curve_index, corner_tmp_incidences)
-    {
-      get_incidences(curve_index,
-                     std::inserter(incidences,
-                                   incidences.begin()));
-    }
-#ifdef CGAL_MESH_3_PROTECTION_DEBUG
-    display_corner_incidences(std::cerr, id);
-#endif // CGAL_MESH_3_PROTECTION_DEBUG
-
-    // increment the loop variable
-    ++cit;
-  }
-}
-
-template <class MD_>
-const typename Mesh_domain_with_polyline_features_3<MD_>::Surface_patch_index_set&
-Mesh_domain_with_polyline_features_3<MD_>::
-get_incidences(Curve_segment_index id) const
-{
-  typename Edges_incidences::const_iterator it = edges_incidences_.find(id);
-  return it->second;
-}
-
-template <class MD_>
-void
-Mesh_domain_with_polyline_features_3<MD_>::
-register_corner(const Point_3& p, const Curve_segment_index& curve_index)
-{
-
-  typename Corners::iterator cit = corners_.lower_bound(p);
-
-  // If the corner already exists, returns...
-  if(cit != corners_.end() && !(corners_.key_comp()(p, cit->first))) {
-    corners_tmp_incidences_[cit->second].insert(curve_index);
-    return;
-  }
-
-  // ...else insert it!
-
-  const Corner_index index = current_corner_index_;
-  ++current_corner_index_;
-
-  corners_.insert(cit, std::make_pair(p, index));
-  corners_tmp_incidences_[index].insert(curve_index);
-}
-
-template <class MD_>
-template <typename InputIterator>
-typename Mesh_domain_with_polyline_features_3<MD_>::Curve_segment_index
-Mesh_domain_with_polyline_features_3<MD_>::
-insert_edge(InputIterator first, InputIterator last)
-{
-  CGAL_assertion(std::distance(first,last) > 1);
-
-  const Curve_segment_index curve_index = current_curve_index_++;
-
-  // Fill corners
-  //
-  // For a cycle, the "first" point of the cycle is registered as a
-  // corner. If at the end, during the call to
-  // 'compute_corners_incidences()', that corner is incident only to a
-  // cycle, then it will be removed from the set of corners.
-  register_corner(*first, curve_index);
-  if ( *first != *boost::prior(last) )
-  {
-    register_corner(*boost::prior(last), curve_index);
-  }
-
-  // Create a new polyline
-  std::pair<typename Edges::iterator,bool> insertion =
-    edges_.insert(std::make_pair(curve_index,Polyline()));
-
-  // Fill polyline with data
-  while ( first != last )
-  {
-    insertion.first->second.add_point(*first++);
-  }
-  return curve_index;
-}
-
-
-template <class MD_>
-CGAL::Sign
-Mesh_domain_with_polyline_features_3<MD_>::
-distance_sign(const Point_3& p, const Point_3& q,
-              const Curve_segment_index& index) const
-{
-  typename Edges::const_iterator eit = edges_.find(index);
-  CGAL_assertion(eit != edges_.end());
-  CGAL_precondition( ! eit->second.is_cycle() );
-
-  if ( p == q )
-    return CGAL::ZERO;
-  else if ( eit->second.are_ordered_along(p,q) )
-    return CGAL::POSITIVE;
-  else
-    return CGAL::NEGATIVE;
-}
-
-template <class MD_>
-CGAL::Sign
-Mesh_domain_with_polyline_features_3<MD_>::
-distance_sign_along_cycle(const Point_3& p,
-                          const Point_3& q,
-                          const Point_3& r,
-                          const Curve_segment_index& index) const
-{
-  // Find edge
-  typename Edges::const_iterator eit = edges_.find(index);
-  CGAL_assertion(eit != edges_.end());
-
-  // If eit is not a cycle, then the orientation corresponds to the sign
-  // of the distance
-  if ( ! eit->second.is_cycle() )
-  {
-    return distance_sign(p,r,index);
-  }
-
-  // If p and r are the same point, it correspond to a complete loop on a cycle
-  if ( p == r ) { return CGAL::POSITIVE; }
-
-  // We are on a cycle without any clue (p==q). Return the shortest path as
-  // orientation.
-  if ( p == q )
-  {
-    FT pr = eit->second.geodesic_distance(p,r);
-    FT rp = eit->second.geodesic_distance(r,p);
-    if ( pr < rp ) { return CGAL::POSITIVE; }
-    else { return CGAL::NEGATIVE; }
-  }
-
-  // If pq or pr is negative, edge is not a cycle, thus geodesic_distance
-  // gives the answer.
-  FT pq = eit->second.geodesic_distance(p,q);
-  FT pr = eit->second.geodesic_distance(p,r);
-  CGAL_assertion(pq > FT(0));
-  CGAL_assertion(pr > FT(0));
-
-  // Compare pq and pr
-  if ( pq <= pr ) { return CGAL::POSITIVE; }
-  else { return CGAL::NEGATIVE; }
-}
-
-template <class MD_>
-bool
-Mesh_domain_with_polyline_features_3<MD_>::
-is_cycle(const Point_3&, const Curve_segment_index& index) const
-{
-  // Find edge
-  typename Edges::const_iterator eit = edges_.find(index);
-  CGAL_assertion(eit != edges_.end());
-
-  return eit->second.is_cycle();
-}
-
-
-} //namespace CGAL
-
-
-#endif // CGAL_MESH_DOMAIN_WITH_POLYLINE_FEATURES_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_facet_criteria_3.h b/3rdparty/CGAL-4.8/include/CGAL/Mesh_facet_criteria_3.h
deleted file mode 100644
index 7f8d211..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Mesh_facet_criteria_3.h
+++ /dev/null
@@ -1,182 +0,0 @@
-// Copyright (c) 2009 INRIA Sophia-Antipolis (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
-// 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(s)     : Stéphane Tayeb
-//
-//******************************************************************************
-// File Description :
-// Mesh_facet_criteria_3 class.
-//******************************************************************************
-
-#ifndef CGAL_MESH_FACET_CRITERIA_3_H
-#define CGAL_MESH_FACET_CRITERIA_3_H
-
-#include <CGAL/Mesh_3/mesh_standard_facet_criteria.h>
-#include <CGAL/Mesh_facet_topology.h>
-
-namespace CGAL {
-  
-template<typename Tr,
-         typename Visitor_ = Mesh_3::Facet_criterion_visitor_with_features<Tr> >
-class Mesh_facet_criteria_3
-{
-public:
-  typedef Visitor_ Visitor;
-  typedef typename Visitor::Facet_quality Facet_quality;
-  typedef typename Visitor::Facet_badness Facet_badness;
-  
-private:
-  typedef Mesh_3::Criteria<Tr,Visitor> Criteria;
-  typedef Mesh_3::Abstract_criterion<Tr,Visitor> Abstract_criterion;
-
-  typedef typename Tr::Facet Facet;
-  typedef typename Tr::Geom_traits::FT FT;
-
-  typedef Mesh_facet_criteria_3<Tr> Self;
-
-public:
-  typedef CGAL::Tag_true Has_manifold_criterion;
-
-  /**
-   * @brief Constructor
-   */
-  Mesh_facet_criteria_3(const FT& angle_bound,
-                        const FT& radius_bound,
-                        const FT& distance_bound,
-                        const Mesh_facet_topology topology =
-                          FACET_VERTICES_ON_SURFACE)
-  {
-    if ( FT(0) != angle_bound )
-      init_aspect(angle_bound);
-    
-    if ( FT(0) != radius_bound )
-      init_radius(radius_bound);
-    
-    if ( FT(0) != distance_bound )
-      init_distance(distance_bound);
-    
-    init_topo(topology);
-  }
-
-  // Nb: SFINAE (dummy) to avoid wrong matches with built-in numerical types
-  // as int.
-  template < typename Sizing_field >
-  Mesh_facet_criteria_3(const FT& angle_bound,
-                        const Sizing_field& radius_bound,
-                        const FT& distance_bound,
-                        const Mesh_facet_topology topology = 
-                          FACET_VERTICES_ON_SURFACE,
-                        typename Sizing_field::FT /*dummy*/ = 0)
-  {
-    if ( FT(0) != angle_bound )
-      init_aspect(angle_bound);
-    
-    init_radius(radius_bound);
-    
-    if ( FT(0) != distance_bound )
-      init_distance(distance_bound);
-    
-    init_topo(topology);  
-  }
-  
-  /// Destructor
-  ~Mesh_facet_criteria_3() { }
-
-   /**
-   * @brief returns the badness of facet \c facet
-   * @param facet the facet
-   * @return the badness of \c facet
-   */
-  Facet_badness operator()(const Facet& facet) const
-  {
-    return criteria_(facet);
-  }
-  
-  void add(Abstract_criterion* criterion)
-  {
-    criteria_.add(criterion);
-  }
-
-  Mesh_facet_topology topology() const {
-    return topology_;
-  }
-
-private:
-  void init_aspect(const FT& angle_bound)
-  {
-    typedef Mesh_3::Aspect_ratio_criterion<Tr,Visitor> Aspect_criterion;
-    criteria_.add(new Aspect_criterion(angle_bound));
-  }
-  
-  void init_radius(const FT& radius_bound)
-  {
-    typedef Mesh_3::Uniform_size_criterion<Tr,Visitor> Uniform_size_criterion;
-    criteria_.add(new Uniform_size_criterion(radius_bound));
-  }
-  
-  template <typename Sizing_field>
-  void init_radius(const Sizing_field& radius_bound)
-  {
-    typedef Mesh_3::Variable_size_criterion<Tr,Visitor,Sizing_field> Variable_size_criterion;
-    criteria_.add(new Variable_size_criterion(radius_bound));
-  }
-  
-  void init_distance(const FT& distance_bound)
-  {
-    typedef Mesh_3::Curvature_size_criterion<Tr,Visitor> Curvature_criterion;
-    criteria_.add(new Curvature_criterion(distance_bound));
-  }
-  
-  void init_topo(const Mesh_facet_topology topology)
-  {
-    topology_ = topology;
-    switch ( topology % MANIFOLD )
-    {
-      case FACET_VERTICES_ON_SURFACE:
-      {
-        typedef Mesh_3::Facet_on_surface_criterion<Tr,Visitor> On_surface_criterion;
-        criteria_.add(new On_surface_criterion());
-        break;
-      }
-        
-      case FACET_VERTICES_ON_SAME_SURFACE_PATCH:
-      {
-        typedef Mesh_3::Facet_on_same_surface_criterion<Tr,Visitor> Same_surface_criterion;
-        criteria_.add(new Same_surface_criterion());
-        break;
-      }
-      
-      case FACET_VERTICES_ON_SAME_SURFACE_PATCH_WITH_ADJACENCY_CHECK:
-      {
-        // @TODO: Implement adjacency check !
-        typedef Mesh_3::Facet_on_same_surface_criterion<Tr,Visitor> Same_surface_criterion;
-        criteria_.add(new Same_surface_criterion());
-        break;
-      }
-    }
-  }
-  
-private:
-  Criteria criteria_;
-  Mesh_facet_topology topology_;
-};  // end class Mesh_facet_criteria_3
-
-}  // end namespace CGAL
-
-
-#endif // CGAL_MESH_FACET_CRITERIA_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_triangulation_3.h b/3rdparty/CGAL-4.8/include/CGAL/Mesh_triangulation_3.h
deleted file mode 100644
index 6aacc04..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Mesh_triangulation_3.h
+++ /dev/null
@@ -1,117 +0,0 @@
-// Copyright (c) 2006-2009 INRIA Sophia-Antipolis (France).
-// Copyright (c) 2011      GeometryFactory Sarl (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
-// 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(s)     : Laurent Rineau, Stephane Tayeb
-
-
-#ifndef CGAL_MESH_TRIANGULATION_3_H
-#define CGAL_MESH_TRIANGULATION_3_H
-
-#include <CGAL/Mesh_3/config.h>
-
-#include <CGAL/Kernel_traits.h>
-
-#include <CGAL/Regular_triangulation_3.h>
-#include <CGAL/Regular_triangulation_euclidean_traits_3.h>
-#include <CGAL/Mesh_3/Robust_weighted_circumcenter_filtered_traits_3.h>
-
-#include <CGAL/Mesh_vertex_base_3.h>
-#include <CGAL/Compact_mesh_cell_base_3.h>
-
-namespace CGAL {
-  
-  namespace details {
-    
-    template<typename K>
-    struct Mesh_geom_traits_generator
-    {
-    private:
-      typedef Robust_weighted_circumcenter_filtered_traits_3<K>
-        Geom_traits;
-      
-    public:
-      typedef Geom_traits type;
-      typedef type Type;
-    };  // end struct Mesh_geom_traits_generator
-    
-  }  // end namespace details
-  
-  
-// Struct Mesh_triangulation_3
-//
-template<class MD,
-         class K=typename Kernel_traits<MD>::Kernel,
-         class Concurrency_tag = Sequential_tag,
-         class Vertex_base_ = Default,
-         class Cell_base_   = Default>
-struct Mesh_triangulation_3;
-
-// Sequential version (default)
-template<class MD, class K, class Concurrency_tag,
-         class Vertex_base_, class Cell_base_>
-struct Mesh_triangulation_3
-{
-private:
-  typedef typename details::Mesh_geom_traits_generator<K>::type Geom_traits;
-
-  typedef typename Default::Get<
-    Vertex_base_, 
-    Mesh_vertex_base_3<Geom_traits, MD> >::type                 Vertex_base;
-  typedef typename Default::Get<
-    Cell_base_, 
-    Compact_mesh_cell_base_3<Geom_traits, MD> >::type           Cell_base;
-
-  typedef Triangulation_data_structure_3<Vertex_base,Cell_base> Tds;
-  typedef Regular_triangulation_3<Geom_traits, Tds>             Triangulation;
-
-public:
-  typedef Triangulation type;
-  typedef type Type;
-};  // end struct Mesh_triangulation_3
-
-#ifdef CGAL_LINKED_WITH_TBB
-// Parallel version (specialization)
-//
-template<class MD, class K,
-         class Vertex_base_, class Cell_base_>
-struct Mesh_triangulation_3<MD, K, Parallel_tag, Vertex_base_, Cell_base_>
-{
-private:
-  typedef typename details::Mesh_geom_traits_generator<K>::type Geom_traits;
-
-  typedef typename Default::Get<
-    Vertex_base_, 
-    Mesh_vertex_base_3<Geom_traits, MD> >::type                 Vertex_base;
-  typedef typename Default::Get<
-    Cell_base_, 
-    Compact_mesh_cell_base_3<Geom_traits, MD> >::type           Cell_base;
-
-  typedef Triangulation_data_structure_3<
-    Vertex_base, Cell_base, Parallel_tag>                       Tds;
-  typedef Regular_triangulation_3<Geom_traits, Tds>             Triangulation;
-
-public:
-  typedef Triangulation type;
-  typedef type Type;
-};  // end struct Mesh_triangulation_3
-#endif // CGAL_LINKED_WITH_TBB
-
-}  // end namespace CGAL
-
-#endif // CGAL_MESH_TRIANGULATION_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_vertex_base_3.h b/3rdparty/CGAL-4.8/include/CGAL/Mesh_vertex_base_3.h
deleted file mode 100644
index 4eb8f66..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Mesh_vertex_base_3.h
+++ /dev/null
@@ -1,310 +0,0 @@
-// Copyright (c) 2009 INRIA Sophia-Antipolis (France).
-// Copyright (c) 2011 GeometryFactory Sarl (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
-// 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: https://scm.gforge.inria.fr/svn/cgal/branches/features/Mesh_3-experimental-GF/Mesh_3/include/CGAL/Mesh_vertex_base_3.h $
-// $Id: Mesh_vertex_base_3.h 69674 2012-06-18 09:34:06Z jtournoi $
-//
-//
-// Author(s)     : Stéphane Tayeb, Andreas Fabri
-//
-//******************************************************************************
-// File Description :
-//
-//
-//******************************************************************************
-
-
-#ifndef CGAL_COMPACT_MESH_VERTEX_BASE_3_H
-#define CGAL_COMPACT_MESH_VERTEX_BASE_3_H
-
-#include <CGAL/Triangulation_vertex_base_3.h>
-#include <CGAL/internal/Mesh_3/get_index.h>
-#include <CGAL/Mesh_3/io_signature.h>
-#include <CGAL/Has_timestamp.h>
-#include <CGAL/tags.h>
-
-namespace CGAL {
-  
-// Without erase counter
-template <typename Concurrency_tag>
-class Mesh_vertex_base_3_base
-{
-#if defined(CGAL_MESH_3_USE_LAZY_SORTED_REFINEMENT_QUEUE) \
- || defined(CGAL_MESH_3_USE_LAZY_UNSORTED_REFINEMENT_QUEUE)
-
-public:
-  // Erase counter (cf. Compact_container)
-  unsigned int erase_counter() const
-  {
-    return this->m_erase_counter;
-  }
-  void set_erase_counter(unsigned int c)
-  {
-    this->m_erase_counter = c;
-  }
-  void increment_erase_counter()
-  {
-    ++this->m_erase_counter;
-  }
-  
-protected:
-  typedef unsigned int              Erase_counter_type;
-  Erase_counter_type                m_erase_counter;
-#endif
-};
-
-#ifdef CGAL_LINKED_WITH_TBB
-// Specialized version (parallel)
-template <>
-class Mesh_vertex_base_3_base<Parallel_tag>
-{
-public:
-  
-  // Erase counter (cf. Compact_container)
-  unsigned int erase_counter() const
-  {
-    return this->m_erase_counter;
-  }
-  void set_erase_counter(unsigned int c)
-  {
-    this->m_erase_counter = c;
-  }
-  void increment_erase_counter()
-  {
-    ++this->m_erase_counter;
-  }
-  
-protected:
-  typedef tbb::atomic<unsigned int> Erase_counter_type;
-  Erase_counter_type                m_erase_counter;
-
-};
-#endif // CGAL_LINKED_WITH_TBB
-
-// Class Mesh_vertex_base_3
-// Vertex base class used in 3D meshing process.
-// Adds information to Vb about the localization of the vertex in regards
-// to the 3D input complex.
-template<class GT,
-         class MD,
-         class Vb = Triangulation_vertex_base_3<GT> >
-class Mesh_vertex_base_3
-: public Vb,
-  public Mesh_vertex_base_3_base<
-    typename Vb::Triangulation_data_structure::Concurrency_tag>
-{
-public:
-  typedef Vb Cmvb3_base;
-  typedef typename Vb::Vertex_handle  Vertex_handle;
-
-  // To get correct vertex type in TDS
-  template < class TDS3 >
-  struct Rebind_TDS {
-    typedef typename Vb::template Rebind_TDS<TDS3>::Other Vb3;
-    typedef Mesh_vertex_base_3 <GT, MD, Vb3> Other;
-  };
-
-  // Types
-  typedef typename MD::Index                      Index;
-  typedef typename GT::FT                         FT;
-
-  // Constructor
-  Mesh_vertex_base_3()
-    : Vb()
-    , number_of_incident_facets_(0)
-    , number_of_components_(0)
-    , index_()
-    , meshing_info_(0)
-    , dimension_(-1)
-    , cache_validity(false)
-#ifdef CGAL_INTRUSIVE_LIST
-    , next_intrusive_()
-    , previous_intrusive_()
-#endif //CGAL_INTRUSIVE_LIST
-    , time_stamp_(-1)
-  {}
-
-  // Default copy constructor and assignment operator are ok
-
-  // Returns the dimension of the lowest dimensional face of the input 3D
-  // complex that contains the vertex
-  int in_dimension() const {
-    if(dimension_ < -1) return -2-dimension_;
-    else return dimension_; 
-  }
-
-  // Sets the dimension of the lowest dimensional face of the input 3D complex
-  // that contains the vertex
-  void set_dimension(const int dimension) { dimension_ = dimension; }
-
-  // Tells if the vertex is marked as a special protecting ball
-  bool is_special() const { return dimension_ < -1; }
-
-  // Marks or unmarks the vertex as a special protecting ball
-  void set_special(bool special = true) {
-    if(special != (dimension_ < -1) )
-      dimension_ = -2-dimension_;
-  }
-
-  // Returns the index of the lowest dimensional face of the input 3D complex
-  // that contains the vertex
-  Index index() const { return index_; }
-
-  // Sets the index of the lowest dimensional face of the input 3D complex
-  // that contains the vertex
-  void set_index(const Index& index) { index_ = index; }
-
-  // Accessors to meshing_info private data
-  const FT& meshing_info() const { return meshing_info_; }
-  void set_meshing_info(const FT& value) { meshing_info_ = value; }
-
-#ifdef CGAL_INTRUSIVE_LIST
-  Vertex_handle next_intrusive() const { return next_intrusive_; }
-  void set_next_intrusive(Vertex_handle v)
-  { 
-    next_intrusive_ = v;
-  }
-
-  Vertex_handle previous_intrusive() const { return previous_intrusive_; }
-  void set_previous_intrusive(Vertex_handle v)
-  {
-    previous_intrusive_ = v; 
-  }
-#endif
-
-  /// For the determinism of Compact_container iterators
-  ///@{
-  typedef Tag_true Has_timestamp;
-
-  std::size_t time_stamp() const {
-    return time_stamp_;
-  }
-  void set_time_stamp(const std::size_t& ts) {
-    time_stamp_ = ts;
-  }
-  ///@}
-
-  bool is_c2t3_cache_valid() const {
-    return cache_validity;
-  }
-
-  void invalidate_c2t3_cache()
-  {
-    cache_validity = false;
-  }
-
-  void set_c2t3_cache(const std::size_t i, const std::size_t j)
-  {
-    number_of_incident_facets_ = i;
-    number_of_components_ = j;
-    cache_validity = true;
-  }
-
-  std::size_t cached_number_of_incident_facets() const
-  {
-    return number_of_incident_facets_;
-  }
-    
-  std::size_t cached_number_of_components() const
-  {
-    return number_of_components_;
-  }
-
-  static
-  std::string io_signature()
-  {
-    return 
-      Get_io_signature<Vb>()() + "+" +
-      Get_io_signature<int>()() + "+" +
-      Get_io_signature<Index>()();
-  }
-private:
-
-  std::size_t number_of_incident_facets_;
-  std::size_t number_of_components_; // number of components in the adjacency
-  // graph of incident facets (in complex)
-
-
-  // Index of the lowest dimensional face of the input 3D complex
-  // that contains me
-  Index index_;
-  // Stores info needed by optimizers
-  FT meshing_info_;
-
-  // Dimension of the lowest dimensional face of the input 3D complex
-  // that contains me. Negative values are a marker for special vertices.
-  short dimension_;
-  bool cache_validity;
-#ifdef CGAL_INTRUSIVE_LIST
-  Vertex_handle next_intrusive_;
-  Vertex_handle previous_intrusive_;
-#endif
-  std::size_t time_stamp_;
-
-};  // end class Mesh_vertex_base_3
-
-template<class GT,
-         class MD,
-         class Vb>
-inline
-std::istream&
-operator>>(std::istream &is, Mesh_vertex_base_3<GT,MD,Vb>& v)
-{
-  typedef Mesh_vertex_base_3<GT,MD,Vb> Vertex;
-  typedef typename Vertex::Cmvb3_base Cmvb3_base;
-  is >> static_cast<Cmvb3_base&>(v);
-  int dimension;
-  if(is_ascii(is)) {
-    is >> dimension;
-
-  } else {
-    CGAL::read(is, dimension);
-  }
-  v.set_dimension(dimension);
-  CGAL_assertion(v.in_dimension() >= -1);
-  CGAL_assertion(v.in_dimension() < 4);
-  typename Vertex::Index index =
-    internal::Mesh_3::Read_mesh_domain_index<MD>()(v.in_dimension(), is);
-  v.set_index(index);
-  return is;
-}
-
-template<class GT,
-         class MD,
-         class Vb>
-inline
-std::ostream&
-operator<<(std::ostream &os, const Mesh_vertex_base_3<GT,MD,Vb>& v)
-{
-  typedef Mesh_vertex_base_3<GT,MD,Vb> Vertex;
-  typedef typename Vertex::Cmvb3_base Cmvb3_base;
-  os << static_cast<const Cmvb3_base&>(v);
-  if(is_ascii(os)) {
-    os << " " << v.in_dimension()
-       << " ";
-  } else {
-    CGAL::write(os, v.in_dimension());
-  }
-  internal::Mesh_3::Write_mesh_domain_index<MD>()(os, 
-                                                  v.in_dimension(),
-                                                  v.index());
-  return os;
-}
-
-}  // end namespace CGAL
-
-
-
-#endif // CGAL_COMPACT_MESH_VERTEX_BASE_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Min_annulus_d.h b/3rdparty/CGAL-4.8/include/CGAL/Min_annulus_d.h
deleted file mode 100644
index 79d1240..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Min_annulus_d.h
+++ /dev/null
@@ -1,874 +0,0 @@
-// Copyright (c) 1997-2001  ETH Zurich (Switzerland).
-// 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
-// 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(s)     : Sven Schoenherr <sven at inf.ethz.ch>
-
-#ifndef CGAL_MIN_ANNULUS_D_H
-#define CGAL_MIN_ANNULUS_D_H
-
-// includes
-// --------
-#include <CGAL/Optimisation/basic.h>
-#include <CGAL/function_objects.h>
-#include <CGAL/QP_options.h>
-#include <CGAL/QP_solver/QP_solver.h>
-#include <CGAL/QP_solver/functors.h>
-#include <CGAL/QP_solver/QP_full_filtered_pricing.h>
-#include <CGAL/QP_solver/QP_full_exact_pricing.h>
-#include <CGAL/boost/iterator/counting_iterator.hpp>
-#include <boost/iterator/transform_iterator.hpp>
-#include <boost/functional.hpp>
-
-// here is how it works. We have d+2 variables: 
-// R (big radius), r (small radius), c (center). The problem is
-//
-// min R^2 - r^2 
-// s.t. ||p - c||^2 >= r^2   for all p
-//      ||p - c||^2 <= R^2   for all p
-//
-// This looks nonlinear, but we can in fact make the substitutions
-// u = R^2 - c^Tc, v = r^2 - c^Tc and get the following equivalent
-// linear program:
-//
-// min u - v
-// s.t. p^Tp - 2p^Tc >= v  for all p
-//      p^Tp - 2p^Tc <= u  for all p
-// 
-// or 
-//
-// max  v - u
-// s.t. v     + 2p_1c_1 + 2p_2c_2 + ...  + 2p_dc_d <=  p^Tp for all p
-//        - u - 2p_1c_1 - 2p_2c_2 - ...  - 2p_dc_d <= -p^Tp for all p
-//
-// When we introduce a dual variable x_p for every constraint in the first
-// set and a dual variable y_p for every constraint in the second set,
-// we obtain the following dual program:
-//
-// min \sum_p x_p p^Tp -  \sum_p y_p p^Tp
-// s.t.
-//    2\sum_p x_p p    - 2\sum_p y_p p     =  0
-//     \sum_p x_p                          =  1  (constraint for v)
-//                     -  \sum_p y_p       = -1  (constraint for u)
-//                                               x_p >= 0  for all p        
-//                                               y_p >= 0  for all p 
-//
-// in the following functors, the ordering of the constraints is as above; 
-// the indices of the variables are: x_p_j <-> 2 * j, y_p_j <-> 2 * j + 1 
-// we also make the substitutions x'_p = x_p / h_p^2, y'_p = y_p / h_p^2
-// where h_p is the homogenizing coordinate of p, in order to allow
-// homogeneous points. This, however, means that the computed annulus is
-// not necessarily correct. If P is a set of homogeneous points, 
-//     P = { (p_0,...,p_{d-1}, h_p) }, 
-// then we always get a *feasible* annulus for the point set 
-//     P' = { (p_0*h_p,...,p_{d-1}*h_p, h_p*h_p) }. 
-// If the type NT is inexact, this annulus might not even be optimal, since
-// the objective function involves terms p^Tp that might not be exactly
-// computed -> document all this!!!
-
-namespace CGAL {
-
-namespace MA_detail {
-
-  // functor for a fixed column of A
-  template <class NT, class Iterator>
-  class A_column : public std::unary_function <int, NT>
-  {
-  public:
-    typedef NT result_type;
-    A_column()
-    {}
-  
-    A_column (int j, int d, Iterator it)
-      : j_ (j), d_ (d), it_ (it), h_p (*(it+d)), nt_0_ (0), nt_2_ (2)
-    {}
-
-    result_type operator() (int i) const
-    {
-      if (j_ % 2 == 0) {
-	// column for x_p
-	if (i < d_) return  *(it_ + i) * h_p * nt_2_;  
-	if (i == d_) return h_p * h_p;  
-	return nt_0_;
-      } else {
-	// column for y_p
-	if (i < d_) return  -(*(it_ + i)) * h_p * nt_2_;
-	if (i == d_+1) return -h_p * h_p;
-	return nt_0_;
-      }
-    }
-    
-  private:
-    int j_;                  // column number
-    int d_;                  // dimension
-    Iterator it_;            // the iterator through the column's point
-    NT h_p;                  // the homogenizing coordinate of p
-    NT nt_0_;
-    NT nt_2_; 
-  };
-  
-  // functor for matrix A
-  template <class NT, class Access_coordinate_begin_d,
-	    class Point_iterator >
-  class A_matrix : public std::unary_function
-  <int, boost::transform_iterator <A_column
-    <NT, typename Access_coordinate_begin_d::Coordinate_iterator>, 
-				   boost::counting_iterator<int> > >
-  { 
-    typedef typename MA_detail::A_column
-    <NT, typename Access_coordinate_begin_d::Coordinate_iterator> A_column;
-  public:
-    typedef boost::transform_iterator
-    <A_column, boost::counting_iterator<int> > result_type;
-    
-    A_matrix ()
-    {}
-
-    A_matrix (int d, 
-	      const Access_coordinate_begin_d& da_coord,
-	      Point_iterator P) 
-      : d_ (d), da_coord_ (da_coord), P_ (P)
-    {}
-
-    result_type operator () (int j) const
-    { 
-      return result_type
-	(0, A_column (j, d_, da_coord_ (*(P_+j/2)))); 
-    }
-
-  private:
-    int d_;                  // dimension
-    Access_coordinate_begin_d da_coord_; // data accessor
-    Point_iterator P_;       // point set P
-  };
-
-  // The functor necessary to realize access to b
-  template <class NT>
-  class B_vector : public std::unary_function<int, NT>
-  {
-  public:
-    typedef NT result_type;
-    B_vector()
-    {}
-
-    B_vector (int d)
-      : d_ (d), nt_0_ (0), nt_1_ (1)
-    {}
-
-    result_type operator() (int i) const
-    {
-      if (i == d_) return nt_1_;
-      if (i == d_+1) return -nt_1_;
-      return nt_0_;
-    }
-
-  private:
-    int d_;
-    NT nt_0_;
-    NT nt_1_;
-  };
-
-}
-
-// Class interfaces
-// ================
-template < class Traits_ >
-class Min_annulus_d {
-public:
-  // self
-  typedef  Traits_                    Traits;
-  typedef  Min_annulus_d<Traits>      Self;
-
-  // types from the traits class
-  typedef  typename Traits::Point_d   Point;
-
-  typedef  typename Traits::Rep_tag   Rep_tag;
-
-  typedef  typename Traits::RT        RT;
-  typedef  typename Traits::FT        FT;
-
-  typedef  typename Traits::Access_dimension_d
-  Access_dimension_d;
-  typedef  typename Traits::Access_coordinates_begin_d
-  Access_coordinates_begin_d;
-
-  typedef  typename Traits::Construct_point_d
-  Construct_point_d;
-
-  typedef  typename Traits::ET        ET;
-  typedef  typename Traits::NT        NT;
-
-  // public types 
-  typedef  std::vector<Point>         Point_vector;
-  typedef  typename Point_vector::const_iterator
-  Point_iterator;
-
-private:  
-  // QP solver iterator types
-  typedef MA_detail::A_matrix <NT, Access_coordinates_begin_d,
-			       Point_iterator> A_matrix;
-  typedef boost::transform_iterator
-  <A_matrix,  
-   boost::counting_iterator<int> >   A_iterator;
-
-  typedef MA_detail::B_vector <NT> B_vector;
-  typedef  boost::transform_iterator
-  <B_vector,
-    boost::counting_iterator<int> >  B_iterator;
-
-  typedef CGAL::Const_oneset_iterator<CGAL::Comparison_result> R_iterator;  
- 
-  typedef  std::vector<NT>                                     C_vector; 
-  typedef  typename C_vector::const_iterator                   C_iterator; 
-
-  // Program type
-  typedef CGAL::Nonnegative_linear_program_from_iterators
-  <A_iterator, B_iterator, R_iterator, C_iterator> LP;
-
-  // Tags
-  typedef QP_solver_impl::QP_tags <Tag_true, Tag_true> QP_tags;
-
-  // Solver types
-  typedef  CGAL::QP_solver <LP, ET, QP_tags > Solver;
-
-  typedef  typename Solver::Pricing_strategy Pricing_strategy;
-
-  // types from the QP solver
-  typedef  typename Solver::Basic_variable_index_iterator
-  Basic_variable_index_iterator;
-    
-  // private types
-  typedef  std::vector<ET>            ET_vector;
-    
-  typedef  QP_access_by_index
-  <typename std::vector<Point>::const_iterator, int> Point_by_index;
-    
-  typedef  boost::binder2nd< std::divides<int> >
-  Divide;
-    
-  typedef  std::vector<int>           Index_vector;
-    
-  typedef  std::vector<NT>            NT_vector;
-  typedef  std::vector<NT_vector>     NT_matrix;
-    
-
-public:
-  // public types
-    
-  typedef  CGAL::Join_input_iterator_1<
-    Basic_variable_index_iterator,
-    CGAL::Unary_compose_1<Point_by_index,Divide> >
-  Support_point_iterator;
-    
-    
-  typedef  typename Index_vector::const_iterator IVCI;
-  typedef  CGAL::Join_input_iterator_1<
-    IVCI, Point_by_index >
-  Inner_support_point_iterator;
-  typedef  CGAL::Join_input_iterator_1<
-    IVCI, Point_by_index >
-  Outer_support_point_iterator;
-
-  typedef IVCI Inner_support_point_index_iterator;
-  typedef IVCI Outer_support_point_index_iterator;
-    
-  typedef  typename ET_vector::const_iterator
-  Coordinate_iterator;
-    
-
-  // creation
-  Min_annulus_d( const Traits&  traits  = Traits())
-    : tco( traits), da_coord(tco.access_coordinates_begin_d_object()),
-      d( -1), solver(0){}
-    
-  template < class InputIterator >
-  Min_annulus_d( InputIterator  first,
-		 InputIterator  last,
-		 const Traits&  traits = Traits())
-    : tco( traits), da_coord(tco.access_coordinates_begin_d_object()), 
-      solver(0) {
-    set( first, last);
-  }
-
-  ~Min_annulus_d() {
-    if (solver)
-      delete solver;
-  }
-    
-  // access to point set
-  int  ambient_dimension( ) const { return d; }
-    
-  int  number_of_points( ) const { return static_cast<int>(points.size()); }
-    
-  Point_iterator  points_begin( ) const { return points.begin(); }
-  Point_iterator  points_end  ( ) const { return points.end  (); }
-    
-  // access to support points
-  int
-  number_of_support_points( ) const
-  { return number_of_points() < 2 ?
-      number_of_points() :
-    solver->number_of_basic_variables(); }
-    
-  Support_point_iterator
-  support_points_begin() const {
-    CGAL_optimisation_assertion_msg(number_of_points() >= 2,
-				    "support_points_begin: not enough points");
-    return Support_point_iterator(
-				  solver->basic_original_variable_indices_begin(),
-				  CGAL::compose1_1(
-						   Point_by_index( points.begin()),
-						   boost::bind2nd( std::divides<int>(), 2)));
-  }
-    
-  Support_point_iterator
-  support_points_end() const {
-    CGAL_optimisation_assertion_msg(number_of_points() >= 2,
-				    "support_points_begin: not enough points");
-    return Support_point_iterator(
-				  solver->basic_original_variable_indices_end(),
-				  CGAL::compose1_1(
-						   Point_by_index( points.begin()),
-						   boost::bind2nd( std::divides<int>(), 2)));
-  }
-    
-  int  number_of_inner_support_points() const { return static_cast<int>(inner_indices.size());}
-  int  number_of_outer_support_points() const { return static_cast<int>(outer_indices.size());}
-    
-  Inner_support_point_iterator
-  inner_support_points_begin() const
-  { return Inner_support_point_iterator(
-					inner_indices.begin(),
-					Point_by_index( points.begin())); }
-    
-  Inner_support_point_iterator
-  inner_support_points_end() const
-  { return Inner_support_point_iterator(
-					inner_indices.end(),
-					Point_by_index( points.begin())); }
-    
-  Outer_support_point_iterator
-  outer_support_points_begin() const
-  { return Outer_support_point_iterator(
-					outer_indices.begin(),
-					Point_by_index( points.begin())); }
-    
-  Outer_support_point_iterator
-  outer_support_points_end() const
-  { return Outer_support_point_iterator(
-					outer_indices.end(),
-					Point_by_index( points.begin())); }
-
-  Inner_support_point_index_iterator
-  inner_support_points_indices_begin() const
-  { return inner_indices.begin(); }
-    
-  Inner_support_point_index_iterator
-  inner_support_points_indices_end() const
-  { return inner_indices.end(); }
-
-  Outer_support_point_index_iterator
-  outer_support_points_indices_begin() const
-  { return outer_indices.begin(); }
-
-  Outer_support_point_index_iterator
-  outer_support_points_indices_end() const
-  { return outer_indices.end(); }
-
-
-  // access to center (rational representation)
-  Coordinate_iterator
-  center_coordinates_begin( ) const { return center_coords.begin(); }
-    
-  Coordinate_iterator
-  center_coordinates_end  ( ) const { return center_coords.end  (); }
-    
-  // access to squared radii (rational representation)
-  ET  squared_inner_radius_numerator( ) const { return sqr_i_rad_numer; }
-  ET  squared_outer_radius_numerator( ) const { return sqr_o_rad_numer; }
-  ET  squared_radii_denominator     ( ) const { return sqr_rad_denom; }
-    
-  // access to center and squared radii
-  // NOTE: an implicit conversion from ET to RT must be available!
-  Point
-  center( ) const
-  { CGAL_optimisation_precondition( ! is_empty());
-  return tco.construct_point_d_object()( ambient_dimension(),
-					 center_coordinates_begin(),
-					 center_coordinates_end()); }
-    
-  FT
-  squared_inner_radius( ) const
-  { CGAL_optimisation_precondition( ! is_empty());
-  return FT( squared_inner_radius_numerator()) /
-    FT( squared_radii_denominator()); }
-    
-  FT
-  squared_outer_radius( ) const
-  { CGAL_optimisation_precondition( ! is_empty());
-  return FT( squared_outer_radius_numerator()) /
-    FT( squared_radii_denominator()); }
-    
-  // predicates
-  CGAL::Bounded_side
-  bounded_side( const Point& p) const
-  { CGAL_optimisation_precondition(
-				   is_empty() || tco.access_dimension_d_object()( p) == d);
-  ET sqr_d = sqr_dist( p);
-  ET h_p_sqr = da_coord(p)[d] * da_coord(p)[d];
-  return CGAL::Bounded_side
-    (CGAL_NTS sign( sqr_d - h_p_sqr * sqr_i_rad_numer)
-     * CGAL_NTS sign( h_p_sqr * sqr_o_rad_numer - sqr_d)); }
-    
-  bool
-  has_on_bounded_side( const Point& p) const
-  { CGAL_optimisation_precondition(
-				   is_empty() || tco.access_dimension_d_object()( p) == d);
-  ET sqr_d = sqr_dist( p);
-  ET h_p_sqr = da_coord(p)[d] * da_coord(p)[d];
-  return ( ( h_p_sqr * sqr_i_rad_numer < sqr_d) && 
-	   ( sqr_d < h_p_sqr * sqr_o_rad_numer)); }
-    
-  bool
-  has_on_boundary( const Point& p) const
-  { CGAL_optimisation_precondition(
-				   is_empty() || tco.access_dimension_d_object()( p) == d);
-  ET sqr_d = sqr_dist( p);
-  ET h_p_sqr = da_coord(p)[d] * da_coord(p)[d];
-  return (( sqr_d == h_p_sqr * sqr_i_rad_numer) || 
-	  ( sqr_d == h_p_sqr * sqr_o_rad_numer));}
-    
-  bool
-  has_on_unbounded_side( const Point& p) const
-  { CGAL_optimisation_precondition(
-				   is_empty() || tco.access_dimension_d_object()( p) == d);
-  ET sqr_d = sqr_dist( p);
-  ET h_p_sqr = da_coord(p)[d] * da_coord(p)[d];
-  return ( ( sqr_d < h_p_sqr * sqr_i_rad_numer) || 
-	   ( h_p_sqr * sqr_o_rad_numer < sqr_d)); }
-    
-  bool  is_empty     ( ) const { return number_of_points() == 0; }
-  bool  is_degenerate( ) const
-  { return ! CGAL_NTS is_positive( sqr_o_rad_numer); }
-    
-  // modifiers
-  template < class InputIterator >
-  void
-  set( InputIterator first, InputIterator last)
-  { if ( points.size() > 0) points.erase( points.begin(), points.end());
-  std::copy( first, last, std::back_inserter( points));
-  set_dimension();
-  CGAL_optimisation_precondition_msg( check_dimension(),
-				      "Not all points have the same dimension.");
-  compute_min_annulus(); }
-    
-  void
-  insert( const Point& p)
-  { if ( is_empty()) d = tco.access_dimension_d_object()( p);
-  CGAL_optimisation_precondition(
-				 tco.access_dimension_d_object()( p) == d);
-  points.push_back( p);
-  compute_min_annulus(); }
-    
-  template < class InputIterator >
-  void
-  insert( InputIterator first, InputIterator last)
-  { CGAL_optimisation_precondition_code( std::size_t old_n = points.size());
-  points.insert( points.end(), first, last);
-  set_dimension();
-  CGAL_optimisation_precondition_msg( check_dimension( old_n),
-				      "Not all points have the same dimension.");
-  compute_min_annulus(); }
-    
-  void
-  clear( )
-  { points.erase( points.begin(), points.end());
-  compute_min_annulus(); }
-    
-  // validity check
-  bool  is_valid( bool verbose = false, int level = 0) const;
-    
-  // traits class access
-  const Traits&  traits( ) const { return tco; }
-    
-
-private:
-    
-  Traits                   tco;       // traits class object
-  Access_coordinates_begin_d da_coord; // data accessor
-    
-  Point_vector             points;    // input points
-  int                      d;         // dimension of input points
-    
-  ET_vector                center_coords;     // center of small.encl.annulus
-    
-  ET                       sqr_i_rad_numer;   // squared inner radius of
-  ET                       sqr_o_rad_numer;   // ---"--- outer ----"----
-  ET                       sqr_rad_denom;     // smallest enclosing annulus
-    
-  Solver                   *solver;    // linear programming solver
-     
-  Index_vector             inner_indices;
-  Index_vector             outer_indices;
-    
-  NT_matrix                a_matrix;  // matrix `A' of dual LP
-  NT_vector                b_vector;  // vector `b' of dual LP
-  NT_vector                c_vector;  // vector `c' of dual LP
-    
-private:
-  // squared distance to center * h_p^2 * c_d^2 
-  ET sqr_dist_exact( const Point& p) const
-  {
-    ET result(0);
-    typename Access_coordinates_begin_d::Coordinate_iterator 
-      p_it (da_coord ( p));     // this is p * h_p
-    ET c_d = center_coords[d];
-    ET h_p = p_it[d];
-    for (int i=0; i<d; ++i) {
-      ET x = 
-	c_d * ET(p_it[i]) -      /* this is c_d *    p_i * h_p */
-	h_p * center_coords[i]   /* this is h_p *    c_i * c_d */ ;
-      result += x * x;
-    }
-    return result;
-  }
-
-  // the function above computes sqr_dist as ||p-c||^2 
-  // (endowed with a factor of c_d^2 * h_p^2)
-  // but we know that c was computed from (possibly slightly wrong)
-  // data if NT is inexact; in order to compensate for this, let
-  // us instead compute sqr_dist as p^Tp - 2c^Tp + c^Tc, where we use
-  // the (potentially wrong) values of p^Tp and p that went into the
-  // linear program; this will give us correct containment / on_boundary 
-  // checks also in the inexact-NT case.
-  ET sqr_dist( const Point& p) const
-  {
-    ET result(0), two(2);
-    NT pTp(0); // computed over input type, possibly slightly wrong
-    ET cTc(0); 
-    ET two_pTc(0);
-    typename Access_coordinates_begin_d::Coordinate_iterator 
-      p_it (da_coord ( p));     // this is p * h_p
-    NT h_p = p_it[d]; // input type!
-    for (int i=0; i<d; ++i) {
-      NT p_i (p_it[i]);  // input type!
-      pTp += p_i * p_i;  // p_i^2 * h_p^2 
-      cTc += center_coords[i] * center_coords[i]; // c_i^2 * c_d^2
-      two_pTc += 
-	// 2 * c_i * c_d * p_i * h_p^2  
-	2 * center_coords[i] * ET(h_p * p_i); 
-    } 
-    ET c_d = center_coords[d];
-    result = 
-      ET(pTp) * c_d * c_d +      
-      cTc * ET (h_p * h_p) +
-      - two_pTc * c_d;
-    return result;
-  }
-    
-  // set dimension of input points
-  void
-  set_dimension( )
-  { d = ( points.size() == 0 ? -1 :
-	  tco.access_dimension_d_object()( points[ 0])); }
-    
-  // check dimension of input points
-  bool
-  check_dimension( std::size_t  offset = 0)
-  { return ( std::find_if( points.begin()+offset, points.end(),
-			   CGAL::compose1_1( boost::bind2nd(
-							  std::not_equal_to<int>(), d),
-					     tco.access_dimension_d_object()))
-	     == points.end()); }
-    
-  // compute smallest enclosing annulus
-  void
-  compute_min_annulus( )
-  {
-    // clear inner and outer support points
-    inner_indices.erase( inner_indices.begin(), inner_indices.end());
-    outer_indices.erase( outer_indices.begin(), outer_indices.end());
-    
-    if ( is_empty()) {
-      center_coords.resize( 1);
-      sqr_i_rad_numer = -ET( 1);
-      sqr_o_rad_numer = -ET( 1);
-      return;
-    }
-    
-    if ( number_of_points() == 1) {
-      inner_indices.push_back( 0);
-      outer_indices.push_back( 0);
-      center_coords.resize( d+1);
-      std::copy( da_coord( points[ 0]),
-		 da_coord( points[ 0])+d+1,
-		 center_coords.begin());
-      sqr_i_rad_numer = ET( 0);
-      sqr_o_rad_numer = ET( 0);
-      sqr_rad_denom   = ET( 1);
-      return;
-    }
-    
-    // set up vector c and solve dual LP
-    // the ordering of the constraints is as above; the ordering
-    // of the variables is: z_p_j <-> 2 * j, y_p_j <-> 2 * j + 1 
-    c_vector.resize( 2*points.size());
-    for ( int j = 0; j < number_of_points(); ++j) {
-      typename Traits::Access_coordinates_begin_d::Coordinate_iterator
-	coord_it = da_coord( points[j]);
-      NT  sum = 0;
-      for ( int i = 0; i < d; ++i) {
-	sum += NT( coord_it[ i])*NT( coord_it[ i]);
-      }
-      c_vector[ 2*j  ] =  sum;
-      c_vector[ 2*j+1] = -sum;
-    }
-        
-    LP lp (2*static_cast<int>(points.size()), d+2, 
-	   A_iterator ( boost::counting_iterator<int>(0), 
-			A_matrix (d, da_coord, points.begin())),
-	   B_iterator ( boost::counting_iterator<int>(0), 
-			B_vector (d)), 
-	   R_iterator (CGAL::EQUAL), 
-	   c_vector.begin());
-    
-    Quadratic_program_options options;
-    options.set_pricing_strategy(pricing_strategy(NT()));
-    delete solver;
-    solver = new Solver(lp, options);
-    CGAL_optimisation_assertion(solver->status() == QP_OPTIMAL);
- 
-    // compute center and squared radius
-    ET sqr_sum = 0;
-    center_coords.resize( ambient_dimension()+1);
-    for ( int i = 0; i < d; ++i) {
-      center_coords[ i] = -solver->dual_variable( i);
-      sqr_sum += center_coords[ i] * center_coords[ i];
-    }
-    center_coords[ d] = solver->variables_common_denominator();
-    sqr_i_rad_numer = sqr_sum
-      - solver->dual_variable( d  )*center_coords[ d];
-    sqr_o_rad_numer = sqr_sum
-      - solver->dual_variable( d+1)*center_coords[ d];
-    sqr_rad_denom   = center_coords[ d] * center_coords[ d];
-        
-    // split up support points
-    for ( int i = 0; i < solver->number_of_basic_original_variables(); ++i) {
-      int index = solver->basic_original_variable_indices_begin()[ i];
-      if ( index % 2 == 0) {
-	inner_indices.push_back( index/2);
-      } else {
-	outer_indices.push_back( index/2);
-      }
-    }
-  }
-  
-  template < class NT >
-  Quadratic_program_pricing_strategy pricing_strategy( NT) {
-    return QP_PARTIAL_FILTERED_DANTZIG;
-  }
-  
-  Quadratic_program_pricing_strategy pricing_strategy( ET) {
-    return QP_PARTIAL_DANTZIG;
-  }
- 
-    
-};
-
-// Function declarations
-// =====================
-// I/O operators
-template < class Traits_ >
-std::ostream&
-operator << ( std::ostream& os, const Min_annulus_d<Traits_>& min_annulus);
-
-template < class Traits_ >
-std::istream&
-operator >> ( std::istream& is,       Min_annulus_d<Traits_>& min_annulus);
-
-// ============================================================================
-
-// Class implementation
-// ====================
-
-// validity check
-template < class Traits_ >
-bool
-Min_annulus_d<Traits_>::
-is_valid( bool verbose, int level) const
-{
-  using namespace std;
-
-  CGAL::Verbose_ostream verr( verbose);
-  verr << "CGAL::Min_annulus_d<Traits>::" << endl;
-  verr << "is_valid( true, " << level << "):" << endl;
-  verr << "  |P| = " << number_of_points()
-       << ", |S| = " << number_of_support_points() << endl;
-
-  // containment check (a)
-  // ---------------------
-  verr << "  (a) containment check..." << flush;
-    
-  Point_iterator  point_it = points_begin();
-  for ( ; point_it != points_end(); ++point_it) {
-    if ( has_on_unbounded_side( *point_it))
-      return CGAL::_optimisation_is_valid_fail( verr,
-						"annulus does not contain all points");
-  }
-    
-  verr << "passed." << endl;
-
-  // support set check (b)
-  // ---------------------
-  verr << "  (b) support set check..." << flush;
-    
-  // all inner support points on inner boundary?
-  Inner_support_point_iterator  i_pt_it = inner_support_points_begin();
-  for ( ; i_pt_it != inner_support_points_end(); ++i_pt_it) {
-    ET h_p_sqr = da_coord (*i_pt_it)[d] * da_coord (*i_pt_it)[d];
-    if ( sqr_dist( *i_pt_it) != h_p_sqr * sqr_i_rad_numer)
-      return CGAL::_optimisation_is_valid_fail( verr,
-						"annulus does not have all inner support points on its inner boundary");
-  }
-    
-  // all outer support points on outer boundary?
-  Outer_support_point_iterator  o_pt_it = outer_support_points_begin();
-  for ( ; o_pt_it != outer_support_points_end(); ++o_pt_it) {
-    ET h_p_sqr = da_coord (*o_pt_it)[d] * da_coord (*o_pt_it)[d];
-    if ( sqr_dist( *o_pt_it) != h_p_sqr * sqr_o_rad_numer)
-      return CGAL::_optimisation_is_valid_fail( verr,
-						"annulus does not have all outer support points on its outer boundary");
-  }
-  /*
-  // center strictly in convex hull of support points?
-  typename Solver::Basic_variable_numerator_iterator
-  num_it = solver.basic_variables_numerator_begin();
-  for ( ; num_it != solver.basic_variables_numerator_end(); ++num_it) {
-  if ( ! (    CGAL_NTS is_positive( *num_it)
-  && *num_it <= solver.variables_common_denominator()))
-  return CGAL::_optimisation_is_valid_fail( verr,
-  "center does not lie strictly in convex hull of support points");
-  }
-  */
-    
-  verr << "passed." << endl;
-
-  verr << "  object is valid!" << endl;
-  return( true);
-}
-
-// output operator
-template < class Traits_ >
-std::ostream&
-operator << ( std::ostream& os,
-              const Min_annulus_d<Traits_>& min_annulus)
-{
-  using namespace std;
-
-  typedef  typename Min_annulus_d<Traits_>::Point  Point;
-  typedef  ostream_iterator<Point>       Os_it;
-  typedef  typename Traits_::ET          ET;
-  typedef  ostream_iterator<ET>          Et_it;
-
-  switch ( CGAL::get_mode( os)) {
-
-  case CGAL::IO::PRETTY:
-    os << "CGAL::Min_annulus_d( |P| = "
-       << min_annulus.number_of_points() << ", |S| = "
-       << min_annulus.number_of_inner_support_points() << '+'
-       << min_annulus.number_of_outer_support_points() << endl;
-    os << "  P = {" << endl;
-    os << "    ";
-    copy( min_annulus.points_begin(), min_annulus.points_end(),
-	  Os_it( os, ",\n    "));
-    os << "}" << endl;
-    os << "  S_i = {" << endl;
-    os << "    ";
-    copy( min_annulus.inner_support_points_begin(),
-	  min_annulus.inner_support_points_end(),
-	  Os_it( os, ",\n    "));
-    os << "}" << endl;
-    os << "  S_o = {" << endl;
-    os << "    ";
-    copy( min_annulus.outer_support_points_begin(),
-	  min_annulus.outer_support_points_end(),
-	  Os_it( os, ",\n    "));
-    os << "}" << endl;
-    os << "  center = ( ";
-    copy( min_annulus.center_coordinates_begin(),
-	  min_annulus.center_coordinates_end(),
-	  Et_it( os, " "));
-    os << ")" << endl;
-    os << "  squared inner radius = "
-       << min_annulus.squared_inner_radius_numerator() << " / "
-       << min_annulus.squared_radii_denominator() << endl;
-    os << "  squared outer radius = "
-       << min_annulus.squared_outer_radius_numerator() << " / "
-       << min_annulus.squared_radii_denominator() << endl;
-    break;
-
-  case CGAL::IO::ASCII:
-    copy( min_annulus.points_begin(), min_annulus.points_end(),
-	  Os_it( os, "\n"));
-    break;
-
-  case CGAL::IO::BINARY:
-    copy( min_annulus.points_begin(), min_annulus.points_end(),
-	  Os_it( os));
-    break;
-
-  default:
-    CGAL_optimisation_assertion_msg( false,
-				     "CGAL::get_mode( os) invalid!");
-    break; }
-
-  return( os);
-}
-
-// input operator
-template < class Traits_ >
-std::istream&
-operator >> ( std::istream& is, CGAL::Min_annulus_d<Traits_>& min_annulus)
-{
-  using namespace std;
-
-  switch ( CGAL::get_mode( is)) {
-
-  case CGAL::IO::PRETTY:
-    cerr << endl;
-    cerr << "Stream must be in ascii or binary mode" << endl;
-    break;
-
-  case CGAL::IO::ASCII:
-  case CGAL::IO::BINARY:
-    typedef  typename CGAL::Min_annulus_d<Traits_>::Point  Point;
-    typedef  istream_iterator<Point>             Is_it;
-    min_annulus.set( Is_it( is), Is_it());
-    break;
-
-  default:
-    CGAL_optimisation_assertion_msg( false, "CGAL::IO::mode invalid!");
-    break; }
-
-  return( is);
-}
-
-} //namespace CGAL
-
-#endif // CGAL_MIN_ANNULUS_D_H
-
-// ===== EOF ==================================================================
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/Minkowski_sum_decomp_2.h b/3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/Minkowski_sum_decomp_2.h
deleted file mode 100644
index 5f03d75..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/Minkowski_sum_decomp_2.h
+++ /dev/null
@@ -1,421 +0,0 @@
-// Copyright (c) 2006  Tel-Aviv University (Israel).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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.
-//
-// Author(s)     : Ron Wein   <wein_r at yahoo.com>
-
-#ifndef CGAL_MINKOWSKI_SUM_DECOMP_2_H
-#define CGAL_MINKOWSKI_SUM_DECOMP_2_H
-
-#include <CGAL/Arr_segment_traits_2.h>
-#include <CGAL/Polygon_with_holes_2.h>
-
-#include <CGAL/Boolean_set_operations_2.h>
-#include <CGAL/General_polygon_set_2.h>
-#include <CGAL/Gps_segment_traits_2.h>
-#include <list>
-
-namespace CGAL {
-
-/*! \class
- * A class for computing the Minkowski sum of two simple polygons based on
- * their decomposition two convex sub-polygons, taking the pairwise sums and
- * computing the union of the sub-sums.
- */
-
-template <class DecompStrategy_, class Container_>
-class Minkowski_sum_by_decomposition_2 {
-public:
-  typedef DecompStrategy_                              Decomposition_strategy;
-  typedef Container_                                   Container;
-
-  typedef typename Decomposition_strategy::Polygon_2     Polygon_2;
-
-  typedef typename Decomposition_strategy::Kernel        Kernel;
-  typedef CGAL::Arr_segment_traits_2<Kernel>             Arr_segment_traits;
-  typedef CGAL::Gps_segment_traits_2<Kernel, Container, Arr_segment_traits>
-                                                         Traits_2;
-  typedef CGAL::General_polygon_set_2<Traits_2>          General_polygon_set_2;
-  typedef CGAL::Polygon_with_holes_2<Kernel,Container>   Polygon_with_holes_2;
-  typedef typename General_polygon_set_2::Arrangement_2  Arrangement_2;
-
-private:
-  // Kernel types:
-  typedef typename Kernel::Point_2                       Point_2;
-  typedef typename Kernel::Vector_2                      Vector_2;
-  typedef typename Kernel::Direction_2                   Direction_2;
-
-  // Kernel functors:
-  typedef typename Kernel::Compare_angle_with_x_axis_2   Compare_angle_2;
-  typedef typename Kernel::Construct_translated_point_2  Translate_point_2;
-  typedef typename Kernel::Construct_vector_2            Construct_vector_2;
-  typedef typename Kernel::Construct_direction_2         Construct_direction_2;
-  typedef typename Kernel::Compare_x_2                   Compare_x_2;
-  typedef typename Kernel::Compare_y_2                   Compare_y_2;
-  typedef typename Kernel::Compare_xy_2                  Compare_xy_2;
-
-  // Polygon-related types:
-  typedef typename Polygon_2::Vertex_circulator          Vertex_circulator;
-  typedef std::list<Polygon_2>                           Polygons_list;
-  typedef typename Polygons_list::iterator               Polygons_iterator;
-
-  typedef std::list<Polygon_with_holes_2>
-    Polygon_with_holes_list;
-
-  // Data members:
-  const Decomposition_strategy* m_decomposition_strategy;
-  bool m_own_strategy;    // inidicates whether the stategy should be freed up.
-
-  const Traits_2* m_traits;
-  bool m_own_traits;      // inidicates whether the kernel should be freed up.
-
-  Compare_angle_2         f_compare_angle;
-  Translate_point_2       f_add;
-  Construct_vector_2      f_vector;
-  Construct_direction_2   f_direction;
-  Compare_x_2             f_compare_x;
-  Compare_y_2             f_compare_y;
-  Compare_xy_2            f_compare_xy;
-
-public:
-  //! Default constructor.
-  Minkowski_sum_by_decomposition_2() :
-    m_decomposition_strategy(NULL),
-    m_own_strategy(false),
-    m_traits(NULL),
-    m_own_traits(false)
-  { init(); }
-
-  //! Constructor.
-  Minkowski_sum_by_decomposition_2(const Decomposition_strategy& strategy,
-                                   const Traits_2& traits) :
-    m_decomposition_strategy(&strategy),
-    m_own_strategy(false),
-    m_traits(&traits),
-    m_own_traits(false)
-  { init(); }
-
-  //! Constructor.
-  Minkowski_sum_by_decomposition_2(const Decomposition_strategy& strategy) :
-    m_decomposition_strategy(&strategy),
-    m_own_strategy(false),
-    m_traits(NULL),
-    m_own_traits(false)
-  { init(); }
-
-  //! Constructor.
-  Minkowski_sum_by_decomposition_2(const Traits_2& traits) :
-    m_decomposition_strategy(NULL),
-    m_own_strategy(false),
-    m_traits(&traits),
-    m_own_traits(false)
-  { init(); }
-
-  /*! Destructor */
-  ~Minkowski_sum_by_decomposition_2()
-  {
-    if (m_own_traits) {
-      if (m_traits != NULL) {
-        delete m_traits;
-        m_traits = NULL;
-      }
-      m_own_traits = false;
-    }
-
-    if (m_own_strategy) {
-      if (m_decomposition_strategy != NULL) {
-        delete m_decomposition_strategy;
-        m_decomposition_strategy = NULL;
-      }
-      m_own_strategy = false;
-    }
-  }
-
-  //! Initialize
-  void init()
-  {
-    // Allocate the traits if not provided.
-    if (m_traits == NULL) {
-      m_traits = new Traits_2;
-      m_own_traits = true;
-    }
-    // Allocate the strategy if not provided.
-    if (m_decomposition_strategy == NULL) {
-      m_decomposition_strategy = new Decomposition_strategy;
-      m_own_strategy = true;
-    }
-    // Obtain kernel functors.
-    const Kernel* kernel = m_traits;
-    f_compare_angle = kernel->compare_angle_with_x_axis_2_object();
-    f_add = kernel->construct_translated_point_2_object();
-    f_vector = kernel->construct_vector_2_object();
-    f_direction = kernel->construct_direction_2_object();
-    f_compare_x = kernel->compare_x_2_object();
-    f_compare_y = kernel->compare_y_2_object();
-    f_compare_xy = kernel->compare_xy_2_object();
-  }
-
-  /*!
-   * Obtain the traits
-   * \return the traits
-   */
-  const Traits_2* traits() const { return m_traits; }
-
-  /*!
-   * Obtain the decomposition strategy
-   * \return the decomposition strategy
-   */
-  const Decomposition_strategy* decomposition_strategy() const
-  { return m_decomposition_strategy; }
-
-  /*!
-   * Compute the Minkowski sum of two simple polygons.
-   * \param pgn1 The first polygon.
-   * \param pgn2 The second polygon.
-   * \pre Both input polygons are simple.
-   * \return The resulting polygon with holes, representing the sum.
-   */
-  Polygon_with_holes_2
-  operator()(const Polygon_2& pgn1, const Polygon_2& pgn2) const
-  {
-    CGAL_precondition(pgn1.is_simple());
-    CGAL_precondition(pgn2.is_simple());
-
-    // Decompose both input polygons to convex sub-polygons.
-    Polygons_list sub_pgns1;
-    Polygons_list sub_pgns2;
-
-    (*m_decomposition_strategy)(pgn1, std::back_inserter(sub_pgns1));
-    (*m_decomposition_strategy)(pgn2, std::back_inserter(sub_pgns2));
-
-    return operator()(sub_pgns1.begin(), sub_pgns1.end(),
-                      sub_pgns2.begin(), sub_pgns2.end());
-  }
-
-  /*!
-   * Compute the Minkowski sum of two polygon-with-holes.
-   * \param pgn1 The first polygon.
-   * \param pgn2 The second polygon.
-   * \pre Both input polygons are simple.
-   * \return The resulting polygon with holes, representing the sum.
-   */
-  Polygon_with_holes_2
-  operator()(const Polygon_with_holes_2& pgn1,
-             const Polygon_with_holes_2& pgn2) const
-  {
-    // Decompose both input polygons to convex sub-polygons.
-    Polygons_list sub_pgns1;
-    Polygons_list sub_pgns2;
-
-    (*m_decomposition_strategy)(pgn1, std::back_inserter(sub_pgns1));
-    (*m_decomposition_strategy)(pgn2, std::back_inserter(sub_pgns2));
-
-    return operator()(sub_pgns1.begin(), sub_pgns1.end(),
-                      sub_pgns2.begin(), sub_pgns2.end());
-  }
-
-  /*!
-   * Compute the Minkowski sum of a simple polygon and a polygon-with-holes.
-   * \param pgn1 The simple polygon.
-   * \param pgn2 The polygon with holes.
-   * \pre Both input polygons are simple.
-   * \return The resulting polygon with holes, representing the sum.
-   */
-  Polygon_with_holes_2
-  operator()(const Polygon_2& pgn1, const Polygon_with_holes_2& pgn2) const
-  {
-    CGAL_precondition(pgn1.is_simple());
-
-    // Decompose both input polygons to convex sub-polygons.
-    Polygons_list sub_pgns1;
-    Polygons_list sub_pgns2;
-
-    (*m_decomposition_strategy)(pgn1, std::back_inserter(sub_pgns1));
-    (*m_decomposition_strategy)(pgn2, std::back_inserter(sub_pgns2));
-
-    return operator()(sub_pgns1.begin(), sub_pgns1.end(),
-                      sub_pgns2.begin(), sub_pgns2.end());
-  }
-
-  /*! Compute the union of the pairwise Minkowski sum of two sets of
-   * convex polygons.
-   * \param begin1 the iterator to the begin element of the first set.
-   * \param end1 the iterator to the past-the-end element of the first set.
-   * \param begin2 the iterator to the begin element of the second set.
-   * \param end2 the iterator to the past-the-end element of the second set.
-   */
-  template <class InputIterator1, class InputIterator2>
-  Polygon_with_holes_2 operator()(InputIterator1 begin1, InputIterator1 end1,
-                                  InputIterator2 begin2, InputIterator1 end2)
-    const
-  {
-    Polygons_list sub_sum_polygons;
-
-    // Compute the sub-sums of all pairs of sub-polygons.
-    for (InputIterator1 curr1 = begin1; curr1 != end1; ++curr1) {
-      for (InputIterator2 curr2 = begin2; curr2 != end2; ++curr2) {
-        // Compute the sum of the current pair of convex sub-polygons.
-        Polygon_2 sub_sum;
-        _compute_sum_of_convex(*curr1, *curr2, sub_sum);
-        sub_sum_polygons.push_back(sub_sum);
-      }
-    }
-
-    General_polygon_set_2 gps(*m_traits);
-    gps.join(sub_sum_polygons.begin(), sub_sum_polygons.end());
-
-    Arrangement_2& arr = gps.arrangement();
-    simplify(arr);
-
-    Polygon_with_holes_list sum;
-    gps.polygons_with_holes(std::back_inserter(sum));
-    CGAL_assertion(sum.size() == 1);
-    return (*(sum.begin()));
-  }
-
-private:
-  /*! Merge mergable edges
-   * \param arr (in) The underlying arrangement.
-   */
-  void simplify(Arrangement_2& arr) const
-  {
-    typename Arrangement_2::Vertex_iterator vit = arr.vertices_begin();
-    while (vit != arr.vertices_end()) {
-      typename Arrangement_2::Vertex_iterator curr = vit++;
-      if (curr->degree() != 2) continue;
-      typename Arrangement_2::Halfedge_around_vertex_circulator eit =
-        curr->incident_halfedges();
-      const typename Arrangement_2::Geometry_traits_2* traits =
-        arr.geometry_traits();
-      if (traits->are_mergeable_2_object()(eit->curve(), eit->next()->curve()))
-      {
-        typename Arrangement_2::Geometry_traits_2::X_monotone_curve_2 c;
-        traits->merge_2_object()(eit->curve(), eit->next()->curve(), c);
-        arr.merge_edge(eit, eit->next(), c);
-      }
-    }
-  }
-
-  /*!
-   * Compute the Minkowski sum of two convex polygons.
-   * \param pgn1 The first convex polygon.
-   * \param pgn2 The second convex polygon.
-   * \param sub_sum Output: Polygon which is the sub sum of the two convex
-   *        polygons
-   */
-  void _compute_sum_of_convex(const Polygon_2& pgn1,
-                              const Polygon_2& pgn2,
-                              Polygon_2& sub_sum) const
-  {
-    // Find the bottom-left vertex in both polygons.
-    Vertex_circulator first1, curr1, next1;
-    Vertex_circulator bottom_left1;
-    Comparison_result res;
-    bottom_left1 = curr1 = first1 = pgn1.vertices_circulator();
-    ++curr1;
-    while (curr1 != first1) {
-      res = f_compare_y(*curr1, *bottom_left1);
-      if ((res == SMALLER) ||
-          ((res == EQUAL) && (f_compare_x(*curr1, *bottom_left1) == SMALLER)))
-      {
-        bottom_left1 = curr1;
-      }
-      ++curr1;
-    }
-
-    // Find the bottom-left vertex in both polygons.
-    Vertex_circulator         first2, curr2, next2;
-    Vertex_circulator         bottom_left2;
-
-    bottom_left2 = curr2 = first2 = pgn2.vertices_circulator();
-    ++curr2;
-    while (curr2 != first2) {
-      res = f_compare_y(*curr2, *bottom_left2);
-      if ((res == SMALLER) ||
-          ((res == EQUAL) && (f_compare_x(*curr2, *bottom_left2) == SMALLER)))
-      {
-        bottom_left2 = curr2;
-      }
-      ++curr2;
-    }
-
-    // Start from the bottom-left vertices.
-    next1 = curr1 = bottom_left1;
-    ++next1;
-    next2 = curr2 = bottom_left2;
-    ++next2;
-
-    // Compute the Minkowski sum.
-    Point_2 first_pt;
-    Point_2 curr_pt;
-    Point_2 prev_pt;
-    bool is_first = true;
-    bool inc1, inc2;
-    bool moved_on1 = false;
-    bool moved_on2 = false;
-
-    do {
-      // Compute the sum of the two current vertices (we actually translate
-      // the point curr1 by a vector equivalent to the point curr2).
-      curr_pt = f_add(*curr1, f_vector(CGAL::ORIGIN, *curr2));
-
-      if (is_first) {
-        // This is the first point we have computed.
-        first_pt = prev_pt = curr_pt;
-        is_first = false;
-        sub_sum.push_back(first_pt);
-      }
-      else {
-        // Add a segment from the previously summed point to the current one.
-        res = f_compare_xy(prev_pt, curr_pt);
-        CGAL_assertion (res != EQUAL);
-        prev_pt = curr_pt;
-        sub_sum.push_back(curr_pt);
-      }
-
-      // Compare the angles the current edges form with the x-axis.
-      res = f_compare_angle(f_direction(f_vector(*curr1, *next1)),
-                            f_direction(f_vector(*curr2, *next2)));
-
-      // Proceed to the next vertex according to the result.
-      inc1 = (res != LARGER);
-      inc2 = (res != SMALLER);
-
-      if (inc1 && moved_on1 && (curr1 == bottom_left1)) {
-        inc1 = false;
-        inc2 = true;
-      }
-
-      if (inc2 && moved_on2 && (curr2 == bottom_left2)) {
-        inc1 = true;
-        inc2 = false;
-      }
-
-      if (inc1) {
-        curr1 = next1;
-        ++next1;
-        moved_on1 = true;
-      }
-
-      if (inc2) {
-        curr2 = next2;
-        ++next2;
-         moved_on2 = true;
-     }
-    } while ((curr1 != bottom_left1) || (curr2 != bottom_left2));
-  }
-};
-
-} //namespace CGAL
-
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Modifiable_priority_queue.h b/3rdparty/CGAL-4.8/include/CGAL/Modifiable_priority_queue.h
deleted file mode 100644
index 1671468..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Modifiable_priority_queue.h
+++ /dev/null
@@ -1,133 +0,0 @@
-// Copyright (c) 2006-2011  GeometryFactory (France). All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Fernando Cacciola <fernando.cacciola at geometryfactory.com>
-//
-#ifndef CGAL_MODIFIABLE_PRIORITY_QUEUE_H
-#define CGAL_MODIFIABLE_PRIORITY_QUEUE_H
-
-#include <climits> // Neeeded by the following Boost header for CHAR_BIT.
-#include <boost/optional.hpp>
-#ifdef CGAL_SURFACE_MESH_SIMPLIFICATION_USE_RELAXED_HEAP
-#include <boost/pending/relaxed_heap.hpp>
-#else
-#include <CGAL/internal/boost/mutable_queue.hpp>
-
-
-namespace CGAL {
-  namespace internal {
-template <class IndexedType, 
-          class RandomAccessContainer = std::vector<IndexedType>, 
-          class Comp = std::less<typename RandomAccessContainer::value_type>,
-          class ID = ::boost::identity_property_map >
-class mutable_queue_with_remove : public internal::boost_::mutable_queue<IndexedType,RandomAccessContainer,Comp,ID>
-{
-  typedef internal::boost_::mutable_queue<IndexedType,RandomAccessContainer,Comp,ID> Base;
-public:
-  typedef typename Base::size_type size_type;
-  typedef typename Base::Node Node;
-
-  mutable_queue_with_remove(size_type n, const Comp& x=Comp(), const ID& _id=ID()) : Base(n,x,_id,true) 
-  {}
-
-  void remove(const IndexedType& x){
-    //first place element at the top
-    size_type current_pos = this->index_array[ get(this->id, x) ];
-    this->c[current_pos] = x;
-
-    Node node(this->c.begin(), this->c.end(), this->c.begin()+current_pos, this->id);
-    while (node.has_parent())
-      node.swap(node.parent(), this->index_array);
-    //then pop it
-    this->pop();
-  }
-  
-  bool contains(const IndexedType& x) const {
-    return this->index_array[ get(this->id, x) ] !=this->index_array.size();
-  }
-};
-
-} } //namespace CGAL::internal
-#endif //CGAL_SURFACE_MESH_SIMPLIFICATION_USE_RELAXED_HEAP
-
-namespace CGAL {
-
-template <class IndexedType_ 
-         ,class Compare_ = std::less<IndexedType_>
-         ,class ID_      = boost::identity_property_map
-         >
-class Modifiable_priority_queue
-{
-public:
-
-  typedef Modifiable_priority_queue Self;
-  
-  typedef IndexedType_ IndexedType ;
-  typedef Compare_     Compare;
-  typedef ID_          ID ;
-  
-  #ifdef CGAL_SURFACE_MESH_SIMPLIFICATION_USE_RELAXED_HEAP
-  typedef boost::relaxed_heap<IndexedType,Compare,ID> Heap;
-  #else
-  typedef  internal::mutable_queue_with_remove<IndexedType,std::vector<IndexedType>,Compare,ID> Heap;
-  #endif //CGAL_SURFACE_MESH_SIMPLIFICATION_USE_RELAXED_HEAP
-  typedef typename Heap::value_type value_type;
-  typedef typename Heap::size_type  size_type;
-  
-  typedef bool handle ;
-  
-public:
-
-  Modifiable_priority_queue( size_type largest_ID, Compare const& c, ID const& id ) : mHeap(largest_ID,c,id) {}
-  
-  handle push ( value_type const& v ) { mHeap.push(v) ; return handle(true) ; }
-  
-  handle update ( value_type const& v, handle h ) { mHeap.update(v); return h ; }
-  
-  handle erase ( value_type const& v, handle  ) { mHeap.remove(v); return null_handle() ; }
-
-  value_type top() const { return mHeap.top() ; }
-  
-  void pop() { mHeap.pop(); }
-  
-  bool empty() const { return mHeap.empty() ; }
-
-  bool contains ( value_type const& v ) { return mHeap.contains(v) ; }
-
-  boost::optional<value_type> extract_top()
-  {
-    boost::optional<value_type> r ;
-    if ( !empty() )
-    {
-      value_type v = top();
-      pop();
-      r = boost::optional<value_type>(v) ;
-    }  
-    return r ;
-  }
-  
-  static handle null_handle() { return handle(false); }
-  
-private:
-
-  Heap mHeap ;  
-    
-} ;
-
-} //namespace CGAL
-
-#endif
- 
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Monge_via_jet_fitting.h b/3rdparty/CGAL-4.8/include/CGAL/Monge_via_jet_fitting.h
deleted file mode 100644
index 1236ac6..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Monge_via_jet_fitting.h
+++ /dev/null
@@ -1,784 +0,0 @@
-// Copyright (c) 2007  INRIA Sophia-Antipolis (France), INRIA Lorraine LORIA.
-// 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
-// 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(s)     : Marc Pouget and Frédéric Cazals
-#ifndef CGAL_MONGE_VIA_JET_FITTING_H_
-#define CGAL_MONGE_VIA_JET_FITTING_H_
-
-#include <CGAL/Simple_cartesian.h>
-#include <CGAL/circulator.h>
-#include <CGAL/Linear_algebraCd.h>
-#include <CGAL/Cartesian_converter.h>
-#include <CGAL/Default_diagonalize_traits.h>
-#include <math.h>
-#include <utility>
-#ifdef CGAL_EIGEN3_ENABLED
-#include <CGAL/Eigen_svd.h>
-#else
-#ifdef CGAL_LAPACK_ENABLED
-#include <CGAL/Lapack/Linear_algebra_lapack.h>
-#endif
-#endif
-
-namespace CGAL {
-
-inline
-unsigned int fact(unsigned int n){
-  unsigned int i, p=1;
-  for(i=2; i<=n; i++) p *= i;
-  return p;
-}
-
-////////////////////// CLASS Monge_via_jet_fitting ////////////////////////
-#ifdef CGAL_EIGEN3_ENABLED
-template < class DataKernel, class LocalKernel = Simple_cartesian<double>, class SvdTraits = Eigen_svd >
-#else
-#ifdef CGAL_LAPACK_ENABLED
-template < class DataKernel, class LocalKernel = Simple_cartesian<double>, class SvdTraits = Lapack_svd>  
-#else
-template < class DataKernel, class LocalKernel, class SvdTraits >  
-#endif
-#endif
-  class Monge_via_jet_fitting {
- public:
-//////////////////////begin nested CLASS Monge_form ///////////////////
-class Monge_form {
- public: 
-  typedef typename DataKernel::FT        FT;
-  typedef typename DataKernel::Point_3   Point_3;
-  typedef typename DataKernel::Vector_3  Vector_3;
- protected:
-  //point on the fitted surface where diff quantities are computed
-  Point_3 m_origin_pt;
-  //the monge trihedron (d1,d2,n) is orthonormal direct
-  Vector_3 m_d1;   //maximal ppal dir
-  Vector_3 m_d2;   //minimal ppal dir
-  Vector_3 m_n;    //normal direction
-  //coeff = (k1, k2, //ppal curv
-  //         b0, b1, b2, b3, //third order
-  //         c0, c1, c2, c3, c4) //fourth order
-  //     if (degree==1) no coeff needed
-  std::vector<FT> m_coefficients;
-  
-public:
-  //constructor
-  Monge_form() {
-    m_origin_pt  = Point_3(0.,0.,0.); 
-    m_d1 = Vector_3(0.,0.,0.);
-    m_d2 = Vector_3(0.,0.,0.);
-    m_n = Vector_3(0.,0.,0.);
-    m_coefficients = std::vector<FT>();
-  }
-  ~Monge_form() {}
-  //access
-  const Point_3 origin() const { return m_origin_pt; }
-  Point_3& origin() { return m_origin_pt; }
-  const Vector_3 maximal_principal_direction() const { return m_d1; }
-  Vector_3& maximal_principal_direction() { return m_d1; }
-  const Vector_3 minimal_principal_direction() const { return m_d2; }
-  Vector_3& minimal_principal_direction() { return m_d2; }
-  const Vector_3 normal_direction() const { return m_n; }
-  Vector_3& normal_direction() { return m_n; }
-  const std::vector<FT> coefficients() const { return m_coefficients; }
-  std::vector<FT>& coefficients() { return m_coefficients; }
-
-  const FT principal_curvatures(size_t i) const {
-    CGAL_precondition( (i == 0 || i == 1) && coefficients().size() >=2 );
-    return coefficients()[i]; }
-  const FT third_order_coefficients(size_t i) const {
-    CGAL_precondition( i <= 3 && coefficients().size() >=6 );
-    return coefficients()[i+2]; }
-  const FT fourth_order_coefficients(size_t i) const {
-    CGAL_precondition( i <= 4 && coefficients().size() >=11 );
-    return coefficients()[i+6]; }
- 
-  //if d>=2, number of coeffs = (d+1)(d+2)/2 -4. 
-  //we remove cst, linear and the xy coeff which vanish
-  void set_up(std::size_t degree);
-  //switch min-max ppal curv/dir wrt a given normal orientation.
-  // if given_normal.monge_normal < 0 then change the orientation
-  // if z=g(x,y) in the basis (d1,d2,n) then in the basis (d2,d1,-n)
-  // z=h(x,y)=-g(y,x)
-  void comply_wrt_given_normal(const Vector_3& given_normal);
-  void dump_verbose(std::ostream& out_stream) const;
-  void dump_4ogl(std::ostream& out_stream, const FT scale);
-};
-//////////////////////end nested CLASS Monge_form /////////////////////
-
-//continue main class Monge_via_jet_fitting ////////
- public:
- typedef  DataKernel   Data_kernel;
- typedef  LocalKernel  Local_kernel;
- 
- //used to convert number types, points and vectors back and forth
- typedef NT_converter<typename Local_kernel::FT, typename  Data_kernel::FT> L2D_NTconverter;
- Cartesian_converter<Data_kernel, Local_kernel> D2L_converter; 
- Cartesian_converter<Local_kernel, Data_kernel> L2D_converter; 
-  
- typedef typename Local_kernel::FT       FT;
- typedef typename Local_kernel::Point_3  Point_3;
- typedef typename Local_kernel::Vector_3 Vector_3;
- typedef CGAL::Aff_transformation_3<Local_kernel> Aff_transformation;
-
- typedef typename Data_kernel::FT       DFT;
-
- typedef typename SvdTraits::Vector LAVector;
- typedef typename SvdTraits::Matrix LAMatrix;
- 
-
- public:
- Monge_via_jet_fitting(); 
- template <class InputIterator>
- Monge_form operator()(InputIterator begin, InputIterator end,  
-		       size_t d, size_t dprime);
- const FT condition_number() const {return condition_nb;}
- const std::pair<FT, Vector_3> pca_basis(size_t i) const {
-   CGAL_precondition( i<3 );
-   return m_pca_basis[i];}
- 
- protected:
- int deg;
- int deg_monge;
-  int nb_d_jet_coeff;
-  int nb_input_pts;
-  FT preconditionning;
-  CGAL::Sqrt<FT> Lsqrt;
-  FT condition_nb;
-  
-  std::vector< std::pair<FT, Vector_3> > m_pca_basis;
-
-  //translate_p0 changes the origin of the world to p0 the first point 
-  //  of the input data points
-  //change_world2fitting (coord of a vector in world) = coord of this 
-  //  vector in fitting. The matrix tranform has as lines the coord of
-  //  the basis vectors of fitting in the world coord. 
-  //idem for change_fitting2monge
-  Aff_transformation translate_p0, change_world2fitting,
-    change_fitting2monge;
-
-  //eigen val and vect stored in m_pca_basis
-  // change_world2fitting is computed 
- template <class InputIterator>
-  void compute_PCA(InputIterator begin, InputIterator end); 
-
-  //Coordinates of input points are computed in the fitting basis with 
-  //  p0 as origin.
-  //Preconditionning is computed, M and Z are filled
- template <class InputIterator>
-  void fill_matrix(InputIterator begin, InputIterator end,
-		   std::size_t d, LAMatrix& M, LAVector& Z);
-  //A is computed, solving MA=Z in the ls sense, the solution A is stored in Z
-  //Preconditionning is needed
-  void solve_linear_system(LAMatrix &M, LAVector& Z);
-  
-  //Classical differential geometric calculus
-  //change_fitting2monge is computed
-  //if deg_monge =1 only 1st order info
-  //if deg_monge >= 2 2nd order info are computed
-  void compute_Monge_basis(const FT* A, Monge_form& monge_form);
-
-  //if deg_monge >=3 then 3rd (and 4th) order info are computed
-  void compute_Monge_coefficients(FT* A, std::size_t dprime, 
-				  Monge_form& monge_form);
-
-  //for a trihedron (v1,v2,v3) switches v1 to -v1 if det(v1,v2,v3) < 0
-  void switch_to_direct_orientation(Vector_3& v1, const Vector_3& v2,
-				   const Vector_3& v3);
-
-    friend
-    std::ostream&
-    operator<<(std::ostream& out_stream, 
-	       const typename Monge_via_jet_fitting<DataKernel, LocalKernel, SvdTraits>::Monge_form& monge){
-      monge.dump_verbose(out_stream);
-      return out_stream;
-    }
-};
-
-//-------------------------------------------------------------------
-// Implementation
-//------------------------------------------------------------------
-
-// Implementation nested Monge_form //////////////////////////////
-//template <class DataKernel>
-template < class DataKernel, class LocalKernel, class SvdTraits>  
-  void Monge_via_jet_fitting<DataKernel, LocalKernel, SvdTraits>::
-  Monge_form::
-set_up(std::size_t degree) {
-  if ( degree >= 2 ) std::fill_n(back_inserter(m_coefficients),
-				 (degree+1)*(degree+2)/2-4, 0.);
-}
-
-
-template < class DataKernel, class LocalKernel, class SvdTraits>  
-void Monge_via_jet_fitting<DataKernel, LocalKernel, SvdTraits>::Monge_form::
-comply_wrt_given_normal(const Vector_3& given_normal)
-{
-  if ( given_normal*this->normal_direction() < 0 )
-    {
-      normal_direction() = -normal_direction();
-      std::swap(maximal_principal_direction(), minimal_principal_direction());
-      if ( coefficients().size() >= 2) 
-	std::swap(coefficients()[0],coefficients()[1]);
-      if ( coefficients().size() >= 6) {
-	std::swap(coefficients()[2],coefficients()[5]);
-	std::swap(coefficients()[3],coefficients()[4]);}
-      if ( coefficients().size() >= 11) {
-	std::swap(coefficients()[6],coefficients()[10]);
-	std::swap(coefficients()[7],coefficients()[9]);}
-      typename std::vector<FT>::iterator itb = coefficients().begin(),
-	ite = coefficients().end();
-      for (;itb!=ite;itb++) { *itb = -(*itb); }
-    }
-}
-
-template < class DataKernel, class LocalKernel, class SvdTraits>  
-void Monge_via_jet_fitting<DataKernel, LocalKernel, SvdTraits>::Monge_form::
-dump_verbose(std::ostream& out_stream) const
-{
-  out_stream << "origin : " << origin() << std::endl
-	     << "n : " << normal_direction() << std::endl;
-  if ( coefficients().size() >= 2) 
-    out_stream << "d1 : " << maximal_principal_direction() << std::endl 
-	       << "d2 : " << minimal_principal_direction() << std::endl
-	       << "k1 : " << coefficients()[0] << std::endl 
-	       << "k2 : " << coefficients()[1] << std::endl;	      
-  if ( coefficients().size() >= 6) 
-    out_stream << "b0 : " << coefficients()[2] << std::endl 
-	       << "b1 : " << coefficients()[3] << std::endl
- 	       << "b2 : " << coefficients()[4] << std::endl
- 	       << "b3 : " << coefficients()[5] << std::endl;
-  if ( coefficients().size() >= 11) 
-    out_stream << "c0 : " << coefficients()[6] << std::endl 
-	       << "c1 : " << coefficients()[7] << std::endl
- 	       << "c2 : " << coefficients()[8] << std::endl
- 	       << "c3 : " << coefficients()[9] << std::endl 
- 	       << "c4 : " << coefficients()[10] << std::endl
-	       << std::endl; 
-}
-
-template < class DataKernel, class LocalKernel, class SvdTraits>  
-void Monge_via_jet_fitting<DataKernel, LocalKernel, SvdTraits>::Monge_form::
-dump_4ogl(std::ostream& out_stream, const FT scale)
-{
-  CGAL_precondition( coefficients().size() >= 2 );
-  out_stream << origin()  << " "
-	     << maximal_principal_direction() * scale << " "
-	     << minimal_principal_direction() * scale << " "
-	     << coefficients()[0] << " "
-	     << coefficients()[1] << " "
-	     << std::endl;
-}
-//////////////////////////////////////////////////////////////
-// Implementation main Monge_via_jet_fiting
-
-template < class DataKernel, class LocalKernel, class SvdTraits>  
-  Monge_via_jet_fitting<DataKernel, LocalKernel, SvdTraits>::
-  Monge_via_jet_fitting()
-{
-  m_pca_basis = std::vector< std::pair<FT, Vector_3> >(3);
-} 
-
-template < class DataKernel, class LocalKernel, class SvdTraits> 
-template <class InputIterator>
-  typename  Monge_via_jet_fitting<DataKernel, LocalKernel, SvdTraits>::Monge_form
-  Monge_via_jet_fitting<DataKernel, LocalKernel, SvdTraits>::
-  operator()(InputIterator begin, InputIterator end, 
-	     size_t d, size_t dprime)
-{
-  // precondition: on the degrees, jet and monge
-  CGAL_precondition( (d >=1) && (dprime >= 1) 
-		     && (dprime <= 4) && (dprime <= d) );
-  this->deg = static_cast<int>(d);
-  this->deg_monge = static_cast<int>(dprime);
-  this->nb_d_jet_coeff = static_cast<int>((d+1)*(d+2)/2);
-  this->nb_input_pts = static_cast<int>(end - begin);
-  // precondition: solvable ls system
-  CGAL_precondition( nb_input_pts >= nb_d_jet_coeff );
-
-  //Initialize
-  Monge_form monge_form;
-  monge_form.set_up(dprime);
-  //for the system MA=Z
-  LAMatrix M(nb_input_pts, nb_d_jet_coeff);
-  LAVector Z(nb_input_pts);
-
-  compute_PCA(begin, end);
-  fill_matrix(begin, end, d, M, Z);//with precond
-  solve_linear_system(M, Z);  //correct with precond
-  compute_Monge_basis(Z.vector(), monge_form);
-  if ( dprime >= 3) compute_Monge_coefficients(Z.vector(), dprime, monge_form);
-  return monge_form;
-}
-
-template < class DataKernel, class LocalKernel, class SvdTraits>  
-template <class InputIterator>
-void Monge_via_jet_fitting<DataKernel, LocalKernel, SvdTraits>::
-compute_PCA(InputIterator begin, InputIterator end)
-{
-  int n = this->nb_input_pts;
-  FT x, y, z,
-    sumX = 0., sumY = 0., sumZ = 0.,
-    sumX2 = 0., sumY2 = 0., sumZ2 = 0.,
-    sumXY = 0., sumXZ = 0., sumYZ = 0., 
-    xx, yy, zz, xy, xz, yz;
-  
-  for (; begin != end; begin++)
-    {
-      Point_3 lp = D2L_converter(*begin);
-      x = lp.x();
-      y = lp.y();
-      z = lp.z();   
-      sumX += x / n;
-      sumY += y / n;
-      sumZ += z / n;
-      sumX2 += x * x / n;
-      sumY2 += y * y / n;
-      sumZ2 += z * z / n;
-      sumXY += x * y / n;
-      sumXZ += x * z / n;
-      sumYZ += y * z / n;
-    }
-  xx = sumX2 - sumX * sumX;
-  yy = sumY2 - sumY * sumY;
-  zz = sumZ2 - sumZ * sumZ;
-  xy = sumXY - sumX * sumY;
-  xz = sumXZ - sumX * sumZ;
-  yz = sumYZ - sumY * sumZ;
-
-  // assemble covariance matrix as a
-  // semi-definite matrix. 
-  // Matrix numbering:
-  // 0 1 2
-  //   3 4
-  //     5
-  CGAL::cpp11::array<FT, 6> covariance = {{ xx,xy,xz,yy,yz,zz }};
-  CGAL::cpp11::array<FT, 3> eigen_values = {{ 0., 0., 0. }};
-  CGAL::cpp11::array<FT, 9> eigen_vectors = {{ 0., 0., 0. }};
-
-  // solve for eigenvalues and eigenvectors.
-  // eigen values are sorted in ascending order, 
-  // eigen vectors are sorted in accordance.
-  CGAL::Default_diagonalize_traits<FT,3>::diagonalize_selfadjoint_covariance_matrix
-    (covariance, eigen_values, eigen_vectors);
-
-  //store in m_pca_basis
-  for (int i=0; i<3; i++)
-    {
-      m_pca_basis[i].first =  eigen_values[2-i];
-    }
-
-  Vector_3 v1(eigen_vectors[6],eigen_vectors[7],eigen_vectors[8]);
-  m_pca_basis[0].second = v1;
-  Vector_3 v2(eigen_vectors[3],eigen_vectors[4],eigen_vectors[5]);
-  m_pca_basis[1].second = v2;
-  Vector_3 v3(eigen_vectors[0],eigen_vectors[1],eigen_vectors[2]);
-  m_pca_basis[2].second = v3;
-  switch_to_direct_orientation(m_pca_basis[0].second,
-			       m_pca_basis[1].second,
-			       m_pca_basis[2].second);
- 
-  //Store the change of basis W->F
-  Aff_transformation 
-    change_basis (m_pca_basis[0].second[0], m_pca_basis[0].second[1], m_pca_basis[0].second[2], 
-		  m_pca_basis[1].second[0], m_pca_basis[1].second[1], m_pca_basis[1].second[2],
-		  m_pca_basis[2].second[0], m_pca_basis[2].second[1], m_pca_basis[2].second[2]);
-
-   this->change_world2fitting = change_basis; 
-}
-
-template < class DataKernel, class LocalKernel, class SvdTraits>  
-template <class InputIterator>
-void Monge_via_jet_fitting<DataKernel, LocalKernel, SvdTraits>::
-fill_matrix(InputIterator begin, InputIterator end,
-	    std::size_t d, LAMatrix &M, LAVector& Z)
-{
-  //origin of fitting coord system = first input data point
-  Point_3 point0 = D2L_converter(*begin);
-  //transform coordinates of sample points with a
-  //translation ($-p$) and multiplication by $ P_{W\rightarrow F}$.
-  Point_3 orig(0.,0.,0.);
-  Vector_3 v_point0_orig(orig - point0);
-  Aff_transformation transl(CGAL::TRANSLATION, v_point0_orig);
-  this->translate_p0 = transl;
-  Aff_transformation transf_points = this->change_world2fitting *
-    this->translate_p0;
-  
-  //compute and store transformed points
-  std::vector<Point_3> pts_in_fitting_basis;
-  pts_in_fitting_basis.reserve(this->nb_input_pts);
-  CGAL_For_all(begin,end){
-    Point_3 cur_pt = transf_points(D2L_converter(*begin));
-    pts_in_fitting_basis.push_back(cur_pt);
-  }
-  
-  //Compute preconditionning
-  FT precond = 0.;
-  typename std::vector<Point_3>::iterator itb = pts_in_fitting_basis.begin(),
-    ite = pts_in_fitting_basis.end();
-  CGAL_For_all(itb,ite) precond += CGAL::abs(itb->x()) + CGAL::abs(itb->y());
-  precond /= 2*this->nb_input_pts;
-  this->preconditionning = precond;
-  //fill matrices M and Z
-  itb = pts_in_fitting_basis.begin();
-  int line_count = 0;
-  FT x, y;
-  CGAL_For_all(itb,ite) {
-    x = itb->x();
-    y = itb->y();
-    //  Z[line_count] = itb->z();
-    Z.set(line_count,itb->z());
-    for (std::size_t k=0; k <= d; k++) {
-      for (std::size_t i=0; i<=k; i++) {
-        M.set(line_count, k*(k+1)/2+i,
-              std::pow(x,static_cast<int>(k-i))
-              * std::pow(y,static_cast<int>(i))
-              /( fact(static_cast<unsigned int>(i)) *
-                 fact(static_cast<unsigned int>(k-i))
-                 *std::pow(this->preconditionning,static_cast<int>(k))));
-      }
-    }
-    line_count++;
-  }
-}
-
-template < class DataKernel, class LocalKernel, class SvdTraits>  
-void Monge_via_jet_fitting<DataKernel, LocalKernel, SvdTraits>::
-solve_linear_system(LAMatrix &M, LAVector& Z)
-{
-  condition_nb = SvdTraits::solve(M, Z); 
-  for (int k=0; k <= this->deg; k++) for (int i=0; i<=k; i++)
-    // Z[k*(k+1)/2+i] /= std::pow(this->preconditionning,k);
-    Z.set( k*(k+1)/2+i, Z(k*(k+1)/2+i) / std::pow(this->preconditionning,k) );
-}
-
-template < class DataKernel, class LocalKernel, class SvdTraits>   
-void Monge_via_jet_fitting<DataKernel, LocalKernel, SvdTraits>::
-compute_Monge_basis(const FT* A, Monge_form& monge_form)
-{
-  // only 1st order info.
-  if ( this->deg_monge == 1 ) {  
-    Point_3 orig_monge(0., 0., A[0]);
-    Vector_3  normal(-A[1], -A[2], 1.);
-    FT norm2 = normal * normal;
-    normal = normal / Lsqrt(norm2);
-    monge_form.origin() = L2D_converter(
-      (this->translate_p0.inverse() * 
-       this->change_world2fitting.inverse()) (orig_monge) );
-    monge_form.normal_direction() = L2D_converter(this->change_world2fitting.inverse()(normal));
-  }
-  // else (deg_monge >= 2) then 2nd order info are computed
-  else {
-  //bi-index to uni-index conversion : A(i,j)=A[(i+j)(i+j+1)/2+j]
-  Point_3 orig_monge(0., 0., A[0]);
-  //normal = Xu crossprod Xv
-  Vector_3 Xu(1.,0.,A[1]), Xv(0.,1.,A[2]), normal(-A[1], -A[2], 1.);
-  FT norm2 = normal * normal;
-  normal = normal / Lsqrt(norm2);
-
-  //Surface in fitting_basis : X(u,v)=(u,v,J_A(u,v))
-  //in the basis Xu=(1,0,A[1]), Xv=(0,1,A[2]), Weingarten=-I^{-1}II
-  //first fond form I=(e,f,f,g)
-  //                 =(Xu.Xu, Xu.Xv, Xu.Xv, Xv.Xv)
-  //second fond form II=(l,m,m,n)/norm2^(1/2)
-  //                   =(n.Xuu, n.Xuv, n.Xuv, n.Xvv)
-  //ppal curv are the opposite of the eigenvalues of Weingarten or the
-  //  eigenvalues of weingarten = -Weingarten = I^{-1}II
-  typedef typename CGAL::Linear_algebraCd<FT>::Matrix Matrix;
-
-  FT e = 1+A[1]*A[1], f = A[1]*A[2], g = 1+A[2]*A[2],
-    l = A[3], m = A[4], n = A[5];
-  Matrix  weingarten(2,2,0.);
-  weingarten(0,0) = (g*l-f*m)/ (Lsqrt(norm2)*norm2);
-  weingarten(0,1) = (g*m-f*n)/ (Lsqrt(norm2)*norm2);
-  weingarten(1,0) = (e*m-f*l)/ (Lsqrt(norm2)*norm2);
-  weingarten(1,1) = (e*n-f*m)/ (Lsqrt(norm2)*norm2);
-  // Y, Z are normalized GramSchmidt of Xu, Xv
-  // Xu->Y=Xu/||Xu||;
-  // Xv->Z=Xv-(Xu.Xv)Xu/||Xu||^2;
-  // Z-> Z/||Z||
-  Vector_3 Y, Z;
-  FT normXu = Lsqrt( Xu*Xu );
-  Y = Xu / normXu;
-  FT XudotXv = Xu * Xv;
-  Z = Xv - XudotXv * Xu / (normXu*normXu);
-  FT normZ = Lsqrt( Z*Z );
-  Z = Z / normZ;
-  Matrix change_XuXv2YZ(2,2,0.);
-  change_XuXv2YZ(0,0) = 1 / normXu;
-  change_XuXv2YZ(0,1) = -XudotXv / (normXu * normXu * normZ);
-  change_XuXv2YZ(1,0) = 0;
-  change_XuXv2YZ(1,1) = 1 / normZ;
-  FT det = 0.;
-  Matrix inv = CGAL::Linear_algebraCd<FT>::inverse ( change_XuXv2YZ, det );
-  //in the new orthonormal basis (Y,Z) of the tangent plane :
-  weingarten = inv *(1/det) * weingarten * change_XuXv2YZ;
-  
-  // diagonalization of weingarten
-  CGAL::cpp11::array<FT,3> W = {{ weingarten(0,0), weingarten(1,0), weingarten(1,1) }};
-  CGAL::cpp11::array<FT,2> eval = {{ 0., 0. }};
-  CGAL::cpp11::array<FT,4> evec = {{ 0., 0., 0., 0. }};
-
-  //eval in increasing order
-  CGAL::Default_diagonalize_traits<FT,2>::diagonalize_selfadjoint_covariance_matrix
-    (W, eval, evec);
-
-  Vector_3 d_max = evec[2]*Y + evec[3]*Z,
-    d_min = evec[0]*Y + evec[1]*Z;
-
-  switch_to_direct_orientation(d_max, d_min, normal);
-  Aff_transformation change_basis (d_max[0], d_max[1], d_max[2], 
-				   d_min[0], d_min[1], d_min[2],
-				   normal[0], normal[1], normal[2]);
-  this->change_fitting2monge = change_basis;
-
-  //store the monge basis origin and vectors with their world coord
-  //store ppal curv
-  monge_form.origin() = L2D_converter(
-    (this->translate_p0.inverse() * 
-     this->change_world2fitting.inverse()) (orig_monge ));
-  monge_form.maximal_principal_direction() = L2D_converter(this->change_world2fitting.inverse()(d_max));
-  monge_form.minimal_principal_direction() = L2D_converter(this->change_world2fitting.inverse()(d_min));
-  monge_form.normal_direction()  = L2D_converter(this->change_world2fitting.inverse()(normal));
-  monge_form.coefficients()[0] = L2D_NTconverter()(eval[1]);
-  monge_form.coefficients()[1] = L2D_NTconverter()(eval[0]);
-  }
-  //end else
-}
-
-template < class DataKernel, class LocalKernel, class SvdTraits>  
-void Monge_via_jet_fitting<DataKernel, LocalKernel, SvdTraits>::
-compute_Monge_coefficients(FT* A, std::size_t dprime, 
-			   Monge_form& monge_form)
-{
-  //One has the equation w=J_A(u,v) of the fitted surface S 
-  // in the fitting_basis
-  //Substituing (u,v,w)=change_fitting2monge^{-1}(x,y,z)
-  //One has the equation f(x,y,z)=0 on this surface S in the monge
-  //  basis
-  //The monge form of the surface at the origin is the bivariate fct
-  //   g(x,y) s.t. f(x,y,g(x,y))=0
-  //voir les calculs Maple dans monge.mws
-  //Notations are f123= d^3f/dxdydz
-  //              g(x,y)=sum (gij x^i y^j/ i!j!) with 
-  //              g00=g10=g01=g11=0, g20=kmax, g02=kmin
-  //
-  //g(x,y)= 1/2*(k1x^2 +k2y^2) 
-  //       +1/6*(b0x^3 +3b1x^2y +3b2xy^2 +b3y^3) 
-  //       +1/24*(c0x^4 +4c1x^3y +6c2x^2y^2 +4c3xy^3 +c4y^4)
-  //       +...
-  // p stores change_fitting2monge^{-1}=change_fitting2monge^{T}
-  FT p[3][3];
-  p[0][0] = this->change_fitting2monge.m(0,0);
-  p[1][0] = this->change_fitting2monge.m(0,1);
-  p[2][0] = this->change_fitting2monge.m(0,2);
-  p[0][1] = this->change_fitting2monge.m(1,0);
-  p[1][1] = this->change_fitting2monge.m(1,1);
-  p[2][1] = this->change_fitting2monge.m(1,2);
-  p[0][2] = this->change_fitting2monge.m(2,0);
-  p[1][2] = this->change_fitting2monge.m(2,1);
-  p[2][2] = this->change_fitting2monge.m(2,2);
-
-  // formula are designed for w=sum( Aij ui vj), but we have J_A = sum( Aij/i!j! ui vj)
-  for (int k=0; k <= this->deg; k++) for (int i=0; i<=k; i++)
-    A[k*(k+1)/2+i] /= fact(k-i)*fact(i);//this is A(k-i;i)
-
-/*   //debug */
-/*   std::cout << "coeff of A" << std::endl */
-/* 	    << A[0] << " "<< A[1] << " "<< A[2] << std::endl */
-/* 	    << A[3] << " "<< A[4] << " "<< A[5] << std::endl */
-/* 	    << A[6] << " "<< A[7] << " "<< A[8] << " "<< A[9]<< std::endl */
-/* 	    << A[10] << " "<< A[11] << " "<< A[12] << " "<< A[13]<< " " << A[14] << std::endl; */
-
-
-
-  //     note f1 = f2 = f12 = 0 
-  //     FT f1 = A[1] * p[0][0] + A[2] * p[1][0] - p[2][0];
-  //     FT f2 = A[2] * p[1][1] + A[1] * p[0][1] - p[2][1];
-  //     FT f12 = 
-  //     2 * A[3] * p[0][0] * p[0][1]
-  //     + 2 * A[5] * p[1][0] * p[1][1]
-  //     + A[4] * p[0][1] * p[1][0] 
-  //     + A[4] * p[0][0] * p[1][1];
-  //         -f11 / f3 = kmax
-  //         -f22 / f3 = kmin 
- 
-  FT f3 = A[1] * p[0][2] + A[2] * p[1][2] - p[2][2];
-  FT f11 =
-    2 * A[4] * p[0][0] * p[1][0]
-    + 2 * A[5] * p[1][0] * p[1][0]
-    + 2 * A[3] * p[0][0] * p[0][0];
-  FT f13 =
-    A[4] * p[0][0] * p[1][2]
-    + A[4] * p[0][2] * p[1][0]
-    + 2 * A[5] * p[1][0] * p[1][2]
-    + 2 * A[3] * p[0][0] * p[0][2];
-  FT f22 =
-    2 * A[4] * p[0][1] * p[1][1]
-    + 2 * A[5] * p[1][1] * p[1][1]
-    + 2 * A[3] * p[0][1] * p[0][1];
-  FT f23 =
-    A[4] * p[0][1] * p[1][2]
-    + 2 * A[5] * p[1][1] * p[1][2]
-    + A[4] * p[0][2] * p[1][1]
-    + 2 * A[3] * p[0][1] * p[0][2];
-  FT f33 =
-    2 * A[5] * p[1][2] * p[1][2]
-    + 2 * A[3] * p[0][2] * p[0][2]
-    + 2 * A[4] * p[0][2] * p[1][2];
-  FT f111 =
-    6 * A[8] * p[0][0] * p[1][0] * p[1][0]
-    + 6 * A[7] * p[0][0] * p[0][0] * p[1][0]
-    + 6 * A[6] * p[0][0] * p[0][0] * p[0][0]
-    + 6 * A[9] * p[1][0] * p[1][0] * p[1][0];
-  FT f222 =
-    6 * A[7] * p[0][1] * p[0][1] * p[1][1]
-    + 6 * A[8] * p[0][1] * p[1][1] * p[1][1]
-    + 6 * A[9] * p[1][1] * p[1][1] * p[1][1]
-    + 6 * A[6] * p[0][1] * p[0][1] * p[0][1];
-  FT f112 =
-    2 * A[7] * p[0][0] * p[0][0] * p[1][1]
-    + 6 * A[6] * p[0][0] * p[0][0] * p[0][1]
-    + 2 * A[8] * p[0][1] * p[1][0] * p[1][0]
-    + 4 * A[8] * p[0][0] * p[1][0] * p[1][1]
-    + 6 * A[9] * p[1][0] * p[1][0] * p[1][1]
-    + 4 * A[7] * p[0][0] * p[0][1] * p[1][0];
-  FT f122 =
-    4 * A[8] * p[0][1] * p[1][0] * p[1][1]
-    + 2 * A[8] * p[0][0] * p[1][1] * p[1][1]
-    + 6 * A[6] * p[0][0] * p[0][1] * p[0][1]
-    + 2 * A[7] * p[0][1] * p[0][1] * p[1][0]
-    + 4 * A[7] * p[0][0] * p[0][1] * p[1][1]
-    + 6 * A[9] * p[1][0] * p[1][1] * p[1][1];
-  FT f113 = 
-    6*A[6]*p[0][0]*p[0][0]*p[0][2]
-    +6*A[9]*p[1][0]*p[1][0]*p[1][2]
-    +2*A[7]*p[0][0]*p[0][0]*p[1][2]
-    +2*A[8]*p[0][2]*p[1][0]*p[1][0]
-    +4*A[7]*p[0][0]*p[0][2]*p[1][0]
-    +4*A[8]*p[0][0]*p[1][0]*p[1][2];
-  FT f223 = 
-    2*A[8]*p[0][2]*p[1][1]*p[1][1]
-    +6*A[6]*p[0][1]*p[0][1]*p[0][2]
-    +6*A[9]*p[1][1]*p[1][1]*p[1][2]
-    +2*A[7]*p[0][1]*p[0][1]*p[1][2]
-    +4*A[7]*p[0][1]*p[0][2]*p[1][1]
-    +4*A[8]*p[0][1]*p[1][1]*p[1][2];
-  FT f123 = 
-    2*A[8]*p[0][2]*p[1][0]*p[1][1]
-    +2*A[7]*p[0][0]*p[0][1]*p[1][2]
-    +2*A[7]*p[0][0]*p[0][2]*p[1][1]
-    +6*A[9]*p[1][0]*p[1][1]*p[1][2]
-    +2*A[7]*p[0][1]*p[0][2]*p[1][0]
-    +6*A[6]*p[0][0]*p[0][1]*p[0][2]
-    +2*A[8]*p[0][0]*p[1][1]*p[1][2]
-    +2*A[8]*p[0][1]*p[1][0]*p[1][2];
-
-  FT b0 = 1/(f3*f3)*(-f111*f3+3*f13*f11);
-  FT b1 = 1/(f3*f3)*(-f112*f3+f23*f11);
-  FT b2 = 1/(f3*f3)*(-f122*f3+f13*f22);
-  FT b3 = -1/(f3*f3)*(f222*f3-3*f23*f22);
-  
-  monge_form.coefficients()[2] = L2D_NTconverter()(b0);
-  monge_form.coefficients()[3] = L2D_NTconverter()(b1);
-  monge_form.coefficients()[4] = L2D_NTconverter()(b2);
-  monge_form.coefficients()[5] = L2D_NTconverter()(b3);
-
-  if ( dprime == 4 )
-    {
-      FT f1111 = 
-	24*A[13]*p[0][0]*p[1][0]*p[1][0]*p[1][0]
-	+24*A[12]*p[0][0]*p[0][0]*p[1][0]*p[1][0]
-	+24*A[11]*p[0][0]*p[0][0]*p[0][0]*p[1][0]
-	+24*A[14]*p[1][0]*p[1][0]*p[1][0]*p[1][0]
-	+24*A[10]*p[0][0]*p[0][0]*p[0][0]*p[0][0];
-      FT f1112 = 
-	6*A[13]*p[0][1]*p[1][0]*p[1][0]*p[1][0]
-	+18*A[13]*p[0][0]*p[1][0]*p[1][0]*p[1][1]
-	+24*A[10]*p[0][0]*p[0][0]*p[0][0]*p[0][1]
-	+12*A[12]*p[0][0]*p[0][1]*p[1][0]*p[1][0]
-	+18*A[11]*p[0][0]*p[0][0]*p[0][1]*p[1][0]
-	+24*A[14]*p[1][0]*p[1][0]*p[1][0]*p[1][1]
-	+6*A[11]*p[0][0]*p[0][0]*p[0][0]*p[1][1]
-	+12*A[12]*p[0][0]*p[0][0]*p[1][0]*p[1][1];
-      FT f1122 = 
-	12*A[11]*p[0][0]*p[0][0]*p[0][1]*p[1][1]
-	+12*A[13]*p[0][0]*p[1][0]*p[1][1]*p[1][1]
-	+12*A[13]*p[0][1]*p[1][0]*p[1][0]*p[1][1]
-	+16*A[12]*p[0][0]*p[0][1]*p[1][0]*p[1][1]
-	+12*A[11]*p[0][0]*p[0][1]*p[0][1]*p[1][0]
-	+24*A[10]*p[0][0]*p[0][0]*p[0][1]*p[0][1]
-	+4*A[12]*p[0][1]*p[0][1]*p[1][0]*p[1][0]
-	+4*A[12]*p[0][0]*p[0][0]*p[1][1]*p[1][1]
-	+24*A[14]*p[1][0]*p[1][0]*p[1][1]*p[1][1];
-      FT f1222 = 
-	6*A[13]*p[0][0]*p[1][1]*p[1][1]*p[1][1]
-	+24*A[10]*p[0][0]*p[0][1]*p[0][1]*p[0][1]
-	+24*A[14]*p[1][0]*p[1][1]*p[1][1]*p[1][1]
-	+6*A[11]*p[0][1]*p[0][1]*p[0][1]*p[1][0]
-	+18*A[11]*p[0][0]*p[0][1]*p[0][1]*p[1][1]
-	+12*A[12]*p[0][0]*p[0][1]*p[1][1]*p[1][1]
-	+12*A[12]*p[0][1]*p[0][1]*p[1][0]*p[1][1]
-	+18*A[13]*p[0][1]*p[1][0]*p[1][1]*p[1][1];
-      FT f2222 =
-	24*A[13]*p[0][1]*p[1][1]*p[1][1]*p[1][1]
-	+24*A[11]*p[0][1]*p[0][1]*p[0][1]*p[1][1]
-	+24*A[12]*p[0][1]*p[0][1]*p[1][1]*p[1][1]
-	+24*A[10]*p[0][1]*p[0][1]*p[0][1]*p[0][1]
-	+24*A[14]*p[1][1]*p[1][1]*p[1][1]*p[1][1];
-
-      FT c0 =
-	-1/(f3*f3*f3)*(f1111*(f3*f3)-4*f13*f3*f111+12*f13*f13*f11-6*f113*f3*f11+3*f33*f11*f11);
-      FT c1 =
-	1/(f3*f3*f3)*(f23*f3*f111+3*f3*f123*f11+3*f13*f3*f112-f1112*(f3*f3)-6*f13*f23*f11); 
-      FT c2 =
-	1/(f3*f3*f3)*(-f33*f22*f11+f113*f3*f22+2*f13*f3*f122-2*f13*f13*f22+f223*f3*f11+2*f23*f3*f112-2*f23*f23*f11-f1122*(f3*f3)); 
-      FT c3 =
-	1/(f3*f3*f3)*(-f1222*(f3*f3)-6*f13*f23*f22+3*f123*f3*f22+f13*f3*f222+3*f23*f3*f122); 
-      FT c4 =
-	-1/(f3*f3*f3)*(f2222*(f3*f3)+3*f33*f22*f22-6*f223*f3*f22-4*f23*f3*f222+12*f23*f23*f22) ; 
-      
-      monge_form.coefficients()[6] = L2D_NTconverter()(c0);
-      monge_form.coefficients()[7] = L2D_NTconverter()(c1);
-      monge_form.coefficients()[8] = L2D_NTconverter()(c2);
-      monge_form.coefficients()[9] = L2D_NTconverter()(c3);
-      monge_form.coefficients()[10] = L2D_NTconverter()(c4);
-    }
-}
-
-template < class DataKernel, class LocalKernel, class SvdTraits>  
-void Monge_via_jet_fitting<DataKernel, LocalKernel, SvdTraits>::
-switch_to_direct_orientation(Vector_3& v1, const Vector_3& v2,
-			    const Vector_3& v3) 
-{
-  if (CGAL::orientation (v1, v2, v3) == CGAL::NEGATIVE)
-    v1 = -v1;
-}
-
-
-// template < class DataKernel, class LocalKernel, class SvdTraits>  
-// inline
-// std::ostream&
-// operator<<(std::ostream& out_stream, 
-// 	  const typename Monge_via_jet_fitting<DataKernel, LocalKernel, SvdTraits>::Monge_form& monge)
-// {
-//   monge.dump_verbose(out_stream);
-//   return out_stream;
-// }
-
-} //namespace CGAL
-
-#endif //CGAL_MONGE_VIA_JET_FITTING_H_
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mpzf.h b/3rdparty/CGAL-4.8/include/CGAL/Mpzf.h
deleted file mode 100644
index 55ceb4e..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Mpzf.h
+++ /dev/null
@@ -1,1161 +0,0 @@
-// Copyright (c) 2013
-// INRIA Saclay - Ile de France (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.
-//
-// Author(s)	:  Marc Glisse
-
-#ifndef CGAL_MPZF_H
-#define CGAL_MPZF_H
-#include <cstdlib>
-#include <algorithm>
-#include <climits>
-#include <vector>
-#include <math.h>
-#include <cmath>
-#include <iostream>
-#include <stdexcept>
-#ifdef CGAL_USE_GMPXX
-# include <CGAL/gmpxx.h>
-#else
-# include <CGAL/gmp.h>
-#endif
-#include <CGAL/enum.h>
-#include <CGAL/Interval_nt.h>
-#include <CGAL/Gmpz.h>
-#include <CGAL/Gmpq.h>
-//#include <CGAL/Gmpzf.h>
-
-#include <CGAL/Coercion_traits.h>
-
-// The following is currently assumed in several places. I hope I am not
-// making too many other assumptions.
-// * limbs are 64 bits
-// * if using gcc, sizeof(long long)==8
-// * mpn_neg(_n) exists
-// * IEEE double
-// * not too fancy endianness
-#if !defined(CGAL_DO_NOT_USE_MPZF) \
-    && __GNU_MP_VERSION * 10 + __GNU_MP_VERSION_MINOR >= 43 \
-    && GMP_NUMB_BITS == 64
-#define CGAL_HAS_MPZF 1
-
-// GMP-4.3.* has a different name for mpn_neg.
-#ifndef mpn_neg
-#define mpn_neg mpn_neg_n
-#endif
-// GMP-4.3.0 is missing mpn_sqr.
-#ifndef mpn_sqr
-#define mpn_sqr(dest,a,n) mpn_mul_n(dest,a,a,n)
-#endif
-// GMP before 5.0 doesn't provide mpn_copyi.
-#ifndef mpn_copyi
-#define mpn_copyi(dst, src, siz) std::copy((src), (src)+(siz), (dst))
-#endif
-
-#include <boost/cstdint.hpp>
-
-#ifdef _MSC_VER
-#include <intrin.h>
-#pragma intrinsic(_BitScanForward64)
-#pragma intrinsic(_BitScanReverse64)
-#endif
-
-#ifdef __xlC__
-#include <builtins.h>
-#endif
-
-#include <CGAL/assertions.h>
-#include <boost/config.hpp>
-#include <boost/detail/workaround.hpp>
-#include <boost/version.hpp>
-
-#if defined(BOOST_MSVC)
-#  pragma warning(push)
-#  pragma warning(disable:4146 4244 4267 4800)
-     // warning on - applied on unsigned number
-     // conversion with loss of data
-     // conversion with loss of data
-     // int to bool performance
-#endif
-
-
-/*
-#ifdef CGAL_MPZF_NO_USE_CACHE
-# ifdef CGAL_MPZF_USE_CACHE
-#  undef CGAL_MPZF_USE_CACHE
-# endif
-#else
-# if !defined(CGAL_MPZF_USE_CACHE) \
-     && defined(CGAL_HAS_THREADS) \
-     && !defined(CGAL_I_PROMISE_I_WONT_USE_MANY_THREADS)
-#  define CGAL_MPZF_USE_CACHE 1
-# endif
-#endif
-*/
-#define CGAL_MPZF_USE_CACHE 1
-
-// On a dataset provided by Andreas, replacing Gmpq with this type in
-// Epick reduced the running time of the construction of a Delaunay
-// triangulation by a factor larger than 6
-
-#if !defined(CGAL_HAS_THREADS)
-#define CGAL_MPZF_THREAD_LOCAL
-#define CGAL_MPZF_TLS
-#elif defined(CGAL_CAN_USE_CXX11_THREAD_LOCAL)
-#define CGAL_MPZF_THREAD_LOCAL thread_local
-#define CGAL_MPZF_TLS thread_local
-#elif defined(_MSC_VER)
-#define CGAL_MPZF_THREAD_LOCAL __declspec(thread)
-#define CGAL_MPZF_TLS
-#else
-#define CGAL_MPZF_THREAD_LOCAL __thread
-#define CGAL_MPZF_TLS
-// Too bad for the others
-#endif
-namespace CGAL {
-namespace Mpzf_impl {
-// Warning: these pools aren't generic at all!
-
-// Not thread-safe
-template <class T, class = void> struct pool1 {
-  static T pop() { T ret = data.back(); data.pop_back(); return ret; }
-  static void push(T t) { data.push_back(t); }
-  static bool empty() { return data.empty(); }
-  static const int extra = 0;
-  private:
-  // thread_local would be fine, but not __declspec(thread) and for most
-  // compilers not __thread, since data is not POD.
-  static std::vector<T> data;
-};
-template <class T, class D> std::vector<T> pool1<T,D>::data;
-
-// Use an intrusive single-linked list instead (allocate one more limb and use
-// it to store the pointer to next), the difference isn't that noticable (still
-// the list wins).  Neither is thread-safe (both can be with threadlocal, and
-// the list can be with an atomic compare-exchange (never tried)).  With gcc,
-// TLS has a large effect on classes with constructor/destructor, but is free
-// for a simple pointer.  The slowdown is because of PR55812.
-
-// Leaks at thread destruction
-template <class T, class = void> struct pool2 {
-  static T pop() { T ret = data(); data() = ptr(data()); return ret; }
-  static void push(T t) { ptr(t) = data(); data() = t; }
-  static bool empty() { return data() == 0; }
-  static const int extra = 1; // TODO: handle the case where a pointer is larger than a mp_limb_t
-  private:
-  CGAL_static_assertion(sizeof(T) >= sizeof(T*));
-  static T& data () {
-    static CGAL_MPZF_TLS T data_ = 0;
-    return data_;
-  }
-  static T& ptr(T t) { t -= extra+1; return *reinterpret_cast<T*>(t); }
-};
-
-#if defined(CGAL_CAN_USE_CXX11_THREAD_LOCAL)
-template <class T, class = void> struct pool3 {
-  static T pop() { T ret = data(); data() = ptr(data()); return ret; }
-  static void push(T t) { ptr(t) = data(); data() = t; }
-  static bool empty() { return data() == 0; }
-  static const int extra = 1; // TODO: handle the case where a pointer is larger than a mp_limb_t
-  private:
-  CGAL_static_assertion(sizeof(T) >= sizeof(T*));
-  struct cleaner {
-    T data_ = 0;
-    ~cleaner(){
-      // Deallocate everything. As an alternative, we could store it in a
-      // global location, for re-use by a later thread.
-      while (!empty())
-	delete[] (pop() - (extra + 1));
-    }
-  };
-  static T& data () {
-    static thread_local cleaner obj;
-    return obj.data_;
-  }
-  static T& ptr(T t) { t -= extra+1; return *reinterpret_cast<T*>(t); }
-};
-#endif
-
-// No caching
-template <class T, class = void> struct no_pool {
-  static T pop() { throw "Shouldn't be here!"; }
-  static void push(T t) { delete [] (t - (extra+1)); }
-  static bool empty() { return true; }
-  static const int extra = 0;
-};
-
-// Only used with an argument known not to be 0.
-inline int ctz (boost::uint64_t x) {
-#if defined(_MSC_VER)
-  unsigned long ret;
-  _BitScanForward64(&ret, x);
-  return (int)ret;
-#elif defined(__xlC__)
-  return __cnttz8 (x);
-#else
-  // Assume long long is 64 bits
-  return __builtin_ctzll (x);
-#endif
-}
-inline int clz (boost::uint64_t x) {
-#if defined(_MSC_VER)
-  unsigned long ret;
-  _BitScanReverse64(&ret, x);
-  return 63 - (int)ret;
-#elif defined(__xlC__)
-  // Macro supposedly not defined on z/OS.
-  return __cntlz8 (x);
-#else
-  return __builtin_clzll (x);
-#endif
-}
-
-// In C++11, std::fill_n returns a pointer to the end, but in C++03,
-// it returns void.
-inline mp_limb_t* fill_n_ptr(mp_limb_t* p, int n, int c) {
-#if __cplusplus >= 201103L
-  return std::fill_n (p, n, c);
-#else
-  mp_limb_t* q = p + n;
-  std::fill (p, q, c);
-  //std::fill_n (p, n, c);
-  //memset (p, sizeof(mp_limb_t)*n, c);
-  return q;
-#endif
-}
-} // namespace Mpzf_impl
-
-#undef CGAL_MPZF_THREAD_LOCAL
-#undef CGAL_MPZF_TLS
-
-// TODO:
-// * make data==0 a valid state for number 0. Incompatible with the cache. I
-//   tried, and it doesn't seem to help (may even hurt a bit).
-struct Mpzf {
-  private:
-#ifdef CGAL_MPZF_USE_CACHE
-  // More experiments to determine the best value would be good. It likely
-  // depends on the usage. Note that pool2 is fast enough that a conditional
-  // cache slows it down. A purely static cache (crash if it isn't large
-  // enough) still wins by about 11% on the Delaunay_3 construction, but is
-  // more complicated to handle.
-  // Evaluating a polynomial in double will never require more than roughly
-  // (2100*degree) bits, or (33*degree) mp_limb_t, which is very small. I
-  // checked by including an array of 150 limbs in every Mpzf (that's where
-  // the 11% number comes from).
-  // BONUS: doing that is thread-safe!
-  static const unsigned int cache_size = 8;
-#endif
-//#if !defined(CGAL_HAS_THREADS) || defined(CGAL_I_PROMISE_I_WONT_USE_MANY_THREADS)
-//  typedef Mpzf_impl::pool2<mp_limb_t*,Mpzf> pool;
-//#elif defined(CGAL_CAN_USE_CXX11_THREAD_LOCAL)
-//  typedef Mpzf_impl::pool3<mp_limb_t*,Mpzf> pool;
-//#else
-  typedef Mpzf_impl::no_pool<mp_limb_t*,Mpzf> pool;
-//#endif
-
-  mp_limb_t* data_; /* data_[0] is never 0 (except possibly for 0). */
-  inline mp_limb_t*& data() { return data_; };
-  inline mp_limb_t const* data() const { return data_; };
-
-#ifdef CGAL_MPZF_USE_CACHE
-  mp_limb_t cache[cache_size + 1];
-#endif
-  int size; /* Number of relevant limbs in data_. */
-  int exp; /* The number is data_ (an integer) * 2 ^ (64 * exp). */
-
-  struct allocate{};
-  struct noalloc{};
-
-  void init(unsigned mini=2){
-#ifdef CGAL_MPZF_USE_CACHE
-    if (mini <= cache_size) {
-      cache[0] = cache_size;
-      data() = cache + 1;
-      return;
-    }
-#endif
-    if(!pool::empty()){
-      data() = pool::pop();
-      if(data()[-1] >= mini) return; // TODO: when mini==2, no need to check
-      delete[] (data() - (pool::extra+1)); // too small, useless
-    }
-    if(mini<2) mini=2;
-    data() = (new mp_limb_t[mini+(pool::extra+1)]) + (pool::extra+1);
-    data()[-1] = mini;
-  }
-  void clear(){
-    while(*--data()==0); // in case we skipped final zeroes
-#ifdef CGAL_MPZF_USE_CACHE
-    if (data() == cache) return;
-#endif
-    ++data();
-    pool::push(data());
-  }
-
-  Mpzf(noalloc){}
-  Mpzf(allocate,int i) { init(i); }
-
-  public:
-
-  static void clear_pool () {
-    while (!pool::empty())
-      delete[] (pool::pop() - (pool::extra + 1));
-  }
-
-  ~Mpzf(){
-    clear();
-  }
-  Mpzf(): size(0), exp(0) {
-    init();
-  }
-  Mpzf& operator=(Mpzf const& x){
-    unsigned asize=std::abs(x.size);
-    if(asize==0) { exp=0; size=0; return *this; }
-    if(this==&x) return *this;
-    while(*--data()==0); // factor that code somewhere?
-    if(*data()<asize){
-#ifdef CGAL_MPZF_USE_CACHE
-      if (data() != cache)
-#endif
-	delete[] (data() - pool::extra);
-      init(asize);
-    } else ++data();
-    size=x.size;
-    exp=x.exp;
-    mpn_copyi(data(),x.data(),asize);
-    return *this;
-  }
-  Mpzf(Mpzf const& x){
-    int asize=std::abs(x.size);
-    init(asize);
-    size=x.size;
-    exp=x.exp;
-    if(size!=0) mpn_copyi(data(),x.data(),asize);
-  }
-#if !defined(CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE) \
-    && !defined(CGAL_MPZF_USE_CACHE)
-  Mpzf(Mpzf&& x):data_(x.data()),size(x.size),exp(x.exp){
-    x.init(); // yes, that's a shame...
-    x.size = 0;
-    x.exp = 0;
-  }
-  Mpzf& operator=(Mpzf&& x){
-    std::swap(size,x.size);
-    exp = x.exp;
-    std::swap(data(),x.data());
-    return *this;
-  }
-  friend Mpzf operator-(Mpzf&& x){
-    Mpzf ret = std::move(x);
-    ret.size = -ret.size;
-    return ret;
-  }
-#endif
-  Mpzf(int i) : exp(0) {
-    // assume that int is smaller than mp_limb_t
-    init();
-    if      (i == 0)    { size = 0; }
-    else if (i >  0)    { size = 1; data()[0] = i; }
-    else /* (i <  0) */ { size =-1; data()[0] = -(mp_limb_t)i; }
-    // cast to mp_limb_t because -INT_MIN is undefined
-  }
-  Mpzf(unsigned int i) : exp(0) {
-    // assume that int is smaller than mp_limb_t
-    init();
-    if      (i == 0)    { size = 0; }
-    else /* (i >  0) */ { size = 1; data()[0] = i; }
-  }
-  Mpzf(long i) : exp(0) {
-    // assume that long is smaller than mp_limb_t
-    init();
-    if      (i == 0)    { size = 0; }
-    else if (i >  0)    { size = 1; data()[0] = i; }
-    else /* (i <  0) */ { size =-1; data()[0] = -(mp_limb_t)i; }
-    // cast to mp_limb_t because -LONG_MIN is undefined
-  }
-  Mpzf(unsigned long i) : exp(0) {
-    // assume that long is smaller than mp_limb_t
-    init();
-    if      (i == 0)    { size = 0; }
-    else /* (i >  0) */ { size = 1; data()[0] = i; }
-  }
-  Mpzf(double d){
-    init();
-    using boost::uint64_t;
-    union {
-#ifdef CGAL_LITTLE_ENDIAN
-      struct { uint64_t man:52; uint64_t exp:11; uint64_t sig:1; } s;
-#else /* CGAL_BIG_ENDIAN */
-      //WARNING: untested!
-      struct { uint64_t sig:1; uint64_t exp:11; uint64_t man:52; } s;
-#endif
-      double d;
-    } u;
-    u.d = d;
-    uint64_t m;
-    uint64_t dexp = u.s.exp;
-    CGAL_assertion_msg(dexp != 2047, "Creating an Mpzf from infinity or NaN.");
-    if (dexp == 0) {
-      if (d == 0) { size=0; exp=0; return; }
-      else { // denormal number
-	m = u.s.man;
-	++dexp;
-      }
-    } else {
-      m = (1LL<<52) | u.s.man;
-    }
-    int e1 = (int)dexp+13;
-    // FIXME: make it more general! But not slower...
-    CGAL_static_assertion(GMP_NUMB_BITS == 64);
-    int e2 = e1 % 64;
-    exp = e1 / 64 - 17;
-    // 52+1023+13==17*64 ?
-#if 0
-    // This seems very slightly faster
-    if(Mpzf_impl::ctz(m)+e2>=64){
-      data()[0] = m >> (64-e2);
-      size = 1;
-      ++exp;
-    }else{
-      data()[0] = m << e2;
-      if(e2>11){ // Wrong test for denormals
-	data()[1] = m >> (64-e2);
-	size = 2;
-      } else {
-	size = 1;
-      }
-    }
-#else
-    mp_limb_t d0 = (m << e2) & GMP_NUMB_MASK;
-    mp_limb_t d1 = 0;
-    if (e2 != 0) // shifting by 64 is UB
-      d1 = m >> (GMP_NUMB_BITS - e2);
-    if (d0 == 0) {
-      data()[0] = d1;
-      size = 1;
-      ++exp;
-    }
-    else {
-      data()[0] = d0;
-      if (d1 == 0) {
-	size = 1;
-      }
-      else {
-	data()[1] = d1;
-	size = 2;
-      }
-    }
-#endif
-    if(u.s.sig) size=-size;
-    //CGAL_assertion(to_double()==IA_force_to_double(d));
-  }
-
-#ifdef CGAL_USE_GMPXX
-  Mpzf(mpz_class const&z){
-    init_from_mpz_t(z.get_mpz_t());
-  }
-#endif
-  Mpzf(Gmpz const&z){
-    init_from_mpz_t(z.mpz());
-  }
-  void init_from_mpz_t(mpz_t const z){
-    exp=mpz_scan1(z,0)/GMP_NUMB_BITS;
-    size=mpz_size(z)-exp;
-    init(size);
-    mpn_copyi(data(),z->_mp_d+exp,size);
-  }
-
-#if 0
-  // For debug purposes only
-  void print()const{
-    //std::cout << "size: " << size << std::endl;
-    if(size==0) { std::cout << "zero\n"; return; }
-    if(size<0) std::cout << "- ";
-    int asize = std::abs(size);
-    std::cout << std::hex;
-    while(--asize>=0) { std::cout << data()[asize] << ' '; }
-    std::cout << std::dec << "exp " << exp << ' ';
-    std::cout << std::dec << "size " << size << ' ';
-    asize = std::abs(size);
-    std::cout << "double: " << std::ldexp((double)data()[asize-1],64*(exp+asize-1))*((size<0)?-1:1) << '\n';
-  }
-#endif
-
-  friend int Mpzf_abscmp(Mpzf const&a, Mpzf const&b){
-    int asize=std::abs(a.size);
-    int bsize=std::abs(b.size);
-    // size==0 should mean exp==-infinity, like with double.
-    // Since it doesn't, test for it explicitly.
-    if (bsize == 0) return asize;
-    if (asize == 0) return -1;
-    int ah=asize+a.exp;
-    int bh=bsize+b.exp;
-    if(ah!=bh) return ah-bh;
-    int minsize=(std::min)(asize,bsize);
-    const mp_limb_t* adata=a.data()+(asize-1);
-    const mp_limb_t* bdata=b.data()+(bsize-1);
-    for(int i=0;i<minsize;++i,--adata,--bdata){
-      const mp_limb_t aa=*adata;
-      const mp_limb_t bb=*bdata;
-      if(aa!=bb) return (aa<bb)?-1:1;
-    }
-    return asize-bsize; // this assumes that we get rid of trailing zeros...
-  }
-  friend int Mpzf_cmp (Mpzf const&a, Mpzf const&b){
-    if ((a.size ^ b.size) < 0) return (a.size < 0) ? -1 : 1;
-    int res = Mpzf_abscmp(a, b);
-    return (a.size < 0) ? -res : res;
-  }
-  friend bool operator<(Mpzf const&a, Mpzf const&b){
-    if((a.size ^ b.size) < 0) return a.size < 0;
-    return ((a.size < 0) ? Mpzf_abscmp(b, a) : Mpzf_abscmp(a, b)) < 0;
-  }
-  friend bool operator>(Mpzf const&a, Mpzf const&b){
-    return b<a;
-  }
-  friend bool operator>=(Mpzf const&a, Mpzf const&b){
-    return !(a<b);
-  }
-  friend bool operator<=(Mpzf const&a, Mpzf const&b){
-    return !(a>b);
-  }
-  friend bool operator==(Mpzf const&a, Mpzf const&b){
-    if (a.exp != b.exp || a.size != b.size) return false;
-    if (a.size == 0) return true;
-    return mpn_cmp(a.data(), b.data(), std::abs(a.size)) == 0;
-  }
-  friend bool operator!=(Mpzf const&a, Mpzf const&b){
-    return !(a==b);
-  }
-  private:
-  static Mpzf aors(Mpzf const&a, Mpzf const&b, int bsize){
-    Mpzf res=noalloc();
-    if(bsize==0){
-      int size=std::abs(a.size);
-      res.init(size);
-      res.exp=a.exp;
-      res.size=a.size;
-      if(size!=0) mpn_copyi(res.data(),a.data(),size);
-      return res;
-    }
-    int asize=a.size;
-    if(asize==0){
-      int size=std::abs(bsize);
-      res.init(size);
-      res.exp=b.exp;
-      res.size=bsize;
-      mpn_copyi(res.data(),b.data(),size);
-      return res;
-    }
-    if((asize^bsize)>=0){
-      // Addition
-      int absasize=std::abs(asize);
-      int absbsize=std::abs(bsize);
-      const mp_limb_t* adata=a.data();
-      const mp_limb_t* bdata=b.data();
-      int aexp=a.exp;
-      int bexp=b.exp;
-      if(aexp<bexp){ res.exp=a.exp; aexp=0; bexp=b.exp-a.exp; }
-      else { res.exp=b.exp; aexp=a.exp-b.exp; bexp=0; }
-      res.init((std::max)(absasize+aexp,absbsize+bexp)+1);
-      mp_limb_t* rdata=res.data();
-      res.size=0;
-      // TODO: if aexp>0, swap a and b so we don't repeat the code.
-      if(0<bexp){
-	if(absasize<=bexp){ // no overlap
-	  mpn_copyi(rdata, adata, absasize);
-	  rdata+=absasize;
-	  rdata=Mpzf_impl::fill_n_ptr(rdata,bexp-absasize,0);
-	  mpn_copyi(rdata, bdata, absbsize);
-	  res.size=absbsize+bexp;
-	  if(bsize<0) res.size=-res.size;
-	  return res;
-	} else {
-	  mpn_copyi(rdata, adata, bexp);
-	  adata+=bexp;
-	  absasize-=bexp;
-	  rdata+=bexp;
-	  res.size=bexp;
-	}
-      }
-      else if(0<aexp){
-	if(absbsize<=aexp){ // no overlap
-	  mpn_copyi(rdata, bdata, absbsize);
-	  rdata+=absbsize;
-	  rdata=Mpzf_impl::fill_n_ptr(rdata,aexp-absbsize,0);
-	  mpn_copyi(rdata, adata, absasize);
-	  res.size=absasize+aexp;
-	  if(asize<0) res.size=-res.size;
-	  return res;
-	} else {
-	  mpn_copyi(rdata, bdata, aexp);
-	  bdata+=aexp;
-	  absbsize-=aexp;
-	  rdata+=aexp;
-	  res.size=aexp;
-	}
-      }
-      if(absasize>=absbsize){
-	mp_limb_t carry=mpn_add(rdata,adata,absasize,bdata,absbsize);
-	res.size+=absasize;
-	if(carry!=0){
-	  res.size++;
-	  rdata[absasize]=carry;
-	}
-      } else {
-	mp_limb_t carry=mpn_add(rdata,bdata,absbsize,adata,absasize);
-	res.size+=absbsize;
-	if(carry!=0){
-	  res.size++;
-	  rdata[absbsize]=carry;
-	}
-      }
-      // unnecessary if a.exp != b.exp
-      while(/*res.size>0&&*/res.data()[0]==0){--res.size;++res.data();++res.exp;}
-      if(bsize<0) res.size=-res.size;
-    } else {
-      // Subtraction
-      const Mpzf *x, *y;
-      int xsize=a.size;
-      int ysize=bsize;
-      int cmp=Mpzf_abscmp(a,b);
-      if(cmp==0){ res.init(); res.size=0; res.exp=0; return res; }
-      if(cmp<0) { x=&b; y=&a; std::swap(xsize, ysize); }
-      else { x=&a; y=&b; }
-      int absxsize=std::abs(xsize);
-      int absysize=std::abs(ysize);
-      const mp_limb_t* xdata=x->data();
-      const mp_limb_t* ydata=y->data();
-      int xexp=x->exp;
-      int yexp=y->exp;
-      if(xexp<yexp){ res.exp=xexp; yexp-=xexp; xexp=0; }
-      else { res.exp=yexp; xexp-=yexp; yexp=0; }
-      res.init((std::max)(absxsize+xexp,absysize+yexp)+1);
-      mp_limb_t* rdata=res.data();
-      res.size=0;
-      bool carry1=false;
-      if(0<yexp){ // must have overlap since x is larger
-	mpn_copyi(rdata, xdata, yexp);
-	xdata+=yexp;
-	absxsize-=yexp;
-	rdata+=yexp;
-	res.size=yexp;
-      }
-      else if(0<xexp){
-	if(absysize<=xexp){ // no overlap
-	  mpn_neg(rdata, ydata, absysize); // assert that it returns 1
-	  rdata+=absysize;
-	  rdata=Mpzf_impl::fill_n_ptr(rdata,xexp-absysize,-1);
-	  mpn_sub_1(rdata, xdata, absxsize, 1);
-	  res.size=absxsize+xexp;
-	  if(res.data()[res.size-1]==0) --res.size;
-	  if(xsize<0) res.size=-res.size;
-	  return res;
-	} else {
-	  mpn_neg(rdata, ydata, xexp); // assert that it returns 1
-	  ydata+=xexp;
-	  absysize-=xexp;
-	  rdata+=xexp;
-	  res.size=xexp;
-	  carry1=true; // assumes no trailing zeros
-	}
-      }
-      CGAL_assertion_code( mp_limb_t carry= )
-	mpn_sub(rdata, xdata, absxsize, ydata, absysize);
-      if(carry1)
-	CGAL_assertion_code( carry+= )
-	  mpn_sub_1(rdata, rdata, absxsize, 1);
-      CGAL_assertion(carry==0);
-      res.size+=absxsize;
-      while(/*res.size>0&&*/res.data()[res.size-1]==0) --res.size;
-      while(/*res.size>0&&*/res.data()[0]==0){--res.size;++res.data();++res.exp;}
-      if(xsize<0) res.size=-res.size;
-    }
-    return res;
-  }
-
-  public:
-  friend Mpzf operator+(Mpzf const&a, Mpzf const&b){
-    return aors(a,b,b.size);
-  }
-
-  friend Mpzf operator-(Mpzf const&a, Mpzf const&b){
-    return aors(a,b,-b.size);
-  }
-
-  friend Mpzf operator*(Mpzf const&a, Mpzf const&b){
-    int asize=std::abs(a.size);
-    int bsize=std::abs(b.size);
-    int siz=asize+bsize;
-    Mpzf res(allocate(),siz);
-    if(asize==0||bsize==0){res.exp=0;res.size=0;return res;}
-    res.exp=a.exp+b.exp;
-    mp_limb_t high;
-    if(asize>=bsize)
-      high = mpn_mul(res.data(),a.data(),asize,b.data(),bsize);
-    else
-      high = mpn_mul(res.data(),b.data(),bsize,a.data(),asize);
-    if(high==0) --siz;
-    if(res.data()[0]==0) { ++res.data(); ++res.exp; --siz; }
-    res.size=((a.size^b.size)>=0)?siz:-siz;
-    return res;
-  }
-
-  friend Mpzf Mpzf_square(Mpzf const&a){
-    int asize=std::abs(a.size);
-    int siz=2*asize;
-    Mpzf res(allocate(),siz);
-    res.exp=2*a.exp;
-    if(asize==0){res.size=0;return res;}
-    mpn_sqr(res.data(),a.data(),asize);
-    mp_limb_t high = res.data()[siz-1];
-    if(high==0) --siz;
-    if(res.data()[0]==0) { ++res.data(); ++res.exp; --siz; }
-    res.size=siz;
-    return res;
-  }
-
-  friend Mpzf operator/(Mpzf const&a, Mpzf const&b){
-    // FIXME: Untested
-    int asize=std::abs(a.size);
-    int bsize=std::abs(b.size);
-    int siz=asize+2-bsize;
-    Mpzf res(allocate(),asize+2);
-    if(bsize==0){throw std::range_error("Division by zero");}
-    if(asize==0){res.exp=0;res.size=0;return res;}
-    res.size=siz;
-    res.exp=a.exp-b.exp;
-    const mp_limb_t *adata = a.data();
-    const mp_limb_t *bdata = b.data();
-    mp_limb_t *qp = res.data();
-    mp_limb_t *rp = qp + siz;
-    if(Mpzf_impl::ctz(adata[0]) >= Mpzf_impl::ctz(bdata[0])){ // Easy case
-      --res.size;
-      mpn_tdiv_qr(qp, rp, 0, adata, asize, bdata, bsize);
-      CGAL_assertion_code(
-	  for (int i=0; i<bsize; ++i)
-	    if (rp[i] != 0) throw std::logic_error("non exact Mpzf division");
-      )
-    }
-    else if(adata[-1]==0){ // We are lucky
-      --adata; ++asize; --res.exp;
-      mpn_tdiv_qr(qp, rp, 0, adata, asize, bdata, bsize);
-      CGAL_assertion_code(
-	  for (int i=0; i<bsize; ++i)
-	    if (rp[i] != 0) throw std::logic_error("non exact Mpzf division");
-      )
-    }
-    else{
-      --res.exp;
-      Mpzf a2(allocate(),asize+1);
-      a2.data()[0]=0;
-      mpn_copyi(a2.data()+1,a.data(),asize);
-      // No need to complete a2, we just want the buffer.
-      //a2.size=(a.size<0)?(a.size-1):(a.size+1);
-      //a2.exp = a.exp-1;
-      mpn_tdiv_qr(qp, rp, 0, a2.data(), asize+1, bdata, bsize);
-      CGAL_assertion_code(
-	  for (int i=0; i<bsize; ++i)
-	    if (rp[i] != 0) throw std::logic_error("non exact Mpzf division");
-      )
-    }
-    while(/*res.size>0&&*/res.data()[res.size-1]==0) --res.size;
-    //while(/*res.size>0&&*/res.data()[0]==0){--res.size;++res.data();++res.exp;}
-    if((a.size^b.size)<0) res.size=-res.size;
-    return res;
-  }
-
-  friend Mpzf Mpzf_gcd(Mpzf const&a, Mpzf const&b){
-    // FIXME: Untested
-    if (a.size == 0) return b;
-    if (b.size == 0) return a;
-    int asize=std::abs(a.size);
-    int bsize=std::abs(b.size);
-    int atz=Mpzf_impl::ctz(a.data()[0]);
-    int btz=Mpzf_impl::ctz(b.data()[0]);
-    int rtz=(std::min)(atz,btz);
-    Mpzf tmp(allocate(), asize);
-    Mpzf res(allocate(), bsize);
-    if (atz != 0) {
-      mpn_rshift(tmp.data(), a.data(), asize, atz);
-      if(tmp.data()[asize-1]==0) --asize;
-    }
-    else { mpn_copyi(tmp.data(), a.data(), asize); }
-    if (btz != 0) {
-      mpn_rshift(res.data(), b.data(), bsize, btz);
-      if(res.data()[bsize-1]==0) --bsize;
-    }
-    else { mpn_copyi(res.data(), b.data(), bsize); }
-    res.exp = 0; // Pick b.exp? or the average? 0 helps return 1 more often.
-    if (asize < bsize)
-      res.size = mpn_gcd(res.data(), res.data(), bsize, tmp.data(), asize);
-    else
-      res.size = mpn_gcd(res.data(), tmp.data(), asize, res.data(), bsize);
-    if(rtz!=0) {
-      mp_limb_t c = mpn_lshift(res.data(), res.data(), res.size, rtz);
-      if(c) { res.data()[res.size]=c; ++res.size; }
-    }
-    return res;
-  }
-
-  friend bool Mpzf_is_square(Mpzf const&x){
-    if (x.size < 0) return false;
-    if (x.size == 0) return true;
-    // Assume that GMP_NUMB_BITS is even.
-    return mpn_perfect_square_p (x.data(), x.size);
-  }
-
-  friend Mpzf Mpzf_sqrt(Mpzf const&x){
-    // FIXME: Untested
-    if (x.size < 0) throw std::range_error("Sqrt of negative number");
-    if (x.size == 0) return 0;
-    if (x.exp % 2 == 0) {
-      Mpzf res(allocate(), (x.size + 1) / 2);
-      res.exp = x.exp / 2;
-      res.size = (x.size + 1) / 2;
-      CGAL_assertion_code(mp_size_t rem=)
-      mpn_sqrtrem(res.data(), 0, x.data(), x.size);
-      CGAL_assertion(rem==0);
-      return res;
-    }
-    else if (x.data()[-1] == 0) {
-      Mpzf res(allocate(), (x.size + 2) / 2);
-      res.exp = (x.exp - 1) / 2;
-      res.size = (x.size + 2) / 2;
-      CGAL_assertion_code(mp_size_t rem=)
-      mpn_sqrtrem(res.data(), 0, x.data()-1, x.size+1);
-      CGAL_assertion(rem==0);
-      return res;
-    }
-    else {
-      Mpzf res(allocate(), (x.size + 2) / 2);
-      res.exp = (x.exp - 1) / 2;
-      res.size = (x.size + 2) / 2;
-      CGAL_assertion_code(mp_size_t rem=)
-      mpn_sqrtrem(res.data(), 0, x.data(), x.size);
-      CGAL_assertion(rem==0);
-      mpn_lshift(res.data(), res.data(), res.size, GMP_NUMB_BITS / 2);
-      return res;
-    }
-  }
-
-  friend Mpzf operator-(Mpzf const&x){
-    Mpzf ret = x;
-    ret.size = -ret.size;
-    return ret;
-  }
-  Mpzf& operator+=(Mpzf const&x){ *this=*this+x; return *this; }
-  Mpzf& operator-=(Mpzf const&x){ *this=*this-x; return *this; }
-  Mpzf& operator*=(Mpzf const&x){ *this=*this*x; return *this; }
-  Mpzf& operator/=(Mpzf const&x){ *this=*this/x; return *this; }
-
-  bool is_canonical () const {
-    if (size == 0) return true;
-    if (data()[0] == 0) return false;
-    if (data()[std::abs(size)-1] == 0) return false;
-    return true;
-  }
-
-  bool is_zero () const {
-    return size==0;
-  }
-
-  bool is_one () const {
-    return exp==0 && size==1 && data()[0]==1;
-  }
-
-  CGAL::Sign sign () const { return CGAL::sign(size); }
-
-  double to_double () const {
-    // Assumes GMP_NUMB_BITS == 64
-    using std::ldexp;
-    if(size==0) return 0;
-    int asize = std::abs(size);
-    mp_limb_t top = data()[asize-1];
-    double dtop = top;
-    if(top >= (1LL<<53) || asize == 1) /* ok */ ;
-    else { dtop += (double)data()[asize-2] * ldexp(1.,-GMP_NUMB_BITS); }
-    return ldexp( (size<0) ? -dtop : dtop, (asize-1+exp) * GMP_NUMB_BITS);
-  }
-
-  std::pair<double, double> to_interval () const {
-    // Assumes GMP_NUMB_BITS == 64
-    if (size == 0) return std::make_pair(0., 0.);
-    double dl, dh;
-    int asize = std::abs(size);
-    int e = 64 * (asize - 1 + exp);
-    mp_limb_t x = data()[asize-1];
-    int lz = Mpzf_impl::clz(x);
-    if (lz <= 11) {
-      if (lz != 11) {
-	e += (11 - lz);
-	x >>= (11 - lz);
-      }
-      dl = x;
-      dh = x + 1;
-      // Check for the few cases where dh=x works (asize==1 and the evicted
-      // bits from x were 0s)
-    }
-    else if (asize == 1) {
-      dl = dh = x; // conversion is exact
-    }
-    else {
-      mp_limb_t y = data()[asize-2];
-      e -= (lz - 11);
-      x <<= (lz - 11);
-      y >>= (75 - lz);
-      x |= y;
-      dl = x;
-      dh = x + 1;
-      // Check for the few cases where dh=x works (asize==2 and the evicted
-      // bits from y were 0s)
-    }
-    typedef Interval_nt<> IA;
-    IA res (dl, dh);
-    res = ldexp (res, e);
-    if (size < 0) res = -res;
-    return CGAL::to_interval(res);
-    // Use ldexp(Interval_nt,int) to delegate the hard thinking
-    // about over/underflow.
-  }
-
-#ifdef CGAL_USE_GMPXX
-#ifndef CGAL_CFG_NO_CPP0X_EXPLICIT_CONVERSION_OPERATORS
-  explicit
-#endif
-  operator mpq_class () const {
-    mpq_class q;
-    export_to_mpq_t(q.get_mpq_t());
-    return q;
-  }
-#endif
-
-#ifndef CGAL_CFG_NO_CPP0X_EXPLICIT_CONVERSION_OPERATORS
-  explicit
-#endif
-  operator Gmpq () const {
-    Gmpq q;
-    export_to_mpq_t(q.mpq());
-    return q;
-  }
-  void export_to_mpq_t(mpq_t q) const {
-    /* q must be 0/1 before this call */
-    CGAL_precondition(mpq_cmp_ui(q,0,1)==0);
-    if (size != 0) {
-      mpz_import (mpq_numref (q),
-		  std::abs(size),
-		  -1, // data()[0] is the least significant part
-		  sizeof(mp_limb_t),
-		  0, // native endianness inside mp_limb_t
-		  GMP_NAIL_BITS, // should be 0
-		  data());
-      if (exp > 0)
-	mpq_mul_2exp(q, q, (sizeof(mp_limb_t) * CHAR_BIT *  exp));
-      else if (exp < 0)
-	mpq_div_2exp(q, q, (sizeof(mp_limb_t) * CHAR_BIT * -exp));
-
-      if (size < 0)
-	mpq_neg(q,q);
-    }
-  }
-#if 0
-#ifndef CGAL_CFG_NO_CPP0X_EXPLICIT_CONVERSION_OPERATORS
-  explicit
-#endif
-// This makes Mpzf==int ambiguous
-  operator Gmpzf () const {
-    mpz_t z;
-    z->_mp_d=const_cast<mp_limb_t*>(data());
-    z->_mp_size=size;
-    Gmpzf m(z);
-// Only works for a very limited range of exponents
-    Gmpzf e(std::ldexp(1.,GMP_NUMB_BITS*exp));
-    return m*e;
-  }
-#endif
-
-  friend void simplify_quotient(Mpzf& a, Mpzf& b){
-    // Avoid quotient(2^huge_a/2^huge_b)
-    a.exp -= b.exp;
-    b.exp = 0;
-    // Simplify with gcd?
-  }
-};
-
-// Copied from Gmpzf, not sure that's the best thing to do.
-inline
-std::ostream& operator<< (std::ostream& os, const Mpzf& a)
-{
-    return os << a.to_double();
-}
-
-inline
-std::istream& operator>> (std::istream& is, Mpzf& a)
-{
-  double d;
-  is >> d;
-  if (is)
-    a = d;
-  return is;
-}
-
-
-  template <> struct Algebraic_structure_traits< Mpzf >
-    : public Algebraic_structure_traits_base< Mpzf, Integral_domain_without_division_tag >  {
-      typedef Tag_true            Is_exact;
-      typedef Tag_false            Is_numerical_sensitive;
-
-      struct Is_zero
-	: public std::unary_function< Type, bool > {
-	  bool operator()( const Type& x ) const {
-	    return x.is_zero();
-	  }
-	};
-
-      struct Is_one
-	: public std::unary_function< Type, bool > {
-	  bool operator()( const Type& x ) const {
-	    return x.is_one();
-	  }
-	};
-
-      struct Gcd
-	: public std::binary_function< Type, Type, Type > {
-	  Type operator()(
-	      const Type& x,
-	      const Type& y ) const {
-	    return Mpzf_gcd(x, y);
-	  }
-	};
-
-      struct Square
-	: public std::unary_function< Type, Type > {
-	  Type operator()( const Type& x ) const {
-	    return Mpzf_square(x);
-	  }
-	};
-
-      struct Integral_division
-	: public std::binary_function< Type, Type, Type > {
-	  Type operator()(
-	      const Type& x,
-	      const Type& y ) const {
-	    return x / y;
-	  }
-	};
-
-      struct Sqrt
-	: public std::unary_function< Type, Type > {
-	  Type operator()( const Type& x) const {
-	    return Mpzf_sqrt(x);
-	  }
-	};
-
-      struct Is_square
-	: public std::binary_function< Type, Type&, bool > {
-	  bool operator()( const Type& x, Type& y ) const {
-	    // TODO: avoid doing 2 calls.
-	    if (!Mpzf_is_square(x)) return false;
-	    y = Mpzf_sqrt(x);
-	    return true;
-	  }
-	  bool operator()( const Type& x) const {
-	    return Mpzf_is_square(x);
-	  }
-	};
-
-    };
-  template <> struct Real_embeddable_traits< Mpzf >
-    : public INTERN_RET::Real_embeddable_traits_base< Mpzf , CGAL::Tag_true > {
-      struct Sgn
-	: public std::unary_function< Type, ::CGAL::Sign > {
-	  ::CGAL::Sign operator()( const Type& x ) const {
-	    return x.sign();
-	  }
-	};
-
-      struct To_double
-	: public std::unary_function< Type, double > {
-	    double operator()( const Type& x ) const {
-	      return x.to_double();
-	    }
-	};
-
-      struct Compare
-	: public std::binary_function< Type, Type, Comparison_result > {
-	    Comparison_result operator()(
-		const Type& x,
-		const Type& y ) const {
-	      return CGAL::sign(Mpzf_cmp(x,y));
-	    }
-	};
-
-      struct To_interval
-	: public std::unary_function< Type, std::pair< double, double > > {
-	    std::pair<double, double> operator()( const Type& x ) const {
-	      return x.to_interval();
-	    }
-	};
-
-    };
-
-CGAL_DEFINE_COERCION_TRAITS_FOR_SELF(Mpzf)
-CGAL_DEFINE_COERCION_TRAITS_FROM_TO(short    ,Mpzf)
-CGAL_DEFINE_COERCION_TRAITS_FROM_TO(int      ,Mpzf)
-CGAL_DEFINE_COERCION_TRAITS_FROM_TO(long     ,Mpzf)
-CGAL_DEFINE_COERCION_TRAITS_FROM_TO(float    ,Mpzf)
-CGAL_DEFINE_COERCION_TRAITS_FROM_TO(double   ,Mpzf)
-CGAL_DEFINE_COERCION_TRAITS_FROM_TO(Gmpz     ,Mpzf)
-#ifdef CGAL_USE_GMPXX
-CGAL_DEFINE_COERCION_TRAITS_FROM_TO(mpz_class,Mpzf)
-#endif
-
-}
-
-/* There isn't much Eigen can do with such a type,
- * mostly this is here for IsInteger to protect people.
- */
-namespace Eigen {
-  template<class> struct NumTraits;
-  template<> struct NumTraits<CGAL::Mpzf>
-  {
-    typedef CGAL::Mpzf Real;
-    /* Should this be Quotient<Mpzf>? Gmpq?  */
-    typedef CGAL::Mpzf NonInteger;
-    typedef CGAL::Mpzf Nested;
-
-    static inline Real epsilon() { return 0; }
-    static inline Real dummy_precision() { return 0; }
-
-    enum {
-      /* Only exact divisions are supported, close enough to an integer.
-       * This way we get compilation failures instead of runtime.  */
-      IsInteger = 1,
-      IsSigned = 1,
-      IsComplex = 0,
-      RequireInitialization = 1,
-      ReadCost = 6,
-      AddCost = 30,
-      MulCost = 50
-    };
-  };
-}
-
-#if defined(BOOST_MSVC)
-#  pragma warning(pop)
-#endif
-
-#endif // GMP_NUMB_BITS == 64
-#endif // CGAL_MPZF_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Multiscale_sort.h b/3rdparty/CGAL-4.8/include/CGAL/Multiscale_sort.h
deleted file mode 100644
index bfc6742..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Multiscale_sort.h
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright (c) 2007  INRIA Sophia-Antipolis (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(s)     : Christophe Delage
-
-#ifndef CGAL_MULTISCALE_SORT_H
-#define CGAL_MULTISCALE_SORT_H
-
-#include <CGAL/basic.h>
-#include <iterator>
-#include <cstddef>
-
-namespace CGAL {
-
-template <class Sort>
-class Multiscale_sort
-{
-    Sort _sort;
-    std::ptrdiff_t _threshold;
-    double _ratio;
-
-public:
-    Multiscale_sort (const Sort &sort = Sort(), std::ptrdiff_t threshold = 1, double ratio = 0.5)
-        : _sort (sort), _threshold (threshold), _ratio (ratio)
-    {
-        CGAL_precondition (0. <= ratio && ratio <= 1.);
-    }
-
-    template <class RandomAccessIterator>
-    void operator() (RandomAccessIterator begin, RandomAccessIterator end) const
-    {
-	typedef typename std::iterator_traits<RandomAccessIterator>::difference_type difference_type;
-        RandomAccessIterator middle = begin;
-        if (end - begin >= _threshold) {
-            middle = begin + difference_type ((end - begin) * _ratio);
-            this->operator() (begin, middle);
-        }
-        _sort (middle, end);
-    }
-};
-
-} // namespace CGAL
-
-#endif // CGAL_MULTISCALE_SORT_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_2/PM_io_parser.h b/3rdparty/CGAL-4.8/include/CGAL/Nef_2/PM_io_parser.h
deleted file mode 100644
index 666ff47..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Nef_2/PM_io_parser.h
+++ /dev/null
@@ -1,403 +0,0 @@
-// Copyright (c) 1997-2000  Max-Planck-Institute Saarbruecken (Germany).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Michael Seel <seel at mpi-sb.mpg.de>
-
-#ifndef CGAL_PM_IO_PARSER_H
-#define CGAL_PM_IO_PARSER_H
-
-#include <CGAL/Nef_2/PM_decorator.h>
-#include <CGAL/Nef_2/Object_index.h>
-#include <vector>
-
-namespace CGAL {
-
-/*{\Moptions outfile=PM_io_parser.man }*/
-/*{\Manpage {PM_io_parser}{PMDEC}{IO of plane maps}{IO}}*/
-
-/*{\Mdefinition An instance |\Mvar| of the data type |\Mname| is a
-decorator to provide input and output of a plane map.  |\Mtype| is
-generic with respect to the |PMDEC| parameter.  |PMDEC| has to be a
-decorator model of our |PM_decorator| concept.}*/
-
-/*{\Mgeneralization PM_decorator}*/
-
-template <typename PMDEC>
-class PM_io_parser : public PMDEC
-{
-  typedef PMDEC                     Base;
-  typedef typename PMDEC::Plane_map Plane_map;
-  typedef typename PMDEC::Point     Point;
-  typedef typename PMDEC::Mark      Mark;
-
-  typedef typename PMDEC::Vertex_iterator   Vertex_iterator;
-  typedef typename PMDEC::Halfedge_iterator Halfedge_iterator;
-  typedef typename PMDEC::Face_iterator     Face_iterator;
-  typedef typename PMDEC::Vertex_handle     Vertex_handle;
-  typedef typename PMDEC::Halfedge_handle   Halfedge_handle;
-  typedef typename PMDEC::Face_handle       Face_handle;
-
-  using Base::clear;
-  using Base::vertices_begin;
-  using Base::vertices_end;
-  using Base::halfedges_begin;
-  using Base::halfedges_end;
-  using Base::faces_begin;
-  using Base::faces_end;
-  using Base::number_of_vertices;
-  using Base::number_of_halfedges;
-  using Base::number_of_faces;
-  using Base::new_vertex;
-  using Base::new_face;
-  using Base::new_halfedge_pair_without_vertices;
-  using Base::is_isolated;
-  using Base::face;
-  using Base::mark;
-  using Base::point;
-  using Base::twin;
-  using Base::previous;
-  using Base::next;
-  using Base::source;
-  using Base::target;
-  using Base::out_edges;
-  using Base::halfedge;
-
-  std::istream& in;
-  std::ostream& out;
-  bool verbose;
-  // a reference to the IO object
-  CGAL::Object_index<Vertex_handle>   VI;
-  CGAL::Object_index<Halfedge_handle> EI;
-  CGAL::Object_index<Face_handle>     FI;
-  std::vector<Vertex_handle>    Vertex_of;
-  std::vector<Halfedge_handle>  Halfedge_of;
-  std::vector<Face_handle>      Face_of;
-  // object mapping for input
-  std::size_t vn,en,fn,i;
-  // the number of objects
-
-
-  void print_vertex(Vertex_handle) const;
-  void print_hedge(Halfedge_handle) const;
-  void print_face(Face_handle) const;
-
-  bool read_vertex(Vertex_handle);
-  bool read_hedge(Halfedge_handle);
-  bool read_face(Face_handle);
-
-  void debug_vertex(Vertex_handle) const;
-  void debug_hedge(Halfedge_handle) const;
-
-public:
-/*{\Mcreation 3}*/
-PM_io_parser(std::istream& is, Plane_map& H)
-/*{\Mcreate creates an instance |\Mvar| of type |\Mname|
-   to input |H| from |is|.}*/
-    : Base(H), in(is), out(std::cout), verbose(0), vn(0), en(0), fn(0)
-        { this->clear(); }
-
-
-PM_io_parser(std::ostream& os, const Plane_map& H)
-/*{\Mcreate creates an instance |\Mvar| of type |\Mname|
-to output |H| to |os|.}*/
-: Base(const_cast<Plane_map&>(H)), in(std::cin), out(os), 
-  VI(Base::vertices_begin(), Base::vertices_end(),'v'),
-  EI(Base::halfedges_begin(),Base::halfedges_end(),'e'),
-  FI(Base::faces_begin(),Base::faces_end(),'f'),
-  vn(Base::number_of_vertices()), 
-  en(Base::number_of_halfedges()), 
-  fn(Base::number_of_faces())
-{ verbose = (out.iword(CGAL::IO::mode) != CGAL::IO::ASCII &&
-             out.iword(CGAL::IO::mode) != CGAL::IO::BINARY);
-}
-
-
-PM_io_parser(std::ostream& os, const PMDEC& D)
-: Base(D), in(std::cin), out(os), 
-  VI(Base::vertices_begin(),Base::vertices_end(),'v'),
-  EI(Base::halfedges_begin(),Base::halfedges_end(),'e'),
-  FI(Base::faces_begin(),Base::faces_end(),'f'),
-  vn(Base::number_of_vertices()), 
-  en(Base::number_of_halfedges()), 
-  fn(Base::number_of_faces())
-{ verbose = (out.iword(CGAL::IO::mode) != CGAL::IO::ASCII &&
-             out.iword(CGAL::IO::mode) != CGAL::IO::BINARY);
-}
-
-
-/*{\Moperations 2 3}*/
-
-bool check_sep(const char* sep);
-
-void print() const;
-/*{\Mop prints |H| to |os|.}*/
-void read();
-/*{\Mop reads |H| from |is|.}*/
-void debug() const;
-std::string index(Vertex_handle v) const { return VI(v,verbose); }
-std::string index(Halfedge_handle e) const { return EI(e,verbose); }
-std::string index(Face_handle f) const { return FI(f,verbose); }
-
-static void dump(const PMDEC& D, std::ostream& os = std::cerr);
-/*{\Mstatic prints the plane map decorated by |D| to |os|.}*/
-
-}; // PM_io_parser<PMDEC>
-
-
-//-----------------------------------------------------------------------------
-// OUTPUT AND INPUT:
-//-----------------------------------------------------------------------------
-
-template <typename PMDEC>
-bool PM_io_parser<PMDEC>::check_sep(const char* sep)
-{
-  char c; 
-  do in.get(c); while (isspace(c));
-  while (*sep != '\0') { 
-    if (*sep != c) {
-      in.putback(c);
-      return false;
-    }
-    ++sep; in.get(c);
-  }
-  in.putback(c);
-  return true;  
-}
-
-template <typename PMDEC>
-void PM_io_parser<PMDEC>::print_vertex(Vertex_handle v) const
-{
-  // syntax: index { isolated incident_object, mark, point }
-  out << index(v) << " { ";
-  if ( is_isolated(v) ) out << "1 " << index(face(v));
-  else                  out << "0 " << index(v->halfedge());
-  out  << ", " << mark(v) << ", " << point(v) <<  "}\n";
-}
-
-template <typename PMDEC>
-bool PM_io_parser<PMDEC>::read_vertex(Vertex_handle v)
-{ 
-  // precondition: nodes exist
-  // syntax: index { mark, point, isolated object }
-  int n; bool iso; int f; Mark m; Point p; 
-  if ( !(in >> n) ||
-       !check_sep("{") ||
-       !(in >> iso) ||
-       !(in >> f) ||
-       !check_sep(",") ||
-       !(in >> m) ||
-       !check_sep(",") ||
-       !(in >> p) ||
-       !check_sep("}") ) return false;
- 
-  if (iso) v->set_face(Face_of[f]);
-  else     v->set_halfedge(Halfedge_of[f]);
-  mark(v) = m; point(v) = p;
-  return true; 
-}
-
-template <typename PMDEC>
-void PM_io_parser<PMDEC>::print_hedge(Halfedge_handle e) const
-{ // syntax: index { opposite, prev, next, vertex, face, mark }
-  out << index(e) << " { "
-      << index(twin(e)) << ", " 
-      << index(previous(e)) << ", " << index(next(e)) << ", "
-      << index(target(e)) << ", " <<   index(face(e)) << ", "
-      << mark(e) << " }\n";
-}
-
-template <typename PMDEC>
-bool PM_io_parser<PMDEC>::read_hedge(Halfedge_handle e)
-{ // syntax: index { opposite, prev, next, vertex, face, mark }
-  int n, eo, epr, ene, v, f; bool m; 
-  if ( !(in >> n) ||
-       !check_sep("{") ||
-       !(in >> eo) || !check_sep(",") ||
-       !(in >> epr) || !check_sep(",") ||
-       !(in >> ene) || !check_sep(",") ||
-       !(in >> v) || !check_sep(",") ||
-       !(in >> f) || !check_sep(",") ||
-       !(in >> m) || !check_sep("}") )
-    return false;
-  CGAL_assertion_msg 
-     (eo >= 0 || (std::size_t) eo < en || epr >= 0 || (std::size_t) epr < en || ene >= 0 || (std::size_t) ene < en ||
-      v >= 0 || (std::size_t) v < vn || f >= 0 || (std::size_t) f < fn ,
-      "wrong index in read_hedge");
-  
-  // precond: objects exist!
-  CGAL_assertion(EI[e->opposite()]);
-  e->set_prev(Halfedge_of[epr]);
-  e->set_next(Halfedge_of[ene]);
-  e->set_vertex(Vertex_of[v]);
-  e->set_face(Face_of[f]);
-  mark(e) = m;
-  return true;
-}
-
-
-template <typename PMDEC>
-void PM_io_parser<PMDEC>::print_face(Face_handle f) const
-{ // syntax: index { halfedge, fclist, ivlist, mark }
-  out << index(f) << " { " << index(halfedge(f)) << ", ";
-  typedef typename std::list<Halfedge_handle>::iterator lhiterator;
-  lhiterator hit, hend = f->fc_end();
-  for(hit = f->fc_begin(); hit!=hend; ++hit) 
-    out << index(*hit) << ' ';
-  out << ", ";
-  typedef typename std::list<Vertex_handle>::iterator lviterator;
-  lviterator vit, vend = f->iv_end();
-  for(vit = f->iv_begin(); vit!=vend; ++vit) 
-    out << index(*vit) << ' ';
-  out << ", " << mark(f) << " }\n";
-}
-
-template <typename PMDEC>
-bool PM_io_parser<PMDEC>::read_face(Face_handle f)
-{ // syntax: index { halfedge, fclist, ivlist, mark }
-  int n, ei, vi; Mark m;
-  if ( !(in >> n) || !check_sep("{") ) return false;
-  if ( !(in >> ei) || !check_sep(",") ) return false;
-  if (ei >= 0) f->set_halfedge(Halfedge_of[ei]);
-  while (in >> ei) { 
-    CGAL_assertion_msg(ei >= 0 && (std::size_t) ei < en, "wrong index in face cycle list.");
-    f->store_fc(Halfedge_of[ei]);
-  } in.clear();
-  if (!check_sep(",")) { return false; }
-  while (in >> vi) { 
-    CGAL_assertion_msg(vi >= 0 && (std::size_t) vi < vn, "wrong index in iso vertex list.");
-    f->store_iv(Vertex_of[vi]);
-  } in.clear();
-  if (!check_sep(",") || !(in >> m) || !check_sep("}") ) 
-    return false;
-  mark(f) = m;
-  return true;
-}
-
-template <typename PMDEC>
-void PM_io_parser<PMDEC>::print() const
-{
-  out << "Plane_map_2" << std::endl;
-  out << "vertices "  << vn << std::endl;
-  out << "halfedges " << en << std::endl;
-  out << "faces "     << fn << std::endl;
-  if (verbose) 
-    out << "/* index { isolated ? face : halfedge, mark, point } */" 
-        << std::endl;
-  Vertex_iterator vit, vend = this->vertices_end();
-  for(vit = this->vertices_begin(); vit!=vend; ++vit) print_vertex(vit);
-  if (verbose) 
-    out << "/* index { opposite, prev, next, vertex, face, mark } */" 
-        << std::endl;
-  Halfedge_iterator eit, eend = this->halfedges_end();
-  for(eit = this->halfedges_begin(); eit!=eend; ++eit) print_hedge(eit);
-  if (verbose) 
-    out << "/* index { halfedge, fclist, ivlist, mark } */" 
-        << std::endl;
-  Face_iterator fit, fend = this->faces_end();
-  for(fit = this->faces_begin(); fit!=fend; ++fit) print_face(fit);
-  out.flush();
-  if (verbose) debug();
-}
-
-template <typename PMDEC>
-void PM_io_parser<PMDEC>::read() 
-{
-  if ( !check_sep("Plane_map_2") )  
-    CGAL_error_msg("PM_io_parser::read: no embedded_PM header.");
-  if ( !(check_sep("vertices") && (in >> vn)) ) 
-    CGAL_error_msg("PM_io_parser::read: wrong node line.");
-  if ( !(check_sep("halfedges") && (in >> en) && (en%2==0)) )
-    CGAL_error_msg("PM_io_parser::read: wrong edge line.");
-  if ( !(check_sep("faces") && (in >> fn)) )
-    CGAL_error_msg("PM_io_parser::read: wrong face line.");
-
-  Vertex_of.resize(vn);
-  Halfedge_of.resize(en);
-  Face_of.resize(fn);
-
-  for(i=0; i<vn; i++)  Vertex_of[i] =   this->new_vertex();
-  for(i=0; i<en; i++) 
-    if (i%2==0) Halfedge_of[i] = this->new_halfedge_pair_without_vertices();
-    else Halfedge_of[i] = twin(Halfedge_of[i-1]);
-  for(i=0; i<fn; i++)  Face_of[i] =     this->new_face();
-
-  for(i=0; i<vn; i++) {
-    if (!read_vertex(Vertex_of[i]))
-      CGAL_error_msg("PM_io_parser::read: error in node line");
-  }
-  for(i=0; i<en; i++) {
-    if (!read_hedge(Halfedge_of[i]))
-      CGAL_error_msg("PM_io_parser::read: error in halfedge\
-      line");
-  }
-  for(i=0; i<fn; i++) {
-    if (!read_face(Face_of[i]))
-      CGAL_error_msg("PM_io_parser::read: error in face line");
-  }
-}
-
-//-----------------------------------------------------------------------------
-// VERBOSE OUTPUT:
-// note that we output the index of the objects which is stored in them
-// this is NOT the member index as produced by the forall loops
-//-----------------------------------------------------------------------------
-
-template <typename PMDEC>
-void PM_io_parser<PMDEC>::debug_vertex(Vertex_handle v) const
-{ 
-  out << index(v) << "[" << mark(v) << "," << point(v) << "]" 
-      << std::endl; 
-}
-
-template <typename PMDEC>
-void PM_io_parser<PMDEC>::debug_hedge(Halfedge_handle e) const
-{ 
-  out << index(e)
-      << "(" << index(source(e)) << "," << index(target(e)) << ") "
-      << index(face(e)) << " " << index(twin(e))
-      << " ["<< mark(e) << "]" <<" "<<&*(face(e)) << std::endl;
-}
-
-
-template <typename PMDEC>
-void PM_io_parser<PMDEC>::debug() const
-{ 
-  out << "\nDEBUG Plane_map\n"
-      << "Vertices:  " << this->number_of_vertices() << "\n"
-      << "Halfedges: " << this->number_of_halfedges() << "\n";
-  Vertex_iterator vit,vend = this->vertices_end(); 
-  for( vit = this->vertices_begin(); vit != vend; ++vit ) {
-    if ( is_isolated(vit) ) continue;
-    typename Base::Halfedge_around_vertex_circulator
-      hcirc = out_edges(vit), hend = hcirc;
-    debug_vertex(vit);
-    CGAL_For_all(hcirc,hend) { out << "  "; debug_hedge(hcirc); }
-  }
-  out << std::endl;
-}
-
-template <typename PMDEC>
-void PM_io_parser<PMDEC>::dump(const PMDEC& D, std::ostream& os)
-{ PM_io_parser<PMDEC> Out(os,D);
-  Out.print();
-}
-
-
-
-} //namespace CGAL
-#endif //CGAL_PM_IO_PARSER_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_2/gen_point_location.h b/3rdparty/CGAL-4.8/include/CGAL/Nef_2/gen_point_location.h
deleted file mode 100644
index 536ada6..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Nef_2/gen_point_location.h
+++ /dev/null
@@ -1,610 +0,0 @@
-// Copyright (c) 1997-2000  Max-Planck-Institute Saarbruecken (Germany).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Michael Seel <seel at mpi-sb.mpg.de>
-
-
-#ifndef CGAL_NEF_2_GEN_POINT_LOCATION_H
-#define CGAL_NEF_2_GEN_POINT_LOCATION_H
-
-#include <CGAL/LEDA_basic.h>
-#if CGAL_LEDA_VERSION < 500
-#include <LEDA/pp_dictionary.h>
-#else
-#include <LEDA/core/pp_dictionary.h>
-#endif
-#include <sstream>
-#include <string>
-#include <list>
-#include <vector>
-#include <map>
-#ifdef CGAL_I_DO_WANT_TO_USE_GENINFO
-#include <CGAL/Nef_2/geninfo.h>
-#else
-#include <boost/any.hpp>
-#endif
-
-
-#undef CGAL_NEF_DEBUG
-#define CGAL_NEF_DEBUG 17
-#include <CGAL/Nef_2/debug.h>
-
-// #define CHECKING_OFF
-
-// for dictionary
-template <class Node>
-inline std::ostream& operator<<(std::ostream& o, const std::list<Node>& n) 
-{ return o; }
-
-/*{\Manpage {GenericLocation}{Node, Edge}
-{Return Type for Planar Point Location}{L}}*/
-
-template <class Node, class Edge>
-class GenericLocation {
-/*{\Mdefinition
-  An instance of the data type |\Mtype| is used as return value for planar 
-  point location. It can store a node or an edge of a graph or the special
-  value |nil| which is used to signal that no node or edge could be found.
-}*/
-  #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO
-  typedef void*  GenPtr;
-  #else
-  typedef boost::any GenPtr;
-  #endif
-public:
-/*{\Mtypes}*/ 
-  enum Type { NIL, NODE, EDGE };
-  /*{\Menum This enumeration allows to specify the 3 basic types of the 
-     values that a |\Mtype| can represent.}*/
-
-  /*{\Mcreation}*/ 
-    GenericLocation()       { init(); }
-    /*{\Mcreate creates a |\Mtype| and initializes with the value |nil|.}*/
-    GenericLocation(Node n) { init(n); }
-    /*{\Mcreate creates a |\Mtype| and initializes with the node |n|.}*/
-    GenericLocation(Edge e) { init(e); }
-    /*{\Mcreate creates a |\Mtype| and initializes with the edge |e|.}*/
-
-    ~GenericLocation() { clear(); }
-
-    GenericLocation(const GenericLocation<Node, Edge>& L) { assign(L); }
-    GenericLocation<Node, Edge>& operator=(
-      const GenericLocation<Node, Edge>& L)
-    { clear(); assign(L); return *this; }
-
-  /*{\Moperations}*/
-    operator const Node&() const
-    {
-  #if !defined(CHECKING_OFF)
-      if (type != NODE) 
-        CGAL_LEDA_SCOPE::error_handler(1, "Location: not convertible to node");
-  #endif
-      #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO
-      return geninfo<Node>::const_access(value);
-      #else
-      return 
-        *boost::any_cast<Node>(&value);
-      #endif
-    }
-    /*{\Mconversion converts |\Mvar| into a node.\\
-       \precond |\Mvar| represents a node.}*/
-
-    operator const Edge&() const
-    { 
-  #if !defined(CHECKING_OFF)
-      if (type != EDGE) 
-        CGAL_LEDA_SCOPE::error_handler(1, "Location: not convertible to edge");
-  #endif
-      #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO
-      return geninfo<Edge>::const_access(value);
-      #else
-      return 
-        *boost::any_cast<Edge>(&value);
-      #endif
-    }
-    /*{\Mconversion converts |\Mvar| into an edge.\\
-       \precond |\Mvar| represents an edge.}*/
-
-    GenericLocation<Node, Edge>& operator=(Node n)
-    { clear(); init(n); return *this; }
-    /*{\Mbinop makes |\Mvar| represent the node |n|.}*/
-
-    GenericLocation<Node, Edge>& operator=(Edge e)
-    { clear(); init(e); return *this; }
-    /*{\Mbinop makes |\Mvar| represent the edge |e|.}*/
-
-    Type get_type() const { return type; }
-    /*{\Mop returns the type of the value contained in |\Mvar|.}*/
-
-    bool is_nil()  const { return type == NIL; }
-    /*{\Mop returns |true| iff |\Mvar| represents the value |nil|.}*/
-
-    bool is_node() const { return type == NODE; }
-    /*{\Mop returns |true| iff |\Mvar| represents a node.}*/
-
-    bool is_edge() const { return type == EDGE; }
-    /*{\Mop returns |true| iff |\Mvar| represents an edge.}*/
-
-  private:
-    void init() { type = NIL; }
-    void init(Node n) 
-    { type = NODE; 
-      #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO
-      geninfo<Node>::create(value); 
-      geninfo<Node>::access(value) = n;
-      #else
-      value=n;
-      #endif
-    }
-    void init(Edge e) 
-    { type = EDGE; 
-      #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO
-      geninfo<Edge>::create(value); 
-      geninfo<Edge>::access(value) = e;
-      #else
-      value=e;
-      #endif
-    }
-
-    void clear()
-    { 
-      switch(type) {
-      #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO
-       case NODE: geninfo<Node>::clear(value); break;
-       case EDGE: geninfo<Edge>::clear(value); break;
-      #else
-       case NODE: value=boost::any(); break;
-       case EDGE: value=boost::any(); break;
-      #endif
-       case NIL: break;
-      }
-    }
-
-    void assign(const GenericLocation<Node, Edge>& L)
-    { 
-      type = L.type;
-      switch(type) {
-       case NODE: 
-        #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO
-         geninfo<Node>::access(value) = geninfo<Node>::const_access(L.value);
-        #else
-         *boost_any_cast<Node>(&value) = boost::any_cast<Node>(L.value);
-        #endif
-         break;
-       case EDGE: 
-        #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO
-         geninfo<Edge>::access(value) = geninfo<Edge>::const_access(L.value);
-        #else
-         *boost::any_cast<Edge>(&value) = boost::any_cast<Edge>(L.value);
-        #endif
-         break;
-       case NIL: break;
-      }
-    }
-
-  public:
-    typedef GenericLocation<Node, Edge> self;
-
-
-private:
-  Type   type;
-  GenPtr value;
-};
-
-/*{\Mimplementation
-  The data type |\Mtype| is implemented as a union of the types |Node| and 
-  |Edge|. There is only constant time and space overhead.
-}*/
-template <class Node, class Edge>
-inline
-bool 
-operator==(const GenericLocation<Node, Edge>& L1, 
-           const GenericLocation<Node, Edge>& L2)
-{ 
-  if (L1.get_type() != L2.get_type()) return false;
-  switch (L1.get_type()) {
-   case GenericLocation<Node, Edge>::NIL:  return true;
-   case GenericLocation<Node, Edge>::NODE: return Node(L1) == Node(L2);
-   case GenericLocation<Node, Edge>::EDGE: return Edge(L1) == Edge(L2);
-  }
-}
-
-template <class Node, class Edge>
-inline
-bool 
-operator!=(const GenericLocation<Node, Edge>& L1, 
-           const GenericLocation<Node, Edge>& L2)
-{ return ! (L1==L2); }
-
-template <class Node, class Edge>
-std::ostream& operator<<(std::ostream& o, 
-                         const GenericLocation<Node, Edge>& L)
-{
-  switch (L.get_type()) {
-   case GenericLocation<Node, Edge>::NIL:  return o<<"nil";
-   case GenericLocation<Node, Edge>::NODE: return o<<"node("<<&*Node(L)<<')';
-   case GenericLocation<Node, Edge>::EDGE: return o<<"edge("<<&*Edge(L)<<')';
-  }
-  return o;
-}
-
-template <class Node, class Edge>
-std::istream& operator>>(std::istream& i, GenericLocation<Node, Edge>&)
-{ return i; }
-template <class XCoord, class PredLessThanX, class Sweepline>
-class GenericXStructure {
-public:
-  typedef std::vector<XCoord>    Array_Coordinates;
-  typedef std::vector<Sweepline> Array_Sweeplines;
-  typedef typename Array_Coordinates::const_iterator Coord_iterator;
-  typedef typename Array_Sweeplines::const_iterator  Sweepline_iterator;
-private:
-  int stops;
-  PredLessThanX     LtX;
-  Array_Coordinates Coordinates;
-  Array_Sweeplines  SweepLines;
-  // SweepLines[0] is EmptyLine;
-public:
-  GenericXStructure() { clear(); }
-  GenericXStructure(int n, const PredLessThanX& cmp) { init(n, cmp); }
-  ~GenericXStructure() { clear(); }
-
-  void init(int n, const PredLessThanX& cmp)
-  { CGAL_NEF_TRACEN("XSinit "<<n); 
-    LtX = cmp;
-    Coordinates = Array_Coordinates(n);
-    SweepLines =  Array_Sweeplines(2*n+1);
-    stops = 0;
-  }
-
-  void clear()
-  { Coordinates.clear();
-    SweepLines.clear();
-    stops = 0;
-  }
-
-  void insertLines(const XCoord& X, 
-                   const Sweepline& atX, const Sweepline& inXplus)
-  { CGAL_NEF_TRACEN("XSinsert "<<X); 
-    Coordinates[stops]    = X;
-    SweepLines[2*stops+1]   = atX;
-    SweepLines[2*stops+2] = inXplus;
-    ++stops;
-  }
-
-  Sweepline_iterator getLineAt(const XCoord& X) const
-  { CGAL_NEF_TRACEN("XSgetLineAt "<<X);
-    Sweepline_iterator sit = SweepLines.begin(); // EmptyLine
-    if ( LtX(X,*Coordinates.begin()) ) {
-      CGAL_NEF_TRACEN("infinity first");
-      return sit; // ]-infinity, x0[
-    }
-    Coord_iterator stopit = std::lower_bound (
-        Coordinates.begin(),Coordinates.end(),X,LtX);
-    /* determines stopit maximal such that 
-       \forall j \in [begin,stopit) : *j < X
-       as a consequence now: *stopit >= X */
-    bool found_exact = false;
-    if ( LtX(X,*stopit) ) --stopit;  // X <  *stopit
-    else found_exact = true;         // X >= *stopit
-      
-    CGAL_NEF_TRACEN("stopit "<<*stopit);
-    int offset = stopit-Coordinates.begin();
-    return found_exact ? 
-      SweepLines.begin() + (2*offset+1) :
-      SweepLines.begin() + (2*offset+2);
-  }
-
-  Sweepline_iterator begin() const { return SweepLines.begin(); }
-  Sweepline_iterator end() const { return SweepLines.end();}
-
-};
-/*{\Manpage {PointLocator} {PLocTraits} {Planar Point Location} {PL}}*/
-
-template <class PLocTraits>
-class PointLocator {
-/*{\Mdefinition
-   An instance |\Mvar| of the parameterized data type |\Mtype| can be used
-   to perform point location queries in the two-dimensional plane.
-   Every non-empty instance |\Mvar| is associated with an embedded planar 
-   graph |G|, which has to remain unchanged while it is referenced by |PL|.\\
-   A location query for a point |p| returns the first object (node or edge)
-   of |G| which is intersected by the straight ray starting in |p| and going
-   vertically downwards/upwards.
-   If the ray does not intersect any node or edge of |G|, then |nil| is 
-   returned.\\
-   The class |\Mtype| is generic, it is parameterized with a traits class 
-   |PLocTraits| which widely controls its behaviour.
-   The traits may even change the return type of a query and its semantics.
-   There are predined traits classes for the LEDA graph types, which are
-   described below in a seperate section.
-}*/
-public:
-  // copied types from PLocTraits
-  typedef typename PLocTraits::Point             Point;
-  typedef typename PLocTraits::XCoord            XCoord;
-  typedef typename PLocTraits::PredLessThanX     PredLessThanX;
-
-  typedef typename PLocTraits::Graph             Graph;
-  typedef typename PLocTraits::Node              Node;
-  typedef typename PLocTraits::Edge              Edge;
-  typedef typename PLocTraits::NodeIterator      NodeIterator;
-  typedef typename PLocTraits::IncEdgeIterator   IncEdgeIterator;
-
-  typedef typename PLocTraits::Curve             Curve;
-  typedef typename PLocTraits::PredCompareCurves PredCompareCurves;
-
-  typedef typename PLocTraits::QueryResult       QueryResult;
-
-/*{\Mtypes}*/
-  // define additional types 
-  typedef GenericLocation<Node, Edge> Location;
-  /*{\Mtypedef usual return value for the point loaction.}*/
-
-  enum Direction { downwards, upwards};
-  /*{\Menum used to specify the direction for the point location.}*/
-
-  typedef CGAL_LEDA_SCOPE::pp_dictionary<Curve, Location, PredCompareCurves>   
-                                                              Sweepline;
-  typedef GenericXStructure<XCoord, PredLessThanX, Sweepline> XStructure;
-  typedef typename Sweepline::item                            SL_item;
-  typedef typename XStructure::Sweepline_iterator Sweepline_iterator;
-  /*{\Mcreation}*/ 
-  PointLocator() { clear(); }
-  /*{\Mcreate creates an empty |\Mtype|.}*/
-
-  PointLocator(const Graph& G, const PLocTraits& PLT = PLocTraits()) : 
-   traits(PLT) { init(G); }
-  /*{\Mcreate creates a |\Mtype| for the graph |G| and the traits |PLT|.}*/
-     
-  /*{\Moperations}*/
-  void clear() { X_Structure.clear(); traits.clear(); }
-  /*{\Mop makes |\Mvar| empty.}*/
-
-
-  void init(const Graph& G, const PLocTraits& PLT) { traits = PLT; init(G); }
-  /*{\Mop makes |\Mvar| a |\Mtype| for the graph |G| and the traits |PLT|.}*/
-
-  void init(const Graph& G);
-  /*{\Mop makes |\Mvar| a |\Mtype| for the graph |G|.}*/
-
-
-  QueryResult locate(const Point& p, const Direction dir) const
-  { return dir == downwards ? locate_down(p) : locate_up(p); }
-  /*{\Mop locates the point |p| in the direction |dir|.}*/
-
-  QueryResult locate_down(const Point& p) const;
-  /*{\Mop locates the point |p| vertically downwards.}*/
-
-  QueryResult locate_up(const Point& p) const;
-  /*{\Mop locates the point |p| vertically upwards.}*/
-
-  Location location(Sweepline_iterator S, SL_item it) const
-  { return (it == nil ? Location() : S->inf(it)); }
-
-  std::string str(const Sweepline& S) const
-  { std::ostringstream os; os << "Sweepline:\n";
-    SL_item it;
-    forall_items(it,S) {  os << "  " << S.key(it) << std::endl; }
-    return os.str();
-  }
-
-
-private:
-  PLocTraits traits;
-  XStructure X_Structure;
-
-};
-
-template <class PLocTraits>
-void
-PointLocator<PLocTraits>::init(const Graph& G)
-{
-  traits.sweep_begin(G);
-  PredLessThanX LtX = traits.getLessThanX();
-  typedef std::map<XCoord, std::list<Node>, PredLessThanX> dictionary;
-  typedef typename dictionary::iterator dic_iterator;
-  dictionary stops(LtX);
-  // Note: X_Structure, Sweepline, and stops copy compare object
-
-  NodeIterator ni = traits.Nodes_begin(G), beyond = traits.Nodes_end(G);
-  for(; ni != beyond; ++ni) {
-    XCoord currentX = traits.getXCoord(G, ni);
-    stops[currentX].push_front(traits.toNode(ni));
-  }
-
-  Sweepline SL(traits.getCompareCurves());
-  X_Structure.init(stops.size(), LtX);
-  dic_iterator stop;
-  for(stop = stops.begin(); stop != stops.end(); ++stop) {
-    std::list<Node>& NodesOnSL = stop->second;
-    traits.sweep_moveto(traits.getXCoord(G, *NodesOnSL.begin()));
-      std::list<Edge> EmergingEdges, VerticalEdges;
-
-      // explore the nodes on SL
-      typename std::list<Node>::iterator cur_node;
-      for(cur_node = NodesOnSL.begin(); 
-          cur_node != NodesOnSL.end(); ++cur_node) {
-        IncEdgeIterator ei     = traits.IncEdges_begin(G, *cur_node);
-        IncEdgeIterator beyond = traits.IncEdges_end(G, *cur_node);
-          CGAL_NEF_TRACEN("NODE: "<<(*cur_node)->point());
-        for(; ei != beyond; ++ei) { 
-          switch (traits.ClassifyEdge(G, traits.toEdge(ei), *cur_node)) {
-            case PLocTraits::StartingNonVertical: 
-              EmergingEdges.push_front(traits.toEdge(ei)); break;
-            case PLocTraits::StartingVertical:    
-              VerticalEdges.push_front(traits.toEdge(ei)); break;
-            case PLocTraits::EndingNonVertical:
-              SL.del(traits.makeCurve(G, traits.toEdge(ei))); break;
-            case PLocTraits::EndingVertical: break;
-          }
-        }
-      }
-
-      // compute SL_at_X
-
-      typename std::list<Edge>::iterator cur_edge;
-      for(cur_edge=VerticalEdges.begin(); 
-          cur_edge!=VerticalEdges.end(); ++cur_edge) 
-        SL.insert(traits.makeCurve(G, *cur_edge), Location(*cur_edge));
-      for(cur_node=NodesOnSL.begin();
-          cur_node!=NodesOnSL.end(); ++cur_node)
-        SL.insert(traits.makeCurve(G, *cur_node), Location(*cur_node));
-      Sweepline SL_at_X = SL;
-
-      // compute SL_in_X_plus
-
-      for(cur_edge=VerticalEdges.begin(); 
-          cur_edge!=VerticalEdges.end(); ++cur_edge)
-        SL.del(traits.makeCurve(G, *cur_edge));
-      for(cur_node=NodesOnSL.begin();
-          cur_node!=NodesOnSL.end(); ++cur_node)
-        SL.del(traits.makeCurve(G, *cur_node));
-
-      for(cur_edge=EmergingEdges.begin();
-          cur_edge!=EmergingEdges.end(); ++cur_edge) 
-        SL.insert(traits.makeCurve(G, *cur_edge), Location(*cur_edge));
-
-    X_Structure.insertLines(traits.getXCoord(G, *NodesOnSL.begin()), 
-                            SL_at_X, SL);
-  }
-
-  traits.sweep_end();
-}
-
-template <class PLocTraits>
-typename PointLocator<PLocTraits>::QueryResult
-PointLocator<PLocTraits>::
-locate_down(const typename PLocTraits::Point& p) const
-{
-  Sweepline_iterator line_at_x = X_Structure.getLineAt(traits.getXCoord(p)),
-                     line_plus = line_at_x;
-  CGAL_NEF_TRACEN("locate_down "<<str(*line_at_x));
-  Curve p_curve = traits.makeCurve(p);
-  PredCompareCurves cmp = traits.getCompareCurves();
-  SL_item it = line_at_x->locate_pred(p_curve), it_plus(0);
-  if ( it && line_at_x->inf(it).is_node() &&
-       cmp(p_curve, line_at_x->key(it))!=0 ) {
-    // p hit a feature exactly
-    line_plus = line_at_x+1;
-    if ( line_plus != X_Structure.end() )
-      it_plus = line_plus->locate_pred(p_curve);
-  }
-  return traits.PostProcess(location(line_at_x,it),
-                            location(line_plus,it_plus),p);
-}
-
-template <class PLocTraits>
-typename PointLocator<PLocTraits>::QueryResult
-PointLocator<PLocTraits>::locate_up(const typename PLocTraits::Point& p) const
-{
-  Sweepline_iterator line_at_x = 
-    X_Structure.getLineAt(traits.getXCoord(p)), line_plus;
-  Curve p_curve = traits.makeCurve(p);
-  PredCompareCurves cmp = traits.getCompareCurves();
-  SL_item it = line_at_x->locate_succ(p_curve), it_plus(0);
-  if ( it && line_at_x->inf(it).is_node() &&
-       cmp(p_curve, line_at_x->key(it))!=0 ) {
-    // p hit a feature exactly
-    line_plus = line_at_x+1;
-    if ( line_plus != X_Structure.end() )
-      it_plus = line_plus->locate_succ(p_curve);
-  }
-  return traits.PostProcess(location(line_at_x,it),
-                            location(line_plus,it_plus), p);
-}
-
-/*{\Mimplementation
-  The implementation of the data type |\Mtype| is based on partially 
-  persistent binary search trees.
-  The expected space requirement is $O(k)$ where $k$ is the sum of the number 
-  of nodes and the number of edges in the graph $G$.
-  The expected time needed for construction and the operation |init| is 
-  $O(k \cdot \log k)$, for the |locate|-operations it is $O(\log k)$. The
-  operation |clear| runs in $O(k)$.
-}*/
-/*{\Mtext
-  \headerline{\arabic{manctr}. Predefined traits classes}
-  \stepcounter{manctr}
-  All predefined traits classes have in common that the return type of a query 
-  is the type |Location|.
-  The embedding of the given graph |G| is a straight-line embedding, so that
-  it is totally determined by the position of the nodes of |G|.
-  Such a position is specified by a |Point| which can be one of the LEDA point
-  types |point| or |rat_point|. The positions can be specified implicitly by 
-  the node attribute of a parameterized graph (e.g. |GRAPH<Point,...>|) or 
-  explicitly by a |node_array<Point>|. In case of explicit specification a
-  |node_array| with the positions of the nodes can be passed to the constructor
-  of the traits class.
-  Further, the point location processes for maps and for standard graphs differ
-  slightly. As a map is a bidirected graph where each edge knows its reversal,
-  the traits classes for maps can ensure the following property:
-  If the result of a query for point |p| is an edge |e| (not containing |p|),
-  then |e| bounds the face of |G| which contains |p|, i.e. |p| lies to the
-  left of |e|.\\
-  Here comes a list of the predefined traits classes:\\[-5.5ex]
-  \begin{itemize}
-  \item |PLocTraits<Graph>|: standard traits for implicitly specified node 
-    positions\\
-    |Graph| can be |GRAPH<Point,...>| (standard graph) or 
-    |PLANAR_MAP<Point,...,...>| (map).
-  \item |PLocTraits_NodeArray<Graph,Point>|: std. traits for explicitly 
-    specified node positions\\
-    |Graph| can be |graph| (standard graph) or |planar_map| (map).
-  \item |PLocTraits_Map<Graph>| and |PLocTraits_Map_NodeArray<Graph,Point>|:\\
-    The parameter |Graph| can be |GRAPH<Point,...>| and |graph| respectively.
-    These traits classes assume that the given graphs are maps.
-  \item |PLocTraits< GRAPH<Circle,Point> >|: traits class for closest-site 
-    voronoi diagrams
-  \end{itemize}
-  Note that a traits class instantiated with |Graph| can also handle graph 
-  types which are derived from |Graph|. Thus |PLocTraits< graph<Point,T> >| 
-  can be used for graphs of type |ugraph<Point,T>| for example.
-}*/
-/*{\Mexample
-First we show an example where the node positions are given implicitly
-as node attributes:
-\begin{verbatim}
-  typedef PointLocator< PLocTraits< GRAPH<Point, int> > > PLocator1;
-  typedef PLocator1::Location Location;
-
-  UGRAPH<Point, int> G;
-  ... // construct G
-
-  PLocator1 PL1(G);
-  Point p = ...; // compute p
-  Location L1 = PL1.locate_down(p);
-\end{verbatim}
-
-The second example shows how a |node_array| can be used to determine the
-node positions:
-\begin{verbatim}
-  typedef PLocTraits_NodeArray<planar_map,Point> PLocTraits2;
-  typedef PointLocator<PLocTraits2> PLocator2;
-
-  planar_map pm;
-  node_array<Point> na;
-  ... // construct pm and na
-
-  PLocator2 PL2(pm, PLocTraits2(na));
-  Point q = ...; // compute q
-  Location L2 = PL2.locate_up(q);
-\end{verbatim}
-}*/
-
-#endif // GEN_POINT_LOCATION_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_point_locator.h b/3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_point_locator.h
deleted file mode 100644
index 3ba4c33..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_point_locator.h
+++ /dev/null
@@ -1,1389 +0,0 @@
-// Copyright (c) 1997-2000  Max-Planck-Institute Saarbruecken (Germany).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Miguel Granados <granados at mpi-sb.mpg.de>
-
-#ifndef CGAL_NEF_SNC_POINT_LOCATOR_H
-#define CGAL_NEF_SNC_POINT_LOCATOR_H
-
-#include <CGAL/basic.h>
-#include <CGAL/Nef_3/SNC_intersection.h>
-#ifdef CGAL_NEF3_POINT_LOCATOR_NAIVE
-#include <CGAL/Nef_3/SNC_ray_shooter.h>
-#endif
-#ifdef CGAL_NEF3_LAZY_KDTREE
-#include <CGAL/Nef_3/Lazy_k3_tree.h>
-#endif
-#include <CGAL/Nef_3/SNC_k3_tree_traits.h>
-#include <CGAL/Nef_3/K3_tree.h>
-#include <CGAL/Unique_hash_map.h>
-#include <CGAL/Timer.h>
-#include <cstring> // for std::strcpy
-
-#ifdef CGAL_NEF3_TRIANGULATE_FACETS
-#include <CGAL/Constrained_triangulation_2.h>
-#include <CGAL/Triangulation_data_structure_2.h>
-#include <CGAL/Projection_traits_xy_3.h>
-#include <CGAL/Projection_traits_yz_3.h>
-#include <CGAL/Projection_traits_xz_3.h>
-#include <CGAL/Constrained_triangulation_face_base_2.h>
-#endif
-
-#undef CGAL_NEF_DEBUG
-#define CGAL_NEF_DEBUG 509
-#include <CGAL/Nef_2/debug.h>
-
-#undef _CGAL_NEF_TRACEN
-#define _CGAL_NEF_TRACEN(msg) CGAL_NEF_TRACEN( "SNC_point_locator: " << msg)
-
-// TODO: find out the proper CGAL replacement for this macro and remove it
-#define CGAL_for_each( i, C) for( i = C.begin(); i != C.end(); ++i)
-
-// #define CGAL_NEF_TIMER(instruction) instruction
-#define CGAL_NEF_TIMER(instruction)
-
-// #define CGAL_NEF_CLOG(t) std::clog <<" "<<t<<std::endl; std::clog.flush()
-#define CGAL_NEF_CLOG(t)
-
-namespace CGAL {
-
-template <typename SNC_decorator>
-class SNC_point_locator
-{
- public:
-  class Intersection_call_back;
-  typedef SNC_decorator Base;
-  typedef SNC_point_locator<SNC_decorator> Self;
-  typedef typename SNC_decorator::Decorator_traits Decorator_traits;
-  typedef typename SNC_decorator::SNC_structure SNC_structure;
-protected:
-  char version_[64];
-  // time for construction, point location, ray shooting and intersection test
-  mutable Timer ct_t, pl_t, rs_t, it_t; 
-
-public: 
-  typedef typename SNC_structure::Object_handle Object_handle;
-
-  typedef typename SNC_structure::Point_3 Point_3;
-  typedef typename SNC_structure::Segment_3 Segment_3;
-  typedef typename SNC_structure::Ray_3 Ray_3;
-  typedef typename SNC_structure::Vector_3 Vector_3;
-  typedef typename SNC_structure::Aff_transformation_3 
-                                  Aff_transformation_3;
-
-  typedef typename Decorator_traits::Vertex_handle Vertex_handle;
-  typedef typename Decorator_traits::Halfedge_handle Halfedge_handle;
-  typedef typename Decorator_traits::Halffacet_handle Halffacet_handle;
-  typedef typename Decorator_traits::Volume_handle Volume_handle;
-  typedef typename Decorator_traits::Vertex_iterator Vertex_iterator;
-  typedef typename Decorator_traits::Halfedge_iterator Halfedge_iterator;
-  typedef typename Decorator_traits::Halffacet_iterator Halffacet_iterator;
-
-
-  const char* version() { return version_; }
-
-  virtual Object_handle locate(const Point_3& p) const = 0;
-
-  virtual Object_handle shoot(const Ray_3& s, int mask=255) const = 0;
-
-  virtual void intersect_with_edges( Halfedge_handle edge,
-                                     const Intersection_call_back& call_back) 
-    const = 0;
-
-  virtual void intersect_with_facets( Halfedge_handle edge,
-                                      const Intersection_call_back& call_back)
-    const = 0;
-
-  virtual void intersect_with_edges_and_facets( Halfedge_handle edge,
-	const Intersection_call_back& call_back) const = 0;
-
-  class Intersection_call_back 
-  {
-  public:
-    virtual void operator()( Halfedge_handle edge, Object_handle object, 
-                             const Point_3& intersection_point) const = 0;
-    
-    virtual ~Intersection_call_back() {}
-  };
-
-  virtual void initialize(SNC_structure* W) = 0;
-
-  virtual Self* clone() const = 0;
-
-  virtual void transform(const Aff_transformation_3& t) = 0;
-
-  //virtual bool update( Unique_hash_map<Vertex_handle, bool>& V, 
-  //                   Unique_hash_map<Halfedge_handle, bool>& E, 
-  //                   Unique_hash_map<Halffacet_handle, bool>& F) = 0;
-
-  virtual void add_facet(Halffacet_handle) {}
-
-  virtual void add_edge(Halfedge_handle) {}
-
-  virtual void add_vertex(Vertex_handle) {}
-
-  virtual ~SNC_point_locator() {
-    CGAL_NEF_CLOG("");
-    CGAL_NEF_CLOG("construction_time:  "<<ct_t.time());
-    CGAL_NEF_CLOG("pointlocation_time: "<<pl_t.time());
-    CGAL_NEF_CLOG("rayshooting_time:   "<<rs_t.time());
-    CGAL_NEF_CLOG("intersection_time:  "<<it_t.time());
-    // warning: the total time showed here could be actually larger
-    // that the real time used by this class, since point location
-    // and intersection test use the ray shooter and so the same time 
-    // could be account to more than one timer
-    CGAL_NEF_CLOG("pltotal_time:       "<<
-      ct_t.time()+pl_t.time()+rs_t.time()+it_t.time());
-  };
-};
-
-template <typename SNC_decorator>
-class SNC_point_locator_by_spatial_subdivision : 
-  public SNC_point_locator<SNC_decorator>,
-  public SNC_decorator
-{ 
-  typedef SNC_decorator Base;
-  typedef CGAL::SNC_point_locator<SNC_decorator> SNC_point_locator;
-  typedef CGAL::SNC_point_locator_by_spatial_subdivision<SNC_decorator> Self;
-  typedef typename SNC_decorator::SNC_structure SNC_structure;
-  typedef typename SNC_decorator::Decorator_traits Decorator_traits;
-  typedef typename Decorator_traits::SM_decorator SM_decorator;
-  typedef CGAL::SNC_intersection<SNC_structure> SNC_intersection;
-  typedef typename SNC_decorator::SM_point_locator SM_point_locator;
-  typedef typename SNC_decorator::Kernel Kernel;
-
-public:
-  typedef typename CGAL::SNC_k3_tree_traits<SNC_decorator> K3_tree_traits;
-#ifdef CGAL_NEF3_LAZY_KDTREE
-  typedef typename CGAL::Lazy_k3_tree<K3_tree_traits> K3_tree;
-#else
-  typedef typename CGAL::K3_tree<K3_tree_traits> K3_tree;
-#endif
-  typedef K3_tree SNC_candidate_provider;
-  
-  typedef typename SNC_structure::Object_handle Object_handle;
- #ifdef CGAL_NEF3_TRIANGULATE_FACETS
-  typedef typename Decorator_traits::Halffacet_triangle_handle 
-                                     Halffacet_triangle_handle;
-#endif
-#ifdef CGAL_NEF3_FACET_WITH_BOX
-  typedef typename SNC_structure::Partial_facet Partial_facet;
-#endif
-  typedef typename SNC_structure::Point_3 Point_3;
-  typedef typename SNC_structure::Plane_3 Plane_3;
-  typedef typename SNC_structure::Segment_3 Segment_3;
-  typedef typename SNC_structure::Ray_3 Ray_3;
-  typedef typename SNC_structure::Vector_3 Vector_3;
-  typedef typename SNC_structure::Triangle_3 Triangle_3;
-  typedef typename SNC_structure::Aff_transformation_3 
-                                  Aff_transformation_3;
-
-  typedef typename SNC_structure::Infi_box Infi_box;
-
-  typedef typename Decorator_traits::Vertex_handle Vertex_handle;
-  typedef typename Decorator_traits::Halfedge_handle Halfedge_handle;
-  typedef typename Decorator_traits::Halffacet_handle Halffacet_handle;
-  typedef typename Decorator_traits::SHalfedge_handle SHalfedge_handle;
-  typedef typename Decorator_traits::SFace_handle SFace_handle;
-  typedef typename Decorator_traits::Vertex_iterator Vertex_iterator;
-  typedef typename Decorator_traits::Halfedge_iterator Halfedge_iterator;
-  typedef typename Decorator_traits::Halffacet_iterator Halffacet_iterator;
-  typedef typename Decorator_traits::Volume_handle Volume_handle;
-
-  typedef typename Decorator_traits::Halffacet_cycle_iterator 
-                                     Halffacet_cycle_iterator;
-  typedef typename Decorator_traits::SHalfedge_around_facet_circulator 
-	                             SHalfedge_around_facet_circulator;
-
-  typedef typename SNC_candidate_provider::Object_list Object_list;
-  typedef typename Object_list::iterator Object_list_iterator;
-  typedef typename SNC_candidate_provider::Objects_along_ray Objects_along_ray;
-  typedef typename Objects_along_ray::Iterator Objects_along_ray_iterator;
-
-  //  typedef typename SNC_candidate_provider::Objects_around_box Objects_around_box;
-
-  using Base::get_visible_facet;
-public:
-  SNC_point_locator_by_spatial_subdivision() : 
-    initialized(false), candidate_provider(0) {}
-
-#ifdef CGAL_NEF3_TRIANGULATE_FACETS	
-  template<typename Kernel>
-  class Triangulation_handler {
-
-    typedef typename CGAL::Triangulation_vertex_base_2<Kernel>               Vb;
-    typedef typename CGAL::Constrained_triangulation_face_base_2<Kernel>     Fb;
-    typedef typename CGAL::Triangulation_data_structure_2<Vb,Fb>             TDS;
-    typedef typename CGAL::No_intersection_tag                               Itag;
-    typedef typename CGAL::Constrained_triangulation_2<Kernel,TDS,Itag>      CT;
-
-    typedef typename CT::Face_handle           Face_handle;
-    typedef typename CT::Finite_faces_iterator Finite_face_iterator;
-    typedef typename CT::Edge                  Edge;
-
-    CT ct;
-    CGAL::Unique_hash_map<Face_handle, bool> visited;
-    Finite_face_iterator fi;
-
-  public:
-    template<typename Halffacet_handle>
-    Triangulation_handler(Halffacet_handle f) : visited(false) {
-
-      Halffacet_cycle_iterator fci;
-      for(fci=f->facet_cycles_begin(); fci!=f->facet_cycles_end(); ++fci) {
-	if(fci.is_shalfedge()) {
-          SHalfedge_around_facet_circulator sfc(fci), send(sfc);
-	  CGAL_For_all(sfc,send) {
-            CGAL_NEF_TRACEN("  insert constraint" << sfc->source()->source()->point()
-	                     << "->" << sfc->source()->twin()->source()->point());
-	    ct.insert_constraint(sfc->source()->source()->point(),
-	                         sfc->source()->twin()->source()->point());
-          }
-        }
-      }
-      CGAL_assertion(ct.is_valid());
-
-      CGAL_NEF_TRACEN("number of finite triangles " << ct.number_of_faces());
-
-      typename CT::Face_handle infinite = ct.infinite_face();
-      typename CT::Vertex_handle ctv = infinite->vertex(1);
-      if(ct.is_infinite(ctv)) ctv = infinite->vertex(2);
-      CGAL_assertion(!ct.is_infinite(ctv));
-
-      typename CT::Face_handle opposite;
-      typename CT::Face_circulator vc(ctv,infinite);
-      do { opposite = vc++;
-      } while(!ct.is_constrained(CT::Edge(vc,vc->index(opposite))));
-      typename CT::Face_handle first = vc;
-
-      CGAL_assertion(!ct.is_infinite(first));
-      traverse_triangulation(first, first->index(opposite));
-
-      /*
-      for(fi = ct.finite_faces_begin(); fi != ct.finite_faces_end(); ++fi)
-        CGAL_NEF_TRACEN("  finite face " 
-	  << Triangle_3(fi->vertex(0)->point(), fi->vertex(1)->point(), fi->vertex(2)->point())
-	   << "was visited " << visited[fi]);
-      */
-
-      fi = ct.finite_faces_begin();
-    }
-
-    void traverse_triangulation(Face_handle f, int parent) {
-      visited[f] = true;
-      if(!ct.is_constrained(Edge(f,ct.cw(parent))) && !visited[f->neighbor(ct.cw(parent))]) {
-	Face_handle child(f->neighbor(ct.cw(parent)));
-	traverse_triangulation(child, child->index(f));
-      } 
-      if(!ct.is_constrained(Edge(f,ct.ccw(parent))) && !visited[f->neighbor(ct.ccw(parent))]) {
-	Face_handle child(f->neighbor(ct.ccw(parent)));
-	traverse_triangulation(child, child->index(f));
-      } 
-    } 
- 
-    template<typename Triangle_3>
-    bool get_next_triangle(Triangle_3& tr) {
-      while(fi != ct.finite_faces_end() && visited[fi] == false) ++fi;
-      if(fi == ct.finite_faces_end()) return false;
-      tr = Triangle_3(fi->vertex(0)->point(), fi->vertex(1)->point(), fi->vertex(2)->point());
-      ++fi;
-      return true;
-    }
-  };
-#endif
-
-  virtual void initialize(SNC_structure* W) {
-#ifdef CGAL_NEF_LIST_OF_TRIANGLES
-    this->set_snc(*W);
-    candidate_provider = new SNC_candidate_provider(W);
-#else // CGAL_NEF_LIST_OF_TRIANGLES
-    CGAL_NEF_TIMER(ct_t.start());
-    std::strcpy( this->version_, "Point Locator by Spatial Subdivision (tm)");
-#ifdef CGAL_NEF3_TRIANGULATE_FACETS
-    CGAL_NEF_CLOG(version()<<" (with triangulated facets)");
-#else
-    CGAL_NEF_CLOG(version());
-#endif
-    CGAL_assertion( W != NULL);
-//    (Base) *this = SNC_decorator(*W);
-    this->set_snc(*W);
-    Object_list objects;
-    Vertex_iterator v;
-    Halfedge_iterator e;
-    Halffacet_iterator f;
-    CGAL_forall_vertices( v, *this->sncp())
-      objects.push_back(make_object(Vertex_handle(v)));
-    typename Object_list::difference_type v_end = objects.size();
-    CGAL_forall_edges( e, *this->sncp())
-      objects.push_back(make_object(Halfedge_handle(e)));
-    CGAL_forall_facets( f, *this->sncp()) {
-#ifdef CGAL_NEF3_TRIANGULATE_FACETS
-
-#ifndef CGAL_NEF3_TRIANGULATION_MINIMUM
-#define CGAL_NEF3_TRIANGULATION_MINIMUM 25
-#endif
-
-      Halffacet_cycle_iterator fci = f->facet_cycles_begin();
-      CGAL_assertion(fci.is_shalfedge());
-      SHalfedge_around_facet_circulator safc(fci), send(safc);
-      int length = 0;
-      int stop = CGAL_NEF3_TRIANGULATION_MINIMUM;
-      while(++length < stop && ++safc != send);
-      if(length >= stop) {
-
-	CGAL_NEF_TRACEN("triangulate facet " << f->plane());
-      
-	typedef typename CGAL::Projection_traits_xy_3<Kernel>       XY;
-	typedef typename CGAL::Projection_traits_yz_3<Kernel>       YZ;
-	typedef typename CGAL::Projection_traits_xz_3<Kernel>       XZ;
-	
-	Triangle_3 tr;
-	
-	Vector_3 orth = f->plane().orthogonal_vector();
-	int c = CGAL::abs(orth[0]) > CGAL::abs(orth[1]) ? 0 : 1;
-	c = CGAL::abs(orth[2]) > CGAL::abs(orth[c]) ? 2 : c;
-	
-	if(c == 0) {
-	  Triangulation_handler<YZ> th(f);
-	  while(th.get_next_triangle(tr)) {
-	    Halffacet_triangle_handle th( f, tr);
-	    objects.push_back(make_object(th));
-	    CGAL_NEF_TRACEN("add triangle " << tr);
-	  }
-	} else if(c == 1) {
-	  Triangulation_handler<XZ> th(f);
-	  while(th.get_next_triangle(tr)) {
-	    Halffacet_triangle_handle th( f, tr);
-	    objects.push_back(make_object(th));
-	    CGAL_NEF_TRACEN("add triangle " << tr);
-	  }
-	} else if(c == 2) {
-	  Triangulation_handler<XY> th(f);
-	  while(th.get_next_triangle(tr)) {
-	    Halffacet_triangle_handle th( f, tr);
-	    objects.push_back(make_object(th));
-	    CGAL_NEF_TRACEN("add triangle " << tr);
-	  }
-	} else
-	  CGAL_error_msg( "wrong value");
-      } else {
-        CGAL_NEF_TRACEN("add facet " << f->plane());
-        objects.push_back(make_object(Halffacet_handle(f)));
-      }
-#elif defined CGAL_NEF3_FACET_WITH_BOX
-#ifndef CGAL_NEF3_PARTITION_MINIMUM
-#define CGAL_NEF3_PARTITION_MINIMUM 6
-#endif
-      Halffacet_cycle_iterator fci = f->facet_cycles_begin();
-      CGAL_assertion(fci.is_shalfedge());
-      SHalfedge_around_facet_circulator safc(fci), send(safc);
-      int length = 0;
-      int stop = CGAL_NEF3_PARTITION_MINIMUM;
-      while(++length < stop && ++safc != send);
-      if(length >= stop) {
-	CGAL_NEF_TRACEN("use Partial facets ");
-	Partial_facet pf(f);
-	objects.push_back(make_object(pf));
-      } else {
-        objects.push_back(make_object(Halffacet_handle(f)));
-      }
-#else
-      objects.push_back(make_object(Halffacet_handle(f)));
-#endif
-    }
-    if(initialized)
-      delete candidate_provider;
-#ifdef CGAL_NEF3_LAZY_KDTREE
-    candidate_provider = new SNC_candidate_provider(objects,v_end);
-#else
-    Object_list_iterator oli=objects.begin()+v_end;
-    candidate_provider = new SNC_candidate_provider(objects,oli);
-#endif
-    // CGAL_NEF_TRACEN(*candidate_provider);
-    CGAL_NEF_TIMER(ct_t.stop());
-#endif // CGAL_NEF_LIST_OF_TRIANGLES
-    initialized = true;
-  }
-
-  virtual Self* clone() const { 
-    return new Self; 
-  }
-
-  virtual void transform(const Aff_transformation_3& t) {
-    candidate_provider->transform(t);
-  }
-
-  virtual bool update( Unique_hash_map<Vertex_handle, bool>& V, 
-                       Unique_hash_map<Halfedge_handle, bool>& E, 
-                       Unique_hash_map<Halffacet_handle, bool>& F) {
-    CGAL_NEF_TIMER(ct_t.start());
-    CGAL_assertion( initialized);
-    bool updated = candidate_provider->update( V, E, F);
-    CGAL_NEF_TIMER(ct_t.stop());
-    return updated;
-  }
-
-  virtual ~SNC_point_locator_by_spatial_subdivision() {
-    CGAL_warning(initialized || 
-		 candidate_provider == 0); // required?
-    if(initialized)
-      delete candidate_provider;
-  }
-
-  /*
-  template <typename Box>
-  bool point_in_box(const Box& box, const Point_3& p) {
-    if(p.x() < box.min_coord(0)) return true;
-    if(p.x() > box.max_coord(0)) return true;
-    if(p.y() < box.min_coord(1)) return true;
-    if(p.y() > box.max_coord(1)) return true;
-    if(p.z() < box.min_coord(2)) return true;
-    if(p.z() > box.max_coord(2)) return true;
-    return false;
-  }
-
-  template <typename Box>
-  bool in_range(const Box& box) const {
-    Vertex_handle v;
-    Halfedge_handle e;
-    Halffacet_handle f;
-
-    Objects_around_box oab;
-    typename Objects_around_box::Iterator 
-      objects_iterator(oab.begin());
-    for( ; objects_iterator != oab.end(); ++objects_iterator) {
-      Object_list candidates = *objects_iterator;
-      Object_list_iterator o;
-      CGAL_for_each( o, candidates) {
-	if(CGAL::assign(v, *o)) {
-	  if(point_in_box(box, v->point()))
-	    return true;
-	} else if(CGAL::assign(e, *o)) {
-	  Point_3 ip;
-	  Point_3 pmin(box.min_coord(0), box.min_coord(1), box.min_coord(2));
-	  Point_3 pmax(box.max_coord(0), box.max_coord(1), box.max_coord(2));
-	  Segment_3 seg(e->source()->point(),
-			e->twin()->source()->point());
-
-	  Plane_3 pl(pmin, Vector_3(1,0,0));
-	  Object o = intersection(pl, seg);
-	  if(CGAL::assign(ip,o) && point_in_box(box, ip))
-	    return true;
-	  pl = Plane_3(pmin, Vector_3(0,1,0));
-	  o = intersection(pl, seg);
-	  if(CGAL::assign(ip,o) && point_in_box(box, ip))
-	    return true;
-	  pl = Plane_3(pmin, Vector_3(0,0,1));
-	  o = intersection(pl, seg);
-	  if(CGAL::assign(ip,o) && point_in_box(box, ip))
-	    return true;
-	  pl = Plane_3(pmax, Vector_3(1,0,0));
-	  o = intersection(pl, seg);
-	  if(CGAL::assign(ip,o) && point_in_box(box, ip))
-	    return true;
-	  pl = Plane_3(pmax, Vector_3(0,1,0));
-	  o = intersection(pl, seg);
-	  if(CGAL::assign(ip,o) && point_in_box(box, ip))
-	    return true;
-	  pl = Plane_3(pmax, Vector_3(0,0,1));
-	  o = intersection(pl, seg);
-	  if(CGAL::assign(ip,o) && point_in_box(box, ip))
-	    return true;
-	} else if(CGAL::assign(f, *o)) {
-	  Segment_3 seg(Point_3(box.min_coord(0), box.min_coord(1), box.min_coord(2)),
-			Point_3(box.min_coord(0), box.min_coord(1), box.max_coord(2)));
-	  if(is.does_intersect_internally(seg, f))
-	    return true;
-	  seg = Segment_3(Point_3(box.max_coord(0), box.min_coord(1), box.min_coord(2)),
-			  Point_3(box.max_coord(0), box.min_coord(1), box.max_coord(2)));
-	  if(is.does_intersect_internally(seg, f))
-	    return true;
-	  seg = Segment_3(Point_3(box.min_coord(0), box.max_coord(1), box.min_coord(2)),
-			  Point_3(box.min_coord(0), box.max_coord(1), box.max_coord(2)));
-	  if(is.does_intersect_internally(seg, f))
-	    return true;
-	  seg = Segment_3(Point_3(box.max_coord(0), box.max_coord(1), box.min_coord(2)),
-			  Point_3(box.max_coord(0), box.max_coord(1), box.max_coord(2)));
-	  if(is.does_intersect_internally(seg, f))
-	    return true;
-
-	  seg = Segment_3(Point_3(box.min_coord(0), box.min_coord(1), box.min_coord(2)),
-			  Point_3(box.min_coord(0), box.max_coord(1), box.min_coord(2)));
-	  if(is.does_intersect_internally(seg, f))
-	    return true;
-	  seg = Segment_3(Point_3(box.max_coord(0), box.min_coord(1), box.min_coord(2)),
-			  Point_3(box.max_coord(0), box.max_coord(1), box.min_coord(2)));
-	  if(is.does_intersect_internally(seg, f))
-	    return true;
-	  seg = Segment_3(Point_3(box.min_coord(0), box.min_coord(1), box.max_coord(2)),
-			  Point_3(box.min_coord(0), box.max_coord(1), box.max_coord(2)));
-	  if(is.does_intersect_internally(seg, f))
-	    return true;
-	  seg = Segment_3(Point_3(box.max_coord(0), box.min_coord(1), box.max_coord(2)),
-			  Point_3(box.max_coord(0), box.max_coord(1), box.max_coord(2)));
-	  if(is.does_intersect_internally(seg, f))
-	    return true;
-
-	  seg = Segment_3(Point_3(box.min_coord(0), box.min_coord(1), box.min_coord(2)),
-			  Point_3(box.max_coord(0), box.min_coord(1), box.min_coord(2)));
-	  if(is.does_intersect_internally(seg, f))
-	    return true;
-	  seg = Segment_3(Point_3(box.min_coord(0), box.max_coord(1), box.min_coord(2)),
-			  Point_3(box.max_coord(0), box.max_coord(1), box.min_coord(2)));
-	  if(is.does_intersect_internally(seg, f))
-	    return true;
-	  seg = Segment_3(Point_3(box.min_coord(0), box.min_coord(1), box.max_coord(2)),
-			  Point_3(box.max_coord(0), box.min_coord(1), box.max_coord(2)));
-	  if(is.does_intersect_internally(seg, f))
-	    return true;
-	  seg = Segment_3(Point_3(box.min_coord(0), box.max_coord(1), box.max_coord(2)),
-			  Point_3(box.max_coord(0), box.max_coord(1), box.max_coord(2)));
-	  if(is.does_intersect_internally(seg, f))
-	    return true;
-
-	} else
-	  CGAL_assertion_msg(false, "wrong handle");
-      }
-    }
-    return false;
-  }
-  */
-
-  virtual Object_handle shoot(const Ray_3& ray, int mask=255) const {
-    CGAL_NEF_TIMER(rs_t.start());
-    CGAL_assertion( initialized);
-    _CGAL_NEF_TRACEN( "shooting: "<<ray);
-    Object_handle result;
-    Vertex_handle v;
-    Halfedge_handle e;
-    Halffacet_handle f;
-#ifdef CGAL_NEF3_TRIANGULATE_FACETS
-    Halffacet_triangle_handle t;
-#endif
-#ifdef CGAL_NEF3_FACET_WITH_BOX
-    Partial_facet pf;
-#endif
-    bool hit = false;
-    Point_3 eor; // 'end of ray', the latest ray's hit point
-    Objects_along_ray objects = candidate_provider->objects_along_ray(ray);
-    Objects_along_ray_iterator objects_iterator = objects.begin();
-    while( !hit && objects_iterator != objects.end()) {
-      Object_list candidates = *objects_iterator;
-      Object_list_iterator o;
-      CGAL_for_each( o, candidates) {
-        if( CGAL::assign( v, *o) && ((mask&1) != 0)) {
-          _CGAL_NEF_TRACEN("trying vertex on "<<v->point());
-          if( ray.source() != v->point() && ray.has_on(v->point())) {
-            _CGAL_NEF_TRACEN("the ray intersects the vertex");
-            _CGAL_NEF_TRACEN("prev. intersection? "<<hit);
-            CGAL_assertion_code
-	      (if( hit)_CGAL_NEF_TRACEN("prev. intersection on "<<eor));
-            if( hit && !Segment_3( ray.source(), eor).has_on(v->point()))
-              continue;
-            eor = v->point();
-            result = make_object(v);
-            hit = true;
-            _CGAL_NEF_TRACEN("the vertex becomes the new hit object");
-          }
-        }
-        else if( CGAL::assign( e, *o) && ((mask&2) != 0)) {
-          Point_3 q;
-          _CGAL_NEF_TRACEN("trying edge on "<< Segment_3(e->source()->point(),e->twin()->source()->point()));
-          if( is.does_intersect_internally( ray, Segment_3(e->source()->point(),
-                                                           e->twin()->source()->point()), q)) {
-            _CGAL_NEF_TRACEN("ray intersects edge on "<<q);
-            _CGAL_NEF_TRACEN("prev. intersection? "<<hit);
-            CGAL_assertion_code
-	      (if( hit) _CGAL_NEF_TRACEN("prev. intersection on "<<eor));
-            if( hit && !has_smaller_distance_to_point( ray.source(), q, eor))
-              continue;
-            _CGAL_NEF_TRACEN("is the intersection point on the current cell? "<<
-                    candidate_provider->is_point_on_cell( q, objects_iterator));
-            if( !candidate_provider->is_point_on_cell( q, objects_iterator))
-                continue;
-            eor = q; 
-            result = make_object(e);
-            hit = true;
-            _CGAL_NEF_TRACEN("the edge becomes the new hit object");
-          }
-        }
-        else if( CGAL::assign( f, *o) && ((mask&4) != 0)) {
-          Point_3 q;
-          _CGAL_NEF_TRACEN("trying facet with on plane "<<f->plane()<<
-                  " with point on "<<f->plane().point());
-          if( is.does_intersect_internally( ray, f, q, true) ) {
-            _CGAL_NEF_TRACEN("ray intersects facet on "<<q);
-            _CGAL_NEF_TRACEN("prev. intersection? "<<hit);
-            if( hit) { _CGAL_NEF_TRACEN("prev. intersection on "<<eor); }
-            if( hit && !has_smaller_distance_to_point( ray.source(), q, eor))
-	      continue;
-            _CGAL_NEF_TRACEN("is the intersection point on the current cell? "<<
-                    candidate_provider->is_point_on_cell( q, objects_iterator));
-            if( !candidate_provider->is_point_on_cell( q, objects_iterator))
-	      continue;
-            eor = q;
-            result = make_object(f);
-            hit = true; 
-            _CGAL_NEF_TRACEN("the facet becomes the new hit object");
-          }
-        }
-#ifdef CGAL_NEF3_FACET_WITH_BOX
-	else if( CGAL::assign(pf, *o) && ((mask&4) != 0)) {
-	  CGAL_NEF_TRACEN("new ray shooting");
-          Point_3 q;
-          if( is.does_intersect_internally( ray, pf, q) ) {
-            if( hit && !has_smaller_distance_to_point( ray.source(), q, eor))
-	      continue;
-            if( !candidate_provider->is_point_on_cell( q, objects_iterator))
-	      continue;
-            eor = q;
-            result = make_object(pf.f);
-            hit = true; 
-          }
-	}
-#endif
-#ifdef CGAL_NEF3_TRIANGULATE_FACETS
-        else if( CGAL::assign( t, *o) && ((mask&8) != 0)) {
-          Point_3 q;
-          Triangle_3 tr = t.get_triangle();
-          _CGAL_NEF_TRACEN("trying triangle "<<tr);
-          if( is.does_intersect( ray, tr, q) && normalized(q) != ray.source()) {
-            _CGAL_NEF_TRACEN("ray intersect triangle on "<< normalized(q));
-            _CGAL_NEF_TRACEN("prev. intersection? "<<hit);
-            if( hit) _CGAL_NEF_TRACEN("prev. intersection on "<< normalized(eor));
-            if( hit && !has_smaller_distance_to_point( ray.source(), q, eor))
-              continue;
-            _CGAL_NEF_TRACEN("is the intersection point on the boundary of the facet? "<<
-                    is.does_contain_on_boundary( t, q));
-            if( is.does_contain_on_boundary( t, q))
-              continue;
-            _CGAL_NEF_TRACEN("is the intersection point on the current cell? "<<
-                    candidate_provider->is_point_on_cell(q,objects_iterator));
-            if( !candidate_provider->is_point_on_cell( q, objects_iterator))
-                continue;
-            eor = q;
-            result = make_object(Halffacet_handle(t));
-            hit = true; 
-            _CGAL_NEF_TRACEN("the facet becomes the new hit object");
-          }
-        }
-#endif
-        else if((mask&15) == 15)
-          CGAL_error_msg( "wrong handle");
-      }
-      if(!hit)
-        ++objects_iterator;
-    }
-    CGAL_NEF_TIMER(rs_t.stop());
-    return result;
-  }
-
-  virtual Object_handle locate( const Point_3& p) const {
-    if(Infi_box::extended_kernel()) {
-    CGAL_NEF_TIMER(pl_t.start());
-    CGAL_assertion( initialized);
-    _CGAL_NEF_TRACEN( "locate "<<p);
-    Object_handle result;
-    Vertex_handle v;
-    Halfedge_handle e;
-    Halffacet_handle f;
-#ifdef CGAL_NEF3_TRIANGULATE_FACETS
-    Halffacet_triangle_handle t;
-#endif
-#ifdef CGAL_NEF3_FACET_WITH_BOX
-    Partial_facet pf;
-#endif
-    Object_list candidates = candidate_provider->objects_around_point(p);
-    Object_list_iterator o = candidates.begin();
-    bool found = false;
-    while( !found && o != candidates.end()) {
-      if( CGAL::assign( v, *o)) {
-        if ( p == v->point()) {
-          _CGAL_NEF_TRACEN("found on vertex "<<v->point());
-          result = make_object(v);
-          found = true;
-        }
-      }
-      else if( CGAL::assign( e, *o)) {
-        if ( is.does_contain_internally(Segment_3(e->source()->point(),e->twin()->source()->point()), p) ) {
-          _CGAL_NEF_TRACEN("found on edge "<<Segment_3(e->source()->point(),e->twin()->source()->point()));
-          result = make_object(e);
-          found = true;
-        }
-      }
-      else if( CGAL::assign( f, *o)) {
-        if (is.does_contain_internally( f, p) ) {
-          _CGAL_NEF_TRACEN("found on facet...");
-          result = make_object(f);
-          found = true;
-        }
-      }
-#ifdef CGAL_NEF3_TRIANGULATE_FACETS
-      else if( CGAL::assign( t, *o)) {
-        Triangle_3 tr = t.get_triangle();
-        if( tr.has_on(p)) {
-          _CGAL_NEF_TRACEN("found on triangle "<<tr);
-	  if(is.does_contain_on_boundary( t, p)) {
-	    _CGAL_NEF_TRACEN("but located on the facet's boundary");
-	    continue;
-	  }
-          result = make_object(Halffacet_handle(t));
-	  found = true;
-        }
-      }
-#endif
-#ifdef CGAL_NEF3_FACET_WITH_BOX 
-      else if( CGAL::assign(pf, *o)) {
-	CGAL_NEF_TRACEN("new locate ");
-        if ( is.does_contain_internally( pf, p) ) {
-          _CGAL_NEF_TRACEN("found on partial facet...");
-          result = make_object(pf.f);
-          found = true;
-        }
-      }
-#endif
-      o++;
-    }
-    if( !found) {
-      _CGAL_NEF_TRACEN("point not found in 2-skeleton");
-      _CGAL_NEF_TRACEN("shooting ray to determine the volume");
-      Ray_3 r( p, Vector_3( -1, 0, 0));
-      result = make_object(determine_volume(r));
-    }    CGAL_NEF_TIMER(pl_t.start());
-    CGAL_NEF_TIMER(pl_t.stop());
-    return result;
-
-
-  } else {   // standard kernel
-
-
-    CGAL_assertion( initialized);
-    _CGAL_NEF_TRACEN( "locate "<<p);
-    typename SNC_structure::FT min_distance;
-    typename SNC_structure::FT tmp_distance;
-    Object_handle result;
-    Vertex_handle v;
-    Halfedge_handle e;
-    Halffacet_handle f;
-#ifdef CGAL_NEF3_TRIANGULATE_FACETS
-    Halffacet_triangle_handle t;
-#endif
-#ifdef CGAL_NEF3_FACET_WITH_BOX
-    Partial_facet pf;
-#endif
-    Object_list candidates = candidate_provider->objects_around_point(p);
-    Object_list_iterator o = candidates.begin();
-
-    if(candidates.empty())
-      return make_object(Base(*this).volumes_begin());
-
-    CGAL::assign(v,*o);
-    CGAL_assertion(CGAL::assign(v,*o));
-    if(p==v->point())
-      return make_object(v);
-
-    min_distance = CGAL::squared_distance(v->point(),p);
-    result = make_object(v);
-    ++o;
-    while(o!=candidates.end() && CGAL::assign(v,*o)) {
-      if ( p == v->point()) {
-        _CGAL_NEF_TRACEN("found on vertex "<<v->point());
-        return make_object(v);
-      }
-      tmp_distance = CGAL::squared_distance(v->point(),p);
-      if(tmp_distance < min_distance) {
-	result = make_object(v);
-        min_distance = tmp_distance;
-      }
-      ++o;
-    }     
-
-    CGAL::assign(v, result);
-    Segment_3 s(p,v->point());
-    // bool first = true;
-    Point_3 ip;
-
-    /*
-    // TODO: das geht effizienter
-    Object_list_iterator of(o);
-    while(of != candidates.end() && assign(e, *of)) ++of;
-    
-    typename SNC_structure::SHalfedge_iterator sei;
-    for(sei=v->shalfedges_begin(); sei!=v->shalfedges_end(); ++sei){      
-      if(sei->is_twin()) continue;
-      Halffacet_handle fout = sei->facet();
-      if(fout->is_twin()) fout = fout->twin();
-      Object_list_iterator ofc(of); 
-      for(;ofc!=candidates.end();++ofc) {
-	if(CGAL::assign(f,*ofc)) {
-	  if(f == fout->twin())
-	    std::cerr << "shit" << std::endl;
-	  if(f == fout) {
-	    Object_list_iterator oe(ofc);
-	    --ofc;
-	    candidates.erase(oe);
-	  }
-	}
-      }
-    }
-    */
-    for(;o!=candidates.end();++o) {
-      if( CGAL::assign( e, *o)) {
-	//	if(first && 
-	//	   (e->source() == v  || e->twin()->source() == v)) continue;
-	Segment_3 ss(e->source()->point(),e->twin()->source()->point());
-	CGAL_NEF_TRACEN("test edge " << e->source()->point() << "->" << e->twin()->source()->point());
-	  if(is.does_contain_internally(ss, p) ) {
-	_CGAL_NEF_TRACEN("found on edge "<< ss);
-          return make_object(e);
-        }
-	if(is.does_intersect_internally(s, ss, ip)) {
-	  // first = false;
-	  s = Segment_3(p, normalized(ip));
-	  result = make_object(e);
-        }
-
-      } else 
-      if( CGAL::assign( f, *o)) {
-	CGAL_NEF_TRACEN("test facet " << f->plane());
-        if (is.does_contain_internally(f,p) ) {
-          _CGAL_NEF_TRACEN("found on facet...");
-          return make_object(f);
-        }
-        if( is.does_intersect_internally(s,f,ip)) {
-          s = Segment_3(p, normalized(ip));
-	  result = make_object(f);
-        }
-#ifdef CGAL_NEF3_FACET_WITH_BOX
-      } else if( CGAL::assign(pf, *o)) {
-	CGAL_NEF_TRACEN("new locate ");
-	if ( is.does_contain_internally( pf, p) ) {
-	  _CGAL_NEF_TRACEN("found on partial facet...");
-	  return make_object(pf.f);
-	}
-        if( is.does_intersect_internally(s,pf,ip)) {	
-          s = Segment_3(p, normalized(ip));
-	  result = make_object(pf.f);
-        }
-#endif
-#ifdef CGAL_NEF3_TRIANGULATE_FACETS
-      } else if( CGAL::assign(t, *o)) {
-        CGAL_NEF_TRACEN("test triangle of facet " << t->plane());
-        Triangle_3 tr = t.get_triangle();
-        CGAL_NEF_TRACEN("trying triangle "<<tr);	
-	if(tr.has_on(p)) {
-	  f = t;
-	  return make_object(f);
-        }
-        if( is.does_intersect( s, tr, ip)) {
-	  CGAL_assertion(!is.does_contain_on_boundary( t, ip));
-          s = Segment_3(p, normalized(ip));
-	  result = make_object(t);
-        }
-#endif
-      } 
-      else CGAL_error_msg( "wrong handle type");
-    }
-
-    CGAL_warning("altered code in SNC_point_locator");
-    /*
-      Halffacet_iterator fc;
-      CGAL_forall_facets(fc, *this->sncp()) {
-	CGAL_assertion(!is.does_intersect_internally(s,f,ip));
-      }
-      
-      Halfedge_iterator ec;
-      CGAL_forall_edges(ec, *this->sncp()) {
-	Segment_3 ss(ec->source()->point(), ec->twin()->source()->point());
-	CGAL_assertion(!is.does_intersect_internally(s,ss,ip));
-      }
-
-      Vertex_iterator vc;
-      CGAL_forall_vertices(vc, *this->sncp()) {
-	std::cerr << "test vertex " << vc->point() << std::endl;
-	CGAL_assertion(vc->point() == s.target() || !s.has_on(vc->point()));
-      }
-    */
-
-    if( CGAL::assign( v, result)) {
-      _CGAL_NEF_TRACEN("vertex hit, obtaining volume..." << v->point());
-
-      CGAL_warning("altered code in SNC_point_locator");
-      SM_point_locator L(&*v);
-      //      Object_handle so = L.locate(s.source()-s.target(), true);
-      Object_handle so = L.locate(s.source()-s.target());
-      SFace_handle sf;
-      if(CGAL::assign(sf,so))
-        return make_object(sf->volume());
-      CGAL_error_msg( "wrong handle type");
-      return Object_handle();
-/*
-      SHalfedge_handle se;
-      CGAL_assertion(CGAL::assign(se,so));
-      CGAL_NEF_TRACEN("intersect segment " << s << " with edges");
-      for(;ox!=candidates.end();++ox) {
-	if(!CGAL::assign(e,*ox)) continue;
-	CGAL_NEF_TRACEN("test edge " << e->source()->point() << "->" << e->twin()->source()->point());
-	if(is.does_intersect_internally(s,Segment_3(e->source()->point(),e->twin()->source()->point()),ip)) {
-	  s = Segment_3(p, normalized(ip));
-	  result = make_object(e);
-        }
-      }
-      CGAL_assertion(CGAL::assign(e,result));
-      CGAL::assign(e,result);
-      f = get_visible_facet(e, Ray_3(p, s.target()));	
-      if( f != Halffacet_handle())
-	return f->incident_volume();
-      SM_decorator SD(&*v); // now, the vertex has no incident facets
-      CGAL_assertion( SD.number_of_sfaces() == 1);
-      return SD.sfaces_begin()->volume();      
-*/
-    } else if( CGAL::assign( f, result)) {
-      _CGAL_NEF_TRACEN("facet hit, obtaining volume...");
-      if(f->plane().oriented_side(p) == ON_NEGATIVE_SIDE)
-	f = f->twin();
-      return make_object(f->incident_volume());
-#ifdef CGAL_NEF3_FACET_WITH_BOX
-    } else if( CGAL::assign(pf, *o)) {
-      CGAL_error_msg( "should not be executed");
-      Halffacet_handle f = pf.f;
-      if(f->plane().oriented_side(p) == ON_NEGATIVE_SIDE)
-	f = f->twin();
-      return make_object(f->incident_volume()); 
-#endif
-#ifdef CGAL_NEF3_TRIANGULATE_FACETS
-    } else if( CGAL::assign(t, result)) {
-      f = t;
-      _CGAL_NEF_TRACEN("facet hit, obtaining volume...");
-      if(f->plane().oriented_side(p) == ON_NEGATIVE_SIDE)
-	f = f->twin();
-      return make_object(f->incident_volume());
-#endif
-    } else if( CGAL::assign(e, result)) {
-      SM_decorator SD(&*e->source());
-      if( SD.is_isolated(e))
-        return make_object(e->incident_sface()->volume());	
-      return make_object(get_visible_facet(e,Ray_3(s.source(),s.to_vector()))->incident_volume());
-    }
-    CGAL_error_msg( "wrong handle type");
-    return Object_handle();
-  }
-  }
-
-  virtual void intersect_with_edges_and_facets( Halfedge_handle e0,
-	const typename SNC_point_locator::Intersection_call_back& call_back) const {
-
-    CGAL_NEF_TIMER(it_t.start());
-    CGAL_assertion( initialized);
-    _CGAL_NEF_TRACEN( "intersecting edge: "<<&*e0<<' '<<Segment_3(e0->source()->point(),
-                                                         e0->twin()->source()->point()));
-
-#ifdef CGAL_NEF3_TRIANGULATE_FACETS
-    Unique_hash_map< Halffacet_triangle_handle, bool> f_mark(false);
-#endif // CGAL_NEF3_TRIANGULATE_FACETS
-
-    Segment_3 s(Segment_3(e0->source()->point(),e0->twin()->source()->point()));
-    Vertex_handle v;
-    Halfedge_handle e;
-    Halffacet_handle f;
-#ifdef CGAL_NEF3_TRIANGULATE_FACETS
-    Halffacet_triangle_handle t;
-#endif
-#ifdef CGAL_NEF3_FACET_WITH_BOX
-    Partial_facet pf;
-#endif
-    Object_list_iterator o;
-    Object_list objects = candidate_provider->objects_around_segment(s);
-    CGAL_for_each( o, objects) {
-      if( CGAL::assign( v, *o)) {
-        /* do nothing */
-      }
-      else if( CGAL::assign( e, *o)) {
-
-#ifdef CGAL_NEF3_DUMP_STATISTICS
-      ++number_of_intersection_candidates;
-#endif
-
-        Point_3 q;
-        if( is.does_intersect_internally( s, Segment_3(e->source()->point(),
-	                                               e->twin()->source()->point()), q)) {
-          q = normalized(q);
-          call_back( e0, make_object(Halfedge_handle(e)), q);
-          _CGAL_NEF_TRACEN("edge intersects edge "<<' '<<&*e<< Segment_3(e->source()->point(),
-                                                                e->twin()->source()->point())<<" on "<<q);
-        }
-      }
-      else if( CGAL::assign( f, *o)) {
-#ifdef CGAL_NEF3_DUMP_STATISTICS
-      ++number_of_intersection_candidates;
-#endif
-
-        Point_3 q;
-        if( is.does_intersect_internally( s, f, q) ) {
-          q = normalized(q);
-          call_back( e0, make_object(Halffacet_handle(f)), q);
-          _CGAL_NEF_TRACEN("edge intersects facet on plane "<<f->plane()<<" on "<<q);
-        }
-      }
-#ifdef CGAL_NEF3_FACET_WITH_BOX
-	else if( CGAL::assign(pf, *o)) {
-	  CGAL_error_msg( "not implemented yet");
-	}
-#endif
-#ifdef CGAL_NEF3_TRIANGULATE_FACETS
-      else if( CGAL::assign( t, *o)) {
-        Point_3 q;
-        Triangle_3 tr = t.get_triangle();
-
-	if( f_mark[t])
-	  continue;
-	_CGAL_NEF_TRACEN("trying with triangle "<<tr);
-        if( is.does_intersect( s, tr, q) &&
-            !is.does_contain_on_boundary( t, q)) {
-          q = normalized(q);
-          call_back( e0, make_object(Halffacet_handle(t)), q);
-          _CGAL_NEF_TRACEN("edge intersects facet triangle on plane "<<t->plane()<<" on "<<q);
-	  f_mark[t] = true;
-        }
-      }
-#endif // CGAL_NEF3_TRIANGULATE_FACETS
-      else
-        CGAL_error_msg( "wrong handle");
-    }
-    CGAL_NEF_TIMER(it_t.stop());
-  }
-
-  virtual void intersect_with_edges( Halfedge_handle e0,
-    const typename SNC_point_locator::Intersection_call_back& call_back) const {
-    CGAL_NEF_TIMER(it_t.start());
-    CGAL_assertion( initialized);
-    _CGAL_NEF_TRACEN( "intersecting edge: "<<&*e0<<' '<<Segment_3(e0->source()->point(),
-                                                         e0->twin()->source()->point()));
-    Segment_3 s(Segment_3(e0->source()->point(),e0->twin()->source()->point()));
-    Vertex_handle v;
-    Halfedge_handle e;
-    Halffacet_handle f;
-#ifdef CGAL_NEF3_TRIANGULATE_FACETS
-    Halffacet_triangle_handle t;
-#endif
-#ifdef CGAL_NEF3_FACET_WITH_BOX
-    Partial_facet pf;
-#endif
-    Object_list_iterator o;
-    Object_list objects = candidate_provider->objects_around_segment(s);
-    CGAL_for_each( o, objects) {
-      if( CGAL::assign( v, *o)) {
-        /* do nothing */
-      }
-      else if( CGAL::assign( e, *o)) {
-
-#ifdef CGAL_NEF3_DUMP_STATISTICS
-      ++number_of_intersection_candidates;
-#endif
-
-        Point_3 q;
-        if( is.does_intersect_internally( s, Segment_3(e->source()->point(),
-	                                               e->twin()->source()->point()), q)) {
-          q = normalized(q);
-          call_back( e0, make_object(Halfedge_handle(e)), q);
-          _CGAL_NEF_TRACEN("edge intersects edge "<<' '<<&*e<< Segment_3(e->source()->point(),
-                                                                e->twin()->source()->point())<<" on "<<q);
-        }
-      }
-      else if( CGAL::assign( f, *o)) {
-        /* do nothing */
-      }
-#ifdef CGAL_NEF3_FACET_WITH_BOX
-	else if( CGAL::assign(pf, *o)) {
-	  CGAL_error_msg( "not implemented yet");
-	}
-#endif
-#ifdef CGAL_NEF3_TRIANGULATE_FACETS
-      else if( CGAL::assign( t, *o)) {
-        /* do nothing */
-      }
-#endif
-      else
-        CGAL_error_msg( "wrong handle");
-    }
-    CGAL_NEF_TIMER(it_t.stop());
-  }
-
-  virtual void intersect_with_facets( Halfedge_handle e0, 
-    const typename SNC_point_locator::Intersection_call_back& call_back) const {
-    CGAL_NEF_TIMER(it_t.start());
-    CGAL_assertion( initialized);
-    _CGAL_NEF_TRACEN( "intersecting edge: "<< Segment_3(e0->source()->point(),
-                                               e0->twin()->source()->point()));
-#ifdef CGAL_NEF3_TRIANGULATE_FACETS
-    Unique_hash_map< Halffacet_triangle_handle, bool> f_mark(false);
-#endif // CGAL_NEF3_TRIANGULATE_FACETS
-    Segment_3 s(Segment_3(e0->source()->point(),e0->twin()->source()->point()));
-    Vertex_handle v;
-    Halfedge_handle e;
-    Halffacet_handle f;
-#ifdef CGAL_NEF3_FACET_WITH_BOX
-    Partial_facet pf;
-#endif
-#ifdef CGAL_NEF3_TRIANGULATE_FACETS
-    Halffacet_triangle_handle t;
-#endif
-    Object_list_iterator o;
-    Object_list objects = candidate_provider->objects_around_segment(s);
-    CGAL_for_each( o, objects) {
-      if( CGAL::assign( v, *o)) {
-        /* do nothing */
-      }
-      else if( CGAL::assign( e, *o)) {
-        /* do nothing */
-      }
-      else if( CGAL::assign( f, *o)) {
-
-#ifdef CGAL_NEF3_DUMP_STATISTICS
-      ++number_of_intersection_candidates;
-#endif
-
-        Point_3 q;
-        if( is.does_intersect_internally( s, f, q) ) {
-          q = normalized(q);
-          call_back( e0, make_object(Halffacet_handle(f)), q);
-          _CGAL_NEF_TRACEN("edge intersects facet on plane "<<f->plane()<<" on "<<q);
-        }
-      }
-#ifdef CGAL_NEF3_FACET_WITH_BOX
-      else if( CGAL::assign(pf, *o)) {
-	CGAL_error_msg( "not implemented yet");
-      }
-#endif
-#ifdef CGAL_NEF3_TRIANGULATE_FACETS
-      else if( CGAL::assign( t, *o)) {
-        Point_3 q;
-        Triangle_3 tr = t.get_triangle();
-	if( f_mark[t])
-	  continue;
-	_CGAL_NEF_TRACEN("trying with triangle "<<tr);
-        if( is.does_intersect( s, tr, q) &&
-            !is.does_contain_on_boundary( t, q)) {
-          q = normalized(q);
-          call_back( e0, make_object(Halffacet_handle(t)), q);
-          _CGAL_NEF_TRACEN("edge intersects facet triangle on plane "<<t->plane()<<" on "<<q);
-	  f_mark[t] = true;
-        }
-      }
-#endif // CGAL_NEF3_TRIANGULATE_FACETS
-      else
-        CGAL_error_msg( "wrong handle");
-    }
-    CGAL_NEF_TIMER(it_t.stop());
-  }
-
-private:
-  Volume_handle determine_volume( const Ray_3& ray) const {
-    Halffacet_handle f_below;
-    Object_handle o = shoot(ray);
-    Vertex_handle v;
-    Halfedge_handle e;
-    Halffacet_handle f;
-    if( CGAL::assign( v, o)) {
-      _CGAL_NEF_TRACEN("vertex hit, obtaining volume...");
-      f_below = get_visible_facet( v, ray);
-      if( f_below != Halffacet_handle())
-        return f_below->incident_volume();
-      SM_decorator SD(&*v); // now, the vertex has no incident facets
-      CGAL_assertion( SD.number_of_sfaces() == 1);
-      return SD.sfaces_begin()->volume();
-    }
-    else if( CGAL::assign( e, o)) {
-      _CGAL_NEF_TRACEN("edge hit, obtaining volume...");
-      f_below = get_visible_facet( e, ray);
-      if( f_below != Halffacet_handle())
-        return f_below->incident_volume();
-      CGAL_assertion_code(SM_decorator SD(&*e->source())); // now, the edge has no incident facets
-      CGAL_assertion(SD.is_isolated(e));
-      return e->incident_sface()->volume();
-    }
-    else if( CGAL::assign( f, o)) {
-      _CGAL_NEF_TRACEN("facet hit, obtaining volume...");
-      f_below = get_visible_facet(f, ray);
-      CGAL_assertion( f_below != Halffacet_handle());
-      return f_below->incident_volume();
-    }
-    return Base(*this).volumes_begin(); // TODO: Comment this hack!
-  }
-
-public:
-  void add_facet(Halffacet_handle f) {
-    candidate_provider->add_facet(f);
-  }
-
-  void add_edge(Halfedge_handle e) {
-    candidate_provider->add_edge(e);	
-  }
-
-  void add_vertex(Vertex_handle v) {
-    candidate_provider->add_vertex(v);
-  }
-
-private:
-  bool initialized;
-  SNC_candidate_provider* candidate_provider;
-  SNC_intersection is;
-#ifdef CGAL_NEF3_TRIANGULATE_FACETS
-  std::list<Halffacet_triangle_handle> triangulation;
-#endif
-};
-
-#ifdef CGAL_NEF3_POINT_LOCATOR_NAIVE
-template <typename SNC_decorator>
-class SNC_point_locator_naive : 
-  public SNC_ray_shooter<SNC_decorator>, 
-  public SNC_point_locator<SNC_decorator>
-{
-  typedef typename SNC_decorator::SNC_structure SNC_structure;
-  typedef SNC_ray_shooter<SNC_decorator> Base;
-  typedef SNC_point_locator_naive<SNC_decorator> Self;
-  typedef SNC_point_locator<SNC_decorator> SNC_point_locator;
-  typedef CGAL::SNC_intersection<SNC_structure> SNC_intersection;
-  typedef typename SNC_decorator::Decorator_traits Decorator_traits;
-  typedef typename Decorator_traits::SM_decorator SM_decorator;
-
-public:
-  typedef typename SNC_decorator::Object_handle Object_handle;
-  typedef typename SNC_decorator::Point_3 Point_3;
-  typedef typename SNC_decorator::Segment_3 Segment_3;
-  typedef typename SNC_decorator::Ray_3 Ray_3;
-  typedef typename SNC_structure::Aff_transformation_3 
-                                  Aff_transformation_3;
-
-  typedef typename Decorator_traits::Vertex_handle Vertex_handle;
-  typedef typename Decorator_traits::Halfedge_handle Halfedge_handle;
-  typedef typename Decorator_traits::Halffacet_handle Halffacet_handle;
-  typedef typename Decorator_traits::Volume_handle Volume_handle;
-  typedef typename Decorator_traits::Vertex_iterator Vertex_iterator;
-  typedef typename Decorator_traits::Halfedge_iterator Halfedge_iterator;
-  typedef typename Decorator_traits::Halffacet_iterator Halffacet_iterator;
-
-public:
-  SNC_point_locator_naive() : initialized(false) {}
-  virtual void initialize(SNC_structure* W) { 
-    CGAL_NEF_TIMER(ct_t.start());
-    std::strcpy(this->version_, "Naive Point Locator (tm)");
-    CGAL_NEF_CLOG(version());
-    CGAL_assertion( W != NULL);
-    Base::initialize(W); 
-    initialized = true;
-    CGAL_NEF_TIMER(ct_t.stop());
-  }
-
-  virtual Self* clone() const { 
-    return new Self; 
-  }
-
-  virtual bool update( Unique_hash_map<Vertex_handle, bool>& V, 
-                       Unique_hash_map<Halfedge_handle, bool>& E, 
-                       Unique_hash_map<Halffacet_handle, bool>& F) {
-    CGAL_NEF_TIMER(ct_t.start());
-    CGAL_assertion( initialized);
-    CGAL_NEF_TIMER(ct_t.stop());
-    return false;
-  }
-
-  virtual ~SNC_point_locator_naive() {}
-
-  virtual Object_handle locate(const Point_3& p) const {
-    CGAL_NEF_TIMER(pl_t.start());
-    CGAL_assertion( initialized);
-    CGAL_NEF_TIMER(pl_t.stop());
-    return Base::locate(p);
-  }
-
-  virtual Object_handle shoot(const Ray_3& r, int mask=0) const {
-    CGAL_NEF_TIMER(rs_t.start());
-    CGAL_assertion( initialized);
-    CGAL_NEF_TIMER(rs_t.stop());
-    return Base::shoot(r);
-  }
-
-  virtual void transform(const Aff_transformation_3& aff) {}
-
-  virtual void intersect_with_edges_and_facets(Halfedge_handle e0,
-    const typename SNC_point_locator::Intersection_call_back& call_back) const {
-	intersect_with_edges(e0,call_back);
-	intersect_with_facets(e0,call_back);
-  }
-
-  virtual void intersect_with_edges( Halfedge_handle e0, 
-    const typename SNC_point_locator::Intersection_call_back& call_back) const {
-    CGAL_NEF_TIMER(it_t.start());
-    CGAL_assertion( initialized);
-    CGAL_NEF_TRACEN( "intersecting edge: "<< Segment_3(e0->source()->point(),
-                                              e0->twin()->source()->point()));
-    SNC_intersection is(*this->sncp());
-    Segment_3 s(Segment_3(e0->source()->point(),e0->twin()->source()->point()));
-    Halfedge_iterator e;
-    CGAL_forall_edges( e, *this->sncp()) {
-
-#ifdef CGAL_NEF3_DUMP_STATISTICS
-      ++number_of_intersection_candidates;
-#endif
-
-      Point_3 q;
-      if( is.does_intersect_internally( s, Segment_3(e->source()->point(),
-                                                     e->twin()->source()->point()), q)) {
-        q = normalized(q);
-        CGAL_NEF_TRACEN("edge intersects edge "<< Segment_3(e->source()->point(),
-                                                   e->twin()->source()->point()) <<" on "<<q);
-        call_back( e0, make_object(e), q);
-      }
-    }
-    CGAL_NEF_TIMER(it_t.stop());
-  }
-
-  virtual void intersect_with_facets( Halfedge_handle e0, 
-    const typename SNC_point_locator::Intersection_call_back& call_back) const {
-    CGAL_NEF_TIMER(it_t.start());
-    CGAL_assertion( initialized);
-    CGAL_NEF_TRACEN( "intersecting edge: "<< Segment_3(e0->source()->point(),
-                                              e0->twin()->source()->point()));
-    SNC_intersection is(*this->sncp());
-    Segment_3 s(Segment_3(e0->source()->point(),
-                          e0->twin()->source()->point()));
-    Halffacet_iterator f;
-    CGAL_forall_facets( f, *this->sncp()) {
-
-#ifdef CGAL_NEF3_DUMP_STATISTICS
-      ++number_of_intersection_candidates;
-#endif
-
-      Point_3 q;
-      if( is.does_intersect_internally( s, f, q) ) {
-        q = normalized(q);
-        CGAL_NEF_TRACEN("edge intersects facet on plane "<<f->plane()<<" on "<<q);
-        call_back( e0, make_object(f), q);
-      }
-    }
-    CGAL_NEF_TIMER(it_t.stop());
-  }
-
-private:
-  bool initialized;
-};
-#endif
-
-} //namespace CGAL
-#endif // CGAL_NEF_SNC_POINT_LOCATOR_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_S2/SM_checker.h b/3rdparty/CGAL-4.8/include/CGAL/Nef_S2/SM_checker.h
deleted file mode 100644
index 444ddf5..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Nef_S2/SM_checker.h
+++ /dev/null
@@ -1,257 +0,0 @@
-// Copyright (c) 1997-2002  Max-Planck-Institute Saarbruecken (Germany).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Michael Seel  <seel at mpi-sb.mpg.de>
-
-#ifndef CGAL_SM_CHECKER_H
-#define CGAL_SM_CHECKER_H
-
-#include <CGAL/basic.h>
-#include <CGAL/Nef_S2/SM_const_decorator.h>
-
-#define CGAL_USING(t) typedef typename Base::t t
-namespace CGAL {
-
-/*{\Moptions outfile=SM_checker.man }*/
-/*{\Manpage {SM_checker}{PMCDEC,GEOM}{Plane map checking}{}}*/
-
-/*{\Mdefinition An instance |\Mvar| of the data type |\Mname| is a
-decorator to check the structure of a plane map. It is generic with
-respect to two template concepts.  |PMCDEC| has to be a decorator
-model of our |SM_const_decorator| concept. |GEOM| has to be a model of
-our geometry kernel concept.}*/
-
-/*{\Mgeneralization SM_const_decorator}*/
-
-template <typename PMCDEC, typename GEOM> 
-class SM_checker : public PMCDEC
-{ typedef PMCDEC Base;
-  const GEOM& K;
-public:
-/*{\Mtypes 3}*/
-typedef PMCDEC  SM_const_decorator;
-/*{\Mtypemember equals |PMCDEC|. Add link to PMCDEC concept.}*/
-typedef typename PMCDEC::Plane_map Plane_map;
-/*{\Mtypemember equals |PMCDEC::Plane_map|, the underlying plane map type.}*/
-typedef GEOM Geometry;
-/*{\Mtypemember equals |GEOM|. Add link to GEOM concept.\\
-\precond |Geometry::Point_2| equals |Plane_map::Point|. }*/
-
-typedef typename GEOM::Point_2     Point;
-typedef typename GEOM::Direction_2 Direction;
-
-CGAL_USING(Vertex_const_handle);
-CGAL_USING(SEdge_handle);
-CGAL_USING(Vertex_const_iterator);
-CGAL_USING(Halfedge_const_iterator);
-CGAL_USING(Halfedge_around_vertex_const_circulator);
-CGAL_USING(Halfedge_around_face_const_circulator);
-/*{\Mtext Iterators, handles, and circulators are inherited from 
-|SM_const_decorator|.}*/
-
-/*{\Mcreation 3}*/
-SM_checker(Plane_map& P, const Geometry& k = Geometry()) : 
-  Base(P), K(k) {}
-/*{\Mcreate constructs a plane map checker working on |P| with
-geometric predicates used from |k|.}*/
-
-SM_checker(const Base& D, const Geometry& k = Geometry()) : 
-  Base(D), K(k) {}
-
-
-/*{\Moperations 2 }*/
-Direction direction(Halfedge_const_handle e) const
-{ return K.construct_direction(
-    point(source(e)),point(target(e))); }
-
-bool is_forward(Halfedge_const_handle e) const
-{ return K.compare_xy(point(source(e)),point(target(e)))<0; }
-
-void check_order_preserving_embedding(Vertex_const_handle v) const;
-/*{\Mop checks if the embedding of the targets of the edges in
-the adjacency list |A(v)| is counter-clockwise order-preserving with 
-respect to the order of the edges in |A(v)|.}*/
-
-void check_order_preserving_embedding() const;
-/*{\Mop checks if the embedding of all vertices of |P| is 
-counter-clockwise order-preserving with respect to the adjacency
-list ordering of all vertices.}*/
-
-void check_forward_prefix_condition(Vertex_const_handle v) const;
-/*{\Mop checks the forward prefix property of the adjacency
-list of |v|.}*/
-
-Halfedge_const_iterator
-check_boundary_is_clockwise_weakly_polygon() const;
-/*{\Mop checks if the outer face cycle of |P| is a clockwise weakly polygon and
-returns a halfedge on the boundary. \precond |P| is a connected graph.
-}*/
-
-void check_is_triangulation() const;
-/*{\Mop checks if |P| is a triangulation.}*/
-
-}; // SM_checker<PMCDEC,GEOM>
-
-
-template <typename PMCDEC, typename GEOM>
-void SM_checker<PMCDEC,GEOM>::
-check_order_preserving_embedding(Vertex_const_handle v) const
-{
-  std::ostrstream error_status;
-  CGAL::set_pretty_mode ( error_status );
-  Halfedge_const_handle ef = first_out_edge(v) ,e=ef,en,enn;
-  error_status << "check_order_preserving_embedding\n";
-  error_status << "vertex " << PV(v) << endl;
-  if ( e != Halfedge_const_handle() ) {
-    while ( true ) {
-      en = cyclic_adj_succ(e);
-      enn = cyclic_adj_succ(en);
-      if (en == ef) break;
-      error_status << "  -> " << point(target(e));
-      error_status << " " << point(target(en)) << " ";
-      error_status << " " << point(target(enn)) << endl;
-      if ( !K.strictly_ordered_ccw(direction(e),direction(en),
-                                   direction(enn)) ||
-           !K.strictly_ordered_ccw(direction(e),direction(en),
-                                   direction(ef)) ) {
-        error_status << "ccw order violate!" << endl << '\0';
-        CGAL_error_msg(error_status.str());
-      }
-      e = en;
-    }
-  }
-  error_status.freeze(0);  
-}
-
-template <typename PMCDEC, typename GEOM>
-void SM_checker<PMCDEC,GEOM>::
-check_forward_prefix_condition(Vertex_const_handle v) const
-{ Halfedge_const_handle ef = first_out_edge(v);
-  if ( ef == Halfedge_const_handle() ) return;
-  Halfedge_const_handle el = cyclic_adj_pred(ef);
-  bool is_left_turn = K.left_turn(point(v),
-                                point(target(ef)),
-                                point(target(el)));
-  bool el_forward = is_forward(el);
-  bool ef_forward = is_forward(ef);
-  CGAL_assertion_msg( (ef == el ||
-                       ef_forward && !el_forward ||
-                       ef_forward &&  el_forward && is_left_turn ||
-                       !ef_forward && !el_forward && is_left_turn) ,
-  "check_forward_prefix_condition: first backward, last forward\n");
-}
-
-template <typename PMCDEC, typename GEOM>
-void SM_checker<PMCDEC,GEOM>::
-check_order_preserving_embedding() const
-{
-  Vertex_const_iterator vit;
-  for (vit = vertices_begin(); vit != vertices_end(); ++vit) {
-    check_order_preserving_embedding(vit);
-    check_forward_prefix_condition(vit);
-  }
-}
-
-
-template <typename PMCDEC, typename GEOM>
-typename SM_checker<PMCDEC,GEOM>::Halfedge_const_iterator
-SM_checker<PMCDEC,GEOM>::
-check_boundary_is_clockwise_weakly_polygon() const
-{
-  Vertex_const_iterator vit, v_min;
-  for (vit = v_min = vertices_begin() ; vit != vertices_end(); ++vit) 
-    if ( K.compare_xy(point(vit), point(v_min))<0 ) v_min = vit;
-  CGAL_assertion_msg(!is_isolated(v_min),"Minimal vertex not connected.");
-  Sphere_point p_min = point(v_min);
-
-  // determine boundary edge incident to v_min: 
-  Halfedge_const_handle e_boundary_at_v_min = first_out_edge(v_min);
-  // all out edges are forward oriented due to minimality
-  Halfedge_around_vertex_const_circulator 
-    hvit(e_boundary_at_v_min), hend(hvit);
-  do {
-    --hvit;
-    Sphere_point p1 = point(target(e_boundary_at_v_min));
-    Sphere_point p2 = point(target(hvit));
-    if ( K.orientation(p_min,p1,p2) > 0 ) { // left_turn
-      e_boundary_at_v_min = hvit;
-      break;
-    }
-  } while (hvit != hend);
-  // now e_boundary_at_v_min is highest starting edge in bundle!!
-
-  int winding_around_globally=0;
-  Halfedge_around_face_const_circulator
-    hfit(e_boundary_at_v_min),hstart(hfit);
-  Halfedge_const_handle e_prev = next(e_boundary_at_v_min);
-  /* we run counterclockwise around the outer face cycle and allow only
-     position where the direction vector of an edge gets smaller again */
-  Direction d_prev = direction(e_prev);
-  CGAL_For_all_backwards(hstart,hfit) {
-    Direction d_curr = direction(hfit);
-    if ( d_curr < d_prev ) ++winding_around_globally;
-    d_prev = d_curr;
-  }
-  CGAL_assertion(winding_around_globally == 1);
-  return e_boundary_at_v_min;
-}
-
-template <typename PMCDEC, typename GEOM>
-void SM_checker<PMCDEC,GEOM>::
-check_is_triangulation() const
-{
-  Halfedge_const_iterator eb;
-  check_integrity_and_topological_planarity(false);
-  CGAL_assertion(number_of_connected_components() == 1);
-  check_order_preserving_embedding();
-  eb = check_boundary_is_clockwise_weakly_polygon();
-
-  CGAL::Hash_map< Halfedge_const_iterator, bool> on_boundary(false);
-  Halfedge_around_face_const_circulator hit(eb), hend(hit);
-  std::ostrstream error_status;
-  CGAL::set_pretty_mode ( error_status );
-  error_status << "check_is_triangulation\n";
-  error_status << "on boundary:\n";
-  CGAL_For_all(hit,hend) {
-    error_status << "  " << PE(hit) << endl;
-    on_boundary[hit]=true;
-  }
-  Halfedge_const_iterator eit;
-  for( eit = halfedges_begin(); eit != halfedges_end(); ++eit) {
-    if (on_boundary[eit]) continue;
-    hit = hend = eit; 
-    int edges_in_face_cycle=0;
-    CGAL_For_all(hit,hend) {
-      error_status << PE(hit);
-      ++edges_in_face_cycle;
-    }
-    CGAL_assertion_msg(edges_in_face_cycle==3,error_status.str());
-  }
-  error_status.freeze(0);
-}
-
-
-\subsection{Plane map input and output}
-The input and output is mainly triggered by an IO Decorator which
-has the control over the IO format and does some basic parsing when
-reading input.
-
-} //namespace CGAL
-
-#undef CGAL_USING
-#endif // CGAL_SM_CHECKER_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_S2/leda_sphere_map.h b/3rdparty/CGAL-4.8/include/CGAL/Nef_S2/leda_sphere_map.h
deleted file mode 100644
index 20ac01c..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Nef_S2/leda_sphere_map.h
+++ /dev/null
@@ -1,273 +0,0 @@
-// Copyright (c) 1997-2002  Max-Planck-Institute Saarbruecken (Germany).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Michael Seel  <seel at mpi-sb.mpg.de>
-
-#ifndef CGAL_LEDA_SPHERE_MAP_H
-#define CGAL_LEDA_SPHERE_MAP_H
-
-#include <CGAL/generic_sweep.h>
-#include <CGAL/Nef_2/Segment_overlay_traits.h>
-#include <CGAL/Nef_S2/Sphere_geometry.h>
-#if CGAL_LEDA_VERSION < 500
-#include <LEDA/graph.h>
-#include <LEDA/graph_misc.h>
-#else
-#include <LEDA/graph/graph.h>
-#include <LEDA/graph/graph_misc.h>
-#endif
-
-#undef CGAL_NEF_DEBUG
-#define CGAL_NEF_DEBUG 211
-#include <CGAL/Nef_2/debug.h>
-
-template <typename R, typename ITERATOR>
-class leda_graph_decorator { 
-public:
-  typedef leda_node      Vertex_handle;
-  typedef leda_edge      Halfedge_handle;
-  typedef CGAL::Sphere_point<R>   Point_2;
-  typedef CGAL::Sphere_segment<R> Segment_2;
-  typedef GRAPH< Point_2, Segment_2 >     Graph;
-  typedef leda_node_map<Halfedge_handle>  Below_map;
-
-  Graph&      G;
-  Below_map&  M;
-
-leda_graph_decorator(Graph& Gi, Below_map& Mi) : G(Gi), M(Mi) {}
-
-Vertex_handle new_vertex(const Point_2& p)
-{ return G.new_node(p); }
-
-void link_as_target_and_append(Vertex_handle v, Halfedge_handle e)
-{ Halfedge_handle erev = G.reversal(e);
-  G.move_edge(e,G.cyclic_adj_pred(e,G.source(e)),v);
-  G.move_edge(erev,v,G.target(erev));
-}
-
-Halfedge_handle new_halfedge_pair_at_source(Vertex_handle v)
-{ Halfedge_handle e_res,e_rev, e_first = G.first_adj_edge(v);
-  if ( e_first == nil ) {
-    e_res = G.new_edge(v,v);
-    e_rev = G.new_edge(v,v);
-  } else {
-    e_res = G.new_edge(e_first,v,LEDA::before);
-    e_rev = G.new_edge(e_first,v,LEDA::before);
-  }
-  G.set_reversal(e_res,e_rev);
-  return e_res;
-}
-
-void supporting_segment(Halfedge_handle e, ITERATOR it)
-{ G[e] = *it; }
-
-void halfedge_below(Vertex_handle v, Halfedge_handle e)
-{ M[v] = e; }
-
-void trivial_segment(Vertex_handle v, ITERATOR it) {}
-void starting_segment(Vertex_handle v, ITERATOR it) {}
-void passing_segment(Vertex_handle v, ITERATOR it) {}
-void ending_segment(Vertex_handle v, ITERATOR it) {}
-
-
-}; // leda_graph_decorator
-
-
-template <typename R>
-class leda_sphere_map_overlayer {
-
-  typedef std::pair<leda_edge,leda_edge> edge_pair;
-  typedef CGAL::Sphere_point<R>   SPoint_2;
-  typedef CGAL::Sphere_segment<R> SSegment_2;
-  typedef CGAL::Plane_3<R>        Plane_3;
-  typedef GRAPH<SPoint_2,SSegment_2> Sphere_map;
-
-  Sphere_map G;
-  leda_node_map<leda_edge>   E;
-
-public:
-
-leda_sphere_map_overlayer() : G(),E(G) {}
-
-const Sphere_map& sphere_map() const { return G; }
-
-template <typename Iterator>
-void subdivide(Iterator start, Iterator end)
-/* subdivision is done in phases
-   - first we partition all segments into the pieces in the
-     closed postive xy-halfspace and into the pieces in the
-     negative xy-halfspace
-   - we sweep both halfspheres separate. Note that the boundary
-     carries the same topology
-   - we unify the graphs embedded into both halfspheres at
-     the boundary.
-*/
-{
-typedef leda_graph_decorator<R,Iterator> leda_graph_output;
-typedef CGAL::Positive_halfsphere_geometry<R> PH_geometry;
-typedef CGAL::Segment_overlay_traits< 
-          Iterator, leda_graph_output, PH_geometry>  PHS_traits;
-typedef CGAL::generic_sweep<PHS_traits> Positive_halfsphere_sweep;
-
-typedef CGAL::Negative_halfsphere_geometry<R> NH_geometry;
-typedef CGAL::Segment_overlay_traits< 
-          Iterator, leda_graph_output, NH_geometry> NHS_traits;
-typedef CGAL::generic_sweep<NHS_traits> Negative_halfsphere_sweep;
-
-  std::list<SSegment_2> Lp,Lm;
-  partition_xy( start, end, Lp , +1);
-  partition_xy( start, end, Lm , -1);
-  // both lists initialized with four quarter segments
-  // supporting the xy-equator thereby separating the 
-  // two halfspheres 
-  // all other segments in the range are split into their
-  // connected components with respect to the xy-plane.
-
-  leda_node v1,v2;
-  leda_graph_output O(G,E);
-  typedef typename PHS_traits::INPUT Input_range;
-  Positive_halfsphere_sweep SP(Input_range(Lp.begin(),Lp.end()),O);
-  SP.sweep();
-  CGAL_NEF_TRACEN("POS SWEEP\n"<<(dump(std::cerr),""));
-  v1=G.first_node(); v2=G.last_node();
-  Negative_halfsphere_sweep SM(Input_range(Lm.begin(),Lm.end()),O);
-  SM.sweep();
-  CGAL_NEF_TRACEN("NEG SWEEP\n"<<(dump(std::cerr),""));
-  v2 = G.succ_node(v2);
-  // now two CCs of sphere graph calculated
-  // v1 = first node of CC in positive xy-sphere
-  // v2 = first node of CC in negative xy-sphere
-
-  merging_halfspheres(v1,v2);
-  clean_trivial_sface_cycles();
-  if (!Is_Plane_Map(G)) error_handler(1,"Sphere map: embedding wrong.");
-  compute_faces();
-}
-
-void merge_nodes(leda_edge e1, leda_edge e2) 
-// e1 and e2 are two edges of the xy equator such that
-// e1 is part of the positive xy-sphere bounding outer face
-// e2 is part of the negative xy-sphere bounding outer face
-// e1 and e2 are oppositely oriented 
-// the outer faces are left of the edges
-// the edges are embedded orderpreserving ccw
-// then the following code merges the edges of A(target(e2))
-// to A(source(e1)) preserving the embedding
-// afterwards source(e1) carries all edges, target(e2) is isolated
-{
-  leda_node v = source(e1);
-  leda_edge e_pos = e1;
-  leda_edge e = G.reversal(e2), er = e2;
-  leda_edge e_end = e;
-  do {
-    leda_edge e_next = G.cyclic_adj_succ(e);
-    G.move_edge(e,e_pos,target(e));
-    G.move_edge(er,er,v);
-    e_pos = e;
-    e = e_next; er = G.reversal(e);
-  } while ( e != e_end );
-}
-
-void merging_halfspheres(leda_node v1, leda_node v2)
-// v1 and v2 are the definite nodes of both CCs
-// where the negative y-axis pierces the sphere.
-// the faces are left of edges
-// edges are embedded orderpreserving ccw
-{
-  CGAL_NEF_TRACEN("Merging Halfspheres");  
-  leda_edge e1,e2,e3,e4,e1n,e2n;
-  forall_sadj_edges(e1,v1) 
-    if ( G[target(e1)].hz()==0 && G[target(e1)].hx()<0 ) break;
-  forall_sadj_edges(e2,v2) 
-    if ( G[target(e2)].hz()==0 && G[target(e2)].hx()>0 ) break;
-  e3 = G.face_cycle_pred(e1);
-  e4 = e2; e2 = G.face_cycle_pred(e2);
-  while ( e1 != e3 || e2 != e4 ) {
-      CGAL_NEF_TRACEN(G[source(e1)]<<" "<< G[target(e2)]);
-    e1n = G.face_cycle_succ(e1); e2n = G.face_cycle_pred(e2);
-    merge_nodes(e1,e2);
-    e1 = e1n; e2 = e2n;
-  }
-}
-
-
-void clean_trivial_sface_cycles() 
-// removes trivial face cycles at equator
-// removes isolated vertices stemming from
-// equator unification
-{
-  leda_edge_map<bool> known(G,false);
-  leda_list<leda_edge> L;
-  leda_list<edge_pair> Lr;
-  leda_edge e;
-  forall_sedges(e,G) {
-    if (known[e]) continue;
-    leda_edge en = G.face_cycle_succ(e);
-    if ( G.face_cycle_succ(en) != e ) 
-      continue;
-    // e in trivial face cycle
-    L.append(e); L.append(en);
-    CGAL_NEF_TRACEN("tivial cycle "<<G[source(e)]<<G[target(e)]);
-    known[e] = known[en] = true;
-    leda_edge er = G.reversal(e);
-    leda_edge enr = G.reversal(en);
-    Lr.append(edge_pair(er,enr));
-  }
-  edge_pair ep;
-  forall(ep,Lr) G.set_reversal(ep.first,ep.second);
-  G.del_edges(L);
-  leda_node v;
-  forall_snodes(v,G) if ( G.outdeg(v)==0 ) G.del_node(v);
-}
-
-void compute_faces()
-{
-  G.compute_faces();
-  leda_face f;
-  leda_edge e;
-  forall_sfaces(f,G) {
-    CGAL_NEF_TRACEN("FACE:");
-    forall_sface_edges(e,f) 
-      CGAL_NEF_TRACEN("  "<<SSegment_2(G[source(e)],G[target(e)]));
-  }
-}
-
-void dump(std::ostream& os, leda_node v, bool nl=true) const
-{  os << " ["<<::index(v)<<"] "<<G[v]; 
-   if (nl) os << std::endl; }
-
-void dump(std::ostream& os) const
-{
-  leda_node v;
-  leda_edge e;
-  forall_snodes(v,G) {
-    dump(os,v);
-    forall_sadj_edges(e,v) {
-      os << "   ->";
-      dump(os,target(e),false);
-      os <<" ["<<G[e]<<" ]\n";
-    }
-  }
-    
-}
-
-
-}; // leda_sphere_map_overlayer<R>
-
-
-#endif //CGAL_LEDA_SPHERE_MAP_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_polyhedron_2.h b/3rdparty/CGAL-4.8/include/CGAL/Nef_polyhedron_2.h
deleted file mode 100644
index 8ae3cf0..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Nef_polyhedron_2.h
+++ /dev/null
@@ -1,1137 +0,0 @@
-// Copyright (c) 1997-2000  Max-Planck-Institute Saarbruecken (Germany).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Michael Seel <seel at mpi-sb.mpg.de>
-
-#ifndef CGAL_NEF_POLYHEDRON_2_H
-#define CGAL_NEF_POLYHEDRON_2_H
-
-#if defined(BOOST_MSVC)
-#  pragma warning(push)
-#  pragma warning(disable:4800) // complaint about performance in std::map where we can't do anything
-#endif                          
-
-
-#include <CGAL/basic.h>
-#include <CGAL/Handle_for.h>
-#include <CGAL/Nef_2/HDS_items.h>
-#include <CGAL/HalfedgeDS_default.h>
-
-#include <CGAL/Is_extended_kernel.h>
-#include <CGAL/Nef_2/PM_explorer.h>
-#include <CGAL/Nef_2/PM_decorator.h>
-#include <CGAL/Nef_2/PM_io_parser.h>
-#include <CGAL/Nef_2/PM_overlayer.h>
-//#include <CGAL/Nef_2/PM_transformer.h>
-#include <CGAL/Nef_2/PM_point_locator.h>
-#include <CGAL/Nef_2/Bounding_box_2.h>
-#include <vector>
-#include <list>
-
-#include <boost/random/linear_congruential.hpp>
-#include <boost/random/uniform_real.hpp>
-#include <boost/random/variate_generator.hpp>
-
-#undef CGAL_NEF_DEBUG
-#define CGAL_NEF_DEBUG 11
-#include <CGAL/Nef_2/debug.h>
-
-namespace CGAL {
-
-template <typename T, typename I, typename M> class Nef_polyhedron_2;
-template <typename T, typename I, typename M> class Nef_polyhedron_2_rep;
-
-template <typename T, typename I, typename M>
-std::ostream& operator<<(std::ostream&, const Nef_polyhedron_2<T,I,M>&); 
-
-template <typename T, typename I, typename M>
-std::istream& operator>>(std::istream&, Nef_polyhedron_2<T,I,M>&);
-
-template <typename T, typename Items, typename Mark_>
-class Nef_polyhedron_2_rep 
-{ 
-  typedef Nef_polyhedron_2_rep<T,Items,Mark_> Self;
-  friend class Nef_polyhedron_2<T,Items,Mark_>;
-
-  struct HDS_traits {
-    typedef typename T::Point_2 Point;
-    typedef Mark_                Mark;
-  };
-
-public: // gcc-3.3 otherwise claims that Decorator in Polyhedron_2 is private
-  typedef CGAL_HALFEDGEDS_DEFAULT<HDS_traits,Items> Plane_map;
-  typedef CGAL::PM_const_decorator<Plane_map>           Const_decorator;
-  typedef CGAL::PM_decorator<Plane_map>                 Decorator;
-  typedef CGAL::PM_naive_point_locator<Decorator,T>     Slocator;
-  typedef CGAL::PM_point_locator<Decorator,T>           Locator;
-  typedef CGAL::PM_overlayer<Decorator,T>               Overlayer;
-
-private:
-
-  Plane_map pm_; 
-  Locator* pl_;
-  
-  void init_locator() 
-  { 
-    if ( !pl_ ) 
-      pl_ = new Locator(pm_); 
-  }
-
-  void clear_locator() 
-  { 
-    if ( pl_ ) { 
-      delete pl_; 
-      pl_=0; 
-    } 
-  }
-
-public:
-  Nef_polyhedron_2_rep() 
-    : pm_(), pl_(0) 
-  {}
-
-  Nef_polyhedron_2_rep(const Self& ) 
-    : pm_(), pl_(0) 
-  {}
-
-  ~Nef_polyhedron_2_rep() 
-  { 
-    pm_.clear(); 
-    clear_locator(); 
-  }
-};
-
-/*{\Moptions print_title=yes }*/ 
-/*{\Manpage {Nef_polyhedron_2}{T}{Nef Polyhedra in the Plane}{N}}*/
-
-/*{\Mdefinition
-An instance of data type |\Mname| is a subset of the plane that is
-the result of forming complements and intersections starting from a
-finite set |H| of half-spaces. |\Mtype| is closed under all binary set
-operations |intersection|, |union|, |difference|, |complement| and
-under the topological operations |boundary|, |closure|, and
-|interior|.
-
-The template parameter |T| is specified via an extended kernel
-concept. |T| must be a model of the concept |ExtendedKernelTraits_2|.
-}*/
-
-template <typename T, typename Items_=HDS_items, typename Mark_=bool>
-class Nef_polyhedron_2 
-  : public Handle_for< Nef_polyhedron_2_rep<T,Items_,Mark_> >
-{ 
-public:
-typedef T Extended_kernel;
-static  T EK; // static extended kernel
-
-  /*{\Mtypes 7}*/
-  typedef Mark_ Mark;
-  /*{\Xtypemember marking set membership or exclusion.}*/
-  typedef Items_ Items;
-  typedef Nef_polyhedron_2<T,Items,Mark> Self;
-  typedef Handle_for< Nef_polyhedron_2_rep<T,Items,Mark> > Base;
-  typedef typename T::Point_2   Extended_point;
-  typedef typename T::Segment_2 Extended_segment;
-
-  typedef typename T::Standard_line_2 Line;
-  /*{\Mtypemember the oriented lines modeling half-planes}*/
-  typedef typename T::Standard_point_2 Point;
-  /*{\Mtypemember the affine points of the plane.}*/
-  typedef typename T::Standard_direction_2 Direction;
-  /*{\Mtypemember directions in our plane.}*/
-  typedef typename T::Standard_aff_transformation_2  Aff_transformation;
-  /*{\Mtypemember affine transformations of the plane.}*/
-
-
-  // types for choosing the right constructor
-  struct Polylines {};
-  struct Polygons {};
-
-  typedef Polylines Polylines_tag;
-  typedef Polygons Polygons_tag;
-
-  enum Operation { JOIN=0 };
-
-  enum Boundary { EXCLUDED=0, INCLUDED=1 };
-  /*{\Menum construction selection.}*/
-
-  enum Content { EMPTY=0, COMPLETE=1 };
-  /*{\Menum construction selection}*/
-
-  static const Polylines POLYLINES;
-  static const Polygons POLYGONS;
-protected:
-  struct AND { bool operator()(bool b1, bool b2)  const { return b1&&b2; }  };
-  struct OR { bool operator()(bool b1, bool b2)   const { return b1||b2; }  };
-  struct DIFF { bool operator()(bool b1, bool b2) const { return b1&&!b2; } };
-  struct XOR { bool operator()(bool b1, bool b2)  const 
-                                           { return (b1&&!b2)||(!b1&&b2); } };
-
-  typedef Nef_polyhedron_2_rep<T,Items,Mark>           Nef_rep;
-  typedef typename Nef_rep::Plane_map       Plane_map;
-  typedef typename Nef_rep::Decorator       Decorator;
-  typedef typename Nef_rep::Const_decorator Const_decorator;
-  typedef typename Nef_rep::Overlayer       Overlayer;
-  //typedef typename Nef_rep::T               Transformer;
-  typedef typename Nef_rep::Slocator        Slocator;
-  typedef typename Nef_rep::Locator         Locator;
-
-  using Base::ptr;
-  using Base::is_shared;
-
-  Plane_map& pm() { return ptr()->pm_; } 
-  const Plane_map& pm() const { return ptr()->pm_; } 
-
-  friend std::ostream& operator<< <>
-      (std::ostream& os, const Nef_polyhedron_2<T,Items,Mark>& NP);
-  friend std::istream& operator>> <>
-      (std::istream& is, Nef_polyhedron_2<T,Items,Mark>& NP);
-
-  typedef typename Decorator::Vertex_handle         Vertex_handle;
-  typedef typename Decorator::Halfedge_handle       Halfedge_handle;
-  typedef typename Decorator::Face_handle           Face_handle;
-  typedef typename Decorator::Vertex_const_handle   Vertex_const_handle;
-  typedef typename Decorator::Halfedge_const_handle Halfedge_const_handle;
-  typedef typename Decorator::Face_const_handle     Face_const_handle;
-
-  typedef typename Decorator::Vertex_iterator       Vertex_iterator;
-  typedef typename Decorator::Halfedge_iterator     Halfedge_iterator;
-  typedef typename Decorator::Face_iterator         Face_iterator;
-  typedef typename Const_decorator::Vertex_const_iterator   
-                                                    Vertex_const_iterator;
-  typedef typename Const_decorator::Halfedge_const_iterator 
-                                                    Halfedge_const_iterator;
-  typedef typename Const_decorator::Face_const_iterator     
-                                                    Face_const_iterator;
-
-  typedef Bounding_box_2<typename Is_extended_kernel<Extended_kernel>::value_type, 
-                         Extended_kernel> Box_2;
-
-  struct Except_frame_box_edges {
-    Decorator D_; 
-    Face_handle f_;
-
-    Except_frame_box_edges(Plane_map& P) 
-      : D_(P), f_(D_.faces_begin()) 
-    {}
-    
-    bool 
-    operator()(Halfedge_handle e, const Tag_true& ) const
-    { 
-      return D_.face(e)==f_ || D_.face(D_.twin(e))==f_; 
-    }
-
-    bool 
-    operator()(Halfedge_handle /*e*/, const Tag_false& ) const
-    { 
-      return false;
-    }
-    bool
-    operator()(Halfedge_handle e) const
-    {
-      return this->operator()(e, typename Is_extended_kernel<Extended_kernel>::value_type());
-    }
-
-  };
-
-  friend struct Except_frame_box_edges;
-
-  typedef std::list<Extended_segment>      ES_list;
-  typedef typename ES_list::const_iterator ES_iterator;
-
-  void fill_with_frame_segs(ES_list& L, const Tag_true& ) const
-  /*{\Xop fills the list with the four segments which span our frame,
-     the convex hull of SW,SE,NW,NE.}*/
-  { L.push_back(Extended_segment(EK.SW(),EK.NW()));
-    L.push_back(Extended_segment(EK.SW(),EK.SE()));
-    L.push_back(Extended_segment(EK.NW(),EK.NE()));
-    L.push_back(Extended_segment(EK.SE(),EK.NE()));
-  }
-
-  void fill_with_frame_segs(ES_list& , const Tag_false& ) const
-  {}
-
-  void fill_with_frame_segs(ES_list& L) const
-  { 
-
-    fill_with_frame_segs(L, typename Is_extended_kernel<Extended_kernel>::value_type());
-  }
-
-  struct Link_to_iterator {
-    const Decorator& D;
-    Halfedge_handle _e;
-    Vertex_handle   _v;
-    ES_iterator     _it;
-    Mark            _m;
-    Link_to_iterator(const Decorator& d, ES_iterator it, Mark m) : 
-      D(d), _e(), _v(), _it(it), _m(m) {}
-
-    void supporting_segment(Halfedge_handle e, ES_iterator it) 
-    {
-      if ( it == _it )
-        _e = e;
-      D.mark(e) = _m; 
-    }
-    void trivial_segment(Vertex_handle v, ES_iterator it) 
-    {
-      if ( it == _it )
-        _v = v;
-      D.mark(v) = _m;
-    }
-    void starting_segment(Vertex_handle v, ES_iterator) 
-    { D.mark(v) = _m; }
-    void passing_segment(Vertex_handle v, ES_iterator) 
-    { D.mark(v) = _m; }
-    void ending_segment(Vertex_handle v, ES_iterator) 
-    { D.mark(v) = _m; }
-
-  };
-
-  template<typename IT>
-  struct From_intersecting_polygons {
-
-    Unique_hash_map<Halfedge_handle,IT>& halfedge2iterator;
-
-    From_intersecting_polygons(Unique_hash_map<Halfedge_handle,IT>& e2i) 
-      : halfedge2iterator(e2i) {}
-
-    void supporting_segment(Halfedge_handle e, IT it) 
-    { 
-      halfedge2iterator[e->opposite()] = 
-	halfedge2iterator[e] = it; e->mark() = true;}      
-
-    void trivial_segment(Vertex_handle v, IT) 
-    { v->mark() = true; }
-    void starting_segment(Vertex_handle v, IT) 
-    { v->mark() = true; }
-    void passing_segment(Vertex_handle v, IT) 
-    { v->mark() = true; }
-    void ending_segment(Vertex_handle v, IT) 
-    { v->mark() = true; }
-  };  
-
-  friend struct Link_to_iterator;
-
-  void clear_outer_face_cycle_marks(const Tag_true&) 
-  { // unset all frame marks
-    Decorator D(pm());
-    Face_iterator f = D.faces_begin(); 
-    D.mark(f) = false;
-    Halfedge_handle e = D.holes_begin(f);
-    D.set_marks_in_face_cycle(e, false);
-  }
-
-  void clear_outer_face_cycle_marks(const Tag_false&)
-  {}
-
-  void clear_outer_face_cycle_marks()
-  {
-    clear_outer_face_cycle_marks(typename Is_extended_kernel<Extended_kernel>::value_type());
-  }
-
-public:
-  /*{\Mcreation 3}*/
-  Nef_polyhedron_2(Content plane = EMPTY) : Base(Nef_rep())
-  /*{\Mcreate creates an instance |\Mvar| of type |\Mname|
-  and initializes it to the empty set if |plane == EMPTY|
-  and to the whole plane if |plane == COMPLETE|.}*/
-  {
-    ES_list L;
-    fill_with_frame_segs(L);
-    Overlayer D(pm());
-    Link_to_iterator I(D, --L.end(), false);
-    D.create(L.begin(),L.end(),I);
-    D.mark(--D.faces_end()) = bool(plane);
-  }
-
-
-  Nef_polyhedron_2(const Line& l, Boundary line = INCLUDED) : Base(Nef_rep())
-  /*{\Mcreate creates a Nef polyhedron |\Mvar| containing the half-plane
-  left of |l| including |l| if |line==INCLUDED|, excluding |l| if 
-  |line==EXCLUDED|.}*/  
-  {   CGAL_NEF_TRACEN("Nconstruction from line "<<l);
-    ES_list L;
-    fill_with_frame_segs(L);
-    if(check_tag(typename Is_extended_kernel<Extended_kernel>::value_type())) {
-      Extended_point ep1 = EK.construct_opposite_point(l);
-      Extended_point ep2 = EK.construct_point(l);
-      L.push_back(EK.construct_segment(ep1,ep2));
-    }
-    Overlayer D(pm());
-    Link_to_iterator I(D, --L.end(), false);
-    D.create(L.begin(),L.end(),I);
-    if(check_tag(typename Is_extended_kernel<Extended_kernel>::value_type())) {
-      CGAL_assertion( I._e != Halfedge_handle() );
-      Halfedge_handle el = I._e;
-      if ( D.point(D.target(el)) != EK.target(L.back()) )
-	el = D.twin(el);
-      D.mark(D.face(el)) = true;
-      D.mark(el) = bool(line);
-    } else {
-      D.mark(--D.faces_end()) = bool(EMPTY);
-      std::cerr << "Constructor not available with standard kernel. "
-                   " Returned empty polygon!" << std::endl;
-    }
-  }
-
-
-  template <class Forward_iterator>
-  Nef_polyhedron_2(Forward_iterator it, Forward_iterator end,
-    Boundary b = INCLUDED) : Base(Nef_rep())
-  /*{\Mcreate creates a Nef polyhedron |\Mvar| from the simple polygon
-  |P| spanned by the list of points in the iterator range |[it,end)| and
-  including its boundary if |b = INCLUDED| and excluding the boundary
-  otherwise. |Forward_iterator| has to be an iterator with value type
-  |Point|. This construction expects that |P| is simple. The degenerate
-  cases where |P| contains no point, one point or spans just one segment
-  (two points) are correctly handled. In all degenerate cases there's
-  only one unbounded face adjacent to the degenerate polygon. If |b ==
-  INCLUDED| then |\Mvar| is just the boundary. If |b == EXCLUDED| then
-  |\Mvar| is the whole plane without the boundary.}*/
-  { 
-    ES_list L;
-    fill_with_frame_segs(L);
-    bool empty = false;  
-    if (it != end) 
-      {
-        Extended_point ef, ep = ef = EK.construct_point(*it);
-        Forward_iterator itl=it; ++itl;
-        if (itl == end) // case only one point
-          L.push_back(EK.construct_segment(ep,ep));
-        else { // at least one segment
-          while( itl != end ) {
-            Extended_point en = EK.construct_point(*itl);
-            L.push_back(EK.construct_segment(ep,en));
-            ep = en; ++itl;
-          }
-          L.push_back(EK.construct_segment(ep,ef));
-        }
-      }
-
-    else empty = true;
-    Overlayer D(pm());
-    Link_to_iterator I(D, --L.end(), true);
-    D.create(L.begin(),L.end(),I);
-    if ( empty ) {
-      D.mark(--D.faces_end()) = !bool(b); return; }
-    CGAL_assertion( I._e != Halfedge_handle() || I._v != Vertex_handle() );
-
-    if ( EK.is_degenerate(L.back()) ) {
-      // its a point
-      CGAL_assertion(I._v != Vertex_handle());
-      D.mark(D.face(I._v)) = !bool(b); D.mark(I._v) = b;
-    } else {
-      // at least one segment
-      Halfedge_handle el = I._e;
-      if ( D.point(D.target(el)) != EK.target(L.back()) )
-	el = D.twin(el);  
-      D.set_marks_in_face_cycle(el,bool(b));
-      unsigned int n = 
-        check_tag(typename Is_extended_kernel<Extended_kernel>::value_type()) ? 2 : 1;
-      if ( D.number_of_faces() > n ) D.mark(D.face(el)) = true;
-      else                           D.mark(D.face(el)) = !bool(b);
-    }
-
-    clear_outer_face_cycle_marks();
-  }
-
-  // The constructor which takes an iterator range of polygons
-  template <class Forward_iterator>
-  Nef_polyhedron_2(Forward_iterator pit, Forward_iterator pend,	      
-		   Polygons, Operation op = JOIN) : Base(Nef_rep()) { 
-
-    CGAL_assertion(op==JOIN);
-
-    typedef typename std::iterator_traits<Forward_iterator>::value_type
-      iterator_pair;
-    typedef typename iterator_pair::first_type point_iterator;
-    point_iterator it, itl, end;
-
-    ES_list L;
-
-    fill_with_frame_segs(L);
-    for(;pit != pend; ++pit) {
-      it = pit->first;
-      end = pit->second;
-      if (it != end) {
-        Extended_point ef, ep = ef = EK.construct_point(*it);
-        itl=it; ++itl;
-        if (itl == end) // case only one point
-          L.push_back(EK.construct_segment(ep,ep));
-        else { // at least one segment
-          while( itl != end ) {
-            Extended_point en = EK.construct_point(*itl);
-            L.push_back(EK.construct_segment(ep,en));
-            ep = en; ++itl;
-          }
-          L.push_back(EK.construct_segment(ep,ef));
-        }
-      }
-    }
-
-    Overlayer D(pm());
-    Unique_hash_map<Halfedge_handle,ES_iterator> e2i;
-    From_intersecting_polygons<ES_iterator> fip(e2i);
-    D.create(L.begin(),L.end(),fip);
-
-    Face_handle outer_face;
-    if(check_tag(typename Is_extended_kernel<Extended_kernel>::value_type()))
-      outer_face = ++D.faces_begin();
-    else
-      outer_face = D.faces_begin();
-    Halfedge_handle e;
-    for(e=D.halfedges_begin(); e!=D.halfedges_end(); ++e) {
-      if(&*e < &*(D.twin(e)) && EK.is_standard(D.source(e)->point())) {
-	ES_iterator eit = e2i[e];
-	if(lexicographically_xy_smaller(EK.standard_point(eit->source()),
-					EK.standard_point(eit->target()))) {
-	  if(lexicographically_xy_smaller(EK.standard_point(D.source(D.twin(e))->point()),
-					  EK.standard_point(D.source(e)->point())))
-	    e = D.twin(e);
-	} else
-	  if(lexicographically_xy_smaller(EK.standard_point(D.source(e)->point()),
-					  EK.standard_point(D.source(D.twin(e))->point())))
-	    e = D.twin(e);
-	if(D.face(e) != outer_face)
-	  D.mark(D.face(e)) = true;
-      }
-    }
-    
-    D.simplify(Except_frame_box_edges(pm()));
-    clear_outer_face_cycle_marks();
-  }
-
-
-  // The constructor which takes an iterator range of polylines
-  template <class Forward_iterator>
-  Nef_polyhedron_2(Forward_iterator pit, Forward_iterator pend,	      
-		   Polylines) : Base(Nef_rep()) { 
-
-    typedef typename std::iterator_traits<Forward_iterator>::value_type 
-      iterator_pair;
-    typedef typename iterator_pair::first_type point_iterator;
-    point_iterator it, itl, end;
-
-    ES_list L;
-
-    fill_with_frame_segs(L);
-    for(;pit != pend; ++pit) {
-      it = pit->first;
-      end = pit->second;
-      if (it != end) {
-        Extended_point ep  = EK.construct_point(*it);
-        itl=it; ++itl;
-        if (itl == end) // case only one point
-          L.push_back(EK.construct_segment(ep,ep));
-        else { // at least one segment
-          while( itl != end ) {
-            Extended_point en = EK.construct_point(*itl);
-            L.push_back(EK.construct_segment(ep,en));
-            ep = en;
-	    ++itl;
-          }
-        }
-      }
-    }
-
-    Overlayer D(pm());
-    Link_to_iterator I(D, --L.end(), true);
-    D.create(L.begin(),L.end(),I, Overlayer::POLYLINE);
-    
-    clear_outer_face_cycle_marks();
-  }
-
-  Nef_polyhedron_2(const Nef_polyhedron_2<T,Items,Mark>& N1) : Base(N1) {}
-  Nef_polyhedron_2& operator=(const Nef_polyhedron_2<T,Items,Mark>& N1)
-  { Base::operator=(N1); return (*this); }
-  ~Nef_polyhedron_2() {}
-
-
-
-  template <class Forward_iterator>
-  Nef_polyhedron_2(Forward_iterator first, Forward_iterator beyond, 
-    double p) : Base(Nef_rep())
-  /*{\Xcreate creates a random Nef polyhedron from the arrangement of
-  the set of lines |S = set[first,beyond)|. The cells of the arrangement
-  are selected uniformly at random with probability $p$. \precond $0 < p
-  < 1$.}*/
-  { CGAL_assertion(0<p && p<1);
-    ES_list L; fill_with_frame_segs(L);
-    while ( first != beyond ) {
-      Extended_point ep1 = EK.construct_opposite_point(*first);
-      Extended_point ep2 = EK.construct_point(*first);
-      L.push_back(EK.construct_segment(ep1,ep2)); ++first;
-    }
-    Overlayer D(pm());
-    Link_to_iterator I(D, --L.end(), false);
-    D.create(L.begin(),L.end(),I);
-
-    boost::rand48 rng;
-    boost::uniform_real<> dist(0,1);
-    boost::variate_generator<boost::rand48&, boost::uniform_real<> > get_double(rng,dist);
-
-    Vertex_iterator v; Halfedge_iterator e; Face_iterator f;
-    for (v = D.vertices_begin(); v != D.vertices_end(); ++v)
-      D.mark(v) = ( get_double() < p ? true : false );
-    for (e = D.halfedges_begin(); e != D.halfedges_end(); ++(++e))
-      D.mark(e) = ( get_double() < p ? true : false );
-    for (f = D.faces_begin(); f != D.faces_end(); ++f)
-      D.mark(f) = ( get_double() < p ? true : false );
-    D.simplify(Except_frame_box_edges(pm()));
-    clear_outer_face_cycle_marks(); 
-  }
-
-
-
-  protected:
-  Nef_polyhedron_2(const Plane_map& H, bool clone=true) : Base(Nef_rep()) 
-  /*{\Xcreate makes |\Mvar| a new object.  If |clone==true| then the
-  underlying structure of |H| is copied into |\Mvar|.}*/
-  { if (clone) {
-      Decorator D(pm()); // a decorator working on the rep plane map
-      D.clone(H);        // cloning H into pm()
-    }
-  }
-  void clone_rep() { *this = Nef_polyhedron_2<T,Items,Mark>(pm()); }
-
-  /*{\Moperations 4 3 }*/
-  public:
-
-  void clear(Content plane = EMPTY)
-  { *this = Nef_polyhedron_2(plane); }
-  /*{\Mop makes |\Mvar| the empty set if |plane == EMPTY| and the
-  full plane if |plane == COMPLETE|.}*/
-
-  bool is_empty() const
-  /*{\Mop returns true if |\Mvar| is empty, false otherwise.}*/
-  { Const_decorator D(pm());
-    Face_const_iterator f = D.faces_begin();
-    if(check_tag(typename Is_extended_kernel<Extended_kernel>::
-		 value_type()))
-      return (D.number_of_vertices()==4 &&
-	      D.number_of_edges()==4 &&
-	      D.number_of_faces()==2 &&
-	      D.mark(++f) == false);
-    else
-      return (D.number_of_vertices()==0 &&
-	      D.number_of_edges()==0 &&
-	      D.number_of_faces()==1 &&
-		D.mark(f) == false);    
-  }
-
-  bool is_plane() const
-  /*{\Mop returns true if |\Mvar| is the whole plane, false otherwise.}*/
-  { Const_decorator D(pm());
-    Face_const_iterator f = D.faces_begin();
-    if(check_tag(typename Is_extended_kernel<Extended_kernel>::
-         value_type()))
-      return (D.number_of_vertices()==4 &&
-              D.number_of_edges()==4 &&
-              D.number_of_faces()==2 &&
-              D.mark(++f) == true);
-    else
-      return (D.number_of_vertices()==0 &&
-          D.number_of_edges()==0 &&
-          D.number_of_faces()==1 &&
-          D.mark(f) == true);
-  }
-
-  void extract_complement()
-  { CGAL_NEF_TRACEN("extract complement");
-  if ( this->is_shared() ) {
-	  clone_rep();
-  }
-    Overlayer D(pm());
-    Vertex_iterator v, vend = D.vertices_end();
-    for(v = D.vertices_begin(); v != vend; ++v)      D.mark(v) = !D.mark(v);
-    Halfedge_iterator e, eend = D.halfedges_end();
-    for(e = D.halfedges_begin(); e != eend; ++(++e)) D.mark(e) = !D.mark(e);
-    Face_iterator f, fend = D.faces_end();
-    for(f = D.faces_begin(); f != fend; ++f)         D.mark(f) = !D.mark(f);
-    clear_outer_face_cycle_marks();
-  }
-
-  void extract_interior()
-  { CGAL_NEF_TRACEN("extract interior");
-    if ( this->is_shared() ) clone_rep();
-    Overlayer D(pm());
-    Vertex_iterator v, vend = D.vertices_end();
-    for(v = D.vertices_begin(); v != vend; ++v)      D.mark(v) = false;
-    Halfedge_iterator e, eend = D.halfedges_end();
-    for(e = D.halfedges_begin(); e != eend; ++(++e)) D.mark(e) = false;
-    D.simplify(Except_frame_box_edges(pm()));
-  }
-
-
-  void extract_boundary()
-  { CGAL_NEF_TRACEN("extract boundary");
-    if ( this->is_shared() ) clone_rep();
-    Overlayer D(pm());
-    Vertex_iterator v, vend = D.vertices_end();
-    for(v = D.vertices_begin(); v != vend; ++v)      D.mark(v) = true;
-    Halfedge_iterator e, eend = D.halfedges_end();
-    for(e = D.halfedges_begin(); e != eend; ++(++e)) D.mark(e) = true;
-    Face_iterator f, fend = D.faces_end();
-    for(f = D.faces_begin(); f != fend; ++f)         D.mark(f) = false;
-    clear_outer_face_cycle_marks();
-    D.simplify(Except_frame_box_edges(pm()));
-  }
-
-  void extract_closure()
-  /*{\Xop converts |\Mvar| to its closure. }*/
-  { CGAL_NEF_TRACEN("extract closure");
-    extract_complement();
-    extract_interior();
-    extract_complement();
-  }
-
-  void extract_regularization()
-  /*{\Xop converts |\Mvar| to its regularization. }*/
-  { CGAL_NEF_TRACEN("extract regularization");
-    extract_interior();
-    extract_closure();
-  }
-
-  /*{\Mtext \headerline{Constructive Operations}}*/
-
-  Nef_polyhedron_2<T,Items,Mark> complement() const
-  /*{\Mop returns the complement of |\Mvar| in the plane.}*/
-  { Nef_polyhedron_2<T,Items,Mark> res = *this;
-    res.extract_complement();
-    return res;
-  }
-
-
-  Nef_polyhedron_2<T,Items,Mark> interior() const
-  /*{\Mop returns the interior of |\Mvar|.}*/
-  { Nef_polyhedron_2<T,Items,Mark> res = *this;
-    res.extract_interior();
-    return res;
-  }
-
-  Nef_polyhedron_2<T,Items,Mark> closure() const
-  /*{\Mop returns the closure of |\Mvar|.}*/
-  { Nef_polyhedron_2<T,Items,Mark> res = *this;
-    res.extract_closure();
-    return res;
-  }
-
-  Nef_polyhedron_2<T,Items,Mark> boundary() const
-  /*{\Mop returns the boundary of |\Mvar|.}*/
-  { Nef_polyhedron_2<T,Items,Mark> res = *this;
-    res.extract_boundary();
-    return res;
-  }
-
-  Nef_polyhedron_2<T,Items,Mark> regularization() const
-  /*{\Mop returns the regularized polyhedron (closure of interior).}*/
-  { Nef_polyhedron_2<T,Items,Mark> res = *this;
-    res.extract_regularization();
-    return res;
-  }
-
-
-  Nef_polyhedron_2<T,Items,Mark> intersection(const Nef_polyhedron_2<T,Items,Mark>& N1) const
-  /*{\Mop returns |\Mvar| $\cap$ |N1|. }*/
-  { Nef_polyhedron_2<T,Items,Mark> res(pm(),false); // empty, no frame
-    Overlayer D(res.pm());
-    D.subdivide(pm(),N1.pm());
-    AND _and; D.select(_and);
-    res.clear_outer_face_cycle_marks();
-    D.simplify(Except_frame_box_edges(res.pm()));
-    return res;
-  }
-
-
-  Nef_polyhedron_2<T,Items,Mark> join(const Nef_polyhedron_2<T,Items,Mark>& N1) const
-  /*{\Mop returns |\Mvar| $\cup$ |N1|. }*/
-  { Nef_polyhedron_2<T,Items,Mark> res(pm(),false); // empty, no frame
-    Overlayer D(res.pm());
-    D.subdivide(pm(),N1.pm());
-    OR _or; D.select(_or);
-    res.clear_outer_face_cycle_marks();
-    D.simplify(Except_frame_box_edges(res.pm()));
-    return res;
-  }
-
-  Nef_polyhedron_2<T,Items,Mark> difference(const Nef_polyhedron_2<T,Items,Mark>& N1) const
-  /*{\Mop returns |\Mvar| $-$ |N1|. }*/
-  { Nef_polyhedron_2<T,Items,Mark> res(pm(),false); // empty, no frame
-    Overlayer D(res.pm());
-    D.subdivide(pm(),N1.pm());
-    DIFF _diff; D.select(_diff);
-    res.clear_outer_face_cycle_marks();
-    D.simplify(Except_frame_box_edges(res.pm()));
-    return res;
-  }    
-
-  Nef_polyhedron_2<T,Items,Mark> symmetric_difference(
-    const Nef_polyhedron_2<T,Items,Mark>& N1) const
-  /*{\Mop returns the symmectric difference |\Mvar - T| $\cup$ 
-          |T - \Mvar|. }*/
-  { Nef_polyhedron_2<T,Items,Mark> res(pm(),false); // empty, no frame
-    Overlayer D(res.pm());
-    D.subdivide(pm(),N1.pm());
-    XOR _xor; D.select(_xor);
-    res.clear_outer_face_cycle_marks();
-    D.simplify(Except_frame_box_edges(res.pm()));
-    return res;
-  }
-
-  #if 0
-  Nef_polyhedron_2<T,Items,Mark> transform(const Aff_transformation& t) const
-  /*{\Mop returns $t(|\Mvar|)$.}*/
-  { Nef_polyhedron_2<T,Items,Mark> res(pm()); // cloned
-    Transformer PMT(res.pm());
-    PMT.transform(t);
-    return res;
-  }
-  #endif
-
-
-  /*{\Mtext Additionally there are operators |*,+,-,^,!| which
-  implement the binary operations \emph{intersection}, \emph{union},
-  \emph{difference}, \emph{symmetric difference}, and the unary
-  operation \emph{complement} respectively. There are also the
-  corresponding modification operations |*=,+=,-=,^=|.}*/
-
-  Nef_polyhedron_2<T,Items,Mark>  operator*(const Nef_polyhedron_2<T,Items,Mark>& N1) const
-  { return intersection(N1); }
-
-  Nef_polyhedron_2<T,Items,Mark>  operator+(const Nef_polyhedron_2<T,Items,Mark>& N1) const
-  { return join(N1); }
-
-  Nef_polyhedron_2<T,Items,Mark>  operator-(const Nef_polyhedron_2<T,Items,Mark>& N1) const
-  { return difference(N1); }
-
-  Nef_polyhedron_2<T,Items,Mark>  operator^(const Nef_polyhedron_2<T,Items,Mark>& N1) const
-  { return symmetric_difference(N1); }
-
-  Nef_polyhedron_2<T,Items,Mark>  operator!() const
-  { return complement(); }
-   
-  Nef_polyhedron_2<T,Items,Mark>& operator*=(const Nef_polyhedron_2<T,Items,Mark>& N1)
-  { *this = intersection(N1); return *this; }
-
-  Nef_polyhedron_2<T,Items,Mark>& operator+=(const Nef_polyhedron_2<T,Items,Mark>& N1)
-  { *this = join(N1); return *this; }
-
-  Nef_polyhedron_2<T,Items,Mark>& operator-=(const Nef_polyhedron_2<T,Items,Mark>& N1)
-  { *this = difference(N1); return *this; }
-
-  Nef_polyhedron_2<T,Items,Mark>& operator^=(const Nef_polyhedron_2<T,Items,Mark>& N1)
-  { *this = symmetric_difference(N1); return *this; }
-
-  /*{\Mtext There are also comparison operations like |<,<=,>,>=,==,!=|
-  which implement the relations subset, subset or equal, superset, superset
-  or equal, equality, inequality, respectively.}*/
-
-  bool operator==(const Nef_polyhedron_2<T,Items,Mark>& N1) const
-  { return symmetric_difference(N1).is_empty(); }
-
-  bool operator!=(const Nef_polyhedron_2<T,Items,Mark>& N1) const
-  { return !operator==(N1); }  
-
-  bool operator<=(const Nef_polyhedron_2<T,Items,Mark>& N1) const
-  { return difference(N1).is_empty(); } 
-
-  bool operator<(const Nef_polyhedron_2<T,Items,Mark>& N1) const
-  { return difference(N1).is_empty() && !N1.difference(*this).is_empty(); } 
-
-  bool operator>=(const Nef_polyhedron_2<T,Items,Mark>& N1) const
-  { return N1.difference(*this).is_empty(); } 
-
-  bool operator>(const Nef_polyhedron_2<T,Items,Mark>& N1) const   
-  { return N1.difference(*this).is_empty() && !difference(N1).is_empty(); } 
-
-
-  /*{\Mtext \headerline{Exploration - Point location - Ray shooting}
-  As Nef polyhedra are the result of forming complements 
-  and intersections starting from a set |H| of half-spaces that are
-  defined by oriented lines in the plane, they can be represented by
-  an attributed plane map $M = (V,E,F)$. For topological queries
-  within |M| the following types and operations allow exploration
-  access to this structure.}*/
-
-  /*{\Mtypes 3}*/
-  typedef Const_decorator Topological_explorer;
-
-  typedef CGAL::PM_explorer<Const_decorator,T> Explorer;
-  /*{\Mtypemember a decorator to examine the underlying plane map. 
-  See the manual page of |Explorer|.}*/
-
-  typedef typename Locator::Object_handle Object_handle;
-  /*{\Mtypemember a generic handle to an object of the underlying
-  plane map. The kind of object |(vertex, halfedge, face)| can 
-  be determined and the object can be assigned to a corresponding
-  handle by the three functions:\\
-  |bool assign(Vertex_const_handle& h, Object_handle)|\\
-  |bool assign(Halfedge_const_handle& h, Object_handle)|\\
-  |bool assign(Face_const_handle& h, Object_handle)|\\
-  where each function returns |true| iff the assignment to
-  |h| was done.}*/
-
-  enum Location_mode { DEFAULT, NAIVE, LMWT };
-  /*{\Menum selection flag for the point location mode.}*/
-
-
-  /*{\Moperations 3 1 }*/
-
-  void init_locator() const 
-  { const_cast<Self*>(this)->ptr()->init_locator(); }
-  const Locator& locator() const 
-  { CGAL_assertion(ptr()->pl_); return *(ptr()->pl_); }
-
-
-  bool contains(Object_handle h) const
-  /*{\Mop  returns true iff the object |h| is contained in the set
-  represented by |\Mvar|.}*/
-  { Slocator PL(pm()); return PL.mark(h); }
-
-  bool contained_in_boundary(Object_handle h) const
-  /*{\Mop  returns true iff the object |h| is contained in the $1$-skeleton
-  of |\Mvar|.}*/
-  { Vertex_const_handle v;
-    Halfedge_const_handle e;
-    return  ( CGAL::assign(v,h) || CGAL::assign(e,h) );
-  }
-
-  Object_handle locate(const Point& p, Location_mode m = DEFAULT) const
-  /*{\Mop  returns a generic handle |h| to an object (face, halfedge, vertex) 
-  of the underlying plane map that contains the point |p| in its relative 
-  interior. The point |p| is contained in the set represented by |\Mvar| if 
-  |\Mvar.contains(h)| is true. The location mode flag |m| allows one to choose
-  between different point location strategies.}*/
-  { 
-    if (m == DEFAULT || m == LMWT) {
-      init_locator();
-      Extended_point ep = EK.construct_point(p);
-      return locator().locate(ep);
-    } else if (m == NAIVE) {
-      Slocator PL(pm(),EK);
-      Extended_segment s(EK.construct_point(p),
-			 PL.point(PL.vertices_begin()));
-      return PL.locate(s); 
-    }
-    CGAL_error_msg("location mode not implemented.");
-    return Object_handle();
-  }
-
-  struct INSET {
-    const Const_decorator& D;
-    INSET(const Const_decorator& Di) : D(Di) {}
-    bool operator()(Vertex_const_handle v) const { return D.mark(v); }
-    bool operator()(Halfedge_const_handle e) const { return D.mark(e); }
-    bool operator()(Face_const_handle f) const { return D.mark(f); }
-  };
-
-  friend struct INSET;
-
-  Object_handle ray_shoot(const Point& p, const Direction& d, 
-                          Location_mode m = DEFAULT) const
-  /*{\Mop returns a handle |h| with |\Mvar.contains(h)| that can be
-  converted to a |Vertex_/Halfedge_/Face_const_handle| as described
-  above. The object returned is intersected by the ray starting in |p|
-  with direction |d| and has minimal distance to |p|.  The operation
-  returns the null handle |NULL| if the ray shoot along |d| does not hit
-  any object |h| of |\Mvar| with |\Mvar.contains(h)|. The location mode
-  flag |m| allows one to choose between different point location
-  strategies.}*/
-  { 
-    Extended_point ep, eq;
-    if(!check_tag(typename Is_extended_kernel<Extended_kernel>::value_type())) {
-      Const_decorator D(pm());
-      Box_2 b(D.vertices_begin(), D.vertices_end());
-      ep = EK.construct_point(p);
-      eq = b.intersection_ray_bbox(p,d);
-    } else {
-      ep = EK.construct_point(p);
-      eq = EK.construct_point(p,d);      
-    }
-      
-    if (m == DEFAULT || m == LMWT) {
-      init_locator();
-      return locator().ray_shoot(EK.construct_segment(ep,eq),
-                                 INSET(locator())); 
-    } else if (m == NAIVE) {
-      Slocator PL(pm(),EK);
-      return PL.ray_shoot(EK.construct_segment(ep,eq),INSET(PL));
-    }
-    CGAL_error_msg("location mode not implemented.");
-    return Object_handle();
-  }
-
-  struct INSKEL {
-    bool operator()(Vertex_const_handle) const { return true; }
-    bool operator()(Halfedge_const_handle) const { return true; }
-    bool operator()(Face_const_handle) const { return false; }
-  };
-
-  Object_handle ray_shoot_to_boundary(const Point& p, const Direction& d, 
-                Location_mode m = DEFAULT) const
-  /*{\Mop returns a handle |h| that can be converted to a
-  |Vertex_/Halfedge_const_handle| as described above. The object
-  returned is part of the $1$-skeleton of |\Mvar|, intersected by the
-  ray starting in |p| with direction |d| and has minimal distance to
-  |p|.  The operation returns the null handle |NULL| if the ray shoot
-  along |d| does not hit any $1$-skeleton object |h| of |\Mvar|. The
-  location mode flag |m| allows one to choose between different point
-  location strategies.}*/
-  { 
-    Extended_point ep, eq;
-    if(!check_tag(typename Is_extended_kernel<Extended_kernel>::value_type())) {
-      Const_decorator D(pm());
-      Box_2 b(D.vertices_begin(), D.vertices_end());
-      ep = EK.construct_point(p);
-      eq = b.intersection_ray_bbox(p,d);
-    } else {
-      ep = EK.construct_point(p);
-      eq = EK.construct_point(p,d);      
-    }
-      
-    if (m == DEFAULT || m == LMWT) {
-      init_locator();
-      return locator().ray_shoot(EK.construct_segment(ep,eq),
-                                 INSKEL()); 
-    } else if (m == NAIVE) {
-      Slocator PL(pm(),EK);
-      return PL.ray_shoot(EK.construct_segment(ep,eq),INSKEL());
-    }
-    CGAL_error_msg("location mode not implemented.");
-    return Object_handle();
-  }
-
-
-  Explorer explorer() const { return Explorer(pm(),EK); }
-  /*{\Mop returns a decorator object which allows read-only access of
-  the underlying plane map. See the manual page |Explorer| for its 
-  usage.}*/
-
-
-  /*{\Mimplementation Nef polyhedra are implemented on top of a halfedge
-  data structure and use linear space in the number of vertices, edges
-  and facets.  Operations like |empty| take constant time. The
-  operations |clear|, |complement|, |interior|, |closure|, |boundary|,
-  |regularization|, input and output take linear time. All binary set
-  operations and comparison operations take time $O(n \log n)$ where $n$
-  is the size of the output plus the size of the input.
-
-  The point location and ray shooting operations are implemented in
-  two flavors. The |NAIVE| operations run in linear query time without
-  any preprocessing, the |DEFAULT| operations (equals |LMWT|) run in
-  sub-linear query time, but preprocessing is triggered with the first
-  operation. Preprocessing takes time $O(N^2)$, the sub-linear point
-  location time is either logarithmic when LEDA's persistent
-  dictionaries are present or if not then the point location time is
-  worst-case linear, but experiments show often sublinear runtimes.  Ray
-  shooting equals point location plus a walk in the constrained
-  triangulation overlayed on the plane map representation. The cost of
-  the walk is proportional to the number of triangles passed in
-  direction |d| until an obstacle is met. In a minimum weight
-  triangulation of the obstacles (the plane map representing the
-  polyhedron) the theory provides a $O(\sqrt{n})$ bound for the number
-  of steps. Our locally minimum weight triangulation approximates the
-  minimum weight triangulation only heuristically (the calculation of
-  the minimum weight triangulation is conjectured to be NP hard). Thus
-  we have no runtime guarantee but a strong experimental motivation for
-  its approximation.}*/
-
-  /*{\Mexample Nef polyhedra are parameterized by a so-called extended
-  geometric kernel. There are three kernels, one based on a homogeneous
-  representation of extended points called |Extended_homogeneous<RT>|
-  where |RT| is a ring type providing additionally a |gcd| operation and
-  one based on a cartesian representation of extended points called
-  |Extended_cartesian<NT>| where |NT| is a field type, and finally
-  |Filtered_extended_homogeneous<RT>| (an optimized version of the
-  first).
-
-  The member types of |Nef_polyhedron_2< Extended_homogeneous<NT> >|
-  map to corresponding types of the CGAL geometry kernel
-  (e.g. |Nef_polyhedron::Line| equals
-  |CGAL::Homogeneous<leda_integer>::Line_2| in the example below).
-  \begin{Mverb}
-  #include <CGAL/basic.h>
-  #include <CGAL/leda_integer.h>
-  #include <CGAL/Extended_homogeneous.h>
-  #include <CGAL/Nef_polyhedron_2.h>
-
-  using namespace CGAL;
-  typedef  Extended_homogeneous<leda_integer> Extended_kernel;
-  typedef  Nef_polyhedron_2<Extended_kernel>  Nef_polyhedron;
-  typedef  Nef_polyhedron::Line               Line;
-
-  int main()
-  {
-    Nef_polyhedron N1(Line(1,0,0));
-    Nef_polyhedron N2(Line(0,1,0), Nef_polyhedron::EXCLUDED);
-    Nef_polyhedron N3 = N1 * N2; // line (*)
-    return 0;
-  }
-  \end{Mverb}
-  After line (*) |N3| is the intersection of |N1| and |N2|.}*/
-
-
-}; // end of Nef_polyhedron_2
-
-template <typename T, typename Items, typename Mark>
-T Nef_polyhedron_2<T,Items,Mark>::EK;
-
-
-template <typename T, typename Items, typename Mark>
-const typename Nef_polyhedron_2<T,Items,Mark>::Polygons Nef_polyhedron_2<T,Items,Mark>::POLYGONS = typename Nef_polyhedron_2<T,Items,Mark>::Polygons();
-
-template <typename T, typename Items, typename Mark>
-const typename Nef_polyhedron_2<T,Items,Mark>::Polylines Nef_polyhedron_2<T,Items,Mark>::POLYLINES = typename Nef_polyhedron_2<T,Items,Mark>::Polylines();
-
-template <typename T, typename Items, typename Mark>
-std::ostream& operator<<
- (std::ostream& os, const Nef_polyhedron_2<T,Items,Mark>& NP)
-{
-  os << "Nef_polyhedron_2<" << NP.EK.output_identifier() << ">\n";
-  typedef typename Nef_polyhedron_2<T,Items,Mark>::Decorator Decorator;
-  CGAL::PM_io_parser<Decorator> O(os, NP.pm()); O.print();
-  return os;
-}
-
-template <typename T, typename Items, typename Mark>
-std::istream& operator>>
-  (std::istream& is, Nef_polyhedron_2<T,Items,Mark>& NP)
-{
-  typedef typename Nef_polyhedron_2<T,Items,Mark>::Decorator Decorator;
-  CGAL::PM_io_parser<Decorator> I(is, NP.pm()); 
-  if (I.check_sep("Nef_polyhedron_2<") &&
-      I.check_sep(NP.EK.output_identifier()) &&
-      I.check_sep(">")) I.read();
-  else {
-    std::cerr << "Nef_polyhedron_2 input corrupted." << std::endl;
-    NP = Nef_polyhedron_2<T,Items,Mark>();
-  }
-  typename Nef_polyhedron_2<T,Items,Mark>::Topological_explorer D(NP.explorer());
-  D.check_integrity_and_topological_planarity();
-  return is;
-}
-
-
-
-} //namespace CGAL
-
-#if defined(BOOST_MSVC)
-#  pragma warning(pop)
-#endif
-
-#endif //CGAL_NEF_POLYHEDRON_2_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_polyhedron_3.h b/3rdparty/CGAL-4.8/include/CGAL/Nef_polyhedron_3.h
deleted file mode 100644
index b6f5b2d..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Nef_polyhedron_3.h
+++ /dev/null
@@ -1,2130 +0,0 @@
-// Copyright (c) 1997-2002,2005 Max-Planck-Institute Saarbruecken (Germany).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Michael Seel    <seel at mpi-sb.mpg.de>
-//                 Miguel Granados <granados at mpi-sb.mpg.de>
-//                 Susan Hert      <hert at mpi-sb.mpg.de>
-//                 Lutz Kettner    <kettner at mpi-sb.mpg.de>
-//                 Ralf Osbild     <osbild at mpi-sb.mpg.de>
-//                 Peter Hachenberger <hachenberger at mpi-sb.mpg.de>
-#ifndef CGAL_NEF_POLYHEDRON_3_H
-#define CGAL_NEF_POLYHEDRON_3_H
-
-#include <CGAL/basic.h>
-#include <CGAL/Handle_for.h>
-#include <CGAL/Nef_3/Default_items.h>
-#include <CGAL/Nef_3/SNC_structure.h>
-#include <CGAL/Nef_3/SNC_decorator.h>
-#include <CGAL/Nef_3/SNC_const_decorator.h>
-#include <CGAL/Nef_3/SNC_constructor.h>
-#include <CGAL/Nef_3/SNC_external_structure.h>
-#include <CGAL/Nef_3/Combine_with_halfspace.h>
-#ifdef CGAL_NEF_VISUAL_HULL
-#include <CGAL/Nef_3/Binary_operation_vs.h>
-#else
-#include <CGAL/Nef_3/Binary_operation.h>
-#endif
-#include <CGAL/Nef_S2/SM_decorator.h>
-#include <CGAL/Nef_S2/SM_const_decorator.h>
-#include <CGAL/Nef_3/SNC_SM_overlayer.h>
-#include <CGAL/Nef_S2/SM_point_locator.h>
-#include <CGAL/Nef_3/SNC_SM_explorer.h>
-#include <CGAL/Nef_polyhedron_S2.h>
-#include <CGAL/Modifier_base.h>
-#include <CGAL/Nef_3/Mark_bounded_volumes.h>
-
-
-#ifdef CGAL_NEF3_CGAL_NEF3_SM_VISUALIZOR
-#include <CGAL/Nef_3/SNC_SM_visualizor.h>
-#endif // CGAL_NEF3_SM_VISUALIZOR
-
-#ifdef CGAL_NEF3_OLD_VISUALIZATION 
-#include <CGAL/Nef_3/Visualizor_OpenGL_3.h>
-#endif // CGAL_NEF3_OLD_VISUALIZATION 
-
-#include <CGAL/IO/Verbose_ostream.h>
-#include <CGAL/Nef_3/polyhedron_3_to_nef_3.h>
-#include <CGAL/Nef_3/shell_to_nef_3.h>
-#include <CGAL/Polyhedron_incremental_builder_3.h>
-#include <CGAL/Polyhedron_3.h>
-#include <CGAL/Nef_3/SNC_point_locator.h>
-#include <CGAL/assertions.h>
-
-#include <CGAL/Constrained_triangulation_2.h>
-#include <CGAL/Triangulation_data_structure_2.h>
-#include <CGAL/Projection_traits_xy_3.h>
-#include <CGAL/Projection_traits_yz_3.h>
-#include <CGAL/Projection_traits_xz_3.h>
-#include <CGAL/Constrained_triangulation_face_base_2.h>
-#include <list>
-
-// RO: includes for "vertex cycle to Nef" constructor
-#include <CGAL/Nef_3/vertex_cycle_to_nef_3.h>
-#include <CGAL/Vector_3.h>
-#include <CGAL/normal_vector_newell_3.h>
-
-#ifdef CGAL_NEF_VISUAL_HULL
-#include <CGAL/Nef_3/Modifying_binary_operation_vs.h>
-#endif
-
-#undef CGAL_NEF_DEBUG
-#define CGAL_NEF_DEBUG 11
-#include <CGAL/Nef_2/debug.h>
-
-namespace CGAL {
-
-template <typename K, typename I, typename M> class Nef_polyhedron_3;
-template <typename K, typename I, typename M> class Nef_polyhedron_3_rep;
-
-template <typename K, typename I, typename M>
-std::ostream& operator<<(std::ostream& os, Nef_polyhedron_3<K,I,M>& NP);
-
-template <typename K, typename I, typename M>
-std::istream& operator>>(std::istream& os, Nef_polyhedron_3<K,I,M>& NP);
-
-
-template <typename K, typename I, typename M>
-class Nef_polyhedron_3_rep 
-{ 
-  typedef Nef_polyhedron_3_rep<K,I,M>                  Self;
-  friend class Nef_polyhedron_3<K,I,M>;
- public:
-  typedef CGAL::SNC_structure<K,I,M>                      SNC_structure;
-  typedef CGAL::SNC_decorator<SNC_structure>              SNC_decorator;
-  typedef CGAL::SNC_const_decorator<SNC_structure>        SNC_const_decorator;
-  typedef CGAL::Binary_operation<SNC_structure>           Binary_operation;
-  typedef CGAL::SNC_constructor<I, SNC_structure>         SNC_constructor;
-  typedef CGAL::SNC_external_structure<I, SNC_structure>  SNC_external_structure;
-  typedef CGAL::SNC_point_locator<SNC_decorator> SNC_point_locator;
-  typedef CGAL::SNC_simplify<I, SNC_structure>            SNC_simplify;
-  typedef CGAL::SNC_point_locator_by_spatial_subdivision<SNC_decorator> SNC_point_locator_default;
-
-  typedef typename SNC_structure::Sphere_map       Sphere_map;
-  typedef CGAL::SM_decorator<Sphere_map>           SM_decorator;
-  typedef CGAL::SM_const_decorator<Sphere_map>     SM_const_decorator;
-  typedef CGAL::SNC_SM_overlayer<I, SM_decorator>  SM_overlayer;
-  typedef CGAL::SM_point_locator<SNC_structure>    SM_point_locator;
-
-#ifdef CGAL_NEF3_SM_VISUALIZOR
-  typedef CGAL::SNC_SM_visualizor<SNC_structure>       SM_visualizor;
-#endif // CGAL_NEF3_SM_VISUALIZOR
-
- private:
-  SNC_structure snc_;
-  SNC_point_locator* pl_;
-  
- public:
-  Nef_polyhedron_3_rep() : snc_(), pl_() {}
-  ~Nef_polyhedron_3_rep() { 
-    CGAL_NEF_TRACEN( "Nef_polyhedron_3_rep: destroying SNC structure "<<&snc_<<
-	    ", point locator "<<pl_);
-    snc_.clear(); 
-    delete pl_; 
-  }
-};
-
-/*{\Manpage {Nef_polyhedron_3} {T} {Nef Polyhedra in Space}{N}}*/
-
-/*{\Mdefinition
-An instance of data type |\Mname| is a subset of 3-space which is the
-result of forming complements and intersections starting from a set |H| of
-halfspaces. |\Mtype| is closed under all binary set opertions |intersection|,
-|union|, |difference|, |complement| and under the topological operations
-|boundary|, |closure|, and |interior|.}*/
-
-template <typename Kernel_, typename Items_ = typename CGAL::Default_items<Kernel_>::Items, typename Mark_ = bool>
-class Nef_polyhedron_3 : public CGAL::Handle_for< Nef_polyhedron_3_rep<Kernel_, Items_, Mark_> >, 
-			 public SNC_const_decorator<SNC_structure<Kernel_,Items_,Mark_> >
-{ 
- public:
-  /*{\Mtypes 7}*/  
-  
-  typedef Kernel_                                     Kernel;
-  typedef Kernel_                                     Traits;
-  typedef Items_                                      Items;
-  typedef Mark_                                       Mark;
-  typedef Nef_polyhedron_3<Kernel, Items, Mark>       Self;
-  typedef Nef_polyhedron_3<Kernel, Items, Mark>       Nef_polyhedron;
-  typedef Handle_for< Nef_polyhedron_3_rep<Kernel, Items, Mark> >   Base;
-  typedef typename Kernel::Point_3                    Point_3;
-  typedef typename Kernel::Plane_3                    Plane_3;
-  typedef typename Kernel::Vector_3                   Vector_3;
-  typedef typename Kernel::Segment_3                  Segment_3;
-  typedef typename Kernel::Aff_transformation_3       Aff_transformation_3;
-
-#ifndef _MSC_VER
-  // VC++ has a problem to digest the following typedef,
-  // and does not need the using statements -- AF
-  // The left and right part of these typedefs have the same name. It is
-  // very important to qualify the left part with the CGAL:: namespace, no
-  // to confuse g++. -- Laurent Rineau, 2010/09/13
-  typedef CGAL::SNC_structure<Kernel,Items,Mark> SNC_structure;
-  typedef CGAL::SNC_const_decorator<SNC_structure> SNC_const_decorator;
-  using SNC_const_decorator::set_snc;
-  using SNC_const_decorator::is_standard;
-  using SNC_const_decorator::is_bounded;
-#endif
-
-  struct Polylines_tag {};
-  struct Points_tag {};
-
-  enum Boundary { EXCLUDED=0, INCLUDED=1 };
-  /*{\Menum construction selection.}*/
-
-  typedef enum { EMPTY=0, COMPLETE=1 } Content;
-  /*{\Menum construction selection}*/
-
-  typedef enum { DEFAULT, NAIVE, WALKING, SPATIAL_SUBDIVISION  } Location_mode;
-  /*{\Menum selection flag for the point location mode.}*/
-
-protected: 
-  struct AND {
-    Mark operator()(const Mark& b1, const Mark& b2, bool /* inverted */ =false)const 
-    { return b1&&b2; } 
-  };
-
-  struct OR {
-    Mark operator()(const Mark& b1, const Mark& b2, bool /* inverted */ =false) const
-    { return b1||b2; } 
-  };
-
-  struct DIFF {
-    Mark operator()(const Mark& b1, const Mark& b2, bool inverted=false) const 
-    { return (inverted) ? !b1&&b2  :  b1&&!b2 ; }
-  };
-
-  struct XOR {
-    Mark operator()(const Mark& b1, const Mark& b2, bool /* inverted */ =false) const 
-    { return (b1&&!b2)||(!b1&&b2); } 
-  };
-
- public:
-  typedef Nef_polyhedron_3_rep<Kernel,Items, Mark>    Nef_rep;
-
-  typedef typename Nef_rep::SM_decorator        SM_decorator;
-  typedef typename Nef_rep::SM_const_decorator  SM_const_decorator;
- protected:
-  typedef typename Nef_rep::SNC_decorator       SNC_decorator;
-  typedef typename Nef_rep::SNC_constructor     SNC_constructor;
-  typedef typename Nef_rep::SNC_external_structure SNC_external_structure;
-  typedef typename Nef_rep::Binary_operation    Binary_operation;
-  typedef typename Nef_rep::SNC_point_locator   SNC_point_locator;
-  typedef typename Nef_rep::SNC_point_locator_default
-    SNC_point_locator_default;
-  typedef CGAL::Combine_with_halfspace<SNC_structure, SNC_point_locator> 
-          Combine_with_halfspace;
-public:
- enum Intersection_mode { 
-	 CLOSED_HALFSPACE = Combine_with_halfspace::CLOSED_HALFSPACE, 
-     OPEN_HALFSPACE = Combine_with_halfspace::OPEN_HALFSPACE, 
-     PLANE_ONLY = Combine_with_halfspace::PLANE_ONLY};
-
-protected: 
-  typedef typename Nef_rep::SM_overlayer        SM_overlayer;
-  typedef typename Nef_rep::SM_point_locator    SM_point_locator;
-  typedef typename Nef_rep::SNC_simplify        SNC_simplify;
-#ifdef CGAL_NEF3_SM_VISUALIZOR
-  typedef typename Nef_rep::SM_visualizor       SM_visualizor;
-#endif // CGAL_NEF3_SM_VISUALIZOR
-#ifdef CGAL_NEF3_OLD_VISUALIZATION 
-  typedef CGAL::Nef_Visualizor_OpenGL_3<Nef_polyhedron_3> Visualizor;
-#endif // CGAL_NEF3_OLD_VISUALIZATION 
-
- typedef typename Nef_rep::Sphere_map                Sphere_map;
- public:
- typedef CGAL::Nef_polyhedron_S2<Kernel,Items,Mark,Sphere_map> Nef_polyhedron_S2;
- protected:
-
-  SNC_structure& snc() { return this->ptr()->snc_; } 
-  const SNC_structure& snc() const { return this->ptr()->snc_; } 
-
-  SNC_point_locator*& pl() { return this->ptr()->pl_; }
-  const SNC_point_locator* pl() const { return this->ptr()->pl_; }
-
-  friend std::ostream& operator<< <>
-      (std::ostream& os, Nef_polyhedron_3<Kernel,Items, Mark>& NP);
-  friend std::istream& operator>> <>
-      (std::istream& is, Nef_polyhedron_3<Kernel,Items, Mark>& NP);
-
-  typedef typename SNC_decorator::Vertex_handle    Vertex_handle;
-  typedef typename SNC_decorator::Halfedge_handle  Halfedge_handle;
-  typedef typename SNC_decorator::Halffacet_handle
-                                                   Halffacet_handle;
-  typedef typename SNC_decorator::Volume_handle    Volume_handle;
-
- public:
-  typedef typename SNC_structure::Sphere_point                 Sphere_point;
-  typedef typename SNC_structure::Sphere_segment               Sphere_segment;
-  typedef typename SNC_structure::Sphere_circle                Sphere_circle;
-  typedef typename SNC_structure::Vertex_base                  Vertex;
-  typedef typename SNC_structure::Halfedge_base                Halfedge;
-  typedef typename SNC_structure::Halffacet_base               Halffacet;
-  typedef typename SNC_structure::Volume_base                  Volume;
-  typedef typename SNC_structure::Vertex_const_handle          Vertex_const_handle;
-  typedef typename SNC_structure::Halfedge_const_handle        Halfedge_const_handle;
-  typedef typename SNC_structure::Halffacet_const_handle       Halffacet_const_handle;
-  typedef typename SNC_structure::Volume_const_handle          Volume_const_handle;
-  typedef typename SNC_structure::SHalfedge_around_svertex_circulator 
-                                  SHalfedge_around_svertex_circulator;
-  typedef typename SNC_structure::SHalfedge_around_svertex_const_circulator 
-                                  SHalfedge_around_svertex_const_circulator;
-  typedef typename SNC_structure::SHalfedge_around_facet_circulator 
-                                  SHalfedge_around_facet_circulator;
-  typedef typename SNC_structure::SHalfedge_around_facet_const_circulator 
-                                  SHalfedge_around_facet_const_circulator;
-  typedef typename SNC_structure::SHalfedge_around_sface_const_circulator 
-                                  SHalfedge_around_sface_const_circulator;
-  typedef typename SNC_structure::Halffacet_cycle_const_iterator     
-                                  Halffacet_cycle_const_iterator;
-  typedef typename SNC_structure::Halffacet_cycle_iterator     
-                                  Halffacet_cycle_iterator;
-  typedef typename SNC_structure::Infi_box                     Infi_box;
-  typedef typename SNC_structure::Size_type Size_type;
-  typedef Size_type                         size_type;
-
-  typedef typename Kernel::RT                       RT;
-
- public:
-  typedef typename SM_decorator::SVertex_handle    SVertex_handle;
-  typedef typename SM_decorator::SHalfedge_handle  SHalfedge_handle;
-  typedef typename SM_decorator::SFace_handle      SFace_handle;
-  typedef typename SM_decorator::SVertex_const_handle
-                                                   SVertex_const_handle;
-  typedef typename SM_decorator::SHalfedge_const_handle
-                                                   SHalfedge_const_handle;
-  typedef typename SM_decorator::SHalfloop_const_handle
-                                                   SHalfloop_const_handle;
-  typedef typename SM_decorator::SFace_const_handle
-                                                   SFace_const_handle;
-  typedef typename SNC_decorator::Vertex_iterator  Vertex_iterator;
-  typedef typename SNC_decorator::Halfedge_iterator
-                                                   Halfedge_iterator;
-  typedef typename SNC_decorator::Halffacet_iterator
-                                                   Halffacet_iterator;
-  typedef typename SNC_structure::Shell_entry_iterator
-                                                   Shell_entry_iterator;
-  typedef typename SNC_decorator::Volume_iterator  Volume_iterator;
-  typedef typename SNC_structure::Vertex_const_iterator
-                                                    Vertex_const_iterator;
-  typedef typename SNC_structure::Halfedge_const_iterator 
-                                                   Halfedge_const_iterator;
-  typedef typename SNC_structure::Halffacet_const_iterator     
-                                                   Halffacet_const_iterator;
-  typedef typename SNC_structure::Volume_const_iterator     
-                                                   Volume_const_iterator;
-  typedef typename SNC_structure::Shell_entry_const_iterator
-                                                   Shell_entry_const_iterator;
-  typedef typename SM_decorator::SVertex_iterator  SVertex_iterator;
-  typedef typename SM_decorator::SHalfedge_iterator
-                                                   SHalfedge_iterator;
-  typedef typename SM_decorator::SHalfloop_iterator
-                                                   SHalfloop_iterator;
-  typedef typename SM_decorator::SFace_iterator    SFace_iterator;
-  typedef typename SM_decorator::SVertex_const_iterator
-                                                   SVertex_const_iterator;
-  typedef typename SM_decorator::SHalfedge_const_iterator 
-                                                   SHalfedge_const_iterator;
-  typedef typename SM_decorator::SHalfloop_const_iterator 
-                                                   SHalfloop_const_iterator;
-  typedef typename SM_decorator::SFace_const_iterator     
-                                                   SFace_const_iterator;
-  typedef typename SNC_decorator::SFace_cycle_const_iterator     
-                                                   SFace_cycle_const_iterator;
-
-  typedef typename SNC_decorator::Association  Association;
-
-
- protected: 
-  void initialize_infibox_vertices(Content space) {
-    SNC_constructor C(snc()); 
-    Infi_box::initialize_infibox_vertices(C, space == COMPLETE);
-  }
-
-  void check_h_for_intersection_of_12_cube_edges_and_add_vertices
-  (const Plane_3& p);
-  void create_intersection_vertex_of_h_and_e();
-  void init_cube_vertices_depending_on_h(const Plane_3& p);
-  void add_h_to_local_view_of_v();
-  
- public:
-  void build_external_structure() {
-    SNC_external_structure es(snc(), pl());
-    es.build_external_structure();
-  }
-
- public:
-  /*{\Mcreation 3}*/
-
-  Nef_polyhedron_3( Content space = EMPTY);
-		   
-  /*{\Mcreate creates an instance |\Mvar| of type |\Mname|
-  and initializes it to the empty set if |space == EMPTY|
-  and to the whole space if |space == COMPLETE|.}*/
-
-  explicit Nef_polyhedron_3(const Plane_3& p, Boundary b = INCLUDED);
-  /*{\Mcreate creates a Nef polyhedron |\Mvar| containing the
-  halfspace on the negative side of |p| including |p| if |b==INCLUDED|,
-  excluding |p| if |b==EXCLUDED|.}*/
-
-  Nef_polyhedron_3(const Nef_polyhedron_3<Kernel,Items, Mark>& N1) 
- : Base(N1) , SNC_const_decorator() {
-    set_snc(snc());
-  } 
-
-  Nef_polyhedron_3& operator=(const Nef_polyhedron_3<Kernel,Items, Mark>& N1) { 
-    Base::operator=(N1);
-    set_snc(snc());
-    return (*this); 
-  }
-
-  ~Nef_polyhedron_3() { 
-    CGAL_NEF_TRACEN("~Nef_polyhedron_3: destructor called for snc "<<&snc()<<
-	   ", pl "<<pl());
-  }
-
-   // RO: "vertex cycle to Nef" constructor (main part)
-   // II input iterator; KN kernel of normal (may differ from Nef kernel)
-   template <class II, class KN>
-   Nef_polyhedron_3 (II v_first, II v_last,
-                    const CGAL::Vector_3<KN> &normal, bool verb = false)
-   {  CGAL_NEF_TRACEN("construction from vertex cycle (main part)");
-
-      // project and triangulate vertices,
-      // convert result to Nef_polyhedron
-      CGAL_precondition (!CGAL::is_empty_range (v_first, v_last));
-      bool is_nef = vertex_cycle_to_nef_3<Nef_polyhedron> (snc(),
-         v_first, v_last, normal, verb);
-      if (is_nef)
-      {
-	 // TO DO:
-	 // Wie kann der eigene point_locator pl() eingebunden werden?
-	 // Wie kann der Konstruktor umgangen werden?
-         typedef CGAL::SNC_point_locator_by_spatial_subdivision
-            <CGAL::SNC_decorator<SNC_structure> >    Point_locator;
-
-         Point_locator Pl;
-         SNC_external_structure es(snc(), &Pl);
-         es.build_external_structure();
-         *this = Nef_polyhedron(snc(), &Pl);
-      }
-      else
-      {  *this = Nef_polyhedron();
-      }
-      set_snc (snc());
-      CGAL_expensive_postcondition (is_valid());
-   }
-
-   // RO: "vertex cycle to Nef" constructor (normal computation)
-   template <class II>
-   Nef_polyhedron_3 (II v_first, II v_last, bool verb = false)
-   {  CGAL_NEF_TRACEN("construction from vertex cycle (normal computation)");
-
-      // compute normal vector
-      CGAL_precondition (!CGAL::is_empty_range (v_first, v_last));
-      CGAL::Vector_3<typename II::value_type::R> normal;
-      normal_vector_newell_3 (v_first, v_last, normal);
-
-      // call "main" constructor
-      *this = Nef_polyhedron_3 (v_first, v_last, normal, verb);
-      set_snc (snc());
-   }
-  
- template<typename Items, typename SNC_structure>
- class Sphere_map_creator {
-   typedef typename SNC_structure::SM_decorator     SM_decorator;
-   typedef typename SNC_structure::Vertex_handle    Vertex_handle;
-   typedef typename SNC_structure::SVertex_handle   SVertex_handle;
-   typedef typename SNC_structure::SFace_handle     SFace_handle;
-   typedef typename SNC_structure::Sphere_point     Sphere_point;
-   
-   public:
-   Sphere_map_creator() {}
-   
-   template<typename point_iterator>
-   void create_end_sphere_map(SNC_structure& snc,
-			      point_iterator cur,
-			      point_iterator prev) {
-     Vertex_handle v(snc.new_vertex(*cur, true));
-     SM_decorator SM(&*v);
-     SVertex_handle sv(v->new_svertex(Sphere_point(ORIGIN+(*prev-*cur)),
-				      true));
-     SFace_handle sf(v->new_sface());
-     SM.link_as_isolated_vertex(sv,sf);
-   }
-   
-   template<typename point_iterator>
-   void create_sphere_map(SNC_structure& snc,
-			  point_iterator cur,
-			  point_iterator prev,
-			  point_iterator next) {
-     Vertex_handle v(snc.new_vertex(*cur, true));
-     SM_decorator SM(&*v);
-     SVertex_handle sv1(v->new_svertex(Sphere_point(ORIGIN+(*prev-*cur)),
-				       true));
-     SVertex_handle sv2(v->new_svertex(Sphere_point(ORIGIN+(*next-*cur)),
-				       true));      
-     SFace_handle sf(v->new_sface());
-     SM.link_as_isolated_vertex(sv1,sf);
-     SM.link_as_isolated_vertex(sv2,sf);
-   }
- };
- 
- template<typename SNC_structure>
- class Sphere_map_creator<CGAL::SNC_indexed_items, SNC_structure> {
-   typedef typename SNC_structure::SM_decorator     SM_decorator;
-   typedef typename SNC_structure::Vertex_handle    Vertex_handle;
-   typedef typename SNC_structure::SVertex_handle   SVertex_handle;
-   typedef typename SNC_structure::SFace_handle     SFace_handle;
-   typedef typename SNC_structure::Sphere_point     Sphere_point;
-   
-   bool first;
-   int index;
- public:
-   Sphere_map_creator() : first(true), index(0) {}
-     
-     template<typename point_iterator>
-       void create_end_sphere_map(SNC_structure& snc,
-				  point_iterator cur,
-				  point_iterator prev) {
-       Vertex_handle v(snc.new_vertex(*cur, true));
-       SM_decorator SM(&*v);
-       SVertex_handle sv(v->new_svertex(Sphere_point(ORIGIN+(*prev-*cur)),
-					true));
-       SFace_handle sf(v->new_sface());
-       SM.link_as_isolated_vertex(sv,sf);
-       if(first) {
-	 sv->set_index();
-	 index = sv->get_index();
-	 first = false;
-       } else
-	 sv->set_index(index);
-     }
-     
-     template<typename point_iterator>
-       void create_sphere_map(SNC_structure& snc,
-			      point_iterator cur,
-			      point_iterator prev,
-			      point_iterator next) {
-       Vertex_handle v(snc.new_vertex(*cur, true));
-       SM_decorator SM(&*v);
-       SVertex_handle sv1(v->new_svertex(Sphere_point(ORIGIN+(*prev-*cur)),
-					 true));
-       SVertex_handle sv2(v->new_svertex(Sphere_point(ORIGIN+(*next-*cur)),
-					 true));      
-       SFace_handle sf(v->new_sface());
-       SM.link_as_isolated_vertex(sv1,sf);
-       SM.link_as_isolated_vertex(sv2,sf);
-       sv1->set_index(index);
-       sv2->set_index();
-       index = sv2->get_index();
-     }
- };
- 
- template <typename InputIterator>
- Nef_polyhedron_3(InputIterator begin, InputIterator end, Polylines_tag) {
-   typedef typename std::iterator_traits<InputIterator>::value_type
-     point_iterator_pair;
-   typedef typename point_iterator_pair::first_type
-     point_iterator;
-
-   empty_rep();
-   set_snc(snc());
-   initialize_infibox_vertices(EMPTY);
-
-   point_iterator pbegin, pend, pnext, pprev;
-   Sphere_map_creator<Items, SNC_structure> smc;
-   for(;begin != end; ++begin) {
-     pend = begin->second;
-     pprev = pnext = pbegin = begin->first;
-     ++pnext;
-     CGAL_assertion(pnext != pend);
-     smc.create_end_sphere_map(snc(),pbegin,pnext);
-     for(++pbegin,++pnext; pnext!=pend; ++pbegin,++pprev,++pnext)
-       smc.create_sphere_map(snc(),pbegin,pprev,pnext);
-     smc.create_end_sphere_map(snc(),pbegin,pprev);
-   }
-   build_external_structure();
-   simplify();
- }
-
- explicit
- Nef_polyhedron_3(const Segment_3& s) {
-   empty_rep();
-   set_snc(snc());
-   initialize_infibox_vertices(EMPTY);
-
-   Sphere_map_creator<Items, SNC_structure> smc;
-   std::vector<Point_3> endpoints(2);
-   endpoints[0]=s.source();
-   endpoints[1]=s.target();
-   smc.create_end_sphere_map(snc(),&endpoints[0],&endpoints[1]);
-   smc.create_end_sphere_map(snc(),&endpoints[1],&endpoints[0]);
-
-   build_external_structure();
-   simplify();
- }
-
- template <typename InputIterator>
- Nef_polyhedron_3(InputIterator begin, InputIterator end, Points_tag) {
-   empty_rep();
-   set_snc(snc());
-   initialize_infibox_vertices(EMPTY);
-
-   for(InputIterator it=begin; it!=end;++it)
-   {
-     Vertex_handle v(snc().new_vertex(*it, true));
-     SM_decorator SM(&*v);
-     v->new_sface();
-   }
-   build_external_structure();
-   simplify();
- }
-
- explicit
- Nef_polyhedron_3(const Point_3& p) {
-   empty_rep();
-   set_snc(snc());
-   initialize_infibox_vertices(EMPTY);
-
-   Vertex_handle v(snc().new_vertex(p, true));
-   SM_decorator SM(&*v);
-   v->new_sface();
-
-   build_external_structure();
-   simplify();
- }
-
- template <class T1, class T2,
-           template <class T31, class T32, class T33>
-           class T3, class T4 >
- Nef_polyhedron_3( CGAL::Polyhedron_3<T1,T2,T3,T4>& P) {
-    CGAL_NEF_TRACEN("construction from Polyhedron_3");
-    SNC_structure rsnc;
-    *this = Nef_polyhedron_3(rsnc, new SNC_point_locator_default, false);
-    initialize_infibox_vertices(EMPTY);
-    polyhedron_3_to_nef_3
-      <CGAL::Polyhedron_3<T1,T2,T3,T4>, SNC_structure>( P, snc());
-    build_external_structure();
-    simplify();
-    CGAL::Mark_bounded_volumes<Nef_polyhedron_3> mbv(true);
-    delegate(mbv);
-    set_snc(snc());
-  }
-  
- Nef_polyhedron_3(const Nef_polyhedron& N, 
-		  SFace_const_iterator sf) 
- {
-   SNC_structure rsnc;
-   *this = Nef_polyhedron_3(rsnc, new SNC_point_locator_default, false);
-   initialize_infibox_vertices(EMPTY);
-   shell_to_nef_3(N, sf, snc());
-   build_external_structure();
-   simplify();
-   CGAL::Mark_bounded_volumes<Nef_polyhedron_3> mbv(true);
-   delegate(mbv);
-   set_snc(snc());
- }
-
-
- protected: 
-
-  template<typename Kernel>
-  class Triangulation_handler2 {
-
-    typedef typename CGAL::Triangulation_vertex_base_2<Kernel>               Vb;
-    typedef typename CGAL::Constrained_triangulation_face_base_2<Kernel>     Fb;
-    typedef typename CGAL::Triangulation_data_structure_2<Vb,Fb>             TDS;
-    typedef typename CGAL::Constrained_triangulation_2<Kernel,TDS>           CT;
-
-    typedef typename CT::Face_handle           Face_handle;
-    typedef typename CT::Vertex_handle         CTVertex_handle;
-    typedef typename CT::Finite_faces_iterator Finite_face_iterator;
-    typedef typename CT::Edge                  Edge;
-
-    CT ct;
-    CGAL::Unique_hash_map<Face_handle, bool> visited;
-    CGAL::Unique_hash_map<CTVertex_handle, Vertex_const_handle> ctv2v;
-    Finite_face_iterator fi;
-    Plane_3 supporting_plane;
-
-  public:
-    Triangulation_handler2(Halffacet_const_handle f) : 
-      visited(false), supporting_plane(f->plane()) {
-
-      Halffacet_cycle_const_iterator fci;
-      for(fci=f->facet_cycles_begin(); fci!=f->facet_cycles_end(); ++fci) {
-	if(fci.is_shalfedge()) {
-          SHalfedge_around_facet_const_circulator sfc(fci), send(sfc);
-	  CGAL_For_all(sfc,send) {
-            CGAL_NEF_TRACEN("  insert point" << sfc->source()->source()->point());
-	    CTVertex_handle ctv = ct.insert(sfc->source()->source()->point());
-	    ctv2v[ctv] = sfc->source()->source();
-          }
-        }
-      }
-
-      for(fci=f->facet_cycles_begin(); fci!=f->facet_cycles_end(); ++fci) {
-	if(fci.is_shalfedge()) {
-          SHalfedge_around_facet_const_circulator sfc(fci), send(sfc);
-	  CGAL_For_all(sfc,send) {
-            CGAL_NEF_TRACEN("  insert constraint" << sfc->source()->source()->point()
-	                     << "->" << sfc->source()->twin()->source()->point());
-	    ct.insert_constraint(sfc->source()->source()->point(),
-	                         sfc->source()->twin()->source()->point());
-          }
-        }
-      }
-      CGAL_assertion(ct.is_valid());
-
-      CGAL_NEF_TRACEN("number of finite triangles " << ct.number_of_faces());
-
-      typename CT::Face_handle infinite = ct.infinite_face();
-      typename CT::Vertex_handle ctv = infinite->vertex(1);
-      if(ct.is_infinite(ctv)) ctv = infinite->vertex(2);
-      CGAL_assertion(!ct.is_infinite(ctv));
-
-      typename CT::Face_handle opposite;
-      typename CT::Face_circulator vc(ctv,infinite);
-      do { opposite = vc++;
-      } while(!ct.is_constrained(typename CT::Edge(vc,vc->index(opposite))));
-      typename CT::Face_handle first = vc;
-
-      CGAL_assertion(!ct.is_infinite(first));
-      traverse_triangulation(first, first->index(opposite));
-
-      fi = ct.finite_faces_begin();
-    }
-
-    void traverse_triangulation(Face_handle f, int parent) {
-      visited[f] = true;
-      if(!ct.is_constrained(Edge(f,ct.cw(parent))) && !visited[f->neighbor(ct.cw(parent))]) {
-	Face_handle child(f->neighbor(ct.cw(parent)));
-	traverse_triangulation(child, child->index(f));
-      } 
-      if(!ct.is_constrained(Edge(f,ct.ccw(parent))) && !visited[f->neighbor(ct.ccw(parent))]) {
-	Face_handle child(f->neighbor(ct.ccw(parent)));
-	traverse_triangulation(child, child->index(f));
-      } 
-    } 
- 
-    template<typename Triangle_3>
-    bool get_next_triangle(Triangle_3& tr) {
-      while(fi != ct.finite_faces_end() && visited[fi] == false) ++fi;
-      if(fi == ct.finite_faces_end()) return false;
-      tr = Triangle_3(fi->vertex(0)->point(), fi->vertex(1)->point(), fi->vertex(2)->point());
-      ++fi;
-      return true;
-    }
-
-    bool same_orientation(Plane_3 p1) const {
-      if(p1.a() != 0)
-	return CGAL::sign(p1.a()) == CGAL::sign(supporting_plane.a());
-      if(p1.b() != 0)
-	return CGAL::sign(p1.b()) == CGAL::sign(supporting_plane.b());
-      return CGAL::sign(p1.c()) == CGAL::sign(supporting_plane.c());
-    }
-
-    template<typename PIB, typename Index>
-    void handle_triangles(PIB& pib, Index& VI) {
-      while(fi != ct.finite_faces_end() && visited[fi] == false) ++fi;
-      while(fi != ct.finite_faces_end()) {
-	Plane_3 plane(fi->vertex(0)->point(),
-		      fi->vertex(1)->point(),
-		      fi->vertex(2)->point());
-	pib.begin_facet();
-	if(same_orientation(plane)) {
-	  pib.add_vertex_to_facet(VI[ctv2v[fi->vertex(0)]]);
-	  pib.add_vertex_to_facet(VI[ctv2v[fi->vertex(1)]]);
-	  pib.add_vertex_to_facet(VI[ctv2v[fi->vertex(2)]]);
-	} else {
-	  pib.add_vertex_to_facet(VI[ctv2v[fi->vertex(0)]]);
-	  pib.add_vertex_to_facet(VI[ctv2v[fi->vertex(2)]]);
-	  pib.add_vertex_to_facet(VI[ctv2v[fi->vertex(1)]]);
-	}
-	pib.end_facet();
-	do {
-	  ++fi;
-	} while(fi != ct.finite_faces_end() && visited[fi] == false);
-      }
-    }
-  };
- 
-  template <class HDS>
-  class Build_polyhedron : public CGAL::Modifier_base<HDS> {
-    
-    class Visitor {
-
-      typedef typename CGAL::Projection_traits_xy_3<Kernel>       XY;
-      typedef typename CGAL::Projection_traits_yz_3<Kernel>       YZ;
-      typedef typename CGAL::Projection_traits_xz_3<Kernel>       XZ;
-
-      const Object_index<Vertex_const_iterator>& VI;
-      Polyhedron_incremental_builder_3<HDS>& B;
-      const SNC_const_decorator& D;
-      
-    public:
-      Visitor(Polyhedron_incremental_builder_3<HDS>& BB,
-	      const SNC_const_decorator& sd,
-	      Object_index<Vertex_const_iterator>& vi) : VI(vi), B(BB), D(sd){}
-
-      void visit(Halffacet_const_handle opposite_facet) {
-
-	CGAL_NEF_TRACEN("Build_polyhedron: visit facet " << opposite_facet->plane());
- 
-	CGAL_assertion(Infi_box::is_standard(opposite_facet->plane()));
-	
-	SHalfedge_const_handle se;
-	Halffacet_cycle_const_iterator fc;
-     	
-	Halffacet_const_handle f = opposite_facet->twin();
-
-	SHalfedge_around_facet_const_circulator 
-	  sfc1(f->facet_cycles_begin()), sfc2(sfc1);
-	
-	if(++f->facet_cycles_begin() != f->facet_cycles_end() ||
-	   ++(++(++sfc1)) != sfc2) {
-	  Vector_3 orth = f->plane().orthogonal_vector();
-	  int c = CGAL::abs(orth[0]) > CGAL::abs(orth[1]) ? 0 : 1;
-	  c = CGAL::abs(orth[2]) > CGAL::abs(orth[c]) ? 2 : c;
-	  
-	  if(c == 0) {
-	    Triangulation_handler2<YZ> th(f);
-	    th.handle_triangles(B, VI);
-	  } else if(c == 1) {
-	    Triangulation_handler2<XZ> th(f);
-	    th.handle_triangles(B, VI);
-	  } else if(c == 2) {
-	    Triangulation_handler2<XY> th(f);
-	    th.handle_triangles(B, VI);
-	  } else
-	    CGAL_error_msg( "wrong value");
-
-	} else {
-
-	  B.begin_facet();
-	  fc = f->facet_cycles_begin();
-	  se = SHalfedge_const_handle(fc);
-	  CGAL_assertion(se!=0);
-	  SHalfedge_around_facet_const_circulator hc_start(se);
-	  SHalfedge_around_facet_const_circulator hc_end(hc_start);
-	  CGAL_For_all(hc_start,hc_end) {
-	    CGAL_NEF_TRACEN("   add vertex " << hc_start->source()->center_vertex()->point());
-	    B.add_vertex_to_facet(VI[hc_start->source()->center_vertex()]);
-	  }
-	  B.end_facet();
-	}
-      }
-
-      void visit(SFace_const_handle) {}
-      void visit(Halfedge_const_handle) {}
-      void visit(Vertex_const_handle) {}
-      void visit(SHalfedge_const_handle) {}
-      void visit(SHalfloop_const_handle) {}
-    };
-
-  public:
-
-    const SNC_const_decorator& scd;
-    Object_index<Vertex_const_iterator> VI;
-
-    Build_polyhedron(const SNC_const_decorator& s) : 
-      scd(s), VI(s.vertices_begin(),s.vertices_end(),'V') {}
-    
-    void operator()( HDS& hds) {
-
-      Polyhedron_incremental_builder_3<HDS> B(hds, true);
-
-      int skip_volumes;
-      if(Infi_box::extended_kernel()) {
-	B.begin_surface(scd.number_of_vertices()-8, 
-			scd.number_of_facets()-6,
-			scd.number_of_edges()-12);
-	skip_volumes = 2;
-      }
-      else {
-	B.begin_surface(scd.number_of_vertices(), 
-			2*scd.number_of_vertices()-4,
-			3*scd.number_of_vertices()-6);
-	skip_volumes = 1;
-      }
-      
-      int vertex_index = 0;
-      Vertex_const_iterator v;
-      CGAL_forall_vertices(v,scd) {
-	if(Infi_box::is_standard(v->point())) {
-	  VI[v]=vertex_index++;
-	  B.add_vertex(v->point());
-	}
-      }     
-      
-      Visitor V(B,scd,VI);
-      Volume_const_handle c;
-      CGAL_forall_volumes(c,scd)
-	if(skip_volumes-- <= 0)
-	  scd.visit_shell_objects(SFace_const_handle(c->shells_begin()),V);
-      B.end_surface();
-      if ( B.error() ) B.rollback();
-    }
-
-  };
-
-  template <class HDS>
-  class Build_polyhedron2 : public CGAL::Modifier_base<HDS> {
-    
-    class Find_holes {
-
-      Unique_hash_map<Vertex_const_handle, bool>& omit_vertex;
-      int nov, nof;
-
-    public:
-      Find_holes(Unique_hash_map<Vertex_const_handle, bool>& omit_vertex_) 
-	: omit_vertex(omit_vertex_), nov(0), nof(0) {}
-
-      void visit(Halffacet_const_handle f) {
-	++nof;
-	Halffacet_cycle_const_iterator fc = f->facet_cycles_begin();
-	for(++fc; fc != f->facet_cycles_end(); ++fc) {
-	  if(fc.is_shalfedge()) {
-	    --nof;
-	    SHalfedge_around_facet_const_circulator 
-	      sfc(fc), send(sfc);
-	    CGAL_For_all(sfc, send) {
-	      omit_vertex[sfc->source()->source()] = true;
-	      --nov;
-	    }
-	  } else if(fc.is_shalfloop()) {
-	    SHalfloop_const_handle sl(fc);
-	    omit_vertex[sl->incident_sface()->center_vertex()];
-	    --nov;
-	  } else
-	    CGAL_error_msg( "wrong handle type");
-	}
-      }
-
-      void visit(Vertex_const_handle) { ++nov; }
-      void visit(SFace_const_handle) {}
-      void visit(Halfedge_const_handle) {}
-      void visit(SHalfedge_const_handle) {}
-      void visit(SHalfloop_const_handle) {}
-
-      int number_of_vertices() const {
-	return nov;
-      }
-
-      int number_of_facets() const {
-	return nof;
-      }
-    };
-
-    class Add_vertices {
-      
-      Polyhedron_incremental_builder_3<HDS>& B;
-      Unique_hash_map<Vertex_const_handle, bool>& omit_vertex;
-      Object_index<Vertex_const_iterator>& VI;      
-      int vertex_index;
-
-    public:
-      Add_vertices(Polyhedron_incremental_builder_3<HDS>& B_,
-		   Unique_hash_map<Vertex_const_handle, bool>& omit_vertex_,
-		   Object_index<Vertex_const_iterator>& VI_) 
-	: B(B_), omit_vertex(omit_vertex_), VI(VI_), vertex_index(0) {}
-	
-      void visit(Vertex_const_handle v) {
-	if(omit_vertex[v]) return;
-	VI[v]=vertex_index++;
-	B.add_vertex(v->point());
-      }
-
-      void visit(Halffacet_const_handle) {}
-      void visit(SFace_const_handle) {}
-      void visit(Halfedge_const_handle) {}
-      void visit(SHalfedge_const_handle) {}
-      void visit(SHalfloop_const_handle) {}
-
-    };
-
-    class Visitor {
-
-      const Object_index<Vertex_const_iterator>& VI;
-      Polyhedron_incremental_builder_3<HDS>& B;
-      const Unique_hash_map<Vertex_const_handle, bool>& omit_vertex;
-      SNC_const_decorator& D;
-      
-    public:
-      Visitor(Polyhedron_incremental_builder_3<HDS>& BB,
-	      const Unique_hash_map<Vertex_const_handle, bool>& omit_vertex_,
-	      SNC_const_decorator& sd,
-	      Object_index<Vertex_const_iterator>& vi) 
-	: VI(vi), B(BB), omit_vertex(omit_vertex_), D(sd){}
-
-      void visit(Halffacet_const_handle opposite_facet) {
-
-	CGAL_NEF_TRACEN("Build_polyhedron: visit facet " << opposite_facet->plane());
- 
-	CGAL_assertion(Infi_box::is_standard(opposite_facet->plane()));
-	
-	SHalfedge_const_handle se;
-	Halffacet_cycle_const_iterator fc;
-     	
-	Halffacet_const_handle f = opposite_facet->twin();
-
-	fc = f->facet_cycles_begin();
-	se = SHalfedge_const_handle(fc);
-	CGAL_assertion(se!=0);
-	if(omit_vertex[se->source()->source()]) return;
-	B.begin_facet();
-	SHalfedge_around_facet_const_circulator hc_start(se);
-	SHalfedge_around_facet_const_circulator hc_end(hc_start);
-	CGAL_For_all(hc_start,hc_end) {
-	  CGAL_NEF_TRACEN("   add vertex " << hc_start->source()->center_vertex()->point());
-	  B.add_vertex_to_facet(VI[hc_start->source()->center_vertex()]);
-	}
-	B.end_facet();
-      }
-
-      void visit(SFace_const_handle) {}
-      void visit(Halfedge_const_handle) {}
-      void visit(Vertex_const_handle) {}
-      void visit(SHalfedge_const_handle) {}
-      void visit(SHalfloop_const_handle) {}
-    };
-
-  public:
-
-    SFace_const_handle sf;
-    SNC_const_decorator& scd;
-    Object_index<Vertex_const_iterator> VI;
-    Unique_hash_map<Vertex_const_handle, bool> omit_vertex;
-
-    Build_polyhedron2(SFace_const_handle sf_, SNC_const_decorator& s) : 
-      sf(sf_), scd(s), VI(s.vertices_begin(),s.vertices_end(),'V'), 
-      omit_vertex(false) {}
-    
-      void operator()(HDS& hds) {
-
-      Polyhedron_incremental_builder_3<HDS> B(hds, true);
-      
-      Find_holes F(omit_vertex);
-      scd.visit_shell_objects(sf, F);
-
-      B.begin_surface(F.number_of_vertices(), 
-		      F.number_of_facets(),
-		      F.number_of_vertices()+F.number_of_facets()-2);
-
-      Add_vertices A(B,omit_vertex, VI);
-      scd.visit_shell_objects(sf, A);
-
-      Visitor V(B,omit_vertex, scd,VI);
-      scd.visit_shell_objects(sf, V);
-      B.end_surface();
-      if ( B.error() ) B.rollback();
-    }
-
-  };
-
-
- public:
- void delegate( Modifier_base<SNC_structure>& modifier, 
-		bool compute_external = false, 
-		bool do_simplify = true) {
-
-   // calls the `operator()' of the `modifier'. Precondition: The
-   // `modifier' returns a consistent representation.
-   if( this->is_shared()) clone_rep();
-   modifier(snc());
-   if(compute_external) {
-     SNC_external_structure es(snc());
-     es.clear_external_structure();
-     
-     build_external_structure();
-   }
-   if(do_simplify)
-     simplify();
-   CGAL_expensive_postcondition( is_valid());
- }
-
- struct SNC_and_PL {
-   SNC_structure* sncp;
-   SNC_point_locator* pl;
-
-   SNC_and_PL(SNC_structure* s, SNC_point_locator* p) : sncp(s), pl(p) {}
- };
-
- void delegate( Modifier_base<SNC_and_PL>& modifier, 
-		bool compute_external = false,
-		bool do_simplify = false) {
-   // calls the `operator()' of the `modifier'. Precondition: The
-   // `modifier' returns a consistent representation.
-   if( this->is_shared()) clone_rep();
-   SNC_and_PL sncpl(&snc(),pl());
-   modifier(sncpl);
-   pl() = sncpl.pl;
-   if(compute_external) {
-     SNC_external_structure es(snc());
-     es.clear_external_structure();
-     build_external_structure();
-   }
-   if(do_simplify)
-     simplify();
-   CGAL_expensive_postcondition( is_valid());
- }
- 
- public:
-
- template<typename Polyhedron>
- void convert_to_Polyhedron(Polyhedron& P) const {
-   convert_to_polyhedron(P);
- }
-
- template<typename Polyhedron>
- void convert_to_polyhedron(Polyhedron& P) const {
-   typedef typename Polyhedron::HalfedgeDS HalfedgeDS;
-   CGAL_precondition(is_simple());
-   P.clear();
-   Build_polyhedron<HalfedgeDS> bp(*this);    
-   P.delegate(bp);
- }
-
- template<typename Polyhedron>
- void convert_inner_shell_to_polyhedron(SFace_const_iterator sf, Polyhedron& P) {
-   typedef typename Polyhedron::HalfedgeDS HalfedgeDS;
-   P.clear();
-   Build_polyhedron2<HalfedgeDS> bp(sf, *this);
-   P.delegate(bp);
- }
-
-  bool is_valid( bool verb = false, int level = 0) {
-    // checks the combinatorial consistency.
-    Verbose_ostream verr(verb);
-    verr << "begin CGAL::Nef_polyhedron_3<...>::is_valid( verb=true, "
-      "level = " << level << "):" << std::endl;
-
-    SNC_decorator D(snc());
-    bool valid = D.is_valid(verb, level);
-    verr << "end of CGAL::Nef_polyhedron_3<...>::is_valid(): structure is "
-	 << ( valid ? "valid." : "NOT VALID.") << std::endl;
-    return valid;
-  }
-
-  bool is_simple() const {
-
-    Halfedge_const_iterator e;
-    CGAL_forall_edges(e,snc())
-      if(!is_edge_2manifold(e))
-	return false;
-
-    CGAL_NEF_TRACEN("there is no edge with non-manifold situation");
-
-    Vertex_const_iterator v;
-    CGAL_forall_vertices(v,snc())
-      if(!is_vertex_2manifold(v))
-	return false;
-
-    CGAL_NEF_TRACEN("there is no vertex with non-manifold situation");
-/*
-    Halffacet_iterator f;
-    CGAL_forall_halffacets(f,snc())
-      if(!is_facet_simple(f))
-	return false;
-
-    CGAL_NEF_TRACEN("there are no holes");
-*/
-    return true;
-  }
- 
- bool is_convex() const {
-   
-   Vertex_const_iterator v;
-   CGAL_forall_vertices(v, *this) {
-
-     SM_const_decorator SD(&*v);
-     if(std::distance(SD.sfaces_begin(),SD.sfaces_end())!=2)
-       return false;
-
-     if(!Infi_box::is_standard(v->point())) continue;
-
-     SFace_const_iterator sf;
-     CGAL_forall_sfaces(sf,SD) {
-       if(sf->volume() == Infi_box::getNirvana(snc())) continue;
-       if(std::distance(sf->sface_cycles_begin(),sf->sface_cycles_end())!=1)
-	 return false;
-       SFace_cycle_const_iterator sfi(sf->sface_cycles_begin());
-       if(!sfi.is_shalfedge())
-	 return false;
-       SHalfedge_const_handle se(sf->sface_cycles_begin());
-       SHalfedge_around_sface_const_circulator sec(se),send(sec);
-       CGAL_For_all(sec,send)
-	 if(spherical_orientation(sec->source()->point(),
-				  sec->snext()->source()->point(),
-				  sec->snext()->snext()->source()->point())<0) {
-	   std::cerr << "vertex at " << v->point() << " is not convex" << std::endl;
-	   return false;
-	 }
-     }
-   }
-   return true;
- }
-
- private:  
-  bool is_edge_2manifold(const Halfedge_const_handle& e) const {
-
-    SM_decorator SD;
-    SHalfedge_around_svertex_const_circulator c(SD.first_out_edge(e)), c2(c);
-
-    if(c == 0) {
-      CGAL_assertion(circulator_size(c) !=2);
-      return false;
-    }
-
-    if(++c == c2){
-      CGAL_assertion(circulator_size(c) !=2);
-      return false;
-    }
-
-    if(++c != c2) { 
-      CGAL_assertion(circulator_size(c) !=2);
-      return false;
-    }
-    
-    CGAL_assertion(circulator_size(c) == 2);
-    return true;
-  }
- 
-  bool is_vertex_2manifold(const Vertex_const_handle& v) const {
-     
-    SFace_const_iterator sfi(v->sfaces_begin());
-    if (++sfi != v->sfaces_last())
-      return false;
-
-    return true;
-  }
-
-  bool is_facet_simple(const Halffacet_const_handle& f) const {
-    
-    bool found_first = false;
-    Halffacet_cycle_const_iterator it; 
-    CGAL_forall_facet_cycles_of(it,f)
-      if (found_first || !it.is_shalfedge())
-	return false;
-      else
-	found_first = true;
-   
-    return true;
-  }
-
- public:
-#ifdef CGAL_NEF3_OLD_VISUALIZATION   
-  void visualize() { 
-    Visualizor sncv(*this);
-    sncv.draw();
-    //OGL::polyhedra_.back().debug();
-    OLDOGL::start_viewer();
-  }
-#endif // CGAL_NEF3_OLD_VISUALIZATION   
-   
-  void clear(Content space = EMPTY)
-    { *this = Nef_polyhedron_3(space); }
-  /*{\Mop makes |\Mvar| the empty set if |space == EMPTY| and the
-  full space if |space == COMPLETE|.}*/
-
- bool is_empty() const {
-   /*{\Mop returns true if |\Mvar| is empty, false otherwise.}*/
-   if(Infi_box::extended_kernel()) 
-     return this->number_of_vertices() == 8 &&
-            this->number_of_edges() == 12 &&
-            this->number_of_facets() == 6 &&
-            this->number_of_volumes() == 2 &&
-            (++this->volumes_begin())->mark() == false;
-
-   else 
-     return this->number_of_vertices() == 0 &&
-            this->number_of_edges() == 0 &&
-            this->number_of_facets() == 0 &&
-            this->number_of_volumes() == 1 &&
-            (this->volumes_begin())->mark() == false;
-  }
-
- bool is_space() const {
-  /*{\Mop returns true if |\Mvar| is the whole space, false otherwise.}*/
-   if(Infi_box::extended_kernel()) 
-     return this->number_of_vertices() == 8 &&
-            this->number_of_edges() == 12 &&
-            this->number_of_facets() == 6 &&
-            this->number_of_volumes() == 2 &&
-            (++this->volumes_begin())->mark() == true;
-
-   else 
-     return this->number_of_vertices() == 0 &&
-            this->number_of_edges() == 0 &&
-            this->number_of_facets() == 0 &&
-            this->number_of_volumes() == 1 &&
-            (this->volumes_begin())->mark() == true;
-  }
-
-  /*{\Xtext \headerline{Destructive Operations}}*/
-
- protected:
-  void clone_rep() { *this = Nef_polyhedron_3<Kernel,Items, Mark>(snc(), pl()); }
-  void empty_rep() { 
-    SNC_structure rsnc;
-    delete pl();
-    *this = Nef_polyhedron_3<Kernel,Items, Mark>(rsnc, new SNC_point_locator_default,false);
-  }
-
- public:
-  Nef_polyhedron_3( const SNC_structure& W, 
-		    SNC_point_locator* _pl = new SNC_point_locator_default,
-		    bool clone_pl = true,
-		    bool clone_snc = true);
-  /*{\Xcreate makes |\Mvar| a new object.  If |cloneit==true| then the
-  underlying structure of |W| is copied into |\Mvar|.}*/
-  // TODO: granados: define behavior when clone=false
-
-  /*{\Moperations 4 3 }*/
-
-  void simplify() {
-    SNC_simplify simp(snc());
-    bool simplified = simp.simplify();
-    CGAL_NEF_TRACEN( "simplify(): structure simplified? "<<simplified);
-    
-    if( simplified) {
-#ifdef CGAL_NEF3_UPDATE_K3TREE_AFTER_SIMPLIFICATION
-      /*debug*/ snc().print_statistics();
-      Unique_hash_map<Vertex_handle, bool> 
-	V(false, snc().number_of_vertices());
-      Unique_hash_map<Halfedge_handle, bool> 
-	E(false, snc().number_of_halfedges());
-      Unique_hash_map<Halffacet_handle, bool> 
-	F(false, snc().number_of_halffacets());
-      Vertex_iterator v;
-      Halfedge_iterator e;
-      Halffacet_iterator f;
-      CGAL_forall_vertices( v, snc()) V[Vertex_handle(v)] = true;
-      CGAL_forall_halfedges( e, snc()) E[Halfedge_handle(e)] = true;
-      CGAL_forall_halffacets( f, snc()) F[Halffacet_handle(f)] = true;
-      bool updated = pl()->update( V, E, F);
-      CGAL_NEF_TRACEN("simplify(): point locator structure updated? " << updated);
-#else
-      SNC_point_locator* old_pl = pl();
-      pl() = pl()->clone();
-      pl()->initialize(&snc());
-      delete old_pl;
-#endif
-    }
-  }
-
- public:
-  Nef_polyhedron_S2 get_sphere_map(Vertex_const_handle v) const {
-    return Nef_polyhedron_S2(*v);
-  }
-
-  void extract_complement();
-  /*{\Xop converts |\Mvar| to its complement. }*/
-  void extract_interior();
-  /*{\Xop converts |\Mvar| to its interior. }*/
-  void extract_boundary();
-  /*{\Xop converts |\Mvar| to its boundary. }*/
-
-  void extract_closure()
-  /*{\Xop converts |\Mvar| to its closure. }*/
-  { CGAL_NEF_TRACEN("extract closure");
-    if( this->is_shared()) clone_rep();
-    extract_complement();
-    extract_interior();
-    extract_complement();
-  }
-
-  void extract_regularization()
-  /*{\Xop converts |\Mvar| to its regularization. }*/
-  { CGAL_NEF_TRACEN("extract regularization");
-    if( this->is_shared()) clone_rep();
-    extract_interior();
-    extract_closure();
-  }
-
-  /*{\Mtext \headerline{Constructive Operations}}*/
-
-  Nef_polyhedron_3<Kernel,Items, Mark> complement() const
-  /*{\Mop returns the complement of |\Mvar| in the plane. }*/
-  { Nef_polyhedron_3<Kernel,Items, Mark> res = *this;
-    res.extract_complement();
-    return res;
-  }
-
-  Nef_polyhedron_3<Kernel,Items, Mark> interior() const
-  /*{\Mop    returns the interior of |\Mvar|. }*/
-  { Nef_polyhedron_3<Kernel,Items, Mark> res = *this;
-    res.extract_interior();
-    return res;
-  }
-
-  Nef_polyhedron_3<Kernel,Items, Mark> closure() const
-  /*{\Mop returns the closure of |\Mvar|. }*/
-  { Nef_polyhedron_3<Kernel,Items, Mark> res = *this;
-    res.extract_closure();
-    return res;
-  }
-
-  Nef_polyhedron_3<Kernel,Items, Mark> boundary() const
-  /*{\Mop returns the boundary of |\Mvar|. }*/
-  { Nef_polyhedron_3<Kernel,Items, Mark> res = *this;
-    res.extract_boundary();
-    return res;
-  }
-
-  Nef_polyhedron_3<Kernel,Items, Mark> regularization() const
-  /*{\Mop    returns the regularized polyhedron (closure of 
-    the interior).}*/
-  { Nef_polyhedron_3<Kernel,Items, Mark> res = *this;
-    res.extract_regularization();
-    return res;
-  }
-
-  Nef_polyhedron_3<Kernel,Items, Mark>
-  intersection(const Nef_polyhedron_3<Kernel,Items, Mark>& N1) const
-    /*{\Mop returns |\Mvar| $\cap$ |N1|. }*/ {
-    CGAL_NEF_TRACEN(" intersection between nef3 "<<&*this<<" and "<<&N1);
-    AND _and;
-    SNC_structure rsnc;
-    Nef_polyhedron_3<Kernel,Items, Mark> res(rsnc, new SNC_point_locator_default, false);
-    Binary_operation bo( res.snc());
-    bo(res.pl(), snc(), pl(), N1.snc(), N1.pl(), _and);
-    return res;
-  }
-
-  Nef_polyhedron_3<Kernel,Items, Mark>
-   intersection(const Plane_3& plane, 
-		Intersection_mode im) const {
-    AND _and;
-    SNC_structure rsnc;
-    Nef_polyhedron_3<Kernel,Items, Mark> res(rsnc, new SNC_point_locator_default, false);
-    Combine_with_halfspace cwh(res.snc(), res.pl());
-    cwh.combine_with_halfspace(snc(), plane, _and, 
-							   static_cast<typename Combine_with_halfspace::Intersection_mode>(im));
-    return res;
-  }
-
-  Nef_polyhedron_3<Kernel,Items, Mark> 
-  join(const Nef_polyhedron_3<Kernel,Items, Mark>& N1) const
-  /*{\Mop returns |\Mvar| $\cup$ |N1|. }*/ { 
-    CGAL_NEF_TRACEN(" join between nef3 "<<&*this<<" and "<<&N1);
-    OR _or;
-    //CGAL::binop_intersection_tests_allpairs<SNC_decorator, OR> tests_impl;
-    SNC_structure rsnc;
-    Nef_polyhedron_3<Kernel,Items, Mark> res(rsnc, new SNC_point_locator_default, false);
-    Binary_operation bo(res.snc());
-    bo(res.pl(), snc(), pl(), N1.snc(), N1.pl(), _or);
-    return res;
-  }
-
-  Nef_polyhedron_3<Kernel,Items, Mark> 
-  difference(const Nef_polyhedron_3<Kernel,Items, Mark>& N1) const
-  /*{\Mop returns |\Mvar| $-$ |N1|. }*/ { 
-    CGAL_NEF_TRACEN(" difference between nef3 "<<&*this<<" and "<<&N1);
-    DIFF _diff;
-    //CGAL::binop_intersection_tests_allpairs<SNC_decorator, DIFF> tests_impl;
-    SNC_structure rsnc;
-    Nef_polyhedron_3<Kernel,Items, Mark> res(rsnc, new SNC_point_locator_default, false);
-    Binary_operation bo(res.snc());
-    bo(res.pl(), snc(), pl(), N1.snc(), N1.pl(), _diff);
-    return res;
-  }    
-
-  Nef_polyhedron_3<Kernel,Items, Mark> 
-  symmetric_difference(const Nef_polyhedron_3<Kernel,Items, Mark>& N1) const
-  /*{\Mop returns the symmectric difference |\Mvar - T| $\cup$ 
-          |T - \Mvar|. }*/ {
-    CGAL_NEF_TRACEN(" symmetic difference between nef3 "<<&*this<<" and "<<&N1);
-    XOR _xor;
-    //CGAL::binop_intersection_tests_allpairs<SNC_decorator, XOR> tests_impl;
-    SNC_structure rsnc;
-    Nef_polyhedron_3<Kernel,Items, Mark> res(rsnc, new SNC_point_locator_default, false);
-    Binary_operation bo(res.snc());
-    bo(res.pl(), snc(), pl(), N1.snc(), N1.pl(), _xor);
-    return res;
-  }
-
-
-  /*{\Mtext Additionally there are operators |*,+,-,^,!| which
-  implement the binary operations \emph{intersection}, \emph{union},
-  \emph{difference}, \emph{symmetric difference}, and the unary
-  operation \emph{complement}. There are also the corresponding
-  modification operations |*=,+=,-=,^=|.}*/
-
-  Nef_polyhedron_3<Kernel,Items, Mark>  operator*(const Nef_polyhedron_3<Kernel,Items, Mark>& N1) const 
-  { return intersection(N1); }
-
-  Nef_polyhedron_3<Kernel,Items, Mark>  operator+(const Nef_polyhedron_3<Kernel,Items, Mark>& N1) const
-  { return join(N1); }
-
-  Nef_polyhedron_3<Kernel,Items, Mark>  operator-(const Nef_polyhedron_3<Kernel,Items, Mark>& N1) const
-  { return difference(N1); }
-
-  Nef_polyhedron_3<Kernel,Items, Mark>  operator^(const Nef_polyhedron_3<Kernel,Items, Mark>& N1) const
-  { return symmetric_difference(N1); }
-
-  Nef_polyhedron_3<Kernel,Items, Mark>  operator!() const
-  { return complement(); }
-   
-  Nef_polyhedron_3<Kernel,Items, Mark>& operator*=(const Nef_polyhedron_3<Kernel,Items, Mark>& N1)
-  { 
-#ifdef CGAL_NEF_VISUAL_HULL
-    CGAL_NEF_SETDTHREAD(19*43*71);
-    std::cerr << "visual hull code " << std::endl;
-    std::cerr << *this << std::endl;
-    std::cerr << const_cast<Nef_polyhedron&>(N1) << std::endl;
-    AND _and;
-    typename CGAL::Modifying_binary_operation<SNC_structure> 
-      mbo(this->snc());
-    mbo(const_cast<SNC_structure&>(N1.snc()), N1.pl(), pl(), _and);
-    return *this;
-#else
-    *this = intersection(N1); return *this; 
-#endif
-  }
-
-  Nef_polyhedron_3<Kernel,Items, Mark>& operator+=(const Nef_polyhedron_3<Kernel,Items, Mark>& N1)
-  { *this = join(N1); return *this; }
-
-  Nef_polyhedron_3<Kernel,Items, Mark>& operator-=(const Nef_polyhedron_3<Kernel,Items, Mark>& N1)
-  { *this = difference(N1); return *this; }
-
-  Nef_polyhedron_3<Kernel,Items, Mark>& operator^=(const Nef_polyhedron_3<Kernel,Items, Mark>& N1)
-  { *this = symmetric_difference(N1); return *this; }
-
-  /*{\Mtext There are also comparison operations like |<,<=,>,>=,==,!=|
-  which implement the relations subset, subset or equal, superset, superset
-  or equal, equality, inequality.}*/
-
-  bool operator==(const Nef_polyhedron_3<Kernel,Items, Mark>& N1) const
-  { CGAL_NEF_TRACEN(" equality comparision between nef3 "<<&*this<<" and "<<&N1);
-    return symmetric_difference(N1).is_empty(); }
-
-  bool operator!=(const Nef_polyhedron_3<Kernel,Items, Mark>& N1) const
-  { CGAL_NEF_TRACEN(" inequality comparision between nef3 "<<&*this<<" and "<<&N1);
-    return !operator==(N1); }  
-
-  bool operator<(const Nef_polyhedron_3<Kernel,Items, Mark>& N1) const
-  { return !N1.difference(*this).is_empty() && difference(N1).is_empty(); } 
-
-  bool operator>(const Nef_polyhedron_3<Kernel,Items, Mark>& N1) const
-  { return difference(*this).is_empty() && !difference(N1).is_empty(); } 
-
-  bool operator<=(const Nef_polyhedron_3<Kernel,Items, Mark>& N1) const
-  { return difference(N1).is_empty(); } 
-
-  bool operator>=(const Nef_polyhedron_3<Kernel,Items, Mark>& N1) const
-  { return N1.difference(*this).is_empty(); } 
-
-
- bool is_90degree_rotation(const Aff_transformation_3& aff) const {
-   if(aff.hm(0,3) != 0) return false;
-   if(aff.hm(1,3) != 0) return false;
-   if(aff.hm(2,3) != 0) return false;
-   if(CGAL_NTS abs(aff.hm(0,0)) + 
-      CGAL_NTS abs(aff.hm(0,1)) + 
-      CGAL_NTS abs(aff.hm(0,2)) != aff.hm(3,3)) return false;
-   if(CGAL_NTS abs(aff.hm(1,0)) + 
-      CGAL_NTS abs(aff.hm(1,1)) + 
-      CGAL_NTS abs(aff.hm(1,2)) != aff.hm(3,3)) return false;
-   if(CGAL_NTS abs(aff.hm(2,0)) + 
-      CGAL_NTS abs(aff.hm(2,1)) + 
-      CGAL_NTS abs(aff.hm(2,2)) != aff.hm(3,3)) return false;
-   if(CGAL_NTS abs(aff.hm(0,0)) + 
-      CGAL_NTS abs(aff.hm(1,0)) + 
-      CGAL_NTS abs(aff.hm(2,0)) != aff.hm(3,3)) return false;
-   if(CGAL_NTS abs(aff.hm(0,1)) + 
-      CGAL_NTS abs(aff.hm(1,1)) + 
-      CGAL_NTS abs(aff.hm(2,1)) != aff.hm(3,3)) return false;
-   if(CGAL_NTS abs(aff.hm(0,2)) + 
-      CGAL_NTS abs(aff.hm(1,2)) + 
-      CGAL_NTS abs(aff.hm(2,2)) != aff.hm(3,3)) return false;
-   return true;
- }
-
- bool is_scaling(const Aff_transformation_3& aff) const {
-   if(aff.hm(0,3) != 0) return false;
-   if(aff.hm(1,3) != 0) return false;
-   if(aff.hm(2,3) != 0) return false;   
-   if(aff.hm(0,1) != 0) return false;
-   if(aff.hm(0,2) != 0) return false;
-   if(aff.hm(1,0) != 0) return false;   
-   if(aff.hm(1,2) != 0) return false;
-   if(aff.hm(2,0) != 0) return false;
-   if(aff.hm(2,1) != 0) return false;
-   if(aff.hm(0,0) != aff.hm(1,1)) return false;
-   if(aff.hm(0,0) != aff.hm(2,2)) return false;
-   return true;
- }
-
- void change_orientation(bool full = false) {
-
-   Halffacet_handle ftemp;
-   Volume_handle vtemp;
-   SVertex_handle svtemp;
-   SHalfedge_handle setemp;
-   SFace_handle sftemp;
-
-   SVertex_iterator sv;
-   CGAL_forall_svertices(sv, snc()) {
-     sv->out_sedge() = sv->out_sedge()->twin();
-   }
-
-   SHalfedge_iterator se;
-   CGAL_forall_shalfedges(se, snc()) {
-     if(se->is_twin()) {
-       svtemp = se->source();
-       se->source() = se->twin()->source();
-       se->twin()->source() = svtemp;
-
-       if(full) {
-	 ftemp = se->facet();
-	 se->facet() = se->twin()->facet();
-	 se->twin()->facet() = ftemp;
-       }
-       //       sftemp = se->incident_sface();
-       //       se->incident_sface() = se->twin()->incident_sface();
-       //       se->twin()->incident_sface() = sftemp;
-     }
-       
-     setemp = se->sprev();
-     se->sprev() = se->snext();
-     se->snext() = setemp;
-
-     se->circle() = se->circle().opposite();
-
-     if(full) {
-       setemp = se->prev();
-       se->prev() = se->next();
-       se->next() = setemp;
-     }
-   }
-
-   if(full) {
-     Halffacet_iterator f;
-     CGAL_forall_facets(f, snc()) {
-       vtemp  = f->incident_volume();
-       f->incident_volume() = f->twin()->incident_volume();
-       f->twin()->incident_volume() = vtemp;
-       Halffacet_cycle_iterator fc(f->facet_cycles_begin()),
-	 fct(f->twin()->facet_cycles_begin());
-       while(fc!=f->facet_cycles_end()) {
-	 CGAL_assertion(fct!=f->twin()->facet_cycles_end());
-	 if(fc.is_shalfedge()) {
-	   CGAL_assertion(fct.is_shalfedge());
-	   setemp = fc;
-	   *fc = *fct;
-	   *fct = make_object(setemp);
-	 }
-	 ++fc;
-	 ++fct;
-       }
-     }
-   
-     CGAL_forall_halffacets(f, snc()) {
-       Halffacet_cycle_iterator fc(f->facet_cycles_begin());
-       for(;fc!=f->facet_cycles_end();++fc) {
-	 if(fc.is_shalfedge()) {
-	   setemp = fc;
-	   SHalfedge_around_facet_circulator hfc(setemp),hend(hfc);
-	   ++hfc;
-	   CGAL_For_all(hfc,hend) {
-	     if ( CGAL::lexicographically_xyz_smaller(hfc->source()->source()->point(),
-						      setemp->source()->source()->point()))
-	       setemp = hfc;
-	   }
-	   *fc = make_object(setemp);
-	 }
-       }
-     }
-   }
- }
-
-  void transform( const Aff_transformation_3& aff) {
-    
-    if( this->is_shared())
-      clone_rep();
-    // only linear transform for the origin-centered sphere maps
-    Aff_transformation_3 linear( aff.hm(0,0), aff.hm(0,1), aff.hm(0,2),
-				 aff.hm(1,0), aff.hm(1,1), aff.hm(1,2),
-				 aff.hm(2,0), aff.hm(2,1), aff.hm(2,2),
-				 aff.hm(3,3));
-    
-    SNC_constructor cstr(snc());
-    
-    std::list<Vertex_handle> vertex_list;
-    std::list<Vertex_handle> corner_list;
-    std::list<Vertex_handle> delete_list;
-    typename std::list<Vertex_handle>::iterator li;
-    typename std::list<Vertex_handle>::iterator li2;
-
-    bool ninety = is_90degree_rotation(aff);
-    bool scale = is_scaling(aff);
-
-    Vertex_iterator vi;
-    CGAL_forall_vertices( vi, snc()) {
-      
-      CGAL_NEF_TRACEN("transform vertex ");
-      if(scale) {
-	if(is_standard(vi))
-	  vi->point() = vi->point().transform( aff);
-	else if(!Infi_box::is_infibox_corner(vi->point())) {
-	  vi->point() = normalized(Infi_box::normalize_transformed_vertex(vi->point().transform(aff)));
-	}
-      } else if (!is_standard(vi) && !ninety) {
-	if(Infi_box::is_infibox_corner(vi->point()))
-	  corner_list.push_back(vi);
-	vertex_list.push_back(vi);
-      } else {
-	vi->point() = vi->point().transform( aff);
-	SM_decorator sdeco(&*vi);
-	sdeco.transform( linear);
-      }
-    }
-
-    if(!this->is_bounded() && !ninety && !scale) {
-      Halffacet_iterator fi;
-      CGAL_forall_facets(fi, snc()) {
-	if(!is_standard(fi) || is_bounded(fi)) continue;
-	Plane_3 pt = fi->plane();
-	pt = pt.transform(aff);
-	std::list<Point_3> points(Infi_box::find_points_of_box_with_plane(cstr,pt));
-	std::list<Vertex_handle> newVertices;
-	newVertices = Infi_box::create_vertices_on_infibox(cstr,
-							   pt, points, fi->mark(), 
-							   fi->twin()->incident_volume()->mark(), 
-							   fi->incident_volume()->mark());
-
-	for(li = newVertices.begin(); li != newVertices.end(); ++li) {
-	  if(Infi_box::is_infibox_corner((*li)->point())) {
-	    li2 = corner_list.begin();
-	    while(li2 != corner_list.end() && (*li2)->point() != (*li)->point()) ++li2;
-	    CGAL_assertion(li2 != corner_list.end());
-	    delete_list.push_back(*li2);
-	    *li2 = *li;
-	  }
-	}
-      }
-      
-      for(li = vertex_list.begin(); li != vertex_list.end();++li) {
-	SM_decorator SD(&**li);
-	if(Infi_box::is_complex_facet_infibox_intersection(**li)) {
-	  Halffacet_handle hf[2];
-	  int i=0;
-	  SHalfedge_iterator sei;
-	  CGAL_forall_sedges(sei,SD) {
-	    if(!Infi_box::is_sedge_on_infibox(sei)) {
-	      hf[i] = sei->facet();
-	      if(hf[i]->is_twin()) hf[i] = hf[i]->twin();
-	      ++i;
-	    }
-	    if(i>1)
-	      break;
-	  }
-	}
-      }
-
-      Association A;
-      SNC_external_structure es(snc());
-      es.clear_external_structure();
-      for(li = vertex_list.begin(); li != vertex_list.end();++li){
-	if(Infi_box::is_complex_facet_infibox_intersection(**li)) {
-	  Vertex_handle v2;
-	  Vertex_handle v1 = cstr.create_for_infibox_overlay(*li);
-	  v1->point() = normalized(Infi_box::normalize_transformed_vertex((*li)->point().transform(aff)));
-	  SM_decorator sdeco(&*v1);
-	  sdeco.transform(linear);	    
-	  switch(Infi_box::type_of_infibox_point(v1->point())) {
-	  case 1: 
-	    v2 = cstr.create_from_point_on_infibox_facet(v1->point()); 
-	    break;
-	  case 2: 
-	    v2 = cstr.create_from_point_on_infibox_edge(v1->point());
-	    break;
-	  case 3: 
-	    v2 = cstr.create_from_point_on_infibox_vertex(v1->point());
-	    li2 = corner_list.begin();
-	    while(li2 != corner_list.end() && (*li2)->point() != v2->point()) ++li2;
-	    if(li2 != corner_list.end())
-	      delete_list.push_back(*li2);
-	    break;
-	  default: CGAL_error_msg( "wrong value");
-	  }
-	  Vertex_handle v = snc().new_vertex(v1->point(), (*li)->mark());
-	  SM_overlayer O(&*v);
-	  O.subdivide(&*v1, &*v2, A);
-	  AND _and;
-	  O.select(_and);
-	  O.simplify(A);
-	  snc().delete_vertex(v1);
-	  snc().delete_vertex(v2);
-	}
-	
-	if(Infi_box::is_infibox_corner((*li)->point())) {
-	  SM_decorator SD(&**li);
-	  if(SD.number_of_svertices() < 4)
-	    continue;
-	  li2 = corner_list.begin();
-	  while(li2 != corner_list.end() && (*li2)->point() != (*li)->point()) ++li2;
-	  CGAL_assertion(li2 != corner_list.end());
-	  if(*li == *li2) {
-	    delete_list.push_back(*li2);
-	    *li2 = cstr.create_from_point_on_infibox_vertex((*li)->point());
-	  }
-	} else 
-	  snc().delete_vertex(*li);	  
-      }
-
-      for(li = delete_list.begin(); li != delete_list.end(); ++li)
-	snc().delete_vertex(*li);
-
-      if(!aff.is_even())
-	change_orientation();
-
-      while(cstr.erase_redundant_vertices()) ;
-      cstr.correct_infibox_sedge_marks();
-
-      build_external_structure();
-      cstr.correct_infibox_sface_marks();
-
-      // are the upcoming lines necessary? 
-      SNC_point_locator* old_pl = pl();
-      pl() = pl()->clone();
-      pl()->initialize(&snc());
-      delete old_pl;   
-
-    } else {
-      Halffacet_iterator fi;
-      CGAL_forall_halffacets(fi,snc()) {
-	if(is_standard(fi) || ninety) {
-	  fi->plane() = fi->plane().transform( aff);
-#ifdef CGAL_NEF3_FACET_WITH_BOX 
-	  typedef typename Halffacet::Box Box;
-	  bool first = true;
-	  Halffacet_cycle_iterator cycle_it = fi->facet_cycles_begin();
-	  if( cycle_it.is_shalfedge() ) {
-	    SHalfedge_iterator edge_it(cycle_it);
-	    SHalfedge_around_facet_circulator
-	      start( edge_it ), end( edge_it );
-	    CGAL_For_all( start, end ) {
-	      const Point_3& p = start->source()->source()->point();
-	      typename Kernel::FT q[3];
-	      q[0] = p.x();
-	      q[1] = p.y();
-	      q[2] = p.z();
-	      if(first) {
-		fi->b = Box(q,q);
-		first = false;
-	      } else
-		fi->b.extend(q);
-	    }
-	  } else
-	    CGAL_error_msg( "is facet first cycle a SHalfloop?"); 
-#endif
-	}
-      }    
-
-      if(!aff.is_even())
-	change_orientation(true);
-
-      if(aff.homogeneous(0,1) != 0 ||
-	 aff.homogeneous(0,2) != 0 ||
-	 aff.homogeneous(1,0) != 0 ||
-	 aff.homogeneous(1,2) != 0 ||
-	 aff.homogeneous(2,0) != 0 ||
-	 aff.homogeneous(2,1) != 0 ||
-	 aff.homogeneous(0,0) != aff.homogeneous(1,1) ||
-	 aff.homogeneous(0,0) != aff.homogeneous(2,2) ||
-	 !this->is_bounded()) {
-	   SNC_point_locator* old_pl = pl();
-	   pl() = pl()->clone();
-	   pl()->initialize(&snc());
-	   delete old_pl;   
-	 }
-      else pl()->transform(aff); 
-    }
-
-    SNC_constructor C(snc());
-    C.assign_indices(); 
-  }
-  
-  /*{\Mtext \headerline{Exploration}
-  As Nef polyhedra are the result of forming complements 
-  and intersections starting from a set |H| of halfspaces which are
-  defined by oriented planes in three space. The corresponding 
-  structure is represented by an extended wuerzburg structure 
-  $W = (V,E,F,C)$. For topological queries within |W| the following 
-  types and operations allow exploration access to this structure.}*/
-
-  /*{\Mtypes 3}*/
-    
-    typedef CGAL::SNC_SM_explorer<SM_const_decorator>  SM_explorer;
-
-    SM_explorer SMexplorer(Vertex_const_handle v) const { 
-      SM_const_decorator SMCD(&*v);
-      return SM_explorer(SMCD); 
-    }
-
-  typedef typename SNC_structure::Object_list Object_list;
-  typedef typename SNC_structure::Object_handle Object_handle;
-  /*{\Mtypemember a generic handle to an object of the underlying
-  plane map. The kind of object |(vertex, halfedge, face)| can 
-  be determined and the object can be assigned to a corresponding
-  handle by the three functions:\\
-  |bool assign(Vertex_const_handle& h, Object_handle)|\\
-  |bool assign(Edge_const_handle& h, Object_handle)|\\
-  |bool assign(Facet_const_handle& h, Object_handle)|\\
-  |bool assign(Volume_const_handle& h, Object_handle)|\\
-  where each function returns |true| iff the assignment to
-  |h| was done.}*/
-
-  /*{\Moperations 3 1 }*/
-
-  bool contains(Object_handle /*h*/) const
-  /*{\Mop  returns true iff the object |h| is contained in the set
-  represented by |\Mvar|.}*/
-    // { SNC_point_locator PL(snc()); return PL.mark(h);} 
-    { CGAL_error_msg( "not implemented."); return false;}
-
-  bool contained_in_boundary(Object_handle h) const
-  /*{\Mop  returns true iff the object |h| is contained in the $2$-skeleton
-  of |\Mvar|.}*/
-  { Vertex_const_handle v;
-    Halfedge_const_handle e;
-    Halffacet_const_handle f;
-    return  ( assign(v,h) || assign(e,h) || assign(f,h) );
-  }
-
-  Object_handle locate(const Point_3& p) const
-  /*{\Mop  returns a generic handle |h| to an object (vertex, edge, facet,
-  volume) of the underlying SNC which contains the point |p| in its relative 
-  interior. The point |p| is contained in the set represented by |\Mvar| if 
-  |\Mvar.contains(h)| is true.}*/ {
-    CGAL_NEF_TRACEN( "locating point...");
-    CGAL_assertion( pl() != NULL);
-
-    Object_handle o = pl()->locate(p);
-    
-    Vertex_handle v;
-    Halfedge_handle e;
-    Halffacet_handle f;
-    Volume_handle c;
-    if(assign(v,o)) return make_object(Vertex_const_handle(v));
-    if(assign(e,o)) return make_object(Halfedge_const_handle(e));
-    if(assign(f,o)) return make_object(Halffacet_const_handle(f));
-    if(assign(c,o)) return make_object(Volume_const_handle(c));
-
-    return Object_handle();
-  }
-
-  /*{\Mimplementation Nef polyhedra are implemented on top of an
-  extended Wuerzburg structure data structure (EWS) and use linear
-  space in the number of vertices, edges and facets.  Operations like
-  empty take constant time. The operations clear, complement, interior,
-  closure, boundary, regularization, input and output take linear
-  time. All binary set operations and comparison operations take time
-  $O(N^2)$ where $N$ is the size of the output plus the size of the
-  input.
-
-  The point location operations run in linear query time without any 
-  preprocessing.}*/
-
-  /*{\Mexample Nef polyhedra are parameterized by a so called extended
-  geometric kernel. There's currently only one such kernel based on a
-  homogeneous representation of extended points called
-  |Extended_homogeneous<NT>|.  The kernel is parameterized by a
-  multiprecision integer type. The member types of |Nef_polyhedron_3<
-  Extended_homogeneous_3<NT> >| map to corresponding types of the CGAL
-  geometry kernel (e.g. |Nef_polyhedron::Plane_3| equals
-  |CGAL::Homogeneous<leda_integer>::Plane_3| in the example below).
-  \begin{Mverb}
-  #include <CGAL/basic.h>
-  #include <CGAL/leda_integer.h>
-  #include <CGAL/Extended_homogeneous.h>
-  #include <CGAL/Nef_polyhedron_3.h>
-
-  using namespace CGAL;
-  typedef  Extended_homogeneous<leda_integer>   Extended_kernel;
-  typedef  Nef_polyhedron_3<Extended_kernel>    Nef_polyhedron;
-  typedef  Nef_polyhedron::Plane_3              Plane_3;
-
-  int main()
-  {
-    Nef_polyhedron N1(Plane_3(1,0,0,0));
-    Nef_polyhedron N2(Plane_3(0,1,0,0), Nef_polyhedron::EXCLUDED);
-    Nef_polyhedron N3 = N1 * N2; // line (*)
-    return 0;
-  }
-  \end{Mverb}
-  After line (*) |N3| is the intersection of |N1| and |N2|.}*/
-
-  std::size_t bytes() {
-    // bytes used for the Nef_polyhedron_3.
-    return sizeof(Self) + (snc().bytes() - sizeof(SNC_structure));
-  }
-
-  std::size_t bytes_reduced() {
-    // bytes used for the Nef_polyhedron_3.
-    std::cout << sizeof(Self) + (snc().bytes_reduced2() - sizeof(SNC_structure)) << std::endl;
-    return sizeof(Self) + (snc().bytes_reduced() - sizeof(SNC_structure));
-  }
-
-}; // end of Nef_polyhedron_3
-
-template <typename Kernel, typename Items, typename Mark>
-Nef_polyhedron_3<Kernel,Items, Mark>::
-Nef_polyhedron_3( Content space) {
-  CGAL_NEF_TRACEN("construction from empty or space.");
-  empty_rep();
-  set_snc(snc());
-  if(Infi_box::extended_kernel()) {
-    initialize_infibox_vertices(space);
-    build_external_structure();
-  } else {
-    build_external_structure();
-    snc().volumes_begin()->mark() = (space == COMPLETE) ? 1 : 0;
-  }
-}
-
-template <typename Kernel, typename Items, typename Mark>
-Nef_polyhedron_3<Kernel,Items, Mark>::
-Nef_polyhedron_3(const Plane_3& h, Boundary b) {
-  CGAL_NEF_TRACEN("construction from plane "<<h);
-  empty_rep();
-  set_snc(snc());
-  SNC_constructor C(snc());
-  Infi_box::create_vertices_of_box_with_plane(C,h,(b==INCLUDED));
-  build_external_structure();
-  /*
-  if(Infi_box::extended_kernel()) {
-    SNC_structure snc1, snc2;
-    SNC_point_locator* pl1 = new SNC_point_locator_default; 
-    SNC_point_locator* pl2 = new SNC_point_locator_default; 
-
-    SNC_constructor c1(snc1); 
-    Infi_box::initialize_infibox_vertices(c1, true);
-    SNC_external_structure es1(snc1, pl1);
-    es1.build_external_structure();
-
-    SNC_constructor c2(snc2);
-    c2.create_vertices_for_halfspace(h, b);
-    SNC_external_structure es2(snc2, pl2);
-    es2.pair_up_halfedges();
-    es2.link_shalfedges_to_facet_cycles();
-    c2.create_facets_and_volumes_of_halfspace(h);
-    pl2->initialize(&snc2);
-
-    AND _and;
-    Binary_operation bo(snc());
-    bo(pl(), snc1, pl1, snc2, pl2, _and);
-    
-    delete pl1;
-    delete pl2;
-  } else
-    CGAL_error_msg
-      ("Constructor is only available with extended kernels");
-  */
-}
- 
-template <typename Kernel, typename Items, typename Mark>
-Nef_polyhedron_3<Kernel,Items, Mark>::
-Nef_polyhedron_3( const SNC_structure& W, SNC_point_locator* _pl, 
-		  bool clone_pl,
-		  bool clone_snc) {
-  CGAL_assertion( clone_snc == true || clone_pl == false);
-  // TODO: granados: define behavior when clone=false
-  //  CGAL_NEF_TRACEN("construction from an existing SNC structure (clone="<<clone<<")"); 
-
-  this->copy_on_write();
-  if(clone_snc) {
-    snc() = W;
-    set_snc(snc());
-  }
-  if(clone_pl) {
-    pl() = _pl->clone();
-    pl()->initialize(&snc());
-  } 
-  else
-    pl() = _pl;
-}
-
-template <typename Kernel, typename Items, typename Mark>
-void
-Nef_polyhedron_3<Kernel,Items, Mark>::
-extract_complement() {
-  CGAL_NEF_TRACEN("extract complement");
-  if( this->is_shared()) clone_rep();
-  SNC_decorator D(snc());
-  Vertex_iterator v;
-  CGAL_forall_vertices(v,D){
-    v->mark() = !v->mark(); 
-    SM_decorator SM(&*v);
-    SM.extract_complement();
-  }
-
-  Halffacet_iterator f;
-  CGAL_forall_halffacets(f,D) f->mark() = !f->mark(); 
- 
-  Volume_iterator c;
-  CGAL_forall_volumes(c,D) 
-    //    if(!(Infi_box::extended_kernel && c==D.volumes_begin()))
-      c->mark() = !c->mark();
-}
-
-template <typename Kernel, typename Items, typename Mark>
-void
-Nef_polyhedron_3<Kernel,Items, Mark>::
-extract_interior() {
-  CGAL_NEF_TRACEN("extract interior");
-  if (this->is_shared()) clone_rep();
-  SNC_decorator D(snc());
-  Vertex_iterator v;
-  CGAL_forall_vertices(v,D){
-    v->mark() = false;
-    SM_decorator SM(&*v);
-    SM.extract_interior();
-  }
-  Halffacet_iterator f;
-  CGAL_forall_halffacets(f,D) f->mark() = false;
-
-  simplify();
-}
-
-template <typename Kernel, typename Items, typename Mark>
-void
-Nef_polyhedron_3<Kernel,Items, Mark>::
-extract_boundary() {
-  CGAL_NEF_TRACEN("extract boundary");
-  if (this->is_shared()) clone_rep();
-  SNC_decorator D(snc());
-  Vertex_iterator v;
-  CGAL_forall_vertices(v,D) {
-    v->mark() = true;
-    SM_decorator SM(&*v);
-    SM.extract_boundary();
-  }
-  Halffacet_iterator f;
-  CGAL_forall_halffacets(f,D) f->mark() = true;
-  Volume_iterator c;
-  CGAL_forall_volumes(c,D) c->mark() = false;
-  simplify();
-}
-
-} //namespace CGAL
-
-#endif //CGAL_NEF_POLYHEDRON_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_polyhedron_S2.h b/3rdparty/CGAL-4.8/include/CGAL/Nef_polyhedron_S2.h
deleted file mode 100644
index 59a0e52..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Nef_polyhedron_S2.h
+++ /dev/null
@@ -1,735 +0,0 @@
-// Copyright (c) 1997-2000  Max-Planck-Institute Saarbruecken (Germany).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Michael Seel       <seel at mpi-sb.mpg.de>
-//                 Peter Hachenberger <hachenberger at mpi-sb.mpg.de>
-
-#ifndef CGAL_NEF_POLYHEDRON_S2_H
-#define CGAL_NEF_POLYHEDRON_S2_H
-
-#if defined(BOOST_MSVC)
-#  pragma warning(push)
-#  pragma warning(disable:4800) // complaint about performance in std::map where we can't do anything
-#endif
-
-#include <CGAL/basic.h>
-#include <CGAL/Handle_for.h>
-#include <CGAL/Nef_S2/SM_items.h>
-#include <CGAL/Nef_S2/Sphere_map.h>
-#include <CGAL/Nef_S2/SM_decorator.h>
-#include <CGAL/Nef_S2/SM_io_parser.h>
-#include <CGAL/Nef_S2/SM_point_locator.h>
-#include <CGAL/Nef_S2/SM_overlayer.h>
-#include <CGAL/Modifier_base.h>
-
-#include <vector>
-#include <list>
-
-#include <boost/random/linear_congruential.hpp>
-#include <boost/random/uniform_real.hpp>
-#include <boost/random/variate_generator.hpp>
-
-#undef CGAL_NEF_DEBUG
-#define CGAL_NEF_DEBUG 53
-#include <CGAL/Nef_2/debug.h>
-
-namespace CGAL {
-
-template <typename K, typename I, typename Mk, typename M> class Nef_polyhedron_S2;
-template <typename K, typename I, typename Mk, typename M> class Nef_polyhedron_S2_rep;
-template <typename K, typename I, typename Mk> class Nef_polyhedron_3;
-class SNC_items;
-
-template <typename K, typename I, typename Mk, typename M>
-std::ostream& operator<<(std::ostream&, const Nef_polyhedron_S2<K,I,Mk,M>&); 
-template <typename K, typename I, typename Mk, typename M>
-std::istream& operator>>(std::istream&, Nef_polyhedron_S2<K,I,Mk,M>&);
-
-
-template <typename K, typename I, typename Mk, typename M>
-class Nef_polyhedron_S2_rep { 
-
-  typedef Nef_polyhedron_S2_rep<K,I,Mk,M>        Self;
-  friend class Nef_polyhedron_S2<K,I,Mk,M>;
-
- public:
-  typedef CGAL::Sphere_geometry<K>                     Sphere_kernel;
-  typedef Mk                                           Mark;
-  typedef M                                            Sphere_map;
-  typedef CGAL::SM_const_decorator<Sphere_map>         Const_decorator;
-  typedef CGAL::SM_decorator<Sphere_map>               Decorator;
-  typedef CGAL::SM_overlayer<Decorator>                Overlayer;
-  typedef CGAL::SM_point_locator<Const_decorator>      Locator;
-
- private:
-  Sphere_map sm_; 
-  
-public:
-  Nef_polyhedron_S2_rep() : sm_() {}
-  Nef_polyhedron_S2_rep(const Self&) : sm_() {}
-  ~Nef_polyhedron_S2_rep() { sm_.clear(); }
-};
-
-/*{\Moptions print_title=yes }*/ 
-/*{\Manpage {Nef_polyhedron_S2}{K}
-{Nef Polyhedra in the sphere surface}{N}}*/
-
-/*{\Mdefinition An instance of data type |\Mname| is a subset of $S_2$
-that is the result of forming complements and intersections starting
-from a finite set |H| of half-spaces. |\Mtype| is closed under all
-binary set operations |intersection|, |union|, |difference|,
-|complement| and under the topological operations |boundary|,
-|closure|, and |interior|.
-
-The template parameter |Kernel| is specified via a kernel concept. 
-|Kernel| must be a model of the concept |NefSphereKernelTraits_2|.
-}*/
-
-template <typename Kernel_, typename Items_ = SM_items, typename Mark_ = bool,  
-	  typename Map_ = Sphere_map<Sphere_geometry<Kernel_>,Items_, Mark_> >
-class Nef_polyhedron_S2 : public Handle_for< Nef_polyhedron_S2_rep<Kernel_,Items_,Mark_,Map_> >, 
-			  public Nef_polyhedron_S2_rep<Kernel_,Items_,Mark_,Map_>::Const_decorator { 
-  
-  using Nef_polyhedron_S2_rep<Kernel_,Items_,Mark_,Map_>::Const_decorator::set_sm;
-
-public:
-  /*{\Mtypes 7}*/
-  typedef Items_                                              Items;
-  typedef Kernel_                                             Kernel;
-  typedef Map_                                                Sphere_map;
-  typedef Mark_                                               Mark;
-  typedef Nef_polyhedron_S2<Kernel,Items,Mark,Sphere_map>     Self;
-  typedef Nef_polyhedron_S2_rep<Kernel,Items,Mark,Sphere_map> Rep;
-  typedef Handle_for< Nef_polyhedron_S2_rep<Kernel,Items,Mark,Sphere_map> >  Base;
-  typedef typename Rep::Sphere_kernel                         Sphere_kernel;
-//  typedef typename Rep::Sphere_map                            Sphere_map;
-
-  typedef typename Sphere_kernel::Sphere_point   Sphere_point;
-  /*{\Mtypemember points in the sphere surface.}*/
-
-  typedef typename Sphere_kernel::Sphere_segment Sphere_segment;
-  /*{\Mtypemember segments in the sphere surface.}*/
-
-  typedef typename Sphere_kernel::Sphere_circle  Sphere_circle;
-  /*{\Mtypemember oriented great circles modeling spherical half-spaces}*/
-
-  typedef typename Sphere_kernel::Sphere_direction Sphere_direction;
-
-
-//  typedef typename Rep::Mark Mark;
-  /*{\Xtypemember marking set membership or exclusion.}*/
-
-  enum Boundary { EXCLUDED=0, INCLUDED=1 };
-  /*{\Menum construction selection.}*/
-
-  enum Content { EMPTY=0, COMPLETE=1 };
-  /*{\Menum construction selection}*/
-
-  const Sphere_map& sphere_map() const { return this->ptr()->sm_; }
-protected:
-  Sphere_map& sphere_map() { return this->ptr()->sm_; } 
-
-  struct AND { bool operator()(const Mark& b1, const Mark& b2)  const { return b1&&b2; }  };
-  struct OR { bool operator()(const Mark& b1, const Mark& b2)   const { return b1||b2; }  };
-  struct DIFF { bool operator()(const Mark& b1, const Mark& b2) const { return b1&&!b2; } };
-  struct XOR { bool operator()(const Mark& b1, const Mark& b2)  const 
-               { return (b1&&!b2)||(!b1&&b2); } };   
-
-  typedef Nef_polyhedron_S2_rep<Kernel,Items,Mark,Sphere_map>  Nef_rep;
-  typedef typename Nef_rep::Decorator                     Decorator;
-public:
-  typedef typename Nef_rep::Const_decorator               Const_decorator;
-protected:
-  typedef typename Nef_rep::Overlayer                     Overlayer;
-  typedef typename Nef_rep::Locator                       Locator;
-
-  friend std::ostream& operator<< <>
-      (std::ostream& os, const Self& NP);
-  friend std::istream& operator>> <>
-      (std::istream& is, Self& NP);
-
-public:
-  typedef typename Decorator::SVertex_handle         SVertex_handle;
-  typedef typename Decorator::SHalfedge_handle       SHalfedge_handle;
-  typedef typename Decorator::SHalfloop_handle       SHalfloop_handle;
-  typedef typename Decorator::SFace_handle           SFace_handle;
-
-  typedef typename Sphere_map::SVertex_base          SVertex;
-  typedef typename Sphere_map::SHalfedge_base        SHalfedge;
-  typedef typename Sphere_map::SHalfloop             SHalfloop;
-  typedef typename Sphere_map::SFace_base            SFace;
-
-  typedef typename Decorator::SVertex_const_handle   SVertex_const_handle;
-  typedef typename Decorator::SHalfedge_const_handle SHalfedge_const_handle;
-  typedef typename Decorator::SHalfloop_const_handle SHalfloop_const_handle;
-  typedef typename Decorator::SFace_const_handle     SFace_const_handle;
-
-  typedef typename Decorator::SVertex_iterator       SVertex_iterator;
-  typedef typename Decorator::SHalfedge_iterator     SHalfedge_iterator;
-  typedef typename Decorator::SHalfloop_iterator     SHalfloop_iterator;
-  typedef typename Decorator::SFace_iterator         SFace_iterator;
-
-  typedef typename Const_decorator::SVertex_const_iterator   
-                                                    SVertex_const_iterator;
-  typedef typename Const_decorator::SHalfedge_const_iterator 
-                                                    SHalfedge_const_iterator;
-  typedef typename Const_decorator::SHalfloop_const_iterator 
-                                                    SHalfloop_const_iterator;
-  typedef typename Const_decorator::SFace_const_iterator     
-                                                    SFace_const_iterator;
-  typedef typename Const_decorator::Size_type Size_type;
-  typedef Size_type size_type;
-  
-  typedef std::list<Sphere_segment>  SS_list;
-  typedef typename SS_list::const_iterator SS_iterator;
-
-  friend class Nef_polyhedron_3<Kernel, SNC_items, Mark>;
-
-public:
-  /*{\Mcreation 3}*/
-
-  Nef_polyhedron_S2(Content sphere = EMPTY) : Base(Nef_rep())
-  /*{\Mcreate creates an instance |\Mvar| of type |\Mname|
-  and initializes it to the empty set if |sphere == EMPTY|
-  and to the whole sphere if |sphere == COMPLETE|.}*/
-  {
-    set_sm(&sphere_map());
-    Decorator D(&sphere_map());
-    SFace_handle sf=D.new_sface();
-    sf->mark() = bool(sphere);
-  }
-
-
-  Nef_polyhedron_S2(const Sphere_circle& c, 
-		    Boundary circle = INCLUDED) : Base(Nef_rep()) {
-  /*{\Mcreate creates a Nef polyhedron |\Mvar| containing the half-sphere
-  left of |c| including |c| if |circle==INCLUDED|, excluding |c| if 
-  |circle==EXCLUDED|.}*/  
-    
-    set_sm(&sphere_map());
-    CGAL_NEF_TRACEN("Nef_polyhedron_S2(): construction from circle "<<c);
-    Decorator D(&sphere_map());
-    Overlayer O(&sphere_map()); 
-    O.create(c);
-    SHalfloop_handle h = D.shalfloop();
-    if ( h->circle() != c ) h = h->twin();
-    h->incident_sface()->mark() = true;
-    h->mark() = h->twin()->mark() = bool(circle);
-  }
-
-
-  template <class Forward_iterator>
-  Nef_polyhedron_S2(Forward_iterator first, Forward_iterator beyond,
-    Boundary b = INCLUDED) : Base(Nef_rep())
-  /*{\Mcreate creates a Nef polyhedron |\Mvar| from the set of sphere
-    segments in the iterator range |[first,beyond)|. If the set of sphere
-    segments is a simple polygon that separates the sphere surface
-    into two regions, then the polygonal region that is left of the
-    segment |*first| is selected. The polygonal region includes its
-    boundary if |b = INCLUDED| and excludes the boundary
-    otherwise. |Forward_iterator| has to be an iterator with value
-    type |Sphere_segment|.}*/
-  { CGAL_NEF_TRACEN("Nef_polyhedron_S2(): creation from segment range");
-    CGAL_assertion(first!=beyond);
-    set_sm(&sphere_map());
-    Overlayer D(&sphere_map());
-    Sphere_segment s = *first;
-    D.create_from_segments(first,beyond);
-    SHalfedge_iterator e;
-    CGAL_forall_shalfedges(e,D) {
-      Sphere_circle c(e->circle());
-      if ( c == s.sphere_circle() ) break;
-    }
-    if ( e != SHalfedge_iterator() ) {
-      if ( e->circle() != s.sphere_circle() ) e = e->twin();
-      CGAL_assertion( e->circle() == s.sphere_circle() );
-      D.set_marks_in_face_cycle(e,bool(b));
-      if ( D.number_of_sfaces() > 2 ) e->incident_sface()->mark() = true;
-      else                            e->incident_sface()->mark() = !bool(b);
-      return;
-    }
-    D.simplify();
-  }
-
-  Nef_polyhedron_S2(const Self& N1) : Base(N1), Const_decorator() {
-    set_sm(&sphere_map());
-  }
-  Nef_polyhedron_S2& operator=(const Self& N1)
-  { Base::operator=(N1); set_sm(&sphere_map()); return (*this); }
-  ~Nef_polyhedron_S2() {}
-
-  template <class Forward_iterator>
-  Nef_polyhedron_S2(Forward_iterator first, Forward_iterator beyond, 
-    double p) : Base(Nef_rep())
-  /*{\Xcreate creates a random Nef polyhedron from the arrangement of
-  the set of circles |S = set[first,beyond)|. The cells of the arrangement
-  are selected uniformly at random with probability $p$. \precond $0 < p
-  < 1$.}*/
-  { CGAL_assertion(0<=p && p<=1);
-    CGAL_assertion(first!=beyond);
-    set_sm(&sphere_map());
-    Overlayer D(&sphere_map());
-    D.create_from_circles(first, beyond); D.simplify();
-
-    boost::rand48 rng;
-    boost::uniform_real<> dist(0,1);
-    boost::variate_generator<boost::rand48&, boost::uniform_real<> > get_double(rng,dist);
-
-    SVertex_iterator v; SHalfedge_iterator e; SFace_iterator f;
-    CGAL_forall_svertices(v,D)
-      v->mark() = ( get_double() < p ? true : false );
-    CGAL_forall_shalfedges(e,D)
-      e->mark() = ( get_double() < p ? true : false );
-    CGAL_forall_sfaces(f,D)
-      f->mark() = ( get_double() < p ? true : false );
-    D.simplify();
-  }
-
- void delegate( Modifier_base<Sphere_map>& modifier) {
-   // calls the `operator()' of the `modifier'. Precondition: The
-   // `modifier' returns a consistent representation.
-   modifier(sphere_map());
-   //   CGAL_expensive_postcondition( is_valid());
- }
-
-//protected:
-  Nef_polyhedron_S2(const Sphere_map& H, bool clone=true) : Base(Nef_rep()) 
-  /*{\Xcreate makes |\Mvar| a new object.  If |clone==true| then the
-  underlying structure of |H| is copied into |\Mvar|.}*/
-{ 
-    if(clone)
-      this->ptr()->sm_ = H; 
-    set_sm(&sphere_map());
-  }
-  
-  void clone_rep() { *this = Self(sphere_map()); }
-
-  /*{\Moperations 4 3 }*/
-  public:
-
-  void clear(Content plane = EMPTY)
-  { *this = Nef_polyhedron_S2(plane); }
-  /*{\Mop makes |\Mvar| the empty set if |plane == EMPTY| and the
-  full plane if |plane == COMPLETE|.}*/
-
-  bool is_empty() const
-  /*{\Mop returns true if |\Mvar| is empty, false otherwise.}*/
-  { Const_decorator D(&sphere_map());
-    CGAL_NEF_TRACEN("is_empty()"<<*this);
-    SFace_const_iterator f = D.sfaces_begin();
-    return (D.number_of_svertices()==0 &&
-            D.number_of_sedges()==0 &&
-            D.number_of_sloops()==0 &&
-            D.number_of_sfaces()==1 &&
-            f->mark() == false);
-  }
-
-  bool is_plane() const
-  /*{\Mop returns true if |\Mvar| is the whole plane, false otherwise.}*/
-  { Const_decorator D(&sphere_map());
-    SFace_const_iterator f = D.sfaces_begin();
-    return (D.number_of_svertices()==0 &&
-            D.number_of_sedges()==0 &&
-            D.number_of_sloops()==0 &&
-            D.number_of_sfaces()==1 &&
-            f->mark() == true);
-  }
-
-  void extract_complement()
-  { CGAL_NEF_TRACEN("extract complement");
-    if ( this->is_shared() ) clone_rep();
-    Overlayer D(&sphere_map());
-    SVertex_iterator v;
-    SHalfedge_iterator e;
-    SFace_iterator f;
-    CGAL_forall_svertices(v,D) v->mark() = !v->mark();
-    CGAL_forall_sedges(e,D) e->mark() = !e->mark();
-    CGAL_forall_sfaces(f,D) f->mark() = !f->mark();
-    
-    if ( D.has_shalfloop() )
-      D.shalfloop()->mark() = 
-	D.shalfloop()->twin()->mark() = 
-	!D.shalfloop()->mark();
-  }
-
-  void extract_interior()
-  { CGAL_NEF_TRACEN("extract interior");
-    if ( this->is_shared() ) clone_rep();
-    Overlayer D(&sphere_map());
-    SVertex_iterator v;
-    SHalfedge_iterator e;
-    CGAL_forall_svertices(v,D) v->mark() = false;
-    CGAL_forall_sedges(e,D) e->mark() = false;
-    if ( D.has_sloop() ) D.shalfloop()->mark() = false;
-    D.simplify();
-  }
-
-
-  void extract_boundary()
-  { CGAL_NEF_TRACEN("extract boundary");
-    if ( this->is_shared() ) clone_rep();
-    Overlayer D(&sphere_map());
-    SVertex_iterator v;
-    SHalfedge_iterator e;
-    SFace_iterator f;
-    CGAL_forall_svertices(v,D) v->mark() = true;
-    CGAL_forall_sedges(e,D)    e->mark() = true;
-    CGAL_forall_sfaces(f,D)    f->mark() = false;
-    if ( D.has_sloop() )       D.shalfloop()->mark() = D.shalfoop()->twin() = true;
-    D.simplify();
-  }
-
-  void extract_closure()
-  /*{\Xop converts |\Mvar| to its closure. }*/
-  { CGAL_NEF_TRACEN("extract closure");
-    extract_complement();
-    extract_interior();
-    extract_complement();
-  }
-
-  void extract_regularization()
-  /*{\Xop converts |\Mvar| to its regularization. }*/
-  { CGAL_NEF_TRACEN("extract regularization");
-    extract_interior();
-    extract_closure();
-  }
-
-  /*{\Mtext \headerline{Constructive Operations}}*/
-
-  Self complement() const
-  /*{\Mop returns the complement of |\Mvar| in the plane.}*/
-  { Self res = *this;
-    res.extract_complement();
-    return res;
-  }
-
-
-  Self interior() const
-  /*{\Mop returns the interior of |\Mvar|.}*/
-  { Self res = *this;
-    res.extract_interior();
-    return res;
-  }
-
-  Self closure() const
-  /*{\Mop returns the closure of |\Mvar|.}*/
-  { Self res = *this;
-    res.extract_closure();
-    return res;
-  }
-
-  Self boundary() const
-  /*{\Mop returns the boundary of |\Mvar|.}*/
-  { Self res = *this;
-    res.extract_boundary();
-    return res;
-  }
-
-  Self regularization() const
-  /*{\Mop returns the regularized polyhedron (closure of interior).}*/
-  { Self res = *this;
-    res.extract_regularization();
-    return res;
-  }
-
-
-  Self intersection(const Self& N1) const
-  /*{\Mop returns |\Mvar| $\cap$ |N1|. }*/
-  { Self res(sphere_map(),false); // empty
-    Overlayer D(&res.sphere_map());
-    D.subdivide(&sphere_map(),&N1.sphere_map());
-    AND _and; D.select(_and); D.simplify();
-    return res;
-  }
-
-
-  Self join(const Self& N1) const
-  /*{\Mop returns |\Mvar| $\cup$ |N1|. }*/
-  { Self res(sphere_map(),false); // empty
-    Overlayer D(&res.sphere_map());
-    D.subdivide(&sphere_map(),&N1.sphere_map());
-    OR _or; D.select(_or); D.simplify();
-    return res;
-  }
-
-  Self difference(const Self& N1) const
-  /*{\Mop returns |\Mvar| $-$ |N1|. }*/
-  { Self res(sphere_map(),false); // empty
-    Overlayer D(&res.sphere_map());
-    D.subdivide(&sphere_map(),&N1.sphere_map());
-    DIFF _diff; D.select(_diff); D.simplify();
-    return res;
-  }    
-
-  Self symmetric_difference(
-    const Self& N1) const
-  /*{\Mop returns the symmectric difference |\Mvar - T| $\cup$ 
-          |T - \Mvar|. }*/
-  { Self res(sphere_map(),false); // empty
-    Overlayer D(&res.sphere_map());
-    D.subdivide(&sphere_map(),&N1.sphere_map());
-    XOR _xor; D.select(_xor); D.simplify();
-    return res;
-  }
-
-  /*{\Mtext Additionally there are operators |*,+,-,^,!| which
-  implement the binary operations \emph{intersection}, \emph{union},
-  \emph{difference}, \emph{symmetric difference}, and the unary
-  operation \emph{complement} respectively. There are also the
-  corresponding modification operations |*=,+=,-=,^=|.}*/
-
-  Self  operator*(const Self& N1) const
-  { return intersection(N1); }
-
-  Self  operator+(const Self& N1) const
-  { return join(N1); }
-
-  Self  operator-(const Self& N1) const
-  { return difference(N1); }
-
-  Self  operator^(const Self& N1) const
-  { return symmetric_difference(N1); }
-
-  Self  operator!() const
-  { return complement(); }
-   
-  Self& operator*=(const Self& N1)
-  { *this = intersection(N1); return *this; }
-
-  Self& operator+=(const Self& N1)
-  { *this = join(N1); return *this; }
-
-  Self& operator-=(const Self& N1)
-  { *this = difference(N1); return *this; }
-
-  Self& operator^=(const Self& N1)
-  { *this = symmetric_difference(N1); return *this; }
-
-  /*{\Mtext There are also comparison operations like |<,<=,>,>=,==,!=|
-  which implement the relations subset, subset or equal, superset, superset
-  or equal, equality, inequality, respectively.}*/
-
-  bool operator==(const Self& N1) const
-  { return symmetric_difference(N1).is_empty(); }
-
-  bool operator!=(const Self& N1) const
-  { return !operator==(N1); }  
-
-  bool operator<=(const Self& N1) const
-  { return difference(N1).is_empty(); } 
-
-  bool operator<(const Self& N1) const
-  { return difference(N1).is_empty() && !N1.difference(*this).is_empty(); } 
-
-  bool operator>=(const Self& N1) const
-  { return N1.difference(*this).is_empty(); } 
-
-  bool operator>(const Self& N1) const   
-  { return N1.difference(*this).is_empty() && !difference(N1).is_empty(); } 
-
-
-  /*{\Mtext \headerline{Exploration - Point location - Ray shooting}
-  As Nef polyhedra are the result of forming complements 
-  and intersections starting from a set |H| of half-spaces that are
-  defined by oriented lines in the plane, they can be represented by
-  an attributed plane map $M = (V,E,F)$. For topological queries
-  within |M| the following types and operations allow exploration
-  access to this structure.}*/
-
-  /*{\Mtypes 3}*/
-  typedef Const_decorator Topological_explorer;
-
-  typedef Const_decorator Explorer;
-  /*{\Mtypemember a decorator to examine the underlying plane map. 
-  See the manual page of |Explorer|.}*/
-
-  typedef typename Locator::Object_handle Object_handle;
-  /*{\Mtypemember a generic handle to an object of the underlying
-  plane map. The kind of object |(vertex, halfedge, face)| can 
-  be determined and the object can be assigned to a corresponding
-  handle by the three functions:\\
-  |bool assign(SVertex_const_handle& h, Object_handle)|\\
-  |bool assign(SHalfedge_const_handle& h, Object_handle)|\\
-  |bool assign(SFace_const_handle& h, Object_handle)|\\
-  where each function returns |true| iff the assignment to
-  |h| was done.}*/
-
-
-  /*{\Moperations 3 1 }*/
-
-  bool contains(Object_handle h) const
-  /*{\Mop  returns true iff the object |h| is contained in the set
-  represented by |\Mvar|.}*/
-  { Locator PL(&sphere_map()); return PL.mark(h); }
-
-  bool contained_in_boundary(Object_handle h) const
-  /*{\Mop  returns true iff the object |h| is contained in the $1$-skeleton
-  of |\Mvar|.}*/
-  { SVertex_const_handle v;
-    SHalfedge_const_handle e;
-    return  ( CGAL::assign(v,h) || CGAL::assign(e,h) );
-  }
-
-
-  Object_handle locate(const Sphere_point& p) const
-  /*{\Mop  returns a generic handle |h| to an object (face, halfedge, vertex) 
-  of the underlying plane map that contains the point |p| in its relative 
-  interior. The point |p| is contained in the set represented by |\Mvar| if 
-  |\Mvar.contains(h)| is true. The location mode flag |m| allows one to choose
-  between different point location strategies.}*/
-  { 
-    Locator PL(&sphere_map());
-    return PL.locate(p); 
-  }
-
-  struct INSET {
-    const Const_decorator& D;
-    INSET(const Const_decorator& Di) : D(Di) {}
-    bool operator()(SVertex_const_handle v) const { return v->mark(); }
-    bool operator()(SHalfedge_const_handle e) const { return e->mark(); }
-    bool operator()(SHalfloop_const_handle l) const { return l->mark(); }
-    bool operator()(SFace_const_handle f) const { return f->mark(); }
-  };
-
-  Object_handle ray_shoot(const Sphere_point& p, 
-			  const Sphere_direction& d) const
-  /*{\Mop returns a handle |h| with |\Mvar.contains(h)| that can be
-  converted to a |SVertex_/SHalfedge_/SFace_const_handle| as described
-  above. The object returned is intersected by the ray starting in |p|
-  with direction |d| and has minimal distance to |p|.  The operation
-  returns the null handle |NULL| if the ray shoot along |d| does not hit
-  any object |h| of |\Mvar| with |\Mvar.contains(h)|.}*/
-  { 
-    Locator PL(&sphere_map());
-    return PL.ray_shoot(p,d,INSET(PL));
-  }
-
-  struct INSKEL {
-    bool operator()(SVertex_const_handle) const { return true; }
-    bool operator()(SHalfedge_const_handle) const { return true; }
-    bool operator()(SHalfloop_const_handle) const { return true; }
-    bool operator()(SFace_const_handle) const { return false; }
-  };
-
-  Object_handle ray_shoot_to_boundary(const Sphere_point& p, 
-				      const Sphere_direction& d) const
-  /*{\Mop returns a handle |h| that can be converted to a
-  |SVertex_/SHalfedge_const_handle| as described above. The object
-  returned is part of the $1$-skeleton of |\Mvar|, intersected by the
-  ray starting in |p| with direction |d| and has minimal distance to
-  |p|.  The operation returns the null handle |NULL| if the ray shoot
-  along |d| does not hit any $1$-skeleton object |h| of |\Mvar|. The
-  location mode flag |m| allows one to choose between different point
-  location strategies.}*/
-  { 
-    Locator PL(&sphere_map());
-    return PL.ray_shoot(p,d,INSKEL());
-  }
-
-
-  //  Explorer explorer() const 
-  /*{\Mop returns a decorator object which allows read-only access of
-  the underlying plane map. See the manual page |Explorer| for its 
-  usage.}*/
-  //  { return Explorer(const_cast<Sphere_map*>(&sphere_map())); }
-
-  /*{\Mtext\headerline{Input and Output}
-  A Nef polyhedron |\Mvar| can be visualized in an open GL window. The 
-  output operator is defined in the file 
-  |CGAL/IO/Nef_\-poly\-hedron_2_\-Win\-dow_\-stream.h|.
-  }*/
-
-  /*{\Mimplementation Nef polyhedra are implemented on top of a halfedge
-  data structure and use linear space in the number of vertices, edges
-  and facets.  Operations like |empty| take constant time. The
-  operations |clear|, |complement|, |interior|, |closure|, |boundary|,
-  |regularization|, input and output take linear time. All binary set
-  operations and comparison operations take time $O(n \log n)$ where $n$
-  is the size of the output plus the size of the input.
-
-  The point location and ray shooting operations are implemented in
-  the naive way. The operations run in linear query time without
-  any preprocessing.}*/
-
-  /*{\Mexample Nef polyhedra are parameterized by a standard CGAL
-  kernel. 
-
-  \begin{Mverb}
-  #include <CGAL/Homogeneous.h>
-  #include <CGAL/leda_integer.h>
-  #include <CGAL/Nef_polyhedron_S2.h>
-  #include <CGAL/SM_items.h>
-
-  using namespace CGAL;
-  typedef  Homogeneous<leda_integer>   Kernel;
-  typedef  SM_items<Kernel, bool>      SM_items;
-  typedef  Nef_polyhedron_S2<SM_items> Nef_polyhedron;
-  typedef  Nef_polyhedron::Sphere_circle Sphere_circle;
-
-  int main()
-  {
-    Nef_polyhedron N1(Sphere_circle(1,0,0));
-    Nef_polyhedron N2(Sphere_circle(0,1,0), Nef_polyhedron::EXCLUDED);
-    Nef_polyhedron N3 = N1 * N2; // line (*)
-    return 0;
-  }
-  \end{Mverb}
-  After line (*) |N3| is the intersection of |N1| and |N2|.}*/
-
-
-}; // end of Nef_polyhedron_S2
-
-template <typename Kernel,typename Items,typename Mark, typename Sphere_map>
-std::ostream& operator<<
- (std::ostream& os, const Nef_polyhedron_S2<Kernel,Items,Mark,Sphere_map>& NP)
-{
-  os << "Nef_polyhedron_S2\n";
-  typedef typename Nef_polyhedron_S2<Kernel,Items,Mark,Sphere_map>::Explorer Decorator;
-  CGAL::SM_io_parser<Decorator> O(os, Decorator(&NP.sphere_map())); 
-  O.print();
-  return os;
-}
-
-template <typename Kernel,typename Items, typename Mark, typename Sphere_map>
-std::istream& operator>>
-  (std::istream& is, Nef_polyhedron_S2<Kernel,Items,Mark,Sphere_map>& NP)
-{
-  typedef typename Nef_polyhedron_S2<Kernel,Items,Mark,Sphere_map>::Decorator Decorator;
-  CGAL::SM_io_parser<Decorator> I(is, Decorator(&NP.sphere_map())); 
-  //  if ( I.check_sep("Nef_polyhedron_S2") ) 
-  I.read();
-  /*
-  else {
-    std::cerr << "Nef_polyhedron_S2 input corrupted." << std::endl;
-    NP = Nef_polyhedron_S2<Kernel,Items,Mark,Sphere_map>();
-  }
-  */
-  /*
-  typename Nef_polyhedron_S2<Kernel,Items,Mark,Sphere_map>::Topological_explorer D(NP.explorer());
-  D.check_integrity_and_topological_planarity();
-  */
-  return is;
-}
-
-
-#if defined(BOOST_MSVC)
-#  pragma warning(pop)
-#endif
-
-} //namespace CGAL
-#endif //CGAL_NEF_POLYHEDRON_S2_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_polynomial.h b/3rdparty/CGAL-4.8/include/CGAL/Nef_polynomial.h
deleted file mode 100644
index 5a3eb94..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Nef_polynomial.h
+++ /dev/null
@@ -1,292 +0,0 @@
-// Copyright (c) 1997-2000  Max-Planck-Institute Saarbruecken (Germany).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Michael Seel <seel at mpi-sb.mpg.de>
-
-#ifndef CGAL_NEF_POLYNOMIAL_H
-#define CGAL_NEF_POLYNOMIAL_H
-
-#include <CGAL/Nef_2/Polynomial.h>
-//#include <CGAL/basic.h>
-//#include <CGAL/kernel_assertions.h>
-//#include <CGAL/Handle_for.h>
-//#include <CGAL/number_type_basic.h>
-//#include <CGAL/number_utils.h>
-//#include <CGAL/Number_type_traits.h>
-//#include <CGAL/IO/io.h>
-#include <cstddef>
-#undef CGAL_NEF_DEBUG
-#define CGAL_NEF_DEBUG 3
-#include <CGAL/Nef_2/debug.h>
-#include <vector>
-
-#include <CGAL/Kernel/mpl.h>
-
-#include <boost/operators.hpp>
-
-namespace CGAL {
-
-#define CGAL_int(T)    typename First_if_different<int,    T>::Type
-#define CGAL_double(T) typename First_if_different<double, T>::Type
-
-template <class NT> 
-class Nef_polynomial
-  : boost::ordered_field_operators1< Nef_polynomial<NT>
-  , boost::ordered_field_operators2< Nef_polynomial<NT>, int
-  > >
-  , public Nef::Polynomial<NT>
-{
-  typedef typename CGAL::Nef::Polynomial<NT>  Base;
-  typedef typename Base::size_type       size_type;
-
- protected:
-  Nef_polynomial(size_type s) : Base(s) {}
-
- public:
-  Nef_polynomial() : Base() {}
-  Nef_polynomial(const NT& a0) : Base(a0) {}
-  Nef_polynomial(const NT& a0, const NT& a1) : Base(a0,a1) {}
-  Nef_polynomial(const NT& a0, const NT& a1, const NT& a2) : Base(a0,a1,a2) {}
-
-  template <class Fwd_iterator>
-  Nef_polynomial(std::pair<Fwd_iterator, Fwd_iterator> poly) : Base(poly) {}
-
-  Nef_polynomial(CGAL_double(NT) n) : Base(n) {}
-  Nef_polynomial(CGAL_double(NT) n1, CGAL_double(NT) n2) : Base(n1, n2) {}
-  Nef_polynomial(CGAL_int(NT) n) : Base(NT(n)) {}
-  Nef_polynomial(CGAL_int(NT) n1, CGAL_int(NT) n2) : Base(n1,n2) {}
-
-  Nef_polynomial(const Base& p) : Base(p) {}
-
-  Base & polynomial() { return static_cast<Base&>(*this); }
-  const Base & polynomial() const  { return static_cast<const Base&>(*this); }
-
-    static NT& infi_maximal_value() {
-      static NT R_ = 1;
-      return R_;
-    }
-};
-
-template <class NT> 
-inline
-Nef_polynomial<NT> operator+(const Nef_polynomial<NT> &a)
-{
-  return a;
-}
-
-template <class NT> 
-inline
-Nef_polynomial<NT> operator-(const Nef_polynomial<NT> &a)
-{
-  return - a.polynomial();
-}
-
-template <class NT> 
-inline
-bool operator<(const Nef_polynomial<NT> &a, const Nef_polynomial<NT> &b)
-{
-  return a.polynomial() < b.polynomial();
-}
-
-template <class NT> 
-inline
-bool operator==(const Nef_polynomial<NT> &a, const Nef_polynomial<NT> &b)
-{
-  return a.polynomial() == b.polynomial();
-}
-
-template <class NT> 
-inline
-bool operator==(const Nef_polynomial<NT> &a, int b)
-{
-  return a.polynomial() == b;
-}
-
-template <class NT> 
-inline
-bool operator<(const Nef_polynomial<NT> &a, int b)
-{
-  return a.polynomial() < b;
-}
-
-template <class NT> 
-inline
-bool operator>(const Nef_polynomial<NT> &a, int b)
-{
-  return a.polynomial() > b;
-}
-
-
-#undef CGAL_double
-#undef CGAL_int
-
-
-// TODO: integral_division to get it an UniqueFactorizationDomain
-// TODO: div / mod  for EuclideanRing
-template <class NT> class Algebraic_structure_traits< Nef_polynomial<NT> >
-    : public Algebraic_structure_traits_base
-             < Nef_polynomial<NT>, CGAL::Integral_domain_without_division_tag> 
-{
-    typedef Algebraic_structure_traits<NT> AST_NT;
-public:
-    typedef Nef_polynomial<NT> Type;
-    typedef typename AST_NT::Is_exact            Is_exact;
-    typedef Tag_false                            Is_numerical_sensitive;                                                           
-    class Integral_division
-        : public std::binary_function< Type, Type,
-                                Type > {
-    public:
-        Type operator()( const Type& x,
-                const Type& y ) const {
-	  Type result = x / y;
-	  CGAL_postcondition_msg(result * y == x, "exact_division failed\n");
-	  return result;
-        }
-    };
-
-    class Gcd 
-      : public std::binary_function< Type, Type, Type > {
-    public:
-        Type operator()( const Type& x, const Type& y ) const {
-            // By definition gcd(0,0) == 0
-          if( x == Type(0) && y == Type(0) )
-            return Type(0);
-            
-          return CGAL::Nef::gcd( x, y );
-        }
-        CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( Type )
-    };
-};
-
-template <class NT> class Real_embeddable_traits< Nef_polynomial<NT> > 
-  : public INTERN_RET::Real_embeddable_traits_base< Nef_polynomial<NT> , CGAL::Tag_true > {
-  public:
-    typedef Nef_polynomial<NT> Type;
-    class Abs 
-        : public std::unary_function< Type, Type> {
-    public:
-        Type inline operator()( const Type& x ) const {
-            return (CGAL::Nef::sign( x ) == CGAL::NEGATIVE)? -x : x;
-        }        
-    };
-
-    class Sgn 
-      : public std::unary_function< Type, CGAL::Sign > {
-      public:
-        CGAL::Sign inline operator()( const Type& x ) const {
-            return CGAL::Nef::sign( x );
-        }        
-    };
-    
-    class Compare 
-      : public std::binary_function< Type, Type,
-                                CGAL::Comparison_result > {
-      public:
-        CGAL::Comparison_result inline operator()( 
-                const Type& x, 
-                const Type& y ) const {
-            return (CGAL::Comparison_result) CGAL::Nef::sign( x - y );
-        }
-    };
-    
-    class To_double 
-      : public std::unary_function< Type, double > {
-      public:
-        double inline operator()( const Type& p ) const {
-            return CGAL::to_double(
-                    p.eval_at(Nef_polynomial<NT>::infi_maximal_value()));
-        }
-    };
-    
-    class To_interval 
-      : public std::unary_function< Type, std::pair< double, double > > {
-      public:
-        std::pair<double, double> operator()( const Type& p ) const {
-            return CGAL::to_interval(p.eval_at(Nef_polynomial<NT>::infi_maximal_value()));
-        }
-    };
-};
-
-template <typename NT>
-inline Nef_polynomial<NT> min BOOST_PREVENT_MACRO_SUBSTITUTION
-(const Nef_polynomial<NT>& x,const Nef_polynomial<NT>& y){
-  return (x<=y)?x:y; 
-}
-
-template <typename NT>
-inline Nef_polynomial<NT> max BOOST_PREVENT_MACRO_SUBSTITUTION
-(const Nef_polynomial<NT>& x,const Nef_polynomial<NT>& y){
-  return (x>=y)?x:y; 
-}
-
-template <typename NT>
-class Fraction_traits<Nef_polynomial<NT> > {
-public:
-    typedef Nef_polynomial<NT> Type;
-    typedef Fraction_traits<NT> Base_traits;
-    typedef typename Base_traits::Is_fraction Is_fraction;
-    typedef CGAL::Nef_polynomial<typename Base_traits::Numerator_type>
-      Numerator_type;
-    typedef typename Base_traits::Denominator_type Denominator_type;
-    //TODO:    typedef Base_traits::Common_factor Common_factor;
-    class Decompose {
-    public:
-        typedef Type first_argument_type;
-        typedef Numerator_type second_argument_type;
-        typedef Denominator_type third_argument_type;
-        void operator () (const first_argument_type& rat, 
-			  second_argument_type& num,
-			  third_argument_type& den) {
-	  typename Base_traits::Decompose decompose;
-	  third_argument_type num0;
-	  third_argument_type num1;
-	  third_argument_type den1;
-	  third_argument_type den0;
-	  decompose(rat[0], num0, den0);
-	  if(rat.degree() > 0) {
-	    decompose(rat[1], num1, den1);
-	    // TODO	    den = den1/gcd(den0, den1)*den0;
-	    den = den1*den0;
-	    num = Numerator_type(num0*den1, num1*den0);
-	  } else {
-	    den = den0;
-	    num = Numerator_type(num0);
-	  }
-        }
-    };
-    class Compose {
-    public:
-        typedef Numerator_type first_argument_type;
-        typedef Denominator_type second_argument_type;
-        typedef Type result_type;
-        result_type operator () (const first_argument_type& num,
-				 const second_argument_type& den) {
-	  typename Base_traits::Compose compose;
-	  if(num.degree() == 0)
-	    return result_type(compose(num[0],den));
-	  else
-	    return result_type(compose(num[0],den),
-			       compose(num[1],den));
-        }
-    };
-};
-
-
-} //namespace CGAL
-
-#endif  // CGAL_NEF_POLYNOMIAL_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Cartesian_LA_base.h b/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Cartesian_LA_base.h
deleted file mode 100644
index 28893d6..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Cartesian_LA_base.h
+++ /dev/null
@@ -1,177 +0,0 @@
-// Copyright (c) 2014
-// INRIA Saclay-Ile de France (France)
-//
-// 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(s)     : Marc Glisse
-
-#ifndef CGAL_KERNEL_D_CARTESIAN_LA_BASE_H
-#define CGAL_KERNEL_D_CARTESIAN_LA_BASE_H
-
-#include <CGAL/basic.h>
-#include <CGAL/Origin.h>
-#include <boost/type_traits/integral_constant.hpp>
-#include <CGAL/representation_tags.h>
-#include <CGAL/NewKernel_d/functor_tags.h>
-#include <CGAL/Uncertain.h>
-#include <CGAL/typeset.h>
-#include <CGAL/NewKernel_d/Dimension_base.h>
-#include <CGAL/NewKernel_d/Cartesian_LA_functors.h>
-#include <CGAL/NewKernel_d/Vector/array.h>
-#include <CGAL/NewKernel_d/Vector/vector.h>
-#include <CGAL/NewKernel_d/Vector/mix.h>
-#ifdef CGAL_EIGEN3_ENABLED
-#include <CGAL/NewKernel_d/LA_eigen/LA.h>
-#else
-#error Eigen3 is required
-#include <CGAL/NewKernel_d/LA_default/LA.h>
-#endif
-
-namespace CGAL {
-
-template < typename FT_, typename Dim_,
-#if 1
-	 typename Vec_=Mix_vector<Array_vector<FT_, Dim_>,
-				  Vector_vector<FT_, Dim_>,
-				  FT_, Dim_>,
-#elif 0
-	 typename Vec_=Array_vector<FT_, Dim_>,
-#elif 0
-	 typename Vec_=Vector_vector<FT_, Dim_>,
-#else
-	 // Dangerous because of alignment. Ok on x86_64 without AVX.
-	 typename Vec_=LA_eigen<FT_, Dim_>,
-#endif
-	 typename LA_=LA_eigen<FT_,Dim_> >
-  /* Default LA to Vec or to LA_eigen? */
-struct Cartesian_LA_base_d : public Dimension_base<Dim_>
-{
-    typedef Cartesian_LA_base_d<FT_,Dim_>               Self;
-    typedef Cartesian_tag                               Rep_tag;
-    typedef Cartesian_tag                               Kernel_tag;
-    typedef Dim_              Default_ambient_dimension;
-    typedef Dim_              Max_ambient_dimension;
-    typedef Dim_              Dimension;
-    typedef LA_               LA;
-    template <class> struct Ambient_dimension { typedef Dim_ type; };
-
-    typedef Vec_     LA_vector;
-    typedef typename LA_vector::Vector Point;
-    typedef typename LA_vector::Vector Vector;
-    typedef typename LA_vector::Vector Vector_;
-    typedef typename LA_vector::Construct_vector Constructor;
-    typedef typename LA_vector::Vector_const_iterator Point_cartesian_const_iterator;
-    typedef typename LA_vector::Vector_const_iterator Vector_cartesian_const_iterator;
-
-    template<class, class=void> struct Type {};
-    template<class D> struct Type< Point_tag, D> { typedef Vector_ type; };
-    template<class D> struct Type<Vector_tag, D> { typedef Vector_ type; };
-    template<class D> struct Type<    FT_tag, D> { typedef     FT_ type; };
-    template<class D> struct Type<    RT_tag, D> { typedef     FT_ type; };
-
-    typedef typeset<Point_tag>
-      ::add<Vector_tag>::type
-    // FIXME: These have nothing to do here.
-      ::add<Segment_tag>::type
-      ::add<Hyperplane_tag>::type
-      ::add<Sphere_tag>::type
-      Object_list;
-
-    typedef typeset< Point_cartesian_const_iterator_tag>::type
-      ::add<Vector_cartesian_const_iterator_tag>::type
-      Iterator_list;
-
-    template<class, class=void, class=boost::integral_constant<int,0> > struct Functor {
-	    typedef Null_functor type;
-    };
-    template<class D> struct Functor<Construct_ttag<Vector_tag>,D> {
-	    typedef CartesianDVectorBase::Construct_LA_vector<Self,Null_vector> type;
-    };
-    template<class D> struct Functor<Construct_ttag<Point_tag>,D> {
-	    typedef CartesianDVectorBase::Construct_LA_vector<Self,Origin> type;
-    };
-    template<class D> struct Functor<Construct_ttag<Point_cartesian_const_iterator_tag>,D> {
-	    typedef CartesianDVectorBase::Construct_cartesian_const_iterator<Self> type;
-    };
-    template<class D> struct Functor<Construct_ttag<Vector_cartesian_const_iterator_tag>,D> {
-	    typedef CartesianDVectorBase::Construct_cartesian_const_iterator<Self> type;
-    };
-    template<class D> struct Functor<Sum_of_vectors_tag,D,
-      boost::integral_constant<int,!LA_vector::template Property<Has_vector_plus_minus_tag>::value> > {
-	    typedef CartesianDVectorBase::Sum_of_vectors<Self> type;
-    };
-    template<class D> struct Functor<Difference_of_vectors_tag,D,
-      boost::integral_constant<int,!LA_vector::template Property<Has_vector_plus_minus_tag>::value> > {
-	    typedef CartesianDVectorBase::Difference_of_vectors<Self> type;
-    };
-    template<class D> struct Functor<Opposite_vector_tag,D,
-      boost::integral_constant<int,!LA_vector::template Property<Has_vector_plus_minus_tag>::value> > {
-	    typedef CartesianDVectorBase::Opposite_vector<Self> type;
-    };
-    template<class D> struct Functor<Midpoint_tag,D,
-      boost::integral_constant<int,
-	   !LA_vector::template Property<Has_vector_plus_minus_tag>::value
-	|| !LA_vector::template Property<Has_vector_scalar_ops_tag>::value> > {
-	    typedef CartesianDVectorBase::Midpoint<Self> type;
-    };
-    template<class D> struct Functor<Compute_point_cartesian_coordinate_tag,D> {
-	    typedef CartesianDVectorBase::Compute_cartesian_coordinate<Self> type;
-    };
-    template<class D> struct Functor<Compute_vector_cartesian_coordinate_tag,D> {
-	    typedef CartesianDVectorBase::Compute_cartesian_coordinate<Self> type;
-    };
-    template<class D> struct Functor<Point_dimension_tag,D> {
-	    typedef CartesianDVectorBase::PV_dimension<Self> type;
-    };
-    template<class D> struct Functor<Vector_dimension_tag,D> {
-	    typedef CartesianDVectorBase::PV_dimension<Self> type;
-    };
-    template<class D> struct Functor<Orientation_of_vectors_tag,D,
-      boost::integral_constant<int,!LA_vector::template Property<Has_determinant_of_iterator_to_vectors_tag>::value> > {
-	    typedef CartesianDVectorBase::Orientation_of_vectors<Self> type;
-    };
-    template<class D> struct Functor<Orientation_of_points_tag,D,
-      boost::integral_constant<int,!LA_vector::template Property<Has_determinant_of_iterator_to_points_tag>::value> > {
-	    typedef CartesianDVectorBase::Orientation_of_points<Self> type;
-    };
-    template<class D> struct Functor<Scalar_product_tag,D,
-      boost::integral_constant<int,!LA_vector::template Property<Has_dot_product_tag>::value> > {
-	    typedef CartesianDVectorBase::Scalar_product<Self> type;
-    };
-    template<class D> struct Functor<Squared_distance_to_origin_tag,D,
-      boost::integral_constant<int,!LA_vector::template Property<Stores_squared_norm_tag>::value> > {
-	    typedef CartesianDVectorBase::Squared_distance_to_origin_stored<Self> type;
-    };
-    // Use integral_constant<int,2> in case of failure, to distinguish from the previous one.
-    template<class D> struct Functor<Squared_distance_to_origin_tag,D,
-      boost::integral_constant<int,
-	(LA_vector::template Property<Stores_squared_norm_tag>::value
-	 || !LA_vector::template Property<Has_dot_product_tag>::value)*2> > {
-	    typedef CartesianDVectorBase::Squared_distance_to_origin_via_dotprod<Self> type;
-    };
-    template<class D> struct Functor<Point_to_vector_tag,D> {
-	    typedef CartesianDVectorBase::Identity_functor<Self> type;
-    };
-    template<class D> struct Functor<Vector_to_point_tag,D> {
-	    typedef CartesianDVectorBase::Identity_functor<Self> type;
-    };
-
-    CGAL_CONSTEXPR Cartesian_LA_base_d(){}
-    CGAL_CONSTEXPR Cartesian_LA_base_d(int d):Dimension_base<Dim_>(d){}
-};
-
-} //namespace CGAL
-
-#endif // CGAL_KERNEL_D_CARTESIAN_LA_BASE_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/LA_eigen/LA.h b/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/LA_eigen/LA.h
deleted file mode 100644
index f46e81a..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/LA_eigen/LA.h
+++ /dev/null
@@ -1,170 +0,0 @@
-// Copyright (c) 2014
-// INRIA Saclay-Ile de France (France)
-//
-// 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(s)     : Marc Glisse
-
-#ifndef CGAL_LA_EIGEN_H
-#define CGAL_LA_EIGEN_H
-#include <CGAL/config.h>
-#ifndef CGAL_EIGEN3_ENABLED
-#error Requires Eigen
-#endif
-#include <boost/type_traits/is_arithmetic.hpp>
-#include <boost/utility/enable_if.hpp>
-#include <CGAL/Dimension.h>
-#include <Eigen/Dense>
-#include <CGAL/NewKernel_d/LA_eigen/constructors.h>
-#include <CGAL/iterator_from_indices.h>
-
-namespace CGAL {
-
-//FIXME: where could we use Matrix_base instead of Matrix?
-// Dim_ real dimension
-// Max_dim_ upper bound on the dimension
-template<class NT_,class Dim_,class Max_dim_=Dim_> struct LA_eigen {
-	typedef NT_ NT;
-	typedef Dim_ Dimension;
-	typedef Max_dim_ Max_dimension;
-	enum { dimension = Eigen_dimension<Dimension>::value };
-	enum { max_dimension = Eigen_dimension<Max_dimension>::value };
-	template< class D2, class D3=D2 >
-	struct Rebind_dimension {
-	  typedef LA_eigen< NT, D2, D3 > Other;
-	};
-	template<class,class=void> struct Property : boost::false_type {};
-	template<class D> struct Property<Has_vector_plus_minus_tag,D> : boost::true_type {};
-	template<class D> struct Property<Has_vector_scalar_ops_tag,D> : boost::true_type {};
-	template<class D> struct Property<Has_dot_product_tag,D> : boost::true_type {};
-
-	typedef Eigen::Matrix<NT,Eigen_dimension<Dim_>::value,1,Eigen::ColMajor|Eigen::AutoAlign,Eigen_dimension<Max_dim_>::value,1> Vector;
-	typedef Eigen::Matrix<NT,Eigen::Dynamic,1> Dynamic_vector;
-	typedef Construct_eigen<Vector> Construct_vector;
-
-#if (EIGEN_WORLD_VERSION>=3)
-	typedef NT const* Vector_const_iterator;
-#else
-	typedef Iterator_from_indices<const type,const NT
-#ifndef CGAL_CXX11
-	  ,NT
-#endif
-	  > Vector_const_iterator;
-#endif
-
-	template<class Vec_>static Vector_const_iterator vector_begin(Vec_ const&a){
-#if (EIGEN_WORLD_VERSION>=3)
-	  return &a[0];
-#else
-	  return Vector_const_iterator(a,0);
-#endif
-	}
-
-	template<class Vec_>static Vector_const_iterator vector_end(Vec_ const&a){
-#if (EIGEN_WORLD_VERSION>=3)
-	  // FIXME: Isn't that dangerous if a is an expression and not a concrete vector?
-	  return &a[0]+a.size();
-#else
-	  return Vector_const_iterator(a,a.size());
-#endif
-	}
-
-	typedef Eigen::Matrix<NT,dimension,dimension,Eigen::ColMajor|Eigen::AutoAlign,max_dimension,max_dimension> Square_matrix;
-	typedef Eigen::Matrix<NT,dimension,Eigen::Dynamic,Eigen::ColMajor|Eigen::AutoAlign,max_dimension,Eigen::Dynamic> Dynamic_matrix;
-		//TODO: don't pass on the values of Max_* for an expensive NT
-                // typedef ... Constructor
-                // typedef ... Accessor
-#if 0
-	private:
-	template <class T> class Canonicalize_vector {
-		typedef typename Dimension_eigen<T::SizeAtCompileTime>::type S1;
-		typedef typename Dimension_eigen<T::MaxSizeAtCompileTime>::type S2;
-		public:
-		typedef typename Vector<S1,S2>::type type;
-	};
-	public:
-#endif
-
-	template<class Vec_>static int size_of_vector(Vec_ const&v){
-		return (int)v.size();
-	}
-
-	template<class Vec_>static NT dot_product(Vec_ const&a,Vec_ const&b){
-		return a.dot(b);
-	}
-
-	template<class Vec_> static int rows(Vec_ const&v) {
-		return (int)v.rows();
-	}
-	template<class Vec_> static int columns(Vec_ const&v) {
-		return (int)v.cols();
-	}
-
-	template<class Mat_> static NT determinant(Mat_ const&m,bool=false){
-		return m.determinant();
-	}
-
-	template<class Mat_> static typename
-	Same_uncertainty_nt<CGAL::Sign, NT>::type
-	sign_of_determinant(Mat_ const&m,bool=false)
-	{
-		return CGAL::sign(m.determinant());
-	}
-
-	template<class Mat_> static int rank(Mat_ const&m){
-		// return m.rank();
-		// This one uses sqrt so cannot be used with Gmpq
-		// TODO: use different algo for different NT?
-		// Eigen::ColPivHouseholderQR<Mat_> decomp(m);
-		Eigen::FullPivLU<Mat_> decomp(m);
-		// decomp.setThreshold(0);
-		return static_cast<int>(decomp.rank());
-	}
-
-	// m*a==b
-	template<class DV, class DM, class V>
-	static bool solve(DV&a, DM const&m, V const& b){
-		//a = m.colPivHouseholderQr().solve(b);
-		a = m.fullPivLu().solve(b);
-		return b.isApprox(m*a);
-	}
-
-	static Dynamic_matrix basis(Dynamic_matrix const&m){
-		return m.fullPivLu().image(m);
-	}
-
-	template<class Vec1,class Vec2> static Vector homogeneous_add(Vec1 const&a,Vec2 const&b){
-		//TODO: use compile-time size when available
-		int d=a.size();
-		Vector v(d);
-		v << b[d-1]*a.topRows(d-1)+a[d-1]*b.topRows(d-1), a[d-1]*b[d-1];
-		return v;
-	}
-
-	template<class Vec1,class Vec2> static Vector homogeneous_sub(Vec1 const&a,Vec2 const&b){
-		int d=a.size();
-		Vector v(d);
-		v << b[d-1]*a.topRows(d-1)-a[d-1]*b.topRows(d-1), a[d-1]*b[d-1];
-		return v;
-	}
-
-	template<class Vec1,class Vec2> static std::pair<NT,NT> homogeneous_dot_product(Vec1 const&a,Vec2 const&b){
-		int d=a.size();
-		return make_pair(a.topRows(d-1).dot(b.topRows(d-1)), a[d-1]*b[d-1]);
-	}
-
-};
-}
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/function_objects_cartesian.h b/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/function_objects_cartesian.h
deleted file mode 100644
index e3acecc..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/function_objects_cartesian.h
+++ /dev/null
@@ -1,1298 +0,0 @@
-// Copyright (c) 2014
-// INRIA Saclay-Ile de France (France)
-//
-// 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(s)     : Marc Glisse
-
-#ifndef CGAL_KERNEL_D_FUNCTION_OBJECTS_CARTESIAN_H
-#define CGAL_KERNEL_D_FUNCTION_OBJECTS_CARTESIAN_H
-
-#include <CGAL/NewKernel_d/utils.h>
-#include <CGAL/Dimension.h>
-#include <CGAL/Uncertain.h>
-#include <CGAL/NewKernel_d/store_kernel.h>
-#include <CGAL/is_iterator.h>
-#include <CGAL/iterator_from_indices.h>
-#include <CGAL/number_utils.h>
-#include <CGAL/Kernel/Return_base_tag.h>
-#include <CGAL/transforming_iterator.h>
-#include <CGAL/transforming_pair_iterator.h>
-#include <CGAL/NewKernel_d/functor_tags.h>
-#include <CGAL/NewKernel_d/functor_properties.h>
-#include <CGAL/predicates/sign_of_determinant.h>
-#include <functional>
-#ifdef CGAL_CXX11
-#include <initializer_list>
-#endif
-
-namespace CGAL {
-namespace CartesianDKernelFunctors {
-namespace internal {
-template<class,int> struct Dimension_at_most { enum { value = false }; };
-template<int a,int b> struct Dimension_at_most<Dimension_tag<a>,b> {
-	enum { value = (a <= b) };
-};
-}
-
-template<class R_,class D_=typename R_::Default_ambient_dimension,bool=internal::Dimension_at_most<D_,6>::value> struct Orientation_of_points : private Store_kernel<R_> {
-	CGAL_FUNCTOR_INIT_STORE(Orientation_of_points)
-	typedef R_ R;
-	typedef typename Get_type<R, Point_tag>::type Point;
-	typedef typename Get_type<R, Orientation_tag>::type result_type;
-	typedef typename R::LA::Square_matrix Matrix;
-
-	template<class Iter>
-	result_type operator()(Iter f, Iter e)const{
-		typename Get_functor<R, Compute_point_cartesian_coordinate_tag>::type c(this->kernel());
-		typename Get_functor<R, Point_dimension_tag>::type pd(this->kernel());
-		Point const& p0=*f++;
-		int d=pd(p0);
-		Matrix m(d,d);
-		// FIXME: this writes the vector coordinates in lines ? check all the other uses in this file, this may be wrong for some.
-		for(int i=0;f!=e;++f,++i) {
-		  Point const& p=*f;
-		  for(int j=0;j<d;++j){
-		    m(i,j)=c(p,j)-c(p0,j);
-		    // should we cache the coordinates of p0 in case they are computed?
-		  }
-		}
-		return R::LA::sign_of_determinant(CGAL_MOVE(m));
-	}
-
-#ifdef CGAL_CXX11
-	// Since the dimension is at least 2, there are at least 3 points and no ambiguity with iterators.
-	// template <class...U,class=typename std::enable_if<std::is_same<Dimension_tag<sizeof...(U)-1>,typename R::Default_ambient_dimension>::value>::type>
-	template <class...U,class=typename std::enable_if<(sizeof...(U)>=3)>::type>
-	result_type operator()(U&&...u) const {
-		return operator()({std::forward<U>(u)...});
-	}
-
-	template <class P>
-	result_type operator()(std::initializer_list<P> l) const {
-		return operator()(l.begin(),l.end());
-	}
-#else
-	//should we make it template to avoid instantiation for wrong dim?
-	//or iterate outside the class?
-#define CGAL_VAR(Z,J,I) m(I,J)=c(p##I,J)-c(x,J);
-#define CGAL_VAR2(Z,I,N) BOOST_PP_REPEAT(N,CGAL_VAR,I)
-#define CGAL_CODE(Z,N,_) \
-	result_type operator()(Point const&x, BOOST_PP_ENUM_PARAMS(N,Point const&p)) const { \
-		typename Get_functor<R, Compute_point_cartesian_coordinate_tag>::type c(this->kernel()); \
-		Matrix m(N,N); \
-		BOOST_PP_REPEAT(N,CGAL_VAR2,N) \
-		return R::LA::sign_of_determinant(CGAL_MOVE(m)); \
-	}
-
-BOOST_PP_REPEAT_FROM_TO(7, 10, CGAL_CODE, _ )
-	// No need to do it for <=6, since that uses a different code path
-#undef CGAL_CODE
-#undef CGAL_VAR2
-#undef CGAL_VAR
-#endif
-};
-
-#ifdef CGAL_CXX11
-template<class R_,int d> struct Orientation_of_points<R_,Dimension_tag<d>,true> : private Store_kernel<R_> {
-	CGAL_FUNCTOR_INIT_STORE(Orientation_of_points)
-	typedef R_ R;
-	typedef typename Get_type<R, RT_tag>::type RT;
-	typedef typename Get_type<R, Point_tag>::type Point;
-	typedef typename Get_type<R, Orientation_tag>::type result_type;
-	template<class>struct Help;
-	template<int...I>struct Help<Indices<I...> > {
-		template<class C,class P,class T> result_type operator()(C const&c,P const&x,T&&t)const{
-			return sign_of_determinant<RT>(c(std::get<I/d>(t),I%d)-c(x,I%d)...);
-		}
-	};
-	template<class P0,class...P> result_type operator()(P0 const&x,P&&...p)const{
-		static_assert(d==sizeof...(P),"Wrong number of arguments");
-		typename Get_functor<R, Compute_point_cartesian_coordinate_tag>::type c(this->kernel());
-		return Help<typename N_increasing_indices<d*d>::type>()(c,x,std::forward_as_tuple(std::forward<P>(p)...));
-	}
-
-
-	template<int N,class Iter,class...U> result_type help2(Dimension_tag<N>, Iter f, Iter const&e, U&&...u)const{
-		auto const&p=*f;
-		return help2(Dimension_tag<N-1>(),++f,e,std::forward<U>(u)...,p);
-	}
-	template<class Iter,class...U> result_type help2(Dimension_tag<0>, Iter CGAL_assertion_code(f), Iter const& CGAL_assertion_code(e), U&&...u)const{
-		CGAL_assertion(f==e);
-		return operator()(std::forward<U>(u)...);
-	}
-	template<class Iter>
-	result_type operator()(Iter f, Iter e)const{
-		return help2(Dimension_tag<d+1>(),f,e);
-	}
-};
-#else
-#define CGAL_VAR(Z,J,I) c(p##I,J)-x##J
-#define CGAL_VAR2(Z,I,N) BOOST_PP_ENUM(N,CGAL_VAR,I)
-#define CGAL_VAR3(Z,N,_) Point const&p##N=*++f;
-#define CGAL_VAR4(Z,N,_) RT const&x##N=c(x,N);
-#define CGAL_CODE(Z,N,_) \
-template<class R_> struct Orientation_of_points<R_,Dimension_tag<N>,true> : private Store_kernel<R_> { \
-	CGAL_FUNCTOR_INIT_STORE(Orientation_of_points) \
-	typedef R_ R; \
-	typedef typename Get_type<R, RT_tag>::type RT; \
-	typedef typename Get_type<R, Point_tag>::type Point; \
-	typedef typename Get_type<R, Orientation_tag>::type result_type; \
-	result_type operator()(Point const&x, BOOST_PP_ENUM_PARAMS(N,Point const&p)) const { \
-		typename Get_functor<R, Compute_point_cartesian_coordinate_tag>::type c(this->kernel()); \
-		BOOST_PP_REPEAT(N,CGAL_VAR4,) \
-		return sign_of_determinant<RT>(BOOST_PP_ENUM(N,CGAL_VAR2,N)); \
-	} \
-	template<class Iter> \
-	result_type operator()(Iter f, Iter CGAL_assertion_code(e))const{ \
-		Point const&x=*f; \
-		BOOST_PP_REPEAT(N,CGAL_VAR3,) \
-		CGAL_assertion(++f==e); \
-		return operator()(x,BOOST_PP_ENUM_PARAMS(N,p)); \
-	} \
-};
-
-	BOOST_PP_REPEAT_FROM_TO(2, 7, CGAL_CODE, _ )
-#undef CGAL_CODE
-#undef CGAL_VAR4
-#undef CGAL_VAR3
-#undef CGAL_VAR2
-#undef CGAL_VAR
-
-#endif
-
-template<class R_> struct Orientation_of_points<R_,Dimension_tag<1>,true> : private Store_kernel<R_> {
-	CGAL_FUNCTOR_INIT_STORE(Orientation_of_points)
-	typedef R_ R;
-	typedef typename Get_type<R, RT_tag>::type RT;
-	typedef typename Get_type<R, Point_tag>::type Point;
-	typedef typename Get_type<R, Orientation_tag>::type result_type;
-	result_type operator()(Point const&x, Point const&y) const {
-		typename Get_functor<R, Compute_point_cartesian_coordinate_tag>::type c(this->kernel());
-		// No sign_of_determinant(RT) :-(
-		return CGAL::compare(c(y,0),c(x,0));
-	}
-	template<class Iter>
-	result_type operator()(Iter f, Iter CGAL_assertion_code(e))const{
-		Point const&x=*f;
-		Point const&y=*++f;
-		CGAL_assertion(++f==e);
-		return operator()(x,y);
-	}
-};
-}
-
-CGAL_KD_DEFAULT_FUNCTOR(Orientation_of_points_tag,(CartesianDKernelFunctors::Orientation_of_points<K>),(Point_tag),(Point_dimension_tag,Compute_point_cartesian_coordinate_tag));
-
-namespace CartesianDKernelFunctors {
-template<class R_> struct Orientation_of_vectors : private Store_kernel<R_> {
-	CGAL_FUNCTOR_INIT_STORE(Orientation_of_vectors)
-	typedef R_ R;
-	typedef typename Get_type<R, Vector_tag>::type Vector;
-	typedef typename Get_type<R, Orientation_tag>::type result_type;
-	typedef typename R::LA::Square_matrix Matrix;
-
-	template<class Iter>
-	result_type operator()(Iter f, Iter e)const{
-		typename Get_functor<R, Compute_vector_cartesian_coordinate_tag>::type c(this->kernel());
-		typename Get_functor<R, Point_dimension_tag>::type vd(this->kernel());
-		// FIXME: Uh? Using it on a vector ?!
-		Vector const& v0=*f;
-		int d=vd(v0);
-		Matrix m(d,d);
-		for(int j=0;j<d;++j){
-			m(0,j)=c(v0,j);
-		}
-		for(int i=1;++f!=e;++i) {
-			Vector const& v=*f;
-		for(int j=0;j<d;++j){
-			m(i,j)=c(v,j);
-		}
-		}
-		return R::LA::sign_of_determinant(CGAL_MOVE(m));
-	}
-
-#ifdef CGAL_CXX11
-	template <class...U,class=typename std::enable_if<(sizeof...(U)>=3)>::type>
-	result_type operator()(U&&...u) const {
-		return operator()({std::forward<U>(u)...});
-	}
-
-	template <class V>
-	result_type operator()(std::initializer_list<V> l) const {
-		return operator()(l.begin(),l.end());
-	}
-#else
-	//TODO
-#endif
-};
-}
-
-CGAL_KD_DEFAULT_FUNCTOR(Orientation_of_vectors_tag,(CartesianDKernelFunctors::Orientation_of_vectors<K>),(Vector_tag),(Point_dimension_tag,Compute_vector_cartesian_coordinate_tag));
-
-namespace CartesianDKernelFunctors {
-template<class R_> struct Linear_rank : private Store_kernel<R_> {
-	CGAL_FUNCTOR_INIT_STORE(Linear_rank)
-	typedef R_ R;
-	typedef typename Get_type<R, Vector_tag>::type Vector;
-	// Computing a sensible Uncertain<int> is not worth it
-	typedef int result_type;
-	typedef typename R::LA::Dynamic_matrix Matrix;
-
-	template<class Iter>
-	result_type operator()(Iter f, Iter e)const{
-		typename Get_functor<R, Compute_vector_cartesian_coordinate_tag>::type c(this->kernel());
-		typename Get_functor<R, Point_dimension_tag>::type vd(this->kernel());
-		std::ptrdiff_t n=std::distance(f,e);
-		if (n==0) return 0;
-		Vector const& v0 = *f;
-		// FIXME: Uh? Using it on a vector ?!
-		int d=vd(v0);
-		Matrix m(d,n);
-		for(int j=0;j<d;++j){
-		  m(j,0)=c(v0,j);
-		}
-		for(int i=1; ++f!=e; ++i){
-		  Vector const& v = *f;
-		  for(int j=0;j<d;++j){
-		    m(j,i)=c(v,j);
-		  }
-		}
-		return R::LA::rank(CGAL_MOVE(m));
-	}
-};
-}
-
-CGAL_KD_DEFAULT_FUNCTOR(Linear_rank_tag,(CartesianDKernelFunctors::Linear_rank<K>),(Vector_tag),(Point_dimension_tag,Compute_vector_cartesian_coordinate_tag));
-
-namespace CartesianDKernelFunctors {
-template<class R_> struct Linearly_independent : private Store_kernel<R_> {
-	CGAL_FUNCTOR_INIT_STORE(Linearly_independent)
-	typedef R_ R;
-	typedef typename Get_type<R, Bool_tag>::type result_type;
-
-	template<class Iter>
-	result_type operator()(Iter f, Iter e)const{
-		typename Get_functor<R, Point_dimension_tag>::type vd(this->kernel());
-		std::ptrdiff_t n=std::distance(f,e);
-		// FIXME: Uh? Using it on a vector ?!
-		int d=vd(*f);
-		if (n>d) return false;
-		typename Get_functor<R, Linear_rank_tag>::type lr(this->kernel());
-		return lr(f,e) == n;
-	}
-};
-}
-
-CGAL_KD_DEFAULT_FUNCTOR(Linearly_independent_tag,(CartesianDKernelFunctors::Linearly_independent<K>),(Vector_tag),(Point_dimension_tag,Linear_rank_tag));
-
-namespace CartesianDKernelFunctors {
-template<class R_> struct Contained_in_linear_hull : private Store_kernel<R_> {
-	CGAL_FUNCTOR_INIT_STORE(Contained_in_linear_hull)
-	typedef R_ R;
-	typedef typename Get_type<R, Vector_tag>::type Vector;
-	// Computing a sensible Uncertain<bool> is not worth it
-	typedef bool result_type;
-	typedef typename R::LA::Dynamic_matrix Matrix;
-
-	template<class Iter,class V>
-	result_type operator()(Iter f, Iter e,V const&w)const{
-		typename Get_functor<R, Compute_vector_cartesian_coordinate_tag>::type c(this->kernel());
-		typename Get_functor<R, Point_dimension_tag>::type vd(this->kernel());
-		std::ptrdiff_t n=std::distance(f,e);
-		if (n==0) return false;
-		// FIXME: Uh? Using it on a vector ?!
-		int d=vd(w);
-		Matrix m(d,n+1);
-		for(int i=0; f!=e; ++f,++i){
-		  Vector const& v = *f;
-		  for(int j=0;j<d;++j){
-		    m(j,i)=c(v,j);
-		  }
-		}
-		for(int j=0;j<d;++j){
-		  m(j,n)=c(w,j);
-		}
-		int r1 = R::LA::rank(m);
-		// FIXME: Don't use eigen directly, go through an interface in LA...
-		m.conservativeResize(Eigen::NoChange, n);
-		int r2 = R::LA::rank(CGAL_MOVE(m));
-		return r1 == r2;
-		// TODO: This is very very far from optimal...
-	}
-};
-}
-
-CGAL_KD_DEFAULT_FUNCTOR(Contained_in_linear_hull_tag,(CartesianDKernelFunctors::Contained_in_linear_hull<K>),(Vector_tag),(Point_dimension_tag,Compute_vector_cartesian_coordinate_tag));
-
-namespace CartesianDKernelFunctors {
-template<class R_> struct Affine_rank : private Store_kernel<R_> {
-	CGAL_FUNCTOR_INIT_STORE(Affine_rank)
-	typedef R_ R;
-	typedef typename Get_type<R, Point_tag>::type Point;
-	// Computing a sensible Uncertain<int> is not worth it
-	typedef int result_type;
-	typedef typename R::LA::Dynamic_matrix Matrix;
-
-	template<class Iter>
-	result_type operator()(Iter f, Iter e)const{
-		typename Get_functor<R, Compute_point_cartesian_coordinate_tag>::type c(this->kernel());
-		typename Get_functor<R, Point_dimension_tag>::type pd(this->kernel());
-		int n=(int)std::distance(f,e);
-		if (--n<=0) return n;
-		Point const& p0 = *f;
-		int d=pd(p0);
-		Matrix m(d,n);
-		for(int i=0; ++f!=e; ++i){
-		  Point const& p = *f;
-		  for(int j=0;j<d;++j){
-		    m(j,i)=c(p,j)-c(p0,j);
-		    // TODO: cache p0[j] in case it is computed?
-		  }
-		}
-		return R::LA::rank(CGAL_MOVE(m));
-	}
-};
-}
-
-CGAL_KD_DEFAULT_FUNCTOR(Affine_rank_tag,(CartesianDKernelFunctors::Affine_rank<K>),(Point_tag),(Point_dimension_tag,Compute_point_cartesian_coordinate_tag));
-
-namespace CartesianDKernelFunctors {
-template<class R_> struct Affinely_independent : private Store_kernel<R_> {
-	CGAL_FUNCTOR_INIT_STORE(Affinely_independent)
-	typedef R_ R;
-	typedef typename Get_type<R, Bool_tag>::type result_type;
-
-	template<class Iter>
-	result_type operator()(Iter f, Iter e)const{
-		typename Get_functor<R, Point_dimension_tag>::type pd(this->kernel());
-		std::ptrdiff_t n=std::distance(f,e);
-		int d=pd(*f);
-		if (--n>d) return false;
-		typename Get_functor<R, Affine_rank_tag>::type ar(this->kernel());
-		return ar(f,e) == n;
-	}
-};
-}
-
-CGAL_KD_DEFAULT_FUNCTOR(Affinely_independent_tag,(CartesianDKernelFunctors::Affinely_independent<K>),(Point_tag),(Point_dimension_tag,Affine_rank_tag));
-
-namespace CartesianDKernelFunctors {
-template<class R_> struct Contained_in_simplex : private Store_kernel<R_> {
-	CGAL_FUNCTOR_INIT_STORE(Contained_in_simplex)
-	typedef R_ R;
-	typedef typename Get_type<R, Point_tag>::type Point;
-	// Computing a sensible Uncertain<*> is not worth it
-	// typedef typename Get_type<R, Boolean_tag>::type result_type;
-	typedef bool result_type;
-	typedef typename Increment_dimension<typename R::Default_ambient_dimension>::type D1;
-	typedef typename Increment_dimension<typename R::Max_ambient_dimension>::type D2;
-	typedef typename R::LA::template Rebind_dimension<D1,D2>::Other LA;
-	typedef typename LA::Dynamic_matrix Matrix;
-	typedef typename LA::Dynamic_vector DynVec;
-	typedef typename LA::Vector Vec;
-
-	template<class Iter, class P>
-	result_type operator()(Iter f, Iter e, P const&q)const{
-		typename Get_functor<R, Compute_point_cartesian_coordinate_tag>::type c(this->kernel());
-		typename Get_functor<R, Point_dimension_tag>::type pd(this->kernel());
-		std::ptrdiff_t n=std::distance(f,e);
-		if (n==0) return false;
-		int d=pd(q);
-		Matrix m(d+1,n);
-		DynVec a(n);
-		// FIXME: Should use the proper vector constructor (Iterator_and_last)
-		Vec b(d+1);
-		for(int j=0;j<d;++j) b[j]=c(q,j);
-		b[d]=1;
-
-		for(int i=0; f!=e; ++i,++f){
-		  Point const& p = *f;
-		  for(int j=0;j<d;++j){
-		    m(j,i)=c(p,j);
-		  }
-		  m(d,i)=1;
-		}
-		if (!LA::solve(a,CGAL_MOVE(m),CGAL_MOVE(b))) return false;
-		for(int i=0;i<n;++i){
-		  if (a[i]<0) return false;
-		}
-		return true;
-	}
-};
-}
-
-CGAL_KD_DEFAULT_FUNCTOR(Contained_in_simplex_tag,(CartesianDKernelFunctors::Contained_in_simplex<K>),(Point_tag),(Point_dimension_tag,Compute_point_cartesian_coordinate_tag));
-
-namespace CartesianDKernelFunctors {
-  namespace internal {
-    template<class Ref_>
-    struct Matrix_col_access {
-      typedef Ref_ result_type;
-      int col;
-      Matrix_col_access(int r):col(r){}
-      template<class Mat> Ref_ operator()(Mat const& m, std::ptrdiff_t row)const{
-	return m(row,col);
-      }
-    };
-  }
-template<class R_> struct Linear_base : private Store_kernel<R_> {
-	CGAL_FUNCTOR_INIT_STORE(Linear_base)
-	typedef R_ R;
-	typedef typename Get_type<R, Vector_tag>::type Vector;
-	typedef typename Get_type<R, FT_tag>::type FT;
-	typedef void result_type;
-	typedef typename R::LA::Dynamic_matrix Matrix;
-
-	template<class Iter, class Oter>
-	result_type operator()(Iter f, Iter e, Oter&o)const{
-		typename Get_functor<R, Compute_vector_cartesian_coordinate_tag>::type c(this->kernel());
-		typename Get_functor<R, Point_dimension_tag>::type vd(this->kernel());
-		typename Get_functor<R, Construct_ttag<Vector_tag> >::type cv(this->kernel());
-		std::ptrdiff_t n=std::distance(f,e);
-		if (n==0) return;
-		Vector const& v0 = *f;
-		// FIXME: Uh? Using it on a vector ?!
-		int d=vd(v0);
-		Matrix m(d,n);
-		for(int j=0;j<d;++j){
-		  m(0,j)=c(v0,j);
-		}
-		for(int i=1; ++f!=e; ++i){
-		  Vector const& v = *f;
-		  for(int j=0;j<d;++j){
-		    m(i,j)=c(v,j);
-		  }
-		}
-		Matrix b = R::LA::basis(CGAL_MOVE(m));
-		for(int i=0; i < R::LA::columns(b); ++i){
-		  //*o++ = Vector(b.col(i));
-		  typedef
-#ifdef CGAL_CXX11
-		    decltype(std::declval<const Matrix>()(0,0))
-#else
-		    FT
-#endif
-		    Ref;
-		  typedef Iterator_from_indices<Matrix, FT, Ref,
-			  internal::Matrix_col_access<Ref> > IFI;
-		  *o++ = cv(IFI(b,0,i),IFI(b,d,i));
-		}
-	}
-};
-}
-
-CGAL_KD_DEFAULT_FUNCTOR(Linear_base_tag,(CartesianDKernelFunctors::Linear_base<K>),(Vector_tag),(Point_dimension_tag,Compute_vector_cartesian_coordinate_tag));
-
-#if 0
-namespace CartesianDKernelFunctors {
-template<class R_,bool=boost::is_same<typename R_::Point,typename R_::Vector>::value> struct Orientation : private Store_kernel<R_> {
-	CGAL_FUNCTOR_INIT_STORE(Orientation)
-	typedef R_ R;
-	typedef typename Get_type<R, Vector_tag>::type Vector;
-	typedef typename Get_type<R, Point_tag>::type Point;
-	typedef typename Get_type<R, Orientation_tag>::type result_type;
-	typedef typename Get_functor<R, Orientation_of_points_tag>::type OP;
-	typedef typename Get_functor<R, Orientation_of_vectors_tag>::type OV;
-
-	//FIXME!!!
-	//when Point and Vector are distinct types, the dispatch should be made
-	//in a way that doesn't instantiate a conversion from Point to Vector
-	template<class Iter>
-	result_type operator()(Iter const&f, Iter const& e)const{
-		typename Get_functor<R, Point_dimension_tag>::type pd(this->kernel());
-		typename std::iterator_traits<Iter>::difference_type d=std::distance(f,e);
-		int dim=pd(*f); // BAD
-		if(d==dim) return OV(this->kernel())(f,e);
-		CGAL_assertion(d==dim+1);
-		return OP(this->kernel())(f,e);
-	}
-	//TODO: version that takes objects directly instead of iterators
-};
-
-template<class R_> struct Orientation<R_,false> : private Store_kernel<R_> {
-	CGAL_FUNCTOR_INIT_STORE(Orientation)
-	typedef R_ R;
-	typedef typename Get_type<R, Vector_tag>::type Vector;
-	typedef typename Get_type<R, Point_tag>::type Point;
-	typedef typename Get_type<R, Orientation_tag>::type result_type;
-	typedef typename Get_functor<R, Orientation_of_points_tag>::type OP;
-	typedef typename Get_functor<R, Orientation_of_vectors_tag>::type OV;
-	typedef typename R::LA::Square_matrix Matrix;
-
-	//FIXME!!!
-	//when Point and Vector are distinct types, the dispatch should be made
-	//in a way that doesn't instantiate a conversion from Point to Vector
-	template<class Iter>
-	typename boost::enable_if<is_iterator_to<Iter,Point>,result_type>::type
-	operator()(Iter const&f, Iter const& e)const{
-		return OP(this->kernel())(f,e);
-	}
-	template<class Iter>
-	typename boost::enable_if<is_iterator_to<Iter,Vector>,result_type>::type
-	operator()(Iter const&f, Iter const& e)const{
-		return OV(this->kernel())(f,e);
-	}
-	//TODO: version that takes objects directly instead of iterators
-};
-}
-#endif
-
-namespace CartesianDKernelFunctors {
-template<class R_> struct Side_of_oriented_sphere : private Store_kernel<R_> {
-	CGAL_FUNCTOR_INIT_STORE(Side_of_oriented_sphere)
-	typedef R_ R;
-	typedef typename Get_type<R, RT_tag>::type RT;
-	typedef typename Get_type<R, Point_tag>::type Point;
-	typedef typename Get_type<R, Oriented_side_tag>::type result_type;
-	typedef typename Increment_dimension<typename R::Default_ambient_dimension>::type D1;
-	typedef typename Increment_dimension<typename R::Max_ambient_dimension>::type D2;
-	typedef typename R::LA::template Rebind_dimension<D1,D2>::Other LA;
-	typedef typename LA::Square_matrix Matrix;
-
-	template<class Iter>
-	result_type operator()(Iter f, Iter const& e)const{
-	  Point const& p0=*f++; // *--e ?
-	  return this->operator()(f,e,p0);
-	}
-
-	template<class Iter>
-	result_type operator()(Iter f, Iter const& e, Point const& p0) const {
-	  typedef typename Get_functor<R, Squared_distance_to_origin_tag>::type Sqdo;
-	  typename Get_functor<R, Compute_point_cartesian_coordinate_tag>::type c(this->kernel());
-	  typename Get_functor<R, Point_dimension_tag>::type pd(this->kernel());
-
-	  int d=pd(p0);
-	  Matrix m(d+1,d+1);
-	  if(CGAL::Is_stored<Sqdo>::value) {
-	    Sqdo sqdo(this->kernel());
-	    for(int i=0;f!=e;++f,++i) {
-	      Point const& p=*f;
-	      for(int j=0;j<d;++j){
-		RT const& x=c(p,j);
-		m(i,j)=x-c(p0,j);
-	      }
-	      m(i,d) = sqdo(p) - sqdo(p0);
-	    }
-	  } else {
-	    for(int i=0;f!=e;++f,++i) {
-	      Point const& p=*f;
-	      m(i,d) = 0;
-	      for(int j=0;j<d;++j){
-		RT const& x=c(p,j);
-		m(i,j)=x-c(p0,j);
-		m(i,d)+=CGAL::square(m(i,j));
-	      }
-	    }
-	  }
-	  if(d%2)
-	    return -LA::sign_of_determinant(CGAL_MOVE(m));
-	  else
-	    return LA::sign_of_determinant(CGAL_MOVE(m));
-	}
-
-#ifdef CGAL_CXX11
-	template <class...U,class=typename std::enable_if<(sizeof...(U)>=4)>::type>
-	result_type operator()(U&&...u) const {
-		return operator()({std::forward<U>(u)...});
-	}
-
-	template <class P>
-	result_type operator()(std::initializer_list<P> l) const {
-		return operator()(l.begin(),l.end());
-	}
-#else
-	//TODO
-#endif
-};
-}
-
-CGAL_KD_DEFAULT_FUNCTOR(Side_of_oriented_sphere_tag,(CartesianDKernelFunctors::Side_of_oriented_sphere<K>),(Point_tag),(Point_dimension_tag,Squared_distance_to_origin_tag,Compute_point_cartesian_coordinate_tag));
-
-namespace CartesianDKernelFunctors {
-template <class R_> struct Construct_circumcenter : Store_kernel<R_> {
-  CGAL_FUNCTOR_INIT_STORE(Construct_circumcenter)
-  typedef typename Get_type<R_, Point_tag>::type Point;
-  typedef Point result_type;
-  typedef typename Get_type<R_, FT_tag>::type FT;
-  template <class Iter>
-  result_type operator()(Iter f, Iter e)const{
-    typedef typename Get_type<R_, Point_tag>::type      Point;
-    typedef typename R_::LA LA;
-    typename Get_functor<R_, Compute_point_cartesian_coordinate_tag>::type c(this->kernel());
-    typename Get_functor<R_, Construct_ttag<Point_tag> >::type cp(this->kernel());
-    typename Get_functor<R_, Point_dimension_tag>::type pd(this->kernel());
-    typename Get_functor<R_, Squared_distance_to_origin_tag>::type sdo(this->kernel());
-
-    Point const& p0=*f;
-    int d = pd(p0);
-    if (d+1 == std::distance(f,e))
-    {
-      // 2*(x-y).c == x^2-y^2
-      typedef typename LA::Square_matrix Matrix;
-      typedef typename LA::Vector Vec;
-      typedef typename LA::Construct_vector CVec;
-      FT const& n0 = sdo(p0);
-      Matrix m(d,d);
-      Vec b = typename CVec::Dimension()(d);
-      // Write the point coordinates in lines.
-      int i;
-      for(i=0; ++f!=e; ++i) {
-	Point const& p=*f;
-	for(int j=0;j<d;++j) {
-	  m(i,j)=2*(c(p,j)-c(p0,j));
-	  b[i] = sdo(p) - n0;
-	}
-      }
-      CGAL_assertion (i == d);
-      Vec res = typename CVec::Dimension()(d);;
-      //std::cout << "Mat: " << m << "\n Vec: " << one << std::endl;
-      LA::solve(res, CGAL_MOVE(m), CGAL_MOVE(b));
-      //std::cout << "Sol: " << res << std::endl;
-      return cp(d,LA::vector_begin(res),LA::vector_end(res));
-    }
-    else
-    {
-      /*
-       * Matrix P=(p1, p2, ...) (each point as a column)
-       * Matrix Q=2*t(p2-p1,p3-p1, ...) (each vector as a line)
-       * Matrix M: QP, adding a line of 1 at the top
-       * Vector B: (1, p2^2-p1^2, p3^2-p1^2, ...)
-       * Solve ML=B, the center of the sphere is PL
-       *
-       * It would likely be faster to write P then transpose, multiply,
-       * etc instead of doing it by hand.
-       */
-      // TODO: check for degenerate cases?
-
-      typedef typename R_::Max_ambient_dimension D2;
-      typedef typename R_::LA::template Rebind_dimension<Dynamic_dimension_tag,D2>::Other LAd;
-      typedef typename LAd::Square_matrix Matrix;
-      typedef typename LAd::Vector Vec;
-      typename Get_functor<R_, Scalar_product_tag>::type sp(this->kernel());
-      int k=static_cast<int>(std::distance(f,e));
-      int d=pd(p0);
-      Matrix m(k,k);
-      Vec b(k);
-      Vec l(k);
-      int j,i=0;
-      for(Iter f2=f;f2!=e;++f2,++i){
-	b(i)=m(i,i)=sdo(*f2);
-	j=0;
-	for(Iter f3=f;f3!=e;++f3,++j){
-	  m(j,i)=m(i,j)=sp(*f2,*f3);
-	}
-      }
-      for(i=1;i<k;++i){
-	b(i)-=b(0);
-	for(j=0;j<k;++j){
-	  m(i,j)=2*(m(i,j)-m(0,j));
-	}
-      }
-      for(j=0;j<k;++j) m(0,j)=1;
-      b(0)=1;
-
-      LAd::solve(l,CGAL_MOVE(m),CGAL_MOVE(b));
-
-      typename LA::Vector center=typename LA::Construct_vector::Dimension()(d);
-      for(i=0;i<d;++i) center(i)=0;
-      j=0;
-      for(Iter f2=f;f2!=e;++f2,++j){
-	for(i=0;i<d;++i){
-	  center(i)+=l(j)*c(*f2,i);
-	}
-      }
-
-      return cp(LA::vector_begin(center),LA::vector_end(center));
-    }
-  }
-};
-}
-
-CGAL_KD_DEFAULT_FUNCTOR(Construct_circumcenter_tag,(CartesianDKernelFunctors::Construct_circumcenter<K>),(Point_tag),(Construct_ttag<Point_tag>,Compute_point_cartesian_coordinate_tag,Scalar_product_tag,Squared_distance_to_origin_tag,Point_dimension_tag));
-
-namespace CartesianDKernelFunctors {
-template <class R_> struct Squared_circumradius : Store_kernel<R_> {
-  CGAL_FUNCTOR_INIT_STORE(Squared_circumradius)
-  typedef typename Get_type<R_, FT_tag>::type result_type;
-  template <class Iter>
-  result_type operator()(Iter f, Iter e)const{
-    typename Get_functor<R_, Construct_circumcenter_tag>::type cc(this->kernel());
-    typename Get_functor<R_, Squared_distance_tag>::type sd(this->kernel());
-    return sd(cc(f, e), *f);
-  }
-};
-}
-
-CGAL_KD_DEFAULT_FUNCTOR(Squared_circumradius_tag,(CartesianDKernelFunctors::Squared_circumradius<K>),(Point_tag),(Construct_circumcenter_tag,Squared_distance_tag));
-
-namespace CartesianDKernelFunctors {
-// TODO: implement it directly, it should be at least as fast as Side_of_oriented_sphere.
-template<class R_> struct Side_of_bounded_sphere : private Store_kernel<R_> {
-	CGAL_FUNCTOR_INIT_STORE(Side_of_bounded_sphere)
-	typedef R_ R;
-	typedef typename Get_type<R, Point_tag>::type Point;
-	typedef typename Get_type<R, Bounded_side_tag>::type result_type;
-
-	template<class Iter>
-	result_type operator()(Iter f, Iter const& e) const {
-	  Point const& p0 = *f++; // *--e ?
-	  typename Get_functor<R, Point_dimension_tag>::type pd(this->kernel());
-	  //FIXME: Doesn't work for non-full dimension.
-	  CGAL_assertion (std::distance(f,e) == pd(p0)+1);
-	  return operator() (f, e, p0);
-	}
-
-	template<class Iter>
-	result_type operator()(Iter const& f, Iter const& e, Point const& p0) const {
-	  typename Get_functor<R, Side_of_oriented_sphere_tag>::type sos (this->kernel());
-	  typename Get_functor<R, Orientation_of_points_tag>::type op (this->kernel());
-	  // enum_cast is not very generic, but since this function isn't supposed to remain like this...
-	  return enum_cast<Bounded_side> (sos (f, e, p0) * op (f, e));
-	}
-
-#ifdef CGAL_CXX11
-	template <class...U,class=typename std::enable_if<(sizeof...(U)>=4)>::type>
-	result_type operator()(U&&...u) const {
-		return operator()({std::forward<U>(u)...});
-	}
-
-	template <class P>
-	result_type operator()(std::initializer_list<P> l) const {
-		return operator()(l.begin(),l.end());
-	}
-#else
-	//TODO
-#endif
-};
-}
-
-CGAL_KD_DEFAULT_FUNCTOR(Side_of_bounded_sphere_tag,(CartesianDKernelFunctors::Side_of_bounded_sphere<K>),(Point_tag),(Side_of_oriented_sphere_tag,Orientation_of_points_tag));
-
-namespace CartesianDKernelFunctors {
-template<class R_> struct Side_of_bounded_circumsphere : private Store_kernel<R_> {
-	CGAL_FUNCTOR_INIT_STORE(Side_of_bounded_circumsphere)
-	typedef typename Get_type<R_, Bounded_side_tag>::type result_type;
-
-	template<class Iter, class P>
-	result_type operator()(Iter f, Iter const& e, P const& p0) const {
-	  // TODO: Special case when the dimension is full.
-	  typename Get_functor<R_, Construct_circumcenter_tag>::type cc(this->kernel());
-	  typename Get_functor<R_, Compare_distance_tag>::type cd(this->kernel());
-
-	  return enum_cast<Bounded_side>(cd(cc(f, e), *f, p0));
-	}
-};
-}
-
-CGAL_KD_DEFAULT_FUNCTOR(Side_of_bounded_circumsphere_tag,(CartesianDKernelFunctors::Side_of_bounded_circumsphere<K>),(Point_tag),(Squared_distance_tag,Construct_circumcenter_tag));
-
-namespace CartesianDKernelFunctors {
-template<class R_> struct Point_to_vector : private Store_kernel<R_> {
-	CGAL_FUNCTOR_INIT_STORE(Point_to_vector)
-	typedef R_ R;
-	typedef typename Get_type<R, RT_tag>::type RT;
-	typedef typename Get_type<R, Vector_tag>::type Vector;
-	typedef typename Get_type<R, Point_tag>::type Point;
-	typedef typename Get_functor<R, Construct_ttag<Vector_tag> >::type CV;
-	typedef typename Get_functor<R, Construct_ttag<Point_cartesian_const_iterator_tag> >::type CI;
-	typedef Vector result_type;
-	typedef Point argument_type;
-	result_type operator()(argument_type const&v)const{
-		CI ci(this->kernel());
-		return CV(this->kernel())(ci(v,Begin_tag()),ci(v,End_tag()));
-	}
-};
-}
-
-CGAL_KD_DEFAULT_FUNCTOR(Point_to_vector_tag,(CartesianDKernelFunctors::Point_to_vector<K>),(Point_tag,Vector_tag),(Construct_ttag<Vector_tag>, Construct_ttag<Point_cartesian_const_iterator_tag>));
-
-namespace CartesianDKernelFunctors {
-template<class R_> struct Vector_to_point : private Store_kernel<R_> {
-	CGAL_FUNCTOR_INIT_STORE(Vector_to_point)
-	typedef R_ R;
-	typedef typename Get_type<R, RT_tag>::type RT;
-	typedef typename Get_type<R, Vector_tag>::type Vector;
-	typedef typename Get_type<R, Point_tag>::type Point;
-	typedef typename Get_functor<R, Construct_ttag<Point_tag> >::type CP;
-	typedef typename Get_functor<R, Construct_ttag<Vector_cartesian_const_iterator_tag> >::type CI;
-	typedef Point result_type;
-	typedef Vector argument_type;
-	result_type operator()(argument_type const&v)const{
-		CI ci(this->kernel());
-		return CP(this->kernel())(ci(v,Begin_tag()),ci(v,End_tag()));
-	}
-};
-}
-
-CGAL_KD_DEFAULT_FUNCTOR(Vector_to_point_tag,(CartesianDKernelFunctors::Vector_to_point<K>),(Point_tag,Vector_tag),(Construct_ttag<Point_tag>, Construct_ttag<Vector_cartesian_const_iterator_tag>));
-
-namespace CartesianDKernelFunctors {
-template<class R_> struct Opposite_vector : private Store_kernel<R_> {
-	CGAL_FUNCTOR_INIT_STORE(Opposite_vector)
-	typedef R_ R;
-	typedef typename Get_type<R, RT_tag>::type RT;
-	typedef typename Get_type<R, Vector_tag>::type Vector;
-	typedef typename Get_functor<R, Construct_ttag<Vector_tag> >::type CV;
-	typedef typename Get_functor<R, Construct_ttag<Vector_cartesian_const_iterator_tag> >::type CI;
-	typedef Vector result_type;
-	typedef Vector argument_type;
-	result_type operator()(Vector const&v)const{
-		CI ci(this->kernel());
-		return CV(this->kernel())(make_transforming_iterator(ci(v,Begin_tag()),std::negate<RT>()),make_transforming_iterator(ci(v,End_tag()),std::negate<RT>()));
-	}
-};
-}
-
-CGAL_KD_DEFAULT_FUNCTOR(Opposite_vector_tag,(CartesianDKernelFunctors::Opposite_vector<K>),(Vector_tag),(Construct_ttag<Vector_tag>, Construct_ttag<Vector_cartesian_const_iterator_tag>));
-
-namespace CartesianDKernelFunctors {
-template<class R_> struct Scaled_vector : private Store_kernel<R_> {
-	CGAL_FUNCTOR_INIT_STORE(Scaled_vector)
-	typedef R_ R;
-	typedef typename Get_type<R, FT_tag>::type FT;
-	typedef typename Get_type<R, Vector_tag>::type Vector;
-	typedef typename Get_functor<R, Construct_ttag<Vector_tag> >::type CV;
-	typedef typename Get_functor<R, Construct_ttag<Vector_cartesian_const_iterator_tag> >::type CI;
-	typedef Vector result_type;
-	typedef Vector first_argument_type;
-	typedef FT second_argument_type;
-	result_type operator()(Vector const&v,FT const& s)const{
-		CI ci(this->kernel());
-		return CV(this->kernel())(make_transforming_iterator(ci(v,Begin_tag()),Scale<FT>(s)),make_transforming_iterator(ci(v,End_tag()),Scale<FT>(s)));
-	}
-};
-}
-
-CGAL_KD_DEFAULT_FUNCTOR(Scaled_vector_tag,(CartesianDKernelFunctors::Scaled_vector<K>),(Vector_tag),(Construct_ttag<Vector_tag>, Construct_ttag<Vector_cartesian_const_iterator_tag>));
-
-namespace CartesianDKernelFunctors {
-template<class R_> struct Sum_of_vectors : private Store_kernel<R_> {
-	CGAL_FUNCTOR_INIT_STORE(Sum_of_vectors)
-	typedef R_ R;
-	typedef typename Get_type<R, RT_tag>::type RT;
-	typedef typename Get_type<R, Vector_tag>::type Vector;
-	typedef typename Get_functor<R, Construct_ttag<Vector_tag> >::type CV;
-	typedef typename Get_functor<R, Construct_ttag<Vector_cartesian_const_iterator_tag> >::type CI;
-	typedef Vector result_type;
-	typedef Vector first_argument_type;
-	typedef Vector second_argument_type;
-	result_type operator()(Vector const&a, Vector const&b)const{
-		CI ci(this->kernel());
-		return CV(this->kernel())(make_transforming_pair_iterator(ci(a,Begin_tag()),ci(b,Begin_tag()),std::plus<RT>()),make_transforming_pair_iterator(ci(a,End_tag()),ci(b,End_tag()),std::plus<RT>()));
-	}
-};
-}
-
-CGAL_KD_DEFAULT_FUNCTOR(Sum_of_vectors_tag,(CartesianDKernelFunctors::Sum_of_vectors<K>),(Vector_tag),(Construct_ttag<Vector_tag>, Construct_ttag<Vector_cartesian_const_iterator_tag>));
-
-namespace CartesianDKernelFunctors {
-template<class R_> struct Difference_of_vectors : private Store_kernel<R_> {
-	CGAL_FUNCTOR_INIT_STORE(Difference_of_vectors)
-	typedef R_ R;
-	typedef typename Get_type<R, RT_tag>::type RT;
-	typedef typename Get_type<R, Vector_tag>::type Vector;
-	typedef typename Get_functor<R, Construct_ttag<Vector_tag> >::type CV;
-	typedef typename Get_functor<R, Construct_ttag<Vector_cartesian_const_iterator_tag> >::type CI;
-	typedef Vector result_type;
-	typedef Vector first_argument_type;
-	typedef Vector second_argument_type;
-	result_type operator()(Vector const&a, Vector const&b)const{
-		CI ci(this->kernel());
-		return CV(this->kernel())(make_transforming_pair_iterator(ci(a,Begin_tag()),ci(b,Begin_tag()),std::minus<RT>()),make_transforming_pair_iterator(ci(a,End_tag()),ci(b,End_tag()),std::minus<RT>()));
-	}
-};
-}
-
-CGAL_KD_DEFAULT_FUNCTOR(Difference_of_vectors_tag,(CartesianDKernelFunctors::Difference_of_vectors<K>),(Vector_tag),(Construct_ttag<Vector_tag>, Construct_ttag<Vector_cartesian_const_iterator_tag>));
-
-namespace CartesianDKernelFunctors {
-template<class R_> struct Translated_point : private Store_kernel<R_> {
-	CGAL_FUNCTOR_INIT_STORE(Translated_point)
-	typedef R_ R;
-	typedef typename Get_type<R, RT_tag>::type RT;
-	typedef typename Get_type<R, Vector_tag>::type Vector;
-	typedef typename Get_type<R, Point_tag>::type Point;
-	typedef typename Get_functor<R, Construct_ttag<Point_tag> >::type CP;
-	typedef typename Get_functor<R, Construct_ttag<Vector_cartesian_const_iterator_tag> >::type CVI;
-	typedef typename Get_functor<R, Construct_ttag<Point_cartesian_const_iterator_tag> >::type CPI;
-	typedef Point  result_type;
-	typedef Point  first_argument_type;
-	typedef Vector second_argument_type;
-	result_type operator()(Point const&a, Vector const&b)const{
-		CVI cvi(this->kernel());
-		CPI cpi(this->kernel());
-		return CP(this->kernel())(make_transforming_pair_iterator(cpi(a,Begin_tag()),cvi(b,Begin_tag()),std::plus<RT>()),make_transforming_pair_iterator(cpi(a,End_tag()),cvi(b,End_tag()),std::plus<RT>()));
-	}
-};
-}
-
-CGAL_KD_DEFAULT_FUNCTOR(Translated_point_tag,(CartesianDKernelFunctors::Translated_point<K>),(Point_tag, Vector_tag),(Construct_ttag<Point_tag>, Construct_ttag<Vector_cartesian_const_iterator_tag>, Construct_ttag<Point_cartesian_const_iterator_tag>));
-
-namespace CartesianDKernelFunctors {
-template<class R_> struct Difference_of_points : private Store_kernel<R_> {
-	CGAL_FUNCTOR_INIT_STORE(Difference_of_points)
-	typedef R_ R;
-	typedef typename Get_type<R, RT_tag>::type RT;
-	typedef typename Get_type<R, Point_tag>::type Point;
-	typedef typename Get_type<R, Vector_tag>::type Vector;
-	typedef typename Get_functor<R, Construct_ttag<Vector_tag> >::type CV;
-	typedef typename Get_functor<R, Construct_ttag<Point_cartesian_const_iterator_tag> >::type CI;
-	typedef Vector result_type;
-	typedef Point first_argument_type;
-	typedef Point second_argument_type;
-	result_type operator()(Point const&a, Point const&b)const{
-		CI ci(this->kernel());
-		return CV(this->kernel())(make_transforming_pair_iterator(ci(a,Begin_tag()),ci(b,Begin_tag()),std::minus<RT>()),make_transforming_pair_iterator(ci(a,End_tag()),ci(b,End_tag()),std::minus<RT>()));
-	}
-};
-}
-
-CGAL_KD_DEFAULT_FUNCTOR(Difference_of_points_tag,(CartesianDKernelFunctors::Difference_of_points<K>),(Point_tag, Vector_tag),(Construct_ttag<Vector_tag>, Construct_ttag<Point_cartesian_const_iterator_tag>));
-
-namespace CartesianDKernelFunctors {
-template<class R_> struct Midpoint : private Store_kernel<R_> {
-	CGAL_FUNCTOR_INIT_STORE(Midpoint)
-	typedef R_ R;
-	typedef typename Get_type<R, FT_tag>::type FT;
-	typedef typename Get_type<R, RT_tag>::type RT;
-	typedef typename Get_type<R, Point_tag>::type Point;
-	typedef typename Get_functor<R, Construct_ttag<Point_tag> >::type CP;
-	typedef typename Get_functor<R, Construct_ttag<Point_cartesian_const_iterator_tag> >::type CI;
-	typedef Point result_type;
-	typedef Point first_argument_type;
-	typedef Point second_argument_type;
-	// There is a division, but it will be cast to RT afterwards anyway, so maybe we could use RT.
-	struct Average : std::binary_function<FT,RT,FT> {
-		FT operator()(FT const&a, RT const&b)const{
-			return (a+b)/2;
-		}
-	};
-	result_type operator()(Point const&a, Point const&b)const{
-		CI ci(this->kernel());
-		//Divide<FT,int> half(2);
-		//return CP(this->kernel())(make_transforming_iterator(make_transforming_pair_iterator(ci.begin(a),ci.begin(b),std::plus<FT>()),half),make_transforming_iterator(make_transforming_pair_iterator(ci.end(a),ci.end(b),std::plus<FT>()),half));
-		return CP(this->kernel())(make_transforming_pair_iterator(ci(a,Begin_tag()),ci(b,Begin_tag()),Average()),make_transforming_pair_iterator(ci(a,End_tag()),ci(b,End_tag()),Average()));
-	}
-};
-}
-
-CGAL_KD_DEFAULT_FUNCTOR(Midpoint_tag,(CartesianDKernelFunctors::Midpoint<K>),(Point_tag),(Construct_ttag<Point_tag>, Construct_ttag<Point_cartesian_const_iterator_tag>));
-
-namespace CartesianDKernelFunctors {
-template<class R_> struct Squared_length : private Store_kernel<R_> {
-	CGAL_FUNCTOR_INIT_STORE(Squared_length)
-	typedef R_ R;
-	typedef typename Get_type<R, RT_tag>::type RT;
-	typedef typename Get_type<R, Vector_tag>::type Vector;
-	typedef typename Get_functor<R, Construct_ttag<Vector_cartesian_const_iterator_tag> >::type CI;
-	typedef RT result_type;
-	typedef Vector argument_type;
-	result_type operator()(Vector const&a)const{
-		CI ci(this->kernel());
-		typename Algebraic_structure_traits<RT>::Square f;
-		// TODO: avoid this RT(0)+...
-		return std::accumulate(make_transforming_iterator(ci(a,Begin_tag()),f),make_transforming_iterator(ci(a,End_tag()),f),RT(0));
-	}
-};
-}
-
-CGAL_KD_DEFAULT_FUNCTOR(Squared_length_tag,(CartesianDKernelFunctors::Squared_length<K>),(Vector_tag),(Construct_ttag<Vector_cartesian_const_iterator_tag>));
-
-namespace CartesianDKernelFunctors {
-template<class R_> struct Squared_distance_to_origin : private Store_kernel<R_> {
-	CGAL_FUNCTOR_INIT_STORE(Squared_distance_to_origin)
-	typedef R_ R;
-	typedef typename Get_type<R, RT_tag>::type RT;
-	typedef typename Get_type<R, Point_tag>::type Point;
-	typedef typename Get_functor<R, Construct_ttag<Point_cartesian_const_iterator_tag> >::type CI;
-	typedef RT result_type;
-	typedef Point argument_type;
-	result_type operator()(Point const&a)const{
-		CI ci(this->kernel());
-		typename Algebraic_structure_traits<RT>::Square f;
-		// TODO: avoid this RT(0)+...
-		return std::accumulate(make_transforming_iterator(ci(a,Begin_tag()),f),make_transforming_iterator(ci(a,End_tag()),f),RT(0));
-	}
-};
-}
-
-CGAL_KD_DEFAULT_FUNCTOR(Squared_distance_to_origin_tag,(CartesianDKernelFunctors::Squared_distance_to_origin<K>),(Point_tag),(Construct_ttag<Point_cartesian_const_iterator_tag>));
-
-namespace CartesianDKernelFunctors {
-template<class R_> struct Squared_distance : private Store_kernel<R_> {
-	CGAL_FUNCTOR_INIT_STORE(Squared_distance)
-	typedef R_ R;
-	typedef typename Get_type<R, RT_tag>::type RT;
-	typedef typename Get_type<R, Point_tag>::type Point;
-	typedef typename Get_functor<R, Construct_ttag<Point_cartesian_const_iterator_tag> >::type CI;
-	typedef RT result_type;
-	typedef Point first_argument_type;
-	typedef Point second_argument_type;
-	struct Sq_diff : std::binary_function<RT,RT,RT> {
-		RT operator()(RT const&a, RT const&b)const{
-			return CGAL::square(a-b);
-		}
-	};
-	result_type operator()(Point const&a, Point const&b)const{
-		CI ci(this->kernel());
-		Sq_diff f;
-		// TODO: avoid this RT(0)+...
-		return std::accumulate(make_transforming_pair_iterator(ci(a,Begin_tag()),ci(b,Begin_tag()),f),make_transforming_pair_iterator(ci(a,End_tag()),ci(b,End_tag()),f),RT(0));
-	}
-};
-}
-
-CGAL_KD_DEFAULT_FUNCTOR(Squared_distance_tag,(CartesianDKernelFunctors::Squared_distance<K>),(Point_tag),(Construct_ttag<Point_cartesian_const_iterator_tag>));
-
-namespace CartesianDKernelFunctors {
-template<class R_> struct Scalar_product : private Store_kernel<R_> {
-  CGAL_FUNCTOR_INIT_STORE(Scalar_product)
-  typedef R_ R;
-  typedef typename Get_type<R, RT_tag>::type RT;
-  typedef typename Get_type<R, Vector_tag>::type Vector;
-  typedef typename Get_functor<R, Construct_ttag<Vector_cartesian_const_iterator_tag> >::type CI;
-  typedef RT result_type;
-  typedef Vector first_argument_type;
-  typedef Vector second_argument_type;
-  result_type operator()(Vector const&a, Vector const&b)const{
-    CI ci(this->kernel());
-    std::multiplies<RT> f;
-    // TODO: avoid this RT(0)+...
-    return std::accumulate(
-	make_transforming_pair_iterator(ci(a,Begin_tag()),ci(b,Begin_tag()),f),
-	make_transforming_pair_iterator(ci(a,  End_tag()),ci(b,  End_tag()),f),
-	RT(0));
-  }
-};
-}
-
-CGAL_KD_DEFAULT_FUNCTOR(Scalar_product_tag,(CartesianDKernelFunctors::Scalar_product<K>),(Vector_tag),(Construct_ttag<Vector_cartesian_const_iterator_tag>));
-
-namespace CartesianDKernelFunctors {
-template<class R_> struct Compare_distance : private Store_kernel<R_> {
-	CGAL_FUNCTOR_INIT_STORE(Compare_distance)
-	typedef R_ R;
-	typedef typename Get_type<R, Point_tag>::type Point;
-	typedef typename Get_functor<R, Squared_distance_tag>::type CSD;
-	typedef typename Get_type<R, Comparison_result_tag>::type result_type;
-	typedef Point first_argument_type;
-	typedef Point second_argument_type;
-	typedef Point third_argument_type; // why am I doing this already?
-	typedef Point fourth_argument_type;
-	result_type operator()(Point const&a, Point const&b, Point const&c)const{
-		CSD csd(this->kernel());
-		return CGAL_NTS compare(csd(a,b),csd(a,c));
-	}
-	result_type operator()(Point const&a, Point const&b, Point const&c, Point const&d)const{
-		CSD csd(this->kernel());
-		return CGAL_NTS compare(csd(a,b),csd(c,d));
-	}
-};
-}
-
-CGAL_KD_DEFAULT_FUNCTOR(Compare_distance_tag,(CartesianDKernelFunctors::Compare_distance<K>),(Point_tag),(Squared_distance_tag));
-
-namespace CartesianDKernelFunctors {
-template<class R_> struct Less_point_cartesian_coordinate : private Store_kernel<R_> {
-	CGAL_FUNCTOR_INIT_STORE(Less_point_cartesian_coordinate)
-	typedef R_ R;
-	typedef typename Get_type<R, Bool_tag>::type result_type;
-	typedef typename Get_functor<R, Compute_point_cartesian_coordinate_tag>::type Cc;
-	// TODO: This is_exact thing should be reengineered.
-	// the goal is to have a way to tell: don't filter this
-	typedef typename CGAL::Is_exact<Cc> Is_exact;
-
-	template<class V,class W,class I>
-	result_type operator()(V const&a, W const&b, I i)const{
-		Cc c(this->kernel());
-		return c(a,i)<c(b,i);
-	}
-};
-}
-
-CGAL_KD_DEFAULT_FUNCTOR(Less_point_cartesian_coordinate_tag,(CartesianDKernelFunctors::Less_point_cartesian_coordinate<K>),(),(Compute_point_cartesian_coordinate_tag));
-
-namespace CartesianDKernelFunctors {
-template<class R_> struct Compare_point_cartesian_coordinate : private Store_kernel<R_> {
-	CGAL_FUNCTOR_INIT_STORE(Compare_point_cartesian_coordinate)
-	typedef R_ R;
-	typedef typename Get_type<R, Comparison_result_tag>::type result_type;
-	typedef typename Get_functor<R, Compute_point_cartesian_coordinate_tag>::type Cc;
-	// TODO: This is_exact thing should be reengineered.
-	// the goal is to have a way to tell: don't filter this
-	typedef typename CGAL::Is_exact<Cc> Is_exact;
-
-	template<class V,class W,class I>
-	result_type operator()(V const&a, W const&b, I i)const{
-		Cc c(this->kernel());
-		return CGAL_NTS compare(c(a,i),c(b,i));
-	}
-};
-}
-
-CGAL_KD_DEFAULT_FUNCTOR(Compare_point_cartesian_coordinate_tag,(CartesianDKernelFunctors::Compare_point_cartesian_coordinate<K>),(),(Compute_point_cartesian_coordinate_tag));
-
-namespace CartesianDKernelFunctors {
-template<class R_> struct Compare_lexicographically : private Store_kernel<R_> {
-	CGAL_FUNCTOR_INIT_STORE(Compare_lexicographically)
-	typedef R_ R;
-	typedef typename Get_type<R, Comparison_result_tag>::type result_type;
-	typedef typename Get_functor<R, Construct_ttag<Point_cartesian_const_iterator_tag> >::type CI;
-	// TODO: This is_exact thing should be reengineered.
-	// the goal is to have a way to tell: don't filter this
-	typedef typename CGAL::Is_exact<CI> Is_exact;
-
-	template<class V,class W>
-	result_type operator()(V const&a, W const&b)const{
-		CI c(this->kernel());
-#ifdef CGAL_CXX11
-		auto
-#else
-		typename CI::result_type
-#endif
-		a_begin=c(a,Begin_tag()),
-		b_begin=c(b,Begin_tag()),
-		a_end=c(a,End_tag());
-		result_type res;
-		// can't we do slightly better for Uncertain<*> ?
-		// after res=...; if(is_uncertain(res))return indeterminate<result_type>();
-		do res=CGAL_NTS compare(*a_begin++,*b_begin++);
-		while(a_begin!=a_end && res==EQUAL);
-		return res;
-	}
-};
-}
-
-CGAL_KD_DEFAULT_FUNCTOR(Compare_lexicographically_tag,(CartesianDKernelFunctors::Compare_lexicographically<K>),(),(Construct_ttag<Point_cartesian_const_iterator_tag>));
-
-namespace CartesianDKernelFunctors {
-template<class R_> struct Less_lexicographically : private Store_kernel<R_> {
-	CGAL_FUNCTOR_INIT_STORE(Less_lexicographically)
-	typedef R_ R;
-	typedef typename Get_type<R, Bool_tag>::type result_type;
-	typedef typename Get_functor<R, Compare_lexicographically_tag>::type CL;
-	typedef typename CGAL::Is_exact<CL> Is_exact;
-
-	template <class V, class W>
-	result_type operator() (V const&a, W const&b) const {
-		CL c (this->kernel());
-		return c(a,b) < 0;
-	}
-};
-}
-
-CGAL_KD_DEFAULT_FUNCTOR(Less_lexicographically_tag,(CartesianDKernelFunctors::Less_lexicographically<K>),(),(Compare_lexicographically_tag));
-
-namespace CartesianDKernelFunctors {
-template<class R_> struct Less_or_equal_lexicographically : private Store_kernel<R_> {
-	CGAL_FUNCTOR_INIT_STORE(Less_or_equal_lexicographically)
-	typedef R_ R;
-	typedef typename Get_type<R, Bool_tag>::type result_type;
-	typedef typename Get_functor<R, Compare_lexicographically_tag>::type CL;
-	typedef typename CGAL::Is_exact<CL> Is_exact;
-
-	template <class V, class W>
-	result_type operator() (V const&a, W const&b) const {
-		CL c (this->kernel());
-		return c(a,b) <= 0;
-	}
-};
-}
-
-CGAL_KD_DEFAULT_FUNCTOR(Less_or_equal_lexicographically_tag,(CartesianDKernelFunctors::Less_or_equal_lexicographically<K>),(),(Compare_lexicographically_tag));
-
-namespace CartesianDKernelFunctors {
-template<class R_> struct Equal_points : private Store_kernel<R_> {
-	CGAL_FUNCTOR_INIT_STORE(Equal_points)
-	typedef R_ R;
-	typedef typename Get_type<R, Bool_tag>::type result_type;
-	typedef typename Get_functor<R, Construct_ttag<Point_cartesian_const_iterator_tag> >::type CI;
-	// TODO: This is_exact thing should be reengineered.
-	// the goal is to have a way to tell: don't filter this
-	typedef typename CGAL::Is_exact<CI> Is_exact;
-
-	template<class V,class W>
-	result_type operator()(V const&a, W const&b)const{
-		CI c(this->kernel());
-#ifdef CGAL_CXX11
-		auto
-#else
-		typename CI::result_type
-#endif
-		a_begin=c(a,Begin_tag()),
-		b_begin=c(b,Begin_tag()),
-		a_end=c(a,End_tag());
-		result_type res = true;
-		// Is using CGAL::possibly for Uncertain really an optimization?
-		do res = res & (*a_begin++ == *b_begin++);
-		while(a_begin!=a_end && possibly(res));
-		return res;
-	}
-};
-}
-
-CGAL_KD_DEFAULT_FUNCTOR(Equal_points_tag,(CartesianDKernelFunctors::Equal_points<K>),(),(Construct_ttag<Point_cartesian_const_iterator_tag>));
-
-namespace CartesianDKernelFunctors {
-template<class R_> struct Oriented_side : private Store_kernel<R_> {
-	CGAL_FUNCTOR_INIT_STORE(Oriented_side)
-	typedef R_ R;
-	typedef typename Get_type<R, Oriented_side_tag>::type result_type;
-	typedef typename Get_type<R, Point_tag>::type Point;
-	typedef typename Get_type<R, Hyperplane_tag>::type Hyperplane;
-	typedef typename Get_type<R, Sphere_tag>::type Sphere;
-	typedef typename Get_functor<R, Value_at_tag>::type VA;
-	typedef typename Get_functor<R, Hyperplane_translation_tag>::type HT;
-	typedef typename Get_functor<R, Squared_distance_tag>::type SD;
-	typedef typename Get_functor<R, Squared_radius_tag>::type SR;
-	typedef typename Get_functor<R, Center_of_sphere_tag>::type CS;
-
-	result_type operator()(Hyperplane const&h, Point const&p)const{
-		HT ht(this->kernel());
-		VA va(this->kernel());
-		return CGAL::compare(va(h,p),ht(h));
-	}
-	result_type operator()(Sphere const&s, Point const&p)const{
-		SD sd(this->kernel());
-		SR sr(this->kernel());
-		CS cs(this->kernel());
-		return CGAL::compare(sd(cs(s),p),sr(s));
-	}
-};
-}
-
-CGAL_KD_DEFAULT_FUNCTOR(Oriented_side_tag,(CartesianDKernelFunctors::Oriented_side<K>),(Point_tag,Sphere_tag,Hyperplane_tag),(Value_at_tag,Hyperplane_translation_tag,Squared_distance_tag,Squared_radius_tag,Center_of_sphere_tag));
-
-namespace CartesianDKernelFunctors {
-template<class R_> struct Has_on_positive_side : private Store_kernel<R_> {
-	CGAL_FUNCTOR_INIT_STORE(Has_on_positive_side)
-	typedef R_ R;
-	typedef typename Get_type<R, Bool_tag>::type result_type;
-	typedef typename Get_functor<R, Oriented_side_tag>::type OS;
-
-	template <class Obj, class Pt>
-	result_type operator()(Obj const&o, Pt const&p)const{
-		OS os(this->kernel());
-		return os(o,p) == ON_POSITIVE_SIDE;
-	}
-};
-}
-
-CGAL_KD_DEFAULT_FUNCTOR(Has_on_positive_side_tag,(CartesianDKernelFunctors::Has_on_positive_side<K>),(),(Oriented_side_tag));
-
-}
-#include <CGAL/NewKernel_d/Coaffine.h>
-#endif // CGAL_KERNEL_D_FUNCTION_OBJECTS_CARTESIAN_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/OTR_2/Cost.h b/3rdparty/CGAL-4.8/include/CGAL/OTR_2/Cost.h
deleted file mode 100644
index b04eaf1..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/OTR_2/Cost.h
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright (c) 2014  INRIA Sophia-Antipolis (France), INRIA Lorraine LORIA.
-// 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
-// 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(s)     : Fernando de Goes, Pierre Alliez, Ivo Vigan, Cl�ment Jamin
-
-#ifndef CGAL_OTR2_COST_H_
-#define CGAL_OTR2_COST_H_
-
-#include <algorithm>
-
-namespace CGAL {
-namespace OTR_2 {
-
-template <class FT>
-class Cost
-{
-private:
-  FT m_norm;
-  FT m_tang;
-  FT m_max_norm;
-  FT m_max_tang;
-
-public:
-  Cost()
-  : m_norm(0),
-    m_tang(0),
-    m_max_norm(0),
-    m_max_tang(0)
-  {}
-
-  Cost(const FT norm, const FT tang)
-  : m_norm(norm),
-    m_tang(tang),
-    m_max_norm(norm),
-    m_max_tang(tang)
-  {}
-
-  ~Cost() {}
-
-  Cost& operator= (const Cost& cost)
-  {
-    m_norm = cost.norm();
-    m_tang = cost.tang();
-    m_max_norm = cost.max_norm();
-    m_max_tang = cost.max_tang();
-    return *this;
-  }
-
-  const FT norm() const { return m_norm; }
-
-  const FT tang() const { return m_tang; }
-
-  const FT max_norm() const { return m_max_norm; }
-
-  const FT max_tang() const { return m_max_tang; }
-
-  FT finalize(const FT alpha = FT(0.5)) const
-  {
-    return FT(2) * (alpha * m_norm + (FT(1) - alpha) * m_tang);
-  }
-
-  void divide(const FT ratio)
-  {
-    CGAL_assertion(ratio != FT(0));
-    m_norm /= ratio;
-    m_tang /= ratio;
-  }
-
-  void add(const Cost& cost, const FT mass = FT(1))
-  {
-    m_norm += mass * cost.norm();
-    m_tang += mass * cost.tang();
-  }
-
-  void reset_max()
-  {
-    m_max_norm = FT(0);
-    m_max_tang = FT(0);
-  }
-
-  void update_max(const Cost& cost)
-  {
-    m_max_norm = (std::max)(m_max_norm, cost.max_norm());
-    m_max_tang = (std::max)(m_max_tang, cost.max_tang());
-  }
-
-  void compute_max(const FT norm, const FT tang)
-  {
-    m_max_norm = (std::max)(m_max_norm, norm);
-    m_max_tang = (std::max)(m_max_tang, tang);
-  }
-};
-
-} } // namespaces
-
-#endif // CGAL_OTR2_COST_H_
diff --git a/3rdparty/CGAL-4.8/include/CGAL/OTR_2/Reconstruction_edge_2.h b/3rdparty/CGAL-4.8/include/CGAL/OTR_2/Reconstruction_edge_2.h
deleted file mode 100644
index 9569d5e..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/OTR_2/Reconstruction_edge_2.h
+++ /dev/null
@@ -1,144 +0,0 @@
-// Copyright (c) 2014  INRIA Sophia-Antipolis (France), INRIA Lorraine LORIA.
-// 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
-// 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(s)     : Fernando de Goes, Pierre Alliez, Ivo Vigan, Cl�ment Jamin
-
-#ifndef CGAL_RECONSTRUCTION_EDGE_2_H_
-#define CGAL_RECONSTRUCTION_EDGE_2_H_
-
-namespace CGAL {
-namespace OTR_2 {
-
-template<class FT, class Edge, class Vertex_handle, class Face_handle>
-class Reconstruction_edge_2 {
-protected:
-  Edge m_edge;
-  Vertex_handle m_source;
-  Vertex_handle m_target;
-
-  FT m_before_cost;
-  FT m_after_cost;
-
-public:
-  Reconstruction_edge_2() 
-  : m_edge(Face_handle(), 0),
-    m_before_cost(0),
-    m_after_cost(0)
-  {}
-
-  Reconstruction_edge_2(const Reconstruction_edge_2& pedge) 
-  : m_edge(pedge.edge()),
-    m_source(pedge.source()),
-    m_target(pedge.target()),
-    m_before_cost(pedge.before()),
-    m_after_cost(pedge.after())
-  {}
-
-  Reconstruction_edge_2(const Edge& edge, const FT before, const FT after)
-  : m_edge(edge),
-    m_before_cost(before),
-    m_after_cost(after)
-  {
-    get_vertices();
-  }
-
-  Reconstruction_edge_2(const Edge& edge, const FT priority = FT(0))
-  : m_edge(edge),
-    m_before_cost(0),
-    m_after_cost(priority)
-  {
-    get_vertices(); 
-  }
-
-  Reconstruction_edge_2(Vertex_handle source, Vertex_handle target)
-  : m_edge(Face_handle(), 0),
-    m_source(source),
-    m_target(target),
-    m_before_cost(0),
-    m_after_cost(0)
-  {}
-
-  Reconstruction_edge_2& operator= (const Reconstruction_edge_2& pedge)
-  {
-    m_edge = pedge.edge();
-    m_source = pedge.source();
-    m_target = pedge.target();
-    m_before_cost = pedge.before();
-    m_after_cost = pedge.after();
-
-    return *this;
-  }
-
-  bool operator== (const Reconstruction_edge_2& pedge) const
-  {
-    return (m_source->id() == pedge.source()->id()
-      && m_target->id() == pedge.target()->id());
-  }
-
-  bool operator< (const Reconstruction_edge_2& pedge) const 
-  {
-    if (m_source->id() < pedge.source()->id())
-      return true;
-    if (m_source->id() > pedge.source()->id())
-      return false;
-    if (m_target->id() < pedge.target()->id())
-      return true;
-    return false;
-  }
-
-  const Edge& edge() const
-  {
-    return m_edge;
-  }
-
-  const Vertex_handle& source() const
-  {
-    return m_source;
-  }
-
-  const Vertex_handle& target() const
-  {
-    return m_target;
-  }
-
-  const FT before() const
-  {
-    return m_before_cost;
-  }
-
-  const FT after() const
-  {
-    return m_after_cost;
-  }
-
-  const FT priority() const
-  {
-    return after() - before();
-  }
-
-protected:
-  void get_vertices()
-  {
-    int index = m_edge.second;
-    m_source = m_edge.first->vertex((index + 1) % 3);
-    m_target = m_edge.first->vertex((index + 2) % 3);
-  }
-};
-
-} } // namespace
-
-#endif // CGAL_RECONSTRUCTION_EDGE_2_H_
diff --git a/3rdparty/CGAL-4.8/include/CGAL/OTR_2/Reconstruction_face_base_2.h b/3rdparty/CGAL-4.8/include/CGAL/OTR_2/Reconstruction_face_base_2.h
deleted file mode 100644
index 0714646..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/OTR_2/Reconstruction_face_base_2.h
+++ /dev/null
@@ -1,266 +0,0 @@
-// Copyright (c) 2014  INRIA Sophia-Antipolis (France), INRIA Lorraine LORIA.
-// 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
-// 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(s)     : Fernando de Goes, Pierre Alliez, Ivo Vigan, Cl�ment Jamin
-
-#ifndef CGAL_RECONSTRUCTION_FACE_BASE_2_H_
-#define CGAL_RECONSTRUCTION_FACE_BASE_2_H_
-
-#include <CGAL/OTR_2/Cost.h>
-#include <CGAL/OTR_2/Sample.h>
-#include <CGAL/Triangulation_face_base_2.h>
-
-#include <vector>
-
-/// \cond SKIP_IN_MANUAL
-
-namespace CGAL {
-namespace OTR_2 {
-
-/// The Reconstruction_face_base_2 class is the default
-/// vertex class of the Reconstruction_face_base_2 class.
-///
-/// - Each vertex stores a CSample as well as the corresponding relocated point
-///
-/// @param Traits_  Traits class
-/// @param Vb       Vertex base class, model of TriangulationFaceBase_2.
-template < class Traits_, class Fb = Triangulation_face_base_2<Traits_> >
-class Reconstruction_face_base_2 : public Fb
-{
-public:
-  typedef Fb                            Base;
-  typedef typename Base::Vertex_handle  Vertex_handle;
-  typedef typename Base::Face_handle    Face_handle;
-
-  template < typename TDS2 >
-  struct Rebind_TDS 
-  {
-    typedef typename Base::template Rebind_TDS<TDS2>::Other   Fb2;
-    typedef Reconstruction_face_base_2<Traits_,Fb2>           Other;
-  };
-
-  typedef typename Traits_::FT    FT;
-  typedef OTR_2::Cost<FT>          Cost_;
-  typedef OTR_2::Sample<Traits_>   Sample_;
-  typedef std::vector<Sample_*>   Sample_vector;
-
-private:
-  Sample_vector m_samples[3];
-  FT m_mass[3];
-
-  Cost_ m_cost0[3];
-  Cost_ m_cost1[3];
-  int   m_plan[3];
-
-  FT m_relevance[3];
-
-public:
-  Reconstruction_face_base_2()
-  {
-    init();
-  }
-
-  Reconstruction_face_base_2(
-    Vertex_handle v1, Vertex_handle v2, Vertex_handle v3)
-  : Base(v1, v2, v3)
-  {
-    init();
-  }
-
-  Reconstruction_face_base_2(
-    Vertex_handle v1, Vertex_handle v2, Vertex_handle v3,
-    Face_handle f1, Face_handle f2, Face_handle f3)
-  : Base(v1, v2, v3, f1, f2, f3)
-  {
-    init();
-  }
-
-  Reconstruction_face_base_2(Face_handle f)
-  : Base(f)
-  {
-    m_samples[0] = f->samples(0);
-    m_samples[1] = f->samples(1);
-    m_samples[2] = f->samples(2);
-
-    m_mass[0] = f->mass(0);
-    m_mass[1] = f->mass(1);
-    m_mass[2] = f->mass(2);
-
-    m_cost0[0] = f->vertex_cost(0);
-    m_cost0[1] = f->vertex_cost(1);
-    m_cost0[2] = f->vertex_cost(2);
-
-    m_cost1[0] = f->edge_cost(0);
-    m_cost1[1] = f->edge_cost(1);
-    m_cost1[2] = f->edge_cost(2);
-
-    m_plan[0] = f->plan(0);
-    m_plan[1] = f->plan(1);
-    m_plan[2] = f->plan(2);
-
-    m_relevance[0] = f->relevance(0);
-    m_relevance[1] = f->relevance(1);
-    m_relevance[2] = f->relevance(2);
-  }
-
-  ~Reconstruction_face_base_2()
-  {
-    clean_all_samples();
-  }
-
-  void init()
-  {
-    m_mass[0] = FT(0);
-    m_mass[1] = FT(0);
-    m_mass[2] = FT(0);
-
-    m_cost0[0] = Cost_();
-    m_cost0[1] = Cost_();
-    m_cost0[2] = Cost_();
-
-    m_cost1[0] = Cost_();
-    m_cost1[1] = Cost_();
-    m_cost1[2] = Cost_();
-
-    m_plan[0] = 0;
-    m_plan[1] = 0;
-    m_plan[2] = 0;
-
-    m_relevance[0] = 0;
-    m_relevance[1] = 0;
-    m_relevance[2] = 0;
-
-  }
-
-  int plan(int edge) const { return m_plan[edge]; }
-  int& plan(int edge) { return m_plan[edge]; }
-
-  const FT& mass(int edge) const { return m_mass[edge]; }
-  FT& mass(int edge) { return m_mass[edge]; }
-
-  const Cost_& vertex_cost(int edge) const { return m_cost0[edge]; }
-  Cost_& vertex_cost(int edge) { return m_cost0[edge]; }
-
-  const Cost_& edge_cost(int edge) const { return m_cost1[edge]; }
-  Cost_& edge_cost(int edge) { return m_cost1[edge]; }
-
-  const FT& relevance(int edge) const { return m_relevance[edge]; }
-  FT& relevance(int edge) { return m_relevance[edge]; }
-
-
-  const Cost_& cost(int edge) const
-  {
-    if (plan(edge) == 0) 
-      return vertex_cost(edge);
-    return edge_cost(edge);
-  }
-
-  bool ghost(int edge) const
-  {
-    if (mass(edge) == FT(0))
-      return true;
-    if (plan(edge) == 0)
-      return true;
-    return false;
-  }
-
-  const Sample_vector& samples(int edge) const { return m_samples[edge]; }
-  Sample_vector& samples(int edge) { return m_samples[edge]; }
-
-  void add_sample(int edge, Sample_* sample)
-  {
-    m_samples[edge].push_back(sample);
-  }
-
-  void clean_samples(int edge)
-  {
-    m_samples[edge].clear();
-  }
-
-  void clean_all_samples()
-  {
-    for (int i = 0; i < 3; ++i)
-      clean_samples(i);
-  }
-};
-
-//---------------STRUCT LESS FACE_HANDLE---------------------
-template <class T>
-struct less_Face_handle
-{
-  void get_vertices_id(const T& face, int& a, int& b, int& c) const
-  {
-    a = face->vertex(0)->id();
-    b = face->vertex(1)->id();
-    c = face->vertex(2)->id();
-  }
-
-  bool operator() (const T& a, const T& b) const
-  {
-    int a0, a1, a2;
-    get_vertices_id(a, a0, a1, a2);
-
-    int b0, b1, b2;
-    get_vertices_id(b, b0, b1, b2);
-
-    if (a0 < b0) return true;
-    if (a0 > b0) return false;
-
-    if (a1 < b1) return true;
-    if (a1 > b1) return false;
-
-    if (a2 < b2) return true;
-
-    return false;
-  }
-};
-
-
-//---------------STRUCT LESS EDGE---------------------
-template <class T>
-struct less_Edge
-{
-  void get_vertices_id(const T& a, int& i, int& j) const
-  {
-    i = a.first->vertex( (a.second+1)%3 )->id();
-    j = a.first->vertex( (a.second+2)%3 )->id();
-    if (i > j) std::swap(i, j);
-  }
-
-  bool operator() (const T& a, const T& b) const
-  {
-    int a0, a1;
-    get_vertices_id(a, a0, a1);
-
-    int b0, b1;
-    get_vertices_id(b, b0, b1);
-
-    if (a0 < b0) return true;
-    if (a0 > b0) return false;
-    if (a1 < b1) return true;
-
-    return false;
-  }
-
-
-  /// \endcond
-
-};
-
-} } //end namespace
-
-#endif // CGAL_RECONSTRUCTION_FACE_BASE_2_H_
diff --git a/3rdparty/CGAL-4.8/include/CGAL/OTR_2/Reconstruction_triangulation_2.h b/3rdparty/CGAL-4.8/include/CGAL/OTR_2/Reconstruction_triangulation_2.h
deleted file mode 100644
index 5242f1b..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/OTR_2/Reconstruction_triangulation_2.h
+++ /dev/null
@@ -1,1079 +0,0 @@
-// Copyright (c) 2014  INRIA Sophia-Antipolis (France), INRIA Lorraine LORIA.
-// 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
-// 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(s)     : Fernando de Goes, Pierre Alliez, Ivo Vigan, Cl�ment Jamin
-
-#ifndef CGAL_RECONSTRUCTION_TRIANGULATION_2_H
-#define CGAL_RECONSTRUCTION_TRIANGULATION_2_H
-
-// local
-#include <CGAL/OTR_2/Sample.h>
-#include <CGAL/OTR_2/Reconstruction_edge_2.h>
-#include <CGAL/OTR_2/Cost.h>
-#include <CGAL/OTR_2/Reconstruction_vertex_base_2.h>
-#include <CGAL/OTR_2/Reconstruction_face_base_2.h>
-
-// CGAL
-#include <CGAL/basic.h>
-#include <CGAL/Random.h>
-#include <CGAL/intersections.h>
-#include <CGAL/Delaunay_triangulation_2.h>
-
-// boost
-#include <boost/multi_index/mem_fun.hpp>
-#include <boost/multi_index_container.hpp>
-#include <boost/multi_index/ordered_index.hpp>
-#include <boost/multi_index/identity.hpp>
-#include <boost/multi_index/member.hpp>
-
-// STL
-#include <map>
-#include <set>
-#include <vector>
-#include <queue>
-#include <iostream>
-#include <limits>
-
-#define EPS   1e-15
-
-namespace CGAL {
-namespace OTR_2 {
-
-/// \internal
-///  The Reconstruction_triangulation_2 class
-///  provides the reconstruction simplex as well as the transportation plan.
-/// - Each vertex stores a normal vector.
-/// - A vertex a Sample which got assigned to it by the transportation plan,
-///   well as the corresponding relocated Point (of type Traits_::Point_2).
-/// - In order to solve a linear system over the triangulation, a vertex may be constrained
-///   or not (i.e. may contribute to the right or left member of the linear system),
-///   and has a unique index.
-/// The vertex class must derive from Reconstruction_vertex_base_3.
-///
-///  @param Traits_   The traits class
-///  @param Tds       Model of TriangulationDataStructure_2.
-///  The vertex class must derive from Reconstruction_vertex_base_2.
-///  The face   class must derive from Reconstruction_face_base_2.
-template<
-  class Traits_,
-  class Tds_ = Triangulation_data_structure_2<
-  Reconstruction_vertex_base_2<Traits_>,
-  Reconstruction_face_base_2<Traits_> > >
-class Reconstruction_triangulation_2
-  : public Delaunay_triangulation_2<Traits_, Tds_> 
-{
-public:
-
-  typedef Delaunay_triangulation_2<Traits_, Tds_> Base;
-
-  typedef typename Traits_::FT FT;
-  typedef typename Traits_::Point_2 Point;
-  typedef typename Traits_::Vector_2 Vector;
-  typedef typename Traits_::Line_2 Line;
-  typedef typename Traits_::Segment_2 Segment;
-  typedef typename Traits_::Triangle_2 Triangle;
-
-  typedef typename Base::Vertex Vertex;
-  typedef typename Base::Vertex_handle Vertex_handle;
-  typedef typename Base::Vertex_iterator Vertex_iterator;
-  typedef typename Base::Vertex_circulator Vertex_circulator;
-  typedef typename Base::Finite_vertices_iterator Finite_vertices_iterator;
-
-  typedef typename Base::Edge Edge;
-  typedef typename Base::Edge_circulator Edge_circulator;
-  typedef typename Base::Finite_edges_iterator Finite_edges_iterator;
-
-  typedef typename Base::Face_handle Face_handle;
-  typedef typename Base::Face_circulator Face_circulator;
-  typedef typename Base::Finite_faces_iterator Finite_faces_iterator;
-
-  typedef std::map<Vertex_handle, Vertex_handle,
-      less_Vertex_handle<Vertex_handle> > Vertex_handle_map;
-  typedef std::map<Face_handle, Face_handle, 
-                   less_Face_handle<Face_handle> > Face_handle_map;
-
-  typedef std::set<Vertex_handle, 
-                   less_Vertex_handle<Vertex_handle> > Vertex_handle_set;
-  typedef std::set<Edge, less_Edge<Edge> > Edge_set;
-
-  typedef std::vector<Edge> Edge_vector;
-
-  typedef OTR_2::Cost<FT> Cost_;
-  typedef OTR_2::Sample<Traits_> Sample_;
-  typedef std::vector<Sample_*> Sample_vector;
-  typedef typename Sample_vector::const_iterator Sample_vector_const_iterator;
-
-  typedef OTR_2::Sample_with_priority<Sample_> PSample;
-  typedef std::priority_queue<PSample, std::vector<PSample>,
-      OTR_2::greater_priority<PSample> > SQueue;
-
-  typedef Reconstruction_edge_2<FT, Edge, 
-                                Vertex_handle, Face_handle> Rec_edge_2;
-
-  using Base::geom_traits;
-
-  typedef boost::multi_index_container<
-      Rec_edge_2,
-      boost::multi_index::indexed_by<
-      // sort by Rec_edge_2::operator<
-      boost::multi_index::ordered_unique< boost::multi_index::identity<
-      Rec_edge_2 > > ,
-      // sort by Rec_edge_2::priority()
-      boost::multi_index::ordered_non_unique<
-      boost::multi_index::const_mem_fun<
-      Rec_edge_2,const FT,&Rec_edge_2::priority> >
-  >
-  > MultiIndex;
-
-  double m_factor; // ghost vs solid
-
-
-public:
-  Reconstruction_triangulation_2(Traits_ traits = Traits_())
-  : Base(traits), m_factor(1.)
-  {
-  }
-
-  ~Reconstruction_triangulation_2() {
-  }
-
-  double& ghost_factor() {
-    return m_factor;
-  }
-
-  double ghost_factor() const {
-    return m_factor;
-  }
-
-  Edge random_finite_edge() const {
-    static CGAL::Random rng;
-    std::size_t nbf = Base::number_of_faces();
-    int offset = rng.get_int(0, static_cast<int>(nbf - 1));
-    Finite_faces_iterator fi = Base::finite_faces_begin();
-    for (int i = 0; i < offset; i++)
-      fi++;
-    Face_handle face = fi;
-    int index = rng.get_int(0, 40) % 3;
-    return Edge(face, index);
-  }
-
-  // ACCESS //
-
-  Vertex_handle source_vertex(const Edge& edge) const {
-    return edge.first->vertex(Base::ccw(edge.second));
-  }
-
-  Vertex_handle target_vertex(const Edge& edge) const {
-    return edge.first->vertex(Base::cw(edge.second));
-  }
-
-  Vertex_handle opposite_vertex(const Edge& edge) const {
-    return edge.first->vertex(edge.second);
-  }
-
-  bool is_pinned(const Edge& edge) const {
-    Vertex_handle s = source_vertex(edge);
-    if (s->pinned())
-      return true;
-    return false;
-  }
-
-  Edge twin_edge(const Edge& edge) const {
-    Face_handle f = edge.first;
-    Vertex_handle v = source_vertex(edge);
-    Face_handle nf = f->neighbor(edge.second);
-    return Edge(nf, Base::ccw(nf->index(v)));
-  }
-
-  Edge next_edge(const Edge& edge) const {
-    Face_handle f = edge.first;
-    int index = Base::ccw(edge.second);
-    return Edge(f, index);
-  }
-
-  Edge prev_edge(const Edge& edge) const {
-    Face_handle f = edge.first;
-    int index = Base::cw(edge.second);
-    return Edge(f, index);
-  }
-
-  FT get_length(const Edge& edge) const {
-    Segment segment = get_segment(edge);
-    return CGAL::sqrt(segment.squared_length());
-  }
-
-  Segment get_segment(const Edge& edge) const {
-    const Point& ps = source_vertex(edge)->point();
-    const Point& pt = target_vertex(edge)->point();
-    return geom_traits().construct_segment_2_object()(ps, pt);
-  }
-
-  Triangle get_triangle(Face_handle face) const {
-    Vertex_handle v0 = face->vertex(0);
-    Vertex_handle v1 = face->vertex(1);
-    Vertex_handle v2 = face->vertex(2);
-    return geom_traits().construct_triangle_2_object()(
-      v0->point(), v1->point(), v2->point());
-  }
-
-  // GET LINK //
-
-  void get_vertices_from_edge_link(const Edge& edge,
-      Vertex_handle_set& vertices) const {
-    vertices.insert(opposite_vertex(edge));
-    vertices.insert(opposite_vertex(twin_edge(edge)));
-  }
-
-  void get_vertices_from_vertex_link(Vertex_handle vertex,
-      Vertex_handle_set& vertices) const {
-    Vertex_circulator vcirc = Base::incident_vertices(vertex);
-    Vertex_circulator vend = vcirc;
-    CGAL_For_all(vcirc, vend)
-    {
-      Vertex_handle v = vcirc;
-      vertices.insert(v);
-    }
-  }
-
-  // boundary of star(vertex)
-  // 'outward' chooses the orientation of the boundary
-  void get_edges_from_star_minus_link(Vertex_handle vertex, Edge_vector& hull,
-      bool outward = false) const {
-    Face_circulator fcirc = Base::incident_faces(vertex);
-    Face_circulator fend = fcirc;
-    CGAL_For_all(fcirc, fend)
-    {
-      Face_handle face = fcirc;
-      int index = face->index(vertex);
-      Edge edge(face, index);
-      if (outward)
-        edge = twin_edge(edge);
-      hull.push_back(edge);
-    }
-  }
-
-  // ATTRIBUTES //
-
-  bool is_ghost(const Edge& edge) const {
-    return edge.first->ghost(edge.second);
-  }
-
-  int get_plan(const Edge& edge) const {
-    return edge.first->plan(edge.second);
-  }
-
-  void set_plan(const Edge& edge, int simplex) const {
-    edge.first->plan(edge.second) = simplex;
-  }
-
-  FT get_mass(const Edge& edge) const {
-    return edge.first->mass(edge.second);
-  }
-
-  void set_mass(const Edge& edge, const FT mass) const {
-    edge.first->mass(edge.second) = mass;
-  }
-
-  const Cost_& get_cost(const Edge& edge) const {
-    return edge.first->cost(edge.second);
-  }
-
-  void set_vertex_cost(const Edge& edge, const Cost_& cost) const {
-    edge.first->vertex_cost(edge.second) = cost;
-  }
-
-  void set_edge_cost(const Edge& edge, const Cost_& cost) const {
-    edge.first->edge_cost(edge.second) = cost;
-  }
-
-  FT get_vertex_minus_edge_cost(const Edge& edge) const {
-    const Cost_& vcost = edge.first->vertex_cost(edge.second);
-    const Cost_& ecost = edge.first->edge_cost(edge.second);
-    return vcost.finalize() - m_factor * ecost.finalize();
-  }
-
-  FT get_vertex_over_edge_cost(const Edge& edge) const {
-    FT vvalue = edge.first->vertex_cost(edge.second).finalize();
-    FT evalue = edge.first->edge_cost(edge.second).finalize();
-    if (evalue == vvalue)
-      return FT(1) / m_factor;
-    return vvalue / (m_factor * evalue);
-  }
-
-  FT get_edge_relevance(const Edge& edge) const {
-    FT M = get_mass(edge);
-    if (M == FT(0))
-      return FT(0);
-
-    FT L = get_length(edge);
-    FT cost = get_cost(edge).finalize();
-    return M * L * L / cost;
-  }
-
-  FT get_density(const Edge& edge) const {
-    FT length = get_length(edge);
-    FT mass = get_mass(edge);
-    return (mass / length);
-  }
-
-  unsigned int nb_samples(const Edge& edge) const {
-    Edge twin = twin_edge(edge);
-    return edge.first->samples(edge.second).size()
-      + twin.first->samples(twin.second).size();
-  }
-
-  void collect_samples_from_edge(
-    const Edge& edge, Sample_vector& samples) const 
-  {
-    const Sample_vector& edge_samples = edge.first->samples(edge.second);
-    samples.insert(samples.end(), edge_samples.begin(), edge_samples.end());
-  }
-
-  void collect_samples_from_vertex(
-    Vertex_handle vertex, Sample_vector& samples, bool cleanup) const 
-  {
-    Face_circulator fcirc = Base::incident_faces(vertex);
-    Face_circulator fend = fcirc;
-    CGAL_For_all(fcirc, fend)
-    {
-      Face_handle face = fcirc;
-      int index = face->index(vertex);
-
-      Edge edge(face, index);
-      collect_samples_from_edge(edge, samples);
-
-      Edge next = next_edge(edge);
-      collect_samples_from_edge(next, samples);
-
-      Edge prev = prev_edge(edge);
-      collect_samples_from_edge(prev, samples);
-
-      if (cleanup)
-        face->clean_all_samples();
-    }
-    Sample_* sample = vertex->sample();
-    if (sample)
-      samples.push_back(sample);
-    if (cleanup)
-      vertex->set_sample(NULL);
-  }
-
-  void collect_all_samples(Sample_vector& samples) const {
-    for (Finite_edges_iterator ei = Base::finite_edges_begin();
-        ei != Base::finite_edges_end(); ++ei) {
-      Edge edge = *ei;
-      Edge twin = twin_edge(edge);
-      collect_samples_from_edge(edge, samples);
-      collect_samples_from_edge(twin, samples);
-    }
-    for (Finite_vertices_iterator vi = Base::finite_vertices_begin();
-        vi != Base::finite_vertices_end(); ++vi) {
-      Vertex_handle v = vi;
-      Sample_* sample = v->sample();
-      if (sample)
-        samples.push_back(sample);
-    }
-  }
-
-  void cleanup_assignments() {
-    for (Finite_faces_iterator fi = Base::finite_faces_begin();
-        fi != Base::finite_faces_end(); ++fi) {
-      fi->clean_all_samples();
-    }
-    for (Finite_vertices_iterator vi = Base::finite_vertices_begin();
-        vi != Base::finite_vertices_end(); ++vi) {
-      vi->set_sample(NULL);
-    }
-  }
-
-  // COST //
-
-  Cost_ compute_total_cost() const {
-    Cost_ sum;
-    for (Finite_edges_iterator ei = Base::finite_edges_begin();
-        ei != Base::finite_edges_end(); ++ei) {
-      Edge edge = *ei;
-      const Cost_& cost = get_cost(edge);
-      sum.update_max(cost);
-      sum.add(cost);
-    }
-    return sum;
-  }
-
-  Cost_ compute_cost_around_vertex(Vertex_handle vertex) const {
-    Cost_ inner;
-    Cost_ outer;
-    Face_circulator fcirc = Base::incident_faces(vertex);
-    Face_circulator fend = fcirc;
-    CGAL_For_all(fcirc, fend)
-    {
-      Face_handle face = fcirc;
-      int index = face->index(vertex);
-
-      Edge edge(face, index);
-      Cost_ cost = get_cost(edge);
-      outer.update_max(cost);
-      outer.add(cost);
-
-      edge = next_edge(edge);
-      cost = get_cost(edge);
-      inner.update_max(cost);
-      inner.add(cost);
-
-      edge = next_edge(edge);
-      cost = get_cost(edge);
-      inner.update_max(cost);
-      inner.add(cost);
-    }
-    inner.divide(2.0);
-
-    Cost_ sum;
-    sum.add(inner);
-    sum.add(outer);
-    sum.update_max(inner);
-    sum.update_max(outer);
-    return sum;
-  }
-
-  void reset_all_costs() {
-    for (Finite_edges_iterator ei = Base::finite_edges_begin();
-        ei != Base::finite_edges_end(); ++ei) {
-      Edge edge = *ei;
-      update_cost(edge);
-    }
-  }
-
-  void update_cost(const Edge& edge) {
-    compute_mass(edge);
-    compute_edge_cost(edge);
-    compute_vertex_cost(edge);
-    select_plan(edge);
-  }
-
-  void compute_mass(const Edge& edge) const {
-    FT mass = 0;
-
-    typename Sample_vector::const_iterator it;
-    const Sample_vector& samples0 = edge.first->samples(edge.second);
-    for (it = samples0.begin(); it != samples0.end(); ++it) {
-      Sample_* sample = *it;
-      mass += sample->mass();
-    }
-
-    Edge twin = twin_edge(edge);
-    const Sample_vector& samples1 = twin.first->samples(twin.second);
-    for (it = samples1.begin(); it != samples1.end(); ++it) {
-      Sample_* sample = *it;
-      mass += sample->mass();
-    }
-
-    set_mass(edge, mass);
-    set_mass(twin, mass);
-  }
-
-  void select_plan(const Edge& edge) const {
-    // transport plan:
-    // 0 - to vertex
-    // 1 - to edge
-
-    int plan = 0;
-    FT diff = get_vertex_minus_edge_cost(edge);
-    if (diff >= 0.0)
-      plan = 1;
-
-    Edge twin = twin_edge(edge);
-    set_plan(edge, plan);
-    set_plan(twin, plan);
-  }
-
-  void compute_edge_cost(const Edge& edge) const {
-    SQueue squeue;
-    FT M = get_mass(edge);
-    FT L = get_length(edge);
-    sort_samples_from_edge(edge, squeue);
-    Cost_ cost = compute_cost_from_squeue(squeue, M, L);
-
-    Edge twin = twin_edge(edge);
-    set_edge_cost(edge, cost);
-    set_edge_cost(twin, cost);
-  }
-
-  void sort_samples_from_edge(const Edge& edge, SQueue& squeue) const {
-    typename Sample_vector::const_iterator it;
-    const Sample_vector& samples0 = edge.first->samples(edge.second);
-    for (it = samples0.begin(); it != samples0.end(); ++it) {
-      Sample_* sample = *it;
-      squeue.push(PSample(sample, sample->coordinate()));
-    }
-
-    Edge twin = twin_edge(edge);
-    const Sample_vector& samples1 = twin.first->samples(twin.second);
-    for (it = samples1.begin(); it != samples1.end(); ++it) {
-      Sample_* sample = *it;
-      squeue.push(PSample(sample, 1.0 - sample->coordinate()));
-    }
-  }
-
-  Cost_ compute_cost_from_squeue(SQueue& squeue, const FT M, const FT L) const
-  {
-    if (squeue.empty())
-      return Cost_();
-    if (M == FT(0))
-      return Cost_();
-
-    Cost_ sum;
-    FT start = 0;
-    FT coef = L / M;
-    while (!squeue.empty()) {
-      PSample psample = squeue.top();
-      squeue.pop();
-
-      FT mass = psample.sample()->mass();
-      FT coord = psample.priority() * L;
-      FT bin = mass * coef;
-      FT center = start + FT(0.5) * bin;
-      FT pos = coord - center;
-
-      FT norm2 = psample.sample()->distance2();
-      FT tang2 = bin * bin / 12 + pos * pos;
-
-      sum.add(Cost_(norm2, tang2), mass);
-      sum.compute_max(norm2, tang2);
-
-      start += bin;
-    }
-    return sum;
-  }
-
-  void compute_vertex_cost(const Edge& edge) const {
-    Edge twin = twin_edge(edge);
-    const Point& ps = source_vertex(edge)->point();
-    const Point& pt = target_vertex(edge)->point();
-
-    Sample_vector samples;
-    collect_samples_from_edge(edge, samples);
-    collect_samples_from_edge(twin, samples);
-
-    Cost_ sum;
-    for (Sample_vector_const_iterator it = samples.begin();
-        it != samples.end(); ++it) {
-      Sample_* sample = *it;
-      FT mass = sample->mass();
-      const Point& query = sample->point();
-
-      FT Ds = geom_traits().compute_squared_distance_2_object()(query, ps);
-      FT Dt = geom_traits().compute_squared_distance_2_object()(query, pt);
-      FT dist2 = ((std::min))(Ds, Dt);
-
-      FT norm2 = sample->distance2();
-      FT tang2 = dist2 - norm2;
-
-      sum.add(Cost_(norm2, tang2), mass);
-      sum.compute_max(norm2, tang2);
-    }
-    set_vertex_cost(edge, sum);
-    set_vertex_cost(twin, sum);
-  }
-
-  // SAMPLE //
-
-  template<class Iterator> // value_type = Sample_*
-  void assign_samples(Iterator begin, Iterator end) {
-    for (Iterator it = begin; it != end; ++it) {
-      Sample_* sample = *it;
-      assign_sample(sample);
-    }
-  }
-
-  template<class Iterator> // value_type = Sample_*
-  void assign_samples_brute_force(Iterator begin, Iterator end) {
-    for (Iterator it = begin; it != end; ++it) {
-      Sample_* sample = *it;
-      assign_sample_brute_force(sample);
-    }
-  }
-
-  bool assign_sample(Sample_* sample) {
-    const Point& point = sample->point();
-    Face_handle face = Base::locate(point);
-
-    if (face == Face_handle() || Base::is_infinite(face)) {
-      //std::cout << "free bird" << std::endl;
-      return false;
-    }
-
-    Vertex_handle vertex = find_nearest_vertex(point, face);
-    if (vertex != Vertex_handle()) {
-      assign_sample_to_vertex(sample, vertex);
-      return true;
-    }
-
-    Edge edge = find_nearest_edge(point, face);
-    assign_sample_to_edge(sample, edge);
-    return true;
-  }
-
-  bool assign_sample_brute_force(Sample_* sample) {
-    const Point& point = sample->point();
-    Face_handle nearest_face = Face_handle();
-    for (Finite_faces_iterator fi = Base::finite_faces_begin();
-        fi != Base::finite_faces_end(); ++fi) {
-      Face_handle face = fi;
-      if (face_has_point(face, point)) {
-        nearest_face = face;
-        break;
-      }
-    }
-
-    if (nearest_face == Face_handle()) {
-      //std::cout << "free bird" << std::endl;
-      return false;
-    }
-
-    Vertex_handle vertex = find_nearest_vertex(point, nearest_face);
-    if (vertex != Vertex_handle()) {
-      assign_sample_to_vertex(sample, vertex);
-      return true;
-    }
-
-    Edge edge = find_nearest_edge(point, nearest_face);
-    assign_sample_to_edge(sample, edge);
-    return true;
-  }
-
-  bool face_has_point(Face_handle face, const Point& query) const {
-    for (int i = 0; i < 3; ++i) {
-      Edge edge(face, i);
-      const Point& ps = source_vertex(edge)->point();
-      const Point& pt = target_vertex(edge)->point();
-      if (!compute_triangle_ccw(ps, pt, query))
-        return false;
-    }
-    return true;
-  }
-
-  Vertex_handle find_nearest_vertex(const Point& point, Face_handle face) const
-  {
-    for (int i = 0; i < 3; ++i) {
-      Vertex_handle vi = face->vertex(i);
-      const Point& pi = vi->point();
-      if (pi == point)
-        return vi;
-    }
-    return Vertex_handle();
-  }
-
-  Edge find_nearest_edge(const Point& point, Face_handle face) const {
-    FT min_dist2 = (std::numeric_limits<FT>::max)();
-    Edge nearest(Face_handle(), 0);
-    for (int i = 0; i < 3; ++i) {
-      Edge edge(face, i);
-      Segment segment = get_segment(edge);
-      FT dist2 = compute_distance2(point, segment);
-      if (dist2 < min_dist2) {
-        min_dist2 = dist2;
-        nearest = edge;
-      }
-    }
-
-    if (nearest.first == Face_handle()) {
-      std::cout << "nearest edge not found" << std::endl;
-    }
-    return nearest;
-  }
-
-  void assign_sample_to_vertex(Sample_* sample, Vertex_handle vertex) const {
-    /*if (vertex->sample()) {
-      std::cout << "assign to vertex: vertex already has sample"
-          << std::endl;
-    }*/
-
-    sample->distance2() = FT(0);
-    sample->coordinate() = FT(0);
-    vertex->set_sample(sample);
-  }
-
-  void assign_sample_to_edge(Sample_* sample, const Edge& edge) const {
-    Segment segment = get_segment(edge);
-    const Point& query = sample->point();
-    sample->distance2() = compute_distance2(query, segment);
-    sample->coordinate() = compute_coordinate(query, segment);
-    edge.first->add_sample(edge.second, sample);
-  }
-
-  FT compute_distance2(const Point& query, const Segment& segment) const {
-    Line line = geom_traits().construct_line_2_object()(segment);
-    if (geom_traits().has_on_2_object()(line, query))
-      return FT(0);
-
-    Point proj = geom_traits().construct_projected_point_2_object()(line, query);
-    return geom_traits().compute_squared_distance_2_object()(query, proj);
-  }
-
-  FT compute_coordinate(const Point& q, const Segment& segment) const {
-    const Point& p0 = segment.source();
-    const Point& p1 = segment.target();
-    Vector p0p1 = geom_traits().construct_vector_2_object()(p0, p1);
-    Vector p0q  = geom_traits().construct_vector_2_object()(p0, q);
-    
-    FT t = geom_traits().compute_scalar_product_2_object()(p0q, p0p1)
-         / geom_traits().compute_scalar_product_2_object()(p0p1, p0p1);
-    return t; // [0,1]
-  }
-
-  // SIGNED DISTANCE //
-
-  // signed distance from line(a,b) to point t
-  FT signed_distance(Vertex_handle a, Vertex_handle b,
-      Vertex_handle t) const {
-    const Point& pa = a->point();
-    const Point& pb = b->point();
-    const Point& pt = t->point();
-    return compute_signed_distance(pa, pb, pt);
-  }
-
-  // signed distance from line(a,b) to point t
-  FT compute_signed_distance(
-    const Point& pa, const Point& pb, const Point& pt) const
-  {
-    if (pt == pa)
-      return FT(0);
-    if (pt == pb)
-      return FT(0);
-    if (pa == pb)
-      return CGAL::sqrt(geom_traits().compute_squared_distance_2_object()(pa, pt));
-
-    Vector vab = geom_traits().construct_vector_2_object()(pa, pb);
-    // Normalize vab
-    vab = geom_traits().construct_scaled_vector_2_object()(
-      vab,
-      FT(1) / CGAL::sqrt(geom_traits().compute_squared_length_2_object()(vab)));
-    Vector vab90 = geom_traits().construct_vector_2_object()(-vab.y(), vab.x());
-    Vector vat = geom_traits().construct_vector_2_object()(pa, pt);
-    return geom_traits().compute_scalar_product_2_object()(vat, vab90);
-  }
-
-  // signed distance from t to the intersection of line(a,b) and line(t,s)
-  FT signed_distance_from_intersection(Vertex_handle a, Vertex_handle b,
-      Vertex_handle t, Vertex_handle s) const {
-    const Point& pa = a->point();
-    const Point& pb = b->point();
-    const Point& pt = t->point();
-    const Point& ps = s->point();
-    return compute_signed_distance_from_intersection(pa, pb, pt, ps);
-  }
-
-  // signed distance from t to the intersection of line(a,b) and line(t,s)
-  FT compute_signed_distance_from_intersection(
-    const Point& pa, const Point& pb, const Point& pt, const Point& ps) const
-  {
-    FT Dabt = compute_signed_distance(pa, pb, pt);
-    if (Dabt == FT(0))
-      return FT(0);
-
-    Line lab = geom_traits().construct_line_2_object()(
-      pa, geom_traits().construct_vector_2_object()(pa, pb));
-    Line lts = geom_traits().construct_line_2_object()(
-      pt, geom_traits().construct_vector_2_object()(pt, ps));
-
-    FT Dqt = (std::numeric_limits<FT>::max)();
-    CGAL::Object result = CGAL::intersection(lab, lts);
-    const Point* iq = CGAL::object_cast<Point>(&result);
-    if (iq)
-      Dqt = CGAL::sqrt(geom_traits().compute_squared_distance_2_object()(*iq, pt));
-
-    if (Dabt < FT(0))
-      Dqt = -Dqt;
-    return Dqt;
-  }
-
-  bool is_triangle_ccw(Vertex_handle a, Vertex_handle b, Vertex_handle c) const
-  {
-    const Point& pa = a->point();
-    const Point& pb = b->point();
-    const Point& pc = c->point();
-    return compute_triangle_ccw(pa, pb, pc);
-  }
-
-  bool compute_triangle_ccw(
-    const Point& pa, const Point& pb, const Point& pc) const
-  {
-    FT dist = compute_signed_distance(pa, pb, pc);
-    return (dist > -EPS);
-  }
-
-  // COMBINATORIAL TESTS //
-
-  // (a,b) is cyclic if (a,b,c) and (a,c,b) exist
-  bool is_edge_cyclic(const Edge& edge) const {
-    Vertex_handle f = opposite_vertex(edge);
-    Vertex_handle b = opposite_vertex(twin_edge(edge));
-    return (f == b);
-  }
-
-  // b from (a,b) is cyclic if (a,b,c) and (b,a,c) exist
-  bool is_target_cyclic(const Edge& edge) const {
-    if (!is_edge_cyclic(edge))
-      return false;
-
-    Edge twin = twin_edge(edge);
-    Edge prev = prev_edge(twin);
-    Face_handle fp = prev.first->neighbor(prev.second);
-    Face_handle ft = twin.first->neighbor(twin.second);
-    return (fp == ft);
-  }
-
-  bool is_flippable(const Edge& edge) const {
-    Edge twin = twin_edge(edge);
-    if (Base::is_infinite(twin.first))
-      return false;
-    if (Base::is_infinite(edge.first))
-      return false;
-
-    Vertex_handle vs = source_vertex(edge);
-    Vertex_handle vt = target_vertex(edge);
-    Vertex_handle vf = opposite_vertex(edge);
-    Vertex_handle vb = opposite_vertex(twin);
-
-    return is_triangle_ccw(vs, vb, vf) && is_triangle_ccw(vt, vf, vb);
-  }
-
-  bool is_collapsible(const Edge& edge) const {
-    return check_link_test(edge) && check_kernel_test(edge);
-  }
-
-  bool check_link_test(const Edge& edge) const {
-    Vertex_handle s = source_vertex(edge);
-    Vertex_handle t = target_vertex(edge);
-
-    if (s == t)
-      return false;
-    typename Vertex_handle_set::const_iterator it;
-
-    Vertex_handle_set svertices;
-    get_vertices_from_vertex_link(s, svertices);
-
-    Vertex_handle_set tvertices;
-    get_vertices_from_vertex_link(t, tvertices);
-
-    // link(s) inter link(t)
-    Vertex_handle_set ivertices;
-    for (it = svertices.begin(); it != svertices.end(); ++it) {
-      Vertex_handle v = *it;
-      if (tvertices.find(v) != tvertices.end())
-        ivertices.insert(v);
-    }
-
-    Vertex_handle_set evertices;
-    get_vertices_from_edge_link(edge, evertices);
-
-    // link(edge) =? link(s) inter link(t)
-    if (evertices.size() != ivertices.size())
-      return false;
-
-    for (it = evertices.begin(); it != evertices.end(); ++it) {
-      Vertex_handle v = *it;
-      if (ivertices.find(v) == ivertices.end())
-        return false;
-    }
-    return true;
-  }
-
-  bool check_kernel_test(const Edge& edge) const {
-    Vertex_handle s = source_vertex(edge);
-    Vertex_handle t = target_vertex(edge);
-
-    Edge_vector hull;
-    get_edges_from_star_minus_link(s, hull);
-    return is_in_kernel(t->point(), hull.begin(), hull.end());
-  }
-
-  template<class Iterator> // value_type = Edge
-  bool is_in_kernel(const Point& query, Iterator begin, Iterator end) const {
-    for (Iterator it = begin; it != end; ++it) {
-      Edge edge = *it;
-      const Point& pa = source_vertex(edge)->point();
-      const Point& pb = target_vertex(edge)->point();
-      if (!compute_triangle_ccw(pa, pb, query))
-        return false;
-    }
-    return true;
-  }
-
-  // COLLAPSE //
-
-  // (s,a,b) + (s,b,c) -> (s,a,c) + (a,b,c)
-  // st = (source,target) from 'make_collapsible'
-  // return (a,c)
-  Edge flip(const Edge& sb, Edge& st, int /*verbose*/ = 0) {
-    Vertex_handle t = target_vertex(st);
-
-    Edge sc = twin_edge(prev_edge(sb));
-    Base::tds().flip(sb.first, sb.second);
-    Edge ac = prev_edge(twin_edge(sc));
-
-    Vertex_handle a = source_vertex(ac);
-    if (a == t)
-      st = prev_edge(ac);
-
-    return ac;
-  }
-
-  void collapse(const Edge& edge, int /*verbose*/ = 0) {
-    if (is_edge_cyclic(edge)) {
-      collapse_cyclic_edge(edge);
-      return;
-    }
-
-    Edge twin = twin_edge(edge);
-    Base::tds().join_vertices(twin);
-  }
-
-  // (a,b,c) + (c,b,a) + (a,c,i) + (c,a,j) ->
-  // (a,c,i) + (c,a,j)
-  void collapse_cyclic_edge(const Edge& bc, int verbose = 0) {
-    if (verbose > 0)
-      std::cout << "collapse_cyclic_edge ... ";
-
-    Edge cb = twin_edge(bc);
-    Face_handle abc = bc.first;
-    Face_handle cba = cb.first;
-
-    Vertex_handle b = source_vertex(bc);
-    Vertex_handle c = target_vertex(bc);
-    Vertex_handle a = opposite_vertex(bc);
-
-    Edge ac = twin_edge(next_edge(bc));
-    Edge ca = twin_edge(prev_edge(cb));
-
-    a->set_face(ac.first);
-    c->set_face(ca.first);
-    ac.first->set_neighbor(ac.second, ca.first);
-    ca.first->set_neighbor(ca.second, ac.first);
-
-    this->delete_face(abc);
-    this->delete_face(cba);
-    this->delete_vertex(b);
-
-    if (verbose > 0)
-      std::cout << "done" << std::endl;
-  }
-
-  void print_edge(Rec_edge_2 edge) const {
-    int i = ((edge).edge()).second;
-    Point a = ((edge).edge()).first->vertex((i+1)%3)->point();
-    Point b = ((edge).edge()).first->vertex((i+2)%3)->point();
-    std::cout <<"( " << (edge).priority()  <<  ") ( " << a << " , " << b << " )" << std::endl;
-  }
-
-  template <class Iterator> // value_type = Edge
-  bool make_collapsible(Edge& edge, Iterator begin, Iterator end, int verbose = 0)
-  {
-    Vertex_handle source = source_vertex(edge);
-    Vertex_handle target = target_vertex(edge);
-
-    MultiIndex multi_ind;
-    for (Iterator it = begin; it != end; ++it)
-    {
-      Edge ab = twin_edge(*it);
-      Vertex_handle a = source_vertex(ab);
-      Vertex_handle b = target_vertex(ab);
-      FT D = signed_distance_from_intersection(a, b, target, source);
-      if (D < FT(0)) {
-        multi_ind.insert(Rec_edge_2(ab, D));
-      }
-    }
-
-    int nb_flips = 0;
-    while (!multi_ind.empty())
-    {
-      Rec_edge_2 pedge = *(multi_ind.template get<1>()).begin();
-      FT Dbc = pedge.priority();
-      Edge bc = pedge.edge();
-      (multi_ind.template get<0>()).erase(pedge);
-
-      Edge sb = prev_edge(bc);
-      Edge ab = prev_edge(twin_edge(sb));
-      Edge sc = twin_edge(next_edge(bc));
-      Edge cd = next_edge(sc);
-
-      Vertex_handle a = source_vertex(ab);
-      Vertex_handle b = source_vertex(bc);
-      Vertex_handle c = target_vertex(bc);
-      Vertex_handle d = target_vertex(cd);
-
-      FT Dac =  -(std::numeric_limits<FT>::max)();
-      if (a != c && is_triangle_ccw(a, b, c))
-        Dac = signed_distance_from_intersection(a, c, target, source);
-
-      FT Dbd =  -(std::numeric_limits<FT>::max)();
-      if (b != d && is_triangle_ccw(b, c, d))
-        Dbd = signed_distance_from_intersection(b, d, target, source);
-
-      if (Dac ==  -(std::numeric_limits<FT>::max)() && Dbd ==
-          -(std::numeric_limits<FT>::max)())
-      {
-        std::cerr << "--- No flips available ---"  << std::endl;
-        return false;
-      }
-
-      if ((std::max)(Dac, Dbd) + EPS < Dbc)
-      {
-			/*
-        std::cerr.precision(10);
-        std::cerr << "--- Flip makes kernel worse ---" << std::endl;
-        std::cerr << Dac << " or " << Dbd << " vs " << Dbc << std::endl;
-        std::cerr << "a: " << a->point() << std::endl;
-        std::cerr << "b: " << b->point() << std::endl;
-        std::cerr << "c: " << c->point() << std::endl;
-        std::cerr << "d: " << d->point() << std::endl;
-        std::cerr << "t: " << target->point() << std::endl;
-        std::cerr << "diff = " << Dbc - (std::max)(Dac, Dbd) << std::endl;
-				*/
-        return false;
-      }
-
-      if (Dac > Dbd)
-      {
-        (multi_ind.template get<0>()).erase(Rec_edge_2(ab));
-
-        Edge ac = flip(sb, edge, verbose);
-        if (Dac < FT(0)) {
-          multi_ind.insert(Rec_edge_2(ac, Dac));
-        }
-      }
-      else
-      {
-        (multi_ind.template get<0>()).erase(Rec_edge_2(cd));
-        Edge bd = flip(sc, edge, verbose);
-        if (Dbd < FT(0)) {
-          multi_ind.insert(Rec_edge_2(bd, Dbd));
-        }
-      }
-      nb_flips++;
-    }
-
-    if (verbose > 0)
-      std::cerr  << "Nb flips: "  << nb_flips << std::endl;
-
-    return true;
-  }
-};
-
-} } //namespace CGAL
-
-#endif // CGAL_RECONSTRUCTION_TRIANGULATION_2_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/OTR_2/Reconstruction_vertex_base_2.h b/3rdparty/CGAL-4.8/include/CGAL/OTR_2/Reconstruction_vertex_base_2.h
deleted file mode 100644
index 91cf9f9..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/OTR_2/Reconstruction_vertex_base_2.h
+++ /dev/null
@@ -1,134 +0,0 @@
-// Copyright (c) 2014  INRIA Sophia-Antipolis (France), INRIA Lorraine LORIA.
-// 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
-// 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(s)     : Fernando de Goes, Pierre Alliez, Ivo Vigan, Cl�ment Jamin
-
-#ifndef CGAL_RECONSTRUCTION_VERTEX_BASE_2_H_
-#define CGAL_RECONSTRUCTION_VERTEX_BASE_2_H_
-
-#include <CGAL/Triangulation_vertex_base_2.h>
-#include <CGAL/OTR_2/Sample.h>
-
-namespace CGAL {
-namespace OTR_2 {
-
-/// The Reconstruction_vertex_base_2 class is the default
-/// vertex class of the Reconstruction_triangulation_2 class.
-///
-/// - Each vertex stores a Sample as well as the corresponding relocated point.
-///
-/// @param Traits_  Geometric traits class
-/// @param Vb       Vertex base class, model of TriangulationVertexBase_2.
-template < class Traits_, class Vb = Triangulation_vertex_base_2<Traits_> >
-class Reconstruction_vertex_base_2 : public Vb
-{
-
-  /// \cond SKIP_IN_MANUAL
-
-public:
-  typedef Vb Base;
-  typedef typename Traits_::FT        FT;
-  typedef OTR_2::Sample<Traits_>       Sample_;
-  typedef typename Traits_::Point_2   Point;
-  typedef typename Base::Face_handle  Face_handle;
-
-  template < typename TDS2 >
-  struct Rebind_TDS {
-    typedef typename Base::template Rebind_TDS<TDS2>::Other Vb2;
-    typedef Reconstruction_vertex_base_2<Traits_,Vb2> Other;
-  };
-
-private:
-  int       m_id;
-  bool      m_pinned;
-  Sample_*  m_sample;
-  Point     m_relocated;
-  FT        m_relevance;
-
-
-public:
-  Reconstruction_vertex_base_2()
-  : Base(),
-    m_id(-1),
-    m_pinned(false),
-    m_sample(NULL),
-    m_relevance(0)
-{
-}
-
-  Reconstruction_vertex_base_2(const Point & p)
-  : Base(p),
-    m_id(-1),
-    m_pinned(false),
-    m_sample(NULL),
-    m_relevance(0)
-  {
-  }
-
-  Reconstruction_vertex_base_2(Face_handle f)
-  : Base(f),
-    m_id(-1),
-    m_pinned(false),
-    m_sample(NULL),
-    m_relevance(0)
-  {
-  }
-
-  Reconstruction_vertex_base_2(const Point & p, Face_handle f)
-  : Base(p, f),
-    m_id(-1),
-    m_pinned(false),
-    m_sample(NULL),
-    m_relevance(0)
-  {
-  }
-
-  ~Reconstruction_vertex_base_2() { }
-
-  int  id() const { return m_id; }
-  int& id() { return m_id; }
-
-  bool  pinned() const { return m_pinned; }
-  bool& pinned() { return m_pinned; }
-
-  FT relevance() const { return m_relevance; }
-  void set_relevance(FT relevance) { m_relevance = relevance; }
-
-  Sample_* sample() const { return m_sample; }
-  void set_sample(Sample_* sample) { m_sample = sample; }
-
-  const Point& relocated() const { return m_relocated; }
-  Point& relocated() { return m_relocated; }
-
-  bool  has_sample_assigned() const { return sample() != NULL; }
-};
-//---------------STRUCT LESS VERTEX_HANDLE---------------------
-template <class T>
-struct less_Vertex_handle
-{
-  bool operator() (const T& a, const T& b) const
-  {
-    return (a->id() < b->id());
-  }
-};
-
-
-/// \endcond
-
-} } //end namespaces
-
-#endif // CGAL_RECONSTRUCTION_VERTEX_BASE_2_H_
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Optimal_transportation_reconstruction_2.h b/3rdparty/CGAL-4.8/include/CGAL/Optimal_transportation_reconstruction_2.h
deleted file mode 100644
index c20785f..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Optimal_transportation_reconstruction_2.h
+++ /dev/null
@@ -1,1673 +0,0 @@
-// Copyright (c) 2014  INRIA Sophia-Antipolis (France), INRIA Lorraine LORIA.
-// 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
-// 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(s)     : Fernando de Goes, Pierre Alliez, Ivo Vigan, Cl�ment Jamin
-
-#ifndef CGAL_OPTIMAL_TRANSPORTATION_RECONSTRUCTION_2_H_
-#define CGAL_OPTIMAL_TRANSPORTATION_RECONSTRUCTION_2_H_
-
-#include <CGAL/OTR_2/Reconstruction_triangulation_2.h>
-#include <CGAL/OTR_2/Reconstruction_edge_2.h>
-
-#include <CGAL/property_map.h>
-#include <CGAL/Real_timer.h>
-
-#include <iterator>
-#include <iostream>
-#include <vector>
-#include <list>
-#include <algorithm>
-#include <utility>      // std::pair
-
-#include <boost/multi_index_container.hpp>
-#include <boost/multi_index/mem_fun.hpp>
-#include <boost/multi_index/ordered_index.hpp>
-#include <boost/multi_index/identity.hpp>
-#include <boost/property_map/property_map.hpp>
-
-namespace CGAL {
-
-
-/*!
-\ingroup PkgOptimalTransportationReconstruction2Classes
-
-This class provides a means to reconstruct a 1-dimensional shape from a set of 2D points with masses.
-The algorithm computes an initial 2D Delaunay triangulation from the input points, 
-and performs a simplification of the triangulation by performing half edge collapses, edge flips and vertex relocations.
-
-The edges are either processed in the order imposed by an priority queue, or
-in an order based on random selection of edge collapse operators.
-As the exhaustive priority queue guarantees a higher quality it is the default.
-The user can switch to the other method, for example for an initial
-simplification round, by calling `set_random_sample_size()`.
-
-By default edge flip operators are applied to ensure that every edge of the 
-triangulation are candidate to be collapsed, while preserving a valid embedding
-of the triangulation. This option can be disabled by calling
-\link set_use_flip() `set_use_flip(false)`\endlink to reduce the running times.
-
-By default the vertices are not relocated after each half edge collapse.
-This option can be changed by setting the number of vertex relocation steps
-performed between two edge collapse operators.
-
-The simplification is performed by calling either 
-\link run_until() `run_until(n)`\endlink or \link run() `run(steps)`\endlink.
-The former simplifies the triangulation until n points remain, while the latter
-stops after `steps` edge collapse operators have been performed.
-Furthermore, we can relocate the vertices by calling `relocate_all_points()`.
-
-\tparam Traits a model of the concept `OptimalTransportationReconstructionTraits_2`.
-
-\tparam PointPMap a model of `ReadablePropertyMap` with value type `Traits::Point_2`.
-        Defaults to <a href="http://www.boost.org/doc/libs/release/libs/property_map/doc/identity_property_map.html">`boost::typed_identity_property_map<Traits::Point_2>`</a> 
-        (for the case the input is points without mass).
-
-\tparam MassPMap a model of `ReadablePropertyMap` with value type `Traits::FT`
-        Defaults to <a href="http://www.boost.org/doc/libs/release/libs/property_map/doc/static_property_map.html">`boost::static_property_map<Traits::FT>`</a> 
-        (for the case the input is points without mass).
-
- */
-template<
-  class Traits,
-  class PointPMap = boost::typed_identity_property_map <typename Traits::Point_2>,
-  class MassPMap  = boost::static_property_map <typename Traits::FT> >
-class Optimal_transportation_reconstruction_2
-{
-public:
-
-  /// \name Types
-  /// @{
-  /*!
-        Number type.
-   */
-  typedef typename Traits::FT FT;
-
-  /*!
-        Point type.
-   */
-  typedef typename Traits::Point_2 Point;
-
-  /*!
-        Segment type.
-  */
-  typedef typename Traits::Segment_2 Segment;
-
-  /// \cond SKIP_IN_MANUAL
-  /*!
-        Vector type.
-   */
-  typedef typename Traits::Vector_2 Vector;
-
-  typedef typename std::pair<Point, FT> PointMassPair;
-  typedef typename std::vector<PointMassPair> PointMassList;
-
-
-  /*!
-    The Output simplex.
-   */
-  typedef OTR_2::Reconstruction_triangulation_2<Traits>  Triangulation;
-
-  typedef typename Triangulation::Vertex                Vertex;
-  typedef typename Triangulation::Vertex_handle         Vertex_handle;
-  typedef typename Triangulation::Vertex_iterator       Vertex_iterator;
-  typedef typename Triangulation::Vertex_circulator     Vertex_circulator;
-  typedef typename Triangulation::Finite_vertices_iterator
-                                                        Finite_vertices_iterator;
-
-  typedef typename Triangulation::Edge                  Edge;
-  typedef typename Triangulation::Edge_circulator       Edge_circulator;
-  typedef typename Triangulation::Finite_edges_iterator Finite_edges_iterator;
-
-  typedef typename Triangulation::Face_handle           Face_handle;
-  typedef typename Triangulation::Face_circulator       Face_circulator;
-  typedef typename Triangulation::Finite_faces_iterator Finite_faces_iterator;
-
-  typedef typename Triangulation::Vertex_handle_map     Vertex_handle_map;
-  typedef typename Triangulation::Face_handle_map       Face_handle_map;
-
-  typedef typename Triangulation::Vertex_handle_set     Vertex_handle_set;
-  typedef typename Triangulation::Edge_set              Edge_set;
-
-  typedef typename Triangulation::Edge_vector           Edge_vector;
-  typedef std::list<Edge>                               Edge_list;
-
-  typedef typename Triangulation::Cost_                 Cost_;
-  typedef typename Triangulation::Sample_               Sample_;
-  typedef typename Triangulation::Sample_vector         Sample_vector;
-  typedef typename Triangulation::Sample_vector_const_iterator
-                                                        Sample_vector_const_iterator;
-
-  typedef typename Triangulation::PSample               PSample;
-  typedef typename Triangulation::SQueue                SQueue;
-
-  typedef typename Triangulation::Rec_edge_2            Rec_edge_2;
-
-  typedef typename Triangulation::MultiIndex            MultiIndex;
-
-  /// @}
-
-protected:
-  Triangulation m_dt;
-  Traits const& m_traits;
-  MultiIndex m_mindex;
-  int m_ignore;
-  int m_verbose;
-  std::size_t m_mchoice;  // # Edges
-  bool m_use_flip;
-  FT m_alpha; // [0, 1]
-  FT m_ghost; // ghost vs solid
-  unsigned int m_relocation; // # relocations
-
-  // bbox
-  FT m_bbox_x;
-  FT m_bbox_y;
-  FT m_bbox_size;
-
-  PointPMap point_pmap;
-  MassPMap  mass_pmap;
-
-  /// \endcond
-
-public:
-
-  /// \name Initialization
-  /// @{
-
-  /*!
-  Constructor of the optimal transportation reconstruction class. 
-  It builds an initial simplicial complex 
-  for a given range of point-mass pairs.
-
-  \tparam InputRange is a model of `Range` with forward iterators, 
-          providing input points and point masses through the 
-          `PointPMap` and `MassPMap` property maps.
-
-  \param input_range  Range of input data.
-  \param point_map    A `ReadablePropertyMap` used to access the input points.
-  \param mass_map     A `ReadablePropertyMap` used to access the input 
-                      points' masses.
-  \param sample_size  If `sample_size != 0`, the size of the random sample 
-                      which replaces the exhaustive priority queue.
-  \param use_flip     If `true` the edge flipping procedure is used to ensure 
-                      that every edge can be made collapsible.
-  \param relocation   The number of point relocations that are performed 
-                      between two edge collapses.
-  \param verbose      Controls how much console output is produced by 
-                      the algorithm. The values are 0, 1, or > 1.
-  \param traits       The traits class.
-   */
-  template <class InputRange>
-  Optimal_transportation_reconstruction_2(
-    const InputRange& input_range,
-    PointPMap point_map = PointPMap(),
-    MassPMap  mass_map = MassPMap(1),
-    std::size_t sample_size = 0,
-    bool use_flip = true,
-    unsigned int relocation = 2,
-    int verbose = 0,
-    Traits traits = Traits())
-  : m_dt(traits),
-    m_traits(m_dt.geom_traits()),
-    m_ignore(0), 
-    m_verbose(verbose),
-    m_mchoice(sample_size),
-    m_use_flip(use_flip),
-    m_alpha(0.5),
-    m_ghost(1.0),
-    m_relocation(relocation),
-    m_bbox_x(0.0),
-    m_bbox_y(0.0),
-    m_bbox_size(1.0),
-    point_pmap(point_map),
-    mass_pmap(mass_map)
-  {
-    initialize(input_range.begin(), input_range.end());
-  }
-
-  /// @}
-
-  /// \name Settting Parameters
-  /// @{
-  /*!
-          If `sample_size == 0`, the simplification is performed using an exhaustive priority queue.
-          If `sample_size` is stricly positive the simplification is performed using a
-          multiple choice approach, ie, a best-choice selection in a random sample of 
-          edge collapse operators, of size `sample_size`. A typical value for the sample
-          size is 15, but this value must be enlarged when targeting a very coarse simplification.
-          \param sample_size If `sample_size != 0`, the size of the random sample replaces the priority queue.
-   */
-  void set_random_sample_size(std::size_t sample_size) {
-    m_mchoice = sample_size;
-  }
-
-  /*!
-        Determines how much console output the algorithm generates.
-        If set to a value larger than 0
-        details about the reconstruction process are written to `std::cerr`.
-
-        \param verbose The verbosity level.
-   */
-  void set_verbose(int verbose) {
-    m_verbose = verbose;
-  }
-
-
-  
-
-  /*!
-        The use_flip parameter determines whether the edge flipping procedure
-        is used for the half-edge collapse. 
-   */
-  void set_use_flip(const bool use_flip) {
-    m_use_flip = use_flip;
-  }
-
-
-  /*!
-        Sets the number of vertex relocations
-        that are performed between two edge collapses.
-   */
-  void set_relocation(unsigned int relocation) {
-    m_relocation = relocation;
-  }
-
-  /// \cond SKIP_IN_MANUAL
-  unsigned int relocation() const {
-    return m_relocation;
-  }
-  /// \endcond
-
-
-  /*!
-  \param relevance The relevance threshold used for filtering the edges.
-  An edge is relevant from the approximation point of view
-  if it is long, covers a large mass (or equivalently the
-  number of points when all masses are equal), and has a
-  small transport cost. This notion is defined as 
-  \f$ m(e) * |e|^2 / cost(e) \f$, where \f$ m(e) \f$ 
-  denotes the mass of the points approximated by the edge,
-  \f$ |e| \f$ denotes the edge length and \f$ cost(e) \f$
-  its approximation error.
-  As the cost is defined by mass time squared distance the
-  relevance is unitless.
-
-  The default value is 0, so that all edges receiving some mass
-  are considered relevant.
-  Setting a large relevance value is used to get robustness to a
-  large amount of outliers.
-   */
-  void set_relevance(const FT relevance) {
-    m_ghost = relevance;
-    m_dt.ghost_factor() = m_ghost;
-  }
-
-
-  /// \cond SKIP_IN_MANUAL
-  FT ghost() {
-    return m_ghost;
-  }
-
-  /// @}
-
-  /// \cond SKIP_IN_MANUAL
-
-  Optimal_transportation_reconstruction_2()
-  : m_traits(m_dt.geom_traits())
-  {
-    initialize_parameters();
-  }
-
-
-  ~Optimal_transportation_reconstruction_2() {
-    clear();
-  }
-
-  void initialize_parameters() {
-    m_verbose = 0;
-    m_mchoice = 0;
-    m_use_flip = true;
-    m_alpha = FT(0.5);
-    m_ghost = FT(1);
-    m_relocation = 0;
-
-    m_bbox_x = FT(0);
-    m_bbox_y = FT(0);
-    m_bbox_size = FT(1);
-
-    m_ignore = 0;
-  }
-
-  //Function if one wants to create a Optimal_transportation_reconstruction_2
-  //without yet specifying the input in the constructor.
-  template <class InputIterator>
-  void initialize(
-    InputIterator start_itr,
-    InputIterator beyond_itr,
-    PointPMap point_map,
-    MassPMap  mass_map)
-  {
-    point_pmap = point_map;
-    mass_pmap  = mass_map;
-
-    initialize(start_itr, beyond_itr);
-  }
-
-
-  template <class InputIterator>
-  void initialize(InputIterator start, InputIterator beyond) {
-
-    clear();
-    insert_loose_bbox(m_bbox_x, m_bbox_y, 2 * m_bbox_size);
-    init(start, beyond);
-
-    std::vector<Sample_*> m_samples;
-    for (InputIterator it = start; it != beyond; it++) {
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-      Point point = get(point_pmap, it);
-      FT    mass  = get( mass_pmap, it);
-#else
-      Point point = get(point_pmap, *it);
-      FT    mass  = get( mass_pmap, *it);
-#endif
-      Sample_* s = new Sample_(point, mass);
-      m_samples.push_back(s);
-    }
-    assign_samples(m_samples.begin(), m_samples.end());
-  }
-
-
-  template <class Vector>
-  Vector random_vec(const FT scale) const
-  {
-    FT dx = -scale + (FT(rand()) / FT(RAND_MAX)) * 2* scale;
-    FT dy = -scale + (FT(rand()) / FT(RAND_MAX)) * 2* scale;
-    return m_traits.construct_vector_2_object()(dx, dy);
-  }
-
-  void clear() {
-    Sample_vector samples;
-    m_dt.collect_all_samples(samples);
-    // Deallocate samples
-    for (Sample_vector_const_iterator s_it = samples.begin();
-        s_it != samples.end(); ++s_it)
-    {
-      delete *s_it;
-    }
-
-    m_dt.clear();
-    m_mindex.clear();
-  }
-
-
-  // INIT //
-  void insert_loose_bbox(const FT x, const FT y, const FT size) {
-    CGAL::Real_timer timer;
-    std::cerr << "insert loose bbox" << "...";
-
-    timer.start();
-    int nb = static_cast<int>(m_dt.number_of_vertices());
-    insert_point(m_traits.construct_point_2_object()(x - size, y - size), true, nb++);
-    insert_point(m_traits.construct_point_2_object()(x - size, y + size), true, nb++);
-    insert_point(m_traits.construct_point_2_object()(x + size, y + size), true, nb++);
-    insert_point(m_traits.construct_point_2_object()(x + size, y - size), true, nb++);
-
-    std::cerr << "done" << " (" << nb << " vertices, "
-      << timer.time() << " s)" << std::endl;
-  }
-
-  template<class Iterator>  // value_type = Point*
-  void init(Iterator begin, Iterator beyond) {
-    CGAL::Real_timer timer;
-    std::cerr << "init" << "...";
-
-    timer.start();
-    int nb = static_cast<int>(m_dt.number_of_vertices());
-    m_dt.infinite_vertex()->pinned() = true;
-    for (Iterator it = begin; it != beyond; it++) {
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-      Point point = get(point_pmap, it);
-#else
-      Point point = get(point_pmap, *it);
-#endif
-      insert_point(point, false, nb++);
-    }
-
-    std::cerr << "done" << " (" << nb << " vertices, "
-      << timer.time() << " s)"
-      << std::endl;
-  }
-
-  Vertex_handle insert_point(
-    const Point& point, const bool pinned, const int id) 
-  {
-    Vertex_handle v = m_dt.insert(point);
-    v->pinned() = pinned;
-    v->id() = id;
-    return v;
-  }
-
-  // ASSIGNMENT //
-
-  void cleanup_assignments() {
-    m_dt.cleanup_assignments();
-  }
-
-  template<class Iterator>  // value_type = Sample_*
-  void assign_samples(Iterator begin, Iterator end) {
-    CGAL::Real_timer timer;
-    std::cerr << "assign samples" << "...";
-
-    timer.start();
-    m_dt.assign_samples(begin, end);
-    m_dt.reset_all_costs();
-
-    std::cerr << "done" << " (" << timer.time() << " s)" << std::endl;
-  }
-
-  void reassign_samples() {
-    Sample_vector samples;
-    m_dt.collect_all_samples(samples);
-    m_dt.cleanup_assignments();
-    m_dt.assign_samples(samples.begin(), samples.end());
-    m_dt.reset_all_costs();
-  }
-
-  void reassign_samples_around_vertex(Vertex_handle vertex) {
-    Sample_vector samples;
-    m_dt.collect_samples_from_vertex(vertex, samples, true);
-    m_dt.assign_samples(samples.begin(), samples.end());
-
-    Edge_vector hull;
-    m_dt.get_edges_from_star_minus_link(vertex, hull, true);
-    update_cost(hull.begin(), hull.end());
-  }
-
-
-  bool do_collapse(Edge edge) {
-    Vertex_handle s = m_dt.source_vertex(edge);
-    Vertex_handle t = m_dt.target_vertex(edge);
-
-    if (m_verbose > 0) {
-      std::cerr << std::endl << "do collapse " << "("
-          << s->id() << "->" << t->id() << ") ... " << std::endl;
-    }
-
-    Sample_vector samples;
-    m_dt.collect_samples_from_vertex(s, samples, true);
-
-    Edge_vector hull;
-    m_dt.get_edges_from_star_minus_link(s, hull, true);
-
-    if (m_mchoice == 0)
-      remove_stencil_from_pqueue(hull.begin(), hull.end());
-
-    if (m_use_flip)
-      m_dt.make_collapsible(edge, hull.begin(), hull.end(), m_verbose);
-
-    // debug test
-    bool ok = m_dt.check_kernel_test(edge);
-    if (!ok) {
-      std::cerr << "do_collapse: kernel test failed: " << std::endl;
-      return false;
-    }
-    //
-
-    m_dt.collapse(edge, m_verbose);
-
-    m_dt.assign_samples(samples.begin(), samples.end());
-
-    update_cost(hull.begin(), hull.end());
-
-    if (m_mchoice == 0)
-      push_stencil_to_pqueue(hull.begin(), hull.end());
-
-    for (unsigned int i = 0; i < m_relocation; ++i) {
-      relocate_one_ring(hull.begin(), hull.end());
-    }
-
-    if (m_verbose > 0) {
-      std::cerr << "done" << std::endl;
-    }
-
-    return true;
-  }
-
-  bool simulate_collapse(const Edge& edge, Cost_& cost) {
-    bool ok;
-    Vertex_handle s = m_dt.source_vertex(edge);
-    Vertex_handle t = m_dt.target_vertex(edge);
-
-    if (m_verbose > 1) {
-      std::cerr << "simulate collapse " << "("
-        << s->id() << "->" << t->id() << ") ... " << std::endl;
-    }
-
-    Triangulation copy;
-    Edge copy_edge = copy_star(edge, copy);
-    Vertex_handle copy_source = copy.source_vertex(copy_edge);
-
-    if (m_use_flip) {
-      Edge_vector copy_hull;
-      copy.get_edges_from_star_minus_link(copy_source, copy_hull, true);
-      ok = copy.make_collapsible(copy_edge, copy_hull.begin(),
-          copy_hull.end(), m_verbose);
-      if (!ok) {
-        // std::cerr << "simulation: failed (make collapsible)" << std::endl;
-        return false;
-      }
-    }
-
-    ok = copy.check_kernel_test(copy_edge);
-    if (!ok) {
-      std::cerr << "simulation: failed (kernel test)" << std::endl;
-      return false;
-    }
-
-    copy.collapse(copy_edge, m_verbose);
-
-    Sample_vector samples;
-    m_dt.collect_samples_from_vertex(s, samples, false);
-
-    backup_samples(samples.begin(), samples.end());
-    copy.assign_samples_brute_force(samples.begin(), samples.end());
-    copy.reset_all_costs();
-    cost = copy.compute_total_cost();
-    restore_samples(samples.begin(), samples.end());
-
-    if (m_verbose > 1) {
-      std::cerr << "done" << std::endl;
-    }
-
-    return true;
-  }
-
-  template<class Iterator> // value_type = Sample_*
-  void backup_samples(Iterator begin, Iterator end) const {
-    for (Iterator it = begin; it != end; ++it) {
-      Sample_* sample = *it;
-      sample->backup();
-    }
-  }
-
-  template<class Iterator> // value_type = Sample_*
-  void restore_samples(Iterator begin, Iterator end) const {
-    for (Iterator it = begin; it != end; ++it) {
-      Sample_* sample = *it;
-      sample->restore();
-    }
-  }
-
-  // PEDGE //
-
-  bool decimate() {
-    bool ok;
-    Rec_edge_2 pedge;
-    ok = pick_edge(m_mchoice, pedge);
-    if (!ok)
-      return false;
-
-    ok = do_collapse(pedge.edge());
-    if (!ok)
-      return false;
-    return true;
-  }
-
-  bool create_pedge(const Edge& edge, Rec_edge_2& pedge) {
-    Cost_ after_cost;
-    bool ok = simulate_collapse(edge, after_cost);
-    if (!ok)
-      return false;
-
-    Vertex_handle source = m_dt.source_vertex(edge);
-    Cost_ before_cost = m_dt.compute_cost_around_vertex(source);
-
-    FT before = before_cost.finalize(m_alpha);
-    FT after = after_cost.finalize(m_alpha);
-    pedge = Rec_edge_2(edge, before, after);
-    return true;
-  }
-
-
-  // COST //
-
-  void init_cost() {
-    m_dt.reset_all_costs();
-  }
-
-  template<class Iterator> // value_type = Edge
-  void update_cost(Iterator begin, Iterator end) {
-    Edge_vector edges;
-    collect_cost_stencil(m_dt, begin, end, edges);
-
-    typename Edge_vector::iterator ei;
-    for (ei = edges.begin(); ei != edges.end(); ++ei) {
-      Edge edge = *ei;
-      m_dt.update_cost(edge);
-    }
-  }
-
-  template<class Iterator> // value_type = Edge
-  void collect_cost_stencil(
-    const Triangulation& mesh, Iterator begin, Iterator end, 
-    Edge_vector& edges) const
-  {
-    Edge_set done;
-    Edge_list fifo;
-    for (Iterator it = begin; it != end; ++it) {
-      Edge edge = *it;
-      fifo.push_back(edge);
-      done.insert(edge);
-    }
-
-    while (!fifo.empty()) {
-      Edge edge = fifo.front();
-      fifo.pop_front();
-
-      edge = mesh.twin_edge(edge);
-      edges.push_back(edge);
-
-      Edge next = mesh.next_edge(edge);
-      if (done.insert(next).second)
-        fifo.push_back(next);
-
-      Edge prev = mesh.prev_edge(edge);
-      if (done.insert(prev).second)
-        fifo.push_back(prev);
-    }
-  }
-
-  // PQUEUE (MCHOICE or EXHAUSTIVE) //
-
-  bool pick_edge(std::size_t nb, Rec_edge_2& best_pedge) {
-    if (m_dt.number_of_faces() < 2)
-      return false;
-
-    std::size_t ne = 2 * m_dt.tds().number_of_edges();
-    if (nb > ne)
-      nb = ne;
-
-    bool ok;
-    if (nb == 0) {
-      ok = pick_edge_from_pqueue(best_pedge);
-      return ok;
-    }
-    m_mindex.clear();
-
-    if (nb == ne) {
-      ok = pick_edge_brute_force(best_pedge);
-      return ok;
-    }
-
-    ok = pick_edge_randomly(nb, best_pedge);
-    return ok;
-  }
-
-  bool pick_edge_from_pqueue(Rec_edge_2& best_pedge) {
-    if (m_mindex.empty())
-      populate_pqueue();
-    if (m_mindex.empty())
-      return false;
-    best_pedge = *(m_mindex.template get<1>()).begin();
-    (m_mindex.template get<0>()).erase(best_pedge);
-    return true;
-  }
-
-  bool pick_edge_brute_force(Rec_edge_2& best_pedge) {
-    MultiIndex mindex;
-    Finite_edges_iterator ei;
-    for (ei = m_dt.finite_edges_begin(); ei != m_dt.finite_edges_end();
-        ++ei) {
-      Edge edge = *ei;
-      push_to_mindex(edge, mindex);
-
-      edge = m_dt.twin_edge(edge);
-      push_to_mindex(edge, mindex);
-    }
-    if (mindex.empty())
-      return false;
-    best_pedge = *(mindex.template get<1>()).begin();
-    return true;
-  }
-
-  bool pick_edge_randomly(std::size_t nb, Rec_edge_2& best_pedge) {
-    MultiIndex mindex;
-    for (std::size_t i = 0; i < nb; ++i) {
-      Rec_edge_2 pedge;
-      if (random_pedge(pedge))
-        mindex.insert(pedge);
-    }
-    if (mindex.empty())
-      return false;
-    best_pedge = *(mindex.template get<1>()).begin();
-    return true;
-  }
-
-  void populate_pqueue() {
-    Finite_edges_iterator ei;
-    for (ei = m_dt.finite_edges_begin(); ei != m_dt.finite_edges_end();
-        ++ei) {
-      Edge edge = *ei;
-      push_to_mindex(edge, m_mindex);
-
-      edge = m_dt.twin_edge(edge);
-      push_to_mindex(edge, m_mindex);
-    }
-  }
-
-
-  bool push_to_mindex(const Edge& edge, MultiIndex& mindex) {
-    if (m_dt.is_pinned(edge))
-      return false;
-    if (m_dt.is_target_cyclic(edge))
-      return false;
-
-    Rec_edge_2 pedge;
-    bool ok = create_pedge(edge, pedge);
-    if (!ok)
-      return false;
-    mindex.insert(pedge);
-    return true;
-  }
-
-
-
-  bool random_pedge(Rec_edge_2& pedge) {
-    for (unsigned i = 0; i < 10; ++i) {
-      Edge edge = m_dt.random_finite_edge();
-      if (m_dt.is_pinned(edge))
-        continue;
-      if (m_dt.is_target_cyclic(edge))
-        continue;
-      bool ok = create_pedge(edge, pedge);
-      if (ok)
-        return true;
-    }
-    return false;
-  }
-
-  template<class Iterator> // value_type = Edge
-  void remove_stencil_from_pqueue(Iterator begin, Iterator end) 
-  {
-    if (m_mindex.empty())
-      return;
-
-    Edge_vector edges;
-    collect_pqueue_stencil(m_dt, begin, end, edges);
-
-    typename Edge_vector::const_iterator ei;
-    for (ei = edges.begin(); ei != edges.end(); ++ei) {
-      Edge edge = *ei;
-      (m_mindex.template get<0>()).erase(Rec_edge_2(edge));
-    }
-  }
-
-  template<class Iterator> // value_type = Edge
-  void push_stencil_to_pqueue(Iterator begin, Iterator end) {
-    Edge_vector edges;
-    collect_pqueue_stencil(m_dt, begin, end, edges);
-
-    typename Edge_vector::const_iterator ei;
-    for (ei = edges.begin(); ei != edges.end(); ++ei) {
-      Edge edge = *ei;
-      push_to_mindex(edge, m_mindex);
-    }
-  }
-
-  template<class Iterator> // value_type = Edge
-  void collect_pqueue_stencil(
-    const Triangulation& mesh, Iterator begin, Iterator end, 
-    Edge_vector& edges) const
-  {
-    Vertex_handle_set vertex_set;
-    for (Iterator it = begin; it != end; ++it) {
-      Edge edge = *it;
-      Edge twin = mesh.twin_edge(edge);
-
-      Vertex_handle s = mesh.source_vertex(edge);
-      if (!s->pinned())
-        vertex_set.insert(s);
-
-      Vertex_handle t = mesh.target_vertex(edge);
-      if (!t->pinned())
-        vertex_set.insert(t);
-
-      Vertex_handle f = mesh.opposite_vertex(edge);
-      if (!f->pinned())
-        vertex_set.insert(f);
-
-      Vertex_handle b = mesh.opposite_vertex(twin);
-      if (!b->pinned())
-        vertex_set.insert(b);
-    }
-
-    typename Vertex_handle_set::const_iterator vi;
-    for (vi = vertex_set.begin(); vi != vertex_set.end(); ++vi) {
-      Vertex_handle v = *vi;
-      Edge_circulator ecirc = mesh.incident_edges(v);
-      Edge_circulator eend = ecirc;
-      CGAL_For_all(ecirc, eend)
-      {
-        Edge edge = *ecirc;
-        if (mesh.source_vertex(edge) != v)
-          edge = mesh.twin_edge(edge);
-        edges.push_back(edge);
-      }
-    }
-  }
-
-  // COPY STAR //
-
-  // edge must not be pinned or have cyclic target
-  Edge copy_star(const Edge& edge, Triangulation& copy) {
-    copy.tds().set_dimension(2);
-    copy.infinite_vertex()->pinned() = true;
-
-    // copy vertices
-    Vertex_handle_map cvmap;
-
-    Vertex_handle s = m_dt.source_vertex(edge);
-    Vertex_handle cs = copy.tds().create_vertex();
-    cvmap[s] = copy_vertex(s, cs);
-
-    Vertex_circulator vcirc = m_dt.incident_vertices(s);
-    Vertex_circulator vend = vcirc;
-    CGAL_For_all(vcirc, vend)
-    {
-      Vertex_handle v = vcirc;
-      if (cvmap.find(v) == cvmap.end()) {
-        Vertex_handle cv = copy.tds().create_vertex();
-        cvmap[v] = copy_vertex(v, cv);
-      }
-    }
-
-    // copy faces
-    Face_handle_map cfmap;
-    Face_circulator fcirc = m_dt.incident_faces(s);
-    Face_circulator fend = fcirc;
-    CGAL_For_all(fcirc, fend)
-    {
-      Face_handle f = fcirc;
-      Face_handle cf = copy.tds().create_face();
-      cfmap[f] = copy_face(f, cf, cvmap);
-    }
-
-    // set neighbors
-    fcirc = m_dt.incident_faces(s);
-    fend = fcirc;
-    CGAL_For_all(fcirc, fend)
-    {
-      Face_handle f = fcirc;
-      copy_neighbors(f, s, cvmap, cfmap);
-    }
-
-    // make copy homeomorphic to S^2
-    close_copy_mesh(cs, copy);
-
-    // copy samples surrounding star
-    copy_samples(s, cs, cfmap, copy);
-
-    // get copy of edge
-    Edge copy_edge = get_copy_edge(edge, cvmap, cfmap);
-    return copy_edge;
-  }
-
-  Vertex_handle copy_vertex(Vertex_handle v0, Vertex_handle v1) const {
-    v1->id() = v0->id();
-    v1->set_point(v0->point());
-    v1->pinned() = v0->pinned();
-    v1->set_sample(v0->sample());
-    return v1;
-  }
-
-  Face_handle copy_face(
-    Face_handle f0, Face_handle f1, Vertex_handle_map& vmap) const 
-  {
-    for (unsigned i = 0; i < 3; ++i) {
-      Vertex_handle v0i = f0->vertex(i);
-      Vertex_handle v1i = vmap[v0i];
-      f1->set_vertex(i, v1i);
-      v1i->set_face(f1);
-    }
-    return f1;
-  }
-
-  void copy_neighbors(
-    Face_handle f, Vertex_handle v, Vertex_handle_map& vmap,
-    Face_handle_map& fmap) const
-  {
-    int i = f->index(v);
-    Face_handle cf = fmap[f];
-    Vertex_handle cv = vmap[v];
-
-    if (fmap.find(f->neighbor(i)) != fmap.end()) {
-      Face_handle fi = f->neighbor(i);
-      Face_handle cfi = fmap[fi];
-      cf->set_neighbor(i, cfi);
-    }
-
-    for (unsigned j = 0; j < 2; ++j) {
-      i = (i + 1) % 3;
-      Face_handle fi = f->neighbor(i);
-      Face_handle cfi = fmap[fi];
-      cf->set_neighbor(i, cfi);
-    }
-  }
-
-  void close_copy_mesh(Vertex_handle vertex, Triangulation& copy) const {
-    std::vector<Face_handle> outer_faces;
-
-    Face_circulator fcirc = copy.incident_faces(vertex);
-    Face_circulator fend = fcirc;
-    CGAL_For_all(fcirc, fend)
-    {
-      Face_handle face = fcirc;
-      int i = face->index(vertex);
-
-      if (face->neighbor(i) != Face_handle())
-        continue;
-
-      Vertex_handle v1 = face->vertex((i + 1) % 3);
-      Vertex_handle v2 = face->vertex((i + 2) % 3);
-
-      Face_handle outer = copy.tds().create_face();
-      outer->set_vertex(0, copy.infinite_vertex());
-      outer->set_vertex(1, v2);
-      outer->set_vertex(2, v1);
-
-      face->set_neighbor(i, outer);
-      outer->set_neighbor(0, face);
-
-      outer_faces.push_back(outer);
-    }
-
-    for (unsigned i = 0; i < outer_faces.size(); ++i) {
-      unsigned j = (i + 1) % outer_faces.size();
-      outer_faces[i]->set_neighbor(2, outer_faces[j]);
-      outer_faces[j]->set_neighbor(1, outer_faces[i]);
-    }
-
-    if (!outer_faces.empty())
-      copy.infinite_vertex()->set_face(outer_faces[0]);
-  }
-
-  void copy_samples(
-    Vertex_handle vertex, Vertex_handle copy_vertex,
-    Face_handle_map& fmap, Triangulation& copy) const
-  {
-    Face_circulator fcirc = m_dt.incident_faces(vertex);
-    Face_circulator fend = fcirc;
-    CGAL_For_all(fcirc, fend)
-    {
-      Face_handle face = fcirc;
-      int index = face->index(vertex);
-      Edge twin = m_dt.twin_edge(Edge(face, index));
-
-      Face_handle copy_face = fmap[face];
-      index = copy_face->index(copy_vertex);
-      Edge copy_twin = copy.twin_edge(Edge(copy_face, index));
-
-      Sample_vector samples;
-      m_dt.collect_samples_from_edge(twin, samples);
-      copy_twin.first->samples(copy_twin.second) = samples;
-    }
-    copy_vertex->set_sample(NULL);
-  }
-
-  Edge get_copy_edge(
-    const Edge& edge, Vertex_handle_map& vmap, Face_handle_map& fmap) const 
-  {
-    Face_handle f = edge.first;
-    Vertex_handle v = f->vertex(edge.second);
-
-    Face_handle cf = fmap[f];
-    Vertex_handle cv = vmap[v];
-
-    return Edge(cf, cf->index(cv));
-  }
-
-  // RELOCATION //
-
-  void relocate_one_vertex(Vertex_handle vertex) {
-    std::swap(vertex->point(), vertex->relocated());
-    reassign_samples_around_vertex(vertex);
-  }
-
-  template<class Iterator> // value_type = Edge
-      void relocate_one_ring(Iterator begin, Iterator end) {
-    Vertex_handle_set vertices;
-    for (Iterator it = begin; it != end; ++it) {
-      Edge edge = *it;
-      vertices.insert(m_dt.source_vertex(edge));
-      vertices.insert(m_dt.target_vertex(edge));
-    }
-
-    typename Vertex_handle_set::const_iterator vi;
-    for (vi = vertices.begin(); vi != vertices.end(); ++vi) {
-      Vertex_handle v = *vi;
-      if (v->pinned())
-        continue;
-      v->relocated() = compute_relocation(v);
-    }
-
-    for (vi = vertices.begin(); vi != vertices.end(); ++vi) {
-      Vertex_handle v = *vi;
-      if (v->pinned())
-        continue;
-      if (v->point() == v->relocated())
-        continue;
-
-      Edge_vector hull;
-      m_dt.get_edges_from_star_minus_link(v, hull, false);
-      bool ok = m_dt.is_in_kernel(v->relocated(), hull.begin(),
-          hull.end());
-
-      if (ok) {
-        // do relocation
-        FT norm_bef = m_dt.compute_cost_around_vertex(v).norm();
-        relocate_one_vertex(v);
-        FT norm_aft = m_dt.compute_cost_around_vertex(v).norm();
-
-        if (norm_bef < norm_aft) {
-          // undo relocation
-          relocate_one_vertex(v);
-        } else if (m_mchoice == 0) {
-          // update queue
-          hull.clear();
-          m_dt.get_edges_from_star_minus_link(v, hull, true);
-          remove_stencil_from_pqueue(hull.begin(), hull.end());
-          push_stencil_to_pqueue(hull.begin(), hull.end());
-        }
-      }
-    }
-  }
-
-  /// \endcond
-
-
-  /// \cond SKIP_IN_MANUAL
-  Vector compute_gradient(Vertex_handle vertex) const {
-    Vector grad = m_traits.construct_vector_2_object()(FT(0), FT(0));
-    Edge_circulator ecirc = m_dt.incident_edges(vertex);
-    Edge_circulator eend = ecirc;
-    CGAL_For_all(ecirc, eend)
-    {
-      Edge edge = *ecirc;
-      if (m_dt.source_vertex(edge) != vertex)
-        edge = m_dt.twin_edge(edge);
-
-      if (m_dt.get_plan(edge) == 0)
-        grad = m_traits.construct_sum_of_vectors_2_object()(
-          grad, compute_gradient_for_plan0(edge));
-      else
-        grad = m_traits.construct_sum_of_vectors_2_object()(
-          grad, compute_gradient_for_plan1(edge));
-    }
-    return grad;
-  }
-
-  Point compute_relocation(Vertex_handle vertex) const {
-    FT coef = FT(0);
-    Vector rhs = m_traits.construct_vector_2_object()(FT(0), FT(0));
-
-    Edge_circulator ecirc = m_dt.incident_edges(vertex);
-    Edge_circulator eend = ecirc;
-    CGAL_For_all(ecirc, eend)
-    {
-      Edge edge = *ecirc;
-      if (m_dt.source_vertex(edge) != vertex)
-        edge = m_dt.twin_edge(edge);
-
-      if (m_dt.get_plan(edge) == 0)
-        compute_relocation_for_plan0(edge, coef, rhs);
-      else
-        compute_relocation_for_plan1(edge, coef, rhs);
-    }
-    compute_relocation_for_vertex(vertex, coef, rhs);
-
-    if (coef == FT(0))
-      return vertex->point();
-
-    return m_traits.construct_translated_point_2_object()(
-      CGAL::ORIGIN,
-      m_traits.construct_scaled_vector_2_object()(rhs, FT(1) / coef));
-  }
-
-  void compute_relocation_for_vertex(
-    Vertex_handle vertex, FT& coef, Vector& rhs) const
-  {
-    Sample_* sample = vertex->sample();
-    if (sample) {
-      const FT m = sample->mass();
-      const Point& ps = sample->point();
-      rhs = m_traits.construct_sum_of_vectors_2_object()(rhs, 
-        m_traits.construct_scaled_vector_2_object()(
-          m_traits.construct_vector_2_object()(CGAL::ORIGIN, ps), m));
-      coef += m;
-    }
-  }
-
-  Vector compute_gradient_for_plan0(const Edge& edge) const {
-    Edge twin = m_dt.twin_edge(edge);
-    const Point& pa = m_dt.source_vertex(edge)->point();
-    const Point& pb = m_dt.target_vertex(edge)->point();
-
-    Sample_vector samples;
-    m_dt.collect_samples_from_edge(edge, samples);
-    m_dt.collect_samples_from_edge(twin, samples);
-
-    Vector grad = m_traits.construct_vector_2_object()(FT(0), FT(0));
-    Sample_vector_const_iterator it;
-    for (it = samples.begin(); it != samples.end(); ++it) {
-      Sample_* sample = *it;
-      const FT m = sample->mass();
-      const Point& ps = sample->point();
-
-      FT Da = m_traits.compute_squared_distance_2_object()(ps, pa);
-      FT Db = m_traits.compute_squared_distance_2_object()(ps, pb);
-      if (Da < Db)
-        grad = m_traits.construct_sum_of_vectors_2_object()(
-          grad,
-          m_traits.construct_scaled_vector_2_object()(
-            m_traits.construct_vector_2_object()(ps, pa), m));
-    }
-    return grad;
-  }
-
-  void compute_relocation_for_plan0(
-    const Edge& edge, FT& coef, Vector& rhs) const 
-  {
-    Edge twin = m_dt.twin_edge(edge);
-    const Point& pa = m_dt.source_vertex(edge)->point();
-    const Point& pb = m_dt.target_vertex(edge)->point();
-
-    Sample_vector samples;
-    m_dt.collect_samples_from_edge(edge, samples);
-    m_dt.collect_samples_from_edge(twin, samples);
-
-    Sample_vector_const_iterator it;
-    for (it = samples.begin(); it != samples.end(); ++it) {
-      Sample_* sample = *it;
-      const FT m = sample->mass();
-      const Point& ps = sample->point();
-
-      FT Da = m_traits.compute_squared_distance_2_object()(ps, pa);
-      FT Db = m_traits.compute_squared_distance_2_object()(ps, pb);
-
-      if (Da < Db) {
-        rhs = m_traits.construct_sum_of_vectors_2_object()(rhs, 
-          m_traits.construct_scaled_vector_2_object()(
-            m_traits.construct_vector_2_object()(CGAL::ORIGIN, ps), m));
-        coef += m;
-      }
-    }
-  }
-
-  Vector compute_gradient_for_plan1(const Edge& edge) const {
-    //FT M = m_dt.get_mass(edge);
-    const Point& pa = m_dt.source_vertex(edge)->point();
-    const Point& pb = m_dt.target_vertex(edge)->point();
-
-    SQueue queue;
-    m_dt.sort_samples_from_edge(edge, queue);
-
-    //FT start = FT(0);
-    Vector grad = m_traits.construct_vector_2_object()(FT(0), FT(0));
-    while (!queue.empty()) {
-      PSample psample = queue.top();
-      queue.pop();
-
-      const FT m = psample.sample()->mass();
-      const Point& ps = psample.sample()->point();
-
-      // normal + tangnetial
-      const FT coord = psample.priority();
-      Point pf = m_traits.construct_translated_point_2_object()(
-        CGAL::ORIGIN,
-        m_traits.construct_sum_of_vectors_2_object()(
-          m_traits.construct_scaled_vector_2_object()(
-            m_traits.construct_vector_2_object()(CGAL::ORIGIN, pa), 
-            1.0 - coord),
-          m_traits.construct_scaled_vector_2_object()(
-            m_traits.construct_vector_2_object()(CGAL::ORIGIN, pb), 
-            coord)));
-      grad = m_traits.construct_sum_of_vectors_2_object()(
-        grad,
-        m_traits.construct_scaled_vector_2_object()(
-          m_traits.construct_vector_2_object()(ps, pf), m * (1.0 - coord)));
-
-      /*
-      // only normal
-      FT bin = m/M;
-      FT center = start + 0.5*bin;
-      Point pc = CGAL::ORIGIN + (1.0-center)*(pa - CGAL::ORIGIN) + center*(pb - CGAL::ORIGIN);
-      start += bin;
-      grad = grad + m*(bin*bin/12.0)*(pa - pb);
-      grad = grad + m*(1.0-center)*(pc - pf);
-      */
-    }
-    return grad;
-  }
-
-  void compute_relocation_for_plan1(
-    const Edge& edge, FT& coef, Vector& rhs) const 
-  {
-    //FT M = m_dt.get_mass(edge);
-    const Point& pb = m_dt.target_vertex(edge)->point();
-
-    SQueue queue;
-    m_dt.sort_samples_from_edge(edge, queue);
-
-    //FT start = FT(0);
-    while (!queue.empty()) {
-      PSample psample = queue.top();
-      queue.pop();
-
-      const FT m = psample.sample()->mass();
-      const Point& ps = psample.sample()->point();
-
-      const FT coord = psample.priority();
-      const FT one_minus_coord = 1.0 - coord;
-
-      // normal + tangential
-      coef += m * one_minus_coord * one_minus_coord;
-      rhs = m_traits.construct_sum_of_vectors_2_object()(
-        rhs,
-        m_traits.construct_scaled_vector_2_object()(
-          m_traits.construct_sum_of_vectors_2_object()(
-            m_traits.construct_vector_2_object()(CGAL::ORIGIN, ps),
-            m_traits.construct_scaled_vector_2_object()(
-              m_traits.construct_vector_2_object()(CGAL::ORIGIN, pb), -coord)),
-          m * one_minus_coord));
-
-      /*
-      // only normal
-      FT bin = m/M;
-      FT center = start + 0.5*bin;
-      Point pc = CGAL::ORIGIN + (1.0-center)*(pa - CGAL::ORIGIN) + center*(pb - CGAL::ORIGIN);
-      start += bin;
-      grad = grad + m*(bin*bin/12.0)*(pa - pb);
-      grad = grad + m*(1.0-center)*(pc - pf);
-       */
-
-      /*
-      // only normal
-      FT bin = m/M;
-      FT center = start + 0.5*bin;
-      FT one_minus_center = 1.0 - center;
-      start += bin;
-
-      coef += m*bin*bin/12.0;
-      rhs = rhs + m*(bin*bin/12.0)*(pb - CGAL::ORIGIN);
-
-      coef += m*one_minus_center*(coord - center);
-      rhs = rhs + m*one_minus_center*(coord - center)*(pb - CGAL::ORIGIN);
-       */
-    }
-  }
-
-  void print_stats_debug() const
-  {
-    int nb_solid = 0;
-    int nb_ghost = 0;
-    for (Finite_edges_iterator ei = m_dt.finite_edges_begin();
-        ei != m_dt.finite_edges_end(); ++ei)
-    {
-      Edge edge = *ei;
-      if (m_dt.is_ghost(edge))
-        nb_ghost++;
-      else
-        nb_solid++;
-    }
-
-    std::cerr << "STATS" << std::endl;
-    std::cerr << "# vertices : " << m_dt.number_of_vertices()-4 << std::endl;
-    std::cerr << "# triangles: " << m_dt.number_of_faces() << std::endl;
-    std::cerr << "# edges: " << m_dt.tds().number_of_edges() << std::endl;
-    std::cerr << "# solid: " << nb_solid << std::endl;
-    std::cerr << "# ghost: " << nb_ghost << std::endl;
-  }
-
-
-  /*!
-    Returns the number of vertices present in the reconstructed triangulation.
-   */
-  std::size_t number_of_vertices() const {
-    return m_dt.number_of_vertices() - 4;
-
-  }
-
-  /*!
-    Returns the number of (solid) edges present in the reconstructed triangulation.
-   */
-  int number_of_edges() const {
-    int nb_solid = 0;
-    for (Finite_edges_iterator ei = m_dt.finite_edges_begin();
-         ei != m_dt.finite_edges_end(); ++ei)
-    {
-      Edge edge = *ei;
-      if (m_dt.is_ghost(edge))
-        continue;
-      nb_solid++;
-    }
-    return nb_solid;
-  }
-
-
-  /*!
-    Returns the cost of the (solid) edges present in the 
-    reconstructed triangulation.
-   */
-  FT total_edge_cost() const {
-    FT total_cost = 0;
-    for (Finite_edges_iterator ei = m_dt.finite_edges_begin();
-         ei != m_dt.finite_edges_end(); ++ei) 
-    {
-      Edge edge = *ei;
-      if (m_dt.is_ghost(edge))
-        continue;
-
-      total_cost += m_dt.get_cost(edge).finalize();
-    }
-    return total_cost;
-  }
-
-  /// \endcond
-
-
-  /// \name Simplification 
-  /// You can freely mix calls of the following functions. 
-  /// @{
-  /*!
-    Computes a shape consisting of `np` points, reconstructing the input
-    points.
-    \param np The number of points which will be present in the output.
-   */
-  void run_until(std::size_t np) {
-    CGAL::Real_timer timer;
-    std::cerr << "reconstruct until " << np << " V";
-
-    timer.start();
-    std::size_t N = np + 4;
-    std::size_t performed = 0;
-    while (m_dt.number_of_vertices() > N) {
-      bool ok = decimate();
-      if (!ok)
-        break;
-      performed++;
-    }
-
-    std::cerr << " done" << " (" << performed
-        << " iters, " << m_dt.number_of_vertices() - 4 << " V "
-        << timer.time() << " s)"
-        << std::endl;
-  }
-
-  /*!
-    Computes a shape, reconstructing the input, by performing `steps`
-    edge collapse operators on the output simplex.
-    \param steps The number of edge collapse operators to be performed.
-   */
-  void run(const unsigned steps) {
-    CGAL::Real_timer timer;
-    std::cerr << "reconstruct " << steps;
-
-    timer.start();
-    unsigned performed = 0;
-    for (unsigned i = 0; i < steps; ++i) {
-      bool ok = decimate();
-      if (!ok)
-        break;
-      performed++;
-    }
-
-    std::cerr << " done" << " (" << performed << "/"
-        << steps << " iters, " << m_dt.number_of_vertices() - 4
-        << " V, " << timer.time() << " s)"
-        << std::endl;
-  }
-
-
-  /*!
-    Since noise and missing data may prevent the reconstructed shape to have sharp corners well located, the algorithm offers the possibility to automatically relocate points after each edge collapse. The new location of the points is chosen such that the fitting of the output segments to the input points is improved. 
-   */
-  void relocate_all_points() {
-    CGAL::Real_timer timer;
-    std::cerr << "relocate all points" << "...";
-
-    timer.start();
-    m_mindex.clear(); // pqueue must be recomputed
-
-    for (Finite_vertices_iterator v = m_dt.finite_vertices_begin();
-        v != m_dt.finite_vertices_end(); ++v) {
-      if (v->pinned())
-        continue;
-      v->relocated() = compute_relocation(v);
-    }
-
-    for (Finite_vertices_iterator v = m_dt.finite_vertices_begin();
-        v != m_dt.finite_vertices_end(); ++v) {
-      if (v->pinned())
-        continue;
-      if (v->point() == v->relocated())
-        continue;
-
-      Edge_vector hull;
-      m_dt.get_edges_from_star_minus_link(v, hull, false);
-      bool ok = m_dt.is_in_kernel(v->relocated(), hull.begin(),
-          hull.end());
-
-      if (ok) {
-        // do relocation
-        FT norm_bef = m_dt.compute_cost_around_vertex(v).norm();
-        relocate_one_vertex(v);
-        FT norm_aft = m_dt.compute_cost_around_vertex(v).norm();
-
-        // undo relocation
-        if (norm_bef < norm_aft)
-          relocate_one_vertex(v);
-      }
-    }
-
-    std::cerr << "done" << " (" << timer.time() << " s)" << std::endl;
-  }
-
-  /// @}
-
-  /// \name Output
-  /// @{
-
-  /*!
-    Writes the points and segments of the output simplex in an indexed format into output iterators.
-        \tparam PointOutputIterator An output iterator with value type 
-                \link Optimal_transportation_reconstruction_2::Point Point \endlink.
-        \tparam IndexOutputIterator An output iterator with value type 
-                `std::size_t`.
-        \tparam IndexPairOutputIterator An output iterator with value type 
-                `std::pair<std::size_t, std::size_t>`.
-
-        \param points The output iterator for all points.
-        \param isolated_points The output iterator for the indices of isolated points.
-        \param segments The output iterator for the pairs of segment indices.
-   */
-  template <
-    typename PointOutputIterator,
-    typename IndexOutputIterator,
-    typename IndexPairOutputIterator>
-  CGAL::cpp11::tuple<
-    PointOutputIterator, 
-    IndexOutputIterator,
-    IndexPairOutputIterator>
-  indexed_output(
-    PointOutputIterator points,
-    IndexOutputIterator isolated_points,
-    IndexPairOutputIterator segments) const
-  {
-    std::vector<Point> isolated_points_;
-    std::vector<Segment> edges;
-
-    list_output (
-        std::back_inserter(isolated_points_), std::back_inserter(edges));
-
-    // vertices_of_edges
-    std::set<Point> edge_vertices;
-    for (typename std::vector<Segment>::iterator it = edges.begin();
-        it != edges.end(); it++) {
-
-      Point a = (*it).source();
-      Point b = (*it).target();
-
-      edge_vertices.insert(a);
-      edge_vertices.insert(b);
-    }
-
-    std::size_t count_points = 0;
-    for (typename std::set<Point>::iterator it = edge_vertices.begin();
-        it != edge_vertices.end(); it++) {
-
-      *points++ = *it;
-      ++count_points;
-    }
-
-    for (typename std::vector<Point>::iterator it = isolated_points_.begin();
-        it != isolated_points_.end(); it++) {
-
-      *isolated_points++ = count_points;
-      *points++ = *it;
-      ++count_points;
-    }
-
-    for (typename std::vector<Segment>::iterator it = edges.begin();
-        it != edges.end(); it++) {
-
-      Point const& a = it->source();
-      Point const& b = it->target();
-
-      typename std::set<Point>::iterator it_a = edge_vertices.find(a);
-      typename std::set<Point>::iterator it_b = edge_vertices.find(b);
-
-      std::size_t pos_a = std::distance(edge_vertices.begin(), it_a);
-      std::size_t pos_b = std::distance(edge_vertices.begin(), it_b);
-
-      *segments++ = std::make_pair(pos_a, pos_b);
-    }
-
-    return CGAL::cpp11::make_tuple(points, isolated_points, segments);
-  }
-
-  /*!
-     Returns the solid edges and vertices present after the reconstruction
-     process finished.
-
-    \details It takes two output iterators, one for storing the
-    isolated points and one for storing the edges of the reconstructed shape.
-
-    \tparam PointOutputIterator An output iterator with value type 
-            \link Optimal_transportation_reconstruction_2::Point Point \endlink.
-    \tparam SegmentOutputIterator An output iterator with value type 
-            \link Optimal_transportation_reconstruction_2::Segment Segment \endlink.
-   */
-  template<class PointOutputIterator, class SegmentOutputIterator>
-  void list_output (PointOutputIterator v_it, SegmentOutputIterator e_it) const
-  {
-    for (Vertex_iterator vi = m_dt.vertices_begin();
-         vi != m_dt.vertices_end(); ++vi)
-    {
-      bool incident_edges_have_sample = false;
-      typename Triangulation::Edge_circulator start = m_dt.incident_edges(vi);
-      typename Triangulation::Edge_circulator cur   = start;
-
-      do {
-        if (!m_dt.is_ghost(*cur)) {
-          incident_edges_have_sample = true;
-          break;
-        }
-        ++cur;
-      } while (cur != start);
-
-      if (!incident_edges_have_sample) {
-        if ((*vi).has_sample_assigned()) {
-          Point p = (*vi).point();
-          *v_it = p;
-          v_it++;
-        }
-      }
-    }
-
-    for (Finite_edges_iterator ei = m_dt.finite_edges_begin(); ei != m_dt.finite_edges_end(); ++ei)
-    {
-      Edge edge = *ei;
-      if (m_dt.is_ghost(edge))
-        continue;
-
-      int index = edge.second;
-      Vertex_handle source = edge.first->vertex( (index+1)%3 );
-      Vertex_handle target = edge.first->vertex( (index+2)%3 );
-
-      Segment s = m_traits.construct_segment_2_object()(
-        source->point(), target->point());
-      *e_it = s;
-      e_it++;
-    }
-  }
-  /// \endcond
-
-
-  /// \cond SKIP_IN_MANUAL
-  void extract_tds_output(Triangulation& rt2) const {
-    rt2 = m_dt;
-    //mark vertices
-    for (Vertex_iterator vi = rt2.vertices_begin();
-        vi != rt2.vertices_end(); ++vi)
-    {
-      bool incident_edges_have_sample = false;
-      typename Triangulation::Edge_circulator start = rt2.incident_edges(vi);
-      typename Triangulation::Edge_circulator cur = start;
-
-      do {
-        if (!rt2.is_ghost(*cur)) {
-          incident_edges_have_sample = true;
-          break;
-        }
-        ++cur;
-      } while (cur != start);
-
-      if (!incident_edges_have_sample) {
-        if ((*vi).has_sample_assigned())
-          (*vi).set_relevance(1);
-      }
-    }
-
-    // mark edges
-    for (Finite_edges_iterator ei = rt2.finite_edges_begin(); ei != rt2.finite_edges_end(); ++ei)
-    {
-      Edge edge = *ei;
-      FT relevance = 0;
-      if (!rt2.is_ghost(edge)) {
-        relevance = rt2.get_edge_relevance(edge); // >= 0
-      }
-      edge.first->relevance(edge.second) = relevance;
-    }
-  }
-
-
-  /// \endcond
-  /// @}
-
-};
-} // namespace
-
-#endif // CGAL_OPTIMAL_TRANSPORTATION_RECONSTRUCTION_2_H_
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Orthogonal_incremental_neighbor_search.h b/3rdparty/CGAL-4.8/include/CGAL/Orthogonal_incremental_neighbor_search.h
deleted file mode 100644
index 54eb4f5..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Orthogonal_incremental_neighbor_search.h
+++ /dev/null
@@ -1,621 +0,0 @@
-// Copyright (c) 2002,2011 Utrecht University (The Netherlands).
-// 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
-// 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(s)     : Hans Tangelder (<hanst at cs.uu.nl>)
-
-#ifndef CGAL_ORTHOGONAL_INCREMENTAL_NEIGHBOR_SEARCH
-#define CGAL_ORTHOGONAL_INCREMENTAL_NEIGHBOR_SEARCH
-
-#include <cstring>
-#include <list>
-#include <queue>
-#include <memory>
-#include <CGAL/Kd_tree.h>
-#include <CGAL/Euclidean_distance.h>
-#include <CGAL/tuple.h>
-
-namespace CGAL {
-
-  template <class SearchTraits, 
-            class Distance_= typename internal::Spatial_searching_default_distance<SearchTraits>::type,
-            class Splitter_ = Sliding_midpoint<SearchTraits>,
-            class Tree_= Kd_tree<SearchTraits, Splitter_, Tag_true> >
-  class Orthogonal_incremental_neighbor_search {
-
-  public:
-    typedef Splitter_ Splitter;
-    typedef Tree_  Tree;
-    typedef Distance_ Distance;
-    typedef typename SearchTraits::Point_d Point_d;
-    typedef typename Distance::Query_item Query_item;
-    typedef typename SearchTraits::FT FT;
-    typedef typename Tree::Point_d_iterator Point_d_iterator;
-    typedef typename Tree::Node_const_handle Node_const_handle;
-
-    typedef std::pair<Point_d,FT> Point_with_transformed_distance;
-    typedef CGAL::cpp11::tuple<Node_const_handle,FT,std::vector<FT> > Node_with_distance;
-    typedef std::vector<Node_with_distance*> Node_with_distance_vector;
-    typedef std::vector<Point_with_transformed_distance*> Point_with_transformed_distance_vector;
-
-    template<class T>
-    struct Object_wrapper
-    {   
-      T object;
-      Object_wrapper(const T& t):object(t){}
-      const T& operator* () const { return object; }
-      const T* operator-> () const { return &object; }
-    };
-
-    class Iterator_implementation {
-      SearchTraits traits;
-    public:
-
-      int number_of_neighbours_computed;
-      int number_of_internal_nodes_visited;
-      int number_of_leaf_nodes_visited;
-      int number_of_items_visited;
-
-    private:
-
-      typedef std::vector<FT> Distance_vector;
-    
-      Distance_vector dists;
-
-      Distance Orthogonal_distance_instance;
-    
-      FT multiplication_factor;
-
-      Query_item query_point;
-
-      FT distance_to_root;
-
-      bool search_nearest_neighbour;
-
-      FT rd;
-
-
-      class Priority_higher {
-      public:
-
-        bool search_nearest;
-
-        Priority_higher(bool search_the_nearest_neighbour) 
-	  : search_nearest(search_the_nearest_neighbour)
-	{} 
-
-        //highest priority is smallest distance
-        bool 
-	operator() (Node_with_distance* n1, Node_with_distance* n2) const
-	{
-	  return (search_nearest) ? (CGAL::cpp11::get<1>(*n1) > CGAL::cpp11::get<1>(*n2)) : (CGAL::cpp11::get<1>(*n2) > CGAL::cpp11::get<1>(*n1));
-        }
-      };
-
-      class Distance_smaller {
-
-      public:
-
-        bool search_nearest;
-
-        Distance_smaller(bool search_the_nearest_neighbour) 
-	  : search_nearest(search_the_nearest_neighbour)
-	{}
-
-        //highest priority is smallest distance
-        bool operator() (Point_with_transformed_distance* p1, Point_with_transformed_distance* p2) const
-	{
-	  return (search_nearest) ? (p1->second > p2->second) : (p2->second > p1->second);
-        }
-      };
-
-
-      std::priority_queue<Node_with_distance*, Node_with_distance_vector,
-	                  Priority_higher> PriorityQueue;
-
-    public:
-      std::priority_queue<Point_with_transformed_distance*, Point_with_transformed_distance_vector,
-	                  Distance_smaller> Item_PriorityQueue;
-
-
-    public:
-
-      int reference_count;
-
-    
-
-      // constructor
-      Iterator_implementation(const Tree& tree,const Query_item& q, const Distance& tr,
-			      FT Eps=FT(0.0), bool search_nearest=true)
-	: traits(tree.traits()),number_of_neighbours_computed(0), number_of_internal_nodes_visited(0), 
-	number_of_leaf_nodes_visited(0), number_of_items_visited(0),
-	Orthogonal_distance_instance(tr), multiplication_factor(Orthogonal_distance_instance.transformed_distance(FT(1.0)+Eps)), 
-	query_point(q), search_nearest_neighbour(search_nearest), 
-	PriorityQueue(Priority_higher(search_nearest)), Item_PriorityQueue(Distance_smaller(search_nearest)),
-	reference_count(1)
-	  
-	  
-      {
-        if (tree.empty()) return;
-
-        typename SearchTraits::Construct_cartesian_const_iterator_d ccci=traits.construct_cartesian_const_iterator_d_object();
-        int dim = static_cast<int>(std::distance(ccci(q), ccci(q,0)));
-
-        dists.resize(dim);
-        for(int i=0 ; i<dim ; ++i){
-          dists[i] = 0;
-        }
-        
-        if (search_nearest){ 
-	  distance_to_root=
-	    Orthogonal_distance_instance.min_distance_to_rectangle(q, tree.bounding_box(),dists);
-          Node_with_distance *The_Root = new Node_with_distance(tree.root(),
-							        distance_to_root, dists);
-          PriorityQueue.push(The_Root);
-
-          // rd is the distance of the top of the priority queue to q
-          rd=CGAL::cpp11::get<1>(*The_Root);
-          Compute_the_next_nearest_neighbour();
-        }
-         else{
-           distance_to_root=
-   	 Orthogonal_distance_instance.max_distance_to_rectangle(q,
-						tree.bounding_box());
-           Node_with_distance *The_Root = new Node_with_distance(tree.root(),
-                                                                 distance_to_root, dists);
-        PriorityQueue.push(The_Root);
-
-        // rd is the distance of the top of the priority queue to q
-        rd=CGAL::cpp11::get<1>(*The_Root);
-        Compute_the_next_furthest_neighbour();
-         }
-
-        
-      }
-
-      // * operator
-      const Point_with_transformed_distance& 
-      operator* () const 
-      {
-	return *(Item_PriorityQueue.top());
-      }
-
-      // prefix operator
-      Iterator_implementation& 
-      operator++() 
-      {
-        Delete_the_current_item_top();
-        if(search_nearest_neighbour)
-          Compute_the_next_nearest_neighbour();
-        else
-          Compute_the_next_furthest_neighbour();
-        return *this;
-      }
-
-      // postfix operator
-      Object_wrapper<Point_with_transformed_distance>
-      operator++(int) 
-      {
-        Object_wrapper<Point_with_transformed_distance> result( *(Item_PriorityQueue.top()) );
-        ++*this;
-        return result;
-      }
-
-      // Print statistics of the general priority search process.
-      std::ostream& 
-      statistics (std::ostream& s) const {
-    	s << "Orthogonal priority search statistics:" 
-	  << std::endl;
-    	s << "Number of internal nodes visited:" 
-	  << number_of_internal_nodes_visited << std::endl;
-    	s << "Number of leaf nodes visited:" 
-	  << number_of_leaf_nodes_visited << std::endl;
-    	s << "Number of items visited:" 
-	  << number_of_items_visited << std::endl;
-        s << "Number of neighbours computed:" 
-	  << number_of_neighbours_computed << std::endl;
-        return s;
-      }
-
-
-      //destructor
-      ~Iterator_implementation() 
-      {
-	while (!PriorityQueue.empty()) {
-	  Node_with_distance* The_top=PriorityQueue.top();
-	  PriorityQueue.pop();
-	  delete The_top;
-	}
-	while (!Item_PriorityQueue.empty()) {
-	  Point_with_transformed_distance* The_top=Item_PriorityQueue.top();
-	  Item_PriorityQueue.pop();
-	  delete The_top;
-        }
-      }
-
-    private:
-
-      void 
-      Delete_the_current_item_top() 
-      {
-        Point_with_transformed_distance* The_item_top=Item_PriorityQueue.top();
-        Item_PriorityQueue.pop();
-        delete The_item_top;
-      }
-
-      void 
-      Compute_the_next_nearest_neighbour() 
-      {
-        // compute the next item
-        bool next_neighbour_found=false;
-        if (!(Item_PriorityQueue.empty())) {
-	    next_neighbour_found=
-	      (multiplication_factor*rd > Item_PriorityQueue.top()->second);
-        }
-	typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object();
-	typename SearchTraits::Cartesian_const_iterator_d query_point_it = construct_it(query_point);
-        // otherwise browse the tree further
-        while ((!next_neighbour_found) && (!PriorityQueue.empty())) {
-	  Node_with_distance* The_node_top=PriorityQueue.top();
-	  Node_const_handle N= CGAL::cpp11::get<0>(*The_node_top);
-          dists = CGAL::cpp11::get<2>(*The_node_top);
-	  PriorityQueue.pop();
-	  delete The_node_top;
-	  FT copy_rd=rd;
-	  while (!(N->is_leaf())) { // compute new distance
-            typename Tree::Internal_node_const_handle node =
-            static_cast<typename Tree::Internal_node_const_handle>(N);
-	    number_of_internal_nodes_visited++;
-	    int new_cut_dim=node->cutting_dimension();
-	    FT new_rd,dst = dists[new_cut_dim];
-	    FT val = *(query_point_it + new_cut_dim);
-            FT diff1 = val - node->high_value();
-            FT diff2 = val - node->low_value();
-	    if (diff1 + diff2 < FT(0.0)) {
-              new_rd=
-		Orthogonal_distance_instance.new_distance(copy_rd,dst,diff1,new_cut_dim);
-                
-	      CGAL_assertion(new_rd >= copy_rd);
-                dists[new_cut_dim] = diff1;
-                Node_with_distance *Upper_Child =
-		  new Node_with_distance(node->upper(), new_rd, dists);
-		PriorityQueue.push(Upper_Child);
-                dists[new_cut_dim] = dst;
-		N=node->lower();
-
-	    }
-	    else { // compute new distance
-	      new_rd=Orthogonal_distance_instance.new_distance(copy_rd,dst,diff2,new_cut_dim);  
-	      CGAL_assertion(new_rd >= copy_rd);
-                dists[new_cut_dim] = diff2;
-		Node_with_distance *Lower_Child =
-		  new Node_with_distance(node->lower(), new_rd, dists);
-		PriorityQueue.push(Lower_Child);
-                dists[new_cut_dim] = dst;
-		N=node->upper();
-	    }
-	  }
-	  // n is a leaf
-          typename Tree::Leaf_node_const_handle node =
-            static_cast<typename Tree::Leaf_node_const_handle>(N);
-	  number_of_leaf_nodes_visited++;
-	  if (node->size() > 0) {
-	    for (typename Tree::iterator it=node->begin(); it != node->end(); it++) {
-	      number_of_items_visited++;
-	      FT distance_to_query_point=
-		Orthogonal_distance_instance.transformed_distance(query_point,*it);
-	      Point_with_transformed_distance *NN_Candidate=
-		new Point_with_transformed_distance(*it,distance_to_query_point);
-	      Item_PriorityQueue.push(NN_Candidate);
-	    }
-	    // old top of PriorityQueue has been processed,
-	    // hence update rd
-                
-	    if (!(PriorityQueue.empty()))  {
-	      rd = CGAL::cpp11::get<1>(*PriorityQueue.top());
-		next_neighbour_found =
-                  (multiplication_factor*rd > 
-		   Item_PriorityQueue.top()->second);
-	    }
-	    else // priority queue empty => last neighbour found
-	      {
-		next_neighbour_found=true;
-	      }
-
-	    number_of_neighbours_computed++;
-	  }
-        }   // next_neighbour_found or priority queue is empty
-        // in the latter case also the item priority quee is empty
-      }
-
-
-      void 
-      Compute_the_next_furthest_neighbour() 
-      {
-        // compute the next item
-        bool next_neighbour_found=false;
-        if (!(Item_PriorityQueue.empty())) {
-	    next_neighbour_found=
-	      (rd < multiplication_factor*Item_PriorityQueue.top()->second);
-        }
-	typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object();
-	typename SearchTraits::Cartesian_const_iterator_d query_point_it = construct_it(query_point);
-        // otherwise browse the tree further
-        while ((!next_neighbour_found) && (!PriorityQueue.empty())) {
-	  Node_with_distance* The_node_top=PriorityQueue.top();
-	  Node_const_handle N= CGAL::cpp11::get<0>(*The_node_top);
-          dists = CGAL::cpp11::get<2>(*The_node_top);
-	  PriorityQueue.pop();
-	  delete The_node_top;
-	  FT copy_rd=rd;
-	  while (!(N->is_leaf())) { // compute new distance
-            typename Tree::Internal_node_const_handle node =
-              static_cast<typename Tree::Internal_node_const_handle>(N);
-	    number_of_internal_nodes_visited++;
-	    int new_cut_dim=node->cutting_dimension();
-	    FT new_rd,dst = dists[new_cut_dim];
-	    FT val = *(query_point_it + new_cut_dim);
-            FT diff1 = val - node->high_value();
-            FT diff2 = val - node->low_value();
-	    if (diff1 + diff2 < FT(0.0)) {
-              new_rd=
-		Orthogonal_distance_instance.new_distance(copy_rd,dst,diff1,new_cut_dim);
-                
-	      CGAL_assertion(new_rd >= copy_rd);
-		Node_with_distance *Lower_Child =
-		  new Node_with_distance(node->lower(), copy_rd, dists);
-		PriorityQueue.push(Lower_Child);
-		N=node->upper();
-                dists[new_cut_dim] = diff1;
-		copy_rd=new_rd;
-
-	    }
-	    else { // compute new distance
-	      new_rd=Orthogonal_distance_instance.new_distance(copy_rd,dst,diff2,new_cut_dim);  
-	      CGAL_assertion(new_rd >= copy_rd);
-		Node_with_distance *Upper_Child =
-		  new Node_with_distance(node->upper(), copy_rd, dists);
-		PriorityQueue.push(Upper_Child);
-		N=node->lower();
-                dists[new_cut_dim] = diff2;
-		copy_rd=new_rd;
-	    }
-	  }
-	  // n is a leaf
-          typename Tree::Leaf_node_const_handle node =
-            static_cast<typename Tree::Leaf_node_const_handle>(N);
-	  number_of_leaf_nodes_visited++;
-	  if (node->size() > 0) {
-	    for (typename Tree::iterator it=node->begin(); it != node->end(); it++) {
-	      number_of_items_visited++;
-	      FT distance_to_query_point=
-		Orthogonal_distance_instance.transformed_distance(query_point,*it);
-	      Point_with_transformed_distance *NN_Candidate=
-		new Point_with_transformed_distance(*it,distance_to_query_point);
-	      Item_PriorityQueue.push(NN_Candidate);
-	    }
-	    // old top of PriorityQueue has been processed,
-	    // hence update rd
-                
-	    if (!(PriorityQueue.empty()))  {
-	      rd = CGAL::cpp11::get<1>(*PriorityQueue.top());
-		next_neighbour_found =
-                  (multiplication_factor*rd < 
-		   Item_PriorityQueue.top()->second);
-	    }
-	    else // priority queue empty => last neighbour found
-	      {
-		next_neighbour_found=true;
-	      }
-
-	    number_of_neighbours_computed++;
-	  }
-        }   // next_neighbour_found or priority queue is empty
-        // in the latter case also the item priority quee is empty
-      }
-    }; // class Iterator_implementaion
-  
-
-
-
-
-
-
-    
-
-  public:
-    class iterator;
-    typedef iterator const_iterator;
-
-    // constructor
-    Orthogonal_incremental_neighbor_search(const Tree& tree,  
-					   const Query_item& q, FT Eps = FT(0.0), 
-					   bool search_nearest=true, const Distance& tr=Distance())
-      : m_tree(tree),m_query(q),m_dist(tr),m_Eps(Eps),m_search_nearest(search_nearest)
-    {}
-
-    iterator 
-    begin() const
-    {
-      return iterator(m_tree,m_query,m_dist,m_Eps,m_search_nearest);
-    }
-
-    iterator 
-    end() const
-    {
-      return iterator();
-    }
-
-    std::ostream& 
-    statistics(std::ostream& s) 
-    {
-      begin()->statistics(s);
-      return s;
-    }
-
-
-
-
-    class iterator {
-
-    public:
-
-      typedef std::input_iterator_tag iterator_category;
-      typedef Point_with_transformed_distance       value_type;
-      typedef Point_with_transformed_distance*      pointer;
-      typedef const Point_with_transformed_distance&      reference;
-      typedef std::size_t               size_type;
-      typedef std::ptrdiff_t            difference_type;
-      typedef int distance_type;
-
-      //class Iterator_implementation;
-      Iterator_implementation *Ptr_implementation;
-
-
-    public:
-
-      // default constructor
-      iterator() 
-      : Ptr_implementation(0)
-      {}
-
-      int 
-      the_number_of_items_visited() 
-      {
-        return Ptr_implementation->number_of_items_visited;
-      }
-
-      // constructor
-      iterator(const Tree& tree,const Query_item& q, const Distance& tr=Distance(), FT eps=FT(0.0), 
-	       bool search_nearest=true)
-	: Ptr_implementation(new Iterator_implementation(tree, q, tr, eps, search_nearest))
-	{}
-
-      // copy constructor
-      iterator(const iterator& Iter) 
-      {
-        Ptr_implementation = Iter.Ptr_implementation;
-        if (Ptr_implementation != 0) Ptr_implementation->reference_count++;
-      }
-
-      iterator& operator=(const iterator& Iter)
-      {
-        if (Ptr_implementation != Iter.Ptr_implementation){
-          if (Ptr_implementation != 0 && --(Ptr_implementation->reference_count)==0) {
-              delete Ptr_implementation;
-          }
-          Ptr_implementation = Iter.Ptr_implementation;
-          if (Ptr_implementation != 0) Ptr_implementation->reference_count++;
-        }
-        return *this;
-      }      
-      
-      
-      const Point_with_transformed_distance& 
-      operator* () const 
-      {
-	return *(*Ptr_implementation);
-      }
-      
-      // -> operator
-      const Point_with_transformed_distance*
-      operator-> () const 
-      {
-	return &*(*Ptr_implementation);
-      }
-
-      // prefix operator
-      iterator& 
-      operator++() 
-      {
-        ++(*Ptr_implementation);
-        return *this;
-      }
-
-      // postfix operator
-      Object_wrapper<Point_with_transformed_distance>
-      operator++(int) 
-      {
-	return (*Ptr_implementation)++;
-      }
-
-
-      bool 
-      operator==(const iterator& It) const 
-      {
-        if (
-	    ((Ptr_implementation == 0) || 
-	     Ptr_implementation->Item_PriorityQueue.empty()) &&
-	    ((It.Ptr_implementation == 0) ||  
-	     It.Ptr_implementation->Item_PriorityQueue.empty())
-	    )
-	  return true;
-        // else
-        return (Ptr_implementation == It.Ptr_implementation);
-      }
-
-      bool 
-      operator!=(const iterator& It) const 
-      {
-        return !(*this == It);
-      }
-
-      std::ostream& 
-      statistics (std::ostream& s) 
-      {
-    	Ptr_implementation->statistics(s);
-        return s;
-      }
-
-      ~iterator() 
-      {
-        if (Ptr_implementation != 0) {
-	  Ptr_implementation->reference_count--;
-	  if (Ptr_implementation->reference_count==0) {
-	    delete Ptr_implementation;
-	    Ptr_implementation = 0;
-	  }
-        }
-      }
-
-
-    }; // class iterator
-
-    //data members
-    const Tree& m_tree;
-    Query_item m_query;
-    Distance m_dist;
-    FT m_Eps; 
-    bool m_search_nearest;
-  }; // class 
-
-  template <class Traits, class Query_item, class Distance>
-  void swap (typename Orthogonal_incremental_neighbor_search<Traits, 
-	     Query_item, Distance>::iterator& x,
-	     typename Orthogonal_incremental_neighbor_search<Traits, 
-	     Query_item, Distance>::iterator& y) 
-  {
-    typename Orthogonal_incremental_neighbor_search<Traits, 
-      Query_item, Distance>::iterator::Iterator_implementation
-      *tmp = x.Ptr_implementation;
-    x.Ptr_implementation  = y.Ptr_implementation;
-    y.Ptr_implementation = tmp;
-  }
-
-} // namespace CGAL
-
-#endif // CGAL_ORTHOGONAL_INCREMENTAL_NEIGHBOR_SEARCH_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Orthogonal_k_neighbor_search.h b/3rdparty/CGAL-4.8/include/CGAL/Orthogonal_k_neighbor_search.h
deleted file mode 100644
index 0fe9226..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Orthogonal_k_neighbor_search.h
+++ /dev/null
@@ -1,189 +0,0 @@
-// Copyright (c) 2002,2011 Utrecht University (The Netherlands).
-// 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
-// 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(s)     : Gael Guennebaud (gael.guennebaud at inria.fr), Hans Tangelder (<hanst at cs.uu.nl>)
-
-#ifndef CGAL_ORTHOGONAL_K_NEIGHBOR_SEARCH_H
-#define CGAL_ORTHOGONAL_K_NEIGHBOR_SEARCH_H
-
-#include <CGAL/internal/K_neighbor_search.h>
-
-namespace CGAL {
-
-template <class SearchTraits, 
-          class Distance= typename internal::Spatial_searching_default_distance<SearchTraits>::type,
-          class Splitter= Sliding_midpoint<SearchTraits> ,
-          class Tree= Kd_tree<SearchTraits, Splitter, Tag_true> >
-class Orthogonal_k_neighbor_search: public internal::K_neighbor_search<SearchTraits,Distance,Splitter,Tree> {
-  typedef  internal::K_neighbor_search<SearchTraits,Distance,Splitter,Tree> Base;
-
-  typename SearchTraits::Cartesian_const_iterator_d query_object_it;
-  
-  std::vector<typename Base::FT> dists;
-public:
-  typedef typename Base::FT FT;
-
-
-  Orthogonal_k_neighbor_search(const Tree& tree, const typename Base::Query_item& q,  
-                               unsigned int k=1, FT Eps=FT(0.0), bool Search_nearest=true, const Distance& d=Distance(),bool sorted=true)
-    : Base(q,k,Eps,Search_nearest,d) 
-  {
-    if (tree.empty()) return;
-
-    typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=tree.traits().construct_cartesian_const_iterator_d_object();
-    query_object_it = construct_it(this->query_object);
-
-    int dim = static_cast<int>(std::distance(query_object_it, construct_it(this->query_object,0)));
-
-    dists.resize(dim);
-    for(int i=0;i<dim;i++)
-        dists[i]=0;
-
-    FT distance_to_root;
-    if (this->search_nearest){ 
-      distance_to_root = this->distance_instance.min_distance_to_rectangle(q, tree.bounding_box(),dists);
-      compute_nearest_neighbors_orthogonally(tree.root(), distance_to_root);
-    }
-    else {
-      distance_to_root = this->distance_instance.max_distance_to_rectangle(q, tree.bounding_box(),dists);
-      compute_furthest_neighbors_orthogonally(tree.root(), distance_to_root);
-    }
-
-    
-      
-          
-      
-    if (sorted) this->queue.sort();
-  }
-private:
-
-  void compute_nearest_neighbors_orthogonally(typename Base::Node_const_handle N, FT rd)
-  {
-    if (!(N->is_leaf())) 
-    {
-      typename Tree::Internal_node_const_handle node =
-        static_cast<typename Tree::Internal_node_const_handle>(N);
-      this->number_of_internal_nodes_visited++;
-      int new_cut_dim=node->cutting_dimension();
-      typename Base::Node_const_handle bestChild, otherChild;
-      FT new_off;
-      FT val = *(query_object_it + new_cut_dim);
-      FT diff1 = val - node->high_value();
-      FT diff2 = val - node->low_value();
-      if ( (diff1 + diff2 <  FT(0.0)) ) 
-      {
-          new_off = diff1;
-          bestChild = node->lower();
-          otherChild = node->upper();                      
-      }
-      else // compute new distance
-      {
-          new_off= diff2;
-          bestChild = node->upper();
-          otherChild = node->lower();
-      }
-      compute_nearest_neighbors_orthogonally(bestChild, rd);
-      FT dst=dists[new_cut_dim];
-      FT new_rd = this->distance_instance.new_distance(rd,dst,new_off,new_cut_dim);
-      dists[new_cut_dim]=new_off;
-        if (this->branch_nearest(new_rd)) 
-        {
-          compute_nearest_neighbors_orthogonally(otherChild, new_rd);
-        }
-      dists[new_cut_dim]=dst;
-    }
-    else
-    {
-      // n is a leaf
-      typename Tree::Leaf_node_const_handle node =
-        static_cast<typename Tree::Leaf_node_const_handle>(N);
-      this->number_of_leaf_nodes_visited++;
-      bool full = this->queue.full();
-      FT worst_dist = this->queue.top().second;
-      if (node->size() > 0)
-      {
-        for (typename Tree::iterator it=node->begin(); it != node->end(); it++) 
-        {
-          this->number_of_items_visited++;
-          FT distance_to_query_object=
-            this->distance_instance.transformed_distance(this->query_object,*it);
-          
-          if(!full || distance_to_query_object < worst_dist)
-            this->queue.insert(std::make_pair(&(*it),distance_to_query_object));
-        }
-      }
-    }
-  }    
-
-   void compute_furthest_neighbors_orthogonally(typename Base::Node_const_handle N, FT rd)
-  {
-    if (!(N->is_leaf())) 
-    {
-      typename Tree::Internal_node_const_handle node = 
-        static_cast<typename Tree::Internal_node_const_handle>(N);
-      this->number_of_internal_nodes_visited++;
-      int new_cut_dim=node->cutting_dimension();
-      typename Base::Node_const_handle bestChild, otherChild;
-      FT new_off;
-      FT val = *(query_object_it + new_cut_dim);
-      FT diff1 = val - node->high_value();
-      FT diff2 = val - node->low_value();
-      if ( (diff1 + diff2 >= FT(0.0)) ) 
-      {
-          new_off= diff2;
-          bestChild = node->upper();
-          otherChild = node->lower();
-      }
-      else // compute new distance
-      {
-          new_off= diff1;
-          bestChild = node->lower();
-          otherChild = node->upper();             
-      }
-      compute_furthest_neighbors_orthogonally(bestChild,rd);
-      FT dst=dists[new_cut_dim];
-      FT new_rd = this->distance_instance.new_distance(rd,dst,new_off,new_cut_dim);
-      dists[new_cut_dim]=new_off;
-        if (this->branch_furthest(new_rd)) 
-          compute_furthest_neighbors_orthogonally(otherChild, new_rd);
-      dists[new_cut_dim]=dst;
-    }
-    else
-    {
-      // n is a leaf
-      typename Tree::Leaf_node_const_handle node = 
-        static_cast<typename Tree::Leaf_node_const_handle>(N);
-      this->number_of_leaf_nodes_visited++;
-      if (node->size() > 0)
-      {
-        for (typename Tree::iterator it=node->begin(); it != node->end(); it++) 
-        {
-          this->number_of_items_visited++;
-          FT distance_to_query_object=
-            this->distance_instance.transformed_distance(this->query_object,*it);
-          this->queue.insert(std::make_pair(&(*it),distance_to_query_object));
-        }
-      }
-    }
-  }    
-  
-}; // class 
-
-} // namespace CGAL
-
-#endif  // CGAL_ORTHOGONAL_K_NEIGHBOR_SEARCH_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Periodic_2_Delaunay_triangulation_2.h b/3rdparty/CGAL-4.8/include/CGAL/Periodic_2_Delaunay_triangulation_2.h
deleted file mode 100644
index d678dc0..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Periodic_2_Delaunay_triangulation_2.h
+++ /dev/null
@@ -1,5376 +0,0 @@
-// Copyright (c) 1997-2013 INRIA Sophia-Antipolis (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
-// 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(s)     : Nico Kruithof <Nico at nghk.nl>
-
-#ifndef CGAL_PERIODIC_2_DELAUNAY_TRIANGULATION_2_H
-#define CGAL_PERIODIC_2_DELAUNAY_TRIANGULATION_2_H
-
-#include <CGAL/Periodic_2_triangulation_2.h>
-#include <CGAL/iterator.h>
-
-#ifndef CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
-#include <CGAL/Spatial_sort_traits_adapter_2.h>
-#include <CGAL/internal/info_check.h>
-
-#include <boost/iterator/zip_iterator.hpp>
-#include <boost/mpl/and.hpp>
-#endif //CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
-
-
-namespace CGAL
-{
-
-template <
-class Gt,
-      class Tds = Triangulation_data_structure_2 <
-      Periodic_2_triangulation_vertex_base_2<Gt>,
-      Periodic_2_triangulation_face_base_2<Gt> > >
-class Periodic_2_Delaunay_triangulation_2 : public Periodic_2_triangulation_2<Gt, Tds>
-{
-  typedef Periodic_2_Delaunay_triangulation_2<Gt, Tds>          Self;
-public:
-  typedef Periodic_2_triangulation_2<Gt, Tds>                   Triangulation;
-
-public:
-  typedef Tds                                  Triangulation_data_structure;
-  typedef Gt                                   Geom_traits;
-
-  typedef typename Gt::Periodic_2_offset_2     Offset;
-  typedef typename Gt::Iso_rectangle_2         Iso_rectangle;
-  typedef array<int, 2>                        Covering_sheets;
-
-  typedef typename Gt::FT                      FT;
-  typedef typename Gt::Point_2                 Point;
-  typedef typename Gt::Segment_2               Segment;
-  typedef typename Gt::Triangle_2              Triangle;
-
-  typedef std::pair<Point, Offset>              Periodic_point;
-  typedef array< std::pair<Point, Offset>, 2>   Periodic_segment;
-  typedef array< std::pair<Point, Offset>, 3>   Periodic_triangle;
-  typedef array< std::pair<Point, Offset>, 4>   Periodic_tetrahedron;
-
-  typedef typename Triangulation::size_type             size_type;
-  typedef typename Triangulation::Locate_type           Locate_type;
-  typedef typename Triangulation::Face_handle           Face_handle;
-  typedef typename Triangulation::Vertex_handle         Vertex_handle;
-  typedef typename Triangulation::Edge                  Edge;
-  typedef typename Triangulation::Edge_circulator       Edge_circulator;
-  typedef typename Triangulation::Face_circulator       Face_circulator;
-  typedef typename Triangulation::Vertex_circulator     Vertex_circulator;
-  typedef typename Triangulation::Finite_edges_iterator Finite_edges_iterator;
-  typedef typename Triangulation::Finite_faces_iterator Finite_faces_iterator;
-  typedef typename Triangulation::Finite_vertices_iterator
-  Finite_vertices_iterator;
-  typedef typename Triangulation::All_faces_iterator    All_faces_iterator;
-
-  typedef typename Triangulation::Edge_iterator    Edge_iterator;
-  typedef typename Triangulation::Face_iterator    Face_iterator;
-  typedef typename Triangulation::Vertex_iterator Vertex_iterator;
-
-
-public:
-#ifndef CGAL_CFG_USING_BASE_MEMBER_BUG_2
-  using Triangulation::empty;
-  using Triangulation::cw;
-  using Triangulation::ccw;
-  using Triangulation::tds;
-  using Triangulation::geom_traits;
-  using Triangulation::create_face;
-  using Triangulation::is_infinite;
-  using Triangulation::get_offset;
-  using Triangulation::set_offsets;
-  using Triangulation::int_to_off;
-  using Triangulation::is_1_cover;
-  using Triangulation::dimension;
-  using Triangulation::number_of_vertices;
-  using Triangulation::faces_begin;
-  using Triangulation::finite_edges_begin;
-  using Triangulation::finite_edges_end;
-  using Triangulation::get_neighbor_offset;
-  using Triangulation::combine_offsets;
-  using Triangulation::locate;
-  using Triangulation::number_of_sheets;
-  using Triangulation::orientation;
-  using Triangulation::side_of_oriented_circle;
-  using Triangulation::remove_degree_init;
-  using Triangulation::insert_too_long_edge;
-  using Triangulation::incident_faces;
-#endif
-
-  /// \name Constructors
-  // \{
-  /// Constructor
-  Periodic_2_Delaunay_triangulation_2(const Iso_rectangle & domain = Iso_rectangle(0, 0, 1, 1),
-                                      const Gt& gt = Gt())
-    : Periodic_2_triangulation_2<Gt, Tds>(domain, gt) {}
-
-  /// Copy constructor
-  Periodic_2_Delaunay_triangulation_2(
-    const Periodic_2_Delaunay_triangulation_2<Gt, Tds> &tr)
-    : Periodic_2_triangulation_2<Gt, Tds>(tr)
-  {
-    CGAL_triangulation_postcondition( is_valid(true) );
-  }
-
-  /// Constructor with insertion of points
-  template < class InputIterator >
-  Periodic_2_Delaunay_triangulation_2(InputIterator first, InputIterator last,
-                                      const Iso_rectangle & domain = Iso_rectangle(0, 0, 1, 1),
-                                      const Gt& gt = Gt())
-    : Periodic_2_triangulation_2<Gt, Tds>(domain, gt)
-  {
-    insert(first, last);
-  }
-
-  // \}
-
-  /// \name Insertion-Removal
-  // \{
-  Vertex_handle insert(const Point  &p,
-                       Face_handle start = Face_handle() );
-  Vertex_handle insert(const Point& p,
-                       Locate_type lt,
-                       Face_handle loc, int li );
-
-
-  /// Inserts a point in the triangulation.
-  Vertex_handle push_back(const Point &p);
-
-#ifndef CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
-  template < class InputIterator >
-  std::ptrdiff_t
-  insert(InputIterator first, InputIterator last,
-         bool is_large_point_set = true,
-         typename boost::enable_if <
-         boost::is_convertible <
-         typename std::iterator_traits<InputIterator>::value_type,
-         Point
-         > >::type* = NULL)
-#else
-  template < class InputIterator >
-  std::ptrdiff_t
-  insert(InputIterator first, InputIterator last, bool is_large_point_set = true)
-#endif //CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO 
-  {
-    if (first == last) return 0;
-
-    size_type n = number_of_vertices();
-
-    // The heuristic discards the existing triangulation so it can only be
-    // applied to empty triangulations.
-    if (n != 0) is_large_point_set = false;
-
-    std::set<Vertex_handle> dummy_points;
-    std::vector<Point> points(first, last);
-    typename std::vector<Point>::iterator pbegin = points.begin();
-
-    if (is_large_point_set)
-      {
-        std::vector<Vertex_handle> tmp_dummy_points = this->insert_dummy_points();
-        std::copy(tmp_dummy_points.begin(), tmp_dummy_points.end(),
-                  std::inserter(dummy_points, dummy_points.begin()));
-      }
-    else
-      {
-        std::random_shuffle (points.begin(), points.end());
-        pbegin = points.begin();
-
-        // The empty triangulation is a 1-cover by definition, insert at least one point
-        insert(*pbegin);
-        ++pbegin;
-        while (!is_1_cover())
-          {
-            if (pbegin == points.end())
-              return number_of_vertices() - n;
-            insert(*pbegin);
-            ++pbegin;
-          }
-      }
-
-    CGAL_assertion(is_1_cover());
-
-    // Insert the points
-    spatial_sort (pbegin, points.end(), geom_traits());
-
-    Face_handle f;
-    Locate_type lt;
-    int li;
-
-    for (typename std::vector<Point>::const_iterator p = pbegin, end = points.end();
-         p != end; ++p)
-      {
-        f = locate(*p, lt, li, f);
-
-        if (lt == Triangulation::VERTEX)
-          {
-            dummy_points.erase(f->vertex(li));
-          }
-        else
-          {
-            insert(*p, lt, f, li);
-          }
-      }
-
-    if (is_large_point_set)
-      {
-        for (typename std::set<Vertex_handle>::const_iterator it = dummy_points.begin();
-             it != dummy_points.end(); ++it)
-          {
-            remove(*it);
-          }
-      }
-
-    return number_of_vertices() - n;
-  }
-#ifndef CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
-private:
-  //top stands for tuple-or-pair
-  template <class Info>
-  const Point& top_get_first(const std::pair<Point, Info>& pair) const
-  {
-    return pair.first;
-  }
-  template <class Info>
-  const Info& top_get_second(const std::pair<Point, Info>& pair) const
-  {
-    return pair.second;
-  }
-  template <class Info>
-  const Point& top_get_first(const boost::tuple<Point, Info>& tuple) const
-  {
-    return boost::get<0>(tuple);
-  }
-  template <class Info>
-  const Info& top_get_second(const boost::tuple<Point, Info>& tuple) const
-  {
-    return boost::get<1>(tuple);
-  }
-
-  template <class Tuple_or_pair, class InputIterator>
-  std::ptrdiff_t insert_with_info(InputIterator first, InputIterator last, bool is_large_point_set)
-  {
-    if (first == last) return 0;
-
-    std::vector<std::ptrdiff_t> indices;
-    std::vector<Point> points;
-    std::vector<typename Tds::Vertex::Info> infos;
-    std::ptrdiff_t index = 0;
-    for (InputIterator it = first; it != last; ++it)
-      {
-        Tuple_or_pair value = *it;
-        points.push_back( top_get_first(value)  );
-        infos.push_back ( top_get_second(value) );
-        indices.push_back(index++);
-      }
-
-    typedef Spatial_sort_traits_adapter_2<Geom_traits, Point*> Search_traits;
-
-    size_type n = number_of_vertices();
-
-    // The heuristic discards the existing triangulation so it can only be
-    // applied to empty triangulations.
-    if (n != 0) is_large_point_set = false;
-
-    std::set<Vertex_handle> dummy_points;
-    typename std::vector<std::ptrdiff_t>::iterator pbegin = indices.begin();
-
-    if (is_large_point_set)
-      {
-        std::vector<Vertex_handle> tmp_dummy_points = this->insert_dummy_points();
-        std::copy(tmp_dummy_points.begin(), tmp_dummy_points.end(),
-                  std::inserter(dummy_points, dummy_points.begin()));
-      }
-    else
-      {
-        std::random_shuffle(indices.begin(), indices.end());
-        pbegin = indices.begin();
-
-        Vertex_handle v_new;
-
-        // The empty triangulation is a 1-cover by definition, insert at least one point
-        v_new = insert(points[*pbegin]);
-        v_new->info() = infos[*pbegin];
-        ++pbegin;
-
-        while (!is_1_cover())
-          {
-            if (pbegin == indices.end())
-              return number_of_vertices() - n;
-            v_new = insert(points[*pbegin]);
-            v_new->info() = infos[*pbegin];
-            ++pbegin;
-          }
-      }
-
-    CGAL_assertion(is_1_cover());
-
-    // Insert the points
-    spatial_sort(indices.begin(), indices.end(), Search_traits(&(points[0]), geom_traits()));
-
-    Face_handle f;
-    Locate_type lt;
-    int li;
-
-    Face_handle hint;
-    for (typename std::vector<std::ptrdiff_t>::const_iterator it = pbegin, end = indices.end();
-         it != end; ++it)
-      {
-        f = locate(points[*it], lt, li, f);
-
-        if (lt == Triangulation::VERTEX)
-          {
-            // Always copy the info, it might be a dummy vertex
-            f->vertex(li)->info() = infos[*it];
-            dummy_points.erase(f->vertex(li));
-          }
-        else
-          {
-            Vertex_handle v_new = insert(points[*it], lt, f, li);
-            v_new->info() = infos[*it];
-          }
-      }
-
-    if (is_large_point_set)
-      {
-        for (typename std::set<Vertex_handle>::const_iterator it = dummy_points.begin();
-             it != dummy_points.end(); ++it)
-          {
-            remove(*it);
-          }
-      }
-
-    return number_of_vertices() - n;
-  }
-
-
-public:
-
-  template < class InputIterator >
-  std::ptrdiff_t
-  insert( InputIterator first,
-          InputIterator last,
-          bool is_large_point_set = true,
-          typename boost::enable_if <
-          boost::is_convertible <
-          typename std::iterator_traits<InputIterator>::value_type,
-          std::pair<Point, typename internal::Info_check<typename Tds::Vertex>::type>
-          > >::type* = NULL
-        )
-  {
-    return insert_with_info< std::pair<Point, typename internal::Info_check<typename Tds::Vertex>::type> >(first, last, is_large_point_set);
-  }
-
-  template <class  InputIterator_1, class InputIterator_2>
-  std::ptrdiff_t
-  insert( boost::zip_iterator< boost::tuple<InputIterator_1, InputIterator_2> > first,
-          boost::zip_iterator< boost::tuple<InputIterator_1, InputIterator_2> > last,
-          bool is_large_point_set = true,
-          typename boost::enable_if <
-          boost::mpl::and_ <
-          boost::is_convertible< typename std::iterator_traits<InputIterator_1>::value_type, Point >,
-          boost::is_convertible< typename std::iterator_traits<InputIterator_2>::value_type, typename internal::Info_check<typename Tds::Vertex>::type >
-          > >::type* = NULL)
-  {
-    return insert_with_info< boost::tuple<Point, typename internal::Info_check<typename Tds::Vertex>::type> >(first, last, is_large_point_set);
-  }
-#endif //CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
-
-  void  remove(Vertex_handle v );
-  // \}
-
-  /// \name Displacement
-  // \{
-
-  Vertex_handle move_if_no_collision(Vertex_handle v, const Point &p);
-  Vertex_handle move_point(Vertex_handle v, const Point &p);
-  // \}
-
-  /// \name Check - Query
-  // \{
-  /// Returns the vertex closest to p, the point location will start from f
-  Vertex_handle
-  nearest_vertex(const Point& p, Face_handle f = Face_handle()) const;
-
-  template <class OutputItFaces, class OutputItBoundaryEdges>
-  std::pair<OutputItFaces, OutputItBoundaryEdges>
-  get_conflicts_and_boundary(const Point  &p,
-                             OutputItFaces fit,
-                             OutputItBoundaryEdges eit,
-                             Face_handle start = Face_handle()) const
-  {
-    CGAL_triangulation_precondition( dimension() == 2);
-    int li;
-    Locate_type lt;
-    Face_handle fh = locate(p, lt, li, start);
-    switch(lt)
-      {
-        //case Triangulation::EMPTY:
-      case Triangulation::VERTEX:
-        return std::make_pair(fit, eit);
-      case Triangulation::FACE:
-      case Triangulation::EDGE:
-      case Triangulation::EMPTY:
-        *fit++ = fh; //put fh in OutputItFaces
-        std::pair<OutputItFaces, OutputItBoundaryEdges> pit = std::make_pair(fit, eit);
-        pit = propagate_conflicts(p, fh, 0, pit);
-        pit = propagate_conflicts(p, fh, 1, pit);
-        pit = propagate_conflicts(p, fh, 2, pit);
-        return pit;
-      }
-    CGAL_triangulation_assertion(false);
-    return std::make_pair(fit, eit);
-  }
-
-  template <class OutputItFaces>
-  OutputItFaces
-  get_conflicts (const Point  &p,
-                 OutputItFaces fit,
-                 Face_handle start = Face_handle()) const
-  {
-    std::pair<OutputItFaces, Emptyset_iterator> pp =
-      get_conflicts_and_boundary(p, fit, Emptyset_iterator(), start);
-    return pp.first;
-  }
-
-  template <class OutputItBoundaryEdges>
-  OutputItBoundaryEdges
-  get_boundary_of_conflicts(const Point  &p,
-                            OutputItBoundaryEdges eit,
-                            Face_handle start = Face_handle()) const
-  {
-    std::pair<Emptyset_iterator, OutputItBoundaryEdges> pp =
-      get_conflicts_and_boundary(p, Emptyset_iterator(), eit, start);
-    return pp.second;
-  }
-  // \}
-
-
-  /// \name Dual
-  // \{
-  /// Returns the dual of f, which is the circumcenter of f.
-  Point dual(Face_handle f) const;
-  /// Returns the dual of e, which is always a segment in the periodic triangulation.
-  Segment dual(const Edge &e) const ;
-  /// Returns the dual of the edge pointed to by ec.
-  Segment dual(const Edge_circulator& ec) const;
-  /// Returns the dual of the edge pointed to by ei.
-  Segment dual(const Edge_iterator& ei) const;
-
-  template < class Stream>
-  Stream& draw_dual(Stream & ps)
-  {
-    Finite_edges_iterator eit = finite_edges_begin();
-    for (; eit != finite_edges_end(); ++eit)
-      {
-        ps << dual(eit);
-      }
-    return ps;
-  }
-  // \}
-
-  /// \name Checking
-  // \{
-  bool is_valid(bool verbose = false, int level = 0) const;
-
-  /// Checks whether f->vertex(i) lies outside the circumcircle of the face nb
-  inline bool locally_Delaunay(const Face_handle &f, int i, const Face_handle &nb);
-  // \}
-
-private:
-  /// Not in the documentation
-  inline void restore_Delaunay(Vertex_handle v);
-
-#ifndef CGAL_DT2_USE_RECURSIVE_PROPAGATING_FLIP
-  void non_recursive_propagating_flip(Face_handle f, int i);
-  void propagating_flip(const Face_handle& f, int i, int depth = 0);
-#else
-  void propagating_flip(const Face_handle& f, int i);
-#endif
-
-  // auxilliary functions for remove
-  // returns false if we first need to convert to a 9-cover before the vertex can be removed
-  bool remove_single_vertex(Vertex_handle v, const Offset &v_o);
-  void remove_degree_triangulate(Vertex_handle v, std::vector<Face_handle> &f,
-                                 std::vector<Vertex_handle> &w,
-                                 std::vector<int> &i, int d);
-  void remove_degree_triangulate(Vertex_handle v, std::vector<Face_handle> &f,
-                                 std::vector<Vertex_handle> &w, std::vector<Offset> &offset_w,
-                                 std::vector<int> &i, int d);
-  void remove_degree_d(Vertex_handle v, std::vector<Face_handle> &f,
-                       std::vector<Vertex_handle> &w,
-                       std::vector<int> &i, int d);
-  void remove_degree_d(Vertex_handle v, std::vector<Face_handle> &f,
-                       std::vector<Vertex_handle> &w, std::vector<Offset> &offset_w,
-                       std::vector<int> &i, int d);
-  /// Assumes that all offsets are (0,0)
-  void fill_hole_delaunay(std::list<Edge> & hole);
-  /// Fill hole over a periodic boundary
-  void fill_hole_delaunay(std::list<Edge> & hole,
-                          std::map<Vertex_handle, Offset> &vertex_offsets);
-
-  void remove_degree3(Vertex_handle v, std::vector<Face_handle> &f,
-                      std::vector<Vertex_handle> &w,
-                      std::vector<int> &i);
-  void remove_degree3(Vertex_handle v, std::vector<Face_handle> &f,
-                      std::vector<Vertex_handle> &w, std::vector<Offset> &o,
-                      std::vector<int> &i);
-  void remove_degree4(Vertex_handle v, std::vector<Face_handle> &f,
-                      std::vector<Vertex_handle> &w, std::vector<Offset> &o,
-                      std::vector<int> &i);
-  void remove_degree4(Vertex_handle v, std::vector<Face_handle> &f,
-                      std::vector<Vertex_handle> &w,
-                      std::vector<int> &i);
-  void remove_degree5(Vertex_handle v, std::vector<Face_handle> &f,
-                      std::vector<Vertex_handle> &w,
-                      std::vector<int> &i);
-  void remove_degree5(Vertex_handle v, std::vector<Face_handle> &f,
-                      std::vector<Vertex_handle> &w, std::vector<Offset> &o,
-                      std::vector<int> &i);
-  void remove_degree5_star   (Vertex_handle &v,
-                              Face_handle & , Face_handle & , Face_handle & , Face_handle & , Face_handle & ,
-                              Vertex_handle&, Vertex_handle&, Vertex_handle&, Vertex_handle&, Vertex_handle&,
-                              int           , int           , int           , int           , int );
-  void remove_degree5_star   (Vertex_handle &v,
-                              Face_handle & , Face_handle & , Face_handle & , Face_handle & , Face_handle & ,
-                              Vertex_handle&, Vertex_handle&, Vertex_handle&, Vertex_handle&, Vertex_handle&,
-                              Offset&, Offset&, Offset&, Offset&, Offset&,
-                              int           , int           , int           , int           , int );
-  void remove_degree6(Vertex_handle v, std::vector<Face_handle> &f,
-                      std::vector<Vertex_handle> &w,
-                      std::vector<int> &i);
-  void remove_degree6(Vertex_handle v, std::vector<Face_handle> &f,
-                      std::vector<Vertex_handle> &w, std::vector<Offset> &o,
-                      std::vector<int> &i);
-  void remove_degree6_star   (Vertex_handle &v,
-                              Face_handle & , Face_handle & , Face_handle & ,
-                              Face_handle & , Face_handle & , Face_handle & ,
-                              Vertex_handle&, Vertex_handle&, Vertex_handle&,
-                              Vertex_handle&, Vertex_handle&, Vertex_handle&,
-                              int           , int           , int           ,
-                              int           , int           , int );
-  void remove_degree6_star   (Vertex_handle &v,
-                              Face_handle & , Face_handle & , Face_handle & ,
-                              Face_handle & , Face_handle & , Face_handle & ,
-                              Vertex_handle&, Vertex_handle&, Vertex_handle&,
-                              Vertex_handle&, Vertex_handle&, Vertex_handle&,
-                              Offset&, Offset&, Offset&,
-                              Offset&, Offset&, Offset&,
-                              int           , int           , int           ,
-                              int           , int           , int );
-  void remove_degree6_N      (Vertex_handle &v,
-                              Face_handle & , Face_handle & , Face_handle & ,
-                              Face_handle & , Face_handle & , Face_handle & ,
-                              Vertex_handle&, Vertex_handle&, Vertex_handle&,
-                              Vertex_handle&, Vertex_handle&, Vertex_handle&,
-                              int           , int           , int           ,
-                              int           , int           , int  );
-  void remove_degree6_N      (Vertex_handle &v,
-                              Face_handle & , Face_handle & , Face_handle & ,
-                              Face_handle & , Face_handle & , Face_handle & ,
-                              Vertex_handle&, Vertex_handle&, Vertex_handle&,
-                              Vertex_handle&, Vertex_handle&, Vertex_handle&,
-                              Offset&, Offset&, Offset&,
-                              Offset&, Offset&, Offset&,
-                              int           , int           , int           ,
-                              int           , int           , int  );
-  void remove_degree6_antiN  (Vertex_handle &v,
-                              Face_handle & , Face_handle & , Face_handle & ,
-                              Face_handle & , Face_handle & , Face_handle & ,
-                              Vertex_handle&, Vertex_handle&, Vertex_handle&,
-                              Vertex_handle&, Vertex_handle&, Vertex_handle&,
-                              int           , int           , int           ,
-                              int           , int           , int  );
-  void remove_degree6_antiN  (Vertex_handle &v,
-                              Face_handle & , Face_handle & , Face_handle & ,
-                              Face_handle & , Face_handle & , Face_handle & ,
-                              Vertex_handle&, Vertex_handle&, Vertex_handle&,
-                              Vertex_handle&, Vertex_handle&, Vertex_handle&,
-                              Offset&, Offset&, Offset&,
-                              Offset&, Offset&, Offset&,
-                              int           , int           , int           ,
-                              int           , int           , int  );
-  void remove_degree6_diamond(Vertex_handle &v,
-                              Face_handle & , Face_handle & , Face_handle & ,
-                              Face_handle & , Face_handle & , Face_handle & ,
-                              Vertex_handle&, Vertex_handle&, Vertex_handle&,
-                              Vertex_handle&, Vertex_handle&, Vertex_handle&,
-                              int           , int           , int           ,
-                              int           , int           , int  );
-  void remove_degree6_diamond(Vertex_handle &v,
-                              Face_handle & , Face_handle & , Face_handle & ,
-                              Face_handle & , Face_handle & , Face_handle & ,
-                              Vertex_handle&, Vertex_handle&, Vertex_handle&,
-                              Vertex_handle&, Vertex_handle&, Vertex_handle&,
-                              Offset&, Offset&, Offset&,
-                              Offset&, Offset&, Offset&,
-                              int           , int           , int           ,
-                              int           , int           , int  );
-  void remove_degree7(Vertex_handle v, std::vector<Face_handle> &f,
-                      std::vector<Vertex_handle> &w,
-                      std::vector<int> &i);
-  void remove_degree7(Vertex_handle v, std::vector<Face_handle> &f,
-                      std::vector<Vertex_handle> &w, std::vector<Offset> &o,
-                      std::vector<int> &i);
-
-  void rotate7(int j, std::vector<Vertex_handle> &w,
-               std::vector<Face_handle> &f,
-               std::vector<int> &i);
-  void rotate7(int j, std::vector<Vertex_handle> &w,
-               std::vector<Face_handle> &f, std::vector<Offset> &o,
-               std::vector<int> &i);
-  /// Returns whether the simplicity criterion is satisfied
-  void get_offset_degree7(std::vector<Offset> &in_o, int out_o[]);
-  void remove_degree7_star      (Vertex_handle&, int, std::vector<Face_handle> &f,
-                                 std::vector<Vertex_handle> &w, std::vector<int> &i);
-  void remove_degree7_star      (Vertex_handle&, int, std::vector<Face_handle> &f,
-                                 std::vector<Vertex_handle> &w, std::vector<Offset> &o, std::vector<int> &i);
-  void remove_degree7_zigzag    (Vertex_handle&, int, std::vector<Face_handle> &f,
-                                 std::vector<Vertex_handle> &w, std::vector<int> &i);
-  void remove_degree7_zigzag    (Vertex_handle&, int, std::vector<Face_handle> &f,
-                                 std::vector<Vertex_handle> &w, std::vector<Offset> &o, std::vector<int> &i);
-  void remove_degree7_leftdelta (Vertex_handle&, int, std::vector<Face_handle> &f,
-                                 std::vector<Vertex_handle> &w, std::vector<int> &i);
-  void remove_degree7_leftdelta (Vertex_handle&, int, std::vector<Face_handle> &f,
-                                 std::vector<Vertex_handle> &w, std::vector<Offset> &o, std::vector<int> &i);
-  void remove_degree7_rightdelta(Vertex_handle&, int, std::vector<Face_handle> &f,
-                                 std::vector<Vertex_handle> &w, std::vector<int> &i);
-  void remove_degree7_rightdelta(Vertex_handle&, int, std::vector<Face_handle> &f,
-                                 std::vector<Vertex_handle> &w, std::vector<Offset> &o, std::vector<int> &i);
-  void remove_degree7_leftfan   (Vertex_handle&, int, std::vector<Face_handle> &f,
-                                 std::vector<Vertex_handle> &w, std::vector<int> &i);
-  void remove_degree7_leftfan   (Vertex_handle&, int, std::vector<Face_handle> &f,
-                                 std::vector<Vertex_handle> &w, std::vector<Offset> &o, std::vector<int> &i);
-  void remove_degree7_rightfan  (Vertex_handle&, int, std::vector<Face_handle> &f,
-                                 std::vector<Vertex_handle> &w, std::vector<int> &i);
-  void remove_degree7_rightfan  (Vertex_handle&, int, std::vector<Face_handle> &f,
-                                 std::vector<Vertex_handle> &w, std::vector<Offset> &o, std::vector<int> &i);
-
-  bool incircle(int x, int j, int k, int l, std::vector<Face_handle> &,
-                std::vector<Vertex_handle> &w, std::vector<int> &)
-  {
-
-    return side_of_oriented_circle(w[j]->point(), w[k]->point(), w[l]->point(), w[x]->point(),
-                                   true) ==  ON_POSITIVE_SIDE;
-  }
-  bool incircle(int x, int j, int k, int l, std::vector<Face_handle> &,
-                std::vector<Vertex_handle> &w, std::vector<Offset> &o, std::vector<int> &)
-  {
-
-    return side_of_oriented_circle(w[j]->point(), w[k]->point(), w[l]->point(), w[x]->point(),
-                                   o[j], o[k], o[l], o[x],
-                                   true) ==  ON_POSITIVE_SIDE;
-  }
-
-// end of auxilliary functions for remove
-
-
-
-
-  Vertex_handle nearest_vertex_2D(const Point& p, Face_handle f) const;
-
-  void  look_nearest_neighbor(const Point& p,
-                              Face_handle f,
-                              int i,
-                              Vertex_handle& nn) const;
-
-  template <class OutputItFaces, class OutputItBoundaryEdges>
-  std::pair<OutputItFaces, OutputItBoundaryEdges>
-  propagate_conflicts (const Point  &p,
-                       Face_handle fh,
-                       int i,
-                       std::pair<OutputItFaces, OutputItBoundaryEdges>
-                       pit)  const
-  {
-    Face_handle fn = fh->neighbor(i);
-    if (! test_conflict(p, fn))
-      {
-        *(pit.second)++ = Edge(fn, fn->index(fh));
-      }
-    else
-      {
-        *(pit.first)++ = fn;
-        int j = fn->index(fh);
-        pit = propagate_conflicts(p, fn, ccw(j), pit);
-        pit = propagate_conflicts(p, fn, cw(j), pit);
-      }
-    return pit;
-  }
-
-  bool test_conflict(const Point &p, Face_handle fh) const
-  {
-    return side_of_oriented_circle(fh, p, true) ==  ON_POSITIVE_SIDE;
-  }
-};
-
-template < class Gt, class Tds >
-bool
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-is_valid(bool verbose, int level) const
-{
-  // Check the parent
-  bool result = Periodic_2_triangulation_2<Gt, Tds>::is_valid(verbose, level);
-
-  // Check in_sphere:
-  if (dimension() == 2)
-    {
-      const Point *p[4];
-      Offset off[4];
-      for (Face_iterator fit = faces_begin();
-           fit != this->faces_end(); ++fit)
-        {
-          for (int i = 0; i < 3; i++)
-            {
-              p[i] = &fit->vertex(i)->point();
-              off[i] = get_offset(fit, i);
-            }
-
-          /// Check whether the vertices of the neighbor lie outside the circumcircle of the face
-          for (int i = 0; i < 3; ++i)
-            {
-              p[3]   = &fit->vertex(i)->point();
-              off[3] = combine_offsets(get_offset(fit, i), get_neighbor_offset(fit, i));
-
-              result &= ON_POSITIVE_SIDE !=
-                        side_of_oriented_circle(*p[0], *p[1], *p[2], *p[3],
-                                                off[0], off[1], off[2], off[3],
-                                                false);
-              CGAL_triangulation_assertion(result);
-            }
-        }
-    }
-
-  return result;
-}
-
-template < class Gt, class Tds >
-typename Periodic_2_Delaunay_triangulation_2<Gt, Tds>::Vertex_handle
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-nearest_vertex(const Point  &p, Face_handle f) const
-{
-  switch (dimension())
-    {
-    case 0:
-      return Vertex_handle();
-      //break;
-    case 2:
-      return nearest_vertex_2D(p, f);
-      //break;
-    }
-  return Vertex_handle();
-}
-
-template < class Gt, class Tds >
-typename Periodic_2_Delaunay_triangulation_2<Gt, Tds>::Vertex_handle
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-nearest_vertex_2D(const Point& p, Face_handle f) const
-{
-  CGAL_triangulation_precondition(dimension() == 2);
-  f = locate(p, f);
-
-  typename Geom_traits::Compare_distance_2 compare_distance =
-    geom_traits().compare_distance_2_object();
-  Vertex_handle nn =  f->vertex(0);
-  if (compare_distance(p, f->vertex(1)->point(), nn->point()) == SMALLER)
-    nn = f->vertex(1);
-  if (compare_distance(p, f->vertex(2)->point(), nn->point()) == SMALLER)
-    nn = f->vertex(2);
-
-  look_nearest_neighbor(p, f, 0, nn);
-  look_nearest_neighbor(p, f, 1, nn);
-  look_nearest_neighbor(p, f, 2, nn);
-
-  return nn;
-}
-
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-look_nearest_neighbor(const Point& p,
-                      Face_handle f,
-                      int i,
-                      Vertex_handle& nn) const
-{
-  Face_handle  ni = f->neighbor(i);
-  if ( this->side_of_oriented_circle(ni, p, true) != ON_POSITIVE_SIDE )
-    return;
-
-  typename Geom_traits::Compare_distance_2 compare_distance =
-    geom_traits().compare_distance_2_object();
-  i = ni->index(f);
-  if (compare_distance(p, ni->vertex(i)->point(), nn->point()) == SMALLER)
-    nn = ni->vertex(i);
-
-  // recursive exploration of triangles whose circumcircle contains p
-  look_nearest_neighbor(p, ni, ccw(i), nn);
-  look_nearest_neighbor(p, ni, cw(i), nn);
-}
-
-//DUALITY
-template<class Gt, class Tds>
-inline
-typename Periodic_2_Delaunay_triangulation_2<Gt, Tds>::Point
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-dual (Face_handle f) const
-{
-  CGAL_triangulation_precondition (dimension() == 2);
-  return Triangulation::circumcenter(f);
-}
-
-
-template < class Gt, class Tds >
-inline typename Gt::Segment_2
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-dual(const Edge &e) const
-{
-  // dimension==2
-  Face_handle nb = e.first->neighbor(e.second);
-  Point p0 = dual(e.first);
-  Point p1 = dual(nb);
-  Offset o = combine_offsets( Offset(), get_neighbor_offset(e.first, e.second));
-  Segment s = geom_traits().construct_segment_2_object()(p0, p1, o, Offset());
-
-  return s;
-}
-
-template < class Gt, class Tds >
-inline typename Gt::Segment_2
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-dual(const Edge_circulator& ec) const
-{
-  return dual(*ec);
-}
-template < class Gt, class Tds >
-inline typename Gt::Segment_2
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-dual(const Edge_iterator& ei) const
-{
-  return dual(*ei);
-}
-
-///////////////////////////////////////////////////////////////
-//  INSERT
-
-template < class Gt, class Tds >
-inline
-typename Periodic_2_Delaunay_triangulation_2<Gt, Tds>::Vertex_handle
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-insert(const Point  &p,  Face_handle start)
-{
-  CGAL_triangulation_assertion((this->domain().xmin() <= p.x()) &&
-                               (p.x() < this->domain().xmax()));
-  CGAL_triangulation_assertion((this->domain().ymin() <= p.y()) &&
-                               (p.y() < this->domain().ymax()));
-
-  if (empty())
-    {
-      return this->insert_first(p);
-    }
-
-  if (start == Face_handle())
-    {
-      start = this->faces_begin();
-    }
-
-  Locate_type lt;
-  int li;
-  Face_handle loc = locate (p, lt, li, start);
-
-  /// Call the insert function with the located simplex
-  return insert(p, lt, loc, li);
-}
-
-template < class Gt, class Tds >
-inline
-typename Periodic_2_Delaunay_triangulation_2<Gt, Tds>::Vertex_handle
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-push_back(const Point &p)
-{
-  return insert(p);
-}
-
-template < class Gt, class Tds >
-inline
-typename Periodic_2_Delaunay_triangulation_2<Gt, Tds>::Vertex_handle
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-insert(const Point  &p, Locate_type lt, Face_handle loc, int li)
-{
-  Vertex_handle vh = Triangulation::insert(p, lt, loc, li);
-
-  if (lt != Triangulation::VERTEX)
-    {
-      restore_Delaunay(vh);
-
-      if (!is_1_cover())
-        {
-          typename Triangulation::Virtual_vertex_reverse_map_it vertices_it =
-            this->virtual_vertices_reverse().find(vh);
-          CGAL_triangulation_assertion(vertices_it != this->virtual_vertices_reverse().end());
-          const std::vector<Vertex_handle> &virtual_vertices = vertices_it->second;
-          for (size_t i = 0; i < virtual_vertices.size(); ++i)
-            {
-              restore_Delaunay(virtual_vertices[i]);
-            }
-
-          this->try_to_convert_to_one_cover();
-          if (is_1_cover())
-            {
-              CGAL_triangulation_assertion(is_valid());
-            }
-        }
-    }
-
-  return vh;
-}
-
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-restore_Delaunay(Vertex_handle v)
-{
-  Face_handle f = v->face();
-  Face_handle next;
-  int i;
-  Face_handle start(f);
-  do
-    {
-      i = f->index(v);
-      next = f->neighbor(ccw(i));  // turn ccw around v
-      propagating_flip(f, i);
-      f = next;
-    }
-  while(next != start);
-}
-
-
-#ifndef CGAL_DT2_USE_RECURSIVE_PROPAGATING_FLIP
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-non_recursive_propagating_flip(Face_handle f , int i)
-{
-  std::stack<Edge> edges;
-  const Vertex_handle& vp = f->vertex(i);
-  edges.push(Edge(f, i));
-
-  while(! edges.empty())
-    {
-      const Edge& e = edges.top();
-      f = e.first;
-      i = e.second;
-      const Face_handle& n = f->neighbor(i);
-
-      if (locally_Delaunay(f, i, n))
-        {
-          edges.pop();
-          continue;
-        }
-      this->flip_single_edge(f, i);
-      // As we haven't popped it, we don't have to push it
-      edges.push(Edge(n, n->index(vp)));
-    }
-}
-
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-propagating_flip(const Face_handle& f, int i, int depth)
-{
-#ifdef CGAL_DT2_IMMEDIATELY_NON_RECURSIVE_PROPAGATING_FLIP
-  non_recursive_propagating_flip(f, i);
-#else
-  int max_depth = 100;
-  if(depth == max_depth)
-    {
-      non_recursive_propagating_flip(f, i);
-      return;
-    }
-  Face_handle n = f->neighbor(i);
-
-  if (locally_Delaunay(f, i, n))
-    return;
-
-  this->flip_single_edge(f, i);
-  propagating_flip(f, i, depth + 1);
-  i = n->index(f->vertex(i));
-  propagating_flip(n, i, depth + 1);
-#endif
-}
-#else
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-propagating_flip(Face_handle& f, int i)
-{
-  Face_handle nb = f->neighbor(i);
-
-  if (locally_Delaunay(f, nb))
-    return;
-
-  this->flip_single_edge(f, i);
-  propagating_flip(f, i);
-  i = nb->index(f->vertex(i));
-  propagating_flip(nb, i);
-}
-#endif
-
-template < class Gt, class Tds >
-bool
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-locally_Delaunay(const Face_handle &f, int i, const Face_handle &nb)
-{
-  CGAL_BRANCH_PROFILER("locally_Delaunay(), simplicity check failures", tmp);
-
-  bool simplicity_criterion = is_1_cover() && f->has_zero_offsets() && nb->has_zero_offsets();
-
-  const Point *p[4];
-  for (int index = 0; index < 3; ++index)
-    {
-      p[index]   = &nb->vertex(index)->point();
-    }
-  p[3]   = &f->vertex(i)->point();
-
-  Oriented_side os;
-  if (simplicity_criterion)
-    {
-      // No periodic offsets
-      os = side_of_oriented_circle(*p[0], *p[1], *p[2], *p[3], true);
-    }
-  else
-    {
-      CGAL_BRANCH_PROFILER_BRANCH(tmp);
-
-      Offset off[4];
-
-      for (int index = 0; index < 3; ++index)
-        {
-          off[index] = get_offset(nb, index);
-        }
-      off[3] = combine_offsets(get_offset(f, i), get_neighbor_offset(f, i));
-
-      os = side_of_oriented_circle(*p[0], *p[1], *p[2], *p[3],
-                                   off[0], off[1], off[2], off[3], true);
-    }
-
-  return (ON_POSITIVE_SIDE != os);
-}
-
-///////////////////////////////////////////////////////////////
-//  REMOVE    see INRIA RResearch Report 7104
-
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-remove(Vertex_handle v)
-{
-  // Make sure we have the original vertex
-  CGAL_assertion(v == this->get_original_vertex(v));
-
-  CGAL_triangulation_precondition(v != Vertex_handle());
-  CGAL_triangulation_precondition(dimension() == 2);
-
-  if ( this->number_of_vertices() == 1)
-    {
-      // Last vertex
-      Triangulation::remove_first(v);
-      return;
-    }
-
-  if (!remove_single_vertex(v, Offset()))
-    {
-      // The vertex was not removed as we need to revert to the 9-cover first
-      this->convert_to_9_sheeted_covering();
-
-      remove_single_vertex(v, Offset());
-    }
-
-  if (!is_1_cover())
-    {
-      CGAL_assertion(this->virtual_vertices_reverse().find(v) != this->virtual_vertices_reverse().end());
-
-      const std::vector<Vertex_handle> &virtual_copies = this->virtual_vertices_reverse().find(v)->second;
-      for (int i = 0; i < 8; ++i)
-        {
-          remove_single_vertex(virtual_copies[i], Offset((i + 1) / 3, (i + 1) % 3));
-        }
-
-      this->remove_from_virtual_copies(v);
-    }
-}
-
-template < class Gt, class Tds >
-bool
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-remove_single_vertex(Vertex_handle v, const Offset &v_o)
-{
-  static int maxd = 30;
-  static std::vector<Face_handle> f(maxd);
-  static std::vector<int> i(maxd);
-  static std::vector<Vertex_handle> w(maxd);
-  static std::vector<Offset> offset_w(maxd);
-  int d;
-  bool simplicity_criterion;
-
-  if (remove_degree_init(v, v_o, f, w, offset_w, i, d, maxd, simplicity_criterion))
-    {
-      if (is_1_cover())
-        {
-          // Don't delete if the hole is too big and the triangulation is a 1-cover
-          return false;
-        }
-    }
-
-  if (simplicity_criterion)
-    remove_degree_triangulate(v, f, w, i, d);
-  else
-    remove_degree_triangulate(v, f, w, offset_w, i, d);
-
-  this->delete_vertex(v);
-
-  return true;
-}
-
-
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-remove_degree_triangulate(Vertex_handle v,
-                          std::vector<Face_handle> &f,
-                          std::vector<Vertex_handle> &w,
-                          std::vector<int> &i, int d)
-{
-  // degree: 3: 1%, 4: 9%, 5: 23%, 6: 35%, 7: 19%, r: 10%
-
-  switch (d)
-    {
-    case 3:
-      remove_degree3(v, f, w, i);
-      break;
-    case 4:
-      remove_degree4(v, f, w, i);
-      break;
-    case 5:
-      remove_degree5(v, f, w, i);
-      break;
-    case 6:
-      remove_degree6(v, f, w, i);
-      break;
-    case 7:
-      remove_degree7(v, f, w, i);
-      break;
-    default:
-      remove_degree_d(v, f, w, i, d);
-      break;
-    }
-}
-
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-remove_degree_triangulate(Vertex_handle v,
-                          std::vector<Face_handle> &f,
-                          std::vector<Vertex_handle> &w,
-                          std::vector<Offset> &offset_w,
-                          std::vector<int> &i, int d)
-{
-  // degree: 3: 1%, 4: 9%, 5: 23%, 6: 35%, 7: 19%, r: 10%
-
-  // Remove all the edges that are too long.
-  // This only needs to be done when the simplicity condition is not
-  // met because the simplicity condition implies is_1_cover(), hence
-  // no too long edges.
-  this->remove_too_long_edges_in_star(v);
-
-  switch (d)
-    {
-    case 3:
-      remove_degree3(v, f, w, offset_w, i);
-      break;
-    case 4:
-      remove_degree4(v, f, w, offset_w, i);
-      break;
-    case 5:
-      remove_degree5(v, f, w, offset_w, i);
-      break;
-    case 6:
-      remove_degree6(v, f, w, offset_w, i);
-      break;
-    case 7:
-      remove_degree7(v, f, w, offset_w, i);
-      break;
-    default:
-      remove_degree_d(v, f, w, offset_w, i, d);
-      break;
-    }
-}
-
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-remove_degree_d(Vertex_handle v, std::vector<Face_handle> &,
-                std::vector<Vertex_handle> &,
-                std::vector<int> &, int)
-{
-  std::list<Edge> hole;
-  this->make_hole(v, hole);
-
-  fill_hole_delaunay(hole);
-
-  return;
-}
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-remove_degree_d(Vertex_handle v, std::vector<Face_handle> &,
-                std::vector<Vertex_handle> &w, std::vector<Offset> &offset_w,
-                std::vector<int> &, int d)
-{
-  std::list<Edge> hole;
-  this->make_hole(v, hole);
-
-  std::map<Vertex_handle, Offset> vertex_offsets;
-  for (int idx = 0; idx < d; ++idx)
-    {
-      vertex_offsets[w[idx]] = offset_w[idx];
-    }
-
-  fill_hole_delaunay(hole, vertex_offsets);
-
-  return;
-}
-
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-remove_degree3(Vertex_handle, std::vector<Face_handle> &f,
-               std::vector<Vertex_handle> &,
-               std::vector<int> &i)
-{
-  // modify the triangulation
-  Face_handle nn = f[1]->neighbor( i[1] );
-  tds().set_adjacency(f[0], ccw(i[0]) , nn , nn->index(f[1])  );
-  nn = f[2]->neighbor( i[2] );
-  tds().set_adjacency(f[0], cw(i[0]) , nn , nn->index(f[2])  );
-  f[0]->set_vertex  (            i[0] , f[1]->vertex( cw(i[1]) ) );
-
-  // clean container
-  tds().delete_face(f[1]);
-  tds().delete_face(f[2]);
-
-  this->set_offsets(f[0], 0, 0, 0);
-
-  return;
-}
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-remove_degree3(Vertex_handle, std::vector<Face_handle> &f,
-               std::vector<Vertex_handle> &, std::vector<Offset> &o,
-               std::vector<int> &i)
-{
-  // modify the triangulation
-  Face_handle nn = f[1]->neighbor( i[1] );
-  tds().set_adjacency(f[0], ccw(i[0]) , nn , nn->index(f[1])  );
-  nn = f[2]->neighbor( i[2] );
-  tds().set_adjacency(f[0], cw(i[0]) , nn , nn->index(f[2])  );
-  f[0]->set_vertex  (            i[0] , f[1]->vertex( cw(i[1]) ) );
-
-  // clean container
-  tds().delete_face(f[1]);
-  tds().delete_face(f[2]);
-
-  Offset oo[3];
-  oo[    i[0] ] = o[2];
-  oo[ cw(i[0])] = o[1];
-  oo[ccw(i[0])] = o[0];
-
-  if (oo[0].x() < 0 || oo[1].x() < 0 || oo[2].x() < 0)
-    {
-      Offset o(number_of_sheets()[0], 0);
-      oo[0] += o;
-      oo[1] += o;
-      oo[2] += o;
-    }
-  if (oo[0].y() < 0 || oo[1].y() < 0 || oo[2].y() < 0)
-    {
-      Offset o(0, number_of_sheets()[1]);
-      oo[0] += o;
-      oo[1] += o;
-      oo[2] += o;
-    }
-  this->set_offsets(f[0],
-                    (oo[0].x() >= number_of_sheets()[0] ? 2 : 0) + (oo[0].y() >= number_of_sheets()[1] ? 1 : 0),
-                    (oo[1].x() >= number_of_sheets()[0] ? 2 : 0) + (oo[1].y() >= number_of_sheets()[1] ? 1 : 0),
-                    (oo[2].x() >= number_of_sheets()[0] ? 2 : 0) + (oo[2].y() >= number_of_sheets()[1] ? 1 : 0));
-
-  return;
-}
-
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-remove_degree4(Vertex_handle, std::vector<Face_handle> &f,
-               std::vector<Vertex_handle> &w,
-               std::vector<int> &i )
-{
-  // removing a degree 4 vertex
-
-  Face_handle nn;
-
-  if ( !incircle(2, 0, 1, 3, f, w, i) )
-    {
-      // diagonal 1 3
-      f[0]->set_vertex( i[0], w[3] ); //w0 w1 w3
-      f[1]->set_vertex( i[1], w[3] ); //w1 w2 w3
-      nn = f[3]->neighbor( i[3] );
-      tds().set_adjacency(f[0], cw(i[0]) , nn , nn->index(f[3])  );
-      nn = f[2]->neighbor( i[2] );
-      tds().set_adjacency(f[1], ccw(i[1]) , nn , nn->index(f[2]) );
-      // clean container
-      tds().delete_face(f[2]);
-      tds().delete_face(f[3]);
-
-      f[0]->set_offsets(0, 0, 0);
-      f[1]->set_offsets(0, 0, 0);
-
-      insert_too_long_edge(f[0], ccw(i[0]));
-    }
-  else
-    {
-      // diagonal 0 2
-      f[0]->set_vertex( i[0], w[2]); //w0 w1 w2
-      f[3]->set_vertex( i[3], w[2]); //w3 w0 w2
-      nn = f[1]->neighbor( i[1] );
-      tds().set_adjacency(f[0], ccw(i[0]) , nn , nn->index(f[1])  );
-      nn = f[2]->neighbor( i[2] );
-      tds().set_adjacency(f[3], cw(i[3]) , nn , nn->index(f[2])  );
-      // clean container
-      tds().delete_face(f[1]);
-      tds().delete_face(f[2]);
-
-      f[0]->set_offsets(0, 0, 0);
-      f[3]->set_offsets(0, 0, 0);
-    }
-}
-
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-remove_degree4(Vertex_handle, std::vector<Face_handle> &f,
-               std::vector<Vertex_handle> &w, std::vector<Offset> &o,
-               std::vector<int> &i )
-{
-  // removing a degree 4 vertex
-
-  Face_handle nn;
-
-  int oo[4];
-  if ((o[0] == o[1]) && (o[0] == o[2]) && (o[0] == o[3]))
-    {
-      for (int i = 0; i < 4; ++i) oo[i] = 0;
-    }
-  else
-    {
-      Covering_sheets cover = number_of_sheets();
-      if ((o[0].x() < 0) || (o[1].x() < 0) || (o[2].x() < 0) || (o[3].x() < 0))
-        for (int i = 0; i < 4; ++i)
-          o[i] += Offset(cover[0], 0);
-
-      if ((o[0].y() < 0) || (o[1].y() < 0) || (o[2].y() < 0) || (o[3].y() < 0))
-        for (int i = 0; i < 4; ++i)
-          o[i] += Offset(0, cover[1]);
-
-      for (int i = 0; i < 4; ++i)
-        {
-          oo[i] = (o[i].x() >= cover[0] ? 2 : 0) + (o[i].y() >= cover[1] ? 1 : 0);
-        }
-    }
-
-  if ( !incircle(2, 0, 1, 3, f, w, o, i) )
-    {
-      // diagonal 1 3
-      f[0]->set_vertex( i[0], w[3] ); //w0 w1 w3
-      f[1]->set_vertex( i[1], w[3] ); //w1 w2 w3
-      nn = f[3]->neighbor( i[3] );
-      tds().set_adjacency(f[0], cw(i[0]) , nn , nn->index(f[3])  );
-      nn = f[2]->neighbor( i[2] );
-      tds().set_adjacency(f[1], ccw(i[1]) , nn , nn->index(f[2]) );
-      // clean container
-      tds().delete_face(f[2]);
-      tds().delete_face(f[3]);
-
-      int o_face[3];
-      o_face[i[0]]      = oo[3];
-      o_face[ccw(i[0])] = oo[0];
-      o_face[ cw(i[0])] = oo[1];
-      this->set_offsets(f[0], o_face[0], o_face[1], o_face[2]);
-      o_face[i[1]]      = oo[3];
-      o_face[ccw(i[1])] = oo[1];
-      o_face[ cw(i[1])] = oo[2];
-      this->set_offsets(f[1], o_face[0], o_face[1], o_face[2]);
-
-      insert_too_long_edge(f[0], ccw(i[0]));
-    }
-  else
-    {
-      // diagonal 0 2
-      f[0]->set_vertex( i[0], w[2]); //w0 w1 w2
-      f[3]->set_vertex( i[3], w[2]); //w3 w0 w2
-      nn = f[1]->neighbor( i[1] );
-      tds().set_adjacency(f[0], ccw(i[0]) , nn , nn->index(f[1])  );
-      nn = f[2]->neighbor( i[2] );
-      tds().set_adjacency(f[3], cw(i[3]) , nn , nn->index(f[2])  );
-      // clean container
-      tds().delete_face(f[1]);
-      tds().delete_face(f[2]);
-
-      int o_face[3];
-      o_face[i[0]]      = oo[2];
-      o_face[ccw(i[0])] = oo[0];
-      o_face[ cw(i[0])] = oo[1];
-      this->set_offsets(f[0], o_face[0], o_face[1], o_face[2]);
-      o_face[i[3]]      = oo[2];
-      o_face[ccw(i[3])] = oo[3];
-      o_face[ cw(i[3])] = oo[0];
-      this->set_offsets(f[3], o_face[0], o_face[1], o_face[2]);
-
-      insert_too_long_edge(f[3], ccw(i[3]));
-    }
-}
-
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-remove_degree5(Vertex_handle v, std::vector<Face_handle> &f,
-               std::vector<Vertex_handle> &w,
-               std::vector<int> &i)
-{
-  // removing a degree 5 vertex
-  this->remove_too_long_edges_in_star(v);
-
-  if (incircle(3, 0, 1, 2, f, w, i))
-    {
-      if (incircle(4, 0, 1, 3, f, w, i))
-        {
-          if (incircle(4, 1, 2, 3, f, w, i))
-            {
-              // star from 4
-              remove_degree5_star(v, f[4], f[0], f[1], f[2], f[3],
-                                  w[4], w[0], w[1], w[2], w[3],
-                                  i[4], i[0], i[1], i[2], i[3]);
-            }
-          else
-            {
-              //star from 1
-              remove_degree5_star(v, f[1], f[2], f[3], f[4], f[0],
-                                  w[1], w[2], w[3], w[4], w[0],
-                                  i[1], i[2], i[3], i[4], i[0]);
-
-
-            }
-        }
-      else
-        {
-          // star from 3
-          remove_degree5_star(v, f[3], f[4], f[0], f[1], f[2],
-                              w[3], w[4], w[0], w[1], w[2],
-                              i[3], i[4], i[0], i[1], i[2]);
-        }
-    }
-  else
-    {
-      if (incircle(4, 2, 3, 0, f, w, i))
-        {
-          if (incircle(4, 0, 1, 2, f, w, i))
-            {
-              // star from 4
-              remove_degree5_star(v, f[4], f[0], f[1], f[2], f[3],
-                                  w[4], w[0], w[1], w[2], w[3],
-                                  i[4], i[0], i[1], i[2], i[3]);
-            }
-          else
-            {
-              //star from 2
-              remove_degree5_star(v, f[2], f[3], f[4], f[0], f[1],
-                                  w[2], w[3], w[4], w[0], w[1],
-                                  i[2], i[3], i[4], i[0], i[1]);
-            }
-        }
-      else
-        {
-          // star from 0
-          remove_degree5_star(v, f[0], f[1], f[2], f[3], f[4],
-                              w[0], w[1], w[2], w[3], w[4],
-                              i[0], i[1], i[2], i[3], i[4]);
-        }
-    }
-  return;
-}
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-remove_degree5(Vertex_handle v, std::vector<Face_handle> &f,
-               std::vector<Vertex_handle> &w, std::vector<Offset> &o,
-               std::vector<int> &i)
-{
-  // removing a degree 5 vertex
-  this->remove_too_long_edges_in_star(v);
-
-  if (incircle(3, 0, 1, 2, f, w, o, i))
-    {
-      if (incircle(4, 0, 1, 3, f, w, o, i))
-        {
-          if (incircle(4, 1, 2, 3, f, w, o, i))
-            {
-              // star from 4
-              remove_degree5_star(v, f[4], f[0], f[1], f[2], f[3],
-                                  w[4], w[0], w[1], w[2], w[3],
-                                  o[4], o[0], o[1], o[2], o[3],
-                                  i[4], i[0], i[1], i[2], i[3]);
-            }
-          else
-            {
-              //star from 1
-              remove_degree5_star(v, f[1], f[2], f[3], f[4], f[0],
-                                  w[1], w[2], w[3], w[4], w[0],
-                                  o[1], o[2], o[3], o[4], o[0],
-                                  i[1], i[2], i[3], i[4], i[0]);
-
-
-            }
-        }
-      else
-        {
-          // star from 3
-          remove_degree5_star(v, f[3], f[4], f[0], f[1], f[2],
-                              w[3], w[4], w[0], w[1], w[2],
-                              o[3], o[4], o[0], o[1], o[2],
-                              i[3], i[4], i[0], i[1], i[2]);
-        }
-    }
-  else
-    {
-      if (incircle(4, 2, 3, 0, f, w, o, i))
-        {
-          if (incircle(4, 0, 1, 2, f, w, o, i))
-            {
-              // star from 4
-              remove_degree5_star(v, f[4], f[0], f[1], f[2], f[3],
-                                  w[4], w[0], w[1], w[2], w[3],
-                                  o[4], o[0], o[1], o[2], o[3],
-                                  i[4], i[0], i[1], i[2], i[3]);
-            }
-          else
-            {
-              //star from 2
-              remove_degree5_star(v, f[2], f[3], f[4], f[0], f[1],
-                                  w[2], w[3], w[4], w[0], w[1],
-                                  o[2], o[3], o[4], o[0], o[1],
-                                  i[2], i[3], i[4], i[0], i[1]);
-            }
-        }
-      else
-        {
-          // star from 0
-          remove_degree5_star(v, f[0], f[1], f[2], f[3], f[4],
-                              w[0], w[1], w[2], w[3], w[4],
-                              o[0], o[1], o[2], o[3], o[4],
-                              i[0], i[1], i[2], i[3], i[4]);
-        }
-    }
-  return;
-}
-
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::remove_degree5_star
-(Vertex_handle &,
- Face_handle &f0, Face_handle &f1, Face_handle &f2, Face_handle &f3, Face_handle &f4,
- Vertex_handle &v0, Vertex_handle &, Vertex_handle &, Vertex_handle &, Vertex_handle &,
- int i0, int i1, int i2, int i3, int i4 )
-{
-  // removing a degree 5 vertex, starring from v0
-  Face_handle nn;
-  f1->set_vertex( i1, v0) ;  // f1 = v1v2v0
-  f2->set_vertex( i2, v0) ;  // f2 = v2v3v0
-  f3->set_vertex( i3, v0) ;  // f3 = v3v4v0
-
-  nn = f0->neighbor( i0 );
-  tds().set_adjacency(f1, cw(i1) , nn , nn->index(f0) );
-  nn = f4->neighbor( i4 );
-  tds().set_adjacency(f3, ccw(i3) , nn , nn->index(f4) );
-  tds().delete_face(f0);
-  tds().delete_face(f4);
-
-  f1->set_offsets(0, 0, 0);
-  f2->set_offsets(0, 0, 0);
-  f3->set_offsets(0, 0, 0);
-}
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::remove_degree5_star
-(Vertex_handle &,
- Face_handle &f0, Face_handle &f1, Face_handle &f2, Face_handle &f3, Face_handle &f4,
- Vertex_handle &v0, Vertex_handle &, Vertex_handle &, Vertex_handle &, Vertex_handle &,
- Offset &o0, Offset &o1, Offset &o2, Offset &o3, Offset &o4,
- int i0, int i1, int i2, int i3, int i4 )
-{
-  // removing a degree 5 vertex, starring from v0
-  Face_handle nn;
-  f1->set_vertex( i1, v0) ;  // f1 = v1v2v0
-  f2->set_vertex( i2, v0) ;  // f2 = v2v3v0
-  f3->set_vertex( i3, v0) ;  // f3 = v3v4v0
-
-  nn = f0->neighbor( i0 );
-  tds().set_adjacency(f1, cw(i1) , nn , nn->index(f0) );
-  nn = f4->neighbor( i4 );
-  tds().set_adjacency(f3, ccw(i3) , nn , nn->index(f4) );
-  tds().delete_face(f0);
-  tds().delete_face(f4);
-
-  if (o0.x() < 0 || o1.x() < 0 || o2.x() < 0 || o3.x() < 0 || o4.x() < 0)
-    {
-      o0 += Offset(number_of_sheets()[0], 0);
-      o1 += Offset(number_of_sheets()[0], 0);
-      o2 += Offset(number_of_sheets()[0], 0);
-      o3 += Offset(number_of_sheets()[0], 0);
-      o4 += Offset(number_of_sheets()[0], 0);
-    }
-  if (o0.y() < 0 || o1.y() < 0 || o2.y() < 0 || o3.y() < 0 || o4.y() < 0)
-    {
-      o0 += Offset(0, number_of_sheets()[1]);
-      o1 += Offset(0, number_of_sheets()[1]);
-      o2 += Offset(0, number_of_sheets()[1]);
-      o3 += Offset(0, number_of_sheets()[1]);
-      o4 += Offset(0, number_of_sheets()[1]);
-    }
-  int oo0 = (o0.x() >= number_of_sheets()[0] ? 2 : 0) + (o0.y() >= number_of_sheets()[1] ? 1 : 0);
-  int oo1 = (o1.x() >= number_of_sheets()[0] ? 2 : 0) + (o1.y() >= number_of_sheets()[1] ? 1 : 0);
-  int oo2 = (o2.x() >= number_of_sheets()[0] ? 2 : 0) + (o2.y() >= number_of_sheets()[1] ? 1 : 0);
-  int oo3 = (o3.x() >= number_of_sheets()[0] ? 2 : 0) + (o3.y() >= number_of_sheets()[1] ? 1 : 0);
-  int oo4 = (o4.x() >= number_of_sheets()[0] ? 2 : 0) + (o4.y() >= number_of_sheets()[1] ? 1 : 0);
-
-  int oo[3];
-  oo[i1]      = oo0;
-  oo[ccw(i1)] = oo1;
-  oo[ cw(i1)] = oo2;
-  this->set_offsets(f1, oo[0], oo[1], oo[2]);
-  oo[i2]      = oo0;
-  oo[ccw(i2)] = oo2;
-  oo[ cw(i2)] = oo3;
-  this->set_offsets(f2, oo[0], oo[1], oo[2]);
-  oo[i3]      = oo0;
-  oo[ccw(i3)] = oo3;
-  oo[ cw(i3)] = oo4;
-  this->set_offsets(f3, oo[0], oo[1], oo[2]);
-
-  //insert_too_long_edges_in_star(f1->vertex(i1));
-  insert_too_long_edge(f1, ccw(i1));
-  insert_too_long_edge(f2, ccw(i2));
-}
-
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-remove_degree6(Vertex_handle v, std::vector<Face_handle> &f,
-               std::vector<Vertex_handle> &w,
-               std::vector<int> &i)
-{
-  if(incircle(1, 2, 3, 0, f, w, i))
-    {
-      if(incircle(4, 2, 3, 5, f, w, i))
-        {
-          if(incircle(1, 2, 3, 4, f, w, i))
-            {
-              if(incircle(4, 0, 1, 3, f, w, i))
-                {
-                  if(incircle(5, 0, 1, 4, f, w, i))
-                    {
-                      remove_degree6_star(v,
-                                          f[1], f[2], f[3], f[4], f[5], f[0],
-                                          w[1], w[2], w[3], w[4], w[5], w[0],
-                                          i[1], i[2], i[3], i[4], i[5], i[0]);
-                    }
-                  else
-                    {
-                      remove_degree6_N(v,
-                                       f[1], f[2], f[3], f[4], f[5], f[0],
-                                       w[1], w[2], w[3], w[4], w[5], w[0],
-                                       i[1], i[2], i[3], i[4], i[5], i[0]);
-                    }
-                }
-              else
-                {
-                  remove_degree6_antiN(v,
-                                       f[0], f[1], f[2], f[3], f[4], f[5],
-                                       w[0], w[1], w[2], w[3], w[4], w[5],
-                                       i[0], i[1], i[2], i[3], i[4], i[5]);
-                }
-            }
-          else
-            {
-              if(incircle(5, 1, 2, 4, f, w, i))
-                {
-                  remove_degree6_N(v, f[2], f[3], f[4], f[5], f[0], f[1],
-                                   w[2], w[3], w[4], w[5], w[0], w[1],
-                                   i[2], i[3], i[4], i[5], i[0], i[1]);
-                }
-              else
-                {
-                  if(incircle(5, 0, 1, 4, f, w, i))
-                    {
-                      remove_degree6_antiN(v,
-                                           f[1], f[2], f[3], f[4], f[5], f[0],
-                                           w[1], w[2], w[3], w[4], w[5], w[0],
-                                           i[1], i[2], i[3], i[4], i[5], i[0]);
-                    }
-                  else
-                    {
-                      remove_degree6_star(v, f[4], f[5], f[0], f[1], f[2], f[3],
-                                          w[4], w[5], w[0], w[1], w[2], w[3],
-                                          i[4], i[5], i[0], i[1], i[2], i[3]);
-                    }
-                }
-            }
-        }
-      else
-        {
-          if(incircle(1, 2, 3, 5, f, w, i))
-            {
-              if(incircle(1, 3, 4, 5, f, w, i))
-                {
-                  if(incircle(4, 0, 1, 3, f, w, i))
-                    {
-                      if(incircle(5, 0, 1, 4, f, w, i))
-                        {
-                          remove_degree6_star(v, f[1], f[2], f[3], f[4], f[5], f[0],
-                                              w[1], w[2], w[3], w[4], w[5], w[0],
-                                              i[1], i[2], i[3], i[4], i[5], i[0]);
-                        }
-                      else
-                        {
-                          remove_degree6_N(v, f[1], f[2], f[3], f[4], f[5], f[0],
-                                           w[1], w[2], w[3], w[4], w[5], w[0],
-                                           i[1], i[2], i[3], i[4], i[5], i[0]);
-                        }
-                    }
-                  else
-                    {
-                      remove_degree6_antiN(v, f[0], f[1], f[2], f[3], f[4], f[5],
-                                           w[0], w[1], w[2], w[3], w[4], w[5],
-                                           i[0], i[1], i[2], i[3], i[4], i[5]);
-                    }
-                }
-              else
-                {
-                  if(incircle(5, 0, 1, 3, f, w, i))
-                    {
-                      remove_degree6_diamond(v, f[1], f[2], f[3], f[4], f[5], f[0],
-                                             w[1], w[2], w[3], w[4], w[5], w[0],
-                                             i[1], i[2], i[3], i[4], i[5], i[0]);
-                    }
-                  else
-                    {
-                      if(incircle(4, 5, 0, 3, f, w, i))
-                        {
-                          remove_degree6_antiN(v, f[0], f[1], f[2], f[3], f[4], f[5],
-                                               w[0], w[1], w[2], w[3], w[4], w[5],
-                                               i[0], i[1], i[2], i[3], i[4], i[5]);
-                        }
-                      else
-                        {
-                          remove_degree6_star(v, f[3], f[4], f[5], f[0], f[1], f[2],
-                                              w[3], w[4], w[5], w[0], w[1], w[2],
-                                              i[3], i[4], i[5], i[0], i[1], i[2]);
-                        }
-                    }
-                }
-            }
-          else
-            {
-              remove_degree6_star(v, f[5], f[0], f[1], f[2], f[3], f[4],
-                                  w[5], w[0], w[1], w[2], w[3], w[4],
-                                  i[5], i[0], i[1], i[2], i[3], i[4]);
-            }
-        }
-    }
-  else
-    {
-      if(incircle(4, 2, 3, 5, f, w, i))
-        {
-          if(incircle(4, 2, 3, 0, f, w, i))
-            {
-              if(incircle(4, 0, 1, 2, f, w, i))
-                {
-                  if(incircle(4, 1, 2, 5, f, w, i))
-                    {
-                      if(incircle(4, 0, 1, 5, f, w, i))
-                        {
-                          remove_degree6_star(v, f[4], f[5], f[0], f[1], f[2], f[3],
-                                              w[4], w[5], w[0], w[1], w[2], w[3],
-                                              i[4], i[5], i[0], i[1], i[2], i[3]);
-                        }
-                      else
-                        {
-                          remove_degree6_antiN(v, f[1], f[2], f[3], f[4], f[5], f[0],
-                                               w[1], w[2], w[3], w[4], w[5], w[0],
-                                               i[1], i[2], i[3], i[4], i[5], i[0]);
-                        }
-                    }
-                  else
-                    {
-                      remove_degree6_N(v, f[2], f[3], f[4], f[5], f[0], f[1],
-                                       w[2], w[3], w[4], w[5], w[0], w[1],
-                                       i[2], i[3], i[4], i[5], i[0], i[1]);
-                    }
-                }
-              else
-                {
-                  if(incircle(4, 5, 0, 2, f, w, i))
-                    {
-                      remove_degree6_diamond(v, f[0], f[1], f[2], f[3], f[4], f[5],
-                                             w[0], w[1], w[2], w[3], w[4], w[5],
-                                             i[0], i[1], i[2], i[3], i[4], i[5]);
-                    }
-                  else
-                    {
-                      if(incircle(5, 0, 1, 2, f, w, i))
-                        {
-                          remove_degree6_N(v, f[2], f[3], f[4], f[5], f[0], f[1],
-                                           w[2], w[3], w[4], w[5], w[0], w[1],
-                                           i[2], i[3], i[4], i[5], i[0], i[1]);
-                        }
-                      else
-                        {
-                          remove_degree6_star(v, f[2], f[3], f[4], f[5], f[0], f[1],
-                                              w[2], w[3], w[4], w[5], w[0], w[1],
-                                              i[2], i[3], i[4], i[5], i[0], i[1]);
-                        }
-                    }
-                }
-            }
-          else
-            {
-              remove_degree6_star(v, f[0], f[1], f[2], f[3], f[4], f[5],
-                                  w[0], w[1], w[2], w[3], w[4], w[5],
-                                  i[0], i[1], i[2], i[3], i[4], i[5]);
-            }
-        }
-      else
-        {
-          if(incircle(5, 2, 3, 0, f, w, i))
-            {
-              if(incircle(5, 0, 1, 2, f, w, i))
-                {
-                  remove_degree6_star(v, f[5], f[0], f[1], f[2], f[3], f[4],
-                                      w[5], w[0], w[1], w[2], w[3], w[4],
-                                      i[5], i[0], i[1], i[2], i[3], i[4]);
-                }
-              else
-                {
-                  remove_degree6_antiN(v, f[2], f[3], f[4], f[5], f[0], f[1],
-                                       w[2], w[3], w[4], w[5], w[0], w[1],
-                                       i[2], i[3], i[4], i[5], i[0], i[1]);
-                }
-            }
-          else
-            {
-              if(incircle(4, 5, 0, 3, f, w, i))
-                {
-                  remove_degree6_star(v, f[0], f[1], f[2], f[3], f[4], f[5],
-                                      w[0], w[1], w[2], w[3], w[4], w[5],
-                                      i[0], i[1], i[2], i[3], i[4], i[5]);
-                }
-              else
-                {
-                  remove_degree6_N(v, f[0], f[1], f[2], f[3], f[4], f[5],
-                                   w[0], w[1], w[2], w[3], w[4], w[5],
-                                   i[0], i[1], i[2], i[3], i[4], i[5]);
-                }
-            }
-        }
-    }
-}
-
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-remove_degree6(Vertex_handle v, std::vector<Face_handle> &f,
-               std::vector<Vertex_handle> &w, std::vector<Offset> &o,
-               std::vector<int> &i)
-{
-  // removing a degree 6 vertex
-  this->remove_too_long_edges_in_star(v);
-
-  if(incircle(1, 2, 3, 0, f, w, o, i))
-    {
-      if(incircle(4, 2, 3, 5, f, w, o, i))
-        {
-          if(incircle(1, 2, 3, 4, f, w, o, i))
-            {
-              if(incircle(4, 0, 1, 3, f, w, o, i))
-                {
-                  if(incircle(5, 0, 1, 4, f, w, o, i))
-                    {
-                      remove_degree6_star(v,
-                                          f[1], f[2], f[3], f[4], f[5], f[0],
-                                          w[1], w[2], w[3], w[4], w[5], w[0],
-                                          o[1], o[2], o[3], o[4], o[5], o[0],
-                                          i[1], i[2], i[3], i[4], i[5], i[0]);
-                    }
-                  else
-                    {
-                      remove_degree6_N(v,
-                                       f[1], f[2], f[3], f[4], f[5], f[0],
-                                       w[1], w[2], w[3], w[4], w[5], w[0],
-                                       o[1], o[2], o[3], o[4], o[5], o[0],
-                                       i[1], i[2], i[3], i[4], i[5], i[0]);
-                    }
-                }
-              else
-                {
-                  remove_degree6_antiN(v,
-                                       f[0], f[1], f[2], f[3], f[4], f[5],
-                                       w[0], w[1], w[2], w[3], w[4], w[5],
-                                       o[0], o[1], o[2], o[3], o[4], o[5],
-                                       i[0], i[1], i[2], i[3], i[4], i[5]);
-                }
-            }
-          else
-            {
-              if(incircle(5, 1, 2, 4, f, w, o, i))
-                {
-                  remove_degree6_N(v, f[2], f[3], f[4], f[5], f[0], f[1],
-                                   w[2], w[3], w[4], w[5], w[0], w[1],
-                                   o[2], o[3], o[4], o[5], o[0], o[1],
-                                   i[2], i[3], i[4], i[5], i[0], i[1]);
-                }
-              else
-                {
-                  if(incircle(5, 0, 1, 4, f, w, o, i))
-                    {
-                      remove_degree6_antiN(v,
-                                           f[1], f[2], f[3], f[4], f[5], f[0],
-                                           w[1], w[2], w[3], w[4], w[5], w[0],
-                                           o[1], o[2], o[3], o[4], o[5], o[0],
-                                           i[1], i[2], i[3], i[4], i[5], i[0]);
-                    }
-                  else
-                    {
-                      remove_degree6_star(v, f[4], f[5], f[0], f[1], f[2], f[3],
-                                          w[4], w[5], w[0], w[1], w[2], w[3],
-                                          o[4], o[5], o[0], o[1], o[2], o[3],
-                                          i[4], i[5], i[0], i[1], i[2], i[3]);
-                    }
-                }
-            }
-        }
-      else
-        {
-          if(incircle(1, 2, 3, 5, f, w, o, i))
-            {
-              if(incircle(1, 3, 4, 5, f, w, o, i))
-                {
-                  if(incircle(4, 0, 1, 3, f, w, o, i))
-                    {
-                      if(incircle(5, 0, 1, 4, f, w, o, i))
-                        {
-                          remove_degree6_star(v, f[1], f[2], f[3], f[4], f[5], f[0],
-                                              w[1], w[2], w[3], w[4], w[5], w[0],
-                                              o[1], o[2], o[3], o[4], o[5], o[0],
-                                              i[1], i[2], i[3], i[4], i[5], i[0]);
-                        }
-                      else
-                        {
-                          remove_degree6_N(v, f[1], f[2], f[3], f[4], f[5], f[0],
-                                           w[1], w[2], w[3], w[4], w[5], w[0],
-                                           o[1], o[2], o[3], o[4], o[5], o[0],
-                                           i[1], i[2], i[3], i[4], i[5], i[0]);
-                        }
-                    }
-                  else
-                    {
-                      remove_degree6_antiN(v, f[0], f[1], f[2], f[3], f[4], f[5],
-                                           w[0], w[1], w[2], w[3], w[4], w[5],
-                                           o[0], o[1], o[2], o[3], o[4], o[5],
-                                           i[0], i[1], i[2], i[3], i[4], i[5]);
-                    }
-                }
-              else
-                {
-                  if(incircle(5, 0, 1, 3, f, w, o, i))
-                    {
-                      remove_degree6_diamond(v, f[1], f[2], f[3], f[4], f[5], f[0],
-                                             w[1], w[2], w[3], w[4], w[5], w[0],
-                                             o[1], o[2], o[3], o[4], o[5], o[0],
-                                             i[1], i[2], i[3], i[4], i[5], i[0]);
-                    }
-                  else
-                    {
-                      if(incircle(4, 5, 0, 3, f, w, o, i))
-                        {
-                          remove_degree6_antiN(v, f[0], f[1], f[2], f[3], f[4], f[5],
-                                               w[0], w[1], w[2], w[3], w[4], w[5],
-                                               o[0], o[1], o[2], o[3], o[4], o[5],
-                                               i[0], i[1], i[2], i[3], i[4], i[5]);
-                        }
-                      else
-                        {
-                          remove_degree6_star(v, f[3], f[4], f[5], f[0], f[1], f[2],
-                                              w[3], w[4], w[5], w[0], w[1], w[2],
-                                              o[3], o[4], o[5], o[0], o[1], o[2],
-                                              i[3], i[4], i[5], i[0], i[1], i[2]);
-                        }
-                    }
-                }
-            }
-          else
-            {
-              remove_degree6_star(v, f[5], f[0], f[1], f[2], f[3], f[4],
-                                  w[5], w[0], w[1], w[2], w[3], w[4],
-                                  o[5], o[0], o[1], o[2], o[3], o[4],
-                                  i[5], i[0], i[1], i[2], i[3], i[4]);
-            }
-        }
-    }
-  else
-    {
-      if(incircle(4, 2, 3, 5, f, w, o, i))
-        {
-          if(incircle(4, 2, 3, 0, f, w, o, i))
-            {
-              if(incircle(4, 0, 1, 2, f, w, o, i))
-                {
-                  if(incircle(4, 1, 2, 5, f, w, o, i))
-                    {
-                      if(incircle(4, 0, 1, 5, f, w, o, i))
-                        {
-                          remove_degree6_star(v, f[4], f[5], f[0], f[1], f[2], f[3],
-                                              w[4], w[5], w[0], w[1], w[2], w[3],
-                                              o[4], o[5], o[0], o[1], o[2], o[3],
-                                              i[4], i[5], i[0], i[1], i[2], i[3]);
-                        }
-                      else
-                        {
-                          remove_degree6_antiN(v, f[1], f[2], f[3], f[4], f[5], f[0],
-                                               w[1], w[2], w[3], w[4], w[5], w[0],
-                                               o[1], o[2], o[3], o[4], o[5], o[0],
-                                               i[1], i[2], i[3], i[4], i[5], i[0]);
-                        }
-                    }
-                  else
-                    {
-                      remove_degree6_N(v, f[2], f[3], f[4], f[5], f[0], f[1],
-                                       w[2], w[3], w[4], w[5], w[0], w[1],
-                                       o[2], o[3], o[4], o[5], o[0], o[1],
-                                       i[2], i[3], i[4], i[5], i[0], i[1]);
-                    }
-                }
-              else
-                {
-                  if(incircle(4, 5, 0, 2, f, w, o, i))
-                    {
-                      remove_degree6_diamond(v, f[0], f[1], f[2], f[3], f[4], f[5],
-                                             w[0], w[1], w[2], w[3], w[4], w[5],
-                                             o[0], o[1], o[2], o[3], o[4], o[5],
-                                             i[0], i[1], i[2], i[3], i[4], i[5]);
-                    }
-                  else
-                    {
-                      if(incircle(5, 0, 1, 2, f, w, o, i))
-                        {
-                          remove_degree6_N(v, f[2], f[3], f[4], f[5], f[0], f[1],
-                                           w[2], w[3], w[4], w[5], w[0], w[1],
-                                           o[2], o[3], o[4], o[5], o[0], o[1],
-                                           i[2], i[3], i[4], i[5], i[0], i[1]);
-                        }
-                      else
-                        {
-                          remove_degree6_star(v, f[2], f[3], f[4], f[5], f[0], f[1],
-                                              w[2], w[3], w[4], w[5], w[0], w[1],
-                                              o[2], o[3], o[4], o[5], o[0], o[1],
-                                              i[2], i[3], i[4], i[5], i[0], i[1]);
-                        }
-                    }
-                }
-            }
-          else
-            {
-              remove_degree6_star(v, f[0], f[1], f[2], f[3], f[4], f[5],
-                                  w[0], w[1], w[2], w[3], w[4], w[5],
-                                  o[0], o[1], o[2], o[3], o[4], o[5],
-                                  i[0], i[1], i[2], i[3], i[4], i[5]);
-            }
-        }
-      else
-        {
-          if(incircle(5, 2, 3, 0, f, w, o, i))
-            {
-              if(incircle(5, 0, 1, 2, f, w, o, i))
-                {
-                  remove_degree6_star(v, f[5], f[0], f[1], f[2], f[3], f[4],
-                                      w[5], w[0], w[1], w[2], w[3], w[4],
-                                      o[5], o[0], o[1], o[2], o[3], o[4],
-                                      i[5], i[0], i[1], i[2], i[3], i[4]);
-                }
-              else
-                {
-                  remove_degree6_antiN(v, f[2], f[3], f[4], f[5], f[0], f[1],
-                                       w[2], w[3], w[4], w[5], w[0], w[1],
-                                       o[2], o[3], o[4], o[5], o[0], o[1],
-                                       i[2], i[3], i[4], i[5], i[0], i[1]);
-                }
-            }
-          else
-            {
-              if(incircle(4, 5, 0, 3, f, w, o, i))
-                {
-                  remove_degree6_star(v, f[0], f[1], f[2], f[3], f[4], f[5],
-                                      w[0], w[1], w[2], w[3], w[4], w[5],
-                                      o[0], o[1], o[2], o[3], o[4], o[5],
-                                      i[0], i[1], i[2], i[3], i[4], i[5]);
-                }
-              else
-                {
-                  remove_degree6_N(v, f[0], f[1], f[2], f[3], f[4], f[5],
-                                   w[0], w[1], w[2], w[3], w[4], w[5],
-                                   o[0], o[1], o[2], o[3], o[4], o[5],
-                                   i[0], i[1], i[2], i[3], i[4], i[5]);
-                }
-            }
-        }
-    }
-}
-
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::remove_degree6_star
-(Vertex_handle &,
- Face_handle &  f0, Face_handle &  f1, Face_handle &  f2,
- Face_handle &  f3, Face_handle &  f4, Face_handle &  f5,
- Vertex_handle &v0, Vertex_handle &, Vertex_handle &,
- Vertex_handle &, Vertex_handle &, Vertex_handle &,
- int i0, int i1, int i2, int i3, int i4, int i5 )
-{
-  // removing a degree 6 vertex, staring from v0
-  Face_handle nn;
-  f1->set_vertex( i1, v0) ;  // f1 = v1v2v0
-  f2->set_vertex( i2, v0) ;  // f2 = v2v3v0
-  f3->set_vertex( i3, v0) ;  // f3 = v3v4v0
-  f4->set_vertex( i4, v0) ;  // f4 = v4v5v0
-  nn = f0->neighbor( i0 );
-  tds().set_adjacency(f1, cw(i1), nn, nn->index(f0));
-  nn = f5->neighbor( i5 );
-  tds().set_adjacency(f4, ccw(i4), nn,  nn->index(f5));
-  tds().delete_face(f0);
-  tds().delete_face(f5);
-
-  f1->set_offsets(0, 0, 0);
-  f2->set_offsets(0, 0, 0);
-  f3->set_offsets(0, 0, 0);
-  f4->set_offsets(0, 0, 0);
-}
-
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::remove_degree6_star
-(Vertex_handle &v,
- Face_handle &  f0, Face_handle &  f1, Face_handle &  f2,
- Face_handle &  f3, Face_handle &  f4, Face_handle &  f5,
- Vertex_handle &v0, Vertex_handle &v1, Vertex_handle &v2,
- Vertex_handle &v3, Vertex_handle &v4, Vertex_handle &v5,
- Offset &o0, Offset &o1, Offset &o2,
- Offset &o3, Offset &o4, Offset &o5,
- int i0, int i1, int i2, int i3, int i4, int i5 )
-{
-  // removing a degree 6 vertex, staring from v0
-  remove_degree6_star(v,
-                      f0, f1, f2, f3, f4, f5,
-                      v0, v1, v2, v3, v4, v5,
-                      i0, i1, i2, i3, i4, i5);
-
-  if (o0.x() < 0 || o1.x() < 0 || o2.x() < 0 || o3.x() < 0 || o4.x() < 0 || o5.x() < 0)
-    {
-      o0 += Offset(number_of_sheets()[0], 0);
-      o1 += Offset(number_of_sheets()[0], 0);
-      o2 += Offset(number_of_sheets()[0], 0);
-      o3 += Offset(number_of_sheets()[0], 0);
-      o4 += Offset(number_of_sheets()[0], 0);
-      o5 += Offset(number_of_sheets()[0], 0);
-    }
-  if (o0.y() < 0 || o1.y() < 0 || o2.y() < 0 || o3.y() < 0 || o4.y() < 0 || o5.y() < 0)
-    {
-      o0 += Offset(0, number_of_sheets()[1]);
-      o1 += Offset(0, number_of_sheets()[1]);
-      o2 += Offset(0, number_of_sheets()[1]);
-      o3 += Offset(0, number_of_sheets()[1]);
-      o4 += Offset(0, number_of_sheets()[1]);
-      o5 += Offset(0, number_of_sheets()[1]);
-    }
-  int oo0 = (o0.x() >= number_of_sheets()[0] ? 2 : 0) + (o0.y() >= number_of_sheets()[1] ? 1 : 0);
-  int oo1 = (o1.x() >= number_of_sheets()[0] ? 2 : 0) + (o1.y() >= number_of_sheets()[1] ? 1 : 0);
-  int oo2 = (o2.x() >= number_of_sheets()[0] ? 2 : 0) + (o2.y() >= number_of_sheets()[1] ? 1 : 0);
-  int oo3 = (o3.x() >= number_of_sheets()[0] ? 2 : 0) + (o3.y() >= number_of_sheets()[1] ? 1 : 0);
-  int oo4 = (o4.x() >= number_of_sheets()[0] ? 2 : 0) + (o4.y() >= number_of_sheets()[1] ? 1 : 0);
-  int oo5 = (o5.x() >= number_of_sheets()[0] ? 2 : 0) + (o5.y() >= number_of_sheets()[1] ? 1 : 0);
-
-  int oo[3];
-  oo[i1]      = oo0;
-  oo[ccw(i1)] = oo1;
-  oo[ cw(i1)] = oo2;
-  this->set_offsets(f1, oo[0], oo[1], oo[2]);
-  oo[i2]      = oo0;
-  oo[ccw(i2)] = oo2;
-  oo[ cw(i2)] = oo3;
-  this->set_offsets(f2, oo[0], oo[1], oo[2]);
-  oo[i3]      = oo0;
-  oo[ccw(i3)] = oo3;
-  oo[ cw(i3)] = oo4;
-  this->set_offsets(f3, oo[0], oo[1], oo[2]);
-  oo[i4]      = oo0;
-  oo[ccw(i4)] = oo4;
-  oo[ cw(i4)] = oo5;
-  this->set_offsets(f4, oo[0], oo[1], oo[2]);
-
-  insert_too_long_edge(f1, ccw(i1));
-  insert_too_long_edge(f2, ccw(i2));
-  insert_too_long_edge(f3, ccw(i3));
-}
-
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::remove_degree6_N
-(
-  Vertex_handle &,
-  Face_handle &  f0, Face_handle &  f1, Face_handle &  f2,
-  Face_handle &  f3, Face_handle &  f4, Face_handle &  f5,
-  Vertex_handle &v0, Vertex_handle &, Vertex_handle &,
-  Vertex_handle &v3, Vertex_handle &, Vertex_handle &,
-  int i0, int i1, int i2, int i3, int i4, int i5 )
-{
-  // removing a degree 6 vertex, N configuration with diagonal v0v3
-  Face_handle nn;
-  f1->set_vertex( i1, v0) ;  // f1 = v1v2v0
-  f2->set_vertex( i2, v0) ;  // f2 = v2v3v0
-  f4->set_vertex( i4, v3) ;  // f4 = v4v5v3
-  f5->set_vertex( i5, v3) ;  // f5 = v5v0v3
-  nn = f0->neighbor( i0 );
-  tds().set_adjacency(f1, cw(i1) , nn , nn->index(f0)  );
-  nn = f3->neighbor( i3 );
-  tds().set_adjacency(f4, cw(i4) , nn, nn->index(f3) );
-  tds().set_adjacency(f2, ccw(i2) , f5 , ccw(i5)  );
-  tds().delete_face(f0);
-  tds().delete_face(f3);
-
-  f1->set_offsets(0, 0, 0);
-  f2->set_offsets(0, 0, 0);
-  f4->set_offsets(0, 0, 0);
-  f5->set_offsets(0, 0, 0);
-}
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::remove_degree6_N
-(
-  Vertex_handle &v,
-  Face_handle &  f0, Face_handle &  f1, Face_handle &  f2,
-  Face_handle &  f3, Face_handle &  f4, Face_handle &  f5,
-  Vertex_handle &v0, Vertex_handle &v1, Vertex_handle &v2,
-  Vertex_handle &v3, Vertex_handle &v4, Vertex_handle &v5,
-  Offset &o0, Offset &o1, Offset &o2,
-  Offset &o3, Offset &o4, Offset &o5,
-  int i0, int i1, int i2, int i3, int i4, int i5 )
-{
-  // removing a degree 6 vertex, N configuration with diagonal v0v3
-
-  remove_degree6_N(v,
-                   f0, f1, f2, f3, f4, f5,
-                   v0, v1, v2, v3, v4, v5,
-                   i0, i1, i2, i3, i4, i5);
-
-  if (o0.x() < 0 || o1.x() < 0 || o2.x() < 0 || o3.x() < 0 || o4.x() < 0 || o5.x() < 0)
-    {
-      o0 += Offset(number_of_sheets()[0], 0);
-      o1 += Offset(number_of_sheets()[0], 0);
-      o2 += Offset(number_of_sheets()[0], 0);
-      o3 += Offset(number_of_sheets()[0], 0);
-      o4 += Offset(number_of_sheets()[0], 0);
-      o5 += Offset(number_of_sheets()[0], 0);
-    }
-  if (o0.y() < 0 || o1.y() < 0 || o2.y() < 0 || o3.y() < 0 || o4.y() < 0 || o5.y() < 0)
-    {
-      o0 += Offset(0, number_of_sheets()[1]);
-      o1 += Offset(0, number_of_sheets()[1]);
-      o2 += Offset(0, number_of_sheets()[1]);
-      o3 += Offset(0, number_of_sheets()[1]);
-      o4 += Offset(0, number_of_sheets()[1]);
-      o5 += Offset(0, number_of_sheets()[1]);
-    }
-  int oo0 = (o0.x() >= number_of_sheets()[0] ? 2 : 0) + (o0.y() >= number_of_sheets()[1] ? 1 : 0);
-  int oo1 = (o1.x() >= number_of_sheets()[0] ? 2 : 0) + (o1.y() >= number_of_sheets()[1] ? 1 : 0);
-  int oo2 = (o2.x() >= number_of_sheets()[0] ? 2 : 0) + (o2.y() >= number_of_sheets()[1] ? 1 : 0);
-  int oo3 = (o3.x() >= number_of_sheets()[0] ? 2 : 0) + (o3.y() >= number_of_sheets()[1] ? 1 : 0);
-  int oo4 = (o4.x() >= number_of_sheets()[0] ? 2 : 0) + (o4.y() >= number_of_sheets()[1] ? 1 : 0);
-  int oo5 = (o5.x() >= number_of_sheets()[0] ? 2 : 0) + (o5.y() >= number_of_sheets()[1] ? 1 : 0);
-
-  int oo[3];
-  oo[i1]      = oo0;
-  oo[ccw(i1)] = oo1;
-  oo[ cw(i1)] = oo2;
-  this->set_offsets(f1, oo[0], oo[1], oo[2]);
-  oo[i2]      = oo0;
-  oo[ccw(i2)] = oo2;
-  oo[ cw(i2)] = oo3;
-  this->set_offsets(f2, oo[0], oo[1], oo[2]);
-  oo[i4]      = oo3;
-  oo[ccw(i4)] = oo4;
-  oo[ cw(i4)] = oo5;
-  this->set_offsets(f4, oo[0], oo[1], oo[2]);
-  oo[i5]      = oo3;
-  oo[ccw(i5)] = oo5;
-  oo[ cw(i5)] = oo0;
-  this->set_offsets(f5, oo[0], oo[1], oo[2]);
-
-  insert_too_long_edge(f1, ccw(i1));
-  insert_too_long_edge(f2, ccw(i2));
-  insert_too_long_edge(f4, ccw(i4));
-  insert_too_long_edge(f5, ccw(i5));
-}
-
-
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::remove_degree6_antiN
-(
-  Vertex_handle &,
-  Face_handle &  f0, Face_handle &  f1, Face_handle &  f2,
-  Face_handle &  f3, Face_handle &  f4, Face_handle &  f5,
-  Vertex_handle &v0, Vertex_handle &, Vertex_handle &,
-  Vertex_handle &v3, Vertex_handle &, Vertex_handle &,
-  int i0, int i1, int i2, int i3, int i4, int i5 )
-{
-  // removing a degree 6 vertex, antiN configuration with diagonal v0v3
-  Face_handle nn;
-  f0->set_vertex( i0, v3) ;  // f0 = v0v1v3
-  f1->set_vertex( i1, v3) ;  // f1 = v1v2v3
-  f3->set_vertex( i3, v0) ;  // f3 = v3v4v0
-  f4->set_vertex( i4, v0) ;  // f4 = v4v5v0
-  nn = f2->neighbor( i2 );
-  tds().set_adjacency(f1, ccw(i1) , nn , nn->index(f2)  );
-  nn = f5->neighbor( i5 );
-  tds().set_adjacency(f4, ccw(i4) , nn , nn->index(f5) );
-  tds().set_adjacency(f0, cw(i0) , f3, cw(i3) );
-  tds().delete_face(f2);
-  tds().delete_face(f5);
-
-  f0->set_offsets(0, 0, 0);
-  f1->set_offsets(0, 0, 0);
-  f3->set_offsets(0, 0, 0);
-  f4->set_offsets(0, 0, 0);
-}
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::remove_degree6_antiN
-(
-  Vertex_handle &v,
-  Face_handle &  f0, Face_handle &  f1, Face_handle &  f2,
-  Face_handle &  f3, Face_handle &  f4, Face_handle &  f5,
-  Vertex_handle &v0, Vertex_handle &v1, Vertex_handle &v2,
-  Vertex_handle &v3, Vertex_handle &v4, Vertex_handle &v5,
-  Offset &o0, Offset &o1, Offset &o2,
-  Offset &o3, Offset &o4, Offset &o5,
-  int i0, int i1, int i2, int i3, int i4, int i5 )
-{
-  // removing a degree 6 vertex, antiN configuration with diagonal v0v3
-  remove_degree6_antiN(v,
-                       f0, f1, f2, f3, f4, f5,
-                       v0, v1, v2, v3, v4, v5,
-                       i0, i1, i2, i3, i4, i5);
-
-  if (o0.x() < 0 || o1.x() < 0 || o2.x() < 0 || o3.x() < 0 || o4.x() < 0 || o5.x() < 0)
-    {
-      o0 += Offset(number_of_sheets()[0], 0);
-      o1 += Offset(number_of_sheets()[0], 0);
-      o2 += Offset(number_of_sheets()[0], 0);
-      o3 += Offset(number_of_sheets()[0], 0);
-      o4 += Offset(number_of_sheets()[0], 0);
-      o5 += Offset(number_of_sheets()[0], 0);
-    }
-  if (o0.y() < 0 || o1.y() < 0 || o2.y() < 0 || o3.y() < 0 || o4.y() < 0 || o5.y() < 0)
-    {
-      o0 += Offset(0, number_of_sheets()[1]);
-      o1 += Offset(0, number_of_sheets()[1]);
-      o2 += Offset(0, number_of_sheets()[1]);
-      o3 += Offset(0, number_of_sheets()[1]);
-      o4 += Offset(0, number_of_sheets()[1]);
-      o5 += Offset(0, number_of_sheets()[1]);
-    }
-  int oo0 = (o0.x() >= number_of_sheets()[0] ? 2 : 0) + (o0.y() >= number_of_sheets()[1] ? 1 : 0);
-  int oo1 = (o1.x() >= number_of_sheets()[0] ? 2 : 0) + (o1.y() >= number_of_sheets()[1] ? 1 : 0);
-  int oo2 = (o2.x() >= number_of_sheets()[0] ? 2 : 0) + (o2.y() >= number_of_sheets()[1] ? 1 : 0);
-  int oo3 = (o3.x() >= number_of_sheets()[0] ? 2 : 0) + (o3.y() >= number_of_sheets()[1] ? 1 : 0);
-  int oo4 = (o4.x() >= number_of_sheets()[0] ? 2 : 0) + (o4.y() >= number_of_sheets()[1] ? 1 : 0);
-  int oo5 = (o5.x() >= number_of_sheets()[0] ? 2 : 0) + (o5.y() >= number_of_sheets()[1] ? 1 : 0);
-
-  int oo[3];
-  oo[i0]      = oo3;
-  oo[ccw(i0)] = oo0;
-  oo[ cw(i0)] = oo1;
-  this->set_offsets(f0, oo[0], oo[1], oo[2]);
-  oo[i1]      = oo3;
-  oo[ccw(i1)] = oo1;
-  oo[ cw(i1)] = oo2;
-  this->set_offsets(f1, oo[0], oo[1], oo[2]);
-  oo[i3]      = oo0;
-  oo[ccw(i3)] = oo3;
-  oo[ cw(i3)] = oo4;
-  this->set_offsets(f3, oo[0], oo[1], oo[2]);
-  oo[i4]      = oo0;
-  oo[ccw(i4)] = oo4;
-  oo[ cw(i4)] = oo5;
-  this->set_offsets(f4, oo[0], oo[1], oo[2]);
-
-  insert_too_long_edge(f0, ccw(i0));
-  insert_too_long_edge(f0,  cw(i0));
-  insert_too_long_edge(f3, ccw(i3));
-}
-
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::remove_degree6_diamond
-(
-  Vertex_handle &,
-  Face_handle &  f0, Face_handle &  f1, Face_handle &  f2,
-  Face_handle &  f3, Face_handle &  f4, Face_handle &  f5,
-  Vertex_handle &v0, Vertex_handle &, Vertex_handle &v2,
-  Vertex_handle &, Vertex_handle &v4, Vertex_handle &,
-  int i0, int i1, int i2, int i3, int i4, int i5 )
-{
-  // removing a degree 6 vertex, with chords v0v2 v2v4 v4v0
-  Face_handle nn;
-  f0->set_vertex( i0, v2) ;  // f0 = v0v1v2
-  f2->set_vertex( i2, v4) ;  // f2 = v2v3v4
-  f4->set_vertex( i4, v0) ;  // f4 = v4v5v0
-  f1->set_vertex( i1, v4) ;
-  f1->set_vertex( ccw(i1), v0) ;  // f1 = v0v2v4
-  nn = f1->neighbor( i1 );
-  tds().set_adjacency(f0, ccw(i0) , nn , nn->index(f1) );
-  nn = f3->neighbor( i3 );
-  tds().set_adjacency(f2, ccw(i2) , nn , nn->index(f3) );
-  nn = f5->neighbor( i5 );
-  tds().set_adjacency(f4, ccw(i4) , nn , nn->index(f5) );
-  tds().set_adjacency(f0, cw(i0) , f1 , i1  );
-  tds().set_adjacency(f4, cw(i4) , f1 , cw(i1) );
-
-  tds().delete_face(f3);
-  tds().delete_face(f5);
-
-
-  f0->set_offsets(0, 0, 0);
-  f1->set_offsets(0, 0, 0);
-  f2->set_offsets(0, 0, 0);
-  f4->set_offsets(0, 0, 0);
-}
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::remove_degree6_diamond
-(
-  Vertex_handle &v,
-  Face_handle &  f0, Face_handle &  f1, Face_handle &  f2,
-  Face_handle &  f3, Face_handle &  f4, Face_handle &  f5,
-  Vertex_handle &v0, Vertex_handle &v1, Vertex_handle &v2,
-  Vertex_handle &v3, Vertex_handle &v4, Vertex_handle &v5,
-  Offset &o0, Offset &o1, Offset &o2,
-  Offset &o3, Offset &o4, Offset &o5,
-  int i0, int i1, int i2, int i3, int i4, int i5 )
-{
-  // removing a degree 6 vertex, with chords v0v2 v2v4 v4v0
-  remove_degree6_diamond(v,
-                         f0, f1, f2, f3, f4, f5,
-                         v0, v1, v2, v3, v4, v5,
-                         i0, i1, i2, i3, i4, i5);
-
-  if (o0.x() < 0 || o1.x() < 0 || o2.x() < 0 || o3.x() < 0 || o4.x() < 0 || o5.x() < 0)
-    {
-      o0 += Offset(number_of_sheets()[0], 0);
-      o1 += Offset(number_of_sheets()[0], 0);
-      o2 += Offset(number_of_sheets()[0], 0);
-      o3 += Offset(number_of_sheets()[0], 0);
-      o4 += Offset(number_of_sheets()[0], 0);
-      o5 += Offset(number_of_sheets()[0], 0);
-    }
-  if (o0.y() < 0 || o1.y() < 0 || o2.y() < 0 || o3.y() < 0 || o4.y() < 0 || o5.y() < 0)
-    {
-      o0 += Offset(0, number_of_sheets()[1]);
-      o1 += Offset(0, number_of_sheets()[1]);
-      o2 += Offset(0, number_of_sheets()[1]);
-      o3 += Offset(0, number_of_sheets()[1]);
-      o4 += Offset(0, number_of_sheets()[1]);
-      o5 += Offset(0, number_of_sheets()[1]);
-    }
-  int oo0 = (o0.x() >= number_of_sheets()[0] ? 2 : 0) + (o0.y() >= number_of_sheets()[1] ? 1 : 0);
-  int oo1 = (o1.x() >= number_of_sheets()[0] ? 2 : 0) + (o1.y() >= number_of_sheets()[1] ? 1 : 0);
-  int oo2 = (o2.x() >= number_of_sheets()[0] ? 2 : 0) + (o2.y() >= number_of_sheets()[1] ? 1 : 0);
-  int oo3 = (o3.x() >= number_of_sheets()[0] ? 2 : 0) + (o3.y() >= number_of_sheets()[1] ? 1 : 0);
-  int oo4 = (o4.x() >= number_of_sheets()[0] ? 2 : 0) + (o4.y() >= number_of_sheets()[1] ? 1 : 0);
-  int oo5 = (o5.x() >= number_of_sheets()[0] ? 2 : 0) + (o5.y() >= number_of_sheets()[1] ? 1 : 0);
-
-  int oo[3];
-  oo[i0]      = oo2;
-  oo[ccw(i0)] = oo0;
-  oo[ cw(i0)] = oo1;
-  this->set_offsets(f0, oo[0], oo[1], oo[2]);
-  oo[i2]      = oo4;
-  oo[ccw(i2)] = oo2;
-  oo[ cw(i2)] = oo3;
-  this->set_offsets(f2, oo[0], oo[1], oo[2]);
-  oo[i4]      = oo0;
-  oo[ccw(i4)] = oo4;
-  oo[ cw(i4)] = oo5;
-  this->set_offsets(f4, oo[0], oo[1], oo[2]);
-  oo[i1]      = oo4;
-  oo[ccw(i1)] = oo0;
-  oo[ cw(i1)] = oo2;
-  this->set_offsets(f1, oo[0], oo[1], oo[2]);
-
-  insert_too_long_edge(f1, 0);
-  insert_too_long_edge(f1, 1);
-  insert_too_long_edge(f1, 2);
-}
-
-
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-remove_degree7(Vertex_handle v, std::vector<Face_handle> &f,
-               std::vector<Vertex_handle> &w,
-               std::vector<int> &i)
-{
-  // removing a degree 7 vertex
-
-  if (incircle(2, 0, 1, 3, f, w, i)) // sweeping from above
-    {
-      if (incircle(2, 3, 4, 0, f, w, i))
-        {
-          if (incircle(5, 3, 4, 6, f, w, i))
-            {
-              if (incircle(5, 3, 4, 2, f, w, i))
-                {
-                  if (incircle(6, 2, 3, 5, f, w, i))
-                    {
-                      if (incircle(6, 0, 1, 2, f, w, i))
-                        {
-                          remove_degree7_leftfan(v,  6  , f, w, i);
-                        }
-                      else
-                        {
-                          remove_degree7_zigzag(v,  6  , f, w, i);
-                        }
-                    }
-                  else
-                    {
-                      if (incircle(5, 0, 1, 2, f, w, i))
-                        {
-                          if (incircle(6, 1, 2, 5, f, w, i))
-                            {
-                              remove_degree7_zigzag(v, 2   , f, w, i);
-                            }
-                          else
-                            {
-                              if (incircle(6, 0, 1, 5, f, w, i))
-                                {
-                                  remove_degree7_rightfan(v, 5   , f, w, i);
-                                }
-                              else
-                                {
-                                  remove_degree7_star(v,  5  , f, w, i);
-                                }
-                            }
-                        }
-                      else
-                        {
-                          if (incircle(2, 5, 6, 0, f, w, i))
-                            {
-                              if (incircle(6, 0, 1, 2, f, w, i))
-                                {
-                                  remove_degree7_zigzag(v,  2  , f, w, i);
-                                }
-                              else
-                                {
-                                  remove_degree7_rightfan(v,  2  , f, w, i);
-                                }
-                            }
-                          else
-                            {
-                              remove_degree7_rightdelta(v,  5  , f, w, i);
-                            }
-                        }
-                    }
-                }
-              else
-                {
-                  if (incircle(4, 0, 1, 2, f, w, i))
-                    {
-                      if (incircle(5, 1, 2, 4, f, w, i))
-                        {
-                          if (incircle(6, 1, 2, 5, f, w, i))
-                            {
-                              remove_degree7_leftfan(v,  2  , f, w, i);
-                            }
-                          else
-                            {
-                              if (incircle(6, 0, 1, 5, f, w, i))
-                                {
-                                  remove_degree7_zigzag(v,  5  , f, w, i);
-                                }
-                              else
-                                {
-                                  remove_degree7_leftfan(v,  5  , f, w, i);
-                                }
-                            }
-                        }
-                      else
-                        {
-                          if (incircle(5, 0, 1, 4, f, w, i))
-                            {
-                              if (incircle(6, 0, 1, 5, f, w, i))
-                                {
-                                  remove_degree7_rightfan(v,  1  , f, w, i);
-                                }
-                              else
-                                {
-                                  remove_degree7_zigzag(v,  1  , f, w, i);
-                                }
-                            }
-                          else
-                            {
-                              remove_degree7_rightfan(v,  4  , f, w, i);
-                            }
-                        }
-                    }
-                  else
-                    {
-                      if (incircle(2, 4, 5, 0, f, w, i))
-                        {
-                          if (incircle(5, 0, 1, 2, f, w, i))
-                            {
-                              if (incircle(6, 1, 2, 5, f, w, i))
-                                {
-                                  remove_degree7_leftfan(v,  2  , f, w, i);
-                                }
-                              else
-                                {
-                                  if (incircle(6, 0, 1, 5, f, w, i))
-                                    {
-                                      remove_degree7_zigzag(v,  5  , f, w, i);
-                                    }
-                                  else
-                                    {
-                                      remove_degree7_leftfan(v,  5  , f, w, i);
-                                    }
-                                }
-                            }
-                          else
-                            {
-                              if (incircle(2, 5, 6, 0, f, w, i))
-                                {
-                                  if (incircle(6, 0, 1, 2, f, w, i))
-                                    {
-                                      remove_degree7_leftfan(v,  2  , f, w, i);
-                                    }
-                                  else
-                                    {
-                                      remove_degree7_star(v,  2  , f, w, i);
-                                    }
-                                }
-                              else
-                                {
-                                  remove_degree7_leftdelta(v,  2  , f, w, i);
-                                }
-                            }
-                        }
-                      else
-                        {
-                          remove_degree7_rightdelta(v,  0  , f, w, i);
-                        }
-                    }
-                }
-            }
-          else
-            {
-              if (incircle(6, 3, 4, 2, f, w, i))
-                {
-                  if (incircle(6, 0, 1, 2, f, w, i))
-                    {
-                      remove_degree7_star(v,  6  , f, w, i);
-                    }
-                  else
-                    {
-                      remove_degree7_rightfan(v,  6  , f, w, i);
-                    }
-                }
-              else
-                {
-                  if (incircle(4, 0, 1, 2, f, w, i))
-                    {
-                      if (incircle(2, 4, 5, 6, f, w, i))
-                        {
-                          if (incircle(5, 1, 2, 4, f, w, i))
-                            {
-                              if (incircle(6, 1, 2, 5, f, w, i))
-                                {
-                                  remove_degree7_leftfan(v,  2  , f, w, i);
-                                }
-                              else
-                                {
-                                  if (incircle(6, 0, 1, 5, f, w, i))
-                                    {
-                                      remove_degree7_zigzag(v,  5  , f, w, i);
-                                    }
-                                  else
-                                    {
-                                      remove_degree7_leftfan(v,  5  , f, w, i);
-                                    }
-                                }
-                            }
-                          else
-                            {
-                              if (incircle(5, 0, 1, 4, f, w, i))
-                                {
-                                  if (incircle(6, 0, 1, 5, f, w, i))
-                                    {
-                                      remove_degree7_rightfan(v,  1  , f, w, i);
-                                    }
-                                  else
-                                    {
-                                      remove_degree7_zigzag(v,  1  , f, w, i);
-                                    }
-                                }
-                              else
-                                {
-                                  remove_degree7_rightfan(v,  4  , f, w, i);
-                                }
-                            }
-                        }
-                      else
-                        {
-                          if (incircle(6, 1, 2, 4, f, w, i))
-                            {
-                              remove_degree7_leftdelta(v,  6  , f, w, i);
-                            }
-                          else
-                            {
-                              if (incircle(1, 4, 5, 6, f, w, i))
-                                {
-                                  if (incircle(1, 4, 5, 0, f, w, i))
-                                    {
-                                      if (incircle(6, 0, 1, 5, f, w, i))
-                                        {
-                                          remove_degree7_rightfan(v,  1  , f, w, i);
-                                        }
-                                      else
-                                        {
-                                          remove_degree7_zigzag(v,  1  , f, w, i);
-                                        }
-                                    }
-                                  else
-                                    {
-                                      remove_degree7_rightfan(v,  4  , f, w, i);
-                                    }
-                                }
-                              else
-                                {
-                                  if (incircle(6, 0, 1, 4, f, w, i))
-                                    {
-                                      remove_degree7_rightdelta(v,  4  , f, w, i);
-                                    }
-                                  else
-                                    {
-                                      if (incircle(6, 4, 5, 0, f, w, i))
-                                        {
-                                          remove_degree7_star(v,  4  , f, w, i);
-                                        }
-                                      else
-                                        {
-                                          remove_degree7_rightfan(v,  4  , f, w, i);
-                                        }
-                                    }
-                                }
-                            }
-                        }
-                    }
-                  else
-                    {
-                      if (incircle(2, 4, 5, 6, f, w, i))
-                        {
-                          if (incircle(2, 4, 5, 0, f, w, i))
-                            {
-                              if (incircle(5, 0, 1, 2, f, w, i))
-                                {
-                                  if (incircle(6, 1, 2, 5, f, w, i))
-                                    {
-                                      remove_degree7_leftfan(v,  2  , f, w, i);
-                                    }
-                                  else
-                                    {
-                                      if (incircle(6, 0, 1, 5, f, w, i))
-                                        {
-                                          remove_degree7_zigzag(v,  5  , f, w, i);
-                                        }
-                                      else
-                                        {
-                                          remove_degree7_leftfan(v,  5  , f, w, i);
-                                        }
-                                    }
-                                }
-                              else
-                                {
-                                  if (incircle(2, 5, 6, 0, f, w, i))
-                                    {
-                                      if (incircle(6, 0, 1, 2, f, w, i))
-                                        {
-                                          remove_degree7_leftfan(v,  2  , f, w, i);
-                                        }
-                                      else
-                                        {
-                                          remove_degree7_star(v,  2  , f, w, i);
-                                        }
-                                    }
-                                  else
-                                    {
-                                      remove_degree7_leftdelta(v,  2  , f, w, i);
-                                    }
-                                }
-                            }
-                          else
-                            {
-                              remove_degree7_rightdelta(v,  0  , f, w, i);
-                            }
-                        }
-                      else
-                        {
-                          if (incircle(2, 6, 0, 4, f, w, i))
-                            {
-                              if (incircle(6, 0, 1, 2, f, w, i))
-                                {
-                                  remove_degree7_leftdelta(v,  6  , f, w, i);
-                                }
-                              else
-                                {
-                                  remove_degree7_rightdelta(v,  2  , f, w, i);
-                                }
-                            }
-                          else
-                            {
-                              if (incircle(6, 4, 5, 0, f, w, i))
-                                {
-                                  remove_degree7_leftdelta(v,  4  , f, w, i);
-                                }
-                              else
-                                {
-                                  remove_degree7_rightdelta(v,  0  , f, w, i);
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-        }
-      else
-        {
-          if (incircle(5, 3, 4, 6, f, w, i))
-            {
-              if (incircle(5, 3, 4, 0, f, w, i))
-                {
-                  if (incircle(5, 2, 3, 0, f, w, i))
-                    {
-                      if (incircle(6, 2, 3, 5, f, w, i))
-                        {
-                          if (incircle(6, 0, 1, 2, f, w, i))
-                            {
-                              remove_degree7_leftfan(v,  6  , f, w, i);
-                            }
-                          else
-                            {
-                              remove_degree7_zigzag(v,  6  , f, w, i);
-                            }
-                        }
-                      else if (incircle(5, 0, 1, 2, f, w, i))
-                        {
-                          if (incircle(6, 1, 2, 5, f, w, i))
-                            {
-                              remove_degree7_zigzag(v,  2  , f, w, i);
-                            }
-                          else
-                            {
-                              if (incircle(6, 0, 1, 5, f, w, i))
-                                {
-                                  remove_degree7_rightfan(v,  5  , f, w, i);
-                                }
-                              else
-                                {
-                                  remove_degree7_star(v,  5  , f, w, i);
-                                }
-                            }
-                        }
-                      else
-                        {
-                          if (incircle(2, 5, 6, 0, f, w, i))
-                            {
-                              if (incircle(6, 0, 1, 2, f, w, i))
-                                {
-                                  remove_degree7_zigzag(v,  2  , f, w, i);
-                                }
-                              else
-                                {
-                                  remove_degree7_rightfan(v,  2  , f, w, i);
-                                }
-                            }
-                          else
-                            {
-                              remove_degree7_rightdelta(v,  5  , f, w, i);
-                            }
-                        }
-                    }
-                  else
-                    {
-                      if (incircle(3, 5, 6, 0, f, w, i))
-                        {
-                          if (incircle(6, 2, 3, 0, f, w, i))
-                            {
-                              if (incircle(6, 0, 1, 2, f, w, i))
-                                {
-                                  remove_degree7_leftfan(v,  6  , f, w, i);
-                                }
-                              else
-                                {
-                                  remove_degree7_zigzag(v,  6  , f, w, i);
-                                }
-                            }
-                          else
-                            {
-                              remove_degree7_leftfan(v,  3  , f, w, i);
-                            }
-                        }
-                      else
-                        {
-                          remove_degree7_leftdelta(v,  0  , f, w, i);
-                        }
-                    }
-                }
-              else
-                {
-                  remove_degree7_star(v,  0  , f, w, i);
-                }
-            }
-          else
-            {
-              if (incircle(6, 3, 4, 0, f, w, i))
-                {
-                  if (incircle(6, 2, 3, 0, f, w, i))
-                    {
-                      if (incircle(6, 0, 1, 2, f, w, i))
-                        {
-                          remove_degree7_star(v,  6  , f, w, i);
-                        }
-                      else
-                        {
-                          remove_degree7_rightfan(v,  6  , f, w, i);
-                        }
-                    }
-                  else
-                    {
-                      remove_degree7_zigzag(v,  3  , f, w, i);
-                    }
-                }
-              else
-                {
-                  if (incircle(6, 4, 5, 0, f, w, i))
-                    {
-                      remove_degree7_leftfan(v,  0  , f, w, i);
-                    }
-                  else
-                    {
-                      remove_degree7_star(v,  0  , f, w, i);
-                    }
-                }
-            }
-        }
-    }
-  else    //sweeping from below
-    {
-      if (incircle(1, 6, 0, 3, f, w, i))
-        {
-          if (incircle(5, 6, 0, 4, f, w, i))
-            {
-              if (incircle(5, 6, 0, 1, f, w, i))
-                {
-                  if (incircle(4, 0, 1, 5, f, w, i))
-                    {
-                      if (incircle(4, 2, 3, 1, f, w, i))
-                        {
-                          remove_degree7_rightfan(v,  4  , f, w, i);
-                        }
-                      else
-                        {
-                          remove_degree7_zigzag(v,  4  , f, w, i);
-                        }
-                    }
-                  else
-                    {
-                      if (incircle(5, 2, 3, 1, f, w, i))
-                        {
-                          if (incircle(4, 1, 2, 5, f, w, i))
-                            {
-                              remove_degree7_zigzag(v, 1   , f, w, i);
-                            }
-                          else
-                            {
-                              if (incircle(4, 2, 3, 5, f, w, i))
-                                {
-                                  remove_degree7_leftfan(v, 5   , f, w, i);
-                                }
-                              else
-                                {
-                                  remove_degree7_star(v,  5  , f, w, i);
-                                }
-                            }
-                        }
-                      else
-                        {
-                          if (incircle(1, 4, 5, 3, f, w, i))
-                            {
-                              if (incircle(4, 2, 3, 1, f, w, i))
-                                {
-                                  remove_degree7_zigzag(v,  1  , f, w, i);
-                                }
-                              else
-                                {
-                                  remove_degree7_leftfan(v,  1  , f, w, i);
-                                }
-                            }
-                          else
-                            {
-                              remove_degree7_leftdelta(v,  5  , f, w, i);
-                            }
-                        }
-                    }
-                }
-              else
-                {
-                  if (incircle(6, 2, 3, 1, f, w, i))
-                    {
-                      if (incircle(5, 1, 2, 6, f, w, i))
-                        {
-                          if (incircle(4, 1, 2, 5, f, w, i))
-                            {
-                              remove_degree7_rightfan(v,  1  , f, w, i);
-                            }
-                          else
-                            {
-                              if (incircle(4, 2, 3, 5, f, w, i))
-                                {
-                                  remove_degree7_zigzag(v,  5  , f, w, i);
-                                }
-                              else
-                                {
-                                  remove_degree7_rightfan(v,  5  , f, w, i);
-                                }
-                            }
-                        }
-                      else
-                        {
-                          if (incircle(5, 2, 3, 6, f, w, i))
-                            {
-                              if (incircle(4, 2, 3, 5, f, w, i))
-                                {
-                                  remove_degree7_leftfan(v,  2  , f, w, i);
-                                }
-                              else
-                                {
-                                  remove_degree7_zigzag(v,  2  , f, w, i);
-                                }
-                            }
-                          else
-                            {
-                              remove_degree7_leftfan(v,  6  , f, w, i);
-                            }
-                        }
-                    }
-                  else
-                    {
-                      if (incircle(1, 5, 6, 3, f, w, i))
-                        {
-                          if (incircle(5, 2, 3, 1, f, w, i))
-                            {
-                              if (incircle(4, 1, 2, 5, f, w, i))
-                                {
-                                  remove_degree7_rightfan(v,  1  , f, w, i);
-                                }
-                              else
-                                {
-                                  if (incircle(4, 2, 3, 5, f, w, i))
-                                    {
-                                      remove_degree7_zigzag(v,  5  , f, w, i);
-                                    }
-                                  else
-                                    {
-                                      remove_degree7_rightfan(v,  5  , f, w, i);
-                                    }
-                                }
-                            }
-                          else
-                            {
-                              if (incircle(1, 4, 5, 3, f, w, i))
-                                {
-                                  if (incircle(4, 2, 3, 1, f, w, i))
-                                    {
-                                      remove_degree7_rightfan(v,  1  , f, w, i);
-                                    }
-                                  else
-                                    {
-                                      remove_degree7_star(v,  1  , f, w, i);
-                                    }
-                                }
-                              else
-                                {
-                                  remove_degree7_rightdelta(v,  1  , f, w, i);
-                                }
-                            }
-                        }
-                      else
-                        {
-                          remove_degree7_leftdelta(v,  3  , f, w, i);
-                        }
-                    }
-                }
-            }
-          else
-            {
-              if (incircle(4, 6, 0, 1, f, w, i))
-                {
-                  if (incircle(4, 2, 3, 1, f, w, i))
-                    {
-                      remove_degree7_star(v,  4  , f, w, i);
-                    }
-                  else
-                    {
-                      remove_degree7_leftfan(v,  4  , f, w, i);
-                    }
-                }
-              else
-                {
-                  if (incircle(6, 2, 3, 1, f, w, i))
-                    {
-                      if (incircle(1, 5, 6, 4, f, w, i))
-                        {
-                          if (incircle(5, 1, 2, 6, f, w, i))
-                            {
-                              if (incircle(4, 1, 2, 5, f, w, i))
-                                {
-                                  remove_degree7_rightfan(v,  1  , f, w, i);
-                                }
-                              else
-                                {
-                                  if (incircle(4, 2, 3, 5, f, w, i))
-                                    {
-                                      remove_degree7_zigzag(v,  5  , f, w, i);
-                                    }
-                                  else
-                                    {
-                                      remove_degree7_rightfan(v,  5  , f, w, i);
-                                    }
-                                }
-                            }
-                          else
-                            {
-                              if (incircle(5, 2, 3, 6, f, w, i))
-                                {
-                                  if (incircle(4, 2, 3, 5, f, w, i))
-                                    {
-                                      remove_degree7_leftfan(v,  2  , f, w, i);
-                                    }
-                                  else
-                                    {
-                                      remove_degree7_zigzag(v,  2  , f, w, i);
-                                    }
-                                }
-                              else
-                                {
-                                  remove_degree7_leftfan(v,  6  , f, w, i);
-                                }
-                            }
-                        }
-                      else
-                        {
-                          if (incircle(4, 1, 2, 6, f, w, i))
-                            {
-                              remove_degree7_rightdelta(v,  4  , f, w, i);
-                            }
-                          else
-                            {
-                              if (incircle(2, 5, 6, 4, f, w, i))
-                                {
-                                  if (incircle(2, 5, 6, 3, f, w, i))
-                                    {
-                                      if (incircle(4, 2, 3, 5, f, w, i))
-                                        {
-                                          remove_degree7_leftfan(v,  2  , f, w, i);
-                                        }
-                                      else
-                                        {
-                                          remove_degree7_zigzag(v,  2  , f, w, i);
-                                        }
-                                    }
-                                  else
-                                    {
-                                      remove_degree7_leftfan(v,  6  , f, w, i);
-                                    }
-                                }
-                              else
-                                {
-                                  if (incircle(4, 2, 3, 6, f, w, i))
-                                    {
-                                      remove_degree7_leftdelta(v,  6  , f, w, i);
-                                    }
-                                  else
-                                    {
-                                      if (incircle(4, 5, 6, 3, f, w, i))
-                                        {
-                                          remove_degree7_star(v,  6  , f, w, i);
-                                        }
-                                      else
-                                        {
-                                          remove_degree7_leftfan(v,  6  , f, w, i);
-                                        }
-                                    }
-                                }
-                            }
-                        }
-                    }
-                  else
-                    {
-                      if (incircle(1, 5, 6, 4, f, w, i))
-                        {
-                          if (incircle(1, 5, 6, 3, f, w, i))
-                            {
-                              if (incircle(5, 2, 3, 1, f, w, i))
-                                {
-                                  if (incircle(4, 1, 2, 5, f, w, i))
-                                    {
-                                      remove_degree7_rightfan(v,  1  , f, w, i);
-                                    }
-                                  else
-                                    {
-                                      if (incircle(4, 2, 3, 5, f, w, i))
-                                        {
-                                          remove_degree7_zigzag(v,  5  , f, w, i);
-                                        }
-                                      else
-                                        {
-                                          remove_degree7_rightfan(v,  5  , f, w, i);
-                                        }
-                                    }
-                                }
-                              else
-                                {
-                                  if (incircle(1, 4, 5, 3, f, w, i))
-                                    {
-                                      if (incircle(4, 2, 3, 1, f, w, i))
-                                        {
-                                          remove_degree7_rightfan(v,  1  , f, w, i);
-                                        }
-                                      else
-                                        {
-                                          remove_degree7_star(v,  1  , f, w, i);
-                                        }
-                                    }
-                                  else
-                                    {
-                                      remove_degree7_rightdelta(v,  1  , f, w, i);
-                                    }
-                                }
-                            }
-                          else
-                            {
-                              remove_degree7_leftdelta(v,  3  , f, w, i);
-                            }
-                        }
-                      else
-                        {
-                          if (incircle(1, 3, 4, 6, f, w, i))
-                            {
-                              if (incircle(4, 2, 3, 1, f, w, i))
-                                {
-                                  remove_degree7_rightdelta(v,  4  , f, w, i);
-                                }
-                              else
-                                {
-                                  remove_degree7_leftdelta(v,  1  , f, w, i);
-                                }
-                            }
-                          else
-                            {
-                              if (incircle(4, 5, 6, 3, f, w, i))
-                                {
-                                  remove_degree7_rightdelta(v,  6  , f, w, i);
-                                }
-                              else
-                                {
-                                  remove_degree7_leftdelta(v,  3  , f, w, i);
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-        }
-      else
-        {
-          if (incircle(5, 6, 0, 4, f, w, i))
-            {
-              if (incircle(5, 6, 0, 3, f, w, i))
-                {
-                  if (incircle(5, 0, 1, 3, f, w, i))
-                    {
-                      if (incircle(4, 0, 1, 5, f, w, i))
-                        {
-                          if (incircle(4, 2, 3, 1, f, w, i))
-                            {
-                              remove_degree7_rightfan(v,  4  , f, w, i);
-                            }
-                          else
-                            {
-                              remove_degree7_zigzag(v,  4  , f, w, i);
-                            }
-                        }
-                      else if (incircle(5, 2, 3, 1, f, w, i))
-                        {
-                          if (incircle(4, 1, 2, 5, f, w, i))
-                            {
-                              remove_degree7_zigzag(v,  1  , f, w, i);
-                            }
-                          else
-                            {
-                              if (incircle(4, 2, 3, 5, f, w, i))
-                                {
-                                  remove_degree7_leftfan(v,  5  , f, w, i);
-                                }
-                              else
-                                {
-                                  remove_degree7_star(v,  5  , f, w, i);
-                                }
-                            }
-                        }
-                      else
-                        {
-                          if (incircle(1, 4, 5, 3, f, w, i))
-                            {
-                              if (incircle(4, 2, 3, 1, f, w, i))
-                                {
-                                  remove_degree7_zigzag(v,  1  , f, w, i);
-                                }
-                              else
-                                {
-                                  remove_degree7_leftfan(v,  1  , f, w, i);
-                                }
-                            }
-                          else
-                            {
-                              remove_degree7_leftdelta(v,  5  , f, w, i);
-                            }
-                        }
-                    }
-                  else
-                    {
-                      if (! incircle(3, 4, 5, 0, f, w, i))
-                        {
-                          if (incircle(4, 0, 1, 3, f, w, i))
-                            {
-                              if (incircle(4, 2, 3, 1, f, w, i))
-                                {
-                                  remove_degree7_rightfan(v,  4  , f, w, i);
-                                }
-                              else
-                                {
-                                  remove_degree7_zigzag(v,  4  , f, w, i);
-                                }
-                            }
-                          else
-                            {
-                              remove_degree7_rightfan(v,  0  , f, w, i);
-                            }
-                        }
-                      else
-                        {
-                          remove_degree7_rightdelta(v,  3  , f, w, i);
-                        }
-                    }
-                }
-              else
-                {
-                  remove_degree7_star(v,  3  , f, w, i);
-                }
-            }
-          else
-            {
-              if (incircle(4, 6, 0, 3, f, w, i))
-                {
-                  if (incircle(4, 0, 1, 3, f, w, i))
-                    {
-                      if (incircle(4, 2, 3, 1, f, w, i))
-                        {
-                          remove_degree7_star(v,  4  , f, w, i);
-                        }
-                      else
-                        {
-                          remove_degree7_leftfan(v,  4  , f, w, i);
-                        }
-                    }
-                  else
-                    {
-                      remove_degree7_zigzag(v,  0  , f, w, i);
-                    }
-                }
-              else
-                {
-                  if (incircle(4, 5, 6, 3, f, w, i))
-                    {
-                      remove_degree7_rightfan(v,  3  , f, w, i);
-                    }
-                  else
-                    {
-                      remove_degree7_star(v,  3  , f, w, i);
-                    }
-                }
-            }
-        }
-    }
-}
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-remove_degree7(Vertex_handle v, std::vector<Face_handle> &f,
-               std::vector<Vertex_handle> &w, std::vector<Offset> &o,
-               std::vector<int> &i)
-{
-  // removing a degree 7 vertex
-
-  if (incircle(2, 0, 1, 3, f, w, o, i)) // sweeping from above
-    {
-      if (incircle(2, 3, 4, 0, f, w, o, i))
-        {
-          if (incircle(5, 3, 4, 6, f, w, o, i))
-            {
-              if (incircle(5, 3, 4, 2, f, w, o, i))
-                {
-                  if (incircle(6, 2, 3, 5, f, w, o, i))
-                    {
-                      if (incircle(6, 0, 1, 2, f, w, o, i))
-                        {
-                          remove_degree7_leftfan(v,  6  , f, w, o, i);
-                        }
-                      else
-                        {
-                          remove_degree7_zigzag(v,  6  , f, w, o, i);
-                        }
-                    }
-                  else
-                    {
-                      if (incircle(5, 0, 1, 2, f, w, o, i))
-                        {
-                          if (incircle(6, 1, 2, 5, f, w, o, i))
-                            {
-                              remove_degree7_zigzag(v, 2   , f, w, o, i);
-                            }
-                          else
-                            {
-                              if (incircle(6, 0, 1, 5, f, w, o, i))
-                                {
-                                  remove_degree7_rightfan(v, 5   , f, w, o, i);
-                                }
-                              else
-                                {
-                                  remove_degree7_star(v,  5  , f, w, o, i);
-                                }
-                            }
-                        }
-                      else
-                        {
-                          if (incircle(2, 5, 6, 0, f, w, o, i))
-                            {
-                              if (incircle(6, 0, 1, 2, f, w, o, i))
-                                {
-                                  remove_degree7_zigzag(v,  2  , f, w, o, i);
-                                }
-                              else
-                                {
-                                  remove_degree7_rightfan(v,  2  , f, w, o, i);
-                                }
-                            }
-                          else
-                            {
-                              remove_degree7_rightdelta(v,  5  , f, w, o, i);
-                            }
-                        }
-                    }
-                }
-              else
-                {
-                  if (incircle(4, 0, 1, 2, f, w, o, i))
-                    {
-                      if (incircle(5, 1, 2, 4, f, w, o, i))
-                        {
-                          if (incircle(6, 1, 2, 5, f, w, o, i))
-                            {
-                              remove_degree7_leftfan(v,  2  , f, w, o, i);
-                            }
-                          else
-                            {
-                              if (incircle(6, 0, 1, 5, f, w, o, i))
-                                {
-                                  remove_degree7_zigzag(v,  5  , f, w, o, i);
-                                }
-                              else
-                                {
-                                  remove_degree7_leftfan(v,  5  , f, w, o, i);
-                                }
-                            }
-                        }
-                      else
-                        {
-                          if (incircle(5, 0, 1, 4, f, w, o, i))
-                            {
-                              if (incircle(6, 0, 1, 5, f, w, o, i))
-                                {
-                                  remove_degree7_rightfan(v,  1  , f, w, o, i);
-                                }
-                              else
-                                {
-                                  remove_degree7_zigzag(v,  1  , f, w, o, i);
-                                }
-                            }
-                          else
-                            {
-                              remove_degree7_rightfan(v,  4  , f, w, o, i);
-                            }
-                        }
-                    }
-                  else
-                    {
-                      if (incircle(2, 4, 5, 0, f, w, o, i))
-                        {
-                          if (incircle(5, 0, 1, 2, f, w, o, i))
-                            {
-                              if (incircle(6, 1, 2, 5, f, w, o, i))
-                                {
-                                  remove_degree7_leftfan(v,  2  , f, w, o, i);
-                                }
-                              else
-                                {
-                                  if (incircle(6, 0, 1, 5, f, w, o, i))
-                                    {
-                                      remove_degree7_zigzag(v,  5  , f, w, o, i);
-                                    }
-                                  else
-                                    {
-                                      remove_degree7_leftfan(v,  5  , f, w, o, i);
-                                    }
-                                }
-                            }
-                          else
-                            {
-                              if (incircle(2, 5, 6, 0, f, w, o, i))
-                                {
-                                  if (incircle(6, 0, 1, 2, f, w, o, i))
-                                    {
-                                      remove_degree7_leftfan(v,  2  , f, w, o, i);
-                                    }
-                                  else
-                                    {
-                                      remove_degree7_star(v,  2  , f, w, o, i);
-                                    }
-                                }
-                              else
-                                {
-                                  remove_degree7_leftdelta(v,  2  , f, w, o, i);
-                                }
-                            }
-                        }
-                      else
-                        {
-                          remove_degree7_rightdelta(v,  0  , f, w, o, i);
-                        }
-                    }
-                }
-            }
-          else
-            {
-              if (incircle(6, 3, 4, 2, f, w, o, i))
-                {
-                  if (incircle(6, 0, 1, 2, f, w, o, i))
-                    {
-                      remove_degree7_star(v,  6  , f, w, o, i);
-                    }
-                  else
-                    {
-                      remove_degree7_rightfan(v,  6  , f, w, o, i);
-                    }
-                }
-              else
-                {
-                  if (incircle(4, 0, 1, 2, f, w, o, i))
-                    {
-                      if (incircle(2, 4, 5, 6, f, w, o, i))
-                        {
-                          if (incircle(5, 1, 2, 4, f, w, o, i))
-                            {
-                              if (incircle(6, 1, 2, 5, f, w, o, i))
-                                {
-                                  remove_degree7_leftfan(v,  2  , f, w, o, i);
-                                }
-                              else
-                                {
-                                  if (incircle(6, 0, 1, 5, f, w, o, i))
-                                    {
-                                      remove_degree7_zigzag(v,  5  , f, w, o, i);
-                                    }
-                                  else
-                                    {
-                                      remove_degree7_leftfan(v,  5  , f, w, o, i);
-                                    }
-                                }
-                            }
-                          else
-                            {
-                              if (incircle(5, 0, 1, 4, f, w, o, i))
-                                {
-                                  if (incircle(6, 0, 1, 5, f, w, o, i))
-                                    {
-                                      remove_degree7_rightfan(v,  1  , f, w, o, i);
-                                    }
-                                  else
-                                    {
-                                      remove_degree7_zigzag(v,  1  , f, w, o, i);
-                                    }
-                                }
-                              else
-                                {
-                                  remove_degree7_rightfan(v,  4  , f, w, o, i);
-                                }
-                            }
-                        }
-                      else
-                        {
-                          if (incircle(6, 1, 2, 4, f, w, o, i))
-                            {
-                              remove_degree7_leftdelta(v,  6  , f, w, o, i);
-                            }
-                          else
-                            {
-                              if (incircle(1, 4, 5, 6, f, w, o, i))
-                                {
-                                  if (incircle(1, 4, 5, 0, f, w, o, i))
-                                    {
-                                      if (incircle(6, 0, 1, 5, f, w, o, i))
-                                        {
-                                          remove_degree7_rightfan(v,  1  , f, w, o, i);
-                                        }
-                                      else
-                                        {
-                                          remove_degree7_zigzag(v,  1  , f, w, o, i);
-                                        }
-                                    }
-                                  else
-                                    {
-                                      remove_degree7_rightfan(v,  4  , f, w, o, i);
-                                    }
-                                }
-                              else
-                                {
-                                  if (incircle(6, 0, 1, 4, f, w, o, i))
-                                    {
-                                      remove_degree7_rightdelta(v,  4  , f, w, o, i);
-                                    }
-                                  else
-                                    {
-                                      if (incircle(6, 4, 5, 0, f, w, o, i))
-                                        {
-                                          remove_degree7_star(v,  4  , f, w, o, i);
-                                        }
-                                      else
-                                        {
-                                          remove_degree7_rightfan(v,  4  , f, w, o, i);
-                                        }
-                                    }
-                                }
-                            }
-                        }
-                    }
-                  else
-                    {
-                      if (incircle(2, 4, 5, 6, f, w, o, i))
-                        {
-                          if (incircle(2, 4, 5, 0, f, w, o, i))
-                            {
-                              if (incircle(5, 0, 1, 2, f, w, o, i))
-                                {
-                                  if (incircle(6, 1, 2, 5, f, w, o, i))
-                                    {
-                                      remove_degree7_leftfan(v,  2  , f, w, o, i);
-                                    }
-                                  else
-                                    {
-                                      if (incircle(6, 0, 1, 5, f, w, o, i))
-                                        {
-                                          remove_degree7_zigzag(v,  5  , f, w, o, i);
-                                        }
-                                      else
-                                        {
-                                          remove_degree7_leftfan(v,  5  , f, w, o, i);
-                                        }
-                                    }
-                                }
-                              else
-                                {
-                                  if (incircle(2, 5, 6, 0, f, w, o, i))
-                                    {
-                                      if (incircle(6, 0, 1, 2, f, w, o, i))
-                                        {
-                                          remove_degree7_leftfan(v,  2  , f, w, o, i);
-                                        }
-                                      else
-                                        {
-                                          remove_degree7_star(v,  2  , f, w, o, i);
-                                        }
-                                    }
-                                  else
-                                    {
-                                      remove_degree7_leftdelta(v,  2  , f, w, o, i);
-                                    }
-                                }
-                            }
-                          else
-                            {
-                              remove_degree7_rightdelta(v,  0  , f, w, o, i);
-                            }
-                        }
-                      else
-                        {
-                          if (incircle(2, 6, 0, 4, f, w, o, i))
-                            {
-                              if (incircle(6, 0, 1, 2, f, w, o, i))
-                                {
-                                  remove_degree7_leftdelta(v,  6  , f, w, o, i);
-                                }
-                              else
-                                {
-                                  remove_degree7_rightdelta(v,  2  , f, w, o, i);
-                                }
-                            }
-                          else
-                            {
-                              if (incircle(6, 4, 5, 0, f, w, o, i))
-                                {
-                                  remove_degree7_leftdelta(v,  4  , f, w, o, i);
-                                }
-                              else
-                                {
-                                  remove_degree7_rightdelta(v,  0  , f, w, o, i);
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-        }
-      else
-        {
-          if (incircle(5, 3, 4, 6, f, w, o, i))
-            {
-              if (incircle(5, 3, 4, 0, f, w, o, i))
-                {
-                  if (incircle(5, 2, 3, 0, f, w, o, i))
-                    {
-                      if (incircle(6, 2, 3, 5, f, w, o, i))
-                        {
-                          if (incircle(6, 0, 1, 2, f, w, o, i))
-                            {
-                              remove_degree7_leftfan(v,  6  , f, w, o, i);
-                            }
-                          else
-                            {
-                              remove_degree7_zigzag(v,  6  , f, w, o, i);
-                            }
-                        }
-                      else if (incircle(5, 0, 1, 2, f, w, o, i))
-                        {
-                          if (incircle(6, 1, 2, 5, f, w, o, i))
-                            {
-                              remove_degree7_zigzag(v,  2  , f, w, o, i);
-                            }
-                          else
-                            {
-                              if (incircle(6, 0, 1, 5, f, w, o, i))
-                                {
-                                  remove_degree7_rightfan(v,  5  , f, w, o, i);
-                                }
-                              else
-                                {
-                                  remove_degree7_star(v,  5  , f, w, o, i);
-                                }
-                            }
-                        }
-                      else
-                        {
-                          if (incircle(2, 5, 6, 0, f, w, o, i))
-                            {
-                              if (incircle(6, 0, 1, 2, f, w, o, i))
-                                {
-                                  remove_degree7_zigzag(v,  2  , f, w, o, i);
-                                }
-                              else
-                                {
-                                  remove_degree7_rightfan(v,  2  , f, w, o, i);
-                                }
-                            }
-                          else
-                            {
-                              remove_degree7_rightdelta(v,  5  , f, w, o, i);
-                            }
-                        }
-                    }
-                  else
-                    {
-                      if (incircle(3, 5, 6, 0, f, w, o, i))
-                        {
-                          if (incircle(6, 2, 3, 0, f, w, o, i))
-                            {
-                              if (incircle(6, 0, 1, 2, f, w, o, i))
-                                {
-                                  remove_degree7_leftfan(v,  6  , f, w, o, i);
-                                }
-                              else
-                                {
-                                  remove_degree7_zigzag(v,  6  , f, w, o, i);
-                                }
-                            }
-                          else
-                            {
-                              remove_degree7_leftfan(v,  3  , f, w, o, i);
-                            }
-                        }
-                      else
-                        {
-                          remove_degree7_leftdelta(v,  0  , f, w, o, i);
-                        }
-                    }
-                }
-              else
-                {
-                  remove_degree7_star(v,  0  , f, w, o, i);
-                }
-            }
-          else
-            {
-              if (incircle(6, 3, 4, 0, f, w, o, i))
-                {
-                  if (incircle(6, 2, 3, 0, f, w, o, i))
-                    {
-                      if (incircle(6, 0, 1, 2, f, w, o, i))
-                        {
-                          remove_degree7_star(v,  6  , f, w, o, i);
-                        }
-                      else
-                        {
-                          remove_degree7_rightfan(v,  6  , f, w, o, i);
-                        }
-                    }
-                  else
-                    {
-                      remove_degree7_zigzag(v,  3  , f, w, o, i);
-                    }
-                }
-              else
-                {
-                  if (incircle(6, 4, 5, 0, f, w, o, i))
-                    {
-                      remove_degree7_leftfan(v,  0  , f, w, o, i);
-                    }
-                  else
-                    {
-                      remove_degree7_star(v,  0  , f, w, o, i);
-                    }
-                }
-            }
-        }
-    }
-  else    //sweeping from below
-    {
-      if (incircle(1, 6, 0, 3, f, w, o, i))
-        {
-          if (incircle(5, 6, 0, 4, f, w, o, i))
-            {
-              if (incircle(5, 6, 0, 1, f, w, o, i))
-                {
-                  if (incircle(4, 0, 1, 5, f, w, o, i))
-                    {
-                      if (incircle(4, 2, 3, 1, f, w, o, i))
-                        {
-                          remove_degree7_rightfan(v,  4  , f, w, o, i);
-                        }
-                      else
-                        {
-                          remove_degree7_zigzag(v,  4  , f, w, o, i);
-                        }
-                    }
-                  else
-                    {
-                      if (incircle(5, 2, 3, 1, f, w, o, i))
-                        {
-                          if (incircle(4, 1, 2, 5, f, w, o, i))
-                            {
-                              remove_degree7_zigzag(v, 1   , f, w, o, i);
-                            }
-                          else
-                            {
-                              if (incircle(4, 2, 3, 5, f, w, o, i))
-                                {
-                                  remove_degree7_leftfan(v, 5   , f, w, o, i);
-                                }
-                              else
-                                {
-                                  remove_degree7_star(v,  5  , f, w, o, i);
-                                }
-                            }
-                        }
-                      else
-                        {
-                          if (incircle(1, 4, 5, 3, f, w, o, i))
-                            {
-                              if (incircle(4, 2, 3, 1, f, w, o, i))
-                                {
-                                  remove_degree7_zigzag(v,  1  , f, w, o, i);
-                                }
-                              else
-                                {
-                                  remove_degree7_leftfan(v,  1  , f, w, o, i);
-                                }
-                            }
-                          else
-                            {
-                              remove_degree7_leftdelta(v,  5  , f, w, o, i);
-                            }
-                        }
-                    }
-                }
-              else
-                {
-                  if (incircle(6, 2, 3, 1, f, w, o, i))
-                    {
-                      if (incircle(5, 1, 2, 6, f, w, o, i))
-                        {
-                          if (incircle(4, 1, 2, 5, f, w, o, i))
-                            {
-                              remove_degree7_rightfan(v,  1  , f, w, o, i);
-                            }
-                          else
-                            {
-                              if (incircle(4, 2, 3, 5, f, w, o, i))
-                                {
-                                  remove_degree7_zigzag(v,  5  , f, w, o, i);
-                                }
-                              else
-                                {
-                                  remove_degree7_rightfan(v,  5  , f, w, o, i);
-                                }
-                            }
-                        }
-                      else
-                        {
-                          if (incircle(5, 2, 3, 6, f, w, o, i))
-                            {
-                              if (incircle(4, 2, 3, 5, f, w, o, i))
-                                {
-                                  remove_degree7_leftfan(v,  2  , f, w, o, i);
-                                }
-                              else
-                                {
-                                  remove_degree7_zigzag(v,  2  , f, w, o, i);
-                                }
-                            }
-                          else
-                            {
-                              remove_degree7_leftfan(v,  6  , f, w, o, i);
-                            }
-                        }
-                    }
-                  else
-                    {
-                      if (incircle(1, 5, 6, 3, f, w, o, i))
-                        {
-                          if (incircle(5, 2, 3, 1, f, w, o, i))
-                            {
-                              if (incircle(4, 1, 2, 5, f, w, o, i))
-                                {
-                                  remove_degree7_rightfan(v,  1  , f, w, o, i);
-                                }
-                              else
-                                {
-                                  if (incircle(4, 2, 3, 5, f, w, o, i))
-                                    {
-                                      remove_degree7_zigzag(v,  5  , f, w, o, i);
-                                    }
-                                  else
-                                    {
-                                      remove_degree7_rightfan(v,  5  , f, w, o, i);
-                                    }
-                                }
-                            }
-                          else
-                            {
-                              if (incircle(1, 4, 5, 3, f, w, o, i))
-                                {
-                                  if (incircle(4, 2, 3, 1, f, w, o, i))
-                                    {
-                                      remove_degree7_rightfan(v,  1  , f, w, o, i);
-                                    }
-                                  else
-                                    {
-                                      remove_degree7_star(v,  1  , f, w, o, i);
-                                    }
-                                }
-                              else
-                                {
-                                  remove_degree7_rightdelta(v,  1  , f, w, o, i);
-                                }
-                            }
-                        }
-                      else
-                        {
-                          remove_degree7_leftdelta(v,  3  , f, w, o, i);
-                        }
-                    }
-                }
-            }
-          else
-            {
-              if (incircle(4, 6, 0, 1, f, w, o, i))
-                {
-                  if (incircle(4, 2, 3, 1, f, w, o, i))
-                    {
-                      remove_degree7_star(v,  4  , f, w, o, i);
-                    }
-                  else
-                    {
-                      remove_degree7_leftfan(v,  4  , f, w, o, i);
-                    }
-                }
-              else
-                {
-                  if (incircle(6, 2, 3, 1, f, w, o, i))
-                    {
-                      if (incircle(1, 5, 6, 4, f, w, o, i))
-                        {
-                          if (incircle(5, 1, 2, 6, f, w, o, i))
-                            {
-                              if (incircle(4, 1, 2, 5, f, w, o, i))
-                                {
-                                  remove_degree7_rightfan(v,  1  , f, w, o, i);
-                                }
-                              else
-                                {
-                                  if (incircle(4, 2, 3, 5, f, w, o, i))
-                                    {
-                                      remove_degree7_zigzag(v,  5  , f, w, o, i);
-                                    }
-                                  else
-                                    {
-                                      remove_degree7_rightfan(v,  5  , f, w, o, i);
-                                    }
-                                }
-                            }
-                          else
-                            {
-                              if (incircle(5, 2, 3, 6, f, w, o, i))
-                                {
-                                  if (incircle(4, 2, 3, 5, f, w, o, i))
-                                    {
-                                      remove_degree7_leftfan(v,  2  , f, w, o, i);
-                                    }
-                                  else
-                                    {
-                                      remove_degree7_zigzag(v,  2  , f, w, o, i);
-                                    }
-                                }
-                              else
-                                {
-                                  remove_degree7_leftfan(v,  6  , f, w, o, i);
-                                }
-                            }
-                        }
-                      else
-                        {
-                          if (incircle(4, 1, 2, 6, f, w, o, i))
-                            {
-                              remove_degree7_rightdelta(v,  4  , f, w, o, i);
-                            }
-                          else
-                            {
-                              if (incircle(2, 5, 6, 4, f, w, o, i))
-                                {
-                                  if (incircle(2, 5, 6, 3, f, w, o, i))
-                                    {
-                                      if (incircle(4, 2, 3, 5, f, w, o, i))
-                                        {
-                                          remove_degree7_leftfan(v,  2  , f, w, o, i);
-                                        }
-                                      else
-                                        {
-                                          remove_degree7_zigzag(v,  2  , f, w, o, i);
-                                        }
-                                    }
-                                  else
-                                    {
-                                      remove_degree7_leftfan(v,  6  , f, w, o, i);
-                                    }
-                                }
-                              else
-                                {
-                                  if (incircle(4, 2, 3, 6, f, w, o, i))
-                                    {
-                                      remove_degree7_leftdelta(v,  6  , f, w, o, i);
-                                    }
-                                  else
-                                    {
-                                      if (incircle(4, 5, 6, 3, f, w, o, i))
-                                        {
-                                          remove_degree7_star(v,  6  , f, w, o, i);
-                                        }
-                                      else
-                                        {
-                                          remove_degree7_leftfan(v,  6  , f, w, o, i);
-                                        }
-                                    }
-                                }
-                            }
-                        }
-                    }
-                  else
-                    {
-                      if (incircle(1, 5, 6, 4, f, w, o, i))
-                        {
-                          if (incircle(1, 5, 6, 3, f, w, o, i))
-                            {
-                              if (incircle(5, 2, 3, 1, f, w, o, i))
-                                {
-                                  if (incircle(4, 1, 2, 5, f, w, o, i))
-                                    {
-                                      remove_degree7_rightfan(v,  1  , f, w, o, i);
-                                    }
-                                  else
-                                    {
-                                      if (incircle(4, 2, 3, 5, f, w, o, i))
-                                        {
-                                          remove_degree7_zigzag(v,  5  , f, w, o, i);
-                                        }
-                                      else
-                                        {
-                                          remove_degree7_rightfan(v,  5  , f, w, o, i);
-                                        }
-                                    }
-                                }
-                              else
-                                {
-                                  if (incircle(1, 4, 5, 3, f, w, o, i))
-                                    {
-                                      if (incircle(4, 2, 3, 1, f, w, o, i))
-                                        {
-                                          remove_degree7_rightfan(v,  1  , f, w, o, i);
-                                        }
-                                      else
-                                        {
-                                          remove_degree7_star(v,  1  , f, w, o, i);
-                                        }
-                                    }
-                                  else
-                                    {
-                                      remove_degree7_rightdelta(v,  1  , f, w, o, i);
-                                    }
-                                }
-                            }
-                          else
-                            {
-                              remove_degree7_leftdelta(v,  3  , f, w, o, i);
-                            }
-                        }
-                      else
-                        {
-                          if (incircle(1, 3, 4, 6, f, w, o, i))
-                            {
-                              if (incircle(4, 2, 3, 1, f, w, o, i))
-                                {
-                                  remove_degree7_rightdelta(v,  4  , f, w, o, i);
-                                }
-                              else
-                                {
-                                  remove_degree7_leftdelta(v,  1  , f, w, o, i);
-                                }
-                            }
-                          else
-                            {
-                              if (incircle(4, 5, 6, 3, f, w, o, i))
-                                {
-                                  remove_degree7_rightdelta(v,  6  , f, w, o, i);
-                                }
-                              else
-                                {
-                                  remove_degree7_leftdelta(v,  3  , f, w, o, i);
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-        }
-      else
-        {
-          if (incircle(5, 6, 0, 4, f, w, o, i))
-            {
-              if (incircle(5, 6, 0, 3, f, w, o, i))
-                {
-                  if (incircle(5, 0, 1, 3, f, w, o, i))
-                    {
-                      if (incircle(4, 0, 1, 5, f, w, o, i))
-                        {
-                          if (incircle(4, 2, 3, 1, f, w, o, i))
-                            {
-                              remove_degree7_rightfan(v,  4  , f, w, o, i);
-                            }
-                          else
-                            {
-                              remove_degree7_zigzag(v,  4  , f, w, o, i);
-                            }
-                        }
-                      else if (incircle(5, 2, 3, 1, f, w, o, i))
-                        {
-                          if (incircle(4, 1, 2, 5, f, w, o, i))
-                            {
-                              remove_degree7_zigzag(v,  1  , f, w, o, i);
-                            }
-                          else
-                            {
-                              if (incircle(4, 2, 3, 5, f, w, o, i))
-                                {
-                                  remove_degree7_leftfan(v,  5  , f, w, o, i);
-                                }
-                              else
-                                {
-                                  remove_degree7_star(v,  5  , f, w, o, i);
-                                }
-                            }
-                        }
-                      else
-                        {
-                          if (incircle(1, 4, 5, 3, f, w, o, i))
-                            {
-                              if (incircle(4, 2, 3, 1, f, w, o, i))
-                                {
-                                  remove_degree7_zigzag(v,  1  , f, w, o, i);
-                                }
-                              else
-                                {
-                                  remove_degree7_leftfan(v,  1  , f, w, o, i);
-                                }
-                            }
-                          else
-                            {
-                              remove_degree7_leftdelta(v,  5  , f, w, o, i);
-                            }
-                        }
-                    }
-                  else
-                    {
-                      if (! incircle(3, 4, 5, 0, f, w, o, i))
-                        {
-                          if (incircle(4, 0, 1, 3, f, w, o, i))
-                            {
-                              if (incircle(4, 2, 3, 1, f, w, o, i))
-                                {
-                                  remove_degree7_rightfan(v,  4  , f, w, o, i);
-                                }
-                              else
-                                {
-                                  remove_degree7_zigzag(v,  4  , f, w, o, i);
-                                }
-                            }
-                          else
-                            {
-                              remove_degree7_rightfan(v,  0  , f, w, o, i);
-                            }
-                        }
-                      else
-                        {
-                          remove_degree7_rightdelta(v,  3  , f, w, o, i);
-                        }
-                    }
-                }
-              else
-                {
-                  remove_degree7_star(v,  3  , f, w, o, i);
-                }
-            }
-          else
-            {
-              if (incircle(4, 6, 0, 3, f, w, o, i))
-                {
-                  if (incircle(4, 0, 1, 3, f, w, o, i))
-                    {
-                      if (incircle(4, 2, 3, 1, f, w, o, i))
-                        {
-                          remove_degree7_star(v,  4  , f, w, o, i);
-                        }
-                      else
-                        {
-                          remove_degree7_leftfan(v,  4  , f, w, o, i);
-                        }
-                    }
-                  else
-                    {
-                      remove_degree7_zigzag(v,  0  , f, w, o, i);
-                    }
-                }
-              else
-                {
-                  if (incircle(4, 5, 6, 3, f, w, o, i))
-                    {
-                      remove_degree7_rightfan(v,  3  , f, w, o, i);
-                    }
-                  else
-                    {
-                      remove_degree7_star(v,  3  , f, w, o, i);
-                    }
-                }
-            }
-        }
-    }
-}
-
-
-
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-rotate7(int j,  std::vector<Vertex_handle> &w,
-        std::vector<Face_handle> &f, std::vector<int> &i)
-{
-  if (j == 0) return;
-  Face_handle ff = f[0];
-  int ii = i[0], k = 0, kk = (6 * j) % 7;
-  Vertex_handle ww = w[0];
-  for (int jj = 0; k != kk; jj = k) // 7 is prime
-    {
-      k = (jj + j) % 7;
-      w[jj] = w[k];
-      f[jj] = f[k];
-      i[jj] = i[k];
-    }
-  w[kk] = ww;
-  f[kk] = ff;
-  i[kk] = ii;
-}
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-rotate7(int j,  std::vector<Vertex_handle> &w,
-        std::vector<Face_handle> &f, std::vector<Offset> &o, std::vector<int> &i)
-{
-  if (j == 0) return;
-  Face_handle ff = f[0];
-  int ii = i[0], k = 0, kk = (6 * j) % 7;
-  Vertex_handle ww = w[0];
-  Offset oo = o[0];
-  for (int jj = 0; k != kk; jj = k) // 7 is prime
-    {
-      k = (jj + j) % 7;
-      w[jj] = w[k];
-      f[jj] = f[k];
-      o[jj] = o[k];
-      i[jj] = i[k];
-    }
-  w[kk] = ww;
-  f[kk] = ff;
-  o[kk] = oo;
-  i[kk] = ii;
-}
-
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-get_offset_degree7(std::vector<Offset> &in_o, int out_o[])
-{
-  bool add[2];
-
-  add[0] = add[1] = false;
-
-  for (int cnt = 0; cnt < 7; ++cnt)
-    {
-      add[0] |= in_o[cnt].x() < 0;
-      add[1] |= in_o[cnt].y() < 0;
-    }
-
-  Covering_sheets c = number_of_sheets();
-  if (add[0] || add[1])
-    {
-      const Offset oo = Offset(add[0] ? c[0] : 0, add[1] ? c[1] : 0);
-      for (int i = 0; i < 7; ++i) in_o[i] += oo;
-    }
-
-  for (int cnt = 0; cnt < 7; ++cnt)
-    out_o[cnt] = (in_o[cnt].x() >= c[0] ? 2 : 0) + (in_o[cnt].y() >= c[1] ? 1 : 0);
-}
-
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-remove_degree7_star   (Vertex_handle &, int j,
-                       std::vector<Face_handle> &f, std::vector<Vertex_handle> &w, std::vector<int> &i)
-{
-  // removing a degree 7 vertex, staring from w[j]
-  rotate7(j, w, f, i);
-
-  Face_handle nn;
-  f[1]->set_vertex( i[1], w[0]) ;  // f1 = w1w2w0
-  f[2]->set_vertex( i[2], w[0]) ;  // f2 = w2w3w0
-  f[3]->set_vertex( i[3], w[0]) ;  // f3 = w3w4w0
-  f[4]->set_vertex( i[4], w[0]) ;  // f4 = w4w5w0
-  f[5]->set_vertex( i[5], w[0]) ;  // f5 = w5w6w0
-
-  nn = f[0]->neighbor( i[0] );
-  tds().set_adjacency(f[1], cw(i[1]) , nn , nn->index(f[0])  );
-  nn = f[6]->neighbor( i[6] );
-  tds().set_adjacency(f[5], ccw(i[5]) , nn , nn->index(f[6]) );
-  tds().delete_face(f[0]);
-  tds().delete_face(f[6]);
-
-
-  f[1]->set_offsets(0, 0, 0);
-  f[2]->set_offsets(0, 0, 0);
-  f[3]->set_offsets(0, 0, 0);
-  f[4]->set_offsets(0, 0, 0);
-  f[5]->set_offsets(0, 0, 0);
-}
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-remove_degree7_star   (Vertex_handle &v, int j,
-                       std::vector<Face_handle> &f, std::vector<Vertex_handle> &w, std::vector<Offset> &o, std::vector<int> &i)
-{
-  // removing a degree 7 vertex, staring from w[j]
-
-  // Rotate the offset as well
-  rotate7(j, w, f, o, i);
-  remove_degree7_star(v, /* !! */ 0, f, w, i);
-
-  int oo[7];
-  get_offset_degree7(o, oo);
-  int o_face[3];
-  int ii;
-  ii = i[1];
-  o_face[ii] = oo[0];
-  o_face[ccw(ii)] = oo[1];
-  o_face[ cw(ii)] = oo[2];
-  this->set_offsets(f[1], o_face[0], o_face[1], o_face[2]);
-  ii = i[2];
-  o_face[ii] = oo[0];
-  o_face[ccw(ii)] = oo[2];
-  o_face[ cw(ii)] = oo[3];
-  this->set_offsets(f[2], o_face[0], o_face[1], o_face[2]);
-  ii = i[3];
-  o_face[ii] = oo[0];
-  o_face[ccw(ii)] = oo[3];
-  o_face[ cw(ii)] = oo[4];
-  this->set_offsets(f[3], o_face[0], o_face[1], o_face[2]);
-  ii = i[4];
-  o_face[ii] = oo[0];
-  o_face[ccw(ii)] = oo[4];
-  o_face[ cw(ii)] = oo[5];
-  this->set_offsets(f[4], o_face[0], o_face[1], o_face[2]);
-  ii = i[5];
-  o_face[ii] = oo[0];
-  o_face[ccw(ii)] = oo[5];
-  o_face[ cw(ii)] = oo[6];
-  this->set_offsets(f[5], o_face[0], o_face[1], o_face[2]);
-
-  insert_too_long_edge(f[1], ccw(i[1]));
-  insert_too_long_edge(f[2], ccw(i[2]));
-  insert_too_long_edge(f[3], ccw(i[3]));
-  insert_too_long_edge(f[4], ccw(i[4]));
-}
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-remove_degree7_zigzag (Vertex_handle &, int j,
-                       std::vector<Face_handle> &f, std::vector<Vertex_handle> &w, std::vector<int> &i)
-{
-  // removing a degree 7 vertex, zigzag, w[j] = middle point
-  rotate7(j, w, f, i);
-
-  Face_handle nn;
-  f[1]->set_vertex(    i[1] , w[3]) ;  // f1 = w1w2w3
-  f[2]->set_vertex(ccw(i[2]), w[1]) ;
-  f[2]->set_vertex(    i[2] , w[0]) ;  // f2 = w1w3w0
-  f[3]->set_vertex(    i[3] , w[0]) ;  // f3 = w3w4w0
-  f[4]->set_vertex( cw(i[4]), w[6]) ;
-  f[4]->set_vertex(    i[4] , w[0]) ;  // f4 = w4w6w0
-  f[5]->set_vertex(    i[5] , w[4]) ;  // f5 = w5w6w4
-
-  nn = f[2]->neighbor( i[2] );
-  tds().set_adjacency(f[1], ccw(i[1]) , nn, nn->index(f[2]) );
-  nn = f[0]->neighbor( i[0] );
-  tds().set_adjacency(f[2], cw(i[2]) , nn , nn->index(f[0]) );
-  nn = f[6]->neighbor( i[6] );
-  tds().set_adjacency(f[4], ccw(i[4]) , nn , nn->index(f[6])  );
-  nn = f[4]->neighbor( i[4] );
-  tds().set_adjacency(f[5], cw(i[5]) , nn , nn->index(f[4])  );
-  tds().set_adjacency(f[1], cw(i[1]) , f[2] , i[2]   );
-  tds().set_adjacency(f[4], i[4]  , f[5] , ccw(i[5])  );
-
-  tds().delete_face(f[0]);
-  tds().delete_face(f[6]);
-
-
-  f[1]->set_offsets(0, 0, 0);
-  f[2]->set_offsets(0, 0, 0);
-  f[3]->set_offsets(0, 0, 0);
-  f[4]->set_offsets(0, 0, 0);
-  f[5]->set_offsets(0, 0, 0);
-}
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-remove_degree7_zigzag (Vertex_handle &v, int j,
-                       std::vector<Face_handle> &f, std::vector<Vertex_handle> &w, std::vector<Offset> &o, std::vector<int> &i)
-{
-  // removing a degree 7 vertex, zigzag, w[j] = middle point
-
-  // Rotate the offset as well
-  rotate7(j, w, f, o, i);
-  remove_degree7_zigzag(v, /* !! */ 0, f, w, i);
-
-  int oo[7];
-  get_offset_degree7(o, oo);
-  int o_face[3];
-  int ii;
-  ii = i[1];
-  o_face[ii] = oo[3];
-  o_face[ccw(ii)] = oo[1];
-  o_face[ cw(ii)] = oo[2];
-  this->set_offsets(f[1], o_face[0], o_face[1], o_face[2]);
-  ii = i[2];
-  o_face[ii] = oo[0];
-  o_face[ccw(ii)] = oo[1];
-  o_face[ cw(ii)] = oo[3];
-  this->set_offsets(f[2], o_face[0], o_face[1], o_face[2]);
-  ii = i[3];
-  o_face[ii] = oo[0];
-  o_face[ccw(ii)] = oo[3];
-  o_face[ cw(ii)] = oo[4];
-  this->set_offsets(f[3], o_face[0], o_face[1], o_face[2]);
-  ii = i[4];
-  o_face[ii] = oo[0];
-  o_face[ccw(ii)] = oo[4];
-  o_face[ cw(ii)] = oo[6];
-  this->set_offsets(f[4], o_face[0], o_face[1], o_face[2]);
-  ii = i[5];
-  o_face[ii] = oo[4];
-  o_face[ccw(ii)] = oo[5];
-  o_face[ cw(ii)] = oo[6];
-  this->set_offsets(f[5], o_face[0], o_face[1], o_face[2]);
-
-  insert_too_long_edge(f[1],  cw(i[1]));
-  insert_too_long_edge(f[2], ccw(i[2]));
-  insert_too_long_edge(f[3], ccw(i[3]));
-  insert_too_long_edge(f[4],     i[4]);
-}
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-remove_degree7_leftdelta(Vertex_handle &, int j,
-                         std::vector<Face_handle> &f, std::vector<Vertex_handle> &w, std::vector<int> &i)
-{
-  // removing a degree 7 vertex, left delta from w[j]
-  rotate7(j, w, f, i);
-
-  Face_handle nn;
-  f[1]->set_vertex(    i[1] , w[0]) ;  // f1 = w1w2w0
-  f[2]->set_vertex(    i[2] , w[0]) ;  // f2 = w2w3w0
-  f[3]->set_vertex( cw(i[3]), w[5]) ;
-  f[3]->set_vertex(    i[3] , w[0]) ;  // f3 = w3w5w0
-  f[4]->set_vertex(    i[4] , w[3]) ;  // f4 = w4w5w3
-  f[5]->set_vertex(    i[5] , w[0]) ;  // f5 = w5w6w0
-
-  nn = f[0]->neighbor( i[0] );
-  tds().set_adjacency(f[1], cw(i[1]) , nn , nn->index(f[0])  );
-  nn = f[3]->neighbor( i[3] );
-  tds().set_adjacency(f[4], cw(i[4]) , nn , nn->index(f[3]) );
-  nn = f[6]->neighbor( i[6] );
-  tds().set_adjacency(f[5], ccw(i[5]) , nn , nn->index(f[6])  );
-  tds().set_adjacency(f[3], i[3]  , f[4] , ccw(i[4])  );
-  tds().set_adjacency(f[3], ccw(i[3]) , f[5] ,  cw(i[5]) );
-
-  tds().delete_face(f[0]);
-  tds().delete_face(f[6]);
-
-  f[1]->set_offsets(0, 0, 0);
-  f[2]->set_offsets(0, 0, 0);
-  f[3]->set_offsets(0, 0, 0);
-  f[4]->set_offsets(0, 0, 0);
-  f[5]->set_offsets(0, 0, 0);
-}
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-remove_degree7_leftdelta(Vertex_handle &v, int j,
-                         std::vector<Face_handle> &f, std::vector<Vertex_handle> &w, std::vector<Offset> &o, std::vector<int> &i)
-{
-  // removing a degree 7 vertex, left delta from w[j]
-
-  // Rotate the offset as well
-  rotate7(j, w, f, o, i);
-  remove_degree7_leftdelta(v, /* !! */ 0, f, w, i);
-
-  int oo[7];
-  get_offset_degree7(o, oo);
-
-  int o_face[3];
-  int ii;
-  ii = i[1];
-  o_face[ii] = oo[0];
-  o_face[ccw(ii)] = oo[1];
-  o_face[ cw(ii)] = oo[2];
-  this->set_offsets(f[1], o_face[0], o_face[1], o_face[2]);
-  ii = i[2];
-  o_face[ii] = oo[0];
-  o_face[ccw(ii)] = oo[2];
-  o_face[ cw(ii)] = oo[3];
-  this->set_offsets(f[2], o_face[0], o_face[1], o_face[2]);
-  ii = i[3];
-  o_face[ii] = oo[0];
-  o_face[ccw(ii)] = oo[3];
-  o_face[ cw(ii)] = oo[5];
-  this->set_offsets(f[3], o_face[0], o_face[1], o_face[2]);
-  ii = i[4];
-  o_face[ii] = oo[3];
-  o_face[ccw(ii)] = oo[4];
-  o_face[ cw(ii)] = oo[5];
-  this->set_offsets(f[4], o_face[0], o_face[1], o_face[2]);
-  ii = i[5];
-  o_face[ii] = oo[0];
-  o_face[ccw(ii)] = oo[5];
-  o_face[ cw(ii)] = oo[6];
-  this->set_offsets(f[5], o_face[0], o_face[1], o_face[2]);
-
-  insert_too_long_edge(f[1], ccw(i[1]));
-  insert_too_long_edge(f[2], ccw(i[2]));
-  insert_too_long_edge(f[3],     i[3]);
-  insert_too_long_edge(f[3], ccw(i[3]));
-}
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-remove_degree7_rightdelta(Vertex_handle &, int j,
-                          std::vector<Face_handle> &f, std::vector<Vertex_handle> &w, std::vector<int> &i)
-{
-  // removing a degree 7 vertex, right delta from w[j]
-  rotate7(j, w, f, i);
-
-  Face_handle nn;
-  f[1]->set_vertex(    i[1] , w[0]) ;  // f1 = w1w2w0
-  f[2]->set_vertex(    i[2] , w[4]) ;  // f2 = w2w3w4
-  f[3]->set_vertex(ccw(i[3]), w[2]) ;
-  f[3]->set_vertex(    i[3] , w[0]) ;  // f3 = w2w4w0
-  f[4]->set_vertex(    i[4] , w[0]) ;  // f4 = w4w5w0
-  f[5]->set_vertex(    i[5] , w[0]) ;  // f5 = w5w6w0
-
-  nn = f[0]->neighbor( i[0] );
-  tds().set_adjacency(f[1], cw(i[1]) , nn , nn->index(f[0]) );
-  nn = f[3]->neighbor( i[3] );
-  tds().set_adjacency(f[2], ccw(i[2]) , nn, nn->index(f[3]) );
-  nn = f[6]->neighbor( i[6] );
-  tds().set_adjacency(f[5], ccw(i[5]) , nn , nn->index(f[6]) );
-  tds().set_adjacency(f[1], ccw(i[1]) , f[3], cw(i[3])  );
-  tds().set_adjacency(f[3], i[3]  , f[2], cw(i[2]) );
-
-  tds().delete_face(f[0]);
-  tds().delete_face(f[6]);
-
-  f[1]->set_offsets(0, 0, 0);
-  f[2]->set_offsets(0, 0, 0);
-  f[3]->set_offsets(0, 0, 0);
-  f[4]->set_offsets(0, 0, 0);
-  f[5]->set_offsets(0, 0, 0);
-}
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-remove_degree7_rightdelta(Vertex_handle &v, int j,
-                          std::vector<Face_handle> &f, std::vector<Vertex_handle> &w, std::vector<Offset> &o, std::vector<int> &i)
-{
-  // removing a degree 7 vertex, right delta from w[j]
-
-  // Rotate the offset as well
-  rotate7(j, w, f, o, i);
-  remove_degree7_rightdelta(v, /* !! */ 0, f, w, i);
-
-  int oo[7];
-  get_offset_degree7(o, oo);
-  int o_face[3];
-  int ii;
-  ii = i[1];
-  o_face[ii] = oo[0];
-  o_face[ccw(ii)] = oo[1];
-  o_face[ cw(ii)] = oo[2];
-  this->set_offsets(f[1], o_face[0], o_face[1], o_face[2]);
-  ii = i[2];
-  o_face[ii] = oo[4];
-  o_face[ccw(ii)] = oo[2];
-  o_face[ cw(ii)] = oo[3];
-  this->set_offsets(f[2], o_face[0], o_face[1], o_face[2]);
-  ii = i[3];
-  o_face[ii] = oo[0];
-  o_face[ccw(ii)] = oo[2];
-  o_face[ cw(ii)] = oo[4];
-  this->set_offsets(f[3], o_face[0], o_face[1], o_face[2]);
-  ii = i[4];
-  o_face[ii] = oo[0];
-  o_face[ccw(ii)] = oo[4];
-  o_face[ cw(ii)] = oo[5];
-  this->set_offsets(f[4], o_face[0], o_face[1], o_face[2]);
-  ii = i[5];
-  o_face[ii] = oo[0];
-  o_face[ccw(ii)] = oo[5];
-  o_face[ cw(ii)] = oo[6];
-  this->set_offsets(f[5], o_face[0], o_face[1], o_face[2]);
-
-  insert_too_long_edge(f[1], ccw(i[1]));
-  insert_too_long_edge(f[2],  cw(i[2]));
-  insert_too_long_edge(f[3], ccw(i[3]));
-  insert_too_long_edge(f[4], ccw(i[4]));
-}
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-remove_degree7_leftfan(Vertex_handle &, int j,
-                       std::vector<Face_handle> &f, std::vector<Vertex_handle> &w, std::vector<int> &i)
-{
-  // removing a degree 7 vertex, left fan from w[j]
-  rotate7(j, w, f, i);
-
-  Face_handle nn;
-  f[1]->set_vertex(    i[1] , w[0]) ;  // f1 = w1w2w0
-  f[2]->set_vertex(    i[2] , w[0]) ;  // f2 = w2w3w0
-  f[3]->set_vertex(    i[3] , w[0]) ;  // f3 = w3w4w0
-  f[4]->set_vertex(    i[4] , w[6]) ;  // f4 = w4w5w6
-  f[6]->set_vertex(    i[6] , w[4]) ;  // f6 = w6w0w4
-
-  nn = f[0]->neighbor( i[0] );
-  tds().set_adjacency(f[1], cw(i[1]) , nn, nn->index(f[0]) );
-  nn = f[5]->neighbor( i[5] );
-  tds().set_adjacency(f[4], ccw(i[4]) , nn, nn->index(f[5]) );
-  tds().set_adjacency(f[3], ccw(i[3]) , f[6], ccw(i[6]) );
-  tds().set_adjacency(f[6], cw(i[6]) , f[4], cw(i[4]) );
-
-  tds().delete_face(f[0]);
-  tds().delete_face(f[5]);
-
-  f[1]->set_offsets(0, 0, 0);
-  f[2]->set_offsets(0, 0, 0);
-  f[3]->set_offsets(0, 0, 0);
-  f[4]->set_offsets(0, 0, 0);
-  f[6]->set_offsets(0, 0, 0);
-}
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-remove_degree7_leftfan(Vertex_handle &v, int j,
-                       std::vector<Face_handle> &f, std::vector<Vertex_handle> &w, std::vector<Offset> &o, std::vector<int> &i)
-{
-  // removing a degree 7 vertex, left fan from w[j]
-
-  // Rotate the offset as well
-  rotate7(j, w, f, o, i);
-  remove_degree7_leftfan(v, /* !! */ 0, f, w, i);
-
-  int oo[7];
-  get_offset_degree7(o, oo);
-
-  int o_face[3];
-  int ii;
-  ii = i[1];
-  o_face[ii] = oo[0];
-  o_face[ccw(ii)] = oo[1];
-  o_face[ cw(ii)] = oo[2];
-  this->set_offsets(f[1], o_face[0], o_face[1], o_face[2]);
-  ii = i[2];
-  o_face[ii] = oo[0];
-  o_face[ccw(ii)] = oo[2];
-  o_face[ cw(ii)] = oo[3];
-  this->set_offsets(f[2], o_face[0], o_face[1], o_face[2]);
-  ii = i[3];
-  o_face[ii] = oo[0];
-  o_face[ccw(ii)] = oo[3];
-  o_face[ cw(ii)] = oo[4];
-  this->set_offsets(f[3], o_face[0], o_face[1], o_face[2]);
-  ii = i[4];
-  o_face[ii] = oo[6];
-  o_face[ccw(ii)] = oo[4];
-  o_face[ cw(ii)] = oo[5];
-  this->set_offsets(f[4], o_face[0], o_face[1], o_face[2]);
-  ii = i[6];
-  o_face[ii] = oo[4];
-  o_face[ccw(ii)] = oo[6];
-  o_face[ cw(ii)] = oo[0];
-  this->set_offsets(f[6], o_face[0], o_face[1], o_face[2]);
-
-  insert_too_long_edge(f[1], ccw(i[1]));
-  insert_too_long_edge(f[2], ccw(i[2]));
-  insert_too_long_edge(f[3], ccw(i[3]));
-  insert_too_long_edge(f[4],  cw(i[4]));
-}
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-remove_degree7_rightfan(Vertex_handle &, int j,
-                        std::vector<Face_handle> &f, std::vector<Vertex_handle> &w, std::vector<int> &i)
-{
-  // removing a degree 7 vertex, right fan from w[j]
-  rotate7(j, w, f, i);
-
-  Face_handle nn;
-  f[0]->set_vertex(    i[0] , w[3]) ;  // f0 = w0w1w3
-  f[2]->set_vertex(    i[2] , w[1]) ;  // f2 = w2w3w1
-  f[3]->set_vertex(    i[3] , w[0]) ;  // f3 = w3w4w0
-  f[4]->set_vertex(    i[4] , w[0]) ;  // f4 = w4w5w0
-  f[5]->set_vertex(    i[5] , w[0]) ;  // f5 = w5w6w0
-
-  nn = f[1]->neighbor( i[1] );
-  tds().set_adjacency(f[2], cw(i[2]) , nn, nn->index(f[1]) );
-  nn = f[6]->neighbor( i[6] );
-  tds().set_adjacency(f[5], ccw(i[5]) , nn, nn->index(f[6]) );
-  tds().set_adjacency(f[2], ccw(i[2]) , f[0], ccw(i[0])  );
-  tds().set_adjacency(f[0], cw(i[0]) , f[3] , cw(i[3]) );
-
-  tds().delete_face(f[1]);
-  tds().delete_face(f[6]);
-
-  f[0]->set_offsets(0, 0, 0);
-  f[2]->set_offsets(0, 0, 0);
-  f[3]->set_offsets(0, 0, 0);
-  f[4]->set_offsets(0, 0, 0);
-  f[5]->set_offsets(0, 0, 0);
-}
-template < class Gt, class Tds >
-void
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-remove_degree7_rightfan(Vertex_handle &v, int j,
-                        std::vector<Face_handle> &f, std::vector<Vertex_handle> &w, std::vector<Offset> &o, std::vector<int> &i)
-{
-  // removing a degree 7 vertex, right fan from w[j]
-
-  // Rotate the offset as well
-  rotate7(j, w, f, o, i);
-  remove_degree7_rightfan(v, /* !! */ 0, f, w, i);
-
-  int oo[7];
-  get_offset_degree7(o, oo);
-  int o_face[3];
-  int ii;
-  ii = i[0];
-  o_face[ii] = oo[3];
-  o_face[ccw(ii)] = oo[0];
-  o_face[ cw(ii)] = oo[1];
-  this->set_offsets(f[0], o_face[0], o_face[1], o_face[2]);
-  ii = i[2];
-  o_face[ii] = oo[1];
-  o_face[ccw(ii)] = oo[2];
-  o_face[ cw(ii)] = oo[3];
-  this->set_offsets(f[2], o_face[0], o_face[1], o_face[2]);
-  ii = i[3];
-  o_face[ii] = oo[0];
-  o_face[ccw(ii)] = oo[3];
-  o_face[ cw(ii)] = oo[4];
-  this->set_offsets(f[3], o_face[0], o_face[1], o_face[2]);
-  ii = i[4];
-  o_face[ii] = oo[0];
-  o_face[ccw(ii)] = oo[4];
-  o_face[ cw(ii)] = oo[5];
-  this->set_offsets(f[4], o_face[0], o_face[1], o_face[2]);
-  ii = i[5];
-  o_face[ii] = oo[0];
-  o_face[ccw(ii)] = oo[5];
-  o_face[ cw(ii)] = oo[6];
-  this->set_offsets(f[5], o_face[0], o_face[1], o_face[2]);
-
-  insert_too_long_edge(f[0], ccw(i[0]));
-  insert_too_long_edge(f[0],  cw(i[0]));
-  insert_too_long_edge(f[3], ccw(i[3]));
-  insert_too_long_edge(f[4], ccw(i[4]));
-}
-
-
-
-
-///////////////////////////////////////////////////////////////
-//  DISPLACEMENT
-
-template <class Gt, class Tds >
-typename Periodic_2_Delaunay_triangulation_2<Gt, Tds>::Vertex_handle
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-move_if_no_collision(Vertex_handle v, const Point &p)
-{
-  Locate_type lt;
-  int li;
-  Vertex_handle inserted;
-  Face_handle loc = locate(p, lt, li, v->face());
-
-  if (lt == Triangulation::VERTEX)
-    return v;
-  else
-    /// This can be optimized by checking whether we can move v->point() to p
-    return insert(p, lt, loc, li);
-}
-
-template <class Gt, class Tds >
-typename Periodic_2_Delaunay_triangulation_2<Gt, Tds>::Vertex_handle
-Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
-move_point(Vertex_handle v, const Point &p)
-{
-  if(v->point() == p) return v;
-  Vertex_handle w = move_if_no_collision(v, p);
-  if(w != v)
-    {
-      remove(v);
-      return w;
-    }
-  return v;
-}
-
-template<class Gt, class Tds>
-void Periodic_2_Delaunay_triangulation_2<Gt, Tds>::fill_hole_delaunay(std::list<Edge> & first_hole)
-{
-  typedef std::list<Edge> Hole;
-  typedef std::list<Hole> Hole_list;
-
-  Face_handle  f, ff, fn;
-  int i, ii, in;
-  Hole_list hole_list;
-  Hole hole;
-
-  hole_list.push_front(first_hole);
-
-  while( ! hole_list.empty())
-    {
-      hole = hole_list.front();
-      hole_list.pop_front();
-      typename Hole::iterator hit = hole.begin();
-
-      // if the hole has only three edges, create the triangle
-      if (hole.size() == 3)
-        {
-          hit = hole.begin();
-          f = (*hit).first;
-          i = (*hit).second;
-          ff = (* ++hit).first;
-          ii = (*hit).second;
-          fn = (* ++hit).first;
-          in = (*hit).second;
-          Face_handle newf = create_face(f, i, ff, ii, fn, in);
-          newf->set_offsets(0, 0, 0);
-
-          continue;
-        }
-
-      // else find an edge with two finite vertices
-      // on the hole boundary
-      // and the new triangle adjacent to that edge
-      //  cut the hole and push it back
-
-      // take the first neighboring face and pop it;
-      ff = (hole.front()).first;
-      ii = (hole.front()).second;
-      hole.pop_front();
-
-      Vertex_handle v0 = ff->vertex(cw(ii));
-      Vertex_handle v1 = ff->vertex(ccw(ii));
-      Vertex_handle v2 = Vertex_handle();
-      Vertex_handle v3 = Vertex_handle();
-      const Point& p0 = v0->point();
-      const Point& p1 = v1->point();
-
-      typename Hole::iterator hdone = hole.end();
-      hit =  hole.begin();
-      typename Hole::iterator cut_after(hit);
-
-      // if tested vertex is c with respect to the vertex opposite
-      // to NULL neighbor,
-      // stop at the before last face;
-      hdone--;
-      while( hit != hdone)
-        {
-          fn = (*hit).first;
-          in = (*hit).second;
-          Vertex_handle vv = fn->vertex(ccw(in));
-
-          const Point &p = vv->point();
-          Orientation orient = orientation(p0, p1, p);
-
-          if (orient == COUNTERCLOCKWISE)
-            {
-              if (v2 == Vertex_handle())
-                {
-                  v2 = vv;
-                  v3 = vv;
-                  cut_after = hit;
-                }
-              else
-                {
-                  Oriented_side side = side_of_oriented_circle(p0, p1, v3->point(), p, true);
-                  if (side == ON_POSITIVE_SIDE)
-                    {
-                      v2 = vv;
-                      v3 = vv;
-                      cut_after = hit;
-                    }
-                }
-            }
-
-          ++hit;
-        }
-
-      // create new triangle and update adjacency relations
-      Face_handle newf;
-
-      //update the hole and push back in the Hole_List stack
-      // if v2 belongs to the neighbor following or preceding *f
-      // the hole remain a single hole
-      // otherwise it is split in two holes
-
-      fn = (hole.front()).first;
-      in = (hole.front()).second;
-      if (fn->has_vertex(v2, i) && i == fn->ccw(in))
-        {
-          newf = create_face(ff, ii, fn, in);
-
-          newf->set_offsets(0, 0, 0);
-
-          hole.pop_front();
-          hole.push_front(Edge(newf, 1));
-          hole_list.push_front(hole);
-        }
-      else
-        {
-          fn = (hole.back()).first;
-          in = (hole.back()).second;
-          if (fn->has_vertex(v2, i) && i == fn->cw(in))
-            {
-              newf = create_face(fn, in, ff, ii);
-              newf->set_offsets(0, 0, 0);
-
-              hole.pop_back();
-              hole.push_back(Edge(newf, 1));
-              hole_list.push_front(hole);
-            }
-          else
-            {
-              // split the hole in two holes
-              CGAL_assertion(v2 != Vertex_handle());
-              newf = create_face(ff, ii, v2);
-              newf->set_offsets(0, 0, 0);
-
-              Hole new_hole;
-              ++cut_after;
-              while( hole.begin() != cut_after )
-                {
-                  new_hole.push_back(hole.front());
-                  hole.pop_front();
-                }
-
-              hole.push_front(Edge( newf, 1));
-              new_hole.push_front(Edge( newf, 0));
-              hole_list.push_front(hole);
-              hole_list.push_front(new_hole);
-            }
-        }
-    }
-}
-
-template<class Gt, class Tds>
-void Periodic_2_Delaunay_triangulation_2<Gt, Tds>::fill_hole_delaunay(
-  std::list<Edge> & first_hole,
-  std::map<Vertex_handle, Offset> &vertex_offsets)
-{
-  typedef std::list<Edge> Hole;
-  typedef std::list<Hole> Hole_list;
-
-  Face_handle  f, ff, fn;
-  int i, ii, in;
-  Hole_list hole_list;
-  Hole hole;
-
-  hole_list.push_front(first_hole);
-
-  while( ! hole_list.empty())
-    {
-      hole = hole_list.front();
-      hole_list.pop_front();
-      typename Hole::iterator hit = hole.begin();
-
-      // if the hole has only three edges, create the triangle
-      if (hole.size() == 3)
-        {
-          hit = hole.begin();
-          f = (*hit).first;
-          i = (*hit).second;
-          ff = (* ++hit).first;
-          ii = (*hit).second;
-          fn = (* ++hit).first;
-          in = (*hit).second;
-          Face_handle newf = create_face(f, i, ff, ii, fn, in);
-          Offset oo0(vertex_offsets[newf->vertex(0)]);
-          Offset oo1(vertex_offsets[newf->vertex(1)]);
-          Offset oo2(vertex_offsets[newf->vertex(2)]);
-          if (oo0.x() < 0 || oo1.x() < 0 || oo2.x() < 0)
-            {
-              oo0 += Offset(number_of_sheets()[0], 0);
-              oo1 += Offset(number_of_sheets()[0], 0);
-              oo2 += Offset(number_of_sheets()[0], 0);
-            }
-          if (oo0.y() < 0 || oo1.y() < 0 || oo2.y() < 0)
-            {
-              oo0 += Offset(0, number_of_sheets()[1]);
-              oo1 += Offset(0, number_of_sheets()[1]);
-              oo2 += Offset(0, number_of_sheets()[1]);
-            }
-          set_offsets(newf,
-                      (oo0.x() >= number_of_sheets()[0] ? 2 : 0) + (oo0.y() >= number_of_sheets()[1] ? 1 : 0),
-                      (oo1.x() >= number_of_sheets()[0] ? 2 : 0) + (oo1.y() >= number_of_sheets()[1] ? 1 : 0),
-                      (oo2.x() >= number_of_sheets()[0] ? 2 : 0) + (oo2.y() >= number_of_sheets()[1] ? 1 : 0));
-
-          insert_too_long_edge(newf, 0);
-          insert_too_long_edge(newf, 1);
-          insert_too_long_edge(newf, 2);
-
-          continue;
-        }
-
-      // else find an edge with two finite vertices
-      // on the hole boundary
-      // and the new triangle adjacent to that edge
-      //  cut the hole and push it back
-
-      // take the first neighboring face and pop it;
-      ff = (hole.front()).first;
-      ii = (hole.front()).second;
-      hole.pop_front();
-
-      Vertex_handle v0 = ff->vertex(cw(ii));
-      Vertex_handle v1 = ff->vertex(ccw(ii));
-      Vertex_handle v2 = Vertex_handle();
-      Vertex_handle v3 = Vertex_handle();
-      const Point& p0 = v0->point();
-      const Point& p1 = v1->point();
-      const Offset o0 = vertex_offsets[v0];
-      const Offset o1 = vertex_offsets[v1];
-      bool simplicity_criterion = (o0 == o1);
-
-      typename Hole::iterator hdone = hole.end();
-      hit =  hole.begin();
-      typename Hole::iterator cut_after(hit);
-
-      // if tested vertex is c with respect to the vertex opposite
-      // to NULL neighbor,
-      // stop at the before last face;
-      hdone--;
-      while( hit != hdone)
-        {
-          fn = (*hit).first;
-          in = (*hit).second;
-          Vertex_handle vv = fn->vertex(ccw(in));
-
-          const Point &p = vv->point();
-          CGAL_assertion(vertex_offsets.find(vv) != vertex_offsets.end());
-          const Offset o = vertex_offsets[vv];
-          Orientation orient;
-          simplicity_criterion &= (o == o0);
-          if (simplicity_criterion)
-            orient = orientation(p0, p1, p);
-          else
-            orient = orientation(p0, p1, p, o0, o1, o);
-
-          if (orient == COUNTERCLOCKWISE)
-            {
-              if (v2 == Vertex_handle())
-                {
-                  v2 = vv;
-                  v3 = vv;
-                  cut_after = hit;
-                }
-              else
-                {
-                  Offset o3 = vertex_offsets[v3];
-                  Oriented_side side;
-                  if (simplicity_criterion && (o3 == o0))
-                    side = side_of_oriented_circle(p0, p1, v3->point(), p,
-                                                   true);
-                  else
-                    side = side_of_oriented_circle(p0, p1, v3->point(), p,
-                                                   o0, o1, o3, o,
-                                                   true);
-                  if (side == ON_POSITIVE_SIDE)
-                    {
-                      v2 = vv;
-                      v3 = vv;
-                      cut_after = hit;
-                    }
-                }
-            }
-
-          ++hit;
-        }
-
-      // create new triangle and update adjacency relations
-      Face_handle newf;
-
-      //update the hole and push back in the Hole_List stack
-      // if v2 belongs to the neighbor following or preceding *f
-      // the hole remain a single hole
-      // otherwise it is split in two holes
-
-      fn = (hole.front()).first;
-      in = (hole.front()).second;
-      if (fn->has_vertex(v2, i) && i == fn->ccw(in))
-        {
-          newf = create_face(ff, ii, fn, in);
-
-          Offset oo0 = o0;
-          Offset oo1 = o1;
-          Offset oo2 = vertex_offsets[v2];
-          if (oo0.x() < 0 || oo1.x() < 0 || oo2.x() < 0)
-            {
-              oo0 += Offset(number_of_sheets()[0], 0);
-              oo1 += Offset(number_of_sheets()[0], 0);
-              oo2 += Offset(number_of_sheets()[0], 0);
-            }
-          if (oo0.y() < 0 || oo1.y() < 0 || oo2.y() < 0)
-            {
-              oo0 += Offset(0, number_of_sheets()[1]);
-              oo1 += Offset(0, number_of_sheets()[1]);
-              oo2 += Offset(0, number_of_sheets()[1]);
-            }
-          set_offsets(newf,
-                      (oo0.x() >= number_of_sheets()[0] ? 2 : 0) + (oo0.y() >= number_of_sheets()[1] ? 1 : 0),
-                      (oo1.x() >= number_of_sheets()[0] ? 2 : 0) + (oo1.y() >= number_of_sheets()[1] ? 1 : 0),
-                      (oo2.x() >= number_of_sheets()[0] ? 2 : 0) + (oo2.y() >= number_of_sheets()[1] ? 1 : 0));
-          // set_offsets(newf, o0, o1, o2);
-          insert_too_long_edge(newf, 0);
-          insert_too_long_edge(newf, 1);
-
-          hole.pop_front();
-          hole.push_front(Edge(newf, 1));
-          hole_list.push_front(hole);
-        }
-      else
-        {
-          fn = (hole.back()).first;
-          in = (hole.back()).second;
-          if (fn->has_vertex(v2, i) && i == fn->cw(in))
-            {
-              newf = create_face(fn, in, ff, ii);
-              Offset oo0 = o0;
-              Offset oo1 = o1;
-              Offset oo2 = vertex_offsets[v2];
-              if (oo0.x() < 0 || oo1.x() < 0 || oo2.x() < 0)
-                {
-                  oo0 += Offset(number_of_sheets()[0], 0);
-                  oo1 += Offset(number_of_sheets()[0], 0);
-                  oo2 += Offset(number_of_sheets()[0], 0);
-                }
-              if (oo0.y() < 0 || oo1.y() < 0 || oo2.y() < 0)
-                {
-                  oo0 += Offset(0, number_of_sheets()[1]);
-                  oo1 += Offset(0, number_of_sheets()[1]);
-                  oo2 += Offset(0, number_of_sheets()[1]);
-                }
-              set_offsets(newf,
-                          (oo2.x() >= number_of_sheets()[0] ? 2 : 0) + (oo2.y() >= number_of_sheets()[1] ? 1 : 0),
-                          (oo0.x() >= number_of_sheets()[0] ? 2 : 0) + (oo0.y() >= number_of_sheets()[1] ? 1 : 0),
-                          (oo1.x() >= number_of_sheets()[0] ? 2 : 0) + (oo1.y() >= number_of_sheets()[1] ? 1 : 0));
-              insert_too_long_edge(newf, 1);
-              insert_too_long_edge(newf, 2);
-              hole.pop_back();
-              hole.push_back(Edge(newf, 1));
-              hole_list.push_front(hole);
-            }
-          else
-            {
-              // split the hole in two holes
-              CGAL_assertion(v2 != Vertex_handle());
-              newf = create_face(ff, ii, v2);
-              Offset oo0 = o0;
-              Offset oo1 = o1;
-              Offset oo2 = vertex_offsets[v2];
-              if (oo0.x() < 0 || oo1.x() < 0 || oo2.x() < 0)
-                {
-                  oo0 += Offset(number_of_sheets()[0], 0);
-                  oo1 += Offset(number_of_sheets()[0], 0);
-                  oo2 += Offset(number_of_sheets()[0], 0);
-                }
-              if (oo0.y() < 0 || oo1.y() < 0 || oo2.y() < 0)
-                {
-                  oo0 += Offset(0, number_of_sheets()[1]);
-                  oo1 += Offset(0, number_of_sheets()[1]);
-                  oo2 += Offset(0, number_of_sheets()[1]);
-                }
-              set_offsets(newf,
-                          (oo0.x() >= number_of_sheets()[0] ? 2 : 0) + (oo0.y() >= number_of_sheets()[1] ? 1 : 0),
-                          (oo1.x() >= number_of_sheets()[0] ? 2 : 0) + (oo1.y() >= number_of_sheets()[1] ? 1 : 0),
-                          (oo2.x() >= number_of_sheets()[0] ? 2 : 0) + (oo2.y() >= number_of_sheets()[1] ? 1 : 0));
-
-
-              // set_offsets(newf, o0, o1, o2);
-              insert_too_long_edge(newf, 0);
-              insert_too_long_edge(newf, 1);
-
-              Hole new_hole;
-              ++cut_after;
-              while( hole.begin() != cut_after )
-                {
-                  new_hole.push_back(hole.front());
-                  hole.pop_front();
-                }
-
-              hole.push_front(Edge( newf, 1));
-              new_hole.push_front(Edge( newf, 0));
-              hole_list.push_front(hole);
-              hole_list.push_front(new_hole);
-            }
-        }
-    }
-}
-} //namespace CGAL
-
-#endif // CGAL_PERIODIC_2_DELAUNAY_TRIANGULATION_2_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Periodic_3_Delaunay_triangulation_3.h b/3rdparty/CGAL-4.8/include/CGAL/Periodic_3_Delaunay_triangulation_3.h
deleted file mode 100644
index 96b379e..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Periodic_3_Delaunay_triangulation_3.h
+++ /dev/null
@@ -1,1241 +0,0 @@
-// Copyright (c) 1999-2004,2006-2009   INRIA Sophia-Antipolis (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
-// 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(s)     : Monique Teillaud <Monique.Teillaud at sophia.inria.fr>
-//                 Sylvain Pion <Sylvain.Pion at sophia.inria.fr>
-//                 Andreas Fabri <Andreas.Fabri at sophia.inria.fr>
-//                 Nico Kruithof <Nico.Kruithof at sophia.inria.fr>
-//                 Manuel Caroli <Manuel.Caroli at sophia.inria.fr>
-
-
-#ifndef CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_3_H
-#define CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_3_H
-
-#include <CGAL/Periodic_3_triangulation_3.h>
-#include <CGAL/spatial_sort.h>
-
-// Needed by remove to fill the hole.
-#include <CGAL/Periodic_3_triangulation_remove_traits_3.h>
-#include <CGAL/Delaunay_triangulation_3.h>
-
-namespace CGAL {
-
-template < class Gt,
-            class Tds = Triangulation_data_structure_3 <
-              Triangulation_vertex_base_3<
-		Gt, Periodic_3_triangulation_ds_vertex_base_3<>
-	      >,
-              Triangulation_cell_base_3<
-                Gt, Periodic_3_triangulation_ds_cell_base_3<>
-              >
-            >
-          >
-class Periodic_3_Delaunay_triangulation_3 :
-    public Periodic_3_triangulation_3<Gt,Tds>
-{
-  typedef Periodic_3_Delaunay_triangulation_3<Gt,Tds>          Self;
-public:
-  typedef Periodic_3_triangulation_3<Gt,Tds>                   Base;
-
-public:
-  /** @name Template parameter types */ //@{
-  typedef Gt                                    Geometric_traits;
-  typedef Tds                                   Triangulation_data_structure;
-  //@}
-
-  ///Compatibility typedef:
-  typedef Geometric_traits                      Geom_traits;
-  typedef typename Gt::FT                       FT;
-
-  typedef typename Gt::Point_3                  Point;
-  typedef typename Gt::Segment_3                Segment;
-  typedef typename Gt::Triangle_3               Triangle;
-  typedef typename Gt::Tetrahedron_3            Tetrahedron;
-
-  typedef typename Base::Periodic_point         Periodic_point;
-  typedef typename Base::Periodic_segment       Periodic_segment;
-  typedef typename Base::Periodic_triangle      Periodic_triangle;
-  typedef typename Base::Periodic_tetrahedron   Periodic_tetrahedron;
-
-  typedef typename Base::Cell_handle            Cell_handle;
-  typedef typename Base::Vertex_handle          Vertex_handle;
-
-  typedef typename Base::Cell                   Cell;
-  typedef typename Base::Vertex                 Vertex;
-  typedef typename Base::Facet                  Facet;
-  typedef typename Base::Edge                   Edge;
-
-  typedef typename Base::Cell_circulator        Cell_circulator;
-  typedef typename Base::Facet_circulator       Facet_circulator;
-  typedef typename Base::Cell_iterator          Cell_iterator;
-  typedef typename Base::Facet_iterator         Facet_iterator;
-  typedef typename Base::Edge_iterator          Edge_iterator;
-  typedef typename Base::Vertex_iterator        Vertex_iterator;
-
-  typedef typename Base::All_cells_iterator     All_cells_iterator;
-  typedef typename Base::All_facets_iterator    All_facets_iterator;
-  typedef typename Base::All_edges_iterator     All_edges_iterator;
-  typedef typename Base::All_vertices_iterator  All_vertices_iterator;
-
-  typedef typename Base::size_type              size_type;
-  typedef typename Base::difference_type        difference_type;
-
-  typedef typename Base::Locate_type            Locate_type;
-  typedef typename Base::Iterator_type          Iterator_type;
-
-  typedef typename Base::Offset                 Offset;
-  typedef typename Base::Iso_cuboid             Iso_cuboid;
-  typedef typename Base::Covering_sheets        Covering_sheets;
-  //@}
-
-#ifndef CGAL_CFG_USING_BASE_MEMBER_BUG_2
-  using Base::cw;
-  using Base::ccw;
-  using Base::domain;
-  using Base::geom_traits;
-  using Base::int_to_off;
-  using Base::number_of_sheets;
-  using Base::number_of_vertices;
-  using Base::number_of_edges;
-  using Base::number_of_facets;
-  using Base::number_of_cells;
-  using Base::cells_begin;
-  using Base::cells_end;
-  using Base::vertices_begin;
-  using Base::vertices_end;
-  using Base::facets_begin;
-  using Base::facets_end;
-  using Base::tds;
-  using Base::next_around_edge;
-  using Base::vertex_triple_index;
-  using Base::mirror_vertex;
-  using Base::orientation;
-  using Base::insert_dummy_points;
-  using Base::swap;
-  using Base::is_1_cover;
-  using Base::is_virtual;
-  using Base::point;
-#endif
-
-  // For strict-ansi compliance
-  using Base::adjacent_vertices;
-  using Base::combine_offsets;
-  using Base::get_offset;
-  using Base::get_original_vertex;
-  using Base::get_location_offset;
-  using Base::get_neighbor_offset;
-  using Base::incident_edges;
-  using Base::incident_facets;
-  using Base::incident_cells;
-  using Base::is_valid_conflict;
-  using Base::locate;
-  using Base::periodic_point;
-  using Base::segment;
-
-public:
-  /** @name Creation */ //@{
-  Periodic_3_Delaunay_triangulation_3(
-      const Iso_cuboid& domain = Iso_cuboid(0,0,0,1,1,1),
-      const Geometric_traits& gt = Geometric_traits())
-    : Base(domain, gt) {}
-
-  // copy constructor duplicates vertices and cells
-  Periodic_3_Delaunay_triangulation_3(
-      const Periodic_3_Delaunay_triangulation_3& tr) : Base(tr) { 
-    CGAL_triangulation_expensive_postcondition( is_valid() );  
-  }
-
-  template < typename InputIterator >
-  Periodic_3_Delaunay_triangulation_3(InputIterator first, InputIterator last,
-      const Iso_cuboid& domain = Iso_cuboid(0,0,0,1,1,1),
-      const Geometric_traits& gt = Geometric_traits() )
-    : Base(domain, gt) {
-    insert(first, last);
-  }
-  //@}
-
-  /** @name Insertion */ //@{
-  Vertex_handle insert(const Point & p, Cell_handle start = Cell_handle()) {
-    Conflict_tester tester(p, this);
-    Point_hider hider;
-    return Base::insert_in_conflict(p, start, tester, hider);
-  }
-
-  Vertex_handle insert(const Point & p, Locate_type lt, Cell_handle c,
-      int li, int lj) {
-    Conflict_tester tester(p, this);
-    Point_hider hider;
-    return Base::insert_in_conflict(p,lt,c,li,lj, tester,hider);
-  }
-
-  template < class InputIterator >
-  std::ptrdiff_t insert(InputIterator first, InputIterator last,
-      bool is_large_point_set = false) {
-    if (first == last) return 0;
-    size_type n = number_of_vertices();
-    // The heuristic discards the existing triangulation so it can only be
-    // applied to empty triangulations.
-    if (n!=0) is_large_point_set = false;
-
-    std::vector<Point> points(first, last);
-    std::random_shuffle (points.begin(), points.end());
-    Cell_handle hint;
-    std::vector<Vertex_handle> dummy_points, double_vertices;
-    typename std::vector<Point>::iterator pbegin = points.begin();
-    if (is_large_point_set)
-      dummy_points = insert_dummy_points();
-    else while (!is_1_cover()) {
-	insert(*pbegin);
-	++pbegin;
-	if (pbegin == points.end()) return number_of_vertices() - n;
-      }
-
-    // Use Geom_traits::K for efficiency: spatial_sort creates a lot
-    // of copies of the traits but does not need the domain that is
-    // stored in it.
-    spatial_sort (pbegin, points.end(), typename Geom_traits::K());
-
-    Conflict_tester tester(*pbegin,this);
-    Point_hider hider;
-    double_vertices = Base::insert_in_conflict(
-	points.begin(),points.end(),hint,tester,hider); 
-   
-    if (is_large_point_set) {
-      typedef CGAL::Periodic_3_triangulation_remove_traits_3< Gt > P3removeT;
-      typedef CGAL::Delaunay_triangulation_3< P3removeT > DT;
-      typedef Vertex_remover< DT > Remover;
-      P3removeT remove_traits(domain());
-      DT dt(remove_traits);
-      Remover remover(this,dt);
-      Conflict_tester t(this);
-      for (unsigned int i=0; i<dummy_points.size(); i++) {
-	if (std::find(double_vertices.begin(), double_vertices.end(),
-		dummy_points[i]) == double_vertices.end())
-	  Base::remove(dummy_points[i],remover,t);
-      }
-    }
-
-    return number_of_vertices() - n;
-  }
-  //@}
-
-  /** @name Point moving */ //@{
-  Vertex_handle move_point(Vertex_handle v, const Point & p);
-  //@}
-
-public:
-  /** @name Removal */ //@{
-  void remove(Vertex_handle v);
-
-  template < typename InputIterator >
-  std::ptrdiff_t remove(InputIterator first, InputIterator beyond) {
-    std::size_t n = number_of_vertices();
-    while (first != beyond) {
-      remove(*first);
-      ++first;
-    }
-    return n - number_of_vertices();
-  }
-  //@}
-
-public:
-  /** @name Wrapping the traits */ //@{
-  Oriented_side side_of_oriented_sphere(const Point &p, const Point &q,
-      const Point &r, const Point &s, const Point &t) const {
-    return geom_traits().side_of_oriented_sphere_3_object()(p,q,r,s,t);
-  }
-  Oriented_side side_of_oriented_sphere(const Point &p, const Point &q,
-      const Point &r, const Point &s, const Point &t, const Offset &o_p,
-      const Offset &o_q, const Offset &o_r, const Offset &o_s,
-      const Offset &o_t) const {
-    return geom_traits().side_of_oriented_sphere_3_object()(
-	p,q,r,s,t,o_p,o_q,o_r,o_s,o_t);
-  }
-  Comparison_result compare_distance(const Point &p, const Point &q,
-      const Point &r) const {
-      return geom_traits().compare_distance_3_object()(p, q, r);
-  }
-  Comparison_result compare_distance(const Point &p, const Point &q,
-      const Point &r, const Offset &o_p, const Offset &o_q,
-      const Offset &o_r) const {
-    return geom_traits().compare_distance_3_object()(p, q, r, o_p, o_q, o_r);
-  }
-  //@}
-
-private:
-  /** @name Query helpers */ //@{
-  Bounded_side _side_of_sphere(const Cell_handle& c, const Point& p,
-      const Offset & offset = Offset(), bool perturb = false) const;
-
-  Offset get_min_dist_offset(const Point & p, const Offset & o,
-      const Vertex_handle vh) const;
-  //@}
-
-public:
-  /** @name Queries */ //@{
-  Bounded_side side_of_sphere(const Cell_handle& c, const Point& p,
-      const Offset & offset = Offset(), bool perturb = false) const{
-    Bounded_side bs = ON_UNBOUNDED_SIDE;
-    int i=0;
-    // TODO: optimize which copies to check depending on the offsets in
-    // the cell.
-    while (bs == ON_UNBOUNDED_SIDE && i<8) {
-      bs= _side_of_sphere(c,p,combine_offsets(offset,int_to_off(i)),perturb);
-      i++;
-    }
-    return bs;
-  }
-
-  Vertex_handle nearest_vertex(const Point& p,
-      Cell_handle c = Cell_handle()) const;
-  Vertex_handle nearest_vertex_in_cell(const Cell_handle& c,
-      const Point & p, const Offset & offset = Offset()) const;
-
-  /// Undocumented wrapper for find_conflicts.
-  template <class OutputIteratorBoundaryFacets, class OutputIteratorCells>
-  std::pair<OutputIteratorBoundaryFacets, OutputIteratorCells>
-  find_conflicts(const Point &p, Cell_handle c,
-      OutputIteratorBoundaryFacets bfit, OutputIteratorCells cit) const {
-    Triple<OutputIteratorBoundaryFacets,OutputIteratorCells,Emptyset_iterator>
-    t = find_conflicts(p, c, bfit, cit, Emptyset_iterator());
-    return std::make_pair(t.first, t.second);
-  }
-
-  template <class OutputIteratorBoundaryFacets, class OutputIteratorCells,
-            class OutputIteratorInternalFacets>
-  Triple<OutputIteratorBoundaryFacets, OutputIteratorCells,
-         OutputIteratorInternalFacets>
-  find_conflicts(const Point &p, Cell_handle c,
-      OutputIteratorBoundaryFacets bfit, OutputIteratorCells cit,
-      OutputIteratorInternalFacets ifit) const;
-  
-  /// Returns the vertices on the boundary of the conflict hole.
-  template <class OutputIterator>
-  OutputIterator vertices_in_conflict(const Point&p, Cell_handle c,
-      OutputIterator res) const;
-
-  bool is_Gabriel(const Cell_handle c, int i) const;
-  bool is_Gabriel(const Cell_handle c, int i, int j) const;
-  bool is_Gabriel(const Facet& f)const {
-    return is_Gabriel(f.first, f.second);
-  }
-  bool is_Gabriel(const Edge& e) const {
-    return is_Gabriel(e.first, e.second, e.third);
-  }
-  //@}
-  
-private:
-  /** @name Voronoi diagram helpers */ //@{
-  bool is_canonical(const Periodic_segment &ps) const {
-    if (number_of_sheets() == make_array(1,1,1)) return true;
-    Offset o0 = ps.at(0).second;
-    Offset o1 = ps.at(1).second;
-    Offset cumm_off((std::min)(o0.x(),o1.x()),(std::min)(o0.y(),o1.y()),
-	(std::min)(o0.z(),o1.z()));
-    return (cumm_off == Offset(0,0,0));
-  }
-  //@}
-public:
-  Periodic_point periodic_circumcenter(Cell_handle c) const {
-    CGAL_triangulation_precondition(c != Cell_handle());
-    Point v = geom_traits().construct_circumcenter_3_object()(
-        c->vertex(0)->point(), c->vertex(1)->point(),
-	c->vertex(2)->point(), c->vertex(3)->point(),
-        get_offset(c,0), get_offset(c,1),
-	get_offset(c,2), get_offset(c,3));
-
-    // check that v lies within the domain. If not: translate
-    Iso_cuboid dom = domain();
-    if (   !(v.x() < dom.xmin()) && v.x()<dom.xmax()
-	&& !(v.y() < dom.ymin()) && v.y()<dom.ymax()
-	&& !(v.z() < dom.zmin()) && v.z()<dom.zmax() )
-      return std::make_pair(v,Offset());
-
-    int ox=-1, oy=-1, oz=-1;
-    if (v.x() < dom.xmin()) ox = 1;
-    else if (v.x() < dom.xmax()) ox = 0;
-    if (v.y() < dom.ymin()) oy = 1;
-    else if (v.y() < dom.ymax()) oy = 0;
-    if (v.z() < dom.zmin()) oz = 1;
-    else if (v.z() < dom.zmax()) oz = 0;
-    Offset transl_offx(0,0,0);
-    Offset transl_offy(0,0,0);
-    Offset transl_offz(0,0,0);
-    Point dv(v);
-
-    // Find the right offset such that the translation will yield a
-    // point inside the original domain.
-    while ( dv.x() < dom.xmin() || !(dv.x() < dom.xmax()) ) {
-      transl_offx.x() = transl_offx.x() + ox;
-      dv = point(std::make_pair(v,transl_offx));
-    }
-    while ( dv.y() < dom.ymin() || !(dv.y() < dom.ymax()) ) {
-      transl_offy.y() = transl_offy.y() + oy;
-      dv = point(std::make_pair(v,transl_offy));
-    }
-    while ( dv.z() < dom.zmin() || !(dv.z() < dom.zmax()) ) {
-      transl_offz.z() = transl_offz.z() + oz;
-      dv = point(std::make_pair(v,transl_offz));
-    }
-
-    Offset transl_off(transl_offx.x(),transl_offy.y(),transl_offz.z());
-    Periodic_point ppv(std::make_pair(v,transl_off));
-
-    CGAL_triangulation_assertion_code(Point rv(point(ppv));)
-    CGAL_triangulation_assertion( !(rv.x() < dom.xmin()) && rv.x() < dom.xmax() );
-    CGAL_triangulation_assertion( !(rv.y() < dom.ymin()) && rv.y() < dom.ymax() );
-    CGAL_triangulation_assertion( !(rv.z() < dom.zmin()) && rv.z() < dom.zmax() );
-    return ppv;
-  }
-
-private:
-bool is_canonical(const Facet &f) const {
-  if (number_of_sheets() == make_array(1,1,1)) return true;
-  Offset cell_off0 = int_to_off(f.first->offset((f.second+1)&3));
-  Offset cell_off1 = int_to_off(f.first->offset((f.second+2)&3));
-  Offset cell_off2 = int_to_off(f.first->offset((f.second+3)&3));
-  Offset diff_off((cell_off0.x() == 1 
-	  && cell_off1.x() == 1 
-	  && cell_off2.x() == 1)?-1:0,
-      (cell_off0.y() == 1 
-	  && cell_off1.y() == 1
-	  && cell_off2.y() == 1)?-1:0,
-      (cell_off0.z() == 1 
-	  && cell_off1.z() == 1
-	  && cell_off2.z() == 1)?-1:0);
-  Offset off0 = combine_offsets(get_offset(f.first, (f.second+1)&3),
-      diff_off);
-  Offset off1 = combine_offsets(get_offset(f.first, (f.second+2)&3),
-      diff_off);
-  Offset off2 = combine_offsets(get_offset(f.first, (f.second+3)&3),
-      diff_off);
-  
-  // If there is one offset with entries larger than 1 then we are
-  // talking about a vertex that is too far away from the original
-  // domain to belong to a canonical triangle.
-  if (off0.x() > 1) return false;
-  if (off0.y() > 1) return false;
-  if (off0.z() > 1) return false;
-  if (off1.x() > 1) return false;
-  if (off1.y() > 1) return false;
-  if (off1.z() > 1) return false;
-  if (off2.x() > 1) return false;
-  if (off2.y() > 1) return false;
-  if (off2.z() > 1) return false;
-  
-  // If there is one direction of space for which all offsets are
-  // non-zero then the edge is not canonical because we can
-  // take the copy closer towards the origin in that direction.
-  int offx = off0.x() & off1.x() & off2.x();
-  int offy = off0.y() & off1.y() & off2.y();
-  int offz = off0.z() & off1.z() & off2.z();
-  
-  return (offx == 0 && offy == 0 && offz == 0);
-}
-  
-  bool canonical_dual_segment(Cell_handle c, int i, Periodic_segment& ps) const {
-    CGAL_triangulation_precondition(c != Cell_handle());
-    Offset off = get_neighbor_offset(c,i,c->neighbor(i));
-    Periodic_point p1 = periodic_circumcenter(c);
-    Periodic_point p2 = periodic_circumcenter(c->neighbor(i));
-    Offset o1 = -p1.second;
-    Offset o2 = combine_offsets(-p2.second,-off);
-    Offset cumm_off((std::min)(o1.x(),o2.x()),
-	(std::min)(o1.y(),o2.y()),(std::min)(o1.z(),o2.z()));
-    const std::pair<Point,Offset> pp1 = std::make_pair(point(p1), o1-cumm_off);
-    const std::pair<Point,Offset> pp2 = std::make_pair(point(p2), o2-cumm_off);
-    ps = make_array(pp1,pp2);
-    return (cumm_off == Offset(0,0,0));
-  }
-
-public:
-  /** @name Voronoi diagram */ //@{
-  Point dual(Cell_handle c) const {
-    return point(periodic_circumcenter(c));
-  }
-  Periodic_segment dual(const Facet & f) const {
-    return dual( f.first, f.second );
-  }
-  Periodic_segment dual(Cell_handle c, int i) const{
-    Periodic_segment ps;
-    canonical_dual_segment(c,i,ps);
-    return ps;
-  }
-
-  template <class OutputIterator>
-  OutputIterator dual(const Edge & e, OutputIterator points) const {
-    return dual(e.first, e.second, e.third, points);
-  }
-
-  template <class OutputIterator>
-  OutputIterator dual(Cell_handle c, int i, int j,
-      OutputIterator points) const {
-    Cell_circulator cstart = incident_cells(c, i, j);
-
-    Offset offv = periodic_point(c,i).second;
-    Vertex_handle v = c->vertex(i);
-
-    Cell_circulator ccit = cstart;
-    do {
-      Point dual_orig = periodic_circumcenter(ccit).first;
-      int idx = ccit->index(v);
-      Offset off = periodic_point(ccit,idx).second;
-      Point dual = point(std::make_pair(dual_orig,-off+offv));
-      *points++ = dual;
-      ++ccit;
-    } while (ccit != cstart);
-    return points;
-  }
-
-  template <class OutputIterator>
-  OutputIterator dual(Vertex_handle v, OutputIterator points) const {
-    std::vector<Cell_handle> cells;
-    incident_cells(v,std::back_inserter(cells));
-
-    for (unsigned int i=0; i<cells.size() ; i++) {
-      Point dual_orig = periodic_circumcenter(cells[i]).first;
-      int idx = cells[i]->index(v);
-      Offset off = periodic_point(cells[i],idx).second;
-      Point dual = point(std::make_pair(dual_orig,-off));
-      *points++ = dual;
-    }
-    return points;
-  }
-
-  template <class Stream>
-  Stream& draw_dual(Stream& os) const {
-    CGAL_triangulation_assertion_code( unsigned int i = 0; )
-    for (Facet_iterator fit = facets_begin(), end = facets_end();
-	 fit != end; ++fit) {
-      if (!is_canonical(*fit)) continue;
-      Periodic_segment pso = dual(*fit);
-      Segment so = segment(pso);
-      CGAL_triangulation_assertion_code ( ++i; )
-	os << so.source()<<' '<<so.target()<<' ';
-    }
-    CGAL_triangulation_assertion( i == number_of_facets() );
-    return os;
-  }
-
-  /// Volume computations
-
-  // Note: Polygon area computation requires to evaluate square roots
-  // and thus cannot be done without changing the Traits concept.
-
-  FT dual_volume(Vertex_handle v) const {
-    std::list<Edge> edges;
-    incident_edges(v, std::back_inserter(edges));
-
-    FT vol(0);
-    for (typename std::list<Edge>::iterator eit = edges.begin() ; 
-	 eit != edges.end() ; ++eit) {
-
-      // compute the dual of the edge *eit but handle the translations
-      // with respect to the dual of v. That is why we cannot use one
-      // of the existing dual functions here.
-      Facet_circulator fstart = incident_facets(*eit);
-      Facet_circulator fcit = fstart;
-      std::vector<Point> pts;
-      do {
-	// TODO: possible speed-up by caching the circumcenters
-	Point dual_orig = periodic_circumcenter(fcit->first).first;
-	int idx = fcit->first->index(v);
-	Offset off = periodic_point(fcit->first,idx).second;
-	pts.push_back(point(std::make_pair(dual_orig,-off)));
-	++fcit;
-      } while (fcit != fstart);
-
-      Point orig(0,0,0);
-      for (unsigned int i=1 ; i<pts.size()-1 ; i++) 
-	vol += Tetrahedron(orig,pts[0],pts[i],pts[i+1]).volume();
-    }
-    return vol;
-  }
-
-  /// Centroid computations
-
-  // Note: Centroid computation for polygons requires to evaluate
-  // square roots and thus cannot be done without changing the
-  // Traits concept.
-
-  // TODO: reuse the centroid computation from the PCA package
-  Point dual_centroid(Vertex_handle v) const {
-    std::list<Edge> edges;
-    incident_edges(v, std::back_inserter(edges));
-
-    FT vol(0);
-    FT x(0), y(0), z(0);
-    for (typename std::list<Edge>::iterator eit = edges.begin() ; 
-	 eit != edges.end() ; ++eit) {
-
-      // compute the dual of the edge *eit but handle the translations
-      // with respect to the dual of v. That is why we cannot use one
-      // of the existing dual functions here.
-      Facet_circulator fstart = incident_facets(*eit);
-      Facet_circulator fcit = fstart;
-      std::vector<Point> pts;
-      do {
-	// TODO: possible speed-up by caching the circumcenters
-	Point dual_orig = periodic_circumcenter(fcit->first).first;
-	int idx = fcit->first->index(v);
-	Offset off = periodic_point(fcit->first,idx).second;
-	pts.push_back(point(std::make_pair(dual_orig,-off)));
-	++fcit;
-      } while (fcit != fstart);
-
-      Point orig(0,0,0);
-      FT tetvol;
-      for (unsigned int i=1 ; i<pts.size()-1 ; i++) {
-	tetvol = Tetrahedron(orig,pts[0],pts[i],pts[i+1]).volume();
-	x += (pts[0].x() + pts[i].x() + pts[i+1].x()) * tetvol;
-	y += (pts[0].y() + pts[i].y() + pts[i+1].y()) * tetvol;
-	z += (pts[0].z() + pts[i].z() + pts[i+1].z()) * tetvol;
-	vol += tetvol;
-      }
-    }
-    x /= ( 4 * vol );
-    y /= ( 4 * vol );
-    z /= ( 4 * vol );
-
-    Iso_cuboid d = domain();
-    x = (x < d.xmin() ? x+d.xmax()-d.xmin() 
-	: (x >= d.xmax() ? x-d.xmax()+d.xmin() : x));
-    y = (y < d.ymin() ? y+d.ymax()-d.ymin() 
-	: (y >= d.ymax() ? y-d.ymax()+d.ymin() : y));
-    z = (z < d.zmin() ? z+d.zmax()-d.zmin() 
-	: (z >= d.zmax() ? z-d.zmax()+d.zmin() : z));
-
-    CGAL_triangulation_postcondition((d.xmin()<=x)&&(x<d.xmax()));
-    CGAL_triangulation_postcondition((d.ymin()<=y)&&(y<d.ymax()));
-    CGAL_triangulation_postcondition((d.zmin()<=z)&&(z<d.zmax()));
-
-    return Point(x,y,z);
-  }
-  //@}
-  
-  /** @name Checking */ //@{
-  bool is_valid(bool verbose = false, int level = 0) const;
-  bool is_valid(Cell_handle c, bool verbose = false, int level = 0) const;
-  //@}
-
-protected:
-  // Protected, because inheritors(e.g. periodic triangulation for meshing) 
-  // of the class Periodic_3_Delaunay_triangulation_3 use this class
-  class Conflict_tester;
-private:
-  class Point_hider;
-
-#ifndef CGAL_CFG_OUTOFLINE_TEMPLATE_MEMBER_DEFINITION_BUG
-  template <class TriangulationR3> struct Vertex_remover;
-#else
-  template <class TriangulationR3>
-  struct Vertex_remover
-  {
-    typedef TriangulationR3      Triangulation_R3;
-    
-    typedef typename std::vector<Point>::iterator Hidden_points_iterator;
-    
-    typedef Triple < Vertex_handle, Vertex_handle, Vertex_handle > Vertex_triple;
-    
-    typedef typename Triangulation_R3::Triangulation_data_structure TDSE;
-    typedef typename Triangulation_R3::Cell_handle        CellE_handle;
-    typedef typename Triangulation_R3::Vertex_handle      VertexE_handle;
-    typedef typename Triangulation_R3::Facet              FacetE;
-    typedef typename Triangulation_R3::Finite_cells_iterator Finite_cellsE_iterator;
-    
-    typedef Triple< VertexE_handle, VertexE_handle, VertexE_handle >
-      VertexE_triple;
-    
-    typedef std::map<Vertex_triple,Facet> Vertex_triple_Facet_map;
-    typedef std::map<Vertex_triple, FacetE> Vertex_triple_FacetE_map;
-    typedef typename Vertex_triple_FacetE_map::iterator
-    Vertex_triple_FacetE_map_it;
-    
-  Vertex_remover(const Self *t, Triangulation_R3 &tmp_) : _t(t),tmp(tmp_) {}
-    
-    const Self *_t;
-    Triangulation_R3 &tmp;
-    
-    void add_hidden_points(Cell_handle) {
-      std::copy (hidden_points_begin(), hidden_points_end(), 
-		 std::back_inserter(hidden));
-    }
-    
-    Hidden_points_iterator hidden_points_begin() {
-      return hidden.begin();
-    }
-    Hidden_points_iterator hidden_points_end() {
-      return hidden.end();
-    }
-    //private:
-    // The removal of v may un-hide some points,
-    // Space functions output them.
-    std::vector<Point> hidden;
-  };
-#endif //CGAL_CFG_OUTOFLINE_TEMPLATE_MEMBER_DEFINITION_BUG
-
-  // unused and undocumented types and functions required to be
-  // compatible to Alpha_shape_3
-public:
-  typedef Cell_iterator   Finite_cells_iterator;
-  typedef Facet_iterator  Finite_facets_iterator;
-  typedef Edge_iterator   Finite_edges_iterator;
-  typedef Vertex_iterator Finite_vertices_iterator;
-
-  int dimension() const { return 3; }
-  template < class T >
-  bool is_infinite(const T&, int = 0, int = 0) const { return false; }
-  size_type number_of_finite_cells() const { return number_of_cells(); }
-  size_type number_of_finite_facets() const { return number_of_facets(); }
-  size_type number_of_finite_edges() const { return number_of_edges(); }
-  size_type number_of_finite_vertices() const { return number_of_vertices(); }
-};
-
-template < class GT, class Tds >
-typename Periodic_3_Delaunay_triangulation_3<GT,Tds>::Vertex_handle
-Periodic_3_Delaunay_triangulation_3<GT,Tds>::nearest_vertex(const Point& p,
-    Cell_handle start) const {
-  if (number_of_vertices() == 0)
-    return Vertex_handle();
-
-  Locate_type lt;
-  int li, lj;
-  Cell_handle c = locate(p, lt, li, lj, start);
-  if (lt == Base::VERTEX) return c->vertex(li);
-  const Conflict_tester tester(p, this);
-  Offset o = combine_offsets(Offset(),get_location_offset(tester,c));
-
-  // - start with the closest vertex from the located cell.
-  // - repeatedly take the nearest of its incident vertices if any
-  // - if not, we're done.
-  Vertex_handle nearest = nearest_vertex_in_cell(c, p, o);
-  std::vector<Vertex_handle> vs;
-  vs.reserve(32);
-  while (true) {
-    Vertex_handle tmp = nearest;
-    Offset tmp_off = get_min_dist_offset(p,o,tmp);
-    adjacent_vertices(nearest, std::back_inserter(vs));
-    for (typename std::vector<Vertex_handle>::const_iterator
-	   vsit = vs.begin(); vsit != vs.end(); ++vsit)
-      tmp = (compare_distance(p,tmp->point(),(*vsit)->point(),
-	      o,tmp_off,get_min_dist_offset(p,o,*vsit))
-	  == SMALLER) ? tmp : *vsit;
-    if (tmp == nearest)
-      break;
-    vs.clear();
-    nearest = tmp;
-  }
-
-  return get_original_vertex(nearest);
-}
-
-// just trying the eight possibilities
-template < class GT, class Tds >
-typename Periodic_3_Delaunay_triangulation_3<GT,Tds>::Offset
-Periodic_3_Delaunay_triangulation_3<GT,Tds>::get_min_dist_offset(
-    const Point & p, const Offset & o, const Vertex_handle vh) const {
-  Offset mdo = get_offset(vh);
-  Offset min_off = Offset(0,0,0);
-  min_off = (compare_distance(p,vh->point(),vh->point(),
-	  o,combine_offsets(mdo,min_off),combine_offsets(mdo,Offset(0,0,1)))
-      == SMALLER ? min_off : Offset(0,0,1) );
-  min_off = (compare_distance(p,vh->point(),vh->point(),
-	  o,combine_offsets(mdo,min_off),combine_offsets(mdo,Offset(0,1,0)))
-      == SMALLER ? min_off : Offset(0,1,0) );
-  min_off = (compare_distance(p,vh->point(),vh->point(),
-	  o,combine_offsets(mdo,min_off),combine_offsets(mdo,Offset(0,1,1)))
-      == SMALLER ? min_off : Offset(0,1,1) );
-  min_off = (compare_distance(p,vh->point(),vh->point(),
-	  o,combine_offsets(mdo,min_off),combine_offsets(mdo,Offset(1,0,0)))
-      == SMALLER ? min_off : Offset(1,0,0) );
-  min_off = (compare_distance(p,vh->point(),vh->point(),
-	  o,combine_offsets(mdo,min_off),combine_offsets(mdo,Offset(1,0,1)))
-      == SMALLER ? min_off : Offset(1,0,1) );
-  min_off = (compare_distance(p,vh->point(),vh->point(),
-	  o,combine_offsets(mdo,min_off),combine_offsets(mdo,Offset(1,1,0)))
-      == SMALLER ? min_off : Offset(1,1,0) );
-  min_off = (compare_distance(p,vh->point(),vh->point(),
-	  o,combine_offsets(mdo,min_off),combine_offsets(mdo,Offset(1,1,1)))
-      == SMALLER ? min_off : Offset(1,1,1) );
-  return combine_offsets(mdo,min_off);
-}
-
-/// Returns the finite vertex of the cell c which is the closest to p.
-template < class GT, class Tds >
-typename Periodic_3_Delaunay_triangulation_3<GT,Tds>::Vertex_handle
-Periodic_3_Delaunay_triangulation_3<GT,Tds>::nearest_vertex_in_cell(
-    const Cell_handle& c, const Point & p, const Offset & o) const {
-  CGAL_triangulation_precondition(number_of_vertices() != 0);
-  Vertex_handle nearest = c->vertex(0);
-  for (int i=1 ; i<4 ; i++) {
-    nearest = (compare_distance(p,nearest->point(),c->vertex(i)->point(),
-	    o,get_offset(c,c->index(nearest)),get_offset(c,i)) == SMALLER) ?
-      nearest : c->vertex(i);
-  }
-  return nearest;
-}
-
-// ############################################################################
-
-// TODO: reintroduce the commented lines.
-template < class Gt, class Tds >
-typename Periodic_3_Delaunay_triangulation_3<Gt,Tds>::Vertex_handle
-Periodic_3_Delaunay_triangulation_3<Gt,Tds>::
-move_point(Vertex_handle v, const Point & p) {
-  CGAL_triangulation_expensive_precondition(is_vertex(v));
-  // Remember an incident vertex to restart
-  // the point location after the removal.
-  // Cell_handle c = v->cell();
-  //Vertex_handle old_neighbor = c->vertex(c->index(v) == 0 ? 1 : 0);
-  //  CGAL_triangulation_assertion(old_neighbor != v);
-
-  remove(v);
-
-  if (number_of_vertices() == 0)
-    return insert(p);
-  return insert(p);//, old_neighbor->cell());
-}
-
-template < class Gt, class Tds >
-void Periodic_3_Delaunay_triangulation_3<Gt,Tds>::remove(Vertex_handle v)
-{
-  typedef CGAL::Periodic_3_triangulation_remove_traits_3< Gt > P3removeT;
-  typedef CGAL::Delaunay_triangulation_3< P3removeT >
-    Euclidean_triangulation;
-  typedef Vertex_remover< Euclidean_triangulation > Remover;
-  P3removeT remove_traits(domain());
-  Euclidean_triangulation tmp(remove_traits);
-  Remover remover(this, tmp);
-  Conflict_tester ct(this);
-
-  Base::remove(v, remover, ct);
-  CGAL_triangulation_expensive_assertion(is_valid());
-}
-
-template < class Gt, class Tds >
-template <class OutputIteratorBoundaryFacets, class OutputIteratorCells,
-          class OutputIteratorInternalFacets>
-Triple<OutputIteratorBoundaryFacets, OutputIteratorCells,
-       OutputIteratorInternalFacets>
-Periodic_3_Delaunay_triangulation_3<Gt,Tds>::find_conflicts( const Point
-&p,
-    Cell_handle c, OutputIteratorBoundaryFacets bfit,
-    OutputIteratorCells cit, OutputIteratorInternalFacets ifit) const {
-  CGAL_triangulation_precondition(number_of_vertices() != 0);
-
-  std::vector<Facet> facets;
-  facets.reserve(64);
-  std::vector<Cell_handle> cells;
-  cells.reserve(32);
-
-  Conflict_tester tester(p, this);
-  Triple<typename std::back_insert_iterator<std::vector<Facet> >,
-         typename std::back_insert_iterator<std::vector<Cell_handle> >,
-         OutputIteratorInternalFacets> tit = Base::find_conflicts(c, tester,
-              make_triple(std::back_inserter(facets),
-                      std::back_inserter(cells), ifit));
-  ifit = tit.third;
-
-  // Reset the conflict flag on the boundary.
-  for(typename std::vector<Facet>::iterator fit=facets.begin();
-  fit != facets.end(); ++fit) {
-    fit->first->neighbor(fit->second)->tds_data().clear();
-    *bfit++ = *fit;
-  }
-
-  // Reset the conflict flag in the conflict cells.
-  for(typename std::vector<Cell_handle>::iterator ccit=cells.begin();
-      ccit != cells.end(); ++ccit) {
-    (*ccit)->tds_data().clear();
-    *cit++ = *ccit;
-  }
-
-  for (typename std::vector<Vertex_handle>::iterator
-	 voit = this->v_offsets.begin();
-       voit != this->v_offsets.end() ; ++voit) {
-    (*voit)->clear_offset();
-  }
-  this->v_offsets.clear();
-
-  return make_triple(bfit, cit, ifit);
-}
-
-template < class Gt, class Tds >
-template <class OutputIterator>
-OutputIterator
-Periodic_3_Delaunay_triangulation_3<Gt,Tds>::vertices_in_conflict(
-    const Point&p, Cell_handle c, OutputIterator res) const {
-  if (number_of_vertices() == 0) return res;
-
-  // Get the facets on the boundary of the hole.
-  std::vector<Facet> facets;
-  find_conflicts(p, c, std::back_inserter(facets), Emptyset_iterator());
-  
-  // Then extract uniquely the vertices.
-  std::set<Vertex_handle> vertices;
-  for (typename std::vector<Facet>::const_iterator i = facets.begin();
-       i != facets.end(); ++i) {
-    vertices.insert(i->first->vertex((i->second+1)&3));
-    vertices.insert(i->first->vertex((i->second+2)&3));
-    vertices.insert(i->first->vertex((i->second+3)&3));
-  }
-  
-  return std::copy(vertices.begin(), vertices.end(), res);
-}
-
-template < class Gt, class Tds >
-Bounded_side Periodic_3_Delaunay_triangulation_3<Gt,Tds>::
-_side_of_sphere(const Cell_handle &c, const Point &q,
-    const Offset &offset, bool perturb ) const {
-
-  Point p0 = c->vertex(0)->point(),
-        p1 = c->vertex(1)->point(),
-        p2 = c->vertex(2)->point(),
-        p3 = c->vertex(3)->point();
-  Offset o0 = this->get_offset(c,0),
-        o1 = this->get_offset(c,1),
-        o2 = this->get_offset(c,2),
-        o3 = this->get_offset(c,3),
-        oq = offset;
-
-  Oriented_side os = ON_NEGATIVE_SIDE;
-  os= side_of_oriented_sphere(p0, p1, p2, p3, q, o0, o1, o2, o3, oq);
-
-  if (os != ON_ORIENTED_BOUNDARY || !perturb)
-    return (Bounded_side) os;
-
-  //We are now in a degenerate case => we do a symbolic perturbation. 
-  // We sort the points lexicographically.
-  Periodic_point pts[5] = {std::make_pair(p0,o0), std::make_pair(p1,o1),
-			   std::make_pair(p2,o2), std::make_pair(p3,o3),
-			   std::make_pair(q,oq)};
-  const Periodic_point *points[5] ={&pts[0],&pts[1],&pts[2],&pts[3],&pts[4]};
-
-  std::sort(points, points+5,
-      typename Base::template Perturbation_order<
-	  typename Gt::Compare_xyz_3 >(
-	  geom_traits().compare_xyz_3_object() ) );
-  // We successively look whether the leading monomial, then 2nd monomial
-  // of the determinant has non null coefficient.
-  // 2 iterations are enough (cf paper)
-  for (int i=4; i>2; --i) {
-    if (points[i] == &pts[4]) {
-      CGAL_triangulation_assertion(orientation(p0, p1, p2, p3, o0, o1, o2, o3)
-          == POSITIVE);
-      // since p0 p1 p2 p3 are non coplanar and positively oriented
-      return ON_UNBOUNDED_SIDE;
-    }
-    Orientation o;
-    if (points[i] == &pts[3] && 
-        (o = orientation(p0, p1, p2, q, o0, o1, o2, oq)) != COPLANAR ) {
-      return (Bounded_side) o;
-    }
-    if (points[i] == &pts[2] && 
-        (o = orientation(p0, p1, q, p3, o0, o1, oq, o3)) != COPLANAR ) {
-      return (Bounded_side) o;
-    }
-    if (points[i] == &pts[1] && 
-        (o = orientation(p0, q, p2, p3, o0, oq, o2, o3)) != COPLANAR ) {
-      return (Bounded_side) o;
-    }
-    if (points[i] == &pts[0] && 
-        (o = orientation(q, p1, p2 ,p3, oq, o1, o2, o3)) != COPLANAR ) {
-      return (Bounded_side) o;
-    }
-  }
-
-  CGAL_triangulation_assertion(false);
-  return ON_UNBOUNDED_SIDE;
-}
-
-template < class Gt, class Tds >
-bool Periodic_3_Delaunay_triangulation_3<Gt,Tds>::
-is_Gabriel(const Cell_handle c, int i) const {
-  CGAL_triangulation_precondition(number_of_vertices() != 0);
-  typename Geom_traits::Side_of_bounded_sphere_3
-    side_of_bounded_sphere =
-    geom_traits().side_of_bounded_sphere_3_object();
-
-  if (side_of_bounded_sphere (
-          c->vertex(vertex_triple_index(i,0))->point(),
-	  c->vertex(vertex_triple_index(i,1))->point(),
-	  c->vertex(vertex_triple_index(i,2))->point(),
-          c->vertex(i)->point(),
-          get_offset(c,vertex_triple_index(i,0)),
-          get_offset(c,vertex_triple_index(i,1)),
-          get_offset(c,vertex_triple_index(i,2)),
-          get_offset(c,i) ) == ON_BOUNDED_SIDE ) return false;
-  Cell_handle neighbor = c->neighbor(i);
-  int in = neighbor->index(c);
-
-  if (side_of_bounded_sphere(
-          neighbor->vertex(vertex_triple_index(in,0))->point(),
-	  neighbor->vertex(vertex_triple_index(in,1))->point(),
-	  neighbor->vertex(vertex_triple_index(in,2))->point(),
-          neighbor->vertex(in)->point(),
-          get_offset(neighbor,vertex_triple_index(in,0)),
-          get_offset(neighbor,vertex_triple_index(in,1)),
-          get_offset(neighbor,vertex_triple_index(in,2)),
-          get_offset(neighbor, in) ) == ON_BOUNDED_SIDE )
-    return false;
-  
-  return true;
-}
-
-template < class Gt, class Tds >
-bool Periodic_3_Delaunay_triangulation_3<Gt,Tds>::
-is_Gabriel(const Cell_handle c, int i, int j) const {
-  typename Geom_traits::Side_of_bounded_sphere_3
-    side_of_bounded_sphere =
-    geom_traits().side_of_bounded_sphere_3_object();
-
-  Facet_circulator fcirc = incident_facets(c,i,j),
-    fdone(fcirc);
-  Vertex_handle v1 = c->vertex(i);
-  Vertex_handle v2 = c->vertex(j);
-  do {
-    // test whether the vertex of cc opposite to *fcirc
-    // is inside the sphere defined by the edge e = (s, i,j)
-    // It is necessary to fetch the offsets from the current cell.
-    Cell_handle cc = fcirc->first;
-    int i1 = cc->index(v1);
-    int i2 = cc->index(v2);
-    int i3 = fcirc->second;
-    Offset off1 = int_to_off(cc->offset(i1));
-    Offset off2 = int_to_off(cc->offset(i2));
-    Offset off3 = int_to_off(cc->offset(i3));
-    if (side_of_bounded_sphere(
-	    v1->point(), v2->point(), cc->vertex(fcirc->second)->point(),
-	    off1, off2, off3) == ON_BOUNDED_SIDE ) return false;
-  } while(++fcirc != fdone);
-  return true;
-}
-
-template < class Gt, class Tds >
-bool
-Periodic_3_Delaunay_triangulation_3<Gt,Tds>::
-is_valid(bool verbose, int level) const
-{ 
-  if (!Base::is_valid(verbose, level)) {
-    if (verbose)
-      std::cerr << "Delaunay: invalid base" << std::endl;
-    return false;
-  }
-
-  Conflict_tester tester(this);
-  if (!is_valid_conflict(tester, verbose, level)) {
-    if (verbose)
-      std::cerr << "Delaunay: conflict problems" << std::endl;
-    return false;
-  }
-
-  if (verbose)
-    std::cerr << "Delaunay valid triangulation" << std::endl;
-  return true;
-}
-
-template < class GT, class TDS >
-bool
-Periodic_3_Delaunay_triangulation_3<GT,TDS>::
-is_valid(Cell_handle ch, bool verbose, int level) const {
-  bool error = false;
-  if (!Base::is_valid(ch, verbose, level)) {
-    error = true;
-    if (verbose) {
-      std::cerr << "geometrically invalid cell" << std::endl;
-      for (int i=0; i<4; i++ )
-	std::cerr << ch->vertex(i)->point() << ", ";
-      std::cerr << std::endl;
-    }
-  }
-  for (Vertex_iterator vit = vertices_begin(); vit != vertices_end(); ++ vit) {
-    for (int i=-1; i<=1; i++)
-      for (int j=-1; j<=1; j++)
-	for (int k=-1; k<=1; k++) {
-	  if (periodic_point(ch,0) == std::make_pair(periodic_point(vit).first,
-		  periodic_point(vit).second+Offset(i,j,k))
-	  || periodic_point(ch,1) == std::make_pair(periodic_point(vit).first,
-		  periodic_point(vit).second+Offset(i,j,k))
-          || periodic_point(ch,2) == std::make_pair(periodic_point(vit).first,
-		  periodic_point(vit).second+Offset(i,j,k))
-	  || periodic_point(ch,3) == std::make_pair(periodic_point(vit).first,
-                  periodic_point(vit).second+Offset(i,j,k)) )
-	    continue;
-	  if (_side_of_sphere(ch, periodic_point(vit).first,
-		  periodic_point(vit).second+Offset(i,j,k),true)
-	      != ON_UNBOUNDED_SIDE) {
-	    error = true;
-	    if (verbose) {
-	      std::cerr << "Delaunay invalid cell" << std::endl;
-	      for (int i=0; i<4; i++ ) {
-		Periodic_point pp = periodic_point(ch,i);
-		std::cerr <<"("<<pp.first <<","<<pp.second<< "), ";
-	      }
-	      std::cerr << std::endl;
-	    }
-	  }
-	}
-  }
-  return !error;
-}
-
-template < class GT, class Tds >
-class Periodic_3_Delaunay_triangulation_3<GT,Tds>::Conflict_tester
-{
-  // stores a pointer to the triangulation,
-  // a point, and an offset
-  const Self *t;
-  Point p;
-  // stores the offset of a point in 27-cover
-  mutable Offset o;
-
-public:
-  /// Constructor
-  Conflict_tester(const Self *_t) : t(_t), p(Point()) {}
-  Conflict_tester(const Point &pt, const Self *_t) : t(_t), p(pt) { }
-  
-  /** The functor
-    *
-    * gives true if the circumcircle of c contains p
-    */
-  bool operator()(const Cell_handle c, const Offset &off) const {
-    return (t->_side_of_sphere(c, p, t->combine_offsets(o, off), true)
-        == ON_BOUNDED_SIDE);
-  }
-
-  bool operator()(const Cell_handle c, const Point& pt,
-      const Offset &off) const {
-    return (t->_side_of_sphere(c, pt, o + off, true) == ON_BOUNDED_SIDE);
-  }
-  
-  int compare_weight(Point, Point) const
-  {
-    return 0;
-  }
-  
-  bool test_initial_cell(Cell_handle c, const Offset &off) const
-  {
-    if (!(operator()(c, off)))
-      CGAL_triangulation_assertion(false);
-    return true;
-  }
-  
-  void set_point(const Point &_p) {
-    p = _p;
-  }
-
-  void set_offset(const Offset &off) const {
-    o = off;
-  }
-  
-  const Offset &get_offset() const {
-    return o;
-  }
-  
-  const Point &point() const {
-    return p;
-  }
-  
-};
-
-template < class GT, class Tds>
-class Periodic_3_Delaunay_triangulation_3<GT,Tds>::Point_hider
-{
-public:
-  Point_hider() {}
-
-  template <class InputIterator>
-  inline void set_vertices(InputIterator, InputIterator) const {}
-  inline void reinsert_vertices(Vertex_handle ) {}
-  inline Vertex_handle replace_vertex(Cell_handle c, int index,
-                                      const Point &) {
-    return c->vertex(index);
-  }
-  inline void hide_point(Cell_handle, const Point &) {}
-
-  inline void hide(Point &, Cell_handle ) const {
-    CGAL_triangulation_assertion(false);
-  }
-
-  inline void do_hide(const Point &, Cell_handle ) const {
-    CGAL_triangulation_assertion(false);
-  }
-  template < class Tester > 
-  inline bool replace_vertex(const Point &, Vertex_handle ,
-      const Tester &) const {
-    return true;
-  }
-  template <class Conflict_tester>
-  inline void hide_points(Vertex_handle,
-      const Conflict_tester &) {
-    // No points to hide in the Delaunay triangulation.
-  }
-
-};
-
-#ifndef CGAL_CFG_OUTOFLINE_TEMPLATE_MEMBER_DEFINITION_BUG 
-template <class GT, class Tds>
-template <class TriangulationR3>
-struct Periodic_3_Delaunay_triangulation_3<GT,Tds>::Vertex_remover
-{
-  typedef TriangulationR3      Triangulation_R3;
-  
-  typedef typename std::vector<Point>::iterator Hidden_points_iterator;
-  
-  typedef Triple < Vertex_handle, Vertex_handle, Vertex_handle > Vertex_triple;
-  
-  typedef typename Triangulation_R3::Triangulation_data_structure TDSE;
-  typedef typename Triangulation_R3::Cell_handle        CellE_handle;
-  typedef typename Triangulation_R3::Vertex_handle      VertexE_handle;
-  typedef typename Triangulation_R3::Facet              FacetE;
-  typedef typename Triangulation_R3::Finite_cells_iterator Finite_cellsE_iterator;
-    
-  typedef Triple< VertexE_handle, VertexE_handle, VertexE_handle >
-  VertexE_triple;
-  
-  typedef std::map<Vertex_triple,Facet> Vertex_triple_Facet_map;
-  typedef std::map<Vertex_triple, FacetE> Vertex_triple_FacetE_map;
-  typedef typename Vertex_triple_FacetE_map::iterator
-  Vertex_triple_FacetE_map_it;
-  
-  Vertex_remover(const Self *t, Triangulation_R3 &tmp_) : _t(t),tmp(tmp_) {}
-    
-  const Self *_t;
-  Triangulation_R3 &tmp;
-    
-  void add_hidden_points(Cell_handle) {
-    std::copy (hidden_points_begin(), hidden_points_end(), 
-	std::back_inserter(hidden));
-  }
-  
-  Hidden_points_iterator hidden_points_begin() {
-    return hidden.begin();
-  }
-  Hidden_points_iterator hidden_points_end() {
-    return hidden.end();
-  }
-  //private:
-  // The removal of v may un-hide some points,
-  // Space functions output them.
-  std::vector<Point> hidden;
-};
-#endif //CGAL_CFG_OUTOFLINE_TEMPLATE_MEMBER_DEFINITION_BUG
-
-} //namespace CGAL
-
-#endif // CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Periodic_3_Delaunay_triangulation_filtered_traits_3.h b/3rdparty/CGAL-4.8/include/CGAL/Periodic_3_Delaunay_triangulation_filtered_traits_3.h
deleted file mode 100644
index 975db52..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Periodic_3_Delaunay_triangulation_filtered_traits_3.h
+++ /dev/null
@@ -1,161 +0,0 @@
-// Copyright (c) 2004,2006-2009   INRIA Sophia-Antipolis (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
-// 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(s)     : Sylvain Pion <Sylvain.Pion at sophia.inria.fr>
-//                 Nico Kruithof <Nico.Kruithof at sophia.inria.fr>
-//                 Manuel Caroli <Manuel.Caroli at sophia.inria.fr>
-
-
-#ifndef CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_FILTERED_TRAITS_3_H
-#define CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_FILTERED_TRAITS_3_H
-
-#include <string>
-#include <CGAL/basic.h>
-#include <CGAL/config.h>
-#include <CGAL/Interval_nt.h>
-#include <CGAL/Uncertain.h>
-#include <CGAL/Profile_counter.h>
-#include <CGAL/Periodic_3_triangulation_filtered_traits_3.h>
-#include <CGAL/Periodic_3_Delaunay_triangulation_traits_3.h>
-
-namespace CGAL {
-
-// The argument is supposed to be a Filtered_kernel like kernel.
-template < typename K, typename Off >
-class Periodic_3_Delaunay_triangulation_filtered_traits_base_3
-  : public Periodic_3_Delaunay_triangulation_traits_base_3<K, Off>
-{
-  typedef Periodic_3_Delaunay_triangulation_traits_base_3<K, Off> Base;
-
-  // Exact traits is based on the exact kernel.
-  typedef Periodic_3_Delaunay_triangulation_traits_3<typename K::Exact_kernel,
-                                            Off>
-                                                   Exact_traits;
-  // Filtering traits is based on the filtering kernel.
-  typedef Periodic_3_Delaunay_triangulation_traits_3<typename K::Approximate_kernel,
-                                            Off>
-                                                   Filtering_traits;
-private:
-  typedef typename K::C2E C2E;
-  typedef typename K::C2F C2F;
-
-  typedef typename C2E::Target_kernel::Iso_cuboid_3 Exact_iso_cuboid_3;
-  typedef typename C2F::Target_kernel::Iso_cuboid_3 Approximate_iso_cuboid_3;
- 
-public:
-  typedef typename K::Iso_cuboid_3 Iso_cuboid_3;
-
-  void set_domain(const Iso_cuboid_3& domain) {
-    C2E c2e;
-    C2F c2f;
-    this->_domain = domain;
-    this->_domain_e = c2e(this->_domain);
-    this->_domain_f = c2f(this->_domain);
-  }
-
-  typedef Filtered_periodic_predicate<
-            typename Exact_traits::Compare_xyz_3,
-            typename Filtering_traits::Compare_xyz_3,
-            Offset_converter_3<C2E>,
-            Offset_converter_3<C2F> >  Compare_xyz_3;
-
-  typedef Filtered_periodic_predicate<
-            typename Exact_traits::Coplanar_orientation_3,
-            typename Filtering_traits::Coplanar_orientation_3,
-            Offset_converter_3<C2E>,
-            Offset_converter_3<C2F> >  Coplanar_orientation_3;
-
-  typedef Filtered_periodic_predicate<
-            typename Exact_traits::Orientation_3,
-            typename Filtering_traits::Orientation_3,
-            Offset_converter_3<C2E>,
-            Offset_converter_3<C2F> >  Orientation_3;
-
-  typedef Filtered_periodic_predicate<
-            typename Exact_traits::Coplanar_side_of_bounded_circle_3,
-            typename Filtering_traits::Coplanar_side_of_bounded_circle_3,
-            Offset_converter_3<C2E>,
-            Offset_converter_3<C2F> >  Coplanar_side_of_bounded_circle_3;
-
-  typedef Filtered_periodic_predicate<
-            typename Exact_traits::Side_of_oriented_sphere_3,
-            typename Filtering_traits::Side_of_oriented_sphere_3,
-            Offset_converter_3<C2E>,
-            Offset_converter_3<C2F> >  Side_of_oriented_sphere_3;
-
-  typedef Filtered_periodic_predicate<
-            typename Exact_traits::Compare_distance_3,
-            typename Filtering_traits::Compare_distance_3,
-            Offset_converter_3<C2E>,
-            Offset_converter_3<C2F> >  Compare_distance_3;
-
-  typedef Filtered_periodic_predicate<
-            typename Exact_traits::Side_of_bounded_sphere_3,
-            typename Filtering_traits::Side_of_bounded_sphere_3,
-            Offset_converter_3<C2E>,
-            Offset_converter_3<C2F> >  Side_of_bounded_sphere_3;
-
-
-  Compare_xyz_3 compare_xyz_3_object() const
-  { return Compare_xyz_3(&_domain_e,&_domain_f);}
-
-  Coplanar_orientation_3 coplanar_orientation_3_object() const
-  { return Coplanar_orientation_3(&_domain_e,&_domain_f); }
-
-  Orientation_3 orientation_3_object() const
-  { return Orientation_3(&_domain_e,&_domain_f);}
-
-  Coplanar_side_of_bounded_circle_3
-  coplanar_side_of_bounded_circle_3_object() const 
-  { return Coplanar_side_of_bounded_circle_3(&_domain_e,&_domain_f); }
-
-  Side_of_oriented_sphere_3 side_of_oriented_sphere_3_object() const
-  { return Side_of_oriented_sphere_3(&_domain_e,&_domain_f);}
-
-  Compare_distance_3 compare_distance_3_object() const
-  { return Compare_distance_3(&_domain_e,&_domain_f);}
-
-  Side_of_bounded_sphere_3 side_of_bounded_sphere_3_object() const
-  { return Side_of_bounded_sphere_3(&_domain_e,&_domain_f);}
-
-  // The following are inherited since they are constructions :
-  // Construct_segment_3
-  // Construct_triangle_3
-  // Construct_tetrahedron_3
-  // Construct_circumcenter_3
-
- protected:
-  Exact_iso_cuboid_3 _domain_e;
-  Approximate_iso_cuboid_3 _domain_f;
-};
-
-} //namespace CGAL
-
-#include <CGAL/Periodic_3_Delaunay_triangulation_statically_filtered_traits_3.h>
-
-namespace CGAL {
-
-template < typename K, typename Off = typename CGAL::Periodic_3_offset_3 >
-class Periodic_3_Delaunay_triangulation_filtered_traits_3
-  : public Periodic_3_Delaunay_triangulation_statically_filtered_traits_3<
-  Periodic_3_Delaunay_triangulation_filtered_traits_base_3<K, Off> > {
-};
-
-} //namespace CGAL
-
-#endif // CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_FILTERED_TRAITS_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Periodic_3_Delaunay_triangulation_statically_filtered_traits_3.h b/3rdparty/CGAL-4.8/include/CGAL/Periodic_3_Delaunay_triangulation_statically_filtered_traits_3.h
deleted file mode 100644
index dbbae07..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Periodic_3_Delaunay_triangulation_statically_filtered_traits_3.h
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright (c) 2001,2004,2008-2009   INRIA Sophia-Antipolis (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
-// 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(s)     : Sylvain Pion <Sylvain.Pion at sophia.inria.fr>
-//                 Manuel Caroli <Manuel.Caroli at sophia.inria.fr>
- 
-#ifndef CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_STATICALLY_FILTERED_TRAITS_3_H
-#define CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_STATICALLY_FILTERED_TRAITS_3_H
-
-// This class gathers optimized predicates written by hand, using
-// a few steps of filtering.  It should work if the initial traits has
-// cartesian coordinates which fit exactly in doubles.
-//
-// Purely static filters code has been removed, since it requires additional
-// logic and is not plug'n play (requires users providing bounds).
-// If it should be provided again, it should probably be separate.
-
-#include <CGAL/Periodic_3_triangulation_statically_filtered_traits_3.h>
-
-#include <CGAL/internal/Static_filters/Periodic_3_side_of_oriented_sphere_3.h>
-
-// TODO :
-// - add more predicates :
-
-namespace CGAL {
-
-// The K_base argument is supposed to provide exact primitives.
-template < typename Traits >
-class Periodic_3_Delaunay_triangulation_statically_filtered_traits_3 : public Periodic_3_triangulation_statically_filtered_traits_3<Traits>
-{
-  typedef Periodic_3_Delaunay_triangulation_statically_filtered_traits_3<Traits> Self;
-
-public:
-
-  typedef internal::Static_filters_predicates::Periodic_3_side_of_oriented_sphere_3<Traits>
-    Side_of_oriented_sphere_3;
-
-  Side_of_oriented_sphere_3  side_of_oriented_sphere_3_object() const {
-    return Side_of_oriented_sphere_3(&this->_domain,
-                                     &this->_domain_e,
-                                     &this->_domain_f);
-  }
-};
-
-} //namespace CGAL
-
-#endif // CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_STATICALLY_FILTERED_TRAITS_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Periodic_3_Delaunay_triangulation_traits_3.h b/3rdparty/CGAL-4.8/include/CGAL/Periodic_3_Delaunay_triangulation_traits_3.h
deleted file mode 100644
index 6fc2193..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Periodic_3_Delaunay_triangulation_traits_3.h
+++ /dev/null
@@ -1,150 +0,0 @@
-// Copyright (c) 2006-2009   INRIA Sophia-Antipolis (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
-// 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(s)     : Nico Kruithof <Nico.Kruithof at sophia.inria.fr>
-//                 Manuel Caroli <Manuel.Caroli at sophia.inria.fr>
-
-#ifndef CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_TRAITS_3_H
-#define CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_TRAITS_3_H
-
-#include <CGAL/basic.h>
-#include <CGAL/Periodic_3_offset_3.h>
-#include <CGAL/Traits_with_offsets_adaptor.h>
-#include <CGAL/Periodic_3_construct_point_3.h>
-#include <CGAL/triangulation_assertions.h>
-#include <CGAL/Periodic_3_triangulation_traits_3.h>
-
-
-namespace CGAL { 
-
-template < class Kernel, class Off = typename CGAL::Periodic_3_offset_3 >
-class Periodic_3_Delaunay_triangulation_traits_base_3
-  : public Periodic_3_triangulation_traits_base_3<Kernel, Off>
-{
-public:
-  typedef Kernel                                                 K;
-  typedef Off                                                    Offset;
-  typedef Periodic_3_triangulation_traits_base_3<K, Offset>               Base;
-  typedef Periodic_3_Delaunay_triangulation_traits_base_3< K, Offset >    Self;
-
-  typedef typename Base::RT                   RT;
-  typedef typename Base::FT                   FT;
-  typedef typename Base::Point_3              Point_3;
-  typedef typename Base::Vector_3             Vector_3;
-  typedef typename Base::Periodic_3_offset_3  Periodic_3_offset_3;
-  typedef typename Base::Iso_cuboid_3         Iso_cuboid_3;
-
-  // The next typedef is there for backward compatibility
-  // Some users take their point type from the traits class.
-  // Before this type was Point
-  typedef Point_3 Point;
-
-  typedef typename Base::Segment_3         Segment_3;
-  typedef typename Base::Triangle_3        Triangle_3;
-  typedef typename Base::Tetrahedron_3     Tetrahedron_3;
-
-  // Delaunay specific predicates
-  typedef Traits_with_offsets_adaptor<Self,
-				      typename K::Side_of_oriented_sphere_3>
-      Side_of_oriented_sphere_3;
-  typedef Traits_with_offsets_adaptor<Self, typename K::Compare_distance_3>
-      Compare_distance_3;
-   typedef Traits_with_offsets_adaptor<Self,
- 				      typename K::Side_of_bounded_sphere_3>
-       Side_of_bounded_sphere_3;
-
-  // Degenerate dimension predicates
-  typedef Traits_with_offsets_adaptor<Self, typename K::Coplanar_orientation_3>
-      Coplanar_orientation_3;
-  typedef Traits_with_offsets_adaptor<Self,
-              typename K::Coplanar_side_of_bounded_circle_3>
-      Coplanar_side_of_bounded_circle_3;
-
-  // Delaunay specific constructions
-  typedef Traits_with_offsets_adaptor<Self,
-				      typename K::Construct_circumcenter_3>
-      Construct_circumcenter_3;
-
-  // Operations
-  Side_of_oriented_sphere_3
-  side_of_oriented_sphere_3_object() const {
-    return Side_of_oriented_sphere_3(&this->_domain);
-  }
-  Compare_distance_3
-  compare_distance_3_object() const {
-    return Compare_distance_3(&this->_domain);
-  }
-  Side_of_bounded_sphere_3
-  side_of_bounded_sphere_3_object() const {
-    return Side_of_bounded_sphere_3(&this->_domain);
-  }
-  Coplanar_orientation_3
-  coplanar_orientation_3_object() const {
-    return Coplanar_orientation_3(&this->_domain);
-  }
-  Coplanar_side_of_bounded_circle_3
-  coplanar_side_of_bounded_circle_3_object() const {
-    return Coplanar_side_of_bounded_circle_3(&this->_domain);
-  }
-  Construct_circumcenter_3
-  construct_circumcenter_3_object() const {
-    return Construct_circumcenter_3(&this->_domain);
-  }
-};
-
-template < typename K, typename Off = CGAL::Periodic_3_offset_3 >
-class Periodic_3_Delaunay_triangulation_traits_3;
-
-} //namespace CGAL
-
-// Partial specialization for Filtered_kernel<CK>.
-#include <CGAL/Filtered_kernel.h>
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-#include <CGAL/Periodic_3_Delaunay_triangulation_filtered_traits_3.h>
-
-namespace CGAL {
-
-// This declaration is needed to break the cyclic dependency.
-template < typename K, typename Off >
-class Periodic_3_Delaunay_triangulation_filtered_traits_3;
-
-template < class K, class Off>
-class Periodic_3_Delaunay_triangulation_traits_3
-  : public Periodic_3_Delaunay_triangulation_traits_base_3<K, Off>
-{
-};
-
-template < typename CK, typename Off >
-class Periodic_3_Delaunay_triangulation_traits_3 < Filtered_kernel<CK>, Off>
-  : public Periodic_3_Delaunay_triangulation_filtered_traits_3 <
-  Filtered_kernel<CK>, Off >
-{
-public:
-  typedef Filtered_kernel<CK>  Kernel;
-};
-
-template < class Off >
-class Periodic_3_Delaunay_triangulation_traits_3<CGAL::Epick, Off>
-  : public Periodic_3_Delaunay_triangulation_filtered_traits_3<CGAL::Epick, Off>
-{
-  typedef CGAL::Epick Kernel;
-};
-
-} //namespace CGAL
-
-#endif // CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_TRAITS_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Periodic_3_triangulation_3.h b/3rdparty/CGAL-4.8/include/CGAL/Periodic_3_triangulation_3.h
deleted file mode 100644
index 3bebc4d..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Periodic_3_triangulation_3.h
+++ /dev/null
@@ -1,4141 +0,0 @@
-// Copyright (c) 1999-2003,2006-2009   INRIA Sophia-Antipolis (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
-// 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(s)     : Monique Teillaud <Monique.Teillaud at sophia.inria.fr>
-//                 Sylvain Pion <Sylvain.Pion at sophia.inria.fr>
-//                 Nico Kruithof <Nico.Kruithof at sophia.inria.fr>
-//                 Manuel Caroli <Manuel.Caroli at sophia.inria.fr>
-
-#ifndef CGAL_PERIODIC_3_TRIANGULATION_3_H
-#define CGAL_PERIODIC_3_TRIANGULATION_3_H
-
-#include <CGAL/basic.h>
-
-#include <iostream>
-#include <algorithm>
-#include <cmath>
-#include <functional>
-#include <list>
-
-#include <boost/tuple/tuple.hpp>
-#include <boost/random/linear_congruential.hpp>
-#include <boost/random/uniform_smallint.hpp>
-#include <boost/random/variate_generator.hpp>
-
-#include <CGAL/triangulation_assertions.h>
-#include <CGAL/use.h>
-
-#include <CGAL/Triangulation_data_structure_3.h>
-#include <CGAL/Periodic_3_triangulation_ds_cell_base_3.h>
-#include <CGAL/Periodic_3_triangulation_ds_vertex_base_3.h>
-#include <CGAL/Triangulation_cell_base_3.h>
-#include <CGAL/Triangulation_vertex_base_3.h>
-
-#include <CGAL/Periodic_3_triangulation_iterators_3.h>
-
-#include <CGAL/Unique_hash_map.h>
-
-#include <CGAL/internal/Exact_type_selector.h>
-#include <CGAL/NT_converter.h>
-
-#ifndef CGAL_NO_STRUCTURAL_FILTERING
-#include <CGAL/Triangulation_structural_filtering_traits.h>
-#include <CGAL/determinant.h>
-#endif // no CGAL_NO_STRUCTURAL_FILTERING
-
-namespace CGAL {
-
-template < class GT, class TDS > class Periodic_3_triangulation_3;
-
-template < class GT, class TDS > std::istream& operator>> 
-    (std::istream& is, Periodic_3_triangulation_3<GT,TDS> &tr);
-template < class GT, class TDS > std::ostream& operator<< 
-    (std::ostream& os, const Periodic_3_triangulation_3<GT,TDS> &tr);
-
-#ifndef CGAL_NO_STRUCTURAL_FILTERING
-namespace internal {
-// structural filtering is performed only for EPIC
-struct Periodic_structural_filtering_3_tag {};
-struct No_periodic_structural_filtering_3_tag {};
-
-template <bool filter>
-struct Periodic_structural_filtering_selector_3 {
-#ifdef FORCE_STRUCTURAL_FILTERING
-  typedef Periodic_structural_filtering_3_tag  Tag;
-#else
-  typedef No_periodic_structural_filtering_3_tag  Tag;
-#endif
-};
-
-template <>
-struct Periodic_structural_filtering_selector_3<true> {
-  typedef Periodic_structural_filtering_3_tag  Tag;
-};
-}
-#endif // no CGAL_NO_STRUCTURAL_FILTERING
-
-/**\class Periodic_3_triangulation_3
- * 
- * \brief Implements functionality for computing in periodic space.
- *
- * There are several things that are special to computing in $\mathbb{T}^3$
- * such as
- * - periodicity --> offsets
- * - no infinite vertex
- * - no degenerate dimensions
- * All functions that are affected can be found in this class. In case it is
- * necessary to provide different implementations for Delaunay and regular
- * triangulation, we work with visitors. 
- */
-
-template < class GT,
-            class TDS = Triangulation_data_structure_3 <
-	      Triangulation_vertex_base_3<
-		GT, Periodic_3_triangulation_ds_vertex_base_3<>
-		>,
-              Triangulation_cell_base_3<
-                GT, Periodic_3_triangulation_ds_cell_base_3<>
-              >
-            >
-          >
-class Periodic_3_triangulation_3 
-  : public Triangulation_utils_3
-{
-  friend std::istream& operator>> <>
-  (std::istream& is, Periodic_3_triangulation_3<GT, TDS> &tr);
-
-  typedef Periodic_3_triangulation_3<GT,TDS>   Self;
-
-public:
-  typedef GT                                   Geometric_traits;
-  typedef TDS                                  Triangulation_data_structure;
-
-  typedef typename GT::Periodic_3_offset_3     Offset;
-  typedef typename GT::Iso_cuboid_3            Iso_cuboid;
-  typedef array<int, 3>                        Covering_sheets;
-  
-  typedef typename GT::Point_3                 Point;
-  typedef typename GT::Segment_3               Segment;
-  typedef typename GT::Triangle_3              Triangle;
-  typedef typename GT::Tetrahedron_3           Tetrahedron;
-
-  typedef std::pair<Point,Offset>              Periodic_point;
-  typedef array< std::pair<Point,Offset>, 2>   Periodic_segment;
-  typedef array< std::pair<Point,Offset>, 3>   Periodic_triangle;
-  typedef array< std::pair<Point,Offset>, 4>   Periodic_tetrahedron;
-
-  typedef typename TDS::Vertex                 Vertex;
-  typedef typename TDS::Cell                   Cell;
-  typedef typename TDS::Facet                  Facet;
-  typedef typename TDS::Edge                   Edge;
-
-  typedef typename TDS::Vertex_handle          Vertex_handle;
-  typedef typename TDS::Cell_handle            Cell_handle;
-  
-  typedef typename TDS::size_type              size_type;
-  typedef typename TDS::difference_type        difference_type;
-
-  typedef typename TDS::Cell_iterator          Cell_iterator;
-  typedef typename TDS::Facet_iterator         Facet_iterator;
-  typedef typename TDS::Edge_iterator          Edge_iterator;
-  typedef typename TDS::Vertex_iterator        Vertex_iterator;
-
-  typedef typename TDS::Cell_circulator        Cell_circulator;
-  typedef typename TDS::Facet_circulator       Facet_circulator;
-
-  typedef Cell_iterator                        All_cells_iterator;
-  typedef Facet_iterator                       All_facets_iterator;
-  typedef Edge_iterator                        All_edges_iterator;
-  typedef Vertex_iterator                      All_vertices_iterator;
-  typedef Periodic_3_triangulation_unique_vertex_iterator_3<Self>
-                                               Unique_vertex_iterator;
-
-private:
-  typedef typename GT::FT                      FT;
-  typedef std::pair< Vertex_handle, Offset >   Virtual_vertex;
-  typedef std::map<Vertex_handle, Virtual_vertex>
-                                               Virtual_vertex_map;
-  typedef typename Virtual_vertex_map::const_iterator
-                                               Virtual_vertex_map_it;
-  typedef std::map<Vertex_handle, std::vector<Vertex_handle > >
-                                               Virtual_vertex_reverse_map;
-  typedef typename Virtual_vertex_reverse_map::const_iterator
-                                               Virtual_vertex_reverse_map_it;
-  typedef Triple< Vertex_handle, Vertex_handle, Vertex_handle >
-                                               Vertex_triple;
-
-public:
-  typedef Periodic_3_triangulation_tetrahedron_iterator_3<Self>
-                                               Periodic_tetrahedron_iterator;
-  typedef Periodic_3_triangulation_triangle_iterator_3<Self>
-                                               Periodic_triangle_iterator;
-  typedef Periodic_3_triangulation_segment_iterator_3<Self>
-                                               Periodic_segment_iterator;
-  typedef Periodic_3_triangulation_point_iterator_3<Self>
-                                               Periodic_point_iterator;
-
-  typedef Point                                value_type;
-  typedef const value_type&                    const_reference;
-
-  typedef Tag_false Weighted_tag;
-
-public:
-  enum Iterator_type {
-    STORED=0,
-    UNIQUE, //1
-    STORED_COVER_DOMAIN, //2
-    UNIQUE_COVER_DOMAIN };//3
-
-  enum Locate_type {
-    VERTEX=0, 
-    EDGE, //1
-    FACET, //2
-    CELL, //3
-    EMPTY , //4
-    OUTSIDE_CONVEX_HULL, // unused, for compatibility with Alpha_shape_3
-    OUTSIDE_AFFINE_HULL }; // unused, for compatibility with Alpha_shape_3
-
-private:
-  Geometric_traits  _gt;
-  Triangulation_data_structure _tds; 
-  Iso_cuboid _domain;
-  /// This threshold should be chosen such that if all edges are shorter,
-  /// we can be sure that there are no self-edges anymore.
-  FT edge_length_threshold;
-  
-  /// This adjacency list stores all edges that are longer than
-  /// edge_length_threshold.
-  std::map< Vertex_handle, std::list<Vertex_handle> > too_long_edges;
-  unsigned int too_long_edge_counter;
-  
-  /// map of offsets for periodic copies of vertices
-  Virtual_vertex_map virtual_vertices;
-  Virtual_vertex_reverse_map  virtual_vertices_reverse;
-
-protected:
-  /// v_offsets temporarily stores all the vertices on the border of a
-  /// conflict region.
-  mutable std::vector<Vertex_handle> v_offsets;
-
-private:
-  /// Determines if we currently compute in 3-cover or 1-cover.
-  Covering_sheets _cover;
-
-public:
-  /** @name Creation */ //@{
-  Periodic_3_triangulation_3(
-      const Iso_cuboid & domain = Iso_cuboid(0,0,0,1,1,1),
-      const Geometric_traits & gt = Geometric_traits())
-    : _gt(gt), _tds(), _domain(domain), too_long_edge_counter(0) {
-    _gt.set_domain(_domain);
-    typedef typename internal::Exact_field_selector<FT>::Type EFT;
-    typedef NT_converter<FT,EFT> NTC;
-    CGAL_USE_TYPE(NTC);
-    CGAL_triangulation_assertion_code( NTC ntc; )
-    CGAL_triangulation_precondition(ntc(_domain.xmax())-ntc(_domain.xmin())
-	== ntc(_domain.ymax())-ntc(_domain.ymin()));
-    CGAL_triangulation_precondition(ntc(_domain.ymax())-ntc(_domain.ymin())
-	== ntc(_domain.zmax())-ntc(_domain.zmin()));
-    CGAL_triangulation_precondition(ntc(_domain.zmax())-ntc(_domain.zmin())
-	== ntc(_domain.xmax())-ntc(_domain.xmin()));
-    _cover = make_array(3,3,3);
-    init_tds();
-    edge_length_threshold = FT(0.166) * (_domain.xmax()-_domain.xmin())
-                                      * (_domain.xmax()-_domain.xmin());
-  }
-
-private:
-  // Copy constructor helpers
-  class Finder;
-  void copy_multiple_covering(const Periodic_3_triangulation_3 & tr);
-public:
-  // Copy constructor duplicates vertices and cells
-  Periodic_3_triangulation_3(const Periodic_3_triangulation_3 & tr)
-    : _gt(tr.geom_traits()),
-      _domain(tr._domain),
-      edge_length_threshold(tr.edge_length_threshold),
-      _cover(tr._cover) {
-    if (is_1_cover()) {
-      _tds = tr.tds();
-    } else {
-      copy_multiple_covering(tr);
-    }
-    CGAL_triangulation_expensive_postcondition(*this == tr);
-  }
-  
-  /** @name Assignment */ //@{
-  Periodic_3_triangulation_3 & operator=(Periodic_3_triangulation_3 tr) {
-    swap(tr);
-    return *this;
-  }
-  
-  void swap(Periodic_3_triangulation_3 &tr) {
-    std::swap(tr._gt, _gt);
-    _tds.swap(tr._tds);
-    std::swap(_domain,tr._domain);
-    std::swap(edge_length_threshold,tr.edge_length_threshold);
-    std::swap(too_long_edges,tr.too_long_edges);
-    std::swap(too_long_edge_counter,tr.too_long_edge_counter);
-    std::swap(virtual_vertices,tr.virtual_vertices);
-    std::swap(virtual_vertices_reverse,tr.virtual_vertices_reverse);
-    std::swap(_cover, tr._cover);
-  }
-
-  /// Clears the triangulation and initializes it again.
-  void clear() {
-    _tds.clear();
-    init_tds();
-    too_long_edges.clear();
-    too_long_edge_counter = 0;
-    virtual_vertices.clear();
-    virtual_vertices_reverse.clear();
-    _cover = make_array(3,3,3);
-    v_offsets.clear();
-  }
-  //@}
-
-private:
-  /// Initializes the triangulation data structure
-  void init_tds() {
-    _tds.set_dimension(-2);
-    v_offsets.reserve(48);
-  }
-
-public:
-  /** @name Access functions */ //@{
-  const Geometric_traits& geom_traits() const { return _gt; }
-  const TDS & tds() const { return _tds; }
-  TDS & tds() { return _tds; }
-
-  const Iso_cuboid & domain() const { return _domain; }
-  // TODO: Documentation and tests
-  void set_domain(const Iso_cuboid & domain) {
-    clear();
-    _domain = domain;
-    _gt.set_domain(domain);
-    edge_length_threshold = FT(0.166) * (_domain.xmax()-_domain.xmin())
-                                      * (_domain.xmax()-_domain.xmin());
-  }
-
-  const Covering_sheets & number_of_sheets() const { return _cover; }
-  const std::pair<Vertex_handle, Offset> original_vertex(
-      const Vertex_handle v) const {
-    return (virtual_vertices.find(v) == virtual_vertices.end()) ?
-      std::make_pair(v,Offset()) : virtual_vertices.find(v)->second;
-  }
-  const std::vector<Vertex_handle>& periodic_copies(
-      const Vertex_handle v) const {
-    CGAL_triangulation_precondition(number_of_sheets() != make_array(1,1,1) );
-    CGAL_triangulation_precondition(
-	virtual_vertices.find(v) == virtual_vertices.end());
-    CGAL_triangulation_assertion(
-	virtual_vertices_reverse.find(v) != virtual_vertices_reverse.end());
-    return virtual_vertices_reverse.find(v)->second;
-  }
-
-  bool is_extensible_triangulation_in_1_sheet_h1() const;
-  bool is_extensible_triangulation_in_1_sheet_h2() const;
-  bool is_triangulation_in_1_sheet() const;
-
-  void convert_to_1_sheeted_covering();
-  void convert_to_27_sheeted_covering();
-
-  size_type number_of_cells() const {
-    if (is_1_cover()) return _tds.number_of_cells();
-    else return _tds.number_of_cells()/27;
-  }
-  size_type number_of_facets() const {
-    if (is_1_cover()) return _tds.number_of_facets();
-    else return _tds.number_of_facets()/27;
-  }
-  size_type number_of_edges() const {
-    if (is_1_cover()) return _tds.number_of_edges();
-    else return _tds.number_of_edges()/27;
-  }
-  size_type number_of_vertices() const {
-    if (is_1_cover()) return _tds.number_of_vertices();
-    else return _tds.number_of_vertices()/27;
-  }
-
-  size_type number_of_stored_cells() const {
-    return _tds.number_of_cells();
-  }
-  size_type number_of_stored_facets() const {
-    return _tds.number_of_facets();
-  }
-  size_type number_of_stored_edges() const {
-    return _tds.number_of_edges();
-  }
-  size_type number_of_stored_vertices() const {
-    return _tds.number_of_vertices();
-  }
-
-protected:
-  bool is_1_cover() const {
-    bool flag;
-    flag = ((_cover[0] == 1) && (_cover[1] == 1) && (_cover[2] == 1));
-    return flag;
-  }
-
-public:
-  bool is_virtual(Vertex_handle v) {
-    if (is_1_cover()) return false;
-    return (virtual_vertices.find(v) != virtual_vertices.end());
-  }
-
-public:
-  // Offset converters
-  int off_to_int(const Offset & off) const {
-    CGAL_triangulation_assertion( off.x()==0 || off.x() ==1 );
-    CGAL_triangulation_assertion( off.y()==0 || off.y() ==1 );
-    CGAL_triangulation_assertion( off.z()==0 || off.z() ==1 );
-    int i = ((off.x()&1)<<2) + ((off.y()&1)<<1) + ((off.z()&1));
-    return i;
-  }
-  Offset int_to_off(int i) const {
-    return Offset((i>>2)&1,(i>>1)&1,i&1);
-  }
-
-
-  void set_offsets(Cell_handle c, int o0,int o1,int o2,int o3) {
-    int off0[3] = {(o0>>2)&1,(o0>>1)&1,(o0&1)};
-    int off1[3] = {(o1>>2)&1,(o1>>1)&1,(o1&1)};
-    int off2[3] = {(o2>>2)&1,(o2>>1)&1,(o2&1)};
-    int off3[3] = {(o3>>2)&1,(o3>>1)&1,(o3&1)};
-    for (int i=0; i<3; i++) {
-      int min_off = (std::min)((std::min)(off0[i],off1[i]),
-			       (std::min)(off2[i],off3[i]));
-      if (min_off != 0) {
-	off0[i] -= min_off; off1[i] -= min_off;
-	off2[i] -= min_off; off3[i] -= min_off;
-      }
-    }
-    o0 = ((off0[0]&1)<<2)+((off0[1]&1)<<1)+(off0[2]&1);
-    o1 = ((off1[0]&1)<<2)+((off1[1]&1)<<1)+(off1[2]&1);
-    o2 = ((off2[0]&1)<<2)+((off2[1]&1)<<1)+(off2[2]&1);
-    o3 = ((off3[0]&1)<<2)+((off3[1]&1)<<1)+(off3[2]&1);
-    c->set_offsets(o0,o1,o2,o3);
-  }
- 
-  template <class Offset> 
-  void set_offsets(Cell_handle c, Offset o0,Offset o1,Offset o2,Offset o3) {
-    int off0[3] = {o0.x(),o0.y(),o0.z()};
-    int off1[3] = {o1.x(),o1.y(),o1.z()};
-    int off2[3] = {o2.x(),o2.y(),o2.z()};
-    int off3[3] = {o3.x(),o3.y(),o3.z()};
-    for (int i=0; i<3; i++) {
-      int min_off = (std::min)((std::min)(off0[i],off1[i]),
-			       (std::min)(off2[i],off3[i]));
-      if (min_off != 0) {
-	off0[i] -= min_off; off1[i] -= min_off;
-	off2[i] -= min_off; off3[i] -= min_off;
-      }
-    }
-
-    CGAL_triangulation_assertion((std::min)((std::min)(off0[0],off1[0]),
-			      (std::min)(off2[0],off3[0])) == 0);
-    CGAL_triangulation_assertion((std::min)((std::min)(off0[1],off1[1]),
-			      (std::min)(off2[1],off3[1])) == 0);
-    CGAL_triangulation_assertion((std::min)((std::min)(off0[2],off1[2]),
-			      (std::min)(off2[2],off3[2])) == 0);
-    CGAL_triangulation_assertion((0 <= off0[0]) && (off0[0] < 2));
-    CGAL_triangulation_assertion((0 <= off1[0]) && (off1[0] < 2));
-    CGAL_triangulation_assertion((0 <= off2[0]) && (off2[0] < 2));
-    CGAL_triangulation_assertion((0 <= off3[0]) && (off3[0] < 2));
-    CGAL_triangulation_assertion((0 <= off0[1]) && (off0[1] < 2));
-    CGAL_triangulation_assertion((0 <= off1[1]) && (off1[1] < 2));
-    CGAL_triangulation_assertion((0 <= off2[1]) && (off2[1] < 2));
-    CGAL_triangulation_assertion((0 <= off3[1]) && (off3[1] < 2));
-    CGAL_triangulation_assertion((0 <= off0[2]) && (off0[2] < 2));
-    CGAL_triangulation_assertion((0 <= off1[2]) && (off1[2] < 2));
-    CGAL_triangulation_assertion((0 <= off2[2]) && (off2[2] < 2));
-    CGAL_triangulation_assertion((0 <= off3[2]) && (off3[2] < 2));
-
-    int o0i = ((off0[0]&1)<<2)+((off0[1]&1)<<1)+(off0[2]&1);
-    int o1i = ((off1[0]&1)<<2)+((off1[1]&1)<<1)+(off1[2]&1);
-    int o2i = ((off2[0]&1)<<2)+((off2[1]&1)<<1)+(off2[2]&1);
-    int o3i = ((off3[0]&1)<<2)+((off3[1]&1)<<1)+(off3[2]&1);
-    c->set_offsets(o0i,o1i,o2i,o3i);
-  }
-
-public:
-  /** @name Wrapping the traits */ //@{
-  Comparison_result compare_xyz(const Point &p1, const Point &p2) const {
-    return geom_traits().compare_xyz_3_object()(p1,p2);
-  }
-  Comparison_result compare_xyz(const Point &p1, const Point&p2,
-      const Offset &o1, const Offset &o2) const {
-    return geom_traits().compare_xyz_3_object()(p1,p2,o1,o2);
-  }
-
-  Orientation orientation(
-      const Point &p1, const Point &p2, const Point &p3, const Point &p4)
-      const {
-    return geom_traits().orientation_3_object()(p1,p2,p3,p4);
-  }
-  Orientation orientation(
-      const Point &p1, const Point &p2, const Point &p3, const Point &p4,
-      const Offset &o1, const Offset &o2, const Offset &o3, const Offset &o4)
-      const {
-    return geom_traits().orientation_3_object()(p1,p2,p3,p4,o1,o2,o3,o4);
-  }
-
-  bool equal(const Point &p1, const Point &p2) const {
-    return compare_xyz(p1,p2) == EQUAL;
-  }
-  bool equal(const Point &p1, const Point &p2,
-      const Offset &o1, const Offset &o2) const {
-    return compare_xyz(p1,p2,o1,o2) == EQUAL;
-  }
-
-  bool coplanar(
-      const Point &p1, const Point &p2, const Point &p3, const Point &p4)
-      const {
-    return orientation(p1,p2,p3,p4) == COPLANAR;
-  }
-  bool coplanar(
-      const Point &p1, const Point &p2, const Point &p3, const Point &p4,
-      const Offset &o1, const Offset &o2, const Offset &o3, const Offset &o4)
-      const {
-    return orientation(p1,p2,p3,p4,o1,o2,o3,o4) == COPLANAR;
-  }
-
-  Periodic_tetrahedron construct_periodic_3_tetrahedron(
-      const Point &p1, const Point &p2, const Point &p3, const Point &p4)
-      const {
-    return make_array(std::make_pair(p1,Offset()), std::make_pair(p2,Offset()),
-	std::make_pair(p3,Offset()), std::make_pair(p4,Offset()));
-  }
-  Periodic_tetrahedron construct_periodic_3_tetrahedron(
-      const Point &p1, const Point &p2, const Point &p3, const Point &p4,
-      const Offset &o1, const Offset &o2, const Offset &o3, const Offset &o4)
-      const {
-    return make_array(std::make_pair(p1,o1), std::make_pair(p2,o2),
-	std::make_pair(p3,o3), std::make_pair(p4,o4));
-  }
-
-  Periodic_triangle construct_periodic_3_triangle(
-      const Point &p1, const Point &p2, const Point &p3) const {
-    return make_array(std::make_pair(p1,Offset()),
-	std::make_pair(p2,Offset()), std::make_pair(p3,Offset()));
-  }
-  Periodic_triangle construct_periodic_3_triangle(
-      const Point &p1, const Point &p2, const Point &p3,
-      const Offset &o1, const Offset &o2, const Offset &o3) const {
-    return make_array(std::make_pair(p1,o1), std::make_pair(p2,o2),
-	std::make_pair(p3,o3));
-  }
-
-  Periodic_segment construct_periodic_3_segment(
-      const Point &p1, const Point &p2) const {
-    return make_array(std::make_pair(p1,Offset()), std::make_pair(p2,Offset()));
-  }
-  Periodic_segment construct_periodic_3_segment(
-      const Point &p1, const Point &p2,
-      const Offset &o1, const Offset &o2) const {
-    return make_array(std::make_pair(p1,o1), std::make_pair(p2,o2));
-  }
-
-  Tetrahedron construct_tetrahedron(
-      const Point &p1, const Point &p2, const Point &p3, const Point &p4)
-      const {
-    return geom_traits().construct_tetrahedron_3_object()(p1,p2,p3,p4);
-  }
-  Tetrahedron construct_tetrahedron(
-      const Point &p1, const Point &p2, const Point &p3, const Point &p4,
-      const Offset &o1, const Offset &o2, const Offset &o3, const Offset &o4)
-      const {
-    return geom_traits().construct_tetrahedron_3_object()(p1,p2,p3,p4,
-	o1,o2,o3,o4);
-  }
-  Tetrahedron construct_tetrahedron(const Periodic_tetrahedron& tet) {
-    return construct_tetrahedron(
-	tet[0].first, tet[1].first, tet[2].first, tet[3].first,
-	tet[0].second, tet[1].second, tet[2].second, tet[3].second);
-  }
-
-  Triangle construct_triangle(
-      const Point &p1, const Point &p2, const Point &p3) const {
-    return geom_traits().construct_triangle_3_object()(p1,p2,p3);
-  }
-  Triangle construct_triangle(
-      const Point &p1, const Point &p2, const Point &p3,
-      const Offset &o1, const Offset &o2, const Offset &o3) const {
-    return geom_traits().construct_triangle_3_object()(p1,p2,p3,o1,o2,o3);
-  }
-  Triangle construct_triangle(const Periodic_triangle& tri) {
-    return construct_triangle(tri[0].first, tri[1].first, tri[2].first,
-       tri[0].second, tri[1].second, tri[2].second);
-  }
-
-  Segment construct_segment(const Point &p1, const Point &p2) const {
-    return geom_traits().construct_segment_3_object()(p1, p2);
-  }
-  Segment construct_segment(const Point &p1, const Point &p2,
-    const Offset &o1, const Offset &o2) const {
-    return geom_traits().construct_segment_3_object()(p1,p2,o1,o2);
-  }
-  Segment construct_segment(const Periodic_segment& seg) const {
-    return construct_segment(seg[0].first, seg[1].first,
-	seg[0].second, seg[1].second);
-  }
-
-  Point construct_point(const Point& p, const Offset &o) const {
-    return geom_traits().construct_point_3_object()(p,o);
-  }
-  Point construct_point(const Periodic_point& pp) const {
-    return construct_point(pp.first, pp.second);
-  }
-  //@}
-
-public:
-  /** @name Geometric access functions */ //@{
-  Periodic_point periodic_point( const Vertex_handle v ) const {
-    if (is_1_cover()) return std::make_pair(v->point(), Offset(0,0,0));
-    Virtual_vertex_map_it it = virtual_vertices.find(v);
-    if (it == virtual_vertices.end()) {
-      // if v is not contained in virtual_vertices, then it is in the
-      // original domain.
-      return std::make_pair(v->point(), Offset(0,0,0));
-    } else {
-      // otherwise it has to be looked up as well as its offset.
-      return std::make_pair(it->second.first->point(), it->second.second);
-    }
-  }
-  Periodic_point periodic_point( const Cell_handle c, int i) const {
-    if (is_1_cover()) return std::make_pair(c->vertex(i)->point(),
-					    int_to_off(c->offset(i)));
-    Virtual_vertex_map_it it = virtual_vertices.find(c->vertex(i));
-    if (it == virtual_vertices.end()) {
-      // if c->vertex(i) is not contained in virtual_vertices, then it
-      // is in the original domain.
-      return std::make_pair(c->vertex(i)->point(), 
-	  combine_offsets(Offset(),int_to_off(c->offset(i))) );
-    } else {
-      // otherwise it has to be looked up as well as its offset.
-      return std::make_pair(it->second.first->point(),
-	  combine_offsets(it->second.second, int_to_off(c->offset(i))) );
-    }
-  }
-
-  Periodic_segment periodic_segment(const Cell_handle c, int i, int j) const {
-    CGAL_triangulation_precondition( i != j );
-    CGAL_triangulation_precondition( number_of_vertices() != 0 );
-    CGAL_triangulation_precondition( i >= 0 && i <= 3 
-        && j >= 0 && j <= 3 );
-    return make_array( std::make_pair(c->vertex(i)->point(),
-				      get_offset(c,i)),
-		       std::make_pair(c->vertex(j)->point(),
-				      get_offset(c,j)) );
-  }
-  Periodic_segment periodic_segment(const Edge & e) const {
-    return periodic_segment(e.first,e.second,e.third);
-  }
-
-  Periodic_triangle periodic_triangle(const Cell_handle c, int i) const;
-  Periodic_triangle periodic_triangle(const Facet & f) const {
-    return periodic_triangle(f.first, f.second);
-  }
-
-  Periodic_tetrahedron periodic_tetrahedron(const Cell_handle c) const {
-    CGAL_triangulation_precondition( number_of_vertices() != 0 );
-    return make_array(
-        std::make_pair(c->vertex(0)->point(), get_offset(c,0)),
-	std::make_pair(c->vertex(1)->point(), get_offset(c,1)),
-        std::make_pair(c->vertex(2)->point(), get_offset(c,2)),
-	std::make_pair(c->vertex(3)->point(), get_offset(c,3)) );
-  }
-
-  Point point(const Periodic_point & pp) const {
-    return construct_point(pp.first, pp.second);
-  }
-  Segment segment(const Periodic_segment & ps) const {
-    return construct_segment(ps[0].first,ps[1].first,ps[0].second,ps[1].second);
-  }
-  Triangle triangle(const Periodic_triangle & pt) const {
-    return construct_triangle(pt[0].first, pt[1].first, pt[2].first,
-			      pt[0].second,pt[1].second,pt[2].second);
-  }
-  Tetrahedron tetrahedron(const Periodic_tetrahedron & pt) const {
-    return construct_tetrahedron(pt[0].first, pt[1].first,
-				 pt[2].first, pt[3].first,
-				 pt[0].second,pt[1].second,
-				 pt[2].second,pt[3].second);
-  }
-  // @}
-
-  /** @name Queries */ //@{
-  bool is_vertex(const Point & p, Vertex_handle & v) const;
-
-  bool is_vertex(Vertex_handle v) const {
-    return _tds.is_vertex(v);
-  }
-  bool is_edge(Vertex_handle u, Vertex_handle v,
-      Cell_handle & c, int & i, int & j) const {
-    return _tds.is_edge(u, v, c, i, j);
-  }
-  bool is_edge(Vertex_handle u, const Offset & off_u,
-	       Vertex_handle v, const Offset & off_v,
-      Cell_handle & c, int & i, int & j) const {
-    if (!_tds.is_edge(u,v,c,i,j)) return false;
-    if ((get_offset(c,i) == off_u) && (get_offset(c,j) == off_v))
-      return true;
-    // it might be that different cells containing (u,v) yield
-    // different offsets, which forces us to test for all possibilities.
-    else {
-      Cell_circulator ccirc = incident_cells(c,i,j,c);
-      while (++ccirc != c) {
-	i = ccirc->index(u);
-	j = ccirc->index(v);
-	if ((get_offset(ccirc,i) == off_u) && (get_offset(ccirc,j) == off_v)) {
-	  c = ccirc;
-	  return true;
-	}
-      }
-      return false;
-    }
-  }
-  bool is_facet(Vertex_handle u, Vertex_handle v, Vertex_handle w,
-      Cell_handle & c, int & i, int & j, int & k) const {
-    return _tds.is_facet(u, v, w, c, i, j, k);
-  }
-  bool is_facet(Vertex_handle u, const Offset & off_u,
-		Vertex_handle v, const Offset & off_v,
-		Vertex_handle w, const Offset & off_w,
-      Cell_handle & c, int & i, int & j, int & k) const {
-    if (!_tds.is_facet(u,v,w,c,i,j,k)) return false;
-    if ((get_offset(c,i) == off_u)
-	&& (get_offset(c,j) == off_v)
-	&& (get_offset(c,k) == off_w) )
-      return true;
-    // it might be that c and c->neighbor(l) yield different offsets
-    // which forces us to test for both possibilities.
-    else {
-      int l = 6-i-j-k;
-      c = c->neighbor(l);
-      i = c->index(u);
-      j = c->index(v);
-      k = c->index(w);      
-      return ((get_offset(c,i) == off_u)
-	  && (get_offset(c,j) == off_v)
-	  && (get_offset(c,k) == off_w) );
-    }
-  }
-  bool is_cell(Cell_handle c) const {
-    return _tds.is_cell(c);
-  }
-  bool is_cell(Vertex_handle u, Vertex_handle v,
-      Vertex_handle w, Vertex_handle t,
-      Cell_handle & c, int & i, int & j, int & k, int & l) const {
-    return _tds.is_cell(u, v, w, t, c, i, j, k, l);
-  }
-  bool is_cell(Vertex_handle u, Vertex_handle v, Vertex_handle w,
-      Vertex_handle t, Cell_handle & c) const {
-    int i,j,k,l;
-    return _tds.is_cell(u, v, w, t, c, i, j, k, l);
-  }
-  bool is_cell(Vertex_handle u, const Offset & off_u,
-	       Vertex_handle v, const Offset & off_v,
-	       Vertex_handle w, const Offset & off_w,
-	       Vertex_handle t, const Offset & off_t,
-      Cell_handle & c, int & i, int & j, int & k, int & l) const {
-    if (!_tds.is_cell(u,v,w,t,c,i,j,k,l)) return false;
-    return ((get_offset(c,i) == off_u)
-	    && (get_offset(c,j) == off_v)
-	    && (get_offset(c,k) == off_w)
-	    && (get_offset(c,l) == off_t) );
-    return false;
-  }
-  bool is_cell(Vertex_handle u, const Offset & off_u,
-	       Vertex_handle v, const Offset & off_v,
-	       Vertex_handle w, const Offset & off_w,
-	       Vertex_handle t, const Offset & off_t,
-	       Cell_handle & c) const {
-    int i, j, k, l;
-    return is_cell(u,off_u,v,off_v,w,off_w,t,off_t,c,i,j,k,l);
-  }
-
-  bool has_vertex(const Facet & f, Vertex_handle v, int & j) const {
-    return _tds.has_vertex(f.first, f.second, v, j);
-  }
-  bool has_vertex(Cell_handle c, int i, Vertex_handle v, int & j) const {
-    return _tds.has_vertex(c, i, v, j);
-  }
-  bool has_vertex(const Facet & f, Vertex_handle v) const {
-    return _tds.has_vertex(f.first, f.second, v);
-  }
-  bool has_vertex(Cell_handle c, int i, Vertex_handle v) const {
-    return _tds.has_vertex(c, i, v);
-  }
-  
-  bool are_equal(Cell_handle c, int i, Cell_handle n, int j) const {
-    return _tds.are_equal(c, i, n, j);
-  }
-  bool are_equal(const Facet & f, const Facet & g) const {
-    return _tds.are_equal(f.first, f.second, g.first, g.second);
-  }
-  bool are_equal(const Facet & f, Cell_handle n, int j) const {
-    return _tds.are_equal(f.first, f.second, n, j);
-  }
-  //@}
-
-#ifdef CGAL_NO_STRUCTURAL_FILTERING
-  Cell_handle
-  periodic_locate(const Point & p, const Offset &o_p,
-	 Locate_type & lt, int & li, int & lj,
-	 Cell_handle start = Cell_handle()) const;
-#else // no CGAL_NO_STRUCTURAL_FILTERING
-#  ifndef CGAL_PT3_STRUCTURAL_FILTERING_MAX_VISITED_CELLS
-#    define CGAL_PT3_STRUCTURAL_FILTERING_MAX_VISITED_CELLS 2500
-#  endif // no CGAL_PT3_STRUCTURAL_FILTERING_MAX_VISITED_CELLS
-
-public:
-  Cell_handle
-  inexact_periodic_locate(const Point& p, const Offset &o_p,
-                 Cell_handle start = Cell_handle(),
-                 int max_num_cells = CGAL_PT3_STRUCTURAL_FILTERING_MAX_VISITED_CELLS) const;
-protected:
-  Cell_handle
-  exact_periodic_locate(const Point& p, const Offset &o_p,
-               Locate_type& lt,
-               int& li, int & lj,
-               Cell_handle start) const;
-
-  Cell_handle
-  generic_periodic_locate(const Point& p, const Offset &o_p,
-                 Locate_type& lt,
-                 int& li, int & lj,
-                 Cell_handle start,
-                 internal::Periodic_structural_filtering_3_tag) const {
-    return exact_periodic_locate(p, o_p, lt, li, lj, inexact_periodic_locate(p, o_p, start));
-  }
-
-  Cell_handle
-  generic_periodic_locate(const Point& p, const Offset &o_p,
-                 Locate_type& lt,
-                 int& li, int & lj,
-                 Cell_handle start,
-                 internal::No_periodic_structural_filtering_3_tag) const {
-    return exact_periodic_locate(p, o_p, lt, li, lj, start);
-  }
-
-  Orientation
-  inexact_orientation(const Point &p, const Point &q,
-                      const Point &r, const Point &s) const
-  {
-    const double px = to_double(p.x());
-    const double py = to_double(p.y());
-    const double pz = to_double(p.z());
-    const double qx = to_double(q.x());
-    const double qy = to_double(q.y());
-    const double qz = to_double(q.z());
-    const double rx = to_double(r.x());
-    const double ry = to_double(r.y());
-    const double rz = to_double(r.z());
-    const double sx = to_double(s.x());
-    const double sy = to_double(s.y());
-    const double sz = to_double(s.z());
-
-    const double pqx = qx - px;
-    const double pqy = qy - py;
-    const double pqz = qz - pz;
-    const double prx = rx - px;
-    const double pry = ry - py;
-    const double prz = rz - pz;
-    const double psx = sx - px;
-    const double psy = sy - py;
-    const double psz = sz - pz;
-
-    const double det = determinant(pqx, pqy, pqz,
-                                   prx, pry, prz,
-                                   psx, psy, psz);
-    if (det > 0) return POSITIVE;
-    if (det < 0) return NEGATIVE;
-    return ZERO;
-  }
-
-  Orientation
-  inexact_orientation(const Point &p, const Point &q,
-                      const Point &r, const Point &s,
-                      const Offset& o_p, const Offset& o_q,
-                      const Offset& o_r, const Offset& o_s) const
-  {
-    return inexact_orientation(construct_point(p, o_p),
-        construct_point(q, o_q),
-        construct_point(r, o_r),
-        construct_point(s, o_s));
-  }
-
-public:
-
-  Cell_handle
-  periodic_locate(const Point & p, const Offset &o_p,
-         Locate_type & lt, int & li, int & lj,
-         Cell_handle start = Cell_handle()) const
-  {
-    typedef Triangulation_structural_filtering_traits<Geometric_traits> TSFT;
-    typedef typename internal::Periodic_structural_filtering_selector_3<
-      TSFT::Use_structural_filtering_tag::value >::Tag Should_filter_tag;
-
-    return generic_periodic_locate(p, o_p, lt, li, lj, start, Should_filter_tag());
-  }
-
-  Cell_handle
-  inexact_locate(const Point& p,
-                 Cell_handle start = Cell_handle(),
-                 int max_num_cells = CGAL_PT3_STRUCTURAL_FILTERING_MAX_VISITED_CELLS) const
-  {
-	  return inexact_periodic_locate(p, Offset(), start, max_num_cells);
-  }
-#endif // no CGAL_NO_STRUCTURAL_FILTERING
-
-protected:
-  /** @name Location helpers */ //@{
-//  Cell_handle periodic_locate(const Point & p, const Offset &o_p,
-//    Locate_type & lt, int & li, int & lj, Cell_handle start) const;
-
-  Bounded_side side_of_cell(const Point & p, const Offset &off,
-      Cell_handle c, Locate_type & lt, int & i, int & j) const;
-  //@}
-  
-public:
-  /** @name Point Location */ //@{
-  /** Wrapper function for locate if only the request point is given.
-    */
-  Cell_handle locate(const Point & p, Cell_handle start=Cell_handle()) const {
-    Locate_type lt;
-    int li, lj;
-    return locate( p, lt, li, lj, start);
-  }
-  
-  /** Wrapper function calling locate with an empty offset if there was no
-    * offset given.
-    */
-  Cell_handle locate(const Point & p, Locate_type & lt, int & li, int & lj,
-      Cell_handle start = Cell_handle()) const {
-    return periodic_locate(p, Offset(), lt, li, lj, start);
-  }
-
-  Bounded_side side_of_cell(const Point & p,
-      Cell_handle c, Locate_type & lt, int & i, int & j) const {
-    if (number_of_vertices() == 0) {
-      lt = EMPTY;
-      return ON_UNBOUNDED_SIDE;
-    }
-    return side_of_cell(p,Offset(),c,lt,i,j);
-  }
-  //@}
-
-private:
-  /** @name Insertion helpers */ //@{
-  template <class CellIt>
-  void insert_too_long_edges(Vertex_handle v,
-      const CellIt begin, const CellIt end);
-
-  template <class CellIt>
-  void delete_too_long_edges(const CellIt begin, const CellIt end);
-
-  template < class Conflict_tester, class Point_hider >
-  Vertex_handle periodic_insert(const Point& p, const Offset& o, Locate_type lt,
-      Cell_handle c, const Conflict_tester &tester,
-      Point_hider &hider, Vertex_handle vh = Vertex_handle());
-
-  template <class Point_iterator, class Offset_iterator>
-  void periodic_sort(Point_iterator /*p_begin*/, Point_iterator /*p_end*/,
-                     Offset_iterator /*o_begin*/, Offset_iterator /*o_end*/) const {
-    std::cout << "Periodic_sort not yet implemented" << std::endl;
-  }
-
-  Vertex_handle create_initial_triangulation(const Point &p);
-public:
-  std::vector<Vertex_handle> insert_dummy_points();
-  
-protected:
-  // this is needed for compatibility reasons
-  template <class Conflict_test, class OutputIteratorBoundaryFacets,
-      class OutputIteratorCells, class OutputIteratorInternalFacets>
-  Triple<OutputIteratorBoundaryFacets, OutputIteratorCells,
-         OutputIteratorInternalFacets>
-  find_conflicts(Cell_handle c,
-      const Conflict_test &tester,
-      Triple<OutputIteratorBoundaryFacets, OutputIteratorCells,
-      OutputIteratorInternalFacets> it) const {
-    Offset off = get_location_offset(tester, c);
-    return find_conflicts(c,off,tester,it);
-  }
-
-  template <class Conflict_test, class OutputIteratorBoundaryFacets,
-      class OutputIteratorCells, class OutputIteratorInternalFacets>
-  Triple<OutputIteratorBoundaryFacets, OutputIteratorCells,
-         OutputIteratorInternalFacets>
-  find_conflicts(Cell_handle c, const Offset &current_off,
-      const Conflict_test &tester,
-      Triple<OutputIteratorBoundaryFacets, OutputIteratorCells,
-      OutputIteratorInternalFacets> it) const;
-  //@}
-  
-protected:
-  // COMMON INSERTION for DELAUNAY and REGULAR TRIANGULATION
-  template < class Conflict_tester, class Point_hider >
-  Vertex_handle insert_in_conflict(const Point & p, Cell_handle start,
-      const Conflict_tester &tester, Point_hider &hider) {
-    Locate_type lt = Locate_type();
-    int li=0, lj=0;
-    Cell_handle c = periodic_locate(p, Offset(), lt, li, lj, start);
-    return insert_in_conflict(p,lt,c,li,lj,tester,hider);
-  }
-
-  template < class Conflict_tester, class Point_hider >
-  Vertex_handle insert_in_conflict(const Point & p, Locate_type lt,
-    Cell_handle c, int li, int lj, const Conflict_tester &tester,
-    Point_hider &hider);
-
-  template < class InputIterator, class Conflict_tester,
-      class Point_hider>
-  std::vector<Vertex_handle> insert_in_conflict(
-      InputIterator begin, InputIterator end, Cell_handle start,
-      Conflict_tester &tester, Point_hider &hider) {
-    Vertex_handle new_vertex;
-    std::vector<Vertex_handle> double_vertices;
-    Locate_type lt = Locate_type();
-    int li=0, lj=0;
-    CGAL_triangulation_assertion_code( Locate_type lta = Locate_type(); )
-    CGAL_triangulation_assertion_code( int ia = 0; )
-    CGAL_triangulation_assertion_code( int ja = 0; )
-    Cell_handle hint;
-    while (begin!=end) {
-      tester.set_point(*begin);
-      hint = periodic_locate(*begin, Offset(), lt, li, lj, start);
-      CGAL_triangulation_assertion_code( if (number_of_vertices() != 0) { );
-	CGAL_triangulation_assertion(side_of_cell(
-		*begin,Offset(), hint, lta, ia, ja) != ON_UNBOUNDED_SIDE);
-	CGAL_triangulation_assertion(lta == lt);
-	CGAL_triangulation_assertion(ia == li);
-	CGAL_triangulation_assertion(ja == lj);
-      CGAL_triangulation_assertion_code( } );
-
-      new_vertex = insert_in_conflict(*begin,lt,hint,li,lj,tester,hider);
-      if (lt == VERTEX) double_vertices.push_back(new_vertex);
-      start = new_vertex->cell();
-      begin++;
-    }
-    return double_vertices;
-  }
-  //@}
-
-private:
-  /** @name Removal helpers */ //@{
-  Vertex_triple make_vertex_triple(const Facet& f) const {
-    Cell_handle ch = f.first;
-    int i = f.second;
-    return Vertex_triple(ch->vertex(vertex_triple_index(i,0)),
-        ch->vertex(vertex_triple_index(i,1)),
-        ch->vertex(vertex_triple_index(i,2))); 
-  }
-
-  void make_canonical(Vertex_triple& t) const;
-
-  void make_hole(Vertex_handle v, std::map<Vertex_triple,Facet> &outer_map,
-      std::vector<Cell_handle> &hole);
-
-  template < class PointRemover >
-  void periodic_remove(Vertex_handle v, PointRemover &remover); 
-  //@}
-  
-protected:
-  /** @name Removal */ //@{
-  template < class PointRemover, class CT >
-  void remove(Vertex_handle v, PointRemover &remover, CT &ct);
-  //@}
-
-public:
-  /** @name Traversal */ //@{
-  Cell_iterator cells_begin() const {
-    return _tds.cells_begin();
-  }
-  Cell_iterator cells_end() const {
-    return _tds.cells_end();
-  }
-
-  Vertex_iterator vertices_begin() const {
-    return _tds.vertices_begin();
-  }
-  Vertex_iterator vertices_end() const {
-    return _tds.vertices_end();
-  }
-
-  Edge_iterator edges_begin() const {
-    return _tds.edges_begin();
-  }
-  Edge_iterator edges_end() const {
-    return _tds.edges_end();
-  }
-
-  Facet_iterator facets_begin() const {
-    return _tds.facets_begin();
-  }
-  Facet_iterator facets_end() const {
-    return _tds.facets_end();
-  }
-
-  Cell_iterator finite_cells_begin() const {
-    return _tds.cells_begin();
-  }
-  Cell_iterator finite_cells_end() const {
-    return _tds.cells_end();
-  }
-
-  Vertex_iterator finite_vertices_begin() const {
-    return _tds.vertices_begin();
-  }
-  Vertex_iterator finite_vertices_end() const {
-    return _tds.vertices_end();
-  }
-
-  Edge_iterator finite_edges_begin() const {
-    return _tds.edges_begin();
-  }
-  Edge_iterator finite_edges_end() const {
-    return _tds.edges_end();
-  }
-
-  Facet_iterator finite_facets_begin() const {
-    return _tds.facets_begin();
-  }
-  Facet_iterator finite_facets_end() const {
-    return _tds.facets_end();
-  }
-
-  All_cells_iterator all_cells_begin() const {
-    return _tds.cells_begin();
-  }
-  All_cells_iterator all_cells_end() const {
-    return _tds.cells_end();
-  }
-
-  All_vertices_iterator all_vertices_begin() const {
-    return _tds.vertices_begin();
-  }
-  All_vertices_iterator all_vertices_end() const {
-    return _tds.vertices_end();
-  }
-
-  All_edges_iterator all_edges_begin() const {
-    return _tds.edges_begin();
-  }
-  All_edges_iterator all_edges_end() const {
-    return _tds.edges_end();
-  }
-
-  All_facets_iterator all_facets_begin() const {
-    return _tds.facets_begin();
-  }
-  All_facets_iterator all_facets_end() const {
-    return _tds.facets_end();
-  }
-  
-  Unique_vertex_iterator unique_vertices_begin() const {
-    return CGAL::filter_iterator(vertices_end(), Domain_tester<Self>(this),
-	                         vertices_begin());
-  }
-  Unique_vertex_iterator unique_vertices_end() const {
-    return CGAL::filter_iterator(vertices_end(), Domain_tester<Self>(this));
-  }
-
-  // Geometric iterators
-  Periodic_tetrahedron_iterator periodic_tetrahedra_begin(
-      Iterator_type it = STORED) const {
-    return Periodic_tetrahedron_iterator(this, it);
-  }
-  Periodic_tetrahedron_iterator periodic_tetrahedra_end(
-      Iterator_type it = STORED) const {
-    return Periodic_tetrahedron_iterator(this, 1, it);
-  }
-
-  Periodic_triangle_iterator periodic_triangles_begin(
-      Iterator_type it = STORED) const {
-    return Periodic_triangle_iterator(this, it);
-  }
-  Periodic_triangle_iterator periodic_triangles_end(
-      Iterator_type it = STORED) const {
-    return Periodic_triangle_iterator(this, 1, it);
-  }
-
-  Periodic_segment_iterator periodic_segments_begin(
-      Iterator_type it = STORED) const {
-    return Periodic_segment_iterator(this, it);
-  }
-  Periodic_segment_iterator periodic_segments_end(
-      Iterator_type it = STORED) const {
-    return Periodic_segment_iterator(this, 1, it);
-  }
-
-  Periodic_point_iterator periodic_points_begin(
-      Iterator_type it = STORED) const {
-    return Periodic_point_iterator(this, it);
-  }
-  Periodic_point_iterator periodic_points_end(
-      Iterator_type it = STORED) const  {
-    return Periodic_point_iterator(this, 1, it);
-  }
-
-  // Circulators
-  Cell_circulator incident_cells(const Edge & e) const {
-    return _tds.incident_cells(e);
-  }
-  Cell_circulator incident_cells(Cell_handle c, int i, int j) const {
-    return _tds.incident_cells(c, i, j);
-  }
-  Cell_circulator incident_cells(const Edge & e, Cell_handle start) const {
-    return _tds.incident_cells(e, start);
-  }
-  Cell_circulator incident_cells(Cell_handle c, int i, int j, 
-      Cell_handle start) const {
-    return _tds.incident_cells(c, i, j, start);
-  }
-
-  Facet_circulator incident_facets(const Edge & e) const {
-    return _tds.incident_facets(e);
-  }
-  Facet_circulator incident_facets(Cell_handle c, int i, int j) const {
-    return _tds.incident_facets(c, i, j);
-  }
-  Facet_circulator incident_facets(const Edge & e, const Facet & start) const {
-    return _tds.incident_facets(e, start);
-  }
-  Facet_circulator incident_facets(Cell_handle c, int i, int j, 
-      const Facet & start) const {
-    return _tds.incident_facets(c, i, j, start);
-  }
-  Facet_circulator incident_facets(const Edge & e,
-      Cell_handle start, int f) const {
-    return _tds.incident_facets(e, start, f);
-  }
-  Facet_circulator incident_facets(Cell_handle c, int i, int j, 
-      Cell_handle start, int f) const {
-    return _tds.incident_facets(c, i, j, start, f);
-  }
-
-  // around a vertex
-  template <class OutputIterator>
-  OutputIterator incident_cells(Vertex_handle v, OutputIterator cells) const {
-    return _tds.incident_cells(v, cells);
-  }
-
-  template <class OutputIterator>
-  OutputIterator incident_facets(Vertex_handle v, OutputIterator facets) const {
-    return _tds.incident_facets(v, facets);
-  }
-
-  template <class OutputIterator>
-  OutputIterator incident_edges(
-      Vertex_handle v, OutputIterator edges) const {
-    return _tds.incident_edges(v, edges);
-  }
-
-  template <class OutputIterator>
-  OutputIterator adjacent_vertices(
-      Vertex_handle v, OutputIterator vertices) const {
-    return _tds.adjacent_vertices(v, vertices);
-  }
-
-  //deprecated, don't use anymore
-  template <class OutputIterator>
-  OutputIterator incident_vertices(
-      Vertex_handle v, OutputIterator vertices) const {
-    return _tds.adjacent_vertices(v, vertices);
-  }
-
-  size_type degree(Vertex_handle v) const {
-    return _tds.degree(v);
-  }
-
-  // Functions forwarded from TDS.
-  int mirror_index(Cell_handle c, int i) const {
-    return _tds.mirror_index(c, i);
-  }
-
-  Vertex_handle mirror_vertex(Cell_handle c, int i) const {
-    return _tds.mirror_vertex(c, i);
-  }
-
-  Facet mirror_facet(Facet f) const {
-    return _tds.mirror_facet(f);
-  }
-  //@}
-  
-private:
-  /** @name Checking helpers */ //@{
-  /// calls has_self_edges for every cell of the triangulation
-  bool has_self_edges() const {
-    Cell_iterator it;
-    for ( it = all_cells_begin(); it != all_cells_end(); ++it )
-      if (has_self_edges(it)) return true;
-    return false;
-  }
-  bool has_self_edges(Cell_handle c) const;
-  //@}
-  
-public:
-  /** @name Checking */ //@{
-  bool is_valid(bool verbose = false, int level = 0) const;
-  bool is_valid(Cell_handle c, bool verbose = false, int level = 0) const;
-protected:
-  template <class ConflictTester>
-  bool is_valid_conflict(ConflictTester &tester, bool verbose = false,
-      int level = 0) const;
-  //@}
-
-protected:
-  /** @name Functors */ //@{
-  template < class Cmp >
-  class Perturbation_order;
-  //@}
-
-public:
-  // undocumented access functions
-  Offset get_offset(Cell_handle ch, int i) const {
-    if (is_1_cover()) return int_to_off(ch->offset(i));
-    Virtual_vertex_map_it it = virtual_vertices.find(ch->vertex(i));
-    if (it != virtual_vertices.end())
-      return combine_offsets(it->second.second, int_to_off(ch->offset(i)));
-    else return combine_offsets(Offset(), int_to_off(ch->offset(i)));
-  }
-  Offset get_offset(Vertex_handle vh) const {
-    if (is_1_cover()) return Offset();
-    Virtual_vertex_map_it it = virtual_vertices.find(vh);
-    if (it != virtual_vertices.end()) return it->second.second;
-    else return Offset();
-  }
-  Vertex_handle get_original_vertex(Vertex_handle vh) const {
-    if (is_1_cover()) return vh;
-    Virtual_vertex_map_it it = virtual_vertices.find(vh);
-    if (it != virtual_vertices.end()) return it->second.first;
-    else return vh;
-  }
-  Offset combine_offsets(const Offset& o_c, const Offset& o_t) const {
-    Offset o_ct(_cover[0]*o_t.x(),_cover[1]*o_t.y(),_cover[2]*o_t.z());
-    return o_c + o_ct;
-  }
-
-  // These functions give the pair (vertex, offset) that corresponds to the
-  // i-th vertex of cell ch or vertex vh, respectively.
-  void get_vertex(Cell_handle ch, int i, Vertex_handle &vh, Offset &off) const;
-  void get_vertex(Vertex_handle vh_i, Vertex_handle &vh, Offset &off) const;
-
-protected:
-  // Auxiliary functions
-  int find_too_long_edges(std::map<Vertex_handle,
-      std::list<Vertex_handle> >& edges) const;
-  Cell_handle get_cell(const Vertex_handle* vh) const;
-  template<class Conflict_tester>
-  Offset get_location_offset(const Conflict_tester& tester,
-	  Cell_handle c) const;
-
-  Offset get_neighbor_offset(Cell_handle ch, int i, Cell_handle nb) const;
-  
-  /** @name Friends */ //@{
-  friend class Perturbation_order<typename GT::Compare_xyz_3>;
-  friend std::istream& operator>> <>
-      (std::istream& is, Periodic_3_triangulation_3<GT,TDS> &tr);
-  friend std::ostream& operator<< <>
-      (std::ostream& os, const Periodic_3_triangulation_3<GT,TDS> &tr);
-  //@}
-
-  // unused and undocumented function required to be compatible to
-  // Alpha_shape_3
-public:
-  Point point(Cell_handle c, int idx) const {
-    //    if (is_1_cover())
-      return point(periodic_point(c,idx));
-
-    Offset vec_off[4];
-    for (int i=0 ; i<4 ; i++) vec_off[i] = periodic_point(c,i).second;
-    int ox = vec_off[0].x();
-    int oy = vec_off[0].y();
-    int oz = vec_off[0].z();
-    for (int i=1 ; i<4 ; i++) {
-      ox = (std::min)(ox,vec_off[i].x());
-      oy = (std::min)(oy,vec_off[i].y());
-      oz = (std::min)(oz,vec_off[i].z());
-    }
-    Offset diff_off(-ox,-oy,-oz);
-    if (diff_off.is_null()) return point(periodic_point(c,idx));
-
-    for (unsigned int i=0 ; i<4 ; i++) vec_off[i] += diff_off;
-    Vertex_handle canonic_vh[4];
-    for (int i=0 ; i<4 ; i++) {
-      Virtual_vertex_map_it vvmit = virtual_vertices.find(c->vertex(i));
-      Vertex_handle orig_vh;
-      if (vvmit == virtual_vertices.end()) orig_vh = c->vertex(i);
-      else orig_vh = vvmit->second.first;
-      if (vec_off[i].is_null()) canonic_vh[i] = orig_vh;
-      else {
-	CGAL_assertion(virtual_vertices_reverse.find(orig_vh)
-	    != virtual_vertices_reverse.end());
-	canonic_vh[i] = virtual_vertices_reverse.find(orig_vh)
-	  ->second[9*vec_off[i][0]+3*vec_off[i][1]+vec_off[i][2]-1];
-      }
-    }
-    
-    std::vector<Cell_handle> cells;
-    incident_cells(canonic_vh[0], std::back_inserter(cells));
-    for (unsigned int i=0 ; i<cells.size() ; i++) {
-      CGAL_assertion(cells[i]->has_vertex(canonic_vh[0]));
-      if (cells[i]->has_vertex(canonic_vh[1])
-	  && cells[i]->has_vertex(canonic_vh[2])
-	  && cells[i]->has_vertex(canonic_vh[3]) )
-	return point(periodic_point(cells[i],cells[i]->index(canonic_vh[idx])));
-    }
-    CGAL_assertion(false);
-  return Point();
-  }
-};
-
-template < class GT, class TDS >
-inline void
-Periodic_3_triangulation_3<GT,TDS>::
-copy_multiple_covering(const Periodic_3_triangulation_3<GT,TDS> & tr) {  
-  // Write the respective offsets in the vertices to make them
-  // automatically copy with the tds.
-  for (Vertex_iterator vit = tr.vertices_begin() ;
-       vit != tr.vertices_end() ; ++vit) {
-    vit->set_offset(tr.get_offset(vit));
-  }
-  // copy the tds
-  _tds = tr.tds();
-  // make a list of all vertices that belong to the original
-  // domain and initialize the basic structure of
-  // virtual_vertices_reverse
-  std::list<Vertex_handle> vlist;
-  for (Vertex_iterator vit = vertices_begin() ;
-       vit != vertices_end() ; ++vit) {
-    if (vit->offset() == Offset()) {
-      vlist.push_back(vit);
-      virtual_vertices_reverse.insert(
-	  std::make_pair(vit,std::vector<Vertex_handle>(26)));
-      CGAL_triangulation_assertion(virtual_vertices_reverse.find(vit)
-	  ->second.size() == 26);
-    }
-  }     
-  // Iterate over all vertices that are not in the original domain
-  // and construct the respective entries to virtual_vertices and
-  // virtual_vertices_reverse
-  for (Vertex_iterator vit2 = vertices_begin() ;
-       vit2 != vertices_end() ; ++vit2) {
-    if (vit2->offset() != Offset()) {
-      //TODO: use some binding, maybe boost instead of the Finder.
-      typename std::list<Vertex_handle>::iterator vlist_it
-	= std::find_if(vlist.begin(), vlist.end(),
-		       Finder(this,vit2->point()));
-      Offset off = vit2->offset();
-      virtual_vertices.insert(std::make_pair(vit2,
-					     std::make_pair(*vlist_it,off)));
-      virtual_vertices_reverse.find(*vlist_it)
-	->second[9*off[0]+3*off[1]+off[2]-1]=vit2;
-      CGAL_triangulation_assertion(get_offset(vit2) == off);
-    }
-  }
-  // Cleanup vertex offsets
-  for (Vertex_iterator vit = vertices_begin() ;
-       vit != vertices_end() ; ++vit)
-    vit->clear_offset();
-  for (Vertex_iterator vit = tr.vertices_begin() ;
-       vit != tr.vertices_end() ; ++vit)
-    vit->clear_offset();
-  // Build up the too_long_edges container
-  too_long_edge_counter = 0;
-  too_long_edges.clear();
-  for (Vertex_iterator vit = vertices_begin() ;
-       vit != vertices_end() ; ++vit) 
-    too_long_edges[vit] = std::list<Vertex_handle>();
-  std::pair<Vertex_handle, Vertex_handle> edge_to_add;
-  Point p1,p2;
-  int i,j;
-  for (Edge_iterator eit = edges_begin() ;
-       eit != edges_end() ; ++eit) {
-    if (&*(eit->first->vertex(eit->second))
-	< &*(eit->first->vertex(eit->third))) {
-      i = eit->second; j = eit->third;
-    } else {
-      i = eit->third; j = eit->second;
-    }
-    edge_to_add = std::make_pair(eit->first->vertex(i),
-				 eit->first->vertex(j));
-    p1 = construct_point(eit->first->vertex(i)->point(),
-	get_offset(eit->first, i));
-    p2 = construct_point(eit->first->vertex(j)->point(),
-	get_offset(eit->first, j));
-    Vertex_handle v_no = eit->first->vertex(i);
-    if (squared_distance(p1,p2) > edge_length_threshold) {
-      CGAL_triangulation_assertion(
-	  find(too_long_edges[v_no].begin(),
-	       too_long_edges[v_no].end(),
-	       edge_to_add.second) == too_long_edges[v_no].end());
-      too_long_edges[v_no].push_back(edge_to_add.second);
-      too_long_edge_counter++;
-    }
-  }
-}
-
-template < class GT, class TDS >
-inline bool
-Periodic_3_triangulation_3<GT,TDS>::
-is_extensible_triangulation_in_1_sheet_h1() const {
-  if (!is_1_cover()) {
-    if (too_long_edge_counter == 0) return true;
-    else return false;
-  } else {
-    typename Geometric_traits::FT longest_edge_squared_length(0);
-    Segment s;
-    for (Periodic_segment_iterator psit = periodic_segments_begin(UNIQUE);
- 	 psit != periodic_segments_end(UNIQUE) ; ++psit) {
-      s = construct_segment(*psit);
-      longest_edge_squared_length = (std::max)(longest_edge_squared_length,
-	  s.squared_length());
-    }
-    return (longest_edge_squared_length < edge_length_threshold);
-  }
-}
-
-template < class GT, class TDS >
-inline bool
-Periodic_3_triangulation_3<GT,TDS>::
-is_extensible_triangulation_in_1_sheet_h2() const {
-  typedef typename Geometric_traits::Construct_circumcenter_3
-    Construct_circumcenter;
-  typedef typename Geometric_traits::FT FT;
-  Construct_circumcenter construct_circumcenter
-    = _gt.construct_circumcenter_3_object();
-  for (Periodic_tetrahedron_iterator tit = periodic_tetrahedra_begin(UNIQUE) ;
-       tit != periodic_tetrahedra_end(UNIQUE) ; ++tit) {
-    Point cc = construct_circumcenter(
-	tit->at(0).first, tit->at(1).first,
-	tit->at(2).first, tit->at(3).first,
-	tit->at(0).second, tit->at(1).second,
-	tit->at(2).second, tit->at(3).second);
-
-    if ( !(FT(16)*squared_distance(cc,point(tit->at(0)))
-	    < (_domain.xmax()-_domain.xmin())*(_domain.xmax()-_domain.xmin())) )
-      return false;
-  }
-  return true;
-}
-
-template < class GT, class TDS >
-inline bool
-Periodic_3_triangulation_3<GT,TDS>::
-is_triangulation_in_1_sheet() const {
-  if (is_1_cover()) return true;
-  for (Vertex_iterator vit = vertices_begin(); vit != vertices_end(); ++vit) {
-    if (virtual_vertices.find(vit) == virtual_vertices.end()) continue;
-    std::vector<Vertex_handle> nb_v;
-    std::set<Vertex_handle> nb_v_odom;
-    Vertex_handle vh;
-    Offset off;
-    adjacent_vertices(vit, std::back_inserter(nb_v));
-    for (unsigned int i=0; i<nb_v.size(); i++) {
-      get_vertex(nb_v[i],vh,off);
-      nb_v_odom.insert(vh);
-    }
-    if (nb_v.size() != nb_v_odom.size()) 
-      return false;
-  }
-  return true;
-}
-
-template < class GT, class TDS >
-inline bool
-Periodic_3_triangulation_3<GT,TDS>::
-is_vertex(const Point & p, Vertex_handle & v) const
-{
-  Locate_type lt;
-  int li, lj;
-  Cell_handle c = locate( p, lt, li, lj );
-  if ( lt != VERTEX )
-    return false;
-  v = c->vertex(li);
-  return true;
-}
-
-template < class GT, class TDS >
-inline void
-Periodic_3_triangulation_3<GT,TDS>::
-make_canonical(Vertex_triple& t) const
-{
-  int i = (&*(t.first) < &*(t.second))? 0 : 1;
-  if(i==0) {
-    i = (&*(t.first) < &*(t.third))? 0 : 2;
-  } else {
-    i = (&*(t.second) < &*(t.third))? 1 : 2;
-  }
-  Vertex_handle tmp; 
-  switch(i){
-  case 0: return;
-  case 1:
-    tmp = t.first;
-    t.first = t.second;
-    t.second = t.third;
-    t.third = tmp;
-    return;
-  default:
-    tmp = t.first;
-    t.first = t.third;
-    t.third = t.second;
-    t.second = tmp;
-  }
-}
-
-template < class GT, class TDS >
-inline typename Periodic_3_triangulation_3<GT,TDS>::Periodic_triangle
-Periodic_3_triangulation_3<GT,TDS>::
-periodic_triangle(const Cell_handle c, int i) const
-{ 
-  CGAL_triangulation_precondition( number_of_vertices() != 0 );
-  CGAL_triangulation_precondition( i >= 0 && i <= 3 );
-  if ( (i&1)==0 ) 
-    return make_array(std::make_pair(c->vertex( (i+2)&3 )->point(),
-				     get_offset(c,(i+2)&3)),
-		      std::make_pair(c->vertex( (i+1)&3 )->point(),
-				     get_offset(c,(i+1)&3)),
-		      std::make_pair(c->vertex( (i+3)&3 )->point(),
-				     get_offset(c,(i+3)&3)) );
-  return make_array(std::make_pair(c->vertex( (i+1)&3 )->point(),
-				   get_offset(c,(i+1)&3)),
-		    std::make_pair(c->vertex( (i+2)&3 )->point(),
-				   get_offset(c,(i+2)&3)),
-		    std::make_pair(c->vertex( (i+3)&3 )->point(),
-				   get_offset(c,(i+3)&3)) );
-}
-
-/** Assumes a point, an offset, and a cell to start from.
-  * Gives the locate type and the simplex (cell and indices) containing p.
-  *
-  * Performs a remembering stochastic walk if the triangulation is not empty.
-  * After the walk the type of the simplex containing p is determined.
-  *
-  * returns the cell p lies in
-  * starts at cell "start"
-  * returns a cell Cell_handel if lt == CELL
-  * returns a facet (Cell_handle,li) if lt == FACET
-  * returns an edge (Cell_handle,li,lj) if lt == EDGE
-  * returns a vertex (Cell_handle,li) if lt == VERTEX
-  */
-template < class GT, class TDS >
-inline typename Periodic_3_triangulation_3<GT,TDS>::Cell_handle
-Periodic_3_triangulation_3<GT,TDS>::
-#ifdef CGAL_NO_STRUCTURAL_FILTERING
-periodic_locate
-#else
-exact_periodic_locate
-#endif
-(const Point & p, const Offset &o_p,
-    Locate_type & lt, int & li, int & lj, Cell_handle start) const {
-  int cumm_off = 0;
-  Offset off_query = o_p;
-  if (number_of_vertices() == 0) {
-    lt = EMPTY;
-    return Cell_handle();
-  }
-  CGAL_triangulation_assertion(number_of_vertices() != 0);
-
-  if (start == Cell_handle()) {
-    start = cells_begin();
-  }
-
-  cumm_off = start->offset(0) | start->offset(1)
-    | start->offset(2) | start->offset(3);
-  if (is_1_cover() && cumm_off != 0) {
-    if (((cumm_off & 4) == 4) && (FT(2)*p.x()<(_domain.xmax()+_domain.xmin())))
-      off_query += Offset(1,0,0);
-    if (((cumm_off & 2) == 2) && (FT(2)*p.y()<(_domain.ymax()+_domain.ymin())))
-      off_query += Offset(0,1,0);
-    if (((cumm_off & 1) == 1) && (FT(2)*p.z()<(_domain.zmax()+_domain.zmin())))
-      off_query += Offset(0,0,1);
-  }
-
-  CGAL_triangulation_postcondition(start!=Cell_handle());
-  CGAL_triangulation_assertion(start->neighbor(0)->neighbor(
-      start->neighbor(0)->index(start))==start);
-  CGAL_triangulation_assertion(start->neighbor(1)->neighbor(
-      start->neighbor(1)->index(start))==start);
-  CGAL_triangulation_assertion(start->neighbor(2)->neighbor(
-      start->neighbor(2)->index(start))==start);
-  CGAL_triangulation_assertion(start->neighbor(3)->neighbor(
-      start->neighbor(3)->index(start))==start);
-
-  // We implement the remembering visibility/stochastic walk.
-  
-  // Remembers the previous cell to avoid useless orientation tests.
-  Cell_handle previous = Cell_handle();
-  Cell_handle c = start;
-  
-  // Stores the results of the 4 orientation tests.  It will be used
-  // at the end to decide if p lies on a face/edge/vertex/interior.
-  Orientation o[4];
-  
-  boost::rand48 rng;      
-  boost::uniform_smallint<> four(0, 3);
-  boost::variate_generator<boost::rand48&, boost::uniform_smallint<> > die4(rng, four);
-
-  
-  // Now treat the cell c.
-try_next_cell:
-  // For the remembering stochastic walk,
-  // we need to start trying with a random index :
-  int i = die4();
-  // For the remembering visibility walk (Delaunay only), we don't :
-  // int i = 0;
-
-  cumm_off =
-    c->offset(0) | c->offset(1) | c->offset(2) | c->offset(3);
-
-  bool simplicity_criterion = (cumm_off == 0) && (off_query.is_null());
-
-  // We know that the 4 vertices of c are positively oriented.
-  // So, in order to test if p is seen outside from one of c's facets,
-  // we just replace the corresponding point by p in the orientation
-  // test.  We do this using the arrays below.
-
-  Offset off[4];
-  const Point* pts[4] = { &(c->vertex(0)->point()),
-      &(c->vertex(1)->point()),
-      &(c->vertex(2)->point()),
-      &(c->vertex(3)->point()) };
-
-  if (!simplicity_criterion && is_1_cover() ) {
-    for (int i=0; i<4; i++) {
-      off[i] = int_to_off(c->offset(i));
-    }
-  }
-  
-  if (!is_1_cover()) {
-    // Just fetch the vertices of c as points with offsets
-    for (int i=0; i<4; i++) {
-      pts[i] = &(c->vertex(i)->point());
-      off[i] = get_offset(c,i);
-    }
-  }
-  
-  for (int j=0; j != 4; ++j, i = (i+1)&3) {
-    Cell_handle next = c->neighbor(i);
-    if (previous == next) {
-      o[i] = POSITIVE;
-      continue;
-    }
-    
-    CGAL_triangulation_assertion(next->neighbor(next->index(c)) == c);
-    
-    // We temporarily put p at i's place in pts.
-    const Point* backup = pts[i];
-    pts[i] = &p;
-    
-    if (simplicity_criterion && is_1_cover() ) {
-      o[i] = orientation(*pts[0], *pts[1], *pts[2], *pts[3]);
-      
-      if ( o[i] != NEGATIVE ) {
-        pts[i] = backup;
-        continue;
-      }
-    }
-    else {
-      Offset backup_off;
-      
-      backup_off = off[i];
-      off[i] = off_query;
-      o[i] = orientation(*pts[0], *pts[1], *pts[2], *pts[3],
-          off[0], off[1], off[2], off[3]);
-
-      if ( o[i] != NEGATIVE ) {
-        pts[i] = backup;
-        off[i] = backup_off;
-        continue;
-      }
-    }
-
-    // Test whether we need to adapt the offset of the query point.
-    // This means, if we get out of the current cover.
-    off_query = combine_offsets(off_query, get_neighbor_offset(c,i,next));
-    previous = c;
-    c = next;
-    goto try_next_cell;
-  }
-
-  
-  // Ok, now we have found the cell. It remains to find the dimension of the
-  // intersected simplex.
-  // now p is in c or on its boundary
-  int sum = ( o[0] == COPLANAR )
-    + ( o[1] == COPLANAR )
-    + ( o[2] == COPLANAR )
-    + ( o[3] == COPLANAR );
-  switch (sum) {
-  case 0:
-      lt = CELL;
-      break;
-  case 1:
-      lt = FACET;
-      li = ( o[0] == COPLANAR ) ? 0 :
-          ( o[1] == COPLANAR ) ? 1 :
-          ( o[2] == COPLANAR ) ? 2 : 3;
-      break;
-  case 2:
-    lt = EDGE;
-    li = ( o[0] != COPLANAR ) ? 0 :
-        ( o[1] != COPLANAR ) ? 1 : 2;
-    lj = ( o[li+1] != COPLANAR ) ? li+1 :
-        ( o[li+2] != COPLANAR ) ? li+2 : li+3;
-    break;
-  case 3:
-    lt = VERTEX;
-    li = ( o[0] != COPLANAR ) ? 0 :
-        ( o[1] != COPLANAR ) ? 1 :
-        ( o[2] != COPLANAR ) ? 2 : 3;
-    break;
-  default:
-    // Vertex can not lie on four facets
-    CGAL_triangulation_assertion(false);
-  }
-  return c;
-}
-
-
-#ifndef CGAL_NO_STRUCTURAL_FILTERING
-template < class GT, class TDS >
-typename Periodic_3_triangulation_3<GT,TDS>::Cell_handle
-Periodic_3_triangulation_3<GT,TDS>::
-inexact_periodic_locate(const Point& p, const Offset& o_p,
-               Cell_handle start,
-               int n_of_turns) const
-{
-	int cumm_off = 0;
-	Offset off_query = o_p;
-	if (number_of_vertices() == 0) {
-		return Cell_handle();
-	}
-	CGAL_triangulation_assertion(number_of_vertices() != 0);
-
-	if (start == Cell_handle()) {
-		start = cells_begin();
-	}
-
-	cumm_off = start->offset(0) | start->offset(1)
-	    		| start->offset(2) | start->offset(3);
-	if (is_1_cover() && cumm_off != 0) {
-		if (((cumm_off & 4) == 4) && (FT(2)*p.x()<(_domain.xmax()+_domain.xmin())))
-			off_query += Offset(1,0,0);
-		if (((cumm_off & 2) == 2) && (FT(2)*p.y()<(_domain.ymax()+_domain.ymin())))
-			off_query += Offset(0,1,0);
-		if (((cumm_off & 1) == 1) && (FT(2)*p.z()<(_domain.zmax()+_domain.zmin())))
-			off_query += Offset(0,0,1);
-	}
-
-	CGAL_triangulation_postcondition(start!=Cell_handle());
-	CGAL_triangulation_assertion(start->neighbor(0)->neighbor(
-			start->neighbor(0)->index(start))==start);
-	CGAL_triangulation_assertion(start->neighbor(1)->neighbor(
-			start->neighbor(1)->index(start))==start);
-	CGAL_triangulation_assertion(start->neighbor(2)->neighbor(
-			start->neighbor(2)->index(start))==start);
-	CGAL_triangulation_assertion(start->neighbor(3)->neighbor(
-			start->neighbor(3)->index(start))==start);
-
-	// We implement the remembering visibility/stochastic walk.
-
-	// Remembers the previous cell to avoid useless orientation tests.
-	Cell_handle previous = Cell_handle();
-	Cell_handle c = start;
-
-	// Now treat the cell c.
-try_next_cell:
-  --n_of_turns;
-	cumm_off =
-			c->offset(0) | c->offset(1) | c->offset(2) | c->offset(3);
-
-	bool simplicity_criterion = (cumm_off == 0) && (off_query.is_null());
-
-	// We know that the 4 vertices of c are positively oriented.
-	// So, in order to test if p is seen outside from one of c's facets,
-	// we just replace the corresponding point by p in the orientation
-	// test.  We do this using the arrays below.
-
-	Offset off[4];
-	const Point* pts[4] = { &(c->vertex(0)->point()),
-			&(c->vertex(1)->point()),
-			&(c->vertex(2)->point()),
-			&(c->vertex(3)->point()) };
-
-	if (!simplicity_criterion && is_1_cover() ) {
-		for (int i=0; i<4; i++) {
-			off[i] = int_to_off(c->offset(i));
-		}
-	}
-
-	if (!is_1_cover()) {
-		// Just fetch the vertices of c as points with offsets
-		for (int i=0; i<4; i++) {
-			pts[i] = &(c->vertex(i)->point());
-			off[i] = get_offset(c,i);
-		}
-	}
-
-	for (int i=0; i != 4; ++i) {
-		Cell_handle next = c->neighbor(i);
-		if (previous == next) {
-			continue;
-		}
-
-		// We temporarily put p at i's place in pts.
-		const Point* backup = pts[i];
-		pts[i] = &p;
-
-		if (simplicity_criterion && is_1_cover() ) {
-			if ( inexact_orientation(*pts[0], *pts[1], *pts[2], *pts[3]) != NEGATIVE ) {
-				pts[i] = backup;
-				continue;
-			}
-		}
-		else {
-			Offset backup_off;
-
-			backup_off = off[i];
-			off[i] = off_query;
-
-			if ( inexact_orientation(*pts[0], *pts[1], *pts[2], *pts[3],
-					off[0], off[1], off[2], off[3]) != NEGATIVE ) {
-				pts[i] = backup;
-				off[i] = backup_off;
-				continue;
-			}
-		}
-
-		// Test whether we need to adapt the offset of the query point.
-		// This means, if we get out of the current cover.
-		off_query = combine_offsets(off_query, get_neighbor_offset(c,i,next));
-		previous = c;
-		c = next;
-		if (n_of_turns)
-		  goto try_next_cell;
-	}
-
-	return c;
-}
-#endif
-
-
-/**
- * returns
- * ON_BOUNDED_SIDE if p inside the cell
- * (for an infinite cell this means that p lies strictly in the half space
- * limited by its finite facet)
- * ON_BOUNDARY if p on the boundary of the cell
- * (for an infinite cell this means that p lies on the *finite* facet)
- * ON_UNBOUNDED_SIDE if p lies outside the cell
- * (for an infinite cell this means that p is not in the preceding
- * two cases)
- * 
- * lt has a meaning only when ON_BOUNDED_SIDE or ON_BOUNDARY
- */
-// TODO: currently off is not used. It could probably be optimized
-// using off.
-template < class GT, class TDS >
-inline Bounded_side Periodic_3_triangulation_3<GT,TDS>::side_of_cell(
-    const Point & q, const Offset &off, Cell_handle c,
-    Locate_type & lt, int & i, int & j) const
-{
-  CGAL_triangulation_precondition( number_of_vertices() != 0 );
-
-  Orientation o0,o1,o2,o3;
-  o0 = o1 = o2 = o3 = ZERO;
-
-  int cumm_off = c->offset(0) | c->offset(1) | c->offset(2) | c->offset(3);
-  if ((cumm_off == 0) && (is_1_cover())) {
-    CGAL_triangulation_assertion(off == Offset());
-    const Point &p0  = c->vertex(0)->point();
-    const Point &p1  = c->vertex(1)->point();
-    const Point &p2  = c->vertex(2)->point();
-    const Point &p3  = c->vertex(3)->point();
-  
-    if (((o0 = orientation(q ,p1,p2,p3)) == NEGATIVE) ||
-        ((o1 = orientation(p0,q ,p2,p3)) == NEGATIVE) ||
-        ((o2 = orientation(p0,p1,q ,p3)) == NEGATIVE) ||
-        ((o3 = orientation(p0,p1,p2,q )) == NEGATIVE) ) {
-      return ON_UNBOUNDED_SIDE;
-    }
-  } else { // Special case for the periodic space.
-    Offset off_q;
-    Offset offs[4];
-    const Point *p[4];
-    for (int i=0; i<4; i++) {
-      p[i] = &(c->vertex(i)->point());
-      offs[i] = get_offset(c,i);
-    }
-    CGAL_triangulation_assertion(orientation(*p[0], *p[1], *p[2], *p[3],
-        offs[0], offs[1], offs[2], offs[3]) == POSITIVE);
-    bool found=false;
-    for (int i=0; (i<8)&&(!found); i++) {
-      if ((cumm_off | ((~i)&7)) == 7) {
-        o0 = o1 = o2 = o3 = NEGATIVE;
-        off_q = combine_offsets(off, int_to_off(i));
-
-        if (((o0 = orientation(      q,  *p[1],  *p[2],  *p[3], 
-                off_q  ,offs[1],offs[2],offs[3])) != NEGATIVE)&&
-            ((o1 = orientation(  *p[0],      q,  *p[2],  *p[3], 
-                offs[0],  off_q,offs[2],offs[3])) != NEGATIVE)&&
-            ((o2 = orientation(  *p[0],  *p[1],      q,  *p[3], 
-                offs[0],offs[1],  off_q,offs[3])) != NEGATIVE)&&
-            ((o3 = orientation(  *p[0],  *p[1],  *p[2],      q, 
-                offs[0],offs[1],offs[2],  off_q)) != NEGATIVE)) {
-          found = true;
-        }
-      }
-    }
-    if (!found) return ON_UNBOUNDED_SIDE;
-  }
-
-  // now all the oi's are >=0
-  // sum gives the number of facets p lies on
-  int sum = ( (o0 == ZERO) ? 1 : 0 ) 
-    + ( (o1 == ZERO) ? 1 : 0 ) 
-    + ( (o2 == ZERO) ? 1 : 0 ) 
-    + ( (o3 == ZERO) ? 1 : 0 );
-
-  switch (sum) {
-  case 0:
-    {
-      lt = CELL;
-      return ON_BOUNDED_SIDE;
-    }
-  case 1:
-    {
-      lt = FACET;
-      // i = index such that p lies on facet(i)
-      i = ( o0 == ZERO ) ? 0 :
-      ( o1 == ZERO ) ? 1 :
-      ( o2 == ZERO ) ? 2 :
-      3;
-      return ON_BOUNDARY;
-    }
-  case 2:
-    {
-      lt = EDGE;
-      // i = smallest index such that p does not lie on facet(i)
-      // i must be < 3 since p lies on 2 facets
-      i = ( o0 == POSITIVE ) ? 0 :
-      ( o1 == POSITIVE ) ? 1 :
-      2;
-      // j = larger index such that p not on facet(j)
-      // j must be > 0 since p lies on 2 facets
-      j = ( o3 == POSITIVE ) ? 3 :
-      ( o2 == POSITIVE ) ? 2 :
-      1;
-      return ON_BOUNDARY;
-    }
-  case 3:
-    {
-      lt = VERTEX;
-      // i = index such that p does not lie on facet(i)
-      i = ( o0 == POSITIVE ) ? 0 :
-      ( o1 == POSITIVE ) ? 1 :
-      ( o2 == POSITIVE ) ? 2 :
-      3;
-      return ON_BOUNDARY;
-    }
-  default:
-    {
-      // impossible : cannot be on 4 facets for a real tetrahedron
-      CGAL_triangulation_assertion(false);
-      return ON_BOUNDARY;
-    }
-  }
-} // side_of_cell
-
-template< class GT, class TDS >
-template< class CellIt >
-inline void Periodic_3_triangulation_3<GT,TDS>::
-    insert_too_long_edges(Vertex_handle v,
-        const CellIt begin, const CellIt end) {
-  CGAL_triangulation_precondition(number_of_vertices() != 0);
-  // add newly added edges to too_long_edges, if necessary.
-  Point p1,p2;
-  Offset omin;
-  std::pair< Vertex_handle, Vertex_handle > edge_to_add;
-  std::pair< Offset, Offset > edge_to_add_off;
-  std::list<Vertex_handle> empty_list;
-  too_long_edges[v] = empty_list;
-  // Iterate over all cells of the new star.
-  for (CellIt it = begin ; it != end ; ++it) {
-    // Consider all possible vertex pairs.
-    for (int k=0; k<4 ; k++) {
-    for (int j=0; j<4 ; j++) {
-      if (j==k) continue;
-      if (&*((*it)->vertex(j)) > &*((*it)->vertex(k))) continue;
-      // make the offsets canonical (wrt. to some notion)
-      // add to too_long_edges, if not yet added and if "too long"
-      CGAL_triangulation_precondition(
-	  &*((*it)->vertex(j))< &*((*it)->vertex(k)));
-
-      edge_to_add = std::make_pair((*it)->vertex(j), (*it)->vertex(k));
-      
-      p1 = construct_point((*it)->vertex(j)->point(), get_offset(*it, j));
-      p2 = construct_point((*it)->vertex(k)->point(), get_offset(*it, k));
-
-      if ((squared_distance(p1,p2) > edge_length_threshold)
-          && (find(too_long_edges[(*it)->vertex(j)].begin(),
-		  too_long_edges[(*it)->vertex(j)].end(),
-		  edge_to_add.second)
-	      == too_long_edges[(*it)->vertex(j)].end())
-      ){
-        too_long_edges[(*it)->vertex(j)].push_back(edge_to_add.second);
-        too_long_edge_counter++;
-      }
-    } }
-  }
-}
-
-template < class GT, class TDS >
-template < class CellIt >
-inline void Periodic_3_triangulation_3<GT,TDS>::
-    delete_too_long_edges(const CellIt begin, const CellIt end) {
-  std::pair< Vertex_handle, Vertex_handle > edge_to_delete, edge_to_delete2;
-  typename std::list< Vertex_handle >::iterator sit;
-  // Iterate over all cells that are in the star. That means that those cells
-  // are going to be deleted. Therefore, all of them have to be deleted from
-  // too_long_edges, if they are contained in it.
-  for (CellIt it = begin ; it != end ; ++it) {
-    for (int j=0; j<4 ; j++) {
-      for (int k=0; k<4; k++) {
-        if (&*((*it)->vertex(j)) < &*((*it)->vertex(k))) {
-          edge_to_delete = std::make_pair((*it)->vertex(j),(*it)->vertex(k));
-        } else {
-          edge_to_delete = std::make_pair((*it)->vertex(k),(*it)->vertex(j));
-        }
-        Vertex_handle v_no = edge_to_delete.first;
-        sit = find(too_long_edges[v_no].begin(),
-            too_long_edges[v_no].end(),
-            edge_to_delete.second);
-        if (sit != too_long_edges[v_no].end()) {
-          too_long_edges[v_no].erase(sit);
-          too_long_edge_counter--;
-        }
-      }
-    }
-  }
-}
-
-/*! \brief Insert point.
-*
-* Inserts the point p into the triangulation. It assumes that
-* the cell c containing p is already known.
-*
-* Implementation:
-* - some precondition checking
-* - find and mark conflicting cells --> find_conflicts
-* Conflicting cells are stored in the vector cells.
-* - backup hidden points
-* - Delete the edges of the marked cells from too_long_edges
-* - Insert the new vertex in the hole obtained by removing the
-*   conflicting cells (star-approach) --> _tds._insert_in_hole 
-* - find out about offsets
-* - Insert the newly added edges that are "too long"
-*   to too_long_edges
-* - reinsert hidden points
-*/
-template < class GT, class TDS >
-template < class Conflict_tester, class Point_hider >
-inline typename Periodic_3_triangulation_3<GT,TDS>::Vertex_handle
-Periodic_3_triangulation_3<GT,TDS>::periodic_insert(
-    const Point & p, const Offset& o,
-    Locate_type lt, Cell_handle c, const Conflict_tester &tester,
-    Point_hider &hider, Vertex_handle vh)
-{
-  Vertex_handle v;
-  CGAL_triangulation_assertion(number_of_vertices() != 0);
-  CGAL_triangulation_precondition_code(
-      Locate_type lt_assert; int i_assert; int j_assert;);
-  CGAL_triangulation_assertion(side_of_cell(tester.point(),o, c,
-      lt_assert, i_assert, j_assert) != ON_UNBOUNDED_SIDE);
-
-  tester.set_offset(o);
-
-  // This only holds for Delaunay
-  CGAL_triangulation_assertion(lt != VERTEX);
-  CGAL_USE(lt);
-
-  // Choose the periodic copy of tester.point() that is inside c.
-  Offset current_off = get_location_offset(tester, c);
-
-  CGAL_triangulation_assertion(side_of_cell(tester.point(),
-      combine_offsets(o,current_off),c,lt_assert,i_assert,j_assert)
-      != ON_UNBOUNDED_SIDE);
-  // If the new point is not in conflict with its cell, it is hidden.
-  if (!tester.test_initial_cell(c, current_off)) {
-    hider.hide_point(c,p);
-    return Vertex_handle();
-  }
-  // Ok, we really insert the point now.
-  // First, find the conflict region.
-  std::vector<Cell_handle> cells;
-  cells.reserve(32);
-
-  Facet facet;
-
-  find_conflicts(c, current_off, tester,
-      make_triple(Oneset_iterator<Facet>(facet),
-      std::back_inserter(cells),
-      Emptyset_iterator()));
-
-  // Remember the points that are hidden by the conflicting cells,
-  // as they will be deleted during the insertion.
-  hider.set_vertices(cells.begin(), cells.end());
-  
-  if (!is_1_cover())
-    delete_too_long_edges(cells.begin(), cells.end());
-  
-  // Insertion. Attention: facets[0].first MUST be in conflict!
-  // Compute the star and put it into the data structure.
-  // Store the new cells from the star in nbs.
-  v = _tds._insert_in_hole(cells.begin(), cells.end(),
-      facet.first, facet.second);
-  v->set_point(p);
-
-  //TODO: this could be done within the _insert_in_hole without losing any
-  //time because each cell is visited in any case.
-  //- Do timings to argue to modify _insert_in_conflicts if need be
-  //- Find the modified _insert_in_hole in the branch svn history of TDS
-  std::vector<Cell_handle> nbs;
-  incident_cells(v, std::back_inserter(nbs));
-  // For all neighbors of the newly added vertex v: fetch their offsets from
-  // the tester and reset them in the triangulation data structure.
-  for (typename std::vector<Cell_handle>::iterator cit = nbs.begin();
-      cit != nbs.end(); cit++) {
-    Offset off[4];
-    for (int i=0 ; i<4 ; i++) {
-      off[i] = (*cit)->vertex(i)->offset();
-    }
-    set_offsets(*cit, off[0], off[1], off[2], off[3]);
-  }
-  
-  for (typename std::vector<Vertex_handle>::iterator voit = v_offsets.begin();
-      voit != v_offsets.end() ; ++voit) {
-    (*voit)->clear_offset();
-  }
-  v_offsets.clear();
-
-  if (vh != Vertex_handle()) {
-    virtual_vertices[v] = Virtual_vertex(vh,o);
-    virtual_vertices_reverse[vh].push_back(v);
-  }
-
-  if (!is_1_cover())
-    insert_too_long_edges(v, nbs.begin(), nbs.end());
-
-  // Store the hidden points in their new cells.
-  hider.reinsert_vertices(v);
-  return v;
-}
-
-/** Inserts the first point to a triangulation.
-  *
-  * With inserting the first point the 3-sheeted covering is constructed.
-  * So first, the 27 vertices are inserted and are added to virtual_vertices
-  * Then 6*27 cells are created.
-  * Then all links are set.
- */
-template < class GT, class TDS >
-inline typename Periodic_3_triangulation_3<GT,TDS>::Vertex_handle
-Periodic_3_triangulation_3<GT,TDS>::create_initial_triangulation(
-    const Point &p) {
-  /// Virtual vertices, one per periodic domain
-  Vertex_handle vir_vertices[3][3][3];
-  /// Virtual cells, 6 per periodic domain
-  Cell_handle cells[3][3][3][6];
-
-  // Initialise vertices:
-  vir_vertices[0][0][0] = _tds.create_vertex();
-  vir_vertices[0][0][0]->set_point(p);
-  virtual_vertices_reverse[vir_vertices[0][0][0]] =
-std::vector<Vertex_handle>();
-  for (int i=0; i<_cover[0]; i++) {
-    for (int j=0; j<_cover[1]; j++) {
-      for (int k=0; k<_cover[2]; k++) {
-        if ((i!=0)||(j!=0)||(k!=0)) {
-          // Initialise virtual vertices out of the domain for debugging
-          vir_vertices[i][j][k] =
-            _tds.create_vertex();
-          vir_vertices[i][j][k]->set_point(p); //+Offset(i,j,k));
-          virtual_vertices[vir_vertices[i][j][k]] =
-            Virtual_vertex(vir_vertices[0][0][0], Offset(i,j,k));
-          virtual_vertices_reverse[vir_vertices[0][0][0]].push_back(
-            vir_vertices[i][j][k]);
-        }
-        CGAL_triangulation_assertion(vir_vertices[i][j][k] != Vertex_handle());
-        CGAL_triangulation_assertion(vir_vertices[0][0][0]->point() == p);
-      }
-    }
-  }
-
-  // Create cells:
-  for (int i=0; i<_cover[0]; i++) {
-    for (int j=0; j<_cover[1]; j++) {
-      for (int k=0; k<_cover[2]; k++) {
-        for (int l=0; l<6; l++) {
-          // 6 cells per 'cube'
-          cells[i][j][k][l] = _tds.create_cell();
-          for (int n=0; n<4; n++)
-            CGAL_triangulation_assertion(cells[i][j][k][l] != Cell_handle());
-        }
-      }
-    }
-  }
-  // set vertex and neighbor information
-  // index to the right vertex: [number of cells][vertex][offset]
-  int vertex_ind[6][4][3] = {
-    { {0, 0, 0},  {0, 1, 0},  {0, 0, 1},  {1, 0, 0} },
-    { {1, 1, 0},  {0, 1, 1},  {1, 0, 1},  {1, 1, 1} },
-    { {1, 0, 0},  {0, 1, 1},  {0, 1, 0},  {0, 0, 1} },
-    { {1, 0, 0},  {0, 1, 1},  {0, 0, 1},  {1, 0, 1} },
-    { {1, 0, 0},  {0, 1, 1},  {1, 0, 1},  {1, 1, 0} },
-    { {1, 0, 0},  {0, 1, 1},  {1, 1, 0},  {0, 1, 0} }
-  };
-  int neighb_ind[6][4][4] = {
-    { { 0, 0, 0, 2},  { 0,-1, 0, 5},  { 0, 0,-1, 3},  {-1, 0, 0, 4} },
-    { { 0, 0, 1, 5},  { 1, 0, 0, 2},  { 0, 1, 0, 3},  { 0, 0, 0, 4} },
-    { {-1, 0, 0, 1},  { 0, 0, 0, 0},  { 0, 0, 0, 3},  { 0, 0, 0, 5} },
-    { { 0, 0, 1, 0},  { 0,-1, 0, 1},  { 0, 0, 0, 4},  { 0, 0, 0, 2} },
-    { { 0, 0, 0, 1},  { 1, 0, 0, 0},  { 0, 0, 0, 5},  { 0, 0, 0, 3} },
-    { { 0, 1, 0, 0},  { 0, 0,-1, 1},  { 0, 0, 0, 2},  { 0, 0, 0, 4} }
-  };
-  for (int i=0; i<_cover[0]; i++) {
-    for (int j=0; j<_cover[1]; j++) {
-      for (int k=0; k<_cover[2]; k++) {
-        int offset = 
-          (i==_cover[0]-1 ? 4 : 0) | 
-	  (j==_cover[1]-1 ? 2 : 0) | 
-	  (k==_cover[2]-1 ? 1 : 0);
-        for (int l=0; l<6; l++) {
-          // cell 0:
-          cells[i][j][k][l]->set_vertices(
-              vir_vertices
-                [(i+vertex_ind[l][0][0])%_cover[0]]
-                [(j+vertex_ind[l][0][1])%_cover[1]]
-                [(k+vertex_ind[l][0][2])%_cover[2]],
-              vir_vertices
-                [(i+vertex_ind[l][1][0])%_cover[0]]
-                [(j+vertex_ind[l][1][1])%_cover[1]]
-                [(k+vertex_ind[l][1][2])%_cover[2]],
-              vir_vertices
-                [(i+vertex_ind[l][2][0])%_cover[0]]
-                [(j+vertex_ind[l][2][1])%_cover[1]]
-                [(k+vertex_ind[l][2][2])%_cover[2]],
-              vir_vertices
-                [(i+vertex_ind[l][3][0])%_cover[0]]
-                [(j+vertex_ind[l][3][1])%_cover[1]]
-                [(k+vertex_ind[l][3][2])%_cover[2]]);
-          set_offsets(cells[i][j][k][l],
-              offset & (vertex_ind[l][0][0]*4 +
-                        vertex_ind[l][0][1]*2 +
-                        vertex_ind[l][0][2]*1),
-              offset & (vertex_ind[l][1][0]*4 +
-                        vertex_ind[l][1][1]*2 +
-                        vertex_ind[l][1][2]*1),
-              offset & (vertex_ind[l][2][0]*4 +
-                        vertex_ind[l][2][1]*2 +
-                        vertex_ind[l][2][2]*1),
-              offset & (vertex_ind[l][3][0]*4 +
-                        vertex_ind[l][3][1]*2 +
-                        vertex_ind[l][3][2]*1));
-          cells[i][j][k][l]->set_neighbors(
-              cells [(i+_cover[0]+neighb_ind[l][0][0])%_cover[0]]
-                    [(j+_cover[1]+neighb_ind[l][0][1])%_cover[1]]
-                    [(k+_cover[2]+neighb_ind[l][0][2])%_cover[2]]
-                    [         neighb_ind[l][0][3]       ],
-              cells [(i+_cover[0]+neighb_ind[l][1][0])%_cover[0]]
-                    [(j+_cover[1]+neighb_ind[l][1][1])%_cover[1]]
-                    [(k+_cover[2]+neighb_ind[l][1][2])%_cover[2]]
-                    [         neighb_ind[l][1][3]       ],
-              cells [(i+_cover[0]+neighb_ind[l][2][0])%_cover[0]]
-                    [(j+_cover[1]+neighb_ind[l][2][1])%_cover[1]]
-                    [(k+_cover[2]+neighb_ind[l][2][2])%_cover[2]]
-                    [         neighb_ind[l][2][3]       ],
-              cells [(i+_cover[0]+neighb_ind[l][3][0])%_cover[0]]
-                    [(j+_cover[1]+neighb_ind[l][3][1])%_cover[1]]
-                    [(k+_cover[2]+neighb_ind[l][3][2])%_cover[2]]
-                    [         neighb_ind[l][3][3]       ]
-          );
-        }
-      }
-    }
-  }
-  // set pointers from the vertices to incident cells.
-  for (int i=0; i<_cover[0]; i++) {
-    for (int j=0; j<_cover[1]; j++) {
-      for (int k=0; k<_cover[2]; k++) {
-        vir_vertices[i][j][k]->set_cell(cells[i][j][k][0]);
-      }
-    }
-  }
-  
-  _tds.set_dimension(3);
-
-  // create the base for too_long_edges;
-  CGAL_triangulation_assertion( too_long_edges.empty() );
-  CGAL_triangulation_assertion(too_long_edge_counter == 0);
-
-  for (Vertex_iterator vit = vertices_begin() ;
-       vit !=vertices_end() ; ++vit )
-    too_long_edges[vit] = std::list<Vertex_handle>();;
-
-  std::vector<Cell_handle> temp_inc_cells;
-  for (Vertex_iterator vit = vertices_begin() ;
-       vit !=vertices_end() ; ++vit ) {
-    temp_inc_cells.clear();
-    incident_cells(vit, std::back_inserter(temp_inc_cells));
-    for (unsigned int i=0 ; i<temp_inc_cells.size() ; i++) {
-      int k = temp_inc_cells[i]->index(vit);
-      for (int j=0; j<4 ; j++) {
-        if (j==k) continue;
-        if (&*vit > &*(temp_inc_cells[i]->vertex(j))) continue;
-        if ((find(too_long_edges[vit].begin(),
-                  too_long_edges[vit].end(),
-            temp_inc_cells[i]->vertex(j)) ==
-		too_long_edges[vit].end())
-        ){
-	  too_long_edges[vit].push_back(temp_inc_cells[i]->vertex(j));
-          too_long_edge_counter++;
-        }
-      }
-    }
-  }
-  return vir_vertices[0][0][0];
-}
-
-#include <CGAL/Periodic_3_triangulation_dummy_36.h>
-
-/** finds all cells that are in conflict with the currently added point
-  * (stored in tester).
-  *
-  * The result will be a hole of which the following data is returned:
-  * - boundary facets
-  * - cells
-  * - internal facets.
-  *
-  * c is the current cell, which must be in conflict.
-  * tester is the function object that tests if a cell is in conflict.
-  */
-template <class GT, class TDS>
-template <class Conflict_test,
-	  class OutputIteratorBoundaryFacets,
-          class OutputIteratorCells,
-	  class OutputIteratorInternalFacets>
-Triple<OutputIteratorBoundaryFacets,
-       OutputIteratorCells,
-       OutputIteratorInternalFacets>
-Periodic_3_triangulation_3<GT,TDS>::
-find_conflicts(Cell_handle d, const Offset &current_off,
-    const Conflict_test &tester,
-    Triple<OutputIteratorBoundaryFacets,
-    OutputIteratorCells,
-    OutputIteratorInternalFacets> it) const {
-  CGAL_triangulation_precondition( number_of_vertices() != 0 );
-  CGAL_triangulation_precondition( tester(d, current_off) );
-
-  std::stack<std::pair<Cell_handle, Offset> > cell_stack;
-  cell_stack.push(std::make_pair(d,current_off));
-  d->tds_data().mark_in_conflict();  
-  *it.second++ = d;
-
-  do {
-    Cell_handle c = cell_stack.top().first;
-    Offset current_off2 = cell_stack.top().second;
-    cell_stack.pop();
-
-    for (int i=0; i< 4; ++i) {
-      Cell_handle test = c->neighbor(i);
-      if (test->tds_data().is_in_conflict()) {
-	if (c < test) {
-	  *it.third++ = Facet(c, i); // Internal facet.
-	}
-	continue; // test was already in conflict.
-      }
-      if (test->tds_data().is_clear()) {
-	Offset o_test = current_off2 + get_neighbor_offset(c, i, test);
-	if (tester(test,o_test)) {
-	  if (c < test)
-	    *it.third++ = Facet(c, i); // Internal facet.
-	  
-	  cell_stack.push(std::make_pair(test,o_test));
-	  test->tds_data().mark_in_conflict();
-	  *it.second++ = test;
-	  continue;
-	}
-	test->tds_data().mark_on_boundary(); // test is on the boundary.
-      }
-      *it.first++ = Facet(c, i);
-      for (int j = 0 ; j<4 ; j++){
-	if (j==i) continue;
-	if (!c->vertex(j)->get_offset_flag()) {
-	  c->vertex(j)->set_offset(int_to_off(c->offset(j))-current_off2);
-	  v_offsets.push_back(c->vertex(j));
-	}
-      }
-    }
-  } while (!cell_stack.empty());
-  return it;
-}
-
-/*! \brief Insert point into triangulation.
- *
- * Inserts the point p into the triangulation. It expects
- * - a cell to start the point location
- * - a testing function to determine cells in conflict
- * - a testing function to determine if a vertex is hidden.
- *
- * Implementation:
- * - If the triangulation is empty call a special function
- * (create_initial_triangulation) to construct the basic
- * triangulation.
- * - Run point location to get the cell c containing point p.
- * - Call periodic_insert to insert p into the 3-cover.
- * - Also insert the eight periodic copies of p.
- */
-template < class GT, class TDS >
-template < class Conflict_tester, class Point_hider >
-inline typename Periodic_3_triangulation_3<GT,TDS>::Vertex_handle
-Periodic_3_triangulation_3<GT,TDS>::insert_in_conflict(const Point & p,
-    Locate_type lt, Cell_handle c, int li, int lj,
-    const Conflict_tester &tester, Point_hider &hider) {
-
-  CGAL_triangulation_assertion((_domain.xmin() <= p.x())
-      && (p.x() < _domain.xmax()));
-  CGAL_triangulation_assertion((_domain.ymin() <= p.y())
-      && (p.y() < _domain.ymax()));
-  CGAL_triangulation_assertion((_domain.zmin() <= p.z()) 
-      && (p.z() < _domain.zmax()));
-
-  if (number_of_vertices() == 0) {
-    return create_initial_triangulation(p);
-  }
-
-  if ((lt == VERTEX) &&
-      (tester.compare_weight(c->vertex(li)->point(),p)==0) ) {
-    return c->vertex(li);
-  }
-
-  Vertex_handle vstart;
-  if (!is_1_cover()) {
-    Virtual_vertex_map_it vvmit = virtual_vertices.find(c->vertex(0));
-    if (vvmit == virtual_vertices.end())
-      vstart = c->vertex(0);
-    else
-      vstart = vvmit->second.first;
-    CGAL_triangulation_assertion(virtual_vertices.find(vstart)
-	==virtual_vertices.end());
-    CGAL_triangulation_assertion(virtual_vertices_reverse.find(vstart)
-        != virtual_vertices_reverse.end());
-  }
-  CGAL_triangulation_assertion( number_of_vertices() != 0 );
-  CGAL_triangulation_expensive_assertion(is_valid());
-  Vertex_handle vh = periodic_insert(p, Offset(), lt, c, tester, hider);
-  if (is_1_cover()) {
-    return vh;
-  }
-  
-  for (Cell_iterator it = all_cells_begin() ;
-      it != all_cells_end() ; it++){
-    CGAL_triangulation_assertion(it->neighbor(0)->neighbor(
-        it->neighbor(0)->index(it))==it);
-    CGAL_triangulation_assertion(it->neighbor(1)->neighbor(
-        it->neighbor(1)->index(it))==it);
-    CGAL_triangulation_assertion(it->neighbor(2)->neighbor(
-        it->neighbor(2)->index(it))==it);
-    CGAL_triangulation_assertion(it->neighbor(3)->neighbor(
-        it->neighbor(3)->index(it))==it);
-  }
-
-  std::vector<Vertex_handle> start_vertices
-      = virtual_vertices_reverse.find(vstart)->second;
-  Cell_handle start;
-  virtual_vertices_reverse[vh] = std::vector<Vertex_handle>();
-  // insert 26 periodic copies
-  for (int i=0; i<_cover[0]; i++) {
-    for (int j=0; j<_cover[1]; j++) {
-      for (int k=0; k<_cover[2]; k++) {
-        if ((i!=0)||(j!=0)||(k!=0)) {
-          start = start_vertices[i*9+j*3+k-1]->cell();
-          c = periodic_locate(p, Offset(i,j,k), lt, li, lj, start);
-          periodic_insert(p, Offset(i,j,k), lt, c, tester, hider,vh);
-        }
-      }
-    }
-  }
-  CGAL_triangulation_expensive_assertion(is_valid());
-
-  // Fall back to 1-cover if the criterion that the longest edge is shorter
-  // than sqrt(0.166) is fulfilled.
-  if ( too_long_edge_counter == 0 ) {
-    CGAL_triangulation_expensive_assertion(is_valid());
-    convert_to_1_sheeted_covering();
-    CGAL_triangulation_expensive_assertion( is_valid() );
-  }
-  return vh;
-}
-
-/// tests if two vertices of one cell are just periodic copies of each other
-template < class GT, class TDS >
-inline bool Periodic_3_triangulation_3<GT,TDS>::has_self_edges(Cell_handle c) const {
-  CGAL_triangulation_assertion((c->vertex(0) != c->vertex(1)) || 
-      (c->offset(0) != c->offset(1)));
-  CGAL_triangulation_assertion((c->vertex(0) != c->vertex(2)) || 
-      (c->offset(0) != c->offset(2)));
-  CGAL_triangulation_assertion((c->vertex(0) != c->vertex(3)) || 
-      (c->offset(0) != c->offset(3)));
-  CGAL_triangulation_assertion((c->vertex(1) != c->vertex(2)) || 
-      (c->offset(1) != c->offset(2)));
-  CGAL_triangulation_assertion((c->vertex(1) != c->vertex(3)) || 
-      (c->offset(1) != c->offset(3)));
-  CGAL_triangulation_assertion((c->vertex(2) != c->vertex(3)) || 
-      (c->offset(2) != c->offset(3)));
-  return ((c->vertex(0) == c->vertex(1)) ||
-      (c->vertex(0) == c->vertex(2)) ||
-      (c->vertex(0) == c->vertex(3)) ||
-      (c->vertex(1) == c->vertex(2)) ||
-      (c->vertex(1) == c->vertex(3)) ||
-      (c->vertex(2) == c->vertex(3)));
-}
-
-/*! \brief Tests if the triangulation is valid.
- *
- * A triangulation is valid if
- * - A cell is not its own neighbor.
- * - A cell has no two equal neighbors
- * - A cell has no two equal vertex-offset pairs
- * - A cell is positively oriented.
- * - The point of a neighbor of cell c that does not belong to c is not inside
- *   the circumcircle of c.
- */
-template < class GT, class TDS >
-bool
-Periodic_3_triangulation_3<GT,TDS>::
-is_valid(bool verbose, int level) const {
-  bool error = false;
-  for (Cell_iterator cit = cells_begin();
-       cit != cells_end(); ++cit) {
-    for (int i=0; i<4; i++) {
-      CGAL_triangulation_assertion(cit != cit->neighbor(i));
-      for (int j=i+1; j<4; j++) {
-        CGAL_triangulation_assertion(cit->neighbor(i) != cit->neighbor(j));
-        CGAL_triangulation_assertion(cit->vertex(i) != cit->vertex(j));
-      }
-    }
-    // Check positive orientation:
-    const Point *p[4]; Offset off[4];
-    for (int i=0; i<4; i++) {
-      p[i] = &cit->vertex(i)->point();
-      off[i] = get_offset(cit,i);
-    }
-    if (orientation(*p[0], *p[1], *p[2], *p[3],
-                   off[0], off[1], off[2], off[3]) != POSITIVE) {
-      if (verbose) {
-	std::cerr<<"Periodic_3_triangulation_3: wrong orientation:"<<std::endl;
-	std::cerr<<off[0]<<'\t'<<*p[0]<<'\n'
-		 <<off[1]<<'\t'<<*p[1]<<'\n'
-		 <<off[2]<<'\t'<<*p[2]<<'\n'
-		 <<off[3]<<'\t'<<*p[3]<<std::endl;
-      }
-      error = true;
-    }
-  }
-
-  if (!has_self_edges()) {
-    if (! _tds.is_valid(verbose, level) ) {
-      return false;
-    }
-  }
-
-  return !error;
-}
-
-template < class GT, class TDS >
-bool Periodic_3_triangulation_3<GT,TDS>::is_valid(Cell_handle ch,
-    bool verbose, int level) const {
-  if ( ! _tds.is_valid(ch,verbose,level) )
-    return false;
-  bool error = false;
-  const Point *p[4]; Offset off[4];
-  for (int i=0; i<4; i++) {
-    p[i] = &ch->vertex(i)->point();
-    off[i] = get_offset(ch,i);
-  }
-  if (orientation(*p[0], *p[1], *p[2], *p[3], 
-		  off[0], off[1], off[2], off[3]) != POSITIVE) {
-    error = true;
-  }
-  
-  return !error;
-}
-
-template < class GT, class TDS >
-template < class ConflictTester >
-bool Periodic_3_triangulation_3<GT,TDS>::
-is_valid_conflict(ConflictTester &tester, bool verbose, int level) const {
-  Cell_iterator it;
-  for ( it = cells_begin(); it != cells_end(); ++it ) {
-    is_valid(it, verbose, level);
-    for (int i=0; i<4; i++ ) {
-      Offset o_nb = get_neighbor_offset(it,i,it->neighbor(i));
-      Offset o_vt = get_offset(it->neighbor(i),
-				      it->neighbor(i)->index(it));
-      if (tester(it,
-		 it->neighbor(i)->vertex(it->neighbor(i)->index(it))->point(),
-		 o_vt-o_nb)) {
-        if (verbose)
-          std::cerr << "non-empty sphere: "
-              <<it->vertex(0)->point()<<'\t'
-              <<it->vertex(1)->point()<<'\t'
-              <<it->vertex(2)->point()<<'\t'
-              <<it->vertex(3)->point()<<'\n'
-	      <<it->neighbor(i)->vertex(it->neighbor(i)->index(it))->point()
-              <<'\t'<<o_vt-o_nb
-              << std::endl;
-        return false;
-      }
-    }
-  }
-  return true;
-}
-
-template < class GT, class TDS >
-inline void Periodic_3_triangulation_3<GT,TDS>::make_hole(Vertex_handle v, 
-    std::map<Vertex_triple,Facet> &outer_map, std::vector<Cell_handle> &hole) {
-  
-  //CGAL_triangulation_precondition( all_vertices_begin()++ 
-  //    != all_vertices_end() );
-  
-  incident_cells(v, std::back_inserter(hole));
-
-  for (typename std::vector<Cell_handle>::iterator cit = hole.begin();
-       cit != hole.end(); ++cit) {
-    int indv = (*cit)->index(v);
-    Cell_handle opp_cit = (*cit)->neighbor( indv );
-    Facet f(opp_cit, opp_cit->index(*cit)); 
-    Vertex_triple vt = make_vertex_triple(f);
-    make_canonical(vt);
-    outer_map[vt] = f;
-    for (int i=0; i<4; i++)
-      if ( i != indv )
-        (*cit)->vertex(i)->set_cell(opp_cit);
-  }
-}
-
-/*! \brief Remove a vertex from the triangulation.
- *
- * Removes vertex v from the triangulation.
- */
-template < class GT, class TDS >
-template < class PointRemover, class Conflict_tester>
-inline void Periodic_3_triangulation_3<GT,TDS>::remove(Vertex_handle v,
-    PointRemover &r, Conflict_tester &t) {
-  CGAL_expensive_precondition(is_vertex(v));
-  std::vector<Vertex_handle> vhrem;
-  if (!is_1_cover()) {
-    if (number_of_vertices() == 1) {
-      clear();
-      return;
-    }
-    Virtual_vertex_map_it vvmit = virtual_vertices.find(v);
-    if (vvmit != virtual_vertices.end()) v = vvmit->second.first;
-    CGAL_triangulation_assertion(virtual_vertices_reverse.find(v)
-        != virtual_vertices_reverse.end());
-    vhrem = virtual_vertices_reverse.find(v)->second;
-    virtual_vertices_reverse.erase(v);
-    CGAL_triangulation_assertion(vhrem.size()==26);
-    for (int i=0 ; i<26 ; i++) {
-      periodic_remove(vhrem[i],r);
-      virtual_vertices.erase(vhrem[i]);
-      CGAL_triangulation_expensive_assertion(is_valid());
-    }
-    periodic_remove(v,r);
-  } else {
-    periodic_remove(v,r);
-    if (!is_1_cover()) remove(v,r,t);
-  }
-  
-}
-
-/*! \brief Remove a vertex from the triangulation.
- *
- * Removes vertex v from the triangulation.
- * It expects a reference to an instance of a PointRemover.
- * 
- * Implementation:
- * - Compute the hole, that is, all cells incident to v. Cells outside of
- *   this hole are not affected by the deletion of v.
- * - Triangulate the hole. This is done computing the triangulation
- *   in Euclidean space for the points on the border of the hole.
- * - Sew this triangulation into the hole.
- * - Test for all newly added edges, whether they are shorter than the
- *   edge_length_threshold. If not, convert to 3-cover.
- */
-template < class GT, class TDS >
-template < class PointRemover >
-inline void Periodic_3_triangulation_3<GT,TDS>::periodic_remove(Vertex_handle v,
-    PointRemover &remover) {
-
-  // Construct the set of vertex triples on the boundary
-  // with the facet just behind
-  typedef std::map<Vertex_triple,Facet> Vertex_triple_Facet_map;
-  typedef PointRemover Point_remover;
-  typedef typename Point_remover::CellE_handle    CellE_handle;
-  typedef typename Point_remover::VertexE_handle  VertexE_handle;
-  typedef typename Point_remover::FacetE          FacetE;
-  typedef typename Point_remover::VertexE_triple  VertexE_triple;
-  typedef typename Point_remover::Finite_cellsE_iterator
-      Finite_cellsE_iterator;
-  typedef typename Point_remover::Vertex_triple_FacetE_map
-      Vertex_triple_FacetE_map;
-
-  // First compute the hole and its boundary vertices.
-  std::vector<Cell_handle> hole;
-  hole.reserve(64);
-  Vertex_triple_Facet_map outer_map;
-  Vertex_triple_FacetE_map inner_map;
-
-  make_hole(v, outer_map, hole);
-
-  CGAL_triangulation_assertion(outer_map.size()==hole.size());
-  CGAL_triangulation_assertion(remover.hidden_points_begin() == 
-      remover.hidden_points_end());
-
-  if (!is_1_cover()) {
-    delete_too_long_edges(hole.begin(), hole.end());
-  }
-  
-  // Output the hidden points.
-  for (typename std::vector<Cell_handle>::iterator
-      hi = hole.begin(), hend = hole.end(); hi != hend; ++hi)
-  {
-    remover.add_hidden_points(*hi);
-  }
-
-  // Build up the map between Vertices on the boundary and offsets
-  // collect all vertices on the boundary
-  std::vector<Vertex_handle> vertices;
-  vertices.reserve(64);
-
-  // The set is needed to ensure that each vertex is inserted only once.
-  std::set<Vertex_handle> tmp_vertices;
-  // The map connects vertices to offsets in the hole
-  std::map<Vertex_handle, Offset> vh_off_map;
-
-  for(typename std::vector<Cell_handle>::iterator cit = hole.begin();
-      cit != hole.end(); ++cit)
-  {
-    // Put all incident vertices in tmp_vertices.
-    for (int j=0; j<4; ++j){
-      if ((*cit)->vertex(j) != v){
-        tmp_vertices.insert((*cit)->vertex(j));
-        vh_off_map[(*cit)->vertex(j)] = int_to_off((*cit)->offset(j))
-            - int_to_off((*cit)->offset((*cit)->index(v)));
-      }
-    }
-  }
-
-  // Now output the vertices.
-  std::copy(tmp_vertices.begin(), tmp_vertices.end(),
-      std::back_inserter(vertices));
-
-  // create a Delaunay/Regular triangulation of the points on the boundary
-  // in Euclidean space and make a map from the vertices in remover.tmp
-  // towards the vertices in *this
-  
-  Unique_hash_map<VertexE_handle,Vertex_handle> vmap;
-  CellE_handle ch;
-  remover.tmp.clear();
-  
-  for(unsigned int i=0; i < vertices.size(); i++){
-    typedef typename Point_remover::Triangulation_R3::Point TRPoint;
-    CGAL_triangulation_assertion(get_offset(vertices[i])
-	+ combine_offsets(Offset(), vh_off_map[vertices[i]])
-	== combine_offsets(get_offset(vertices[i]),vh_off_map[vertices[i]]));
-    TRPoint trp = std::make_pair(vertices[i]->point(),
-	combine_offsets( get_offset(vertices[i]), vh_off_map[vertices[i]]) );
-    VertexE_handle vh = remover.tmp.insert(trp, ch);
-    vmap[vh] = vertices[i];
-    CGAL_triangulation_assertion(vmap.is_defined(vh));
-  }
-  CGAL_triangulation_assertion(remover.tmp.number_of_vertices() != 0);
-
-  // Construct the set of vertex triples of tmp
-  // We reorient the vertex triple so that it matches those from outer_map
-  // Also note that we use the vertices of *this, not of tmp
-  for(Finite_cellsE_iterator it = remover.tmp.finite_cells_begin();
-      it != remover.tmp.finite_cells_end();
-      ++it){
-    VertexE_triple vt_aux;
-    for(int i=0; i < 4; i++){
-      FacetE f = std::pair<CellE_handle,int>(it,i);
-      vt_aux = VertexE_triple(
-          f.first->vertex(vertex_triple_index(f.second,0)),
-          f.first->vertex(vertex_triple_index(f.second,1)),
-          f.first->vertex(vertex_triple_index(f.second,2)));
-      if (vmap.is_defined(vt_aux.first)
-          && vmap.is_defined(vt_aux.second)
-          && vmap.is_defined(vt_aux.third) ) {
-        Vertex_triple vt(vmap[vt_aux.first],vmap[vt_aux.third],
-            vmap[vt_aux.second]);
-        make_canonical(vt);
-        inner_map[vt]= f;
-      }
-    }
-  }
-
-  // A structure for storing the new neighboring relations
-  typedef boost::tuple<Cell_handle, int, Cell_handle> Neighbor_relation;
-  std::vector<Neighbor_relation> nr_vec;
-  std::vector<Cell_handle> new_cells;
-
-  // Grow inside the hole, by extending the surface
-  while(! outer_map.empty()){
-    typename Vertex_triple_Facet_map::iterator oit = outer_map.begin();
-    
-    typename Vertex_triple_Facet_map::value_type o_vt_f_pair = *oit;
-    Cell_handle o_ch = o_vt_f_pair.second.first;
-    unsigned int o_i = o_vt_f_pair.second.second;
-    
-    typename Vertex_triple_FacetE_map::iterator iit =
-        inner_map.find(o_vt_f_pair.first);
-    
-    CGAL_triangulation_assertion(iit != inner_map.end());
-    typename Vertex_triple_FacetE_map::value_type i_vt_f_pair = *iit;
-    CellE_handle i_ch = i_vt_f_pair.second.first;
-    unsigned int i_i = i_vt_f_pair.second.second;
-    
-    // create a new cell to glue to the outer surface
-    Cell_handle new_ch = _tds.create_cell();
-    new_cells.push_back(new_ch);
-    new_ch->set_vertices(vmap[i_ch->vertex(0)], vmap[i_ch->vertex(1)],
-                        vmap[i_ch->vertex(2)], vmap[i_ch->vertex(3)]);
-    set_offsets(new_ch, vh_off_map[vmap[i_ch->vertex(0)]],
-                        vh_off_map[vmap[i_ch->vertex(1)]],
-                        vh_off_map[vmap[i_ch->vertex(2)]],
-                        vh_off_map[vmap[i_ch->vertex(3)]]);
-    
-    // Update the edge length management
-    for( int i=0 ; i < 4 ; i++ ) {
-      for (int j=0 ; j < 4 ; j++) {
-        if (j==i) continue;
-        if (&*(new_ch->vertex(i)) > &*(new_ch->vertex(j))) continue;
-
-	Point p1 = construct_point(new_ch->vertex(i)->point(),
-	    get_offset(new_ch, i));
-	Point p2 = construct_point(new_ch->vertex(j)->point(),
-	    get_offset(new_ch, j));
-        Vertex_handle v_no = new_ch->vertex(i);
-
-        if (squared_distance(p1,p2) > edge_length_threshold) {
-	  // If the cell does not fulfill the edge-length criterion
-	  // revert all changes to the triangulation and transform it
-	  // to a triangulation in the needed covering space.
-          if (is_1_cover()) {
-	    _tds.delete_cells(new_cells.begin(), new_cells.end());
-	    convert_to_27_sheeted_covering();
-            return;
-          }
-          else if (find(too_long_edges[v_no].begin(),
-			too_long_edges[v_no].end(),
-			new_ch->vertex(j))
-		   == too_long_edges[v_no].end()) {
-            too_long_edges[v_no].push_back(new_ch->vertex(j));
-            too_long_edge_counter++;
-          }
-        }
-      }
-    }
-
-    // The neighboring relation needs to be stored temporarily in
-    // nr_vec. It cannot be applied directly because then we could not
-    // easily cancel the removing process if a cell is encountered
-    // that does not obey the edge-length criterion.
-    nr_vec.push_back(boost::make_tuple(o_ch,o_i,new_ch));
-    nr_vec.push_back(boost::make_tuple(new_ch,i_i,o_ch));
-
-    // for the other faces check, if they can also be glued
-    for(unsigned int i = 0; i < 4; i++){
-      if(i != i_i){
-	Facet f = std::pair<Cell_handle,int>(new_ch,i);
-        Vertex_triple vt = make_vertex_triple(f);
-        make_canonical(vt);
-        std::swap(vt.second,vt.third);
-        typename Vertex_triple_Facet_map::iterator oit2 = outer_map.find(vt);
-        if(oit2 == outer_map.end()){
-          std::swap(vt.second,vt.third);
-          outer_map[vt]= f;
-        } else {
-        // glue the faces
-          typename Vertex_triple_Facet_map::value_type o_vt_f_pair2 = *oit2;
-          Cell_handle o_ch2 = o_vt_f_pair2.second.first;
-          int o_i2 = o_vt_f_pair2.second.second;
-	  nr_vec.push_back(boost::make_tuple(o_ch2,o_i2,new_ch));
-	  nr_vec.push_back(boost::make_tuple(new_ch,i,o_ch2));
-          outer_map.erase(oit2);
-        }
-      }
-    }
-    outer_map.erase(oit);
-  }
-
-  // finally set the neighboring relations
-  for (unsigned int i=0 ; i<nr_vec.size() ; i++) {
-    nr_vec[i].template get<0>()->set_neighbor(nr_vec[i].template get<1>(),nr_vec[i].template get<2>());
-  }
-  
-  _tds.delete_vertex(v);
-  _tds.delete_cells(hole.begin(), hole.end());
-  CGAL_triangulation_expensive_assertion(is_valid());
-}
-
-// ############################################################################
-// ############################################################################
-// ############################################################################
-template < class GT, class TDS >
-template < class Cmp >
-class Periodic_3_triangulation_3<GT, TDS>::Perturbation_order {
-
-  typedef GT Geometric_traits;
-  typedef typename Geometric_traits::Point_3 Point;
-  typedef typename Geometric_traits::Compare_xyz_3 Compare_xyz_3;
-  typedef typename Periodic_3_triangulation_3<GT, TDS>::Periodic_point
-      Periodic_point;
-  
-  Cmp _cmp;
-
-public:
-  Perturbation_order(const Cmp & cmp) : _cmp(cmp) {}
-
-  bool operator()(const Periodic_point *p, const Periodic_point *q) const {
-    return (_cmp(p->first, q->first, p->second, q->second) == SMALLER);
-  }
-};
-
-// ############################################################################
-// ############################################################################
-// ############################################################################
-
-/** \brief Delete each redundant cell and the not anymore needed data
- *  structures.
- * 
- *  This function consists of four iterations over all cells and one
- *  iteration over all vertices:
- *  1. cell iteration: mark all cells that are to delete
- *  2. cell iteration: redirect neighbors of remaining cells
- *  3. cell iteration: redirect vertices of remaining cells
- *  4. cell iteration: delete all cells marked in the 1. iteration
- *  Vertex iteration: delete all vertices outside the original domain.
- */
-template < class GT, class TDS >
-inline void 
-Periodic_3_triangulation_3<GT,TDS>::convert_to_1_sheeted_covering() {
-  // ###################################################################
-  // ### First cell iteration ##########################################
-  // ###################################################################
-  {
-    if (is_1_cover()) return;
-    bool to_delete, has_simplifiable_offset;
-    Virtual_vertex_map_it vvmit;
-    // First iteration over all cells: Mark the cells that are to delete.
-    // Cells are to delete if they cannot be translated anymore in the
-    // direction of one of the axes without yielding negative offsets.
-    for( Cell_iterator it = all_cells_begin() ;
-    it != all_cells_end() ; ++it ) {
-      to_delete = false;
-      // for all directions in 3D Space
-      for( int j=0 ; j<3 ; j++ ) {
-        has_simplifiable_offset = true;
-        // for all vertices of cell it
-        for( int i=0 ; i<4 ; i++ ) {
-          vvmit = virtual_vertices.find(it->vertex(i));
-          // if it->vertex(i) lies inside the original domain:
-          if (vvmit == virtual_vertices.end()) {
-            // the cell cannot be moved any more because if we did, then
-            // it->vertex(i) will get at least one negative offset.
-            has_simplifiable_offset = false;
-            // if it->vertex(i) lies outside the original domain:
-          } else {
-            // The cell can certainly be deleted if the offset contains a 2
-            to_delete = to_delete
-                || (vvmit->second.second[j] == 2) ;
-            // The cell can be moved into one direction only if the offset of
-            // all for vertices is >=1 for this direction. Since we already
-            // tested for 2 it is sufficient to test here for 1.
-            has_simplifiable_offset = has_simplifiable_offset
-                && (vvmit->second.second[j] == 1) ;
-          }
-        } 
-        // if the offset can be simplified, i.e. the cell can be moved, then
-        // it can be deleted.
-        if (has_simplifiable_offset)
-          to_delete = true;
-      }
-      // Mark all cells that are to delete. They cannot be deleted yet,
-      // because neighboring information still needs to be extracted.
-      if (to_delete) {
-        it->set_additional_flag(1);
-      }
-    }
-  }
-
-  // ###################################################################
-  // ### Second cell iteration #########################################
-  // ###################################################################
-  {
-    Vertex_handle vert[4], nbv[4];
-    Offset off[4];
-    Cell_handle nb, new_neighbor;
-    std::vector<Triple<Cell_handle, int, Cell_handle> > new_neighbor_relations;
-
-    // Second iteration over all cells: redirect neighbors where necessary
-    for (Cell_iterator it = all_cells_begin() ;
-        it != all_cells_end() ; ++it) {
-      // Skip all cells that are to delete.
-      if (it->get_additional_flag() == 1) continue;
-      
-      // Redirect neighbors: Only neighbors that are marked by the
-      // additional_flag have to be substituted by one of their periodic
-      // copies. The unmarked neighbors stay the same.
-      for ( int i = 0 ; i < 4 ; i++ ) {
-        if ( it->neighbor(i)->get_additional_flag() != 1 ) continue;
-        
-        nb = it->neighbor(i);
-        
-        for ( int j = 0 ; j < 4 ; j++ ) {
-          off[j] = Offset();
-          get_vertex( nb, j, vert[j], off[j]);
-        }
-        int x,y,z;
-        x = (std::min) ( (std::min) ( off[0][0], off[1][0] ),
-            (std::min) ( off[2][0], off[3][0] ) );
-        y = (std::min) ( (std::min) ( off[0][1], off[1][1] ),
-            (std::min) ( off[2][1], off[3][1] ) );
-        z = (std::min) ( (std::min) ( off[0][2], off[1][2] ),
-            (std::min) ( off[2][2], off[3][2] ) );
-        
-        // The vector from nb to the "original" periodic copy of nb, that is
-        // the copy that will not be deleted.
-        Offset difference_offset(x,y,z);
-        CGAL_triangulation_assertion( !difference_offset.is_null() );
-        
-        // We now have to find the "original" periodic copy of nb from
-        // its vertices. Therefore, we first have to find the vertices.
-        for ( int j = 0 ; j < 4 ; j++ ) {
-          CGAL_triangulation_assertion( (off[j]-difference_offset)[0] >= 0);
-          CGAL_triangulation_assertion( (off[j]-difference_offset)[1] >= 0);
-          CGAL_triangulation_assertion( (off[j]-difference_offset)[2] >= 0);
-          CGAL_triangulation_assertion( (off[j]-difference_offset)[0] < 3);
-          CGAL_triangulation_assertion( (off[j]-difference_offset)[1] < 3);
-          CGAL_triangulation_assertion( (off[j]-difference_offset)[2] < 3);
-          
-          // find the Vertex_handles of the vertices of the "original"
-          // periodic copy of nb. If the vertex is inside the original
-          // domain, there is nothing to do
-          if ( (off[j]-difference_offset).is_null() ) {
-            nbv[j] = vert[j];
-            // If the vertex is outside the original domain, we have to search
-            // in virtual_vertices in the "wrong" direction. That means, we
-            // cannot use virtual_vertices.find but have to use
-            // virtual_vertices_reverse.
-          } else {
-            Offset nbo = off[j]-difference_offset;
-            nbv[j] = virtual_vertices_reverse.find(vert[j])
-              ->second[nbo[0]*9+nbo[1]*3+nbo[2]-1];
-          }
-        }
-        // Find the new neighbor by its 4 vertices
-        new_neighbor = get_cell( nbv );
-        
-        // Store the new neighbor relation. This cannot be applied yet because
-        // it would disturb the functioning of get_cell( ... )
-        new_neighbor_relations.push_back(make_triple(it, i, new_neighbor));
-      }
-    }
-    // Apply the new neighbor relations now.
-    for (unsigned int i=0 ; i<new_neighbor_relations.size() ; i++){
-      new_neighbor_relations[i].first->set_neighbor(
-          new_neighbor_relations[i].second,
-          new_neighbor_relations[i].third);
-    }
-  }
-  
-  // ###################################################################
-  // ### Third cell iteration ##########################################
-  // ###################################################################
-  {
-    Vertex_handle vert[4];
-    Offset off[4];
-    // Third iteration over all cells: redirect vertices where necessary
-    for (Cell_iterator it = all_cells_begin() ;
-        it != all_cells_end() ; ++it) {
-      // Skip all cells that are marked to delete
-      if (it->get_additional_flag() == 1) continue;
-      // Find the corresponding vertices of it in the original domain
-      // and set them as new vertices of it.
-      for ( int i = 0 ; i < 4 ; i++ ) {
-        off[i] = Offset();
-        get_vertex( it, i, vert[i], off[i]);
-        it->set_vertex( i, vert[i]);
-        CGAL_triangulation_assertion(vert[i]->point()[0] < _domain.xmax());
-        CGAL_triangulation_assertion(vert[i]->point()[1] < _domain.ymax());
-        CGAL_triangulation_assertion(vert[i]->point()[2] < _domain.zmax());
-        CGAL_triangulation_assertion(vert[i]->point()[0] >= _domain.xmin());
-        CGAL_triangulation_assertion(vert[i]->point()[1] >= _domain.ymin());
-        CGAL_triangulation_assertion(vert[i]->point()[2] >= _domain.zmin());
-        
-        // redirect also the cell pointer of the vertex.
-        it->vertex(i)->set_cell(it);
-      }
-      // Set the offsets.
-      set_offsets(it, off[0], off[1], off[2], off[3] );
-      CGAL_triangulation_assertion( int_to_off(it->offset(0)) == off[0] );
-      CGAL_triangulation_assertion( int_to_off(it->offset(1)) == off[1] );
-      CGAL_triangulation_assertion( int_to_off(it->offset(2)) == off[2] );
-      CGAL_triangulation_assertion( int_to_off(it->offset(3)) == off[3] );
-    }
-  }
-  
-  // ###################################################################
-  // ### Fourth cell iteration #########################################
-  // ###################################################################
-  {
-    // Delete the marked cells.
-    std::vector<Cell_handle> cells_to_delete;
-    for ( Cell_iterator cit = all_cells_begin() ;
-    cit != all_cells_end() ; ++cit ) {
-      if ( cit->get_additional_flag() == 1 )
-        cells_to_delete.push_back( cit );
-    }
-    _tds.delete_cells(cells_to_delete.begin(), cells_to_delete.end());
-  }
-  
-  // ###################################################################
-  // ### Vertex iteration ##############################################
-  // ###################################################################
-  {
-    // Delete all the vertices in virtual_vertices, that is all vertices
-    // outside the original domain.
-    std::vector<Vertex_handle> vertices_to_delete;
-    for ( Vertex_iterator vit = all_vertices_begin() ;
-	  vit != all_vertices_end() ; ++vit ) {
-      if ( virtual_vertices.count( vit ) != 0 ) {
-        CGAL_triangulation_assertion( virtual_vertices.count( vit ) == 1 );
-        vertices_to_delete.push_back( vit ) ;
-      }
-    }
-    _tds.delete_vertices(vertices_to_delete.begin(), vertices_to_delete.end());
-  }
-  _cover = make_array(1,1,1);
-  virtual_vertices.clear();
-  virtual_vertices_reverse.clear();
-}
-
-template < class GT, class TDS >
-inline void
-Periodic_3_triangulation_3<GT,TDS>::convert_to_27_sheeted_covering() {
-  if (_cover == make_array(3,3,3)) return;
-  CGAL_triangulation_precondition(is_1_cover());
-
-  // Create 27 copies of each vertex and write virtual_vertices and
-  // virtual_vertices_reverse
-  std::list<Vertex_handle> original_vertices;
-  // try to use std::copy instead of the following loop.
-  for (Vertex_iterator vit = vertices_begin() ; vit != vertices_end() ; ++vit)
-    original_vertices.push_back(vit);
-  for (typename std::list<Vertex_handle>::iterator vit
-	 = original_vertices.begin() ; vit != original_vertices.end() ; ++vit) {
-    Vertex_handle v_cp;
-    std::vector<Vertex_handle> copies;
-    for (int i=0; i<3; i++)
-      for (int j=0; j<3; j++)
-	for (int k=0; k<3; k++) {
-	  if (i==0 && j==0 && k==0) continue;
-	  v_cp = _tds.create_vertex(*vit);
-	  copies.push_back(v_cp);
-	  virtual_vertices.insert(std::make_pair(v_cp,
-	      std::make_pair(*vit,Offset(i,j,k))));
-	}
-    virtual_vertices_reverse.insert(std::make_pair(*vit,copies));
-  }
-
-  // Create 27 copies of each cell from the respective copies of the
-  // vertices and write virtual_cells and virtual_cells_reverse.
-  typedef std::map<Cell_handle, std::pair<Cell_handle, Offset> >
-    Virtual_cell_map;
-  typedef std::map<Cell_handle, std::vector<Cell_handle > >
-    Virtual_cell_reverse_map;
-  typedef typename Virtual_cell_reverse_map::const_iterator VCRMIT;
-
-  Virtual_cell_map virtual_cells;
-  Virtual_cell_reverse_map virtual_cells_reverse;
-  
-  std::list<Cell_handle> original_cells;
-  for (Cell_iterator cit = cells_begin() ; cit != cells_end() ; ++cit)
-    original_cells.push_back(cit);
-
-  // Store vertex offsets in a separate data structure
-  std::list< Offset > off_v;
-  for (typename std::list<Vertex_handle>::iterator vit
-	 = original_vertices.begin() ; vit != original_vertices.end() ; ++vit) {
-    Cell_handle ccc = (*vit)->cell();
-    int v_index = ccc->index(*vit);
-    off_v.push_back(int_to_off(ccc->offset(v_index)));
-  }
-
-  // Store neighboring offsets in a separate data structure
-  std::list< array<Offset,4> > off_nb;
-  for (typename std::list<Cell_handle>::iterator cit = original_cells.begin() ;
-       cit != original_cells.end() ; ++cit) {
-    array<Offset,4> off_nb_c;
-    for (int i=0; i<4; i++){
-      Cell_handle ccc = *cit;
-      Cell_handle nnn = ccc->neighbor(i);
-      off_nb_c[i] = get_neighbor_offset(ccc,i,nnn);
-    }
-    off_nb.push_back(off_nb_c);
-  }
-
-  // Create copies of cells
-  for (typename std::list<Cell_handle>::iterator cit = original_cells.begin() ;
-       cit != original_cells.end() ; ++cit) {
-    Cell_handle c_cp;
-    Vertex_handle v0,v1,v2,v3;
-    std::vector<Cell_handle> copies;
-    Virtual_vertex_reverse_map_it vvrmit[4];
-    Offset vvoff[4];
-    for (int i=0; i<4; i++) {
-	vvrmit[i] = virtual_vertices_reverse.find((*cit)->vertex(i));
-	CGAL_triangulation_assertion(
-	    vvrmit[i] != virtual_vertices_reverse.end());
-	vvoff[i] = int_to_off((*cit)->offset(i));
-    }
-    Vertex_handle vvh[4];
-    for (int n=0; n<26; n++) {
-      for (int i=0; i<4; i++) {
-	// Decomposition of n into an offset (nx,ny,nz):
-	// nx = (n+1)/9, ny = ((n+1)/3)%3, nz = (n+1)%3
-	int o_i = ((n+1)/9+vvoff[i].x()+3)%3;
-	int o_j = ((n+1)/3+vvoff[i].y()+3)%3;
-	int o_k = ((n+1)+vvoff[i].z()+3)%3;
-	int n_c = 9*o_i+3*o_j+o_k-1;
-	CGAL_triangulation_assertion(n_c >= -1);
-	if (n_c == -1) vvh[i] = (*cit)->vertex(i);
-	else           vvh[i] = vvrmit[i]->second[n_c];
-      }
-      c_cp = _tds.create_cell(vvh[0], vvh[1], vvh[2], vvh[3]);
-      copies.push_back(c_cp);
-    }
-    virtual_cells_reverse.insert(std::make_pair(*cit,copies));
-  }
-
-  // Set new vertices of boundary cells of the original domain.
-  for (typename std::list<Cell_handle>::iterator cit = original_cells.begin() ;
-       cit != original_cells.end() ; ++cit) {
-    for (int i=0; i<4; i++) {
-      Virtual_vertex_reverse_map_it vvrmit
-	= virtual_vertices_reverse.find((*cit)->vertex(i));
-      CGAL_triangulation_assertion(vvrmit != virtual_vertices_reverse.end());
-      Offset vvoff = int_to_off((*cit)->offset(i));
-      if (!vvoff.is_null()) {
-	int n_c = 9*vvoff.x()+3*vvoff.y()+vvoff.z()-1;
-	CGAL_triangulation_assertion(n_c >= 0);
-	CGAL_triangulation_assertion(static_cast<unsigned int>(n_c) 
-	    < vvrmit->second.size());
-	(*cit)->set_vertex(i,vvrmit->second[n_c]);
-      }
-    }
-  }
-
-  // Set neighboring relations of cell copies
-  typename std::list< array<Offset,4> >::iterator oit = off_nb.begin() ; 
-  for (typename std::list<Cell_handle>::iterator cit = original_cells.begin();
-       cit != original_cells.end() ; ++cit, ++oit) {
-    CGAL_triangulation_assertion( oit != off_nb.end() );
-    VCRMIT c_cp = virtual_cells_reverse.find(*cit);
-    CGAL_triangulation_assertion(c_cp != virtual_cells_reverse.end());
-    for (int i=0; i<4; i++) {
-      Cell_handle cit_nb = (*cit)->neighbor(i);
-      VCRMIT c_cp_nb = virtual_cells_reverse.find(cit_nb);
-      CGAL_triangulation_assertion(c_cp_nb != virtual_cells_reverse.end());
-      Offset nboff = (*oit)[i];
-      for (int n=0; n<26; n++) {
-	int n_nb;
- 	if (nboff.is_null()) n_nb = n;
- 	else {
- 	  int o_i = ((n+1)/9-nboff.x()+3)%3;
- 	  int o_j = ((n+1)/3-nboff.y()+3)%3;
- 	  int o_k = (n+1-nboff.z()+3)%3;
- 	  n_nb = 9*o_i+3*o_j+o_k-1;
- 	}
-	if (n_nb == -1) {
-	  CGAL_triangulation_assertion(cit_nb->has_vertex(
-		  c_cp->second[n]->vertex((i+1)%4)) );
-	  CGAL_triangulation_assertion(cit_nb->has_vertex(
-		  c_cp->second[n]->vertex((i+2)%4)) );
-	  CGAL_triangulation_assertion(cit_nb->has_vertex(
-		  c_cp->second[n]->vertex((i+3)%4)) );
-	  c_cp->second[n]->set_neighbor(i,cit_nb);
-	}
-	else {
-	  CGAL_triangulation_assertion(n_nb >= 0);
-	  CGAL_triangulation_assertion(static_cast<unsigned int>(n_nb)
-	      <= c_cp_nb->second.size());
-	  CGAL_triangulation_assertion(c_cp_nb->second[n_nb]
-			 ->has_vertex(c_cp->second[n]->vertex((i+1)%4)) );
-	  CGAL_triangulation_assertion(c_cp_nb->second[n_nb]
-			 ->has_vertex(c_cp->second[n]->vertex((i+2)%4)) );
-	  CGAL_triangulation_assertion(c_cp_nb->second[n_nb]
-			 ->has_vertex(c_cp->second[n]->vertex((i+3)%4)) );
-	  c_cp->second[n]->set_neighbor(i,c_cp_nb->second[n_nb]);
-	}
-      }
-    }
-  }
-
-  // Set neighboring relations of original cells
-  oit = off_nb.begin();
-  for (typename std::list<Cell_handle>::iterator cit = original_cells.begin();
-       cit != original_cells.end() ; ++cit, ++oit) {
-    CGAL_triangulation_assertion( oit != off_nb.end() );
-    for (int i=0; i<4; i++) {
-      Offset nboff = (*oit)[i];
-      if (!nboff.is_null()) {
-	Cell_handle cit_nb = (*cit)->neighbor(i);
-	VCRMIT c_cp_nb = virtual_cells_reverse.find(cit_nb);
-	CGAL_triangulation_assertion(c_cp_nb != virtual_cells_reverse.end());
-	int o_i = (3-nboff.x())%3;
-	int o_j = (3-nboff.y())%3;
-	int o_k = (3-nboff.z())%3;
-	int n_nb = 9*o_i+3*o_j+o_k-1;
-	CGAL_triangulation_assertion(n_nb >= 0);
-	CGAL_triangulation_assertion(static_cast<unsigned int>(n_nb)
-	    <= c_cp_nb->second.size());
-	CGAL_triangulation_assertion(c_cp_nb->second[n_nb]
-		       ->has_vertex((*cit)->vertex((i+1)%4)) );
-	CGAL_triangulation_assertion(c_cp_nb->second[n_nb]
-		       ->has_vertex((*cit)->vertex((i+2)%4)) );
-	CGAL_triangulation_assertion(c_cp_nb->second[n_nb]
-		       ->has_vertex((*cit)->vertex((i+3)%4)) );
-	(*cit)->set_neighbor(i,c_cp_nb->second[n_nb]);
-      }
-    }
-  }
-
-  // Set incident cells 
-  for (Cell_iterator cit = cells_begin() ; cit != cells_end() ; ++cit) {
-    for (int i=0 ; i<4 ; i++) {
-      cit->vertex(i)->set_cell(cit);
-    }
-  }
-
-  // Set offsets where necessary
-  for (typename std::list<Cell_handle>::iterator cit = original_cells.begin() ;
-       cit != original_cells.end() ; ++cit) {
-    VCRMIT c_cp = virtual_cells_reverse.find(*cit);
-    CGAL_triangulation_assertion( c_cp != virtual_cells_reverse.end());
-    Offset off[4];
-    for (int i=0; i<4; i++)
-      off[i] = int_to_off((*cit)->offset(i));
-    if (off[0].is_null() && off[1].is_null()
-	&& off[2].is_null() && off[3].is_null()) continue;
-    for (int n=0; n<26; n++) {
-      Offset off_cp[4];
-      int o_i = (n+1)/9;
-      int o_j = ((n+1)/3)%3;
-      int o_k = (n+1)%3;
-      if (o_i!=2 && o_j!=2 && o_k !=2) continue;
-      for (int i=0; i<4; i++) {
-	off_cp[i] = Offset((o_i==2)?off[i].x():0,
-			   (o_j==2)?off[i].y():0,
-			   (o_k==2)?off[i].z():0);
-	CGAL_triangulation_assertion(off_cp[i].x() == 0 || off_cp[i].x() == 1);
-	CGAL_triangulation_assertion(off_cp[i].y() == 0 || off_cp[i].y() == 1);
-	CGAL_triangulation_assertion(off_cp[i].z() == 0 || off_cp[i].z() == 1);
-      }
-      set_offsets(c_cp->second[n],off_cp[0],off_cp[1],off_cp[2],off_cp[3]);
-    }
-  }
-
-  // Iterate over all original cells and reset offsets.
-  for (typename std::list<Cell_handle>::iterator cit = original_cells.begin() ;
-       cit != original_cells.end() ; ++cit) {
-    //This statement does not seem to have any effect
-    set_offsets(*cit, 0,0,0,0);
-    CGAL_triangulation_assertion((*cit)->offset(0) == 0);
-    CGAL_triangulation_assertion((*cit)->offset(1) == 0);
-    CGAL_triangulation_assertion((*cit)->offset(2) == 0);
-    CGAL_triangulation_assertion((*cit)->offset(3) == 0);
-  }
-
-  _cover = make_array(3,3,3);
-  CGAL_triangulation_expensive_assertion(is_valid());
-
-  // Set up too long edges data structure
-  int i=0;
-  for (Vertex_iterator vit = vertices_begin(); vit != vertices_end(); ++vit) {
-    too_long_edges[vit] = std::list<Vertex_handle>();
-    ++i;
-  }
-  too_long_edge_counter = find_too_long_edges(too_long_edges);
-}
-
-// iterate over all edges and store the ones that are longer than
-// edge_length_threshold in edges. Return the number of too long edges.
-template < class GT, class TDS >
-inline int
-Periodic_3_triangulation_3<GT,TDS>::find_too_long_edges(
-    std::map<Vertex_handle, std::list<Vertex_handle> >& edges)
-const {
-  Point p1, p2;
-  int counter = 0;
-  Vertex_handle v_no,vh;
-  for (Edge_iterator eit = edges_begin();
-       eit != edges_end() ; eit++) {
-    p1 = construct_point(eit->first->vertex(eit->second)->point(),
-	get_offset(eit->first, eit->second));
-    p2 = construct_point(eit->first->vertex(eit->third)->point(),
-	get_offset(eit->first, eit->third));
-    if (squared_distance(p1,p2) > edge_length_threshold) {
-      if (&*(eit->first->vertex(eit->second)) <
-	  &*(eit->first->vertex(eit->third))) {
-	v_no = eit->first->vertex(eit->second);
-	vh = eit->first->vertex(eit->third);
-      } else {
-	v_no = eit->first->vertex(eit->third);
-	vh = eit->first->vertex(eit->second);
-      }
-      edges[v_no].push_back(vh);
-      counter++;
-    }
-  }
-  return counter;
-}
-
-template < class GT, class TDS >
-class Periodic_3_triangulation_3<GT,TDS>::Finder {
-  const Self* _t;
-  const Point & _p;
-public:
-  Finder(const Self* t, const Point &p) : _t(t), _p(p) {}
-  bool operator()(const Vertex_handle v) {
-    return _t->equal(v->point(), _p);
-  }
-};
-
-/** Find the cell that consists of the four given vertices
- *
- *  Iterates over all cells and compare the four vertices of each cell
- *  with the four vertices in vh.
- */
-template < class GT, class TDS >
-inline typename Periodic_3_triangulation_3<GT,TDS>::Cell_handle
-Periodic_3_triangulation_3<GT,TDS>::get_cell(const Vertex_handle* vh) const {
-  bool contains_v[4];
-  std::vector<Cell_handle> cells;
-  incident_cells(vh[3],std::back_inserter(cells));
-  for ( typename std::vector<Cell_handle>::iterator it = cells.begin();
-       it != cells.end(); it++ ) {
-    CGAL_triangulation_assertion(
-	(*it)->vertex(0) == vh[3] || (*it)->vertex(1) == vh[3]
-      ||(*it)->vertex(2) == vh[3] || (*it)->vertex(3) == vh[3]) ;
-    for ( int j=0 ; j<3 ; j++ ) {
-      contains_v[j] = false;
-      contains_v[j] = ( (*it)->vertex(0) == vh[j] )
-          || ( (*it)->vertex(1) == vh[j] )
-          || ( (*it)->vertex(2) == vh[j] )
-          || ( (*it)->vertex(3) == vh[j] );
-    }
-    if (contains_v[0] && contains_v[1] && contains_v[2]) {
-      return (*it);
-    }
-  }
-  CGAL_triangulation_assertion(false);
-  return Cell_handle();
-}
-
-/*! \brief Get the offset of tester.point() such that 
- * this point is in conflict with c w.r.t tester.get_offset().
- *
- * Implementation: Just try all eight possibilities.
- */
-template < class GT, class TDS >
-template < class Conflict_tester >
-inline typename Periodic_3_triangulation_3<GT,TDS>::Offset
-Periodic_3_triangulation_3<GT,TDS>::get_location_offset(
-    const Conflict_tester& tester, Cell_handle c) const {
-  CGAL_triangulation_precondition( number_of_vertices() != 0 );
-
-  //  CGAL_triangulation_precondition_code(Locate_type lt; int i; int j;);
-  //  CGAL_triangulation_precondition(side_of_cell(q,o,c,lt,i,j)
-  //      != ON_UNBOUNDED_SIDE);
-
-  int cumm_off = c->offset(0) | c->offset(1) | c->offset(2) | c->offset(3);
-  if (cumm_off == 0) {
-    // default case:
-    return Offset();
-  } else {
-    // Main idea seems to just test all possibilities.
-    for (int i=0; i<8; i++) {
-      if (((cumm_off | (~i))&7) == 7) {
-		  if (tester(c,int_to_off(i))) {
-			return int_to_off(i);
-        }
-      }
-    }
-  }
-  CGAL_triangulation_assertion(false);
-  return Offset();
-}
-
-/** Get the offset between the origins of the internal offset coordinate
-  * systems of two neighboring cells with respect from ch to nb.
-  *
-  * - Find two corresponding vertices from each cell
-  * - Return the difference of their offsets.
-  */
-template < class GT, class TDS >
-inline typename Periodic_3_triangulation_3<GT,TDS>::Offset
-Periodic_3_triangulation_3<GT,TDS>::get_neighbor_offset(
-    Cell_handle ch, int i, Cell_handle nb) const {
-  // Redundance in the signature!
-  CGAL_triangulation_precondition(ch->neighbor(i) == nb);
-  CGAL_triangulation_precondition(nb->neighbor(nb->index(ch)) == ch);
-  
-  Vertex_handle vertex_ch;
-  int index_ch, index_nb;
-  // ensure that vertex_ch \in nb and vertex_nb \in ch
-  index_ch = (i==0? 1 : 0);
-  vertex_ch = ch->vertex(index_ch);
-  index_nb = nb->index(vertex_ch);
-
-  return int_to_off(nb->offset(index_nb)) - int_to_off(ch->offset(index_ch));
-}
-
-/**
- * - ch->offset(i) is an bit triple encapsulated in an integer. Each bit
- *   represents the offset in one direction --> 2-cover!
- * - it_to_off(int) decodes this again.
- * - Finally the offset vector is multiplied by cover.
- *   So if we are working in 3-cover we translate it to the neighboring
- *   3-cover and not only to the neighboring domain.
- */
-template < class GT, class TDS >
-inline void Periodic_3_triangulation_3<GT, TDS>::get_vertex(
-    Cell_handle ch, int i, Vertex_handle &vh, Offset &off) const {
-
-  off = combine_offsets(Offset(),int_to_off(ch->offset(i)));
-  vh = ch->vertex(i);
-  
-  if (is_1_cover()) return;
-  Vertex_handle vh_i = vh;
-  get_vertex(vh_i, vh, off);
-  return;
-}
-
-template < class GT, class TDS >
-inline void Periodic_3_triangulation_3<GT, TDS>::get_vertex(
-    Vertex_handle vh_i, Vertex_handle &vh, Offset &off) const {
-  
-  Virtual_vertex_map_it it = virtual_vertices.find(vh_i);
-
-  if (it == virtual_vertices.end()) {
-    // if ch->vertex(i) is not contained in virtual_vertices, then it is in
-    // the original domain.
-    vh = vh_i;
-    CGAL_triangulation_assertion(vh != Vertex_handle());
-  } else {
-    // otherwise it has to be looked up as well as its offset.
-    vh = it->second.first;
-    off += it->second.second;
-    CGAL_triangulation_assertion(vh->point().x() < _domain.xmax());
-    CGAL_triangulation_assertion(vh->point().y() < _domain.ymax());
-    CGAL_triangulation_assertion(vh->point().z() < _domain.zmax());
-    CGAL_triangulation_assertion(vh->point().x() >= _domain.xmin());
-    CGAL_triangulation_assertion(vh->point().y() >= _domain.ymin());
-    CGAL_triangulation_assertion(vh->point().z() >= _domain.zmin());
-  }
-}
-
-template < class GT, class TDS >
-std::istream & 
-operator>> (std::istream& is, Periodic_3_triangulation_3<GT,TDS> &tr)
-  // reads
-  // the current covering that guarantees the triangulation to be a
-  //     simplicial complex
-  // the number of vertices
-  // the non combinatorial information on vertices (points in case of 1-sheeted
-  //     covering, point-offset pairs otherwise)
-  //     ALL PERIODIC COPIES OF ONE VERTEX MUST BE STORED CONSECUTIVELY
-  // the number of cells
-  // the cells by the indices of their vertices in the preceding list
-  // of vertices, plus the non combinatorial information on each cell
-  // the neighbors of each cell by their index in the preceding list of cells
-{
-  CGAL_triangulation_precondition(is.good());
-
-  typedef Periodic_3_triangulation_3<GT,TDS>       Triangulation;
-  typedef typename GT::FT FT;
-  typedef typename Triangulation::size_type             size_type;
-  typedef typename Triangulation::Vertex_handle         Vertex_handle;
-  typedef typename Triangulation::Cell_handle           Cell_handle;
-  typedef typename Triangulation::Offset                Offset;
-  typedef typename Triangulation::Iso_cuboid            Iso_cuboid;
-
-  tr.clear();
-
-  Iso_cuboid domain(0,0,0,1,1,1);
-  int cx=0, cy=0, cz=0;
-  size_type n=0;
-
-  if (is_ascii(is)) {
-    is >> domain;
-    is >> cx >> cy >> cz;
-    is >> n;
-  }
-  else {
-    is >> domain;
-    read(is,cx);
-    read(is,cy);
-    read(is,cz);
-    read(is,n);
-  }
- 
-  CGAL_triangulation_assertion((n/(cx*cy*cz))*cx*cy*cz == n);
-
-  tr.tds().set_dimension((n==0?-2:3));
-  tr._domain = domain;
-  tr._gt.set_domain(domain);
-  tr._cover = make_array(cx,cy,cz);
-
-  if ( n==0 ) return is;
-
-  std::map< std::size_t, Vertex_handle > V;
-
-  if (cx==1 && cy==1 && cz==1) {
-    for (std::size_t i=0; i < n; i++) {
-      V[i] = tr.tds().create_vertex();
-      is >> *V[i];
-    }
-  } else {
-    Vertex_handle v,w;
-    std::vector<Vertex_handle> vv;
-    Offset off;
-    for (std::size_t i=0; i < n; i++) {
-      v = tr.tds().create_vertex();
-      V[i] = v;
-      is >> *V[i] >> off;
-      vv.clear();
-      for (int j=1; j<cx*cy*cz; j++) {
-        i++;
-        w = tr.tds().create_vertex();
-        V[i] = w;
-        is >> *V[i] >> off;
-        vv.push_back(w);
-        tr.virtual_vertices[w]=std::make_pair(v,off);
-      }
-      tr.virtual_vertices_reverse[v]=vv;
-    }
-  }
-  
-  std::map< std::size_t, Cell_handle > C;
-  std::size_t m;
-  tr._tds.read_cells(is, V, m, C);
-
-  // read offsets
-  int off[4] = {0,0,0,0};
-  for (std::size_t j=0 ; j < m; j++) {
-    if (is_ascii(is))
-      is >> off[0] >> off[1] >> off[2] >> off[3];
-    else {
-      read(is,off[0]);
-      read(is,off[1]);
-      read(is,off[2]);
-      read(is,off[3]);
-    }
-    tr.set_offsets(C[j],off[0],off[1],off[2],off[3]);
-  }
-  
-  // read potential other information
-  for (std::size_t j=0 ; j < m; j++)
-    is >> *(C[j]);
-
-  typedef typename Triangulation::Vertex_iterator VI;
-
-  int i=0;
-  for (VI vi = tr.vertices_begin();
-      vi != tr.vertices_end(); ++vi) {
-    tr.too_long_edges[vi]=std::list<Vertex_handle>();
-    ++i;
-  }
-
-  tr.edge_length_threshold = FT(0.166) * (tr._domain.xmax()-tr._domain.xmin())
-                                       * (tr._domain.xmax()-tr._domain.xmin());
-  tr.too_long_edge_counter = tr.find_too_long_edges(tr.too_long_edges);
-
-  CGAL_triangulation_expensive_assertion( tr.is_valid() );
-  return is;
-}
-    
-template < class GT, class TDS >
-std::ostream & 
-operator<< (std::ostream& os,const Periodic_3_triangulation_3<GT,TDS> &tr)
-// writes :
-// the number of vertices
-// the domain as six coordinates: xmin ymin zmin xmax ymax zmax
-// the current covering that guarantees the triangulation to be a
-//     simplicial complex
-// the non combinatorial information on vertices (points in case of 1-sheeted
-//     covering, point-offset pairs otherwise)
-//     ALL PERIODIC COPIES OF ONE VERTEX MUST BE STORED CONSECUTIVELY
-// the number of cells
-// the cells by the indices of their vertices in the preceding list
-// of vertices, plus the non combinatorial information on each cell
-// the neighbors of each cell by their index in the preceding list of cells
-{
-  typedef Periodic_3_triangulation_3<GT,TDS>       Triangulation;
-  typedef typename Triangulation::size_type        size_type;
-  typedef typename Triangulation::Vertex_handle    Vertex_handle;
-  typedef typename Triangulation::Vertex_iterator  Vertex_iterator;
-  typedef typename Triangulation::Cell_handle      Cell_handle;
-  typedef typename Triangulation::Cell_iterator    Cell_iterator;
-  typedef typename Triangulation::Covering_sheets  Covering_sheets;
-  typedef typename Triangulation::Offset           Offset;
-  typedef typename Triangulation::Virtual_vertex_map_it Virtual_vertex_map_it;
-  typedef typename Triangulation::Iso_cuboid       Iso_cuboid;
-
-  // outputs dimension, domain and number of vertices
-  Iso_cuboid domain = tr.domain();
-  Covering_sheets cover = tr.number_of_sheets();
-  size_type n = tr.number_of_vertices();
-
-  if (is_ascii(os))
-    os << domain << std::endl
-       << cover[0] << " " << cover[1] << " " << cover[2] << std::endl
-       << n*cover[0]*cover[1]*cover[2] << std::endl;       
-  else {
-    os << domain;
-    write(os,cover[0]);
-    write(os,cover[1]);
-    write(os,cover[2]);
-    write(os,n*cover[0]*cover[1]*cover[2]);
-  }
-
-  if (n == 0)
-    return os;
- 
-  // write the vertices
-  Unique_hash_map<Vertex_handle, std::size_t > V;
-  std::size_t i=0;
-  if (tr.is_1_cover()) {
-    for (Vertex_iterator it=tr.vertices_begin(); it!=tr.vertices_end(); ++it) {
-      V[it] = i++;
-      os << it->point();
-      if (is_ascii(os))
-        os << std::endl;
-    }
-  } else {
-    Virtual_vertex_map_it vit, vvit;
-    std::vector<Vertex_handle> vv;
-    for (Vertex_iterator it=tr.vertices_begin(); it!=tr.vertices_end(); ++it) {
-      vit = tr.virtual_vertices.find(it);
-      if (vit != tr.virtual_vertices.end()) continue;
-      V[it]=i++;
-      if (is_ascii(os))
-        os << it->point() << std::endl
-           << Offset(0,0,0) << std::endl;
-      else os << it->point() << Offset(0,0,0);
-      CGAL_triangulation_assertion(tr.virtual_vertices_reverse.find(it)
-          != tr.virtual_vertices_reverse.end());
-      vv = tr.virtual_vertices_reverse.find(it)->second;
-      CGAL_triangulation_assertion(vv.size() == 26);
-      for (std::size_t j=0; j<vv.size(); j++) {
-        vvit = tr.virtual_vertices.find(vv[j]);
-        CGAL_triangulation_assertion(vvit != tr.virtual_vertices.end());
-        V[vv[j]] = i++;
-        if (is_ascii(os))
-          os << vv[j]->point() << std::endl
-             << vvit->second.second << std::endl;
-        else os << vv[j]->point() << vvit->second.second;
-      }
-    }
-  }
-  CGAL_triangulation_postcondition(i==tr._cover[0]*tr._cover[1]*tr._cover[2]*n);
-  
-  // asks the tds for the combinatorial information
-  tr.tds().print_cells(os, V);
-  
-  // write offsets
-  //for (unsigned int i=0 ; i<tr.number_of_cells() ; i++) {
-  for (Cell_iterator it=tr.cells_begin(); it!=tr.cells_end(); ++it) {
-    //Cell_handle ch = std::find(tr.cells_begin(), tr.cells_end(), i);
-    Cell_handle ch(it);
-    for (int j=0; j<4; j++) {
-      if(is_ascii(os)) {
-	os << ch->offset(j);
-        if ( j==3 )
-          os << std::endl;
-        else
-          os << ' ';
-      }
-      else write(os,ch->offset(j));
-    }
-  }
-  
-  // write the non combinatorial information on the cells
-  // using the << operator of Cell
-  // works because the iterator of the tds traverses the cells in the
-  // same order as the iterator of the triangulation
-  if(tr.number_of_vertices() != 0) {
-      for(Cell_iterator it=tr.cells_begin(); it != tr.cells_end(); ++it) {
-    os << *it; // other information
-    if(is_ascii(os))
-      os << std::endl;
-    }
-  }
-  return os ;
-}
-
-namespace internal {
-
-  /// Internal function used by operator==.
-  // This function tests and registers the 4 neighbors of c1/c2,
-  // and performs a bfs traversal
-  // Returns false if an inequality has been found.
-  //TODO: introduce offsets
-  template <class GT, class TDS1, class TDS2>
-  bool
-  test_next(const Periodic_3_triangulation_3<GT, TDS1> &t1,
-            const Periodic_3_triangulation_3<GT, TDS2> & /* needed_for_deducing_TDS2 */,
-            typename Periodic_3_triangulation_3<GT, TDS1>::Cell_handle c1,
-            typename Periodic_3_triangulation_3<GT, TDS2>::Cell_handle c2,
-            std::map<typename Periodic_3_triangulation_3<GT, TDS1>::Cell_handle,
-            typename Periodic_3_triangulation_3<GT, TDS2>::Cell_handle> &Cmap,
-            std::map<typename Periodic_3_triangulation_3<GT, TDS1>::Vertex_handle,
-            typename Periodic_3_triangulation_3<GT, TDS2>::Vertex_handle> &Vmap)
-  {  
-    typedef Periodic_3_triangulation_3<GT, TDS1> Tr1;
-    typedef Periodic_3_triangulation_3<GT, TDS2> Tr2;
-    typedef typename Tr1::Vertex_handle  Vertex_handle1;
-    typedef typename Tr1::Cell_handle    Cell_handle1;
-    typedef typename Tr2::Vertex_handle  Vertex_handle2;
-    typedef typename Tr2::Cell_handle    Cell_handle2;
-    typedef typename std::map<Cell_handle1, Cell_handle2>::const_iterator  Cit;
-    typedef typename std::map<Vertex_handle1, Vertex_handle2>::const_iterator Vit;
-
-    std::vector<std::pair<Cell_handle1, Cell_handle2> > queue;
-    queue.push_back(std::make_pair(c1,c2));
-    
-    while(! queue.empty()){
-      boost::tie(c1,c2) = queue.back();
-      queue.pop_back();
-  
-      // Precondition: c1, c2 have been registered as well as their 4 vertices.
-      CGAL_triangulation_precondition(t1.number_of_vertices() != 0);
-      CGAL_triangulation_precondition(Cmap[c1] == c2);
-      CGAL_triangulation_precondition(Vmap.find(c1->vertex(0)) != Vmap.end());
-      CGAL_triangulation_precondition(Vmap.find(c1->vertex(1)) != Vmap.end());
-      CGAL_triangulation_precondition(Vmap.find(c1->vertex(2)) != Vmap.end());
-      CGAL_triangulation_precondition(Vmap.find(c1->vertex(3)) != Vmap.end());
-      
-
-      for (int i=0; i <= 3; ++i) {
-        Cell_handle1 n1 = c1->neighbor(i);
-        Cit cit = Cmap.find(n1);
-        Vertex_handle1 v1 = c1->vertex(i);
-        Vertex_handle2 v2 = Vmap[v1];
-        Cell_handle2 n2 = c2->neighbor(c2->index(v2));
-        if (cit != Cmap.end()) {
-          // n1 was already registered.
-          if (cit->second != n2)
-            return false;
-          continue;
-        }
-        // n1 has not yet been registered.
-        // We check that the new vertices match geometrically.
-        // And we register them.
-        Vertex_handle1 vn1 = n1->vertex(n1->index(c1));
-        Vertex_handle2 vn2 = n2->vertex(n2->index(c2));
-        Vit vit = Vmap.find(vn1);
-        if (vit != Vmap.end()) {
-          // vn1 already registered
-          if (vit->second != vn2)
-            return false;
-        }
-        else {
-          if (t1.geom_traits().compare_xyz_3_object()(vn1->point(),
-                                                      vn2->point()) != 0)
-            return false;
-          
-          // We register vn1/vn2.
-          Vmap.insert(std::make_pair(vn1, vn2));
-        }
-        
-        // We register n1/n2.
-        Cmap.insert(std::make_pair(n1, n2));
-        queue.push_back(std::make_pair(n1, n2));
-      }
-    }
-    return true;
-  }
-
-} // namespace internal
-
-
-template < class GT, class TDS1, class TDS2  >
-bool
-operator==(const Periodic_3_triangulation_3<GT,TDS1> &t1,
-     const Periodic_3_triangulation_3<GT,TDS2> &t2)
-{
-  typedef typename Periodic_3_triangulation_3<GT,TDS1>::Vertex_handle
-      Vertex_handle1;
-  typedef typename Periodic_3_triangulation_3<GT,TDS1>::Cell_handle  
-      Cell_handle1;
-  typedef typename Periodic_3_triangulation_3<GT,TDS2>::Vertex_handle
-      Vertex_handle2;
-  typedef typename Periodic_3_triangulation_3<GT,TDS2>::Vertex_handle
-      Vertex_iterator2;
-  typedef typename Periodic_3_triangulation_3<GT,TDS2>::Cell_handle
-      Cell_handle2;
-  
-  typedef typename Periodic_3_triangulation_3<GT,TDS1>::Point      Point;
-  typedef typename Periodic_3_triangulation_3<GT,TDS1>::Offset     Offset;
-
-  // typedef typename Periodic_3_triangulation_3<GT,TDS1>
-  //     ::Geometric_traits::Compare_xyz_3                       Compare_xyz_3;
-  // Compare_xyz_3 cmp1 = t1.geom_traits().compare_xyz_3_object();
-  // Compare_xyz_3 cmp2 = t2.geom_traits().compare_xyz_3_object();
-  
-  // Some quick checks.
-  if (   t1.domain()           != t2.domain()
-      || t1.number_of_sheets() != t2.number_of_sheets())
-    return false;
-
-  if (   t1.number_of_vertices() != t2.number_of_vertices()
-      || t1.number_of_cells() != t2.number_of_cells())
-    return false;
-
-  // Special case for empty triangulations
-  if (t1.number_of_vertices() == 0)
-    return true;
-
-  // We will store the mapping between the 2 triangulations vertices and
-  // cells in 2 maps.
-  std::map<Vertex_handle1, Vertex_handle2> Vmap;
-  std::map<Cell_handle1, Cell_handle2> Cmap;
-
-  // find a common point
-  Vertex_handle1 v1 = static_cast<Vertex_handle1>(t1.vertices_begin());
-  Vertex_handle2 iv2;
-  for (Vertex_iterator2 vit2 = t2.vertices_begin() ;
-      vit2 != t2.vertices_end(); ++vit2) {
-    if (!t1.equal(vit2->point(), v1->point(),
-		  t2.get_offset(vit2), t1.get_offset(v1)))
-      continue;
-    iv2 = static_cast<Vertex_handle2>(vit2);
-    break;
-  }
-  if (iv2 == Vertex_handle2())
-    return false;
-  Vmap.insert(std::make_pair(v1, iv2));
-
-  // We pick one cell of t1, and try to match it against the
-  // cells of t2.
-  Cell_handle1 c = v1->cell();
-  Vertex_handle1 v2 = c->vertex((c->index(v1)+1)%4);
-  Vertex_handle1 v3 = c->vertex((c->index(v1)+2)%4);
-  Vertex_handle1 v4 = c->vertex((c->index(v1)+3)%4);
-  Point p2 = v2->point();
-  Point p3 = v3->point();
-  Point p4 = v4->point();
-  Offset o2 = t1.get_offset(v2);
-  Offset o3 = t1.get_offset(v3);
-  Offset o4 = t1.get_offset(v4);
-
-  std::vector<Cell_handle2> ics;
-  t2.incident_cells(iv2, std::back_inserter(ics));
-  for (typename std::vector<Cell_handle2>::const_iterator cit = ics.begin();
-       cit != ics.end(); ++cit) {
-    int inf = (*cit)->index(iv2);
-
-    if (t1.equal(p2, (*cit)->vertex((inf+1)%4)->point(),
-	      o2, t2.get_offset((*cit)->vertex((inf+1)%4))))
-      Vmap.insert(std::make_pair(v2, (*cit)->vertex((inf+1)%4)));
-    else if (t1.equal(p2, (*cit)->vertex((inf+2)%4)->point(),
-	      o2, t2.get_offset((*cit)->vertex((inf+2)%4))))
-      Vmap.insert(std::make_pair(v2, (*cit)->vertex((inf+2)%4)));
-    else if (t1.equal(p2, (*cit)->vertex((inf+3)%4)->point(),
-	      o2, t2.get_offset((*cit)->vertex((inf+3)%4))))
-      Vmap.insert(std::make_pair(v2, (*cit)->vertex((inf+3)%4)));
-    else
-      continue; // None matched v2.
-
-    if (t1.equal(p3, (*cit)->vertex((inf+1)%4)->point(),
-	      o3, t2.get_offset((*cit)->vertex((inf+1)%4))))
-      Vmap.insert(std::make_pair(v3, (*cit)->vertex((inf+1)%4)));
-    else if (t1.equal(p3, (*cit)->vertex((inf+2)%4)->point(),
-	      o3, t2.get_offset((*cit)->vertex((inf+2)%4))))
-      Vmap.insert(std::make_pair(v3, (*cit)->vertex((inf+2)%4)));
-    else if (t1.equal(p3, (*cit)->vertex((inf+3)%4)->point(),
-	      o3, t2.get_offset((*cit)->vertex((inf+3)%4))))
-      Vmap.insert(std::make_pair(v3, (*cit)->vertex((inf+3)%4)));
-    else
-      continue; // None matched v3.
-
-    if (t1.equal(p4, (*cit)->vertex((inf+1)%4)->point(),
-	      o4, t2.get_offset((*cit)->vertex((inf+1)%4))))
-      Vmap.insert(std::make_pair(v4,(*cit)->vertex((inf+1)%4)));
-    else if (t1.equal(p4, (*cit)->vertex((inf+2)%4)->point(),
-	      o4, t2.get_offset((*cit)->vertex((inf+2)%4))))
-      Vmap.insert(std::make_pair(v4,(*cit)->vertex((inf+2)%4)));
-    else if (t1.equal(p4, (*cit)->vertex((inf+3)%4)->point(),
-	      o4, t2.get_offset((*cit)->vertex((inf+3)%4))))
-      Vmap.insert(std::make_pair(v4,(*cit)->vertex((inf+3)%4)));
-    else
-      continue; // None matched v4.
-
-    // Found it !
-    Cmap.insert(std::make_pair(c, *cit));
-    break;
-  }
-
-  if (Cmap.size() == 0)
-    return false;
-
-  // We now have one cell, we need to compare in a bfs graph traversal
-  return internal::test_next(t1, t2, Cmap.begin()->first, Cmap.begin()->second, Cmap, Vmap);
-}
-
-template < class GT, class TDS1, class TDS2 >
-inline
-bool
-operator!=(const Periodic_3_triangulation_3<GT,TDS1> &t1,
-    const Periodic_3_triangulation_3<GT,TDS2> &t2)
-{
-  return ! (t1 == t2);
-}
-
-} //namespace CGAL
-
-#endif // CGAL_PERIODIC_3_TRIANGULATION_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Periodic_3_triangulation_filtered_traits_3.h b/3rdparty/CGAL-4.8/include/CGAL/Periodic_3_triangulation_filtered_traits_3.h
deleted file mode 100644
index a25d628..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Periodic_3_triangulation_filtered_traits_3.h
+++ /dev/null
@@ -1,203 +0,0 @@
-// Copyright (c) 2004,2006-2009   INRIA Sophia-Antipolis (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
-// 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(s)     : Sylvain Pion <Sylvain.Pion at sophia.inria.fr>
-//                 Nico Kruithof <Nico.Kruithof at sophia.inria.fr>
-//                 Manuel Caroli <Manuel.Caroli at sophia.inria.fr>
-
-
-#ifndef CGAL_PERIODIC_3_TRIANGULATION_FILTERED_TRAITS_3_H
-#define CGAL_PERIODIC_3_TRIANGULATION_FILTERED_TRAITS_3_H
-
-#include <string>
-#include <CGAL/basic.h>
-#include <CGAL/config.h>
-#include <CGAL/Interval_nt.h>
-#include <CGAL/Uncertain.h>
-#include <CGAL/Profile_counter.h>
-
-namespace CGAL {
-
-// This template class is a wrapper that implements the filtering for any
-// predicate (dynamic filters with IA).
-
-// TODO :
-// - each predicate in the default kernel should define a tag that says if it
-//   wants to be filtered or not (=> all homogeneous predicate define this
-//   tag).  We could even test-suite that automatically.  It makes a strong
-//   new requirement on the kernel though...
-//   Could be done with a traits mechanism ?
-//   A default template could use the current IA, but other tags or whatever
-//   could specify no filtering at all, or static filtering...
-// - same thing for constructions => virtual operator() ?
-// - similarly, constructions should have a tag saying if they can throw or
-//   not, or we let all this up to the compiler optimizer to figure out ?
-// - Some caching could be done at the Point_2 level.
-
-template <class EP, class AP, class C2E, class C2A, bool Protection = true>
-class Filtered_periodic_predicate
-  : public Filtered_predicate<EP, AP, C2E, C2A, Protection>
-{
-  typedef Filtered_predicate<EP, AP, C2E, C2A, Protection> Base;
-public:
-  Filtered_periodic_predicate() : Base() {}
-
-  // These constructors are used for constructive predicates.
-  // You should try to avoid constructive predicates, as they will construct
-  // the exact values systematically (in the ctor), rather than lazily.
-  template <class OE, class OA> 
-  Filtered_periodic_predicate(const OE * oe, const OA * oa) 
-    : Base( EP(oe), AP(oa) )
-  {}
-};
-}
-
-#include <CGAL/Periodic_3_triangulation_traits_3.h>
-
-namespace CGAL
-{
-// The Offset_converter is parametrized by a usual kernel converter,
-// and adds the conversions for Offsets.
-template < typename Converter >
-struct Offset_converter_3
-  : public Converter
-{
-  typedef typename Converter::Source_kernel Source_kernel;
-  typedef typename Converter::Target_kernel Target_kernel;
-
-  typedef typename Periodic_3_triangulation_traits_base_3<Source_kernel>
-                   ::Offset  Source_off;
-  typedef typename Periodic_3_triangulation_traits_base_3<Source_kernel>
-                   ::Point_3  Source_pt;
-
-  typedef typename Periodic_3_triangulation_traits_base_3<Target_kernel>
-                   ::Offset  Target_off;
-  typedef typename Periodic_3_triangulation_traits_base_3<Target_kernel>
-                   ::Point_3  Target_pt;
-
-
-  using Converter::operator();
-
-  Target_off
-  operator()(const Source_off &off) const
-  {
-    return off;
-  }
-};
-
-// The argument is supposed to be a Filtered_kernel like kernel.
-template < typename K, typename Off >
-class Periodic_3_triangulation_filtered_traits_base_3
-  : public Periodic_3_triangulation_traits_base_3<K, Off>
-{
-  typedef Periodic_3_triangulation_traits_base_3<K, Off> Base;
-
-  // Exact traits is based on the exact kernel.
-  typedef future_release::Periodic_3_triangulation_traits_3<typename K::Exact_kernel,
-                                            Off>
-                                                   Exact_traits;
-  // Filtering traits is based on the filtering kernel.
-  typedef future_release::Periodic_3_triangulation_traits_3<typename K::Approximate_kernel,
-                                            Off>
-                                                   Filtering_traits;
-private:
-  typedef typename K::C2E C2E;
-  typedef typename K::C2F C2F;
-
-  typedef typename C2E::Target_kernel::Iso_cuboid_3 Exact_iso_cuboid_3;
-  typedef typename C2F::Target_kernel::Iso_cuboid_3 Approximate_iso_cuboid_3;
- 
-public:
-  typedef typename K::Iso_cuboid_3 Iso_cuboid_3;
-
-  void set_domain(const Iso_cuboid_3& domain) {
-    C2E c2e;
-    C2F c2f;
-    this->_domain = domain;
-    this->_domain_e = c2e(this->_domain);
-    this->_domain_f = c2f(this->_domain);
-  }
-
-  typedef Filtered_periodic_predicate<
-            typename Exact_traits::Compare_xyz_3,
-            typename Filtering_traits::Compare_xyz_3,
-            Offset_converter_3<C2E>,
-            Offset_converter_3<C2F> >  Compare_xyz_3;
-
-  typedef Filtered_periodic_predicate<
-            typename Exact_traits::Coplanar_orientation_3,
-            typename Filtering_traits::Coplanar_orientation_3,
-            Offset_converter_3<C2E>,
-            Offset_converter_3<C2F> >  Coplanar_orientation_3;
-
-  typedef Filtered_periodic_predicate<
-            typename Exact_traits::Orientation_3,
-            typename Filtering_traits::Orientation_3,
-            Offset_converter_3<C2E>,
-            Offset_converter_3<C2F> >  Orientation_3;
-
-  typedef Filtered_periodic_predicate<
-            typename Exact_traits::Coplanar_side_of_bounded_circle_3,
-            typename Filtering_traits::Coplanar_side_of_bounded_circle_3,
-            Offset_converter_3<C2E>,
-            Offset_converter_3<C2F> >  Coplanar_side_of_bounded_circle_3;
-
-  typedef Filtered_periodic_predicate<
-            typename Exact_traits::Compare_distance_3,
-            typename Filtering_traits::Compare_distance_3,
-            Offset_converter_3<C2E>,
-            Offset_converter_3<C2F> >  Compare_distance_3;
-
-  Compare_xyz_3 compare_xyz_3_object() const
-  { return Compare_xyz_3(&_domain_e,&_domain_f);}
-
-  Coplanar_orientation_3 coplanar_orientation_3_object() const
-  { return Coplanar_orientation_3(&_domain_e,&_domain_f); }
-
-  Orientation_3 orientation_3_object() const
-  { return Orientation_3(&_domain_e,&_domain_f);}
-
-  Coplanar_side_of_bounded_circle_3
-  coplanar_side_of_bounded_circle_3_object() const 
-  { return Coplanar_side_of_bounded_circle_3(&_domain_e,&_domain_f); }
-
-  // The following are inherited since they are constructions :
-  // Construct_segment_3
-  // Construct_triangle_3
-  // Construct_tetrahedron_3
-
- protected:
-  Exact_iso_cuboid_3 _domain_e;
-  Approximate_iso_cuboid_3 _domain_f;
-};
-
-} //namespace CGAL
-
-#include <CGAL/Periodic_3_triangulation_statically_filtered_traits_3.h>
-
-namespace CGAL {
-
-template < typename K, typename Off = typename CGAL::Periodic_3_offset_3 >
-class Periodic_3_triangulation_filtered_traits_3
-  : public Periodic_3_triangulation_statically_filtered_traits_3<
-  Periodic_3_triangulation_filtered_traits_base_3<K, Off> > {
-};
-
-} //namespace CGAL
-
-#endif // CGAL_PERIODIC_3_TRIANGULATION_FILTERED_TRAITS_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Periodic_3_triangulation_traits_3.h b/3rdparty/CGAL-4.8/include/CGAL/Periodic_3_triangulation_traits_3.h
deleted file mode 100644
index d4ce63b..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Periodic_3_triangulation_traits_3.h
+++ /dev/null
@@ -1,173 +0,0 @@
-// Copyright (c) 2006-2009   INRIA Sophia-Antipolis (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
-// 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(s)     : Nico Kruithof <Nico.Kruithof at sophia.inria.fr>
-//                 Manuel Caroli <Manuel.Caroli at sophia.inria.fr>
-
-#ifndef CGAL_PERIODIC_3_TRIANGULATION_TRAITS_3_H
-#define CGAL_PERIODIC_3_TRIANGULATION_TRAITS_3_H
-
-#include <CGAL/basic.h>
-#include <CGAL/Periodic_3_offset_3.h>
-#include <CGAL/Periodic_3_construct_point_3.h>
-#include <CGAL/triangulation_assertions.h>
-#include <CGAL/Traits_with_offsets_adaptor.h>
-
-
-namespace CGAL { 
-
-template < class Kernel, class Off = typename CGAL::Periodic_3_offset_3 >
-class Periodic_3_triangulation_traits_base_3
-  : public Kernel
-{
-public:
-  typedef Kernel                                                 K;
-  typedef Off                                                    Offset;
-  typedef Periodic_3_triangulation_traits_base_3< K, Offset >    Self;  
-
-  typedef typename K::RT                RT;
-  typedef typename K::FT                FT;
-  typedef typename K::Point_3           Point_3;
-  typedef typename K::Vector_3          Vector_3;
-  typedef Offset                        Periodic_3_offset_3;
-  typedef typename K::Iso_cuboid_3      Iso_cuboid_3;
-
-  // The next typedef is there for backward compatibility
-  // Some users take their point type from the traits class.
-  // Before this type was Point
-  typedef Point_3 Point;
-
-  typedef typename K::Segment_3         Segment_3;
-  typedef typename K::Triangle_3        Triangle_3;
-  typedef typename K::Tetrahedron_3     Tetrahedron_3;
-
-  // Triangulation predicates
-  typedef Traits_with_offsets_adaptor<Self, typename K::Compare_xyz_3>
-      Compare_xyz_3;
-  typedef Traits_with_offsets_adaptor<Self, typename K::Orientation_3>
-      Orientation_3;
-  
-  // Triangulation constructions
-  typedef Periodic_3_construct_point_3<Self, typename K::Construct_point_3>
-      Construct_point_3;
-  typedef Traits_with_offsets_adaptor<Self, typename K::Construct_segment_3>
-      Construct_segment_3;
-  typedef Traits_with_offsets_adaptor<Self, typename K::Construct_triangle_3>
-      Construct_triangle_3;
-  typedef Traits_with_offsets_adaptor<Self, typename K::Construct_tetrahedron_3>
-      Construct_tetrahedron_3;
-
-  // Access
-  void set_domain(const Iso_cuboid_3& domain) {
-    _domain = domain;
-  }
-  
-  Iso_cuboid_3 get_domain() const {
-    return _domain;
-  }
-
-  // Operations
-  Compare_xyz_3
-  compare_xyz_3_object() const {
-    return Compare_xyz_3(&_domain);
-  }
-  Orientation_3
-  orientation_3_object() const {
-    return Orientation_3(&_domain);
-  }
-  Construct_point_3
-  construct_point_3_object() const {
-    return Construct_point_3(_domain);
-  }
-  Construct_segment_3
-  construct_segment_3_object() const {
-    return Construct_segment_3(&_domain);
-  }
-  Construct_triangle_3
-  construct_triangle_3_object() const {
-    return Construct_triangle_3(&_domain);
-  }
-  Construct_tetrahedron_3
-  construct_tetrahedron_3_object() const {
-    return Construct_tetrahedron_3(&_domain);
-  }
-
-protected:
-  Iso_cuboid_3 _domain;
-};
-
-namespace future_release
-{
-template < typename K, typename Off = CGAL::Periodic_3_offset_3 >
-class Periodic_3_triangulation_traits_3;
-}
-
-} //namespace CGAL
-
-// Partial specialization for Filtered_kernel<CK>.
-#include <CGAL/Filtered_kernel.h>
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-#include <CGAL/Periodic_3_triangulation_filtered_traits_3.h>
-
-namespace CGAL {
-// This declaration is needed to break the cyclic dependency.
-template < typename K, typename Off >
-class Periodic_3_triangulation_filtered_traits_3;
-
-namespace future_release {
-template < class K, class Off>
-class Periodic_3_triangulation_traits_3
-  : public Periodic_3_triangulation_traits_base_3<K, Off>
-{
-};
-
-template < typename CK, typename Off >
-class Periodic_3_triangulation_traits_3 < Filtered_kernel<CK>, Off>
-  : public Periodic_3_triangulation_filtered_traits_3 <
-  Filtered_kernel<CK>, Off >
-{
-public:
-  typedef Filtered_kernel<CK>  Kernel;
-};
-
-template < class Off >
-class Periodic_3_triangulation_traits_3<CGAL::Epick, Off>
-  : public Periodic_3_triangulation_filtered_traits_3<CGAL::Epick, Off>
-{
-  typedef CGAL::Epick Kernel;
-};
-
-}
-} //namespace CGAL
-
-#include <CGAL/Periodic_3_Delaunay_triangulation_traits_3.h>
-
-
-namespace CGAL
-{
-template < typename K, typename Off >
-class Periodic_3_Delaunay_triangulation_traits_3;
-
-// Periodic_3_triangulation_traits_3 should not be used as traits for Periodic_3_Delaunay_triangulation_3 anymore.
-template < class Kernel, class Off = typename CGAL::Periodic_3_offset_3 >
-class CGAL_DEPRECATED Periodic_3_triangulation_traits_3 : public Periodic_3_Delaunay_triangulation_traits_3<Kernel, Off>
-{
-};
-}
-
-#endif // CGAL_PERIODIC_3_TRIANGULATION_TRAITS_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Point_with_normal_3.h b/3rdparty/CGAL-4.8/include/CGAL/Point_with_normal_3.h
deleted file mode 100644
index 94636bf..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Point_with_normal_3.h
+++ /dev/null
@@ -1,225 +0,0 @@
-// Copyright (c) 2007-2009  INRIA (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
-// 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(s)     : Laurent Saboret, Pierre Alliez
-
-#ifndef CGAL_POINT_WITH_NORMAL_3_H
-#define CGAL_POINT_WITH_NORMAL_3_H
-
-#include <CGAL/Point_3.h>
-#include <CGAL/Vector_3.h>
-#include <CGAL/Origin.h>
-#include <CGAL/value_type_traits.h>
-
-#include <CGAL/property_map.h>
-
-#include <boost/version.hpp>
-#if BOOST_VERSION >= 104000
-  #include <boost/property_map/property_map.hpp>
-#else
-  #include <boost/property_map.hpp>
-#endif
-
-namespace CGAL {
-
-/// \cond SKIP_IN_MANUAL
-  
-/// The Point_with_normal_3 class represents a 3D point with:
-/// - a position,
-/// - a normal (oriented).
-///
-/// @heading Parameters:
-/// @param Gt       Geometric traits class.
-
-template<class Gt>
-class Point_with_normal_3 : public Gt::Point_3
-{
-// Private types
-private:
-
-  typedef typename Gt::Point_3  Base;
-
-// Public types
-public:
-
-    typedef Gt Geom_traits; ///< Geometric traits class
-    typedef typename Geom_traits::FT FT;
-    typedef typename Geom_traits::RT RT;
-    typedef typename Geom_traits::Point_3  Point;  ///< typedef to Geom_traits::Point_3
-    typedef typename Geom_traits::Vector_3 Vector; ///< typedef to Geom_traits::Vector_3
-
-// Public methods
-public:
-
-    /// Point is (0,0,0) by default.
-    /// Normal is (0,0,0) by default.
-    Point_with_normal_3(const Origin& o = ORIGIN)
-    : Base(o)
-    {
-    }
-    Point_with_normal_3(FT x, FT y, FT z,
-                        const Vector& normal = NULL_VECTOR)
-    : Base(x,y,z),
-      m_normal(normal)
-    {
-    }
-    Point_with_normal_3(RT hx, RT hy, RT hz, RT hw,
-                        const Vector& normal = NULL_VECTOR)
-    : Base(hx,hy,hz,hw),
-      m_normal(normal)
-    {
-    }
-    Point_with_normal_3(const Point& point,
-                        const Vector& normal = NULL_VECTOR)
-    : Base(point),
-      m_normal(normal)
-    {
-    }
-
-    /// Copy constructor
-    Point_with_normal_3(const Point_with_normal_3& pwn)
-    : Base(pwn),
-      m_normal(pwn.normal())
-    {
-    }
-    template <class K>
-    Point_with_normal_3(const Point_with_normal_3<K>& pwn)
-    : Base(pwn),
-      m_normal(pwn.normal())
-    {
-    }
-    /// Operator =()
-    Point_with_normal_3& operator=(const Point_with_normal_3& pwn)
-    {
-      Base::operator=(pwn);
-      m_normal = pwn.normal();
-      return *this;
-    }
-
-    /// Gets/sets position.
-    const Point& position() const { return *this; }
-    Point&       position()       { return *this; }
-
-    /// Gets/sets normal.
-    const Vector& normal() const { return m_normal; }
-    Vector&       normal()       { return m_normal; }
-
-// Data
-private:
-
-    Vector  m_normal;
-};
-
-
-//=========================================================================
-
-#ifndef CGAL_USE_PROPERTY_MAPS_API_V1
-/// Property map that accesses the normal vector from a Point_with_normal_3 object
-///
-/// @heading Is Model for the Concepts:
-/// \cgalModels `LvaluePropertyMap`
-///
-/// @heading Parameters:
-/// @param Gt Geometric traits class.
-
-template <class Gt>
-struct Normal_of_point_with_normal_pmap
-{
-  typedef Point_with_normal_3<Gt> Point_with_normal; ///< Position + normal
-  typedef typename Gt::Vector_3 Vector; /// normal
-
-  typedef Point_with_normal key_type;
-  typedef Vector value_type;
-  typedef value_type& reference;
-  typedef boost::lvalue_property_map_tag category;
-
-  /// Access a property map element
-  reference operator[](key_type& pwn) const { return pwn.normal(); }
-
-  typedef Normal_of_point_with_normal_pmap<Gt> Self;
-  /// \name Put/get free functions
-  /// @{
-  friend const value_type& get(const Self&,const key_type& k) {return k.normal();}
-  friend         reference get(const Self&,      key_type& k) {return k.normal();}
-  friend void put(const Self&,key_type& k, const value_type& v) {k.normal()=v;}
-  /// @};}
-};
-
-/// Free function to create a Normal_of_point_with_normal_pmap property map.
-///
-/// @relates Normal_of_point_with_normal_pmap
-
-template <class Point_with_normal> // Point_with_normal type
-Normal_of_point_with_normal_pmap<
-  typename CGAL::Kernel_traits<Point_with_normal>::Kernel>
-  make_normal_of_point_with_normal_pmap(Point_with_normal)
-{
-  return Normal_of_point_with_normal_pmap<typename CGAL::Kernel_traits<Point_with_normal>::Kernel>();
-}
-
-#else
-/// Property map that accesses the normal vector from a Point_with_normal_3* pointer
-/// (or in general an iterator over Point_with_normal_3 elements).
-///
-/// @heading Is Model for the Concepts:
-/// \cgalModels `LvaluePropertyMap`
-///
-/// @heading Parameters:
-/// @param Gt Geometric traits class.
-
-template <class Gt>
-struct Normal_of_point_with_normal_pmap
-  : public boost::put_get_helper<typename Gt::Vector_3&,
-                                 Normal_of_point_with_normal_pmap<Gt> >
-{
-  typedef Point_with_normal_3<Gt> Point_with_normal; ///< Position + normal
-  typedef typename Gt::Vector_3 Vector; /// normal
-
-  typedef Point_with_normal* key_type;
-  typedef Vector value_type;
-  typedef value_type& reference;
-  typedef boost::lvalue_property_map_tag category;
-
-  /// Access a property map element.
-  ///
-  /// @tparam Iter Type convertible to key_type.
-  template <class Iter>
-  reference operator[](Iter it) const { return (reference) it->normal(); }
-};
-
-/// Free function to create a Normal_of_point_with_normal_pmap property map.
-///
-/// @relates Normal_of_point_with_normal_pmap
-
-template <class Iter> // Type convertible to key_type
-Normal_of_point_with_normal_pmap<typename CGAL::Kernel_traits<typename CGAL::value_type_traits<Iter>::type>::Kernel>
-make_normal_of_point_with_normal_pmap(Iter)
-{
-  // value_type_traits is a workaround as back_insert_iterator's value_type is void
-  typedef typename CGAL::value_type_traits<Iter>::type Value_type;
-  typedef typename CGAL::Kernel_traits<Value_type>::Kernel Kernel;
-  return Normal_of_point_with_normal_pmap<Kernel>();
-}
-#endif
-
-/// \endcond
-
-} //namespace CGAL
-
-
-#endif //CGAL_POINT_WITH_NORMAL_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Poisson_reconstruction_function.h b/3rdparty/CGAL-4.8/include/CGAL/Poisson_reconstruction_function.h
deleted file mode 100644
index 82b62a8..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Poisson_reconstruction_function.h
+++ /dev/null
@@ -1,1212 +0,0 @@
-// Copyright (c) 2007-09  INRIA (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
-// 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(s)     : Laurent Saboret, Pierre Alliez
-
-#ifndef CGAL_POISSON_RECONSTRUCTION_FUNCTION_H
-#define CGAL_POISSON_RECONSTRUCTION_FUNCTION_H
-
-#ifndef CGAL_DIV_NORMALIZED
-#  ifndef CGAL_DIV_NON_NORMALIZED
-#    define CGAL_DIV_NON_NORMALIZED 1
-#  endif
-#endif
-
-#include <vector>
-#include <deque>
-#include <algorithm>
-#include <cmath>
-#include <iterator>
-
-#include <CGAL/trace.h>
-#include <CGAL/Reconstruction_triangulation_3.h>
-#include <CGAL/spatial_sort.h>
-#ifdef CGAL_EIGEN3_ENABLED
-#include <CGAL/Eigen_solver_traits.h>
-#else
-#endif
-#include <CGAL/centroid.h>
-#include <CGAL/property_map.h>
-#include <CGAL/surface_reconstruction_points_assertions.h>
-#include <CGAL/poisson_refine_triangulation.h>
-#include <CGAL/Robust_circumcenter_filtered_traits_3.h>
-#include <CGAL/compute_average_spacing.h>
-#include <CGAL/Timer.h>
-
-#include <boost/shared_ptr.hpp>
-#include <boost/array.hpp>
-#include <boost/type_traits/is_convertible.hpp>
-#include <boost/utility/enable_if.hpp>
-
-/*! 
-  \file Poisson_reconstruction_function.h
-*/
-
-namespace CGAL {
-
-  namespace internal {
-template <class RT>
-bool
-invert(
-       const RT& a0,  const RT& a1,  const RT& a2,
-       const RT& a3,  const RT& a4,  const RT& a5,
-       const RT& a6,  const RT& a7,  const RT& a8,
-       RT& i0,   RT& i1,   RT& i2,
-       RT& i3,   RT& i4,   RT& i5,
-       RT& i6,   RT& i7,   RT& i8)
-{
-    // Compute the adjoint.
-    i0 = a4*a8 - a5*a7;
-    i1 = a2*a7 - a1*a8;
-    i2 = a1*a5 - a2*a4;
-    i3 = a5*a6 - a3*a8;
-    i4 = a0*a8 - a2*a6;
-    i5 = a2*a3 - a0*a5;
-    i6 = a3*a7 - a4*a6;
-    i7 = a1*a6 - a0*a7;
-    i8 = a0*a4 - a1*a3;
-
-    RT det = a0*i0 + a1*i3 + a2*i6;
-
-    if(det != 0) {
-      RT idet = (RT(1.0))/det;
-      i0 *= idet;
-      i1 *= idet;
-      i2 *= idet;
-      i3 *= idet;
-      i4 *= idet;
-      i5 *= idet;
-      i6 *= idet;
-      i7 *= idet;
-      i8 *= idet;
-      return true;
-    }
-
-    return false;
-}
-
-  }
-
-
-/// \cond SKIP_IN_MANUAL
-struct Poisson_visitor {
-  void before_insertion() const
-  {}
-};
-
-struct Poisson_skip_vertices { 
-  double ratio;
-  Random& m_random;
-  Poisson_skip_vertices(const double ratio, Random& random)
-    : ratio(ratio), m_random(random) {}
-
-  template <typename Iterator>
-  bool operator()(Iterator) const {
-    return m_random.get_double() < ratio;
-  }
-};
-
-// Given f1 and f2, two sizing fields, that functor wrapper returns
-//   max(f1, f2*f2)
-// The wrapper stores only pointers to the two functors.
-template <typename F1, typename F2>
-struct Special_wrapper_of_two_functions_keep_pointers {
-  F1 *f1;
-  F2 *f2;
-  Special_wrapper_of_two_functions_keep_pointers(F1* f1, F2* f2) 
-    : f1(f1), f2(f2) {}
-
-  template <typename X>
-  double operator()(const X& x) const {
-    return (std::max)((*f1)(x), CGAL::square((*f2)(x)));
-  }
-
-  template <typename X>
-  double operator()(const X& x) {
-    return (std::max)((*f1)(x), CGAL::square((*f2)(x)));
-  }
-}; // end struct Special_wrapper_of_two_functions_keep_pointers<F1, F2>
-/// \endcond 
-
-
-/*!
-\ingroup PkgPoissonSurfaceReconstruction
-
-\brief Implementation of the Poisson Surface Reconstruction method.
-  
-Given a set of 3D points with oriented normals sampled on the boundary
-of a 3D solid, the Poisson Surface Reconstruction method \cgalCite{Kazhdan06} 
-solves for an approximate indicator function of the inferred
-solid, whose gradient best matches the input normals. The output
-scalar function, represented in an adaptive octree, is then
-iso-contoured using an adaptive marching cubes.
-
-`Poisson_reconstruction_function` implements a variant of this
-algorithm which solves for a piecewise linear function on a 3D
-Delaunay triangulation instead of an adaptive octree.
-
-\tparam Gt Geometric traits class. 
-
-\cgalModels `ImplicitFunction`
-
-*/
-template <class Gt>
-class Poisson_reconstruction_function
-{
-// Public types
-public:
-
-  /// \name Types 
-  /// @{
-
-  typedef Gt Geom_traits; ///< Geometric traits class
-  /// \cond SKIP_IN_MANUAL
-  typedef Reconstruction_triangulation_3<Robust_circumcenter_filtered_traits_3<Gt> >
-                                                   Triangulation;
-  /// \endcond
-  typedef typename Triangulation::Cell_handle   Cell_handle;
-
-  // Geometric types
-  typedef typename Geom_traits::FT FT; ///< number type.
-  typedef typename Geom_traits::Point_3 Point; ///< point type.
-  typedef typename Geom_traits::Vector_3 Vector; ///< vector type.
-  typedef typename Geom_traits::Sphere_3 Sphere; 
-
-  /// @}
-
-// Private types
-private:
-
-  // Internal 3D triangulation, of type Reconstruction_triangulation_3.
-  // Note: poisson_refine_triangulation() requires a robust circumcenter computation.
-
-  // Repeat Triangulation types
-  typedef typename Triangulation::Triangulation_data_structure Triangulation_data_structure;
-  typedef typename Geom_traits::Ray_3 Ray;
-  typedef typename Geom_traits::Plane_3 Plane;
-  typedef typename Geom_traits::Segment_3 Segment;
-  typedef typename Geom_traits::Triangle_3 Triangle;
-  typedef typename Geom_traits::Tetrahedron_3 Tetrahedron;
-  typedef typename Triangulation::Vertex_handle Vertex_handle;
-  typedef typename Triangulation::Cell   Cell;
-  typedef typename Triangulation::Vertex Vertex;
-  typedef typename Triangulation::Facet  Facet;
-  typedef typename Triangulation::Edge   Edge;
-  typedef typename Triangulation::Cell_circulator  Cell_circulator;
-  typedef typename Triangulation::Facet_circulator Facet_circulator;
-  typedef typename Triangulation::Cell_iterator    Cell_iterator;
-  typedef typename Triangulation::Facet_iterator   Facet_iterator;
-  typedef typename Triangulation::Edge_iterator    Edge_iterator;
-  typedef typename Triangulation::Vertex_iterator  Vertex_iterator;
-  typedef typename Triangulation::Point_iterator   Point_iterator;
-  typedef typename Triangulation::Finite_vertices_iterator Finite_vertices_iterator;
-  typedef typename Triangulation::Finite_cells_iterator    Finite_cells_iterator;
-  typedef typename Triangulation::Finite_facets_iterator   Finite_facets_iterator;
-  typedef typename Triangulation::Finite_edges_iterator    Finite_edges_iterator;
-  typedef typename Triangulation::All_cells_iterator       All_cells_iterator;
-  typedef typename Triangulation::Locate_type Locate_type;
-
-// Data members.
-// Warning: the Surface Mesh Generation package makes copies of implicit functions,
-// thus this class must be lightweight and stateless.
-private:
-
-  // operator() is pre-computed on vertices of *m_tr by solving
-  // the Poisson equation Laplacian(f) = divergent(normals field).
-  boost::shared_ptr<Triangulation> m_tr;
-
-  mutable boost::shared_ptr<std::vector<boost::array<double,9> > > m_Bary;
-  mutable std::vector<Point> Dual;
-  mutable std::vector<Vector> Normal;
-
-  // contouring and meshing
-  Point m_sink; // Point with the minimum value of operator()
-  mutable Cell_handle m_hint; // last cell found = hint for next search
-
-  FT average_spacing;
-
-
-  /// function to be used for the different constructors available that are
-  /// doing the same thing but with default template parameters
-  template <typename InputIterator,
-            typename PointPMap,
-            typename NormalPMap,
-            typename Visitor
-  >
-  void forward_constructor(
-    InputIterator first,
-    InputIterator beyond,
-    PointPMap point_pmap,
-    NormalPMap normal_pmap,
-    Visitor visitor)
-  {
-    CGAL::Timer task_timer; task_timer.start();
-    CGAL_TRACE_STREAM << "Creates Poisson triangulation...\n";
-
-    // Inserts points in triangulation
-    m_tr->insert(
-      first,beyond,
-      point_pmap,
-      normal_pmap,
-      visitor);
-
-    // Prints status
-    CGAL_TRACE_STREAM << "Creates Poisson triangulation: " << task_timer.time() << " seconds, "
-                                                           << std::endl;
-  }
-
-
-// Public methods
-public:
-
-  /// \name Creation 
-  /// @{
-
-
-  /*! 
-    Creates a Poisson implicit function from the  range of points `[first, beyond)`. 
-
-    \tparam InputIterator iterator over input points. 
-
-    \tparam PointPMap is a model of `ReadablePropertyMap` with
-      a `value_type = Point`.  It can be omitted if `InputIterator`
-      `value_type` is convertible to `Point`. 
-    
-    \tparam NormalPMap is a model of `ReadablePropertyMap`
-      with a `value_type = Vector`.
-  */ 
-  template <typename InputIterator,
-            typename PointPMap,
-            typename NormalPMap
-  >
-  Poisson_reconstruction_function(
-    InputIterator first,  ///< iterator over the first input point.
-    InputIterator beyond, ///< past-the-end iterator over the input points.
-    PointPMap point_pmap, ///< property map: `value_type of InputIterator` -> `Point` (the position of an input point).
-    NormalPMap normal_pmap ///< property map: `value_type of InputIterator` -> `Vector` (the *oriented* normal of an input point).
-  )
-    : m_tr(new Triangulation), m_Bary(new std::vector<boost::array<double,9> > )
-    , average_spacing(CGAL::compute_average_spacing<CGAL::Sequential_tag>(first, beyond, point_pmap, 6))
-  {
-    forward_constructor(first, beyond, point_pmap, normal_pmap, Poisson_visitor());
-  }
-
-  /// \cond SKIP_IN_MANUAL
-  template <typename InputIterator,
-            typename PointPMap,
-            typename NormalPMap,
-            typename Visitor
-  >
-  Poisson_reconstruction_function(
-    InputIterator first,  ///< iterator over the first input point.
-    InputIterator beyond, ///< past-the-end iterator over the input points.
-    PointPMap point_pmap, ///< property map: `value_type of InputIterator` -> `Point` (the position of an input point).
-    NormalPMap normal_pmap, ///< property map: `value_type of InputIterator` -> `Vector` (the *oriented* normal of an input point).
-    Visitor visitor)
-    : m_tr(new Triangulation), m_Bary(new std::vector<boost::array<double,9> > )
-    , average_spacing(CGAL::compute_average_spacing<CGAL::Sequential_tag>(first, beyond, point_pmap, 6))
-  {
-    forward_constructor(first, beyond, point_pmap, normal_pmap, visitor);
-  }
-
-  // This variant creates a default point property map = Identity_property_map and Visitor=Poisson_visitor
-  template <typename InputIterator,
-            typename NormalPMap
-  >
-  Poisson_reconstruction_function(
-    InputIterator first,  ///< iterator over the first input point.
-    InputIterator beyond, ///< past-the-end iterator over the input points.
-    NormalPMap normal_pmap, ///< property map: `value_type of InputIterator` -> `Vector` (the *oriented* normal of an input point).
-    typename boost::enable_if<
-      boost::is_convertible<typename std::iterator_traits<InputIterator>::value_type, Point>
-    >::type* = 0
-  )
-  : m_tr(new Triangulation), m_Bary(new std::vector<boost::array<double,9> > )
-  , average_spacing(CGAL::compute_average_spacing<CGAL::Sequential_tag>(first, beyond, 6))
-  {
-    forward_constructor(first, beyond, 
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-      make_dereference_property_map(first),
-#else
-      make_identity_property_map(
-      typename std::iterator_traits<InputIterator>::value_type()),
-#endif
-      normal_pmap, Poisson_visitor());
-    CGAL::Timer task_timer; task_timer.start();
-  }
-  /// \endcond
-
-  /// @}
-
-  /// \name Operations
-  /// @{
-
-  /// Returns a sphere bounding the inferred surface.
-  Sphere bounding_sphere() const
-  {
-    return m_tr->bounding_sphere();
-  }
-  
-  /// \cond SKIP_IN_MANUAL
-  const Triangulation& tr() const {
-    return *m_tr;
-  }
-  
-  // This variant requires all parameters.
-  template <class SparseLinearAlgebraTraits_d,
-            class Visitor>
-  bool compute_implicit_function(
-                                 SparseLinearAlgebraTraits_d solver,// = SparseLinearAlgebraTraits_d(),
-                                 Visitor visitor,
-                                 double approximation_ratio = 0,
-                                 double average_spacing_ratio = 5) 
-  {
-    CGAL::Timer task_timer; task_timer.start();
-    CGAL_TRACE_STREAM << "Delaunay refinement...\n";
-
-    // Delaunay refinement
-    const FT radius_edge_ratio_bound = 2.5;
-    const unsigned int max_vertices = (unsigned int)1e7; // max 10M vertices
-    const FT enlarge_ratio = 1.5;
-    const FT radius = sqrt(bounding_sphere().squared_radius()); // get triangulation's radius
-    const FT cell_radius_bound = radius/5.; // large
-
-    internal::Poisson::Constant_sizing_field<Triangulation> sizing_field(CGAL::square(cell_radius_bound));
-
-    std::vector<int> NB; 
-
-    NB.push_back( delaunay_refinement(radius_edge_ratio_bound,sizing_field,max_vertices,enlarge_ratio));
-
-    while(m_tr->insert_fraction(visitor)){
-
-      NB.push_back( delaunay_refinement(radius_edge_ratio_bound,sizing_field,max_vertices,enlarge_ratio));
-    }
-
-    if(approximation_ratio > 0. && 
-       approximation_ratio * std::distance(m_tr->input_points_begin(),
-                                           m_tr->input_points_end()) > 20) {
-
-      // Add a pass of Delaunay refinement.
-      //
-      // In that pass, the sizing field, of the refinement process of the
-      // triangulation, is based on the result of a poisson function with a
-      // sample of the input points. The ratio is 'approximation_ratio'.
-      //
-      // For optimization reasons, the cell criteria of the refinement
-      // process uses two sizing fields:
-      //
-      //   - the minimum of the square of 'coarse_poisson_function' and the
-      // square of the constant field equal to 'average_spacing',
-      //
-      //   - a second sizing field that is constant, and equal to:
-      //
-      //         average_spacing*average_spacing_ratio
-      //
-      // If a given cell is smaller than the constant second sizing field,
-      // then the cell is considered as small enough, and the first sizing
-      // field, more costly, is not evaluated.
-
-      typedef Filter_iterator<typename Triangulation::Input_point_iterator,
-                              Poisson_skip_vertices> Some_points_iterator;
-      //make it deterministic
-      Random random(0);
-      Poisson_skip_vertices skip(1.-approximation_ratio,random);
-      
-      CGAL_TRACE_STREAM << "SPECIAL PASS that uses an approximation of the result (approximation ratio: "
-                << approximation_ratio << ")" << std::endl;
-      CGAL::Timer approximation_timer; approximation_timer.start();
-
-      CGAL::Timer sizing_field_timer; sizing_field_timer.start();
-      Poisson_reconstruction_function<Geom_traits> 
-        coarse_poisson_function(Some_points_iterator(m_tr->input_points_end(),
-                                                     skip,
-                                                     m_tr->input_points_begin()),
-                                Some_points_iterator(m_tr->input_points_end(),
-                                                     skip),
-                                Normal_of_point_with_normal_pmap<Geom_traits>() );
-      coarse_poisson_function.compute_implicit_function(solver, Poisson_visitor(),
-                                                        0.);
-      internal::Poisson::Constant_sizing_field<Triangulation> 
-        min_sizing_field(CGAL::square(average_spacing));
-      internal::Poisson::Constant_sizing_field<Triangulation> 
-        sizing_field_ok(CGAL::square(average_spacing*average_spacing_ratio));
-
-      Special_wrapper_of_two_functions_keep_pointers<
-        internal::Poisson::Constant_sizing_field<Triangulation>,
-        Poisson_reconstruction_function<Geom_traits> > sizing_field2(&min_sizing_field,
-                                                                     &coarse_poisson_function);
-        
-      sizing_field_timer.stop();
-      std::cerr << "Construction time of the sizing field: " << sizing_field_timer.time() 
-                << " seconds" << std::endl;
-
-      NB.push_back( delaunay_refinement(radius_edge_ratio_bound,
-                                        sizing_field2,
-                                        max_vertices,
-                                        enlarge_ratio,
-                                        sizing_field_ok) );
-      approximation_timer.stop();
-      CGAL_TRACE_STREAM << "SPECIAL PASS END (" << approximation_timer.time() <<  " seconds)" << std::endl;
-    }
-
-    
-    // Prints status
-    CGAL_TRACE_STREAM << "Delaunay refinement: " << "added ";
-    for(std::size_t i = 0; i < NB.size()-1; i++){
-      CGAL_TRACE_STREAM << NB[i] << " + "; 
-    } 
-    CGAL_TRACE_STREAM << NB.back() << " Steiner points, "
-                      << task_timer.time() << " seconds, "
-                      << std::endl;
-    task_timer.reset();
-
-#ifdef CGAL_DIV_NON_NORMALIZED
-    CGAL_TRACE_STREAM << "Solve Poisson equation with non-normalized divergence...\n";
-#else
-    CGAL_TRACE_STREAM << "Solve Poisson equation with normalized divergence...\n";
-#endif
-
-    // Computes the Poisson indicator function operator()
-    // at each vertex of the triangulation.
-    double lambda = 0.1;
-    if ( ! solve_poisson(solver, lambda) )
-    {
-      std::cerr << "Error: cannot solve Poisson equation" << std::endl;
-      return false;
-    }
-
-    // Shift and orient operator() such that:
-    // - operator() = 0 on the input points,
-    // - operator() < 0 inside the surface.
-    set_contouring_value(median_value_at_input_vertices());
-
-    // Prints status
-    CGAL_TRACE_STREAM << "Solve Poisson equation: " << task_timer.time() << " seconds, "
-                                                    << std::endl;
-    task_timer.reset();
-
-    return true;
-  }
-  /// \endcond
-
-  /*!
-    This function must be called after the
-    insertion of oriented points. It computes the piecewise linear scalar
-    function operator() by: applying Delaunay refinement, solving for
-    operator() at each vertex of the triangulation with a sparse linear
-    solver, and shifting and orienting operator() such that it is 0 at all
-    input points and negative inside the inferred surface.
-
-    \tparam SparseLinearAlgebraTraits_d Symmetric definite positive sparse linear solver.
-    If \ref thirdpartyEigen "Eigen" 3.1 (or greater) is available and `CGAL_EIGEN3_ENABLED`
-    is defined, an overload with \link Eigen_solver_traits <tt>Eigen_solver_traits<Eigen::ConjugateGradient<Eigen_sparse_symmetric_matrix<double>::EigenType> ></tt> \endlink
-    as default solver is provided.
-  
-    \param solver sparse linear solver.
-    \param smoother_hole_filling controls if the Delaunay refinement is done for the input points, or for an approximation of the surface obtained from a first pass of the algorithm on a sample of the points.
-
-    \return `false` if the linear solver fails. 
-  */ 
-  template <class SparseLinearAlgebraTraits_d>
-  bool compute_implicit_function(SparseLinearAlgebraTraits_d solver, bool smoother_hole_filling = false)
-  {
-    if (smoother_hole_filling)
-      return compute_implicit_function<SparseLinearAlgebraTraits_d,Poisson_visitor>(solver,Poisson_visitor(),0.02,5);
-    else
-      return compute_implicit_function<SparseLinearAlgebraTraits_d,Poisson_visitor>(solver,Poisson_visitor());
-  }
-
-  /// \cond SKIP_IN_MANUAL
-#ifdef CGAL_EIGEN3_ENABLED
-  // This variant provides the default sparse linear traits class = Eigen_solver_traits.
-  bool compute_implicit_function(bool smoother_hole_filling = false)
-  {
-    typedef Eigen_solver_traits<Eigen::ConjugateGradient<Eigen_sparse_symmetric_matrix<double>::EigenType> > Solver;
-    return compute_implicit_function<Solver>(Solver(), smoother_hole_filling);
-  }
-#endif
-
-  boost::tuple<FT, Cell_handle, bool> special_func(const Point& p) const
-  {
-    m_hint = m_tr->locate(p  ,m_hint  ); // no hint when we use hierarchy
-
-    if(m_tr->is_infinite(m_hint)) {
-      int i = m_hint->index(m_tr->infinite_vertex());
-      return boost::make_tuple(m_hint->vertex((i+1)&3)->f(),
-                               m_hint, true);
-    }
-
-    FT a,b,c,d;
-    barycentric_coordinates(p,m_hint,a,b,c,d);
-    return boost::make_tuple(a * m_hint->vertex(0)->f() +
-                             b * m_hint->vertex(1)->f() +
-                             c * m_hint->vertex(2)->f() +
-                             d * m_hint->vertex(3)->f(),
-                             m_hint, false);
-  }
-  /// \endcond
-
-  /*! 
-    `ImplicitFunction` interface: evaluates the implicit function at a 
-    given 3D query point. The function `compute_implicit_function()` must be 
-    called before the first call to `operator()`. 
-  */ 
-  FT operator()(const Point& p) const
-  {
-    m_hint = m_tr->locate(p ,m_hint); 
-
-    if(m_tr->is_infinite(m_hint)) {
-      int i = m_hint->index(m_tr->infinite_vertex());
-      return m_hint->vertex((i+1)&3)->f();
-    }
-
-    FT a,b,c,d;
-    barycentric_coordinates(p,m_hint,a,b,c,d);
-    return a * m_hint->vertex(0)->f() +
-           b * m_hint->vertex(1)->f() +
-           c * m_hint->vertex(2)->f() +
-           d * m_hint->vertex(3)->f();
-  }
-  
-  /// \cond SKIP_IN_MANUAL
-  void initialize_cell_indices()
-  {
-    int i=0;
-    for(Finite_cells_iterator fcit = m_tr->finite_cells_begin();
-        fcit != m_tr->finite_cells_end();
-        ++fcit){
-      fcit->info()= i++;
-    }
-  }
-
-  void initialize_barycenters() const
-  {
-    m_Bary->resize(m_tr->number_of_cells());
-
-    for(std::size_t i=0; i< m_Bary->size();i++){
-      (*m_Bary)[i][0]=-1;
-    }
-  }
-
-  void initialize_cell_normals() const
-  {
-    Normal.resize(m_tr->number_of_cells());
-    int i = 0;
-    int N = 0;
-    for(Finite_cells_iterator fcit = m_tr->finite_cells_begin();
-        fcit != m_tr->finite_cells_end();
-        ++fcit){
-      Normal[i] = cell_normal(fcit);
-      if(Normal[i] == NULL_VECTOR){
-        N++;
-      }
-      ++i;
-    }
-    std::cerr << N << " out of " << i << " cells have NULL_VECTOR as normal" << std::endl;
-  }
-
-  void initialize_duals() const
-  {
-    Dual.resize(m_tr->number_of_cells());    
-    int i = 0;
-    for(Finite_cells_iterator fcit = m_tr->finite_cells_begin();
-        fcit != m_tr->finite_cells_end();
-        ++fcit){
-      Dual[i++] = m_tr->dual(fcit);
-    }
-  }
-
-  void clear_duals() const
-  {
-    Dual.clear();
-  }
-
-  void clear_normals() const
-  {
-    Normal.clear();
-  }
-
-  void initialize_matrix_entry(Cell_handle ch) const
-  {
-    boost::array<double,9> & entry = (*m_Bary)[ch->info()];
-    const Point& pa = ch->vertex(0)->point();
-    const Point& pb = ch->vertex(1)->point();
-    const Point& pc = ch->vertex(2)->point();
-    const Point& pd = ch->vertex(3)->point();
-    
-    Vector va = pa - pd;
-    Vector vb = pb - pd;
-    Vector vc = pc - pd;
-    
-    internal::invert(va.x(), va.y(), va.z(),
-           vb.x(), vb.y(), vb.z(),
-           vc.x(), vc.y(), vc.z(),
-           entry[0],entry[1],entry[2],entry[3],entry[4],entry[5],entry[6],entry[7],entry[8]);
-  }
-  /// \endcond
-  
-  /// Returns a point located inside the inferred surface.
-  Point get_inner_point() const
-  {
-    // Gets point / the implicit function is minimum
-    return m_sink;
-  }
-
-  /// @}
-
-// Private methods:
-private:
-
-  /// Delaunay refinement (break bad tetrahedra, where
-  /// bad means badly shaped or too big). The normal of
-  /// Steiner points is set to zero.
-  /// Returns the number of vertices inserted.
-
-  template <typename Sizing_field>
-  unsigned int delaunay_refinement(FT radius_edge_ratio_bound, ///< radius edge ratio bound (ignored if zero)
-                                   Sizing_field sizing_field, ///< cell radius bound (ignored if zero)
-                                   unsigned int max_vertices, ///< number of vertices bound
-                                   FT enlarge_ratio) ///< bounding box enlarge ratio
-  {
-    return delaunay_refinement(radius_edge_ratio_bound,
-                               sizing_field,
-                               max_vertices,
-                               enlarge_ratio,
-                               internal::Poisson::Constant_sizing_field<Triangulation>());
-  }
-
-  template <typename Sizing_field, 
-            typename Second_sizing_field>
-  unsigned int delaunay_refinement(FT radius_edge_ratio_bound, ///< radius edge ratio bound (ignored if zero)
-                                   Sizing_field sizing_field, ///< cell radius bound (ignored if zero)
-                                   unsigned int max_vertices, ///< number of vertices bound
-                                   FT enlarge_ratio, ///< bounding box enlarge ratio
-                                   Second_sizing_field second_sizing_field)
-  {
-    Sphere elarged_bsphere = enlarged_bounding_sphere(enlarge_ratio);
-    unsigned int nb_vertices_added = poisson_refine_triangulation(*m_tr,radius_edge_ratio_bound,sizing_field,second_sizing_field,max_vertices,elarged_bsphere);
-
-    return nb_vertices_added;
-  }
-
-  /// Poisson reconstruction.
-  /// Returns false on error.
-  ///
-  /// @commentheading Template parameters:
-  /// @param SparseLinearAlgebraTraits_d Symmetric definite positive sparse linear solver.
-  template <class SparseLinearAlgebraTraits_d>
-  bool solve_poisson(
-    SparseLinearAlgebraTraits_d solver, ///< sparse linear solver
-    double lambda)
-  {
-    CGAL_TRACE("Calls solve_poisson()\n");
-
-    double time_init = clock();
-
-    double duration_assembly = 0.0;
-    double duration_solve = 0.0;
-
-
-    initialize_cell_indices();
-    initialize_barycenters();
-
-    // get #variables
-    constrain_one_vertex_on_convex_hull();
-    m_tr->index_unconstrained_vertices();
-    unsigned int nb_variables = static_cast<unsigned int>(m_tr->number_of_vertices()-1);
-
-    CGAL_TRACE("  Number of variables: %ld\n", (long)(nb_variables));
-
-    // Assemble linear system A*X=B
-    typename SparseLinearAlgebraTraits_d::Matrix A(nb_variables); // matrix is symmetric definite positive
-    typename SparseLinearAlgebraTraits_d::Vector X(nb_variables), B(nb_variables);
-
-    initialize_duals();
-#ifndef CGAL_DIV_NON_NORMALIZED
-    initialize_cell_normals();
-#endif
-    Finite_vertices_iterator v, e;
-    for(v = m_tr->finite_vertices_begin(),
-        e = m_tr->finite_vertices_end();
-        v != e;
-        ++v)
-    {
-      if(!m_tr->is_constrained(v)) {
-#ifdef CGAL_DIV_NON_NORMALIZED
-        B[v->index()] = div(v); // rhs -> divergent
-#else // not defined(CGAL_DIV_NORMALIZED)
-        B[v->index()] = div_normalized(v); // rhs -> divergent
-#endif // not defined(CGAL_DIV_NORMALIZED)
-        assemble_poisson_row<SparseLinearAlgebraTraits_d>(A,v,B,lambda);
-      }
-    }
-
-    clear_duals();
-    clear_normals();
-    duration_assembly = (clock() - time_init)/CLOCKS_PER_SEC;
-    CGAL_TRACE("  Creates matrix: done (%.2lf s)\n", duration_assembly);
-
-    CGAL_TRACE("  Solve sparse linear system...\n");
-
-    // Solve "A*X = B". On success, solution is (1/D) * X.
-    time_init = clock();
-    double D;
-    if(!solver.linear_solver(A, B, X, D))
-      return false;
-    CGAL_surface_reconstruction_points_assertion(D == 1.0);
-    duration_solve = (clock() - time_init)/CLOCKS_PER_SEC;
-
-    CGAL_TRACE("  Solve sparse linear system: done (%.2lf s)\n", duration_solve);
-
-    // copy function's values to vertices
-    unsigned int index = 0;
-    for (v = m_tr->finite_vertices_begin(), e = m_tr->finite_vertices_end(); v!= e; ++v)
-      if(!m_tr->is_constrained(v))
-        v->f() = X[index++];
-
-    CGAL_TRACE("End of solve_poisson()\n");
-
-    return true;
-  }
-
-  /// Shift and orient the implicit function such that:
-  /// - the implicit function = 0 for points / f() = contouring_value,
-  /// - the implicit function < 0 inside the surface.
-  ///
-  /// Returns the minimum value of the implicit function.
-  FT set_contouring_value(FT contouring_value)
-  {
-    // median value set to 0.0
-    shift_f(-contouring_value);
-
-    // check value on convex hull (should be positive)
-    Vertex_handle v = any_vertex_on_convex_hull();
-    if(v->f() < 0.0)
-      flip_f();
-
-    // Update m_sink
-    FT sink_value = find_sink();
-    return sink_value;
-  }
-
-
-/// Gets median value of the implicit function over input vertices.
-  FT median_value_at_input_vertices() const
-  {
-    std::deque<FT> values;
-    Finite_vertices_iterator v, e;
-    for(v = m_tr->finite_vertices_begin(),
-        e= m_tr->finite_vertices_end();
-        v != e; 
-        v++)
-      if(v->type() == Triangulation::INPUT)
-        values.push_back(v->f());
-
-    std::size_t size = values.size();
-    if(size == 0)
-    {
-      std::cerr << "Contouring: no input points\n";
-      return 0.0;
-    }
-
-    std::sort(values.begin(),values.end());
-    std::size_t index = size/2;
-    // return values[size/2];
-    return 0.5 * (values[index] + values[index+1]); // avoids singular cases
-  }
-
-  void barycentric_coordinates(const Point& p,
-                               Cell_handle cell,
-                               FT& a,
-                               FT& b,
-                               FT& c,
-                               FT& d) const
-  {
-
-    //    const Point& pa = cell->vertex(0)->point();
-    // const Point& pb = cell->vertex(1)->point();
-    // const Point& pc = cell->vertex(2)->point();
-    const Point& pd = cell->vertex(3)->point();
-#if 1
-    //Vector va = pa - pd;
-    //Vector vb = pb - pd;
-    //Vector vc = pc - pd;
-    Vector vp = p - pd;
-
-    //FT i00, i01, i02, i10, i11, i12, i20, i21, i22;
-    //internal::invert(va.x(), va.y(), va.z(),
-    //       vb.x(), vb.y(), vb.z(),
-    //       vc.x(), vc.y(), vc.z(),
-    //       i00, i01, i02, i10, i11, i12, i20, i21, i22);
-    const boost::array<double,9> & i = (*m_Bary)[cell->info()];
-    if(i[0]==-1){
-      initialize_matrix_entry(cell);
-    }
-    //    UsedBary[cell->info()] = true;
-    a = i[0] * vp.x() + i[3] * vp.y() + i[6] * vp.z();
-    b = i[1] * vp.x() + i[4] * vp.y() + i[7] * vp.z();
-    c = i[2] * vp.x() + i[5] * vp.y() + i[8] * vp.z();
-    d = 1 - ( a + b + c);
-#else
-    FT v = volume(pa,pb,pc,pd);
-    a = std::fabs(volume(pb,pc,pd,p) / v);
-    b = std::fabs(volume(pa,pc,pd,p) / v);
-    c = std::fabs(volume(pb,pa,pd,p) / v);
-    d = std::fabs(volume(pb,pc,pa,p) / v);
-
-    std::cerr << "_________________________________\n";
-    std::cerr << aa << "  " << bb << "  " << cc << "  " << dd << std::endl;
-    std::cerr << a << "  " << b << "  " << c << "  " << d << std::endl;
-
-#endif
-  }
-
-  FT find_sink()
-  {
-    m_sink = CGAL::ORIGIN;
-    FT min_f = 1e38;
-    Finite_vertices_iterator v, e;
-    for(v = m_tr->finite_vertices_begin(),
-        e= m_tr->finite_vertices_end();
-        v != e;
-        v++)
-    {
-      if(v->f() < min_f)
-      {
-        m_sink = v->point();
-        min_f = v->f();
-      }
-    }
-    return min_f;
-  }
-
-  void shift_f(const FT shift)
-  {
-    Finite_vertices_iterator v, e;
-    for(v = m_tr->finite_vertices_begin(),
-        e = m_tr->finite_vertices_end();
-        v!= e;
-        v++)
-      v->f() += shift;
-  }
-
-  void flip_f()
-  {
-    Finite_vertices_iterator v, e;
-    for(v = m_tr->finite_vertices_begin(),
-          e = m_tr->finite_vertices_end();
-        v != e;
-        v++)
-      v->f() = -v->f();
-  }
-
-  Vertex_handle any_vertex_on_convex_hull()
-  {
-    Cell_handle ch = m_tr->infinite_vertex()->cell();
-    return  ch->vertex( (ch->index( m_tr->infinite_vertex())+1)%4);
-  }
-
-
-  void constrain_one_vertex_on_convex_hull(const FT value = 0.0)
-  {
-    Vertex_handle v = any_vertex_on_convex_hull();
-    m_tr->constrain(v);
-    v->f() = value;
-  }
-
-  // TODO: Some entities are computed too often
-  // - nn and area should not be computed for the face and its opposite face
-  // 
-  // divergent
-  FT div_normalized(Vertex_handle v)
-  {
-    std::vector<Cell_handle> cells;
-    cells.reserve(32);
-    m_tr->incident_cells(v,std::back_inserter(cells));
-  
-    FT div = 0;
-    typename std::vector<Cell_handle>::iterator it;
-    for(it = cells.begin(); it != cells.end(); it++)
-    {
-      Cell_handle cell = *it;
-      if(m_tr->is_infinite(cell))
-        continue;
-
-      // compute average normal per cell
-      Vector n = get_cell_normal(cell);
-
-      // zero normal - no need to compute anything else
-      if(n == CGAL::NULL_VECTOR)
-        continue;
-
-
-      // compute n'
-      int index = cell->index(v);
-      const Point& x = cell->vertex(index)->point();
-      const Point& a = cell->vertex((index+1)%4)->point();
-      const Point& b = cell->vertex((index+2)%4)->point();
-      const Point& c = cell->vertex((index+3)%4)->point();
-      Vector nn = (index%2==0) ? CGAL::cross_product(b-a,c-a) : CGAL::cross_product(c-a,b-a);
-      nn = nn / std::sqrt(nn*nn); // normalize
-      Vector p = a - x;
-      Vector q = b - x;
-      Vector r = c - x;
-      FT p_n = std::sqrt(p*p);
-      FT q_n = std::sqrt(q*q);
-      FT r_n = std::sqrt(r*r);
-      FT solid_angle = p*(CGAL::cross_product(q,r));
-      solid_angle = std::abs(solid_angle / (p_n*q_n*r_n + (p*q)*r_n + (q*r)*p_n + (r*p)*q_n));
-
-      FT area = std::sqrt(squared_area(a,b,c));
-      FT length = p_n + q_n + r_n;
-      div += n * nn * area / length ;
-    }
-    return div * FT(3.0);
-  }
-
-  FT div(Vertex_handle v)
-  {
-    std::vector<Cell_handle> cells;
-    cells.reserve(32);
-    m_tr->incident_cells(v,std::back_inserter(cells));
-  
-    FT div = 0.0;
-    typename std::vector<Cell_handle>::iterator it;
-    for(it = cells.begin(); it != cells.end(); it++)
-    {
-      Cell_handle cell = *it;
-      if(m_tr->is_infinite(cell))
-        continue;
-      
-      const int index = cell->index(v);
-      const Point& a = cell->vertex(m_tr->vertex_triple_index(index, 0))->point();
-      const Point& b = cell->vertex(m_tr->vertex_triple_index(index, 1))->point();
-      const Point& c = cell->vertex(m_tr->vertex_triple_index(index, 2))->point();
-      const Vector nn = CGAL::cross_product(b-a,c-a);
-
-      div+= nn * (//v->normal() + 
-                  cell->vertex((index+1)%4)->normal() +
-                  cell->vertex((index+2)%4)->normal() +
-                  cell->vertex((index+3)%4)->normal());
-    }
-    return div;
-  }
-
-  Vector get_cell_normal(Cell_handle cell)
-  {
-    return Normal[cell->info()];
-  }
-
-  Vector cell_normal(Cell_handle cell) const
-  {
-    const Vector& n0 = cell->vertex(0)->normal();
-    const Vector& n1 = cell->vertex(1)->normal();
-    const Vector& n2 = cell->vertex(2)->normal();
-    const Vector& n3 = cell->vertex(3)->normal();
-    Vector n = n0 + n1 + n2 + n3;
-    if(n != NULL_VECTOR){
-      FT sq_norm = n*n;
-      if(sq_norm != 0.0){
-        return n / std::sqrt(sq_norm); // normalize
-      }
-    }
-    return NULL_VECTOR;
-  }
-
-  // cotan formula as area(voronoi face) / len(primal edge)
-  FT cotan_geometric(Edge& edge)
-  {
-    Cell_handle cell = edge.first;
-    Vertex_handle vi = cell->vertex(edge.second);
-    Vertex_handle vj = cell->vertex(edge.third);
-
-    // primal edge
-    const Point& pi = vi->point();
-    const Point& pj = vj->point();
-    Vector primal = pj - pi;
-    FT len_primal = std::sqrt(primal * primal);
-    return area_voronoi_face(edge) / len_primal;
-  }
-
-  // spin around edge
-  // return area(voronoi face)
-  FT area_voronoi_face(Edge& edge)
-  {
-    // circulate around edge
-    Cell_circulator circ = m_tr->incident_cells(edge);
-    Cell_circulator done = circ;
-    std::vector<Point> voronoi_points;
-    voronoi_points.reserve(9);
-    do
-    {
-      Cell_handle cell = circ;
-      if(!m_tr->is_infinite(cell))
-        voronoi_points.push_back(Dual[cell->info()]);
-      else // one infinite tet, switch to another calculation
-        return area_voronoi_face_boundary(edge);
-      circ++;
-    }
-    while(circ != done);
-
-    if(voronoi_points.size() < 3)
-    {
-      CGAL_surface_reconstruction_points_assertion(false);
-      return 0.0;
-    }
-
-    // sum up areas
-    FT area = 0.0;
-    const Point& a = voronoi_points[0];
-    std::size_t nb_triangles = voronoi_points.size() - 1;
-    for(std::size_t i=1;i<nb_triangles;i++)
-    {
-      const Point& b = voronoi_points[i];
-      const Point& c = voronoi_points[i+1];
-      area += std::sqrt(squared_area(a,b,c));
-    }
-    return area;
-  }
-
-  // approximate area when a cell is infinite
-  FT area_voronoi_face_boundary(Edge& edge)
-  {
-    FT area = 0.0;
-    Vertex_handle vi = edge.first->vertex(edge.second);
-    Vertex_handle vj = edge.first->vertex(edge.third);
-
-    const Point& pi = vi->point();
-    const Point& pj = vj->point();
-    Point m = CGAL::midpoint(pi,pj);
-
-    // circulate around each incident cell
-    Cell_circulator circ = m_tr->incident_cells(edge);
-    Cell_circulator done = circ;
-    do
-    {
-      Cell_handle cell = circ;
-      if(!m_tr->is_infinite(cell))
-      {
-        // circumcenter of cell
-        Point c = Dual[cell->info()];
-        Tetrahedron tet = m_tr->tetrahedron(cell);
-
-        int i = cell->index(vi);
-        int j = cell->index(vj);
-        int k =  Triangulation_utils_3::next_around_edge(i,j);
-        int l =  Triangulation_utils_3::next_around_edge(j,i);
-
-        Vertex_handle vk = cell->vertex(k);
-        Vertex_handle vl = cell->vertex(l);
-
-        const Point& pk = vk->point();
-        const Point& pl = vl->point();
-
-        // if circumcenter is outside tet
-        // pick barycenter instead
-        if(tet.has_on_unbounded_side(c))
-        {
-          Point cell_points[4] = {pi,pj,pk,pl};
-          c = CGAL::centroid(cell_points, cell_points+4);
-        }
-
-        Point ck = CGAL::circumcenter(pi,pj,pk);
-        Point cl = CGAL::circumcenter(pi,pj,pl);
-
-        area += std::sqrt(squared_area(m,c,ck));
-        area += std::sqrt(squared_area(m,c,cl));
-      }
-      circ++;
-    }
-    while(circ != done);
-    return area;
-  }
-
-  /// Assemble vi's row of the linear system A*X=B
-  ///
-  /// @commentheading Template parameters:
-  /// @param SparseLinearAlgebraTraits_d Symmetric definite positive sparse linear solver.
-  template <class SparseLinearAlgebraTraits_d>
-  void assemble_poisson_row(typename SparseLinearAlgebraTraits_d::Matrix& A,
-                            Vertex_handle vi,
-                            typename SparseLinearAlgebraTraits_d::Vector& B,
-                            double lambda)
-  {
-    // for each vertex vj neighbor of vi
-    std::vector<Edge> edges;
-    m_tr->incident_edges(vi,std::back_inserter(edges));
-
-    double diagonal = 0.0;
-
-    for(typename std::vector<Edge>::iterator it = edges.begin();
-        it != edges.end();
-        it++)
-      {
-        Vertex_handle vj = it->first->vertex(it->third);
-        if(vj == vi){
-          vj = it->first->vertex(it->second);
-        }
-        if(m_tr->is_infinite(vj))
-          continue;
-
-        // get corresponding edge
-        Edge edge( it->first, it->first->index(vi), it->first->index(vj));
-        if(vi->index() < vj->index()){
-          std::swap(edge.second,  edge.third);
-        }
-
-        double cij = cotan_geometric(edge);
-
-        if(m_tr->is_constrained(vj)){
-          if(! is_valid(vj->f())){
-            std::cerr << "vj->f() = " << vj->f() << " is not valid" << std::endl;
-          }
-          B[vi->index()] -= cij * vj->f(); // change rhs
-          if(! is_valid( B[vi->index()])){
-            std::cerr << " B[vi->index()] = " <<  B[vi->index()] << " is not valid" << std::endl;
-          }
-
-        } else {
-          if(! is_valid(cij)){
-            std::cerr << "cij = " << cij << " is not valid" << std::endl;
-          }
-          A.set_coef(vi->index(),vj->index(), -cij, true /*new*/); // off-diagonal coefficient
-        }
-
-        diagonal += cij;
-      }
-    // diagonal coefficient
-    if (vi->type() == Triangulation::INPUT){
-      A.set_coef(vi->index(),vi->index(), diagonal + lambda, true /*new*/) ;
-    } else{
-      A.set_coef(vi->index(),vi->index(), diagonal, true /*new*/);
-    }
-  }
-  
-
-  /// Computes enlarged geometric bounding sphere of the embedded triangulation.
-  Sphere enlarged_bounding_sphere(FT ratio) const
-  {
-    Sphere bsphere = bounding_sphere(); // triangulation's bounding sphere
-    return Sphere(bsphere.center(), bsphere.squared_radius() * ratio*ratio);
-  }
-
-}; // end of Poisson_reconstruction_function
-
-
-} //namespace CGAL
-
-#endif // CGAL_POISSON_RECONSTRUCTION_FUNCTION_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polychain_2.h b/3rdparty/CGAL-4.8/include/CGAL/Polychain_2.h
deleted file mode 100644
index 542adfb..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polychain_2.h
+++ /dev/null
@@ -1,859 +0,0 @@
-// Copyright (c) 2015  Università della Svizzera italiana.
-// 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
-// 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(s)     : Panagiotis Cheilaris, Sandeep Kumar Dey, Evanthia Papadopoulou
-//philaris at gmail.com, sandeep.kr.dey at gmail.com, evanthia.papadopoulou at usi.ch
-
-#ifndef CGAL_POLYCHAIN_2_H
-#define CGAL_POLYCHAIN_2_H
-
-#include <CGAL/basic.h>
-#include <CGAL/Polygon_2.h>
-#include <CGAL/intersections.h>
-
-
-// Polychainsegment_2
-
-namespace CGAL {
-
-namespace Qt {
-  template <typename K> class PainterOstream;
-}
-
-template <class Traits_P, class Container_P
-        = std::vector<typename Traits_P::Point_2> >
-class Polychainsegment_2 : public Polygon_2<Traits_P, Container_P> {
-
-  public:
-    typedef Traits_P Traits;
-    typedef Polygon_2<Traits_P, Container_P> Base;
-
-    // constructors
-
-    Polychainsegment_2() : Base() {}
-
-    Polychainsegment_2(
-        const Polychainsegment_2<Traits_P,Container_P>& pc)
-      : Base((Base) pc) {}
-
-    template <class InputIterator>
-    Polychainsegment_2(InputIterator first, InputIterator last,
-                       Traits p_traits = Traits())
-        : Base(first, last, p_traits)  {}
-
-
-    template< class K >
-    void draw(CGAL::Qt::PainterOstream<K>& stream) const {
-      typedef typename K::Segment_2 K_Segment_2;
-      typedef typename Polychainsegment_2<
-                        Traits_P,Container_P>::Vertex_const_iterator
-              VI;
-
-      if (this->size() > 1) {
-        VI source = this->vertices_begin();
-        VI target = source+1;
-        for( ; target!=this->vertices_end(); ++source, ++target)
-        {
-          stream << K_Segment_2(*source, *target);
-        }
-      }
-    }
-
-    template< class Stream >
-    void draw(Stream & str) const
-    {
-      typedef typename Traits_P::Segment_2 Segment_2;
-      typedef typename Polychainsegment_2<
-                        Traits_P,Container_P>::Vertex_const_iterator
-              VI;
-      if (this->size() > 1) {
-        VI source = this->vertices_begin();
-        VI target = source+1;
-        for( ; target!=this->vertices_end(); ++source, ++target)
-        {
-          str << Segment_2(*source, *target);
-        }
-      }
-    }
-
-} ;
-
-
-
-
-template <class Traits_P, class Container_P>
-std::ostream&
-operator<<(std::ostream &os,
-           const Polychainsegment_2<Traits_P,Container_P>& p)
-{
-  typename Polychainsegment_2<Traits_P,Container_P>
-              ::Vertex_const_iterator
-           i;
-
-  switch(os.iword(IO::mode)) {
-    case IO::ASCII :
-      os << p.size() << ' ';
-      for (i = p.vertices_begin(); i != p.vertices_end(); ++i) {
-        os << *i << ' ';
-      }
-      return os;
-
-    case IO::BINARY :
-      os << p.size();
-      for (i = p.vertices_begin(); i != p.vertices_end(); ++i) {
-        os << *i;
-      }
-      return os;
-
-    default:
-      os << "Polychainsegment_2(" << std::endl;
-      for (i = p.vertices_begin(); i != p.vertices_end(); ++i) {
-        os << "  " << *i << std::endl;
-      }
-      os << ")" << std::endl;
-      return os;
-  }
-}
-
-
-
-
-
-/* the following not allowed in some compilers: */
-/*
-template< class Stream,
-          class Traits_P,
-          class Container_P = std::vector<typename Traits_P::Point_2>
-        >
-inline
-Stream& operator<<(Stream &s,
-                   const Polychainsegment_2 <Traits_P, Container_P> &P)
-{
-  P.draw(s);
-  return s;
-}
-*/
-
-
-/* instead, we use overloading */
-
-/*
-template< class Stream,
-          class Traits_P
-        >
-inline
-Stream& operator<<(Stream &s,
-                   const Polychainsegment_2 <Traits_P> &P)
-{
-  P.draw(s);
-  return s;
-}
-
-
-template< class Stream,
-          class Traits_P,
-          class Container_P
-        >
-inline
-Stream& operator<<(Stream &s,
-                   const Polychainsegment_2 <Traits_P, Container_P> &P)
-{
-  P.draw(s);
-  return s;
-}
-*/
-
-
-
-// Polychainray_2
-
-template <class Traits_P, class Container_P
-        = std::vector<typename Traits_P::Point_2> >
-class Polychainray_2 :
-  public Polychainsegment_2<Traits_P, Container_P> {
-
-public:
-    typedef Traits_P Traits;
-
-private:
-    typedef typename Traits_P::Direction_2 OutgoingDirection;
-    typedef Polychainsegment_2<Traits_P, Container_P> Base;
-
-    OutgoingDirection outgoing;
-
-public:
-
-    // constructors
-
-    Polychainray_2(): Base(), outgoing() {}
-
-    Polychainray_2(const Polychainray_2<Traits_P,Container_P>& pcr)
-      : Base((Base) pcr), outgoing(pcr.outgoing) {}
-
-    template <class InputIterator>
-    Polychainray_2(InputIterator first, InputIterator last,
-	           OutgoingDirection d,
-              Traits p_traits = Traits())
-        : Base(first, last, p_traits), outgoing(d)
-    {
-    }
-
-
-    // get_outgoing
-
-    OutgoingDirection get_outgoing() const {
-	return outgoing;
-    }
-
-
-    // drawing
-
-    template< class K >
-    void draw(CGAL::Qt::PainterOstream<K>& stream) const {
-      typedef typename K::Segment_2 K_Segment_2;
-      typedef typename K::Ray_2 K_Ray_2;
-      typedef typename
-	  Polychainray_2<Traits_P,Container_P>::Vertex_const_iterator VI;
-
-      CGAL_assertion( this->size() > 0 );
-
-      VI source = this->vertices_begin();
-      if (this->size() > 1) {
-        VI target = source+1;
-        for( ; target!=this->vertices_end(); ++source, ++target)
-        {
-          stream << K_Segment_2(*source, *target);
-        }
-      }
-      // now source contains the last point;
-      // draw outgoing ray from this point
-      stream << K_Ray_2(*source, this->get_outgoing());
-    }
-
-    template< class Stream >
-    void draw(Stream & stream) const {
-      typedef typename Traits_P::Segment_2 Segment_2;
-      typedef typename Traits_P::Ray_2 Ray_2;
-      typedef typename
-	  Polychainray_2<Traits_P,Container_P>::Vertex_const_iterator VI;
-
-      CGAL_assertion( this->size() > 0 );
-
-      VI source = this->vertices_begin();
-      if (this->size() > 1) {
-        VI target = source+1;
-        for( ; target!=this->vertices_end(); ++source, ++target)
-        {
-          stream << Segment_2(*source, *target);
-        }
-      }
-      // now source contains the last point;
-      // draw outgoing ray from this point
-      stream << Ray_2(*source, this->get_outgoing());
-    }
-
-
-} ;
-
-
-template <class Traits_P, class Container_P>
-std::ostream&
-operator<<(std::ostream &os,
-           const Polychainray_2<Traits_P,Container_P>& p)
-{
-  typename Polychainray_2<Traits_P,Container_P>::Vertex_const_iterator i;
-
-  switch(os.iword(IO::mode)) {
-    case IO::ASCII :
-      os << p.size() << ' ';
-      for (i = p.vertices_begin(); i != p.vertices_end(); ++i) {
-        os << *i << ' ';
-      }
-      os << ", dout=" << p.get_outgoing() << ' ';
-      return os;
-
-    case IO::BINARY :
-      os << p.size();
-      for (i = p.vertices_begin(); i != p.vertices_end(); ++i) {
-        os << *i;
-      }
-      os << p.get_outgoing();
-      return os;
-
-    default:
-      os << "Polychainray_2(" << std::endl;
-      for (i = p.vertices_begin(); i != p.vertices_end(); ++i) {
-        os << "  " << *i << std::endl;
-      }
-      os << "dout=" << p.get_outgoing() << std::endl;
-      os << ")" << std::endl;
-      return os;
-  }
-}
-
-
-
-
-
-/*
-template< class Stream,
-          class Traits_P
-        >
-inline
-Stream& operator<<(Stream &s,
-                   const Polychainray_2 <Traits_P> &P)
-{
-  P.draw(s);
-  return s;
-}
-
-
-template< class Stream,
-          class Traits_P,
-          class Container_P
-        >
-inline
-Stream& operator<<(Stream &s,
-                   const Polychainray_2 <Traits_P, Container_P> &P)
-{
-  P.draw(s);
-  return s;
-}
-*/
-
-
-
-// Polychainline_2
-
-template <class Traits_P, class Container_P
-        = std::vector<typename Traits_P::Point_2> >
-class Polychainline_2 : public Polychainray_2<Traits_P, Container_P> {
-
-public:
-
-private:
-    typedef Traits_P Traits;
-    typedef typename Traits_P::Direction_2 IncomingDirection;
-    typedef typename Traits_P::Direction_2 OutgoingDirection;
-    typedef typename Traits_P::Line_2      Line_2;
-    typedef typename Traits_P::Ray_2       Ray_2;
-    typedef typename Traits_P::Segment_2   Segment_2;
-    typedef typename Traits_P::Point_2     Point_2;
-    typedef Polychainray_2<Traits_P, Container_P>  Base;
-    typedef Polychainline_2<Traits_P, Container_P> Self;
-
-    IncomingDirection incoming;
-    bool is_line_optimization;
-
-public:
-
-    // constructors
-
-    Polychainline_2() : Base(), incoming(),
-      is_line_optimization(false)
-    {}
-
-    Polychainline_2(const Self& pcl)
-      : Base((Base) pcl), incoming(pcl.incoming),
-        is_line_optimization(pcl.is_line_optimization)
-    {}
-
-    template <class InputIterator>
-    Polychainline_2(IncomingDirection dinc,
-	            InputIterator first, InputIterator last,
-	            OutgoingDirection dout,
-                    Traits p_traits = Traits())
-        : Base(first, last, dout, p_traits), incoming(dinc),
-          is_line_optimization(false)
-    {
-    }
-
-    void set_line_optimization() {
-      CGAL_assertion(this->size() == 1);
-      CGAL_assertion(this->incoming == - this->get_outgoing());
-      is_line_optimization = true;
-    }
-
-    // get_incoming
-
-    IncomingDirection get_incoming() const {
-	return incoming;
-    }
-
-
-    // unary minus operator
-    // that reverses the orientation of the polychainline
-
-    Self
-    operator-() const {
-      // first reverse list of points of polychainline
-
-      std::vector<typename Traits_P::Point_2> reverse;
-
-      unsigned int npts = this->size();
-
-      CGAL_SDG_DEBUG(std::cout << "pcl_reverse npts="
-          << npts << std::endl;);
-
-      reverse.resize(npts);
-
-      //std::reverse_copy(this->vertices_begin(),
-      //                  this->vertices_end(),
-      //                  reverse);
-
-      typedef typename Polychainline_2<
-                        Traits_P,Container_P>::Vertex_const_iterator
-              VI;
-
-      unsigned int i = npts - 1;
-
-      for (VI vi = this->vertices_begin();
-              vi != this->vertices_end();
-              ++vi)
-      {
-        //CGAL_SDG_DEBUG(std::cout << "debug pcl_reverse setting at " << i
-        //          << " value " << *vi << std::endl;);
-        reverse[i] = *vi;
-        --i;
-      }
-
-
-      // then also swap incoming and outgoing directions
-
-      //return Self(this->get_outgoing(),
-      //            reverse.begin(),
-      //            reverse.end(),
-      //            this->get_incoming());
-
-      Self pclreverse(this->get_outgoing(),
-                      reverse.begin(),
-                      reverse.end(),
-                      this->get_incoming());
-
-      if (is_line_optimization) {
-        pclreverse.set_line_optimization();
-      }
-
-      return pclreverse;
-    }
-
-    // line_first_intersection_point_with
-    typename Traits_P::Point_2
-    line_first_intersection_point_with(
-        const Polychainline_2<Traits_P,Container_P>& pcl)
-    {
-      CGAL_assertion(is_line_optimization);
-      Line_2 line((*this)[0], this->get_outgoing());
-
-      typedef typename
-	  Polychainline_2<Traits_P,Container_P>::
-                     Vertex_const_iterator
-          VI;
-
-      CGAL::Object result;
-
-      VI sourcepcl  = pcl.vertices_begin();
-      Ray_2 rayincpcl (*sourcepcl,  pcl.get_incoming());
-      result = CGAL::intersection(line, rayincpcl);
-      if (const Point_2 *ipoint = CGAL::object_cast<Point_2>(&result)) {
-        return *ipoint;
-      }
-
-      if (pcl.size() > 1) {
-        VI targetpcl = sourcepcl+1;
-        for( ;
-            targetpcl != pcl.vertices_end();
-            ++sourcepcl, ++targetpcl)
-        {
-          Segment_2 testseg(*sourcepcl, *targetpcl);
-          result = CGAL::intersection(line, testseg);
-          if (const Point_2 *ipoint = CGAL::object_cast<Point_2>(&result)) {
-            return *ipoint;
-          }
-        }
-      }
-      Ray_2 rayoutpcl(*sourcepcl, pcl.get_outgoing());
-      result = CGAL::intersection(line, rayoutpcl);
-      if (const Point_2 *ipoint = CGAL::object_cast<Point_2>(&result)) {
-        return *ipoint;
-      }
-
-      CGAL_SDG_DEBUG(std::cout
-          << "debug error: no intersection found for "
-          << "this=" << *this << " pcl=" << pcl << std::endl;);
-
-      CGAL_assertion(false);
-
-      return Point_2();
-
-    } // end of line_first_intersection_point_with
-
-    // first_intersection_point_with
-    typename Traits_P::Point_2
-    first_intersection_point_with(
-        const Polychainline_2<Traits_P,Container_P>& pcl)
-    {
-      // for every piece of object,
-      // try intersecting with every piece of pcl
-
-      CGAL_SDG_DEBUG(std::cout
-          << "debug first_intersection entering this="
-          << *this << " pcl=" << pcl << std::endl;);
-
-      typedef typename
-	  Polychainline_2<Traits_P,Container_P>::
-                     Vertex_const_iterator
-          VI;
-
-      typedef typename std::vector<typename Traits_P::Segment_2>::
-               const_iterator SI;
-
-      CGAL_assertion( this->size() > 0 );
-      CGAL_assertion( pcl.size() > 0 );
-
-      if (this->is_line_optimization) {
-        return line_first_intersection_point_with(pcl);
-      }
-
-#if 0
-      CGAL_SDG_DEBUG(std::cout << "debug first_intersection "
-          << "creating empty vectors" << std::endl;);
-#endif
-
-      // create two empty vectors for storing the segments
-      std::vector<Segment_2> segmentsthis;
-      std::vector<Segment_2> segmentspcl;
-
-      VI sourcethis = this->vertices_begin();
-      Ray_2 rayincthis(*sourcethis, this->get_incoming());
-      if (this->size() > 1) {
-        VI targetthis = sourcethis+1;
-        for( ;
-            targetthis != this->vertices_end();
-            ++sourcethis, ++targetthis)
-        {
-          segmentsthis.push_back(Segment_2(*sourcethis, *targetthis));
-        }
-      }
-      Ray_2 rayoutthis(*sourcethis, this->get_outgoing());
-
-      CGAL_assertion(this->size() == (segmentsthis.size() + 1));
-
-#if 0
-      CGAL_SDG_DEBUG(std::cout << "debug first_intersection "
-                     << "segmentsthis computed" << std::endl;);
-#endif
-
-
-      VI sourcepcl  = pcl.vertices_begin();
-      Ray_2 rayincpcl (*sourcepcl,  pcl.get_incoming());
-      if (pcl.size() > 1) {
-        VI targetpcl = sourcepcl+1;
-        for( ;
-            targetpcl != pcl.vertices_end();
-            ++sourcepcl, ++targetpcl)
-        {
-          segmentspcl.push_back(Segment_2(*sourcepcl, *targetpcl));
-        }
-      }
-      Ray_2 rayoutpcl(*sourcepcl, pcl.get_outgoing());
-
-      CGAL_assertion(pcl.size() == (segmentspcl.size() + 1));
-
-#if 0
-      CGAL_SDG_DEBUG(std::cout << "debug first_intersection "
-                     << "segmentspcl computed" << std::endl;);
-#endif
-
-
-      CGAL::Object result;
-
-#if 0
-      CGAL_SDG_DEBUG(std::cout << "debug first_intersection "
-                    << "trying rayincthis with pcl" << std::endl;);
-#endif
-
-#if 0
-      CGAL_SDG_DEBUG(std::cout << "debug first_intersection "
-                << "trying ray " << rayincthis
-                     << " with ray " << rayincpcl << std::endl;);
-#endif
-
-      result = CGAL::intersection(rayincthis, rayincpcl);
-      if (const Point_2 *ipoint = CGAL::object_cast<Point_2>(&result)) {
-        return *ipoint;
-      }
-
-      for (SI sipcl = segmentspcl.begin();
-              sipcl != segmentspcl.end();
-              ++sipcl) {
-#if 0
-        CGAL_SDG_DEBUG(std::cout << "debug first_intersection "
-                << "trying ray " << rayincthis
-                       << " with segment " << *sipcl << std::endl;);
-#endif
-
-        result = CGAL::intersection(rayincthis, *sipcl);
-        if (const Point_2 *ipoint = CGAL::object_cast<Point_2>(&result)) {
-          return *ipoint;
-        }
-      }
-
-#if 0
-      CGAL_SDG_DEBUG(std::cout << "debug first_intersection "
-                << "trying ray " << rayincthis
-                     << " with ray " << rayoutpcl << std::endl;);
-#endif
-
-      result = CGAL::intersection(rayincthis, rayoutpcl);
-      if (const Point_2 *ipoint = CGAL::object_cast<Point_2>(&result)) {
-        return *ipoint;
-      }
-
-#if 0
-      CGAL_SDG_DEBUG(std::cout << "debug first_intersection "
-                     << "trying segmentsthis with pcl" << std::endl;);
-#endif
-
-      for (SI sithis = segmentsthis.begin();
-              sithis != segmentsthis.end();
-              ++sithis) {
-
-#if 0
-        CGAL_SDG_DEBUG(std::cout << "debug first_intersection "
-                << "trying segment " << *sithis
-                       << " with ray " << rayincpcl << std::endl;);
-#endif
-
-        result = CGAL::intersection(*sithis, rayincpcl);
-        if (const Point_2 *ipoint = CGAL::object_cast<Point_2>(&result)) {
-          return *ipoint;
-        }
-
-        for (SI sipcl = segmentspcl.begin();
-            sipcl != segmentspcl.end();
-            ++sipcl) {
-#if 0
-          CGAL_SDG_DEBUG(std::cout << "debug first_intersection "
-                << "trying segment " << *sithis
-                         << " with segment " << *sipcl << std::endl;);
-#endif
-
-          result = CGAL::intersection(*sithis, *sipcl);
-          if (const Point_2 *ipoint = CGAL::object_cast<Point_2>(&result))
-          {
-            return *ipoint;
-          }
-        }
-
-#if 0
-        CGAL_SDG_DEBUG(std::cout << "debug first_intersection "
-            << "trying segment " << *sithis
-            << " with ray " << rayoutpcl << std::endl;);
-#endif
-
-        result = CGAL::intersection(*sithis, rayoutpcl);
-        if (const Point_2 *ipoint = CGAL::object_cast<Point_2>(&result)) {
-          return *ipoint;
-        }
-
-      }
-
-#if 0
-      CGAL_SDG_DEBUG(std::cout << "debug first_intersection "
-                     << "trying rayoutthis with pcl" << std::endl;);
-#endif
-
-#if 0
-      CGAL_SDG_DEBUG(std::cout << "debug first_intersection "
-                << "trying ray " << rayoutthis
-                     << " with ray " << rayincpcl << std::endl;);
-#endif
-
-      result = CGAL::intersection(rayoutthis, rayincpcl);
-      if (const Point_2 *ipoint = CGAL::object_cast<Point_2>(&result)) {
-        return *ipoint;
-      }
-
-      for (SI sipcl = segmentspcl.begin();
-              sipcl != segmentspcl.end();
-              ++sipcl) {
-#if 0
-        CGAL_SDG_DEBUG(std::cout << "debug first_intersection "
-                << "trying ray " << rayoutthis
-                       << " with segment " << *sipcl << std::endl;);
-#endif
-
-        result = CGAL::intersection(rayoutthis, *sipcl);
-        if (const Point_2 *ipoint = CGAL::object_cast<Point_2>(&result)) {
-          return *ipoint;
-        }
-      }
-
-#if 0
-      CGAL_SDG_DEBUG(std::cout << "debug first_intersection "
-                << "trying ray " << rayoutthis
-                     << " with ray " << rayoutpcl << std::endl;);
-#endif
-
-      result = CGAL::intersection(rayoutthis, rayoutpcl);
-      if (const Point_2 *ipoint = CGAL::object_cast<Point_2>(&result)) {
-        return *ipoint;
-      }
-
-      CGAL_SDG_DEBUG(std::cout
-          << "debug error: no intersection found for "
-          << "this=" << *this << " pcl=" << pcl << std::endl;);
-
-      CGAL_assertion(false);
-
-      // philaris: added to avoid complaining from some compilers
-
-      return Point_2();
-
-    }
-
-
-    // drawing
-
-    template< class K >
-    void draw(CGAL::Qt::PainterOstream<K>& stream) const {
-      typedef typename K::Segment_2 K_Segment_2;
-      typedef typename K::Ray_2 K_Ray_2;
-      typedef typename
-	  Polychainline_2<Traits_P,Container_P>::Vertex_const_iterator VI;
-
-      CGAL_assertion( this->size() > 0 );
-
-      VI source = this->vertices_begin();
-
-      // draw outgoing ray from first point
-      stream << K_Ray_2(*source, this->get_incoming());
-
-      if (this->size() > 1) {
-        VI target = source+1;
-        for( ; target!=this->vertices_end(); ++source, ++target)
-        {
-          stream << K_Segment_2(*source, *target);
-        }
-      }
-
-      // now source contains the last point;
-      // draw outgoing ray from this point
-      stream << K_Ray_2(*source, this->get_outgoing());
-    }
-
-    template< class Stream >
-    void draw(Stream & stream) const {
-      typedef typename
-	  Polychainline_2<Traits_P,Container_P>::Vertex_const_iterator VI;
-
-      CGAL_assertion( this->size() > 0 );
-
-      VI source = this->vertices_begin();
-
-      // draw outgoing ray from first point
-      stream << Ray_2(*source, this->get_incoming());
-
-      if (this->size() > 1) {
-        VI target = source+1;
-        for( ; target!=this->vertices_end(); ++source, ++target)
-        {
-          stream << Segment_2(*source, *target);
-        }
-      }
-
-      // now source contains the last point;
-      // draw outgoing ray from this point
-      stream << Ray_2(*source, this->get_outgoing());
-    }
-
-} ;
-
-
-
-template <class Traits_P, class Container_P>
-std::ostream&
-operator<<(std::ostream &os,
-           const Polychainline_2<Traits_P,Container_P>& p)
-{
-  typename Polychainline_2<Traits_P,Container_P>::Vertex_const_iterator i;
-
-  switch(os.iword(IO::mode)) {
-    case IO::ASCII :
-      os << p.size() << ' ';
-      os << ", dinc=" << p.get_incoming() << ", ";
-      for (i = p.vertices_begin(); i != p.vertices_end(); ++i) {
-        os << *i << ' ';
-      }
-      os << ", dout=" << p.get_outgoing() << ' ';
-      return os;
-
-    case IO::BINARY :
-      os << p.size();
-      os << p.get_incoming();
-      for (i = p.vertices_begin(); i != p.vertices_end(); ++i) {
-        os << *i;
-      }
-      os << p.get_outgoing();
-      return os;
-
-    default:
-      os << "Polychainline_2(" << std::endl;
-      os << "dinc=" << p.get_incoming() << std::endl;
-      for (i = p.vertices_begin(); i != p.vertices_end(); ++i) {
-        os << "  " << *i << std::endl;
-      }
-      os << "dout=" << p.get_outgoing() << std::endl;
-      os << ")" << std::endl;
-      return os;
-  }
-}
-
-
-/*
-template< class Stream,
-          class Traits_P
-        >
-inline
-Stream& operator<<(Stream &s,
-                   const Polychainline_2 <Traits_P> &P)
-{
-  P.draw(s);
-  return s;
-}
-
-
-template< class Stream,
-          class Traits_P,
-          class Container_P
-        >
-inline
-Stream& operator<<(Stream &s,
-                   const Polychainline_2 <Traits_P, Container_P> &P)
-{
-  P.draw(s);
-  return s;
-}
-*/
-
-
-
-} //namespace CGAL
-
-#endif // CGAL_POLYCHAIN_2_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_2_algorithms.h b/3rdparty/CGAL-4.8/include/CGAL/Polygon_2_algorithms.h
deleted file mode 100644
index 52478f0..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polygon_2_algorithms.h
+++ /dev/null
@@ -1,466 +0,0 @@
-// Copyright (c) 1997  
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved. 
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Wieger Wesselink <wieger at cs.ruu.nl>
-
-/*!
-  \file Polygon_2_algorithms.h
-*/
-
-#ifndef CGAL_POLYGON_2_ALGORITHMS_H
-#define CGAL_POLYGON_2_ALGORITHMS_H
-
-#include <CGAL/basic.h>
-#include <CGAL/enum.h>
-#include <CGAL/Bbox_2.h>
-#include <CGAL/Polygon_2/polygon_assertions.h>
-
-/// 
-namespace CGAL {
-
-//-----------------------------------------------------------------------//
-//                  algorithms for sequences of 2D points
-//-----------------------------------------------------------------------//
-
-
-/// \addtogroup PkgPolygon2Functions
-/// @{
-
-/// Returns an iterator to the leftmost point from the range
-/// `[first,last)`. In case of a tie, the point
-/// with the smallest `y`-coordinate is taken.
-///
-/// \tparam Traits is a model of the concept `PolygonTraits_2`.
-/// 	  Only the members `Less_xy_2` and
-/// 	  `less_xy_2_object()` are used.
-/// \tparam ForwardIterator must have `Traits::Point_2` as value type.
-///
-///
-/// \sa `CGAL::right_vertex_2()`
-/// \sa `CGAL::top_vertex_2()`
-/// \sa `CGAL::bottom_vertex_2()`
-/// \sa `CGAL::Polygon_2`
-template <class ForwardIterator, class PolygonTraits>
-ForwardIterator left_vertex_2(ForwardIterator first,
-			      ForwardIterator last,
-			      const PolygonTraits& traits);
-
-/// Returns an iterator to the rightmost point from the range
-/// `[first,last)`. In case of a tie, the point
-/// with the largest `y`-coordinate is taken.
-/// 
-/// \tparam Traits is a model of the concept
-/// 	  `PolygonTraits_2`.
-/// 	  In fact, only the members `Less_xy_2` and
-/// 	  `less_xy_2_object()` are used.
-/// \tparam ForwardIterator must have`Traits::Point_2` as value type.
-///
-/// 
-/// \sa `CGAL::left_vertex_2()`
-/// \sa `CGAL::top_vertex_2()`
-/// \sa `CGAL::bottom_vertex_2()`
-/// \sa `CGAL::Polygon_2`
-template <class ForwardIterator, class PolygonTraits>
-ForwardIterator right_vertex_2(ForwardIterator first,
-			       ForwardIterator last,
-			       const PolygonTraits& traits);
-
-/// Returns an iterator to the topmost point from the range
-/// `[first,last)`. In case of a tie, the point
-/// with the largest `x`-coordinate is taken.
-///
-/// \tparam Traits is a model of the concept
-/// 	  `PolygonTraits_2`.
-/// 	  Only the members `Less_yx_2` and
-/// 	  `less_yx_2_object()` are used.
-/// \tparam ForwardIterator must have `Traits::Point_2` as value type.
-/// 
-/// \sa `CGAL::left_vertex_2()`
-/// \sa `CGAL::right_vertex_2()`
-/// \sa `CGAL::bottom_vertex_2()`
-/// \sa `CGAL::Polygon_2`
-template <class ForwardIterator, class PolygonTraits>
-ForwardIterator top_vertex_2(ForwardIterator first,
-			     ForwardIterator last,
-			     const PolygonTraits& traits);
-
-/// Returns an iterator to the bottommost point from the range
-/// `[first,last)`. In case of a tie, the point
-/// with the smallest `x`-coordinate is taken.
-///
-/// \tparam Traits is a model of the concept
-/// 	  `PolygonTraits_2`.
-/// 	  Only the members `Less_yx_2` and
-/// 	  `less_yx_2_object()` are used.
-/// \tparam ForwardIterator must have `Traits::Point_2` as value type.
-/// 
-/// \sa `CGAL::left_vertex_2()`
-/// \sa `CGAL::right_vertex_2()`
-/// \sa `CGAL::top_vertex_2()`
-/// \sa `CGAL::Polygon_2`
-/// \sa `PolygonTraits_2`
-template <class ForwardIterator, class PolygonTraits>
-ForwardIterator bottom_vertex_2(ForwardIterator first,
-				ForwardIterator last,
-				const PolygonTraits& traits);
-
-/// Computes the signed area of the polygon defined by the range of points
-/// `[first,last)`. The area is returned in the parameter
-/// `result`. The sign is positive for counterclockwise polygons, negative for
-/// clockwise polygons. If the polygon is not simple, the area is not well defined.
-/// The functionality is also available by the `polygon_area_2()` function, which
-/// returns the area instead of taking it as a parameter.
-/// 
-/// \tparam Traits is a model of the concept
-/// 	  `PolygonTraits_2`.
-/// 	  Only the following members of this traits class are used:
-///   - `Compute_area_2` : Computes the signed area of the
-/// 	    oriented triangle defined by 3 `Point_2` passed as arguments.
-///   - `FT`
-///   - `compute_area_2_object()`
-/// \tparam ForwardIterator must have `Traits::Point_2` as value type.
-/// 
-/// \sa `CGAL::polygon_area_2()`
-/// \sa `PolygonTraits_2`
-/// \sa `CGAL::orientation_2()`
-/// \sa `CGAL::Polygon_2`
-template <class ForwardIterator, class PolygonTraits>
-void 
-area_2( ForwardIterator first, ForwardIterator last,
-   	typename PolygonTraits::FT &result,
-        const PolygonTraits& traits)
-{
-  typedef typename PolygonTraits::FT FT;
-   result = FT(0);
-   // check if the polygon is empty
-   if (first == last) return;
-   ForwardIterator second = first; ++second;
-   // check if the polygon has only one point
-   if (second == last) return;
-   typename PolygonTraits::Compute_area_2 compute_area_2 =
-            traits.compute_area_2_object();
-   ForwardIterator third = second;
-   while (++third != last) {
-	result = result + compute_area_2(*first, *second, *third);
-	second = third;
-   }
-}
-
-/// Computes the signed area of the polygon defined by the range of points
-/// `[first,last)`.
-/// The sign is positive for counterclockwise polygons, negative for
-/// clockwise polygons. If the polygon is not simple, the area is not well defined.
-/// 
-/// \tparam Traits is a model of the concept `PolygonTraits_2`. Only the following members of this traits class are used:
-///   - `Compute_area_2` : Computes the signed area of the
-/// 	    oriented triangle defined by 3 `Point_2` passed as arguments.
-///   - `FT`
-///   - `compute_area_2_object`
-/// \tparam ForwardIterator must have `Traits::Point_2` as value type.
-/// 
-/// 
-/// \sa `PolygonTraits_2 `
-/// \sa `CGAL::orientation_2()`
-/// \sa `CGAL::Polygon_2 `
-template <class ForwardIterator, class PolygonTraits>
-typename PolygonTraits::FT 
-polygon_area_2( ForwardIterator first, ForwardIterator last,
-		const PolygonTraits& traits)
-{
-   typedef typename PolygonTraits::FT FT;
-   FT result = FT(0);
-   // check if the polygon is empty
-   if (first == last) return result;
-   ForwardIterator second = first; ++second;
-   // check if the polygon has only one point
-   if (second == last) return result;
-   typename PolygonTraits::Compute_area_2 compute_area_2 =
-            traits.compute_area_2_object();
-   ForwardIterator third = second;
-   while (++third != last) {
-	result = result + compute_area_2(*first, *second, *third);
-	second = third;
-   }
-   return result;
-}
-
-/// Checks if the polygon is convex.
-/// 
-/// \tparam Traits is a model of the concept
-/// 	  `PolygonTraits_2`.
-/// 	  Only the following members of this traits class are used:
-///   - `Less_xy_2`
-///   - `Orientation_2`
-///   - `less_xy_2_object`
-///   - `orientation_2_object`
-/// \tparam ForwardIterator must have `PolygonTraits::Point_2` as value type.
-///
-/// \sa `PolygonTraits_2 `
-/// \sa `CGAL::Polygon_2 `
-template <class ForwardIterator, class PolygonTraits>
-bool is_convex_2(ForwardIterator first,
-		 ForwardIterator last,
-		 const PolygonTraits& traits);
-
-/// Checks if the polygon defined by the
-/// iterator range `[first,last)` is simple, that is, if the edges 
-/// do not intersect, except consecutive edges in their common vertex.
-/// 
-/// \tparam Traits is a model of the concept
-/// 	  `PolygonTraits_2`.
-/// 	  Only the following members of this traits class are used:
-///   - `Point_2`
-///   - `Less_xy_2`
-///   - `Orientation_2`
-///   - `less_xy_2_object()`
-///   - `orientation_2_object()`
-/// \tparam ForwardIterator must have `PolygonTraits::Point_2` as value type.
-/// 
-/// ### Implementation##
-/// 
-/// The simplicity test is implemented by means of a plane sweep algorithm.
-/// The algorithm is quite robust when used with inexact number types.
-/// The running time is `O(n log n)`, where n is the number of vertices of the
-/// polygon.
-/// 
-/// \sa `PolygonTraits_2`
-/// \sa `CGAL::Polygon_2`
-template <class ForwardIterator, class PolygonTraits>
-bool is_simple_2(ForwardIterator first,
-		 ForwardIterator last,
-		 const PolygonTraits& traits);
-
-// In the following two functions we would like to use Traits::Point_2
-// instead of Point, but this is not allowed by g++ 2.7.2.
-///
-/// Computes on which side of a polygon a point lies.
-/// \tparam Traits is a model of the concept
-/// 	  `PolygonTraits_2`.
-/// 	  Only the following members of this traits class are used:
-///   - `Less_xy_2`
-///   - `Compare_x_2`
-///   - `Compare_y_2`
-///   - `Orientation_2`
-///   - `less_xy_2_object()`
-///   - `compare_x_2_object()`
-///   - `compare_y_2_object()`
-///   - `orientation_2_object()`
-/// \tparam ForwardIterator must have `PolygonTraits::Point_2` as value type.
-///
-/// \sa `PolygonTraits_2`
-/// \sa `CGAL::bounded_side_2()`
-/// \sa `CGAL::is_simple_2()`
-/// \sa `CGAL::Polygon_2`
-/// \sa `Oriented_side`
-template <class ForwardIterator, class Point, class Traits>
-Oriented_side oriented_side_2(ForwardIterator first,
-			      ForwardIterator last,
-			      const Point& point,
-			      const Traits& traits);
-
-/// Computes if a point lies inside a polygon.
-/// The polygon is defined by the sequence of points `[first,last)`.
-/// Being inside is defined by the odd-even rule. If we take a ray starting at the
-/// point and extending to infinity (in any direction), we count the number of
-/// intersections. If this number is odd, the point is inside, otherwise it is
-/// outside. If the point is on a polygon edge, a special value is returned.  A
-/// simple polygon divides the plane in an unbounded and a bounded region.
-/// According to the definition points in the bounded region are inside the polygon.
-/// 
-/// 
-/// \tparam Traits is a model of the concept
-/// 	  `PolygonTraits_2`.
-/// 	  Only the following members of this traits class are used:
-///   - `Compare_x_2`
-///   - `Compare_y_2`
-///   - `Orientation_2`
-///   - `compare_x_2_object()`
-///   - `compare_y_2_object()`
-///   - `orientation_2_object()`
-/// \tparam ForwardIterator must have `Traits::Point_2` as value type.
-/// 
-/// ### Implementation ###
-/// 
-/// The running time is linear in the number of vertices of the polygon.
-/// A horizontal ray is taken to count the number of intersections.
-/// Special care is taken that the result is correct even if there are degeneracies
-/// (if the ray passes through a vertex).
-///
-/// 
-/// \sa `PolygonTraits_2`
-/// \sa `CGAL::oriented_side_2()`
-/// \sa `CGAL::Polygon_2 `
-/// \sa \ref CGAL::Bounded_side
-template <class ForwardIterator, class Point, class PolygonTraits>
-Bounded_side bounded_side_2(ForwardIterator first,
-			    ForwardIterator last,
-			    const Point& point,
-			    const PolygonTraits& traits);
-
-/// Computes if a polygon is clockwise or counterclockwise oriented.
-/// \pre `is_simple_2(first, last, traits);`
-/// 
-/// \tparam Traits is a model of the concept
-/// 	  `PolygonTraits_2`.
-/// 	  Only the following members of this traits class are used:
-///   - `Less_xy_2`
-///   - `less_xy_2_object()`
-///   - `orientation_2_object()`
-/// \tparam ForwardIterator must have`Traits::Point_2` as value type.
-/// 
-/// 
-/// 
-/// \sa `PolygonTraits_2`
-/// \sa `CGAL::is_simple_2()`
-/// \sa `CGAL::Polygon_2`
-/// \sa `CGAL::Orientation`
-template <class ForwardIterator, class Traits>
-Orientation orientation_2(ForwardIterator first,
-			  ForwardIterator last,
-			  const Traits& traits);
-
-/// @}
-
-//-----------------------------------------------------------------------//
-//                         implementation
-//-----------------------------------------------------------------------//
-
-template <class ForwardIterator>
-inline
-ForwardIterator left_vertex_2(ForwardIterator first,
-			      ForwardIterator last)
-{  
-  typedef typename Kernel_traits<
-    typename std::iterator_traits<ForwardIterator>::value_type>::Kernel K; 
-  return left_vertex_2(first, last, K());
-}
-
-
-template <class ForwardIterator>
-inline
-ForwardIterator right_vertex_2(ForwardIterator first,
-			       ForwardIterator last)
-{ 
-  typedef typename Kernel_traits<
-    typename std::iterator_traits<ForwardIterator>::value_type>::Kernel K; 
-  return right_vertex_2(first, last, K());
-}
-
-
-template <class ForwardIterator>
-inline
-ForwardIterator top_vertex_2(ForwardIterator first,
-			     ForwardIterator last)
-{
-  typedef typename Kernel_traits<
-    typename std::iterator_traits<ForwardIterator>::value_type>::Kernel K; 
-  return top_vertex_2(first, last, K());
-}
-
-
-template <class ForwardIterator>
-inline
-ForwardIterator bottom_vertex_2(ForwardIterator first,
-				ForwardIterator last)
-{
-  typedef typename Kernel_traits<
-    typename std::iterator_traits<ForwardIterator>::value_type>::Kernel K; 
-  return bottom_vertex_2(first, last, K());
-}
-
-template <class ForwardIterator, class Numbertype>
-inline
-void area_2(ForwardIterator first,
-	    ForwardIterator last,
-	    Numbertype& result)
-{
-  typedef typename Kernel_traits<
-    typename std::iterator_traits<ForwardIterator>::value_type>::Kernel K; 
-  area_2(first, last, result, K());
-}
-
-
-
-template <class ForwardIterator>
-inline
-bool is_convex_2(ForwardIterator first,
-		 ForwardIterator last)
-{
-  typedef typename Kernel_traits<
-    typename std::iterator_traits<ForwardIterator>::value_type>::Kernel K; 
-  return is_convex_2(first, last, K());
-}
-
-
-
-template <class ForwardIterator>
-inline
-bool is_simple_2(ForwardIterator first,
-		 ForwardIterator last)
-{
-  typedef typename Kernel_traits<
-    typename std::iterator_traits<ForwardIterator>::value_type>::Kernel K; 
-  return is_simple_2(first, last, K());
-}
-
-template <class ForwardIterator>
-inline
-Oriented_side oriented_side_2(
-  ForwardIterator first,
-  ForwardIterator last,
-  const typename std::iterator_traits<ForwardIterator>::value_type& point)
-{
-  typedef typename Kernel_traits<
-    typename std::iterator_traits<ForwardIterator>::value_type>::Kernel K; 
-  return oriented_side_2(first, last, point, K());
-}
-
-
-template <class ForwardIterator>
-inline
-Bounded_side bounded_side_2(
-  ForwardIterator first,
-  ForwardIterator last,
-  const typename std::iterator_traits<ForwardIterator>::value_type& point)
-{
-  typedef typename Kernel_traits<
-    typename std::iterator_traits<ForwardIterator>::value_type>::Kernel K; 
-  return bounded_side_2(first, last, point, K());
-}
-
-
-
-template <class ForwardIterator>
-inline
-Orientation orientation_2(ForwardIterator first,
-			  ForwardIterator last)
-{
-  typedef typename Kernel_traits<
-    typename std::iterator_traits<ForwardIterator>::value_type>::Kernel K; 
-  return orientation_2(first, last, K());
-}
-
-} //namespace CGAL
-
-#include <CGAL/Polygon_2/Polygon_2_algorithms_impl.h>
-
-#endif // CGAL_POLYGON_2_ALGORITHMS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/Weights.h b/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/Weights.h
deleted file mode 100644
index a70accf..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/Weights.h
+++ /dev/null
@@ -1,766 +0,0 @@
-// Copyright (c) 2015 GeometryFactory (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Yin Xu, Andreas Fabri and Ilker O. Yaz
-
-#ifndef CGAL_PMP_WEIGHTS_H
-#define CGAL_PMP_WEIGHTS_H
-/// @cond CGAL_DOCUMENT_INTERNAL
-
-#include <CGAL/boost/graph/helpers.h>
-#include <CGAL/Kernel/global_functions_3.h>
-#include <CGAL/property_map.h>
-
-namespace CGAL {
-namespace internal {
-
-// Returns the cotangent value of half angle v0 v1 v2
-// using formula in -[Meyer02] Discrete Differential-Geometry Operators for- page 19
-// The potential problem with previous one (Cotangent_value) is that it does not produce symmetric results
-// (i.e. for v0, v1, v2 and v2, v1, v0 returned cot weights can be slightly different)
-// This one provides stable results.
-template<class PolygonMesh>
-struct Cotangent_value_Meyer_impl
-{
-  typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
-
-  template <class VertexPointMap>
-  double operator()(vertex_descriptor v0, vertex_descriptor v1, vertex_descriptor v2, const VertexPointMap& ppmap)
-  {
-    typedef typename Kernel_traits<
-      typename boost::property_traits<VertexPointMap>::value_type >::Kernel::Vector_3 Vector;
-    
-    Vector a = get(ppmap, v0) - get(ppmap, v1);
-    Vector b = get(ppmap, v2) - get(ppmap, v1);
-    
-    double dot_ab = a*b;
-    // rewritten for safer fp arithmetic
-    //double dot_aa = a.squared_length();
-    //double dot_bb = b.squared_length();
-    //double divider = CGAL::sqrt( dot_aa * dot_bb - dot_ab * dot_ab );
-
-    Vector cross_ab = CGAL::cross_product(a, b);
-    double divider = CGAL::sqrt(cross_ab*cross_ab);
-
-    if(divider == 0 /*|| divider != divider*/) 
-    {
-      CGAL::collinear(get(ppmap, v0), get(ppmap, v1), get(ppmap, v2)) ? 
-        CGAL_warning(!"Infinite Cotangent value with degenerate triangle!") :
-        CGAL_warning(!"Infinite Cotangent value due to floating point arithmetic!");
-      
-
-      return dot_ab > 0 ? (std::numeric_limits<double>::max)() :
-                         -(std::numeric_limits<double>::max)();
-    }
-    
-    return dot_ab / divider;
-  }
-};
-
-// Same as above but with a different API
-template<class PolygonMesh
-  , class VertexPointMap = typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::type>
-class Cotangent_value_Meyer
-{
-protected:
-  typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
-  typedef VertexPointMap Point_property_map;
-  typedef typename boost::property_traits<Point_property_map>::value_type Point;
-  typedef typename Kernel_traits<Point>::Kernel::Vector_3  Vector;
-
-  PolygonMesh& pmesh_;
-  Point_property_map ppmap;
-
-public:
-  
-  Cotangent_value_Meyer(PolygonMesh& pmesh_, VertexPointMap vpmap_)
-    : pmesh_(pmesh_)
-    , ppmap(vpmap_)
-  {}
-
-  PolygonMesh& pmesh()
-  {
-    return pmesh_;
-  }
-
-  double operator()(vertex_descriptor v0, vertex_descriptor v1, vertex_descriptor v2)
-  {
-    return Cotangent_value_Meyer_impl<PolygonMesh>()(v0,v1,v2,ppmap);
-  }
-};
-
-
-// imported from skeletonization
-template<class PolygonMesh,
-         class VertexPointMap =
-          typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::type>
-class Cotangent_value_Meyer_secure
-{
-  typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
-  typedef VertexPointMap Point_property_map;
-  typedef typename boost::property_traits<Point_property_map>::value_type Point;
-  typedef typename Kernel_traits<Point>::Kernel::Vector_3  Vector;
-
-  PolygonMesh& pmesh_;
-  Point_property_map ppmap;
-
-public:
-  
-  Cotangent_value_Meyer_secure(PolygonMesh& pmesh_, VertexPointMap vpmap_)
-    : pmesh_(pmesh_)
-    , ppmap(vpmap_)
-  {}
-
-  PolygonMesh& pmesh()
-  {
-    return pmesh_;
-  }
-
-  double operator()(vertex_descriptor v0, vertex_descriptor v1, vertex_descriptor v2)
-  {
-    Vector a = get(ppmap, v0) - get(ppmap, v1);
-    Vector b = get(ppmap, v2) - get(ppmap, v1);
-    
-    double dot_ab = a*b;
-    double dot_aa = a.squared_length();
-    double dot_bb = b.squared_length();
-    double lb = -0.999, ub = 0.999;
-    double cosine = dot_ab / CGAL::sqrt(dot_aa) / CGAL::sqrt(dot_bb);
-    cosine = (cosine < lb) ? lb : cosine;
-    cosine = (cosine > ub) ? ub : cosine;
-    double sine = std::sqrt(1.0 - cosine * cosine);
-    return cosine / sine;
-  }
-};
-
-// Returns the cotangent value of half angle v0 v1 v2 by clamping between [1, 89] degrees
-// as suggested by -[Friedel] Unconstrained Spherical Parameterization-
-template<class PolygonMesh
-  , class VertexPointMap = typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::type
-  , class CotangentValue = Cotangent_value_Meyer<PolygonMesh, VertexPointMap> >
-class Cotangent_value_clamped : CotangentValue
-{
-  Cotangent_value_clamped()
-  {}
-public:
-
-  Cotangent_value_clamped(PolygonMesh& pmesh_, VertexPointMap vpmap_)
-    : CotangentValue(pmesh_, vpmap_)
-  {}
-
-  PolygonMesh& pmesh()
-  {
-    return CotangentValue::pmesh();
-  }
-
-  typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
-
-  double operator()(vertex_descriptor v0, vertex_descriptor v1, vertex_descriptor v2)
-  {
-    const double cot_1 = 57.289962;
-    const double cot_89 = 0.017455;
-    double value = CotangentValue::operator()(v0, v1, v2);
-    return (std::max)(cot_89, (std::min)(value, cot_1));
-  }
-};
-
-template<class PolygonMesh
-  , class VertexPointMap = typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::type
-  , class CotangentValue = Cotangent_value_Meyer<PolygonMesh, VertexPointMap> >
-class Cotangent_value_clamped_2 : CotangentValue
-{
-  Cotangent_value_clamped_2()
-  {}
-
-public:
-
-  Cotangent_value_clamped_2(PolygonMesh& pmesh_, VertexPointMap vpmap_)
-    : CotangentValue(pmesh_, vpmap_)
-  {}
-
-  PolygonMesh& pmesh()
-  {
-    return CotangentValue::pmesh();
-  }
-
-  typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
-
-  double operator()(vertex_descriptor v0, vertex_descriptor v1, vertex_descriptor v2)
-  {
-    const double cot_5 = 5.671282;
-    const double cot_175 = -cot_5;
-    double value = CotangentValue::operator()(v0, v1, v2);
-    return (std::max)(cot_175, (std::min)(value, cot_5));
-  }
-};
-
-template<class PolygonMesh
-  , class VertexPointMap = typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::type
-  , class CotangentValue = Cotangent_value_Meyer<PolygonMesh, VertexPointMap> >
-class Cotangent_value_minimum_zero : CotangentValue
-{
-  Cotangent_value_minimum_zero()
-  {}
-public:
-  Cotangent_value_minimum_zero(PolygonMesh& pmesh_, VertexPointMap vpmap_)
-    : CotangentValue(pmesh_, vpmap_)
-  {}
-
-  PolygonMesh& pmesh()
-  {
-    return CotangentValue::pmesh();
-  }
-
-  typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
-
-  double operator()(vertex_descriptor v0, vertex_descriptor v1, vertex_descriptor v2)
-  {
-    double value = CotangentValue::operator()(v0, v1, v2);
-    return (std::max)(0.0, value);
-  }
-};
-
-template<class PolygonMesh,
-         class CotangentValue = Cotangent_value_Meyer_impl<PolygonMesh> >
-struct Cotangent_value_minimum_zero_impl : CotangentValue
-{
-  typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
-
-  template <class VertexPointMap>
-  double operator()(vertex_descriptor v0, vertex_descriptor v1, vertex_descriptor v2, const VertexPointMap& ppmap)
-  {
-    double value = CotangentValue::operator()(v0, v1, v2,ppmap);
-    return (std::max)(0.0, value);
-  }
-};
-
-template<class PolygonMesh
-    , class VertexPointMap = typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::type
-    , class CotangentValue
-           = Cotangent_value_Meyer<PolygonMesh, VertexPointMap> >
-class Voronoi_area : CotangentValue
-{
-  //Voronoi_area()
-  //{}
-  
-public:
-  Voronoi_area(PolygonMesh& pmesh_, VertexPointMap vpmap_)
-    : CotangentValue(pmesh_, vpmap_)
-  {}
-
-  //Voronoi_area(PolygonMesh& pmesh_)
-  //  : CotangentValue(pmesh_, get(CGAL::vertex_point, pmesh_))
-  //{}
-
-  PolygonMesh& pmesh()
-  {
-    return CotangentValue::pmesh();
-  }
-
-  typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
-  typedef typename boost::graph_traits<PolygonMesh>::in_edge_iterator in_edge_iterator;
-  typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor halfedge_descriptor;
-
-  typedef VertexPointMap Point_property_map;
-  typedef typename boost::property_traits<Point_property_map>::value_type Point;
-  typedef typename Kernel_traits<Point>::Kernel::Vector_3  Vector;
-
-  double operator()(vertex_descriptor v0) {
-
-    //return 1.0;
-    double voronoi_area = 0.0;
-    BOOST_FOREACH(halfedge_descriptor he,
-                  halfedges_around_target( halfedge(v0,pmesh()), pmesh()) )
-    {
-      if( is_border(he,pmesh()) ) { continue; }
-
-      CGAL_assertion(CGAL::is_triangle_mesh(pmesh()));
-      CGAL_assertion( v0 == target(he, pmesh()) );
-      vertex_descriptor v1 = source(he, pmesh());
-      vertex_descriptor v_op = target(next(he, pmesh()), pmesh());
-
-      const Point& v0_p = get(this->ppmap, v0);
-      const Point& v1_p = get(this->ppmap, v1);
-      const Point& v_op_p = get(this->ppmap, v_op);
-
-      // (?) check if there is a better way to predicate triangle is obtuse or not
-      CGAL::Angle angle0 = CGAL::angle(v1_p, v0_p, v_op_p);
-      CGAL::Angle angle1 = CGAL::angle(v_op_p, v1_p, v0_p);
-      CGAL::Angle angle_op = CGAL::angle(v0_p, v_op_p, v1_p);
-
-      bool obtuse = (angle0 == CGAL::OBTUSE) || (angle1 == CGAL::OBTUSE) || (angle_op == CGAL::OBTUSE);
-
-      if(!obtuse) {
-        double cot_v1 = CotangentValue::operator()(v_op, v1, v0);
-        double cot_v_op = CotangentValue::operator()(v0, v_op, v1);
-
-        double term1 = cot_v1   * (v_op_p - v0_p).squared_length();
-        double term2 = cot_v_op * (v1_p  - v0_p).squared_length();
-        voronoi_area += (1.0 / 8.0) * (term1 + term2);
-      }
-      else {
-        double area_t = CGAL::sqrt(squared_area(v0_p, v1_p, v_op_p));
-        if(angle0 == CGAL::OBTUSE) {
-          voronoi_area += area_t / 2.0;
-        }
-        else {
-          voronoi_area += area_t / 4.0;
-        }
-      }
-    }
-    CGAL_warning(voronoi_area != 0 && "Zero voronoi area!");
-    return voronoi_area;
-  }
-};
-// Returns the cotangent value of half angle v0 v1 v2 by dividing the triangle area
-// as suggested by -[Mullen08] Spectral Conformal Parameterization-
-template<class PolygonMesh
-  , class VertexPointMap = typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::type
-  , class CotangentValue = Cotangent_value_Meyer<PolygonMesh, VertexPointMap> >
-class Cotangent_value_area_weighted : CotangentValue
-{
-  Cotangent_value_area_weighted()
-  {}
-
-public:
-
-  Cotangent_value_area_weighted(PolygonMesh& pmesh_, VertexPointMap vpmap_)
-    : CotangentValue(pmesh_, vpmap_)
-  {}
-
-  PolygonMesh& pmesh()
-  {
-    return CotangentValue::pmesh();
-  }
-
-  typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
-
-  double operator()(vertex_descriptor v0, vertex_descriptor v1, vertex_descriptor v2)
-  {
-    return CotangentValue::operator()(v0, v1, v2)
-      / CGAL::sqrt(squared_area(v0->point(), v1->point(), v2->point()));
-  }
-};
-/////////////////////////////////////////////////////////////////////////////////////////
-
-///////////////////////////// Edge Weight Calculators ///////////////////////////////////
-// Cotangent weight calculator 
-// Cotangent_value:               as suggested by -[Sorkine07] ARAP Surface Modeling-
-// Cotangent_value_area_weighted: as suggested by -[Mullen08] Spectral Conformal Parameterization-
-template< class PolygonMesh,
-          class CotangentValue = Cotangent_value_minimum_zero_impl<PolygonMesh> >
-struct Cotangent_weight_impl : CotangentValue
-{
-  typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor   halfedge_descriptor;
-  typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
-
-  // Returns the cotangent weight of specified halfedge_descriptor
-  // Edge orientation is trivial
-  template<class VertexPointMap>
-  double operator()(halfedge_descriptor he, PolygonMesh& pmesh, const VertexPointMap& ppmap)
-  {
-    vertex_descriptor v0 = target(he, pmesh);
-    vertex_descriptor v1 = source(he, pmesh);
-     // Only one triangle for border edges
-    if (is_border_edge(he, pmesh))
-     {
-       
-       halfedge_descriptor he_cw = opposite( next(he, pmesh) , pmesh );
-       vertex_descriptor v2 = source(he_cw, pmesh);
-       if (is_border_edge(he_cw, pmesh) )
-       {
-         halfedge_descriptor he_ccw = prev( opposite(he, pmesh) , pmesh );
-         v2 = source(he_ccw, pmesh);
-       }
-       return ( CotangentValue::operator()(v0, v2, v1, ppmap)/2.0 );
-     }
-     else
-     {
-       halfedge_descriptor he_cw = opposite( next(he, pmesh) , pmesh );
-       vertex_descriptor v2 = source(he_cw, pmesh);     
-       halfedge_descriptor he_ccw = prev( opposite(he, pmesh) , pmesh );
-       vertex_descriptor v3 = source(he_ccw, pmesh);
-
-        return ( CotangentValue::operator()(v0, v2, v1, ppmap)/2.0 +
-                 CotangentValue::operator()(v0, v3, v1, ppmap)/2.0 );
-     }
-  }
-};
-
-template<class PolygonMesh
-  , class VertexPointMap = typename boost::property_map<PolygonMesh, vertex_point_t>::type
-  , class CotangentValue
-           = Cotangent_value_minimum_zero<PolygonMesh, VertexPointMap> >
-class Cotangent_weight : CotangentValue
-{
-  Cotangent_weight()
-  {}
-
-public:
-  Cotangent_weight(PolygonMesh& pmesh_, VertexPointMap vpmap_)
-    : CotangentValue(pmesh_, vpmap_)
-  {}
-
-  Cotangent_weight(PolygonMesh& pmesh_)
-    : CotangentValue(pmesh_, get(CGAL::vertex_point, pmesh_))
-  {}
-
-  PolygonMesh& pmesh()
-  {
-    return CotangentValue::pmesh();
-  }
-
-  typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor   halfedge_descriptor;
-  typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
-
-  typedef typename boost::property_map<PolygonMesh,vertex_point_t>::type Point_property_map;
-  typedef typename boost::property_traits<Point_property_map>::value_type Point;
-  typedef typename Kernel_traits<Point>::Kernel::Vector_3  Vector;
-
-  // Returns the cotangent weight of specified halfedge_descriptor
-  // Edge orientation is trivial
-  double operator()(halfedge_descriptor he)
-  {
-    vertex_descriptor v0 = target(he, pmesh());
-    vertex_descriptor v1 = source(he, pmesh());
-     // Only one triangle for border edges
-    if (is_border_edge(he, pmesh()))
-     {
-       
-       halfedge_descriptor he_cw = opposite( next(he, pmesh()) , pmesh() );
-       vertex_descriptor v2 = source(he_cw, pmesh());
-       if (is_border_edge(he_cw, pmesh()) )
-       {
-         halfedge_descriptor he_ccw = prev( opposite(he, pmesh()) , pmesh() );
-         v2 = source(he_ccw, pmesh());
-       }
-       return ( CotangentValue::operator()(v0, v2, v1)/2.0 );
-     }
-     else
-     {
-       halfedge_descriptor he_cw = opposite( next(he, pmesh()) , pmesh() );
-       vertex_descriptor v2 = source(he_cw, pmesh());     
-       halfedge_descriptor he_ccw = prev( opposite(he, pmesh()) , pmesh() );
-       vertex_descriptor v3 = source(he_ccw, pmesh());
-
-        return ( CotangentValue::operator()(v0, v2, v1)/2.0 + CotangentValue::operator()(v0, v3, v1)/2.0 );
-     }
-  }
-};
-
-// Single cotangent from -[Chao10] Simple Geometric Model for Elastic Deformation
-template<class PolygonMesh,
-         class CotangentValue = Cotangent_value_Meyer_impl<PolygonMesh> >
-struct Single_cotangent_weight_impl : CotangentValue
-{
-  typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor   halfedge_descriptor;
-  typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
-
-  // Returns the cotangent of the opposite angle of the edge
-  // 0 for border edges (which does not have an opposite angle)
-  template <class VertexPointMap>
-  double operator()(halfedge_descriptor he, PolygonMesh& pmesh, const VertexPointMap& ppmap)
-  {
-    if(is_border(he, pmesh)) { return 0.0;}
-     
-    vertex_descriptor v0 = target(he, pmesh);
-    vertex_descriptor v1 = source(he, pmesh);
-
-    vertex_descriptor v_op = target(next(he, pmesh), pmesh);
-     return CotangentValue::operator()(v0, v_op, v1, ppmap);
-  }
-};
-
-template<class PolygonMesh
-  , class VertexPointMap = typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::type
-  , class CotangentValue = Cotangent_value_Meyer<PolygonMesh, VertexPointMap> >
-class Single_cotangent_weight : CotangentValue
-{
-  Single_cotangent_weight()
-  {}
-public:
-  Single_cotangent_weight(PolygonMesh& pmesh_, VertexPointMap vpmap_)
-    : CotangentValue(pmesh_, vpmap_)
-  {}
-
-  PolygonMesh& pmesh()
-  {
-    return CotangentValue::pmesh();
-  }
-
-  typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor   halfedge_descriptor;
-  typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
-
-  typedef typename boost::property_map<PolygonMesh,vertex_point_t>::type Point_property_map;
-  typedef typename boost::property_traits<Point_property_map>::value_type Point;
-  typedef typename Kernel_traits<Point>::Kernel::Vector_3  Vector;
-
-  // Returns the cotangent of the opposite angle of the edge
-  // 0 for border edges (which does not have an opposite angle)
-  double operator()(halfedge_descriptor he)
-  {
-    if(is_border(he, pmesh())) { return 0.0;}
-     
-    vertex_descriptor v0 = target(he, pmesh());
-    vertex_descriptor v1 = source(he, pmesh());
-
-    vertex_descriptor v_op = target(next(he, pmesh()), pmesh());
-     return CotangentValue::operator()(v0, v_op, v1);
-  }
-};
-
-// Mean value calculator described in -[Floater04] Mean Value Coordinates-
-template<class PolygonMesh
-       , class VertexPointMap = typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::type>
-class Mean_value_weight
-{
-  //Mean_value_weight()
-  //{}
-
-  PolygonMesh& pmesh_;
-  VertexPointMap vpmap_;
-
-public:
-  Mean_value_weight(PolygonMesh& pmesh_, VertexPointMap vpmap)
-    : pmesh_(pmesh_), vpmap_(vpmap)
-  {}
-
-  PolygonMesh& pmesh()
-  {
-    return pmesh_;
-  }
-
-  typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor  halfedge_descriptor;
-  typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor    vertex_descriptor;
-
-  typedef VertexPointMap Point_property_map;
-  typedef typename boost::property_traits<Point_property_map>::value_type Point;
-  typedef typename Kernel_traits<Point>::Kernel::Vector_3  Vector;
-
-  // Returns the mean-value coordinate of specified halfedge_descriptor
-  // Returns different value for different edge orientation (which is a normal behaivour according to formula)
-  double operator()(halfedge_descriptor he)
-  {
-    vertex_descriptor v0 = target(he, pmesh());
-    vertex_descriptor v1 = source(he, pmesh());
-    Vector vec = v0->point() - v1->point();
-    double norm = CGAL::sqrt( vec.squared_length() );
-
-    // Only one triangle for border edges
-    if ( is_border_edge(he, pmesh()) )
-    {
-      halfedge_descriptor he_cw = opposite( next(he, pmesh()) , pmesh() );
-      vertex_descriptor v2 = source(he_cw, pmesh());
-      if ( is_border_edge(he_cw, pmesh()) )
-      {
-        halfedge_descriptor he_ccw = prev( opposite(he, pmesh()) , pmesh() );
-        v2 = source(he_ccw, pmesh());
-      }
-
-      return ( half_tan_value_2(v1, v0, v2)/norm);
-    }
-    else
-    {
-      halfedge_descriptor he_cw = opposite( next(he, pmesh()) , pmesh() );
-      vertex_descriptor v2 = source(he_cw, pmesh());     
-      halfedge_descriptor he_ccw = prev( opposite(he, pmesh()) , pmesh() );
-      vertex_descriptor v3 = source(he_ccw, pmesh());
-
-      return ( half_tan_value_2(v1, v0, v2)/norm + half_tan_value_2(v1, v0, v3)/norm);
-    }
-  }
-
-private:
-  // Returns the tangent value of half angle v0_v1_v2/2
-  double half_tan_value(vertex_descriptor v0, vertex_descriptor v1, vertex_descriptor v2)
-  {
-    Vector vec0 = v1->point() - v2->point();
-    Vector vec1 = v2->point() - v0->point();
-    Vector vec2 = v0->point() - v1->point();
-    double e0_square = vec0.squared_length();
-    double e1_square = vec1.squared_length();
-    double e2_square = vec2.squared_length();
-    double e0 = CGAL::sqrt(e0_square);
-    double e2 = CGAL::sqrt(e2_square);
-    double cos_angle = ( e0_square + e2_square - e1_square ) / 2.0 / e0 / e2;
-    cos_angle = (std::max)(-1.0, (std::min)(1.0, cos_angle)); // clamp into [-1, 1]
-    double angle = acos(cos_angle);
-    
-    return ( tan(angle/2.0) );
-  }
-
-  // My deviation built on Meyer_02
-  double half_tan_value_2(vertex_descriptor v0, vertex_descriptor v1, vertex_descriptor v2)
-  {
-    Vector a = v0->point() - v1->point();
-    Vector b = v2->point() - v1->point();
-    double dot_ab = a[0]*b[0] + a[1]*b[1] + a[2]*b[2];
-    double dot_aa = a.squared_length();
-    double dot_bb = b.squared_length();
-    double dot_aa_bb = dot_aa * dot_bb;
-
-    double cos_rep = dot_ab;
-    double sin_rep = CGAL::sqrt(dot_aa_bb  - dot_ab * dot_ab);
-    double normalizer = CGAL::sqrt(dot_aa_bb); // |a|*|b|
-
-    return (normalizer - cos_rep) / sin_rep; // formula from [Floater04] page 4
-                                             // tan(Q/2) = (1 - cos(Q)) / sin(Q)
-  }
-};
-
-template< class PolygonMesh, 
-          class PrimaryWeight = Cotangent_weight<PolygonMesh>,
-          class SecondaryWeight = Mean_value_weight<PolygonMesh> >
-class Hybrid_weight : public PrimaryWeight, SecondaryWeight
-{
-  PrimaryWeight primary;
-  SecondaryWeight secondary;
-
-  Hybrid_weight()
-  {}
-
-public:
-  Hybrid_weight(PolygonMesh& pmesh_)
-    : primary(pmesh_), secondary(pmesh_)
-  {}
-
-  PolygonMesh& pmesh()
-  {
-    return primary.pmesh();
-  }
-
-  typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor   halfedge_descriptor;
-
-  double operator()(halfedge_descriptor he)
-  {
-    double weight = primary(he);
-    //if(weight < 0) { std::cout << "Negative weight" << std::endl; }
-    return (weight >= 0) ? weight : secondary(he);
-  }
-};
-
-// Trivial uniform weights (created for test purposes)
-template<class PolygonMesh>
-class Uniform_weight
-{
-public:
-  typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor   halfedge_descriptor;
-
-  double operator()(halfedge_descriptor /*e*/)
-  { return 1.0; }
-};
-
-////////////////////////////////////////////////////////////////////////////
-//                              FAIRING                                   //
-template<class PolygonMesh>
-class Scale_dependent_weight_fairing
-{
-  PolygonMesh& pmesh_;
-public:
-  Scale_dependent_weight_fairing(PolygonMesh& pmesh_)
-    : pmesh_(pmesh_)
-  {}
-
-  PolygonMesh& pmesh()
-  {
-    return pmesh_;
-  }
-
-  typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor   halfedge_descriptor;
-  typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
-
-  typedef typename boost::property_map<PolygonMesh,vertex_point_t>::type Point_property_map;
-  typedef typename boost::property_traits<Point_property_map>::value_type Point;
-  typedef typename Kernel_traits<Point>::Kernel::Vector_3  Vector;
-
-  double w_i(vertex_descriptor /*v_i*/) { return 1.0; }
-
-  double w_ij(halfedge_descriptor he)
-  {
-    Vector v = target(he, pmesh())->point() - source(he, pmesh())->point();
-    double divider = CGAL::sqrt(v.squared_length());
-    if(divider == 0.0) {
-      CGAL_warning(!"Scale dependent weight - zero length edge.");
-      return (std::numeric_limits<double>::max)();
-    }
-    return 1.0 / divider;
-  }
-};
-
-template<class PolygonMesh
-  , class VertexPointMap = typename boost::property_map<PolygonMesh, vertex_point_t>::type
->
-class Cotangent_weight_with_voronoi_area_fairing
-{
-  typedef PolygonMesh PM;
-  typedef VertexPointMap VPMap;
-  Voronoi_area<PM, VPMap> voronoi_functor;
-  Cotangent_weight<PM, VPMap, Cotangent_value_Meyer<PM, VPMap> > cotangent_functor;
-
-public:
-  Cotangent_weight_with_voronoi_area_fairing(PM& pmesh_)
-    : voronoi_functor(pmesh_, get(CGAL::vertex_point, pmesh_))
-    , cotangent_functor(pmesh_, get(CGAL::vertex_point, pmesh_))
-  {}
-
-  Cotangent_weight_with_voronoi_area_fairing(PM& pmesh_, VPMap vpmap_)
-    : voronoi_functor(pmesh_, vpmap_)
-    , cotangent_functor(pmesh_, vpmap_)
-  {}
-
-  PM& pmesh()
-  {
-    return voronoi_functor.pmesh();
-  }
-
-  typedef typename boost::graph_traits<PM>::halfedge_descriptor   halfedge_descriptor;
-  typedef typename boost::graph_traits<PM>::vertex_descriptor vertex_descriptor;
-
-  double w_i(vertex_descriptor v_i)
-  {
-    return 0.5 / voronoi_functor(v_i);
-  }
-
-  double w_ij(halfedge_descriptor he) {
-
-    return cotangent_functor(he) * 2.0;
-  }
-};
-
-template<class PolygonMesh>
-class Uniform_weight_fairing
-{
-public:
-  typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor halfedge_descriptor;
-  typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
-
-  Uniform_weight_fairing(PolygonMesh&)
-  {}
-
-  double w_ij(halfedge_descriptor /*e*/) { return 1.0; }
-
-  double w_i(vertex_descriptor /*v_i*/) { return 1.0; }
-};
-////////////////////////////////////////////////////////////////////////////
-
-}//namespace internal
-
-
-}//namespace CGAL
-/// @endcond
-#endif //CGAL_PMP_WEIGHTS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/border.h b/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/border.h
deleted file mode 100644
index f7df4b4..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/border.h
+++ /dev/null
@@ -1,199 +0,0 @@
-// Copyright (c) 2015 GeometryFactory (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Jane Tournois
-
-#ifndef CGAL_POLYGON_MESH_PROCESSING_GET_BORDER_H
-#define CGAL_POLYGON_MESH_PROCESSING_GET_BORDER_H
-
-#include <boost/graph/graph_traits.hpp>
-#include <boost/foreach.hpp>
-#include <boost/type_traits/is_same.hpp>
-
-#include <CGAL/Polygon_mesh_processing/internal/named_function_params.h>
-#include <CGAL/Polygon_mesh_processing/internal/named_params_helper.h>
-
-#include <set>
-
-namespace CGAL{
-namespace Polygon_mesh_processing {
-
-  namespace internal
-  {
-    template<typename PM
-           , typename FaceRange
-           , typename HalfedgeOutputIterator>
-    HalfedgeOutputIterator border_halfedges_impl(const FaceRange& faces
-                                               , HalfedgeOutputIterator out
-                                               , const PM& pmesh)
-    {
-      typedef typename boost::graph_traits<PM>::halfedge_descriptor halfedge_descriptor;
-      typedef typename boost::graph_traits<PM>::face_descriptor     face_descriptor;
-
-      //collect halfedges that appear only once
-      // the bool is true if the halfedge stored is the one of the face,
-      // false if it is its opposite
-      std::map<halfedge_descriptor, bool> border;
-      BOOST_FOREACH(face_descriptor f, faces)
-      {
-        BOOST_FOREACH(halfedge_descriptor h,
-          halfedges_around_face(halfedge(f, pmesh), pmesh))
-        {
-          //halfedge_descriptor is model of `LessThanComparable`
-          bool from_face = (h < opposite(h, pmesh));
-          halfedge_descriptor he = from_face
-            ? h
-            : opposite(h, pmesh);
-          if (border.find(he) != border.end())
-            border.erase(he); //even number of appearances
-          else
-            border.insert(std::make_pair(he, from_face));//odd number of appearances
-        }
-      }
-      //copy them in out
-      typedef typename std::map<halfedge_descriptor, bool>::value_type HD_bool;
-      BOOST_FOREACH(const HD_bool& hd, border)
-      {
-        if (hd.second)
-          *out++ = hd.first;
-        else
-          *out++ = opposite(hd.first, pmesh);
-      }
-      return out;
-    }
-
-    template<typename PM
-           , typename FaceRange
-           , typename FaceIndexMap
-           , typename HalfedgeOutputIterator>
-    HalfedgeOutputIterator border_halfedges_impl(const FaceRange& faces
-                                               , const FaceIndexMap& fmap
-                                               , HalfedgeOutputIterator out
-                                               , const PM& pmesh)
-    {
-      typedef typename boost::graph_traits<PM>::halfedge_descriptor halfedge_descriptor;
-      typedef typename boost::graph_traits<PM>::face_descriptor     face_descriptor;
-
-      std::vector<bool> present(num_faces(pmesh), false);
-      BOOST_FOREACH(face_descriptor fd, faces)
-        present[get(fmap, fd)] = true;
-
-      BOOST_FOREACH(face_descriptor fd, faces)
-        BOOST_FOREACH(halfedge_descriptor hd,
-                      halfedges_around_face(halfedge(fd, pmesh), pmesh))
-       {
-         halfedge_descriptor opp=opposite(hd, pmesh);
-         if (is_border(opp, pmesh) || !present[get(fmap,face(opp,pmesh))])
-           *out++ = opp;
-       }
-
-      return out;
-    }
-
-    struct Dummy_PM
-    {
-    public:
-      typedef bool vertex_property_type;
-    };
-
-  }//end namespace internal
-
-  /*!
-  \ingroup PkgPolygonMeshProcessing
-  * collects the border of a surface patch
-  * defined as a face range. The border is "seen from inside" the patch,
-  * i.e. the collected halfedges are
-  * the ones that belong to the input faces.
-  *
-  * @tparam PolygonMesh model of `HalfedgeGraph`
-  * @tparam FaceRange range of
-       `boost::graph_traits<PolygonMesh>::%face_descriptor`, model of `Range`.
-        Its iterator type is `InputIterator`.
-  * @tparam HalfedgeOutputIterator model of `OutputIterator`
-     holding `boost::graph_traits<PolygonMesh>::%halfedge_descriptor`
-     for patch border
-  * @tparam NamedParameters a sequence of \ref namedparameters
-  *
-  * @param pmesh the polygon mesh to which `faces` belong
-  * @param faces the range of faces defining the patch
-  *              around which the border is collected
-  * @param out the output iterator that collects halfedges that form the border
-  *            of `faces`, seen from inside the surface patch
-  * @param np optional sequence of \ref namedparameters among
-     the ones listed below
-
-  * \cgalNamedParamsBegin
-      \cgalParamBegin{face_index_map} a property map containing the index of each face of `pmesh` \cgalParamEnd
-    \cgalNamedParamsEnd
-  *
-  * @returns `out`
-  */
-  template<typename PolygonMesh
-         , typename FaceRange
-         , typename HalfedgeOutputIterator
-         , typename NamedParameters>
-  HalfedgeOutputIterator border_halfedges(const FaceRange& faces
-                                  , const PolygonMesh& pmesh
-                                  , HalfedgeOutputIterator out
-                                  , const NamedParameters& np)
-  {
-    typedef PolygonMesh PM;
-    typedef typename GetFaceIndexMap<PM, NamedParameters>::type           FIMap;
-    typedef typename boost::property_map<typename internal::Dummy_PM,
-                                              CGAL::face_index_t>::type   Unset_FIMap;
-
-    if (boost::is_same<FIMap, Unset_FIMap>::value)
-    {
-      //face index map is not given in named parameters, nor as an internal property map
-      return internal::border_halfedges_impl(faces, out, pmesh);
-    }
-    //face index map given as a named parameter, or as an internal property map
-    FIMap fim = choose_param(get_param(np, face_index),
-                             get(CGAL::face_index, pmesh));
-    return internal::border_halfedges_impl(faces, fim, out, pmesh);
-  }
-
-  template<typename PolygonMesh
-         , typename HalfedgeOutputIterator>
-  HalfedgeOutputIterator border_halfedges(const PolygonMesh& pmesh
-                                        , HalfedgeOutputIterator out)
-  {
-    typedef PolygonMesh PM;
-    typedef typename boost::graph_traits<PM>::halfedge_descriptor halfedge_descriptor;
-    BOOST_FOREACH(halfedge_descriptor hd, halfedges(pmesh))
-      if (is_border(hd, pmesh))
-        *out++ = hd;
-    return out;
-  }
-
-  template<typename PolygonMesh
-         , typename FaceRange
-         , typename HalfedgeOutputIterator>
-  HalfedgeOutputIterator border_halfedges(const FaceRange& faces
-                                        , const PolygonMesh& pmesh
-                                        , HalfedgeOutputIterator out)
-  {
-    return border_halfedges(faces, pmesh, out,
-      CGAL::Polygon_mesh_processing::parameters::all_default());
-  }
-
-}
-} // end of namespace CGAL::Polygon_mesh_processing
-
-
-#endif //CGAL_POLYGON_MESH_PROCESSING_GET_BORDER_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/compute_normal.h b/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/compute_normal.h
deleted file mode 100644
index 8515307..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/compute_normal.h
+++ /dev/null
@@ -1,371 +0,0 @@
-// Copyright (c) 2015 GeometryFactory (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Jane Tournois
-
-
-#ifndef CGAL_POLYGON_MESH_PROCESSING_COMPUTE_NORMAL_H
-#define CGAL_POLYGON_MESH_PROCESSING_COMPUTE_NORMAL_H
-
-#include <CGAL/boost/graph/helpers.h>
-#include <CGAL/boost/graph/properties.h>
-#include <boost/graph/graph_traits.hpp>
-#include <CGAL/Origin.h>
-#include <CGAL/Kernel/global_functions_3.h>
-#include <CGAL/Kernel_traits.h>
-
-#include <CGAL/Polygon_mesh_processing/internal/named_function_params.h>
-#include <CGAL/Polygon_mesh_processing/internal/named_params_helper.h>
-
-#include <boost/type_traits.hpp>
-
-namespace CGAL{
-
-namespace Polygon_mesh_processing{
-
-namespace internal {
-
-  template<typename Point>
-  typename CGAL::Kernel_traits<Point>::Kernel::Vector_3
-  triangle_normal(const Point& p0, const Point& p1, const Point& p2)
-  {
-    return CGAL::cross_product(p2 - p1, p0 - p1);
-  }
-}
-
-template<typename Point, typename PM, typename VertexPointMap, typename Vector>
-void sum_normals(const PM& pmesh,
-                 typename boost::graph_traits<PM>::face_descriptor f,
-                 VertexPointMap vpmap,
-                 Vector& sum)
-{
-  typedef typename boost::graph_traits<PM>::halfedge_descriptor halfedge_descriptor;
-  halfedge_descriptor he = halfedge(f, pmesh);
-  halfedge_descriptor end = he;
-  bool f_is_triangle = (he == next(next(next(he, pmesh), pmesh), pmesh));
-  /*it is useless to compute the normal 3 times on a triangle*/
-  do
-  {
-    const Point& prv = get(vpmap, target(prev(he, pmesh), pmesh));
-    const Point& curr = get(vpmap, target(he, pmesh));
-    const Point& nxt = get(vpmap, target(next(he, pmesh), pmesh));
-    Vector n = internal::triangle_normal(prv, curr, nxt);
-    sum = sum + n;
-
-    he = next(he, pmesh);
-  } while (he != end && !f_is_triangle);
-}
-
-
-/**
-* \ingroup PMP_normal_grp
-* computes the outward unit vector normal to face `f`.
-* @tparam PolygonMesh a model of `FaceGraph` that has an internal property map
-*         for `CGAL::vertex_point_t`
-* @tparam NamedParameters a sequence of \ref namedparameters
-*
-* @param f the face on which the normal is computed
-* @param pmesh the polygon mesh containing `f`
-* @param np optional sequence of \ref namedparameters among the ones listed below
-*
-* \cgalNamedParamsBegin
-*    \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh` \cgalParamEnd
-*    \cgalParamBegin{geom_traits} a geometric traits class instance \cgalParamEnd
-* \cgalNamedParamsEnd
-*
-* @return the computed normal. The return type is a 3D vector type. It is
-* either deduced from the `geom_traits` \ref namedparameters if provided,
-* or from the geometric traits class deduced from the point property map
-* of `pmesh`.
-*/
-template <typename PolygonMesh, typename NamedParameters>
-#ifdef DOXYGEN_RUNNING
-Vector_3
-#else
-typename GetGeomTraits<PolygonMesh, NamedParameters>::type::Vector_3
-#endif
-compute_face_normal(typename boost::graph_traits<PolygonMesh>::face_descriptor f
-                    , const PolygonMesh& pmesh
-                    , const NamedParameters& np)
-{
-  typedef typename GetGeomTraits<PolygonMesh, NamedParameters>::type Kernel;
-  typedef typename Kernel::FT FT;
-  typedef typename Kernel::Point_3 Point;
-  typedef typename Kernel::Vector_3 Vector;
-
-  using boost::get_param;
-  using boost::choose_const_pmap;
-
-  Vector normal = CGAL::NULL_VECTOR;
-  sum_normals<Point>(pmesh, f
-    , choose_const_pmap(get_param(np, CGAL::vertex_point), pmesh, CGAL::vertex_point)
-    , normal);
-
-  if (normal == CGAL::NULL_VECTOR)
-    return normal;
-  else
-  return normal / FT( std::sqrt( to_double(normal * normal) ) );
-}
-
-/**
-* \ingroup PMP_normal_grp
-* computes the outward unit vector normal for all faces of the polygon mesh.
-* @tparam PolygonMesh a model of `FaceGraph` that has an internal property map
-*         for `CGAL::vertex_point_t`
-* @tparam FaceNormalMap a model of `WritablePropertyMap` with
-    `boost::graph_traits<PolygonMesh>::%face_descriptor` as key type and
-    `Kernel::Vector_3` as value type.
-*
-* @param pmesh the polygon mesh
-* @param fnm the property map in which the normals are written
-* @param np optional sequence of \ref namedparameters among the ones listed below
-*
-* \cgalNamedParamsBegin
-*    \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh` \cgalParamEnd
-*    \cgalParamBegin{geom_traits} a geometric traits class instance \cgalParamEnd
-* \cgalNamedParamsEnd
-*
-*/
-template <typename PolygonMesh
-          , typename FaceNormalMap
-          , typename NamedParameters>
-void
-compute_face_normals(const PolygonMesh& pmesh
-                   , FaceNormalMap fnm
-                   , const NamedParameters& np)
-{
-  typedef typename GetGeomTraits<PolygonMesh,NamedParameters>::type Kernel;
-
-  typename boost::graph_traits<PolygonMesh>::face_descriptor f;
-  BOOST_FOREACH(f, faces(pmesh)){
-    typename Kernel::Vector_3 vec = compute_face_normal(f, pmesh, np);
-    put(fnm, f, vec);
-  }
-}
-
-/**
-* \ingroup PMP_normal_grp
-* computes the unit normal at vertex `v` as the average of the normals of incident faces.
-* @tparam PolygonMesh a model of `FaceGraph` that has an internal property map
-*         for `CGAL::vertex_point_t`
-*
-* @param v the vertex at which the normal is computed
-* @param pmesh the polygon mesh containing `v`
-* @param np optional sequence of \ref namedparameters among the ones listed below
-*
-* \cgalNamedParamsBegin
-*    \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh` \cgalParamEnd
-*    \cgalParamBegin{geom_traits} a geometric traits class instance \cgalParamEnd
-* \cgalNamedParamsEnd
-*
-* @return the computed normal. The return type is a 3D vector type. It is
-* either deduced from the `geom_traits` \ref namedparameters if provided,
-* or the geometric traits class deduced from the point property map
-* of `pmesh`.
-*/
-template<typename PolygonMesh, typename NamedParameters>
-#ifdef DOXYGEN_RUNNING
-Vector_3
-#else
-typename GetGeomTraits<PolygonMesh, NamedParameters>::type::Vector_3
-#endif
-compute_vertex_normal(typename boost::graph_traits<PolygonMesh>::vertex_descriptor v,
-                      const PolygonMesh& pmesh,
-                      const NamedParameters& np
-                      )
-{
-  typedef typename GetGeomTraits<PolygonMesh, NamedParameters>::type Kernel;
-  typedef typename Kernel::FT FT;
-
-  typedef typename GetFaceNormalMap<PolygonMesh, NamedParameters>::NoMap DefaultMap;
-
-  typedef typename boost::lookup_named_param_def <
-    CGAL::face_normal_t,
-    NamedParameters,
-    DefaultMap> ::type FaceNormalMap;
-
-  FaceNormalMap fnmap
-    = boost::choose_param(get_param(np, face_normal), DefaultMap());
-
-  bool fnmap_valid
-    = !boost::is_same<FaceNormalMap,
-                      DefaultMap
-                     >::value;
-
-  typedef typename Kernel::Vector_3 Vector;
-  typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor halfedge_descriptor;
-
-  Vector normal = CGAL::NULL_VECTOR;
-  halfedge_descriptor he = halfedge(v, pmesh);
-  // handle isolated vertices
-  if (he==boost::graph_traits<PolygonMesh>::null_halfedge()) return normal;
-  halfedge_descriptor end = he;
-  do
-    {
-    if (!is_border(he, pmesh))
-    {
-      Vector n = fnmap_valid ? get(fnmap, face(he, pmesh))
-                             : compute_face_normal(face(he, pmesh), pmesh, np);
-      normal = normal + n;
-    }
-    he = opposite(next(he, pmesh), pmesh);
-  } while (he != end);
-
-  if (normal == CGAL::NULL_VECTOR)
-    return normal;
-  else
-  return normal / FT( std::sqrt( to_double(normal * normal)  ) );
-}
-
-/**
-* \ingroup PMP_normal_grp
-* computes the outward unit vector normal for all vertices of the polygon mesh.
-* @tparam PolygonMesh a model of `FaceListGraph` that has an internal property map
-*         for `CGAL::vertex_point_t`
-* @tparam VertexNormalMap a model of `WritablePropertyMap` with
-    `boost::graph_traits<PolygonMesh>::%vertex_descriptor` as key type and
-    the return type of `compute_vertex_normal()` as value type.
-*
-* @param pmesh the polygon mesh
-* @param vnm the property map in which the normals are written
-* @param np optional sequence of \ref namedparameters among the ones listed below
-*
-* \cgalNamedParamsBegin
-*    \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh` \cgalParamEnd
-*    \cgalParamBegin{geom_traits} a geometric traits class instance \cgalParamEnd
-* \cgalNamedParamsEnd
-*
-*/
-template <typename PolygonMesh
-          , typename VertexNormalMap
-          , typename NamedParameters
-          >
-void
-compute_vertex_normals(const PolygonMesh& pmesh
-                      , VertexNormalMap vnm
-                      , const NamedParameters& np
-                      )
-{
-  typedef typename GetGeomTraits<PolygonMesh,NamedParameters>::type Kernel;
-
-  typename boost::graph_traits<PolygonMesh>::vertex_descriptor v;
-  BOOST_FOREACH(v, vertices(pmesh)){
-    typename Kernel::Vector_3 vec = compute_vertex_normal(v, pmesh, np);
-    put(vnm, v, vec);
-  }
-}
-
-/**
-* \ingroup PMP_normal_grp
-* computes the outward unit vector normal for all vertices and faces of the polygon mesh.
-* @tparam PolygonMesh a model of `FaceListGraph` that has an internal property map
-*         for `CGAL::vertex_point_t`
-* @tparam VertexNormalMap a model of `WritablePropertyMap` with
-    `boost::graph_traits<PolygonMesh>::%vertex_descriptor` as key type and
-    `Kernel::Vector_3` as value type.
-* @tparam FaceNormalMap a model of `ReadWritePropertyMap` with
-    `boost::graph_traits<PolygonMesh>::%face_descriptor` as key type and
-    `Kernel::Vector_3` as value type.
-*
-* @param pmesh the polygon mesh
-* @param vnm the property map in which the vertex normals are written
-* @param fnm the property map in which the face normals are written
-* @param np optional sequence of \ref namedparameters among the ones listed below
-*
-* \cgalNamedParamsBegin
-*    \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh` \cgalParamEnd
-*    \cgalParamBegin{geom_traits} a geometric traits class instance \cgalParamEnd
-* \cgalNamedParamsEnd
-*
-*/
-template <typename PolygonMesh
-          , typename VertexNormalMap
-          , typename FaceNormalMap
-          , typename NamedParameters
-          >
-void
-compute_normals(const PolygonMesh& pmesh
-                , VertexNormalMap vnm
-                , FaceNormalMap fnm
-                , const NamedParameters& np
-                )
-{
-  compute_face_normals(pmesh, fnm, np);
-  compute_vertex_normals(pmesh, vnm, np.face_normal_map(fnm));
-}
-
-///\cond SKIP_IN_MANUAL
-// compute_vertex_normal overloads
-template <typename PolygonMesh>
-typename CGAL::Kernel_traits< typename property_map_value<PolygonMesh, CGAL::vertex_point_t>::type>::Kernel::Vector_3
-compute_vertex_normal(
-  typename boost::graph_traits<PolygonMesh>::vertex_descriptor v,
-  const PolygonMesh& pmesh)
-{
-  return compute_vertex_normal(v, pmesh,
-    CGAL::Polygon_mesh_processing::parameters::all_default());
-}
-
-// compute_vertex_normals overloads
-template <typename PolygonMesh, typename VertexNormalMap>
-void
-compute_vertex_normals(const PolygonMesh& pmesh,
-                      VertexNormalMap vnm)
-{
-  compute_vertex_normals(pmesh, vnm,
-    CGAL::Polygon_mesh_processing::parameters::all_default());
-}
-
-// compute_face_normal overload
-template <typename PolygonMesh>
-typename CGAL::Kernel_traits < typename property_map_value<PolygonMesh, CGAL::vertex_point_t>::type>::Kernel::Vector_3
-compute_face_normal(
-  typename boost::graph_traits<PolygonMesh>::face_descriptor f,
-  const PolygonMesh& pmesh)
-{
-  return compute_face_normal(f, pmesh,
-    CGAL::Polygon_mesh_processing::parameters::all_default());
-}
-
-// compute_face_normals overload
-template <typename PolygonMesh, typename FaceNormalMap>
-void
-compute_face_normals(const PolygonMesh& pmesh, FaceNormalMap fnm)
-{
-  compute_face_normals(pmesh, fnm,
-    CGAL::Polygon_mesh_processing::parameters::all_default());
-}
-
-// compute_normals overload
-template <typename PolygonMesh, typename VertexNormalMap, typename FaceNormalMap>
-void
-compute_normals(const PolygonMesh& pmesh,
-                VertexNormalMap vnm,
-                FaceNormalMap fnm)
-{
-  compute_normals(pmesh, vnm, fnm,
-    CGAL::Polygon_mesh_processing::parameters::all_default());
-}
-
-/// \endcond
-
-}
-
-} // end of namespace CGAL::Polygon_mesh_processing
-
-#endif // CGAL_POLYGON_MESH_PROCESSING_COMPUTE_NORMAL_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/fair.h b/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/fair.h
deleted file mode 100644
index 095a399..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/fair.h
+++ /dev/null
@@ -1,165 +0,0 @@
-// Copyright (c) 2015 GeometryFactory (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Ilker O. Yaz
-
-#ifndef CGAL_POLYGON_MESH_PROCESSING_FAIR_H
-#define CGAL_POLYGON_MESH_PROCESSING_FAIR_H
-
-#include <CGAL/Polygon_mesh_processing/internal/fair_impl.h>
-#include <CGAL/Polygon_mesh_processing/internal/named_function_params.h>
-#include <CGAL/Polygon_mesh_processing/internal/named_params_helper.h>
-
-#if defined(CGAL_EIGEN3_ENABLED)
-#include <CGAL/Eigen_solver_traits.h>  // for sparse linear system solver
-#endif
-
-#include <boost/type_traits/is_same.hpp>
-
-namespace CGAL {
-
-namespace Polygon_mesh_processing {
-
-namespace internal {
-  // use non-default weight calculator and non-default solver
-  // WeightCalculator a model of `FairWeightCalculator`, can be omitted to use default Cotangent weights
-  // weight_calculator a function object to calculate weights, defaults to Cotangent weights and can be omitted
-  template<typename SparseLinearSolver,
-           typename WeightCalculator,
-           typename TriangleMesh,
-           typename VertexRange,
-           typename VertexPointMap>
-  bool fair(TriangleMesh& tmesh,
-    const VertexRange& vertices,
-    SparseLinearSolver solver,
-    WeightCalculator weight_calculator,
-    unsigned int continuity,
-    VertexPointMap vpmap)
-  {
-    CGAL::Polygon_mesh_processing::internal::Fair_Polyhedron_3
-       <TriangleMesh, SparseLinearSolver, WeightCalculator, VertexPointMap>
-       fair_functor(tmesh, vpmap, weight_calculator);
-    return fair_functor.fair(vertices, solver, continuity);
-  }
-
-} //end namespace internal
-
-  /*!
-  \ingroup PMP_meshing_grp
-  @brief fairs a region on a triangle mesh.
-  The points of the selected vertices are
-  relocated to yield an as-smooth-as-possible surface patch,
-  based on solving a linear bi-Laplacian system with boundary constraints,
-  described in \cgalCite{Botsch2008OnLinearVariational}.
-  The optional parameter `fairing_continuity` gives the ability to control the tangential
-  continuity C<sup>\a n</sup> of the output mesh.
-
-  The region described by `vertices` might contain multiple disconnected components.
-  Note that the mesh connectivity is not altered in any way,
-  only vertex locations get updated.
-
-  Fairing might fail if fixed vertices, which are used as boundary conditions,
-  do not suffice to solve constructed linear system.
-
-  Note that if the vertex range to which fairing is applied contains all the vertices of the triangle mesh,
-  fairing does not fail, but the mesh gets shrinked to `CGAL::ORIGIN`.
-
-  @tparam TriangleMesh a model of `FaceGraph` and `MutableFaceGraph`
-          that has an internal property map for `CGAL::vertex_point_t`
-  @tparam VertexRange a range of vertex descriptors of `TriangleMesh`, model of `Range`.
-          Its iterator type is `InputIterator`.
-  @tparam NamedParameters a sequence of \ref namedparameters
-
-  @param tmesh the triangle mesh with patches to be faired
-  @param vertices the vertices of the patches to be faired (the positions of only those vertices will be changed)
-  @param np optional sequence of \ref namedparameters among the ones listed below
-
-  \cgalNamedParamsBegin
-    \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `tmesh` \cgalParamEnd
-    \cgalParamBegin{fairing_continuity} tangential continuity of the output surface patch. The larger `fairing_continuity` gets, the more fixed vertices are required \cgalParamEnd
-    \cgalParamBegin{sparse_linear_solver} an instance of the sparse linear solver used for fairing \cgalParamEnd
-  \cgalNamedParamsEnd
-  
-  @return `true` if fairing is successful, otherwise no vertices are relocated
-
-  @pre `is_triangle_mesh(tmesh)`
-
-  @todo accuracy of solvers are not good, for example when there is no boundary condition pre_factor should fail, but it does not.
-  */
-  template<typename TriangleMesh,
-           typename VertexRange,
-           typename NamedParameters>
-  bool fair(TriangleMesh& tmesh,
-            const VertexRange& vertices,
-            const NamedParameters& np)
-  {
-    using boost::get_param;
-    using boost::choose_param;
-
-    CGAL_precondition(is_triangle_mesh(tmesh));
-
-#if defined(CGAL_EIGEN3_ENABLED)
-  #if EIGEN_VERSION_AT_LEAST(3,2,0)
-    typedef CGAL::Eigen_solver_traits<Eigen::SparseLU<
-      CGAL::Eigen_sparse_matrix<double>::EigenType, Eigen::COLAMDOrdering<int> >  >
-      Default_solver;
-  #else
-    typedef bool Default_solver;//compilation should crash
-      //if no solver is provided and Eigen version < 3.2
-  #endif
-#else
-    typedef bool Default_solver;//compilation should crash
-      //if no solver is provided and Eigen version < 3.2
-#endif
-
-#if defined(CGAL_EIGEN3_ENABLED)
-    CGAL_static_assertion_msg(
-      (!boost::is_same<typename GetSolver<NamedParameters, Default_solver>::type, bool>::value) || EIGEN_VERSION_AT_LEAST(3, 2, 0),
-      "The function `fair` requires Eigen3 version 3.2 or later.");
-#else
-    CGAL_static_assertion_msg(
-      (!boost::is_same<typename GetSolver<NamedParameters, Default_solver>::type, bool>::value),
-      "The function `fair` requires Eigen3 version 3.2 or later.");
-#endif
-
-    typedef typename GetVertexPointMap < TriangleMesh, NamedParameters>::type VPMap;
-    typedef CGAL::internal::Cotangent_weight_with_voronoi_area_fairing<TriangleMesh, VPMap>
-      Default_Weight_calculator;
-
-    VPMap vpmap_ = choose_param(get_param(np, vertex_point), get(CGAL::vertex_point, tmesh));
-
-    return internal::fair(tmesh, vertices,
-      choose_param(get_param(np, sparse_linear_solver), Default_solver()),
-      choose_param(get_param(np, weight_calculator), Default_Weight_calculator(tmesh, vpmap_)),
-      choose_param(get_param(np, fairing_continuity), 1),
-      vpmap_
-      );
-  }
-
-  template<typename TriangleMesh, typename VertexRange>
-  bool fair(TriangleMesh& tmesh, const VertexRange& vertices)
-  {
-    return fair(tmesh, vertices,
-      CGAL::Polygon_mesh_processing::parameters::all_default());
-  }
-
-} //end namespace Polygon_mesh_processing
-
-} //end namespace CGAL
-
-#endif //CGAL_POLYGON_MESH_PROCESSING_FAIR_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h b/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h
deleted file mode 100644
index 626c3ce..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h
+++ /dev/null
@@ -1,1236 +0,0 @@
-// Copyright (c) 2015 GeometryFactory (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Ilker O. Yaz
-
-#ifndef CGAL_HOLE_FILLING_TRIANGULATE_HOLE_POLYLINE_H
-#define CGAL_HOLE_FILLING_TRIANGULATE_HOLE_POLYLINE_H
-
-#include <CGAL/Mesh_3/dihedral_angle_3.h>
-#include <CGAL/value_type_traits.h>
-#include <CGAL/Delaunay_triangulation_3.h>
-#include <CGAL/Triangulation_vertex_base_with_info_3.h>
-#include <CGAL/iterator.h>
-#include <CGAL/trace.h>
-#include <CGAL/use.h>
-
-#include <vector>
-#include <stack>
-#include <map>
-
-#include <boost/iterator/transform_iterator.hpp>
-#include <boost/unordered_set.hpp>
-
-namespace CGAL {
-namespace internal {
-
-/************************************************************************
- * Lookup tables
- ************************************************************************/
-// Wrapper around vector
-template<class T>
-class Lookup_table {
-public:
-  Lookup_table(int n, const T& t) : n(n), table(n*n, t) { }
-  void put(int i, int j, const T& t) {
-    CGAL_assertion(bound_check(i,j));
-    table[i*n + j] = t;
-  }
-  const T& get(int i, int j) const {
-    CGAL_assertion(bound_check(i,j));
-    return table[i*n + j];
-  }
-
-  int n;
-private:
-  bool bound_check(int i, int j) const {
-    CGAL_assertion(i >= 0 && i < n);
-    CGAL_assertion(j >= 0 && j < n);
-    CGAL_assertion(i < j); 
-    CGAL_USE(i);
-    CGAL_USE(j);
-    // previous implementation was based on directly vector and i supposed to be always smaller than j.
-    // this check actually can be removed and i =min(i,j) j = max(i,j) can be used for reflexive access 
-    return true;
-  }
-  std::vector<T> table;
-};
-
-// Wrapper around map, where if i,j is not found a default value is returned,
-// and if default value inserted i,j erased.
-template<class T>
-class Lookup_table_map {
-public:
-  Lookup_table_map(int n, const T& default_) : n(n), default_(default_) { }
-
-  void put(int i, int j, const T& t) {
-    CGAL_assertion(bound_check(i,j));
-    
-    if(t == default_) {
-      table.erase(std::make_pair(i,j));
-      return;
-    }
-    
-    std::pair<typename Map::iterator, bool> inserted = table.insert(std::make_pair(std::make_pair(i,j), t));
-    if(!inserted.second) { inserted.first->second = t;}
-  }
-  const T& get(int i, int j) const {
-    CGAL_assertion(bound_check(i,j));
-    typename Map::const_iterator ij = table.find(std::make_pair(i,j));
-    if(ij != table.end()) {
-      return ij->second;
-    }
-    return default_;
-  }
-
-  void set_range_to_default(int b, int e/*inclusive*/) {
-    // given a range b-e erase each entity which falls into b-e
-    // example: given range 2-6, entries need to be deleted  2-3, 2-4, 2-5, 2-6
-    //                                                            3-4, 3-5, 3-6
-    //                                                                 4-5, 4-6
-    //                                                                      5-6
-    typename Map::iterator it;
-    if(b == 0) { it = table.begin(); }
-    else       { 
-      it = table.upper_bound(std::make_pair(b-1, n)); // to find first entry where entry.first == b
-    }
-
-    while(it != table.end() && it->first.first != e) {
-      if(it->first.second <= e) 
-      { table.erase(it++); }
-      else 
-      { ++it; }
-    }
-  }
-
-  int n;
-private:
-  typedef std::map<std::pair<int,int>, T> Map;
-  bool bound_check(int i, int j) const {
-    CGAL_assertion(i >= 0 && i < n);
-    CGAL_assertion(j >= 0 && j < n);
-    CGAL_assertion(i < j);
-    CGAL_USE(i);
-    CGAL_USE(j);
-    return true;
-  }
-  Map table;
-  T default_;
-};
-
-/************************************************************************
- * Is_valid classes (to be used in Weight_calculator)
- ************************************************************************/
-struct Is_valid_existing_edges
-{
-  typedef std::vector<std::pair<int, int> > Edge_container;
-  
-  Is_valid_existing_edges(Edge_container& existing_edges) 
-    : existing_edges(existing_edges)
-  {
-    std::sort(existing_edges.begin(), existing_edges.end());
-#ifndef CGAL_NDEBUG
-    // all pairs need to be satisfy pair.first < pair.second
-    for(Edge_container::iterator it = existing_edges.begin(); it != existing_edges.end(); ++it) {
-      CGAL_assertion(it->first < it->second);
-    }
-#endif
-  }
-
-  template<class Point_3>
-  bool operator()(const std::vector<Point_3>&,
-                  int v0, int v1, int v2) const 
-  {
-    CGAL_assertion(v0 < v1 && v1 < v2);
-
-    if(v0 + 1 != v1 && // border edges can not be inside existing_edges, so no need to check
-       std::binary_search(existing_edges.begin(), existing_edges.end(), std::make_pair(v0,v1)) )
-    { return false; }
-
-    if(v1 + 1 != v2 &&
-      std::binary_search(existing_edges.begin(), existing_edges.end(), std::make_pair(v1,v2)) )
-    { return false; }
-    
-    if(std::binary_search(existing_edges.begin(), existing_edges.end(), std::make_pair(v2,v0)) )
-    { return false; }
-
-    return true;
-  }
-
-  Edge_container& existing_edges;
-};
-
-struct Is_not_degenerate_triangle
-{
-  template<class Point_3>
-  bool operator()(const std::vector<Point_3>& P,
-                  int v0, int v1, int v2) const 
-  {
-    return !CGAL::collinear(P[v0], P[v1], P[v2]);
-  }
-};
-
-// Combine above two
-struct Is_valid_existing_edges_and_degenerate_triangle
-{
-  Is_valid_existing_edges_and_degenerate_triangle(Is_valid_existing_edges::Edge_container& edges)
-    : is_valid_edges(edges) { }
-
-  template<class Point_3>
-  bool operator()(const std::vector<Point_3>& P,
-                  int v0, int v1, int v2) const 
-  {
-    return Is_not_degenerate_triangle()(P,v0,v1,v2)
-                      && is_valid_edges(P,v0,v1,v2);
-  }
-
-  Is_valid_existing_edges is_valid_edges;
-};
-
-/************************************************************************
- * Weights
- ************************************************************************/
-
-// First minimizes the worst dihedral angle between patch triangles, then the total surface area as a tiebreaker.
-class Weight_min_max_dihedral_and_area 
-{
-  template<class Weight_, class IsValid>
-  friend struct Weight_calculator;
-
-  template<class Weight_>
-  friend class Weight_incomplete;
-
-public:
-  // these two should not be used (used in test code)
-  std::pair<double,double> w;
-  Weight_min_max_dihedral_and_area(double angle, double area) : w(angle, area) { }
-
-// below required by Weight concept
-private:
-  template<class Point_3, class LookupTable>
-  Weight_min_max_dihedral_and_area(const std::vector<Point_3>& P, 
-                                   const std::vector<Point_3>& Q, 
-                                   int i, int j, int k, 
-                                   const LookupTable& lambda)
-  {
-    CGAL_assertion(i < j);
-    CGAL_assertion(j < k);
-    int n = static_cast<int>(P.size()) -1; // because the first and last point are equal
-    
-    // The CGAL::dihedral angle is measured between the oriented triangles, that is it goes from [-pi, pi]
-    // What we need is the angle between the normals of the triangles between [0, pi]
-    double ang_max = 0;
-
-    // Test each edge
-    int vertices[] = {i, j, k};
-    for(int e = 0; e < 3; ++e) 
-    {
-      int v0      = vertices[e];
-      int v1      = vertices[(e+1)%3];
-      int v_other = vertices[(e+2)%3];
-      double angle = 0;
-      // check whether the edge is border
-      if( (v0 + 1 == v1 || (v0 == n-1 && v1 == 0) ) && !Q.empty() ) {
-        angle = 180 - CGAL::abs( 
-          CGAL::Mesh_3::dihedral_angle(P[v0],P[v1],P[v_other],Q[v0]) );
-      }
-      else {
-        if(e == 2) { continue; }
-        if(lambda.get(v0, v1) != -1){
-          const Point_3& p01 = P[lambda.get(v0, v1)];
-          angle = 180 - CGAL::abs( 
-            CGAL::Mesh_3::dihedral_angle(P[v0],P[v1],P[v_other],p01) );
-        }
-      }
-      ang_max = (std::max)(ang_max, angle);
-    }
-   
-    w = std::make_pair(ang_max, CGAL::sqrt(CGAL::squared_area(P[i],P[j],P[k])));
-  }
-
-public:
-  Weight_min_max_dihedral_and_area operator+(const Weight_min_max_dihedral_and_area& w2) const 
-  {
-    CGAL_assertion((*this) != NOT_VALID());
-    CGAL_assertion(w2 != NOT_VALID());
-
-    return Weight_min_max_dihedral_and_area((std::max)(w.first, w2.w.first), w.second + w2.w.second);
-  }
-
-  bool operator<(const Weight_min_max_dihedral_and_area& w2) const
-  {
-    CGAL_assertion((*this) != NOT_VALID());
-    CGAL_assertion(w2 != NOT_VALID());
-
-    if(w.first == w2.w.first)
-    { return w.second < w2.w.second; }
-    return w.first < w2.w.first;
-  }
-
-  bool operator==(const Weight_min_max_dihedral_and_area& w2) const 
-  { return w.first == w2.w.first && w.second == w2.w.second; }
-
-  bool operator!=(const Weight_min_max_dihedral_and_area& w2) const 
-  { return !(*this == w2); }
-
-  static const Weight_min_max_dihedral_and_area DEFAULT() // rule: x + DEFAULT() == x
-  { return Weight_min_max_dihedral_and_area(0,0); }
-  static const Weight_min_max_dihedral_and_area NOT_VALID() 
-  { return Weight_min_max_dihedral_and_area(-1,-1); }
-
-  friend std::ostream& operator<<(std::ostream& out, const Weight_min_max_dihedral_and_area& w) {
-    out << "Max dihedral: " << w.w.first << ", Total area: " << w.w.second;
-    return out;
-  }
-};
-
-// For proof of concept. Tested weakly.
-class Weight_total_edge {
-  template<class Weight_, class IsValid>
-  friend struct Weight_calculator;
-
-private:
-  double total_length;
-
-  Weight_total_edge(double total_length = 0) : total_length(total_length) { }
-
-  template<class Point_3, class LookupTable>
-  Weight_total_edge(const std::vector<Point_3>& P, 
-                    const std::vector<Point_3>&, 
-                    int i, int j, int k, 
-                    const LookupTable&)
-    : total_length(0)
-  {
-    CGAL_assertion(i < j);
-    CGAL_assertion(j < k);
-    int n = P.size() -1; // because the first and last point are equal
-
-    // Test each edge
-    int vertices[] = {i, j, k};
-    for(int e = 0; e < 3; ++e) 
-    {
-      int v0      = vertices[e];
-      int v1      = vertices[(e+1)%3];
-        
-      // check whether the edge is border
-      bool border = (v0 + 1 == v1) || (v0 == n-1 && v1 == 0);
-      if(!border) {
-        total_length += CGAL::sqrt(CGAL::squared_distance(P[v0],P[v1]));
-      }
-    }
-  }
-
-public:
-  Weight_total_edge operator+(const Weight_total_edge& w2) const 
-  {
-    CGAL_assertion((*this) != NOT_VALID());
-    CGAL_assertion(w2 != NOT_VALID());
-    return Weight_total_edge(total_length + w2.total_length);
-  }
-
-  bool operator<(const Weight_total_edge& w2) const
-  { 
-    CGAL_assertion((*this) != NOT_VALID());
-    CGAL_assertion(w2 != NOT_VALID());
-    return total_length < w2.total_length; 
-  }
-
-  bool operator==(const Weight_total_edge& w2) const 
-  { return total_length == w2.total_length; }
-  bool operator!=(const Weight_total_edge& w2) const 
-  { return !(*this == w2); }
-
-  static const Weight_total_edge DEFAULT() { return Weight_total_edge(0); } // rule: x + DEFAULT() == x
-  static const Weight_total_edge NOT_VALID() { return Weight_total_edge(-1); }
-  friend std::ostream& operator<<(std::ostream& out, const Weight_total_edge& w) {
-    out << "Total edge length : " << w.total_length;
-    return out;
-  }
-};
-
-// Weights for incomplete patches. It maximize patch size, then ActualWeight as a tiebreaker.
-template<class ActualWeight>
-class Weight_incomplete
-{
-  template<class Weight_, class IsValid>
-  friend struct Weight_calculator;
-
-private:
-  template<class Point_3, class LookupTable>
-  Weight_incomplete(const std::vector<Point_3>& P, 
-    const std::vector<Point_3>& Q, 
-    int i, int j, int k, 
-    const LookupTable& lambda)
-    : weight(P,Q,i,j,k,lambda), patch_size(1)
-  { }
-
-  Weight_incomplete(const ActualWeight& weight, int patch_size) 
-    : weight(weight), patch_size(patch_size)
-  { }
-
-public:
-  Weight_incomplete operator+(const Weight_incomplete& w2) const 
-  {
-    CGAL_assertion((*this) != NOT_VALID());
-    CGAL_assertion(w2 != NOT_VALID());
-
-    return Weight_incomplete(weight + w2.weight, patch_size + w2.patch_size);
-  }
-
-  bool operator<(const Weight_incomplete& w2) const
-  {
-    CGAL_assertion((*this) != NOT_VALID());
-    CGAL_assertion(w2 != NOT_VALID());
-
-    if(patch_size == w2.patch_size) {
-      return weight < w2.weight;
-    }
-    return patch_size > w2.patch_size; // if patch size is larger, then the weight is smaller
-  }
-
-  bool operator==(const Weight_incomplete& w2) const 
-  { return weight == w2.weight && patch_size == w2.patch_size; }
-
-  bool operator!=(const Weight_incomplete& w2) const 
-  { return !(*this == w2); }
-
-  static const Weight_incomplete DEFAULT() // rule: x + DEFAULT() == x
-  { return Weight_incomplete(ActualWeight::DEFAULT(), 0); }
-  static const Weight_incomplete NOT_VALID()
-  { return Weight_incomplete(ActualWeight::NOT_VALID(), 0); }
-
-  friend std::ostream& operator<<(std::ostream& out, const Weight_incomplete& w) {
-    out << "Patch size: " << w.patch_size << ", Actual weight: " << w.weight;
-    return out;
-  }
-
-  ActualWeight weight;
-  int patch_size;
-};
-
-// Weight calculator class is both responsible from calculating weights, and checking validity of triangle
-template<class Weight_, class IsValid>
-struct Weight_calculator 
-{
-  typedef Weight_ Weight;
-  Weight_calculator(const IsValid& is_valid = IsValid()) : is_valid(is_valid) { }
-
-  template<class Point_3, class LookupTable>
-  Weight operator()(const std::vector<Point_3>& P, 
-    const std::vector<Point_3>& Q, 
-    int i, int j, int k, 
-    const LookupTable& lambda) const 
-  {
-    if( !is_valid(P,i,j,k) ) 
-    { return Weight::NOT_VALID(); }
-    return Weight(P, Q, i,j,k, lambda);
-  }
-
-  IsValid is_valid;
-};
-/************************************************************************
- * Tracer
- ************************************************************************/
-// It can produce a patch from both complete and incomplete lambda
-template<class OutputIteratorValueType, class OutputIteratorPatch, class OutputIteratorHole>
-struct Tracer_polyline_incomplete {
-  Tracer_polyline_incomplete(OutputIteratorPatch out, OutputIteratorHole out_hole) 
-    : out(out), out_hole(out_hole)
-  { }
-
-  template <class LookupTable>
-  void
-  operator()(const LookupTable& lambda, int v0, int v1)
-  {
-    CGAL_assertion_code( const int n = lambda.n; )
-    std::stack<std::pair<int, int> > ranges;
-    ranges.push(std::make_pair(v0, v1));
-
-    while(!ranges.empty()) {
-      std::pair<int, int> r = ranges.top(); 
-      ranges.pop();
-      CGAL_assertion(r.first >= 0 && r.first < n);
-      CGAL_assertion(r.second >= 0 && r.second < n);
-
-      if(r.first + 1 == r.second) { continue; }
-
-      int la = lambda.get(r.first, r.second);
-      if(la == -1) {
-        *out_hole++ = std::make_pair(r.first, r.second);
-        continue;
-      }
-
-      CGAL_assertion(la >= 0 && la < n);
-      CGAL_assertion(r.first < la && r.second > la);
-      *out++ = OutputIteratorValueType(r.first, la, r.second);
-
-      ranges.push(std::make_pair(r.first, la));
-      ranges.push(std::make_pair(la, r.second));
-    }
-  }
-
-  OutputIteratorPatch out;
-  OutputIteratorHole  out_hole;
-};
-
-/************************************************************************
- * Triangulate hole with support of 3D Triangulation
- ************************************************************************/
-
-// to support incident_facets(Edge e) function for both dimension 2 and 3
-template<unsigned int Dimension, class Triangulator>
-struct Incident_facet_circulator;
-
-template<class Triangulator>
-struct Incident_facet_circulator_base 
-{
-  typedef typename Triangulator::Facet         Facet;
-  typedef typename Triangulator::Edge          Edge;
-  typedef typename Triangulator::Cell_handle   Cell_handle;
-
-  struct Edge_wrapper {
-    Edge_wrapper(Edge e) : e(e) { }
-
-    int vertex_first()
-    { return (std::min)(e.first->vertex(e.second)->info(), e.first->vertex(e.third)->info()); }
-    int vertex_second()
-    { return (std::max)(e.first->vertex(e.second)->info(), e.first->vertex(e.third)->info()); }
-    
-    Edge e;
-  };
-
-  // Finds the other vertex than e.v0 and e.v1 in facet f
-  // Note that this may return infinite vertex
-  int get_third(Facet f, Edge e) {
-    int v0_info = e.first->vertex(e.second)->info();
-    int v1_info = e.first->vertex(e.third )->info();
-    // warning: it should be designed to handle dimension 2 (e.g. f.first->vertex(3)->info() will crash)
-    for(int i = 0; i < 4; ++i) {
-      if(i == f.second) { continue; } // skip the vertex which is not on `f`
-      int f3 = f.first->vertex(i)->info();
-      if(f3 != v0_info && f3 != v1_info) {
-        return f3; 
-      }
-    }
-    CGAL_assertion(false);
-    return -1;
-  }
-
-  Edge_wrapper edge_first(Facet f, Edge e) {
-    int v0_info = (std::min)(e.first->vertex(e.second)->info(),
-                             e.first->vertex(e.third)->info());
-    return Edge(f.first, 
-                get_vertex_index(f.first, v0_info) , 
-                get_vertex_index(f.first, get_third(f,e)));
-  }
-
-  Edge_wrapper edge_second(Facet f, Edge e) {
-    int v1_info = (std::max)(e.first->vertex(e.second)->info(),
-                             e.first->vertex(e.third)->info());
-    return Edge(f.first,
-                get_vertex_index(f.first, v1_info),
-                get_vertex_index(f.first, get_third(f,e)));
-  }
-
-  int get_vertex_index(Cell_handle ch, int info) {
-    // warning: it should be designed to handle dimension 2 (e.g. f.first->vertex(3)->info() will crash)
-    for(int i = 0; i < 4; ++i) {
-      int v = ch->vertex(i)->info();
-      if(v == info) { return i; }
-    }
-    CGAL_assertion(false);
-    return -1;
-  }
-};
-
-// Use the fact that an edge can be incident to 2 facets in dimension 2
-// and all valid facets (which contains finite + infinite vertices but not the NULL vertex) are
-// pointed by index 3 in cells
-template<class Triangulator>
-struct Incident_facet_circulator<2, Triangulator>
-  : Incident_facet_circulator_base<Triangulator>
-{
-  typedef typename Triangulator::Facet         Facet;
-  typedef typename Triangulator::Edge          Edge;
-  typedef typename Triangulator::Triangulation Triangulation;
-  typedef typename Incident_facet_circulator_base<Triangulator>::Edge_wrapper Edge_wrapper;
-
-  Incident_facet_circulator(Edge_wrapper ew, const Triangulation&)
-    : f1( Facet(ew.e.first, 3) ),
-      f2( Facet(ew.e.first->neighbor(3 - ew.e.second - ew.e.third), 3) ),
-      it(f1), e(ew.e)
-  {
-     CGAL_assertion(f1 != f2);
-     CGAL_assertion(e.second < 3 && e.third < 3);
-  }
-  Incident_facet_circulator& operator++() {
-    it = it == f1 ? f2 : f1;
-    return *this;
-  }
-  operator bool() const { return it != f1; }
-
-  int get_third()
-  { return Incident_facet_circulator_base<Triangulator>::get_third(it, e); }
-  Edge_wrapper edge_first() 
-  { return Incident_facet_circulator_base<Triangulator>::edge_first(it, e); }
-  Edge_wrapper edge_second() 
-  { return Incident_facet_circulator_base<Triangulator>::edge_second(it, e); }
-
-  Facet f1, f2, it;
-  Edge e;
-};
-
-// Just a wrapper around Facet_circulator
-template<class Triangulator>
-struct Incident_facet_circulator<3, Triangulator>
-  : Incident_facet_circulator_base<Triangulator>
-{
-  typedef typename Triangulator::Facet            Facet;
-  typedef typename Triangulator::Edge             Edge;
-  typedef typename Triangulator::Triangulation    Triangulation;
-  typedef typename Triangulator::Facet_circulator Facet_circulator;
-  typedef typename Incident_facet_circulator_base<Triangulator>::Edge_wrapper Edge_wrapper;
-
-  Incident_facet_circulator(Edge_wrapper ew, const Triangulation& tr)
-    : it(tr.incident_facets(ew.e)), end(it), e(ew.e)
-  { }
-  Incident_facet_circulator& operator++() {
-    ++it;
-    return *this;
-  }
-  operator bool() const { return it != end; }
-  
-  int get_third() 
-  { return Incident_facet_circulator_base<Triangulator>::get_third(*it, e); }
-  Edge_wrapper edge_first() 
-  { return Incident_facet_circulator_base<Triangulator>::edge_first(*it, e); }
-  Edge_wrapper edge_second() 
-  { return Incident_facet_circulator_base<Triangulator>::edge_second(*it, e); }
-
-  Facet_circulator it;
-  Facet_circulator end;
-  Edge e;
-};
-
-// Another DS for search space, which can be used in triangulate_DT
-// It is useful for extending the search space of 3D Triangulation by appending new triangles
-struct Edge_graph 
-{
-  struct Edge_comp {
-    bool operator()(std::pair<int, int> p0, std::pair<int, int> p1) const {
-      if(p0.first > p0.second) { std::swap(p0.first, p0.second); }
-      if(p1.first > p1.second) { std::swap(p1.first, p1.second); }
-      return p0 < p1;
-    }
-  };
-
-  typedef boost::unordered_set<int> Vertex_container;
-  // contains edges as key, and each edge contains set of third vertices which denote neighbor facets to that edge
-  typedef std::map<std::pair<int, int>, Vertex_container, Edge_comp> Graph;
-
-  struct Edge_wrapper {
-    Edge_wrapper(std::pair<int, int> e) : e(e) { }
-
-    int vertex_first()  const { return (std::min)(e.first, e.second); }
-    int vertex_second() const { return (std::max)(e.first, e.second); }
-    std::pair<int, int> e;
-  };
-
-  struct Incident_facet_circulator
-  {
-    Incident_facet_circulator(Edge_wrapper ew, const Edge_graph& tr)
-    {
-      Graph::const_iterator it_e = tr.graph.find(ew.e);
-      CGAL_assertion(it_e != tr.graph.end());
-      it = it_e->second.begin();
-      end = it_e->second.end();
-      e = ew.e;
-    }
-    Incident_facet_circulator& operator++() {
-      ++it;
-      return *this;
-    }
-    operator bool() const { return it != end; }
-
-    int get_third() const { return *it; }
-    Edge_wrapper edge_first()  const { return std::make_pair(Edge_wrapper(e).vertex_first(), *it); }
-    Edge_wrapper edge_second() const { return std::make_pair(Edge_wrapper(e).vertex_second(), *it); }
-
-    Vertex_container::const_iterator it;
-    Vertex_container::const_iterator end;
-    std::pair<int, int> e;
-  };
-
-  template<class IncidentFacetCirculator, class Triangulation>
-  void init(const Triangulation& tr, const std::vector<bool>& edge_exist)
-  {
-    typedef typename Triangulation::Finite_edges_iterator Finite_edges_iterator;
-
-    n = static_cast<int>(edge_exist.size());
-    for(Finite_edges_iterator eb = tr.finite_edges_begin(); eb != tr.finite_edges_end(); ++eb) 
-    {
-      int v0 = eb->first->vertex(eb->second)->info();
-      int v1 = eb->first->vertex(eb->third )->info();
-      Vertex_container& e_neighs = graph[std::make_pair(v0, v1)];
-
-      IncidentFacetCirculator fb(*eb, tr);
-      do {
-        int v2 = fb.get_third();
-        if(v2 == -1) { continue; }
-        e_neighs.insert(v2);
-      } while(++fb);
-    }
-
-    for(int i = 0; i < n; ++i) {
-      if(edge_exist[i]) { continue; }
-      int v0 = i == n-1 ? 0   : i;
-      int v1 = i == n-1 ? n-1 : i+1;
-      add_all_possible_to_edge(std::make_pair(v0, v1));
-    }
-  }
-
-  void add_all_possible_to_edge(std::pair<int, int> e) {
-    Vertex_container& e_neighs = graph[e];
-    for(int i = 0; i < n; ++i) {
-      if(i == e.first || i == e.second) { continue; }
-      e_neighs.insert(i);
-      graph[std::make_pair(i, e.first)].insert(e.second);
-      graph[std::make_pair(i, e.second)].insert(e.first);
-    }
-  }
-
-  Graph graph;
-  int n;
-};
-
-template<
-  class Kernel,
-  class Tracer,
-  class WeightCalculator,
-  template <class> class LookupTable = Lookup_table
->
-class Triangulate_hole_polyline;
-
-// By default Lookup_table_map is used, since Lookup_table requires n*n mem.
-// Performance decrease is nearly 2x (for n = 10,000, for larger n Lookup_table just goes out of mem) 
-template<
-  class Kernel,
-  class Tracer,
-  class WeightCalculator,
-  template <class> class LookupTable = Lookup_table_map
->
-class Triangulate_hole_polyline_DT 
-{
-  struct Auto_count {
-    typedef std::pair<typename Kernel::Point_3, int> result_type;
-
-    Auto_count(int count = 0) : count(count)  { }
-    result_type operator()(const typename Kernel::Point_3& p) const
-    { return std::make_pair(p, count++); }
-    mutable int count;
-  };
-
-public:
-  typedef typename WeightCalculator::Weight                   Weight;
-  typedef typename Kernel::Point_3                            Point_3;
-  typedef std::vector<Point_3>                                Polyline_3;
-
-  typedef Triangulation_vertex_base_with_info_3<int, Kernel>  VB_with_id;
-  typedef Triangulation_data_structure_3<VB_with_id>          TDS;
-  typedef Delaunay_triangulation_3<Kernel, TDS>               Triangulation;
-
-  typedef typename Triangulation::Finite_edges_iterator       Finite_edges_iterator;
-  typedef typename Triangulation::Facet_circulator            Facet_circulator;
-  typedef typename Triangulation::Cell_handle                 Cell_handle;
-  typedef typename Triangulation::Vertex_handle               Vertex_handle;
-  typedef typename Triangulation::Edge                        Edge;
-  typedef typename Triangulation::Facet                       Facet;
-
-  typedef Incident_facet_circulator<2, Triangulate_hole_polyline_DT> IFC_2;
-  typedef Incident_facet_circulator<3, Triangulate_hole_polyline_DT> IFC_3;
-
-  Weight operator()(const Polyline_3& P, 
-                    const Polyline_3& Q,
-                    Tracer& tracer,
-                    const WeightCalculator& WC) const
-  {
-    CGAL_assertion(P.front() == P.back());
-    CGAL_assertion(Q.empty() || (Q.front() == Q.back()));
-    CGAL_assertion(Q.empty() || (P.size() == Q.size()));
-
-    int n = static_cast<int>(P.size())-1; // because the first and last point are equal
-    Triangulation tr;
-    std::vector<bool> edge_exist;
-    std::pair<int, int> range(0, n-1);
-    boost::tuple<boost::optional<Edge>, bool, bool> res = construct_3D_triangulation(P, range, tr, edge_exist);
-    if(!res.template get<2>()) {
-      #ifndef CGAL_TEST_SUITE
-      CGAL_warning(!"Returning no output. Dimension of 3D Triangulation is below 2!");
-      #else
-      std::cerr << "W: Returning no output. Dimension of 3D Triangulation is below 2!\n";
-      #endif
-      return Weight::NOT_VALID();
-    }
-
-    // all border edges inside 3D Triangulation
-    if(boost::get<1>(res)) {
-      LookupTable<Weight> W(n, Weight::DEFAULT()); // do not forget that these default values are not changed for [i, i+1]
-      LookupTable<int>    lambda(n,-1);
-
-      typename Incident_facet_circulator_base<Triangulate_hole_polyline_DT>::Edge_wrapper
-        e_start(*boost::get<0>(res)); 
-      if(tr.dimension() == 3) {
-        triangulate_DT<IFC_3>(P, Q, W, lambda, e_start, tr, WC, false);
-      }
-      else {
-        CGAL_assertion(tr.dimension() == 2);
-        triangulate_DT<IFC_2>(P, Q, W, lambda, e_start, tr, WC, false);
-      }
-
-      if(W.get(0, n-1) == Weight::NOT_VALID()) {
-        #ifndef CGAL_TEST_SUITE
-        CGAL_warning(!"Returning no output. No possible triangulation is found!");
-        #else
-        std::cerr << "W: Returning no output. No possible triangulation is found!\n";
-        #endif
-        return Weight::NOT_VALID();
-      }
-
-      tracer(lambda, 0, n-1);
-      return W.get(0,n-1);
-    }
-    
-    // How to handle missing border edges
-    #if 1
-    return fill_by_extra_triangles(tr, edge_exist, P, Q, tracer, WC);
-    #else
-    // This approach produce better patches when used with Weight_incomplete 
-    // (which should be arranged in internal::triangulate_hole_Polyhedron, triangulate_polyline)
-    return fill_by_incomplete_patches(tr, res.get<0>(), edge_exist, P, Q, tracer, WC);
-    #endif
-  }
-
-private:
-
-  /************************************************************************
-  * Main algorithm which construct a minimum patch top-down searching through the space of tr
-  *
-  * + Edge_DT should have:
-  *   - vertex_first() vertex_second() functions where vertex_first() always returns vertex with smaller id
-  * + IncidentFacetCirculator should have:
-  *   - constructor with Edge_DT and Triangulation_DT
-  *   - pre-increment, conversion to bool
-  *   - get_third() returning the third vertex of facet pointed by circulator
-  *   - edge_first() and edge_second() neighbor edges to get_third() vertex
-  ************************************************************************/
-  template<class IncidentFacetCirculator, class Edge_DT, class Triangulation_DT>
-  void triangulate_DT(const Polyline_3& P, 
-                      const Polyline_3& Q, 
-                      LookupTable<Weight>& W, 
-                      LookupTable<int>& lambda, 
-                      Edge_DT e,
-                      const Triangulation_DT& tr,
-                      const WeightCalculator& WC,
-                      const bool produce_incomplete) const
-  {
-    /**********************************************************************
-     *  + Default W value is Weight::DEFAULT(), default lambda value is -1.
-     *  + DEFAULT() is used to check whether the region (v0-v1) is processed.
-     *  + If a range v0-v1 does not contains any possible triangulation, then W[v0,v1] = NOT_VALID() and lambda[v0,v1] = -1
-     *  + Note that w + DEFAULT() == w must hold
-     */
-    int v0 = e.vertex_first();
-    int v1 = e.vertex_second();
-    CGAL_assertion(v0 < v1);  // vertex_first() should always return vertex with smaller index
-    CGAL_assertion(v0 != -1); // edge can not be incident to infinite vertex
-
-    if( v0 + 1 == v1 || // border edge - should not check v0 = 0, v1 = n-1, because it is the initial edge where the algorithm starts
-        W.get(v0, v1) != Weight::DEFAULT() ) // the range is previously processed
-    { return; }
-
-    int m_min = -1;
-    Weight w_min = Weight::NOT_VALID();
-
-    IncidentFacetCirculator fb(e, tr);
-    do {
-      int v2 = fb.get_third();
-      if(v2 < v0 || v2 > v1) { continue; } // this will also skip infinite vertex
-
-      if(WC(P,Q, v0,v2,v1, lambda) == Weight::NOT_VALID())
-      { continue; } // computed weight in here is not correct weight
-                    // since max dih angle requires neighbor ranges to be already computed. It is just for checking validity.
-      
-      Weight w = Weight::DEFAULT();
-
-      Edge_DT e0 = fb.edge_first(); // edge v0-v2
-      CGAL_assertion(e0.vertex_first() == v0 && e0.vertex_second() == v2);
-      triangulate_DT<IncidentFacetCirculator>(P, Q, W, lambda, e0, tr, WC, produce_incomplete); // region v0-v2
-      const Weight& we0 = W.get(v0, v2);
-
-      if(!produce_incomplete && we0 == Weight::NOT_VALID()) 
-      { continue; } // not producing incomplete patches and failed to fill sub-range v0-v2, so no reason to proceed
-      if(we0 != Weight::NOT_VALID()) // to not consider we0 if it is NOT_VALID (it is valid when produce_incomplete = true)
-      { w = w + we0; }
-
-      Edge_DT e1 = fb.edge_second(); // edge v2-v1
-      CGAL_assertion(e1.vertex_first() == v2 && e1.vertex_second() == v1);
-      triangulate_DT<IncidentFacetCirculator>(P, Q, W, lambda, e1, tr, WC, produce_incomplete); // region v2-v1
-      const Weight& we1 = W.get(v2, v1);
-
-      if(!produce_incomplete && we1 == Weight::NOT_VALID()) 
-      { continue; }
-      if(we1 != Weight::NOT_VALID()) // to not consider we1 if it is NOT_VALID (it is valid when produce_incomplete = true)
-      { w = w + we1; }
-
-      w = w + WC(P,Q, v0,v2,v1, lambda);
-      if(m_min == -1 || w < w_min){
-        w_min = w;
-        m_min = v2;
-      }
-    } while(++fb);
-
-    // can be m_min = -1 and w_min = NOT_VALID which means no possible triangulation between v0-v1
-    W.put(v0,v1, w_min);
-    lambda.put(v0,v1, m_min);
-  }
-
-  // returns [h.first-h.second edge, true if all edges inside 3D triangulation, true if tr.dimension() >= 2]
-  boost::tuple<boost::optional<Edge>, bool, bool>
-  construct_3D_triangulation(const Polyline_3& P,
-                             std::pair<int,int> h,
-                             Triangulation& tr,
-                             std::vector<bool>& edge_exist) const 
-  {
-    // construct 3D tr with P[h.first], P[h.second] also assign ids from h.first to h.second
-    boost::optional<Edge> e;
-    int n_border = h.second - h.first + 1;
-    tr.insert(boost::make_transform_iterator(boost::next(P.begin(), h.first), Auto_count(h.first)),
-              boost::make_transform_iterator(boost::next(P.begin(), h.second +1), Auto_count(h.first)));
-    tr.infinite_vertex()->info() = -1;
-
-    if(tr.dimension() < 2) { return boost::make_tuple(e, false, false); }
-
-    // check whether all edges are included in DT, and get v0-vn-1 edge
-    edge_exist.assign(n_border, false);
-    int nb_exists = 0;
-    Finite_edges_iterator v_first_v_second_edge; // range.first - range.second edge
-    for(Finite_edges_iterator eb = tr.finite_edges_begin();
-        eb != tr.finite_edges_end();
-        ++eb) 
-    {
-      int v0_id = eb->first->vertex(eb->second)->info();
-      int v1_id = eb->first->vertex(eb->third )->info();
-      if(v0_id > v1_id) { std::swap(v0_id, v1_id); }
-
-      // to start from v0 vn-1 edge
-      if(v0_id == h.first && v1_id == h.second) { v_first_v_second_edge = eb; }
-
-      // check whether the edge is border edge
-      int border_id = -1;
-      if(v0_id + 1 == v1_id)                         { border_id = v0_id; }
-      else if(v0_id == h.first && v1_id == h.second) { border_id = v1_id; }
-
-      if(border_id != -1 && !edge_exist[border_id - h.first]) {
-        ++nb_exists;
-        edge_exist[border_id - h.first] = true;
-      }
-    }
-    CGAL_assertion(n_border >= nb_exists);
-
-    bool is_3D_T_complete = (nb_exists == n_border);
-    if(edge_exist[n_border-1]) { e = *v_first_v_second_edge; }
-    return boost::make_tuple(e, is_3D_T_complete, true);
-  }
-
-  /************************************************************************
-  * Try to construct hole part by part.
-  *
-  * What need to be improved:
-  *  + if 3D triangulation does not contain the start-edge (edge between v0 vn-1) we directly switch to all space. 
-  *  + when switched to all-space, we use map based lookup tables.
-  ************************************************************************/
-  Weight fill_by_incomplete_patches(Triangulation& tr,
-                                    boost::optional<Edge> start_edge,
-                                    std::vector<bool>& edge_exist,
-                                    const Polyline_3& P, 
-                                    const Polyline_3& Q,
-                                    Tracer& tracer,
-                                    const WeightCalculator& WC) const
-  {
-    typedef std::pair<int, int> Range;
-    typedef std::back_insert_iterator<std::vector<Range> > Output_hole_iterator;
-    typedef Tracer_polyline_incomplete<boost::tuple<int, int, int>, Emptyset_iterator, Output_hole_iterator> Remaining_holes_tracer;
-    
-    std::vector<Range> remaining_holes;
-    
-    int n_all = P.size()-1;// because the first point and last point are equal
-    remaining_holes.push_back(Range(0, n_all-1)); // corresponds to start_edge 
-
-    LookupTable<Weight> W(n_all, Weight::DEFAULT()); // do not forget that these default values are not changed for [i, i+1]
-    LookupTable<int>    lambda(n_all,-1);
-
-    while(true) {
-      Range h = remaining_holes.back();
-      remaining_holes.pop_back();
-     
-      if(start_edge) {
-        typename IFC_3::Edge_wrapper e(*start_edge);
-        CGAL_assertion(h.first == e.vertex_first() && 
-                       h.second == e.vertex_second()); 
-      }
-
-      if(!start_edge) {
-        // switch to brute force 
-        Triangulate_hole_polyline<Kernel, Tracer, WeightCalculator, LookupTable> all_space;
-        all_space.triangulate_all(P, Q, WC, std::make_pair(h.first, h.second), W, lambda);
-        if(W.get(h.first, h.second) == Weight::NOT_VALID()) {
-          CGAL_warning(!"Returning no output. Filling hole with incomplete patches is not successful!");
-          return Weight::NOT_VALID();
-        }
-      }
-      else {
-        // run the algorithm
-        typename IFC_3::Edge_wrapper e(*start_edge);
-        if(tr.dimension() == 3) 
-        {
-          triangulate_DT<IFC_3>(P, Q, W, lambda, e, tr, WC, true);
-        }
-        else {
-          CGAL_assertion(tr.dimension() == 2);
-          triangulate_DT<IFC_2>(P, Q, W, lambda, e, tr, WC, true);
-        }
-        // check whether there is any improvement (at least we should construct one triangle)
-        if(W.get(h.first, h.second) == Weight::NOT_VALID()) {
-          // switch to brute force 
-          Triangulate_hole_polyline<Kernel, Tracer, WeightCalculator, LookupTable> all_space;
-          all_space.triangulate_all(P, Q, WC, std::make_pair(h.first, h.second), W, lambda);
-          if(W.get(h.first, h.second) == Weight::NOT_VALID()) {
-            CGAL_warning(!"Returning no output. Filling hole with incomplete patches is not successful!");
-            return Weight::NOT_VALID();
-          }
-        }
-        // gather remaining holes
-        Remaining_holes_tracer hole_tracer((Emptyset_iterator()), (Output_hole_iterator(remaining_holes)));
-        hole_tracer(lambda, e.vertex_first(), e.vertex_second());
-      }
-
-      if(remaining_holes.empty()) { break; }
-      // construct tr for next coming hole
-      h = remaining_holes.back();
-      tr.clear();
-      boost::tuple<boost::optional<Edge>, bool, bool> res = construct_3D_triangulation(P, h, tr, edge_exist);
-      if(!boost::get<0>(res)) {
-        CGAL_warning(!"Returning no output. Filling hole with incomplete patches is not successful!");
-        return Weight::NOT_VALID();
-      }
-      start_edge = *boost::get<0>(res);
-      // clear related regions in W, lambda for next coming hole
-      W.set_range_to_default(h.first, h.second);
-      lambda.set_range_to_default(h.first, h.second);
-    }
-    tracer(lambda, 0, n_all-1);
-
-    // W.get(0, n_all -1) is not correct weight (since we do not update weights while we are filling remaining holes), 
-    // we need to recalculate it
-    std::stack<std::pair<int, int> > ranges;
-    ranges.push(std::make_pair(0, n_all-1));
-    Weight total_weight = Weight::DEFAULT();
-    while(!ranges.empty()) {
-      std::pair<int, int> r = ranges.top(); 
-      ranges.pop();
-      if(r.first + 1 == r.second) { continue; }
-      int la = lambda.get(r.first, r.second);
-      total_weight = total_weight + WC(P,Q, r.first,la,r.second, lambda);
-      ranges.push(std::make_pair(r.first, la));
-      ranges.push(std::make_pair(la, r.second));
-    }
-    return total_weight;
-  }
-  
-  /************************************************************************
-   * This approach extends the search space by adding extra triangles.
-   *
-   * + Initial search space is 3D Triangulation.
-   * + For each border edge which is not inside 3DT, we add all possible triangles containing that edge to the search space.
-   *   Example: say border edge [4-5] is not found in 3DT, then triangles = { [0,4,5] [1,4,5] [2,4,5] ... [ n-1,4,5] } 
-   *   are added to the search space.
-   *
-   * I guess this approach does not make the search space complete, since there are some cases that it still returns no patch.
-   ************************************************************************/
-  Weight fill_by_extra_triangles(const Triangulation& tr, 
-                                 const std::vector<bool>& edge_exist,
-                                 const Polyline_3& P, 
-                                 const Polyline_3& Q,
-                                 Tracer& tracer,
-                                 const WeightCalculator& WC) const
-  {
-    int n = static_cast<int>(edge_exist.size());
-    LookupTable<Weight> W(n, Weight::DEFAULT()); // do not forget that these default values are not changed for [i, i+1]
-    LookupTable<int>    lambda(n,-1);
-
-    Edge_graph edge_graph;
-
-    if(tr.dimension() == 3) 
-    { edge_graph.init<IFC_3>(tr, edge_exist); }
-    else 
-    { edge_graph.init<IFC_2>(tr, edge_exist); }
-
-    Edge_graph::Edge_wrapper e_start(std::make_pair(0, n-1));
-    triangulate_DT<Edge_graph::Incident_facet_circulator>
-      (P, Q, W, lambda, e_start, edge_graph, WC, false);
-    
-    if(W.get(0, n-1) == Weight::NOT_VALID()) {
-      #ifndef CGAL_TEST_SUITE
-      CGAL_warning(!"Returning no output. Filling hole with extra triangles is not successful!");
-      #else
-      std::cerr << "W: Returning no output. Filling hole with extra triangles is not successful!\n";
-      #endif
-      return Weight::NOT_VALID();
-    }
-
-    tracer(lambda, 0, n-1);
-    return W.get(0, n-1);
-  }
-}; // End of Triangulate_hole_polyline_DT
-
-/************************************************************************
- * Triangulate hole by using all search space
- ************************************************************************/
-template<
-  class Kernel,
-  class Tracer,
-  class WeightCalculator,
-  template <class> class LookupTable
->
-class Triangulate_hole_polyline {
-public:
-  typedef typename WeightCalculator::Weight  Weight;
-  typedef typename Kernel::Point_3           Point_3;
-  typedef std::vector<Point_3>               Polyline_3;
-
-  Weight operator()(const Polyline_3& P,
-                    const Polyline_3& Q,
-                    Tracer& tracer,
-                    const WeightCalculator& WC) const
-  {
-    CGAL_assertion(P.front() == P.back());
-    CGAL_assertion(Q.empty() || (Q.front() == Q.back()));
-    CGAL_assertion(Q.empty() || (P.size() == Q.size()));
-    
-    int n = static_cast<int>(P.size()) - 1;                       // because the first and last point are equal
-    LookupTable<Weight> W(n,Weight::DEFAULT()); // do not forget that these default values are not changed for [i, i+1]
-    LookupTable<int>    lambda(n,-1);
-    
-    triangulate_all(P, Q, WC, std::make_pair(0,n-1), W, lambda);
-
-    if(W.get(0,n-1) == Weight::NOT_VALID()) {
-      #ifndef CGAL_TEST_SUITE
-      CGAL_warning(!"Returning no output. No possible triangulation is found!");
-      #else
-      std::cerr << "W: Returning no output. No possible triangulation is found!\n";
-      #endif
-      return Weight::NOT_VALID();
-    }
-
-    tracer(lambda, 0, n-1);
-    return W.get(0,n-1);
-  }
-
-  void triangulate_all(const Polyline_3& P,
-                       const Polyline_3& Q,
-                       const WeightCalculator& WC,
-                       std::pair<int, int> range,
-                       LookupTable<Weight>& W, 
-                       LookupTable<int>& lambda) const
-  {
-    for(int j = 2; j<= range.second; ++j) {              // determines range (2 - 3 - 4 )
-      for(int i=range.first; i<= range.second-j; ++i) {  // iterates over ranges and find min triangulation in those ranges 
-        int k = i+j;                                     // like [0-2, 1-3, 2-4, ...], [0-3, 1-4, 2-5, ...]
-
-        int m_min = -1;
-        Weight w_min = Weight::NOT_VALID();
-        // i is the range start (e.g. 1) k is the range end (e.g. 5) -> [1-5]. Now subdivide the region [1-5] with m -> 2,3,4
-        for(int m = i+1; m<k; ++m) { 
-          // now the regions i-m and m-k might be valid(constructed) patches,
-          if( W.get(i,m) == Weight::NOT_VALID() || W.get(m,k) == Weight::NOT_VALID() ) 
-          { continue; }
-
-          const Weight& w_imk = WC(P,Q,i,m,k, lambda);
-          if(w_imk == Weight::NOT_VALID()) 
-          { continue; }
-
-          const Weight& w = W.get(i,m) + W.get(m,k) + w_imk;
-          if(m_min == -1 || w < w_min) {
-            w_min = w;
-            m_min = m;
-          }
-        }
-
-        // can be m_min = -1 and w_min = NOT_VALID which means no possible triangulation between i-k
-        W.put(i,k,w_min);
-        lambda.put(i,k, m_min);
-      }
-    }
-  }
-};
-
-/***********************************************************************************
- * Internal entry point for both polyline and Polyhedron_3 triangulation functions
- ***********************************************************************************/
-template <
-  typename PointRange1,
-  typename PointRange2,
-  typename Tracer,
-  typename WeightCalculator,
-  typename Kernel
->
-typename WeightCalculator::Weight
-triangulate_hole_polyline(const PointRange1& points,
-                          const PointRange2& third_points,
-                          Tracer& tracer,
-                          const WeightCalculator& WC,
-                          bool use_delaunay_triangulation,
-                          const Kernel&)
-{
-  typedef Kernel        K;
-  typedef typename K::Point_3    Point_3;
-  typedef CGAL::internal::Triangulate_hole_polyline_DT<K, Tracer, WeightCalculator> Fill_DT;
-  typedef CGAL::internal::Triangulate_hole_polyline<K, Tracer, WeightCalculator>    Fill;
-
-  std::vector<Point_3> P(boost::begin(points), boost::end(points));
-  std::vector<Point_3> Q(boost::begin(third_points), boost::end(third_points));
-
-  if(P.front() != P.back()){
-    P.push_back(P.front());
-    if( !Q.empty() && P.size() > Q.size()) {
-      Q.push_back(Q.front());
-    }
-  }
-
-  typename WeightCalculator::Weight w = use_delaunay_triangulation ?
-    Fill_DT().operator()(P,Q,tracer,WC) :
-    Fill().operator()(P,Q,tracer,WC);
-  CGAL_TRACE_STREAM << w << std::endl;
-  return w;
-}
-
-} // namespace internal
-
-} // namespace CGAL
-
-#endif // CGAL_HOLE_FILLING_TRIANGULATE_HOLE_POLYLINE_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/AABB_filtered_projection_traits.h b/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/AABB_filtered_projection_traits.h
deleted file mode 100644
index 4ea6bca..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/AABB_filtered_projection_traits.h
+++ /dev/null
@@ -1,134 +0,0 @@
-// Copyright (c) 2008-2009  INRIA Sophia-Antipolis (France), ETH Zurich (Switzerland).
-// Copyright (c) 2010  GeometryFactory Sarl (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
-// 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(s) : Camille Wormser, Pierre Alliez, Stephane Tayeb, Laurent Rineau
-//
-// File adapted from <CGAL/internal/AABB_tree/AABB_traversal_traits.h>
-//
-
-#ifndef CGAL_AABB_FILTERED_PROJECTION_TRAITS_H
-#define CGAL_AABB_FILTERED_PROJECTION_TRAITS_H
-
-#include <CGAL/internal/boost/property_map.h>
-
-#include <CGAL/AABB_tree.h>
-#include <CGAL/internal/AABB_tree/AABB_node.h>
-#include <CGAL/internal/AABB_tree/Primitive_helper.h>
-
-namespace CGAL {
-namespace Polygon_mesh_processing {
-namespace internal {
-
-/**
- * @class Projection_traits
- */
-template <typename AABBTraits,
-          typename IndexPropertyMap,
-          bool keep = false>
-class Filtered_projection_traits
-{
-  typedef typename AABBTraits::FT FT;
-  typedef typename AABBTraits::Point_3 Point_3;
-  typedef typename AABBTraits::Primitive Primitive;
-  typedef typename AABBTraits::Bounding_box Bounding_box;
-  typedef typename AABBTraits::Primitive::Id Primitive_id;
-  typedef typename AABBTraits::Point_and_primitive_id Point_and_primitive_id;
-  typedef typename AABBTraits::Object_and_primitive_id Object_and_primitive_id;
-  typedef ::CGAL::AABB_node<AABBTraits> Node;
-  typedef typename ::CGAL::AABB_tree<AABBTraits>::size_type size_type;
-
-  typedef typename boost::property_traits<IndexPropertyMap>::value_type Index_type;
-
-  typedef std::set<typename boost::remove_const<Index_type>::type> Set_of_indices;
-
-public:
-  template <typename IndexToIgnoreIterator>
-  Filtered_projection_traits(IndexToIgnoreIterator begin,
-                             IndexToIgnoreIterator end,
-                             const AABBTraits& aabb_traits,
-                             IndexPropertyMap index_map = IndexPropertyMap())
-    : m_closest_point_initialized(false),
-      set_of_indices(begin, end),
-      aabb_traits(aabb_traits),
-      index_map(index_map)
-  {
-  }
-
-  Filtered_projection_traits(Index_type index,
-                             const AABBTraits& aabb_traits,
-                             IndexPropertyMap index_map = IndexPropertyMap())
-    : m_closest_point_initialized(false),
-      set_of_indices(),
-      aabb_traits(aabb_traits),
-      index_map(index_map)
-  {
-    set_of_indices.insert(index);
-  }
-
-  bool go_further() const { return true; }
-
-  void intersection(const Point_3& query, const Primitive& primitive)
-  {
-    const Index_type& id = get(index_map, primitive.id());
-
-    if(keep != (set_of_indices.count(id) > 0)) return;
-    if(!m_closest_point_initialized) {
-      typedef CGAL::internal::Primitive_helper<AABBTraits> Helper;
-      m_closest_point = Helper::get_reference_point(primitive, aabb_traits);
-      m_closest_primitive = primitive.id();
-      m_closest_point_initialized = true;
-    }
-    Point_3 new_closest_point = aabb_traits.closest_point_object()
-      (query, primitive, m_closest_point);
-    if(new_closest_point != m_closest_point)
-    {
-      m_closest_primitive = primitive.id();
-      m_closest_point = new_closest_point; // this effectively shrinks the sphere
-    }
-  }
-
-  bool do_intersect(const Point_3& query, const Node& node) const
-  {
-    if(!m_closest_point_initialized) return true;
-    return AABBTraits().compare_distance_object()
-      (query, node.bbox(), m_closest_point) == CGAL::SMALLER;
-  }
-
-  bool found() { return m_closest_point_initialized; };
-
-  Point_3 closest_point() const { return m_closest_point; }
-  Point_and_primitive_id closest_point_and_primitive() const
-  {
-    return Point_and_primitive_id(m_closest_point, m_closest_primitive);
-  }
-
-private:
-  Point_3 m_closest_point;
-  typename Primitive::Id m_closest_primitive;
-  bool m_closest_point_initialized;
-  Set_of_indices set_of_indices;
-  const AABBTraits& aabb_traits;
-  IndexPropertyMap index_map;
-}; // end Filtered_projection_traits
-
-} // end namespace internal
-} // end namespace Polygon_mesh_processing
-} // end namespace CGAL
-
-#endif // CGAL_MESH_3_AABB_FILTERED_PROJECTION_TRAITS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h b/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h
deleted file mode 100644
index 684cc59..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h
+++ /dev/null
@@ -1,1613 +0,0 @@
-// Copyright (c) 2015 GeometryFactory (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Jane Tournois
-
-#ifndef CGAL_POLYGON_MESH_PROCESSING_REMESH_IMPL_H
-#define CGAL_POLYGON_MESH_PROCESSING_REMESH_IMPL_H
-
-#include <CGAL/Polygon_mesh_processing/compute_normal.h>
-#include <CGAL/Polygon_mesh_processing/border.h>
-#include <CGAL/Polygon_mesh_processing/repair.h>
-#include <CGAL/Polygon_mesh_processing/measure.h>
-#include <CGAL/Polygon_mesh_processing/connected_components.h>
-
-#include <CGAL/AABB_tree.h>
-#include <CGAL/AABB_traits.h>
-#include <CGAL/AABB_triangle_primitive.h>
-
-#include <CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/AABB_filtered_projection_traits.h>
-
-#include <CGAL/property_map.h>
-#include <CGAL/iterator.h>
-#include <CGAL/boost/graph/Euler_operations.h>
-#include <boost/graph/graph_traits.hpp>
-#include <boost/foreach.hpp>
-
-#include <boost/bimap.hpp>
-#include <boost/bimap/multiset_of.hpp>
-#include <boost/bimap/set_of.hpp>
-#include <boost/property_map/property_map.hpp>
-#include <boost/range.hpp>
-#include <boost/unordered_map.hpp>
-#include <boost/unordered_set.hpp>
-#include <boost/shared_ptr.hpp>
-
-#include <map>
-#include <list>
-#include <vector>
-#include <iterator>
-#include <fstream>
-
-#ifdef CGAL_PMP_REMESHING_DEBUG
-#include <CGAL/Polygon_mesh_processing/self_intersections.h>
-#define CGAL_DUMP_REMESHING_STEPS
-#endif
-
-#ifdef CGAL_PMP_REMESHING_VERY_VERBOSE
-#define CGAL_PMP_REMESHING_VERBOSE
-#endif
-
-
-
-
-
-namespace CGAL {
-
-namespace PMP = Polygon_mesh_processing;
-
-namespace Polygon_mesh_processing {
-namespace internal {
-
-  enum Halfedge_status {
-    PATCH,       //h and hopp belong to the patch to be remeshed
-    PATCH_BORDER,//h belongs to the patch, hopp is MESH
-    MESH,        //h and hopp belong to the mesh, not the patch
-    MESH_BORDER  //h belongs to the mesh, face(hopp, pmesh) == null_face()
-  };
-
-  // A property map
-  template<typename Descriptor>
-  struct No_constraint_pmap
-  {
-  public:
-    typedef Descriptor                          key_type;
-    typedef bool                                value_type;
-    typedef value_type&                         reference;
-    typedef boost::read_write_property_map_tag  category;
-
-    friend bool get(const No_constraint_pmap& , const key_type& ) {
-      return false;
-    }
-    friend void put(No_constraint_pmap& , const key_type& , const bool ) {}
-  };
-
-  template <typename PM, typename FaceRange>
-  struct Border_constraint_pmap
-  {
-    typedef typename boost::graph_traits<PM>::halfedge_descriptor halfedge_descriptor;
-    typedef typename boost::graph_traits<PM>::edge_descriptor edge_descriptor;
-
-    boost::shared_ptr< std::set<edge_descriptor> > border_edges_ptr;
-    const PM* pmesh_ptr_;
-
-  public:
-    typedef edge_descriptor                     key_type;
-    typedef bool                                value_type;
-    typedef value_type&                         reference;
-    typedef boost::read_write_property_map_tag  category;
-
-    Border_constraint_pmap()
-      : border_edges_ptr(new std::set<edge_descriptor>() )
-      , pmesh_ptr_(NULL)
-    {}
-    Border_constraint_pmap(const PM& pmesh, const FaceRange& faces)
-      : border_edges_ptr(new std::set<edge_descriptor>() )
-      , pmesh_ptr_(&pmesh)
-    {
-      std::vector<halfedge_descriptor> border;
-      PMP::border_halfedges(faces, *pmesh_ptr_, std::back_inserter(border));
-
-      BOOST_FOREACH(halfedge_descriptor h, border)
-        border_edges_ptr->insert(edge(h, *pmesh_ptr_));
-    }
-
-    friend bool get(const Border_constraint_pmap<PM, FaceRange>& map,
-                    const edge_descriptor& e)
-    {
-      CGAL_assertion(map.pmesh_ptr_!=NULL);
-      return map.border_edges_ptr->count(e)!=0;
-    }
-
-    friend void put(Border_constraint_pmap<PM, FaceRange>& map,
-                    const edge_descriptor& e,
-                    const bool is)
-    {
-      CGAL_assertion(map.pmesh_ptr_ != NULL);
-      if (is)
-        map.border_edges_ptr->insert(e);
-      else
-        map.border_edges_ptr->erase(e);
-    }
-  };
-
-  template<typename PM,
-           typename EdgeConstraintMap,
-           typename VertexPointMap>
-  bool constraints_are_short_enough(const PM& pmesh,
-                                    EdgeConstraintMap ecmap,
-                                    VertexPointMap vpmap,
-                                    const double& high)
-  {
-    double sqh = high*high;
-    typedef typename boost::graph_traits<PM>::halfedge_descriptor halfedge_descriptor;
-    typedef typename boost::graph_traits<PM>::edge_descriptor     edge_descriptor;
-    BOOST_FOREACH(edge_descriptor e, edges(pmesh))
-    {
-      if (get(ecmap, e))
-      {
-        halfedge_descriptor h = halfedge(e, pmesh);
-        if (sqh < CGAL::squared_distance(get(vpmap, source(h, pmesh)),
-                                         get(vpmap, target(h, pmesh))))
-        {
-          return false;
-        }
-      }
-    }
-    return true;
-  }
-
-  template<typename PolygonMesh
-         , typename VertexPointMap
-         , typename GeomTraits
-         , typename EdgeIsConstrainedMap = No_constraint_pmap<
-              typename boost::graph_traits<PolygonMesh>::edge_descriptor>
-         , typename VertexIsConstrainedMap = No_constraint_pmap<
-              typename boost::graph_traits<PolygonMesh>::vertex_descriptor>
-  >
-  class Incremental_remesher
-  {
-    typedef PolygonMesh PM;
-    typedef typename boost::graph_traits<PM>::halfedge_descriptor halfedge_descriptor;
-    typedef typename boost::graph_traits<PM>::edge_descriptor     edge_descriptor;
-    typedef typename boost::graph_traits<PM>::vertex_descriptor   vertex_descriptor;
-    typedef typename boost::graph_traits<PM>::face_descriptor     face_descriptor;
-
-    typedef typename GeomTraits::Point_3    Point;
-    typedef typename GeomTraits::Vector_3   Vector_3;
-    typedef typename GeomTraits::Plane_3    Plane_3;
-    typedef typename GeomTraits::Triangle_3 Triangle_3;
-
-    typedef Incremental_remesher<PM, VertexPointMap
-                               , GeomTraits
-                               , EdgeIsConstrainedMap
-                               , VertexIsConstrainedMap
-                               > Self;
-
-  private:
-    typedef std::size_t                                  Patch_id;
-    typedef std::vector<Triangle_3>                      Triangle_list;
-    typedef std::vector<Patch_id>                        Patch_id_list;
-
-    typedef CGAL::AABB_triangle_primitive<GeomTraits,
-                     typename Triangle_list::iterator>    AABB_primitive;
-    typedef CGAL::AABB_traits<GeomTraits, AABB_primitive> AABB_traits;
-    typedef CGAL::AABB_tree<AABB_traits>                  AABB_tree;
-
-  public:
-    Incremental_remesher(PolygonMesh& pmesh
-                       , VertexPointMap& vpmap
-                       , const bool protect_constraints
-                       , EdgeIsConstrainedMap ecmap = EdgeIsConstrainedMap()
-                       , VertexIsConstrainedMap vcmap = VertexIsConstrainedMap()
-                       , const bool own_tree = true)//built by the remesher
-      : mesh_(pmesh)
-      , vpmap_(vpmap)
-      , own_tree_(own_tree)
-      , input_triangles_()
-      , input_patch_ids_()
-      , halfedge_status_map_()
-      , protect_constraints_(protect_constraints)
-      , patch_ids_map_()
-      , ecmap_(ecmap)
-      , vcmap_(vcmap)
-    {
-      CGAL_assertion(CGAL::is_triangle_mesh(mesh_));
-    }
-
-    ~Incremental_remesher()
-    {
-      if (own_tree_)
-        delete tree_ptr_;
-    }
-    
-    template<typename FaceRange>
-    void init_remeshing(const FaceRange& face_range)
-    {
-      tag_halfedges_status(face_range); //called first
-      Constraint_property_map cpmap(*this);
-
-      //build AABB tree of input surface
-      PMP::connected_components(mesh_,
-        boost::make_assoc_property_map(patch_ids_map_),// set patch_id() for each face
-        PMP::parameters::edge_is_constrained_map(cpmap));
-
-      BOOST_FOREACH(face_descriptor f, face_range)
-      {
-        input_triangles_.push_back(triangle(f));
-        input_patch_ids_.push_back(get_patch_id(f));
-      }
-      CGAL_assertion(input_triangles_.size() == input_patch_ids_.size());
-
-      tree_ptr_ = new AABB_tree(input_triangles_.begin(),
-                                input_triangles_.end());
-      tree_ptr_->accelerate_distance_queries();
-    }
-
-    // split edges of edge_range that have their length > high
-    template<typename EdgeRange>
-    void split_long_edges(const EdgeRange& edge_range,
-                          const double& high)
-    {
-      typedef boost::bimap<
-        boost::bimaps::set_of<halfedge_descriptor>,
-        boost::bimaps::multiset_of<double, std::greater<double> > >  Boost_bimap;
-      typedef typename Boost_bimap::value_type                       long_edge;
-
-#ifdef CGAL_PMP_REMESHING_VERBOSE
-      std::cout << "Split long edges (" << high << ")...";
-      std::cout.flush();
-#endif
-      double sq_high = high*high;
-
-      //collect long edges
-      Boost_bimap long_edges;
-      BOOST_FOREACH(edge_descriptor e, edge_range)
-      {
-        double sqlen = sqlength(e);
-        if (sqlen > sq_high)
-        {
-          long_edges.insert(long_edge(halfedge(e, mesh_), sqlen));
-          put(ecmap_, e, false);
-        }
-        else
-          put(ecmap_, e, true);
-      }
-
-      //split long edges
-      unsigned int nb_splits = 0;
-      while (!long_edges.empty())
-      {
-        //the edge with longest length
-        typename Boost_bimap::right_map::iterator eit = long_edges.right.begin();
-        halfedge_descriptor he = eit->second;
-        double sqlen = eit->first;
-        long_edges.right.erase(eit);
-
-        //split edge
-        Point refinement_point = this->midpoint(he);
-        halfedge_descriptor hnew = CGAL::Euler::split_edge(he, mesh_);
-        CGAL_assertion(he == next(hnew, mesh_));
-        ++nb_splits;
-
-        //move refinement point
-        vertex_descriptor vnew = target(hnew, mesh_);
-        put(vpmap_, vnew, refinement_point);
-#ifdef CGAL_PMP_REMESHING_VERY_VERBOSE
-        std::cout << "   refinement point : " << refinement_point << std::endl;
-#endif
-
-        //check sub-edges
-        double sqlen_new = 0.25 * sqlen;
-        if (sqlen_new > sq_high)
-        {
-          //if it was more than twice the "long" threshold, insert them
-          long_edges.insert(long_edge(hnew, sqlen_new));
-          long_edges.insert(long_edge(next(hnew, mesh_), sqlen_new));
-        }
-        else
-        {
-          put(ecmap_, edge(hnew, mesh_), true);
-          put(ecmap_, edge(next(hnew, mesh_), mesh_), true);
-        }
-
-        //insert new edges to keep triangular faces, and update long_edges
-        if (!is_border(hnew, mesh_))
-        {
-          CGAL::Euler::split_face(hnew, next(next(hnew, mesh_), mesh_), mesh_);
-        }
-
-        //do it again on the other side if we're not on boundary
-        halfedge_descriptor hnew_opp = opposite(hnew, mesh_);
-        if (!is_border(hnew_opp, mesh_))
-        {
-          CGAL::Euler::split_face(prev(hnew_opp, mesh_), next(hnew_opp, mesh_), mesh_);
-        }
-      }
-#ifdef CGAL_PMP_REMESHING_VERBOSE
-      std::cout << " done (" << nb_splits << " splits)." << std::endl;
-#endif
-#ifdef CGAL_DUMP_REMESHING_STEPS
-      dump("0-border_split.off");
-#endif
-    }
-
-    // PMP book :
-    // "visits all edges of the mesh
-    //if an edge is longer than the given threshold `high`, the edge
-    //is split at its midpoint and the two adjacent triangles are bisected (2-4 split)"
-    void split_long_edges(const double& high)
-    {
-      typedef boost::bimap<
-        boost::bimaps::set_of<halfedge_descriptor>,
-        boost::bimaps::multiset_of<double, std::greater<double> > >  Boost_bimap;
-      typedef typename Boost_bimap::value_type                       long_edge;
-
-#ifdef CGAL_PMP_REMESHING_VERBOSE
-      std::cout << "Split long edges (" << high << ")..." << std::endl;
-#endif
-      double sq_high = high*high;
-
-      //collect long edges
-      Boost_bimap long_edges;
-      BOOST_FOREACH(edge_descriptor e, edges(mesh_))
-      {
-        if (!is_split_allowed(e))
-          continue;
-        double sqlen = sqlength(e);
-        if(sqlen > sq_high)
-          long_edges.insert(long_edge(halfedge(e, mesh_), sqlen));
-      }
-
-      //split long edges
-      unsigned int nb_splits = 0;
-      while (!long_edges.empty())
-      {
-        //the edge with longest length
-        typename Boost_bimap::right_map::iterator eit = long_edges.right.begin();
-        halfedge_descriptor he = eit->second;
-        double sqlen = eit->first;
-        long_edges.right.erase(eit);
-
-#ifdef CGAL_PMP_REMESHING_VERBOSE
-        std::cout << "\r\t(" << long_edges.left.size() << " long edges, ";
-        std::cout << nb_splits << " splits)";
-        std::cout.flush();
-#endif
-
-        if (protect_constraints_ && !is_longest_on_faces(edge(he, mesh_)))
-          continue;
-
-        //split edge
-        Point refinement_point = this->midpoint(he);
-        halfedge_descriptor hnew = CGAL::Euler::split_edge(he, mesh_);
-        CGAL_assertion(he == next(hnew, mesh_));
-        ++nb_splits;
-
-        //move refinement point
-        vertex_descriptor vnew = target(hnew, mesh_);
-        put(vpmap_, vnew, refinement_point);
-#ifdef CGAL_PMP_REMESHING_VERY_VERBOSE
-        std::cout << "   Refinement point : " << refinement_point << std::endl;
-#endif
-
-        //after splitting
-        halfedge_descriptor hnew_opp = opposite(hnew, mesh_);
-        halfedge_added(hnew, status(he));
-        halfedge_added(hnew_opp, status(opposite(he, mesh_)));
-
-        //check sub-edges
-        double sqlen_new = 0.25 * sqlen;
-        if (sqlen_new > sq_high)
-        {
-          //if it was more than twice the "long" threshold, insert them
-          long_edges.insert(long_edge(hnew,              sqlen_new));
-          long_edges.insert(long_edge(next(hnew, mesh_), sqlen_new));
-        }
-
-        //insert new edges to keep triangular faces, and update long_edges
-        if (!is_on_border(hnew))
-        {
-          Patch_id patch_id = get_patch_id(face(hnew, mesh_));
-          halfedge_descriptor hnew2 = CGAL::Euler::split_face(hnew,
-                                                              next(next(hnew, mesh_), mesh_),
-                                                              mesh_);
-          Halfedge_status snew = (is_on_patch(hnew) || is_on_patch_border(hnew))
-            ? PATCH
-            : MESH;
-          halfedge_added(hnew2,                  snew);
-          halfedge_added(opposite(hnew2, mesh_), snew);
-          set_patch_id(face(hnew2, mesh_), patch_id);
-          set_patch_id(face(opposite(hnew2, mesh_), mesh_), patch_id);
-
-          if (snew == PATCH)
-          {
-            double sql = sqlength(hnew2);
-            if (sql > sq_high)
-              long_edges.insert(long_edge(hnew2, sql));
-          }
-        }
-
-        //do it again on the other side if we're not on boundary
-        if (!is_on_border(hnew_opp))
-        {
-          Patch_id patch_id = get_patch_id(face(hnew_opp, mesh_));
-          halfedge_descriptor hnew2 = CGAL::Euler::split_face(prev(hnew_opp, mesh_),
-                                                              next(hnew_opp, mesh_),
-                                                              mesh_);
-          Halfedge_status snew = (is_on_patch(hnew_opp) || is_on_patch_border(hnew_opp))
-             ? PATCH
-            : MESH;
-          halfedge_added(hnew2,                  snew);
-          halfedge_added(opposite(hnew2, mesh_), snew);
-          set_patch_id(face(hnew2, mesh_), patch_id);
-          set_patch_id(face(opposite(hnew2, mesh_), mesh_), patch_id);
-
-          if (snew == PATCH)
-          {
-            double sql = sqlength(hnew2);
-            if (sql > sq_high)
-              long_edges.insert(long_edge(hnew2, sql));
-          }
-        }
-      }
-#ifdef CGAL_PMP_REMESHING_VERBOSE
-      std::cout << " done ("<< nb_splits << " splits)." << std::endl;
-#endif
-
-#ifdef CGAL_PMP_REMESHING_DEBUG
-      CGAL_expensive_assertion(is_triangle_mesh(mesh_));
-      CGAL_assertion(halfedge_status_map_.size() == nb_valid_halfedges());
-      debug_status_map();
-      debug_self_intersections();
-#endif
-
-#ifdef CGAL_DUMP_REMESHING_STEPS
-      dump("1-edge_split.off");
-#endif
-    }
-
-    // PMP book :
-    // "collapses and thus removes all edges that are shorter than a
-    // threshold `low`. [...] testing before each collapse whether the collapse
-    // would produce an edge that is longer than `high`"
-    void collapse_short_edges(const double& low, const double& high)
-    {
-      typedef boost::bimap<
-        boost::bimaps::set_of<halfedge_descriptor>,
-        boost::bimaps::multiset_of<double, std::less<double> > >  Boost_bimap;
-      typedef typename Boost_bimap::value_type                    short_edge;
-
-#ifdef CGAL_PMP_REMESHING_VERBOSE
-      std::cout << "Collapse short edges (" << low << ", " << high << ")..."
-                << std::endl;
-#endif
-      double sq_low = low*low;
-      double sq_high = high*high;
-
-      Boost_bimap short_edges;
-      BOOST_FOREACH(edge_descriptor e, edges(mesh_))
-      {
-        if (!is_collapse_allowed(e))
-          continue;
-        double sqlen = sqlength(e);
-        if (sqlen < sq_low)
-          short_edges.insert(short_edge(halfedge(e, mesh_), sqlen));
-      }
-
-      unsigned int nb_collapses = 0;
-      while (!short_edges.empty())
-      {
-        //the edge with shortest length
-        typename Boost_bimap::right_map::iterator eit = short_edges.right.begin();
-        halfedge_descriptor he = eit->second;
-        short_edges.right.erase(eit);
-
-#ifdef CGAL_PMP_REMESHING_VERBOSE
-        std::cout << "\r\t(" << short_edges.left.size() << " short edges, ";
-        std::cout << nb_collapses << " collapses)";
-        std::cout.flush();
-#endif
-
-        //handle the boundary case :
-        //a PATCH_BORDER edge can be collapsed,
-        //and an edge incident to PATCH_BORDER can be collapsed,
-        //but only if the boundary vertex is kept,
-        //so re-insert opposite(he) to collapse it
-        if (!is_on_patch(he))
-        {
-          CGAL_assertion(!protect_constraints_);//is_collapse_allowed returned false
-          if (is_on_border(he) || is_on_mesh(he))
-          {
-            he = opposite(he, mesh_); //he now is PATCH_BORDER
-            CGAL_assertion(is_on_patch_border(he));
-          }
-        }//end if(not on PATCH)
-
-        //let's try to collapse he into vb
-        vertex_descriptor va = source(he, mesh_);
-        vertex_descriptor vb = target(he, mesh_);
-
-        if (is_on_patch_border(va) && !is_on_patch_border(vb))
-        {
-          he = opposite(he, mesh_);
-          va = source(he, mesh_);
-          vb = target(he, mesh_);
-          CGAL_assertion(is_on_patch_border(vb) && !is_on_patch_border(va));
-        }
-        else if (is_on_patch(va) && is_on_patch(vb))
-        {
-          if(!collapse_does_not_invert_face(he))
-          {
-            if (collapse_does_not_invert_face(opposite(he, mesh_)))
-            {
-              he = opposite(he, mesh_);
-              va = source(he, mesh_);
-              vb = target(he, mesh_);
-            }
-            else
-              continue;//both directions invert a face
-          }
-          CGAL_assertion(collapse_does_not_invert_face(he));
-        }
-
-        CGAL_assertion(is_collapse_allowed(edge(he, mesh_)));
-
-        if (degree(va, mesh_) < 3
-          || degree(vb, mesh_) < 3
-          || !CGAL::Euler::does_satisfy_link_condition(edge(he, mesh_), mesh_))//necessary to collapse
-          continue;
-
-        //check that collapse would not create an edge with length > high
-        //iterate on vertices va_i of the one-ring of va
-        bool collapse_ok = true;
-        BOOST_FOREACH(halfedge_descriptor ha, halfedges_around_target(va, mesh_))
-        {
-          vertex_descriptor va_i = source(ha, mesh_);
-          if (sqlength(vb, va_i) > sq_high)
-          {
-            collapse_ok = false;
-            break;
-          }
-        }
-        //before collapsing va into vb, check that it does not break a corner
-        //if it is allowed, perform the collapse
-        if (collapse_ok && !is_constrained(va) && !is_corner(va))
-        {
-          //"collapse va into vb along e"
-          // remove edges incident to va and vb, because their lengths will change
-          BOOST_FOREACH(halfedge_descriptor ha, halfedges_around_target(va, mesh_))
-          {
-            short_edges.left.erase(ha);
-            short_edges.left.erase(opposite(ha, mesh_));
-          }
-          BOOST_FOREACH(halfedge_descriptor hb, halfedges_around_target(vb, mesh_))
-          {
-            short_edges.left.erase(hb);
-            short_edges.left.erase(opposite(hb, mesh_));
-          }
-
-          //before collapse
-          bool mesh_border_case     = is_on_border(opposite(he, mesh_));
-          halfedge_descriptor ep_p  = prev(opposite(he, mesh_), mesh_);
-          halfedge_descriptor epo_p = opposite(ep_p, mesh_);
-          halfedge_descriptor en    = next(he, mesh_);
-          halfedge_descriptor en_p  = next(opposite(he, mesh_), mesh_);
-          Halfedge_status s_ep_p    = status(ep_p);
-          Halfedge_status s_epo_p   = status(epo_p);
-          Halfedge_status s_ep      = status(prev(he, mesh_));
-          Halfedge_status s_epo     = status(opposite(prev(he, mesh_), mesh_));
-
-          // merge halfedge_status to keep the more important on both sides
-          //do it before collapse is performed to be sure everything is valid
-          merge_status(en, s_epo, s_ep);
-          if (!mesh_border_case)
-            merge_status(en_p, s_epo_p, s_ep_p);
-
-          if (!mesh_border_case)
-            halfedge_and_opp_removed(prev(opposite(he, mesh_), mesh_));
-          halfedge_and_opp_removed(he);
-          halfedge_and_opp_removed(prev(he, mesh_));
-
-          //perform collapse
-          Point target_point = get(vpmap_, vb);
-          vertex_descriptor vkept = CGAL::Euler::collapse_edge(edge(he, mesh_), mesh_);
-          put(vpmap_, vkept, target_point);
-          ++nb_collapses;
-
-          fix_degenerate_faces(vkept, short_edges, sq_low);
-
-#ifdef CGAL_PMP_REMESHING_DEBUG
-          CGAL_assertion_code(std::size_t nbb = nb_valid_halfedges());
-          CGAL_assertion(nbb == halfedge_status_map_.size());
-          debug_status_map();
-          CGAL_assertion(!incident_to_degenerate(halfedge(vkept, mesh_)));
-#endif
-
-          //insert new/remaining short edges
-          BOOST_FOREACH(halfedge_descriptor ht, halfedges_around_target(vkept, mesh_))
-          {
-            if (!is_collapse_allowed(edge(ht, mesh_)))
-              continue;
-            double sqlen = sqlength(ht);
-            if (sqlen < sq_low)
-              short_edges.insert(short_edge(ht, sqlen));
-          }
-        }//end if(collapse_ok)
-      }
-
-#ifdef CGAL_PMP_REMESHING_VERBOSE
-      std::cout << " done (" << nb_collapses << " collapses)." << std::endl;
-#endif
-
-#ifdef CGAL_DUMP_REMESHING_STEPS
-      dump("2-edge_collapse.off");
-#endif
-
-#ifdef CGAL_PMP_REMESHING_DEBUG
-      CGAL_assertion(nb_valid_halfedges() == halfedge_status_map_.size());
-      CGAL_expensive_assertion(is_triangle_mesh(mesh_));
-      debug_status_map();
-      debug_self_intersections();
-      CGAL_assertion(0 == PMP::remove_degenerate_faces(mesh_,
-        PMP::parameters::vertex_point_map(vpmap_).geom_traits(GeomTraits())));
-#endif
-    }
-
-    // PMP book :
-    // "equalizes the vertex valences by flipping edges.
-    // The target valence is 6 and 4 for interior and boundary vertices, resp.
-    // The algo. tentatively flips each edge `e` and checks whether the deviation
-    // to the target valences decreases. If not, the edge is flipped back"
-    void equalize_valences()
-    {
-#ifdef CGAL_PMP_REMESHING_VERBOSE
-      std::cout << "Equalize valences..." << std::endl;
-#endif
-      unsigned int nb_flips = 0;
-      BOOST_FOREACH(edge_descriptor e, edges(mesh_))
-      {
-        //only the patch edges are allowed to be flipped
-        halfedge_descriptor he = halfedge(e, mesh_);
-        if (!is_on_patch(he))
-          continue;
-
-        vertex_descriptor va = source(he, mesh_);
-        vertex_descriptor vb = target(he, mesh_);
-        vertex_descriptor vc = target(next(he, mesh_), mesh_);
-        vertex_descriptor vd = target(next(opposite(he, mesh_), mesh_), mesh_);
-
-        int deviation_pre = CGAL::abs(valence(va) - target_valence(va))
-                          + CGAL::abs(valence(vb) - target_valence(vb))
-                          + CGAL::abs(valence(vc) - target_valence(vc))
-                          + CGAL::abs(valence(vd) - target_valence(vd));
-
-        CGAL_assertion_code(Halfedge_status s1 = status(he));
-        CGAL_assertion_code(Halfedge_status s1o = status(opposite(he, mesh_)));
-
-        CGAL::Euler::flip_edge(he, mesh_);
-        ++nb_flips;
-
-#ifdef CGAL_PMP_REMESHING_VERBOSE
-        std::cout << "\r\t(" << nb_flips << " flips)";
-        std::cout.flush();
-#endif
-        CGAL_assertion_code(Halfedge_status s2 = status(he));
-        CGAL_assertion_code(Halfedge_status s2o = status(opposite(he, mesh_)));
-        CGAL_assertion(s1 == s2   && s1 == PATCH);
-        CGAL_assertion(s1o == s2o && s1o == PATCH);
-        CGAL_assertion(nb_valid_halfedges() == halfedge_status_map_.size());
-        CGAL_assertion(!is_border(he, mesh_));
-
-        CGAL_assertion(
-             (vc == target(he, mesh_) && vd == source(he, mesh_))
-          || (vd == target(he, mesh_) && vc == source(he, mesh_)));
-
-        int deviation_post = CGAL::abs(valence(va) - target_valence(va))
-                          + CGAL::abs(valence(vb) - target_valence(vb))
-                          + CGAL::abs(valence(vc) - target_valence(vc))
-                          + CGAL::abs(valence(vd) - target_valence(vd));
-
-        //check that mesh does not become non-triangle,
-        //nor has inverted faces
-        if (deviation_pre <= deviation_post
-          || !check_normals(he)
-          || incident_to_degenerate(he)
-          || incident_to_degenerate(opposite(he, mesh_))
-          || !is_on_triangle(he)
-          || !is_on_triangle(opposite(he, mesh_))
-          || !check_normals(target(he, mesh_))
-          || !check_normals(source(he, mesh_)))
-        {
-          CGAL::Euler::flip_edge(he, mesh_);
-          --nb_flips;
-
-          CGAL_assertion_code(Halfedge_status s3 = status(he));
-          CGAL_assertion(s1 == s3);
-          CGAL_assertion(!is_border(he, mesh_));
-          CGAL_assertion(
-               (va == source(he, mesh_) && vb == target(he, mesh_))
-            || (vb == source(he, mesh_) && va == target(he, mesh_)));
-        }
-      }
-
-#ifdef CGAL_PMP_REMESHING_VERBOSE
-      std::cout << "\r\tdone ("<< nb_flips << " flips)" << std::endl;
-#endif
-
-#ifdef CGAL_PMP_REMESHING_DEBUG
-      CGAL_assertion(nb_valid_halfedges() == halfedge_status_map_.size());
-      debug_status_map();
-      CGAL_assertion(0 == PMP::remove_degenerate_faces(mesh_
-                            , PMP::parameters::vertex_point_map(vpmap_)
-                            .geom_traits(GeomTraits())));
-      debug_self_intersections();
-#endif
-
-#ifdef CGAL_DUMP_REMESHING_STEPS
-      dump("3-edge_flips.off");
-#endif
-    }
-
-    // PMP book :
-    // "applies an iterative smoothing filter to the mesh.
-    // The vertex movement has to be constrained to the vertex tangent plane [...]
-    // smoothing algorithm with uniform Laplacian weights"
-    void tangential_relaxation(const bool smooth_along_features/*1d smoothing*/)
-    {
-      //todo : move border vertices along 1-dimensional features
-#ifdef CGAL_PMP_REMESHING_VERBOSE
-      std::cout << "Tangential relaxation...";
-      std::cout.flush();
-#endif
-
-      //todo : use boost::vector_property_map to improve computing time
-      typedef std::map<vertex_descriptor, Vector_3> VNormalsMap;
-      VNormalsMap vnormals;
-      boost::associative_property_map<VNormalsMap> propmap_normals(vnormals);
-      std::map<vertex_descriptor, Point> barycenters;
-
-      // at each vertex, compute vertex normal
-      // at each vertex, compute barycenter of neighbors
-      BOOST_FOREACH(vertex_descriptor v, vertices(mesh_))
-      {
-        if (is_on_patch(v) && !is_constrained(v))
-        {
-        Vector_3 vn = PMP::compute_vertex_normal(v, mesh_
-                            , PMP::parameters::vertex_point_map(vpmap_)
-                            .geom_traits(GeomTraits()));
-        put(propmap_normals, v, vn);
-
-          Vector_3 move = CGAL::NULL_VECTOR;
-          unsigned int star_size = 0;
-          BOOST_FOREACH(halfedge_descriptor h, halfedges_around_target(v, mesh_))
-          {
-            move = move + Vector_3(get(vpmap_, v), get(vpmap_, source(h, mesh_)));
-            ++star_size;
-          }
-          CGAL_assertion(star_size > 0);
-          move = (1. / (double)star_size) * move;
-
-          barycenters[v] = get(vpmap_, v) + move;
-        }
-        else if (smooth_along_features
-              && !protect_constraints_
-              && is_on_patch_border(v)
-              && !is_corner(v)
-              && !is_constrained(v))
-        {
-          put(propmap_normals, v, CGAL::NULL_VECTOR);
-
-          std::vector<halfedge_descriptor> border_halfedges;
-          BOOST_FOREACH(halfedge_descriptor h, halfedges_around_target(v, mesh_))
-          {
-            if (is_on_patch_border(h) || is_on_patch_border(opposite(h, mesh_)))
-              border_halfedges.push_back(h);
-          }
-          if (border_halfedges.size() == 2)//others are corner cases
-          {
-            vertex_descriptor ph0 = source(border_halfedges[0], mesh_);
-            vertex_descriptor ph1 = source(border_halfedges[1], mesh_);
-            double dot = Vector_3(get(vpmap_, v), get(vpmap_, ph0))
-                       * Vector_3(get(vpmap_, v), get(vpmap_, ph1));
-            //check squared cosine is < 0.25 (~120 degrees)
-            if (0.25 < dot / (sqlength(border_halfedges[0]) * sqlength(border_halfedges[0])))
-              barycenters[v] = CGAL::midpoint(midpoint(border_halfedges[0]),
-                                              midpoint(border_halfedges[1]));
-          }
-        }
-      }
-
-      // compute moves
-      typedef typename std::map<vertex_descriptor, Point>::value_type VP_pair;
-      std::map<vertex_descriptor, Point> new_locations;
-      BOOST_FOREACH(const VP_pair& vp, barycenters)
-      {
-        vertex_descriptor v = vp.first;
-        Point pv = get(vpmap_, v);
-        Vector_3 nv = boost::get(propmap_normals, v);
-        Point qv = vp.second; //barycenter at v
-
-        new_locations[v] = qv + (nv * Vector_3(qv, pv)) * nv;
-      }
-
-      // perform moves
-      BOOST_FOREACH(const VP_pair& vp, new_locations)
-      {
-        put(vpmap_, vp.first, vp.second);
-      }
-
-      CGAL_assertion(is_valid(mesh_));
-
-      CGAL_assertion(is_triangle_mesh(mesh_));
-#ifdef CGAL_PMP_REMESHING_DEBUG
-      debug_self_intersections();
-#endif
-#ifdef CGAL_PMP_REMESHING_VERBOSE
-      std::cout << "done." << std::endl;
-#endif
-#ifdef CGAL_DUMP_REMESHING_STEPS
-      dump("4-relaxation.off");
-#endif
-    }
-
-    struct Constraint_property_map
-    {
-      typedef boost::readable_property_map_tag      category;
-      typedef bool                                  value_type;
-      typedef bool                                  reference;
-      typedef edge_descriptor                       key_type;
-      const Self* remesher_ptr_;
-      Constraint_property_map(): remesher_ptr_(NULL) {}
-      Constraint_property_map(const Self& remesher)
-        : remesher_ptr_(&remesher) {}
-      friend bool get(const Constraint_property_map& m,
-                      const edge_descriptor& e) {
-        return m.remesher_ptr_->is_on_border(e) ||
-               m.remesher_ptr_->is_on_patch_border(e);
-      }
-    };
-
-    // PMP book :
-    // "maps the vertices back to the surface"
-    void project_to_surface()
-    {
-      //todo : handle the case of boundary vertices
-#ifdef CGAL_PMP_REMESHING_VERBOSE
-      std::cout << "Project to surface...";
-      std::cout.flush();
-#endif
-
-      BOOST_FOREACH(vertex_descriptor v, vertices(mesh_))
-      {
-        if (!is_on_patch(v) || is_constrained(v))
-          continue;
-        //note if v is constrained, it has not moved
-
-        Patch_id_property_map pid_pmap(*this);
-        internal::Filtered_projection_traits<typename AABB_tree::AABB_traits,
-                                             Patch_id_property_map,
-                                             true> /* keep primitives with matching IDs */
-        projection_traits(
-          get_patch_id(face(halfedge(v, mesh_), mesh_)),
-          tree_ptr_->traits(),
-          pid_pmap
-          );
-
-        tree_ptr_->traversal(get(vpmap_, v), projection_traits);
-        CGAL_assertion(projection_traits.found());
-
-        Point proj = projection_traits.closest_point();
-        put(vpmap_, v, proj);
-      }
-
-      CGAL_assertion(is_valid(mesh_));
-      CGAL_assertion(is_triangle_mesh(mesh_));
-
-#ifdef CGAL_PMP_REMESHING_DEBUG
-      debug_self_intersections();
-#endif
-#ifdef CGAL_PMP_REMESHING_VERBOSE
-      std::cout << "done." << std::endl;
-#endif
-
-#ifdef CGAL_DUMP_REMESHING_STEPS
-      dump("5-project.off");
-#endif
-    }
-
-private:
-  Patch_id get_patch_id(const face_descriptor& f) const
-  {
-    if (patch_ids_map_.empty())
-      return -1;
-    else
-      return patch_ids_map_.at(f);
-  }
-
-  void set_patch_id(const face_descriptor& f, const Patch_id& i)
-  {
-    if (patch_ids_map_.find(f) == patch_ids_map_.end())
-      patch_ids_map_.insert(std::make_pair(f, i));
-    else
-      patch_ids_map_[f] = i;
-  }
-
-  struct Patch_id_property_map
-  {
-    typedef boost::readable_property_map_tag     category;
-    typedef Patch_id                             value_type;
-    typedef Patch_id&                            reference;
-    typedef typename Triangle_list::const_iterator key_type;
-
-    const Self* remesher_ptr_;
-
-    Patch_id_property_map()
-      : remesher_ptr_(NULL) {}
-    Patch_id_property_map(const Self& remesher)
-      : remesher_ptr_(&remesher) {}
-
-    friend Patch_id get(const Patch_id_property_map& m, key_type tr_it)
-    {
-      //tr_it is an iterator from triangles_
-      std::size_t id_in_vec = std::distance(
-        m.remesher_ptr_->input_triangles().begin(), tr_it);
-
-      CGAL_assertion(0 <= id_in_vec);
-      CGAL_assertion(id_in_vec < m.remesher_ptr_->input_patch_ids().size());
-      CGAL_assertion(*tr_it == m.remesher_ptr_->input_triangles()[id_in_vec]);
-
-      return m.remesher_ptr_->input_patch_ids()[id_in_vec];
-    }
-  };
-
-  private:
-    Triangle_3 triangle(face_descriptor f) const
-    {
-      halfedge_descriptor h = halfedge(f, mesh_);
-      vertex_descriptor v1  = target(h, mesh_);
-      vertex_descriptor v2  = target(next(h, mesh_), mesh_);
-      vertex_descriptor v3  = target(next(next(h, mesh_), mesh_), mesh_);
-      return Triangle_3(get(vpmap_, v1), get(vpmap_, v2), get(vpmap_, v3));
-    }
-
-    double sqlength(const vertex_descriptor& v1,
-                    const vertex_descriptor& v2) const
-    {
-      return CGAL::squared_distance(get(vpmap_, v1), get(vpmap_, v2));
-    }
-
-    double sqlength(const halfedge_descriptor& h) const
-    {
-      vertex_descriptor v1 = target(h, mesh_);
-      vertex_descriptor v2 = source(h, mesh_);
-      return sqlength(v1, v2);
-    }
-
-    double sqlength(const edge_descriptor& e) const
-    {
-      return sqlength(halfedge(e, mesh_));
-    }
-
-    Point midpoint(const halfedge_descriptor& he) const
-    {
-      Point p1 = get(vpmap_, target(he, mesh_));
-      Point p2 = get(vpmap_, source(he, mesh_));
-      return CGAL::midpoint(p1, p2);
-    }
-
-    void dump(const char* filename) const
-    {
-      std::ofstream out(filename);
-      out << mesh_;
-      out.close();
-    }
-
-    int valence(const vertex_descriptor& v) const
-    {
-      return static_cast<int>(degree(v, mesh_));
-    }
-
-    int target_valence(const vertex_descriptor& v) const
-    {
-      return (is_border(v, mesh_)) ? 4 : 6;
-    }
-
-    bool is_on_triangle(const halfedge_descriptor& h) const
-    {
-      return h == next(next(next(h, mesh_), mesh_), mesh_);
-    }
-
-    bool is_longest_on_faces(const edge_descriptor& e) const
-    {
-      halfedge_descriptor h = halfedge(e, mesh_);
-      halfedge_descriptor hopp = opposite(h, mesh_);
-
-      //check whether h is the longest edge in its associated face
-      //overwise refinement will go for an endless loop
-      double sqh = sqlength(h);
-      return sqh >= sqlength(next(h, mesh_))
-          && sqh >= sqlength(next(next(h, mesh_), mesh_))
-          //do the same for hopp
-          && sqh >= sqlength(next(hopp, mesh_))
-          && sqh >= sqlength(next(next(hopp, mesh_), mesh_));
-    }
-
-    bool is_constrained(const edge_descriptor& e) const
-    {
-      return get(Constraint_property_map(*this), e);
-    }
-
-    bool is_split_allowed(const edge_descriptor& e) const
-    {
-      halfedge_descriptor h = halfedge(e, mesh_);
-      halfedge_descriptor hopp = opposite(h, mesh_);
-
-      if (protect_constraints_ && is_constrained(e))
-        return false;
-      else //allow splitting constraints
-      {
-        if (is_on_mesh(h) && is_on_mesh(hopp))
-          return false;
-        else if (is_on_mesh(h) && is_on_border(hopp))
-          return false;
-        else if (is_on_mesh(hopp) && is_on_border(h))
-          return false;
-        else
-          return true;
-      }
-    }
-
-    bool is_collapse_allowed(const edge_descriptor& e) const
-    {
-      halfedge_descriptor he = halfedge(e, mesh_);
-      halfedge_descriptor hopp = opposite(he, mesh_);
-
-      if (protect_constraints_ && is_constrained(e))
-        return false;
-      if (is_on_patch(he)) //hopp is also on patch
-      {
-        if (is_on_patch_border(next(he, mesh_)) && is_on_patch_border(prev(he, mesh_)))
-          return false;//too many cases to be handled
-        else if (is_on_patch_border(next(hopp, mesh_)) && is_on_patch_border(prev(hopp, mesh_)))
-          return false;//too many cases to be handled
-        else if (is_on_patch_border(target(he, mesh_)) && is_on_patch_border(source(he, mesh_)))
-          return false;//collapse would induce pinching the selection
-        else return true;
-      }
-      else if (is_on_patch_border(he))
-        return is_collapse_allowed_on_patch_border(he);
-      else if (is_on_patch_border(hopp))
-        return is_collapse_allowed_on_patch_border(hopp);
-      return false;
-    }
-
-    bool is_collapse_allowed_on_patch_border(const halfedge_descriptor& h) const
-    {
-      CGAL_precondition(is_on_patch_border(h));
-      halfedge_descriptor hopp = opposite(h, mesh_);
-
-      if (is_on_patch_border(next(h, mesh_)) && is_on_patch_border(prev(h, mesh_)))
-        return false;
-
-      if (is_on_patch_border(hopp))
-      {
-        if (is_on_patch_border(next(hopp, mesh_)) && is_on_patch_border(prev(hopp, mesh_)))
-          return false;
-        else
-          return true;
-      }
-      CGAL_assertion(is_on_mesh(hopp) || is_on_border(hopp));
-      return true;//we already checked we're not pinching a hole in the patch
-    }
-
-    bool collapse_does_not_invert_face(const halfedge_descriptor& h) const
-    {
-      vertex_descriptor vs = source(h, mesh_);
-      vertex_descriptor vt = target(h, mesh_);
-      
-      //backup source point
-      Point ps = get(vpmap_, vs);
-      //move source at target
-      put(vpmap_, vs, get(vpmap_, vt));
-
-      //collect normals to faces around vs AND vt
-      //vertices are at the same location, but connectivity is still be same,
-      //with plenty of degenerate triangles (which are common to both stars)
-      std::vector<Vector_3> normals;
-      BOOST_FOREACH(halfedge_descriptor hd,
-                    halfedges_around_target(h, mesh_))
-      {
-        Vector_3 n = compute_normal(face(hd, mesh_));
-        //n can be 0 in the splitting step because we remove degenerate faces
-        //only at the end of the splitting step
-        if(n != CGAL::NULL_VECTOR)
-          normals.push_back(n);
-      }
-      BOOST_FOREACH(halfedge_descriptor hd,
-                    halfedges_around_target(opposite(h, mesh_), mesh_))
-      {
-        Vector_3 n = compute_normal(face(hd, mesh_));
-        if(n != CGAL::NULL_VECTOR)
-          normals.push_back(n);
-      }
-
-      //check all normals have same orientation
-      bool res = true;
-      for(std::size_t i = 1; i < normals.size(); ++i)/*start at 1 on purpose*/
-      {
-        if (normals[i-1] * normals[i] <= 0.)
-        {
-          res = false;
-          break;
-        }
-      }
-      //restore position
-      put(vpmap_, vs, ps);
-      return res;
-    }
-
-    bool is_constrained(const vertex_descriptor& v) const
-    {
-      return get(vcmap_, v);
-    }
-
-    bool is_corner(const vertex_descriptor& v) const
-    {
-      unsigned int nb_incident_features = 0;
-      BOOST_FOREACH(halfedge_descriptor h, halfedges_around_target(v, mesh_))
-      {
-        if (is_on_border(h) || is_on_patch_border(h))
-          ++nb_incident_features;
-        if (nb_incident_features > 2)
-          return true;
-      }
-      return false;
-    }
-
-    Vector_3 compute_normal(const face_descriptor& f) const
-    {
-      halfedge_descriptor hd = halfedge(f, mesh_);
-      typename GeomTraits::Triangle_3
-        tr(get(vpmap_, target(hd, mesh_)),
-           get(vpmap_, target(next(hd, mesh_), mesh_)),
-           get(vpmap_, target(next(next(hd, mesh_), mesh_), mesh_)));
-
-      if (tr.is_degenerate())
-        return CGAL::NULL_VECTOR;
-      else
-        return PMP::compute_face_normal(f, mesh_);
-    }
-
-    template<typename FaceRange>
-    void tag_halfedges_status(const FaceRange& face_range)
-    {
-      //tag MESH,        //h and hopp belong to the mesh, not the patch
-      //tag MESH_BORDER  //h belongs to the mesh, face(hopp, pmesh) == null_face()
-      BOOST_FOREACH(halfedge_descriptor h, halfedges(mesh_))
-      {
-        //being part of the border of the mesh is predominant
-        if (is_border(h, mesh_))
-          halfedge_status_map_[h] = MESH_BORDER; //erase previous value if exists
-        else
-          halfedge_status_map_[h] = MESH;
-      }
-
-      //tag PATCH,       //h and hopp belong to the patch to be remeshed
-      BOOST_FOREACH(face_descriptor f, face_range)
-      {
-        BOOST_FOREACH(halfedge_descriptor h,
-                      halfedges_around_face(halfedge(f, mesh_), mesh_))
-        {
-          halfedge_status_map_[h] = PATCH;
-        }
-      }
-
-      internal::Border_constraint_pmap<PM, FaceRange> border_map(mesh_, face_range);
-      //override the border of PATCH
-      //tag PATCH_BORDER,//h belongs to the patch, hopp doesn't
-      BOOST_FOREACH(edge_descriptor e, edges(mesh_))
-      {
-        if (get(ecmap_, e) || get(border_map, e))
-        {
-          //deal with h and hopp for borders that are sharp edges to be preserved
-          halfedge_descriptor h = halfedge(e, mesh_);
-          if (halfedge_status_map_[h] == PATCH)
-            halfedge_status_map_[h] = PATCH_BORDER;
-
-          halfedge_descriptor hopp = opposite(h, mesh_);
-          if (halfedge_status_map_[hopp] == PATCH)
-            halfedge_status_map_[hopp] = PATCH_BORDER;
-
-          put(ecmap_, e, false);
-        }
-      }
-
-      CGAL_assertion(halfedge_status_map_.size() == nb_valid_halfedges());
-    }
-
-    Halfedge_status status(const halfedge_descriptor& h) const
-    {
-      typename boost::unordered_map <
-        halfedge_descriptor, Halfedge_status >::const_iterator
-          it = halfedge_status_map_.find(h);
-      if (it == halfedge_status_map_.end())
-        std::cout << "Something goes wrong with status function" << std::endl;
-      CGAL_assertion(it != halfedge_status_map_.end());
-      return it->second;
-    }
-
-    void merge_status(const halfedge_descriptor& en,
-                      const Halfedge_status& s_epo,
-                      const Halfedge_status& s_ep)
-    {
-      CGAL_assertion(halfedge_status_map_.find(en) != halfedge_status_map_.end());
-
-      //get missing data
-      halfedge_descriptor eno = opposite(en, mesh_);
-      Halfedge_status s_eno = status(eno);
-
-      if (s_epo == MESH_BORDER && s_eno == MESH_BORDER)
-        return;
-
-      if(s_epo == MESH_BORDER
-        || s_ep == MESH_BORDER
-        || s_epo == PATCH_BORDER
-        || s_ep == PATCH_BORDER)
-      {
-        halfedge_status_map_[en]  = s_epo;
-        halfedge_status_map_[eno] = s_ep;
-      }
-      // else keep current status for en and eno
-    }
-
-    template<typename Bimap>
-    void fix_degenerate_faces(const vertex_descriptor& v,
-                              Bimap& short_edges,
-                              const double& sq_low)
-    {
-      CGAL_assertion_code(std::size_t nb_done = 0);
-      boost::unordered_set<halfedge_descriptor> degenerate_faces;
-      BOOST_FOREACH(halfedge_descriptor h,
-                    halfedges_around_target(halfedge(v, mesh_), mesh_))
-      {
-        if (is_border(h, mesh_))
-          continue;
-        if (PMP::is_degenerated(h, mesh_, vpmap_, GeomTraits()))
-          degenerate_faces.insert(h);
-      }
-      while(!degenerate_faces.empty())
-      {
-        halfedge_descriptor h = *(degenerate_faces.begin());
-        degenerate_faces.erase(degenerate_faces.begin());
-
-        if (!PMP::is_degenerated(h, mesh_, vpmap_, GeomTraits()))
-          //this can happen when flipping h has consequences further in the mesh
-          continue;
-
-        //check that opposite is not also degenerate
-        if (degenerate_faces.find(opposite(h, mesh_)) != degenerate_faces.end())
-          degenerate_faces.erase(opposite(h, mesh_));
-
-        if(is_border(h, mesh_))
-          continue;
-
-        BOOST_FOREACH(halfedge_descriptor hf,
-                      halfedges_around_face(h, mesh_))
-        {
-          vertex_descriptor vc = target(hf, mesh_);
-          vertex_descriptor va = target(next(hf, mesh_), mesh_);
-          vertex_descriptor vb = target(next(next(hf, mesh_), mesh_), mesh_);
-          Vector_3 ab(get(vpmap_,va), get(vpmap_,vb));
-          Vector_3 ac(get(vpmap_,va), get(vpmap_,vc));
-          if (ab * ac < 0)
-          {
-            halfedge_descriptor hfo = opposite(hf, mesh_);
-            halfedge_descriptor h_ab = prev(hf, mesh_);
-            halfedge_descriptor h_ca = next(hf, mesh_);
-
-            short_edges.left.erase(hf);
-            short_edges.left.erase(hfo);
-
-            CGAL::Euler::flip_edge(hf, mesh_);
-            CGAL_assertion_code(++nb_done);
-
-            //update halfedge_status_map_
-            halfedge_status_map_[h_ab] = merge_status(h_ab, hf, hfo);
-            halfedge_status_map_[h_ca] = merge_status(h_ca, hf, hfo);
-            halfedge_status_map_[hf] =
-              (is_on_patch(h_ca) || is_on_patch_border(h_ca))
-              ? PATCH
-              : MESH;
-            halfedge_status_map_[hfo] = status(hf);
-#ifdef CGAL_PMP_REMESHING_DEBUG
-            debug_status_map();
-#endif
-
-            //insert new edges in 'short_edges'
-            if (is_collapse_allowed(edge(hf, mesh_)))
-            {
-              double sqlen = sqlength(hf);
-              if (sqlen < sq_low)
-                short_edges.insert(typename Bimap::value_type(hf, sqlen));
-            }
-
-            if (!is_border(hf, mesh_)
-              && PMP::is_degenerated(hf, mesh_, vpmap_, GeomTraits()))
-              degenerate_faces.insert(hf);
-            if (!is_border(hfo, mesh_)
-              && PMP::is_degenerated(hfo, mesh_, vpmap_, GeomTraits()))
-              degenerate_faces.insert(hfo);
-
-            break;
-          }
-        }
-      }
-#ifdef CGAL_PMP_REMESHING_DEBUG
-      debug_status_map();
-#endif
-    }
-
-    bool incident_to_degenerate(const halfedge_descriptor& he)
-    {
-      BOOST_FOREACH(halfedge_descriptor h,
-                    halfedges_around_target(he, mesh_))
-      {
-        if (is_border(h, mesh_))
-          continue;
-        if (PMP::is_degenerated(h, mesh_, vpmap_, GeomTraits()))
-          return true;
-      }
-      return false;
-    }
-
-    Halfedge_status merge_status(const halfedge_descriptor& h1,
-      const halfedge_descriptor& h2,
-      const halfedge_descriptor& h3)
-    {
-      Halfedge_status s1 = status(h1);
-      if (s1 == MESH_BORDER) return s1;
-      Halfedge_status s2 = status(h2);
-      if (s2 == MESH_BORDER) return s2;
-      Halfedge_status s3 = status(h3);
-      if (s3 == MESH_BORDER) return s3;
-      else if (s1 == PATCH_BORDER) return s1;
-      else if (s2 == PATCH_BORDER) return s2;
-      else if (s3 == PATCH_BORDER) return s3;
-
-      CGAL_assertion(s1 == s2 && s1 == s3);
-      return s1;
-    }
-
-    bool is_on_patch(const halfedge_descriptor& h) const
-    {
-      bool res =(status(h) == PATCH);
-      CGAL_assertion(res == (status(opposite(h, mesh_)) == PATCH));
-      return res;
-    }
-
-    bool is_on_patch(const face_descriptor& f) const
-    {
-      BOOST_FOREACH(halfedge_descriptor h,
-                    halfedges_around_face(halfedge(f, mesh_), mesh_))
-      {
-        if (is_on_patch(h) || is_on_patch_border(h))
-          return true;
-      }
-      return false;
-    }
-
-    bool is_on_patch(const vertex_descriptor& v) const
-    {
-      BOOST_FOREACH(halfedge_descriptor h,
-                    halfedges_around_target(v, mesh_))
-      {
-        if (!is_on_patch(h))
-          return false;
-      }
-      return true;
-    }
-
-public:
-    bool is_on_patch_border(const halfedge_descriptor& h) const
-    {
-      bool res = (status(h) == PATCH_BORDER);
-      if (res)
-      {
-        CGAL_assertion_code(Halfedge_status hs = status(opposite(h, mesh_)));
-        CGAL_assertion(hs == MESH_BORDER
-                    || hs == MESH
-                    || hs == PATCH_BORDER);//when 2 incident patches are remeshed
-      }
-      return res;
-    }
-    bool is_on_patch_border(const edge_descriptor& e) const
-    {
-      return is_on_patch_border(halfedge(e,mesh_))
-          || is_on_patch_border(opposite(halfedge(e, mesh_), mesh_));
-    }
-    bool is_on_patch_border(const vertex_descriptor& v) const
-    {
-      BOOST_FOREACH(halfedge_descriptor h, halfedges_around_target(v, mesh_))
-      {
-        if (is_on_patch_border(h) || is_on_patch_border(opposite(h, mesh_)))
-          return true;
-      }
-      return false;
-    }
-
-    bool is_on_border(const halfedge_descriptor& h) const
-    {
-      bool res = (status(h) == MESH_BORDER);
-      CGAL_assertion(res == is_border(h, mesh_));
-      CGAL_assertion(res == is_border(next(h, mesh_), mesh_));
-      return res;
-    }
-
-    bool is_on_border(const edge_descriptor& e) const
-    {
-      return is_on_border(halfedge(e, mesh_))
-          || is_on_border(opposite(halfedge(e, mesh_), mesh_));
-    }
-
-    bool is_on_mesh(const halfedge_descriptor& h) const
-    {
-      return status(h) == MESH;
-    }
-
-private:
-    void halfedge_added(const halfedge_descriptor& h,
-                        const Halfedge_status& s)
-    {
-      halfedge_status_map_.insert(std::make_pair(h, s));
-    }
-
-    void halfedge_and_opp_removed(const halfedge_descriptor& h)
-    {
-      halfedge_status_map_.erase(h);
-      halfedge_status_map_.erase(opposite(h, mesh_));
-    }
-
-    std::size_t nb_valid_halfedges() const
-    {
-      return static_cast<std::size_t>(
-        std::distance(halfedges(mesh_).first, halfedges(mesh_).second));
-    }
-
-    void debug_status_map() const
-    {
-      unsigned int nb_border = 0;
-      unsigned int nb_mesh = 0;
-      unsigned int nb_patch = 0;
-      unsigned int nb_patch_border = 0;
-
-      typedef typename boost::unordered_map <
-        halfedge_descriptor, Halfedge_status>::value_type
-          HD_pair;
-      BOOST_FOREACH(const HD_pair& hs, halfedge_status_map_)
-      {
-        if(is_on_patch(hs.first))              nb_patch++;
-        else if(is_on_patch_border(hs.first))  nb_patch_border++;
-        else if(is_on_mesh(hs.first))          nb_mesh++;
-        else if(is_on_border(hs.first))        nb_border++;
-        else CGAL_assertion(false);
-      }
-    }
-
-#ifdef CGAL_PMP_REMESHING_DEBUG
-    void debug_self_intersections() const
-    {
-      std::cout << "Test self intersections...";
-      std::vector<std::pair<face_descriptor, face_descriptor> > facets;
-      PMP::self_intersections(
-        mesh_,
-        std::back_inserter(facets),
-        PMP::parameters::vertex_point_map(vpmap_));
-      //CGAL_assertion(facets.empty());
-      std::cout << "done ("<< facets.size() <<" facets)." << std::endl;
-    }
-
-    void debug_self_intersections(const vertex_descriptor& v) const
-    {
-      std::cout << "Test self intersections...";
-      std::vector<std::pair<face_descriptor, face_descriptor> > facets;
-      PMP::self_intersections(
-        faces_around_target(halfedge(v, mesh_), mesh_),
-        mesh_,
-        std::back_inserter(facets),
-        PMP::parameters::vertex_point_map(vpmap_));
-      //CGAL_assertion(facets.empty());
-      std::cout << "done ("<< facets.size() <<" facets)." << std::endl;
-    }
-#endif
-
-    //warning : when v is on a sharp edge (angle <= 90 deg)
-    // which is not constrained (it's not mandatory)
-    //this test will return false, though normals are correct
-    bool check_normals(const vertex_descriptor& v) const
-    {
-      if (!is_on_patch(v))
-        return true;//not much to say if we are on a boundary/sharp edge
-
-      std::vector<Vector_3> normals;
-      BOOST_FOREACH(halfedge_descriptor hd,
-                    halfedges_around_target(halfedge(v, mesh_), mesh_))
-      {
-        Vector_3 n = compute_normal(face(hd, mesh_));
-        normals.push_back(n);
-        CGAL_assertion(n != CGAL::NULL_VECTOR);
-      }
-      //check all normals have same orientation
-      for (std::size_t i = 1; i < normals.size(); ++i)/*start at 1 on purpose*/
-      {
-        double dot = normals[i - 1] * normals[i];
-        if(dot <= 0.)
-          return false;
-      }
-      return true;
-    }
-
-    bool check_normals(const halfedge_descriptor& h) const
-    {
-      if (!is_on_patch(h))
-        return true;//nothing to say
-      Vector_3 n = compute_normal(face(h, mesh_));
-      Vector_3 no = compute_normal(face(opposite(h, mesh_), mesh_));
-      return n * no > 0.;
-    }
-
-  public:
-    const Triangle_list& input_triangles() const {
-      return input_triangles_;
-    }
-
-    const Patch_id_list& input_patch_ids() const {
-      return input_patch_ids_;
-    }
-
-    void update_constraints_property_map()
-    {
-      BOOST_FOREACH(edge_descriptor e, edges(mesh_))
-      {
-        if (is_on_patch_border(halfedge(e, mesh_))
-          || is_on_patch_border(opposite(halfedge(e, mesh_), mesh_)))
-          put(ecmap_, e, true);
-        else
-          put(ecmap_, e, false);
-      }
-    }
-
-  private:
-    PolygonMesh& mesh_;
-    VertexPointMap& vpmap_;
-    const AABB_tree* tree_ptr_;
-    bool own_tree_;
-    Triangle_list input_triangles_;
-    Patch_id_list input_patch_ids_;
-    boost::unordered_map<halfedge_descriptor, Halfedge_status> halfedge_status_map_;
-    bool protect_constraints_;
-    boost::unordered_map<face_descriptor, Patch_id> patch_ids_map_;
-    EdgeIsConstrainedMap ecmap_;
-    VertexIsConstrainedMap vcmap_;
-
-  };//end class Incremental_remesher
-}//end namespace internal
-}//end namespace Polygon_mesh_processing
-}//end namespace CGAL
-
-#endif //CGAL_POLYGON_MESH_PROCESSING_REMESH_IMPL_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/internal/fair_impl.h b/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/internal/fair_impl.h
deleted file mode 100644
index a59f500..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/internal/fair_impl.h
+++ /dev/null
@@ -1,203 +0,0 @@
-// Copyright (c) 2015 GeometryFactory (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Jane Tournois
-
-#ifndef CGAL_POLYGON_MESH_PROCESSING_FAIR_POLYHEDRON_3_H
-#define CGAL_POLYGON_MESH_PROCESSING_FAIR_POLYHEDRON_3_H
-
-#include <map>
-#include <set>
-#include <CGAL/assertions.h>
-#include <CGAL/Polygon_mesh_processing/Weights.h>
-#include <CGAL/Timer.h>
-#include <CGAL/trace.h>
-#include <iterator>
-
-namespace CGAL {
-
-namespace Polygon_mesh_processing {
-
-namespace internal {
-
-// [On Linear Variational Surface Deformation Methods-2008]
-template<class PolygonMesh,
-         class SparseLinearSolver,
-         class WeightCalculator,
-         class VertexPointMap>
-class Fair_Polyhedron_3 {
-  // typedefs
-  typedef typename VertexPointMap::value_type Point_3;
-  typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
-  typedef  Halfedge_around_target_circulator<PolygonMesh>  Halfedge_around_vertex_circulator;
-
-  typedef SparseLinearSolver Sparse_linear_solver;
-  typedef typename Sparse_linear_solver::Matrix Solver_matrix;
-  typedef typename Sparse_linear_solver::Vector Solver_vector;
-
-// members
-  PolygonMesh& pmesh;
-  WeightCalculator weight_calculator;
-  VertexPointMap ppmap;
-
-public:
-  Fair_Polyhedron_3(PolygonMesh& pmesh
-      , VertexPointMap vpmap
-      , WeightCalculator weight_calculator)
-    : pmesh(pmesh)
-    , weight_calculator(weight_calculator)
-    , ppmap(vpmap)
-  { }
-  
-private:
-  double sum_weight(vertex_descriptor v) {
-  double weight = 0;
-  Halfedge_around_vertex_circulator circ(halfedge(v,pmesh),pmesh), done(circ);
-  do {
-    weight += weight_calculator.w_ij(*circ);
-    } while(++circ != done);
-    return weight;
-  }
-
-  // recursively computes a row (use depth parameter to compute L, L^2, L^3)
-  // Equation 6 in [On Linear Variational Surface Deformation Methods]
-  void compute_row(
-    vertex_descriptor v,
-    int row_id,                            // which row to insert in [ frees stay left-hand side ]
-    Solver_matrix& matrix, 
-    double& x, double& y, double& z,               // constants transfered to right-hand side
-    double multiplier,
-    const std::map<vertex_descriptor, std::size_t>& vertex_id_map,
-    unsigned int depth)
-  {
-    if(depth == 0) {
-      typename std::map<vertex_descriptor, std::size_t>::const_iterator vertex_id_it = vertex_id_map.find(v);
-      if(vertex_id_it != vertex_id_map.end()) {
-        int col_id = static_cast<int>(vertex_id_it->second);
-        matrix.add_coef(row_id, col_id, multiplier);
-      }
-      else { 
-        typename boost::property_traits<VertexPointMap>::reference p = ppmap[v];
-        x += multiplier * - p.x(); 
-        y += multiplier * - p.y(); 
-        z += multiplier * - p.z(); 
-      }
-    }
-    else {
-      double w_i = weight_calculator.w_i(v);
-
-      Halfedge_around_vertex_circulator circ(halfedge(v,pmesh),pmesh), done(circ);
-      do {
-        double w_i_w_ij = w_i * weight_calculator.w_ij(*circ) ;
-
-        vertex_descriptor nv = target(opposite(*circ,pmesh),pmesh);
-        compute_row(nv, row_id, matrix, x, y, z, -w_i_w_ij*multiplier, vertex_id_map, depth-1);
-      } while(++circ != done);
-
-      double w_i_w_ij_sum = w_i * sum_weight(v);
-      compute_row(v, row_id, matrix, x, y, z, w_i_w_ij_sum*multiplier, vertex_id_map, depth-1);
-    }
-  }
-
-public:
-  template<class VertexRange>
-  bool fair(const VertexRange& vertices
-    , SparseLinearSolver solver
-    , unsigned int fc)
-  {
-    int depth = static_cast<int>(fc) + 1;
-    if(depth < 0 || depth > 3) {
-      CGAL_warning(!"Continuity should be between 0 and 2 inclusively!");
-      return false; 
-    }
-
-    std::set<vertex_descriptor> interior_vertices(boost::begin(vertices),
-                                                  boost::end(vertices));
-    if(interior_vertices.empty()) { return true; }
-
-    CGAL::Timer timer; timer.start();
-    const std::size_t nb_vertices = interior_vertices.size();
-    Solver_vector X(nb_vertices), Bx(nb_vertices);
-    Solver_vector Y(nb_vertices), By(nb_vertices);
-    Solver_vector Z(nb_vertices), Bz(nb_vertices);
-
-    std::map<vertex_descriptor, std::size_t> vertex_id_map;
-    std::size_t id = 0;
-    BOOST_FOREACH(vertex_descriptor vd, interior_vertices)
-    {
-      if( !vertex_id_map.insert(std::make_pair(vd, id)).second ) {
-        CGAL_warning(!"Duplicate vertex is found!");
-        return false;
-      }
-      ++id;
-    }
-
-    Solver_matrix A(nb_vertices);
-
-    BOOST_FOREACH(vertex_descriptor vd, interior_vertices)
-    {
-      int v_id = static_cast<int>(vertex_id_map[vd]);
-      compute_row(vd, v_id, A, Bx[v_id], By[v_id], Bz[v_id], 1, vertex_id_map, depth);
-    }
-    CGAL_TRACE_STREAM << "**Timer** System construction: " << timer.time() << std::endl; timer.reset();
-
-    // factorize
-    double D;
-    bool prefactor_ok = solver.factor(A, D);
-    if(!prefactor_ok) {
-      CGAL_warning(!"pre_factor failed!");
-      return false;
-    }
-    CGAL_TRACE_STREAM << "**Timer** System factorization: " << timer.time() << std::endl; timer.reset();
-
-    // solve
-    bool is_all_solved = solver.linear_solver(Bx, X) && solver.linear_solver(By, Y) && solver.linear_solver(Bz, Z);
-    if(!is_all_solved) {
-      CGAL_warning(!"linear_solver failed!"); 
-      return false; 
-    }
-    CGAL_TRACE_STREAM << "**Timer** System solver: " << timer.time() << std::endl; timer.reset();
-
-    
-    /* This relative error is to large for cases that the results are not good */ 
-    /*
-    double rel_err_x = (A.eigen_object()*X - Bx).norm() / Bx.norm();
-    double rel_err_y = (A.eigen_object()*Y - By).norm() / By.norm();
-    double rel_err_z = (A.eigen_object()*Z - Bz).norm() / Bz.norm();
-    CGAL_TRACE_STREAM << "rel error: " << rel_err_x 
-                                << " " << rel_err_y
-                                << " " << rel_err_z << std::endl;
-                                */
-
-    // update 
-    id = 0;
-    BOOST_FOREACH(vertex_descriptor vd, interior_vertices)
-    {
-      put(ppmap, vd, Point_3(X[id], Y[id], Z[id]));
-      ++id;
-    }
-    return true;
-  }
-};
-
-}//namespace internal
-
-}//namespace Polygon_mesh_processing
-
-}//namespace CGAL
-#endif //CGAL_POLYGON_MESH_PROCESSING_FAIR_POLYHEDRON_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/internal/named_function_params.h b/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/internal/named_function_params.h
deleted file mode 100644
index 79db38e..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/internal/named_function_params.h
+++ /dev/null
@@ -1,386 +0,0 @@
-// Copyright (c) 2015 GeometryFactory (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Jane Tournois
-
-#ifndef CGAL_PMP_BGL_NAMED_FUNCTION_PARAMS_H
-#define CGAL_PMP_BGL_NAMED_FUNCTION_PARAMS_H
-
-#include <CGAL/boost/graph/named_function_params.h>
-
-#define CGAL_PMP_NP_TEMPLATE_PARAMETERS T, typename Tag, typename Base
-#define CGAL_PMP_NP_CLASS CGAL::pmp_bgl_named_params<T,Tag,Base>
-
-namespace CGAL{
-
-  enum density_control_factor_t     { density_control_factor      };
-  enum use_delaunay_triangulation_t { use_delaunay_triangulation  };
-  enum fairing_continuity_t         { fairing_continuity };
-  enum sparse_linear_solver_t       { sparse_linear_solver };
-  enum geom_traits_t                { geom_traits };
-  enum number_of_iterations_t       { number_of_iterations };
-  enum protect_constraints_t        { protect_constraints };
-  enum vertex_is_constrained_t      { vertex_is_constrained };
-
-  //to be documented
-  enum smooth_along_features_t      { smooth_along_features };
-  enum face_normal_t                { face_normal };
-
-  //internal
-  enum weight_calculator_t          { weight_calculator };
-  enum all_default_t                { all_default };
-
-  template <typename T, typename Tag, typename Base = boost::no_property>
-  struct pmp_bgl_named_params
-    : CGAL::cgal_bgl_named_params<T, Tag, Base>
-  {
-    typedef CGAL::cgal_bgl_named_params<T, Tag, Base> base;
-    typedef pmp_bgl_named_params self;
-
-    pmp_bgl_named_params(T v = T()) : base(v) {}
-    pmp_bgl_named_params(T v, const Base& b) : base(v, b) {}
-
-    pmp_bgl_named_params<bool, all_default_t, self>
-    all_default() const
-    {
-      typedef pmp_bgl_named_params<bool, all_default_t, self> Params;
-      return Params(*this);
-    }
-
-    template <typename Double>
-    pmp_bgl_named_params<Double, density_control_factor_t, self>
-    density_control_factor(const Double& d) const
-    {
-      typedef pmp_bgl_named_params<Double, density_control_factor_t, self> Params;
-      return Params(d, *this);
-    }
-
-    template <typename Boolean>
-    pmp_bgl_named_params<Boolean, use_delaunay_triangulation_t, self>
-    use_delaunay_triangulation(const Boolean b) const
-    {
-      typedef pmp_bgl_named_params<Boolean, use_delaunay_triangulation_t, self> Params;
-      return Params(b, *this);
-    }
-
-    template <typename UnsignedInt>
-    pmp_bgl_named_params<UnsignedInt, fairing_continuity_t, self>
-    fairing_continuity(const UnsignedInt& ui) const
-    {
-      typedef pmp_bgl_named_params<UnsignedInt, fairing_continuity_t, self> Params;
-      return Params(ui, *this);
-    }
-
-    template<typename Solver>
-    pmp_bgl_named_params<Solver, sparse_linear_solver_t, self>
-    sparse_linear_solver(const Solver& s) const
-    {
-      typedef pmp_bgl_named_params<Solver, sparse_linear_solver_t, self> Params;
-      return Params(s, *this);
-    }
-
-    template<typename WeightCalc>
-    pmp_bgl_named_params<WeightCalc, weight_calculator_t, self>
-    weight_calculator(const WeightCalc& w) const
-    {
-      typedef pmp_bgl_named_params<WeightCalc, weight_calculator_t, self> Params;
-      return Params(w, *this);
-    }
-
-    template <typename FaceNormalMap>
-    pmp_bgl_named_params<FaceNormalMap, face_normal_t, self>
-    face_normal_map(const FaceNormalMap& m) const
-    {
-      typedef pmp_bgl_named_params<FaceNormalMap, face_normal_t, self> Params;
-      return Params(m, *this);
-    }
-
-    //overload
-    template <typename PointMap>
-    pmp_bgl_named_params<PointMap, boost::vertex_point_t, self>
-    vertex_point_map(const PointMap& p) const
-    {
-      typedef pmp_bgl_named_params<PointMap, boost::vertex_point_t, self> Params;
-      return Params(p, *this);
-    }
-
-    template<typename K>
-    pmp_bgl_named_params<K, geom_traits_t, self>
-    geom_traits(const K& k) const
-    {
-      typedef pmp_bgl_named_params<K, geom_traits_t, self> Params;
-      return Params(k, *this);
-    }
-
-    template<typename NT>
-    pmp_bgl_named_params<NT, number_of_iterations_t, self>
-    number_of_iterations(const NT& n) const
-    {
-      typedef pmp_bgl_named_params<NT, number_of_iterations_t, self> Params;
-      return Params(n, *this);
-    }
-
-    template<typename Boolean>
-    pmp_bgl_named_params<Boolean, protect_constraints_t, self>
-    protect_constraints(const Boolean b) const
-    {
-      typedef pmp_bgl_named_params<Boolean, protect_constraints_t, self> Params;
-      return Params(b, *this);
-    }
-
-    template<typename Boolean>
-    pmp_bgl_named_params<Boolean, smooth_along_features_t, self>
-      smooth_along_features(const Boolean b) const
-    {
-      typedef pmp_bgl_named_params<Boolean, smooth_along_features_t, self> Params;
-      return Params(b, *this);
-    }
-
-    template <typename VertexIsConstrained>
-    pmp_bgl_named_params<VertexIsConstrained, vertex_is_constrained_t, self>
-    vertex_is_constrained_map(const VertexIsConstrained& vm) const
-    {
-      typedef pmp_bgl_named_params<VertexIsConstrained, vertex_is_constrained_t, self> Params;
-      return Params(vm, *this);
-    }
-
-    //overload
-    template <typename EdgeIsConstrained>
-    pmp_bgl_named_params<EdgeIsConstrained, edge_is_constrained_t, self>
-    edge_is_constrained_map(const EdgeIsConstrained& em) const
-    {
-      typedef pmp_bgl_named_params<EdgeIsConstrained, edge_is_constrained_t, self> Params;
-      return Params(em, *this);
-    }
-
-    template <typename EdgeIsConstrainedParams>
-    pmp_bgl_named_params<EdgeIsConstrainedParams, edge_is_constrained_params_t, self>
-    edge_is_constrained_map_params(const EdgeIsConstrainedParams& em) const
-    {
-      typedef pmp_bgl_named_params<EdgeIsConstrainedParams,
-                                   edge_is_constrained_params_t, self> Params;
-      return Params(em, *this);
-    }
-
-    //overload
-    template <typename IndexMap>
-    pmp_bgl_named_params<IndexMap, boost::face_index_t, self>
-    face_index_map(const IndexMap& p) const
-    {
-      typedef pmp_bgl_named_params<IndexMap, boost::face_index_t, self> Params;
-      return Params(p, *this);
-    }
-
-    //overload
-    template <typename IndexMap>
-    pmp_bgl_named_params<IndexMap, boost::vertex_index_t, self>
-    vertex_index_map(const IndexMap& p) const
-    {
-      typedef pmp_bgl_named_params<IndexMap, boost::vertex_index_t, self> Params;
-      return Params(p, *this);
-    }
-
-  };
-
-namespace Polygon_mesh_processing{
-
-namespace parameters{
-
-  pmp_bgl_named_params<bool, all_default_t>
-  inline all_default()
-  {
-    typedef pmp_bgl_named_params<bool, all_default_t> Params;
-    return Params();
-  }
-
-  template <typename Double>
-  pmp_bgl_named_params<Double, density_control_factor_t>
-  density_control_factor(const Double& d)
-  {
-    typedef pmp_bgl_named_params<Double, density_control_factor_t> Params;
-    return Params(d);
-  }
-
-  template <typename Boolean>
-  pmp_bgl_named_params<Boolean, use_delaunay_triangulation_t>
-  use_delaunay_triangulation(const Boolean b)
-  {
-    typedef pmp_bgl_named_params<Boolean, use_delaunay_triangulation_t> Params;
-    return Params(b);
-  }
-
-  template <typename UnsignedInt>
-  pmp_bgl_named_params<UnsignedInt, fairing_continuity_t>
-  fairing_continuity(const UnsignedInt& ui)
-  {
-    typedef pmp_bgl_named_params<UnsignedInt, fairing_continuity_t> Params;
-    return Params(ui);
-  }
-
-  template<typename Solver>
-  pmp_bgl_named_params<Solver, sparse_linear_solver_t>
-  sparse_linear_solver(const Solver& s)
-  {
-    typedef pmp_bgl_named_params<Solver, sparse_linear_solver_t> Params;
-    return Params(s);
-  }
-
-  template<typename WeightCalc>
-  pmp_bgl_named_params<WeightCalc, weight_calculator_t>
-  weight_calculator(const WeightCalc& w)
-  {
-    typedef pmp_bgl_named_params<WeightCalc, weight_calculator_t> Params;
-    return Params(w);
-  }
-
-  template <typename FaceNormalMap>
-  pmp_bgl_named_params<FaceNormalMap, face_normal_t>
-  face_normal_map(const FaceNormalMap& m)
-  {
-    typedef pmp_bgl_named_params<FaceNormalMap, face_normal_t> Params;
-    return Params(m);
-  }
-
-  //overload
-  template <typename PointMap>
-  pmp_bgl_named_params<PointMap, boost::vertex_point_t>
-  vertex_point_map(const PointMap& p)
-  {
-    typedef pmp_bgl_named_params<PointMap, boost::vertex_point_t> Params;
-    return Params(p);
-  }
-
-  template<typename K>
-  pmp_bgl_named_params<K, geom_traits_t>
-  geom_traits(const K& k)
-  {
-    typedef pmp_bgl_named_params<K, geom_traits_t> Params;
-    return Params(k);
-  }
-
-  template<typename NT>
-  pmp_bgl_named_params<NT, number_of_iterations_t>
-    number_of_iterations(const NT& n)
-  {
-    typedef pmp_bgl_named_params<NT, number_of_iterations_t> Params;
-    return Params(n);
-  }
-
-  template <typename Boolean>
-  pmp_bgl_named_params<Boolean, protect_constraints_t>
-  protect_constraints(const Boolean b)
-  {
-    typedef pmp_bgl_named_params<Boolean, protect_constraints_t> Params;
-    return Params(b);
-  }
-
-  template<typename Boolean>
-  pmp_bgl_named_params<Boolean, smooth_along_features_t>
-  smooth_along_features(const Boolean b)
-  {
-    typedef pmp_bgl_named_params<Boolean, smooth_along_features_t> Params;
-    return Params(b);
-  }
-
-  template <typename VertexIsConstrained>
-  pmp_bgl_named_params<VertexIsConstrained, vertex_is_constrained_t>
-  vertex_is_constrained_map(const VertexIsConstrained& vm)
-  {
-    typedef pmp_bgl_named_params<VertexIsConstrained, vertex_is_constrained_t> Params;
-    return Params(vm);
-  }
-
-  //overload
-  template <typename EdgeIsConstrained>
-  pmp_bgl_named_params<EdgeIsConstrained, edge_is_constrained_t>
-  edge_is_constrained_map(const EdgeIsConstrained& em)
-  {
-    typedef pmp_bgl_named_params<EdgeIsConstrained, edge_is_constrained_t> Params;
-    return Params(em);
-  }
-
-  //overload
-  template <typename EdgeIsConstrainedParams>
-  pmp_bgl_named_params<EdgeIsConstrainedParams, edge_is_constrained_params_t>
-  edge_is_constrained_map_params(const EdgeIsConstrainedParams& em)
-  {
-    typedef pmp_bgl_named_params<EdgeIsConstrainedParams,
-                                 edge_is_constrained_params_t> Params;
-    return Params(em);
-  }
-
-  //overload
-  template <typename IndexMap>
-  pmp_bgl_named_params<IndexMap, boost::face_index_t>
-  face_index_map(IndexMap const& p)
-  {
-    typedef pmp_bgl_named_params<IndexMap, boost::face_index_t> Params;
-    return Params(p);
-  }
-
-  //overload
-  template <typename IndexMap>
-  pmp_bgl_named_params<IndexMap, boost::vertex_index_t>
-  vertex_index_map(const IndexMap& p)
-  {
-    typedef pmp_bgl_named_params<IndexMap, boost::vertex_index_t> Params;
-    return Params(p);
-  }
-
-} //namespace parameters
-} //namespace Polygon_mesh_processing
-
-#if BOOST_VERSION < 105100
-  template <class Tag1, class Tag2, class T1, class Base>
-  inline
-  typename boost::property_value< pmp_bgl_named_params<T1,Tag1,Base>, Tag2>::type
-  get_param(const pmp_bgl_named_params<T1,Tag1,Base>& p, Tag2 tag2)
-  {
-    enum { match = boost::detail::same_property<Tag1,Tag2>::value };
-    typedef typename
-      boost::property_value< pmp_bgl_named_params<T1,Tag1,Base>, Tag2>::type T2;
-    T2* t2 = 0;
-    typedef boost::detail::property_value_dispatch<match> Dispatcher;
-    return Dispatcher::const_get_value(p, t2, tag2);
-  }
-#endif
-
-} //namespace CGAL
-
-// partial specializations hate inheritance and we need to repeat
-// those here. this is rather fragile.
-namespace boost {
-  template <typename T, typename Tag, typename Base, typename Def>
-  struct lookup_named_param_def<Tag, CGAL::pmp_bgl_named_params<T, Tag, Base>, Def> {
-    typedef T type;
-    static const type& get(const bgl_named_params<T, Tag, Base>& p, const Def&) {
-      return p.m_value;
-    }
-  };
-
-  template <typename Tag1, typename T, typename Tag, typename Base, typename Def>
-  struct lookup_named_param_def<Tag1, CGAL::pmp_bgl_named_params<T, Tag, Base>, Def> {
-    typedef typename lookup_named_param_def<Tag1, Base, Def>::type type;
-    static const type& get(const bgl_named_params<T, Tag, Base>& p, const Def& def) {
-      return lookup_named_param_def<Tag1, Base, Def>::get(p.m_base, def);
-    }
-  };
-} // boost
-
-
-#endif //CGAL_PMP_BGL_NAMED_FUNCTION_PARAMS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/internal/named_params_helper.h b/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/internal/named_params_helper.h
deleted file mode 100644
index 9bd3a37..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/internal/named_params_helper.h
+++ /dev/null
@@ -1,140 +0,0 @@
-// Copyright (c) 2015 GeometryFactory (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Jane Tournois
-
-#ifndef CGAL_NAMED_PARAMETERS_HELPERS_H
-#define CGAL_NAMED_PARAMETERS_HELPERS_H
-
-#include <CGAL/Kernel_traits.h>
-#include <CGAL/Polygon_mesh_processing/internal/named_function_params.h>
-
-#include <CGAL/property_map.h>
-
-// shortcut for accessing the value type of the property map
-template <class Graph, class Property>
-class property_map_value {
-  typedef typename boost::property_map<Graph, Property>::const_type PMap;
-public:
-  typedef typename boost::property_traits<PMap>::value_type type;
-};
-
-template<typename PolygonMesh>
-class GetK
-{
-  typedef typename property_map_value<PolygonMesh,
-    boost::vertex_point_t>::type
-    Point;
-public:
-  typedef typename CGAL::Kernel_traits<Point>::Kernel Kernel;
-};
-
-template<typename PolygonMesh, typename NamedParameters>
-class GetGeomTraits
-{
-  typedef typename GetK<PolygonMesh>::Kernel DefaultKernel;
-public:
-  typedef typename boost::lookup_named_param_def <
-    CGAL::geom_traits_t,
-    NamedParameters,
-    DefaultKernel
-  > ::type  type;
-};
-
-template<typename PolygonMesh, typename NamedParameters>
-class GetVertexPointMap
-{
-  typedef typename boost::property_map<PolygonMesh, boost::vertex_point_t>::const_type
-    DefaultVPMap_const;
-  typedef typename boost::property_map<PolygonMesh, boost::vertex_point_t>::type
-    DefaultVPMap;
-public:
-  typedef typename boost::lookup_named_param_def<
-    boost::vertex_point_t,
-    NamedParameters,
-    DefaultVPMap
-  > ::type  type;
-  typedef typename boost::lookup_named_param_def<
-    boost::vertex_point_t,
-    NamedParameters,
-    DefaultVPMap_const
-  > ::type  const_type;
-};
-
-template<typename PolygonMesh, typename NamedParameters>
-class GetFaceIndexMap
-{
-  typedef typename boost::property_map < PolygonMesh, boost::face_index_t>::type DefaultMap;
-public:
-  typedef typename boost::lookup_named_param_def <
-    boost::face_index_t,
-    NamedParameters,
-    DefaultMap
-  > ::type  type;
-};
-
-template<typename PolygonMesh, typename NamedParameters>
-class GetVertexIndexMap
-{
-  typedef typename boost::property_map < PolygonMesh, boost::vertex_index_t>::type DefaultMap;
-public:
-  typedef typename boost::lookup_named_param_def <
-    boost::vertex_index_t,
-    NamedParameters,
-    DefaultMap
-  > ::type  type;
-};
-
-template<typename PolygonMesh, typename NamedParameters>
-class GetFaceNormalMap
-{
-  struct DummyNormalPmap
-  {
-    typedef typename boost::graph_traits<PolygonMesh>::face_descriptor key_type;
-    typedef typename GetGeomTraits<PolygonMesh, NamedParameters>::type::Vector_3 value_type;
-    typedef value_type reference;
-    typedef boost::readable_property_map_tag category;
-
-    typedef DummyNormalPmap Self;
-    friend reference get(const Self&, const key_type&) { return CGAL::NULL_VECTOR; }
-  };
-
-public:
-  typedef DummyNormalPmap NoMap;
-  typedef typename boost::lookup_named_param_def <
-    CGAL::face_normal_t,
-    NamedParameters,
-    DummyNormalPmap//default
-  > ::type  type;
-};
-
-template<typename NamedParameters, typename DefaultSolver>
-class GetSolver
-{
-public:
-  typedef typename boost::lookup_named_param_def <
-    CGAL::sparse_linear_solver_t,
-    NamedParameters,
-    DefaultSolver
-  > ::type type;
-};
-
-
-
-#endif //CGAL_NAMED_PARAMETERS_HELPERS_H
-
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/internal/refine_impl.h b/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/internal/refine_impl.h
deleted file mode 100644
index 296c5b9..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/internal/refine_impl.h
+++ /dev/null
@@ -1,335 +0,0 @@
-// Copyright (c) 2015 GeometryFactory (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Jane Tournois
-
-#ifndef CGAL_POLYGON_MESH_PROCESSING_REFINE_POLYHEDRON_3_H
-#define CGAL_POLYGON_MESH_PROCESSING_REFINE_POLYHEDRON_3_H
-
-#include <cmath>
-#include <map>
-#include <set>
-#include <list>
-
-#include <CGAL/assertions.h>
-#include <CGAL/trace.h>
-#include <CGAL/Timer.h>
-#include <CGAL/squared_distance_3.h>
-#include <CGAL/Kernel/global_functions_3.h>
-#include <CGAL/boost/graph/iterator.h>
-#include <CGAL/boost/graph/Euler_operations.h>
-#include <CGAL/boost/graph/properties.h>
-#include <boost/property_map/property_map.hpp>
-
-namespace CGAL {
-
-namespace Polygon_mesh_processing {
-
-namespace internal {
-
-template<class PolygonMesh, class VertexPointMap>
-class Refine_Polyhedron_3 {
-//// typedefs
-  typedef typename boost::property_traits<VertexPointMap>::value_type     Point_3;
-  typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor    vertex_descriptor;
-  typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor  halfedge_descriptor;
-  typedef typename boost::graph_traits<PolygonMesh>::face_descriptor      face_descriptor;
-
-  typedef Halfedge_around_face_circulator<PolygonMesh>    Halfedge_around_facet_circulator;
-  typedef Halfedge_around_target_circulator<PolygonMesh>  Halfedge_around_vertex_circulator;
-
-private:
-  PolygonMesh& pmesh;
-  VertexPointMap vpmap;
-  
-  bool flippable(halfedge_descriptor h) {
-    // this check is added so that edge flip does not break manifoldness
-    // it might happen when there is an edge where flip_edge(h) will be placed (i.e. two edges collide after flip)
-    vertex_descriptor v_tip_0 = target(next(h,pmesh),pmesh);
-    vertex_descriptor v_tip_1 = target(next(opposite(h,pmesh),pmesh),pmesh);
-    Halfedge_around_vertex_circulator v_cir(next(h,pmesh), pmesh), v_end(v_cir);
-    do {
-      if(target(opposite(*v_cir, pmesh),pmesh) == v_tip_1) { return false; }
-    } while(++v_cir != v_end);
-    
-    // also eliminate collinear triangle generation
-    if( CGAL::collinear(vpmap[v_tip_0], vpmap[v_tip_1], vpmap[target(h, pmesh)]) ||
-        CGAL::collinear(vpmap[v_tip_0], vpmap[v_tip_1], vpmap[target(opposite(h, pmesh),pmesh)]) ) {
-      return false;
-    }
-
-    return true;
-  }
-
-  bool relax(halfedge_descriptor h)
-  {
-    const Point_3& p = vpmap[target(h,pmesh)];
-    const Point_3& q = vpmap[target(opposite(h,pmesh),pmesh)];
-    const Point_3& r = vpmap[target(next(h,pmesh),pmesh)];
-    const Point_3& s = vpmap[target(next(opposite(h,pmesh),pmesh),pmesh)];
-    if( (CGAL::ON_UNBOUNDED_SIDE  != CGAL::side_of_bounded_sphere(p,q,r,s)) ||
-        (CGAL::ON_UNBOUNDED_SIDE  != CGAL::side_of_bounded_sphere(p,q,s,r)) )
-    {
-      if(flippable(h)) {
-        Euler::flip_edge(h,pmesh);
-        return true;
-      }
-    }
-    return false;
-  }
-
-  template<class VertexOutputIterator,
-           class FaceOutputIterator,
-           class FaceRange>
-  bool subdivide(const FaceRange& faces,
-                 const std::set<halfedge_descriptor>& border_edges,
-                 std::map<vertex_descriptor, double>& scale_attribute, 
-                 VertexOutputIterator& vertex_out,
-                 FaceOutputIterator& facet_out,
-                 std::vector<face_descriptor>& new_faces,
-                 double alpha)
-  {
-    BOOST_FOREACH(face_descriptor fd, faces)
-    {
-      CGAL_assertion(fd  != boost::graph_traits<PolygonMesh>::null_face());
-
-      vertex_descriptor vi = target(halfedge(fd,pmesh),pmesh);
-      vertex_descriptor vj = target(next(halfedge(fd,pmesh),pmesh),pmesh);
-      vertex_descriptor vk = target(prev(halfedge(fd,pmesh),pmesh),pmesh);
-      Point_3 c = CGAL::centroid(vpmap[vi], vpmap[vj], vpmap[vk]);
-      double sac  = (scale_attribute[vi] + scale_attribute[vj] + scale_attribute[vk])/3.0;
-      double dist_c_vi = CGAL::sqrt(CGAL::squared_distance(c,vpmap[vi]));
-      double dist_c_vj = CGAL::sqrt(CGAL::squared_distance(c,vpmap[vj]));
-      double dist_c_vk = CGAL::sqrt(CGAL::squared_distance(c,vpmap[vk]));
-      if((alpha * dist_c_vi > sac) &&
-         (alpha * dist_c_vj > sac) &&
-         (alpha * dist_c_vk > sac) &&
-         (alpha * dist_c_vi > scale_attribute[vi]) &&
-         (alpha * dist_c_vj > scale_attribute[vj]) &&
-         (alpha * dist_c_vk > scale_attribute[vk]))
-      {
-        halfedge_descriptor h = Euler::add_center_vertex(halfedge(fd,pmesh),pmesh);
-        put(vpmap, target(h,pmesh), c);
-          scale_attribute[target(h,pmesh)] = sac;
-          *vertex_out++ = target(h,pmesh);
-
-          // collect 2 new facets for next round 
-          face_descriptor h1 = face(opposite(next(h,pmesh),pmesh),pmesh);
-          face_descriptor h2 = face(opposite(h,pmesh),pmesh);
-          new_faces.push_back(h1); new_faces.push_back(h2);
-          *facet_out++ = h1;    *facet_out++ = h2;
-          // relax edges of the  patching mesh 
-          halfedge_descriptor e_ij = prev(h,pmesh);
-          halfedge_descriptor e_ik = next(opposite(h,pmesh),pmesh);
-          halfedge_descriptor e_jk = prev(opposite(next(h,pmesh),pmesh),pmesh);
-
-          if(border_edges.find(e_ij) == border_edges.end()){
-            relax(e_ij);
-          }
-          if(border_edges.find(e_ik) == border_edges.end()){
-            relax(e_ik);
-          }
-          if(border_edges.find(e_jk) == border_edges.end()){
-            relax(e_jk);
-          }
-      }
-    }
-    return !new_faces.empty();
-  }
-
-  template<typename FaceRange>
-  bool relax(const FaceRange& faces,
-             const std::vector<face_descriptor>& new_faces,
-             const std::set<halfedge_descriptor>& border_edges)
-  {
-    int flips = 0;
-    std::list<halfedge_descriptor> interior_edges;
-    std::set<halfedge_descriptor> included_map; 
-
-    collect_interior_edges(faces, border_edges, interior_edges, included_map);
-    collect_interior_edges(new_faces, border_edges, interior_edges, included_map);
-
-    CGAL_TRACE_STREAM << "Test " << interior_edges.size() << " edges " << std::endl;
-    //do not just use std::set (included_map) for iteration, the order effects the output (we like to make it deterministic)
-    BOOST_FOREACH(halfedge_descriptor h, interior_edges)
-    {
-      if (relax(h)) {
-        ++flips;
-      }
-    }
-
-    CGAL_TRACE_STREAM << "|flips| = " << flips << std::endl;
-    return flips > 0;
-  }
-
-  template<typename FaceRange>
-  void collect_interior_edges(const FaceRange& faces,
-        const std::set<halfedge_descriptor>& border_edges,
-        std::list<halfedge_descriptor>& interior_edges,
-        std::set<halfedge_descriptor>& included_map)
-  {
-    BOOST_FOREACH(face_descriptor fd, faces)
-    {
-      Halfedge_around_face_circulator<PolygonMesh> circ(halfedge(fd, pmesh), pmesh), done(circ);
-      do {
-        halfedge_descriptor h = *circ;
-        if (border_edges.find(h) == border_edges.end()){
-          // do not remove included_map and use if(&*h < &*oh) { interior_edges.push_back(h) } 
-          // which will change the order of edges from run to run
-          halfedge_descriptor oh = opposite(h, pmesh);
-          halfedge_descriptor h_rep = (h < oh) ? h : oh; // AF: was &*h < &*oh
-          if (included_map.insert(h_rep).second) {
-            interior_edges.push_back(h_rep);
-          }
-        }
-      } while (++circ != done);
-    }
-  }
-
-  double average_length(vertex_descriptor vh,
-                        const std::set<face_descriptor>& interior_map, 
-                        bool accept_internal_facets)
-  {
-    const Point_3& vp = vpmap[vh]; 
-    Halfedge_around_target_circulator<PolygonMesh> circ(halfedge(vh,pmesh),pmesh), done(circ);
-    int deg = 0;
-    double sum = 0;
-    do {
-      face_descriptor f(face(*circ,pmesh)), f_op(face(opposite(*circ,pmesh),pmesh));
-
-      if(!accept_internal_facets) {
-        if(interior_map.find(f) != interior_map.end() && interior_map.find(f_op) != interior_map.end())
-        { continue; } // which means current edge is an interior edge and should not be included in scale attribute calculation
-      }
-
-      const Point_3& vq = vpmap[target(opposite(*circ,pmesh),pmesh)];
-      sum += CGAL::sqrt(CGAL::squared_distance(vp, vq));
-      ++deg;
-    } while(++circ != done);
-
-    CGAL_assertion(deg != 0); // this might happen when accept_internal_facets = false but there is
-    return sum/deg;
-  }
-
-  template<typename FaceRange>
-  void calculate_scale_attribute(const FaceRange& faces,
-                                 const std::set<face_descriptor>& interior_map,
-                                 std::map<vertex_descriptor, double>& scale_attribute,
-                                 bool accept_internal_facets) 
-  {
-    BOOST_FOREACH(face_descriptor fd, faces)
-    {
-      Halfedge_around_face_circulator<PolygonMesh> circ(halfedge(fd,pmesh),pmesh), done(circ);
-      do {
-        vertex_descriptor v = target(*circ,pmesh);
-        std::pair<typename std::map<vertex_descriptor, double>::iterator, bool> v_insert 
-          = scale_attribute.insert(std::make_pair(v, 0));
-        if(!v_insert.second) { continue; } // already calculated
-        v_insert.first->second = average_length(v, interior_map, accept_internal_facets);
-      } while(++circ != done);
-    }
-  }
-
-  template<typename FaceRange>
-  bool contain_internal_facets(const FaceRange& faces,
-                               const std::set<face_descriptor>& interior_map) const
-  {
-    BOOST_FOREACH(face_descriptor fd, faces)
-    {
-      Halfedge_around_face_circulator<PolygonMesh> circ(halfedge(fd,pmesh),pmesh), done(circ);
-      do {
-        Halfedge_around_target_circulator<PolygonMesh> circ_v(*circ,pmesh), done_v(circ_v);
-        bool internal_v = true;
-        do {
-          face_descriptor f(face(*circ,pmesh)), f_op(face(opposite(*circ_v,pmesh),pmesh));
-
-          if(interior_map.find(f) == interior_map.end() || interior_map.find(f_op) == interior_map.end()) {
-            internal_v = false;
-            break;
-          } 
-        } while(++circ_v != done_v);
-
-        if(internal_v) { return true; }
-      } while(++circ != done);
-    }
-    return false;
-  }
-
-public:
-  Refine_Polyhedron_3(PolygonMesh& pmesh
-                    , VertexPointMap vpmap_)
-    : pmesh(pmesh)
-    , vpmap(vpmap_)
-  {}
-
-  template<class FaceRange, class FacetOutputIterator, class VertexOutputIterator>
-  void refine(const FaceRange& faces,
-              FacetOutputIterator& facet_out,
-              VertexOutputIterator& vertex_out,
-              double alpha)
-  {
-      // do not use just std::set, the order effects the output (for the same input we want to get same output)
-    std::set<face_descriptor> interior_map(boost::begin(faces), boost::end(faces));
-
-    // store boundary edges - to be used in relax 
-    std::set<halfedge_descriptor> border_edges;
-    BOOST_FOREACH(face_descriptor f, faces)
-    {
-      Halfedge_around_face_circulator<PolygonMesh> circ(halfedge(f,pmesh),pmesh), done(circ);
-      do {
-        if(interior_map.find(face(opposite(*circ,pmesh),pmesh)) == interior_map.end()) {
-          border_edges.insert(*circ);
-        }
-      } while(++circ != done);
-    }
-
-    // check whether there is any need to accept internal facets
-    bool accept_internal_facets = contain_internal_facets(faces, interior_map);
-    std::map<vertex_descriptor, double> scale_attribute;
-    calculate_scale_attribute(faces, interior_map, scale_attribute, accept_internal_facets);
-
-    std::vector<face_descriptor> all_faces(boost::begin(faces), boost::end(faces));
-    CGAL::Timer total_timer; total_timer.start();
-    for(int i = 0; i < 10; ++i)
-    {
-      std::vector<face_descriptor> new_faces;
-      CGAL::Timer timer; timer.start();
-      bool is_subdivided = subdivide(all_faces, border_edges, scale_attribute, vertex_out, facet_out, new_faces, alpha);
-      CGAL_TRACE_STREAM << "**Timer** subdivide() :" << timer.time() << std::endl; timer.reset();
-      if(!is_subdivided)
-        break;
-
-      bool is_relaxed = relax(faces, new_faces, border_edges);
-      CGAL_TRACE_STREAM << "**Timer** relax() :" << timer.time() << std::endl;
-      if(!is_relaxed)
-        break;
-      all_faces.insert(all_faces.end(), new_faces.begin(), new_faces.end());
-    }
-
-    CGAL_TRACE_STREAM << "**Timer** TOTAL: " << total_timer.time() << std::endl;
-  }
-
-}; //end class Refine_Polyhedron_3
-
-}//namespace internal
-
-}//namespace Polygon_mesh_processing
-
-}//namespace CGAL
-
-#endif //CGAL_POLYGON_MESH_PROCESSING_REFINE_POLYHEDRON_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/measure.h b/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/measure.h
deleted file mode 100644
index 69a18f5..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/measure.h
+++ /dev/null
@@ -1,418 +0,0 @@
-// Copyright (c) 2015 GeometryFactory (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Andreas Fabri
-
-#ifndef CGAL_POLYGON_MESH_PROCESSING_MEASURE_H
-#define CGAL_POLYGON_MESH_PROCESSING_MEASURE_H
-
-#include <CGAL/boost/graph/iterator.h>
-#include <CGAL/boost/graph/helpers.h>
-#include <CGAL/boost/graph/properties.h>
-#include <boost/graph/graph_traits.hpp>
-
-#include <CGAL/Polygon_mesh_processing/internal/named_function_params.h>
-#include <CGAL/Polygon_mesh_processing/internal/named_params_helper.h>
-
-#ifdef DOXYGEN_RUNNING
-#define CGAL_PMP_NP_TEMPLATE_PARAMETERS NamedParameters
-#define CGAL_PMP_NP_CLASS NamedParameters
-#endif
-
-namespace CGAL {
-
-namespace Polygon_mesh_processing {
-
-  /**
-  * \ingroup measure_grp
-  * computes the length of an edge of a given polygon mesh.
-  * The edge is given by one of its halfedges, or the edge itself.
-  *
-  * @tparam PolygonMesh a model of `HalfedgeGraph` that has an internal property map
-  *         for `CGAL::vertex_point_t`
-  * @tparam NamedParameters a sequence of \ref namedparameters
-  *
-  * @param h one halfedge of the edge to compute the length
-  * @param pmesh the polygon mesh to which `h` belongs
-  * @param np optional sequence of \ref namedparameters among the ones listed below
-  *
-  * \cgalNamedParamsBegin
-  *    \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh` \cgalParamEnd
-  * \cgalNamedParamsEnd
-  *
-  * @return the length of `h`. The return type `FT` is a number type. It is
-  * either deduced from the `geom_traits` \ref namedparameters if provided,
-  * or the geometric traits class deduced from the point property map
-  * of `pmesh`.
-  *
-  * @sa `face_border_length()`
-  */
-  template<typename PolygonMesh,
-           typename NamedParameters>
-#ifdef DOXYGEN_RUNNING
-  FT
-#else
-  typename GetGeomTraits<PolygonMesh, NamedParameters>::type::FT
-#endif
-  edge_length(typename boost::graph_traits<PolygonMesh>::halfedge_descriptor h
-              , const PolygonMesh& pmesh
-              , const NamedParameters& np)
-  {
-    using boost::choose_const_pmap;
-    using boost::get_param;
-
-    typename GetVertexPointMap<PolygonMesh, NamedParameters>::const_type
-    vpm = choose_const_pmap(get_param(np, CGAL::vertex_point),
-                            pmesh,
-                            CGAL::vertex_point);
-
-    return CGAL::sqrt(CGAL::squared_distance(get(vpm, source(h, pmesh)),
-                                             get(vpm, target(h, pmesh))));
-  }
-
-  template<typename PolygonMesh>
-  typename CGAL::Kernel_traits<typename property_map_value<PolygonMesh,
-    CGAL::vertex_point_t>::type>::Kernel::FT
-  edge_length(typename boost::graph_traits<PolygonMesh>::halfedge_descriptor h
-            , const PolygonMesh& pmesh)
-  {
-    return edge_length(h, pmesh,
-      CGAL::Polygon_mesh_processing::parameters::all_default());
-  }
-  // edge overloads
-  template<typename PolygonMesh,
-           typename NamedParameters>
-  typename GetGeomTraits<PolygonMesh, NamedParameters>::type::FT
-  edge_length(typename boost::graph_traits<PolygonMesh>::edge_descriptor e
-              , const PolygonMesh& pmesh
-              , const NamedParameters& np)
-  {
-    return edge_length(halfedge(e,pmesh), pmesh, np);
-  }
-
-  template<typename PolygonMesh>
-  typename CGAL::Kernel_traits<typename property_map_value<PolygonMesh,
-    CGAL::vertex_point_t>::type>::Kernel::FT
-  edge_length(typename boost::graph_traits<PolygonMesh>::edge_descriptor e
-            , const PolygonMesh& pmesh)
-  {
-    return edge_length(halfedge(e,pmesh), pmesh);
-  }
-
-  /**
-  * \ingroup measure_grp
-  * computes the length of the border polyline
-  * that contains a given halfedge.
-  *
-  * @tparam PolygonMesh a model of `HalfedgeGraph` that has an internal property map
-  *         for `CGAL::vertex_point_t`
-  * @tparam NamedParameters a sequence of \ref namedparameters
-  *
-  * @param h a halfedge of the border polyline of which the length is computed
-  * @param pmesh the polygon mesh to which `h` belongs
-  * @param np optional sequence of \ref namedparameters among the ones listed below
-  *
-  * \cgalNamedParamsBegin
-  *    \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh` \cgalParamEnd
-  * \cgalNamedParamsEnd
-  *
-  * @return the length of the sequence of border edges of `face(h, pmesh)`.
-  * The return type `FT` is a number type. It is
-  * either deduced from the `geom_traits` \ref namedparameters if provided,
-  * or the geometric traits class deduced from the point property map
-  * of `pmesh`.
-  *
-  * @sa `edge_length()`
-  */
-  template<typename PolygonMesh,
-           typename NamedParameters>
-#ifdef DOXYGEN_RUNNING
-   FT
-#else
-  typename GetGeomTraits<PolygonMesh, NamedParameters>::type::FT
-#endif
-  face_border_length(
-              typename boost::graph_traits<PolygonMesh>::halfedge_descriptor h
-              , const PolygonMesh& pmesh
-              , const NamedParameters& np)
-  {
-    double result = 0.;
-    BOOST_FOREACH(typename boost::graph_traits<PolygonMesh>::halfedge_descriptor haf,
-                  halfedges_around_face(h, pmesh))
-    {
-      result += edge_length(haf, pmesh, np);
-    }
-    return result;
-  }
-
-  template<typename PolygonMesh>
-  typename CGAL::Kernel_traits<typename property_map_value<PolygonMesh,
-    CGAL::vertex_point_t>::type>::Kernel::FT
-  face_border_length(
-              typename boost::graph_traits<PolygonMesh>::halfedge_descriptor h
-              , const PolygonMesh& pmesh)
-  {
-    return face_border_length(h, pmesh,
-      CGAL::Polygon_mesh_processing::parameters::all_default());
-  }
-
-
-  /**
-  * \ingroup measure_grp
-  * computes the area of a face of a given
-  * triangulated surface mesh.
-  *
-  * @tparam TriangleMesh a model of `HalfedgeGraph` that has an internal property map
-  *         for `CGAL::vertex_point_t`
-  * @tparam NamedParameters a sequence of \ref namedparameters
-  *
-  * @param f the face of which the area is computed
-  * @param tmesh the triangulated surface mesh to which `f` belongs
-  * @param np optional sequence of \ref namedparameters among the ones listed below
-  *
-  * \cgalNamedParamsBegin
-  *    \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh` \cgalParamEnd
-  *  \cgalParamBegin{geom_traits} a geometric traits class instance \cgalParamEnd
-  * \cgalNamedParamsEnd
-  *
-  *@pre `f != boost::graph_traits<TriangleMesh>::%null_face()`
-  *
-  * @return the area of `f`.
-  * The return type `FT` is a number type. It is
-  * either deduced from the `geom_traits` \ref namedparameters if provided,
-  * or the geometric traits class deduced from the point property map
-  * of `tmesh`.
-  *
-  * @sa `area()`
-  */
-  template<typename TriangleMesh,
-           typename CGAL_PMP_NP_TEMPLATE_PARAMETERS>
-#ifdef DOXYGEN_RUNNING
-  FT
-#else
-  typename GetGeomTraits<TriangleMesh, CGAL_PMP_NP_CLASS>::type::FT
-#endif
-  face_area(typename boost::graph_traits<TriangleMesh>::face_descriptor f
-            , const TriangleMesh& tmesh
-            , const CGAL_PMP_NP_CLASS& np)
-  {
-    using boost::choose_const_pmap;
-    using boost::get_param;
-
-    CGAL_precondition(boost::graph_traits<TriangleMesh>::null_face() != f);
-
-    typename GetVertexPointMap<TriangleMesh, CGAL_PMP_NP_CLASS>::const_type
-    vpm = choose_const_pmap(get_param(np, CGAL::vertex_point),
-                            tmesh,
-                            CGAL::vertex_point);
-
-    typedef typename boost::graph_traits<TriangleMesh>::halfedge_descriptor halfedge_descriptor;
-    halfedge_descriptor hd = halfedge(f, tmesh);
-    halfedge_descriptor nhd = next(hd, tmesh);
-
-    typename GetGeomTraits<TriangleMesh, CGAL_PMP_NP_CLASS>::type traits;
-
-    return traits.compute_area_3_object()(get(vpm, source(hd, tmesh)),
-                                          get(vpm, target(hd, tmesh)),
-                                          get(vpm, target(nhd, tmesh)));
-  }
-
-  template<typename TriangleMesh>
-  typename CGAL::Kernel_traits<typename property_map_value<TriangleMesh,
-    CGAL::vertex_point_t>::type>::Kernel::FT
-  face_area(typename boost::graph_traits<TriangleMesh>::face_descriptor f
-            , const TriangleMesh& tmesh)
-  {
-    return face_area(f, tmesh,
-      CGAL::Polygon_mesh_processing::parameters::all_default());
-  }
-
-  /**
-  * \ingroup measure_grp
-  * computes the area of a range of faces of a given
-  * triangulated surface mesh.
-  *
-  * @tparam FaceRange range of `boost::graph_traits<PolygonMesh>::%face_descriptor`,
-          model of `Range`.
-          Its iterator type is `InputIterator`.
-  * @tparam TriangleMesh a model of `HalfedgeGraph` that has an internal property map
-  *         for `CGAL::vertex_point_t`
-  * @tparam NamedParameters a sequence of \ref namedparameters
-  *
-  * @param face_range the range of faces of which the area is computed
-  * @param tmesh the triangulated surface mesh to which the faces of `face_range` belong
-  * @param np optional sequence of \ref namedparameters among the ones listed below
-  *
-  * \cgalNamedParamsBegin
-  *    \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh` \cgalParamEnd
-  *  \cgalParamBegin{geom_traits} a geometric traits class instance \cgalParamEnd
-  * \cgalNamedParamsEnd
-  *
-  * @return sum of face areas of `faces`.
-  * The return type `FT` is a number type. It is
-  * either deduced from the `geom_traits` \ref namedparameters if provided,
-  * or the geometric traits class deduced from the point property map
-  * of `tmesh`.
-  *
-  * @sa `face_area()`
-  */
-  template<typename FaceRange,
-           typename TriangleMesh,
-           typename CGAL_PMP_NP_TEMPLATE_PARAMETERS>
-#ifdef DOXYGEN_RUNNING
-  FT
-#else
-  typename GetGeomTraits<TriangleMesh, CGAL_PMP_NP_CLASS>::type::FT
-#endif
-  area(FaceRange face_range
-     , const TriangleMesh& tmesh
-     , const CGAL_PMP_NP_CLASS& np)
-  {
-    typedef typename boost::graph_traits<TriangleMesh>::face_descriptor face_descriptor;
-    double result = 0.;
-    BOOST_FOREACH(face_descriptor f, face_range)
-    {
-      result += face_area(f, tmesh, np);
-    }
-    return result;
-  }
-
-  template<typename FaceRange, typename TriangleMesh>
-  double area(FaceRange face_range, const TriangleMesh& tmesh)
-  {
-    return area(face_range, tmesh,
-      CGAL::Polygon_mesh_processing::parameters::all_default());
-  }
-
-  /**
-  * \ingroup measure_grp
-  * computes the surface area of a triangulated surface mesh.
-  *
-  * @tparam TriangleMesh a model of `HalfedgeGraph` that has an internal property map
-  *         for `CGAL::vertex_point_t`
-  * @tparam NamedParameters a sequence of \ref namedparameters
-  *
-  * @param tmesh the triangulated surface mesh
-  * @param np optional sequence of \ref namedparameters among the ones listed below
-  *
-  * \cgalNamedParamsBegin
-  *    \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh` \cgalParamEnd
-  *  \cgalParamBegin{geom_traits} a geometric traits class instance \cgalParamEnd
-  * \cgalNamedParamsEnd
-  *
-  * @return the surface area of `tmesh`.
-  * The return type `FT` is a number type. It is
-  * either deduced from the `geom_traits` \ref namedparameters if provided,
-  * or the geometric traits class deduced from the point property map
-  * of `tmesh`.
-  *
-  * @sa `face_area()`
-  */
-  template<typename TriangleMesh
-         , typename CGAL_PMP_NP_TEMPLATE_PARAMETERS>
-#ifdef DOXYGEN_RUNNING
-  FT
-#else
-  typename GetGeomTraits<TriangleMesh, CGAL_PMP_NP_CLASS>::type::FT
-#endif
-  area(const TriangleMesh& tmesh, const CGAL_PMP_NP_CLASS& np)
-  {
-    return area(faces(tmesh), tmesh, np);
-  }
-
-  template<typename TriangleMesh>
-  typename CGAL::Kernel_traits<typename property_map_value<TriangleMesh,
-    CGAL::vertex_point_t>::type>::Kernel::FT
-  area(const TriangleMesh& tmesh)
-  {
-    return area(faces(tmesh), tmesh);
-  }
-
-  /**
-  * \ingroup measure_grp
-  * computes the volume of the domain bounded by
-  * a closed triangulated surface mesh.
-  *
-  * @tparam TriangleMesh a model of `HalfedgeGraph` that has an internal property map
-  *         for `CGAL::vertex_point_t`
-  * @tparam NamedParameters a sequence of \ref namedparameters
-  *
-  * @param tmesh the closed triangulated surface mesh bounding the volume
-  * @param np optional sequence of \ref namedparameters among the ones listed below
-  *
-  * @pre `tmesh` is closed
-  *
-  * \cgalNamedParamsBegin
-  *  \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh` \cgalParamEnd
-  *  \cgalParamBegin{geom_traits} a geometric traits class instance \cgalParamEnd
-  * \cgalNamedParamsEnd
-  *
-  * @return the volume bounded by `tmesh`.
-  * The return type `FT` is a number type. It is
-  * either deduced from the `geom_traits` \ref namedparameters if provided,
-  * or the geometric traits class deduced from the point property map
-  * of `tmesh`.
-  */
-  template<typename TriangleMesh
-         , typename CGAL_PMP_NP_TEMPLATE_PARAMETERS>
-#ifdef DOXYGEN_RUNNING
-  FT
-#else
-  typename GetGeomTraits<TriangleMesh, CGAL_PMP_NP_CLASS>::type::FT
-#endif
-  volume(const TriangleMesh& tmesh, const CGAL_PMP_NP_CLASS& np)
-  {
-    CGAL_assertion(is_triangle_mesh(tmesh));
-    CGAL_assertion(is_closed(tmesh));
-
-    using boost::choose_const_pmap;
-    using boost::get_param;
-
-    typename GetVertexPointMap<TriangleMesh, CGAL_PMP_NP_CLASS>::const_type
-      vpm = choose_const_pmap(get_param(np, CGAL::vertex_point),
-                              tmesh,
-                              CGAL::vertex_point);
-    typename GetGeomTraits<TriangleMesh, CGAL_PMP_NP_CLASS>::type::Point_3
-      origin(0, 0, 0);
-
-    typedef typename boost::graph_traits<TriangleMesh>::face_descriptor face_descriptor;
-
-    double volume = 0.;
-    BOOST_FOREACH(face_descriptor f, faces(tmesh))
-    {
-      volume += CGAL::volume(origin,
-        get(vpm, target(halfedge(f, tmesh), tmesh)),
-        get(vpm, target(next(halfedge(f, tmesh), tmesh), tmesh)),
-        get(vpm, target(prev(halfedge(f, tmesh), tmesh), tmesh)));
-    }
-    return volume;
-  }
-
-  template<typename TriangleMesh>
-  typename CGAL::Kernel_traits<typename property_map_value<TriangleMesh,
-    CGAL::vertex_point_t>::type>::Kernel::FT
-  volume(const TriangleMesh& tmesh)
-  {
-    return volume(tmesh,
-      CGAL::Polygon_mesh_processing::parameters::all_default());
-  }
-
-}
-}
-
-#endif // CGAL_POLYGON_MESH_PROCESSING_MEASURE_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/orient_polygon_soup.h b/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/orient_polygon_soup.h
deleted file mode 100644
index 4368a46..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/orient_polygon_soup.h
+++ /dev/null
@@ -1,426 +0,0 @@
-// Copyright (c) 2009-2015 GeometryFactory (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Laurent Rineau and Sebastien Loriot
-
-
-#ifndef CGAL_POLYGON_MESH_PROCESSING_ORIENT_POLYGON_SOUP
-#define CGAL_POLYGON_MESH_PROCESSING_ORIENT_POLYGON_SOUP
-
-#include <CGAL/tuple.h>
-#include <CGAL/array.h>
-#include <CGAL/assertions.h>
-#include <boost/foreach.hpp>
-
-#include <set>
-#include <map>
-#include <stack>
-#include <vector>
-#include <algorithm>
-#include <iostream>
-
-namespace CGAL {
-
-namespace Polygon_mesh_processing {
-
-namespace internal {
-
-template<class Point_3, class Polygon_3>
-class Polygon_soup_orienter
-{
-/// Index types
-  typedef typename std::iterator_traits<
-            typename Polygon_3::iterator >::value_type                     V_ID;
-  typedef typename std::vector<Polygon_3>::size_type                       P_ID;
-//  typedef int                                                             CC_ID;
-  typedef std::pair<V_ID, V_ID>                                       V_ID_pair;
-/// Container types
-  typedef std::vector<Point_3>                                           Points;
-  typedef std::vector<Polygon_3>                                       Polygons;
-  typedef std::map<V_ID_pair, std::set<P_ID> >                         Edge_map;
-  typedef typename Edge_map::iterator                         Edge_map_iterator;
-  typedef std::set<V_ID_pair>                                      Marked_edges;
-
-/// Data members
-  Points& points;             //< the set of input points
-  Polygons& polygons;         //< the set of input polygons
-  Edge_map edges;             //< the set of edges of the input polygons
-  Marked_edges marked_edges;  //< the set of singular edges or edges incident
-                              //<   to non-compatible orientation polygons
-
-  /// for each polygon referenced by its position in `polygons`, indicates
-  /// the connected component it belongs too after orientation.
-//  std::vector< CC_ID > polygon_cc_id;
-  /// for each vertex, indicates the list of polygon containing it
-  std::vector< std::vector<P_ID> > incident_polygons_per_vertex;
-
-/// Utility functions
-  V_ID_pair canonical_edge(V_ID i, V_ID j)
-  {
-    return i<j ? V_ID_pair(i,j):V_ID_pair(j,i);
-  }
-
-  bool is_edge_marked(V_ID i, V_ID j)
-  {
-    return marked_edges.count(canonical_edge(i,j)) > 0;
-  }
-
-  void set_edge_marked(V_ID i, V_ID j)
-  {
-    marked_edges.insert(canonical_edge(i,j));
-  }
-
-  cpp11::array<V_ID,3>
-  get_neighbor_vertices(V_ID v_id, P_ID polygon_index)
-  {
-    std::size_t nbv = polygons[polygon_index].size(), pvid=0;
-    for (; pvid!=nbv; ++pvid)
-      if (v_id==polygons[polygon_index][pvid]) break;
-    CGAL_assertion( pvid!=nbv );
-    V_ID prev = polygons[polygon_index][ (pvid+nbv-1)%nbv ];
-    V_ID next = polygons[polygon_index][ (pvid+1)%nbv ];
-    return make_array(prev,v_id,next);
-  }
-
-  std::pair<V_ID,P_ID>
-  next_cw_vertex_around_source(V_ID src, V_ID tgt)
-  {
-    typedef std::pair<V_ID,P_ID> VID_and_PID;
-    if ( is_edge_marked(src,tgt) ) return VID_and_PID(src,300612);
-    Edge_map_iterator em_it=edges.find(V_ID_pair(tgt, src));
-    if ( em_it==edges.end() ) return VID_and_PID(src,300612);// the vertex is on the border
-    CGAL_assertion(em_it->second.size()==1);
-    P_ID p_id = *(em_it->second.begin());
-    return VID_and_PID(get_neighbor_vertices(src, p_id)[2], p_id);
-  }
-
-  std::pair<V_ID,P_ID>
-  next_ccw_vertex_around_target(V_ID src, V_ID tgt)
-  {
-    typedef std::pair<V_ID,P_ID> VID_and_PID;
-    if ( is_edge_marked(src,tgt) ) return VID_and_PID(tgt,300612);
-    Edge_map_iterator em_it=edges.find(V_ID_pair(tgt, src));
-    if ( em_it==edges.end() ) return VID_and_PID(tgt,300612);// the vertex is on the border
-    CGAL_assertion(em_it->second.size()==1);
-    P_ID p_id = *(em_it->second.begin());
-    return VID_and_PID(get_neighbor_vertices(tgt, p_id)[0], p_id);
-  }
-
-  void inverse_orientation(const std::size_t index) {
-    std::reverse(polygons[index].begin(), polygons[index].end());
-  }
-
-  void replace_vertex_index_in_polygon(
-    std::size_t polygon_id,
-    V_ID old_index,
-    V_ID new_index)
-  {
-    BOOST_FOREACH(V_ID& i, polygons[polygon_id])
-      if( i==old_index )
-        i=new_index;
-  }
-
-/// Functions filling containers
-  void fill_edge_map() {
-    // Fill edges
-    edges.clear();
-    for(P_ID i = 0; i < polygons.size(); ++i)
-    {
-      const P_ID size = polygons[i].size();
-      for(P_ID j = 0; j < size; ++j) {
-        V_ID i0 = polygons[i][j];
-        V_ID i1 = polygons[i][ (j+1)%size];
-        edges[V_ID_pair(i0, i1)].insert(i);
-      }
-    }
-
-    // Fill non-manifold edges
-    marked_edges.clear();
-    for(P_ID i = 0; i < polygons.size(); ++i)
-    {
-      const P_ID size = polygons[i].size();
-      for(P_ID j = 0; j < size; ++j) {
-        V_ID i0 = polygons[i][j];
-        V_ID i1 = polygons[i][ (j+1)%size ];
-
-        std::size_t nb_edges = 0;
-        Edge_map_iterator em_it = edges.find( V_ID_pair(i0, i1) );
-        if ( em_it!=edges.end() ) nb_edges += em_it->second.size();
-        em_it = edges.find( V_ID_pair(i1, i0) );
-        if ( em_it!=edges.end() ) nb_edges += em_it->second.size();
-
-        if( nb_edges > 2 ) set_edge_marked(i0,i1);
-      }
-    }
-  }
-
-  void fill_incident_polygons_per_vertex()
-  {
-    incident_polygons_per_vertex.resize(points.size());
-
-    P_ID nb_polygons=polygons.size();
-    for(P_ID ip=0; ip<nb_polygons; ++ip)
-    {
-      BOOST_FOREACH(V_ID iv, polygons[ip])
-        incident_polygons_per_vertex[iv].push_back(ip);
-    }
-  }
-
-public:
-
-  Polygon_soup_orienter(Points& points, Polygons& polygons)
-    : points(points), polygons(polygons)
-  {
-    fill_edge_map();
-  }
-
-  /// We try to orient polygon consistently by walking in the dual graph, from
-  /// a not yet re-oriented polygon.
-  /// We have an edge between two polygons if they share an edge, and this edge
-  /// is shared by exactly two polygons. While walking along an edge, we reorient
-  /// the polygon we walked in if its orientation is not compatible with the one
-  /// we come from.
-  /// If the polygon was already marked as oriented, then we cut the dual edge
-  /// in the graph and the primal edge is marked.
-  /// At the same time, we assign an id to each polygon in the same connected
-  /// componenet of the dual graph.
-  void orient()
-  {
-    std::vector<bool> oriented;
-    std::stack<std::size_t> stack;
-//    polygon_cc_id.resize(polygons.size(), -1);
-
-    // We first consider all polygons as non-oriented
-    oriented.resize(polygons.size());
-
-    P_ID polygon_index = 0;
-
-//    CC_ID current_cc_index=-1;
-    while (polygon_index != polygons.size())
-    {
-      // We look for the first polygon not already oriented
-      while ( polygon_index != polygons.size() && oriented[polygon_index] ) {
-        ++polygon_index;
-      }
-      if(polygon_index == polygons.size()) break;
-
-//      ++ current_cc_index; // visit a new connected component
-
-      // we visit the connected component by crossing edges manifold edges
-      oriented[polygon_index] = true;
-      stack.push(polygon_index);
-      while(! stack.empty() )
-      {
-        const P_ID to_be_oriented_index = stack.top();
-        stack.pop();
-
-//        CGAL_assertion(polygon_cc_id[to_be_oriented_index]==-1);
-//        polygon_cc_id[to_be_oriented_index]=current_cc_index;
-
-        const P_ID size = polygons[to_be_oriented_index].size();
-        for(P_ID ih = 0 ; ih < size ; ++ih) {
-          P_ID ihp1 = (ih+1)%size;
-          const V_ID i1 = polygons[to_be_oriented_index][ih];
-          const V_ID i2 = polygons[to_be_oriented_index][ihp1];
-
-          if( is_edge_marked(i1,i2) ) continue;
-
-          // edge (i1,i2)
-          Edge_map_iterator it_same_orient = edges.find(V_ID_pair(i1, i2));
-          // edges (i2,i1)
-          Edge_map_iterator it_other_orient = edges.find(V_ID_pair(i2, i1));
-
-          CGAL_assertion(it_same_orient != edges.end());
-          CGAL_assertion(it_other_orient == edges.end() ||
-                         it_other_orient->second.size()==1);
-
-          if (it_same_orient->second.size() > 1)
-          {
-            CGAL_assertion(it_other_orient == edges.end());
-            // one neighbor but with the same orientation
-            P_ID index = *(it_same_orient->second.begin());
-            if(index == to_be_oriented_index)
-              index = *(++it_same_orient->second.begin());
-            if(oriented[index])
-            {
-              // polygon already oriented but its orientation is not compatible ---> mark the edge and continue
-              set_edge_marked(i1,i2);
-              continue; // next edge
-            }
-
-            // reverse the orientation
-            const P_ID size = polygons[index].size();
-            for(P_ID j = 0; j < size; ++j) {
-              V_ID i0 = polygons[index][j];
-              V_ID i1 = polygons[index][(j+1)%size];
-              Edge_map_iterator em_it = edges.find(V_ID_pair(i0, i1));
-              CGAL_assertion_code(const bool r = )
-                em_it->second.erase(index)
-              CGAL_assertion_code(!= 0);
-              CGAL_assertion(r);
-              if ( em_it->second.empty() ) edges.erase(em_it);
-            }
-            inverse_orientation(index);
-            for(P_ID j = 0; j < size; ++j) {
-              V_ID i0 = polygons[index][j];
-              V_ID i1 = polygons[index][(j+1)%size];
-              edges[V_ID_pair(i0, i1)].insert(index);
-            }
-            // "inverse the orientation of polygon #index
-            oriented[index] = true;
-            stack.push(index);
-          }
-          else{
-            if( it_other_orient != edges.end() ){
-              CGAL_assertion(it_same_orient->second.size() == 1);
-              CGAL_assertion(it_other_orient->second.size() == 1);
-              // one polygon, same orientation
-              const P_ID index = *(it_other_orient->second.begin());
-              if(oriented[index]) continue; //nothing todo already processed and correctly oriented
-              oriented[index] = true;
-              // "keep the orientation of polygon #index
-              stack.push(index);
-            }
-          }
-        } // end for on all edges of one
-      } // end while loop on the polygons of the connected component
-    } // end while loop on all non-oriented polygons remaining
-  }
-
-  /// A vertex is said to be singular if its link is neither a cycle nor a chain,
-  /// but several cycles and chains.
-  /// For each such vertex v, we consider each set of polygons incident to v
-  /// and sharing a non-marked edge incident to v. A copy of v is assigned to
-  /// each but one set of incident polygons.
-  void duplicate_singular_vertices()
-  {
-    fill_incident_polygons_per_vertex();
-    std::vector< std::pair<V_ID, std::vector<P_ID> > > vertices_to_duplicate;
-
-    V_ID nbv = static_cast<V_ID>( points.size() );
-    for (V_ID v_id = 0; v_id < nbv; ++v_id)
-    {
-      const std::vector< P_ID >& incident_polygons = incident_polygons_per_vertex[v_id];
-
-      if ( incident_polygons.empty() ) continue; //isolated vertex
-      std::set<P_ID> visited_polygons;
-
-      bool first_pass = true;
-      BOOST_FOREACH(P_ID p_id, incident_polygons)
-      {
-        if ( !visited_polygons.insert(p_id).second ) continue; // already visited
-
-        if (!first_pass)
-        {
-          vertices_to_duplicate.push_back(std::pair<V_ID, std::vector<P_ID> >());
-          vertices_to_duplicate.back().first=v_id;
-        }
-
-        const cpp11::array<V_ID,3>& neighbors = get_neighbor_vertices(v_id,p_id);
-
-        V_ID next = neighbors[2];
-
-        if( !first_pass)
-          vertices_to_duplicate.back().second.push_back(p_id);
-
-        do{
-          P_ID other_p_id;
-          cpp11::tie(next, other_p_id) = next_cw_vertex_around_source(v_id, next);
-          if (next==v_id) break;
-          visited_polygons.insert(other_p_id);
-          if( !first_pass)
-            vertices_to_duplicate.back().second.push_back(other_p_id);
-        }
-        while(next!=neighbors[0]);
-
-        if (next==v_id){
-          /// turn the otherway round
-          next = neighbors[0];
-          do{
-            P_ID other_p_id;
-            cpp11::tie(next, other_p_id) = next_ccw_vertex_around_target(next, v_id);
-            if (next==v_id) break;
-            visited_polygons.insert(other_p_id);
-            if( !first_pass)
-              vertices_to_duplicate.back().second.push_back(other_p_id);
-          }
-          while(true);
-        }
-        first_pass=false;
-      }
-    }
-
-    /// now duplicate the vertices
-    typedef std::pair<V_ID, std::vector<P_ID> > V_ID_and_Polygon_ids;
-    BOOST_FOREACH(const V_ID_and_Polygon_ids& vid_and_pids, vertices_to_duplicate)
-    {
-      V_ID new_index = static_cast<V_ID>(points.size());
-      points.push_back( points[vid_and_pids.first] );
-      BOOST_FOREACH(P_ID polygon_id, vid_and_pids.second)
-        replace_vertex_index_in_polygon(polygon_id, vid_and_pids.first, new_index);
-    }
-  }
-};
-} // namespace internal
-
-/**
- * \ingroup PMP_repairing_grp
- * tries to consistently orient a soup of polygons in 3D space.
- * When it is not possible to produce a combinatorial manifold surface,
- * some points are duplicated.
- * Because a polygon soup does not have any connectivity (each point
- * has as many occurences as the number of polygons it belongs to),
- * duplicating one point (or a pair of points)
- * amounts to duplicate the polygon to which it belongs.
- *
- * These points are either an endpoint of an edge incident to more
- * than two polygons, an endpoint of an edge between 
- * two polygons with incompatible orientations (during the re-orientation process),
- * or more generally a point \a p at which the intersection
- * of an infinitesimally small ball centered at \a p
- * with the polygons incident to it is not a topological disk.
- *
- * The algorithm is described in \cgalCite{gueziec2001cutting}.
- *
- * @tparam Point the point type
- * @tparam Polygon a `std::vector<std::size_t>` containing the indices
- *         of the points of the face
- *
- * @param points points of the soup of polygons. Some points might be pushed back to resolve
- *               non-manifold or non-orientability issues.
- * @param polygons each element in the vector describes a polygon using the index of the points in `points`.
- *                 If needed the order of the indices of a polygon might be reversed.
- * @return `true`  if the orientation operation succeded.
- * @return `false` if some points were duplicated, thus producing a self-intersecting polyhedron.
- *
- */
-template <class Point, class Polygon>
-bool orient_polygon_soup(std::vector<Point>& points,
-                         std::vector<Polygon>& polygons)
-{
-  std::size_t inital_nb_pts = points.size();
-  internal::Polygon_soup_orienter<Point, Polygon> orienter(points, polygons);
-  orienter.orient();
-  orienter.duplicate_singular_vertices();
-
-  return inital_nb_pts==points.size();
-}
-
-} }//end namespace CGAL::Polygon_mesh_processing
-
-#endif // CGAL_POLYGON_MESH_PROCESSING_ORIENT_POLYGON_SOUP
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h b/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h
deleted file mode 100644
index 7ab4762..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h
+++ /dev/null
@@ -1,162 +0,0 @@
-// Copyright (c) 2009-2013 GeometryFactory (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Laurent Rineau and Ilker O. Yaz
-
-#ifndef CGAL_POLYGON_MESH_PROCESSING_POLYGON_SOUP_TO_POLYGON_MESH
-#define CGAL_POLYGON_MESH_PROCESSING_POLYGON_SOUP_TO_POLYGON_MESH
-
-#include <CGAL/IO/generic_print_polyhedron.h>
-#include <CGAL/Polyhedron_incremental_builder_3.h>
-#include <CGAL/boost/graph/Euler_operations.h>
-#include <CGAL/property_map.h>
-#include <set>
-
-namespace CGAL
-{
-namespace Polygon_mesh_processing
-{
-namespace internal
-{
-template <typename PM
-        , typename Point
-        , typename Polygon>
-class Polygon_soup_to_polygon_mesh
-{
-  const std::vector<Point>& _points;
-  const std::vector<Polygon>& _polygons;
-
-  typedef typename boost::property_map<PM, CGAL::vertex_point_t>::type Vpmap;
-  typedef typename boost::property_traits<Vpmap>::value_type Point_3;
-
-  typedef typename boost::graph_traits<PM>::vertex_descriptor vertex_descriptor;
-  typedef typename boost::graph_traits<PM>::halfedge_descriptor halfedge_descriptor;
-  typedef typename boost::graph_traits<PM>::face_descriptor face_descriptor;
-
-public:
-  /**
-  * The constructor for modifier object.
-  * @param points points of the soup of polygons.
-  * @param polygons each element in the vector describes a polygon using the index of the points in the vector.
-  */
-  Polygon_soup_to_polygon_mesh(const std::vector<Point>& points,
-                               const std::vector<Polygon>& polygons)
-    : _points(points),
-      _polygons(polygons)
-  { }
-
-  void operator()(PM& pmesh)
-  {
-    Vpmap vpmap = get(CGAL::vertex_point, pmesh);
-
-    std::vector<vertex_descriptor> vertices(_points.size());
-    for (std::size_t i = 0, end = _points.size(); i < end; ++i)
-    {
-      Point_3 pi(_points[i][0], _points[i][1], _points[i][2]);
-      vertices[i] = add_vertex(pmesh);
-      put(vpmap, vertices[i], pi);
-    }
-
-    for (std::size_t i = 0, end = _polygons.size(); i < end; ++i)
-    {
-      const Polygon& polygon = _polygons[i];
-      const std::size_t size = polygon.size();
-
-      std::vector<vertex_descriptor> vr(size); //vertex range
-      vr.resize(size);
-      for (std::size_t j = 0; j < size; ++j)
-        vr[j] = vertices[polygon[j] ];
-
-      CGAL_assertion_code(face_descriptor fd = )
-      CGAL::Euler::add_face(vr, pmesh);
-      CGAL_assertion(fd != boost::graph_traits<PM>::null_face());
-    }
-  }
-};
-}//end namespace internal
-
-
-  /// \cond SKIP_IN_MANUAL
-  /**
-  * \ingroup PMP_repairing_grp
-  * returns `true` if the soup of polygons defines a valid polygon mesh
-  * that can be handled by `CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh()`.
-  *
-  * @tparam Polygon a `std::vector<std::size_t>` containing the indices
-  *         of the points of the polygon face
-  *
-  * @param polygons each element in the vector describes a polygon using the index of the vertices
-  *
-  */
-  template<class Polygon>
-  bool is_polygon_soup_a_polygon_mesh(const std::vector<Polygon>& polygons)
-  {
-    typedef typename std::iterator_traits<
-              typename Polygon::iterator >::value_type                   V_ID;
-
-    std::set< std::pair<V_ID, V_ID> > edge_set;
-    BOOST_FOREACH(const Polygon& polygon, polygons)
-    {
-      std::size_t nb_edges = polygon.size();
-      if (nb_edges<3) return false;
-      V_ID prev=polygon.back();
-      BOOST_FOREACH(V_ID id, polygon)
-        if (! edge_set.insert(std::pair<V_ID, V_ID>(prev,id)).second )
-          return false;
-        else
-          prev=id;
-    }
-
-    return true;
-  }
-  /// \endcond
-
-  /**
-  * \ingroup PMP_repairing_grp
-  * builds a polygon mesh from a soup of polygons.
-  * @pre the input polygon soup describes consistently oriented
-  * polygon mesh.
-  *
-  * @tparam PolygonMesh a model of `MutableFaceGraph` with an internal point property map
-  * @tparam Point a point type that has an operator `[]` to access coordinates
-  * @tparam Polygon a `std::vector<std::size_t>` containing the indices
-  *         of the points of the face
-  *
-  * @param points points of the soup of polygons
-  * @param polygons each element in the vector describes a polygon using the index of the points in `points`
-  * @param out the polygon mesh to be built
-  *
-  * \sa `CGAL::Polygon_mesh_processing::orient_polygon_soup()`
-  *
-  */
-  template<class PolygonMesh, class Point, class Polygon>
-  void polygon_soup_to_polygon_mesh(
-    const std::vector<Point>& points,
-    const std::vector<Polygon>& polygons,
-    PolygonMesh& out)
-  {
-    internal::Polygon_soup_to_polygon_mesh<PolygonMesh, Point, Polygon>
-      converter(points, polygons);
-    converter(out);
-  }
-
-}//end namespace Polygon_mesh_processing
-
-}// end namespace CGAL
-
-#endif // CGAL_POLYGON_MESH_PROCESSING_POLYGON_SOUP_TO_POLYGON_MESH
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/remesh.h b/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/remesh.h
deleted file mode 100644
index a21b59b..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/remesh.h
+++ /dev/null
@@ -1,278 +0,0 @@
-// Copyright (c) 2015 GeometryFactory (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Jane Tournois
-
-#ifndef CGAL_POLYGON_MESH_PROCESSING_REMESH_H
-#define CGAL_POLYGON_MESH_PROCESSING_REMESH_H
-
-#include <CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h>
-
-#include <CGAL/Polygon_mesh_processing/internal/named_function_params.h>
-#include <CGAL/Polygon_mesh_processing/internal/named_params_helper.h>
-
-namespace CGAL {
-
-namespace Polygon_mesh_processing {
-
-/*!
-* \ingroup PMP_meshing_grp
-* @brief remeshes a triangulated region of a polygon mesh.
-* This operation sequentially performs edge splits, edge collapses,
-* edge flips, Laplacian smoothing and projection to the initial surface
-* to generate a smooth mesh with a prescribed edge length.
-*
-* @tparam PolygonMesh model of `MutableFaceGraph` that 
-*         has an internal property map for `CGAL::vertex_point_t`.
-*         The descriptor types `boost::graph_traits<PolygonMesh>::%face_descriptor`
-*         and `boost::graph_traits<PolygonMesh>::%halfedge_descriptor` must be
-*         models of `Hashable`.
-* @tparam FaceRange range of `boost::graph_traits<PolygonMesh>::%face_descriptor`,
-          model of `Range`. Its iterator type is `InputIterator`.
-* @tparam NamedParameters a sequence of \ref namedparameters
-*
-* @param pmesh a polygon mesh with triangulated surface patches to be remeshed
-* @param faces the range of triangular faces defining one or several surface patches to be remeshed
-* @param target_edge_length the edge length that is targetted in the remeshed patch
-* @param np optional sequence of \ref namedparameters among the ones listed below
-*
-* @pre if constraints protection is activated, the constrained edges should
-* not be longer than 4/3*`target_edge_length`
-*
-* \cgalNamedParamsBegin
-*  \cgalParamBegin{vertex_point_map} the property map with the points associated
-*    to the vertices of `pmesh`. Instance of a class model of `ReadWritePropertyMap`.
-*  \cgalParamEnd
-*  \cgalParamBegin{number_of_iterations} the number of iterations for the
-*    sequence of atomic operations performed (listed in the above description)
-*  \cgalParamEnd
-*  \cgalParamBegin{geom_traits} a geometric traits class instance, model of `Kernel`
-*  \cgalParamEnd
-*  \cgalParamBegin{edge_is_constrained_map} a property map containing the
-*    constrained-or-not status of each edge of pmesh. A constrained edge can be splitted
-*    or collapsed, but not flipped, nor its endpoints moved by smoothing.
-*    Note that patch boundary edges (i.e. incident to only one face in the range)
-*    are always considered as constrained edges.
-*  \cgalParamEnd
-*  \cgalParamBegin{vertex_is_constrained_map} a property map containing the
-*    constrained-or-not status of each vertex of pmesh. A constrained vertex
-*    cannot be modified at all during remeshing
-*  \cgalParamEnd
-*  \cgalParamBegin{protect_constraints} If `true`, the edges set as constrained
-*     in `edge_is_constrained_map` (or by default the boundary edges)
-*     are not splitted nor collapsed during remeshing.
-*     Note that around constrained edges that have their length higher than
-*     twice `target_edge_length`, remeshing will fail to provide
-*     good quality results. It can even fail to terminate because of cascading vertex
-*     insertions.
-*  \cgalParamEnd
-* \cgalNamedParamsEnd
-*
-* @sa `split_long_edges()`
-*
-*@todo document `1d_smoothing`
-*@todo add possibility to provide a functor that projects to a prescribed surface
-*/
-template<typename PolygonMesh
-       , typename FaceRange
-       , typename NamedParameters>
-void isotropic_remeshing(const FaceRange& faces
-                       , const double& target_edge_length
-                       , PolygonMesh& pmesh
-                       , const NamedParameters& np)
-{
-  typedef PolygonMesh PM;
-  typedef typename boost::graph_traits<PM>::vertex_descriptor vertex_descriptor;
-  using boost::choose_pmap;
-  using boost::get_param;
-  using boost::choose_param;
-
-  typedef typename GetGeomTraits<PM, NamedParameters>::type GT;
-
-  typedef typename GetVertexPointMap<PM, NamedParameters>::type VPMap;
-  VPMap vpmap = choose_pmap(get_param(np, boost::vertex_point),
-                            pmesh,
-                            boost::vertex_point);
-
-  typedef typename boost::lookup_named_param_def <
-      CGAL::edge_is_constrained_t,
-      NamedParameters,
-      internal::Border_constraint_pmap<PM, FaceRange>//default
-    > ::type ECMap;
-  ECMap ecmap
-    = choose_param(get_param(np, edge_is_constrained),
-                   internal::Border_constraint_pmap<PM, FaceRange>(pmesh, faces));
-
-  typedef typename boost::lookup_named_param_def <
-      CGAL::vertex_is_constrained_t,
-      NamedParameters,
-      internal::No_constraint_pmap<vertex_descriptor>//default
-    > ::type VCMap;
-  VCMap vcmap = choose_param(get_param(np, vertex_is_constrained),
-                             internal::No_constraint_pmap<vertex_descriptor>());
-
-  double low = 4. / 5. * target_edge_length;
-  double high = 4. / 3. * target_edge_length;
-
-  bool protect = choose_param(get_param(np, protect_constraints), false);
-  if(protect)
-  {
-    std::string msg("Isotropic remeshing : protect_constraints cannot be set to");
-    msg.append(" true with constraints larger than 4/3 * target_edge_length.");
-    msg.append(" Remeshing aborted.");
-    CGAL_precondition_msg(
-      internal::constraints_are_short_enough(pmesh, ecmap, vpmap, high),
-      msg.c_str());
-  }
-
-  typename internal::Incremental_remesher<PM, VPMap, GT, ECMap, VCMap>
-    remesher(pmesh, vpmap, protect, ecmap, vcmap);
-  remesher.init_remeshing(faces);
-
-  unsigned int nb_iterations = choose_param(get_param(np, number_of_iterations), 1);
-  bool smoothing_1d = choose_param(get_param(np, smooth_along_features), false);
-
-#ifdef CGAL_PMP_REMESHING_VERBOSE
-  std::cout << std::endl;
-  std::cout << "Remeshing (size = " << target_edge_length;
-  std::cout << ", #iter = " << nb_iterations << ")..." << std::endl;
-#endif
-
-  for (unsigned int i = 0; i < nb_iterations; ++i)
-  {
-#ifdef CGAL_PMP_REMESHING_VERBOSE
-    std::cout << " * Iteration " << (i + 1) << " *" << std::endl;
-#endif
-
-    remesher.split_long_edges(high);
-    remesher.collapse_short_edges(low, high);
-    remesher.equalize_valences();
-    remesher.tangential_relaxation(smoothing_1d);
-    remesher.project_to_surface();
-
-#ifdef CGAL_PMP_REMESHING_VERBOSE
-    std::cout << std::endl;
-#endif
-  }
-
-  remesher.update_constraints_property_map();
-
-#ifdef CGAL_PMP_REMESHING_VERBOSE
-  std::cout << "Remeshing done (size = " << target_edge_length;
-  std::cout << ", #iter = " << nb_iterations << ")." << std::endl;
-#endif
-}
-
-template<typename PolygonMesh
-       , typename FaceRange>
-void isotropic_remeshing(
-    const FaceRange& faces
-  , const double& target_edge_length
-  , PolygonMesh& pmesh)
-{
-  isotropic_remeshing(
-    faces,
-    target_edge_length,
-    pmesh,
-    parameters::all_default());
-}
-
-/*!
-* \ingroup PMP_meshing_grp
-* @brief splits the edges listed in `edges` into sub-edges
-* that are not longer than the given threshold `max_length`.
-*
-* Note this function is useful to split constrained edges before
-* calling `isotropic_remeshing()` with protection of constraints
-* activated (to match the constrained edge length required by the
-* remeshing algorithm to be guaranteed to terminate)
-*
-* @tparam PolygonMesh model of `MutableFaceGraph` that
-*         has an internal property map for `CGAL::vertex_point_t`.
-* @tparam EdgeRange range of `boost::graph_traits<PolygonMesh>::%edge_descriptor`,
-*   model of `Range`. Its iterator type is `InputIterator`.
-* @tparam NamedParameters a sequence of \ref namedparameters
-*
-* @param pmesh a polygon mesh
-* @param edges the range of edges to be split if they are longer than given threshold
-* @param max_length the edge length above which an edge from `edges` is split
-*        into to sub-edges
-* @param np optional \ref namedparameters described below
-
-* \cgalNamedParamsBegin
-*  \cgalParamBegin{vertex_point_map} the property map with the points associated
-*    to the vertices of `pmesh`. Instance of a class model of `ReadWritePropertyMap`.
-*  \cgalParamEnd
-* \cgalNamedParamsEnd
-*
-* @sa `isotropic_remeshing()`
-*
-*/
-template<typename PolygonMesh
-       , typename EdgeRange
-       , typename NamedParameters>
-void split_long_edges(const EdgeRange& edges
-                    , const double& max_length
-                    , PolygonMesh& pmesh
-                    , const NamedParameters& np)
-{
-  typedef PolygonMesh PM;
-  typedef typename boost::graph_traits<PM>::edge_descriptor edge_descriptor;
-  typedef typename boost::graph_traits<PM>::vertex_descriptor vertex_descriptor;
-  using boost::choose_pmap;
-  using boost::choose_param;
-  using boost::get_param;
-
-  typedef typename GetGeomTraits<PM, NamedParameters>::type GT;
-  typedef typename GetVertexPointMap<PM, NamedParameters>::type VPMap;
-  VPMap vpmap = choose_pmap(get_param(np, boost::vertex_point),
-                            pmesh,
-                            boost::vertex_point);
-
-  typedef typename boost::lookup_named_param_def <
-        CGAL::edge_is_constrained_t,
-        NamedParameters,
-        internal::No_constraint_pmap<edge_descriptor>//default
-      > ::type ECMap;
-  ECMap ecmap = choose_param(get_param(np, edge_is_constrained),
-                             internal::No_constraint_pmap<edge_descriptor>());
-  
-  typename internal::Incremental_remesher<PM, VPMap, GT, ECMap>
-    remesher(pmesh, vpmap, false/*protect constraints*/
-           , ecmap
-           , internal::No_constraint_pmap<vertex_descriptor>()
-           , false/*need aabb_tree*/);
-
-  remesher.split_long_edges(edges, max_length);
-}
-
-template<typename PolygonMesh, typename EdgeRange>
-void split_long_edges(const EdgeRange& edges
-                    , const double& max_length
-                    , PolygonMesh& pmesh)
-{
-  split_long_edges(edges,
-    max_length,
-    pmesh,
-    parameters::all_default());
-}
-
-} //end namespace Polygon_mesh_processing
-} //end namespace CGAL
-
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/triangulate_faces.h b/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/triangulate_faces.h
deleted file mode 100644
index 91bde2f..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/triangulate_faces.h
+++ /dev/null
@@ -1,381 +0,0 @@
-// Copyright (c) 2010-2011  GeometryFactory Sarl (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
-// 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(s)     : Laurent Rineau
-
-#ifndef CGAL_POLYGON_MESH_PROCESSING_TRIANGULATE_FACES_H
-#define CGAL_POLYGON_MESH_PROCESSING_TRIANGULATE_FACES_H
-
-#include <CGAL/HalfedgeDS_decorator.h>
-#include <CGAL/boost/graph/helpers.h>
-#include <CGAL/boost/graph/Euler_operations.h>
-
-#include <CGAL/Triangulation_vertex_base_with_info_2.h>
-#include <CGAL/Triangulation_face_base_with_info_2.h>
-#include <CGAL/Constrained_Delaunay_triangulation_2.h>
-#include <CGAL/Constrained_triangulation_plus_2.h>
-#include <CGAL/Triangulation_2_filtered_projection_traits_3.h>
-
-#include <CGAL/Polygon_mesh_processing/compute_normal.h>
-#include <CGAL/Polygon_mesh_processing/internal/named_function_params.h>
-#include <CGAL/Polygon_mesh_processing/internal/named_params_helper.h>
-
-#include <boost/range/size.hpp>
-#include <boost/foreach.hpp>
-
-#include <queue>
-#include <vector>
-#include <utility>
-
-namespace CGAL {
-
-namespace Polygon_mesh_processing {
-
-namespace internal {
-
-template <class PM
-          , typename VertexPointMap
-          , typename Kernel>
-class Triangulate_modifier
-{
-  typedef Kernel Traits;
-
-  typedef typename boost::graph_traits<PM>::vertex_descriptor vertex_descriptor;
-  typedef typename boost::graph_traits<PM>::halfedge_descriptor halfedge_descriptor;
-  typedef typename boost::graph_traits<PM>::face_descriptor face_descriptor;
-  typedef typename boost::graph_traits<PM>::edge_descriptor edge_descriptor;
-  typedef typename Kernel::Point_3 Point;
-
-  typedef CGAL::Triangulation_2_filtered_projection_traits_3<Traits>   P_traits;
-
-  typedef CGAL::Triangulation_vertex_base_with_info_2<halfedge_descriptor,
-                                                      P_traits>        Vb;
-
-  struct Face_info {
-    typename boost::graph_traits<PM>::halfedge_descriptor e[3];
-    bool is_external;
-  };
-
-  typedef CGAL::Triangulation_face_base_with_info_2<Face_info,
-                                                    P_traits>          Fb1;
-  typedef CGAL::Constrained_triangulation_face_base_2<P_traits, Fb1>   Fb;
-  typedef CGAL::Triangulation_data_structure_2<Vb,Fb>                  TDS;
-  typedef CGAL::No_intersection_tag                                    Itag;
-  typedef CGAL::Constrained_Delaunay_triangulation_2<P_traits,
-                                                     TDS,
-                                                     Itag>             CDTbase;
-  typedef CGAL::Constrained_triangulation_plus_2<CDTbase>              CDT;
-
-  VertexPointMap _vpmap;
-
-public:
-  Triangulate_modifier(VertexPointMap vpmap)
-    : _vpmap(vpmap)
-  {
-  }
-
-  bool is_external(typename CDT::Face_handle fh) const {
-    return fh->info().is_external;
-  }
-
-  void triangulate_face(face_descriptor f, PM& pmesh)
-  {
-    typename Traits::Vector_3 normal =
-      Polygon_mesh_processing::compute_face_normal(f, pmesh);
-
-    P_traits cdt_traits(normal);
-    CDT cdt(cdt_traits);
-
-    // Halfedge_around_facet_circulator
-    typedef typename CDT::Vertex_handle Tr_Vertex_handle;
-    halfedge_descriptor start = halfedge(f, pmesh);
-    halfedge_descriptor h = start;
-    Tr_Vertex_handle previous, first;
-    do
-    {
-      Tr_Vertex_handle vh = cdt.insert(_vpmap[target(h, pmesh)]);
-      if (first == Tr_Vertex_handle()) {
-        first = vh;
-      }
-      vh->info() = h;
-      if(previous != Tr_Vertex_handle() && previous != vh) {
-        cdt.insert_constraint(previous, vh);
-      }
-      previous = vh;
-      h = next(h, pmesh);
-
-    } while( h != start );
-    cdt.insert_constraint(previous, first);
-
-    // sets mark is_external
-    for(typename CDT::All_faces_iterator fit = cdt.all_faces_begin(),
-          end = cdt.all_faces_end();
-        fit != end; ++fit)
-    {
-      fit->info().is_external = false;
-    }
-    std::queue<typename CDT::Face_handle> face_queue;
-    face_queue.push(cdt.infinite_vertex()->face());
-    while(! face_queue.empty() )
-    {
-      typename CDT::Face_handle fh = face_queue.front();
-      face_queue.pop();
-
-      if(fh->info().is_external)
-        continue;
-
-      fh->info().is_external = true;
-      for(int i = 0; i <3; ++i)
-      {
-        if(!cdt.is_constrained(typename CDT::Edge(fh, i)))
-        {
-          face_queue.push(fh->neighbor(i));
-        }
-      }
-    }
-
-    // then modify the polyhedron
-    // make_hole. (see comment in function body)
-    this->make_hole(halfedge(f, pmesh), pmesh);
-
-    for(typename CDT::Finite_edges_iterator eit = cdt.finite_edges_begin(),
-          end = cdt.finite_edges_end();
-        eit != end; ++eit)
-    {
-      typename CDT::Face_handle fh = eit->first;
-      const int index = eit->second;
-      typename CDT::Face_handle opposite_fh = fh->neighbor(eit->second);
-      const int opposite_index = opposite_fh->index(fh);
-
-      const Tr_Vertex_handle va = fh->vertex(cdt. cw(index));
-      const Tr_Vertex_handle vb = fh->vertex(cdt.ccw(index));
-
-      if( ! (is_external(fh) && is_external(opposite_fh))//not both fh are external
-          && ! cdt.is_constrained(*eit) )                  //and edge is not constrained
-      {
-        // strictly internal edge
-        halfedge_descriptor hnew = halfedge(add_edge(pmesh), pmesh),
-          hnewopp = opposite(hnew, pmesh);
-
-        fh->info().e[index] = hnew;
-        opposite_fh->info().e[opposite_index] = hnewopp;
-
-        set_target(hnew,    target(va->info(), pmesh), pmesh);
-        set_target(hnewopp, target(vb->info(), pmesh), pmesh);
-      }
-      if( cdt.is_constrained(*eit) ) //edge is constrained
-      {
-        if(!is_external(fh)) {
-          fh->info().e[index] = va->info();
-        }
-        if(!is_external(opposite_fh)) {
-          opposite_fh->info().e[opposite_index] = vb->info();
-        }
-      }
-    }
-    for(typename CDT::Finite_faces_iterator fit = cdt.finite_faces_begin(),
-          end = cdt.finite_faces_end();
-        fit != end; ++fit)
-    {
-      if(!is_external(fit))
-      {
-        halfedge_descriptor h0 = fit->info().e[0];
-        halfedge_descriptor h1 = fit->info().e[1];
-        halfedge_descriptor h2 = fit->info().e[2];
-        CGAL_assertion(h0 != halfedge_descriptor());
-        CGAL_assertion(h1 != halfedge_descriptor());
-        CGAL_assertion(h2 != halfedge_descriptor());
-
-        set_next(h0, h1, pmesh);
-        set_next(h1, h2, pmesh);
-        set_next(h2, h0, pmesh);
-
-        Euler::fill_hole(h0, pmesh);
-      }
-    }
-  }
-
-  template<typename FaceRange>
-  void operator()(FaceRange face_range, PM& pmesh)
-  {
-    // One need to store facet handles into a vector, because the list of
-    // facets of the polyhedron will be modified during the loop, and
-    // that invalidates the range [facets_begin(), facets_end()[.
-    std::vector<face_descriptor> facets;
-    facets.reserve(std::distance(boost::begin(face_range), boost::end(face_range)));
-
-    //only consider non-triangular faces
-    BOOST_FOREACH(face_descriptor fit, face_range)
-      if ( next( next( halfedge(fit, pmesh), pmesh), pmesh)
-        !=       prev( halfedge(fit, pmesh), pmesh) )
-        facets.push_back(fit);
-
-    // Iterates on the vector of face descriptors
-    BOOST_FOREACH(face_descriptor f, facets)
-    {
-      this->triangulate_face(f, pmesh);
-    }
-  }
-
-  void make_hole(halfedge_descriptor h, PM& pmesh)
-  {
-    //we are not using Euler::make_hole because it has a precondition
-    //that the hole is not made on the boundary of the mesh
-    //here we allow making a hole on the boundary, and the pair(s) of
-    //halfedges that become border-border are fixed by the connectivity
-    //setting made in operator()
-    CGAL_assertion(!is_border(h, pmesh));
-    face_descriptor fd = face(h, pmesh);
-
-    BOOST_FOREACH(halfedge_descriptor hd, halfedges_around_face(h, pmesh))
-    {
-      CGAL::internal::set_border(hd, pmesh);
-    }
-    remove_face(fd, pmesh);
-  }
-
-
-}; // end class Triangulate_modifier
-
-}//end namespace internal
-
-/**
-* \ingroup PMP_meshing_grp
-* triangulates a single face of a polygon mesh. This function depends on the package \ref PkgTriangulation2Summary
-* @tparam PolygonMesh a model of `FaceListGraph` and `MutableFaceGraph`
-*         that has an internal property map for `boost::vertex_point_t`
-* @tparam NamedParameters a sequence of \ref namedparameters
-*
-* @param f face to be triangulated
-* @param pmesh the polygon mesh to which the face to be triangulated belongs
-* @param np optional sequence of \ref namedparameters among the ones listed below
-*
-* \cgalNamedParamsBegin
-*    \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh` \cgalParamEnd
-*    \cgalParamBegin{geom_traits} a geometric traits class instance \cgalParamEnd
-* \cgalNamedParamsEnd
-*
-*/
-template<typename PolygonMesh, typename NamedParameters>
-void triangulate_face(typename boost::graph_traits<PolygonMesh>::face_descriptor f,
-                      PolygonMesh& pmesh,
-                      const NamedParameters& np)
-{
-  using boost::choose_const_pmap;
-  using boost::get_param;
-
-  //VertexPointMap
-  typedef typename GetVertexPointMap<PolygonMesh, NamedParameters>::type VPMap;
-  VPMap vpmap = choose_pmap(get_param(np, boost::vertex_point),
-                            pmesh,
-                            boost::vertex_point);
-  //Kernel
-  typedef typename GetGeomTraits<PolygonMesh, NamedParameters>::type Kernel;
-
-  internal::Triangulate_modifier<PolygonMesh, VPMap, Kernel> modifier(vpmap);
-  modifier.triangulate_face(f, pmesh);
-}
-
-template<typename PolygonMesh>
-void triangulate_face(typename boost::graph_traits<PolygonMesh>::face_descriptor f,
-                      PolygonMesh& pmesh)
-{
-  triangulate_face(f, pmesh, CGAL::Polygon_mesh_processing::parameters::all_default());
-}
-
-/**
-* \ingroup PMP_meshing_grp
-* triangulates given faces of a polygon mesh. This function depends on the package \ref PkgTriangulation2Summary
-*
-* @tparam FaceRange range of `boost::graph_traits<PolygonMesh>::%face_descriptor`,
-          model of `Range`.
-          Its iterator type is `InputIterator`.
-* @tparam PolygonMesh a model of `FaceListGraph` and `MutableFaceGraph`
-*         that has an internal property map for `boost::vertex_point_t`
-* @tparam NamedParameters a sequence of \ref namedparameters
-*
-* @param face_range the range of faces to be triangulated
-* @param pmesh the polygon mesh to be triangulated
-* @param np optional sequence of \ref namedparameters among the ones listed below
-*
-* \cgalNamedParamsBegin
-*    \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh` \cgalParamEnd
-*    \cgalParamBegin{geom_traits} a geometric traits class instance \cgalParamEnd
-* \cgalNamedParamsEnd
-*
-*/
-template <typename FaceRange, typename PolygonMesh, typename NamedParameters>
-void triangulate_faces(FaceRange face_range,
-                       PolygonMesh& pmesh,
-                       const NamedParameters& np)
-{
-  using boost::choose_const_pmap;
-  using boost::get_param;
-
-  //VertexPointMap
-  typedef typename GetVertexPointMap<PolygonMesh, NamedParameters>::type VPMap;
-  VPMap vpmap = choose_pmap(get_param(np, boost::vertex_point),
-                            pmesh,
-                            boost::vertex_point);
-  //Kernel
-  typedef typename GetGeomTraits<PolygonMesh, NamedParameters>::type Kernel;
-
-  internal::Triangulate_modifier<PolygonMesh, VPMap, Kernel> modifier(vpmap);
-  modifier(face_range, pmesh);
-}
-
-template <typename FaceRange, typename PolygonMesh>
-void triangulate_faces(FaceRange face_range, PolygonMesh& pmesh)
-{
-  triangulate_faces(face_range, pmesh, CGAL::Polygon_mesh_processing::parameters::all_default());
-}
-
-/**
-* \ingroup PMP_meshing_grp
-* triangulates all faces of a polygon mesh. This function depends on the package \ref PkgTriangulation2Summary
-* @tparam PolygonMesh a model of `FaceListGraph` and `MutableFaceGraph`
-*         that has an internal property map for `boost::vertex_point_t`
-* @tparam NamedParameters a sequence of \ref namedparameters
-*
-* @param pmesh the polygon mesh to be triangulated
-* @param np optional sequence of \ref namedparameters among the ones listed below
-*
-* \cgalNamedParamsBegin
-*    \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh` \cgalParamEnd
-*    \cgalParamBegin{geom_traits} a geometric traits class instance \cgalParamEnd
-* \cgalNamedParamsEnd
-*
-*/
-template <typename PolygonMesh, typename NamedParameters>
-void triangulate_faces(PolygonMesh& pmesh,
-                       const NamedParameters& np)
-{
-  triangulate_faces(faces(pmesh), pmesh, np);
-}
-
-template <typename PolygonMesh>
-void triangulate_faces(PolygonMesh& pmesh)
-{
-  triangulate_faces(faces(pmesh), pmesh, CGAL::Polygon_mesh_processing::parameters::all_default());
-}
-
-} // end namespace Polygon_mesh_processing
-
-} // end namespace CGAL
-
-#endif // CGAL_POLYGON_MESH_PROCESSING_TRIANGULATE_FACES_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/triangulate_hole.h b/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/triangulate_hole.h
deleted file mode 100644
index 6eec6bb..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/triangulate_hole.h
+++ /dev/null
@@ -1,406 +0,0 @@
-// Copyright (c) 2015 GeometryFactory (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Ilker O. Yaz
-
-#ifndef CGAL_POLYGON_MESH_PROCESSING_TRIANGULATE_HOLE_H
-#define CGAL_POLYGON_MESH_PROCESSING_TRIANGULATE_HOLE_H
-
-#include <CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polygon_mesh.h>
-#include <CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h>
-#include <CGAL/Polygon_mesh_processing/refine.h>
-#include <CGAL/Polygon_mesh_processing/fair.h>
-
-#include <CGAL/Polygon_mesh_processing/internal/named_function_params.h>
-#include <CGAL/Polygon_mesh_processing/internal/named_params_helper.h>
-
-#include <CGAL/boost/graph/helpers.h>
-
-#include <boost/tuple/tuple.hpp>
-
-#include <vector>
-
-namespace CGAL {
-
-namespace Polygon_mesh_processing {
-
-  /*!
-  \ingroup hole_filling_grp
-  triangulates a hole in a polygon mesh.
-  The hole must not contain any non-manifold vertex.
-  The patch generated does not introduce non-manifold edges nor degenerate triangles.
-  If a hole cannot be triangulated, `pmesh` is not modified and nothing is recorded in `out`.
-
-  @tparam PolygonMesh a model of `MutableFaceGraph`
-          that has an internal property map for `CGAL::vertex_point_t`
-  @tparam OutputIterator a model of `OutputIterator`
-    holding `boost::graph_traits<PolygonMesh>::%face_descriptor` for patch faces.
-  @tparam NamedParameters a sequence of \ref namedparameters
-
-  @param pmesh polygon mesh containing the hole
-  @param border_halfedge a border halfedge incident to the hole
-  @param out iterator over patch faces
-  @param np optional sequence of \ref namedparameters among the ones listed below
-
-  \cgalNamedParamsBegin
-     \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh` \cgalParamEnd
-     \cgalParamBegin{use_delaunay_triangulation} if `true`, use the Delaunay triangulation facet search space \cgalParamEnd
-     \cgalParamBegin{geom_traits} a geometric traits class instance \cgalParamEnd
-  \cgalNamedParamsEnd
-
-  @return `out`
-
-  \todo handle islands
-  @todo Replace border_halfedge by a range of border halfedges.
-        The first one would describe the hole,
-        the other ones would describe the islands.
-  @todo Then, insert the holes vertices in the set of possibilities
-        for connecting vertices together
-  @todo handle the case where an island is reduced to a point
-  */  
-  template<typename PolygonMesh,
-           typename OutputIterator,
-           typename NamedParameters>
-  OutputIterator
-  triangulate_hole(PolygonMesh& pmesh,
-              typename boost::graph_traits<PolygonMesh>::halfedge_descriptor border_halfedge,
-              OutputIterator out,
-              const NamedParameters& np)
-  {
-    using boost::choose_param;
-    using boost::get_param;
-
-    bool use_dt3 =
-#ifdef CGAL_HOLE_FILLING_DO_NOT_USE_DT3
-      false;
-#else
-      choose_param(get_param(np, use_delaunay_triangulation), true);
-#endif
-
-    CGAL_precondition(face(border_halfedge, pmesh) == boost::graph_traits<PolygonMesh>::null_face());
-
-    return internal::triangulate_hole_polygon_mesh(pmesh,
-      border_halfedge,
-      out,
-      choose_param(get_param(np, vertex_point), get(CGAL::vertex_point, pmesh)),
-      use_dt3,
-      choose_param(get_param(np, geom_traits), typename GetGeomTraits<PolygonMesh,NamedParameters>::type()))
-      .first;
-  }
-
-  template<typename PolygonMesh, typename OutputIterator>
-  OutputIterator
-    triangulate_hole(PolygonMesh& pmesh,
-      typename boost::graph_traits<PolygonMesh>::halfedge_descriptor border_halfedge,
-      OutputIterator out)
-  {
-    return triangulate_hole(pmesh, border_halfedge, out,
-      CGAL::Polygon_mesh_processing::parameters::all_default());
-  }
-
-  template<typename PM, typename VertexRange>
-  void test_in_edges(const PM& pmesh, const VertexRange& patch)
-  {
-    BOOST_FOREACH(typename boost::graph_traits<PM>::vertex_descriptor v0, patch)
-    {
-      typename boost::graph_traits<PM>::in_edge_iterator e, e_end;
-      for (boost::tie(e, e_end) = in_edges(v0, pmesh); e != e_end; e++)
-      {
-        typename boost::graph_traits<PM>::halfedge_descriptor he = halfedge(*e, pmesh);
-        if (is_border(he, pmesh)) { continue; }
-
-        CGAL_assertion(v0 == target(he, pmesh) || v0 == source(he, pmesh));
-      }
-    }
-  }
-
-  /*!
-  \ingroup  hole_filling_grp
-  @brief triangulates and refines a hole in a polygon mesh.
-
-  @tparam PolygonMesh must be model of `MutableFaceGraph`
-          that has an internal property map for `CGAL::vertex_point_t`
-  @tparam FacetOutputIterator model of `OutputIterator`
-     holding `boost::graph_traits<PolygonMesh>::%face_descriptor` for patch faces.
-  @tparam VertexOutputIterator model of `OutputIterator`
-     holding `boost::graph_traits<PolygonMesh>::%vertex_descriptor` for patch vertices.
-  @tparam NamedParameters a sequence of \ref namedparameters
-
-  @param pmesh polygon mesh which has the hole
-  @param border_halfedge a border halfedge incident to the hole
-  @param face_out output iterator over patch faces
-  @param vertex_out output iterator over patch vertices without including the boundary
-  @param np optional sequence of \ref namedparameters among the ones listed below
-
-  \cgalNamedParamsBegin
-     \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh` \cgalParamEnd
-     \cgalParamBegin{density_control_factor} factor to control density of the ouput mesh, where larger values cause denser refinements, as in `refine()` \cgalParamEnd
-     \cgalParamBegin{use_delaunay_triangulation} if `true`, use the Delaunay triangulation facet search space \cgalParamEnd
-     \cgalParamBegin{geom_traits} a geometric traits class instance \cgalParamEnd
-  \cgalNamedParamsEnd
-
-  @return pair of `face_out` and `vertex_out`
-
-  \sa CGAL::Polygon_mesh_processing::triangulate_hole()
-  \sa CGAL::Polygon_mesh_processing::refine()
-
-  \todo handle islands
-  */
-  template<typename PolygonMesh,
-           typename FaceOutputIterator,
-           typename VertexOutputIterator,
-           typename NamedParameters>
-  std::pair<FaceOutputIterator, VertexOutputIterator>
-    triangulate_and_refine_hole(PolygonMesh& pmesh,
-      typename boost::graph_traits<PolygonMesh>::halfedge_descriptor border_halfedge,
-      FaceOutputIterator face_out,
-      VertexOutputIterator vertex_out,
-      const NamedParameters& np)
-  {
-    std::vector<typename boost::graph_traits<PolygonMesh>::face_descriptor> patch;
-    triangulate_hole(pmesh, border_halfedge, std::back_inserter(patch), np);
-    face_out = std::copy(patch.begin(), patch.end(), face_out);
-
-    test_in_edges(pmesh, vertices(pmesh));
-
-    return refine(pmesh, patch, face_out, vertex_out, np);
-  }
-
-  template<typename PolygonMesh,
-           typename FaceOutputIterator,
-           typename VertexOutputIterator>
-  std::pair<FaceOutputIterator, VertexOutputIterator>
-    triangulate_and_refine_hole(PolygonMesh& pmesh,
-       typename boost::graph_traits<PolygonMesh>::halfedge_descriptor border_halfedge,
-       FaceOutputIterator face_out,
-       VertexOutputIterator vertex_out)
-  {
-    return triangulate_and_refine_hole(pmesh, border_halfedge,
-      face_out, vertex_out,
-      CGAL::Polygon_mesh_processing::parameters::all_default());
-  }
-
-  /*!
-  \ingroup  hole_filling_grp
-  @brief triangulates, refines and fairs a hole in a polygon mesh.
-
-  @tparam PolygonMesh a model of `MutableFaceGraph`
-          that has an internal property map for `CGAL::vertex_point_t`
-  @tparam FaceOutputIterator model of `OutputIterator`
-      holding `boost::graph_traits<PolygonMesh>::%face_descriptor` for patch faces
-  @tparam VertexOutputIterator model of `OutputIterator`
-      holding `boost::graph_traits<PolygonMesh>::%vertex_descriptor` for patch vertices
-  @tparam NamedParameters a sequence of \ref namedparameters
-
-  @param pmesh polygon mesh which has the hole
-  @param border_halfedge a border halfedge incident to the hole
-  @param face_out output iterator over patch faces
-  @param vertex_out output iterator over patch vertices without including the boundary
-  @param np optional sequence of \ref namedparameters among the ones listed below
-
-  \cgalNamedParamsBegin
-     \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh` \cgalParamEnd
-     \cgalParamBegin{use_delaunay_triangulation} if `true`, use the Delaunay triangulation facet search space \cgalParamEnd
-     \cgalParamBegin{density_control_factor} factor to control density of the ouput mesh, where larger values cause denser refinements, as in `refine()` \cgalParamEnd
-     \cgalParamBegin{fairing_continuity} tangential continuity of the output surface patch \cgalParamEnd
-     \cgalParamBegin{sparse_linear_solver} an instance of the sparse linear solver used for fairing \cgalParamEnd
-     \cgalParamBegin{geom_traits} a geometric traits class instance \cgalParamEnd
-  \cgalNamedParamsEnd
-
-  @return tuple of
-  - `bool`: `true` if fairing is successful
-  - `face_out`
-  - `vertex_out`
-
-  \sa CGAL::Polygon_mesh_processing::triangulate_hole()
-  \sa CGAL::Polygon_mesh_processing::refine()
-  \sa CGAL::Polygon_mesh_processing::fair()
-
-  \todo handle islands
-  */
-  template<typename PolygonMesh,
-           typename FaceOutputIterator,
-           typename VertexOutputIterator,
-           typename NamedParameters>
-  CGAL::cpp11::tuple<bool, FaceOutputIterator, VertexOutputIterator>
-  triangulate_refine_and_fair_hole(PolygonMesh& pmesh,
-    typename boost::graph_traits<PolygonMesh>::halfedge_descriptor border_halfedge,
-    FaceOutputIterator face_out,
-    VertexOutputIterator vertex_out,
-    const NamedParameters& np)
-  {
-    std::vector<typename boost::graph_traits<PolygonMesh>::vertex_descriptor> patch;
-
-    CGAL_assertion(CGAL::is_triangle_mesh(pmesh));
-
-    face_out = triangulate_and_refine_hole
-      (pmesh, border_halfedge, face_out, std::back_inserter(patch), np).first;
-
-    CGAL_assertion(CGAL::is_triangle_mesh(pmesh));
-
-    test_in_edges(pmesh, patch);
-
-    bool fair_success = fair(pmesh, patch, np);
-
-    vertex_out = std::copy(patch.begin(), patch.end(), vertex_out);
-    return CGAL::cpp11::make_tuple(fair_success, face_out, vertex_out);
-  }
-
-  template<typename PolygonMesh,
-           typename FaceOutputIterator,
-           typename VertexOutputIterator>
-  CGAL::cpp11::tuple<bool, FaceOutputIterator, VertexOutputIterator>
-  triangulate_refine_and_fair_hole(PolygonMesh& pmesh,
-        typename boost::graph_traits<PolygonMesh>::halfedge_descriptor border_halfedge,
-        FaceOutputIterator face_out,
-        VertexOutputIterator vertex_out)
-  {
-    return triangulate_refine_and_fair_hole(pmesh, border_halfedge,
-      face_out, vertex_out,
-      CGAL::Polygon_mesh_processing::parameters::all_default());
-  }
-
-  /*!
-  \ingroup  hole_filling_grp
-  creates triangles to fill the hole defined by points in the range `points`.
-  Triangles are recorded into `out` using the indices of the input points in the range `points`.
-  Note that no degenerate triangles will be produced.
-  If no triangulation can be found, then nothing is recorded in `out`.
-
-  If faces incident to the polyline outside the hole are known,
-  it is recommended to use this function.
-  The point range `third_points` indicates for each pair of consecutive points in the range `points`,
-  the third point of the face this segment is incident to. It influences the choice
-  of the best triangulation while avoiding overfolding.
-
-  Note that the ranges `points` and `third_points` may or may not contain duplicated first point at the end of sequence.
-
-  @pre `third_points.size() == points.size()`
-
-  @tparam PointRange range of points, model of `Range`.
-    Its iterator type is `InputIterator`.
-  @tparam OutputIterator model of `OutputIterator`, to collect patch faces.
-     A specialization for `CGAL::value_type_traits<OutputIterator>` must be available,
-     and the corresponding value type `type` must have
-     a constructor `type(int p0, int p1, int p2)` available.
-     The indices correspond to the ones of input points in `points`.
-  @tparam NamedParameters a sequence of \ref namedparameters
-
-  @param points the range of input points
-  @param third_points the range of third points
-  @param out iterator over output patch triangles, described by indices of points
-             in `points`
-  @param np optional sequence of \ref namedparameters among the ones listed below
-
-  \cgalNamedParamsBegin
-     \cgalParamBegin{use_delaunay_triangulation} if `true`, use the Delaunay triangulation facet search space \cgalParamEnd
-     \cgalParamBegin{geom_traits} a geometric traits class instance \cgalParamEnd
-  \cgalNamedParamsEnd
-
-  \todo handle islands
-  */
-  template <typename PointRange1,
-            typename PointRange2,
-            typename OutputIterator,
-            typename NamedParameters>
-  OutputIterator
-  triangulate_hole_polyline(const PointRange1& points,
-                            const PointRange2& third_points,
-                            OutputIterator out,
-                            const NamedParameters& np)
-  {
-    using boost::choose_param;
-    using boost::get_param;
-
-    bool use_dt3 =
-#ifdef CGAL_HOLE_FILLING_DO_NOT_USE_DT3
-      false;
-#else
-      choose_param(get_param(np, use_delaunay_triangulation), true);
-#endif
-
-    typedef CGAL::internal::Weight_min_max_dihedral_and_area      Weight;
-    typedef CGAL::internal::Weight_calculator<Weight,
-                  CGAL::internal::Is_not_degenerate_triangle>  WC;
-    typedef std::vector<std::pair<int, int> > Holes;
-    typedef std::back_insert_iterator<Holes>  Holes_out;
-
-    Holes holes;//just to check there is no holes left
-
-    typedef typename value_type_traits<OutputIterator>::type OutputIteratorValueType;
-    CGAL::internal::Tracer_polyline_incomplete<OutputIteratorValueType, OutputIterator, Holes_out>
-      tracer(out, Holes_out(holes));
-    
-    typedef typename PointRange1::iterator InIterator;
-    typedef typename std::iterator_traits<InIterator>::value_type Point;
-
-    triangulate_hole_polyline(points, third_points, tracer, WC(),
-      use_dt3,
-      choose_param(get_param(np, CGAL::geom_traits),
-        typename CGAL::Kernel_traits<Point>::Kernel()));
-
-    CGAL_assertion(holes.empty());
-    return tracer.out;
-  }
-
-  template <typename PointRange1,
-            typename PointRange2,
-            typename OutputIterator>
-  OutputIterator
-  triangulate_hole_polyline(const PointRange1& points,
-                            const PointRange2& third_points,
-                            OutputIterator out)
-  {
-    return triangulate_hole_polyline(points, third_points, out,
-      CGAL::Polygon_mesh_processing::parameters::all_default());
-  }
-
-  /*!
-  \ingroup  hole_filling_grp
-  same as above but the range of third points is omitted. They are not
-  taken into account in the cost computation that leads the hole filling. 
-*/
-  template <typename PointRange,
-            typename OutputIterator,
-            typename CGAL_PMP_NP_TEMPLATE_PARAMETERS>
-  OutputIterator
-  triangulate_hole_polyline(const PointRange& points,
-                            OutputIterator out,
-                            const CGAL_PMP_NP_CLASS& np)
-  {
-    typedef typename std::iterator_traits<
-      typename PointRange::iterator>::value_type Point;
-    std::vector< Point > third_points;
-    return triangulate_hole_polyline(points, third_points, out, np);
-  }
-
-  template <typename PointRange,
-            typename OutputIterator>
-  OutputIterator
-  triangulate_hole_polyline(const PointRange& points,
-                            OutputIterator out)
-  {
-    return triangulate_hole_polyline(points, out,
-      CGAL::Polygon_mesh_processing::parameters::all_default());
-  }
-
-} //end namespace Polygon_mesh_processing
-
-} //end namespace CGAL
-
-#endif //CGAL_POLYGON_MESH_PROCESSING_TRIANGULATE_HOLE_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_with_holes_2.h b/3rdparty/CGAL-4.8/include/CGAL/Polygon_with_holes_2.h
deleted file mode 100644
index 0963fe7..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polygon_with_holes_2.h
+++ /dev/null
@@ -1,227 +0,0 @@
-// Copyright (c) 2005  Tel-Aviv University (Israel).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Baruch Zukerman <baruchzu at post.tau.ac.il>
-
-#ifndef CGAL_POLYGON_WITH_HOLES_2_H
-#define CGAL_POLYGON_WITH_HOLES_2_H
-
-#include <CGAL/Polygon_2.h>
-#include <CGAL/General_polygon_with_holes_2.h>
-#include <vector>
-#include <algorithm>
-
-namespace CGAL {
-
-template <class Kernel,
-          class Containter = std::vector<typename Kernel::Point_2> >
-class Polygon_with_holes_2 : 
-  public General_polygon_with_holes_2<CGAL::Polygon_2<Kernel, Containter> >
-{
-public:
-
-  typedef CGAL::Polygon_2<Kernel, Containter>        Polygon_2;
-  typedef General_polygon_with_holes_2<Polygon_2>    Base;
-  typedef typename Base::Hole_const_iterator         Hole_const_iterator;
-  typedef typename Base::Size                        Size;
-
-  /*! Default constructor. */
-  Polygon_with_holes_2 () : 
-    Base()
-  {}
-
-  /*! Constructor from the base class. */
-  Polygon_with_holes_2 (const Base& base) : 
-    Base (base)
-  {}
-
-  /*! Constructor from a polygon. */
-  explicit Polygon_with_holes_2 (const Polygon_2& pgn_boundary) : 
-    Base (pgn_boundary)
-  {}
-
-  /*! Constructor from a polygon (outer boundary) and hole polygons. */
-  template <class HolesInputIterator>
-  Polygon_with_holes_2 (const Polygon_2& pgn_boundary,
-                        HolesInputIterator h_begin,
-                        HolesInputIterator h_end) : 
-    Base (pgn_boundary, h_begin, h_end)
-  {}
-
-  /*! Obtain the bounding box of the polygon with holes */
-  Bbox_2 bbox() const { return this->outer_boundary().bbox(); }  
-};
-
-//-----------------------------------------------------------------------//
-//                          operator<<
-//-----------------------------------------------------------------------//
-
-template <class Kernel_, class Container_>
-std::ostream& operator<<(std::ostream &os,
-                         const Polygon_with_holes_2<Kernel_, Container_>& p)
-{
-  typename Polygon_with_holes_2<Kernel_,Container_>::Hole_const_iterator i;
-
-  switch(os.iword(IO::mode)) {
-    case IO::ASCII :
-      os << p.outer_boundary() << ' ' << p.number_of_holes()<<' ';
-      for (i = p.holes_begin(); i != p.holes_end(); ++i) {
-        os << *i << ' ';
-      }
-      return os;
-
-    case IO::BINARY :
-       os << p.outer_boundary() << p.number_of_holes();
-      for (i = p.holes_begin(); i != p.holes_end(); ++i) {
-        os << *i ;
-      }
-      return os;
-
-    default:
-      os << "Polygon_with_holes_2(" << std::endl;
-      if(p.is_unbounded())
-        os << "No outer bounary" << std::endl;
-      else
-      {
-        os << "Boundary(" << std::endl;
-        os << p.outer_boundary() << std::endl;
-      }
-
-      os << "Holes" << std::endl;
-      os << p.number_of_holes()<<std::endl;
-      for (i = p.holes_begin(); i != p.holes_end(); ++i) {
-        os <<" "<< *i << std::endl;
-      }
-
-      os << ")" << std::endl;
-      return os;
-  }
-}
-
-//-----------------------------------------------------------------------//
-//                          operator>>
-//-----------------------------------------------------------------------//
-
-template <class Kernel_, class Container_>
-std::istream &operator>>(std::istream &is,
-                         Polygon_with_holes_2<Kernel_, Container_>& p)
-{
-  typedef CGAL::Polygon_2<Kernel_, Container_> Polygon_2;
-  p.clear();
-  is >> p.outer_boundary();
-
-  unsigned int n; // number of holes;
-  is >> n;
-  if(is)
-  {
-     for (unsigned int i=0; i<n; i++)
-     {
-       Polygon_2 hole;
-       is >> hole;
-       p.add_hole(hole);
-     }
-  }
-
-  return is;
-}
-
-
-//-----------------------------------------------------------------------//
-//                          operator==
-//-----------------------------------------------------------------------//
-template <class Kernel_, class Container_>
-bool operator==(const Polygon_with_holes_2<Kernel_, Container_>& p1,
-                const Polygon_with_holes_2<Kernel_, Container_>& p2)
-{
-  typedef typename 
-    Polygon_with_holes_2<Kernel_, Container_>::Hole_const_iterator HCI;
-  typedef CGAL::Polygon_2<Kernel_, Container_> Polygon_2;
-  if(&p1 == &p2)
-    return (true);
-
-  if(p1.number_of_holes() != p2.number_of_holes())
-    return (false);
-
-  if(p1.outer_boundary() != p2.outer_boundary())
-    return (false);
-
-  std::list<Polygon_2> tmp_list(p2.holes_begin(), p2.holes_end());
-
-  HCI i = p1.holes_begin();
-  for(; i!= p1.holes_end(); ++i)
-  {
-    typename std::list<Polygon_2>::iterator j =
-      (std::find(tmp_list.begin(), tmp_list.end(), *i));
-
-    if(j == tmp_list.end())
-      return (false);
-
-    tmp_list.erase(j);
-  }
-
-
-  CGAL_assertion(tmp_list.empty());
-  return (true);
-}
-
-//-----------------------------------------------------------------------//
-//                          operator!=
-//-----------------------------------------------------------------------//
-template <class Kernel_, class Container_>
-inline bool operator!=(const Polygon_with_holes_2<Kernel_, Container_>& p1,
-                       const Polygon_with_holes_2<Kernel_, Container_>& p2)
-{
-  return (!(p1==p2));
-}
-
-//-----------------------------------------------------------------------//
-//                          operator==
-//-----------------------------------------------------------------------//
-template <class Kernel_, class Container_>
-bool operator==(const Polygon_with_holes_2<Kernel_, Container_>& p1,
-                const Polygon_2<Kernel_, Container_>& p2)
-{
-  return (p1.outer_boundary() == p2  &&  !p1.number_of_holes());
-}
-
-template <class Kernel_, class Container_>
-inline bool operator==(const Polygon_2<Kernel_, Container_>& p1,
-                       const Polygon_with_holes_2<Kernel_, Container_>& p2)
-{
-  return (p2 == p1);
-}
-
-template <class Kernel_, class Container_>
-inline bool operator!=(const Polygon_with_holes_2<Kernel_, Container_>& p1,
-                       const Polygon_2<Kernel_, Container_>& p2)
-{
-  return (!(p1==p2));
-}
-
-template <class Kernel_, class Container_>
-inline bool operator!=(const Polygon_2<Kernel_, Container_>& p1,
-                       const Polygon_with_holes_2<Kernel_, Container_>& p2)
-{
-  return (!(p1==p2));
-}
-
-
-
-} //namespace CGAL
-
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polyhedral_mesh_domain_3.h b/3rdparty/CGAL-4.8/include/CGAL/Polyhedral_mesh_domain_3.h
deleted file mode 100644
index 3728b8a..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polyhedral_mesh_domain_3.h
+++ /dev/null
@@ -1,804 +0,0 @@
-// Copyright (c) 2009 INRIA Sophia-Antipolis (France).
-// Copyright (c) 2011 GeometryFactory Sarl (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
-// 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(s)     : Stéphane Tayeb
-//
-//******************************************************************************
-// File Description :
-//
-//******************************************************************************
-
-#ifndef CGAL_POLYHEDRAL_MESH_DOMAIN_3_H
-#define CGAL_POLYHEDRAL_MESH_DOMAIN_3_H
-
-#include <CGAL/Polygon_mesh_processing/internal/Side_of_triangle_mesh/Point_inside_vertical_ray_cast.h>
-
-#include <CGAL/Mesh_3/global_parameters.h>
-#include <CGAL/Mesh_3/Robust_intersection_traits_3.h>
-#include <CGAL/Mesh_3/Triangle_accessor_primitive.h>
-#include <CGAL/Triangle_accessor_3.h>
-#include <CGAL/AABB_tree.h>
-#include <CGAL/AABB_traits.h>
-#include <sstream>
-
-#include <CGAL/Random.h>
-#include <CGAL/point_generators_3.h>
-#include <CGAL/Mesh_3/Creator_weighted_point_3.h>
-#include <CGAL/Mesh_3/Profile_counter.h>
-
-#include <boost/optional.hpp>
-#include <boost/none.hpp>
-#include <boost/utility/enable_if.hpp>
-#include <boost/mpl/vector.hpp>
-#include <boost/mpl/contains.hpp>
-#include <CGAL/tuple.h>
-#include <boost/format.hpp>
-#include <boost/variant.hpp>
-#include <boost/math/special_functions/round.hpp>
-
-#ifdef CGAL_LINKED_WITH_TBB
-# include <tbb/enumerable_thread_specific.h>
-#endif
-
-namespace CGAL {
-
-namespace Mesh_3 {
-
-namespace details {
-
-inline
-double
-max_length(const Bbox_3& b)
-{
-  return (std::max)(b.xmax()-b.xmin(),
-                    (std::max)(b.ymax()-b.ymin(),b.zmax()-b.zmin()) );
-}
-
-
-// -----------------------------------
-// Surface_patch_index_generator
-// To use patch_id enclosed in AABB_primitives or not
-// -----------------------------------
-template < typename Subdomain_index, typename Polyhedron, typename Tag >
-struct Surface_patch_index_generator
-{
-  typedef std::pair<Subdomain_index,Subdomain_index>  Surface_patch_index;
-  typedef Surface_patch_index                         type;
-
-  template < typename Primitive_id >
-  Surface_patch_index operator()(const Primitive_id&)
-  { return Surface_patch_index(0,1); }
-};
-
-template < typename Subdomain_index, typename Polyhedron >
-struct Surface_patch_index_generator<Subdomain_index, Polyhedron, CGAL::Tag_true>
-{
-  typedef typename Polyhedron::Face::Patch_id Surface_patch_index;
-  typedef Surface_patch_index   type;
-
-  template < typename Primitive_id >
-  Surface_patch_index operator()(const Primitive_id& primitive_id)
-  { return primitive_id->patch_id(); }
-};
-
-
-// -----------------------------------
-// Index_generator
-// Don't use boost::variant if types are the same type
-// -----------------------------------
-template < typename Subdomain_index, typename Surface_patch_index >
-struct Index_generator
-{
-  typedef boost::variant<Subdomain_index,Surface_patch_index> Index;
-  typedef Index                                         type;
-};
-
-template < typename T >
-struct Index_generator<T, T>
-{
-  typedef T       Index;
-  typedef Index   type;
-};
-
-// -----------------------------------
-// Geometric traits generator
-// -----------------------------------
-template < typename Gt,
-           typename Use_exact_intersection_construction_tag >
-struct IGT_generator {};
-
-template < typename Gt >
-struct IGT_generator<Gt,CGAL::Tag_true>
-{
-#ifdef CGAL_MESH_3_NEW_ROBUST_INTERSECTION_TRAITS
-  typedef CGAL::Mesh_3::Robust_intersection_traits_3_new<Gt> type;
-#else // NOT CGAL_MESH_3_NEW_ROBUST_INTERSECTION_TRAITS
-  typedef CGAL::Mesh_3::Robust_intersection_traits_3<Gt> type;
-#endif // NOT CGAL_MESH_3_NEW_ROBUST_INTERSECTION_TRAITS
-  typedef type Type;
-};
-
-template < typename Gt >
-struct IGT_generator<Gt,CGAL::Tag_false>
-{
-  typedef Gt type;
-  typedef type Type;
-};
-
-}  // end namespace details
-
-}  // end namespace Mesh_3
-
-
-/**
- * @class Polyhedral_mesh_domain_3
- *
- *
- */
-template<class Polyhedron,
-         class IGT_,
-         class TriangleAccessor=Triangle_accessor_3<Polyhedron,IGT_>,
-         class Use_patch_id_tag=Tag_false,
-         class Use_exact_intersection_construction_tag = CGAL::Tag_true>
-class Polyhedral_mesh_domain_3
-{
-  typedef typename Mesh_3::details::IGT_generator<
-    IGT_,Use_exact_intersection_construction_tag>::type IGT;
-
-public:
-  /// Geometric object types
-  typedef typename IGT::Point_3    Point_3;
-  typedef typename IGT::Segment_3  Segment_3;
-  typedef typename IGT::Ray_3      Ray_3;
-  typedef typename IGT::Line_3     Line_3;
-  typedef typename IGT::Vector_3   Vector_3;
-  typedef typename IGT::Sphere_3   Sphere_3;
-
-  //-------------------------------------------------------
-  // Index Types
-  //-------------------------------------------------------
-  /// Type of indexes for cells of the input complex
-  typedef int Subdomain_index;
-  typedef boost::optional<Subdomain_index> Subdomain;
-  /// Type of indexes for surface patch of the input complex
-  typedef typename Mesh_3::details::Surface_patch_index_generator<
-    Subdomain_index,Polyhedron,Use_patch_id_tag>::type    Surface_patch_index;
-  typedef boost::optional<Surface_patch_index>            Surface_patch;
-  /// Type of indexes to characterize the lowest dimensional face of the input
-  /// complex on which a vertex lie
-  typedef typename Mesh_3::details::Index_generator<
-    Subdomain_index, Surface_patch_index>::type           Index;
-
-  typedef CGAL::cpp11::tuple<Point_3,Index,int> Intersection;
-
-
-  typedef typename IGT::FT         FT;
-
-  // Kernel_traits compatibility
-  typedef IGT R;
-
-private:
-  typedef Mesh_3::Triangle_accessor_primitive<
-    TriangleAccessor, IGT>                              AABB_primitive;
-  typedef class AABB_traits<IGT,AABB_primitive>         AABB_traits;
-  typedef class AABB_tree<AABB_traits>                  AABB_tree_;
-private:
-  typedef typename AABB_tree_::Primitive_id              AABB_primitive_id;
-  typedef typename AABB_tree_::Primitive Primitive;
-  typedef typename AABB_traits::Bounding_box            Bounding_box;
-
-public:
-
-  /// Default constructor
-  Polyhedral_mesh_domain_3()
-    : tree_()
-    , bounding_tree_(&tree_)
-    , p_rng_(NULL)
-    , delete_rng_(true)
-  {
-    p_rng_ = new CGAL::Random(0);
-  }
-
-  /**
-   * @brief Constructor. Contruction from a polyhedral surface
-   * @param polyhedron the polyhedron describing the polyhedral surface
-   */
-  Polyhedral_mesh_domain_3(const Polyhedron& p,
-                           CGAL::Random* p_rng = NULL)
-    : tree_(TriangleAccessor().triangles_begin(p),
-            TriangleAccessor().triangles_end(p))
-    , bounding_tree_(&tree_) // the bounding tree is tree_
-    , p_rng_(p_rng)
-    , delete_rng_(false)
-  {
-    if(!p.is_pure_triangle()) {
-      std::cerr << "Your input polyhedron must be triangulated!\n";
-      CGAL_error_msg("Your input polyhedron must be triangulated!");
-    }
-    if(!p_rng_)
-    {
-      p_rng_ = new CGAL::Random(0);
-      delete_rng_ = true;
-    }
-  }
-
-  Polyhedral_mesh_domain_3(const Polyhedron& p,
-                           const Polyhedron& bounding_polyhedron,
-                           CGAL::Random* p_rng = NULL)
-    : tree_(TriangleAccessor().triangles_begin(p),
-            TriangleAccessor().triangles_end(p))
-    , bounding_tree_(new AABB_tree_(TriangleAccessor().triangles_begin(bounding_polyhedron),
-                                    TriangleAccessor().triangles_end(bounding_polyhedron)))
-    , p_rng_(p_rng)
-    , delete_rng_(false)
-  {
-    tree_.insert(TriangleAccessor().triangles_begin(bounding_polyhedron),
-                 TriangleAccessor().triangles_end(bounding_polyhedron));
-    tree_.build();
-    bounding_tree_->build();
-    if(!p_rng_)
-    {
-      p_rng_ = new CGAL::Random(0);
-      delete_rng_ = true;
-    }
-  }
-
-  /**
-   * Constructor.
-   *
-   * Constructor from a sequence of polyhedral surfaces, and a bounding
-   * polyhedral surface.
-   *
-   * @param InputPolyhedraPtrIterator must an iterator of a sequence of
-   * pointers to polyhedra
-   *
-   * @param bounding_polyhedron reference to the bounding surface
-   */
-  template <typename InputPolyhedraPtrIterator>
-  Polyhedral_mesh_domain_3(InputPolyhedraPtrIterator begin,
-                           InputPolyhedraPtrIterator end,
-                           const Polyhedron& bounding_polyhedron,
-                           CGAL::Random* p_rng = NULL)
-    : p_rng_(p_rng)
-    , delete_rng_(false)
-  {
-    if(begin != end) {
-      for(; begin != end; ++begin) {
-        tree_.insert(TriangleAccessor().triangles_begin(**begin),
-                     TriangleAccessor().triangles_end(**begin));
-      }
-      tree_.insert(TriangleAccessor().triangles_begin(bounding_polyhedron),
-                   TriangleAccessor().triangles_end(bounding_polyhedron));
-      tree_.build();
-      bounding_tree_ =
-        bounding_polyhedron.empty() ?
-        0 :
-        new AABB_tree_(TriangleAccessor().triangles_begin(bounding_polyhedron),
-                       TriangleAccessor().triangles_end(bounding_polyhedron));
-      if(!bounding_polyhedron.empty()) {
-        bounding_tree_->build();
-      }
-    }
-    else {
-      tree_.rebuild(TriangleAccessor().triangles_begin(bounding_polyhedron),
-                    TriangleAccessor().triangles_end(bounding_polyhedron));
-      bounding_tree_ = &tree_;
-    }
-    if(!p_rng_)
-    {
-      p_rng_ = new CGAL::Random(0);
-      delete_rng_ = true;
-    }
-  }
-
-  /**
-   * Constructor.
-   *
-   * Constructor from a sequence of polyhedral surfaces, without bounding
-   * surface. The domain will always answer false to "is_in_domain"
-   * queries.
-   *
-   * @param InputPolyhedraPtrIterator must an iterator of a sequence of
-   * pointers to polyhedra
-   */
-  template <typename InputPolyhedraPtrIterator>
-  Polyhedral_mesh_domain_3(InputPolyhedraPtrIterator begin,
-                           InputPolyhedraPtrIterator end,
-                           CGAL::Random* p_rng = NULL)
-    : p_rng_(p_rng)
-    , delete_rng_(false)
-  {
-    if(begin != end) {
-      for(; begin != end; ++begin) {
-        tree_.insert(TriangleAccessor().triangles_begin(**begin),
-                     TriangleAccessor().triangles_end(**begin));
-      }
-      tree_.build();
-    }
-    bounding_tree_ = 0;
-    if(!p_rng_)
-    {
-      p_rng_ = new CGAL::Random(0);
-      delete_rng_ = true;
-    }
-  }
-
-  /// Destructor
-  ~Polyhedral_mesh_domain_3() {
-    if(bounding_tree_ != 0 && bounding_tree_ != &tree_) {
-      delete bounding_tree_;
-    }
-    if(delete_rng_)
-      delete p_rng_;
-  }
-
-  /**
-   * Constructs  a set of \ccc{n} points on the surface, and output them to
-   *  the output iterator \ccc{pts} whose value type is required to be
-   *  \ccc{std::pair<Points_3, Index>}.
-   */
-  struct Construct_initial_points
-  {
-    Construct_initial_points(const Polyhedral_mesh_domain_3& domain)
-      : r_domain_(domain) {}
-
-    template<class OutputIterator>
-    OutputIterator operator()(OutputIterator pts, const int n = 8) const;
-
-  private:
-    const Polyhedral_mesh_domain_3& r_domain_;
-  };
-
-  Construct_initial_points construct_initial_points_object() const
-  {
-    return Construct_initial_points(*this);
-  }
-
-
-  /**
-   * Returns a bounding box of the domain
-   */
-  Bbox_3 bbox() const {
-    return tree_.bbox();
-  }
-
-
-  /**
-   * Returns true if point~\ccc{p} is in the domain. If \ccc{p} is in the
-   *  domain, the parameter index is set to the index of the subdomain
-   *  including $p$. It is set to the default value otherwise.
-   */
-  struct Is_in_domain
-  {
-    Is_in_domain(const Polyhedral_mesh_domain_3& domain)
-      : r_domain_(domain) {}
-
-    Subdomain operator()(const Point_3& p) const;
-  private:
-    const Polyhedral_mesh_domain_3& r_domain_;
-  };
-
-  Is_in_domain is_in_domain_object() const { return Is_in_domain(*this); }
-
-  Point_3 project_on_surface(const Point_3& p) const
-  {
-    return tree_.closest_point(p);
-  }
-
-  /// Allowed query types
-  typedef boost::mpl::vector<Segment_3, Ray_3, Line_3> Allowed_query_types;
-
-  /**
-   * Returns true is the element \ccc{type} intersect properly any of the
-   * surface patches describing the either the domain boundary or some
-   * subdomain boundary.
-   * \ccc{Type} is either \ccc{Segment_3}, \ccc{Ray_3} or \ccc{Line_3}.
-   * Parameter index is set to the index of the intersected surface patch
-   * if \ccc{true} is returned and to the default \ccc{Surface_patch_index}
-   * value otherwise.
-   */
-  struct Do_intersect_surface
-  {
-    Do_intersect_surface(const Polyhedral_mesh_domain_3& domain)
-      : r_domain_(domain) {}
-
-    template <typename Query>
-    typename boost::enable_if<typename boost::mpl::contains<Allowed_query_types,
-                                                            Query>::type,
-                              Surface_patch>::type
-    operator()(const Query& q) const
-    {
-      CGAL_MESH_3_PROFILER(std::string("Mesh_3 profiler: ") + std::string(CGAL_PRETTY_FUNCTION));
-
-      boost::optional<AABB_primitive_id> primitive_id = r_domain_.tree_.any_intersected_primitive(q);
-      if ( primitive_id )
-      {
-        r_domain_.cache_primitive(q, *primitive_id);
-        return Surface_patch(r_domain_.make_surface_index(*primitive_id));
-      } else {
-        return Surface_patch();
-      }
-    }
-
-  private:
-    const Polyhedral_mesh_domain_3& r_domain_;
-  };
-
-  Do_intersect_surface do_intersect_surface_object() const
-  {
-    return Do_intersect_surface(*this);
-  }
-
-  /**
-   * Returns a point in the intersection of the primitive \ccc{type}
-   * with some boundary surface.
-   * \ccc{Type1} is either \ccc{Segment_3}, \ccc{Ray_3} or \ccc{Line_3}.
-   * The integer \ccc{dimension} is set to the dimension of the lowest
-   * dimensional face in the input complex containing the returned point, and
-   * \ccc{index} is set to the index to be stored at a mesh vertex lying
-   * on this face.
-   */
-  struct Construct_intersection
-  {
-    Construct_intersection(const Polyhedral_mesh_domain_3& domain)
-      : r_domain_(domain) {}
-
-    template <typename Query>
-    typename boost::enable_if<typename boost::mpl::contains<Allowed_query_types,
-                                                            Query>::type,
-                              Intersection>::type
-    operator()(const Query& q) const
-    {
-      CGAL_MESH_3_PROFILER(std::string("Mesh_3 profiler: ") + std::string(CGAL_PRETTY_FUNCTION));
-      typedef typename AABB_tree_::template Intersection_and_primitive_id<Query>::Type
-        Intersection_and_primitive_id;
-      typedef boost::optional<Intersection_and_primitive_id> AABB_intersection;
-      typedef Point_3 Bare_point;
-
-      AABB_intersection intersection;
-#ifndef CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
-      if(r_domain_.query_is_cached(q))
-      {
-        const AABB_primitive_id primitive_id = r_domain_.cached_primitive_id();
-        typename cpp11::result_of<
-          typename IGT::Intersect_3(typename Primitive::Datum, Query)>::type o
-            = IGT().intersect_3_object()(Primitive(primitive_id).datum(),q);
-        intersection = o ?
-          Intersection_and_primitive_id(*o, primitive_id) :
-          AABB_intersection();
-      } else
-#endif // not CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
-      {
-#ifndef CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
-        CGAL_precondition(r_domain_.do_intersect_surface_object()(q));
-#endif // NOT CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
-
-        intersection = r_domain_.tree_.any_intersection(q);
-      }
-      if ( intersection )
-      {
-        // Get primitive
-        AABB_primitive_id primitive_id = intersection->second;
-
-        // intersection may be either a point or a segment
-#if CGAL_INTERSECTION_VERSION > 1
-        if ( const Bare_point* p_intersect_pt =
-             boost::get<Bare_point>( &(intersection->first) ) )
-#else
-        if ( const Bare_point* p_intersect_pt =
-             object_cast<Bare_point>( &(intersection->first) ) )
-#endif
-        {
-          return Intersection(*p_intersect_pt,
-                              r_domain_.index_from_surface_patch_index(
-                                r_domain_.make_surface_index(primitive_id)),
-                              2);
-        }
-#if CGAL_INTERSECTION_VERSION > 1
-        else if ( const Segment_3* p_intersect_seg =
-                  boost::get<Segment_3>(&(intersection->first)))
-#else
-        else if ( const Segment_3* p_intersect_seg =
-                  object_cast<Segment_3>(&(intersection->first)))
-#endif
-        {
-          CGAL_MESH_3_PROFILER("Mesh_3 profiler: Intersection is a segment");
-
-          return Intersection(p_intersect_seg->source(),
-                              r_domain_.index_from_surface_patch_index(
-                                r_domain_.make_surface_index(primitive_id)),
-                              2);
-        }
-        else {
-#ifndef CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
-          std::stringstream stream;
-          stream.precision(17);
-          set_pretty_mode(stream);
-          stream <<
-            "Mesh_3 error : AABB_tree any_intersection result is "
-            "not a point nor a segment\n";
-          if(intersection->first.empty()) {
-            stream <<  "The intersection is empty!";
-          } else {
-            stream <<  "The intersection typeinfo name is ";
-            stream <<  intersection->first.type().name();
-          }
-          stream << "\nThe query was: ";
-          stream << q << std::endl;
-          stream << "The intersecting primitive in the AABB tree was: "
-                 << AABB_primitive(intersection->second).datum() << std::endl;
-          CGAL_error_msg(stream.str().c_str());
-#endif // not CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
-        }
-      }
-
-      // Should not happen
-      // unless CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3 is defined
-      return Intersection();
-    }
-
-  private:
-    const Polyhedral_mesh_domain_3& r_domain_;
-  };
-
-  Construct_intersection construct_intersection_object() const
-  {
-    return Construct_intersection(*this);
-  }
-
-
-  /**
-   * Returns the index to be stored in a vertex lying on the surface identified
-   * by \c index.
-   */
-  Index index_from_surface_patch_index(const Surface_patch_index& index) const
-  { return Index(index); }
-
-  /**
-   * Returns the index to be stored in a vertex lying in the subdomain
-   * identified by \c index.
-   */
-  Index index_from_subdomain_index(const Subdomain_index& index) const
-  { return Index(index); }
-
-  /**
-   * Returns the \c Surface_patch_index of the surface patch
-   * where lies a vertex with dimension 2 and index \c index.
-   */
-  Surface_patch_index surface_patch_index(const Index& index) const
-  { return boost::get<Surface_patch_index>(index); }
-
-  /**
-   * Returns the index of the subdomain containing a vertex
-   *  with dimension 3 and index \c index.
-   */
-  Subdomain_index subdomain_index(const Index& index) const
-  { return boost::get<Subdomain_index>(index); }
-
-  // -----------------------------------
-  // Backward Compatibility
-  // -----------------------------------
-#ifndef CGAL_MESH_3_NO_DEPRECATED_SURFACE_INDEX
-  typedef Surface_patch_index   Surface_index;
-
-  Index index_from_surface_index(const Surface_index& index) const
-  { return index_from_surface_patch_index(index); }
-
-  Surface_index surface_index(const Index& index) const
-  { return surface_patch_index(index); }
-#endif // CGAL_MESH_3_NO_DEPRECATED_SURFACE_INDEX
-  // -----------------------------------
-  // End backward Compatibility
-  // -----------------------------------
-
-public:
-  Surface_patch_index make_surface_index(
-    const AABB_primitive_id& primitive_id = AABB_primitive_id() ) const
-  {
-    Mesh_3::details::Surface_patch_index_generator<Subdomain_index,
-                                                   Polyhedron,
-                                                   Use_patch_id_tag> generator;
-
-    return generator(primitive_id);
-  }
-
-  // Undocumented function, used to implement a sizing field that
-  // computes lfs using this AABB tree. That avoids to rebuild the same
-  // tree.
-  typedef AABB_tree_ AABB_tree;
-  const AABB_tree& aabb_tree() const {
-    return tree_;
-  }
-
-protected:
-  void add_primitives(const Polyhedron& p)
-  {
-    tree_.insert(TriangleAccessor().triangles_begin(p),
-                 TriangleAccessor().triangles_end(p));
-
-    tree_.build();
-  }
-
-private:
-  /// The AABB tree: intersection detection and more
-  AABB_tree_ tree_;
-
-  AABB_tree_* bounding_tree_;
-
-  // cache queries and intersected primitive
-  typedef typename boost::make_variant_over<Allowed_query_types>::type Cached_query;
-  struct Query_cache
-  {
-    Query_cache() : has_cache(false) {}
-    bool has_cache;
-    Cached_query cached_query;
-    AABB_primitive_id cached_primitive_id;
-  };
-#ifdef CGAL_LINKED_WITH_TBB
-  mutable tbb::enumerable_thread_specific<Query_cache> query_cache;
-#else
-  mutable Query_cache query_cache;
-#endif
-
-  //random number generator for Construct_initial_points
-  CGAL::Random* p_rng_;
-  bool delete_rng_;
-
-public:
-
-  template <typename Query>
-  void cache_primitive(const Query& q,
-                       const AABB_primitive_id id) const
-  {
-#ifdef CGAL_LINKED_WITH_TBB
-    Query_cache &qc = query_cache.local();
-    qc.cached_query = Cached_query(q);
-    qc.has_cache = true;
-    qc.cached_primitive_id = id;
-#else
-    query_cache.cached_query = Cached_query(q);
-    query_cache.has_cache = true;
-    query_cache.cached_primitive_id = id;
-#endif
-  }
-
-  template <typename Query>
-  bool query_is_cached(const Query& q) const {
-#ifdef CGAL_LINKED_WITH_TBB
-    Query_cache &qc = query_cache.local();
-    return qc.has_cache && (qc.cached_query == Cached_query(q));
-#else
-    return query_cache.has_cache 
-      && (query_cache.cached_query == Cached_query(q));
-#endif
-  }
-
-  AABB_primitive_id cached_primitive_id() const {
-#ifdef CGAL_LINKED_WITH_TBB
-    return query_cache.local().cached_primitive_id;
-#else
-    return query_cache.cached_primitive_id;
-#endif
-  }
-
-  void set_random_generator(CGAL::Random* p_rng)
-  {
-    if(delete_rng_) delete p_rng_;
-    if(!p_rng)
-    {
-      p_rng_ = new CGAL::Random(0);
-      delete_rng_ = true;
-    }
-    else {
-      p_rng_ = p_rng;
-      delete_rng_ = false;
-    }
-  }
-
-private:
-  // Disabled copy constructor & assignment operator
-  typedef Polyhedral_mesh_domain_3 Self;
-  Polyhedral_mesh_domain_3(const Self& src);
-  Self& operator=(const Self& src);
-
-};  // end class Polyhedral_mesh_domain_3
-
-
-
-
-
-template<typename P_, typename IGT_, typename TA,
-         typename Tag, typename E_tag_>
-template<class OutputIterator>
-OutputIterator
-Polyhedral_mesh_domain_3<P_,IGT_,TA,Tag,E_tag_>::
-Construct_initial_points::operator()(OutputIterator pts,
-                                     const int n) const
-{
-  typename IGT::Construct_ray_3 ray = IGT().construct_ray_3_object();
-  typename IGT::Construct_vector_3 vector = IGT().construct_vector_3_object();
-
-  const Bounding_box bbox = r_domain_.tree_.bbox();
-  const Point_3 center( FT( (bbox.xmin() + bbox.xmax()) / 2),
-                        FT( (bbox.ymin() + bbox.ymax()) / 2),
-                        FT( (bbox.zmin() + bbox.zmax()) / 2) );
-
-  CGAL::Random& rng = *(r_domain_.p_rng_);
-  Random_points_on_sphere_3<Point_3> random_point(1., rng);
-
-  int i = n;
-# ifdef CGAL_MESH_3_VERBOSE
-  std::cerr << "construct initial points:" << std::endl;
-# endif
-  // Point construction by ray shooting from the center of the enclosing bbox
-  while ( i > 0 )
-  {
-    const Ray_3 ray_shot = ray(center, vector(CGAL::ORIGIN,*random_point));
-
-#ifdef CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
-    Intersection intersection = r_domain_.construct_intersection_object()(ray_shot);
-    if(CGAL::cpp0x::get<2>(intersection) != 0) {
-#else
-    if(r_domain_.do_intersect_surface_object()(ray_shot)) {
-      Intersection intersection = r_domain_.construct_intersection_object()(ray_shot);
-#endif
-      *pts++ = std::make_pair(CGAL::cpp0x::get<0>(intersection),
-                              CGAL::cpp0x::get<1>(intersection));
-
-      --i;
-
-#ifdef CGAL_MESH_3_VERBOSE
-      std::cerr << boost::format("\r             \r"
-                                 "%1%/%2% initial point(s) found...")
-        % (n - i)
-        % n;
-# endif
-    }
-    ++random_point;
-  }
-
-#ifdef CGAL_MESH_3_VERBOSE
-  std::cerr << std::endl;
-#endif
-  return pts;
-}
-
-
-template<typename P_, typename IGT_, typename TA,
-         typename Tag, typename E_tag_>
-typename Polyhedral_mesh_domain_3<P_,IGT_,TA,Tag,E_tag_>::Subdomain
-Polyhedral_mesh_domain_3<P_,IGT_,TA,Tag,E_tag_>::
-Is_in_domain::operator()(const Point_3& p) const
-{
-  if(r_domain_.bounding_tree_ == 0) return Subdomain();
-
-  internal::Point_inside_vertical_ray_cast<IGT_, AABB_tree_> inside_functor;
-  Bounded_side side = inside_functor(p, *(r_domain_.bounding_tree_));
-
-  if(side == CGAL::ON_UNBOUNDED_SIDE) { return Subdomain(); }
-  else { return Subdomain(Subdomain_index(1)); } // case ON_BOUNDARY && ON_BOUNDED_SIDE
-}
-
-
-
-
-}  // end namespace CGAL
-
-
-#endif // POLYHEDRAL_MESH_TRAITS_3_H_
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polyhedral_mesh_domain_with_features_3.h b/3rdparty/CGAL-4.8/include/CGAL/Polyhedral_mesh_domain_with_features_3.h
deleted file mode 100644
index a4fe82a..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polyhedral_mesh_domain_with_features_3.h
+++ /dev/null
@@ -1,245 +0,0 @@
-// Copyright (c) 2009-2010 INRIA Sophia-Antipolis (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
-// 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(s)     : Stéphane Tayeb
-//
-//******************************************************************************
-// File Description :
-//
-//******************************************************************************
-
-#ifndef CGAL_POLYHEDRAL_MESH_DOMAIN_WITH_FEATURES_3_H
-#define CGAL_POLYHEDRAL_MESH_DOMAIN_WITH_FEATURES_3_H
-
-#include <CGAL/Mesh_3/config.h>
-
-#include <CGAL/Random.h>
-#include <CGAL/Polyhedral_mesh_domain_3.h>
-#include <CGAL/Mesh_domain_with_polyline_features_3.h>
-#include <CGAL/Mesh_polyhedron_3.h>
-
-#include <CGAL/Mesh_3/Detect_polylines_in_polyhedra.h>
-#include <CGAL/Mesh_3/Polyline_with_context.h>
-#include <CGAL/Mesh_3/Detect_features_in_polyhedra.h>
-
-#include <CGAL/enum.h>
-#include <CGAL/IO/Polyhedron_iostream.h>
-
-#include <boost/iterator/transform_iterator.hpp>
-
-#include <string>
-#include <vector>
-#include <fstream>
-
-
-namespace CGAL {
-
-/**
- * @class Polyhedral_mesh_domain_with_features_3
- *
- *
- */
-template < class IGT_,
-           class Polyhedron_ = typename Mesh_polyhedron_3<IGT_>::type,
-           class TriangleAccessor=Triangle_accessor_3<Polyhedron_,IGT_>,
-           class Use_patch_id_tag = Tag_true,
-           class Use_exact_intersection_construction_tag = Tag_true >
-class Polyhedral_mesh_domain_with_features_3
-  : public Mesh_domain_with_polyline_features_3<
-      Polyhedral_mesh_domain_3< Polyhedron_,
-                                IGT_,
-                                TriangleAccessor,
-                                Use_patch_id_tag,
-                                Use_exact_intersection_construction_tag > >
-{
-  typedef Mesh_domain_with_polyline_features_3<
-    Polyhedral_mesh_domain_3<
-      Polyhedron_, IGT_, TriangleAccessor,
-      Use_patch_id_tag, Use_exact_intersection_construction_tag > > Base;
-  
-public:
-  typedef Polyhedron_ Polyhedron;
-  
-  // Index types
-  typedef typename Base::Index                Index;
-  typedef typename Base::Corner_index         Corner_index;
-  typedef typename Base::Curve_segment_index  Curve_segment_index;
-  typedef typename Base::Surface_patch_index  Surface_patch_index;
-  typedef typename Base::Subdomain_index      Subdomain_index;
-  
-  // Backward compatibility
-#ifndef CGAL_MESH_3_NO_DEPRECATED_SURFACE_INDEX
-  typedef Surface_patch_index                 Surface_index;
-#endif // CGAL_MESH_3_NO_DEPRECATED_SURFACE_INDEX
-
-  typedef typename Base::R         R;
-  typedef typename Base::Point_3   Point_3;
-  typedef typename Base::FT        FT;
-  
-  typedef CGAL::Tag_true           Has_features;
-
-  /// Constructors
-  Polyhedral_mesh_domain_with_features_3(const Polyhedron& p,
-    CGAL::Random* p_rng = NULL);
-  Polyhedral_mesh_domain_with_features_3(const std::string& filename,
-    CGAL::Random* p_rng = NULL);
-
-  // The following is needed, because otherwise, when a "const char*" is
-  // passed, the constructors templates are a better match, than the
-  // constructor with `std::string`.
-  Polyhedral_mesh_domain_with_features_3(const char* filename,
-    CGAL::Random* p_rng = NULL);
-
-  template <typename T1, typename T2>
-  Polyhedral_mesh_domain_with_features_3(const T1& a, const T2& b,
-                                         CGAL::Random* p_rng = NULL)
-    : Base(a, b)
-  { this->set_random_generator(p_rng); }
-
-
-  template <typename T1, typename T2, typename T3>
-  Polyhedral_mesh_domain_with_features_3(const T1& a, const T2& b, const T3& c,
-                                         CGAL::Random* p_rng = NULL)
-    : Base(a, b, c)
-  { this->set_random_generator(p_rng); }
-
-  /// Destructor
-  ~Polyhedral_mesh_domain_with_features_3() {}
-
-  /// Detect features
-  void initialize_ts(Polyhedron& p);
-
-  void detect_features(FT angle_in_degree, Polyhedron& p);
-  void detect_features(FT angle_in_degree = FT(60)) { detect_features(angle_in_degree, polyhedron_); }
-
-private:
-  Polyhedron polyhedron_;
-
-public:
-  const Polyhedron& polyhedron() const { return polyhedron_; }
-  
-private:
-  // Disabled copy constructor & assignment operator
-  typedef Polyhedral_mesh_domain_with_features_3 Self;
-  Polyhedral_mesh_domain_with_features_3(const Self& src);
-  Self& operator=(const Self& src);
-
-};  // end class Polyhedral_mesh_domain_with_features_3
-
-
-template < typename GT_, typename P_, typename TA_,
-           typename Tag_, typename E_tag_>
-Polyhedral_mesh_domain_with_features_3<GT_,P_,TA_,Tag_,E_tag_>::
-Polyhedral_mesh_domain_with_features_3(const Polyhedron& p,
-                                       CGAL::Random* p_rng)
-  : Base()
-  , polyhedron_(p)
-{
-  this->add_primitives(polyhedron_);
-  this->set_random_generator(p_rng);
-}
-
-template < typename GT_, typename P_, typename TA_,
-           typename Tag_, typename E_tag_>
-Polyhedral_mesh_domain_with_features_3<GT_,P_,TA_,Tag_,E_tag_>::
-Polyhedral_mesh_domain_with_features_3(const char* filename,
-                                       CGAL::Random* p_rng)
-  : Base()
-  , polyhedron_()
-{
-  // Create input polyhedron
-  std::ifstream input(filename);
-  input >> polyhedron_;
-  this->add_primitives(polyhedron_);
-  this->set_random_generator(p_rng);
-}
-
-template < typename GT_, typename P_, typename TA_,
-           typename Tag_, typename E_tag_>
-Polyhedral_mesh_domain_with_features_3<GT_,P_,TA_,Tag_,E_tag_>::
-Polyhedral_mesh_domain_with_features_3(const std::string& filename,
-                                       CGAL::Random* p_rng)
-  : Base()
-  , polyhedron_()
-{
-  // Create input polyhedron
-  std::ifstream input(filename.c_str());
-  input >> polyhedron_;
-  this->add_primitives(polyhedron_);
-  this->set_random_generator(p_rng);
-}
-
-
-template < typename GT_, typename P_, typename TA_,
-           typename Tag_, typename E_tag_>
-void
-Polyhedral_mesh_domain_with_features_3<GT_,P_,TA_,Tag_,E_tag_>::
-initialize_ts(Polyhedron& p)
-{
-  std::size_t ts = 0;
-  for(typename Polyhedron::Vertex_iterator v = p.vertices_begin(),
-      end = p.vertices_end() ; v != end ; ++v)
-  {
-    v->set_time_stamp(ts++);
-  }
-  for(typename Polyhedron::Facet_iterator fit = p.facets_begin(),
-       end = p.facets_end() ; fit != end ; ++fit )
-  {
-    fit->set_time_stamp(ts++);
-  }
-  for(typename Polyhedron::Halfedge_iterator hit = p.halfedges_begin(),
-       end = p.halfedges_end() ; hit != end ; ++hit )
-  {
-    hit->set_time_stamp(ts++);
-  }
-}
-
-
-template < typename GT_, typename P_, typename TA_,
-           typename Tag_, typename E_tag_>
-void
-Polyhedral_mesh_domain_with_features_3<GT_,P_,TA_,Tag_,E_tag_>::
-detect_features(FT angle_in_degree, Polyhedron& p)
-{
-  initialize_ts(p);
-  // Get sharp features
-  Mesh_3::detect_features(p,angle_in_degree);
-  
-  // Get polylines
-  typedef std::vector<Point_3> Bare_polyline;
-  typedef Mesh_3::Polyline_with_context<Surface_patch_index, Curve_segment_index,
-    Bare_polyline > Polyline;
-  
-  std::vector<Polyline> polylines;
-  typedef std::back_insert_iterator<std::vector<Polyline> > Output_iterator;
-
-  Mesh_3::detect_polylines<Polyhedron,Polyline,Output_iterator>(
-    &p, std::back_inserter(polylines));
-    
-  // Insert polylines in domain
-  Mesh_3::Extract_bare_polyline<Polyline> extractor;
-  
-  this->add_features(
-    boost::make_transform_iterator(polylines.begin(),extractor),
-    boost::make_transform_iterator(polylines.end(),extractor));
-}
-
-} //namespace CGAL
-
-
-#endif // CGAL_POLYHEDRAL_MESH_DOMAIN_WITH_FEATURES_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polyline_constraint_hierarchy_2.h b/3rdparty/CGAL-4.8/include/CGAL/Polyline_constraint_hierarchy_2.h
deleted file mode 100644
index 07906b9..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polyline_constraint_hierarchy_2.h
+++ /dev/null
@@ -1,1174 +0,0 @@
-// Copyright (c) 2012  INRIA Sophia-Antipolis (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
-// 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(s)     : Andreas Fabri, Olivier Billet, Mariette Yvinec
-
-#ifndef CGAL_POLYLINE_CONSTRAINT_HIERARCHY_2_H
-#define CGAL_POLYLINE_CONSTRAINT_HIERARCHY_2_H
-
-#include <CGAL/basic.h>
-#include <utility>
-#include <map>
-#include <set> 
-#include <list> 
-#include <CGAL/Skiplist.h>
-#include <CGAL/Iterator_project.h>
-#include <CGAL/triangulation_assertions.h>
-
-namespace CGAL {
-
-// T               is expected to be Vertex_handle
-// Compare         is a comparison operator for type T
-// Data            is intended to store info on a Vertex
-template <class T, class Compare, class Data>
-class Polyline_constraint_hierarchy_2
-{
-public:
-  typedef Data                                    Point;
-  typedef T                                       Vertex_handle;
-  typedef std::pair<T, T>                         Edge;
-  typedef std::pair<T, T>                         Constraint;
-  typedef std::pair<T, T>                         Subconstraint;
-
-private:
-  class Node {
-  public:
-    explicit Node(Vertex_handle vh, bool input = false)
-      : vertex_(vh), point_(vh->point()), id(-1), input(input)
-    {}
-    Point& point() { return point_; }
-    const Point& point() const { return point_; }
-    Vertex_handle vertex() const { return vertex_; }
-  private:
-    Vertex_handle vertex_;
-    Point point_;
-  public:
-    int id;
-    bool input;
-  };
-
-  typedef CGAL::Skiplist<Node>  Vertex_list;
-  typedef std::list<Constraint> Constraint_list;
-
-public:
-  // the base line is always 
-  class Point_it 
-    : public boost::iterator_adaptor<
-    Point_it
-    , typename Vertex_list::all_iterator 
-    , Point
-    >
-  {
-  public:
-    Point_it() : Vertex_it::iterator_adaptor_() {}
-    Point_it(typename Vertex_list::all_iterator it) : Point_it::iterator_adaptor_(it) {}
-  private:
-    friend class boost::iterator_core_access;
-    Point& dereference() const { return this->base()->point(); }
-  };
-
-  // only nodes with a vertex_handle that is still in the triangulation
-  class Vertex_it 
-    : public boost::iterator_adaptor<
-    Vertex_it
-    , typename Vertex_list::skip_iterator 
-    , Vertex_handle
-    , boost::use_default
-    , Vertex_handle>
-  {
-  public:
-    Vertex_it() : Vertex_it::iterator_adaptor_() {}
-    Vertex_it(typename Vertex_list::skip_iterator it) : Vertex_it::iterator_adaptor_(it) {}
-    operator Point_it() const { return Point_it(this->base()); }
-    bool& input() { return this->base()->input; }
-  private:
-    friend class boost::iterator_core_access;
-    Vertex_handle dereference() const { return this->base()->vertex(); }
-  };
-
-  typedef typename Constraint_list::iterator Constraint_it;
-
-  struct Constraint_id {
-    Vertex_list* second;
-
-    Constraint_id(): second(NULL) {}
-
-    Constraint_id(Vertex_list* vl)
-      : second(vl)
-    {}
-
-    Vertex_list* vl_ptr() const {return second;}
-
-    operator std::pair<std::pair<Vertex_handle, Vertex_handle>,Vertex_list*>()
-    { 
-      if (second!=NULL){
-        return std::make_pair(std::make_pair(second->front().vertex(),
-                                             second->back().vertex()),second);
-      } 
-      return std::make_pair(std::make_pair(Vertex_handle(),Vertex_handle()),second);
-    }
-
-    bool operator == (const Constraint_id& other) const
-    {
-      return second == other.second;
-    }
-    bool operator != (const Constraint_id& other) const
-    {
-      return second != other.second;
-    }
-
-    bool operator<(const Constraint_id& other) const{
-      return second < other.second;
-    }
-  };
-
-  class Pair_compare {
-    Compare comp;
-
-  public:
-    Pair_compare(const Compare& comp) : comp(comp) {}
-
-    bool operator()(const Edge& e1, const Edge& e2) const {
-      if(comp(e1.first, e2.first)) {
-        return true;
-      } else if((! comp(e2.first, e1.first)) && //  !less(e1,e2) && !less(e2,e1) == equal
-                comp(e1.second, e2.second)) {
-        return true;
-      } else {
-        return false;
-      }
-    }
-  };
-
-  class Context {
-    friend class Polyline_constraint_hierarchy_2<T,Compare,Data>;
-  private:
-    Vertex_list*    enclosing;
-    Vertex_it       pos;
-  public:
-    Context() : enclosing(NULL) {}
-
-    Context(const Context& hc)
-      : enclosing(hc.enclosing), pos(hc.pos)
-    {}
-
-    Vertex_it    vertices_begin() { return enclosing->skip_begin();}
-    Vertex_it    current() {return pos;}
-    Vertex_it    vertices_end() {return enclosing->skip_end();}
-    Constraint_id  id() { return enclosing; }
-    std::size_t    number_of_vertices() const {return enclosing->skip_size(); }
-  };                                           
-
-  typedef std::list<Context>              Context_list;
-  typedef typename Context_list::iterator Context_iterator;
-
-  typedef std::set<Constraint_id>           Constraint_set;
-  typedef std::map<Edge, Context_list*,
-		   Pair_compare>            Sc_to_c_map;
-  typedef typename Constraint_set::iterator C_iterator;
-  typedef typename Sc_to_c_map::const_iterator    Sc_iterator;
-  typedef Sc_iterator Subconstraint_iterator;
-  
-private:
-  // data for the 1d hierarchy
-  Compare          comp;
-  Constraint_set   constraint_set;
-  Sc_to_c_map      sc_to_c_map;
-  std::map<std::pair<Vertex_handle, Vertex_handle>,
-	   Constraint_id,
-	   Pair_compare> constraint_map;
-  
-public:
-  Polyline_constraint_hierarchy_2(const Compare& comp)
-    : comp(comp)
-    , sc_to_c_map(Pair_compare(comp))
-    , constraint_map(Pair_compare(comp))
-  { }
-  Polyline_constraint_hierarchy_2(const Polyline_constraint_hierarchy_2& ch); 
-  ~Polyline_constraint_hierarchy_2(){ clear();}
-  void clear();
-  Polyline_constraint_hierarchy_2& operator=(const Polyline_constraint_hierarchy_2& ch);
-
-  // Query 
-  bool is_subconstrained_edge(T va, T vb) const;
-  bool is_constrained_edge(T va, T vb) const;
-  bool is_constrained_vertex(T v) const;
-
-  Vertex_it vertices_in_constraint_begin(Constraint_id cid) const
-  { return cid.vl_ptr()->skip_begin(); }
-  Vertex_it vertices_in_constraint_end(Constraint_id cid) const
-  { return cid.vl_ptr()->skip_end(); }
-
-  Vertex_it vertices_in_constraint_begin(Vertex_handle va, Vertex_handle vb) const
-  { Constraint_id cid = constraint_map.find(make_edge(va,vb))->second;
-    return cid.vl_ptr()->skip_begin(); }
-
-  Vertex_it vertices_in_constraint_end(Vertex_handle va, Vertex_handle vb) const
-  { Constraint_id cid = constraint_map.find(make_edge(va,vb))->second;
-    return cid.vl_ptr()->skip_end(); }
-
-  Point_it points_in_constraint_begin(Constraint_id cid) const
-  { return cid.vl_ptr()->all_begin(); }
-  Point_it points_in_constraint_end(Constraint_id cid) const
-  { return cid.vl_ptr()->all_end(); }
-
-  bool enclosing_constraint(Edge he, Constraint& hc) const;
-  bool enclosing_constraint(T  vaa, T  vbb, T& va, T& vb) const;
-  bool enclosing_constraints(T vaa, T  vbb,  Constraint_list& hcl) const;
-  bool next_along_sc(T va, T vb, T& w) const;
-  void oriented_end(T va, T vb, T& vc) const;
-
-  Context context(T va, T vb);
-  std::size_t number_of_enclosing_constraints(T va, T vb) const;
-  Context_iterator contexts_begin(T va, T vb) const;
-  Context_iterator contexts_end(T va, T vb) const;
-  std::size_t number_of_constraints() const  { return constraint_set.size();}
-  std::size_t number_of_subconstraints()const {return sc_to_c_map.size();}
-  
-
-  // insert/remove
-  void add_Steiner(T va, T vb, T vx);
-  Vertex_list* insert_constraint(T va, T vb);
-  void append_constraint(Constraint_id cid, T va, T vb);
-  void swap(Constraint_id first, Constraint_id second);
-  void remove_constraint(Constraint_id cid);
-
-  void remove_constraint(Vertex_handle va, Vertex_handle vb)
-  {
-    remove_constraint(constraint_map[make_edge(va,vb)]);
-  }
-
-  void split_constraint(T va, T vb, T vc);
-
-  void simplify(Vertex_it u,
-                Vertex_it v,
-                Vertex_it w);
-
-  std::size_t remove_points_without_corresponding_vertex(Constraint_id);
-  std::size_t remove_points_without_corresponding_vertex();
-
-  Constraint_id concatenate(Constraint_id first, Constraint_id second);
-  Constraint_id concatenate2(Constraint_id first, Constraint_id second);
-  Constraint_id split(Constraint_id first, Vertex_it vcit);
-  Constraint_id split2(Constraint_id first, Vertex_it vcit);
-
-  void remove_Steiner(T v, T va, T vb);
-
-  // iterators
-
-  Subconstraint_iterator subconstraint_begin() const
-  { 
-    return sc_to_c_map.begin(); 
-  }
-
-  Subconstraint_iterator subconstraint_end() const
-  { 
-    return sc_to_c_map.end();   
-  }
-
-  Sc_iterator sc_begin() const{ return sc_to_c_map.begin(); }
-  Sc_iterator sc_end()   const{ return sc_to_c_map.end();   }
-  C_iterator  c_begin()  const{ return constraint_set.begin(); }
-  C_iterator  c_end()    const{ return constraint_set.end();   }
-  
-  // Helper functions
-  void copy(const Polyline_constraint_hierarchy_2& ch);
-  void copy(const Polyline_constraint_hierarchy_2& ch, std::map<Vertex_handle,Vertex_handle>& vmap);
-  void swap(Polyline_constraint_hierarchy_2& ch);
-
-private: 
-  Edge      make_edge(T va, T vb) const;
-  Vertex_it get_pos(T va, T vb) const;
-  bool      get_contexts(T va, T vb, 
-			 Context_iterator& ctxt, 
-			 Context_iterator& past) const;
-
-  bool      get_contexts(T va, T vb, Context_list*&) const;
-
-  //to_debug
-public:
-  void   print() const;
-};
-
-template <class T, class Compare, class Data>
-Polyline_constraint_hierarchy_2<T,Compare,Data>::
-Polyline_constraint_hierarchy_2(const Polyline_constraint_hierarchy_2& ch)
-  : comp(ch.comp)
-  , sc_to_c_map(Pair_compare(comp))
-  , constraint_map(Pair_compare(comp))
-{
-  copy(ch);
-}
-
-template <class T, class Compare, class Data>
-Polyline_constraint_hierarchy_2<T,Compare,Data>&
-Polyline_constraint_hierarchy_2<T,Compare,Data>::
-operator=(const Polyline_constraint_hierarchy_2& ch){
-  copy(ch);
-  return *this;
-}
-
-template <class T, class Compare, class Data>
-void
-Polyline_constraint_hierarchy_2<T,Compare,Data>::
-copy(const Polyline_constraint_hierarchy_2& ch1)
-{
-  // create a identity transfer vertex map
-  std::map<Node, Node>  vmap;
-  C_iterator cit1 = ch1.c_begin();
-  for( ; cit1 != ch1.c_end(); ++cit1) {
-    Vertex_it vit = cit1->second->begin();
-    for( ; vit != cit1->second->end(); ++vit) {
-      vmap[*vit] = *vit;
-    }
-  }
-  copy(ch1, vmap);
-}
-
-template <class T, class Compare, class Data>
-void
-Polyline_constraint_hierarchy_2<T,Compare,Data>::
-copy(const Polyline_constraint_hierarchy_2& ch1, std::map<Vertex_handle,Vertex_handle>& vmap)
-  // copy with a transfer vertex map
-{
-  std::map<Vertex_list*,Vertex_list*> vlmap;
-  clear();
-  // copy constraint_set
-  C_iterator cit1 = ch1.c_begin();
-  for( ; cit1 != ch1.c_end(); ++cit1) {
-    Vertex_list* hvl1 = cit1->vl_ptr();
-    Vertex_list* hvl2 = new Vertex_list;
-    vlmap[hvl1] = hvl2;
-    Vertex_it vit = hvl1->skip_begin(), end = hvl1->skip_end();
-    for( ; vit != end; ++vit) hvl2->push_back(Node(vmap[*vit]));
-    constraint_set.insert(hvl2);
-  }
-  // copy sc_to_c_map
-  Sc_iterator scit1 = ch1.sc_begin();
-  for( ; scit1 != ch1.sc_end(); ++scit1) {
-    //vertices of the subconstraints
-    Vertex_handle uu2 = vmap[scit1->first.first];
-    Vertex_handle vv2 = vmap[scit1->first.second];
-    Context_list* hcl1  = scit1->second;
-    Context_list* hcl2  = new Context_list;
-    Context_iterator cit1 = hcl1->begin();
-    for( ; cit1 != hcl1->end(); ++cit1){
-      // vertices of the enclosing constraints
-      Context ctxt2;
-      ctxt2.enclosing = vlmap[cit1->enclosing];
-      ctxt2.pos = ctxt2.enclosing->skip_begin();
-      Vertex_it aux = cit1->enclosing->skip_begin();
-      while( aux != cit1->pos) {
-	++aux;
-	++ctxt2.pos;
-      }
-      hcl2->push_back(ctxt2);
-    }
-    sc_to_c_map[make_edge(uu2,vv2)] = hcl2;
-  }
-
-  comp = ch1.comp;
-  return;
-}
-
-
-template <class T, class Compare, class Data>
-void
-Polyline_constraint_hierarchy_2<T,Compare,Data>::
-swap(Polyline_constraint_hierarchy_2& ch)
-{
-  constraint_set.swap(ch.constraint_set);
-  sc_to_c_map.swap(ch.sc_to_c_map);
-}
-
-
-/*
-template <class T, class Compare, class Data>
-bool Polyline_constraint_hierarchy_2<T,Compare,Data>::
-is_constrained_edge(T va, T vb) const
-{
-  return( c_to_sc_map.find(make_edge(va, vb)) != c_to_sc_map.end() );
-}
-*/
-
-template <class T, class Compare, class Data>
-bool Polyline_constraint_hierarchy_2<T,Compare,Data>::
-is_subconstrained_edge(T va, T vb) const
-{
-  return( sc_to_c_map.find(make_edge(va, vb)) != sc_to_c_map.end() );
-}
-
-
-// af: obsolete
-template <class T, class Compare, class Data>
-bool Polyline_constraint_hierarchy_2<T,Compare,Data>::
-enclosing_constraint(Edge he, Constraint& hc) const
-{
-  Context_iterator hcit, past;
-  if ( !get_contexts(he.first,he.second, hcit ,past)) return false;
-  hc = make_edge(hcit->enclosing->front(), hcit->enclosing->back());
-  return true;
-}
-
-
-// used by Constrained_triangulation_plus_2::intersect with Exact_intersection_tag
-template <class T, class Compare, class Data>
-bool Polyline_constraint_hierarchy_2<T,Compare,Data>::
-enclosing_constraint(T  vaa, T  vbb, T& va, T& vb) const
-{
-  Context_iterator hcit, past;
-  if ( !get_contexts(vaa,vbb, hcit ,past)) return false;
-  // va = hcit->enclosing->front().vertex();
-  // vb = hcit->enclosing->back().vertex();
-  // Vertex_list* vl = hcit->enclosing;
-  Vertex_it pos = hcit->pos;
-  if(vaa != *pos){
-    std::swap(vaa,vbb);
-  }
-  while(!pos.input()){
-    --pos;
-  }
-  va = *pos;
-  pos = hcit->pos;
-  ++pos;
-  CGAL_triangulation_assertion(vbb == *pos);
-  while(!pos.input()){
-    ++pos;
-  }
-  vb = *pos;
-  return true;
-}
-
-// af: obsolete
-template <class T, class Compare, class Data>
-bool Polyline_constraint_hierarchy_2<T,Compare,Data>::
-enclosing_constraints(T vaa, T vbb , Constraint_list& hcl) const
-{
-  Context_iterator hcit, past;
-  if ( !get_contexts(vaa,vbb, hcit ,past)) return false;
-  for (; hcit!=past; hcit++) {
-    hcl.push_back(make_edge(hcit->enclosing->front(), 
-			    hcit->enclosing->back())); 
-  }
-  return true;
-}
-
-template <class T, class Compare, class Data>
-typename Polyline_constraint_hierarchy_2<T,Compare,Data>::Context
-Polyline_constraint_hierarchy_2<T,Compare,Data>::
-context(T va, T vb)
-{
-  Context_iterator hcit, past;
-  if(!get_contexts(va,vb, hcit ,past)) CGAL_triangulation_assertion(false);
-  return *hcit;
-}
-
-template <class T, class Compare, class Data>
-std::size_t 
-Polyline_constraint_hierarchy_2<T,Compare,Data>::
-number_of_enclosing_constraints(T va, T vb) const
-{
-  Context_list* hcl = NULL;
-  CGAL_triangulation_assertion_code( bool found = ) get_contexts(va,vb,hcl);
-  CGAL_triangulation_assertion(found);
-  return hcl->size();
-}
-
-template <class T, class Compare, class Data>
-typename Polyline_constraint_hierarchy_2<T,Compare,Data>::Context_iterator
-Polyline_constraint_hierarchy_2<T,Compare,Data>::
-contexts_begin(T va, T vb) const
-{
-   Context_iterator first, last;
-   if( !get_contexts(va,vb,first,last))  CGAL_triangulation_assertion(false);
-   return first;
-}
-
-template <class T, class Compare, class Data>
-typename Polyline_constraint_hierarchy_2<T,Compare,Data>::Context_iterator
-Polyline_constraint_hierarchy_2<T,Compare,Data>::
-contexts_end(T va, T vb) const
-{   
-   Context_iterator first, last;
-   if( !get_contexts(va,vb,first,last))  CGAL_triangulation_assertion(false);
-   return last;
-} 
-
-template <class T, class Compare, class Data>
-void
-Polyline_constraint_hierarchy_2<T,Compare,Data>::
-swap(Constraint_id first, Constraint_id second){
-    // We have to look at all subconstraints
-  for(Vertex_it it = first.vl_ptr()->skip_begin(), succ = it, end = first.vl_ptr()->skip_end(); 
-      ++succ != end; 
-      ++it){
-    typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ));
-    CGAL_triangulation_assertion(scit != sc_to_c_map.end());
-    Context_list* hcl = scit->second;
-
-    // and replace the context of the constraint
-    for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
-      if(ctit->enclosing == first.vl_ptr()){
-	ctit->enclosing = 0;
-	break;
-      }
-    }
-  }
-    // We have to look at all subconstraints
-  for(Vertex_it it = second.vl_ptr()->skip_begin(), succ = it, end = second.vl_ptr()->skip_end(); 
-      ++succ != end; 
-      ++it){
-    typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ));
-    CGAL_triangulation_assertion(scit != sc_to_c_map.end());
-    Context_list* hcl = scit->second;
-
-    // and replace the context of the constraint
-    for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
-      if(ctit->enclosing == second.vl_ptr()){
-	ctit->enclosing = first.vl_ptr();
-	break;
-      }
-    }
-  }   
-  // We have to look at all subconstraints
-  for(Vertex_it it = first.vl_ptr()->skip_begin(), succ = it, end = first.vl_ptr()->skip_end(); 
-      ++succ != end; 
-      ++it){
-    typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ));
-    CGAL_triangulation_assertion(scit != sc_to_c_map.end());
-    Context_list* hcl = scit->second;
-
-    // and replace the context of the constraint
-    for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
-      if(ctit->enclosing == 0){
-	ctit->enclosing = second.vl_ptr();
-	break;
-      }
-    }
-  }
-  first.vl_ptr()->swap(*second.vl_ptr());
-}
-
-
-template <class T, class Compare, class Data>
-void
-Polyline_constraint_hierarchy_2<T,Compare,Data>::
-remove_constraint(Constraint_id cid){
-  constraint_set.erase(cid);
-  
-  // We have to look at all subconstraints
-  for(Vertex_it it = cid.vl_ptr()->skip_begin(), succ = it, end = cid.vl_ptr()->skip_end(); 
-      ++succ != end; 
-      ++it){
-    typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ));
-    CGAL_triangulation_assertion(scit != sc_to_c_map.end());
-    Context_list* hcl = scit->second;
-
-    // and remove the context of the constraint
-    for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
-      if(ctit->enclosing == cid.vl_ptr()){
-	    hcl->erase(ctit);
-		break;
-      }
-    }
-    // If the constraint passes several times through the same subconstraint,
-    // the above loop maybe removes them in the wrong order
-
-    // If this was the only context in the list, delete the context list
-    if(hcl->empty()){
-      sc_to_c_map.erase(scit);
-      delete hcl;
-    }
-  }
-  delete cid.vl_ptr();
-}
-
-
-// This function removes vertex v from the polyline constraint
-// It only works for one polyline passing through v
-// and for the case that the constrained edge u,w has no intersections
-template <class T, class Compare, class Data>
-void Polyline_constraint_hierarchy_2<T,Compare,Data>::simplify(Vertex_it uc,
-                                                       Vertex_it vc,
-                                                       Vertex_it wc)
-
-{
-  Vertex_handle u = *uc, v = *vc, w = *wc;
-  typename Sc_to_c_map::iterator uv_sc_iter = sc_to_c_map.find(make_edge(u, v));
-  CGAL_assertion_msg( uv_sc_iter != sc_to_c_map.end(), "not a subconstraint" );
-  Context_list*  uv_hcl = uv_sc_iter->second;
-  CGAL_assertion_msg(uv_hcl->size() == 1, "more than one constraint passing through the subconstraint" );
-  if(*(uv_hcl->front().current()) != u) {
-    std::swap(u,w);
-    uv_sc_iter = sc_to_c_map.find(make_edge(u, v));
-    CGAL_assertion_msg( uv_sc_iter != sc_to_c_map.end(), "not a subconstraint" );
-    uv_hcl = (*uv_sc_iter).second;
-    CGAL_assertion_msg(uv_hcl->size() == 1, "more than one constraint passing through the subconstraint" );
-  }
-  // now u,v, and w are ordered along the polyline constraint
-  if(vc.input()){
-    uc.input() = true;
-    wc.input() = true;
-  }
-  typename Sc_to_c_map::iterator vw_sc_iter = sc_to_c_map.find(make_edge(v, w));
-  CGAL_assertion_msg( vw_sc_iter != sc_to_c_map.end(), "not a subconstraint" );
-  Context_list*  vw_hcl = vw_sc_iter->second;
-  CGAL_assertion_msg(vw_hcl->size() == 1, "more than one constraint passing through the subconstraint" );
-  Vertex_list* vertex_list = uv_hcl->front().id().vl_ptr();
-  CGAL_assertion_msg(vertex_list  == vw_hcl->front().id().vl_ptr(), "subconstraints from different polyline constraints" );
-  // Remove the list item which points to v
-  vertex_list->skip(vc.base());
-  
-  // Remove the entries for [u,v] and [v,w]
-  sc_to_c_map.erase(uv_sc_iter);
-  sc_to_c_map.erase(vw_sc_iter);
-  delete vw_hcl;
-  // reuse other context list
-  sc_to_c_map[make_edge(u,w)] = uv_hcl;
-}
-
-
-template <class T, class Compare, class Data>
-std::size_t
-Polyline_constraint_hierarchy_2<T,Compare,Data>::remove_points_without_corresponding_vertex(Constraint_id cid)
-{
-  std::size_t n = 0;
-  for(Point_it it = points_in_constraint_begin(cid); 
-      it != points_in_constraint_end(cid); ++it) { 
-    if(cid.vl_ptr()->is_skipped(it.base())) {
-      it = cid.vl_ptr()->erase(it.base());
-      ++n;
-    }
-  }
-  return n;
-}
-
-template <class T, class Compare, class Data>
-std::size_t
-Polyline_constraint_hierarchy_2<T,Compare,Data>::remove_points_without_corresponding_vertex()
-{
-  std::size_t n = 0;
-  for(C_iterator it = constraint_set.begin(); it!= constraint_set.end(); ++it){
-    n+= remove_points_without_corresponding_vertex(*it);
-  }
-  return n;
-}
-
-
-template <class T, class Compare, class Data>
-typename Polyline_constraint_hierarchy_2<T,Compare,Data>::Constraint_id
-Polyline_constraint_hierarchy_2<T,Compare,Data>::concatenate(Constraint_id first, Constraint_id second)
-{
-  constraint_set.erase(first);
-  constraint_set.erase(second);
-  // We have to look at all subconstraints
-  for(Vertex_it it = second.vl_ptr()->skip_begin(), succ = it, end = second.vl_ptr()->skip_end(); 
-      ++succ != end; 
-      ++it){
-    typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ));
-    CGAL_triangulation_assertion(scit != sc_to_c_map.end());
-    Context_list* hcl = scit->second;
-
-    // and replace the context of the constraint
-    for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
-      if(ctit->enclosing == second.vl_ptr()){
-	ctit->enclosing = first.vl_ptr();
-	break;
-      }
-    }
-  }
-  // now we really concatenate the vertex lists
-  // Note that all iterators pointing into second remain valid.
-  // This concerns user code, as well as  the data member "pos" of the Context class
-  first.vl_ptr()->pop_back(); // because it is the same as second.front()
-  Vertex_it back_it = first.vl_ptr()->skip_end();
-  --back_it;
-  first.vl_ptr()->splice(first.vl_ptr()->skip_end(), *(second.vl_ptr()), second.vl_ptr()->skip_begin(), second.vl_ptr()->skip_end());
-
-  // Note that for VC8 with iterator debugging the iterators pointing into second
-  // are NOT valid      So we have to update them
-  for(Vertex_it it = back_it, succ = it, end = first.vl_ptr()->skip_end(); 
-      ++succ != end; 
-      ++it){
-    typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ));
-    CGAL_triangulation_assertion(scit != sc_to_c_map.end());
-    Context_list* hcl = scit->second;
-
-    // and update pos in the context of the constraint
-    for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
-      if(ctit->enclosing == first.vl_ptr()){
-	ctit->pos = it;
-	break;
-      }
-    }
-    }
-  constraint_set.insert(first);
-
-  delete second.vl_ptr();
-  return first;
-}
-
-template <class T, class Compare, class Data>
-typename Polyline_constraint_hierarchy_2<T,Compare,Data>::Constraint_id
-Polyline_constraint_hierarchy_2<T,Compare,Data>::concatenate2(Constraint_id first, Constraint_id second)
-{  
-  constraint_set.erase(first);
-  constraint_set.erase(second);
-  // We have to look at all subconstraints
-  for(Vertex_it it = first.vl_ptr()->skip_begin(), succ = it, end = first.vl_ptr()->skip_end(); 
-      ++succ != end; 
-      ++it){
-    typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ));
-    CGAL_triangulation_assertion(scit != sc_to_c_map.end());
-    Context_list* hcl = scit->second;
-
-    // and replace the context of the constraint
-    for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
-      if(ctit->enclosing == first.vl_ptr()){
-	ctit->enclosing = second.vl_ptr();
-	break;
-      }
-    }
-  }
-  // now we really concatenate the vertex lists
-  // Note that all iterators pointing into second remain valid.
-  first.vl_ptr()->pop_back(); // because it is the same as second.front()
-  Vertex_it back_it = first.vl_ptr()->skip_end();
-  --back_it;
-  second.vl_ptr()->splice(second.vl_ptr()->skip_begin(), *(first.vl_ptr()), first.vl_ptr()->skip_begin(), first.vl_ptr()->skip_end());
-
-  // Note that for VC8 with iterator debugging the iterators pointing into second
-  // are NOT valid      So we have to update them
-  for(Vertex_it it = back_it, succ = it, end = first.vl_ptr()->skip_end(); 
-      ++succ != end; 
-      ++it){
-    typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ));
-    CGAL_triangulation_assertion(scit != sc_to_c_map.end());
-    Context_list* hcl = scit->second;
-
-    // and update pos in the context of the constraint
-    for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
-      if(ctit->enclosing == second.vl_ptr()){
-	ctit->pos = it;
-	break;
-      }
-    }
-  }
-  constraint_set.insert(second);
-
-  delete first.vl_ptr();
-  return second.vl_ptr();
-}
-
-
-  // split a constraint in two constraints, so that vcit becomes the first
-  // vertex of the new constraint
-  // returns the new constraint 
-template <class T, class Compare, class Data>
-typename Polyline_constraint_hierarchy_2<T,Compare,Data>::Constraint_id
-Polyline_constraint_hierarchy_2<T,Compare,Data>::split(Constraint_id first, Vertex_it vcit)
-{
-  constraint_set.erase(first);
-  Vertex_list* second = new Vertex_list;
-  second->splice(second->skip_end(), *(first.vl_ptr()), vcit.base(), first.vl_ptr()->skip_end());
-  first.vl_ptr()->push_back(second->front()); // Duplicate the common vertex
-  Vertex_it vit = second->skip_begin();
-  vit.input() = true;
-  vit = first.vl_ptr()->skip_end();
-  --vit;
-  vit.input() = true;
-  constraint_set.insert(first);
-  constraint_set.insert(second);
- // We have to look at all subconstraints
-  for(Vertex_it it = second->skip_begin(), succ = it, end = second->skip_end(); 
-      ++succ != end; 
-      ++it){
-    typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ));
-    CGAL_triangulation_assertion(scit != sc_to_c_map.end());
-    Context_list* hcl = scit->second;
-
-    // and replace the context of the constraint
-    for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
-      if(ctit->enclosing == first.vl_ptr()){
-	ctit->enclosing = second;
-	break;
-      }
-    }
-  }
-  return second;
-}
-
-template <class T, class Compare, class Data>
-typename Polyline_constraint_hierarchy_2<T,Compare,Data>::Constraint_id
-Polyline_constraint_hierarchy_2<T,Compare,Data>::split2(Constraint_id first, Vertex_it vcit)
-{
-  constraint_set.erase(first);
-  Vertex_list* second = new Vertex_list;
-  second->splice(second->skip_end(), *first.vl_ptr(), first.vl_ptr()->skip_begin(), vcit.base());
-  second->push_back(first.vl_ptr()->front()); // Duplicate the common vertex
-  Vertex_it vit = second->skip_end();
-  --vit;
-  vit.input() = true;
-  vit = first.vl_ptr()->skip_begin();
-  vit.input() = true;
-  constraint_set.insert(first);
-  constraint_set.insert(second);
- // We have to look at all subconstraints
-  for(Vertex_it it = second->skip_begin(), succ = it, end = second->skip_end(); 
-      ++succ != end; 
-      ++it){
-    typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ));
-    CGAL_triangulation_assertion(scit != sc_to_c_map.end());
-    Context_list* hcl = scit->second;
-
-    // and replace the context of the constraint
-    for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
-      if(ctit->enclosing == first.vl_ptr()){
-	ctit->enclosing = second;
-	break;
-      }
-    }
-  }
-  return second;
-}
-
-
-/*
-when a constraint is inserted,
-it is, at first, both  a constraint and a subconstraint
- */
-template <class T, class Compare, class Data>
-typename Polyline_constraint_hierarchy_2<T,Compare,Data>::Vertex_list*
-Polyline_constraint_hierarchy_2<T,Compare,Data>::
-insert_constraint(T va, T vb){
-  Edge        he = make_edge(va, vb);
-  Vertex_list*  children = new Vertex_list; 
-  Context_list* fathers;
-
-  typename Sc_to_c_map::iterator scit = sc_to_c_map.find(he);
-  if(scit == sc_to_c_map.end()){
-    fathers = new Context_list;
-    sc_to_c_map.insert(std::make_pair(he,fathers));
-  } else {
-    fathers = scit->second;
-  }
-
-  children->push_front(Node(va, true));  // was he.first
-  children->push_back(Node(vb, true));   // was he.second
-  constraint_set.insert(children);
-  Context ctxt;
-  ctxt.enclosing = children;
-  ctxt.pos     = children->skip_begin();
-  fathers->push_front(ctxt);
-
-  constraint_map[he] = children;
-  return children;
-}
-
-
-template <class T, class Compare, class Data>
-void
-Polyline_constraint_hierarchy_2<T,Compare,Data>::
-append_constraint(Constraint_id cid, T va, T vb){
-  Edge        he = make_edge(va, vb);
-  Context_list* fathers;
-
-  typename Sc_to_c_map::iterator scit = sc_to_c_map.find(he);
-  if(scit == sc_to_c_map.end()){
-    fathers = new Context_list;
-    sc_to_c_map.insert(std::make_pair(he,fathers));
-  } else {
-    fathers = scit->second;
-  }
-
-  typename Vertex_list::skip_iterator bit = cid.vl_ptr()->skip_end();
-  --bit;
-  cid.vl_ptr()->push_back(Node(vb, true));
-  Context ctxt;
-  ctxt.enclosing = cid.vl_ptr();
-  ctxt.pos     = bit;
-  fathers->push_front(ctxt);
-}
-
-
-template <class T, class Compare, class Data>
-void Polyline_constraint_hierarchy_2<T,Compare,Data>::
-clear()
-{
-  C_iterator cit;
-  Sc_iterator scit;
-  // clean and delete vertices lists
-  for(cit=constraint_set.begin(); cit != constraint_set.end();  cit++){
-    cit->vl_ptr()->clear();
-    delete cit->vl_ptr();
-  }
-  // clean and delete context lists
-  for(scit=sc_to_c_map.begin(); scit != sc_to_c_map.end(); scit++){
-    (*scit).second->clear();
-    delete (*scit).second;
-  }
-  sc_to_c_map.clear();
-  constraint_set.clear();
-  constraint_map.clear();
-}
-
-
-template <class T, class Compare, class Data>
-bool Polyline_constraint_hierarchy_2<T,Compare,Data>::
-next_along_sc(T va, T vb, T& w) const
-{
-  // find the next vertex after vb along any enclosing constrained
-  // return false if there is no ....
-  Context_iterator  ctxtit, past;
-  if(!get_contexts(va, vb, ctxtit, past)) CGAL_triangulation_assertion(false);
-
-  Vertex_it pos;
-  for( ; ctxtit != past; ctxtit++){
-    pos = ctxtit->pos;
-    if((*pos)==va) {
-      ++pos; ++pos;
-      if (pos != ctxtit->enclosing->end()) {  w=(*pos); return true;}
-    }
-    else {
-      if (pos != ctxtit->enclosing->begin()) {--pos; w=(*pos); return true;}
-    }
-  }
-  return false;
-}
-
-
-
-/*
-  Attention, le point v DOIT etre un point de Steiner,
-  et les segments va,v et v,vb sont des sous contraintes.
-*/
-template <class T, class Compare, class Data>
-void Polyline_constraint_hierarchy_2<T,Compare,Data>::
-remove_Steiner(T v, T va, T vb)
-{
-  // remove a Steiner point
-  CGAL_precondition(!is_constrained_vertex(v));
- 
-  Context_list*  hcl1;
-  Context_list*  hcl2;
-  if(!get_contexts(va,v,hcl1)) CGAL_triangulation_assertion(false);
-  if(!get_contexts(v,vb,hcl2)) CGAL_triangulation_assertion(false);
-
-  Vertex_it      pos;
-  for(Context_iterator ctit=hcl1->begin(); ctit != hcl1->end(); ctit++){
-    pos = ctit->pos;
-    if((*pos)==va) pos++;
-    pos = ctit->enclosing->erase(pos);
-    ctit->pos = --pos;
-  }
-
-  sc_to_c_map.erase(make_edge(va,v));
-  sc_to_c_map.erase(make_edge(v,vb));
-  delete hcl2;
-  sc_to_c_map.insert(std::make_pair(make_edge(va,vb),hcl1));
-}
-
-
-
-/*
-  same as add_Steiner
-  precondition : va,vb est une souscontrainte. 
-*/
-template <class T, class Compare, class Data>
-void Polyline_constraint_hierarchy_2<T,Compare,Data>::
-split_constraint(T va, T vb, T vc){
-  add_Steiner(va, vb, vc);
-}
-
-
-template <class T, class Compare, class Data>
-void 
-Polyline_constraint_hierarchy_2<T,Compare,Data>::
-add_Steiner(T va, T vb, T vc){
-  Context_list* hcl=NULL;
-  if(!get_contexts(va,vb,hcl)) CGAL_triangulation_assertion(false);
-
-  Context_list* hcl2 = new  Context_list;
-
-  Vertex_it      pos;
-  Context  ctxt;
-  for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
-    // insert vc in enclosing constraint
-    pos = ctit->current();
-    ++pos;
-    pos = ctit->enclosing->insert(pos.base(), Node(vc));
-    --pos;
-    
-    // set ctxt to the context of (vc,vb)
-    // change *ctit in hcl to the context of (va,vc)
-    // add ctxt to hcl2 list
-    ctxt.enclosing = ctit->enclosing;  
-    if(*pos == va) {
-      ctit->pos = pos;
-      ctxt.pos = ++pos;
-    }
-    else { //(*pos)==vb
-      ctxt.pos = pos;
-      ctit->pos = ++pos;
-    }
-    hcl2->push_back(ctxt);
-  }
-
-  Context_list* hcl3;
-  if (get_contexts(va,vc,hcl3)) { // (va,vc) is already a subconstraint
-    hcl3->splice(hcl3->end(), *hcl);
-    delete hcl;
-  }
-  else   sc_to_c_map.insert(std::make_pair(make_edge(va,vc), hcl));
-
-  if (get_contexts(vc,vb,hcl3)) {// (vc,vb) is already a subconstraint
-    hcl3->splice(hcl3->end(),*hcl2);
-
-    delete hcl2;
-  }
-  else  sc_to_c_map.insert(std::make_pair(make_edge(vc,vb), hcl2));
-    
-  
-  sc_to_c_map.erase(make_edge(va,vb));
-  return;
-}
-
-
-template <class T, class Compare, class Data>
-inline
-typename Polyline_constraint_hierarchy_2<T,Compare,Data>::Edge
-Polyline_constraint_hierarchy_2<T,Compare,Data>::
-make_edge(T va, T vb) const
-{
-  return comp(va, vb) ? Edge(va,vb) : Edge(vb,va);
-}
-
-template <class T, class Compare, class Data>
-inline
-bool
-Polyline_constraint_hierarchy_2<T,Compare,Data>::
-get_contexts(T va, T vb, Context_list* & hcl) const
-{
-  Sc_iterator sc_iter = sc_to_c_map.find(make_edge(va,vb));
-  if( sc_iter == sc_to_c_map.end() )    return(false);
-  hcl = (*sc_iter).second;
-  return true;
-}
-
-template <class T, class Compare, class Data>
-inline
-bool
-Polyline_constraint_hierarchy_2<T,Compare,Data>::
-get_contexts(T va, T vb, 
-	     Context_iterator& ctxt, 
-	     Context_iterator& past) const
-{
-  Context_list* hcl;
-  if (!get_contexts(va,vb,hcl)) return false;
-  ctxt = hcl->begin();
-  past = hcl->end();
-  return true;    
-}
-
-
-
-template <class T, class Compare, class Data>
-inline
-typename Polyline_constraint_hierarchy_2<T,Compare,Data>::Vertex_it
-Polyline_constraint_hierarchy_2<T,Compare,Data>::
-get_pos(T va, T vb) const
-  //return pos in the first context
-{
-    return (*sc_to_c_map.find(make_edge(va,vb))).second->begin().pos;
-}
-
-template <class T, class Compare, class Data>
-void
-Polyline_constraint_hierarchy_2<T,Compare,Data>::
-oriented_end(T va, T vb, T& vc) const
-{
-  Context_iterator ctxt, past;
-  if(!get_contexts(va,vb, ctxt, past) ) CGAL_triangulation_assertion(false);
-  if(*(ctxt->pos) == va)
-    vc = ctxt->enclosing->back();
-  else
-    vc = ctxt->enclosing->front();
-}
-
-
-template <class T, class Compare, class Data>
-void
-Polyline_constraint_hierarchy_2<T,Compare,Data>::
-print() const
-{ 
-  C_iterator hcit;
-  std::map<T,int>  vertex_num;
-  int num = 0;
-  for(hcit = c_begin(); hcit != c_end();  hcit++) {
-    Constraint_id cid = (*hcit);
-    Vertex_it vit =cid.vl_ptr()->skip_begin(), end = cid.vl_ptr()->skip_end();
-    for (;vit != end; vit++){
-      num ++;
-      vertex_num.insert(std::make_pair((*vit), num));
-    }
-  }
-//  typename std::map<T,int>::iterator vnit = vertex_num.begin();
-//  for(; vnit != vertex_num.end(); vnit++) {
-//    vnit->second = ++num;
-//    std::cerr << "vertex num " << num  << " " << vnit->first->point()
-//	      << std::endl;
-//  }
-
-  C_iterator cit=c_begin();
-  Sc_iterator scit=sc_begin();
-
-  for(; cit != c_end();  cit++){
-    std::cout << std::endl ;
-    std::cout << "constraint " ;
-    std::cout << cit->vl_ptr();
-    std::cout << "  subconstraints " ;
-    Vertex_it vit = (*cit).vl_ptr()->skip_begin(), end = (*cit).vl_ptr()->skip_end();
-    for(; vit != end; vit++){
-      std::cout << vertex_num[*vit]  <<" ";
-    }
-    vit = (*cit).vl_ptr()->skip_begin(), end = (*cit).vl_ptr()->skip_end();
-    for(; vit != end; vit++){
-      std::cout << (*vit)->point()  <<" ";
-    }
-  }
-  std::cout << std::endl ;
-  for(;scit != sc_end(); scit++){
-    std::cout << "subconstraint " ;
-    std::cout << vertex_num[scit->first.first] << " " 
-	      << vertex_num[scit->first.second];
-    Context_iterator cb, ce;
-    get_contexts(scit->first.first, scit->first.second, cb, ce);
-    
-    std::cout << "  enclosing " ;
-    for(; cb != ce; cb++) { 
-      std::cout << cb->id().vl_ptr();
-      std::cout <<  "   " ;
-    }
-    std::cout << std::endl ;
-  }
-  return; 
-}
-
-
-} //namespace CGAL
-#endif // CGAL_POLYLINE_CONSTRAINT_HIERARCHY_2_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polyline_simplification_2/simplify.h b/3rdparty/CGAL-4.8/include/CGAL/Polyline_simplification_2/simplify.h
deleted file mode 100644
index f2bb6e6..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polyline_simplification_2/simplify.h
+++ /dev/null
@@ -1,472 +0,0 @@
-// Copyright (c) 2012 Geometry Factory. All rights reserved.
-// 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
-// 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(s)     : Andreas Fabri
-//
-#ifndef CGAL_POLYLINE_SIMPLIFICATION_2_SIMPLIFY_H
-#define CGAL_POLYLINE_SIMPLIFICATION_2_SIMPLIFY_H
-
-#include <list>
-
-#include <CGAL/Polyline_simplification_2/Vertex_base_2.h>
-#include <CGAL/Polyline_simplification_2/Squared_distance_cost.h>
-#include <CGAL/Polyline_simplification_2/Scaled_squared_distance_cost.h>
-#include <CGAL/Polyline_simplification_2/Hybrid_squared_distance_cost.h>
-#include <CGAL/Polyline_simplification_2/Stop_below_count_ratio_threshold.h>
-#include <CGAL/Polyline_simplification_2/Stop_below_count_threshold.h>
-#include <CGAL/Polyline_simplification_2/Stop_above_cost_threshold.h>
-#include <CGAL/Modifiable_priority_queue.h>
-#include <CGAL/algorithm.h>
-
-// Needed for Polygon_2
-
-#include <CGAL/Constrained_Delaunay_triangulation_2.h>
-#include <CGAL/Constrained_triangulation_plus_2.h>
-#include <list>
-
-
-namespace CGAL {
-
-#ifndef DOXYGEN_RUNNING
-
-template < class CDT >
-class Constrained_triangulation_plus_2;
-
-
-template <class PolygonTraits_2, class Container>
-class Polygon_2;
-
-#endif
-
-namespace Polyline_simplification_2 {
-
-template <typename PCT, typename CostFunction, typename StopFunction>
-class Polyline_simplification_2
-{
-public:
-
-  typedef typename PCT::Point Point;
-  typedef typename PCT::Constraint_id Constraint_id;
-  typedef typename PCT::Constraint_iterator Constraint_iterator;
-  typedef typename PCT::Vertices_in_constraint_iterator Vertices_in_constraint_iterator;
-  //typedef typename PCT::Points_in_constraint_iterator Points_in_constraint_iterator;
-  typedef typename PCT::Vertex_handle Vertex_handle;
-  typedef typename PCT::Vertex_circulator Vertex_circulator;
-
-  typedef typename PCT::Geom_traits::FT FT;
-  
-  PCT& pct;
-  CostFunction cost;
-  StopFunction stop;
-  std::size_t pct_initial_number_of_vertices, number_of_unremovable_vertices;
-
-  
-  struct Compare_cost 
-  { 
-    bool operator() ( Vertices_in_constraint_iterator const& x, 
-                      Vertices_in_constraint_iterator const& y ) const 
-    { 
-      return (*x)->cost() < (*y)->cost(); 
-    }
-  } ;
-  
-  struct Id_map : public boost::put_get_helper<std::size_t, Id_map>
-  { 
-    typedef boost::readable_property_map_tag category;
-    typedef std::size_t                      value_type;
-    typedef value_type                       reference;
-    typedef Vertices_in_constraint_iterator  key_type;
-    
-    reference operator[] ( key_type const& x ) const { return x.base()->id ; }
-  } ;
-  
-  typedef CGAL::Modifiable_priority_queue<Vertices_in_constraint_iterator,Compare_cost,Id_map> MPQ ;
-  
-  MPQ* mpq;
-
-  Polyline_simplification_2(PCT& pct, CostFunction cost, StopFunction stop)
-    : pct(pct), cost(cost), stop(stop), pct_initial_number_of_vertices(pct.number_of_vertices()), number_of_unremovable_vertices(0)
-  {
-    int m = initialize_indices();
-    initialize_unremovable();
-    Compare_cost cc;
-    Id_map idm;
-    mpq =  new MPQ(m, cc, idm);
-    initialize_costs();
-  }
-
-  Polyline_simplification_2(PCT& pct, Constraint_id cid, CostFunction cost, StopFunction stop)
-    : pct(pct), cost(cost), stop(stop), pct_initial_number_of_vertices(pct.number_of_vertices()), number_of_unremovable_vertices(0)
-  {
-    int m = initialize_indices(cid);
-    initialize_unremovable();
-    Compare_cost cc;
-    Id_map idm;
-    mpq =  new MPQ(m, cc, idm);
-    initialize_costs(cid);
-  }
-
-
-
-  ~Polyline_simplification_2()
-  {
-    delete mpq;
-  }
-
-  void initialize_unremovable()
-  {
-    std::set<Vertex_handle> vertices;
-    Constraint_iterator cit = pct.constraints_begin(), e = pct.constraints_end();
-    for(; cit!=e; ++cit){
-      Constraint_id cid = *cit;
-      Vertices_in_constraint_iterator it = pct.vertices_in_constraint_begin(cid);
-      (*it)->set_removable(false);
-      for(; it != pct.vertices_in_constraint_end(cid); ++it){
-        if(vertices.find(*it) != vertices.end()){
-          (*it)->set_removable(false);
-        } else {
-          vertices.insert(*it);
-        }
-      }
-      it = boost::prior(it);
-      (*it)->set_removable(false);
-    }
-  }
-
-  // For all polyline constraints we compute the cost of all unremovable and not removed vertices
-  int
-  initialize_costs(Constraint_id cid)
-  {
-    int n=0;
-    for(Vertices_in_constraint_iterator it = pct.vertices_in_constraint_begin(cid);
-        it != pct.vertices_in_constraint_end(cid);
-        ++it){
-      if((*it)->is_removable()){
-        boost::optional<FT> dist = cost(pct, it);
-        if(dist){
-          (*it)->set_cost(*dist);
-          (*mpq).push(it);
-          ++n;
-        } else {
-          // no need to set the costs as this vertex is not in the priority queue
-        } 
-      }
-    }
-    return n;
-  }  
-  
-  void
-  initialize_costs()
-  {
-    int n=0;
-    Constraint_iterator cit = pct.constraints_begin(), e = pct.constraints_end();
-    for(; cit!=e; ++cit){
-      n+= initialize_costs(*cit);
-    }
-  }
-
-  bool
-  is_removable(Vertices_in_constraint_iterator it)
-  {
-    typedef typename PCT::Geom_traits Geom_traits;
-    if(! (*it)->is_removable()) {
-      return false;
-    }
-    
-    Vertex_handle vh = *it;
-    Vertices_in_constraint_iterator u = boost::prior(it);
-    Vertex_handle uh = *u;
-    Vertices_in_constraint_iterator w = boost::next(it);
-    Vertex_handle wh = *w;
-    
-    typename Geom_traits::Orientation_2 orientation_2 = pct.geom_traits().orientation_2_object();
-    CGAL::Orientation o = orientation_2(uh->point(), vh->point(), wh->point());
-    if(o == CGAL::COLLINEAR){
-      return true;
-    }
-    if(o == CGAL::LEFT_TURN){
-      std::swap(uh,wh);
-    }
-    
-    // uh, vh, wh perform a right turn 
-    const Point& up = uh->point();
-    const Point& wp = wh->point();
-    Vertex_circulator circ = pct.incident_vertices(vh);
-    while(circ != uh){
-      ++circ;
-    }
-    ++circ;
-    if(circ == wh){
-      typename PCT::Edge e;
-      CGAL_assertion_code( bool b = ) pct.is_edge(uh,wh,e.first,e.second);
-      CGAL_assertion(b);
-      return ! pct.is_constrained(e);
-    }
-    while(circ != wh){
-      o = orientation_2(up, circ->point(), wp);
-      if(orientation_2(up, wp, circ->point()) != CGAL::RIGHT_TURN){
-        return false;
-      }
-      ++circ;
-    }
-    return true;
-  }
-
-
-  int
-  initialize_indices(Constraint_id cid, int id = 0)
-  {
-    for(Vertices_in_constraint_iterator it = pct.vertices_in_constraint_begin(cid);
-        it != pct.vertices_in_constraint_end(cid);
-        ++it){
-      it.base()->id = id++;
-    }
-    return id;
-  }
-  
-  int
-  initialize_indices()
-  {
-    int id = 0;
-    Constraint_iterator b = pct.constraints_begin(), e = pct.constraints_end();
-    for(; b!=e; ++b){
-      id = initialize_indices(*b, id);
-    }
-    return id;
-  }
-  
-bool
-operator()()
-{
-  if((*mpq).empty()){
-      return false;
-    }
-  Vertices_in_constraint_iterator v = (*mpq).top();
-  (*mpq).pop();
-  if(stop(pct, *v, (*v)->cost(), pct_initial_number_of_vertices, pct.number_of_vertices())){
-    return false;
-  }
-  if(is_removable(v)){
-    Vertices_in_constraint_iterator u = boost::prior(v), w = boost::next(v);
-    pct.simplify(v);
-    
-    if((*u)->is_removable()){
-      boost::optional<FT> dist = cost(pct, u);
-      if(! dist){
-        std::cerr << "undefined cost not handled yet" << std::endl;
-      } else {
-        (*u)->set_cost(*dist);
-        if((*mpq).contains(u)){
-        (*mpq).update(u, true);
-        }
-      }
-    }
-    
-    if((*w)->is_removable()){
-      boost::optional<FT> dist = cost(pct, w);
-      if(! dist){
-        std::cerr << "undefined cost not handled yet" << std::endl;
-      } else {
-        (*w)->set_cost(*dist);
-        if((*mpq).contains(w)){
-        (*mpq).update(w, true);
-        }
-
-      }
-    }
-  } else {
-    ++number_of_unremovable_vertices;
-  }
-  return true;
-}
-
-  std::size_t
-  number_of_removed_vertices() const
-  {
-    return pct_initial_number_of_vertices - pct.number_of_vertices();
-  }
-
-  };
-
-/*!
-\ingroup  PkgPolylineSimplification2Functions
-
-Simplifies a single polygon.
-
-\tparam Traits must be a model of `ConstrainedDelaunayTriangulationTraits_2`
-\tparam CostFunction must be a model of `PolylineSimplificationCostFunction`.
-\tparam StopFunction must be a model of `PolylineSimplificationStopPredicate`
-
-\attention Any \cgal kernel can be used for `Traits`, but as the traits
-class is used for internally using a constrained Delaunay triangulation,
-it should be a kernel with at least exact predicates.
-*/
-template <class Traits, class Container, class CostFunction, class StopFunction>
-                  CGAL::Polygon_2<Traits,Container>
-                  simplify(const CGAL::Polygon_2<Traits,Container>& polygon,
-                           CostFunction cost,
-                           StopFunction stop)
-{
-  typedef Traits K;
-  typedef typename K::Point_2 Point_2;
-
-  typedef Vertex_base_2< K > Vb;
-  typedef CGAL::Constrained_triangulation_face_base_2<K> Fb;
-  typedef CGAL::Triangulation_data_structure_2<Vb,Fb> TDS;
-  typedef CGAL::Constrained_Delaunay_triangulation_2<K, TDS, CGAL::Exact_predicates_tag> CDT;
-  typedef CGAL::Constrained_triangulation_plus_2<CDT>       PCT;
-  typedef typename PCT::Constraint_id Constraint_id;
-  typedef typename PCT::Vertices_in_constraint_iterator Vertices_in_constraint_iterator;
-
-  PCT pct;
-
-  Constraint_id cid = pct.insert_constraint(polygon);
-
-  Polyline_simplification_2<PCT, CostFunction, StopFunction> simplifier(pct, cost, stop);
-  while(simplifier()){}
-
-  CGAL::Polygon_2<Traits,Container> result;
-  Vertices_in_constraint_iterator beg = pct.vertices_in_constraint_begin(cid);
-  Vertices_in_constraint_iterator end = pct.vertices_in_constraint_end(cid);
-  for(; beg!=end;){
-    Point_2 p = (*beg)->point();
-    ++beg;
-    if(beg!=end){
-      result.push_back(p);
-    }
-  }
-  return result;
-}
-
-/*!
-\ingroup  PkgPolylineSimplification2Functions
-
-Simplifies an open or closed polyline given as an iterator range of 2D \cgal points.
-
-\tparam PointIterator must be an iterator with value type `CGAL::Kernel::Point_2`.
-\tparam CostFunction must be a model of `PolylineSimplificationCostFunction`
-\tparam StopFunction must be a model of `PolylineSimplificationStopPredicate`
-\tparam PointOutputIterator must be an output iterator to which `CGAL::Kernel::Point_2` can be assigned.
-*/
-  template <class PointIterator, class CostFunction, class StopFunction, class PointOutputIterator>
-  PointOutputIterator
-  simplify(PointIterator b, PointIterator e,
-           CostFunction cost,
-           StopFunction stop,
-           PointOutputIterator out,
-           bool close = false)
-{
-  typedef typename std::iterator_traits<PointIterator>::value_type Point_2;
-  typedef typename CGAL::Kernel_traits<Point_2>::type K;
-  typedef Vertex_base_2< K > Vb;
-  typedef CGAL::Constrained_triangulation_face_base_2<K> Fb;
-  typedef CGAL::Triangulation_data_structure_2<Vb,Fb> TDS;
-  typedef CGAL::Constrained_Delaunay_triangulation_2<K, TDS, CGAL::Exact_predicates_tag> CDT;
-  typedef CGAL::Constrained_triangulation_plus_2<CDT>       PCT;
-  typedef typename PCT::Constraint_id Constraint_id;
-  typedef typename PCT::Vertices_in_constraint_iterator Vertices_in_constraint_iterator;
-
-  PCT pct;
-
-  Constraint_id cid = pct.insert_constraint(b,e, close);
-
-  Polyline_simplification_2<PCT, CostFunction, StopFunction> simplifier(pct, cost, stop);
-  while(simplifier()){}
-
-  Vertices_in_constraint_iterator beg = pct.vertices_in_constraint_begin(cid);
-  Vertices_in_constraint_iterator end = pct.vertices_in_constraint_end(cid);
-  for(; beg!=end;){
-    Point_2 p = (*beg)->point();
-    ++beg;
-    if((!close) || (beg!=end)){
-      *out++ = p;
-    }
-  }
-  return out;
-}
-
-
-/*!
-\ingroup  PkgPolylineSimplification2Functions
-
-Simplifies a single polyline in a triangulation with polylines as constraints. 
-
-\param ct The underlying constrained Delaunay triangulation which embeds the polyline constraints
-\param cid The constraint identifier of the polyline constraint to simplify
-\param cost The cost function
-\param stop The stop function
-\param remove_points  If `true` the function \link CGAL::Constrained_triangulation_plus_2::remove_points_without_corresponding_vertex() `ct.remove_points_without_corresponding_vertex()` \endlink is called.
-\returns the number of removed vertices
-\tparam CDT  must be `CGAL::Constrained_triangulation_plus_2` with a vertex type that
-is model of  `PolylineSimplificationVertexBase_2`.
-\tparam CostFunction must be a model of `PolylineSimplificationCostFunction`
-\tparam StopFunction must be a model of `PolylineSimplificationStopPredicate`
-*/
-template <class CDT, class CostFunction, class StopFunction>
-std::size_t
-simplify(CGAL::Constrained_triangulation_plus_2<CDT>& ct,
-         typename CGAL::Constrained_triangulation_plus_2<CDT>::Constraint_id cid,
-         CostFunction cost,
-         StopFunction stop,
-         bool remove_points = true)
-{
-  typedef CGAL::Constrained_triangulation_plus_2<CDT> PCT;
-  Polyline_simplification_2<PCT, CostFunction, StopFunction> simplifier(ct, cid, cost, stop);
-
-  while(simplifier()){}
-  if(remove_points){
-    ct.remove_points_without_corresponding_vertex(cid);
-  }
-  return simplifier.number_of_removed_vertices();
-}
-
-/*!
-\ingroup  PkgPolylineSimplification2Functions
-Simplifies all polylines in a triangulation with polylines as constraints.
-\param ct The underlying constrained Delaunay triangulation which embeds the polyline constraints
-\param cost The cost function
-\param stop The stop function
-\param remove_points If `true` the function \link CGAL::Constrained_triangulation_plus_2::remove_points_without_corresponding_vertex() `ct.remove_points_without_corresponding_vertex()`\endlink is called.
-\returns the number of removed vertices
-\tparam CDT  must be `CGAL::Constrained_triangulation_plus_2` with a vertex type that
-is model of  `PolylineSimplificationVertexBase_2`.
-\tparam CostFunction must be a model of `PolylineSimplificationCostFunction`
-\tparam StopFunction must be a model of `PolylineSimplificationStopPredicate`
-*/
-
-template <class CDT, class CostFunction, class StopFunction>
-std::size_t
-simplify(CGAL::Constrained_triangulation_plus_2<CDT>& ct,
-         CostFunction cost,
-         StopFunction stop,
-         bool remove_points = true)
-{
-  typedef CGAL::Constrained_triangulation_plus_2<CDT> PCT;
-  Polyline_simplification_2<PCT, CostFunction, StopFunction> simplifier(ct, cost, stop);
-
-  while(simplifier()){}
-  if(remove_points){
-    ct.remove_points_without_corresponding_vertex();
-  }
-  return simplifier.number_of_removed_vertices();
-}
-
-
-
-} // namespace polyline_simplification_2
-} // namespace CGAL 
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial.h b/3rdparty/CGAL-4.8/include/CGAL/Polynomial.h
deleted file mode 100644
index 76ce642..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polynomial.h
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright (c) 2008 Max-Planck-Institute Saarbruecken (Germany).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Arno Eigenwillig <arno at mpi-inf.mpg.de>
-//                 Michael Seel <seel at mpi-inf.mpg.de>
-//                 Michael Hemmer <hemmer at informatik.uni-mainz.de> 
-// ============================================================================
-
-// TODO: The comments are all original EXACUS comments and aren't adapted. So
-//         they may be wrong now.
-
-/*! \file CGAL/Polynomial.h
- *  \brief Defines class CGAL::Polynomial.
- *  
- *  Polynomials in one variable (or more, by recursion)
- */
-
-#ifndef CGAL_POLYNOMIAL_H
-#define CGAL_POLYNOMIAL_H
-
-#include <cstdarg>
-#include <cctype>
-#include <vector>
-#include <iostream>
-#include <CGAL/basic.h>
-#include <CGAL/Handle_with_policy.h>
-#include <boost/iterator/transform_iterator.hpp>
-#include <boost/mpl/if.hpp>
-#include <CGAL/Flattening_iterator.h>
-
-#include <CGAL/Exponent_vector.h>
-
-#include <CGAL/assertions.h>
-
-#ifdef CGAL_USE_LEDA
-#if CGAL_LEDA_VERSION >= 500
-#include <LEDA/core/array.h>
-#else
-#include <LEDA/array.h>
-#endif
-#endif // CGAL_USE_LEDA
-
-#include <CGAL/Polynomial/fwd.h>
-#include <CGAL/Polynomial/Polynomial_type.h>
-#include <CGAL/Polynomial_traits_d.h>
-#include <CGAL/Polynomial/Algebraic_structure_traits.h>
-#include <CGAL/Polynomial/Real_embeddable_traits.h>
-#include <CGAL/Polynomial/Fraction_traits.h>
-#include <CGAL/Polynomial/Scalar_factor_traits.h>
-#include <CGAL/Polynomial/Modular_traits.h>
-#include <CGAL/Polynomial/Coercion_traits.h>
-#include <CGAL/Polynomial/Chinese_remainder_traits.h>
-#include <CGAL/Polynomial/Get_arithmetic_kernel.h>
-
-// TODO: Are these still includes necessary?
-#include <CGAL/Polynomial/polynomial_gcd.h> // used above for Algebraic_structure_traits<Poly...>::Gcd
-#include <CGAL/Polynomial/prs_resultant.h>  // for compatibility
-
-#include <CGAL/Polynomial_traits_d.h>
-#include <CGAL/polynomial_utils.h>
-
-#endif  // CGAL_POLYNOMIAL_H
-
-// EOF
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/basic.h b/3rdparty/CGAL-4.8/include/CGAL/Polynomial/basic.h
deleted file mode 100644
index 5a78b09..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/basic.h
+++ /dev/null
@@ -1,211 +0,0 @@
-// Copyright (c) 2005  Stanford University (USA).
-// 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(s)     : Daniel Russel <drussel at alumni.princeton.edu>
-
-#ifndef CGAL_POLYNOMIAL_BASIC_H
-#define CGAL_POLYNOMIAL_BASIC_H
-
-#include <CGAL/Polynomial/internal/config.h>
-#include <CGAL/Polynomial/internal/Statistics.h>
-#include <CGAL/assertions.h>
-/*!
-
-  \file CGAL/Polynomial/basic.h The file which defines the basic
-  things needed throught the module.  All other headers should include
-  this first.
-
-*/
-
-#ifdef CGAL_USE_GMP
-#ifndef CGAL_POLYNOMIAL_USE_CGAL
-#define CGAL_POLYNOMIAL_USE_CGAL
-#endif
-#endif
-
-#include <CGAL/Polynomial/internal/macros.h>
-
-#ifdef CGAL_POLYNOMIAL_USE_CGAL
-/*
-  When CGAL is present
-*/
-#include <CGAL/basic.h>
-
-#ifdef CGAL_USE_GMP
-#include <CGAL/Gmpq.h>
-namespace CGAL { namespace POLYNOMIAL {
-typedef CGAL::Gmpq Default_field_nt;
-} } //namespace CGAL::POLYNOMIAL
-#else
-#include <CGAL/MP_Float.h>
-#include <CGAL/Quotient.h>
-namespace CGAL { namespace POLYNOMIAL {
-typedef CGAL::Quotient<CGAL::MP_Float> Default_field_nt;
-} } //namespace CGAL::POLYNOMIAL
-#endif
-
-namespace CGAL { namespace POLYNOMIAL {
-
-/*typedef CGAL::Sign Sign;
-static const Sign ZERO= CGAL::ZERO;
-static const Sign POSITIVE= CGAL::POSITIVE;
-static const Sign NEGATIVE= CGAL::NEGATIVE;*/
-/*typedef int Comparison_result;
-static const int EQUAL= CGAL::EQUAL;
-static const int SMALLER= CGAL::SMALLER;
-static const int LARGER = CGAL::LARGER;*/
-static const int UNKNOWN = -3;
-typedef int Order;
-static const int STRICTLY_BELOW = -3;
-static const int BELOW=-2;
-static const int CONTAINED=-1;
-static const int CONTAINS=1;
-static const int ABOVE=2;
-static const int STRICTLY_ABOVE=3;
-//typedef enum Sign {ZERO=CGAL::ZERO, POSITIVE=CGAL::POSITIVE, NEGATIVE=CGAL::NEGATIVE} Sign;
-
-//typedef CGAL::Comparison_result Comparison_result;
-
-/*template <class NT>
-Sign sign(const NT &nt)
-{
-    return CGAL::sign(nt);
-    }*/
-
-
-/*typedef ::CGAL::Integral_domain_without_division_tag             Integral_domain_without_division_tag;
-typedef ::CGAL::Euclidean_ring_tag   Euclidean_ring_tag;
-typedef ::CGAL::Field_tag            Field_tag;
-typedef ::CGAL::Field_with_sqrt_tag       Field_with_sqrt_tag;*/
-
-} } //namespace CGAL::POLYNOMIAL
-
-#define CGAL_POLYNOMIAL_TO_DOUBLE(d) CGAL::to_double(d)
-
-#define CGAL_POLYNOMIAL_TO_INTERVAL(d) CGAL::to_interval(d)
-
-#else
-/*
-  When no CGAL is present
-*/
-
-namespace CGAL { namespace POLYNOMIAL {
-
-typedef int Sign;
-static const int ZERO =0;
-static const int POSITIVE=1;
-static const int NEGATIVE=-1;
-typedef int Comparison_result;
-static const int EQUAL= 0;
-static const int SMALLER= -1;
-static const int LARGER = 1;
-
-template <class NT>
-Sign sign(const NT &nt)
-{
-    if (nt >0) return POSITIVE;
-    else if (nt <0) return NEGATIVE;
-    else return ZERO;
-}
-
-
-struct Integral_domain_without_division_tag {};
-struct Euclidean_ring_tag {};
-struct Field_tag {};
-struct Field_with_sqrt_tag {};
-
-} } //namespace CGAL::POLYNOMIAL
-#endif
-
-#include <limits>
-
-/*
-  Shared
-*/
-
-namespace CGAL { namespace POLYNOMIAL {
-
-//! Used for signs when filtering is involved
-typedef enum Extended_sign
-{
-    EXTENDED_NEGATIVE=NEGATIVE, EXTENDED_ZERO=ZERO,
-    EXTENDED_POSITIVE=POSITIVE, EXTENDED_UNKNOWN=2
-} Extended_sign;
-
-//! Calculate the extened sign of a number.
-/*!  For a regular number, the extened sign is teh same as the sign.
-
-There is a specializated version for filtering included in
-  CGAL/Polynomial/Tools/interval_arithmetic.h
-*/
-template <class NT>
-inline Extended_sign extended_sign(const NT &nt)
-{
-  // for VC
-  switch(CGAL::sign(nt)) {
-        case ZERO: return EXTENDED_ZERO;
-        case POSITIVE: return EXTENDED_POSITIVE;
-        default: return EXTENDED_NEGATIVE;
-    };
-}
-
-
-template <class Rt>
-inline Rt infinity()
-{
-  //CGAL_static_assertion(std::numeric_limits<Rt>::is_specialized);
-    if (std::numeric_limits<Rt>::has_infinity) return std::numeric_limits<Rt>::infinity();
-    else return (std::numeric_limits<Rt>::max)();
-}
-
-
-} } //namespace CGAL::POLYNOMIAL
-
-/*!  \namespace CGAL::POLYNOMIAL This is the namespace where all the
-  directly exposed members of the framework are defined.
-
-  \todo put specialized templates first in header
-
-  \todo wrapper support for boost::interval
-
-  \namespace CGAL::POLYNOMIAL::internal The classes in this namespace
-  should not be accessed directly by the users of the
-  library. However, many of them are exposed in other ways (for
-example as members of a kernel), so things need to be documented.
-
-\namespace CGAL We don't put much in CGAL. Just to_double,
-to_interval, sign and a couple of other methods.
-*/
-
-/*
-namespace CGAL { namespace POLYNOMIAL {
-
-//!\todo are these needed? The tags in the polynomial NS?
-struct Descartes_tag {};
-struct Sturm_tag {};
-struct Bezier_tag {};
-
-} } //namespace CGAL::POLYNOMIAL
-*/
-
-#ifdef CGAL_POLYNOMIAL_NO_LIMITS
-#include <CGAL/Polynomial/internal/limits.h>
-#else
-#include <limits>
-#endif
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/bezout_matrix.h b/3rdparty/CGAL-4.8/include/CGAL/Polynomial/bezout_matrix.h
deleted file mode 100644
index 24c8e6c..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/bezout_matrix.h
+++ /dev/null
@@ -1,619 +0,0 @@
-// Copyright (c) 2008 Max-Planck-Institute Saarbruecken (Germany)
-//
-// 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(s)     : Michael Hemmer
-//
-// ============================================================================
-
-// TODO: The comments are all original EXACUS comments and aren't adapted. So
-//         they may be wrong now.
-
-#ifndef CGAL_POLYNOMIAL_BEZOUT_MATRIX_H
-#define CGAL_POLYNOMIAL_BEZOUT_MATRIX_H
-
-#include <algorithm>
-
-#include <CGAL/basic.h>
-#include <CGAL/Polynomial_traits_d.h>
-#include <CGAL/Polynomial/determinant.h>
-#include <CGAL/use.h>
-
-#include <vector>
-//#include <CGAL/Linear_algebraHd.h>
-
-
-//#include <CGAL/Linear_algebra.h>
-//#include <CGAL/number_type_utils.h>
-
-namespace CGAL {
-
-namespace internal {
-
-/*! \ingroup CGAL_resultant_matrix
- *  \brief construct hybrid Bezout matrix of two polynomials
- *
- *  If \c sub=0 ,  this function returns the hybrid Bezout matrix 
- *  of \c f and \c g.
- *  The hybrid Bezout matrix of two polynomials \e f and \e g
- *  (seen as polynomials in one variable) is a
- *  square matrix of size max(deg(<I>f</I>), deg(<I>g</I>)) whose entries
- *  are expressions in the polynomials' coefficients.
- *  Its determinant is the resultant of \e f and \e g, maybe up to sign.
- *  The function computes the same matrix as the Maple command 
- *  <I>BezoutMatrix</I>.
- *
- *  If \c sub>0 , this function returns the matrix obtained by chopping
- *  off the \c sub topmost rows and the \c sub rightmost columns.
- *  Its determinant is the <I>sub</I>-th (scalar) subresultant
- *  of \e f and \e g, maybe up to sign.
- *
- *  If specified, \c sub must be less than the degrees of both \e f and \e g.
- *
- *  See also \c CGAL::hybrid_bezout_subresultant() and \c CGAL::sylvester_matrix() .
- *
- *  A formal definition of the hybrid Bezout matrix and a proof for the
- *  subresultant property can be found in:
- *
- *  Gema M.Diaz-Toca, Laureano Gonzalez-Vega: Various New Expressions for
- *  Subresultants and Their Applications. AAECC 15, 233-266 (2004)
- *
- */
-template <typename Polynomial_traits_d>
-typename internal::Simple_matrix< typename Polynomial_traits_d::Coefficient_type >
-hybrid_bezout_matrix(typename Polynomial_traits_d::Polynomial_d f, 
-                     typename Polynomial_traits_d::Polynomial_d g, 
-                     int sub = 0)
-{
-
-    typedef typename Polynomial_traits_d::Polynomial_d Polynomial;
-    typedef typename Polynomial_traits_d::Coefficient_type NT;
-    typename Polynomial_traits_d::Degree degree;
-    typename CGAL::Algebraic_structure_traits<Polynomial>::Is_zero is_zero;
-    typename Polynomial_traits_d::Get_coefficient coeff;
-
-    typedef typename internal::Simple_matrix<NT> Matrix;
-
-    int n = degree(f);
-    int m = degree(g);
-    CGAL_precondition((n >= 0) && !is_zero(f));
-    CGAL_precondition((m >= 0) && !is_zero(g));
-    CGAL_precondition(n > sub || sub == 0);
-    CGAL_precondition(m > sub || sub == 0);
-
-    int i, j, k, l;
-    NT  s;
-
-    if (m > n) {
-        std::swap(f, g);
-        std::swap(m, n);
-    }
-
-    Matrix B(n-sub);
-
-    for (i = 1+sub; i <= m; i++) {
-        for (j = 1; j <= n-sub; j++) {
-            s = NT(0);
-            for (k = 0; k <= i-1; k++) {
-                l = n+i-j-k;
-                if ((l <= n) and (l >= n-(m-i))) {
-                    s += coeff(f,l) * coeff(g,k);
-                }
-            }
-            for (k = 0; k <= n-(m-i+1); k++) {
-                l = n+i-j-k;
-                if ((l <= m) and (l >= i)) {
-                    s -= coeff(f,k) * coeff(g,l);
-                }
-            }
-            B[i-sub-1][j-1] = s;
-        }
-    }
-    for (i = std::max(m+1, 1+sub); i <= n; i++) {
-        for (j = i-m; j <= std::min(i, n-sub); j++) {
-            B[i-sub-1][j-1] = coeff(g,i-j);
-        }
-    }
-
-    return B; // g++ 3.1+ has NRVO, so this should not be too expensive
-}
-
-/*! \ingroup CGAL_resultant_matrix
- *  \brief construct the symmetric Bezout matrix of two polynomials
- *
- *  This function returns the (symmetric) Bezout matrix of \c f and \c g.
- *  The Bezout matrix of two polynomials \e f and \e g
- *  (seen as polynomials in one variable) is a
- *  square matrix of size max(deg(<I>f</I>), deg(<I>g</I>)) whose entries
- *  are expressions in the polynomials' coefficients.
- *  Its determinant is the resultant of \e f and \e g, maybe up to sign.
- *
- */
-template <typename Polynomial_traits_d>
-typename internal::Simple_matrix<typename Polynomial_traits_d::Coefficient_type>
-symmetric_bezout_matrix
-    (typename Polynomial_traits_d::Polynomial_d f, 
-     typename Polynomial_traits_d::Polynomial_d g, 
-     int sub = 0)
-{
-
-    
-
-  // Note: The algorithm is taken from:
-  // Chionh, Zhang, Goldman: Fast Computation of the Bezout and Dixon Resultant
-  // Matrices. J.Symbolic Computation 33, 13-29 (2002)
-    
-    typedef typename Polynomial_traits_d::Polynomial_d Polynomial;
-    typedef typename Polynomial_traits_d::Coefficient_type NT;
-    typename Polynomial_traits_d::Degree degree;
-    CGAL_assertion_code(typename CGAL::Algebraic_structure_traits<Polynomial>::Is_zero is_zero;)
-    CGAL_USE_TYPE(Polynomial);
-    typename Polynomial_traits_d::Get_coefficient coeff;
-
-    typedef typename internal::Simple_matrix<NT> Matrix;
-
-    int n = degree(f);
-    int m = degree(g);
-    CGAL_precondition((n >= 0) && !is_zero(f));
-    CGAL_precondition((m >= 0) && !is_zero(g));
-
-    int i,j,stop;
-
-    NT sum1,sum2;
-
-    if (m > n) {
-        std::swap(f, g);
-        std::swap(m, n);
-    }
-
-    CGAL_precondition((sub>=0) && sub < n);
-
-    int d = n - sub;
-
-    Matrix B(d);
-
-    // 1st step: Initialisation
-    for(i=0;i<d;i++) {
-      for(j=i;j<d;j++) {
-        sum1 = ((j+sub)+1>m) ? NT(0) : -coeff(f,i+sub)*coeff(g,(j+sub)+1);
-	sum2 =  ((i+sub)>m)  ? NT(0) :  coeff(g,i+sub)*coeff(f,(j+sub)+1);
-	B[i][j]=sum1+sum2;
-      }
-    }
-
-    // 2nd Step: Recursion adding
-    
-    // First, set up the first line correctly
-    for(i=0;i<d-1;i++) {
-      stop = (sub<d-1-i) ? sub : d-i-1;
-      for(j=1;j<=stop;j++) {
-          sum1 = ((i+sub+j)+1>m) ? NT(0) 
-                                 : -coeff(f,sub-j)*coeff(g,(i+sub+j)+1);
-          sum2 =  ((sub-j)>m)    ? NT(0) 
-                                 : coeff(g,sub-j)*coeff(f,(i+sub+j)+1);
-	
-	B[0][i]+=sum1+sum2;
-      }
-    }
-    // Now, compute the rest
-    for(i=1;i<d-1;i++) {
-      for(j=i;j<d-1;j++) {
-	B[i][j]+=B[i-1][j+1];
-      }
-    }
-
-    
-   //3rd Step: Exploit symmetry
-    for(i=1;i<d;i++) {
-      for(j=0;j<i;j++) {
-	B[i][j]=B[j][i];
-      }
-    }
-    
-    return B;
-}
-    
-
-
-/*! \ingroup CGAL_resultant_matrix
- *  \brief compute (sub)resultant as Bezout matrix determinant
- *
- *  This function returns the determinant of the matrix returned
- *  by <TT>hybrid_bezout_matrix(f, g, sub)</TT>  which is the
- *  resultant of \c f and \c g, maybe up to sign;
- *  or rather the <I>sub</I>-th (scalar) subresultant, if a non-zero third
- *  argument is given.
- *
- *  If specified, \c sub must be less than the degrees of both \e f and \e g.
- *
- *  This function might be faster than \c CGAL::Polynomial<..>::resultant() ,
- *  which computes the resultant from a subresultant remainder sequence.
- *  See also \c CGAL::sylvester_subresultant().
- */
-template <class Polynomial_traits_d>
-typename Polynomial_traits_d::Coefficient_type hybrid_bezout_subresultant(
-        typename Polynomial_traits_d::Polynomial_d f, 
-        typename Polynomial_traits_d::Polynomial_d g, 
-        int sub = 0
-) { 
-
-    typedef typename Polynomial_traits_d::Polynomial_d Polynomial;
-    typedef typename Polynomial_traits_d::Coefficient_type NT;
-    typename Polynomial_traits_d::Degree degree;
-    typename CGAL::Algebraic_structure_traits<Polynomial>::Is_zero is_zero;
-    
-    typedef internal::Simple_matrix<NT> Matrix;
-
-    CGAL_precondition((degree(f) >= 0));
-    CGAL_precondition((degree(g) >= 0));
-    
-    if (is_zero(f) || is_zero(g)) return NT(0);
-    
-    Matrix S = hybrid_bezout_matrix<Polynomial_traits_d>(f, g, sub);
-    CGAL_assertion(S.row_dimension() == S.column_dimension());
-    if (S.row_dimension() == 0) {
-        return NT(1);
-    } else {
-        return internal::determinant(S);
-    }
-}
-
-// Transforms the minors of the symmetric bezout matrix into the subresultant.
-// Needs the appropriate power of the leading coedfficient of f and the
-// degrees of f and g
-template<class InputIterator,class OutputIterator,class NT>
-void symmetric_minors_to_subresultants(InputIterator in,
-                                       OutputIterator out,
-                                       NT divisor,
-                                       int n,
-                                       int m,
-                                       bool swapped) {
-  
-    typename CGAL::Algebraic_structure_traits<NT>::Integral_division idiv;
-    
-    for(int i=0;i<m;i++) {
-      bool negate = ((n-m+i+1) & 2)>>1; // (n-m+i+1)==2 or 3 mod 4
-      negate=negate ^ (swapped & ((n-m+i+1)*(i+1)));  
-      //...XOR (swapped AND (n-m+i+1)* (i+1) is odd) 
-      
-      *out = idiv(*in,  negate ? -divisor : divisor);
-      in++;
-      out++;
-    }
-}
-
-
-/*! \ingroup CGAL_resultant_matrix
- * \brief compute the principal subresultant coefficients as minors 
- * of the symmetric Bezout matrix.
- *
- * Returns the sequence sres<sub>0</sub>,..,sres<sub>m</sub>, where 
- * sres<sub>i</sub> denotes the ith principal subresultant coefficient
- *
- * The function uses an extension of the Berkowitz method to compute the
- * determinant
- * See also \c CGAL::minors_berkowitz
- */
-template<class Polynomial_traits_d,class OutputIterator>
-OutputIterator symmetric_bezout_subresultants(
-	   typename Polynomial_traits_d::Polynomial_d f, 
-           typename Polynomial_traits_d::Polynomial_d g,
-           OutputIterator sres)
-{
-
-    typedef typename Polynomial_traits_d::Polynomial_d Polynomial;
-    typedef typename Polynomial_traits_d::Coefficient_type NT;
-    typename Polynomial_traits_d::Degree degree;
-    typename CGAL::Algebraic_structure_traits<Polynomial>::Is_zero is_zero;
-    typename Polynomial_traits_d::Leading_coefficient lcoeff;
-
-    typedef typename internal::Simple_matrix<NT> Matrix;
-    
-    int n = degree(f);
-    int m = degree(g);
-    
-    bool swapped=false;
-
-    if(n < m) {
-      std::swap(f,g);
-      std::swap(n,m);
-      swapped=true;
-      
-    }
-
-    Matrix B = symmetric_bezout_matrix<Polynomial_traits_d>(f,g);
-    
-    // Compute a_0^{n-m}
-
-    NT divisor=ipower(lcoeff(f),n-m);
-    
-    std::vector<NT> minors;
-    minors_berkowitz(B,std::back_inserter(minors),n,m);
-    CGAL::internal::symmetric_minors_to_subresultants(minors.begin(),sres,
-                                                   divisor,n,m,swapped);
-    
-    return sres; 
-  }
-
-/* 
- * Return a modified version of the hybrid bezout matrix such that the minors
- * from the last k rows and columns give the subresultants
- */
-template<class Polynomial_traits_d>
-typename internal::Simple_matrix<typename Polynomial_traits_d::Coefficient_type>
-modified_hybrid_bezout_matrix
-    (typename Polynomial_traits_d::Polynomial_d f,
-     typename Polynomial_traits_d::Polynomial_d g) {
-
-    typedef typename Polynomial_traits_d::Coefficient_type NT;
-
-    typedef typename internal::Simple_matrix<NT> Matrix;
-    
-    typename Polynomial_traits_d::Degree degree;
-
-    int n = degree(f);
-    int m = degree(g);
-    
-    int i,j;
-
-    bool negate, swapped=false;
-
-    if(n < m) {
-      std::swap(f,g); //(*)
-      std::swap(n,m);
-      swapped=true;
-    }
-    
-    Matrix B = CGAL::internal::hybrid_bezout_matrix<Polynomial_traits_d>(f,g);
-
-
-    // swap columns
-    i=0;
-    while(i<n-i-1) {
-      B.swap_columns(i,n-i-1); // (**)
-      i++;
-    }
-    for(i=0;i<n;i++) { 
-      negate=(n-i-1) & 1; // Negate every second column because of (**)
-      negate=negate ^ (swapped & (n-m+1)); // XOR negate everything because of(*)
-      if(negate) {
-	for(j=0;j<n;j++) {
-	  B[j][i] *= -1;
-	}
-      }
-    }
-    return B;
-}
-
-/*! \ingroup CGAL_resultant_matrix
- * \brief compute the principal subresultant coefficients as minors 
- * of the hybrid Bezout matrix.
- *
- * Returns the sequence sres<sub>0</sub>,...,sres<sub>m</sub>$, where 
- * sres<sub>i</sub> denotes the ith principal subresultant coefficient
- *
- * The function uses an extension of the Berkowitz method to compute the
- * determinant
- * See also \c CGAL::minors_berkowitz
- */
-template<class Polynomial_traits_d,class OutputIterator>
-OutputIterator hybrid_bezout_subresultants(
-	   typename Polynomial_traits_d::Polynomial_d f, 
-           typename Polynomial_traits_d::Polynomial_d g,
-           OutputIterator sres) 
-  {
-
-    typedef typename Polynomial_traits_d::Coefficient_type NT;
-    typename Polynomial_traits_d::Degree degree;
-
-    typedef typename internal::Simple_matrix<NT> Matrix;
-    
-    int n = degree(f);
-    int m = degree(g);
-
-    Matrix B = CGAL::internal::modified_hybrid_bezout_matrix<Polynomial_traits_d>
-        (f,g);
-
-    if(n<m) {
-      std::swap(n,m);
-    }
-
-    return minors_berkowitz(B,sres,n,m);
-  }
-
-
-  // Swap entry A_ij with A_(n-i)(n-j) for square matrix A of dimension n
-  template<class NT>
-    void swap_entries(typename internal::Simple_matrix<NT> & A) {
-    CGAL_precondition(A.row_dimension()==A.column_dimension());
-    int n = A.row_dimension();
-    int i=0;
-    while(i<n-i-1) {
-        A.swap_rows(i,n-i-1); 
-        A.swap_columns(i,n-i-1); 
-        i++;
-    }
-  }
-  
-  // Produce S-matrix with the given matrix and integers.
-  template<class NT,class InputIterator>
-    typename internal::Simple_matrix<NT> s_matrix(
-	      const typename internal::Simple_matrix<NT>& B,
-	      InputIterator num,int size)
-    {
-      typename internal::Simple_matrix<NT> S(size);
-      CGAL_precondition_code(int n = B.row_dimension();)
-      CGAL_precondition(n==(int)B.column_dimension());
-      int curr_num;
-      bool negate;
-      
-      for(int i=0;i<size;i++) {
-	curr_num=(*num);
-	num++;
-	negate = curr_num<0;
-	if(curr_num<0) {
-	  curr_num=-curr_num;
-	}
-	for(int j=0;j<size;j++) {
-	  
-	  S[j][i]=negate ? -B[j][curr_num-1] : B[j][curr_num-1];
-	  
-	}
-      }
-      return S;
-    }
-  
-  // Produces the integer sequence for the S-matrix, where c is the first entry
-  // of the sequence, s the number of desired diagonals and n the dimension 
-  // of the base matrix
-  template<class OutputIterator>
-    OutputIterator s_matrix_integer_sequence(OutputIterator it,
-					      int c,int s,int n) {
-    CGAL_precondition(0<s);
-    CGAL_precondition(s<=n);
-    // c is interpreted modulo s wrt to the representants {1,..,s}
-    c=c%s;
-    if(c==0) {
-      c=s;
-    }
-    
-    int i, p=0, q=c;
-    while(q<=n) {
-      *it = q;
-      it++;
-      for(i=p+1;i<q;i++) {
-	*it = -i;
-	it++;
-      }
-      p = q;
-      q = q+s;
-    }
-    return it;
-  }
-
-/*! \ingroup CGAL_resultant_matrix
- * \brief computes the coefficients of the polynomial subresultant sequence 
- *
- * Returns an upper triangular matrix <I>A</I> such that A<sub>i,j</sub> is
- * the coefficient of <I>x<sup>j-1</sup></I> in the <I>i</I>th polynomial
- * subresultant. In particular, the main diagonal contains the scalar
- * subresultants.
- * 
- * If \c d > 0 is specified, only the first \c d diagonals of <I>A</I> are 
- * computed. In particular, setting \c d to one yields exactly the same
- * result as applying \c hybrid_subresultants or \c symmetric_subresultants
- * (except the different output format). 
- *
- * These coefficients are computed as special minors of the hybrid Bezout matrix.
- * See also \c CGAL::minors_berkowitz
- */
-template<typename Polynomial_traits_d>
-typename internal::Simple_matrix<typename Polynomial_traits_d::Coefficient_type> 
-polynomial_subresultant_matrix(typename Polynomial_traits_d::Polynomial_d f,
-			       typename Polynomial_traits_d::Polynomial_d g,
-                               int d=0) {
-
-    typedef typename Polynomial_traits_d::Coefficient_type NT;
-    typename Polynomial_traits_d::Degree degree;
-    typename Polynomial_traits_d::Leading_coefficient lcoeff;
-
-    int n = degree(f);
-    int m = degree(g);
-
-    CGAL_precondition(n>=0);
-    CGAL_precondition(m>=0);
-    CGAL_precondition(d>=0);
-
-    typedef internal::Simple_matrix<NT> Matrix;
-   
-    bool swapped=false;
-
-    if(n < m) {
-      std::swap(f,g);
-      std::swap(n,m);
-      swapped=true;
-    }
-
-    if(d==0) {
-      d=m;
-    };
-
-
-    Matrix B = CGAL::internal::symmetric_bezout_matrix<Polynomial_traits_d>(f,g);
-
-    // For easier notation, we swap all entries:
-    internal::swap_entries<NT>(B);
-    
-    // Compute the S-matrices and collect the minors
-    std::vector<Matrix> s_mat(m);
-    std::vector<std::vector<NT> > coeffs(d);
-    for(int i = 1; i<=d;i++) {
-      std::vector<int> intseq;
-      internal::s_matrix_integer_sequence(std::back_inserter(intseq),i,d,n);
-
-      Matrix S = internal::s_matrix<NT>(B,intseq.begin(),(int)intseq.size());
-      internal::swap_entries<NT>(S);
-      //std::cout << S << std::endl;
-      int Sdim = S.row_dimension();
-      int number_of_minors=(Sdim < m) ? Sdim : Sdim; 
-      
-      internal::minors_berkowitz(S,std::back_inserter(coeffs[i-1]),
-			    Sdim,number_of_minors);
-
-    }
-
-    // Now, rearrange the minors in the matrix
-
-    Matrix Ret(m,m,NT(0));
-
-    for(int i = 0; i < d; i++) {
-      for(int j = 0;j < m-i ; j++) {
-	int s_index=(n-m+j+i+1)%d;
-	if(s_index==0) {
-	  s_index=d;
-	}
-	s_index--;
-	Ret[j][j+i]=coeffs[s_index][n-m+j];
-	
-      }
-    }
-
-    typename CGAL::Algebraic_structure_traits<NT>::Integral_division idiv;
-
-    NT divisor = ipower(lcoeff(f),n-m); 
-
-    int bit_mask = swapped ? 1 : 0;
-    // Divide through the divisor and set the correct sign
-    for(int i=0;i<m;i++) {
-      for(int j = i;j<m;j++) {
-	int negate = ((n-m+i+1) & 2)>>1; // (n-m+i+1)==2 or 3 mod 4
-	negate^=(bit_mask & ((n-m+i+1)*(i+1)));
-	//...XOR (swapped AND (n-m+i+1)* (i+1) is odd) 
-	Ret[i][j] = idiv(Ret[i][j],  negate>0 ? -divisor : divisor);
-      }
-    }
-
-    return Ret;
-}
-
-}
-
-} //namespace CGAL
-
-
-
-#endif // CGAL_POLYNOMIAL_BEZOUT_MATRIX_H
-// EOF
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_kernel.h b/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_kernel.h
deleted file mode 100644
index 749cae9..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_kernel.h
+++ /dev/null
@@ -1,111 +0,0 @@
-// Copyright (c) 2005  Stanford University (USA).
-// 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(s)     : Daniel Russel <drussel at alumni.princeton.edu>
-
-#ifndef CGAL_POLYNOMIAL_FILTERED_POLYNOMIAL_KERNEL_H
-#define CGAL_POLYNOMIAL_FILTERED_POLYNOMIAL_KERNEL_H
-
-#include <CGAL/Polynomial/basic.h>
-#include <CGAL/Polynomial/Filtered_rational/Filtered_rational_traits.h>
-#include <CGAL/Polynomial/Filtered_kernel/Filtered_sign_at.h>
-#include <CGAL/Polynomial/Filtered_kernel/Filtered_root_multiplicity.h>
-#include <CGAL/Polynomial/Kernel/Root_container.h>
-#include <CGAL/Polynomial/Kernel/Is_even_multiplicity.h>
-#include <CGAL/Polynomial/Kernel/Is_rational.h>
-#include <CGAL/Polynomial/Kernel/To_rational.h>
-
-namespace CGAL { namespace POLYNOMIAL {
-
-//! A filtered polynomial kernel.
-/*!
- */
-template < class Traits_t, class RE>
-class Filtered_kernel: public internal::Filtered_rational_traits<Traits_t>
-{
-    typedef Filtered_kernel< Traits_t, RE > This;
-    typedef internal::Filtered_rational_traits<Traits_t> P;
-    public:
-        typedef RE Root_stack;
-        typedef typename RE::Root Root;
-        typedef typename P::Function Function;
-        typedef typename Function::NT NT;
-        typedef typename Root_stack::Traits Root_stack_traits;
-
-        Filtered_kernel(const Root_stack_traits &tr = Root_stack_traits()): ret_(tr){}
-
-        typedef typename internal::Filtered_sign_at<This> Sign_at;
-        Sign_at sign_at_object(const Function &p) const
-        {
-            return Sign_at(p, *this);
-        }
-
-        typedef internal::Filtered_root_multiplicity<This> Multiplicity;
-        Multiplicity multiplicity_object(const Function &p0) const
-        {
-            return Multiplicity(p0, *this);
-        }
-
-        typedef internal::Is_even_multiplicity<This> Is_even_multiplicity;
-        Is_even_multiplicity is_even_multiplicity_object(const Function &) const
-        {
-            return Is_even_multiplicity();
-        }
-
-        typedef internal::Is_rational<This> Is_rational;
-        Is_rational is_rational_object() const
-        {
-            return Is_rational();
-        }
-
-        typedef internal::To_rational<This> To_rational;
-        To_rational to_rational_object() const
-        {
-            return To_rational();
-        }
-
-//! Return a container for roots in an interval
-/*!
-  \todo make sure that the iterator has all the right types.
-*/
-        typedef internal::Root_container<This> Root_container;
-        friend class internal::Root_container<This>;
-        Root_container root_container_object(const typename P::Function &f,
-            const Root &lb=-Root::infinity(),
-            const Root &ub= Root::infinity()) const
-        {
-            return Root_container(f, lb, ub, *this);
-        }
-
-        Root_stack root_stack_object(const typename P::Function &f,
-            const Root &lb=-Root::infinity(),
-            const Root &ub= Root::infinity()) const
-        {
-            return Root_stack(f, lb, ub, root_stack_traits_object());
-        }
-
-        Root_stack_traits root_stack_traits_object() const
-        {
-            return ret_;
-        }
-    protected:
-        Root_stack_traits ret_;
-};
-
-} } //namespace CGAL::POLYNOMIAL
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_kernel/Filtered_Descartes_has_root.h b/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_kernel/Filtered_Descartes_has_root.h
deleted file mode 100644
index 199e692..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_kernel/Filtered_Descartes_has_root.h
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright (c) 2005  Stanford University (USA).
-// 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(s)     : Daniel Russel <drussel at alumni.princeton.edu>
-
-#ifndef CGAL_POLYNOMIAL_FILTERED_DESCARTES_HAS_ROOT_H
-#define CGAL_POLYNOMIAL_FILTERED_DESCARTES_HAS_ROOT_H
-#include <CGAL/Polynomial/basic.h>
-#include <CGAL/Polynomial/Filtered_kernel/Filtered_Descartes_root_counter.h>
-
-namespace CGAL { namespace POLYNOMIAL { namespace internal {;
-
-template <class Kernel>
-class Filtered_Descartes_has_root
-{
-    public:
-        Filtered_Descartes_has_root(){}
-
-        Filtered_Descartes_has_root(const typename Kernel::Function &fh, Kernel k= Kernel()): h_(fh), kernel_(k) {
-        }
-
-        ~Filtered_Descartes_has_root() {
-        }
-
-        typedef bool result_type;
-
-        template <class NTT>
-            result_type operator()(const NTT &begin, const NTT &end,
-            POLYNOMIAL_NS::Sign=POLYNOMIAL_NS::ZERO,
-            POLYNOMIAL_NS::Sign=POLYNOMIAL_NS::ZERO) const
-        {
-            return filtered_Descartes_root_counter(h_, begin, end, false, kernel_)!= 0;
-        }
-
-    protected:
-        typename Kernel::Function h_;
-        Kernel kernel_;
-};
-
-} } } //namespace CGAL::POLYNOMIAL::internal;
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_kernel/Filtered_Descartes_root_counter.h b/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_kernel/Filtered_Descartes_root_counter.h
deleted file mode 100644
index 4d3d684..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_kernel/Filtered_Descartes_root_counter.h
+++ /dev/null
@@ -1,158 +0,0 @@
-// Copyright (c) 2005  Stanford University (USA).
-// 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(s)     : Daniel Russel <drussel at alumni.princeton.edu>
-
-#ifndef CGAL_POLYNOMIAL_FILTERED_DESCARTES_ROOT_COUNTER_H
-#define CGAL_POLYNOMIAL_FILTERED_DESCARTES_ROOT_COUNTER_H
-
-#include <CGAL/Polynomial/basic.h>
-
-#include <CGAL/Polynomial/Tools/Alternation_counter.h>
-#include <CGAL/Polynomial/Tools/interval_arithmetic.h>
-
-namespace CGAL { namespace POLYNOMIAL { namespace internal {;
-
-//! A class for computing filtered exact and approximate descartes root bounds.
-/*!
-  This can be used in two modes, first, just used filtering to perform an exact
-  descartes root bound faster. The second will return as soon as it can figure
-  out that there is a root in the interval.  This second mode can then return
-  the value SOME for the number roots meaning there is some unknown number
-  greater than 0 (at most).
-
-  A descartes root bound if performed exact computes whether there are 0, 1 or
-  an odd number or an even number of roots. The presence of an odd number of
-  roots can be more quickly determined by looking at the signs of the ends of
-  the interval (assuming they are non-zero). This bound does not do this
-optimization since the values can probably be cached by the calling function
-(since a pair of intervals share an endpoint).
-
-The filtering is used in a variety of ways. First, calculation are initially
-performed using intervals. If no exact answer is required and there is at
-least one definite alternation in the signs of the interval coefficients, then
-SOME is returned. If the intervals do not result in sufficient information
-begin computed, then the calculations fall back to repeating the process with
-an exact number type. Only ring operations are used, so any exact number type
-is fine.
-
-I think I should be able to return more exact bounds even if the intervals are
-not clear on their sign.  For example:
-+?- the value of the ? does not matter
-+?+ there are 0 or 2 from the ?, so the parity is still known
-+??+ there are at most 1, so this is useless
-+??- there are at most 3, so this is useless.
-*/
-
-template <class BNT, class Kernel>
-unsigned int filtered_Descartes_root_counter(const typename Kernel::Function &fh,
-const BNT &begin,
-const BNT &end,
-bool need_exact,
-Kernel k)
-{
-    typename Kernel::Interval_kernel::NT bi, ei;
-    typename Kernel::Interval_kernel::Function fim;
-    POLYNOMIAL_NS::Alternation_counter<typename Kernel::Interval_kernel::NT> ac;
-    {
-        Interval_arithmetic_guard iag;
-
-        if (fh.interval_function().is_constant()) {
-//std::cerr << "Why are you solving constant function?\n";
-            return 0;
-        }
-
-        bi= k.interval_function_converter_object().nt_converter()(begin);
-        ei= k.interval_function_converter_object().nt_converter()(end);
-
-//! Could add their optimization here if shift is positive
-        fim = k.interval_kernel_object().map_interval_to_positive_object(fh.interval_function())( bi, ei);
-
-        for (int i=0; i<= fim.degree(); ++i) {
-            ac.push_back(fim[i]);
-            if (!need_exact && ac.number_of_alternations() >0) {
-//std::cout << "Quick out in root count.\n";
-                return 1;
-            }
-        }
-    }
-
-    if (!ac.is_uncertain()) {
-/*std::cout << "No uncertainty in root count: " << fh << " [" << begin << ", " << end << "] is "
-  << ac.number_of_alternations() << "\n";*/
-        return ac.number_of_alternations();
-    }
-    else {
-/*if (ac.number_of_alternations() >0 && !ac.parity_uncertain()){
-  if (ac.number_of_alternations() %2==0) return Descartes_root_count::even();
-  else return Descartes_root_count::odd();
-  } else*/
-//typename CGAL::NT_converter<BNT, typename Kernel::Exact_kernel::Function::NT> ec;
-
-        typename Kernel::Exact_function_converter efc= k.exact_function_converter_object();
-        typename Kernel::Exact_kernel::NT be= efc.nt_converter()(begin);
-        typename Kernel::Exact_kernel::NT ee= efc.nt_converter()(end);
-        typename Kernel::Exact_kernel ek=k.exact_kernel_object();
-
-        typename Kernel::Exact_kernel::Function fem= ek.map_interval_to_positive_object(fh.exact_function())(be, ee);
-
-        POLYNOMIAL_NS::Alternation_counter<typename Kernel::Exact_kernel::NT> ac;
-        for (int i=0; i<= fem.degree(); ++i) {
-            ac.push_back(fem[i]);
-        }
-//std::cout << "Exact return in root count.\n";
-        return ac.number_of_alternations();
-    }
-}
-
-
-template <class Kernel>
-class Filtered_Descartes_root_counter
-{
-    public:
-        Filtered_Descartes_root_counter(){}
-
-        Filtered_Descartes_root_counter(const typename Kernel::Function &fh, Kernel k= Kernel()): h_(fh), kernel_(k) {
-        }
-
-        ~Filtered_Descartes_root_counter() {
-        }
-
-        typedef unsigned int result_type;
-
-        template <class NTT>
-            result_type operator()(const NTT &begin, const NTT &end,
-            POLYNOMIAL_NS::Sign,
-            POLYNOMIAL_NS::Sign) const
-        {
-            return filtered_Descartes_root_counter(h_, begin, end, true, kernel_);
-        }
-
-        template <class NTT>
-            result_type operator()(const NTT &begin, const NTT &end) const
-        {
-            return filtered_Descartes_root_counter(h_, begin, end, true, kernel_);
-        }
-
-    protected:
-        typename Kernel::Function h_;
-        Kernel kernel_;
-};
-
-} } } //namespace CGAL::POLYNOMIAL::internal;
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_kernel/Filtered_polynomial_rational_kernel.h b/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_kernel/Filtered_polynomial_rational_kernel.h
deleted file mode 100644
index b8335ff..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_kernel/Filtered_polynomial_rational_kernel.h
+++ /dev/null
@@ -1,226 +0,0 @@
-// Copyright (c) 2005  Stanford University (USA).
-// 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(s)     : Daniel Russel <drussel at alumni.princeton.edu>
-
-#ifndef CGAL_POLYNOMIAL_FILTERED_POLYNOMIAL_RATIONAL_KERNEL_H
-#define CGAL_POLYNOMIAL_FILTERED_POLYNOMIAL_RATIONAL_KERNEL_H
-
-#include <CGAL/Polynomial/basic.h>
-#include <CGAL/Polynomial/Tools/interval_arithmetic.h>
-
-#include <CGAL/Polynomial/Tools/Filtered_function.h>
-#include <CGAL/Polynomial/internal/Virtual_function_explicit.h>
-#include <CGAL/Polynomial/internal/Virtual_function_constant.h>
-#include <CGAL/Polynomial/internal/Virtual_function_generator.h>
-
-#include <CGAL/Polynomial/Filtered_kernel/Filtered_sign_at.h>
-#include <CGAL/Polynomial/Filtered_kernel/Filtered_are_negations.h>
-#include <CGAL/Polynomial/Filtered_kernel/Filtered_Descartes_has_root.h>
-#include <CGAL/Polynomial/Filtered_kernel/Filtered_root_bound_evaluator.h>
-#include <CGAL/Polynomial/Filtered_kernel/Filtered_sign_at.h>
-#include <CGAL/Polynomial/Filtered_kernel/Filtered_root_multiplicity.h>
-
-// not yet ported
-#include <CGAL/Polynomial/Kernel/Bezier_root_counter.h>
-#include <CGAL/Polynomial/Kernel/Sturm_root_counter.h>
-#include <CGAL/Polynomial/Kernel/Compare_isolated_roots_in_interval.h>
-
-namespace CGAL { namespace POLYNOMIAL { namespace internal {
-
-template <class SFK_t, class IFK_t, class EFK_t, class IFC_t, class EFC_t, class EIFC_t>
-class Filtered_polynomial_rational_kernel
-{
-    typedef Filtered_polynomial_rational_kernel<SFK_t, IFK_t, EFK_t,
-        IFC_t, EFC_t, EIFC_t> This;
-    public:
-
-        Filtered_polynomial_rational_kernel(){}
-
-        typedef typename SFK_t::Function::NT NT;
-        typedef Filtered_function<typename SFK_t::Function,
-            typename IFK_t::Function,
-            typename EFK_t::Function,
-            IFC_t, EFC_t, EIFC_t> Function;
-
-        typedef typename SFK_t::Function Explicit_function;
-
-        typedef SFK_t Explicit_kernel;
-        typedef IFK_t Interval_kernel;
-        typedef EFK_t Exact_kernel;
-
-        const Explicit_kernel &explicit_kernel_object() const { return sk_;}
-        const Interval_kernel &interval_kernel_object() const {return ik_;}
-        const Exact_kernel &exact_kernel_object() const {return ek_;}
-
-        typedef EFC_t Exact_function_converter;
-        typedef IFC_t Interval_function_converter;
-        typedef EIFC_t Exact_interval_function_converter;
-
-        const Exact_function_converter &exact_function_converter_object() const
-        {
-            return efc_;
-        }
-
-        const Interval_function_converter &interval_function_converter_object() const
-        {
-            return ifc_;
-        }
-
-        const Exact_interval_function_converter &exact_interval_function_converter_object() const
-        {
-            return eifc_;
-        }
-
-        typedef internal::Filtered_sign_at<This> Sign_at;
-        Sign_at sign_at_object(const Function &p) const
-        {
-            return Sign_at(p, *this);
-        }
-
-        typedef internal::Filtered_Descartes_root_counter<This> Descartes_root_counter;
-        Descartes_root_counter Descartes_root_counter_object(const Function &p) const
-        {
-            return Descartes_root_counter(p, *this);
-        }
-
-        typedef internal::Filtered_are_negations<This> Are_negations;
-        Are_negations are_negations_object() const
-        {
-            return Are_negations(*this);
-        }
-
-        typedef internal::Filtered_Descartes_has_root<This> Descartes_has_root;
-        Descartes_has_root Descartes_has_root_object(const Function &p) const
-        {
-            return Descartes_has_root(p, *this);
-        }
-
-        typedef internal::Sturm_root_counter<Exact_kernel> Sturm_root_counter;
-        Sturm_root_counter Sturm_root_counter_object(const Function &p) const
-        {
-            return Sturm_root_counter(p.exact_function());
-        }
-
-        typedef internal::Bezier_root_counter<Exact_kernel> Bezier_root_counter;
-        Bezier_root_counter Bezier_root_counter_object(const Function &p) const
-        {
-            return Bezier_root_counter(p.exact_function());
-        }
-
-        typedef internal::Compare_isolated_roots_in_interval<Exact_kernel>
-            Compare_isolated_roots_in_interval;
-        Compare_isolated_roots_in_interval compare_isolated_roots_in_interval_object(const Function &p0,
-            const Function &p1)const
-        {
-            return Compare_isolated_roots_in_interval(p0.exact_function(), p1.exact_function(),
-                exact_kernel_object());
-        }
-
-        typedef internal::Filtered_root_bound_evaluator<This> Root_bound;
-        Root_bound root_bound_object(bool power_of_two=true)const
-        {
-            return Root_bound(power_of_two, *this);
-        }
-
-        typedef internal::Filtered_root_multiplicity<This> Zero_multiplicity;
-        Zero_multiplicity zero_multiplicity_object(const Function &p0) const
-        {
-            return Zero_multiplicity(p0, *this);
-        }
-
-    protected:
-        typedef internal::Virtual_function_explicit<
-            typename Explicit_kernel::Function,
-            typename Interval_kernel::Function,
-            typename Exact_kernel::Function,
-            Interval_function_converter,
-            Exact_function_converter,
-            Exact_interval_function_converter> EVF;
-    public:
-
-        template <class UF>
-            Function function_from_generator(const UF &fc) const
-        {
-            typename Function::VFP vfp= new internal::Virtual_function_generator<UF, This,
-                typename Explicit_kernel::Function,
-                typename Interval_kernel::Function,
-                typename Exact_kernel::Function,
-                Interval_function_converter,
-                Exact_function_converter,
-                Exact_interval_function_converter>(fc, *this);
-            return Function(vfp);
-        }
-
-//! construct high degree polynomials
-        Function function_object(const NT& a0, const NT& a1=0) const
-        {
-            typename Explicit_kernel::Function f= sk_.function_object(a0, a1);
-            typename Function::VFP vfp= new EVF(f, ifc_, efc_,eifc_);
-            return Function(vfp);
-        }
-
-//! construct high degree polynomials
-        Function function_object(const NT& a0, const NT& a1,
-            const NT& a2, const NT& a3=0) const
-        {
-            typename Explicit_kernel::Function f= sk_.function_object(a0, a1,a2,a3);
-            typename Function::VFP vfp= new EVF(f, ifc_, efc_, eifc_);
-            return Function(vfp);
-        }
-
-//! construct high degree polynomials
-        Function function_object(const NT& a0, const NT& a1,
-            const NT& a2, const NT& a3,
-            const NT& a4, const NT& a5=0,
-            const NT& a6=0, const NT& a7=0) const
-        {
-            typename Explicit_kernel::Function f= sk_.function_object(a0, a1,a2,a3,a4,a5,a6,a7);
-            typename Function::VFP vfp= new EVF(f, ifc_, efc_, eifc_);
-            return Function(vfp);
-        }
-
-//! construct high degree polynomials
-        Function function_object(const NT& a0, const NT& a1,
-            const NT& a2, const NT& a3,
-            const NT& a4, const NT& a5,
-            const NT& a6, const NT& a7,
-            const NT& a8, const NT& a9=0,
-            const NT& a10=0, const NT& a11=0,
-            const NT& a12=0, const NT& a13=0,
-            const NT& a14=0, const NT& a15=0,
-            const NT& a16=0, const NT& a17=0,
-            const NT& a18=0, const NT& a19=0) const
-        {
-            typename Explicit_kernel::Function f= sk_.function_object(a0, a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,
-                a11,a12,a13,a14,a15,a16,a17,a18,a19);
-            typename Function::VFP vfp= new EVF(f, ifc_, efc_, eifc_);
-            return Function(vfp);
-        }
-
-    protected:
-        Explicit_kernel sk_;
-        Interval_kernel ik_;
-        Exact_kernel ek_;
-        Interval_function_converter ifc_;
-        Exact_function_converter efc_;
-        Exact_interval_function_converter eifc_;
-};
-
-} } } //namespace CGAL::POLYNOMIAL::internal
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_Descartes_has_root.h b/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_Descartes_has_root.h
deleted file mode 100644
index 5fc4028..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_Descartes_has_root.h
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright (c) 2005  Stanford University (USA).
-// 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(s)     : Daniel Russel <drussel at alumni.princeton.edu>
-
-#ifndef CGAL_POLYNOMIAL_FILTERED_DESCARTES_HAS_ROOT_H
-#define CGAL_POLYNOMIAL_FILTERED_DESCARTES_HAS_ROOT_H
-#include <CGAL/Polynomial/basic.h>
-#include <CGAL/Polynomial/Filtered_rational/Filtered_Descartes_root_counter.h>
-
-namespace CGAL { namespace POLYNOMIAL { namespace internal {;
-
-template <class Kernel>
-class Filtered_Descartes_has_root
-{
-    public:
-        Filtered_Descartes_has_root(){}
-
-        Filtered_Descartes_has_root(const typename Kernel::Function &fh, Kernel k= Kernel()): h_(fh), kernel_(k) {
-        }
-
-        ~Filtered_Descartes_has_root() {
-        }
-
-        typedef bool result_type;
-
-        template <class NTT>
-            result_type operator()(const NTT &begin, const NTT &end,
-            POLYNOMIAL_NS::Sign=POLYNOMIAL_NS::ZERO,
-            POLYNOMIAL_NS::Sign=POLYNOMIAL_NS::ZERO) const
-        {
-            return filtered_Descartes_root_counter(h_, begin, end, false, kernel_)!= 0;
-        }
-
-    protected:
-        typename Kernel::Function h_;
-        Kernel kernel_;
-};
-
-} } } //namespace CGAL::POLYNOMIAL::internal;
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_standard_sequence.h b/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_standard_sequence.h
deleted file mode 100644
index 91634d1..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_standard_sequence.h
+++ /dev/null
@@ -1,151 +0,0 @@
-// Copyright (c) 2005  Stanford University (USA).
-// 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(s)     : Daniel Russel <drussel at alumni.princeton.edu>
-
-#ifndef CGAL_FILTERED_STANDARD_SEQUENCE_H
-#define CGAL_FILTERED_STANDARD_SEQUENCE_H
-
-#include <CGAL/Polynomial/basic.h>
-#include <CGAL/Polynomial/Filtered_rational/Filtered_Sturm_sequence.h>
-
-namespace CGAL { namespace POLYNOMIAL { namespace internal {
-
-template<class Traits>
-class Filtered_standard_sequence
-: public Filtered_Sturm_sequence<Traits>
-{
-    protected:
-        typedef Filtered_Sturm_sequence<Traits> P;
-        typedef typename P::SP                SP;
-        typedef typename P::EP                EP;
-        typedef typename P::FH   FH;
-
-    public:
-        typedef SP                  Storage_function;
-        typedef EP                  Exact_function;
-        typedef FH                  Function_handle;
-//typedef typename P::Method_tag                 Method_tag;
-
-    protected:
-        typedef typename P::Interval_nt  Interval_nt;
-        typedef typename P::Exact_nt     Exact_nt;
-
-        typedef typename P::Interval_function  Interval_function;
-
-        typedef typename P::ISturm  ISturm;
-        typedef typename P::ESturm     ESturm;
-
-        typedef typename P::Exact_to_interval_function_converter
-            Exact_to_interval_function_converter;
-
-    protected:
-
-        virtual void compute_exact() const
-        {
-            if ( this->know_exact ) { return; }
-
-            Exact_function eq = P::tr_.exact_traits_object().differentiate_object()(P::fhp.exact_function());
-            this->eseq = P::tr_.exact_traits_object().Sturm_sequence_object(P::fhp.exact_function(), eq);
-            P::update_interval_Sturm_sequence();
-            this->know_exact = true;
-        }
-
-        void initialize() {
-            FPU_CW_t backup = FPU_get_and_set_cw(CGAL_FE_UPWARD);
-
-            Interval_function iq = P::tr_.interval_traits_object().differentiate_object()(P::fhp.interval_function());
-            this->iseq = P::tr_.interval_traits_object().Sturm_sequence_object(P::fhp.interval_function(), iq);
-
-            FPU_set_cw(backup);
-
-            this->know_exact = false;
-
-#if 1
-            bool need_exact = false;
-            for (int i = P::iseq.size()-1; i >= 0; i--) {
-                bool is_zero = true;
-                for (int j = 0; j <= P::iseq[i].degree(); j++) {
-                    if ( !CGAL::is_finite(P::iseq[i][j]) ) {
-                        need_exact = true;
-                        break;
-                    }
-                    if ( P::iseq[i][j].inf() != 0 || P::iseq[i][j].sup() != 0 ) {
-                        is_zero = false;
-                    }
-                }
-                if ( is_zero ) {
-                    need_exact = true;
-                    break;
-                }
-            }
-
-            if ( !need_exact ) {
-                P::know_exact = false;
-                return;
-            }
-
-            compute_exact();
-#endif
-        }
-
-    public:
-//===============
-// CONSTRUCTORS
-//===============
-        Filtered_standard_sequence() {}
-
-        Filtered_standard_sequence(const Function_handle& fh, const Traits &tr):
-        P(fh, Function_handle(0), tr, false) {
-//this->fhp = fh;
-            initialize();
-        }
-
-        virtual ~Filtered_standard_sequence() {}
-
-        const Interval_function& interval(int i) const  { return P::iseq[i]; }
-        const Exact_function&    exact(int i)    const
-        {
-            if ( !this->know_exact ) {
-                compute_exact();
-            }
-            return P::eseq[i];
-        }
-
-    public:
-
-        template<class T>
-            unsigned int
-            number_of_real_roots(const T& a, const T& b) const
-        {
-            CGAL_precondition( b >= a );
-
-            unsigned int Va = sign_variations(a);
-            if ( Va == 0 ) { return 0; }
-
-            unsigned int Vb = sign_variations(b);
-
-            CGAL_assertion( Va > Vb );
-
-            return Va - Vb;
-        }
-
-};
-
-} } } //namespace CGAL::POLYNOMIAL::internal
-#endif                                            // CGAL_FILTERED_STANDARD_SEQUENCE_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Kernel/Sign_above.h b/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Kernel/Sign_above.h
deleted file mode 100644
index e73920e..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Kernel/Sign_above.h
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright (c) 2005  Stanford University (USA).
-// 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(s)     : Daniel Russel <drussel at alumni.princeton.edu>
-
-#ifndef CGAL_POLYNOMIAL_INTERNAL_AFTER_AT_ROOT_H
-#define CGAL_POLYNOMIAL_INTERNAL_AFTER_AT_ROOT_H
-
-#include <CGAL/Polynomial/basic.h>
-//#include <CGAL/Polynomial/internal/Explicit_root.h>
-#include <CGAL/Polynomial/internal/Rational/Evaluate_polynomial.h>
-#include <CGAL/Polynomial/internal/Rational/Sign_above_rational.h>
-
-namespace CGAL { namespace POLYNOMIAL { namespace internal {
-
-//! Compute the sign after a root.
-/*!
-  This has specializations for Explicit_roots.
-*/
-template <class RNT, class K>
-class Sign_above: Sign_above_rational<K>
-{
-  typedef typename K::Function Poly;
-  typedef Sign_above_rational<K> P;
-public:
-  Sign_above( K k):P(k) {
-  }
-  Sign_above(){}
-
-#if defined(_MSC_VER) && ( _MSC_VER >= 1800 )
-  // == VC12 == Visual Studio 2013
-  template<typename... Args>
-  auto operator()(Args&&... args) ->
-      decltype(P::operator()(std::forward<Args>(args)...))
-  {
-    return P::operator()(std::forward<Args>(args)...);
-  }
-#else
-  using P::operator();
-#endif
-
-  typedef CGAL::Sign result_type;
-  typedef Poly first_argument_type;
-  typedef typename K::Root second_argument_type;
- typename P::result_type operator()(const first_argument_type &f,
-                                    const second_argument_type &v) const
-  {
-    CGAL_Polynomial_expensive_precondition(k_.sign_at_root_object(p_)(v)==CGAL::ZERO);
-    return eval(f, v);
-  }
-
-protected:
-
-  template <class R>
-  CGAL::Sign eval(const Poly &p, const R &r) const
-  {
-    double ub= CGAL::to_interval(r).second+.00001;
-    if (ub== CGAL::to_interval(r).second) ub= ub*2;
-    typename K::Root_stack rc=  k_.root_stack_object(p, r, ub);
-    while (true) {
-      if (rc.empty()) {
-	return k_.sign_at_object()(p,typename Poly::NT(ub));
-      } else if (rc.top() != r) {
-	typename K::Root rr=rc.top();
-	typename K::Sign_between_roots sb= k_.sign_between_roots_object();
-	return sb(p, r, rr);
-      } else {
-	rc.pop();
-      }
-    }
-  }
-  K k_;
-};
-
-
-} } } //namespace CGAL::POLYNOMIAL::internal
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Descartes_has_root.h b/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Descartes_has_root.h
deleted file mode 100644
index 68b1f13..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Descartes_has_root.h
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright (c) 2005  Stanford University (USA).
-// 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(s)     : Daniel Russel <drussel at alumni.princeton.edu>
-
-#ifndef CGAL_POLYNOMIAL_DESCARTES_HAS_ROOT_H
-#define CGAL_POLYNOMIAL_DESCARTES_HAS_ROOT_H
-
-#include <CGAL/Polynomial/basic.h>
-#include <CGAL/Polynomial/Tools/Alternation_counter.h>
-
-namespace CGAL { namespace POLYNOMIAL { namespace internal {;
-
-template <class Kernel>
-class Descartes_has_root
-{
-    public:
-        Descartes_has_root(const typename Kernel::Function &f,
-        Kernel k= Kernel()): map_(k.map_rational_interval_to_positive_object(f)) {
-
-        }
-
-        typedef bool result_type;
-        typedef typename Kernel::Function::NT first_argument_type;
-        typedef typename Kernel::Function::NT second_argument_type;
-
-//! Note, the result is an upper bound
-/*!
-  Bezier root counter needs the sign version of the function. This is added to make the two compatible.
-*/
-        template <class NTT>
-            result_type operator()(const NTT &lb, const NTT &ub,
-            POLYNOMIAL_NS::Sign, POLYNOMIAL_NS::Sign) const
-        {
-            return operator()(lb,ub);
-        }
-        template <class NTT>
-            result_type operator()(const NTT &lb, const NTT &ub) const
-        {
-            typename Kernel::Function mf= map_(lb, ub);
-
-            typename POLYNOMIAL_NS::Alternation_counter<first_argument_type> ac;
-            for (int i=0; i<= mf.degree(); ++i) {
-                ac.push_back(mf[i]);
-                if (ac.number_of_alternations() >0) return true;
-
-            }
-//std::cout << "Num alternations is " << ac.number_of_alternations() << std::endl;
-            return false;
-        }
-    protected:
-        typename Kernel::Map_rational_interval_to_positive map_;
-};
-} } } //namespace CGAL::POLYNOMIAL::internal;
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Standard_sequence.h b/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Standard_sequence.h
deleted file mode 100644
index 98f7a35..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Standard_sequence.h
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright (c) 2005  Stanford University (USA).
-// 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(s)     : Daniel Russel <drussel at alumni.princeton.edu>
-
-#ifndef CGAL_STANDARD_SEQUENCE_H
-#define CGAL_STANDARD_SEQUENCE_H
-
-//#include <CGAL/Polynomial/utilities.h>
-//#include <CGAL/Polynomial/Rational/Sturm_sequence.h>
-
-namespace CGAL { namespace POLYNOMIAL { namespace internal {
-
-template<class Sturm_sequence_t>
-class Standard_sequence : public Sturm_sequence_t
-{
-    public:
-        typedef Sturm_sequence_t                        Sturm_sequence;
-        typedef typename Sturm_sequence::Kernel         Kernel;
-        typedef typename Sturm_sequence::Polynomial     Polynomial;
-
-        typedef typename Polynomial::NT                 NT;
-
-    protected:
-        typedef Sturm_sequence                          Base;
-
-    public:
-        Standard_sequence() : Base() {}
-        Standard_sequence(const Polynomial& p, const Kernel& k=Kernel())
-            : Base(p, k.differentiate_object()(p), k) {}
-
-    protected:
-        template<class NTRep>
-            unsigned int number_of_real_roots_base(const NTRep& a,
-            const NTRep& b) const
-        {
-            CGAL_precondition( b >= a );
-
-            unsigned int Va = sign_variations(a);
-            if ( Va == 0 ) { return 0; }
-
-            unsigned int Vb = sign_variations(b);
-
-//CGAL_assertion( Va > Vb );
-
-            return Va - Vb;
-        }
-
-    public:
-        template<class T>
-            unsigned int
-            number_of_real_roots(const T& a, const T& b) const
-        {
-            return number_of_real_roots_base(a, b);
-        }
-
-};
-
-#if 0
-template<class Kernel, class Ret, class M = CGAL::Integral_domain_without_division_tag>
-class Standard_sequence_k
-: public Sturm_sequence_k<Kernel, Ret,M>
-{
-//public:
-    typedef Sturm_sequence_k<Kernel, Ret,M> Parent;
-    typedef typename Parent::Polynomial                                       Polynomial;
-//typedef M                                       Method_tag;
-
-    typedef typename Parent::NT                 NT;
-
-//protected:
-
-    public:
-        Standard_sequence_k() : Parent() {}
-        Standard_sequence_k(const Polynomial& p)
-            : Parent(p, p.derivative()) {}
-};
-#endif
-
-} } } //namespace CGAL::POLYNOMIAL::internal
-#endif                                            // CGAL_STANDARD_SEQUENCE_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Sturm_root_rep.h b/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Sturm_root_rep.h
deleted file mode 100644
index 05f12b4..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Sturm_root_rep.h
+++ /dev/null
@@ -1,1049 +0,0 @@
-// Copyright (c) 2005  Stanford University (USA).
-// 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(s)     : Daniel Russel <drussel at alumni.princeton.edu>
-
-#ifndef CGAL_POLYNOMIAL_STURM_ROOT_REP_H
-#define CGAL_POLYNOMIAL_STURM_ROOT_REP_H
-
-#include <CGAL/Polynomial/basic.h>
-#include <CGAL/Polynomial/internal/Rational/Sign_Sturm_sequence.h>
-#include <limits>
-#include <cfloat>
-
-//#include <CGAL/Polynomial/internal/Bisection.h>
-
-
-namespace CGAL { namespace POLYNOMIAL { namespace internal {
-
-//==================
-// the Root class
-//==================
-template<class Solver_t, class Interval_t>
-class Sturm_root_rep
-{
-public:
-  typedef Solver_t                            Solver;
-  typedef Interval_t                          Interval;
-  typedef typename Solver::Traits             Traits;
-
-  //  typedef typename Solver::Exact_nt           Exact_nt;
-  //  typedef typename Solver::Storage_function   Storage_function;
-  //  typedef typename Solver::Exact_function     Exact_function;
-  typedef typename Solver::Method_tag         Method_tag;
-
-  //  typedef typename Solver::Function_handle    Function_handle;
-  typedef typename Solver::Standard_sequence  Standard_sequence;
-
-  typedef typename Solver::Polynomial         Polynomial;
-  typedef typename Solver::NT                 NT;
-  typedef typename Solver::Sign_at            Sign_at;
-  typedef NT                                  Exact_nt;
-
-  typedef Sturm_root_rep<Solver,Interval>  Self;
-
-  class Sign_at_functor
-  {
-  public:
-    typedef Sign result_type;
-
-    Sign_at_functor(const Self* outer) : outer(outer) {}
-
-    template<class T>
-    result_type operator()(const T& x) const
-    {
-      Sign s1 = outer->sseq.sign_at(x, 0);
-      Sign s2 = outer->sseq.sign_at_gcd(x);
-
-      CGAL_assertion( s1 == CGAL::ZERO || s2 != CGAL::ZERO );
-      return s1 * s2;
-    }
-
-  private:
-    const Self* outer;
-  };
-
-  typedef typename Traits::Sign_Sturm_sequence   Sign_Sturm_sequence;
-
-protected:
-  typedef std::pair<Interval,Interval>               Interval_pair;
-
-public:
-  //==========================================
-  // METHODS FOR COMPUTING THE MULTIPLICITY
-  //==========================================
-
-  bool is_rational() const
-  {
-    return is_exact();
-  }
-
-  NT to_rational() const
-  {
-    CGAL_Polynomial_precondition( is_rational() );
-    return ivl.lower_bound();
-  }
-
-  bool is_exact() const
-  {
-    return ivl.is_singular();
-  }
-
-  // computes the multiplicity using the interval number type;
-  // if computation was successful the method sets success to true;
-  // if computation was not possible the method sets success to
-  // false;
-
-  void compute_multiplicity() const
-  {
-    CGAL_precondition( multiplicity_ == 0 );
-
-    if ( p_.degree() == 1 ) {
-      multiplicity_ = 1;
-      return;
-    }
-
-    if ( is_exact() ) {
-      compute_multiplicity_exact();
-    }
-    else {
-      compute_multiplicity_interval();
-    }
-  }
-
-  void compute_multiplicity_exact() const
-  {
-    Polynomial q = p_;
-
-    while ( true ) {
-      multiplicity_++;
-      q = tr_.differentiate_object()(q);
-
-      if ( q.is_zero() ) { break; }
-
-      Sign_at  sign_at_q(q);
-      Sign s = ivl.apply_to_endpoint(sign_at_q, Interval::LOWER);
-      if ( s != CGAL::ZERO ) {
-	break;
-      }
-    }
-  }
-
-  void compute_multiplicity_interval() const
-  {
-    bool is_even_multiplicity_ = is_even_multiplicity();
-
-    typename Traits::Differentiate differentiate =
-      tr_.differentiate_object();
-
-    Polynomial q = p_;
-    bool first_time = true;
-    while ( true ) {
-      if ( first_time ) {
-	first_time = false;
-	if ( !is_even_multiplicity_ ) {
-	  multiplicity_++;
-	  q = differentiate(q);
-	}
-	else {
-	  multiplicity_ += 2;
-	  q = differentiate( differentiate(q) );
-	}
-      }
-      else {
-	multiplicity_ += 2;
-	q = differentiate( differentiate(q) );
-      }
-
-      if ( q.degree() <= 0 ) { break; }
-
-      Sign_Sturm_sequence sign_sturm =
-	tr_.sign_Sturm_sequence_object(p_, q);
-
-      int sign = ivl.apply_to_interval(sign_sturm);
-
-      if ( sign != 0 ) { break; }
-    }
-  }
-
-  //===========================================
-  // HELPER METHODS FOR UPDATING THE VALUES
-  // ASSOCIATED WITH THE INTERVAL
-  //===========================================
-
-  void set_lower(const typename Interval::NT& l,
-		 const Sign& s_l) const
-  {
-    ivl.set_lower(l);
-    s_lower = s_l;
-  }
-
-  void set_upper(const typename Interval::NT& u,
-		 const Sign& s_u) const
-  {
-    ivl.set_upper(u);
-    s_upper = s_u;
-  }
-
-  void set_interval(const typename Interval::NT& x) const
-  {
-    ivl.set_lower(x);
-    ivl.set_upper(x);
-    s_lower = s_upper = CGAL::ZERO;
-  }
-
-
-
-  template <class This>
-  Comparison_result
-  compare_finite(const This &r, bool subdiv=true) const {
-    // consider the cases that the root is known exactly;
-    // this is equivalent to saying that the two endpoints for the
-    // interval containing the root are the same;
-    // moreover if the two interval endpoints are not the same we
-    // make sure that the interval endpoints are not roots.
-    // this will make life easier afterwards.
-
-    if ( is_exact() ) {
-      //	std::cout << "first is exact" << std::endl;
-      if ( r.is_exact() ) {
-	//	  std::cout << "second is exact" << std::endl;
-	return CGAL::compare( lower_bound(), r.lower_bound() );
-      }
-      else {
-	if ( upper_bound() <= r.lower_bound() ) {
-	  return CGAL::SMALLER;
-	}
-	else if ( lower_bound() >= r.upper_bound() ) {
-	  return CGAL::LARGER;
-	} else if ( upper_bound() > r.lower_bound() &&
-                    lower_bound() < r.upper_bound() ) {
-	  Sign s_r_lb = r.sign_lower();
-	  {
-	    Sign s_r_ub = r.sign_upper();
-	    CGAL_assertion( s_r_lb != CGAL::ZERO && s_r_ub != CGAL::ZERO );
-	    if(0) s_r_ub= CGAL::ZERO;
-	  }
-
-	  Sign s_at_r = r.sign_at( *this, Interval::LOWER );
-
-	  if ( s_at_r == CGAL::ZERO ) { return CGAL::EQUAL; }
-	  return ( s_at_r == s_r_lb ) ? CGAL::SMALLER : CGAL::LARGER;
-	}
-      }
-    }
-    else if ( r.is_exact() ) {
-
-      // we have already checked the case that this root is also
-      // known exactly
-      //	std::cout << "second is exact" << std::endl;
-      if ( upper_bound() <= r.lower_bound() ) {
-	//	  std::cout << "this.upper bound <= other.lower bound" << std::endl;
-	return CGAL::SMALLER;
-      }
-      else if ( lower_bound() >= r.upper_bound() ) {
-	//	  std::cout << "this.lower bound >= other.upper bound" << std::endl;
-	return CGAL::LARGER;
-      } else if (  upper_bound() > r.lower_bound() &&
-		   lower_bound() < r.upper_bound() ) {
-	//	   std::cout << "other in interval of this" << std::endl;
-	Sign s_ub = sign_upper();
-	{
-	  Sign s_lb = sign_lower();
-	  CGAL_assertion( s_lb != CGAL::ZERO && s_ub != CGAL::ZERO );
-	  if(0) s_lb= CGAL::ZERO;
-	}
-
-	Sign s_at_this = sign_at( r, Interval::LOWER );
-
-	if ( s_at_this == CGAL::ZERO ) { return CGAL::EQUAL; }
-	return ( s_ub == s_at_this ) ? CGAL::SMALLER : CGAL::LARGER;
-      }
-    }
-    else {
-      // now the roots are in the interior of interval
-      // check if the interiors of the intervals are disjoint
-      //	std::cout << "both not exact" << std::endl;
-      //	int prec = std::cout.precision();
-      //	std::cout.precision(16);
-      //	std::cout << "this:  " << lower_bound() << " " << upper_bound()
-      //		  << std::endl;
-      //	std::cout << "other: " << r.lower_bound() << " "
-      //		  << r.upper_bound() << std::endl;
-      //	std::cout.precision(prec);
-
-      if ( upper_bound() <= r.lower_bound() ) {
-	//	  std::cout << "this.upper bound <= other.lower bound" << std::endl;
-	return CGAL::SMALLER;
-      }
-      else if ( lower_bound() >= r.upper_bound() ) {
-	//	  std::cout << "this.lower bound >= other.upper bound" << std::endl;
-	return CGAL::LARGER;
-      } else {
-	if (subdiv) {
-	  int count=0;
-	  while ( upper_bound() > r.lower_bound() &&
-		  lower_bound() < r.upper_bound() ) {
-	    subdivide();
-	    ++count;
-	    if (count==4) break;
-	    //	  std::cout << "intersecting intervals" << std::endl;
-	  }
-	  return compare_finite(r, false);
-	} else {
-	  return compare_intersecting(r);
-	}
-      }
-    }
-
-    bool this_line_should_not_have_been_reached = false;
-    CGAL_assertion( this_line_should_not_have_been_reached );
-    if (0) this_line_should_not_have_been_reached= false;
-    return CGAL::EQUAL;
-  }
-  
-
-  //===========================================
-  // HELPER METHODS FOR COMPARISON OPERATORS
-  //===========================================
-  template<class This>
-  Comparison_result compare(const This& r) const
-  {
-    // check against positive and negative infinity
-    if (idx == -2) {
-      if ( r.idx == -2 ) { return CGAL::EQUAL; }
-      return CGAL::SMALLER;
-    }
-    if (idx == -1) {
-      if ( r.idx == -1 ) { return CGAL::EQUAL; }
-      return CGAL::LARGER;
-    }
-    if (r.idx == -2) {
-      // I have already checked if both are negative infinity
-      return CGAL::LARGER;
-    }
-    if (r.idx == -1) {
-      // I have already checked if both are positive infinity
-      return CGAL::SMALLER;
-    }
-    return compare_finite(r);
-  }
-
-  
-  //--------------------------------------------------------------
-
-
-  template<class This>
-  Comparison_result
-  compare_intersecting(const This& r) const
-  {
-    // in this method we know that the intervals are not
-    // trivial, are intersecting and that the endpoints are not
-    // roots
-
-    // Case 1: the intervals have common left endpoint
-    if ( lower_bound() == r.lower_bound() ) {
-      if ( upper_bound() > r.upper_bound() ) {
-	Sign s = sign_at( r, Interval::UPPER );
-
-	if ( s == CGAL::ZERO ) {
-	  // the root of this is equal to the upper bound of r
-	  //	    set_interval( r, Interval::UPPER );
-	  set_interval( r.upper_bound() );
-	  return CGAL::LARGER;
-	}
-	else {
-	  if ( s == sign_lower() ) {
-	    return CGAL::LARGER;
-	  }
-	  else {
-	    //	      set_upper( r, Interval::UPPER, s );
-	    set_upper( r.upper_bound(), s );
-	    return compare_same_interval(r);
-	  }
-	}
-      }
-      else if ( r.upper_bound() > upper_bound() ) {
-	const This* new_this = static_cast<const This*>(this);
-	return opposite(r.compare_intersecting( *new_this ));
-      }
-      else if ( upper_bound() == r.upper_bound() ) {
-	return compare_same_interval(r);
-      }
-    }
-
-    // Case 2: the intervals have common right endpoint
-    if ( upper_bound() == r.upper_bound() ) {
-      if ( lower_bound() < r.lower_bound() ) {
-	Sign s = sign_at( r, Interval::LOWER );
-	if ( s == CGAL::ZERO ) {
-	  // the root of this is equal to the lower bound of r
-	  //	    set_interval( r, Interval::LOWER );
-	  set_interval( r.lower_bound() );
-	  return CGAL::SMALLER;
-	}
-	else {
-	  if ( s == sign_upper() ) {
-	    return CGAL::SMALLER;
-	  }
-	  else {
-	    //	      set_lower( r, Interval::LOWER, s );
-	    set_lower( r.lower_bound(), s );
-	    return compare_same_interval(r);
-	  }
-	}
-      }
-      else if ( r.lower_bound() < lower_bound() ) {
-	const This* new_this = static_cast<const This*>(this);
-	return opposite(r.compare_intersecting( *new_this ));
-      }
-      else if ( lower_bound() == r.lower_bound() ) {
-	return compare_same_interval(r);
-      }
-    }
-
-    // Case 3: the upper bound of r is an interior point of the
-    //         interval of this and the lower bound of r is before
-    //         the lower bound of this
-    if ( lower_bound() > r.lower_bound() &&
-	 upper_bound() > r.upper_bound() ) {
-
-      Sign s_this_at_r = r.sign_at( *this, Interval::LOWER );
-      if ( s_this_at_r == CGAL::ZERO ) {
-	//	  r.set_interval( *this, Interval::LOWER );
-	r.set_interval( lower_bound() );
-	return CGAL::LARGER;
-      }
-
-      Sign s_r_at_this = sign_at( r, Interval::UPPER );
-      if ( s_r_at_this == CGAL::ZERO ) {
-	//	  set_interval( r, Interval::UPPER );
-	set_interval( r.upper_bound() );
-	return CGAL::SMALLER;
-      }
-
-      if ( s_r_at_this != CGAL::ZERO && s_this_at_r != CGAL::ZERO ) {
-
-	if ( s_this_at_r != r.sign_lower() ) {
-	  //	    r.set_upper( *this, Interval::LOWER, s_this_at_r );
-	  r.set_upper( lower_bound(), s_this_at_r );
-	  return CGAL::LARGER;
-	}
-
-	if ( s_r_at_this != sign_upper() ) {
-	  //	    set_lower( r, Interval::UPPER, s_r_at_this );
-	  set_lower( r.upper_bound(), s_r_at_this );
-	  return CGAL::LARGER;
-	}
-
-	//	  set_upper( r, Interval::UPPER, s_r_at_this );
-	//	  r.set_lower( *this, Interval::LOWER, s_this_at_r );
-	set_upper( r.upper_bound(), s_r_at_this );
-	r.set_lower( lower_bound(), s_this_at_r );
-
-	return compare_same_interval(r);
-      }
-    }
-
-    // Case 4: the upper bound of this is an interior point of the
-    //         interval of r and the lower bound of this is before
-    //         the lower bound of r
-    if ( lower_bound() < r.lower_bound() &&
-	 upper_bound() < r.upper_bound() ) {
-      const This* new_this = static_cast<const This*>(this);
-      return opposite(r.compare_intersecting( *new_this ));
-    }
-
-    // Case 5: the interval of r is contained in the interval of
-    //         this
-    if ( lower_bound() < r.lower_bound() &&
-	 upper_bound() > r.upper_bound() ) {
-
-      Sign s_rl_at_this = sign_at( r, Interval::LOWER );
-      if ( s_rl_at_this == CGAL::ZERO ) {
-	//	  set_interval( r, Interval::LOWER );
-	set_interval( r.lower_bound() );
-	return CGAL::SMALLER;
-      }
-
-      Sign s_ru_at_this = sign_at( r, Interval::UPPER );
-      if ( s_ru_at_this == CGAL::ZERO ) {
-	//	  set_interval( r, Interval::UPPER );
-	set_interval( r.upper_bound() );
-	return CGAL::LARGER;
-      }
-
-      Sign s_l = sign_lower();
-      if ( s_l != s_rl_at_this ) {
-	//	  set_upper( r, Interval::LOWER, s_rl_at_this );
-	set_upper( r.lower_bound(), s_rl_at_this );
-	return CGAL::SMALLER;
-      }
-
-      Sign s_u = sign_upper();
-      if ( s_u != s_ru_at_this ) {
-	//	  set_lower( r, Interval::UPPER, s_ru_at_this );
-	set_lower( r.upper_bound(), s_ru_at_this );
-	return CGAL::LARGER;
-      }
-
-      if ( s_rl_at_this != CGAL::ZERO &&
-	   s_ru_at_this != CGAL::ZERO   ) {
-	//	  set_lower( r, Interval::LOWER, s_rl_at_this );
-	//	  set_upper( r, Interval::UPPER, s_ru_at_this );
-	set_lower( r.lower_bound(), s_rl_at_this );
-	set_upper( r.upper_bound(), s_ru_at_this );
-
-	return compare_same_interval(r);
-      }
-    }
-
-    // Case 6: the interval of this is contained in
-    //         the interval of r
-    if ( lower_bound() > r.lower_bound() &&
-	 upper_bound() < r.upper_bound() ) {
-      const This* new_this = static_cast<const This*>(this);
-      return opposite(r.compare_intersecting( *new_this ));
-    }
-
-    CGAL_postcondition_msg(0, "This line should not have been reached.\n");
-    //bool this_line_should_not_have_been_reached = false;
-    //CGAL_assertion( this_line_should_not_have_been_reached );
-
-    return CGAL::EQUAL;
-  }                                         // end-compare_intersecting
-
-  //--------------------------------------------------------------
-  void subdivide() const
-  {
-    if (!refined_) {
-      refined_=true;
-      //std::cout << "Refining " << *this << " " << std::endl;
-    }
-
-
-    Interval_pair ivl_pair = ivl.split();
-    Interval first_half  = ivl_pair.first;
-    Interval second_half = ivl_pair.second;
-
-    Sign_at_functor sign_at_f(this);
-
-    Sign s_mid =
-      first_half.apply_to_endpoint( sign_at_f, Interval::UPPER );
-
-    if ( s_mid == CGAL::ZERO ) {
-      ivl = first_half.endpoint_interval( Interval::UPPER );
-      return;
-    }
-
-    if ( s_mid == sign_upper() ) {
-      ivl = first_half;
-    }
-    else {
-      ivl = second_half;
-    }
-  }
-
-  
-
-  template<class Child>
-  Polynomial compute_simple(Field_tag, const Child&) const
-  {
-    Polynomial gcd = sseq.exact( sseq.exact_size() - 1 );
-    return p_ / gcd;
-  }
-
-  /*Polynomial compute_simple(Integral_domain_without_division_tag, const Self&) const
-    {
-    Polynomial gcd = sseq[sseq.size() - 1];
-    return tr_.pseudo_quotient_object()(p_, gcd);
-    }*/
-  
-  Polynomial compute_simple(Field_tag, const Self&) const
-  {
-    Polynomial gcd = sseq[sseq.size() - 1];
-    return tr_.quotient_object()(p_, gcd);
-  }
-
-  template<class This>
-  Comparison_result
-  //    compare_same_interval(const Self& r) const
-  compare_same_interval(const This& r) const
-  {
-    CGAL_precondition( lower_bound() == r.lower_bound() );
-    CGAL_precondition( upper_bound() == r.upper_bound() );
-
-    // here I have to do some subdivisions...
-
-    Method_tag mtag;
-    Sign_Sturm_sequence seq
-      = tr_.sign_Sturm_sequence_object(r.compute_simple(mtag, r),
-				       compute_simple(mtag, r) );
-
-    int sign_of_r_at_this;
-
-    sign_of_r_at_this =
-      seq.sum_of_signs(lower_bound(), upper_bound());
-
-    if ( sign_of_r_at_this == 0 ) { return CGAL::EQUAL; }
-
-    Sign s_r;
-    if ( sign_of_r_at_this < 0 ) {
-      s_r = CGAL::NEGATIVE;
-    }
-    else {
-      s_r = CGAL::POSITIVE;
-    }
-
-    Sign s_l = sign_lower();
-
-    return ( s_r != s_l ) ? CGAL::SMALLER : CGAL::LARGER;
-  }
-
-  //===================
-  // SIGNS EVALUATORS
-  //===================
-  Sign sign_lower() const
-  {
-    return s_lower;
-  }
-
-  Sign sign_upper() const
-  {
-    return s_upper;
-  }
-
-  template<class This>
-  Sign sign_at(const This& r, typename Interval::Endpoint b) const
-  {
-    Sign_at_functor sign_at_f(this);
-
-    return r.ivl.apply_to_endpoint(sign_at_f, b);
-  }
-
-public:
-  //==================================
-  // POSITIVE AND NEGATIVE INFINITY
-  //==================================
-  static Self infinity(const Traits& tr = Traits()) {
-    return Self(-1, 0, tr);
-  }
-
-  //================
-  // CONSTRUCTORS
-  //================
-protected:
-  Sturm_root_rep(int i, int, const Traits& tr)
-    : idx(i), ivl(), p_(), sseq(), s_lower(CGAL::ZERO),
-      s_upper(CGAL::ZERO), multiplicity_(0), tr_(tr), refined_(false)  {}
-
-public:
-  Sturm_root_rep(const Traits& tr = Traits())
-    : idx(-1), ivl(), p_(), sseq(), s_lower(CGAL::ZERO),
-      s_upper(CGAL::ZERO), multiplicity_(0), tr_(tr), refined_(false)  {}
-  //-------
-  template<class T>
-  Sturm_root_rep(const T& a, const Traits& tr = Traits())
-    : idx(1), ivl(a), p_(), sseq(), s_lower(CGAL::ZERO),
-      s_upper(CGAL::ZERO), multiplicity_(0), tr_(tr), refined_(false)  {}
-  //-------
-  Sturm_root_rep(const Interval& ivl,
-		 const Polynomial& p,
-		 const Standard_sequence& sseq, int idx,
-		 const Traits& tr)
-    : idx(idx), ivl(ivl), p_(p), sseq(sseq),
-      s_lower(CGAL::ZERO), s_upper(CGAL::ZERO), multiplicity_(0),
-      tr_(tr), refined_(false) {
-    //++sturm_created__;
-    Sign_at_functor sign_at_p(this);
-    s_lower = apply(sign_at_p, ivl.lower_bound());
-    s_upper = apply(sign_at_p, ivl.upper_bound());
-
-    //      s_lower = sign_at( *this, Interval::LOWER );
-    //      s_upper = sign_at( *this, Interval::UPPER );
-  }
-  //-------
-  Sturm_root_rep(const Self& other)
-    : idx(other.idx), ivl(), p_(other.p_), sseq(other.sseq),
-      s_lower(other.s_lower),   s_upper(other.s_upper),
-      multiplicity_(other.multiplicity_), tr_(other.tr_), refined_(other.refined_){
-    if ( other.idx >= 1 ) {
-      ivl = other.ivl;
-    }
-  }
-
-  //=======================
-  // ASSIGNMENT OPERATOR
-  //=======================
-  const Self& operator=(const Self& other) {
-    if ( &other == this ) { return *this; }
-    idx = other.idx;
-    p_ = other.p_;
-    sseq = other.sseq;
-    s_lower = other.s_lower;
-    s_upper = other.s_upper;
-    multiplicity_ = other.multiplicity_;
-    tr_ = other.tr_;
-
-    if ( idx >= 1 ) {
-      ivl = other.ivl;
-    }
-    return *this;
-  }
-
-  //=========================
-  // COMPARISON OPERATORS
-  //=========================
-  bool operator!=(const Self& r) const
-  {
-    return compare(r) != CGAL::EQUAL;
-  }
-
-  bool operator==(const Self& r) const
-  {
-    return compare(r) == CGAL::EQUAL;
-  }
-
-  bool operator<=(const Self& r) const
-  {
-    return compare(r) != CGAL::LARGER;
-  }
-
-  bool operator>=(const Self& r) const
-  {
-    return compare(r) != CGAL::SMALLER;
-  }
-
-  bool operator>(const Self& r) const
-  {
-    return compare(r) == CGAL::LARGER;
-  }
-
-  bool operator<(const Self& r) const
-  {
-    return compare(r) == CGAL::SMALLER;
-  }
-
-  Self operator-() const
-  {
-    if ( idx == -1 ) {
-      return Self(-2, 0, tr_);
-    }
-    else if ( idx == -2 ) {
-      return Self(-1,0, tr_);
-    }
-    else if (idx == 1) {
-      // HACK by Daniel
-      return Self(-ivl, tr_);
-    }
-    else {
-
-      Interval m_ivl = -ivl;
-      Polynomial m_p = tr_.negate_variable_object()(p_);
-      Standard_sequence m_sseq= tr_.standard_sequence_object(m_p);
-
-      Self m_root(m_ivl, m_p, m_sseq, idx, tr_);
-
-      m_root.multiplicity_ = multiplicity_;
-
-      return m_root;
-    }
-  }
-
-  //===========================
-  // THE MULTIPLICITY METHOD
-  //===========================
-  unsigned int multiplicity() const
-  {
-    if ( idx < 0 ) { return 0; }
-    if ( multiplicity_ == 0 ) {
-      compute_multiplicity();
-    }last_zero_=false;
-    if (multiplicity_%2==0) return multiplicity_/2;
-    else return multiplicity_;
-  }
-
-  //====================
-  // THE PARITY METHOD
-  //====================
-  bool is_even_multiplicity() const
-  {
-    return false;
-    /*if ( idx < 0 ) { return false; }
-
-    if ( is_exact() ) {
-      return (multiplicity() % 2 == 0);
-    }
-    else {
-      Sign_at_functor sign_at_f(this);
-
-      Sign sl = apply(sign_at_f, ivl.lower_bound());
-      Sign su = apply(sign_at_f, ivl.upper_bound());
-      return (sl == su);
-      }*/
-  }
-
-  //==========================
-  // ACCESS TO THE INTERVAL
-  //==========================
-  typename Interval::NT lower_bound() const { 
-    CGAL_precondition(idx >= 0);
-    return ivl.lower_bound(); }
-  typename Interval::NT upper_bound() const { 
-    CGAL_precondition(idx >= 0);
-    return ivl.upper_bound(); }
-  Interval    interval()    const { return ivl; }
-  int         index()       const { return idx; }
-  const Polynomial&     polynomial() const { return p_; }
-  //    Polynomial  simple_polynomial() const { return p; }
-
-public:
-  //======================
-  // CONVERTOR TO double
-  //======================
-  double compute_double(double acc = 1e-10) const
-  {
-    if (idx < 0) {
-      double inf=std::numeric_limits<double>::has_infinity? std::numeric_limits<double>::infinity() : (std::numeric_limits<double>::max)();
-      if ( idx == -1 ){
-	return inf;
-      } else return -inf;
-    }
-    /*if ( idx == -2 ) {
-      return -DBL_MAX * DBL_MAX;
-      }*/
-
-    if ( is_exact() ) {
-      return CGAL_POLYNOMIAL_TO_DOUBLE(lower_bound());
-    }
-
-    Exact_nt xacc(acc);
-
-
-    while ( ivl.approximate_width() > acc ) {
-      subdivide();
-      /*if (!refined_) {
-	++sturm_refined__;
-	refined_=true;
-	std::cout << "Refining " << *this << " to compute double " << std::endl;
-	}*/
-      if ( is_exact() ) { break; }
-    }
-
-    return CGAL_POLYNOMIAL_TO_DOUBLE( lower_bound() );
-  }
-
-  const std::pair<NT, NT>& isolating_interval() const {
-    CGAL_precondition(idx >=0);
-    return ivl.to_pair();
-  }
-
-  //========================
-  // CONVERTOR TO interval
-  //========================
-  std::pair<double,double> compute_interval() const
-  {
-    if (*this == infinity()){ 
-      return std::make_pair(std::numeric_limits<double>::infinity(),
-			    std::numeric_limits<double>::infinity());
-    }
-    else if (*this == -infinity()) {
-      return std::make_pair(-std::numeric_limits<double>::infinity(),
-			    -std::numeric_limits<double>::infinity());
-    } else {
-      compute_double();
-	    
-      std::pair<double,double> i_low =
-	CGAL_POLYNOMIAL_TO_INTERVAL(ivl.lower_bound());
-      std::pair<double,double> i_high =
-	CGAL_POLYNOMIAL_TO_INTERVAL(ivl.upper_bound());
-	    
-      return std::pair<double,double>(i_low.first, i_high.second);
-    }
-  }
-
-  //================
-  // STREAM WRITER
-  //================
-  template<class Stream>
-  Stream& write(Stream& os) const
-  {
-    if ( idx == -2 ) {
-      os << "-inf";
-    }
-    else if ( idx == -1 ) {
-      os << "inf";
-    }
-    else {
-      os << "{" << ivl << ", " << idx << "}";
-    }
-    if (idx != -2 && idx != -1) {
-      Self copy = *this;
-      os << " = " << copy.compute_double();
-    }
-    return os;
-  }
-
-protected:
-  bool is_up_;
-  int  
-  int                    idx;
-  mutable Interval       ivl;
-  Polynomial             p_;
-  Standard_sequence      sseq;
-  mutable Sign           s_lower, s_upper;
-  mutable unsigned int   multiplicity_;
-  Traits                 tr_;
-  mutable bool refined_;
-};
-
-template<class Stream, class S, class I>
-Stream&
-operator<<(Stream& os, const Sturm_root_rep<S,I>& r)
-{
-  return r.write(os);
-}
-
-/*template<class S, class I>
-  std::pair<double,double>
-  to_interval(const Sturm_root_rep<S,I>& r)
-  {
-  return r.compute_interval();
-  }*/
-
-} } } //namespace CGAL::POLYNOMIAL::internal
-
-namespace CGAL {
-
-/*template<class S, class I>
-  double
-  to_double(const CGAL_POLYNOMIAL_NS::internal::Sturm_root_rep<S,I>& r)
-  {
-  return r.compute_double();
-  }
-
-
-  template<class S, class I>
-  std::pair<double,double>
-  to_interval(const CGAL_POLYNOMIAL_NS::internal::Sturm_root_rep<S,I>& r)
-  {
-  return r.compute_interval();
-  }*/
-
-
-template <class T, class I>
-class Real_embeddable_traits< CGAL::POLYNOMIAL::internal::Sturm_root_rep<T,I> > 
-  : public INTERN_RET::Real_embeddable_traits_base< CGAL::POLYNOMIAL::internal::Sturm_root_rep<T,I> , Tag_true > {
-public:
-  typedef CGAL::POLYNOMIAL::internal::Sturm_root_rep<T,I>  Type;
-  class Abs 
-    : public std::unary_function< Type, Type > {
-  public:
-    Type operator()( const Type& x ) const {
-      if (x < Type(0)) return -x;
-      else return x;
-    }
-  };
-    
-  class Sgn 
-    : public std::unary_function< Type, ::CGAL::Sign > {
-  public:
-    ::CGAL::Sign operator()( const Type& x ) const {
-      return static_cast<CGAL::Sign>(x.compare(0));
-    }        
-  };
-    
-  class Compare 
-    : public std::binary_function< Type, Type,
-			      Comparison_result > {
-  public:
-    Comparison_result operator()( const Type& x, 
-				  const Type& y ) const {
-      return x.compare(y);
-    }
-        
-    CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT( Type,
-							 Comparison_result )
-        
-      };
-    
-  class To_double 
-    : public std::unary_function< Type, double > {
-  public:
-    double operator()( const Type& x ) const {
-      // this call is required to get reasonable values for the double
-      // approximation
-      return x.compute_double();
-    }
-  };
-    
-  class To_interval 
-    : public std::unary_function< Type, std::pair< double, double > > {
-  public:
-    std::pair<double, double> operator()( const Type& x ) const {
-
-      return x.compute_interval();
-    }          
-  };
-};
-
-
-} //namespace CGAL
-
-namespace std
-{
-  template <class S, class I>
-  class numeric_limits<CGAL_POLYNOMIAL_NS::internal::Sturm_root_rep<S,I> >:
-    public numeric_limits<typename CGAL_POLYNOMIAL_NS::internal::Sturm_root_rep<S,I>::NT >
-  {
-  public:
-    typedef numeric_limits<typename CGAL_POLYNOMIAL_NS::internal::Sturm_root_rep<S,I>::NT > P;
-    typedef CGAL_POLYNOMIAL_NS::internal::Sturm_root_rep<S,I> T;
-    static const bool is_specialized = true;
-    static T min BOOST_PREVENT_MACRO_SUBSTITUTION () throw() {return T((P::min)());}
-    static T max BOOST_PREVENT_MACRO_SUBSTITUTION () throw() {return T((P::max)());}
-    /*static const int digits =0;
-      static const int digits10 =0;
-      static const bool is_signed = true;
-      static const bool is_integer = false;
-      static const bool is_exact = true;
-      static const int radix =0;
-      static T epsilon() throw(){return T(0);}
-      static T round_error() throw(){return T(0);}
-      static const int min_exponent=0;
-      static const int min_exponent10=0;
-      static const int max_exponent=0;
-      static const int max_exponent10=0;*/
-    static const bool has_infinity=true;
-    /*static const bool has_quiet_NaN = false;
-      static const bool has_signaling_NaN= false;
-      static const float_denorm_style has_denorm= denorm_absent;
-      static const bool has_denorm_loss = false;
-    */
-    static T infinity() throw() {return T::infinity();}
-    /*static T quiet_NaN() throw(){return T(0);}
-      static T denorm_min() throw() {return T(0);}
-      static const bool is_iec559=false;
-      static const bool is_bounded =false;
-      static const bool is_modulo= false;
-      static const bool traps = false;
-      static const bool tinyness_before =false;
-      static const float_round_style round_stype = round_toward_zero;*/
-  };
-};
-#endif                                            // CGAL_POLYNOMIAL_STURM_ROOT_REP_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Turkowski_numeric_solvers_impl.h b/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Turkowski_numeric_solvers_impl.h
deleted file mode 100644
index bac3c74..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Turkowski_numeric_solvers_impl.h
+++ /dev/null
@@ -1,467 +0,0 @@
-// Copyright (c) 2005  Stanford University (USA).
-// 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(s)     : Daniel Russel <drussel at alumni.princeton.edu>
-
-#ifdef CGAL_HEADER_ONLY
-#define CGAL_INLINE_FUNCTION inline
-#else
-#define CGAL_INLINE_FUNCTION
-#endif
-
-#include <CGAL/Polynomial/internal/numeric_solvers_support.h>
-#include <CGAL/Polynomial/internal/numeric_solvers.h>
-
-/*#ifdef _MSC_VER
-#pragma warning(disable:1572)
-#endif*/
-
-
-//#include "numeric_solvers_support.C"
-
-// Taken from http://www.worldserver.com/turk/opensource/
-
-/* Copyright (C) 1978-1999 Ken Turkowski. <turk_at_computer.org>
- *
- * All rights reserved.
- *
- * Warranty Information
- *  Even though I have reviewed this software, I make no warranty
- *  or representation, either express or implied, with respect to this
- *  software, its quality, accuracy, merchantability, or fitness for a
- *  particular purpose.  As a result, this software is provided "as is,"
- *  and you, its user, are assuming the entire risk as to its quality
- *  and accuracy.
- *
- * This code may be used and freely distributed as long as it includes
- * this copyright notice and the above warranty information.
- */
-
-#include <cmath>
-#include <iomanip>
-
-namespace CGAL { namespace POLYNOMIAL { namespace internal {
-
-# define FLOAT double
-
-static const unsigned int MAXN= 55;
-//# define PARAMFLOAT double_t
-
-/*******************************************************************************
- * FindCubicRoots
- *
- *	Solve:
- *		coeff[3] * x^3 + coeff[2] * x^2 + coeff[1] * x + coeff[0] = 0
- *
- *	returns:
- *		3 - 3 real roots
- *		1 - 1 real root (2 complex conjugate)
- *******************************************************************************/
-
-static long
-FindCubicRoots(const FLOAT coeff[4], FLOAT x[3])
-{
-  FLOAT a1 = coeff[2] / coeff[3];
-  FLOAT a2 = coeff[1] / coeff[3];
-  FLOAT a3 = coeff[0] / coeff[3];
-
-  double Q = (a1 * a1 - 3 * a2) / 9;
-  double R = (2 * a1 * a1 * a1 - 9 * a1 * a2 + 27 * a3) / 54;
-  double Qcubed = Q * Q * Q;
-  double d = Qcubed - R * R;
-
-  /* Three real roots */
-  if (d >= 0) {
-    double theta = std::acos(R / std::sqrt(Qcubed));
-    double sqrtQ = std::sqrt(Q);
-    x[0] = -2 * sqrtQ * std::cos( theta           / 3) - a1 / 3;
-    x[1] = -2 * sqrtQ * std::cos((theta + 2 * CGAL_PI) / 3) - a1 / 3;
-    x[2] = -2 * sqrtQ * std::cos((theta + 4 * CGAL_PI) / 3) - a1 / 3;
-    return (3);
-  }
-
-  /* One real root */
-  else {
-    double e = std::pow(std::sqrt(-d) + ::CGAL::abs(R), 1. / 3.);
-    if (R > 0)
-      e = -e;
-    x[0] = (e + Q / e) - a1 / 3.;
-    return (1);
-  }
-}
-
-
-/*******************************************************************************
- * FindPolynomialRoots
- *
- * The Bairstow and Newton correction formulae are used for a simultaneous
- * linear and quadratic iterated synthetic division.  The coefficients of
- * a polynomial of degree n are given as a[i] (i=0,i,..., n) where a[0] is
- * the constant term.  The coefficients are scaled by dividing them by
- * their geometric mean.  The Bairstow or Newton iteration method will
- * nearly always converge to the number of figures carried, fig, either to
- * root values or to their reciprocals.  If the simultaneous Newton and
- * Bairstow iteration fails to converge on root values or their
- * reciprocals in maxiter iterations, the convergence requirement will be
- * successively reduced by one decimal figure.  This program anticipates
- * and protects against loss of significance in the quadratic synthetic
- * division.  (Refer to "On Programming the Numerical Solution of
- * Polynomial Equations," by K. W. Ellenberger, Commun. ACM 3 (Dec. 1960),
- * 644-647.)  The real and imaginary part of each root is stated as u[i]
- * and v[i], respectively, together with the corresponding constant,
- * conv[i], used in the convergence test.  This program has been used
- * successfully for over a year on the Bendix G15-D (Intercard System) and
- * has recently been coded for the IBM 709 (Fortran system).
- *
- * ACM algorithm #30 - Numerical Solution of the Polynomial Equation
- * K. W. Ellenberger
- * Missle Division, North American Aviation, Downey, California
- * Converted to C, modified, optimized, and structured by
- * Ken Turkowski
- * CADLINC, Inc., Palo Alto, California
- *******************************************************************************/
-
-static void
-FindPolynomialRoots(
-		    const FLOAT     *a,                               /* Coefficients */
-		    FLOAT           *u,                               /* Real component of each root */
-		    FLOAT           *v,                               /* Imaginary component of each root */
-		    FLOAT           *conv,                            /* Convergence constant associated with each root */
-		    long            n,                                /* Degree of polynomial (order-1) */
-		    long            maxiter,                          /* Maximum number of iterations */
-		    long            fig                               /* The number of decimal figures to be computed */
-		    )
-{
-  int number_of_ITERATE=0;
-  int number_of_INIT=0;
-  CGAL_precondition(static_cast<unsigned int>(fig) < MAXN);
-  int i;
-  int j;
-  FLOAT h[MAXN + 3], b[MAXN + 3], c[MAXN + 3], d[MAXN + 3], e[MAXN + 3];
-  /* [-2 : n] */
-  FLOAT K, ps, qs, pt, qt, s, rev, r= std::numeric_limits<double>::infinity();
-  int t;
-  FLOAT p=std::numeric_limits<double>::infinity(), q=std::numeric_limits<double>::infinity();
-
-  /* Zero elements with negative indices */
-  b[2 + -1] = b[2 + -2] =
-    c[2 + -1] = c[2 + -2] =
-    d[2 + -1] = d[2 + -2] =
-    e[2 + -1] = e[2 + -2] =
-    h[2 + -1] = h[2 + -2] = 0.0;
-
-  /* Copy polynomial coefficients to working storage */
-  for (j = n; j >= 0; j--)
-    h[2 + j] = *a++;                          /* Note reversal of coefficients */
-
-  t = 1;
-  K = std::pow(10.0, (double)(fig));            /* Relative accuracy */
-
-  for (; h[2 + n] == 0.0; n--) {                /* Look for zero high-order coeff. */
-    *u++ = 0.0;
-    *v++ = 0.0;
-    *conv++ = K;
-  }
-
- INIT:
-  ++number_of_INIT;
-  if (number_of_INIT > 1000) {
-    std::cerr << "Too many INITs" << std::flush;
-    return;
-  }
-
-  if (n == 0)
-    return;
-
-  ps = qs = pt = qt = s = 0.0;
-  rev = 1.0;
-  K = std::pow(10.0, (double)(fig));
-
-  if (n == 1) {
-    r = -h[2 + 1] / h[2 + 0];
-    goto LINEAR;
-  }
-
-  for (j = n; j >= 0; j--)                      /* Find geometric mean of coeff's */
-    if (h[2 + j] != 0.0)
-      s += std::log( ::CGAL::abs(h[2 + j]));
-  s = std::exp(s / (n + 1));
-
-  for (j = n; j >= 0; j--)                      /* Normalize coeff's by mean */
-    h[2 + j] /= s;
-
-  if ( ::CGAL::abs(h[2 + 1] / h[2 + 0]) < ::CGAL::abs(h[2 + n - 1] / h[2 + n])) {
-  REVERSE:
-    t = -t;
-    for (j = (n - 1) / 2; j >= 0; j--) {
-      s = h[2 + j];
-      h[2 + j] = h[2 + n - j];
-      h[2 + n - j] = s;
-    }
-  }
-  if (qs != 0.0) {
-    p = ps;
-    q = qs;
-  }
-  else {
-    if (h[2 + n - 2] == 0.0) {
-      q = 1.0;
-      p = -2.0;
-    }
-    else {
-      q = h[2 + n] / h[2 + n - 2];
-      p = (h[2 + n - 1] - q * h[2 + n - 3]) / h[2 + n - 2];
-    }
-    if (n == 2)
-      goto QADRTIC;
-    r = 0.0;
-  }
- ITERATE:
-  ++number_of_ITERATE;
-  if (number_of_ITERATE > 1000) {
-    std::cerr << "Too many ITERATEs" << std::flush;
-    return;
-  }
-  for (i = maxiter; i > 0; i--) {
-
-    for (j = 0; j <= n; j++) {                /* BAIRSTOW */
-      b[2 + j] = h[2 + j] - p * b[2 + j - 1] - q * b[2 + j - 2];
-      c[2 + j] = b[2 + j] - p * c[2 + j - 1] - q * c[2 + j - 2];
-    }
-    if ((h[2 + n - 1] != 0.0) && (b[2 + n - 1] != 0.0)) {
-      if ( ::CGAL::abs(h[2 + n - 1] / b[2 + n - 1]) >= K) {
-	b[2 + n] = h[2 + n] - q * b[2 + n - 2];
-      }
-      if (b[2 + n] == 0.0)
-	goto QADRTIC;
-      if (K < ::CGAL::abs(h[2 + n] / b[2 + n]))
-	goto QADRTIC;
-    }
-
-    for (j = 0; j <= n; j++) {                /* NEWTON */
-      /* Calculate polynomial at r */
-      d[2 + j] = h[2 + j] + r * d[2 + j - 1];
-      /* Calculate derivative at r */
-      e[2 + j] = d[2 + j] + r * e[2 + j - 1];
-    }
-    if (d[2 + n] == 0.0)
-      goto LINEAR;
-    if (K < ::CGAL::abs(h[2 + n] / d[2 + n]))
-      goto LINEAR;
-
-    c[2 + n - 1] = -p * c[2 + n - 2] - q * c[2 + n - 3];
-    s = c[2 + n - 2] * c[2 + n - 2] - c[2 + n - 1] * c[2 + n - 3];
-    if (s == 0.0) {
-      p -= 2.0;
-      q *= (q + 1.0);
-    }
-    else {
-      p += (b[2 + n - 1] * c[2 + n - 2] - b[2 + n] * c[2 + n - 3]) / s;
-      q += (-b[2 + n - 1] * c[2 + n - 1] + b[2 + n] * c[2 + n - 2]) / s;
-    }
-    if (e[2 + n - 1] == 0.0)
-      r -= 1.0;                             /* Minimum step */
-    else
-      r -= d[2 + n] / e[2 + n - 1];         /* Newton's iteration */
-  }
-  ps = pt;
-  qs = qt;
-  pt = p;
-  qt = q;
-  if (rev < 0.0)
-    K /= 10.0;
-  rev = -rev;
-  goto REVERSE;
-
- LINEAR:
-  if (t < 0)
-    r = 1.0 / r;
-  n--;
-  *u++ = r;
-  *v++ = 0.0;
-  *conv++ = K;
-
-  for (j = n; j >= 0; j--) {                    /* Polynomial deflation by lin-nomial */
-    if ((d[2 + j] != 0.0) && ( ::CGAL::abs(h[2 + j] / d[2 + j]) < K))
-      h[2 + j] = d[2 + j];
-    else
-      h[2 + j] = 0.0;
-  }
-
-  if (n == 0)
-    return;
-  goto ITERATE;
-
- QADRTIC:
-  if (t < 0) {
-    p /= q;
-    q = 1.0 / q;
-  }
-  n -= 2;
-
-  if (0.0 < (q - (p * p / 4.0))) {              /* Two complex roots */
-    *(u + 1) = *u = -p / 2.0;
-    u += 2;
-    s = sqrt(q - (p * p / 4.0));
-    *v++ = s;
-    *v++ = -s;
-  }                                             /* Two real roots */
-  else {
-    s = std::sqrt(((p * p / 4.0)) - q);
-    if (p < 0.0)
-      *u++ = -p / 2.0 + s;
-    else
-      *u++ = -p / 2.0 - s;
-    *u = q / u[-1];
-    ++u;                                      // moved from lhs of before
-    *v++ = 0.0;
-    *v++ = 0.0;
-  }
-  *conv++ = K;
-  *conv++ = K;
-
-  for (j = n; j >= 0; j--) {                    /* Polynomial deflation by quadratic */
-    if ((b[2 + j] != 0.0) && ( ::CGAL::abs(h[2 + j] / b[2 + j]) < K))
-      h[2 + j] = b[2 + j];
-    else
-      h[2 + j] = 0.0;
-  }
-  goto INIT;
-}
-
-
-#undef MAXN
-
-template <bool CLEAN>
-static void Turkowski_polynomial_compute_roots_t(const double *begin, 
-						 const double *end,
-						 double lb, double ub,
-						 std::vector<double> &roots)
-{
-  std::size_t numc= end-begin;
-  double rp[MAXN];
-  double cp[MAXN];
-  double cc[MAXN];
-
-  /*for (unsigned int i=0; i< numc; ++i){
-    rp[i]= std::numeric_limits<double>::infinity();
-    }*/
-
-  for (unsigned int i=0; i< MAXN; ++i){
-    cc[i]=std::numeric_limits<double>::infinity();
-    rp[i]=std::numeric_limits<double>::infinity();
-    cc[i]=std::numeric_limits<double>::infinity();
-  }
-
-  FindPolynomialRoots(begin, rp, cp, cc, static_cast<long>(numc)-1, 10*static_cast<long>(numc), 40);
-
-  /*if (CLEAN) {
-    lb-= .000005;
-    }*/
-  double last= -std::numeric_limits<double>::infinity();
-  for (std::size_t i=0; i< numc-1; ++i) {
-    /* std::cout << "Trying " <<  rp[i] << "+" << std::setprecision(10) <<  cp[i] << "i "
-       << cc[i] << "\n";*/
-    if (cc[i] > 10000 && root_is_good(rp[i], cp[i], lb, ub)) {
-      roots.push_back(rp[i]);
-      /*std::cout << "Good was " <<  rp[i] << "+" <<std::setprecision(10) <<  cp[i] << "i "
-	<< cc[i] << "\n";*/
-    } else if (CLEAN && root_is_good(rp[i], cp[i], last, ub) && last < rp[i] && rp[i] <= lb) {
-      last= rp[i];
-    }
-    /*else {
-      std::cout << "Rejected " << rp[i] << "+" << cp[i] << "i\n";
-      }*/
-  }
-  std::sort(roots.begin(), roots.end(), std::greater<double>());
-  
-  if (CLEAN) filter_solver_roots(begin, end, lb, ub, last, roots);
-}
-
-CGAL_INLINE_FUNCTION
-void Turkowski_polynomial_compute_roots(const double *begin, const double *end, 
-					double lb, double ub, 
-					std::vector<double> &roots)
-{
-
-  std::ptrdiff_t degree= end-begin-1;
-  switch( degree) {
-  case -1:
-  case 0:
-    break;
-  case 1:
-    compute_linear_roots(begin,end, lb, ub, roots);
-    break;
-  case 2:
-    compute_quadratic_roots(begin, end, lb, ub, roots);
-    break;
-  case 3:
-    {
-      double rd[3];
-      int numr= FindCubicRoots(begin, rd);
-      for (int i=numr-1; i>=0; --i) {
-	if (rd[i] >= lb && rd[i] < ub) roots.push_back(rd[i]);
-      }
-      std::sort(roots.begin(), roots.end(), std::greater<double>());
-      break;
-    }
-  default:
-    Turkowski_polynomial_compute_roots_t<false>(begin, end, lb, ub, roots);
-
-  }
-
-}
-
-CGAL_INLINE_FUNCTION
-void Turkowski_polynomial_compute_cleaned_roots(const double *begin, const double *end, 
-						double lb, double ub,
-						std::vector<double> &roots)
-{
-  std::ptrdiff_t degree= end-begin-1;
-  switch( degree) {
-  case -1:
-  case 0:
-    break;
-  case 1:
-    compute_linear_cleaned_roots(begin,end, lb, ub, roots);
-    break;
-  case 2:
-    compute_quadratic_cleaned_roots(begin, end, lb, ub, roots);
-    break;
-  case 3:
-    {
-      double rd[3];
-      int numr= FindCubicRoots(begin, rd);
-      double last=-std::numeric_limits<double>::infinity();
-      for (int i=numr-1; i>=0; --i) {
-	if (rd[i]< ub && rd[i] >= lb) roots.push_back(rd[i]);
-	if (rd[i] < lb && rd[i] > last){
-	  last=rd[i];
-	}
-      }
-      std::sort(roots.begin(), roots.end(), std::greater<double>());
-      filter_solver_roots(begin, end, lb, ub, last, roots);
-      break;
-    }
-  default:
-    Turkowski_polynomial_compute_roots_t<true>(begin, end, lb, ub, roots);
-  }
-}
-
-
-} } } //namespace CGAL::POLYNOMIAL::internal
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/macros.h b/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/macros.h
deleted file mode 100644
index 8cb7c18..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/macros.h
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright (c) 2005  Stanford University (USA).
-// 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(s)     : Daniel Russel <drussel at alumni.princeton.edu>
-
-#ifndef CGAL_POLYNOMIAL_INTERNAL_MACROS_H
-#define CGAL_POLYNOMIAL_INTERNAL_MACROS_H
-
-#include <CGAL/Polynomial/internal/config.h>
-
-#ifdef CGAL_POLYNOMIAL_USE_CGAL
-/*
-  When CGAL is present
-*/
-#include <CGAL/basic.h>
-
-#define CGAL_POLYNOMIAL_NS CGAL::POLYNOMIAL
-#define CGAL_Polynomial_assertion(x) CGAL_assertion(x)
-#define CGAL_Polynomial_assertion_code(x) CGAL_assertion_code(x)
-#define CGAL_Polynomial_precondition(x) CGAL_precondition(x)
-#define CGAL_Polynomial_precondition_code(x) CGAL_precondition_code(x)
-#define CGAL_Polynomial_postcondition(x) CGAL_postcondition(x)
-#ifdef CGAL_POLYNOMIAL_CHECK_EXPENSIVE
-#define CGAL_Polynomial_expensive_precondition(x) CGAL_expensive_precondition(x)
-#define CGAL_Polynomial_expensive_assertion(x) CGAL_expensive_assertion(x)
-#define CGAL_Polynomial_expensive_postcondition(x) CGAL_expensive_postcondition(x)
-#else
-#define CGAL_Polynomial_expensive_precondition(x)
-#define CGAL_Polynomial_expensive_assertion(x)
-#define CGAL_Polynomial_expensive_postcondition(x)
-#endif
-#define CGAL_Polynomial_exactness_assertion(x) CGAL_exactness_assertion(x)
-#define CGAL_Polynomial_exactness_postcondition(x) CGAL_exactness_postcondition(x)
-#define CGAL_Polynomial_exactness_precondition(x) CGAL_exactness_precondition(x)
-
-#else
-/*
-  When no CGAL is present
-*/
-
-#define POLYNOMIAL_NS Polynomial
-
-#include <cassert>
-
-#define CGAL_Polynomial_assertion(x) assert(x)
-// This does not work
-#define CGAL_Polynomial_assertion_code(x) x
-#define CGAL_Polynomial_precondition(x) assert(x)
-#define CGAL_Polynomial_postcondition(x) assert(x)
-#define CGAL_Polynomial_expensive_precondition(x)
-#define CGAL_Polynomial_expensive_assertion(x)
-#define CGAL_Polynomial_expensive_postcondition(x)
-#define CGAL_Polynomial_exactness_postcondition(x)
-#define CGAL_Polynomial_exactness_precondition(x)
-#endif
-
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polytope_distance_d.h b/3rdparty/CGAL-4.8/include/CGAL/Polytope_distance_d.h
deleted file mode 100644
index 70d6979..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Polytope_distance_d.h
+++ /dev/null
@@ -1,933 +0,0 @@
-// Copyright (c) 1997-2001  ETH Zurich (Switzerland).
-// 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
-// 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(s)     : Sven Schoenherr <sven at inf.ethz.ch>
-
-#ifndef CGAL_POLYTOPE_DISTANCE_D_H
-#define CGAL_POLYTOPE_DISTANCE_D_H
-
-// includes
-// --------
-#include <CGAL/Optimisation/basic.h>
-#include <CGAL/function_objects.h>
-#include <boost/functional.hpp>
-
-#include <CGAL/QP_options.h>
-#include <CGAL/QP_solver/QP_solver.h>
-#include <CGAL/QP_models.h>
-#include <CGAL/QP_solver/functors.h>
-#include <CGAL/QP_solver/QP_full_filtered_pricing.h>
-#include <CGAL/QP_solver/QP_full_exact_pricing.h>
-
-namespace CGAL {
-
-// To determine the polytope distance, we set up the following QP:
-// 
-// We let v-w be nonnegative vectors such that
-// v-w = p-q, where p and q are the points that realize the
-// optimal distance. That way, we obtain a nonnegative QP
-// 
-//
-//min (v-w)^T(w-v)
-//     v-w - \sum x_i p_i + \sum y_j q_j    = 0
-//           \sum x_i                       = 1
-//                           \sum y_j       = 1
-//     v, w, x, y >= 0
-
-namespace PD_detail {
-  // The functors necessary to realize access to A
-  // 
-  // A has the form
-  //    I  -I    -P    Q
-  //    0   0     1    0
-  //    0   0     0    1
-  // where  I and -I are blocks of size d*d, and the 0's and 1's are
-  // rows vectors of 0's and 1's 
-  //
-  // we have one functor for a fixed column, and one functor for the
-  // whole matrix
-
-  // functor for a fixed column of A
-  template <class NT, class Iterator>
-  class A_column : public std::unary_function <int, NT>
-  {
-  public:
-    typedef NT result_type;
-    A_column()
-    {}
-  
-    A_column (int j, int d, bool in_p, Iterator it)
-      : j_ (j), d_ (d), in_p_ (in_p), it_ (it), nt_0_ (0), nt_1_ (1)
-    {}
-
-    result_type operator() (int i) const
-    {
-      if (j_ < d_) {
-	// column for v
-	return (i == j_ ? nt_1_ : nt_0_);
-      }
-      if (j_ < 2*d_) {
-	// column for w
-	return (i == j_-d_ ? -nt_1_ : nt_0_);
-      }
-      // point column
-      if (in_p_) {
-	// column for P
-	if (i < d_) return -(*(it_ + i));
-	if (i == d_) return *(it_ + d_); // homogenizing coordinate
-	return nt_0_;
-      } else {
-	// column for Q
-	if (i < d_) return (*(it_ + i));
-	if (i == d_+1) return *(it_ + d_); // homogenizing coordinate
-	return nt_0_;
-      }
-      // never get here
-    }
-    
-  private:
-    int j_;                  // column number
-    int d_;                  // dimension
-    bool in_p_;              // point in P ?
-    Iterator it_;            // the iterator through the column's point
-    NT nt_0_;
-    NT nt_1_; 
-  };
-  
-  // functor for matrix A
-  template <class NT, class Access_coordinate_begin_d,
-	    class Point_iterator >
-  class A_matrix : public std::unary_function
-  <int, boost::transform_iterator <A_column
-    <NT, typename Access_coordinate_begin_d::Coordinate_iterator>, 
-				   boost::counting_iterator<int> > >
-  { 
-    typedef PD_detail::A_column
-    <NT, typename Access_coordinate_begin_d::Coordinate_iterator> A_column;
-  public:
-    typedef  boost::transform_iterator
-    <A_column, boost::counting_iterator<int> > result_type;
-    
-    A_matrix ()
-    {}
-
-    A_matrix (int d, 
-	      Access_coordinate_begin_d da_coord,
-	      Point_iterator P, 
-	      int r, 
-	      Point_iterator Q) 
-      : d_ (d), da_coord_ (da_coord), P_ (P), r_ (r), Q_ (Q)
-    {}
-
-    result_type operator () (int j) const
-    { 
-      if (j < 2*d_) {
-	// column of v or w
-	return result_type
-	  (0, A_column (j, d_, false  /*dummy*/, 
-			da_coord_ (*P_) /*dummy*/));
-      }
-      if (j < 2*d_+r_) {
-	// column of P
-	return result_type
-	  (0, A_column (j , d_, true, da_coord_ (*(P_+(j-2*d_)))));
-      }
-      // column of Q
-      return result_type
-	(0, A_column (j, d_, false, da_coord_ (*(Q_+(j-2*d_-r_))))); 
-    }
-
-  private:
-    int d_;                  // dimension
-    Access_coordinate_begin_d da_coord_; // data accessor
-    Point_iterator P_;       // point set P
-    int r_;                  // size of point set P
-    Point_iterator Q_;       // point set Q
-  };
-
-  // The functor necessary to realize access to b
-  // b has the form
-  // 0
-  // 0
-  // 1  (row d)
-  // 1  (row d+1)
-
-  template <class NT>
-  class B_vector : public std::unary_function<int, NT>
-  {
-  public:
-    typedef NT result_type;
-    B_vector()
-    {}
-
-    B_vector (int d)
-      : d_ (d), nt_0_ (0), nt_1_ (1)
-    {}
-
-    result_type operator() (int i) const
-    {
-      return ( (i == d_ || i == d_+1) ? nt_1_ : nt_0_);
-    }
-
-  private:
-    int d_;
-    NT nt_0_;
-    NT nt_1_;
-  };
-
-
-  // The functors necessary to realize access to D
-  // 
-  // D has the form
-  //   I  -I    0
-  //  -I   I    0
-  //   0   0    0
-  // where all I and -I are blocks of size d*d
-  //
-  // we have one functor for a fixed row, and one functor for the
-  // whole matrix
-
-  // functor for a fixed row of D; note that we have to return 2D in
-  // order to please the QP_solver
-  template <class NT> 
-  class D_row : public std::unary_function <int, NT> 
-  {
-  public:
-    typedef NT result_type;
-    D_row () 
-    {}
-    D_row (int i, int d) 
-      : i_ (i), d_ (d), nt_0_ (0), nt_2_ (2)
-    {}
-    
-    result_type operator () (int j) const
-    {
-      if (j < d_) {
-	//  I ( 1 iff i = j)
-	// -I (-1 iff i = j + d)
-	//  0
-	if (i_ == j) return nt_2_;
-	if (i_ == j + d_) return -nt_2_;
-	return nt_0_;
-      }
-      if (j < 2*d_) {
-	// -I (-1 iff i = j - d)
-	//  I ( 1 iff i = j)
-	//  0
-	if (i_ == j - d_) return -nt_2_;
-	if (i_ == j) return nt_2_;
-	return nt_0_;
-      }
-      // 0
-      // 0
-      // 0
-      return nt_0_;
-    }
-  private:
-    int i_; // row number
-    int d_; // dimension
-    NT nt_0_;
-    NT nt_2_;
-  };
-
-  // functor for matrix D
-  template <class NT>
-  class D_matrix : public std::unary_function
-  <int, boost::transform_iterator<D_row<NT>,
-				  boost::counting_iterator<int> > >
-  { 
-  public:
-    typedef boost::transform_iterator<D_row<NT>,
-	    boost::counting_iterator<int> > result_type; 
-    D_matrix ()
-    {}
-    D_matrix (int d)
-      :  d_ (d)
-    {}
-
-    result_type operator()(int i) const 
-    {
-      return result_type (0, D_row<NT>(i, d_));
-    }
-
-  private:
-    int d_; // dimension
-  };
-}
-
-// Class interfaces
-// ================
-template < class Traits_ >
-class Polytope_distance_d {
-public:
-  // self
-  typedef  Traits_                    Traits;
-  typedef  Polytope_distance_d<Traits>
-  Self;
-
-  // types from the traits class
-  typedef  typename Traits::Point_d   Point;
-
-  typedef  typename Traits::Rep_tag   Rep_tag;
-
-  typedef  typename Traits::RT        RT;
-  typedef  typename Traits::FT        FT;
-
-  typedef  typename Traits::Access_dimension_d
-  Access_dimension_d;
-  typedef  typename Traits::Access_coordinates_begin_d
-  Access_coordinates_begin_d;
-
-  typedef  typename Traits::Construct_point_d
-  Construct_point_d;
-
-  typedef  typename Traits::ET        ET;
-  typedef  typename Traits::NT        NT; 
-
-private:
-  // private types
-  typedef  std::vector<Point>         Point_vector;
-  typedef  std::vector<ET>            ET_vector;
-    
-  typedef  QP_access_by_index
-  <typename std::vector<Point>::const_iterator, int> Point_by_index;
-    
-  typedef  std::vector<NT>            NT_vector;
-  typedef  std::vector<NT_vector>     NT_matrix;
-  
-  typedef  std::vector<int>           Index_vector;
-public:    
-  // public types
-  typedef  typename Point_vector::const_iterator
-  Point_iterator;
-    
-  typedef typename Index_vector::const_iterator IVCI;
-  typedef CGAL::Join_input_iterator_1< IVCI, Point_by_index >
-  Support_point_iterator;
-
-  typedef typename Index_vector::const_iterator
-  Support_point_index_iterator;
-    
-  typedef  typename ET_vector::const_iterator
-  Coordinate_iterator;
-
-private:
-  
-  // QP solver iterator types
-  typedef PD_detail::A_matrix <NT, Access_coordinates_begin_d,
-			       Point_iterator> A_matrix;
-  typedef boost::transform_iterator<
-    A_matrix, boost::counting_iterator<int> > A_iterator;
-
-  typedef PD_detail::B_vector <NT> B_vector;
-  typedef boost::transform_iterator<
-    B_vector, boost::counting_iterator<int> > B_iterator;
-
-  typedef CGAL::Const_oneset_iterator<CGAL::Comparison_result> R_iterator;  
-  typedef CGAL::Const_oneset_iterator<NT> C_iterator; 
-
-  typedef PD_detail::D_matrix <NT> D_matrix;
-  typedef boost::transform_iterator <
-    D_matrix, boost::counting_iterator<int> > D_iterator;
-
-  // Program type
-  typedef CGAL::Nonnegative_quadratic_program_from_iterators
-      <A_iterator, B_iterator, R_iterator, D_iterator, C_iterator> QP;
-
-  // Tags
-  typedef QP_solver_impl::QP_tags <Tag_false, Tag_true> QP_tags;
-
-  // Solver types
-  typedef  CGAL::QP_solver <QP, ET, QP_tags > Solver;
-
-  typedef  typename Solver::Pricing_strategy Pricing_strategy;
-
-public:    
-
-  // creation
-  Polytope_distance_d( const Traits&  traits  = Traits())
-    : nt_0(0), nt_1(1),
-      tco( traits), da_coord (tco.access_coordinates_begin_d_object()),
-      d( -1), solver(0) 
-  {}
-    
-  template < class InputIterator1, class InputIterator2 >
-  Polytope_distance_d( InputIterator1 p_first,
-		       InputIterator1 p_last,
-		       InputIterator2 q_first,
-		       InputIterator2 q_last,
-		       const Traits&  traits = Traits())
-    : nt_0(0), nt_1(1), 
-      tco( traits), da_coord (tco.access_coordinates_begin_d_object()),
-      solver(0)
-  {
-    set( p_first, p_last, q_first, q_last);
-  }
-
-  ~Polytope_distance_d() {    
-    if (solver)
-      delete solver;
-  }
-
-  // access to point sets
-  int  ambient_dimension( ) const { return d; }
-    
-  int  number_of_points( ) const { return static_cast<int>(p_points.size()+q_points.size());}
-    
-  int  number_of_points_p( ) const { return static_cast<int>(p_points.size()); }
-  int  number_of_points_q( ) const { return static_cast<int>(q_points.size()); }
-    
-  Point_iterator  points_p_begin( ) const { return p_points.begin(); }
-  Point_iterator  points_p_end  ( ) const { return p_points.end  (); }
-    
-  Point_iterator  points_q_begin( ) const { return q_points.begin(); }
-  Point_iterator  points_q_end  ( ) const { return q_points.end  (); }
-    
-  // access to support points
-  int
-  number_of_support_points( ) const
-  { return is_finite() ? 
-      static_cast<int>(p_support_indices.size()+q_support_indices.size()) : 0; }
-    
-  int  number_of_support_points_p() const { return static_cast<int>(p_support_indices.size());}
-  int  number_of_support_points_q() const { return static_cast<int>(q_support_indices.size());}
-    
-  Support_point_iterator
-  support_points_p_begin() const
-  { return Support_point_iterator(
-				  p_support_indices.begin(),
-				  Point_by_index( p_points.begin())); }
-    
-  Support_point_iterator
-  support_points_p_end() const
-  { return Support_point_iterator(
-				  is_finite() ? p_support_indices.end()
-				  : p_support_indices.begin(),
-				  Point_by_index( p_points.begin())); }
-    
-  Support_point_iterator
-  support_points_q_begin() const
-  { return Support_point_iterator(
-				  q_support_indices.begin(),
-				  Point_by_index( q_points.begin())); }
-    
-  Support_point_iterator
-  support_points_q_end() const
-  { return Support_point_iterator(
-				  is_finite() ? q_support_indices.end()
-				  : q_support_indices.begin(),
-				  Point_by_index( q_points.begin())); }
-
-  Support_point_index_iterator
-  support_points_p_indices_begin() const
-  { return p_support_indices.begin(); }
-    
-  Support_point_index_iterator
-  support_points_p_indices_end() const
-  { return p_support_indices.end(); }
-
-  Support_point_index_iterator
-  support_points_q_indices_begin() const
-  { return q_support_indices.begin(); }
-
-  Support_point_index_iterator
-  support_points_q_indices_end() const
-  { return q_support_indices.end(); }
-    
-  // access to realizing points (rational representation)
-  Coordinate_iterator
-  realizing_point_p_coordinates_begin( ) const { return p_coords.begin(); }
-    
-  Coordinate_iterator
-  realizing_point_p_coordinates_end  ( ) const { return p_coords.end  (); }
-    
-  Coordinate_iterator
-  realizing_point_q_coordinates_begin( ) const { return q_coords.begin(); }
-    
-  Coordinate_iterator
-  realizing_point_q_coordinates_end  ( ) const { return q_coords.end  (); }
-    
-  // access to squared distance (rational representation)
-  ET  squared_distance_numerator  ( ) const
-  { return solver->solution_numerator(); }
-    
-  ET  squared_distance_denominator( ) const
-  { return solver->solution_denominator(); }
-    
-  // access to realizing points and squared distance
-  // NOTE: an implicit conversion from ET to RT must be available!
-  Point
-  realizing_point_p( ) const
-  { CGAL_optimisation_precondition( is_finite());
-  return tco.construct_point_d_object()
-    ( ambient_dimension(),
-      realizing_point_p_coordinates_begin(),
-      realizing_point_p_coordinates_end  ()); }
-    
-  Point
-  realizing_point_q( ) const
-  { CGAL_optimisation_precondition( is_finite());
-  return tco.construct_point_d_object()
-    ( ambient_dimension(),
-      realizing_point_q_coordinates_begin(),
-      realizing_point_q_coordinates_end  ()); }
-    
-  FT
-  squared_distance( ) const
-  { 
-    return FT( squared_distance_numerator  ()) /
-      FT( squared_distance_denominator()); }
-    
-  bool  is_finite( ) const
-  { return ( number_of_points_p() > 0) && ( number_of_points_q() > 0); }
-    
-  bool  is_zero( ) const
-  { return CGAL_NTS is_zero( squared_distance_numerator()); }
-    
-  bool  is_degenerate( ) const { return ( ! is_finite()); }
-    
-  // modifiers
-  template < class InputIterator1, class InputIterator2 >
-  void
-  set( InputIterator1 p_first, InputIterator1 p_last,
-       InputIterator2 q_first, InputIterator2 q_last)
-  { 
-    p_points.clear();
-    q_points.clear();
-    std::copy( p_first, p_last, std::back_inserter( p_points));
-    std::copy( q_first, q_last, std::back_inserter( q_points));
-    set_dimension();
-    CGAL_optimisation_precondition_msg
-      (check_dimension( p_points.begin(), p_points.end())
-       && check_dimension( q_points.begin(), q_points.end()),
-       "Not all points have the same dimension.");
-
-    compute_distance(); 
-  }
-    
-  template < class InputIterator >
-  void
-  set_p( InputIterator p_first, InputIterator p_last)
-  { 
-    p_points.clear();
-    std::copy( p_first, p_last, std::back_inserter( p_points));
-    set_dimension();
-    CGAL_optimisation_precondition_msg
-      (check_dimension( p_points.begin(), p_points.end()),
-       "Not all points have the same dimension.");
-
-    compute_distance(); 
-  }
-    
-  template < class InputIterator >
-  void
-  set_q( InputIterator q_first, InputIterator q_last)
-  {
-    q_points.clear();
-    std::copy( q_first, q_last, std::back_inserter( q_points));
-    set_dimension();
-    CGAL_optimisation_precondition_msg
-      (check_dimension( q_points.begin(), q_points.end()),
-       "Not all points have the same dimension.");
-  
-    compute_distance(); 
-  }
-    
-  void
-  insert_p( const Point& p)
-  { 
-    CGAL_optimisation_precondition
-      ( ( ! is_finite()) ||
-	( tco.access_dimension_d_object()( p) == d));
-    p_points.push_back( p);
-    set_dimension(); // it might no longer be -1 
-    compute_distance(); 
-  }
-    
-  void
-  insert_q( const Point& q)
-  { 
-    CGAL_optimisation_precondition
-      ( ( ! is_finite()) ||
-	( tco.access_dimension_d_object()( q) == d));
-    q_points.push_back( q); 
-    set_dimension(); // it might no longer be -1 
-    compute_distance(); 
-  }
-    
-  template < class InputIterator1, class InputIterator2 >
-  void
-  insert( InputIterator1 p_first, InputIterator1 p_last,
-	  InputIterator2 q_first, InputIterator2 q_last)
-  { 
-    CGAL_optimisation_precondition_code(int old_r = static_cast<int>(p_points.size()));
-    CGAL_optimisation_precondition_code(int old_s = static_cast<int>(q_points.size()));
-    p_points.insert( p_points.end(), p_first, p_last);
-    q_points.insert( q_points.end(), q_first, q_last);
-    set_dimension();
-    CGAL_optimisation_precondition_msg
-      (check_dimension( p_points.begin()+old_r, p_points.end())
-       && check_dimension( q_points.begin()+old_s, q_points.end()),
-       "Not all points have the same dimension.");
-    compute_distance(); 
-  }
-    
-  template < class InputIterator >
-  void
-  insert_p( InputIterator p_first, InputIterator p_last)
-  { 
-    CGAL_optimisation_precondition_code(int old_r = static_cast<int>(p_points.size()));
-    p_points.insert( p_points.end(), p_first, p_last);
-    set_dimension();
-    CGAL_optimisation_precondition_msg
-      (check_dimension( p_points.begin()+old_r, p_points.end()),
-       "Not all points have the same dimension.");
-    compute_distance(); 
-  }
-    
-  template < class InputIterator >
-  void
-  insert_q( InputIterator q_first, InputIterator q_last)
-  { 
-    CGAL_optimisation_precondition_code( int old_s = static_cast<int>(q_points.size()));
-    q_points.insert( q_points.end(), q_first, q_last);
-    set_dimension();
-    CGAL_optimisation_precondition_msg
-      (check_dimension( q_points.begin()+old_s, q_points.end()),
-       "Not all points have the same dimension.");
-    compute_distance(); 
-  }
-    
-  void
-  clear( )
-  { 
-    p_points.clear();
-    q_points.clear();
-    compute_distance(); 
-  }
-    
-  // validity check
-  bool  is_valid( bool verbose = false, int level = 0) const;
-    
-  // traits class access
-  const Traits&  traits( ) const { return tco; }
-    
-
-private:
-  NT nt_0;
-  NT nt_1;
-
-  Traits                     tco;        // traits class object
-  Access_coordinates_begin_d da_coord;   // data accessor object
-    
-  Point_vector             p_points;  // points of P
-  Point_vector             q_points;  // points of Q
-  int                      d;         // dimension of input points
-    
-  ET_vector                p_coords;          // realizing point of P
-  ET_vector                q_coords;          // realizing point of Q
-    
-  Solver                   *solver;    // quadratic programming solver
-    
-  Index_vector             p_support_indices;
-  Index_vector             q_support_indices;
-    
-private:    
-  // set dimension of input points
-  void
-  set_dimension( )
-  { 
-    d = ( p_points.size() > 0 ?
-	  tco.access_dimension_d_object()( p_points[ 0]) :
-	  q_points.size() > 0 ?
-	  tco.access_dimension_d_object()( q_points[ 0]) :
-	  -1); 
-  }
-    
-  // check dimension of input points
-  template < class InputIterator >
-  bool
-  check_dimension( InputIterator first, InputIterator last)
-  { return ( std::find_if
-	     ( first, last,
-	       CGAL::compose1_1
-	       ( boost::bind2nd(std::not_equal_to<int>(), d),
-		 tco.access_dimension_d_object()))
-	     == last); }
-    
-  // compute (squared) distance
-  void
-  compute_distance( )
-  {
-    // clear support points
-    p_support_indices.clear();
-    q_support_indices.clear();
-    if ( ( p_points.size() == 0) || ( q_points.size() == 0)) return;
-        
-    // construct program
-    int n = 2 * d + static_cast<int>(p_points.size() + q_points.size());
-    int m = d + 2;
-    CGAL_optimisation_precondition (p_points.size() > 0);
-    QP qp (n, m, 
-	   A_iterator 
-	   (boost::counting_iterator<int>(0), 
-	    A_matrix (d, da_coord, p_points.begin(), static_cast<int>(p_points.size()), 
-			 q_points.begin())),
-	   B_iterator (boost::counting_iterator<int>(0), B_vector (d)), 
-	   R_iterator (CGAL::EQUAL), 
-	   D_iterator (boost::counting_iterator<int>(0), D_matrix (d)),
-	   C_iterator (nt_0));
-
-    delete solver;
-    Quadratic_program_options options;
-    options.set_pricing_strategy(pricing_strategy(NT()));
-    solver = new Solver(qp, options);
-    CGAL_optimisation_assertion(solver->status() == QP_OPTIMAL);
-    // compute support and realizing points
-    ET  et_0 = 0;
-    int r = static_cast<int>(p_points.size());
-    p_coords.resize( ambient_dimension()+1);
-    q_coords.resize( ambient_dimension()+1);
-    std::fill( p_coords.begin(), p_coords.end(), et_0);
-    std::fill( q_coords.begin(), q_coords.end(), et_0);
-    for (int i = 0; i < solver->number_of_basic_original_variables(); ++i) {
-      ET  value = solver->basic_original_variables_numerator_begin()[ i];
-      int index = solver->basic_original_variable_indices_begin()[ i];
-      if (index < 2*d) continue; // v or w variable
-      if (index < 2*d + r) {
-	// a point of p
-	for ( int j = 0; j < d; ++j) {
-	  p_coords[ j]
-	    += value * ET(da_coord (p_points[ index-2*d ])[ j]);
-	}
-	p_support_indices.push_back( index-2*d);
-      } else {
-	// a point of q
-	for ( int j = 0; j < d; ++j) {
-	  q_coords[ j]
-	    += value * ET(da_coord (q_points[ index-2*d-r])[ j]);
-	}
-	q_support_indices.push_back( index-2*d-r);
-      }
-    }
-    p_coords[ d] = q_coords[ d] = solver->variables_common_denominator();
-  }
-    
-  template < class NT >
-  Quadratic_program_pricing_strategy pricing_strategy( NT) {
-    return QP_PARTIAL_FILTERED_DANTZIG;
-  }
-  
-  Quadratic_program_pricing_strategy pricing_strategy( ET) {
-    return QP_PARTIAL_DANTZIG;
-  }
-    
-};
-
-// Function declarations
-// =====================
-// output operator
-template < class Traits_ >
-std::ostream&
-operator << ( std::ostream& os,
-              const Polytope_distance_d<Traits_>& poly_dist);
-
-
-// ============================================================================
-
-// Class implementation
-// ====================
-
-// validity check
-template < class Traits_ >
-bool
-Polytope_distance_d<Traits_>::
-is_valid( bool verbose, int level) const
-{
-  using namespace std;
-
-  CGAL::Verbose_ostream verr( verbose);
-  verr << "CGAL::Polytope_distance_d<Traits>::" << endl;
-  verr << "is_valid( true, " << level << "):" << endl;
-  verr << "  |P+Q| = " << number_of_points_p()
-       <<          '+' << number_of_points_q()
-       <<   ", |S| = " << number_of_support_points_p()
-       <<          '+' << number_of_support_points_q() << endl;
-
-  if ( is_finite()) {
-
-    // compute normal vector
-    ET_vector  normal( d), diff( d);
-    ET  et_0 = 0, den = p_coords[d];
-    CGAL_optimisation_assertion (den > et_0);
-    CGAL_optimisation_assertion (den == q_coords[d]);
-    int i, j;
-    for ( j = 0; j < d; ++j) normal[ j] = p_coords[ j] - q_coords[ j];
-
-    // check correctness of computed squared distance
-    verr << "  checking squared_distance..." << flush;
-    ET sqr_dist_num (0);
-    for ( j = 0; j < d; ++j)
-      sqr_dist_num += normal[ j] * normal[ j];
-    ET sqr_dist_den = 
-      p_coords[ d] * p_coords[ d];
-    if (sqr_dist_num * squared_distance_denominator() !=
-	sqr_dist_den * squared_distance_numerator())
-      return CGAL::_optimisation_is_valid_fail
-	( verr, "realizing points don't have correct squared distance");
-
-
-    // check P
-    // -------
-    verr << "  checking P..." << flush;
-        
-    // check point set
-    for ( i = 0; i < number_of_points_p(); ++i) {
-      for ( j = 0; j < d; ++j) {
-	// compute (a positive multiple of) p^* - p_i
-	diff[ j] = 
-	  ET(da_coord(p_points[ i])[d]) * p_coords[ j] - 
-	  den * ET(da_coord( p_points[ i])[ j]);
-      }
-      if ( std::inner_product( diff.begin(), diff.end(),
-			       normal.begin(), et_0) > et_0)
-	return CGAL::_optimisation_is_valid_fail
-	  ( verr, "polytope P is not separated by its hyperplane");
-    }
-        
-    verr << "passed." << endl;
-
-    // check Q
-    // -------
-    verr << "  checking Q..." << flush;
-        
-    // check point set
-    for ( i = 0; i < number_of_points_q(); ++i) {
-      for ( j = 0; j < d; ++j) {
-	// compute (a positive multiple of) q^* - q_i
-	diff[ j] = 
-	  ET(da_coord(q_points[ i])[d]) * q_coords[ j] - 
-	  den * ET(da_coord( q_points[ i])[ j]);
-      }
-      if ( std::inner_product( diff.begin(), diff.end(),
-			       normal.begin(), et_0) < et_0)
-	return CGAL::_optimisation_is_valid_fail
-	  ( verr, "polytope Q is not separated by its hyperplane");
-    }
-        
-    verr << "passed." << endl;
-  }
-
-  verr << "  object is valid!" << endl;
-  return( true);
-}
-
-// output operator
-template < class Traits_ >
-std::ostream&
-operator << ( std::ostream& os,
-              const Polytope_distance_d<Traits_>& poly_dist)
-{
-  using namespace std;
-
-  typedef  typename Polytope_distance_d<Traits_>::Point  Point;
-  typedef  ostream_iterator<Point>       Os_it;
-  typedef  typename Traits_::ET          ET;
-  typedef  ostream_iterator<ET>          Et_it;
-
-  switch ( CGAL::get_mode( os)) {
-
-  case CGAL::IO::PRETTY:
-    os << "CGAL::Polytope_distance_d( |P+Q| = "
-       << poly_dist.number_of_points_p() << '+'
-       << poly_dist.number_of_points_q() << ", |S| = "
-       << poly_dist.number_of_support_points_p() << '+'
-       << poly_dist.number_of_support_points_q() << endl;
-    os << "  P = {" << endl;
-    os << "    ";
-    copy( poly_dist.points_p_begin(), poly_dist.points_p_end(),
-	  Os_it( os, ",\n    "));
-    os << "}" << endl;
-    os << "  Q = {" << endl;
-    os << "    ";
-    copy( poly_dist.points_q_begin(), poly_dist.points_q_end(),
-	  Os_it( os, ",\n    "));
-    os << "}" << endl;
-    os << "  S_P = {" << endl;
-    os << "    ";
-    copy( poly_dist.support_points_p_begin(),
-	  poly_dist.support_points_p_end(),
-	  Os_it( os, ",\n    "));
-    os << "}" << endl;
-    os << "  S_Q = {" << endl;
-    os << "    ";
-    copy( poly_dist.support_points_q_begin(),
-	  poly_dist.support_points_q_end(),
-	  Os_it( os, ",\n    "));
-    os << "}" << endl;
-    os << "  p = ( ";
-    copy( poly_dist.realizing_point_p_coordinates_begin(),
-	  poly_dist.realizing_point_p_coordinates_end(),
-	  Et_it( os, " "));
-    os << ")" << endl;
-    os << "  q = ( ";
-    copy( poly_dist.realizing_point_q_coordinates_begin(),
-	  poly_dist.realizing_point_q_coordinates_end(),
-	  Et_it( os, " "));
-    os << ")" << endl;
-    os << "  squared distance = "
-       << poly_dist.squared_distance_numerator() << " / "
-       << poly_dist.squared_distance_denominator() << endl;
-    break;
-
-  case CGAL::IO::ASCII:
-    os << poly_dist.number_of_points_p() << endl;
-    copy( poly_dist.points_p_begin(),
-	  poly_dist.points_p_end(),
-	  Os_it( os, "\n"));
-    os << poly_dist.number_of_points_q() << endl;
-    copy( poly_dist.points_q_begin(),
-	  poly_dist.points_q_end(),
-	  Os_it( os, "\n"));
-    break;
-
-  case CGAL::IO::BINARY:
-    os << poly_dist.number_of_points_p() << endl;
-    copy( poly_dist.points_p_begin(),
-	  poly_dist.points_p_end(),
-	  Os_it( os));
-    os << poly_dist.number_of_points_q() << endl;
-    copy( poly_dist.points_q_begin(),
-	  poly_dist.points_q_end(),
-	  Os_it( os));
-    break;
-
-  default:
-    CGAL_optimisation_assertion_msg( false,
-				     "CGAL::get_mode( os) invalid!");
-    break; }
-
-  return( os);
-}
-
-
-} //namespace CGAL
-
-#endif // CGAL_POLYTOPE_DISTANCE_D_H
-
-// ===== EOF ==================================================================
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/DemosMainWindow_impl.h b/3rdparty/CGAL-4.8/include/CGAL/Qt/DemosMainWindow_impl.h
deleted file mode 100644
index 32fa867..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Qt/DemosMainWindow_impl.h
+++ /dev/null
@@ -1,474 +0,0 @@
-// Copyright (c) 2008  GeometryFactory Sarl (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
-// 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(s)     : Andreas Fabri <Andreas.Fabri at geometryfactory.com>
-//                 Laurent Rineau <Laurent.Rineau at geometryfactory.com>
-   
-#ifdef CGAL_HEADER_ONLY
-#define CGAL_INLINE_FUNCTION inline
-#else
-#define CGAL_INLINE_FUNCTION
-#endif
-
-#include <CGAL/Qt/GraphicsViewNavigation.h>
-#include <QApplication>
-#include <QLabel>
-#include <QFile>
-#include <QFileDialog>
-#include <QFileInfo>
-#include <QMenu>
-#include <QMenuBar>
-#include <QAction>
-#include <QMessageBox>
-#include <QStatusBar>
-#include <QGraphicsView>
-#include <QGLWidget>
-#include <QTextStream>
-#include <QSettings>
-#include <QUrl>
-#include <QDesktopWidget>
-#include <QRegExp>
-#include <QSvgGenerator>
-#include <QtCore>
-#include <QtOpenGL>
-
-#include <CGAL/config.h> // needed to get CGAL_VERSION_STR
-#include <CGAL/Qt/DemosMainWindow.h>
-#include <iostream>
-
-namespace CGAL {
-namespace Qt {
-
-CGAL_INLINE_FUNCTION
-DemosMainWindow::DemosMainWindow(QWidget * parent, ::Qt::WindowFlags flags)
-  : QMainWindow(parent, flags),
-    maxNumRecentFiles(10),
-    recentFileActs(maxNumRecentFiles)
-{
-  // prepare the QLabel xycoord for inclusion in the statusBar()
-  xycoord = new QLabel(" -0.00000 , -0.00000 ", this);
-  xycoord->setAlignment(::Qt::AlignHCenter);
-  xycoord->setMinimumSize(xycoord->sizeHint());
-  xycoord->clear();
-
-  actionUse_OpenGL = new QAction(this);
-  actionUse_OpenGL->setObjectName("actionUse_OpenGL");
-  actionUse_OpenGL->setCheckable(true);
-  actionUse_OpenGL->setText(tr("Use &OpenGL"));
-  actionUse_OpenGL->setStatusTip(tr("Make Qt use OpenGL to display the graphical items, instead of its native painting system."));
-  actionUse_OpenGL->setShortcut(tr("Ctrl+G"));
-
-  actionUse_Antialiasing = new QAction(this);
-  actionUse_Antialiasing->setObjectName("actionUse_Antialiasing");
-  actionUse_Antialiasing->setCheckable(true);
-  actionUse_Antialiasing->setText(tr("Use &anti-aliasing"));
-  actionUse_Antialiasing->setStatusTip(tr("Make Qt use anti-aliasing when displaying the graphical items."));
-  actionUse_Antialiasing->setShortcut(tr("Ctrl+A"));
-
-  actionAboutCGAL = new QAction(this);
-  actionAboutCGAL->setObjectName("actionAboutCGAL");
-  actionAboutCGAL->setText(tr("About &CGAL..."));
-
-  actionAbout = new QAction(this);
-  actionAbout->setObjectName("actionAbout");
-  actionAbout->setText(tr("&About..."));
-
-  setAcceptDrops(true);
-}
-
-CGAL_INLINE_FUNCTION
-DemosMainWindow::~DemosMainWindow()
-{
-}
-
-CGAL_INLINE_FUNCTION
-void 
-DemosMainWindow::dragEnterEvent(QDragEnterEvent *event)
-{
-  if (event->mimeData()->hasFormat("text/uri-list"))
-    event->acceptProposedAction();
-}
-
-CGAL_INLINE_FUNCTION
-void 
-DemosMainWindow::dropEvent(QDropEvent *event)
-{
-  Q_FOREACH(QUrl url, event->mimeData()->urls()) {
-    QString filename = url.toLocalFile();
-    this->open(filename);
-  }
-  event->acceptProposedAction();
-}
-
-CGAL_INLINE_FUNCTION
-void
-DemosMainWindow::addNavigation(QGraphicsView* graphicsView)
-{
-  navigation = new CGAL::Qt::GraphicsViewNavigation();
-  graphicsView->viewport()->installEventFilter(navigation);
-  graphicsView->installEventFilter(navigation);
-  QObject::connect(navigation, SIGNAL(mouseCoordinates(QString)),
-		   xycoord, SLOT(setText(QString)));
-  view = graphicsView;
-}
-
-CGAL_INLINE_FUNCTION
-void
-DemosMainWindow::setupStatusBar()
-{
-  this->statusBar()->addWidget(new QLabel(this), 1);
-  this->statusBar()->addWidget(xycoord, 0);
-}
-
-CGAL_INLINE_FUNCTION
-void
-DemosMainWindow::setupOptionsMenu(QMenu* menuOptions)
-{
-  // search for the Options menu
-  if(!menuOptions) {
-    menuOptions = getMenu("menuOptions", tr("&Options"));
-  }
-
-  // if not found, then create it
-  if(!menuOptions) {
-    menuOptions = new QMenu(this->menuBar());
-    menuOptions->setTitle(tr("&Options"));
-    this->menuBar()->addAction(menuOptions->menuAction());
-    menuOptions->setObjectName("menuOptions");
-  }
-
-  if(!menuOptions->isEmpty()) {
-    menuOptions->addSeparator();
-  }
-  menuOptions->addAction(actionUse_OpenGL);
-  menuOptions->addAction(actionUse_Antialiasing);
-  connect(actionUse_Antialiasing, SIGNAL(toggled(bool)),
-          this, SLOT(setUseAntialiasing(bool)));
-  connect(actionUse_OpenGL, SIGNAL(toggled(bool)),
-          this, SLOT(setUseOpenGL(bool)));
-  actionUse_Antialiasing->setChecked(true);
-}
-
-CGAL_INLINE_FUNCTION
-void
-DemosMainWindow::setupExportSVG(QAction* action, QGraphicsView* view)
-{
-  this->view = view;
-  connect(action, SIGNAL(triggered(bool)),
-	  this, SLOT(exportSVG()));
-}
-
-CGAL_INLINE_FUNCTION
-void DemosMainWindow::exportSVG()
-{
-  QString fileName = QFileDialog::getSaveFileName(this,
-						  tr("Export to SVG"),
-						  ".",
-						  tr("SVG (*.svg)\n"));
-
-  QSvgGenerator svg;
-  svg.setFileName(fileName);
-
-  svg.setSize(this->view->size());
-  svg.setViewBox(this->view->sceneRect());
-  svg.setTitle(tr("%1 drawing").arg(qApp->applicationName()));
-  svg.setDescription(tr("Generated using %1").arg(qApp->applicationName()));
-
-  QPainter painter;
-  painter.begin(&svg);
-  this->view->render(&painter);
-  painter.end();
-}
-
-CGAL_INLINE_FUNCTION
-void
-DemosMainWindow::setUseAntialiasing(bool checked)
-{
-  view->setRenderHint(QPainter::Antialiasing, checked);
-  view->setRenderHint(QPainter::HighQualityAntialiasing, checked);
-
-  statusBar()->showMessage(tr("Antialiasing %1activated").arg(checked?"":"de-"),
-                           1000);
-}
-
-CGAL_INLINE_FUNCTION
-void
-DemosMainWindow::setUseOpenGL(bool checked)
-{ 
-  if(checked) {
-    QGLWidget* new_viewport = new QGLWidget;
-
-    // Setup the format to allow antialiasing with OpenGL:
-    // one need to activate the SampleBuffers, if the graphic driver allows
-    // this.
-    QGLFormat glformat = new_viewport->format();
-    glformat.setOption(QGL::SampleBuffers);
-    new_viewport->setFormat(glformat);
-
-    view->setViewport(new_viewport);
-  }
-  else {
-    view->setViewport(new QWidget);
-  }
-  statusBar()->showMessage(tr("OpenGL %1activated").arg(checked?"":"de-"),
-                           1000);
-  view->viewport()->installEventFilter(navigation);
-  view->setFocus();
-}
-
-CGAL_INLINE_FUNCTION
-QMenu* 
-DemosMainWindow::getMenu(QString objectName, QString title)
-{
-  QMenu* menu = NULL;
-
-  QString title2 = title;
-  title2.remove('&');
-  // search if a menu has objectName()==objectName
-  menu = this->findChild<QMenu*>(objectName);
-
-  // then search if a menu has title()==title
-  if(menu) {
-    return menu;
-  } else {
-    Q_FOREACH(menu, this->findChildren<QMenu*>()) {
-      if(menu->title() == title ||
-         menu->title() == title2) {
-        return menu;
-      }
-    }
-  }
-  return NULL;
-}
-
-CGAL_INLINE_FUNCTION
-void 
-DemosMainWindow::popupAboutBox(QString title, QString html_resource_name)
-{
-  QFile about_CGAL(html_resource_name);
-  about_CGAL.open(QIODevice::ReadOnly);
-  QString about_CGAL_txt = QTextStream(&about_CGAL).readAll();
-#ifdef CGAL_VERSION_STR
-  QString cgal_version(CGAL_VERSION_STR);
-#  ifdef CGAL_FAKE_PUBLIC_RELEASE
-  cgal_version.replace(QRegExp("-Ic?.*"), "");
-#  endif
-  about_CGAL_txt.replace("<!--CGAL_VERSION-->",
-                         QString(" (version %1)")
-                         .arg(cgal_version));
-#endif
-  QMessageBox mb(QMessageBox::NoIcon,
-                 title,
-                 about_CGAL_txt,
-                 QMessageBox::Ok,
-                 this);
-
-  QLabel* mb_label = mb.findChild<QLabel*>("qt_msgbox_label");
-  if(mb_label) {
-    mb_label->setTextInteractionFlags(mb_label->textInteractionFlags() | 
-                                      ::Qt::LinksAccessibleByMouse | 
-                                      ::Qt::LinksAccessibleByKeyboard);
-  }
-  else {
-    std::cerr << "Cannot find child \"qt_msgbox_label\" in QMessageBox\n"
-              << "  with Qt version " << QT_VERSION_STR << "!\n";
-  }
-  mb.exec();
-}
-
-CGAL_INLINE_FUNCTION
-QMenu* DemosMainWindow::getHelpMenu()
-{
-  QMenu* menuHelp = getMenu("menuHelp", tr("&Help"));
-  if(!menuHelp) {
-    menuHelp = new QMenu(this->menuBar());
-    menuHelp->setTitle(tr("&Help"));
-    this->menuBar()->addAction(menuHelp->menuAction());
-    menuHelp->setObjectName("menuHelp");
-  }
-  return menuHelp;
-}
-
-CGAL_INLINE_FUNCTION
-void 
-DemosMainWindow::addAboutCGAL(QMenu* menuHelp)
-{
-  if(!menuHelp) {
-    menuHelp = getHelpMenu();
-  }
-  menuHelp->addAction(actionAboutCGAL);
-
-  connect(actionAboutCGAL, SIGNAL(triggered()),
-          this, SLOT(popupAboutCGAL()));
-}
-
-CGAL_INLINE_FUNCTION
-void 
-DemosMainWindow::addAboutDemo(QString htmlResourceName, QMenu* menuHelp)
-{
-  if(!menuHelp) {
-    menuHelp = getHelpMenu();
-  }
-  menuHelp->addAction(actionAbout);
-  aboutHtmlResource = htmlResourceName;
-
-  connect(actionAbout, SIGNAL(triggered()),
-          this, SLOT(popupAboutDemo()));
-}
-
-CGAL_INLINE_FUNCTION
-void
-DemosMainWindow::popupAboutCGAL()
-{
-  popupAboutBox(tr("About CGAL..."),
-                ":/cgal/help/about_CGAL.html");
-}
-
-CGAL_INLINE_FUNCTION
-void
-DemosMainWindow::popupAboutDemo()
-{
-  popupAboutBox(tr("About the demo..."),
-                aboutHtmlResource);
-}
-
-CGAL_INLINE_FUNCTION
-void
-DemosMainWindow::setMaxNumberOfRecentFiles(const unsigned int i)
-{
-  maxNumRecentFiles = i;
-  recentFileActs.resize(maxNumRecentFiles);
-}
-
-CGAL_INLINE_FUNCTION
-unsigned int 
-DemosMainWindow::maxNumberOfRecentFiles() const
-{
-  return maxNumRecentFiles;
-}
-
-CGAL_INLINE_FUNCTION
-void 
-DemosMainWindow::openRecentFile_aux()
-{
-  QAction *action = qobject_cast<QAction *>(sender());
-  if (action)
-    emit openRecentFile(action->data().toString());
-}
-
-CGAL_INLINE_FUNCTION
-void 
-DemosMainWindow::addToRecentFiles(QString fileName)
-{
-  QSettings settings;
-  QStringList files = settings.value("recentFileList").toStringList();
-  files.removeAll(fileName);
-  files.prepend(fileName);
-  while (files.size() > (int)maxNumberOfRecentFiles())
-    files.removeLast();
-
-  settings.setValue("recentFileList", files);
-
-  updateRecentFileActions();
-}
-
-CGAL_INLINE_FUNCTION
-void
-DemosMainWindow::addRecentFiles(QMenu* menu, QAction* insertBeforeAction)
-{
-  if(!insertBeforeAction) {
-    recentFilesSeparator = menu->addSeparator();
-  }
-
-  for (unsigned int i = 0; i < maxNumberOfRecentFiles(); ++i) {
-    recentFileActs[i] = new QAction(this);
-    recentFileActs[i]->setVisible(false);
-    connect(recentFileActs[i], SIGNAL(triggered()),
-            this, SLOT(openRecentFile_aux()));
-    if(insertBeforeAction)
-      menu->insertAction(insertBeforeAction, recentFileActs[i]);
-    else
-      menu->addAction(recentFileActs[i]);
-  }
-
-  if(insertBeforeAction) {
-    recentFilesSeparator = menu->insertSeparator(insertBeforeAction);
-  }
-
-  recentFilesSeparator->setVisible(false);
-
-  updateRecentFileActions();
-}
-
-CGAL_INLINE_FUNCTION
-void 
-DemosMainWindow::updateRecentFileActions()
-{
-  QSettings settings;
-  QStringList files = settings.value("recentFileList").toStringList();
-
-  int numRecentFiles = qMin(files.size(), (int)this->maxNumberOfRecentFiles());
-  
-  for (int i = 0; i < numRecentFiles; ++i) {
-    QString strippedName = QFileInfo(files[i]).fileName();
-    QString text = tr("&%1 %2").arg(i).arg(strippedName);
-    recentFileActs[i]->setText(text);
-    recentFileActs[i]->setData(files[i]);
-    recentFileActs[i]->setVisible(true);
-  }
-  for (unsigned int j = numRecentFiles; j < maxNumberOfRecentFiles(); ++j)
-    recentFileActs[j]->setVisible(false);
-  
-  recentFilesSeparator->setVisible(numRecentFiles > 0);
-}
-
-CGAL_INLINE_FUNCTION
-void DemosMainWindow::writeState(QString groupname)
-{
-  QSettings settings;
-
-  settings.beginGroup(groupname);
-  settings.setValue("size", size());
-  settings.setValue("pos", pos());
-  settings.setValue("state", saveState());
-  settings.endGroup();
-}
-
-CGAL_INLINE_FUNCTION
-void DemosMainWindow::readState(QString groupname, Options /*what_to_save*/)
-{
-  QSettings settings;
-  
-  settings.beginGroup(groupname);
-  resize(settings.value("size", this->size()).toSize());
-
-  QDesktopWidget* desktop = qApp->desktop();
-  QPoint pos = settings.value("pos", this->pos()).toPoint();
-  if(desktop->availableGeometry(pos).contains(pos)) {
-    move(pos);
-  }
-  QByteArray mainWindowState = settings.value("state").toByteArray();
-  if(!mainWindowState.isNull()) {
-    this->restoreState(mainWindowState);
-  }
-  settings.endGroup();
-}
-
-
-} // namespace Qt
-} // namespace CGAL
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/GraphicsViewNavigation_impl.h b/3rdparty/CGAL-4.8/include/CGAL/Qt/GraphicsViewNavigation_impl.h
deleted file mode 100644
index 0570920..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Qt/GraphicsViewNavigation_impl.h
+++ /dev/null
@@ -1,351 +0,0 @@
-// Copyright (c) 2008  GeometryFactory Sarl (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
-// 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(s)     : Andreas Fabri <Andreas.Fabri at geometryfactory.com>
-//                 Laurent Rineau <Laurent.Rineau at geometryfactory.com>
-   
-#ifdef CGAL_HEADER_ONLY
-#define CGAL_INLINE_FUNCTION inline
-#else
-#define CGAL_INLINE_FUNCTION
-#endif
-
-#include <CGAL/Qt/GraphicsViewNavigation.h>
-#include <CGAL/Qt/utility.h> // for mapToScene(QGraphicsView*, QRect)
-#include <cmath>
-#include <iostream>
-#include <boost/format.hpp>
-
-#include <QEvent>
-#include <QMouseEvent>
-#include <QWheelEvent>
-#include <QGraphicsView>
-#include <QGraphicsScene>
-#include <QGraphicsRectItem>
-#include <QFlags>
-#include <QScrollBar>
-
-namespace CGAL {
-namespace Qt {
-
-  CGAL_INLINE_FUNCTION
-  GraphicsViewNavigation::GraphicsViewNavigation()
-    : rectItem(new QGraphicsRectItem),
-      dragging(false)
-  {
-    QColor rect_color(250, 221, 0);
-    rect_color.setAlpha(50);
-    rectItem->setBrush(rect_color);
-    rect_color.setAlpha(255);
-    rectItem->setPen(QPen(rect_color, 0, ::Qt::DashLine));
-    rectItem->hide();
-    rectItem->setZValue(10000);
-  }
-
-  CGAL_INLINE_FUNCTION
-  GraphicsViewNavigation::~GraphicsViewNavigation()
-  {
-    delete rectItem;
-  }
-
-  CGAL_INLINE_FUNCTION
-  bool 
-  GraphicsViewNavigation::eventFilter(QObject *obj, QEvent *event)
-  {
-    QGraphicsView* v = qobject_cast<QGraphicsView*>(obj);
-    if(v == NULL) {
-      QWidget* viewport = qobject_cast<QWidget*>(obj);
-      if(viewport == NULL) {
-        return false;
-      }
-      v = qobject_cast<QGraphicsView*>(viewport->parent());
-      if(v == NULL) {
-        return false;
-      }
-    }
-    switch(event->type()) 
-    {
-    case QEvent::KeyPress: {
-      QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
-      int offset = 10;
-      if( (keyEvent->modifiers() & ::Qt::ShiftModifier)
-          || (keyEvent->modifiers() & ::Qt::ControlModifier) ) {
-        offset = 20;
-      }
-      switch (keyEvent->key()) {
-      case ::Qt::Key_Up:
-        translateView(v, 0, -offset);
-        break;
-      case ::Qt::Key_Down:
-        translateView(v, 0, offset);
-        break;
-      case ::Qt::Key_Left:
-        translateView(v, -offset, 0);
-        break;
-      case ::Qt::Key_Right:
-        translateView(v, offset, 0);
-        break;
-      case ::Qt::Key_PageUp:
-        v->rotate(-6);
-        break;
-      case ::Qt::Key_PageDown:
-        v->rotate(6);
-        break;
-      case ::Qt::Key_Plus:
-        scaleView(v, 1.2);
-        break;
-      case ::Qt::Key_Minus:
-        scaleView(v, 1 / 1.2);
-        break;
-      case ::Qt::Key_Control:
-        cursor_backup = v->cursor();
-        v->setCursor(::Qt::CrossCursor);
-      default:
-        return false;
-      }
-      //         display_parameters();
-      return true;
-      break;
-    } // end case KeyPress
-    case QEvent::KeyRelease: {
-      QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
-      if(keyEvent->key() == ::Qt::Key_Control) {
-        if(rectItem->isVisible() ) {
-          dragging = false;
-          v->scene()->removeItem(rectItem);
-          rectItem->hide();
-        }
-        v->setCursor(cursor_backup);
-        return true;
-      }
-      return false;
-      break;
-    } // end case KeyRelease
-    case QEvent::Wheel: {
-      QWheelEvent *wheelEvent = static_cast<QWheelEvent*>(event);
-      if(wheelEvent->orientation() != ::Qt::Vertical) {
-        return false;
-      }
-      double zoom_ratio = 240.0;
-      if( (wheelEvent->modifiers() & ::Qt::ShiftModifier)
-          || (wheelEvent->modifiers() & ::Qt::ControlModifier) ) {
-        zoom_ratio = 120.0;
-      }
-      scaleView(v, pow((double)2, -wheelEvent->delta() / zoom_ratio));
-
-      //         display_parameters();
-      return true;
-      break;
-    } // end case Wheel
-    case QEvent::MouseButtonPress: {
-      QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
-      if( (mouseEvent->modifiers() == (::Qt::ControlModifier | ::Qt::ShiftModifier))
-          && mouseEvent->button() == ::Qt::RightButton )
-      {
-        QPoint offset = mouseEvent->pos() - v->viewport()->rect().center();
-        translateView(v, offset.x(), offset.y());
-        return true;
-      }
-      else if( mouseEvent->modifiers() == ::Qt::ControlModifier ) {
-        if(mouseEvent->button() == ::Qt::LeftButton) {
-          rect_first_point = v->mapToScene(mouseEvent->pos());
-          rectItem->setRect(QRectF(rect_first_point, QSizeF(0.,0.)));
-          rectItem->show();
-          v->scene()->addItem(rectItem);
-          return true;
-        }
-        else if( mouseEvent->button() == ::Qt::RightButton) {
-          dragging = true;
-          dragging_start = v->mapToScene(mouseEvent->pos());
-          v->setCursor(::Qt::ClosedHandCursor);
-          return true;
-        }
-      }
-      return false;
-      break;
-    } // end case MouseRelease
-    case QEvent::MouseMove: {
-      QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
-      QPointF pos = v->mapToScene(mouseEvent->pos());
-      QString xy = QString(" ") + QString::number(pos.x(),'g', 6) + " , " + QString::number(pos.y(),'g', 6) + " ";
-      emit mouseCoordinates(xy);
-      if(rectItem->isVisible()) {
-	QPointF size = v->mapToScene(mouseEvent->pos());
-	size = size - rect_first_point;
-        rectItem->setRect(rect_first_point.x(),
-			  rect_first_point.y(),
-			  size.x(),
-			  size.y());
-      }
-      if( dragging )
-      {
-//         std::cerr << boost::format("mouseMove: globalpos=(%1%, %2%)\n"
-//                                    "           pos=(%3%, %4%)\n"
-//                                    "           sender=%5% (class %6%), parent class %7%\n")
-//           % mouseEvent->globalPos().x()
-//           % mouseEvent->globalPos().y()
-//           % mouseEvent->pos().x()
-//           % mouseEvent->pos().y()
-//           % (&*obj)
-//           % obj->metaObject()->className()
-//           % obj->parent()->metaObject()->className();
-
-//         drag_to(mouseEvent->pos());
-      }
-      break;
-    } // end MouseMove
-    case QEvent::MouseButtonRelease: {
-      QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
-      if(rectItem->isVisible() && mouseEvent->button() == ::Qt::LeftButton){
-        v->setSceneRect(v->sceneRect() | rectItem->rect());
-        v->fitInView(rectItem->rect(), ::Qt::KeepAspectRatio);
-        v->scene()->removeItem(rectItem);
-        rectItem->hide();
-        return true;
-      }
-      else if(  mouseEvent->button() == ::Qt::RightButton ) {
-        if(dragging) {
-          dragging = false;
-          drag_to(v, mouseEvent->pos());
-          v->setCursor(cursor_backup);
-          return true;
-        }
-      }
-      return false;
-      break;
-    } // end MouseRelease
-    default:
-      return false;
-    } // end switch
-    return false;
-  }
-
-
-  CGAL_INLINE_FUNCTION
-  void 
-  GraphicsViewNavigation::scaleView(QGraphicsView* v, qreal scaleFactor)
-  {
-    QPointF center = v->mapToScene(v->viewport()->rect().center());
-//     qreal factor = v->matrix().scale(scaleFactor, scaleFactor).mapRect(QRectF(0, 0, 1, 1)).width();
-    //if (factor < 0.001 || factor > 2000)
-    //    return;
-
-    v->scale(scaleFactor, scaleFactor);
-    QPoint offset = v->mapFromScene(center) - v->viewport()->rect().center();
-    translateView(v, offset.x(), offset.y());
-  }
-
-  CGAL_INLINE_FUNCTION
-  void GraphicsViewNavigation::drag_to(QGraphicsView* v, QPoint new_pos)
-  {
-    QPoint dragging_start_in_view = v->mapFromScene(dragging_start);
-    QPoint offset = new_pos - dragging_start_in_view;
-//     std::cerr << boost::format("drag_to: origin=(%1%, %2%)\n"
-//                                "         offset=(%3%, %4%)\n")
-//       % dragging_start_in_view.x() % dragging_start_in_view.y()
-//       % offset.x() % offset.y();
-    translateView(v, -offset.x(), -offset.y());
-    dragging_start_in_view = v->mapFromScene(dragging_start);
-//     std::cerr << boost::format("         after=(%1%, %2%)\n")
-//       % dragging_start_in_view.x() % dragging_start_in_view.y();
-  }
-
-  CGAL_INLINE_FUNCTION
-  void GraphicsViewNavigation::translateView(QGraphicsView* v, int dx,  int dy)
-  {
-    if( dx == 0 && dy == 0 ) {
-      return;
-    }
-
-    int horizontalScrollBarValue = v->horizontalScrollBar()->value();
-    int verticalScrollBarValue = v->verticalScrollBar()->value();
-
-    if( (horizontalScrollBarValue + dx <= 
-         v->horizontalScrollBar()->maximum()) &&
-        (horizontalScrollBarValue + dx >=
-         v->horizontalScrollBar()->minimum()) &&
-        (verticalScrollBarValue + dy <= 
-         v->verticalScrollBar()->maximum()) &&
-        (verticalScrollBarValue + dy >=
-         v->verticalScrollBar()->minimum()) )
-    {
-      v->horizontalScrollBar()->setValue(horizontalScrollBarValue + dx);
-      v->verticalScrollBar()->setValue(verticalScrollBarValue + dy);
-    }
-    else
-    {
-      QRect vp_rect = v->viewport()->rect();
-      QPointF new_center = v->mapToScene(vp_rect.center() + QPoint(dx, dy));
-      vp_rect |= vp_rect.translated(dx, dy);
-      QRectF rect = mapToScene(v, vp_rect);
-      v->setSceneRect(v->sceneRect() | rect);
-      v->centerOn(new_center);
-
-      // QGraphicsView::centerOn makes rounding errors.
-      // The following two "if" make them unnoticable when dx==0 or dy==0.
-      if(dx == 0) {
-        v->horizontalScrollBar()->setValue(horizontalScrollBarValue);
-      }
-      if(dy == 0) {
-        v->verticalScrollBar()->setValue(verticalScrollBarValue);
-      }
-    }
-//     display_parameters();
-  }
-
-  CGAL_INLINE_FUNCTION
-  void GraphicsViewNavigation::display_parameters(QGraphicsView* v)
-  {
-    std::cerr << 
-      boost::format("matrix translation=(%1%, %2%)\n"
-                    "       rotation=(%3% - %4% )\n"
-                    "                (%5% - %6% )\n")
-      % v->matrix().dx()
-      % v->matrix().dy()
-      % v->matrix().m11()
-      % v->matrix().m12()
-      % v->matrix().m21()
-      % v->matrix().m22();
-
-    QRect vp_rect = v->viewport()->rect();
-    QPoint vp_top_left = vp_rect.topLeft();
-    QPoint vp_bottom_right = vp_rect.bottomRight();
-    QPointF top_left = v->mapToScene(vp_top_left);
-    QPointF bottom_right = v->mapToScene(vp_bottom_right);
-
-    std::cerr <<
-      boost::format("view=(%1% - %2%) x (%3% - %4%)\n")
-      % top_left.x() % bottom_right.x()
-      % top_left.y() % bottom_right.y();
-    std::cerr <<
-      boost::format("viewport=(%1% - %2%) x (%3% - %4%)\n")
-      % vp_top_left.x() % vp_bottom_right.x()
-      % vp_top_left.y() % vp_bottom_right.y();
-    std::cerr <<
-      boost::format("scrollbars=(%1% <= %2% <= %3%) x (%4% <= %5% <= %6%)\n")
-      % v->horizontalScrollBar()->minimum() 
-      % v->horizontalScrollBar()->value()
-      % v->horizontalScrollBar()->maximum()
-      % v->verticalScrollBar()->minimum() 
-      % v->verticalScrollBar()->value()
-      % v->verticalScrollBar()->maximum();
-  }
-
-} // namespace Qt
-} // namespace CGAL
-
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Quotient.h b/3rdparty/CGAL-4.8/include/CGAL/Quotient.h
deleted file mode 100644
index a1934fc..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Quotient.h
+++ /dev/null
@@ -1,878 +0,0 @@
-// Copyright (c) 1999-2007  
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved. 
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Stefan Schirra, Sylvain Pion, Michael Hemmer
-
-// The template class Quotient<NT> is based on the LEDA class
-// leda_rational written by Stefan Naeher and Christian Uhrig.
-// It is basically a templated version with restricted functionality
-// of the version of rational in LEDA release 3.3.
-// The modification was done by Stefan.Schirra at mpi-sb.mpg.de
-
-// The include is done before the protect macro on purpose, because
-// of a cyclic dependency.
-
-#include <CGAL/number_type_basic.h>
-
-#ifndef CGAL_QUOTIENT_H
-#define CGAL_QUOTIENT_H
-
-#include <utility>
-#include <istream>
-
-#include <CGAL/Interval_nt.h>
-#include <CGAL/Kernel/mpl.h>
-
-#include <boost/operators.hpp>
-
-namespace CGAL {
-
-#define CGAL_int(T)    typename First_if_different<int,    T>::Type
-#define CGAL_double(T) typename First_if_different<double, T>::Type
-
-// Simplify the quotient numerator/denominator.
-// Currently the default template doesn't do anything.
-// This function is not documented as a number type requirement for now.
-template < typename NT >
-inline void
-simplify_quotient(NT &, NT &) {}
-
-// This one should be replaced by some functor or tag.
-// Meanwhile, the class is specialized for Gmpz, mpz_class, leda_integer.
-template < typename NT >
-struct Split_double
-{
-  void operator()(double d, NT &num, NT &den) const
-  {
-    num = NT(d);
-    den = 1;
-  }
-};
-
-
-template <class NT_>
-class Quotient
-  : boost::ordered_field_operators1< Quotient<NT_>
-  , boost::ordered_field_operators2< Quotient<NT_>, NT_
-  , boost::ordered_field_operators2< Quotient<NT_>, CGAL_int(NT_)
-  , boost::ordered_field_operators2< Quotient<NT_>, CGAL_double(NT_)
-    > > > >
-{
- public:
-  typedef NT_        NT;
-
-  Quotient()
-    : num(0), den(1) {}
-
-  Quotient(const NT& n)
-    : num(n), den(1) {}
-
-  Quotient(const CGAL_double(NT) & n)
-  { Split_double<NT>()(n, num, den); }
-
-  Quotient(const CGAL_int(NT) & n)
-    : num(n), den(1) {}
-
-  template <class T>
-  explicit Quotient(const T& n) : num(n), den(1) {}
-
-  template <class T>
-  Quotient(const Quotient<T>& n) : num(n.numerator()), den(n.denominator()) {}
-
-  Quotient& operator=(const NT & n)
-  {
-    num = n;
-    den = 1;
-    return *this;
-  }
-
-  Quotient& operator=(const CGAL_double(NT) & n)
-  {
-    Split_double<NT>()(n, num, den);
-    return *this;
-  }
-
-  Quotient& operator=(const CGAL_int(NT) & n)
-  {
-    num = n;
-    den = 1;
-    return *this;
-  }
-
-#ifdef CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE
-
-  template <class T1, class T2>
-  Quotient(const T1& n, const T2& d) : num(n), den(d)
-  { CGAL_precondition( d != 0 ); }
-
-#else
-  template <class T1, class T2>
-  Quotient(T1 && n, T2 && d)
-     : num(std::forward<T1>(n)), den(std::forward<T2>(d))
-  { CGAL_postcondition( den != 0 ); }
-
-  Quotient(NT && n)
-    : num(std::move(n)), den(1) {}
-
-  Quotient& operator=(NT && n)
-  {
-    num = std::move(n);
-    den = 1;
-    return *this;
-  }
-#endif
-
-  Quotient<NT>& operator+= (const Quotient<NT>& r);
-  Quotient<NT>& operator-= (const Quotient<NT>& r);
-  Quotient<NT>& operator*= (const Quotient<NT>& r);
-  Quotient<NT>& operator/= (const Quotient<NT>& r);
-  Quotient<NT>& operator+= (const NT& r);
-  Quotient<NT>& operator-= (const NT& r);
-  Quotient<NT>& operator*= (const NT& r);
-  Quotient<NT>& operator/= (const NT& r);
-  Quotient<NT>& operator+= (const CGAL_int(NT)& r);
-  Quotient<NT>& operator-= (const CGAL_int(NT)& r);
-  Quotient<NT>& operator*= (const CGAL_int(NT)& r);
-  Quotient<NT>& operator/= (const CGAL_int(NT)& r);
-  Quotient<NT>& operator+= (const CGAL_double(NT)& r);
-  Quotient<NT>& operator-= (const CGAL_double(NT)& r);
-  Quotient<NT>& operator*= (const CGAL_double(NT)& r);
-  Quotient<NT>& operator/= (const CGAL_double(NT)& r);
-
-  Quotient<NT>&    normalize();
-
-  const NT&   numerator()   const { return num; }
-  const NT&   denominator() const { return den; }
-
-  void swap(Quotient &q)
-  {
-    using std::swap;
-    swap(num, q.num);
-    swap(den, q.den);
-  }
-
-#ifdef CGAL_ROOT_OF_2_ENABLE_HISTOGRAM_OF_NUMBER_OF_DIGIT_ON_THE_COMPLEX_CONSTRUCTOR
-  int tam() const { return std::max(num.tam(), den.tam()); }
-#endif
-
- public:
-  NT   num;
-  NT   den;
-};
-
-template <class NT>
-inline
-void swap(Quotient<NT> &p, Quotient<NT> &q)
-{
-  p.swap(q);
-}
-
-template <class NT>
-CGAL_MEDIUM_INLINE
-Quotient<NT>&
-Quotient<NT>::normalize()
-{
-  if (num == den)
-  {
-      num = den = 1;
-      return *this;
-  }
-  if (-num == den)
-  {
-      num = -1;
-      den = 1;
-      return *this;
-  }
-  NT ggt = CGAL_NTS gcd(num, den);
-  if (ggt != 1 )
-  {
-      num = CGAL::integral_division(num, ggt);
-      den = CGAL::integral_division(den, ggt);
-  }
-  return *this;
-}
-
-template <class NT>
-CGAL_MEDIUM_INLINE
-Quotient<NT>&
-Quotient<NT>::operator+= (const Quotient<NT>& r)
-{
-    num = num * r.den + r.num * den;
-    den *= r.den;
-    simplify_quotient(num, den);
-    return *this;
-}
-
-template <class NT>
-CGAL_MEDIUM_INLINE
-Quotient<NT>&
-Quotient<NT>::operator-= (const Quotient<NT>& r)
-{
-    num = num * r.den - r.num * den;
-    den *= r.den;
-    simplify_quotient(num, den);
-    return *this;
-}
-
-template <class NT>
-CGAL_MEDIUM_INLINE
-Quotient<NT>&
-Quotient<NT>::operator*= (const Quotient<NT>& r)
-{
-    num *= r.num;
-    den *= r.den;
-    simplify_quotient(num, den);
-    return *this;
-}
-
-template <class NT>
-CGAL_MEDIUM_INLINE
-Quotient<NT>&
-Quotient<NT>::operator/= (const Quotient<NT>& r)
-{
-    CGAL_precondition( r.num != 0 );
-    num *= r.den;
-    den *= r.num;
-    simplify_quotient(num, den);
-    return *this;
-}
-
-template <class NT>
-CGAL_MEDIUM_INLINE
-Quotient<NT>&
-Quotient<NT>::operator+= (const NT& r)
-{
-    num += r * den;
-    return *this;
-}
-
-template <class NT>
-CGAL_MEDIUM_INLINE
-Quotient<NT>&
-Quotient<NT>::operator-= (const NT& r)
-{
-    num -= r * den;
-    return *this;
-}
-
-template <class NT>
-CGAL_MEDIUM_INLINE
-Quotient<NT>&
-Quotient<NT>::operator*= (const NT& r)
-{
-    num *= r;
-    return *this;
-}
-
-template <class NT>
-CGAL_MEDIUM_INLINE
-Quotient<NT>&
-Quotient<NT>::operator/= (const NT& r)
-{
-    CGAL_precondition( r != 0 );
-    den *= r;
-    return *this;
-}
-
-template <class NT>
-CGAL_MEDIUM_INLINE
-Quotient<NT>&
-Quotient<NT>::operator+= (const CGAL_int(NT)& r)
-{
-    num += r * den;
-    return *this;
-}
-
-template <class NT>
-CGAL_MEDIUM_INLINE
-Quotient<NT>&
-Quotient<NT>::operator-= (const CGAL_int(NT)& r)
-{
-    num -= r * den;
-    return *this;
-}
-
-template <class NT>
-CGAL_MEDIUM_INLINE
-Quotient<NT>&
-Quotient<NT>::operator*= (const CGAL_int(NT)& r)
-{
-    num *= r;
-    return *this;
-}
-
-template <class NT>
-CGAL_MEDIUM_INLINE
-Quotient<NT>&
-Quotient<NT>::operator/= (const CGAL_int(NT)& r)
-{
-    CGAL_precondition( r != 0 );
-    den *= r;
-    return *this;
-}
-
-template <class NT>
-CGAL_MEDIUM_INLINE
-Quotient<NT>&
-Quotient<NT>::operator+= (const CGAL_double(NT)& r)
-{
-  //num += r * den; 
-  NT r_num, r_den; 
-  Split_double<NT>()(r,r_num,r_den);
-  num = num*r_den + r_num*den;
-  den *=r_den; 
-  return *this;
-}
-
-template <class NT>
-CGAL_MEDIUM_INLINE
-Quotient<NT>&
-Quotient<NT>::operator-= (const CGAL_double(NT)& r)
-{
-  //num -= r * den;
-  NT r_num, r_den; 
-  Split_double<NT>()(r,r_num,r_den);
-  num =  num*r_den - r_num*den;
-  den *= r_den; 
-  return *this;
-}
-
-template <class NT>
-CGAL_MEDIUM_INLINE
-Quotient<NT>&
-Quotient<NT>::operator*= (const CGAL_double(NT)& r)
-{
-  // num *= r;
-  
-  NT r_num, r_den; 
-  Split_double<NT>()(r,r_num,r_den);
-  num *= r_num;
-  den *= r_den; 
-  return *this;
-}
-
-template <class NT>
-CGAL_MEDIUM_INLINE
-Quotient<NT>&
-Quotient<NT>::operator/= (const CGAL_double(NT)& r)
-{
-  CGAL_precondition( r != 0 );
-  NT r_num, r_den; 
-  Split_double<NT>()(r,r_num,r_den);
-  num *= r_den;
-  den *= r_num; 
-  return *this;
-}
-
-template <class NT>
-CGAL_MEDIUM_INLINE
-Comparison_result
-quotient_cmp(const Quotient<NT>& x, const Quotient<NT>& y)
-{
-    // No assumptions on the sign of  den  are made
-
-    // code assumes that SMALLER == - 1;
-    CGAL_precondition( SMALLER == static_cast<Comparison_result>(-1) );
-
-    int xsign = CGAL_NTS sign(x.num) * CGAL_NTS sign(x.den) ;
-    int ysign = CGAL_NTS sign(y.num) * CGAL_NTS sign(y.den) ;
-    if (xsign == 0) return static_cast<Comparison_result>(-ysign);
-    if (ysign == 0) return static_cast<Comparison_result>(xsign);
-    // now (x != 0) && (y != 0)
-    int diff = xsign - ysign;
-    if (diff == 0)
-    {
-        int msign = CGAL_NTS sign(x.den) * CGAL_NTS sign(y.den);
-        NT leftop  = x.num * y.den * msign;
-        NT rightop = y.num * x.den * msign;
-        return CGAL_NTS compare(leftop, rightop);
-    }
-    else
-    {
-        return (xsign < ysign) ? SMALLER : LARGER;
-    }
-}
-
-
-template <class NT>
-std::ostream&
-operator<<(std::ostream& s, const Quotient<NT>& r)
-{
-   return s << r.numerator() << '/' << r.denominator();
-}
-
-template <class NT>
-std::istream&
-operator>>(std::istream& in, Quotient<NT>& r)
-{
-  /* format  num/den  or simply  num  */
-
-  NT num,den=1;
-  in >> num;
-  if(!in) return in;
-  std::istream::sentry s(in); // skip whitespace
-  if(in.peek()!='/'){
-	  if(!in.good()){
-		  in.clear(std::ios_base::eofbit);
-		  // unlikely to be some other reason?
-	  }
-  } else {
-	  char c;
-	  in.get(c); // remove the '/'
-	  in >> den;
-	  if(!in) return in;
-  }
-  r=Quotient<NT>(num,den);
-  return in;
-}
-
-template< class NT >
-inline
-Quotient<NT>
-operator+( const Quotient<NT>& x ) {
-  return Quotient<NT>(x);
-}
-
-template <class NT>
-inline
-Quotient<NT>
-operator-(const Quotient<NT>& x)
-{ return Quotient<NT>(-x.num,x.den); }
-
-
-template <class NT>
-CGAL_MEDIUM_INLINE
-NT
-quotient_truncation(const Quotient<NT>& r)
-{ return (r.num / r.den); }
-
-
-
-template <class NT>
-CGAL_MEDIUM_INLINE
-bool
-operator==(const Quotient<NT>& x, const Quotient<NT>& y)
-{ return x.num * y.den == x.den * y.num; }
-
-template <class NT>
-CGAL_MEDIUM_INLINE
-bool
-operator==(const Quotient<NT>& x, const NT& y)
-{ return x.den * y == x.num; }
-
-template <class NT>
-inline
-bool
-operator==(const Quotient<NT>& x, const CGAL_int(NT) & y)
-{ return x.den * y == x.num; }
-
-template <class NT>
-inline
-bool
-operator==(const Quotient<NT>& x, const CGAL_double(NT) & y)
-{ return x.den * y == x.num; }
-
-
-
-template <class NT>
-CGAL_MEDIUM_INLINE
-bool
-operator<(const Quotient<NT>& x, const Quotient<NT>& y)
-{
-  return quotient_cmp(x,y) == SMALLER;
-}
-
-template <class NT>
-CGAL_MEDIUM_INLINE
-bool
-operator<(const Quotient<NT>& x, const NT& y)
-{
-  return quotient_cmp(x,Quotient<NT>(y)) == SMALLER;
-}
-
-template <class NT>
-CGAL_MEDIUM_INLINE
-bool
-operator<(const Quotient<NT>& x, const CGAL_int(NT)& y)
-{
-  return quotient_cmp(x,Quotient<NT>(y)) == SMALLER;
-}
-
-template <class NT>
-CGAL_MEDIUM_INLINE
-bool
-operator<(const Quotient<NT>& x, const CGAL_double(NT)& y)
-{
-  return quotient_cmp(x,Quotient<NT>(y)) == SMALLER;
-}
-
-
-template <class NT>
-inline
-bool
-operator>(const Quotient<NT>& x, const NT& y)
-{ return quotient_cmp(x,Quotient<NT>(y)) == LARGER; }
-
-template <class NT>
-inline
-bool
-operator>(const Quotient<NT>& x, const CGAL_int(NT)& y)
-{ return quotient_cmp(x, Quotient<NT>(y)) == LARGER; }
-
-template <class NT>
-inline
-bool
-operator>(const Quotient<NT>& x, const CGAL_double(NT)& y)
-{ return quotient_cmp(x, Quotient<NT>(y)) == LARGER; }
-
-
-template< class NT >
-class Is_valid< Quotient<NT> >
-  : public std::unary_function< Quotient<NT>, bool > {
-  public :
-    bool operator()( const Quotient<NT>& x ) const {
-      return is_valid(x.num) && is_valid(x.den);
-    }
-};
-
-
-template <class NT>
-inline
-const NT&
-denominator(const Quotient<NT>& q)
-{ return q.den ; }
-
-template <class NT>
-inline
-const NT&
-numerator(const Quotient<NT>& q)
-{ return q.num ; }
-
-// The min/max are functions are needed since LEDA defines template
-// min/max functions which clash with std::min/max with ADL.
-template <class NT>
-inline
-const Quotient<NT>&
-min
-BOOST_PREVENT_MACRO_SUBSTITUTION
-(const Quotient<NT>& p, const Quotient<NT>& q)
-{
-  return (std::min)(p, q);
-}
-template <class NT>
-inline
-const Quotient<NT>&
-max
-BOOST_PREVENT_MACRO_SUBSTITUTION
-(const Quotient<NT>& p, const Quotient<NT>& q)
-{
-  return (std::max)(p, q);
-}
-
-/*
-template <class NT>
-NT
-gcd(const NT&, const NT&)
-{ return NT(1); }
-*/
-
-#undef CGAL_double
-#undef CGAL_int
-
-//
-// Algebraic structure traits
-//
-namespace INTERN_QUOTIENT {
-  template< class NT, class Sqrt_functor >
-  class Sqrt_selector {
-    public:
-      class Sqrt
-        : public std::unary_function< NT, NT > {
-        public:
-          NT operator()( const NT& x ) const {
-            CGAL_precondition(x > 0);
-            return NT(CGAL_NTS sqrt(x.numerator()*x.denominator()),
-                      x.denominator());
-          }
-      };
-  };
-
-  template< class NT >
-  class Sqrt_selector< NT, Null_functor > {
-    public:
-      typedef Null_functor Sqrt;
-  };
-
-// TODO: Algebraic_category could be Field_with_sqrt_tag, if NT
-//       is INEXACT (because Sqrt can be inexact) and has a Sqrt-functor.
-template<class NT> class Algebraic_structure_traits_quotient_base;
-
-template< class NT > class Algebraic_structure_traits_quotient_base< Quotient<NT> >
-  : public Algebraic_structure_traits_base< Quotient<NT>, Field_tag >  {
-
-public:
-    typedef Quotient<NT> Type;
-
-    typedef typename Algebraic_structure_traits<NT>::Is_exact        Is_exact;
-    typedef Tag_false Is_numerical_sensitive;
-
-
-
-    class Is_square
-        : public std::binary_function< Quotient<NT>, Quotient<NT>&, bool > {
-    public:
-        bool operator()( Quotient<NT> x, Quotient<NT>& y ) const {
-            NT x_num, x_den, y_num, y_den;
-            x.normalize();
-            x_num = x.numerator();
-            x_den = x.denominator();
-
-            typename Algebraic_structure_traits<NT>::Is_square is_square;
-            bool num_is_square = is_square(x_num,y_num);
-            bool den_is_square = is_square(x_den,y_den);
-            y= Quotient<NT>(y_num,y_den);
-            return num_is_square && den_is_square;
-        }
-        bool operator()(Quotient<NT> x) const {
-            x.normalize();
-            typename Algebraic_structure_traits<NT>::Is_square is_square;
-            return is_square(x.numerator())&&is_square(x.denominator());
-        }
-
-    };
-
-    typedef typename boost::mpl::if_c<
-        !boost::is_same< typename Algebraic_structure_traits<NT>::Sqrt,
-                         Null_functor >::value,
-         typename INTERN_QUOTIENT::Sqrt_selector< Type,
-                                                  Is_exact >::Sqrt,
-         Null_functor
-                            >::type Sqrt;
-
-    class Simplify
-      : public std::unary_function< Type&, void > {
-      public:
-        void operator()( Type& x) const {
-            x.normalize();
-        }
-    };
-};
-
-
-template<class NT> class Real_embeddable_traits_quotient_base;
-// Real embeddable traits
-template < class NT > class Real_embeddable_traits_quotient_base< Quotient<NT> >
-  : public INTERN_RET::Real_embeddable_traits_base< Quotient<NT>,
-                  typename Real_embeddable_traits< NT >::Is_real_embeddable > {
-  public:
-    typedef Quotient<NT> Type;
-
-    class Compare
-      : public std::binary_function< Type, Type,
-                                Comparison_result > {
-      public:
-        Comparison_result operator()( const Type& x,
-                                            const Type& y ) const {
-          return quotient_cmp(x, y);
-        }
-    };
-
-    class To_double
-      : public std::unary_function< Type, double > {
-      public:
-        double operator()( const Type& x ) const {
-        // Original global function was marked with an TODO!!
-          if (x.num == 0 )
-            return 0;
-
-          double nd = CGAL_NTS to_double( x.num );
-
-          if (x.den == 1 )
-            return nd;
-
-          double dd = CGAL_NTS to_double( x.den );
-
-          if ( CGAL_NTS is_finite( x.den ) && CGAL_NTS is_finite( x.num ) )
-            return nd/dd;
-
-          if ( CGAL_NTS abs(x.num) > CGAL_NTS abs(x.den) )
-          {
-              NT  nt_div = x.num / x.den;
-              double divd = CGAL_NTS to_double(nt_div);
-              if ( divd >= std::ldexp(1.0,53) )
-              { return divd; }
-          }
-          if ( CGAL_NTS abs(x.num) < CGAL_NTS abs(x.den) )
-          { return 1.0 / CGAL_NTS to_double( NT(1) / x ); }
-
-          return nd/dd;
-        }
-    };
-
-    class To_interval
-      : public std::unary_function< Type, std::pair< double, double > > {
-      public:
-        std::pair<double, double> operator()( const Type& x ) const {
-          Interval_nt<> quot =
-                          Interval_nt<>(CGAL_NTS to_interval(x.numerator())) /
-                          Interval_nt<>(CGAL_NTS to_interval(x.denominator()));
-          return std::make_pair(quot.inf(), quot.sup());
-        }
-    };
-
-    class Is_finite
-      : public std::unary_function< Type, bool > {
-      public:
-        bool operator()( const Type& x ) const {
-          return CGAL_NTS is_finite(x.num) && CGAL_NTS is_finite(x.den);
-        }
-    };
-};
-} // namespace INTERN_QUOTIENT
-
-template< class NT > class Algebraic_structure_traits< Quotient<NT> >
-    : public INTERN_QUOTIENT::Algebraic_structure_traits_quotient_base<
-Quotient<NT> >{};
-
-template< class NT > class Real_embeddable_traits< Quotient<NT> >
-    : public INTERN_QUOTIENT::Real_embeddable_traits_quotient_base<
-Quotient<NT> >{};
-
-
-// self coercion
-CGAL_DEFINE_COERCION_TRAITS_FOR_SELF_TEM( Quotient<NT>, class NT)
-
-// from int to Quotient
-template <class NT>
-struct Coercion_traits<typename First_if_different<int, NT>::Type,Quotient<NT> >
-{
-    typedef Tag_true  Are_explicit_interoperable;
-    typedef Tag_true  Are_implicit_interoperable;
-    typedef Quotient<NT> Type;
-    struct Cast{
-        typedef Type result_type;
-        Type operator()(const Quotient<NT>& x)   const { return x;}
-        Type operator()(
-                const typename First_if_different<int, NT>::Type& x) const {
-            return Type(x);}
-    };
-};
-template <class NT>
-struct Coercion_traits<Quotient<NT>,typename First_if_different<int, NT>::Type>
-    :public Coercion_traits<typename First_if_different<int, NT>::Type,
-Quotient<NT> >{};
-
-// from double to Quotient
-template <class NT>
-struct Coercion_traits<typename First_if_different<double, NT>::Type,
-Quotient<NT> >{
-    typedef Tag_true  Are_explicit_interoperable;
-    typedef Tag_true  Are_implicit_interoperable;
-    typedef Quotient<NT> Type;
-    struct Cast{
-        typedef Type result_type;
-        Type operator()(const Quotient<NT>& x)   const { return x;}
-        Type operator()(
-                const typename First_if_different<double, NT>::Type& x) const {
-            return Type(x);}
-    };
-};
-template <class NT>
-struct Coercion_traits<Quotient<NT>,
-typename First_if_different<double, NT>::Type>
-    :public Coercion_traits<typename First_if_different<double, NT>::Type,
-Quotient<NT> >
-{};
-
-// from NT to Quotient
-CGAL_DEFINE_COERCION_TRAITS_FROM_TO_TEM ( NT, Quotient<NT>, class NT)
-
-/*! \ingroup NiX_Fraction_traits_spec
- *  \brief Specialization of Fraction_traits for Quotient<NT>
- */
-template <class NT>
-class Fraction_traits< Quotient<NT> > {
-public:
-    typedef Quotient<NT> Type;
-    typedef ::CGAL::Tag_true Is_fraction;
-    typedef NT Numerator_type;
-    typedef Numerator_type Denominator_type;
-
-    //TODO: check whether Numerator_type has a GCD.
-    //will use Scalar_factor from Scalar_factor_traits (not implemented yet)
-    //for more details see EXACUS:NumeriX/include/NiX/Scalar_factor_traits.h
-    typedef typename Algebraic_structure_traits< Numerator_type >::Gcd Common_factor;
-
-    class Decompose {
-    public:
-        typedef Type first_argument_type;
-        typedef Numerator_type& second_argument_type;
-        typedef Numerator_type& third_argument_type;
-        void operator () (
-                const Type& rat,
-                Numerator_type& num,
-                Numerator_type& den) {
-            num = rat.numerator();
-            den = rat.denominator();
-        }
-    };
-
-    class Compose {
-    public:
-        typedef Numerator_type first_argument_type;
-        typedef Numerator_type second_argument_type;
-        typedef Type result_type;
-        Type operator ()(
-                const Numerator_type& num ,
-                const Numerator_type& den ) {
-            Type result(num, den);
-            return result;
-        }
-    };
-};
-
-} //namespace CGAL
-
-namespace Eigen {
-  template<class> struct NumTraits;
-  template<class NT> struct NumTraits<CGAL::Quotient<NT> >
-  {
-    typedef CGAL::Quotient<NT> Real;
-    typedef CGAL::Quotient<NT> NonInteger;
-    typedef CGAL::Quotient<NT> Nested;
-
-    static inline Real epsilon() { return NumTraits<NT>::epsilon(); }
-    static inline Real dummy_precision() { return NumTraits<NT>::dummy_precision(); }
-
-    enum {
-      IsInteger = 0,
-      IsSigned = 1,
-      IsComplex = 0,
-      RequireInitialization = NumTraits<NT>::RequireInitialization,
-      ReadCost = 2*NumTraits<NT>::ReadCost,
-      AddCost = 150,
-      MulCost = 100
-    };
-  };
-}
-
-#endif  // CGAL_QUOTIENT_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Random.h b/3rdparty/CGAL-4.8/include/CGAL/Random.h
deleted file mode 100644
index 665dd78..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Random.h
+++ /dev/null
@@ -1,254 +0,0 @@
-// Copyright (c) 1997-2001  
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved. 
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Sven Schoenherr <sven at inf.ethz.ch>, Sylvain Pion, Andreas Fabri
-
-#ifndef CGAL_RANDOM_H
-#define CGAL_RANDOM_H
-
-#include <string>
-#include <utility>
-#include <CGAL/basic.h>
-
-#if defined(BOOST_MSVC)
-#  pragma warning(push)
-#  pragma warning(disable:4244)
-#endif
-#include <boost/random/uniform_smallint.hpp>
-#if defined(BOOST_MSVC)
-#  pragma warning(pop)
-#endif
-#include <boost/random/linear_congruential.hpp>
-#include <boost/random/uniform_int.hpp>
-#include <boost/random/uniform_real.hpp>
-#include <boost/random/uniform_01.hpp>
-#include <boost/random/variate_generator.hpp>
-
-namespace CGAL {
-
-class Random {
-public:
-  // types
-  
-  struct State {
-    std::string rng;
-    unsigned int random_value, val, seed;
-    
-    State()
-    {}
-    
-    State(std::string rng, 
-          unsigned int random_value, 
-          unsigned int val, 
-          unsigned int seed)
-      : rng(rng), random_value(random_value), val(val), seed(seed)
-    {}
-  };
-  // creation
-  CGAL_EXPORT Random( );
-  CGAL_EXPORT Random( unsigned int  seed);
-  
-  // seed
-  CGAL_EXPORT unsigned int get_seed ( ) const;
-    
-  // operations
-  bool get_bool( )
-  {
-    return( static_cast< bool>( rng() & 1));
-  }
-
-
-  template <typename IntType>
-  IntType
-  uniform_smallint(IntType lower, IntType upper)
-  {
-    // uniform_smallint has a closed interval, CGAL a halfopen
-    boost::uniform_smallint<IntType> dist(lower,upper-1);
-    boost::variate_generator<boost::rand48&, boost::uniform_smallint<IntType> > generator(rng,dist);
-    
-    return generator();
-  }
-
-  template <typename IntType>
-  IntType
-  uniform_smallint(IntType lower)
-  {
-    return uniform_smallint<IntType>(lower,9);
-  }
-
-  template <typename IntType>
-  IntType
-  uniform_smallint()
-  {
-    return uniform_smallint<IntType>(0,9);
-  }
-
-  template <typename IntType>
-  IntType
-  uniform_int(IntType lower, IntType upper)
-  {
-    // uniform_int has a closed interval, CGAL a halfopen
-    boost::uniform_int<IntType> dist(lower,upper);
-    boost::variate_generator<boost::rand48&, boost::uniform_int<IntType> > generator(rng,dist);
-    
-    return generator();
-  }
-
-
-  template <typename IntType>
-  IntType
-  uniform_int(IntType lower)
-  {
-    return uniform_int<IntType>(lower,9);
-  }
-
-  template <typename IntType>
-  IntType
-  uniform_int()
-  {
-    return uniform_int<IntType>(0,9);
-  }
- 
-
-  
-  template <typename IntType>
-  IntType
-  operator () (IntType upper)
-  {
-    return uniform_int<IntType>(0, upper-1);
-  }
- 
-  int
-  get_int(int lower, int upper)
-  {
-    return uniform_int<int>(lower,upper-1);
-  }
-
-
-  template <typename RealType>
-  RealType
-  uniform_real( RealType lower, RealType upper)
-  {
-    // uniform_real as well as CGAL have a halfopen interval
-    boost::uniform_real<RealType> dist(lower,upper);
-    boost::variate_generator<boost::rand48&, boost::uniform_real<RealType> > generator(rng,dist);
-    
-    return generator();
-  }
-
-
-  template <typename RealType>
-  RealType
-  uniform_real( RealType lower)
-  {
-    return uniform_real<RealType>(lower, 1.0);
-  }
-
-
-  template <typename RealType>
-  RealType
-  uniform_real()
-  {
-    return uniform_real<RealType>(0.0, 1.0);
-  }
-
-
-  template <typename RealType>
-  RealType
-  uniform_01()
-  {
-    // uniform_01 as well as CGAL have a halfopen interval
-    boost::uniform_01<RealType> dist;
-    boost::variate_generator<boost::rand48&, boost::uniform_01<RealType> > generator(rng,dist);
-    
-    return generator();
-  }
-
-
-  double
-  get_double( double lower = 0.0, double upper = 1.0)
-  {
-    return uniform_real<double>(lower, upper);
-  }
-
-    // state 
-    CGAL_EXPORT void save_state( State& state) const;
-    CGAL_EXPORT void restore_state( const State& state);
-
-    // Computes a random int value smaller than 2^b.
-    // It's supposed to be fast, useful for randomized algorithms.
-    // The distribution is not perfectly flat, but this is a sacrifice against
-    // efficiency.
-    template <int b>
-    int get_bits()
-    {
-	CGAL_assertion(0<b && b<16);
-        if (val == 0) {
-            random_value = (421U * random_value + 2073U) % 32749U;
-            val = random_value;
-        }
-        int ret = val & ((1<<b)-1);
-        val >>= 1; // Shifting by b would be slightly better, but is slower.
-        return ret;
-    }
-
-    
-  bool    operator==(Random rd) const
-  {
-    return (rng == rd.rng) 
-      && (random_value == rd.random_value)
-      && (val == rd.val)
-      && (seed == rd.seed);
-  }
-
-  private:
-    // data members
-    unsigned int random_value; // Current 15 bits random value.
-    unsigned int val; // random_value shifted by used bits.
-    unsigned int seed; 
-    boost::rand48 rng;
-};
-
-#ifndef CGAL_HEADER_ONLY
-// Global variables
-// ================
-CGAL_EXPORT extern  Random  default_random;
-#endif // CGAL_HEADER_ONLY
-
-#ifdef CGAL_HEADER_ONLY
-inline Random& get_default_random()
-{
-  static Random default_random;
-  return default_random;
-}
-#else // CGAL_HEADER_ONLY
-inline Random& get_default_random()
-{ return default_random; }
-#endif // CGAL_HEADER_ONLY
-
-} //namespace CGAL
-
-#ifdef CGAL_HEADER_ONLY
-#include <CGAL/Random_impl.h>
-#endif // CGAL_HEADER_ONLY
-
-#endif // CGAL_RANDOM_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Random_impl.h b/3rdparty/CGAL-4.8/include/CGAL/Random_impl.h
deleted file mode 100644
index 16cb9e0..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Random_impl.h
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright (c) 1997-2001
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Sven Schönherr <sven at inf.ethz.ch>
-
-#ifdef CGAL_HEADER_ONLY
-#define CGAL_INLINE_FUNCTION inline
-#else
-#define CGAL_INLINE_FUNCTION
-#endif
-
-#include <ctime>
-#include <sstream>
-
-namespace CGAL {
-
-// Class implementation (continued)
-// ================================
-
-// constructors
-CGAL_INLINE_FUNCTION
-Random::
-Random( )
-    :  val(0)
-{
-    // get system's time
-    std::time_t s;
-    std::time( &s);
-    seed = (unsigned int)s;
-
-    // initialize random numbers generator
-    rng.seed(static_cast<boost::int32_t>(seed));
-    random_value = get_int(0, 1<<15);
-}
-
-CGAL_INLINE_FUNCTION
-Random::
-Random( unsigned int  seed)
-    : val(0), seed(seed)
-{
-    // initialize random numbers generator
-    rng.seed(static_cast<boost::int32_t>(seed));
-    random_value = get_int(0, 1<<15);
-}
-
-// seed
-CGAL_INLINE_FUNCTION
-unsigned int
-Random::get_seed () const
-{
-  return seed;
-}
-
-// state
-CGAL_INLINE_FUNCTION
-void
-Random::save_state( Random::State& state) const
-{
-  std::ostringstream os;
-  os << rng;
-  state = Random::State(os.str(),random_value, val, seed);
-}
-
-CGAL_INLINE_FUNCTION
-void
-Random::restore_state( const Random::State& state)
-{
-  std::istringstream is(state.rng);
-  is >> rng;
-  random_value = state.random_value;
-  val = state.val;
-  seed = state.seed;
-}
-
-} //namespace CGAL
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Reconstruction_triangulation_3.h b/3rdparty/CGAL-4.8/include/CGAL/Reconstruction_triangulation_3.h
deleted file mode 100644
index 18e0499..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Reconstruction_triangulation_3.h
+++ /dev/null
@@ -1,514 +0,0 @@
-// Copyright (c) 2007  INRIA (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
-// 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(s)     : Laurent Saboret, Pierre Alliez
-
-
-#ifndef CGAL_IMPLICIT_FCT_DELAUNAY_TRIANGULATION_H
-#define CGAL_IMPLICIT_FCT_DELAUNAY_TRIANGULATION_H
-
-#include <CGAL/Point_with_normal_3.h>
-#include <CGAL/Lightweight_vector_3.h>
-#include <CGAL/property_map.h>
-#include <CGAL/surface_reconstruction_points_assertions.h>
-
-#include <CGAL/Delaunay_triangulation_3.h>
-#include <CGAL/Triangulation_cell_base_with_info_3.h>
-#include <CGAL/Min_sphere_of_spheres_d.h>
-#include <CGAL/Min_sphere_of_points_d_traits_3.h>
-#include <CGAL/centroid.h>
-
-#include <boost/random/random_number_generator.hpp>
-#include <boost/random/linear_congruential.hpp>
-
-#include <vector>
-#include <iterator>
-
-namespace CGAL {
-
-/// \internal
-/// The Reconstruction_vertex_base_3 class is the default
-/// vertex class of the Reconstruction_triangulation_3 class.
-///
-/// It provides the interface requested by the Poisson_reconstruction_function class:
-/// - Each vertex stores a normal vector.
-/// - A vertex is either an input point or a Steiner point added by Delaunay refinement.
-/// - In order to solve a linear system over the triangulation, a vertex may be constrained
-///   or not (i.e. may contribute to the right or left member of the linear system),
-///   and has a unique index.
-///
-/// @param Gt   Geometric traits class / Point_3 is a typedef to Point_with_normal_3.
-/// @param Cb   Vertex base class, model of TriangulationVertexBase_3.
-
-template < typename Gt,
-           typename Vb = Triangulation_vertex_base_3<Gt> >
-class Reconstruction_vertex_base_3 : public Vb
-{
-// Public types
-public:
-
-  /// Geometric traits class / Point_3 is a typedef to Point_with_normal_3.
-  typedef Gt Geom_traits;
-
-  // Repeat Triangulation_vertex_base_3 public types
-  /// \cond SKIP_IN_MANUAL
-  typedef typename Vb::Cell_handle Cell_handle;
-  template < typename TDS2 >
-  struct Rebind_TDS {
-    typedef typename Vb::template Rebind_TDS<TDS2>::Other                       Vb2;
-    typedef Reconstruction_vertex_base_3<Geom_traits, Vb2> Other;
-  };
-  /// \endcond
-
-  // Geometric types
-  typedef typename Geom_traits::FT FT;
-  typedef typename Geom_traits::Vector_3 Vector;           ///< typedef to Vector_3
-  typedef typename Geom_traits::Point_3 Point;             ///< typedef to Point_with_normal_3
-  typedef typename Geom_traits::Point_3 Point_with_normal; ///< typedef to Point_with_normal_3
-
-// data members
-private:
-
-  // TODO: reduce memory footprint
-  FT m_f; // value of the implicit function // float precise enough?
-  bool m_constrained; // is vertex constrained? // combine constrained and type
-  unsigned char m_type; // INPUT or STEINER
-  unsigned int m_index; // index in matrix (to be stored outside)
-
-// Public methods
-public:
-
-  Reconstruction_vertex_base_3()
-    : Vb(), m_f(FT(0.0)), m_type(0), m_index(0)
-  {}
-
-  Reconstruction_vertex_base_3(const Point_with_normal& p)
-    : Vb(p), m_f(FT(0.0)), m_type(0), m_index(0)
-  {}
-
-  Reconstruction_vertex_base_3(const Point_with_normal& p, Cell_handle c)
-    : Vb(p,c), m_f(FT(0.0)), m_type(0), m_index(0)
-  {}
-
-  Reconstruction_vertex_base_3(Cell_handle c)
-    : Vb(c), m_f(FT(0.0)), m_type(0), m_index(0)
-  {}
-
-
-  /// Gets/sets the value of the implicit function.
-  /// Default value is 0.0.
-  FT  f() const { return m_f; }
-  FT& f()       { return m_f; }
-
-  /// Gets/sets the type = INPUT or STEINER.
-  unsigned char  type() const { return m_type; }
-  unsigned char& type()       { return m_type; }
-
-  /// Gets/sets the index in matrix.
-  unsigned int  index() const { return m_index; }
-  unsigned int& index()       { return m_index; }
-
-  /// Gets/sets normal vector.
-  /// Default value is null vector.
-  const Vector& normal() const { return this->point().normal(); }
-  Vector&       normal()       { return this->point().normal(); }
-
-// Private methods
-private:
-
-    /// Copy constructor and operator =() are not implemented.
-    Reconstruction_vertex_base_3(const Reconstruction_vertex_base_3& toCopy);
-    Reconstruction_vertex_base_3& operator =(const Reconstruction_vertex_base_3& toCopy);
-
-}; // end of Reconstruction_vertex_base_3
-
-
-/// \internal
-/// Helper class:
-/// Reconstruction_triangulation_default_geom_traits_3
-/// changes in a geometric traits class the Point_3 type to
-/// Point_with_normal_3<BaseGt>.
-///
-/// @param BaseGt   Geometric traits class.
-template <class BaseGt>
-struct Reconstruction_triangulation_default_geom_traits_3 : public BaseGt
-{
-  typedef Point_with_normal_3<BaseGt> Point_3;
-};
-
-
-/// \internal
-/// The Reconstruction_triangulation_3 class
-/// provides the interface requested by the Poisson_reconstruction_function class:
-/// - Each vertex stores a normal vector.
-/// - A vertex is either an input point or a Steiner point added by Delaunay refinement.
-/// - In order to solve a linear system over the triangulation, a vertex may be constrained
-///   or not (i.e. may contribute to the right or left member of the linear system),
-///   and has a unique index.
-/// The vertex class must derive from Reconstruction_vertex_base_3.
-///
-/// @param BaseGt   Geometric traits class.
-/// @param Gt       Geometric traits class / Point_3 is a typedef to Point_with_normal_3<BaseGt>.
-/// @param Tds      Model of TriangulationDataStructure_3. The vertex class
-///                 must derive from Reconstruction_vertex_base_3.
-
-template <class BaseGt,
-          class Gt = Reconstruction_triangulation_default_geom_traits_3<BaseGt>,
-          class Tds_ = Triangulation_data_structure_3<Reconstruction_vertex_base_3<Gt>, Triangulation_cell_base_with_info_3<int,Gt> > >
-class Reconstruction_triangulation_3 : public Delaunay_triangulation_3<Gt,Tds_>
-{
-// Private types
-private:
-
-  // Base class
-  typedef Delaunay_triangulation_3<Gt,Tds_>  Base;
-
-  // Auxiliary class to build an iterator over input points.
-  class Is_steiner_point
-  {
-  public:
-      typedef typename Base::Finite_vertices_iterator Finite_vertices_iterator;
-
-      bool operator()(const Finite_vertices_iterator& v) const
-      {
-        return (v->type() == Reconstruction_triangulation_3::STEINER);
-      }
-  };
-
-// Public types
-public:
-
-  /// Geometric traits class / Point_3 is a typedef to Point_with_normal_3<BaseGt>.
-  typedef Gt  Geom_traits;
-
-  // Repeat base class' types
-  /// \cond SKIP_IN_MANUAL
-  typedef Tds_ Triangulation_data_structure;
-  typedef typename Base::Segment      Segment;
-  typedef typename Base::Triangle     Triangle;
-  typedef typename Base::Tetrahedron  Tetrahedron;
-  typedef typename Base::Line         Line;
-  typedef typename Base::Ray          Ray;
-  typedef typename Base::Object       Object;
-  typedef typename Base::Cell_handle   Cell_handle;
-  typedef typename Base::Vertex_handle Vertex_handle;
-  typedef typename Base::Cell   Cell;
-  typedef typename Base::Vertex Vertex;
-  typedef typename Base::Facet  Facet;
-  typedef typename Base::Edge   Edge;
-  typedef typename Base::Cell_circulator  Cell_circulator;
-  typedef typename Base::Facet_circulator Facet_circulator;
-  typedef typename Base::Cell_iterator    Cell_iterator;
-  typedef typename Base::Facet_iterator   Facet_iterator;
-  typedef typename Base::Edge_iterator    Edge_iterator;
-  typedef typename Base::Vertex_iterator  Vertex_iterator;
-  typedef typename Base::Point_iterator Point_iterator;
-  typedef typename Base::Finite_vertices_iterator Finite_vertices_iterator;
-  typedef typename Base::Finite_cells_iterator    Finite_cells_iterator;
-  typedef typename Base::Finite_facets_iterator   Finite_facets_iterator;
-  typedef typename Base::Finite_edges_iterator    Finite_edges_iterator;
-  typedef typename Base::All_cells_iterator       All_cells_iterator;
-  typedef typename Base::All_vertices_iterator       All_vertices_iterator;
-  typedef typename Base::Locate_type Locate_type;
-  /// \endcond
-
-  // Geometric types
-  typedef typename Geom_traits::FT FT;
-  typedef typename Geom_traits::Vector_3 Vector; ///< typedef to Vector_3<BaseGt>
-  typedef typename Geom_traits::Point_3 Point;  ///< typedef to Point_with_normal_3<BaseGt>
-  typedef typename Geom_traits::Point_3 Point_with_normal; ///< Point_with_normal_3<BaseGt>
-  typedef typename Geom_traits::Sphere_3 Sphere;
-
-  /// Point type
-  enum Point_type {
-    INPUT=0,    ///< Input point.
-    STEINER=1   ///< Steiner point created by Delaunay refinement.
-  };
-
-  /// Iterator over input vertices.
-  typedef Filter_iterator<Finite_vertices_iterator, Is_steiner_point>
-                                                    Input_vertices_iterator;
-
-  /// Iterator over input points.
-  typedef Iterator_project<Input_vertices_iterator,
-                           Project_point<Vertex> >  Input_point_iterator;
-
-  mutable Sphere sphere;
-  std::vector<Point_with_normal> points;
-  std::size_t fraction;
-  std::list<double> fractions;
-  Vertex_handle constrained_vertex;
-
-
-public:
-
-  /// Default constructor.
-  Reconstruction_triangulation_3()
-  {}
-
-  ~Reconstruction_triangulation_3()
-  {}
-
-  // Default copy constructor and operator =() are fine.
-
-  // Repeat base class' public methods used below
-  /// \cond SKIP_IN_MANUAL
-  using Base::points_begin;
-  using Base::points_end;
-  using Base::number_of_vertices;
-  using Base::finite_vertices_begin;
-  using Base::finite_vertices_end;
-  using Base::all_vertices_begin;
-  using Base::all_vertices_end;
-
-  using Base::geom_traits;
-  /// \endcond
-
-  /// Gets first iterator over input vertices.
-  Input_vertices_iterator input_vertices_begin() const
-  {
-      return Input_vertices_iterator(finite_vertices_end(), Is_steiner_point(),
-                                     finite_vertices_begin());
-  }
-  /// Gets past-the-end iterator over input vertices.
-  Input_vertices_iterator input_vertices_end() const
-  {
-      return Input_vertices_iterator(finite_vertices_end(), Is_steiner_point());
-  }
-
-  /// Gets iterator over the first input point.
-  Input_point_iterator input_points_begin() const
-  {
-      return Input_point_iterator(input_vertices_begin());
-  }
-  /// Gets past-the-end iterator over the input points.
-  Input_point_iterator input_points_end() const
-  {
-      return Input_point_iterator(input_vertices_end());
-  }
-
-  /// Gets the bounding sphere of input points.
-
-
-  Sphere bounding_sphere() const
-  {
-    return sphere;
-  }
-
-  void initialize_bounding_sphere() const
-  {
-    typedef Min_sphere_of_points_d_traits_3<Gt,FT> Traits;
-    typedef Min_sphere_of_spheres_d<Traits> Min_sphere;
-   
-    // Computes min sphere
-    Min_sphere ms(points.begin(),points.end());
-
-    typename Min_sphere::Cartesian_const_iterator coord = ms.center_cartesian_begin();
-    FT cx = *coord++;
-    FT cy = *coord++;
-    FT cz = *coord;
-
-    sphere = Sphere(Point(cx,cy,cz), ms.radius()*ms.radius());
-  }
-
-  /// Insert point in the triangulation.
-  /// Default type is INPUT.
-  template <typename Visitor>
-  Vertex_handle insert(const Point_with_normal& p,
-                       Point_type type,// = INPUT,
-                       Cell_handle start,// = Cell_handle(),
-                       Visitor visitor)
-  {
-
-    if(type == INPUT){
-      visitor.before_insertion();
-    }
-    if(this->dimension() < 3){
-      Vertex_handle v = Base::insert(p, start);
-      v->type() = type;
-      return v;
-    }
-    typename Base::Locate_type lt;
-    int li, lj;
-    Cell_handle ch = Base::locate(p, lt, li, lj, start);
-
-    Vertex_handle v = Base::insert(p, lt, ch, li, lj);
-    v->type() = type;
-    return v;
-    
-  }
-
-  /// Insert the [first, beyond) range of points in the triangulation using a spatial sort.
-  /// Default type is INPUT.
-  ///
-  /// @commentheading Template Parameters:
-  /// @param InputIterator iterator over input points.
-  /// @param PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3.
-  ///        It can be omitted if InputIterator value_type is convertible to Point_3.
-  /// @param NormalPMap is a model of `ReadablePropertyMap` with a value_type = Vector_3.
-  ///
-  /// @return the number of inserted points.
-
-  // This variant requires all parameters.
-  template <typename InputIterator,
-            typename PointPMap,
-            typename NormalPMap,
-            typename Visitor
-  >
-  int insert(
-    InputIterator first,  ///< iterator over the first input point.
-    InputIterator beyond, ///< past-the-end iterator over the input points.
-    PointPMap point_pmap, ///< property map: `value_type of InputIterator` -> `Point_3` (the position of an input point).
-    NormalPMap normal_pmap, ///< property map: `value_type of InputIterator` -> `Vector_3` (the *oriented* normal of an input point).
-    Visitor visitor)
-  {
-    if(! points.empty()){
-      std::cerr << "WARNING: not all points inserted yet" << std::endl;
-    }
-    // Convert input points to Point_with_normal_3
-    //std::vector<Point_with_normal> points;
-    for (InputIterator it = first; it != beyond; ++it)
-    {
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-      Point_with_normal pwn(get(point_pmap,it), get(normal_pmap,it));
-#else
-      Point_with_normal pwn(get(point_pmap,*it), get(normal_pmap,*it));
-#endif
-      points.push_back(pwn);
-    }
-    std::size_t n = points.size();
-
-    initialize_bounding_sphere();
-
-    boost::rand48 random;
-    boost::random_number_generator<boost::rand48> rng(random);
-    std::random_shuffle (points.begin(), points.end(), rng);
-    fraction = 0;
-
-    fractions.clear();
-    fractions.push_back(1.0);
-    
-    double m = static_cast<double>(n);
-    
-    while(m > 500){
-      m /= 2;
-      fractions.push_front(m/n);
-    }
-    
-    insert_fraction(visitor);
-    return 0;
-  }
-
-  template <typename Visitor>
-  bool insert_fraction(Visitor visitor)
-  {
-    if(fractions.empty()){
-      points.clear();
-      return false;
-    }
-    double frac = fractions.front();
-    fractions.pop_front();
-    std::size_t more = (std::size_t)(points.size() * frac) - fraction;
-    if((fraction+more) > points.size()){
-      more = points.size() - fraction;
-    }
-    Cell_handle hint;
-    spatial_sort (points.begin()+fraction, points.begin()+fraction+more, geom_traits());
-    for (typename std::vector<Point_with_normal>::const_iterator p = points.begin()+fraction;
-         p != points.begin()+fraction+more; ++p)
-    {
-      Vertex_handle v = insert(*p, INPUT, hint, visitor);
-      hint = v->cell();
-    }
-    fraction += more;
-    return true;
-  }
-
-  /// \cond SKIP_IN_MANUAL
-  // This variant creates a default point property map = Identity_property_map.
-  template <typename InputIterator,
-            typename NormalPMap,
-            typename Visitor
-  >
-  int insert(
-    InputIterator first,  ///< iterator over the first input point.
-    InputIterator beyond, ///< past-the-end iterator over the input points.
-    NormalPMap normal_pmap, ///< property map: `value_type of InputIterator` -> `Vector_3` (the *oriented* normal of an input point).
-    Visitor visitor)
-  {
-    return insert(
-      first,beyond,
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-      make_dereference_property_map(first),
-#else
-      make_identity_property_map(
-      typename std::iterator_traits<InputIterator>::value_type()),
-#endif
-      normal_pmap,
-      visitor);
-  }
-  /// \endcond
-
-  /// Delaunay refinement callback:
-  /// insert STEINER point in the triangulation.
-  template <class CellIt>
-  Vertex_handle
-  insert_in_hole(const Point_with_normal& p, CellIt cell_begin, CellIt cell_end,
-	         Cell_handle begin, int i,
-                 Point_type type = STEINER)
-  {
-      Vertex_handle v = Base::insert_in_hole(p, cell_begin, cell_end, begin, i);
-      v->type() = type;
-      return v;
-  }
-
-  /// Index unconstrained vertices following the order of Finite_vertices_iterator.
-  /// @return the number of unconstrained vertices.
-  unsigned int index_unconstrained_vertices()
-  {
-    unsigned int index = 0;
-    for (Finite_vertices_iterator v = finite_vertices_begin(),
-         e = finite_vertices_end();
-         v!= e;
-         ++v)
-    {
-      if(! is_constrained(v))
-        v->index() = index++;
-    }
-    return index;
-  }
-
-  /// Is vertex constrained, i.e.
-  /// does it contribute to the right or left member of the linear system?
-
-  bool is_constrained(Vertex_handle v) const
-  {
-    return v == constrained_vertex;
-  }
-
-  void constrain(Vertex_handle v)
-  {
-    constrained_vertex = v;
-  }
-  
-
-}; // end of Reconstruction_triangulation_3
-
-} //namespace CGAL
-
-#endif // CGAL_IMPLICIT_FCT_DELAUNAY_TRIANGULATION_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Regular_complex_d.h b/3rdparty/CGAL-4.8/include/CGAL/Regular_complex_d.h
deleted file mode 100644
index 3639731..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Regular_complex_d.h
+++ /dev/null
@@ -1,736 +0,0 @@
-// Copyright (c) 1997-2000  Max-Planck-Institute Saarbruecken (Germany).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Michael Seel <seel at mpi-sb.mpg.de>
-//---------------------------------------------------------------------
-// file generated by notangle from regl_complex.lw
-// please debug or modify LEDA web file
-// mails and bugs: Michael.Seel at mpi-sb.mpg.de
-// based on LEDA architecture by S. Naeher, C. Uhrig
-// coding: K. Mehlhorn, M. Seel
-// debugging and templatization: M. Seel
-//---------------------------------------------------------------------
-
-#ifndef CGAL_REGULAR_COMPLEX_D_H
-#define CGAL_REGULAR_COMPLEX_D_H
-#define CGAL_DEPRECATED_HEADER "<CGAL/Regular_complex_d.h>"
-#define CGAL_REPLACEMENT_HEADER "the Triangulation package (see http://doc.cgal.org/latest/Triangulation)"
-#include <CGAL/internal/deprecation_warning.h>
-
-#include <CGAL/basic.h>
-#include <CGAL/Iterator_project.h>
-#include <CGAL/Compact_container.h>
-#include <vector>
-#include <list>
-#include <cstddef>
-
-#include <CGAL/Kernel_d/debug.h>
-
-#ifdef CGAL_USE_LEDA
-#if CGAL_LEDA_VERSION < 500
-#include <LEDA/memory.h>
-#else
-#include <LEDA/system/memory.h>
-#endif
-#endif
-
-namespace CGAL {
-
-template <class R> class RC_simplex_d;
-template <class R> class RC_vertex_d;
-template <class R> class Regular_complex_d;
-template <class R> class Convex_hull_d;
-
-#define forall_rc_vertices(x,RC)\
-for(x = (RC).vertices_begin(); x != (RC).vertices_end(); ++x) 
-#define forall_rc_simplices(x,RC)\
-for(x = (RC).simplices_begin(); x != (RC).simplices_end(); ++x) 
-
-
-template <class Refs>
-class RC_vertex_d 
-
-{ typedef RC_vertex_d<Refs> Self;
-  typedef typename Refs::Point_d Point_d;
-  typedef typename Refs::Vertex_handle Vertex_handle;
-  typedef typename Refs::Simplex_handle Simplex_handle;
-  typedef typename Refs::R R;
-  friend class Regular_complex_d<R>;
-  friend class Convex_hull_d<R>;
-  friend class RC_simplex_d<Refs>;
-  Simplex_handle s_;
-  int            index_;
-  Point_d        point_;
-
-  void set_simplex(Simplex_handle s) { s_=s; }
-  void set_index(int i) { index_=i; }
-  void set_point(const Point_d& p) { point_=p; }
-
-public:
-  RC_vertex_d(Simplex_handle s, int i, const Point_d& p) :
-    s_(s), index_(i), point_(p) {}
-  RC_vertex_d(const Point_d& p) : point_(p), pp(NULL) {}
-  RC_vertex_d() :  s_(), index_(-42), pp(NULL) {}
-  // beware that ass_point was initialized here by nil_point
-  ~RC_vertex_d() {}
-
-  Simplex_handle simplex() const { return s_; }
-  int index() const { return index_; }
-  const Point_d& point() const { return point_; }
-
-  void* pp;
-  void*   for_compact_container() const { return pp; }
-  void* & for_compact_container()       { return pp; }
-
-#ifdef CGAL_USE_LEDA
-  LEDA_MEMORY(RC_vertex_d)
-#endif
-};
-
-
-template <class Refs>
-class RC_simplex_d 
-{ typedef RC_simplex_d<Refs>  Self;
-  typedef typename Refs::Point_d Point_d;
-  typedef typename Refs::Vertex_handle Vertex_handle;
-  typedef typename Refs::Simplex_handle Simplex_handle;
-  typedef typename Refs::R R;
-  friend class Regular_complex_d<R>;
-  friend class Convex_hull_d<R>;
-protected:
-  std::vector<Vertex_handle>   vertices;    // array of vertices
-  std::vector<Simplex_handle>  neighbors;   // opposite simplices
-  std::vector<int>             opposite_vertices; 
-                               // indices of opposite vertices
-
-  //------ only for convex hulls ------------------
-  typedef typename R::Hyperplane_d Hyperplane_d;
-  Hyperplane_d h_base;   // hyperplane supporting base facet
-  bool         visited_; // visited mark when traversing
-  //------ only for convex hulls ------------------
-
-  Vertex_handle  vertex(int i) const { return vertices[i]; }
-  Simplex_handle neighbor(int i) const { return neighbors[i]; }
-  int opposite_vertex_index(int i) const { return opposite_vertices[i]; }
-
-  void set_vertex(int i, Vertex_handle v) { vertices[i] = v; }
-  void set_neighbor(int i, Simplex_handle s) { neighbors[i]=s; }
-  void set_opposite_vertex_index(int i, int index) 
-  { opposite_vertices[i]=index; }
-
-  //------ only for convex hulls ------------------
-  Hyperplane_d hyperplane_of_base_facet() const { return h_base; }
-  void set_hyperplane_of_base_facet(const Hyperplane_d& h) { h_base = h; }
-  bool& visited() { return visited_; }
-  //------ only for convex hulls ------------------
-
-public:
-  typedef typename std::vector<Vertex_handle>::const_iterator 
-          VIV_iterator;
-  struct Point_from_VIV_iterator {
-    typedef Vertex_handle argument_type;
-    typedef Point_d      result_type;
-    result_type& operator()(argument_type& x) const 
-    { return x->point(); }
-    const result_type& operator()(const argument_type& x) const 
-    { return x->point(); }
-  };
-
-  typedef CGAL::Iterator_project<VIV_iterator,Point_from_VIV_iterator,
-    const Point_d&, const Point_d*> Point_const_iterator;
-
-  Point_const_iterator points_begin() const 
-  { return Point_const_iterator(vertices.begin()); }
-  Point_const_iterator points_end() const 
-  { return Point_const_iterator(vertices.end()); }
-
-  void* pp;
-  void*   for_compact_container() const { return pp; }
-  void* & for_compact_container()       { return pp; }
-
-  #if 0
-  struct Point_const_iterator {
-    typedef Point_const_iterator self;
-    typedef std::random_access_iterator_tag iterator_category;
-    typedef const Point_d&                  value_type;
-    typedef std::ptrdiff_t                  difference_type;
-    typedef const Point_d*                  pointer;
-    typedef const Point_d&                  reference;
-
-    typedef typename std::vector<Vertex_handle>::const_iterator 
-      ra_vertex_iterator;
-
-    Point_const_iterator() : _it() {}
-    Point_const_iterator(ra_vertex_iterator it) : _it(it) {}
-      
-    value_type operator*() const { return (*_it)->point(); }
-    pointer operator->() const { return &(operator*()); }
-
-    self& operator++() { ++_it; return *this; }
-    self  operator++(int) { self tmp = *this; ++_it; return tmp; }
-    self& operator--() { --_it; return *this; }
-    self  operator--(int) { self tmp = *this; --_it; return tmp; }
-
-    self& operator+=(difference_type i) { _it+=i; return *this; }
-    self& operator-=(difference_type i) { _it-=i; return *this; }
-    self operator+(difference_type i) const 
-    { self tmp=*this; tmp+=i; return tmp; }
-    self operator-(difference_type i) const 
-    { self tmp=*this; tmp-=i; return tmp; }
-
-    difference_type operator-(self x) const { return _it-x._it; }
-    reference operator[](difference_type i) { return *(*this + i); }
-
-    bool operator==(const self& x) const { return _it==x._it; }
-    bool operator!=(const self& x) const { return ! (*this==x); }
-    bool operator<(self x) const { (x - *this) > 0; }
-
-    private:
-      ra_vertex_iterator _it;  
-  }; // Point_const_iterator
-
-  Point_const_iterator points_begin() const 
-  { return Point_const_iterator(vertices.begin()); }
-  Point_const_iterator points_end() const 
-  { return Point_const_iterator(vertices.end()); }
-
-  #endif
-          
-
-  RC_simplex_d() : pp(NULL) {}
-  RC_simplex_d(int dmax) : 
-    vertices(dmax+1), neighbors(dmax+1), opposite_vertices(dmax+1), pp(NULL)
-  { for (int i = 0; i <= dmax; i++) { 
-      neighbors[i] = Simplex_handle(); 
-      vertices[i] = Vertex_handle(); 
-      opposite_vertices[i] = -1;
-    }
-    visited_ = false;
-  }
-  ~RC_simplex_d() {} 
-
-  void print(std::ostream& O=std::cout) const
-  {
-    O << "RC_simplex_d {" ;
-    for(int i=0;i < int(vertices.size());++i) {
-      Vertex_handle v = vertices[i];
-      if ( v != Vertex_handle() ) O << v->point();
-      else O << "(nil)";
-    }
-    O << "}";
-  }
-
-#ifdef CGAL_USE_LEDA
-  LEDA_MEMORY(RC_simplex_d) 
-#endif
-
-}; 
-
-template <typename R>
-std::ostream& operator<<(std::ostream& O, const RC_simplex_d<R>& s)
-{ s.print(O); return O; }
-
-
-/*{\Manpage {Regular_complex_d}{R}{Regular Simplicial Complex}{C}}*/
-/*{\Mdefinition 
-
-An instance |\Mvar| of type |\Mname| is a regular abstract or concrete
-simplicial complex. An abstract simplicial complex is a family |\Mvar|
-of subsets of some set $V$, called the vertex set of the complex,
-which is closed under the subset relation, i.e., if a set $s$ belongs
-to the family then all its subsets do. A set $s$ of cardinality $k +
-1$ is called a $k$-simplex and $k$ is called its dimension.  If $s$ is
-a subset of $t$ then $s$ is called a subsimplex or face of $t$. A
-vertex $v$ is called incident to a simplex $s$ if $v$ is an element of
-$s$.  A simplex is called \emph{maximal} if it is not a face of any
-simplex in |\Mvar|. Two simplices of dimension $k$ are called
-neighbors if they share $k-1$ vertices. A complex is connected if its
-set of maximal simplices forms a connected set under the neighboring
-relation.  A simplicial complex is called \emph{regular} if all
-maximal simplices in the complex have the same dimension and if the
-complex is connected.  
-
-A concrete simplicial complex is an abstract simplicial complex in
-which a point in some ambient space is associated with each vertex.
-We use |dim| to denote the dimension of ambient space.  Simplices are
-now interpreted geometrically as sets of points in ambient space,
-namely as the convex hulls of (the points associated with) their
-vertices. A $0$-simplex is a point, a $1$-simplex is a line segment, a
-$2$-simplex is a triangle, a $3$-simplex is a tetrahedron,
-etc.. \emph{The simplices is a concrete simplicial complex must
-satisfy the additional conditions that the points associated with the
-vertices of any simplex are affinely independet and that the
-intersection of any two simplices is a face of both.} We will write
-simplicial complex instead of concrete simplicial complex in the
-sequel.
-
-All maximal simplices in a regular simplicial complex have the same
-dimension, which we denote |dcur|.  For each maximal
-simplex\cgalFootnote{we drop the adjective maximal in the sequel} in
-|\Mvar| there is an item of type |RC_simplex_d| and for each vertex
-there is an item of type |rc_vertex|.  Each maximal simplex has |1+dcur| 
-vertices indexed from $0$ to |dcur|. For any simplex $s$ and any
-index $i$, |C.vertex_of(s,i)| returns the $i$-th vertex of $s$. There
-may or may not be a simplex $t$ opposite to (the vertex with index)
-$i$, i.e., a maximal simplex $t$ having
-\{|C.vertex_of(s,0)|,|C.vertex_of(s,1)|,\ldots,
-|C.vertex_of(s,dcur)|\} - \{|C.vertex_of(s,i)|\} in its vertex
-set.  The function |C.opposite(s,i)| returns $t$ if it exists and
-returns |nil| otherwise. If $t$ exists then $s$ and $t$ share |dcur|
-vertices, namely all but vertex $i$ of $s$ and vertex
-|C.opposite_vertex(s,i)| of $t$. Assume that $t = |C.opposite(s,i)|$
-exists and let |j = C.opposite_vertex(s,i)|. Then |s = C.opposite(t,j)| 
-and |i = C.opposite_vertex(t,j)| and
-\begin{eqnarray*}
-\lefteqn{\{|C.vertex_of(s,0)|,|C.vertex_of(s,1)|,\ldots,
-|C.vertex_of(s,dcur)|\} - \{|C.vertex_of(s,i)|\} =} \\ & &
-\{|C.vertex_of(t,0)|,|C.vertex_of(t,1)|,\ldots,|C.vertex_of(t,dcur)|\}
-- \{|C.vertex_of(t,j)|\}.  \end{eqnarray*} In general, a
-vertex belongs to many simplices. For an |rc_vertex| $v$,
-the functions |C.simplex(v)| and |C.index(v)| return a pair $(s,i)$
-such that |v = C.vertex_of(s,i)|.
-
-The class |regl_complex| has a static member |nil_point| of type
-|Point_d|. This point is different (= not indentical) from any user
-defined point and is the point associated with every vertex of an
-abstract simplicial complex. It simulates the use of |nil| to denote
-an undefined object.
-
-Regular complexes are designed as the base class for triangulations of
-convex hulls and Delaunay triangulations in higher dimensional
-space. We have not used them yet for any other purpose. Regular
-complexes are built by constructing vertices and simplices, by
-assigning positions to vertices and vertices to simplices, and by
-establishing neighbor relations. The update operations do not check
-whether the data structure built actually encodes a simplicial
-complex.  The class provides a function |is_valid()| that performs a
-partial check whether the data structure encodes a simplicial
-complex. It is not checked whether two simplices intersect without
-sharing a face.
-}*/
-
-template <class R_>
-class Regular_complex_d
-{ 
-typedef Regular_complex_d<R_> Self;
-public:
-/*{\Mtypes 4}*/
-typedef R_ R;
-
-typedef RC_vertex_d<Self> Vertex;
-
-  typedef CGAL::Compact_container<Vertex> Vertex_list;
-
-typedef typename Vertex_list::iterator       Vertex_handle;
-/*{\Mtypemember the handle type for vertices of the complex.}*/
-typedef typename Vertex_list::const_iterator Vertex_const_handle;
-
-typedef typename Vertex_list::iterator       Vertex_iterator;
-/*{\Mtypemember the iterator type for vertices of the complex.}*/
-typedef typename Vertex_list::const_iterator Vertex_const_iterator;
-
-typedef RC_simplex_d<Self> Simplex;
-typedef CGAL::Compact_container<Simplex>    Simplex_list;
-
-typedef typename Simplex_list::iterator       Simplex_handle;
-/*{\Mtypemember the handle type for simplices of the complex.}*/
-typedef typename Simplex_list::const_iterator Simplex_const_handle;
-
-typedef typename Simplex_list::iterator       Simplex_iterator;
-/*{\Mtypemember the iterator type for simplices of the complex.}*/
-typedef typename Simplex_list::const_iterator Simplex_const_iterator;
-
-typedef typename R::Point_d Point_d;
-
-protected:
-  const R& Kernel_;
-  int dcur; // dimension of the current complex
-  int dmax; // dimension of ambient space
-
-  Vertex_list  vertices_; // list of all vertices
-  Simplex_list simplices_; // list of all simplices
-
-/* the default copy constructor and assignment operator for class
-   regl_complex work incorrectly; it is therefore good practice to
-   either implement them correctly or to make them inaccessible. We do
-   the latter. */
-
-private:
-
-  Regular_complex_d(const Regular_complex_d<R>& ); 
-  Regular_complex_d& operator=(const Regular_complex_d<R>& ); 
-
-  void clean_dynamic_memory()
-  { 
-    vertices_.clear();
-    simplices_.clear();
-}
-
-public:
-
-/*{\Mcreation}*/
-
-Regular_complex_d(int d = 2, const R& Kernel = R()) 
-/*{\Mcreate creates an instance |\Mvar| of type |\Mtype|. The
-dimension of the underlying space is $d$ and |\Mvar| is initialized to
-the empty regular complex.  Thus |dcur| equals $-1$. The traits class
-|R| specifies the models of all types and the implementations of
-all geometric primitives used by the regular complex class. The
-|Kernel| parameter allows you to carry fixed geometric information
-into the data type. For the default kernel traits |Homogeneous_d|
-the default construction of |Kernel| is enough.
-
-In the following we use further template parameters like the point
-type |Point_d=R::Point_d|.  At this point, it suffices to say that
-|Point_d| represents points in $d$-space. The complete specification of
-the traits class is to be found at the end of this manual page.}*/
- : Kernel_(Kernel) { dmax = d; dcur = -1; }
-
-
-~Regular_complex_d() { clean_dynamic_memory(); }
-
-/* In the destructor for |Regular_complex_d|, we have to release the
-   storage which was allocated for the simplices and the vertices. */
-
-/*{\Mtext The data type |\Mtype| offers neither copy constructor nor 
-          assignment operator.}*/
-
-/*{\Moperations 3 3}*/
-/*{\Mtext \headerline{Access Operations}}*/
-
-int dimension() const { return dmax; }
-/*{\Mop returns the dimension of ambient space}*/
-
-int current_dimension() const { return dcur; }
-/*{\Mop returns the current dimension of the simplices in the
-complex.}*/
-
-Vertex_handle vertex(Simplex_handle s, int i) const 
-/*{\Mop returns the $i$-th vertex of $s$.\\
-\precond $0 \leq i \leq |current_dimension|$. }*/
-{ CGAL_assertion(0<=i&&i<=dcur);
-  return s->vertex(i); }
-
-Vertex_const_handle vertex(Simplex_const_handle s, int i) const 
-{ CGAL_assertion(0<=i&&i<=dcur);
-  return s->vertex(i); }
-
-Point_d associated_point(Vertex_handle v) const 
-/*{\Mop returns the point associated with vertex |v|.}*/
-{ return v->point(); }
-
-Point_d associated_point(Vertex_const_handle v) const 
-{ return v->point(); }
-
-
-int index(Vertex_handle v) const 
-/*{\Mop returns the index of $v$ in |C.simplex(v)|.}*/
-{ return v->index(); }
-
-int index(Vertex_const_handle v) const 
-{ return v->index(); }
-
-
-Simplex_handle simplex(Vertex_handle v) const 
-/*{\Mop returns a simplex of which $v$ is a vertex. Note that this
-simplex is not unique. }*/
-{ return v->simplex(); } 
-
-Simplex_const_handle simplex(Vertex_const_handle v) const 
-{ return v->simplex(); } 
-
-Point_d associated_point(Simplex_handle s, int i) const
-/*{\Mop same as |C.associated_point(C.vertex(s,i))|.}*/
-{ return associated_point(vertex(s,i)); }
-
-Point_d associated_point(Simplex_const_handle s, int i) const
-{ return associated_point(vertex(s,i)); }
-
-Simplex_handle opposite_simplex(Simplex_handle s,int i) const 
-/*{\Mop returns the simplex opposite to the $i$-th vertex of $s$
-(|Simplex_handle()| is there is no such simplex).\\ \precond $0 \leq i \leq |dcur|$. }*/
-{ CGAL_assertion(0<=i&&i<=dcur);
-  return s->neighbor(i); }
-
-Simplex_const_handle opposite_simplex(Simplex_const_handle s,int i) const 
-{ CGAL_assertion(0<=i&&i<=dcur);
-  return s->neighbor(i); }
-
-int index_of_opposite_vertex(Simplex_handle s, int i) const
-{ CGAL_assertion(0<=i&&i<=dcur);
-  return s->opposite_vertex_index(i); }
-/*{\Mop returns the index of the vertex opposite to the $i$-th vertex
-of $s$. \precond $0 \leq i \leq |dcur|$ and there is a
-simplex opposite to the $i$-th vertex of $s$.}*/
-
-int index_of_opposite_vertex(Simplex_const_handle s, int i) const
-{ CGAL_assertion(0<=i&&i<=dcur);
-  return s->opposite_vertex_index(i); }
-
-
-
-/*{\Mtext \headerline{Update Operations}
-
-We give operations that allow to update a regular complex. They have
-to be used with care as they may invalidate the data structure.}*/
-
-void clear(int d = 0)
-/*{\Mop reinitializes |\Mvar| to the empty complex in dimension |dim|.}*/
-{ clean_dynamic_memory();
-  dmax = d; dcur = -1; 
-}
-
-void set_current_dimension(int d) { dcur = d; }
-/*{\Mop sets |dcur| to |d|. }*/
-
-Simplex_handle new_simplex() 
-/*{\Mop adds a new simplex to |\Mvar| and returns it. The new simplex
-has no vertices yet.}*/
-{ 
-  Simplex s(dmax);
-  Simplex_handle  h = simplices_.insert(s);
-  return h;
-}
-
-Vertex_handle  new_vertex() 
-/*{\Mop adds a new vertex to |\Mvar| and returns it. The new vertex
-        has no associated simplex nor index yet. The associated point
-        is the point |Regular_complex_d::nil_point| which is a static
-        member of class |Regular_complex_d.|}*/
-{ 
-  Vertex v(nil_point);
-  Vertex_handle h = vertices_.insert(v);
-  return h; 
-}
-
-Vertex_handle  new_vertex(const Point_d& p) 
-/*{\Mop adds a new vertex to |\Mvar| and returns it. The new vertex
-        has |p| as the associated point, but is has no associated
-        simplex nor index yet.}*/
-{ 
-  Vertex v(p);
-  Vertex_handle h = vertices_.insert(v);
-  return h;
-}
-
-void associate_vertex_with_simplex(Simplex_handle s, int i, Vertex_handle v)
-/*{\Mop sets the $i$-th vertex of |s| to |v| and records this fact in
-$v$. The latter occurs only if $v$ is non-nil.}*/
-{ s -> set_vertex(i,v);
-  if ( v != Vertex_handle() ) { 
-    v -> set_simplex(s); v -> set_index(i);
-  }
-}
-
-void associate_point_with_vertex(Vertex_handle v, const Point_d& p)
-/*{\Mop sets the point associated with $v$ to $p$.}*/
-{ v -> set_point(p); }
-
-void set_neighbor(Simplex_handle s, int i, Simplex_handle s1, int j)
-/*{\Mop sets the neihbor opposite to vertex $i$ of |s| to |s1| and
-        records vertex $j$ of |s1| as the vertex opposite to $i$.}*/
-{ s  -> set_neighbor(i,s1);
-  s1 -> set_neighbor(j,s);
-  s  -> set_opposite_vertex_index(i,j);
-  s1 -> set_opposite_vertex_index(j,i);
-}
-
-void check_topology() const;
-/*{\Mop Partially checks whether |\Mvar| is an abstract simplicial
-complex. This function terminates without error if each vertex is a
-vertex of the simplex of which it claims to be a vertex, if the
-vertices of all simplices are pairwise distinct, if the neighbor
-relationship is symmetric, and if neighboring simplices share exactly
-|dcur| vertices.  It returns an error message if one of these
-conditions is violated.  Note that it is not checked whether simplices
-that share |dcur| vertices are neighbors in the data structure.}*/
-
-void check_topology_and_geometry() const;
-/*{\Mop In addition to the above, this function checks whether all
-vertices have an associated point different from
-|Regular_complex_d::nil_point| and whether the points associated with the
-vertices of any simplex are affinely independent. It returns an error
-message otherwise.  Note that it is not checked whether the
-intersection of any two simplices is a facet of both.}*/
-
-
-typedef size_t Size_type;
-
-Size_type number_of_vertices() const  { return this->vertices_.size();}
-Size_type number_of_simplices() const  { return this->simplices_.size();}
-
-void print_statistics(std::ostream& os = std::cout) const
-{ 
-  os << "Regular_complex_d - statistic" << std::endl;
-  os << "number of vertices = " << number_of_vertices() << std::endl;
-  os << "number of simplices = " << number_of_simplices() << std::endl;
-}
-
-/*{\Mtext \headerline{Lists and Iterators}
-\setopdims{4.5cm}{3.5cm}}*/
-
-/*{\Mtext The following operation pairs return iterator ranges in
-the style of STL.}*/
-
-Vertex_iterator vertices_begin() { return vertices_.begin(); }
-/*{\Mop the first vertex of |\Mvar|.}*/
-Vertex_iterator vertices_end()   { return vertices_.end(); }
-/*{\Mop the beyond vertex of |\Mvar|.}*/
-Simplex_iterator simplices_begin() { return simplices_.begin(); }
-/*{\Mop the first simplex of |\Mvar|.}*/
-Simplex_iterator simplices_end()   { return simplices_.end(); }
-/*{\Mop the beyond simplex of |\Mvar|.}*/
-
-Vertex_const_iterator vertices_begin() const { return vertices_.begin(); }
-Vertex_const_iterator vertices_end()   const { return vertices_.end(); }
-Simplex_const_iterator simplices_begin() const { return simplices_.begin(); }
-Simplex_const_iterator simplices_end()   const { return simplices_.end(); }
-
-std::list<Simplex_handle> all_simplices()
-/*{\Mop returns the set of all maximal simplices in |\Mvar|.}*/
-{ std::list<Simplex_handle> res; Simplex_iterator it;
-  forall_rc_simplices(it,*this) res.push_back(it);
-  return res; }
-
-std::list<Simplex_const_handle> all_simplices() const 
-{ std::list<Simplex_const_handle> res; Simplex_const_iterator it;
-  forall_rc_simplices(it,*this) res.push_back(it);
-  return res; }
-
-std::list<Vertex_handle> all_vertices()
-/*{\Mop returns the set of all vertices in |\Mvar|.}*/
-{ std::list<Vertex_handle> res; Vertex_iterator it;
-  forall_rc_vertices(it,*this) res.push_back(it);
-  return res; }
-
-std::list<Vertex_const_handle> all_vertices() const 
-{ std::list<Vertex_const_handle> res; Vertex_const_iterator it;
-  forall_rc_vertices(it,*this) res.push_back(it);
-  return res; }
-
-
-
-const R& kernel() const { return Kernel_; }
-static Point_d nil_point;
-
-}; // Regular_complex_d<R>
-
-// init static member:
-template <class R> 
-typename Regular_complex_d<R>::Point_d Regular_complex_d<R>::nil_point;
-
-
-template <class R>
-void Regular_complex_d<R>::check_topology() const
-{ 
-  Simplex_const_handle s,t; 
-  Vertex_const_handle v;
-  int i,j,k; 
-  if (dcur == -1) {
-    if (!vertices_.empty() || !simplices_.empty() ) 
-      CGAL_error_msg(      "check_topology: dcur is -1 but there are vertices or simplices");
-  }
-
-  forall_rc_vertices(v,*this) {
-    if ( v != vertex(simplex(v),index(v)) )
-      CGAL_error_msg(      "check_topology: vertex-simplex relationship corrupted");
-  }
-
-  forall_rc_simplices(s,*this) {
-    for(i = 0; i <= dcur; i++) {
-      for (j = i + 1; j <= dcur; j++) {
-        if (vertex(s,i) == vertex(s,j))
-          CGAL_error_msg(          "check_topology: a simplex with two equal vertices"); 
-      }
-    }
-  }
-
-  forall_rc_simplices(s,*this) {
-    for(i = 0; i <= dcur; i++) {
-      if ((t = opposite_simplex(s,i)) != Simplex_const_handle()) { 
-        int l = index_of_opposite_vertex(s,i); 
-        if (s != opposite_simplex(t,l) || 
-            i != index_of_opposite_vertex(t,l))
-          CGAL_error_msg(          "check_topology: neighbor relation is not symmetric"); 
-
-        for (j = 0; j <= dcur; j++) {
-          if (j != i) {
-            // j must also occur as a vertex of t
-            for (k = 0; k <= dcur && 
-                   ( vertex(s,j) != vertex(t,k) || k == l); k++) {}
-            if (k > dcur) 
-              CGAL_error_msg(              "check_topology: too few shared vertices."); 
-          }
-        }
-      }
-    }
-  }
-}
-
-template <class R>
-void Regular_complex_d<R>::check_topology_and_geometry() const
-{ 
-  check_topology();
-  Vertex_const_handle v;
-  forall_rc_vertices(v,*this) {
-    if ( v == Vertex_const_handle() || 
-         associated_point(v).identical(Regular_complex_d<R>::nil_point) )
-      CGAL_error_msg("check_topology_and_geometry: \
-      vertex with nil_point or no associated point.");
-  }
-
-  typename R::Affinely_independent_d affinely_independent =
-    kernel().affinely_independent_d_object();
-  Simplex_const_handle s;
-  forall_rc_simplices(s,*this) {
-    std::vector<Point_d> A(dcur + 1);
-    for (int i = 0; i <= dcur; i++) 
-      A[i] = associated_point(s,i);
-    if ( !affinely_independent(A.begin(),A.end()) )
-      CGAL_error_msg("check_topology_and_geometry: \
-      corners of some simplex are not affinely independent");
-  }
-}
-
-
-/*{\Mtext 
-\headerline{Iteration Statements}
-
-{\bf forall\_rc\_simplices}($s,C$)       
-$\{$ ``the simplices of $C$ are successively assigned to $s$'' $\}$
-
-{\bf forall\_rc\_vertices}($v,C$)       
-$\{$ ``the vertices of $C$ are successively assigned to $v$'' $\}$
-
-}*/
-
-/*{\Mimplementation Each simplex stores its vertices, the adjacent
-simplices, and the opposite vertices in arrays. The space requirement
-for a simplex is $3 * |dim| * 4$ Bytes for the contents of the arrays
-plus the actual space for the points plus the constant space overhead
-for the arrays (see the manual pages for arrays).
-
-The class |Regular_complex_d| needs constant space plus space for a list of
-simplices (which is about 12 bytes per simplex). The total space
-requirement is therefore about $12(|dim| + 2)$ bytes times the number
-of simplices.  }*/
-
-
-
-} //namespace CGAL
-#endif // CGAL_REGULAR_COMPLEX_D_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Regular_triangulation_2.h b/3rdparty/CGAL-4.8/include/CGAL/Regular_triangulation_2.h
deleted file mode 100644
index a002e01..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Regular_triangulation_2.h
+++ /dev/null
@@ -1,2237 +0,0 @@
-// Copyright (c) 1997  INRIA Sophia-Antipolis (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
-// 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(s)     : Frederic Fichel, Mariette Yvinec, Julia Floetotto
-
-#ifndef CGAL_REGULAR_TRIANGULATION_2_H
-#define CGAL_REGULAR_TRIANGULATION_2_H
-
-#include <CGAL/Triangulation_2.h>
-#include <CGAL/Regular_triangulation_face_base_2.h>
-#include <CGAL/Regular_triangulation_vertex_base_2.h>
-#include <CGAL/utility.h>
-
-#include <boost/bind.hpp>
-
-#ifndef CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
-#include <CGAL/Spatial_sort_traits_adapter_2.h>
-#include <CGAL/internal/info_check.h>
-
-#include <boost/iterator/zip_iterator.hpp>
-#include <boost/mpl/and.hpp>
-#endif //CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
-
-namespace CGAL { 
-
-template < typename K_ >
-struct Weighted_point_mapper_2 
-  :   public K_ 
-{
-  typedef typename K_::Weighted_point_2 Point_2;
-
-  Weighted_point_mapper_2() {}
-  Weighted_point_mapper_2(const K_& k) : K_(k) {}
-};
-
-template < class Gt, 
-           class Tds  = Triangulation_data_structure_2 <
-                        Regular_triangulation_vertex_base_2<Gt>,
-		        Regular_triangulation_face_base_2<Gt> > >
-class Regular_triangulation_2 
-  : public Triangulation_2<Weighted_point_mapper_2<Gt>,Tds>
-{
-  typedef Regular_triangulation_2<Gt, Tds>                         Self;
-  typedef Triangulation_2<Weighted_point_mapper_2<Gt>,Tds>         Base;
-public:
-  typedef Tds                                  Triangulation_data_structure;
-  typedef Gt                                   Geom_traits;
-  typedef typename Gt::Point_2                 Bare_point;
-  typedef typename Gt::Weighted_point_2        Weighted_point;
-  typedef typename Gt::Weight                  Weight;
-
-  typedef typename Base::size_type             size_type;
-  typedef typename Base::Face_handle           Face_handle;
-  typedef typename Base::Vertex_handle         Vertex_handle;
-  typedef typename Base::Vertex                Vertex;
-  typedef typename Base::Edge                  Edge;
-  typedef typename Base::Locate_type           Locate_type;
-  typedef typename Base::Face_circulator       Face_circulator;
-  typedef typename Base::Edge_circulator       Edge_circulator;
-  typedef typename Base::Vertex_circulator     Vertex_circulator;
-  typedef typename Base::Finite_edges_iterator Finite_edges_iterator;
-  typedef typename Base::All_edges_iterator    All_edges_iterator;
-  typedef typename Base::Finite_faces_iterator Finite_faces_iterator;
-  typedef typename Base::All_faces_iterator    All_faces_iterator;
-  typedef typename Base::Face::Vertex_list     Vertex_list;
-  typedef typename Vertex_list::iterator       Vertex_list_iterator;
-
-#ifndef CGAL_CFG_USING_BASE_MEMBER_BUG_2
-  using Base::cw;
-  using Base::ccw;
-  using Base::dimension;
-  using Base::geom_traits;
-  using Base::infinite_vertex;
-  using Base::create_face;
-  using Base::number_of_faces;
-  using Base::all_faces_begin;
-  using Base::all_faces_end;
-  using Base::all_edges_begin;
-  using Base::all_edges_end;
-  using Base::finite_faces_begin;
-  using Base::finite_faces_end;
-  using Base::finite_edges_begin;
-  using Base::finite_edges_end;
-  using Base::OUTSIDE_AFFINE_HULL;
-  using Base::VERTEX;
-  using Base::FACE;
-  using Base::EDGE;
-  using Base::OUTSIDE_CONVEX_HULL;
-  using Base::orientation;
-  using Base::locate;
-  using Base::incident_faces;
-  using Base::is_infinite;
-  using Base::degree;
-  using Base::delete_vertex;
-  using Base::incident_vertices;
-  using Base::make_hole;
-  using Base::mirror_index;
-  using Base::show_vertex;
-  using Base::test_dim_down;
-#endif
-
-private:
-  typedef std::list<Face_handle>      Faces_around_stack; 
-
-  class Hidden_tester {
-  public:
-    bool operator()(const typename Base::All_vertices_iterator&  it){
-      return it->is_hidden();
-     }
-    bool operator()(const typename Base::Finite_vertices_iterator&  it){
-      return it->is_hidden();
-    }
-  };
-
-  class Unhidden_tester {
-  public:
-    bool operator()(const typename Base::Finite_vertices_iterator&  it){
-      return ! it->is_hidden();
-    }
-  };
-
-  typedef typename Base::All_vertices_iterator     All_vib;
-  typedef typename Base::Finite_vertices_iterator  Finite_vib;
-
-public:
-  // We derive in order to add a conversion to handle.
-  class All_vertices_iterator :
-    public Filter_iterator<All_vib, Hidden_tester> {
-    typedef Filter_iterator<All_vib, Hidden_tester> Base;
-    typedef All_vertices_iterator                     Self;
-     public:
-    All_vertices_iterator() : Base() {}
-    All_vertices_iterator(const Base &b) : Base(b) {}
-    Self & operator++() { Base::operator++(); return *this; }
-    Self & operator--() { Base::operator--(); return *this; }
-    Self operator++(int) { Self tmp(*this); ++(*this); return tmp; }
-    Self operator--(int) { Self tmp(*this); --(*this); return tmp; }
-    operator Vertex_handle() const { return Base::base(); } 
-  };
-
-  class Finite_vertices_iterator :
-    public Filter_iterator<Finite_vib, Hidden_tester> {
-    typedef Filter_iterator<Finite_vib, Hidden_tester> Base; 
-    typedef Finite_vertices_iterator                          Self;
-  public:
-    Finite_vertices_iterator() : Base() {}
-    Finite_vertices_iterator(const Base &b) : Base(b) {}
-    Self & operator++() { Base::operator++(); return *this; }
-    Self & operator--() { Base::operator--(); return *this; }
-    Self operator++(int) { Self tmp(*this); ++(*this); return tmp; }
-    Self operator--(int) { Self tmp(*this); --(*this); return tmp; }
-    operator Vertex_handle() const { return Base::base(); }
- };
-
-  class Hidden_vertices_iterator :
-    public Filter_iterator<Finite_vib, Unhidden_tester> {
-    typedef Filter_iterator<Finite_vib, Unhidden_tester> Base; 
-    typedef Hidden_vertices_iterator                     Self;
-  public:
-    Hidden_vertices_iterator() : Base() {}
-    Hidden_vertices_iterator(const Base &b) : Base(b) {}
-    Self & operator++() { Base::operator++(); return *this; }
-    Self & operator--() { Base::operator--(); return *this; }
-    Self operator++(int) { Self tmp(*this); ++(*this); return tmp; }
-    Self operator--(int) { Self tmp(*this); --(*this); return tmp; }
-    operator Vertex_handle() const { return Base::base(); }
- };
-
- //for backward compatibility
-  typedef Finite_faces_iterator                Face_iterator;
-  typedef Finite_edges_iterator                Edge_iterator;
-  typedef Finite_vertices_iterator             Vertex_iterator;
-
- //Tag to distinguish Delaunay from Regular triangulations
-  typedef Tag_true  Weighted_tag;
-
-private:
-  size_type _hidden_vertices;
-
-public:
-  Regular_triangulation_2(const Gt& gt=Gt()) 
-    : Base(Weighted_point_mapper_2<Gt>(gt)), _hidden_vertices(0) {}
-
-  Regular_triangulation_2(const Regular_triangulation_2 &rt);
-
-  template < class InputIterator >
-  Regular_triangulation_2(InputIterator first, InputIterator last,
-                          const Gt& gt=Gt())
-    : Base(Weighted_point_mapper_2<Gt>(gt)), _hidden_vertices(0)
-  {
-    insert(first, last);
-  }
-
-  Regular_triangulation_2 & operator=(const Regular_triangulation_2 &tr);
-
-  size_type number_of_vertices() const {
-    return Base::number_of_vertices() - _hidden_vertices;
-  }
- 
-  size_type number_of_hidden_vertices() const {
-    return _hidden_vertices;
-  }
-
-  // CHECK - QUERY
-
-  Oriented_side power_test(const Weighted_point &p,
-			   const Weighted_point &q,
-			   const Weighted_point &r,
-			   const Weighted_point &s, bool perturb) const;
-  Oriented_side power_test(const Weighted_point &p,
-			   const Weighted_point &q,
-			   const Weighted_point &r) const;
-  Oriented_side power_test(const Weighted_point &p,
-			   const Weighted_point &r) const;
-  Oriented_side power_test(const Face_handle &f, 
-			   const Weighted_point &p, bool perturb=false) const;
-  Oriented_side power_test(const Face_handle& f, int i,
-			   const Weighted_point &p) const;
- 
-  
-  bool is_valid(bool verbose = false, int level = 0) const;
-  bool test_conflict(const Weighted_point  &p, Face_handle fh) const;
-  void show_face(Face_handle fh) const;
-  void show_all() const;	
-  
-   //  //template member functions, declared and defined at the end 
-  //  template <class OutputItFaces, class OutputItBoundaryEdges, 
-  //                                       class OutputItHiddenVertices> 
-  //   Triple<OutputItFaces,OutputItBoundaryEdges, OutputItHiddenVertices>
-  //   get_conflicts_and_boundary_and_hidden_vertices (const
-  //   Weighted_point  &p, 
-  // 						  OutputItFaces fit, 
-  // 						  OutputItBoundaryEdges eit,
-  // 						  OutputItHiddenVertices vit,  
-  // 						  Face_handle start = 
-  //                                                 Face_handle()) const;
-  // template <class OutputItFaces, class OutputItBoundaryEdges> 
-  // std::pair<OutputItFaces,OutputItBoundaryEdges>
-  // get_conflicts_and_boundary(const Weighted_point  &p, 
-  // 		                OutputItFaces fit, 
-  // 		                OutputItBoundaryEdges eit,
-  // 		                Face_handle start) const;
-  // template <class OutputItFaces>
-  // OutputItFaces
-  // get_conflicts (const Weighted_point  &p, 
-  //                OutputItFaces fit, 
-  // 		    Face_handle start ) const;
-  // template <class OutputItBoundaryEdges>
-  // OutputItBoundaryEdges
-  // get_boundary_of_conflicts(const Weighted_point  &p, 
-  // 			       OutputItBoundaryEdges eit, 
-  // 			       Face_handle start ) const;
-  //   template <class OutputItBoundaryEdges, class OutputItHiddenVertices> 
-  //   std::pair<OutputItBoundaryEdges, OutputItHiddenVertices> 
-  //   get_boundary_of_conflicts_and_hidden_vertices(const Weighted_point  &p, 
-  // 						OutputItBoundaryEdges eit, 
-  // 						OutputItHiddenVertices vit,
-  // 						Face_handle start=
-  //                                                Face_handle()) const;
-  //   template <class OutputItHiddenVertices> 
-  //   OutputItHiddenVertices
-  //   get_hidden_vertices(const Weighted_point  &p, 
-  // 			   OutputItHiddenVertices vit,
-  // 			   Face_handle start= 
-  //                       Face_handle()) const;
-  
-  // DUAL
-  Bare_point dual (Face_handle f) const;
-  Object dual(const Edge &e) const ;
-  Object dual(const Edge_circulator& ec) const;
-  Object dual(const Finite_edges_iterator& ei) const;
-  Bare_point weighted_circumcenter(Face_handle f) const; 
-  Bare_point weighted_circumcenter(const Weighted_point& p0, 
-			      const Weighted_point& p1, 
-			      const Weighted_point& p2) const;
-
-  // Insertion, Deletion and Flip
-  Vertex_handle push_back(const Weighted_point &p);
-  Vertex_handle insert(const Weighted_point &p, 
-		       Face_handle f = Face_handle() );
-  Vertex_handle insert(const Weighted_point &p,
-	 	       Locate_type  lt,
-		       Face_handle loc, int li );
-  Vertex_handle insert_in_face(const Weighted_point &p, Face_handle f);
-  Vertex_handle insert_in_edge(const Weighted_point &p, Face_handle f, int i);
-  void flip(Face_handle f, int i);
-  void remove_degree_3(Vertex_handle v, 
-		       Face_handle f = Face_handle());
-  void remove(Vertex_handle v);
-
-  All_vertices_iterator all_vertices_begin () const;
-  All_vertices_iterator all_vertices_end () const;
-
-  Finite_vertices_iterator finite_vertices_begin () const;
-  Finite_vertices_iterator finite_vertices_end () const;
-  Vertex_handle finite_vertex() const;
-
-  Hidden_vertices_iterator hidden_vertices_begin () const;
-  Hidden_vertices_iterator hidden_vertices_end () const;
-
-  //  Vertex_handle file_input(std::istream& is);
-  // void file_output(std::ostream& os) const;
-
-public:
-  void clear();
-  void copy_triangulation(const Self& tr);
-private:
-  void copy_triangulation_();
-  Vertex_handle reinsert(Vertex_handle v, Face_handle start);
-  void regularize(Vertex_handle v);
-  void remove_hidden(Vertex_handle v);
-  void remove_2D(Vertex_handle v);
-  void fill_hole_regular(std::list<Edge> & hole);
-  void set_face(Vertex_list& vl, const Face_handle& fh);
-  void update_hidden_points_3_1(const Face_handle& f1, const Face_handle& f2, 
-				const Face_handle& f3);
-  void update_hidden_points_2_2(const Face_handle& f1, const Face_handle& f2);
-  void update_hidden_points_1_3(const Face_handle& f1, const Face_handle& f2,
-				const Face_handle& f3);
-
-  Vertex_handle hide_new_vertex(Face_handle f, const Weighted_point& p);
-  void hide_remove_degree_3(Face_handle fh, Vertex_handle vh);
-  void hide_vertex(Face_handle f, Vertex_handle v);
-   void exchange_incidences(Vertex_handle va, Vertex_handle vb);
-  void exchange_hidden(Vertex_handle va, Vertex_handle vb);
-
-  void stack_flip(Vertex_handle v, Faces_around_stack &faces_around);
-  void stack_flip_4_2(Face_handle f, int i, int j, 
-		      Faces_around_stack &faces_around);
-  void stack_flip_3_1(Face_handle f, int i, int j,
-		      Faces_around_stack &faces_around);
-  void stack_flip_2_2(Face_handle f, int i, 
-		      Faces_around_stack &faces_around);
-  void stack_flip_dim1(Face_handle f, int i,
-		       Faces_around_stack &faces_around);
-  bool is_valid_face(Face_handle fh) const;
-  bool is_valid_vertex(Vertex_handle fh) const;
-		       
-
-
-public:
-#ifndef CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
-  template < class InputIterator >
-  std::ptrdiff_t
-  insert( InputIterator first, InputIterator last,
-          typename boost::enable_if<
-              boost::is_convertible<
-                  typename std::iterator_traits<InputIterator>::value_type,
-                  Weighted_point
-              >
-          >::type* = NULL  
-  )
-#else  
-  template < class InputIterator >
-  std::ptrdiff_t
-  insert(InputIterator first, InputIterator last)
-#endif //CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
-  {
-      size_type n = number_of_vertices();
-
-      std::vector<Weighted_point> points (first, last);
-      spatial_sort (points.begin(), points.end(), geom_traits());
-
-      Face_handle hint;
-      for (typename std::vector<Weighted_point>::const_iterator p = points.begin(),
-		      end = points.end();
-              p != end; ++p)
-          hint = insert (*p, hint)->face();
-
-      return number_of_vertices() - n;
-  }
-
-#ifndef CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
-private:
-  //top stands for tuple-or-pair
-  template <class Info>
-  const Weighted_point& top_get_first(const std::pair<Weighted_point,Info>& pair) const { return pair.first; }
-  template <class Info>
-  const Info& top_get_second(const std::pair<Weighted_point,Info>& pair) const { return pair.second; }
-  template <class Info>
-  const Weighted_point& top_get_first(const boost::tuple<Weighted_point,Info>& tuple) const { return boost::get<0>(tuple); }
-  template <class Info>
-  const Info& top_get_second(const boost::tuple<Weighted_point,Info>& tuple) const { return boost::get<1>(tuple); }
-
-  template <class Tuple_or_pair,class InputIterator>
-  std::ptrdiff_t insert_with_info(InputIterator first,InputIterator last)
-  {
-    size_type n = number_of_vertices();
-    std::vector<std::ptrdiff_t> indices;
-    std::vector<Weighted_point> points;
-    std::vector<typename Triangulation_data_structure::Vertex::Info> infos;
-    std::ptrdiff_t index=0;
-    for (InputIterator it=first;it!=last;++it){
-      Tuple_or_pair pair = *it;
-      points.push_back( top_get_first(pair) );
-      infos.push_back ( top_get_second(pair) );
-      indices.push_back(index++);
-    }
-
-    typedef Spatial_sort_traits_adapter_2<Geom_traits,Weighted_point*> Search_traits;
-    
-    spatial_sort(indices.begin(),indices.end(),Search_traits(&(points[0]),geom_traits()));    
-
-    Face_handle hint;
-    Vertex_handle v_hint;
-    for (typename std::vector<std::ptrdiff_t>::const_iterator
-      it = indices.begin(), end = indices.end();
-      it != end; ++it)
-    {
-      v_hint = insert (points[*it], hint);
-      
-      if (v_hint!=Vertex_handle()){
-        v_hint->info()=infos[*it];
-        hint=v_hint->face();
-      }
-    }
-
-    return number_of_vertices() - n;
-  }
-  
-public:
-
-  template < class InputIterator >
-  std::ptrdiff_t
-  insert( InputIterator first,
-          InputIterator last,
-          typename boost::enable_if<
-              boost::is_convertible<
-                typename std::iterator_traits<InputIterator>::value_type,
-                std::pair<Weighted_point,typename internal::Info_check<typename Triangulation_data_structure::Vertex>::type>
-              >
-          >::type* = NULL
-  )
-  {return insert_with_info< std::pair<Weighted_point,typename internal::Info_check<typename Triangulation_data_structure::Vertex>::type> >(first,last);}
-  
-  template <class  InputIterator_1,class InputIterator_2>
-  std::ptrdiff_t
-  insert( boost::zip_iterator< boost::tuple<InputIterator_1,InputIterator_2> > first,
-          boost::zip_iterator< boost::tuple<InputIterator_1,InputIterator_2> > last,
-          typename boost::enable_if<
-            boost::mpl::and_<
-              typename boost::is_convertible< typename std::iterator_traits<InputIterator_1>::value_type, Weighted_point >,
-              typename boost::is_convertible< typename std::iterator_traits<InputIterator_2>::value_type, typename internal::Info_check<typename Triangulation_data_structure::Vertex>::type >
-            >
-          >::type* =NULL
-  )
-  {return insert_with_info< boost::tuple<Weighted_point,typename internal::Info_check<typename Triangulation_data_structure::Vertex>::type> >(first,last);}
-#endif //CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO  
-  
-  template < class Stream>
-  Stream& draw_dual(Stream & ps) const
-    {
-      Finite_edges_iterator eit = finite_edges_begin();
-      for (; eit != finite_edges_end(); ++eit) {
-	Object o = dual(eit);
-	typename Geom_traits::Line_2  l;
-	typename Geom_traits::Ray_2   r;
-	typename Geom_traits::Segment_2 s;
-	if (CGAL::assign(s,o)) ps << s;
-	if (CGAL::assign(r,o)) ps << r;
-	if (CGAL::assign(l,o)) ps << l;
-      }
-      return ps;
-    }
-   template <class OutputItFaces, class OutputItBoundaryEdges, 
-     class OutputItHiddenVertices> 
-   Triple<OutputItFaces,OutputItBoundaryEdges, OutputItHiddenVertices>
-   get_conflicts_and_boundary_and_hidden_vertices(const Weighted_point  &p, 
-						  OutputItFaces fit, 
-						  OutputItBoundaryEdges eit,
-						  OutputItHiddenVertices vit,
-						  Face_handle start = 
-						  Face_handle()) const
-    {
-      CGAL_triangulation_precondition( dimension() == 2);
-      int li;
-      Locate_type lt;
-      Face_handle fh = locate(p,lt,li, start);
-      switch(lt) {
-      case OUTSIDE_AFFINE_HULL:
-	return make_triple(fit, eit, vit);
-      case VERTEX:
-      case FACE:
-      case EDGE:
-      case OUTSIDE_CONVEX_HULL:
-	//test whether p is not in conflict 
-	// with the first face: 
-	// this includes the cases that p is located 
-	// on a vertex and either equal or no conflict
-	if (!test_conflict(p,fh))
-	  return make_triple(fit, eit, vit);
-	
-	// region includes all faces in conflict so far detected
-	// stack includes the faces in the region whose neighbors
-	// have not yet been looked at
-	std::set<Face_handle> region;
-	std::stack<Edge> st; 
-	
-	//collection of all boundary_vertices:
-	std::set< Vertex_handle> boundary_vertices;
-	//collection of potential_intern_vertices = vertices incident
-	// to an edge incident to two faces in conflict and met 
-	// twice during the "walk":
-	std::set< Vertex_handle> potential_intern_vertices;
-	
-	*fit++ = fh; //put fh in OutputItFaces
-	region.insert(fh);
-	st.push(Edge(fh,2));
-	st.push(Edge(fh,1));	
-	st.push(Edge(fh,0));
-
-	while (! st.empty()){
-	  Edge e = st.top();
- 	  st.pop();
-	  Face_handle fh = e.first;
-	  Face_handle fn = fh->neighbor(e.second);
-	  int i = fn->index(fh);
-	  if( region.find(fn) == region.end() ){
-	    if (test_conflict(p,fn))
-	      {
-		region.insert(fn);
-		st.push(Edge(fn, cw(i)));
-		st.push(Edge(fn,ccw(i)));
-		*fit++ = fn;
-	      }
-	    else{ 
-	      e = Edge(fn,i);
-	      *eit++ = e;
-	      if(!is_infinite(fn->vertex(cw(i))))
-		boundary_vertices.insert(fn->vertex(cw(i)));
-	       if(!is_infinite(fn->vertex(ccw(i))))
-		 boundary_vertices.insert(fn->vertex(ccw(i)));
-	    }
-	  }
-	  else {
-	    //insert the vertices of the last edge into the set of 
-	    // potential intern vertices:
-	    potential_intern_vertices.insert(fn->vertex(ccw(i)));
-	    potential_intern_vertices.insert(fn->vertex(cw(i)));
-	  }
-	}
-	if(!potential_intern_vertices.empty()){
-	  //determine the hidden vertices:
-	  std::set_difference (potential_intern_vertices.begin(), 
-			  potential_intern_vertices.end(),
-			  boundary_vertices.begin(),
-			  boundary_vertices.end(),
-			  vit); 
-	}
-	return  make_triple(fit, eit, vit);
-      }
-      CGAL_triangulation_assertion(false);
-      return make_triple(fit, eit, vit);
-    }
-  
-  template <class OutputItFaces, class OutputItBoundaryEdges> 
-  std::pair<OutputItFaces,OutputItBoundaryEdges>
-  get_conflicts_and_boundary (const Weighted_point  &p, 
-			      OutputItFaces fit, 
-			      OutputItBoundaryEdges eit,
-			      Face_handle start = Face_handle()) const
-    {
-      Triple<OutputItFaces,OutputItBoundaryEdges,Emptyset_iterator>
-	pp = 
-	get_conflicts_and_boundary_and_hidden_vertices(p, fit, eit,
-       						       Emptyset_iterator(), 
-       						       start);
-      return std::make_pair(pp.first, pp.second);
-    }
-  template <class OutputItFaces, class OutputItHiddenVertices> 
-  std::pair<OutputItFaces, OutputItHiddenVertices> 
-  get_conflicts_and_hidden_vertices(const Weighted_point  &p, 
-				    OutputItFaces fit, 
-				    OutputItHiddenVertices vit,
-				    Face_handle start = 
-				    Face_handle()) const
-    {
-      Triple<OutputItFaces, Emptyset_iterator,OutputItHiddenVertices> 
-	pp = 
-	get_conflicts_and_boundary_and_hidden_vertices(p,fit,
-						       Emptyset_iterator(), 
-						       vit,
-						       start);
-      return std::make_pair(pp.first,pp.third);
-    }
-
-
-   template <class OutputItBoundaryEdges, class OutputItHiddenVertices> 
-  std::pair<OutputItBoundaryEdges, OutputItHiddenVertices> 
-  get_boundary_of_conflicts_and_hidden_vertices(const Weighted_point  &p, 
-						OutputItBoundaryEdges eit, 
-						OutputItHiddenVertices vit,
-						Face_handle start = 
-						Face_handle()) const
-    {
-      Triple<Emptyset_iterator,OutputItBoundaryEdges,
-	OutputItHiddenVertices> 
-	pp = 
-	get_conflicts_and_boundary_and_hidden_vertices(p,
-						       Emptyset_iterator(), 
-						       eit,vit,
-						       start);
-      return std::make_pair(pp.second,pp.third);
-    }
-
-  template <class OutputItFaces> 
-  OutputItFaces
-  get_conflicts (const Weighted_point  &p, 
-		 OutputItFaces fit, 
-		 Face_handle start= Face_handle()) const
-    {
-      Triple<OutputItFaces,Emptyset_iterator,Emptyset_iterator>
-	pp = 
-	get_conflicts_and_boundary_and_hidden_vertices(p, fit, 
-						       Emptyset_iterator(),
-						       Emptyset_iterator(), 
-						       start);
-      return pp.first;
-    }
-  
-  template <class OutputItBoundaryEdges> 
-  OutputItBoundaryEdges
-  get_boundary_of_conflicts(const Weighted_point  &p, 
-			    OutputItBoundaryEdges eit, 
-			    Face_handle start= Face_handle()) const
-    {    
-      Triple<Emptyset_iterator, OutputItBoundaryEdges,Emptyset_iterator>
-	pp = 
-	get_conflicts_and_boundary_and_hidden_vertices(p,
-						       Emptyset_iterator(),
-						       eit,
-						       Emptyset_iterator(), 
-						       start);
-      return pp.second;
-    }
-  template <class OutputItHiddenVertices> 
-  OutputItHiddenVertices 
-  get_hidden_vertices(const Weighted_point  &p, OutputItHiddenVertices vit,
-		      Face_handle start= Face_handle()) const
-    {
-      Triple<Emptyset_iterator,Emptyset_iterator,
-	OutputItHiddenVertices> 
-	pp = 
-	get_conflicts_and_boundary_and_hidden_vertices(p,Emptyset_iterator(), 
-						       Emptyset_iterator(),vit,
-						       start);
-      return pp.third;
-    }
-
-  // nearest power vertex query
-  Vertex_handle nearest_power_vertex(const Bare_point& p) const;
-};
-
-template < class Gt, class Tds >
-inline bool
-Regular_triangulation_2<Gt,Tds>::
-test_conflict(const Weighted_point  &p, Face_handle fh) const
-{
-  return(power_test(fh,p) == ON_POSITIVE_SIDE);
-}   
-
-template < class Gt, class Tds >
-void
-Regular_triangulation_2<Gt,Tds>::
-clear()
-{
-  Base::clear();
-  _hidden_vertices = 0;
-}
-
-template < class Gt, class Tds >
-void
-Regular_triangulation_2<Gt,Tds>::
-copy_triangulation_()
-{
-  // the list of vertices have been copied member for member and are
-  // not good
-  // clear them and next
-  // scan the hidden vertices to retablish the list in faces
-  typename Tds::Face_iterator 
-                       baseit= this->_tds.face_iterator_base_begin();
-  for( ; baseit !=  this->_tds.face_iterator_base_end(); baseit++){
-    baseit->vertex_list().clear();
-  }
-  Hidden_vertices_iterator hvit = hidden_vertices_begin();
-  for( ; hvit !=  hidden_vertices_end() ; ++hvit){
-    hvit->face()->vertex_list().push_back(hvit);
-  }
-  CGAL_triangulation_postcondition(is_valid());
-}
-
-template < class Gt, class Tds >
-void
-Regular_triangulation_2<Gt,Tds>::
-copy_triangulation(const Self &tr )
-{
-  Base::copy_triangulation(tr);
-  _hidden_vertices = tr._hidden_vertices;
-  copy_triangulation_();
-}
-
-template < class Gt, class Tds >
-Regular_triangulation_2<Gt,Tds>::
-Regular_triangulation_2(const Self &tr)
-  : Base(tr), _hidden_vertices(tr._hidden_vertices)
-{
-  copy_triangulation_();
-}
-
-template <class Gt, class Tds >
-Regular_triangulation_2<Gt,Tds> &
-Regular_triangulation_2<Gt, Tds>::
-operator=(const Self &tr)
-{
-  copy_triangulation(tr);
-  return *this;
-}
-
-template < class Gt, class Tds >
-Oriented_side
-Regular_triangulation_2<Gt,Tds>::
-power_test(const Face_handle &f, const Weighted_point &p, bool perturb) const
-{
-  // p is supposed to be a finite point
-  // if f is a finite face, 
-  // return  ON_NEGATIVE_SIDE if p is above f 
-  // (p has to be hidden)
-  if (dimension() == 1) return power_test(f->vertex(0)->point(),
-					  f->vertex(1)->point(),p);
-  int i;
-  if ( ! f->has_vertex(infinite_vertex(), i) )
-    return power_test(f->vertex(0)->point(),
-		      f->vertex(1)->point(),
-		      f->vertex(2)->point(),p, perturb);
-
-  Orientation o = orientation(f->vertex(ccw(i))->point(),
-			      f->vertex( cw(i))->point(),
-			      p);
-  if (o==COLLINEAR)
-    return power_test(f->vertex(ccw(i))->point(),
-		      f->vertex( cw(i))->point(),p);
-
-  return o;
-}
-
-template < class Gt, class Tds >
-Oriented_side
-Regular_triangulation_2<Gt,Tds>::
-power_test(const Face_handle& f, int i,
-	   const Weighted_point &p) const
-{
-  // f,i is supposed to be a finite edge
-  // p is supposed to be on  edge (f,i)
-  // return ON_NEGATIVE_SIDE if p is above (f,i)
-  // (p has to be hidden)
-  CGAL_triangulation_precondition (!is_infinite(f,i) &&
-	     orientation(f->vertex(ccw(i))->point(),
-			 f->vertex( cw(i))->point(),
-			 p) == COLLINEAR);
-  return  power_test(f->vertex(ccw(i))->point(),
-		     f->vertex( cw(i))->point(),
-		     p);
-}
-
-template < class Gt, class Tds >
-inline
-Oriented_side
-Regular_triangulation_2<Gt,Tds>::
-power_test(const Weighted_point &p0,
-	   const Weighted_point &p1,
-	   const Weighted_point &p2,
-	   const Weighted_point &p,
-           bool perturb) const
-{
-    CGAL_triangulation_precondition( orientation(p0, p1, p2) == POSITIVE );
-
-    using namespace boost;
-
-    Oriented_side os = geom_traits().power_test_2_object()(p0, p1, p2, p);
-
-    if ( (os != ON_ORIENTED_BOUNDARY) || (! perturb))
-        return os;
-
-    // We are now in a degenerate case => we do a symbolic perturbation.
-
-    // We sort the points lexicographically.
-    const Weighted_point * points[4] = {&p0, &p1, &p2, &p};
-    std::sort(points, points + 4,
-              boost::bind(&Self::compare_xy, this,
-                          boost::bind(Dereference<Weighted_point>(), _1),
-                          boost::bind(Dereference<Weighted_point>(), _2)) == SMALLER);
-
-
-
-
-
-    // We successively look whether the leading monomial, then 2nd monomial
-    // of the determinant has non null coefficient.
-    // 2 iterations are enough (cf paper)
-    for (int i=3; i>1; --i) {
-        if (points[i] == &p)
-            return ON_NEGATIVE_SIDE; // since p0 p1 p2 are non collinear
-                                     // and positively oriented
-	Orientation o;
-        if (points[i] == &p2 && (o = orientation(p0,p1,p)) != COLLINEAR )
-            return o;
-        if (points[i] == &p1 && (o = orientation(p0,p,p2)) != COLLINEAR )
-            return o;
-        if (points[i] == &p0 && (o = orientation(p,p1,p2)) != COLLINEAR )
-            return o;
-    }
-
-    CGAL_triangulation_assertion(false);
-    return ON_NEGATIVE_SIDE;
-}
-
-template < class Gt, class Tds >
-inline
-Oriented_side
-Regular_triangulation_2<Gt,Tds>::
-power_test(const Weighted_point &p,
-	   const Weighted_point &q,
-	   const Weighted_point &r) const
-{
-  return geom_traits().power_test_2_object()(p,q,r);
-}
-
-template < class Gt, class Tds >
-inline
-Oriented_side
-Regular_triangulation_2<Gt,Tds>::
-power_test(const Weighted_point &p,
-	   const Weighted_point &r) const
-{
-  return geom_traits().power_test_2_object()(p,r);
-}
-
-template < class Gt, class Tds >
-bool
-Regular_triangulation_2<Gt,Tds>::
-is_valid_face(Face_handle fh) const
-{
-  bool result = true;
-  if(is_infinite(fh)) result = result && fh->vertex_list().empty();
-  if (!result) { show_face(fh);}
-  CGAL_triangulation_assertion(result);
-
-  typename Vertex_list::iterator vlit = fh->vertex_list().begin(),
-	                       vldone = fh->vertex_list().end();
-  for (; vlit != vldone; vlit++)    {
-    result = result && power_test(fh, (*vlit)->point()) == ON_NEGATIVE_SIDE;
-    result = result && ((*vlit)->face() == fh);
-    if (!result)     show_face(fh);
-    CGAL_triangulation_assertion(result); 
-  }
-  return result;
-}
-
-template < class Gt, class Tds >
-bool
-Regular_triangulation_2<Gt,Tds>::
-is_valid_vertex(Vertex_handle vh) const
-{
-  bool result = true;
-  if (vh->is_hidden()) {
-    Locate_type lt; 
-    int li;
-    Face_handle loc  = locate(vh->point(), lt, li, vh->face());
-    if (dimension() == 0) {
-        result = result && lt == Base::VERTEX;
-        result = result && power_test (vh->face()->vertex(0)->point(), vh->point()) <= 0;
-    } else {
-        result = result && (!is_infinite(vh->face()));
-        result = result && (loc == vh->face() ||
-                (lt == Base::VERTEX && 
-                 vh->face()->has_vertex(loc->vertex(li))) ||
-                (lt == Base::EDGE && vh->face() ==
-                 loc->neighbor(li)) );
-
-        result = result && 
-            power_test(vh->face(),vh->point()) == ON_NEGATIVE_SIDE;
-//            if ( !result) {
-//               std::cerr << " from is_valid_vertex " << std::endl;
-//               std::cerr << "sommet cache " << &*(vh) 
-//         		<< "vh_point " <<vh->point() << " " << std::endl;
-//               std::cerr << "vh_>face " << &*(vh->face())  << " " << std::endl;
-//               std::cerr <<  "loc      " <<  &*(loc )
-//         	        << " lt " << lt  << " li " << li << std::endl;
-//               show_face(vh->face());
-//               show_face(loc);
-//             }
-    }
-  }
-  else { // normal vertex
-    result = result && vh->face()->has_vertex(vh);
-//     if ( !result) {
-//       std::cerr << " from is_valid_vertex " << std::endl;
-//       std::cerr << "normal vertex " << &(*vh) << std::endl;
-//       std::cerr << vh->point() << " " << std::endl;
-//       std::cerr << "vh_>face " << &*(vh->face())  << " " << std::endl;
-//       show_face(vh->face());
-//     }
-  }
-  CGAL_triangulation_assertion(result);
-  return result;
-}
-
-template < class Gt, class Tds >
-bool
-Regular_triangulation_2<Gt,Tds>::
-is_valid(bool verbose, int /* level */) const
-{
-  // cannot call for is_valid() of Base Triangulation class
-  // because 1) number of vertices of base class does not match
-  // tds.is_valid calls is_valid for each vertex
-  // and the test is not fullfilled by  hidden vertices ...
-  // result = result && Triangulation_2<Gt,Tds>::is_valid(verbose, level);
-  bool result = true;
-  for(All_faces_iterator fit = all_faces_begin(); 
-      fit != all_faces_end(); ++fit) {
-    result = result && is_valid_face(fit);
-  }
-
-  for(All_vertices_iterator vit = all_vertices_begin(); 
-                            vit != all_vertices_end(); ++vit) {
-    result = result && is_valid_vertex(vit);
-  }
-
-   for(Hidden_vertices_iterator hvit = hidden_vertices_begin(); 
-                                hvit != hidden_vertices_end(); ++hvit) {
-    result = result && is_valid_vertex(hvit);
-  }
-
-   switch(dimension()) {
-   case 0 :
-     break;
-   case 1:
-     if (number_of_vertices() > 2 ) {
-       Finite_vertices_iterator it1 = finite_vertices_begin(),
-	 it2(it1), it3(it1);
-       ++it2;
-       ++it3; ++it3;
-       while( it3 != finite_vertices_end()) {
-	 Orientation s = orientation(it1->point(),
-				    it2->point(),
-				    it3->point()); 
-	 result = result && s == COLLINEAR ;
-	 CGAL_triangulation_assertion(result);
-	 ++it1 ; ++it2; ++it3;
-       }
-     }
-     break;
-   case 2 :
-    for(Finite_faces_iterator it=finite_faces_begin(); 
-	 it!=finite_faces_end(); it++) {
-      CGAL_triangulation_assertion( ! is_infinite(it));
-      Orientation s = orientation(it->vertex(0)->point(),
-				  it->vertex(1)->point(),
-				  it->vertex(2)->point());
-      CGAL_triangulation_assertion( s == LEFT_TURN );
-      result = result && ( s == LEFT_TURN );
-
-      for (int i = 0 ; i < 3 ; i++) {
-	if (!is_infinite(it->vertex(i)))
-	  result = result && ON_POSITIVE_SIDE != 
-	    power_test(it->neighbor(i), it->vertex(i)->point());
-	CGAL_triangulation_assertion(result);
-      }
-    }
-
-     Vertex_circulator start = incident_vertices(infinite_vertex());
-     Vertex_circulator pc(start);
-     Vertex_circulator qc(start); ++qc;
-     Vertex_circulator rc(start); ++rc; ++rc;
-     do{
-       Orientation s = orientation(pc->point(),
-				   qc->point(),
-				   rc->point());
-       CGAL_triangulation_assertion( s != LEFT_TURN );
-       result = result && ( s != LEFT_TURN );
-       ++pc ; ++qc ; ++rc;
-     } while(pc != start);
- 
-     // check number of faces. This cannot be done by the Tds
-     // which does not know the number of components nor the genus
-     result = result && (number_of_faces() == 2*(number_of_vertices()+1)
-		                            - 4 
-                                           - degree(infinite_vertex()));
-     CGAL_triangulation_assertion( result);
-     break;
-   }
-  
-   // in any dimension
-   if(verbose) {
-     std::cerr << " nombres de sommets " << number_of_vertices() << "\t"
-	       << "nombres de sommets  caches " << number_of_hidden_vertices()
-	       << std::endl;
-   }
-   result = result && ( Base::number_of_vertices() ==
-			number_of_vertices() + number_of_hidden_vertices());
-   CGAL_triangulation_assertion( result);
-   return result;
-}
-
-
-template <class Gt, class Tds >
-void
- Regular_triangulation_2<Gt, Tds>::
-show_face(Face_handle fh) const
-{
-  Base::show_face(fh);
-
-  typename Vertex_list::iterator current;
-  std::cerr << "  +++++>>>    ";
-  for (current= fh->vertex_list().begin(); 
-       current!= fh->vertex_list().end() ; current++ ) {
-        std::cerr <<"[ "<< ((*current)->point()) << " ] ,  ";
-  }
-  std::cerr <<std::endl;
-}
-
-
-template < class Gt, class Tds >
-void
-Regular_triangulation_2<Gt,Tds>::
-show_all() const
-{
-  std::cerr<< "AFFICHE TOUTE LA TRIANGULATION :" << std::endl;
-  std::cerr << std::endl<<"====> "<< this ;
-  std::cerr <<  " dimension " <<  dimension() << std::endl;
-  std::cerr << "nb of vertices " << number_of_vertices() 
-	    << " nb of hidden vertices " << number_of_hidden_vertices() 
-	    <<   std::endl;
-
-  if (dimension() < 1) return;
-  if(dimension() == 1) {
-    std::cerr<<" all edges "<<std::endl; 
-    All_edges_iterator aeit;
-    for(aeit = all_edges_begin(); aeit != all_edges_end(); aeit++){
-      show_face(aeit->first);
-    }
-   }
-  
-  else{ //dimension ==2
-    std::cerr<<" faces finies "<<std::endl;
-    Finite_faces_iterator fi;
-    for(fi = finite_faces_begin(); fi != finite_faces_end(); fi++) {
-      show_face(fi);
-    }
-
-    std::cerr <<" faces infinies "<<std::endl;
-    All_faces_iterator afi;
-    for(afi = all_faces_begin(); afi != all_faces_end(); afi++) {
-      if(is_infinite(afi)) show_face(afi);
-    }
-  }
-  
-  if (number_of_vertices()>1) {
-    std::cerr << "affichage des sommets de la triangulation reguliere"
-	      <<std::endl;
-    All_vertices_iterator vi;
-    for( vi = all_vertices_begin(); vi != all_vertices_end(); vi++){
-      show_vertex(vi);
-      std::cerr << "  / face associee : "
-	     <<  &*(vi->face()) << std::endl;
-      }
-      std::cerr<<std::endl;
-  }
-  
-   std::cerr << "sommets caches "  << std::endl;
-   Hidden_vertices_iterator hvi = hidden_vertices_begin();
-   for( ; hvi != hidden_vertices_end(); hvi++) {
-     show_vertex(hvi);
-      std::cerr << "  / face associee : "
-	     << &*(hvi->face()) << std::endl;
-   }
-  return;
-}
-
-
-
-//DUALITY
-template < class Gt, class Tds >
-inline
-typename Regular_triangulation_2<Gt,Tds>::Bare_point
-Regular_triangulation_2<Gt,Tds>::
-dual (Face_handle f) const
-{
-  return weighted_circumcenter(f);
-}
-
-template < class Gt, class Tds >
-inline
-typename Regular_triangulation_2<Gt,Tds>::Bare_point
-Regular_triangulation_2<Gt,Tds>::
-weighted_circumcenter(Face_handle f) const
-{
-  CGAL_triangulation_precondition (dimension()==2 || !is_infinite(f));
-  return weighted_circumcenter(f->vertex(0)->point(),
-			       f->vertex(1)->point(),
-			       f->vertex(2)->point());
-}
-
-template<class Gt, class Tds>
-inline
-typename Regular_triangulation_2<Gt,Tds>::Bare_point
-Regular_triangulation_2<Gt,Tds>::
-weighted_circumcenter(const Weighted_point& p0, 
-		      const Weighted_point& p1, 
-		      const Weighted_point& p2) const
-{
-  return 
-    geom_traits().construct_weighted_circumcenter_2_object()(p0,p1,p2);
-}
-
-template < class Gt, class Tds >
-inline
-Object
-Regular_triangulation_2<Gt,Tds>::
-dual(const Edge &e) const
-{
-  typedef typename Geom_traits::Line_2        Line;
-  typedef typename Geom_traits::Ray_2         Ray;
-  typedef typename Geom_traits::Segment_2     Segment;
-  
-  CGAL_triangulation_precondition (! is_infinite(e));
-  if( dimension()== 1 ){
-    const Weighted_point& p = (e.first)->vertex(cw(e.second))->point();
-    const Weighted_point& q = (e.first)->vertex(ccw(e.second))->point();
-    Line l  = geom_traits().construct_radical_axis_2_object()(p,q);
-    return make_object(l);
-  }
-  
-  // dimension==2
-  if( (! is_infinite(e.first)) &&
-      (! is_infinite(e.first->neighbor(e.second))) ) {
-    Segment s = geom_traits().construct_segment_2_object()
-      (dual(e.first),dual(e.first->neighbor(e.second)));
-    return make_object(s);
-  } 
-
-  // one of the adjacent faces is infinite
-  Face_handle f; int i;
-  if ( is_infinite(e.first)) {
-    f=e.first->neighbor(e.second); i=f->index(e.first);
-  } 
-  else {
-    f=e.first; i=e.second;
-  }
-  const Weighted_point& p = f->vertex( cw(i))->point();
-  const Weighted_point& q = f->vertex( ccw(i))->point();
-  Line l  = geom_traits().construct_radical_axis_2_object()(p,q);
-  Ray r = geom_traits().construct_ray_2_object()(dual(f), l);
-  return make_object(r);
-}
-  
-
-template < class Gt, class Tds >
-inline 
-Object
-Regular_triangulation_2<Gt,Tds>::  
-dual(const Edge_circulator& ec) const
-{
-  return dual(*ec);
-}
-  
-template < class Gt, class Tds >
-inline 
-Object
-Regular_triangulation_2<Gt,Tds>::
-dual(const Finite_edges_iterator& ei) const
-{
-  return dual(*ei);
-}
-
-//INSERTION-REMOVAL
-template < class Gt, class Tds >
-typename Regular_triangulation_2<Gt,Tds>::Vertex_handle
-Regular_triangulation_2<Gt,Tds>::
-push_back(const Weighted_point &p)
-{	
-    return insert(p);
-}
-
-template < class Gt, class Tds >
-typename Regular_triangulation_2<Gt,Tds>::Vertex_handle
-Regular_triangulation_2<Gt,Tds>::
-insert(const Weighted_point &p, Face_handle start)
-{
-  Locate_type lt;
-  int li;
-  Face_handle loc = locate(p, lt, li, start);
-  return insert(p, lt, loc, li);
-}
-
-template < class Gt, class Tds >
-typename Regular_triangulation_2<Gt,Tds>::Vertex_handle
-Regular_triangulation_2<Gt,Tds>::
-insert(const Weighted_point &p, Locate_type lt, Face_handle loc, int li) 
-{
-    Vertex_handle v;
-    switch (lt) {
-    case Base::VERTEX:
-        {
-            CGAL_precondition (dimension() >= 0);
-            if (dimension() == 0) {
-                // in this case locate() oddly returns loc = NULL and li = 4,
-                // so we work around it.
-                loc = finite_vertex()->face();
-                li = 0;
-            }
-
-            Vertex_handle vv = loc->vertex(li);
-	    CGAL::Oriented_side side = power_test (vv->point(), p);
-	    
-	    switch(side) {
-	      
-	    case ON_NEGATIVE_SIDE:
-	      return hide_new_vertex (loc, p);
-	      
-	    case ON_POSITIVE_SIDE:
-	      v = this->_tds.create_vertex(); 
-	      v->set_point(p);
-	      exchange_incidences(v,vv);
-	      hide_vertex(loc, vv);
-	      regularize (v);
-	      return v;
-	      
-	    case ON_ORIENTED_BOUNDARY:
-	      return vv;
-	    }
-        }
-    case Base::EDGE:
-        {
-            CGAL_precondition (dimension() >= 1);
-            Oriented_side os = dimension() == 1 ? power_test (loc, li, p) :
-                                                  power_test (loc, p, true);
-
-            if (os < 0) {
-                if (is_infinite (loc)) loc = loc->neighbor (li);
-                return hide_new_vertex (loc, p);
-            }
-            v = insert_in_edge (p, loc, li);
-            break;
-        }
-
-    case Base::FACE:
-        {
-            CGAL_precondition (dimension() >= 2);
-            if (power_test (loc, p, true) < 0) {
-                return hide_new_vertex(loc,p);
-            }
-            v = insert_in_face (p, loc);
-            break;
-        }
-    default:
-        v = Base::insert (p, lt, loc, li);
-    }
-
-    if (lt == OUTSIDE_AFFINE_HULL) {
-        //clear vertex list of infinite faces which have been copied
-        for ( All_faces_iterator afi = all_faces_begin();
-                afi != all_faces_end(); afi++)
-            if (is_infinite (afi))
-                afi->vertex_list().clear();
-    }
-
-    regularize (v);
-
-    return v;
-}
-
-/*
-The reinsert function  insert a weighted point which was in a hidden
-vertex.
-The new and old vertices are then exchanged ; this is required
-if the regular triangulation is used with a hierarchy because
-the old vertex has its up and down pointers set and other vertices
-pointing on him
-*/
-template < class Gt, class Tds >
-typename Regular_triangulation_2<Gt,Tds>::Vertex_handle
-Regular_triangulation_2<Gt,Tds>::
-reinsert(Vertex_handle v, Face_handle start)
-{
-  CGAL_triangulation_assertion(v->is_hidden());
-  v->set_hidden(false);
-  _hidden_vertices--;
- 
-//   //to debug 
-//   std::cerr << "from reinsert " << std::endl;
-//   show_vertex(v);
-//   Locate_type lt;
-//   int li;
-//   Face_handle loc = locate(v->point(), lt, li, start);
-//   std::cerr << "locate " << &(*loc) << "\t" << lt << "\t" << li <<
-//     std::endl;
-//   show_face(loc);
-//    std::cerr << std::endl;
-
-  Vertex_handle vh = insert(v->point(), start);
-  if(vh->is_hidden()) exchange_hidden(v,vh);
-  else  exchange_incidences(v,vh);
-  this->_tds.delete_vertex(vh);
-  return v;
-}
-
- 
-//push va instead of vb in the list of the face fb hiding vb
-// vb must be the last inserted vertex in the list of fb
-template < class Gt, class Tds >
-void
-Regular_triangulation_2<Gt,Tds>::
-exchange_hidden(Vertex_handle va, Vertex_handle vb)
-{ 
-  CGAL_triangulation_assertion (vb->is_hidden());
-  CGAL_triangulation_assertion (vb == vb->face()->vertex_list().back());
- 
-//   //to debug 
-//   std::cerr << "from exchange hidden 1" << std::endl;
-//   show_vertex(vb);
-//   std::cerr << "  / face associee : "
-// 	     << &*(vb->face()) << std::endl;
-  
-  vb->face()->vertex_list().pop_back();
-  _hidden_vertices--;
-  hide_vertex(vb->face(), va);
-
-//  //to debug 
-//   std::cerr << "from exchange hidden 1" << std::endl;
-//   show_vertex(va);
-//   std::cerr << "  / face associee : "
-// 	     << &*(va->face()) << std::endl << std::endl; 
-}
-
-// set to va the incidences of vb 
-template < class Gt, class Tds >
-void
-Regular_triangulation_2<Gt,Tds>::
-exchange_incidences(Vertex_handle va, Vertex_handle vb)
-{
-  CGAL_triangulation_assertion ( !vb->is_hidden());
-  std::list<Face_handle> faces;
-  if (dimension() == 0) {
-    faces.push_back (vb->face());
-  } else if (dimension() == 1) {
-    faces.push_back(vb->face());
-    int i = vb->face()->index(vb);
-    faces.push_back(vb->face()->neighbor(1-i));
-  }
-  else {
-    CGAL_triangulation_assertion (dimension() == 2);
-    Face_circulator fc = incident_faces(vb), done(fc);
-    do {
-      faces.push_back(fc);
-      fc++;
-    }while(fc != done);
-  }
-
-  va->set_face(*(faces.begin()));
-  for(typename std::list<Face_handle>::iterator it = faces.begin();
-      it != faces.end(); it++){
-    Face_handle fh = *it;
-    fh->set_vertex(fh->index(vb), va);
-  }
-  return;
-}
-
-template < class Gt, class Tds >
-typename Regular_triangulation_2<Gt,Tds>::Vertex_handle
-Regular_triangulation_2<Gt,Tds>::
-insert_in_face(const Weighted_point &p, Face_handle f)
-{
-  Vertex_handle v = Base::insert_in_face(p,f);
-  update_hidden_points_1_3(f, 
-			   f->neighbor(ccw(f->index(v))), 
-			   f->neighbor( cw(f->index(v))) );
-  return v;
-}
-
-template < class Gt, class Tds >
-typename Regular_triangulation_2<Gt,Tds>::Vertex_handle
-Regular_triangulation_2<Gt,Tds>::
-insert_in_edge(const Weighted_point &p, Face_handle f, int i)
-{
-  Vertex_handle v;
-  if (dimension() == 1) {
-    v = Base::insert_in_edge(p,f,i);
-    Face_handle g = f->neighbor(1 - f->index(v));
-    update_hidden_points_2_2(f,g);
-  }
-  else { //dimension()==2
-    // don't use update_hidden_points_2_2 any more to split
-    // hidden vertices list because new affectation of f and n
-    // around new vertex is unknown
-    Face_handle n = f->neighbor(i);
-    Vertex_list p_list;
-    p_list.splice(p_list.begin(),f->vertex_list());
-    p_list.splice(p_list.begin(),n->vertex_list());
-    v = Base::insert_in_edge(p,f,i);
-    Face_handle loc;
-    while ( ! p_list.empty() ){
-      loc = locate(p_list.front()->point(), n);
-      if (is_infinite(loc)) loc = loc->neighbor(loc->index(infinite_vertex()));
-      hide_vertex(loc, p_list.front());
-      p_list.pop_front();
-    }
-  }
-  return v;
-} 
-
-template < class Gt, class Tds >
-void
-Regular_triangulation_2<Gt,Tds>::
-regularize(Vertex_handle v)
-{
-  CGAL_triangulation_precondition( v != infinite_vertex());
-  Faces_around_stack faces_around;
-
-  if (dimension() < 1) return;
-
-  //initialise faces_around
-  if (dimension() == 1) {
-    faces_around.push_back(v->face());
-    faces_around.push_back(v->face()->neighbor(1- v->face()->index(v)));
-  }
-  else{ //dimension==2
-    Face_circulator fit = incident_faces(v), done(fit);
-    do {
-      faces_around.push_back(fit++);
-    } while(fit != done);
-  }
-
-  while( ! faces_around.empty() )
-    stack_flip(v, faces_around);
-  return;
-}
-
-
-template < class Gt, class Tds >
-void
-Regular_triangulation_2<Gt,Tds>::
-flip(Face_handle f, int i)
-{
-  Face_handle n = f->neighbor(i);
-  Base::flip(f,i);
-  update_hidden_points_2_2(f,n);
-}
-
-
-template < class Gt, class Tds >
-void
-Regular_triangulation_2<Gt,Tds>::
-remove_degree_3(Vertex_handle v, Face_handle f) 
-{
-  if (f == Face_handle())    f=v->face();
-  update_hidden_points_3_1(f, f->neighbor( cw(f->index(v))),
-			   f->neighbor(ccw(f->index(v))));
-  Base::remove_degree_3(v,f);
-  if (is_infinite(f)) { //the list of f is given to its finite neighbor
-    Face_handle fn = f->neighbor(f->index(infinite_vertex()));
-    set_face(f->vertex_list(),fn);
-    fn->vertex_list().splice(fn->vertex_list().begin(),f->vertex_list());
-  }
-
-}
-
-
-template < class Gt, class Tds >
-void
-Regular_triangulation_2<Gt,Tds>::
-remove_hidden(Vertex_handle v )
-{
-  _hidden_vertices--;
-  v->face()->vertex_list().remove(v);
-  delete_vertex(v);
-  return;
-}
-
-template < class Gt, class Tds >
-void
-Regular_triangulation_2<Gt,Tds>::
-remove(Vertex_handle v )
-{
-    CGAL_triangulation_precondition( v != Vertex_handle() );
-    CGAL_triangulation_precondition(!is_infinite(v));
-
-    if (v->is_hidden())
-        return remove_hidden (v);
-
-    Face_handle hint;
-    int ihint = 0;
-
-    Vertex_list to_reinsert;
-    switch (dimension()) {
-    case 0:
-        to_reinsert.splice (to_reinsert.begin(), v->face()->vertex_list());
-        break;
-    case 1:
-        {
-            Face_handle f1 = v->face();
-            ihint = f1->index(v);
-            hint = f1->neighbor(ihint);
-            Face_handle f2 = f1->neighbor(1 - ihint);
-            ihint = mirror_index (f1, ihint);
-
-            to_reinsert.splice (to_reinsert.begin(), f1->vertex_list());
-            to_reinsert.splice (to_reinsert.begin(), f2->vertex_list());
-            break;
-        }
-    case 2:
-        {
-            Face_circulator f = incident_faces (v), end = f;
-            ihint = f->index(v);
-            hint = f->neighbor(ihint);
-            ihint = mirror_index (f, ihint);
-            do to_reinsert.splice (to_reinsert.begin(), f->vertex_list());
-            while (++f != end);
-            break;
-        }
-    }
-
-    if (number_of_vertices() <= 2) {
-        this->_tds.remove_dim_down(v);
-    } else if (dimension() < 2) {
-        Base::remove (v);
-    } else {
-        remove_2D (v);
-    }
-
-    if (hint != Face_handle()) hint = hint->neighbor(ihint);
-
-    for (typename Vertex_list::iterator i = to_reinsert.begin();
-            i != to_reinsert.end(); ++i)
-    {
-        hint = reinsert (*i, hint)->face();
-    }
-}
-
-template < class Gt, class Tds >
-void
-Regular_triangulation_2<Gt,Tds>::
-remove_2D(Vertex_handle v)
-{
-  if (test_dim_down(v)) {  this->_tds.remove_dim_down(v);  }
-  else {
-    std::list<Edge> hole;
-    make_hole(v, hole);
-    fill_hole_regular(hole);
-    delete_vertex(v);
-  }
-  return;   
-}
-
-
-template < class Gt, class Tds >
-void
-Regular_triangulation_2<Gt,Tds>::
-fill_hole_regular(std::list<Edge> & first_hole)
-{
-  typedef std::list<Edge> Hole;
-  typedef std::list<Hole> Hole_list;
-  
-  Hole hole;
-  Hole_list hole_list;
-  Face_handle ff, fn;
-  int i, ii, in;
-	
-  hole_list.push_front(first_hole);
-  
-  while (! hole_list.empty())
-    {
-      hole = hole_list.front();
-      hole_list.pop_front();
-      typename Hole::iterator hit = hole.begin();
-	    
-      // if the hole has only three edges, create the triangle
-      if (hole.size() == 3)
-	{
-	  Face_handle  newf = create_face();
-	  hit = hole.begin();
-	  for(int j=0; j<3; j++)
-	    {
-	      ff = (*hit).first;
-	      ii = (*hit).second;
-	      hit++;
-	      ff->set_neighbor(ii,newf);
-	      newf->set_neighbor(j,ff);
-	      newf->set_vertex(newf->ccw(j),ff->vertex(ff->cw(ii)));
-	    }
-	  continue;
-	}
-  
-      // else find an edge with two finite vertices
-      // on the hole boundary
-      // and the new triangle adjacent to that edge
-      //  cut the hole and push it back
- 
-      // first, ensure that a neighboring face
-      // whose vertices on the hole boundary are finite
-      // is the first of the hole
-      bool finite = false;
-      while (!finite)
-	{
-	  ff = hole.front().first;
-	  ii = hole.front().second;
-	  if ( is_infinite(ff->vertex(cw(ii))) ||
-	       is_infinite(ff->vertex(ccw(ii))))
-	    {
-	      hole.push_back(hole.front());
-	      hole.pop_front();
-	    }
-	  else
-	    finite = true;
-	}
- 
-      // take the first neighboring face and pop it;
-      ff = hole.front().first;
-      ii = hole.front().second;
-      hole.pop_front();
- 
-      Vertex_handle  v0 = ff->vertex(ff->cw(ii)); 
-      const Weighted_point& p0 = v0->point();
-      Vertex_handle  v1 = ff->vertex(ff->ccw(ii)); 
-      const Weighted_point& p1 = v1->point();
-      Vertex_handle  v2 = infinite_vertex(); 
-      Weighted_point p2;
-      Vertex_handle  vv;
-      Weighted_point p;
- 
-      typename Hole::iterator hdone = hole.end();
-      hit = hole.begin();
-      typename Hole::iterator cut_after(hit);
- 
-      // if tested vertex is c with respect to the vertex opposite
-      // to NULL neighbor,
-      // stop at the before last face;
-      hdone--;
-      while (hit != hdone) 
-	{
-	  fn = (*hit).first;
-	  in = (*hit).second;
-	  vv = fn->vertex(ccw(in));
-	  if (is_infinite(vv))
-	    {
-	      if (is_infinite(v2))
-		cut_after = hit;
-	    }
-	  else 
-	    {	// vv is a finite vertex
-	      p = vv->point();
-	      if (orientation(p0,p1,p) == 
-		  COUNTERCLOCKWISE)
-		{
-		  if (is_infinite(v2))
-		    {
-		      v2=vv;
-		      p2=p;
-		      cut_after=hit;
-		    }
-		  else if (power_test(p0,p1,p2,p,true) == 
-			   ON_POSITIVE_SIDE)
-		    {
-		      v2=vv;
-		      p2=p;
-		      cut_after=hit;
-		    }
-		}
-	    }
-	  ++hit;
-	}
- 
-      // create new triangle and update adjacency relations
-      Face_handle newf = create_face(v0,v1,v2);
-      newf->set_neighbor(2,ff);
-      ff->set_neighbor(ii, newf);
- 
-      //update the hole and push back in the Hole_List stack
-      // if v2 belongs to the neighbor following or preceding *f
-      // the hole remain a single hole
-      // otherwise it is split in two holes
- 
-      fn = hole.front().first;
-      in = hole.front().second;
-      if (fn->has_vertex(v2, i) && i == (int)fn->ccw(in)) 
-	{
-	  newf->set_neighbor(0,fn);
-	  fn->set_neighbor(in,newf);
-	  hole.pop_front();
-	  hole.push_front(Edge(newf,1));
-	  hole_list.push_front(hole);
-	}
-      else
-	{
-	  fn = hole.back().first;
-	  in = hole.back().second;
-	  if (fn->has_vertex(v2, i) && i == (int)fn->cw(in)) 
-	    {
-	      newf->set_neighbor(1,fn);
-	      fn->set_neighbor(in,newf);
-	      hole.pop_back();
-	      hole.push_back(Edge(newf,0));
-	      hole_list.push_front(hole);
-	    }
-	  else
-	    { // split the hole in two holes
-	      Hole new_hole;
-	      ++cut_after;
-	      while (hole.begin() != cut_after)
-		{
-		  new_hole.push_back(hole.front());
-		  hole.pop_front();
-		}
- 
-	      hole.push_front(Edge(newf,1));
-	      new_hole.push_front(Edge(newf,0));
-	      hole_list.push_front(hole);
-	      hole_list.push_front(new_hole);
-	    }
-	}
-    }
-}
-
-
-template < class Gt, class Tds >
-void
-Regular_triangulation_2<Gt,Tds>::
-set_face(Vertex_list& vl, const Face_handle& fh)
-{
-  for(typename Vertex_list::iterator it = vl.begin(); it != vl.end(); it++)
-    (*it)->set_face(fh);
-}
-
-// add the vertex_list of f2 and f3 to the point list of f1
-// for the 3-1 flip
-template < class Gt, class Tds >
-void
-Regular_triangulation_2<Gt,Tds>::
-update_hidden_points_3_1(const Face_handle& f1, const Face_handle& f2, 
-			 const Face_handle& f3)
-{
-  set_face(f2->vertex_list(), f1);
-  set_face(f3->vertex_list(), f1);
-  (f1->vertex_list()).splice(f1->vertex_list().begin(),f2->vertex_list());
-  (f1->vertex_list()).splice(f1->vertex_list().begin(),f3->vertex_list());
-  return;				  
-}
-
-
-// the points of the lists of 2 faces are sorted
-// because of a 2-2 flip
-template < class Gt, class Tds >
-void
-Regular_triangulation_2<Gt,Tds>::
-update_hidden_points_2_2(const Face_handle& f1, const Face_handle& f2)
-{	
-  CGAL_triangulation_assertion(f1->has_neighbor(f2));
-    
-  Vertex_list p_list;
-  p_list.splice(p_list.begin(),f1->vertex_list());
-  p_list.splice(p_list.begin(),f2->vertex_list());
-
-  // if one of the face is infinite, 
-  // the other face hide all the points
-  if ( is_infinite(f1)) {
-    set_face(p_list, f2);
-    (f2->vertex_list()).splice(f2->vertex_list().begin(),p_list);
-    return;
-  }
-  if ( is_infinite(f2)) {
-    set_face(p_list, f1);
-    (f1->vertex_list()).splice(f1->vertex_list().begin(),p_list);
-    return;
-  }
-
-  if (dimension() == 1) {
-    const Weighted_point& a1 = f1->vertex(f1->index(f2))->point();
-    const Weighted_point& a  = f1->vertex(1-f1->index(f2))->point();
-    while ( ! p_list.empty() ) {
-      if ( compare_x(a, p_list.front()->point()) == 
-	   compare_x(a, a1)  &&
-	   compare_y(a, p_list.front()->point()) == 
-	   compare_y(a, a1))
-	{
-	  hide_vertex(f1, p_list.front());
-	} else {
-	hide_vertex(f2, p_list.front());
-	}
-      p_list.pop_front();
-    }
-    return;
-  }
-
-  // from here f1 and f2 are finite 2-dimensional faces
-  int idx2 = f1->index(f2);
-  Vertex_handle v0=f1->vertex(ccw(idx2));
-  Vertex_handle v1=f1->vertex(cw(idx2));
-  CGAL_triangulation_assertion( !is_infinite(v0) && !is_infinite(v1)); 
-
-  while ( ! p_list.empty() )
-    {
-      if (orientation(v0->point(), v1->point(), p_list.front()->point()) ==
-	  COUNTERCLOCKWISE)
-	hide_vertex(f1, p_list.front());
-	else
-	hide_vertex(f2, p_list.front());
-      p_list.pop_front();
-    }
-}
-	  
-// The point list of f1 is separated into 3 lists
-// for a 1-3 flip
-template < class Gt, class Tds >
-void
-Regular_triangulation_2<Gt,Tds>::
-update_hidden_points_1_3(const Face_handle& f1, const Face_handle& f2, 
-			 const Face_handle& f3)
-{
-    CGAL_triangulation_assertion(f1->has_neighbor(f2) &&
-			      f2->has_neighbor(f3) &&
-			      f3->has_neighbor(f1));
-
-
-    Vertex_list p_list;
-    p_list.splice(p_list.begin(),f1->vertex_list());
-    if (p_list.empty())
-	return;
-
-    // the following does not work if 
-    // two of f1,f2 and f3 are twice neighbors
-    // but this cannot appear taking the assertion into account;
-    int idx2 = f1->index(f2),
-        idx3 = f1->index(f3);
-    Vertex_handle v2 = f1->vertex(idx2),
-                  v3 = f1->vertex(idx3),
-                  v0 = f1->vertex(3-(idx2+idx3)),
-                  v1 = f2->vertex(f2->index(f1));
-
-    CGAL_triangulation_assertion(f2->has_vertex(v0) && f1->has_vertex(v0));
-    CGAL_triangulation_assertion(f3->has_vertex(v1));
-    CGAL_triangulation_assertion( ! is_infinite(v0));
-
-    // if two of f1, f2,and f3 are infinite
-    // the list goes entirely to the third finite face
-    // no orientation test necessary
-    // because the point list of an infinite face
-    // is only made of point projecting on its finite edge
-    if ( is_infinite(f1 ) && is_infinite(f2)) {
-      set_face(p_list, f3);
-      f3->vertex_list().splice(f3->vertex_list().begin(), p_list);
-      return;
-    }
-    if ( is_infinite(f1) && is_infinite(f3)) {
-      set_face(p_list, f2);
-      f2->vertex_list().splice(f2->vertex_list().begin(), p_list);
-      return;
-    }
-    if ( is_infinite(f2) && is_infinite(f3)){
-      set_face(p_list, f1);
-      f1->vertex_list().splice(f1->vertex_list().begin(), p_list);
-      return;
-    }
-    
-    // if here, v1,v2,v3 and v0 are finite vertices
-    while(! p_list.empty())
-    {
-      Vertex_handle v(p_list.front());
-//       if(orientation(v2->point(),v0->point(), v->point()) !=
-// 	 orientation(v2->point(),v0->point(),v3->point()) )
-//       { // not in f1
-// 	if (orientation(v1->point(), v0->point(), v->point() ) !=
-// 	    orientation(v1->point(), v0->point(), v3->point() ) )
-// 	  // not in f2
-// 	    hide_vertex(f3, v);
-// 	   else
-// 	    hide_vertex(f2, v);
-//       }
-//       else
-// 	  hide_vertex(f1, v);
-      if(orientation(v2->point(),v0->point(), v->point()) ==
- 	 orientation(v2->point(),v0->point(),v3->point())  &&
-	 orientation(v3->point(),v0->point(), v->point()) ==
-	 orientation(v3->point(),v0->point(), v2->point()))
-	hide_vertex(f1, v);
-      else if (orientation(v1->point(), v0->point(), v->point()) ==
-	       orientation(v1->point(), v0->point(), v3->point()) )
-	hide_vertex(f2,v);
-      else hide_vertex(f3,v);
-      p_list.pop_front();
-    }
-}
-
-// the vertex is a degree three vertex which has to removed
-// and hidden
-// create first  a new hidden vertex and exchange with the vertex
-// to be removed by the tds : 
-// this is required to keep up and down pointers right when using a hierarchy
-template < class Gt, class Tds >
-void 
-Regular_triangulation_2<Gt,Tds>::
-hide_remove_degree_3(Face_handle fh, Vertex_handle vh)
-{
- Vertex_handle vnew= this->_tds.create_vertex();
- exchange_incidences(vnew,vh);
- remove_degree_3(vnew, fh);
- hide_vertex(fh,vh);
-}
-
-// create a vertex and hide it
-template < class Gt, class Tds >
-typename Regular_triangulation_2<Gt,Tds>::Vertex_handle
-Regular_triangulation_2<Gt,Tds>::
-hide_new_vertex(Face_handle f, const Weighted_point& p)
-{
-  Vertex_handle v = this->_tds.create_vertex(); 
-  v->set_point(p);
-  hide_vertex(f, v);
-  return v;
-}
-
-// insert the vertex to the hidden vertex list
-template < class Gt, class Tds >
-void
-Regular_triangulation_2<Gt,Tds>::
-hide_vertex(Face_handle f, Vertex_handle vh)
-{
-  // no hidden vertex in infinite face
-  if(is_infinite(f) && dimension() > 0) f = f->neighbor(f->index(infinite_vertex()));
- 
-  if(! vh->is_hidden()) {
-    vh->set_hidden(true);
-    _hidden_vertices++;
-  }
-  vh->set_face(f);
-  f->vertex_list().push_back(vh);
-}
-
-// template < class Gt, class Tds >
-// void
-// Regular_triangulation_2<Gt,Tds>::
-// hide_vertex(Face_handle f, void* ptr)
-// {
-//   Vertex_handle v(static_cast<Vertex*>(ptr));
-//   hide_vertex(f, v);
-// }
-
-
-
-template < class Gt, class Tds >
-void
-Regular_triangulation_2<Gt,Tds>::
-stack_flip(Vertex_handle v, Faces_around_stack &faces_around)
-{
-  Face_handle f=faces_around.front();
-  faces_around.pop_front();
-  int i = f->index(v);
-  Face_handle n = f->neighbor(i);
-    
-  if (dimension() == 1 ) {
-    if ( is_infinite(f)  || is_infinite(n) ) return;
-    if ( power_test( v->point(),
-		     n->vertex(n->index(f))->point(),
-		     f->vertex(1-i)->point()) ==  ON_NEGATIVE_SIDE)
-      stack_flip_dim1(f,i,faces_around);
-    return;
-  }  
-
-  // now dimension() == 2
-  //test the regularity of edge (f,i)
-  //if( power_test(n, v->point()) == ON_NEGATIVE_SIDE)
-  if( power_test(n, v->point(), true) != ON_POSITIVE_SIDE)
-    return;
-    
-  if(is_infinite(f,i))
-    {
-      int j = 3 - ( i + f->index(infinite_vertex()));
-      if ( degree(f->vertex(j)) == 4)
-	stack_flip_4_2(f,i,j,faces_around);
-      return;
-    }
-
-    // now f and n are both finite faces
-    int ni = n->index(f);
-    Orientation occw = orientation(f->vertex(i)->point(),
-				   f->vertex(ccw(i))->point(),
-				   n->vertex(ni)->point());
-    Orientation ocw  = orientation(f->vertex(i)->point(),
-				   f->vertex(cw(i))->point(),
-				   n->vertex(ni)->point());
-    if (occw == LEFT_TURN && ocw == RIGHT_TURN) {
-      // quadrilater (f,n) is convex
-      stack_flip_2_2(f,i, faces_around);
-      return;
-    }
-    if (occw == RIGHT_TURN && degree(f->vertex(ccw(i))) == 3) {
-      stack_flip_3_1(f,i,ccw(i),faces_around);
-      return;
-    }
-    if (ocw == LEFT_TURN && degree(f->vertex(cw(i))) == 3) {
-      stack_flip_3_1(f,i,cw(i),faces_around);
-      return;
-    }
-    if (occw == COLLINEAR && degree(f->vertex(ccw(i))) == 4) {
-      stack_flip_4_2(f,i,ccw(i),faces_around);
-      return;
-    }
-    if (ocw == COLLINEAR && degree(f->vertex(cw(i))) == 4)
-      stack_flip_4_2(f,i,cw(i),faces_around);
-    
-    return;
-}
-
-
-template < class Gt, class Tds >
-void
-Regular_triangulation_2<Gt,Tds>::
-stack_flip_4_2(Face_handle f, int i, int j, Faces_around_stack & faces_around)
-{
-    int k = 3-(i+j);
-    Face_handle g=f->neighbor(k);
-    if (!faces_around.empty())
-    {
-      if (faces_around.front() == g)
-	  faces_around.pop_front();
-      else if (faces_around.back() == g) 
-	  faces_around.pop_back();
-    }
-    
-    //union f with  g and f->neihgbor(i) with g->f->neihgbor(i)
-    Face_handle fn = f->neighbor(i);
-    //Face_handle gn = g->neighbor(g->index(f->vertex(i)));
-    Vertex_handle vq = f->vertex(j);
-    
-    this->_tds.flip( f, i); //not using flip because the vertex j is flat.
-    update_hidden_points_2_2(f,fn);
-    Face_handle h1 = ( j == ccw(i) ? fn : f);
-    //hide_vertex(h1, vq);
-    hide_remove_degree_3(g,vq);
-    if(j == ccw(i)) {
-      faces_around.push_front(h1); 
-      faces_around.push_front(g);
-    }
-    else {
-      faces_around.push_front(g);
-      faces_around.push_front(h1); 
-    }
-}
-
-
-template < class Gt, class Tds >
-void
-Regular_triangulation_2<Gt,Tds>::
-stack_flip_3_1(Face_handle f, int i, int j, Faces_around_stack & faces_around)
-{
-  int k = 3-(i+j);
-  Face_handle g=f->neighbor(k);
-  if (!faces_around.empty())
-  {
-    if (faces_around.front()== g)
-	faces_around.pop_front();
-    else if ( faces_around.back() == g)
-	faces_around.pop_back();
-  }
-
-  Vertex_handle vq= f->vertex(j);
-  //hide_vertex(f,vq);
-  hide_remove_degree_3(f,vq);
-  faces_around.push_front(f);
-}
-
-
-template < class Gt, class Tds >
-void
-Regular_triangulation_2<Gt,Tds>::
-stack_flip_2_2(Face_handle f, int i, Faces_around_stack & faces_around)
-{
-    Vertex_handle vq = f->vertex(ccw(i));
-    flip(f,i);
-    if(f->has_vertex(vq)) {
-      faces_around.push_front(f->neighbor(ccw(i)));
-      faces_around.push_front(f);
-    }
-    else { 
-      faces_around.push_front(f);
-      faces_around.push_front(f->neighbor(cw(i)));
-    }
-}
-  
-template < class Gt, class Tds >
-void
-Regular_triangulation_2<Gt,Tds>::
-stack_flip_dim1(Face_handle f, int i, Faces_around_stack &faces_around)
-{
-  Vertex_handle va = f->vertex(1-i);
-  Face_handle n= f->neighbor(i);
-  int in = n->index(f);
-  Vertex_handle vb = n->vertex(in);
-  f->set_vertex(1-i, n->vertex(in));
-  vb->set_face(f);
-  f->set_neighbor(i, n->neighbor(1-in));
-  n->neighbor(1-in)->set_neighbor(n->neighbor(1-in)->index(n), f);
-  (f->vertex_list()).splice(f->vertex_list().begin(),n->vertex_list());
-  set_face(f->vertex_list(),f);
-  this->delete_face(n);
-  hide_vertex(f,va);
-  faces_around.push_front(f);
-  return;
-}
-
-
-template < class Gt, class Tds >
-typename Regular_triangulation_2<Gt,Tds>::All_vertices_iterator 
-Regular_triangulation_2<Gt,Tds>::
-all_vertices_begin () const
-{
-  return CGAL::filter_iterator(Base::all_vertices_end(), 
-			 Hidden_tester(),
-			 Base::all_vertices_begin());
-}
-
-template < class Gt, class Tds >
-typename Regular_triangulation_2<Gt,Tds>::All_vertices_iterator 
-Regular_triangulation_2<Gt,Tds>::
-all_vertices_end () const
-{
-  return CGAL::filter_iterator(Base::all_vertices_end(), 
-			 Hidden_tester() ); 
-}
-
-template < class Gt, class Tds >
-typename Regular_triangulation_2<Gt,Tds>::Finite_vertices_iterator 
-Regular_triangulation_2<Gt,Tds>::
-finite_vertices_begin () const
-{
-  return CGAL::filter_iterator(Base::finite_vertices_end(), 
-			 Hidden_tester(),
-			 Base::finite_vertices_begin());
-}
-
-template < class Gt, class Tds >
-typename Regular_triangulation_2<Gt,Tds>::Vertex_handle 
-Regular_triangulation_2<Gt,Tds>::
-finite_vertex () const
-{
-  CGAL_triangulation_precondition (number_of_vertices() >= 1);
-  return (finite_vertices_begin());
-}
-
-
-
-template < class Gt, class Tds >
-typename Regular_triangulation_2<Gt,Tds>::Finite_vertices_iterator 
-Regular_triangulation_2<Gt,Tds>::
-finite_vertices_end () const
-{
-
-  return CGAL::filter_iterator(Base::finite_vertices_end(), 
-			 Hidden_tester() );
-
-}
-
-template < class Gt, class Tds >
-typename Regular_triangulation_2<Gt,Tds>::Hidden_vertices_iterator 
-Regular_triangulation_2<Gt,Tds>::
-hidden_vertices_begin () const
-{
-  return CGAL::filter_iterator(Base::finite_vertices_end(), 
-			 Unhidden_tester(), 
-			 Base::finite_vertices_begin() );
-
-}
-
-template < class Gt, class Tds >
-typename Regular_triangulation_2<Gt,Tds>::Hidden_vertices_iterator 
-Regular_triangulation_2<Gt,Tds>::
-hidden_vertices_end () const
-{
-  return CGAL::filter_iterator(Base::finite_vertices_end(), 
-			 Unhidden_tester() );
-}
-
-template < class Gt, class Tds >
-typename Regular_triangulation_2<Gt,Tds>::Vertex_handle
-Regular_triangulation_2<Gt,Tds>::
-nearest_power_vertex(const Bare_point& p) const
-{
-  if ( dimension() == -1 ) { return Vertex_handle(); }
-
-  if ( dimension() == 0 ) { return this->finite_vertex(); }
-
-  typename Geom_traits::Compare_power_distance_2 cmp_power_distance =
-    geom_traits().compare_power_distance_2_object();
-
-  Vertex_handle vclosest;
-  Vertex_handle v = this->finite_vertex();
-
-  //  if ( dimension() == 1 ) {
-  //  }
-
-  do {
-    vclosest = v;
-    Weighted_point wp = v->point();
-    Vertex_circulator vc_start = incident_vertices(v);
-    Vertex_circulator vc = vc_start;
-    do {
-      if ( !is_infinite(vc) ) {
-	if ( cmp_power_distance(p, vc->point(), wp) == SMALLER ) {
-	  v = vc;
-	  break;
-	}
-      }
-      ++vc;
-    } while ( vc != vc_start );
-  } while ( vclosest != v );
-
-  return vclosest;  
-}
-
-
-} //namespace CGAL 
-
-#endif // CGAL_REGULAR_TRIANGULATION_2_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Regular_triangulation_3.h b/3rdparty/CGAL-4.8/include/CGAL/Regular_triangulation_3.h
deleted file mode 100644
index 6060008..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Regular_triangulation_3.h
+++ /dev/null
@@ -1,2326 +0,0 @@
-// Copyright (c) 1999-2004  INRIA Sophia-Antipolis (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
-// 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(s)     : Monique Teillaud <Monique.Teillaud at sophia.inria.fr>
-//                 Sylvain Pion
-//                 Christophe Delage <Christophe.Delage at sophia.inria.fr>
-//                 Clement Jamin
-
-#ifndef CGAL_REGULAR_TRIANGULATION_3_H
-#define CGAL_REGULAR_TRIANGULATION_3_H
-
-#include <CGAL/basic.h>
-
-#include <set>
-
-#ifdef CGAL_LINKED_WITH_TBB
-# include <CGAL/point_generators_3.h>
-# include <tbb/parallel_for.h>
-# include <tbb/enumerable_thread_specific.h>
-# include <tbb/concurrent_vector.h>
-#endif
-
-#include <CGAL/Triangulation_3.h>
-#include <CGAL/Regular_triangulation_cell_base_3.h>
-#include <boost/bind.hpp>
-
-#ifndef CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
-#include <CGAL/Spatial_sort_traits_adapter_3.h>
-#include <CGAL/internal/info_check.h>
-
-#include <boost/iterator/zip_iterator.hpp>
-#include <boost/mpl/and.hpp>
-#endif //CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
-#ifdef CGAL_TRIANGULATION_3_PROFILING
-# include <CGAL/Mesh_3/Profiling_tools.h>
-#endif
-
-#ifdef CGAL_CONCURRENT_TRIANGULATION_3_ADD_TEMPORARY_POINTS_ON_FAR_SPHERE
-#include <CGAL/point_generators_3.h>
-#endif
-
-#if defined(BOOST_MSVC)
-#  pragma warning(push)
-#  pragma warning(disable:4355) // complaint about using 'this' to
-#endif                          // initialize a member
-
-namespace CGAL {
-
-  /************************************************
-   *
-   * Regular_triangulation_3 class
-   *
-   ************************************************/
-
-  template < class Gt, class Tds_ = Default, class Lock_data_structure_ = Default >
-  class Regular_triangulation_3
-  : public Triangulation_3<
-      Gt,
-      typename Default::Get<Tds_, Triangulation_data_structure_3 <
-        Triangulation_vertex_base_3<Gt>,
-        Regular_triangulation_cell_base_3<Gt> > >::type,
-      Lock_data_structure_>
-  {
-    typedef Regular_triangulation_3<Gt, Tds_, Lock_data_structure_> Self;
-
-    typedef typename Default::Get<Tds_, Triangulation_data_structure_3 <
-      Triangulation_vertex_base_3<Gt>,
-      Regular_triangulation_cell_base_3<Gt> > >::type Tds;
-
-    typedef Triangulation_3<Gt,Tds,Lock_data_structure_> Tr_Base;
-
-  public:
-
-    typedef Tds                                   Triangulation_data_structure;
-    typedef Gt                                    Geom_traits;
-
-    typedef typename Tr_Base::Concurrency_tag     Concurrency_tag;
-    typedef typename Tr_Base::Lock_data_structure Lock_data_structure;
-
-    typedef typename Tr_Base::Vertex_handle       Vertex_handle;
-    typedef typename Tr_Base::Cell_handle         Cell_handle;
-    typedef typename Tr_Base::Vertex              Vertex;
-    typedef typename Tr_Base::Cell                Cell;
-    typedef typename Tr_Base::Facet               Facet;
-    typedef typename Tr_Base::Edge                Edge;
-
-    typedef typename Tr_Base::size_type           size_type;
-    typedef typename Tr_Base::Locate_type         Locate_type;
-    typedef typename Tr_Base::Cell_iterator       Cell_iterator;
-    typedef typename Tr_Base::Facet_iterator      Facet_iterator;
-    typedef typename Tr_Base::Edge_iterator       Edge_iterator;
-    typedef typename Tr_Base::Facet_circulator    Facet_circulator;
-
-    typedef typename Tr_Base::Finite_vertices_iterator Finite_vertices_iterator;
-    typedef typename Tr_Base::Finite_cells_iterator    Finite_cells_iterator;
-    typedef typename Tr_Base::Finite_facets_iterator   Finite_facets_iterator;
-    typedef typename Tr_Base::Finite_edges_iterator    Finite_edges_iterator;
-    typedef typename Tr_Base::All_cells_iterator       All_cells_iterator;
-
-    typedef typename Gt::Weighted_point_3            Weighted_point;
-    typedef typename Gt::Bare_point                  Bare_point;
-    typedef typename Gt::Segment_3                   Segment;
-    typedef typename Gt::Triangle_3                  Triangle;
-    typedef typename Gt::Tetrahedron_3               Tetrahedron;
-
-    // types for dual:
-    typedef typename Gt::Line_3        Line;
-    typedef typename Gt::Ray_3         Ray;
-    typedef typename Gt::Plane_3       Plane;
-    typedef typename Gt::Object_3      Object;
-
-    //Tag to distinguish Delaunay from Regular triangulations
-    typedef Tag_true   Weighted_tag;
-
-    using Tr_Base::cw;
-    using Tr_Base::ccw;
-#ifndef CGAL_CFG_USING_BASE_MEMBER_BUG_2
-    using Tr_Base::geom_traits;
-#endif
-    using Tr_Base::number_of_vertices;
-    using Tr_Base::dimension;
-    using Tr_Base::finite_facets_begin;
-    using Tr_Base::finite_facets_end;
-    using Tr_Base::finite_vertices_begin;
-    using Tr_Base::finite_vertices_end;
-    using Tr_Base::finite_cells_begin;
-    using Tr_Base::finite_cells_end;
-    using Tr_Base::finite_edges_begin;
-    using Tr_Base::finite_edges_end;
-    using Tr_Base::tds;
-    using Tr_Base::infinite_vertex;
-    using Tr_Base::next_around_edge;
-    using Tr_Base::vertex_triple_index;
-    using Tr_Base::mirror_vertex;
-    using Tr_Base::mirror_index;
-    using Tr_Base::orientation;
-    using Tr_Base::coplanar_orientation;
-    using Tr_Base::adjacent_vertices;
-    using Tr_Base::construct_segment;
-    using Tr_Base::incident_facets;
-    using Tr_Base::insert_in_conflict;
-    using Tr_Base::is_infinite;
-    using Tr_Base::is_valid_finite;
-    using Tr_Base::locate;
-    using Tr_Base::side_of_segment;
-    using Tr_Base::side_of_edge;
-    using Tr_Base::find_conflicts;
-    using Tr_Base::is_valid;
-
-    Regular_triangulation_3(const Gt & gt = Gt(), Lock_data_structure *lock_ds = NULL)
-      : Tr_Base(gt, lock_ds), hidden_point_visitor(this)
-    {}
-
-    Regular_triangulation_3(Lock_data_structure *lock_ds, const Gt & gt = Gt())
-      : Tr_Base(lock_ds, gt), hidden_point_visitor(this)
-    {}
-
-    Regular_triangulation_3(const Regular_triangulation_3 & rt)
-      : Tr_Base(rt), hidden_point_visitor(this)
-    {
-      CGAL_triangulation_postcondition( is_valid() );
-    }
-
-    //insertion
-    template < typename InputIterator >
-    Regular_triangulation_3(InputIterator first, InputIterator last,
-      const Gt & gt = Gt(), Lock_data_structure *lock_ds = NULL)
-      : Tr_Base(gt, lock_ds), hidden_point_visitor(this)
-    {
-      insert(first, last);
-    }
-
-    template < typename InputIterator >
-    Regular_triangulation_3(InputIterator first, InputIterator last,
-      Lock_data_structure *lock_ds, const Gt & gt = Gt())
-      : Tr_Base(gt, lock_ds), hidden_point_visitor(this)
-    {
-      insert(first, last);
-    }
-
-  private:
-
-#ifdef CGAL_CONCURRENT_TRIANGULATION_3_ADD_TEMPORARY_POINTS_ON_FAR_SPHERE
-    std::vector<Vertex_handle> 
-    add_temporary_points_on_far_sphere(const size_t num_points)
-    {
-      std::vector<Vertex_handle> far_sphere_vertices;
-
-      const size_t MIN_NUM_POINTS_FOR_FAR_SPHERE_POINTS = 1000000;
-      if (num_points >= MIN_NUM_POINTS_FOR_FAR_SPHERE_POINTS)
-      {
-        // Add temporary vertices on a "far sphere" to reduce contention on
-        // the infinite vertex
-
-        // Get bbox
-        const Bbox_3 &bbox = *this->get_bbox();
-        // Compute radius for far sphere
-        const double& xdelta = bbox.xmax() - bbox.xmin();
-        const double& ydelta = bbox.ymax() - bbox.ymin();
-        const double& zdelta = bbox.zmax() - bbox.zmin();
-        const double radius = 1.3 * 0.5 * std::sqrt(xdelta*xdelta +
-          ydelta*ydelta +
-          zdelta*zdelta);
-
-        // WARNING - TODO: this code has to be fixed because Vector_3 is not 
-        // required by the traits concept
-        const typename Gt::Vector_3 center(
-          bbox.xmin() + 0.5*xdelta,
-          bbox.ymin() + 0.5*ydelta,
-          bbox.zmin() + 0.5*zdelta);
-        Random_points_on_sphere_3<Point> random_point(radius);
-        const int NUM_PSEUDO_INFINITE_VERTICES = static_cast<int>(
-          tbb::task_scheduler_init::default_num_threads() * 3.5);
-        std::vector<Point> points_on_far_sphere;
-        for (int i = 0 ; i < NUM_PSEUDO_INFINITE_VERTICES ; ++i, ++random_point)
-          points_on_far_sphere.push_back(*random_point + center);
-
-        spatial_sort(points_on_far_sphere.begin(),
-          points_on_far_sphere.end(),
-          geom_traits());
-
-        std::vector<Point>::const_iterator it_p = points_on_far_sphere.begin();
-        std::vector<Point>::const_iterator it_p_end = points_on_far_sphere.end();
-        for (; it_p != it_p_end ; ++it_p)
-        {
-          Locate_type lt;
-          Cell_handle c;
-          int li, lj;
-
-          c = locate(*it_p, lt, li, lj, hint);
-          Vertex_handle v = insert(*it_p, lt, c, li, lj);
-          hint = (v == Vertex_handle() ? c : v->cell());
-
-          far_sphere_vertices.push_back(v);
-        }
-      }
-
-      return far_sphere_vertices;
-    }
-
-    void remove_temporary_points_on_far_sphere(
-      const std::vector<Vertex_handle> & far_sphere_vertices)
-    {
-      if (!far_sphere_vertices.empty())
-      {
-        // Remove the temporary vertices on far sphere
-        remove(far_sphere_vertices.begin(), far_sphere_vertices.end());
-      }
-    }
-#endif // CGAL_CONCURRENT_TRIANGULATION_3_ADD_TEMPORARY_POINTS_ON_FAR_SPHERE
-
-  public:
-
-#ifndef CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
-    template < class InputIterator >
-    std::ptrdiff_t
-      insert( InputIterator first, InputIterator last,
-      typename boost::enable_if<
-      boost::is_convertible<
-      typename std::iterator_traits<InputIterator>::value_type,
-      Weighted_point
-      >
-      >::type* = NULL
-      )
-#else
-    template < class InputIterator >
-    std::ptrdiff_t
-      insert( InputIterator first, InputIterator last)
-#endif //CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
-    {
-#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
-      static Profile_branch_counter_3 bcounter(
-        "early withdrawals / late withdrawals / successes [Regular_tri_3::insert]");
-#endif
-
-#ifdef CGAL_TRIANGULATION_3_PROFILING
-      WallClockTimer t;
-#endif
-
-      size_type n = number_of_vertices();
-      std::vector<Weighted_point> points(first, last);
-      spatial_sort (points.begin(), points.end(), geom_traits());
-
-    // Parallel
-#ifdef CGAL_LINKED_WITH_TBB
-      if (this->is_parallel())
-      {
-        size_t num_points = points.size();
-        Cell_handle hint;
-        
-#ifdef CGAL_CONCURRENT_TRIANGULATION_3_ADD_TEMPORARY_POINTS_ON_FAR_SPHERE
-        std::vector<Vertex_handle> far_sphere_vertices = 
-          add_temporary_points_on_far_sphere(num_points);
-#endif
-      
-        size_t i = 0;
-        // Insert "num_points_seq" points sequentially
-        // (or more if dim < 3 after that)
-        size_t num_points_seq = (std::min)(num_points, (size_t)100);
-        while (dimension() < 3 || i < num_points_seq)
-        {
-          Locate_type lt;
-          Cell_handle c;
-          int li, lj;
-
-          c = locate (points[i], lt, li, lj, hint);
-          Vertex_handle v = insert (points[i], lt, c, li, lj);
-
-          hint = (v == Vertex_handle() ? c : v->cell());
-          ++i;
-        }
-
-        tbb::enumerable_thread_specific<Vertex_handle> tls_hint(hint->vertex(0));
-        tbb::parallel_for(
-          tbb::blocked_range<size_t>( i, num_points ),
-          Insert_point<Self>(*this, points, tls_hint)
-        );
-
-#ifdef CGAL_CONCURRENT_TRIANGULATION_3_ADD_TEMPORARY_POINTS_ON_FAR_SPHERE
-        remove_temporary_points_on_far_sphere(far_sphere_vertices);
-#endif
-      }
-      // Sequential
-      else
-#endif // CGAL_LINKED_WITH_TBB
-      {
-        Cell_handle hint;
-        for (typename std::vector<Weighted_point>::const_iterator p = points.begin(),
-          end = points.end(); p != end; ++p)
-        {
-          Locate_type lt;
-          Cell_handle c;
-          int li, lj;
-          c = locate (*p, lt, li, lj, hint);
-
-          Vertex_handle v = insert (*p, lt, c, li, lj);
-
-          hint = v == Vertex_handle() ? c : v->cell();
-        }
-      }
-#ifdef CGAL_TRIANGULATION_3_PROFILING
-      std::cerr << "Points inserted in " << t.elapsed() << " seconds." << std::endl;
-#endif
-      return number_of_vertices() - n;
-    }
-
-
-#ifndef CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
-  private:
-    //top stands for tuple-or-pair
-    template <class Info>
-    const Weighted_point& top_get_first(const std::pair<Weighted_point,Info>& pair) const { return pair.first; }
-    template <class Info>
-    const Info& top_get_second(const std::pair<Weighted_point,Info>& pair) const { return pair.second; }
-    template <class Info>
-    const Weighted_point& top_get_first(const boost::tuple<Weighted_point,Info>& tuple) const { return boost::get<0>(tuple); }
-    template <class Info>
-    const Info& top_get_second(const boost::tuple<Weighted_point,Info>& tuple) const { return boost::get<1>(tuple); }
-
-    template <class Tuple_or_pair,class InputIterator>
-    std::ptrdiff_t insert_with_info(InputIterator first,InputIterator last)
-    {
-      size_type n = number_of_vertices();
-      std::vector<std::ptrdiff_t> indices;
-      std::vector<Weighted_point> points;
-      std::vector<typename Triangulation_data_structure::Vertex::Info> infos;
-      std::ptrdiff_t index=0;
-      for (InputIterator it=first;it!=last;++it){
-        Tuple_or_pair pair = *it;
-        points.push_back( top_get_first(pair) );
-        infos.push_back ( top_get_second(pair) );
-        indices.push_back(index++);
-      }
-
-      typedef Spatial_sort_traits_adapter_3<Geom_traits,Weighted_point*> Search_traits;
-
-      spatial_sort( indices.begin(),indices.end(),Search_traits(&(points[0]),geom_traits()) );
-#ifdef CGAL_LINKED_WITH_TBB
-      if (this->is_parallel())
-      {
-        size_t num_points = points.size();
-        Cell_handle hint;
-
-#ifdef CGAL_CONCURRENT_TRIANGULATION_3_ADD_TEMPORARY_POINTS_ON_FAR_SPHERE
-        std::vector<Vertex_handle> far_sphere_vertices =
-          add_temporary_points_on_far_sphere(num_points);
-#endif
-
-        size_t i = 0;
-        // Insert "num_points_seq" points sequentially
-        // (or more if dim < 3 after that)
-        size_t num_points_seq = (std::min)(num_points, (size_t)100);
-        while (dimension() < 3 || i < num_points_seq)
-        {
-          Locate_type lt;
-          Cell_handle c;
-          int li, lj;
-          c = locate(points[indices[i]], lt, li, lj, hint);
-
-          Vertex_handle v = insert(points[indices[i]], lt, c, li, lj);
-          if (v != Vertex_handle()){
-            v->info() = infos[indices[i]];
-            hint = v->cell();
-          }
-          else
-            hint = c;
-
-          ++i;
-        }
-
-        tbb::enumerable_thread_specific<Vertex_handle> tls_hint(hint->vertex(0));
-        tbb::parallel_for(
-          tbb::blocked_range<size_t>(i, num_points),
-          Insert_point_with_info<Self>(*this, points, infos, indices, tls_hint)
-          );
-
-#ifdef CGAL_CONCURRENT_TRIANGULATION_3_ADD_TEMPORARY_POINTS_ON_FAR_SPHERE
-        remove_temporary_points_on_far_sphere(far_sphere_vertices);
-#endif
-      }
-      // Sequential
-      else
-#endif // CGAL_LINKED_WITH_TBB
-      {
-        Cell_handle hint;
-        for (typename std::vector<std::ptrdiff_t>::const_iterator
-          it = indices.begin(), end = indices.end();
-          it != end; ++it)
-        {
-          Locate_type lt;
-          Cell_handle c;
-          int li, lj;
-          c = locate (points[*it], lt, li, lj, hint);
-
-          Vertex_handle v = insert (points[*it], lt, c, li, lj);
-          if (v!=Vertex_handle()){
-            v->info()=infos[*it];
-            hint=v->cell();
-          }
-          else
-            hint=c;
-        }
-      }
-
-      return number_of_vertices() - n;
-    }
-
-  public:
-
-    template < class InputIterator >
-    std::ptrdiff_t
-      insert( InputIterator first,
-      InputIterator last,
-      typename boost::enable_if<
-      boost::is_convertible<
-      typename std::iterator_traits<InputIterator>::value_type,
-      std::pair<Weighted_point,typename internal::Info_check<typename Triangulation_data_structure::Vertex>::type>
-      >
-      >::type* = NULL
-      )
-    {return insert_with_info< std::pair<Weighted_point,typename internal::Info_check<typename Triangulation_data_structure::Vertex>::type> >(first,last);}
-
-    template <class  InputIterator_1,class InputIterator_2>
-    std::ptrdiff_t
-      insert( boost::zip_iterator< boost::tuple<InputIterator_1,InputIterator_2> > first,
-      boost::zip_iterator< boost::tuple<InputIterator_1,InputIterator_2> > last,
-      typename boost::enable_if<
-      boost::mpl::and_<
-      typename boost::is_convertible< typename std::iterator_traits<InputIterator_1>::value_type, Weighted_point >,
-      typename boost::is_convertible< typename std::iterator_traits<InputIterator_2>::value_type, typename internal::Info_check<typename Triangulation_data_structure::Vertex>::type >
-      >
-      >::type* =NULL
-      )
-    {return insert_with_info< boost::tuple<Weighted_point,typename internal::Info_check<typename Triangulation_data_structure::Vertex>::type> >(first,last);}
-#endif //CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
-
-
-    Vertex_handle insert(const Weighted_point & p, Vertex_handle hint,
-                         bool *could_lock_zone = NULL)
-    {
-      return insert(p,
-                    hint == Vertex_handle() ? this->infinite_cell() : hint->cell(),
-                    could_lock_zone);
-    }
-
-    Vertex_handle insert(const Weighted_point & p,
-      Cell_handle start = Cell_handle(), bool *could_lock_zone = NULL);
-
-    Vertex_handle insert(const Weighted_point & p, Locate_type lt,
-      Cell_handle c, int li, int, bool *could_lock_zone = NULL);
-
-    template <class CellIt>
-    Vertex_handle
-      insert_in_hole(const Weighted_point & p, CellIt cell_begin, CellIt cell_end,
-      Cell_handle begin, int i);
-
-    template <class CellIt>
-    Vertex_handle
-      insert_in_hole(const Weighted_point & p, CellIt cell_begin, CellIt cell_end,
-      Cell_handle begin, int i, Vertex_handle newv);
-
-    template <class OutputIteratorBoundaryFacets,
-    class OutputIteratorCells,
-    class OutputIteratorInternalFacets>
-      Triple<OutputIteratorBoundaryFacets,
-      OutputIteratorCells,
-      OutputIteratorInternalFacets>
-      find_conflicts(const Weighted_point &p, Cell_handle c,
-      OutputIteratorBoundaryFacets bfit,
-      OutputIteratorCells cit,
-      OutputIteratorInternalFacets ifit
-      , bool *could_lock_zone = NULL
-      , const Facet *this_facet_must_be_in_the_cz = NULL
-      , bool *the_facet_is_in_its_cz = NULL
-      ) const
-    {
-      CGAL_triangulation_precondition(dimension() >= 2);
-
-      std::vector<Cell_handle> cells;
-      cells.reserve(32);
-      std::vector<Facet> facets;
-      facets.reserve(64);
-
-      if (dimension() == 2) {
-        Conflict_tester_2 tester(p, this);
-        if (! tester (c)) return make_triple (bfit, cit, ifit);
-        ifit = Tr_Base::find_conflicts
-          (c, tester,
-          make_triple(std::back_inserter(facets),
-          std::back_inserter(cells),
-          ifit)
-          , could_lock_zone
-          , this_facet_must_be_in_the_cz
-          , the_facet_is_in_its_cz
-          ).third;
-      }
-      else {
-        Conflict_tester_3 tester(p, this);
-        if (! tester (c)) return make_triple (bfit, cit, ifit);
-        ifit = Tr_Base::find_conflicts
-          (c, tester,
-          make_triple(std::back_inserter(facets),
-          std::back_inserter(cells),
-          ifit)
-          , could_lock_zone
-          , this_facet_must_be_in_the_cz
-          , the_facet_is_in_its_cz
-          ).third;
-      }
-
-      // Reset the conflict flag on the boundary.
-      for(typename std::vector<Facet>::iterator fit=facets.begin();
-        fit != facets.end(); ++fit) {
-          fit->first->neighbor(fit->second)->tds_data().clear();
-          *bfit++ = *fit;
-      }
-
-      // Reset the conflict flag in the conflict cells.
-      for(typename std::vector<Cell_handle>::iterator ccit=cells.begin();
-        ccit != cells.end(); ++ccit) {
-          (*ccit)->tds_data().clear();
-          *cit++ = *ccit;
-      }
-      return make_triple(bfit, cit, ifit);
-    }
-
-    template <class OutputIteratorBoundaryFacets, class OutputIteratorCells>
-    std::pair<OutputIteratorBoundaryFacets, OutputIteratorCells>
-      find_conflicts(const Weighted_point &p, Cell_handle c,
-      OutputIteratorBoundaryFacets bfit,
-      OutputIteratorCells cit
-      , bool *could_lock_zone = NULL
-      ) const
-    {
-      Triple<OutputIteratorBoundaryFacets,
-        OutputIteratorCells,
-        Emptyset_iterator> t = find_conflicts(p, c, bfit, cit,
-                                              Emptyset_iterator(),
-                                              could_lock_zone);
-      return std::make_pair(t.first, t.second);
-    }
-
-    // Returns the vertices on the interior of the conflict hole.
-    template <class OutputIterator>
-    OutputIterator
-      vertices_inside_conflict_zone(const Weighted_point&p, Cell_handle c,
-      OutputIterator res) const
-    {
-      CGAL_triangulation_precondition(dimension() >= 2);
-
-      // Get the facets on the boundary of the hole, and the cells of the hole
-      std::vector<Cell_handle> cells;
-      std::vector<Facet> facets;
-      find_conflicts(p, c, std::back_inserter(facets),
-        std::back_inserter(cells), Emptyset_iterator());
-
-      // Put all vertices on the hole in 'vertices'
-      const int d = dimension();
-      std::set<Vertex_handle> vertices;
-      for (typename std::vector<Cell_handle>::const_iterator
-        it = cells.begin(),
-        end = cells.end(); it != end; ++it)
-      {
-        for(int i = 0; i <= d; ++i) {
-          vertices.insert((*it)->vertex(i));
-        }
-      }
-      // Then extract the vertices of the boundary and remove them from
-      // 'vertices'
-      if (dimension() == 3) {
-        for (typename std::vector<Facet>::const_iterator i = facets.begin();
-          i != facets.end(); ++i) {
-            vertices.erase(i->first->vertex((i->second+1)&3));
-            vertices.erase(i->first->vertex((i->second+2)&3));
-            vertices.erase(i->first->vertex((i->second+3)&3));
-        }
-      } else {
-        for (typename std::vector<Facet>::const_iterator i = facets.begin();
-          i != facets.end(); ++i) {
-            vertices.erase(i->first->vertex(cw(i->second)));
-            vertices.erase(i->first->vertex(ccw(i->second)));
-        }
-      }
-
-      return std::copy(vertices.begin(), vertices.end(), res);
-    }
-
-#ifndef CGAL_NO_DEPRECATED_CODE
-    // Returns the vertices on the boundary of the conflict hole.
-    template <class OutputIterator>
-    OutputIterator
-      vertices_in_conflict(const Weighted_point&p, Cell_handle c, OutputIterator res) const
-    {
-      return vertices_on_conflict_zone_boundary(p, c, res);
-    }
-#endif // CGAL_NO_DEPRECATED_CODE
-
-    // Returns the vertices on the boundary of the conflict hole.
-    template <class OutputIterator>
-    OutputIterator
-      vertices_on_conflict_zone_boundary(const Weighted_point&p, Cell_handle c,
-      OutputIterator res) const
-    {
-      CGAL_triangulation_precondition(dimension() >= 2);
-
-      // Get the facets on the boundary of the hole.
-      std::vector<Facet> facets;
-      find_conflicts(p, c, std::back_inserter(facets),
-        Emptyset_iterator(), Emptyset_iterator());
-
-      // Then extract uniquely the vertices.
-      std::set<Vertex_handle> vertices;
-      if (dimension() == 3) {
-        for (typename std::vector<Facet>::const_iterator i = facets.begin();
-          i != facets.end(); ++i) {
-            vertices.insert(i->first->vertex((i->second+1)&3));
-            vertices.insert(i->first->vertex((i->second+2)&3));
-            vertices.insert(i->first->vertex((i->second+3)&3));
-        }
-      } else {
-        for (typename std::vector<Facet>::const_iterator i = facets.begin();
-          i != facets.end(); ++i) {
-            vertices.insert(i->first->vertex(cw(i->second)));
-            vertices.insert(i->first->vertex(ccw(i->second)));
-        }
-      }
-
-      return std::copy(vertices.begin(), vertices.end(), res);
-    }
-
-    void remove (Vertex_handle v);
-    // Concurrency-safe
-    // See Triangulation_3::remove for more information
-    bool remove (Vertex_handle v, bool *could_lock_zone);
-
-    template < typename InputIterator >
-    size_type remove(InputIterator first, InputIterator beyond)
-    {
-      CGAL_triangulation_precondition(!this->does_repeat_in_range(first, beyond));
-      size_type n = number_of_vertices();
-
-#ifdef CGAL_TRIANGULATION_3_PROFILING
-      WallClockTimer t;
-#endif
-
-      // Parallel
-#ifdef CGAL_LINKED_WITH_TBB
-      if (this->is_parallel())
-      {
-        // TODO: avoid that by asking for ramdom-access iterators?
-        std::vector<Vertex_handle> vertices(first, beyond);
-        tbb::concurrent_vector<Vertex_handle> vertices_to_remove_sequentially;
-
-        tbb::parallel_for(
-          tbb::blocked_range<size_t>( 0, vertices.size()),
-          Remove_point<Self>(*this, vertices, vertices_to_remove_sequentially)
-        );
-
-        // Do the rest sequentially
-        for ( typename tbb::concurrent_vector<Vertex_handle>::const_iterator
-                it = vertices_to_remove_sequentially.begin(),
-                it_end = vertices_to_remove_sequentially.end()
-            ; it != it_end
-            ; ++it)
-        {
-          remove(*it);
-        }
-      }
-      // Sequential
-      else
-#endif // CGAL_LINKED_WITH_TBB
-      {
-        while (first != beyond) {
-          remove(*first);
-          ++first;
-        }
-      }
-
-#ifdef CGAL_TRIANGULATION_3_PROFILING
-      std::cerr << "Points removed in " << t.elapsed() << " seconds." << std::endl;
-#endif
-      return n - number_of_vertices();
-    }
-
-    
-    template <class OutputItCells>
-    void remove_and_give_new_cells(Vertex_handle v, OutputItCells cit)
-    {
-      Self tmp;
-      Vertex_remover<Self> remover (tmp);
-      Tr_Base::remove_and_give_new_cells(v, remover, cit);
-
-      CGAL_triangulation_expensive_postcondition(is_valid());
-    }
-
-
-    // DISPLACEMENT
-    Vertex_handle move_point(Vertex_handle v, const Weighted_point & p);
-
-    // Displacement works only for Regular triangulation
-    // without hidden points at any time
-    Vertex_handle move_if_no_collision(Vertex_handle v, const Weighted_point & p);
-    Vertex_handle move(Vertex_handle v, const Weighted_point & p);
-
-    // REMOVE CLUSTER - works only when Regular has no hidden point at all
-    // "regular as Delaunay"
-    template < typename InputIterator >
-    size_type remove_cluster(InputIterator first, InputIterator beyond)
-    {
-      Self tmp;
-      Vertex_remover<Self> remover (tmp);
-      return Tr_Base::remove(first, beyond, remover);
-    }
-
-  protected:
-
-    Oriented_side
-      side_of_oriented_power_sphere(const Weighted_point &p0,
-      const Weighted_point &p1,
-      const Weighted_point &p2,
-      const Weighted_point &p3,
-      const Weighted_point &p,
-      bool perturb = false) const;
-
-    Oriented_side
-      side_of_oriented_power_circle(const Weighted_point &p0,
-      const Weighted_point &p1,
-      const Weighted_point &p2,
-      const Weighted_point &p,
-      bool perturb = false) const;
-
-    Bounded_side
-      side_of_bounded_power_circle(const Weighted_point &p0,
-      const Weighted_point &p1,
-      const Weighted_point &p2,
-      const Weighted_point &p,
-      bool perturb = false) const;
-
-    Bounded_side
-      side_of_bounded_power_segment(const Weighted_point &p0,
-      const Weighted_point &p1,
-      const Weighted_point &p,
-      bool perturb = false) const;
-
-
-  public:
-
-    // Queries
-    Bounded_side
-      side_of_power_sphere(Cell_handle c, const Weighted_point &p,
-      bool perturb = false) const;
-
-    Bounded_side
-      side_of_power_circle(const Facet & f, const Weighted_point & p,
-      bool /* perturb */ = false) const
-    {
-      return side_of_power_circle(f.first, f.second, p);
-    }
-
-    Bounded_side
-      side_of_power_circle(Cell_handle c, int i, const Weighted_point &p,
-      bool perturb = false) const;
-
-    Bounded_side
-      side_of_power_segment(Cell_handle c, const Weighted_point &p,
-      bool perturb = false) const;
-
-    Vertex_handle
-      nearest_power_vertex_in_cell(const Bare_point& p,
-      Cell_handle c)  const;
-
-    Vertex_handle
-      nearest_power_vertex(const Bare_point& p, Cell_handle c =
-      Cell_handle()) const;
-
-    bool is_Gabriel(Cell_handle c, int i) const;
-    bool is_Gabriel(Cell_handle c, int i, int j) const;
-    bool is_Gabriel(const Facet& f)const ;
-    bool is_Gabriel(const Edge& e) const;
-    bool is_Gabriel(Vertex_handle v) const;
-
-
-    // Dual functions
-    Bare_point dual(Cell_handle c) const;
-
-    Object dual(const Facet & f) const
-    { return dual( f.first, f.second ); }
-
-    Object dual(Cell_handle c, int i) const;
-
-    template < class Stream>
-    Stream& draw_dual(Stream & os)
-    {
-      for (Finite_facets_iterator fit = finite_facets_begin(),
-        end = finite_facets_end();
-        fit != end; ++fit) {
-          Object o = dual(*fit);
-          if      (const Segment    *s = object_cast<Segment>(&o))    os << *s;
-          else if (const Ray        *r = object_cast<Ray>(&o))        os << *r;
-          else if (const Bare_point *p = object_cast<Bare_point>(&o)) os << *p;
-      }
-      return os;
-    }
-
-    bool is_valid(bool verbose = false, int level = 0) const;
-
-  protected:
-    bool
-      less_power_distance(const Bare_point &p,
-      const Weighted_point &q,
-      const Weighted_point &r)  const
-    {
-      return
-        geom_traits().compare_power_distance_3_object()(p, q, r) == SMALLER;
-    }
-
-    Bare_point
-      construct_weighted_circumcenter(const Weighted_point &p,
-      const Weighted_point &q,
-      const Weighted_point &r,
-      const Weighted_point &s) const
-    {
-      return geom_traits().construct_weighted_circumcenter_3_object()(p,q,r,s);
-    }
-
-    Bare_point
-      construct_weighted_circumcenter(const Weighted_point &p,
-      const Weighted_point &q,
-      const Weighted_point &r) const
-    {
-      return geom_traits().construct_weighted_circumcenter_3_object()(p,q,r);
-    }
-
-    Line
-      construct_perpendicular_line(const Plane &pl, const Bare_point &p) const
-    {
-      return geom_traits().construct_perpendicular_line_3_object()(pl, p);
-    }
-
-    Plane
-      construct_plane(const Bare_point &p, const Bare_point &q, const Bare_point &r) const
-    {
-      return geom_traits().construct_plane_3_object()(p, q, r);
-    }
-
-    Ray
-      construct_ray(const Bare_point &p, const Line &l) const
-    {
-      return geom_traits().construct_ray_3_object()(p, l);
-    }
-
-    Object
-      construct_object(const Bare_point &p) const
-    {
-      return geom_traits().construct_object_3_object()(p);
-    }
-
-    Object
-      construct_object(const Segment &s) const
-    {
-      return geom_traits().construct_object_3_object()(s);
-    }
-
-    Object
-      construct_object(const Ray &r) const
-    {
-      return geom_traits().construct_object_3_object()(r);
-    }
-
-    Vertex_handle
-      nearest_power_vertex(const Bare_point &p,
-      Vertex_handle v,
-      Vertex_handle w) const
-    {
-      // In case of equality, v is returned.
-      CGAL_triangulation_precondition(v != w);
-      if (is_infinite(v))	  return w;
-      if (is_infinite(w))	  return v;
-      return less_power_distance(p, w->point(), v->point()) ? w : v;
-    }
-
-    Oriented_side
-      power_test(const Weighted_point &p, const Weighted_point &q) const
-    {
-      CGAL_triangulation_precondition(this->equal(p, q));
-      return geom_traits().power_test_3_object()(p, q);
-    }
-
-    Oriented_side
-      power_test(const Weighted_point &p, const Weighted_point &q,
-      const Weighted_point &r) const
-    {
-      CGAL_triangulation_precondition(this->collinear(p, q, r));
-      return geom_traits().power_test_3_object()(p, q, r);
-    }
-
-    Oriented_side
-      power_test(const Weighted_point &p, const Weighted_point &q,
-      const Weighted_point &r, const Weighted_point &s) const
-    {
-      CGAL_triangulation_precondition(this->coplanar(p, q, r, s));
-      return geom_traits().power_test_3_object()(p, q, r, s);
-    }
-
-    Oriented_side
-      power_test(const Weighted_point &p, const Weighted_point &q,
-      const Weighted_point &r, const Weighted_point &s,
-      const Weighted_point &t) const
-    {
-      return geom_traits().power_test_3_object()(p, q, r, s, t);
-    }
-
-    bool in_conflict_3(const Weighted_point &p, const Cell_handle c) const
-    {
-      return side_of_power_sphere(c, p, true) == ON_BOUNDED_SIDE;
-    }
-
-    bool in_conflict_2(const Weighted_point &p, const Cell_handle c, int i) const
-    {
-      return side_of_power_circle(c, i, p, true) == ON_BOUNDED_SIDE;
-    }
-
-    bool in_conflict_1(const Weighted_point &p, const Cell_handle c) const
-    {
-      return side_of_power_segment(c, p, true) == ON_BOUNDED_SIDE;
-    }
-
-    bool in_conflict_0(const Weighted_point &p, const Cell_handle c) const
-    {
-      return power_test(c->vertex(0)->point(), p) == ON_POSITIVE_SIDE;
-    }
-
-    bool in_conflict(const Weighted_point &p, const Cell_handle c) const
-    {
-      switch (dimension()) {
-      case 0: return in_conflict_0(p, c);
-      case 1: return in_conflict_1(p, c);
-      case 2: return in_conflict_2(p, c, 3);
-      case 3: return in_conflict_3(p, c);
-      }
-      return true;
-    }
-
-    class Conflict_tester_3
-    {
-      const Weighted_point &p;
-      const Self *t;
-
-    public:
-
-      Conflict_tester_3(const Weighted_point &pt, const Self *tr)
-        : p(pt), t(tr) {}
-
-      bool operator()(const Cell_handle c) const {
-        return t->in_conflict_3(p, c);
-      }
-
-      bool test_initial_cell(const Cell_handle c) const {
-        return operator()(c);
-      }
-      Oriented_side compare_weight(const Weighted_point &wp1,
-        const Weighted_point &wp2) const
-      {
-        return t->power_test (wp1, wp2);
-      }
-    };
-
-    class Conflict_tester_2
-    {
-      const Weighted_point &p;
-      const Self *t;
-    public:
-
-      Conflict_tester_2(const Weighted_point &pt, const Self *tr)
-        : p(pt), t(tr) {}
-
-      bool operator()(const Cell_handle c) const
-      {
-        return t->in_conflict_2(p, c, 3);
-      }
-      bool test_initial_cell(const Cell_handle c) const {
-        return operator()(c);
-      }
-      Oriented_side compare_weight(const Weighted_point &wp1,
-        const Weighted_point &wp2) const
-      {
-        return t->power_test (wp1, wp2);
-      }
-    };
-
-    class Conflict_tester_1
-    {
-      const Weighted_point &p;
-      const Self *t;
-
-    public:
-
-      Conflict_tester_1(const Weighted_point &pt, const Self *tr)
-        : p(pt), t(tr) {}
-
-      bool operator()(const Cell_handle c) const
-      {
-        return t->in_conflict_1(p, c);
-      }
-      bool test_initial_cell(const Cell_handle c) const {
-        return operator()(c);
-      }
-      Oriented_side compare_weight(const Weighted_point &wp1,
-        const Weighted_point &wp2) const
-      {
-        return t->power_test (wp1, wp2);
-      }
-    };
-
-    class Conflict_tester_0
-    {
-      const Weighted_point &p;
-      const Self *t;
-
-    public:
-
-      Conflict_tester_0(const Weighted_point &pt, const Self *tr)
-        : p(pt), t(tr) {}
-
-      bool operator()(const Cell_handle c) const
-      {
-        return t->in_conflict_0(p, c);
-      }
-      bool test_initial_cell(const Cell_handle c) const {
-        return operator()(c);
-      }
-      int compare_weight(const Weighted_point &wp1,
-        const Weighted_point &wp2) const
-      {
-        return t->power_test (wp1, wp2);
-      }
-    };
-
-    // Sequential version
-    // "dummy" is here to allow the specialization (see below)
-    // See http://groups.google.com/group/comp.lang.c++.moderated/browse_thread/thread/285ab1eec49e1cb6
-    template<typename Concurrency_tag_, typename dummy = void>
-    class Hidden_point_visitor
-    {
-      Self *t;
-      mutable std::vector<Vertex_handle> vertices;
-      mutable std::vector<Weighted_point> hidden_points;
-
-    public:
-
-      Hidden_point_visitor(Self *tr) : t(tr) {}
-
-      template <class InputIterator>
-      void process_cells_in_conflict(InputIterator start, InputIterator end) const
-      {
-        int dim = t->dimension();
-        while (start != end) {
-          std::copy((*start)->hidden_points_begin(),
-            (*start)->hidden_points_end(),
-            std::back_inserter(hidden_points));
-
-          for (int i=0; i<=dim; i++) {
-            Vertex_handle v = (*start)->vertex(i);
-            if (v->cell() != Cell_handle()) {
-              vertices.push_back(v);
-              v->set_cell(Cell_handle());
-            }
-          }
-          start ++;
-        }
-      }
-      void reinsert_vertices(Vertex_handle v) {
-        Cell_handle hc = v->cell();
-        for (typename std::vector<Vertex_handle>::iterator
-          vi = vertices.begin(); vi != vertices.end(); ++vi) {
-            if ((*vi)->cell() != Cell_handle()) continue;
-            hc = t->locate ((*vi)->point(), hc);
-            hide_point(hc, (*vi)->point());
-            t->tds().delete_vertex(*vi);
-        }
-        vertices.clear();
-        for (typename std::vector<Weighted_point>::iterator
-          hp = hidden_points.begin(); hp != hidden_points.end(); ++hp) {
-            hc = t->locate (*hp, hc);
-            hide_point (hc, *hp);
-        }
-        hidden_points.clear();
-      }
-      Vertex_handle replace_vertex(Cell_handle c, int index,
-        const Weighted_point &p) {
-          Vertex_handle v = c->vertex(index);
-          hide_point(c, v->point());
-          v->set_point(p);
-          return v;
-      }
-      void hide_point(Cell_handle c, const Weighted_point &p) {
-        c->hide_point(p);
-      }
-    };
-
-#ifdef CGAL_LINKED_WITH_TBB
-    // Parallel version specialization
-    template<typename dummy>
-    class Hidden_point_visitor<Parallel_tag, dummy>
-    {
-      typedef Hidden_point_visitor<Parallel_tag> HPV;
-
-      Self *t;
-      mutable tbb::enumerable_thread_specific<std::vector<Vertex_handle> >  vertices;
-      mutable tbb::enumerable_thread_specific<std::vector<Weighted_point> > hidden_points;
-
-    public:
-
-      Hidden_point_visitor(Self *tr) : t(tr) {}
-
-      template <class InputIterator>
-      void process_cells_in_conflict(InputIterator start, InputIterator end) const
-      {
-        int dim = t->dimension();
-        while (start != end) {
-          std::copy((*start)->hidden_points_begin(),
-            (*start)->hidden_points_end(),
-            std::back_inserter(hidden_points.local()));
-
-          for (int i=0; i<=dim; i++) {
-            Vertex_handle v = (*start)->vertex(i);
-            if (v->cell() != Cell_handle()) {
-              vertices.local().push_back(v);
-              v->set_cell(Cell_handle());
-            }
-          }
-          start ++;
-        }
-      }
-      void reinsert_vertices(Vertex_handle v) {
-        Cell_handle hc = v->cell();
-        for (typename std::vector<Vertex_handle>::iterator
-          vi = vertices.local().begin(); vi != vertices.local().end(); ++vi) {
-            if ((*vi)->cell() != Cell_handle()) continue;
-            hc = t->locate ((*vi)->point(), hc);
-            hide_point(hc, (*vi)->point());
-            t->tds().delete_vertex(*vi);
-        }
-        vertices.local().clear();
-        for (typename std::vector<Weighted_point>::iterator
-          hp = hidden_points.local().begin(); hp != hidden_points.local().end(); ++hp) {
-            hc = t->locate (*hp, hc);
-            hide_point (hc, *hp);
-        }
-        hidden_points.local().clear();
-      }
-      Vertex_handle replace_vertex(Cell_handle c, int index,
-        const Weighted_point &p) {
-          Vertex_handle v = c->vertex(index);
-          hide_point(c, v->point());
-          v->set_point(p);
-          return v;
-      }
-      void hide_point(Cell_handle c, const Weighted_point &p) {
-        c->hide_point(p);
-      }
-    };
-
-  // Functor for parallel insert(begin, end) function
-  template <typename RT>
-  class Insert_point
-  {
-    typedef typename RT::Weighted_point                 Weighted_point;
-    typedef typename RT::Vertex_handle                  Vertex_handle;
-
-    RT                                                  & m_rt;
-    const std::vector<Weighted_point>                   & m_points;
-    tbb::enumerable_thread_specific<Vertex_handle>      & m_tls_hint;
-
-  public:
-    // Constructor
-    Insert_point(RT & rt,
-                 const std::vector<Weighted_point> & points,
-                 tbb::enumerable_thread_specific<Vertex_handle> & tls_hint)
-    : m_rt(rt), m_points(points), m_tls_hint(tls_hint)
-    {}
-
-    // Constructor
-    Insert_point(const Insert_point &ip)
-    : m_rt(ip.m_rt), m_points(ip.m_points), m_tls_hint(ip.m_tls_hint)
-    {}
-
-    // operator()
-    void operator()( const tbb::blocked_range<size_t>& r ) const
-    {
-#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
-      static Profile_branch_counter_3 bcounter(
-        "early withdrawals / late withdrawals / successes [Delaunay_tri_3::insert]");
-#endif
-
-      Vertex_handle &hint = m_tls_hint.local();
-      for( size_t i_point = r.begin() ; i_point != r.end() ; ++i_point)
-      {
-        bool success = false;
-        const Weighted_point &p = m_points[i_point];
-        while(!success)
-        {
-          if (m_rt.try_lock_vertex(hint) && m_rt.try_lock_point(p))
-          {
-            bool could_lock_zone;
-            Locate_type lt;
-            int li, lj;
-
-            Cell_handle c = m_rt.locate (p, lt, li, lj, hint->cell(), 
-                                         &could_lock_zone);
-            Vertex_handle v;
-            if (could_lock_zone)
-              v = m_rt.insert (p, lt, c, li, lj, &could_lock_zone);
-
-            if (could_lock_zone)
-            {
-              hint = (v == Vertex_handle() ? c->vertex(0) : v);
-              m_rt.unlock_all_elements();
-              success = true;
-#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
-              ++bcounter;
-#endif
-            }
-            else
-            {
-              m_rt.unlock_all_elements();
-#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
-              bcounter.increment_branch_1(); // THIS is a late withdrawal!
-#endif
-            }
-          }
-          else
-          {
-            m_rt.unlock_all_elements();
-#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
-            bcounter.increment_branch_2(); // THIS is an early withdrawal!
-#endif
-          }
-        }
-      }
-    }
-  };
-
-  // Functor for parallel insert_with_info(begin, end) function
-  template <typename RT>
-  class Insert_point_with_info
-  {
-    typedef typename RT::Weighted_point                         Weighted_point;
-    typedef typename RT::Vertex_handle                          Vertex_handle;
-    typedef typename RT::Triangulation_data_structure::Vertex::Info Info;
-
-    RT                                                  & m_rt;
-    const std::vector<Weighted_point>                   & m_points;
-    const std::vector<Info>                             & m_infos;
-    const std::vector<std::ptrdiff_t>                   & m_indices;
-    tbb::enumerable_thread_specific<Vertex_handle>      & m_tls_hint;
-
-  public:
-    // Constructor
-    Insert_point_with_info(RT & rt,
-      const std::vector<Weighted_point> & points,
-      const std::vector<Info> & infos,
-      const std::vector<std::ptrdiff_t> & indices,
-      tbb::enumerable_thread_specific<Vertex_handle> & tls_hint)
-    : m_rt(rt), m_points(points), m_infos(infos), m_indices(indices), 
-      m_tls_hint(tls_hint)
-    {}
-
-    // Constructor
-    Insert_point_with_info(const Insert_point_with_info &ip)
-    : m_rt(ip.m_rt), m_points(ip.m_points), m_infos(ip.m_infos), 
-      m_indices(ip.m_indices), m_tls_hint(ip.m_tls_hint)
-    {}
-
-    // operator()
-    void operator()(const tbb::blocked_range<size_t>& r) const
-    {
-#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
-      static Profile_branch_counter_3 bcounter(
-        "early withdrawals / late withdrawals / successes [Delaunay_tri_3::insert]");
-#endif
-
-      Vertex_handle &hint = m_tls_hint.local();
-      for (size_t i_idx = r.begin() ; i_idx != r.end() ; ++i_idx)
-      {
-        bool success = false;
-        std::ptrdiff_t i_point = m_indices[i_idx];
-        const Weighted_point &p = m_points[i_point];
-        while (!success)
-        {
-          if (m_rt.try_lock_vertex(hint) && m_rt.try_lock_point(p))
-          {
-            bool could_lock_zone;
-            Locate_type lt;
-            int li, lj;
-
-            Cell_handle c = m_rt.locate(p, lt, li, lj, hint->cell(),
-              &could_lock_zone);
-            Vertex_handle v;
-            if (could_lock_zone)
-              v = m_rt.insert(p, lt, c, li, lj, &could_lock_zone);
-
-            if (could_lock_zone)
-            {
-              if (v == Vertex_handle())
-              {
-                hint = c->vertex(0);
-              }
-              else
-              {
-                v->info() = m_infos[i_point];
-                hint = v;
-              }
-
-              m_rt.unlock_all_elements();
-              success = true;
-#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
-              ++bcounter;
-#endif
-            }
-            else
-            {
-              m_rt.unlock_all_elements();
-#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
-              bcounter.increment_branch_1(); // THIS is a late withdrawal!
-#endif
-            }
-          }
-          else
-          {
-            m_rt.unlock_all_elements();
-#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
-            bcounter.increment_branch_2(); // THIS is an early withdrawal!
-#endif
-          }
-        }
-      }
-    }
-  };
-
-  // Functor for parallel remove(begin, end) function
-  template <typename RT>
-  class Remove_point
-  {
-    typedef typename RT::Weighted_point                 Weighted_point;
-    typedef typename RT::Vertex_handle                  Vertex_handle;
-
-    RT                                    & m_rt;
-    const std::vector<Vertex_handle>      & m_vertices;
-    tbb::concurrent_vector<Vertex_handle> & m_vertices_to_remove_sequentially;
-
-  public:
-    // Constructor
-    Remove_point(RT & rt,
-                 const std::vector<Vertex_handle> & vertices,
-                 tbb::concurrent_vector<Vertex_handle> & 
-                   vertices_to_remove_sequentially)
-    : m_rt(rt), m_vertices(vertices), 
-      m_vertices_to_remove_sequentially(vertices_to_remove_sequentially)
-    {}
-
-    // Constructor
-    Remove_point(const Remove_point &rp)
-    : m_rt(rp.m_rt), m_vertices(rp.m_vertices),
-      m_vertices_to_remove_sequentially(rp.m_vertices_to_remove_sequentially)
-    {}
-
-    // operator()
-    void operator()( const tbb::blocked_range<size_t>& r ) const
-    {
-      for( size_t i_vertex = r.begin() ; i_vertex != r.end() ; ++i_vertex)
-      {
-        Vertex_handle v = m_vertices[i_vertex];
-        bool could_lock_zone, needs_to_be_done_sequentially;
-        do
-        {
-          needs_to_be_done_sequentially =
-            !m_rt.remove(v, &could_lock_zone);
-          m_rt.unlock_all_elements();
-        } while (!could_lock_zone);
-
-        if (needs_to_be_done_sequentially)
-          m_vertices_to_remove_sequentially.push_back(v);
-      }
-    }
-  };
-#endif // CGAL_LINKED_WITH_TBB
-
-    Hidden_point_visitor<Concurrency_tag> &get_hidden_point_visitor()
-    {
-      return hidden_point_visitor;
-    }
-
-    template < class RegularTriangulation_3 >
-    class Vertex_remover;
-
-    template < class RegularTriangulation_3 >
-    class Vertex_inserter;
-
-    Hidden_point_visitor<Concurrency_tag> hidden_point_visitor;
-  };
-
-
-  template < class Gt, class Tds, class Lds >
-  typename Regular_triangulation_3<Gt,Tds,Lds>::Vertex_handle
-    Regular_triangulation_3<Gt,Tds,Lds>::
-    nearest_power_vertex_in_cell(const Bare_point& p,
-    Cell_handle c) const
-    // Returns the finite vertex of the cell c with smaller
-    // power distance  to p.
-  {
-    CGAL_triangulation_precondition(dimension() >= 1);
-    Vertex_handle nearest = nearest_power_vertex(p,
-      c->vertex(0),
-      c->vertex(1));
-    if (dimension() >= 2) {
-      nearest = nearest_power_vertex(p, nearest, c->vertex(2));
-      if (dimension() == 3)
-        nearest = nearest_power_vertex(p, nearest, c->vertex(3));
-    }
-    return nearest;
-  }
-
-
-  template < class Gt, class Tds, class Lds >
-  typename Regular_triangulation_3<Gt,Tds,Lds>::Vertex_handle
-    Regular_triangulation_3<Gt,Tds,Lds>::
-    nearest_power_vertex(const Bare_point& p, Cell_handle start) const
-  {
-    if (number_of_vertices() == 0)
-      return Vertex_handle();
-
-    // Use a brute-force algorithm if dimension < 3.
-    if (dimension() < 3) {
-      Finite_vertices_iterator vit = finite_vertices_begin();
-      Vertex_handle res = vit;
-      ++vit;
-      for (Finite_vertices_iterator end = finite_vertices_end(); vit != end; ++vit)
-        res = nearest_power_vertex(p, res, vit);
-      return res;
-    }
-
-    Locate_type lt;
-    int li, lj;
-    // I put the cast here temporarily
-    // until we solve the traits class pb of regular triangulation
-    Cell_handle c = locate(static_cast<Weighted_point>(p), lt, li, lj, start);
-
-    // - start with the closest vertex from the located cell.
-    // - repeatedly take the nearest of its incident vertices if any
-    // - if not, we're done.
-    Vertex_handle nearest = nearest_power_vertex_in_cell(p, c);
-    std::vector<Vertex_handle> vs;
-    vs.reserve(32);
-    while (true) {
-      Vertex_handle tmp = nearest;
-      adjacent_vertices(nearest, std::back_inserter(vs));
-      for (typename std::vector<Vertex_handle>::const_iterator
-        vsit = vs.begin(); vsit != vs.end(); ++vsit)
-        tmp = nearest_power_vertex(p, tmp, *vsit);
-      if (tmp == nearest)
-        break;
-      vs.clear();
-      nearest = tmp;
-    }
-    return nearest;
-  }
-
-template < class Gt, class Tds, class Lds >
-typename Regular_triangulation_3<Gt,Tds,Lds>::Bare_point
-Regular_triangulation_3<Gt,Tds,Lds>::
-dual(Cell_handle c) const
-{
-  CGAL_triangulation_precondition(dimension()==3);
-  CGAL_triangulation_precondition( ! is_infinite(c) );
-
-  return c->weighted_circumcenter(geom_traits());
-}
-
-  template < class Gt, class Tds, class Lds >
-  typename Regular_triangulation_3<Gt,Tds,Lds>::Object
-    Regular_triangulation_3<Gt,Tds,Lds>::
-    dual(Cell_handle c, int i) const
-  {
-    CGAL_triangulation_precondition(dimension()>=2);
-    CGAL_triangulation_precondition( ! is_infinite(c,i) );
-
-    if ( dimension() == 2 ) {
-      CGAL_triangulation_precondition( i == 3 );
-      return construct_object(
-        construct_weighted_circumcenter(c->vertex(0)->point(),
-        c->vertex(1)->point(),
-        c->vertex(2)->point()) );
-    }
-
-    // dimension() == 3
-    Cell_handle n = c->neighbor(i);
-    if ( ! is_infinite(c) && ! is_infinite(n) )
-      return construct_object(construct_segment( dual(c), dual(n) ));
-
-    // either n or c is infinite
-    int in;
-    if ( is_infinite(c) )
-      in = n->index(c);
-    else {
-      n = c;
-      in = i;
-    }
-    // n now denotes a finite cell, either c or c->neighbor(i)
-    int ind[3] = {(in+1)&3,(in+2)&3,(in+3)&3};
-    if ( (in&1) == 1 )
-      std::swap(ind[0], ind[1]);
-    const Weighted_point& p = n->vertex(ind[0])->point();
-    const Weighted_point& q = n->vertex(ind[1])->point();
-    const Weighted_point& r = n->vertex(ind[2])->point();
-
-    Line l =
-      construct_perpendicular_line( construct_plane(p,q,r),
-      construct_weighted_circumcenter(p,q,r) );
-    return construct_object(construct_ray( dual(n), l));
-  }
-
-
-  template < class Gt, class Tds, class Lds >
-  Oriented_side
-    Regular_triangulation_3<Gt,Tds,Lds>::
-    side_of_oriented_power_sphere(const Weighted_point &p0,
-    const Weighted_point &p1,
-    const Weighted_point &p2,
-    const Weighted_point &p3,
-    const Weighted_point &p, bool perturb) const
-  {
-    CGAL_triangulation_precondition( orientation(p0, p1, p2, p3) == POSITIVE );
-
-    using namespace boost;
-
-    Oriented_side os = power_test(p0, p1, p2, p3, p);
-
-    if (os != ON_ORIENTED_BOUNDARY || !perturb)
-      return os;
-
-    // We are now in a degenerate case => we do a symbolic perturbation.
-
-    // We sort the points lexicographically.
-    const Weighted_point * points[5] = {&p0, &p1, &p2, &p3, &p};
-    std::sort(points, points + 5,
-      boost::bind(geom_traits().compare_xyz_3_object(),
-      boost::bind(Dereference<Weighted_point>(), _1),
-      boost::bind(Dereference<Weighted_point>(), _2)) == SMALLER);
-
-    // We successively look whether the leading monomial, then 2nd monomial
-    // of the determinant has non null coefficient.
-    for (int i=4; i>1; --i) {
-      if (points[i] == &p)
-        return ON_NEGATIVE_SIDE; // since p0 p1 p2 p3 are non coplanar
-      // and positively oriented
-      Orientation o;
-      if (points[i] == &p3 && (o = orientation(p0,p1,p2,p)) != COPLANAR )
-        return o;
-      if (points[i] == &p2 && (o = orientation(p0,p1,p,p3)) != COPLANAR )
-        return o;
-      if (points[i] == &p1 && (o = orientation(p0,p,p2,p3)) != COPLANAR )
-        return o;
-      if (points[i] == &p0 && (o = orientation(p,p1,p2,p3)) != COPLANAR )
-        return o;
-    }
-
-    CGAL_triangulation_assertion(false);
-    return ON_NEGATIVE_SIDE;
-  }
-
-
-  template < class Gt, class Tds, class Lds >
-  Bounded_side
-    Regular_triangulation_3<Gt,Tds,Lds>::
-    side_of_power_sphere(Cell_handle c, const Weighted_point &p,
-    bool perturb) const
-  {
-    CGAL_triangulation_precondition( dimension() == 3 );
-    int i3;
-    if ( ! c->has_vertex( infinite_vertex(), i3 ) ) {
-      return Bounded_side( side_of_oriented_power_sphere(c->vertex(0)->point(),
-        c->vertex(1)->point(),
-        c->vertex(2)->point(),
-        c->vertex(3)->point(),
-        p, perturb) );
-    }
-    // else infinite cell :
-    int i0,i1,i2;
-    if ( (i3%2) == 1 ) {
-      i0 = (i3+1)&3;
-      i1 = (i3+2)&3;
-      i2 = (i3+3)&3;
-    }
-    else {
-      i0 = (i3+2)&3;
-      i1 = (i3+1)&3;
-      i2 = (i3+3)&3;
-    }
-
-    // general case
-    Orientation o = orientation(c->vertex(i0)->point(),
-      c->vertex(i1)->point(),
-      c->vertex(i2)->point(), p);
-    if (o != ZERO)
-      return Bounded_side(o);
-
-    // else p coplanar with i0,i1,i2
-    return side_of_bounded_power_circle(c->vertex(i0)->point(),
-      c->vertex(i1)->point(),
-      c->vertex(i2)->point(),
-      p, perturb);
-  }
-
-
-  template < class Gt, class Tds, class Lds >
-  Bounded_side
-    Regular_triangulation_3<Gt,Tds,Lds>::
-    side_of_bounded_power_circle(const Weighted_point &p0,
-    const Weighted_point &p1,
-    const Weighted_point &p2,
-    const Weighted_point &p, bool perturb) const
-  {
-    CGAL_triangulation_precondition(coplanar_orientation(p0, p1, p2) != 0);
-    if (coplanar_orientation(p0, p1, p2) == POSITIVE)
-      return Bounded_side (side_of_oriented_power_circle(p0, p1, p2, p, perturb));
-    // Wrong because the low level power test already does a coplanar orientation
-    // test.
-    // return Bounded_side (- side_of_oriented_power_circle (p0, p2, p1, p,
-    // perturb));
-    return Bounded_side (side_of_oriented_power_circle(p0, p2, p1, p, perturb));
-  }
-
-
-  template < class Gt, class Tds, class Lds >
-  Oriented_side
-    Regular_triangulation_3<Gt,Tds,Lds>::
-    side_of_oriented_power_circle(const Weighted_point &p0,
-    const Weighted_point &p1,
-    const Weighted_point &p2,
-    const Weighted_point &p, bool perturb) const
-  {
-    CGAL_triangulation_precondition( coplanar_orientation(p0, p1, p2) == POSITIVE );
-
-    using namespace boost;
-
-    Oriented_side os = power_test(p0, p1, p2, p);
-
-    if (os != ON_ORIENTED_BOUNDARY || !perturb)
-      return os;
-
-    // We are now in a degenerate case => we do a symbolic perturbation.
-
-    // We sort the points lexicographically.
-    const Weighted_point * points[4] = {&p0, &p1, &p2, &p};
-    std::sort(points, points + 4,
-      boost::bind(geom_traits().compare_xyz_3_object(),
-      boost::bind(Dereference<Weighted_point>(), _1),
-      boost::bind(Dereference<Weighted_point>(), _2)) == SMALLER);
-
-    // We successively look whether the leading monomial, then 2nd monomial
-    // of the determinant has non null coefficient.
-    // 2 iterations are enough (cf paper)
-    for (int i=3; i>1; --i) {
-      if (points[i] == &p)
-        return ON_NEGATIVE_SIDE; // since p0 p1 p2 are non collinear
-      // and positively oriented
-      Orientation o;
-      if (points[i] == &p2 && (o = coplanar_orientation(p0,p1,p)) != COPLANAR )
-        return o;
-      if (points[i] == &p1 && (o = coplanar_orientation(p0,p,p2)) != COPLANAR )
-        return o;
-      if (points[i] == &p0 && (o = coplanar_orientation(p,p1,p2)) != COPLANAR )
-        return o;
-    }
-
-    CGAL_triangulation_assertion(false);
-    return ON_NEGATIVE_SIDE;
-  }
-
-
-  template < class Gt, class Tds, class Lds >
-  Bounded_side
-    Regular_triangulation_3<Gt,Tds,Lds>::
-    side_of_power_circle(Cell_handle c, int i, const Weighted_point &p,
-    bool perturb) const
-  {
-    CGAL_triangulation_precondition( dimension() >= 2 );
-    int i3 = 5;
-    if ( dimension() == 2 ) {
-      CGAL_triangulation_precondition( i == 3 );
-      // the triangulation is supposed to be valid, ie the facet
-      // with vertices 0 1 2 in this order is positively oriented
-      if ( ! c->has_vertex( infinite_vertex(), i3 ) )
-        return Bounded_side( side_of_oriented_power_circle(c->vertex(0)->point(),
-        c->vertex(1)->point(),
-        c->vertex(2)->point(),
-        p, perturb) );
-      // else infinite facet
-      // v1, v2 finite vertices of the facet such that v1,v2,infinite
-      // is positively oriented
-      Vertex_handle v1 = c->vertex( ccw(i3) ),
-        v2 = c->vertex( cw(i3) );
-      CGAL_triangulation_assertion(coplanar_orientation(v1->point(), v2->point(),
-        mirror_vertex(c, i3)->point()) == NEGATIVE);
-      Orientation o = coplanar_orientation(v1->point(), v2->point(), p);
-      if ( o != ZERO )
-        return Bounded_side( o );
-      // case when p collinear with v1v2
-      return side_of_bounded_power_segment(v1->point(),
-        v2->point(),
-        p, perturb);
-    }// dim 2
-
-    // else dimension == 3
-    CGAL_triangulation_precondition( (i >= 0) && (i < 4) );
-    if ( ( ! c->has_vertex(infinite_vertex(),i3) ) || ( i3 != i ) ) {
-      // finite facet
-      // initialization of i0 i1 i2, vertices of the facet positively
-      // oriented (if the triangulation is valid)
-      int i0 = (i>0) ? 0 : 1;
-      int i1 = (i>1) ? 1 : 2;
-      int i2 = (i>2) ? 2 : 3;
-      CGAL_triangulation_precondition(this->coplanar(c->vertex(i0)->point(),
-        c->vertex(i1)->point(),
-        c->vertex(i2)->point(), p));
-      return side_of_bounded_power_circle(c->vertex(i0)->point(),
-        c->vertex(i1)->point(),
-        c->vertex(i2)->point(),
-        p, perturb);
-    }
-    //else infinite facet
-    // v1, v2 finite vertices of the facet such that v1,v2,infinite
-    // is positively oriented
-    Vertex_handle v1 = c->vertex( next_around_edge(i3,i) ),
-      v2 = c->vertex( next_around_edge(i,i3) );
-    Orientation o = (Orientation)
-      (coplanar_orientation( v1->point(), v2->point(),
-      c->vertex(i)->point()) *
-      coplanar_orientation( v1->point(), v2->point(), p));
-    // then the code is duplicated from 2d case
-    if ( o != ZERO )
-      return Bounded_side( -o );
-    // because p is in f iff
-    // it is not on the same side of v1v2 as c->vertex(i)
-    // case when p collinear with v1v2 :
-    return side_of_bounded_power_segment(v1->point(),
-      v2->point(),
-      p, perturb);
-  }
-
-  template < class Gt, class Tds, class Lds >
-  Bounded_side
-    Regular_triangulation_3<Gt,Tds,Lds>::
-    side_of_bounded_power_segment(const Weighted_point &p0,
-    const Weighted_point &p1,
-    const Weighted_point &p, bool perturb) const
-  {
-    Oriented_side os = power_test(p0, p1, p);
-
-    if (os != ON_ORIENTED_BOUNDARY || !perturb)
-      return Bounded_side(os);
-
-    // We are now in a degenerate case => we do a symbolic perturbation.
-
-    switch (this->collinear_position(p0, p, p1)) {
-    case Tr_Base::BEFORE: case Tr_Base::AFTER:
-      return ON_UNBOUNDED_SIDE;
-    case Tr_Base::MIDDLE:
-      return ON_BOUNDED_SIDE;
-    default:
-      ;
-    }
-
-    CGAL_triangulation_assertion(false);
-    return ON_UNBOUNDED_SIDE;
-  }
-
-  template < class Gt, class Tds, class Lds >
-  Bounded_side
-    Regular_triangulation_3<Gt,Tds,Lds>::
-    side_of_power_segment(Cell_handle c, const Weighted_point &p,
-    bool perturb) const
-  {
-    CGAL_triangulation_precondition( dimension() == 1 );
-    if ( ! is_infinite(c,0,1) )
-      return side_of_bounded_power_segment(c->vertex(0)->point(),
-      c->vertex(1)->point(),
-      p, perturb);
-    Locate_type lt; int i;
-    Bounded_side soe = side_of_edge( p, c, lt, i );
-    if (soe != ON_BOUNDARY)
-      return soe;
-    // Either we compare weights, or we use the finite neighboring edge
-    Cell_handle finite_neighbor = c->neighbor(c->index(infinite_vertex()));
-    CGAL_triangulation_assertion(!is_infinite(finite_neighbor,0,1));
-    return side_of_bounded_power_segment(finite_neighbor->vertex(0)->point(),
-      finite_neighbor->vertex(1)->point(),
-      p, perturb);
-  }
-
-  template < class Gt, class Tds, class Lds >
-  bool
-    Regular_triangulation_3<Gt,Tds,Lds>::
-    is_Gabriel(const Facet& f) const
-  {
-    return is_Gabriel(f.first, f.second);
-  }
-
-  template < class Gt, class Tds, class Lds >
-  bool
-    Regular_triangulation_3<Gt,Tds,Lds>::
-    is_Gabriel(Cell_handle c, int i) const
-  {
-    CGAL_triangulation_precondition(dimension() == 3 && !is_infinite(c,i));
-    typename Geom_traits::Side_of_bounded_orthogonal_sphere_3
-      side_of_bounded_orthogonal_sphere =
-      geom_traits().side_of_bounded_orthogonal_sphere_3_object();
-
-    if ((!is_infinite(c->vertex(i))) &&
-      side_of_bounded_orthogonal_sphere(
-      c->vertex(vertex_triple_index(i,0))->point(),
-      c->vertex(vertex_triple_index(i,1))->point(),
-      c->vertex(vertex_triple_index(i,2))->point(),
-      c->vertex(i)->point()) == ON_BOUNDED_SIDE ) return false;
-
-    Cell_handle neighbor = c->neighbor(i);
-    int in = neighbor->index(c);
-
-    if ((!is_infinite(neighbor->vertex(in))) &&
-      side_of_bounded_orthogonal_sphere(
-      c->vertex(vertex_triple_index(i,0))->point(),
-      c->vertex(vertex_triple_index(i,1))->point(),
-      c->vertex(vertex_triple_index(i,2))->point(),
-      neighbor->vertex(in)->point()) == ON_BOUNDED_SIDE ) return false;
-
-    return true;
-  }
-
-
-  template < class Gt, class Tds, class Lds >
-  bool
-    Regular_triangulation_3<Gt,Tds,Lds>::
-    is_Gabriel(const Edge& e) const
-  {
-    return is_Gabriel(e.first, e.second, e.third);
-  }
-
-  template < class Gt, class Tds, class Lds >
-  bool
-    Regular_triangulation_3<Gt,Tds,Lds>::
-    is_Gabriel(Cell_handle c, int i, int j) const
-  {
-    CGAL_triangulation_precondition(dimension() == 3 && !is_infinite(c,i,j));
-    typename Geom_traits::Side_of_bounded_orthogonal_sphere_3
-      side_of_bounded_orthogonal_sphere =
-      geom_traits().side_of_bounded_orthogonal_sphere_3_object();
-
-    Facet_circulator fcirc = incident_facets(c,i,j),
-      fdone(fcirc);
-    Vertex_handle v1 = c->vertex(i);
-    Vertex_handle v2 = c->vertex(j);
-    do {
-      // test whether the vertex of cc opposite to *fcirc
-      // is inside the sphere defined by the edge e = (s, i,j)
-      Cell_handle cc = (*fcirc).first;
-      int ii = (*fcirc).second;
-      if (!is_infinite(cc->vertex(ii)) &&
-        side_of_bounded_orthogonal_sphere( v1->point(),
-        v2->point(),
-        cc->vertex(ii)->point())
-        == ON_BOUNDED_SIDE ) return false;
-    } while(++fcirc != fdone);
-    return true;
-  }
-
-  template < class Gt, class Tds, class Lds >
-  bool
-    Regular_triangulation_3<Gt,Tds,Lds>::
-    is_Gabriel(Vertex_handle v) const
-  {
-    return nearest_power_vertex( v->point().point(), v->cell()) == v;
-  }
-
-  // Returns
-  template < class Gt, class Tds, class Lds >
-  typename Regular_triangulation_3<Gt,Tds,Lds>::Vertex_handle
-    Regular_triangulation_3<Gt,Tds,Lds>::
-    insert(const Weighted_point & p, Cell_handle start, bool *could_lock_zone)
-  {
-    Locate_type lt;
-    int li, lj;
-
-    // Parallel
-    if (could_lock_zone)
-    {
-      Cell_handle c = locate(p, lt, li, lj, start, could_lock_zone);
-      if (*could_lock_zone)
-        return insert(p, lt, c, li, lj, could_lock_zone);
-      else
-        return Vertex_handle();
-    }
-    // Sequential
-    else
-    {
-      Cell_handle c = locate(p, lt, li, lj, start);
-      return insert(p, lt, c, li, lj);
-    }
-  }
-
-  template < class Gt, class Tds, class Lds >
-  typename Regular_triangulation_3<Gt,Tds,Lds>::Vertex_handle
-    Regular_triangulation_3<Gt,Tds,Lds>::
-    insert(const Weighted_point & p, Locate_type lt, Cell_handle c,
-           int li, int lj, bool *could_lock_zone)
-  {
-    switch (dimension()) {
-    case 3:
-      {
-        Conflict_tester_3 tester (p, this);
-        return insert_in_conflict(p, lt,c,li,lj, tester,
-                                  get_hidden_point_visitor(),
-                                  could_lock_zone);
-      }
-    case 2:
-      {
-        Conflict_tester_2 tester (p, this);
-        return insert_in_conflict(p, lt,c,li,lj, tester,
-                                  get_hidden_point_visitor(),
-                                  could_lock_zone);
-      }
-    case 1:
-      {
-        Conflict_tester_1 tester (p, this);
-        return insert_in_conflict(p, lt,c,li,lj, tester,
-                                  get_hidden_point_visitor(),
-                                  could_lock_zone);
-      }
-    }
-
-    Conflict_tester_0 tester (p, this);
-    return insert_in_conflict(p, lt,c,li,lj, tester,
-                              get_hidden_point_visitor(),
-                              could_lock_zone);
-  }
-
-
-  template < class Gt, class Tds, class Lds >
-  template <class CellIt>
-  typename Regular_triangulation_3<Gt,Tds,Lds>::Vertex_handle
-    Regular_triangulation_3<Gt,Tds,Lds>::
-    insert_in_hole(const Weighted_point & p, CellIt cell_begin, CellIt cell_end,
-    Cell_handle begin, int i)
-  {
-    CGAL_triangulation_precondition(cell_begin != cell_end);
-
-    get_hidden_point_visitor().process_cells_in_conflict(cell_begin,cell_end);
-
-    Vertex_handle v =
-      Tr_Base::insert_in_hole(p, cell_begin, cell_end, begin, i);
-
-    // Store the hidden points in their new cells and hide vertices that
-    // have to be hidden
-    get_hidden_point_visitor().reinsert_vertices(v);
-    return v;
-  }
-
-
-  template < class Gt, class Tds, class Lds >
-  template <class CellIt>
-  typename Regular_triangulation_3<Gt,Tds,Lds>::Vertex_handle
-    Regular_triangulation_3<Gt,Tds,Lds>::
-    insert_in_hole(const Weighted_point & p, CellIt cell_begin, CellIt cell_end,
-    Cell_handle begin, int i, Vertex_handle newv)
-  {
-    CGAL_triangulation_precondition(cell_begin != cell_end);
-
-    get_hidden_point_visitor().process_cells_in_conflict(cell_begin,cell_end);
-
-    Vertex_handle v =
-      Tr_Base::insert_in_hole(p, cell_begin, cell_end, begin, i, newv);
-
-    // Store the hidden points in their new cells and hide vertices that
-    // have to be hidden
-    get_hidden_point_visitor().reinsert_vertices(v);
-    return v;
-  }
-
-  template <class Gt, class Tds, class Lds >
-  template <class RegularTriangulation_3>
-  class Regular_triangulation_3<Gt, Tds, Lds>::Vertex_remover {
-    typedef RegularTriangulation_3 Regular;
-    typedef typename Gt::Point_3 Point;
-  public:
-    typedef typename std::vector<Point>::iterator
-      Hidden_points_iterator;
-
-    Vertex_remover(Regular &tmp_) : tmp(tmp_) {}
-
-    Regular &tmp;
-
-    void add_hidden_points(Cell_handle ch) {
-      std::copy (ch->hidden_points_begin(), ch->hidden_points_end(),
-        std::back_inserter(hidden));
-    }
-
-    Hidden_points_iterator hidden_points_begin() {
-      return hidden.begin();
-    }
-    Hidden_points_iterator hidden_points_end() {
-      return hidden.end();
-    }
-
-    Bounded_side side_of_bounded_circle(const Point &p, const Point &q,
-      const Point &r, const Point &s, bool perturb = false) const {
-        return tmp.side_of_bounded_power_circle(p,q,r,s,perturb);
-    }
-
-  private:
-    // The removal of v may un-hide some points,
-    // Space functions output them.
-    std::vector<Point> hidden;
-  };
-
-  // The displacement method works only
-  // on regular triangulation without hidden points at any time
-  // the vertex inserter is used only
-  // for the purpose of displacements
-  template <class Gt, class Tds, class Lds >
-  template <class RegularTriangulation_3>
-  class Regular_triangulation_3<Gt, Tds, Lds>::Vertex_inserter {
-    typedef RegularTriangulation_3 Regular;
-  public:
-    typedef Nullptr_t Hidden_points_iterator;
-
-    Vertex_inserter(Regular &tmp_) : tmp(tmp_) {}
-
-    Regular &tmp;
-
-    void add_hidden_points(Cell_handle) {}
-    Hidden_points_iterator hidden_points_begin() { return NULL; }
-    Hidden_points_iterator hidden_points_end() { return NULL; }
-
-    Vertex_handle insert(const Weighted_point& p,
-      Locate_type lt, Cell_handle c, int li, int lj) {
-        return tmp.insert(p, lt, c, li, lj);
-    }
-
-    Vertex_handle insert(const Weighted_point& p, Cell_handle c) {
-      return tmp.insert(p, c);
-    }
-
-    Vertex_handle insert(const Weighted_point& p) {
-      return tmp.insert(p);
-    }
-  };
-
-  template < class Gt, class Tds, class Lds >
-  void
-    Regular_triangulation_3<Gt,Tds,Lds>::
-    remove(Vertex_handle v)
-  {
-    Cell_handle c;
-    if (dimension() > 0)
-      c = v->cell()->neighbor(v->cell()->index(v));
-
-    Self tmp;
-    Vertex_remover<Self> remover(tmp);
-    Tr_Base::remove(v,remover);
-
-    // Re-insert the points that v was hiding.
-    for (typename Vertex_remover<Self>::Hidden_points_iterator
-      hi = remover.hidden_points_begin();
-      hi != remover.hidden_points_end(); ++hi) {
-        Vertex_handle hv = insert (*hi, c);
-        if (hv != Vertex_handle()) c = hv->cell();
-    }
-    CGAL_triangulation_expensive_postcondition (is_valid());
-  }
-
-  template < class Gt, class Tds, class Lds >
-  bool
-    Regular_triangulation_3<Gt,Tds,Lds>::
-    remove(Vertex_handle v, bool *could_lock_zone)
-  {
-    bool removed = true;
-
-    // Locking vertex v...
-    if (!this->try_lock_vertex(v))
-    {
-      *could_lock_zone = false;
-    }
-    else
-    {
-      Vertex_handle hint = (v->cell()->vertex(0) == v ?
-        v->cell()->vertex(1) : v->cell()->vertex(0));
-
-      Self tmp;
-      Vertex_remover<Self> remover(tmp);
-      removed = Tr_Base::remove(v, remover, could_lock_zone);
-
-      if (*could_lock_zone && removed)
-      {
-        // Re-insert the points that v was hiding.
-        for (typename Vertex_remover<Self>::Hidden_points_iterator
-          hi = remover.hidden_points_begin();
-          hi != remover.hidden_points_end(); ++hi)
-        {
-          bool could_lock_zone = false;
-          Vertex_handle hv;
-          while (!could_lock_zone)
-          {
-            hv = insert (*hi, hint, &could_lock_zone);
-          }
-          if (hv != Vertex_handle())
-            hint = hv;
-        }
-        CGAL_triangulation_expensive_postcondition (is_valid());
-      }
-    }
-
-    return removed;
-  }
-
-  // Again, verbatim copy from Delaunay.
-  template < class Gt, class Tds, class Lds >
-  typename Regular_triangulation_3<Gt,Tds,Lds>::Vertex_handle
-    Regular_triangulation_3<Gt,Tds,Lds>::
-    move_point(Vertex_handle v, const Weighted_point & p)
-  {
-    CGAL_triangulation_precondition(! is_infinite(v));
-    CGAL_triangulation_expensive_precondition(is_vertex(v));
-
-    // Dummy implementation for a start.
-
-    // Remember an incident vertex to restart
-    // the point location after the removal.
-    Cell_handle c = v->cell();
-    Vertex_handle old_neighbor = c->vertex(c->index(v) == 0 ? 1 : 0);
-    CGAL_triangulation_assertion(old_neighbor != v);
-
-    remove(v);
-
-    if (dimension() <= 0)
-      return insert(p);
-    return insert(p, old_neighbor->cell());
-  }
-
-  // Displacement works only for Regular triangulation
-  // without hidden points at any time
-  template < class Gt, class Tds, class Lds >
-  typename Regular_triangulation_3<Gt,Tds,Lds>::Vertex_handle
-    Regular_triangulation_3<Gt,Tds,Lds>::
-    move_if_no_collision(Vertex_handle v, const Weighted_point &p)
-  {
-    Self tmp;
-    Vertex_remover<Self> remover (tmp);
-    Vertex_inserter<Self> inserter (*this);
-    Vertex_handle res = Tr_Base::move_if_no_collision(v,p,remover,inserter);
-
-    CGAL_triangulation_expensive_postcondition(is_valid());
-    return res;
-  }
-
-  template <class Gt, class Tds, class Lds >
-  typename Regular_triangulation_3<Gt,Tds,Lds>::Vertex_handle
-    Regular_triangulation_3<Gt,Tds,Lds>::
-    move(Vertex_handle v, const Weighted_point &p) {
-      CGAL_triangulation_precondition(!is_infinite(v));
-      if(v->point() == p) return v;
-      Self tmp;
-      Vertex_remover<Self> remover (tmp);
-      Vertex_inserter<Self> inserter (*this);
-      return Tr_Base::move(v,p,remover,inserter);
-  }
-
-  template < class Gt, class Tds, class Lds >
-  bool
-    Regular_triangulation_3<Gt,Tds,Lds>::
-    is_valid(bool verbose, int level) const
-  {
-    if ( ! Tr_Base::is_valid(verbose,level) ) {
-      if (verbose)
-        std::cerr << "invalid base triangulation" << std::endl;
-      CGAL_triangulation_assertion(false);
-      return false;
-    }
-
-    switch ( dimension() ) {
-    case 3:
-      {
-        for(Finite_cells_iterator it = finite_cells_begin(), end = finite_cells_end(); it != end; ++it) {
-          is_valid_finite(it, verbose, level);
-          for(int i=0; i<4; i++) {
-            if ( !is_infinite
-              (it->neighbor(i)->vertex(it->neighbor(i)->index(it))) ) {
-                if ( side_of_power_sphere
-                  (it,
-                  it->neighbor(i)->vertex(it->neighbor(i)->index(it))->point())
-                  == ON_BOUNDED_SIDE ) {
-                    if (verbose)
-                      std::cerr << "non-empty sphere " << std::endl;
-                    CGAL_triangulation_assertion(false);
-                    return false;
-                }
-            }
-          }
-        }
-        break;
-      }
-    case 2:
-      {
-        for(Finite_facets_iterator it = finite_facets_begin(), end = finite_facets_end(); it!= end; ++it) {
-          is_valid_finite((*it).first, verbose, level);
-          for(int i=0; i<3; i++) {
-            if( !is_infinite
-              ((*it).first->neighbor(i)->vertex( (((*it).first)->neighbor(i))
-              ->index((*it).first))) ) {
-                if ( side_of_power_circle
-                  ( (*it).first, 3,
-                  (*it).first->neighbor(i)->
-                  vertex( (((*it).first)->neighbor(i))
-                  ->index((*it).first) )->point() )
-                  == ON_BOUNDED_SIDE ) {
-                    if (verbose)
-                      std::cerr << "non-empty circle " << std::endl;
-                    CGAL_triangulation_assertion(false);
-                    return false;
-                }
-            }
-          }
-        }
-        break;
-      }
-    case 1:
-      {
-        for(Finite_edges_iterator it = finite_edges_begin(), end = finite_edges_end(); it != end; ++it) {
-          is_valid_finite((*it).first, verbose, level);
-          for(int i=0; i<2; i++) {
-            if( !is_infinite
-              ((*it).first->neighbor(i)->vertex( (((*it).first)->neighbor(i))
-              ->index((*it).first))) ) {
-                if ( side_of_power_segment
-                  ( (*it).first,
-                  (*it).first->neighbor(i)->
-                  vertex( (((*it).first)->neighbor(i))
-                  ->index((*it).first) )->point() )
-                  == ON_BOUNDED_SIDE ) {
-                    if (verbose)
-                      std::cerr << "non-empty edge " << std::endl;
-                    CGAL_triangulation_assertion(false);
-                    return false;
-                }
-            }
-          }
-        }
-        break;
-      }
-    }
-    if (verbose)
-      std::cerr << "valid Regular triangulation" << std::endl;
-    return true;
-  }
-
-} //namespace CGAL
-
-#if defined(BOOST_MSVC)
-#  pragma warning(pop)
-#endif
-
-#endif // CGAL_REGULAR_TRIANGULATION_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Search_traits_adapter.h b/3rdparty/CGAL-4.8/include/CGAL/Search_traits_adapter.h
deleted file mode 100644
index 125bc0b..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Search_traits_adapter.h
+++ /dev/null
@@ -1,180 +0,0 @@
-// Copyright (c) 2011 GeometryFactory (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Sebastien Loriot
-
-#ifndef CGAL_SEARCH_TRAITS_WITH_INFO
-#define CGAL_SEARCH_TRAITS_WITH_INFO
-
-#include <CGAL/Kd_tree_rectangle.h>
-#include <CGAL/Euclidean_distance.h> //for default distance specialization
-#include <CGAL/property_map.h>
-#include <CGAL/assertions.h>
-
-#include <boost/mpl/has_xxx.hpp>
-#include <boost/type_traits/is_same.hpp>
-
-namespace CGAL{
-
-using ::get;
-  
-template <class Point_with_info,class PointPropertyMap,class Base_traits>
-class Search_traits_adapter;
-  
-template <class Point_with_info,class PointPropertyMap,class Base_distance>
-class Distance_adapter;
-  
-namespace internal{
-
-BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Has_typedef_Iso_box_d,Iso_box_d,false)
-
-template <class T,bool Has_iso_box_d=Has_typedef_Iso_box_d<T>::value >
-struct Get_iso_box_d;
-
-template <class T>
-struct Get_iso_box_d<T,false>
-{
-  typedef void type;
-};
-
-template <class T>
-struct Get_iso_box_d<T,true>
-{
-  typedef typename T::Iso_box_d type;
-};
-  
-  template <class Point_with_info,class PointPropertyMap,class Base_traits>
-  struct Spatial_searching_default_distance< ::CGAL::Search_traits_adapter<Point_with_info,PointPropertyMap,Base_traits> >{
-    typedef ::CGAL::Distance_adapter<Point_with_info,
-                                                 PointPropertyMap,
-                                                 typename Spatial_searching_default_distance<Base_traits>::type> type;
-  };
-
-} //namespace internal
-  
-  
-template <class Point_with_info,class PointPropertyMap,class Base_traits>
-class Search_traits_adapter : public Base_traits{
-  PointPropertyMap ppmap;
-
-  CGAL_static_assertion( ( boost::is_same< boost::lvalue_property_map_tag,
-                           typename boost::property_traits<PointPropertyMap>::category
-                         >::value ) );
-public:
-  typedef Base_traits Base;
-  typedef typename internal::Get_iso_box_d<Base>::type Iso_box_d;
-
-  Search_traits_adapter(const PointPropertyMap& ppmap_=PointPropertyMap(),
-                          const Base_traits& base=Base_traits()
-  ):Base_traits(base),ppmap(ppmap_){}
-
-  typedef typename Base_traits::Cartesian_const_iterator_d      Cartesian_const_iterator_d;
-  typedef Point_with_info                                       Point_d;
-  typedef typename Base_traits::FT                              FT;
-  typedef typename Base_traits::Dimension                       Dimension;
-  
-
-  struct Construct_cartesian_const_iterator_d: public Base_traits::Construct_cartesian_const_iterator_d{
-    PointPropertyMap ppmap;
-    using Base_traits::Construct_cartesian_const_iterator_d::operator();
-    
-    Construct_cartesian_const_iterator_d(const typename Base_traits::Construct_cartesian_const_iterator_d& base, const PointPropertyMap& ppmap_)
-      :Base_traits::Construct_cartesian_const_iterator_d(base), ppmap(ppmap_){}
-    
-    typename Base_traits::Cartesian_const_iterator_d operator()(const Point_with_info& p) const
-    { return this->operator() (get(ppmap,p)); }
-
-    typename Base_traits::Cartesian_const_iterator_d operator()(const Point_with_info& p, int)  const
-    { return this->operator() (get(ppmap,p),0); }
-  };
-  
-  struct Construct_iso_box_d: public Base::Construct_iso_box_d{
-    PointPropertyMap ppmap;
-    typedef typename Base_traits::FT  FT; // needed for VC++, because otherwise it is taken from the private typedef of the base class
-
-    Iso_box_d operator() () const {
-      return static_cast<const typename Base::Construct_iso_box_d* >(this)->operator() ();
-    }
-    Iso_box_d operator() (const Point_with_info& p, const Point_with_info& q) const
-    {
-      return static_cast<const typename Base::Construct_iso_box_d* >(this)->operator() (get(ppmap,p),get(ppmap,q));
-    }
-  };
-  
-  const PointPropertyMap& point_property_map() const {return ppmap;}
-  
-  Construct_cartesian_const_iterator_d construct_cartesian_const_iterator_d_object() const {
-    return Construct_cartesian_const_iterator_d(
-      static_cast<const Base*>(this)->construct_cartesian_const_iterator_d_object(),
-      ppmap);
-  }
-};
-
-template <class Point_with_info,class PointPropertyMap,class Base_distance>
-class Distance_adapter : public Base_distance {
-  PointPropertyMap ppmap;
-  typedef typename Base_distance::FT FT;
-
-  CGAL_static_assertion( ( boost::is_same< boost::lvalue_property_map_tag,
-                           typename boost::property_traits<PointPropertyMap>::category
-                         >::value ) );
-public:
-    
-  Distance_adapter( const PointPropertyMap& ppmap_=PointPropertyMap(),
-                         const Base_distance& distance=Base_distance()
-  ):Base_distance(distance),ppmap(ppmap_){}
-
-  using Base_distance::transformed_distance;
-  
-  typedef Point_with_info Point_d;
-  typedef typename Base_distance::Query_item Query_item;
-
-  const PointPropertyMap& point_property_map() const {return ppmap;}    
-
-  FT transformed_distance(const Query_item& p1, const Point_with_info& p2) const
-  {
-    return this->transformed_distance(p1,get(ppmap,p2));
-  }
-
-  template <class FT,class Dimension>
-  FT min_distance_to_rectangle(const Query_item& p, const CGAL::Kd_tree_rectangle<FT,Dimension>& b) const
-  {
-    return static_cast<const Base_distance*>(this)->min_distance_to_rectangle(p,b);
-  }
-
-  template <class FT,class Dimension>
-  FT min_distance_to_rectangle(const Query_item& p, const CGAL::Kd_tree_rectangle<FT,Dimension>& b,std::vector<FT>& dists) 
-  {
-    return static_cast<Base_distance*>(this)->min_distance_to_rectangle(p,b,dists);
-  }
-
-  template <class FT,class Dimension>
-  FT max_distance_to_rectangle(const Query_item& p,const CGAL::Kd_tree_rectangle<FT,Dimension>& b) const
-  {
-    return static_cast<const Base_distance*>(this)->max_distance_to_rectangle(p,b);
-  }  
-  template <class FT,class Dimension>
-  FT max_distance_to_rectangle(const Query_item& p,const CGAL::Kd_tree_rectangle<FT,Dimension>& b,std::vector<FT>& dists)
-  {
-    return static_cast<Base_distance*>(this)->max_distance_to_rectangle(p,b,dists);
-  }  
-};
-
-}//namespace CGAL
-
-#endif //CGAL_SEARCH_TRAITS_WITH_INFO
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Search_traits_d.h b/3rdparty/CGAL-4.8/include/CGAL/Search_traits_d.h
deleted file mode 100644
index 7aadc8a..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Search_traits_d.h
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (c) 2002,2011 Utrecht University (The Netherlands).
-// 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
-// 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(s)     : Hans Tangelder (<hanst at cs.uu.nl>)
-
-
-#ifndef CGAL_SEARCH_TRAITS_D_H
-#define CGAL_SEARCH_TRAITS_D_H
-#include <CGAL/Dimension.h>
-
-namespace CGAL {
-
-
-  template <class K,typename D = Dynamic_dimension_tag>
-  class Search_traits_d {
-
-  public:
-    typedef D Dimension;
-    typedef typename K::Cartesian_const_iterator_d Cartesian_const_iterator_d;
-    typedef typename K::Construct_cartesian_const_iterator_d Construct_cartesian_const_iterator_d;
-    typedef typename K::Construct_iso_box_d Construct_iso_box_d;
-    typedef typename K::Construct_min_vertex_d Construct_min_vertex_d;
-    typedef typename K::Construct_max_vertex_d Construct_max_vertex_d;
-    typedef typename K::Point_d Point_d;
-    typedef typename K::Iso_box_d Iso_box_d;
-    typedef typename K::FT FT;
-    
-    Construct_cartesian_const_iterator_d construct_cartesian_const_iterator_d_object() const {
-       return Construct_cartesian_const_iterator_d();
-    }  
-  };
-
-  
-} // namespace CGAL
-#endif // CGAL_SEARCH_TRAITS_D_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2.h b/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2.h
deleted file mode 100644
index 2a3400b..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2.h
+++ /dev/null
@@ -1,2043 +0,0 @@
-// Copyright (c) 2003,2004,2005,2006  INRIA Sophia-Antipolis (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
-// 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(s)     : Menelaos Karavelas <mkaravel at iacm.forth.gr>
-
-
-
-#ifndef CGAL_SEGMENT_DELAUNAY_GRAPH_2_H
-#define CGAL_SEGMENT_DELAUNAY_GRAPH_2_H
-
-#include <iostream>
-#include <vector>
-#include <list>
-#include <set>
-#include <map>
-#include <algorithm>
-#include <boost/tuple/tuple.hpp>
-
-#include <CGAL/Segment_Delaunay_graph_2/basic.h>
-
-#include <CGAL/Triangulation_2.h>
-#include <CGAL/Segment_Delaunay_graph_storage_traits_2.h>
-#include <CGAL/Segment_Delaunay_graph_vertex_base_2.h>
-#include <CGAL/Segment_Delaunay_graph_face_base_2.h>
-#include <CGAL/Triangulation_data_structure_2.h>
-
-#include <CGAL/Segment_Delaunay_graph_2/in_place_edge_list.h>
-#include <CGAL/Segment_Delaunay_graph_2/edge_list.h>
-#include <CGAL/Segment_Delaunay_graph_2/Traits_wrapper_2.h>
-#include <CGAL/Segment_Delaunay_graph_2/Constructions_C2.h>
-
-#include <CGAL/Iterator_project.h>
-#include <CGAL/utility.h>
-
-#include <CGAL/spatial_sort.h>
-#include <CGAL/Spatial_sort_traits_adapter_2.h>
-
-#include <boost/iterator/counting_iterator.hpp>
-
-/*
-  Conventions:
-  ------------
-  1. we treat segments as open; the endpoints are separate objects
-  2. a segment of length zero is treated as a point
-  3. a point is deleted only if it has no segment adjacent to it
-  4. when a segment is deleted it's endpoints are not deleted
-  5. the user can force the deletion of endpoints; this is only done
-     if condition 3 is met.
-  6. when objects are written to a stream we distinguish between
-     points and segments; points start by a 'p' and segments by an 's'.
-*/
-
-
-namespace CGAL {
-
-namespace SegmentDelaunayGraph_2 {
-
-namespace Internal {
-
-  template<typename Edge, typename LTag> struct Which_list;
-
-  // use the in-place edge list
-  template<typename E>
-  struct Which_list<E,Tag_true>
-  {
-    typedef E                           Edge;
-    typedef In_place_edge_list_for_sdg<Edge>    List;
-  };
-
-  // do not use the in-place edge list
-  template<typename E>
-  struct Which_list<E,Tag_false>
-  {
-    typedef E                                 Edge;
-    // change the following to Tag_false in order to use
-    // CGAL's Unique_hash_map
-    typedef Tag_true                          Use_stl_map_tag;
-    typedef Edge_list<Edge,Use_stl_map_tag>   List;
-  };
-
-
-  template < class Node >
-  struct Project_site_2 {
-    typedef Node                   argument_type;
-    typedef typename Node::Site_2  Site;
-    typedef Site                   result_type;
-    Site& operator()(const Node& x) const { 
-      static Site s;
-      s = x.site();
-      return s;
-    }
-    //    const Site& operator()(const Node& x) const { return x.site(); }
-  };
-
-  template < class Node, class Site_t >
-  struct Project_input_to_site_2 {
-    typedef Node                   argument_type;
-    typedef Site_t                 Site;
-    typedef Site                   result_type;
-    Site& operator()(const Node& x) const {
-      static Site s;
-      if ( boost::tuples::get<2>(x) /*x.third*/ ) { // it is a point
-	//	s = Site::construct_site_2(*x.first);
-	s = Site::construct_site_2( *boost::tuples::get<0>(x) );
-      } else {
-	//	s = Site::construct_site_2(*x.first, *x.second);
-	s = Site::construct_site_2
-	  (*boost::tuples::get<0>(x), *boost::tuples::get<1>(x));
-      }
-      return s;
-    }
-  };
-
-  template<typename T, typename U>
-  struct Check_type_equality_for_info
-  {
-    Check_type_equality_for_info()
-    {
-      ERROR__INFO_TYPES_OF_insert_AND_Storage_traits_with_info_2_MUST_MATCH
-	(T(), U());
-    }
-  };
-
-  template<typename T>
-  struct Check_type_equality_for_info<T,T>
-  {
-  };
-
-} // namespace Internal
-
-} //namespace SegmentDelaunayGraph_2
-
-
-template<class Gt, class ST, class STag, class D_S, class LTag, class SDGLx >
-class Segment_Delaunay_graph_hierarchy_2;
-
-template<class Gt, class ST, class D_S, class LTag >
-class Segment_Delaunay_graph_Linf_2;
-
-
-template<class Gt,
-	 class ST = Segment_Delaunay_graph_storage_traits_2<Gt>,
-	 class D_S = Triangulation_data_structure_2 < 
-                Segment_Delaunay_graph_vertex_base_2<ST>,
-                Segment_Delaunay_graph_face_base_2<Gt> >,
-	 class LTag = Tag_false >
-class Segment_Delaunay_graph_2
-  : private Triangulation_2<
-          Segment_Delaunay_graph_traits_wrapper_2<Gt>, D_S >
-{
-  friend class Segment_Delaunay_graph_Linf_2<Gt,ST,D_S,LTag>;
-  friend class Segment_Delaunay_graph_hierarchy_2<Gt,ST,Tag_true,D_S,LTag,
-   Segment_Delaunay_graph_2<Gt,ST,D_S,LTag> >;
-  friend class Segment_Delaunay_graph_hierarchy_2<Gt,ST,Tag_false,D_S,LTag,
-   Segment_Delaunay_graph_2<Gt,ST,D_S,LTag> >;
-  friend class Segment_Delaunay_graph_hierarchy_2<Gt,ST,Tag_true,D_S,LTag,
-   Segment_Delaunay_graph_Linf_2<Gt,ST,D_S,LTag> >;
-  friend class Segment_Delaunay_graph_hierarchy_2<Gt,ST,Tag_false,D_S,LTag,
-   Segment_Delaunay_graph_Linf_2<Gt,ST,D_S,LTag> >;
-protected:
-  // LOCAL TYPES
-  //------------
-  typedef Segment_Delaunay_graph_2<Gt,ST,D_S,LTag>       Self;
-
-  typedef Segment_Delaunay_graph_traits_wrapper_2<Gt>   Modified_traits;
-  typedef Triangulation_2<Modified_traits,D_S>           DG;
-  typedef DG                                            Delaunay_graph;
-
-  typedef LTag                                          List_tag;
-
-public:
-  // PUBLIC TYPES
-  //-------------
-  typedef D_S                                     Data_structure;
-  typedef D_S                                     Triangulation_data_structure;
-  typedef Gt                                     Geom_traits;
-  typedef ST                                     Storage_traits;
-  typedef typename Gt::Site_2                    Site_2;
-  typedef typename Gt::Point_2                   Point_2;
-
-  typedef typename D_S::Edge                      Edge;
-  typedef typename D_S::Vertex_handle             Vertex_handle;
-  typedef typename D_S::Face_handle               Face_handle;
-  typedef typename D_S::Vertex                    Vertex;
-  typedef typename D_S::Face                      Face;
-
-  typedef typename D_S::size_type                 size_type;
-
-  typedef typename D_S::Vertex_circulator         Vertex_circulator;
-  typedef typename D_S::Edge_circulator           Edge_circulator;
-  typedef typename D_S::Face_circulator           Face_circulator;
-
-  typedef typename D_S::Face_iterator             All_faces_iterator;
-  typedef typename D_S::Vertex_iterator           All_vertices_iterator;
-  typedef typename D_S::Edge_iterator             All_edges_iterator;
-
-  typedef typename DG::Finite_faces_iterator     Finite_faces_iterator;
-  typedef typename DG::Finite_vertices_iterator  Finite_vertices_iterator;
-  typedef typename DG::Finite_edges_iterator     Finite_edges_iterator;
-
-  typedef typename Storage_traits::Point_container     Point_container;
-  typedef typename Storage_traits::Point_handle        Point_handle;
-  typedef typename Storage_traits::const_Point_handle  const_Point_handle;
-
-protected:
-  typedef typename Geom_traits::Arrangement_type_2  AT2;
-  typedef typename AT2::Arrangement_type            Arrangement_type;
-
-  // these containers should have point handles and should replace the
-  // point container...
-  typedef boost::tuples::tuple<Point_handle,Point_handle,bool>  Site_rep_2;
-
-  struct Site_rep_less_than {
-    // less than for site reps
-    bool operator()(const Site_rep_2& x, const Site_rep_2& y) const {
-      Point_handle x1 = boost::tuples::get<0>(x);
-      Point_handle y1 = boost::tuples::get<0>(y);
-
-      if ( &(*x1) < &(*y1) ) { return true; }
-      if ( &(*y1) < &(*x1) ) { return false; }
-
-      Point_handle x2 = boost::tuples::get<1>(x);
-      Point_handle y2 = boost::tuples::get<1>(y);
-
-      return &(*x2) < &(*y2);
-    }
-  };
-
-  typedef std::set<Site_rep_2,Site_rep_less_than>  Input_sites_container;
-  typedef typename Input_sites_container::const_iterator
-  All_inputs_iterator;
-
-  typedef
-  CGAL_SEGMENT_DELAUNAY_GRAPH_2_NS::Internal::
-  Project_input_to_site_2<Site_rep_2, Site_2>
-  Proj_input_to_site;
-
-  typedef CGAL_SEGMENT_DELAUNAY_GRAPH_2_NS::Internal::Project_site_2<Vertex>
-  Proj_site;
-
-  struct Point_handle_less_than {
-    // less than
-    bool operator()(const const_Point_handle& x,
-		    const const_Point_handle& y) const {
-      return &(*x) < &(*y);
-    }
-  };
-
-  typedef std::pair<Point_handle,Point_handle>   Point_handle_pair;
-
-  typedef std::map<Point_handle,Point_handle,Point_handle_less_than>
-  Handle_map;
-
-public:
-  typedef Iterator_project<All_inputs_iterator, Proj_input_to_site>
-  Input_sites_iterator;
-
-  typedef Iterator_project<Finite_vertices_iterator, 
-                           Proj_site>            Output_sites_iterator;
-protected:
-  // LOCAL VARIABLE(S)
-  //------------------
-  // the container of points
-  Point_container pc_;
-  Input_sites_container isc_;
-  Storage_traits st_;
-#ifdef CGAL_SDG_NO_FACE_MAP
-  std::vector<Face_handle> fhc_;
-#endif
-
-protected:
-  // MORE LOCAL TYPES
-  //-----------------
-  typedef typename Gt::Intersections_tag        Intersections_tag;
-
-  typedef std::map<Face_handle,bool>            Face_map;
-  typedef std::vector<Edge>                     Edge_vector;
-
-  typedef std::list<Vertex_handle>              Vertex_list;
-  typedef typename Vertex_list::iterator        Vertex_list_iterator;
-
-  typedef Triple<Vertex_handle,Vertex_handle,Vertex_handle>
-  Vertex_triple;
-
-  typedef Vertex_handle                         Vh_triple[3];
-  typedef std::map<Face_handle,Sign>            Sign_map;
-
-  typedef std::pair<Face_handle,Face_handle>    Face_pair;
-
-  typedef typename Storage_traits::Storage_site_2   Storage_site_2;
-
-  // the edge list
-  typedef typename
-  CGAL_SEGMENT_DELAUNAY_GRAPH_2_NS::Internal::Which_list<Edge,List_tag>::List 
-  List;
-
-
-protected:
-  // types for insert on segment functions
-  typedef Vertex_triple (Self::*Insert_on_Type)(
-      const Storage_site_2& ss, const Site_2& t,
-      Vertex_handle v, const Tag_true&);
-  Insert_on_Type insert_point_on_segment_ptr;
-
-  typedef Vertex_triple (Self::*Insert_Exact_on_Type)(
-      const Storage_site_2& ss, const Site_2& t,
-      Vertex_handle v);
-  Insert_Exact_on_Type insert_exact_point_on_segment_ptr;
-
-  Vertex_triple
-  insert_point_on_segment(const Storage_site_2& ss, const Site_2& t,
-			  Vertex_handle v, const Tag_true&);
-
-  Vertex_triple
-  insert_exact_point_on_segment(const Storage_site_2& ss, const Site_2& t,
-				Vertex_handle v);
-
-private:
-  // CREATION helper
-  template<class ITag>
-  inline
-  void setup_if_intersecting_pointer(ITag tag) {
-    setup_if_intersecting_pointer_with_tag(tag);
-  }
-
-  void setup_if_intersecting_pointer_with_tag(Tag_false) {
-    insert_point_on_segment_ptr = NULL;
-  }
-
-  void setup_if_intersecting_pointer_with_tag(Tag_true) {
-    insert_point_on_segment_ptr = &Self::insert_point_on_segment;
-  }
-
-  void setup_insert_on_pointers_l2(void) {
-    Intersections_tag itag;
-    setup_if_intersecting_pointer(itag);
-    insert_exact_point_on_segment_ptr = &Self::insert_exact_point_on_segment;
-  }
-
-public:
-  // CREATION
-  //---------
-  Segment_Delaunay_graph_2(const Geom_traits& gt = Geom_traits(),
-			   const Storage_traits& st = Storage_traits())
-    : DG(gt), st_(st)
-  {
-    setup_insert_on_pointers_l2();
-  }
-
-  template< class Input_iterator >
-  Segment_Delaunay_graph_2(Input_iterator first, Input_iterator beyond,
-			   const Geom_traits& gt = Geom_traits(),
-			   const Storage_traits& st = Storage_traits())
-    : DG(gt), st_(st)
-  {
-    setup_insert_on_pointers_l2();
-    insert(first, beyond);
-  }
-
-  Segment_Delaunay_graph_2(const Self& other);
-  Self& operator=(const Self& other);
-
-public:
-  // ACCESS METHODS
-  // --------------
-  const Geom_traits&  geom_traits() const { return DG::geom_traits(); }
-
-  const Storage_traits&  storage_traits() const { return st_; }
-
-  const Data_structure&   data_structure() const { return this->_tds; }
-  const Triangulation_data_structure& tds() const { return this->_tds; }
-  const Point_container&  point_container() const { return pc_; }
-
-  inline size_type number_of_input_sites() const {
-    return isc_.size();
-  }
-
-  inline size_type number_of_output_sites() const {
-    return number_of_vertices();
-  }
-
-  inline size_type number_of_vertices() const {
-    return DG::number_of_vertices();
-  }
-
-  inline size_type number_of_faces() const {
-    return DG::number_of_faces();
-  }
-
-  inline Vertex_handle infinite_vertex() const {
-    return DG::infinite_vertex();
-  }
-
-  inline Face_handle infinite_face() const {
-    return DG::infinite_face();
-  }
-
-  inline Vertex_handle finite_vertex() const {
-    return DG::finite_vertex();
-  }
-
-  inline int dimension() const {
-    return DG::dimension();
-  }
-
-  using Delaunay_graph::cw;
-  using Delaunay_graph::ccw;
-  using Delaunay_graph::delete_vertex;
-  using Delaunay_graph::delete_face;
-public:
-  // TRAVERSAL OF THE DUAL GRAPH
-  //----------------------------
-  inline Finite_faces_iterator finite_faces_begin() const {
-    return DG::finite_faces_begin();
-  }
-
-  inline Finite_faces_iterator finite_faces_end() const {
-    return DG::finite_faces_end();
-  }
-
-  inline Finite_vertices_iterator finite_vertices_begin() const {
-    return DG::finite_vertices_begin();
-  }
-
-  inline Finite_vertices_iterator finite_vertices_end() const {
-    return DG::finite_vertices_end();
-  }
-
-  inline Finite_edges_iterator finite_edges_begin() const {
-    return DG::finite_edges_begin();    
-  }
-
-  inline Finite_edges_iterator finite_edges_end() const {
-    return DG::finite_edges_end();    
-  }
-
-  inline All_faces_iterator all_faces_begin() const {
-    return DG::all_faces_begin();
-  }
-
-  inline All_faces_iterator all_faces_end() const {
-    return DG::all_faces_end();
-  }
-
-  inline All_vertices_iterator all_vertices_begin() const {
-    return DG::all_vertices_begin();
-  }
-
-  inline All_vertices_iterator all_vertices_end() const {
-    return DG::all_vertices_end();
-  }
-
-  inline All_edges_iterator all_edges_begin() const {
-    return DG::all_edges_begin();
-  }
-
-  inline All_edges_iterator all_edges_end() const {
-    return DG::all_edges_end();
-  }
-
-  inline Input_sites_iterator input_sites_begin() const {
-    return Input_sites_iterator(isc_.begin());
-  }
-
-  inline Input_sites_iterator input_sites_end() const {
-    return Input_sites_iterator(isc_.end());
-  }
-
-  inline Output_sites_iterator output_sites_begin() const {
-    return Output_sites_iterator(finite_vertices_begin());
-  }
-
-  inline Output_sites_iterator output_sites_end() const {
-    return Output_sites_iterator(finite_vertices_end());    
-  }
-
-public:
-  // CIRCULATORS
-  //------------
-  inline Face_circulator
-  incident_faces(Vertex_handle v,
-		 Face_handle f = Face_handle()) const {
-    return DG::incident_faces(v, f);
-  }
-
-  inline Vertex_circulator
-  incident_vertices(Vertex_handle v,
-		    Face_handle f = Face_handle()) const { 
-    return DG::incident_vertices(v, f);
-  }
-
-  inline Edge_circulator
-  incident_edges(Vertex_handle v,
-		 Face_handle f = Face_handle()) const {
-    return DG::incident_edges(v, f);
-  }
- 
-public:
-  // PREDICATES
-  //-----------
-  inline bool is_infinite(const Vertex_handle& v) const {
-    return DG::is_infinite(v);
-  }
-
-  inline bool is_infinite(const Face_handle& f) const {
-    return DG::is_infinite(f);
-  }
-
-  inline bool is_infinite(const Face_handle& f, int i) const {
-    return DG::is_infinite(f, i);
-  }
-
-  inline bool is_infinite(const Edge& e) const {
-    return is_infinite(e.first, e.second);
-  }
-
-  inline bool is_infinite(const Edge_circulator& ec) const {
-    return DG::is_infinite(ec);
-  }
-
-public:
-  // INSERTION METHODS
-  //------------------
-  template<class Input_iterator>
-  inline size_type insert(Input_iterator first, Input_iterator beyond) {
-    return insert(first, beyond, Tag_false());
-  }
-
-  template<class Input_iterator>
-  size_type insert(Input_iterator first, Input_iterator beyond,	Tag_false)
-  {
-    // do it the obvious way: insert them as they come;
-    // one might think though that it might be better to first insert
-    // all end points and then all segments, or a variation of that.
-    size_type n_before = number_of_vertices();
-    for (Input_iterator it = first; it != beyond; ++it) {
-      insert(*it);
-    }
-    size_type n_after = number_of_vertices();
-    return n_after - n_before;
-  }
-
-  //insert a range of points using spatial sorting
-  std::size_t insert_points(std::vector<Point_2>& points)
-  {
-    size_type n = this->number_of_vertices();
-    spatial_sort (points.begin(), points.end(), geom_traits());
-    Vertex_handle hint;
-    for (typename std::vector<Point_2>::const_iterator
-          p = points.begin(), end = points.end(); p != end; ++p)
-    {
-      hint = insert(*p, hint);
-    }
-
-    return this->number_of_vertices() - n;
-  }
-
-  template <class PointIterator>
-  std::size_t insert_points(PointIterator first, PointIterator beyond)
-  {
-    std::vector<Point_2> points (first, beyond);
-    return insert_points(points);
-  }
-
-  template <class IndicesIterator>
-  std::size_t insert_segments( const std::vector<Point_2>& points,
-                               IndicesIterator indices_first,
-                               IndicesIterator indices_beyond )
-  {
-    typedef std::vector<std::ptrdiff_t> Vertex_indices;
-    typedef std::vector<Vertex_handle> Vertices;
-
-    Vertex_indices vertex_indices;
-    vertex_indices.resize(points.size());
-
-    std::copy(boost::counting_iterator<std::ptrdiff_t>(0),
-              boost::counting_iterator<std::ptrdiff_t>(points.size()),
-              std::back_inserter(vertex_indices));
-
-    size_type n = this->number_of_vertices();
-    Spatial_sort_traits_adapter_2<Gt,const Point_2*> sort_traits(&(points[0]));
-
-    spatial_sort(vertex_indices.begin(), vertex_indices.end(), sort_traits);
-
-    Vertices vertices;
-    vertices.resize(points.size());
-
-    Vertex_handle hint;
-    for(typename Vertex_indices::const_iterator
-          it_pti = vertex_indices.begin(), end = vertex_indices.end();
-          it_pti != end; ++it_pti)
-    {
-      hint = insert(points[*it_pti], hint);
-      vertices[*it_pti] = hint;
-    }
-
-    for(IndicesIterator it_cst=indices_first, end=indices_beyond;
-        it_cst!=end; ++it_cst)
-    {
-      Vertex_handle v1 = vertices[it_cst->first];
-      Vertex_handle v2 = vertices[it_cst->second];
-      if(v1 != v2) insert(v1, v2);
-    }
-
-    return this->number_of_vertices() - n;
-  }
-
-  template <class PointIterator, class IndicesIterator>
-  std::size_t insert_segments(PointIterator points_first,
-                              PointIterator points_beyond,
-                              IndicesIterator indices_first,
-                              IndicesIterator indices_beyond)
-  {
-    std::vector<Point_2> points (points_first, points_beyond);
-    return insert_segments(points, indices_first, indices_beyond);
-  }
-
-  static const Point_2& get_source(const std::pair<Point_2, Point_2>& segment){
-    return segment.first;
-  }
-  static const Point_2& get_target(const std::pair<Point_2, Point_2>& segment){
-    return segment.second;
-  }
-
-  template <class Segment_2>
-  static const Point_2& get_source(const Segment_2& segment){
-    return segment.source();
-  }
-  template <class Segment_2>
-  static const Point_2& get_target(const Segment_2& segment){
-    return segment.target();
-  }
-
-  static const Point_2& get_source(const Site_2& segment){
-    return segment.source_of_supporting_site();
-  }
-
-  static const Point_2& get_target(const Site_2& segment){
-    return segment.target_of_supporting_site();
-  }
-
-  template <class SegmentIterator>
-  std::size_t insert_segments(SegmentIterator first, SegmentIterator beyond)
-  {
-    std::vector<Point_2> points;
-    for (SegmentIterator s_it=first; s_it!=beyond; ++s_it)
-    {
-      points.push_back( get_source(*s_it) );
-      points.push_back( get_target(*s_it) );
-    }
-
-    std::vector< std::pair<std::size_t, std::size_t> > segment_indices;
-    std::size_t nb_segments = points.size() / 2;
-    segment_indices.reserve( nb_segments );
-    for (std::size_t k=0; k < nb_segments; ++k)
-      segment_indices.push_back( std::make_pair(2*k,2*k+1) );
-
-    return insert_segments( points,
-                            segment_indices.begin(),
-                            segment_indices.end() );
-  }
-
-  template <class Input_iterator>
-  inline size_type
-  insert_range(Input_iterator first, Input_iterator beyond, Site_2){
-    std::vector<Point_2> points;
-    std::vector<Point_2> segment_points;
-    std::vector< std::pair<std::size_t, std::size_t> > segment_indices;
-    std::vector<Site_2> non_input_segments;
-
-    for (Input_iterator it=first; it!=beyond; ++it)
-    {
-      if ( it->is_input() )
-      {
-        if (it->is_point() ) points.push_back( it->point() );
-        else{
-          segment_points.push_back( it->source_of_supporting_site() );
-          segment_points.push_back( it->target_of_supporting_site() );
-          segment_indices.push_back( std::make_pair(segment_points.size()-2,
-                                                    segment_points.size()-1 ));
-        }
-      }
-      else
-        non_input_segments.push_back(*it);
-    }
-    //insert the points
-    size_type n = insert_points(points);
-    //insert the segments
-    n += insert_segments( segment_points,
-                          segment_indices.begin(),
-                          segment_indices.end() );
-    //insert non-input sites
-    std::random_shuffle( non_input_segments.begin(), non_input_segments.end() );
-    n += insert(non_input_segments.begin(),
-                non_input_segments.end(), Tag_false() );
-    return n;
-  }
-
-  template <class Input_iterator>
-  inline size_type
-  insert_range(Input_iterator first, Input_iterator beyond, Point_2){
-    return insert_points(first, beyond);
-  }
-
-  template <class Input_iterator, class Segment_2>
-  inline size_type
-  insert_range(Input_iterator first, Input_iterator beyond, Segment_2){
-    return insert_segments(first, beyond);
-  }
-
-  template<class Input_iterator>
-  inline size_type
-  insert(Input_iterator first, Input_iterator beyond, Tag_true)
-  {
-    return
-      insert_range(first, beyond,
-                   typename std::iterator_traits<Input_iterator>::value_type()
-      );
-  }
-
-  // insert a point
-  inline Vertex_handle insert(const Point_2& p) {
-    // update input site container
-    Point_handle ph = register_input_site(p);
-    Storage_site_2 ss = st_.construct_storage_site_2_object()(ph);
-    return insert_point(ss, p, Vertex_handle());
-  }
-
-  inline Vertex_handle insert(const Point_2& p, Vertex_handle vnear) {
-    // update input site container
-    Point_handle ph = register_input_site(p);
-    Storage_site_2 ss = st_.construct_storage_site_2_object()(ph);
-    return insert_point(ss, p, vnear);
-  }
-
-protected:
-  // insert a point without registering it in the input sites
-  // container: useful for the hierarchy
-  inline Vertex_handle insert_no_register(const Storage_site_2& ss,
-					  const Point_2& p,
-					  Vertex_handle vnear) {
-    return insert_point(ss, p, vnear);
-  }
-
-public:
-  // insert a segment
-  inline Vertex_handle insert(const Point_2& p0, const Point_2& p1) {
-    // update input site container
-    Point_handle_pair php = register_input_site(p0, p1);
-    Storage_site_2 ss =
-      st_.construct_storage_site_2_object()(php.first, php.second);
-    Vertex_handle v = insert_segment(ss, Site_2::construct_site_2(p0, p1),
-				     Vertex_handle());
-    if ( v == Vertex_handle() ) {
-      unregister_input_site(php.first, php.second);
-    }
-    return v;
-  }
-
-  // inserting a segment whose endpoints have already been inserted
-  // update input site container
-  inline Vertex_handle insert(const Vertex_handle& v0,
-			      const Vertex_handle& v1) {
-    CGAL_precondition( v0->storage_site().is_point() &&
-		       v1->storage_site().is_point() );
-
-    Point_handle h0 = v0->storage_site().point();
-    Point_handle h1 = v1->storage_site().point();
-    Storage_site_2 ss = st_.construct_storage_site_2_object()(h0, h1);
-
-    // update input site container
-    Point_handle_pair php = register_input_site(h0, h1);
-
-    if ( number_of_vertices() == 2 ) {
-      return insert_third(ss, v0, v1);
-    }
-
-    Vertex_handle v = insert_segment_interior(ss.site(), ss, v0);
-    if ( v == Vertex_handle() ) {
-      unregister_input_site(php.first, php.second);
-    }
-    return v;
-  }
-
-  inline Vertex_handle insert(const Point_2& p0, const Point_2& p1, 
-			      Vertex_handle vnear) {
-    // update input site container
-    Point_handle_pair php = register_input_site(p0, p1);
-    Storage_site_2 ss =
-      st_.construct_storage_site_2_object()(php.first, php.second);
-    Vertex_handle v =
-      insert_segment(ss, Site_2::construct_site_2(p0, p1), vnear);
-    if ( v == Vertex_handle() ) {
-      unregister_input_site(php.first, php.second);
-    }
-    return v;
-  }
-
-  inline Vertex_handle insert(const Site_2& t) {
-    return insert(t, Vertex_handle());
-  }
-
-  Vertex_handle insert(const Site_2& t, Vertex_handle vnear)
-  {
-    // the intended use is to unify the calls to insert(...);
-    // thus the site must be an exact one; 
-    CGAL_precondition( t.is_input() );
-
-    // update input site container
-
-    if ( t.is_segment() ) {
-      Point_handle_pair php =
-	register_input_site( t.source_of_supporting_site(),
-			     t.target_of_supporting_site() );
-      Storage_site_2 ss =
-	st_.construct_storage_site_2_object()(php.first, php.second);
-      Vertex_handle v = insert_segment(ss, t, vnear);
-      if ( v == Vertex_handle() ) {
-	unregister_input_site( php.first, php.second );
-      }
-      return v;
-    } else if ( t.is_point() ) {
-      Point_handle ph = register_input_site( t.point() );
-      Storage_site_2 ss = st_.construct_storage_site_2_object()(ph);
-      return insert_point(ss, t.point(), vnear);
-    } else {
-      CGAL_precondition ( t.is_defined() );
-      return Vertex_handle(); // to avoid compiler error
-    }
-  }
-
-protected:
-  template<class SSite>
-  inline void convert_info1(SSite& ss_trg, const SSite& ss_src,
-			    bool is_src, int,
-			    typename SSite::Has_info_tag const* = 0) const
-  {
-    //    std::cerr << "converting info..." << std::flush;
-    typename Storage_traits::Convert_info convert = st_.convert_info_object();
-
-    ss_trg.set_info( convert(ss_src.info(), is_src) );
-    //    std::cerr << " done!" << std::endl;
-  }
-
-  template<class SSite>
-  inline void convert_info1(SSite& /*  ss_trg */,
-			    const SSite& /* ss_src */, bool, char) const
-  {
-  }
-
-  void convert_info(Storage_site_2& ss_trg,
-		    const Storage_site_2& ss_src, bool is_src) const {
-    CGAL_precondition( ss_src.is_segment() && ss_trg.is_point() );
-    CGAL_precondition( ss_src.is_input() && ss_trg.is_input() );
-    CGAL_assertion( (is_src && same_points(ss_src.source_site(), ss_trg)) ||
-		    (!is_src && same_points(ss_src.target_site(), ss_trg))
-		    );
-    convert_info1(ss_trg, ss_src, is_src, 0);
-  }
-
-  template<class SSite>
-  inline void merge_info1(Vertex_handle v, const SSite& ss, int,
-			  typename SSite::Has_info_tag const* = 0)
-  {
-    //    std::cerr << "merging info..." << std::flush;
-    Storage_site_2 ss_v = v->storage_site();
-
-    typename Storage_traits::Merge_info merge = st_.merge_info_object();
-
-    ss_v.set_info( merge(ss_v.info(), ss.info()) );
-    v->set_site(ss_v);
-    //    std::cerr << " done!" << std::endl;
-  }
-
-  template<class SSite>
-  inline void merge_info1(Vertex_handle, const SSite&, char) const
-  {
-  }
-
-  // merges the info of the storage site of the vertex handle with the
-  // info of the given site; the vertex_handle contains the storage
-  // site with the new info
-  inline void merge_info(Vertex_handle v, const Storage_site_2& ss)  {
-    CGAL_precondition( (v->storage_site().is_segment() &&
-			ss.is_segment() &&
-			same_segments(v->site(), ss.site())) ||
-		       (v->storage_site().is_point() &&
-			ss.is_point() &&
-			same_points(v->site(), ss.site())) ||
-    		       (v->storage_site().is_point() &&	ss.is_segment())
-    		       );
-    merge_info1(v, ss, 0);
-  }
-
-public:
-  template<typename Info_t>
-  inline Vertex_handle insert(const Site_2& t,
-			      const Info_t& info) {
-    return insert(t, info, Vertex_handle());
-  }
-
-  template<typename Info_t>
-  Vertex_handle insert(const Site_2& t,
-		       const Info_t& info,
-		       Vertex_handle vnear)
-  {
-    typedef typename Storage_traits::Info Info;
-    CGAL_SEGMENT_DELAUNAY_GRAPH_2_NS::Internal::
-      Check_type_equality_for_info<Info_t, Info>();
-    // the intended use is to unify the calls to insert(...);
-    // thus the site must be an exact one; 
-    CGAL_precondition( t.is_input() );
-
-    // update input site container
-
-    if ( t.is_segment() ) {
-      Point_handle_pair php =
-	register_input_site( t.source_of_supporting_site(),
-			     t.target_of_supporting_site() );
-      Storage_site_2 ss =
-	st_.construct_storage_site_2_object()(php.first, php.second);
-      ss.set_info(info);
-      Vertex_handle v = insert_segment(ss, t, vnear);
-      if ( v == Vertex_handle() ) {
-	unregister_input_site( php.first, php.second );
-      }
-      return v;
-    } else if ( t.is_point() ) {
-      Point_handle ph = register_input_site( t.point() );
-      Storage_site_2 ss = st_.construct_storage_site_2_object()(ph);
-      ss.set_info(info);
-      return insert_point(ss, t.point(), vnear);
-    } else {
-      CGAL_precondition ( t.is_defined() );
-      return Vertex_handle(); // to avoid compiler error
-    }
-  }
-
-  // REMOVAL METHODS
-  //----------------
-protected:
-  bool is_star(const Vertex_handle& v) const;
-  bool is_linear_chain(const Vertex_handle& v0, const Vertex_handle& v1,
-		       const Vertex_handle& v2) const;
-  bool is_flippable(const Face_handle& f, int i) const;
-
-  void minimize_degree(const Vertex_handle& v);
-
-  // this method does not really do the job as intended, i.e., for removal
-  void equalize_degrees(const Vertex_handle& v, Self& small_d,
-			std::map<Vertex_handle,Vertex_handle>& vmap,
-			List& l) const;
-
-  void expand_conflict_region_remove(const Face_handle& f,
-				     const Site_2& t,
-				     const Storage_site_2& ss,
-				     List& l, Face_map& fm,
-				     Sign_map& sign_map);
-
-  void find_conflict_region_remove(const Vertex_handle& v,
-				   const Vertex_handle& vnearest,
-				   List& l, Face_map& fm, Sign_map& vm);
-
-  template<class OutputItFaces>
-  OutputItFaces get_faces(const List& l, OutputItFaces fit) const
-  {
-    // map that determines if a face has been visited
-    std::map<Face_handle,bool> fmap;
-
-    // compute the initial face
-    Edge e_front = l.front();
-    Face_handle fstart = e_front.first->neighbor(e_front.second);
-
-    // do the recursion
-    return get_faces(l, fstart, fmap, fit);
-  }
-
-  template<class OutputItFaces>
-  OutputItFaces get_faces(const List& l, Face_handle f,
-			  std::map<Face_handle,bool>& fmap,
-			  OutputItFaces fit) const
-  {
-    // if the face has been visited return
-    if ( fmap.find(f) != fmap.end() ) { return fit; }
-
-    // mark the face as visited
-    fmap[f] = true;
-
-    // output the face
-    *fit++ = f;
-
-    // recursively go to neighbors
-    for (int i = 0; i < 3; i++) {
-      Face_handle n = f->neighbor(i);
-      Edge ee(n, n->index( this->_tds.mirror_vertex(f,i) ));
-      if ( !l.is_in_list(ee) ) {
-	fit = get_faces(l, n, fmap, fit);
-      }
-    }
-    return fit;
-  }
-
-  size_type count_faces(const List& l) const;
-
-  void fill_hole(const Self& small_d, const Vertex_handle& v, const List& l,
-		 std::map<Vertex_handle,Vertex_handle>& vmap);
-
-  bool remove_first(const Vertex_handle& v);
-  bool remove_second(const Vertex_handle& v);
-  bool remove_third(const Vertex_handle& v);
-
-  void compute_small_diagram(const Vertex_handle& v, Self& small_d) const;
-  void compute_vertex_map(const Vertex_handle& v, const Self& small_d,
-			  std::map<Vertex_handle,Vertex_handle>& vmap) const;
-  void remove_degree_d_vertex(const Vertex_handle& v);
-
-  bool remove_base(const Vertex_handle& v);
-
-public:
-  bool remove(const Vertex_handle& v);
-
-protected:
-  inline void unregister_input_site(const Point_handle& h)
-  {
-    Site_rep_2 rep(h, h, true);
-    typename Input_sites_container::iterator it = isc_.find(rep);
-    CGAL_assertion( it != isc_.end() );
-
-    pc_.erase(h);
-    isc_.erase(it);
-  }
-
-  inline void unregister_input_site(const Point_handle& h1,
-				    const Point_handle& h2)
-  {   
-    Site_rep_2 rep(h1, h2, false);
-    typename Input_sites_container::iterator it = isc_.find(rep);
-    
-    Site_rep_2 sym_rep(h2, h1, false);
-    typename Input_sites_container::iterator sym_it = isc_.find(sym_rep);
-
-    CGAL_assertion( it != isc_.end() || sym_it != isc_.end() );
-
-    if ( it != isc_.end() ) { isc_.erase(it); }
-    if ( sym_it != isc_.end() ) { isc_.erase(sym_it); }
-
-    Site_rep_2 r1(h1, h1, true);
-    if ( isc_.find(r1) == isc_.end() ) { isc_.insert(r1); }
-
-    Site_rep_2 r2(h2, h2, true);
-    if ( isc_.find(r2) == isc_.end() ) { isc_.insert(r2); }
-  }
-
-  inline Point_handle register_input_site(const Point_2& p)
-  {
-    std::pair<Point_handle,bool> it = pc_.insert(p);
-    Site_rep_2 rep(it.first, it.first, true);
-    isc_.insert( rep );
-    return it.first;
-  }
-
-  inline
-  Point_handle_pair register_input_site(const Point_2& p0, const Point_2& p1)
-  {
-    std::pair<Point_handle,bool> it1 = pc_.insert(p0);
-    std::pair<Point_handle,bool> it2 = pc_.insert(p1);
-    Site_rep_2 rep(it1.first, it2.first, false);
-    isc_.insert( rep );
-    return Point_handle_pair(it1.first, it2.first);
-  }
-
-  inline
-  Point_handle_pair register_input_site(const Point_handle& h0,
-					const Point_handle& h1)
-  {
-    CGAL_precondition( h0 != h1 );
-    Site_rep_2 rep(h0, h1, false);
-    isc_.insert( rep );
-    return Point_handle_pair(h0, h1);
-  }
-
-  Vertex_handle  insert_first(const Storage_site_2& ss, const Point_2& p);
-  Vertex_handle  insert_second(const Storage_site_2& ss, const Point_2& p);
-  Vertex_handle  insert_third(const Storage_site_2& ss, const Point_2& p);
-  Vertex_handle  insert_third(const Site_2& t, const Storage_site_2& ss);
-  Vertex_handle  insert_third(const Storage_site_2& ss, Vertex_handle v0,
-			      Vertex_handle v1);
-
-  Vertex_handle insert_point(const Storage_site_2& ss, const Point_2& p,
-			     Vertex_handle vnear);
-  Vertex_handle insert_point(const Storage_site_2& ss,
-			     const Site_2& t, Vertex_handle vnear);
-  Vertex_handle insert_point2(const Storage_site_2& ss,
-			      const Site_2& t, Vertex_handle vnear);
-
-  Vertex_handle insert_segment(const Storage_site_2& ss, const Site_2& t,
-			       Vertex_handle vnear);
-
-  Vertex_handle insert_segment_interior(const Site_2& t,
-					const Storage_site_2& ss,
-					Vertex_handle vnear);
-
-  template<class ITag>
-  inline
-  Vertex_handle insert_intersecting_segment(const Storage_site_2& ss,
-					    const Site_2& t,
-					    Vertex_handle v,
-					    ITag tag) {
-    return insert_intersecting_segment_with_tag(ss, t, v, tag);
-  }
-
-  Vertex_handle
-  insert_intersecting_segment_with_tag(const Storage_site_2& ss,
-				       const Site_2& t,
-				       Vertex_handle v, Tag_false);
-
-  Vertex_handle
-  insert_intersecting_segment_with_tag(const Storage_site_2& ss,
-				       const Site_2& t,
-				       Vertex_handle v, Tag_true);
-
-
-
-public:
-  // NEAREST NEIGHBOR LOCATION
-  //--------------------------
-  inline Vertex_handle nearest_neighbor(const Point_2& p) const {
-    return nearest_neighbor(Site_2::construct_site_2(p), Vertex_handle());
-  }
-
-  inline Vertex_handle nearest_neighbor(const Point_2& p,
-					Vertex_handle vnear) const {
-    return nearest_neighbor(Site_2::construct_site_2(p), vnear);
-  }
-
-protected:
-  Vertex_handle nearest_neighbor(const Site_2& p,
-				 Vertex_handle vnear) const;
-
-
-protected:
-  // I/O METHODS
-  //------------
-  typedef std::map<const_Point_handle,size_type,Point_handle_less_than>
-  Point_handle_mapper;
-
-  typedef std::vector<Point_handle> Point_handle_vector;
-
-  void file_output(std::ostream&, const Storage_site_2&,
-		   Point_handle_mapper&) const;
-
-  void file_output(std::ostream&, Point_handle_mapper&,
-		   bool print_point_container) const;
-
-  void file_input(std::istream&, Storage_site_2&,
-		  const Point_handle_vector&, const Tag_true&) const;
-  void file_input(std::istream&, Storage_site_2&,
-		  const Point_handle_vector&, const Tag_false&) const;
-  void file_input(std::istream&, bool read_handle_vector,
-		  Point_handle_vector&);
-
-public:
-  void file_input(std::istream& is) {
-    Point_handle_vector P;
-    file_input(is, true, P);
-  }
-
-  void file_output(std::ostream& os) const {
-    Point_handle_mapper P;
-    size_type inum = 0;
-    for (const_Point_handle ph = pc_.begin(); ph != pc_.end(); ++ph) {
-      P[ph] = inum++;
-    }
-    file_output(os, P, true);
-  }
-
-  template< class Stream >
-  Stream& draw_dual(Stream& str) const
-  {
-    Finite_edges_iterator eit = finite_edges_begin();
-    for (; eit != finite_edges_end(); ++eit) {
-      draw_dual_edge(*eit, str);
-    }
-    return str;
-  }
-
-  template < class Stream > 
-  Stream& draw_skeleton(Stream& str) const
-  {
-    Finite_edges_iterator eit = finite_edges_begin();
-    for (; eit != finite_edges_end(); ++eit) {
-      Site_2 p = eit->first->vertex(  cw(eit->second) )->site();
-      Site_2 q = eit->first->vertex( ccw(eit->second) )->site();
-
-      bool is_endpoint_of_seg =
-	( p.is_segment() && q.is_point() &&
-	  is_endpoint_of_segment(q, p) ) ||
-	( p.is_point() && q.is_segment() &&
-	  is_endpoint_of_segment(p, q) );
-
-      if ( !is_endpoint_of_seg ) {
-	draw_dual_edge(*eit, str);
-      }
-    }
-    return str;
-  }
-
-  // MK: this has to be rewritten. all the checking must be done in
-  // the geometric traits class.
-  template< class Stream >
-  Stream& draw_dual_edge(Edge e, Stream& str) const
-  {
-    CGAL_precondition( !is_infinite(e) );
-
-    typename Geom_traits::Line_2              l;
-    typename Geom_traits::Segment_2           s;
-    typename Geom_traits::Ray_2               r;
-    CGAL::Parabola_segment_2<Gt>              ps;
-
-    Object o = primal(e);
-
-    if (CGAL::assign(l, o))   str << l;
-    if (CGAL::assign(s, o))   str << s; 
-    if (CGAL::assign(r, o))   str << r;
-    if (CGAL::assign(ps, o))  ps.draw(str);
-
-    return str;
-  }
-
-  template< class Stream >
-  inline
-  Stream& draw_dual_edge(Edge_circulator ec, Stream& str) const {
-    return draw_dual_edge(*ec, str);
-  }
-
-  template< class Stream >
-  inline
-  Stream& draw_dual_edge(Finite_edges_iterator eit, Stream& str) const {
-    return draw_dual_edge(*eit, str);
-  }
-
-public:
-  // VALIDITY CHECK
-  //---------------
-  bool is_valid(bool verbose = false, int level = 1) const;
-
-public:
-  // MISCELLANEOUS
-  //--------------
-  void clear() {
-    DG::clear();
-    pc_.clear();
-    isc_.clear();
-  }
-
-  void swap(Segment_Delaunay_graph_2& sdg) {
-    DG::swap(sdg);
-    pc_.swap(sdg.pc_);
-    isc_.swap(sdg.isc_);
-  }
-
-  //////////////////////////////////////////////////////////////////////
-  // THE METHODS BELOW ARE LOCAL
-  //////////////////////////////////////////////////////////////////////
-
-protected:
-  // THE COPY METHOD
-  //------------------------------------------------------------------
-  // used in the copy constructor and assignment operator
-
-  Storage_site_2
-  copy_storage_site(const Storage_site_2& ss_other,
-		    Handle_map& hm, const Tag_false&);
-
-  Storage_site_2
-  copy_storage_site(const Storage_site_2& ss_other,
-		    Handle_map& hm, const Tag_true&);
-
-  void copy(Segment_Delaunay_graph_2& other);
-  void copy(Segment_Delaunay_graph_2& other, Handle_map& hm);
-
-protected:
-  // HELPER METHODS FOR COMBINATORIAL OPERATIONS ON THE DATA STRUCTURE
-  //------------------------------------------------------------------
-
-  // getting the degree of a vertex
-  inline
-  typename Data_structure::size_type degree(const Vertex_handle& v) const {
-    return this->_tds.degree(v);
-  }
-
-  // getting the symmetric edge
-  inline Edge sym_edge(const Edge e) const {
-    return sym_edge(e.first, e.second);
-  }
-
-  inline Edge sym_edge(const Face_handle& f, int i) const {
-    Face_handle f_sym = f->neighbor(i);
-#ifdef CGAL_SDG_ALTERNATE_SYMEDGE_IMPLEMENTATION_BY_AF
-    int count = ( f_sym->neighbor(0) == f );
-    int i_sym = 0;
-    if ( f_sym->neighbor(1) == f ) {
-      ++count;
-      i_sym = 1;
-    }
-    if ( f_sym->neighbor(2) == f ) {
-      ++count;
-      i_sym = 2;
-    }
-    if ( count == 1 ) {
-      return Edge(f_sym, i_sym);
-    }
-    return Edge(f_sym, f_sym->index( f->vertex(i) ));
-#else
-    return Edge(  f_sym, f_sym->index( this->_tds.mirror_vertex(f, i) )  );
-#endif
-  }
-
-  Edge flip(Face_handle& f, int i) {
-    CGAL_precondition ( f != Face_handle() );
-    CGAL_precondition (i == 0 || i == 1 || i == 2);
-    CGAL_precondition( this->dimension()==2 ); 
-
-    CGAL_precondition( f->vertex(i) != this->_tds.mirror_vertex(f, i) );
-
-    this->_tds.flip(f, i);
-
-    return Edge(f, ccw(i));
-  }
-
-  inline Edge flip(Edge e) {
-    return flip(e.first, e.second);
-  }
-
-  inline bool is_degree_2(const Vertex_handle& v) const {
-    Face_circulator fc = incident_faces(v);
-    Face_circulator fc1 = fc;
-    ++(++fc1);
-    return ( fc == fc1 );
-  }
-
-  inline Vertex_handle insert_degree_2(Edge e) {
-    return this->_tds.insert_degree_2(e.first,e.second);
-  }
-
-  inline Vertex_handle insert_degree_2(Edge e, const Storage_site_2& ss) {
-    Vertex_handle v = insert_degree_2(e);
-    v->set_site(ss);
-    return v;
-  }
-
-  inline void remove_degree_2(Vertex_handle v) {
-    CGAL_precondition( is_degree_2(v) );
-    this->_tds.remove_degree_2(v);
-  }
-
-  inline void remove_degree_3(Vertex_handle v) {
-    CGAL_precondition( degree(v) == 3 );
-    this->_tds.remove_degree_3(v, Face_handle());
-  }
-
-  inline Vertex_handle create_vertex(const Storage_site_2& ss) {
-    Vertex_handle v = this->_tds.create_vertex();
-    v->set_site(ss);
-    return v;
-  }
-
-  inline Vertex_handle create_vertex_dim_up(const Storage_site_2& ss) {
-    Vertex_handle v = this->_tds.insert_dim_up(infinite_vertex());
-    v->set_site(ss);
-    return v;
-  }
-
-protected:
-  // HELPER METHODS FOR CREATING STORAGE SITES
-  //------------------------------------------
-  inline
-  Storage_site_2 split_storage_site(const Storage_site_2& ss0,
-				    const Storage_site_2& ss1,
-				    bool first)
-  {
-    // Split the first storage site which is a segment using the
-    // second storage site which is an exact point
-    // i denotes whether the first or second half is to be created
-    CGAL_precondition( ss0.is_segment() && ss1.is_point() );
-
-    return st_.construct_storage_site_2_object()(ss0, ss1, first);
-  }
-
-public:
-  // METHODS FOR ACCESSING THE PRIMAL GRAPH
-  //---------------------------------------
-  // used primarily for visualization
-  inline Point_2 primal(const Face_handle& f) const {
-    return circumcenter(f);
-  }
-
-  Object primal(const Edge e) const;
-
-  inline Object primal(const Edge_circulator& ec) const {
-    return primal(*ec); 
-  }
-
-  inline Object primal(const Finite_edges_iterator& ei) const {
-    return primal(*ei);
-  }
-
-protected:
-  void print_error_message() const;
-
-  void print_error_message(const Tag_false&) const
-  {
-    static int i = 0;
-
-    if ( i == 0 ) {
-      i++;
-      std::cerr << "SDG::Insert aborted: intersecting segments found"
-		<< std::endl;
-    }
-  }
-
-  void print_error_message(const Tag_true&) const {}
-
-  //protected:
-public:
-  // wrappers for constructions
-  inline Point_2 circumcenter(const Face_handle& f) const {
-    CGAL_precondition( this->dimension()==2 || !is_infinite(f) );
-    return circumcenter(f->vertex(0)->site(),
-			f->vertex(1)->site(),
-			f->vertex(2)->site());
-  }
-
-  inline Point_2 circumcenter(const Site_2& t0, const Site_2& t1, 
-			      const Site_2& t2) const {
-    return
-    geom_traits().construct_svd_vertex_2_object()(t0, t1, t2);
-  }
-
-protected:
-  // HELPER METHODS FOR INSERTION
-  //-----------------------------
-  void initialize_conflict_region(const Face_handle& f, List& l);
-
-  std::pair<Face_handle,Face_handle>
-  find_faces_to_split(const Vertex_handle& v, const Site_2& t) const;
-
-  void expand_conflict_region(const Face_handle& f, const Site_2& t,
-			      const Storage_site_2& ss,
-#ifdef CGAL_SDG_NO_FACE_MAP
-			      List& l,
-#else
-			      List& l, Face_map& fm,
-			      std::map<Face_handle,Sign>& sign_map,
-#endif
-			      Triple<bool, Vertex_handle,
-			      Arrangement_type>& vcross);
-
-  Vertex_handle add_bogus_vertex(Edge e, List& l);
-  Vertex_list   add_bogus_vertices(List& l);
-  void          remove_bogus_vertices(Vertex_list& vl);
-
-#ifdef CGAL_SDG_NO_FACE_MAP
-  void retriangulate_conflict_region(Vertex_handle v, List& l);
-#else
-  void retriangulate_conflict_region(Vertex_handle v, List& l,
-				     Face_map& fm);
-#endif
-
-
-// choosing the correct bisector constructors
-private:
-  template <typename T, typename Tag_has_bisector_constructions>
-  struct ConstructionHelper {};
-
-  // take constructors from L2
-  template <typename T>
-  struct ConstructionHelper<T, Tag_false>
-  {
-    typedef CGAL_SEGMENT_DELAUNAY_GRAPH_2_NS::
-              Construct_sdg_bisector_2<Gt,
-                Integral_domain_without_division_tag>
-            tagbis;
-    typedef CGAL_SEGMENT_DELAUNAY_GRAPH_2_NS::
-              Construct_sdg_bisector_ray_2<Gt,
-                Integral_domain_without_division_tag>
-            tagbisray;
-    typedef CGAL_SEGMENT_DELAUNAY_GRAPH_2_NS::
-              Construct_sdg_bisector_segment_2<Gt,
-                Integral_domain_without_division_tag>
-            tagbisseg;
-  };
-
-  // constructors from traits
-  template <typename T>
-  struct ConstructionHelper<T, Tag_true>
-  {
-    typedef
-            typename T:: template Construct_sdg_bisector_2
-              <Gt, Integral_domain_without_division_tag>
-            tagbis;
-    typedef
-            typename T:: template Construct_sdg_bisector_ray_2
-              <Gt, Integral_domain_without_division_tag>
-            tagbisray;
-    typedef
-            typename T:: template Construct_sdg_bisector_segment_2
-              <Gt, Integral_domain_without_division_tag>
-            tagbisseg;
-  };
-
-  template <typename T>
-  struct ConstructionChooser
-  {
-    typedef typename ConstructionHelper<T, typename T::Tag_has_bisector_constructions>::tagbis tagbis;
-    typedef typename ConstructionHelper<T, typename T::Tag_has_bisector_constructions>::tagbisray tagbisray;
-    typedef typename ConstructionHelper<T, typename T::Tag_has_bisector_constructions>::tagbisseg tagbisseg;
-  };
-
-
-protected:
-  // TYPES AND ACCESS METHODS FOR VISUALIZATION
-  //-------------------------------------------
-
-  // types
-  typedef
-  CGAL_SEGMENT_DELAUNAY_GRAPH_2_NS::Construct_sdg_circle_2<Gt,Integral_domain_without_division_tag>
-  Construct_sdg_circle_2;
-
-  typedef typename
-          ConstructionChooser<Geom_traits>::tagbis
-          Construct_sdg_bisector_2;
-  typedef typename
-          ConstructionChooser<Geom_traits>::tagbisray
-          Construct_sdg_bisector_ray_2;
-  typedef typename
-          ConstructionChooser<Geom_traits>::tagbisseg
-          Construct_sdg_bisector_segment_2;
-
-  // access
-  inline Construct_sdg_circle_2
-  construct_sdg_circle_2_object() const{
-    return Construct_sdg_circle_2();
-  }
-
-  inline Construct_sdg_bisector_2
-  construct_sdg_bisector_2_object() const {
-    return Construct_sdg_bisector_2();
-  }
-
-  inline Construct_sdg_bisector_ray_2
-  construct_sdg_bisector_ray_2_object() const {
-    return Construct_sdg_bisector_ray_2();
-  }
-
-  inline Construct_sdg_bisector_segment_2
-  construct_sdg_bisector_segment_2_object() const { 
-    return Construct_sdg_bisector_segment_2(); 
-  }
-
-protected:
-  // WRAPPERS FOR GEOMETRIC PREDICATES
-  //----------------------------------
-  inline
-  bool same_points(const Storage_site_2& p, const Storage_site_2& q) const {
-    return geom_traits().equal_2_object()(p.site(), q.site());
-  }
-
-  inline
-  bool same_segments(const Storage_site_2& t, Vertex_handle v) const {
-    if ( is_infinite(v) ) { return false; }
-    if ( t.is_point() || v->storage_site().is_point() ) { return false; }
-    return same_segments(t.site(), v->site());
-  }
-
-  inline
-  bool is_endpoint_of_segment(const Storage_site_2& p,
-			      const Storage_site_2& s) const
-  {
-    CGAL_precondition( p.is_point() && s.is_segment() );
-    return ( same_points(p, s.source_site()) ||
-	     same_points(p, s.target_site()) );
-  }
-
-  inline
-  bool is_degenerate_segment(const Storage_site_2& s) const {
-    CGAL_precondition( s.is_segment() );
-    return same_points(s.source_site(), s.target_site());
-  }
-
-  // returns:
-  //   ON_POSITIVE_SIDE if q is closer to t1
-  //   ON_NEGATIVE_SIDE if q is closer to t2
-  //   ON_ORIENTED_BOUNDARY if q is on the bisector of t1 and t2
-  inline
-  Oriented_side side_of_bisector(const Storage_site_2 &t1,
-				 const Storage_site_2 &t2,
-				 const Storage_site_2 &q) const {
-    return
-      geom_traits().oriented_side_of_bisector_2_object()(t1.site(),
-							 t2.site(),
-							 q.site());
-  }
-
-  inline
-  Sign incircle(const Storage_site_2 &t1, const Storage_site_2 &t2,
-		const Storage_site_2 &t3, const Storage_site_2 &q) const {
-#ifdef CGAL_PROFILE_SDG_DUMP_INCIRCLE
-    typedef typename Geom_traits::FT  FT;
-    if ( !Algebraic_structure_traits<FT>::Is_exact::value ) {
-      std::ofstream ofs("incircle.cin", std::ios_base::app);
-      ofs.precision(16);
-      ofs << t1.site() << " ";
-      ofs << t2.site() << " ";
-      ofs << t3.site() << " ";
-      ofs <<  q.site() << std::endl;
-      ofs.close();
-    }
-#endif
-    return geom_traits().vertex_conflict_2_object()(t1.site(),
-						    t2.site(),
-						    t3.site(),
-						    q.site());
-  }
-
-  inline
-  Sign incircle(const Storage_site_2 &t1, const Storage_site_2 &t2,
-		const Storage_site_2 &q) const {
-    return geom_traits().vertex_conflict_2_object()(t1.site(),
-						    t2.site(),
-						    q.site());
-  }
-
-  inline
-  Sign incircle(const Face_handle& f, const Storage_site_2& q) const {
-    return incircle(f, q.site());
-  }
-
-  inline
-  bool finite_edge_interior(const Storage_site_2& t1,
-			    const Storage_site_2& t2,
-			    const Storage_site_2& t3,
-			    const Storage_site_2& t4,
-			    const Storage_site_2& q, Sign sgn) const {
-    return
-      geom_traits().finite_edge_interior_conflict_2_object()
-      (t1.site(), t2.site(), t3.site(), t4.site(), q.site(), sgn);
-  }
-
-  inline
-  bool finite_edge_interior(const Face_handle& f, int i,
-			    const Storage_site_2& q, Sign sgn) const {
-    CGAL_precondition( !is_infinite(f) &&
-		       !is_infinite(f->neighbor(i)) );
-    return finite_edge_interior( f->vertex( ccw(i) )->site(),
-				 f->vertex(  cw(i) )->site(),
-				 f->vertex(     i  )->site(),
-				 this->_tds.mirror_vertex(f, i)->site(),
-				 q.site(), sgn);
-  }
-
-  inline
-  bool finite_edge_interior(const Storage_site_2& t1,
-			    const Storage_site_2& t2,
-			    const Storage_site_2& t3,
-			    const Storage_site_2& q,
-			    Sign sgn) const {
-    return geom_traits().finite_edge_interior_conflict_2_object()(t1.site(),
-								  t2.site(),
-								  t3.site(),
-								  q.site(),
-								  sgn);
-  }
-
-  inline
-  bool finite_edge_interior(const Storage_site_2& t1,
-			    const Storage_site_2& t2,
-			    const Storage_site_2& q,
-			    Sign sgn) const {
-    return
-      geom_traits().finite_edge_interior_conflict_2_object()(t1.site(),
-							     t2.site(),
-							     q.site(),
-							     sgn);
-  }
-
-  bool finite_edge_interior(const Face_handle& f, int i,
-			    const Storage_site_2& p, Sign sgn,
-			    int j) const {
-    return finite_edge_interior(f, i, p.site(), sgn, j);
-  }
-
-  inline
-  bool infinite_edge_interior(const Storage_site_2& t2,
-			      const Storage_site_2& t3,
-			      const Storage_site_2& t4,
-			      const Storage_site_2& q, Sign sgn) const {
-    return
-      geom_traits().infinite_edge_interior_conflict_2_object()
-      (t2.site(), t3.site(), t4.site(), q.site(), sgn);
-  }
-
-  inline
-  bool infinite_edge_interior(const Face_handle& f, int i,
-			      const Storage_site_2& q, Sign sgn) const
-  {
-    return infinite_edge_interior(f, i, q, sgn);
-  }
-
-  inline
-  bool edge_interior(const Face_handle& f, int i,
-		     const Storage_site_2& t, Sign sgn) const {
-    return edge_interior(f, i, t.site(), sgn);
-  }
-
-  inline
-  bool edge_interior(const Edge& e,
-		     const Storage_site_2& t, Sign sgn) const {
-    return edge_interior(e.first, e.second, t, sgn);
-  }
-
-  inline Arrangement_type
-  arrangement_type(const Storage_site_2& t, const Vertex_handle& v) const {
-    if ( is_infinite(v) ) { return AT2::DISJOINT; }
-    return arrangement_type(t, v->storage_site());
-  }
-
-  inline
-  Arrangement_type arrangement_type(const Storage_site_2& p,
-				    const Storage_site_2& q) const {
-    return arrangement_type(p.site(), q.site());
-  }
-
-  inline
-  bool are_parallel(const Storage_site_2& p, const Storage_site_2& q) const {
-    return geom_traits().are_parallel_2_object()(p.site(), q.site());
-  }
-
-  inline Oriented_side
-  oriented_side(const Storage_site_2& s1, const Storage_site_2& s2,
-                const Storage_site_2& supp,
-		const Storage_site_2& p) const
-  {
-    CGAL_precondition( supp.is_segment() && p.is_point() );
-    return
-      geom_traits().oriented_side_2_object()(
-          s1.site(), s2.site(), supp.site(), p.site());
-  }
-
-  inline Oriented_side
-  oriented_side(const Storage_site_2& s1, const Storage_site_2& s2,
-		const Storage_site_2& s3, const Storage_site_2& supp,
-		const Storage_site_2& p) const {
-    CGAL_precondition( supp.is_segment() && p.is_point() );
-    return geom_traits().oriented_side_2_object()(s1.site(),
-						  s2.site(),
-						  s3.site(),
-						  supp.site(), p.site());
-  }
-
-
-  //-------
-
-  inline
-  bool same_points(const Site_2& p, const Site_2& q) const {
-    return geom_traits().equal_2_object()(p, q);
-  }
-
-  inline
-  bool same_segments(const Site_2& t, Vertex_handle v) const {
-    if ( is_infinite(v) ) { return false; }
-    if ( t.is_point() || v->site().is_point() ) { return false; }
-    return same_segments(t, v->site());
-  }
-
-  inline
-  bool same_segments(const Site_2& p, const Site_2& q) const {
-    CGAL_precondition( p.is_segment() && q.is_segment() );
-
-    return
-      (same_points(p.source_site(), q.source_site()) &&
-       same_points(p.target_site(), q.target_site())) ||
-      (same_points(p.source_site(), q.target_site()) &&
-       same_points(p.target_site(), q.source_site()));
-  }
-
-  inline
-  bool is_endpoint_of_segment(const Site_2& p, const Site_2& s) const
-  {
-    CGAL_precondition( p.is_point() && s.is_segment() );
-    return ( same_points(p, s.source_site()) ||
-	     same_points(p, s.target_site()) );
-  }
-
-  inline
-  bool is_degenerate_segment(const Site_2& s) const {
-    CGAL_precondition( s.is_segment() );
-    return same_points(s.source_site(), s.target_site());
-  }
-
-  // returns:
-  //   ON_POSITIVE_SIDE if q is closer to t1
-  //   ON_NEGATIVE_SIDE if q is closer to t2
-  //   ON_ORIENTED_BOUNDARY if q is on the bisector of t1 and t2
-  inline
-  Oriented_side side_of_bisector(const Site_2 &t1, const Site_2 &t2,
-				 const Site_2 &q) const {
-    return geom_traits().oriented_side_of_bisector_2_object()(t1, t2, q);
-  }
-
-  inline
-  Sign incircle(const Site_2 &t1, const Site_2 &t2,
-		const Site_2 &t3, const Site_2 &q) const {
-#ifdef CGAL_PROFILE_SDG_DUMP_INCIRCLE
-    typedef typename Geom_traits::FT  FT;
-    if ( !Algebraic_structure_traits<FT>::Is_exact::value ) {
-      std::ofstream ofs("incircle.cin", std::ios_base::app);
-      ofs.precision(16);
-      ofs << t1 << " ";
-      ofs << t2 << " ";
-      ofs << t3 << " ";
-      ofs <<  q << std::endl;
-      ofs.close();
-    }
-#endif
-    return geom_traits().vertex_conflict_2_object()(t1, t2, t3, q);
-  }
-
-  inline
-  Sign incircle(const Site_2 &t1, const Site_2 &t2,
-		const Site_2 &q) const {
-    return geom_traits().vertex_conflict_2_object()(t1, t2, q);
-  }
-
-  inline
-  Sign incircle(const Face_handle& f, const Site_2& q) const;
-
-  inline
-  Sign incircle(const Vertex_handle& v0, const Vertex_handle& v1,
-		const Vertex_handle& v) const {
-    CGAL_precondition( !is_infinite(v0) && !is_infinite(v1)
-		       && !is_infinite(v) );
-
-    return incircle( v0->site(), v1->site(), v->site());
-  }
-
-  Sign incircle(const Vertex_handle& v0, const Vertex_handle& v1,
-		const Vertex_handle& v2, const Vertex_handle& v) const;
-
-  inline
-  bool finite_edge_interior(const Site_2& t1, const Site_2& t2,
-			    const Site_2& t3, const Site_2& t4,
-			    const Site_2& q,  Sign sgn) const {
-    return
-      geom_traits().finite_edge_interior_conflict_2_object()
-      (t1,t2,t3,t4,q,sgn);
-  }
-
-  inline
-  bool finite_edge_interior(const Face_handle& f, int i,
-			    const Site_2& q, Sign sgn) const {
-    CGAL_precondition( !is_infinite(f) &&
-		       !is_infinite(f->neighbor(i)) );
-    return finite_edge_interior( f->vertex( ccw(i) )->site(),
-				 f->vertex(  cw(i) )->site(),
-				 f->vertex(     i  )->site(),
-				 this->_tds.mirror_vertex(f, i)->site(),
-				 q, sgn);
-  }
-
-  inline
-  bool finite_edge_interior(const Vertex_handle& v1, const Vertex_handle& v2,
-			    const Vertex_handle& v3, const Vertex_handle& v4,
-			    const Vertex_handle& v, Sign sgn) const {
-    CGAL_precondition( !is_infinite(v1) && !is_infinite(v2) &&
-		       !is_infinite(v3) && !is_infinite(v4) &&
-		       !is_infinite(v) );
-    return finite_edge_interior( v1->site(), v2->site(),
-				 v3->site(), v4->site(),
-				 v->site(), sgn);
-  }
-
-  inline
-  bool finite_edge_interior(const Site_2& t1, const Site_2& t2,
-			    const Site_2& t3, const Site_2& q,
-			    Sign sgn) const {
-    return
-    geom_traits().finite_edge_interior_conflict_2_object()(t1,t2,t3,q,sgn);
-  }
-
-  inline
-  bool finite_edge_interior(const Site_2& t1, const Site_2& t2,
-			    const Site_2& q,  Sign sgn) const {
-    return
-    geom_traits().finite_edge_interior_conflict_2_object()(t1,t2,q,sgn);
-  }
-
-  bool finite_edge_interior(const Face_handle& f, int i,
-			    const Site_2& p, Sign sgn, int) const;
-
-  bool finite_edge_interior(const Vertex_handle& v1, const Vertex_handle& v2,
-			    const Vertex_handle& v3, const Vertex_handle& v4,
-			    const Vertex_handle& v, Sign, int) const;
-
-  inline
-  bool infinite_edge_interior(const Site_2& t2, const Site_2& t3,
-			      const Site_2& t4, const Site_2& q,
-			      Sign sgn) const {
-    return
-      geom_traits().infinite_edge_interior_conflict_2_object()
-      (t2,t3,t4,q,sgn);
-  }
-
-
-  bool infinite_edge_interior(const Face_handle& f, int i,
-			      const Site_2& q, Sign sgn) const;
-
-  bool infinite_edge_interior(const Vertex_handle& v1,
-			      const Vertex_handle& v2,
-			      const Vertex_handle& v3,
-			      const Vertex_handle& v4,
-			      const Vertex_handle& v,
-			      Sign sgn) const;
-
-  bool edge_interior(const Face_handle& f, int i,
-		     const Site_2& t, Sign sgn) const;
-
-  bool edge_interior(const Edge& e,
-		     const Site_2& t, Sign sgn) const {
-    return edge_interior(e.first, e.second, t, sgn);
-  }
-
-  bool edge_interior(const Vertex_handle& v1,
-		     const Vertex_handle& v2,
-		     const Vertex_handle& v3,
-		     const Vertex_handle& v4,
-		     const Vertex_handle& v,
-		     Sign sgn) const;
-
-  inline Arrangement_type
-  arrangement_type(const Site_2& t, const Vertex_handle& v) const {
-    if ( is_infinite(v) ) { return AT2::DISJOINT; }
-    return arrangement_type(t, v->site());
-  }
-
-  Arrangement_type arrangement_type(const Site_2& p, const Site_2& q) const;
-
-  inline
-  bool are_parallel(const Site_2& p, const Site_2& q) const {
-    return geom_traits().are_parallel_2_object()(p, q);
-  }
-
-  inline Oriented_side
-  oriented_side(const Site_2& s1, const Site_2&s2,
-                const Site_2& supp, const Site_2& p) const
-  {
-    CGAL_precondition( supp.is_segment() && p.is_point() );
-    return geom_traits().oriented_side_2_object()(s1, s2, supp, p);
-  }
-
-  inline Oriented_side
-  oriented_side(const Site_2& s1, const Site_2& s2, const Site_2& s3,
-		const Site_2& supp, const Site_2& p) const {
-    CGAL_precondition( supp.is_segment() && p.is_point() );
-    return geom_traits().oriented_side_2_object()(s1, s2, s3, supp, p);
-  }
-
-  bool is_degenerate_edge(const Site_2& p1,
-			  const Site_2& p2,
-			  const Site_2& p3,
-			  const Site_2& p4) const {
-    return geom_traits().is_degenerate_edge_2_object()
-      (p1, p2, p3, p4);
-  }
-
-  bool is_degenerate_edge(const Vertex_handle& v1,
-			  const Vertex_handle& v2,
-			  const Vertex_handle& v3,
-			  const Vertex_handle& v4) const {
-    CGAL_precondition( !is_infinite(v1) && !is_infinite(v2) &&
-		       !is_infinite(v3) && !is_infinite(v4) );
-
-    return is_degenerate_edge(v1->site(), v2->site(),
-			      v3->site(), v4->site());
-  }
-
-  bool is_degenerate_edge(const Face_handle& f, int i) const {
-    Vertex_handle v1 = f->vertex( ccw(i) );
-    Vertex_handle v2 = f->vertex(  cw(i) );
-    Vertex_handle v3 = f->vertex(     i  );
-    Vertex_handle v4 = this->_tds.mirror_vertex(f, i);
-
-    return is_degenerate_edge(v1, v2, v3, v4);
-  }
-
-  bool is_degenerate_edge(const Edge& e) const {
-    return is_degenerate_edge(e.first, e.second);
-  }
-
-  Vertex_handle first_endpoint_of_segment(const Vertex_handle& v) const;
-  Vertex_handle second_endpoint_of_segment(const Vertex_handle& v) const;
-
-}; // Segment_Delaunay_graph_2
-
-
-template<class Gt, class D_S, class LTag>
-std::istream& operator>>(std::istream& is,
-			 Segment_Delaunay_graph_2<Gt,D_S,LTag>& sdg)
-{
-  sdg.file_input(is);
-  return is;
-}
-
-template<class Gt, class D_S, class LTag>
-std::ostream& operator<<(std::ostream& os,
-			 const Segment_Delaunay_graph_2<Gt,D_S,LTag>& sdg)
-{
-  sdg.file_output(os);
-  return os;
-}
-
-} //namespace CGAL
-
-
-#include <CGAL/Segment_Delaunay_graph_2/Segment_Delaunay_graph_2_impl.h>
-
-
-#endif // CGAL_SEGMENT_DELAUNAY_GRAPH_2_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Shape_detection_3/Efficient_RANSAC.h b/3rdparty/CGAL-4.8/include/CGAL/Shape_detection_3/Efficient_RANSAC.h
deleted file mode 100644
index 634ca2b..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Shape_detection_3/Efficient_RANSAC.h
+++ /dev/null
@@ -1,912 +0,0 @@
-// Copyright (c) 2015 INRIA Sophia-Antipolis (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
-// 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(s)     : Sven Oesau, Yannick Verdie, Clément Jamin, Pierre Alliez
-//
-
-#ifndef CGAL_SHAPE_DETECTION_3_EFFICIENT_RANSAC_H
-#define CGAL_SHAPE_DETECTION_3_EFFICIENT_RANSAC_H
-
-#include <CGAL/Shape_detection_3/Octree.h>
-#include <CGAL/Shape_detection_3/Shape_base.h>
-#include <CGAL/Random.h>
-
-//for octree ------------------------------
-#include <boost/iterator/filter_iterator.hpp>
-#include <CGAL/bounding_box.h>
-#include <CGAL/Iterator_range.h>
-//----------
-
-#include <vector>
-#include <cmath>
-#include <limits>
-#include <fstream>
-#include <sstream>
-
-//boost --------------
-#include <boost/iterator/counting_iterator.hpp>
-#include <boost/shared_ptr.hpp>
-#include <boost/make_shared.hpp>
-//---------------------
-
-
-/*! 
-  \file Efficient_RANSAC.h
-*/
-
-namespace CGAL {
-  namespace Shape_detection_3 {
-
-/*!
-\ingroup PkgPointSetShapeDetection3
-\brief A shape detection algorithm using a RANSAC method.
-
-Given a point set in 3D space with unoriented normals, sampled on surfaces,
-this class enables to detect subsets of connected points lying on the surface of primitive shapes.
-Each input point is assigned to either none or at most one detected primitive
-shape. The implementation follows \cgalCite{schnabel2007efficient}.
-
-\tparam Traits a model of `EfficientRANSACTraits`
-
-*/
-  template <class Traits>
-  class Efficient_RANSAC {
-  public:
-
-    /// \cond SKIP_IN_MANUAL
-    struct Filter_unassigned_points {
-      Filter_unassigned_points() : m_shape_index(dummy) {}
-      Filter_unassigned_points(const std::vector<int> &shapeIndex)
-        : m_shape_index(shapeIndex) {}
-
-      bool operator()(std::size_t x) {
-        if (x < m_shape_index.size())
-          return m_shape_index[x] == -1;
-        else return true; // to prevent infinite incrementing
-      }
-      const std::vector<int>&  m_shape_index;
-      std::vector<int> dummy;
-    };
-
-    typedef boost::filter_iterator<Filter_unassigned_points,
-      boost::counting_iterator<std::size_t> > Point_index_iterator;
-    ///< iterator for indices of points.
-    /// \endcond
-
-    /// \name Types 
-    /// @{
-    /// \cond SKIP_IN_MANUAL
-    typedef typename Traits::Input_range::iterator Input_iterator;
-    typedef typename Traits::FT FT; ///< number type.
-    typedef typename Traits::Point_3 Point; ///< point type.
-    typedef typename Traits::Vector_3 Vector; ///< vector type.
-    /// \endcond
-
-    typedef typename Traits::Input_range Input_range;
-    ///< Model of the concept `Range` with random access iterators, providing input points and normals
-    /// through the following two property maps.
-
-    typedef typename Traits::Point_map Point_map;
-    ///< property map to access the location of an input point.
-    typedef typename Traits::Normal_map Normal_map;
-    ///< property map to access the unoriented normal of an input point
-    typedef Shape_base<Traits> Shape; ///< shape type.
-
-#ifdef DOXYGEN_RUNNING
-    typedef unspecified_type Shape_range;
-#else
-    struct Shape_range : public Iterator_range<
-      typename std::vector<boost::shared_ptr<Shape> >::const_iterator> {
-      typedef Iterator_range<
-        typename std::vector<boost::shared_ptr<Shape> >::const_iterator> Base;
-
-      Shape_range(boost::shared_ptr<std::vector<boost::shared_ptr<Shape> > >
-        extracted_shapes) : Base(make_range(extracted_shapes->begin(),
-        extracted_shapes->end())), m_extracted_shapes(extracted_shapes) {}
-    private:
-      boost::shared_ptr<std::vector<boost::shared_ptr<Shape> > >
-        m_extracted_shapes; // keeps a reference to the shape vector
-    };
-#endif
-    ///< An `Iterator_range` with a bidirectional constant iterator type with value type `boost::shared_ptr<Shape>`.
-
-
-#ifdef DOXYGEN_RUNNING
-    typedef unspecified_type Point_index_range;
-    ///< An `Iterator_range` with a bidirectional iterator with value type `std::size_t`
-    ///  as indices into the input data that has not been assigned to a shape.
-    ///  As this range class has no `size()` method, the method 
-    ///  `Efficient_RANSAC::number_of_unassigned_points()` is provided.
-#else 
-    typedef Iterator_range<Point_index_iterator>
-      Point_index_range;
-#endif     
-
-    /// @}
-    
-    /// \name Parameters 
-    /// @{
-      /*!
-       %Parameters for the shape detection algorithm. They are explained in detail 
-       in Section \ref Point_set_shape_detection_3Parameters  of the User Manual.
-       */
-    struct Parameters {
-      Parameters()
-        : probability((FT) 0.01)
-        , min_points((std::numeric_limits<std::size_t>::max)())
-        , epsilon(-1)
-        , normal_threshold((FT) 0.9)
-        , cluster_epsilon(-1)
-      {}
-
-      FT probability;         ///< Probability to control search endurance. %Default value: 5%.
-      std::size_t min_points; ///< Minimum number of points of a shape. %Default value: 1% of total number of input points.
-      FT epsilon;             ///< Maximum tolerance Euclidian distance from a point and a shape. %Default value: 1% of bounding box diagonal.
-      FT normal_threshold;	  ///< Maximum tolerance normal deviation from a point's normal to the normal on shape at projected point. %Default value: 0.9 (around 25 degrees).
-      FT cluster_epsilon;	    ///< Maximum distance between points to be considered connected. %Default value: 1% of bounding box diagonal.
-    };
-    /// @}
-
-  private:
-    typedef internal::Octree<internal::DirectPointAccessor<Traits> >
-      Direct_octree;
-    typedef internal::Octree<internal::IndexedPointAccessor<Traits> >
-      Indexed_octree;
-    //--------------------------------------------typedef
-
-    // Creates a function pointer for instancing shape instances.
-    template <class ShapeT>
-    static Shape *factory() {
-      return new ShapeT;
-    }
-
-  public:
-
-  /// \name Initialization
-  /// @{
-
-    /*! 
-      Constructs an empty shape detection engine.
-    */ 
-    Efficient_RANSAC(Traits t = Traits())
-      : m_traits(t)
-      , m_direct_octrees(NULL)
-      , m_global_octree(NULL)
-      , m_num_subsets(0)
-      , m_num_available_points(0)
-      , m_num_total_points(0)
-      , m_valid_iterators(false)
-    {}
-
-    /*! 
-      Releases all memory allocated by this instances including shapes.
-    */ 
-    ~Efficient_RANSAC() {
-      clear();
-    }
-
-    /*!
-      Retrieves the traits class.
-     */
-    const Traits&
-    traits() const
-    {
-      return m_traits;
-    }
-
-    /*!
-      Sets the input data. The range must stay valid
-      until the detection has been performed and the access to the
-      results is no longer required. The data in the input is reordered by the methods
-      `detect()` and `preprocess()`. This function first calls `clear()`.
-    */
-    void set_input(
-      Input_range& input_range,
-      ///< range of input data.
-      Point_map point_map = Point_map(),
-      ///< property map to access the position of an input point.
-      Normal_map normal_map = Normal_map()
-      ///< property map to access the normal of an input point.
-      ) {
-        m_point_pmap = point_map;
-        m_normal_pmap = normal_map;
-
-        m_input_iterator_first = input_range.begin();
-        m_input_iterator_beyond = input_range.end();
-
-        clear();
-
-        m_extracted_shapes = 
-          boost::make_shared<std::vector<boost::shared_ptr<Shape> > >();
-
-        m_num_available_points = m_num_total_points = std::distance(
-          m_input_iterator_first, m_input_iterator_beyond);
-
-        m_valid_iterators = true;
-    }
-    /*!
-      Registers in the detection engine the shape type `ShapeType` that must inherit from `Shape_base`.
-      For example, for registering a plane as detectable shape you should call
-      `ransac.add_shape_factory< Shape_detection_3::Plane<Traits> >();`. Note
-      that if your call is within a template, you should add the `template`
-      keyword just before `add_shape_factory`: 
-      `ransac.template add_shape_factory< Shape_detection_3::Plane<Traits> >();`.
-    */ 
-    template <class Shape_type>
-    void add_shape_factory() {
-      m_shape_factories.push_back(factory<Shape_type>);
-    }
-
-    /*!
-      Constructs internal data structures required for the shape detection.
-      These structures only depend on the input data, i.e. the points and
-      normal vectors. This method is called by `detect()`, if it was not called
-      before by the user.
-    */ 
-    bool preprocess() {
-      if (m_num_total_points == 0)
-        return false;
-
-      // Generation of subsets
-      m_num_subsets = (std::size_t)(std::max<std::ptrdiff_t>)((std::ptrdiff_t)
-        std::floor(std::log(double(m_num_total_points))/std::log(2.))-9, 2);
-
-      // SUBSET GENERATION ->
-      // approach with increasing subset sizes -> replace with octree later on
-      Input_iterator last = m_input_iterator_beyond - 1;
-      std::size_t remainingPoints = m_num_total_points;
-
-      m_available_octree_sizes.resize(m_num_subsets);
-      m_direct_octrees = new Direct_octree *[m_num_subsets];
-      for (int s = int(m_num_subsets) - 1;s >= 0;--s) {
-        std::size_t subsetSize = remainingPoints;
-        std::vector<std::size_t> indices(subsetSize);
-        if (s) {
-          subsetSize >>= 1;
-          for (std::size_t i = 0;i<subsetSize;i++) {
-            std::size_t index = default_random(2);
-            index = index + (i<<1);
-            index = (index >= remainingPoints) ? remainingPoints - 1 : index;
-            indices[i] = index;
-          }
-
-          // move points to the end of the point vector
-          std::size_t j = subsetSize;
-          do {
-            j--;
-            typename std::iterator_traits<Input_iterator>::value_type
-              tmp = (*last);
-            *last = m_input_iterator_first[indices[std::size_t(j)]];
-            m_input_iterator_first[indices[std::size_t(j)]] = tmp;
-            last--;
-          } while (j > 0);
-          m_direct_octrees[s] = new Direct_octree(
-            m_traits, last + 1,
-            last + subsetSize + 1,
-            m_point_pmap, m_normal_pmap,
-            remainingPoints - subsetSize);
-        }
-        else
-          m_direct_octrees[0] = new Direct_octree(
-            m_traits, m_input_iterator_first,
-            m_input_iterator_first + (subsetSize),
-            m_point_pmap, m_normal_pmap,
-          0);
-
-        m_available_octree_sizes[s] = subsetSize;
-        m_direct_octrees[s]->createTree();
-
-        remainingPoints -= subsetSize;
-      }
-
-      m_global_octree = new Indexed_octree(
-        m_traits, m_input_iterator_first, m_input_iterator_beyond,
-        m_point_pmap, m_normal_pmap);
-      m_global_octree->createTree();
-
-      return true;
-    }
-
-    /// @}
-
-    /// \name Memory Management
-    /// @{
-    /*!
-      Removes all shape types registered for detection.
-     */ 
-    void clear_shape_factories() {
-      m_shape_factories.clear();
-    }
-
-    /*!
-      Frees memory allocated for the internal search structures but keeps the detected shapes.
-      It invalidates the range retrieved using `unassigned_points()`.
-     */ 
-    void clear_octrees() {
-      // If there is no data yet, there are no data structures.
-      if (!m_valid_iterators)
-        return;
-
-      if (m_global_octree) {
-        delete m_global_octree;
-        m_global_octree = NULL;
-      }
-
-      if (m_direct_octrees) {
-        for (std::size_t i = 0;i<m_num_subsets;i++) 
-          delete m_direct_octrees[i];
-        delete [] m_direct_octrees;
-
-        m_direct_octrees = NULL;
-      }
-
-      m_num_subsets = 0;
-    }
-
-    /*!
-      Calls `clear_octrees()` and removes all detected shapes.
-      All internal structures are cleaned, including formerly detected shapes.
-      Thus iterators and ranges retrieved through `shapes()` and `indices_of_unassigned_points()` 
-      are invalidated.
-    */ 
-    void clear() {
-      // If there is no data yet, there are no data structures.
-      if (!m_valid_iterators)
-        return;
-
-      std::vector<int>().swap(m_shape_index);
-
-      m_extracted_shapes = 
-        boost::make_shared<std::vector<boost::shared_ptr<Shape> > >();
-      
-      m_num_available_points = m_num_total_points;
-
-      clear_octrees();
-    }
-    /// @}
-
-    /// \name Detection 
-    /// @{
-    /*! 
-      Performs the shape detection. Shape types considered during the detection
-      are those registered using `add_shape_factory()`.
-
-      \return `true` if shape types have been registered and
-              input data has been set. Otherwise, `false` is returned.
-    */ 
-    bool detect(
-      const Parameters &options = Parameters()
-      ///< %Parameters for shape detection.
-                ) {
-      // No shape types for detection or no points provided, exit
-      if (m_shape_factories.size() == 0 ||
-          (m_input_iterator_beyond - m_input_iterator_first) == 0)
-        return false;
-
-      if (m_num_subsets == 0 || m_global_octree == 0) {
-        if (!preprocess())
-          return false;
-      }
-
-      // Reset data structures possibly used by former search
-      m_extracted_shapes = 
-        boost::make_shared<std::vector<boost::shared_ptr<Shape> > >();
-      m_num_available_points = m_num_total_points;
-
-      for (std::size_t i = 0;i<m_num_subsets;i++) {
-        m_available_octree_sizes[i] = m_direct_octrees[i]->size();
-      }
-
-      // Use bounding box diagonal as reference for default values
-      Bbox_3 bbox = m_global_octree->boundingBox();
-      FT bbox_diagonal = (FT) CGAL::sqrt(
-          (bbox.xmax() - bbox.xmin()) * (bbox.xmax() - bbox.xmin())
-        + (bbox.ymax() - bbox.ymin()) * (bbox.ymax() - bbox.ymin()) 
-        + (bbox.zmax() - bbox.zmin()) * (bbox.zmax() - bbox.zmin()));
-
-      m_options = options;
-
-      // Epsilon or cluster_epsilon have been set by the user?
-      // If not, derive from bounding box diagonal
-      m_options.epsilon = (m_options.epsilon < 0)
-        ? bbox_diagonal * (FT) 0.01 : m_options.epsilon;
-
-      m_options.cluster_epsilon = (m_options.cluster_epsilon < 0) 
-        ? bbox_diagonal * (FT) 0.01 : m_options.cluster_epsilon;
-
-      // Minimum number of points has been set?
-      m_options.min_points = 
-        (m_options.min_points >= m_num_available_points) ? 
-          (std::size_t)((FT)0.01 * m_num_available_points) : 
-          m_options.min_points;
-      m_options.min_points = (m_options.min_points < 10) ? 10 : m_options.min_points;
-      
-      // Initializing the shape index
-      m_shape_index.assign(m_num_available_points, -1);
-
-      // List of all randomly drawn candidates
-      // with the minimum number of points
-      std::vector<Shape *> candidates;
-
-      // Identifying minimum number of samples
-      std::size_t required_samples = 0;
-      for (std::size_t i = 0;i<m_shape_factories.size();i++) {
-        Shape *tmp = (Shape *) m_shape_factories[i]();
-        required_samples = (std::max<std::size_t>)(required_samples, tmp->minimum_sample_size());
-        delete tmp;
-      }
-
-      std::size_t first_sample; // first sample for RANSAC
-
-      FT best_expected = 0;
-
-      // number of points that have been assigned to a shape
-      std::size_t num_invalid = 0;
-
-      std::size_t generated_candidates = 0;
-      std::size_t failed_candidates = 0;
-      bool force_exit = false;
-      bool keep_searching = true;
-      
-      do { // main loop
-        best_expected = 0;
-
-        if (keep_searching)
-          do {
-            // Generate candidates
-            //1. pick a point p1 randomly among available points
-            std::set<std::size_t> indices;
-            bool done = false;
-            do {
-              do 
-              first_sample = default_random(m_num_available_points);
-              while (m_shape_index[first_sample] != -1);
-
-              done = m_global_octree->drawSamplesFromCellContainingPoint(
-                get(m_point_pmap, 
-                *(m_input_iterator_first + first_sample)),
-                select_random_octree_level(),
-                indices,
-                m_shape_index,
-                required_samples);
-
-            } while (m_shape_index[first_sample] != -1 || !done);
-
-            generated_candidates++;
-
-            //add candidate for each type of primitives
-            for(typename std::vector<Shape *(*)()>::iterator it =
-              m_shape_factories.begin(); it != m_shape_factories.end(); it++)	{
-                Shape *p = (Shape *) (*it)();
-                //compute the primitive and says if the candidate is valid
-                p->compute(indices,
-                  m_input_iterator_first,
-                  m_traits,
-                  m_point_pmap,
-                  m_normal_pmap,
-                  m_options.epsilon, 
-                  m_options.normal_threshold);
-
-                if (p->is_valid()) {
-                  improve_bound(p, m_num_available_points - num_invalid, 1, 500);
-
-                  //evaluate the candidate
-                  if(p->max_bound() >= m_options.min_points && p->score() > 0) {
-                    if (best_expected < p->expected_value())
-                      best_expected = p->expected_value();
-
-                    candidates.push_back(p);
-                  }
-                  else {
-                    failed_candidates++;
-                    delete p;
-                  }        
-                }
-                else {
-                  failed_candidates++;
-                  delete p;
-                }
-            }
-
-            if (failed_candidates >= 10000)
-              force_exit = true;
-            
-            keep_searching = (stop_probability(m_options.min_points,
-              m_num_available_points - num_invalid, 
-              generated_candidates, m_global_octree->maxLevel())
-                    > m_options.probability);
-        } while( !force_exit
-          && stop_probability((std::size_t) best_expected,
-                             m_num_available_points - num_invalid, 
-                             generated_candidates,
-                             m_global_octree->maxLevel()) 
-                > m_options.probability
-          && keep_searching);
-        // end of generate candidate
-
-        if (force_exit) {
-          break;
-        }
-
-        if (candidates.empty())
-          continue;
-
-        // Now get the best candidate in the current set of all candidates
-        // Note that the function sorts the candidates:
-        //  the best candidate is always the last element of the vector
-        
-        Shape *best_candidate = 
-          get_best_candidate(candidates, m_num_available_points - num_invalid);
-
-        // If search is done and the best candidate is too small, we are done.
-        if (!keep_searching && best_candidate->m_score < m_options.min_points)
-          break;
-
-        if (!best_candidate)
-          continue;
-
-        best_candidate->m_indices.clear();
-
-        best_candidate->m_score = 
-          m_global_octree->score(best_candidate,
-                                 m_shape_index,
-                                 FT(3) * m_options.epsilon,
-                                 m_options.normal_threshold);
-
-        best_expected = static_cast<FT>(best_candidate->m_score);
-
-        best_candidate->connected_component(best_candidate->m_indices,
-                                            m_options.cluster_epsilon);
-        
-        // check score against min_points and clear out candidates if too low
-        if (best_candidate->indices_of_assigned_points().size() <
-          m_options.min_points) 
-        {
-          for (std::size_t i = 0;i < candidates.size() - 1;i++) {
-            if (best_candidate->is_same(candidates[i])) {
-              delete candidates[i];
-              candidates[i] = NULL;
-            }
-          }
-
-          candidates.back() = NULL;
-          delete best_candidate;
-          best_candidate = NULL;
-
-          // Trimming candidates list
-          std::size_t empty = 0, occupied = 0;
-          while (empty < candidates.size()) {
-            while (empty < candidates.size() && candidates[empty]) empty++;
-
-            if (empty >= candidates.size())
-              break;
-
-            if (occupied < empty)
-              occupied = empty + 1;
-
-            while (occupied < candidates.size() && !candidates[occupied])
-              occupied++;
-
-            if (occupied >= candidates.size())
-              break;
-            candidates[empty] = candidates[occupied];
-            candidates[occupied] = NULL;
-            empty++;
-            occupied++;
-          }
-
-          candidates.resize(empty);
-        }
-        else
-          if (stop_probability((std::size_t) best_candidate->expected_value(),
-                            (m_num_available_points - num_invalid),
-                            generated_candidates,
-                            m_global_octree->maxLevel())
-                <= m_options.probability) {
-
-            // Remove candidate from list
-            candidates.back() = NULL;
-
-            //1. add best candidate to final result.
-            m_extracted_shapes->push_back(
-                                    boost::shared_ptr<Shape>(best_candidate));
-
-            //2. remove the points
-            const std::vector<std::size_t> &indices_points_best_candidate =
-              best_candidate->indices_of_assigned_points();
-
-            for (std::size_t i = 0;i<indices_points_best_candidate.size();i++) {
-              m_shape_index[indices_points_best_candidate.at(i)] =
-                int(m_extracted_shapes->size()) - 1;
-
-              num_invalid++;
-              
-              for (std::size_t j = 0;j<m_num_subsets;j++) {
-                if (m_direct_octrees[j] && m_direct_octrees[j]->m_root) {
-                  std::size_t offset = m_direct_octrees[j]->offset();
-
-                  if (offset <= indices_points_best_candidate.at(i) &&
-                      (indices_points_best_candidate.at(i) - offset) 
-                      < m_direct_octrees[j]->size()) {
-                    m_available_octree_sizes[j]--;
-                  }
-                }
-              }
-            }
-
-            //2.3 Remove the points from the subtrees        
-
-            generated_candidates--;
-            failed_candidates = 0;
-            best_expected = 0;
-
-            std::vector<std::size_t> subset_sizes(m_num_subsets);
-            subset_sizes[0] = m_available_octree_sizes[0];
-            for (std::size_t i = 1;i<m_num_subsets;i++) {
-              subset_sizes[i] = subset_sizes[i-1] + m_available_octree_sizes[i];
-            }
-  
-  
-            //3. Remove points from candidates common with extracted primitive
-            //#pragma omp parallel for
-            best_expected = 0;
-            for (std::size_t i=0;i< candidates.size()-1;i++) {
-              if (candidates[i]) {
-                candidates[i]->update_points(m_shape_index);
-                candidates[i]->compute_bound(
-                  subset_sizes[candidates[i]->m_nb_subset_used - 1],
-                  m_num_available_points - num_invalid);
-  
-                if (candidates[i]->max_bound() < m_options.min_points) {
-                  delete candidates[i];
-                  candidates[i] = NULL;
-                }
-                else {
-                  best_expected = (candidates[i]->expected_value() > best_expected) ?
-                    candidates[i]->expected_value() : best_expected;
-                }
-              }
-            }
-  
-            std::size_t start = 0, end = candidates.size() - 1;
-            while (start < end) {
-              while (candidates[start] && start < end) start++;
-              while (!candidates[end] && start < end) end--;
-              if (!candidates[start] && candidates[end] && start < end) {
-                candidates[start] = candidates[end];
-                candidates[end] = NULL;
-                start++;
-                end--;
-              }
-            }
-  
-            if (candidates[end]) end++;
-  
-            candidates.resize(end);
-          }
-        keep_searching = (stop_probability(m_options.min_points,
-            m_num_available_points - num_invalid,
-            generated_candidates, 
-            m_global_octree->maxLevel())
-              > m_options.probability);
-      }
-      while((keep_searching
-        && FT(m_num_available_points - num_invalid) >= m_options.min_points)
-        || best_expected >= m_options.min_points);
-
-      // Clean up remaining candidates.
-      for (std::size_t i = 0;i<candidates.size();i++)
-        delete candidates[i];
-
-      candidates.resize(0);
-
-      m_num_available_points -= num_invalid;
- 
-      return true;
-    }
-
-    /// @}
-
-    /// \name Access
-    /// @{            
-    /*!
-      Returns an `Iterator_range` with a bidirectional iterator with value type
-      `boost::shared_ptr<Shape>` over the detected shapes in the order of detection.
-      Depending on the chosen probability
-      for the detection, the shapes are ordered with decreasing size.
-    */
-    Shape_range shapes() const {
-      return Shape_range(m_extracted_shapes);
-    }
-      
-    /*! 
-      Number of points not assigned to a shape.
-    */ 
-    std::size_t number_of_unassigned_points() {
-      return m_num_available_points;
-    }
-    
-    /*! 
-      Returns an `Iterator_range` with a bidirectional iterator with value type `std::size_t`
-      as indices into the input data that has not been assigned to a shape. 
-    */ 
-    Point_index_range indices_of_unassigned_points() {
-      Filter_unassigned_points fup(m_shape_index);
-
-      Point_index_iterator p1 =
-        boost::make_filter_iterator<Filter_unassigned_points>(
-        fup,
-        boost::counting_iterator<std::size_t>(0),
-        boost::counting_iterator<std::size_t>(m_shape_index.size()));
-
-      return make_range(p1, Point_index_iterator(p1.end()));
-    }
-    /// @}
-
-  private:
-    int select_random_octree_level() {
-      return (int) default_random(m_global_octree->maxLevel() + 1);
-    }
-
-    Shape* get_best_candidate(std::vector<Shape* >& candidates,
-                            const std::size_t num_available_points) {
-      if (candidates.size() == 1)
-        return candidates.back();
-
-      int index_worse_candidate = 0;
-      bool improved = true;
-
-      while (index_worse_candidate < (int)candidates.size() - 1 && improved) {
-        improved = false;
-
-        typename Shape::Compare_by_max_bound comp;
-
-        std::sort(candidates.begin() + index_worse_candidate,
-                  candidates.end(),
-                  comp);
-
-        //refine the best one 
-        improve_bound(candidates.back(),
-                     num_available_points, m_num_subsets,
-                     m_options.min_points);
-
-        int position_stop;
-
-        //Take all those intersecting the best one, check for equal ones
-        for (position_stop = int(candidates.size()) - 1;
-             position_stop > index_worse_candidate;
-             position_stop--) {
-          if (candidates.back()->min_bound() >
-            candidates.at(position_stop)->max_bound())
-            break;//the intervals do not overlaps anymore
-
-          if (candidates.at(position_stop)->max_bound()
-              <= m_options.min_points)
-            break;  //the following candidate doesnt have enough points!
-
-          //if we reach this point, there is an overlap
-          //  between best one and position_stop
-          //so request refining bound on position_stop
-          improved |= improve_bound(candidates.at(position_stop),
-                                   num_available_points,
-                                   m_num_subsets,
-                                   m_options.min_points);
-
-          //test again after refined
-          if (candidates.back()->min_bound() >
-            candidates.at(position_stop)->max_bound()) 
-            break;//the intervals do not overlaps anymore
-        }
-
-        index_worse_candidate = position_stop;
-      }
-
-      return candidates.back();
-    }
-
-    bool improve_bound(Shape *candidate,
-                      std::size_t num_available_points,
-                      std::size_t max_subset,
-                      std::size_t min_points) {
-      if (candidate->m_nb_subset_used >= max_subset)
-        return false;
-
-      if (candidate->m_nb_subset_used >= m_num_subsets)
-        return false;
-
-      candidate->m_nb_subset_used =
-        (candidate->m_nb_subset_used >= m_num_subsets) ? 
-        m_num_subsets - 1 : candidate->m_nb_subset_used;
-
-      //what it does is add another subset and recompute lower and upper bound
-      //the next subset to include is provided by m_nb_subset_used
-
-      std::size_t num_points_evaluated = 0;
-      for (std::size_t i=0;i<candidate->m_nb_subset_used;i++)
-        num_points_evaluated += m_available_octree_sizes[i];
-
-      // need score of new subset as well as sum of
-      // the score of the previous considered subset
-      std::size_t new_score = 0;
-      std::size_t new_sampled_points = 0;
-
-      do {
-        new_score = m_direct_octrees[candidate->m_nb_subset_used]->score(
-          candidate, 
-          m_shape_index, 
-          m_options.epsilon,
-          m_options.normal_threshold);
-
-        candidate->m_score += new_score;
-        
-        num_points_evaluated += 
-          m_available_octree_sizes[candidate->m_nb_subset_used];
-
-        new_sampled_points +=
-          m_available_octree_sizes[candidate->m_nb_subset_used];
-
-        candidate->m_nb_subset_used++;
-      } while (new_sampled_points < min_points &&
-        candidate->m_nb_subset_used < m_num_subsets);
-
-      candidate->m_score = candidate->m_indices.size();
-
-      candidate->compute_bound(num_points_evaluated, num_available_points);
-
-      return true;
-    }
-    
-    inline FT stop_probability(std::size_t largest_candidate, std::size_t num_pts, std::size_t num_candidates, std::size_t octree_depth) const {
-      return (std::min<FT>)(std::pow((FT) 1.f - (FT) largest_candidate / FT(num_pts * octree_depth * 4), (int) num_candidates), (FT) 1);
-    }
-    
-  private:
-    Parameters m_options;
-
-    // Traits class.
-    Traits m_traits;
-
-    // Octrees build on input data for quick shape evaluation and
-    // sample selection within an octree cell.
-    Direct_octree **m_direct_octrees;
-    Indexed_octree *m_global_octree;
-    std::vector<std::size_t> m_available_octree_sizes;
-    std::size_t m_num_subsets;
-
-    // maps index into points to assigned extracted primitive
-    std::vector<int> m_shape_index;
-    std::size_t m_num_available_points; 
-    std::size_t m_num_total_points;
-
-    //give the index of the subset of point i
-    std::vector<int> m_index_subsets;
-
-    boost::shared_ptr<std::vector<boost::shared_ptr<Shape> > > m_extracted_shapes;
-
-    std::vector<Shape *(*)()> m_shape_factories;
-
-    // iterators of input data
-    bool m_valid_iterators;
-    Input_iterator m_input_iterator_first, m_input_iterator_beyond; 
-    Point_map m_point_pmap;
-    Normal_map m_normal_pmap;
-  };
-}
-}
-
-#endif // CGAL_SHAPE_DETECTION_3_EFFICIENT_RANSAC_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Shape_detection_3/Octree.h b/3rdparty/CGAL-4.8/include/CGAL/Shape_detection_3/Octree.h
deleted file mode 100644
index 4f95926..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Shape_detection_3/Octree.h
+++ /dev/null
@@ -1,727 +0,0 @@
-// Copyright (c) 2015 INRIA Sophia-Antipolis (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
-// 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(s)     : Sven Oesau, Yannick Verdie, Clément Jamin, Pierre Alliez
-//
-
-#ifndef CGAL_SHAPE_DETECTION_3_OCTREE_H
-#define CGAL_SHAPE_DETECTION_3_OCTREE_H
-
-#include <limits>
-#include <stack>
-
-#include <CGAL/Random.h>
-#include <CGAL/Bbox_3.h>
-#include <CGAL/Shape_detection_3/Shape_base.h>
-
-
-extern int scoreTime;
-
-namespace CGAL {
-  namespace Shape_detection_3 {
-  
-    template<class Traits> 
-    class Efficient_RANSAC;
-    
-  namespace internal {
-
-    const std::size_t size_t_max = (std::numeric_limits<std::size_t>::max)();
-  
-    template<class Sdt>
-    class DirectPointAccessor {
-    public:
-      typedef Sdt Sd_traits;
-      typedef typename Sd_traits::Input_range::iterator Input_iterator;
-
-      DirectPointAccessor() {}
-      DirectPointAccessor(const Input_iterator &begin,
-                          const Input_iterator &beyond, 
-                          std::size_t offset) : m_first(begin), m_offset(offset) {
-        m_beyond = (beyond == begin) ? begin : beyond - 1;
-      }
-
-      Input_iterator at(std::size_t i) {
-        return m_first + i;
-      }
-
-      std::size_t index(std::size_t i) {
-        return i + m_offset;
-      }
-
-      std::size_t offset() {
-        return m_offset;
-      }
-
-      std::size_t size() {
-        return m_beyond - m_first + 1;
-      }
-
-      Input_iterator first() {
-        return m_first;
-      }
-
-      Input_iterator beyond() {
-        return m_beyond;
-      }
-
-      void setData(Input_iterator &begin, Input_iterator &beyond) {
-        m_beyond = (beyond == begin) ? begin : beyond - 1;
-      }
-
-      void swap(std::size_t a, std::size_t b) {
-        typename std::iterator_traits<Input_iterator>::value_type tmp;
-        tmp = m_first[a];
-        m_first[a] = m_first[b];
-        m_first[b] = tmp;
-      }
-
-    protected:
-      Input_iterator m_first;
-
-    private:
-      Input_iterator m_beyond;
-      std::size_t m_offset;
-    };
-
-    template<class Sdt>
-    class IndexedPointAccessor {
-    public:
-      typedef Sdt Sd_traits;
-      typedef typename Sd_traits::Input_range::iterator Input_iterator;
-
-      IndexedPointAccessor() {}
-      IndexedPointAccessor(const Input_iterator &begin,
-                           const Input_iterator &beyond, std::size_t)
-                           : m_first(begin) {
-        m_beyond = (beyond == begin) ? begin : beyond - 1;
-        m_indices.resize(size());
-        for (std::size_t i = 0;i<size();i++)
-          m_indices[i] = i;
-      }
-
-      Input_iterator at(std::size_t i) {
-        return m_first + m_indices[i];
-      }
-
-      std::size_t index(std::size_t i) {
-        return m_indices[i];
-      }
-
-      std::size_t offset() {
-        return 0;
-      }
-
-      Input_iterator first() {
-        return m_first;
-      }
-
-      Input_iterator beyond() {
-        return m_beyond;
-      }
-
-      void setData(Input_iterator &begin, Input_iterator &beyond) {
-        m_beyond = (beyond == begin) ? begin : beyond - 1;
-        m_indices.resize(size());
-        for (std::size_t i = 0;i<size();i++)
-          m_indices[i] = i;
-      }
-
-      std::size_t size() {
-        return m_beyond - m_first + 1;
-      }
-
-      void swap(std::size_t a, std::size_t b) {
-        std::size_t tmp = m_indices[a];
-        m_indices[a] = m_indices[b];
-        m_indices[b] = tmp;
-      }
-
-    protected:
-      Input_iterator m_first;
-
-    private:
-      std::vector<std::size_t> m_indices;
-      Input_iterator m_beyond;
-    };
-
-    template<class PointAccessor>
-    class Octree : public PointAccessor {
-
-      typedef typename PointAccessor::Sd_traits Sd_traits;
-      typedef typename Sd_traits::Input_range::iterator Input_iterator;
-      typedef Shape_base<Sd_traits> Shape;
-      typedef typename Sd_traits::Point_3 Point_3;
-      typedef typename Sd_traits::Vector_3 Vector_3;
-      typedef typename Sd_traits::FT FT;
-      typedef typename Sd_traits::Point_map Point_map;
-      typedef typename Sd_traits::Normal_map Normal_map;
-
-      template<class Sd_traits>
-        friend class ::CGAL::Shape_detection_3::Efficient_RANSAC;
-
-      struct Cell {
-        std::size_t first, last;
-        Cell *child[8];
-        Point_3 center;
-        std::size_t level;
-
-        Cell(std::size_t first, std::size_t last, Point_3 center, std::size_t level)
-          : first(first), last(last), center(center), level(level) {
-            memset(child, 0, sizeof(Cell *) * 8);
-        }
-
-        bool isLeaf() const {
-          for (std::size_t i = 0;i<8;i++) {
-            if (child[i])
-              return false;
-          }
-          return true;
-        }
-
-        std::size_t size() const {
-          if (first == size_t_max || last == size_t_max)
-            return 0;
-          else return (last - first + 1);
-        }
-      };
-
-      // --------------------------------------------------------------------------
-      // Utilities
-      // --------------------------------------------------------------------------
-      FT get_x(const Vector_3& v){ return m_traits.compute_x_3_object()(v); }
-      FT get_y(const Vector_3& v){ return m_traits.compute_y_3_object()(v); }
-      FT get_z(const Vector_3& v){ return m_traits.compute_z_3_object()(v); }
-      FT get_x(const Point_3& p){ return m_traits.compute_x_3_object()(p); }
-      FT get_y(const Point_3& p){ return m_traits.compute_y_3_object()(p); }
-      FT get_z(const Point_3& p){ return m_traits.compute_z_3_object()(p); }
-      FT get_coord(const Point_3& p, unsigned int d)
-      {
-        CGAL_assertion(d >= 0 && d < 3);
-        switch (d)
-        {
-          case 0: return get_x(p);
-          case 1: return get_y(p);
-          case 2: return get_z(p);
-          default: return FT(0);
-        }
-      }
-
-      Point_3 constr_pt(FT x, FT y, FT z) const
-      { return m_traits.construct_point_3_object()(x, y, z); }
-      Vector_3 constr_vec(const Point_3& p, const Point_3& q) const
-      { return m_traits.construct_vector_3_object()(p, q); }
-
-      Point_3 transl(const Point_3& p, const Vector_3 &v)
-      { return m_traits.construct_translated_point_3_object()(p, v); }
-        
-    public:
-      Octree(Sd_traits const& traits) 
-        : m_traits(traits), m_bucket_size(20), m_set_max_level(10), m_root(NULL) {}
-      Octree(Sd_traits const& traits,
-             const Input_iterator &first,
-             const Input_iterator &beyond,
-             Point_map& point_pmap,
-             Normal_map& normal_pmap,
-             std::size_t offset = 0,
-             std::size_t bucketSize = 20, 
-             std::size_t maxLevel = 10)
-             : PointAccessor(first, beyond, offset),
-               m_traits(traits),
-               m_root(NULL),
-               m_bucket_size(bucketSize),
-               m_set_max_level(maxLevel),
-               m_point_pmap (point_pmap),
-               m_normal_pmap (normal_pmap) {}
-
-      ~Octree() {
-        if (!m_root)
-          return;
-
-        std::stack<Cell *> stack;
-        stack.push(m_root);
-        while (!stack.empty()) {
-          Cell *cell = stack.top();
-          stack.pop();
-
-          for (std::size_t i = 0;i<8;i++)
-            if (cell->child[i])
-              stack.push(cell->child[i]);
-
-          delete cell;
-        }
-      }
-
-      // Sorting data in a way such that points of one cell
-      // are always in one range and ordered child-wise:
-      // +---+---+
-      // | 1.| 0.|
-      // +---+---+
-      // | 3.| 2.|
-      // +---+---+
-      // z max before z min, then y max before y min, then x max before x min
-      void createTree() {
-        buildBoundingCube();
-        std::size_t count = 0;
-        m_max_level = 0;
-
-        std::stack<Cell *> stack;
-        m_root = new Cell(0, this->size() - 1, m_center, 0);
-        stack.push(m_root);
-        while (!stack.empty()) {
-          Cell *cell= stack.top();
-          stack.pop();
-
-          m_max_level = std::max<std::size_t>(m_max_level, cell->level);
-          if (cell->level == m_set_max_level)
-            continue;
-          
-          std::size_t zLowYHighXSplit, zLowYLowXSplit, zLowYSplit;
-          std::size_t zHighYSplit, zHighYHighXSplit, zHighYLowXSplit;
-
-          std::size_t zSplit = split(cell->first, cell->last, 2, get_z(cell->center));
-
-          if (zSplit != size_t_max) {
-
-            zLowYSplit = split(cell->first, zSplit, 1, get_y(cell->center));
-            if (zLowYSplit != size_t_max) {
-              zLowYLowXSplit = split(cell->first,
-                                     zLowYSplit, 0, get_x(cell->center));
-              zLowYHighXSplit = split(zLowYSplit + 1,
-                                      zSplit, 0, get_x(cell->center)); 
-            }
-            else {
-              zLowYLowXSplit = size_t_max;
-              zLowYHighXSplit = split(cell->first, zSplit, 0, get_x(cell->center));
-            }
-
-            zHighYSplit = split(zSplit + 1, cell->last, 1, get_y(cell->center));  
-
-            if (zHighYSplit != size_t_max) {
-              zHighYHighXSplit = split(zHighYSplit + 1,
-                                       cell->last, 0, get_x(cell->center));
-              zHighYLowXSplit = split(zSplit + 1,
-                                      zHighYSplit, 0, get_x(cell->center));
-            }
-            else {
-              zHighYLowXSplit = size_t_max;
-              zHighYHighXSplit = split(zSplit + 1,
-                                       cell->last, 0, get_x(cell->center));
-            }
-          }
-          else {
-            zLowYSplit = size_t_max;
-            zLowYLowXSplit = size_t_max;
-            zLowYHighXSplit = size_t_max;
-
-            zHighYSplit = split(cell->first,
-                                cell->last,
-                                1,
-                                get_y(cell->center)); 
-
-            if (zHighYSplit != size_t_max) {
-              zHighYHighXSplit = split(zHighYSplit + 1, 
-                                       cell->last, 
-                                       0, 
-                                       get_x(cell->center));
-
-              zHighYLowXSplit = split(cell->first, 
-                                      zHighYSplit,
-                                      0, 
-                                      get_x(cell->center)); 
-            }
-            else {
-              zHighYLowXSplit = size_t_max;
-              zHighYHighXSplit = split(cell->first,
-                                       cell->last, 
-                                       0,
-                                       get_x(cell->center));
-            }
-          }
-
-
-          FT width = m_width / (1<<(cell->level + 1));
-
-          if (zSplit != size_t_max) {
-            if (zLowYSplit != size_t_max) {
-              if (zLowYLowXSplit != size_t_max) {
-
-                if (cell->first <= zLowYLowXSplit) {
-                  //---
-                  cell->child[7] = new Cell(cell->first,
-                                            zLowYLowXSplit, 
-                                            transl(cell->center, constr_vec(
-                                              ORIGIN, constr_pt(-width,-width,-width))),
-                                            cell->level + 1);
-
-                  if (cell->child[7]->size() > m_bucket_size)
-                    stack.push(cell->child[7]);
-                }
-              }
-              else zLowYLowXSplit = cell->first - 1;
-
-              if (zLowYLowXSplit < zLowYSplit || zLowYLowXSplit == size_t_max) {
-                //+--
-                cell->child[6] = new Cell(zLowYLowXSplit + 1,
-                                          zLowYSplit, 
-                                          transl(cell->center, constr_vec(
-                                            ORIGIN, constr_pt(width,-width,-width))),
-                                          cell->level + 1);
-
-                if (cell->child[6]->size() > m_bucket_size)
-                  stack.push(cell->child[6]);
-              }
-            }
-            else zLowYSplit = cell->first - 1;
-
-            if (zLowYHighXSplit != size_t_max) {
-
-              if (zLowYSplit < zLowYHighXSplit || zLowYSplit == size_t_max) {
-                //-+-
-                cell->child[5] = new Cell(zLowYSplit + 1, 
-                                          zLowYHighXSplit, 
-                                          transl(cell->center, constr_vec(
-                                            ORIGIN, constr_pt(-width, width,-width))),
-                                          cell->level + 1);
-
-                if (cell->child[5]->size() > m_bucket_size)
-                  stack.push(cell->child[5]);
-              }
-            }
-            else zLowYHighXSplit = zLowYSplit;
-
-            if (zLowYHighXSplit < zSplit || zLowYHighXSplit == size_t_max) {
-              //++-
-              cell->child[4] = new Cell(zLowYHighXSplit + 1,
-                                        zSplit, 
-                                        transl(cell->center, constr_vec(
-                                          ORIGIN, constr_pt(width, width,-width))),
-                                        cell->level + 1);
-
-              if (cell->child[4]->size() > m_bucket_size)
-                stack.push(cell->child[4]);
-            }
-          }
-          else zSplit = cell->first - 1;
-
-          if (zHighYSplit != size_t_max) {
-            if (zHighYLowXSplit != size_t_max) {
-
-              if (zSplit < zHighYLowXSplit || zSplit == size_t_max) {
-                //--+
-                cell->child[3] = new Cell(zSplit + 1,
-                                          zHighYLowXSplit,
-                                          transl(cell->center, constr_vec(
-                                            ORIGIN, constr_pt(-width,-width, width))),
-                                          cell->level + 1);
-
-                if (cell->child[3]->size() > m_bucket_size)
-                  stack.push(cell->child[3]);
-              }
-            }
-            else zHighYLowXSplit = zSplit;
-
-            if (zHighYLowXSplit < zHighYSplit || zHighYLowXSplit == size_t_max) {
-              //+-+
-              cell->child[2] = new Cell(zHighYLowXSplit + 1,
-                                        zHighYSplit, 
-                                        transl(cell->center, constr_vec(
-                                          ORIGIN, constr_pt(width,-width, width))),
-                                        cell->level + 1);
-
-              if (cell->child[2]->size() > m_bucket_size)
-                stack.push(cell->child[2]);
-            }
-
-          }
-          else zHighYSplit = zSplit;
-
-          if (zHighYHighXSplit != size_t_max) {
-            if (zHighYSplit < zHighYHighXSplit || zHighYSplit == size_t_max) {
-              //-++
-              cell->child[1] = new Cell(zHighYSplit + 1,
-                                        zHighYHighXSplit, 
-                                        transl(cell->center, constr_vec(
-                                          ORIGIN, constr_pt(-width, width, width))), 
-                                        cell->level + 1);
-
-              if (cell->child[1]->size() > m_bucket_size)
-                stack.push(cell->child[1]);
-            }
-          }
-          else zHighYHighXSplit = zHighYSplit;
-
-          if (zHighYHighXSplit <= cell->last || zHighYHighXSplit == size_t_max) {
-            if (zHighYHighXSplit < cell->last || zHighYHighXSplit == size_t_max) {
-              //+++
-              cell->child[0] = new Cell(zHighYHighXSplit + 1, 
-                                        cell->last,
-                                        transl(cell->center, constr_vec(
-                                          ORIGIN, constr_pt(width, width, width))),
-                                        cell->level + 1);
-
-              if (cell->child[0]->size() > m_bucket_size)
-                stack.push(cell->child[0]);
-            }
-          }
-
-          std::size_t sum = 0;
-          for (std::size_t i = 0;i<8;i++)
-            sum += (cell->child[i]) ? cell->child[i]->size() : 0;
-
-          count++;
-        }
-      }
-
-      bool drawSamplesFromCellContainingPoint(const Point_3 &p,
-                                              std::size_t level,
-                                              std::set<std::size_t>& indices,
-                                              const std::vector<int>& shapeIndex,
-                                              std::size_t requiredSamples) {
-
-        bool upperZ, upperY, upperX;
-        Cell *cur = m_root;
-
-        while (cur && cur->level < level) {
-          upperX = get_x(cur->center) <= get_x(p);
-          upperY = get_y(cur->center) <= get_y(p);
-          upperZ = get_z(cur->center) <= get_z(p);
-
-          if (upperZ) {
-            if (upperY)
-              cur = (upperX) ? cur->child[0] : cur->child[1];
-            else cur = (upperX) ? cur->child[2] : cur->child[3];
-          }
-          else {
-            if (upperY)
-              cur = (upperX) ? cur->child[4] : cur->child[5];
-            else cur = (upperX) ? cur->child[6] : cur->child[7];
-          }
-        }
-
-        if (cur) {
-          std::size_t enough = 0;
-          for (std::size_t i = cur->first;i<=cur->last;i++) {
-            std::size_t j = this->index(i);
-            if (shapeIndex[j] == -1) {
-              enough++;
-              if (enough >= requiredSamples)
-                break;
-            }
-          }
-          if (enough >= requiredSamples) {
-            do {
-              std::size_t p = CGAL::default_random.
-                uniform_int<std::size_t>(0, cur->size() - 1);
-              std::size_t j = this->index(cur->first + p);
-              if (shapeIndex[j] == -1)
-                indices.insert(j);
-            } while (indices.size() < requiredSamples);
-
-            return true;
-          }
-          else return false;
-        }
-        else return false;
-      }
-
-      std::size_t maxLevel() {
-        return m_max_level;
-      }
-
-      std::size_t fullScore(Shape *candidate,
-                       std::vector<int> &shapeIndex,
-                       FT epsilon, 
-                       FT normal_threshold) {
-
-        std::vector<std::size_t> indices(m_root->size());
-        for (std::size_t i = 0;i<m_root->size();i++) {
-          indices[i] = index(m_root->first + i);
-        }
-        
-        candidate->cost_function(this->begin() + m_root->first, 
-                                 this->begin() + m_root->last,
-                                 shapeIndex,
-                                 epsilon, 
-                                 normal_threshold, 
-                                 indices);
-
-        return candidate->m_indices.size();
-      }
-
-      std::size_t score(Shape *candidate, 
-                   std::vector<int> &shapeIndex,
-                   FT epsilon,
-                   FT normal_threshold) {
-
-        std::stack<Cell *> stack;
-        stack.push(m_root);
-
-        while(!stack.empty()) {
-          Cell *cell = stack.top();
-          stack.pop();
-
-          FT width = m_width / (1<<(cell->level));
-
-          FT diag = CGAL::sqrt(FT(3) * width * width) + epsilon;
-
-          FT dist = candidate->squared_distance(cell->center);
-
-          if (dist > (diag * diag))
-            continue;
-
-          // differ between full or partial overlap?
-          // if full overlap further traversal of this branch is not necessary
-          if (cell->isLeaf()) {
-            std::vector<std::size_t> indices;
-            indices.reserve(cell->size());
-            for (std::size_t i = 0;i<cell->size();i++) {
-              if (shapeIndex[this->index(cell->first + i)] == -1) {
-                indices.push_back(this->index(cell->first + i));
-              }
-            }
-
-            candidate->cost_function(epsilon, 
-                                     normal_threshold, 
-                                     indices);
-          }
-          else {
-            for (std::size_t i = 0;i<8;i++)
-              if (cell->child[i])
-                stack.push(cell->child[i]);
-          }
-
-        }
-
-        return candidate->m_indices.size();
-      }
-
-      void setBucketSize(std::size_t bucketSize) {
-        m_bucket_size = bucketSize;
-      }
-
-      const Bbox_3 &boundingBox() {
-        return m_bBox;
-      }
-        
-      const Bbox_3 &buildBoundingCube() {
-        FT min[] = {(std::numeric_limits<FT>::max)(),
-                    (std::numeric_limits<FT>::max)(),
-                    (std::numeric_limits<FT>::max)()};
-        FT max[] = {(std::numeric_limits<FT>::min)(),
-                    (std::numeric_limits<FT>::min)(),
-                    (std::numeric_limits<FT>::min)()};
-
-        for (std::size_t i = 0;i<this->size();i++) {
-          Point_3 p = get(m_point_pmap, *this->at(i));
-          min[0] = (std::min<FT>)(min[0], get_x(p));
-          min[1] = (std::min<FT>)(min[1], get_y(p));
-          min[2] = (std::min<FT>)(min[2], get_z(p));
-          max[0] = (std::max<FT>)(max[0], get_x(p));
-          max[1] = (std::max<FT>)(max[1], get_y(p));
-          max[2] = (std::max<FT>)(max[2], get_z(p));
-        }
-
-        m_bBox = Bbox_3(min[0], min[1], min[2], max[0], max[1], max[2]);
-
-        m_width = (std::max)(max[0] - min[0], 
-          (std::max)(max[1] - min[1], max[2] - min[2])) * (FT) 0.5;
-        m_center = constr_pt((min[0] + max[0]) * (FT) 0.5,
-                             (min[1] + max[1]) * (FT) 0.5,
-                             (min[2] + max[2]) * (FT) 0.5);
-
-        return m_bBox;
-      }
-
-      // returns index of last point below threshold
-      std::size_t split(std::size_t first, std::size_t last, std::size_t dimension, FT threshold) {
-        if (last == size_t_max || first == size_t_max) 
-          return size_t_max;
-
-        if (first > last)
-          return first - 1;
-
-        std::size_t origFirst = first;
-
-        while(first < last) {
-          // find first above threshold
-          Point_3 p1 = get(m_point_pmap, *this->at(first));
-          FT v1 = get_coord(p1, static_cast<unsigned int>(dimension));
-          while (get_coord(
-                   get(m_point_pmap, *this->at(first)),
-                   static_cast<unsigned int>(dimension)) < threshold
-                 && first < last) {
-            first++;
-          }
-
-          // check if last has been reached
-          if (first == last) {
-            return (get_coord(
-                      get(m_point_pmap, *this->at(first)),
-                      static_cast<unsigned int>(dimension)) < threshold) ?
-                   first : (first == origFirst) ? size_t_max : first - 1;
-          }
-
-          // find last below threshold
-          p1 = get(m_point_pmap, *this->at(last));
-          v1 = get_coord(p1, static_cast<unsigned int>(dimension));
-          while (get_coord(
-                   get(m_point_pmap, *this->at(last)),
-                   static_cast<unsigned int>(dimension)) >= threshold
-                 && last > first) {
-            last--;
-          }
-
-          // check if first has been reached
-          if (last == first) {
-            return (get_coord(
-                      get(m_point_pmap, *this->at(first)),
-                      static_cast<unsigned int>(dimension)) < threshold) ?
-                    first : (first == origFirst) ? size_t_max : first - 1;
-          }
-
-          this->swap(first, last);
-          p1 = get(m_point_pmap, *this->at(first));
-          v1 = get_coord(p1, static_cast<unsigned int>(dimension));
-          p1 = get(m_point_pmap, *this->at(last));
-          v1 = get_coord(p1, static_cast<unsigned int>(dimension));
-          first++;
-          last--;
-        }
-
-        return (get_coord(
-                  get(m_point_pmap, *this->at(first)),
-                  static_cast<unsigned int>(dimension)) < threshold) ?
-               first : (first == origFirst) ? size_t_max : first - 1;
-      }
-
-      Sd_traits m_traits;
-      Bbox_3 m_bBox;
-      Cell *m_root;
-      Point_3 m_center;
-      FT m_width;
-      std::size_t m_bucket_size;
-      std::size_t m_set_max_level;
-      std::size_t m_max_level;
-      Point_map m_point_pmap;
-      Normal_map m_normal_pmap;
-    };
-  }
-  }
-}
-
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Shape_detection_3/Plane.h b/3rdparty/CGAL-4.8/include/CGAL/Shape_detection_3/Plane.h
deleted file mode 100644
index 64af70b..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Shape_detection_3/Plane.h
+++ /dev/null
@@ -1,211 +0,0 @@
-// Copyright (c) 2015 INRIA Sophia-Antipolis (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
-// 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(s)     : Sven Oesau, Yannick Verdie, Clément Jamin, Pierre Alliez
-//
-
-#ifndef CGAL_SHAPE_DETECTION_3_PLANE_H
-#define CGAL_SHAPE_DETECTION_3_PLANE_H
-
-#include <CGAL/Shape_detection_3/Shape_base.h>
-#include <CGAL/number_utils.h>
-
-/*!
- \file Plane.h
- */
-namespace CGAL {
-  namespace Shape_detection_3 {
-    /*!
-     \ingroup PkgPointSetShapeDetection3Shapes
-     \brief Plane implements Shape_base. The plane is represented by the normal vector and the distance to the origin.
-     \tparam Traits a model of `EfficientRANSACTraits` with the additional 
-             requirement for planes (see `EfficientRANSACTraits` documentation).
-     */
-  template <class Traits>
-  class Plane : public Shape_base<Traits> {
-  public:
-    /// \cond SKIP_IN_MANUAL
-    typedef typename Traits::Point_map Point_map;
-     ///< property map to access the location of an input point.
-    typedef typename Traits::Normal_map Normal_map;
-     ///< property map to access the unoriented normal of an input point.
-    typedef typename Traits::FT FT; ///< number type.
-    typedef typename Traits::Point_3 Point_3; ///< point type.
-    typedef typename Traits::Vector_3 Vector_3;
-    /// \endcond
-
-    typedef typename Traits::Plane_3 Plane_3;///< plane type for conversion operator.
-
-  public:
-    Plane() : Shape_base<Traits>() {}
-
-    /*!
-      Conversion operator to `Plane_3` type.
-     */
-    operator Plane_3() const {
-      return Plane_3(this->get_x(m_normal), this->get_y(m_normal), this->get_z(m_normal), m_d);
-    }
-            
-    /*!
-      Normal vector of the plane.
-     */
-    Vector_3 plane_normal() const {
-      return m_normal;
-    }
-            
-    /*!
-      Signed distance from the origin.
-     */
-    FT d() const {
-      return m_d;
-    }
-    
-    /// \cond SKIP_IN_MANUAL
-    /*!
-      Computes squared Euclidean distance from query point to the shape.
-     */
-    FT squared_distance(const Point_3 &p) const {
-      FT d = this->scalar_pdct(
-        this->constr_vec(p, m_point_on_primitive), m_normal);
-      return d * d;
-    }
-
-    
-    /*!
-      Helper function to write the plane equation and
-      number of assigned points into a string.
-     */
-    std::string info() const {
-      std::stringstream sstr;
-      sstr << "Type: plane (" << this->get_x(m_normal) << ", " << this->get_y(m_normal) 
-        << ", " << this->get_z(m_normal) << ")x - " << m_d << "= 0"
-        << " #Pts: " << this->m_indices.size();
-
-      return sstr.str();
-    }
-    /// \endcond
-
-  protected:
-      /// \cond SKIP_IN_MANUAL
-    virtual void create_shape(const std::vector<std::size_t> &indices) {
-      Point_3 p1 = this->point(indices[0]);
-      Point_3 p2 = this->point(indices[1]);
-      Point_3 p3 = this->point(indices[2]);
-
-      m_normal = this->cross_pdct(
-        this->constr_vec(p2, p1), this->constr_vec(p3, p1));
-
-      FT length = CGAL::sqrt(this->sqlen(m_normal));
-
-      // Are the points almost singular?
-      if (length < (FT)0.0001) {
-        return;
-      }
-
-      m_normal = this->scale(m_normal, (FT)1.0 / length);
-      m_d = -(this->get_x(p1) * this->get_x(m_normal) 
-        + this->get_y(p1) * this->get_y(m_normal) 
-        + this->get_z(p1) * this->get_z(m_normal));
-
-      //check deviation of the 3 normal
-      Vector_3 l_v = this->constr_vec();
-      for (std::size_t i = 0;i<3;i++) {
-        l_v = this->normal(indices[i]);
-
-        if (CGAL::abs(this->scalar_pdct(l_v, m_normal))
-            < this->m_normal_threshold * CGAL::sqrt(this->sqlen(l_v))) {
-          this->m_is_valid = false;
-          return;
-        }
-
-        m_point_on_primitive = p1;
-        m_base1 = this->cross_pdct(this->constr_vec(p2, p1), m_normal);
-        m_base1 = this->scale(m_base1, ((FT)1.0 / CGAL::sqrt(this->sqlen(m_base1))));
-
-        m_base2 = this->cross_pdct(m_base1, m_normal);
-        m_base2 = this->scale(m_base2, ((FT)1.0 / CGAL::sqrt(this->sqlen(m_base2))));
-      }
-
-      this->m_is_valid = true;
-    }
-
-    virtual void parameters(const std::vector<std::size_t> &indices,
-                            std::vector<std::pair<FT, FT> > &parameterSpace,
-                            FT &,                    
-                            FT min[2],
-                            FT max[2]) const {
-      // Transform first point before to initialize min/max
-      Vector_3 p = this->constr_vec(
-        m_point_on_primitive, this->point(indices[0]));
-      FT u = this->scalar_pdct(p, m_base1);
-      FT v = this->scalar_pdct(p, m_base2);
-      parameterSpace[0] = std::pair<FT, FT>(u, v);
-      min[0] = max[0] = u;
-      min[1] = max[1] = v;
-
-      for (std::size_t i = 1;i<indices.size();i++) {
-        p = this->constr_vec(m_point_on_primitive, this->point(indices[i]));
-        u = this->scalar_pdct(p, m_base1);
-        v = this->scalar_pdct(p, m_base2);
-        min[0] = (std::min<FT>)(min[0], u);
-        max[0] = (std::max<FT>)(max[0], u);
-        min[1] = (std::min<FT>)(min[1], v);
-        max[1] = (std::max<FT>)(max[1], v);
-        parameterSpace[i] = std::pair<FT, FT>(u, v);
-      }
-    }
-    
-    virtual void squared_distance(const std::vector<std::size_t> &indices,
-                                  std::vector<FT> &dists) const {
-      for (std::size_t i = 0;i<indices.size();i++) {
-        const FT d = this->scalar_pdct(
-          this->constr_vec(m_point_on_primitive, this->point(indices[i])), 
-          m_normal);
-        dists[i] = d * d;
-      }
-    }
-
-    virtual void cos_to_normal(const std::vector<std::size_t> &indices, 
-                               std::vector<FT> &angles) const {
-      for (std::size_t i = 0;i<indices.size();i++) {
-        angles[i] = CGAL::abs(
-          this->scalar_pdct(this->normal(indices[i]), m_normal));
-      }
-    }
-
-    FT cos_to_normal(const Point_3 &, const Vector_3 &n) const{
-      return CGAL::abs(this->scalar_pdct(n, m_normal));
-    } 
-    
-    virtual std::size_t minimum_sample_size() const {
-      return 3;
-    }
-
-    virtual bool supports_connected_component() const {
-      return true;
-    }
-
-  private:
-    Point_3 m_point_on_primitive;
-    Vector_3 m_base1, m_base2, m_normal;
-    FT m_d;
-    /// \endcond
-  };
-}
-}
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Shape_detection_3/Shape_base.h b/3rdparty/CGAL-4.8/include/CGAL/Shape_detection_3/Shape_base.h
deleted file mode 100644
index a1c381a..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Shape_detection_3/Shape_base.h
+++ /dev/null
@@ -1,702 +0,0 @@
-// Copyright (c) 2015 INRIA Sophia-Antipolis (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
-// 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(s)     : Sven Oesau, Yannick Verdie, Clément Jamin, Pierre Alliez
-//
-
-#ifndef CGAL_SHAPE_DETECTION_3_SHAPE_BASE_H
-#define CGAL_SHAPE_DETECTION_3_SHAPE_BASE_H
-
-#include <vector>
-#include <set>
-#include <boost/tuple/tuple.hpp>
-#include <CGAL/Kd_tree.h>
-#include <CGAL/Fuzzy_sphere.h>
-#include <CGAL/property_map.h>
-#include <CGAL/number_utils.h>
-#include <CGAL/Random.h>
-
-/*!
- \file Shape_base.h
- */
-
-#ifndef CGAL_M_PI_2
-#define CGAL_M_PI_2 1.57079632679489661923
-#endif
-#ifndef CGAL_M_PI_4
-#define CGAL_M_PI_4 0.785398163397448309616
-#endif
-
-namespace CGAL {
-  namespace Shape_detection_3 {
-  namespace internal {
-    template<class PointAccessor>
-    class Octree;
-  }
-    
-    /*!
-     \ingroup PkgPointSetShapeDetection3Shapes
-     \brief Base class for shape types defining an interface to construct a
-            shape from a set of points and to compute the point distance and normal
-            deviation from the surface normal. It is used during detection to
-            identify the inliers from the input data and to extract the largest
-            connected component in inlier points.
-     */
-  template <class Traits>
-  class Shape_base {
-    /// \cond SKIP_IN_MANUAL
-    template <class T>
-    friend class Efficient_RANSAC;
-    template<class PointAccessor>
-    friend class internal::Octree;
-    /// \endcond
-
-  public:
-    /// \cond SKIP_IN_MANUAL
-    typedef typename Traits::Input_range::iterator Input_iterator;
-      ///< random access iterator for input data.
-    typedef typename Traits::Point_map Point_map;
-      ///< property map to access the location of an input point.
-    typedef typename Traits::Normal_map Normal_map;
-      ///< property map to access the unoriented normal of an input point.
-    typedef Shape_base<Traits> Shape;
-      ///< own type.
-    /// \endcond
-
-    typedef typename Traits::FT FT; ///< number type.
-    typedef typename Traits::Point_3 Point_3; ///< point type.
-    typedef typename Traits::Vector_3 Vector_3; ///< vector type.
-
-    // \todo The property maps should be passed here instead of `compute`
-    Shape_base() :
-    m_is_valid(false),
-      m_lower_bound((std::numeric_limits<FT>::min)()),
-      m_upper_bound((std::numeric_limits<FT>::min)()),
-      m_score(0),
-      m_sum_expected_value(0),
-      m_nb_subset_used(0),
-      m_has_connected_component(false) {
-    }
-
-    virtual ~Shape_base() {}
-      
-    /*!
-      returns the indices of the points in the input range assigned to this shape.
-     */
-    const std::vector<std::size_t> & indices_of_assigned_points() const {
-      return m_indices;
-    }
-      
-    /*!
-      returns a string containing the shape type
-      and the numerical parameters.
-     */
-    virtual std::string info() const {
-      return std::string();
-    }
-
-    /*!
-      Computes the squared Euclidean distance from the query point `p` to the shape.
-     */
-    virtual FT squared_distance(const Point_3 &p) const = 0;
-
-  protected:
-      
-    /*!
-      Constructs the shape based on a minimal set of samples from the
-      input data.
-     */
-    virtual void create_shape(const std::vector<std::size_t> &indices) = 0;
-    
-    /*!
-      Determines the largest cluster of inlier points. A point belongs to a cluster
-      if there is a point in the cluster closer than `cluster_epsilon` distance.
-     */
-    virtual std::size_t connected_component(
-      std::vector<std::size_t> &indices, FT cluster_epsilon) {
-      if (indices.size() == 0)
-        return 0;
-
-      if (m_has_connected_component)
-        return m_score;
-
-      m_has_connected_component = true;
-      if (!this->supports_connected_component())
-        return connected_component_kdTree(indices, cluster_epsilon);
-      
-      // Fetching parameters
-      FT min[] = {0,0}, max[] = {0,0};
-
-      std::vector<std::pair<FT, FT> > parameter_space;
-      parameter_space.resize(indices.size());
-
-      parameters(m_indices, parameter_space, cluster_epsilon, min, max);
-
-      // Determine required size of bitmap
-      std::size_t u_extent = std::size_t(ceil((max[0] - min[0]) / cluster_epsilon));
-      std::size_t v_extent = std::size_t(ceil((max[1] - min[1]) / cluster_epsilon));
-
-      // Handle singular case
-      u_extent = (u_extent == 0) ? 1 : u_extent;
-      v_extent = (v_extent == 0) ? 1 : v_extent;
-
-      std::vector<unsigned int> bitmap;
-      bitmap.resize(u_extent * v_extent, 0);
-
-      // Fill bitmap
-      for (std::size_t i = 0;i<parameter_space.size();i++) {
-        int u = (int)((parameter_space[i].first - min[0]) / cluster_epsilon);
-        int v = (int)((parameter_space[i].second - min[1]) / cluster_epsilon);
-
-        u = (u < 0) ? 0 : (((std::size_t)u >= u_extent) ? (int)u_extent - 1 : u);
-        v = (v < 0) ? 0 : (((std::size_t)v >= v_extent) ? (int)v_extent - 1 : v);
-
-        bitmap[v * int(u_extent) + u] = true;
-      }
-
-      // Iterate through the bitmap
-      std::vector<unsigned int> map;
-      map.reserve(64);
-      map.resize(2);
-
-      for (std::size_t y = 0;y<v_extent;y++) {
-        for (std::size_t x = 0;x<u_extent;x++) {
-          if (!bitmap[y * u_extent + x])
-            continue;
-
-          unsigned int w = (x > 0) ?
-            bitmap[y  * u_extent + x - 1] : 0;
-
-          unsigned int n = (y > 0) ?
-            bitmap[(y - 1) * u_extent + x] : 0;
-
-          unsigned int nw = (x > 0 && y > 0) ?
-            bitmap[(y - 1) * u_extent + x - 1] : 0;
-
-          unsigned int ne = ((x + 1 < u_extent) && y > 0) ?
-            bitmap[(y - 1) * u_extent + x + 1] : 0;
-
-          // Find smallest set label;
-          unsigned int curLabel = static_cast<unsigned int>(map.size());
-
-          curLabel = (w != 0) ?
-            (std::min<unsigned int>)(curLabel, w) : curLabel;
-
-          curLabel = (n != 0) ?
-            (std::min<unsigned int>)(curLabel, n) : curLabel;
-
-          curLabel = (nw != 0) ?
-            (std::min<unsigned int>)(curLabel, nw) : curLabel;
-
-          curLabel = (ne != 0) ? 
-            (std::min<unsigned int>)(curLabel, ne) : curLabel;
-
-          // Update merge map.
-          if (curLabel != map.size()) {
-            if (w > curLabel) update_label(map, w, curLabel);
-            if (nw > curLabel) update_label(map, nw, curLabel);
-            if (n > curLabel) update_label(map, n, curLabel);
-            if (ne > curLabel) update_label(map, ne, curLabel);
-          }
-          else map.push_back(static_cast<unsigned int>(map.size()));
-
-          bitmap[y * u_extent + x] = curLabel;
-        }
-      }
-
-      // post_wrap to handle boundaries in different shape types.
-      if (map.size() > 3)
-        post_wrap(bitmap, u_extent, v_extent, map);
-
-      // Propagate label changes
-      for (unsigned int j = 3; j < static_cast<unsigned int>(map.size()); j++)
-        update_label(map, j, map[j]);
-
-      // Update labels
-      for (std::size_t y = 0;y<v_extent;y++)
-        for (std::size_t x = 0;x<u_extent;x++) {
-          unsigned int label = bitmap[y * u_extent + x];
-
-          if (!label)
-            continue;
-
-          if (map[label] != label)
-            bitmap[y * u_extent + x] = map[label];
-        }
-
-      // Count points per label.
-      std::vector<unsigned int> count(map.size(), 0);
-
-      for (std::size_t i = 0;i<parameter_space.size();i++) {
-        int u = (int)((parameter_space[i].first - min[0]) / cluster_epsilon);
-        int v = (int)((parameter_space[i].second - min[1]) / cluster_epsilon);
-        
-        u = (u < 0) ? 0 : (((std::size_t)u >= u_extent) ? (int)u_extent - 1 : u);
-        v = (v < 0) ? 0 : (((std::size_t)v >= v_extent) ? (int)v_extent - 1 : v);
-
-        count[bitmap[v * int(u_extent) + u]]++;
-      }
-
-      // Find largest component. Start at index 2 as 0/1 are reserved for
-      // basic free/occupied bitmap labels.
-      unsigned int largest = 2;
-      for (unsigned int i = 3; i < static_cast<unsigned int>(count.size()); i++)
-        largest = (count[largest] < count[i]) ? i : largest;
-
-      // Extract sought-after indices.
-      std::vector<std::size_t> comp_indices;
-      comp_indices.reserve(count[largest]);
-
-      for (std::size_t i = 0;i<parameter_space.size();i++) {
-        int u = (int)((parameter_space[i].first - min[0]) / cluster_epsilon);
-        int v = (int)((parameter_space[i].second - min[1]) / cluster_epsilon);
-        
-        u = (u < 0) ? 0 : (((std::size_t)u >= u_extent) ? (int)u_extent - 1 : u);
-        v = (v < 0) ? 0 : (((std::size_t)v >= v_extent) ? (int)v_extent - 1 : v);
-
-        if (bitmap[v * int(u_extent) + u] == largest)
-          comp_indices.push_back(indices[i]);
-      }
-
-      indices = comp_indices;
-
-      return m_score = indices.size();
-    }
-    
-    /*!
-      Determines the largest cluster with a point-to-point
-      distance not larger than `cluster_epsilon`. This general version performs
-      a region growing within the inliers using a kd-tree.
-     */
-    std::size_t connected_component_kdTree(std::vector<std::size_t> &indices,
-                                           FT cluster_epsilon) {
-      typedef boost::tuple<Point_3, std::size_t> Point_and_size_t;
-      typedef CGAL::Search_traits_adapter<Point_and_size_t,
-        CGAL::Nth_of_tuple_property_map<0, Point_and_size_t>,
-        typename Traits::Search_traits> Search_traits_adapter;
-
-      typedef CGAL::Kd_tree<Search_traits_adapter> Kd_Tree;
-      typedef CGAL::Fuzzy_sphere<Search_traits_adapter> Fuzzy_sphere;
-
-      m_has_connected_component = true;
-      
-      std::vector<Point_and_size_t> pts;
-      std::vector<std::size_t> label_map;
-      pts.resize(indices.size());
-      label_map.resize(indices.size(), 0);
-
-      for (std::size_t i = 0;i < indices.size();i++) {
-        pts[i] = Point_and_size_t(point(indices[i]), i);
-      }
-
-      // construct kd tree
-      Kd_Tree tree(pts.begin(), pts.end());
-      
-      std::stack<std::size_t> stack;
-      std::size_t unlabeled = pts.size();
-      std::size_t label = 1;
-      std::size_t best = 0;
-      std::size_t best_size = 0;
-
-      for (std::size_t i = 0;i<pts.size();i++) {
-        if (label_map[i] != 0)
-          continue;
-
-        std::size_t assigned = 0;
-
-        stack.push(i);
-        while(!stack.empty()) {
-          std::vector<Point_and_size_t> near_points;
-
-          std::size_t p = stack.top();
-          stack.pop();
-
-          Fuzzy_sphere fs(pts[p], cluster_epsilon, 0);
-          tree.search(std::back_inserter(near_points), fs);
-
-          for (std::size_t j = 0;j<near_points.size();j++) {
-            std::size_t index = boost::get<1>(near_points[j]);
-            if (index == p)
-              continue;
-
-            if (label_map[index] != label) {
-              label_map[index] = label;
-              assigned++;
-              stack.push(index);
-            }
-          }
-        }
-        
-        // Track most prominent label and remaining points
-        unlabeled -= assigned;
-        if (assigned > best_size) {
-          best = label;
-          best_size = assigned;
-        }
-
-        label++;
-
-        // Can we stop already?
-        if (unlabeled <= best_size)
-          break;
-      }
-
-      std::vector<std::size_t> tmp_indices;
-      tmp_indices.reserve(best_size);
-      for (std::size_t i = 0;i<pts.size();i++) {
-        if (label_map[i] == best)
-          tmp_indices.push_back(indices[i]);
-      }
-
-      indices = tmp_indices;
-      
-      return indices.size();
-    }
-
-    /*!
-      Computes the squared Euclidean distance from a set of points to the shape.
-      The distances will be stored in the so called parameter.
-     */
-    virtual void squared_distance(const std::vector<std::size_t> &indices,
-                                  std::vector<FT> &distances) const = 0;
-
-    /*!
-      Computes the deviation of the point normal from the surface normal at the
-      projected point in form of the dot product and writes the result into the
-      provided `angles` vector.
-     */
-    virtual void cos_to_normal(const std::vector<std::size_t> &indices,
-                               std::vector<FT> &angles) const = 0;
-
-    /*!
-      Returns minimal number of sample points required for construction.
-     */
-    virtual std::size_t minimum_sample_size() const = 0;
-
-    /*!
-      Retrieves the point location from its index.
-     */
-    typename boost::property_traits< typename Traits::Point_map >::reference
-    point(std::size_t i) const {
-      return get(this->m_point_pmap, *(this->m_first + i));
-    }
-    
-    /*!
-      Retrieves the normal vector from its index.
-     */
-    typename boost::property_traits< typename Traits::Normal_map >::reference
-    normal(std::size_t i) const {
-      return get(this->m_normal_pmap, *(this->m_first + i));
-    }
-
-    /*!
-      Retrieves the traits class.
-     */
-    const Traits&
-    traits() const
-    {
-      return m_traits;
-    }
-
-    /// \cond SKIP_IN_MANUAL
-    struct Compare_by_max_bound {
-        bool operator() (const Shape *a, const Shape *b) {
-            return a->max_bound() < b->max_bound();
-        }
-    };
-      
-    FT expected_value() const {
-      return (m_lower_bound + m_upper_bound) / 2.f;
-    }
-
-    FT inline min_bound() const {
-      return  m_lower_bound;
-    }
-
-    FT inline max_bound() const {
-      return  m_upper_bound;
-    }
-
-    virtual void post_wrap(const std::vector<unsigned int> &bitmap,
-                   const std::size_t &u_extent,
-                   const std::size_t &v_extent,
-                   std::vector<unsigned int> &labels) const {
-      // Avoid compiler warnings about unused parameters.
-      (void) bitmap;
-      (void) u_extent;
-      (void) v_extent;
-      (void) labels;
-    }
-
-    // return last computed score, or -1 if no score yet
-    FT inline score() const {
-      return FT(m_score);
-    } 
-
-    int inline subsets() const {
-      return m_nb_subset_used;
-    }
-
-    // sorting is performed by expected value
-    operator FT() const {
-      return expected_value();
-    }
-
-    void inline update_label(std::vector<unsigned int> &labels, unsigned int i,
-                             unsigned int &new_value) const {
-      if (labels[i] != i)
-        update_label(labels, labels[i], new_value);
-
-      if (new_value < labels[i])
-        labels[i] = new_value;
-      else
-        new_value = labels[i];
-    }
-
-    void update_points(const std::vector<int> &shape_index) {
-      if (!m_indices.size())
-        return;
-      std::size_t start = 0, end = m_indices.size() - 1;
-      while (start < end) {
-        while (shape_index[m_indices[start]] == -1
-          && start < end) start++;
-
-        while (shape_index[m_indices[end]] != -1
-          && start < end) end--;
-
-        if (shape_index[m_indices[start]] != -1
-          && shape_index[m_indices[end]] == -1
-          && start < end) {
-          std::size_t tmp = m_indices[start];
-          m_indices[start] = m_indices[end];
-          m_indices[end] = tmp;
-        }
-      }
-      m_indices.resize(end);
-      m_score = m_indices.size();
-    }
-
-    bool is_valid() const {
-      return m_is_valid;
-    }
-
-    // Two shapes are considered the same if from 18 points randomly selected
-    // from the shapes at least 12 match both shapes
-    bool is_same(const Shape_base *other) const {
-      if (!other)
-        return false;
-      if (other->m_indices.size() == 0)
-        return true;
-
-      const std::size_t num = 9;
-      int score = 0;
-      std::vector<std::size_t> indices(num);
-      for (std::size_t i = 0;i<num;i++)
-        indices[i] = m_indices[default_random(m_indices.size())];
-      
-      std::vector<FT> dists(num), angles(num);
-      other->squared_distance(indices, dists);
-      other->cos_to_normal(indices, angles);
-
-      for (std::size_t i = 0;i<num;i++)
-        if (dists[i] <= m_epsilon && angles[i] > m_normal_threshold)
-          score++;
-
-      if (score < 3)
-        return false;
-
-      for (std::size_t i = 0;i<num;i++)
-        indices[i] = other->m_indices[default_random(other->m_indices.size())];
-
-      this->squared_distance(indices, dists);
-      this->cos_to_normal(indices, angles);
-
-      for (std::size_t i = 0;i<num;i++)
-        if (dists[i] <= m_epsilon && angles[i] > m_normal_threshold)
-          score++;
-
-      return (score >= 12);
-    }
-
-    virtual void parameters(const std::vector<std::size_t>& indices,
-                            std::vector<std::pair<FT, FT> >& parameter_space,
-                            FT &cluster_epsilon,
-                            FT min[2],
-                            FT max[2]) const {
-      // Avoid compiler warnings about unused parameters.
-      (void)indices;
-      (void)parameter_space;
-      (void)cluster_epsilon;
-      (void)min;
-      (void)max;
-    }
-
-    void compute(const std::set<std::size_t>& indices,
-                 Input_iterator first,
-                 Traits traits,
-                 Point_map point_pmap,
-                 Normal_map normal_pmap,
-                 FT epsilon,
-                 FT normal_threshold) {
-      if (indices.size() < minimum_sample_size())
-        return;
-
-      m_first = first;
-      m_traits = traits;
-      m_point_pmap = point_pmap;
-      m_normal_pmap = normal_pmap;
-      m_epsilon = epsilon;
-      m_normal_threshold = normal_threshold;
-
-      std::vector<std::size_t> output(indices.begin(), indices.end());
-
-      create_shape(output);
-    }
-
-    inline bool operator<(const Shape &c) const {
-      return expected_value() < c.expected_value();
-    }
-
-    std::size_t cost_function(FT epsilon,
-                         FT normal_threshold,
-                         const std::vector<std::size_t> &indices) {
-      std::vector<FT> dists, angles;
-      dists.resize(indices.size());
-      squared_distance(indices, dists);
-      angles.resize(indices.size());
-      cos_to_normal(indices, angles);
-
-      std::size_t score_before = m_indices.size();
-
-      FT eps = epsilon * epsilon;
-      for (std::size_t i = 0;i<indices.size();i++) {
-          if (dists[i] <= eps && angles[i] > normal_threshold)
-            m_indices.push_back(indices[i]);
-        }
-
-      return m_indices.size() - score_before;
-    }
-
-    template<typename T> bool is_finite(T arg) {
-      return arg == arg && 
-        arg != std::numeric_limits<T>::infinity() &&
-        arg != -std::numeric_limits<T>::infinity();
-    }
-
-    void compute_bound(const std::size_t num_evaluated_points,
-                       const std::size_t num_available_points) {
-      hypergeometrical_dist(-2 - num_evaluated_points,
-                            -2 - num_available_points,
-                            -1 - signed(m_indices.size()),
-                            m_lower_bound, m_upper_bound);
-
-      m_lower_bound = -1 - m_lower_bound;
-      m_upper_bound = -1 - m_upper_bound;
-    }
-
-    void hypergeometrical_dist(const std::ptrdiff_t UN, 
-                               const std::ptrdiff_t x,
-                               const std::ptrdiff_t n, 
-                               FT &low,
-                               FT &high) {                           
-      const FT q = FT(x * n * double(UN - x) * (UN - n) / (UN - 1));
-      const FT sq = CGAL::sqrt(q);
-      low  = (x * n - sq) / UN;
-      high = (x * n + sq)/UN;
-
-      if (!is_finite<FT>(low) || !is_finite<FT>(high)) {
-        low = high = 0;
-      }
-    }
-
-
-    virtual bool supports_connected_component() const {
-      return false;
-    };
-
-    
-    // ------------------------------------------------------------------------
-    // Utilities
-    // ------------------------------------------------------------------------
-    FT get_x(const Vector_3& v) const { return m_traits.compute_x_3_object()(v); }
-    FT get_y(const Vector_3& v) const { return m_traits.compute_y_3_object()(v); }
-    FT get_z(const Vector_3& v) const { return m_traits.compute_z_3_object()(v); }
-    FT get_x(const Point_3& p) const { return m_traits.compute_x_3_object()(p); }
-    FT get_y(const Point_3& p) const { return m_traits.compute_y_3_object()(p); }
-    FT get_z(const Point_3& p) const { return m_traits.compute_z_3_object()(p); }
-    
-    Point_3 constr_pt() const
-    { return m_traits.construct_point_3_object()(ORIGIN); }
-    Point_3 constr_pt(FT x, FT y, FT z) const
-    { return m_traits.construct_point_3_object()(x, y, z); }
-    Vector_3 constr_vec() const
-    { return m_traits.construct_vector_3_object()(NULL_VECTOR); }
-    Vector_3 constr_vec(const Point_3& p, const Point_3& q) const
-    { return m_traits.construct_vector_3_object()(p, q); }
-
-    FT sqlen(const Vector_3& v) const
-    { return m_traits.compute_squared_length_3_object()(v); }
-    Vector_3 scale(const Vector_3& v, FT scale) const
-    { return m_traits.construct_scaled_vector_3_object()(v, scale); }
-    Vector_3 sum_vectors(const Vector_3& u, const Vector_3& v) const
-    { return m_traits.construct_sum_of_vectors_3_object()(u, v); }
-    Point_3 transl(const Point_3& p, const Vector_3 &v) const
-    { return m_traits.construct_translated_point_3_object()(p, v); }
-    FT scalar_pdct(const Vector_3& u, const Vector_3& v) const
-    { return m_traits.compute_scalar_product_3_object()(u, v); }
-    Vector_3 cross_pdct(const Vector_3& u, const Vector_3& v) const
-    { return m_traits.construct_cross_product_vector_3_object()(u, v); }
-
-  protected:
-    /// \endcond
-    // 
-    /// \cond SKIP_IN_MANUAL
-    /*!
-      Contains indices of the inliers of the candidate, access
-      to the point and normal data is provided via property maps.
-     */
-    std::vector<std::size_t> m_indices;
-
-    FT m_epsilon;
-
-    //deviation of normal, used during first check of the 3 normal
-    FT m_normal_threshold;
-
-    bool m_is_valid;
-    FT m_lower_bound;
-    FT m_upper_bound;
-
-    std::size_t m_score;
-
-    FT m_sum_expected_value;
-
-    //count the number of subset used so far for the score,
-    //and thus indicate the next one to use
-    std::size_t m_nb_subset_used;
-    bool m_has_connected_component;
-
-    Input_iterator m_first;
-
-    Traits m_traits;
-    Point_map m_point_pmap;
-    Normal_map m_normal_pmap;
-    /// \endcond
-  };  
-}
-}
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Spatial_sort_traits_adapter_2.h b/3rdparty/CGAL-4.8/include/CGAL/Spatial_sort_traits_adapter_2.h
deleted file mode 100644
index e84097e..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Spatial_sort_traits_adapter_2.h
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright (c) 2011  GeometryFactory (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Sebastien Loriot
-
-
-#ifndef CGAL_SPATIAL_SORT_TRAITS_ADAPTER_2_H
-#define CGAL_SPATIAL_SORT_TRAITS_ADAPTER_2_H
-
-#include <boost/call_traits.hpp>
-#include <boost/version.hpp>
-#if BOOST_VERSION >= 104000
-  #include <boost/property_map/property_map.hpp>
-#else
-  #include <boost/property_map.hpp>
-#endif
-
-
-namespace CGAL{
-  
-using ::get;
-
-template<class Base_traits,class PointPropertyMap>
-class Spatial_sort_traits_adapter_2:public Base_traits{
-  PointPropertyMap ppmap_;
-public:
-  Spatial_sort_traits_adapter_2(Base_traits base=Base_traits()):Base_traits(base){}
-
-  Spatial_sort_traits_adapter_2(const PointPropertyMap& ppmap,Base_traits base=Base_traits())
-  :Base_traits(base),ppmap_(ppmap){}
-
-  typedef Base_traits Gt;
-  typedef typename boost::property_traits<PointPropertyMap>::key_type Point_2;
-  typedef typename boost::call_traits<Point_2>::param_type Arg_type;
-
-  struct Less_x_2 : public Base_traits::Less_x_2{
-    Less_x_2(const PointPropertyMap& ppmap,const typename Base_traits::Less_x_2& base):
-      Base_traits::Less_x_2(base),ppmap_(ppmap){}
-    const PointPropertyMap& ppmap_;
-    bool operator()(Arg_type p,Arg_type q) const {
-      return static_cast<const typename Base_traits::Less_x_2*>(this)->operator()(get(ppmap_,p),get(ppmap_,q));
-    }
-  };
-
-  struct Less_y_2 : public Base_traits::Less_y_2{
-    Less_y_2(const PointPropertyMap& ppmap,const typename Base_traits::Less_y_2& base):
-      Base_traits::Less_y_2(base),ppmap_(ppmap){}
-    const PointPropertyMap& ppmap_;
-    bool operator()(Arg_type p,Arg_type q) const {
-      return static_cast<const typename Base_traits::Less_y_2*>(this)->operator()(get(ppmap_,p),get(ppmap_,q));
-    }
-  };
-
-  Less_x_2 less_x_2_object () const {return Less_x_2(ppmap_,static_cast<const Gt*>(this)->less_x_2_object() );}
-  Less_y_2 less_y_2_object () const {return Less_y_2(ppmap_,static_cast<const Gt*>(this)->less_y_2_object() );}
-  
-  const PointPropertyMap& point_property_map() const {return ppmap_;}
-
-};
-
-} //namespace CGAL
-
-#endif //CGAL_SPATIAL_SORT_TRAITS_ADAPTER_2_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Spatial_sort_traits_adapter_3.h b/3rdparty/CGAL-4.8/include/CGAL/Spatial_sort_traits_adapter_3.h
deleted file mode 100644
index 107bc4d..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Spatial_sort_traits_adapter_3.h
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright (c) 2011  GeometryFactory (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Sebastien Loriot
-
-
-#ifndef CGAL_SPATIAL_SORT_TRAITS_ADAPTER_3_H
-#define CGAL_SPATIAL_SORT_TRAITS_ADAPTER_3_H
-
-#include <boost/call_traits.hpp>
-#include <boost/version.hpp>
-#if BOOST_VERSION >= 104000
-  #include <boost/property_map/property_map.hpp>
-#else
-  #include <boost/property_map.hpp>
-#endif
-
-
-namespace CGAL{
-
-using ::get;
-  
-template<class Base_traits,class PointPropertyMap>
-class Spatial_sort_traits_adapter_3:public Base_traits{
-  PointPropertyMap ppmap_;
-public:
-  Spatial_sort_traits_adapter_3(Base_traits base=Base_traits()):Base_traits(base){}
-
-  Spatial_sort_traits_adapter_3(const PointPropertyMap& ppmap,Base_traits base=Base_traits())
-  :Base_traits(base),ppmap_(ppmap){}
-
-  typedef Base_traits Gt;
-  typedef typename boost::property_traits<PointPropertyMap>::key_type Point_3;
-  typedef typename boost::call_traits<Point_3>::param_type Arg_type;
-
-  struct Less_x_3 : public Base_traits::Less_x_3{
-    Less_x_3(const PointPropertyMap& ppmap,const typename Base_traits::Less_x_3& base):
-      Base_traits::Less_x_3(base),ppmap_(ppmap){}
-    const PointPropertyMap& ppmap_;
-    bool operator()(Arg_type p,Arg_type q) const {
-      return static_cast<const typename Base_traits::Less_x_3*>(this)->operator()(get(ppmap_,p),get(ppmap_,q));
-    }
-  };
-
-  struct Less_y_3 : public Base_traits::Less_y_3{
-    Less_y_3(const PointPropertyMap& ppmap,const typename Base_traits::Less_y_3& base):
-      Base_traits::Less_y_3(base),ppmap_(ppmap){}
-    const PointPropertyMap& ppmap_;
-    bool operator()(Arg_type p,Arg_type q) const {
-      return static_cast<const typename Base_traits::Less_y_3*>(this)->operator()(get(ppmap_,p),get(ppmap_,q));
-    }
-  };
-
-  struct Less_z_3 : public Base_traits::Less_z_3{
-    Less_z_3(const PointPropertyMap& ppmap,const typename Base_traits::Less_z_3& base):
-      Base_traits::Less_z_3(base),ppmap_(ppmap){}
-    const PointPropertyMap& ppmap_;
-    bool operator()(Arg_type p,Arg_type q) const {
-      return static_cast<const typename Base_traits::Less_z_3*>(this)->operator()(get(ppmap_,p),get(ppmap_,q));
-    }
-  };
-
-  Less_x_3 less_x_3_object () const {return Less_x_3(ppmap_,static_cast<const Gt*>(this)->less_x_3_object() );}
-  Less_y_3 less_y_3_object () const {return Less_y_3(ppmap_,static_cast<const Gt*>(this)->less_y_3_object() );}
-  Less_z_3 less_z_3_object () const {return Less_z_3(ppmap_,static_cast<const Gt*>(this)->less_z_3_object() );}
-  
-  const PointPropertyMap& point_property_map() const {return ppmap_;}
-  
-};
-
-} //namespace CGAL
-
-#endif //CGAL_SPATIAL_SORT_TRAITS_ADAPTER_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Spatial_sort_traits_adapter_d.h b/3rdparty/CGAL-4.8/include/CGAL/Spatial_sort_traits_adapter_d.h
deleted file mode 100644
index ad2ef1c..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Spatial_sort_traits_adapter_d.h
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright (c) 2011  GeometryFactory (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Sebastien Loriot
-
-
-#ifndef CGAL_SPATIAL_SORT_TRAITS_ADAPTER_D_H
-#define CGAL_SPATIAL_SORT_TRAITS_ADAPTER_D_H
-
-#include <boost/call_traits.hpp>
-#include <boost/version.hpp>
-#if BOOST_VERSION >= 104000
-  #include <boost/property_map/property_map.hpp>
-#else
-  #include <boost/property_map.hpp>
-#endif
-
-
-namespace CGAL{
-
-using ::get;
-  
-template<class Base_traits,class PointPropertyMap>
-class Spatial_sort_traits_adapter_d:public Base_traits{
-  PointPropertyMap ppmap_;
-public:
-  Spatial_sort_traits_adapter_d(Base_traits base=Base_traits()):Base_traits(base){}
-
-  Spatial_sort_traits_adapter_d(const PointPropertyMap& ppmap,Base_traits base=Base_traits())
-  :Base_traits(base),ppmap_(ppmap){}
-
-  typedef Base_traits Gt;
-  typedef typename boost::property_traits<PointPropertyMap>::key_type Point_d;
-  typedef typename boost::call_traits<Point_d>::param_type Arg_type;
-
-    
-    
-  struct Point_dimension_d: public Base_traits::Point_dimension_d{
-    Point_dimension_d(const PointPropertyMap& ppmap,const typename Base_traits::Point_dimension_d& base):
-      Base_traits::Point_dimension_d(base),ppmap_(ppmap){}
-    const PointPropertyMap& ppmap_;
-    int operator()(Arg_type p) const {
-      return static_cast<const typename Base_traits::Point_dimension_d*>(this)->operator()(get(ppmap_,p));
-    }
-  };
-
-  struct Less_coordinate_d: public Base_traits::Less_coordinate_d{
-    Less_coordinate_d(const PointPropertyMap& ppmap,const typename Base_traits::Less_coordinate_d& base):
-      Base_traits::Less_coordinate_d(base),ppmap_(ppmap){}
-    const PointPropertyMap& ppmap_;
-    bool operator()(Arg_type p,Arg_type q,int i) const {
-      return static_cast<const typename Base_traits::Less_coordinate_d*>(this)->operator()(get(ppmap_,p),get(ppmap_,q),i);
-    }
-  };
-
-
-  struct Compute_coordinate_d: public Base_traits::Compute_coordinate_d{
-    Compute_coordinate_d(const PointPropertyMap& ppmap,const typename Base_traits::Compute_coordinate_d& base):
-      Base_traits::Compute_coordinate_d(base),ppmap_(ppmap){}
-    const PointPropertyMap& ppmap_;
-    bool operator()(Arg_type p,int i) const {
-      return static_cast<const typename Base_traits::Compute_coordinate_d*>(this)->operator()(get(ppmap_,p),i);
-    }
-  };
- 
- 
-
-  Point_dimension_d point_dimension_d_object () const {return Point_dimension_d(ppmap_,static_cast<const Gt*>(this)->point_dimension_d_object() );}
-  Less_coordinate_d less_coordinate_d_object () const {return Less_coordinate_d(ppmap_,static_cast<const Gt*>(this)->less_coordinate_d_object() );}
-  Compute_coordinate_d compute_coordinate_d_object () const {return Compute_coordinate_d(ppmap_,static_cast<const Gt*>(this)->compute_coordinate_d_object() );}
-  
-  const PointPropertyMap& point_property_map() const {return ppmap_;}
-  
-};
-
-} //namespace CGAL
-
-#endif //CGAL_SPATIAL_SORT_TRAITS_ADAPTER_D_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sqrt_extension/Eigen_NumTraits.h b/3rdparty/CGAL-4.8/include/CGAL/Sqrt_extension/Eigen_NumTraits.h
deleted file mode 100644
index c9d28d8..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Sqrt_extension/Eigen_NumTraits.h
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (c) 2006-2008 Max-Planck-Institute Saarbruecken (Germany).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Michael Hemmer   <hemmer at mpi-inf.mpg.de>
-
-
-#ifndef CGAL_SQRT_EXTENSION_EIGEN_NUMTRAITS_H
-#define CGAL_SQRT_EXTENSION_EIGEN_NUMTRAITS_H
-
-namespace Eigen {
-  template<class> struct NumTraits;
-  template <class NT,class ROOT, class ACDE_TAG, class FP_TAG>
-  struct NumTraits<CGAL::Sqrt_extension<NT, ROOT, ACDE_TAG, FP_TAG> >
-  {
-    typedef CGAL::Sqrt_extension<NT, ROOT, ACDE_TAG, FP_TAG> Real;
-    typedef Real NonInteger;
-    typedef Real Nested;
-
-    static inline Real epsilon() { return NumTraits<NT>::epsilon(); }
-
-    enum {
-      IsInteger = 0,
-      IsSigned = 1,
-      IsComplex = 0,
-      RequireInitialization = 1,
-      ReadCost = 2*NumTraits<NT>::ReadCost+NumTraits<ROOT>::ReadCost,
-      AddCost = 2*NumTraits<NT>::AddCost+NumTraits<ROOT>::ReadCost,
-      MulCost = 5*NumTraits<NT>::MulCost+2*NumTraits<NT>::AddCost
-    };
-  };
-}
-
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Straight_skeleton_converter_2.h b/3rdparty/CGAL-4.8/include/CGAL/Straight_skeleton_converter_2.h
deleted file mode 100644
index 979d407..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Straight_skeleton_converter_2.h
+++ /dev/null
@@ -1,302 +0,0 @@
-// Copyright (c) 2005-2008 Fernando Luis Cacciola Carballal. 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
-// 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(s)     : Fernando Cacciola <fernando_cacciola at ciudad.com.ar>
-
-#ifndef CGAL_STRAIGHT_SKELETON_CONVERTER_2_H
-#define CGAL_STRAIGHT_SKELETON_CONVERTER_2_H 1
-
-#include <boost/shared_ptr.hpp>
-
-#include <CGAL/Straight_skeleton_2.h>
-
-namespace CGAL {
-
-template<class Source_skeleton_
-        ,class Target_skeleton_
-        ,class NT_converter = typename internal::Default_converter<typename Source_skeleton_::Traits
-                                                               ,typename Target_skeleton_::Traits
-                                                               >::Type 
-        >
-struct Straight_skeleton_items_converter_2: Cartesian_converter< typename Source_skeleton_::Traits
-                                                               , typename Target_skeleton_::Traits
-                                                               , NT_converter
-                                                               >
-{
-  typedef Source_skeleton_ Source_skeleton ;
-  typedef Target_skeleton_ Target_skeleton ;
-  
-  typedef typename Source_skeleton::Traits Source_traits ;
-  typedef typename Target_skeleton::Traits Target_traits ;
-  
-  typedef Cartesian_converter<Source_traits,Target_traits> Base ;
-  
-  typedef typename Source_skeleton::Vertex_const_handle   Source_vertex_const_handle ;
-  typedef typename Source_skeleton::Halfedge_const_handle Source_halfedge_const_handle ;
-  typedef typename Source_skeleton::Face_const_handle     Source_face_const_handle  ;
-  
-  typedef typename Target_skeleton::Vertex    Target_vertex ;
-  typedef typename Target_skeleton::Halfedge  Target_halfedge ;
-  typedef typename Target_skeleton::Face      Target_face ;
-  
-  Target_vertex operator() ( Source_vertex_const_handle aV ) const 
-  {
-    CGAL_assertion( handle_assigned(aV) ) ;
-    
-    return Target_vertex( aV->id()
-                        , this->Base::operator()(aV->point())
-                        , this->Base::operator()(aV->time ())
-                        , aV->is_split()
-                        , aV->has_infinite_time()
-                        ) ;
-  }
-  
-  Target_halfedge operator() ( Source_halfedge_const_handle aH ) const 
-  {
-    CGAL_assertion( handle_assigned(aH) ) ;
-    
-    return Target_halfedge( aH->id(), aH->slope() ) ;
-  }
-  
-  Target_face operator() ( Source_face_const_handle aF ) const 
-  {
-    CGAL_assertion( handle_assigned(aF) ) ;
-    
-    return Target_face( aF->id() );
-  }
-} ;
-
-template<class Source_skeleton_, class Target_skeleton_, class Items_converter_>
-struct Straight_skeleton_converter_2
-{
-  typedef Source_skeleton_ Source_skeleton ;
-  typedef Target_skeleton_ Target_skeleton ;
-  typedef Items_converter_ Items_converter ;
-  
-  typedef typename Source_skeleton::Traits Source_traits ;
-  typedef typename Target_skeleton::Traits Target_traits ;
-  
-  typedef boost::shared_ptr<Target_skeleton> Target_skeleton_ptr ;
-  
-  typedef typename Source_skeleton::Vertex_const_iterator   Source_vertex_const_iterator ;
-  typedef typename Source_skeleton::Halfedge_const_iterator Source_halfedge_const_iterator ;
-  typedef typename Source_skeleton::Face_const_iterator     Source_face_const_iterator  ;
-  
-  typedef typename Source_skeleton::Halfedge_handle Source_halfedge_handle ;
-  
-  typedef typename Target_skeleton::Vertex   Target_vertex ;
-  typedef typename Target_skeleton::Halfedge Target_halfedge ;
-  typedef typename Target_skeleton::Face     Target_face ;
-  
-  typedef typename Target_skeleton::Vertex_handle   Target_vertex_handle ;
-  typedef typename Target_skeleton::Halfedge_handle Target_halfedge_handle ;
-  typedef typename Target_skeleton::Face_handle     Target_face_handle  ;
-  
-  typedef typename Target_skeleton::Vertex_iterator   Target_vertex_iterator ;
-  typedef typename Target_skeleton::Halfedge_iterator Target_halfedge_iterator ;
-  typedef typename Target_skeleton::Face_iterator     Target_face_iterator  ;
-
-  typedef typename Target_skeleton::Base      SlsBase ;
-  typedef typename Target_halfedge::Base_base HBase_base ;
-  typedef typename Target_halfedge::Base      HBase ;
-  typedef typename Target_vertex::Base        VBase ;
-  typedef typename Target_face::Base          FBase ;
-  
-  typedef CGAL_SS_i::Triedge<Source_halfedge_handle> Source_triedge ;
-  typedef CGAL_SS_i::Triedge<Target_halfedge_handle> Target_triedge ;
-  
-  Straight_skeleton_converter_2 ( Items_converter const& aCvt = Items_converter() )
-    :
-    cvt(aCvt)
-  {}
-  
-  Target_skeleton_ptr operator() ( Source_skeleton const& aSkeleton ) const
-  {
-    CGAL_assertion(aSkeleton.is_valid());
-    Target_skeleton_ptr rResult = create_unconnected_copy(aSkeleton);
-    connect_items(aSkeleton,*rResult);
-    CGAL_assertion(rResult->is_valid());
-    return rResult ;
-  }
-  
-private :
-  
-  Target_skeleton_ptr create_unconnected_copy ( Source_skeleton const& aSource ) const
-  {
-    Target_skeleton_ptr rCopy ( new Target_skeleton ) ;
-    
-    int lMaxVID =-1, lMaxHID = -1, lMaxFID = -1 ;
-    
-    for ( Source_vertex_const_iterator vit = aSource.vertices_begin(); vit != aSource.vertices_end(); ++ vit )
-      if ( vit->id() > lMaxVID )
-        lMaxVID = vit->id();
-        
-    for ( Source_halfedge_const_iterator hit = aSource.halfedges_begin(); hit != aSource.halfedges_end(); ++ hit )
-      if ( hit->id() > lMaxHID )
-        lMaxHID = hit->id();
-        
-    for ( Source_face_const_iterator fit = aSource.faces_begin(); fit != aSource.faces_end(); ++ fit )
-      if ( fit->id() > lMaxFID )
-        lMaxFID = fit->id();
-    
-    Target_vertices .clear();
-    Target_halfedges.clear();
-    Target_faces    .clear();
-    Target_vertices .resize(lMaxVID+1);
-    Target_halfedges.resize(lMaxHID+1);
-    Target_faces    .resize(lMaxFID+1);
-    
-    for ( Source_vertex_const_iterator vit = aSource.vertices_begin(); vit != aSource.vertices_end(); ++ vit )
-    {
-      Target_vertex_handle tv = rCopy->SlsBase::vertices_push_back( cvt(vit) ) ; 
-       
-      Target_vertices.at(tv->id()) = tv ;
-    }  
-      
-    for ( Source_halfedge_const_iterator hit = aSource.halfedges_begin(); hit != aSource.halfedges_end(); ++ hit )
-    {
-      Target_halfedge_handle    th = rCopy->SlsBase::edges_push_back( cvt(hit), cvt(hit->opposite()) ) ; 
-      Target_halfedge_handle oppth = th->opposite();
-      
-      Target_halfedges.at(   th->id()) = th ;
-      Target_halfedges.at(oppth->id()) = oppth ;
-      
-      ++ hit ;
-    } 
-    
-    for ( Source_face_const_iterator fit = aSource.faces_begin(); fit != aSource.faces_end(); ++ fit )
-    {
-      Target_face_handle tf = rCopy->SlsBase::faces_push_back( cvt(fit) ) ; 
-      
-      Target_faces.at(tf->id()) = tf ;
-    }  
-    
-    return rCopy ;
-  }
-  
-  void connect_items ( Source_skeleton const& aSource, Target_skeleton& aTarget ) const
-  {
-    Target_vertex_iterator tvit = aTarget.vertices_begin();
-    for ( Source_vertex_const_iterator svit = aSource.vertices_begin(); svit != aSource.vertices_end(); ++ svit, ++ tvit )
-    {
-      CGAL_assertion( handle_assigned(svit) ) ;
-      CGAL_assertion( handle_assigned(svit->halfedge()) ) ;
-      
-      Target_halfedge_handle tgt_halfedge = Target_halfedges.at(svit->halfedge()->id());
-          
-      CGAL_assertion( handle_assigned(tgt_halfedge) ) ;
-      tvit->VBase::set_halfedge(tgt_halfedge);
-      
-      Target_halfedge_handle tgt_striedge_e0, tgt_striedge_e1, tgt_striedge_e2 ;
-      
-      Source_triedge const& stri = svit->event_triedge() ;
-      
-      if ( handle_assigned(stri.e0()) )
-        tgt_striedge_e0 = Target_halfedges.at(stri.e0()->id());
-        
-      if ( handle_assigned(stri.e1()) )
-        tgt_striedge_e1 = Target_halfedges.at(stri.e1()->id());
-      
-      if ( handle_assigned(stri.e2()) )
-        tgt_striedge_e2 = Target_halfedges.at(stri.e2()->id());
-        
-      tvit->VBase::set_event_triedge( Target_triedge(tgt_striedge_e0, tgt_striedge_e1, tgt_striedge_e2) ) ;
-    }
-    
-    Target_halfedge_iterator thit = aTarget.halfedges_begin();
-    for ( Source_halfedge_const_iterator shit = aSource.halfedges_begin(); shit != aSource.halfedges_end(); ++ shit, ++ thit )
-    {
-      CGAL_assertion( handle_assigned(shit->opposite()) ) ;
-      CGAL_assertion( handle_assigned(shit->next    ()) ) ;
-      CGAL_assertion( handle_assigned(shit->prev    ()) ) ;
-      CGAL_assertion( handle_assigned(shit->vertex  ()) ) ;
-      
-      Target_halfedge_handle tgt_opposite = Target_halfedges.at(shit->opposite()->id());
-      Target_halfedge_handle tgt_next     = Target_halfedges.at(shit->next    ()->id());
-      Target_halfedge_handle tgt_prev     = Target_halfedges.at(shit->prev    ()->id());
-      Target_vertex_handle   tgt_vertex   = Target_vertices .at(shit->vertex  ()->id());
-      
-      CGAL_assertion( handle_assigned(tgt_opposite) ) ;
-      CGAL_assertion( handle_assigned(tgt_next)     ) ;
-      CGAL_assertion( handle_assigned(tgt_prev)     ) ;
-      CGAL_assertion( handle_assigned(tgt_vertex)   ) ;
-      
-      thit->HBase_base::set_opposite (tgt_opposite);
-      thit->HBase_base::set_next     (tgt_next);
-      thit->HBase_base::set_prev     (tgt_prev);
-      thit->HBase_base::set_vertex   (tgt_vertex);
-      
-      if ( handle_assigned(shit->face()) )
-      {
-        Target_face_handle tgt_face = Target_faces.at(shit->face()->id());
-        CGAL_assertion( handle_assigned(tgt_face) ) ;
-        thit->HBase_base::set_face(tgt_face);
-      }
-     }  
-    
-    Target_face_iterator tfit = aTarget.faces_begin();
-    for ( Source_face_const_iterator sfit = aSource.faces_begin(); sfit != aSource.faces_end(); ++ sfit, ++ tfit )
-    {
-      CGAL_assertion( handle_assigned(sfit->halfedge()) ) ;
-      
-      Target_halfedge_handle tgt_halfedge = Target_halfedges.at(sfit->halfedge()->id());
-          
-      CGAL_assertion( handle_assigned(tgt_halfedge) ) ;
-      
-      tfit->FBase::set_halfedge(tgt_halfedge);
-    }  
-  }
-  
-  Items_converter const& cvt ;
-  
-  mutable std::vector<Target_vertex_handle>   Target_vertices ;
-  mutable std::vector<Target_halfedge_handle> Target_halfedges;
-  mutable std::vector<Target_face_handle>     Target_faces    ;
-  
-} ;
-
-template<class Target_skeleton, class Source_skeleton, class Items_converter>
-boost::shared_ptr<Target_skeleton> 
-convert_straight_skeleton_2 ( Source_skeleton const& aSrc, Items_converter const& ic )
-{
-  typedef Straight_skeleton_converter_2<Source_skeleton,Target_skeleton,Items_converter> Skeleton_converter ;
-  
-  Skeleton_converter c(ic) ;
-  
-  return c(aSrc);
-    
-}
-
-template<class Target_skeleton, class Source_skeleton>
-boost::shared_ptr<Target_skeleton> 
-convert_straight_skeleton_2 ( Source_skeleton const& aSrc )
-{
-  typedef Straight_skeleton_items_converter_2<Source_skeleton,Target_skeleton> Items_converter ;
-  
-  typedef Straight_skeleton_converter_2<Source_skeleton,Target_skeleton,Items_converter> Skeleton_converter ;
-  
-  Skeleton_converter c ;
-  
-  return c(aSrc);
-    
-}
-
-} // end namespace CGAL
-
-
-#endif // CGAL_STRAIGHT_SKELETON_2_CONVERTER_H //
-// EOF //
-
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh/Properties.h b/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh/Properties.h
deleted file mode 100644
index e4bd63e..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh/Properties.h
+++ /dev/null
@@ -1,481 +0,0 @@
-//=============================================================================
-// Copyright (C) 2001-2005 by Computer Graphics Group, RWTH Aachen
-// Copyright (C) 2011 by Graphics & Geometry Group, Bielefeld University
-// Copyright (C) 2014 GeometryFactory
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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.
-//
-
-
-#ifndef CGAL_SURFACE_MESH_PROPERTY_H
-#define CGAL_SURFACE_MESH_PROPERTY_H
-
-#include <vector>
-#include <string>
-#include <algorithm>
-#include <typeinfo>
-
-#include <boost/property_map/property_map.hpp>
-
-#include <CGAL/assertions.h>
-
-namespace CGAL {
-
-#ifndef DOXYGEN_RUNNING
-
-/// \addtogroup PkgSurface_mesh
-///
-/// @{
-
-/// @cond CGAL_DOCUMENT_INTERNALS
-class Base_property_array
-{
-public:
-
-    /// Default constructor
-    Base_property_array(const std::string& name) : name_(name) {}
-
-    /// Destructor.
-    virtual ~Base_property_array() {}
-
-    /// Reserve memory for n elements.
-    virtual void reserve(size_t n) = 0;
-
-    /// Resize storage to hold n elements.
-    virtual void resize(size_t n) = 0;
-
-    /// Free unused memory.
-    virtual void shrink_to_fit() = 0;
-
-    /// Extend the number of elements by one.
-    virtual void push_back() = 0;
-
-    /// Let two elements swap their storage place.
-    virtual void swap(size_t i0, size_t i1) = 0;
-
-    /// Return a deep copy of self.
-    virtual Base_property_array* clone () const = 0;
-
-    /// Return the type_info of the property
-    virtual const std::type_info& type() = 0;
-
-    /// Return the name of the property
-    const std::string& name() const { return name_; }
-
-
-protected:
-
-    std::string name_;
-};
-
-  /// @endcond
-
-
-//== CLASS DEFINITION =========================================================
-
-/// @cond CGAL_DOCUMENT_INTERNALS
-
-template <class T>
-class Property_array : public Base_property_array
-{
-public:
-
-    typedef T                                       value_type;
-    typedef std::vector<value_type>                 vector_type;
-    typedef typename vector_type::reference         reference;
-    typedef typename vector_type::const_reference   const_reference;
-
-    Property_array(const std::string& name, T t=T()) : Base_property_array(name), value_(t) {}
-
-public: // virtual interface of Base_property_array
-
-    virtual void reserve(size_t n)
-    {
-        data_.reserve(n);
-    }
-
-    virtual void resize(size_t n)
-    {
-        data_.resize(n, value_);
-    }
-
-    virtual void push_back()
-    {
-        data_.push_back(value_);
-    }
-
-    virtual void shrink_to_fit()
-    {
-        vector_type(data_).swap(data_);
-    }
-
-    virtual void swap(size_t i0, size_t i1)
-    {
-        T d(data_[i0]);
-        data_[i0]=data_[i1];
-        data_[i1]=d;
-    }
-
-    virtual Base_property_array* clone() const
-    {
-        Property_array<T>* p = new Property_array<T>(name_, value_);
-        p->data_ = data_;
-        return p;
-    }
-
-    virtual const std::type_info& type() { return typeid(T); }
-
-
-public:
-
-    /// Get pointer to array (does not work for T==bool)
-    const T* data() const
-    {
-        return &data_[0];
-    }
-
-    /// Access the i'th element. No range check is performed!
-    reference operator[](int _idx)
-    {
-        CGAL_assertion( size_t(_idx) < data_.size() );
-        return data_[_idx];
-    }
-
-    /// Const access to the i'th element. No range check is performed!
-    const_reference operator[](int _idx) const
-    {
-        CGAL_assertion( size_t(_idx) < data_.size());
-        return data_[_idx];
-    }
-
-
-
-private:
-    vector_type data_;
-    value_type  value_;
-};
-
-  /// @endcond
-
-// specialization for bool properties
-template <>
-inline const bool*
-Property_array<bool>::data() const
-{
-    CGAL_assertion(false);
-    return NULL;
-}
-
-
-
-//== CLASS DEFINITION =========================================================
-
-/// @cond CGAL_DOCUMENT_INTERNALS
-
-template<typename>
-class Property_container;
-/// @endcond 
-
-
-
-
-//== CLASS DEFINITION =========================================================
-/// @cond CGAL_DOCUMENT_INTERNALS
-
-template <class, class>
-class Property_map;
-
-template<typename Key>
-class Property_container
-{
-public:
-
-    // default constructor
-    Property_container() : size_(0) {}
-
-    // destructor (deletes all property arrays)
-    virtual ~Property_container() { clear(); }
-
-    // copy constructor: performs deep copy of property arrays
-    Property_container(const Property_container& _rhs) { operator=(_rhs); }
-
-    // assignment: performs deep copy of property arrays
-    Property_container& operator=(const Property_container& _rhs)
-    {
-        if (this != &_rhs)
-        {
-            clear();
-            parrays_.resize(_rhs.n_properties());
-            size_ = _rhs.size();
-            for (unsigned int i=0; i<parrays_.size(); ++i)
-                parrays_[i] = _rhs.parrays_[i]->clone();
-        }
-        return *this;
-    }
-
-    // returns the current size of the property arrays
-    size_t size() const { return size_; }
-
-    // returns the number of property arrays
-    size_t n_properties() const { return parrays_.size(); }
-
-    // returns a vector of all property names
-    std::vector<std::string> properties() const
-    {
-        std::vector<std::string> names;
-        for (unsigned int i=0; i<parrays_.size(); ++i)
-            names.push_back(parrays_[i]->name());
-        return names;
-    }
-
-    // add a property with name \c name and default value \c t
-    template <class T> 
-    std::pair<Property_map<Key, T>,bool>
-    add(const std::string& name, const T t=T())
-    {
-        // if a property with this name already exists, return it
-        for (unsigned int i=0; i<parrays_.size(); ++i)
-        {
-            if (parrays_[i]->name() == name)
-            {
-              return std::make_pair(Property_map<Key, T>(dynamic_cast<Property_array<T>*>(parrays_[i])), true);
-            }
-        }
-
-        // otherwise add the property
-        Property_array<T>* p = new Property_array<T>(name, t);
-        p->resize(size_);
-        parrays_.push_back(p);
-        return std::make_pair(Property_map<Key, T>(p),false);
-    }
-
-
-    // get a property by its name. returns invalid property if it does not exist.
-    template <class T> Property_map<Key, T> get(const std::string& name) const
-    {
-        for (unsigned int i=0; i<parrays_.size(); ++i)
-            if (parrays_[i]->name() == name)
-                return Property_map<Key, T>(dynamic_cast<Property_array<T>*>(parrays_[i]));
-        return Property_map<Key, T>();
-    }
-
-
-    // returns a property if it exists, otherwise it creates it first.
-    template <class T> Property_map<Key, T> get_or_add(const std::string& name, const T t=T())
-    {
-        Property_map<Key, T> p = get<T>(name);
-        if (!p) p = add<T>(name, t);
-        return p;
-    }
-
-
-    // get the type of property by its name. returns typeid(void) if it does not exist.
-    const std::type_info& get_type(const std::string& name)
-    {
-        for (unsigned int i=0; i<parrays_.size(); ++i)
-            if (parrays_[i]->name() == name)
-                return parrays_[i]->type();
-        return typeid(void);
-    }
-
-
-    // delete a property
-    template <class T> void remove(Property_map<Key, T>& h)
-    {
-        std::vector<Base_property_array*>::iterator it=parrays_.begin(), end=parrays_.end();
-        for (; it!=end; ++it)
-        {
-            if (*it == h.parray_)
-            {
-                delete *it;
-                parrays_.erase(it);
-                h.reset();
-                break;
-            }
-        }
-    }
-
-
-    // delete all properties
-    void clear()
-    {
-        for (unsigned int i=0; i<parrays_.size(); ++i)
-            delete parrays_[i];
-        parrays_.clear();
-        size_ = 0;
-    }
-
-
-    // reserve memory for n entries in all arrays
-    void reserve(size_t n) const
-    {
-        for (unsigned int i=0; i<parrays_.size(); ++i)
-            parrays_[i]->reserve(n);
-    }
-
-    // resize all arrays to size n
-    void resize(size_t n)
-    {
-        for (unsigned int i=0; i<parrays_.size(); ++i)
-            parrays_[i]->resize(n);
-        size_ = n;
-    }
-
-    // free unused space in all arrays
-    void shrink_to_fit() const
-    {
-        for (unsigned int i=0; i<parrays_.size(); ++i)
-            parrays_[i]->shrink_to_fit();
-    }
-
-    // add a new element to each vector
-    void push_back()
-    {
-        for (unsigned int i=0; i<parrays_.size(); ++i)
-            parrays_[i]->push_back();
-        ++size_;
-    }
-
-    // swap elements i0 and i1 in all arrays
-    void swap(size_t i0, size_t i1) const
-    {
-        for (unsigned int i=0; i<parrays_.size(); ++i)
-            parrays_[i]->swap(i0, i1);
-    }
-
-
-private:
-    std::vector<Base_property_array*>  parrays_;
-    size_t  size_;
-};
-
-  /// @endcond
-
-///
-/// `Property_map` enables to attach properties to the simplices of a 
-///  surface mesh.
-/// 
-/// @tparam Key The key type of the property map. It must be a model of `Index`.
-/// @tparam Value The value type of the property.
-///
-/// \cgalModels `LvaluePropertyMap`
-///
-template <class I, class T>
-class Property_map
-/// @cond CGAL_DOCUMENT_INTERNALS
-  : public boost::put_get_helper< 
-           typename Property_array<T>::reference,
-           Property_map< I, T > >
-/// @endcond
-{
-    typedef void (Property_map::*bool_type)() const;
-    void this_type_does_not_support_comparisons() const {}
-public:
-    typedef I key_type;
-    typedef T value_type;
-    typedef boost::lvalue_property_map_tag category;
-
-#ifndef DOXYGEN_RUNNING
-
-    typedef typename Property_array<T>::reference reference;
-
-    typedef typename Property_array<T>::const_reference const_reference;
-#else 
-    /// A reference to the value type of the property.
-  typedef unspecified_type reference;
-
-    /// A const reference to the value type of the property.
-  typedef unspecified_type const_reference;
-#endif
-
-#ifndef DOXYGEN_RUNNING
-    friend class Property_container<I>;
-
-    template <typename K>  friend class Surface_mesh;
-#endif
-
-public:
-/// @cond CGAL_DOCUMENT_INTERNALS
-    Property_map(Property_array<T>* p=NULL) : parray_(p) {}
-
-    void reset()
-    {
-        parray_ = NULL;
-    }
-  /// @endcond 
-
-public:
-    /// \name Accessing Properties
-    //@{
-#ifdef DOXYGEN_RUNNING
-    /// Conversion to a Boolean. It is \c true when the property map
-    /// can be used, and \c false otherwise.  
-  operator bool () const;
-#else
-    operator bool_type() const {
-        return parray_ != NULL ?
-            &Property_map::this_type_does_not_support_comparisons : 0;
-    }
-#endif
-    /// Access the property associated with the key \c i.
-    reference operator[](const I& i)
-    {
-      CGAL_assertion(parray_ != NULL);
-      return (*parray_)[i.idx()];
-    }
-
-    /// Access the property associated with the key \c i.
-    reference operator[](const I& i) const
-    {
-      CGAL_assertion(parray_ != NULL);
-      return (*parray_)[i.idx()];
-    }
-
-    /// Allows access to the underlying storage of the property. This
-    /// is useful when the key associated with the properties is
-    /// unimportant and only the properties are of interest
-    /// (e.g. rendering).
-    ///
-    /// \returns a pointer to the underlying storage of the property.
-    const T* data() const
-    {
-      CGAL_assertion(parray_ != NULL);
-      return parray_->data();
-    }
-
-    //@}
-private:
-
-    Property_array<T>& array()
-    {
-        CGAL_assertion(parray_ != NULL);
-        return *parray_;
-    }
-
-    const Property_array<T>& array() const
-    {
-        CGAL_assertion(parray_ != NULL);
-        return *parray_;
-    }
-
-    Property_array<T>* parray_;
-};
-
-
-
-///@}
-#endif // DOXYGEN_RUNNING  
-} // CGAL
-
-//=============================================================================
-#endif // CGAL_SURFACE_MESH_PROPERTY_H
-//=============================================================================
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh/Surface_mesh.h b/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh/Surface_mesh.h
deleted file mode 100644
index 00444fe..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh/Surface_mesh.h
+++ /dev/null
@@ -1,3037 +0,0 @@
-//=============================================================================
-// Copyright (C) 2001-2005 by Computer Graphics Group, RWTH Aachen
-// Copyright (C) 2011 by Graphics & Geometry Group, Bielefeld University
-// Copyright (C) 2014 GeometryFactory
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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.
-//
-
-
-#ifndef CGAL_SURFACE_MESH_H
-#define CGAL_SURFACE_MESH_H
-
-#include <iterator>
-#include <algorithm>
-#include <utility>
-#include <iostream>
-#include <cstddef>
-#include <vector>
-#include <string>
-#include <typeinfo>
-#include <functional>
-
-#include <boost/cstdint.hpp>
-#include <boost/array.hpp>
-#include <boost/iterator/iterator_facade.hpp>
-#include <boost/foreach.hpp>
-#include <boost/property_map/property_map.hpp>
-
-#include <CGAL/Iterator_range.h>
-#include <CGAL/circulator.h>
-#include <CGAL/assertions.h>
-#include <CGAL/Surface_mesh/Surface_mesh_fwd.h>
-#include <CGAL/Surface_mesh/IO.h>
-//#include <CGAL/Surface_mesh/Properties.h>
-#include <CGAL/boost/graph/graph_traits_Surface_mesh.h>
-#include <CGAL/boost/graph/iterator.h>
-#include <CGAL/boost/graph/Euler_operations.h>
-
-namespace CGAL {
-
-
-#ifndef DOXYGEN_RUNNING
-    /// Base class for vertex, halfedge, edge, and face index. 
-    ///
-    /// \attention Note that `Index` is not a model of the concept `Handle`,
-    /// because it cannot be dereferenced.
-    /// \sa `Vertex_index`, `Halfedge_index`, `Edge_index`, `Face_index`.
-    template<typename T>
-    class SM_Index
-    {
-    public:
-    typedef boost::uint32_t size_type;
-        /// Constructor. %Default construction creates an invalid index.
-        /// We write -1, which is <a href="http://en.cppreference.com/w/cpp/concept/numeric_limits">
-        /// <tt>std::numeric_limits<size_type>::max()</tt></a>
-        /// as `size_type` is an unsigned type. 
-        explicit SM_Index(size_type _idx=-1) : idx_(_idx) {}
-
-        /// Get the underlying index of this index
-        operator size_type() const { return idx_; }
-
-        /// reset index to be invalid (index=-1)
-        void reset() { idx_=-1; }
-
-        /// return whether the index is valid, i.e., the index is not equal to -1.
-        bool is_valid() const { 
-          size_type inf = -1;
-          return idx_ != inf;
-        }
-
-        /// are two indices equal?
-        bool operator==(const T& _rhs) const {
-            return idx_ == _rhs.idx_;
-        }
-
-        /// are two indices different?
-        bool operator!=(const T& _rhs) const {
-            return idx_ != _rhs.idx_;
-        }
-
-        /// Comparison by index.
-        bool operator<(const T& _rhs) const {
-            return idx_ < _rhs.idx_;
-        }
-
-        /// increments the internal index. This operation does not
-        /// guarantee that the index is valid or undeleted after the
-        /// increment.
-        SM_Index& operator++() { ++idx_; return *this; }
-        /// decrements the internal index. This operation does not
-        /// guarantee that the index is valid or undeleted after the
-        /// decrement.
-        SM_Index& operator--() { --idx_; return *this; }
-
-        /// increments the internal index. This operation does not
-        /// guarantee that the index is valid or undeleted after the
-        /// increment.
-        SM_Index operator++(int) { SM_Index tmp(*this); ++idx_; return tmp; }
-        /// decrements the internal index. This operation does not
-        /// guarantee that the index is valid or undeleted after the
-        /// decrement.
-        SM_Index operator--(int) { SM_Index tmp(*this); --idx_; return tmp; }
-
-
-      
-     
-      
-    private:
-        size_type idx_;
-    };
-
-  template <class T>
-  std::size_t hash_value(const SM_Index<T>&  i)
-  {
-    std::size_t ret = i;
-    return ret;
-  }
-
-    // Implementation for Surface_mesh::Vertex_index
- 
-    class SM_Vertex_index
- : public SM_Index<SM_Vertex_index>
-    {
-    public:
-
-        SM_Vertex_index() : SM_Index<SM_Vertex_index>(-1) {}
-
-        explicit SM_Vertex_index(size_type _idx) : SM_Index<SM_Vertex_index>(_idx) {}
-
-
-        friend std::ostream& operator<<(std::ostream& os, SM_Vertex_index const& v)
-        {
-          return (os << 'v' << (size_type)v );
-        }
-    };
-
-    // Implementation of Surface_mesh::Halfedge_index
-    class SM_Halfedge_index
-      : public SM_Index<SM_Halfedge_index>
-    {
-    public:
-
-        // Workaround for a bug in g++4.4 in ADL for function next:
-        // we provide the types needed for std::iterator_traits<Surface_mesh::halfedge_index>,
-        // although this descriptor is not an iterator.
-        typedef void iterator_category;
-        typedef void value_type;
-        typedef void difference_type;
-        typedef void pointer;
-        typedef void reference;
-
-        SM_Halfedge_index() : SM_Index<SM_Halfedge_index>(-1) {}
-
-        explicit SM_Halfedge_index(size_type _idx) : SM_Index<SM_Halfedge_index>(_idx) {}
-
-        friend std::ostream& operator<<(std::ostream& os, SM_Halfedge_index const& h)
-        {
-          return (os << 'h' << (size_type)h );
-        }
-    };
-
-    /// Implementation of Surfae_mesh::Face_index
-    class SM_Face_index
-      : public SM_Index<SM_Face_index>
-    {
-    public:
-
-        SM_Face_index() : SM_Index<SM_Face_index>(-1) {}
-
-        explicit SM_Face_index(size_type _idx) : SM_Index<SM_Face_index>(_idx) {}
-
-
-        friend std::ostream& operator<<(std::ostream& os, SM_Face_index const& f)
-        {
-          return (os << 'f' << (size_type)f );
-        }
-    };
-
-    /// Implementation of Surface_mesh::Edge_index
-    class SM_Edge_index
-    {
-    public:
-        typedef boost::uint32_t size_type;
-
-        SM_Edge_index() : halfedge_(-1) { }
-
-        SM_Edge_index(size_type idx) : halfedge_(idx * 2) { }
-
-
-        SM_Edge_index(SM_Halfedge_index he) : halfedge_(he) { }
-
-        // returns the internal halfedge.
-        SM_Halfedge_index halfedge() const { return halfedge_; }
-
-        // returns the underlying index of this index.
-        operator size_type() const { return (size_type)halfedge_ / 2; }
-
-        // resets index to be invalid (index=-1)
-        void reset() { halfedge_.reset(); }
-
-        // returns whether the index is valid, i.e., the index is not equal to -1.
-        bool is_valid() const { return halfedge_.is_valid(); }
-
-        // Are two indices equal?
-        bool operator==(const SM_Edge_index& other) const { return (size_type)(*this) == (size_type)other; }
-
-        // Are two indices different?
-        bool operator!=(const SM_Edge_index& other) const { return (size_type)(*this) != (size_type)other; }
-
-        // compares by index.
-        bool operator<(const SM_Edge_index& other) const { return (size_type)(*this) < (size_type)other;}
-
-        // decrements the internal index. This operation does not
-        // guarantee that the index is valid or undeleted after the
-        // decrement.
-        SM_Edge_index& operator--() { halfedge_ = SM_Halfedge_index((size_type)halfedge_ - 2); return *this; }
-
-        // increments the internal index. This operation does not
-        // guarantee that the index is valid or undeleted after the
-        // increment.
-        SM_Edge_index& operator++() { halfedge_ = SM_Halfedge_index((size_type)halfedge_ + 2); return *this; }
-
-        // decrements internal index. This operation does not
-        // guarantee that the index is valid or undeleted after the
-        // decrement.
-        SM_Edge_index operator--(int) { SM_Edge_index tmp(*this); halfedge_ = SM_Halfedge_index((size_type)halfedge_ - 2); return tmp; }
-
-        // increments internal index. This operation does not
-        // guarantee that the index is valid or undeleted after the
-        // increment.
-        SM_Edge_index operator++(int) { SM_Edge_index tmp(*this); halfedge_ = SM_Halfedge_index((size_type)halfedge_ + 2); return tmp; }
-
-
-      // prints the index and a short identification string to an ostream.
-        friend std::ostream& operator<<(std::ostream& os, SM_Edge_index const& e)
-        {
-          return (os << 'e' << (size_type)e << " on " << e.halfedge());
-        }
-
-        friend  std::size_t hash_value(const SM_Edge_index&  i)
-        {
-          return i;
-        }
-
-    private:
-        SM_Halfedge_index halfedge_;
-    };
-#endif
-
-  /// \ingroup PkgSurface_mesh
-  /// This class is a data structure that can be used as halfedge data structure or polyhedral
-  /// surface. It is an alternative to the classes `HalfedgeDS` and `Polyhedron_3`
-  /// defined in the packages  \ref PkgHDSSummary and \ref PkgPolyhedronSummary. 
-  /// The main difference is that it is indexed based and not pointer based,
-  /// and that the mechanism for adding information to vertices, halfedges, edges,
-  /// and faces is much simpler and done at runtime and not at compile time.
-  /// When elements are removed, they are only marked as removed, and a garbage
-  /// collection function must be called to really remove them. 
-  /// @tparam P The type of the \em point property of a vertex. There is no requirement on `P`,
-  ///         besides being default constructible and assignable. 
-  ///         In typical use cases it will be a 2D or 3D point type.
-  /// \cgalModels `MutableFaceGraph` and `FaceListGraph`
-
-template <typename P>
-class Surface_mesh
-{
-
-    typedef Surface_mesh<P> Self;
-
-    template<typename>
-    class Handle_iterator;
-public:
-
-
-
-/// \addtogroup PkgSurface_mesh
-///
-/// @{
-
-/// @cond CGAL_DOCUMENT_INTERNALS
-class Base_property_array
-{
-public:
-
-    /// Default constructor
-    Base_property_array(const std::string& name) : name_(name) {}
-
-    /// Destructor.
-    virtual ~Base_property_array() {}
-
-    /// Reserve memory for n elements.
-    virtual void reserve(size_t n) = 0;
-
-    /// Resize storage to hold n elements.
-    virtual void resize(size_t n) = 0;
-
-    /// Free unused memory.
-    virtual void shrink_to_fit() = 0;
-
-    /// Extend the number of elements by one.
-    virtual void push_back() = 0;
-
-    virtual bool transfer(const Base_property_array& other) = 0;
-
-    /// Let two elements swap their storage place.
-    virtual void swap(size_t i0, size_t i1) = 0;
-
-    /// Return a deep copy of self.
-    virtual Base_property_array* clone () const = 0;
-
-    /// Return the type_info of the property
-    virtual const std::type_info& type() = 0;
-
-    /// Return the name of the property
-    const std::string& name() const { return name_; }
-
-
-protected:
-
-    std::string name_;
-};
-
-  /// @endcond
-
-
-//== CLASS DEFINITION =========================================================
-
-/// @cond CGAL_DOCUMENT_INTERNALS
-
-template <class T>
-class Property_array : public Base_property_array
-{
-public:
-
-    typedef T                                       value_type;
-    typedef std::vector<value_type>                 vector_type;
-    typedef typename vector_type::reference         reference;
-    typedef typename vector_type::const_reference   const_reference;
-
-    Property_array(const std::string& name, T t=T()) : Base_property_array(name), value_(t) {}
-
-public: // virtual interface of Base_property_array
-
-    virtual void reserve(size_t n)
-    {
-        data_.reserve(n);
-    }
-
-    virtual void resize(size_t n)
-    {
-        data_.resize(n, value_);
-    }
-
-    virtual void push_back()
-    {
-        data_.push_back(value_);
-    }
-
-    bool transfer(const Base_property_array& other)
-    {
-      const Property_array<T>* pa = dynamic_cast<const Property_array*>(&other);
-      if(pa != NULL){
-        std::copy((*pa).data_.begin(), (*pa).data_.end(), data_.end()-(*pa).data_.size());
-        return true;
-      } 
-      return false;
-    }
-
-    virtual void shrink_to_fit()
-    {
-        vector_type(data_).swap(data_);
-    }
-
-    virtual void swap(size_t i0, size_t i1)
-    {
-        T d(data_[i0]);
-        data_[i0]=data_[i1];
-        data_[i1]=d;
-    }
-
-    virtual Base_property_array* clone() const
-    {
-        Property_array<T>* p = new Property_array<T>(this->name_, this->value_);
-        p->data_ = data_;
-        return p;
-    }
-
-    virtual const std::type_info& type() { return typeid(T); }
-
-
-public:
-
-    /// Get pointer to array (does not work for T==bool)
-    const T* data() const
-    {
-        return &data_[0];
-    }
-
-    /// Access the i'th element. No range check is performed!
-    reference operator[](int _idx)
-    {
-        CGAL_assertion( size_t(_idx) < data_.size() );
-        return data_[_idx];
-    }
-
-    /// Const access to the i'th element. No range check is performed!
-    const_reference operator[](int _idx) const
-    {
-        CGAL_assertion( size_t(_idx) < data_.size());
-        return data_[_idx];
-    }
-
-
-
-private:
-    vector_type data_;
-    value_type  value_;
-};
-
-
-#if 0
-// specialization for bool properties
-template <>
-inline const bool*
-Property_array<bool>::data() const
-{
-    CGAL_assertion(false);
-    return NULL;
-}
-#endif 
-
-  /// @endcond
-
-//== CLASS DEFINITION =========================================================
-
-/// @cond CGAL_DOCUMENT_INTERNALS
-
-template<typename>
-class Property_container;
-/// @endcond 
-
-
-
-
-//== CLASS DEFINITION =========================================================
-/// @cond CGAL_DOCUMENT_INTERNALS
-
-template <class, class>
-class Property_map;
-
-template<typename Key>
-class Property_container
-{
-public:
-
-    // default constructor
-    Property_container() : size_(0) {}
-
-    // destructor (deletes all property arrays)
-    virtual ~Property_container() { clear(); }
-
-    // copy constructor: performs deep copy of property arrays
-    Property_container(const Property_container& _rhs) { operator=(_rhs); }
-
-    // assignment: performs deep copy of property arrays
-    Property_container& operator=(const Property_container& _rhs)
-    {
-        if (this != &_rhs)
-        {
-            clear();
-            parrays_.resize(_rhs.n_properties());
-            size_ = _rhs.size();
-            for (unsigned int i=0; i<parrays_.size(); ++i)
-                parrays_[i] = _rhs.parrays_[i]->clone();
-        }
-        return *this;
-    }
-
-    void transfer(const Property_container& _rhs)
-    {
-      for(unsigned int i=0; i<parrays_.size(); ++i){
-        for (unsigned int j=0; j<_rhs.parrays_.size(); ++j){
-          if(parrays_[i]->name() ==  _rhs.parrays_[j]->name()){
-            parrays_[i]->transfer(* _rhs.parrays_[j]);
-            break;
-          }
-        }
-      }
-    }
-
-    // returns the current size of the property arrays
-    size_t size() const { return size_; }
-
-    // returns the number of property arrays
-    size_t n_properties() const { return parrays_.size(); }
-
-    // returns a vector of all property names
-    std::vector<std::string> properties() const
-    {
-        std::vector<std::string> names;
-        for (unsigned int i=0; i<parrays_.size(); ++i)
-            names.push_back(parrays_[i]->name());
-        return names;
-    }
-
-    // add a property with name \c name and default value \c t
-    template <class T>
-    std::pair<Property_map<Key, T>, bool>
-    add(const std::string& name, const T t=T())
-    {
-        for (unsigned int i=0; i<parrays_.size(); ++i)
-        {
-            if (parrays_[i]->name() == name)
-            {
-              return std::make_pair(Property_map<Key, T>(dynamic_cast<Property_array<T>*>(parrays_[i])), false);
-            }
-        }
-
-        // otherwise add the property
-        Property_array<T>* p = new Property_array<T>(name, t);
-        p->resize(size_);
-        parrays_.push_back(p);
-        return std::make_pair(Property_map<Key, T>(p), true);
-    }
-
-
-    // get a property by its name. returns invalid property if it does not exist.
-    template <class T> 
-    std::pair<Property_map<Key, T>,bool>
-    get(const std::string& name) const
-    {
-        for (unsigned int i=0; i<parrays_.size(); ++i)
-            if (parrays_[i]->name() == name)
-              return std::make_pair(Property_map<Key, T>(dynamic_cast<Property_array<T>*>(parrays_[i])), true);
-        return std::make_pair(Property_map<Key, T>(), false);
-    }
-
-
-    // returns a property if it exists, otherwise it creates it first.
-    template <class T>
-    Property_map<Key, T> 
-    get_or_add(const std::string& name, const T t=T())
-    {
-      Property_map<Key, T> p;
-      bool b;
-      boost::tie(p,b)= get<T>(name);
-        if (!b) p = add<T>(name, t).first;
-        return p;
-    }
-
-
-    // get the type of property by its name. returns typeid(void) if it does not exist.
-    const std::type_info& 
-    get_type(const std::string& name)
-    {
-        for (unsigned int i=0; i<parrays_.size(); ++i)
-            if (parrays_[i]->name() == name)
-                return parrays_[i]->type();
-        return typeid(void);
-    }
-
-
-    // delete a property
-    template <class T> 
-    void
-    remove(Property_map<Key, T>& h)
-    {
-        typename std::vector<Base_property_array*>::iterator it=parrays_.begin(), end=parrays_.end();
-        for (; it!=end; ++it)
-        {
-            if (*it == h.parray_)
-            {
-                delete *it;
-                parrays_.erase(it);
-                h.reset();
-                break;
-            }
-        }
-    }
-
-
-    // delete all properties
-    void clear()
-    {
-        for (unsigned int i=0; i<parrays_.size(); ++i)
-            delete parrays_[i];
-        parrays_.clear();
-        size_ = 0;
-    }
-
-
-    // reserve memory for n entries in all arrays
-    void reserve(size_t n) const
-    {
-        for (unsigned int i=0; i<parrays_.size(); ++i)
-            parrays_[i]->reserve(n);
-    }
-
-    // resize all arrays to size n
-    void resize(size_t n)
-    {
-        for (unsigned int i=0; i<parrays_.size(); ++i)
-            parrays_[i]->resize(n);
-        size_ = n;
-    }
-
-    // free unused space in all arrays
-    void shrink_to_fit() const
-    {
-        for (unsigned int i=0; i<parrays_.size(); ++i)
-            parrays_[i]->shrink_to_fit();
-    }
-
-    // add a new element to each vector
-    void push_back()
-    {
-        for (unsigned int i=0; i<parrays_.size(); ++i)
-            parrays_[i]->push_back();
-        ++size_;
-    }
-
-    // swap elements i0 and i1 in all arrays
-    void swap(size_t i0, size_t i1) const
-    {
-        for (unsigned int i=0; i<parrays_.size(); ++i)
-            parrays_[i]->swap(i0, i1);
-    }
-
-
-private:
-    std::vector<Base_property_array*>  parrays_;
-    size_t  size_;
-};
-
-  /// @endcond
-
-#ifndef DOXYGEN_RUNNING
-/// 
-///
-/// `Property_map` enables to attach properties to the simplices of a 
-///  surface mesh.
-/// 
-/// @tparam Key The key type of the property map. It must be a model of `Index`.
-/// @tparam Value The value type of the property.
-///
-/// \cgalModels `LvaluePropertyMap`
-///
-template <class I, class T>
-class Property_map
-/// @cond CGAL_DOCUMENT_INTERNALS
-  : public boost::put_get_helper< 
-           typename Property_array<T>::reference,
-           Property_map< I, T > >
-/// @endcond
-{
-    typedef void (Property_map::*bool_type)() const;
-    void this_type_does_not_support_comparisons() const {}
-public:
-    typedef I key_type;
-    typedef T value_type;
-    typedef boost::lvalue_property_map_tag category;
-
-#ifndef DOXYGEN_RUNNING
-
-    typedef typename Property_array<T>::reference reference;
-
-    typedef typename Property_array<T>::const_reference const_reference;
-#else 
-    /// A reference to the value type of the property.
-  typedef unspecified_type reference;
-
-    /// A const reference to the value type of the property.
-  typedef unspecified_type const_reference;
-#endif
-
-#ifndef DOXYGEN_RUNNING
-    friend class Property_container<I>;
-
-    template <typename K>  friend class Surface_mesh;
-#endif
-
-public:
-/// @cond CGAL_DOCUMENT_INTERNALS
-    Property_map(Property_array<T>* p=NULL) : parray_(p) {}
-
-    void reset()
-    {
-        parray_ = NULL;
-    }
-  /// @endcond 
-
-public:
-    /// \name Accessing Properties
-    //@{
-#ifdef DOXYGEN_RUNNING
-    /// Conversion to a Boolean. It is \c true when the property map
-    /// can be used, and \c false otherwise.  
-  operator bool () const;
-#else
-    operator bool_type() const {
-        return parray_ != NULL ?
-            &Property_map::this_type_does_not_support_comparisons : 0;
-    }
-#endif
-    /// Access the property associated with the key \c i.
-    reference operator[](const I& i)
-    {
-      CGAL_assertion(parray_ != NULL);
-      return (*parray_)[i];
-    }
-
-    /// Access the property associated with the key \c i.
-    reference operator[](const I& i) const
-    {
-      CGAL_assertion(parray_ != NULL);
-      return (*parray_)[i];
-    }
-
-    bool transfer (const Property_map& other)
-    {
-      return parray_->transfer(*(other.parray_));
-    }
-
-    /// Allows access to the underlying storage of the property. This
-    /// is useful when the key associated with the properties is
-    /// unimportant and only the properties are of interest
-    /// (e.g. rendering).
-    ///
-    /// \returns a pointer to the underlying storage of the property.
-    const T* data() const
-    {
-      CGAL_assertion(parray_ != NULL);
-      return parray_->data();
-    }
-
-    //@}
-private:
-
-    Property_array<T>& array()
-    {
-        CGAL_assertion(parray_ != NULL);
-        return *parray_;
-    }
-
-    const Property_array<T>& array() const
-    {
-        CGAL_assertion(parray_ != NULL);
-        return *parray_;
-    }
-
-    Property_array<T>* parray_;
-};
-
-#endif // DOXYGEN_RUNNING
-
-///@}
-
-
-
-    /// \name Basic Types
-    ///
-    ///@{
-
-    /// The point type.
-    typedef P Point;
-
-    /// The type used to represent an index.
-    typedef boost::uint32_t size_type;
-
-    ///@}
-
-    /// \name Basic Elements
-    ///
-    ///@{
-
-
-#ifdef DOXYGEN_RUNNING
-
-    /// This class represents a vertex.
-    /// \cgalModels `Index`
-    /// \cgalModels `LessThanComparable`
-    /// \cgalModels `Hashable`
-    /// \sa `Halfedge_index`, `Edge_index`, `Face_index`
-    class Vertex_index
-    {
-    public:
-        /// %Default constructor.
-        Vertex_index() : SM_Index<Vertex_index>(-1) {}
-
-        explicit Vertex_index(size_type _idx) : SM_Index<Vertex_index>(_idx) {}
-
-        /// prints the index and a short identification string to an ostream.
-        friend std::ostream& operator<<(std::ostream& os, typename Surface_mesh::Vertex_index const& v)
-        {
-          return (os << 'v' << (size_type)v );
-        }
-    };
-#else
-  typedef SM_Vertex_index Vertex_index;
-#endif
-
-#ifdef DOXYGEN_RUNNING
-
-    /// This class represents a halfedge.
-    /// \cgalModels `Index`
-    /// \cgalModels `LessThanComparable`
-    /// \cgalModels `Hashable`
-    /// \sa `Vertex_index`, `Edge_index`, `Face_index`
-    class Halfedge_index
-    {
-    public:
-        /// %Default constructor
-        Halfedge_index() : SM_Index<Halfedge_index>(-1) {}
-
-        explicit Halfedge_index(size_type _idx) : SM_Index<Halfedge_index>(_idx) {}
-
-        /// prints the index and a short identification string to an ostream.
-        friend std::ostream& operator<<(std::ostream& os, typename Surface_mesh::Halfedge_index const& h)
-        {
-          return (os << 'h' << (size_type)h );
-        }
-
-    };
-#else
-  typedef SM_Halfedge_index Halfedge_index;
-#endif
-
-#ifdef DOXYGEN_RUNNING
-    /// This class represents a face
-    /// \cgalModels `Index`
-    /// \cgalModels `LessThanComparable`
-    /// \cgalModels `Hashable`
-    /// \sa `Vertex_index`, `Halfedge_index`, `Edge_index`
-    class Face_index
-    {
-    public:
-        /// %Default constructor
-        Face_index() : SM_Index<Face_index>(-1) {}
-
-        explicit Face_index(size_type _idx) : SM_Index<Face_index>(_idx) {}
-
-        /// prints the index and a short identification string to an ostream.
-        friend std::ostream& operator<<(std::ostream& os, typename Surface_mesh::Face_index const& f)
-        {
-          return (os << 'f' << (size_type)f );
-        }
-    };
-#else
-  typedef SM_Face_index Face_index;
-#endif
-
-#ifdef DOXYGEN_RUNNING
-    /// This class represents an edge.
-    /// \cgalModels `Index`
-    /// \cgalModels `LessThanComparable`
-    /// \cgalModels `Hashable`
-    /// \sa `Vertex_index`, `Halfedge_index`, `Face_index`
-    class Edge_index
-    {
-    public:
-        /// %Default constructor
-        Edge_index() : halfedge_(-1) { }
-
-        Edge_index(size_type idx) : halfedge_(idx * 2) { }
-
-        /// constructs an `Edge_index` from a halfedge.
-        Edge_index(Halfedge_index he) : halfedge_(he) { }
-        /// @cond CGAL_DOCUMENT_INTERNALS
-        /// returns the internal halfedge.
-        Halfedge_index halfedge() const { return halfedge_; }
-
-        /// returns the underlying index of this index.
-        operator size_type() const { return (size_type)halfedge_ / 2; }
-
-        /// resets index to be invalid (index=-1)
-        void reset() { halfedge_.reset(); }
-
-        /// returns whether the index is valid, i.e., the index is not equal to -1.
-        bool is_valid() const { return halfedge_.is_valid(); }
-
-        /// Are two indices equal?
-        bool operator==(const Edge_index& other) const { return (size_type)(*this) == (size_type)other; }
-
-        /// Are two indices different?
-        bool operator!=(const Edge_index& other) const { return (size_type)(*this) != (size_type)other; }
-
-        /// compares by index.
-        bool operator<(const Edge_index& other) const { return (size_type)(*this) < (size_type)other;}
-
-        /// decrements the internal index. This operation does not
-        /// guarantee that the index is valid or undeleted after the
-        /// decrement.
-        Edge_index& operator--() { halfedge_ = Halfedge_index((size_type)halfedge_ - 2); return *this; }
-
-        /// increments the internal index. This operation does not
-        /// guarantee that the index is valid or undeleted after the
-        /// increment.
-        Edge_index& operator++() { halfedge_ = Halfedge_index((size_type)halfedge_ + 2); return *this; }
-
-        /// decrements internal index. This operation does not
-        /// guarantee that the index is valid or undeleted after the
-        /// decrement.
-        Edge_index operator--(int) { Edge_index tmp(*this); halfedge_ = Halfedge_index((size_type)halfedge_ - 2); return tmp; }
-
-        /// increments internal index. This operation does not
-        /// guarantee that the index is valid or undeleted after the
-        /// increment.
-        Edge_index operator++(int) { Edge_index tmp(*this); halfedge_ = Halfedge_index((size_type)halfedge_ + 2); return tmp; }
-
-        /// @endcond 
-
-        /// prints the index and a short identification string to an ostream.
-        friend std::ostream& operator<<(std::ostream& os, typename Surface_mesh::Edge_index const& e)
-        {
-          return (os << 'e' << (size_type)e << " on " << e.halfedge());
-        }
-    private:
-        Halfedge_index halfedge_;
-    };
-#else
-  typedef SM_Edge_index Edge_index;
-#endif
-
- 
-    ///@}
-private: //-------------------------------------------------- connectivity types
-
-    /// This type stores the vertex connectivity
-    /// \sa `Halfedge_connectivity`, `Face_connectivity`
-    struct Vertex_connectivity
-    {
-        /// an incoming halfedge per vertex (it will be a border halfedge for border vertices)
-        Halfedge_index  halfedge_;
-    };
-
-
-    /// This type stores the halfedge connectivity
-    /// \sa `Vertex_connectivity`, `Face_connectivity`
-    struct Halfedge_connectivity
-    {
-        /// face incident to halfedge
-        Face_index      face_;
-        /// vertex the halfedge points to
-        Vertex_index    vertex_;
-        /// next halfedge within a face (or along a border)
-        Halfedge_index  next_halfedge_;
-        /// previous halfedge within a face (or along a border)
-        Halfedge_index  prev_halfedge_;
-    };
-
-
-    /// This type stores the face connectivity
-    /// \sa `Vertex_connectivity`, `Halfedge_connectivity`
-    struct Face_connectivity
-    {
-        /// a halfedge that is part of the face
-        Halfedge_index  halfedge_;
-    };
-
-private: //------------------------------------------------------ iterator types
-    template<typename Index_>
-    class Index_iterator
-      : public boost::iterator_facade< Index_iterator<Index_>,
-                                       Index_,
-                                       std::bidirectional_iterator_tag
-                                       >
-    {
-        typedef boost::iterator_facade< Index_iterator<Index_>,
-                                        Index_,
-                                        std::bidirectional_iterator_tag
-                                        > Facade;
-    public:
-        Index_iterator() : hnd_(), mesh_(NULL) {}
-        Index_iterator(const Index_& h, const Surface_mesh* m)
-          : hnd_(h), mesh_(m) {
-          if (mesh_ && mesh_->has_garbage()){
-              while (mesh_->has_valid_index(hnd_) && mesh_->is_removed(hnd_)) ++hnd_;
-          }
-        }
-    private:
-        friend class boost::iterator_core_access;
-        void increment()
-        {
-            ++hnd_;
-            CGAL_assertion(mesh_ != NULL);
-
-            if(mesh_->has_garbage())
-              while ( mesh_->has_valid_index(hnd_) && mesh_->is_removed(hnd_)) ++hnd_;
-        }
-  
-        void decrement()
-        {
-            --hnd_;
-            CGAL_assertion(mesh_ != NULL);
-            if(mesh_->has_garbage())
-               while ( mesh_->has_valid_index(hnd_) && mesh_->is_removed(hnd_)) --hnd_;
-        }
-
-        bool equal(const Index_iterator& other) const
-        {
-            return this->hnd_ == other.hnd_;
-        }
-
-        Index_& dereference() const { return const_cast<Index_&>(hnd_); }
-
-        Index_ hnd_;
-        const Surface_mesh* mesh_;
-
-    };
-public:
-    /// \name Range Types
-    ///
-    /// Each range `R` in this section has a nested type `R::iterator`, 
-    /// is convertible to `std:pair<R::iterator,R::iterator>`, so that one can use `boost::tie()`,
-    /// and can be used with `BOOST_FOREACH()`, as well as with the C++11 range based for-loop.
-
-    ///@{
-
-#ifndef DOXYGEN_RUNNING
-    typedef Index_iterator<Vertex_index> Vertex_iterator;
-#endif
-
-    /// \brief The range over all vertex indices.
-    ///
-    /// A model of <a href="http://www.boost.org/libs/range/doc/html/range/concepts/bidirectional_range.html">BidirectionalRange</a> with value type `Vertex_index`.
-    /// \sa `vertices()`
-    /// \sa `Halfedge_range`, `Edge_range`, `Face_range`
-#ifdef DOXYGEN_RUNNING
-    typedef unspecified_type Vertex_range;
-#else
-    typedef Iterator_range<Vertex_iterator> Vertex_range;
-#endif
-
-#ifndef DOXYGEN_RUNNING
-    typedef Index_iterator<Halfedge_index> Halfedge_iterator;
-#endif
-
-    /// \brief The range over all halfedge indices.
-    ///
-    /// A model of <a href="http://www.boost.org/libs/range/doc/html/range/concepts/bidirectional_range.html">BidirectionalRange</a> with value type `Halfedge_index`.
-    /// \sa `halfedges()`
-    /// \sa `Vertex_range`, `Edge_range`, `Face_range`
-#ifdef DOXYGEN_RUNNING
-    typedef unspecified_type Halfedge_range;
-#else
-    typedef Iterator_range<Halfedge_iterator> Halfedge_range;
-#endif
-
-#ifndef DOXYGEN_RUNNING
-    typedef Index_iterator<Edge_index> Edge_iterator;
-#endif
-
-    /// \brief The range over all edge indices.
-    ///
-    /// A model of <a href="http://www.boost.org/libs/range/doc/html/range/concepts/bidirectional_range.html">BidirectionalRange</a> with value type `Edge_index`.
-    /// \sa `edges()`
-    /// \sa `Halfedge_range`, `Vertex_range`, `Face_range`
-#ifdef DOXYGEN_RUNNING
-    typedef unspecified_type Edge_range;
-#else
-    typedef Iterator_range<Edge_iterator> Edge_range;
-#endif
-
-
-#ifndef DOXYGEN_RUNNING
-    typedef Index_iterator<Face_index> Face_iterator;
-#endif
-    /// \brief The range over all face indices.
-    ///
-    /// A model of <a href="http://www.boost.org/libs/range/doc/html/range/concepts/bidirectional_range.html">BidirectionalRange</a> with value type `Face_index`.
-    /// \sa `faces()`
-    /// \sa `Vertex_range`, `Halfedge_range`, `Edge_range`
- #ifdef DOXYGEN_RUNNING
-    typedef unspecified_type Face_range;
-#else
-   typedef Iterator_range<Face_iterator> Face_range;
-#endif
-
-#ifndef DOXYGEN_RUNNING 
-
-  typedef CGAL::Vertex_around_target_iterator<Surface_mesh> Vertex_around_target_iterator;
-  typedef Iterator_range<Vertex_around_target_iterator> Vertex_around_target_range;
-
-  typedef CGAL::Halfedge_around_target_iterator<Surface_mesh>  Halfedge_around_target_iterator;
-  typedef Iterator_range<Halfedge_around_target_iterator> Halfedge_around_target_range;
-
-  typedef CGAL::Face_around_target_iterator<Surface_mesh>  Face_around_target_iterator;
-  typedef Iterator_range<Face_around_target_iterator> Face_around_target_range;
-
-  typedef CGAL::Vertex_around_face_iterator<Surface_mesh>  Vertex_around_face_iterator;
-  typedef Iterator_range<Vertex_around_face_iterator> Vertex_around_face_range;
-
-  typedef CGAL::Halfedge_around_face_iterator<Surface_mesh>  Halfedge_around_face_iterator;
-  typedef Iterator_range<Halfedge_around_face_iterator> Halfedge_around_face_range;
-
-  typedef CGAL::Face_around_face_iterator<Surface_mesh>  Face_around_face_iterator;
-  typedef Iterator_range<Face_around_face_iterator> Face_around_face_range;
-#endif
-
-    /// @cond CGAL_BEGIN_END
-    /// Start iterator for vertices.
-    Vertex_iterator vertices_begin() const
-    {
-        return Vertex_iterator(Vertex_index(0), this);
-    }
-
-    /// End iterator for vertices.
-    Vertex_iterator vertices_end() const
-    {
-        return Vertex_iterator(Vertex_index(num_vertices()), this);
-    }
-    /// @endcond
-
-
-    /// returns the iterator range of the vertices of the mesh.
-    Vertex_range vertices() const {
-      return make_range(vertices_begin(), vertices_end());
-    }
-
-
-    /// @cond CGAL_BEGIN_END
-    /// Start iterator for halfedges.
-    Halfedge_iterator halfedges_begin() const
-    {
-        return Halfedge_iterator(Halfedge_index(0), this);
-    }
-
-    /// End iterator for halfedges.
-    Halfedge_iterator halfedges_end() const
-    {
-        return Halfedge_iterator(Halfedge_index(num_halfedges()), this);
-    }
-    /// @endcond
-
-
-    /// returns the iterator range of the halfedges of the mesh.
-    Halfedge_range halfedges() const {
-      return make_range(halfedges_begin(), halfedges_end());
-    }
-
-
-    /// @cond CGAL_BEGIN_END
-    /// Start iterator for edges.
-    Edge_iterator edges_begin() const
-    {
-        return Edge_iterator(Edge_index(0), this);
-    }
-
-    /// End iterator for edges.
-    Edge_iterator edges_end() const
-    {
-        return Edge_iterator(Edge_index(num_edges()), this);
-    }
-    /// @endcond
-
-
-    /// returns the iterator range of the edges of the mesh.
-    Edge_range edges() const
-    {
-        return make_range(edges_begin(), edges_end());
-    }
-
-
-    /// @cond CGAL_BEGIN_END
-    /// Start iterator for faces.
-    Face_iterator faces_begin() const
-    {
-        return Face_iterator(Face_index(0), this);
-    }
-
-    /// End iterator for faces.
-    Face_iterator faces_end() const
-    {
-        return Face_iterator(Face_index(num_faces()), this);
-    }
-    /// @endcond
-
-    /// returns the iterator range of the faces of the mesh.
-    Face_range faces() const {
-      return make_range(faces_begin(), faces_end());
-    }
-
-#ifndef DOXYGEN_RUNNING
-    /// returns the iterator range for vertices around vertex `target(h)`, starting at `source(h)`.
-    Vertex_around_target_range vertices_around_target(Halfedge_index h) const
-    {
-      return CGAL::vertices_around_target(h,*this);
-    }
-
-    /// returns the iterator range for incoming halfedges around vertex `target(h)`, starting at `h`.
-    Halfedge_around_target_range halfedges_around_target(Halfedge_index h) const
-    {
-      return CGAL::halfedges_around_target(h,*this);
-    }
-
-    /// returns the iterator range for faces around vertex `target(h)`, starting at `face(h)`.
-    Face_around_target_range faces_around_target(Halfedge_index h) const
-    {
-      return CGAL::faces_around_target(h,*this);
-    }
-
-    /// returns the iterator range for vertices around face `face(h)`, starting at `target(h)`.
-    Vertex_around_face_range vertices_around_face(Halfedge_index h) const
-     {
-       return CGAL::vertices_around_face(h,*this);
-     }
-
-    /// returns the iterator range for halfedges around face `face(h)`, starting at `h`.
-    Halfedge_around_face_range halfedges_around_face(Halfedge_index h) const
-    {
-      return CGAL::halfedges_around_face(h,*this);
-    }
-
-    /// returns the iterator range for halfedges around face `face(h)`, starting at `h`.
-    Face_around_face_range faces_around_face(Halfedge_index h) const
-    {
-       return CGAL::faces_around_face(h,*this);
-    }
-
-#endif
-
-    ///@}
-
-
-public: 
-
-#ifndef DOXYGEN_RUNNING
-    /// \name Circulator Types
-    ///
-    /// The following circulators enable to iterate through the elements around a face or vertex.
-    /// As explained in the \ref SurfaceMeshOrientation "User Manual", we can speak of a  
-    /// *clockwise* or *counterclockwise*
-    /// traversal, by looking at the surface from the right side.  
-    ///@{
-
-    /// \brief This class circulates clockwise through all 
-    /// one-ring neighbors of a vertex. 
-    ///  A model of `BidirectionalCirculator` with value type `Vertex_index`.
-    /// \sa `Halfedge_around_target_circulator`, `Face_around_target_circulator`
-
-  typedef CGAL::Vertex_around_target_circulator<Surface_mesh> Vertex_around_target_circulator;
-
-
-
-    /// \brief This class circulates clockwise through all incident faces of a vertex.
-    ///  A model of `BidirectionalCirculator` with value type `Face_index`.
-    /// \sa `Vertex_around_target_circulator`, `Halfedge_around_target_circulator`
-
-  typedef CGAL::Face_around_target_circulator<Surface_mesh> Face_around_target_circulator;
-
-
-    /// \brief This class circulates clockwise through all halfedges around a vertex that have this vertex as target.
-    ///  A model of `BidirectionalCirculator` with value type `Halfedge_index`.
-    /// \sa `Vertex_around_target_circulator`, `Halfedge_around_target_circulator`
-
-  typedef CGAL::Halfedge_around_target_circulator<Surface_mesh> Halfedge_around_target_circulator;
-
-
-    /// \brief This class circulates clockwise through all halfedges around a vertex that have this vertex as source.
-    ///  A model of `BidirectionalCirculator` with value type `Halfedge_index`.
-    /// \sa `Vertex_around_target_circulator`, `Halfedge_around_target_circulator`
-
-  typedef CGAL::Halfedge_around_source_circulator<Surface_mesh> Halfedge_around_source_circulator;
-
-    /// \brief This class circulates counterclockwise through all vertices around a face.
-    ///  A model of `BidirectionalCirculator` with value type `Vertex_index`.
-
-  typedef  CGAL::Vertex_around_face_circulator<Surface_mesh> Vertex_around_face_circulator;
-
-
-    /// \brief This class circulates counterclockwise through all halfedges around a face.
-    ///  A model of `BidirectionalCirculator` with value type `Halfedge_index`.
-
-  typedef  CGAL::Halfedge_around_face_circulator<Surface_mesh> Halfedge_around_face_circulator;
-
-   /// \brief This class circulates counterclockwise through all faces around a face.
-   ///  A model of `BidirectionalCirculator` with value type `Face_index`.
-   ///  Note that the face index is the same after `operator++`, if the neighboring faces share 
-   ///  several halfedges.
-
-  typedef  CGAL::Face_around_face_circulator<Surface_mesh> Face_around_face_circulator;
-  /// @}
-#endif
-
-  /// @cond CGAL_DOCUMENT_INTERNALS
-  // typedefs which make it easier to write the partial specialisation of boost::graph_traits
-
-  typedef Vertex_index   vertex_index;
-  typedef P                   vertex_property_type;
-  typedef Halfedge_index halfedge_index;
-  typedef Edge_index     edge_index;
-  typedef Face_index     face_index;
-
-  typedef Vertex_iterator     vertex_iterator;
-  typedef Halfedge_iterator   halfedge_iterator;
-  typedef Edge_iterator       edge_iterator;
-  typedef Face_iterator      face_iterator;
-  typedef CGAL::Out_edge_iterator<Self>     out_edge_iterator;
-
-  typedef boost::undirected_tag             directed_category;
-  typedef boost::disallow_parallel_edge_tag edge_parallel_category; 
-
-  struct traversal_category : public virtual boost::bidirectional_graph_tag,
-                              public virtual boost::vertex_list_graph_tag,
-                              public virtual boost::edge_list_graph_tag
-  {};
-
-  typedef size_type vertices_size_type;
-  typedef size_type halfedges_size_type;
-  typedef size_type edges_size_type;
-  typedef size_type faces_size_type;
-  typedef size_type degree_size_type;
-
- /// @endcond
-public:
-
-    /// \name Construction, Destruction, Assignment
-    ///
-    ///  Copy constructors as well as assignment do also copy simplices marked as removed.
-    ///@{
-
-    /// %Default constructor.
-    Surface_mesh();
-
-    /// Copy constructor: copies `rhs` to `*this`. Performs a deep copy of all properties.
-    Surface_mesh(const Surface_mesh& rhs) { *this = rhs; }
-
-    /// assigns `rhs` to `*this`. Performs a deep copy of all properties.
-    Surface_mesh& operator=(const Surface_mesh& rhs);
-
-    /// assigns `rhs` to `*this`. Does not copy custom properties.
-    Surface_mesh& assign(const Surface_mesh& rhs);
-
-    ///@}
-
-public:
-
-    /// \name Adding Vertices, Edges, and Faces
-    ///@{
-
-   /// adds a new vertex, and resizes vertex properties if necessary.
-    Vertex_index add_vertex()
-    {
-      size_type inf = -1;
-      if(vertices_freelist_ != inf){
-        size_type idx = vertices_freelist_;
-        vertices_freelist_ = (size_type)vconn_[Vertex_index(vertices_freelist_)].halfedge_;
-        --removed_vertices_;
-        vremoved_[Vertex_index(idx)] = false;
-        return Vertex_index(idx);
-      } else {
-        vprops_.push_back();
-        return Vertex_index(num_vertices()-1);
-      }
-    }
-
-    /// adds a new vertex, resizes vertex properties if necessary,
-    /// and sets the \em point property to `p`.
-    /// \note Several vertices may have the same point property.
-    Vertex_index add_vertex(const Point& p) 
-    {
-        Vertex_index v = add_vertex();
-        vpoint_[v] = p;
-        return v;
-    }
-
-
-
-public:
-
-    /// adds a new edge, and resizes edge and halfedge properties if necessary.
-    Halfedge_index add_edge()
-    {
-      Halfedge_index h0, h1;
-      size_type inf = -1;
-      if(edges_freelist_ != inf){
-        size_type idx = edges_freelist_;
-        edges_freelist_ = (size_type)hconn_[Halfedge_index(edges_freelist_)].next_halfedge_;
-        --removed_edges_;
-        eremoved_[Edge_index(Halfedge_index(idx))] = false;
-        return Halfedge_index(idx);
-      } else {
-        eprops_.push_back();
-        hprops_.push_back();
-        hprops_.push_back();
-
-        return Halfedge_index(num_halfedges()-2);
-      }
-    }
-
-    /// adds two opposite halfedges, and resizes edge and halfedge properties if necessary.
-    /// Sets the targets of the halfedge to the given vertices, but does not modify the halfedge
-    /// associated to the vertices.
-    /// \note The function does not check whether there is already an edge between the vertices.
-    /// \returns the halfedge with `v1` as target
-
-    Halfedge_index add_edge(Vertex_index v0, Vertex_index v1)
-    {
-        CGAL_assertion(v0 != v1);
-        Halfedge_index h = add_edge();
-
-        set_target(h, v1);
-        set_target(opposite(h), v0);
-
-        return h;
-    }
-
-    /// adds a new face, and resizes face properties if necessary.
-    Face_index add_face()
-    {
-      size_type inf = -1;
-      if(faces_freelist_ != inf){
-        size_type idx = faces_freelist_;
-        faces_freelist_ = (size_type)fconn_[Face_index(faces_freelist_)].halfedge_;
-        --removed_faces_;
-        fremoved_[Face_index(idx)] = false;
-        return Face_index(idx);
-      } else {
-        fprops_.push_back();
-        return Face_index(num_faces()-1);
-      }
-    }
-
-    /// if possible, adds a new face with vertices from a range with value type `Vertex_index`.
-    /// The function adds halfedges between successive vertices if they are not yet indicent to halfedges,
-    /// or updates the connectivity of halfedges already in place. 
-    /// Resizes halfedge, edge, and face properties if necessary.
-    /// \returns the face index of the added face, or `Surface_mesh::null_face()` if the face could not be added.
-    template <typename Range>
-    Face_index add_face(const Range& vertices);
-
-
-    /// adds a new triangle connecting vertices `v0`, `v1`, `v2`.
-    /// \returns the face index of the added face, or `Surface_mesh::null_face()` if the face could not be added.
-    Face_index add_face(Vertex_index v0, Vertex_index v1, Vertex_index v2)
-    {
-        boost::array<Vertex_index, 3> 
-            v = {{v0, v1, v2}};
-        return add_face(v);
-    }
-
-    /// adds a new quad connecting vertices `v0`, `v1`, `v2`, `v3`.
-    /// \returns the face index of the added face, or `Surface_mesh::null_face()` if the face could not be added.
-    Face_index add_face(Vertex_index v0, Vertex_index v1, Vertex_index v2, Vertex_index v3)
-    {
-        boost::array<Vertex_index, 4> 
-            v = {{v0, v1, v2, v3}};
-        return add_face(v);
-    }
-
-    ///@}
-
-
- 
-    /// \name Low-Level Removal Functions 
-    ///
-    /// Although the elements are only marked as removed
-    /// their connectivity and properties should not be used.
-    ///
-    /// \warning Functions in this group do not adjust any of
-    /// connected elements and usually leave the surface mesh in an
-    /// invalid state.
-    /// 
-    ///
-    /// @{
-
-    /// removes vertex `v` from the halfedge data structure without
-    /// adjusting anything.
-    void remove_vertex(Vertex_index v)
-    {
-        vremoved_ = add_property_map<Vertex_index, bool>("v:removed", false).first;
-        vremoved_[v] = true; ++removed_vertices_; garbage_ = true;
-        vconn_[v].halfedge_ = Halfedge_index(vertices_freelist_);
-        vertices_freelist_ = (size_type)v;
-    }
-
-    /// removes the two halfedges corresponding to `e` from the halfedge data structure without
-    /// adjusting anything.
-    void remove_edge(Edge_index e)
-    {
-        eremoved_ = add_property_map<Edge_index, bool>("e:removed", false).first;
-        eremoved_[e] = true; ++removed_edges_; garbage_ = true;
-        hconn_[Halfedge_index((size_type)e << 1)].next_halfedge_ = Halfedge_index(edges_freelist_ );
-        edges_freelist_ = ((size_type)e << 1);
-    }
-
-    /// removes  face `f` from the halfedge data structure without
-    /// adjusting anything.
-
-    void remove_face(Face_index f)
-    {
-        fremoved_ = add_property_map<Face_index, bool>("f:removed", false).first;
-        fremoved_[f] = true; ++removed_faces_; garbage_ = true;
-        fconn_[f].halfedge_ = Halfedge_index(faces_freelist_);
-        faces_freelist_ = (size_type)f;
-    }
-
-
-    ///@}
-
-
-    /// \name Memory Management
-    ///
-    /// Functions to check the number of elements, the amount of space
-    /// allocated for elements, and to clear the structure.
-    ///@{
-
-  /// returns the number of vertices in the mesh.
-  size_type number_of_vertices() const
-  {
-    return num_vertices() - number_of_removed_vertices();
-  }
- 
-  /// returns the number of halfedges in the mesh.
-  size_type number_of_halfedges() const
-  {
-    return num_halfedges() - number_of_removed_halfedges();
-  }
-
-  /// returns the number of edges in the mesh.
-  size_type number_of_edges() const
-  {
-    return num_edges() - number_of_removed_edges();
-  }
-
-  /// returns the number of faces in the mesh.
-  size_type number_of_faces() const
-  {
-    return num_faces() - number_of_removed_faces();
-  }
-
-    /// returns `true` iff the mesh is empty, i.e., has no vertices, halfedges and faces.
-    bool is_empty() const
-  {
-    return ( num_vertices() == number_of_removed_vertices()
-             && num_halfedges() == number_of_removed_halfedges()
-             && num_faces() == number_of_removed_faces());
-  }
-
-    /// removes all vertices, halfedge, edges and faces. Collects garbage and clears all properties.
-    void clear();
-
- 
-    /// reserves space for vertices, halfedges, edges, faces, and their currently
-    /// associated properties.
-    void reserve(size_type nvertices,
-                 size_type nedges,
-                 size_type nfaces )
-    {
-        vprops_.reserve(nvertices);
-        hprops_.reserve(2*nedges);
-        eprops_.reserve(nedges);
-        fprops_.reserve(nfaces);
-    }
-
-      void resize(size_type nvertices,
-                 size_type nedges,
-                 size_type nfaces )
-    {
-        vprops_.resize(nvertices);
-        hprops_.resize(2*nedges);
-        eprops_.resize(nedges);
-        fprops_.resize(nfaces);
-    }
-  
-  bool join(const Surface_mesh& other)
-  {
-    size_type nv = num_vertices(), nh = num_halfedges(), nf = num_faces();
-    resize(num_vertices()+  other.num_vertices(),
-            num_edges()+  other.num_edges(),
-            num_faces()+  other.num_faces());
-
-    vprops_.transfer(other.vprops_);
-    hprops_.transfer(other.hprops_);
-    fprops_.transfer(other.fprops_);
-    eprops_.transfer(other.eprops_);
-
-    for(size_type i = nv; i < nv+other.num_vertices(); i++){
-      Vertex_index vi(i);
-      if(vconn_[vi].halfedge_ != null_halfedge()){
-        vconn_[vi].halfedge_ = Halfedge_index(size_type(vconn_[vi].halfedge_)+nh);
-      }
-    }
-    for(size_type i = nf; i < nf+other.num_faces(); i++){
-      Face_index fi(i);
-      if(fconn_[fi].halfedge_ != null_halfedge()){
-        fconn_[fi].halfedge_ = Halfedge_index(size_type(fconn_[fi].halfedge_)+nh);
-      }
-    }
-    for(size_type i = nh; i < nh+other.num_halfedges(); i++){
-      Halfedge_index hi(i);
-      if(hconn_[hi].face_ != null_face()){
-        hconn_[hi].face_ = Face_index(size_type(hconn_[hi].face_)+nf);
-      }
-      if( hconn_[hi].vertex_ != null_vertex()){
-        hconn_[hi].vertex_ = Vertex_index(size_type(hconn_[hi].vertex_)+nv);
-      }
-      if(hconn_[hi].next_halfedge_ != null_halfedge()){
-        hconn_[hi].next_halfedge_ = Halfedge_index(size_type(hconn_[hi].next_halfedge_)+nh);
-      }
-      if(hconn_[hi].prev_halfedge_ != null_halfedge()){
-        hconn_[hi].prev_halfedge_ = Halfedge_index(size_type(hconn_[hi].prev_halfedge_)+nh);
-      }
-    }
-    size_type nil = -1;
-    if(other.vertices_freelist_ != nil){
-      if(vertices_freelist_ != nil){
-        Vertex_index vi(nv+other.vertices_freelist_);
-        Halfedge_index inf(-1);
-        while(vconn_[vi].halfedge_ != inf){
-          vi = Vertex_index(size_type(vconn_[vi].halfedge_));
-        }
-        vconn_[vi].halfedge_ = Halfedge_index(vertices_freelist_);
-      }
-      vertices_freelist_ = nv + other.vertices_freelist_; 
-    }
-    if(other.faces_freelist_ != nil){
-      if(faces_freelist_ != nil){
-        Face_index fi(nf+other.faces_freelist_);
-        Halfedge_index inf(-1);
-        while(fconn_[fi].halfedge_ != inf){
-          fi = Face_index(size_type(fconn_[fi].halfedge_));
-        }
-        fconn_[fi].halfedge_ = Halfedge_index(faces_freelist_);
-      }
-      faces_freelist_ = nf + other.faces_freelist_; 
-    }
-    if(other.edges_freelist_ != nil){
-      if(edges_freelist_ != nil){
-        Halfedge_index hi((nh>>1)+other.edges_freelist_);
-        Halfedge_index inf(-1);
-        while(hconn_[hi].next_halfedge_ != inf){
-          hi = hconn_[hi].next_halfedge_;
-        }
-        hconn_[hi].next_halfedge_ = Halfedge_index(edges_freelist_);
-      }
-      edges_freelist_ = (nh>>1) + other.edges_freelist_; 
-    }
-    garbage_ = garbage_ || other.garbage_;
-    removed_vertices_ += other.removed_vertices_;
-    removed_edges_ += other.removed_edges_;
-    removed_faces_ += other.removed_faces_;
-    return true;
-  }
-
-    ///@}
-
-    
-    /// \name Garbage Collection
-    ///
-    /// While removing elements only marks them as removed
-    /// garbage collection really removes them.
-    /// The API in this section allows to check whether 
-    /// an element is removed, to get the number of
-    /// removed elements, and to collect garbage.
-    /// The number of elements together with the number of  removed elements is
-    /// an upperbound on the index, and is needed
-    /// by algorithms that temporarily store a 
-    /// property in a vector of the appropriate size.
-    /// Note however that by garbage collecting elements get new indices.
-    /// In case you store indices in an auxiliary data structure
-    /// or in a property these indices are potentially no longer 
-    /// refering to the right elements. 
-
-
-    ///@{
-#ifndef DOXYGEN_RUNNING
-   /// returns the number of used and removed vertices in the mesh.
-    size_type num_vertices() const { return (size_type) vprops_.size(); }
-
-    /// returns the number of used and removed halfedges in the mesh.
-    size_type num_halfedges() const { return (size_type) hprops_.size(); }
-
-    /// returns the number of used and removed edges in the mesh.
-    size_type num_edges() const { return (size_type) eprops_.size(); }
-
-    /// returns the number of used and removed faces in the mesh.
-    size_type num_faces() const { return (size_type) fprops_.size(); }
-
-#endif
-
-    /// returns the number of vertices in the mesh which are marked removed.
-    size_type number_of_removed_vertices() const { return removed_vertices_; }
-
-    /// returns the number of halfedges in the mesh which are marked removed.
-    size_type number_of_removed_halfedges() const { return 2*removed_edges_; }
-
-    /// returns the number of edges in the mesh which are marked removed.
-    size_type number_of_removed_edges() const { return removed_edges_; }
-
-    /// returns the number offaces in the mesh which are marked removed.
-    size_type number_of_removed_faces() const { return removed_faces_; }
-
-
-
-    /// returns whether vertex `v` is marked removed.
-    /// \sa `collect_garbage()`
-    bool is_removed(Vertex_index v) const
-    {
-        return vremoved_[v];
-    }
-    /// returns whether halfedge `h` is marked removed.
-    /// \sa `collect_garbage()`
-    bool is_removed(Halfedge_index h) const
-    {
-        return eremoved_[edge(h)];
-    }
-    /// returns whether edge `e` is marked removed.
-    /// \sa `collect_garbage()`
-    bool is_removed(Edge_index e) const
-    {
-        return eremoved_[e];
-    }
-    /// returns whether face `f` is marked removed.
-    /// \sa `collect_garbage()`
-    bool is_removed(Face_index f) const
-    {
-        return fremoved_[f];
-    }
-
-    /// checks if any vertices, halfedges, edges, or faces are marked as removed.
-    /// \sa collect_garbage
-    bool has_garbage() const { return garbage_; }
-
-    /// really removes vertices, halfedges, edges, and faces which are marked removed.
-    /// \sa `has_garbage()`
-    /// \attention By garbage collecting elements get new indices.
-    /// In case you store indices in an auxiliary data structure
-    /// or in a property these indices are potentially no longer 
-    /// refering to the right elements. 
-    void collect_garbage();
-
-
-    /// @cond CGAL_DOCUMENT_INTERNALS
-    /// removes unused memory from vectors. This shrinks the storage
-    /// of all properties to the minimal required size.
-    /// \attention Invalidates all existing references to properties.
-
-    void shrink_to_fit()
-    {
-        vprops_.shrink_to_fit();
-        hprops_.shrink_to_fit();
-        eprops_.shrink_to_fit();
-        fprops_.shrink_to_fit();
-    }
-    /// @endcond
-
-    ///@}
-
-    /// @cond CGAL_DOCUMENT_INTERNALS
-    ///
-    /// \name Simple Validity Checks
-    ///
-    /// Functions in this group check if the index is valid, that is between
-    /// `0` and the currently allocated maximum amount of the
-    /// elements. They do not check if an element is marked as removed.
-    ///@{
-
-    /// returns whether the index of vertex `v` is valid, that is within the current array bounds.
-    bool has_valid_index(Vertex_index v) const
-    {
-      return ((size_type)v < num_vertices());
-    } 
-
-    /// returns whether the index of halfedge `h` is valid, that is within the current array bounds.
-    bool has_valid_index(Halfedge_index h) const
-    {
-      return ((size_type)h < num_halfedges());
-    }
-    /// returns whether the index of edge `e` is valid, that is within the current array bounds.
-    bool has_valid_index(Edge_index e) const
-    {
-      return ((size_type)e < num_edges());
-    }
-    /// returns whether the index of face `f` is valid, that is within the current array bounds.
-    bool has_valid_index(Face_index f) const
-    {
-        return ((size_type)f < num_faces());
-    }
-
-    /// @}
-    /// @endcond
-    
-    /// \name Validity Checks
-    ///
-    /// Functions in this group perform checks for structural
-    /// consistency of a complete surface mesh, or an individual element. 
-    /// They are expensive and should only be used in debug configurations.
-
-    ///@{
-
-    /// perform an expensive validity check on the data structure and
-    /// print found errors to `std::cerr` when `verbose == true`.
-  bool is_valid(bool verbose = true) const
-    {
-        bool valid = true;
-        size_type vcount = 0, hcount = 0, fcount = 0;
-        for(Halfedge_iterator it = halfedges_begin(); it != halfedges_end(); ++it) { 
-            ++hcount;
-            valid = valid && next(*it).is_valid();
-            valid = valid && opposite(*it).is_valid();
-            if(!valid) {
-                if (verbose)
-                  std::cerr << "Integrity of halfedge " << *it << " corrupted."  << std::endl;
-                break;
-            }
-
-            valid = valid && (opposite(*it) != *it);
-            valid = valid && (opposite(opposite(*it)) == *it);
-            if(!valid) {
-              if (verbose)
-                std::cerr << "Integrity of opposite halfedge of " << *it << " corrupted."  << std::endl;
-              break;
-            }
-
-            valid = valid && (next(prev(*it)) == *it);
-            if(!valid) {
-                if (verbose)
-                  std::cerr << "Integrity of previous halfedge of " << *it << " corrupted."  << std::endl;
-                break;
-            }
-
-            valid = valid && (prev(next(*it)) == *it);
-            if(!valid) {
-                if (verbose)
-                  std::cerr << "Integrity of next halfedge of " << *it << " corrupted."  << std::endl;
-                break;
-            }
-
-            valid = valid && target(*it).is_valid();
-            if(!valid) {
-                if (verbose)
-                  std::cerr << "Integrity of vertex of halfedge " << *it << " corrupted."  << std::endl;
-                break;
-            }
-
-            valid = valid && (target(*it) == target(opposite(next(*it))));
-            if(!valid) {
-                if (verbose)
-                  std::cerr << "Halfedge vertex of next opposite is not the same for " << *it << "."  << std::endl;
-                break;
-            }
-        }
-
-        for(Vertex_iterator it = vertices_begin(); it != vertices_end(); ++it) {
-          ++vcount;
-            if(halfedge(*it).is_valid()) {
-                // not an isolated vertex
-                valid = valid && (target(halfedge(*it)) == *it);
-                if(!valid) {
-                    if (verbose)
-                      std::cerr << "Halfedge of " << *it << " is not an incoming halfedge." << std::endl;
-                    break;
-                }
-            }
-        }
-        for(Face_iterator it = faces_begin(); it != faces_end(); ++it) {
-          ++fcount;
-        }
-        
-        valid = valid && (vcount == number_of_vertices());
-        if(!valid && verbose){
-          std::cerr << "#vertices: iterated: " << vcount << " vs number_of_vertices(): " << number_of_vertices()<< std::endl;
-        }
-
-        valid = valid && (hcount == number_of_halfedges());
-        if(!valid && verbose){
-          std::cerr << "#halfedges: iterated: " << hcount << " vs number_of_halfedges(): " << number_of_halfedges()<< std::endl;
-        }
-
-        valid = valid && (fcount == number_of_faces());
-        if(!valid && verbose){
-          std::cerr << "#faces: iterated: " << fcount << " vs number_of_faces(): " << number_of_faces()<< std::endl;
-        }
-        return valid;
-    }
-
-    /// performs a validity check on a single vertex.
-    bool is_valid(Vertex_index v) const {
-        Halfedge_index h = vconn_[v].halfedge_;
-        if(h!= null_halfedge() && (!has_valid_index(h) || is_removed(h))) {
-          std::cerr << "Vertex connectivity halfedge error in " << (size_type)v
-                    << " with " << (size_type)h << std::endl;
-            return false;
-        }
-        return true;
-    }
-
-    /// performs a validity check on a single halfedge.
-    bool is_valid(Halfedge_index h) const {
-        Face_index f = hconn_[h].face_;
-        Vertex_index v = hconn_[h].vertex_;
-        Halfedge_index hn = hconn_[h].next_halfedge_;
-        Halfedge_index hp = hconn_[h].prev_halfedge_;
-
-        bool valid = true;
-        // don't validate the face if this is a border halfedge
-        if(!is_border(h)) {
-            if(!has_valid_index(f) || is_removed(f)) {
-                std::cerr << "Halfedge connectivity Face "
-                          << (!has_valid_index(f) ? "invalid" : "removed")
-                          << " in " << (size_type)h << std::endl;
-                valid = false;
-            }
-        }
-
-        if(!has_valid_index(v) || is_removed(v)) {
-            std::cerr << "Halfedge connectivity Vertex "
-                      << (!has_valid_index(v) ? "invalid" : "removed")
-                      << " in " << (size_type)h << std::endl;
-            valid = false;
-        }
-
-        if(!has_valid_index(hn) || is_removed(hn)) {
-            std::cerr << "Halfedge connectivity hnext "
-                      << (!has_valid_index(hn) ? "invalid" : "removed")
-                      << " in " << (size_type)h << std::endl;
-            valid = false;
-        }
-        if(!has_valid_index(hp) || is_removed(hp)) {
-            std::cerr << "Halfedge connectivity hprev "
-                      << (!has_valid_index(hp) ? "invalid" : "removed")
-                      << " in " << (size_type)h << std::endl;
-            valid = false;
-        }
-        return valid;
-    }
-
-
-    /// performs a validity check on a single ede.
-    bool is_valid(Edge_index e) const {
-      Halfedge_index h = halfedge(e);
-      return is_valid(h) && is_valid(opposite(h));
-    }
-
-
-    /// performs a validity check on a single face.
-    bool is_valid(Face_index f) const {
-        Halfedge_index h = fconn_[f].halfedge_;
-        if(!has_valid_index(h) || is_removed(h)) {
-          std::cerr << "Face connectivity halfedge error in " << (size_type)f
-                      << " with " << (size_type)h << std::endl;
-            return false;
-        }
-        return true;
-    }
-
-    ///@}
-
-
-
-    /// \name Low-Level Connectivity
-    ///@{
-
-    /// returns the vertex the halfedge `h` points to.
-    Vertex_index target(Halfedge_index h) const
-    {
-        return hconn_[h].vertex_;
-    }
-
-    /// sets the vertex the halfedge `h` points to to `v`.
-    void set_target(Halfedge_index h, Vertex_index v)
-    {
-        hconn_[h].vertex_ = v;
-    }
-
-    /// returns the face incident to halfedge `h`.
-    Face_index face(Halfedge_index h) const
-    {
-        return hconn_[h].face_;
-    }
-
-    /// sets the incident face to halfedge `h` to `f`.
-    void set_face(Halfedge_index h, Face_index f)
-    {
-        hconn_[h].face_ = f;
-    }
-
-    /// returns the next halfedge within the incident face.
-    Halfedge_index next(Halfedge_index h) const
-    {
-        return hconn_[h].next_halfedge_;
-    }
-
-    /// returns the previous halfedge within the incident face.
-    Halfedge_index prev(Halfedge_index h) const
-    {
-        return hconn_[h].prev_halfedge_;
-    }
-
-    /// @cond CGAL_DOCUMENT_INTERNALS
-    // sets the next halfedge of `h` within the face to `nh`.
-    void set_next_only(Halfedge_index h, Halfedge_index nh)
-    {
-      hconn_[h].next_halfedge_ = nh;
-    }
-
-    // sets previous halfedge of `h` to `nh`.
-    void set_prev_only(Halfedge_index h, Halfedge_index nh)
-    {
-      if(h != null_halfedge()){
-        hconn_[h].prev_halfedge_ = nh;
-      }
-    }
-    /// @endcond  
-
-    /// sets the next halfedge of `h` within the face to `nh` and
-    /// the previous halfedge of `nh` to `h`.
-    void set_next(Halfedge_index h, Halfedge_index nh)
-    {
-      set_next_only(h, nh);
-      set_prev_only(nh, h);
-    }
-
-    /// returns an incoming halfedge of vertex `v`.
-    /// If `v` is a border vertex this will be a border halfedge.
-    /// \invariant `target(halfedge(v)) == v`
-    Halfedge_index halfedge(Vertex_index v) const
-    {
-        return vconn_[v].halfedge_;
-    }
-
-    /// sets the incoming halfedge of vertex `v` to `h`.
-    void set_halfedge(Vertex_index v, Halfedge_index h)
-    {
-        vconn_[v].halfedge_ = h;
-    }
-
-
-    /// returns a halfedge of face `f`.
-    Halfedge_index halfedge(Face_index f) const
-    {
-        return fconn_[f].halfedge_;
-    }
-
-    /// sets the halfedge of face `f` to `h`.
-    void set_halfedge(Face_index f, Halfedge_index h)
-    {
-        fconn_[f].halfedge_ = h;
-    }
-
-    /// returns the opposite halfedge of `h`. Note that there is no function `set_opposite()`.
-    Halfedge_index opposite(Halfedge_index h) const
-    {
-        return Halfedge_index(((size_type)h & 1) ? (size_type)h-1 : (size_type)h+1);
-    }
-
-    ///@}
-
-    /// \name Low-Level Connectivity Convenience Functions
-    ///@{
-
-    /// returns the vertex the halfedge `h` emanates from.
-    Vertex_index source(Halfedge_index h) const
-    {
-        return target(opposite(h));
-    }
-
-    /// returns `opposite(next(h))`, that is the next halfedge \ref SurfaceMeshOrientation 
-    /// "clockwise" around the target vertex of `h`.
-    Halfedge_index next_around_target(Halfedge_index h) const
-    {
-        return opposite(next(h));
-    }
-
-    /// returns `prev(opposite(h))`, that is the previous halfedge \ref SurfaceMeshOrientation
-    /// "clockwise" around the target vertex of `h`.
-    Halfedge_index prev_around_target(Halfedge_index h) const
-    {
-        return prev(opposite(h));
-    }
-
-    /// returns `next(opposite(h))`, that is the next halfedge \ref SurfaceMeshOrientation 
-    /// "clockwise" around the source vertex of `h`.
-    Halfedge_index next_around_source(Halfedge_index h) const
-    {
-        return next(opposite(h));
-    }
-
-    /// returns `opposite(prev(h))`, that is the previous halfedge \ref SurfaceMeshOrientation
-    /// "clockwise" around the source vertex of `h`.
-    Halfedge_index prev_around_source(Halfedge_index h) const
-    {
-        return opposite(prev(h));
-    }
-
-    /// returns the i'th vertex of edge `e`, for `i=0` or `1`.
-    Vertex_index vertex(Edge_index e, unsigned int i) const
-    {
-        CGAL_assertion(i<=1);
-        return target(halfedge(e, i));
-    }
-
-    /// finds a halfedge between two vertices. Returns a default constructed
-    /// `Halfedge_index`, if  `source` and  `target` are not connected.
-    Halfedge_index halfedge(Vertex_index source, Vertex_index target) const;
-
-    ///@}
-
-
-    /// \name Switching between Halfedges and Edges
-    ///@{
-
-    /// returns the edge that contains halfedge `h` as one of its two halfedges.
-    Edge_index edge(Halfedge_index h) const
-    {
-        return Edge_index(h);
-    }
-
-    /// returns the halfedge corresponding to the edge `e`.
-    Halfedge_index halfedge(Edge_index e) const
-    {
-        return Halfedge_index(e.halfedge());
-    }
-
-    /// returns the i'th halfedge of edge `e`, for `i=0` or `1`.
-    Halfedge_index halfedge(Edge_index e, unsigned int i) const
-    {
-        CGAL_assertion(i<=1);
-        return Halfedge_index(((size_type)e << 1) + i);
-    }
-
-    ///@}
-
-
-    /// \name Degree Functions
-    ///@{
-
-    /// returns the number of incident halfedges of vertex `v`.
-    size_type degree(Vertex_index v) const;
-
-    /// returns the number of incident halfedges of face `f`.
-    size_type degree(Face_index f) const;
-
-    ///@}
-
-
-
-    /// \name Borders
-    ///
-    ///  A halfedge, or edge is on the border of a surface mesh
-    /// if it is incident to a `null_face()`.  A vertex is on a border
-    /// if it is incident to a border halfedge. While for a halfedge and
-    /// edge this is a constant time operation, for a vertex it means
-    /// to look at all incident halfedges.  If algorithms operating on a 
-    /// surface mesh maintain that the halfedge associated to a border vertex is
-    /// a border halfedge, this is a constant time operation too.  
-    /// This section provides functions to check if an element is on a 
-    /// border and to change the halfedge associated to a border vertex.
-    ///@{
-
-    /// returns whether `v` is a border vertex. 
-    /// \cgalAdvancedBegin
-    /// With the default value for
-    /// `check_all_incident_halfedges` the function iteratates over the incident halfedges.
-    /// With `check_all_incident_halfedges == false` the function returns `true`, if the incident
-    /// halfedge associated to vertex `v` is a border halfedge.
-    /// \cgalAdvancedEnd
-  bool is_border(Vertex_index v, bool check_all_incident_halfedges = true) const
-    {
-        Halfedge_index h(halfedge(v));
-        if (h == null_halfedge()){
-          return false;
-        }
-        if(check_all_incident_halfedges){
-          Halfedge_around_target_circulator hatc(h,*this), done(hatc);
-          do {
-            if(is_border(*hatc)){
-              return true;
-            }
-          }while(++hatc != done);
-          return false;
-        }
-        return (!(is_valid(h) && is_border(h)));
-    }
-
-    /// returns whether `h` is a border halfege, that is if its incident face is `sm.null_face()`.
-    bool is_border(Halfedge_index h) const
-    {
-        return !face(h).is_valid();
-    }
-
-
-    /// returns whether `e` is a border edge, i.e., if any 
-    /// of its two halfedges is a border halfedge.
-    bool is_border(Edge_index e) const
-    {
-      return is_border(e.halfedge()) || is_border(opposite(e.halfedge()));
-    }
-
-  /// iterates over the incident halfedges and sets the incident halfedge
-  /// associated to vertex `v` to a border halfedge and returns `true` if it exists.
-  bool set_vertex_halfedge_to_border_halfedge(Vertex_index v)
-  {
-    if(halfedge(v) == null_halfedge()){
-      return false;
-    }
-    Halfedge_around_target_circulator hatc(halfedge(v),*this), done(hatc);
-    do {
-      if(is_border(*hatc)){
-        set_halfedge(v,*hatc);
-        return true;
-      }
-    }while(++hatc != done);
-    return false;
-  }
-
-  /// applies `set_vertex_halfedge_to_border_halfedge(Vertex_index)` on all vertices 
-  /// around the face associated to `h`.
-  void set_vertex_halfedge_to_border_halfedge(Halfedge_index h)
-  {
-    if(is_border(h)){
-      Halfedge_around_face_circulator hafc(h,*this),done(hafc);
-      do {
-        set_halfedge(target(*hafc),*hafc);
-      }while(++hafc != done);
-    } else {
-       Vertex_around_face_circulator vafc(h,*this),done(vafc);
-      do {
-        set_vertex_halfedge_to_border_halfedge(*vafc);
-      }while(++vafc != done);
-    }
-  }
-
-  /// applies `set_vertex_halfedge_to_border_halfedge(Vertex_index)` on all vertices 
-  /// of the surface mesh.
-  void set_vertex_halfedge_to_border_halfedge()
-  {
-    BOOST_FOREACH(Halfedge_index h, halfedges()){
-      if(is_border(h)){
-          set_halfedge(target(h),h);
-        }
-    }
-  }
-
-
-    /// returns whether `v` is isolated, i.e., incident to `Surface_mesh::null_halfedge()`.
-    bool is_isolated(Vertex_index v) const
-    {
-        return !halfedge(v).is_valid();
-    }
-
-    ///@}
-
-
-private: //--------------------------------------------------- property handling
-
-  // Property_selector maps an index type to a property_container, the
-  // dummy is necessary to make it a partial specialization (full
-  // specializations are only allowed at namespace scope).
-  template<typename, bool = true>
-  struct Property_selector {};
-
-  template<bool dummy>
-  struct Property_selector<typename CGAL::Surface_mesh<P>::Vertex_index, dummy> {
-    CGAL::Surface_mesh<P>* m_;
-    Property_selector(CGAL::Surface_mesh<P>* m) : m_(m) {}
-    Property_container<typename CGAL::Surface_mesh<P>::Vertex_index>&
-    operator()() { return m_->vprops_; }
-  };
-  template<bool dummy>
-  struct Property_selector<typename CGAL::Surface_mesh<P>::Halfedge_index, dummy> {
-    CGAL::Surface_mesh<P>* m_;
-    Property_selector(CGAL::Surface_mesh<P>* m) : m_(m) {}
-    Property_container<typename CGAL::Surface_mesh<P>::Halfedge_index>&
-    operator()() { return m_->hprops_; }
-  };
-  template<bool dummy>
-  struct Property_selector<typename CGAL::Surface_mesh<P>::Edge_index, dummy> {
-    CGAL::Surface_mesh<P>* m_;
-    Property_selector(CGAL::Surface_mesh<P>* m) : m_(m) {}
-    Property_container<typename CGAL::Surface_mesh<P>::Edge_index>&
-    operator()() { return m_->eprops_; }
-  };
-  template<bool dummy>
-  struct Property_selector<typename CGAL::Surface_mesh<P>::Face_index, dummy> {
-    CGAL::Surface_mesh<P>* m_;
-    Property_selector(CGAL::Surface_mesh<P>* m) : m_(m) {}
-    Property_container<typename CGAL::Surface_mesh<P>::Face_index>&
-    operator()() { return m_->fprops_; }
-  };
-
-    public:
- 
-
- /*! \name Property Handling
-
- A `Property_map<I,T>` allows to associate properties of type `T` to a vertex, halfdge, edge, or face index type I.
- Properties can be added, and looked up with a string, and they can be removed at runtime.
- The \em point property of type `P` is associated to the string "v:point". 
-
-    */
-    ///@{
-
-  /// Model of `LvaluePropertyMap` with `I` as key type and `T` as value type, where `I`
-  /// is either a vertex, halfedge, edge, or face index type.
-#ifdef DOXYGEN_RUNNING
-  template <class I, class T>
-  using Property_map = unspecified_type;
-
-#else
-
-
-#endif
-
-    /// adds a property map named `name` with value type `T` and default `t`
-    /// for index type `I`. Returns the property map together with a Boolean 
-    /// that is `true` if a new map was created. In case it already exists
-    /// the existing map together with `false` is returned.
-
-  
-    template<class I, class T>
-    std::pair<Property_map<I, T>, bool>
-    add_property_map(const std::string& name, const T t=T()) {
-      return Property_selector<I>(this)().template add<T>(name, t);
-    }
-
- 
-    /// returns a property map named `name` with key type `I` and value type `T`, 
-    /// and a Boolean that is `true` if the property exists. 
-    /// In case it does not exist the Boolean is `false` and the behavior of
-    /// the property map is undefined.
-    template <class I, class T>
-    std::pair<Property_map<I, T>,bool> property_map(const std::string& name) const
-    {
-      return Property_selector<I>(const_cast<Surface_mesh*>(this))().template get<T>(name);
-    }
-
-
-    /// removes property map `p`. The memory allocated for that property map is
-    /// freed.
-    template<class I, class T>
-    void remove_property_map(Property_map<I, T>& p)
-    {
-      (Property_selector<I>(this)()).remove(p);
-    }
-
-    /// @cond CGAL_DOCUMENT_INTERNALS
-    /// returns the std::type_info of the value type of the
-    /// property identified by `name`.  `typeid(void)` if `name`
-    /// does not identify any property.
-    ///
-    /// @tparam I The key type of the property. 
-
-    template<class I>
-    const std::type_info& property_type(const std::string& name)
-    {
-      return Property_selector<I>(this)().get_type(name);
-    }
-    /// @endcond
-
-    /// returns a vector with all strings that describe properties with the key type `I`.
-    /// @tparam I The key type of the properties.
-    template<class I>
-    std::vector<std::string> properties() const
-    {
-      return Property_selector<I>(this)().properties();
-    }
-
-    /// returns the property for the string "v:point".
-    Property_map<Vertex_index, Point>
-    points() const { return vpoint_; }
-
-    /// returns the point associated to vertex `v`.
-    const Point&
-    point(Vertex_index v) const { return vpoint_[v]; }
-
-    /// returns the point associated to vertex `v`.
-    Point&
-    point(Vertex_index v) { return vpoint_[v]; }
-
-    /// @cond CGAL_DOCUMENT_INTERNALS
-    /// prints property statistics to the stream `out`. The output is human-readable but
-    /// not machine-friendly.  
-    ///
-    void property_stats(std::ostream& out = std::cout) const;
-    /// @endcond
-    ///@}
-
-
- /// \name Null Elements
-    ///@{
-
-  /// returns `Vertex_index(-1)`.
-  static Vertex_index null_vertex()
-  {
-    return vertex_index(-1);
-  }
-
-  /// returns `Edge_index(-1)`.
-  static Edge_index null_edge()
-  {
-    return edge_index(-1);
-  }
-  /// returns `Halfedge_index(-1)`.
-  static Halfedge_index null_halfedge()
-  {
-    return halfedge_index(-1);
-  }
-  /// returns `Face_index(-1)`.
-  static Face_index null_face()
-  {
-    return face_index(-1);
-  }
-  /// @}
-
-  
-private: //--------------------------------------------------- helper functions
-
-
-    /// make sure that the incoming halfedge of vertex v is a border halfedge
-    /// if `v` is a border vertex.
-    void adjust_incoming_halfedge(Vertex_index v);
-
-private: //------------------------------------------------------- private data
-    Property_container<Vertex_index> vprops_;
-    Property_container<Halfedge_index> hprops_;
-    Property_container<Edge_index> eprops_;
-    Property_container<Face_index> fprops_;
-
-    Property_map<Vertex_index, Vertex_connectivity>      vconn_;
-    Property_map<Halfedge_index, Halfedge_connectivity>  hconn_;
-    Property_map<Face_index, Face_connectivity>          fconn_;
-
-    Property_map<Vertex_index, bool>  vremoved_;
-    Property_map<Edge_index, bool>    eremoved_;
-    Property_map<Face_index, bool>    fremoved_;
-
-    Property_map<Vertex_index, Point>   vpoint_;
-
-    size_type removed_vertices_;
-    size_type removed_edges_;
-    size_type removed_faces_;
-
-    size_type vertices_freelist_;
-    size_type edges_freelist_;
-    size_type faces_freelist_;
-    bool garbage_;
-};
-
-  /*! \addtogroup PkgSurface_mesh
-   *
-   * @{
-   */
-
-  /// \relates Surface_mesh
-  /// Inserts `other` into `sm`. 
-  /// Shifts the indices of vertices of `other` by `sm.number_of_vertices() + sm.number_of_removed_vertices()`
-  /// and analoguously for halfedges, edges, and faces.
-  /// Copies entries of all property maps which have the same name in `sm` and `other`. 
-  /// that is, property maps which are only in `other` are ignored.
-  /// Also copies elements which are marked as removed, and concatenates the freelists of `sm` and `other`. 
-
-  template <typename P>
-  Surface_mesh<P>& operator+=(Surface_mesh<P>& sm, const Surface_mesh<P>& other)
-  {
-    sm.join(other);
-    return sm;
-  }
-
-  /// \relates Surface_mesh
-  /// Inserts the surface mesh in an output stream in Ascii OFF format. 
-  /// Only the \em point property is inserted in the stream.
-  /// \pre `operator<<(std::ostream&,const P&)` must be defined.
-  template <typename P>
-  std::ostream& operator<<(std::ostream& os, const Surface_mesh<P>& sm)
-  {
-    typedef Surface_mesh<P> Mesh;
-    typedef typename Mesh::Vertex_index Vertex_index;
-    typedef typename Mesh::Face_index Face_index;
-
-    os << "OFF\n" << sm.number_of_vertices() << " " << sm.number_of_faces() << " 0\n";
-    std::vector<int> reindex;
-    reindex.resize(sm.num_vertices());
-    int n = 0;
-    BOOST_FOREACH(Vertex_index v, sm.vertices()){
-      os << sm.point(v) << '\n';
-      reindex[v]=n++;
-    }
-
-    BOOST_FOREACH(Face_index f, sm.faces()){
-      os << sm.degree(f);
-      BOOST_FOREACH(Vertex_index v, CGAL::vertices_around_face(sm.halfedge(f),sm)){
-        os << " " << reindex[v];
-      }
-      os << '\n';
-    }
-    return os;
-  }
-
-/// @cond CGAL_DOCUMENT_INTERNALS
-
-  inline std::istream& sm_skip_comments( std::istream& in) {
-      char c;
-      in >> c;
-      if (c == '#')
-        in.ignore((std::numeric_limits<std::streamsize>::max)(), '\n');
-      else
-        in.putback(c);
-      return in;
-  }
-/// @endcond
-
-
-  /// \relates Surface_mesh
-  /// Extracts the surface mesh from an input stream in Ascii OFF format.
-  /// The operator only reads the point property and does not read files 
-  /// with vertex normals or textures.
-  /// \pre `operator>>(std::istream&,const P&)` must be defined.
-  template <typename P>
-  std::istream& operator>>(std::istream& is, Surface_mesh<P>& sm)
-  {
-    typedef Surface_mesh<P> Mesh;
-    typedef typename Mesh::size_type size_type;
-    sm.clear();
-    int n, f, e;
-    std::string off;
-    is >> off;
-    CGAL_assertion(off == "OFF" || off == "COFF");
-    is >> n >> f >> e;
-    sm.reserve(n,2*f,e);
-    P p;
-    for(int i=0; i < n; i++){
-      is >> sm_skip_comments;
-      is >> p;
-      sm.add_vertex(p);
-      is.ignore((std::numeric_limits<std::streamsize>::max)(), '\n');
-    }
-    std::vector<size_type> vr;
-    std::size_t d;
-    for(int i=0; i < f; i++){
-      is >> sm_skip_comments;
-      is >> d;
-      vr.resize(d);
-      for(std::size_t j=0; j<d; j++){
-        is >> vr[j];
-      }
-      sm.add_face(vr);
-    }
-    return is;
-  }
-
- 
- /*! @} */
-
-template <typename P>
-Surface_mesh<P>::
-Surface_mesh()
-{
-    // allocate standard properties
-    // same list is used in operator=() and assign()
-    vconn_    = add_property_map<Vertex_index, Vertex_connectivity>("v:connectivity").first;
-    hconn_    = add_property_map<Halfedge_index, Halfedge_connectivity>("h:connectivity").first;
-    fconn_    = add_property_map<Face_index, Face_connectivity>("f:connectivity").first;
-    vpoint_   = add_property_map<Vertex_index, Point>("v:point").first;
-    vremoved_ = add_property_map<Vertex_index, bool>("v:removed", false).first;
-    eremoved_ = add_property_map<Edge_index, bool>("e:removed", false).first;
-    fremoved_ = add_property_map<Face_index, bool>("f:removed", false).first;
-
-    removed_vertices_ = removed_edges_ = removed_faces_ = 0;
-    vertices_freelist_ = edges_freelist_ = faces_freelist_ = -1;
-    garbage_ = false;
-}
-
-
-//-----------------------------------------------------------------------------
-template <typename P>
-Surface_mesh<P>&
-Surface_mesh<P>::
-operator=(const Surface_mesh<P>& rhs)
-{
-    if (this != &rhs)
-    {
-        // deep copy of property containers
-        vprops_ = rhs.vprops_;
-        hprops_ = rhs.hprops_;
-        eprops_ = rhs.eprops_;
-        fprops_ = rhs.fprops_;
-
-        // property handles contain pointers, have to be reassigned
-        vconn_    = property_map<Vertex_index, Vertex_connectivity>("v:connectivity").first;
-        hconn_    = property_map<Halfedge_index, Halfedge_connectivity>("h:connectivity").first;
-        fconn_    = property_map<Face_index, Face_connectivity>("f:connectivity").first;
-        vremoved_ = property_map<Vertex_index, bool>("v:removed").first;
-        eremoved_ = property_map<Edge_index, bool>("e:removed").first;
-        fremoved_ = property_map<Face_index, bool>("f:removed").first;
-        vpoint_   = property_map<Vertex_index, P>("v:point").first;
-
-        // how many elements are removed?
-        removed_vertices_  = rhs.removed_vertices_;
-        removed_edges_     = rhs.removed_edges_;
-        removed_faces_     = rhs.removed_faces_;
-        vertices_freelist_ = rhs.vertices_freelist_;
-        edges_freelist_    = rhs.edges_freelist_;
-        faces_freelist_    = rhs.faces_freelist_;
-        garbage_           = rhs.garbage_;
-    }
-
-    return *this;
-}
-
-
-//-----------------------------------------------------------------------------
-template <typename P>
-Surface_mesh<P>&
-Surface_mesh<P>::
-assign(const Surface_mesh<P>& rhs)
-{
-    if (this != &rhs)
-    {
-        // clear properties
-        vprops_.clear();
-        hprops_.clear();
-        eprops_.clear();
-        fprops_.clear();
-
-        // allocate standard properties
-        vconn_    = add_property_map<Vertex_index, Vertex_connectivity>("v:connectivity").first;
-        hconn_    = add_property_map<Halfedge_index, Halfedge_connectivity>("h:connectivity").first;
-        fconn_    = add_property_map<Face_index, Face_connectivity>("f:connectivity").first;
-        vpoint_   = add_property_map<Vertex_index, P>("v:point").first;
-        vremoved_ = add_property_map<Vertex_index, bool>("v:removed", false).first;
-        eremoved_ = add_property_map<Edge_index, bool>("e:removed", false).first;
-        fremoved_ = add_property_map<Face_index, bool>("f:removed", false).first;
-
-        // copy properties from other mesh
-        vconn_.array()     = rhs.vconn_.array();
-        hconn_.array()     = rhs.hconn_.array();
-        fconn_.array()     = rhs.fconn_.array();
-        vpoint_.array()    = rhs.vpoint_.array();
-        vremoved_.array()  = rhs.vremoved_.array();
-        eremoved_.array()  = rhs.eremoved_.array();
-        fremoved_.array()  = rhs.fremoved_.array();
-
-        // resize (needed by property containers)
-        vprops_.resize(rhs.num_vertices());
-        hprops_.resize(rhs.num_halfedges());
-        eprops_.resize(rhs.num_edges());
-        fprops_.resize(rhs.num_faces());
-
-        // how many elements are removed?
-        removed_vertices_  = rhs.removed_vertices_;
-        removed_edges_     = rhs.removed_edges_;
-        removed_faces_     = rhs.removed_faces_;
-        vertices_freelist_ = rhs.vertices_freelist_;
-        edges_freelist_    = rhs.edges_freelist_;
-        faces_freelist_    = rhs.faces_freelist_;
-        garbage_           = rhs.garbage_;
-    }
-
-    return *this;
-}
-
-//-----------------------------------------------------------------------------
-template <typename P>
-void
-Surface_mesh<P>::
-clear()
-{
-    vprops_.resize(0);
-    hprops_.resize(0);
-    eprops_.resize(0);
-    fprops_.resize(0);
-
-    vprops_.shrink_to_fit();
-    hprops_.shrink_to_fit();
-    eprops_.shrink_to_fit();
-    fprops_.shrink_to_fit();
-
-    removed_vertices_ = removed_edges_ = removed_faces_ = 0;
-    vertices_freelist_ = edges_freelist_ = faces_freelist_ = -1;
-    garbage_ = false;
-}
-
-//-----------------------------------------------------------------------------
-/// @cond CGAL_DOCUMENT_INTERNALS
-template <typename P>
-void
-Surface_mesh<P>::
-property_stats(std::ostream& out) const
-{
-    std::vector<std::string> props;
-
-    out << "vertex properties:\n";
-    props = properties<Vertex_index>();
-    for (unsigned int i=0; i<props.size(); ++i)
-        out << "\t" << props[i] << std::endl;
-
-    out << "halfedge properties:\n";
-    props = properties<Halfedge_index>();
-    for (unsigned int i=0; i<props.size(); ++i)
-        out << "\t" << props[i] << std::endl;
-
-    out << "edge properties:\n";
-    props = properties<Edge_index>();
-    for (unsigned int i=0; i<props.size(); ++i)
-        out << "\t" << props[i] << std::endl;
-
-    out << "face properties:\n";
-    props = properties<Face_index>();
-    for (unsigned int i=0; i<props.size(); ++i)
-        out << "\t" << props[i] << std::endl;
-}
-/// @endcond
-
-//-----------------------------------------------------------------------------
-template <typename P>
-typename Surface_mesh<P>::Halfedge_index
-Surface_mesh<P>::
-halfedge(Vertex_index source, Vertex_index target) const
-{
-    CGAL_assertion(has_valid_index(source) && has_valid_index(target));
-
-    Halfedge_index h  = halfedge(target);
-    const Halfedge_index hh = h;
-
-    if (h.is_valid())
-    {
-        do
-        {
-            if (this->source(h) == source)
-              return h;
-            h = next_around_target(h);
-        }
-        while (h != hh);
-    }
-
-    return Halfedge_index();
-}
-
-
-//-----------------------------------------------------------------------------
-template <typename P>
-void
-Surface_mesh<P>::
-adjust_incoming_halfedge(Vertex_index v)
-{
-    Halfedge_index h  = halfedge(v);
-    Halfedge_index hh = h;
-
-    if (h.is_valid())
-    {
-        if (target(h) != v)
-        {
-            // wrong target, flip
-            h = opposite(h);
-            hh = h;
-            set_halfedge(v, h);
-        }
-
-        do
-        {
-            if (is_border(h))
-            {
-                set_halfedge(v, h);
-                return;
-            }
-            h = next_around_target(h);
-        }
-        while (h != hh);
-    }
-}
-
-//-----------------------------------------------------------------------------
-
- /// @cond CGAL_DOCUMENT_INTERNALS
-
-template <typename P>
-template <typename Range>
-typename Surface_mesh<P>::Face_index
-Surface_mesh<P>::add_face(const Range& r)
-{
-  return CGAL::Euler::add_face(r, *this);
-}
-
-  /// @endcond
-
-//-----------------------------------------------------------------------------
-template <typename P>
-typename Surface_mesh<P>::size_type
-Surface_mesh<P>::
-degree(Vertex_index v) const
-{
-    size_type count(0);
-    if(halfedge(v) == null_halfedge()){
-      return 0;
-    }
-    Vertex_around_target_circulator vvit(halfedge(v), *this);
-    Vertex_around_target_circulator vvend = vvit;
-    if(vvit) do
-    {
-        ++count;
-    } while (++vvit != vvend);
-
-    return count;
-}
-
-
-//-----------------------------------------------------------------------------
-template <typename P>
-typename Surface_mesh<P>::size_type
-Surface_mesh<P>::
-degree(Face_index f) const
-{
-    size_type count(0);
-    if(halfedge(f) == null_halfedge()){
-      return 0;
-    }
-    Vertex_around_face_circulator fvit(halfedge(f),*this);
-    Vertex_around_face_circulator fvend = fvit;
-    if(fvit) do {
-        ++count;
-    } while (++fvit != fvend);
-
-    return count;
-}
-
-template <typename P>
-void
-Surface_mesh<P>::
-collect_garbage()
-{
-    int  i, i0, i1,
-    nV(num_vertices()),
-    nE(num_edges()),
-    nH(num_halfedges()),
-    nF(num_faces());
-
-    Vertex_index    v;
-    Halfedge_index  h;
-    Face_index      f;
-
-
-    // setup index mapping%
-    Property_map<Vertex_index, Vertex_index>      vmap = add_property_map<Vertex_index, Vertex_index>("v:garbage-collection").first;
-    Property_map<Halfedge_index, Halfedge_index>  hmap = add_property_map<Halfedge_index, Halfedge_index>("h:garbage-collection").first;
-    Property_map<Face_index, Face_index>          fmap = add_property_map<Face_index, Face_index>("f:garbage-collection").first;
-    for (i=0; i<nV; ++i)
-        vmap[Vertex_index(i)] = Vertex_index(i);
-    for (i=0; i<nH; ++i)
-        hmap[Halfedge_index(i)] = Halfedge_index(i);
-    for (i=0; i<nF; ++i)
-        fmap[Face_index(i)] = Face_index(i);
-
-
-
-    // really remove vertices
-    if (nV > 0)
-    {
-        i0=0;  i1=nV-1;
-
-        while (1)
-        {
-            // find first removed and last un-removed
-            while (!vremoved_[Vertex_index(i0)] && i0 < i1)  ++i0;
-            while ( vremoved_[Vertex_index(i1)] && i0 < i1)  --i1;
-            if (i0 >= i1) break;
-
-            // swap
-            vprops_.swap(i0, i1);
-        };
-
-        // remember new size
-        nV = vremoved_[Vertex_index(i0)] ? i0 : i0+1;
-    }
-
-    // really remove edges
-    if (nE > 0)
-    {
-        i0=0;  i1=nE-1;
-
-        while (1)
-        {
-            // find first removed and last un-removed
-            while (!eremoved_[Edge_index(i0)] && i0 < i1) ++i0;
-            while ( eremoved_[Edge_index(i1)] && i0 < i1) --i1;
-            if (i0 >= i1) break;
-
-            // swap
-            eprops_.swap(i0, i1);
-            hprops_.swap(2*i0,   2*i1);
-            hprops_.swap(2*i0+1, 2*i1+1);
-        };
-
-        // remember new size
-        nE = eremoved_[Edge_index(i0)] ? i0 : i0+1;
-        nH = 2*nE;
-    }
-
-
-    // really remove faces
-    if (nF > 0)
-    {
-        i0=0;  i1=nF-1;
-
-        while (1)
-        {
-            // find 1st removed and last un-removed
-            while (!fremoved_[Face_index(i0)] && i0 < i1)  ++i0;
-            while ( fremoved_[Face_index(i1)] && i0 < i1)  --i1;
-            if (i0 >= i1) break;
-
-            // swap
-            fprops_.swap(i0, i1);
-        };
-
-        // remember new size
-        nF = fremoved_[Face_index(i0)] ? i0 : i0+1;
-    }
-
-
-    // update vertex connectivity
-    for (i=0; i<nV; ++i)
-    {
-        v = Vertex_index(i);
-        if (!is_isolated(v))
-            set_halfedge(v, hmap[halfedge(v)]);
-    }
-
-
-    // update halfedge connectivity
-    for (i=0; i<nH; ++i)
-    {
-        h = Halfedge_index(i);
-        set_target(h, vmap[target(h)]);
-        set_next(h, hmap[next(h)]);
-        if (!is_border(h))
-            set_face(h, fmap[face(h)]);
-    }
-
-
-    // update indices of faces
-    for (i=0; i<nF; ++i)
-    {
-        f = Face_index(i);
-        set_halfedge(f, hmap[halfedge(f)]);
-    }
-
-    // remove index maps
-    remove_property_map<Vertex_index>(vmap);
-    remove_property_map<Halfedge_index>(hmap);
-    remove_property_map<Face_index>(fmap);
-
-    // finally resize arrays
-    vprops_.resize(nV); vprops_.shrink_to_fit();
-    hprops_.resize(nH); hprops_.shrink_to_fit();
-    eprops_.resize(nE); eprops_.shrink_to_fit();
-    fprops_.resize(nF); fprops_.shrink_to_fit();
-
-    removed_vertices_ = removed_edges_ = removed_faces_ = 0;
-    vertices_freelist_ = edges_freelist_ = faces_freelist_ = -1;
-    garbage_ = false;
-}
-
-
-
-} // CGAL
-
-
-namespace std {
-
-#if defined(BOOST_MSVC)
-#  pragma warning(push)
-#  pragma warning(disable:4099) // For VC10 it is class hash 
-#endif
-
-#ifndef CGAL_CFG_NO_STD_HASH
-
-  template <>
-  struct hash<CGAL::SM_Halfedge_index >
-    : public std::unary_function<CGAL::SM_Halfedge_index, std::size_t> {
-
-    std::size_t operator()(const CGAL::SM_Halfedge_index& i) const
-    {
-      return i;
-    }
-  };
-
-  template <>
-  struct hash<CGAL::SM_Vertex_index >
-    : public std::unary_function<CGAL::SM_Vertex_index, std::size_t>  {
-
-    std::size_t operator()(const CGAL::SM_Vertex_index& i) const
-    {
-      return i;
-    }
-  };
-
-  template <>
-  struct hash<CGAL::SM_Face_index > 
-    : public std::unary_function<CGAL::SM_Face_index, std::size_t> {
-
-    std::size_t operator()(const CGAL::SM_Face_index& i) const
-    {
-      return i;
-    }
-  };
-
-  template <>
-  struct hash<CGAL::SM_Edge_index >
-    : public std::unary_function<CGAL::SM_Edge_index, std::size_t>  {
-
-    std::size_t operator()(const CGAL::SM_Edge_index& i) const
-    {
-      return i;
-    }
-  };
-#endif // CGAL_CFG_NO_STD_HASH
-
-#if defined(BOOST_MSVC)
-#  pragma warning(pop)
-#endif
-
-} // namespace std
-
-namespace boost {
-  template <>
-  struct hash<CGAL::SM_Vertex_index > {
-    std::size_t operator()(const CGAL::SM_Vertex_index& i) const
-    {
-      return i;
-    }
-  };
-
-} // namespace boost
-
-#endif /* CGAL_SURFACE_MESH_H */
-
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_deformation.h b/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_deformation.h
deleted file mode 100644
index c31255c..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_deformation.h
+++ /dev/null
@@ -1,1537 +0,0 @@
-// Copyright (c) 2014 GeometryFactory
-// 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
-// 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(s)     : Yin Xu, Andreas Fabri and Ilker O. Yaz
-
-#ifndef CGAL_SURFACE_MESH_DEFORMATION_H
-#define CGAL_SURFACE_MESH_DEFORMATION_H
-
-#include <CGAL/config.h>
-#include <CGAL/Default.h>
-#include <CGAL/tuple.h>
-
-#include <CGAL/Polygon_mesh_processing/Weights.h>
-#include <CGAL/Simple_cartesian.h>
-
-#include <vector>
-#include <list>
-#include <utility>
-#include <limits>
-#include <boost/foreach.hpp>
-
-/*
-#define CGAL_DEFORM_MESH_USE_EXPERIMENTAL_SCALE // define it to activate optimal scale calculation,
-// then you can define below to just scale, if not both rotate and scale will be activated
-#define CGAL_DEFORM_MESH_JUST_EXPERIMENTAL_SCALE // to not to rotate but just scale
-*/
-
-// for default parameters
-#if defined(CGAL_EIGEN3_ENABLED)
-#include <CGAL/Eigen_solver_traits.h>  // for sparse linear system solver
-#include <CGAL/Deformation_Eigen_polar_closest_rotation_traits_3.h>  // for 3x3 closest rotation computer
-#endif
-
-namespace CGAL {
-
-/// \ingroup PkgSurfaceMeshDeformation
-///@brief Deformation algorithm type
-enum Deformation_algorithm_tag
-{
-  ORIGINAL_ARAP,  /**< use original as-rigid-as possible algorithm */
-  SPOKES_AND_RIMS /**< use spokes and rims version of as-rigid-as possible algorithm */
-};
-
-/// @cond CGAL_DOCUMENT_INTERNAL
-namespace internal {
-template<class HalfedgeGraph, Deformation_algorithm_tag deformation_algorithm_tag>
-struct Weight_calculator_selector;
-
-template<class HalfedgeGraph>
-struct Weight_calculator_selector<HalfedgeGraph, CGAL::SPOKES_AND_RIMS> {
-  typedef Single_cotangent_weight_impl<HalfedgeGraph> weight_calculator;
-};
-
-template<class HalfedgeGraph>
-struct Weight_calculator_selector<HalfedgeGraph, CGAL::ORIGINAL_ARAP> {
-  typedef Cotangent_weight_impl<HalfedgeGraph> weight_calculator;
-};
-
-// property map that create a Simple_cartesian<double>::Point_3
-// on the fly in order the deformation class to be used
-// with points with minimal requirements
-template <class Vertex_point_map>
-struct SC_on_the_fly_pmap: public Vertex_point_map{
-  typedef boost::readable_property_map_tag category;
-  typedef CGAL::Simple_cartesian<double>::Point_3 value_type;
-  typedef value_type reference;
-  typedef typename boost::property_traits<Vertex_point_map>::key_type key_type;
-
-  SC_on_the_fly_pmap(Vertex_point_map base):
-    Vertex_point_map(base) {}
-
-  friend value_type
-  get(const SC_on_the_fly_pmap map, key_type k)
-  {
-    typename boost::property_traits<Vertex_point_map>::reference base=
-      get(static_cast<const Vertex_point_map&>(map), k);
-    return value_type(base[0], base[1], base[2]);
-  }
-};
-
-
-}//namespace internal
-/// @endcond
-
- ///
- /// \ingroup PkgSurfaceMeshDeformation
- /// @brief Class providing the functionalities for deforming a triangulated surface mesh
- ///
- /// @tparam HG a model of HalfedgeGraph
- /// @tparam VIM a model of `ReadablePropertyMap` with `Surface_mesh_deformation::vertex_descriptor` as key and `unsigned int` as value type.
- ///         The default is `boost::property_map<HG, boost::%vertex_index_t>::%type`.
- /// @tparam HIM a model of `ReadablePropertyMap` with `Surface_mesh_deformation::halfedge_descriptor` as key and `unsigned int` as value type.
- ///         The default is `boost::property_map<HG, boost::%halfedge_index_t>::%type`.
- /// @tparam TAG tag for selecting the deformation algorithm
- /// @tparam WC a model of `SurfaceMeshDeformationWeights`, with `WC::Halfedge_graph` being `HG`.
- ///         If `TAG` is `ORIGINAL_ARAP`, the weights must be positive to guarantee a correct energy minimization.
- ///         The default is the cotangent weighting scheme. In case `TAG` is `ORIGINAL_ARAP`, negative weights are clamped to zero.
- /// @tparam ST a model of SparseLinearAlgebraWithFactorTraits_d. If \ref thirdpartyEigen "Eigen" 3.2 (or greater) is available
- /// and `CGAL_EIGEN3_ENABLED` is defined, then an overload of `Eigen_solver_traits` is provided as default parameter.\n
-  /// \code
- ///     CGAL::Eigen_solver_traits<
- ///         Eigen::SparseLU<
- ///            CGAL::Eigen_sparse_matrix<double>::EigenType,
- ///            Eigen::COLAMDOrdering<int> >  >
- /// \endcode
- /// @tparam CR a model of DeformationClosestRotationTraits_3. If \ref thirdpartyEigen "Eigen" 3.1 (or greater) is available and `CGAL_EIGEN3_ENABLED` is defined,
- /// `Deformation_Eigen_polar_closest_rotation_traits_3` is provided as default parameter.
- /// @tparam VPM a model of `ReadWritePropertyMap`</a>  with `Surface_mesh_deformation::vertex_descriptor` as key and a point as value type. The point type must be a model of `::RawPoint_3`.
- /// The default is `boost::property_map<HG, CGAL::vertex_point_t>::%type`.
-template <
-  class HG,
-  class VIM=Default,
-  class HIM=Default,
-  Deformation_algorithm_tag TAG = SPOKES_AND_RIMS,
-  class WC = Default,
-  class ST = Default,
-  class CR = Default,
-  class VPM = Default
-  >
-class Surface_mesh_deformation
-{
-//Typedefs
-public:
-
-  /// \name Types
-  /// @{
-  // typedefed template parameters, main reason is doxygen creates autolink to typedefs but not template parameters
-  ///
-  typedef HG Halfedge_graph;
-
-// Index maps
-#ifndef DOXYGEN_RUNNING
-  typedef typename Default::Get<
-    VIM,
-    typename boost::property_map<Halfedge_graph, boost::vertex_index_t>::type
-  >::type Vertex_index_map;
-  typedef typename Default::Get<
-    HIM,
-    typename boost::property_map<Halfedge_graph, boost::halfedge_index_t>::type
-  >::type Hedge_index_map;
-#else
-  ///
-  typedef VIM Vertex_index_map;
-  ///
-  typedef HIM Hedge_index_map;
-#endif
-
-// weight calculator
-#ifndef DOXYGEN_RUNNING
-  typedef typename Default::Get<
-    WC,
-    typename internal::Weight_calculator_selector<HG, TAG>::weight_calculator
-  >::type Weight_calculator;
-#else
-  ///
-  typedef WC Weight_calculator;
-#endif
-
-// sparse linear solver
-#ifndef DOXYGEN_RUNNING
-  typedef typename Default::Get<
-    ST,
-  #if defined(CGAL_EIGEN3_ENABLED)
-      CGAL::Eigen_solver_traits<
-          Eigen::SparseLU<
-            CGAL::Eigen_sparse_matrix<double>::EigenType,
-            Eigen::COLAMDOrdering<int> >  >
-  #else
-    ST // no parameter provided, and Eigen is not enabled: so don't compile!
-  #endif
-  >::type Sparse_linear_solver;
-#else
-  ///
-  typedef ST Sparse_linear_solver;
-#endif
-
-// CR helper
-#ifndef DOXYGEN_RUNNING
-  typedef typename Default::Get<
-    CR,
-  #if defined(CGAL_EIGEN3_ENABLED)
-    Deformation_Eigen_polar_closest_rotation_traits_3
-  #else
-    CR // no parameter provided, and Eigen is not enabled: so don't compile!
-  #endif
-  >::type Closest_rotation_traits;
-#else
-  ///
-  typedef CR Closest_rotation_traits;
-#endif
-
-// vertex point pmap
-#ifndef DOXYGEN_RUNNING
-  typedef typename Default::Get<
-    VPM,
-    typename boost::property_map<Halfedge_graph, CGAL::vertex_point_t>::type
-  >::type Vertex_point_map;
-#else
-  ///
-  typedef VPM Vertex_point_map;
-#endif
-
-  /// The type for vertex descriptor
-  typedef typename boost::graph_traits<Halfedge_graph>::vertex_descriptor vertex_descriptor;
-  /// The type for halfedge descriptor
-  typedef typename boost::graph_traits<Halfedge_graph>::halfedge_descriptor halfedge_descriptor;
-  /// The 3D point type, model of `::RawPoint_3`
-  typedef typename boost::property_traits<Vertex_point_map>::value_type Point;
-  /// A constant iterator range over the vertices of the region-of-interest.
-  /// It is a model of `ConstRange` with `vertex_descriptor` as iterator value type.
-  typedef std::vector<vertex_descriptor> Roi_vertex_range;
-/// @}
-
-private:
-  typedef Surface_mesh_deformation<HG, VIM, HIM, TAG, WC, ST, CR> Self;
-  // Repeat Halfedge_graph types
-  typedef typename boost::graph_traits<Halfedge_graph>::vertex_iterator     vertex_iterator;
-  typedef typename boost::graph_traits<Halfedge_graph>::halfedge_iterator       halfedge_iterator;
-  typedef typename boost::graph_traits<Halfedge_graph>::in_edge_iterator    in_edge_iterator;
-  typedef typename boost::graph_traits<Halfedge_graph>::out_edge_iterator   out_edge_iterator;
-
-  typedef typename Closest_rotation_traits::Matrix CR_matrix;
-  typedef typename Closest_rotation_traits::Vector CR_vector;
-
-// Data members.
-  Halfedge_graph& m_halfedge_graph;                   /**< Source triangulated surface mesh for modeling */
-
-  std::vector<Point> original;                        ///< original positions of roi (size: ros + boundary_of_ros)
-  std::vector<Point> solution;                        ///< storing position of ros vertices during iterations (size: ros + boundary_of_ros)
-
-  Vertex_index_map vertex_index_map;                  ///< storing indices of all vertices
-  Hedge_index_map   hedge_index_map;                  ///< storing indices of all halfedges
-
-  std::vector<vertex_descriptor> roi;                 ///< region of interest
-  std::vector<vertex_descriptor> ros;                 ///< region of solution, including roi and hard constraints on boundary of roi
-
-  std::vector<std::size_t> ros_id_map;                ///< (size: num vertices)
-  std::vector<bool>        is_roi_map;                ///< (size: num vertices)
-  std::vector<bool>        is_ctrl_map;               ///< (size: num vertices)
-
-  std::vector<double> hedge_weight;                   ///< all halfedge weights
-  std::vector<CR_matrix> rot_mtr;                     ///< rotation matrices of ros vertices (size: ros)
-
-  Sparse_linear_solver m_solver;                      ///< linear sparse solver
-  unsigned int m_iterations;                          ///< number of maximal iterations
-  double m_tolerance;                                 ///< tolerance of convergence
-
-  bool need_preprocess_factorization;                 ///< is there any need to compute L and factorize
-  bool need_preprocess_region_of_solution;            ///< is there any need to compute region of solution
-
-  bool last_preprocess_successful;                    ///< stores the result of last call to preprocess()
-
-  Weight_calculator weight_calculator;
-
-  Vertex_point_map vertex_point_map;
-
-#ifdef CGAL_DEFORM_MESH_USE_EXPERIMENTAL_SR_ARAP
-public:
-// SR-ARAP [Zohar13]
-  double m_sr_arap_alpha;
-private:
-#endif
-#ifdef CGAL_DEFORM_MESH_USE_EXPERIMENTAL_SCALE
-  std::vector<double> scales;
-#endif
-
-#ifndef CGAL_CFG_NO_CPP0X_DELETED_AND_DEFAULT_FUNCTIONS
-public:
-  Surface_mesh_deformation(const Self&) = delete; // no copy
-#else
-private:
-  Surface_mesh_deformation(const Self&); // no copy
-#endif
-
-
-// Public methods
-public:
-
-  /// \cond SKIP_FROM_MANUAL
-  //vertex_point_map set by default
-  Surface_mesh_deformation(Halfedge_graph& halfedge_graph,
-                           Vertex_index_map vertex_index_map,
-                           Hedge_index_map hedge_index_map
-                          )
-    : m_halfedge_graph(halfedge_graph), vertex_index_map(vertex_index_map), hedge_index_map(hedge_index_map),
-      ros_id_map(std::vector<std::size_t>(num_vertices(halfedge_graph), (std::numeric_limits<std::size_t>::max)() )),
-      is_roi_map(std::vector<bool>(num_vertices(halfedge_graph), false)),
-      is_ctrl_map(std::vector<bool>(num_vertices(halfedge_graph), false)),
-      m_iterations(5), m_tolerance(1e-4),
-      need_preprocess_factorization(true),
-      need_preprocess_region_of_solution(true),
-      last_preprocess_successful(false),
-      weight_calculator(Weight_calculator()),
-      vertex_point_map(get(vertex_point, halfedge_graph))
-  {
-    init();
-  }
-
-  //vertex_point_map and hedge_index_map set by default
-  Surface_mesh_deformation(Halfedge_graph& halfedge_graph,
-                           Vertex_index_map vertex_index_map
-                          )
-    : m_halfedge_graph(halfedge_graph), vertex_index_map(vertex_index_map),
-      hedge_index_map(get(boost::halfedge_index, halfedge_graph)),
-      ros_id_map(std::vector<std::size_t>(num_vertices(halfedge_graph), (std::numeric_limits<std::size_t>::max)() )),
-      is_roi_map(std::vector<bool>(num_vertices(halfedge_graph), false)),
-      is_ctrl_map(std::vector<bool>(num_vertices(halfedge_graph), false)),
-      m_iterations(5), m_tolerance(1e-4),
-      need_preprocess_factorization(true),
-      need_preprocess_region_of_solution(true),
-      last_preprocess_successful(false),
-      weight_calculator(Weight_calculator()),
-      vertex_point_map(get(vertex_point, halfedge_graph))
-  {
-    init();
-  }
-  //vertex_point_map, hedge_index_map and vertex_index_map set by default
-  Surface_mesh_deformation(Halfedge_graph& halfedge_graph)
-    : m_halfedge_graph(halfedge_graph),
-      vertex_index_map(get(boost::vertex_index, halfedge_graph)),
-      hedge_index_map(get(boost::halfedge_index, halfedge_graph)),
-      ros_id_map(std::vector<std::size_t>(num_vertices(halfedge_graph), (std::numeric_limits<std::size_t>::max)() )),
-      is_roi_map(std::vector<bool>(num_vertices(halfedge_graph), false)),
-      is_ctrl_map(std::vector<bool>(num_vertices(halfedge_graph), false)),
-      m_iterations(5), m_tolerance(1e-4),
-      need_preprocess_factorization(true),
-      need_preprocess_region_of_solution(true),
-      last_preprocess_successful(false),
-      weight_calculator(Weight_calculator()),
-      vertex_point_map(get(vertex_point, halfedge_graph))
-  {
-    init();
-  }
-
-  // Constructor with all the parameters provided
-  Surface_mesh_deformation(Halfedge_graph& halfedge_graph,
-                           Vertex_index_map vertex_index_map,
-                           Hedge_index_map hedge_index_map,
-                           Vertex_point_map vertex_point_map,
-                           Weight_calculator weight_calculator = Weight_calculator()
-                          )
-    : m_halfedge_graph(halfedge_graph), vertex_index_map(vertex_index_map), hedge_index_map(hedge_index_map),
-    ros_id_map(std::vector<std::size_t>(num_vertices(halfedge_graph), (std::numeric_limits<std::size_t>::max)() )),
-    is_roi_map(std::vector<bool>(num_vertices(halfedge_graph), false)),
-    is_ctrl_map(std::vector<bool>(num_vertices(halfedge_graph), false)),
-    m_iterations(5), m_tolerance(1e-4),
-    need_preprocess_factorization(true),
-    need_preprocess_region_of_solution(true),
-    last_preprocess_successful(false),
-    weight_calculator(weight_calculator),
-    vertex_point_map(vertex_point_map)
-  {
-    init();
-  }
-  /// \endcond
-  #if DOXYGEN_RUNNING
-/// \name Construction
-/// @{
-    /**
-   * The constructor of a deformation object
-   *
-   * @pre the halfedge_graph consists of only triangular facets
-   * @param halfedge_graph triangulated surface mesh to deform
-   * @param vertex_index_map property map which associates an id to each vertex, from `0` to `num_vertices(halfedge_graph)-1`.
-   * @param hedge_index_map property map which associates an id to each halfedge, from `0` to `2*num_edges(halfedge_graph)-1`.
-   * @param vertex_point_map property map which associates a point to each vertex of the graph.
-   * @param weight_calculator function object or pointer for weight calculation
-   */
-  Surface_mesh_deformation(Halfedge_graph& halfedge_graph,
-    Vertex_index_map vertex_index_map=get(boost::vertex_index, halfedge_graph),
-    Hedge_index_map hedge_index_map=get(boost::halfedge_index, halfedge_graph),
-    Vertex_point_map vertex_point_map=get(boost::vertex_point, halfedge_graph),
-    Weight_calculator weight_calculator = Weight_calculator()
-    );
-/// @}
-  #endif
-
-private:
-  void init() {
-    typedef internal::SC_on_the_fly_pmap<Vertex_point_map> Wrapper;
-    // compute halfedge weights
-    halfedge_iterator eb, ee;
-    hedge_weight.reserve(2*num_edges(m_halfedge_graph));
-    for(cpp11::tie(eb, ee) = halfedges(m_halfedge_graph); eb != ee; ++eb)
-    {
-      hedge_weight.push_back(
-        this->weight_calculator(*eb, m_halfedge_graph, Wrapper(vertex_point_map)));
-    }
-#ifdef CGAL_DEFORM_MESH_USE_EXPERIMENTAL_SR_ARAP
-    m_sr_arap_alpha=2;
-#endif
-  }
-
-public:
-
-/// \name Preprocessing
-/// @{
-  /**
-   * Erases all the vertices from the region-of-interest (control vertices included).
-   */
-  void clear_roi_vertices(){
-    need_preprocess_both();
-    // clear roi vertices
-    roi.clear();
-    //set to false all bits
-    is_roi_map.assign(num_vertices(m_halfedge_graph), false);
-    is_ctrl_map.assign(num_vertices(m_halfedge_graph), false);
-  }
-
-  /**
-   * Erases all the vertices from the set of control vertices.
-   */
-  void clear_control_vertices(){
-    need_preprocess_factorization=true;
-    //set to false all bits
-    is_ctrl_map.assign(num_vertices(m_halfedge_graph), false);
-  }
-
-  /**
-   * Inserts a vertex in the set of control vertices. The vertex is also inserted in the region-of-interest if it is not already in it.
-   * @param vd the vertex to be inserted
-   * @return `true` if `vd` is not already a control vertex.
-   */
-  bool insert_control_vertex(vertex_descriptor vd)
-  {
-    if(is_control_vertex(vd)) { return false; }
-    need_preprocess_factorization=true;
-
-    insert_roi_vertex(vd); // also insert it as roi
-
-    is_ctrl_map[id(vd)] = true;
-    return true;
-  }
-
-  /**
-   * Inserts a range of vertices in the set of control vertices. The vertices are also inserted in the region-of-interest if they are not already in it.
-   * @tparam InputIterator input iterator type with `vertex_descriptor` as value type
-   * @param begin first iterator of the range of vertices
-   * @param end past-the-end iterator of the range of vertices
-   */
-  template<class InputIterator>
-  void insert_control_vertices(InputIterator begin, InputIterator end)
-  {
-    for( ;begin != end; ++begin)
-    {
-      insert_control_vertex(*begin);
-    }
-  }
-
-  /**
-   * Erases a vertex from the set of control vertices.
-   * @param vd the vertex to be erased
-   * @return `true` if `vd` was a control vertex.
-   */
-  bool erase_control_vertex(vertex_descriptor vd)
-  {
-    if(!is_control_vertex(vd)) { return false; }
-
-    need_preprocess_factorization=true;
-    is_ctrl_map[id(vd)] = false;
-    return true;
-  }
-
-  /**
-   * Inserts a range of vertices in the region-of-interest
-   * @tparam InputIterator input iterator with `vertex_descriptor` as value type
-   * @param begin first iterator of the range of vertices
-   * @param end past-the-end iterator of the range of vertices
-   */
-  template<class InputIterator>
-  void insert_roi_vertices(InputIterator begin, InputIterator end)
-  {
-    for( ;begin != end; ++begin)
-    {
-      insert_roi_vertex(*begin);
-    }
-  }
-
-  /**
-   * Inserts a vertex in the region-of-interest
-   * @param vd the vertex to be inserted
-   * @return `true` if `vd` is not already in the region-of-interest.
-   */
-  bool insert_roi_vertex(vertex_descriptor vd)
-  {
-    if(is_roi_vertex(vd)) { return false; }
-    need_preprocess_both();
-
-    is_roi_map[id(vd)] = true;
-    roi.push_back(vd);
-    return true;
-  }
-
-  /**
-   * Erases a vertex from the region-of-interest and the set of control vertices.
-   * \note At the next call to `preprocess()`, any vertex that is no longer in the region-of-interest will be assigned to its original position
-   * (that is the position of the vertex at the time of construction or after the last call to `overwrite_initial_geometry()`).
-   * @param vd the vertex to be erased
-   * @return `true` `vd` was a vertex from the region-of-interest.
-   */
-  bool erase_roi_vertex(vertex_descriptor vd)
-  {
-    if(!is_roi_vertex(vd)) { return false; }
-
-    erase_control_vertex(vd); // also erase from being control
-
-    typename std::vector<vertex_descriptor>::iterator it = std::find(roi.begin(), roi.end(), vd);
-    if(it != roi.end())
-    {
-      is_roi_map[id(vd)] = false;
-      roi.erase(it);
-
-      need_preprocess_both();
-      return true;
-    }
-
-    CGAL_assertion(false); // inconsistency between is_roi_map, and roi vector!
-    return false;
-  }
-
-  /**
-   * Preprocessing function that need to be called each time the region-of-interest or the set
-   * of control vertices are changed before calling `deform()`.
-   * If not already done, `deform()` first calls this function.
-   * \cgalAdvancedBegin
-   * Collects the vertices not in the region-of-interest that are adjacent to a vertex from the
-   * region-of-interest (these vertices are internally considered as fixed control vertices).
-   * Then assembles and factorizes the Laplacian matrix used in the function `deform()`.
-   * \cgalAdvancedEnd
-   * \note A modification of the set of control vertices or the region-of-interest invalidates the
-   * preprocessing data.
-   * @return `true` if successful.
-   * A common reason for failure is that the system is rank deficient,
-   * which happens for example when all the vertices are in the region-of-interest and no control vertices are set, or
-   * if the weighting scheme used features too many zero and breaks the connectivity information.
-   */
-  bool preprocess()
-  {
-    region_of_solution();
-    assemble_laplacian_and_factorize();
-    return last_preprocess_successful; // which is set by assemble_laplacian_and_factorize()
-  }
-/// @} Preprocessing
-
-/// \name Deformation
-/// @{
-
-  /**
-   * Sets the target position of a control vertex.
-   * @param vd the control vertex the target position is set
-   * @param target_position the new target position
-   */
-  void set_target_position(vertex_descriptor vd, const Point& target_position)
-  {
-    region_of_solution(); // we require ros ids, so if there is any need to preprocess of region of solution -do it.
-
-    if(!is_control_vertex(vd)) { return; }
-    solution[ros_id(vd)] = target_position;
-  }
-
-  /**
-   * Updates the target position of `vd` by applying     a translation of vector `t`.
-   *
-   * @tparam Vect is a 3D vector class, with `Vect(double x,double y, double z)` being a constructor from its %Cartesian coordinates
-   *         and `double Vect::operator[](int i)` with i=0,1 or 2 returning its %Cartesian coordinates.
-   *
-   * @param vd a control vertex
-   * @param t translation vector
-   * \pre `is_control_vertex(vd)`
-   */
-  template<class Vect>
-  void translate(vertex_descriptor vd, const Vect& t)
-  {
-    region_of_solution(); // we require ros ids, so if there is any need to preprocess of region of solution -do it.
-
-    std::size_t v_id = ros_id(vd);
-    solution[v_id] = add_to_point(solution[v_id], t);
-  }
-
-  /**
-   * Equivalent to calling the overload taking only one control vertex, for each vertex in the range `[begin,end[`.
-   *
-   * @tparam InputIterator input iterator type with `vertex_descriptor` as value type
-   * @tparam Vect is a 3D vector class, with `Vect(double x,double y, double z)` being a constructor from its %Cartesian coordinates
-   *         and `double Vect::operator[](int i)` with i=0,1 or 2 returning its %Cartesian coordinates.
-   *
-   * @param begin first iterator of the range of vertices
-   * @param end past-the-end iterator of the range of vertices
-   * @param t translation vector
-   */
-  template<class InputIterator, class Vect>
-  void translate(InputIterator begin, InputIterator end, const Vect& t)
-  {
-    region_of_solution(); // we require ros ids, so if there is any need to preprocess of region of solution -do it.
-
-    for(; begin != end; ++begin) {
-      std::size_t v_id = ros_id(*begin);
-      solution[v_id] = add_to_point(solution[v_id], t);
-    }
-  }
-
-  /**
-   * Updates the target position of `vd` by applying to its last target position
-   * a rotation defined by the quaternion `quat`, the center of the rotation being
-   * the origin translated by `to_rotation_center` .
-   *
-   * @tparam Quaternion is a quaternion class with `Vect operator*(Quaternion, Vect)` returning the product of a quaternion with a vector
-   * @tparam Vect is a 3D vector class, with `Vect(double x,double y, double z)` being a constructor from its %Cartesian coordinates
-   *         and `double Vect::operator[](int i)` with i=0,1 or 2 returning its %Cartesian coordinates.
-   *
-   * @param vd a control vertex
-   * @param to_rotation_center the vector to translate the origin to the center of the rotation
-   * @param quat quaternion of the rotation
-   * \pre `is_control_vertex(vd)`
-   * \pre `quad` represents a rotation
-   */
-  template <typename Quaternion, typename Vect>
-  void rotate(vertex_descriptor vd, const Vect& to_rotation_center, const Quaternion& quat)
-  {
-    CGAL_precondition( is_control_vertex(vd) );
-    region_of_solution(); // we require ros ids, so if there is any need to preprocess of region of solution -do it.
-
-    std::size_t v_id = ros_id(vd);
-    Vect v = quat * sub_to_vect(solution[v_id], to_rotation_center);
-    solution[v_id] = Point( to_rotation_center[0]+v[0],
-                            to_rotation_center[1]+v[1],
-                            to_rotation_center[2]+v[2] );
-  }
-
-  /**
-   * Equivalent to calling the overload taking only one control vertex, for each vertex in the range `[begin,end[`.
-   *
-   * @tparam InputIterator input iterator type with `vertex_descriptor` as value type
-   * @tparam Quaternion is a quaternion class with `Vect operator*(Quaternion, Vect)` returning the product of a quaternion with a vector
-   * @tparam Vect is a 3D vector class, with `Vect(double x,double y, double z)` being a constructor from its %Cartesian coordinates
-   *         and `double Vect::operator[](int i)` with i=0,1 or 2 returning its %Cartesian coordinates.
-   *
-   * @param begin first iterator of the range of vertices
-   * @param end past-the-end iterator of the range of vertices
-   * @param to_rotation_center the vector to translate the origin to the center of the rotation
-   * @param quat quaternion of the rotation
-   * \pre `quad` represents a rotation
-   */
-  template <typename InputIterator, typename Vect, typename Quaternion>
-  void rotate(InputIterator begin, InputIterator end, const Vect& to_rotation_center, const Quaternion& quat)
-  {
-    region_of_solution(); // we require ros ids, so if there is any need to preprocess of region of solution -do it.
-
-    for(; begin != end; ++begin) {
-      std::size_t v_id = ros_id(*begin);
-      Vect v = quat * sub_to_vect(solution[v_id], to_rotation_center);
-      solution[v_id] = Point( to_rotation_center[0]+v[0],
-                              to_rotation_center[1]+v[1],
-                              to_rotation_center[2]+v[2] );
-    }
-  }
-
-  /**
-    * Returns the target position of a control vertex.
-    * \param vd a control vertex
-    * \pre `is_control_vertex(vd)`
-    */
-  const Point& target_position(vertex_descriptor vd)
-  {
-    region_of_solution();
-
-    CGAL_precondition( is_control_vertex(vd) );
-    return solution[ ros_id(vd) ];
-  }
-
-  /**
-   * Deforms the region-of-interest according to the deformation algorithm, using the target positions of each control vertex set by using `rotate()`, `translate()`, or `set_target_position()`.
-   * The points associated to each vertex of the input graph that are inside the region-of-interest are updated.
-   * \note Nothing happens if `preprocess()` returns `false`.
-   * @see set_iterations(unsigned int iterations), set_tolerance(double tolerance), deform(unsigned int iterations, double tolerance)
-   */
-  void deform()
-  {
-    deform(m_iterations, m_tolerance);
-  }
-
-  /**
-   * Same as `deform()` but the number of iterations and the tolerance are one-time parameters.
-   * @param iterations number of iterations for optimization procedure
-   * @param tolerance tolerance of convergence (see explanations set_tolerance(double tolerance))
-   */
-  void deform(unsigned int iterations, double tolerance)
-  {
-    preprocess();
-
-    if(!last_preprocess_successful) {
-      CGAL_warning(false);
-      return;
-    }
-    // Note: no energy based termination occurs at first iteration
-    // because comparing energy of original model (before deformation) and deformed model (deformed_1_iteration)
-    // simply does not make sense, comparison is meaningful between deformed_(i)_iteration & deformed_(i+1)_iteration
-
-    double energy_this = 0; // initial value is not important, because we skip first iteration
-    double energy_last;
-
-    // iterations
-    for ( unsigned int ite = 0; ite < iterations; ++ite)
-    {
-      // main steps of optimization
-      update_solution();
-#ifndef CGAL_DEFORM_MESH_JUST_EXPERIMENTAL_SCALE
-      optimal_rotations();
-#endif
-#ifdef CGAL_DEFORM_MESH_USE_EXPERIMENTAL_SCALE
-      optimal_scales();
-#endif
-      // energy based termination
-      if(tolerance > 0.0 && (ite + 1) < iterations) // if tolerance <= 0 then don't compute energy
-      {                                             // also no need compute energy if this iteration is the last iteration
-        energy_last = energy_this;
-        energy_this = energy();
-        CGAL_warning(energy_this >= 0);
-
-        if(ite != 0) // skip first iteration
-        {
-          double energy_dif = std::abs((energy_last - energy_this) / energy_this);
-          if ( energy_dif < tolerance ) { break; }
-        }
-      }
-    }
-    // copy solution to the target surface mesh
-    assign_solution();
-  }
-
-  /**
-   * Resets the points associated to the vertices of the region-of-interest at their
-   * initial positions at time of the functor construction or after
-   * the last call to `overwrite_initial_geometry()`.
-   * \note if the region-of-interest or the set of control vertices have been
-   * modified since the last call to `preprocess()`, it will be called prior
-   * to the reset.
-   */
-  void reset()
-  {
-    if(roi.empty()) { return; } // no ROI to reset
-
-    region_of_solution(); // since we are using original vector
-
-    //restore the current positions to be the original positions
-    BOOST_FOREACH(vertex_descriptor vd, roi_vertices())
-    {
-      put(vertex_point_map, vd, original[ros_id(vd)]);
-      solution[ros_id(vd)]=original[ros_id(vd)];
-    }
-
-    // also set rotation matrix to identity
-    std::fill(rot_mtr.begin(), rot_mtr.end(),
-              Closest_rotation_traits().identity_matrix());
-  }
-
-  /**
-   * Sets the initial positions of the vertices from the region-of-interest to the current positions. Calling this function has the same effect as creating
-   * a new deformation object with the current deformed halfedge-graph, keeping the region-of-interest and the set of control vertices.
-   * \note if the region-of-interest or the set of control vertices have been modified since the last call to `preprocess()`,
-   * it will be called prior to the overwrite.
-   *
-   * \cgalAdvancedBegin
-   * This function might have a non-negligible effect on the result.
-   * The Laplacian matrix of the free vertices and the optimal rotations
-   * are computed using the original positions of the points
-   * associated to the vertices. Thus, if a deformed version of the surface mesh
-   * is used as reference, the surface mesh properties the algorithm
-   * tries to preserve are those of an altered version (which are already
-   * degraded).
-   * \cgalAdvancedEnd
-   */
-  void overwrite_initial_geometry()
-  {
-    typedef internal::SC_on_the_fly_pmap<Vertex_point_map> Wrapper;
-    if(roi.empty()) { return; } // no ROI to overwrite
-
-    region_of_solution(); // the roi should be preprocessed since we are using original_position vec
-
-    BOOST_FOREACH(vertex_descriptor vd, roi_vertices())
-    {
-      original[ros_id(vd)] = get(vertex_point_map, vd);
-    }
-
-    // now I need to compute weights for halfedges incident to roi vertices
-    std::vector<bool> is_weight_computed(2*num_edges(m_halfedge_graph), false);
-    BOOST_FOREACH(vertex_descriptor vd, roi_vertices())
-    {
-      in_edge_iterator e, e_end;
-      for (cpp11::tie(e,e_end) = in_edges(vd, m_halfedge_graph); e != e_end; e++)
-      {
-        halfedge_descriptor he = halfedge(*e, m_halfedge_graph);
-        std::size_t id_e = id(he);
-        if(is_weight_computed[id_e]) { continue; }
-
-        hedge_weight[id_e] = weight_calculator(he, m_halfedge_graph, Wrapper(vertex_point_map));
-        is_weight_computed[id_e] = true;
-
-        halfedge_descriptor e_opp = opposite(he, m_halfedge_graph);
-        std::size_t id_e_opp = id(e_opp);
-
-        hedge_weight[id_e_opp] = weight_calculator(e_opp, m_halfedge_graph, Wrapper(vertex_point_map));
-        is_weight_computed[id_e_opp] = true;
-      }
-    }
-
-    // also set rotation matrix to identity
-    std::fill(rot_mtr.begin(), rot_mtr.end(), Closest_rotation_traits().identity_matrix());
-
-    need_preprocess_both(); // now we need reprocess
-  }
-
-/// @} Deformation
-
-/// \name Utilities
-/// @{
-
-  /**
-   * Gets the default number of iterations (5) or the value passed to the function `set_iterations()`
-   */
-  unsigned int iterations()
-  { return m_iterations; }
-
-  /**
-   * Gets the default tolerance parameter (1e-4) or the value passed to the function `set_tolerance()`
-   */
-  double tolerance()
-  { return m_tolerance; }
-
-  /**
-   * Sets the maximum number of iterations ran by `deform()`
-   */
-  void set_iterations(unsigned int iterations)
-  { this->m_iterations = iterations; }
-
-   /// @brief Sets the tolerance of the convergence used in `deform()`.
-   /// If `tolerance==0`, no energy based termination criteria is used (preventing to do the energy computation at each iteration step)
-   ///
-   /// `tolerance >` \f$|\mathrm{energy}(m_i) - \mathrm{energy}(m_{i-1})| / \mathrm{energy}(m_i)\f$ will be used as a termination criterium.
-  void set_tolerance(double tolerance)
-  { this->m_tolerance = tolerance; }
-
-  /**
-   * Returns the range of vertices in the region-of-interest.
-   */
-  const Roi_vertex_range& roi_vertices() const
-  {
-    return roi;
-  }
-
-  /**
-   * Tests whether a vertex is inside the region-of-interest.
-   * @param vd the query vertex
-   * @return `true` if `vd` has been inserted to (and not erased from) the region-of-interest.
-   */
-  bool is_roi_vertex(vertex_descriptor vd) const
-  { return is_roi_map[id(vd)]; }
-
-  /**
-   * Tests whether a vertex is a control vertex.
-   * @param vd the query vertex
-   * @return `true` if `vd` has been inserted to (and not erased from) the set of control vertices.
-   */
-  bool is_control_vertex(vertex_descriptor vd) const
-  { return is_ctrl_map[id(vd)]; }
-
-  /**
-   * Provides access to the halfedge graph being deformed
-   */
-  const Halfedge_graph& halfedge_graph() const
-  { return m_halfedge_graph; }
-
-/// @} Utilities
-
-
-private:
-
-  /// Assigns id to one ring neighbor of vd, and also push them into push_vector
-  void assign_ros_id_to_one_ring(vertex_descriptor vd,
-                             std::size_t& next_id,
-                             std::vector<vertex_descriptor>& push_vector)
-  {
-    in_edge_iterator e, e_end;
-    for (cpp11::tie(e,e_end) = in_edges(vd, m_halfedge_graph); e != e_end; e++)
-    {
-      vertex_descriptor vt = source(*e, m_halfedge_graph);
-      if(ros_id(vt) == (std::numeric_limits<std::size_t>::max)())  // neighboring vertex which is outside of roi and not visited previously (i.e. need an id)
-      {
-        ros_id(vt) = next_id++;
-        push_vector.push_back(vt);
-      }
-    }
-  }
-
-  /// Find region of solution, including roi and hard constraints, which is the 1-ring vertices out roi
-  /// Contains four parts:
-  ///  - if there is any vertex which is no longer roi, set its position back to original position
-  ///  - assign a ros id to vertices inside ros + ros-boundary
-  ///  - reinitialize rotation matrices, if a vertex is previously ros, use its previous matrix, otherwise set zero
-  ///  - reinitialize original, and solution,
-  ///      + if a vertex is previously roi, then use its original position in old_origional, else use point().
-  ///        In both case we are using "original position" of the vertex.
-  ///      + same for solution (it is required to prevent jumping effects)
-  void region_of_solution()
-  {
-    if(!need_preprocess_region_of_solution) { return; }
-    need_preprocess_region_of_solution = false;
-
-    std::vector<std::size_t>  old_ros_id_map = ros_id_map;
-    std::vector<CR_matrix>    old_rot_mtr    = rot_mtr;
-    std::vector<Point>        old_solution   = solution;
-    std::vector<Point>        old_original   = original;
-
-    // any vertices which are no longer ROI, should be assigned to their original position, so that:
-    // IF a vertex is ROI (actually if its ros + boundary) previously (when previous region_of_solution() is called)
-    // we have its original position in old_original
-    // ELSE
-    // we have its original position in vertex->point()
-    // (current ros is actually old ros - we did not change it yet)
-    for(typename std::vector<vertex_descriptor>::iterator it = ros.begin(); it != ros.end(); ++it)
-    {
-      if(!is_roi_vertex(*it)) {
-        put(vertex_point_map, *it, old_original[ old_ros_id_map[id(*it)] ]);
-      }
-    }
-
-    ////////////////////////////////////////////////////////////////
-    // assign id to vertices inside: roi, boundary of roi (roi + boundary of roi = ros),
-    //                               and boundary of ros
-    // keep in mind that id order does not have to be compatible with ros order
-    ros.clear(); // clear ros
-    ros.insert(ros.end(), roi.begin(), roi.end());
-
-    ros_id_map.assign(num_vertices(m_halfedge_graph), (std::numeric_limits<std::size_t>::max)()); // use max as not assigned mark
-
-    for(std::size_t i = 0; i < roi.size(); i++)  // assign id to all roi vertices
-    { ros_id(roi[i]) = i; }
-
-    // now assign an id to vertices on boundary of roi
-    std::size_t next_ros_index = roi.size();
-    for(std::size_t i = 0; i < roi.size(); i++)
-    { assign_ros_id_to_one_ring(roi[i], next_ros_index, ros); }
-
-    std::vector<vertex_descriptor> outside_ros;
-    // boundary of ros also must have ids because in CR calculation,
-    // one-ring neighbor of ROS vertices are reached.
-    for(std::size_t i = roi.size(); i < ros.size(); i++)
-    { assign_ros_id_to_one_ring(ros[i], next_ros_index, outside_ros); }
-    ////////////////////////////////////////////////////////////////
-
-    // initialize the rotation matrices (size: ros)
-    rot_mtr.resize(ros.size());
-    for(std::size_t i = 0; i < rot_mtr.size(); i++)
-    {
-      std::size_t v_ros_id = ros_id(ros[i]);
-      std::size_t v_id = id(ros[i]);
-
-      // any vertex which is previously ROS has a rotation matrix
-      // use that matrix to prevent jumping effects
-      if(old_ros_id_map[v_id] != (std::numeric_limits<std::size_t>::max)()
-          && old_ros_id_map[v_id] < old_rot_mtr.size()) {
-          // && boundary of ros vertices also have ids so check whether it is ros
-        rot_mtr[v_ros_id] = old_rot_mtr[ old_ros_id_map[v_id] ];
-      }
-      else {
-        rot_mtr[v_ros_id] = Closest_rotation_traits().identity_matrix();
-      }
-    }
-
-    // initialize solution and original (size: ros + boundary_of_ros)
-
-    // for simplifying coding effort, I also put boundary of ros into solution and original
-    // because boundary of ros vertices are reached in optimal_rotations() and energy()
-    solution.resize(ros.size() + outside_ros.size());
-    original.resize(ros.size() + outside_ros.size());
-
-    for(std::size_t i = 0; i < ros.size(); i++)
-    {
-      std::size_t v_ros_id = ros_id(ros[i]);
-      std::size_t v_id = id(ros[i]);
-
-      if(is_roi_vertex(ros[i]) && old_ros_id_map[v_id] != (std::numeric_limits<std::size_t>::max)()) {
-        // if it is currently roi and previously ros + boundary
-        // (actually I just need to assign old's to new's if a vertex is currently and previously ROI
-        // but no harm on assigning if its also previously ros + boundary because
-        // those(old_original & old_solution) will be equal to original position)
-        original[v_ros_id] = old_original[old_ros_id_map[v_id]];
-        solution[v_ros_id] = old_solution[old_ros_id_map[v_id]];
-      }
-      else {
-        solution[v_ros_id] = get(vertex_point_map, ros[i]);
-        original[v_ros_id] = get(vertex_point_map, ros[i]);
-      }
-    }
-
-    for(std::size_t i = 0; i < outside_ros.size(); ++i)
-    {
-      std::size_t v_ros_id = ros_id(outside_ros[i]);
-      original[v_ros_id] = get(vertex_point_map, outside_ros[i]);
-      solution[v_ros_id] = get(vertex_point_map, outside_ros[i]);
-    }
-
-#ifdef CGAL_DEFORM_MESH_USE_EXPERIMENTAL_SCALE
-    scales.resize(ros.size());
-    std::fill(scales.begin(), scales.end(), 1.0);
-#endif
-  }
-
-  /// Assemble Laplacian matrix A of linear system A*X=B
-  void assemble_laplacian_and_factorize()
-  {
-    if(TAG == SPOKES_AND_RIMS)
-    {
-      assemble_laplacian_and_factorize_spokes_and_rims();
-    }
-    else
-    {
-      assemble_laplacian_and_factorize_arap();
-    }
-  }
-  /// Construct matrix that corresponds to left-hand side of eq:lap_ber in user manual
-  /// Also constraints are integrated as eq:lap_energy_system in user manual
-  void assemble_laplacian_and_factorize_arap()
-  {
-    if(!need_preprocess_factorization) { return; }
-    need_preprocess_factorization = false;
-
-    typename Sparse_linear_solver::Matrix A(ros.size());
-
-    /// assign cotangent Laplacian to ros vertices
-    for(std::size_t k = 0; k < ros.size(); k++)
-    {
-      vertex_descriptor vi = ros[k];
-      std::size_t vi_id = ros_id(vi);
-      if ( is_roi_vertex(vi) && !is_control_vertex(vi) )          // vertices of ( roi - ctrl )
-      {
-        double diagonal = 0;
-        in_edge_iterator e, e_end;
-        for (cpp11::tie(e,e_end) = in_edges(vi, m_halfedge_graph); e != e_end; e++)
-        {
-          halfedge_descriptor he = halfedge(*e, m_halfedge_graph);
-          vertex_descriptor vj = source(he, m_halfedge_graph);
-          double wij = hedge_weight[id(he)];  // edge(pi - pj)
-          double wji = hedge_weight[id(opposite(he, m_halfedge_graph))]; // edge(pi - pj)
-          double total_weight = wij + wji;
-
-          A.set_coef(vi_id, ros_id(vj), -total_weight, true); // off-diagonal coefficient
-          diagonal += total_weight;
-        }
-        // diagonal coefficient
-        A.set_coef(vi_id, vi_id, diagonal, true);
-      }
-      else
-      {
-        A.set_coef(vi_id, vi_id, 1.0, true);
-      }
-    }
-
-    // now factorize
-    double D;
-    last_preprocess_successful = m_solver.factor(A, D);
-    CGAL_warning(last_preprocess_successful);
-  }
-  /// Construct matrix that corresponds to left-hand side of eq:lap_ber_rims in user manual
-  /// Also constraints are integrated as eq:lap_energy_system in user manual
-  void assemble_laplacian_and_factorize_spokes_and_rims()
-  {
-    if(!need_preprocess_factorization) { return; }
-    need_preprocess_factorization = false;
-
-    typename Sparse_linear_solver::Matrix A(ros.size());
-
-    /// assign cotangent Laplacian to ros vertices
-    for(std::size_t k = 0; k < ros.size(); k++)
-    {
-      vertex_descriptor vi = ros[k];
-      std::size_t vi_id = ros_id(vi);
-      if ( is_roi_vertex(vi) && !is_control_vertex(vi) ) // vertices of ( roi - ctrl ): free vertices
-      {
-        double diagonal = 0;
-        out_edge_iterator e, e_end;
-        for (cpp11::tie(e,e_end) = out_edges(vi, m_halfedge_graph); e != e_end; e++)
-        {
-          halfedge_descriptor he = halfedge(*e, m_halfedge_graph);
-          double total_weight = 0;
-          // an edge contribute to energy only if it is part of an incident triangle
-          // (i.e it should not be a border edge)
-          if(!is_border(he, m_halfedge_graph))
-          {
-            double wji = hedge_weight[id(he)]; // edge(pj - pi)
-            total_weight += wji;
-          }
-
-          halfedge_descriptor opp = opposite(he, m_halfedge_graph);
-          if(!is_border(opp, m_halfedge_graph))
-          {
-            double wij = hedge_weight[id(opp)]; // edge(pi - pj)
-            total_weight += wij;
-          }
-
-          // place coefficient to matrix
-          vertex_descriptor vj = target(he, m_halfedge_graph);
-          A.set_coef(vi_id, ros_id(vj), -total_weight, true); // off-diagonal coefficient
-          diagonal += total_weight;
-        }
-        // diagonal coefficient
-        A.set_coef(vi_id, vi_id, diagonal, true);
-      }
-      else // constrained vertex
-      {
-        A.set_coef(vi_id, vi_id, 1.0, true);
-      }
-    }
-
-    // now factorize
-    double D;
-    last_preprocess_successful = m_solver.factor(A, D);
-    CGAL_warning(last_preprocess_successful);
-  }
-
-  /// Local step of iterations, computing optimal rotation matrices
-  void optimal_rotations()
-  {
-    if(TAG == SPOKES_AND_RIMS)
-    {
-      optimal_rotations_spokes_and_rims();
-    }
-    else
-    {
-      optimal_rotations_arap();
-    }
-  }
-  void optimal_rotations_arap()
-  {
-    Closest_rotation_traits cr_traits;
-    CR_matrix cov = cr_traits.zero_matrix();
-
-    // only accumulate ros vertices
-    for ( std::size_t k = 0; k < ros.size(); k++ )
-    {
-      vertex_descriptor vi = ros[k];
-      std::size_t vi_id = ros_id(vi);
-      // compute covariance matrix (user manual eq:cov_matrix)
-      cov = cr_traits.zero_matrix();
-
-      in_edge_iterator e, e_end;
-
-#ifdef CGAL_DEFORM_MESH_USE_EXPERIMENTAL_SR_ARAP
-      cpp11::tie(e,e_end) = in_edges(vi, m_halfedge_graph);
-      double ne_i=std::distance(e,e_end);
-#endif
-      for (cpp11::tie(e,e_end) = in_edges(vi, m_halfedge_graph); e != e_end; e++)
-      {
-        halfedge_descriptor he=halfedge(*e, m_halfedge_graph);
-        vertex_descriptor vj = source(he, m_halfedge_graph);
-        std::size_t vj_id = ros_id(vj);
-
-        const CR_vector& pij = sub_to_CR_vector(original[vi_id], original[vj_id]);
-        const CR_vector& qij = sub_to_CR_vector(solution[vi_id], solution[vj_id]);
-        double wij = hedge_weight[id(he)];
-
-        cr_traits.add_scalar_t_vector_t_vector_transpose(cov, wij, pij, qij); // cov += wij * (pij * qij)
-#ifdef CGAL_DEFORM_MESH_USE_EXPERIMENTAL_SR_ARAP
-        // add neighbor rotation
-        cov += m_sr_arap_alpha * rot_mtr[vj_id].transpose() / ne_i;
-#endif
-
-      }
-
-      cr_traits.compute_close_rotation(cov, rot_mtr[vi_id]);
-    }
-  }
-  void optimal_rotations_spokes_and_rims()
-  {
-    Closest_rotation_traits cr_traits;
-    CR_matrix cov =cr_traits.zero_matrix();
-
-    // only accumulate ros vertices
-    for ( std::size_t k = 0; k < ros.size(); k++ )
-    {
-      vertex_descriptor vi = ros[k];
-      std::size_t vi_id = ros_id(vi);
-      // compute covariance matrix
-      cov = cr_traits.zero_matrix();
-
-      //iterate through all triangles
-      out_edge_iterator e, e_end;
-      for (cpp11::tie(e,e_end) = out_edges(vi, m_halfedge_graph); e != e_end; e++)
-      {
-        halfedge_descriptor he = halfedge(*e, m_halfedge_graph);
-        if(is_border(he, m_halfedge_graph)) { continue; } // no facet
-        // iterate edges around facet
-        halfedge_descriptor hedge_around_facet = he;
-        do
-        {
-          vertex_descriptor v1 = target(hedge_around_facet, m_halfedge_graph);
-          vertex_descriptor v2 = source(hedge_around_facet, m_halfedge_graph);
-
-          std::size_t v1_id = ros_id(v1); std::size_t v2_id = ros_id(v2);
-
-          const CR_vector& p12 = sub_to_CR_vector(original[v1_id], original[v2_id]);
-          const CR_vector& q12 = sub_to_CR_vector(solution[v1_id], solution[v2_id]);
-          double w12 = hedge_weight[id(hedge_around_facet)];
-
-          cr_traits.add_scalar_t_vector_t_vector_transpose(cov, w12, p12, q12); // cov += w12 * (p12 * q12);
-
-        } while( (hedge_around_facet = next(hedge_around_facet, m_halfedge_graph)) != he);
-      }
-
-      cr_traits.compute_close_rotation(cov, rot_mtr[vi_id]);
-    }
-  }
-
-#ifdef CGAL_DEFORM_MESH_USE_EXPERIMENTAL_SCALE
-  void optimal_scales()
-  {
-    for ( std::size_t k = 0; k < ros.size(); k++ )
-    {
-      vertex_descriptor vi = ros[k];
-      std::size_t vi_id = ros_id(vi);
-      // compute covariance matrix (user manual eq:cov_matrix)
-      double eT_eR = 0, eRT_eR = 0;
-
-      in_edge_iterator e, e_end;
-      for (cpp11::tie(e,e_end) = in_edges(vi, m_halfedge_graph); e != e_end; e++)
-      {
-        halfedge_descriptor he = *e;
-        vertex_descriptor vj = source(he, m_halfedge_graph);
-        std::size_t vj_id = ros_id(vj);
-
-        const CR_vector& pij = sub_to_CR_vector(original[vi_id], original[vj_id]);
-        const CR_vector& qij = sub_to_CR_vector(solution[vi_id], solution[vj_id]);
-
-        double wij = hedge_weight[id(he)];
-
-        const CR_vector& pRij = rot_mtr[vi_id] * pij;
-        eRT_eR += pRij[0]*pRij[0] + pRij[1]*pRij[1] + pRij[2]*pRij[2];
-        eT_eR  += qij[0]*pRij[0]  + qij[1]*pRij[1]  + qij[2]*pRij[2];
-      }
-
-      scales[vi_id] = eT_eR / eRT_eR;
-    }
-  }
-#endif
-
-  /// Global step of iterations, updating solution
-  void update_solution()
-  {
-    if(TAG == SPOKES_AND_RIMS)
-    {
-      update_solution_spokes_and_rims();
-    }
-    else
-    {
-      update_solution_arap();
-    }
-  }
-  /// calculate right-hand side of eq:lap_ber in user manual and solve the system
-  void update_solution_arap()
-  {
-    typename Sparse_linear_solver::Vector X(ros.size()), Bx(ros.size());
-    typename Sparse_linear_solver::Vector Y(ros.size()), By(ros.size());
-    typename Sparse_linear_solver::Vector Z(ros.size()), Bz(ros.size());
-
-    Closest_rotation_traits cr_traits;
-
-    // assemble right columns of linear system
-    for ( std::size_t k = 0; k < ros.size(); k++ )
-    {
-      vertex_descriptor vi = ros[k];
-      std::size_t vi_id = ros_id(vi);
-
-      if ( is_roi_vertex(vi) && !is_control_vertex(vi) )
-      {// free vertices
-        // sum of right-hand side of eq:lap_ber in user manual
-        CR_vector xyz = cr_traits.vector(0, 0, 0);
-
-        in_edge_iterator e, e_end;
-        for (cpp11::tie(e,e_end) = in_edges(vi, m_halfedge_graph); e != e_end; e++)
-        {
-          halfedge_descriptor he = halfedge(*e, m_halfedge_graph);
-          vertex_descriptor vj = source(he, m_halfedge_graph);
-          std::size_t vj_id = ros_id(vj);
-
-          const CR_vector& pij = sub_to_CR_vector(original[vi_id], original[vj_id]);
-
-          double wij = hedge_weight[id(he)];
-          double wji = hedge_weight[id(opposite(he, m_halfedge_graph))];
-#ifndef CGAL_DEFORM_MESH_USE_EXPERIMENTAL_SCALE
-          cr_traits.add__scalar_t_matrix_p_scalar_t_matrix__t_vector(xyz, wij, rot_mtr[vi_id], wji, rot_mtr[vj_id], pij);
-#else
-        cr_traits.add__scalar_t_matrix_p_scalar_t_matrix__t_vector(xyz, wij * scales[vi_id], rot_mtr[vi_id],
-          wji * scales[vj_id], rot_mtr[vj_id], pij);
-#endif
-          // corresponds xyz += (wij*rot_mtr[vi_id] + wji*rot_mtr[vj_id]) * pij
-        }
-        Bx[vi_id] = cr_traits.vector_coordinate(xyz, 0);
-        By[vi_id] = cr_traits.vector_coordinate(xyz, 1);
-        Bz[vi_id] = cr_traits.vector_coordinate(xyz, 2);
-      }
-      else
-      {// constrained vertex
-        Bx[vi_id] = solution[vi_id][0]; By[vi_id] = solution[vi_id][1]; Bz[vi_id] = solution[vi_id][2];
-      }
-    }
-
-    // solve "A*X = B".
-    bool is_all_solved = m_solver.linear_solver(Bx, X) && m_solver.linear_solver(By, Y) && m_solver.linear_solver(Bz, Z);
-    if(!is_all_solved) {
-      CGAL_warning(false);
-      return;
-    }
-    // copy to solution
-    for (std::size_t i = 0; i < ros.size(); i++)
-    {
-      std::size_t v_id = ros_id(ros[i]);
-      Point p(X[v_id], Y[v_id], Z[v_id]);
-      if (!is_ctrl_map[id(ros[i])])
-        solution[v_id] = p;
-    }
-  }
-  /// calculate right-hand side of eq:lap_ber_rims in user manual and solve the system
-  void update_solution_spokes_and_rims()
-  {
-    typename Sparse_linear_solver::Vector X(ros.size()), Bx(ros.size());
-    typename Sparse_linear_solver::Vector Y(ros.size()), By(ros.size());
-    typename Sparse_linear_solver::Vector Z(ros.size()), Bz(ros.size());
-
-    Closest_rotation_traits cr_traits;
-
-    // assemble right columns of linear system
-    for ( std::size_t k = 0; k < ros.size(); k++ )
-    {
-      vertex_descriptor vi = ros[k];
-      std::size_t vi_id = ros_id(vi);
-
-      if ( is_roi_vertex(vi) && !is_control_vertex(vi) )
-      {// free vertices
-        // sum of right-hand side of eq:lap_ber_rims in user manual
-        CR_vector xyz = cr_traits.vector(0, 0, 0);
-
-        out_edge_iterator e, e_end;
-        for (cpp11::tie(e,e_end) = out_edges(vi, m_halfedge_graph); e != e_end; e++)
-        {
-          halfedge_descriptor he = halfedge(*e, m_halfedge_graph);
-          vertex_descriptor vj = target(he, m_halfedge_graph);
-          std::size_t vj_id = ros_id(vj);
-
-          const CR_vector& pij = sub_to_CR_vector(original[vi_id], original[vj_id]);
-
-          if(!is_border(he, m_halfedge_graph))
-          {
-            vertex_descriptor vn = target(next(he, m_halfedge_graph), m_halfedge_graph); // opp vertex of e_ij
-            double wji = hedge_weight[id(he)] / 3.0;  // edge(pj - pi)
-            cr_traits.add_scalar_t_matrix_sum_t_vector(xyz, wji, rot_mtr[vi_id], rot_mtr[vj_id], rot_mtr[ros_id(vn)], pij);
-            // corresponds  xyz += wji*(rot_mtr[vi_id] + rot_mtr[vj_id] + rot_mtr[ros_id(vn)])*pij;
-          }
-
-          halfedge_descriptor opp = opposite(he, m_halfedge_graph);
-          if(!is_border(opp, m_halfedge_graph))
-          {
-            vertex_descriptor vm = target(next(opp, m_halfedge_graph), m_halfedge_graph); // other opp vertex of e_ij
-            double wij = hedge_weight[id(opp)] / 3.0;  // edge(pi - pj)
-            cr_traits.add_scalar_t_matrix_sum_t_vector(xyz, wij, rot_mtr[vi_id], rot_mtr[vj_id], rot_mtr[ros_id(vm)], pij);
-            // corresponds xyz += wij * ( rot_mtr[vi_id] + rot_mtr[vj_id] + rot_mtr[ros_id(vm)] ) * pij
-          }
-        }
-        Bx[vi_id] = cr_traits.vector_coordinate(xyz, 0);
-        By[vi_id] = cr_traits.vector_coordinate(xyz, 1);
-        Bz[vi_id] = cr_traits.vector_coordinate(xyz, 2);
-      }
-      else
-      {// constrained vertices
-        Bx[vi_id] = solution[vi_id][0]; By[vi_id] = solution[vi_id][1]; Bz[vi_id] = solution[vi_id][2];
-      }
-    }
-    // solve "A*X = B".
-    bool is_all_solved = m_solver.linear_solver(Bx, X) && m_solver.linear_solver(By, Y) && m_solver.linear_solver(Bz, Z);
-    if(!is_all_solved) {
-      CGAL_warning(false);
-      return;
-    }
-
-    // copy to solution
-    for (std::size_t i = 0; i < ros.size(); i++)
-    {
-      std::size_t v_id = ros_id(ros[i]);
-      Point p(X[v_id], Y[v_id], Z[v_id]);
-      if (!is_ctrl_map[id(ros[i])])
-        solution[v_id] = p;
-    }
-  }
-
-  /// Assign solution to target surface mesh
-  void assign_solution()
-  {
-    for(std::size_t i = 0; i < ros.size(); ++i){
-      std::size_t v_id = ros_id(ros[i]);
-      if(is_roi_vertex(ros[i]))
-      {
-        put(vertex_point_map, ros[i], solution[v_id]);
-      }
-    }
-  }
-
-  /// Compute modeling energy
-  double energy() const
-  {
-    if(TAG == SPOKES_AND_RIMS)
-    {
-      return energy_spokes_and_rims();
-    }
-    else
-    {
-      return energy_arap();
-      return 0;
-    }
-  }
-  double energy_arap() const
-  {
-    Closest_rotation_traits cr_traits;
-
-    double sum_of_energy = 0;
-    // only accumulate ros vertices
-    for( std::size_t k = 0; k < ros.size(); k++ )
-    {
-      vertex_descriptor vi = ros[k];
-      std::size_t vi_id = ros_id(vi);
-
-      in_edge_iterator e, e_end;
-      for (cpp11::tie(e,e_end) = in_edges(vi, m_halfedge_graph); e != e_end; e++)
-      {
-        halfedge_descriptor he = halfedge(*e, m_halfedge_graph);
-        vertex_descriptor vj = source(he, m_halfedge_graph);
-        std::size_t vj_id = ros_id(vj);
-
-        const CR_vector& pij = sub_to_CR_vector(original[vi_id], original[vj_id]);
-        const CR_vector& qij = sub_to_CR_vector(solution[vi_id], solution[vj_id]);
-
-        double wij = hedge_weight[id(he)];
-
-        sum_of_energy += wij * cr_traits.squared_norm_vector_scalar_vector_subs(qij, rot_mtr[vi_id], pij);
-        // sum_of_energy += wij * ( qij - rot_mtr[vi_id]*pij )^2
-      }
-    }
-    return sum_of_energy;
-  }
-  double energy_spokes_and_rims() const
-  {
-    Closest_rotation_traits cr_traits;
-
-    double sum_of_energy = 0;
-    // only accumulate ros vertices
-    for( std::size_t k = 0; k < ros.size(); k++ )
-    {
-      vertex_descriptor vi = ros[k];
-      std::size_t vi_id = ros_id(vi);
-      //iterate through all triangles
-      out_edge_iterator e, e_end;
-      for (cpp11::tie(e,e_end) = out_edges(vi, m_halfedge_graph); e != e_end; e++)
-      {
-        halfedge_descriptor he = halfedge(*e, m_halfedge_graph);
-        if(is_border(he, m_halfedge_graph)) { continue; } // no facet
-        // iterate edges around facet
-        halfedge_descriptor hedge_around_facet = he;
-        do
-        {
-          vertex_descriptor v1 = target(hedge_around_facet, m_halfedge_graph);
-          vertex_descriptor v2 = source(hedge_around_facet, m_halfedge_graph);
-          std::size_t v1_id = ros_id(v1); std::size_t v2_id = ros_id(v2);
-
-          const CR_vector& p12 = sub_to_CR_vector(original[v1_id], original[v2_id]);
-          const CR_vector& q12 = sub_to_CR_vector(solution[v1_id], solution[v2_id]);
-          double w12 = hedge_weight[id(hedge_around_facet)];
-
-          sum_of_energy += w12 * cr_traits.squared_norm_vector_scalar_vector_subs(q12, rot_mtr[vi_id], p12);
-          // sum_of_energy += w12 * ( q12 - rot_mtr[vi_id]*p12 )^2
-
-        } while( (hedge_around_facet = next(hedge_around_facet, m_halfedge_graph)) != he);
-      }
-    }
-    return sum_of_energy;
-  }
-
-  void need_preprocess_both()
-  {
-    need_preprocess_factorization = true;
-    need_preprocess_region_of_solution = true;
-  }
-
-  /// p1 - p2, return CR_vector
-  CR_vector sub_to_CR_vector(const Point& p1, const Point& p2) const
-  {
-    return Closest_rotation_traits().vector(p1[0] - p2[0], p1[1] - p2[1], p1[2] - p2[2]);
-  }
-
-  template<class Vect>
-  Point add_to_point(const Point& p, const Vect& v) {
-    return Point(p[0] + v[0], p[1] + v[1], p[2] + v[2]);
-  }
-
-  template<class Vect>
-  Vect sub_to_vect(const Point& p, const Vect& v) {
-    return Vect(p[0] - v[0], p[1] - v[1], p[2] - v[2]);
-  }
-
-  /// shorthand of get(vertex_index_map, v)
-  std::size_t id(vertex_descriptor vd) const
-  { return get(vertex_index_map, vd); }
-
-  std::size_t& ros_id(vertex_descriptor vd)
-  { return ros_id_map[id(vd)]; }
-  std::size_t  ros_id(vertex_descriptor vd) const
-  { return ros_id_map[id(vd)]; }
-
-  /// shorthand of get(hedge_index_map, e)
-  std::size_t id(halfedge_descriptor e) const
-  {
-    return get(hedge_index_map, e);
-  }
-};
-} //namespace CGAL
-#endif  // CGAL_SURFACE_MESH_DEFORMATION_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_shortest_path/Surface_mesh_shortest_path.h b/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_shortest_path/Surface_mesh_shortest_path.h
deleted file mode 100644
index 3147938..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_shortest_path/Surface_mesh_shortest_path.h
+++ /dev/null
@@ -1,2786 +0,0 @@
-// Copyright (c) 2014 GeometryFactory
-// 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
-// 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(s)     : Stephen Kiazyk
-
-#ifndef CGAL_SURFACE_MESH_SHORTEST_PATH_SURFACE_MESH_SHORTEST_PATH_H
-#define CGAL_SURFACE_MESH_SHORTEST_PATH_SURFACE_MESH_SHORTEST_PATH_H
-
-#include <iterator>
-#include <vector>
-#include <utility>
-#include <queue>
-#include <algorithm>
-#include <cstddef>
-#include <list>
-
-#include <boost/array.hpp>
-#include <boost/lexical_cast.hpp>
-#include <boost/utility/enable_if.hpp>
-#include <boost/type_traits/is_same.hpp>
-#include <iterator>
-
-#include <CGAL/assertions.h>
-#include <CGAL/AABB_tree.h>
-#include <CGAL/Default.h>
-
-#include <CGAL/Surface_mesh_shortest_path/barycentric.h>
-#include <CGAL/Surface_mesh_shortest_path/internal/Cone_tree.h>
-#include <CGAL/Surface_mesh_shortest_path/internal/misc_functions.h>
-
-#include <CGAL/boost/graph/iterator.h>
-#include <boost/variant/get.hpp>
-
-namespace CGAL {
-
-/*!
-\ingroup PkgSurfaceMeshShortestPath
-
-\brief Computes shortest surface paths from one or more source points on a surface mesh.
-
-\details Uses an optimized variation of Chen and Han's \f$ O(n^2) \f$ algorithm by Xin and Wang.
-Refer to those respective papers for the details of the implementation.
-
-\tparam Traits a model of `SurfaceMeshShortestPathTraits`.
-\tparam VIM a model of `ReadablePropertyMap` with `vertex_descriptor` as key and `unsigned int` as value type.
-            The default is `boost::property_map<HG, boost::%vertex_index_t>::%type`.
-\tparam HIM a model of `ReadablePropertyMap` with `halfedge_descriptor` as key and `unsigned int` as value type.
-            The default is `boost::property_map<HG, boost::%halfedge_index_t>::%type`.
-\tparam FIM a model of `ReadablePropertyMap` with `face_descriptor` as key and `unsigned int` as value type.
-            The default is `boost::property_map<HG, boost::%face_index_t>::%type`.
-\tparam VPM a model of `ReadablePropertyMap` with `vertex_descriptor` as key and `Traits::Point_3` as value type.
-            The default is `boost::property_map<HG, CGAL::vertex_point_t>::%type`.
-*/
-
-template<class Traits,
-  class VIM = Default,
-  class HIM = Default,
-  class FIM = Default,
-  class VPM = Default>
-class Surface_mesh_shortest_path
-{
-public:
-/// \name Types
-/// @{
-
-  /// The triangle mesh type which this algorithm acts on.
-  typedef typename Traits::Triangle_mesh Triangle_mesh;
-
-  /// The BGL graph traits for this triangle mesh
-  typedef boost::graph_traits<Triangle_mesh> Graph_traits;
-
-  /// Descriptors for the vertices of `Triangle_mesh`
-  typedef typename Graph_traits::vertex_descriptor vertex_descriptor;
-
-  /// Descriptors for the halfedges of `Triangle_mesh`
-  typedef typename Graph_traits::halfedge_descriptor halfedge_descriptor;
-
-  /// Descriptors of the faces of `Triangle_mesh`
-  typedef typename Graph_traits::face_descriptor face_descriptor;
-
-#ifndef DOXYGEN_RUNNING
-
-  typedef typename Default::Get<
-    VIM,
-    typename boost::property_map<Triangle_mesh, boost::vertex_index_t>::type
-      >::type Vertex_index_map;
-
-  typedef typename Default::Get<
-    HIM,
-    typename boost::property_map<Triangle_mesh, boost::halfedge_index_t>::type
-      >::type Halfedge_index_map;
-
-  typedef typename Default::Get<
-    FIM,
-    typename boost::property_map<Triangle_mesh, boost::face_index_t>::type
-      >::type Face_index_map;
-
-  typedef typename Default::Get<
-    VPM,
-    typename boost::property_map<Triangle_mesh, CGAL::vertex_point_t>::type
-      >::type Vertex_point_map;
-
-#else
-  /// The vertex index property map class
-  typedef VIM Vertex_index_map;
-
-  /// The halfedge index property map class
-  typedef HIM Halfedge_index_map;
-
-  /// The face index property map class
-  typedef FIM Face_index_map;
-
-  /// The vertex point property map class
-  typedef VPM Vertex_point_map;
-#endif
-
-  /// The numeric type used by this algorithm.
-  typedef typename Traits::FT FT;
-
-  /// The 3-dimensional point type, which must coincide with the value type of `Vertex_point_map`.
-  typedef typename Traits::Point_3 Point_3;
-
-  /// An ordered triple which specifies a location inside a triangle as
-  /// a convex combination of its three vertices.
-  typedef typename Traits::Barycentric_coordinate Barycentric_coordinate;
-
-  /// \brief An ordered pair specifying a location on the surface of the `Triangle_mesh`.
-  /// \details If `g` is the input graph and given the pair (`f`, `bc`) such that `bc` is `(w0, w1, w2)`,
-  ///  the correspondance with the weights in `bc` and the vertices of the face `f` is the following:
-  /// - `w0 = source(halfedge(f,g),g)`
-  /// - `w1 = target(halfedge(f,g),g)`
-  /// - `w2 = target(next(halfedge(f,g),g),g)`
-  typedef std::pair<face_descriptor, Barycentric_coordinate> Face_location;
-
-private:
-
-  typedef std::list<Face_location> Source_point_list;
-  typedef typename Source_point_list::iterator Source_point_underlying_iterator;
-
-public:
-
-  /*!
-  \brief A model of `BidirectionalIterator` to access the source points
-
-  \details An iterator becomes invalid if:
-   - the corresponding point is removed (either with `Surface_mesh_shortest_path::remove_source_point()` or `Surface_mesh_shortest_path::remove_all_source_points()`).
-   - the structure is re-built (triggered by a shortest path query or a call to `Surface_mesh_shortest_path::build_sequence_tree()`).
-   - the structure is cleared (`Surface_mesh_shortest_path::clear()`).
-
-  Dereferencing this iterator yields a `const Surface_mesh_shortest_path::Face_location&`.
-
-  This iterator supports equality comparison operations.
-  */
-  class Source_point_iterator
-  {
-  public:
-    typedef std::bidirectional_iterator_tag iterator_category;
-    typedef Face_location value_type;
-    typedef Face_location* pointer;
-    typedef Face_location& reference;
-
-  private:
-    Source_point_underlying_iterator m_iterator;
-
-    friend class Surface_mesh_shortest_path;
-
-    Source_point_iterator(Source_point_underlying_iterator it)
-      : m_iterator(it)
-    {
-    }
-
-  public:
-    /*!
-    \brief %Default constructor
-    */
-    Source_point_iterator()
-    {
-    }
-
-    /*!
-    \brief Copy constructor
-    */
-    Source_point_iterator(const Source_point_iterator& other)
-      : m_iterator(other.m_iterator)
-    {
-    }
-
-    /*
-    \brief Copy the contents of another `Source_point_iterator`
-
-    \param other The iterator to be copied
-    */
-    Source_point_iterator& operator=(const Source_point_iterator& other)
-    {
-      m_iterator = other.m_iterator;
-      return *this;
-    }
-
-    const Face_location& operator*() const
-    {
-      return *m_iterator;
-    }
-
-    const Face_location* operator->() const
-    {
-      return &(*m_iterator);
-    }
-
-    Source_point_iterator& operator++()
-    {
-      ++m_iterator;
-      return *this;
-    }
-
-    Source_point_iterator operator++(int)
-    {
-      Source_point_iterator temp(*this);
-      ++m_iterator;
-      return temp;
-    }
-
-    Source_point_iterator& operator--()
-    {
-      --m_iterator;
-      return *this;
-    }
-
-    Source_point_iterator operator--(int)
-    {
-      Source_point_iterator temp(*this);
-      --m_iterator;
-      return temp;
-    }
-
-    bool operator==(const Source_point_iterator& other)
-    {
-      return m_iterator == other.m_iterator;
-    }
-
-    bool operator!=(const Source_point_iterator& other)
-    {
-      return m_iterator != other.m_iterator;
-    }
-  };
-
-  /// The return type from shortest path distance queries. Stores the distance
-  /// to the nearest source point, and a `Source_point_iterator` to the
-  /// source point itself.
-  typedef std::pair<FT, Source_point_iterator> Shortest_path_result;
-
-/// @}
-
-private:
-  typedef typename Graph_traits::vertex_iterator vertex_iterator;
-  typedef typename Graph_traits::halfedge_iterator halfedge_iterator;
-  typedef typename Graph_traits::face_iterator face_iterator;
-
-  typedef typename Traits::Triangle_3 Triangle_3;
-  typedef typename Traits::Triangle_2 Triangle_2;
-  typedef typename Traits::Segment_2 Segment_2;
-  typedef typename Traits::Ray_3 Ray_3;
-  typedef typename Traits::Ray_2 Ray_2;
-  typedef typename Traits::Line_2 Line_2;
-  typedef typename Traits::Point_2 Point_2;
-  typedef typename Traits::Vector_2 Vector_2;
-
-  typedef internal::Cone_tree_node<Traits> Cone_tree_node;
-  typedef internal::Cone_expansion_event<Traits> Cone_expansion_event;
-
-  typedef std::priority_queue<Cone_expansion_event, std::vector<Cone_expansion_event*>, internal::Cone_expansion_event_min_priority_queue_comparator<Traits> > Expansion_priqueue;
-  typedef std::pair<Cone_tree_node*, FT> Node_distance_pair;
-
-private:
-
-  template <class OutputIterator>
-  struct Point_path_visitor_wrapper
-  {
-    Surface_mesh_shortest_path& m_owner;
-    OutputIterator m_output;
-
-    Point_path_visitor_wrapper(Surface_mesh_shortest_path& owner, OutputIterator output)
-      : m_owner(owner)
-      , m_output(output)
-    {
-    }
-
-    void operator()(halfedge_descriptor edge, FT t)
-    {
-      *m_output = m_owner.point(edge, t);
-      ++m_output;
-    }
-
-    void operator()(vertex_descriptor vertex)
-    {
-      *m_output = m_owner.point(vertex);
-      ++m_output;
-    }
-
-    void operator()(face_descriptor f, Barycentric_coordinate location)
-    {
-      *m_output = m_owner.point(f, location);
-      ++m_output;
-    }
-  };
-
-private:
-  Traits m_traits;
-  Triangle_mesh& m_graph;
-  Vertex_index_map m_vertexIndexMap;
-  Halfedge_index_map m_halfedgeIndexMap;
-  Face_index_map m_faceIndexMap;
-  Vertex_point_map m_vertexPointMap;
-
-  std::vector<bool> m_vertexIsPseudoSource;
-
-  std::vector<Node_distance_pair> m_vertexOccupiers;
-  std::vector<Node_distance_pair> m_closestToVertices;
-
-  std::vector<std::pair<Cone_tree_node*, Source_point_iterator> > m_rootNodes;
-  Source_point_list m_faceLocations;
-  Source_point_underlying_iterator m_firstNewSourcePoint;
-  Source_point_list m_deletedSourceLocations;
-
-  std::vector<std::vector<Cone_tree_node*> > m_faceOccupiers;
-
-  Expansion_priqueue m_expansionPriqueue;
-
-#if !defined(NDEBUG)
-
-  std::size_t m_currentNodeCount;
-  std::size_t m_peakNodeCount;
-  std::size_t m_queueAtPeakNodes;
-  std::size_t m_peakQueueSize;
-  std::size_t m_nodesAtPeakQueue;
-
-#endif
-
-#if !defined(NDEBUG)
-public:
-
-  /// \cond
-
-  std::size_t peak_node_count()
-  {
-    return m_peakNodeCount;
-  }
-
-  std::size_t current_node_count()
-  {
-    return m_currentNodeCount;
-  }
-
-  std::size_t peak_queue_size()
-  {
-    return m_peakQueueSize;
-  }
-
-  std::size_t current_memory_usage()
-  {
-    std::size_t baseUsage = m_rootNodes.size() * sizeof(Cone_tree_node*) + m_closestToVertices.size() * sizeof(Node_distance_pair);
-
-    std::size_t finalUsage = baseUsage + sizeof(Cone_tree_node) * m_currentNodeCount;
-
-    for (std::size_t i = 0; i < m_faceOccupiers.size(); ++i)
-    {
-      finalUsage += (m_faceOccupiers[i].size() * sizeof(Cone_tree_node*)) + sizeof(std::vector<Cone_tree_node*>);
-    }
-
-    return finalUsage;
-  }
-
-  std::size_t peak_memory_usage()
-  {
-    std::size_t baseUsage = m_rootNodes.size() * sizeof(Cone_tree_node*) + m_vertexOccupiers.size() * sizeof(Node_distance_pair) + m_closestToVertices.size() * sizeof(Node_distance_pair);
-
-    std::size_t peakNodeUsage = baseUsage + (sizeof(Cone_tree_node) * m_peakNodeCount) + ((sizeof(Cone_expansion_event) + sizeof(Cone_expansion_event*)) * m_queueAtPeakNodes);
-
-    std::size_t peakQueueUsage = baseUsage + (sizeof(Cone_expansion_event) + (sizeof(Cone_expansion_event*)) * m_peakQueueSize) + (sizeof(Cone_tree_node) * m_nodesAtPeakQueue);
-
-    return std::max(peakNodeUsage, peakQueueUsage);
-  }
-
-  /// \endcond
-
-#endif
-
-
-public:
-
-  /// \cond
-
-  /// This is just a placeholder for a proper debug output verbosity switch method
-  bool m_debugOutput;
-
-  /// \endcond
-
-private:
-
-  void node_created()
-  {
-#if !defined(NDEBUG)
-    ++m_currentNodeCount;
-    if (m_currentNodeCount > m_peakNodeCount)
-    {
-      m_peakNodeCount = m_currentNodeCount;
-      m_queueAtPeakNodes = m_expansionPriqueue.size();
-    }
-#endif
-  }
-
-  void queue_pushed()
-  {
-#if !defined(NDEBUG)
-    if (m_expansionPriqueue.size() > m_peakQueueSize)
-    {
-      m_peakQueueSize = m_expansionPriqueue.size();
-      m_nodesAtPeakQueue = m_currentNodeCount;
-    }
-#endif
-  }
-
-  void node_deleted()
-  {
-#if !defined(NDEBUG)
-    --m_currentNodeCount;
-#endif
-  }
-
-  Point_2 construct_barycenter_in_triangle_2(const Triangle_2& t, const Barycentric_coordinate& b) const
-  {
-    return construct_barycenter_in_triangle_2(t, b, m_traits);
-  }
-
-  static Point_2 construct_barycenter_in_triangle_2(const Triangle_2& t, const Barycentric_coordinate& b, const Traits& traits)
-  {
-    typename Traits::Construct_vertex_2 cv2(traits.construct_vertex_2_object());
-    typename Traits::Construct_barycentric_coordinate_weight cbcw(traits.construct_barycentric_coordinate_weight_object());
-    typename Traits::Construct_barycenter_2 cb2(traits.construct_barycenter_2_object());
-
-    return cb2(cv2(t, 0), cbcw(b, 0), cv2(t, 1), cbcw(b, 1), cv2(t, 2), cbcw(b, 2));
-  }
-
-  Point_3 construct_barycenter_in_triangle_3(const Triangle_3& t, const Barycentric_coordinate& b) const
-  {
-    return construct_barycenter_in_triangle_3(t, b, m_traits);
-  }
-
-  static Point_3 construct_barycenter_in_triangle_3(const Triangle_3& t, const Barycentric_coordinate& b, const Traits& traits)
-  {
-    typename Traits::Construct_vertex_3 cv3(traits.construct_vertex_3_object());
-    typename Traits::Construct_barycentric_coordinate_weight cbcw(traits.construct_barycentric_coordinate_weight_object());
-    typename Traits::Construct_barycenter_3 cb3(traits.construct_barycenter_3_object());
-
-    return cb3(cv3(t, 0), cbcw(b, 0), cv3(t, 1), cbcw(b, 1), cv3(t, 2), cbcw(b, 2));
-  }
-
-  Triangle_3 triangle_from_halfedge(halfedge_descriptor edge) const
-  {
-    return triangle_from_halfedge(edge, m_graph, m_vertexPointMap);
-  }
-
-  static Triangle_3 triangle_from_halfedge(halfedge_descriptor edge, const Triangle_mesh& g)
-  {
-    return triangle_from_halfedge(edge, g, get(vertex_point, g));
-  }
-
-  static Triangle_3 triangle_from_halfedge(halfedge_descriptor edge, const Triangle_mesh& g, Vertex_point_map vertexPointMap)
-  {
-    return CGAL::internal::triangle_from_halfedge<Triangle_3, Triangle_mesh, Vertex_point_map>(edge, g, vertexPointMap);
-  }
-
-  Triangle_3 triangle_from_face(face_descriptor f) const
-  {
-    return triangle_from_face(f, m_graph, m_vertexPointMap);
-  }
-
-  static Triangle_3 triangle_from_face(face_descriptor f, const Triangle_mesh& g)
-  {
-    return triangle_from_halfedge(halfedge(f, g), g, get(vertex_point, g));
-  }
-
-  static Triangle_3 triangle_from_face(face_descriptor f, const Triangle_mesh& g, Vertex_point_map vertexPointMap)
-  {
-    return triangle_from_halfedge(halfedge(f, g), g, vertexPointMap);
-  }
-
-  /*
-    Filtering algorithm described in Xin and Wang (2009) "Improving chen and han's algorithm on the discrete geodesic problem."
-    http://doi.acm.org/10.1145/1559755.1559761
-  */
-  bool window_distance_filter(Cone_tree_node* cone, Segment_2 windowSegment, bool reversed)
-  {
-    typename Traits::Construct_vertex_2 cv2(m_traits.construct_vertex_2_object());
-    typename Traits::Compute_squared_distance_2 csd2(m_traits.compute_squared_distance_2_object());
-
-    Segment_2 parentEntrySegment = cone->entry_segment();
-    Point_2 v2 = cone->target_point();
-    Point_2 I = cone->source_image();
-    FT d = cone->distance_from_source_to_root();
-    FT d1;
-    FT d2;
-    FT d3;
-    Point_2 A;
-    Point_2 B;
-    Point_2 v1;
-    Point_2 v3;
-
-    std::size_t v1Index = get(m_vertexIndexMap, source(cone->entry_edge(), m_graph));
-    std::size_t v2Index = get(m_vertexIndexMap, cone->target_vertex());
-    std::size_t v3Index = get(m_vertexIndexMap, target(cone->entry_edge(), m_graph));
-
-    Node_distance_pair v1Distance = m_closestToVertices[v1Index];
-    Node_distance_pair v2Distance = m_closestToVertices[v2Index];
-    Node_distance_pair v3Distance = m_closestToVertices[v3Index];
-
-    if (reversed)
-    {
-      std::swap(v1Distance, v3Distance);
-      std::swap(v1Index, v3Index);
-      A = cv2(windowSegment, 1);
-      B = cv2(windowSegment, 0);
-      v1 = cv2(parentEntrySegment, 1);
-      v3 = cv2(parentEntrySegment, 0);
-    }
-    else
-    {
-      A = cv2(windowSegment, 0);
-      B = cv2(windowSegment, 1);
-      v1 = cv2(parentEntrySegment, 0);
-      v3 = cv2(parentEntrySegment, 1);
-    }
-
-    d1 = v1Distance.second;
-    d2 = v2Distance.second;
-    d3 = v3Distance.second;
-
-    bool hasD1 = v1Distance.first != NULL && v1Distance.first != cone->parent();
-    bool hasD2 = v2Distance.first != NULL && v2Distance.first != cone->parent();
-    bool hasD3 = v3Distance.first != NULL && v3Distance.first != cone->parent();
-
-    if (hasD1 && (d + CGAL::internal::select_sqrt(csd2(I, B)) > d1 + CGAL::internal::select_sqrt(csd2(v1, B))))
-    {
-      if (m_debugOutput)
-      {
-        std::cout << "Filter: d + |I,B| > d1 + |v1,B|: " << std::endl;
-        std::cout << "v1 = " << v1Index << " , " << d1 << " , v2 = " << v2Index << " , " << d2 << " , v3 = " << v3Index << " , " << d3 << std::endl;
-        std::cout << "d = " << d << std::endl;
-        std::cout << "v1,B = " << CGAL::internal::select_sqrt(csd2(v1, B)) << std::endl;
-        std::cout << "I,B = " << CGAL::internal::select_sqrt(csd2(I, B)) << std::endl;
-        std::cout << "I,A = " << CGAL::internal::select_sqrt(csd2(I, A)) << std::endl;
-        std::cout << (d + CGAL::internal::select_sqrt(csd2(I, B))) << " vs. " << (d1 + CGAL::internal::select_sqrt(csd2(v1, B))) << std::endl;
-      }
-
-      return false;
-    }
-
-    if (hasD2 && (d + CGAL::internal::select_sqrt(csd2(I, A)) > d2 + CGAL::internal::select_sqrt(csd2(v2, A))))
-    {
-      if (m_debugOutput)
-      {
-        std::cout << "Filter: d + |I,A| > d2 + |v2,A|: " << std::endl;
-        std::cout << "v1 = " << v1Index << " , " << d1 << " , v2 = " << v2Index << " , " << d2 << " , v3 = " << v3Index << " , " << d3 << std::endl;
-        std::cout << "d = " << d << std::endl;
-        std::cout << "v2,A = " << CGAL::internal::select_sqrt(csd2(v2, A)) << std::endl;
-        std::cout << "I,A = " << CGAL::internal::select_sqrt(csd2(I, A)) << std::endl;
-        std::cout << (d + CGAL::internal::select_sqrt(csd2(I, A))) << " vs. " << (d2 + CGAL::internal::select_sqrt(csd2(v2, A))) << std::endl;
-      }
-
-      return false;
-    }
-
-    if (hasD3 && (d + CGAL::internal::select_sqrt(csd2(I, A)) > d3 + CGAL::internal::select_sqrt(csd2(v3, A))))
-    {
-      if (m_debugOutput)
-      {
-        std::cout << "Filter: d + |I,A| > d3 + |v3,A|: " << std::endl;
-        std::cout << "v1 = " << v1Index << " , " << d1 << " , v2 = " << v2Index << " , " << d2 << " , v3 = " << v3Index << " , " << d3 << std::endl;
-        std::cout << "d = " << d << std::endl;
-        std::cout << "v3,A = " << CGAL::internal::select_sqrt(csd2(v3, A)) << std::endl;
-        std::cout << "I,A = " << CGAL::internal::select_sqrt(csd2(I, A)) << std::endl;
-        std::cout << (d + CGAL::internal::select_sqrt(csd2(I, A))) << " vs. " << (d3 + CGAL::internal::select_sqrt(csd2(v3, A))) << std::endl;
-      }
-
-      return false;
-    }
-
-    return true;
-  }
-
-  /*
-    Push a new node representing crossing the edge to the left of `cone`'s target vertex
-  */
-  void expand_left_child(Cone_tree_node* cone, Segment_2 windowSegment)
-  {
-    typename Traits::Construct_vertex_2 cv2(m_traits.construct_vertex_2_object());
-    typename Traits::Construct_triangle_3_along_segment_2_flattening ft3as2(m_traits.construct_triangle_3_along_segment_2_flattening_object());
-
-    CGAL_assertion(cone->m_pendingLeftSubtree != NULL);
-
-    cone->m_pendingLeftSubtree = NULL;
-
-    if (window_distance_filter(cone, windowSegment, false))
-    {
-      Triangle_3 adjacentFace = triangle_from_halfedge(cone->left_child_edge());
-      Triangle_2 layoutFace = ft3as2(adjacentFace, 0, cone->left_child_base_segment());
-      Cone_tree_node* child = new Cone_tree_node(m_traits, m_graph, cone->left_child_edge(), layoutFace, cone->source_image(), cone->distance_from_source_to_root(), cv2(windowSegment, 0), cv2(windowSegment, 1), Cone_tree_node::INTERVAL);
-      node_created();
-      cone->set_left_child(child);
-      process_node(child);
-    }
-    else if (m_debugOutput)
-    {
-      std::cout << "\tNode was filtered." << std::endl;
-    }
-  }
-
-  /*
-    Push a new node representing crossing the edge to the right of `cone`'s target vertex
-  */
-  void expand_right_child(Cone_tree_node* cone, Segment_2 windowSegment)
-  {
-    typename Traits::Construct_vertex_2 cv2(m_traits.construct_vertex_2_object());
-    typename Traits::Construct_triangle_3_along_segment_2_flattening ft3as2(m_traits.construct_triangle_3_along_segment_2_flattening_object());
-
-    CGAL_assertion(cone->m_pendingRightSubtree != NULL);
-
-    cone->m_pendingRightSubtree = NULL;
-
-    if (window_distance_filter(cone, windowSegment, true))
-    {
-      Triangle_3 adjacentFace = triangle_from_halfedge(cone->right_child_edge());
-      Triangle_2 layoutFace = ft3as2(adjacentFace, 0, cone->right_child_base_segment());
-      Cone_tree_node* child = new Cone_tree_node(m_traits, m_graph, cone->right_child_edge(), layoutFace, cone->source_image(), cone->distance_from_source_to_root(), cv2(windowSegment, 0), cv2(windowSegment, 1), Cone_tree_node::INTERVAL);
-      node_created();
-      cone->set_right_child(child);
-      process_node(child);
-    }
-    else if (m_debugOutput)
-    {
-      std::cout << "\tNode was filtered." << std::endl;
-    }
-  }
-
-  /*
-    Determines whether to expand `location` as a face, edge, or vertex root, depending on
-    whether it is near to a given edge or vertex, or is an internal face location
-  */
-  void expand_root(face_descriptor f, Barycentric_coordinate location, Source_point_iterator sourcePointIt)
-  {
-    typename Traits::Construct_barycentric_coordinate_weight cbcw(m_traits.construct_barycentric_coordinate_weight_object());
-    typename Traits::Classify_barycentric_coordinate classify_barycentric_coordinate(m_traits.classify_barycentric_coordinate_object());
-
-    std::size_t associatedEdge;
-    CGAL::Surface_mesh_shortest_paths_3::Barycentric_coordinate_type type;
-    boost::tie(type, associatedEdge) = classify_barycentric_coordinate(location);
-
-    switch (type)
-    {
-      case CGAL::Surface_mesh_shortest_paths_3::BARYCENTRIC_COORDINATE_ON_BOUNDED_SIDE:
-        expand_face_root(f, location, sourcePointIt);
-        break;
-      case CGAL::Surface_mesh_shortest_paths_3::BARYCENTRIC_COORDINATE_ON_BOUNDARY:
-        {
-          halfedge_descriptor he = halfedge(f, m_graph);
-          for (std::size_t i = 0; i < associatedEdge; ++i)
-          {
-            he = next(he, m_graph);
-          }
-          expand_edge_root(he, cbcw(location, associatedEdge), cbcw(location, (associatedEdge + 1) % 3), sourcePointIt);
-        }
-        break;
-      case CGAL::Surface_mesh_shortest_paths_3::BARYCENTRIC_COORDINATE_ON_VERTEX:
-        {
-          halfedge_descriptor he = halfedge(f, m_graph);
-          for (std::size_t i = 0; i < associatedEdge; ++i)
-          {
-            he = next(he, m_graph);
-          }
-          expand_vertex_root(source(he, m_graph), sourcePointIt);
-        }
-        break;
-      default:
-        CGAL_assertion(false && "Invalid face location");
-        // Perhaps hit an assertion that the type must not be external or invalid?
-    }
-  }
-
-  /*
-    Create source nodes facing each edge of `f`, rooted at the given `faceLocation`
-  */
-  void expand_face_root(face_descriptor f, Barycentric_coordinate faceLocation, Source_point_iterator sourcePointIt)
-  {
-    typename Traits::Construct_triangle_3_to_triangle_2_projection pt3t2(m_traits.construct_triangle_3_to_triangle_2_projection_object());
-    typename Traits::Construct_vertex_2 cv2(m_traits.construct_vertex_2_object());
-
-    halfedge_descriptor start = halfedge(f, m_graph);
-    halfedge_descriptor current = start;
-
-    Cone_tree_node* faceRoot = new Cone_tree_node(m_traits, m_graph, m_rootNodes.size());
-    node_created();
-    m_rootNodes.push_back(std::make_pair(faceRoot, sourcePointIt));
-
-    if (m_debugOutput)
-    {
-      typename Traits::Construct_barycentric_coordinate_weight cbcw(m_traits.construct_barycentric_coordinate_weight_object());
-      std::cout << "\tFace Root Expansion: id = " << get(m_faceIndexMap, f) << " , Location = " << cbcw(faceLocation, 0) << " " << cbcw(faceLocation, 1) << " " << cbcw(faceLocation, 2) << " " << std::endl;
-    }
-
-    for (std::size_t currentVertex = 0; currentVertex < 3; ++currentVertex)
-    {
-      Triangle_3 face3d(triangle_from_halfedge(current));
-      Triangle_2 layoutFace(pt3t2(face3d));
-      Barycentric_coordinate rotatedFaceLocation(shifted_coordiate(faceLocation, currentVertex));
-      Point_2 sourcePoint(construct_barycenter_in_triangle_2(layoutFace, rotatedFaceLocation));
-
-      Cone_tree_node* child = new Cone_tree_node(m_traits, m_graph, current, layoutFace, sourcePoint, FT(0.0), cv2(layoutFace, 0), cv2(layoutFace, 2), Cone_tree_node::FACE_SOURCE);
-      node_created();
-      faceRoot->push_middle_child(child);
-
-      if (m_debugOutput)
-      {
-        std::cout << "\tExpanding face root #" << currentVertex << " : " << std::endl;;
-        std::cout << "\t\tFace = " << layoutFace << std::endl;
-        std::cout << "\t\tLocation = " << sourcePoint << std::endl;
-      }
-
-      process_node(child);
-
-      current = next(current, m_graph);
-    }
-  }
-
-  /*
-    Create 'source' nodes to each size of the given edge, rooted at the specified parametric location
-  */
-  void expand_edge_root(halfedge_descriptor baseEdge, FT t0, FT t1, Source_point_iterator sourcePointIt)
-  {
-    typename Traits::Construct_barycenter_2 cb2(m_traits.construct_barycenter_2_object());
-    typename Traits::Construct_vertex_2 cv2(m_traits.construct_vertex_2_object());
-    typename Traits::Construct_triangle_3_to_triangle_2_projection pt3t2(m_traits.construct_triangle_3_to_triangle_2_projection_object());
-
-    if (m_debugOutput)
-    {
-      std::cout << "\tEdge Root Expansion: faceA = " << get(m_faceIndexMap, face(baseEdge, m_graph)) << " , faceB = " << get(m_faceIndexMap, face(opposite(baseEdge, m_graph), m_graph)) << " , t0 = " << t0 << " , t1 = " << t1 << std::endl;
-    }
-
-    halfedge_descriptor baseEdges[2];
-    baseEdges[0] = baseEdge;
-    baseEdges[1] = opposite(baseEdge, m_graph);
-
-    Triangle_3 faces3d[2];
-    Triangle_2 layoutFaces[2];
-
-    for (std::size_t i = 0; i < 2; ++i)
-    {
-       faces3d[i] = triangle_from_halfedge(baseEdges[i]);
-       layoutFaces[i] = pt3t2(faces3d[i]);
-    }
-
-    Point_2 sourcePoints[2];
-    sourcePoints[0] = cb2(cv2(layoutFaces[0], 0), t0, cv2(layoutFaces[0], 1), t1);
-    sourcePoints[1] = cb2(cv2(layoutFaces[1], 0), t0, cv2(layoutFaces[1], 1), t1);
-
-    Cone_tree_node* edgeRoot = new Cone_tree_node(m_traits, m_graph, m_rootNodes.size());
-    node_created();
-    m_rootNodes.push_back(std::make_pair(edgeRoot, sourcePointIt));
-
-    for (std::size_t side = 0; side < 2; ++side)
-    {
-      if (m_debugOutput)
-      {
-        std::cout << "\tExpanding edge root #" << side << " : " << std::endl;;
-        std::cout << "\t\tFace = " << layoutFaces[side] << std::endl;
-        std::cout << "\t\tLocation = " << sourcePoints[side] << std::endl;
-      }
-
-      Cone_tree_node* mainChild = new Cone_tree_node(m_traits, m_graph, baseEdges[side], layoutFaces[side], sourcePoints[side], FT(0.0), cv2(layoutFaces[side], 0), cv2(layoutFaces[side], 1), Cone_tree_node::EDGE_SOURCE);
-      node_created();
-      edgeRoot->push_middle_child(mainChild);
-      process_node(mainChild);
-    }
-  }
-
-  /*
-    Create a 'source' node for each face surrounding the given vertex.
-  */
-  void expand_vertex_root(vertex_descriptor vertex, Source_point_iterator sourcePointIt)
-  {
-    if (m_debugOutput)
-    {
-      std::cout << "\tVertex Root Expansion: Vertex = " << get(m_vertexIndexMap, vertex) << std::endl;
-    }
-
-    Cone_tree_node* vertexRoot = new Cone_tree_node(m_traits, m_graph, m_rootNodes.size(), prev(halfedge(vertex, m_graph), m_graph));
-
-    node_created();
-    m_rootNodes.push_back(std::make_pair(vertexRoot, sourcePointIt));
-
-    m_closestToVertices[get(m_vertexIndexMap, vertex)] = Node_distance_pair(vertexRoot, FT(0.0));
-
-    expand_pseudo_source(vertexRoot);
-  }
-
-  /*
-    Create child nodes for each face surrounding the vertex occupied by `parent`, and push them to the queue
-  */
-  void expand_pseudo_source(Cone_tree_node* parent)
-  {
-    typename Traits::Construct_triangle_3_to_triangle_2_projection pt3t2(m_traits.construct_triangle_3_to_triangle_2_projection_object());
-    typename Traits::Construct_vertex_2 cv2(m_traits.construct_vertex_2_object());
-
-    parent->m_pendingMiddleSubtree = NULL;
-
-    vertex_descriptor expansionVertex = parent->target_vertex();
-
-    halfedge_descriptor startEdge = halfedge(expansionVertex, m_graph);
-    halfedge_descriptor currentEdge = halfedge(expansionVertex, m_graph);
-
-    FT distanceFromTargetToRoot = parent->distance_from_target_to_root();
-
-    if (m_debugOutput)
-    {
-      std::cout << "Distance from target to root: " << distanceFromTargetToRoot << std::endl;
-    }
-
-    // A potential optimization could be made by only expanding in the 'necessary' range (i.e. the range outside of geodesic visibility), but the
-    // benefits may be small, since the node filter would prevent more than one-level propagation.
-    // It would also be neccessary to distinguish expanding a root vertex node from a pseudo-source node
-
-    do
-    {
-      Triangle_3 face3d(triangle_from_halfedge(currentEdge));
-      Triangle_2 layoutFace(pt3t2(face3d));
-
-      if (m_debugOutput)
-      {
-        std::cout << "Expanding PsuedoSource: id = ";
-        if (face(currentEdge, m_graph) != Graph_traits::null_face())
-        {
-          std::cout << get(m_faceIndexMap, face(currentEdge, m_graph));
-        }
-        else
-        {
-          std::cout << "EXTERNAL";
-        }
-        std::cout << std::endl;
-      }
-
-      Cone_tree_node* child = new Cone_tree_node(m_traits, m_graph, currentEdge, layoutFace, cv2(layoutFace, 1), distanceFromTargetToRoot, cv2(layoutFace, 0), cv2(layoutFace, 2), Cone_tree_node::VERTEX_SOURCE);
-
-      node_created();
-      parent->push_middle_child(child);
-      process_node(child);
-
-      currentEdge = opposite(next(currentEdge, m_graph), m_graph);
-    }
-    while (currentEdge != startEdge);
-
-  }
-
-  /*
-    Returns the intersection of `segment` and the cone defined by the region to the left `leftBoundary` and right of `rightBoundary`
-  */
-  bool clip_to_bounds(const Segment_2& segment, const Ray_2& leftBoundary, const Ray_2& rightBoundary, Segment_2& outSegment)
-  {
-    typename Traits::Construct_source_2 cs2(m_traits.construct_source_2_object());
-    typename Traits::Construct_segment_2 cseg2(m_traits.construct_segment_2_object());
-    typename Traits::Construct_target_2 ct2(m_traits.construct_target_2_object());
-    typename Traits::Construct_line_2 cl2(m_traits.construct_line_2_object());
-    typename Traits::Intersect_2 i2(m_traits.intersect_2_object());
-    typename Traits::Orientation_2 o2(m_traits.orientation_2_object());
-    typename Traits::Construct_point_on_2 cpo2(m_traits.construct_point_on_2_object());
-    typename Traits::Compute_parametric_distance_along_segment_2 pdas2(m_traits.compute_parametric_distance_along_segment_2_object());
-
-    typedef typename cpp11::result_of<typename Traits::Intersect_2(Line_2, Line_2)>::type LineLineIntersectResult;
-
-    Point_2 leftPoint;
-    Point_2 rightPoint;
-
-    if (m_debugOutput)
-    {
-      std::cout << "Clipping Segment " << segment << " with left = " << leftBoundary << " and right = " << rightBoundary << std::endl;
-    }
-
-    FT leftT;
-    FT rightT;
-
-    CGAL::Orientation leftOrientation = o2(cs2(leftBoundary), cpo2(leftBoundary, 1), cs2(segment));
-
-    if (leftOrientation == CGAL::RIGHT_TURN || leftOrientation == CGAL::COLLINEAR)
-    {
-      if (m_debugOutput)
-      {
-        std::cout << "\tLeft is completely covered." << std::endl;
-      }
-      leftPoint = cs2(segment);
-      leftT = FT(0.0);
-    }
-    else
-    {
-      LineLineIntersectResult cgalIntersection = i2(cl2(segment), cl2(leftBoundary));
-
-      if (!cgalIntersection || !boost::get<Point_2>(&*cgalIntersection))
-      {
-        if (m_debugOutput)
-        {
-          std::cout << "Dropping left due to co-linearity of boundary. " << bool(cgalIntersection) << std::endl;
-        }
-        return false;
-      }
-      else
-      {
-        Point_2* result = boost::get<Point_2>(&*cgalIntersection);
-        FT t0 = pdas2(cs2(segment), ct2(segment), *result);
-
-        if (t0 >= FT(1.00000))
-        {
-          if (m_debugOutput)
-          {
-            std::cout << "Dropping due to missing left intersect. " << t0 << std::endl;
-          }
-
-          return false;
-        }
-        else if (t0 <= FT(0.00000))
-        {
-          if (m_debugOutput)
-          {
-            std::cout << "\tLeft is completely covered (secondary check). " << t0 << std::endl;
-          }
-
-          leftPoint = cs2(segment);
-          leftT = FT(0.0);
-        }
-        else
-        {
-          if (m_debugOutput)
-          {
-            std::cout << "\tLeft intersects at t = " << t0 << std::endl;
-          }
-
-          leftPoint = *result;
-          leftT = t0;
-        }
-      }
-    }
-
-    CGAL::Orientation rightOrientation = o2(cs2(rightBoundary), cpo2(rightBoundary, 1), ct2(segment));
-
-    if (rightOrientation == CGAL::LEFT_TURN || rightOrientation == CGAL::COLLINEAR)
-    {
-      if (m_debugOutput)
-      {
-        std::cout << "Right is completely covered." << std::endl;
-      }
-      rightPoint = ct2(segment);
-      rightT = FT(1.0);
-    }
-    else
-    {
-      LineLineIntersectResult cgalIntersection = i2(cl2(segment), cl2(rightBoundary));
-
-      if (!cgalIntersection || !boost::get<Point_2>(&*cgalIntersection))
-      {
-        if (m_debugOutput)
-        {
-          std::cout << "Dropping due to co-linearity of right boundary." << std::endl;
-        }
-        return false;
-      }
-      else
-      {
-        Point_2* result = boost::get<Point_2>(&*cgalIntersection);
-        FT t0 = pdas2(cs2(segment), ct2(segment), *result);
-
-        if (t0 <= FT(0.00000))
-        {
-          if (m_debugOutput)
-          {
-            std::cout << "Dropping due to missing right intersect. " << t0 << std::endl;
-          }
-          return false;
-        }
-        else if (t0 >= FT(1.00000))
-        {
-          if (m_debugOutput)
-          {
-            std::cout << "\tRight is completely covered (secondary check). " << t0 << std::endl;
-          }
-          rightPoint = ct2(segment);
-          rightT = FT(1.0);
-        }
-        else
-        {
-          if (m_debugOutput)
-          {
-            std::cout << "\tRight intersects at t = " << t0 << std::endl;
-          }
-          rightPoint = *result;
-          rightT = t0;
-        }
-      }
-    }
-
-    if (leftT >= rightT)
-    {
-      if (m_debugOutput)
-      {
-        std::cout << "Dropping due to overlap. " << leftT << " : " << rightT << std::endl;
-      }
-      return false;
-    }
-
-    outSegment = cseg2(leftPoint, rightPoint);
-
-    return true;
-  }
-
-  /*
-    Take a node and compute whether it is an occupier/evicts older nodes, then push any children it may have.
-  */
-  void process_node(Cone_tree_node* node)
-  {
-    typename Traits::Compare_relative_intersection_along_segment_2 crias2(m_traits.compare_relative_intersection_along_segment_2_object());
-
-    bool leftSide = false;
-    bool rightSide = false;
-
-    if (!node->is_source_node())
-    {
-      leftSide = node->has_left_side();
-      rightSide = node->has_right_side();
-    }
-    else if (node->node_type() == Cone_tree_node::EDGE_SOURCE) 
-    {
-      leftSide = true;
-      rightSide = true;
-    }
-    else
-    {
-      leftSide = true;
-      rightSide = false;
-    }
-
-    bool propagateLeft = false;
-    bool propagateRight = false;
-    bool propagateMiddle = false;
-
-    if (m_debugOutput)
-    {
-      std::cout << " Processing node " << node << " , level = " << node->level() << std::endl;
-      std::cout << "\tFace = " << node->layout_face() << std::endl;
-      std::cout << "\tVertices = ";
-      halfedge_descriptor current = node->entry_edge();
-      for (std::size_t i = 0; i < 3; ++i)
-      {
-        std::cout << get(m_vertexIndexMap, source(current, m_graph)) << " ";
-        current = next(current, m_graph);
-      }
-      std::cout << std::endl;
-      std::cout << "\tSource Image = " << node->source_image() << std::endl;
-      std::cout << "\tWindow Left = " << node->window_left() << std::endl;
-      std::cout << "\tWindow Right = " << node->window_right() << std::endl;
-      std::cout << "\t Has Left : " << (leftSide ? "yes" : "no") << " , Has Right : " << (rightSide ? "yes" : "no") << std::endl;
-    }
-
-    if (node->is_source_node() || (leftSide && rightSide))
-    {
-      if (m_debugOutput)
-      {
-        std::cout << "\tContains target vertex" << std::endl;
-      }
-
-      std::size_t entryEdgeIndex = get(m_halfedgeIndexMap, node->entry_edge());
-
-      Node_distance_pair currentOccupier = m_vertexOccupiers[entryEdgeIndex];
-      FT currentNodeDistance = node->distance_from_target_to_root();
-
-      bool isLeftOfCurrent = false;
-
-      if (m_debugOutput)
-      {
-        std::cout << "\t Entry Edge = " << entryEdgeIndex << std::endl;
-        std::cout << "\t Target vertex = " << get(m_vertexIndexMap, node->target_vertex()) << std::endl;
-      }
-
-      if (currentOccupier.first != NULL)
-      {
-        if (node->is_vertex_node())
-        {
-          isLeftOfCurrent = false;
-        }
-        else if (currentOccupier.first->is_vertex_node())
-        {
-          isLeftOfCurrent = true;
-        }
-        else
-        {
-          CGAL::Comparison_result comparison = crias2(
-            node->entry_segment(),
-            node->ray_to_target_vertex().supporting_line(),
-            currentOccupier.first->entry_segment(),
-            currentOccupier.first->ray_to_target_vertex().supporting_line()
-          );
-
-          if (comparison == CGAL::SMALLER)
-          {
-            isLeftOfCurrent = true;
-          }
-        }
-
-        if (m_debugOutput)
-        {
-          std::cout << "\t Current occupier = " << currentOccupier.first << std::endl;
-          std::cout << "\t Current Occupier Distance = " << currentOccupier.second << std::endl;
-          std::cout << "\t " << (isLeftOfCurrent ? "Left" : "Right") << " of current" << std::endl;
-        }
-      }
-
-      if (m_debugOutput)
-      {
-        std::cout << "\t New Distance = " << currentNodeDistance << std::endl;
-      }
-
-      if (currentOccupier.first == NULL || currentOccupier.second > currentNodeDistance)
-      {
-        if (m_debugOutput)
-        {
-          std::cout << "\t Current node is now the occupier" << std::endl;
-        }
-
-        m_vertexOccupiers[entryEdgeIndex] = std::make_pair(node, currentNodeDistance);
-
-        propagateLeft = true;
-        propagateRight = true;
-
-        // This is a consequence of using the same basic node type for source and interval nodes
-        // If this is a source node, it is only pointing to one of the two opposite edges (the left one by convention)
-        if (node->node_type() != Cone_tree_node::INTERVAL && node->node_type() != Cone_tree_node::EDGE_SOURCE)
-        {
-          propagateRight = false;
-
-          // Propagating a pseudo-source on a boundary vertex can result in a cone on a null face
-          // In such a case, we only care about the part of the cone pointing at the vertex (i.e. the middle child),
-          // so we can avoid propagating over the (non-existant) left opposite edge
-          if (node->is_null_face())
-          {
-            propagateLeft = false;
-          }
-        }
-
-        if (currentOccupier.first != NULL)
-        {
-          if (isLeftOfCurrent)
-          {
-            if (currentOccupier.first->get_left_child())
-            {
-              delete_node(currentOccupier.first->remove_left_child());
-            }
-            else if (currentOccupier.first->m_pendingLeftSubtree != NULL)
-            {
-              currentOccupier.first->m_pendingLeftSubtree->m_cancelled = true;
-              currentOccupier.first->m_pendingLeftSubtree = NULL;
-            }
-          }
-          else
-          {
-            if (currentOccupier.first->get_right_child())
-            {
-              delete_node(currentOccupier.first->remove_right_child());
-            }
-            else if (currentOccupier.first->m_pendingRightSubtree != NULL)
-            {
-              currentOccupier.first->m_pendingRightSubtree->m_cancelled = true;
-              currentOccupier.first->m_pendingRightSubtree = NULL;
-            }
-          }
-        }
-
-        std::size_t targetVertexIndex = get(m_vertexIndexMap, node->target_vertex());
-
-        // Check if this is now the absolute closest node, and replace the current closest as appropriate
-        Node_distance_pair currentClosest = m_closestToVertices[targetVertexIndex];
-
-        if (m_debugOutput && currentClosest.first != NULL)
-        {
-          std::cout << "\t Current Closest Distance = " << currentClosest.second << std::endl;
-        }
-
-        if (currentClosest.first == NULL || currentClosest.second > currentNodeDistance)
-        {
-          if (m_debugOutput)
-          {
-            std::cout << "\t Current node is now the closest" << std::endl;
-          }
-
-          // if this is a saddle vertex, then evict previous closest vertex
-          if (m_vertexIsPseudoSource[targetVertexIndex])
-          {
-            if (currentClosest.first != NULL)
-            {
-              if (m_debugOutput)
-              {
-                std::cout << "\tEvicting old pseudo-source: " << currentClosest.first << std::endl;
-              }
-
-              if (currentClosest.first->m_pendingMiddleSubtree != NULL)
-              {
-                currentClosest.first->m_pendingMiddleSubtree->m_cancelled = true;
-                currentClosest.first->m_pendingMiddleSubtree = NULL;
-              }
-
-              while (currentClosest.first->has_middle_children())
-              {
-                delete_node(currentClosest.first->pop_middle_child());
-              }
-
-              if (m_debugOutput)
-              {
-                std::cout << "\tFinished Evicting" << std::endl;
-              }
-            }
-
-            propagateMiddle = true;
-          }
-
-          m_closestToVertices[targetVertexIndex] = Node_distance_pair(node, currentNodeDistance);
-        }
-      }
-      else
-      {
-        if (isLeftOfCurrent)
-        {
-          propagateLeft = true;
-        }
-        else if (!node->is_source_node())
-        {
-          propagateRight = true;
-        }
-      }
-    }
-    else
-    {
-      propagateLeft = leftSide;
-      propagateRight = rightSide;
-    }
-
-    if (node->level() <= num_faces(m_graph))
-    {
-      if (propagateLeft)
-      {
-        push_left_child(node);
-      }
-
-      if (propagateRight && (!node->is_source_node() || node->node_type() == Cone_tree_node::EDGE_SOURCE))
-      {
-        push_right_child(node);
-      }
-
-      if (propagateMiddle)
-      {
-        push_middle_child(node);
-      }
-    }
-    else if (m_debugOutput)
-    {
-      std::cout << "\tNo expansion since level limit reached" << std::endl;
-    }
-
-  }
-
-  void push_left_child(Cone_tree_node* parent)
-  {
-    typename Traits::Compute_squared_distance_2 csd2(m_traits.compute_squared_distance_2_object());
-
-    if (face(parent->left_child_edge(), m_graph) != Graph_traits::null_face())
-    {
-      Segment_2 leftWindow;
-
-      if (parent->is_source_node())
-      {
-        leftWindow = parent->left_child_base_segment();
-      }
-      else
-      {
-        bool result = clip_to_bounds(parent->left_child_base_segment(), parent->left_boundary(), parent->right_boundary(), leftWindow);
-        if (!result)
-        {
-          if (m_debugOutput)
-          {
-            std::cout << "Left child clip failed, killing node." << std::endl;
-          }
-          return;
-        }
-      }
-
-      FT distanceEstimate = parent->distance_from_source_to_root() + CGAL::internal::select_sqrt(csd2(parent->source_image(), leftWindow));
-
-      if (m_debugOutput)
-      {
-        std::cout << "\tPushing Left Child, Segment = " << parent->left_child_base_segment() << " , clipped = " << leftWindow << " , Estimate = " << distanceEstimate << std::endl;
-      }
-
-      Cone_expansion_event* event = new Cone_expansion_event(parent, distanceEstimate, Cone_expansion_event::LEFT_CHILD, leftWindow);
-      parent->m_pendingLeftSubtree = event;
-
-      m_expansionPriqueue.push(event);
-
-      queue_pushed();
-    }
-  }
-
-  void push_right_child(Cone_tree_node* parent)
-  {
-    typename Traits::Compute_squared_distance_2 csd2(m_traits.compute_squared_distance_2_object());
-
-    if (face(parent->right_child_edge(), m_graph) != Graph_traits::null_face())
-    {
-      Segment_2 rightWindow;
-      bool result = clip_to_bounds(parent->right_child_base_segment(), parent->left_boundary(), parent->right_boundary(), rightWindow);
-
-      if (!result)
-      {
-        if (m_debugOutput)
-        {
-          std::cout << "Right child clip failed, killing node." << std::endl;
-        }
-        return;
-      }
-
-      FT distanceEstimate = parent->distance_from_source_to_root() + CGAL::internal::select_sqrt(csd2(parent->source_image(), rightWindow));
-
-      if (m_debugOutput)
-      {
-        std::cout << "\tPushing Right Child, Segment = " << parent->right_child_base_segment() << " , clipped = " << rightWindow << " , Estimate = " << distanceEstimate << std::endl;
-      }
-
-      Cone_expansion_event* event = new Cone_expansion_event(parent, distanceEstimate, Cone_expansion_event::RIGHT_CHILD, rightWindow);
-      queue_pushed();
-      parent->m_pendingRightSubtree = event;
-
-      m_expansionPriqueue.push(event);
-    }
-  }
-
-  void push_middle_child(Cone_tree_node* parent)
-  {
-    if (m_debugOutput)
-    {
-      std::cout << "\tPushing Middle Child, Estimate = " << parent->distance_from_target_to_root() << std::endl;
-    }
-
-    Cone_expansion_event* event = new Cone_expansion_event(parent, parent->distance_from_target_to_root(), Cone_expansion_event::PSEUDO_SOURCE);
-
-    queue_pushed();
-
-    parent->m_pendingMiddleSubtree = event;
-
-    m_expansionPriqueue.push(event);
-  }
-
-  void delete_node(Cone_tree_node* node, bool destruction = false)
-  {
-    if (node != NULL)
-    {
-      if (m_debugOutput)
-      {
-        std::cout << "Deleting node " << node << std::endl;
-      }
-
-      if (node->m_pendingLeftSubtree != NULL)
-      {
-        node->m_pendingLeftSubtree->m_cancelled = true;
-        node->m_pendingLeftSubtree = NULL;
-      }
-
-      if (node->get_left_child() != NULL)
-      {
-        if (m_debugOutput)
-        {
-          std::cout << "\t"  << node << " Descending left." << std::endl;
-        }
-
-        delete_node(node->remove_left_child(), destruction);
-      }
-
-      if (node->m_pendingRightSubtree != NULL)
-      {
-        node->m_pendingRightSubtree->m_cancelled = true;
-        node->m_pendingRightSubtree = NULL;
-      }
-
-      if (node->get_right_child() != NULL)
-      {
-        if (m_debugOutput)
-        {
-          std::cout << "\t"  << node << " Descending right." << std::endl;
-        }
-
-        delete_node(node->remove_right_child(), destruction);
-      }
-
-      if (node->m_pendingMiddleSubtree != NULL)
-      {
-        node->m_pendingMiddleSubtree->m_cancelled = true;
-        node->m_pendingMiddleSubtree = NULL;
-      }
-
-      if (node->has_middle_children() && m_debugOutput)
-      {
-        std::cout << "\t"  << node << " Descending middle." << std::endl;
-      }
-
-      while (node->has_middle_children())
-      {
-        delete_node(node->pop_middle_child(), destruction);
-      }
-
-      // At the point of destruction, the `Triangle_mesh` referenced may have gone out of scope, we wish to distinguish between deletion with an assumed reference
-      // to the original `Triangle_mesh`, and deletion without
-      if (!node->is_root_node() && !destruction)
-      {
-        std::size_t entryEdgeIndex = get(m_halfedgeIndexMap, node->entry_edge());
-
-        if (m_vertexOccupiers[entryEdgeIndex].first == node)
-        {
-          m_vertexOccupiers[entryEdgeIndex].first = NULL;
-
-          std::size_t targetVertexIndex = get(m_vertexIndexMap, node->target_vertex());
-
-          if (m_closestToVertices[targetVertexIndex].first == node)
-          {
-            m_closestToVertices[targetVertexIndex].first = NULL;
-          }
-        }
-      }
-
-      delete node;
-    }
-
-    node_deleted();
-  }
-
-  void set_vertex_types()
-  {
-    vertex_iterator current, end;
-
-    for (boost::tie(current, end) = vertices(m_graph); current != end; ++current)
-    {
-      std::size_t vertexIndex = get(m_vertexIndexMap, *current);
-
-      if (is_saddle_vertex(*current) || is_boundary_vertex(*current))
-      {
-        m_vertexIsPseudoSource[vertexIndex] = true;
-      }
-      else
-      {
-        m_vertexIsPseudoSource[vertexIndex] = false;
-      }
-    }
-  }
-
-  bool is_saddle_vertex(vertex_descriptor v)
-  {
-    return m_traits.is_saddle_vertex_object()(v, m_graph, m_vertexPointMap);
-  }
-
-  bool is_boundary_vertex(vertex_descriptor v)
-  {
-    halfedge_descriptor h = halfedge(v, m_graph);
-    halfedge_descriptor first = h;
-
-    do
-    {
-      if (face(h, m_graph) == Graph_traits::null_face() || face(opposite(h, m_graph), m_graph) == Graph_traits::null_face())
-      {
-        return true;
-      }
-
-      h = opposite(next(h, m_graph), m_graph);
-    }
-    while(h != first);
-
-    return false;
-  }
-
-  void delete_all_nodes()
-  {
-    for (std::size_t i = 0; i < m_rootNodes.size(); ++i)
-    {
-      delete_node(m_rootNodes[i].first, true);
-    }
-  }
-
-  void reset_algorithm(bool clearFaceLocations = true)
-  {
-    Cone_tree_node* null_value=NULL;
-    m_closestToVertices.resize(num_vertices(m_graph));
-    std::fill(m_closestToVertices.begin(), m_closestToVertices.end(), Node_distance_pair(null_value, FT(0.0)));
-    m_vertexOccupiers.resize(num_halfedges(m_graph));
-    std::fill(m_vertexOccupiers.begin(), m_vertexOccupiers.end(), Node_distance_pair(null_value, FT(0.0)));
-
-    while (!m_expansionPriqueue.empty())
-    {
-      delete m_expansionPriqueue.top();
-      m_expansionPriqueue.pop();
-    }
-
-    if (clearFaceLocations)
-    {
-      m_faceLocations.clear();
-      m_firstNewSourcePoint = m_faceLocations.end();
-      m_deletedSourceLocations.clear();
-    }
-
-    delete_all_nodes();
-    m_rootNodes.clear();
-    m_vertexIsPseudoSource.resize(num_vertices(m_graph));
-
-#if !defined(NDEBUG)
-    m_currentNodeCount = 0;
-    m_peakNodeCount = 0;
-    m_queueAtPeakNodes = 0;
-    m_peakQueueSize = 0;
-    m_nodesAtPeakQueue = 0;
-#endif
-
-  }
-
-  template <class Visitor>
-  void visit_shortest_path(Cone_tree_node* startNode, const Point_2& startLocation, Visitor& visitor)
-  {
-    typename Traits::Compute_parametric_distance_along_segment_2 parametric_distance_along_segment_2(m_traits.compute_parametric_distance_along_segment_2_object());
-    typename Traits::Construct_ray_2 construct_ray_2(m_traits.construct_ray_2_object());
-    typename Traits::Construct_line_2 construct_line_2(m_traits.construct_line_2_object());
-    typename Traits::Construct_source_2 construct_source_2(m_traits.construct_source_2_object());
-    typename Traits::Construct_target_2 construct_target_2(m_traits.construct_target_2_object());
-    typename Traits::Intersect_2 intersect_2(m_traits.intersect_2_object());
-
-    typedef typename cpp11::result_of<typename Traits::Intersect_2 (Line_2, Line_2)>::type LineLineIntersectResult;
-
-    Cone_tree_node* current = startNode;
-    Point_2 currentLocation(startLocation);
-
-    while (!current->is_root_node())
-    {
-      switch (current->node_type())
-      {
-        case Cone_tree_node::INTERVAL:
-        case Cone_tree_node::EDGE_SOURCE:
-        {
-          Segment_2 entrySegment = current->entry_segment();
-          Ray_2 rayToLocation(construct_ray_2(current->source_image(), currentLocation));
-
-          LineLineIntersectResult cgalIntersection = intersect_2(construct_line_2(entrySegment), construct_line_2(rayToLocation));
-
-          CGAL_assertion(bool(cgalIntersection));
-
-          Point_2* result = boost::get<Point_2>(&*cgalIntersection);
-
-          CGAL_assertion(result && "Error, did not get point intersection on path walk to source");
-
-          FT t0 = parametric_distance_along_segment_2(construct_source_2(entrySegment), construct_target_2(entrySegment), *result);
-
-          if (m_debugOutput)
-          {
-            std::cout << "Current Node: " << current << " , Face = " << current->layout_face() << std::endl;
-            halfedge_descriptor he = current->entry_edge();
-            std::cout << "Face vertices: ";
-            for (std::size_t i = 0; i < 3; ++i)
-            {
-              std::cout << get(m_vertexIndexMap, source(he, m_graph)) << ",";
-              he = next(he, m_graph);
-            }
-            std::cout << std::endl;
-            std::cout << "Current Location: " << currentLocation << std::endl;
-            std::cout << "Distance: " << current->distance_to_root(currentLocation) << std::endl;
-            std::cout << "Inside cone: " << (current->inside_window(currentLocation) ? "Yes" : "No") << std::endl;
-            std::cout << "Current Source: " << current->source_image() << std::endl;
-            std::cout << "Current Segment: " << entrySegment << std::endl;
-            std::cout << "Current Left Window: " << current->window_left() << "  ,  " << m_traits.compute_parametric_distance_along_segment_2_object()(entrySegment.start(), entrySegment.end(), current->window_left()) << std::endl;
-            std::cout << "Current Right Window: " << current->window_right() << "  ,  " << m_traits.compute_parametric_distance_along_segment_2_object()(entrySegment.start(), entrySegment.end(), current->window_right()) << std::endl;
-            std::cout << "Current Segment Intersection: " << *result << std::endl;
-            std::cout << "Edge: (" << get(m_vertexIndexMap, source(current->entry_edge(), m_graph)) << "," << get(m_vertexIndexMap, target(current->entry_edge(), m_graph)) << ")  :  " << t0 << std::endl;
-          }
-
-          visitor(current->entry_edge(), t0);
-
-          currentLocation = *result;
-
-          current = current->parent();
-
-        }
-          break;
-        case Cone_tree_node::VERTEX_SOURCE:
-          visitor(target(current->entry_edge(), m_graph));
-          currentLocation = current->parent()->target_point();
-          current = current->parent();
-          break;
-        case Cone_tree_node::FACE_SOURCE:
-          // This is guaranteed to be the final node in any sequence
-          visitor(m_rootNodes[current->tree_id()].second->first, m_rootNodes[current->tree_id()].second->second);
-          current = current->parent();
-          break;
-        default:
-          CGAL_assertion(false && "Unhandled node type found in tree");
-      }
-    }
-  }
-
-  void add_to_face_list(Cone_tree_node* node)
-  {
-    if (!node->is_root_node() && !node->is_null_face())
-    {
-      std::size_t faceIndex = get(m_faceIndexMap, node->current_face());
-      m_faceOccupiers[faceIndex].push_back(node);
-    }
-
-    if (node->get_left_child() != NULL)
-    {
-      add_to_face_list(node->get_left_child());
-    }
-
-    if (node->get_right_child() != NULL)
-    {
-      add_to_face_list(node->get_right_child());
-    }
-
-    for (std::size_t i = 0; i < node->num_middle_children(); ++i)
-    {
-      add_to_face_list(node->get_middle_child(i));
-    }
-  }
-
-  Point_2 face_location_with_normalized_coordinate(Cone_tree_node* node, Barycentric_coordinate location)
-  {
-    return construct_barycenter_in_triangle_2(node->layout_face(), localized_coordiate(node, location));
-  }
-
-  Barycentric_coordinate localized_coordiate(Cone_tree_node* node, Barycentric_coordinate location)
-  {
-    return shifted_coordiate(location, node->edge_face_index());
-  }
-
-  Barycentric_coordinate shifted_coordiate(Barycentric_coordinate location, std::size_t shift)
-  {
-    typename Traits::Construct_barycentric_coordinate_weight cbcw(m_traits.construct_barycentric_coordinate_weight_object());
-    typename Traits::Construct_barycentric_coordinate cbc(m_traits.construct_barycentric_coordinate_object());
-    return cbc(cbcw(location, shift), cbcw(location, (shift + 1) % 3), cbcw(location, (shift + 2) % 3));
-  }
-
-  std::pair<Node_distance_pair, Barycentric_coordinate> nearest_on_face(face_descriptor f, Barycentric_coordinate location)
-  {
-    typename Traits::Construct_barycentric_coordinate cbc(m_traits.construct_barycentric_coordinate_object());
-
-    std::size_t faceIndex = get(m_faceIndexMap, f);
-
-    Cone_tree_node* closest = NULL;
-    FT closestDistance = 0;
-
-    std::vector<Cone_tree_node*>& currentFaceList = m_faceOccupiers[faceIndex];
-
-    for (std::size_t i = 0; i < currentFaceList.size(); ++i)
-    {
-      Cone_tree_node* current = currentFaceList[i];
-
-      if (closest != NULL && current->distance_from_source_to_root() >= closestDistance)
-      {
-        continue;
-      }
-
-      Point_2 locationInContext = face_location_with_normalized_coordinate(current, location);
-
-      if (current->inside_window(locationInContext))
-      {
-        FT currentDistance = current->distance_to_root(locationInContext);
-
-        if (closest == NULL || currentDistance < closestDistance)
-        {
-          closest = current;
-          closestDistance = currentDistance;
-        }
-      }
-    }
-
-    if (closest)
-    {
-      return std::make_pair(Node_distance_pair(closest, closestDistance), localized_coordiate(closest, location));
-    }
-    else
-    {
-      return std::make_pair(Node_distance_pair((Cone_tree_node*)NULL, FT(0.0)), cbc(FT(0.0), FT(0.0), FT(0.0)));
-    }
-  }
-
-  std::pair<Node_distance_pair, Barycentric_coordinate> nearest_to_location(face_descriptor f, Barycentric_coordinate location)
-  {
-    typename Traits::Construct_barycentric_coordinate_weight cbcw(m_traits.construct_barycentric_coordinate_weight_object());
-    typename Traits::Construct_barycentric_coordinate cbc(m_traits.construct_barycentric_coordinate_object());
-    typename Traits::Classify_barycentric_coordinate classify_barycentric_coordinate(m_traits.classify_barycentric_coordinate_object());
-
-    std::size_t associatedEdge;
-    CGAL::Surface_mesh_shortest_paths_3::Barycentric_coordinate_type type;
-    boost::tie(type, associatedEdge) = classify_barycentric_coordinate(location);
-
-    switch (type)
-    {
-      case CGAL::Surface_mesh_shortest_paths_3::BARYCENTRIC_COORDINATE_ON_BOUNDED_SIDE:
-        return nearest_on_face(f, location);
-      case CGAL::Surface_mesh_shortest_paths_3::BARYCENTRIC_COORDINATE_ON_BOUNDARY:
-        {
-          halfedge_descriptor he = halfedge(f, m_graph);
-          for (std::size_t i = 0; i < associatedEdge; ++i)
-          {
-            he = next(he, m_graph);
-          }
-
-          halfedge_descriptor oppositeHalfedge = opposite(he, m_graph);
-
-          std::size_t oppositeIndex = internal::edge_index(oppositeHalfedge, m_graph);
-
-          FT oppositeLocationCoords[3] = { FT(0.0), FT(0.0), FT(0.0) };
-
-          oppositeLocationCoords[oppositeIndex] = cbcw(location, (associatedEdge + 1) % 3);
-          oppositeLocationCoords[(oppositeIndex + 1) % 3] = cbcw(location, associatedEdge);
-
-          std::pair<Node_distance_pair,Barycentric_coordinate> mainFace = nearest_on_face(f, location);
-          Barycentric_coordinate oppositeLocation(cbc(oppositeLocationCoords[0], oppositeLocationCoords[1], oppositeLocationCoords[2]));
-          std::pair<Node_distance_pair,Barycentric_coordinate> otherFace = nearest_on_face(face(oppositeHalfedge, m_graph), oppositeLocation);
-
-          if (mainFace.first.first == NULL)
-          {
-            return otherFace;
-          }
-          else if (otherFace.first.first == NULL)
-          {
-            return mainFace;
-          }
-          else
-          {
-            return mainFace.first.second < otherFace.first.second ? mainFace : otherFace;
-          }
-        }
-        break;
-      case CGAL::Surface_mesh_shortest_paths_3::BARYCENTRIC_COORDINATE_ON_VERTEX:
-        {
-          halfedge_descriptor he = halfedge(f, m_graph);
-
-          for (std::size_t i = 0; i < associatedEdge; ++i)
-          {
-            he = next(he, m_graph);
-          }
-
-          vertex_descriptor vertex = source(he, m_graph);
-
-          return std::make_pair(m_closestToVertices[get(m_vertexIndexMap, vertex)], cbc(FT(0.0), FT(0.0), FT(1.0)));
-        }
-        break;
-
-      default:
-        CGAL_assertion(false && "Invalid face location");
-        return std::pair<Node_distance_pair, Barycentric_coordinate>();
-    }
-  }
-
-  static bool cone_comparator(const Cone_tree_node* lhs, const Cone_tree_node* rhs)
-  {
-    return lhs->distance_from_source_to_root() < rhs->distance_from_source_to_root();
-  }
-
-  template <class InputIterator>
-  Source_point_iterator add_source_points_internal(InputIterator begin, InputIterator end, vertex_descriptor)
-  {
-    Source_point_iterator firstAdded;
-
-    for (InputIterator it = begin; it != end; ++it)
-    {
-      Source_point_iterator added = add_source_point(face_location(*it));
-
-      if (it == begin)
-      {
-        firstAdded = added;
-      }
-    }
-
-    return firstAdded;
-  }
-
-  template <class InputIterator>
-  Source_point_iterator add_source_points_internal(InputIterator begin, InputIterator end, Face_location)
-  {
-    Source_point_iterator firstAdded;
-
-    for (InputIterator it = begin; it != end; ++it)
-    {
-      Source_point_iterator added = add_source_point(it->first, it->second);
-
-      if (it == begin)
-      {
-        firstAdded = added;
-      }
-    }
-
-    return firstAdded;
-  }
-
-  void construct_sequence_tree_internal()
-  {
-    reset_algorithm(false);
-    set_vertex_types();
-
-    m_vertexOccupiers.resize(num_halfedges(m_graph));
-    m_closestToVertices.resize(num_vertices(m_graph));
-
-    if (m_debugOutput)
-    {
-      vertex_iterator current, end;
-
-      std::size_t numVertices = 0;
-
-      for (boost::tie(current,end) = vertices(m_graph); current != end; ++current)
-      {
-        std::cout << "Vertex#" << numVertices << ": p = " << get(m_vertexPointMap,*current) << " , Saddle Vertex: " << (is_saddle_vertex(*current) ? "yes" : "no") << " , Boundary Vertex: " << (is_boundary_vertex(*current) ? "yes" : "no") << std::endl;
-        ++numVertices;
-      }
-    }
-
-    face_iterator facesCurrent;
-    face_iterator facesEnd;
-
-    if (m_debugOutput)
-    {
-      std::size_t numFaces = 0;
-
-      for (boost::tie(facesCurrent, facesEnd) = faces(m_graph); facesCurrent != facesEnd; ++facesCurrent)
-      {
-        std::cout << "Face#" << numFaces << ": Vertices = (";
-        ++numFaces;
-        halfedge_descriptor faceEdgesStart = halfedge(*facesCurrent, m_graph);
-        halfedge_descriptor faceEdgesCurrent = faceEdgesStart;
-
-        do
-        {
-          std::cout << get(m_vertexIndexMap, source(faceEdgesCurrent, m_graph));
-
-          faceEdgesCurrent = next(faceEdgesCurrent, m_graph);
-
-          if (faceEdgesCurrent != faceEdgesStart)
-          {
-            std::cout << ", ";
-          }
-          else
-          {
-            std::cout << ")";
-          }
-        }
-        while (faceEdgesCurrent != faceEdgesStart);
-
-        std::cout << std::endl;
-      }
-
-    }
-
-    for (typename Source_point_list::iterator it = m_faceLocations.begin(); it != m_faceLocations.end(); ++it)
-    {
-      if (m_debugOutput)
-      {
-        std::cout << "Root: " << get(m_faceIndexMap, it->first) << " , " << it->second[0] << " " << it->second[1] << " " << it->second[2] << " " << std::endl;
-      }
-
-      expand_root(it->first, it->second, Source_point_iterator(it));
-    }
-
-    if (m_debugOutput)
-    {
-      std::cout << "PriQ start size = " << m_expansionPriqueue.size() << std::endl;
-
-      std::cout << "Num face locations: " << m_faceLocations.size() << std::endl;
-      std::cout << "Num root nodes: " << m_rootNodes.size() << " (Hint: these should be the same size)" << std::endl;
-
-    }
-
-    while (m_expansionPriqueue.size() > 0)
-    {
-      Cone_expansion_event* event = m_expansionPriqueue.top();
-      m_expansionPriqueue.pop();
-
-      if (!event->m_cancelled)
-      {
-        typename Cone_expansion_event::Expansion_type type = event->m_type;
-        Cone_tree_node* parent = event->m_parent;
-
-        switch (type)
-        {
-          case Cone_expansion_event::PSEUDO_SOURCE:
-            if (m_debugOutput)
-            {
-              std::cout << "PseudoSource Expansion: Parent = " << parent << " , Vertex = " << get(m_vertexIndexMap, event->m_parent->target_vertex()) << " , Distance = " << event->m_distanceEstimate << " , Level = " << event->m_parent->level() + 1 << std::endl;
-            }
-
-            expand_pseudo_source(parent);
-            break;
-          case Cone_expansion_event::LEFT_CHILD:
-            if (m_debugOutput)
-            {
-              std::cout << "Left Expansion: Parent = " << parent << " Edge = (" << get(m_vertexIndexMap, source(event->m_parent->left_child_edge(), m_graph)) << "," << get(m_vertexIndexMap, target(event->m_parent->left_child_edge(), m_graph)) << ") , Distance = " << event->m_distanceEstimate << " , Level = " << event->m_parent->level() + 1 << std::endl;
-            }
-
-            expand_left_child(parent, event->m_windowSegment);
-            break;
-          case Cone_expansion_event::RIGHT_CHILD:
-            if (m_debugOutput)
-            {
-              std::cout << "Right Expansion: Parent = " << parent << " , Edge = (" << get(m_vertexIndexMap, source(event->m_parent->right_child_edge(), m_graph)) << "," << get(m_vertexIndexMap, target(event->m_parent->right_child_edge(), m_graph)) << ") , Distance = " << event->m_distanceEstimate << " , Level = " << event->m_parent->level() + 1 << std::endl;
-            }
-
-            expand_right_child(parent, event->m_windowSegment);
-            break;
-        }
-      }
-      else if (m_debugOutput)
-      {
-        std::cout << "Found cancelled event for node: " << event->m_parent << std::endl;
-      }
-
-      delete event;
-    }
-
-    m_faceOccupiers.clear();
-    m_faceOccupiers.resize(num_faces(m_graph));
-
-    for (std::size_t i = 0; i < m_rootNodes.size(); ++i)
-    {
-      add_to_face_list(m_rootNodes[i].first);
-    }
-
-    for (std::size_t i = 0; i < m_faceOccupiers.size(); ++i)
-    {
-      std::vector<Cone_tree_node*>& currentFaceList = m_faceOccupiers[i];
-      std::sort(currentFaceList.begin(), currentFaceList.end(), cone_comparator);
-    }
-
-    if (m_debugOutput)
-    {
-      std::cout << "Closest distances: " << std::endl;
-
-      for (std::size_t i = 0; i < m_closestToVertices.size(); ++i)
-      {
-        std::cout << "\tVertex = " << i << std::endl;
-        std::cout << "\tDistance = " << m_closestToVertices[i].second << std::endl;
-      }
-
-      std::cout << std::endl;
-
-      for (std::size_t i = 0; i < m_faceOccupiers.size(); ++i)
-      {
-        std::cout << "\tFace = " << i << std::endl;
-        std::cout << "\t#Occupiers = " << m_faceOccupiers[i].size() << std::endl;
-      }
-
-      std::cout << std::endl << "Done!" << std::endl;
-    }
-
-    m_firstNewSourcePoint = m_faceLocations.end();
-    m_deletedSourceLocations.clear();
-
-  }
-
-public:
-
-  /// \name Constructors
-  /// @{
-
-  /*!
-  \brief Creates a shortest paths object using `g` as input.
-
-  Equivalent to `Surface_mesh_shortest_path(g, get(boost::vertex_index, g), get(boost::halfedge_index, g), get(boost::face_index, g), get(CGAL::vertex_point, g), traits)`.
-  */
-  Surface_mesh_shortest_path(Triangle_mesh& g, const Traits& traits = Traits())
-    : m_traits(traits)
-    , m_graph(g)
-    , m_vertexIndexMap(get(boost::vertex_index, g))
-    , m_halfedgeIndexMap(get(boost::halfedge_index, g))
-    , m_faceIndexMap(get(boost::face_index, g))
-    , m_vertexPointMap(get(CGAL::vertex_point, g))
-    , m_debugOutput(false)
-  {
-    reset_algorithm();
-  }
-
-  /*!
-  \brief Creates a shortest paths object using `g` as input.
-
-  \details No copy of the `Triangle_mesh` is made, only a reference to the `g` is held.
-
-  \param g The surface mesh to compute shortest paths on.  Note that it must be triangulated.
-
-  \param vertexIndexMap Property map associating an id to each vertex, from 0 to `num_vertices(g) - 1`.
-
-  \param halfedgeIndexMap Property map associating an id to each halfedge, from 0 to `num_halfedges(g) - 1`.
-
-  \param faceIndexMap Property map associating an id to each face, from 0 to `num_faces(g) - 1`.
-
-  \param vertexPointMap Property map used to access the points associated to each vertex of the graph.
-
-  \param traits Optional instance of the traits class to use.
-  */
-  Surface_mesh_shortest_path(Triangle_mesh& g, Vertex_index_map vertexIndexMap, Halfedge_index_map halfedgeIndexMap, Face_index_map faceIndexMap, Vertex_point_map vertexPointMap, const Traits& traits = Traits())
-    : m_traits(traits)
-    , m_graph(g)
-    , m_vertexIndexMap(vertexIndexMap)
-    , m_halfedgeIndexMap(halfedgeIndexMap)
-    , m_faceIndexMap(faceIndexMap)
-    , m_vertexPointMap(vertexPointMap)
-    , m_debugOutput(false)
-  {
-    reset_algorithm();
-  }
-
-  /// @}
-
-  /// \cond
-
-  ~Surface_mesh_shortest_path()
-  {
-    delete_all_nodes();
-
-#if !defined(NDEBUG)
-    if (m_debugOutput)
-    {
-      std::cout << "Final node count: " << m_currentNodeCount << std::endl;
-    }
-    return;
-    CGAL_assertion(m_currentNodeCount == 0);
-#endif
-  }
-
-  /// \endcond
-
-  /// \name Addition and Removal of Source Points
-  /// @{
-
-  /*!
-  \brief Adds `v` as a source for the shortest path queries.
-
-  \details No change to the internal shortest paths data structure occurs
-  until either `Surface_mesh_shortest_path::build_sequence_tree()` or
-  the first shortest path query is done.
-
-  \return An iterator to the source point added
-  */
-  Source_point_iterator add_source_point(vertex_descriptor v)
-  {
-    Face_location location = face_location(v);
-    return add_source_point(location);
-  }
-
-  /*!
-  \brief Adds a point inside the face `f` as a source for the shortest path queries.
-
-  \details No change to the internal shortest paths data structure occurs
-  until either `Surface_mesh_shortest_path::build_sequence_tree()` or
-  the first shortest path query is done.
-
-  \param f A face of the input face graph
-  \param location Barycentric coordinate in face `f` specifying the source point.
-  \return An iterator to the source point added
-  */
-  Source_point_iterator add_source_point(face_descriptor f, Barycentric_coordinate location)
-  {
-    return add_source_point(std::make_pair(f, location));
-  }
-
-  /*!
-  \brief Adds a point inside a face as a source for the shortest path queries,
-  equivalent to `Surface_mesh_shortest_path::add_source_point(location.first, location.second);`
-  */
-  Source_point_iterator add_source_point(Face_location location)
-  {
-    Source_point_underlying_iterator added = m_faceLocations.insert(m_faceLocations.end(), location);
-
-    if (m_firstNewSourcePoint == m_faceLocations.end())
-    {
-      m_firstNewSourcePoint = added;
-    }
-
-    return Source_point_iterator(added);
-  }
-
-  /*!
-  \brief Adds a range of points as sources for the shortest path queries.
-
-  \details No change to the internal shortest paths data structure occurs
-  until either `Surface_mesh_shortest_path::build_sequence_tree()` or
-  the first shortest path query is done.
-
-  \tparam InputIterator A `ForwardIterator` which dereferences to either `Surface_mesh_shortest_path::Face_location`, or `Surface_mesh_shortest_path::vertex_descriptor`.
-
-  \param begin iterator to the first in the list of source point locations.
-  \param end iterator to one past the end of the list of source point locations.
-  \return An iterator to the first source point added.
-  */
-  template <class InputIterator>
-  Source_point_iterator add_source_points(InputIterator begin, InputIterator end)
-  {
-    return add_source_points_internal(begin, end, typename std::iterator_traits<InputIterator>::value_type());
-  }
-
-  /*!
-  \brief Removes a source point for the shortest path queries.
-
-  \details No change to the internal shortest paths data structure occurs
-  until either `Surface_mesh_shortest_path::build_sequence_tree()` or
-  the first shortest path query is done.
-  Behaviour is undefined if the source point `it` was already removed.
-
-  \param it iterator to the source point to be removed
-  */
-  void remove_source_point(Source_point_iterator it)
-  {
-    if (it == m_firstNewSourcePoint)
-    {
-      ++m_firstNewSourcePoint;
-    }
-
-    m_deletedSourceLocations.splice(m_deletedSourceLocations.begin(), m_faceLocations, it.m_iterator);
-  }
-
-  /*!
-  \brief Removes all source points for the shortest path queries.
-
-  \details No change to the internal shortest paths data structure occurs
-  until either `Surface_mesh_shortest_path::build_sequence_tree()` or
-  the first shortest path query is done.
-  For a version which deletes all data immediately, use `clear()` instead.
-  */
-  void remove_all_source_points()
-  {
-    m_deletedSourceLocations.splice(m_deletedSourceLocations.begin(), m_faceLocations, m_faceLocations.begin(), m_faceLocations.end());
-    m_firstNewSourcePoint = m_faceLocations.end();
-  }
-
-  /// @}
-
-  /// \name Creation and Destruction of the Shortest Paths Sequence Tree
-  /// @{
-
-  /*!
-  \brief Computes all pending changes to the internal sequence tree
-
-  \details A call to this method will only trigger a computation only if some
-  change to the set of source points occurred since the last time
-  the sequence tree was computed.
-  */
-  void build_sequence_tree()
-  {
-    if (changed_since_last_build())
-    {
-      construct_sequence_tree_internal();
-    }
-  }
-
-  /*!
-  \brief Removes all data, the class is as if it was constructed.
-
-  \details All internal containers are cleared  and the internal
-  sequence tree is also cleared.  For a version which defers deletion until
-  it is necessary, use `Surface_mesh_shortest_path::remove_all_source_points()`.
-  */
-  void clear()
-  {
-    reset_algorithm();
-  }
-
-  /// @}
-
-  /// \name Accessors
-  /// @{
-
-  /*!
-  \brief Returns an iterator to the first source point location
-
-  \details The elements will appear in the order they were inserted to the
-  structure by calls to `add_source_point()` or `add_source_points()`.  Deleted
-  points will not appear in the sequence.
-
-  \return An iterator to the first of the stored source points.
-  */
-  Source_point_iterator source_points_begin() const
-  {
-    // It is a feature of C++11 that `const_iterator` may be used in calls to `erase()`, however
-    // in order to support C++98, we must use `iterator`.  Semantically, this is correct, but
-    // I must cast away the const-ness to hide the internal uglyness
-    return Source_point_iterator(const_cast<std::list<Face_location>&>(m_faceLocations).begin());
-  }
-
-  /*!
-  \brief Returns an iterator to one past the last source point location
-
-  \return An iterator to one past-the-end in the list of stored source points.
-  */
-  Source_point_iterator source_points_end() const
-  {
-    return Source_point_iterator(const_cast<std::list<Face_location>&>(m_faceLocations).end());
-  }
-
-  /*!
-  \brief Returns the total number of source points used for the shortest path queries.
-  */
-  std::size_t number_of_source_points() const
-  {
-    return m_faceLocations.size();
-  }
-
-  /*!
-  \brief Determines if the internal sequence tree is valid (already built and no new source point has been added).
-
-  \return true if the structure needs to be rebuilt, false otherwise
-  */
-  bool changed_since_last_build() const
-  {
-    return m_firstNewSourcePoint != m_faceLocations.end() || !m_deletedSourceLocations.empty();
-  }
-
-  /// @}
-
-  /// \name Shortest Distance Queries
-  /// @{
-
-  /*!
-  \brief Computes the shortest surface distance from a vertex to any source point
-
-  \param v A vertex of the input face graph
-  \return A pair, containing the distance to the source point, and an
-    iterator to the source point.  If no source point was reachable (can
-    occur when the graph is disconnected), the distance will be a negative
-    value and the source point iterator will be equal to `source_points_end()`.
-  */
-  Shortest_path_result shortest_distance_to_source_points(vertex_descriptor v)
-  {
-    build_sequence_tree();
-
-    Node_distance_pair result = m_closestToVertices[get(m_vertexIndexMap, v)];
-
-    Cone_tree_node* current = result.first;
-
-    if (current)
-    {
-      return std::make_pair(result.second, m_rootNodes[current->tree_id()].second);
-    }
-    else
-    {
-      return std::make_pair(FT(-1.0), source_points_end());
-    }
-  }
-
-  /*!
-  \brief Computes the shortest surface distance from any surface location to any source point
-
-  \param f A face of the input face graph
-  \param location Barycentric coordinate of the query point on face `f`
-  \return A pair, containing the distance to the source point, and an
-    iterator to the source point.  If no source point was reachable (can
-    occur when the graph is disconnected), the distance will be a negative
-    value and the source point iterator will be equal to `source_points_end()`.
-  */
-  Shortest_path_result shortest_distance_to_source_points(face_descriptor f, Barycentric_coordinate location)
-  {
-    build_sequence_tree();
-
-    std::pair<Node_distance_pair, Barycentric_coordinate> result = nearest_to_location(f, location);
-
-    Cone_tree_node* current = result.first.first;
-
-    if (current)
-    {
-      return std::make_pair(result.first.second, m_rootNodes[current->tree_id()].second);
-    }
-    else
-    {
-      return std::make_pair(FT(-1.0), source_points_end());
-    }
-  }
-
-  /// @}
-
-  /// \name Shortest Path Sequence Queries
-  /// @{
-
-  /*!
-  \brief Visits the sequence of edges, vertices and faces traversed by the shortest path
-  from a vertex to any source point.
-
-  \details Visits simplices, starting from the query vertex, back to
-  the nearest source point. If no shortest path could be found (for example,
-  the surface is disconnected), then no calls to the visitor will be made
-  (not even for the query vertex).
-
-  \param v A vertex of the input face graph
-  \param visitor A model of `SurfaceMeshShortestPathVisitor` to receive the shortest path
-  \return A pair, containing the distance to the source point, and an
-    iterator to the source point.  If no source point was reachable (can
-    occur when the graph is disconnected), the distance will be a negative
-    value and the source point iterator will be equal to `source_points_end()`.
-  */
-  template <class Visitor>
-  Shortest_path_result
-  shortest_path_sequence_to_source_points(vertex_descriptor v, Visitor& visitor)
-  {
-    build_sequence_tree();
-
-    Node_distance_pair result = m_closestToVertices[get(m_vertexIndexMap, v)];
-    Cone_tree_node* current = result.first;
-
-    if (current)
-    {
-      visitor(v);
-      visit_shortest_path(current, current->target_point(), visitor);
-      return std::make_pair(result.second, m_rootNodes[current->tree_id()].second);
-    }
-    else
-    {
-      return std::make_pair(FT(-1.0), source_points_end());
-    }
-  }
-
-  /*!
-  \brief Visits the sequence of edges, vertices and faces traversed by the shortest path
-  from any surface location to any source point.
-
-  \details Visits simplices, starting from the query point, back to
-  the nearest source point. If no shortest path could be found (for example,
-  the surface is disconnected), then no calls to the visitor will be made
-  (not even for the query point).
-
-  \param f A face of the input face graph
-  \param location Barycentric coordinate of the query point on face `f`
-  \param visitor A model of `SurfaceMeshShortestPathVisitor` to receive the shortest path
-  \return A pair, containing the distance to the source point, and an
-    iterator to the source point.  If no source point was reachable (can
-    occur when the graph is disconnected), the distance will be a negative
-    value and the source point iterator will be equal to `source_points_end()`.
-  */
-  template <class Visitor>
-  Shortest_path_result
-  shortest_path_sequence_to_source_points(face_descriptor f, Barycentric_coordinate location, Visitor& visitor)
-  {
-    build_sequence_tree();
-
-    std::pair<Node_distance_pair, Barycentric_coordinate> result = nearest_to_location(f, location);
-    Cone_tree_node* current = result.first.first;
-
-    if (current)
-    {
-      Point_2 locationInContext = construct_barycenter_in_triangle_2(current->layout_face(), result.second);
-      visitor(f, location);
-      visit_shortest_path(current, locationInContext, visitor);
-      return std::make_pair(result.first.second, m_rootNodes[current->tree_id()].second);
-    }
-    else
-    {
-      return std::make_pair(FT(-1.0), source_points_end());
-    }
-  }
-
-  /// @}
-
-  /// \name Shortest Path Point Queries
-  /// @{
-
-  /*!
-  \brief Computes the sequence of points in the shortest path along the
-    surface of the input face graph from the given vertex to the closest
-    source point.
-
-  \param v A vertex of the input face graph
-  \param output An OutputIterator to receive the shortest path points as `Point_3` objects
-  \return A pair, containing the distance to the source point, and an
-    iterator to the source point.  If no source point was reachable (can
-    occur when the graph is disconnected), the distance will be a negative
-    value and the source point iterator will be equal to `source_points_end()`.
-  */
-  template <class OutputIterator>
-  Shortest_path_result
-  shortest_path_points_to_source_points(vertex_descriptor v, OutputIterator output)
-  {
-    build_sequence_tree();
-
-    Point_path_visitor_wrapper<OutputIterator> wrapper(*this, output);
-    return shortest_path_sequence_to_source_points(v, wrapper);
-  }
-
-  /*!
-  \brief Computes the sequence of points in the shortest path along the
-    surface of the input face graph from the given query location to the closest
-    source point.
-
-  \param f A face of on the input face graph
-  \param location The barycentric coordinate of the query point on face `f`
-  \param output An OutputIterator to receive the shortest path points as `Point_3` objects
-  \return A pair, containing the distance to the source point, and an
-    iterator to the source point.  If no source point was reachable (can
-    occur when the graph is disconnected), the distance will be a negative
-    value and the source point iterator will be equal to `source_points_end()`.
-  */
-  template <class OutputIterator>
-  Shortest_path_result
-  shortest_path_points_to_source_points(face_descriptor f, Barycentric_coordinate location, OutputIterator output)
-  {
-    build_sequence_tree();
-
-    Point_path_visitor_wrapper<OutputIterator> wrapper(*this, output);
-    return shortest_path_sequence_to_source_points(f, location, wrapper);
-  }
-
-  /// @}
-
-  /// \name Surface Point Constructions
-  /// @{
-
-  /*!
-  \brief Returns the 3-dimensional coordinate at the barycentric coordinate
-    of the given face.
-
-  \details The following static overloads are also available:
-    - `static Point_3 point(face_descriptor f, Barycentric_coordinate location, const Triangle_mesh& g, const Traits& traits = Traits())`
-    - `static Point_3 point(face_descriptor f, Barycentric_coordinate location, const Triangle_mesh& g, Vertex_point_map vertexPointMap, const Traits& traits = Traits())`
-
-  \param f A face of on the input face graph
-  \param location The barycentric coordinate of the query point on face `f`
-  */
-  Point_3 point(face_descriptor f, Barycentric_coordinate location) const
-  {
-    return point(f, location, m_graph, m_vertexPointMap, m_traits);
-  }
-
-  /// \cond
-
-  static Point_3 point(face_descriptor f, Barycentric_coordinate location, const Triangle_mesh& g, const Traits& traits = Traits())
-  {
-    return point(f, location, g, CGAL::get(CGAL::vertex_point, g), traits);
-  }
-
-  static Point_3 point(face_descriptor f, Barycentric_coordinate location, const Triangle_mesh& g, Vertex_point_map vertexPointMap, const Traits& traits = Traits())
-  {
-    return construct_barycenter_in_triangle_3(triangle_from_face(f, g, vertexPointMap), location, traits);
-  }
-
-  /// \endcond
-
-  /*!
-  \brief Returns the 3-dimensional coordinate at the parametric location
-    along the given edge.
-
-  \details The following static overloads are also available:
-    - `static Point_3 point(halfedge_descriptor edge, FT t, const Triangle_mesh& g, const Traits& traits = Traits())`
-    - `static Point_3 point(halfedge_descriptor edge, FT t, const Triangle_mesh& g, Vertex_point_map vertexPointMap, const Traits& traits = Traits())`
-
-  \param edge An edge of the input face graph
-  \param t The parametric distance along edge of the desired point
-  */
-  Point_3 point(halfedge_descriptor edge, FT t) const
-  {
-    return point(edge, t, m_graph, m_vertexPointMap, m_traits);
-  }
-
-  /// \cond
-
-  static Point_3 point(halfedge_descriptor edge, FT t, const Triangle_mesh& g, const Traits& traits = Traits())
-  {
-    return point(edge, t, g, CGAL::get(CGAL::vertex_point, g), traits);
-  }
-
-  static Point_3 point(halfedge_descriptor edge, FT t, const Triangle_mesh& g, Vertex_point_map vertexPointMap, const Traits& traits = Traits())
-  {
-    typename Traits::Construct_barycenter_3 construct_barycenter_3(traits.construct_barycenter_3_object());
-
-    // Note: the parameter t is meant to be the weighted coordinate on the _endpoint_ (i.e. target) of the segment
-    return construct_barycenter_3(get(vertexPointMap, target(edge, g)), t, get(vertexPointMap, source(edge, g)));
-  }
-
-  /// \endcond
-
-  /*!
-  \brief Returns the 3-dimensional coordinate of the given vertex.
-
-  \param vertex A vertex of the input face graph
-  */
-  Point_3 point(vertex_descriptor vertex) const
-  {
-    return get(m_vertexPointMap, vertex);
-  }
-
-  /// @}
-
-  /// \name Surface Face Location Constructions
-  /// @{
-
-  /*!
-  \brief Returns the location of the given vertex as a `Face_location`
-
-  \details The following static overload is also available:
-    - `static Face_location face_location(vertex_descriptor vertex, const Triangle_mesh& g, const Traits& traits = Traits())`
-
-  \param vertex A vertex of the input face graph
-  */
-  Face_location face_location(vertex_descriptor vertex) const
-  {
-    return face_location(vertex, m_graph, m_traits);
-  }
-
-  /// \cond
-
-  static Face_location face_location(vertex_descriptor vertex, const Triangle_mesh& g, const Traits& traits = Traits())
-  {
-    typename Traits::Construct_barycentric_coordinate construct_barycentric_coordinate(traits.construct_barycentric_coordinate_object());
-    halfedge_descriptor he = next(halfedge(vertex, g), g);
-    face_descriptor locationFace = face(he, g);
-    std::size_t edgeIndex = CGAL::internal::edge_index(he, g);
-
-    FT coords[3] = { FT(0.0), FT(0.0), FT(0.0) };
-
-    coords[edgeIndex] = FT(1.0);
-
-    return Face_location(locationFace, construct_barycentric_coordinate(coords[0], coords[1], coords[2]));
-  }
-
-  /// \endcond
-
-  /*!
-  \brief Returns a location along the given edge as a `Face_location`.
-
-  \details The following static overload is also available:
-    - `static Face_location face_location(halfedge_descriptor he, FT t, const Triangle_mesh& g, const Traits& traits = Traits())`
-
-  \param he A halfedge of the input face graph
-  \param t Parametric distance of the desired point along `he`
-  */
-  Face_location face_location(halfedge_descriptor he, FT t) const
-  {
-    return face_location(he, t, m_graph, m_traits);
-  }
-
-  /// \cond
-
-  static Face_location face_location(halfedge_descriptor he, FT t, const Triangle_mesh& g, const Traits& traits = Traits())
-  {
-    typename Traits::Construct_barycentric_coordinate cbc(traits.construct_barycentric_coordinate_object());
-    face_descriptor locationFace = face(he, g);
-    std::size_t edgeIndex = CGAL::internal::edge_index(he, g);
-
-    const FT oneMinusT(FT(1.0) - t);
-
-    FT coords[3] = { FT(0.0), FT(0.0), FT(0.0) };
-
-    coords[edgeIndex] = oneMinusT;
-    coords[(edgeIndex + 1) % 3] = t;
-
-    return Face_location(locationFace, cbc(coords[0], coords[1], coords[2]));
-  }
-
-  /// \endcond
-
-  /// @}
-
-  /// \name Nearest Face Location Queries
-  /// @{
-
-  /*
-  \brief Returns the nearest face location to the given point.
-    Note that this will (re-)build an `AABB_tree` on each call. If you need
-    to  call this function more than once, use `build_aabb_tree()` to cache a
-    copy of the `AABB_tree`, and use the overloads of this function
-    that accept a reference to an `AABB_tree` as input.
-
-  \details The following static overload is also available:
-    - `static Face_location locate(const Point_3& p, const Triangle_mesh& g, Vertex_point_map vertexPointMap, const Traits& traits = Traits())`
-
-  \tparam AABBTraits A model of `AABBTraits` used to define a \cgal `AABB_tree`.
-
-  \param p Point to locate on the input face graph
-  */
-  template <class AABBTraits>
-  Face_location locate(const Point_3& p) const
-  {
-    return locate<AABBTraits>(p, m_graph, m_vertexPointMap, m_traits);
-  }
-
-  /// \cond
-
-  template <class AABBTraits>
-  static Face_location locate(const Point_3& location, const Triangle_mesh& g, Vertex_point_map vertexPointMap, const Traits& traits = Traits())
-  {
-    AABB_tree<AABBTraits> tree;
-    build_aabb_tree(g, tree);
-    return locate(location, tree, g, vertexPointMap, traits);
-  }
-
-  /// \endcond
-
-  /*!
-  \brief Returns the face location nearest to the given point.
-
-  \details The following static overload is also available:
-    - static Face_location locate(const Point_3& p, const AABB_tree<AABBTraits>& tree, const Triangle_mesh& g, Vertex_point_map vertexPointMap, const Traits& traits = Traits())
-
-  \tparam AABBTraits A model of `AABBTraits` used to define a \cgal `AABB_tree`.
-
-  \param p Point to locate on the input face graph
-  \param tree A `AABB_tree` containing the triangular faces of the input surface mesh to perform the point location with
-  */
-  template <class AABBTraits>
-  Face_location locate(const Point_3& p, const AABB_tree<AABBTraits>& tree) const
-  {
-    return locate(p, tree, m_graph, m_vertexPointMap, m_traits);
-  }
-
-  /// \cond
-
-  template <class AABBTraits>
-  static Face_location locate(const Point_3& location, const AABB_tree<AABBTraits>& tree, const Triangle_mesh& g, Vertex_point_map vertexPointMap, const Traits& traits = Traits())
-  {
-    typename Traits::Construct_barycentric_coordinate_in_triangle_3 cbcit3(traits.construct_barycentric_coordinate_in_triangle_3_object());
-    typename AABB_tree<AABBTraits>::Point_and_primitive_id result = tree.closest_point_and_primitive(location);
-
-    face_descriptor f = result.second;
-    Barycentric_coordinate b = cbcit3(triangle_from_face(f, g, vertexPointMap), result.first);
-    return Face_location(f, b);
-  }
-
-  /// \endcond
-
-  /*
-  \brief Returns the face location along `ray` nearest to its source point.
-    Note that this will (re-)build an `AABB_tree` on each call. If you need
-    to  call this function more than once, use `build_aabb_tree()` to cache a
-    copy of the `AABB_tree`, and use the overloads of this function
-    that accept a reference to an `AABB_tree` as input.
-
-  \details The following static overload is also available:
-    - `static Face_location locate(const Ray_3& ray, const Triangle_mesh& g, Vertex_point_map vertexPointMap, const Traits& traits = Traits())`
-
-  \tparam AABBTraits A model of `AABBTraits` used to define an `AABB_tree`.
-
-  \param ray Ray to intersect with the input face graph
-  */
-  template <class AABBTraits>
-  Face_location locate(const Ray_3& ray) const
-  {
-    return locate<AABBTraits>(ray, m_graph, m_vertexPointMap, m_traits);
-  }
-
-  /// \cond
-
-  template <class AABBTraits>
-  static Face_location locate(const Ray_3& ray, const Triangle_mesh& g, Vertex_point_map vertexPointMap, const Traits& traits = Traits())
-  {
-    AABB_tree<AABBTraits> tree;
-    build_aabb_tree(g, tree);
-    return locate(ray, tree, g, vertexPointMap, traits);
-  }
-
-  /// \endcond
-
-  /*!
-  \brief Returns the face location along `ray` nearest to
-    its source point.
-
-  \details The following static overload is also available:
-    - static Face_location locate(const Ray_3& ray, const AABB_tree<AABBTraits>& tree, const Triangle_mesh& g, Vertex_point_map vertexPointMap, const Traits& traits = Traits())
-
-  \tparam AABBTraits A model of `AABBTraits` used to define a \cgal `AABB_tree`.
-
-  \param ray Ray to intersect with the input face graph
-  \param tree A `AABB_tree` containing the triangular faces of the input surface mesh to perform the point location with
-  */
-  template <class AABBTraits>
-  Face_location locate(const Ray_3& ray, const AABB_tree<AABBTraits>& tree) const
-  {
-    return locate(ray, tree, m_graph, m_vertexPointMap, m_traits);
-  }
-
-  /// \cond
-
-  template <class AABBTraits>
-  static Face_location locate(const Ray_3& ray, const AABB_tree<AABBTraits>& tree, const Triangle_mesh& g, Vertex_point_map vertexPointMap, const Traits& traits = Traits())
-  {
-    typedef AABB_tree<AABBTraits> AABB_face_graph_tree;
-    typename Traits::Construct_barycentric_coordinate_in_triangle_3 cbcit3(traits.construct_barycentric_coordinate_in_triangle_3_object());
-    typename Traits::Construct_barycentric_coordinate cbc(traits.construct_barycentric_coordinate_object());
-    typename Traits::Compute_squared_distance_3 csd3(traits.compute_squared_distance_3_object());
-    typedef typename AABB_face_graph_tree::template Intersection_and_primitive_id<Ray_3>::Type Intersection_type;
-    typedef boost::optional<Intersection_type> Ray_intersection;
-
-    std::vector<Ray_intersection> intersections;
-
-    tree.all_intersections(ray, std::back_inserter(intersections));
-
-    bool foundOne = false;
-    FT nearestDistance = 0;
-    Point_3 nearestPoint = CGAL::ORIGIN;
-    face_descriptor nearestFace;
-
-    for (std::size_t i = 0; i < intersections.size(); ++i)
-    {
-      if (intersections[i])
-      {
-        Point_3* intersectionPoint = boost::get<Point_3>(&(intersections[i]->first));
-
-        if (intersectionPoint)
-        {
-          FT distance = csd3(*intersectionPoint, ray.source());
-
-          if (!foundOne || distance < nearestDistance)
-          {
-            foundOne = true;
-            nearestPoint = *intersectionPoint;
-            nearestDistance = distance;
-            nearestFace = intersections[i]->second;
-          }
-        }
-      }
-    }
-
-    if (foundOne)
-    {
-      Barycentric_coordinate b = cbcit3(triangle_from_face(nearestFace, g, vertexPointMap), nearestPoint);
-      return Face_location(nearestFace, b);
-    }
-    else
-    {
-      return Face_location(Graph_traits::null_face(), cbc(FT(0.0), FT(0.0), FT(0.0)));
-    }
-  }
-
-  /// \endcond
-
-  /// @}
-
-  /*
-  \brief Creates an `AABB_tree` suitable for use with `locate`.
-
-  \details The following static overload is also available:
-    - `static void build_aabb_tree(const Triangle_mesh& g, AABB_tree<AABBTraits>& outTree)`
-
-  \tparam AABBTraits A model of `AABBTraits` used to define a \cgal `AABB_tree`.
-
-  \param outTree Output parameter to store the computed `AABB_tree`
-  */
-  template <class AABBTraits>
-  void build_aabb_tree(AABB_tree<AABBTraits>& outTree) const
-  {
-    build_aabb_tree(m_graph, outTree);
-  }
-
-  /// \cond
-
-  template <class AABBTraits>
-  static void build_aabb_tree(const Triangle_mesh& g, AABB_tree<AABBTraits>& outTree)
-  {
-    face_iterator facesStart, facesEnd;
-    boost::tie(facesStart, facesEnd) = faces(g);
-    outTree.rebuild(facesStart, facesEnd, g);
-    outTree.build();
-  }
-  /// \endcond
-
-};
-
-} // namespace CGAL
-
-#endif // CGAL_SURFACE_MESH_SHORTEST_PATH_SURFACE_MESH_SHORTEST_PATH_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_shortest_path/Surface_mesh_shortest_path_traits.h b/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_shortest_path/Surface_mesh_shortest_path_traits.h
deleted file mode 100644
index 0c4b37b..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_shortest_path/Surface_mesh_shortest_path_traits.h
+++ /dev/null
@@ -1,205 +0,0 @@
-// Copyright (c) 2014 GeometryFactory
-// 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
-// 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(s)     : Stephen Kiazyk
-
-#ifndef CGAL_SURFACE_MESH_SHORTEST_PATH_TRAITS_H
-#define CGAL_SURFACE_MESH_SHORTEST_PATH_TRAITS_H
-
-#include <CGAL/Surface_mesh_shortest_path/barycentric.h>
-#include <CGAL/Surface_mesh_shortest_path/function_objects.h>
-
-#include <ostream>
-#include <cstddef>
-
-#include <boost/array.hpp>
-
-namespace CGAL {
-
-/*!
-\ingroup PkgSurfaceMeshShortestPathTraitsClasses
-
-\brief A model of the concept `SurfaceMeshShortestPathTraits`
-as required by the `Surface_mesh_shortest_path` class.
-
-\tparam K A \cgal Kernel
-
-\tparam G A model of `FaceListGraph`
-
-\cgalModels `SurfaceMeshShortestPathTraits`
-*/
-template <
-  class K,
-  class G>
-class Surface_mesh_shortest_path_traits : public K
-{
-public:
-
-  /// Kernel type
-  typedef K Kernel;
-
-  /// Triangle mesh type
-  typedef G Triangle_mesh;
-
-  typedef typename Kernel::FT FT;
-
-  /// Barycentric coordinate type
-  typedef typename CGAL::cpp11::array<FT,3> Barycentric_coordinate;
-
-  // Predicates
-public:
-  typedef typename Surface_mesh_shortest_paths_3::Compare_relative_intersection_along_segment_2<Kernel> Compare_relative_intersection_along_segment_2;
-  typedef typename Surface_mesh_shortest_paths_3::Is_saddle_vertex<Kernel, Triangle_mesh> Is_saddle_vertex;
-
-  // Constructions
-public:
-  class Construct_barycentric_coordinate
-  {
-  public:
-    typedef Barycentric_coordinate result_type;
-
-    result_type operator() (const FT& a, const FT& b, const FT& c) const
-    {
-      Barycentric_coordinate output;
-      output[0] = a;
-      output[1] = b;
-      output[2] = c;
-      return output;
-    }
-  };
-
-  class Construct_barycentric_coordinate_weight
-  {
-  public:
-    typedef FT result_type;
-
-    result_type operator() (const Barycentric_coordinate b, std::size_t i) const
-    {
-      return b[i % 3];
-    }
-  };
-
-  typedef typename Surface_mesh_shortest_paths_3::Construct_triangle_3_to_triangle_2_projection<K> Construct_triangle_3_to_triangle_2_projection;
-  typedef typename Surface_mesh_shortest_paths_3::Construct_triangle_3_along_segment_2_flattening<K> Construct_triangle_3_along_segment_2_flattening;
-  typedef typename Surface_mesh_shortest_paths_3::Compute_parametric_distance_along_segment_2<K> Compute_parametric_distance_along_segment_2;
-  typedef typename Surface_mesh_shortest_paths_3::Construct_barycentric_coordinate_in_triangle_2<K, Barycentric_coordinate, Construct_barycentric_coordinate> Construct_barycentric_coordinate_in_triangle_2;
-  typedef typename Surface_mesh_shortest_paths_3::Construct_barycentric_coordinate_in_triangle_3<K, Barycentric_coordinate, Construct_barycentric_coordinate> Construct_barycentric_coordinate_in_triangle_3;
-  typedef typename Surface_mesh_shortest_paths_3::Classify_barycentric_coordinate<Barycentric_coordinate, Construct_barycentric_coordinate_weight> Classify_barycentric_coordinate;
-
-private:
-  Kernel m_kernel;
-  Construct_barycentric_coordinate m_construct_barycentric_coordinate_object;
-  Construct_barycentric_coordinate_weight m_construct_barycentric_coordinate_weight_object;
-  Classify_barycentric_coordinate m_classify_barycentric_coordinate_object;
-  Construct_triangle_3_to_triangle_2_projection m_construct_triangle_3_to_triangle_2_projection_object;
-  Construct_triangle_3_along_segment_2_flattening m_construct_triangle_3_along_segment_2_flattening_object;
-  Construct_barycentric_coordinate_in_triangle_2 m_construct_barycentric_coordinate_in_triangle_2_object;
-  Construct_barycentric_coordinate_in_triangle_3 m_construct_barycentric_coordinate_in_triangle_3_object;
-  Compare_relative_intersection_along_segment_2 m_compare_relative_intersection_along_segment_2_object;
-  Is_saddle_vertex m_is_saddle_vertex_object;
-  Compute_parametric_distance_along_segment_2 m_compute_parametric_distance_along_segment_2_object;
-
-public:
-
-  Surface_mesh_shortest_path_traits()
-  {
-  }
-
-  Surface_mesh_shortest_path_traits(const Kernel& kernel)
-    : m_kernel(kernel)
-    , m_classify_barycentric_coordinate_object(m_construct_barycentric_coordinate_weight_object)
-    , m_construct_triangle_3_to_triangle_2_projection_object(m_kernel)
-    , m_construct_triangle_3_along_segment_2_flattening_object(m_kernel)
-    , m_is_saddle_vertex_object(m_kernel, m_construct_triangle_3_to_triangle_2_projection_object, m_construct_triangle_3_along_segment_2_flattening_object)
-    , m_compare_relative_intersection_along_segment_2_object(m_kernel)
-    , m_construct_barycentric_coordinate_in_triangle_2_object(m_construct_barycentric_coordinate_object, m_kernel.construct_vector_2_object(), m_kernel.compute_scalar_product_2_object())
-    , m_construct_barycentric_coordinate_in_triangle_3_object(m_construct_barycentric_coordinate_object, m_kernel.construct_vector_3_object(), m_kernel.compute_scalar_product_3_object())
-  {
-  }
-
-  Construct_barycentric_coordinate construct_barycentric_coordinate_object() const { return m_construct_barycentric_coordinate_object; }
-  Construct_barycentric_coordinate_weight construct_barycentric_coordinate_weight_object() const { return m_construct_barycentric_coordinate_weight_object; }
-  Classify_barycentric_coordinate classify_barycentric_coordinate_object() const { return m_classify_barycentric_coordinate_object; }
-
-  Is_saddle_vertex is_saddle_vertex_object() const { return m_is_saddle_vertex_object; }
-
-  Compare_relative_intersection_along_segment_2 compare_relative_intersection_along_segment_2_object() const { return m_compare_relative_intersection_along_segment_2_object; }
-  Construct_triangle_3_to_triangle_2_projection construct_triangle_3_to_triangle_2_projection_object() const { return m_construct_triangle_3_to_triangle_2_projection_object; }
-  Construct_triangle_3_along_segment_2_flattening construct_triangle_3_along_segment_2_flattening_object() const { return m_construct_triangle_3_along_segment_2_flattening_object; }
-  Construct_barycentric_coordinate_in_triangle_2 construct_barycentric_coordinate_in_triangle_2_object() const { return m_construct_barycentric_coordinate_in_triangle_2_object; }
-  Construct_barycentric_coordinate_in_triangle_3 construct_barycentric_coordinate_in_triangle_3_object() const { return m_construct_barycentric_coordinate_in_triangle_3_object; }
-  Compute_parametric_distance_along_segment_2 compute_parametric_distance_along_segment_2_object() const { return m_compute_parametric_distance_along_segment_2_object; }
-};
-
-template <class Kernel, class Triangle_mesh>
-std::ostream& operator<<(std::ostream& os, typename Surface_mesh_shortest_path_traits<Kernel, Triangle_mesh>::Barycentric_coordinate b)
-{
-  return os << b[0] << " " << b[1] << " " << b[2];
-}
-
-#ifndef DOXYGEN_RUNNING // needed due to a bug in doxygen
-/*!
-\ingroup PkgSurfaceMeshShortestPathTraitsClasses
-
-\internal
-
-\brief Provides an implementation of the SurfaceMeshShortestPathTraits
-model which uses an exact Kernel during the unfolding operations to achieve better overall precision
-
-\tparam K Kernel Type
-
-\tparam G triangle mesh type
-
-\cgalModels `SurfaceMeshShortestPathTraits`
-*/
-template <
-  class K,
-  class G>
-class Surface_mesh_shortest_path_traits_with_robust_unfolding : public Surface_mesh_shortest_path_traits<K,G>
-{
-public:
-  typedef K Kernel;
-  typedef typename Surface_mesh_shortest_paths_3::Robust_project_triangle_3_to_triangle_2<K> Construct_triangle_3_to_triangle_2_projection;
-  typedef typename Surface_mesh_shortest_paths_3::Robust_flatten_triangle_3_along_segment_2<K> Construct_triangle_3_along_segment_2_flattening;
-
-private:
-
-  Construct_triangle_3_to_triangle_2_projection m_robust_construct_triangle_3_to_triangle_2_projection_object;
-  Construct_triangle_3_along_segment_2_flattening m_robust_flatten_triangle_3_along_segment_2;
-
-public:
-
-  Surface_mesh_shortest_path_traits_with_robust_unfolding()
-  {
-  }
-
-  Surface_mesh_shortest_path_traits_with_robust_unfolding(const Kernel& kernel)
-    : Surface_mesh_shortest_path_traits<K,G>(kernel)
-    , m_robust_construct_triangle_3_to_triangle_2_projection_object(kernel)
-    , m_robust_flatten_triangle_3_along_segment_2(kernel)
-  {
-  }
-
-  Construct_triangle_3_to_triangle_2_projection construct_triangle_3_to_triangle_2_projection_object() const { return m_robust_construct_triangle_3_to_triangle_2_projection_object; }
-  Construct_triangle_3_along_segment_2_flattening construct_triangle_3_along_segment_2_flattening_object() const { return m_robust_flatten_triangle_3_along_segment_2; }
-};
-#endif
-
-} // namespace CGAL
-
-
-#endif // CGAL_SURFACE_MESH_SHORTEST_PATH_TRAITS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Three/Polyhedron_demo_io_plugin_interface.h b/3rdparty/CGAL-4.8/include/CGAL/Three/Polyhedron_demo_io_plugin_interface.h
deleted file mode 100644
index d44a45e..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Three/Polyhedron_demo_io_plugin_interface.h
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright (c) 2009,2010,2012  GeometryFactory Sarl (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
-// 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(s)     : Laurent RINEAU
-
-#ifndef POLYHEDRON_DEMO_IO_PLUGIN_INTERFACE_H
-#define POLYHEDRON_DEMO_IO_PLUGIN_INTERFACE_H
-
-#include <QFileInfo>
-#include <QStringList>
-
-namespace CGAL{
-namespace Three {
-class Scene_item;
-  /*!
-   * \file Polyhedron_demo_io_plugin_interface.h
-   * This class provides a base for creating a new IO plugin.
-   */
-class Polyhedron_demo_io_plugin_interface 
-{
-public:
-  //!Returns the name of the plugin
-  virtual QString name() const = 0;
-  virtual ~Polyhedron_demo_io_plugin_interface() {}
-  /*! The filters for the names of the files that can be used
-   * by the plugin.
-   * Example : to filter OFF files : return "OFF files (*.off)"
-*/
-  virtual QString nameFilters() const = 0;
-  virtual QString saveNameFilters() const {return nameFilters();}
-  virtual QString loadNameFilters() const {return nameFilters();}
-
-  //! Specifies if the io_plugin is able to load an item or not.
-  virtual bool canLoad() const = 0;
-  //!  Loads an item from a file.
-  virtual Scene_item* load(QFileInfo fileinfo) = 0;
-  //!Specifies if the io_plugin can save the item or not.
-  virtual bool canSave(const Scene_item*) = 0;
-  //!Saves the item in the file corresponding to the path
-  //!contained in fileinfo. Returns false if error.
-  virtual bool save(const Scene_item*, QFileInfo fileinfo) = 0;
-};
-}
-}
-Q_DECLARE_INTERFACE(CGAL::Three::Polyhedron_demo_io_plugin_interface,
-                    "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0")
-
-#endif // POLYHEDRON_DEMO_IO_PLUGIN_INTERFACE_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Three/Polyhedron_demo_plugin_helper.h b/3rdparty/CGAL-4.8/include/CGAL/Three/Polyhedron_demo_plugin_helper.h
deleted file mode 100644
index b7ea12f..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Three/Polyhedron_demo_plugin_helper.h
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright (c) 2009,2014,2015  GeometryFactory Sarl (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
-// 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(s)     : Laurent RINEAU
-
-//! \file Polyhedron_demo_plugin_helper.h 
-#ifndef POLYHEDRON_DEMO_OPERATION_HELPER_H
-#define POLYHEDRON_DEMO_OPERATION_HELPER_H
-
-#include "Scene_item_config.h" //defines SCENE_ITEM_EXPORT
-
-#include <QString>
-#include <QStringList>
-#include <QMap>
-
-class QAction;
-struct QMetaObject;
-class QMainWindow;
-class QDockWidget;
-
-#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
-#include <CGAL/Three/Scene_interface.h>
-namespace CGAL {
-namespace Three {
-  /*!
-   * This class provides a base for creating a new plugin.
-   */
-class SCENE_ITEM_EXPORT Polyhedron_demo_plugin_helper
-  : public Polyhedron_demo_plugin_interface
-{
-public:
-  //! get action object from its name
-  static QAction* getActionFromMainWindow(QMainWindow*, QString action_name);
-  
-  //! Init plugin
-  virtual void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface);
-  
-  //! Get list of actions supported by this plugin
-  virtual QStringList actionsNames() const;
-  //!List of the actions of the plugin
-  virtual QList<QAction*> actions() const;
-
-  //! To get a selected item with the type of SceneType
-  template<class SceneType>
-  SceneType* get_selected_item() const {
-    int item_id = scene->mainSelectionIndex();
-    SceneType* scene_item = qobject_cast<SceneType*>(scene->item(item_id));
-    if(!scene_item) {
-      // no selected SceneType - if there is only one in list return it, otherwise NULL
-      int counter = 0;
-      int last_selected = 0;
-      for(CGAL::Three::Scene_interface::Item_id i = 0, end = scene->numberOfEntries(); i < end && counter < 2; ++i) {
-        if(SceneType* tmp = qobject_cast<SceneType*>(scene->item(i))) { 
-          scene_item = tmp;
-          counter++; 
-          last_selected=i;
-        }
-      }
-      if(counter != 1) { return NULL; }
-      scene->setSelectedItem(last_selected);
-    }
-    return scene_item;
-  }
-
-  //!To add a dock widget to the interface
-  void add_dock_widget(QDockWidget* dock);
-
-  //! Auto-connects actions to slots. Called by init().
-  void autoConnectActions();
-  
-protected:
-  //!The list of actions
-  QMap<QString, QAction*> actions_map;
-  //!The reference to the scene
-  CGAL::Three::Scene_interface* scene;
-  //!The reference to the main window
-  QMainWindow* mw;
-};
-}
-}
-#endif // POLYHEDRON_DEMO_OPERATION_HELPER_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Three/Polyhedron_demo_plugin_interface.h b/3rdparty/CGAL-4.8/include/CGAL/Three/Polyhedron_demo_plugin_interface.h
deleted file mode 100644
index f3ddda4..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Three/Polyhedron_demo_plugin_interface.h
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright (c) 2009-2015  GeometryFactory Sarl (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
-// 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(s)     : Laurent RINEAU
-
-   //! \file Polyhedron_demo_plugin_interface.h 
-#ifndef POLYHEDRON_DEMO_PLUGIN_INTERFACE_H
-#define POLYHEDRON_DEMO_PLUGIN_INTERFACE_H
-
-#include <QString>
-#include <QList>
-#include <QtPlugin>
-#include <QDebug>
-
-class QAction;
-class QMainWindow;
-class Messages_interface;
-namespace CGAL {
-namespace Three {
-class Scene_interface;
-  /*!
-   * This class gives some virtual functions to help making a plugin
-   */
-class Polyhedron_demo_plugin_interface 
-{
-public:
-  //! Destructor
-  virtual ~Polyhedron_demo_plugin_interface() {}
-  //!Initializes the plugin.
-  virtual void init(QMainWindow*, CGAL::Three::Scene_interface*) {}
-  //!Initializes the plugin.
-  virtual void init(QMainWindow* mw, CGAL::Three::Scene_interface* sc, Messages_interface*) {
-    init(mw, sc);
-  }
-
-  //! Checks the current state of the `Scene` or `MainWindow` and decides
-  //! if the plugin can function, given that state.  Its actions are
-  //! visible in contextmenus, if this returns true, not visible
-  //! otherwise.  
-  //!
-  //! @returns \c true, if the plugin is applicable, \c false
-  //! otherwise
-  virtual bool applicable(QAction*) const = 0;
-  //!The list of the actions of the plugin.
-  virtual QList<QAction*> actions() const = 0;
-  //!If you need to do something when the plugin is closed, do it here
-  virtual void closure() {
- }
-};
-}
-}
-Q_DECLARE_INTERFACE(CGAL::Three::Polyhedron_demo_plugin_interface,
-                    "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
-
-#endif // POLYHEDRON_DEMO_PLUGIN_INTERFACE_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Three/Scene_draw_interface.h b/3rdparty/CGAL-4.8/include/CGAL/Three/Scene_draw_interface.h
deleted file mode 100644
index c9fa3f0..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Three/Scene_draw_interface.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (c) 2009,2010,2012,2015  GeometryFactory Sarl (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
-// 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(s)     : Laurent RINEAU
-
-#ifndef SCENE_DRAW_INTERFACE_H
-#define SCENE_DRAW_INTERFACE_H
-
-class QKeyEvent;
-namespace CGAL
-{
-namespace Three {
-  class Viewer_interface;
-
-
-//! Base class to interact with the scene from the viewer.
-class Scene_draw_interface {
-public:
-  virtual ~Scene_draw_interface(){}
-  virtual void initializeGL() = 0;
-  virtual void draw() = 0;
-  virtual void draw(CGAL::Three::Viewer_interface*) { draw(); };
-  virtual void drawWithNames() = 0;
-  virtual void drawWithNames(CGAL::Three::Viewer_interface*) { drawWithNames(); }
-  virtual bool keyPressEvent(QKeyEvent* e) = 0;
-  virtual float get_bbox_length() const = 0;
-};
-}
-}
-#endif // SCENE_DRAW_INTERFACE_H;
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Three/Scene_group_item.h b/3rdparty/CGAL-4.8/include/CGAL/Three/Scene_group_item.h
deleted file mode 100644
index bc4db1c..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Three/Scene_group_item.h
+++ /dev/null
@@ -1,141 +0,0 @@
-// Copyright (c) 2015  GeometryFactory Sarl (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
-// 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(s)     : Maxime Gimeno
-
-
-#ifndef SCENE_GROUP_ITEM_H
-#define SCENE_GROUP_ITEM_H
-
-#include <CGAL/Three/Scene_item.h>
-using namespace CGAL::Three;
-
-#include <QtCore/qglobal.h>
-#ifdef demo_framework_EXPORTS
-#  define DEMO_FRAMEWORK_EXPORT Q_DECL_EXPORT
-#else
-#  define DEMO_FRAMEWORK_EXPORT Q_DECL_IMPORT
-#endif
-namespace CGAL {
-namespace Three {
-//!A Scene_group_item is a virtual Scene_item that does not draw anything,
-//! but regroups other items as its children. It allows the
-//! user to apply several actions to multiple items at the same time.
-class DEMO_FRAMEWORK_EXPORT Scene_group_item : public Scene_item
-{
-    Q_OBJECT
-public :
-    Scene_group_item(QString name = QString("New group"));
-    ~Scene_group_item() {}
-    //!Returns false to avoid disturbing the BBox of the scene.
-    bool isFinite() const;
-    //!Returns true to avoid disturbing the BBox of the scene.
-    bool isEmpty() const ;
-    //!Returns if the group_item is currently expanded or collapsed in the view.
-    //! True means expanded, false means collapsed.
-    //! @see setExpanded.
-    bool isExpanded() const;
-    //!Makes the group_item expanded or collapsed in the view.
-    //! True means expanded, false means collapsed.
-    void setExpanded(bool);
-    //! @see isExpanded.
-    //!Returns an empty BBox to avoid disturbing the BBox of the scene.
-    Bbox bbox() const;
-    //!Not supported.
-    Scene_item* clone() const {return 0;}
-    //! Indicate if rendering mode is supported.
-    bool supportsRenderingMode(RenderingMode m) const;
-    //!Prints the number of children.
-    QString toolTip() const;
-    //!Adds a Scene_item* to the list of children.
-    //!@see getChildren. @see removeChild.
-    void addChild(Scene_item* new_item);
-    //!Sets all the children to the specified color.
-    void setColor(QColor c);
-    //!Sets all the children in the specified rendering mode.
-    void setRenderingMode(RenderingMode m);
-    //!Sets all the children to the specified visibility.
-    void setVisible(bool b);
-    //!Sets all the children in points mode.
-    void setPointsMode() {
-      setRenderingMode(Points);
-    }
-    //!Sets all the children in wireframe rendering.
-    void setWireframeMode() {
-      setRenderingMode(Wireframe);
-    }
-    //!Sets all the children in wireframe rendering.
-    void setWireframe() {
-      setRenderingMode(Wireframe);
-    }
-    //!Sets all the children in flat rendering.
-    void setFlat() {
-      setRenderingMode(Flat);
-    }
-    //!Sets all the children in flat rendering.
-    void setFlatMode() {
-      setRenderingMode(Flat);
-    }
-    //!Sets all the children in flat rendering with edges.
-    void setFlatPlusEdgesMode() {
-      setRenderingMode(FlatPlusEdges);
-    }
-    //!Sets all the children in smooth rendering.
-    void setGouraudMode() {
-      setRenderingMode(Gouraud);
-    }
-    //!Sets all the children in point rendering with normals.
-    void setPointsPlusNormalsMode(){
-      setRenderingMode(PointsPlusNormals);
-    }
-    //!Sets all the children in splat rendering.
-    void setSplattingMode(){
-      setRenderingMode(Splatting);
-    }
-    //!Returns a list of all the children.
-    QList<Scene_item*> getChildren() const {return children;}
-    //!Removes a Scene_item from the list of children.
-    //!@see getChildren @see addChild
-    void removeChild( Scene_item* item)
-    {
-      Scene_group_item* group =
-              qobject_cast<Scene_group_item*>(item);
-      if(group)
-        Q_FOREACH(Scene_item* child, group->getChildren())
-            removeChild(child);
-      item->has_group=0;
-      children.removeOne(item);
-    }
-    //!Moves a child up in the list.
-    void moveUp(int);
-    //!Moves a child down in the list.
-    void moveDown(int);
-
-private:
-    //!Contains a reference to all the children of this group.
-    QList<Scene_item*> children;
-    //!Updates the property has_group for each group and sub-groups containing new_item.
-    void add_group_number(Scene_item*new_item);
-    bool expanded;
-
-}; //end of class Scene_group_item
-
-}
-}
-
-#endif // SCENE_GROUP_ITEM_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Three/Scene_interface.h b/3rdparty/CGAL-4.8/include/CGAL/Three/Scene_interface.h
deleted file mode 100644
index fb2d922..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Three/Scene_interface.h
+++ /dev/null
@@ -1,191 +0,0 @@
-// Copyright (c) 2012-2015  GeometryFactory Sarl (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
-// 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(s)     : Laurent RINEAU
-
-#ifndef SCENE_INTERFACE_H
-#define SCENE_INTERFACE_H
-
-#include <QString>
-#include <QColor>
-#include <QList>
-#include <algorithm>
-#include <cmath>
-namespace CGAL{namespace Three{
-class Scene_item;
-class Scene_group_item;
-    }}
-// OpenGL rendering mode
-/** \file Scene_interface.h
- * Contains the class Scene_interface and the enum RenderingMode.
- */
-/*!
- * \brief The RenderingMode enum
- * Can be Points, PointsPlusNormals, Wireframe, Flat, FlatPlusEdges, or Gouraud.
- * - Points, PointsPlusNormals, and Wireframe have no light model.
- * - Flat and FlatPlusEdges use a basic light model with one normal per facet.
- * - Gouraud use the same light model but with one normal per vertex.
- */
-enum RenderingMode { Points = 0,
-                     PointsPlusNormals,
-                     Splatting,
-                     Wireframe, 
-                     Flat,
-                     FlatPlusEdges,
-                     Gouraud,
-                     LastRenderingMode = Gouraud,
-                     NumberOfRenderingMode = LastRenderingMode+1 };
-
-
-namespace CGAL {
-namespace Three{
-/*!
- * This is the class given to the plugins to interact with the scene.
- * */
-class Scene_interface {
-public:
-    //!Contains the coordinates for the two extremities of the diagonal of a bounding box.
-    //! Those points are respectively the left bottom front vertex and the right upper back vertex.
-  struct Bbox {
-    double xmin, ymin, zmin;
-    double xmax, ymax, zmax;
-    Bbox(const double _xmin,const double _ymin,const double _zmin,
-         const double _xmax,const double _ymax,const double _zmax)
-      : xmin(_xmin), ymin(_ymin), zmin(_zmin),
-        xmax(_xmax), ymax(_ymax), zmax(_zmax)
-    {
-    }
-    //!The default constructor of a bounding box.
-    //! The two vertices are (0.0,0.0,0.0) and (1.0,1.0,1.0).
-    Bbox()
-      : xmin(0.0), ymin(0.0), zmin(0.0),
-        xmax(1.0), ymax(1.0), zmax(1.0)
-    {
-    }
-    //!Sums the coordinates of each vertex one by one.
-    Bbox operator+(const Bbox& b) const {
-      return Bbox((std::min)(xmin, b.xmin),
-                  (std::min)(ymin, b.ymin),
-                  (std::min)(zmin, b.zmin),
-                  (std::max)(xmax, b.xmax),
-                  (std::max)(ymax, b.ymax),
-                  (std::max)(zmax, b.zmax));
-    }
-
-    //!@returns true if all the coordinates of the two bounding boxes are the same.
-    bool operator==(const Bbox&b) const{
-      return
-        xmin==b.xmin && xmax==b.xmax &&
-        ymin==b.ymin && ymax==b.ymax &&
-        zmin==b.zmin && zmax==b.zmax;
-    }
-    //!@returns the opposite of ==.
-    //!@see #operator==
-    bool operator!=(const Bbox& b) const{
-      return !(*this == b);
-    }
-    //!@returns the difference between xmax and xmin.
-    double width() const { return xmax-xmin; }
-    //!@returns the difference between ymax and ymin.
-    double height() const { return ymax-ymin; }
-    //!@returns the difference between zmax and zmin.
-    double depth() const { return zmax-zmin; }
-    //!@returns the length of the diagonal of the bounding box.
-    double diagonal_length() const
-    {
-      return std::sqrt(width()*width() + height()*height() + depth()*depth());
-    }
-
-  }; // struct BBox (ad hoc class, does not depend on CGAL kernels
-
-  //!Integer used for the index of an Scene_item.
-  //!@see Scene_item
-  typedef int Item_id;
-  //!Virtual destructor
-  virtual ~Scene_interface() {};
-  //!Adds an item to the list of items. Must be overloaded.
-  //!@returns the index of the new item.
-  virtual Item_id addItem(CGAL::Three::Scene_item* item) = 0;
-  //!Sets an item as the one at the specified index .
-  //!If emit_item_about_to_be_destroyed is set to true, emits
-  //!an itemAboutToBeDestroyed signal. Must be overloaded.
-  //!@returns a pointer to the old item.
-  virtual Scene_item* replaceItem(Item_id, CGAL::Three::Scene_item*, bool emit_item_about_to_be_destroyed = false) = 0;
-  //!Moves item to the targeted group.
-  virtual void changeGroup(CGAL::Three::Scene_item* item, CGAL::Three::Scene_group_item* target_group) = 0;
-
-  /*! Erases an item in the list. Must be overloaded.
-   * @returns the index of the item just before the one that is erased,
-   * or just after.
-   * @returns -1 if the list is empty.*/
-  virtual Item_id erase(Item_id) = 0;
-
-  /*! Duplicate a scene item. Must be overloaded.
-   * @returns the ID of the new item (-1 on error).
-   */
-    virtual Item_id duplicate(Item_id) = 0;
-
-  // Accessors (getters)
-  //!Must be overloaded.
-  //!@returns the number of items.
-  virtual int numberOfEntries() const = 0;
-  //!Must be overloaded.
-  //! @returns the item at the target index.
-  virtual CGAL::Three::Scene_item* item(Item_id) const = 0;
-  //!Must be overloaded.
-  //! @returns the id of the target item.
-  virtual Item_id item_id(CGAL::Three::Scene_item*) const = 0;
-  //!Must be overloaded.
-  //!@returns the currently selected item's index.
-  virtual Item_id mainSelectionIndex() const = 0;
-  //!Must be overloaded.
-  //!@returns the list of currently selected items indices.
-  virtual QList<Item_id> selectionIndices() const = 0;
-  //!Must be overloaded.
-  //!@returns the index of the Item_A
-  virtual Item_id selectionAindex() const = 0;
-  //!Must be overloaded.
-  //!@returns the index of the Item_B
-  virtual Item_id selectionBindex() const = 0;
-
-  //! Must be overloaded.
-  //!@returns the scene bounding box
-  virtual Bbox bbox() const = 0;
-  //!Must be overloaded.
-  //!@returns the length of the bounding box's diagonal.
-  virtual double len_diagonal() const = 0;
-
-public:
-  /*! Notifies the scene that an item was modified. Must be overloaded.*/
-  virtual void itemChanged(Item_id i) = 0; 
-  /*! Notifies the scene that an item was modified. Must be overloaded.*/
-  virtual void itemChanged(CGAL::Three::Scene_item*) = 0;
-
-  /*! Selects an item. Must be overloaded.*/
-  virtual void setSelectedItem(Item_id) = 0;
-  /*!  Adds group to the Scene. If items were selected at the
-   * moment this function is called, they are added to the group.
-   * If all the selected items were in the same group, the new group
-   * is added as a sub-group of this group.*/
-  virtual void add_group(Scene_group_item* group) = 0;
-  
-}; // end interface Scene_interface
-}
-}
-
-#endif // SCENE_INTERFACE_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Three/Scene_item.h b/3rdparty/CGAL-4.8/include/CGAL/Three/Scene_item.h
deleted file mode 100644
index 37eafaa..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Three/Scene_item.h
+++ /dev/null
@@ -1,459 +0,0 @@
-// Copyright (c) 2012-2015  GeometryFactory Sarl (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
-// 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(s)     : Laurent RINEAU, Maxime Gimeno
-
-#ifndef SCENE_ITEM_H
-#define SCENE_ITEM_H
-#include <CGAL/Three/Scene_item_config.h>
-#include <CGAL/Three/Scene_interface.h>
-#include <QString>
-#include <QPixmap>
-#include <QFont>
-#include <QOpenGLBuffer>
-#include <QOpenGLShader>
-#include <QOpenGLVertexArrayObject>
-#include <vector>
-namespace CGAL {
-namespace Three {
-  class Viewer_interface;
-}
-}
-namespace qglviewer {
-  class ManipulatedFrame;
-}
-
-class QMenu;
-class QKeyEvent;
-namespace CGAL {
-namespace Three {
-
-class Viewer_interface;
-//! This class represents an object in the OpenGL scene
-class SCENE_ITEM_EXPORT Scene_item : public QObject {
-  Q_OBJECT
-  Q_PROPERTY(QColor color READ color WRITE setColor)
-  Q_PROPERTY(QString name READ name WRITE setName)
-  Q_PROPERTY(bool visible READ visible WRITE setVisible)
-  Q_ENUMS(RenderingMode)
-  Q_PROPERTY(RenderingMode renderingMode READ renderingMode WRITE setRenderingMode)
-public:
- /*!
-   * \brief The OpenGL_program_IDs enum
-   * This enum holds the OpenGL programs IDs that are given to getShaderProgram() and attrib_buffers().
-   *@see getShaderProgram
-   * @see attrib_buffers
-   */
- enum OpenGL_program_IDs
- {
-  PROGRAM_WITH_LIGHT = 0,      /** Used to render a surface or edge affected by the light. It uses a per fragment lighting model, and renders brighter the selected item.*/
-  PROGRAM_WITHOUT_LIGHT,       /** Used to render a polygon edge or points. It renders in a uniform color and is not affected by light. It renders the selected item in black.*/
-  PROGRAM_NO_SELECTION,        /** Used to render a polyline or a surface that is not affected by light, like a cutting plane. It renders in a uniform color that does not change with selection.*/
-  PROGRAM_WITH_TEXTURE,        /** Used to render a textured polyhedron. Affected by light.*/
-  PROGRAM_PLANE_TWO_FACES,     /** Used to render a two-faced plane. The two faces have a different color. Not affected by light.*/
-  PROGRAM_WITH_TEXTURED_EDGES, /** Used to render the edges of a textured polyhedorn. Not affected by light.*/
-  PROGRAM_INSTANCED,           /** Used to display instanced rendered spheres.Affected by light.*/
-  PROGRAM_INSTANCED_WIRE,      /** Used to display instanced rendered wired spheres. Not affected by light.*/
-  PROGRAM_C3T3,                /** Used to render a c3t3_item. It discards any fragment on a side of a plane, meaning that nothing is displayed on this side of the plane. Affected by light.*/
-  PROGRAM_C3T3_EDGES,          /** Used to render the edges of a c3t3_item. It discards any fragment on a side of a plane, meaning that nothing is displayed on this side of the plane. Not affected by light.*/
-  NB_OF_PROGRAMS               /** Holds the number of different programs in this enum.*/
- };
-  typedef CGAL::Three::Scene_interface::Bbox Bbox;
-  typedef qglviewer::ManipulatedFrame ManipulatedFrame;
-  //! The default color of a scene_item.
-  static const QColor defaultColor; // defined in Scene_item.cpp
-
-  //!The default Constructor.
-  /*!
-   * Initializes the number of VBOs to 20 and VAOs to 10 and creates them.
-   */
-  Scene_item()
-    : name_("unamed"),
-      color_(defaultColor),
-      visible_(true),
-      are_buffers_filled(false),
-      rendering_mode(FlatPlusEdges),
-      defaultContextMenu(0),
-      buffersSize(20),
-      vaosSize(10),
-      vaos(10)
-  {
-      is_bbox_computed = false;
-      is_monochrome = true;
-      for(int i=0; i<vaosSize; i++)
-      {
-          addVaos(i);
-          vaos[i]->create();
-      }
-
-      buffers.reserve(buffersSize);
-      for(int i=0; i<buffersSize; i++)
-      {
-          QOpenGLBuffer n_buf;
-          buffers.push_back(n_buf);
-          buffers[i].create();
-      }
-      nb_isolated_vertices = 0;
-      has_group = 0;
-  }
-  //!The Constructor.
-  /*!
-   * Initializes the number of VBOs and VAOs and creates them.
-   */
-  Scene_item(int buffers_size, int vaos_size)
-    : name_("unamed"),
-      color_(defaultColor),
-      visible_(true),
-      are_buffers_filled(false),
-      rendering_mode(FlatPlusEdges),
-      defaultContextMenu(0),
-      buffersSize(buffers_size),
-      vaosSize(vaos_size),
-      vaos(vaos_size)
-  {
-      is_bbox_computed = false;
-      is_monochrome = true;
-      for(int i=0; i<vaosSize; i++)
-      {
-          addVaos(i);
-          vaos[i]->create();
-      }
-
-      buffers.reserve(buffersSize);
-      for(int i=0; i<buffersSize; i++)
-      {
-          QOpenGLBuffer n_buf;
-          buffers.push_back(n_buf);
-          buffers[i].create();
-      }
-      nb_isolated_vertices = 0;
-      has_group = 0;
-  }
-  //! Setter for the number of isolated vertices.
-  void setNbIsolatedvertices(std::size_t nb) { nb_isolated_vertices = nb;}
-  //! Getter for the number of isolated vertices.
-  std::size_t getNbIsolatedvertices() const {return nb_isolated_vertices;}
-  //!The destructor. It is virtual as the item is virtual.
-  virtual ~Scene_item();
-  //! Creates a new item as a copy of the sender. Must be overloaded.
-  virtual Scene_item* clone() const = 0;
-
-  //! Indicates if rendering mode is supported
-  virtual bool supportsRenderingMode(RenderingMode m) const = 0;
-  //! Deprecated. Does nothing.
-  virtual void draw() const {}
-  /*! \brief The drawing function.
-   * Draws the facets of the item in the viewer using OpenGL functions. The data
-   * for the drawing is gathered in compute_elements(), and is sent
-   * to buffers in initialize_buffers().
-   * @see compute_elements()
-   * @see initialize_buffers()
-   */
-  virtual void draw(CGAL::Three::Viewer_interface*) const  { draw(); }
-  //! Deprecated. Does nothing.
-  virtual void draw_edges() const { draw(); }
-  /*! \brief The drawing function.
-   * Draws the edges and lines of the item in the viewer using OpenGL functions. The data
-   * for the drawing is gathered in compute_elements(), and is sent
-   * to buffers in initialize_buffers().
-   * @see compute_elements()
-   * @see initialize_buffers()
-   */
-  virtual void draw_edges(CGAL::Three::Viewer_interface* viewer) const { draw(viewer); }
-  //! Deprecated. Does nothing.
-  virtual void draw_points() const { draw(); }
-  /*! \brief The drawing function.
-   * Draws the points of the item in the viewer using OpenGL functions. The data
-   * for the drawing is gathered in compute_elements(), and is sent
-   * to buffers in initialize_buffers().
-   * @see compute_elements()
-   * @see initialize_buffers()
-   */
-  virtual void draw_points(CGAL::Three::Viewer_interface*) const { draw_points(); }
-
-  //! Draws the splats of the item in the viewer using GLSplat functions.
-  virtual void draw_splats() const {}
-  //! Draws the splats of the item in the viewer using GLSplat functions.
-  virtual void draw_splats(CGAL::Three::Viewer_interface*) const {draw_splats();}
-
-  //! Specifies which data must be updated when selection has changed.
-  //! Must be overloaded.
-  virtual void selection_changed(bool);
-
-  // Functions for displaying meta-data of the item
-  //! @returns a QString containing meta-data about the item.
-  //! Must be overloaded.
-  //! Data is :Number of vertices, Number of edges, Number of facets,
-  //! Volume, Area, Bounding box limits and Number of isolated points.
-  virtual QString toolTip() const = 0;
-  //! @returns a QPixmap containing graphical meta-data about the item.
-  virtual QPixmap graphicalToolTip() const { return QPixmap(); }
-  //! @returns a QFont containing the font used for the data of the item.
-  virtual QFont font() const { return QFont(); }
-
-  // Functions that help the Scene to compute its bbox
-  //! If isFinite() returns false, the BBox is not computed.
-  virtual bool isFinite() const { return true; }
-  //! Specifies if the item is empty or null.
-  virtual bool isEmpty() const { return true; }
-  //!@returns the item's bounding box.
-  virtual Bbox bbox() const {
-      if(!is_bbox_computed)
-          compute_bbox();
-      is_bbox_computed = true;
-      return _bbox;
-  }
-  // Function about manipulation
-  //! Decides if the item can have a ManipulatedFrame.
-  virtual bool manipulatable() const { return false; }
-  //!@returns the manipulatedFrame of the item.
-  virtual ManipulatedFrame* manipulatedFrame() { return 0; }
-
-  // Getters for the four basic properties
-  //! @returns the current color of the item.
-  virtual QColor color() const { return color_; }
-  //! @returns the current name of the item.
-  virtual QString name() const { return name_; }
-  //! @returns the current visibility of the item.
-  virtual bool visible() const { return visible_; }
-  //! @returns the current rendering mode of the item.
-  //!@see RenderingMode
-  virtual RenderingMode renderingMode() const { return rendering_mode; }
-  //! @returns the current rendering mode of the item as a human readable string.
-  virtual QString renderingModeName() const;
-
-  //! Context menu
-  virtual QMenu* contextMenu();
-
-  //!Handles key press events.
-  virtual bool keyPressEvent(QKeyEvent*){return false;}
-
-  //!Contains the header for the table in the statistics dialog
-  /*!
-   * A header data is composed of 2 columns : the Categories and the titles.
-   * A category is the name given to an association of titles.
-   * A title is the name of a line.
-   *
-   * For example,
-   * Category :    | Titles| Values
-   * 2 lines       |       |
-   *  ____________________________
-   * |             |Name   |Cube |
-   * |             |_______|_____|
-   * |General Info |\#Edges|12   |
-   * |_____________|_______|_____|
-   *
-   *  would be stored as follows :
-   * categories = std::pair<QString,int>(QString("General Info"),2)
-   * titles.append("Name");
-   * titles.append("#Edges");
-   */
-  struct Header_data{
-   //!Contains the name of the category of statistics and the number of lines it will contain
-   QList<std::pair<QString, int> > categories;
-   //!Contains the name of the lines of each category. Must be sorted from top to bottom.
-   QList<QString> titles;
-  };
-  //!Returns a Header_data struct containing the header information.
-  virtual Header_data header()const;
-  //!Returns a QString containing the requested value for the the table in the statistics dialog
-  /*!
-   * Example :
-   *  ____________________________
-   * |             |Name   |Cube |
-   * |             |_______|_____|
-   * |General Info |\#Edges|12   |
-   * |_____________|_______|_____|
-   * compute stats(0) should return "Cube" and compute_stats(1) should return QString::number(12);
-   * The numbers must be coherent with the order of declaration of the titles in the header.
-   *
-   *
-   */
-  virtual QString compute_stats(int i);
-
-  //!Contains the number of group and subgroups containing this item.
-  int has_group;
-
-public Q_SLOTS:
-
-  //! Notifies the program that the internal data or the properties of
-  //! an item has changed, and that it must be computed again.It is
-  //! important to call this function whenever the internal data is changed,
-  //! or the displayed item will not be updated.
-  //!Must be overloaded.
-  virtual void invalidateOpenGLBuffers();
-  //!Setter for the color of the item. Calls invalidateOpenGLBuffers() so the new color is applied.
-  virtual void setColor(QColor c) { color_ = c; if(!is_monochrome)invalidateOpenGLBuffers(); }
-  //!Setter for the RGB color of the item. Calls setColor(QColor).
-  //!@see setColor(QColor c)
-  void setRbgColor(int r, int g, int b) { setColor(QColor(r, g, b)); }
-  //!Setter for the name of the item.
-  virtual void setName(QString n) { name_ = n; }
-  //!Setter for the visibility of the item.
-  virtual void setVisible(bool b) { visible_ = b; }
-  //!Setter for the rendering mode of the item.
-  //!@see RenderingMode
-  virtual void setRenderingMode(RenderingMode m) { 
-    if (supportsRenderingMode(m))
-      rendering_mode = m; 
-    Q_EMIT redraw();
-  }
-  //!Set the RenderingMode to Points.
-  void setPointsMode() {
-    setRenderingMode(Points);
-  }
-  //!Set the RenderingMode to Wireframe.
-  void setWireframeMode() {
-    setRenderingMode(Wireframe);
-  }
-
-  //!Set the RenderingMode to Flat.
-  void setFlatMode() {
-    setRenderingMode(Flat);
-  }
-  //!Set the RenderingMode to FlatPlusEdges.
-  void setFlatPlusEdgesMode() {
-    setRenderingMode(FlatPlusEdges);
-  }
-  //!Set the RenderingMode to Gouraud.
-  void setGouraudMode() {
-    setRenderingMode(Gouraud);
-  }
-  //!Set the RenderingMode to PointsPlusNormals.
-  void setPointsPlusNormalsMode(){
-    setRenderingMode(PointsPlusNormals);
-  }
-  //!Set the RenderingMode to Splatting.
-  void setSplattingMode(){
-    setRenderingMode(Splatting);
-  }
-
-  //! If b is true, the item will use buffers to render the color.
-  //! If b is false, it will use a uniform value. For example, when
-  //! using the mesh segmentation plugin, the item must be multicolor.
-  void setItemIsMulticolor(bool b){
-    is_monochrome = !b;
-  }
-  
-  //!Emits an aboutToBeDestroyed() signal.
-  virtual void itemAboutToBeDestroyed(Scene_item*);
-
-  //!Selects a point through raycasting.
-  virtual void select(double orig_x,
-                      double orig_y,
-                      double orig_z,
-                      double dir_x,
-                      double dir_y,
-                      double dir_z);
-
-Q_SIGNALS:
-  void itemChanged();
-  void aboutToBeDestroyed();
-  void redraw();
-
-protected:
-  //!Holds the BBox of the item
-  mutable Bbox _bbox;
-  mutable bool is_bbox_computed;
-  virtual void compute_bbox()const{}
-  // The four basic properties
-  //!The name of the item.
-  QString name_;
-  //!The color of the item.
-  QColor color_;
-  //!The visibility of the item.
-  bool visible_;
-  //!Specifies if the item is currently selected.
-  bool is_selected;
-  //! Specifies if the item is monochrome and uses uniform attribute for its color
-  //! or is multicolor and uses buffers.
-  bool is_monochrome;
-  //! Holds the number of vertices that are not linked to the polyhedron from the OFF
-  //! file.
-  std::size_t nb_isolated_vertices;
-  /*! Decides if the draw function must call initialize_buffers() or not. It is set
-   * to true in the end of initialize_buffers() and to false in invalidateOpenGLBuffers(). The need of
-   * this boolean comes from the need of a context from the OpenGLFunctions used in
-   * initialize_buffers().
-   * @see initialize_buffers()
-   * @see invalidateOpenGLBuffers()
-   */
-  mutable bool are_buffers_filled;
-  //!The rendering mode of the item.
-  //!@see RenderingMode
-  RenderingMode rendering_mode;
-  //!The default context menu.
-  QMenu* defaultContextMenu;
-  /*! Contains the previous RenderingMode.
-   * This is used to determine if invalidateOpenGLBuffers should be called or not
-   * in certain cases.
-   * @see invalidateOpenGLBuffers()*/
-  RenderingMode prev_shading;
-  /*! \todo replace it by RenderingMode().
-   * \brief
-   *  Contains the current RenderingMode.
-   * This is used to determine if invalidateOpenGLBuffers should be called or not
-   * in certain cases.
-   * @see invalidateOpenGLBuffers()*/
-  RenderingMode cur_shading;
-  //!Contains the size of the vector of VBOs
-  int buffersSize;
-  //!Contains the size of the map of VAOs
-  int vaosSize;
-  //!Contains the VBOs
-  mutable std::vector<QOpenGLBuffer> buffers;
-  /*! Contains the VAOs.
-   */
-  std::vector<QOpenGLVertexArrayObject*> vaos;
-  //!Adds a VAO to the Map.
-  void addVaos(int i)
-  {
-      QOpenGLVertexArrayObject* n_vao = new QOpenGLVertexArrayObject();
-      vaos[i] = n_vao;
-  }
-
-  //! Used pass data to the shader.
-  int vertexLoc;
-  //! Used pass data to the shader.
-  int normalLoc;
-  //! Used pass data to the shader.
-  int colorLoc;
-  /*! Fills the VBOs with data. Must be called after each call to #compute_elements().
-   * @see compute_elements()
-   */
-  void initialize_buffers(){}
-
-  /*! Collects all the data for the shaders. Must be called in #invalidateOpenGLBuffers().
-   * @see invalidateOpenGLBuffers().
-   */
-  void compute_elements(){}
-  /*! Passes all the uniform data to the shaders.
-   * According to program_name, this data may change.
-   */
-  void attrib_buffers(CGAL::Three::Viewer_interface*, int program_name) const;
-
-  /*! Compatibility function. Calls `viewer->getShaderProgram()`. */
-  virtual QOpenGLShaderProgram* getShaderProgram(int name , CGAL::Three::Viewer_interface *viewer = 0) const;
-}; // end class Scene_item
-}
-}
-
-#include <QMetaType>
-Q_DECLARE_METATYPE(CGAL::Three::Scene_item*)
-
-#endif // SCENE_ITEM_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Three/Viewer_interface.h b/3rdparty/CGAL-4.8/include/CGAL/Three/Viewer_interface.h
deleted file mode 100644
index e99b5bb..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Three/Viewer_interface.h
+++ /dev/null
@@ -1,162 +0,0 @@
-// Copyright (c) 2012-2015  GeometryFactory Sarl (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
-// 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(s)     : Laurent RINEAU, Maxime Gimeno
-
-#ifndef VIEWER_INTERFACE_H
-#define VIEWER_INTERFACE_H
-
-#include <QGLViewer/qglviewer.h>
-#include <QWidget>
-#include <QPoint>
-#include <QOpenGLFunctions_2_1>
-#include <CGAL/Qt/CreateOpenGLContext.h>
-// forward declarations
-class QWidget;
-class QMouseEvent;
-class QKeyEvent;
-class QOpenGLShaderProgram;
-
-//! \file Viewer_interface.h
-#include <CGAL/Three/Viewer_config.h> // for VIEWER_EXPORT
-namespace CGAL{
-namespace Three{
-class Scene_draw_interface;
-//! Base class to interact with the viewer from the plugins, the items and the scene.
-class VIEWER_EXPORT Viewer_interface : public QGLViewer, public QOpenGLFunctions_2_1 {
-
-  Q_OBJECT
-
-public:
- /*!
-   * \brief The OpenGL_program_IDs enum
-   * This enum holds the OpenGL programs IDs that are given to getShaderProgram() and attrib_buffers().
-   *@see getShaderProgram
-   * @see attrib_buffers
-   */
-  enum OpenGL_program_IDs
-  {
-   PROGRAM_WITH_LIGHT = 0,      /** Used to render a surface or edge affected by the light. It uses a per fragment lighting model, and renders brighter the selected item.*/
-   PROGRAM_WITHOUT_LIGHT,       /** Used to render a polygon edge or points. It renders in a uniform color and is not affected by light. It renders the selected item in black.*/
-   PROGRAM_NO_SELECTION,        /** Used to render a polyline or a surface that is not affected by light, like a cutting plane. It renders in a uniform color that does not change with selection.*/
-   PROGRAM_WITH_TEXTURE,        /** Used to render a textured polyhedron. Affected by light.*/
-   PROGRAM_PLANE_TWO_FACES,     /** Used to render a two-faced plane. The two faces have a different color. Not affected by light.*/
-   PROGRAM_WITH_TEXTURED_EDGES, /** Used to render the edges of a textured polyhedorn. Not affected by light.*/
-   PROGRAM_INSTANCED,           /** Used to display instanced rendered spheres.Affected by light.*/
-   PROGRAM_INSTANCED_WIRE,      /** Used to display instanced rendered wired spheres. Not affected by light.*/
-   PROGRAM_C3T3,                /** Used to render a c3t3_item. It discards any fragment on a side of a plane, meaning that nothing is displayed on this side of the plane. Affected by light.*/
-   PROGRAM_C3T3_EDGES,          /** Used to render the edges of a c3t3_item. It discards any fragment on a side of a plane, meaning that nothing is displayed on this side of the plane. Not affected by light.*/
-   NB_OF_PROGRAMS               /** Holds the number of different programs in this enum.*/
-  };
-
-  Viewer_interface(QWidget* parent) : QGLViewer(CGAL::Qt::createOpenGLContext(), parent) {}
-  virtual ~Viewer_interface() {}
-
-  //! Sets the scene for the viewer.
-  virtual void setScene(CGAL::Three::Scene_draw_interface* scene) = 0;
-  //! @returns the antialiasing state.
-  virtual bool antiAliasing() const = 0;
-  
-  // Those two functions are defined in Viewer.cpp
-  //!Sets the position and orientation of a frame using a QString.
-  //!@returns true if it worked.
-  static bool readFrame(QString, qglviewer::Frame&);
-  //!@returns a QString contining the position and orientation of a frame.
-  static QString dumpFrame(const qglviewer::Frame&);
-  //! @returns the fastDrawing state.
-  virtual bool inFastDrawing() const = 0;
-
-  /*! Passes all the uniform data to the shaders.
-   * According to program_name, this data may change.
-   * @see OpenGL_program_IDs
-   */
-  virtual void attrib_buffers(int program_name) const = 0;
-
-  /*! Returns a program according to name.
-   * If the program does not exist yet, it is created and stored in shader_programs.
-   * @see OpenGL_program_IDs
-   * @returns a pointer to the corresponding program.*/
-  virtual QOpenGLShaderProgram* getShaderProgram(int name) const = 0;
-
-  //!Allows OpenGL 2.1 context to get access to glDrawArraysInstanced.
-  typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDARBPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
-  //!Allows OpenGL 2.1 context to get access to glVertexAttribDivisor.
-  typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORARBPROC) (GLuint index, GLuint divisor);
-  //!Allows OpenGL 2.1 context to get access to glVertexAttribDivisor.
-  typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) (GLuint target, GLuint attachment, GLuint textarget, GLuint texture, GLint level);
-  //!Allows OpenGL 2.1 context to get access to gkFrameBufferTexture2D.
-  PFNGLDRAWARRAYSINSTANCEDARBPROC glDrawArraysInstanced;
-  //!Allows OpenGL 2.1 context to get access to glVertexAttribDivisor.
-  PFNGLVERTEXATTRIBDIVISORARBPROC glVertexAttribDivisor;
-  //!Allows OpenGL 2.1 context to get access to gkFrameBufferTexture2D.
-  PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2D;
-  //!@returns true if glVertexAttribDivisor, and glDrawArraysInstanced are found.
-  //! Used by the items to avoid SEGFAULT.
-  bool extension_is_found;
-  //!The matrix used for the picking.
-  GLfloat pickMatrix_[16];
-  //!Sets the binding for SHIFT+LEFT CLICK to SELECT (initially used in Scene_polyhedron_selection_item.h)
-  void setBindingSelect()
-  {
-#if QGLVIEWER_VERSION >= 0x020501
-    setMouseBinding(::Qt::ShiftModifier, ::Qt::LeftButton, SELECT);
-#else
-    setMouseBinding(::Qt::SHIFT + ::Qt::LeftButton, SELECT);
-#endif
-  }
-  //!Sets the binding for SHIFT+LEFT CLICK to NO_CLICK_ACTION (initially used in Scene_polyhedron_selection_item.h)
-  void setNoBinding()
-  {
-#if QGLVIEWER_VERSION >= 0x020501
-    setMouseBinding(::Qt::ShiftModifier, ::Qt::LeftButton, NO_CLICK_ACTION);
-#else
-    setMouseBinding(::Qt::SHIFT + ::Qt::LeftButton, NO_CLICK_ACTION);
-#endif
-  }
-
-Q_SIGNALS:
-  //!Defined automatically in moc.
-  void selected(int);
-  //!Defined automatically in moc.
-  void requestContextMenu(QPoint global_pos);
-  //!Defined automatically in moc.
-  void selectedPoint(double, double, double);
-  //!Defined automatically in moc.
-  void selectionRay(double, double, double, double, double, double);
-
-public Q_SLOTS:
-  //! Sets the antialiasing to true or false.
-  virtual void setAntiAliasing(bool b) = 0;
-  //! If b is true, facets will be ligted from both internal and external sides.
-  //! If b is false, only the side that is exposed to the light source will be lighted.
-  virtual void setTwoSides(bool b) = 0;
-  //! If b is true, some items are displayed in a simplified version when moving the camera.
-  //! If b is false, items display is never altered, even when moving.
-  virtual void setFastDrawing(bool b) = 0;
-  //! Make the camera turn around.
-  virtual void turnCameraBy180Degres() = 0;
-  //! @returns a QString containing the position and orientation of the camera.
-  virtual QString dumpCameraCoordinates() = 0;
-//!Moves the camera to the new coordinates (position and orientation) through an animation.
-  virtual bool moveCameraToCoordinates(QString, 
-                                       float animation_duration = 0.5f) = 0;
-
-}; // end class Viewer_interface
-}
-}
-#endif // VIEWER_INTERFACE_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Time_stamper.h b/3rdparty/CGAL-4.8/include/CGAL/Time_stamper.h
deleted file mode 100644
index 649d072..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Time_stamper.h
+++ /dev/null
@@ -1,90 +0,0 @@
-// Copyright (c) 2014 GeometryFactory Sarl (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.
-//
-//
-//
-// Author(s)     : Jane Tournois
-
-#include <CGAL/Has_timestamp.h>
-
-#ifndef CGAL_TIME_STAMPER_H
-#define CGAL_TIME_STAMPER_H
-
-namespace CGAL {
-
-template <typename T>
-struct Time_stamper
-{
-  Time_stamper()
-   : time_stamp_(0) {}
-
-  Time_stamper(const Time_stamper& ts)
-   : time_stamp_(ts.time_stamp_) {}
-
-  void set_time_stamp(T* pt) {
-    pt->set_time_stamp(time_stamp_++);
-  }
-
-  static bool less(const T* p_t1, const T* p_t2) {
-    if(p_t1 == NULL)      return (p_t2 != NULL);
-    else if(p_t2 == NULL) return false;
-    else                  return p_t1->time_stamp() < p_t2->time_stamp();
-  }
-
-  void reset() {
-    time_stamp_ = 0;
-  }
-private:
-  std::size_t time_stamp_;
-}; // end class template Time_stamper<T>
-
-template <typename T>
-struct No_time_stamp
-{
-public:
-  void set_time_stamp(T*)  {}
-  static bool less(const T* p_t1,const T* p_t2) {
-    return p_t1 < p_t2;
-  }
-  void reset()                {}
-}; // end class template No_time_stamp<T>
-
-// That class template is an auxiliary class.  It has a
-// specialization for the case where `T::Has_timestamp` does not exists.
-// The non-specialized template, when `T::Has_timestamp` exists, derives
-// from `Time_stamper<T>` or `No_time_stamp<T>` depending on the
-// value of the Boolean constant `T::Has_timestamp`.
-// The declaration of that class template requires `T` to be a complete type.
-template <class T, bool has_timestamp = internal::Has_timestamp<T>::value>
-struct Get_time_stamper{
-  typedef Time_stamper<T> type;
-};
-
-// Specialization when `T::Has_timestamp` does not exist, derives from
-// `TimeStamper_`, or from `No_time_stamp<T>`.
-template <class T>
-struct Get_time_stamper<T,false>{
-  typedef No_time_stamp<T> type;
-};
-
-// Implementation of the timestamp policy. It is very important that the
-// declaration of that class template does not require `T` to be a complete
-// type.  That way, the declaration of a pointer of type `Time_stamper_impl<T, Ts>
-// in `Compact_container` for example is possible with an incomplete type.
-template <class T>
-struct Time_stamper_impl : public Get_time_stamper<T>::type {};
-
-} //end of namespace CGAL
-
-#endif // CGAL_TIME_STAMPER_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_2/insert_constraints.h b/3rdparty/CGAL-4.8/include/CGAL/Triangulation_2/insert_constraints.h
deleted file mode 100644
index 9abef10..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_2/insert_constraints.h
+++ /dev/null
@@ -1,114 +0,0 @@
-// Copyright (c) 2014  INRIA Sophia-Antipolis (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
-// 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(s)     : Andreas Fabri, Mariette Yvinec
-
-#ifndef CGAL_INTERNAL_TRIANGULATION_2_IMSERT_CONSTRAINTS_H
-#define CGAL_INTERNAL_TRIANGULATION_2_IMSERT_CONSTRAINTS_H
-
-#include <CGAL/Spatial_sort_traits_adapter_2.h>
-#include <boost/iterator/counting_iterator.hpp>
-#include <vector>
-#include <iterator>
-
-namespace CGAL {
-  namespace internal {
-
-
-
-    template <class T, class IndicesIterator>
-    std::size_t insert_constraints( T& t,
-                                    const std::vector<typename T::Point>& points,
-                                    IndicesIterator indices_first,
-                                    IndicesIterator indices_beyond )
-  {
-    typedef typename T::Vertex_handle Vertex_handle;
-    typedef typename T::Face_handle Face_handle;
-    typedef typename T::Geom_traits Geom_traits;
-    typedef typename T::Point Point;
-    typedef std::vector<std::ptrdiff_t> Vertex_indices;
-    typedef std::vector<Vertex_handle> Vertices;
-    
-    Vertex_indices vertex_indices;
-    vertex_indices.resize(points.size());
-
-    std::copy(boost::counting_iterator<std::ptrdiff_t>(0),
-              boost::counting_iterator<std::ptrdiff_t>(points.size()),
-              std::back_inserter(vertex_indices));
-
-    typename T::size_type n = t.number_of_vertices();
-    CGAL::Spatial_sort_traits_adapter_2<Geom_traits, const Point*> sort_traits(&(points[0]));
-
-    spatial_sort(vertex_indices.begin(), vertex_indices.end(), sort_traits);
-
-    Vertices vertices;
-    vertices.resize(points.size());
-
-    Face_handle hint;
-    for(typename Vertex_indices::const_iterator
-          it_pti = vertex_indices.begin(), end = vertex_indices.end();
-          it_pti != end; ++it_pti)
-    {
-      vertices[*it_pti] = t.insert(points[*it_pti], hint);
-      hint=vertices[*it_pti]->face();
-    }
-
-    for(IndicesIterator it_cst=indices_first, end=indices_beyond;
-        it_cst!=end; ++it_cst)
-    {
-      Vertex_handle v1 = vertices[it_cst->first];
-      Vertex_handle v2 = vertices[it_cst->second];
-      if(v1 != v2) t.insert_constraint(v1, v2);
-    }
-
-    return t.number_of_vertices() - n;
-  }
-
-
-
-    template <class T,class ConstraintIterator>
-    std::size_t insert_constraints(T& t,
-                                   ConstraintIterator first,
-                                   ConstraintIterator beyond)
-  {
-    typedef typename T::Point Point;
-    typedef typename T::Point Point;
-    std::vector<Point> points;
-    for (ConstraintIterator s_it=first; s_it!=beyond; ++s_it)
-    {
-      points.push_back( T::get_source(*s_it) );
-      points.push_back( T::get_target(*s_it) );
-    }
-
-    std::vector< std::pair<std::size_t, std::size_t> > segment_indices;
-    std::size_t nb_segments = points.size() / 2;
-    segment_indices.reserve( nb_segments );
-    for (std::size_t k=0; k < nb_segments; ++k)
-      segment_indices.push_back( std::make_pair(2*k,2*k+1) );
-
-    return insert_constraints( t,
-                               points,
-                               segment_indices.begin(),
-                               segment_indices.end() );
-  }
-
-
-  }
-}
-
-#endif // CGAL_INTERNAL_TRIANGULATION_2_IMSERT_CONSTRAINTS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_2_filtered_projection_traits_3.h b/3rdparty/CGAL-4.8/include/CGAL/Triangulation_2_filtered_projection_traits_3.h
deleted file mode 100644
index 96b6830..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_2_filtered_projection_traits_3.h
+++ /dev/null
@@ -1,85 +0,0 @@
- // Copyright (c) 2009  GeometryFactory (France)
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Laurent Rineau
-
-
-#ifndef CGAL_TRIANGULATION_2_FILTERED_PROJECTION_TRAITS_3_H
-#define CGAL_TRIANGULATION_2_FILTERED_PROJECTION_TRAITS_3_H
-
-#include <CGAL/Triangulation_2_projection_traits_3.h>
-#include <CGAL/Filtered_predicate.h>
-
-namespace CGAL {
-
-template < class Filtered_kernel >
-class Triangulation_2_filtered_projection_traits_3
-  : public Triangulation_2_projection_traits_3<Filtered_kernel>
-{
-  typedef Filtered_kernel K;
-  typedef Triangulation_2_filtered_projection_traits_3<K> Self;
-  typedef Triangulation_2_projection_traits_3<K> Base;
-
-  typedef typename K::Exact_kernel Exact_kernel;
-  typedef typename K::Approximate_kernel Approximate_kernel;
-  typedef typename K::C2E C2E;
-  typedef typename K::C2F C2F;
-
-public:
-  typedef Triangulation_2_projection_traits_3<Exact_kernel> Exact_traits;
-  typedef Triangulation_2_projection_traits_3<Approximate_kernel> Filtering_traits;
-
-public:
-  explicit Triangulation_2_filtered_projection_traits_3(const typename K::Vector_3& n)
-    : Base(n)
-  {
-  }
-
-#define CGAL_TRIANGULATION_2_PROJ_TRAITS_FILTER_PRED(P, Pf, ACCESSOR)    \
-  typedef  Filtered_predicate< \
-    typename Exact_traits::P, \
-    typename Filtering_traits::P, \
-    C2E, \
-    C2F > P; \
-  P Pf() const { \
-    return P(this->ACCESSOR()); \
-  }
-  CGAL_TRIANGULATION_2_PROJ_TRAITS_FILTER_PRED(Orientation_2,
-                                               orientation_2_object,
-                                               normal)
-  CGAL_TRIANGULATION_2_PROJ_TRAITS_FILTER_PRED(Side_of_oriented_circle_2,
-                                               side_of_oriented_circle_2_object,
-                                               normal)
-  CGAL_TRIANGULATION_2_PROJ_TRAITS_FILTER_PRED(Less_x_2,
-					       less_x_2_object,
-					       base1)
-  CGAL_TRIANGULATION_2_PROJ_TRAITS_FILTER_PRED(Less_y_2,
-					       less_y_2_object,
-					       base2)
-  CGAL_TRIANGULATION_2_PROJ_TRAITS_FILTER_PRED(Compare_x_2,
-					       compare_x_2_object,
-					       base1)
-  CGAL_TRIANGULATION_2_PROJ_TRAITS_FILTER_PRED(Compare_y_2,
-					       compare_y_2_object,
-					       base2)
-}; // end class Triangulation_2_projection_traits_3<Filtered_kernel>
-
-} // end namespace CGAL
-
-
-#endif // CGAL_TRIANGULATION_2_FILTERED_PROJECTION_TRAITS_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_2_projection_traits_3.h b/3rdparty/CGAL-4.8/include/CGAL/Triangulation_2_projection_traits_3.h
deleted file mode 100644
index 36b584e..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_2_projection_traits_3.h
+++ /dev/null
@@ -1,487 +0,0 @@
-// Copyright (c) 2009  GeometryFactory (France)
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Laurent Rineau
-
-
-#ifndef CGAL_TRIANGULATION_2_PROJECTION_TRAITS_3_H
-#define CGAL_TRIANGULATION_2_PROJECTION_TRAITS_3_H
-
-#include <CGAL/Profile_timer.h>
-#include <CGAL/intersections.h>
-
-namespace CGAL {
-
-namespace TriangulationProjectionTraitsCartesianFunctors {
-
-template <class Traits>
-class Projected_orientation_with_normal_3
-{
-  // private members
-  const typename Traits::Vector_3 normal;
-
-  // private type aliases
-  typedef typename Traits::K K;
-  typedef typename Traits::Point_2 Point;
-  typedef typename Traits::Vector_3 Vector_3;
-public:
-  typedef typename K::Orientation Orientation;
-  typedef Orientation result_type;
-
-  Projected_orientation_with_normal_3(const Vector_3& normal_)
-    : normal(normal_)
-  {
-    CGAL_PROFILER("Construct Projected_orientation_with_normal_3.")
-    CGAL_TIME_PROFILER("Construct Projected_orientation_with_normal_3")
-  }
-
-  Orientation operator()(const Point& p,
-			 const Point& q,
-			 const Point& r) const
-  {    
-    CGAL_PROFILER("Projected_orientation_with_normal_3::operator()");
-    CGAL_TIME_PROFILER("Projected_orientation_with_normal_3::operator()");
-    return orientation(q-p, r-p, normal);
-  }
-}; // end class Projected_orientation_with_normal_3<Traits>
-
-template <class Traits>
-class Projected_side_of_oriented_circle_with_normal_3
-{
-  // private members
-  const typename Traits::Vector_3 normal;
-
-  // private types aliases
-  typedef typename Traits::K K;
-  typedef typename Traits::Point_2 Point;
-  typedef typename Traits::Vector_3 Vector_3;
-  typedef typename Traits::FT FT;
-
-  typedef Projected_side_of_oriented_circle_with_normal_3<Traits> Self;
-
-public:
-  typedef typename K::Oriented_side Oriented_side;
-  typedef Oriented_side result_type;
-
-  Projected_side_of_oriented_circle_with_normal_3(const Vector_3& normal_)
-    : normal(normal_)
-  {
-    CGAL_PROFILER("Construct Projected_side_of_oriented_circle_with_normal_3.")
-    CGAL_TIME_PROFILER("Construct Projected_side_of_oriented_circle_with_normal_3.")
-  }
-
-  Oriented_side operator()(const Point& p,
-			   const Point& q,
-			   const Point& r,
-			   const Point& t) const
-  {
-    CGAL_PROFILER("Projected_side_of_oriented_circle_with_normal_3::operator()")
-    CGAL_TIME_PROFILER("Projected_side_of_oriented_circle_with_normal_3::operator()")
-    const Vector_3& u = normal;
-
-    const Vector_3 tp = p - t;
-    const Vector_3 tq = q - t;
-    const Vector_3 tr = r - t;
-
-    const FT tp2 = tp * tp;
-    const FT tq2 = tq * tq;
-    const FT tr2 = tr * tr;
-    const FT u2  =  u * u;
-
-    const FT k_p = tp * u;
-    const FT k_q = tq * u;
-    const FT k_r = tr * u;
-
-    return 
-       sign_of_determinant(tp.x(), tp.y(), tp.z(), (tp2 + k_p) * u2 - k_p * k_p,
-			   tr.x(), tr.y(), tr.z(), (tr2 + k_r) * u2 - k_r * k_r,
-			   tq.x(), tq.y(), tq.z(), (tq2 + k_q) * u2 - k_q * k_q,
-                           u.x(),  u.y(),  u.z(), u2 * u2);
-    // Note that q and r have been swapped in the determinant above, to
-    // inverse its sign.
-  }
-}; // end class Projected_side_of_oriented_circle_with_normal_3
-
-template <class Traits>
-class Projected_squared_distance_with_normal_3
-{
-  // private members
-  const typename Traits::Vector_3 normal;
-  
-  // private types aliases
-  typedef typename Traits::K K;
-  typedef typename Traits::Point_2 Point;
-  typedef typename Traits::Line_2 Line;
-  typedef typename Traits::Vector_3 Vector_3;
-  typedef typename Traits::FT FT;
-
-public:
-  Projected_squared_distance_with_normal_3(const Vector_3& normal_)
-    : normal(normal_)
-  {
-    CGAL_PROFILER("Construct Projected_squared_distance_with_normal_3.")
-    CGAL_TIME_PROFILER("Construct Projected_squared_distance_with_normal_3")
-  }
-
-  FT operator()(const Point& p, const Point& q)
-  {
-    return squared_distance(p, q);
-  }
-
-  FT operator()(const Line& line, const Point& p)
-  {
-    CGAL_PROFILER("Projected_squared_distance_with_normal_3::operator()")
-    CGAL_TIME_PROFILER("Projected_squared_distance_with_normal_3::operator()")
-    const Vector_3& vl = line.to_vector();
-    const Point& pl = line.point();
-    const Vector_3 v = cross_product(normal,
-                                     vl);
-    if(v == NULL_VECTOR) {
-      // den == 0 if the line is vertical
-      // In that case, the distance is the distance to the line
-      const Vector_3 w = cross_product(pl - p,
-                                       vl);
-      return (w * w) / (vl * vl);
-    }
-    else {
-      const FT det = determinant(normal, 
-                                 vl, 
-                                 pl - p);
-      return (det * det) / ( v * v );
-    }
-  }
-}; // end class Projected_squared_distance_with_normal_3
-
-template <class Traits>
-class Projected_intersect_3
-{
-  // private members
-  const typename Traits::Vector_3 normal;
-  
-  // private types aliases
-  typedef typename Traits::K K;
-  typedef typename Traits::Point_2 Point;
-  typedef typename Traits::Line_2 Line;
-  typedef typename Traits::Segment_2 Segment;
-  typedef typename K::Plane_3 Plane_3;
-  typedef typename Traits::Vector_3 Vector_3;
-  typedef typename Traits::FT FT;
-public:
-  Projected_intersect_3(const Vector_3& normal_)
-    : normal(normal_)
-  {
-    CGAL_PROFILER("Construct Projected_intersect_3")
-    CGAL_TIME_PROFILER("Construct Projected_intersect_3")
-  }
-
-  Object operator()(const Segment& s1, const Segment& s2)
-  {
-    CGAL_PROFILER("Projected_intersect_3::operator()")
-    CGAL_TIME_PROFILER("Projected_intersect_3::operator()")
-    const Vector_3 u1 = cross_product(s1.to_vector(), normal);
-    if(u1 == NULL_VECTOR)
-      return K().intersect_3_object()(s1.supporting_line(), s2);
-
-    const Vector_3 u2 = cross_product(s2.to_vector(), normal);
-    if(u2 == NULL_VECTOR)
-      return K().intersect_3_object()(s1, s2.supporting_line());
-    
-    const Plane_3 plane_1(s1.source(), u1);
-    const Plane_3 plane_2(s2.source(), u2);
-    
-    Object planes_intersection = intersection(plane_1, plane_2);
-    if(planes_intersection.empty()) {
-      std::cerr << "planes_intersection is empty\n";
-      return planes_intersection;
-    }
-    if(const Line* line = object_cast<Line>(&planes_intersection))
-    {
-      const Point& pi = line->point(0);
-      if(cross_product(normal, pi - s1.source())
-         * cross_product(normal, pi - s1.target()) > FT(0)
-         ||
-         cross_product(normal, pi - s2.source())
-         * cross_product(normal, pi - s2.target()) > FT(0) )
-      {
-        // the intersection of the lines is not inside the segments
-        std::cerr << "intersection not inside\n";
-        return Object();
-      }
-      else
-      {
-        // Let the plane passing through s1.source() and with normal
-        // the cross product of s1.to_vector() and s2.to_vector(). That
-        // plane should intersect *l, now.
-        return intersection(*line, Plane_3(s1.source(), 
-                                           cross_product(s1.to_vector(),
-                                                         s2.to_vector())));
-      }
-    }
-    if(object_cast<Plane_3>(&planes_intersection))
-    {
-      std::cerr << "coplanar lines\n";
-      CGAL_error();
-      return Object();
-    }
-    return Object();
-  }
-}; // end class Projected_intersect_3
-
-
-template <class Traits>
-class Less_along_axis
-{
-  // private members
-  typedef typename Traits::Vector_3 Vector_3;
-  typedef typename Traits::Point_2 Point;
-  const Vector_3 base;
-public:
-  Less_along_axis(const Vector_3& base) : base(base)
-  {
-    CGAL_PROFILER("Construct Less_along_axis")
-    CGAL_TIME_PROFILER("Construct Less_along_axis")
-  }
-
-  typedef bool result_type;
-
-  bool operator() (const Point &p, const Point &q) const {
-    return base * (p - q) < 0;
-  }
-}; // end class Less_along_axis
-
-template <class Traits>
-class Compare_along_axis
-{
-  // private members
-  typedef typename Traits::Vector_3 Vector_3;
-  typedef typename Traits::Point_2 Point;
-  const Vector_3 base;
-public:
-  Compare_along_axis(const Vector_3& base) : base(base)
-  {
-    CGAL_PROFILER("Construct Compare_along_axis")
-    CGAL_TIME_PROFILER("Construct Compare_along_axis")
-  }
-
-  typedef Comparison_result result_type;
-
-  Comparison_result operator() (const Point &p, const Point &q) const {
-    return compare(base * (p - q), 0);
-  }
-}; // end class Compare_along_axis
-
-} // end namespace TriangulationProjectionTraitsCartesianFunctors
-
-
-template < class Kernel >
-class Triangulation_2_projection_traits_3
-{
-  typedef Triangulation_2_projection_traits_3<Kernel> Self;
-
-  typename Kernel::Vector_3 n, b1, b2;
-
-public:
-  typedef typename Kernel::Vector_3 Vector_3;
-
-
-  explicit Triangulation_2_projection_traits_3(const Vector_3& n_)
-    : n(n_)
-  {
-    typedef typename Kernel::FT FT;
-    typedef typename Kernel::Vector_3 Vector_3;
-
-    const FT& nx = n.x();
-    const FT& ny = n.y();
-    const FT& nz = n.z();
-    if(CGAL::abs(nz) >= CGAL::abs(ny)) {
-      b1 = Vector_3(nz, 0, -nx);
-    }
-    else {
-      b1 = Vector_3(ny, -nx, 0);
-    }
-    b2 = cross_product(n, b1);
-  }
-
-  const Vector_3& normal() const
-  {
-    return n;
-  }
-
-  const Vector_3& base1() const{
-    return b1;
-  }
-
-  const Vector_3& base2() const{
-    return b2;
-  }
-
-  typedef Kernel K;
-  typedef typename K::FT          FT;
-  typedef typename K::Point_3     Point_2;
-  typedef typename K::Segment_3   Segment_2;
-  typedef typename K::Vector_3    Vector_2;
-  typedef typename K::Triangle_3  Triangle_2;
-  typedef typename K::Line_3      Line_2;
-
-  typedef typename K::Angle_3                                Angle_2;
-
-  typedef TriangulationProjectionTraitsCartesianFunctors::
-    Compare_along_axis<Self>                                 Compare_x_2;
-  typedef TriangulationProjectionTraitsCartesianFunctors::
-    Compare_along_axis<Self>                                 Compare_y_2;
-
-  typedef TriangulationProjectionTraitsCartesianFunctors::
-    Less_along_axis<Self>                                    Less_x_2;
-  typedef TriangulationProjectionTraitsCartesianFunctors::
-    Less_along_axis<Self>                                    Less_y_2;
-
-  typedef TriangulationProjectionTraitsCartesianFunctors::
-    Projected_orientation_with_normal_3<Self>                Orientation_2;
-
-  typedef TriangulationProjectionTraitsCartesianFunctors::
-    Projected_side_of_oriented_circle_with_normal_3<Self>    Side_of_oriented_circle_2;
-
-  typedef TriangulationProjectionTraitsCartesianFunctors::
-  Projected_squared_distance_with_normal_3<Self>             Compute_squared_distance_2;
-
-  typedef TriangulationProjectionTraitsCartesianFunctors::
-  Projected_intersect_3<Self>                                Intersect_2;
-
-  typedef typename K::Construct_segment_3  Construct_segment_2;
-  typedef typename K::Construct_vector_3   Construct_vector_2;
-  typedef typename K::Construct_line_3     Construct_line_2;
-  typedef typename K::Construct_triangle_3 Construct_triangle_2;
-
-  typedef typename K::Construct_scaled_vector_3     Construct_scaled_vector_2;
-  typedef typename K::Construct_translated_point_3  Construct_translated_point_2;
-  typedef typename K::Construct_midpoint_3          Construct_midpoint_2;
-  typedef typename K::Construct_circumcenter_3      Construct_circumcenter_2;
-
-  typedef typename K::Compute_area_3                Compute_area_2;
-
-  Less_x_2
-  less_x_2_object() const
-  {
-    return Less_x_2(this->base1());
-  }
-
-  Less_y_2
-  less_y_2_object() const
-  {
-    return Less_y_2(this->base2());
-  }
-
-  Compare_x_2
-  compare_x_2_object() const
-  {
-    return Compare_x_2(this->base1());
-  }
-
-  Compare_y_2
-  compare_y_2_object() const
-  { 
-    return Compare_y_2(this->base2());
-  }
-
-  Orientation_2 
-  orientation_2_object() const
-  {
-    return Orientation_2(this->normal()); 
-  }
-
-  Side_of_oriented_circle_2
-  side_of_oriented_circle_2_object() const
-  {
-    return Side_of_oriented_circle_2(this->normal());
-  }
-  
-  Compute_squared_distance_2
-  compute_squared_distance_2_object() const
-  {
-    return Compute_squared_distance_2(this->normal());
-  }
-  
-  Intersect_2
-  intersect_2_object () const
-  {
-    return Intersect_2(this->normal());
-  }
-
-  Angle_2  angle_2_object() const
-    {return Angle_2();}
-
-  Construct_segment_2  construct_segment_2_object() const
-    {return Construct_segment_2();}
-  
-  Construct_vector_2  construct_vector_2_object() const
-    {return Construct_vector_2();}
-
-  Construct_scaled_vector_2  construct_scaled_vector_2_object() const
-    {return Construct_scaled_vector_2();}
-
-  Construct_midpoint_2  construct_midpoint_2_object() const
-    {return Construct_midpoint_2();}
-
-  Construct_circumcenter_2  construct_circumcenter_2_object() const
-    {return Construct_circumcenter_2();}
-
-  Construct_translated_point_2  construct_translated_point_2_object() const
-    {return Construct_translated_point_2();}
-
-  Construct_line_2  construct_line_2_object() const
-    {return Construct_line_2();}
-  
-  Construct_triangle_2  construct_triangle_2_object() const
-    {return Construct_triangle_2();}
-
-  Compute_area_2 compute_area_2_object() const
-  {return Compute_area_2();}
-    
-
-
-  // Special functor, not in the Kernel concept
-  class Projection_to_plan {
-    // Remeber: Point_2 is K::Point_3
-    const Point_2& plane_point;
-    const Vector_3& normal;
-  public:
-    // Return the projection of a point to a plane passing through 
-    // the point 'plane_point' and with orthogonal vector normal().
-    Projection_to_plan(const Point_2& plane_point_, const Self& self)
-      : plane_point(plane_point_),
-        normal(self.normal())
-    {}
-
-    Point_2 operator()(const Point_2& point) const 
-    {
-      return point +
-        ( ( (plane_point - point) * normal ) / (normal * normal) ) * normal;
-    }
-  }; // end Projection_to_plan
-
-  Projection_to_plan projection_to_plan_object(const Point_2& plane_point) const
-  {
-    return Projection_to_plan(plane_point, *this);
-  }
-
-}; // end class Triangulation_2_projection_traits_3<Kernel>
-  
-
-} // end namespace CGAL
-
-#endif // CGAL_TRIANGULATION_2_PROJECTION_TRAITS_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_3.h b/3rdparty/CGAL-4.8/include/CGAL/Triangulation_3.h
deleted file mode 100644
index 743593c..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_3.h
+++ /dev/null
@@ -1,6687 +0,0 @@
-// Copyright (c) 1999-2003  INRIA Sophia-Antipolis (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
-// 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(s)     : Monique Teillaud <Monique.Teillaud at sophia.inria.fr>
-//                 Sylvain Pion
-//                 Clement Jamin
-
-#ifndef CGAL_TRIANGULATION_3_H
-#define CGAL_TRIANGULATION_3_H
-
-#include <CGAL/basic.h>
-
-#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
-# define CGAL_PROFILE
-# include <CGAL/Profile_counter.h>
-#endif
-
-#include <iostream>
-#include <list>
-#include <set>
-#include <map>
-#include <utility>
-#include <stack>
-
-#include <CGAL/Unique_hash_map.h>
-#include <CGAL/triangulation_assertions.h>
-#include <CGAL/Triangulation_utils_3.h>
-
-#include <CGAL/Triangulation_data_structure_3.h>
-#include <CGAL/Triangulation_cell_base_3.h>
-#include <CGAL/Triangulation_vertex_base_3.h>
-
-#include <CGAL/spatial_sort.h>
-
-#include <CGAL/iterator.h>
-#include <CGAL/function_objects.h>
-#include <CGAL/Iterator_project.h>
-#include <CGAL/Default.h>
-
-#include <CGAL/Bbox_3.h>
-#include <CGAL/Spatial_lock_grid_3.h>
-
-#include <boost/bind.hpp>
-#include <boost/random/linear_congruential.hpp>
-#include <boost/random/uniform_smallint.hpp>
-#include <boost/random/variate_generator.hpp>
-#include <boost/mpl/if.hpp>
-
-#ifndef CGAL_NO_STRUCTURAL_FILTERING
-#include <CGAL/internal/Static_filters/tools.h>
-#include <CGAL/Triangulation_structural_filtering_traits.h>
-#include <CGAL/determinant.h>
-#endif // no CGAL_NO_STRUCTURAL_FILTERING
-
-#ifdef CGAL_LINKED_WITH_TBB
-# include <tbb/scalable_allocator.h>
-#endif
-
-#define CGAL_TRIANGULATION_3_USE_THE_4_POINTS_CONSTRUCTOR
-
-namespace CGAL {
-
-template < class GT, class Tds = Default,
-           class Lock_data_structure = Default >
-class Triangulation_3;
-
-template < class GT, class Tds, class Lds > std::istream& operator>>
-(std::istream& is, Triangulation_3<GT,Tds,Lds> &tr);
-
-#ifndef CGAL_NO_STRUCTURAL_FILTERING
-namespace internal {
-// structural filtering is performed only for EPIC
-struct Structural_filtering_3_tag {};
-struct No_structural_filtering_3_tag {};
-
-template <bool filter>
-struct Structural_filtering_selector_3 {
-#ifdef FORCE_STRUCTURAL_FILTERING
-  typedef Structural_filtering_3_tag  Tag;
-#else
-  typedef No_structural_filtering_3_tag  Tag;
-#endif
-};
-
-template <>
-struct Structural_filtering_selector_3<true> {
-  typedef Structural_filtering_3_tag  Tag;
-};
-}
-#endif // no CGAL_NO_STRUCTURAL_FILTERING
-
-/************************************************
-// Class Triangulation_3_base
-// Two versions: Sequential (no locking) / Parallel (with locking)
-************************************************/
-
-// Sequential (without locking)
-template <typename Concurrency_tag, typename Lock_data_structure_>
-class Triangulation_3_base
-{
-public:
-  // If Lock_data_structure_ = Default => void
-  typedef typename Default::Get<
-    Lock_data_structure_, void>::type Lock_data_structure;
-
-protected:
-  Triangulation_3_base()  {}
-
-  Triangulation_3_base(Lock_data_structure *) {}
-
-  void swap(Triangulation_3_base<Concurrency_tag, Lock_data_structure_> &){}
-
-  template <typename Vertex_triple, typename Facet>
-  struct Vertex_triple_Facet_map_generator
-  {
-    typedef std::map<Vertex_triple, Facet> type;
-  };
-
-  template <typename Vertex_handle>
-  struct Vertex_handle_unique_hash_map_generator
-  {
-    typedef Unique_hash_map<Vertex_handle,
-                            Vertex_handle,
-                            Handle_hash_function> type;
-  };
-
-public:
-  bool is_parallel() const
-  {
-    return false;
-  }
-
-  // LOCKS (no-op functions)
-
-  template <typename Point_3>
-  bool try_lock_point(const Point_3 &, int = 0) const
-  { return true; }
-
-  template <typename Vertex_handle>
-  bool try_lock_vertex(const Vertex_handle &, int = 0) const
-  { return true; }
-
-  template <typename Cell_handle>
-  bool try_lock_cell(const Cell_handle &, int = 0) const
-  { return true; }
-
-  template <typename Facet>
-  bool try_lock_facet(const Facet &, int = 0) const
-  { return true; }
-
-  template <typename P3>
-  bool is_point_locked_by_this_thread(const P3 &) const
-  { return false; }
-
-  template <typename Cell_handle>
-  bool is_cell_locked_by_this_thread(const Cell_handle &) const
-  { return false; }
-
-  void *get_lock_data_structure() const
-  {
-    return 0;
-  }
-
-  void set_lock_data_structure(void *) const
-  {
-  }
-
-  void unlock_all_elements() const {}
-  template <typename P3> void unlock_all_elements_but_one_point(const P3 &) const {}
-
-  const Bbox_3 *get_bbox() const
-  {
-    return NULL;
-  }
-};
-
-#ifdef CGAL_LINKED_WITH_TBB
-// Parallel (with locking)
-template <typename Lock_data_structure_>
-class Triangulation_3_base<Parallel_tag, Lock_data_structure_>
-{
-public:
-  // If Lock_data_structure_ = Default => use Spatial_lock_grid_3
-  typedef typename Default::Get<
-    Lock_data_structure_, Spatial_lock_grid_3<Tag_priority_blocking> >
-    ::type Lock_data_structure;
-
-protected:
-  Triangulation_3_base()
-    : m_lock_ds(0) {}
-
-  Triangulation_3_base(Lock_data_structure *lock_ds)
-    : m_lock_ds(lock_ds) {}
-
-  void swap(Triangulation_3_base<Parallel_tag, Lock_data_structure_> &tr)
-  {
-    std::swap(tr.m_lock_ds, m_lock_ds);
-  }
-
-  template <typename Vertex_triple, typename Facet>
-  struct Vertex_triple_Facet_map_generator
-  {
-    typedef std::map
-    <
-      Vertex_triple,
-      Facet,
-      std::less<Vertex_triple>,
-      tbb::scalable_allocator<std::pair<const Vertex_triple, Facet> >
-    > type;
-  };
-
-  template <typename Vertex_handle>
-  struct Vertex_handle_unique_hash_map_generator
-  {
-    typedef Unique_hash_map<Vertex_handle,
-                            Vertex_handle,
-                            Handle_hash_function,
-                            tbb::scalable_allocator<Vertex_handle> > type;
-  };
-
-public:
-
-  bool is_parallel() const
-  {
-    return m_lock_ds != 0;
-  }
-
-  // LOCKS
-  template <typename Point_3>
-  bool try_lock_point(const Point_3 &p, int lock_radius = 0) const
-  {
-    bool locked = true;
-    if (m_lock_ds)
-    {
-      locked = m_lock_ds->try_lock(p, lock_radius);
-    }
-    return locked;
-  }
-
-  template <typename Vertex_handle>
-  bool try_lock_vertex(const Vertex_handle &vh, int lock_radius = 0) const
-  {
-    bool locked = true;
-    if (m_lock_ds)
-    {
-      locked = m_lock_ds->try_lock(vh->point(), lock_radius);
-    }
-    return locked;
-  }
-
-  template <typename Cell_handle>
-  bool try_lock_cell(const Cell_handle &cell_handle, int lock_radius = 0) const
-  {
-    bool success = true;
-    // Lock the element area on the grid
-    for (int iVertex = 0 ; success && iVertex < 4 ; ++iVertex)
-    {
-      success = try_lock_vertex(cell_handle->vertex(iVertex), lock_radius);
-    }
-    return success;
-  }
-
-  template <typename Facet>
-  bool try_lock_facet(const Facet &facet, int lock_radius = 0) const
-  {
-    bool success = true;
-
-    // Lock the element area on the grid
-    for (int iVertex = (facet.second+1)&3 ;
-          success && iVertex != facet.second ; iVertex = (iVertex+1)&3)
-    {
-      success = try_lock_vertex(facet.first->vertex(iVertex), lock_radius);
-    }
-
-    return success;
-  }
-
-  template <typename P3>
-  bool is_point_locked_by_this_thread(const P3 &p) const
-  {
-    bool locked = true;
-    if (m_lock_ds)
-    {
-      locked = m_lock_ds->is_locked_by_this_thread(p);
-    }
-    return locked;
-  }
-
-  template <typename Cell_handle>
-  bool is_cell_locked_by_this_thread(const Cell_handle &cell_handle) const
-  {
-    bool locked = true;
-    if (m_lock_ds)
-    {
-      for (int iVertex = 0 ; locked && iVertex < 4 ; ++iVertex)
-      {
-        locked = m_lock_ds->is_locked_by_this_thread(
-          cell_handle->vertex(iVertex)->point());
-      }
-    }
-    return locked;
-  }
-
-  Lock_data_structure *get_lock_data_structure() const
-  {
-    return m_lock_ds;
-  }
-
-  void set_lock_data_structure(Lock_data_structure *lock_ds) const
-  {
-    m_lock_ds = lock_ds;
-  }
-
-  void unlock_all_elements() const
-  {
-    if (m_lock_ds)
-      m_lock_ds->unlock_all_points_locked_by_this_thread();
-  }
-
-  template <typename P3>
-  void unlock_all_elements_but_one_point(const P3 &point) const
-  {
-    if (m_lock_ds)
-      m_lock_ds->unlock_all_tls_locked_locations_but_one_point(point);
-  }
-
-  const Bbox_3 *get_bbox() const
-  {
-    return &m_lock_ds->get_bbox();
-  }
-
-protected:
-  mutable Lock_data_structure *m_lock_ds;
-};
-#endif // CGAL_LINKED_WITH_TBB
-
-/************************************************
- *
- * Triangulation_3 class
- *
- ************************************************/
-
-template < class GT, class Tds_, class Lock_data_structure_ >
-class Triangulation_3
-  : public Triangulation_3_base<
-      // Get Concurrency_tag from TDS
-      typename Default::Get< Tds_,
-                             Triangulation_data_structure_3
-                             <
-                               Triangulation_vertex_base_3<GT>,
-                                     Triangulation_cell_base_3<GT>
-                             >
-                           >::type::Concurrency_tag,
-      Lock_data_structure_>
-  , public Triangulation_utils_3
-{
-  friend std::istream& operator>> <>
-  (std::istream& is, Triangulation_3<GT,Tds_,Lock_data_structure_> &tr);
-
-  typedef typename Default::Get<Tds_, Triangulation_data_structure_3 <
-                                          Triangulation_vertex_base_3<GT>,
-                                          Triangulation_cell_base_3<GT> > >::type Tds;
-
-  typedef Triangulation_3<GT, Tds_, Lock_data_structure_> Self;
-  typedef Triangulation_3_base<
-    typename Tds::Concurrency_tag, Lock_data_structure_>  Base;
-
-public:
-
-  typedef typename Base::Lock_data_structure   Lock_data_structure;
-  typedef Tds                                  Triangulation_data_structure;
-  typedef GT                                   Geom_traits;
-
-  typedef typename GT::Point_3                 Point;
-  typedef typename GT::Segment_3               Segment;
-  typedef typename GT::Triangle_3              Triangle;
-  typedef typename GT::Tetrahedron_3           Tetrahedron;
-
-  typedef typename Tds::Concurrency_tag        Concurrency_tag;
-
-  typedef typename Tds::Vertex                 Vertex;
-  typedef typename Tds::Cell                   Cell;
-  typedef typename Tds::Facet                  Facet;
-  typedef typename Tds::Edge                   Edge;
-
-  typedef typename Tds::size_type              size_type;
-  typedef typename Tds::difference_type        difference_type;
-
-  typedef typename Tds::Vertex_handle          Vertex_handle;
-  typedef typename Tds::Cell_handle            Cell_handle;
-
-  typedef typename Tds::Cell_circulator        Cell_circulator;
-  typedef typename Tds::Facet_circulator       Facet_circulator;
-
-  // Not documented, see TDS.
-  typedef typename Tds::Face_circulator        Face_circulator;
-
-  typedef typename Tds::Cell_iterator          Cell_iterator;
-  typedef typename Tds::Facet_iterator         Facet_iterator;
-  typedef typename Tds::Edge_iterator          Edge_iterator;
-  typedef typename Tds::Vertex_iterator        Vertex_iterator;
-
-  typedef Cell_iterator                        All_cells_iterator;
-  typedef Facet_iterator                       All_facets_iterator;
-  typedef Edge_iterator                        All_edges_iterator;
-  typedef Vertex_iterator                      All_vertices_iterator;
-
-  typedef typename Tds::Simplex                Simplex;
-private:
-  // This class is used to generate the Finite_*_iterators.
-  class Infinite_tester
-  {
-      const Self *t;
-
-  public:
-
-      Infinite_tester() {}
-
-      Infinite_tester(const Self *tr)
-          : t(tr) {}
-
-      bool operator()(const Vertex_iterator & v) const
-      {
-          return t->is_infinite(v);
-      }
-
-      bool operator()(typename std::vector<Vertex_handle>::const_iterator v) const
-      {
-              return t->is_infinite(*v);
-      }
-
-      bool operator()(const Cell_iterator & c) const
-      {
-          return t->is_infinite(c);
-      }
-
-      bool operator()(const Edge_iterator & e) const
-      {
-          return t->is_infinite(*e);
-      }
-
-      bool operator()(const Facet_iterator & f) const
-      {
-          return t->is_infinite(*f);
-      }
-  };
-
-public:
-
-  // We derive in order to add a conversion to handle.
-  class Finite_cells_iterator
-    : public Filter_iterator<Cell_iterator, Infinite_tester> {
-    typedef Filter_iterator<Cell_iterator, Infinite_tester> Base;
-    typedef Finite_cells_iterator                           Self;
-  public:
-
-    Finite_cells_iterator() : Base() {}
-    Finite_cells_iterator(const Base &b) : Base(b) {}
-
-    Self & operator++() { Base::operator++(); return *this; }
-    Self & operator--() { Base::operator--(); return *this; }
-    Self operator++(int) { Self tmp(*this); ++(*this); return tmp; }
-    Self operator--(int) { Self tmp(*this); --(*this); return tmp; }
-
-    operator Cell_handle() const { return Base::base(); }
-  };
-
-  // We derive in order to add a conversion to handle.
-  class Finite_vertices_iterator
-    : public Filter_iterator<Vertex_iterator, Infinite_tester> {
-    typedef Filter_iterator<Vertex_iterator, Infinite_tester> Base;
-    typedef Finite_vertices_iterator                          Self;
-  public:
-
-    Finite_vertices_iterator() : Base() {}
-    Finite_vertices_iterator(const Base &b) : Base(b) {}
-
-    Self & operator++() { Base::operator++(); return *this; }
-    Self & operator--() { Base::operator--(); return *this; }
-    Self operator++(int) { Self tmp(*this); ++(*this); return tmp; }
-    Self operator--(int) { Self tmp(*this); --(*this); return tmp; }
-
-    operator Vertex_handle() const { return Base::base(); }
-  };
-
-  typedef Filter_iterator<Edge_iterator, Infinite_tester>
-                                               Finite_edges_iterator;
-  typedef Filter_iterator<Facet_iterator, Infinite_tester>
-                                               Finite_facets_iterator;
-
-private:
-  // Auxiliary iterators for convenience
-  // do not use default template argument to please VC++
-  typedef Project_point<Vertex>                           Proj_point;
-public:
-  typedef Iterator_project<Finite_vertices_iterator,
-                           Proj_point,
-                           const Point&,
-                           const Point*,
-                           std::ptrdiff_t,
-                           std::bidirectional_iterator_tag>  Point_iterator;
-
-  typedef Point                         value_type; // to have a back_inserter
-  typedef const value_type&             const_reference;
-
-  //Tag to distinguish triangulations with weighted_points
-  typedef Tag_false  Weighted_tag;
-
-
-
-  enum Locate_type {
-    VERTEX=0,
-    EDGE, //1
-    FACET, //2
-    CELL, //3
-    OUTSIDE_CONVEX_HULL, //4
-    OUTSIDE_AFFINE_HULL };//5
-
-protected:
-  Tds _tds;
-  GT  _gt;
-  Vertex_handle infinite; //infinite vertex
-
-  Comparison_result
-  compare_xyz(const Point &p, const Point &q) const
-  {
-      return geom_traits().compare_xyz_3_object()(p, q);
-  }
-
-  bool
-  equal(const Point &p, const Point &q) const
-  {
-      return compare_xyz(p, q) == EQUAL;
-  }
-
-  Orientation
-  orientation(const Point &p, const Point &q,
-              const Point &r, const Point &s) const
-  {
-      return geom_traits().orientation_3_object()(p, q, r, s);
-  }
-
-  bool
-  coplanar(const Point &p, const Point &q,
-           const Point &r, const Point &s) const
-  {
-      return orientation(p, q, r, s) == COPLANAR;
-  }
-
-  Orientation
-  coplanar_orientation(const Point &p, const Point &q, const Point &r) const
-  {
-      return geom_traits().coplanar_orientation_3_object()(p, q, r);
-  }
-
-  bool
-  collinear(const Point &p, const Point &q, const Point &r) const
-  {
-      return coplanar_orientation(p, q, r) == COLLINEAR;
-  }
-
-  Segment
-  construct_segment(const Point &p, const Point &q) const
-  {
-      return geom_traits().construct_segment_3_object()(p, q);
-  }
-
-  Triangle
-  construct_triangle(const Point &p, const Point &q, const Point &r) const
-  {
-      return geom_traits().construct_triangle_3_object()(p, q, r);
-  }
-
-  Tetrahedron
-  construct_tetrahedron(const Point &p, const Point &q,
-                        const Point &r, const Point &s) const
-  {
-      return geom_traits().construct_tetrahedron_3_object()(p, q, r, s);
-  }
-
-  enum COLLINEAR_POSITION {BEFORE, SOURCE, MIDDLE, TARGET, AFTER};
-
-  COLLINEAR_POSITION
-  collinear_position(const Point &s, const Point &p, const Point &t) const
-  // (s,t) defines a line, p is on that line.
-  // Depending on the position of p wrt s and t, returns :
-  // --------------- s ---------------- t --------------
-  // BEFORE       SOURCE    MIDDLE    TARGET       AFTER
-  {
-      CGAL_triangulation_precondition(!equal(s, t));
-      CGAL_triangulation_precondition(collinear(s, p, t));
-
-      Comparison_result ps = compare_xyz(p, s);
-      if (ps == EQUAL)
-          return SOURCE;
-      Comparison_result st = compare_xyz(s, t);
-      if (ps == st)
-          return BEFORE;
-      Comparison_result pt = compare_xyz(p, t);
-      if (pt == EQUAL)
-          return TARGET;
-      if (pt == st)
-          return MIDDLE;
-      return AFTER;
-  }
-
-  void init_tds()
-    {
-      infinite = _tds.insert_increase_dimension();
-    }
-
-  void init_tds(const Point &p0, const Point &p1,
-                const Point &p2, const Point &p3)
-  {
-    Vertex_handle v0, v1, v2, v3;
-    infinite = _tds.insert_first_finite_cell(v0, v1, v2, v3, infinite);
-    v0->set_point(p0);
-    v1->set_point(p1);
-    v2->set_point(p2);
-    v3->set_point(p3);
-  }
-
-  void init_tds(const Point &p0, const Point &p1,
-                const Point &p2, const Point &p3,
-                Vertex_handle &vh0, Vertex_handle &vh1,
-                Vertex_handle &vh2, Vertex_handle &vh3)
-  {
-    infinite = _tds.insert_first_finite_cell(vh0, vh1, vh2, vh3, infinite);
-    vh0->set_point(p0);
-    vh1->set_point(p1);
-    vh2->set_point(p2);
-    vh3->set_point(p3);
-  }
-
-public:
-
-  // CONSTRUCTORS
-  Triangulation_3(const GT & gt = GT(), Lock_data_structure *lock_ds = NULL)
-    : Base(lock_ds), _tds(), _gt(gt)
-    {
-      init_tds();
-    }
-
-  Triangulation_3(Lock_data_structure *lock_ds, const GT & gt = GT())
-    : Base(lock_ds), _tds(), _gt(gt)
-    {
-      init_tds();
-    }
-
-  // copy constructor duplicates vertices and cells
-  Triangulation_3(const Triangulation_3 & tr)
-    : Base(tr.get_lock_data_structure()), _gt(tr._gt)
-    {
-      infinite = _tds.copy_tds(tr._tds, tr.infinite);
-      CGAL_triangulation_expensive_postcondition(*this == tr);
-    }
-
-  template < typename InputIterator >
-  Triangulation_3(InputIterator first, InputIterator last,
-                  const GT & gt = GT(), Lock_data_structure *lock_ds = NULL)
-    : Base(lock_ds), _gt(gt)
-    {
-      init_tds();
-      insert(first, last);
-    }
-
-  // Create the 3D triangulation of p0, p1, p3 and p4
-  // Precondition: p0, p1, p3 and p4 MUST BE positively oriented
-  Triangulation_3(const Point &p0, const Point &p1,
-                  const Point &p3, const Point &p4,
-                  const GT & gt = GT(), Lock_data_structure *lock_ds = NULL)
-    : Base(lock_ds), _gt(gt)
-    {
-      CGAL_triangulation_precondition(orientation(p0, p1, p3, p4) == POSITIVE);
-      init_tds(p0, p1, p3, p4);
-    }
-
-  void clear()
-    {
-      _tds.clear();
-      init_tds();
-    }
-
-  Triangulation_3 & operator=(Triangulation_3 tr)
-    {
-      // The triangulation passed as argument has been copied,
-      // because the parameter tr is passed by value. Then the following
-      // swap consumes the *copy*. The original triangulation is left
-      // untouched.
-      swap(tr);
-      return *this;
-    }
-
-  // HELPING FUNCTIONS
-
-  void swap(Triangulation_3 &tr)
-    {
-      std::swap(tr._gt, _gt);
-      std::swap(tr.infinite, infinite);
-      _tds.swap(tr._tds);
-      Base::swap(tr);
-    }
-
-  //ACCESS FUNCTIONS
-  const GT & geom_traits() const
-    { return _gt;}
-
-  const Tds & tds() const
-    { return _tds;}
-
-  Tds & tds()
-    { return _tds;}
-
-  int dimension() const
-    { return _tds.dimension();}
-
-  size_type number_of_finite_cells() const;
-
-  size_type number_of_cells() const;
-
-  size_type number_of_finite_facets() const;
-
-  size_type number_of_facets() const;
-
-  size_type number_of_finite_edges() const;
-
-  size_type number_of_edges() const;
-
-  size_type number_of_vertices() const // number of finite vertices
-    {return _tds.number_of_vertices()-1;}
-
-  Vertex_handle infinite_vertex() const
-    { return infinite; }
-
-  void set_infinite_vertex(Vertex_handle v)
-    { infinite=v;}
-
-  Cell_handle infinite_cell() const
-    {
-      CGAL_triangulation_assertion(infinite_vertex()->cell()->
-                                   has_vertex(infinite_vertex()));
-      return infinite_vertex()->cell();
-    }
-
-  // GEOMETRIC ACCESS FUNCTIONS
-
-  Tetrahedron tetrahedron(const Cell_handle c) const
-    {
-      CGAL_triangulation_precondition( dimension() == 3 );
-      CGAL_triangulation_precondition( ! is_infinite(c) );
-      return construct_tetrahedron(c->vertex(0)->point(),
-                                   c->vertex(1)->point(),
-                                   c->vertex(2)->point(),
-                                   c->vertex(3)->point());
-    }
-
-  Triangle triangle(const Cell_handle c, int i) const;
-
-  Triangle triangle(const Facet & f) const
-    { return triangle(f.first, f.second); }
-
-  Segment segment(const Cell_handle c, int i, int j) const;
-
-  Segment segment(const Edge & e) const
-    { return segment(e.first,e.second,e.third); }
-
-  const Point & point(Cell_handle c, int i) const {
-    CGAL_triangulation_precondition( dimension() >= 0 );
-    CGAL_triangulation_precondition( i >= 0 && i <= dimension() );
-    CGAL_triangulation_precondition( ! is_infinite(c->vertex(i)) );
-    return c->vertex(i)->point();
-  }
-
-  const Point & point(Vertex_handle v) const {
-    CGAL_triangulation_precondition( dimension() >= 0 );
-    CGAL_triangulation_precondition( ! is_infinite(v) );
-    return v->point();
-  }
-
-  // TEST IF INFINITE FEATURES
-  bool is_infinite(const Vertex_handle v) const
-  { return v == infinite_vertex(); }
-
-  bool is_infinite(const Cell_handle c) const
-    {
-      CGAL_triangulation_precondition( dimension() == 3 );
-      return c->has_vertex(infinite_vertex());
-    }
-
-  bool is_infinite(const Cell_handle c, int i) const;
-
-  bool is_infinite(const Facet & f) const
-    { return is_infinite(f.first,f.second); }
-
-  bool is_infinite(const Cell_handle c, int i, int j) const;
-
-  bool is_infinite(const Edge & e) const
-    { return is_infinite(e.first,e.second,e.third); }
-
-  //QUERIES
-
-  bool is_vertex(const Point & p, Vertex_handle & v) const;
-
-  bool is_vertex(Vertex_handle v) const;
-  bool is_edge(Vertex_handle u, Vertex_handle v,
-               Cell_handle & c, int & i, int & j) const;
-  bool is_facet(Vertex_handle u, Vertex_handle v, Vertex_handle w,
-                Cell_handle & c, int & i, int & j, int & k) const;
-  bool is_cell(Cell_handle c) const;
-  bool is_cell(Vertex_handle u, Vertex_handle v,
-               Vertex_handle w, Vertex_handle t,
-               Cell_handle & c, int & i, int & j, int & k, int & l) const;
-  bool is_cell(Vertex_handle u, Vertex_handle v,
-               Vertex_handle w, Vertex_handle t,
-               Cell_handle & c) const;
-
-  bool has_vertex(const Facet & f, Vertex_handle v, int & j) const;
-  bool has_vertex(Cell_handle c, int i, Vertex_handle v, int & j) const;
-  bool has_vertex(const Facet & f, Vertex_handle v) const;
-  bool has_vertex(Cell_handle c, int i, Vertex_handle v) const;
-
-  bool are_equal(Cell_handle c, int i, Cell_handle n, int j) const;
-  bool are_equal(const Facet & f, const Facet & g) const;
-  bool are_equal(const Facet & f, Cell_handle n, int j) const;
-
-#ifdef CGAL_NO_STRUCTURAL_FILTERING
-  Cell_handle
-  locate(const Point & p,
-         Locate_type & lt, int & li, int & lj,
-         Cell_handle start = Cell_handle(),
-         bool *could_lock_zone = NULL) const;
-#else // no CGAL_NO_STRUCTURAL_FILTERING
-#  ifndef CGAL_T3_STRUCTURAL_FILTERING_MAX_VISITED_CELLS
-#    define CGAL_T3_STRUCTURAL_FILTERING_MAX_VISITED_CELLS 2500
-#  endif // no CGAL_T3_STRUCTURAL_FILTERING_MAX_VISITED_CELLS
-
-
-public:
-  Cell_handle
-  inexact_locate(const Point& p,
-                 Cell_handle start = Cell_handle(),
-                 int max_num_cells = CGAL_T3_STRUCTURAL_FILTERING_MAX_VISITED_CELLS,
-                 bool *could_lock_zone = NULL) const;
-protected:
-  Cell_handle
-  exact_locate(const Point& p,
-               Locate_type& lt,
-               int& li, int & lj,
-               Cell_handle start,
-               bool *could_lock_zone = NULL
-               ) const;
-
-  Cell_handle
-  generic_locate(const Point& p,
-                 Locate_type& lt,
-                 int& li, int & lj,
-                 Cell_handle start,
-                 internal::Structural_filtering_3_tag,
-                 bool *could_lock_zone = NULL) const
-  {
-    Cell_handle ch = inexact_locate(
-      p, start, CGAL_T3_STRUCTURAL_FILTERING_MAX_VISITED_CELLS, could_lock_zone);
-    if (could_lock_zone && *could_lock_zone == false)
-      return ch; // = Cell_handle() here
-    else
-      return exact_locate(p, lt, li, lj, ch, could_lock_zone);
-  }
-
-  Cell_handle
-  generic_locate(const Point& p,
-                 Locate_type& lt,
-                 int& li, int & lj,
-                 Cell_handle start,
-                 internal::No_structural_filtering_3_tag
-                 , bool *could_lock_zone = NULL) const
-  {
-    return exact_locate(p, lt, li, lj, start, could_lock_zone);
-  }
-
-public:
-  Orientation
-  inexact_orientation(const Point &p, const Point &q,
-                      const Point &r, const Point &s) const
-  {
-  // So that this code works well with Lazy_kernel
-  internal::Static_filters_predicates::Get_approx<Point> get_approx;
-    const double px = to_double(get_approx(p).x());
-    const double py = to_double(get_approx(p).y());
-    const double pz = to_double(get_approx(p).z());
-    const double qx = to_double(get_approx(q).x());
-    const double qy = to_double(get_approx(q).y());
-    const double qz = to_double(get_approx(q).z());
-    const double rx = to_double(get_approx(r).x());
-    const double ry = to_double(get_approx(r).y());
-    const double rz = to_double(get_approx(r).z());
-    const double sx = to_double(get_approx(s).x());
-    const double sy = to_double(get_approx(s).y());
-    const double sz = to_double(get_approx(s).z());
-
-    const double pqx = qx - px;
-    const double pqy = qy - py;
-    const double pqz = qz - pz;
-    const double prx = rx - px;
-    const double pry = ry - py;
-    const double prz = rz - pz;
-    const double psx = sx - px;
-    const double psy = sy - py;
-    const double psz = sz - pz;
-
-    const double det = determinant(pqx, pqy, pqz,
-                                   prx, pry, prz,
-                                   psx, psy, psz);
-    if (det > 0) return POSITIVE;
-    if (det < 0) return NEGATIVE;
-    return ZERO;
-  }
-
-public:
-
-  Cell_handle
-  locate(const Point & p,
-         Locate_type & lt, int & li, int & lj,
-         Cell_handle start = Cell_handle()
-         , bool *could_lock_zone = NULL
-         ) const
-  {
-    typedef Triangulation_structural_filtering_traits<Geom_traits> TSFT;
-    typedef typename internal::Structural_filtering_selector_3<
-      TSFT::Use_structural_filtering_tag::value >::Tag Should_filter_tag;
-
-    return generic_locate(p, lt, li, lj, start, Should_filter_tag(), could_lock_zone);
-  }
-#endif // no CGAL_NO_STRUCTURAL_FILTERING
-
-  Cell_handle
-  locate(const Point & p, Cell_handle start = Cell_handle(),
-         bool *could_lock_zone = NULL) const
-  {
-      Locate_type lt;
-      int li, lj;
-      return locate( p, lt, li, lj, start, could_lock_zone);
-  }
-
-  Cell_handle
-  locate(const Point & p,
-         Locate_type & lt, int & li, int & lj, Vertex_handle hint,
-   bool *could_lock_zone = NULL) const
-  {
-      return locate(p, lt, li, lj,
-        hint == Vertex_handle() ? infinite_cell() : hint->cell(),
-        could_lock_zone);
-  }
-
-  Cell_handle
-  locate(const Point & p, Vertex_handle hint,
-         bool *could_lock_zone = NULL) const
-    {
-      return locate(p, hint == Vertex_handle() ? infinite_cell() : hint->cell(),
-        could_lock_zone);
-  }
-
-  // PREDICATES ON POINTS ``TEMPLATED'' by the geom traits
-
-  Bounded_side
-  side_of_tetrahedron(const Point & p,
-                      const Point & p0,
-                      const Point & p1,
-                      const Point & p2,
-                      const Point & p3,
-                      Locate_type & lt, int & i, int & j ) const;
-  Bounded_side
-  side_of_cell(const Point & p,
-               Cell_handle c,
-               Locate_type & lt, int & i, int & j) const;
-  Bounded_side
-  side_of_triangle(const Point & p,
-                   const Point & p0, const Point & p1, const Point & p2,
-                   Locate_type & lt, int & i, int & j ) const;
-  Bounded_side
-  side_of_facet(const Point & p,
-                Cell_handle c,
-                Locate_type & lt, int & li, int & lj) const;
-  Bounded_side
-  side_of_facet(const Point & p,
-                const Facet & f,
-                Locate_type & lt, int & li, int & lj) const
-    {
-      CGAL_triangulation_precondition( f.second == 3 );
-      return side_of_facet(p, f.first, lt, li, lj);
-    }
-  Bounded_side
-  side_of_segment(const Point & p,
-                  const Point & p0, const Point & p1,
-                  Locate_type & lt, int & i ) const;
-  Bounded_side
-  side_of_edge(const Point & p,
-               Cell_handle c,
-               Locate_type & lt, int & li) const;
-  Bounded_side
-  side_of_edge(const Point & p,
-               const Edge & e,
-               Locate_type & lt, int & li) const
-    {
-      CGAL_triangulation_precondition( e.second == 0 );
-      CGAL_triangulation_precondition( e.third == 1 );
-      return side_of_edge(p, e.first, lt, li);
-    }
-
-  // Functions forwarded from TDS.
-  int mirror_index(Cell_handle c, int i) const
-  { return _tds.mirror_index(c, i); }
-
-  Vertex_handle mirror_vertex(Cell_handle c, int i) const
-  { return _tds.mirror_vertex(c, i); }
-
-  Facet mirror_facet(Facet f) const
-  { return _tds.mirror_facet(f);}
-
-  // MODIFIERS
-  bool flip(const Facet &f)
-  // returns false if the facet is not flippable
-  // true other wise and
-  // flips facet i of cell c
-  // c will be replaced by one of the new cells
-  {
-    return flip( f.first, f.second);
-  }
-  bool flip(Cell_handle c, int i);
-  void flip_flippable(const Facet &f)
-  {
-    flip_flippable( f.first, f.second);
-  }
-  void flip_flippable(Cell_handle c, int i);
-  bool flip(const Edge &e)
-  // returns false if the edge is not flippable
-  // true otherwise and
-  // flips edge i,j of cell c
-  // c will be deleted
-  {
-    return flip( e.first, e.second, e.third );
-  }
-  bool flip(Cell_handle c, int i, int j);
-  void flip_flippable(const Edge &e)
-  {
-    flip_flippable( e.first, e.second, e.third );
-  }
-  void flip_flippable(Cell_handle c, int i, int j);
-
-  //INSERTION
-
-  Vertex_handle insert(const Point & p, Vertex_handle hint)
-  {
-    return insert(p, hint == Vertex_handle() ? infinite_cell() : hint->cell());
-  }
-  Vertex_handle insert(const Point & p, Cell_handle start = Cell_handle());
-  Vertex_handle insert(const Point & p, Locate_type lt, Cell_handle c,
-                       int li, int lj);
-
-//protected: // internal methods
-
-  template <class OutputItCells>
-  Vertex_handle insert_and_give_new_cells(const Point  &p,
-                                          OutputItCells fit,
-                                          Cell_handle start = Cell_handle() );
-
-  template <class OutputItCells>
-  Vertex_handle insert_and_give_new_cells(const Point& p,
-                                          OutputItCells fit,
-                                          Vertex_handle hint);
-
-  template <class OutputItCells>
-  Vertex_handle insert_and_give_new_cells(const Point& p,
-                                          Locate_type lt,
-                                          Cell_handle c, int li, int lj,
-                                          OutputItCells fit);
-
-  template < class Conflict_tester, class Hidden_points_visitor >
-  inline Vertex_handle insert_in_conflict(const Point & p,
-                                          Locate_type lt,
-                                          Cell_handle c, int li, int lj,
-                                          const Conflict_tester &tester,
-                                          Hidden_points_visitor &hider,
-                                          bool *could_lock_zone = NULL);
-
-  template < class InputIterator >
-  std::ptrdiff_t insert(InputIterator first, InputIterator last)
-    {
-      size_type n = number_of_vertices();
-
-      std::vector<Point> points (first, last);
-      spatial_sort (points.begin(), points.end(), geom_traits());
-
-      Vertex_handle hint;
-      for (typename std::vector<Point>::const_iterator p = points.begin(), end = points.end();
-              p != end; ++p)
-          hint = insert(*p, hint);
-
-      return number_of_vertices() - n;
-    }
-
-  Vertex_handle
-  insert_in_cell(const Point & p, Cell_handle c);
-
-  Vertex_handle
-  insert_in_facet(const Point & p, Cell_handle c, int i);
-
-  Vertex_handle
-  insert_in_facet(const Point & p, const Facet & f)
-    {
-      return insert_in_facet(p, f.first, f.second);
-    }
-
-  Vertex_handle
-  insert_in_edge(const Point & p, Cell_handle c, int i, int j);
-
-  Vertex_handle
-  insert_in_edge(const Point & p, const Edge & e)
-    {
-      return insert_in_edge(p, e.first, e.second, e.third);
-    }
-
-  Vertex_handle
-  insert_outside_convex_hull(const Point & p, Cell_handle c);
-
-  Vertex_handle
-  insert_outside_affine_hull(const Point & p);
-
-  template <class CellIt>
-  Vertex_handle
-  insert_in_hole(const Point & p, CellIt cell_begin, CellIt cell_end,
-                 Cell_handle begin, int i)
-  {
-      // Some geometric preconditions should be tested...
-      Vertex_handle v = _tds.insert_in_hole(cell_begin, cell_end, begin, i);
-      v->set_point(p);
-      return v;
-  }
-
-  template <class CellIt>
-  Vertex_handle
-  insert_in_hole(const Point & p, CellIt cell_begin, CellIt cell_end,
-                 Cell_handle begin, int i, Vertex_handle newv)
-  {
-      // Some geometric preconditions should be tested...
-      newv->set_point(p);
-      return _tds.insert_in_hole(cell_begin, cell_end, begin, i, newv);
-  }
-
-  // Internal function, cells should already be marked.
-  template <class CellIt>
-  Vertex_handle
-  _insert_in_hole(const Point & p, CellIt cell_begin, CellIt cell_end,
-                  Cell_handle begin, int i)
-  {
-      // Some geometric preconditions should be tested...
-      Vertex_handle v = _tds._insert_in_hole(cell_begin, cell_end, begin, i);
-      v->set_point(p);
-      return v;
-  }
-
-  // Internal function, cells should already be marked.
-  template <class CellIt>
-  Vertex_handle
-  _insert_in_hole(const Point & p, CellIt cell_begin, CellIt cell_end,
-                  Cell_handle begin, int i, Vertex_handle newv)
-  {
-      // Some geometric preconditions should be tested...
-      newv->set_point(p);
-      return _tds._insert_in_hole(cell_begin, cell_end, begin, i, newv);
-  }
-
-protected:
-
-  template < class InputIterator >
-  bool does_repeat_in_range(InputIterator first, InputIterator beyond) const;
-
-  template < class InputIterator >
-  bool infinite_vertex_in_range(InputIterator first, InputIterator beyond) const;
-
-
-  // - c is the current cell, which must be in conflict.
-  // - tester is the function object that tests if a cell is in conflict.
-  template <class Conflict_test,
-            class OutputIteratorBoundaryFacets,
-            class OutputIteratorCells,
-            class OutputIteratorInternalFacets>
-  Triple<OutputIteratorBoundaryFacets,
-         OutputIteratorCells,
-         OutputIteratorInternalFacets>
-  find_conflicts(
-     Cell_handle d,
-     const Conflict_test &tester,
-     Triple<OutputIteratorBoundaryFacets,
-     OutputIteratorCells,
-     OutputIteratorInternalFacets> it
-     , bool *could_lock_zone = NULL
-     , const Facet *this_facet_must_be_in_the_cz = NULL
-     , bool *the_facet_is_in_its_cz = NULL
-     ) const
-  {
-    CGAL_triangulation_precondition( dimension()>=2 );
-
-    if (the_facet_is_in_its_cz)
-      *the_facet_is_in_its_cz = false;
-
-    if (could_lock_zone)
-      *could_lock_zone = true;
-
-    if (could_lock_zone)
-    {
-      if (!this->try_lock_cell(d))
-      {
-        *could_lock_zone = false;
-        return it;
-      }
-    }
-
-    CGAL_triangulation_precondition( tester(d) );
-
-    // To store the boundary cells, in case we need to rollback
-    std::stack<Cell_handle> cell_stack;
-    cell_stack.push(d);
-    d->tds_data().mark_in_conflict();
-
-    *it.second++ = d;
-
-    do {
-      Cell_handle c = cell_stack.top();
-      cell_stack.pop();
-
-      // For each neighbor cell
-      for (int i=0; i<dimension()+1; ++i) {
-        Cell_handle test = c->neighbor(i);
-
-        // "test" is either in the conflict zone,
-        // either facet-adjacent to the CZ
-
-        if (test->tds_data().is_in_conflict()) {
-
-          Facet f(c, i); // Internal facet.
-          // Is it the facet where're looking for?
-          if (this_facet_must_be_in_the_cz && the_facet_is_in_its_cz
-            && f == *this_facet_must_be_in_the_cz)
-          {
-            *the_facet_is_in_its_cz = true;
-          }
-          if (c < test)
-          {
-            *it.third++ = f;
-          }
-          continue; // test was already in conflict.
-        }
-        if (test->tds_data().is_clear()) {
-            if (tester(test)) {
-
-            // "test" is in the conflict zone
-            if (could_lock_zone)
-            {
-              if (!this->try_lock_cell(test))
-              {
-                *could_lock_zone = false;
-                // Unlock
-                return it;
-              }
-            }
-
-
-            Facet f(c, i); // Internal facet.
-            // Is it the facet where're looking for?
-            if (this_facet_must_be_in_the_cz && the_facet_is_in_its_cz
-              && f == *this_facet_must_be_in_the_cz)
-            {
-              *the_facet_is_in_its_cz = true;
-            }
-
-            if (c < test)
-            {
-              *it.third++ = f;
-            }
-
-            cell_stack.push(test);
-            test->tds_data().mark_in_conflict();
-            *it.second++ = test;
-            continue;
-          }
-
-          test->tds_data().mark_on_boundary();
-        }
-
-        Facet f(c, i); // Boundary facet.
-        // Is it the facet where're looking for?
-        if (this_facet_must_be_in_the_cz
-            && the_facet_is_in_its_cz
-            &&
-            (mirror_facet(f) == *this_facet_must_be_in_the_cz
-             || f == *this_facet_must_be_in_the_cz) )
-        {
-          *the_facet_is_in_its_cz = true;
-        }
-
-        *it.first++ = f;
-      }
-    } while (!cell_stack.empty());
-    return it;
-  }
-
-  // This one takes a function object to recursively determine the cells in
-  // conflict, then calls _tds._insert_in_hole().
-  template < class Conflict_test >
-  Vertex_handle
-  insert_conflict(Cell_handle c, const Conflict_test &tester)
-  {
-    CGAL_triangulation_precondition( dimension() >= 2 );
-    CGAL_triangulation_precondition( c != Cell_handle() );
-    CGAL_triangulation_precondition( tester(c) );
-
-    std::vector<Cell_handle> cells;
-    cells.reserve(32);
-
-    Facet facet;
-
-    // Find the cells in conflict
-    switch (dimension()) {
-    case 3:
-      find_conflicts(c, tester, make_triple(Oneset_iterator<Facet>(facet),
-                                            std::back_inserter(cells),
-                                            Emptyset_iterator()));
-      break;
-    case 2:
-      find_conflicts(c, tester, make_triple(Oneset_iterator<Facet>(facet),
-                                            std::back_inserter(cells),
-                                            Emptyset_iterator()));
-    }
-    // Create the new cells and delete the old.
-    return _tds._insert_in_hole(cells.begin(), cells.end(),
-                                  facet.first, facet.second);
-  }
-
-private:
-  // Here are the conflit tester function objects passed to
-  // insert_conflict_[23]() by insert_outside_convex_hull().
-  class Conflict_tester_outside_convex_hull_3
-  {
-      const Point &p;
-      const Self *t;
-
-  public:
-
-      Conflict_tester_outside_convex_hull_3(const Point &pt, const Self *tr)
-          : p(pt), t(tr) {}
-
-      bool operator()(const Cell_handle c) const
-      {
-          Locate_type loc;
-          int i, j;
-          return t->side_of_cell( p, c, loc, i, j ) == ON_BOUNDED_SIDE;
-      }
-  };
-
-  class Conflict_tester_outside_convex_hull_2
-  {
-      const Point &p;
-      const Self *t;
-
-  public:
-
-      Conflict_tester_outside_convex_hull_2(const Point &pt, const Self *tr)
-          : p(pt), t(tr) {}
-
-      bool operator()(const Cell_handle c) const
-      {
-          Locate_type loc;
-          int i, j;
-          return t->side_of_facet( p, c, loc, i, j ) == ON_BOUNDED_SIDE;
-      }
-  };
-
-protected:
-
-  // no point being private, we might need to test
-  // whether a displacement decreases dimension on
-  // others inherited triangulations
-  bool test_dim_down(Vertex_handle v) const;
-
-  bool test_dim_down_using_incident_cells_3(
-    Vertex_handle v, std::vector<Cell_handle> &incident_cells,
-    std::vector<Vertex_handle> &adj_vertices,
-    bool *could_lock_zone = NULL) const;
-
-  // REMOVAL
-  template < class VertexRemover >
-  void remove(Vertex_handle v, VertexRemover &remover);
-  template < class VertexRemover >
-  // Concurrency-safe version
-  // Pre-condition: dimension = 3
-  // The return value is only meaningful if *could_lock_zone = true:
-  // * returns true if the vertex was removed
-  // * returns false if the vertex wasn't removed since it would decrease
-  //   the dimension => needs to be done sequentially
-  bool remove(Vertex_handle v, VertexRemover &remover,
-              bool *could_lock_zone);
-
-  template < class VertexRemover, class OutputItCells >
-  void remove_and_give_new_cells(Vertex_handle v, VertexRemover &remover,
-                                 OutputItCells fit);
-
-  // This function removes a batch of points at once.
-  // If points are grouped in cluster, the performance is increased
-  // compared to removing one by one.
-  // For now, this function is only guaranteed for Delaunay triangulations (or Regular as Delaunay).
-  // By doing these kind of remove followed by inserting the cluster,
-  // we achieve fast relocations for a batch of points (in a Delaunay triangulation).
-  template < class InputIterator, class VertexRemover >
-  size_type remove(InputIterator first, InputIterator beyond,
-                   VertexRemover &remover);
-  enum REMOVE_VERTEX_STATE {CLEAR, TO_REMOVE, PROCESSED, EXTREMITY};
-
-  // MOVE
-  template < class VertexRemover, class VertexInserter >
-  Vertex_handle move_if_no_collision(Vertex_handle v, const Point &p,
-                                     VertexRemover &remover,
-                                     VertexInserter &inserter);
-
-  template < class VertexRemover, class VertexInserter >
-  Vertex_handle move(Vertex_handle v, const Point &p,
-                     VertexRemover &remover, VertexInserter &inserter);
-
-  // move and give new cells
-  template < class VertexRemover, class VertexInserter, class OutputItCells  >
-  Vertex_handle move_if_no_collision_and_give_new_cells(
-                                                        Vertex_handle v, const Point &p, VertexRemover &remover,
-                                                        VertexInserter &inserter, OutputItCells fit);
-
-  // This is a function better suited for tds
-  // but because it is not required in the model of tds
-  // at this time, it should be implemented here.
-  void flip_2D(Cell_handle f, int i)
-  {
-    CGAL_triangulation_precondition( dimension()==2);
-    Cell_handle n  = f->neighbor(i);
-    int ni = this->_tds.mirror_index(f,i); //ni = n->index(f);
-
-    int cwi = (i+2)%3;
-    int ccwi = (i+1)%3;
-    int cwni = (ni+2)%3;
-    int ccwni = (ni+1)%3;
-
-    Vertex_handle  v_cw = f->vertex(cwi);
-    Vertex_handle  v_ccw = f->vertex(ccwi);
-
-    // bl == bottom left, tr == top right
-    Cell_handle tr = f->neighbor(ccwi);
-    int tri =  this->_tds.mirror_index(f,ccwi);
-    Cell_handle bl = n->neighbor(ccwni);
-    int bli =  this->_tds.mirror_index(n,ccwni);
-
-    f->set_vertex(cwi, n->vertex(ni));
-    n->set_vertex(cwni, f->vertex(i));
-
-    // update the neighborhood relations
-    this->_tds.set_adjacency(f, i, bl, bli);
-    this->_tds.set_adjacency(f, ccwi, n, ccwni);
-    this->_tds.set_adjacency(n, ni, tr, tri);
-
-    if(v_cw->cell() == f) {
-      v_cw->set_cell(n);
-    }
-
-    if(v_ccw->cell() == n) {
-      v_ccw->set_cell(f);
-    }
-  }
-
-  template < class VertexRemover, class VertexInserter >
-  void restore_edges_after_decrease_dimension(Vertex_handle v,
-                                              VertexRemover &remover, VertexInserter &inserter)
-  {
-
-    Cell_handle fkstart = v->cell();
-    Cell_handle start = fkstart->neighbor(fkstart->index(v));
-
-    std::list<Edge_2D> hole;
-    make_hole_2D(v, hole, remover);
-    fill_hole_2D(hole, remover);
-    // make hole here will work if the link of v is a valid triangulation
-    // the aim here is Delaunay triangulations
-    // to make it more general one could have an internal function here
-    // to remove v without touching its handle
-
-    // This insert must be from Delaunay (or the particular trian.)
-    // not the basic Triangulation_3.
-    // Here we correct the recent triangulation (with decreased dimension) formed
-    // in particular here a 2D (from 3D to 2D displacement)
-    Vertex_handle inserted = inserter.insert(v->point(), start);
-
-    // fixing pointer
-    Cell_handle fc = inserted->cell(), done(fc);
-    std::vector<Cell_handle> faces_pt;
-    faces_pt.reserve(16);
-    do {
-      faces_pt.push_back(fc);
-      fc = fc->neighbor((fc->index(inserted) + 1)%3);
-    } while(fc != done);
-    std::size_t ss = faces_pt.size();
-    for(std::size_t k=0; k<ss; k++)
-    {
-      Cell_handle f = faces_pt[k];
-      int i = f->index(inserted);
-      f->set_vertex(i, v);
-    }
-    v->set_cell(inserted->cell());
-
-    tds().delete_vertex(inserted);
-  }
-
-private:
-  typedef Facet Edge_2D;
-  typedef Triple<Vertex_handle,Vertex_handle,Vertex_handle> Vertex_triple;
-  typedef typename Base::template Vertex_triple_Facet_map_generator<
-    Vertex_triple, Facet>::type Vertex_triple_Facet_map;
-  typedef typename Base::template Vertex_handle_unique_hash_map_generator<
-    Vertex_handle>::type Vertex_handle_unique_hash_map;
-
-  Vertex_triple make_vertex_triple(const Facet& f) const;
-  void make_canonical(Vertex_triple& t) const;
-
-  template < class VertexRemover >
-  VertexRemover& make_hole_2D(Vertex_handle v, std::list<Edge_2D> & hole,
-      VertexRemover &remover);
-  template < class VertexRemover >
-  VertexRemover& make_hole_2D(Vertex_handle v, std::list<Edge_2D> & hole,
-                              VertexRemover &remover,
-                              std::set<Cell_handle> &cells_set);
-
-  template < class VertexRemover >
-  void fill_hole_2D(std::list<Edge_2D> & hole, VertexRemover &remover);
-
-  void make_hole_3D( Vertex_handle v, Vertex_triple_Facet_map& outer_map,
-      std::vector<Cell_handle> & hole);
-  // When the incident cells are already known
-  void make_hole_3D(
-    Vertex_handle v,
-    const std::vector<Cell_handle> & incident_cells,
-          Vertex_triple_Facet_map& outer_map);
-
-  template < class VertexRemover >
-  VertexRemover& remove_dim_down(Vertex_handle v, VertexRemover &remover);
-  template < class VertexRemover >
-  VertexRemover& remove_1D(Vertex_handle v, VertexRemover &remover);
-  template < class VertexRemover >
-  VertexRemover& remove_2D(Vertex_handle v, VertexRemover &remover);
-  template < class VertexRemover >
-  VertexRemover& remove_3D(Vertex_handle v, VertexRemover &remover);
-  // Version of remove_3D if the incident cells and the adjacent vertices
-  // are already known
-  template < class VertexRemover >
-  VertexRemover& remove_3D(Vertex_handle v, VertexRemover &remover,
-                           const std::vector<Cell_handle> &inc_cells,
-                           std::vector<Vertex_handle> &adj_vertices);
-
-  template < class VertexRemover, class OutputItCells  >
-  VertexRemover& remove_dim_down(Vertex_handle v, VertexRemover &remover,
-                                 OutputItCells fit);
-
-  template < class VertexRemover, class OutputItCells  >
-  VertexRemover& remove_1D(Vertex_handle v, VertexRemover &remover,
-                           OutputItCells fit);
-
-  template < class VertexRemover, class OutputItCells  >
-  VertexRemover& remove_2D(Vertex_handle v, VertexRemover &remover,
-                           OutputItCells fit);
-
-  template < class VertexRemover, class OutputItCells  >
-  VertexRemover& remove_3D(Vertex_handle v, VertexRemover &remover,
-                           OutputItCells fit);
-
-  template < class VertexRemover, class OutputItCells  >
-  void fill_hole_2D(std::list<Edge_2D> & hole, VertexRemover &remover,
-                    OutputItCells fit);
-
-  // They access "Self", so need to be friend.
-  friend class Conflict_tester_outside_convex_hull_3;
-  friend class Conflict_tester_outside_convex_hull_2;
-  friend class Infinite_tester;
-  friend class Finite_vertices_iterator;
-  friend class Finite_cells_iterator;
-
-  // remove cluster
-  template < class InputIterator >
-  void _mark_vertices_to_remove(InputIterator first, InputIterator beyond,
-    std::map<Vertex_handle, REMOVE_VERTEX_STATE> &vstates) const
-  {
-    while (first != beyond) vstates[*first++] = TO_REMOVE;
-  }
-
-  bool _test_dim_down_cluster(
-                              std::map<Vertex_handle, REMOVE_VERTEX_STATE> &vstates) const
-  // tests whether removing the cluster of vertices
-  // marked as "to remove", decreases the dimension of the triangulation
-  {
-    CGAL_triangulation_precondition( dimension() == 3 );
-    int k=0;
-    Vertex_handle v[4];
-    for (Finite_vertices_iterator fit = finite_vertices_begin();
-         fit != finite_vertices_end(); ++fit ) {
-      if(vstates[fit] == TO_REMOVE) continue;
-      v[k++] = fit;
-      if(k == 4)
-      {
-        if (!coplanar(v[0]->point(), v[1]->point(),
-                      v[2]->point(), v[3]->point())) return false;
-        k--;
-      }
-    }
-    return k < 4;
-  }
-
-  template < class InputIterator, class VertexRemover >
-  bool
-  _remove_cluster_3D(InputIterator first, InputIterator beyond, VertexRemover &remover,
-                     std::map<Vertex_handle, REMOVE_VERTEX_STATE> &vstates);
-
-  void _make_big_hole_3D(Vertex_handle v,
-                         std::map<Vertex_triple,Facet>& outer_map,
-                         std::vector<Cell_handle> & hole,
-                         std::vector<Vertex_handle> & vertices,
-                         std::map<Vertex_handle, REMOVE_VERTEX_STATE> &vstates);
-
-public:
-
-  //TRAVERSING : ITERATORS AND CIRCULATORS
-  Finite_cells_iterator finite_cells_begin() const
-  {
-      if ( dimension() < 3 )
-          return finite_cells_end();
-      return CGAL::filter_iterator(cells_end(), Infinite_tester(this),
-                                   cells_begin());
-  }
-  Finite_cells_iterator finite_cells_end() const
-  {
-      return CGAL::filter_iterator(cells_end(), Infinite_tester(this));
-  }
-
-  Cell_iterator cells_begin() const
-  {
-      return _tds.cells_begin();
-  }
-  Cell_iterator cells_end() const
-  {
-      return _tds.cells_end();
-  }
-
-  All_cells_iterator all_cells_begin() const
-  {
-      return _tds.cells_begin();
-  }
-  All_cells_iterator all_cells_end() const
-  {
-      return _tds.cells_end();
-  }
-
-  Finite_vertices_iterator finite_vertices_begin() const
-  {
-      if ( number_of_vertices() <= 0 )
-          return finite_vertices_end();
-      return CGAL::filter_iterator(vertices_end(), Infinite_tester(this),
-                                   vertices_begin());
-  }
-  Finite_vertices_iterator finite_vertices_end() const
-  {
-      return CGAL::filter_iterator(vertices_end(), Infinite_tester(this));
-  }
-
-  Vertex_iterator vertices_begin() const
-  {
-      return _tds.vertices_begin();
-  }
-  Vertex_iterator vertices_end() const
-  {
-      return _tds.vertices_end();
-  }
-
-  All_vertices_iterator all_vertices_begin() const
-  {
-      return _tds.vertices_begin();
-  }
-  All_vertices_iterator all_vertices_end() const
-  {
-      return _tds.vertices_end();
-  }
-
-  Finite_edges_iterator finite_edges_begin() const
-  {
-      if ( dimension() < 1 )
-          return finite_edges_end();
-      return CGAL::filter_iterator(edges_end(), Infinite_tester(this),
-                                   edges_begin());
-  }
-  Finite_edges_iterator finite_edges_end() const
-  {
-      return CGAL::filter_iterator(edges_end(), Infinite_tester(this));
-  }
-
-  Edge_iterator edges_begin() const
-  {
-      return _tds.edges_begin();
-  }
-  Edge_iterator edges_end() const
-  {
-      return _tds.edges_end();
-  }
-
-  All_edges_iterator all_edges_begin() const
-  {
-      return _tds.edges_begin();
-  }
-  All_edges_iterator all_edges_end() const
-  {
-      return _tds.edges_end();
-  }
-
-  Finite_facets_iterator finite_facets_begin() const
-  {
-      if ( dimension() < 2 )
-          return finite_facets_end();
-      return CGAL::filter_iterator(facets_end(), Infinite_tester(this),
-                                   facets_begin());
-  }
-  Finite_facets_iterator finite_facets_end() const
-  {
-      return CGAL::filter_iterator(facets_end(), Infinite_tester(this));
-  }
-
-  Facet_iterator facets_begin() const
-  {
-      return _tds.facets_begin();
-  }
-  Facet_iterator facets_end() const
-  {
-      return _tds.facets_end();
-  }
-
-  All_facets_iterator all_facets_begin() const
-  {
-      return _tds.facets_begin();
-  }
-  All_facets_iterator all_facets_end() const
-  {
-      return _tds.facets_end();
-  }
-
-  Point_iterator points_begin() const
-  {
-      return Point_iterator(finite_vertices_begin());
-  }
-  Point_iterator points_end() const
-  {
-      return Point_iterator(finite_vertices_end());
-  }
-
-  // cells around an edge
-  Cell_circulator incident_cells(const Edge & e) const
-  {
-    return _tds.incident_cells(e);
-  }
-  Cell_circulator incident_cells(Cell_handle c, int i, int j) const
-  {
-    return _tds.incident_cells(c, i, j);
-  }
-  Cell_circulator incident_cells(const Edge & e, Cell_handle start) const
-  {
-    return _tds.incident_cells(e, start);
-  }
-  Cell_circulator incident_cells(Cell_handle c, int i, int j,
-                                 Cell_handle start) const
-  {
-    return _tds.incident_cells(c, i, j, start);
-  }
-
-  // facets around an edge
-  Facet_circulator incident_facets(const Edge & e) const
-  {
-    return _tds.incident_facets(e);
-  }
-  Facet_circulator incident_facets(Cell_handle c, int i, int j) const
-  {
-    return _tds.incident_facets(c, i, j);
-  }
-  Facet_circulator incident_facets(const Edge & e, const Facet & start) const
-  {
-    return _tds.incident_facets(e, start);
-  }
-  Facet_circulator incident_facets(Cell_handle c, int i, int j,
-                                   const Facet & start) const
-  {
-    return _tds.incident_facets(c, i, j, start);
-  }
-  Facet_circulator incident_facets(const Edge & e,
-                                   Cell_handle start, int f) const
-  {
-    return _tds.incident_facets(e, start, f);
-  }
-  Facet_circulator incident_facets(Cell_handle c, int i, int j,
-                                   Cell_handle start, int f) const
-  {
-    return _tds.incident_facets(c, i, j, start, f);
-  }
-
-  // around a vertex
-  class Finite_filter {
-    const Self* t;
-    public:
-    Finite_filter(const Self* _t): t(_t) {}
-    template<class T>
-    bool operator() (const T& e) const {
-      return t->is_infinite(e);
-    }
-  };
-
-  class Finite_filter_2D {
-    const Self* t;
-    public:
-    Finite_filter_2D(const Self* _t): t(_t) {}
-
-    template<class T>
-    bool operator() (const T& e) const {
-      return t->is_infinite(e);
-    }
-
-    bool operator() (const Cell_handle c) {
-      return t->is_infinite(c, 3);
-    }
-  };
-
-  template <typename OutputIterator>
-  OutputIterator
-  incident_cells(Vertex_handle v, OutputIterator cells) const
-  {
-    return _tds.incident_cells(v, cells);
-  }
-  
-  template <typename OutputIterator>
-  void incident_cells_threadsafe(Vertex_handle v,
-                                 OutputIterator cells) const
-  {
-    _tds.incident_cells_threadsafe(v, cells);
-  }
-  
-  template <typename Filter, typename OutputIterator>
-  void incident_cells_threadsafe(Vertex_handle v,
-                                 OutputIterator cells,
-                                 const Filter &filter) const
-  {
-    _tds.incident_cells_threadsafe(v, cells, filter);
-  }
-
-  bool
-  try_lock_and_get_incident_cells(Vertex_handle v,
-                                  std::vector<Cell_handle>& cells) const
-  {
-    // We need to lock v individually first, to be sure v->cell() is valid
-    if (!this->try_lock_vertex(v))
-      return false;
-
-    Cell_handle d = v->cell();
-    if (!this->try_lock_cell(d)) // LOCK
-    {
-      return false;
-    }
-    cells.push_back(d);
-    d->tds_data().mark_in_conflict();
-    int head=0;
-    int tail=1;
-    do {
-      Cell_handle c = cells[head];
-
-      for (int i=0; i<4; ++i) {
-        if (c->vertex(i) == v)
-          continue;
-        Cell_handle next = c->neighbor(i);
-
-        if (!this->try_lock_cell(next)) // LOCK
-        {
-          BOOST_FOREACH(Cell_handle& ch,
-            std::make_pair(cells.begin(), cells.end()))
-          {
-            ch->tds_data().clear();
-          }
-          cells.clear();
-          return false;
-        }
-        if (! next->tds_data().is_clear())
-          continue;
-        cells.push_back(next);
-        ++tail;
-        next->tds_data().mark_in_conflict();
-      }
-      ++head;
-    } while(head != tail);
-    BOOST_FOREACH(Cell_handle& ch, std::make_pair(cells.begin(), cells.end()))
-    {
-      ch->tds_data().clear();
-    }
-    return true;
-  }
-
-  template <class OutputIterator>
-  bool
-  try_lock_and_get_adjacent_vertices_and_cells_3(
-    Vertex_handle v, OutputIterator vertices,
-    std::vector<Cell_handle> &cells) const
-  {
-
-    // We need to lock v individually first, to be sure v->cell() is valid
-    if (!this->try_lock_vertex(v))
-      return false;
-
-    Cell_handle d = v->cell();
-    if (!this->try_lock_cell(d)) // LOCK
-    {
-      return false;
-    }
-    cells.push_back(d);
-    d->tds_data().mark_in_conflict();
-    int head=0;
-    int tail=1;
-    do {
-      Cell_handle c = cells[head];
-
-      for (int i=0; i<4; ++i) {
-        if (c->vertex(i) == v)
-          continue;
-        Cell_handle next = c->neighbor(i);
-
-        if (!this->try_lock_cell(next)) // LOCK
-        {
-          BOOST_FOREACH(Cell_handle& ch,
-            std::make_pair(cells.begin(), cells.end()))
-          {
-            ch->tds_data().clear();
-          }
-          cells.clear();
-          return false;
-        }
-        if (! next->tds_data().is_clear())
-          continue;
-        cells.push_back(next);
-        ++tail;
-        next->tds_data().mark_in_conflict();
-      }
-      ++head;
-    } while(head != tail);
-
-    std::set<Vertex_handle> tmp_vertices;
-    BOOST_FOREACH(Cell_handle& ch, std::make_pair(cells.begin(), cells.end()))
-    {
-      ch->tds_data().clear();
-      for (int i = 0;  i < 4; ++i)
-      {
-              Vertex_handle w = ch->vertex(i);
-              if (w != v && tmp_vertices.insert(w).second)
-        {
-                *vertices = w;
-
-        }
-      }
-    }
-    return true;
-  }
-
-  template <class OutputIterator>
-  OutputIterator
-  finite_incident_cells(Vertex_handle v, OutputIterator cells) const
-  {
-        if(dimension() == 2)
-          return _tds.incident_cells(v, cells, Finite_filter_2D(this));
-    return _tds.incident_cells(v, cells, Finite_filter(this));
-  }
-
-  template <class OutputIterator>
-  OutputIterator
-  incident_facets(Vertex_handle v, OutputIterator facets) const
-  {
-    return _tds.incident_facets(v, facets);
-  }
-
-  template <class OutputIterator>
-  OutputIterator
-  finite_incident_facets(Vertex_handle v, OutputIterator facets) const
-  {
-    return _tds.incident_facets(v, facets, Finite_filter(this));
-  }
-
-  template <class OutputIterator>
-  OutputIterator
-  incident_facets_threadsafe(Vertex_handle v, OutputIterator facets) const
-  {
-    return _tds.incident_facets_threadsafe(v, facets);
-  }
-
-  template <class OutputIterator>
-  OutputIterator
-  finite_incident_facets_threadsafe(Vertex_handle v, OutputIterator facets) const
-  {
-    return _tds.incident_facets_threadsafe(v, facets, Finite_filter(this));
-  }
-
-  // old name (up to CGAL 3.4)
-  // kept for backwards compatibility but not documented
-  template <class OutputIterator>
-  OutputIterator
-  incident_vertices(Vertex_handle v, OutputIterator vertices) const
-  {
-    return _tds.adjacent_vertices(v, vertices);
-  }
-
-  // correct name
-  template <class OutputIterator>
-  OutputIterator
-  adjacent_vertices(Vertex_handle v, OutputIterator vertices) const
-  {
-    return _tds.adjacent_vertices(v, vertices);
-  }
-
-  template <class OutputIterator>
-  OutputIterator
-  adjacent_vertices_and_cells_3(Vertex_handle v, OutputIterator vertices,
-                                std::vector<Cell_handle> &cells) const
-  {
-    return _tds.adjacent_vertices_and_cells_3(v, vertices, cells);
-  }
-
-  // old name (up to CGAL 3.4)
-  // kept for backwards compatibility but not documented
-  template <class OutputIterator>
-  OutputIterator
-  finite_incident_vertices(Vertex_handle v, OutputIterator vertices) const
-  {
-    return _tds.adjacent_vertices(v, vertices, Finite_filter(this));
-  }
-
-  // correct name
-  template <class OutputIterator>
-  OutputIterator
-  finite_adjacent_vertices(Vertex_handle v, OutputIterator vertices) const
-  {
-    return _tds.adjacent_vertices(v, vertices, Finite_filter(this));
-  }
-
-  template <class OutputIterator>
-  OutputIterator
-  incident_edges(Vertex_handle v, OutputIterator edges) const
-  {
-      return _tds.incident_edges(v, edges);
-  }
-
-  template <class OutputIterator>
-  OutputIterator
-  finite_incident_edges(Vertex_handle v, OutputIterator edges) const
-  {
-    return _tds.incident_edges(v, edges, Finite_filter(this));
-  }
-
-  size_type degree(Vertex_handle v) const
-  {
-      return _tds.degree(v);
-  }
-
-
-
-  // CHECKING
-  bool is_valid(bool verbose = false, int level = 0) const;
-
-  bool is_valid(Cell_handle c, bool verbose = false, int level = 0) const;
-
-  bool is_valid_finite(Cell_handle c, bool verbose = false, int level=0) const;
-};
-
-template < class GT, class Tds, class Lds >
-std::istream &
-operator>> (std::istream& is, Triangulation_3<GT, Tds, Lds> &tr)
-  // reads
-  // the dimension
-  // the number of finite vertices
-  // the non combinatorial information on vertices (point, etc)
-  // the number of cells
-  // the cells by the indices of their vertices in the preceding list
-  // of vertices, plus the non combinatorial information on each cell
-  // the neighbors of each cell by their index in the preceding list of cells
-  // when dimension < 3 : the same with faces of maximal dimension
-{
-  typedef Triangulation_3<GT, Tds>               Triangulation;
-  typedef typename Triangulation::Vertex_handle  Vertex_handle;
-  typedef typename Triangulation::Cell_handle    Cell_handle;
-
-  tr._tds.clear(); // infinite vertex deleted
-  tr.infinite = tr._tds.create_vertex();
-
-  std::size_t n;
-  int d;
-  if(is_ascii(is))
-     is >> d >> n;
-  else {
-    read(is, d);
-    read(is, n);
-  }
-  if(!is) return is;
-  tr._tds.set_dimension(d);
-
-  std::map< std::size_t, Vertex_handle > V;
-  V[0] = tr.infinite_vertex();
-  // the infinite vertex is numbered 0
-
-  for (std::size_t i=1; i <= n; i++) {
-    V[i] = tr._tds.create_vertex();
-    if(!(is >> *V[i])) return is;
-  }
-
-  std::map< std::size_t, Cell_handle > C;
-
-  std::size_t m;
-  tr._tds.read_cells(is, V, m, C);
-
-  for (std::size_t j=0 ; j < m; j++)
-    if(!(is >> *(C[j]))) return is;
-
-  CGAL_triangulation_assertion( tr.is_valid(false) );
-  return is;
-}
-
-template < class GT, class Tds, class Lds >
-std::ostream &
-operator<< (std::ostream& os, const Triangulation_3<GT, Tds, Lds> &tr)
-  // writes :
-  // the dimension
-  // the number of finite vertices
-  // the non combinatorial information on vertices (point, etc)
-  // the number of cells
-  // the cells by the indices of their vertices in the preceding list
-  // of vertices, plus the non combinatorial information on each cell
-  // the neighbors of each cell by their index in the preceding list of cells
-  // when dimension < 3 : the same with faces of maximal dimension
-{
-  typedef Triangulation_3<GT, Tds>                 Triangulation;
-  typedef typename Triangulation::size_type        size_type;
-  typedef typename Triangulation::Vertex_handle    Vertex_handle;
-  typedef typename Triangulation::Vertex_iterator  Vertex_iterator;
-  typedef typename Triangulation::Cell_iterator    Cell_iterator;
-  typedef typename Triangulation::Edge_iterator    Edge_iterator;
-  typedef typename Triangulation::Facet_iterator   Facet_iterator;
-
-  // outputs dimension and number of vertices
-  size_type n = tr.number_of_vertices();
-  if (is_ascii(os))
-    os << tr.dimension() << std::endl << n << std::endl;
-  else
-  {
-    write(os, tr.dimension());
-    write(os, n);
-  }
-
-  if (n == 0)
-    return os;
-
-  std::vector<Vertex_handle> TV(n+1);
-  size_type i = 0;
-
-  // write the vertices
-
-  for (Vertex_iterator it = tr.vertices_begin(), end = tr.vertices_end();
-         it != end; ++it)
-    TV[i++] = it;
-
-  CGAL_triangulation_assertion( i == n+1 );
-  CGAL_triangulation_assertion( tr.is_infinite(TV[0]) );
-
-  Unique_hash_map<Vertex_handle, std::size_t > V;
-
-  V[tr.infinite_vertex()] = 0;
-  for (i=1; i <= n; i++) {
-    os << *TV[i];
-    V[TV[i]] = i;
-    if (is_ascii(os))
-        os << std::endl;
-  }
-
-    // asks the tds for the combinatorial information
-  tr.tds().print_cells(os, V);
-
-
-  // write the non combinatorial information on the cells
-  // using the << operator of Cell
-  // works because the iterator of the tds traverses the cells in the
-  // same order as the iterator of the triangulation
-  switch ( tr.dimension() ) {
-  case 3:
-    {
-      for(Cell_iterator it = tr.cells_begin(), end = tr.cells_end(); it != end; ++it) {
-        os << *it; // other information
-        if(is_ascii(os))
-          os << std::endl;
-      }
-      break;
-    }
-  case 2:
-    {
-      for(Facet_iterator it = tr.facets_begin(), end = tr.facets_end(); it != end; ++it) {
-        os << *((*it).first); // other information
-        if(is_ascii(os))
-          os << std::endl;
-      }
-      break;
-    }
-  case 1:
-    {
-      for(Edge_iterator it = tr.edges_begin(), end = tr.edges_end(); it != end; ++it) {
-        os << *((*it).first); // other information
-        if(is_ascii(os))
-          os << std::endl;
-      }
-      break;
-    }
-  }
-
-
-  return os ;
-}
-
-template < class GT, class Tds, class Lds >
-typename Triangulation_3<GT,Tds,Lds>::size_type
-Triangulation_3<GT,Tds,Lds>::
-number_of_finite_cells() const
-{
-  if ( dimension() < 3 ) return 0;
-  return std::distance(finite_cells_begin(), finite_cells_end());
-}
-
-template < class GT, class Tds, class Lds >
-typename Triangulation_3<GT,Tds,Lds>::size_type
-Triangulation_3<GT,Tds,Lds>::
-number_of_cells() const
-{
-  return _tds.number_of_cells();
-}
-
-template < class GT, class Tds, class Lds >
-typename Triangulation_3<GT,Tds,Lds>::size_type
-Triangulation_3<GT,Tds,Lds>::
-number_of_finite_facets() const
-{
-  if ( dimension() < 2 ) return 0;
-  return std::distance(finite_facets_begin(), finite_facets_end());
-}
-
-template < class GT, class Tds, class Lds >
-typename Triangulation_3<GT,Tds,Lds>::size_type
-Triangulation_3<GT,Tds,Lds>::
-number_of_facets() const
-{
-  return _tds.number_of_facets();
-}
-
-template < class GT, class Tds, class Lds >
-typename Triangulation_3<GT,Tds,Lds>::size_type
-Triangulation_3<GT,Tds,Lds>::
-number_of_finite_edges() const
-{
-  if ( dimension() < 1 ) return 0;
-  return std::distance(finite_edges_begin(), finite_edges_end());
-}
-
-template < class GT, class Tds, class Lds >
-typename Triangulation_3<GT,Tds,Lds>::size_type
-Triangulation_3<GT,Tds,Lds>::
-number_of_edges() const
-{
-  return _tds.number_of_edges();
-}
-
-template < class GT, class Tds, class Lds >
-typename Triangulation_3<GT,Tds,Lds>::Triangle
-Triangulation_3<GT,Tds,Lds>::
-triangle(const Cell_handle c, int i) const
-{
-  CGAL_triangulation_precondition( dimension() == 2 || dimension() == 3 );
-  CGAL_triangulation_precondition( (dimension() == 2 && i == 3)
-                                || (dimension() == 3 && i >= 0 && i <= 3) );
-  CGAL_triangulation_precondition( ! is_infinite(Facet(c, i)) );
-  if ( (i&1)==0 )
-    return construct_triangle(c->vertex( (i+2)&3 )->point(),
-                              c->vertex( (i+1)&3 )->point(),
-                              c->vertex( (i+3)&3 )->point());
-  return construct_triangle(c->vertex( (i+1)&3 )->point(),
-                            c->vertex( (i+2)&3 )->point(),
-                            c->vertex( (i+3)&3 )->point());
-}
-
-template < class GT, class Tds, class Lds >
-typename Triangulation_3<GT,Tds,Lds>::Segment
-Triangulation_3<GT,Tds,Lds>::
-segment(const Cell_handle c, int i, int j) const
-{
-  CGAL_triangulation_precondition( i != j );
-  CGAL_triangulation_precondition( dimension() >= 1 && dimension() <= 3 );
-  CGAL_triangulation_precondition( i >= 0 && i <= dimension()
-                                   && j >= 0 && j <= dimension() );
-  CGAL_triangulation_precondition( ! is_infinite(Edge(c, i, j)) );
-  return construct_segment( c->vertex(i)->point(), c->vertex(j)->point() );
-}
-
-template < class GT, class Tds, class Lds >
-inline
-bool
-Triangulation_3<GT,Tds,Lds>::
-is_infinite(const Cell_handle c, int i) const
-{
-  CGAL_triangulation_precondition( dimension() == 2 || dimension() == 3 );
-  CGAL_triangulation_precondition( (dimension() == 2 && i == 3)
-                                   || (dimension() == 3 && i >= 0 && i <= 3) );
-  return is_infinite(c->vertex(i<=0 ? 1 : 0)) ||
-         is_infinite(c->vertex(i<=1 ? 2 : 1)) ||
-         is_infinite(c->vertex(i<=2 ? 3 : 2));
-}
-
-template < class GT, class Tds, class Lds >
-inline
-bool
-Triangulation_3<GT,Tds,Lds>::
-is_infinite(const Cell_handle c, int i, int j) const
-{
-  CGAL_triangulation_precondition( i != j );
-  CGAL_triangulation_precondition( dimension() >= 1 && dimension() <= 3 );
-  CGAL_triangulation_precondition(
-          i >= 0 && i <= dimension() && j >= 0 && j <= dimension() );
-  return is_infinite( c->vertex(i) ) || is_infinite( c->vertex(j) );
-}
-
-template < class GT, class Tds, class Lds >
-bool
-Triangulation_3<GT,Tds,Lds>::
-is_vertex(const Point & p, Vertex_handle & v) const
-{
-  Locate_type lt;
-  int li, lj;
-  Cell_handle c = locate( p, lt, li, lj );
-  if ( lt != VERTEX )
-    return false;
-  v = c->vertex(li);
-  return true;
-}
-
-template < class GT, class Tds, class Lds >
-inline
-bool
-Triangulation_3<GT,Tds,Lds>::
-is_vertex(Vertex_handle v) const
-{
-  return _tds.is_vertex(v);
-}
-
-template < class GT, class Tds, class Lds >
-bool
-Triangulation_3<GT,Tds,Lds>::
-is_edge(Vertex_handle u, Vertex_handle v,
-        Cell_handle & c, int & i, int & j) const
-{
-  return _tds.is_edge(u, v, c, i, j);
-}
-
-template < class GT, class Tds, class Lds >
-bool
-Triangulation_3<GT,Tds,Lds>::
-is_facet(Vertex_handle u, Vertex_handle v, Vertex_handle w,
-         Cell_handle & c, int & i, int & j, int & k) const
-{
-  return _tds.is_facet(u, v, w, c, i, j, k);
-}
-
-template < class GT, class Tds, class Lds >
-inline
-bool
-Triangulation_3<GT,Tds,Lds>::
-is_cell(Cell_handle c) const
-{
-  return _tds.is_cell(c);
-}
-
-template < class GT, class Tds, class Lds >
-bool
-Triangulation_3<GT,Tds,Lds>::
-is_cell(Vertex_handle u, Vertex_handle v,
-        Vertex_handle w, Vertex_handle t,
-        Cell_handle & c, int & i, int & j, int & k, int & l) const
-{
-  return _tds.is_cell(u, v, w, t, c, i, j, k, l);
-}
-
-template < class GT, class Tds, class Lds >
-bool
-Triangulation_3<GT,Tds,Lds>::
-is_cell(Vertex_handle u, Vertex_handle v,
-        Vertex_handle w, Vertex_handle t,
-        Cell_handle & c) const
-{
-  int i,j,k,l;
-  return _tds.is_cell(u, v, w, t, c, i, j, k, l);
-}
-
-template < class GT, class Tds, class Lds >
-inline
-bool
-Triangulation_3<GT,Tds,Lds>::
-has_vertex(const Facet & f, Vertex_handle v, int & j) const
-{
-  return _tds.has_vertex(f.first, f.second, v, j);
-}
-
-template < class GT, class Tds, class Lds >
-inline
-bool
-Triangulation_3<GT,Tds,Lds>::
-has_vertex(Cell_handle c, int i, Vertex_handle v, int & j) const
-{
-  return _tds.has_vertex(c, i, v, j);
-}
-
-template < class GT, class Tds, class Lds >
-inline
-bool
-Triangulation_3<GT,Tds,Lds>::
-has_vertex(const Facet & f, Vertex_handle v) const
-{
-  return _tds.has_vertex(f.first, f.second, v);
-}
-
-template < class GT, class Tds, class Lds >
-inline
-bool
-Triangulation_3<GT,Tds,Lds>::
-has_vertex(Cell_handle c, int i, Vertex_handle v) const
-{
-  return _tds.has_vertex(c, i, v);
-}
-
-template < class GT, class Tds, class Lds >
-inline
-bool
-Triangulation_3<GT,Tds,Lds>::
-are_equal(Cell_handle c, int i, Cell_handle n, int j) const
-{
-  return _tds.are_equal(c, i, n, j);
-}
-
-template < class GT, class Tds, class Lds >
-inline
-bool
-Triangulation_3<GT,Tds,Lds>::
-are_equal(const Facet & f, const Facet & g) const
-{
-  return _tds.are_equal(f.first, f.second, g.first, g.second);
-}
-
-template < class GT, class Tds, class Lds >
-inline
-bool
-Triangulation_3<GT,Tds,Lds>::
-are_equal(const Facet & f, Cell_handle n, int j) const
-{
-  return _tds.are_equal(f.first, f.second, n, j);
-}
-
-template < class GT, class Tds, class Lds >
-typename Triangulation_3<GT,Tds,Lds>::Cell_handle
-Triangulation_3<GT,Tds,Lds>::
-#ifdef CGAL_NO_STRUCTURAL_FILTERING
-locate(const Point & p, Locate_type & lt, int & li, int & lj,
-       Cell_handle start, bool *could_lock_zone) const
-#else
-exact_locate(const Point & p, Locate_type & lt, int & li, int & lj,
-             Cell_handle start, bool *could_lock_zone) const
-#endif
-  // returns the (finite or infinite) cell p lies in
-  // starts at cell "start"
-  // if lt == OUTSIDE_CONVEX_HULL, li is the
-  // index of a facet separating p from the rest of the triangulation
-  // in dimension 2 :
-  // returns a facet (Cell_handle,li) if lt == FACET
-  // returns an edge (Cell_handle,li,lj) if lt == EDGE
-  // returns a vertex (Cell_handle,li) if lt == VERTEX
-  // if lt == OUTSIDE_CONVEX_HULL, li, lj give the edge of c
-  // separating p from the rest of the triangulation
-  // lt = OUTSIDE_AFFINE_HULL if p is not coplanar with the triangulation
-{
-  CGAL_triangulation_expensive_assertion(start == Cell_handle() || tds().is_simplex(start) );
-
-  if (could_lock_zone)
-    *could_lock_zone = true;
-
-  if ( dimension() >= 1 ) {
-      // Make sure we continue from here with a finite cell.
-      if ( start == Cell_handle() )
-          start = infinite_cell();
-
-      int ind_inf;
-      if ( start->has_vertex(infinite, ind_inf) )
-          start = start->neighbor(ind_inf);
-  }
-
-  boost::rand48 rng;
-
-  switch (dimension()) {
-  case 3:
-  {
-    CGAL_triangulation_precondition( start != Cell_handle() );
-    CGAL_triangulation_precondition( ! start->has_vertex(infinite) );
-
-    // We implement the remembering visibility/stochastic walk.
-
-    // Remembers the previous cell to avoid useless orientation tests.
-    Cell_handle previous = Cell_handle();
-    Cell_handle c = start;
-
-    if (could_lock_zone)
-    {
-      if (!this->try_lock_cell(c))
-      {
-        *could_lock_zone = false;
-        return Cell_handle();
-      }
-    }
-
-    // Stores the results of the 4 orientation tests.  It will be used
-    // at the end to decide if p lies on a face/edge/vertex/interior.
-    Orientation o[4];
-
-    boost::uniform_smallint<> four(0, 3);
-    boost::variate_generator<boost::rand48&, boost::uniform_smallint<> > die4(rng, four);
-
-    // Now treat the cell c.
-    bool try_next_cell = true;
-    while(try_next_cell)
-    {
-      try_next_cell = false;
-      // We know that the 4 vertices of c are positively oriented.
-      // So, in order to test if p is seen outside from one of c's facets,
-      // we just replace the corresponding point by p in the orientation
-      // test.  We do this using the array below.
-      const Point* pts[4] = { &(c->vertex(0)->point()),
-                              &(c->vertex(1)->point()),
-                              &(c->vertex(2)->point()),
-                              &(c->vertex(3)->point()) };
-
-      // For the remembering stochastic walk,
-      // we need to start trying with a random index :
-      int i = die4();
-      // For the remembering visibility walk (Delaunay and Regular only), we don't :
-      // int i = 0;
-
-      // for each vertex
-      for (int j=0; !try_next_cell && j != 4; ++j, i = (i+1)&3)
-      {
-              Cell_handle next = c->neighbor(i);
-
-              if (previous == next)
-        {
-                o[i] = POSITIVE;
-        }
-        else
-        {
-          // We temporarily put p at i's place in pts.
-          const Point* backup = pts[i];
-          pts[i] = &p;
-                o[i] = orientation(*pts[0], *pts[1], *pts[2], *pts[3]);
-                if ( o[i] != NEGATIVE )
-          {
-            pts[i] = backup;
-          }
-          else
-          {
-                  if ( next->has_vertex(infinite, li) )
-            {
-                    // We are outside the convex hull.
-                    lt = OUTSIDE_CONVEX_HULL;
-                    return next;
-                  }
-                  previous = c;
-                  c = next;
-            if (could_lock_zone)
-            {
-              //previous->unlock(); // DON'T do that, "c" may be in
-                                    // the same locking cell as "previous"
-              if (!this->try_lock_cell(c))
-              {
-                *could_lock_zone = false;
-                return Cell_handle();
-              }
-            }
-            try_next_cell = true;
-          }
-        }
-      } // next vertex
-    } // next cell
-
-          // now p is in c or on its boundary
-          int sum = ( o[0] == COPLANAR )
-                  + ( o[1] == COPLANAR )
-                  + ( o[2] == COPLANAR )
-                  + ( o[3] == COPLANAR );
-          switch (sum) {
-          case 0:
-            {
-              lt = CELL;
-              break;
-            }
-          case 1:
-            {
-              lt = FACET;
-              li = ( o[0] == COPLANAR ) ? 0 :
-                   ( o[1] == COPLANAR ) ? 1 :
-                   ( o[2] == COPLANAR ) ? 2 : 3;
-              break;
-            }
-          case 2:
-            {
-              lt = EDGE;
-              li = ( o[0] != COPLANAR ) ? 0 :
-                   ( o[1] != COPLANAR ) ? 1 : 2;
-              lj = ( o[li+1] != COPLANAR ) ? li+1 :
-                   ( o[li+2] != COPLANAR ) ? li+2 : li+3;
-              CGAL_triangulation_assertion(collinear( p,
-                                                      c->vertex( li )->point(),
-                                                      c->vertex( lj )->point()));
-              break;
-            }
-          case 3:
-            {
-              lt = VERTEX;
-              li = ( o[0] != COPLANAR ) ? 0 :
-                   ( o[1] != COPLANAR ) ? 1 :
-                   ( o[2] != COPLANAR ) ? 2 : 3;
-              break;
-            }
-          }
-          return c;
-  }
-
-  case 2:
-    {
-      CGAL_triangulation_precondition( start != Cell_handle() );
-      CGAL_triangulation_precondition( ! start->has_vertex(infinite) );
-      Cell_handle c = start;
-
-      boost::uniform_smallint<> three(0, 2);
-      boost::variate_generator<boost::rand48&, boost::uniform_smallint<> > die3(rng, three);
-
-      //first tests whether p is coplanar with the current triangulation
-      if ( orientation( c->vertex(0)->point(),
-                        c->vertex(1)->point(),
-                        c->vertex(2)->point(),
-                        p ) != DEGENERATE ) {
-        lt = OUTSIDE_AFFINE_HULL;
-        li = 3; // only one facet in dimension 2
-        return c;
-      }
-      // if p is coplanar, location in the triangulation
-      // only the facet numbered 3 exists in each cell
-      while (1) {
-        int inf;
-        if ( c->has_vertex(infinite,inf) ) {
-          // c must contain p in its interior
-          lt = OUTSIDE_CONVEX_HULL;
-          li = cw(inf);
-          lj = ccw(inf);
-          return c;
-        }
-
-        // else c is finite
-        // we test its edges in a random order until we find a
-        // neighbor to go further
-        int i = die3();
-        const Point & p0 = c->vertex( i )->point();
-        const Point & p1 = c->vertex( ccw(i) )->point();
-        const Point & p2 = c->vertex( cw(i) )->point();
-        Orientation o[3];
-        CGAL_triangulation_assertion(coplanar_orientation(p0,p1,p2)==POSITIVE);
-        o[0] = coplanar_orientation(p0,p1,p);
-        if ( o[0] == NEGATIVE ) {
-          c = c->neighbor( cw(i) );
-          continue;
-        }
-        o[1] = coplanar_orientation(p1,p2,p);
-        if ( o[1] == NEGATIVE ) {
-          c = c->neighbor( i );
-          continue;
-        }
-        o[2] = coplanar_orientation(p2,p0,p);
-        if ( o[2] == NEGATIVE ) {
-          c = c->neighbor( ccw(i) );
-          continue;
-        }
-
-        // now p is in c or on its boundary
-        int sum = ( o[0] == COLLINEAR )
-                + ( o[1] == COLLINEAR )
-                + ( o[2] == COLLINEAR );
-        switch (sum) {
-        case 0:
-          {
-            lt = FACET;
-            li = 3; // useless ?
-            break;
-          }
-        case 1:
-          {
-            lt = EDGE;
-            li = ( o[0] == COLLINEAR ) ? i :
-                 ( o[1] == COLLINEAR ) ? ccw(i) :
-                 cw(i);
-            lj = ccw(li);
-            break;
-          }
-        case 2:
-          {
-            lt = VERTEX;
-            li = ( o[0] != COLLINEAR ) ? cw(i) :
-                 ( o[1] != COLLINEAR ) ? i :
-                 ccw(i);
-            break;
-          }
-        }
-        return c;
-      }
-    }
-  case 1:
-    {
-      CGAL_triangulation_precondition( start != Cell_handle() );
-      CGAL_triangulation_precondition( ! start->has_vertex(infinite) );
-      Cell_handle c = start;
-
-      //first tests whether p is collinear with the current triangulation
-      if ( ! collinear( p,
-                        c->vertex(0)->point(),
-                        c->vertex(1)->point()) ) {
-        lt = OUTSIDE_AFFINE_HULL;
-        return c;
-      }
-      // if p is collinear, location :
-      while (1) {
-        if ( c->has_vertex(infinite) ) {
-          // c must contain p in its interior
-          lt = OUTSIDE_CONVEX_HULL;
-          return c;
-        }
-
-        // else c is finite
-        // we test on which direction to continue the traversal
-        switch (collinear_position(c->vertex(0)->point(),
-                                   p,
-                                   c->vertex(1)->point()) ) {
-        case AFTER:
-          c = c->neighbor(0);
-          continue;
-        case BEFORE:
-          c = c->neighbor(1);
-          continue;
-        case MIDDLE:
-            lt = EDGE;
-            li = 0;
-            lj = 1;
-            return c;
-        case SOURCE:
-            lt = VERTEX;
-            li = 0;
-            return c;
-        case TARGET:
-            lt = VERTEX;
-            li = 1;
-            return c;
-        }
-      }
-    }
-  case 0:
-    {
-      Finite_vertices_iterator vit = finite_vertices_begin();
-      if ( ! equal( p, vit->point() ) ) {
-        lt = OUTSIDE_AFFINE_HULL;
-      }
-      else {
-        lt = VERTEX;
-        li = 0;
-      }
-      return vit->cell();
-    }
-  case -1:
-    {
-      lt = OUTSIDE_AFFINE_HULL;
-      return Cell_handle();
-    }
-  default:
-    {
-      CGAL_triangulation_assertion(false);
-      return Cell_handle();
-    }
-  }
-}
-
-#ifndef CGAL_NO_STRUCTURAL_FILTERING
-template <class Gt, class Tds, class Lds>
-inline
-typename Triangulation_3<Gt, Tds, Lds>::Cell_handle
-Triangulation_3<Gt, Tds, Lds>::
-inexact_locate(const Point & t, Cell_handle start, int n_of_turns,
-               bool *could_lock_zone) const
-{
-  CGAL_triangulation_expensive_assertion(start == Cell_handle() || tds().is_simplex(start) );
-
-  if (could_lock_zone)
-    *could_lock_zone = true;
-
-  if(dimension() < 3) return start;
-
-  // Make sure we continue from here with a finite cell.
-  if ( start == Cell_handle() )
-    start = infinite_cell();
-
-  // CJTODO: useless?
-  if (could_lock_zone)
-  {
-    if (!this->try_lock_cell(start))
-    {
-      *could_lock_zone = false;
-      return Cell_handle();
-    }
-  }
-
-  int ind_inf;
-  if( start->has_vertex(infinite, ind_inf) )
-    start = start->neighbor(ind_inf);
-
-  CGAL_triangulation_precondition( start != Cell_handle() );
-  CGAL_triangulation_precondition( ! start->has_vertex(infinite) );
-
-  // We implement the remembering visibility walk.
-  // in this phase, no need to be stochastic
-
-  // Remembers the previous cell to avoid useless orientation tests.
-  Cell_handle previous = Cell_handle();
-  Cell_handle c = start;
-
-  if (could_lock_zone)
-  {
-    if (!this->try_lock_cell(c))
-    {
-      *could_lock_zone = false;
-      return Cell_handle();
-    }
-  }
-
-  // Now treat the cell c.
-  try_next_cell:
-
-  n_of_turns--;
-
-  // We know that the 4 vertices of c are positively oriented.
-  // So, in order to test if p is seen outside from one of c's facets,
-  // we just replace the corresponding point by p in the orientation
-  // test.  We do this using the array below.
-  const Point* pts[4] = { &(c->vertex(0)->point()),
-                          &(c->vertex(1)->point()),
-                          &(c->vertex(2)->point()),
-                          &(c->vertex(3)->point()) };
-
-  // (non-stochastic) visibility walk
-  for (int i=0; i != 4; ++i) {
-    Cell_handle next = c->neighbor(i);
-    if (previous == next) continue;
-
-    // We temporarily put p at i's place in pts.
-    const Point* backup = pts[i];
-    pts[i] = &t;
-    if( inexact_orientation(*pts[0], *pts[1], *pts[2], *pts[3]) != NEGATIVE) {
-      pts[i] = backup;
-      continue;
-    }
-    if(next->has_vertex(infinite)) {
-      // We are outside the convex hull.
-      return next;
-    }
-    previous = c;
-    c = next;
-    if (could_lock_zone)
-    {
-      //previous->unlock(); // DON'T do that, "c" may be in
-                            // the same locking cell as "previous"
-      if (!this->try_lock_cell(c))
-      {
-        *could_lock_zone = false;
-        return Cell_handle();
-      }
-    }
-    if(n_of_turns) goto try_next_cell;
-  }
-
-  return c;
-}
-#endif // no CGAL_NO_STRUCTURAL_FILTERING
-
-template < class GT, class Tds, class Lds >
-Bounded_side
-Triangulation_3<GT,Tds,Lds>::
-side_of_tetrahedron(const Point & p,
-                    const Point & p0,
-                    const Point & p1,
-                    const Point & p2,
-                    const Point & p3,
-                    Locate_type & lt, int & i, int & j ) const
-  // p0,p1,p2,p3 supposed to be non coplanar
-  // tetrahedron p0,p1,p2,p3 is supposed to be well oriented
-  // returns :
-  // ON_BOUNDED_SIDE if p lies strictly inside the tetrahedron
-  // ON_BOUNDARY if p lies on one of the facets
-  // ON_UNBOUNDED_SIDE if p lies strictly outside the tetrahedron
-{
-  CGAL_triangulation_precondition
-    ( orientation(p0,p1,p2,p3) == POSITIVE );
-
-  Orientation o0,o1,o2,o3;
-  if ( ((o0 = orientation(p,p1,p2,p3)) == NEGATIVE) ||
-       ((o1 = orientation(p0,p,p2,p3)) == NEGATIVE) ||
-       ((o2 = orientation(p0,p1,p,p3)) == NEGATIVE) ||
-       ((o3 = orientation(p0,p1,p2,p)) == NEGATIVE) ) {
-    lt = OUTSIDE_CONVEX_HULL;
-    return ON_UNBOUNDED_SIDE;
-  }
-
-  // now all the oi's are >=0
-  // sum gives the number of facets p lies on
-  int sum = ( (o0 == ZERO) ? 1 : 0 )
-          + ( (o1 == ZERO) ? 1 : 0 )
-          + ( (o2 == ZERO) ? 1 : 0 )
-          + ( (o3 == ZERO) ? 1 : 0 );
-
-  switch (sum) {
-  case 0:
-    {
-      lt = CELL;
-      return ON_BOUNDED_SIDE;
-    }
-  case 1:
-    {
-      lt = FACET;
-      // i = index such that p lies on facet(i)
-      i = ( o0 == ZERO ) ? 0 :
-          ( o1 == ZERO ) ? 1 :
-          ( o2 == ZERO ) ? 2 :
-          3;
-      return ON_BOUNDARY;
-    }
-  case 2:
-    {
-      lt = EDGE;
-      // i = smallest index such that p does not lie on facet(i)
-      // i must be < 3 since p lies on 2 facets
-      i = ( o0 == POSITIVE ) ? 0 :
-          ( o1 == POSITIVE ) ? 1 :
-          2;
-      // j = larger index such that p not on facet(j)
-      // j must be > 0 since p lies on 2 facets
-      j = ( o3 == POSITIVE ) ? 3 :
-          ( o2 == POSITIVE ) ? 2 :
-          1;
-      return ON_BOUNDARY;
-    }
-  case 3:
-    {
-      lt = VERTEX;
-      // i = index such that p does not lie on facet(i)
-      i = ( o0 == POSITIVE ) ? 0 :
-          ( o1 == POSITIVE ) ? 1 :
-          ( o2 == POSITIVE ) ? 2 :
-          3;
-      return ON_BOUNDARY;
-    }
-  default:
-    {
-      // impossible : cannot be on 4 facets for a real tetrahedron
-      CGAL_triangulation_assertion(false);
-      return ON_BOUNDARY;
-    }
-  }
-}
-
-template < class GT, class Tds, class Lds >
-Bounded_side
-Triangulation_3<GT,Tds,Lds>::
-side_of_cell(const Point & p,
-             Cell_handle c,
-             Locate_type & lt, int & i, int & j) const
-  // returns
-  // ON_BOUNDED_SIDE if p inside the cell
-  // (for an infinite cell this means that p lies strictly in the half space
-  // limited by its finite facet)
-  // ON_BOUNDARY if p on the boundary of the cell
-  // (for an infinite cell this means that p lies on the *finite* facet)
-  // ON_UNBOUNDED_SIDE if p lies outside the cell
-  // (for an infinite cell this means that p is not in the preceding
-  // two cases)
-  // lt has a meaning only when ON_BOUNDED_SIDE or ON_BOUNDARY
-{
-  CGAL_triangulation_precondition( dimension() == 3 );
-  if ( ! is_infinite(c) ) {
-    return side_of_tetrahedron(p,
-                               c->vertex(0)->point(),
-                               c->vertex(1)->point(),
-                               c->vertex(2)->point(),
-                               c->vertex(3)->point(),
-                               lt, i, j);
-  }
-  else {
-    int inf = c->index(infinite);
-    Orientation o;
-    Vertex_handle
-      v1=c->vertex((inf+1)&3),
-      v2=c->vertex((inf+2)&3),
-      v3=c->vertex((inf+3)&3);
-    if ( (inf&1) == 0 )
-      o = orientation(p, v1->point(), v2->point(), v3->point());
-    else
-      o =  orientation(v3->point(), p, v1->point(), v2->point());
-
-    switch (o) {
-    case POSITIVE:
-      {
-        lt = CELL;
-        return ON_BOUNDED_SIDE;
-      }
-    case NEGATIVE:
-      return ON_UNBOUNDED_SIDE;
-    case ZERO:
-      {
-        // location in the finite facet
-        int i_f, j_f;
-        Bounded_side side =
-          side_of_triangle(p, v1->point(), v2->point(), v3->point(),
-                           lt, i_f, j_f);
-        // lt need not be modified in most cases :
-        switch (side) {
-        case ON_BOUNDED_SIDE:
-          {
-            // lt == FACET ok
-            i = inf;
-            return ON_BOUNDARY;
-          }
-        case ON_BOUNDARY:
-          {
-            // lt == VERTEX OR EDGE ok
-            i = ( i_f == 0 ) ? ((inf+1)&3) :
-                ( i_f == 1 ) ? ((inf+2)&3) :
-                ((inf+3)&3);
-            if ( lt == EDGE ) {
-              j = (j_f == 0 ) ? ((inf+1)&3) :
-                  ( j_f == 1 ) ? ((inf+2)&3) :
-                  ((inf+3)&3);
-            }
-            return ON_BOUNDARY;
-          }
-        case ON_UNBOUNDED_SIDE:
-          {
-            // p lies on the plane defined by the finite facet
-            // lt must be initialized
-            return ON_UNBOUNDED_SIDE;
-          }
-        default:
-          {
-            CGAL_triangulation_assertion(false);
-            return ON_BOUNDARY;
-          }
-        } // switch side
-      }// case ZERO
-    default:
-      {
-        CGAL_triangulation_assertion(false);
-        return ON_BOUNDARY;
-      }
-    } // switch o
-  } // else infinite cell
-} // side_of_cell
-
-template < class GT, class Tds, class Lds >
-Bounded_side
-Triangulation_3<GT,Tds,Lds>::
-side_of_triangle(const Point & p,
-                 const Point & p0,
-                 const Point & p1,
-                 const Point & p2,
-                 Locate_type & lt, int & i, int & j ) const
-  // p0,p1,p2 supposed to define a plane
-  // p supposed to lie on plane p0,p1,p2
-  // triangle p0,p1,p2 defines the orientation of the plane
-  // returns
-  // ON_BOUNDED_SIDE if p lies strictly inside the triangle
-  // ON_BOUNDARY if p lies on one of the edges
-  // ON_UNBOUNDED_SIDE if p lies strictly outside the triangle
-{
-  CGAL_triangulation_precondition( coplanar(p,p0,p1,p2) );
-
-  Orientation o012 = coplanar_orientation(p0,p1,p2);
-  CGAL_triangulation_precondition( o012 != COLLINEAR );
-
-  Orientation o0; // edge p0 p1
-  Orientation o1; // edge p1 p2
-  Orientation o2; // edge p2 p0
-
-  if ((o0 = coplanar_orientation(p0,p1,p)) == opposite(o012) ||
-      (o1 = coplanar_orientation(p1,p2,p)) == opposite(o012) ||
-      (o2 = coplanar_orientation(p2,p0,p)) == opposite(o012)) {
-    lt = OUTSIDE_CONVEX_HULL;
-    return ON_UNBOUNDED_SIDE;
-  }
-
-  // now all the oi's are >=0
-  // sum gives the number of edges p lies on
-  int sum = ( (o0 == ZERO) ? 1 : 0 )
-          + ( (o1 == ZERO) ? 1 : 0 )
-          + ( (o2 == ZERO) ? 1 : 0 );
-
-  switch (sum) {
-  case 0:
-    {
-      lt = FACET;
-      return ON_BOUNDED_SIDE;
-    }
-  case 1:
-    {
-      lt = EDGE;
-      i = ( o0 == ZERO ) ? 0 :
-          ( o1 == ZERO ) ? 1 :
-          2;
-      if ( i == 2 )
-        j=0;
-      else
-        j = i+1;
-      return ON_BOUNDARY;
-    }
-  case 2:
-    {
-      lt = VERTEX;
-      i = ( o0 == o012 ) ? 2 :
-          ( o1 == o012 ) ? 0 :
-          1;
-      return ON_BOUNDARY;
-    }
-  default:
-    {
-      // cannot happen
-      CGAL_triangulation_assertion(false);
-      return ON_BOUNDARY;
-    }
-  }
-}
-
-template < class GT, class Tds, class Lds >
-Bounded_side
-Triangulation_3<GT,Tds,Lds>::
-side_of_facet(const Point & p,
-              Cell_handle c,
-              Locate_type & lt, int & li, int & lj) const
-  // supposes dimension 2 otherwise does not work for infinite facets
-  // returns :
-  // ON_BOUNDED_SIDE if p inside the facet
-  // (for an infinite facet this means that p lies strictly in the half plane
-  // limited by its finite edge)
-  // ON_BOUNDARY if p on the boundary of the facet
-  // (for an infinite facet this means that p lies on the *finite* edge)
-  // ON_UNBOUNDED_SIDE if p lies outside the facet
-  // (for an infinite facet this means that p is not in the
-  // preceding two cases)
-  // lt has a meaning only when ON_BOUNDED_SIDE or ON_BOUNDARY
-  // when they mean anything, li and lj refer to indices in the cell c
-  // giving the facet (c,i)
-{
-  CGAL_triangulation_precondition( dimension() == 2 );
-  if ( ! is_infinite(c,3) ) {
-    // The following precondition is useless because it is written
-    // in side_of_facet
-    // 	CGAL_triangulation_precondition( coplanar (p,
-    // 					  c->vertex(0)->point,
-    // 					  c->vertex(1)->point,
-    // 					  c->vertex(2)->point) );
-    int i_t, j_t;
-    Bounded_side side = side_of_triangle(p,
-                            c->vertex(0)->point(),
-                            c->vertex(1)->point(),
-                            c->vertex(2)->point(),
-                            lt, i_t, j_t);
-    // We protect the following code by this test to avoid valgrind messages.
-    if (side == ON_BOUNDARY) {
-        // indices in the original cell :
-        li = ( i_t == 0 ) ? 0 :
-             ( i_t == 1 ) ? 1 : 2;
-        lj = ( j_t == 0 ) ? 0 :
-             ( j_t == 1 ) ? 1 : 2;
-    }
-    return side;
-  }
-  // else infinite facet
-  int inf = c->index(infinite);
-    // The following precondition is useless because it is written
-    // in side_of_facet
-    // 	CGAL_triangulation_precondition( coplanar (p,
-    // 				  c->neighbor(inf)->vertex(0)->point(),
-    // 				  c->neighbor(inf)->vertex(1)->point(),
-    // 				  c->neighbor(inf)->vertex(2)->point()));
-  int i2 = next_around_edge(inf,3);
-  int i1 = 3-inf-i2;
-  Vertex_handle v1 = c->vertex(i1),
-                v2 = c->vertex(i2);
-
-  CGAL_triangulation_assertion(coplanar_orientation(v1->point(), v2->point(),
-                               mirror_vertex(c, inf)->point()) == POSITIVE);
-
-  switch (coplanar_orientation(v1->point(), v2->point(), p)) {
-  case POSITIVE:
-      // p lies on the same side of v1v2 as vn, so not in f
-      return ON_UNBOUNDED_SIDE;
-  case NEGATIVE:
-      // p lies in f
-      lt = FACET;
-      li = 3;
-      return ON_BOUNDED_SIDE;
-  default: // case ZERO:
-      // p collinear with v1v2
-      int i_e;
-      switch (side_of_segment(p, v1->point(), v2->point(), lt, i_e)) {
-        // computation of the indices in the original cell
-      case ON_BOUNDED_SIDE:
-          // lt == EDGE ok
-          li = i1;
-          lj = i2;
-          return ON_BOUNDARY;
-      case ON_BOUNDARY:
-          // lt == VERTEX ok
-          li = ( i_e == 0 ) ? i1 : i2;
-          return ON_BOUNDARY;
-      default: // case ON_UNBOUNDED_SIDE:
-          // p lies on the line defined by the finite edge
-          return ON_UNBOUNDED_SIDE;
-      }
-  }
-}
-
-template < class GT, class Tds, class Lds >
-Bounded_side
-Triangulation_3<GT,Tds,Lds>::
-side_of_segment(const Point & p,
-                const Point & p0,
-                const Point & p1,
-                Locate_type & lt, int & i ) const
-  // p0, p1 supposed to be different
-  // p supposed to be collinear to p0, p1
-  // returns :
-  // ON_BOUNDED_SIDE if p lies strictly inside the edge
-  // ON_BOUNDARY if p equals p0 or p1
-  // ON_UNBOUNDED_SIDE if p lies strictly outside the edge
-{
-  CGAL_triangulation_precondition( ! equal(p0, p1) );
-  CGAL_triangulation_precondition( collinear(p, p0, p1) );
-
-  switch (collinear_position(p0, p, p1)) {
-  case MIDDLE:
-    lt = EDGE;
-    return ON_BOUNDED_SIDE;
-  case SOURCE:
-    lt = VERTEX;
-    i = 0;
-    return ON_BOUNDARY;
-  case TARGET:
-    lt = VERTEX;
-    i = 1;
-    return ON_BOUNDARY;
-  default: // case BEFORE: case AFTER:
-    lt = OUTSIDE_CONVEX_HULL;
-    return ON_UNBOUNDED_SIDE;
-  }
-}
-
-template < class GT, class Tds, class Lds >
-Bounded_side
-Triangulation_3<GT,Tds,Lds>::
-side_of_edge(const Point & p,
-             Cell_handle c,
-             Locate_type & lt, int & li) const
-  // supposes dimension 1 otherwise does not work for infinite edges
-  // returns :
-  // ON_BOUNDED_SIDE if p inside the edge
-  // (for an infinite edge this means that p lies in the half line
-  // defined by the vertex)
-  // ON_BOUNDARY if p equals one of the vertices
-  // ON_UNBOUNDED_SIDE if p lies outside the edge
-  // (for an infinite edge this means that p lies on the other half line)
-  // lt has a meaning when ON_BOUNDED_SIDE and ON_BOUNDARY
-  // li refer to indices in the cell c
-{
-  CGAL_triangulation_precondition( dimension() == 1 );
-  if ( ! is_infinite(c,0,1) )
-    return side_of_segment(p, c->vertex(0)->point(), c->vertex(1)->point(),
-                           lt, li);
-  // else infinite edge
-  int inf = c->index(infinite);
-  switch (collinear_position(c->vertex(1-inf)->point(), p,
-                             mirror_vertex(c, inf)->point())) {
-      case SOURCE:
-          lt = VERTEX;
-          li = 1-inf;
-          return ON_BOUNDARY;
-      case BEFORE:
-          lt = EDGE;
-          return ON_BOUNDED_SIDE;
-      default: // case MIDDLE: case AFTER: case TARGET:
-          return ON_UNBOUNDED_SIDE;
-  }
-}
-
-template < class GT, class Tds, class Lds >
-bool
-Triangulation_3<GT,Tds,Lds>::
-flip( Cell_handle c, int i )
-{
-  CGAL_triangulation_precondition( (dimension() == 3) && (0<=i) && (i<4)
-                                   && (number_of_vertices() >= 5) );
-
-  Cell_handle n = c->neighbor(i);
-  int in = n->index(c);
-  if ( is_infinite( c ) || is_infinite( n ) ) return false;
-
-  if ( i%2 == 1 ) {
-    if ( orientation( c->vertex((i+1)&3)->point(),
-                      c->vertex((i+2)&3)->point(),
-                      n->vertex(in)->point(),
-                      c->vertex(i)->point() )
-         != POSITIVE ) return false;
-    if ( orientation( c->vertex((i+2)&3)->point(),
-                      c->vertex((i+3)&3)->point(),
-                      n->vertex(in)->point(),
-                      c->vertex(i)->point() )
-         != POSITIVE ) return false;
-    if ( orientation( c->vertex((i+3)&3)->point(),
-                      c->vertex((i+1)&3)->point(),
-                      n->vertex(in)->point(),
-                      c->vertex(i)->point() )
-         != POSITIVE ) return false;
-  }
-  else {
-    if ( orientation( c->vertex((i+2)&3)->point(),
-                      c->vertex((i+1)&3)->point(),
-                      n->vertex(in)->point(),
-                      c->vertex(i)->point() )
-         != POSITIVE ) return false;
-    if ( orientation( c->vertex((i+3)&3)->point(),
-                      c->vertex((i+2)&3)->point(),
-                      n->vertex(in)->point(),
-                      c->vertex(i)->point() )
-         != POSITIVE ) return false;
-    if ( orientation( c->vertex((i+1)&3)->point(),
-                      c->vertex((i+3)&3)->point(),
-                      n->vertex(in)->point(),
-                      c->vertex(i)->point() )
-         != POSITIVE ) return false;
-  }
-
-  _tds.flip_flippable(c, i);
-  return true;
-}
-
-template < class GT, class Tds, class Lds >
-void
-Triangulation_3<GT,Tds,Lds>::
-flip_flippable( Cell_handle c, int i )
-{
-  CGAL_triangulation_precondition( (dimension() == 3) && (0<=i) && (i<4)
-                                   && (number_of_vertices() >= 5) );
-  CGAL_triangulation_precondition_code( Cell_handle n = c->neighbor(i); );
-  CGAL_triangulation_precondition_code( int in = n->index(c); );
-  CGAL_triangulation_precondition( ( ! is_infinite( c ) ) &&
-                                   ( ! is_infinite( n ) ) );
-
-  if ( i%2 == 1 ) {
-    CGAL_triangulation_precondition( orientation( c->vertex((i+1)&3)->point(),
-                                                  c->vertex((i+2)&3)->point(),
-                                                  n->vertex(in)->point(),
-                                                  c->vertex(i)->point() )
-                                     == POSITIVE );
-    CGAL_triangulation_precondition( orientation( c->vertex((i+2)&3)->point(),
-                                                  c->vertex((i+3)&3)->point(),
-                                                  n->vertex(in)->point(),
-                                                  c->vertex(i)->point() )
-                                     == POSITIVE );
-    CGAL_triangulation_precondition( orientation( c->vertex((i+3)&3)->point(),
-                                                  c->vertex((i+1)&3)->point(),
-                                                  n->vertex(in)->point(),
-                                                  c->vertex(i)->point() )
-                                     == POSITIVE );
-  }
-  else {
-    CGAL_triangulation_precondition( orientation( c->vertex((i+2)&3)->point(),
-                                                  c->vertex((i+1)&3)->point(),
-                                                  n->vertex(in)->point(),
-                                                  c->vertex(i)->point() )
-                                     == POSITIVE );
-    CGAL_triangulation_precondition( orientation( c->vertex((i+3)&3)->point(),
-                                                  c->vertex((i+2)&3)->point(),
-                                                  n->vertex(in)->point(),
-                                                  c->vertex(i)->point() )
-                                     == POSITIVE );
-    CGAL_triangulation_precondition( orientation( c->vertex((i+1)&3)->point(),
-                                                  c->vertex((i+3)&3)->point(),
-                                                  n->vertex(in)->point(),
-                                                  c->vertex(i)->point() )
-                                     == POSITIVE );
-  }
-
-  _tds.flip_flippable(c, i);
-}
-
-template < class GT, class Tds, class Lds >
-bool
-Triangulation_3<GT,Tds,Lds>::
-flip( Cell_handle c, int i, int j )
-  // flips edge i,j of cell c
-{
-  CGAL_triangulation_precondition( (dimension() == 3)
-                                   && (0<=i) && (i<4)
-                                   && (0<=j) && (j<4)
-                                   && ( i != j )
-                                   && (number_of_vertices() >= 5) );
-
-  // checks that degree 3 and not on the convex hull
-  int degree = 0;
-  Cell_circulator ccir = incident_cells(c,i,j);
-  Cell_circulator cdone = ccir;
-  do {
-    if ( is_infinite(ccir) ) return false;
-    ++degree;
-    ++ccir;
-  } while ( ccir != cdone );
-
-  if ( degree != 3 ) return false;
-
-  // checks that future tetrahedra are well oriented
-  Cell_handle n = c->neighbor( next_around_edge(i,j) );
-  int in = n->index( c->vertex(i) );
-  int jn = n->index( c->vertex(j) );
-  if ( orientation( c->vertex(next_around_edge(i,j))->point(),
-                    c->vertex(next_around_edge(j,i))->point(),
-                    n->vertex(next_around_edge(jn,in))->point(),
-                    c->vertex(j)->point() )
-       != POSITIVE ) return false;
-  if ( orientation( c->vertex(i)->point(),
-                    c->vertex(next_around_edge(j,i))->point(),
-                    n->vertex(next_around_edge(jn,in))->point(),
-                    c->vertex(next_around_edge(i,j))->point() )
-       != POSITIVE ) return false;
-
-  _tds.flip_flippable(c, i, j);
-  return true;
-}
-
-template < class GT, class Tds, class Lds >
-void
-Triangulation_3<GT,Tds,Lds>::
-flip_flippable( Cell_handle c, int i, int j )
-  // flips edge i,j of cell c
-{
-#if !defined CGAL_TRIANGULATION_NO_PRECONDITIONS && \
-    !defined CGAL_NO_PRECONDITIONS && !defined NDEBUG
-  CGAL_triangulation_precondition( (dimension() == 3)
-                                   && (0<=i) && (i<4)
-                                   && (0<=j) && (j<4)
-                                   && ( i != j )
-                                   && (number_of_vertices() >= 5) );
-  int degree = 0;
-  Cell_circulator ccir = incident_cells(c,i,j);
-  Cell_circulator cdone = ccir;
-  do {
-    CGAL_triangulation_precondition( ! is_infinite(ccir) );
-    ++degree;
-    ++ccir;
-  } while ( ccir != cdone );
-  CGAL_triangulation_precondition( degree == 3 );
-
-  Cell_handle n = c->neighbor( next_around_edge(i, j) );
-  int in = n->index( c->vertex(i) );
-  int jn = n->index( c->vertex(j) );
-  CGAL_triangulation_precondition
-    ( orientation( c->vertex(next_around_edge(i,j))->point(),
-                   c->vertex(next_around_edge(j,i))->point(),
-                   n->vertex(next_around_edge(jn,in))->point(),
-                   c->vertex(j)->point() ) == POSITIVE );
-  CGAL_triangulation_precondition
-    ( orientation( c->vertex(i)->point(),
-                   c->vertex(next_around_edge(j,i))->point(),
-                   n->vertex(next_around_edge(jn,in))->point(),
-                   c->vertex(next_around_edge(i,j))->point() ) == POSITIVE );
-#endif
-  _tds.flip_flippable(c, i, j);
-}
-
-template < class GT, class Tds, class Lds >
-typename Triangulation_3<GT,Tds,Lds>::Vertex_handle
-Triangulation_3<GT,Tds,Lds>::
-insert(const Point & p, Cell_handle start)
-{
-  Locate_type lt;
-  int li, lj;
-  Cell_handle c = locate( p, lt, li, lj, start);
-  return insert(p, lt, c, li, lj);
-}
-
-template < class GT, class Tds, class Lds >
-typename Triangulation_3<GT,Tds,Lds>::Vertex_handle
-Triangulation_3<GT,Tds,Lds>::
-insert(const Point & p, Locate_type lt, Cell_handle c, int li, int lj)
-{
-  switch (lt) {
-  case VERTEX:
-    return c->vertex(li);
-  case EDGE:
-    return insert_in_edge(p, c, li, lj);
-  case FACET:
-    return insert_in_facet(p, c, li);
-  case CELL:
-    return insert_in_cell(p, c);
-  case OUTSIDE_CONVEX_HULL:
-    return insert_outside_convex_hull(p, c);
-  case OUTSIDE_AFFINE_HULL:
-  default:
-    return insert_outside_affine_hull(p);
-  }
-}
-
-
-
-template < class GT, class Tds, class Lds >
-template < class Conflict_tester, class Hidden_points_visitor >
-typename Triangulation_3<GT,Tds,Lds>::Vertex_handle
-Triangulation_3<GT,Tds,Lds>::
-insert_in_conflict(const Point & p,
-                   Locate_type lt, Cell_handle c, int li, int /*lj*/,
-                   const Conflict_tester &tester,
-                   Hidden_points_visitor &hider,
-                   bool *could_lock_zone)
-{
-  if (could_lock_zone)
-    *could_lock_zone = true;
-
-  switch (dimension()) {
-  case 3:
-    {
-      if ((lt == VERTEX) &&
-          (tester.compare_weight(c->vertex(li)->point(), p)==0) ) {
-        return c->vertex(li);
-      }
-      // If the new point is not in conflict with its cell, it is hidden.
-      if (!tester.test_initial_cell(c)) {
-        hider.hide_point(c,p);
-        return Vertex_handle();
-      }
-
-      // Ok, we really insert the point now.
-      // First, find the conflict region.
-      std::vector<Cell_handle> cells;
-      Facet facet;
-
-      cells.reserve(32);
-
-      // Parallel
-      if (could_lock_zone)
-      {
-        std::vector<Facet> facets;
-        facets.reserve(32);
-
-        find_conflicts(
-          c,
-          tester,
-          make_triple(
-            std::back_inserter(facets),
-                                    std::back_inserter(cells),
-            Emptyset_iterator()),
-          could_lock_zone);
-
-        if (*could_lock_zone == false)
-        {
-          BOOST_FOREACH(Cell_handle& ch,
-            std::make_pair(cells.begin(), cells.end()))
-          {
-            ch->tds_data().clear();
-          }
-
-          BOOST_FOREACH(Facet& f,
-            std::make_pair(facets.begin(), facets.end()))
-          {
-            f.first->neighbor(f.second)->tds_data().clear();
-          }
-          return Vertex_handle();
-        }
-
-        facet = facets.back();
-      }
-      // Sequential
-      else
-      {
-        cells.reserve(32);
-        find_conflicts(
-          c,
-          tester,
-          make_triple(
-            Oneset_iterator<Facet>(facet),
-                                    std::back_inserter(cells),
-                                    Emptyset_iterator()));
-      }
-
-
-      // Remember the points that are hidden by the conflicting cells,
-      // as they will be deleted during the insertion.
-      hider.process_cells_in_conflict(cells.begin(), cells.end());
-
-      Vertex_handle v = _insert_in_hole(p, cells.begin(), cells.end(),
-                                        facet.first, facet.second);
-
-      // Store the hidden points in their new cells.
-      hider.reinsert_vertices(v);
-      return v;
-    }
-  case 2:
-    {
-      // This check is added compared to the 3D case
-      if (lt == OUTSIDE_AFFINE_HULL)
-        return insert_outside_affine_hull (p);
-
-      if ((lt == VERTEX) &&
-          (tester.compare_weight(c->vertex(li)->point(), p)==0) ) {
-        return c->vertex(li);
-      }
-      // If the new point is not in conflict with its cell, it is hidden.
-      if (!tester.test_initial_cell(c)) {
-        hider.hide_point(c,p);
-        return Vertex_handle();
-      }
-
-      // Ok, we really insert the point now.
-      // First, find the conflict region.
-      std::vector<Cell_handle> cells;
-      Facet facet;
-
-      cells.reserve(32);
-      find_conflicts
-        (c, tester, make_triple(Oneset_iterator<Facet>(facet),
-                                std::back_inserter(cells),
-                                Emptyset_iterator()));
-
-      // Remember the points that are hidden by the conflicting cells,
-      // as they will be deleted during the insertion.
-      hider.process_cells_in_conflict(cells.begin(), cells.end());
-
-      Vertex_handle v = _insert_in_hole(p, cells.begin(), cells.end(),
-                                        facet.first, facet.second);
-
-      // Store the hidden points in their new cells.
-      hider.reinsert_vertices(v);
-      return v;
-    }
-  default:
-    {
-      // dimension() <= 1
-      if (lt == OUTSIDE_AFFINE_HULL)
-        return insert_outside_affine_hull (p);
-
-      if (lt == VERTEX &&
-          tester.compare_weight(c->vertex(li)->point(), p) == 0) {
-        return c->vertex(li);
-      }
-
-      // If the new point is not in conflict with its cell, it is hidden.
-      if (! tester.test_initial_cell(c)) {
-        hider.hide_point(c,p);
-        return Vertex_handle();
-      }
-
-      if (dimension() == 0) {
-        return hider.replace_vertex(c, li, p);
-      }
-
-
-      // dimension() == 1;
-
-      // Ok, we really insert the point now.
-      // First, find the conflict region.
-      std::vector<Cell_handle> cells;
-      Facet facet;
-      Cell_handle bound[2];
-      // corresponding index: bound[j]->neighbor(1-j) is in conflict.
-
-      // We get all cells in conflict,
-      // and remember the 2 external boundaries.
-      cells.push_back(c);
-
-      for (int j = 0; j<2; ++j) {
-        Cell_handle n = c->neighbor(j);
-        while ( tester(n) ) {
-          cells.push_back(n);
-          n = n->neighbor(j);
-        }
-        bound[j] = n;
-      }
-
-      // Insertion.
-      hider.process_cells_in_conflict(cells.begin(), cells.end());
-
-      tds().delete_cells(cells.begin(), cells.end());
-
-      // We preserve the order (like the orientation in 2D-3D).
-      Vertex_handle v = tds().create_vertex();
-      Cell_handle c0 = tds().create_face(v, bound[0]->vertex(0), Vertex_handle());
-      Cell_handle c1 = tds().create_face(bound[1]->vertex(1), v, Vertex_handle());
-      tds().set_adjacency(c0, 1, c1, 0);
-      tds().set_adjacency(bound[0], 1, c0, 0);
-      tds().set_adjacency(c1, 1, bound[1], 0);
-      bound[0]->vertex(0)->set_cell(bound[0]);
-      bound[1]->vertex(1)->set_cell(bound[1]);
-      v->set_cell(c0);
-      v->set_point (p);
-
-      hider.reinsert_vertices(v);
-
-      return v;
-    }
-  }
-}
-
-template < class GT, class Tds, class Lds >
-typename Triangulation_3<GT,Tds,Lds>::Vertex_handle
-Triangulation_3<GT,Tds,Lds>::
-insert_in_cell(const Point & p, Cell_handle c)
-{
-  CGAL_triangulation_precondition( dimension() == 3 );
-  CGAL_triangulation_precondition_code
-    ( Locate_type lt;
-      int i; int j; );
-  CGAL_triangulation_precondition
-    ( side_of_tetrahedron( p,
-                           c->vertex(0)->point(),
-                           c->vertex(1)->point(),
-                           c->vertex(2)->point(),
-                           c->vertex(3)->point(),
-                           lt,i,j ) == ON_BOUNDED_SIDE );
-
-    Vertex_handle v = _tds.insert_in_cell(c);
-    v->set_point(p);
-    return v;
-}
-
-template < class GT, class Tds, class Lds >
-inline
-typename Triangulation_3<GT,Tds,Lds>::Vertex_handle
-Triangulation_3<GT,Tds,Lds>::
-insert_in_facet(const Point & p, Cell_handle c, int i)
-{
-  CGAL_triangulation_precondition( dimension() == 2 || dimension() == 3);
-  CGAL_triangulation_precondition( (dimension() == 2 && i == 3)
-                                || (dimension() == 3 && i >= 0 && i <= 3) );
-  CGAL_triangulation_exactness_precondition_code
-    ( Locate_type lt;
-      int li; int lj; );
-  CGAL_triangulation_exactness_precondition
-    ( coplanar( p, c->vertex((i+1)&3)->point(),
-                   c->vertex((i+2)&3)->point(),
-                   c->vertex((i+3)&3)->point() )
-      &&
-      side_of_triangle( p,
-                        c->vertex((i+1)&3)->point(),
-                        c->vertex((i+2)&3)->point(),
-                        c->vertex((i+3)&3)->point(),
-                        lt, li, lj) == ON_BOUNDED_SIDE );
-
-    Vertex_handle v = _tds.insert_in_facet(c, i);
-    v->set_point(p);
-    return v;
-}
-
-template < class GT, class Tds, class Lds >
-typename Triangulation_3<GT,Tds,Lds>::Vertex_handle
-Triangulation_3<GT,Tds,Lds>::
-insert_in_edge(const Point & p, Cell_handle c, int i, int j)
-{
-  CGAL_triangulation_precondition( i != j );
-  CGAL_triangulation_precondition( dimension() >= 1 && dimension() <= 3 );
-  CGAL_triangulation_precondition( i >= 0 && i <= dimension()
-                                   && j >= 0 && j <= dimension() );
-  CGAL_triangulation_exactness_precondition_code( Locate_type lt; int li; );
-  switch ( dimension() ) {
-  case 3:
-  case 2:
-    {
-      CGAL_triangulation_precondition( ! is_infinite(c, i, j) );
-      CGAL_triangulation_exactness_precondition(
-                         collinear( c->vertex(i)->point(),
-                                    p,
-                                    c->vertex(j)->point() )
-                      && side_of_segment( p,
-                                          c->vertex(i)->point(),
-                                          c->vertex(j)->point(),
-                                          lt, li ) == ON_BOUNDED_SIDE );
-      break;
-    }
-  case 1:
-    {
-      CGAL_triangulation_exactness_precondition( side_of_edge(p, c, lt, li)
-                                                 == ON_BOUNDED_SIDE );
-      break;
-    }
-  }
-
-  Vertex_handle v = _tds.insert_in_edge(c, i, j);
-  v->set_point(p);
-  return v;
-}
-
-template < class GT, class Tds, class Lds >
-typename Triangulation_3<GT,Tds,Lds>::Vertex_handle
-Triangulation_3<GT,Tds,Lds>::
-insert_outside_convex_hull(const Point & p, Cell_handle c)
-  // c is an infinite cell containing p
-  // p is strictly outside the convex hull
-  // dimension 0 not allowed, use outside-affine-hull
-{
-  CGAL_triangulation_precondition( dimension() > 0 );
-  CGAL_triangulation_precondition( c->has_vertex(infinite) );
-  // the precondition that p is in c is tested in each of the
-  // insertion methods called from this method
-  switch ( dimension() ) {
-  case 1:
-    {
-      // 	// p lies in the infinite edge neighboring c
-      // 	// on the other side of li
-      // 	return insert_in_edge(p,c->neighbor(1-li),0,1);
-      return insert_in_edge(p,c,0,1);
-    }
-  case 2:
-    {
-      Conflict_tester_outside_convex_hull_2 tester(p, this);
-      Vertex_handle v = insert_conflict(c, tester);
-      v->set_point(p);
-      return v;
-    }
-  default: // case 3:
-    {
-      Conflict_tester_outside_convex_hull_3 tester(p, this);
-      Vertex_handle v = insert_conflict(c, tester);
-      v->set_point(p);
-      return v;
-    }
-  }
-}
-
-template < class GT, class Tds, class Lds >
-typename Triangulation_3<GT,Tds,Lds>::Vertex_handle
-Triangulation_3<GT,Tds,Lds>::
-insert_outside_affine_hull(const Point & p)
-{
-  CGAL_triangulation_precondition( dimension() < 3 );
-  bool reorient;
-  switch ( dimension() ) {
-  case 1:
-    {
-      Cell_handle c = infinite_cell();
-      Cell_handle n = c->neighbor(c->index(infinite_vertex()));
-      Orientation o = coplanar_orientation(n->vertex(0)->point(),
-                                           n->vertex(1)->point(), p);
-      CGAL_triangulation_precondition ( o != COLLINEAR );
-      reorient = o == NEGATIVE;
-      break;
-    }
-  case 2:
-    {
-      Cell_handle c = infinite_cell();
-      Cell_handle n = c->neighbor(c->index(infinite_vertex()));
-      Orientation o = orientation( n->vertex(0)->point(),
-                                   n->vertex(1)->point(),
-                                   n->vertex(2)->point(), p );
-      CGAL_triangulation_precondition ( o != COPLANAR );
-      reorient = o == NEGATIVE;
-      break;
-    }
-  default:
-    reorient = false;
-  }
-
-  Vertex_handle v = _tds.insert_increase_dimension(infinite_vertex());
-  v->set_point(p);
-
-  if (reorient)
-      _tds.reorient();
-
-  return v;
-}
-
-template < class GT, class Tds, class Lds >
-template < class OutputItCells >
-typename Triangulation_3<GT,Tds,Lds>::Vertex_handle
-Triangulation_3<GT,Tds,Lds>::insert_and_give_new_cells(const Point  &p,
-                                                   OutputItCells fit,
-                                                   Cell_handle start)
-{
-  Vertex_handle v = insert(p, start);
-  int dimension = this->dimension();
-  if(dimension == 3) this->incident_cells(v, fit);
-  else if(dimension == 2)
-  {
-    Cell_handle c = v->cell(), end = c;
-    do {
-      *fit++ = c;
-      int i = c->index(v);
-      c = c->neighbor((i+1)%3);
-    } while(c != end);
-  }
-  else if(dimension == 1)
-  {
-    Cell_handle c = v->cell();
-    *fit++ = c;
-    *fit++ = c->neighbor((~(c->index(v)))&1);
-  }
-  else *fit++ = v->cell(); // dimension = 0
-  return v;
-}
-
-template < class GT, class Tds, class Lds >
-template < class OutputItCells >
-typename Triangulation_3<GT,Tds,Lds>::Vertex_handle
-Triangulation_3<GT,Tds,Lds>::insert_and_give_new_cells(const Point& p,
-                                                   OutputItCells fit,
-                                                   Vertex_handle hint)
-{
-  Vertex_handle v = insert(p, hint);
-  int dimension = this->dimension();
-  if(dimension == 3) this->incident_cells(v, fit);
-  else if(dimension == 2)
-  {
-    Cell_handle c = v->cell(), end = c;
-    do {
-      *fit++ = c;
-      int i = c->index(v);
-      c = c->neighbor((i+1)%3);
-    } while(c != end);
-  }
-  else if(dimension == 1)
-  {
-    Cell_handle c = v->cell();
-    *fit++ = c;
-    *fit++ = c->neighbor((~(c->index(v)))&1);
-  }
-  else *fit++ = v->cell(); // dimension = 0
-  return v;
-}
-
-template < class GT, class Tds, class Lds >
-template < class OutputItCells >
-typename Triangulation_3<GT,Tds,Lds>::Vertex_handle
-Triangulation_3<GT,Tds,Lds>::insert_and_give_new_cells(const Point& p,
-                                                   Locate_type lt,
-                                                   Cell_handle c, int li, int lj,
-                                                   OutputItCells fit)
-{
-  Vertex_handle v = insert(p, lt, c, li, lj);
-  int dimension = this->dimension();
-  if(dimension == 3) this->incident_cells(v, fit);
-  else if(dimension == 2)
-  {
-    Cell_handle c = v->cell(), end = c;
-    do {
-      *fit++ = c;
-      int i = c->index(v);
-      c = c->neighbor((i+1)%3);
-    } while(c != end);
-  }
-  else if(dimension == 1)
-  {
-    Cell_handle c = v->cell();
-    *fit++ = c;
-    *fit++ = c->neighbor((~(c->index(v)))&1);
-  }
-  else *fit++ = v->cell(); // dimension = 0
-  return v;
-}
-
-template <class Gt, class Tds, class Lds>
-typename Triangulation_3<Gt,Tds,Lds>::Vertex_triple
-Triangulation_3<Gt,Tds,Lds>::
-make_vertex_triple(const Facet& f) const
-{
-  Cell_handle ch = f.first;
-  int i = f.second;
-
-  return Vertex_triple(ch->vertex(vertex_triple_index(i,0)),
-      ch->vertex(vertex_triple_index(i,1)),
-      ch->vertex(vertex_triple_index(i,2)));
-}
-
-template <class Gt, class Tds, class Lds>
-void
-Triangulation_3<Gt,Tds,Lds>::
-make_canonical(Vertex_triple& t) const
-{
-  int i = (t.first < t.second) ? 0 : 1;
-  if(i==0) {
-    i = (t.first < t.third) ? 0 : 2;
-  } else {
-    i = (t.second < t.third) ? 1 : 2;
-  }
-  Vertex_handle tmp;
-  switch(i){
-  case 0: return;
-  case 1:
-    tmp = t.first;
-    t.first = t.second;
-    t.second = t.third;
-    t.third = tmp;
-    return;
-  default:
-    tmp = t.first;
-    t.first = t.third;
-    t.third = t.second;
-    t.second = tmp;
-  }
-}
-
-template < class GT, class Tds, class Lds >
-bool
-Triangulation_3<GT,Tds,Lds>::
-test_dim_down(Vertex_handle v) const
-  // tests whether removing v decreases the dimension of the triangulation
-  // true iff
-  // v is incident to all finite cells/facets
-  // and all the other vertices are coplanar/collinear in dim3/2.
-{
-  CGAL_triangulation_precondition(dimension() >= 0);
-  CGAL_triangulation_precondition(! is_infinite(v) );
-
-  if (dimension() == 3) {
-      Finite_cells_iterator cit = finite_cells_begin();
-
-      int iv;
-      if ( ! cit->has_vertex(v,iv) )
-          return false;
-      const Point &p1=cit->vertex((iv+1)&3)->point();
-      const Point &p2=cit->vertex((iv+2)&3)->point();
-      const Point &p3=cit->vertex((iv+3)&3)->point();
-      ++cit;
-
-      for (; cit != finite_cells_end(); ++cit ) {
-          if ( ! cit->has_vertex(v,iv) )
-              return false;
-          for (int i=1; i<4; i++ )
-              if ( !coplanar(p1,p2,p3,cit->vertex((iv+i)&3)->point()) )
-                  return false;
-      }
-  }
-  else if (dimension() == 2)
-  {
-      Finite_facets_iterator cit = finite_facets_begin();
-
-      int iv;
-      if ( ! cit->first->has_vertex(v,iv) )
-          return false;
-      const Point &p1 = cit->first->vertex(cw(iv))->point();
-      const Point &p2 = cit->first->vertex(ccw(iv))->point();
-      ++cit;
-
-      for (; cit != finite_facets_end(); ++cit ) {
-          if ( ! cit->first->has_vertex(v,iv) )
-              return false;
-          if ( !collinear(p1, p2, cit->first->vertex(cw(iv))->point()) ||
-               !collinear(p1, p2, cit->first->vertex(ccw(iv))->point()) )
-              return false;
-      }
-  }
-  else // dimension() == 1 or 0
-      return number_of_vertices() == (size_type) dimension() + 1;
-
-  return true;
-}
-
-template < class GT, class Tds, class Lds >
-bool
-Triangulation_3<GT,Tds,Lds>::
-test_dim_down_using_incident_cells_3(
-  Vertex_handle v, std::vector<Cell_handle> &incident_cells,
-  std::vector<Vertex_handle> &adj_vertices,
-  bool *could_lock_zone) const
-{
-  CGAL_triangulation_precondition(dimension() == 3);
-  CGAL_triangulation_precondition(! is_infinite(v) );
-
-  // Collect all vertices on the boundary
-  // and all incident cells
-  if (could_lock_zone)
-  {
-    *could_lock_zone = try_lock_and_get_adjacent_vertices_and_cells_3(
-      v, std::back_inserter(adj_vertices), incident_cells);
-    if (*could_lock_zone == false)
-      return false;
-  }
-  else
-  {
-    adjacent_vertices_and_cells_3(
-      v, std::back_inserter(adj_vertices), incident_cells);
-  }
-
-  typedef Filter_iterator< typename std::vector<Vertex_handle>::const_iterator,
-                           Infinite_tester
-                         > Finite_vertex_iterator;
-  Finite_vertex_iterator vit(
-    adj_vertices.end(), Infinite_tester(this), adj_vertices.begin());
-  Finite_vertex_iterator vit_end(
-    adj_vertices.end(), Infinite_tester(this));
-  const Point &p1 = (*vit++)->point();
-  const Point &p2 = (*vit++)->point();
-  const Point &p3 = (*vit++)->point();
-
-  for ( ; vit != vit_end ; ++vit )
-  {
-          if (!coplanar(p1, p2, p3, (*vit)->point()))
-            return false;
-  }
-
-  for (typename std::vector<Cell_handle>::const_iterator it_inc_cell
-         = incident_cells.begin() ;
-       it_inc_cell != incident_cells.end() ;
-       ++it_inc_cell)
-  {
-    if (!is_infinite(*it_inc_cell))
-      return is_infinite(mirror_vertex(
-        *it_inc_cell, (*it_inc_cell)->index(v)));
-  }
-
-  return true;
-}
-
-template <class Gt, class Tds, class Lds>
-template < class VertexRemover >
-VertexRemover&
-Triangulation_3<Gt, Tds, Lds>::
-make_hole_2D(Vertex_handle v, std::list<Edge_2D> &hole, VertexRemover &remover)
-{
-  std::vector<Cell_handle> to_delete;
-  to_delete.reserve(32);
-
-  Face_circulator fc = tds().incident_faces(v);
-  Face_circulator done(fc);
-
-  // We prepare for deleting all interior cells.
-  // We ->set_cell() pointers to cells outside the hole.
-  // We push the Edges_2D of the boundary (seen from outside) in "hole".
-  do {
-    Cell_handle f = fc;
-    int i = f->index(v);
-    Cell_handle fn = f->neighbor(i);
-    int in = fn->index(f);
-
-    f->vertex(cw(i))->set_cell(fn);
-    fn->set_neighbor(in, Cell_handle());
-
-    hole.push_back(Edge_2D(fn, in));
-    remover.add_hidden_points(f);
-    to_delete.push_back(f);
-
-    ++fc;
-  } while (fc != done);
-
-  tds().delete_cells(to_delete.begin(), to_delete.end());
-  return remover;
-}
-
-// this one also erases a set of cells
-// which is useful to the move method
-// outputting newly created cells
-template <class Gt, class Tds, class Lds>
-template < class VertexRemover >
-VertexRemover&
-Triangulation_3<Gt, Tds, Lds>::
-make_hole_2D(Vertex_handle v, std::list<Edge_2D> &hole, VertexRemover &remover,
-             std::set<Cell_handle> &cells_set)
-{
-  std::vector<Cell_handle> to_delete;
-  to_delete.reserve(32);
-
-  Face_circulator fc = tds().incident_faces(v);
-  Face_circulator done(fc);
-
-  // We prepare for deleting all interior cells.
-  // We ->set_cell() pointers to cells outside the hole.
-  // We push the Edges_2D of the boundary (seen from outside) in "hole".
-  do {
-    Cell_handle f = fc;
-    int i = f->index(v);
-    Cell_handle fn = f->neighbor(i);
-    int in = fn->index(f);
-
-    f->vertex(cw(i))->set_cell(fn);
-    fn->set_neighbor(in, Cell_handle());
-
-    hole.push_back(Edge_2D(fn, in));
-    remover.add_hidden_points(f);
-    to_delete.push_back(f);
-
-    ++fc;
-  } while (fc != done);
-
-  for(typename std::vector<Cell_handle>::const_iterator ib = to_delete.begin(),
-        iend = to_delete.end(); ib != iend; ib++) cells_set.erase(*ib);
-
-  tds().delete_cells(to_delete.begin(), to_delete.end());
-  return remover;
-}
-
-template <class Gt, class Tds, class Lds>
-template < class VertexRemover >
-void
-Triangulation_3<Gt, Tds, Lds>::
-fill_hole_2D(std::list<Edge_2D> & first_hole, VertexRemover &remover)
-{
-  typedef std::list<Edge_2D> Hole;
-
-  std::vector<Hole> hole_list;
-
-  Cell_handle  f, ff, fn;
-  int i, ii, in;
-
-  hole_list.push_back(first_hole);
-
-  while( ! hole_list.empty())
-    {
-      Hole hole = hole_list.back();
-      hole_list.pop_back();
-
-      // if the hole has only three edges, create the triangle
-      if (hole.size() == 3) {
-        typename Hole::iterator hit = hole.begin();
-        f = (*hit).first;        i = (*hit).second;
-        ff = (* ++hit).first;    ii = (*hit).second;
-        fn = (* ++hit).first;    in = (*hit).second;
-        tds().create_face(f, i, ff, ii, fn, in);
-        continue;
-      }
-
-      // else find an edge with two finite vertices
-      // on the hole boundary
-      // and the new triangle adjacent to that edge
-      //  cut the hole and push it back
-
-      // first, ensure that a neighboring face
-      // whose vertices on the hole boundary are finite
-      // is the first of the hole
-      while (1) {
-        ff = (hole.front()).first;
-        ii = (hole.front()).second;
-        if ( is_infinite(ff->vertex(cw(ii))) ||
-             is_infinite(ff->vertex(ccw(ii)))) {
-          hole.push_back(hole.front());
-          hole.pop_front();
-        }
-        else
-            break;
-      }
-
-      // take the first neighboring face and pop it;
-      ff = (hole.front()).first;
-      ii = (hole.front()).second;
-      hole.pop_front();
-
-      Vertex_handle v0 = ff->vertex(cw(ii));
-      Vertex_handle v1 = ff->vertex(ccw(ii));
-      Vertex_handle v2 = infinite_vertex();
-      const Point &p0 = v0->point();
-      const Point &p1 = v1->point();
-      const Point *p2 = NULL; // Initialize to NULL to avoid warning.
-
-      typename Hole::iterator hdone = hole.end();
-      typename Hole::iterator hit = hole.begin();
-      typename Hole::iterator cut_after(hit);
-
-      // if tested vertex is c with respect to the vertex opposite
-      // to NULL neighbor,
-      // stop at the before last face;
-      hdone--;
-      for (; hit != hdone; ++hit) {
-        fn = hit->first;
-        in = hit->second;
-        Vertex_handle vv = fn->vertex(ccw(in));
-        if (is_infinite(vv)) {
-          if (is_infinite(v2))
-              cut_after = hit;
-        }
-        else {     // vv is a finite vertex
-          const Point &p = vv->point();
-          if (coplanar_orientation(p0, p1, p) == COUNTERCLOCKWISE) {
-            if (is_infinite(v2) ||
-                remover.side_of_bounded_circle(p0, p1, *p2, p, true)
-                  == ON_BOUNDED_SIDE) {
-                v2 = vv;
-                p2 = &p;
-                cut_after = hit;
-            }
-          }
-        }
-      }
-
-      // create new triangle and update adjacency relations
-      Cell_handle newf;
-
-      //update the hole and push back in the Hole_List stack
-      // if v2 belongs to the neighbor following or preceding *f
-      // the hole remain a single hole
-      // otherwise it is split in two holes
-
-      fn = (hole.front()).first;
-      in = (hole.front()).second;
-      if (fn->has_vertex(v2, i) && i == ccw(in)) {
-        newf = tds().create_face(ff, ii, fn, in);
-        hole.pop_front();
-        hole.push_front(Edge_2D(newf, 1));
-        hole_list.push_back(hole);
-      }
-      else{
-        fn = (hole.back()).first;
-        in = (hole.back()).second;
-        if (fn->has_vertex(v2, i) && i == cw(in)) {
-          newf = tds().create_face(fn, in, ff, ii);
-          hole.pop_back();
-          hole.push_back(Edge_2D(newf, 1));
-          hole_list.push_back(hole);
-        }
-        else{
-          // split the hole in two holes
-          newf = tds().create_face(ff, ii, v2);
-          Hole new_hole;
-          ++cut_after;
-          while( hole.begin() != cut_after )
-            {
-              new_hole.push_back(hole.front());
-              hole.pop_front();
-            }
-
-          hole.push_front(Edge_2D(newf, 1));
-          new_hole.push_front(Edge_2D(newf, 0));
-          hole_list.push_back(hole);
-          hole_list.push_back(new_hole);
-        }
-      }
-    }
-}
-
-template <class Gt, class Tds, class Lds>
-template < class VertexRemover, class OutputItCells >
-void
-Triangulation_3<Gt, Tds, Lds>::
-fill_hole_2D(std::list<Edge_2D> & first_hole, VertexRemover &remover,
-             OutputItCells fit)
-{
-  typedef std::list<Edge_2D> Hole;
-
-  std::vector<Hole> hole_list;
-
-  Cell_handle  f, ff, fn;
-  int i, ii, in;
-
-  hole_list.push_back(first_hole);
-
-  while( ! hole_list.empty())
-  {
-    Hole hole = hole_list.back();
-    hole_list.pop_back();
-
-    // if the hole has only three edges, create the triangle
-    if (hole.size() == 3) {
-      typename Hole::iterator hit = hole.begin();
-      f = (*hit).first;        i = (*hit).second;
-      ff = (* ++hit).first;    ii = (*hit).second;
-      fn = (* ++hit).first;    in = (*hit).second;
-      *fit++ = tds().create_face(f, i, ff, ii, fn, in);
-      continue;
-    }
-
-    // else find an edge with two finite vertices
-    // on the hole boundary
-    // and the new triangle adjacent to that edge
-    //  cut the hole and push it back
-
-    // first, ensure that a neighboring face
-    // whose vertices on the hole boundary are finite
-    // is the first of the hole
-    while (1) {
-      ff = (hole.front()).first;
-      ii = (hole.front()).second;
-      if ( is_infinite(ff->vertex(cw(ii))) ||
-           is_infinite(ff->vertex(ccw(ii)))) {
-        hole.push_back(hole.front());
-        hole.pop_front();
-      }
-      else
-        break;
-    }
-
-    // take the first neighboring face and pop it;
-    ff = (hole.front()).first;
-    ii = (hole.front()).second;
-    hole.pop_front();
-
-    Vertex_handle v0 = ff->vertex(cw(ii));
-    Vertex_handle v1 = ff->vertex(ccw(ii));
-    Vertex_handle v2 = infinite_vertex();
-    const Point &p0 = v0->point();
-    const Point &p1 = v1->point();
-    const Point *p2 = NULL; // Initialize to NULL to avoid warning.
-
-    typename Hole::iterator hdone = hole.end();
-    typename Hole::iterator hit = hole.begin();
-    typename Hole::iterator cut_after(hit);
-
-    // if tested vertex is c with respect to the vertex opposite
-    // to NULL neighbor,
-    // stop at the before last face;
-    hdone--;
-    for (; hit != hdone; ++hit) {
-      fn = hit->first;
-      in = hit->second;
-      Vertex_handle vv = fn->vertex(ccw(in));
-      if (is_infinite(vv)) {
-        if (is_infinite(v2))
-          cut_after = hit;
-      }
-      else {     // vv is a finite vertex
-        const Point &p = vv->point();
-        if (coplanar_orientation(p0, p1, p) == COUNTERCLOCKWISE) {
-          if (is_infinite(v2) ||
-              remover.side_of_bounded_circle(p0, p1, *p2, p, true)
-              == ON_BOUNDED_SIDE) {
-            v2 = vv;
-            p2 = &p;
-            cut_after = hit;
-          }
-        }
-      }
-    }
-
-    // create new triangle and update adjacency relations
-    Cell_handle newf;
-
-    //update the hole and push back in the Hole_List stack
-    // if v2 belongs to the neighbor following or preceding *f
-    // the hole remain a single hole
-    // otherwise it is split in two holes
-
-    fn = (hole.front()).first;
-    in = (hole.front()).second;
-    if (fn->has_vertex(v2, i) && i == ccw(in)) {
-      newf = tds().create_face(ff, ii, fn, in);
-      hole.pop_front();
-      hole.push_front(Edge_2D(newf, 1));
-      hole_list.push_back(hole);
-    } else {
-      fn = (hole.back()).first;
-      in = (hole.back()).second;
-      if (fn->has_vertex(v2, i) && i == cw(in)) {
-        newf = tds().create_face(fn, in, ff, ii);
-        hole.pop_back();
-        hole.push_back(Edge_2D(newf, 1));
-        hole_list.push_back(hole);
-      } else {
-        // split the hole in two holes
-        newf = tds().create_face(ff, ii, v2);
-        Hole new_hole;
-        ++cut_after;
-        while( hole.begin() != cut_after )
-        {
-          new_hole.push_back(hole.front());
-          hole.pop_front();
-        }
-        hole.push_front(Edge_2D(newf, 1));
-        new_hole.push_front(Edge_2D(newf, 0));
-        hole_list.push_back(hole);
-        hole_list.push_back(new_hole);
-      }
-    }
-
-    *fit++ = newf;
-
-  }
-}
-
-template <class Gt, class Tds, class Lds>
-void
-Triangulation_3<Gt,Tds,Lds>::
-make_hole_3D( Vertex_handle v,
-              Vertex_triple_Facet_map& outer_map,
-              std::vector<Cell_handle> & hole)
-{
-  CGAL_triangulation_expensive_precondition( ! test_dim_down(v) );
-
-  incident_cells(v, std::back_inserter(hole));
-
-  for (typename std::vector<Cell_handle>::iterator cit = hole.begin(),
-       end = hole.end(); cit != end; ++cit) {
-    int indv = (*cit)->index(v);
-    Cell_handle opp_cit = (*cit)->neighbor( indv );
-    Facet f(opp_cit, opp_cit->index(*cit));
-    Vertex_triple vt = make_vertex_triple(f);
-    make_canonical(vt);
-    outer_map[vt] = f;
-    for (int i=0; i<4; i++)
-      if ( i != indv )
-        (*cit)->vertex(i)->set_cell(opp_cit);
-  }
-}
-
-// When the incident cells are already known
-template <class Gt, class Tds, class Lds>
-void
-Triangulation_3<Gt,Tds,Lds>::
-make_hole_3D( Vertex_handle v,
-              const std::vector<Cell_handle> & incident_cells,
-              Vertex_triple_Facet_map& outer_map)
-{
-  CGAL_triangulation_expensive_precondition( ! test_dim_down(v) );
-
-  for (typename std::vector<Cell_handle>::const_iterator cit = incident_cells.begin(),
-       end = incident_cells.end(); cit != end; ++cit) {
-    int indv = (*cit)->index(v);
-    Cell_handle opp_cit = (*cit)->neighbor( indv );
-    Facet f(opp_cit, opp_cit->index(*cit));
-    Vertex_triple vt = make_vertex_triple(f);
-    make_canonical(vt);
-    outer_map[vt] = f;
-    for (int i=0; i<4; i++)
-      if ( i != indv )
-        (*cit)->vertex(i)->set_cell(opp_cit);
-  }
-}
-
-template <class Gt, class Tds, class Lds>
-template < class VertexRemover >
-VertexRemover&
-Triangulation_3<Gt,Tds,Lds>::
-remove_dim_down(Vertex_handle v, VertexRemover &remover)
-{
-    CGAL_triangulation_precondition (dimension() >= 0);
-
-    // Collect all the hidden points.
-    for (All_cells_iterator ci = tds().raw_cells_begin(),
-            end = tds().raw_cells_end(); ci != end; ++ci)
-        remover.add_hidden_points(ci);
-
-    tds().remove_decrease_dimension(v, infinite_vertex());
-
-    // Now try to see if we need to re-orient.
-    if (dimension() == 2) {
-        Facet f = *finite_facets_begin();
-        if (coplanar_orientation(f.first->vertex(0)->point(),
-                                 f.first->vertex(1)->point(),
-                                 f.first->vertex(2)->point()) == NEGATIVE)
-            tds().reorient();
-    }
-
-    return remover;
-}
-
-template <class Gt, class Tds, class Lds>
-template < class VertexRemover >
-VertexRemover&
-Triangulation_3<Gt,Tds,Lds>::
-remove_1D(Vertex_handle v, VertexRemover &remover)
-{
-    CGAL_triangulation_precondition (dimension() == 1);
-
-    Cell_handle c1 = v->cell();
-    Cell_handle c2 = c1->neighbor(c1->index(v) == 0 ? 1 : 0);
-    remover.add_hidden_points(c1);
-    remover.add_hidden_points(c2);
-
-    tds().remove_from_maximal_dimension_simplex (v);
-
-    return remover;
-}
-
-template <class Gt, class Tds, class Lds>
-template < class VertexRemover >
-VertexRemover&
-Triangulation_3<Gt,Tds,Lds>::
-remove_2D(Vertex_handle v, VertexRemover &remover)
-{
-    CGAL_triangulation_precondition(dimension() == 2);
-    std::list<Edge_2D> hole;
-    make_hole_2D(v, hole, remover);
-    fill_hole_2D(hole, remover);
-    tds().delete_vertex(v);
-    return remover;
-}
-
-template <class Gt, class Tds, class Lds>
-template < class VertexRemover >
-VertexRemover&
-Triangulation_3<Gt,Tds,Lds>::
-remove_3D(Vertex_handle v, VertexRemover &remover)
-{
-  std::vector<Cell_handle> hole;
-  hole.reserve(64);
-
-  // Construct the set of vertex triples on the boundary
-  // with the facet just behind
-  Vertex_triple_Facet_map outer_map;
-  Vertex_triple_Facet_map inner_map;
-
-  make_hole_3D(v, outer_map, hole);
-  CGAL_assertion(remover.hidden_points_begin() ==
-      remover.hidden_points_end() );
-
-  // Output the hidden points.
-  for (typename std::vector<Cell_handle>::iterator
-      hi = hole.begin(), hend = hole.end(); hi != hend; ++hi)
-    remover.add_hidden_points(*hi);
-
-  bool inf = false;
-  // collect all vertices on the boundary
-  std::vector<Vertex_handle> vertices;
-  vertices.reserve(64);
-
-  adjacent_vertices(v, std::back_inserter(vertices));
-
-  // create a Delaunay triangulation of the points on the boundary
-  // and make a map from the vertices in remover.tmp towards the vertices
-  // in *this
-
-  unsigned int i = 0;
-  Vertex_handle_unique_hash_map vmap;
-  Cell_handle ch = Cell_handle();
-#ifdef CGAL_TRIANGULATION_3_USE_THE_4_POINTS_CONSTRUCTOR
-  size_t num_vertices = vertices.size();
-  if (num_vertices >= 5)
-  {
-    //std::random_shuffle(vertices.begin(), vertices.end());
-    for (int j = 0 ; j < 4 ; ++j)
-    {
-      if (is_infinite(vertices[j]))
-      {
-        std::swap(vertices[j], vertices[4]);
-        break;
-      }
-    }
-    Orientation o = orientation(
-      vertices[0]->point(),
-      vertices[1]->point(),
-      vertices[2]->point(),
-      vertices[3]->point());
-
-    if (o == NEGATIVE)
-      std::swap(vertices[0], vertices[1]);
-
-    if (o != ZERO)
-    {
-      Vertex_handle vh1, vh2, vh3, vh4;
-      remover.tmp.init_tds(
-        vertices[0]->point(), vertices[1]->point(),
-        vertices[2]->point(), vertices[3]->point(),
-        vh1, vh2, vh3, vh4);
-      ch = vh1->cell();
-      vmap[vh1] = vertices[0];
-      vmap[vh2] = vertices[1];
-      vmap[vh3] = vertices[2];
-      vmap[vh4] = vertices[3];
-      i = 4;
-    }
-  }
-#endif
-
-  for(; i < vertices.size(); i++){
-    if(! is_infinite(vertices[i])){
-      Vertex_handle vh = remover.tmp.insert(vertices[i]->point(), ch);
-      ch = vh->cell();
-      vmap[vh] = vertices[i];
-    }else {
-      inf = true;
-    }
-  }
-
-  if(remover.tmp.dimension()==2){
-    Vertex_handle fake_inf = remover.tmp.insert(v->point());
-    vmap[fake_inf] = infinite_vertex();
-  } else {
-    vmap[remover.tmp.infinite_vertex()] = infinite_vertex();
-  }
-
-  CGAL_triangulation_assertion(remover.tmp.dimension() == 3);
-
-  // Construct the set of vertex triples of remover.tmp
-  // We reorient the vertex triple so that it matches those from outer_map
-  // Also note that we use the vertices of *this, not of remover.tmp
-
-  if(inf){
-    for(All_cells_iterator it = remover.tmp.all_cells_begin(),
-        end = remover.tmp.all_cells_end(); it != end; ++it){
-      for(i=0; i < 4; i++){
-        Facet f = std::pair<Cell_handle,int>(it,i);
-        Vertex_triple vt_aux = make_vertex_triple(f);
-        Vertex_triple vt(vmap[vt_aux.first],vmap[vt_aux.third],vmap[vt_aux.second]);
-        make_canonical(vt);
-        inner_map[vt]= f;
-      }
-    }
-  } else {
-      for(Finite_cells_iterator it = remover.tmp.finite_cells_begin(),
-        end = remover.tmp.finite_cells_end(); it != end; ++it){
-      for(i=0; i < 4; i++){
-        Facet f = std::pair<Cell_handle,int>(it,i);
-        Vertex_triple vt_aux = make_vertex_triple(f);
-        Vertex_triple vt(vmap[vt_aux.first],vmap[vt_aux.third],vmap[vt_aux.second]);
-        make_canonical(vt);
-        inner_map[vt]= f;
-      }
-    }
-  }
-  // Grow inside the hole, by extending the surface
-  while(! outer_map.empty()){
-    typename Vertex_triple_Facet_map::iterator oit = outer_map.begin();
-    while(is_infinite(oit->first.first) ||
-          is_infinite(oit->first.second) ||
-          is_infinite(oit->first.third)){
-      ++oit;
-      // otherwise the lookup in the inner_map fails
-      // because the infinite vertices are different
-    }
-    typename Vertex_triple_Facet_map::value_type o_vt_f_pair = *oit;
-    Cell_handle o_ch = o_vt_f_pair.second.first;
-    unsigned int o_i = o_vt_f_pair.second.second;
-
-    typename Vertex_triple_Facet_map::iterator iit =
-             inner_map.find(o_vt_f_pair.first);
-    CGAL_triangulation_assertion(iit != inner_map.end());
-    typename Vertex_triple_Facet_map::value_type i_vt_f_pair = *iit;
-    Cell_handle i_ch = i_vt_f_pair.second.first;
-    unsigned int i_i = i_vt_f_pair.second.second;
-
-    // create a new cell and glue it to the outer surface
-    Cell_handle new_ch = tds().create_cell();
-    new_ch->set_vertices(vmap[i_ch->vertex(0)], vmap[i_ch->vertex(1)],
-                         vmap[i_ch->vertex(2)], vmap[i_ch->vertex(3)]);
-
-    o_ch->set_neighbor(o_i,new_ch);
-    new_ch->set_neighbor(i_i, o_ch);
-
-    // for the other faces check, if they can also be glued
-    for(i = 0; i < 4; i++){
-      if(i != i_i){
-        Facet f = std::pair<Cell_handle,int>(new_ch,i);
-        Vertex_triple vt = make_vertex_triple(f);
-        make_canonical(vt);
-        std::swap(vt.second,vt.third);
-        typename Vertex_triple_Facet_map::iterator oit2 = outer_map.find(vt);
-        if(oit2 == outer_map.end()){
-          std::swap(vt.second,vt.third);
-          outer_map[vt]= f;
-        } else {
-          // glue the faces
-          typename Vertex_triple_Facet_map::value_type o_vt_f_pair2 = *oit2;
-          Cell_handle o_ch2 = o_vt_f_pair2.second.first;
-          int o_i2 = o_vt_f_pair2.second.second;
-          o_ch2->set_neighbor(o_i2,new_ch);
-          new_ch->set_neighbor(i, o_ch2);
-          outer_map.erase(oit2);
-        }
-      }
-    }
-    outer_map.erase(oit);
-  }
-  tds().delete_vertex(v);
-  tds().delete_cells(hole.begin(), hole.end());
-
-  return remover;
-}
-
-template <class Gt, class Tds, class Lds>
-template < class VertexRemover >
-VertexRemover&
-Triangulation_3<Gt,Tds,Lds>::
-remove_3D(Vertex_handle v, VertexRemover &remover,
-          const std::vector<Cell_handle> &inc_cells,
-          std::vector<Vertex_handle> &adj_vertices)
-{
-  // Construct the set of vertex triples on the boundary
-  // with the facet just behind
-  Vertex_triple_Facet_map outer_map;
-  Vertex_triple_Facet_map inner_map;
-
-  make_hole_3D(v, inc_cells, outer_map);
-
-  CGAL_assertion(remover.hidden_points_begin() ==
-      remover.hidden_points_end() );
-
-  // Output the hidden points.
-  for (typename std::vector<Cell_handle>::const_iterator
-      hi = inc_cells.begin(), hend = inc_cells.end(); hi != hend; ++hi)
-    remover.add_hidden_points(*hi);
-
-  bool inf = false;
-
-  // create a Delaunay triangulation of the points on the boundary
-  // and make a map from the vertices in remover.tmp towards the vertices
-  // in *this
-
-  unsigned int i = 0;
-  Vertex_handle_unique_hash_map vmap;
-  Cell_handle ch = Cell_handle();
-#ifdef CGAL_TRIANGULATION_3_USE_THE_4_POINTS_CONSTRUCTOR
-  size_t num_vertices = adj_vertices.size();
-  if (num_vertices >= 5)
-  {
-    //std::random_shuffle(adj_vertices.begin(), adj_vertices.end());
-    for (int j = 0 ; j < 4 ; ++j)
-    {
-      if (is_infinite(adj_vertices[j]))
-      {
-        std::swap(adj_vertices[j], adj_vertices[4]);
-        break;
-      }
-    }
-    Orientation o = orientation(
-      adj_vertices[0]->point(),
-      adj_vertices[1]->point(),
-      adj_vertices[2]->point(),
-      adj_vertices[3]->point());
-
-    if (o == NEGATIVE)
-      std::swap(adj_vertices[0], adj_vertices[1]);
-
-    if (o != ZERO)
-    {
-      Vertex_handle vh1, vh2, vh3, vh4;
-      remover.tmp.init_tds(
-        adj_vertices[0]->point(), adj_vertices[1]->point(),
-        adj_vertices[2]->point(), adj_vertices[3]->point(),
-        vh1, vh2, vh3, vh4);
-      ch = vh1->cell();
-      vmap[vh1] = adj_vertices[0];
-      vmap[vh2] = adj_vertices[1];
-      vmap[vh3] = adj_vertices[2];
-      vmap[vh4] = adj_vertices[3];
-      i = 4;
-    }
-  }
-#endif
-
-  for(; i < adj_vertices.size(); i++){
-    if(! is_infinite(adj_vertices[i])){
-      Vertex_handle vh = remover.tmp.insert(adj_vertices[i]->point(), ch);
-      ch = vh->cell();
-      vmap[vh] = adj_vertices[i];
-    }else {
-      inf = true;
-    }
-  }
-
-  if(remover.tmp.dimension()==2){
-    Vertex_handle fake_inf = remover.tmp.insert(v->point());
-    vmap[fake_inf] = infinite_vertex();
-  } else {
-    vmap[remover.tmp.infinite_vertex()] = infinite_vertex();
-  }
-
-  CGAL_triangulation_assertion(remover.tmp.dimension() == 3);
-
-  // Construct the set of vertex triples of remover.tmp
-  // We reorient the vertex triple so that it matches those from outer_map
-  // Also note that we use the vertices of *this, not of remover.tmp
-
-  if(inf){
-    for(All_cells_iterator it = remover.tmp.all_cells_begin(),
-        end = remover.tmp.all_cells_end(); it != end; ++it){
-      for(i=0; i < 4; i++){
-        Facet f = std::pair<Cell_handle,int>(it,i);
-        Vertex_triple vt_aux = make_vertex_triple(f);
-        Vertex_triple vt(vmap[vt_aux.first],vmap[vt_aux.third],vmap[vt_aux.second]);
-        make_canonical(vt);
-        inner_map[vt]= f;
-      }
-    }
-  } else {
-      for(Finite_cells_iterator it = remover.tmp.finite_cells_begin(),
-        end = remover.tmp.finite_cells_end(); it != end; ++it){
-      for(i=0; i < 4; i++){
-        Facet f = std::pair<Cell_handle,int>(it,i);
-        Vertex_triple vt_aux = make_vertex_triple(f);
-        Vertex_triple vt(vmap[vt_aux.first],vmap[vt_aux.third],vmap[vt_aux.second]);
-        make_canonical(vt);
-        inner_map[vt]= f;
-      }
-    }
-  }
-  // Grow inside the hole, by extending the surface
-  while(! outer_map.empty()){
-    typename Vertex_triple_Facet_map::iterator oit = outer_map.begin();
-    while(is_infinite(oit->first.first) ||
-          is_infinite(oit->first.second) ||
-          is_infinite(oit->first.third)){
-      ++oit;
-      // otherwise the lookup in the inner_map fails
-      // because the infinite vertices are different
-    }
-    typename Vertex_triple_Facet_map::value_type o_vt_f_pair = *oit;
-    Cell_handle o_ch = o_vt_f_pair.second.first;
-    unsigned int o_i = o_vt_f_pair.second.second;
-
-    typename Vertex_triple_Facet_map::iterator iit =
-             inner_map.find(o_vt_f_pair.first);
-    CGAL_triangulation_assertion(iit != inner_map.end());
-    typename Vertex_triple_Facet_map::value_type i_vt_f_pair = *iit;
-    Cell_handle i_ch = i_vt_f_pair.second.first;
-    unsigned int i_i = i_vt_f_pair.second.second;
-
-    // create a new cell and glue it to the outer surface
-    Cell_handle new_ch = tds().create_cell();
-    new_ch->set_vertices(vmap[i_ch->vertex(0)], vmap[i_ch->vertex(1)],
-                         vmap[i_ch->vertex(2)], vmap[i_ch->vertex(3)]);
-
-    o_ch->set_neighbor(o_i,new_ch);
-    new_ch->set_neighbor(i_i, o_ch);
-
-    // for the other faces check, if they can also be glued
-    for(i = 0; i < 4; i++){
-      if(i != i_i){
-        Facet f = std::pair<Cell_handle,int>(new_ch,i);
-        Vertex_triple vt = make_vertex_triple(f);
-        make_canonical(vt);
-        std::swap(vt.second,vt.third);
-        typename Vertex_triple_Facet_map::iterator oit2 = outer_map.find(vt);
-        if(oit2 == outer_map.end()){
-          std::swap(vt.second,vt.third);
-          outer_map[vt]= f;
-        } else {
-          // glue the faces
-          typename Vertex_triple_Facet_map::value_type o_vt_f_pair2 = *oit2;
-          Cell_handle o_ch2 = o_vt_f_pair2.second.first;
-          int o_i2 = o_vt_f_pair2.second.second;
-          o_ch2->set_neighbor(o_i2,new_ch);
-          new_ch->set_neighbor(i, o_ch2);
-          outer_map.erase(oit2);
-        }
-      }
-    }
-    outer_map.erase(oit);
-  }
-  tds().delete_vertex(v);
-  tds().delete_cells(inc_cells.begin(), inc_cells.end());
-
-  return remover;
-}
-
-template <class Gt, class Tds, class Lds>
-template < class VertexRemover >
-void
-Triangulation_3<Gt, Tds, Lds>::
-remove(Vertex_handle v, VertexRemover &remover) {
-  CGAL_triangulation_precondition( v != Vertex_handle());
-  CGAL_triangulation_precondition( !is_infinite(v));
-  CGAL_triangulation_expensive_precondition( tds().is_vertex(v) );
-
-  if (test_dim_down (v)) {
-    remove_dim_down (v, remover);
-  }
-  else {
-    switch (dimension()) {
-    case 1: remove_1D (v, remover); break;
-    case 2: remove_2D (v, remover); break;
-    case 3: remove_3D (v, remover); break;
-    default:
-      CGAL_triangulation_assertion (false);
-    }
-  }
-}
-
-template <class Gt, class Tds, class Lds>
-template < class VertexRemover >
-bool
-Triangulation_3<Gt, Tds, Lds>::
-remove(Vertex_handle v, VertexRemover &remover, bool *could_lock_zone)
-{
-  // N.B.: dimension doesn't need to be atomic since the parallel removal
-  //       will never decrease the dimension (the last few removes are done
-  //       sequentially)
-  CGAL_triangulation_precondition( v != Vertex_handle());
-  CGAL_triangulation_precondition( !is_infinite(v));
-  CGAL_triangulation_precondition( dimension() == 3);
-  CGAL_triangulation_expensive_precondition( tds().is_vertex(v) );
-
-#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
-  static Profile_branch_counter_3 bcounter(
-    "early withdrawals / late withdrawals / successes [Delaunay_tri_3::remove]");
-#endif
-
-  bool removed = true;
-
-  // Locking vertex v is a good start
-  if (!this->try_lock_vertex(v))
-  {
-    *could_lock_zone = false;
-#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
-    bcounter.increment_branch_2(); // THIS is an early withdrawal!
-#endif
-  }
-  else
-  {
-    std::vector<Cell_handle> incident_cells;
-    incident_cells.reserve(64);
-    std::vector<Vertex_handle> adj_vertices;
-    adj_vertices.reserve(64);
-    bool dim_down = test_dim_down_using_incident_cells_3(
-      v, incident_cells, adj_vertices, could_lock_zone);
-
-    if (*could_lock_zone)
-    {
-      if (dim_down)
-        removed = false;
-      else
-        remove_3D (v, remover, incident_cells, adj_vertices);
-    }
-  }
-
-#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
-  if (could_lock_zone)
-  {
-    if (*could_lock_zone)
-      ++bcounter;
-    else
-      bcounter.increment_branch_1(); // THIS is a late withdrawal!
-  }
-#endif
-
-  return removed;
-}
-
-// The remove here uses the remover, but
-// no function envolving hidden points
-// will be used in this internal version
-template <class Gt, class Tds, class Lds>
-template < class VertexRemover, class OutputItCells >
-VertexRemover&
-Triangulation_3<Gt, Tds, Lds>::
-remove_dim_down(Vertex_handle v, VertexRemover &remover, OutputItCells fit) {
-  remove_dim_down(v, remover);
-  for(All_cells_iterator afi = tds().raw_cells_begin();
-      afi != tds().raw_cells_end();
-      afi++) *fit++ = afi;
-  return remover;
-}
-
-template <class Gt, class Tds, class Lds>
-template < class VertexRemover, class OutputItCells >
-VertexRemover&
-Triangulation_3<Gt, Tds, Lds>::
-remove_1D(Vertex_handle v, VertexRemover &remover, OutputItCells fit) {
-  Point p = v->point();
-  remove_1D(v, remover);
-  *fit++ = locate(p);
-  return remover;
-}
-
-template <class Gt, class Tds, class Lds>
-template < class VertexRemover, class OutputItCells >
-VertexRemover&
-Triangulation_3<Gt, Tds, Lds>::
-remove_2D(Vertex_handle v, VertexRemover &remover, OutputItCells fit) {
-  CGAL_triangulation_precondition(dimension() == 2);
-  std::list<Edge_2D> hole;
-  make_hole_2D(v, hole, remover);
-  fill_hole_2D(hole, remover, fit);
-  tds().delete_vertex(v);
-  return remover;
-}
-
-template <class Gt, class Tds, class Lds>
-template < class VertexRemover, class OutputItCells >
-VertexRemover&
-Triangulation_3<Gt, Tds, Lds>::
-remove_3D(Vertex_handle v, VertexRemover &remover, OutputItCells fit) {
-  CGAL_triangulation_precondition(dimension() == 3);
-
-  std::vector<Cell_handle> hole;
-  hole.reserve(64);
-
-  // Construct the set of vertex triples on the boundary
-  // with the facet just behind
-  Vertex_triple_Facet_map outer_map;
-  Vertex_triple_Facet_map inner_map;
-
-  make_hole_3D(v, outer_map, hole);
-
-  CGAL_assertion(remover.hidden_points_begin() ==
-                 remover.hidden_points_end() );
-
-  // Output the hidden points.
-  for (typename std::vector<Cell_handle>::iterator
-         hi = hole.begin(), hend = hole.end(); hi != hend; ++hi)
-    remover.add_hidden_points(*hi);
-
-  bool inf = false;
-  unsigned int i;
-  // collect all vertices on the boundary
-  std::vector<Vertex_handle> vertices;
-  vertices.reserve(64);
-
-  adjacent_vertices(v, std::back_inserter(vertices));
-
-  // create a Delaunay triangulation of the points on the boundary
-  // and make a map from the vertices in remover.tmp towards the vertices
-  // in *this
-
-  Vertex_handle_unique_hash_map vmap;
-  Cell_handle ch = Cell_handle();
-  for(i=0; i < vertices.size(); i++){
-    if(! is_infinite(vertices[i])){
-      Vertex_handle vh = remover.tmp.insert(vertices[i]->point(), ch);
-      ch = vh->cell();
-      vmap[vh] = vertices[i];
-    }else {
-      inf = true;
-    }
-  }
-
-  if(remover.tmp.dimension()==2){
-    Vertex_handle fake_inf = remover.tmp.insert(v->point());
-    vmap[fake_inf] = infinite_vertex();
-  } else {
-    vmap[remover.tmp.infinite_vertex()] = infinite_vertex();
-  }
-
-  CGAL_triangulation_assertion(remover.tmp.dimension() == 3);
-
-  // Construct the set of vertex triples of remover.tmp
-  // We reorient the vertex triple so that it matches those from outer_map
-  // Also note that we use the vertices of *this, not of remover.tmp
-
-  if(inf){
-    for(All_cells_iterator it = remover.tmp.all_cells_begin(),
-          end = remover.tmp.all_cells_end(); it != end; ++it)
-    {
-      for(i=0; i < 4; i++){
-        Facet f = std::pair<Cell_handle,int>(it,i);
-        Vertex_triple vt_aux = make_vertex_triple(f);
-        Vertex_triple vt(vmap[vt_aux.first],vmap[vt_aux.third],vmap[vt_aux.second]);
-        make_canonical(vt);
-        inner_map[vt]= f;
-      }
-    }
-  } else {
-    for(Finite_cells_iterator it = remover.tmp.finite_cells_begin(),
-        end = remover.tmp.finite_cells_end(); it != end; ++it)
-    {
-      for(i=0; i < 4; i++){
-        Facet f = std::pair<Cell_handle,int>(it,i);
-        Vertex_triple vt_aux = make_vertex_triple(f);
-        Vertex_triple vt(vmap[vt_aux.first],vmap[vt_aux.third],vmap[vt_aux.second]);
-        make_canonical(vt);
-        inner_map[vt]= f;
-      }
-    }
-  }
-  // Grow inside the hole, by extending the surface
-  while(! outer_map.empty()){
-    typename Vertex_triple_Facet_map::iterator oit = outer_map.begin();
-    while(is_infinite(oit->first.first) ||
-          is_infinite(oit->first.second) ||
-          is_infinite(oit->first.third)){
-      ++oit;
-      // otherwise the lookup in the inner_map fails
-      // because the infinite vertices are different
-    }
-    typename Vertex_triple_Facet_map::value_type o_vt_f_pair = *oit;
-    Cell_handle o_ch = o_vt_f_pair.second.first;
-    unsigned int o_i = o_vt_f_pair.second.second;
-
-    typename Vertex_triple_Facet_map::iterator iit =
-             inner_map.find(o_vt_f_pair.first);
-    CGAL_triangulation_assertion(iit != inner_map.end());
-    typename Vertex_triple_Facet_map::value_type i_vt_f_pair = *iit;
-    Cell_handle i_ch = i_vt_f_pair.second.first;
-    unsigned int i_i = i_vt_f_pair.second.second;
-
-    // create a new cell and glue it to the outer surface
-    Cell_handle new_ch = tds().create_cell();
-                *fit++ = new_ch;
-
-    new_ch->set_vertices(vmap[i_ch->vertex(0)], vmap[i_ch->vertex(1)],
-                         vmap[i_ch->vertex(2)], vmap[i_ch->vertex(3)]);
-
-    o_ch->set_neighbor(o_i,new_ch);
-    new_ch->set_neighbor(i_i, o_ch);
-
-    // for the other faces check, if they can also be glued
-    for(i = 0; i < 4; i++){
-      if(i != i_i){
-        Facet f = std::pair<Cell_handle,int>(new_ch,i);
-        Vertex_triple vt = make_vertex_triple(f);
-        make_canonical(vt);
-        std::swap(vt.second,vt.third);
-        typename Vertex_triple_Facet_map::iterator oit2 = outer_map.find(vt);
-        if(oit2 == outer_map.end()){
-          std::swap(vt.second,vt.third);
-          outer_map[vt]= f;
-        } else {
-          // glue the faces
-          typename Vertex_triple_Facet_map::value_type o_vt_f_pair2 = *oit2;
-          Cell_handle o_ch2 = o_vt_f_pair2.second.first;
-          int o_i2 = o_vt_f_pair2.second.second;
-          o_ch2->set_neighbor(o_i2,new_ch);
-          new_ch->set_neighbor(i, o_ch2);
-          outer_map.erase(oit2);
-        }
-      }
-    }
-    outer_map.erase(oit);
-  }
-  tds().delete_vertex(v);
-  tds().delete_cells(hole.begin(), hole.end());
-
-  return remover;
-}
-
-
-template <class Gt, class Tds, class Lds>
-template < class VertexRemover, class OutputItCells >
-void
-Triangulation_3<Gt, Tds, Lds>::
-remove_and_give_new_cells(Vertex_handle v, VertexRemover &remover,
-  OutputItCells fit) {
-  CGAL_triangulation_precondition( v != Vertex_handle());
-  CGAL_triangulation_precondition( !is_infinite(v));
-  CGAL_triangulation_expensive_precondition( tds().is_vertex(v) );
-
-  if (test_dim_down (v)) {
-    remove_dim_down (v, remover, fit);
-  }
-  else {
-    switch (dimension()) {
-    case 1: remove_1D (v, remover, fit); break;
-    case 2: remove_2D (v, remover, fit); break;
-    case 3: remove_3D (v, remover, fit); break;
-    default:
-      CGAL_triangulation_assertion (false);
-    }
-  }
-}
-
-// The VertexInserter is needed so as to
-// allow us the usage of the insertion method
-// from the particular triangulation
-template <class Gt, class Tds, class Lds>
-template < class VertexRemover, class VertexInserter >
-typename Triangulation_3<Gt,Tds,Lds>::Vertex_handle
-Triangulation_3<Gt,Tds,Lds>::
-move_if_no_collision(Vertex_handle v, const Point &p,
-                     VertexRemover &remover, VertexInserter &inserter) {
-  CGAL_assertion(remover.hidden_points_begin() ==
-                 remover.hidden_points_end() );
-  CGAL_triangulation_precondition(!is_infinite(v));
-  if(v->point() == p) return v;
-  const int dim = dimension();
-
-  // If displacements are known to be small
-  // we might want to optimize by checking
-  // whether there is a topological change
-  // or not before.
-  // In this version this will not be put inside this method
-  // because it is for general purposes,
-  // and remaining Delaunay after motion is a bit too restrictive.
-  // In the filtered version optimized for displacements
-  // it will be used as an a priori.
-  // However, a non-fully optimized but good version of
-  // is_delaunay_after_displacement is provided as an internal method of
-  // Delaunay_triangulation_3 (see the class for more details).
-
-  Locate_type lt;
-  int li, lj;
-  Cell_handle loc = locate(p, lt, li, lj, v->cell());
-
-  if(lt == VERTEX) return loc->vertex(li);
-
-  if(dim == 0) {
-    v->set_point(p);
-    return v;
-  }
-
-  size_type n_vertices = tds().number_of_vertices();
-
-  if((lt == OUTSIDE_AFFINE_HULL) && (dim == 1) && (n_vertices == 3)) {
-    v->set_point(p);
-    return v;
-  }
-
-  if((lt == OUTSIDE_AFFINE_HULL) && (dim == 2) && (n_vertices == 4)) {
-    v->set_point(p);
-    return v;
-  }
-
-  if((lt != OUTSIDE_AFFINE_HULL) && (dim == 1)) {
-
-    if(loc->has_vertex(v)) {
-      v->set_point(p);
-    } else {
-      Vertex_handle inserted = insert(p, lt, loc, li, lj);
-      Cell_handle f = v->cell();
-      int i = f->index(v);
-      if (i==0) {f = f->neighbor(1);}
-      CGAL_triangulation_assertion(f->index(v) == 1);
-      Cell_handle g= f->neighbor(0);
-      f->set_vertex(1, g->vertex(1));
-      f->set_neighbor(0,g->neighbor(0));
-      g->neighbor(0)->set_neighbor(1,f);
-      g->vertex(1)->set_cell(f);
-      tds().delete_cell(g);
-      Cell_handle f_ins = inserted->cell();
-      i = f_ins->index(inserted);
-      if (i==0) {f_ins = f_ins->neighbor(1);}
-      CGAL_triangulation_assertion(f_ins->index(inserted) == 1);
-      Cell_handle g_ins = f_ins->neighbor(0);
-      f_ins->set_vertex(1, v);
-      g_ins->set_vertex(0, v);
-      v->set_point(p);
-      v->set_cell(inserted->cell());
-      tds().delete_vertex(inserted);
-    }
-    return v;
-  }
-
-  bool dim_down = test_dim_down(v);
-
-  if((lt != OUTSIDE_AFFINE_HULL) && dim_down && (dim == 2)) {
-    // verify if p and two static vertices are collinear in this case
-    int iinf;
-    Cell_handle finf = infinite_vertex()->cell(), fdone;
-    fdone = finf;
-    do {
-      iinf = finf->index(infinite_vertex());
-      if(!finf->has_vertex(v)) break;
-      finf = finf->neighbor((iinf+1)%3);
-    } while(finf != fdone);
-    iinf = ~iinf;
-    if(this->collinear(finf->vertex(iinf&1)->point(),
-                       finf->vertex(iinf&2)->point(),
-                       p))
-    {
-      v->set_point(p);
-      _tds.decrease_dimension(loc, loc->index(v));
-      return v;
-    }
-  }
-
-  if(((dim == 2) && (lt != OUTSIDE_AFFINE_HULL)) ||
-     ((lt == OUTSIDE_AFFINE_HULL) && (dim == 1)))
-  {
-
-    // This is insert must be from Delaunay (or the particular trian.)
-    // not Triangulation_3 !
-    Vertex_handle inserted = inserter.insert(p, lt, loc, li, lj);
-
-    std::list<Edge_2D> hole;
-    make_hole_2D(v, hole, remover);
-    fill_hole_2D(hole, remover);
-
-    // fixing pointer
-    Cell_handle fc = inserted->cell(), done(fc);
-    std::vector<Cell_handle> faces_pt;
-    faces_pt.reserve(16);
-    do {
-      faces_pt.push_back(fc);
-      fc = fc->neighbor((fc->index(inserted) + 1)%3);
-    } while(fc != done);
-    std::size_t ss = faces_pt.size();
-    for(std::size_t k=0; k<ss; k++)
-    {
-      Cell_handle f = faces_pt[k];
-      int i = f->index(inserted);
-      f->set_vertex(i, v);
-    }
-    v->set_point(p);
-    v->set_cell(inserted->cell());
-
-    tds().delete_vertex(inserted);
-
-    return v;
-  }
-
-  if((lt != OUTSIDE_AFFINE_HULL) && dim_down && (dim == 3)) {
-    // verify if p and two static vertices are collinear in this case
-    std::vector<Cell_handle> ics;
-    incident_cells(infinite_vertex(), std::back_inserter(ics));
-    std::size_t size = ics.size();
-    Cell_handle finf;
-    for (std::size_t i=0; i<size; i++) {
-      finf = ics[i];
-      if(!finf->has_vertex(v)) break;
-    }
-    int iinf = finf->index(infinite_vertex());
-    if(remover.tmp.coplanar(finf->vertex((iinf+1)&3)->point(),
-                            finf->vertex((iinf+2)&3)->point(),
-                            finf->vertex((iinf+3)&3)->point(),
-                            p))
-    {
-      v->set_point(p);
-      _tds.decrease_dimension(loc, loc->index(v));
-      Facet f = *finite_facets_begin();
-      if (coplanar_orientation(f.first->vertex(0)->point(),
-                               f.first->vertex(1)->point(),
-                               f.first->vertex(2)->point()) == NEGATIVE)
-        tds().reorient();
-      restore_edges_after_decrease_dimension(v, remover,inserter);
-      return v;
-    }
-  }
-
-  // This is insert must be from Delaunay (or the particular trian.)
-  // not Triangulation_3 !
-  Vertex_handle inserted = inserter.insert(p, lt, loc, li, lj);
-
-  std::vector<Cell_handle> hole;
-  hole.reserve(64);
-
-  // Construct the set of vertex triples on the boundary
-  // with the facet just behind
-  Vertex_triple_Facet_map outer_map;
-  Vertex_triple_Facet_map inner_map;
-
-  make_hole_3D(v, outer_map, hole);
-
-  CGAL_assertion(remover.hidden_points_begin() ==
-                 remover.hidden_points_end() );
-
-  // Output the hidden points.
-  for (typename std::vector<Cell_handle>::iterator
-         hi = hole.begin(), hend = hole.end(); hi != hend; ++hi)
-    remover.add_hidden_points(*hi);
-
-  bool inf = false;
-  unsigned int i;
-  // collect all vertices on the boundary
-  std::vector<Vertex_handle> vertices;
-  vertices.reserve(64);
-
-  adjacent_vertices(v, std::back_inserter(vertices));
-
-  // create a Delaunay triangulation of the points on the boundary
-  // and make a map from the vertices in remover.tmp towards the vertices
-  // in *this
-
-  Vertex_handle_unique_hash_map vmap;
-  Cell_handle ch = Cell_handle();
-  for(i=0; i < vertices.size(); i++){
-    if(! is_infinite(vertices[i])){
-      Vertex_handle vh = remover.tmp.insert(vertices[i]->point(), ch);
-      ch = vh->cell();
-      vmap[vh] = vertices[i];
-    }else {
-      inf = true;
-    }
-  }
-
-  if(remover.tmp.dimension()==2){
-    Vertex_handle fake_inf = remover.tmp.insert(v->point());
-    vmap[fake_inf] = infinite_vertex();
-  } else {
-    vmap[remover.tmp.infinite_vertex()] = infinite_vertex();
-  }
-
-  CGAL_triangulation_assertion(remover.tmp.dimension() == 3);
-
-  // Construct the set of vertex triples of remover.tmp
-  // We reorient the vertex triple so that it matches those from outer_map
-  // Also note that we use the vertices of *this, not of remover.tmp
-
-  if(inf){
-    for(All_cells_iterator it = remover.tmp.all_cells_begin(),
-          end = remover.tmp.all_cells_end(); it != end; ++it){
-      for(i=0; i < 4; i++){
-        Facet f = std::pair<Cell_handle,int>(it,i);
-        Vertex_triple vt_aux = make_vertex_triple(f);
-        Vertex_triple vt(vmap[vt_aux.first],vmap[vt_aux.third],vmap[vt_aux.second]);
-        make_canonical(vt);
-        inner_map[vt]= f;
-      }
-    }
-  } else {
-    for(Finite_cells_iterator it = remover.tmp.finite_cells_begin(),
-          end = remover.tmp.finite_cells_end(); it != end; ++it){
-      for(i=0; i < 4; i++){
-        Facet f = std::pair<Cell_handle,int>(it,i);
-        Vertex_triple vt_aux = make_vertex_triple(f);
-        Vertex_triple vt(vmap[vt_aux.first],vmap[vt_aux.third],vmap[vt_aux.second]);
-        make_canonical(vt);
-        inner_map[vt]= f;
-      }
-    }
-  }
-  // Grow inside the hole, by extending the surface
-  while(! outer_map.empty()){
-    typename Vertex_triple_Facet_map::iterator oit = outer_map.begin();
-    while(is_infinite(oit->first.first) ||
-          is_infinite(oit->first.second) ||
-          is_infinite(oit->first.third)){
-      ++oit;
-      // otherwise the lookup in the inner_map fails
-      // because the infinite vertices are different
-    }
-    typename Vertex_triple_Facet_map::value_type o_vt_f_pair = *oit;
-    Cell_handle o_ch = o_vt_f_pair.second.first;
-    unsigned int o_i = o_vt_f_pair.second.second;
-
-    typename Vertex_triple_Facet_map::iterator iit =
-      inner_map.find(o_vt_f_pair.first);
-    CGAL_triangulation_assertion(iit != inner_map.end());
-    typename Vertex_triple_Facet_map::value_type i_vt_f_pair = *iit;
-    Cell_handle i_ch = i_vt_f_pair.second.first;
-    unsigned int i_i = i_vt_f_pair.second.second;
-
-    // create a new cell and glue it to the outer surface
-    Cell_handle new_ch = tds().create_cell();
-
-    new_ch->set_vertices(vmap[i_ch->vertex(0)], vmap[i_ch->vertex(1)],
-                         vmap[i_ch->vertex(2)], vmap[i_ch->vertex(3)]);
-
-    o_ch->set_neighbor(o_i,new_ch);
-    new_ch->set_neighbor(i_i, o_ch);
-
-    // for the other faces check, if they can also be glued
-    for(i = 0; i < 4; i++){
-      if(i != i_i){
-        Facet f = std::pair<Cell_handle,int>(new_ch,i);
-        Vertex_triple vt = make_vertex_triple(f);
-        make_canonical(vt);
-        std::swap(vt.second,vt.third);
-        typename Vertex_triple_Facet_map::iterator oit2 = outer_map.find(vt);
-        if(oit2 == outer_map.end()){
-          std::swap(vt.second,vt.third);
-          outer_map[vt]= f;
-        } else {
-          // glue the faces
-          typename Vertex_triple_Facet_map::value_type o_vt_f_pair2 = *oit2;
-          Cell_handle o_ch2 = o_vt_f_pair2.second.first;
-          int o_i2 = o_vt_f_pair2.second.second;
-          o_ch2->set_neighbor(o_i2,new_ch);
-          new_ch->set_neighbor(i, o_ch2);
-          outer_map.erase(oit2);
-        }
-      }
-    }
-    outer_map.erase(oit);
-  }
-
-  // fixing pointer
-  std::vector<Cell_handle> cells_pt;
-  cells_pt.reserve(64);
-  incident_cells(inserted, std::back_inserter(cells_pt));
-  std::size_t size = cells_pt.size();
-  for(std::size_t i=0; i<size; i++) {
-    Cell_handle c = cells_pt[i];
-    c->set_vertex(c->index(inserted), v);
-  }
-  v->set_point(p);
-  v->set_cell(inserted->cell());
-  tds().delete_vertex(inserted);
-  tds().delete_cells(hole.begin(), hole.end());
-  return v;
-} // end of Vertex_handle
-  // Triangulation_3<Gt,Tds,Lds>::
-  // move_if_no_collision(Vertex_handle,Point, VertexRemover, VertexInserter)
-
-template <class Gt, class Tds, class Lds>
-template < class VertexRemover, class VertexInserter >
-typename Triangulation_3<Gt,Tds,Lds>::Vertex_handle
-Triangulation_3<Gt,Tds,Lds>::
-move(Vertex_handle v, const Point &p,
-     VertexRemover &remover, VertexInserter &inserter) {
-  CGAL_assertion(remover.hidden_points_begin() ==
-                 remover.hidden_points_end() );
-  CGAL_triangulation_precondition(!is_infinite(v));
-  if(v->point() == p) return v;
-  Vertex_handle w = move_if_no_collision(v,p,remover,inserter);
-  if(w != v) {
-    remove(v, remover);
-    return w;
-  }
-  return v;
-}
-
-// The VertexInserter is needed so as to
-// allow us the usage of the insertion method
-// from the particular triangulation
-template <class Gt, class Tds, class Lds>
-template < class VertexRemover, class VertexInserter, class OutputItCells >
-typename Triangulation_3<Gt,Tds,Lds>::Vertex_handle
-Triangulation_3<Gt,Tds,Lds>::
-move_if_no_collision_and_give_new_cells(Vertex_handle v, const Point &p,
-                                        VertexRemover &remover, VertexInserter &inserter, OutputItCells fit) {
-  CGAL_assertion(remover.hidden_points_begin() ==
-                 remover.hidden_points_end() );
-  CGAL_triangulation_precondition(!is_infinite(v));
-  if(v->point() == p) return v;
-  const int dim = dimension();
-
-  // If displacements are known to be small
-  // we might want to optimize by checking
-  // whether there is a topological change
-  // or not before.
-  // In this version this will not be put inside this method
-  // because it is for general purposes,
-  // and remaining Delaunay after motion is a bit too restrictive.
-  // In the filtered version optimized for displacements
-  // it will be used as an a priori.
-  // However, a non-fully optimized but good version of
-  // is_delaunay_after_displacement is provided as an internal method of
-  // Delaunay_triangulation_3 (see the class for more details).
-
-  Locate_type lt;
-  int li, lj;
-  Cell_handle loc = locate(p, lt, li, lj, v->cell());
-
-  if(lt == VERTEX) return loc->vertex(li);
-
-  if(dim == 0) {
-    v->set_point(p);
-    return v;
-  }
-
-  int n_vertices = tds().number_of_vertices();
-
-  if((lt == OUTSIDE_AFFINE_HULL) && (dim == 1) && (n_vertices == 3)) {
-    v->set_point(p);
-    for(All_cells_iterator afi = tds().raw_cells_begin();
-        afi != tds().raw_cells_end();
-        afi++) *fit++ = afi;
-    return v;
-  }
-
-  if((lt == OUTSIDE_AFFINE_HULL) && (dim == 2) && (n_vertices == 4)) {
-    v->set_point(p);
-    for(All_cells_iterator afi = tds().raw_cells_begin();
-        afi != tds().raw_cells_end();
-        afi++) *fit++ = afi;
-    return v;
-  }
-
-  if((lt != OUTSIDE_AFFINE_HULL) && (dim == 1)) {
-    if(loc->has_vertex(v)) {
-      v->set_point(p);
-    } else {
-      Vertex_handle inserted = insert(p, lt, loc, li, lj);
-      Cell_handle f = v->cell();
-      int i = f->index(v);
-      if (i==0) {f = f->neighbor(1);}
-      CGAL_triangulation_assertion(f->index(v) == 1);
-      Cell_handle g= f->neighbor(0);
-      f->set_vertex(1, g->vertex(1));
-      f->set_neighbor(0,g->neighbor(0));
-      g->neighbor(0)->set_neighbor(1,f);
-      g->vertex(1)->set_cell(f);
-      tds().delete_cell(g);
-      *fit++ = f;
-      Cell_handle f_ins = inserted->cell();
-      i = f_ins->index(inserted);
-      if (i==0) {f_ins = f_ins->neighbor(1);}
-      CGAL_triangulation_assertion(f_ins->index(inserted) == 1);
-      Cell_handle g_ins = f_ins->neighbor(0);
-      f_ins->set_vertex(1, v);
-      g_ins->set_vertex(0, v);
-      v->set_point(p);
-      v->set_cell(inserted->cell());
-      tds().delete_vertex(inserted);
-    }
-    *fit++ = v->cell();
-    if(v->cell()->neighbor(0)->has_vertex(v))
-      *fit++ = v->cell()->neighbor(0);
-    if(v->cell()->neighbor(1)->has_vertex(v))
-      *fit++ = v->cell()->neighbor(1);
-    return v;
-  }
-
-  bool dim_down = test_dim_down(v);
-
-  if((lt != OUTSIDE_AFFINE_HULL) && dim_down && (dim == 2)) {
-    // verify if p and two static vertices are collinear in this case
-    int iinf;
-    Cell_handle finf = infinite_vertex()->cell(), fdone;
-    fdone = finf;
-    do {
-      iinf = finf->index(infinite_vertex());
-      if(!finf->has_vertex(v)) break;
-      finf = finf->neighbor((iinf+1)%3);
-    } while(finf != fdone);
-    iinf = ~iinf;
-    if(this->collinear(finf->vertex(iinf&1)->point(),
-                       finf->vertex(iinf&2)->point(),
-                       p))
-    {
-      v->set_point(p);
-      _tds.decrease_dimension(loc, loc->index(v));
-      for(All_cells_iterator afi = tds().raw_cells_begin();
-          afi != tds().raw_cells_end();
-          afi++) *fit++ = afi;
-      return v;
-    }
-  }
-
-  if(((dim == 2) && (lt != OUTSIDE_AFFINE_HULL)) ||
-     ((lt == OUTSIDE_AFFINE_HULL) && (dim == 1)))
-  {
-
-    std::set<Cell_handle> cells_set;
-    // This is insert must be from Delaunay (or the particular trian.)
-    // not Triangulation_3 !
-    Vertex_handle inserted = inserter.insert(p, lt, loc, li, lj);
-    Cell_handle c = inserted->cell(), end = c;
-    do {
-      cells_set.insert(c);
-      int i = c->index(inserted);
-      c = c->neighbor((i+1)%3);
-    }	while(c != end);
-
-    std::list<Edge_2D> hole;
-    make_hole_2D(v, hole, remover, cells_set);
-    fill_hole_2D(hole, remover, fit);
-
-    // fixing pointer
-    Cell_handle fc = inserted->cell(), done(fc);
-    std::vector<Cell_handle> faces_pt;
-    faces_pt.reserve(16);
-    do {
-      faces_pt.push_back(fc);
-      fc = fc->neighbor((fc->index(inserted) + 1)%3);
-    } while(fc != done);
-    int ss = faces_pt.size();
-    for(int k=0; k<ss; k++)
-    {
-      Cell_handle f = faces_pt[k];
-      int i = f->index(inserted);
-      f->set_vertex(i, v);
-    }
-    v->set_point(p);
-    v->set_cell(inserted->cell());
-
-    tds().delete_vertex(inserted);
-
-    for(typename std::set<Cell_handle>::const_iterator ib = cells_set.begin(),
-          iend = cells_set.end(); ib != iend; ib++) *fit++ = *ib;
-
-    return v;
-  }
-
-  if((lt != OUTSIDE_AFFINE_HULL) && dim_down && (dim == 3)) {
-    // verify if p and two static vertices are collinear in this case
-    std::vector<Cell_handle> ics;
-    incident_cells(infinite_vertex(), std::back_inserter(ics));
-    int size = ics.size();
-    Cell_handle finf;
-    for (int i=0; i<size; i++) {
-      finf = ics[i];
-      if(!finf->has_vertex(v)) break;
-    }
-    int iinf = finf->index(infinite_vertex());
-    if(remover.tmp.coplanar(finf->vertex((iinf+1)&3)->point(),
-                            finf->vertex((iinf+2)&3)->point(),
-                            finf->vertex((iinf+3)&3)->point(),
-                            p))
-    {
-      v->set_point(p);
-      _tds.decrease_dimension(loc, loc->index(v));
-      Facet f = *finite_facets_begin();
-      if (coplanar_orientation(f.first->vertex(0)->point(),
-                               f.first->vertex(1)->point(),
-                               f.first->vertex(2)->point()) == NEGATIVE)
-        tds().reorient();
-      restore_edges_after_decrease_dimension(v, remover,inserter);
-      for(All_cells_iterator afi = tds().raw_cells_begin();
-          afi != tds().raw_cells_end();
-          afi++) *fit++ = afi;
-      return v;
-    }
-  }
-
-  std::set<Cell_handle> cells_set;
-
-  // This is insert must be from Delaunay (or the particular trian.)
-  // not Triangulation_3 !
-  Vertex_handle inserted = inserter.insert(p, lt, loc, li, lj);
-
-  std::vector<Cell_handle> cells_tmp;
-  cells_tmp.reserve(64);
-  incident_cells(inserted, std::back_inserter(cells_tmp));
-  int size = cells_tmp.size();
-  for(int i=0; i<size; i++) {
-    cells_set.insert(cells_tmp[i]);
-  }
-
-  std::vector<Cell_handle> hole;
-  hole.reserve(64);
-
-  // Construct the set of vertex triples on the boundary
-  // with the facet just behind
-  Vertex_triple_Facet_map outer_map;
-  Vertex_triple_Facet_map inner_map;
-
-  make_hole_3D(v, outer_map, hole);
-
-  for(typename std::vector<Cell_handle>::const_iterator ib = hole.begin(),
-        iend = hole.end(); ib != iend; ib++) cells_set.erase(*ib);
-
-  CGAL_assertion(remover.hidden_points_begin() ==
-                 remover.hidden_points_end() );
-
-  // Output the hidden points.
-  for (typename std::vector<Cell_handle>::iterator
-         hi = hole.begin(), hend = hole.end(); hi != hend; ++hi)
-    remover.add_hidden_points(*hi);
-
-  bool inf = false;
-  unsigned int i;
-  // collect all vertices on the boundary
-  std::vector<Vertex_handle> vertices;
-  vertices.reserve(64);
-
-  adjacent_vertices(v, std::back_inserter(vertices));
-
-  // create a Delaunay triangulation of the points on the boundary
-  // and make a map from the vertices in remover.tmp towards the vertices
-  // in *this
-
-  Vertex_handle_unique_hash_map vmap;
-  Cell_handle ch = Cell_handle();
-  for(i=0; i < vertices.size(); i++){
-    if(! is_infinite(vertices[i])){
-      Vertex_handle vh = remover.tmp.insert(vertices[i]->point(), ch);
-      ch = vh->cell();
-      vmap[vh] = vertices[i];
-    }else {
-      inf = true;
-    }
-  }
-
-  if(remover.tmp.dimension()==2){
-    Vertex_handle fake_inf = remover.tmp.insert(v->point());
-    vmap[fake_inf] = infinite_vertex();
-  } else {
-    vmap[remover.tmp.infinite_vertex()] = infinite_vertex();
-  }
-
-  CGAL_triangulation_assertion(remover.tmp.dimension() == 3);
-
-  // Construct the set of vertex triples of remover.tmp
-  // We reorient the vertex triple so that it matches those from outer_map
-  // Also note that we use the vertices of *this, not of remover.tmp
-
-  if(inf){
-    for(All_cells_iterator it = remover.tmp.all_cells_begin(),
-          end = remover.tmp.all_cells_end(); it != end; ++it){
-      for(i=0; i < 4; i++){
-        Facet f = std::pair<Cell_handle,int>(it,i);
-        Vertex_triple vt_aux = make_vertex_triple(f);
-        Vertex_triple vt(vmap[vt_aux.first],vmap[vt_aux.third],vmap[vt_aux.second]);
-        make_canonical(vt);
-        inner_map[vt]= f;
-      }
-    }
-  } else {
-    for(Finite_cells_iterator it = remover.tmp.finite_cells_begin(),
-          end = remover.tmp.finite_cells_end(); it != end; ++it){
-      for(i=0; i < 4; i++){
-        Facet f = std::pair<Cell_handle,int>(it,i);
-        Vertex_triple vt_aux = make_vertex_triple(f);
-        Vertex_triple vt(vmap[vt_aux.first],vmap[vt_aux.third],vmap[vt_aux.second]);
-        make_canonical(vt);
-        inner_map[vt]= f;
-      }
-    }
-  }
-  // Grow inside the hole, by extending the surface
-  while(! outer_map.empty()){
-    typename Vertex_triple_Facet_map::iterator oit = outer_map.begin();
-    while(is_infinite(oit->first.first) ||
-          is_infinite(oit->first.second) ||
-          is_infinite(oit->first.third)){
-      ++oit;
-      // otherwise the lookup in the inner_map fails
-      // because the infinite vertices are different
-    }
-    typename Vertex_triple_Facet_map::value_type o_vt_f_pair = *oit;
-    Cell_handle o_ch = o_vt_f_pair.second.first;
-    unsigned int o_i = o_vt_f_pair.second.second;
-
-    typename Vertex_triple_Facet_map::iterator iit =
-      inner_map.find(o_vt_f_pair.first);
-    CGAL_triangulation_assertion(iit != inner_map.end());
-    typename Vertex_triple_Facet_map::value_type i_vt_f_pair = *iit;
-    Cell_handle i_ch = i_vt_f_pair.second.first;
-    unsigned int i_i = i_vt_f_pair.second.second;
-
-    // create a new cell and glue it to the outer surface
-    Cell_handle new_ch = tds().create_cell();
-    *fit++ = new_ch;
-
-    new_ch->set_vertices(vmap[i_ch->vertex(0)], vmap[i_ch->vertex(1)],
-                         vmap[i_ch->vertex(2)], vmap[i_ch->vertex(3)]);
-
-    o_ch->set_neighbor(o_i,new_ch);
-    new_ch->set_neighbor(i_i, o_ch);
-
-    // for the other faces check, if they can also be glued
-    for(i = 0; i < 4; i++){
-      if(i != i_i){
-        Facet f = std::pair<Cell_handle,int>(new_ch,i);
-        Vertex_triple vt = make_vertex_triple(f);
-        make_canonical(vt);
-        std::swap(vt.second,vt.third);
-        typename Vertex_triple_Facet_map::iterator oit2 = outer_map.find(vt);
-        if(oit2 == outer_map.end()){
-          std::swap(vt.second,vt.third);
-          outer_map[vt]= f;
-        } else {
-          // glue the faces
-          typename Vertex_triple_Facet_map::value_type o_vt_f_pair2 = *oit2;
-          Cell_handle o_ch2 = o_vt_f_pair2.second.first;
-          int o_i2 = o_vt_f_pair2.second.second;
-          o_ch2->set_neighbor(o_i2,new_ch);
-          new_ch->set_neighbor(i, o_ch2);
-          outer_map.erase(oit2);
-        }
-      }
-    }
-    outer_map.erase(oit);
-  }
-
-  // fixing pointer
-  std::vector<Cell_handle> cells_pt;
-  cells_pt.reserve(64);
-  incident_cells(inserted, std::back_inserter(cells_pt));
-  size = cells_pt.size();
-  for(int i=0; i<size; i++) {
-    Cell_handle c = cells_pt[i];
-    c->set_vertex(c->index(inserted), v);
-  }
-  v->set_point(p);
-  v->set_cell(inserted->cell());
-  tds().delete_vertex(inserted);
-  tds().delete_cells(hole.begin(), hole.end());
-
-  for(typename std::set<Cell_handle>::const_iterator ib = cells_set.begin(),
-        iend = cells_set.end(); ib != iend; ib++) *fit++ = *ib;
-  return v;
-}
-
-template <class Gt, class Tds, class Lds>
-void
-Triangulation_3<Gt,Tds,Lds>::
-_make_big_hole_3D( Vertex_handle v,
-                   std::map<Vertex_triple,Facet>& outer_map,
-                   std::vector<Cell_handle> & hole,
-                   std::vector<Vertex_handle> & vertices,
-                   std::map<Vertex_handle, REMOVE_VERTEX_STATE> &vstates)
-{
-
-  Cell_handle start = v->cell();
-  start->tds_data().mark_processed();
-  hole.push_back(start);
-  std::size_t i=0, n=1;
-  while(i < n)
-  {
-
-    Cell_handle c = hole[i++];
-
-    for(int k=0; k<4; k++)
-    {
-      Vertex_handle v0 = c->vertex(k);
-
-      const REMOVE_VERTEX_STATE vst = vstates[v0];
-
-      if(vst == CLEAR)
-      {
-        vstates[v0] = EXTREMITY;
-        vertices.push_back(v0);
-      }	else if(vst == TO_REMOVE) {
-        // we mark the vertices, so all the vertices
-        // from the same cluster will be skipped
-        // in the remove_cluster_3D function
-        vstates[v0] = PROCESSED;
-      }
-
-      int i1 = vertex_triple_index(k, 0);
-      int i2 = vertex_triple_index(k, 1);
-      int i3 = vertex_triple_index(k, 2);
-
-      Vertex_handle v1 = c->vertex(i1);
-      Vertex_handle v2 = c->vertex(i2);
-      Vertex_handle v3 = c->vertex(i3);
-
-      Cell_handle opp_cit = c->neighbor(k);
-      int opp_i = tds().mirror_index(c,k);
-      Vertex_handle vm = opp_cit->vertex(opp_i);
-
-      bool pb1 = false, pb2 = false, pb3 = false, pbm = false;
-
-      const REMOVE_VERTEX_STATE vst1 = vstates[v1];
-      pb1 = vst1 == TO_REMOVE || vst1 == PROCESSED;
-
-      if(!pb1) {
-        const REMOVE_VERTEX_STATE vst2 = vstates[v2];
-        pb2 = vst2 == TO_REMOVE || vst2 == PROCESSED;
-
-        if(!pb2) {
-          const REMOVE_VERTEX_STATE vst3 = vstates[v3];
-          pb3 = vst3 == TO_REMOVE || vst3 == PROCESSED;
-
-          if(!pb3) {
-            const REMOVE_VERTEX_STATE vstm = vstates[vm];
-            pbm = vstm == TO_REMOVE || vstm == PROCESSED;
-          }
-
-        }
-
-      }
-
-      bool bad_opposite_cell = pb1 || pb2 || pb3 || pbm;
-
-      // update the hole if needed
-      // when the vertex is not to be removed
-      if(bad_opposite_cell)
-      {
-        if(opp_cit->tds_data().is_clear())
-        {
-          hole.push_back(opp_cit);
-          opp_cit->tds_data().mark_processed();
-          n++;
-        }
-        continue;
-      }
-
-      Facet f(opp_cit, opp_i);
-      Vertex_triple vt = make_vertex_triple(f);
-      make_canonical(vt);
-      outer_map[vt] = f;
-      v1->set_cell(opp_cit);
-      v2->set_cell(opp_cit);
-      v3->set_cell(opp_cit);
-      vm->set_cell(opp_cit);
-
-    }
-  }
-
-  std::size_t vsize = vertices.size();
-  for(std::size_t i=0; i<vsize; i++) vstates[vertices[i]] = CLEAR;
-
-}
-
-
-template <class Gt, class Tds, class Lds>
-template < class InputIterator, class VertexRemover >
-bool
-Triangulation_3<Gt, Tds, Lds>::
-_remove_cluster_3D(InputIterator first, InputIterator beyond, VertexRemover &remover,
-                   std::map<Vertex_handle, REMOVE_VERTEX_STATE> &vstates) {
-  InputIterator init = first;
-  while(first != beyond)
-  {
-    Vertex_handle v = *first++;
-
-    if(vstates[v] == PROCESSED) continue;
-
-    //  _make_big_hole_3D and we fill the hole for each cluster
-    vstates[v] = PROCESSED;
-
-    // here, we make the hole for the cluster with v inside
-    typedef std::map<Vertex_triple,Facet> Vertex_triple_Facet_map;
-    std::vector<Cell_handle> hole;
-    std::vector<Vertex_handle> vertices;
-    hole.reserve(64);
-    vertices.reserve(32);
-    Vertex_triple_Facet_map outer_map;
-    _make_big_hole_3D(v, outer_map, hole, vertices, vstates);
-
-    // the connectivity is totally lost, we need to rebuild
-    if(!outer_map.size())
-    {
-      std::size_t nh = hole.size();
-      for(std::size_t i=0; i<nh; i++) hole[i]->tds_data().clear();
-      return false;
-    }
-
-    std::size_t vsi = vertices.size();
-
-    bool inf = false;
-    std::size_t i;
-    Vertex_handle_unique_hash_map vmap;
-    Cell_handle ch = Cell_handle();
-
-    if(vsi > 100)
-    {
-      // spatial sort if too many points
-      std::vector<Point> vps;
-      std::map<Point, Vertex_handle> mp_vps;
-      for(i=0; i<vsi;i++)
-      {
-        Vertex_handle vv = vertices[i];
-        if(! this->is_infinite(vv)) {
-          vps.push_back(vv->point());
-          mp_vps[vv->point()] = vv;
-        } else inf = true;
-      }
-      spatial_sort(vps.begin(), vps.end());
-
-      std::size_t svps = vps.size();
-
-      for(i=0; i < svps; i++){
-        Vertex_handle vv = mp_vps[vps[i]];
-        Vertex_handle vh = remover.tmp.insert(vv->point(), ch);
-        ch = vh->cell();
-        vmap[vh] = vv;
-      }
-
-      if(remover.tmp.dimension()==2){
-        Vertex_handle fake_inf = remover.tmp.insert(v->point());
-        vmap[fake_inf] = this->infinite_vertex();
-      } else {
-        vmap[remover.tmp.infinite_vertex()] = this->infinite_vertex();
-      }
-    } else {
-
-      for(i=0; i < vsi; i++){
-        if(!this->is_infinite(vertices[i])){
-          Vertex_handle vh = remover.tmp.insert(vertices[i]->point(), ch);
-          ch = vh->cell();
-          vmap[vh] = vertices[i];
-        } else {
-          inf = true;
-        }
-      }
-
-      if(remover.tmp.dimension()==2){
-        Vertex_handle fake_inf = remover.tmp.insert(v->point());
-        vmap[fake_inf] = this->infinite_vertex();
-      } else {
-        vmap[remover.tmp.infinite_vertex()] = this->infinite_vertex();
-      }
-    }
-
-    Vertex_triple_Facet_map inner_map;
-
-    if(inf){
-      for(All_cells_iterator it = remover.tmp.all_cells_begin(),
-            end = remover.tmp.all_cells_end(); it != end; ++it){
-        for(unsigned int index=0; index < 4; index++) {
-          Facet f = std::pair<Cell_handle,int>(it,index);
-          Vertex_triple vt_aux = this->make_vertex_triple(f);
-          Vertex_triple vt(vmap[vt_aux.first],vmap[vt_aux.third],vmap[vt_aux.second]);
-          this->make_canonical(vt);
-          inner_map[vt]= f;
-        }
-      }
-    } else {
-      for(Finite_cells_iterator it = remover.tmp.finite_cells_begin(),
-            end = remover.tmp.finite_cells_end(); it != end; ++it){
-        for(unsigned int index=0; index < 4; index++){
-          Facet f = std::pair<Cell_handle,int>(it,index);
-          Vertex_triple vt_aux = this->make_vertex_triple(f);
-          Vertex_triple vt(vmap[vt_aux.first],vmap[vt_aux.third],vmap[vt_aux.second]);
-          this->make_canonical(vt);
-          inner_map[vt]= f;
-        }
-      }
-    }
-
-    // Grow inside the hole, by extending the surface
-    while(! outer_map.empty()){
-      typename Vertex_triple_Facet_map::iterator oit = outer_map.begin();
-
-      while(this->is_infinite(oit->first.first) ||
-            this->is_infinite(oit->first.second) ||
-            this->is_infinite(oit->first.third)){
-        ++oit;
-        // otherwise the lookup in the inner_map fails
-        // because the infinite vertices are different
-      }
-      typename Vertex_triple_Facet_map::value_type o_vt_f_pair = *oit;
-      Cell_handle o_ch = o_vt_f_pair.second.first;
-      unsigned int o_i = o_vt_f_pair.second.second;
-
-      typename Vertex_triple_Facet_map::iterator iit =
-        inner_map.find(o_vt_f_pair.first);
-      CGAL_triangulation_assertion(iit != inner_map.end());
-      typename Vertex_triple_Facet_map::value_type i_vt_f_pair = *iit;
-      Cell_handle i_ch = i_vt_f_pair.second.first;
-      unsigned int i_i = i_vt_f_pair.second.second;
-
-      // create a new cell and glue it to the outer surface
-      Cell_handle new_ch = tds().create_cell();
-      new_ch->set_vertices(vmap[i_ch->vertex(0)], vmap[i_ch->vertex(1)],
-                           vmap[i_ch->vertex(2)], vmap[i_ch->vertex(3)]);
-
-      o_ch->set_neighbor(o_i,new_ch);
-      new_ch->set_neighbor(i_i, o_ch);
-
-      for(int j=0;j<4;j++) new_ch->vertex(j)->set_cell(new_ch);
-
-      // for the other faces check, if they can also be glued
-      for(unsigned int index = 0; index < 4; index++){
-        if(index != i_i){
-          Facet f = std::pair<Cell_handle,int>(new_ch,index);
-          Vertex_triple vt = this->make_vertex_triple(f);
-          this->make_canonical(vt);
-          std::swap(vt.second,vt.third);
-          typename Vertex_triple_Facet_map::iterator oit2 = outer_map.find(vt);
-          if(oit2 == outer_map.end()){
-            std::swap(vt.second,vt.third);
-            outer_map[vt]= f;
-          } else {
-            // glue the faces
-            typename Vertex_triple_Facet_map::value_type o_vt_f_pair2 = *oit2;
-            Cell_handle o_ch2 = o_vt_f_pair2.second.first;
-            int o_i2 = o_vt_f_pair2.second.second;
-            o_ch2->set_neighbor(o_i2,new_ch);
-            new_ch->set_neighbor(index, o_ch2);
-            outer_map.erase(oit2);
-          }
-        }
-      }
-
-      outer_map.erase(oit);
-    }
-
-    this->tds().delete_cells(hole.begin(), hole.end());
-    remover.tmp.clear();
-
-  }
-
-  this->tds().delete_vertices(init, beyond);
-
-  return true;
-}
-
-template <class Gt, class Tds, class Lds>
-template < class InputIterator >
-bool
-Triangulation_3<Gt, Tds, Lds>::
-does_repeat_in_range(InputIterator first, InputIterator beyond) const {
-  std::set<Vertex_handle> s;
-  while (first!=beyond) if (! s.insert(*first++).second ) return true;
-  return false;
-}
-
-template <class Gt, class Tds, class Lds>
-template < class InputIterator >
-bool
-Triangulation_3<Gt, Tds, Lds>::
-infinite_vertex_in_range(InputIterator first, InputIterator beyond) const {
-  while(first != beyond) if(is_infinite(*first++)) return true;
-  return false;
-}
-
-template <class Gt, class Tds, class Lds>
-template < class InputIterator, class VertexRemover >
-typename Triangulation_3<Gt, Tds, Lds>::size_type
-Triangulation_3<Gt, Tds, Lds>::
-remove(InputIterator first, InputIterator beyond, VertexRemover &remover) {
-  CGAL_triangulation_precondition(!does_repeat_in_range(first, beyond));
-  CGAL_triangulation_precondition(!infinite_vertex_in_range(first, beyond));
-  size_type n = number_of_vertices();
-  InputIterator init = first, init2 = first;
-  if(dimension() == 3 && n > 4)
-  {
-    // If we could add states on a vertex base as it is done
-    // for cells, it would improve the performance.
-    std::map<Vertex_handle, REMOVE_VERTEX_STATE> vstates;
-    _mark_vertices_to_remove(first, beyond, vstates);
-    if(!_test_dim_down_cluster(vstates))
-    {
-      if(_remove_cluster_3D(init, beyond, remover, vstates))
-        return n - number_of_vertices();
-    }
-  }
-
-  // dimension() < 3 or
-  // no connectivity of the remaining vertices
-  // we remove one by one
-  while (init2 != beyond) {
-    Vertex_handle v = *init2++;
-    remover.tmp.clear();
-    remove(v, remover);
-  }
-  return n - number_of_vertices();
-}
-
-template < class GT, class Tds, class Lds >
-bool
-Triangulation_3<GT,Tds,Lds>::
-is_valid(bool verbose, int level) const
-{
-  if ( ! _tds.is_valid(verbose,level) ) {
-    if (verbose)
-        std::cerr << "invalid data structure" << std::endl;
-    CGAL_triangulation_assertion(false);
-    return false;
-  }
-
-  if ( infinite_vertex() == Vertex_handle() ) {
-    if (verbose)
-        std::cerr << "no infinite vertex" << std::endl;
-    CGAL_triangulation_assertion(false);
-    return false;
-  }
-
-  switch ( dimension() ) {
-  case 3:
-    {
-      for(Finite_cells_iterator it = finite_cells_begin(), end = finite_cells_end();
-              it != end; ++it)
-        is_valid_finite(it, verbose, level);
-      break;
-    }
-  case 2:
-    {
-      for(Finite_facets_iterator it = finite_facets_begin(), end = finite_facets_end();
-             it != end; ++it)
-        is_valid_finite(it->first,verbose,level);
-      break;
-    }
-  case 1:
-    {
-      for(Finite_edges_iterator it = finite_edges_begin(), end = finite_edges_end();
-             it != end; ++it)
-        is_valid_finite(it->first,verbose,level);
-      break;
-    }
-  }
-  if (verbose)
-      std::cerr << "valid triangulation" << std::endl;
-  return true;
-}
-
-template < class GT, class Tds, class Lds >
-bool
-Triangulation_3<GT,Tds,Lds>::
-is_valid(Cell_handle c, bool verbose, int level) const
-{
-  if ( ! _tds.is_valid(c,verbose,level) ) {
-    if (verbose) {
-      std::cerr << "combinatorially invalid cell";
-      for (int i=0; i <= dimension(); i++ )
-        std::cerr << c->vertex(i)->point() << ", ";
-      std::cerr << std::endl;
-    }
-    CGAL_triangulation_assertion(false);
-    return false;
-  }
-  if ( ! is_infinite(c) )
-    is_valid_finite(c, verbose, level);
-  if (verbose)
-      std::cerr << "geometrically valid cell" << std::endl;
-  return true;
-}
-
-
-template < class GT, class Tds, class Lds >
-bool
-Triangulation_3<GT,Tds,Lds>::
-is_valid_finite(Cell_handle c, bool verbose, int) const
-{
-  switch ( dimension() ) {
-  case 3:
-    {
-      if ( orientation(c->vertex(0)->point(),
-                       c->vertex(1)->point(),
-                       c->vertex(2)->point(),
-                       c->vertex(3)->point()) != POSITIVE ) {
-        if (verbose)
-            std::cerr << "badly oriented cell "
-                      << c->vertex(0)->point() << ", "
-                      << c->vertex(1)->point() << ", "
-                      << c->vertex(2)->point() << ", "
-                      << c->vertex(3)->point() << std::endl;
-        CGAL_triangulation_assertion(false);
-        return false;
-      }
-      break;
-    }
-  case 2:
-    {
-        if (coplanar_orientation(c->vertex(0)->point(),
-                                 c->vertex(1)->point(),
-                                 c->vertex(2)->point()) != POSITIVE) {
-          if (verbose)
-              std::cerr << "badly oriented face "
-                        << c->vertex(0)->point() << ", "
-                        << c->vertex(1)->point() << ", "
-                        << c->vertex(2)->point() << std::endl;
-          CGAL_triangulation_assertion(false);
-          return false;
-        }
-      break;
-    }
-  case 1:
-    {
-      const Point & p0 = c->vertex(0)->point();
-      const Point & p1 = c->vertex(1)->point();
-
-      Vertex_handle v = c->neighbor(0)->vertex(c->neighbor(0)->index(c));
-      if ( ! is_infinite(v) )
-      {
-        if ( collinear_position(p0, p1, v->point()) != MIDDLE ) {
-          if (verbose)
-              std::cerr << "badly oriented edge "
-                        << p0 << ", " << p1 << std::endl
-                        << "with neighbor 0"
-                        << c->neighbor(0)->vertex(1-c->neighbor(0)->index(c))
-                                         ->point()
-                        << ", " << v->point() << std::endl;
-          CGAL_triangulation_assertion(false);
-          return false;
-        }
-      }
-
-      v = c->neighbor(1)->vertex(c->neighbor(1)->index(c));
-      if ( ! is_infinite(v) )
-      {
-        if ( collinear_position(p1, p0, v->point()) != MIDDLE ) {
-          if (verbose)
-              std::cerr << "badly oriented edge "
-                        << p0 << ", " << p1 << std::endl
-                        << "with neighbor 1"
-                        << c->neighbor(1)->vertex(1-c->neighbor(1)->index(c))
-                                         ->point()
-                        << ", " << v->point() << std::endl;
-          CGAL_triangulation_assertion(false);
-          return false;
-        }
-      }
-      break;
-    }
-  }
-  return true;
-}
-
-
-namespace internal {
-
-// Internal function used by operator==.
-template < class GT, class Tds1, class Tds2, class Lds >
-bool
-test_next(const Triangulation_3<GT, Tds1, Lds> &t1,
-          const Triangulation_3<GT, Tds2, Lds> &t2,
-          typename Triangulation_3<GT, Tds1, Lds>::Cell_handle c1,
-          typename Triangulation_3<GT, Tds2, Lds>::Cell_handle c2,
-          std::map<typename Triangulation_3<GT, Tds1, Lds>::Cell_handle,
-                   typename Triangulation_3<GT, Tds2, Lds>::Cell_handle> &Cmap,
-          std::map<typename Triangulation_3<GT, Tds1, Lds>::Vertex_handle,
-                   typename Triangulation_3<GT, Tds2, Lds>::Vertex_handle> &Vmap)
-{
-
-    // This function tests and registers the 4 neighbors of c1/c2,
-    // and recursively calls itself over them.
-    // We don't use the call stack as it may overflow
-    // Returns false if an inequality has been found.
-
-    // Precondition: c1, c2 have been registered as well as their 4 vertices.
-    CGAL_triangulation_precondition(t1.dimension() >= 2);
-    CGAL_triangulation_precondition(Cmap[c1] == c2);
-    CGAL_triangulation_precondition(Vmap.find(c1->vertex(0)) != Vmap.end());
-    CGAL_triangulation_precondition(Vmap.find(c1->vertex(1)) != Vmap.end());
-    CGAL_triangulation_precondition(Vmap.find(c1->vertex(2)) != Vmap.end());
-    CGAL_triangulation_precondition(t1.dimension() == 2 ||
-                                    Vmap.find(c1->vertex(3)) != Vmap.end());
-
-    typedef Triangulation_3<GT, Tds1, Lds> Tr1;
-    typedef Triangulation_3<GT, Tds2, Lds> Tr2;
-    typedef typename Tr1::Vertex_handle  Vertex_handle1;
-    typedef typename Tr1::Cell_handle    Cell_handle1;
-    typedef typename Tr2::Vertex_handle  Vertex_handle2;
-    typedef typename Tr2::Cell_handle    Cell_handle2;
-    typedef typename std::map<Cell_handle1, Cell_handle2>::const_iterator  Cit;
-    typedef typename std::map<Vertex_handle1,
-                              Vertex_handle2>::const_iterator Vit;
-
-    std::vector<std::pair<Cell_handle1, Cell_handle2> > cell_stack;
-    cell_stack.push_back(std::make_pair(c1, c2));
-
-    while(! cell_stack.empty()){
-
-      Cell_handle1 c1 = cell_stack.back().first;
-      Cell_handle2 c2 = cell_stack.back().second;
-      cell_stack.pop_back();
-
-      for (int i=0; i <= t1.dimension(); ++i) {
-        Cell_handle1 n1 = c1->neighbor(i);
-        Cit cit = Cmap.find(n1);
-        Vertex_handle1 v1 = c1->vertex(i);
-        Vertex_handle2 v2 = Vmap[v1];
-        Cell_handle2 n2 = c2->neighbor(c2->index(v2));
-        if (cit != Cmap.end()) {
-          // n1 was already registered.
-          if (cit->second != n2)
-              return false;
-          continue;
-        }
-        // n1 has not yet been registered.
-        // We check that the new vertices match geometrically.
-        // And we register them.
-        Vertex_handle1 vn1 = n1->vertex(n1->index(c1));
-        Vertex_handle2 vn2 = n2->vertex(n2->index(c2));
-        Vit vit = Vmap.find(vn1);
-        if (vit != Vmap.end()) {
-          // vn1 already registered
-          if (vit->second != vn2)
-            return false;
-        }
-        else {
-          if (t2.is_infinite(vn2))
-            return false; // vn1 can't be infinite,
-          // since it would have been registered.
-          if (t1.geom_traits().compare_xyz_3_object()(vn1->point(),
-                                                      vn2->point()) != 0)
-            return false;
-          // We register vn1/vn2.
-          Vmap.insert(std::make_pair(vn1, vn2));
-        }
-
-        // We register n1/n2.
-        Cmap.insert(std::make_pair(n1, n2));
-        cell_stack.push_back(std::make_pair(n1, n2));
-      }
-    }
-
-    return true;
-}
-
-} // namespace internal
-
-
-template < class GT, class Tds1, class Tds2, class Lds >
-bool
-operator==(const Triangulation_3<GT, Tds1, Lds> &t1,
-           const Triangulation_3<GT, Tds2, Lds> &t2)
-{
-    typedef typename Triangulation_3<GT, Tds1>::Vertex_handle Vertex_handle1;
-    typedef typename Triangulation_3<GT, Tds1>::Cell_handle   Cell_handle1;
-    typedef typename Triangulation_3<GT, Tds2>::Vertex_handle Vertex_handle2;
-    typedef typename Triangulation_3<GT, Tds2>::Cell_handle   Cell_handle2;
-
-    typedef typename Triangulation_3<GT, Tds1>::Point                       Point;
-    typedef typename Triangulation_3<GT, Tds1>::Geom_traits::Equal_3        Equal_3;
-    typedef typename Triangulation_3<GT, Tds1>::Geom_traits::Compare_xyz_3  Compare_xyz_3;
-
-    Equal_3 equal = t1.geom_traits().equal_3_object();
-    Compare_xyz_3 cmp1 = t1.geom_traits().compare_xyz_3_object();
-    Compare_xyz_3 cmp2 = t2.geom_traits().compare_xyz_3_object();
-
-    // Some quick checks.
-    if (t1.dimension() != t2.dimension()
-        || t1.number_of_vertices() != t2.number_of_vertices()
-        || t1.number_of_cells() != t2.number_of_cells())
-        return false;
-
-    int dim = t1.dimension();
-    // Special case for dimension < 1.
-    // The triangulation is uniquely defined in these cases.
-    if (dim < 1)
-        return true;
-
-    // Special case for dimension == 1.
-    if (dim == 1) {
-        // It's enough to test that the points are the same,
-        // since the triangulation is uniquely defined in this case.
-        using namespace boost;
-        std::vector<Point> V1 (t1.points_begin(), t1.points_end());
-        std::vector<Point> V2 (t2.points_begin(), t2.points_end());
-        std::sort(V1.begin(), V1.end(), boost::bind(cmp1, _1, _2) == NEGATIVE);
-        std::sort(V2.begin(), V2.end(), boost::bind(cmp2, _1, _2) == NEGATIVE);
-        return V1 == V2;
-    }
-
-    // We will store the mapping between the 2 triangulations vertices and
-    // cells in 2 maps.
-    std::map<Vertex_handle1, Vertex_handle2> Vmap;
-    std::map<Cell_handle1, Cell_handle2> Cmap;
-
-    // Handle the infinite vertex.
-    Vertex_handle1 v1 = t1.infinite_vertex();
-    Vertex_handle2 iv2 = t2.infinite_vertex();
-    Vmap.insert(std::make_pair(v1, iv2));
-
-    // We pick one infinite cell of t1, and try to match it against the
-    // infinite cells of t2.
-    Cell_handle1 c = v1->cell();
-    Vertex_handle1 v2 = c->vertex((c->index(v1)+1)%(dim+1));
-    Vertex_handle1 v3 = c->vertex((c->index(v1)+2)%(dim+1));
-    Vertex_handle1 v4 = c->vertex((c->index(v1)+3)%(dim+1));
-    const Point &p2 = v2->point();
-    const Point &p3 = v3->point();
-    const Point &p4 = v4->point();
-
-    std::vector<Cell_handle2> ics;
-    t2.incident_cells(iv2, std::back_inserter(ics));
-    for (typename std::vector<Cell_handle2>::const_iterator cit = ics.begin();
-            cit != ics.end(); ++cit) {
-        int inf = (*cit)->index(iv2);
-
-        if (equal(p2, (*cit)->vertex((inf+1)%(dim+1))->point()))
-            Vmap.insert(std::make_pair(v2, (*cit)->vertex((inf+1)%(dim+1))));
-        else if (equal(p2, (*cit)->vertex((inf+2)%(dim+1))->point()))
-            Vmap.insert(std::make_pair(v2, (*cit)->vertex((inf+2)%(dim+1))));
-        else if (dim == 3 &&
-                 equal(p2, (*cit)->vertex((inf+3)%(dim+1))->point()))
-            Vmap.insert(std::make_pair(v2, (*cit)->vertex((inf+3)%(dim+1))));
-        else
-            continue; // None matched v2.
-
-        if (equal(p3, (*cit)->vertex((inf+1)%(dim+1))->point()))
-            Vmap.insert(std::make_pair(v3, (*cit)->vertex((inf+1)%(dim+1))));
-        else if (equal(p3, (*cit)->vertex((inf+2)%(dim+1))->point()))
-            Vmap.insert(std::make_pair(v3, (*cit)->vertex((inf+2)%(dim+1))));
-        else if (dim == 3 &&
-                 equal(p3, (*cit)->vertex((inf+3)%(dim+1))->point()))
-            Vmap.insert(std::make_pair(v3, (*cit)->vertex((inf+3)%(dim+1))));
-        else
-            continue; // None matched v3.
-
-        if (dim == 3) {
-            if (equal(p4, (*cit)->vertex((inf+1)%(dim+1))->point()))
-                Vmap.insert(std::make_pair(v4,
-                                           (*cit)->vertex((inf+1)%(dim+1))));
-            else if (equal(p4, (*cit)->vertex((inf+2)%(dim+1))->point()))
-                Vmap.insert(std::make_pair(v4,
-                                           (*cit)->vertex((inf+2)%(dim+1))));
-            else if (equal(p4, (*cit)->vertex((inf+3)%(dim+1))->point()))
-                Vmap.insert(std::make_pair(v4,
-                                           (*cit)->vertex((inf+3)%(dim+1))));
-            else
-                continue; // None matched v4.
-        }
-
-        // Found it !
-        Cmap.insert(std::make_pair(c, *cit));
-        break;
-    }
-
-    if (Cmap.size() == 0)
-        return false;
-    // We now have one cell, we need to propagate recursively.
-    return internal::test_next(t1, t2,
-                     Cmap.begin()->first, Cmap.begin()->second, Cmap, Vmap);
-}
-
-template < class GT, class Tds1, class Tds2 >
-inline
-bool
-operator!=(const Triangulation_3<GT, Tds1> &t1,
-           const Triangulation_3<GT, Tds2> &t2)
-{
-  return ! (t1 == t2);
-}
-
-} //namespace CGAL
-
-#endif // CGAL_TRIANGULATION_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_data_structure_3.h b/3rdparty/CGAL-4.8/include/CGAL/Triangulation_data_structure_3.h
deleted file mode 100644
index fbdd537..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_data_structure_3.h
+++ /dev/null
@@ -1,3971 +0,0 @@
-// Copyright (c) 1999-2005  INRIA Sophia-Antipolis (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
-// 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(s)     : Monique Teillaud <Monique.Teillaud at sophia.inria.fr>
-//                 Sylvain Pion
-
-// combinatorial triangulation of the boundary of a polytope
-// of dimension d in dimension d+1
-// for -1 <= d <= 3
-
-#ifndef CGAL_TRIANGULATION_DATA_STRUCTURE_3_H
-#define CGAL_TRIANGULATION_DATA_STRUCTURE_3_H
-
-#include <CGAL/basic.h>
-
-#include <utility>
-#include <map>
-#include <set>
-#include <vector>
-#include <stack>
-
-#include <boost/unordered_set.hpp>
-#include <CGAL/utility.h>
-#include <CGAL/iterator.h>
-
-#include <CGAL/Unique_hash_map.h>
-#include <CGAL/triangulation_assertions.h>
-#include <CGAL/Triangulation_utils_3.h>
-
-#include <CGAL/Concurrent_compact_container.h>
-#include <CGAL/Compact_container.h>
-
-#include <CGAL/Triangulation_ds_cell_base_3.h>
-#include <CGAL/Triangulation_ds_vertex_base_3.h>
-#include <CGAL/Triangulation_simplex_3.h>
-
-#include <CGAL/internal/Triangulation_ds_iterators_3.h>
-#include <CGAL/internal/Triangulation_ds_circulators_3.h>
-
-#ifdef CGAL_LINKED_WITH_TBB
-#  include <tbb/scalable_allocator.h>
-#endif
-
-#include <boost/foreach.hpp>
-#include <boost/type_traits/is_convertible.hpp>
-
-namespace CGAL {
-
-// TODO : noms : Vb != Vertex_base : clarifier.
-
-template < class Vb = Triangulation_ds_vertex_base_3<>,
-           class Cb = Triangulation_ds_cell_base_3<>,
-           class Concurrency_tag_ = Sequential_tag
->
-class Triangulation_data_structure_3
-  : public Triangulation_utils_3
-{
-  typedef Triangulation_data_structure_3<Vb, Cb, Concurrency_tag_> Tds;
-
-public:
-
-  typedef Concurrency_tag_            Concurrency_tag;
-
-  // Tools to change the Vertex and Cell types of the TDS.
-  template < typename Vb2 >
-  struct Rebind_vertex {
-    typedef Triangulation_data_structure_3<Vb2, Cb, Concurrency_tag> Other;
-  };
-
-  template < typename Cb2 >
-  struct Rebind_cell {
-    typedef Triangulation_data_structure_3<Vb, Cb2, Concurrency_tag> Other;
-  };
-
-  // Put this TDS inside the Vertex and Cell types.
-  typedef typename Vb::template Rebind_TDS<Tds>::Other  Vertex;
-  typedef typename Cb::template Rebind_TDS<Tds>::Other  Cell;
-
-  class Cell_data {
-    unsigned char conflict_state;
-  public:
-    Cell_data() : conflict_state(0) {}
-
-    void clear()            { conflict_state = 0; }
-    void mark_in_conflict() { conflict_state = 1; }
-    void mark_on_boundary() { conflict_state = 2; }
-    void mark_processed()   { conflict_state = 1; }
-
-    bool is_clear()       const { return conflict_state == 0; }
-    bool is_in_conflict() const { return conflict_state == 1; }
-    bool is_on_boundary() const { return conflict_state == 2; }
-    bool processed() const { return conflict_state == 1; }
-  };
-
-private:
-
-  friend class internal::Triangulation_ds_facet_iterator_3<Tds>;
-  friend class internal::Triangulation_ds_edge_iterator_3<Tds>;
-
-  friend class internal::Triangulation_ds_cell_circulator_3<Tds>;
-  friend class internal::Triangulation_ds_facet_circulator_3<Tds>;
-
-public:
-    
-  // Cells
-  // N.B.: Concurrent_compact_container requires TBB
-#ifdef CGAL_LINKED_WITH_TBB
-  typedef typename boost::mpl::if_c
-  <
-    boost::is_convertible<Concurrency_tag, Parallel_tag>::value,
-    Concurrent_compact_container<Cell, tbb::scalable_allocator<Cell> >,
-    Compact_container<Cell>
-  >::type                                                Cell_range;
-
-# else
-  typedef Compact_container<Cell>                        Cell_range;
-#endif
-
-  // Vertices
-  // N.B.: Concurrent_compact_container requires TBB
-#ifdef CGAL_LINKED_WITH_TBB
-  typedef typename boost::mpl::if_c
-  <
-    boost::is_convertible<Concurrency_tag, Parallel_tag>::value,
-    Concurrent_compact_container<Vertex, tbb::scalable_allocator<Vertex> >,
-    Compact_container<Vertex>
-  >::type                                                Vertex_range;
-
-# else
-  typedef Compact_container<Vertex>                      Vertex_range;
-#endif
-
-  
-  typedef typename Cell_range::size_type       size_type;
-  typedef typename Cell_range::difference_type difference_type;
-
-  typedef typename Cell_range::iterator        Cell_iterator;
-  typedef typename Vertex_range::iterator      Vertex_iterator;
-
-  typedef internal::Triangulation_ds_facet_iterator_3<Tds>   Facet_iterator;
-  typedef internal::Triangulation_ds_edge_iterator_3<Tds>    Edge_iterator;
-
-  typedef internal::Triangulation_ds_cell_circulator_3<Tds>  Cell_circulator;
-  typedef internal::Triangulation_ds_facet_circulator_3<Tds> Facet_circulator;
-
-//private: // In 2D only :
-  typedef internal::Triangulation_ds_face_circulator_3<Tds>  Face_circulator;
-
-  typedef Vertex_iterator                          Vertex_handle;
-  typedef Cell_iterator                            Cell_handle;
-
-  typedef std::pair<Cell_handle, int>              Facet;
-  typedef Triple<Cell_handle, int, int>            Edge;
-
-  typedef Triangulation_simplex_3<Tds>             Simplex;
-//#ifndef CGAL_TDS_USE_RECURSIVE_CREATE_STAR_3
-  //internally used for create_star_3 (faster than a tuple)
-  struct iAdjacency_info{
-    int v1;
-    Cell_handle v2;
-    int v3;
-    Cell_handle v4;
-    int v5;
-    int v6;
-    iAdjacency_info(){}
-    iAdjacency_info(int a1,Cell_handle a2,int a3,Cell_handle a4,int a5 ,int a6):
-      v1(a1),v2(a2),v3(a3),v4(a4),v5(a5),v6(a6) {}
-    void update_variables(int& a1,Cell_handle& a2,int& a3,Cell_handle& a4,int& a5 ,int& a6)
-    {
-      a1=v1;
-      a2=v2;
-      a3=v3;
-      a4=v4;
-      a5=v5;
-      a6=v6;
-    }
-  };
-//#endif  
- 
-
-public:
-  Triangulation_data_structure_3()
-    : _dimension(-2)
-  {}
-
-  Triangulation_data_structure_3(const Tds & tds)
-  {
-    copy_tds(tds);
-  }
-
-  Tds & operator= (const Tds & tds)
-  {
-    if (&tds != this) {
-      Tds tmp(tds);
-      swap(tmp);
-    }
-    return *this;
-  }
-
-  size_type number_of_vertices() const { return vertices().size(); }
-
-  int dimension() const {return _dimension;}
-
-  size_type number_of_cells() const
-    {
-      if ( dimension() < 3 ) return 0;
-      return cells().size();
-    }
-
-  size_type number_of_facets() const
-    {
-      if ( dimension() < 2 ) return 0;
-      return std::distance(facets_begin(), facets_end());
-    }
-
-  size_type number_of_edges() const
-    {
-      if ( dimension() < 1 ) return 0;
-      return std::distance(edges_begin(), edges_end());
-    }
-
-  // USEFUL CONSTANT TIME FUNCTIONS
-
-  // SETTING
-
-  void set_dimension(int n) { _dimension = n; }
-
-  Vertex_handle create_vertex(const Vertex &v)
-  {
-      return vertices().insert(v);
-  }
-
-  Vertex_handle create_vertex()
-  {
-      return vertices().emplace();
-  }
-
-  Vertex_handle create_vertex(Vertex_handle v)
-  {
-      return create_vertex(*v);
-  }
-
-  Cell_handle create_cell(const Cell &c)
-    {
-      return cells().insert(c);
-    }
-
-  Cell_handle create_cell()
-    {
-      return cells().emplace();
-    }
-
-  Cell_handle create_cell(Cell_handle c)
-    {
-      return create_cell(*c);
-    }
-
-  Cell_handle create_cell(Vertex_handle v0, Vertex_handle v1,
-                          Vertex_handle v2, Vertex_handle v3)
-    {
-      return cells().emplace(v0, v1, v2, v3);
-    }
-
-  Cell_handle create_cell(Vertex_handle v0, Vertex_handle v1,
-                          Vertex_handle v2, Vertex_handle v3,
-                          Cell_handle n0, Cell_handle n1,
-                          Cell_handle n2, Cell_handle n3)
-    {
-      return cells().emplace(v0, v1, v2, v3, n0, n1, n2, n3);
-    }
-
-  Cell_handle create_face()
-    {
-      CGAL_triangulation_precondition(dimension()<3);
-      return create_cell();
-    }
-
-  Cell_handle create_face(Vertex_handle v0, Vertex_handle v1,
-                          Vertex_handle v2)
-    {
-      CGAL_triangulation_precondition(dimension()<3);
-      return cells().emplace(v0, v1, v2, Vertex_handle());
-    }
-
-  // The following functions come from TDS_2.
-  Cell_handle create_face(Cell_handle f0, int i0,
-                          Cell_handle f1, int i1,
-                          Cell_handle f2, int i2)
-    {
-      CGAL_triangulation_precondition(dimension() <= 2);
-      Cell_handle newf = create_face(f0->vertex(cw(i0)),
-                                     f1->vertex(cw(i1)),
-                                     f2->vertex(cw(i2)));
-      set_adjacency(newf, 2, f0, i0);
-      set_adjacency(newf, 0, f1, i1);
-      set_adjacency(newf, 1, f2, i2);
-      return newf;
-    }
-
-  Cell_handle create_face(Cell_handle f0, int i0,
-                          Cell_handle f1, int i1)
-    {
-      CGAL_triangulation_precondition(dimension() <= 2);
-      Cell_handle newf = create_face(f0->vertex(cw(i0)),
-                                     f1->vertex(cw(i1)),
-                                     f1->vertex(ccw(i1)));
-      set_adjacency(newf, 2, f0, i0);
-      set_adjacency(newf, 0, f1, i1);
-      return newf;
-    }
-
-  Cell_handle create_face(Cell_handle f, int i, Vertex_handle v)
-    {
-      CGAL_triangulation_precondition(dimension() <= 2);
-      Cell_handle newf = create_face(f->vertex(cw(i)),
-                                     f->vertex(ccw(i)),
-                                     v);
-      set_adjacency(newf, 2, f, i);
-      return newf;
-    }
-
-  // not documented
-  void read_cells(std::istream& is, std::map< std::size_t, Vertex_handle > &V,
-                  std::size_t & m, std::map< std::size_t, Cell_handle > &C );
-  // not documented
-  void print_cells(std::ostream& os,
-                   const Unique_hash_map<Vertex_handle, std::size_t> &V ) const;
-
-  // ACCESS FUNCTIONS
-
-  void delete_vertex( Vertex_handle v )
-  {
-      CGAL_triangulation_expensive_precondition( is_vertex(v) );
-      vertices().erase(v);
-  }
-
-  void delete_cell( Cell_handle c )
-  {
-      CGAL_triangulation_expensive_precondition( is_simplex(c) );
-      cells().erase(c);
-  }
-
-  template <class InputIterator>
-  void delete_vertices(InputIterator begin, InputIterator end)
-  {
-      for(; begin != end; ++begin)
-          delete_vertex(*begin);
-  }
-
-  template <class InputIterator>
-  void delete_cells(InputIterator begin, InputIterator end)
-  {
-      for(; begin != end; ++begin)
-          delete_cell(*begin);
-  }
-
-  // QUERIES
-
-  bool is_simplex(Cell_handle c) const; // undocumented for now
-  bool is_vertex(Vertex_handle v) const;
-  bool is_edge(Cell_handle c, int i, int j) const;
-  bool is_edge(Vertex_handle u, Vertex_handle v, Cell_handle & c,
-               int & i, int & j) const;
-  bool is_edge(Vertex_handle u, Vertex_handle v) const;
-  bool is_facet(Cell_handle c, int i) const;
-  bool is_facet(Vertex_handle u, Vertex_handle v,
-                Vertex_handle w,
-                Cell_handle & c, int & i, int & j, int & k) const;
-  bool is_cell(Cell_handle c) const;
-  bool is_cell(Vertex_handle u, Vertex_handle v,
-               Vertex_handle w, Vertex_handle t,
-               Cell_handle & c, int & i, int & j, int & k, int & l) const;
-  bool is_cell(Vertex_handle u, Vertex_handle v,
-               Vertex_handle w, Vertex_handle t) const;
-
-  bool has_vertex(const Facet & f, Vertex_handle v, int & j) const;
-  bool has_vertex(Cell_handle c, int i,
-                  Vertex_handle v, int & j) const;
-  bool has_vertex(const Facet & f, Vertex_handle v) const;
-  bool has_vertex(Cell_handle c, int i, Vertex_handle v) const;
-
-  bool are_equal(Cell_handle c, int i,
-                 Cell_handle n, int j) const;
-  bool are_equal(const Facet & f, const Facet & g) const;
-  bool are_equal(const Facet & f, Cell_handle n, int j) const;
-
-  // MODIFY
-
-  bool flip(Cell_handle c, int i);
-  bool flip(const Facet &f)
-  { return flip( f.first, f.second); }
-
-  void flip_flippable(Cell_handle c, int i);
-  void flip_flippable(const Facet &f)
-  { flip_flippable( f.first, f.second ); }
-
-  bool flip(Cell_handle c, int i, int j);
-  bool flip(const Edge &e)
-  { return flip( e.first, e.second, e.third ); }
-
-  void flip_flippable(Cell_handle c, int i, int j);
-  void flip_flippable(const Edge &e)
-  { flip_flippable( e.first, e.second, e.third ); }
-
-private:
-  // common to flip and flip_flippable
-  void flip_really(Cell_handle c, int i, Cell_handle n, int in);
-  void flip_really(Cell_handle c, int i, int j,
-                   Cell_handle c1, Vertex_handle v1,
-                   int i1, int j1, int next1,
-                   Cell_handle c2, Vertex_handle v2,
-                   int i2, int j2, int next2,
-                   Vertex_handle v3);
-
-  #ifdef CGAL_TDS_USE_RECURSIVE_CREATE_STAR_3
-  Cell_handle create_star_3(Vertex_handle v, Cell_handle c,
-                            int li, int prev_ind2 = -1);
-  #else
-  Cell_handle recursive_create_star_3(Vertex_handle v, Cell_handle c, int li, int prev_ind2,int depth);
-  Cell_handle non_recursive_create_star_3(Vertex_handle v, Cell_handle c, int li, int prev_ind2);
-
-  Cell_handle create_star_3(Vertex_handle v, Cell_handle c,
-                            int li, int prev_ind2 = -1)
-  {
-    return recursive_create_star_3(v,c,li,prev_ind2,0);
-  }
-  #endif
-
-  Cell_handle create_star_2(Vertex_handle v,
-                            Cell_handle c, int li);
-
-public:
-
-  // Internal function : assumes the conflict cells are marked.
-  template <class CellIt>
-  Vertex_handle _insert_in_hole(CellIt cell_begin, CellIt cell_end,
-                                Cell_handle begin, int i,
-                                Vertex_handle newv)
-  {
-      CGAL_triangulation_precondition(begin != Cell_handle());
-      // if begin == NULL (default arg), we could compute one by walking in
-      // CellIt.  At the moment, the functionality is not available, you have
-      // to specify a starting facet.
-
-      Cell_handle cnew;
-      if (dimension() == 3)
-          cnew = create_star_3(newv, begin, i);
-      else
-          cnew = create_star_2(newv, begin, i);
-
-      newv->set_cell(cnew);
-      delete_cells(cell_begin, cell_end);
-      return newv;
-  }
-
-  // Internal function : assumes the conflict cells are marked.
-  template <class CellIt>
-  Vertex_handle _insert_in_hole(CellIt cell_begin, CellIt cell_end,
-                                Cell_handle begin, int i)
-  {
-      return _insert_in_hole(cell_begin, cell_end, begin, i, create_vertex());
-  }
-
-  // Mark the cells in conflict, then calls the internal function.
-  template <class CellIt>
-  Vertex_handle insert_in_hole(CellIt cell_begin, CellIt cell_end,
-                               Cell_handle begin, int i,
-                               Vertex_handle newv)
-  {
-      for (CellIt cit = cell_begin; cit != cell_end; ++cit)
-          (*cit)->tds_data().mark_in_conflict();
-
-      return _insert_in_hole(cell_begin, cell_end, begin, i, newv);
-  }
-
-  // Mark the cells in conflict, then calls the internal function.
-  template <class CellIt>
-  Vertex_handle insert_in_hole(CellIt cell_begin, CellIt cell_end,
-                               Cell_handle begin, int i)
-  {
-      return insert_in_hole(cell_begin, cell_end, begin, i, create_vertex());
-  }
-
-  //INSERTION
-  
-  // Create a finite cell with v1, v2, v3 and v4
-  // Precondition: v1, v2, v3 and v4 MUST BE positively oriented
-  Vertex_handle insert_first_finite_cell(
-    Vertex_handle &v1, Vertex_handle &v2, Vertex_handle &v3, Vertex_handle &v4,
-    Vertex_handle v_infinite = Vertex_handle());
-
-  Vertex_handle insert_in_cell(Cell_handle c);
-
-  Vertex_handle insert_in_facet(const Facet & f)
-    { return insert_in_facet(f.first, f.second); }
-
-  Vertex_handle insert_in_facet(Cell_handle c, int i);
-
-  Vertex_handle insert_in_edge(const Edge & e)
-    { return insert_in_edge(e.first, e.second, e.third); }
-
-  Vertex_handle insert_in_edge(Cell_handle c, int i, int j);
-
-  Vertex_handle insert_increase_dimension(Vertex_handle star =Vertex_handle());
-
-  // REMOVAL
-
-private:
-  Cell_handle remove_degree_4(Vertex_handle v);
-  Cell_handle remove_degree_3(Vertex_handle v);
-  Cell_handle remove_degree_2(Vertex_handle v);
-public:
-  Cell_handle remove_from_maximal_dimension_simplex(Vertex_handle v);
-  void remove_decrease_dimension(Vertex_handle v)
-  {
-      remove_decrease_dimension (v, v);
-  }
-  void remove_decrease_dimension(Vertex_handle v, Vertex_handle w);
-  void decrease_dimension(Cell_handle f, int i);
-
-  // Change orientation of the whole TDS.
-  void reorient()
-  {
-      CGAL_triangulation_precondition(dimension() >= 1);
-      for (Cell_iterator i = cells().begin();
-              i != cells().end(); ++i)
-          change_orientation(i);
-  }
-
-  // ITERATOR METHODS
-
-  Cell_iterator cells_begin() const
-  {
-    if ( dimension() < 3 )
-        return cells_end();
-    return cells().begin();
-  }
-
-  Cell_iterator cells_end() const
-  {
-    return cells().end();
-  }
-
-  Cell_iterator raw_cells_begin() const
-  {
-    return cells().begin();
-  }
-
-  Cell_iterator raw_cells_end() const
-  {
-    return cells().end();
-  }
-
-  Facet_iterator facets_begin() const
-  {
-    if ( dimension() < 2 )
-        return facets_end();
-    return Facet_iterator(this);
-  }
-
-  Facet_iterator facets_end() const
-  {
-    return Facet_iterator(this, 1);
-  }
-
-  Edge_iterator edges_begin() const
-  {
-    if ( dimension() < 1 )
-        return edges_end();
-    return Edge_iterator(this);
-  }
-
-  Edge_iterator edges_end() const
-  {
-    return Edge_iterator(this,1);
-  }
-
-  Vertex_iterator vertices_begin() const
-  {
-    return vertices().begin();
-  }
-
-  Vertex_iterator vertices_end() const
-  {
-    return vertices().end();
-  }
-
-  // CIRCULATOR METHODS
-
-  // cells around an edge
-  Cell_circulator incident_cells(const Edge & e) const
-  {
-    CGAL_triangulation_precondition( dimension() == 3 );
-    return Cell_circulator(e);
-  }
-  Cell_circulator incident_cells(Cell_handle ce, int i, int j) const
-  {
-    CGAL_triangulation_precondition( dimension() == 3 );
-    return Cell_circulator(ce, i, j);
-  }
-
-  Cell_circulator incident_cells(const Edge &e, Cell_handle start) const
-  {
-    CGAL_triangulation_precondition( dimension() == 3 );
-    return Cell_circulator(e, start);
-  }
-  Cell_circulator incident_cells(Cell_handle ce, int i, int j,
-                                 Cell_handle start) const
-  {
-    CGAL_triangulation_precondition( dimension() == 3 );
-    return Cell_circulator(ce, i, j, start);
-  }
-
-  //facets around an edge
-  Facet_circulator incident_facets(const Edge & e) const
-  {
-    CGAL_triangulation_precondition( dimension() == 3 );
-    return Facet_circulator(e);
-  }
-  Facet_circulator incident_facets(Cell_handle ce, int i, int j) const
-  {
-    CGAL_triangulation_precondition( dimension() == 3 );
-    return Facet_circulator(ce, i, j);
-  }
-  Facet_circulator incident_facets(const Edge & e, const Facet & start) const
-  {
-    CGAL_triangulation_precondition( dimension() == 3 );
-    return Facet_circulator(e, start);
-  }
-  Facet_circulator incident_facets(Cell_handle ce, int i, int j,
-                                   const Facet & start) const
-  {
-    CGAL_triangulation_precondition( dimension() == 3 );
-    return Facet_circulator(ce, i, j, start);
-  }
-  Facet_circulator incident_facets(const Edge & e,
-                                   Cell_handle start, int f) const
-  {
-    CGAL_triangulation_precondition( dimension() == 3 );
-    return Facet_circulator(e, start, f);
-  }
-  Facet_circulator incident_facets(Cell_handle ce, int i, int j,
-                                   Cell_handle start, int f) const
-  {
-    CGAL_triangulation_precondition( dimension() == 3 );
-    return Facet_circulator(ce, i, j, start, f);
-  }
-
-  // 2D : circulates on the faces adjacent to a vertex.
-  Face_circulator incident_faces(Vertex_handle v) const
-  {
-    CGAL_triangulation_precondition( dimension() == 2 );
-    return Face_circulator(v, v->cell());
-  }
-
-  // around a vertex
-private:
-
-  template <class IncidentCellIterator, class IncidentFacetIterator>
-  std::pair<IncidentCellIterator, IncidentFacetIterator>
-  incident_cells_3(Vertex_handle v, Cell_handle d,
-                                 std::pair<IncidentCellIterator,
-                                 IncidentFacetIterator> it) const
-  {
-        CGAL_triangulation_precondition(dimension() == 3);
-        
-        std::stack<Cell_handle> cell_stack;
-        cell_stack.push(d);
-        d->tds_data().mark_in_conflict();
-        *it.first++ = d;
-        
-        do {
-                Cell_handle c = cell_stack.top();
-                cell_stack.pop();
-                
-                for (int i=0; i<4; ++i) {
-                        if (c->vertex(i) == v)
-                                continue;
-                        Cell_handle next = c->neighbor(i);
-                        if (c < next)
-                                *it.second++ = Facet(c, i); // Incident facet.
-                        if (! next->tds_data().is_clear())
-                                continue;
-                        cell_stack.push(next);
-                        next->tds_data().mark_in_conflict();
-                        *it.first++ = next;
-                }
-        } while(!cell_stack.empty());
-
-        return it;
-  }
-
-  template <class IncidentFacetIterator>
-  void
-  incident_cells_3_threadsafe(Vertex_handle v, Cell_handle d,
-                              std::vector<Cell_handle> &cells,
-                              IncidentFacetIterator facet_it) const
-  {
-    boost::unordered_set<Cell_handle, Handle_hash_function> found_cells;
-
-    cells.push_back(d);
-    found_cells.insert(d);
-    int head=0;
-    int tail=1;
-    do {
-      Cell_handle c = cells[head];
-
-      for (int i=0; i<4; ++i) {
-        if (c->vertex(i) == v)
-          continue;
-        Cell_handle next = c->neighbor(i);
-        if (c < next)
-          *facet_it++ = Facet(c, i); // Incident facet
-        if (! found_cells.insert(next).second )
-          continue;
-        cells.push_back(next);
-        ++tail;
-      }
-      ++head;
-    } while(head != tail);
-  }
-  
-  void just_incident_cells_3(Vertex_handle v,
-                             std::vector<Cell_handle>& cells) const
-  {
-    CGAL_triangulation_precondition(dimension() == 3);
-
-    Cell_handle d = v->cell();
-    cells.push_back(d);
-    d->tds_data().mark_in_conflict();
-    int head=0;
-    int tail=1;
-    do {
-      Cell_handle c = cells[head];
-
-      for (int i=0; i<4; ++i) {
-        if (c->vertex(i) == v)
-          continue;
-        Cell_handle next = c->neighbor(i);
-        if (! next->tds_data().is_clear())
-          continue;
-        cells.push_back(next);
-        ++tail;
-        next->tds_data().mark_in_conflict();
-      }
-      ++head;
-    } while(head != tail);
-  }
-
-  template <class OutputIterator>
-  void
-  incident_cells_2(Vertex_handle v, Cell_handle,
-                   OutputIterator cells) const
-  {
-      CGAL_triangulation_precondition(dimension() == 2);
-
-      Face_circulator fc = incident_faces(v);
-      Face_circulator done(fc);
-      do {
-        *cells++ = fc;
-        ++fc;
-      } while (fc != done);
-  }
-
-public:
-
-  class False_filter {
-    public:
-    False_filter() {}
-    template<class T>
-    bool operator() (T) {
-      return false;
-    }
-  };
-
-        // Visitor for visit_incident_cells:
-        // outputs the facets
-  template <class OutputIterator, class Filter>
-  class Facet_extractor {
-    OutputIterator output;
-    Filter filter;
-    public:
-    Facet_extractor(Vertex_handle, OutputIterator _output, const Tds*, Filter _filter):
-    output(_output), filter(_filter){}
-    void operator() (Cell_handle) {}
-
-    OutputIterator result() {
-      return output;
-    }
-
-    class Facet_it {
-      OutputIterator& output;
-      Filter& filter;
-      public:
-      Facet_it(OutputIterator& _output, Filter& _filter): output(_output), filter(_filter) {}
-      Facet_it& operator*() {return *this;};
-      Facet_it& operator++() {return *this;};
-      Facet_it operator++(int) {return *this;};
-      template<class T>
-      Facet_it& operator=(const T& e) {
-        if(filter(e))
-          return *this;
-        *output++ = e;
-        return *this;
-      }
-      Facet_it& operator=(const Facet_it& f) {
-        output = f.output;
-        filter = f.filter;
-        return *this;
-      }
-    };
-    Facet_it facet_it() {
-      return Facet_it(output, filter);
-    }
-  };
-
-        // Visitor for visit_incident_cells:
-        // outputs the cells
-  template <class OutputIterator, class Filter>
-  class Cell_extractor {
-    OutputIterator output;
-    Filter filter;
-    public:
-    Cell_extractor(Vertex_handle, OutputIterator _output, const Tds*, Filter _filter):
-    output(_output), filter(_filter) {}
-
-    void operator()(Cell_handle c) {
-      if(filter(c))
-        return;
-      *output++ = c;
-    }
-    CGAL::Emptyset_iterator facet_it() {return CGAL::Emptyset_iterator();}
-    OutputIterator result() {
-      return output;
-    }
-  };
-
-  // Visitor for visit_incident_cells:
-  // WARNING: 2D ONLY
-  // outputs the faces obtained as degenerated cells
-  template <class OutputIterator, class Filter>
-  class DegCell_as_Facet_extractor {
-    OutputIterator output;
-    Filter filter;
-    public:
-    DegCell_as_Facet_extractor(Vertex_handle, OutputIterator _output, const Tds*, Filter _filter):
-    output(_output), filter(_filter) {}
-
-    void operator()(Cell_handle c) {
-      Facet f = Facet(c,3);
-      if(filter(f))
-        return;
-      *output++ = f;
-    }
-    CGAL::Emptyset_iterator facet_it() {return CGAL::Emptyset_iterator();}
-    OutputIterator result() {
-      return output;
-    }
-  };
-
-  template<class Treatment, class OutputIterator, class Filter, bool hasVisited>
-  class Vertex_extractor;
-
-        // Visitor for visit_incident_cells:
-        // outputs the result of Treatment applied to the vertices
-  template<class Treatment, class OutputIterator, class Filter>
-  class Vertex_extractor<Treatment,OutputIterator,Filter,false> {
-    Vertex_handle v;
-
-    boost::unordered_set<Vertex_handle, Handle_hash_function> tmp_vertices;
-
-    Treatment treat;
-    const Tds* t;
-    Filter filter;
-  public:
-    Vertex_extractor(Vertex_handle _v, OutputIterator _output, const Tds* _t, Filter _filter):
-    v(_v), treat(_output), t(_t), filter(_filter) 
-    {
-#if ( BOOST_VERSION >= 105000 )
-      tmp_vertices.reserve(64);
-#endif
-    }
-
-    void operator()(Cell_handle c) {
-      for (int j=0; j<= t->dimension(); ++j) {
-        Vertex_handle w = c->vertex(j);
-        if(filter(w))
-          continue;
-        if (w != v) {
-          if(tmp_vertices.insert(w).second) {
-            treat(c, v, j);
-          }
-
-        }
-      }
-    }
-
-
-    CGAL::Emptyset_iterator facet_it() {return CGAL::Emptyset_iterator();}
-    OutputIterator result() {
-      return treat.result();
-    }
-  };
-
-  template<class Treatment, class OutputIterator, class Filter>
-  class Vertex_extractor<Treatment,OutputIterator,Filter,true> {
-    Vertex_handle v;
-    std::vector<Vertex_handle> tmp_vertices;
-
-    Treatment treat;
-    const Tds* t;
-    Filter filter;
-  public:
-    Vertex_extractor(Vertex_handle _v, OutputIterator _output, const Tds* _t, Filter _filter):
-    v(_v), treat(_output), t(_t), filter(_filter) {
-      tmp_vertices.reserve(64);
-    }
-
-    void operator()(Cell_handle c) {
-      for (int j=0; j<= t->dimension(); ++j) {
-	Vertex_handle w = c->vertex(j);
-	if(filter(w))
-	  continue;
-	if (w != v){
-
-          if(! w->visited_for_vertex_extractor){
-            w->visited_for_vertex_extractor = true;
-            tmp_vertices.push_back(w);
-	    treat(c, v, j);
-          }
-        }
-      }
-    }
-
-    ~Vertex_extractor()
-    {
-      for(std::size_t i=0; i < tmp_vertices.size(); ++i){
-        tmp_vertices[i]->visited_for_vertex_extractor = false;
-      }
-    }
-
-
-    CGAL::Emptyset_iterator facet_it() {return CGAL::Emptyset_iterator();}
-    OutputIterator result() {
-      return treat.result();
-    }
-  };
-
-
-
-  // Treatment for Vertex_extractor:
-  // outputs the vertices
-  template<class OutputIterator>
-  class Vertex_feeder_treatment {
-    OutputIterator output;
-  public:
-    Vertex_feeder_treatment(OutputIterator _output): output(_output) {};
-    void operator()(Cell_handle c, Vertex_handle, int index) {
-      *output++ = c->vertex(index);
-    }
-    OutputIterator result() {
-      return output;
-    }
-  };
-
-  // Treatment for Vertex_extractor:
-  // outputs the edges corresponding to the vertices
-  template<class OutputIterator>
-  class Edge_feeder_treatment {
-    OutputIterator output;
-  public:
-    Edge_feeder_treatment(OutputIterator _output): output(_output) {};
-    void operator()(Cell_handle c, Vertex_handle v, int index) {
-      *output++ = Edge(c, c->index(v), index);
-    }
-    OutputIterator result() {
-      return output;
-    }
-  };
-
-  template <class Filter, class OutputIterator>
-  OutputIterator
-  incident_cells(Vertex_handle v, OutputIterator cells, Filter f = Filter()) const
-  {
-    return visit_incident_cells<Cell_extractor<OutputIterator, Filter>,
-      OutputIterator>(v, cells, f);
-  }
-
-  template <class OutputIterator>
-  OutputIterator
-  incident_cells(Vertex_handle v, OutputIterator cells) const
-  {
-    return incident_cells<False_filter>(v, cells);
-  }
-
-  // This version only works for vectors and only in 3D
-  void incident_cells_3(Vertex_handle v,
-                        std::vector<Cell_handle>& cells) const
-  {
-    just_incident_cells_3(v, cells);  
-    typename std::vector<Cell_handle>::iterator cit,end;
-    for(cit = cells.begin(), end = cells.end();
-              cit != end;
-              ++cit)
-    {
-      (*cit)->tds_data().clear();
-    }
-  }
-  
-  template <class Filter, class OutputIterator>
-  OutputIterator
-  incident_cells_threadsafe(Vertex_handle v, OutputIterator cells, Filter f = Filter()) const
-  {
-    return visit_incident_cells_threadsafe<Cell_extractor<OutputIterator, Filter>,
-      OutputIterator>(v, cells, f);
-  }
-
-  template <class OutputIterator>
-  OutputIterator
-  incident_cells_threadsafe(Vertex_handle v, OutputIterator cells) const
-  {
-    return incident_cells_threadsafe<False_filter>(v, cells);
-  }
-
-  template <class Filter, class OutputIterator>
-  OutputIterator
-  incident_facets(Vertex_handle v, OutputIterator facets, Filter f = Filter()) const
-  {
-    CGAL_triangulation_precondition( dimension() > 1 );
-    if(dimension() == 3)
-        return visit_incident_cells<Facet_extractor<OutputIterator, Filter>, OutputIterator>(v, facets, f);
-    else
-        return visit_incident_cells<DegCell_as_Facet_extractor<OutputIterator, Filter>, OutputIterator>(v, facets, f);
-  }
-
-  template <class OutputIterator>
-  OutputIterator
-  incident_facets(Vertex_handle v, OutputIterator facets) const
-  {
-    return incident_facets<False_filter>(v, facets);
-  }
-  
-  template <class Filter, class OutputIterator>
-  OutputIterator
-  incident_facets_threadsafe(Vertex_handle v, OutputIterator facets, Filter f = Filter()) const
-  {
-    CGAL_triangulation_precondition( dimension() > 1 );
-    if(dimension() == 3)
-        return visit_incident_cells_threadsafe<Facet_extractor<OutputIterator, Filter>, OutputIterator>(v, facets, f);
-    else
-        return visit_incident_cells_threadsafe<DegCell_as_Facet_extractor<OutputIterator, Filter>, OutputIterator>(v, facets, f);
-  }
-
-  template <class OutputIterator>
-  OutputIterator
-  incident_facets_threadsafe(Vertex_handle v, OutputIterator facets) const
-  {
-    return incident_facets<False_filter>(v, facets);
-  }
-
-  BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Has_member_visited,Has_visited_for_vertex_extractor,false)
-
-  template <class Filter, class OutputIterator>
-  OutputIterator
-  incident_edges(Vertex_handle v, OutputIterator edges, Filter f = Filter()) const
-  {
-    CGAL_triangulation_precondition( v != Vertex_handle() );
-    CGAL_triangulation_precondition( dimension() >= 1 );
-    CGAL_triangulation_expensive_precondition( is_vertex(v) );
-    CGAL_triangulation_expensive_precondition( is_valid() );
-
-    if (dimension() == 1) {
-      CGAL_triangulation_assertion( number_of_vertices() >= 3);
-      Cell_handle n0 = v->cell();
-      const int index_v_in_n0 = n0->index(v);
-      CGAL_assume(index_v_in_n0 <= 1);
-      Cell_handle n1 = n0->neighbor(1-index_v_in_n0);
-      const int index_v_in_n1 = n1->index(v);
-      CGAL_assume(index_v_in_n1 <= 1);
-      if(!f(n0->vertex(1-index_v_in_n0))) *edges++ = Edge(n0, n0->index(v), 1-index_v_in_n0);
-      if(!f(n1->vertex(1-index_v_in_n1))) *edges++ = Edge(n1, n1->index(v), 1-index_v_in_n1);
-      return edges;
-    }
-    return visit_incident_cells<Vertex_extractor<Edge_feeder_treatment<OutputIterator>,
-                                                 OutputIterator, Filter, Has_member_visited<Vertex>::value>,
-    OutputIterator>(v, edges, f);
-  }
-
-  template <class OutputIterator>
-  OutputIterator
-  incident_edges(Vertex_handle v, OutputIterator edges) const
-  {
-    return incident_edges<False_filter>(v, edges);
-  }
-
-  template <class Filter, class OutputIterator>
-  OutputIterator
-  adjacent_vertices(Vertex_handle v, OutputIterator vertices, Filter f = Filter()) const
-  {
-    CGAL_triangulation_precondition( v != Vertex_handle() );
-    CGAL_triangulation_precondition( dimension() >= -1 );
-    CGAL_triangulation_expensive_precondition( is_vertex(v) );
-    CGAL_triangulation_expensive_precondition( is_valid() );
-
-    if (dimension() == -1)
-    return vertices;
-
-    if (dimension() == 0) {
-      Vertex_handle v1 = v->cell()->neighbor(0)->vertex(0);
-      if(!f(v1)) *vertices++ = v1;
-      return vertices;
-    }
-
-    if (dimension() == 1) {
-      CGAL_triangulation_assertion( number_of_vertices() >= 3);
-      Cell_handle n0 = v->cell();
-      const int index_v_in_n0 = n0->index(v);
-      CGAL_assume(index_v_in_n0 <= 1);
-      Cell_handle n1 = n0->neighbor(1-index_v_in_n0);
-      const int index_v_in_n1 = n1->index(v);
-      CGAL_assume(index_v_in_n1 <= 1);
-      Vertex_handle v1 = n0->vertex(1-index_v_in_n0);
-      Vertex_handle v2 = n1->vertex(1-index_v_in_n1);
-      if(!f(v1)) *vertices++ = v1;
-      if(!f(v2)) *vertices++ = v2;
-      return vertices;
-    }
-    return visit_incident_cells<Vertex_extractor<Vertex_feeder_treatment<OutputIterator>,
-    OutputIterator, Filter, Has_member_visited<Vertex>::value>,
-    OutputIterator>(v, vertices, f);
-  }
-
-  // old name - kept for backwards compatibility but not documented
-  template <class OutputIterator>
-  OutputIterator
-  incident_vertices(Vertex_handle v, OutputIterator vertices) const
-  {
-    return adjacent_vertices<False_filter>(v, vertices);
-  }
-
-  // correct name
-  template <class OutputIterator>
-  OutputIterator
-  adjacent_vertices(Vertex_handle v, OutputIterator vertices) const
-  {
-    return adjacent_vertices<False_filter>(v, vertices);
-  }
-
-  template <class Visitor, class OutputIterator, class Filter>
-  OutputIterator
-  visit_incident_cells(Vertex_handle v, OutputIterator output, Filter f) const
-  {
-    CGAL_triangulation_precondition( v != Vertex_handle() );
-    CGAL_triangulation_expensive_precondition( is_vertex(v) );
-
-    if ( dimension() < 2 )
-    return output;
-
-    Visitor visit(v, output, this, f);
-
-    std::vector<Cell_handle> tmp_cells;
-    tmp_cells.reserve(64);
-    if ( dimension() == 3 )
-    incident_cells_3(v, v->cell(), std::make_pair(std::back_inserter(tmp_cells), visit.facet_it()));
-    else
-    incident_cells_2(v, v->cell(), std::back_inserter(tmp_cells));
-
-    typename std::vector<Cell_handle>::iterator cit;
-    for(cit = tmp_cells.begin();
-        cit != tmp_cells.end();
-        ++cit)
-    {
-      (*cit)->tds_data().clear();
-      visit(*cit);
-    } 
-
-    return visit.result();
-  }
-  
-  template <class Visitor, class OutputIterator, class Filter>
-  OutputIterator
-  visit_incident_cells_threadsafe(
-    Vertex_handle v, OutputIterator output, Filter f) const
-  {
-    CGAL_triangulation_precondition( v != Vertex_handle() );
-    CGAL_triangulation_expensive_precondition( is_vertex(v) );
-
-    if ( dimension() < 2 )
-    return output;
-
-    Visitor visit(v, output, this, f);
-
-    std::vector<Cell_handle> tmp_cells;
-    tmp_cells.reserve(64);
-    if ( dimension() == 3 )
-      incident_cells_3_threadsafe(
-        v, v->cell(), tmp_cells, visit.facet_it());
-    else
-      incident_cells_2(v, v->cell(), std::back_inserter(tmp_cells));
-
-    typename std::vector<Cell_handle>::iterator cit;
-    for(cit = tmp_cells.begin();
-        cit != tmp_cells.end();
-        ++cit)
-    {
-      visit(*cit);
-    } 
-
-    return visit.result();
-  }
-  
-  template <class Visitor, class OutputIterator, class Filter>
-  OutputIterator
-  visit_incident_cells(Vertex_handle v, OutputIterator output, 
-                       std::vector<Cell_handle> &cells, Filter f) const
-  {
-    CGAL_triangulation_precondition( v != Vertex_handle() );
-    CGAL_triangulation_expensive_precondition( is_vertex(v) );
-
-    if ( dimension() < 2 )
-    return output;
-
-    Visitor visit(v, output, this, f);
-
-    if ( dimension() == 3 )
-    incident_cells_3(v, v->cell(), std::make_pair(std::back_inserter(cells), visit.facet_it()));
-    else
-    incident_cells_2(v, v->cell(), std::back_inserter(cells));
-
-    typename std::vector<Cell_handle>::iterator cit;
-    for(cit = cells.begin();
-        cit != cells.end();
-        ++cit)
-    {
-      (*cit)->tds_data().clear();
-      visit(*cit);
-    }
-    return visit.result();
-  }
-
-  template <class Visitor, class OutputIterator, class Filter>
-  OutputIterator
-  visit_just_incident_cells(Vertex_handle v, OutputIterator output, Filter f) const
-  {
-    CGAL_triangulation_precondition( v != Vertex_handle() );
-    CGAL_triangulation_expensive_precondition( is_vertex(v) );
-
-    if ( dimension() < 2 )
-    return output;
-
-    Visitor visit(v, output, this, f);
-
-    std::vector<Cell_handle> tmp_cells;
-    tmp_cells.reserve(64);
-
-    if ( dimension() == 3 )
-      just_incident_cells_3(v, tmp_cells);
-    else
-    incident_cells_2(v, v->cell(), std::back_inserter(tmp_cells));
-
-    typename std::vector<Cell_handle>::iterator cit;
-    for(cit = tmp_cells.begin();
-        cit != tmp_cells.end();
-        ++cit)
-    {
-      (*cit)->tds_data().clear();
-      visit(*cit);
-    }
-    return visit.result();
-  }
-  
-  // For dimension 3 only
-  template <class VertexFilter, class OutputVertexIterator>
-  OutputVertexIterator
-  adjacent_vertices_and_cells_3(Vertex_handle v, OutputVertexIterator vertices,
-                                std::vector<Cell_handle> &cells,
-                                VertexFilter f = VertexFilter()) const
-  {
-    CGAL_triangulation_precondition( v != Vertex_handle() );
-    CGAL_triangulation_precondition( dimension() == 3 );
-    CGAL_triangulation_expensive_precondition( is_vertex(v) );
-    CGAL_triangulation_expensive_precondition( is_valid() );
-
-    return 
-      visit_incident_cells
-      <
-        Vertex_extractor<Vertex_feeder_treatment<OutputVertexIterator>,
-                         OutputVertexIterator, 
-                         VertexFilter, 
-                         Has_member_visited<Vertex>::value>,
-        OutputVertexIterator
-      >(v, vertices, cells, f);
-  }
-
-  // For dimension 3 only
-  template <class OutputVertexIterator>
-  OutputVertexIterator
-  adjacent_vertices_and_cells_3(Vertex_handle v, OutputVertexIterator vertices,
-                                std::vector<Cell_handle> &cells) const
-  {
-    return adjacent_vertices_and_cells_3<False_filter>(v, vertices, cells);
-  }
-
-  size_type degree(Vertex_handle v) const;
-
-  // CHECKING
-  bool is_valid(bool verbose = false, int level = 0) const;
-  bool is_valid(Vertex_handle v, bool verbose = false, int level = 0) const;
-  bool is_valid(Cell_handle c, bool verbose = false, int level = 0) const;
-
-  // Helping functions
-  template <class TDS_src>
-  Vertex_handle copy_tds(const TDS_src & tds,
-                         typename TDS_src::Vertex_handle vert);
-
-  template <class TDS_src>
-  Vertex_handle copy_tds(const TDS_src & tds)
-  {
-    return copy_tds(tds, typename TDS_src::Vertex_handle());
-  }
-    // returns the new vertex corresponding to vert in the new tds
-
-  template <class TDS_src,class ConvertVertex,class ConvertCell>
-  Vertex_handle copy_tds(const TDS_src&, typename TDS_src::Vertex_handle,const ConvertVertex&,const ConvertCell&);
-
-  
-  void swap(Tds & tds);
-
-  void clear();
-
-  void set_adjacency(Cell_handle c0, int i0,
-                     Cell_handle c1, int i1) const
-  {
-      CGAL_triangulation_assertion(i0 >= 0 && i0 <= dimension());
-      CGAL_triangulation_assertion(i1 >= 0 && i1 <= dimension());
-      CGAL_triangulation_assertion(c0 != c1);
-      c0->set_neighbor(i0,c1);
-      c1->set_neighbor(i1,c0);
-  }
-
-  int mirror_index(Cell_handle c, int i) const
-  {
-      CGAL_triangulation_precondition ( i>=0 && i<4 );
-      return c->neighbor(i)->index(c);
-  }
-
-  Vertex_handle mirror_vertex(Cell_handle c, int i) const
-  {
-      return c->neighbor(i)->vertex(mirror_index(c, i));
-  }
-
-  Facet mirror_facet(Facet f) const
-  {
-    Cell_handle neighbor_cell = f.first->neighbor(f.second);
-    const int opposite_index = neighbor_cell->index(f.first);
-    return Facet(neighbor_cell, opposite_index);
-  }
-
-  // We need the const_cast<>s because TDS is not const-correct.
-  Cell_range & cells() { return _cells; }
-  Cell_range & cells() const
-  { return const_cast<Tds*>(this)->_cells; }
-
-  Vertex_range & vertices() {return _vertices;}
-  Vertex_range & vertices() const
-  { return const_cast<Tds*>(this)->_vertices; }
-
-private:
-
-  // Change the orientation of the cell by swapping indices 0 and 1.
-  void change_orientation(Cell_handle c) const
-  {
-      Vertex_handle tmp_v = c->vertex(0);
-      c->set_vertex(0, c->vertex(1));
-      c->set_vertex(1, tmp_v);
-      Cell_handle tmp_c = c->neighbor(0);
-      c->set_neighbor(0, c->neighbor(1));
-      c->set_neighbor(1, tmp_c);
-  }
-
-  // in dimension i, number of vertices >= i+2
-  // ( the boundary of a simplex in dimension i+1 has i+2 vertices )
-  int _dimension;
-
-  Cell_range   _cells;
-  Vertex_range _vertices;
-
-  // used by is-valid :
-  bool count_vertices(size_type &i, bool verbose = false, int level = 0) const;
-  // counts AND checks the validity
-  bool count_facets(size_type &i, bool verbose = false, int level = 0) const;
-  // counts but does not check
-  bool count_edges(size_type &i, bool verbose = false, int level = 0) const;
-  // counts but does not check
-  bool count_cells(size_type &i, bool verbose = false, int level = 0) const;
-  // counts AND checks the validity
-};
-
-#ifdef CGAL_TDS_USE_RECURSIVE_CREATE_STAR_3
-template <class Vb, class Cb, class Ct>
-typename Triangulation_data_structure_3<Vb,Cb,Ct>::Cell_handle
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-create_star_3(Vertex_handle v, Cell_handle c, int li, int prev_ind2)
-{
-    CGAL_triangulation_precondition( dimension() == 3);
-    CGAL_triangulation_precondition( c->tds_data().is_in_conflict() );
-    CGAL_triangulation_precondition( ! c->neighbor(li)->tds_data().is_in_conflict() );
-
-    Cell_handle cnew = create_cell(c->vertex(0),
-                                   c->vertex(1),
-                                   c->vertex(2),
-                                   c->vertex(3));
-    cnew->set_vertex(li, v);
-    Cell_handle c_li = c->neighbor(li);
-    set_adjacency(cnew, li, c_li, c_li->index(c));
-
-    // Look for the other neighbors of cnew.
-    for (int ii=0; ii<4; ++ii) {
-      if (ii == prev_ind2 || cnew->neighbor(ii) != Cell_handle())
-          continue;
-      cnew->vertex(ii)->set_cell(cnew);
-
-      // Indices of the vertices of cnew such that ii,vj1,vj2,li positive.
-      Vertex_handle vj1 = c->vertex(next_around_edge(ii, li));
-      Vertex_handle vj2 = c->vertex(next_around_edge(li, ii));
-      Cell_handle cur = c;
-      int zz = ii;
-      Cell_handle n = cur->neighbor(zz);
-      // turn around the oriented edge vj1 vj2
-      while ( n->tds_data().is_in_conflict() ) {
-        CGAL_triangulation_assertion( n != c );
-        cur = n;
-        zz = next_around_edge(n->index(vj1), n->index(vj2));
-        n = cur->neighbor(zz);
-      }
-      // Now n is outside region, cur is inside.
-      n->tds_data().clear(); // Reset the flag for boundary cells.
-
-      int jj1 = n->index(vj1);
-      int jj2 = n->index(vj2);
-      Vertex_handle vvv = n->vertex(next_around_edge(jj1, jj2));
-      Cell_handle nnn = n->neighbor(next_around_edge(jj2, jj1));
-      int zzz = nnn->index(vvv);
-      if (nnn == cur) {
-        // Neighbor relation is reciprocal, ie
-        // the cell we are looking for is not yet created.
-        nnn = create_star_3(v, nnn, zz, zzz);
-      }
-
-      set_adjacency(nnn, zzz, cnew, ii);
-    }
-
-    return cnew;
-}
-#else
-template <class Vb, class Cb, class Ct>
-typename Triangulation_data_structure_3<Vb,Cb,Ct>::Cell_handle
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-recursive_create_star_3(Vertex_handle v, Cell_handle c, int li,
-                        int prev_ind2, int depth)
-{
-    if ( depth == 100 ) return non_recursive_create_star_3(v,c,li,prev_ind2);
-    CGAL_triangulation_precondition( dimension() == 3);
-    CGAL_triangulation_precondition( c->tds_data().is_in_conflict() );
-    CGAL_triangulation_precondition( ! c->neighbor(li)->tds_data().is_in_conflict() );
-
-    Cell_handle cnew = create_cell(c->vertex(0),
-                                   c->vertex(1),
-                                   c->vertex(2),
-                                   c->vertex(3));
-    cnew->set_vertex(li, v);
-    Cell_handle c_li = c->neighbor(li);
-    set_adjacency(cnew, li, c_li, c_li->index(c));
-
-    // Look for the other neighbors of cnew.
-    for (int ii=0; ii<4; ++ii) {
-      if (ii == prev_ind2 || cnew->neighbor(ii) != Cell_handle())
-          continue;
-      cnew->vertex(ii)->set_cell(cnew);
-
-      // Indices of the vertices of cnew such that ii,vj1,vj2,li positive.
-      Vertex_handle vj1 = c->vertex(next_around_edge(ii, li));
-      Vertex_handle vj2 = c->vertex(next_around_edge(li, ii));
-      Cell_handle cur = c;
-      int zz = ii;
-      Cell_handle n = cur->neighbor(zz);
-      // turn around the oriented edge vj1 vj2
-      while ( n->tds_data().is_in_conflict() ) {
-        CGAL_triangulation_assertion( n != c );
-        cur = n;
-        zz = next_around_edge(n->index(vj1), n->index(vj2));
-        n = cur->neighbor(zz);
-      }
-      // Now n is outside region, cur is inside.
-      n->tds_data().clear(); // Reset the flag for boundary cells.
-
-      int jj1 = n->index(vj1);
-      int jj2 = n->index(vj2);
-      Vertex_handle vvv = n->vertex(next_around_edge(jj1, jj2));
-      Cell_handle nnn = n->neighbor(next_around_edge(jj2, jj1));
-      int zzz = nnn->index(vvv);
-      if (nnn == cur) {
-        // Neighbor relation is reciprocal, ie
-        // the cell we are looking for is not yet created.
-        nnn = recursive_create_star_3(v, nnn, zz, zzz,depth+1);
-      }
-
-      set_adjacency(nnn, zzz, cnew, ii);
-    }
-
-    return cnew;
-}
-
-//We use the class iAdjacency_info instead of a tuple because
-//at the moment we made the change it was faster like this.
-template <class Vb, class Cb, class Ct>
-typename Triangulation_data_structure_3<Vb,Cb,Ct>::Cell_handle
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-non_recursive_create_star_3(Vertex_handle v, Cell_handle c, int li, int prev_ind2)
-{
-    CGAL_triangulation_precondition( dimension() == 3);
-    CGAL_triangulation_precondition( c->tds_data().is_in_conflict() );
-    CGAL_triangulation_precondition( ! c->neighbor(li)->tds_data().is_in_conflict() );
-
-    Cell_handle cnew = create_cell(c->vertex(0),
-                                   c->vertex(1),
-                                   c->vertex(2),
-                                   c->vertex(3));
-    cnew->set_vertex(li, v);
-    Cell_handle c_li = c->neighbor(li);
-    set_adjacency(cnew, li, c_li, c_li->index(c));
-    
-    std::stack<iAdjacency_info> adjacency_info_stack;
-  
-    int ii=0;
-    do
-    {
-      // Look for the other neighbors of cnew.
-      if ( ! (ii == prev_ind2 || cnew->neighbor(ii) != Cell_handle()) ){
-        cnew->vertex(ii)->set_cell(cnew);
-
-        // Indices of the vertices of cnew such that ii,vj1,vj2,li positive.
-        Vertex_handle vj1 = c->vertex(next_around_edge(ii, li));
-        Vertex_handle vj2 = c->vertex(next_around_edge(li, ii));
-        Cell_handle cur = c;
-        int zz = ii;
-        Cell_handle n = cur->neighbor(zz);
-        // turn around the oriented edge vj1 vj2
-        while ( n->tds_data().is_in_conflict() ) {
-          CGAL_triangulation_assertion( n != c );
-          cur = n;
-          zz = next_around_edge(n->index(vj1), n->index(vj2));
-          n = cur->neighbor(zz);
-        }
-        // Now n is outside region, cur is inside.
-        n->tds_data().clear(); // Reset the flag for boundary cells.
-
-        int jj1 = n->index(vj1);
-        int jj2 = n->index(vj2);
-        Vertex_handle vvv = n->vertex(next_around_edge(jj1, jj2));
-        Cell_handle nnn = n->neighbor(next_around_edge(jj2, jj1));
-        int zzz = nnn->index(vvv);
-        if (nnn == cur) {
-          // Neighbor relation is reciprocal, ie
-          // the cell we are looking for is not yet created.
-          //re-run the loop
-          adjacency_info_stack.push( iAdjacency_info(zzz,cnew,ii,c,li,prev_ind2) );
-          c=nnn;  li=zz; prev_ind2=zzz; ii=0;
-          //copy-pasted from beginning to avoid if ii==0
-          CGAL_triangulation_precondition( c->tds_data().is_in_conflict() );
-          CGAL_triangulation_precondition( ! c->neighbor(li)->tds_data().is_in_conflict() );
-          cnew = create_cell(c->vertex(0),c->vertex(1),c->vertex(2),c->vertex(3));
-          cnew->set_vertex(li, v);
-          c_li = c->neighbor(li);
-          set_adjacency(cnew, li, c_li, c_li->index(c));          
-          continue;
-        }
-        set_adjacency(nnn, zzz, cnew, ii);
-      }
-      while (++ii==4){
-        if ( adjacency_info_stack.empty() ) return cnew;
-        Cell_handle nnn=cnew; 
-        int zzz;
-        adjacency_info_stack.top().update_variables(zzz,cnew,ii,c,li,prev_ind2);
-        adjacency_info_stack.pop();
-        set_adjacency(nnn, zzz, cnew, ii);
-      }
-    }
-    while (true);
-}
-#endif
-
-template <class Vb, class Cb, class Ct>
-typename Triangulation_data_structure_3<Vb,Cb,Ct>::Cell_handle
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-create_star_2(Vertex_handle v, Cell_handle c, int li )
-{
-  CGAL_triangulation_assertion( dimension() == 2 );
-  Cell_handle cnew;
-
-  // i1 i2 such that v,i1,i2 positive
-  int i1=ccw(li);
-  // traversal of the boundary of region in ccw order to create all
-  // the new facets
-  Cell_handle bound = c;
-  Vertex_handle v1 = c->vertex(i1);
-  int ind = c->neighbor(li)->index(c); // to be able to find the
-                                       // first cell that will be created
-  Cell_handle cur;
-  Cell_handle pnew = Cell_handle();
-  do {
-    cur = bound;
-    // turn around v2 until we reach the boundary of region
-    while ( cur->neighbor(cw(i1))->tds_data().is_in_conflict() ) {
-      // neighbor in conflict
-      cur = cur->neighbor(cw(i1));
-      i1 = cur->index( v1 );
-    }
-    cur->neighbor(cw(i1))->tds_data().clear();
-    // here cur has an edge on the boundary of region
-    cnew = create_face( v, v1, cur->vertex( ccw(i1) ) );
-    set_adjacency(cnew, 0, cur->neighbor(cw(i1)),
-                           cur->neighbor(cw(i1))->index(cur));
-    cnew->set_neighbor(1, Cell_handle());
-    cnew->set_neighbor(2, pnew);
-    // pnew is null at the first iteration
-    v1->set_cell(cnew);
-    //pnew->set_neighbor( cw(pnew->index(v1)), cnew );
-    if (pnew != Cell_handle()) { pnew->set_neighbor( 1, cnew );}
-
-    bound = cur;
-    i1 = ccw(i1);
-    v1 = bound->vertex(i1);
-    pnew = cnew;
-    //} while ( ( bound != c ) || ( li != cw(i1) ) );
-  } while ( v1 != c->vertex(ccw(li)) );
-  // missing neighbors between the first and the last created cells
-  cur = c->neighbor(li)->neighbor(ind); // first created cell
-  set_adjacency(cnew, 1, cur, 2);
-  return cnew;
-}
-
-template <class Vb, class Cb, class Ct>
-std::istream&
-operator>>(std::istream& is, Triangulation_data_structure_3<Vb,Cb,Ct>& tds)
-  // reads :
-  // the dimension
-  // the number of vertices
-  // the number of cells
-  // the cells by the indices of their vertices
-  // the neighbors of each cell by their index in the preceding list of cells
-  // when dimension < 3 : the same with faces of maximal dimension
-{
-  typedef Triangulation_data_structure_3<Vb,Cb,Ct> Tds;
-  typedef typename Tds::Vertex_handle  Vertex_handle;
-  typedef typename Tds::Cell_handle    Cell_handle;
-
-  tds.clear();
-
-  std::size_t n;
-  int d;
-  if(is_ascii(is))
-     is >> d >> n;
-  else {
-    read(is, n);
-    read(is,d);
-  }
-  tds.set_dimension(d);
-
-  if(n == 0)
-    return is;
-
-  std::map<std::size_t , Vertex_handle > V;
-
-  // creation of the vertices
-  for (std::size_t i=0; i < n; i++) {
-    //    is >> p;
-    //    V[i] = tds.create_vertex();
-    //    V[i]->set_point(p);
-    V[i] = tds.create_vertex();
-  }
-
-  std::map< std::size_t, Cell_handle > C;
-  std::size_t m;
-
-  tds.read_cells(is, V, m, C);
-  CGAL_triangulation_assertion( tds.is_valid() );
-  return is;
-}
-
-template <class Vb, class Cb, class Ct>
-std::ostream&
-operator<<(std::ostream& os, const Triangulation_data_structure_3<Vb,Cb,Ct> &tds)
-  // writes :
-  // the dimension
-  // the number of vertices
-  // the number of cells
-  // the cells by the indices of their vertices
-  // the neighbors of each cell by their index in the preceding list of cells
-  // when dimension < 3 : the same with faces of maximal dimension
-{
-  typedef Triangulation_data_structure_3<Vb,Cb,Ct> Tds;
-  typedef typename Tds::size_type               size_type;
-  typedef typename Tds::Vertex_handle           Vertex_handle;
-  typedef typename Tds::Vertex_iterator         Vertex_iterator;
-
-
-  Unique_hash_map<Vertex_handle, size_type> V;
-
-  // outputs dimension and number of vertices
-  size_type n = tds.number_of_vertices();
-
-  if (is_ascii(os))
-      os << tds.dimension() << std::endl << n << std::endl;
-  else
-  {
-    write(os,tds.dimension());
-    write(os,n);
-  }
-
-  if (n == 0)
-    return os;
-
-  // index the vertices
-  size_type i = 0;
-  for (Vertex_iterator it=tds.vertices_begin(); it != tds.vertices_end(); ++it)
-    V[it] = i++;
-
-  CGAL_triangulation_assertion( i == n );
-
-  tds.print_cells(os, V);
-
-  return os;
-}
-
-template <class Vb, class Cb, class Ct>
-bool
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-is_simplex( Cell_handle c ) const
-{
-  switch(dimension()) {
-    case 3 : return is_cell(c);
-    case 2 : return is_facet(c, 3);
-    case 1 : return is_edge(c, 0, 1);
-    case 0 : return is_vertex(c->vertex(0));
-    case -1 : return c == cells().begin();
-  }
-  return false;
-}
-
-template <class Vb, class Cb, class Ct>
-bool
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-is_vertex(Vertex_handle v) const
-{
-    return vertices().owns_dereferencable(v);
-}
-
-template <class Vb, class Cb, class Ct>
-bool
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-is_edge(Vertex_handle u, Vertex_handle v,
-        Cell_handle &c, int &i, int &j) const
-  // returns false when dimension <1 or when indices wrong
-{
-    CGAL_triangulation_expensive_precondition( is_vertex(u) && is_vertex(v) );
-
-    if (u==v)
-        return false;
-
-    std::vector<Cell_handle> cells;
-    cells.reserve(64);
-    incident_cells(u, std::back_inserter(cells));
-
-    for (typename std::vector<Cell_handle>::iterator cit = cells.begin();
-              cit != cells.end(); ++cit)
-        if ((*cit)->has_vertex(v, j)) {
-            c = *cit;
-            i = c->index(u);
-            return true;
-        }
-    return false;
-}
-
-template <class Vb, class Cb, class Ct>
-bool
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-is_edge(Vertex_handle u, Vertex_handle v) const
-{
-    Cell_handle c;
-    int i, j;
-    return is_edge(u, v, c, i, j);
-}
-
-template <class Vb, class Cb, class Ct>
-bool
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-is_edge(Cell_handle c, int i, int j) const
-{
-  if (dimension() < 1)
-    return false;
-
-  if ( i==j ) return false;
-  if ( (i<0) || (j<0) ) return false;
-  if ( (dimension() == 1) && ((i>1) || (j>1)) ) return false;
-  if ( (dimension() == 2) && ((i>2) || (j>2)) ) return false;
-  if ((i>3) || (j>3)) return false;
-
-  return cells().owns_dereferencable(c);
-}
-
-template <class Vb, class Cb, class Ct>
-bool
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-is_facet(Vertex_handle u, Vertex_handle v,
-         Vertex_handle w,
-         Cell_handle & c, int & i, int & j, int & k) const
-  // returns false when dimension <2 or when indices wrong
-{
-    CGAL_triangulation_expensive_precondition( is_vertex(u) &&
-                                               is_vertex(v) &&
-                                               is_vertex(w) );
-
-    if ( u==v || u==w || v==w )
-        return false;
-    if (dimension() < 2)
-        return false;
-
-    std::vector<Cell_handle> cells;
-    cells.reserve(64);
-    incident_cells(u, std::back_inserter(cells));
-
-    for (typename std::vector<Cell_handle>::iterator cit = cells.begin();
-              cit != cells.end(); ++cit)
-        if ((*cit)->has_vertex(v, j) && (*cit)->has_vertex(w, k)) {
-            c = *cit;
-            i = c->index(u);
-            return true;
-        }
-    return false;
-}
-
-template <class Vb, class Cb, class Ct>
-bool
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-is_facet(Cell_handle c, int i) const
-{
-    CGAL_triangulation_precondition(i>=0 && i<4);
-
-    if ( dimension() < 2 )
-        return false;
-
-    if ( (dimension() == 2) && (i!=3) )
-        return false;
-
-    return cells().owns_dereferencable(c);
-}
-
-template <class Vb, class Cb, class Ct>
-bool
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-is_cell( Cell_handle c ) const
-  // returns false when dimension <3
-{
-    if (dimension() < 3)
-        return false;
-
-    return cells().owns_dereferencable(c);
-}
-
-template <class Vb, class Cb, class Ct>
-bool
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-is_cell(Vertex_handle u, Vertex_handle v,
-        Vertex_handle w, Vertex_handle t,
-        Cell_handle & c, int & i, int & j, int & k, int & l) const
-  // returns false when dimension <3
-{
-    CGAL_triangulation_expensive_precondition( is_vertex(u) &&
-                                               is_vertex(v) &&
-                                               is_vertex(w) &&
-                                               is_vertex(t) );
-
-    if ( u==v || u==w || u==t || v==w || v==t || w==t )
-        return false;
-
-    std::vector<Cell_handle> cells;
-    cells.reserve(64);
-    incident_cells(u, std::back_inserter(cells));
-
-    for (typename std::vector<Cell_handle>::iterator cit = cells.begin();
-              cit != cells.end(); ++cit)
-        if ((*cit)->has_vertex(v, j) && (*cit)->has_vertex(w, k) &&
-            (*cit)->has_vertex(t, l)) {
-            c = *cit;
-            i = c->index(u);
-            return true;
-        }
-    return false;
-}
-
-template <class Vb, class Cb, class Ct>
-bool
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-is_cell(Vertex_handle u, Vertex_handle v,
-        Vertex_handle w, Vertex_handle t)
-    const
-  // returns false when dimension <3
-{
-    Cell_handle c;
-    int i, j, k, l;
-    return is_cell(u, v, w, t, c, i, j, k, l);
-}
-
-template <class Vb, class Cb, class Ct>
-inline
-bool
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-has_vertex(Cell_handle c, int i, Vertex_handle v, int & j) const
-  // computes the index j of the vertex in the cell c giving the query
-  // facet (c,i)
-  // j has no meaning if false is returned
-{
-  CGAL_triangulation_precondition( dimension() == 3 );
-  return ( c->has_vertex(v,j) && (j != i) );
-}
-
-template <class Vb, class Cb, class Ct>
-inline
-bool
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-has_vertex(Cell_handle c, int i, Vertex_handle v) const
-  // checks whether the query facet (c,i) has vertex v
-{
-  CGAL_triangulation_precondition( dimension() == 3 );
-  int j;
-  return ( c->has_vertex(v,j) && (j != i) );
-}
-
-template <class Vb, class Cb, class Ct>
-inline
-bool
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-has_vertex(const Facet & f, Vertex_handle v, int & j) const
-{
-  return has_vertex(f.first, f.second, v, j);
-}
-
-template <class Vb, class Cb, class Ct>
-inline
-bool
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-has_vertex(const Facet & f, Vertex_handle v) const
-{
-  return has_vertex(f.first, f.second, v);
-}
-
-template <class Vb, class Cb, class Ct>
-bool
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-are_equal(Cell_handle c, int i, Cell_handle n, int j) const
-  // tests whether facets c,i and n,j, have the same 3 vertices
-  // the triangulation is supposed to be valid, the orientation of the
-  // facets is not checked here
-  // the neighbor relations between c and  n are not tested either,
-  // which allows to use this method before setting these relations
-  // (see remove in Delaunay_3)
-  //   if ( c->neighbor(i) != n ) return false;
-  //   if ( n->neighbor(j) != c ) return false;
-{
-  CGAL_triangulation_precondition( dimension() == 3 );
-
-  if ( (c==n) && (i==j) ) return true;
-
-  int j1,j2,j3;
-  return( n->has_vertex( c->vertex((i+1)&3), j1 ) &&
-          n->has_vertex( c->vertex((i+2)&3), j2 ) &&
-          n->has_vertex( c->vertex((i+3)&3), j3 ) &&
-          ( j1+j2+j3+j == 6 ) );
-}
-
-template <class Vb, class Cb, class Ct>
-bool
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-are_equal(const Facet & f, const Facet & g) const
-{
-  return are_equal(f.first, f.second, g.first, g.second);
-}
-
-template <class Vb, class Cb, class Ct>
-bool
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-are_equal(const Facet & f, Cell_handle n, int j) const
-{
-  return are_equal(f.first, f.second, n, j);
-}
-
-template <class Vb, class Cb, class Ct>
-bool
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-flip( Cell_handle c, int i )
-  // returns false if the facet is not flippable
-  // true other wise and
-  // flips facet i of cell c
-  // c will be replaced by one of the new cells
-{
-  CGAL_triangulation_precondition( (dimension() == 3) && (0<=i) && (i<4)
-                                   && (number_of_vertices() >= 6) );
-  CGAL_triangulation_expensive_precondition( is_cell(c) );
-
-  Cell_handle n = c->neighbor(i);
-  int in = n->index(c);
-
-  // checks that the facet is flippable,
-  // ie the future edge does not already exist
-  if (is_edge(c->vertex(i), n->vertex(in)))
-      return false;
-
-  flip_really(c,i,n,in);
-  return true;
-}
-
-template <class Vb, class Cb, class Ct>
-void
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-flip_flippable(Cell_handle c, int i )
-  // flips facet i of cell c
-  // c will be replaced by one of the new cells
-{
-  CGAL_triangulation_precondition( (dimension() == 3) && (0<=i) && (i<4)
-                                   && (number_of_vertices() >= 6) );
-  CGAL_triangulation_expensive_precondition( is_cell(c) );
-
-  Cell_handle n = c->neighbor(i);
-  int in = n->index(c);
-
-  // checks that the facet is flippable,
-  // ie the future edge does not already exist
-  CGAL_triangulation_expensive_precondition( !is_edge(c->vertex(i),
-                                                      n->vertex(in)));
-  flip_really(c,i,n,in);
-}
-
-template <class Vb, class Cb, class Ct>
-inline
-void
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-flip_really( Cell_handle c, int i, Cell_handle n, int in )
-  // private - used by flip and flip_flippable
-{
-  int i1 = (i+1)&3;
-  int i2 = (i+2)&3;
-  int i3 = (i+3)&3;
-
-  int in1 = n->index(c->vertex(i1));
-  int in2 = n->index(c->vertex(i2));
-  int in3 = n->index(c->vertex(i3));
-
-  set_adjacency(c, i, n->neighbor(in3), n->neighbor(in3)->index(n));
-  c->set_vertex( i3, n->vertex(in) );
-
-  set_adjacency(n, in, c->neighbor(i1), c->neighbor(i1)->index(c));
-  n->set_vertex( in1, c->vertex(i) );
-
-  Cell_handle cnew = create_cell(c->vertex(i), c->vertex(i1),
-                                 n->vertex(in), n->vertex(in3));
-
-  set_adjacency(cnew, 0, n->neighbor(in2), n->neighbor(in2)->index(n));
-  set_adjacency(cnew, 1, n, in2);
-  set_adjacency(cnew, 2, c->neighbor(i2), c->neighbor(i2)->index(c));
-  set_adjacency(cnew, 3, c, i2);
-  set_adjacency(c, i1, n, in3);
-
-  if ((i&1) != 0)
-      change_orientation(cnew);
-
-  c->vertex(i1)->set_cell(cnew);
-  c->vertex(i2)->set_cell(c);
-  n->vertex(in3)->set_cell(n);
-  // to be implemented : 2d case
-  // CGAL_triangulation_precondition( (0<=i) && (i<3) );
-}
-
-template <class Vb, class Cb, class Ct>
-bool
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-flip( Cell_handle c, int i, int j )
-  // returns false if the edge is not flippable
-  // true otherwise and
-  // flips edge i,j of cell c
-  // c will be deleted
-{
-  CGAL_triangulation_precondition( (dimension() == 3)
-                                   && (0<=i) && (i<4)
-                                   && (0<=j) && (j<4)
-                                   && ( i != j )
-                                   && (number_of_vertices() >= 6) );
-  CGAL_triangulation_expensive_precondition( is_cell(c) );
-
-  // checks that the edge is flippable ie degree 3
-  int degree = 0;
-  Cell_circulator ccir = incident_cells(c,i,j);
-  Cell_circulator cdone = ccir;
-  do {
-    ++degree;
-    ++ccir;
-  } while ( ccir != cdone );
-
-  if ( degree != 3 ) return false;
-
-  int next = next_around_edge(i,j);
-  Cell_handle c1 = c->neighbor( next );
-  Vertex_handle v1 = c->vertex( next ); // will become vertex of c1
-  int i1 = c1->index( c->vertex(i) );
-  int j1 = c1->index( c->vertex(j) );
-
-  int next1 = next_around_edge(i1,j1);
-  Cell_handle c2  = c1->neighbor( next1 );
-  Vertex_handle v2 = c1->vertex( next1 ); // will become vertex of c2
-  int i2 = c2->index( c->vertex(i) );
-  int j2 = c2->index( c->vertex(j) );
-
-  int next2 = next_around_edge(i2,j2);
-  Vertex_handle v3 = c2->vertex( next2 );
-
-  // checks that the edge is flippable,
-  // is the future cells do not already exist
-  if ( is_cell(v1,v2,v3,c->vertex(i)) ) return false;
-  if ( is_cell(v1,v2,v3,c->vertex(j)) ) return false;
-
-  flip_really(c,i,j,c1,v1,i1,j1,next1,c2,v2,i2,j2,next2,v3);
-
-  return true;
-}
-
-template <class Vb, class Cb, class Ct>
-void
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-flip_flippable( Cell_handle c, int i, int j )
-  // flips edge i,j of cell c
-  // c will be deleted
-{
-  CGAL_triangulation_precondition( (dimension() == 3)
-                                   && (0<=i) && (i<4)
-                                   && (0<=j) && (j<4)
-                                   && ( i != j )
-                                   && (number_of_vertices() >= 6) );
-  CGAL_triangulation_expensive_precondition( is_cell(c) );
-
-  // checks that the edge is flippable ie degree 3
-  CGAL_triangulation_precondition_code( int degree = 0; );
-  CGAL_triangulation_precondition_code
-    ( Cell_circulator ccir = incident_cells(c,i,j); );
-  CGAL_triangulation_precondition_code( Cell_circulator cdone = ccir; );
-  CGAL_triangulation_precondition_code( do {
-                                          ++degree;
-                                          ++ccir;
-                                        } while ( ccir != cdone ); );
-
-  CGAL_triangulation_precondition( degree == 3 );
-
-  int next = next_around_edge(i,j);
-  Cell_handle c1 = c->neighbor( next );
-  Vertex_handle v1 = c->vertex( next ); // will become vertex of c1
-  int i1 = c1->index( c->vertex(i) );
-  int j1 = c1->index( c->vertex(j) );
-
-  int next1 = next_around_edge(i1,j1);
-  Cell_handle c2  = c1->neighbor( next1 );
-  Vertex_handle v2 = c1->vertex( next1 ); // will become vertex of c2
-  int i2 = c2->index( c->vertex(i) );
-  int j2 = c2->index( c->vertex(j) );
-
-  int next2 = next_around_edge(i2,j2);
-  Vertex_handle v3 = c2->vertex( next2 );
-
-  // checks that the edge is flippable,
-  // is the future cells do not already exist
-  CGAL_triangulation_expensive_precondition( !is_cell(v1,v2,v3,c->vertex(i)) );
-  CGAL_triangulation_expensive_precondition( !is_cell(v1,v2,v3,c->vertex(j)) );
-
-  flip_really(c,i,j,c1,v1,i1,j1,next1,c2,v2,i2,j2,next2,v3);
-}
-
-template <class Vb, class Cb, class Ct>
-inline
-void
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-flip_really( Cell_handle c, int i, int j,
-             Cell_handle c1, Vertex_handle v1,
-             int i1, int j1, int next1,
-             Cell_handle c2, Vertex_handle v2,
-             int i2, int j2, int next2,
-             Vertex_handle v3 )
-{
-  c->vertex(i)->set_cell(c1);
-  c->vertex(j)->set_cell(c2);
-
-  c1->set_vertex( j1, v1 );
-  v1->set_cell(c1);
-  c2->set_vertex( i2, v2 );
-  v2->set_cell(c2);
-
-  set_adjacency(c1, next1,c2->neighbor(j2), c2->neighbor(j2)->index(c2));
-  set_adjacency(c2,c2->index(v1),c1->neighbor(i1),c1->neighbor(i1)->index(c1));
-
-  set_adjacency(c1, i1, c2, j2);
-
-  set_adjacency(c1, 6-i1-j1-next1, c->neighbor(j), c->neighbor(j)->index(c));
-  set_adjacency(c2, next2, c->neighbor(i), c->neighbor(i)->index(c));
-
-  v3->set_cell( c2 );
-
-  delete_cell( c );
-}
-
-template <class Vb, class Cb, class Ct>
-void
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-read_cells(std::istream& is, std::map< std::size_t, Vertex_handle > &V,
-           std::size_t & m, std::map< std::size_t, Cell_handle > &C)
-{
-  // creation of the cells and neighbors
-  switch (dimension()) {
-  case 3:
-  case 2:
-  case 1:
-    {
-      if(is_ascii(is))
-        is >> m;
-      else
-        read(is, m);
-
-      for(std::size_t i = 0; i < m; i++) {
-        Cell_handle c = create_cell();
-        for (int k=0; k<=dimension(); ++k) {
-          std::size_t ik;
-            if(is_ascii(is))
-               is >> ik;
-            else
-              read(is, ik);
-            c->set_vertex(k, V[ik]);
-            V[ik]->set_cell(c);
-        }
-        C[i] = c;
-      }
-      for(std::size_t j = 0; j < m; j++) {
-        Cell_handle c = C[j];
-        for (int k=0; k<=dimension(); ++k) {
-          std::size_t ik;
-            if(is_ascii(is))
-              is >> ik;
-            else
-              read(is, ik);
-            c->set_neighbor(k, C[ik]);
-        }
-      }
-      break;
-    }
-  case 0:
-    {
-      m = 2;
-
-      //      CGAL_triangulation_assertion( n == 2 );
-      for (int i=0; i < 2; i++) {
-        Cell_handle c = create_face(V[i], Vertex_handle(), Vertex_handle());
-        C[i] = c;
-        V[i]->set_cell(c);
-      }
-      for (int j=0; j < 2; j++) {
-        Cell_handle c = C[j];
-        c->set_neighbor(0, C[1-j]);
-      }
-      break;
-    }
-  case -1:
-    {
-      m = 1;
-      //      CGAL_triangulation_assertion( n == 1 );
-      Cell_handle c = create_face(V[0], Vertex_handle(), Vertex_handle());
-      C[0] = c;
-      V[0]->set_cell(c);
-      break;
-    }
-  }
-}
-
-template <class Vb, class Cb, class Ct>
-void
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-print_cells(std::ostream& os, const Unique_hash_map<Vertex_handle, std::size_t> &V ) const
-{
-  std::map<Cell_handle, std::size_t > C;
-  std::size_t i = 0;
-
-  switch ( dimension() ) {
-  case 3:
-    {
-      std::size_t m = number_of_cells();
-      if(is_ascii(os))
-        os << m << std::endl;
-      else
-        write(os, m);
-
-      // write the cells
-      Cell_iterator it;
-      for(it = cells_begin(); it != cells_end(); ++it) {
-        C[it] = i++;
-        for(int j = 0; j < 4; j++){
-          if(is_ascii(os)) {
-            os << V[it->vertex(j)];
-            if ( j==3 )
-              os << std::endl;
-            else
-              os << ' ';
-          }
-          else
-            write(os, V[it->vertex(j)]);
-        }
-      }
-      CGAL_triangulation_assertion( i == m );
-
-      // write the neighbors
-      for(it = cells_begin(); it != cells_end(); ++it) {
-        for (int j = 0; j < 4; j++) {
-          if(is_ascii(os)){
-            os << C[it->neighbor(j)];
-            if(j==3)
-              os << std::endl;
-            else
-              os <<  ' ';
-          }
-          else
-            write(os, C[it->neighbor(j)]);
-        }
-      }
-      break;
-    }
-  case 2:
-    {
-      size_type m = number_of_facets();
-      if(is_ascii(os))
-        os << m << std::endl;
-      else
-        write(os, m);
-
-      // write the facets
-      Facet_iterator it;
-      for(it = facets_begin(); it != facets_end(); ++it) {
-        C[(*it).first] = i++;
-        for(int j = 0; j < 3; j++){
-          if(is_ascii(os)) {
-            os << V[(*it).first->vertex(j)];
-            if ( j==2 )
-              os << std::endl;
-            else
-              os <<  ' ';
-          }
-          else {
-            write(os,  V[(*it).first->vertex(j)]);
-          }
-        }
-      }
-      CGAL_triangulation_assertion( i == m );
-
-      // write the neighbors
-      for(it = facets_begin(); it != facets_end(); ++it) {
-        for (int j = 0; j < 3; j++) {
-          if(is_ascii(os)){
-            os << C[(*it).first->neighbor(j)];
-            if(j==2)
-              os << std::endl;
-            else
-              os <<  ' ';
-          }
-          else {
-            write(os, C[(*it).first->neighbor(j)]);
-          }
-        }
-      }
-      break;
-    }
-  case 1:
-    {
-      size_type m = number_of_edges();
-      if(is_ascii(os))
-        os << m << std::endl;
-      else
-        write(os, m);
-      // write the edges
-      Edge_iterator it;
-      for(it = edges_begin(); it != edges_end(); ++it) {
-        C[(*it).first] = i++;
-        for(int j = 0; j < 2; j++){
-          if(is_ascii(os)) {
-            os << V[(*it).first->vertex(j)];
-            if ( j==1 )
-              os << std::endl;
-            else
-              os <<  ' ';
-          }
-          else {
-            write(os, V[(*it).first->vertex(j)]);
-          }
-        }
-      }
-      CGAL_triangulation_assertion( i == m );
-
-      // write the neighbors
-      for(it = edges_begin(); it != edges_end(); ++it) {
-        for (int j = 0; j < 2; j++) {
-          if(is_ascii(os)){
-            os << C[(*it).first->neighbor(j)];
-            if(j==1)
-              os << std::endl;
-            else
-              os <<  ' ';
-          }
-          else {
-            write(os, C[(*it).first->neighbor(j)]);
-          }
-        }
-      }
-      break;
-    }
-  }
-}
-
-
-template <class Vb, class Cb, class Ct>
-typename Triangulation_data_structure_3<Vb,Cb,Ct>::Vertex_handle
-Triangulation_data_structure_3<Vb,Cb,Ct>::insert_first_finite_cell(
-  Vertex_handle &v0, Vertex_handle &v1, Vertex_handle &v2, Vertex_handle &v3,
-  Vertex_handle v_infinite)
-{
-  CGAL_triangulation_precondition( 
-    (v_infinite == Vertex_handle() && dimension() == -2)
-    || (v_infinite != Vertex_handle() && dimension() == -1));
-
-  if (v_infinite == Vertex_handle())
-    v_infinite = create_vertex();
-
-  set_dimension(3);
-
-  v0 = create_vertex();
-  v1 = create_vertex();
-  v2 = create_vertex();
-  v3 = create_vertex();
-
-  Cell_handle c0123 = create_cell(v0,         v1,   v2,   v3);
-  Cell_handle ci012 = create_cell(v_infinite, v0,   v1,   v2);
-  Cell_handle ci103 = create_cell(v_infinite, v1,   v0,   v3);
-  Cell_handle ci023 = create_cell(v_infinite, v0,   v2,   v3);
-  Cell_handle ci132 = create_cell(v_infinite, v1,   v3,   v2);
-
-  v_infinite->set_cell(ci012);
-  v0->set_cell(c0123);
-  v1->set_cell(c0123);
-  v2->set_cell(c0123);
-  v3->set_cell(c0123);
-
-  set_adjacency(c0123, 0, ci132, 0);
-  set_adjacency(c0123, 1, ci023, 0);
-  set_adjacency(c0123, 2, ci103, 0);
-  set_adjacency(c0123, 3, ci012, 0);
-
-  set_adjacency(ci012, 3, ci103, 3);
-  set_adjacency(ci012, 2, ci023, 3);
-  set_adjacency(ci012, 1, ci132, 2);
-  set_adjacency(ci103, 1, ci023, 2);
-  set_adjacency(ci023, 1, ci132, 1);
-  set_adjacency(ci103, 2, ci132, 3);
-
-  return v_infinite;
-}
-
-template <class Vb, class Cb, class Ct>
-typename Triangulation_data_structure_3<Vb,Cb,Ct>::Vertex_handle
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-insert_in_cell(Cell_handle c)
-{
-  CGAL_triangulation_precondition( dimension() == 3 );
-  CGAL_triangulation_precondition( c != Cell_handle() );
-  CGAL_triangulation_expensive_precondition( is_cell(c) );
-
-  Vertex_handle v = create_vertex();
-
-  Vertex_handle v0 = c->vertex(0);
-  Vertex_handle v1 = c->vertex(1);
-  Vertex_handle v2 = c->vertex(2);
-  Vertex_handle v3 = c->vertex(3);
-
-  Cell_handle n1 = c->neighbor(1);
-  Cell_handle n2 = c->neighbor(2);
-  Cell_handle n3 = c->neighbor(3);
-
-  // c will be modified to have v,v1,v2,v3 as vertices
-  Cell_handle c3 = create_cell(v0,v1,v2,v);
-  Cell_handle c2 = create_cell(v0,v1,v,v3);
-  Cell_handle c1 = create_cell(v0,v,v2,v3);
-
-  set_adjacency(c3, 0, c, 3);
-  set_adjacency(c2, 0, c, 2);
-  set_adjacency(c1, 0, c, 1);
-
-  set_adjacency(c2, 3, c3, 2);
-  set_adjacency(c1, 3, c3, 1);
-  set_adjacency(c1, 2, c2, 1);
-
-  set_adjacency(n1, n1->index(c), c1, 1);
-  set_adjacency(n2, n2->index(c), c2, 2);
-  set_adjacency(n3, n3->index(c), c3, 3);
-
-  c->set_vertex(0,v);
-
-  v0->set_cell(c1);
-  v->set_cell(c);
-
-  return v;
-}
-
-template <class Vb, class Cb, class Ct>
-typename Triangulation_data_structure_3<Vb,Cb,Ct>::Vertex_handle
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-insert_in_facet(Cell_handle c, int i)
-{ // inserts v in the facet opposite to vertex i of cell c
-
-  CGAL_triangulation_precondition( c != Cell_handle() );
-  CGAL_triangulation_precondition( dimension() >= 2 );
-
-  Vertex_handle v = create_vertex();
-
-  switch ( dimension() ) {
-
-  case 3:
-    {
-      CGAL_triangulation_expensive_precondition( is_cell(c) );
-      CGAL_triangulation_precondition( i == 0 || i == 1 ||
-                                       i == 2 || i == 3 );
-      // c will be modified to have v replacing vertex(i+3)
-      int i1,i2,i3;
-
-      if ( (i&1) == 0 ) {
-        i1=(i+1)&3; i2=(i+2)&3; i3=6-i-i1-i2;
-      }
-      else {
-        i1=(i+1)&3; i2=(i+3)&3; i3=6-i-i1-i2;
-      }
-      // i,i1,i2,i3 is well oriented
-      // so v will "replace" the vertices in this order
-      // when creating the new cells one after another from c
-
-      Vertex_handle vi=c->vertex(i);
-      Vertex_handle v1=c->vertex(i1);
-      Vertex_handle v2=c->vertex(i2);
-      Vertex_handle v3=c->vertex(i3);
-
-      // new cell with v in place of i1
-      Cell_handle nc = c->neighbor(i1);
-      Cell_handle cnew1 = create_cell(vi,v,v2,v3);
-      set_adjacency(cnew1, 1, nc, nc->index(c));
-      set_adjacency(cnew1, 3, c, i1);
-
-      v3->set_cell(cnew1);
-
-      // new cell with v in place of i2
-      nc = c->neighbor(i2);
-      Cell_handle cnew2 = create_cell(vi,v1,v,v3);
-      set_adjacency(cnew2, 2, nc, nc->index(c));
-      set_adjacency(cnew2, 3, c, i2);
-      set_adjacency(cnew1, 2, cnew2, 1);
-
-      // v replaces i3 in c
-      c->set_vertex(i3,v);
-
-      // other side of facet containing v
-      Cell_handle d = c->neighbor(i);
-      int j = d->index(c);
-      int j1=d->index(v1);// triangulation supposed to be valid
-      int j2=d->index(v2);
-      int j3=6-j-j1-j2;
-      // then the orientation of j,j1,j2,j3 depends on the parity
-      // of i-j
-
-      // new cell with v in place of j1
-      Cell_handle nd = d->neighbor(j1);
-      Cell_handle dnew1 = create_cell(d->vertex(j),v,v3,v2);
-      set_adjacency(dnew1, 1, nd, nd->index(d));
-      set_adjacency(dnew1, 2, d, j1);
-      set_adjacency(dnew1, 0, cnew1, 0);
-
-      // new cell with v in place of j2
-      nd = d->neighbor(j2);
-      Cell_handle dnew2 = create_cell(d->vertex(j),v1,v3,v);
-
-      set_adjacency(dnew2, 3, nd, nd->index(d));
-      set_adjacency(dnew2, 2, d, j2);
-      set_adjacency(dnew2, 0, cnew2, 0);
-      set_adjacency(dnew1, 3, dnew2, 1);
-
-      // v replaces i3 in d
-      d->set_vertex(j3,v);
-      v->set_cell(d);
-
-      break;
-    }
-  case 2:
-    {
-      CGAL_triangulation_expensive_precondition( is_facet(c,i) );
-      Cell_handle n = c->neighbor(2);
-      Cell_handle cnew = create_face(c->vertex(0),c->vertex(1),v);
-      set_adjacency(cnew, 2, n, n->index(c));
-      set_adjacency(cnew, 0, c, 2);
-      c->vertex(0)->set_cell(cnew);
-
-      n = c->neighbor(1);
-      Cell_handle dnew = create_face(c->vertex(0),v,c->vertex(2));
-      set_adjacency(dnew, 1, n, n->index(c));
-      set_adjacency(dnew, 0, c, 1);
-      set_adjacency(dnew, 2, cnew, 1);
-
-      c->set_vertex(0,v);
-      v->set_cell(c);
-      break;
-    }
-  }
-
-  return v;
-}
-
-template <class Vb, class Cb, class Ct>
-typename Triangulation_data_structure_3<Vb,Cb,Ct>::Vertex_handle
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-insert_in_edge(Cell_handle c, int i, int j)
-  // inserts a vertex in the edge of cell c with vertices i and j
-{
-  CGAL_triangulation_precondition( c != Cell_handle() );
-  CGAL_triangulation_precondition( i != j );
-  CGAL_triangulation_precondition( dimension() >= 1 );
-
-  switch ( dimension() ) {
-  case 3:
-    {
-      CGAL_triangulation_expensive_precondition( is_cell(c) );
-      CGAL_triangulation_precondition( i>=0 && i<=3 && j>=0 && j<=3 );
-
-      std::vector<Cell_handle > cells;
-      cells.reserve(32);
-      Cell_circulator ccir = incident_cells(c, i, j);
-      do {
-          Cell_handle cc = ccir;
-          cells.push_back(cc);
-          cc->tds_data().mark_in_conflict();
-          ++ccir;
-      } while (c != ccir);
-
-      return _insert_in_hole(cells.begin(), cells.end(), c, i);
-    }
-  case 2:
-    {
-      CGAL_triangulation_expensive_precondition( is_edge(c,i,j) );
-
-      Vertex_handle v = create_vertex();
-      int k=3-i-j; // index of the third vertex of the facet
-      Cell_handle d = c->neighbor(k);
-      int kd = d->index(c);
-      int id = d->index(c->vertex(i));
-      int jd = d->index(c->vertex(j));
-
-      Cell_handle cnew = create_cell();
-      cnew->set_vertex(i,c->vertex(i));
-      c->vertex(i)->set_cell(cnew);
-      cnew->set_vertex(j,v);
-      cnew->set_vertex(k,c->vertex(k));
-      c->set_vertex(i,v);
-
-      Cell_handle dnew = create_cell();
-      dnew->set_vertex(id,d->vertex(id));
-      // d->vertex(id)->cell() is cnew OK
-      dnew->set_vertex(jd,v);
-      dnew->set_vertex(kd,d->vertex(kd));
-      d->set_vertex(id,v);
-
-      Cell_handle nj = c->neighbor(j);
-      set_adjacency(cnew, i, c, j);
-      set_adjacency(cnew, j, nj, nj->index(c));
-
-      nj = d->neighbor(jd);
-      set_adjacency(dnew, id, d, jd);
-      set_adjacency(dnew, jd, nj, nj->index(d));
-
-      set_adjacency(cnew, k, dnew, kd);
-
-      v->set_cell(cnew);
-      return v;
-    }
-  default: // case 1:
-    {
-      Vertex_handle v = create_vertex();
-      CGAL_triangulation_expensive_precondition( is_edge(c,i,j) );
-      Cell_handle cnew = create_face(v, c->vertex(1), Vertex_handle());
-      c->vertex(1)->set_cell(cnew);
-      c->set_vertex(1,v);
-      set_adjacency(cnew, 0, c->neighbor(0), 1);
-      set_adjacency(cnew, 1, c, 0);
-
-      v->set_cell(cnew);
-      return v;
-    }
-  }
-}
-
-template <class Vb, class Cb, class Ct>
-typename Triangulation_data_structure_3<Vb,Cb,Ct>::Vertex_handle
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-insert_increase_dimension(Vertex_handle star)
-  // star = vertex from which we triangulate the facet of the
-  // incremented dimension
-  // ( geometrically : star = infinite vertex )
-  // = NULL only used to insert the 1st vertex (dimension -2 to dimension -1)
-  // changes the dimension
-{
-  CGAL_triangulation_precondition( dimension() < 3);
-
-  Vertex_handle v = create_vertex();
-
-  int dim = dimension();
-  if (dim != -2) {
-      CGAL_triangulation_precondition( star != Vertex_handle() );
-      // In this case, this precondition is not relatively expensive.
-      CGAL_triangulation_precondition( is_vertex(star) );
-  }
-
-  // this is set now, so that it becomes allowed to reorient
-  // new facets or cells by iterating on them (otherwise the
-  // dimension is too small)
-  set_dimension( dimension()+1 );
-
-  switch ( dim ) {
-  case -2:
-      // insertion of the first vertex
-      // ( geometrically : infinite vertex )
-    {
-      Cell_handle c = create_face(v, Vertex_handle(), Vertex_handle());
-      v->set_cell(c);
-      break;
-    }
-
-  case -1:
-    // insertion of the second vertex
-    // ( geometrically : first finite vertex )
-    {
-      Cell_handle d = create_face(v, Vertex_handle(), Vertex_handle());
-      v->set_cell(d);
-      set_adjacency(d, 0, star->cell(), 0);
-      break;
-    }
-
-  case 0:
-    // insertion of the third vertex
-    // ( geometrically : second finite vertex )
-    {
-      Cell_handle c = star->cell();
-      Cell_handle d = c->neighbor(0);
-
-      c->set_vertex(1,d->vertex(0));
-      d->set_vertex(1,v);
-      d->set_neighbor(1,c);
-      Cell_handle e = create_face( v, star, Vertex_handle() );
-      set_adjacency(e, 0, c, 1);
-      set_adjacency(e, 1, d, 0);
-
-      v->set_cell(d);
-      break;
-    }
-
-  case 1:
-    // general case : 4th vertex ( geometrically : 3rd finite vertex )
-    // degenerate cases geometrically : 1st non collinear vertex
-    {
-      Cell_handle c = star->cell();
-      int i = c->index(star); // i== 0 or 1
-      CGAL_assertion(i==0 || i==1);
-      int j = (i == 0) ? 1 : 0;
-      Cell_handle d = c->neighbor(j);
-        
-      c->set_vertex(2,v);
-
-      Cell_handle e = c->neighbor(i);
-      Cell_handle cnew = c;
-      Cell_handle enew = Cell_handle();
-        
-      while( e != d ){
-        enew = create_cell();
-        enew->set_vertex(i,e->vertex(j));
-        enew->set_vertex(j,e->vertex(i));
-        enew->set_vertex(2,star);
-        
-        set_adjacency(enew, i, cnew, j);
-        // false at the first iteration of the loop where it should
-        // be neighbor 2
-        // it is corrected after the loop
-        set_adjacency(enew, 2, e, 2);
-        // neighbor j will be set during next iteration of the loop
-        
-        e->set_vertex(2,v);
-
-        e = e->neighbor(i);
-        cnew = enew;
-      }
-        
-      d->set_vertex(2,v);
-      set_adjacency(enew, j, d, 2);
-
-      // corrections for star->cell() :
-      c = star->cell();
-      c->set_neighbor(2,c->neighbor(i)->neighbor(2));
-      c->set_neighbor(j,d);
-
-      v->set_cell(d);
-
-      break;
-    }
-
-  case 2:
-    // general case : 5th vertex ( geometrically : 4th finite vertex )
-    // degenerate cases : geometrically 1st non coplanar vertex
-    {
-      // used to store the new cells, in order to be able to traverse only
-      // them to find the missing neighbors.
-      std::vector<Cell_handle > new_cells;
-      new_cells.reserve(16);
-
-      Cell_iterator it = cells_begin();
-      // allowed since the dimension has already been set to 3
-
-      v->set_cell(it); // ok since there is at least one ``cell''
-      for(; it != cells_end(); ++it) {
-        // Here we must be careful since we create_cells in a loop controlled
-        // by an iterator.  So we first take care of the cells newly created
-        // by the following test :
-        if (it->neighbor(0) == Cell_handle())
-          continue;
-        it->set_neighbor(3, Cell_handle());
-        it->set_vertex(3, v);
-        if ( ! it->has_vertex(star) ) {
-          Cell_handle cnew = create_cell( it->vertex(0), it->vertex(2),
-                                          it->vertex(1), star);
-          // The Intel compiler has a problem with passing "it" directly to
-          // function "set_adjacency": the adjacency is not changed.
-          Cell_handle ch_it = it;
-          set_adjacency(cnew, 3, ch_it, 3);
-          cnew->set_neighbor(0, Cell_handle());
-          new_cells.push_back(cnew);
-        }
-      }
-
-      // traversal of the new cells only, to add missing neighbors
-      for(typename std::vector<Cell_handle>::iterator ncit = new_cells.begin();
-           ncit != new_cells.end(); ++ncit) {
-        Cell_handle n = (*ncit)->neighbor(3); // opposite to star
-        for ( int i=0; i<3; i++ ) {
-          int j;
-          if ( i==0 ) j=0;
-          else j=3-i; // vertex 1 and vertex 2 are always switched when
-          // creating a new cell (see above)
-          Cell_handle c = n->neighbor(i)->neighbor(3);
-          if ( c != Cell_handle() ) {
-            // i.e. star is not a vertex of n->neighbor(i)
-            (*ncit)->set_neighbor(j, c);
-            // opposite relation will be set when ncit arrives on c
-            // this avoids to look for the correct index
-            // and to test whether *ncit already has neighbor i
-          }
-          else {
-            // star is a vertex of n->neighbor(i)
-            set_adjacency(*ncit, j, n->neighbor(i), 3);//neighbor opposite to v
-          }
-        }
-      }
-    }
-  }// end switch
-
-  return v;
-}
-
-template <class Vb, class Cb, class Ct>
-void
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-remove_decrease_dimension(Vertex_handle v, Vertex_handle w)
-{
-    CGAL_triangulation_expensive_precondition( is_valid() );
-    CGAL_triangulation_precondition( dimension() >= -1 );
-    CGAL_triangulation_precondition( dimension() != 1 ||
-                                     number_of_vertices() == 3);
-    CGAL_triangulation_precondition( number_of_vertices() >
-                                     (size_type) dimension() + 1 );
-    CGAL_triangulation_precondition( degree(v) == number_of_vertices()-1 );
-
-    if (dimension() <= 0) {
-        delete_cell(v->cell());
-    }
-    else {
-        // the cells incident to w are down graded one dimension
-        // the other cells are deleted
-        std::vector<Cell_handle> to_delete, to_downgrade;
-
-        for (Cell_iterator ib = cells().begin();
-            ib != cells().end(); ++ib) {
-            if ( ib->has_vertex(w) )
-                to_downgrade.push_back(ib);
-            else
-                to_delete.push_back(ib);
-        }
-
-        typename std::vector<Cell_handle>::iterator lfit=to_downgrade.begin();
-        for( ; lfit != to_downgrade.end(); ++lfit) {
-            Cell_handle f = *lfit;
-            int j = f->index(w);
-            int k; if (f->has_vertex(v, k)) f->set_vertex(k, w);
-            if (j != dimension()) {
-                f->set_vertex(j, f->vertex(dimension()));
-                f->set_neighbor(j, f->neighbor(dimension()));
-                if (dimension() >= 1)
-                    change_orientation(f);
-            }
-            f->set_vertex(dimension(), Vertex_handle());
-            f->set_neighbor(dimension(), Cell_handle());
-
-            // Update vertex->cell() pointers.
-            for (int i = 0; i < dimension(); ++i)
-                f->vertex(i)->set_cell(f);
-        }
-
-        delete_cells(to_delete.begin(), to_delete.end());
-    }
-    delete_vertex(v);
-    set_dimension(dimension()-1);
-    CGAL_triangulation_postcondition(is_valid());
-}
-
-template <class Vb, class Cb, class Ct>
-typename Triangulation_data_structure_3<Vb,Cb,Ct>::Cell_handle
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-remove_from_maximal_dimension_simplex(Vertex_handle v)
-{
-    CGAL_triangulation_precondition(dimension() >= 1);
-    CGAL_triangulation_precondition(degree(v) == (size_type) dimension() + 1);
-    CGAL_triangulation_precondition(number_of_vertices() >
-                                    (size_type) dimension() + 1);
-
-    if (number_of_vertices() == (size_type) dimension() + 2) {
-        remove_decrease_dimension(v);
-        return Cell_handle();
-    }
-
-    if (dimension() == 3)
-        return remove_degree_4(v);
-    if (dimension() == 2)
-        return remove_degree_3(v);
-
-    // dimension() == 1
-    return remove_degree_2(v);
-}
-
-template <class Vb, class Cb, class Ct>
-typename Triangulation_data_structure_3<Vb,Cb,Ct>::Cell_handle
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-remove_degree_2(Vertex_handle v)
-{
-    CGAL_triangulation_precondition(dimension() == 1);
-    CGAL_triangulation_precondition(degree(v) == 2);
-    CGAL_triangulation_precondition(number_of_vertices() >= 4);
-
-    // Cells to be killed.
-    Cell_handle c0, c1;
-    // Indices of v in these cells.
-    int i0, i1;
-
-    c0 = v->cell();
-    i0 = c0->index(v);
-    c1 = c0->neighbor((i0 == 0) ? 1 : 0);
-    i1 = c1->index(v);
-
-    // New cell : we copy the content of c0, so we keep the orientation.
-    Cell_handle newc = create_face(c0->vertex(0),
-                                   c0->vertex(1),
-                                   Vertex_handle());
-
-    newc->set_vertex(i0, c1->vertex(c1->index(c0)));
-
-    set_adjacency(newc,    i0, c0->neighbor(i0), mirror_index(c0, i0));
-    set_adjacency(newc,  1-i0, c1->neighbor(i1), mirror_index(c1, i1));
-
-    newc->vertex(0)->set_cell(newc);
-    newc->vertex(1)->set_cell(newc);
-
-    delete_cell(c0);
-    delete_cell(c1);
-    delete_vertex(v);
-
-    return newc;
-}
-
-template <class Vb, class Cb, class Ct>
-typename Triangulation_data_structure_3<Vb,Cb,Ct>::Cell_handle
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-remove_degree_3(Vertex_handle v)
-{
-    CGAL_triangulation_precondition(dimension() == 2);
-    CGAL_triangulation_precondition(degree(v) == 3);
-    CGAL_triangulation_precondition(number_of_vertices() >= 5);
-
-    // Cells to be killed.
-    Cell_handle c0, c1, c2;
-    // Indices of v in these cells.
-    int i0, i1, i2;
-
-    c0 = v->cell();
-    i0 = c0->index(v);
-    c1 = c0->neighbor(cw(i0));
-    i1 = c1->index(v);
-    c2 = c0->neighbor(ccw(i0));
-    i2 = c2->index(v);
-
-    // New cell : we copy the content of c0, so we keep the orientation.
-    Cell_handle newc = create_face(c0->vertex(0),
-                                   c0->vertex(1),
-                                   c0->vertex(2));
-
-    newc->set_vertex(i0, c1->vertex(c1->index(c0)));
-
-    set_adjacency(newc,      i0, c0->neighbor(i0), mirror_index(c0, i0));
-    set_adjacency(newc,  cw(i0), c1->neighbor(i1), mirror_index(c1, i1));
-    set_adjacency(newc, ccw(i0), c2->neighbor(i2), mirror_index(c2, i2));
-
-    newc->vertex(0)->set_cell(newc);
-    newc->vertex(1)->set_cell(newc);
-    newc->vertex(2)->set_cell(newc);
-
-    delete_cell(c0);
-    delete_cell(c1);
-    delete_cell(c2);
-    delete_vertex(v);
-
-    return newc;
-}
-
-template <class Vb, class Cb, class Ct>
-typename Triangulation_data_structure_3<Vb,Cb,Ct>::Cell_handle
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-remove_degree_4(Vertex_handle v)
-{
-    CGAL_triangulation_precondition(dimension() == 3);
-    CGAL_triangulation_precondition(degree(v) == 4);
-    CGAL_triangulation_precondition(number_of_vertices() >= 6);
-
-    // Cells to be killed.
-    Cell_handle c0, c1, c2, c3;
-    // Indices of v in these cells.
-    int i0, i1, i2, i3;
-
-    c0 = v->cell();
-    i0 = c0->index(v);
-    c1 = c0->neighbor(i0^1);
-    i1 = c1->index(v);
-    c2 = c0->neighbor(i0^2);
-    i2 = c2->index(v);
-    c3 = c0->neighbor(i0^3);
-    i3 = c3->index(v);
-
-    // New cell : we copy the content of c0, so we keep the orientation.
-    Cell_handle newc = create_cell(c0->vertex(0),
-                                   c0->vertex(1),
-                                   c0->vertex(2),
-                                   c0->vertex(3));
-
-    newc->set_vertex(i0, c1->vertex(c1->index(c0)));
-
-    set_adjacency(newc,   i0, c0->neighbor(i0), mirror_index(c0, i0));
-    set_adjacency(newc, i0^1, c1->neighbor(i1), mirror_index(c1, i1));
-    set_adjacency(newc, i0^2, c2->neighbor(i2), mirror_index(c2, i2));
-    set_adjacency(newc, i0^3, c3->neighbor(i3), mirror_index(c3, i3));
-
-    newc->vertex(0)->set_cell(newc);
-    newc->vertex(1)->set_cell(newc);
-    newc->vertex(2)->set_cell(newc);
-    newc->vertex(3)->set_cell(newc);
-
-    delete_cell(c0);
-    delete_cell(c1);
-    delete_cell(c2);
-    delete_cell(c3);
-    delete_vertex(v);
-
-    return newc;
-}
-
-template <class Vb, class Cb, class Ct>
-void
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-decrease_dimension(Cell_handle c, int i)
-{
-  CGAL_triangulation_expensive_precondition( is_valid() );;
-  CGAL_triangulation_precondition( dimension() >= 2);
-  CGAL_triangulation_precondition( number_of_vertices() >
-                                   (size_type) dimension() + 1 );
-  CGAL_triangulation_precondition( degree(c->vertex(i)) == number_of_vertices()-1 );
-
-  Vertex_handle v = c->vertex(i);
-  Vertex_handle w = c->vertex(i);
-
-  // the cells incident to w are down graded one dimension
-  // the other cells are deleted
-  std::vector<Cell_handle> to_delete, to_downgrade;
-
-  for (Cell_iterator ib = cells().begin();
-       ib != cells().end(); ++ib) {
-    if ( ib->has_vertex(w) )
-      to_downgrade.push_back(ib);
-    else
-      to_delete.push_back(ib);
-  }
-
-  typename std::vector<Cell_handle>::iterator lfit=to_downgrade.begin();
-  for( ; lfit != to_downgrade.end(); ++lfit) {
-    Cell_handle f = *lfit;
-    int j = f->index(w);
-    int k; 
-    if (f->has_vertex(v, k)) f->set_vertex(k, w);
-    if (j != dimension()) {
-      f->set_vertex(j, f->vertex(dimension()));
-      f->set_neighbor(j, f->neighbor(dimension()));
-      if (dimension() >= 1)
-        change_orientation(f);
-    }
-    f->set_vertex(dimension(), Vertex_handle());
-    f->set_neighbor(dimension(), Cell_handle());
-
-    // Update vertex->cell() pointers.
-    for (int i = 0; i < dimension(); ++i)
-      f->vertex(i)->set_cell(f);
-  }
-
-  delete_cells(to_delete.begin(), to_delete.end());
-
-  //delete_vertex(v);
-  set_dimension(dimension()-1);
-
-  if(dimension() == 2)
-  {
-    Cell_handle n0 = c->neighbor(0);
-    Cell_handle n1 = c->neighbor(1);
-    Cell_handle n2 = c->neighbor(2);
-    Vertex_handle v0 = c->vertex(0);
-    Vertex_handle v1 = c->vertex(1);
-    Vertex_handle v2 = c->vertex(2);
-                
-    int i0 = 0, i1 = 0, i2 = 0;
-                
-    for(int i=0; i<3; i++) if(n0->neighbor(i) == c) { i0 = i; break; }
-    for(int i=0; i<3; i++) if(n1->neighbor(i) == c) { i1 = i; break; }
-    for(int i=0; i<3; i++) if(n2->neighbor(i) == c) { i2 = i; break; }
-                
-    Cell_handle c1 = create_cell(v, v0, v1, Vertex_handle());
-    Cell_handle c2 = create_cell(v, v1, v2, Vertex_handle());
-
-    c->set_vertex(0, v);
-    c->set_vertex(1, v2);
-    c->set_vertex(2, v0);
-    c->set_vertex(3, Vertex_handle());
-
-    //Cell_handle c3 = create_cell(v, v2, v0, Vertex_handle());
-    Cell_handle c3 = c;
-                
-    c1->set_neighbor(0, n2); n2->set_neighbor(i2, c1);
-    c1->set_neighbor(1, c2); 
-    c1->set_neighbor(2, c3);
-    c1->set_neighbor(3, Cell_handle());
-                
-    c2->set_neighbor(0, n0); n0->set_neighbor(i0, c2);
-    c2->set_neighbor(1, c3); 
-    c2->set_neighbor(2, c1);
-    c2->set_neighbor(3, Cell_handle());
-                
-    c3->set_neighbor(0, n1); n1->set_neighbor(i1, c3);
-    c3->set_neighbor(1, c1); 
-    c3->set_neighbor(2, c2);
-    c3->set_neighbor(3, Cell_handle());
-                
-    v->set_cell(c1);
-    v0->set_cell(c1);
-    v1->set_cell(c1);
-    v2->set_cell(c2);
-  }
-        
-  if(dimension() == 1)
-  {
-    Cell_handle n0 = c->neighbor(0);
-    Cell_handle n1 = c->neighbor(1);
-    Vertex_handle v0 = c->vertex(0);
-    Vertex_handle v1 = c->vertex(1);
-                
-    int i0 = 0 , i1 = 0;
-                
-    for(int i=0; i<2; i++) if(n0->neighbor(i) == c) { i0 = i; break; }
-    for(int i=0; i<2; i++) if(n1->neighbor(i) == c) { i1 = i; break; }
-                
-    Cell_handle c1 = create_cell(v0, v, Vertex_handle(), Vertex_handle());
-                
-    c->set_vertex(0, v);
-    c->set_vertex(1, v1);
-    c->set_vertex(2, Vertex_handle());
-    c->set_vertex(3, Vertex_handle());
-
-    //Cell_handle c2 = create_cell(v, v1, Vertex_handle(), Vertex_handle());
-    Cell_handle c2 = c;
-                
-    c1->set_neighbor(0, c2); 
-    c1->set_neighbor(1, n1); n1->set_neighbor(i1, c1);
-    c1->set_neighbor(2, Cell_handle());
-    c1->set_neighbor(3, Cell_handle());
-                
-    c2->set_neighbor(0, n0); n0->set_neighbor(i0, c2);
-    c2->set_neighbor(1, c1); 
-    c2->set_neighbor(2, Cell_handle());
-    c2->set_neighbor(3, Cell_handle());
-                
-    v->set_cell(c1);
-    v0->set_cell(c1);
-    v1->set_cell(c2);
-  }
-        
-  CGAL_triangulation_postcondition(is_valid());
-}
-
-
-template <class Vb, class Cb, class Ct>
-typename Triangulation_data_structure_3<Vb,Cb,Ct>::size_type
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-degree(Vertex_handle v) const
-{
-    std::size_t res;
-    adjacent_vertices(v, Counting_output_iterator(&res));
-    return res;
-}
-
-template <class Vb, class Cb, class Ct>
-bool
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-is_valid(bool verbose, int level ) const
-{
-  switch ( dimension() ) {
-  case 3:
-    {
-        
-      if(number_of_vertices() <= 4) {
-        if (verbose)
-          std::cerr << "wrong number of vertices" << std::endl;
-        CGAL_triangulation_assertion(false);
-        return false;
-      }
-        
-      size_type vertex_count;
-      if ( ! count_vertices(vertex_count,verbose,level) )
-        return false;
-      if ( number_of_vertices() != vertex_count ) {
-        if (verbose)
-          std::cerr << "wrong number of vertices" << std::endl;
-        CGAL_triangulation_assertion(false);
-        return false;
-      }
-
-      size_type cell_count;
-      if ( ! count_cells(cell_count,verbose,level) )
-        return false;
-      size_type edge_count;
-      if ( ! count_edges(edge_count,verbose,level) )
-          return false;
-      size_type facet_count;
-      if ( ! count_facets(facet_count,verbose,level) )
-          return false;
-
-      // Euler relation
-      if ( cell_count - facet_count + edge_count - vertex_count != 0 ) {
-        if (verbose)
-            std::cerr << "Euler relation unsatisfied" << std::endl;
-        CGAL_triangulation_assertion(false);
-        return false;
-      }
-
-      break;
-    }
-  case 2:
-    {
-        
-      if(number_of_vertices() <= 3) {
-        if (verbose)
-          std::cerr << "wrong number of vertices" << std::endl;
-        CGAL_triangulation_assertion(false);
-        return false;
-      }
-        
-      size_type vertex_count;
-      
-      if ( ! count_vertices(vertex_count,verbose,level) )
-        return false;
-      if ( number_of_vertices() != vertex_count ) {
-        if (verbose)
-            std::cerr << "false number of vertices" << std::endl;
-        CGAL_triangulation_assertion(false);
-        return false;
-      }
-
-      size_type edge_count;
-      if ( ! count_edges(edge_count,verbose,level) )
-          return false;
-      // Euler for edges
-      if ( edge_count != 3 * vertex_count - 6 ) {
-        if (verbose)
-            std::cerr << "Euler relation unsatisfied - edges/vertices"
-                      << std::endl;
-        CGAL_triangulation_assertion(false);
-        return false;
-      }
-
-      size_type facet_count;
-      if ( ! count_facets(facet_count,verbose,level) )
-          return false;
-      // Euler for facets
-      if ( facet_count != 2 * vertex_count - 4 ) {
-        if (verbose)
-            std::cerr << "Euler relation unsatisfied - facets/vertices"
-                      << std::endl;
-        CGAL_triangulation_assertion(false);
-        return false;
-      }
-      break;
-    }
-  case 1:
-    {
-        
-      if(number_of_vertices() <= 1) {
-        if (verbose)
-          std::cerr << "wrong number of vertices" << std::endl;
-        CGAL_triangulation_assertion(false);
-        return false;
-      }
-        
-      size_type vertex_count;
-      if ( ! count_vertices(vertex_count,verbose,level) )
-          return false;
-      if ( number_of_vertices() != vertex_count ) {
-        if (verbose)
-            std::cerr << "false number of vertices" << std::endl;
-        CGAL_triangulation_assertion(false);
-        return false;
-      }
-      size_type edge_count;
-      if ( ! count_edges(edge_count,verbose,level) )
-          return false;
-      // Euler for edges
-      if ( edge_count != vertex_count ) {
-        if (verbose)
-            std::cerr << "false number of edges" << std::endl;
-        CGAL_triangulation_assertion(false);
-        return false;
-      }
-      break;
-    }
-  case 0:
-    {
-      if ( number_of_vertices() < 2 ) {
-        if (verbose)
-            std::cerr << "less than 2 vertices but dimension 0" << std::endl;
-        CGAL_triangulation_assertion(false);
-        return false;
-      }
-      // no break; continue
-    }
-  case -1:
-    {
-      if ( number_of_vertices() < 1 ) {
-        if (verbose)
-          std::cerr << "no vertex but dimension -1" << std::endl;
-        CGAL_triangulation_assertion(false);
-        return false;
-      }
-      // vertex count
-      size_type vertex_count;
-      if ( ! count_vertices(vertex_count,verbose,level) )
-        return false;
-      if ( number_of_vertices() != vertex_count ) {
-        if (verbose)
-          std::cerr << "false number of vertices" << std::endl;
-        CGAL_triangulation_assertion(false);
-        return false;
-      }
-    }
-  } // end switch
-  if (verbose)
-      std::cerr << "valid data structure" << std::endl;
-  return true;
-}
-
-template <class Vb, class Cb, class Ct>
-bool
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-is_valid(Vertex_handle v, bool verbose, int level) const
-{
-  bool result = v->is_valid(verbose,level);
-  result = result && v->cell()->has_vertex(v);
-  if ( ! result ) {
-    if ( verbose )
-      std::cerr << "invalid vertex" << std::endl;
-    CGAL_triangulation_assertion(false);
-  }
-  return result;
-}
-
-template <class Vb, class Cb, class Ct>
-bool
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-is_valid(Cell_handle c, bool verbose, int level) const
-{
-    if ( ! c->is_valid(verbose, level) )
-        return false;
-
-    switch (dimension()) {
-    case -2:
-    case -1:
-    {
-      if ( c->vertex(0) == Vertex_handle() ) {
-        if (verbose)
-            std::cerr << "vertex 0 NULL" << std::endl;
-        CGAL_triangulation_assertion(false);
-        return false;
-      }
-      is_valid(c->vertex(0),verbose,level);
-      if ( c->vertex(1) != Vertex_handle() || c->vertex(2) != Vertex_handle()) {
-        if (verbose)
-            std::cerr << "vertex 1 or 2 != NULL" << std::endl;
-        CGAL_triangulation_assertion(false);
-        return false;
-      }
-      if ( c->neighbor(0) != Cell_handle() ||
-           c->neighbor(1) != Cell_handle() ||
-           c->neighbor(2) != Cell_handle()) {
-        if (verbose)
-            std::cerr << "one neighbor != NULL" << std::endl;
-        CGAL_triangulation_assertion(false);
-        return false;
-      }
-      break;
-    }
-
-    case 0:
-      {
-      if ( c->vertex(0) == Vertex_handle() ) {
-        if (verbose)
-            std::cerr << "vertex 0 NULL" << std::endl;
-        CGAL_triangulation_assertion(false);
-        return false;
-      }
-      is_valid(c->vertex(0),verbose,level);
-      if ( c->neighbor (0) == Cell_handle() ) {
-        if (verbose)
-            std::cerr << "neighbor 0 NULL" << std::endl;
-        CGAL_triangulation_assertion(false);
-        return false;
-      }
-      if ( c->vertex(1) != Vertex_handle() ||
-           c->vertex(2) != Vertex_handle() ) {
-        if (verbose)
-            std::cerr << "vertex 1 or 2 != NULL" << std::endl;
-        CGAL_triangulation_assertion(false);
-        return false;
-      }
-      if ( c->neighbor(1) != Cell_handle() ||
-           c->neighbor(2) != Cell_handle() ) {
-        if (verbose)
-            std::cerr << "neighbor 1 or 2 != NULL" << std::endl;
-        CGAL_triangulation_assertion(false);
-        return false;
-      }
-
-      if ( ! c->neighbor(0)->has_vertex(c->vertex(0)) ) {
-        if (verbose)
-            std::cerr << "neighbor 0 does not have vertex 0" << std::endl;
-        CGAL_triangulation_assertion(false);
-        return false;
-      }
-      break;
-      }
-
-    case 1:
-      {
-      Vertex_handle v0 = c->vertex(0);
-      Vertex_handle v1 = c->vertex(1);
-      Cell_handle n0 = c->neighbor(0);
-      Cell_handle n1 = c->neighbor(1);
-
-      if ( v0 == Vertex_handle() || v1 == Vertex_handle() ) {
-        if (verbose)
-            std::cerr << "vertex 0 or 1 NULL" << std::endl;
-        CGAL_triangulation_assertion(false);
-        return false;
-      }
-      is_valid(c->vertex(0),verbose,level);
-      is_valid(c->vertex(1),verbose,level);
-      if ( n0 == Cell_handle() || n1 == Cell_handle() ) {
-        if (verbose)
-            std::cerr << "neighbor 0 or 1 NULL" << std::endl;
-        CGAL_triangulation_assertion(false);
-        return false;
-      }
-
-      if ( v0 !=  n1->vertex(1) ) {
-        if (verbose)
-            std::cerr << "neighbor 1 does not have vertex 0 as vertex 1"
-                      << std::endl;
-        CGAL_triangulation_assertion(false);
-        return false;
-      }
-      if ( v1 != n0->vertex(0) ) {
-        if (verbose)
-            std::cerr << "neighbor 0 does not have vertex 1 as vertex 0"
-                      << std::endl;
-        CGAL_triangulation_assertion(false);
-        return false;
-      }
-
-      if ( n0->neighbor(1) != c ) {
-        if (verbose)
-            std::cerr << "neighbor 0 does not have this as neighbor 1"
-                      << std::endl;
-        CGAL_triangulation_assertion(false);
-        return false;
-      }
-      if ( n1->neighbor(0) != c ) {
-        if (verbose)
-            std::cerr << "neighbor 1 does not have this as neighbor 0"
-                      << std::endl;
-        CGAL_triangulation_assertion(false);
-        return false;
-      }
-
-      break;
-      }
-
-    case 2:
-      {
-      if ( c->vertex(0) == Vertex_handle() ||
-           c->vertex(1) == Vertex_handle() ||
-           c->vertex(2) == Vertex_handle() ) {
-        if (verbose)
-            std::cerr << "vertex 0, 1, or 2 NULL" << std::endl;
-        CGAL_triangulation_assertion(false);
-        return false;
-      }
-      is_valid(c->vertex(0),verbose,level);
-      is_valid(c->vertex(1),verbose,level);
-      is_valid(c->vertex(2),verbose,level);
-      int in;
-      Cell_handle n;
-      for(int i = 0; i < 3; i++) {
-        n = c->neighbor(i);
-        if ( n == Cell_handle() ) {
-          if (verbose)
-              std::cerr << "neighbor " << i << " NULL" << std::endl;
-          CGAL_triangulation_assertion(false);
-          return false;
-        }
-        if ( ! n->has_vertex(c->vertex(cw(i)),in ) ) {
-          if (verbose)
-              std::cerr << "vertex " << cw(i)
-                        << " not vertex of neighbor " << i << std::endl;
-          CGAL_triangulation_assertion(false);
-          return false;
-        }
-        in = cw(in);
-        if ( n->neighbor(in) != c ) {
-          if (verbose)
-              std::cerr << "neighbor " << i
-                        << " does not have this as neighbor "
-                        << in << std::endl;
-          CGAL_triangulation_assertion(false);
-          return false;
-        }
-        if ( c->vertex(ccw(i)) != n->vertex(cw(in)) ) {
-          if (verbose)
-              std::cerr << "vertex " << ccw(i)
-                        << " is not vertex " << cw(in)
-                        << " of neighbor " << i << std::endl;
-          CGAL_triangulation_assertion(false);
-          return false;
-        }
-      }
-      break;
-      }
-
-    case 3:
-      {
-        int i;
-        for(i = 0; i < 4; i++) {
-          if ( c->vertex(i) == Vertex_handle() ) {
-            if (verbose)
-                std::cerr << "vertex " << i << " NULL" << std::endl;
-            CGAL_triangulation_assertion(false);
-            return false;
-          }
-          is_valid(c->vertex(i),verbose,level);
-        }
-
-        for(i = 0; i < 4; i++) {
-          Cell_handle n = c->neighbor(i);
-          if ( n == Cell_handle() ) {
-            if (verbose)
-              std::cerr << "neighbor " << i << " NULL" << std::endl;
-            CGAL_triangulation_assertion(false);
-            return false;
-          }
-
-          int in = 5;
-          // if ( ! n->has_neighbor(handle(), in) ) {
-          if ( n->neighbor(0) == c) in = 0;
-          if ( n->neighbor(1) == c) in = 1;
-          if ( n->neighbor(2) == c) in = 2;
-          if ( n->neighbor(3) == c) in = 3;
-          if (in == 5) {
-            if (verbose)
-              std::cerr << "neighbor of c has not c as neighbor" << std::endl;
-            CGAL_triangulation_assertion(false);
-            return false;
-          }
-        
-          int j1n,j2n,j3n;
-          if ( ! n->has_vertex(c->vertex((i+1)&3),j1n) ) {
-            if (verbose) { std::cerr << "vertex " << ((i+1)&3)
-                                     << " not vertex of neighbor "
-                                     << i << std::endl; }
-            CGAL_triangulation_assertion(false);
-            return false;
-          }
-          if ( ! n->has_vertex(c->vertex((i+2)&3),j2n) ) {
-            if (verbose) { std::cerr << "vertex " << ((i+2)&3)
-                                     << " not vertex of neighbor "
-                                     << i << std::endl; }
-            CGAL_triangulation_assertion(false);
-            return false;
-          }
-          if ( ! n->has_vertex(c->vertex((i+3)&3),j3n) ) {
-            if (verbose) { std::cerr << "vertex " << ((i+3)&3)
-                                     << " not vertex of neighbor "
-                                     << i << std::endl; }
-            CGAL_triangulation_assertion(false);
-            return false;
-          }
-        
-          if ( in+j1n+j2n+j3n != 6) {
-            if (verbose) { std::cerr << "sum of the indices != 6 "
-                                     << std::endl; }
-            CGAL_triangulation_assertion(false);
-            return false;
-          }
-        
-          // tests whether the orientations of this and n are consistent
-          if ( ((i+in)&1) == 0 ) { // i and in have the same parity
-            if ( j1n == ((in+1)&3) ) {
-              if ( ( j2n != ((in+3)&3) ) || ( j3n != ((in+2)&3) ) ) {
-                if (verbose)
-                  std::cerr << " pb orientation with neighbor "
-                            << i << std::endl;
-                CGAL_triangulation_assertion(false);
-                return false;
-              }
-            }
-            if ( j1n == ((in+2)&3) ) {
-              if ( ( j2n != ((in+1)&3) ) || ( j3n != ((in+3)&3) ) ) {
-                if (verbose)
-                  std::cerr << " pb orientation with neighbor "
-                            << i << std::endl;
-                CGAL_triangulation_assertion(false);
-                return false;
-              }
-            }
-            if ( j1n == ((in+3)&3) ) {
-              if ( ( j2n != ((in+2)&3) ) || ( j3n != ((in+1)&3) ) ) {
-                if (verbose)
-                  std::cerr << " pb orientation with neighbor "
-                            << i << std::endl;
-                CGAL_triangulation_assertion(false);
-                return false;
-              }
-            }
-          }
-          else { // i and in do not have the same parity
-            if ( j1n == ((in+1)&3) ) {
-              if ( ( j2n != ((in+2)&3) ) || ( j3n != ((in+3)&3) ) ) {
-                if (verbose)
-                  std::cerr << " pb orientation with neighbor "
-                            << i << std::endl;
-                CGAL_triangulation_assertion(false);
-                return false;
-              }
-            }
-            if ( j1n == ((in+2)&3) ) {
-              if ( ( j2n != ((in+3)&3) ) || ( j3n != ((in+1)&3) ) ) {
-                if (verbose)
-                  std::cerr << " pb orientation with neighbor "
-                            << i << std::endl;
-                CGAL_triangulation_assertion(false);
-                return false;
-              }
-            }
-            if ( j1n == ((in+3)&3) ) {
-              if ( ( j2n != ((in+1)&3) ) || ( j3n != ((in+2)&3) ) ) {
-                if (verbose)
-                  std::cerr << " pb orientation with neighbor "
-                            << i << std::endl;
-                CGAL_triangulation_assertion(false);
-                return false;
-              }
-            }
-          }
-        } // end looking at neighbors
-      }// end case dim 3
-    } // end switch
-    return true;
-}
-
-template <class Vb, class Cb, class Ct>
-template <class TDS_src,class ConvertVertex,class ConvertCell>
-typename Triangulation_data_structure_3<Vb,Cb,Ct>::Vertex_handle
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-copy_tds(const TDS_src& tds,
-        typename TDS_src::Vertex_handle vert,
-        const ConvertVertex& convert_vertex,
-        const ConvertCell& convert_cell)
-{
-  CGAL_triangulation_expensive_precondition( vert == Vertex_handle()
-                                          || tds.is_vertex(vert) );
-
-  clear();
-
-  size_type n = tds.number_of_vertices();
-  set_dimension(tds.dimension());
-
-  if (n == 0)  return Vertex_handle(); 
-
-  // Number of pointers to cell/vertex to copy per cell.
-  int dim = (std::max)(1, dimension() + 1);
-
-  // Create the vertices.
-  std::vector<typename TDS_src::Vertex_handle> TV(n);
-  size_type i = 0;
-
-  for (typename TDS_src::Vertex_iterator vit = tds.vertices_begin();
-       vit != tds.vertices_end(); ++vit)
-    TV[i++] = vit;
-
-  CGAL_triangulation_assertion( i == n );
-
-  Unique_hash_map< typename TDS_src::Vertex_handle,Vertex_handle > V;
-  Unique_hash_map< typename TDS_src::Cell_handle,Cell_handle > F;
-  
-  for (i=0; i <= n-1; ++i){
-    Vertex_handle vh=create_vertex( convert_vertex(*TV[i]) );
-    V[ TV[i] ] = vh;
-    convert_vertex(*TV[i],*vh);
-  }
-
-  // Create the cells.
-  for (typename TDS_src::Cell_iterator cit = tds.cells().begin();
-          cit != tds.cells_end(); ++cit) {
-      Cell_handle ch=create_cell(convert_cell(*cit));
-      F[cit]=ch;
-      for (int j = 0; j < dim; j++)
-        ch->set_vertex(j, V[cit->vertex(j)] );
-      convert_cell(*cit,*ch);
-  }
-
-  // Link the vertices to a cell.
-  for (typename TDS_src::Vertex_iterator vit2 = tds.vertices_begin();
-       vit2 != tds.vertices_end(); ++vit2)
-    V[vit2]->set_cell( F[vit2->cell()] );
-
-  // Hook neighbor pointers of the cells.
-  for (typename TDS_src::Cell_iterator cit2 = tds.cells().begin();
-          cit2 != tds.cells_end(); ++cit2) {
-    for (int j = 0; j < dim; j++)
-      F[cit2]->set_neighbor(j, F[cit2->neighbor(j)] );
-  }
-
-  CGAL_triangulation_postcondition( is_valid() );
-
-  return (vert != typename TDS_src::Vertex_handle()) ? V[vert] : Vertex_handle();
-}
-
-//utilities for copy_tds
-namespace internal { namespace TDS_3{
-  template <class Vertex_src,class Vertex_tgt>
-  struct Default_vertex_converter
-  {
-    Vertex_tgt operator()(const Vertex_src& src) const {
-      return Vertex_tgt(src.point());
-    }
-    
-    void operator()(const Vertex_src&,Vertex_tgt&) const {}
-  };
-
-  template <class Cell_src,class Cell_tgt>
-  struct Default_cell_converter
-  {
-    Cell_tgt operator()(const Cell_src&) const {
-      return Cell_tgt();
-    }
-    
-    void operator()(const Cell_src&,Cell_tgt&) const {}
-  };
-  
-  template <class Vertex>
-  struct Default_vertex_converter<Vertex,Vertex>
-  {
-    const Vertex& operator()(const Vertex& src) const {
-      return src;
-    }
-    
-    void operator()(const Vertex&,Vertex&) const {}
-  };
-  
-  template <class Cell>
-  struct Default_cell_converter<Cell,Cell>{
-    const Cell& operator()(const Cell& src) const {
-      return src;
-    } 
-    
-    void operator()(const Cell&,Cell&) const {}
-  };
-} } //namespace internal::TDS_3
-
-template <class Vb, class Cb, class Ct>
-template<class TDS_src>
-typename Triangulation_data_structure_3<Vb,Cb,Ct>::Vertex_handle
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-copy_tds(const TDS_src& src,typename TDS_src::Vertex_handle vert)
-{
-  internal::TDS_3::Default_vertex_converter<typename TDS_src::Vertex,Vertex> setv;
-  internal::TDS_3::Default_cell_converter<typename TDS_src::Cell,Cell>  setc;
-  return copy_tds(src,vert,setv,setc);
-}
-
-template <class Vb, class Cb, class Ct>
-void
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-swap(Tds & tds)
-{
-  CGAL_triangulation_expensive_precondition(tds.is_valid() && is_valid());
-
-  std::swap(_dimension, tds._dimension);
-  cells().swap(tds.cells());
-  vertices().swap(tds.vertices());
-}
-
-template <class Vb, class Cb, class Ct>
-void
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-clear()
-{
-  cells().clear();
-  vertices().clear();
-  set_dimension(-2);
-}
-
-template <class Vb, class Cb, class Ct>
-bool
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-count_vertices(size_type & i, bool verbose, int level) const
-  // counts AND checks the validity
-{
-  i = 0;
-
-  for (Vertex_iterator it = vertices_begin(); it != vertices_end(); ++it) {
-    if ( ! is_valid(it,verbose,level) ) {
-      if (verbose)
-          std::cerr << "invalid vertex" << std::endl;
-      CGAL_triangulation_assertion(false);
-      return false;
-    }
-    ++i;
-  }
-  return true;
-}
-
-template <class Vb, class Cb, class Ct>
-bool
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-count_facets(size_type & i, bool verbose, int level) const
-  // counts but does not check
-{
-  i = 0;
-
-  for (Facet_iterator it = facets_begin(); it != facets_end(); ++it) {
-    if ( ! is_valid((*it).first,verbose, level) ) {
-      if (verbose)
-          std::cerr << "invalid facet" << std::endl;
-      CGAL_triangulation_assertion(false);
-      return false;
-    }
-    ++i;
-  }
-  return true;
-}
-
-template <class Vb, class Cb, class Ct>
-bool
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-count_edges(size_type & i, bool verbose, int level) const
-  // counts but does not check
-{
-  i = 0;
-
-  for (Edge_iterator it = edges_begin(); it != edges_end(); ++it) {
-    if ( ! is_valid((*it).first,verbose, level) ) {
-      if (verbose)
-          std::cerr << "invalid edge" << std::endl;
-      CGAL_triangulation_assertion(false);
-      return false;
-    }
-    ++i;
-  }
-  return true;
-}
-
-template <class Vb, class Cb, class Ct>
-bool
-Triangulation_data_structure_3<Vb,Cb,Ct>::
-count_cells(size_type & i, bool verbose, int level) const
-  // counts AND checks the validity
-{
-  i = 0;
-
-  for (Cell_iterator it = cells_begin(); it != cells_end(); ++it) {
-    if ( ! is_valid(it,verbose, level) ) {
-      if (verbose)
-          std::cerr << "invalid cell" << std::endl;
-      CGAL_triangulation_assertion(false);
-      return false;
-    }
-    ++i;
-  }
-  return true;
-}
-
-} //namespace CGAL
-
-#endif // CGAL_TRIANGULATION_DATA_STRUCTURE_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_euclidean_traits_2.h b/3rdparty/CGAL-4.8/include/CGAL/Triangulation_euclidean_traits_2.h
deleted file mode 100644
index fc4bb2d..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_euclidean_traits_2.h
+++ /dev/null
@@ -1,133 +0,0 @@
-// Copyright (c) 1997   INRIA Sophia-Antipolis (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
-// 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(s)     : Mariette Yvinec
-
-#ifndef CGAL_TRIANGULATION_EUCLIDEAN_TRAITS_2_H
-#define CGAL_TRIANGULATION_EUCLIDEAN_TRAITS_2_H
-
-#include <CGAL/Point_2.h>
-#include <CGAL/Segment_2.h>
-#include <CGAL/Triangle_2.h>
-#include <CGAL/Line_2.h>
-#include <CGAL/Ray_2.h>
-#include <CGAL/predicates_on_points_2.h>
-#include <CGAL/basic_constructions_2.h>
-#include <CGAL/distance_predicates_2.h>
-
-#include <CGAL/triangulation_assertions.h>
-#include <CGAL/Segment_2_Segment_2_intersection.h>
-
-namespace CGAL { 
-
-template < class R >
-class Triangulation_euclidean_traits_2 {
-public:
-  typedef R Rep;
-  typedef typename R::Point_2     Point_2;
-  typedef typename R::Segment_2   Segment_2;
-  typedef typename R::Triangle_2  Triangle_2;
-  typedef typename R::Line_2      Line_2;
-  typedef typename R::Ray_2       Ray_2;
-
-  typedef typename R::Less_x_2                   Less_x_2;
-  typedef typename R::Less_y_2                   Less_y_2;
-  typedef typename R::Compare_x_2                Compare_x_2;
-  typedef typename R::Compare_y_2                Compare_y_2;
-  typedef typename R::Orientation_2              Orientation_2;
-  typedef typename R::Side_of_oriented_circle_2  Side_of_oriented_circle_2;
-  typedef typename R::Construct_circumcenter_2   Construct_circumcenter_2;
-  typedef typename R::Construct_bisector_2       Construct_bisector_2;
-  typedef typename R::Compare_distance_2         Compare_distance_2;
-  typedef typename R::Construct_segment_2        Construct_segment_2;
-  typedef typename R::Construct_triangle_2       Construct_triangle_2;
-  typedef typename R::Construct_direction_2      Construct_direction_2;
-  typedef typename R::Construct_ray_2            Construct_ray_2;
-  
-  //for natural_neighbor_coordinates_2
-  typedef typename R::FT                         FT;
-  typedef typename R::Equal_x_2                  Equal_x_2;
-  typedef typename R::Compute_area_2             Compute_area_2;
-  Compute_area_2 compute_area_2_object () const {return Compute_area_2();}
-  
-  // for compatibility with previous versions
-  typedef Point_2      Point;
-  typedef Segment_2    Segment;
-  typedef Triangle_2   Triangle;
-  typedef Ray_2        Ray;
-  typedef Line_2       Line;
-
-  Triangulation_euclidean_traits_2() {}
-  Triangulation_euclidean_traits_2(const Triangulation_euclidean_traits_2 &) {}
-  Triangulation_euclidean_traits_2 &operator=
-      (const Triangulation_euclidean_traits_2 &)
-  {return *this;}
- 
-  Less_x_2
-  less_x_2_object() const
-    { return Less_x_2();}
-
-  Less_y_2
-  less_y_2_object() const
-    { return Less_y_2();}
-  
-  Compare_x_2
-  compare_x_2_object() const
-    { return Compare_x_2();}
-
-  Compare_y_2
-  compare_y_2_object() const
-    { return Compare_y_2();}
-  
-  Orientation_2
-  orientation_2_object() const
-    { return Orientation_2();}
-
-  Side_of_oriented_circle_2
-  side_of_oriented_circle_2_object() const
-    {return Side_of_oriented_circle_2();}
- 
-  Construct_circumcenter_2
-  construct_circumcenter_2_object() const
-    { return Construct_circumcenter_2();}
-
-  Construct_bisector_2
-  construct_bisector_2_object() const
-    {return Construct_bisector_2();}
-  
-  Compare_distance_2
-  compare_distance_2_object() const
-    {return Compare_distance_2();}
-
-  Construct_segment_2  construct_segment_2_object() const
-    {return Construct_segment_2();}
-
-  Construct_triangle_2  construct_triangle_2_object() const
-    {return Construct_triangle_2();}
-
-  Construct_direction_2  construct_direction_2_object() const
-    {return Construct_direction_2();}
-
-  Construct_ray_2  construct_ray_2_object() const
-    {return Construct_ray_2();}
-
-};
-
-} //namespace CGAL 
-
-#endif // CGAL_TRIANGULATION_EUCLIDEAN_TRAITS_2_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_euclidean_traits_xy_3.h b/3rdparty/CGAL-4.8/include/CGAL/Triangulation_euclidean_traits_xy_3.h
deleted file mode 100644
index 961136d..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_euclidean_traits_xy_3.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (c) 1997-2010  INRIA Sophia-Antipolis (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
-// 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(s)     : Mariette Yvinec
-
-#ifndef CGAL_TRIANGULATION_EUCLIDEAN_TRAITS_XY_3_H
-#define CGAL_TRIANGULATION_EUCLIDEAN_TRAITS_XY_3_H
-
-#define CGAL_DEPRECATED_HEADER "<CGAL/Triangulation_euclidean_traits_xy_3.h>"
-#define CGAL_REPLACEMENT_HEADER "<CGAL/Projection_traits_xy_3.h>"
-#include <CGAL/internal/deprecation_warning.h>
-
-#include <CGAL/internal/Projection_traits_3.h>
-
-namespace CGAL { 
-
-template < class R >
-class Triangulation_euclidean_traits_xy_3
-  : public internal::Projection_traits_3<R,2>
-{};
-  
-} //namespace CGAL 
-
-#endif // CGAL_TRIANGULATION_EUCLIDEAN_TRAITS_XY_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_euclidean_traits_xz_3.h b/3rdparty/CGAL-4.8/include/CGAL/Triangulation_euclidean_traits_xz_3.h
deleted file mode 100644
index f0cdefa..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_euclidean_traits_xz_3.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (c) 1997-2010  INRIA Sophia-Antipolis (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
-// 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(s)     : Mariette Yvinec
-
-#ifndef CGAL_TRIANGULATION_EUCLIDEAN_TRAITS_XZ_3_H
-#define CGAL_TRIANGULATION_EUCLIDEAN_TRAITS_XZ_3_H
-
-#define CGAL_DEPRECATED_HEADER "<CGAL/Triangulation_euclidean_traits_xz_3.h>"
-#define CGAL_REPLACEMENT_HEADER "<CGAL/Projection_traits_xz_3.h>"
-#include <CGAL/internal/deprecation_warning.h>
-
-#include <CGAL/internal/Projection_traits_3.h>
-namespace CGAL {
-
-template < class R >
-class Triangulation_euclidean_traits_xz_3
-  : public internal::Projection_traits_3<R,1>
-{};
-
-} //namespace CGAL
-
-#endif // CGAL_TRIANGULATION_EUCLIDEAN_TRAITS_XZ_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_euclidean_traits_yz_3.h b/3rdparty/CGAL-4.8/include/CGAL/Triangulation_euclidean_traits_yz_3.h
deleted file mode 100644
index 8a92296..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_euclidean_traits_yz_3.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (c) 1997-2010  INRIA Sophia-Antipolis (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
-// 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(s)     : Mariette Yvinec
-
-#ifndef CGAL_TRIANGULATION_EUCLIDEAN_TRAITS_YZ_3_H
-#define CGAL_TRIANGULATION_EUCLIDEAN_TRAITS_YZ_3_H
-
-#define CGAL_DEPRECATED_HEADER "<CGAL/Triangulation_euclidean_traits_yz_3.h>"
-#define CGAL_REPLACEMENT_HEADER "<CGAL/Projection_traits_yz_3.h>"
-#include <CGAL/internal/deprecation_warning.h>
-
-#include <CGAL/internal/Projection_traits_3.h>
-
-namespace CGAL {
-
-template < class R >
-class Triangulation_euclidean_traits_yz_3
-  : public internal::Projection_traits_3<R,0>
-{};
-
-} //namespace CGAL
-
-#endif // CGAL_TRIANGULATION_EUCLIDEAN_TRAITS_YZ_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_hierarchy_3.h b/3rdparty/CGAL-4.8/include/CGAL/Triangulation_hierarchy_3.h
deleted file mode 100644
index 81ba0df..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_hierarchy_3.h
+++ /dev/null
@@ -1,842 +0,0 @@
-// Copyright (c) 1998, 2001, 2003  INRIA Sophia-Antipolis (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
-// 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(s)     : Olivier Devillers <Olivier.Devillers at sophia.inria.fr>
-//                 Sylvain Pion
-
-#ifndef CGAL_TRIANGULATION_HIERARCHY_3_H
-#define CGAL_TRIANGULATION_HIERARCHY_3_H
-
-#include <CGAL/basic.h>
-#include <CGAL/triangulation_assertions.h>
-#include <CGAL/Triangulation_hierarchy_vertex_base_3.h>
-#include <CGAL/Location_policy.h>
-
-#include <boost/random/linear_congruential.hpp>
-#include <boost/random/geometric_distribution.hpp>
-#include <boost/random/variate_generator.hpp>
-
-#ifndef CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
-#include <CGAL/Spatial_sort_traits_adapter_3.h>
-#include <CGAL/internal/info_check.h>
-
-#include <boost/tuple/tuple.hpp>
-#include <boost/iterator/zip_iterator.hpp>
-#include <boost/mpl/and.hpp>
-#endif //CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
-
-namespace CGAL {
-
-// This class is deprecated, but must be kept for backward compatibility.
-//
-// It would be better to move its content to the Delaunay_triangulation_3
-// specializations for Fast_location and make Triangulation_hierarchy_3 the
-// empty nutshell instead.
-//
-// Then, later, maybe merge the Compact/Fast codes in a cleaner factorized way.
-
-template < class Tr >
-class Triangulation_hierarchy_3
-  : public Tr
-{
-  // parameterization of the hierarchy
-  // maximal number of points is 30^5 = 24 millions !
-  enum { ratio = 30 };
-  enum { minsize = 20};
-  enum { maxlevel = 5};
-
-public:
-  typedef Tr                                   Tr_Base;
-  typedef Fast_location                        Location_policy;
-  typedef typename Tr_Base::Geom_traits        Geom_traits;
-  typedef typename Tr_Base::Point              Point;
-  typedef typename Tr_Base::size_type          size_type;
-  typedef typename Tr_Base::Vertex_handle      Vertex_handle;
-  typedef typename Tr_Base::Cell_handle        Cell_handle;
-  typedef typename Tr_Base::Vertex_iterator    Vertex_iterator;
-  typedef typename Tr_Base::Vertex             Vertex;
-  typedef typename Tr_Base::Locate_type        Locate_type;
-  typedef typename Tr_Base::Finite_vertices_iterator  Finite_vertices_iterator;
-  typedef typename Tr_Base::Finite_cells_iterator     Finite_cells_iterator;
-  typedef typename Tr_Base::Finite_facets_iterator    Finite_facets_iterator;
-  typedef typename Tr_Base::Finite_edges_iterator     Finite_edges_iterator;
-
-  using Tr_Base::number_of_vertices;
-  using Tr_Base::geom_traits;
-
-private:
-
-  // here is the stack of triangulations which form the hierarchy
-  Tr_Base*       hierarchy[maxlevel];
-  boost::rand48  random;
-
-  void set_up_down(Vertex_handle up, Vertex_handle down)
-  {
-    up->set_down(down);
-    down->set_up(up);
-  }
-
-public:
-
-  Triangulation_hierarchy_3(const Geom_traits& traits = Geom_traits());
-
-  Triangulation_hierarchy_3(const Triangulation_hierarchy_3& tr);
-
-  template < typename InputIterator >
-  Triangulation_hierarchy_3(InputIterator first, InputIterator last,
-                            const Geom_traits& traits = Geom_traits())
-    : Tr_Base(traits)
-  {
-      hierarchy[0] = this;
-      for(int i=1; i<maxlevel; ++i)
-          hierarchy[i] = new Tr_Base(traits);
-      insert(first, last);
-  }
-
-  Triangulation_hierarchy_3 & operator=(const Triangulation_hierarchy_3& tr)
-  {
-    Triangulation_hierarchy_3 tmp(tr);
-    swap(tmp);
-    return *this;
-  }
-
-  ~Triangulation_hierarchy_3();
-
-  void swap(Triangulation_hierarchy_3 &tr);
-
-  void clear();
-
-  // CHECKING
-  bool is_valid(bool verbose = false, int level = 0) const;
-
-  // INSERT REMOVE
-  Vertex_handle insert(const Point &p, Vertex_handle hint)
-  {
-    return insert(p, hint == Vertex_handle() ? this->infinite_cell() : hint->cell());
-  }
-
-  Vertex_handle insert(const Point &p, Cell_handle start = Cell_handle ());
-
-  Vertex_handle insert(const Point &p, Locate_type lt, Cell_handle loc,
-                       int li, int lj);
-
-#ifndef CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
-  template < class InputIterator >
-  std::ptrdiff_t
-  insert( InputIterator first, InputIterator last,
-          typename boost::enable_if<
-            boost::is_convertible<
-                typename std::iterator_traits<InputIterator>::value_type,
-                Point
-            >
-          >::type* = NULL
-  )
-#else
-  template < class InputIterator >
-  std::ptrdiff_t
-  insert( InputIterator first, InputIterator last)
-#endif //CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
-  {
-    size_type n = number_of_vertices();
-
-      std::vector<Point> points (first, last);
-      spatial_sort (points.begin(), points.end(), geom_traits());
-
-      // hints[i] is the vertex of the previously inserted point in level i.
-      // Thanks to spatial sort, they are better hints than what the hierarchy
-      // would give us.
-      Vertex_handle hints[maxlevel];
-      for (typename std::vector<Point>::const_iterator p = points.begin(), end = points.end();
-              p != end; ++p)
-      {
-          int vertex_level = random_level();
-
-          Vertex_handle v = hints[0] = hierarchy[0]->insert (*p, hints[0]);
-          Vertex_handle prev = v;
-
-          for (int level = 1; level <= vertex_level; ++level) {
-              v = hints[level] = hierarchy[level]->insert (*p, hints[level]);
-	      set_up_down(v, prev);
-              prev = v;
-          }
-      }
-      return number_of_vertices() - n;
-  }
-
-#ifndef CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
-private:
-  //top stands for tuple-or-pair
-  template <class Info>
-  const Point& top_get_first(const std::pair<Point,Info>& pair) const { return pair.first; }
-  template <class Info>
-  const Info& top_get_second(const std::pair<Point,Info>& pair) const { return pair.second; }
-  template <class Info>
-  const Point& top_get_first(const boost::tuple<Point,Info>& tuple) const { return boost::get<0>(tuple); }
-  template <class Info>
-  const Info& top_get_second(const boost::tuple<Point,Info>& tuple) const { return boost::get<1>(tuple); }
-
-  template <class Tuple_or_pair,class InputIterator>
-  std::ptrdiff_t insert_with_info(InputIterator first,InputIterator last)
-  {
-    size_type n = number_of_vertices();
-    std::vector<std::ptrdiff_t> indices;
-    std::vector<Point> points;
-    std::vector<typename Vertex::Info> infos;
-    std::ptrdiff_t index=0;
-    for (InputIterator it=first;it!=last;++it){
-      Tuple_or_pair value=*it;
-      points.push_back( top_get_first(value)  );
-      infos.push_back ( top_get_second(value) );
-      indices.push_back(index++);
-    }
-
-    typedef Spatial_sort_traits_adapter_3<Geom_traits,Point*> Search_traits;
-
-    spatial_sort(indices.begin(),indices.end(),Search_traits(&(points[0]),geom_traits()));
-
-
-    // hints[i] is the vertex of the previously inserted point in level i.
-    // Thanks to spatial sort, they are better hints than what the hierarchy
-    // would give us.
-    Vertex_handle hints[maxlevel];
-    for (typename std::vector<std::ptrdiff_t>::const_iterator
-      it = indices.begin(), end = indices.end();
-      it != end; ++it)
-    {
-        int vertex_level = random_level();
-
-        Vertex_handle v = hints[0] = hierarchy[0]->insert (points[*it], hints[0]);
-        v->info()=infos[*it];
-        Vertex_handle prev = v;
-
-        for (int level = 1; level <= vertex_level; ++level) {
-            v = hints[level] = hierarchy[level]->insert (points[*it], hints[level]);
-            set_up_down(v, prev);
-            prev = v;
-        }
-    }
-    return number_of_vertices() - n;
-  }
-
-public:
-
-  template < class InputIterator >
-  std::ptrdiff_t
-  insert( InputIterator first,
-          InputIterator last,
-          typename boost::enable_if<
-            boost::is_convertible<
-              typename std::iterator_traits<InputIterator>::value_type,
-              std::pair<Point,typename internal::Info_check<Vertex>::type>
-            > >::type* =NULL
-  )
-  {
-    return insert_with_info< std::pair<Point,typename internal::Info_check<Vertex>::type> >(first,last);
-  }
-
-  template <class  InputIterator_1,class InputIterator_2>
-  std::ptrdiff_t
-  insert( boost::zip_iterator< boost::tuple<InputIterator_1,InputIterator_2> > first,
-          boost::zip_iterator< boost::tuple<InputIterator_1,InputIterator_2> > last,
-          typename boost::enable_if<
-            boost::mpl::and_<
-              boost::is_convertible< typename std::iterator_traits<InputIterator_1>::value_type, Point >,
-              boost::is_convertible< typename std::iterator_traits<InputIterator_2>::value_type, typename internal::Info_check<Vertex>::type >
-            >
-          >::type* =NULL
-  )
-  {
-    return insert_with_info< boost::tuple<Point,typename internal::Info_check<Vertex>::type> >(first,last);
-  }
-#endif //CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
-
-  void remove(Vertex_handle v);
-
-  template < typename InputIterator >
-  size_type remove(InputIterator first, InputIterator beyond)
-  {
-    size_type n = number_of_vertices();
-    while (first != beyond) {
-      remove(*first);
-      ++first;
-    }
-    return n - number_of_vertices();
-  }
-
-  template < typename InputIterator >
-  size_type remove_cluster(InputIterator first, InputIterator beyond)
-  {
-    CGAL_triangulation_precondition(!this->does_repeat_in_range(first, beyond));
-    CGAL_triangulation_precondition(!this->infinite_vertex_in_range(first, beyond));
-    size_type n = this->number_of_vertices();
-    std::vector<Vertex_handle> vo(first, beyond), vc;
-    int l=0;
-    while(1) {
-      size_type n = vo.size();
-      if(n == 0) break;
-      for(size_type i=0; i<n; i++) {
-        if(vo[i]->up() != Vertex_handle()) vc.push_back(vo[i]->up());
-      }
-      hierarchy[l++]->remove_cluster(vo.begin(), vo.end());
-      std::swap(vo,vc);
-      vc.clear();
-    }
-    return n - this->number_of_vertices();
-  }
-
-#ifndef CGAL_NO_DEPRECATED_CODE
-  CGAL_DEPRECATED Vertex_handle move_point(Vertex_handle v, const Point & p);
-#endif
-
-  Vertex_handle move_if_no_collision(Vertex_handle v, const Point &p);
-  Vertex_handle move(Vertex_handle v, const Point &p);
-
-public: // some internal methods
-
-  // INSERT REMOVE DISPLACEMENT
-  // GIVING NEW FACES
-
-  template <class OutputItCells>
-  Vertex_handle insert_and_give_new_cells(const Point  &p, 
-                                          OutputItCells fit,
-                                          Cell_handle start = Cell_handle() );
-		
-  template <class OutputItCells>
-  Vertex_handle insert_and_give_new_cells(const Point& p,
-                                          OutputItCells /* fit */,
-                                          Vertex_handle hint)
-  {
-    return insert_and_give_new_cells(p, hint == Vertex_handle() ? 
-                                     this->infinite_cell() : hint->cell());			
-  }
-
-  template <class OutputItCells>
-  Vertex_handle insert_and_give_new_cells(const Point& p,
-                                          Locate_type lt,
-                                          Cell_handle c, int li, int lj, 
-                                          OutputItCells fit);
-
-  template <class OutputItCells>
-  void remove_and_give_new_cells(Vertex_handle v, 
-                                 OutputItCells fit);
-
-  template <class OutputItCells>
-  Vertex_handle move_if_no_collision_and_give_new_cells(Vertex_handle v, 
-                                                        const Point &p, OutputItCells fit);
-	
-public:	
-
-
-  //LOCATE
-  Cell_handle locate(const Point& p, Locate_type& lt, int& li, int& lj,
-                     Vertex_handle hint) const
-  {
-    return locate(p, lt, li, lj, hint == Vertex_handle() ? this->infinite_cell() : hint->cell());
-  }
-
-  Cell_handle locate(const Point& p, Vertex_handle hint) const
-  {
-    return locate(p, hint == Vertex_handle() ? this->infinite_cell() : hint->cell());
-  }
-
-  Cell_handle locate(const Point& p, Locate_type& lt, int& li, int& lj,
-                     Cell_handle start = Cell_handle ()) const;
-
-  Cell_handle locate(const Point& p, Cell_handle start = Cell_handle ()) const;
-
-  Vertex_handle
-  nearest_vertex(const Point& p, Cell_handle start = Cell_handle()) const;
-
-protected:
-
-  struct locs {
-      Cell_handle pos;
-      int li, lj;
-      Locate_type lt;
-  };
-
-  void locate(const Point& p, Locate_type& lt, int& li, int& lj,
-	      locs pos[maxlevel], Cell_handle start = Cell_handle ()) const;
-
-  int random_level();
-};
-
-
-template <class Tr >
-Triangulation_hierarchy_3<Tr>::
-Triangulation_hierarchy_3(const Geom_traits& traits)
-  : Tr_Base(traits)
-{
-  hierarchy[0] = this;
-  for(int i=1;i<maxlevel;++i)
-    hierarchy[i] = new Tr_Base(traits);
-}
-
-// copy constructor duplicates vertices and cells
-template <class Tr>
-Triangulation_hierarchy_3<Tr>::
-Triangulation_hierarchy_3(const Triangulation_hierarchy_3<Tr> &tr)
-    : Tr_Base(tr)
-{
-  hierarchy[0] = this;
-  for(int i=1; i<maxlevel; ++i)
-    hierarchy[i] = new Tr_Base(*tr.hierarchy[i]);
-
-  // up and down have been copied in straightforward way
-  // compute a map at lower level
-
-  std::map< Vertex_handle, Vertex_handle > V;
-
-  for( Finite_vertices_iterator it = hierarchy[0]->finite_vertices_begin(),
-       end = hierarchy[0]->finite_vertices_end(); it != end; ++it)
-    if (it->up() != Vertex_handle())
-      V[ it->up()->down() ] = it;
-
-  for(int j=1; j<maxlevel; ++j) {
-    for( Finite_vertices_iterator it = hierarchy[j]->finite_vertices_begin(),
-	 end = hierarchy[j]->finite_vertices_end(); it != end; ++it) {
-	// current it->down() pointer goes in original instead in copied triangulation
-	set_up_down(it, V[it->down()]);
-	// make map for next level
-	if (it->up() != Vertex_handle())
-	    V[ it->up()->down() ] = it;
-    }
-  }
-}
-
-template <class Tr>
-void
-Triangulation_hierarchy_3<Tr>::
-swap(Triangulation_hierarchy_3<Tr> &tr)
-{
-  Tr_Base::swap(tr);
-  for(int i=1; i<maxlevel; ++i)
-      std::swap(hierarchy[i], tr.hierarchy[i]);
-}
-
-template <class Tr>
-Triangulation_hierarchy_3<Tr>::
-~Triangulation_hierarchy_3()
-{
-  clear();
-  for(int i=1; i<maxlevel; ++i) {
-    delete hierarchy[i];
-  }
-}
-
-template <class Tr>
-void
-Triangulation_hierarchy_3<Tr>::
-clear()
-{
-  for(int i=0;i<maxlevel;++i)
-    hierarchy[i]->clear();
-}
-
-template <class Tr>
-bool
-Triangulation_hierarchy_3<Tr>::
-is_valid(bool verbose, int level) const
-{
-  bool result = true;
-
-  // verify correctness of triangulation at all levels
-  for(int i=0; i<maxlevel; ++i)
-	result = result && hierarchy[i]->is_valid(verbose, level);
-
-  // verify that lower level has no down pointers
-  for( Finite_vertices_iterator it = hierarchy[0]->finite_vertices_begin(),
-       end = hierarchy[0]->finite_vertices_end(); it != end; ++it)
-    result = result && (it->down() == Vertex_handle());
-
-  // verify that other levels has down pointer and reciprocal link is fine
-  for(int j=1; j<maxlevel; ++j)
-    for( Finite_vertices_iterator it = hierarchy[j]->finite_vertices_begin(),
-	 end = hierarchy[j]->finite_vertices_end(); it != end; ++it)
-      result = result && &*(it) == &*(it->down()->up());
-
-  // verify that other levels has down pointer and reciprocal link is fine
-  for(int k=0; k<maxlevel-1; ++k)
-    for( Finite_vertices_iterator it = hierarchy[k]->finite_vertices_begin(),
-	 end = hierarchy[k]->finite_vertices_end(); it != end; ++it)
-      result = result && ( it->up() == Vertex_handle() ||
-	        &*it == &*(it->up())->down() );
-
-  return result;
-}
-
-template <class Tr>
-typename Triangulation_hierarchy_3<Tr>::Vertex_handle
-Triangulation_hierarchy_3<Tr>::
-insert(const Point &p, Cell_handle start)
-{
-  int vertex_level = random_level();
-  Locate_type lt;
-  int i, j;
-  // locate using hierarchy
-  locs positions[maxlevel];
-  locate(p, lt, i, j, positions, start);
-  // insert at level 0
-  Vertex_handle vertex = hierarchy[0]->insert(p,
-	                                      positions[0].lt,
-	                                      positions[0].pos,
-	                                      positions[0].li,
-	                                      positions[0].lj);
-  Vertex_handle previous = vertex;
-  Vertex_handle first = vertex;
-
-  int level = 1;
-  while (level <= vertex_level ){
-      if (positions[level].pos == Cell_handle())
-          vertex = hierarchy[level]->insert(p);
-      else
-          vertex = hierarchy[level]->insert(p,
-	                                    positions[level].lt,
-	                                    positions[level].pos,
-	                                    positions[level].li,
-	                                    positions[level].lj);
-    set_up_down(vertex, previous);
-    previous=vertex;
-    level++;
-  }
-  return first;
-}
-
-template <class Tr>
-template <class OutputItCells>
-typename Triangulation_hierarchy_3<Tr>::Vertex_handle
-Triangulation_hierarchy_3<Tr>::
-insert_and_give_new_cells(const Point &p, OutputItCells fit, Cell_handle start)
-{
-  int vertex_level = random_level();
-  Locate_type lt;
-  int i, j;
-  // locate using hierarchy
-  locs positions[maxlevel];
-  locate(p, lt, i, j, positions, start);
-  // insert at level 0
-  Vertex_handle vertex = hierarchy[0]->insert_and_give_new_cells(p,
-                                                                 positions[0].lt,
-                                                                 positions[0].pos,
-                                                                 positions[0].li,
-                                                                 positions[0].lj,fit);
-  Vertex_handle previous = vertex;
-  Vertex_handle first = vertex;
-
-  int level = 1;
-  while (level <= vertex_level ){
-    if (positions[level].pos == Cell_handle())
-      vertex = hierarchy[level]->insert(p);
-    else
-      vertex = hierarchy[level]->insert(p,
-                                        positions[level].lt,
-                                        positions[level].pos,
-                                        positions[level].li,
-                                        positions[level].lj);
-    set_up_down(vertex, previous);
-    previous=vertex;
-    level++;
-  }
-  return first;
-}
-
-template <class Tr>
-typename Triangulation_hierarchy_3<Tr>::Vertex_handle
-Triangulation_hierarchy_3<Tr>::
-insert(const Point &p, Locate_type lt, Cell_handle loc, int li, int lj)
-{
-  int vertex_level = random_level();
-  // insert at level 0
-  Vertex_handle vertex = hierarchy[0]->insert(p,lt,loc,li,lj);
-  Vertex_handle previous = vertex;
-  Vertex_handle first = vertex;
-
-  if (vertex_level > 0) {
-    Locate_type lt;
-    int i, j;
-    // locate using hierarchy
-    locs positions[maxlevel];
-    locate(p, lt, i, j, positions, vertex->cell());
-
-    int level = 1;
-    while (level <= vertex_level ){
-      if (positions[level].pos == Cell_handle())
-	vertex = hierarchy[level]->insert(p);
-      else
-	vertex = hierarchy[level]->insert(p,
-	    positions[level].lt,
-	    positions[level].pos,
-	    positions[level].li,
-	    positions[level].lj);
-      set_up_down(vertex, previous);
-      previous=vertex;
-      level++;
-    }
-  }
-  return first;
-}
-
-template <class Tr>
-template <class OutputItCells>
-typename Triangulation_hierarchy_3<Tr>::Vertex_handle
-Triangulation_hierarchy_3<Tr>::
-insert_and_give_new_cells(const Point &p, Locate_type lt, Cell_handle loc, 
-  int li, int lj, OutputItCells fit)
-{
-  int vertex_level = random_level();
-  // insert at level 0
-  Vertex_handle vertex = 
-    hierarchy[0]->insert_and_give_new_cells(p,lt,loc,li,lj,fit);
-  Vertex_handle previous = vertex;
-  Vertex_handle first = vertex;
-
-  if (vertex_level > 0) {
-    Locate_type lt;
-    int i, j;
-    // locate using hierarchy
-    locs positions[maxlevel];
-    locate(p, lt, i, j, positions, vertex->cell());
-
-    int level = 1;
-    while (level <= vertex_level ){
-      if (positions[level].pos == Cell_handle())
-	vertex = hierarchy[level]->insert(p);
-      else
-	vertex = hierarchy[level]->insert(p,
-                                          positions[level].lt,
-                                          positions[level].pos,
-                                          positions[level].li,
-                                          positions[level].lj);
-      set_up_down(vertex, previous);
-      previous=vertex;
-      level++;
-    }
-  }
-  return first;
-}
-
-template <class Tr>
-void
-Triangulation_hierarchy_3<Tr>::
-remove(Vertex_handle v)
-{
-  CGAL_triangulation_precondition(v != Vertex_handle());
-  for (int l = 0; l < maxlevel; ++l) {
-    Vertex_handle u = v->up();
-    hierarchy[l]->remove(v);
-    if (u == Vertex_handle())
-	break;
-    v = u;
-  }
-}
-
-template <class Tr>
-template <class OutputItCells>
-void
-Triangulation_hierarchy_3<Tr>::
-remove_and_give_new_cells(Vertex_handle v, OutputItCells fit)
-{
-  CGAL_triangulation_precondition(v != Vertex_handle());
-  CGAL_triangulation_precondition(!is_infinite(v));
-  for (int l = 0; l < maxlevel; ++l) {
-    Vertex_handle u = v->up();
-    if(l) hierarchy[l]->remove(v);
-    else hierarchy[l]->remove_and_give_new_cells(v, fit);
-    if (u == Vertex_handle())
-	break;
-    v = u;
-  }
-}
-
-#ifndef CGAL_NO_DEPRECATED_CODE
-template < class Tr >
-typename Triangulation_hierarchy_3<Tr>::Vertex_handle
-Triangulation_hierarchy_3<Tr>::
-move_point(Vertex_handle v, const Point & p)
-{
-  CGAL_triangulation_precondition(v != Vertex_handle());
-  Vertex_handle old, ret;
-
-  for (std::size_t l = 0; l < maxlevel; ++l) {
-    Vertex_handle u = v->up();
-    Vertex_handle w = hierarchy[l]->move_point(v, p);
-    if (l == 0) {
-	ret = w;
-    }
-    else {
-        set_up_down(w, old);
-    }
-    if (u == Vertex_handle())
-	break;
-    old = w;
-    v = u;
-  }
-
-  return ret;
-}
-#endif
-
-template <class Tr>
-typename Triangulation_hierarchy_3<Tr>::Vertex_handle
-Triangulation_hierarchy_3<Tr>::
-move_if_no_collision(Vertex_handle v, const Point & p)
-{
-  CGAL_triangulation_precondition(!this->is_infinite(v));	
-  if(v->point() == p) return v;
-  Vertex_handle ans;
-  for (int l = 0; l < maxlevel; ++l) {
-    Vertex_handle u = v->up();
-    if(l) hierarchy[l]->move_if_no_collision(v, p);
-    else ans = hierarchy[l]->move_if_no_collision(v, p);
-    if(ans != v) return ans;
-    if (u == Vertex_handle())
-      break;
-    v = u;
-  }
-  return ans;
-}
-
-template <class Tr>
-typename Triangulation_hierarchy_3<Tr>::Vertex_handle
-Triangulation_hierarchy_3<Tr>::
-move(Vertex_handle v, const Point & p)
-{
-  CGAL_triangulation_precondition(!this->is_infinite(v));
-  if(v->point() == p) return v;
-  Vertex_handle w = move_if_no_collision(v,p);
-  if(w != v) {
-    remove(v);
-    return w;
-  }
-  return v;
-}
-
-template <class Tr>
-template <class OutputItCells>
-typename Triangulation_hierarchy_3<Tr>::Vertex_handle
-Triangulation_hierarchy_3<Tr>::
-move_if_no_collision_and_give_new_cells(
-  Vertex_handle v, const Point & p, OutputItCells fit)
-{
-  CGAL_triangulation_precondition(!is_infinite(v));	
-  if(v->point() == p) return v;
-  Vertex_handle ans;
-  for (int l = 0; l < maxlevel; ++l) {
-    Vertex_handle u = v->up();
-    if(l) hierarchy[l]->move_if_no_collision(v, p);
-    else ans = 
-           hierarchy[l]->move_if_no_collision_and_give_new_cells(v, p, fit);
-    if(ans != v) return ans;
-    if (u == Vertex_handle())
-      break;
-    v = u;
-  }
-  return ans;
-}
-
-template <class Tr>
-inline
-typename Triangulation_hierarchy_3<Tr>::Cell_handle
-Triangulation_hierarchy_3<Tr>::
-locate(const Point& p, Locate_type& lt, int& li, int& lj, Cell_handle start) const
-{
-  if (start != Cell_handle ())
-    return Tr_Base::locate (p, lt, li, lj, start);
-  locs positions[maxlevel];
-  locate(p, lt, li, lj, positions);
-  return positions[0].pos;
-}
-
-template <class Tr>
-inline
-typename Triangulation_hierarchy_3<Tr>::Cell_handle
-Triangulation_hierarchy_3<Tr>::
-locate(const Point& p, Cell_handle start) const
-{
-  if (start != Cell_handle ())
-    return Tr_Base::locate (p, start);
-  Locate_type lt;
-  int li, lj;
-  return locate(p, lt, li, lj);
-}
-
-template <class Tr>
-void
-Triangulation_hierarchy_3<Tr>::
-locate(const Point& p, Locate_type& lt, int& li, int& lj,
-       locs pos[maxlevel], Cell_handle start) const
-{
-  int level = maxlevel;
-
-  // find the highest level with enough vertices
-  while (hierarchy[--level]->number_of_vertices() < (size_type) minsize) {
-    if ( ! level)
-	break;  // do not go below 0
-  }
-
-  for (int i=level+1; i<maxlevel; ++i)
-      pos[i].pos = Cell_handle();
-
-  Cell_handle position = Cell_handle();
-  while(level > 0) {
-    // locate at that level from "position"
-    // result is stored in "position" for the next level
-    pos[level].pos = position = hierarchy[level]->locate(p,
-	                                                 pos[level].lt,
-	                                                 pos[level].li,
-	                                                 pos[level].lj,
-	                                                 position);
-    // find the nearest vertex.
-    Vertex_handle nearest = hierarchy[level]->nearest_vertex_in_cell(p, position);
-
-    // go at the same vertex on level below
-    nearest = nearest->down();
-    position = nearest->cell();                // incident cell
-    --level;
-  }
-
-  if (start != Cell_handle())
-    position = start;
-
-  pos[0].pos = hierarchy[0]->locate(p, lt, li, lj, position); // at level 0
-  pos[0].lt = lt;
-  pos[0].li = li;
-  pos[0].lj = lj;
-}
-
-template <class Tr>
-typename Triangulation_hierarchy_3<Tr>::Vertex_handle
-Triangulation_hierarchy_3<Tr>::
-nearest_vertex(const Point& p, Cell_handle start) const
-{
-    return Tr_Base::nearest_vertex(p, start != Cell_handle() ? start : locate(p));
-}
-
-template <class Tr>
-int
-Triangulation_hierarchy_3<Tr>::
-random_level()
-{
-  boost::geometric_distribution<> proba(1.0/ratio);
-  boost::variate_generator<boost::rand48&, boost::geometric_distribution<> > die(random, proba);
-
-  return (std::min)(die(), (int)maxlevel)-1;
-}
-
-} //namespace CGAL
-
-#endif // CGAL_TRIANGULATION_HIERARCHY_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_line_face_circulator_2.h b/3rdparty/CGAL-4.8/include/CGAL/Triangulation_line_face_circulator_2.h
deleted file mode 100644
index d57a622..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_line_face_circulator_2.h
+++ /dev/null
@@ -1,701 +0,0 @@
-// Copyright (c) 1997  INRIA Sophia-Antipolis (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
-// 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(s)     : Mariette Yvinec
-
-
-#ifndef CGAL_TRIANGULATION_LINE_FACE_CIRCULATOR_2_H
-#define CGAL_TRIANGULATION_LINE_FACE_CIRCULATOR_2_H
-
-#include <CGAL/circulator.h>
-#include <CGAL/Triangulation_utils_2.h>
-#include <CGAL/triangulation_assertions.h>
-// #include <CGAL/Triangulation_face_2.h>
-// #include <CGAL/Triangulation_vertex_2.h>
-// #include <CGAL/Triangulation_handles_2.h>
-
-namespace CGAL {
-
-
-template <class Triangulation_ > //  < class Gt, class Tds >
-class Triangulation_line_face_circulator_2
-  :   public Bidirectional_circulator_base< typename Triangulation_::Triangulation_data_structure::Face,
-	                                    std::ptrdiff_t,
-                                            std::size_t>,
-      public Triangulation_cw_ccw_2
-{
-public:
-
-  typedef Triangulation_line_face_circulator_2<Triangulation_> Line_face_circulator;
-  typedef Triangulation_                      Triangulation;
-  typedef typename Triangulation::Geom_traits  Gt;
-  typedef typename Triangulation_::Triangulation_data_structure Tds;
-  typedef typename Tds::Vertex                 Vertex;
-  typedef typename Tds::Face                   Face;
-  typedef typename Tds::Edge                   Edge;
-  typedef typename Tds::Vertex_handle          Vertex_handle;
-  typedef typename Tds::Face_handle            Face_handle;
-  typedef typename Tds::Face_circulator        Face_circulator;
-  
-  typedef typename Gt::Point_2 Point;
-  typedef typename Triangulation::Locate_type Locate_type;
-
-   enum State {undefined = -1,
-	       vertex_vertex,
-	       vertex_edge,
-	       edge_vertex,
-	       edge_edge};
-            
-private:
-  Face_handle pos;
-  const Triangulation* _tr;
-  State s;
-  int i;
-  Point p, q;
-            
-public:
-  Triangulation_line_face_circulator_2()
-    : pos(), _tr(NULL), s(undefined), i(-1)
-    {}
-            
-  Triangulation_line_face_circulator_2(Vertex_handle v,
-				       const Triangulation* tr,
-				       const Point& dir);
-
-  Triangulation_line_face_circulator_2(const Point& pp,
-				       const Point& qq,
-				       const Triangulation * t);
-           
-  Triangulation_line_face_circulator_2(const Point& pp,
-				       const Point& qq,
-				       const Face_handle& ff,
-				       const Triangulation* t); 
-
-  Line_face_circulator&   operator++() ;
-  Line_face_circulator&   operator--() ;
-  Line_face_circulator    operator++(int);
-  Line_face_circulator    operator--(int);
-  Face*                   operator->() {return &*pos;}
-  Face&                   operator*() { return *pos;}
-  Face_handle             handle() {return pos;}
-  operator Face_handle() const {return pos;}
-  bool  operator==(const Line_face_circulator& lfc) const;
-  bool  operator!=(const Line_face_circulator& lfc) const;
-
-  bool  operator==(const Face_handle& fh) const { return fh == pos; }
-  bool  operator!=(const Face_handle& fh) const { return fh != pos; }
-
-  bool  operator==(Nullptr_t  CGAL_triangulation_assertion_code(n)) const;
-  bool  operator!=(Nullptr_t n) const;
-  bool  is_empty() const;
-  bool  collinear_outside() const;
-  bool locate(const Point& t, Locate_type &lt,  int &li);
-
-  //private:
-  Triangulation_line_face_circulator_2(const Face_handle& face,
-				       int index,
-				       State state,
-				       const Triangulation * t,
-				       const Point& pp,
-				       const Point& qq);
-private:
-  void increment();
-  void decrement();
-};
-
-template < class Triangulation >
-inline
-bool
-operator==(typename Triangulation::Triangulation_data_structure::Face_handle fh, 
-	   Triangulation_line_face_circulator_2<Triangulation> fc)
-{
-  return (fc==fh);
-}
-
-template < class Triangulation >
-inline
-bool
-operator!=(typename Triangulation::Triangulation_data_structure::Face_handle fh, 
-	   Triangulation_line_face_circulator_2<Triangulation> fc)
-{
-  return (fc!=fh);
-}
-
-template < class Triangulation >
-Triangulation_line_face_circulator_2<Triangulation>::
-Triangulation_line_face_circulator_2(const Face_handle& face,
-				     int index,
-				     State state,
-				     const Triangulation * t,
-				     const Point& pp,
-				     const Point& qq)
-    : pos(face), _tr(t), s(state), i(index),  
-      p(pp), q(qq)            
-{
-  CGAL_triangulation_precondition(! t->xy_equal(p, q));
-}
-
-
-template < class Triangulation >
-Triangulation_line_face_circulator_2<Triangulation>::
-Triangulation_line_face_circulator_2(Vertex_handle v,
-				     const Triangulation* tr,
-				     const Point& dir)
-  :pos(), _tr(tr), s(undefined)
-  // begin at the face incident to v, traversed by the ray from v to
-  // dir 
-  // or null iterator
-{
-  CGAL_triangulation_precondition((!_tr->is_infinite(v)) &&
-			       (_tr->dimension() == 2)  &&
-			       (! _tr->xy_equal(v->point(),dir)));
-  p=v->point();
-  q=dir;
-
-  // find a finite vertex to the left of pq
-  // if there is no, the line_face_circulator is null
-  Face_circulator fc = _tr->incident_faces(v);
-  Face_circulator done(fc);
-  int ic = fc->index(v);
-  Vertex_handle  vt= fc->vertex(cw(ic));
-   while( _tr->is_infinite(vt) || 
-	  _tr->orientation(p, q, vt->point()) != LEFT_TURN) {
-    ++fc;
-    ic = fc->index(v);
-    vt= fc->vertex(cw(ic));
-    if (fc == done) { *this = Line_face_circulator(); return;}
-  }
-  
-  // now vt is finite and to the left of pq
-  Vertex_handle vr = fc-> vertex(ccw(ic));
-  Orientation pqr = RIGHT_TURN; // warning "pqr might be used uninitialized"
-  while ( (!_tr->is_infinite(vr)) &&
-	  (pqr = _tr->orientation(p, q, vr->point()))== LEFT_TURN ) {
-    --fc;
-    ic = fc->index(v);
-    vr = fc-> vertex(ccw(ic));
-  }
-
-  // vr can be infinite or finite. 
-  // If finite [pqr] is COLLINEAR or RIGHT_TURN
-  // reset vt and conclude.  vt is still finite and [pqt] still LEFT_TURN
-  ic = fc->index(v);
-  vt= fc->vertex(cw(ic));
-  CGAL_triangulation_assertion (_tr->orientation(p,q, vt->point())==
-				LEFT_TURN );
-  if (_tr->is_infinite(vr)) {
-    --fc;
-    ic = fc->index(v);
-    vr = fc->vertex(ccw(ic));
-    pqr = _tr->orientation(p, q, vr->point());
-    switch(pqr){
-    case RIGHT_TURN:
-    case COLLINEAR:
-      ++fc;
-      ic = fc->index(_tr->infinite_vertex());
-      pos = fc;
-      s = vertex_vertex;
-      i = ic;
-      break;
-    case LEFT_TURN:
-     *this = Line_face_circulator(); 
-     break;
-    }
-  }
-  else if (pqr == COLLINEAR) {
-    pos = fc;
-    s = vertex_vertex;
-    i = ccw(ic);
-   }
-  else { // pqr==RIGHT_TURN 
-    pos = fc;
-    s = vertex_edge;
-    i = ic ;
-  }
-  return;
-}
-  
-
-
-
-template < class Triangulation >
-Triangulation_line_face_circulator_2<Triangulation>::
-Triangulation_line_face_circulator_2(const Point& pp,
-				     const Point& qq,
-				     const Triangulation * t)
-     : pos(), _tr(t), s(undefined), p(pp), q(qq)
-  //begins at the  first finite face traversed be the oriented line pq
-{
-  Vertex_handle inf = _tr->infinite_vertex();
-  Face_circulator fc = _tr->incident_faces(inf),
-    done(fc);
-
-  i = fc->index(inf);
-  Point l = fc->vertex(cw(i))->point();
-  Point r = fc->vertex(ccw(i))->point();
-  Orientation pql = _tr->orientation(p, q, l);
-  Orientation pqr = _tr->orientation(p, q, r);
-            
-   do{
-    if( (pql == LEFT_TURN) && (pqr == RIGHT_TURN) ){
-      *this = ++Line_face_circulator( fc, i, vertex_edge, t, p, q);
-           return;
-    } 
-    else if ( (pql == LEFT_TURN) && (pqr == COLLINEAR) ){
-      --fc;
-      i = fc->index(inf);
-      Point  ss = fc->vertex(ccw(i))->point();
-      Orientation pqs  = _tr->orientation(p, q, ss);
-      Face_handle fn;
-      int in;
-      switch(pqs) {
-      case LEFT_TURN:
-	*this = Line_face_circulator();
-	return;
-      case COLLINEAR:
-	fn = fc->neighbor(i);
-	in = fn->index(fc);
-	*this = Line_face_circulator( fn, cw(in),vertex_vertex,t,p,q);
-	return;
-      case RIGHT_TURN:
-	fn = fc->neighbor(i);
-	Vertex_handle vr = fc->vertex(cw(i)); // vertex corresponding to r
-	in = fn->index(vr);
-	ss = fn->vertex(cw(in))->point();
-	pqs = _tr->orientation(p, q, ss);
-	Orientation pqss = RIGHT_TURN;
-	while ( pqs != LEFT_TURN) {
-	  pqss = pqs;
-	  fn = fn->neighbor(ccw(in));
-	  in = fn->index(vr);
-	  ss = fn->vertex(cw(in))->point();
-	  pqs = _tr->orientation(p, q, ss);
-	}
-	if (pqss == RIGHT_TURN)
-	  *this = Line_face_circulator( fn, in ,vertex_edge,t,p,q);
-	else // pqss = COLLINEAR
-	  *this = Line_face_circulator(fn,ccw(in),vertex_vertex,t,p,q);
-	return;
-      }
-    }
-
-    // going CCW around convex hull is CW around infinite vertex
-    --fc; 
-    l = r;
-    pql = pqr;
-    i = fc->index(inf);
-    r = fc->vertex(ccw(i))->point();
-    pqr = _tr->orientation(p, q, r);
-  }while(fc != done);
-
-   // if line (p,q) does not intersect the convex hull in an edge
-   // the circulator has a singular value
-   *this=Line_face_circulator();
-   return;
-}
-
-
-template < class Triangulation >
-Triangulation_line_face_circulator_2<Triangulation>::
-Triangulation_line_face_circulator_2(const Point& pp,
-				     const Point& qq,
-				     const Face_handle& ff,
-				     const Triangulation* t)
-  : pos(ff), _tr(t), s(undefined), p(pp), q(qq)
-  // precondition : face ff contain p
-  // the walk  begins at face ff if ff is a finite face traversed by the
-  // circulator
-  // if ff is finite but not traversed by the circulator
-  // (this happens when p is a vertex of ff or on an edge) :
-  // the circulator may be empty, or the walk begins at a finite face
-  // incident to p 
-  // if ff is infinite, the walk begin at the first finite face traversed
-{
-  CGAL_triangulation_precondition(_tr->is_infinite(ff) ||
-			      _tr->oriented_side(ff,p) != ON_NEGATIVE_SIDE);
-  int j;
-  if(_tr->is_infinite(pos)){
-    *this  = Line_face_circulator(p, q, t);
-    return;
-  }
-
-  // Test whether p lies on a vertex
-  for(j = 0; j < 3; j++){
-    if(_tr->xy_equal(pos->vertex(j)->point(), p)){
-      *this = Line_face_circulator( pos->vertex(j), t, q);
-      if( (!is_empty()) && _tr->is_infinite(pos )) --(*this);
-      return;
-    }
-  }
-            
-  // Test whether p lies on an edge
-  for(j = 0; j < 3; j++) {
-    if(_tr->orientation(pos->vertex(ccw(j))->point(),
-			pos->vertex(cw(j))->point(),
-			p) == COLLINEAR){
-      Orientation pqj =
-	_tr->orientation(p, q, pos->vertex(j)->point());
-      Orientation pqcwj =
-	_tr->orientation(p, q, pos->vertex(cw(j))->point());
-      switch(pqcwj) {
-      case COLLINEAR :
-	if(pqj == LEFT_TURN){
-	  s = vertex_vertex;
-	  i = cw(j);
-	  return;
-	} 
-	else if(! _tr->is_infinite(pos->neighbor(j))){
-	  Face_handle n = pos->neighbor(j);
-	  i = cw(n->index(pos)); 
-	  pos = n;
-	  s = vertex_vertex;
-	  return;
-	} else {
-           // singular value
-	  *this = Line_face_circulator();
-	  return;
-	}
-      case LEFT_TURN :
-	i = j;
-	s = (pqj == COLLINEAR) ? vertex_edge :  
-	  edge_edge;
-	break;
-      case RIGHT_TURN :
-	switch(pqj){
-	case COLLINEAR:
-	  s = edge_vertex;
-	  i = j;
-	  return;
-	case LEFT_TURN:
-	  s = edge_edge;
-	  i = ccw(j);
-	  return;
-	case RIGHT_TURN:
-	  s = edge_edge;
-	  i = cw(j);
-	  return;
-	}
-      }
-    }
-  }
-
-  // p lies in the interior of the face
-  Orientation orient[3];
-  for(j=0; j<3; j++) {
-    orient[j] =
-      _tr->orientation(p,q,pos->vertex(j)->point());
-  }
-  for(j=0; j<3; j++) {
-    if(orient[j] == COLLINEAR) {
-      i = j;
-      s = (orient[ccw(j)] == LEFT_TURN) ? edge_vertex : 
-	vertex_edge;
-      return;
-    }
-  }
-  s = edge_edge;
-  for(j=0; j<3; j++){
-    if(orient[j] == RIGHT_TURN){
-      i = (orient[ccw(j)] == RIGHT_TURN) ? j : cw(j);
-      return;
-    }
-  }
-}
-
-
-template < class Triangulation >
-inline
-void
-Triangulation_line_face_circulator_2<Triangulation>::
-increment()
-{
-  CGAL_triangulation_precondition(pos != Face_handle());
-  if(s == vertex_vertex || s == edge_vertex) {
-    Orientation o;
-    do{
-      Face_handle n = pos->neighbor(cw(i));
-      i = n->index(pos);
-      pos = n;
-      if (pos->vertex(i) == _tr->infinite_vertex()){
-	o = COLLINEAR;
-	i = cw(i);
-	break;
-      }
-      o = _tr->orientation(p, q, pos->vertex(i)->point());
-      i = cw(i);
-    }while(o == LEFT_TURN);
-            
-    if(o == COLLINEAR) {
-      s = vertex_vertex;
-      i = ccw(i);
-    } 
-    else {
-      s = vertex_edge;
-    }
-  } 
-  else {
-    Face_handle n = pos->neighbor(i);
-    int ni = n->index(pos);
-    pos = n ;
-    Orientation o = _tr->is_infinite(pos->vertex(ni)) ?
-      COLLINEAR :
-      _tr->orientation(p,q,pos->vertex(ni)->point());
-            
-    switch(o){
-    case LEFT_TURN:
-      s = edge_edge;
-      i = ccw(ni);
-      break;
-    case RIGHT_TURN:
-      s = edge_edge;
-      i = cw(ni);
-      break;
-    default:
-      s = edge_vertex;
-      i = ni;
-    }
-  }
-} 
-            
-template < class Triangulation >
-void
-Triangulation_line_face_circulator_2<Triangulation>::             
-decrement()
-{
-  CGAL_triangulation_precondition(pos != Face_handle());
-  if(s == vertex_vertex || s == vertex_edge) {
-    if(s == vertex_vertex){
-      i = cw(i);
-    }
-    Orientation o;
-    do{
-      Face_handle n = pos->neighbor(ccw(i));
-      i = n->index(pos);
-      pos = n;
-      if (pos->vertex(i) == _tr->infinite_vertex()){
-	o = COLLINEAR;
-	i = ccw(i);
-	break;
-      }
-      o = _tr->orientation(p, q, pos->vertex(i)->point());
-      i = ccw(i);
-    }while(o == LEFT_TURN);
-            
-    s = (o == COLLINEAR) ? vertex_vertex : edge_vertex;
-            
-  } 
-  else { // s == edge_edge  ||  s == edge_vertex
-    // the following is not nice. A better solution is to say
-    // that index i is at the vertex that is alone on one side of l(p,q)
-    if(s == edge_edge){
-      i = (_tr->orientation
-	   (p, q,
-	    pos->vertex(i)->point()) == 
-	   LEFT_TURN)
-	? cw(i) : ccw(i);
-    }
-    Face_handle n = pos->neighbor(i);
-    i = n->index(pos);
-    pos = n;
-    Orientation o = _tr->is_infinite(pos->vertex(i)) ?
-      COLLINEAR :
-      _tr->orientation(p, q, pos->vertex(i)->point());
-            
-    s = (o == COLLINEAR) ? vertex_edge : edge_edge;
-  }
-}
-
-template < class Triangulation >
-bool
-Triangulation_line_face_circulator_2<Triangulation>::
-locate(const Point& t, Locate_type &lt,  int &li)
-{
-  switch(s){            
-  case edge_edge:
-  case vertex_edge:
-    {
-      Orientation o =
-	_tr->orientation(pos->vertex(ccw(i))->point(),
-			 pos->vertex(cw(i))->point(),
-			 t);
-      if(o == RIGHT_TURN)      return false;
-      if(o == COLLINEAR){
-	lt = Triangulation::EDGE;
-	li = i;
-	return true;
-      }
-      lt = Triangulation::FACE;
-      li = 4;//li unused in this case
-      return true;
-    }
-  case vertex_vertex:
-    {
-      if(_tr->is_infinite(pos->vertex(i))){
-	CGAL_triangulation_assertion(
-	       _tr->orientation( pos->vertex(cw(i))->point(),
-				 pos->vertex(ccw(i))->point(),
-				 t) != LEFT_TURN);
-	lt = Triangulation::OUTSIDE_CONVEX_HULL;
-	li = i;
-	return true;
-      }
-      const Point &u = pos->vertex(cw(i))->point();
-      const Point &v = pos->vertex(i)->point();
-      // u == t  was detected earlier
-      if(_tr->compare_x(v,t)==EQUAL && 
-	 _tr->compare_y(v,t)==EQUAL){
-	lt = Triangulation::VERTEX;
-	li = i;
-	return true;
-      }
-      if(_tr->collinear_between(u, t, v)) {
-	lt = Triangulation::EDGE;
-	li = ccw(i);
-	return true;
-      }
-      return false;
-    }
-  default: // edge_vertex
-    {
-      if(_tr->is_infinite(pos->vertex(i))){
-	lt = Triangulation::OUTSIDE_CONVEX_HULL;
-	li = i;
-	return true;
-      }
-      if(_tr->xy_equal(t,pos->vertex(i) ->point()) ){
-	li = i;
-	lt = Triangulation::VERTEX;
-	return true;
-      }
-      if(_tr->collinear_between(p, t, pos->vertex(i)->point())) {
-	lt = Triangulation::FACE;
-	return true;
-      }
-      return false;
-    }
-  }
-}
-           
-template < class Triangulation >
-inline
-Triangulation_line_face_circulator_2<Triangulation>&
-Triangulation_line_face_circulator_2<Triangulation>::
-operator++()
-{
-  CGAL_triangulation_precondition( pos != Face_handle()) ;
-  increment();
-  return *this;
-}
-            
-template < class Triangulation >
-inline
-Triangulation_line_face_circulator_2<Triangulation>&
-Triangulation_line_face_circulator_2<Triangulation>::            
-operator--()
-{
-  CGAL_triangulation_precondition(pos != Face_handle()) ;
-  decrement();
-  return *this;
-}
-            
-template < class Triangulation >
-inline
-Triangulation_line_face_circulator_2<Triangulation>
-Triangulation_line_face_circulator_2<Triangulation>::             
-operator++(int)
-{
-  Line_face_circulator tmp(*this);
-  ++(*this);
-  return tmp;
-}
-            
-template < class Triangulation >
-inline
-Triangulation_line_face_circulator_2<Triangulation>
-Triangulation_line_face_circulator_2<Triangulation>::             
-operator--(int)
-{
-  Line_face_circulator tmp(*this);
-  --(*this);
-  return tmp;
-}
-
-template < class Triangulation >
-inline bool
-Triangulation_line_face_circulator_2<Triangulation>::    
-operator==(const Line_face_circulator& lfc) const
-{
-  CGAL_triangulation_precondition( pos != Face_handle() &&
-			       lfc.pos != Face_handle());
-  return ( pos == lfc.pos &&  _tr == lfc._tr &&
-            s== lfc.s && p==lfc.p && q==lfc.q);
-}
-
-template < class Triangulation >
-inline bool
-Triangulation_line_face_circulator_2<Triangulation>:: 
-operator!=(const Line_face_circulator& lfc) const
-{
-  return !(*this == lfc);
-}
-            
-template < class Triangulation >
-inline bool
-Triangulation_line_face_circulator_2<Triangulation>::   
-is_empty() const
-{
-  return pos == Face_handle();
-}
-
-template < class Triangulation >
-inline bool
-Triangulation_line_face_circulator_2<Triangulation>::            
-operator==(Nullptr_t CGAL_triangulation_assertion_code(n)) const
-{
-  CGAL_triangulation_assertion( n == NULL);
-  return pos == Face_handle();
-}
-            
-template < class Triangulation >
-inline bool
-Triangulation_line_face_circulator_2<Triangulation>::            
-operator!=(Nullptr_t n) const
-{
-  CGAL_triangulation_assertion( n == NULL);
-  return !(*this == n);
-}
-            
-template < class Triangulation >
-inline bool
-Triangulation_line_face_circulator_2<Triangulation>:: 
-collinear_outside() const
-{
-//   return (_tr->is_infinite(*this))
-//     && (s == vertex_vertex)
-//     && (! _tr->is_infinite((*this)->vertex(i)));
-  // return true if  the circulator is non null
-  // the line is collinear with a convex hull edge
-  // and the convex hull is on the left of the line
-  Face_handle fh = pos;
-  return ( s == vertex_vertex  &&
-	  (! _tr->is_infinite(fh)) &&
-           _tr->is_infinite(fh->neighbor(ccw(i))));
-}
-
-} //namespace CGAL
-#endif //CGAL_TRIANGULATION_LINE_FACE_CIRCULATOR_2_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Weighted_Minkowski_distance.h b/3rdparty/CGAL-4.8/include/CGAL/Weighted_Minkowski_distance.h
deleted file mode 100644
index 9b00dc0..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/Weighted_Minkowski_distance.h
+++ /dev/null
@@ -1,415 +0,0 @@
-// Copyright (c) 2002,2011 Utrecht University (The Netherlands).
-// 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
-// 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(s)     : Hans Tangelder (<hanst at cs.uu.nl>)
-
-// Note: Use p=0 to denote the weighted Linf-distance 
-// For 0<p<1 Lp is not a metric
-
-#ifndef CGAL_WEIGHTED_MINKOWSKI_DISTANCE_H
-#define CGAL_WEIGHTED_MINKOWSKI_DISTANCE_H
-
-#include <cmath>
-#include <vector>
-
-#include <CGAL/number_utils.h>
-#include <CGAL/Kd_tree_rectangle.h>
-#include <CGAL/internal/Get_dimension_tag.h>
-
-namespace CGAL {
-
-  template <class SearchTraits>
-  class Weighted_Minkowski_distance {
-    SearchTraits traits;
-    public:
-
-    typedef typename SearchTraits::Point_d Point_d;
-    typedef Point_d                        Query_item;
-    typedef typename SearchTraits::FT      FT;
-    typedef std::vector<FT>                Weight_vector;
-    typedef typename internal::Get_dimension_tag<SearchTraits>::Dimension Dimension;
-
-    private:
-
-    typedef typename SearchTraits::Cartesian_const_iterator_d Coord_iterator;
-    FT power; 
-
-    Weight_vector the_weights;
-
-    public:
-
-
-    // default constructor
-    Weighted_Minkowski_distance(const SearchTraits& traits_=SearchTraits())
-      : traits(traits_),power(2) 
-    {}
-
-    Weighted_Minkowski_distance(const int d,const SearchTraits& traits_=SearchTraits()) 
-      : traits(traits_),power(2), the_weights(d)
-    {
-      for (int i = 0; i < d; ++i) the_weights[i]=FT(1);
-    }
-
-    //default copy constructor and destructor
-    
-
-    Weighted_Minkowski_distance (FT pow, int dim,
-				 const Weight_vector& weights,
-                                 const SearchTraits& traits_=SearchTraits()) 
-      : traits(traits_),power(pow)
-    {
-      CGAL_assertion(power >= FT(0));
-      CGAL_assertion(dim==weights.size());
-      for (unsigned int i = 0; i < weights.size(); ++i)
-	CGAL_assertion(weights[i]>=FT(0));
-      the_weights.resize(weights.size());
-      the_weights = weights;
-    }
-
-    template <class InputIterator>
-    Weighted_Minkowski_distance (FT pow, int dim,
-				 InputIterator begin, InputIterator end,
-                                 const SearchTraits& traits_=SearchTraits()) 
-      : traits(traits_),power(pow)
-    {
-      CGAL_assertion(power >= FT(0));
-      the_weights.resize(dim);
-      std::copy(begin, end, the_weights.begin());
-      for (int i = 0; i < dim; ++i){
-	the_weights[i] = *begin;
-	++begin;
-	CGAL_assertion(the_weights[i]>=FT(0));
-      }
-      CGAL_assertion(begin == end);
-    }
-
-
-    inline FT transformed_distance(const Query_item& q, const Point_d& p) const {
-        return transformed_distance(q,p, Dimension());
-    }
-
-    //Dynamic version for runtime dimension
-    inline 
-    FT 
-    transformed_distance(const Query_item& q, const Point_d& p, Dynamic_dimension_tag) const
-    {
-      FT distance = FT(0);
-      typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=
-        traits.construct_cartesian_const_iterator_d_object();
-      Coord_iterator qit = construct_it(q),
-	             qe = construct_it(q,1), 
-	             pit = construct_it(p);
-      if (power == FT(0)) {
-	for (unsigned int i = 0; qit != qe; ++qit, ++i)
-	  if (the_weights[i] * CGAL::abs((*qit) - (*pit)) > distance)
-	    distance = the_weights[i] * CGAL::abs((*qit)-(*pit));
-      }
-      else
-	for (unsigned int i = 0; qit != qe; ++qit, ++i)
-	  distance += 
-	    the_weights[i] * std::pow(CGAL::abs((*qit)-(*pit)),power);
-      return distance;
-    }
-
-    //Generic version for DIM > 3
-    template <int DIM>
-    inline FT 
-    transformed_distance(const Query_item& q, const Point_d& p, Dimension_tag<DIM>) const
-    {
-      FT distance = FT(0);
-      typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=
-        traits.construct_cartesian_const_iterator_d_object();
-      Coord_iterator qit = construct_it(q),
-	             qe = construct_it(q,1), 
-	             pit = construct_it(p);
-      if (power == FT(0)) {
-	for (unsigned int i = 0; qit != qe; ++qit, ++i)
-	  if (the_weights[i] * CGAL::abs((*qit) - (*pit)) > distance)
-	    distance = the_weights[i] * CGAL::abs((*qit)-(*pit));
-      }
-      else
-	for (unsigned int i = 0; qit != qe; ++qit, ++i)
-	  distance += 
-	    the_weights[i] * std::pow(CGAL::abs((*qit)-(*pit)),power);
-      return distance;
-    }
-
-    //DIM = 2 loop unrolled
-    inline FT 
-    transformed_distance(const Query_item& q, const Point_d& p, Dimension_tag<2>) const
-    {
-      FT distance = FT(0);
-      typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=
-        traits.construct_cartesian_const_iterator_d_object();
-      Coord_iterator qit = construct_it(q),
-	             pit = construct_it(p);
-      if (power == FT(0)) {
-	  if (the_weights[0] * CGAL::abs((*qit) - (*pit)) > distance)
-	    distance = the_weights[0] * CGAL::abs((*qit)-(*pit));
-          qit++;pit++;
-          if (the_weights[1] * CGAL::abs((*qit) - (*pit)) > distance)
-	    distance = the_weights[1] * CGAL::abs((*qit)-(*pit));
-      }
-      else{
-	  distance += 
-	    the_weights[0] * std::pow(CGAL::abs((*qit)-(*pit)),power);
-          qit++;pit++;
-          distance += 
-	    the_weights[1] * std::pow(CGAL::abs((*qit)-(*pit)),power);
-      }
-      return distance;
-    }
-
-    //DIM = 3 loop unrolled
-    inline FT 
-    transformed_distance(const Query_item& q, const Point_d& p, Dimension_tag<3>) const
-    {
-      FT distance = FT(0);
-      typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=
-        traits.construct_cartesian_const_iterator_d_object();
-      Coord_iterator qit = construct_it(q),
-	             pit = construct_it(p);
-      if (power == FT(0)) {
-	  if (the_weights[0] * CGAL::abs((*qit) - (*pit)) > distance)
-	    distance = the_weights[0] * CGAL::abs((*qit)-(*pit));
-          qit++;pit++;
-          if (the_weights[1] * CGAL::abs((*qit) - (*pit)) > distance)
-	    distance = the_weights[1] * CGAL::abs((*qit)-(*pit));
-          qit++;pit++;
-          if (the_weights[2] * CGAL::abs((*qit) - (*pit)) > distance)
-	    distance = the_weights[2] * CGAL::abs((*qit)-(*pit));
-      }
-      else{
-	  distance += 
-	    the_weights[0] * std::pow(CGAL::abs((*qit)-(*pit)),power);
-          qit++;pit++;
-          distance += 
-	    the_weights[1] * std::pow(CGAL::abs((*qit)-(*pit)),power);
-          qit++;pit++;
-          distance += 
-	    the_weights[2] * std::pow(CGAL::abs((*qit)-(*pit)),power);
-      }
-      return distance;
-    }
-
-    inline 
-    FT 
-    min_distance_to_rectangle(const Query_item& q,
-			      const Kd_tree_rectangle<FT,Dimension>& r) const 
-    {
-      FT distance = FT(0);
-      typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=
-        traits.construct_cartesian_const_iterator_d_object();
-      Coord_iterator qit = construct_it(q), qe = construct_it(q,1);
-      if (power == FT(0))
-	{
-	  for (unsigned int i = 0; qit != qe; ++qit, ++i) {
-	    if (the_weights[i]*(r.min_coord(i) - 
-				(*qit)) > distance)
-	      distance = the_weights[i] * (r.min_coord(i)-
-					   (*qit));
-	    if (the_weights[i] * ((*qit) - r.max_coord(i)) > 
-		distance)
-	      distance = the_weights[i] * 
-		((*qit)-r.max_coord(i));
-	  }
-	}
-      else
-	{
-	  for (unsigned int i = 0; qit != qe; ++qit, ++i) {
-	    if ((*qit) < r.min_coord(i))
-	      distance += the_weights[i] * 
-		std::pow(r.min_coord(i)-(*qit),power);
-	    if ((*qit) > r.max_coord(i))
-	      distance += the_weights[i] * 
-		std::pow((*qit)-r.max_coord(i),power);
-	  }
-	};
-      return distance;
-    }
-
-    inline 
-    FT 
-    min_distance_to_rectangle(const Query_item& q,
-			      const Kd_tree_rectangle<FT,Dimension>& r,std::vector<FT>& dists) {
-      FT distance = FT(0);
-      typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=
-        traits.construct_cartesian_const_iterator_d_object();
-      Coord_iterator qit = construct_it(q), qe = construct_it(q,1);
-      if (power == FT(0))
-	{
-	  for (unsigned int i = 0; qit != qe; ++qit, ++i) {
-	    if (the_weights[i]*(r.min_coord(i) - 
-				(*qit)) > distance){
-              dists[i] = (r.min_coord(i)-
-		(*qit));
-	      distance = the_weights[i] * dists[i];
-            }
-	    if (the_weights[i] * ((*qit) - r.max_coord(i)) > 
-		distance){
-                  dists[i] = 
-		((*qit)-r.max_coord(i));
-	      distance = the_weights[i] * dists[i];
-            }
-	  }
-	}
-      else
-	{
-	  for (unsigned int i = 0; qit != qe; ++qit, ++i) {
-	    if ((*qit) < r.min_coord(i)){
-              dists[i] = r.min_coord(i)-(*qit);
-	      distance += the_weights[i] * 
-		std::pow(dists[i],power);
-            }
-	    if ((*qit) > r.max_coord(i)){
-              dists[i] = (*qit)-r.max_coord(i);
-	      distance += the_weights[i] * 
-		std::pow(dists[i],power);
-            }
-	  }
-	};
-      return distance;
-    }
-
-    inline 
-    FT
-    max_distance_to_rectangle(const Query_item& q,
-			      const Kd_tree_rectangle<FT,Dimension>& r) const {
-      FT distance=FT(0);
-      typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=
-        traits.construct_cartesian_const_iterator_d_object();
-      Coord_iterator qit = construct_it(q), qe = construct_it(q,1);
-      if (power == FT(0))
-	{
-	  for (unsigned int i = 0; qit != qe; ++qit, ++i) {
-	    if ((*qit) >= (r.min_coord(i) + 
-			 r.max_coord(i))/FT(2.0)) {
-	      if (the_weights[i] * ((*qit) - 
-				    r.min_coord(i)) > distance)
-		distance = the_weights[i] * 
-		  ((*qit)-r.min_coord(i));
-	      else
-		if (the_weights[i] * 
-		    (r.max_coord(i) - (*qit)) > distance)
-		  distance = the_weights[i] * 
-		    ( r.max_coord(i)-(*qit));
-            }
-	  }
-	}
-      else
-	{
-	  for (unsigned int i = 0; qit != qe; ++qit, ++i) {
-	    if ((*qit) <= (r.min_coord(i)+r.max_coord(i))/FT(2.0))
-	      distance += the_weights[i] * std::pow(r.max_coord(i)-(*qit),power);
-	    else
-	      distance += the_weights[i] * std::pow((*qit)-r.min_coord(i),power);
-	  }
-	};
-      return distance;
-    }
-
-     inline 
-    FT
-    max_distance_to_rectangle(const Query_item& q,
-			      const Kd_tree_rectangle<FT,Dimension>& r,std::vector<FT>& dists) {
-      FT distance=FT(0);
-      typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=
-        traits.construct_cartesian_const_iterator_d_object();
-      Coord_iterator qit = construct_it(q), qe = construct_it(q,1);
-      if (power == FT(0))
-	{
-	  for (unsigned int i = 0; qit != qe; ++qit, ++i) {
-	    if ((*qit) >= (r.min_coord(i) + 
-			 r.max_coord(i))/FT(2.0)) {
-	      if (the_weights[i] * ((*qit) - 
-				    r.min_coord(i)) > distance){
-                dists[i] = (*qit)-r.min_coord(i);
-		distance = the_weights[i] * 
-		  (dists[i]);
-              }
-	      else
-		if (the_weights[i] * 
-		    (r.max_coord(i) - (*qit)) > distance){
-                      dists[i] =  r.max_coord(i)-(*qit);
-		  distance = the_weights[i] * 
-		    (dists[i]);
-                }
-            }
-	  }
-	}
-      else
-	{
-	  for (unsigned int i = 0; qit != qe; ++qit, ++i) {
-	    if ((*qit) <= (r.min_coord(i)+r.max_coord(i))/FT(2.0)){
-              dists[i] = r.max_coord(i)-(*qit);
-	      distance += the_weights[i] * std::pow(dists[i],power);
-            }
-	    else{
-              dists[i] = (*qit)-r.min_coord(i);
-	      distance += the_weights[i] * std::pow(dists[i],power);
-            }
-	  }
-	};
-      return distance;
-    }
-    
-    inline 
-    FT 
-    new_distance(FT dist, FT old_off, FT new_off,
-		 int cutting_dimension)  const 
-    {
-      FT new_dist;
-      if (power == FT(0))
-	{
-	  if (the_weights[cutting_dimension]*CGAL::abs(new_off) 
-	      > dist) 
-	    new_dist= 
-	      the_weights[cutting_dimension]*CGAL::abs(new_off);
-	  else new_dist=dist;
-	}
-      else
-	{
-	  new_dist = dist + the_weights[cutting_dimension] * 
-	    (std::pow(CGAL::abs(new_off),power)-std::pow(CGAL::abs(old_off),power));
-	}
-      return new_dist;
-    }
-    
-    inline 
-    FT 
-    transformed_distance(FT d) const 
-    {
-      if (power <= FT(0)) return d;
-      else return std::pow(d,power);
-      
-    }
-    
-    inline 
-    FT 
-    inverse_of_transformed_distance(FT d) const 
-    {
-      if (power <= FT(0)) return d;
-      else return std::pow(d,1/power);
-      
-    }
-
-  }; // class Weighted_Minkowski_distance
-
-} // namespace CGAL
-
-#endif // CGAL_WEIGHTED_MINKOWSKI_DISTANCE_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/assertions.h b/3rdparty/CGAL-4.8/include/CGAL/assertions.h
deleted file mode 100644
index 0370531..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/assertions.h
+++ /dev/null
@@ -1,353 +0,0 @@
-// Copyright (c) 1999  
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved. 
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Geert-Jan Giezeman and Sven Schoenherr
-
-#include <CGAL/config.h>
-
-#ifndef CGAL_ASSERTIONS_H
-#define CGAL_ASSERTIONS_H
-
-#include <CGAL/export/CGAL.h>
-
-// #include <CGAL/assertions_behaviour.h> // for backward compatibility
-
-#ifndef CGAL_NO_ASSERTIONS 
-#ifdef CGAL_CFG_NO_CPP0X_STATIC_ASSERT
-#include <boost/static_assert.hpp>
-#endif
-#endif
-
-namespace CGAL {
-
-// function declarations
-// =====================
-// failure functions
-// -----------------
-CGAL_EXPORT void assertion_fail      ( const char*, const char*, int, const char* = "") CGAL_NORETURN;
-CGAL_EXPORT void precondition_fail   ( const char*, const char*, int, const char* = "") CGAL_NORETURN;
-CGAL_EXPORT void postcondition_fail  ( const char*, const char*, int, const char* = "") CGAL_NORETURN;
-
-// warning function
-// ----------------
-CGAL_EXPORT
-void warning_fail( const char*, const char*, int, const char* = "");
-
-
-// The following declarations are needed first, before assertions are used.
-// ---------------------------------------------------------------------
-template < typename T > class Uncertain;
-inline bool possibly(bool b);
-inline bool possibly(Uncertain<bool> c);
-
-
-// macro definitions
-// =================
-// assertions
-// ----------
-
-#ifdef NDEBUG
-#  ifndef CGAL_NDEBUG
-#    define CGAL_NDEBUG
-#  endif
-#endif
-
-#ifdef CGAL_NDEBUG
-#  define CGAL_NO_ASSERTIONS
-#  define CGAL_NO_PRECONDITIONS
-#  define CGAL_NO_POSTCONDITIONS
-#  define CGAL_NO_WARNINGS
-#endif
-
-#if defined(CGAL_NO_ASSERTIONS)
-#  define CGAL_assertion(EX) (static_cast<void>(0))
-#  define CGAL_destructor_assertion(EX) (static_cast<void>(0))
-#  define CGAL_assertion_msg(EX,MSG) (static_cast<void>(0))
-#  define CGAL_assertion_code(CODE)
-#  ifdef CGAL_ASSUME
-#    define CGAL_assume(EX) CGAL_ASSUME(EX)
-#    define CGAL_assume_code(CODE) CODE
-#  else // not def CGAL_ASSUME
-#    define CGAL_assume(EX)  CGAL_assertion(EX)
-#    define CGAL_assume_code(CODE) CGAL_assertion_code(CODE)
-#  endif // not def CGAL_ASSUME
-#else // no CGAL_NO_ASSERTIONS
-#  define CGAL_assertion(EX) \
-   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__))
-#  define CGAL_destructor_assertion(EX) \
-   (CGAL::possibly(EX)||std::uncaught_exception()?(static_cast<void>(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__))
-#  define CGAL_assertion_msg(EX,MSG) \
-   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG))
-#  define CGAL_assertion_code(CODE) CODE
-#  define CGAL_assume(EX) CGAL_assertion(EX)
-#  define CGAL_assume_code(CODE) CGAL_assertion_code(CODE)
-#endif // no CGAL_NO_ASSERTIONS
-
-#ifndef CGAL_CFG_NO_CPP0X_STATIC_ASSERT
-
-#  if defined(CGAL_NO_ASSERTIONS)
-
-#    define CGAL_static_assertion(EX) \
-     static_assert(true, "")
-
-#    define CGAL_static_assertion_msg(EX,MSG) \
-     static_assert(true, "")
-
-#  else // no CGAL_NO_ASSERTIONS
-
-#    define CGAL_static_assertion(EX) \
-     static_assert(EX, #EX)
-
-#    define CGAL_static_assertion_msg(EX,MSG) \
-     static_assert(EX, MSG)
-
-#  endif // no CGAL_NO_ASSERTIONS
-
-#else // if CGAL_CFG_NO_CPP0X_STATIC_ASSERT is true
-
-#  if defined(CGAL_NO_ASSERTIONS)
-
-#    define CGAL_static_assertion(EX) \
-     BOOST_STATIC_ASSERT(true) CGAL_UNUSED
-  
-#    define CGAL_static_assertion_msg(EX,MSG) \
-     BOOST_STATIC_ASSERT(true) CGAL_UNUSED
-
-#  else // no CGAL_NO_ASSERTIONS
-
-#    define CGAL_static_assertion(EX) \
-     BOOST_STATIC_ASSERT(EX) CGAL_UNUSED
-  
-#    define CGAL_static_assertion_msg(EX,MSG) \
-     BOOST_STATIC_ASSERT(EX) CGAL_UNUSED
-
-#  endif // no CGAL_NO_ASSERTIONS
-
-#endif // if CGAL_CFG_NO_CPP0X_STATIC_ASSERT is true
-  
-#if defined(CGAL_NO_ASSERTIONS) || !defined(CGAL_CHECK_EXACTNESS)
-#  define CGAL_exactness_assertion(EX) (static_cast<void>(0))
-#  define CGAL_exactness_assertion_msg(EX,MSG) (static_cast<void>(0))
-#  define CGAL_exactness_assertion_code(CODE)
-#else
-#  define CGAL_exactness_assertion(EX) \
-   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__))
-#  define CGAL_exactness_assertion_msg(EX,MSG) \
-   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG))
-#  define CGAL_exactness_assertion_code(CODE) CODE
-#endif // CGAL_NO_ASSERTIONS
-
-#if defined(CGAL_NO_ASSERTIONS) || !defined(CGAL_CHECK_EXPENSIVE)
-#  define CGAL_expensive_assertion(EX) (static_cast<void>(0))
-#  define CGAL_expensive_assertion_msg(EX,MSG) (static_cast<void>(0))
-#  define CGAL_expensive_assertion_code(CODE)
-#else
-#  define CGAL_expensive_assertion(EX) \
-   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__))
-#  define CGAL_expensive_assertion_msg(EX,MSG) \
-   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG))
-#  define CGAL_expensive_assertion_code(CODE) CODE
-#endif // CGAL_NO_ASSERTIONS
-
-#if defined(CGAL_NO_ASSERTIONS) || !defined(CGAL_CHECK_EXACTNESS) || !defined(CGAL_CHECK_EXPENSIVE)
-#  define CGAL_expensive_exactness_assertion(EX) (static_cast<void>(0))
-#  define CGAL_expensive_exactness_assertion_msg(EX,MSG) (static_cast<void>(0))
-#  define CGAL_expensive_exactness_assertion_code(CODE)
-#else
-#  define CGAL_expensive_exactness_assertion(EX) \
-   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__))
-#  define CGAL_expensive_exactness_assertion_msg(EX,MSG) \
-   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG))
-#  define CGAL_expensive_exactness_assertion_code(CODE) CODE
-#endif // CGAL_NO_ASSERTIONS
-
-
-// preconditions
-// -------------
-
-#if defined(CGAL_NO_PRECONDITIONS)
-#  define CGAL_precondition(EX) (static_cast<void>(0))
-#  define CGAL_precondition_msg(EX,MSG) (static_cast<void>(0))
-#  define CGAL_precondition_code(CODE)
-#else
-#  define CGAL_precondition(EX) \
-   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__))
-#  define CGAL_precondition_msg(EX,MSG) \
-   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG))
-#  define CGAL_precondition_code(CODE) CODE
-#endif // CGAL_NO_PRECONDITIONS
-
-#if defined(CGAL_NO_PRECONDITIONS) || !defined(CGAL_CHECK_EXACTNESS)
-#  define CGAL_exactness_precondition(EX) (static_cast<void>(0))
-#  define CGAL_exactness_precondition_msg(EX,MSG) (static_cast<void>(0))
-#  define CGAL_exactness_precondition_code(CODE)
-#else
-#  define CGAL_exactness_precondition(EX) \
-   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__))
-#  define CGAL_exactness_precondition_msg(EX,MSG) \
-   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG))
-#  define CGAL_exactness_precondition_code(CODE) CODE
-#endif // CGAL_NO_PRECONDITIONS
-
-#if defined(CGAL_NO_PRECONDITIONS) || !defined(CGAL_CHECK_EXPENSIVE)
-#  define CGAL_expensive_precondition(EX) (static_cast<void>(0))
-#  define CGAL_expensive_precondition_msg(EX,MSG) (static_cast<void>(0))
-#  define CGAL_expensive_precondition_code(CODE)
-#else
-#  define CGAL_expensive_precondition(EX) \
-   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__))
-#  define CGAL_expensive_precondition_msg(EX,MSG) \
-   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG))
-#  define CGAL_expensive_precondition_code(CODE) CODE
-#endif // CGAL_NO_PRECONDITIONS
-
-#if defined(CGAL_NO_PRECONDITIONS) || !defined(CGAL_CHECK_EXACTNESS) || !defined(CGAL_CHECK_EXPENSIVE) 
-#  define CGAL_expensive_exactness_precondition(EX) (static_cast<void>(0))
-#  define CGAL_expensive_exactness_precondition_msg(EX,MSG) (static_cast<void>(0))
-#  define CGAL_expensive_exactness_precondition_code(CODE)
-#else
-#  define CGAL_expensive_exactness_precondition(EX) \
-   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__))
-#  define CGAL_expensive_exactness_precondition_msg(EX,MSG) \
-   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG))
-#  define CGAL_expensive_exactness_precondition_code(CODE) CODE
-#endif // CGAL_NO_PRECONDITIONS
-
-
-// postconditions
-// --------------
-
-#if defined(CGAL_NO_POSTCONDITIONS)
-#  define CGAL_postcondition(EX) (static_cast<void>(0))
-#  define CGAL_postcondition_msg(EX,MSG) (static_cast<void>(0))
-#  define CGAL_postcondition_code(CODE)
-#else
-#  define CGAL_postcondition(EX) \
-   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__))
-#  define CGAL_postcondition_msg(EX,MSG) \
-   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG))
-#  define CGAL_postcondition_code(CODE) CODE
-#endif // CGAL_NO_POSTCONDITIONS
-
-#if defined(CGAL_NO_POSTCONDITIONS) || !defined(CGAL_CHECK_EXACTNESS)
-#  define CGAL_exactness_postcondition(EX) (static_cast<void>(0))
-#  define CGAL_exactness_postcondition_msg(EX,MSG) (static_cast<void>(0))
-#  define CGAL_exactness_postcondition_code(CODE)
-#else
-#  define CGAL_exactness_postcondition(EX) \
-   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__))
-#  define CGAL_exactness_postcondition_msg(EX,MSG) \
-   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG))
-#  define CGAL_exactness_postcondition_code(CODE) CODE
-#endif // CGAL_NO_POSTCONDITIONS
-
-#if defined(CGAL_NO_POSTCONDITIONS) || !defined(CGAL_CHECK_EXPENSIVE)
-#  define CGAL_expensive_postcondition(EX) (static_cast<void>(0))
-#  define CGAL_expensive_postcondition_msg(EX,MSG) (static_cast<void>(0))
-#  define CGAL_expensive_postcondition_code(CODE)
-#else
-#  define CGAL_expensive_postcondition(EX) \
-   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__))
-#  define CGAL_expensive_postcondition_msg(EX,MSG) \
-   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG))
-#  define CGAL_expensive_postcondition_code(CODE) CODE
-#endif // CGAL_NO_POSTCONDITIONS
-
-#if defined(CGAL_NO_POSTCONDITIONS) || !defined(CGAL_CHECK_EXACTNESS) || !defined(CGAL_CHECK_EXPENSIVE)
-#  define CGAL_expensive_exactness_postcondition(EX) (static_cast<void>(0))
-#  define CGAL_expensive_exactness_postcondition_msg(EX,MSG) (static_cast<void>(0))
-#  define CGAL_expensive_exactness_postcondition_code(CODE)
-#else
-#  define CGAL_expensive_exactness_postcondition(EX) \
-   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__))
-#  define CGAL_expensive_exactness_postcondition_msg(EX,MSG) \
-   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG))
-#  define CGAL_expensive_exactness_postcondition_code(CODE) CODE
-#endif // CGAL_NO_POSTCONDITIONS
-
-
-// warnings
-// --------
-
-#if defined(CGAL_NO_WARNINGS)
-#  define CGAL_warning(EX) (static_cast<void>(0))
-#  define CGAL_warning_msg(EX,MSG) (static_cast<void>(0))
-#  define CGAL_warning_code(CODE)
-#else
-#  define CGAL_warning(EX) \
-   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__))
-#  define CGAL_warning_msg(EX,MSG) \
-   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG))
-#  define CGAL_warning_code(CODE) CODE
-#endif // CGAL_NO_WARNINGS
-
-#if defined(CGAL_NO_WARNINGS) || !defined(CGAL_CHECK_EXACTNESS)
-#  define CGAL_exactness_warning(EX) (static_cast<void>(0))
-#  define CGAL_exactness_warning_msg(EX,MSG) (static_cast<void>(0))
-#  define CGAL_exactness_warning_code(CODE)
-#else
-#  define CGAL_exactness_warning(EX) \
-   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__))
-#  define CGAL_exactness_warning_msg(EX,MSG) \
-   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG))
-#  define CGAL_exactness_warning_code(CODE) CODE
-#endif // CGAL_NO_WARNINGS
-
-#if defined(CGAL_NO_WARNINGS) || !defined(CGAL_CHECK_EXPENSIVE)
-#  define CGAL_expensive_warning(EX) (static_cast<void>(0))
-#  define CGAL_expensive_warning_msg(EX,MSG) (static_cast<void>(0))
-#  define CGAL_expensive_warning_code(CODE)
-#else
-#  define CGAL_expensive_warning(EX) \
-   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__))
-#  define CGAL_expensive_warning_msg(EX,MSG) \
-   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG))
-#  define CGAL_expensive_warning_code(CODE) CODE
-#endif // CGAL_NO_WARNINGS
-
-#if defined(CGAL_NO_WARNINGS) || !defined(CGAL_CHECK_EXACTNESS) || !defined(CGAL_CHECK_EXPENSIVE)
-#  define CGAL_expensive_exactness_warning(EX) (static_cast<void>(0))
-#  define CGAL_expensive_exactness_warning_msg(EX,MSG) (static_cast<void>(0))
-#  define CGAL_expensive_exactness_warning_code(CODE)
-#else
-#  define CGAL_expensive_exactness_warning(EX) \
-   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__))
-#  define CGAL_expensive_exactness_warning_msg(EX,MSG) \
-   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG))
-#  define CGAL_expensive_exactness_warning_code(CODE) CODE
-#endif // CGAL_NO_WARNINGS
-
-// CGAL error
-#define CGAL_error_msg(MSG) ::CGAL::assertion_fail( "", __FILE__, __LINE__, MSG )
-#define CGAL_error()        ::CGAL::assertion_fail( "", __FILE__, __LINE__ )
-
-} //namespace CGAL
-
-// This comes last as it is dependant on the macros to be defined.
-// But the macros need CGAL::possibly().
-#include <CGAL/Uncertain.h>
-
-#ifdef CGAL_HEADER_ONLY
-#include <CGAL/assertions_impl.h>
-#endif // CGAL_HEADER_ONLY
-
-#endif // CGAL_ASSERTIONS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/bilateral_smooth_point_set.h b/3rdparty/CGAL-4.8/include/CGAL/bilateral_smooth_point_set.h
deleted file mode 100644
index 53c5b64..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/bilateral_smooth_point_set.h
+++ /dev/null
@@ -1,652 +0,0 @@
-// Copyright (c) 2013-06  INRIA Sophia-Antipolis (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
-// 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(s) : Shihao Wu, Clement Jamin, Pierre Alliez 
-
-#ifndef CGAL_BILATERAL_SMOOTH_POINT_SET_H
-#define CGAL_BILATERAL_SMOOTH_POINT_SET_H
-
-#include <CGAL/Search_traits_3.h>
-#include <CGAL/Orthogonal_k_neighbor_search.h>
-#include <CGAL/property_map.h>
-#include <CGAL/point_set_processing_assertions.h>
-#include <CGAL/Point_with_normal_3.h>
-
-#include <iterator>
-#include <set>
-#include <algorithm>
-#include <cmath>
-#include <ctime>
-#include <CGAL/Real_timer.h>
-#include <CGAL/Memory_sizer.h>
-
-#include <boost/version.hpp>
-#if BOOST_VERSION >= 104000
-#include <boost/property_map/property_map.hpp>
-#else
-#include <boost/property_map.hpp>
-#endif
-
-#ifdef CGAL_LINKED_WITH_TBB
-#include <tbb/parallel_for.h>
-#include <tbb/blocked_range.h>
-#include <tbb/scalable_allocator.h>  
-#endif // CGAL_LINKED_WITH_TBB
-
-// Default allocator: use TBB allocators if available
-#ifdef CGAL_LINKED_WITH_TBB
-# define CGAL_PSP3_DEFAULT_ALLOCATOR tbb::scalable_allocator
-#else // CGAL_LINKED_WITH_TBB
-# define CGAL_PSP3_DEFAULT_ALLOCATOR std::allocator
-#endif // CGAL_LINKED_WITH_TBB
-
-
-//#define CGAL_PSP3_VERBOSE 
-
-namespace CGAL {
-
-// ----------------------------------------------------------------------------
-// Private section
-// ----------------------------------------------------------------------------
-/// \cond SKIP_IN_MANUAL
-
-namespace bilateral_smooth_point_set_internal{
-
-// Item in the Kd-tree: position (Point_3) + index
-template <typename Kernel>
-class Kd_tree_element : public Point_with_normal_3<Kernel>
-{
-public:
-  unsigned int index;
-
-  // basic geometric types
-  typedef typename CGAL::Origin Origin;
-  typedef CGAL::Point_with_normal_3<Kernel> Base;
-
-  Kd_tree_element(const Origin& o = ORIGIN, unsigned int id=0)
-    : Base(o), index(id)
-  {}
-  Kd_tree_element(const Base& p, unsigned int id=0)
-    : Base(p), index(id)
-  {}
-  Kd_tree_element(const Kd_tree_element& other)
-    : Base(other), index(other.index)
-  {}
-};
-
-
-// Helper class for the Kd-tree
-template <typename Kernel>
-class Kd_tree_gt : public Kernel
-{
-public:
-  typedef Kd_tree_element<Kernel> Point_3;
-};
-
-template <typename Kernel>
-class Kd_tree_traits : public CGAL::Search_traits_3<Kd_tree_gt<Kernel> >
-{
-public:
-  typedef typename Kernel::Point_3 PointType;
-};
-
-
-/// Compute bilateral projection for each point
-/// according to their KNN neighborhood points
-/// 
-/// \pre `k >= 2`, radius > 0 , sharpness_angle > 0 && sharpness_angle < 90
-///
-/// @tparam Kernel Geometric traits class.
-/// @tparam Tree KD-tree.
-///
-/// @return 
-
-template <typename Kernel>
-CGAL::Point_with_normal_3<Kernel>
-compute_denoise_projection(
-  const CGAL::Point_with_normal_3<Kernel>& query, ///< 3D point to project
-  const std::vector<CGAL::Point_with_normal_3<Kernel>,
-  CGAL_PSP3_DEFAULT_ALLOCATOR<CGAL::Point_with_normal_3<Kernel> > >& neighbor_pwns,  //
-  typename Kernel::FT radius,                   ///< accept neighborhood radius
-  typename Kernel::FT sharpness_angle           ///< control sharpness(0-90)
-)
-{
-  CGAL_point_set_processing_precondition(radius > 0);
-  CGAL_point_set_processing_precondition(sharpness_angle > 0
-                                         && sharpness_angle < 90);
-
-  // basic geometric types
-  typedef typename Kernel::FT FT;
-  typedef CGAL::Point_with_normal_3<Kernel> Pwn;
-  typedef typename Kernel::Vector_3 Vector;
-  typedef typename Kernel::Point_3 Point;
-
-  FT radius2 = radius * radius;
-
-  FT weight = (FT)0.0;
-  FT iradius16 = -(FT)4.0/radius2;
-  FT project_dist_sum = FT(0.0);
-  FT project_weight_sum = FT(0.0);
-  Vector normal_sum = CGAL::NULL_VECTOR; 
-
-  FT cos_sigma = cos(sharpness_angle / 180.0 * 3.1415926);
-  FT sharpness_bandwidth = std::pow((CGAL::max)(1e-8, 1 - cos_sigma), 2);
-
-  typename std::vector<Pwn,CGAL_PSP3_DEFAULT_ALLOCATOR<Pwn> >::const_iterator 
-    pwn_iter = neighbor_pwns.begin();
-  for (; pwn_iter != neighbor_pwns.end(); ++pwn_iter)
-  {
-    const Point& np = pwn_iter->position();
-    const Vector& nn = pwn_iter->normal();
-
-    FT dist2 = CGAL::squared_distance(query.position(), np);
-    if (dist2 < radius2)
-    {
-      FT theta = std::exp(dist2 * iradius16);
-      FT psi = std::exp(-std::pow(1 - query.normal() * nn, 2)
-        / sharpness_bandwidth);
-
-      weight = theta * psi;
-
-      project_dist_sum += ((query.position() - np) * nn) * weight;
-      project_weight_sum += weight;
-      normal_sum = normal_sum + nn * weight;
-    }
-  }
-
-  Vector update_normal = normal_sum / project_weight_sum;
-  update_normal = update_normal / sqrt(update_normal.squared_length());
-
-  Point update_point = query.position() - update_normal * 
-                      (project_dist_sum / project_weight_sum); 
-
-  return Pwn(update_point, update_normal);
-}
-
-/// Computes neighbors from kdtree.
-///
-/// \pre `k >= 2`.
-///
-/// @tparam Kernel Geometric traits class.
-/// @tparam Tree KD-tree.
-///
-/// @return neighbors pwn of query point.
-template < typename Kernel,
-           typename Tree>
-std::vector<CGAL::Point_with_normal_3<Kernel>,
-            CGAL_PSP3_DEFAULT_ALLOCATOR<CGAL::Point_with_normal_3<Kernel> > >
-compute_kdtree_neighbors(
-  const CGAL::Point_with_normal_3<Kernel>& query, ///< 3D point
-  const Tree& tree,                               ///< KD-tree
-  unsigned int k                                  ///< number of neighbors         
-)                       
-{
-  // basic geometric types
-  typedef CGAL::Point_with_normal_3<Kernel> Pwn;
-
-  // types for K nearest neighbors search
-  typedef bilateral_smooth_point_set_internal::Kd_tree_traits<Kernel> Tree_traits;
-  typedef CGAL::Orthogonal_k_neighbor_search<Tree_traits> Neighbor_search;
-  typedef typename Neighbor_search::iterator Search_iterator;
-
-  // performs k + 1 queries (if unique the query point is
-  // output first). search may be aborted when k is greater
-  // than number of input points
-  Neighbor_search search(tree, query, k+1);
-  Search_iterator search_iterator = search.begin();
-  ++search_iterator;
-  unsigned int i;
-  std::vector<CGAL::Point_with_normal_3<Kernel>
-    , CGAL_PSP3_DEFAULT_ALLOCATOR<CGAL::Point_with_normal_3<Kernel> > 
-    > neighbor_pwns;
-
-  for(i = 0; i < (k+1); ++i)
-  {
-    if(search_iterator == search.end())
-      break; // premature ending
-
-    Pwn pwn = search_iterator->first;
-    neighbor_pwns.push_back(pwn);
-    ++search_iterator;
-  }
-
-  // output 
-  return neighbor_pwns;
-}
-
-
-/// Computes max-spacing of one query point from K nearest neighbors.
-///
-/// \pre `k >= 2`.
-///
-/// @tparam Kernel Geometric traits class.
-/// @tparam Tree KD-tree.
-///
-/// @return max spacing.
-template < typename Kernel,
-           typename Tree >
-typename Kernel::FT
-compute_max_spacing(
-  const CGAL::Point_with_normal_3<Kernel>& query, ///< 3D point
-  Tree& tree,                                     ///< KD-tree
-  unsigned int k)                                 ///< number of neighbors
-{
-  // basic geometric types
-  typedef typename Kernel::FT FT;
-  typedef CGAL::Point_with_normal_3<Kernel> Pwn;
-
-  // types for K nearest neighbors search
-  typedef bilateral_smooth_point_set_internal::Kd_tree_traits<Kernel> Tree_traits;
-  typedef CGAL::Orthogonal_k_neighbor_search<Tree_traits> Neighbor_search;
-  typedef typename Neighbor_search::iterator Search_iterator;
-
-  // performs k + 1 queries (if unique the query point is
-  // output first). search may be aborted when k is greater
-  // than number of input points
-  Neighbor_search search(tree,query,k+1);
-  Search_iterator search_iterator = search.begin();
-  ++search_iterator;
-  FT max_distance = (FT)0.0;
-  unsigned int i;
-  for(i = 0; i < (k+1) ; ++i)
-  {
-    if(search_iterator == search.end())
-      break; // premature ending
-
-    Pwn pwn = search_iterator->first;
-    double dist2 = CGAL::squared_distance(query.position(), pwn.position());
-    max_distance = (CGAL::max)(dist2, max_distance);
-    ++search_iterator;
-  }
-
-  // output max spacing
-  return std::sqrt(max_distance);
-}
-
-} /* namespace internal */
-
-/// \endcond
-
-#ifdef CGAL_LINKED_WITH_TBB
-/// \cond SKIP_IN_MANUAL
-/// This is for parallelization of function: bilateral_smooth_point_set()
-template <typename Kernel, typename Tree>
-class Compute_pwns_neighbors
-{
-  typedef typename CGAL::Point_with_normal_3<Kernel> Pwn;
-  typedef typename std::vector<Pwn,CGAL_PSP3_DEFAULT_ALLOCATOR<Pwn> > Pwns;
-  typedef typename std::vector<Pwns,CGAL_PSP3_DEFAULT_ALLOCATOR<Pwns> > 
-                                                                Pwns_neighbors;
-  typedef typename Kernel::FT FT;
-
-  unsigned int                                              m_k;
-  const Tree                                              & m_tree;
-  const Pwns                                              & m_pwns;
-  Pwns_neighbors                                          & m_pwns_neighbors;
-
-public:
-  Compute_pwns_neighbors(unsigned int k, const Tree &tree,
-                         const Pwns &pwns, Pwns_neighbors &neighbors)
-    : m_k(k), m_tree(tree), m_pwns(pwns), m_pwns_neighbors(neighbors) {} 
-
-  void operator() ( const tbb::blocked_range<size_t>& r ) const 
-  {
-    for (size_t i = r.begin(); i!=r.end(); i++)
-    {
-      m_pwns_neighbors[i] = bilateral_smooth_point_set_internal::
-        compute_kdtree_neighbors<Kernel, Tree>(m_pwns[i], m_tree, m_k);
-    }
-  }
-};
-/// \endcond  
-
-/// \cond SKIP_IN_MANUAL
-/// This is for parallelization of function: compute_denoise_projection()
-template <typename Kernel>
-class Pwn_updater 
-{
-  typedef typename CGAL::Point_with_normal_3<Kernel> Pwn;
-  typedef typename std::vector<Pwn,CGAL_PSP3_DEFAULT_ALLOCATOR<Pwn> > Pwns;
-  typedef typename Kernel::FT FT;
-
-  FT sharpness_angle;
-  FT radius;
-  Pwns* pwns;
-  Pwns* update_pwns;
-  std::vector<Pwns,CGAL_PSP3_DEFAULT_ALLOCATOR<Pwns> >* pwns_neighbors;
-
-public:
-  Pwn_updater(FT sharpness, 
-    FT r,
-    Pwns *in,
-    Pwns *out, 
-    std::vector<Pwns,CGAL_PSP3_DEFAULT_ALLOCATOR<Pwns> >* neighbors): 
-  sharpness_angle(sharpness), 
-    radius(r),
-    pwns(in),
-    update_pwns(out),
-    pwns_neighbors(neighbors){} 
-
-
-  void operator() ( const tbb::blocked_range<size_t>& r ) const 
-  { 
-    for (size_t i = r.begin(); i != r.end(); ++i) 
-    {
-      (*update_pwns)[i] = bilateral_smooth_point_set_internal::
-        compute_denoise_projection<Kernel>((*pwns)[i], 
-        (*pwns_neighbors)[i], 
-        radius,
-        sharpness_angle);  
-
-    }
-  }
-};
-/// \endcond
-#endif // CGAL_LINKED_WITH_TBB
-
-
-// ----------------------------------------------------------------------------
-// Public section
-// ----------------------------------------------------------------------------
-
-//=============================================================================
-/// \ingroup PkgPointSetProcessing
-/// 
-/// This function smooths an input point set by iteratively projecting each 
-///  point onto the implicit surface patch fitted over its k nearest neighbors.
-///  Bilateral projection preserves sharp features according to the normal
-/// (gradient) information. Both point positions and normals will be modified.  
-/// For more details, please see section 4 in \cgalCite{ear-2013}.  
-///
-/// A parallel version of this function is provided and requires the executable to be 
-/// linked against the <a href="http://www.threadingbuildingblocks.org">Intel TBB library</a>.
-/// To control the number of threads used, the user may use the tbb::task_scheduler_init class.
-/// See the <a href="http://www.threadingbuildingblocks.org/documentation">TBB documentation</a> 
-/// for more details.
-///
-/// \pre Normals must be unit vectors
-/// \pre k >= 2
-///
-/// @tparam Concurrency_tag enables sequential versus parallel algorithm.
-///                         Possible values are `Sequential_tag`
-///                         and `Parallel_tag`.
-/// @tparam ForwardIterator iterator over input points.
-/// @tparam PointPMap is a model of `ReadWritePropertyMap` 
-///         with the value type of `ForwardIterator` as key and `Kernel::Point_3` as value type.
-///         It can be omitted if the value type of `ForwardIterator` is convertible to 
-///         `Kernel::Point_3`.
-/// @tparam NormalPMap is a model of `ReadWritePropertyMap` with the value type of `ForwardIterator` as key
-///         and `Kernel::Vector_3` as value type.
-/// @tparam Kernel Geometric traits class.
-///      It can be omitted and deduced automatically from the value type of  `PointPMap`
-///      using `Kernel_traits`.
-///
-/// @return Average point movement error. It's a convergence criterium for the algorithm.
-///         This value can help the user to decide how many iterations are
-///         sufficient.
-
-// This variant requires all parameters.
-template <typename Concurrency_tag,
-          typename ForwardIterator,
-          typename PointPMap,
-          typename NormalPMap,
-          typename Kernel>
-double
-bilateral_smooth_point_set(
-  ForwardIterator first,    ///< forward iterator on the first input point.
-  ForwardIterator beyond,   ///< past-the-end iterator.
-  PointPMap point_pmap,     ///< point property map.
-  NormalPMap normal_pmap,   ///< normal property map.
-  unsigned int k,           ///< size of the neighborhood for the implicit surface patch fitting.
-                            ///< The larger the value is, the smoother the result will be.
-  typename Kernel::FT sharpness_angle,  ///< controls the sharpness of the result.
-                            ///< The larger the value is, the smoother the result will be.
-                            ///< The range of possible value is [0, 90].
-  const Kernel& /*kernel*/) ///< geometric traits.
-{
-  // basic geometric types
-  typedef typename Kernel::Point_3 Point;
-  typedef typename CGAL::Point_with_normal_3<Kernel> Pwn;
-  typedef typename std::vector<Pwn,CGAL_PSP3_DEFAULT_ALLOCATOR<Pwn> > Pwns;
-  typedef typename Kernel::Vector_3 Vector;
-  typedef typename Kernel::FT FT;
-
-  CGAL_point_set_processing_precondition(first != beyond);
-  CGAL_point_set_processing_precondition(k > 1);
-
-  // types for K nearest neighbors search structure
-  typedef bilateral_smooth_point_set_internal::
-                                       Kd_tree_element<Kernel> Kd_tree_element;
-  typedef bilateral_smooth_point_set_internal::Kd_tree_traits<Kernel> Tree_traits;
-  typedef CGAL::Orthogonal_k_neighbor_search<Tree_traits> Neighbor_search;
-  typedef typename Neighbor_search::Tree Tree;
-
-  // copy points and normals
-  Pwns pwns;
-  for(ForwardIterator it = first; it != beyond; ++it)
-  {
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-    const Point& p = get(point_pmap, it);
-    const Vector& n = get(normal_pmap, it);
-#else
-    const Point& p = get(point_pmap, *it);
-    const Vector& n = get(normal_pmap, *it);
-#endif
-    CGAL_point_set_processing_precondition(n.squared_length() > 1e-10);
-    
-    pwns.push_back(Pwn(p, n));
-  }
-
-  std::size_t nb_points = pwns.size();
-
-#ifdef CGAL_PSP3_VERBOSE
-   std::cout << "Initialization and compute max spacing: " << std::endl;
-#endif
-   // initiate a KD-tree search for points
-   std::vector<Kd_tree_element,
-     CGAL_PSP3_DEFAULT_ALLOCATOR<Kd_tree_element> > treeElements;
-   treeElements.reserve(pwns.size());
-   typename std::vector<Pwn,CGAL_PSP3_DEFAULT_ALLOCATOR<Pwn> >::iterator 
-     pwn_iter = pwns.begin();
-   for (unsigned int i = 0; pwn_iter != pwns.end(); ++pwn_iter)
-   {
-     treeElements.push_back(Kd_tree_element(*pwn_iter, i));
-   }
-   Tree tree(treeElements.begin(), treeElements.end());
-   // Guess spacing
-#ifdef CGAL_PSP3_VERBOSE
-   CGAL::Real_timer task_timer;
-   task_timer.start();
-#endif
-   FT guess_neighbor_radius = 0.0; 
-
-   for(pwn_iter = pwns.begin(); pwn_iter != pwns.end(); ++pwn_iter)
-   {
-     FT max_spacing = bilateral_smooth_point_set_internal::
-       compute_max_spacing<Kernel,Tree>(*pwn_iter, tree, k);
-     guess_neighbor_radius = (CGAL::max)(max_spacing, guess_neighbor_radius); 
-   }
-   
-#ifdef CGAL_PSP3_VERBOSE
-   task_timer.stop();
-#endif
-   guess_neighbor_radius *= 0.95;
-
-#ifdef CGAL_PSP3_VERBOSE
-   CGAL::Memory_sizer::size_type memory = CGAL::Memory_sizer().virtual_size();
-   std::cout << "done: " << task_timer.time() << " seconds, "
-             << (memory>>20) << " Mb allocated" << std::endl;
-
-   std::cout << "Compute all neighbors: " << std::endl;
-   task_timer.reset();
-   task_timer.start();
-#endif
-   // compute all neighbors
-   std::vector<Pwns,CGAL_PSP3_DEFAULT_ALLOCATOR<Pwns> > pwns_neighbors;
-   pwns_neighbors.resize(nb_points);
- 
-#ifndef CGAL_LINKED_WITH_TBB
-  CGAL_static_assertion_msg (!(boost::is_convertible<Concurrency_tag, Parallel_tag>::value),
-			     "Parallel_tag is enabled but TBB is unavailable.");
-#else
-   if (boost::is_convertible<Concurrency_tag,Parallel_tag>::value)
-   {
-     Compute_pwns_neighbors<Kernel, Tree> f(k, tree, pwns, pwns_neighbors);
-     tbb::parallel_for(tbb::blocked_range<size_t>(0, nb_points), f);
-   }
-   else
-#endif
-   {
-     typename std::vector<Pwns,CGAL_PSP3_DEFAULT_ALLOCATOR<Pwns> >::iterator 
-       pwns_iter = pwns_neighbors.begin();
-
-     for(pwn_iter = pwns.begin(); pwn_iter != pwns.end(); ++pwn_iter, ++pwns_iter)
-     {
-       *pwns_iter = bilateral_smooth_point_set_internal::
-         compute_kdtree_neighbors<Kernel, Tree>(*pwn_iter, tree, k);
-     }
-   }
-   
-#ifdef CGAL_PSP3_VERBOSE
-   task_timer.stop();
-   memory = CGAL::Memory_sizer().virtual_size();
-   std::cout << "done: " << task_timer.time() << " seconds, "
-             << (memory>>20) << " Mb allocated" << std::endl;
-
-   std::cout << "Compute update points and normals: " << std::endl;
-   task_timer.reset();
-   task_timer.start();
-#endif
-   // update points and normals
-   Pwns update_pwns(nb_points);
-
-#ifdef CGAL_LINKED_WITH_TBB
-   if(boost::is_convertible<Concurrency_tag, CGAL::Parallel_tag>::value)
-   {
-     //tbb::task_scheduler_init init(4);
-     tbb::blocked_range<size_t> block(0, nb_points);
-     Pwn_updater<Kernel> pwn_updater(sharpness_angle,
-                                     guess_neighbor_radius,
-                                     &pwns,
-                                     &update_pwns,
-                                     &pwns_neighbors);
-     tbb::parallel_for(block, pwn_updater);
-   }
-   else
-#endif // CGAL_LINKED_WITH_TBB
-   {
-     typename std::vector<Pwn,CGAL_PSP3_DEFAULT_ALLOCATOR<Pwn> >::iterator 
-       update_iter = update_pwns.begin();
-     typename std::vector<Pwns,CGAL_PSP3_DEFAULT_ALLOCATOR<Pwns> >::iterator 
-       neighbor_iter = pwns_neighbors.begin();
-     for(pwn_iter = pwns.begin(); pwn_iter != pwns.end(); 
-         ++pwn_iter, ++update_iter, ++neighbor_iter)
-     {
-       *update_iter = bilateral_smooth_point_set_internal::
-         compute_denoise_projection<Kernel>
-         (*pwn_iter, 
-          *neighbor_iter, 
-          guess_neighbor_radius, 
-          sharpness_angle);
-     }
-   }
-#ifdef CGAL_PSP3_VERBOSE
-   task_timer.stop(); 
-   memory = CGAL::Memory_sizer().virtual_size();
-   std::cout << "done: " << task_timer.time() << " seconds, "
-             << (memory>>20) << " Mb allocated" << std::endl;
-#endif
-   // save results
-   FT sum_move_error = 0;
-   ForwardIterator it = first;
-   for(unsigned int i = 0 ; it != beyond; ++it, ++i)
-   {
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-     Point& p = get(point_pmap, it);
-     Vector& n = get(normal_pmap, it);
-#else
-     Point& p = get(point_pmap, *it);
-     Vector& n = get(normal_pmap, *it);
-#endif
-     sum_move_error += CGAL::squared_distance(p, update_pwns[i].position());
-     p = update_pwns[i].position();
-     n = update_pwns[i].normal();
-   }
-     
-   return sum_move_error / nb_points;
-}
-
-
-/// @cond SKIP_IN_MANUAL
-// This variant deduces the kernel from the point property map.
-template <typename Concurrency_tag,
-          typename ForwardIterator,
-          typename PointPMap,
-          typename NormalPMap>
-double
-bilateral_smooth_point_set(
-  ForwardIterator first,      ///< forward iterator to the first input point.
-  ForwardIterator beyond,     ///< past-the-end iterator.
-  PointPMap point_pmap,        ///< property map OutputIterator -> Point_3.
-  NormalPMap normal_pmap,    ///< property map ForwardIterator -> Vector_3.
-  const unsigned int k,      ///< number of neighbors.
-  double sharpness_angle     ///< control sharpness(0-90)
-) ///< property map OutputIterator -> Vector_3.
-{
-  typedef typename boost::property_traits<PointPMap>::value_type Point;
-  typedef typename Kernel_traits<Point>::Kernel Kernel;
-  return bilateral_smooth_point_set<Concurrency_tag>(
-    first, beyond,
-    point_pmap,
-    normal_pmap,
-    k,
-    sharpness_angle,
-    Kernel());
-}
-/// @endcond
-
-/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Dereference_property_map.
-template <typename Concurrency_tag,
-          typename ForwardIterator,
-          typename NormalPMap>
-double
-bilateral_smooth_point_set(
-  ForwardIterator first,    ///< forward iterator to the first input point.
-  ForwardIterator beyond,   ///< past-the-end iterator.
-  const unsigned int k,     ///< number of neighbors.
-  double sharpness_angle,   ///< control sharpness(0-90)
-  NormalPMap normal_pmap)   ///< property map OutputIterator -> Vector_3.
-{
-  return bilateral_smooth_point_set<Concurrency_tag>(
-    first, beyond,
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-    make_dereference_property_map(first),
-#else
-    make_identity_property_map(
-    typename std::iterator_traits<ForwardIterator>::value_type()),
-#endif
-    normal_pmap, 
-    k,
-    sharpness_angle);
-}
-/// @endcond
-
-
-} //namespace CGAL
-
-#endif // CGAL_BILATERAL_SMOOTH_POINT_SET_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/Dual.h b/3rdparty/CGAL-4.8/include/CGAL/boost/graph/Dual.h
deleted file mode 100644
index fd904a5..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/Dual.h
+++ /dev/null
@@ -1,329 +0,0 @@
-// Copyright (c) 2015  GeometryFactory (France).  All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Andreas Fabri
-
-#ifndef CGAL_BGL_DUAL_H
-#define CGAL_BGL_DUAL_H
-
-#include <CGAL/boost/graph/properties.h>
-#include <boost/range/distance.hpp>
-
-namespace CGAL {
-
-template <typename Primal_>
-class Dual
-{
-  
-  const Primal_& primal_;
-
-public:
-  typedef Primal_ Primal;
-
-  Dual(const Primal& primal)
-  : primal_(primal)
-  {}
-
-  const Primal& primal() const
-  {
-    return primal_;
-  }
-};
-
-} // namespace CGAL
-
-namespace boost {
-  
-template <typename Primal>
-class graph_traits<CGAL::Dual<Primal> >
-{
-  typedef boost::graph_traits<Primal> GTP;
-  struct Dual_traversal_category : public virtual boost::bidirectional_graph_tag,
-                                   public virtual boost::vertex_list_graph_tag,
-                                   public virtual boost::edge_list_graph_tag
-  {};
-
-public:
-  typedef typename GTP::face_descriptor     vertex_descriptor;
-  typedef typename GTP::vertex_descriptor   face_descriptor;
-  typedef typename GTP::halfedge_descriptor halfedge_descriptor;
-  typedef typename GTP::edge_descriptor     edge_descriptor;
-  typedef typename GTP::directed_category   directed_category;
-  typedef boost::allow_parallel_edge_tag    edge_parallel_category; 
-  typedef Dual_traversal_category           traversal_category;
-
-  typedef typename GTP::faces_size_type          vertices_size_type;
-  typedef typename GTP::vertices_size_type       faces_size_type;
-  typedef typename GTP::edges_size_type          edges_size_type;
-  typedef typename GTP::halfedges_size_type      halfedges_size_type;
-  typedef typename GTP::degree_size_type         degree_size_type;
-
-  typedef typename GTP::face_iterator     vertex_iterator;
-  typedef typename GTP::vertex_iterator   face_iterator;
-  typedef typename GTP::halfedge_iterator halfedge_iterator;
-  typedef typename GTP::edge_iterator     edge_iterator;
-
-  typedef CGAL::Halfedge_around_face_iterator<Primal> in_edge_iterator;
-  typedef CGAL::Opposite_edge_around_face_iterator<Primal> out_edge_iterator;
-
-  static vertex_descriptor   null_vertex()   { return vertex_descriptor(); }
-  static face_descriptor     null_face()     { return face_descriptor(); }
-  static halfedge_descriptor null_halfedge() { return halfedge_descriptor(); }
-};
- 
-template<typename P>
-struct graph_traits< const CGAL::Dual<P> >  
-  : public graph_traits< CGAL::Dual<P> >
-{}; 
-
-namespace internal{
-
-template <class G>
-struct Dual_vertex_index_pmap{
-  typedef typename boost::property_map<G, boost::face_index_t>::type  Property_map;
-  Property_map m_pmap;
-
-  typedef typename boost::graph_traits<G>::face_descriptor key_type;
-  typedef typename Property_map::value_type value_type;
-  typedef typename Property_map::reference reference;
-  typedef typename Property_map::category category;
-
-  Dual_vertex_index_pmap(const G& g)
-    : m_pmap( get(boost::face_index, g) )
-  {}
-
-  friend reference get(const Dual_vertex_index_pmap<G>& pmap, key_type fd) {
-    return get(pmap.m_pmap, fd);
-  }
-};
-
-template <class G>
-struct Dual_face_index_pmap{
-  typedef typename boost::property_map<G, boost::vertex_index_t>::type  Property_map;
-  Property_map m_pmap;
-
-  typedef typename boost::graph_traits<G>::vertex_descriptor key_type;
-  typedef typename Property_map::value_type value_type;
-  typedef typename Property_map::reference reference;
-  typedef typename Property_map::category category;
-
-  Dual_face_index_pmap(const G& g)
-    : m_pmap( get(boost::vertex_index, g) )
-  {}
-
-  friend reference get(const Dual_face_index_pmap<G>& pmap, key_type vd) {
-    return get(pmap.m_pmap, vd);
-  }
-};
-
-} //end of namespace internal
-
-template <typename P>
-struct property_map<CGAL::Dual<P>, boost::vertex_index_t>
-{
-  typedef internal::Dual_vertex_index_pmap<P> type;
-  typedef internal::Dual_vertex_index_pmap<P> const_type;
-};
-
-template <typename P>
-struct property_map<CGAL::Dual<P>, boost::face_index_t>
-{
-  typedef internal::Dual_face_index_pmap<P> type;
-  typedef internal::Dual_face_index_pmap<P> const_type;
-};
-
-} // namespace boost
-
-
-namespace CGAL {
-
-template <typename P>
-typename boost::internal::Dual_vertex_index_pmap<P>
-get(boost::vertex_index_t, const Dual<P>& dual)
-{
-  return typename boost::internal::Dual_vertex_index_pmap<P>(dual.primal());
-}
-
-template <typename P>
-typename boost::internal::Dual_face_index_pmap<P>
-get(boost::face_index_t, const Dual<P>& dual)
-{
-  return typename boost::internal::Dual_face_index_pmap<P>(dual.primal());
-}
-
-template <typename P>
-typename boost::graph_traits<CGAL::Dual<P> >::vertices_size_type
-num_vertices(const CGAL::Dual<P>& dual)
-{
-  return num_faces(dual.primal());
-}
-     
-template <typename P>
-Iterator_range<typename boost::graph_traits<Dual<P> >::vertex_iterator>
-vertices(const CGAL::Dual<P>& dual)
-{
-  return faces(dual.primal()); 
-}
-    
-template <typename P>
-Iterator_range<typename boost::graph_traits<Dual<P> >::halfedge_iterator>
-halfedges(const CGAL::Dual<P>& dual)
-{
-  return halfedges(dual.primal()); 
-}
-  
-template <typename P>
-Iterator_range<typename boost::graph_traits<Dual<P> >::edge_iterator>
-edges(const CGAL::Dual<P>& dual)
-{
-  return edges(dual.primal()); 
-}
-
-template <typename P>
-typename boost::graph_traits<Dual<P> >::vertex_descriptor
-source(typename boost::graph_traits<Dual<P> >::halfedge_descriptor h,
-       const Dual<P>& dual)
-{
-  const typename Dual<P>::Primal& primal = dual.primal();
-  return face(opposite(h,primal),primal);
-}
- 
-template <typename P>
-typename boost::graph_traits<Dual<P> >::vertex_descriptor
-target(typename boost::graph_traits<Dual<P> >::halfedge_descriptor h,
-       const Dual<P>& dual)
-{
-  const typename Dual<P>::Primal& primal = dual.primal();
-  return face(h,primal);
-}
- 
-
-template <typename P>
-typename boost::graph_traits<Dual<P> >::vertex_descriptor
-source(typename boost::graph_traits<Dual<P> >::edge_descriptor h,
-       const Dual<P>& dual)
-{
-  const typename Dual<P>::Primal& primal = dual.primal();
-  return face(opposite(halfedge(h,primal),primal),primal);
-}
- 
-template <typename P>
-typename boost::graph_traits<Dual<P> >::vertex_descriptor
-target(typename boost::graph_traits<Dual<P> >::edge_descriptor h,
-       const Dual<P>& dual)
-{
-  const typename Dual<P>::Primal& primal = dual.primal();
-  return face(halfedge(h,primal),primal);
-}
-
-template <typename P>
-typename boost::graph_traits<Dual<P> >::halfedge_descriptor
-halfedge(typename boost::graph_traits<Dual<P> >::vertex_descriptor v,
-         const Dual<P>& dual)
-{
-  return halfedge(v, dual.primal());
-}
-
-template <typename P>
-typename boost::graph_traits<Dual<P> >::halfedge_descriptor
-halfedge(typename boost::graph_traits<Dual<P> >::face_descriptor f,
-         const Dual<P>& dual)
-{
-  return halfedge(f, dual.primal());
-}
-
-template <typename P>
-typename boost::graph_traits<Dual<P> >::halfedge_descriptor
-halfedge(typename boost::graph_traits<Dual<P> >::edge_descriptor e,
-         const Dual<P>& dual)
-{
-  return halfedge(e, dual.primal());
-}
-template <typename P>
-typename boost::graph_traits<Dual<P> >::face_descriptor
-face(typename boost::graph_traits<Dual<P> >::halfedge_descriptor h,
-       const Dual<P>& dual)
-{
-  const typename Dual<P>::Primal& primal = dual.primal();
-  return target(h,primal);
-}
-
-template <typename P>
-typename boost::graph_traits<Dual<P> >::halfedge_descriptor
-opposite(typename boost::graph_traits<Dual<P> >::halfedge_descriptor h,
-         const Dual<P>& dual)
-{
-  return opposite(h, dual.primal());
-}
-
-template <typename P>
-typename boost::graph_traits<Dual<P> >::halfedge_descriptor
-next(typename boost::graph_traits<Dual<P> >::halfedge_descriptor h,
-         const Dual<P>& dual)
-{
-  const typename Dual<P>::Primal& primal = dual.primal();
-  return opposite(prev(h,primal),primal);
-}  
-
-template <typename P>
-typename boost::graph_traits<Dual<P> >::halfedge_descriptor
-prev(typename boost::graph_traits<Dual<P> >::halfedge_descriptor h,
-         const Dual<P>& dual)
-{
-  const typename Dual<P>::Primal& primal = dual.primal();
-  return next(opposite(h,primal),primal);
-}  
-
-template <typename P>
-Iterator_range<typename boost::graph_traits<Dual<P> >::out_edge_iterator>
-out_edges(typename boost::graph_traits<Dual<P> >::vertex_descriptor v,
-          const Dual<P>& dual)
-{
-  const typename Dual<P>::Primal& primal = dual.primal();
-  return opposite_edges_around_face(halfedge(v,primal),primal);
-}
-
-template <typename P>
-Iterator_range<typename boost::graph_traits<Dual<P> >::out_edge_iterator>
-in_edges(typename boost::graph_traits<Dual<P> >::vertex_descriptor v,
-         const Dual<P>& dual)
-{
-  const typename Dual<P>::Primal& primal = dual.primal();
-  return halfedges_around_face(halfedge(v,primal),primal);
-}
-       
-template <typename P>
-typename boost::graph_traits<Dual<P> >::degree_size_type
-out_degree(typename boost::graph_traits<Dual<P> >::vertex_descriptor v,
-           const Dual<P>& dual)
-{
-  const typename Dual<P>::Primal& primal = dual.primal();
-  return boost::distance(halfedges_around_face(halfedge(v,primal),primal));
-}
-
- template <typename P>
-typename boost::graph_traits<Dual<P> >::degree_size_type
-in_degree(typename boost::graph_traits<Dual<P> >::vertex_descriptor v,
-           const Dual<P>& dual)
-{
-  return out_degree(v,dual);
-}
-         
-        
-} // namespace CGAL
-
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/convert_surface_mesh.h b/3rdparty/CGAL-4.8/include/CGAL/boost/graph/convert_surface_mesh.h
deleted file mode 100644
index 7a964e7..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/convert_surface_mesh.h
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright (c) 2015  GeometryFactory (France).  All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Andreas Fabri
-
-#ifndef CGAL_BOOST_GRAPH_CONVERT_SURFACE_MESH_H
-#define CGAL_BOOST_GRAPH_CONVERT_SURFACE_MESH_H
-
-#include <CGAL/boost/graph/Euler_operations.h>
-#include <CGAL/boost/graph/iterator.h>
-#include <boost/unordered_map.hpp>
-#include <CGAL/boost/graph/helpers.h>
-
-namespace CGAL {
-
-  template <typename SourceMesh, typename TargetMesh, typename V2V, typename H2H>
-  void convert_surface_mesh(const SourceMesh& sm, TargetMesh& tm, V2V& v2v, H2H& h2h)
-{
-  typedef typename boost::graph_traits<SourceMesh>::vertex_descriptor sm_vertex_descriptor;
-  typedef typename boost::graph_traits<TargetMesh>::vertex_descriptor tm_vertex_descriptor;
-
-  typedef typename boost::graph_traits<SourceMesh>::face_descriptor sm_face_descriptor;
-  typedef typename boost::graph_traits<TargetMesh>::face_descriptor tm_face_descriptor;
-
-  typedef typename boost::graph_traits<SourceMesh>::halfedge_descriptor sm_halfedge_descriptor;
-  typedef typename boost::graph_traits<TargetMesh>::halfedge_descriptor tm_halfedge_descriptor;
-
-  typedef typename boost::property_map<SourceMesh, vertex_point_t>::const_type sm_PMap;
-  typedef typename boost::property_map<TargetMesh, vertex_point_t>::type tm_PMap;
-
-  sm_PMap sm_pmap = get(vertex_point, sm);
-  tm_PMap tm_pmap = get(vertex_point, tm);
-
-
-  BOOST_FOREACH(sm_vertex_descriptor svd, vertices(sm)){
-    tm_vertex_descriptor tvd = add_vertex(tm);
-    v2v.insert(std::make_pair(svd, tvd));
-    put(tm_pmap, tvd, get(sm_pmap, svd));
-  }
-
-  boost::unordered_map<sm_face_descriptor, tm_face_descriptor> f2f;
-  BOOST_FOREACH(sm_face_descriptor sfd, faces(sm)){
-    std::vector<tm_vertex_descriptor> tv;
-    BOOST_FOREACH(sm_vertex_descriptor svd, vertices_around_face(halfedge(sfd,sm),sm)){
-      tv.push_back(v2v.at(svd));
-    }
-    f2f[sfd] = Euler::add_face(tv,tm);
-  }
-  
-  BOOST_FOREACH(sm_face_descriptor sfd, faces(sm)){
-    sm_halfedge_descriptor shd = halfedge(sfd,sm), done(shd);
-    tm_halfedge_descriptor thd = halfedge(f2f[sfd],tm);
-    tm_vertex_descriptor tvd = v2v.at(target(shd,sm));
-    while(target(thd,tm) != tvd){
-      thd = next(thd,tm);
-    }
-    do {
-      h2h.insert(std::make_pair(shd, thd));
-
-      if (face(opposite(shd, sm), sm) == boost::graph_traits<SourceMesh>::null_face())
-        h2h.insert(std::make_pair(opposite(shd, sm), opposite(thd, tm)));
-
-      shd = next(shd,sm);
-      thd = next(thd,tm);
-    }while(shd != done);
-  }
-  
-}
-
-} // namespace CGAL
-
-#endif //  CGAL_BOOST_GRAPH_CONVERT_SURFACE_MESH_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/graph_traits_Delaunay_triangulation_2.h b/3rdparty/CGAL-4.8/include/CGAL/boost/graph/graph_traits_Delaunay_triangulation_2.h
deleted file mode 100644
index d25e974..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/graph_traits_Delaunay_triangulation_2.h
+++ /dev/null
@@ -1,395 +0,0 @@
-// Copyright (c) 2007  GeometryFactory (France).  All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Andreas Fabri, Fernando Cacciola
-
-#ifndef CGAL_GRAPH_TRAITS_DELAUNAY_TRIANGULATION_2_H
-#define CGAL_GRAPH_TRAITS_DELAUNAY_TRIANGULATION_2_H
-
-// include this to avoid a VC15 warning
-#include <CGAL/boost/graph/named_function_params.h>
-
-#include <boost/config.hpp>
-#include <boost/iterator_adaptors.hpp>
-#include <boost/graph/graph_traits.hpp>
-#include <boost/graph/properties.hpp>
-#include <CGAL/boost/graph/graph_traits_Triangulation_2.h>
-
-// The functions and classes in this file allows the user to
-// treat a CGAL Delaunay_triangulation_2 object as a boost graph "as is". No
-// wrapper is needed for the Delaunay_triangulation_2 object.
-
-
-
-namespace boost { 
-
-  template <class GT, class TDS>
-  struct graph_traits< CGAL::Delaunay_triangulation_2<GT,TDS> > {
-
-    struct DT2_graph_traversal_category : 
-      public virtual bidirectional_graph_tag,
-      public virtual adjacency_graph_tag,        
-      public virtual edge_list_graph_tag,
-      public virtual vertex_list_graph_tag { };
-
-    typedef CGAL::Delaunay_triangulation_2<GT,TDS> Delaunay_triangulation;
-
-    typedef typename CGAL::Delaunay_triangulation_2<GT,TDS>::Vertex_handle vertex_descriptor;
-    typedef CGAL::detail::Edge<CGAL::Delaunay_triangulation_2<GT,TDS>, typename CGAL::Delaunay_triangulation_2<GT,TDS>::Edge>  edge_descriptor;
-    typedef typename CGAL::Delaunay_triangulation_2<GT,TDS>::All_edges_iterator  edge_iterator;
-
-    typedef CGAL::detail::boost_all_vertices_iterator<Delaunay_triangulation> vertex_iterator;
-    typedef CGAL::Counting_iterator<CGAL::detail::Out_edge_circulator<typename Delaunay_triangulation::Edge_circulator, edge_descriptor>, edge_descriptor > out_edge_iterator;
-    typedef CGAL::Counting_iterator<CGAL::detail::In_edge_circulator<typename Delaunay_triangulation::Edge_circulator, edge_descriptor>, edge_descriptor > in_edge_iterator;
-    typedef CGAL::Counting_iterator<typename Delaunay_triangulation::Vertex_circulator> Incident_vertices_iterator;
-    typedef Incident_vertices_iterator adjacency_iterator;
-
-    typedef undirected_tag directed_category;
-    typedef disallow_parallel_edge_tag edge_parallel_category; 
-    typedef DT2_graph_traversal_category traversal_category;
-    typedef typename Delaunay_triangulation::size_type size_type;
-    typedef size_type vertices_size_type;
-    typedef size_type edges_size_type;
-    typedef size_type degree_size_type;
-  };
-
-
-} // namespace boost
-
-
-namespace CGAL {
-
-  template <class Gt, class Tds>
-  typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::vertex_descriptor
-  source(typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::edge_descriptor e,
-         const CGAL::Delaunay_triangulation_2<Gt,Tds>& g)
-  {
-    return e.first->vertex(g.ccw(e.second));
-  }
-
-  template <class Gt, class Tds>
-  typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::vertex_descriptor
-  target(typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::edge_descriptor e,
-         const CGAL::Delaunay_triangulation_2<Gt,Tds>& g)
-  {
-    return e.first->vertex(g.cw(e.second));
-  }
-
-  template <class Gt, class Tds>
-  inline std::pair<
-    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::vertex_iterator,
-    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::vertex_iterator >  
-  vertices(const CGAL::Delaunay_triangulation_2<Gt,Tds>& g)
-  {
-    typedef typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::vertex_iterator
-      Iter;
-    return std::make_pair( Iter(g.all_vertices_begin()), Iter(g.all_vertices_end()) );
-  }
-
-
-  template <class Gt, class Tds>
-  inline std::pair<
-    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::edge_iterator,
-    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::edge_iterator >  
-  edges(const CGAL::Delaunay_triangulation_2<Gt,Tds>& g)
-  {    
-    return std::make_pair(g.all_edges_begin(), g.all_edges_end());
-  }
-
-  template <class Gt, class Tds>
-  inline std::pair<
-    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::out_edge_iterator,
-    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::out_edge_iterator >  
-  out_edges(
-    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::vertex_descriptor u, 
-    const CGAL::Delaunay_triangulation_2<Gt,Tds>& g)
-  {
-    typename CGAL::Delaunay_triangulation_2<Gt,Tds>::Edge_circulator ec(u,u->face());
-    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::degree_size_type out_deg = out_degree(u,g);
-    typedef typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >
-      ::out_edge_iterator Iter;
-    
-    return std::make_pair( Iter(ec), Iter(ec,out_deg) );
-  }
-
-  template <class Gt, class Tds>
-  inline std::pair<
-    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::in_edge_iterator,
-    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::in_edge_iterator >  
-  in_edges(
-    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::vertex_descriptor u, 
-    const CGAL::Delaunay_triangulation_2<Gt,Tds>& g)
-  {
-    typename CGAL::Delaunay_triangulation_2<Gt,Tds>::Edge_circulator ec(u,u->face());
-    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::degree_size_type out_deg = out_degree(u,g);
-    typedef typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >
-      ::in_edge_iterator Iter;
-    return std::make_pair( Iter(ec), Iter(ec,out_deg) );
-  }
-
-  template <class Gt, class Tds>
-  inline std::pair<
-    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::adjacency_iterator,
-    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::adjacency_iterator >  
-  adjacent_vertices(
-    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::vertex_descriptor u, 
-    const CGAL::Delaunay_triangulation_2<Gt,Tds>& g)
-  {
-    typename CGAL::Delaunay_triangulation_2<Gt,Tds>::Vertex_circulator vc = out_edge_iterator(u,u.face());
-    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::degree_size_type out_deg = out_degree(u,g);
-    typedef typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >
-      ::adjacency_iterator Iter;
-    return std::make_pair( Iter(vc), Iter(vc,out_deg) );
-  }
-
-  template <class Gt, class Tds>
-  typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::vertices_size_type
-  num_vertices(const CGAL::Delaunay_triangulation_2<Gt,Tds>& g)
-  {
-    return g.number_of_vertices()+1;
-  }  
-
-  template <class Gt, class Tds>
-  typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::edges_size_type
-  num_edges(const CGAL::Delaunay_triangulation_2<Gt,Tds>& g)
-  {
-    return  g.number_of_vertices() + 1 + g.number_of_faces() + degree(g.infinite_vertex(), g) - 2;
-  }  
-
-  template <class Gt, class Tds>
-  typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::degree_size_type
-  out_degree(
-    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::vertex_descriptor u, 
-    const CGAL::Delaunay_triangulation_2<Gt,Tds>& g)
-  {
-    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::degree_size_type deg = 0;
-    typename CGAL::Delaunay_triangulation_2<Gt,Tds>::Edge_circulator c = g.incident_edges(u), done(c);
-    if ( c != 0) {
-        do {
-            ++deg;
-        } while (++c != done);
-    }
-    return deg;
-  }
-
-  template <class Gt, class Tds>
-  typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::degree_size_type
-  in_degree(
-    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::vertex_descriptor u, 
-    const CGAL::Delaunay_triangulation_2<Gt,Tds>& g)
-  {
-    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::degree_size_type deg = 0;
-    typename CGAL::Delaunay_triangulation_2<Gt,Tds>::Edge_circulator c = g.incident_edges(u), done(c);
-    if ( c != 0) {
-        do {
-            ++deg;
-        } while (++c != done);
-    }
-    return deg;
-  }
-
-  template <class Gt, class Tds>
-  typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::degree_size_type
-  degree(
-    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::vertex_descriptor u, 
-    const CGAL::Delaunay_triangulation_2<Gt,Tds>& g)
-  {
-    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::degree_size_type deg = 0;
-    typename CGAL::Delaunay_triangulation_2<Gt,Tds>::Edge_circulator c = g.incident_edges(u), done(c);
-    if ( c != 0) {
-        do {
-            ++deg;
-        } while (++c != done);
-    }
-    return deg;
-  }
-
-
-  // property maps
-  template <class Gt, class Tds>
-  class DT2_vertex_id_map
-    : public boost::put_get_helper<int, DT2_vertex_id_map<Gt,Tds> >
-  {
-  public:
-    typedef boost::readable_property_map_tag category;
-    typedef int value_type;
-    typedef int reference;
-    typedef typename CGAL::Delaunay_triangulation_2<Gt,Tds>::Vertex_handle key_type;
-    
-    DT2_vertex_id_map()
-    {}
-    
-    long operator[](key_type vh) const {
-      return vh->id(); 
-    }
-  };
-
-  template <class Gt, class Tds>
-  class DT2_edge_id_map
-    : public boost::put_get_helper<int, DT2_edge_id_map<Gt,Tds> >
-  {
-  public:
-    typedef boost::readable_property_map_tag category;
-    typedef int value_type;
-    typedef int reference;
-    typedef typename CGAL::Delaunay_triangulation_2<Gt,Tds>::Edge key_type;
-    
-    DT2_edge_id_map()
-    {}
-    
-    long operator[](key_type e) const {
-      return (3 * e.first.id()) + e.second; 
-    }
-  };
-
-  template <class Gt, class Tds>
-  class DT2_edge_weight_map
-    : public boost::put_get_helper<typename Gt::FT, DT2_edge_weight_map<Gt, Tds> >
-  {
-  private:
-    const CGAL::Delaunay_triangulation_2<Gt,Tds>& tr;
-  public:
-    typedef boost::readable_property_map_tag category;
-    typedef typename Gt::FT value_type;
-    typedef value_type reference;
-    typedef typename CGAL::Delaunay_triangulation_2<Gt,Tds>::Edge key_type;
-
-    DT2_edge_weight_map(const CGAL::Delaunay_triangulation_2<Gt,Tds>& tr_) 
-      : tr(tr_) 
-    { }
-
-    typename Gt::FT operator[](key_type e) const {
-      return tr.segment(e).squared_length();
-    }
-  };
-
-
-  template <class Gt, class Tds>
-  inline DT2_vertex_id_map<Gt,Tds>
-  get(boost::vertex_index_t, const CGAL::Delaunay_triangulation_2<Gt,Tds>& ) {
-    DT2_vertex_id_map<Gt,Tds> m;
-    return m;
-  }
-
-  template <class Gt, class Tds>
-  inline DT2_edge_id_map<Gt,Tds>
-  get(boost::edge_index_t, const CGAL::Delaunay_triangulation_2<Gt,Tds>& ) {
-    DT2_edge_id_map<Gt,Tds> m;
-    return m;
-  }
-
-  template <class Gt, class Tds>
-  inline DT2_edge_weight_map<Gt,Tds>
-  get(boost::edge_weight_t, const CGAL::Delaunay_triangulation_2<Gt,Tds>& g) {
-    DT2_edge_weight_map<Gt,Tds> m(g);
-    return m;
-  }
-
-  template <class Tag>
-  struct DT2_property_map { };
-
-  template <>
-  struct DT2_property_map<boost::vertex_index_t> {
-    template <class Gt, class Tds>
-    struct bind_ {
-      typedef DT2_vertex_id_map<Gt,Tds> type;
-      typedef DT2_vertex_id_map<Gt,Tds> const_type;
-    };
-  };
-
-
-  template <>
-  struct DT2_property_map<boost::edge_index_t> {
-    template <class Gt, class Tds>
-    struct bind_ {
-      typedef DT2_edge_id_map<Gt,Tds> type;
-      typedef DT2_edge_id_map<Gt,Tds> const_type;
-    };
-  };
-
-
-  template <>
-  struct DT2_property_map<boost::edge_weight_t> {
-    template <class Gt, class Tds>
-    struct bind_ {
-      typedef DT2_edge_weight_map<Gt,Tds> type;
-      typedef DT2_edge_weight_map<Gt,Tds> const_type;
-    };
-  };
-
-} // namespace CGAL
-
-namespace boost {
-
-  // g++ 'enumeral_type' in template unification not implemented workaround
-  template <class Gt, class Tds, class Tag>
-  struct property_map<CGAL::Delaunay_triangulation_2<Gt,Tds>, Tag> {
-    typedef typename 
-    CGAL::DT2_property_map<Tag>::template bind_<Gt,Tds> map_gen;
-    typedef typename map_gen::type type;
-    typedef typename map_gen::const_type const_type;
-  };
-
-  // see struct property_map in Polyehdron for an explanation
-  template <class Gt, class Tds, class Tag>
-  struct property_map<const CGAL::Delaunay_triangulation_2<Gt,Tds>, Tag> {
-    typedef typename 
-    CGAL::DT2_property_map<Tag>::template bind_<Gt,Tds> map_gen;
-    typedef typename map_gen::type type;
-    typedef typename map_gen::const_type const_type;
-  };
-
-} // namespace boost
-
-namespace CGAL {
-  template <class Gt, class Tds, class PropertyTag, class Key>
-  inline
-  typename boost::property_traits<
-    typename boost::property_map<CGAL::Delaunay_triangulation_2<Gt,Tds>,PropertyTag>::const_type>::value_type
-  get(PropertyTag p, const CGAL::Delaunay_triangulation_2<Gt,Tds>& g, const Key& key) {
-    return get(get(p, g), key);
-  }
-  
-  template <class Gt, class Tds, class PropertyTag, class Key,class Value>
-  inline void
-  put(PropertyTag p, CGAL::Delaunay_triangulation_2<Gt,Tds>& g, 
-      const Key& key, const Value& value)
-  {
-    typedef typename boost::property_map<CGAL::Delaunay_triangulation_2<Gt,Tds>, PropertyTag>::type Map;
-    Map pmap = get(p, g);
-    put(pmap, key, value);
-  }
-
-} // namespace CGAL
-
-namespace boost {
-
-  // What are those needed for ???
-  template <typename Gt, typename Tds>
-  struct edge_property_type<CGAL::Delaunay_triangulation_2<Gt,Tds> > {
-    typedef void type;
-  };  
-
-  template <typename Gt, typename Tds>
-  struct vertex_property_type<CGAL::Delaunay_triangulation_2<Gt,Tds> > {
-    typedef void type;
-  };
-} // namespace boost
-
-//#include <CGAL/graph_traits_Delaunay_delaunay_triangulation_2.h>
-
-#endif // CGAL_GRAPH_TRAITS_DELAUNAY_TRIANGULATION_2_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/graph_traits_HalfedgeDS.h b/3rdparty/CGAL-4.8/include/CGAL/boost/graph/graph_traits_HalfedgeDS.h
deleted file mode 100644
index f7185e8..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/graph_traits_HalfedgeDS.h
+++ /dev/null
@@ -1,252 +0,0 @@
-// Copyright (c) 2007  GeometryFactory (France).  All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Andreas Fabri, Fernando Cacciola
-
-#ifndef CGAL_BOOST_GRAPH_GRAPH_TRAITS_HALFEDGEDS_H
-#define CGAL_BOOST_GRAPH_GRAPH_TRAITS_HALFEDGEDS_H
-
-#include <functional>
-
-// include this to avoid a VC15 warning
-#include <CGAL/boost/graph/named_function_params.h>
-
-#include <boost/config.hpp>
-#include <boost/iterator/iterator_adaptor.hpp>
-#include <boost/iterator/transform_iterator.hpp>
-#include <boost/type_traits/remove_const.hpp>
-
-#include <boost/graph/graph_traits.hpp>
-#include <boost/graph/properties.hpp>
-
-#include <CGAL/basic.h>
-#include <CGAL/boost/graph/iterator.h>
-#include <CGAL/Handle_hash_function.h>
-
-#ifndef CGAL_NO_DEPRECATED_CODE
-#include <CGAL/boost/graph/halfedge_graph_traits.h>
-#endif
-
-namespace CGAL {
-
-namespace internal {
-
-template<typename I>
-class Prevent_deref
-  : public boost::iterator_adaptor<
-  Prevent_deref<I>
-  , I // base
-  , I // value
-  >
-{
-public:
-  typedef boost::iterator_adaptor<
-  Prevent_deref<I>
-  , I // base
-  , I // value
-  > Base;
-  //  typedef typename Prevent_deref::iterator_adaptor_::reference reference;
-  typedef typename Base::reference reference;
-  Prevent_deref() : Base() {};
-  Prevent_deref(const I& i) : Base(i) {};
-private:
-  friend class boost::iterator_core_access;
-  reference dereference() const { return const_cast<typename boost::remove_reference<reference>::type&>(this->base_reference()); }
-};
-
-// a HDS_halfedge pretending to be an Edge
-template<typename Halfedge_handle>
-struct HDS_edge {
-  HDS_edge() : halfedge_() { }
-
-  explicit HDS_edge(const Halfedge_handle& h) : halfedge_(h) {}
-
-  bool operator==(const HDS_edge& other) const {
-    // equality is tricky, we are equal when both halfedges are the
-    // same or when the opposite halfedge of this is the same as
-    // halfedge_.other but we need to be careful not to apply this
-    // should this be the invalid halfedge or opposite is going to
-    // blow up
-    if(halfedge_ == other.halfedge_) {
-      return true;
-    } else if(halfedge_ != Halfedge_handle()) { // not default constructed
-      return halfedge_->opposite() == other.halfedge_;
-    } else {
-      // this is the invalid halfedge, it can only be equal to the
-      // invalid halfedge and this is covered by the first case
-      return false;
-    }
-  }
-
-  bool operator!=(const HDS_edge& other) const {
-    return !(*this == other);
-  }
-
-  friend bool operator<(const HDS_edge& a,const HDS_edge& b)
-  {
-    if(a==b) return false;
-    return a.halfedge_ < b.halfedge_;
-  }
-
-  // forward some function to avoid boilerplate and typedefs inside
-  // the free functions
-
-  HDS_edge next() { return HDS_edge(halfedge_->next()); }
-
-  // this is potentially broken as it does not use the decorator to
-  // find prev, but we cannot instantiate the entire decorator
-  // without the full polyhedron type and taking all necessary
-  // template parameters seems overkill
-  HDS_edge prev() { return HDS_edge(halfedge_->prev()); }
-
-  HDS_edge opposite() { return HDS_edge(halfedge_->opposite()); }
-
-  // this is hacky, we don't know the actual type of the id and if we
-  // start adding decltype special cases we have to do it consistently
-  // up to the property map and maybe back down to Polyhedron.
-  std::size_t id() const { return halfedge_->id() / 2; }
-
-  Halfedge_handle halfedge() const { return halfedge_; }
-
-  // save us some work to do function chaining
-  HDS_edge
-  opposite_next() { return HDS_edge(halfedge_->opposite()->next()); }
-
-  HDS_edge
-  next_opposite() { return HDS_edge(halfedge_->next()->opposite()); }
-
-  HDS_edge
-  prev_opposite() { return HDS_edge(halfedge_->prev()->opposite()); }
-
-  HDS_edge
-  opposite_prev() { return HDS_edge(halfedge_->opposite()->prev()); }
-
-
-private:
-  Halfedge_handle halfedge_;
-};
-
-// make edge_descriptor hashable by default in Unique_hash_map
-namespace handle{
-  template<typename Halfedge_handle>
-  struct Hash_functor< HDS_edge<Halfedge_handle> >
-  {
-    std::size_t
-    operator()(const HDS_edge<Halfedge_handle>& edge)
-    {
-      Halfedge_handle he = edge.halfedge();
-      if ( he < he->opposite() )
-        return Hash_functor<Halfedge_handle>()(he);
-      return Hash_functor<Halfedge_handle>()(he->opposite());
-    }
-  };
-} //end of namespace handle
-
-template<typename Halfedge_handle>
-struct Construct_edge {
-  typedef HDS_edge<Halfedge_handle> result_type;
-  HDS_edge<Halfedge_handle> operator()(const Halfedge_handle& he) const
-  { return HDS_edge<Halfedge_handle>(he); }
-};
-
-template<typename Halfedge_handle>
-struct Construct_edge_opposite {
-  typedef HDS_edge<Halfedge_handle> result_type;
-  HDS_edge<Halfedge_handle> operator()(const Halfedge_handle& he) const
-  { return HDS_edge<Halfedge_handle>(he->opposite()); }
-};
-
-} // internal
-
-template <class HDS>
-struct HDS_graph_traits
-{
-private:
-  struct HDS_graph_traversal_category : public virtual boost::bidirectional_graph_tag,
-                                        public virtual boost::vertex_list_graph_tag,
-                                        public virtual boost::edge_list_graph_tag
-  {};
-
-public:
-  typedef typename HDS::Vertex_handle                                vertex_descriptor;
-  typedef typename internal::HDS_edge<typename HDS::Halfedge_handle> edge_descriptor;
-  typedef typename HDS::Face_handle                                  face_descriptor;
-  typedef typename HDS::Halfedge_handle                              halfedge_descriptor;
-
-  typedef internal::Prevent_deref<typename HDS::Vertex_iterator>     vertex_iterator;
-  typedef internal::Prevent_deref<typename HDS::Face_iterator>       face_iterator;
-  typedef internal::Prevent_deref<typename HDS::Edge_iterator>       edge_iterator_i;
-  typedef internal::Prevent_deref<typename HDS::Halfedge_iterator>   halfedge_iterator;
-
-
-
-  typedef boost::transform_iterator<
-    internal::Construct_edge<typename HDS::Halfedge_handle>,
-    edge_iterator_i,
-    edge_descriptor> edge_iterator;
-
-  typedef Out_edge_iterator<HDS> out_edge_iterator;
-
-  typedef In_edge_iterator<HDS> in_edge_iterator;
-
-  typedef boost::undirected_tag             directed_category;
-  typedef boost::disallow_parallel_edge_tag edge_parallel_category;
-  typedef HDS_graph_traversal_category      traversal_category;
-
-  typedef typename HDS::size_type vertices_size_type;
-  typedef vertices_size_type      edges_size_type;
-  typedef vertices_size_type      halfedges_size_type;
-  typedef vertices_size_type      degree_size_type;
-  typedef vertices_size_type      faces_size_type;
-
-  static vertex_descriptor null_vertex() { return vertex_descriptor(); }
-  static halfedge_descriptor null_halfedge() { return halfedge_descriptor(); }
-  static face_descriptor null_face() { return face_descriptor(); }
-};
-
-
-} //namespace CGAL
-
-
-namespace std {
-
-#if defined(BOOST_MSVC)
-#  pragma warning(push)
-#  pragma warning(disable:4099) // For VC10 it is class hash 
-#endif
-
-#ifndef CGAL_CFG_NO_STD_HASH
-
-  template <typename H>
-  struct hash<CGAL::internal::HDS_edge<H> > {
-    std::size_t operator()(const CGAL::internal::HDS_edge<H>& e) const
-    {
-      std::cerr << "HDS_edge HashFct" << std::endl;
-      std::hash<H> fct;
-      return fct(e.halfedge());
-    }
-  };
-
-#endif // CGAL_CFG_NO_STD_HASH
-
-#if defined(BOOST_MSVC)
-#  pragma warning(pop)
-#endif
-
-} // namespace std
-
-#endif // CGAL_BOOST_GRAPH_GRAPH_TRAITS_HALFEDGEDS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/graph_traits_PolyMesh_ArrayKernelT.h b/3rdparty/CGAL-4.8/include/CGAL/boost/graph/graph_traits_PolyMesh_ArrayKernelT.h
deleted file mode 100644
index ff8ddf2..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/graph_traits_PolyMesh_ArrayKernelT.h
+++ /dev/null
@@ -1,697 +0,0 @@
-// Copyright (c) 2007  GeometryFactory (France).  All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Andreas Fabri, Philipp Moeller
-
-#ifndef CGAL_BOOST_GRAPH_GRAPH_TRAITS_POLYMESH_ARRAYKERNELT_H
-#define CGAL_BOOST_GRAPH_GRAPH_TRAITS_POLYMESH_ARRAYKERNELT_H
-
-// include this to avoid a VC15 warning
-#include <CGAL/boost/graph/named_function_params.h>
-
-#include <boost/graph/graph_traits.hpp>
-#include <boost/graph/properties.hpp>
-
-#include <boost/iterator/transform_iterator.hpp>
-
-#include <CGAL/boost/graph/properties_PolyMesh_ArrayKernelT.h>
-#include <CGAL/boost/graph/internal/OM_iterator_from_circulator.h>
-#include <CGAL/boost/graph/iterator.h>
-#include <CGAL/Iterator_range.h>
-#include <CGAL/boost/graph/helpers.h>
-#include <CGAL/assertions.h>
-
-#include <OpenMesh/Core/Mesh/PolyMesh_ArrayKernelT.hh>
-
-// http://openmesh.org/Documentation/OpenMesh-Doc-Latest/classOpenMesh_1_1Concepts_1_1KernelT.html
-
-#if defined(BOOST_MSVC)
-#  pragma warning(push)
-#  pragma warning(disable:4267)
-#endif
-namespace CGAL { namespace internal {
-
-
-template<typename Halfedge_handle>
-class OMesh_edge {
-public:
-  OMesh_edge() : halfedge_() {}
-  explicit OMesh_edge(const Halfedge_handle& h) : halfedge_(h) {}
-  Halfedge_handle halfedge() const { return halfedge_; }
-  bool is_valid() const { return halfedge_.is_valid(); }
-
-  bool
-  operator==(const OMesh_edge& other) {
-    if(halfedge_ == other.halfedge_) {
-      return true;
-    } else if(halfedge_ != Halfedge_handle()) {
-      return opposite() == other.halfedge_;
-    } else {
-      return false;
-    }
-  }
-
-  bool operator<(const OMesh_edge& other) const
-  { 
-    return this->idx() < other.idx();
-  }
-
-  bool
-  operator!=(const OMesh_edge& other) { return !(*this == other); }
-
-  Halfedge_handle
-  opposite() const { return Halfedge_handle((halfedge_.idx() & 1) ? halfedge_.idx()-1 : halfedge_.idx()+1); }
-
-  OMesh_edge
-  opposite_edge() const { return OMesh_edge(Halfedge_handle((halfedge_.idx() & 1) ? halfedge_.idx()-1 : halfedge_.idx()+1)); }
-
-  unsigned int idx() const { return halfedge_.idx() / 2; }
-private:
-  Halfedge_handle halfedge_;
-};
-
-template <typename Halfedge_handle, typename OMeshEdge>
-struct Convert_omesh_edge
-{
-  typedef OMesh_edge<Halfedge_handle> result_type;
-  result_type operator()(const OMeshEdge& h) const { 
-    return result_type(Halfedge_handle(h.idx() * 2)); 
-  }
-};
-
-template <typename Halfedge_handle>
-struct Construct_omesh_edge
-{
-  typedef OMesh_edge<Halfedge_handle> result_type;
-  template <typename T>
-  result_type operator()(const T& h) const { return result_type(h); }
-};
-
-template <typename Halfedge_handle>
-struct Construct_omesh_edge_opposite
-{
-  typedef OMesh_edge<Halfedge_handle> result_type;
-  template <typename T>
-  result_type operator()(const T& h) const { return result_type(h).opposite_edge(); }
-};
-
-
-} // internal
-} // CGAL
-
-
-namespace boost {
-
-template <class K>
-struct graph_traits< OpenMesh::PolyMesh_ArrayKernelT<K> >
-{
-private:
-  typedef OpenMesh::PolyMesh_ArrayKernelT<K> SM;
-
-  struct SM_graph_traversal_category : public virtual boost::bidirectional_graph_tag,
-                                       public virtual boost::vertex_list_graph_tag,
-                                       public virtual boost::edge_list_graph_tag
-  {};
-
-public:
-  // Graph
-  typedef typename SM::VertexHandle                                        vertex_descriptor;
-  typedef typename SM::Point                                               vertex_property_type;
-  typedef typename CGAL::internal::OMesh_edge<typename SM::HalfedgeHandle> edge_descriptor;
-  typedef boost::undirected_tag                                            directed_category;
-  typedef boost::disallow_parallel_edge_tag                                edge_parallel_category; 
-  typedef SM_graph_traversal_category                                      traversal_category;
-
-  // HalfedgeGraph
-  typedef typename SM::HalfedgeHandle              halfedge_descriptor;
-
-   // FaceGraph
-  typedef typename SM::FaceHandle   face_descriptor;
-  
-  // VertexListGraph
-  typedef typename SM::VertexIter   vertex_iterator;
-  typedef unsigned int              vertices_size_type;
-  // EdgeListGraph
-  typedef boost::transform_iterator<
-    CGAL::internal::Convert_omesh_edge<typename SM::HalfedgeHandle, typename SM::EdgeHandle>,
-    typename SM::EdgeIter,
-    edge_descriptor>                edge_iterator;
-
-  typedef unsigned int              edges_size_type;
-  // HalfEdgeListGraph
-  typedef typename SM::HalfedgeIter halfedge_iterator;
-  typedef unsigned int              halfedges_size_type;
-  // FaceListGraph
-  typedef typename SM::FaceIter     face_iterator;
-  typedef unsigned int              faces_size_type;
-
-  // IncidenceGraph
-  typedef unsigned int              degree_size_type;
-
-  
-  typedef CGAL::In_edge_iterator<SM> in_edge_iterator;
-
-  typedef CGAL::Out_edge_iterator<SM> out_edge_iterator;
-
-  // nulls
-  static vertex_descriptor   null_vertex() { return vertex_descriptor(); }
-  static face_descriptor     null_face()   { return face_descriptor(); }
-  static halfedge_descriptor     null_halfedge()   { return halfedge_descriptor(); }
-};
-
-template<typename K>
-struct graph_traits< const OpenMesh::PolyMesh_ArrayKernelT<K> >  
-  : public graph_traits< OpenMesh::PolyMesh_ArrayKernelT<K> >
-{ };
-
-} // namespace boost
-
-namespace OpenMesh {
-
-template <typename K>
-typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertices_size_type
-num_vertices(const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
-{
-  return sm.n_vertices();
-}
-  
-
-template <typename K>
-typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::edges_size_type
-num_edges(const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
-{
-  return sm.n_edges();
-}
-  
-
-template <typename K>
-typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::degree_size_type
-degree(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor v,
-       const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
-{
-  return sm.valence(v);
-}
-
-         
-template <typename K>
-typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::degree_size_type
-out_degree(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor v,
-           const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
-{
-  return sm.valence(v);
-}
-             
-  
-template <typename K>
-typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::degree_size_type
-in_degree(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor v,
-          const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
-{
-  return sm.valence(v);
-}
-            
-  
-template <typename K>
-typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor
-source(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::edge_descriptor e,
-       const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
-{
-  return sm.from_vertex_handle(e.halfedge());
-}
-
-template <typename K>
-typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor
-source(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor h,
-       const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
-{
-  return sm.from_vertex_handle(h);
-}
-         
-
-template <typename K>
-typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor
-target(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::edge_descriptor e,
-       const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
-{
-  return sm.to_vertex_handle(e.halfedge());
-}
-
-template <typename K>
-typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor
-target(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor h,
-       const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
-{
-  return sm.to_vertex_handle(h);
-}
-    
-template <typename K>
-CGAL::Iterator_range<typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_iterator>
-vertices(const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
-{
-  return CGAL::make_range(sm.vertices_sbegin(), sm.vertices_end()); 
-}
-
- 
-template <typename K>
-CGAL::Iterator_range<typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::edge_iterator>
-edges(const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
-{
-  typedef typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::edge_iterator iterator;
-  iterator beg(sm.edges_sbegin());
-  iterator end(sm.edges_end());
-  return CGAL::make_range(beg,end); 
-}
-
-  
-template <typename K>
-CGAL::Iterator_range<typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::in_edge_iterator>
-in_edges(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor v,
-         const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
-{
-  typedef typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::in_edge_iterator Iter;
-
-  return CGAL::make_range(Iter(halfedge(v,sm),sm), Iter(halfedge(v,sm),sm,1));
-}
-
-
-template <typename K>
-CGAL::Iterator_range<typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::out_edge_iterator>
-out_edges(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor v,
-          const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
-{
-  typedef typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::out_edge_iterator Iter;
-  return CGAL::make_range(Iter(halfedge(v,sm),sm), Iter(halfedge(v,sm),sm,1));
-}
-
-
-template<typename K>
-std::pair<typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::edge_descriptor,
-          bool>
-edge(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor u, 
-     typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor v, 
-     const OpenMesh::PolyMesh_ArrayKernelT<K>& sm) {
-  typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::edge_descriptor 
-    he(sm.find_halfedge(u, v));
-  return std::make_pair(he, he.is_valid());
-}
-
-
-//
-// HalfedgeGraph
-//
-template <typename K>
-typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor
-next(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor h,
-     const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
-{
-  return sm.next_halfedge_handle(h);
-}
-
-template <typename K>
-typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor
-prev(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor h,
-     const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
-{
-  return sm.prev_halfedge_handle(h);
-}
-
-template <typename K>
-typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor
-opposite(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor h,
-         const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
-{
-  return sm.opposite_halfedge_handle(h);
-}
-
-template <typename K>
-typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::edge_descriptor
-edge(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor h,
-     const OpenMesh::PolyMesh_ArrayKernelT<K>& /*sm*/)
-{
-  return typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::edge_descriptor(h);
-}
-
-template <typename K>
-typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor
-halfedge(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::edge_descriptor e,
-         const OpenMesh::PolyMesh_ArrayKernelT<K>&)
-{
-  return e.halfedge();
-}
-
-template <typename K>
-typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor
-halfedge(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor v,
-         const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
-{
-  if(sm.halfedge_handle(v) == boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::null_halfedge()){
-    return boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::null_halfedge();
-  }
-  // prev because OpenMesh stores out-going halfedges
-  // return sm.prev_halfedge_handle(sm.halfedge_handle(v));
-  return sm.opposite_halfedge_handle(sm.halfedge_handle(v));
-}
-
-
-template <typename K>
-std::pair<
-  typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor,
-  bool
->
-halfedge(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor u,
-         typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor v,
-         const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
-{
-  typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor h = sm.find_halfedge(u, v);
-  return std::make_pair(h, h.is_valid());
-}
-
-
-
-//
-// HalfedgeListGraph
-//
-template <typename K>
-CGAL::Iterator_range<typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_iterator>
-halfedges(const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
-{
-  return CGAL::make_range(sm.halfedges_sbegin(), sm.halfedges_end());
-}
-
-template <typename K>
-typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedges_size_type
-num_halfedges(const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
-{
-  return sm.n_halfedges();
-}
-
-
-
-//
-// MutableHalfedgeGraph
-//
-template<typename K>
-void
-set_next(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor h1, 
-         typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor h2,
-         OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
-{
-  sm.set_next_halfedge_handle(h1, h2);
-}
-
-
-
-template<typename K>
-void
-set_target(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor h,
-           typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor v,
-           OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
-{
-  sm.set_vertex_handle(h, v);
-}
-
-
-template<typename K>
-void
-set_halfedge(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor v,
-             typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor h,
-             OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
-{
-  sm.set_halfedge_handle(v, sm.opposite_halfedge_handle(h));
-}
-
-
-template<typename K>
-void
-adjust_border_halfedge(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor v,
-                       OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
-{
-  sm.adjust_outgoing_halfedge(v);
-}
-
-template<typename K>
-void
-garbage_collection(OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
-{
-  sm.garbage_collection();
-}
-
-template<typename K>
-typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::edge_descriptor
-add_edge(OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
-{
-  return edge(sm.new_edge(boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::null_vertex(),
-                          boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::null_vertex() ), sm);
-}
-
-
-//
-// FaceGraph
-//
-template<typename K>
-typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor
-halfedge(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::face_descriptor f,
-     const OpenMesh::PolyMesh_ArrayKernelT<K>& sm) 
-{
-  return sm.halfedge_handle(f);
-}
-  
-template<typename K>
-typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::face_descriptor
-face(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor h,
-     const OpenMesh::PolyMesh_ArrayKernelT<K>& sm) 
-{
-  return sm.face_handle(h);
-}
-
-
-
-//
-// MutableFaceGraph
-//
-template<typename K>
-void
-set_face(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor h,
-         typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::face_descriptor f,
-         OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
-{
-  sm.set_face_handle(h, f);
-}
-
-  
-template<typename K>
-void
-set_halfedge(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::face_descriptor f,
-             typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor h,
-             OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
-{
-  sm.set_halfedge_handle(f, h);
-}
-
- 
-//
-// FaceListGraph
-//
-template <typename K>
-typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::faces_size_type
-num_faces(const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
-{
-  return sm.n_faces();
-}
-  
-template <typename K>
-CGAL::Iterator_range<typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::face_iterator>
-faces(const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
-{
-  return CGAL::make_range(sm.faces_sbegin(), sm.faces_end()); 
-}
- 
-
-template <typename K>
-typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor
-add_vertex(OpenMesh::PolyMesh_ArrayKernelT<K>& sm) {
-  return sm.new_vertex();
-}
-
-  /*
-
-// MutableGraph
-// add a vertex with a default constructed property
-template <typename K>
-typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor
-add_vertex(OpenMesh::PolyMesh_ArrayKernelT<K>& sm) {
-  return sm.add_vertex(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_property_type());
-}
-
-template <typename K>
-typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor
-add_vertex(const typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_property_type& p, OpenMesh::PolyMesh_ArrayKernelT<K>& sm) {
-  return sm.add_vertex(p);
-}
-
-template <typename K>
-void
-clear_vertex(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor, 
-             OpenMesh::PolyMesh_ArrayKernelT<K>&) {
-  CGAL_assert(false);
-}
-
-  */
-
-template <typename K>
-void
-remove_vertex(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor v, 
-              OpenMesh::PolyMesh_ArrayKernelT<K>& sm) {
-
-  sm.request_face_status();
-  sm.request_vertex_status();
-  sm.request_halfedge_status();
-  sm.set_halfedge_handle(v, typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor());
-  sm.status(v).set_deleted(true);
-}
-
-  
-template <typename K>
-void
-remove_edge(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor u, 
-            typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor v, 
-            OpenMesh::PolyMesh_ArrayKernelT<K>& sm) 
-{
-  typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::edge_descriptor e = edge(u, v, sm);
-  remove_edge(e,sm);
-}
-
-template <typename K>
-void
-remove_edge(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::edge_descriptor e, 
-            OpenMesh::PolyMesh_ArrayKernelT<K>& sm) 
-{
-  sm.request_face_status();
-  sm.request_vertex_status();
-  sm.request_halfedge_status();
-  sm.request_edge_status();
-
-  typedef typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor halfedge_descriptor;
-
-  halfedge_descriptor h1 = halfedge(e,sm);
-  halfedge_descriptor h2 = opposite(halfedge(e,sm),sm);
-  sm.status(sm.edge_handle(h1)).set_deleted(true);
-  sm.status(h1).set_deleted(true);
-  sm.status(h2).set_deleted(true);
-
-}
-
-
-template <typename K>
-void
-remove_edge(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::edge_iterator eiter, 
-            OpenMesh::PolyMesh_ArrayKernelT<K>& sm) 
-{
-  remove_edge(*eiter, sm);
-}
-
-template<typename K>
-void
-remove_face(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::face_descriptor f, 
-            OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
-{
-
-  sm.request_face_status();
-  sm.request_vertex_status();
-  sm.request_halfedge_status();
-  
-  set_halfedge(f, typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor(), sm);
-  sm.status(f).set_deleted(true);
-}
-
-#if 0 // conflits with function in Euler_operations.h
-template<typename K>
-std::pair<typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::edge_descriptor,
-          bool>
-add_edge(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor v1, 
-         typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor v2, 
-         OpenMesh::PolyMesh_ArrayKernelT<K>& sm) {
-  
-  return sm.new_edge(v1, v2);
-}
-#endif
-
-template<typename K>
-typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::face_descriptor
-add_face(OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
-{
-  return sm.new_face();
-}
-
-template<typename K, typename InputIterator>
-typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::face_descriptor
-add_face(InputIterator begin, InputIterator end, OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
-{
-  std::vector<typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor> 
-    v(begin, end);
-  return sm.add_face(v);
-}
-
-template<typename K>
-bool is_valid(OpenMesh::PolyMesh_ArrayKernelT<K>& sm, bool /* verbose */ = false)
-{
-  return CGAL::is_valid_polygon_mesh(sm);
-}
-
-} // namespace OpenMesh
-
-namespace CGAL {
-
-// Overload CGAL::clear function. PolyMesh_ArrayKernel behaves
-// differently from other meshes. Calling clear does not affect the
-// number of vertices, edges, or faces in the mesh. To get actual
-// numbers it is necessary to first collect garbage. We add an
-// overlaod to get consistent behavior.
-template<typename K>
-void clear(OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
-{
-  sm.clear();
-  sm.garbage_collection(true, true, true);
-  CGAL_postcondition(num_edges(sm) == 0);
-  CGAL_postcondition(num_vertices(sm) == 0);
-  CGAL_postcondition(num_faces(sm) == 0);
-}
-
-}
-
-
-#ifndef CGAL_NO_DEPRECATED_CODE
-#include <CGAL/boost/graph/backward_compatibility_functions.h>
-
-namespace boost {
-  // The following functions were defined in the namespace boost
-  using OpenMesh::vertices;
-  using OpenMesh::edges;
-  using OpenMesh::num_vertices;
-  using OpenMesh::num_edges;
-  using OpenMesh::out_edges;
-  using OpenMesh::in_edges;
-  using OpenMesh::target;
-  using OpenMesh::source;
-} // namespace boost
-#endif //CGAL_NO_DEPRECATED_CODE
-
-#if defined(BOOST_MSVC)
-#  pragma warning(pop)
-#endif
-
-#endif // CGAL_BOOST_GRAPH_TRAITS_POLYMESH_ARRAYKERNELT_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/graph_traits_TriMesh_ArrayKernelT.h b/3rdparty/CGAL-4.8/include/CGAL/boost/graph/graph_traits_TriMesh_ArrayKernelT.h
deleted file mode 100644
index 53e6a57..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/graph_traits_TriMesh_ArrayKernelT.h
+++ /dev/null
@@ -1,614 +0,0 @@
-// Copyright (c) 2007  GeometryFactory (France).  All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Andreas Fabri, Philipp Moeller
-
-#ifndef CGAL_BOOST_GRAPH_GRAPH_TRAITS_TRIMESH_ARRAYKERNELT_H
-#define CGAL_BOOST_GRAPH_GRAPH_TRAITS_TRIMESH_ARRAYKERNELT_H
-
-#include <boost/graph/graph_traits.hpp>
-#include <boost/graph/properties.hpp>
-
-#include <boost/iterator/transform_iterator.hpp>
-
-#include <CGAL/boost/graph/properties_TriMesh_ArrayKernelT.h>
-#include <CGAL/boost/graph/graph_traits_PolyMesh_ArrayKernelT.h>
-#include <CGAL/boost/graph/internal/OM_iterator_from_circulator.h>
-#include <CGAL/boost/graph/iterator.h>
-#include <CGAL/Iterator_range.h>
-#include <CGAL/boost/graph/helpers.h>
-#include <CGAL/assertions.h>
-
-#include <OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh>
-
-// http://openmesh.org/Documentation/OpenMesh-Doc-Latest/classOpenMesh_1_1Concepts_1_1KernelT.html
-
-#if defined(BOOST_MSVC)
-#  pragma warning(push)
-#  pragma warning(disable:4267)
-#endif
-
-namespace boost {
-
-template <class K>
-struct graph_traits< OpenMesh::TriMesh_ArrayKernelT<K> >
-{
-private:
-  typedef OpenMesh::TriMesh_ArrayKernelT<K> SM;
-
-  struct SM_graph_traversal_category : public virtual boost::bidirectional_graph_tag,
-                                       public virtual boost::vertex_list_graph_tag,
-                                       public virtual boost::edge_list_graph_tag
-  {};
-
-public:
-  // Graph
-  typedef typename SM::VertexHandle                                        vertex_descriptor;
-  typedef typename SM::Point                                               vertex_property_type;
-  typedef typename CGAL::internal::OMesh_edge<typename SM::HalfedgeHandle> edge_descriptor;
-  typedef boost::undirected_tag                                            directed_category;
-  typedef boost::disallow_parallel_edge_tag                                edge_parallel_category; 
-  typedef SM_graph_traversal_category                                      traversal_category;
-
-  // HalfedgeGraph
-  typedef typename SM::HalfedgeHandle              halfedge_descriptor;
-
-   // FaceGraph
-  typedef typename SM::FaceHandle   face_descriptor;
-  
-  // VertexListGraph
-  typedef typename SM::VertexIter   vertex_iterator;
-  typedef unsigned int              vertices_size_type;
-  // EdgeListGraph
-  typedef boost::transform_iterator<
-    CGAL::internal::Convert_omesh_edge<typename SM::HalfedgeHandle, typename SM::EdgeHandle>,
-    typename SM::EdgeIter,
-    edge_descriptor>                edge_iterator;
-
-  typedef unsigned int              edges_size_type;
-  // HalfEdgeListGraph
-  typedef typename SM::HalfedgeIter halfedge_iterator;
-  typedef unsigned int              halfedges_size_type;
-  // FaceListGraph
-  typedef typename SM::FaceIter     face_iterator;
-  typedef unsigned int              faces_size_type;
-
-  // IncidenceGraph
-  typedef unsigned int              degree_size_type;
-
-  
-  typedef CGAL::In_edge_iterator<SM> in_edge_iterator;
-
-  typedef CGAL::Out_edge_iterator<SM> out_edge_iterator;
-
-  // nulls
-  static vertex_descriptor   null_vertex() { return vertex_descriptor(); }
-  static face_descriptor     null_face()   { return face_descriptor(); }
-  static halfedge_descriptor     null_halfedge()   { return halfedge_descriptor(); }
-};
-
-template<typename K>
-struct graph_traits< const OpenMesh::TriMesh_ArrayKernelT<K> >  
-  : public graph_traits< OpenMesh::TriMesh_ArrayKernelT<K> >
-{ };
-
-} // namespace boost
-
-namespace OpenMesh {
-
-template <typename K>
-typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertices_size_type
-num_vertices(const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
-{
-  return sm.n_vertices();
-}
-  
-
-template <typename K>
-typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::edges_size_type
-num_edges(const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
-{
-  return sm.n_edges();
-}
-  
-
-template <typename K>
-typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::degree_size_type
-degree(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor v,
-       const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
-{
-  return sm.valence(v);
-}
-
-         
-template <typename K>
-typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::degree_size_type
-out_degree(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor v,
-           const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
-{
-  return sm.valence(v);
-}
-             
-  
-template <typename K>
-typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::degree_size_type
-in_degree(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor v,
-          const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
-{
-  return sm.valence(v);
-}
-            
-  
-template <typename K>
-typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor
-source(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::edge_descriptor e,
-       const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
-{
-  return sm.from_vertex_handle(e.halfedge());
-}
-
-template <typename K>
-typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor
-source(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor h,
-       const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
-{
-  return sm.from_vertex_handle(h);
-}
-         
-
-template <typename K>
-typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor
-target(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::edge_descriptor e,
-       const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
-{
-  return sm.to_vertex_handle(e.halfedge());
-}
-
-template <typename K>
-typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor
-target(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor h,
-       const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
-{
-  return sm.to_vertex_handle(h);
-}
-    
-template <typename K>
-CGAL::Iterator_range<typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_iterator>
-vertices(const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
-{
-  return CGAL::make_range(sm.vertices_sbegin(), sm.vertices_end()); 
-}
-
- 
-template <typename K>
-CGAL::Iterator_range<typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::edge_iterator>
-edges(const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
-{
-  typedef typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::edge_iterator iterator;
-  iterator beg(sm.edges_sbegin());
-  iterator end(sm.edges_end());
-  return CGAL::make_range(beg,end); 
-}
-
-  
-template <typename K>
-CGAL::Iterator_range<typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::in_edge_iterator>
-in_edges(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor v,
-         const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
-{
-  typedef typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::in_edge_iterator Iter;
-
-  return CGAL::make_range(Iter(halfedge(v,sm),sm), Iter(halfedge(v,sm),sm,1));
-}
-
-
-template <typename K>
-CGAL::Iterator_range<typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::out_edge_iterator>
-out_edges(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor v,
-          const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
-{
-  typedef typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::out_edge_iterator Iter;
-  return CGAL::make_range(Iter(halfedge(v,sm),sm), Iter(halfedge(v,sm),sm,1));
-}
-
-
-template<typename K>
-std::pair<typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::edge_descriptor,
-          bool>
-edge(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor u, 
-     typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor v, 
-     const OpenMesh::TriMesh_ArrayKernelT<K>& sm) {
-  typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::edge_descriptor 
-    he(sm.find_halfedge(u, v));
-  return std::make_pair(he, he.is_valid());
-}
-
-
-//
-// HalfedgeGraph
-//
-template <typename K>
-typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor
-next(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor h,
-     const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
-{
-  return sm.next_halfedge_handle(h);
-}
-
-template <typename K>
-typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor
-prev(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor h,
-     const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
-{
-  return sm.prev_halfedge_handle(h);
-}
-
-template <typename K>
-typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor
-opposite(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor h,
-         const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
-{
-  return sm.opposite_halfedge_handle(h);
-}
-
-template <typename K>
-typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::edge_descriptor
-edge(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor h,
-     const OpenMesh::TriMesh_ArrayKernelT<K>& /*sm*/)
-{
-  return typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::edge_descriptor(h);
-}
-
-template <typename K>
-typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor
-halfedge(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::edge_descriptor e,
-         const OpenMesh::TriMesh_ArrayKernelT<K>&)
-{
-  return e.halfedge();
-}
-
-template <typename K>
-typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor
-halfedge(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor v,
-         const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
-{
-  if(sm.halfedge_handle(v) == boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::null_halfedge()){
-    return boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::null_halfedge();
-  }
-  // prev because OpenMesh stores out-going halfedges
-  // return sm.prev_halfedge_handle(sm.halfedge_handle(v));
-  return sm.opposite_halfedge_handle(sm.halfedge_handle(v));
-}
-
-
-template <typename K>
-std::pair<
-  typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor,
-  bool
->
-halfedge(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor u,
-         typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor v,
-         const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
-{
-  typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor h = sm.find_halfedge(u, v);
-  return std::make_pair(h, h.is_valid());
-}
-
-
-
-//
-// HalfedgeListGraph
-//
-template <typename K>
-CGAL::Iterator_range<typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_iterator>
-halfedges(const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
-{
-  return CGAL::make_range(sm.halfedges_sbegin(), sm.halfedges_end());
-}
-
-template <typename K>
-typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedges_size_type
-num_halfedges(const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
-{
-  return sm.n_halfedges();
-}
-
-
-
-//
-// MutableHalfedgeGraph
-//
-template<typename K>
-void
-set_next(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor h1, 
-         typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor h2,
-         OpenMesh::TriMesh_ArrayKernelT<K>& sm)
-{
-  sm.set_next_halfedge_handle(h1, h2);
-}
-
-
-
-template<typename K>
-void
-set_target(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor h,
-           typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor v,
-           OpenMesh::TriMesh_ArrayKernelT<K>& sm)
-{
-  sm.set_vertex_handle(h, v);
-}
-
-
-template<typename K>
-void
-set_halfedge(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor v,
-             typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor h,
-             OpenMesh::TriMesh_ArrayKernelT<K>& sm)
-{
-  sm.set_halfedge_handle(v, sm.opposite_halfedge_handle(h));
-}
-
-
-template<typename K>
-void
-adjust_border_halfedge(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor v,
-                       OpenMesh::TriMesh_ArrayKernelT<K>& sm)
-{
-  sm.adjust_outgoing_halfedge(v);
-}
-
-template<typename K>
-void
-garbage_collection(OpenMesh::TriMesh_ArrayKernelT<K>& sm)
-{
-  sm.garbage_collection();
-}
-
-template<typename K>
-typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::edge_descriptor
-add_edge(OpenMesh::TriMesh_ArrayKernelT<K>& sm)
-{
-  return edge(sm.new_edge(boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::null_vertex(),
-                          boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::null_vertex() ), sm);
-}
-
-
-//
-// FaceGraph
-//
-template<typename K>
-typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor
-halfedge(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::face_descriptor f,
-     const OpenMesh::TriMesh_ArrayKernelT<K>& sm) 
-{
-  return sm.halfedge_handle(f);
-}
-  
-template<typename K>
-typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::face_descriptor
-face(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor h,
-     const OpenMesh::TriMesh_ArrayKernelT<K>& sm) 
-{
-  return sm.face_handle(h);
-}
-
-
-
-//
-// MutableFaceGraph
-//
-template<typename K>
-void
-set_face(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor h,
-         typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::face_descriptor f,
-         OpenMesh::TriMesh_ArrayKernelT<K>& sm)
-{
-  sm.set_face_handle(h, f);
-}
-
-  
-template<typename K>
-void
-set_halfedge(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::face_descriptor f,
-             typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor h,
-             OpenMesh::TriMesh_ArrayKernelT<K>& sm)
-{
-  sm.set_halfedge_handle(f, h);
-}
-
- 
-//
-// FaceListGraph
-//
-template <typename K>
-typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::faces_size_type
-num_faces(const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
-{
-  return sm.n_faces();
-}
-  
-template <typename K>
-CGAL::Iterator_range<typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::face_iterator>
-faces(const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
-{
-  return CGAL::make_range(sm.faces_sbegin(), sm.faces_end()); 
-}
- 
-
-template <typename K>
-typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor
-add_vertex(OpenMesh::TriMesh_ArrayKernelT<K>& sm) {
-  return sm.new_vertex();
-}
-
-  /*
-
-// MutableGraph
-// add a vertex with a default constructed property
-template <typename K>
-typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor
-add_vertex(OpenMesh::TriMesh_ArrayKernelT<K>& sm) {
-  return sm.add_vertex(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_property_type());
-}
-
-template <typename K>
-typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor
-add_vertex(const typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_property_type& p, OpenMesh::TriMesh_ArrayKernelT<K>& sm) {
-  return sm.add_vertex(p);
-}
-
-template <typename K>
-void
-clear_vertex(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor, 
-             OpenMesh::TriMesh_ArrayKernelT<K>&) {
-  CGAL_assert(false);
-}
-
-  */
-
-template <typename K>
-void
-remove_vertex(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor v, 
-              OpenMesh::TriMesh_ArrayKernelT<K>& sm) {
-
-  sm.request_face_status();
-  sm.request_vertex_status();
-  sm.request_halfedge_status();
-  sm.set_halfedge_handle(v, typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor());
-  sm.status(v).set_deleted(true);
-}
-
-  
-template <typename K>
-void
-remove_edge(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor u, 
-            typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor v, 
-            OpenMesh::TriMesh_ArrayKernelT<K>& sm) 
-{
-  typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::edge_descriptor e = edge(u, v, sm);
-  remove_edge(e,sm);
-}
-
-template <typename K>
-void
-remove_edge(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::edge_descriptor e, 
-            OpenMesh::TriMesh_ArrayKernelT<K>& sm) 
-{
-  sm.request_face_status();
-  sm.request_vertex_status();
-  sm.request_halfedge_status();
-  sm.request_edge_status();
-
-  typedef typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor halfedge_descriptor;
-
-  halfedge_descriptor h1 = halfedge(e,sm);
-  halfedge_descriptor h2 = opposite(halfedge(e,sm),sm);
-  sm.status(sm.edge_handle(h1)).set_deleted(true);
-  sm.status(h1).set_deleted(true);
-  sm.status(h2).set_deleted(true);
-
-}
-
-
-template <typename K>
-void
-remove_edge(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::edge_iterator eiter, 
-            OpenMesh::TriMesh_ArrayKernelT<K>& sm) 
-{
-  remove_edge(*eiter, sm);
-}
-
-template<typename K>
-void
-remove_face(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::face_descriptor f, 
-            OpenMesh::TriMesh_ArrayKernelT<K>& sm)
-{
-
-  sm.request_face_status();
-  sm.request_vertex_status();
-  sm.request_halfedge_status();
-  
-  set_halfedge(f, typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor(), sm);
-  sm.status(f).set_deleted(true);
-}
-
-#if 0 // conflits with function in Euler_operations.h
-template<typename K>
-std::pair<typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::edge_descriptor,
-          bool>
-add_edge(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor v1, 
-         typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor v2, 
-         OpenMesh::TriMesh_ArrayKernelT<K>& sm) {
-  
-  return sm.new_edge(v1, v2);
-}
-#endif
-
-template<typename K>
-typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::face_descriptor
-add_face(OpenMesh::TriMesh_ArrayKernelT<K>& sm)
-{
-  return sm.new_face();
-}
-
-template<typename K, typename InputIterator>
-typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::face_descriptor
-add_face(InputIterator begin, InputIterator end, OpenMesh::TriMesh_ArrayKernelT<K>& sm)
-{
-  typedef typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor vertex_descriptor;
-  assert(begin!= end);
-  vertex_descriptor u = *begin; 
-  ++begin;  
-  assert(begin!= end);
-    vertex_descriptor v = *begin; 
-  ++begin;  
-  assert(begin!= end);
-    vertex_descriptor w = *begin; 
-
-  return sm.add_face(u,v,w);
-}
-
-template<typename K>
-bool is_valid(OpenMesh::TriMesh_ArrayKernelT<K>& sm, bool /* verbose */ = false)
-{
-  return CGAL::is_valid_polygon_mesh(sm);
-}
-
-} // namespace OpenMesh
-
-
-#ifndef CGAL_NO_DEPRECATED_CODE
-#include <CGAL/boost/graph/backward_compatibility_functions.h>
-
-namespace boost {
-  // The following functions were defined in the namespace boost
-  using OpenMesh::vertices;
-  using OpenMesh::edges;
-  using OpenMesh::num_vertices;
-  using OpenMesh::num_edges;
-  using OpenMesh::out_edges;
-  using OpenMesh::in_edges;
-  using OpenMesh::target;
-  using OpenMesh::source;
-} // namespace boost
-#endif //CGAL_NO_DEPRECATED_CODE
-
-#if defined(BOOST_MSVC)
-#  pragma warning(pop)
-#endif
-
-#endif // CGAL_BOOST_GRAPH_TRAITS_TRIMESH_ARRAYKERNELT_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/graph_traits_Triangulation_2.h b/3rdparty/CGAL-4.8/include/CGAL/boost/graph/graph_traits_Triangulation_2.h
deleted file mode 100644
index 8c8e411..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/graph_traits_Triangulation_2.h
+++ /dev/null
@@ -1,873 +0,0 @@
-// Copyright (c) 2007  GeometryFactory (France).  All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Andreas Fabri, Fernando Cacciola
-
-#ifndef CGAL_GRAPH_TRAITS_TRIANGULATION_2_H
-#define CGAL_GRAPH_TRAITS_TRIANGULATION_2_H
-
-#include <functional>
-
-// include this to avoid a VC15 warning
-#include <CGAL/boost/graph/named_function_params.h>
-
-#include <boost/config.hpp>
-#include <boost/iterator_adaptors.hpp>
-#include <boost/graph/graph_traits.hpp>
-#include <boost/graph/properties.hpp>
-
-#include <CGAL/boost/graph/properties.h>
-#include <CGAL/Triangulation_2.h>
-#include <CGAL/Iterator_range.h>
-
-// The functions and classes in this file allows the user to
-// treat a CGAL Triangulation_2 object as a boost graph "as is". No
-// wrapper is needed for the Triangulation_2 object.
-
-
-namespace CGAL {
-
-  namespace detail {
-
-template < class T, class EdgeBase >
-class Edge : public EdgeBase {
-
-public:
-  typedef typename T::Face_handle Face_handle ;
-  
-  Edge()
-  {}
-
-  Edge(Face_handle  fh, int i)
-    : EdgeBase(fh,i)
-  {}
-  
-  Edge(const EdgeBase& e)
-    : EdgeBase(e)
-  {}
-
-  Edge(const Edge& e)
-    : EdgeBase(e)
-  {}
-
-  Edge&
-  operator=(const Edge& e)
-  {
-    this->first = e.first;
-    this->second = e.second;
-    return *this;
-  }
-
-  friend std::size_t hash_value(const Edge& e)
-  {
-    return hash_value(e.first);
-  }
-
-  bool operator==(const Edge& other) const
-  {
-    if((this->first == other.first)&&(this->second == other.second)) return true;
-    Face_handle fh = this->first->neighbor(this->second);
-    if(other.first != fh) return false;
-    int i = fh->index(this->first);
-    return (other.second == i);
-  }
-
-  bool operator!=(Edge& other) const
-  {
-    return ! (*this == other);
-  }
-};
-
-template <class Circ, class E>
-class Out_edge_circulator : public Circ
-{
-private:
-  mutable E e;
-
-public:
-
-  typedef E value_type;
-  typedef E* pointer;
-  typedef E& reference;
-
-  Out_edge_circulator()
-    : Circ()
-  {}
-
-  Out_edge_circulator(Circ c)
-    : Circ(c)
-  {}
-
-  const E& operator*() const
-  {
-    E ed = static_cast<const Circ*>(this)->operator*();
-    e = E(ed.first->neighbor(ed.second), ed.first->neighbor(ed.second)->index(ed.first));
-    return e;
-  }
-};
- 
-template <class Circ, class E>
-class In_edge_circulator : public Circ
-{
-private:
-  mutable E e;
-
-public:
-
-  typedef E value_type;
-  typedef E* pointer;
-  typedef E& reference;
-
-  In_edge_circulator()
-    : Circ()
-  {}
-
-  In_edge_circulator(Circ c)
-    : Circ(c)
-  {}
-
-  const E& operator*() const
-{
-    typename Circ::value_type ed = static_cast<const Circ*>(this)->operator*();
-    e = E(ed);
-    return e;
-  }
-};
-  
-
-  //  The vertex iterator of the bgl must evaluate to a vertex handle, not to a vertex
-template < class T>
-class boost_all_vertices_iterator {
-protected:
- typename T::All_vertices_iterator nt;
-public:
-  typedef typename T::All_vertices_iterator  Iterator;
-  typedef boost_all_vertices_iterator<T> Self;
-
-  typedef typename std::iterator_traits<Iterator>::iterator_category iterator_category;
-  typedef typename T::Vertex_handle  value_type;
-  typedef typename std::iterator_traits<Iterator>::difference_type           difference_type;
-  typedef value_type      reference;
-  typedef value_type      pointer;
-
-  // CREATION
-  // --------
-
-  boost_all_vertices_iterator()
-  {}
-
-  boost_all_vertices_iterator( Iterator j) : nt(j) {}
-
-  // OPERATIONS Forward Category
-  // ---------------------------
-
-
-  bool operator==( const Self& i) const { return ( nt == i.nt); }
-  bool operator!=( const Self& i) const { return !(nt == i.nt );   }
-  value_type  operator*() const  { return nt; }
-  value_type    operator->()  { return nt; }
-
-  Self& operator++() {
-    ++nt;
-    return *this;
-  }
-
-  Self  operator++(int) {
-    Self tmp = *this;
-    ++*this;
-    return tmp;
-  }
-
-  Self& operator--() {
-    --nt;
-    return *this;
-  }
-
-  Self  operator--(int) {
-    Self tmp = *this;
-    --*this;
-    return tmp;
-  }
-};
-
-template < class T>
-class boost_all_faces_iterator {
-protected:
- typename T::All_faces_iterator nt;
-public:
-  typedef typename T::All_faces_iterator  Iterator;
-  typedef boost_all_faces_iterator<T> Self;
-
-  typedef typename std::iterator_traits<Iterator>::iterator_category iterator_category;
-  typedef typename T::Face_handle  value_type;
-  typedef typename std::iterator_traits<Iterator>::difference_type           difference_type;
-  typedef value_type      reference;
-  typedef value_type      pointer;
-
-  // CREATION
-  // --------
-
-  boost_all_faces_iterator()
-  {}
-
-  boost_all_faces_iterator( Iterator j) : nt(j) {}
-
-  // OPERATIONS Forward Category
-  // ---------------------------
-
-
-  bool operator==( const Self& i) const { return ( nt == i.nt); }
-  bool operator!=( const Self& i) const { return !(nt == i.nt );   }
-  value_type  operator*() const  { return nt; }
-  value_type    operator->()  { return nt; }
-
-  Self& operator++() {
-    ++nt;
-    return *this;
-  }
-
-  Self  operator++(int) {
-    Self tmp = *this;
-    ++*this;
-    return tmp;
-  }
-
-  Self& operator--() {
-    --nt;
-    return *this;
-  }
-
-  Self  operator--(int) {
-    Self tmp = *this;
-    --*this;
-    return tmp;
-  }
-};
-
-    
-    template <typename Tr>
-    struct T2_halfedge_descriptor
-    {
-      typedef typename Tr::Face_handle face_descriptor;
-      face_descriptor first;
-      int second;
-      operator std::pair<face_descriptor, int>() { return std::make_pair(first,second); }
-      
-      T2_halfedge_descriptor()
-      {}
-      
-      T2_halfedge_descriptor(const typename Tr::Edge& e)
-        : first(e.first), second(e.second)
-      {}
-      
-      T2_halfedge_descriptor(face_descriptor fd, int i)
-        : first(fd), second(i)
-      {}
-      
-      friend std::size_t hash_value(const T2_halfedge_descriptor& h)
-      {
-        return hash_value(h.first);
-      } 
-      
-      bool operator==(const T2_halfedge_descriptor& other) const
-      {
-        return (first == other.first) && (second == other.second);
-      }
-      
-      bool operator!=(const T2_halfedge_descriptor& other) const
-      {
-        return (first != other.first) || (second != other.second);
-      }
-
-      bool operator<(const T2_halfedge_descriptor& other) const
-      {
-        if(first < other.first) return true;
-        if(first > other.first) return false;
-        return second  < other.second;
-      }
-    };
-
-
-  } // namespace detail
-} // namespace CGAL
-
-namespace boost { 
-
-  template <class GT, class TDS>
-  struct graph_traits< CGAL::Triangulation_2<GT,TDS> > {
-
-    struct T2_graph_traversal_category : 
-      public virtual bidirectional_graph_tag,
-      public virtual adjacency_graph_tag,
-      public virtual edge_list_graph_tag,
-      public virtual vertex_list_graph_tag { };
-
-    typedef CGAL::Triangulation_2<GT,TDS> Triangulation;
-
-    typedef typename CGAL::Triangulation_2<GT,TDS>::Vertex_handle vertex_descriptor;
-    typedef typename CGAL::Triangulation_2<GT,TDS>::Face_handle face_descriptor;
-    typedef CGAL::detail::Edge<CGAL::Triangulation_2<GT,TDS>, typename CGAL::Triangulation_2<GT,TDS>::Edge>  edge_descriptor;
-    typedef typename CGAL::Triangulation_2<GT,TDS>::All_edges_iterator  edge_iterator;
-
-
-    typedef CGAL::detail::T2_halfedge_descriptor<Triangulation> halfedge_descriptor;
-
-    typedef typename CGAL::Triangulation_2<GT,TDS>::All_halfedges_iterator  halfedge_iterator;
-
-    typedef CGAL::detail::boost_all_vertices_iterator<Triangulation> vertex_iterator;
-    typedef CGAL::detail::boost_all_faces_iterator<Triangulation> face_iterator;
-    typedef CGAL::Counting_iterator<CGAL::detail::Out_edge_circulator<typename Triangulation::Edge_circulator, edge_descriptor>, edge_descriptor > out_edge_iterator;
-    typedef CGAL::Counting_iterator<CGAL::detail::In_edge_circulator<typename Triangulation::Edge_circulator, edge_descriptor>, edge_descriptor > in_edge_iterator;
-    typedef CGAL::Counting_iterator<typename Triangulation::Vertex_circulator> Incident_vertices_iterator;
-    typedef Incident_vertices_iterator adjacency_iterator;
-
-    typedef undirected_tag directed_category;
-    typedef disallow_parallel_edge_tag edge_parallel_category; 
-    typedef T2_graph_traversal_category traversal_category;
-    typedef typename Triangulation::size_type size_type;
-    typedef size_type vertices_size_type;
-    typedef size_type edges_size_type;
-    typedef size_type halfedges_size_type;
-    typedef size_type faces_size_type;
-    typedef size_type degree_size_type;
-
-  // nulls
-  static vertex_descriptor   null_vertex() { return vertex_descriptor(); }
-  static face_descriptor     null_face()   { return face_descriptor(); }
-  static halfedge_descriptor     null_halfedge()   { return halfedge_descriptor(); }
-  };
-
-
-} // namespace boost
-
-
-namespace CGAL {
-
-  template <class Gt, class Tds>
-  typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor
-  next(typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor e,
-       const Triangulation_2<Gt,Tds>& g)
-  {
-    typedef typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor halfedge_descriptor;
-    return halfedge_descriptor(e.first, g.ccw(e.second));
-  }
-
-
-  template <class Gt, class Tds>
-  typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor
-  prev(typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor e,
-       const Triangulation_2<Gt,Tds>& g)
-  {
-    typedef typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor halfedge_descriptor;
-    return halfedge_descriptor(e.first, g.cw(e.second));
-  }
-
-  
-
-  template <class Gt, class Tds>
-  typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor
-  opposite(typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor e,
-       const Triangulation_2<Gt,Tds>& g)
-  {
-    
-    return g.mirror_edge(e);
-  }
-  
-  template <class Gt, class Tds>
-  typename boost::graph_traits< Triangulation_2<Gt,Tds> >::vertex_descriptor
-  source(typename boost::graph_traits< Triangulation_2<Gt,Tds> >::edge_descriptor e,
-         const Triangulation_2<Gt,Tds>& g)
-  {
-    return e.first->vertex(g.ccw(e.second));
-  }
-
-  template <class Gt, class Tds>
-  typename boost::graph_traits< Triangulation_2<Gt,Tds> >::vertex_descriptor
-  target(typename boost::graph_traits< Triangulation_2<Gt,Tds> >::edge_descriptor e,
-         const Triangulation_2<Gt,Tds>& g)
-  {
-    return e.first->vertex(g.cw(e.second));
-  }
-
-  template <class Gt, class Tds>
-  typename boost::graph_traits< Triangulation_2<Gt,Tds> >::vertex_descriptor
-  source(typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor e,
-         const Triangulation_2<Gt,Tds>& g)
-  {
-    return e.first->vertex(g.ccw(e.second));
-  }
-
-  template <class Gt, class Tds>
-  typename boost::graph_traits< Triangulation_2<Gt,Tds> >::vertex_descriptor
-  target(typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor e,
-         const Triangulation_2<Gt,Tds>& g)
-  {
-    return e.first->vertex(g.cw(e.second));
-  }
-
-  template <class Gt, class Tds>
-  typename boost::graph_traits< Triangulation_2<Gt,Tds> >::face_descriptor
-  face(typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor e,
-         const Triangulation_2<Gt,Tds>&)
-  {
-    return e.first;
-  }
-
-  template <class Gt, class Tds>
-  typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor
-  halfedge(typename boost::graph_traits< Triangulation_2<Gt,Tds> >::face_descriptor f,
-           const Triangulation_2<Gt,Tds>&)
-  {
-    typedef typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor halfedge_descriptor;
-    return halfedge_descriptor(f,0);
-  }
-
-  template <class Gt, class Tds>
-  typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor
-  halfedge(typename boost::graph_traits< Triangulation_2<Gt,Tds> >::vertex_descriptor v,
-           const Triangulation_2<Gt,Tds>& g)
-  {
-    typedef typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor halfedge_descriptor;
-    typedef typename boost::graph_traits< Triangulation_2<Gt,Tds> >::face_descriptor face_descriptor;
-    face_descriptor fd = v->face();
-    int i = fd->index(v);
-    return halfedge_descriptor(fd,g.ccw(i));
-  }
-
-  template <class Gt, class Tds>
-  typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor
-  halfedge(typename boost::graph_traits< Triangulation_2<Gt,Tds> >::edge_descriptor e,
-           const Triangulation_2<Gt,Tds>&)
-  {
-    typedef typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor halfedge_descriptor;
-    return halfedge_descriptor(e.first,e.second);
-  }
-
-  template <class Gt, class Tds>
-  typename boost::graph_traits< Triangulation_2<Gt,Tds> >::edge_descriptor
-  edge(typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor e,
-           const Triangulation_2<Gt,Tds>&)
-  {
-    typedef typename boost::graph_traits< Triangulation_2<Gt,Tds> >::edge_descriptor edge_descriptor;
-    return edge_descriptor(e.first,e.second);
-  }
-
-
-  template <class Gt, class Tds>
-  inline Iterator_range<typename boost::graph_traits< Triangulation_2<Gt,Tds> >::vertex_iterator>  
-  vertices(const Triangulation_2<Gt,Tds>& g)
-  {
-    typedef typename boost::graph_traits< Triangulation_2<Gt,Tds> >::vertex_iterator
-      Iter;
-    return make_range( Iter(g.all_vertices_begin()), Iter(g.all_vertices_end()) );
-  }
-
-
-  template <class Gt, class Tds>
-  inline Iterator_range<typename boost::graph_traits< Triangulation_2<Gt,Tds> >::edge_iterator>  
-  edges(const Triangulation_2<Gt,Tds>& g)
-  {    
-    return make_range(g.all_edges_begin(), g.all_edges_end());
-  }
-
-  template <class Gt, class Tds>
-  inline Iterator_range<typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_iterator >  
-  halfedges(const Triangulation_2<Gt,Tds>& g)
-  {    
-    return make_range(g.all_halfedges_begin(), g.all_halfedges_end());
-  }
-
-  template <class Gt, class Tds>
-  inline Iterator_range<typename boost::graph_traits< Triangulation_2<Gt,Tds> >::face_iterator >  
-  faces(const Triangulation_2<Gt,Tds>& g)
-  {
-    typedef typename boost::graph_traits< Triangulation_2<Gt,Tds> >::face_iterator
-      Iter;
-    return make_range( Iter(g.all_faces_begin()), Iter(g.all_faces_end()) );
-  }
-
-  template <class Gt, class Tds>
-  typename boost::graph_traits< Triangulation_2<Gt,Tds> >::degree_size_type
-  out_degree(
-    typename boost::graph_traits< Triangulation_2<Gt,Tds> >::vertex_descriptor u, 
-    const Triangulation_2<Gt,Tds>& g)
-  {
-    typename boost::graph_traits< Triangulation_2<Gt,Tds> >::degree_size_type deg = 0;
-    typename Triangulation_2<Gt,Tds>::Edge_circulator c = g.incident_edges(u), done(c);
-    if ( c != 0) {
-        do {
-            ++deg;
-        } while (++c != done);
-    }
-    return deg;
-  }
-
-  template <class Gt, class Tds>
-  inline Iterator_range<typename boost::graph_traits< Triangulation_2<Gt,Tds> >::out_edge_iterator >  
-  out_edges(
-    typename boost::graph_traits< Triangulation_2<Gt,Tds> >::vertex_descriptor u, 
-    const Triangulation_2<Gt,Tds>& g)
-  {
-    typename Triangulation_2<Gt,Tds>::Edge_circulator ec(u,u->face());
-    typename boost::graph_traits< Triangulation_2<Gt,Tds> >::degree_size_type out_deg = out_degree(u,g);
-    typedef typename boost::graph_traits< Triangulation_2<Gt,Tds> >
-      ::out_edge_iterator Iter;
-    
-    return make_range( Iter(ec), Iter(ec,out_deg) );
-  }
-
-  template <class Gt, class Tds>
-  inline Iterator_range<typename boost::graph_traits< Triangulation_2<Gt,Tds> >::in_edge_iterator >  
-  in_edges(
-    typename boost::graph_traits< Triangulation_2<Gt,Tds> >::vertex_descriptor u, 
-    const Triangulation_2<Gt,Tds>& g)
-  {
-    typename Triangulation_2<Gt,Tds>::Edge_circulator ec(u,u->face());
-    typename boost::graph_traits< Triangulation_2<Gt,Tds> >::degree_size_type out_deg = out_degree(u,g);
-    typedef typename boost::graph_traits< Triangulation_2<Gt,Tds> >
-      ::in_edge_iterator Iter;
-    return make_range( Iter(ec), Iter(ec,out_deg) );
-  }
-
-  template <class Gt, class Tds>
-  inline Iterator_range<typename boost::graph_traits< Triangulation_2<Gt,Tds> >::adjacency_iterator>  
-  adjacent_vertices(
-    typename boost::graph_traits< Triangulation_2<Gt,Tds> >::vertex_descriptor u, 
-    const Triangulation_2<Gt,Tds>& g)
-  {
-    typename Triangulation_2<Gt,Tds>::Vertex_circulator vc = out_edge_iterator(u,u.face());
-    typename boost::graph_traits< Triangulation_2<Gt,Tds> >::degree_size_type out_deg = out_degree(u,g);
-    typedef typename boost::graph_traits< Triangulation_2<Gt,Tds> >
-      ::adjacency_iterator Iter;
-    return make_range( Iter(vc), Iter(vc,out_deg) );
-  }
-
-  template <class Gt, class Tds>
-  typename boost::graph_traits< Triangulation_2<Gt,Tds> >::vertices_size_type
-  num_vertices(const Triangulation_2<Gt,Tds>& g)
-  {
-    return g.tds().number_of_vertices();
-  }  
-
-  template <class Gt, class Tds>
-  typename boost::graph_traits< Triangulation_2<Gt,Tds> >::edges_size_type
-  num_edges(const Triangulation_2<Gt,Tds>& g)
-  {
-
-    return  g.tds().number_of_vertices() + g.tds().number_of_faces() - 2;
-  }  
-
-  template <class Gt, class Tds>
-  typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedges_size_type
-  num_halfedges(const Triangulation_2<Gt,Tds>& g)
-  {
-    return  num_edges(g) * 2;
-  }  
-
-  template <class Gt, class Tds>
-  typename boost::graph_traits< Triangulation_2<Gt,Tds> >::faces_size_type
-  num_faces(const Triangulation_2<Gt,Tds>& g)
-  {
-    return  g.tds().number_of_faces();
-  } 
-
-  template <class Gt, class Tds>
-  typename boost::graph_traits< Triangulation_2<Gt,Tds> >::degree_size_type
-  in_degree(
-    typename boost::graph_traits< Triangulation_2<Gt,Tds> >::vertex_descriptor u, 
-    const Triangulation_2<Gt,Tds>& g)
-  {
-    typename boost::graph_traits< Triangulation_2<Gt,Tds> >::degree_size_type deg = 0;
-    typename Triangulation_2<Gt,Tds>::Edge_circulator c = g.incident_edges(u), done(c);
-    if ( c != 0) {
-        do {
-            ++deg;
-        } while (++c != done);
-    }
-    return deg;
-  }
-
-  template <class Gt, class Tds>
-  typename boost::graph_traits< Triangulation_2<Gt,Tds> >::degree_size_type
-  degree(
-    typename boost::graph_traits< Triangulation_2<Gt,Tds> >::vertex_descriptor u, 
-    const Triangulation_2<Gt,Tds>& g)
-  {
-    typename boost::graph_traits< Triangulation_2<Gt,Tds> >::degree_size_type deg = 0;
-    typename Triangulation_2<Gt,Tds>::Edge_circulator c = g.incident_edges(u), done(c);
-    if ( c != 0) {
-        do {
-            ++deg;
-        } while (++c != done);
-    }
-    return deg;
-  }
-
-
-  // property maps
-  template <class Gt, class Tds>
-  class T2_vertex_id_map
-    : public boost::put_get_helper<int, T2_vertex_id_map<Gt,Tds> >
-  {
-  public:
-    typedef boost::readable_property_map_tag category;
-    typedef int value_type;
-    typedef int reference;
-    typedef typename CGAL::Triangulation_2<Gt,Tds>::Vertex_handle key_type;
-    
-    T2_vertex_id_map()
-    {}
-    
-    long operator[](key_type vh) const {
-      return vh->id(); 
-    }
-  };
-
-  template <class Gt, class Tds>
-  class T2_vertex_point_map
-  {
-  public:
-    typedef boost::lvalue_property_map_tag category;
-    typedef typename Tds::Vertex::Point value_type;
-    typedef value_type& reference;
-    typedef typename CGAL::Triangulation_2<Gt,Tds>::Vertex_handle key_type;
-
-    friend reference get(T2_vertex_point_map<Gt,Tds>, key_type vh)
-    { 
-      return vh->point(); 
-    }
-    friend void put(T2_vertex_point_map<Gt,Tds>, key_type vh, reference v)
-    {
-      vh->point()=v; 
-    }
-    reference operator[](key_type vh) const {
-      return vh->point();
-    }
-  };
-
-
-  template <class Gt, class Tds>
-  class T2_edge_id_map
-    : public boost::put_get_helper<int, T2_edge_id_map<Gt,Tds> >
-  {
-  public:
-    typedef boost::readable_property_map_tag category;
-    typedef int value_type;
-    typedef int reference;
-    typedef typename CGAL::Triangulation_2<Gt,Tds>::Edge key_type;
-    
-    T2_edge_id_map()
-    {}
-    
-    long operator[](key_type e) const {
-      return (3 * e.first.id()) + e.second; 
-    }
-  };
-
-  template <class Gt, class Tds>
-  class T2_edge_weight_map
-    : public boost::put_get_helper<typename Gt::FT, T2_edge_weight_map<Gt, Tds> >
-  {
-  private:
-    const CGAL::Triangulation_2<Gt,Tds>& tr;
-  public:
-    typedef boost::readable_property_map_tag category;
-    typedef typename Gt::FT value_type;
-    typedef value_type reference;
-    typedef typename CGAL::Triangulation_2<Gt,Tds>::Edge key_type;
-
-    T2_edge_weight_map(const CGAL::Triangulation_2<Gt,Tds>& tr_) 
-      : tr(tr_) 
-    { }
-
-    value_type operator[](key_type e) const {
-      return tr.segment(e).squared_length();
-    }
-  };
-
-
-  template <class Gt, class Tds>
-  inline T2_vertex_id_map<Gt,Tds>
-  get(boost::vertex_index_t, const Triangulation_2<Gt,Tds>&) {
-    T2_vertex_id_map<Gt,Tds> m;
-    return m;
-  }
-
-  template <class Gt, class Tds>
-  inline T2_vertex_point_map<Gt,Tds>
-  get(boost::vertex_point_t, const Triangulation_2<Gt,Tds>&) {
-    T2_vertex_point_map<Gt,Tds> m;
-    return m;
-  }
-
-  template <class Gt, class Tds>
-  inline T2_edge_id_map<Gt,Tds>
-  get(boost::edge_index_t, const Triangulation_2<Gt,Tds>&) {
-    T2_edge_id_map<Gt,Tds> m;
-    return m;
-  }
-
-  template <class Gt, class Tds>
-  inline T2_edge_weight_map<Gt,Tds>
-  get(boost::edge_weight_t, const Triangulation_2<Gt,Tds>& g) {
-    T2_edge_weight_map<Gt,Tds> m(g);
-    return m;
-  }
-
-  template <class Tag>
-  struct T2_property_map { };
-
-  template <>
-  struct T2_property_map<boost::vertex_index_t> {
-    template <class Gt, class Tds>
-    struct bind_ {
-      typedef T2_vertex_id_map<Gt,Tds> type;
-      typedef T2_vertex_id_map<Gt,Tds> const_type;
-    };
-  };
-
-
-
-  template <>
-  struct T2_property_map<boost::vertex_point_t> {
-    template <class Gt, class Tds>
-    struct bind_ {
-      typedef T2_vertex_point_map<Gt,Tds> type;
-      typedef T2_vertex_point_map<Gt,Tds> const_type;
-    };
-  };
-
-
-  template <>
-  struct T2_property_map<boost::edge_index_t> {
-    template <class Gt, class Tds>
-    struct bind_ {
-      typedef T2_edge_id_map<Gt,Tds> type;
-      typedef T2_edge_id_map<Gt,Tds> const_type;
-    };
-  };
-
-
-  template <>
-  struct T2_property_map<boost::edge_weight_t> {
-    template <class Gt, class Tds>
-    struct bind_ {
-      typedef T2_edge_weight_map<Gt,Tds> type;
-      typedef T2_edge_weight_map<Gt,Tds> const_type;
-    };
-  };
-
-} // namespace CGAL
-
-namespace boost {
-  // g++ 'enumeral_type' in template unification not implemented workaround
-  template <class Gt, class Tds, class Tag>
-  struct property_map<CGAL::Triangulation_2<Gt,Tds>, Tag> {
-    typedef typename 
-    CGAL::T2_property_map<Tag>::template bind_<Gt,Tds> map_gen;
-    typedef typename map_gen::type type;
-    typedef typename map_gen::const_type const_type;
-  };
-
-  // see struct property_map in Polyehdron for an explanation
-  template <class Gt, class Tds, class Tag>
-  struct property_map<const CGAL::Triangulation_2<Gt,Tds>, Tag> {
-    typedef typename 
-    CGAL::T2_property_map<Tag>::template bind_<Gt,Tds> map_gen;
-    typedef typename map_gen::type type;
-    typedef typename map_gen::const_type const_type;
-  };
-
-} // namespace boost
-
-
-namespace CGAL {
-
-  template <class Gt, class Tds, class PropertyTag, class Key>
-  inline
-  typename boost::property_traits<
-    typename boost::property_map<Triangulation_2<Gt,Tds>,PropertyTag>::const_type>::value_type
-  get(PropertyTag p, const Triangulation_2<Gt,Tds>& g, const Key& key) {
-    return get(get(p, g), key);
-  }
-  
-  template <class Gt, class Tds, class PropertyTag, class Key,class Value>
-  inline void
-  put(PropertyTag p, Triangulation_2<Gt,Tds>& g, 
-      const Key& key, const Value& value)
-  {
-    typedef typename boost::property_map<Triangulation_2<Gt,Tds>, PropertyTag>::type Map;
-    Map pmap = get(p, g);
-    put(pmap, key, value);
-  }
-
-} // namespace CGAL 
-
-namespace boost {
-
-  // What are those needed for ???
-  template <typename Gt, typename Tds>
-  struct edge_property_type<CGAL::Triangulation_2<Gt,Tds> > {
-    typedef void type;
-  };  
-
-  template <typename Gt, typename Tds>
-  struct vertex_property_type<CGAL::Triangulation_2<Gt,Tds> > {
-    typedef void type;
-  };
-} // namespace boost
-
-
-namespace std {
-
-
-#if defined(BOOST_MSVC)
-#  pragma warning(push)
-#  pragma warning(disable:4099) // For VC10 it is class hash 
-#endif
-
-#ifndef CGAL_CFG_NO_STD_HASH
-
-  template < class T, class EdgeBase>
-  struct hash<CGAL::detail::Edge<T,EdgeBase> > {
-    std::size_t operator()(const CGAL::detail::Edge<T,EdgeBase>& e) const
-    {
-      std::cerr << "Triangulation_2::Edge HashFct" << std::endl;
-      return hash_value(e);
-    }
-  }; 
-
-  template < class Tr>
-  struct hash<CGAL::detail::T2_halfedge_descriptor<Tr> > {
-    std::size_t operator()(const CGAL::detail::T2_halfedge_descriptor<Tr>& e) const
-    {
-      std::cerr << "Triangulation_2::halfedge_descriptor HashFct" << std::endl;
-      return hash_value(e);
-    }
-  };
-
-#endif // CGAL_CFG_NO_STD_HASH
-
-#if defined(BOOST_MSVC)
-#  pragma warning(pop)
-#endif
-
-} // namespace std
-
-//#include <CGAL/graph_traits_Delaunay_triangulation_2.h>
-
-#endif // CGAL_GRAPH_TRAITS_TRIANGULATION_2_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/properties_CombinatorialMap.h b/3rdparty/CGAL-4.8/include/CGAL/boost/graph/properties_CombinatorialMap.h
deleted file mode 100644
index ba6259e..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/properties_CombinatorialMap.h
+++ /dev/null
@@ -1,276 +0,0 @@
-// Copyright (c) 2013 CNRS and LIRIS' Establishments (France).
-//
-// 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:
-// 
-//
-// Author(s)     : Pierre Talbot
-
-#ifndef CGAL_BOOST_GRAPH_PROPERTIES_COMBINATORIAL_MAP_H
-#define CGAL_BOOST_GRAPH_PROPERTIES_COMBINATORIAL_MAP_H
-
-#include <CGAL/boost/graph/properties.h>
-#include <CGAL/Unique_hash_map.h>
-#include <CGAL/Linear_cell_complex.h>
-
-#define CGAL_LCC_ARGS unsigned int d_, unsigned int ambient_dim, \
-             class Traits_, \
-             class Items_, \
-             class Alloc_, \
-             template<unsigned int, class, class, class> \
-             class CMap
-
-#define CGAL_LCC_TYPE CGAL::Linear_cell_complex<d_, ambient_dim, Traits_, Items_, Alloc_, CMap > 
-
-namespace CGAL {
-
-template<class LCC>
-class LCC_edge_weight_map : public boost::put_get_helper<double, LCC>
-{ 
-public:
-
-  typedef boost::readable_property_map_tag                                category;
-  typedef double                                                          value_type;
-  typedef double                                                          reference;
-  typedef typename boost::graph_traits<LCC const>::edge_descriptor key_type;
-
-  LCC_edge_weight_map(LCC const& ) {}
-
-  reference operator[](key_type const& e) const
-  {
-    return CGAL::squared_distance(LCC::point(e), LCC::point(e->opposite()));
-  }
-};
-
-template <class CMap>
-class CMap_dart_index_map_external 
-  : public boost::put_get_helper<std::size_t, CMap_dart_index_map_external<CMap> >
-{
-  
-public:
-
-  typedef boost::readable_property_map_tag                                category;
-  typedef std::size_t                                                     value_type;
-  typedef std::size_t                                                     reference;
-  typedef typename boost::graph_traits<CMap const>::edge_descriptor       key_type;
-
-  CMap_dart_index_map_external() : map()
-  {}
-
-  CMap_dart_index_map_external(CMap const& cm) 
-    : map()
-  {
-    CMap &cmap = const_cast<CMap&>(cm);
-    typedef typename CMap::template One_dart_per_cell_range<1>::iterator Iter;
-    Iter b=cmap.template one_dart_per_cell<1>().begin();
-    Iter e=cmap.template one_dart_per_cell<1>().end();
-    for(value_type i=0; b != e; ++b, ++i)
-    {
-      map[b] = i;
-      ++i;
-      map[b->opposite()] = i;
-    }
-    typedef typename CMap::Dart_range::iterator DIter;
-    DIter bi = cmap.darts().begin();
-    DIter ei = cmap.darts().end();
-    for(; bi != ei; ++bi)
-    {
-      value_type v1 = map[bi];
-      value_type v2 = map[opposite_edge(bi, cm)];
-      CGAL_assertion(v1 - v2 == 1 || v1 - v2 == -1);
-    }
-  }
-
-  reference operator[](key_type const& e) const { return map[e]; }
-  
-private:
-  
-  CGAL::Unique_hash_map<key_type,std::size_t> map ;
-};
-
-template<class LCC>
-class LCC_vertex_point_map : public boost::put_get_helper< typename LCC::Point&, LCC_vertex_point_map<LCC> >
-{
-public:
-
-  typedef typename LCC::Point Point;
-  
-  typedef boost::lvalue_property_map_tag category;
-  typedef Point value_type;
-  typedef Point& reference;
-  typedef typename boost::graph_traits<LCC>::vertex_descriptor key_type;
-
-  LCC_vertex_point_map(LCC& ) {}
-
-  reference operator[](key_type const& v) const { return LCC::point(v); }
-};
-
-template<class LCC>
-class LCC_vertex_point_const_map : public boost::put_get_helper< typename LCC::Point const&, LCC_vertex_point_const_map<LCC> >
-{
-public:
-
-  typedef typename LCC::Point Point;
-  
-  typedef boost::readable_property_map_tag category;
-  typedef Point value_type;
-  typedef Point const& reference;
-  typedef typename boost::graph_traits<LCC const>::vertex_descriptor key_type;
-
-  LCC_vertex_point_const_map(LCC const&) {}
-
-  reference operator[](key_type const& v) const { return LCC::point(v); }
-};
-
-
-template <class CMap, typename Tag>
-struct CMap_property_map
-{};
-
-template <class CMap>
-struct CMap_property_map<CMap, vertex_external_index_t> 
-{
-  typedef CMap_dart_index_map_external<CMap> type;
-  typedef CMap_dart_index_map_external<CMap> const_type;
-};
-
-template <class CMap>
-struct CMap_property_map<CMap, edge_external_index_t> 
-{
-  typedef CMap_dart_index_map_external<CMap> type;
-  typedef CMap_dart_index_map_external<CMap> const_type;
-};
-
-template <class CMap>
-struct CMap_property_map<CMap, boost::edge_index_t>
-{
-  typedef CMap_dart_index_map_external<CMap> type;
-  typedef CMap_dart_index_map_external<CMap> const_type;
-};
-
-template <class CMap>
-struct CMap_property_map<CMap, boost::vertex_index_t>
-{
-  typedef CMap_dart_index_map_external<CMap> type;
-  typedef CMap_dart_index_map_external<CMap> const_type;
-};
-
-// For LCC
-template <class LCC>
-struct CMap_property_map<LCC, boost::edge_weight_t>
-{
-  typedef LCC_edge_weight_map<LCC> type;
-  typedef LCC_edge_weight_map<LCC> const_type;
-};
-
-template <class LCC>
-struct CMap_property_map<LCC, vertex_point_t>
-{
-  typedef LCC_vertex_point_map<LCC> type;
-  typedef LCC_vertex_point_const_map<LCC> const_type;
-};
-
-template <class Type, class Tag>
-struct CMap_property_map_helper
-{
-  typedef typename CGAL::CMap_property_map<Type, Tag> map_gen;
-  typedef typename map_gen::type       type;
-  typedef typename map_gen::const_type const_type;
-};
-
-} // namespace CGAL
-
-namespace boost{
-
-// LCC.
-template<CGAL_LCC_ARGS, class Tag>
-struct property_map<CGAL_LCC_TYPE, Tag> : CGAL::CMap_property_map_helper<CGAL_LCC_TYPE, Tag>
-{};
-
-// This partial specialization shouldn't be needed but is due to a bug in Boost 1.51.
-template<CGAL_LCC_ARGS, class Tag>
-struct property_map<const CGAL_LCC_TYPE, Tag> : CGAL::CMap_property_map_helper<CGAL_LCC_TYPE, Tag>
-{};
-
-template<CGAL_LCC_ARGS>
-CGAL::CMap_dart_index_map_external<CGAL_LCC_TYPE> get(CGAL::edge_external_index_t, CGAL_LCC_TYPE const& cmap) 
-{
-  return CGAL::CMap_dart_index_map_external<CGAL_LCC_TYPE>(cmap);
-}
-
-template<CGAL_LCC_ARGS>
-CGAL::CMap_dart_index_map_external<CGAL_LCC_TYPE> get(CGAL::vertex_external_index_t, CGAL_LCC_TYPE const& cmap) 
-{
-  return CGAL::CMap_dart_index_map_external<CGAL_LCC_TYPE>(cmap);
-}
-
-// LCC get.
-template <CGAL_LCC_ARGS>
-CGAL::LCC_edge_weight_map<CGAL_LCC_TYPE> get(edge_weight_t, CGAL_LCC_TYPE const& lcc) 
-{
-  return CGAL::LCC_edge_weight_map<CGAL_LCC_TYPE>(lcc);
-}
-
-template <CGAL_LCC_ARGS>
-CGAL::CMap_dart_index_map_external<CGAL_LCC_TYPE> get(edge_index_t, CGAL_LCC_TYPE const& lcc) 
-{
-  return CGAL::CMap_dart_index_map_external<CGAL_LCC_TYPE>(lcc);
-}
-
-template <CGAL_LCC_ARGS>
-CGAL::CMap_dart_index_map_external<CGAL_LCC_TYPE> get(vertex_index_t, CGAL_LCC_TYPE const& lcc) 
-{
-  return CGAL::CMap_dart_index_map_external<CGAL_LCC_TYPE>(lcc);
-}
-
-template <CGAL_LCC_ARGS>
-CGAL::LCC_vertex_point_map<CGAL_LCC_TYPE> get(CGAL::vertex_point_t, CGAL_LCC_TYPE& lcc) 
-{
-  return CGAL::LCC_vertex_point_map<CGAL_LCC_TYPE>(lcc);
-}
-
-template <CGAL_LCC_ARGS>
-CGAL::LCC_vertex_point_const_map<CGAL_LCC_TYPE> get(CGAL::vertex_point_t, CGAL_LCC_TYPE const& lcc) 
-{
-  return CGAL::LCC_vertex_point_const_map<CGAL_LCC_TYPE>(lcc);
-}
-
-template<CGAL_LCC_ARGS, class PropertyTag, class Key>
-typename property_traits<typename property_map<CGAL_LCC_TYPE, PropertyTag>::type>::reference
-get(PropertyTag p, CGAL_LCC_TYPE& g, const Key& key) 
-{
-  return get(get(p, g), key);
-}
-
-template<CGAL_LCC_ARGS, class PropertyTag, class Key>
-typename property_traits<typename property_map<CGAL_LCC_TYPE, PropertyTag>::const_type>::reference
-get(PropertyTag p, CGAL_LCC_TYPE const& g, const Key& key) 
-{
-  return get(get(p, g), key);
-}
-
-template<CGAL_LCC_ARGS, class PropertyTag, class Key,class Value>
-void put(PropertyTag p, CGAL_LCC_TYPE& g, const Key& key, const Value& value)
-{
-  typedef typename property_map<CGAL_LCC_TYPE, PropertyTag>::type Map;
-  Map pmap = get(p, g);
-  put(pmap, key, value);
-}
-
-} // namespace boost
-
-#undef CGAL_LCC_ARGS
-#undef CGAL_LCC_TYPE
-
-
-#endif // CGAL_BOOST_GRAPH_PROPERTIES_COMBINATORIAL_MAP_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/properties_Polyhedron_3.h b/3rdparty/CGAL-4.8/include/CGAL/boost/graph/properties_Polyhedron_3.h
deleted file mode 100644
index 9514b2b..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/properties_Polyhedron_3.h
+++ /dev/null
@@ -1,445 +0,0 @@
-// Copyright (c) 2007  GeometryFactory (France).  All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Andreas Fabri, Fernando Cacciola
-
-#ifndef CGAL_BOOST_GRAPH_PROPERTIES_POLYHEDRON_3_H
-#define CGAL_BOOST_GRAPH_PROPERTIES_POLYHEDRON_3_H
-
-#include <CGAL/boost/graph/properties.h>
-#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
-#include <CGAL/Unique_hash_map.h>
-#include <CGAL/squared_distance_2_1.h>
-#include <boost/shared_ptr.hpp>
-
-#define CGAL_HDS_PARAM_ template < class Traits, class Items, class Alloc> class HDS
-
-namespace CGAL {
-
-namespace internal {
-
-template<class Handle>
-class Polyhedron_index_map_external
-  : public boost::put_get_helper<std::size_t, Polyhedron_index_map_external<Handle> >
-{
-public:
-  typedef boost::readable_property_map_tag category;
-  typedef std::size_t                      value_type;
-  typedef std::size_t                      reference;
-  typedef Handle                           key_type;
-
-private:
-  typedef CGAL::Unique_hash_map<key_type,std::size_t> Map;
-
-public:
-  template <typename InputIterator>
-  Polyhedron_index_map_external(InputIterator begin, InputIterator end, std::size_t max)
-    : map_(new Map(begin, end, 0, std::size_t(-1), max)) {}
-
-  reference operator[](const key_type& k) const { return (*map_)[k]; }
-private:
-   boost::shared_ptr<Map> map_;
-};
-
-// Special case for edges.
-template<class Polyhedron>
-class Polyhedron_edge_index_map_external
-  : public boost::put_get_helper<std::size_t, Polyhedron_edge_index_map_external<Polyhedron> >
-{
-public:
-  typedef boost::readable_property_map_tag                          category;
-  typedef std::size_t                                               value_type;
-  typedef std::size_t                                               reference;
-  typedef typename boost::graph_traits<Polyhedron>::edge_descriptor key_type;
-
-private:
-  typedef CGAL::Unique_hash_map<key_type,std::size_t> Map;
-
-public:
-  Polyhedron_edge_index_map_external(Polyhedron& p)
-    : map_(new Map(std::size_t(-1), num_halfedges(p)))
-  {
-    unsigned int data = 0;
-    typename boost::graph_traits<Polyhedron>::edge_iterator it, end;
-    for(boost::tie(it, end) = edges(p); it != end; ++it, ++data)
-      (*map_)[*it] = data;
-  }
-
-  reference operator[](const key_type& k) const { return (*map_)[k]; }
-private:
-  boost::shared_ptr<Map> map_;
-};
-
-template<typename Handle>
-struct Wrap_squared
-  : boost::put_get_helper< double, Wrap_squared<Handle> >
-{
-  typedef double value_type;
-  typedef double reference;
-  typedef Handle key_type;
-  typedef boost::readable_property_map_tag category;
-
-  template<typename E>
-  double
-  // TODO Kernel::FT, this is as bad as the old code, we need to
-  // forward the halfedge type in HDS_edge to extract the kernel here.
-  // Technically, there is also a general implementation for
-  // HalfedgeGraph to prevent duplication in Surface_mesh.
-  operator[](const E& e) const {
-    return CGAL::squared_distance(e.halfedge()->vertex()->point(), e.halfedge()->opposite()->vertex()->point());
-  }
-};
-
-  template<typename Polyhedron, typename Handle>
-struct Index_accessor
-    : boost::put_get_helper< std::size_t&, Index_accessor<Polyhedron,Handle> >
-{
-  typedef boost::lvalue_property_map_tag category;
-  typedef std::size_t&                   reference;
-  typedef std::size_t                    value_type;
-  typedef Handle                         key_type;
-
-  reference operator[](Handle h) const { return h->id(); }
-};
-
-template<typename Handle>
-struct Edge_index_accessor
-  : boost::put_get_helper< std::size_t, Edge_index_accessor<Handle> >
-{
-  typedef boost::readable_property_map_tag category;
-  typedef std::size_t                      reference;
-  typedef std::size_t                      value_type;
-  typedef Handle                           key_type;
-
-  reference operator[](Handle h) const { return h.id(); }
-};
-
-template<typename Handle, typename ValueType, typename Reference>
-struct Point_accessor
-  : boost::put_get_helper< Reference, Point_accessor<Handle, ValueType, Reference> >
-{
-  typedef boost::lvalue_property_map_tag category;
-  typedef Reference                      reference;
-  typedef ValueType                      value_type;
-  typedef Handle                         key_type;
-
-  reference operator[](Handle h) const { return h->point(); }
-};
-
-} // internal
-
-// the tag we dispatch on from property_map<G, Property>
-template <class Tag>
-struct Polyhedron_property_map {};
-
-} // namespace CGAL
-
-namespace CGAL {
-
-// generalized 2-ary get functions
-template<class Gt, class I, CGAL_HDS_PARAM_, class A, class PropertyTag>
-typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, PropertyTag >::const_type
-get(PropertyTag, CGAL::Polyhedron_3<Gt,I,HDS,A> const&)
-{ return typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, PropertyTag >::const_type(); }
-
-template<class Gt, class I, CGAL_HDS_PARAM_, class A, class PropertyTag>
-typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, PropertyTag >::type
-get(PropertyTag, CGAL::Polyhedron_3<Gt,I,HDS,A>&)
-{ return typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, PropertyTag >::type(); }
-
-// generalized 3-ary get functions
-template<class Gt, class I, CGAL_HDS_PARAM_, class A, class PropertyTag, class Key>
-typename boost::property_traits< typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, PropertyTag >::type >::reference
-get(PropertyTag p, CGAL::Polyhedron_3<Gt,I,HDS,A>& g, const Key& key)
-{ return get(get(p, g), key); }
-
-template<class Gt, class I, CGAL_HDS_PARAM_, class A, class PropertyTag, class Key>
-typename boost::property_traits< typename boost::property_map<CGAL::Polyhedron_3<Gt,I,HDS,A>, PropertyTag >::const_type >::reference
-get(PropertyTag p, CGAL::Polyhedron_3<Gt,I,HDS,A> const& g, const Key& key)
-{ return get(get(p, g), key); }
-
-// generalized put
-template<class Gt, class I, CGAL_HDS_PARAM_, class A, class PropertyTag, class Key,class Value>
-void put(PropertyTag p, CGAL::Polyhedron_3<Gt,I,HDS,A>& g, const Key& key, const Value& value)
-{
-  typedef typename boost::property_map<CGAL::Polyhedron_3<Gt,I,HDS,A>, PropertyTag>::type Map;
-  Map pmap = get(p, g);
-  put(pmap, key, value);
-}
-
-} // boost
-
-// specialization needs to be repeated for halfedge, vertex, face
-#define CGAL_POLYHEDRON_INDEX_PM(ENTITY, TAG, ACCESSOR)                 \
-  namespace CGAL {                                                      \
-  template<> struct Polyhedron_property_map<boost::ENTITY##TAG> {  \
-  template<class Gt, class I, CGAL_HDS_PARAM_, class A>                 \
-  struct bind_ {                                                        \
-    typedef internal::ACCESSOR##_accessor<                              \
-    CGAL::Polyhedron_3<Gt, I, HDS, A>, \
-    typename boost::graph_traits< CGAL::Polyhedron_3<Gt, I, HDS, A>     \
-                                  >::ENTITY##_descriptor > type;        \
-    typedef type const_type;                                            \
-  };                                                                    \
-  };                                                                    \
-  }
-
-CGAL_POLYHEDRON_INDEX_PM(halfedge, _index_t, Index)
-CGAL_POLYHEDRON_INDEX_PM(vertex, _index_t, Index)
-CGAL_POLYHEDRON_INDEX_PM(face, _index_t, Index)
-
-#undef CGAL_POLYHEDRON_INDEX_PM
-
-namespace CGAL {
-// not done with macros, because HDS_edge::id does not return a
-// reference
-template <>
-struct Polyhedron_property_map<boost::edge_index_t>
-{
-  template<class Gt, class I, CGAL_HDS_PARAM_, class A>
-  struct bind_
-  {
-    typedef internal::Edge_index_accessor<
-      typename boost::graph_traits<
-        CGAL::Polyhedron_3<Gt, I, HDS, A>
-        >::edge_descriptor > type;
-    typedef type const_type;
-  };
-};
-
-template <>
-struct Polyhedron_property_map<boost::edge_weight_t>
-{
-  template<class Gt, class I, CGAL_HDS_PARAM_, class A>
-  struct bind_
-  {
-    typedef internal::Wrap_squared<
-      typename boost::graph_traits<
-        CGAL::Polyhedron_3<Gt, I, HDS, A>
-        >::edge_descriptor > type;
-    typedef type const_type;
-  };
-};
-
-template <>
-struct Polyhedron_property_map<vertex_point_t>
-{
-  template<class Gt, class I, CGAL_HDS_PARAM_, class A>
-  struct bind_
-  {
-    typedef internal::Point_accessor<
-      typename boost::graph_traits<
-        CGAL::Polyhedron_3<Gt, I, HDS, A>
-        >::vertex_descriptor,
-      typename Gt::Point_3, typename Gt::Point_3&> type;
-
-    typedef internal::Point_accessor<
-      typename boost::graph_traits<
-        CGAL::Polyhedron_3<Gt, I, HDS, A>
-        >::vertex_descriptor,
-      typename Gt::Point_3, const typename Gt::Point_3&> const_type;
-  };
-};
-
-//
-// external indices
-//
-
-template <>
-struct Polyhedron_property_map<edge_external_index_t>
-{
-  template<class Gt, class I, CGAL_HDS_PARAM_, class A>
-  struct bind_
-  {
-    typedef internal::Polyhedron_edge_index_map_external<
-      CGAL::Polyhedron_3<Gt, I, HDS, A>
-      > type;
-    typedef type const_type;
-  };
-};
-
-template <>
-struct Polyhedron_property_map<halfedge_external_index_t>
-{
-  template<class Gt, class I, CGAL_HDS_PARAM_, class A>
-  struct bind_
-  {
-    typedef internal::Polyhedron_index_map_external<
-      typename boost::graph_traits<
-        CGAL::Polyhedron_3<Gt, I, HDS, A>
-        >::halfedge_descriptor > type;
-    typedef type const_type;
-  };
-};
-
-
-template <>
-struct Polyhedron_property_map<vertex_external_index_t>
-{
-  template<class Gt, class I, CGAL_HDS_PARAM_, class A>
-  struct bind_
-  {
-    typedef internal::Polyhedron_index_map_external<
-      typename boost::graph_traits<
-        CGAL::Polyhedron_3<Gt, I, HDS, A>
-        >::vertex_descriptor > type;
-    typedef type const_type;
-  };
-};
-
-template <>
-struct Polyhedron_property_map<face_external_index_t>
-{
-  template<class Gt, class I, CGAL_HDS_PARAM_, class A>
-  struct bind_
-  {
-    typedef internal::Polyhedron_index_map_external<
-      typename boost::graph_traits<
-        CGAL::Polyhedron_3<Gt, I, HDS, A>
-        >::face_descriptor > type;
-    typedef type const_type;
-  };
-};
-
-} // CGAL
-
-namespace CGAL {
-
-template<class Gt, class I, CGAL_HDS_PARAM_, class A>
-typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, boost::edge_external_index_t >::const_type
-get(boost::edge_external_index_t, CGAL::Polyhedron_3<Gt,I,HDS,A> const& p)
-{
-  return typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, boost::edge_external_index_t >::const_type(
-    const_cast<CGAL::Polyhedron_3<Gt,I,HDS,A>& >(p));
-}
-
-template<class Gt, class I, CGAL_HDS_PARAM_, class A>
-typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, boost::halfedge_external_index_t >::const_type
-get(boost::halfedge_external_index_t, CGAL::Polyhedron_3<Gt,I,HDS,A> const& p)
-{
-  CGAL::Polyhedron_3<Gt,I,HDS,A>& ncp = const_cast<CGAL::Polyhedron_3<Gt,I,HDS,A>&>(p);
-
-  return typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, boost::halfedge_external_index_t >::const_type(
-    ncp.halfedges_begin(), ncp.halfedges_end(), ncp.size_of_halfedges());
-}
-
-template<class Gt, class I, CGAL_HDS_PARAM_, class A>
-typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, boost::vertex_external_index_t >::const_type
-get(boost::vertex_external_index_t, CGAL::Polyhedron_3<Gt,I,HDS,A> const& p)
-{
-  CGAL::Polyhedron_3<Gt,I,HDS,A>& ncp = const_cast<CGAL::Polyhedron_3<Gt,I,HDS,A>&>(p);
-
-  return typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, boost::vertex_external_index_t >::const_type(
-    ncp.vertices_begin(), ncp.vertices_end(), ncp.size_of_vertices());
-}
-
-template<class Gt, class I, CGAL_HDS_PARAM_, class A>
-typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, boost::face_external_index_t >::const_type
-get(boost::face_external_index_t, CGAL::Polyhedron_3<Gt,I,HDS,A> const& p)
-{
-  CGAL::Polyhedron_3<Gt,I,HDS,A>& ncp = const_cast<CGAL::Polyhedron_3<Gt,I,HDS,A>&>(p);
-
-  return typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, boost::face_external_index_t >::const_type(
-    ncp.facets_begin(), ncp.facets_end(), ncp.size_of_facets());
-}
-
-// the same blurb for non-const
-
-template<class Gt, class I, CGAL_HDS_PARAM_, class A>
-typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, boost::edge_external_index_t >::type
-get(boost::edge_external_index_t, CGAL::Polyhedron_3<Gt,I,HDS,A>& p)
-{
-  return typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, boost::edge_external_index_t >::type(
-    p);
-}
-
-template<class Gt, class I, CGAL_HDS_PARAM_, class A>
-typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, boost::halfedge_external_index_t >::type
-get(boost::halfedge_external_index_t, CGAL::Polyhedron_3<Gt,I,HDS,A> & ncp)
-{
-  return typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, boost::halfedge_external_index_t >::type(
-    ncp.halfedges_begin(), ncp.halfedges_end(), ncp.size_of_halfedges());
-}
-
-template<class Gt, class I, CGAL_HDS_PARAM_, class A>
-typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, boost::vertex_external_index_t >::type
-get(boost::vertex_external_index_t, CGAL::Polyhedron_3<Gt,I,HDS,A> & ncp)
-{
-  return typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, boost::vertex_external_index_t >::type(
-    ncp.vertices_begin(), ncp.vertices_end(), ncp.size_of_vertices());
-}
-
-
-template<class Gt, class I, CGAL_HDS_PARAM_, class A>
-typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, boost::face_external_index_t >::type
-get(boost::face_external_index_t, CGAL::Polyhedron_3<Gt,I,HDS,A> & ncp)
-{
-  return typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, boost::face_external_index_t >::type(
-    ncp.facets_begin(), ncp.facets_end(), ncp.size_of_facets());
-}
-
-
-
-} // namespace CGAL
-
-
-namespace boost {
-
-// property_map dispatcher into Polyhedron
-template<class Gt, class I, CGAL_HDS_PARAM_, class A, class Tag>
-struct property_map<CGAL::Polyhedron_3<Gt,I,HDS,A>, Tag>
-{
-  typedef typename CGAL::Polyhedron_property_map<Tag>::
-      template bind_<Gt,I,HDS,A> map_gen;
-  typedef typename map_gen::type       type;
-  typedef typename map_gen::const_type const_type;
-};
-
-// property_map dispatcher into const Polyhedron
-template<class Gt, class I, CGAL_HDS_PARAM_, class A, class Tag>
-struct property_map<const CGAL::Polyhedron_3<Gt,I,HDS,A>, Tag>
-{
-  typedef typename CGAL::Polyhedron_property_map<Tag>::
-      template bind_<Gt,I,HDS,A> map_gen;
-  typedef typename map_gen::type       type;
-  typedef typename map_gen::const_type const_type;
-};
-
-// What are those needed for ???
-template<class Gt, class I, CGAL_HDS_PARAM_, class A>
-struct edge_property_type<CGAL::Polyhedron_3<Gt,I,HDS,A> >
-{
-  typedef edge_weight_t type;
-};
-
-template<class Gt, class I, CGAL_HDS_PARAM_, class A>
-struct vertex_property_type<CGAL::Polyhedron_3<Gt,I,HDS,A> >
-{
-  typedef CGAL::vertex_point_t type;
-};
-
-template<class Gt, class I, CGAL_HDS_PARAM_, class A>
-struct vertex_property_type<const CGAL::Polyhedron_3<Gt,I,HDS,A> >
-{
-  typedef CGAL::vertex_point_t type;
-};
-} // namespace boost
-
-
-#undef CGAL_HDS_PARAM_
-
-#endif // CGAL_BOOST_GRAPH_PROPERTIES_POLYHEDRON_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/properties_Surface_mesh.h b/3rdparty/CGAL-4.8/include/CGAL/boost/graph/properties_Surface_mesh.h
deleted file mode 100644
index 08306f7..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/properties_Surface_mesh.h
+++ /dev/null
@@ -1,279 +0,0 @@
-// Copyright (c) 2014  GeometryFactory (France).  All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Philipp Möller
-
-
-#ifndef CGAL_PROPERTIES_SURFACE_MESH_H
-#define CGAL_PROPERTIES_SURFACE_MESH_H
-
-#include <CGAL/assertions.h>
-#include <CGAL/Surface_mesh.h>
-#include <CGAL/Kernel_traits.h>
-#include <CGAL/squared_distance_3.h>
-
-#include <CGAL/boost/graph/properties.h>
-
-#include <boost/cstdint.hpp>
-
-namespace CGAL {
-
-template <typename Point>
-class SM_edge_weight_pmap 
-  : public boost::put_get_helper<typename CGAL::Kernel_traits<Point>::type::FT, SM_edge_weight_pmap<Point> >
-{
-  typedef CGAL::Surface_mesh<Point> SM;
-public:
-  typedef boost::readable_property_map_tag                category;
-  typedef typename CGAL::Kernel_traits<Point>::type::FT   value_type;
-  typedef value_type                                      reference;
-  typedef typename SM::Edge_index                        key_type;
-
-  SM_edge_weight_pmap(const CGAL::Surface_mesh<Point>& sm)
-    : pm_(sm. template property_map< 
-            typename SM::Vertex_index,
-            typename SM::Point >("v:point").first),
-      sm_(sm)
-    {}
-
-  value_type operator[](const key_type& e) const
-  {
-    return CGAL::sqrt(CGAL::squared_distance(pm_[source(e, sm_)],
-                                             pm_[target(e, sm_)]));
-  }
-
-private:
-   typename SM::template Property_map< typename SM::Vertex_index, 
-                                       typename SM::Point > pm_;
-  const SM& sm_;
-};
-
-
-template <typename K, typename VEF>
-class SM_index_pmap : public boost::put_get_helper<boost::uint32_t, SM_index_pmap<K,VEF> >
-{
-public:
-  typedef boost::readable_property_map_tag category;
-  typedef boost::uint32_t                  value_type;
-  typedef boost::uint32_t                  reference;
-  typedef VEF                              key_type;
-
-  value_type operator[](const key_type& vd) const
-  {
-    return vd;
-  }
-};
-
-} // CGAL
-
-// overloads and specializations in the boost namespace
-namespace boost {
-#if 1
-template <typename Point, typename T>
-struct property_map<CGAL::Surface_mesh<Point>, boost::vertex_property_t<T> >
-{
-  typedef CGAL::Surface_mesh<Point> SM;
-  typedef typename SM:: template Property_map<typename SM::vertex_index,T> type;
-  typedef type const_type;
-};
-
-
-#endif
-
-
-//
-// edge_weight
-//
-
-template <typename Point>
-struct property_map<CGAL::Surface_mesh<Point>, boost::edge_weight_t >
-{
-  typedef CGAL::SM_edge_weight_pmap<Point> type;
-  typedef CGAL::SM_edge_weight_pmap<Point> const_type;
-};
-
-template <typename Point>
-typename property_map<CGAL::Surface_mesh<Point>, boost::edge_weight_t>::const_type
-get(boost::edge_weight_t, const CGAL::Surface_mesh<Point>& sm)
-{
-  return CGAL::SM_edge_weight_pmap<Point>(sm);
-}
-
-template <typename Point>
-typename CGAL::SM_edge_weight_pmap<Point>::value_type
-get(boost::edge_weight_t, const CGAL::Surface_mesh<Point>& sm, 
-    const typename boost::graph_traits<CGAL::Surface_mesh<Point> >::edge_descriptor& e)
-{
-  return CGAL::SM_edge_weight_pmap<Point>(sm)[e];
-}
-
-//
-// vertex_index
-//
-
-template <typename K>
-struct property_map<CGAL::Surface_mesh<K>, boost::vertex_index_t >
-{
-  typedef CGAL::SM_index_pmap<K, typename boost::graph_traits<CGAL::Surface_mesh<K> >::vertex_descriptor> type;
-  typedef CGAL::SM_index_pmap<K, typename boost::graph_traits<CGAL::Surface_mesh<K> >::vertex_descriptor> const_type;
-};
-
-template <typename K>
-CGAL::SM_index_pmap<K, typename boost::graph_traits<CGAL::Surface_mesh<K> >::vertex_descriptor>
-get(const boost::vertex_index_t&, const CGAL::Surface_mesh<K>&)
-{
-  return CGAL::SM_index_pmap<K, typename boost::graph_traits<CGAL::Surface_mesh<K> >::vertex_descriptor>();
-}
-
-//
-// face_index
-//
-
-template <typename K>
-struct property_map<CGAL::Surface_mesh<K>, boost::face_index_t >
-{
-  typedef CGAL::SM_index_pmap<K, typename boost::graph_traits<CGAL::Surface_mesh<K> >::face_descriptor> type;
-  typedef CGAL::SM_index_pmap<K, typename boost::graph_traits<CGAL::Surface_mesh<K> >::face_descriptor> const_type;
-};
-
-template <typename K>
-typename property_map<CGAL::Surface_mesh<K>, boost::face_index_t>::const_type
-get(const boost::face_index_t&, const CGAL::Surface_mesh<K>&)
-{
-  return CGAL::SM_index_pmap<K, typename boost::graph_traits<CGAL::Surface_mesh<K> >::face_descriptor>();
-}
-
-//
-// edge_index
-//
-
-template <typename K>
-struct property_map<CGAL::Surface_mesh<K>, boost::edge_index_t >
-{
-  typedef CGAL::SM_index_pmap<K, typename boost::graph_traits<CGAL::Surface_mesh<K> >::edge_descriptor> type;
-  typedef CGAL::SM_index_pmap<K, typename boost::graph_traits<CGAL::Surface_mesh<K> >::edge_descriptor> const_type;
-};
-
-template <typename K>
-CGAL::SM_index_pmap<K, typename boost::graph_traits<CGAL::Surface_mesh<K> >::edge_descriptor>
-get(const boost::edge_index_t&, const CGAL::Surface_mesh<K>&)
-{
-  return CGAL::SM_index_pmap<K, typename boost::graph_traits<CGAL::Surface_mesh<K> >::edge_descriptor>();
-}
-
-//
-// halfedge_index
-//
-
-template <typename K>
-struct property_map<CGAL::Surface_mesh<K>, boost::halfedge_index_t >
-{
-  typedef CGAL::SM_index_pmap<K, typename boost::graph_traits<CGAL::Surface_mesh<K> >::halfedge_descriptor> type;
-  typedef CGAL::SM_index_pmap<K, typename boost::graph_traits<CGAL::Surface_mesh<K> >::halfedge_descriptor> const_type;
-};
-
-template <typename K>
-CGAL::SM_index_pmap<K, typename boost::graph_traits<CGAL::Surface_mesh<K> >::halfedge_descriptor>
-get(const boost::halfedge_index_t&, const CGAL::Surface_mesh<K>&)
-{
-  return CGAL::SM_index_pmap<K, typename boost::graph_traits<CGAL::Surface_mesh<K> >::halfedge_descriptor>();
-}
-
-//
-// vertex_point
-// 
-
-template<typename P>
-struct property_map<CGAL::Surface_mesh<P>, CGAL::vertex_point_t >
-{
-  typedef CGAL::Surface_mesh<P> SM; 
-
-  typedef typename
-    SM::template Property_map< typename SM::Vertex_index, 
-                               P
-                               > type;
-  
-  typedef type const_type;
-  
-};
-
-template<typename K>
-typename property_map<CGAL::Surface_mesh<K>, CGAL::vertex_point_t >::const_type
-get(CGAL::vertex_point_t, const CGAL::Surface_mesh<K>& g) {
-  return g.points();
-}
-
-
-// get for intrinsic properties
-#define CGAL_SM_INTRINSIC_PROPERTY(RET, PROP, TYPE)                     \
-  template<typename Point>                                              \
-  RET                                                                   \
-  get(PROP p, const CGAL::Surface_mesh<Point>& sm,                      \
-      typename boost::graph_traits< CGAL::Surface_mesh<Point> >::TYPE x) \
-  { return get(get(p, sm), x); }                                        \
-
-CGAL_SM_INTRINSIC_PROPERTY(boost::uint32_t, boost::vertex_index_t, vertex_descriptor)
-CGAL_SM_INTRINSIC_PROPERTY(boost::uint32_t, boost::edge_index_t, edge_descriptor)
-CGAL_SM_INTRINSIC_PROPERTY(boost::uint32_t, boost::halfedge_index_t, halfedge_descriptor)
-CGAL_SM_INTRINSIC_PROPERTY(boost::uint32_t, boost::face_index_t, face_descriptor)
-CGAL_SM_INTRINSIC_PROPERTY(Point&, CGAL::vertex_point_t, vertex_descriptor)
-
-#undef CGAL_SM_INTRINSIC_PROPERTY
-
-// put for intrinsic properties
-// only available for vertex_point
-template<typename K>
-void
-put(CGAL::vertex_point_t p, const CGAL::Surface_mesh<K>& g,
-    typename boost::graph_traits< CGAL::Surface_mesh<K> >::vertex_descriptor x,
-    const K& point) {
-  typedef CGAL::Surface_mesh<K> SM;
-  CGAL_assertion(g.is_valid(x));
-  typename SM::template Property_map< typename boost::graph_traits<SM>::vertex_descriptor, 
-                    K> prop = get(p, g);
-  prop[x] = point;
-}
-
-} // boost
-
-#if 0
-// 
-namespace CGAL {
-template <typename Point, typename T>
-typename boost::property_map<CGAL::Surface_mesh<Point>, boost::vertex_property_t<T> >::const_type
-get(boost::vertex_property_t<T> vprop, const CGAL::Surface_mesh<Point>& sm)
-{
-  return sm.template get_property_map<typename CGAL::Surface_mesh<Point>::Vertex_index, T>(vprop.s).first;
-}
-
-template <typename Point, typename T>
-typename boost::property_map<CGAL::Surface_mesh<Point>, boost::vertex_property_t<T> >::const_type
-add(boost::vertex_property_t<T> vprop, CGAL::Surface_mesh<Point>& sm)
-{
-  return sm.template add_property_map<typename CGAL::Surface_mesh<Point>::Vertex_index, T>(vprop.s, vprop.t).first;
-}
-
-template <typename Pmap,typename P>
-void
-remove(Pmap pm, CGAL::Surface_mesh<P>& sm)
-{
-  return sm.remove_property_map(pm);
-}
-} // namespace CGAL
-#endif
-
-#endif /* CGAL_PROPERTIES_SURFACE_MESH_H */
diff --git a/3rdparty/CGAL-4.8/include/CGAL/compute_average_spacing.h b/3rdparty/CGAL-4.8/include/CGAL/compute_average_spacing.h
deleted file mode 100644
index 97d4c64..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/compute_average_spacing.h
+++ /dev/null
@@ -1,274 +0,0 @@
-// Copyright (c) 2007-09  INRIA Sophia-Antipolis (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
-// 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(s) : Pierre Alliez and Laurent Saboret
-
-#ifndef CGAL_AVERAGE_SPACING_3_H
-#define CGAL_AVERAGE_SPACING_3_H
-
-#include <CGAL/Search_traits_3.h>
-#include <CGAL/squared_distance_3.h>
-#include <CGAL/Orthogonal_k_neighbor_search.h>
-#include <CGAL/property_map.h>
-#include <CGAL/point_set_processing_assertions.h>
-#include <CGAL/assertions.h>
-
-#include <iterator>
-#include <list>
-
-#ifdef CGAL_LINKED_WITH_TBB
-#include <tbb/parallel_for.h>
-#include <tbb/blocked_range.h>
-#include <tbb/scalable_allocator.h>  
-#endif // CGAL_LINKED_WITH_TBB
-
-namespace CGAL {
-
-
-// ----------------------------------------------------------------------------
-// Private section
-// ----------------------------------------------------------------------------
-/// \cond SKIP_IN_MANUAL
-namespace internal {
-
-
-/// Computes average spacing of one query point from K nearest neighbors.
-///
-/// \pre `k >= 2`.
-///
-/// @tparam Kernel Geometric traits class.
-/// @tparam Tree KD-tree.
-///
-/// @return average spacing (scalar).
-template < typename Kernel,
-           typename Tree >
-typename Kernel::FT
-compute_average_spacing(const typename Kernel::Point_3& query, ///< 3D point whose spacing we want to compute
-                        const Tree& tree,                      ///< KD-tree
-                        unsigned int k)                        ///< number of neighbors
-{
-  // basic geometric types
-  typedef typename Kernel::FT FT;
-  typedef typename Kernel::Point_3 Point;
-
-  // types for K nearest neighbors search
-  typedef Search_traits_3<Kernel> Tree_traits;
-  typedef Orthogonal_k_neighbor_search<Tree_traits> Neighbor_search;
-  typedef typename Neighbor_search::iterator Search_iterator;
-
-  // performs k + 1 queries (if unique the query point is
-  // output first). search may be aborted when k is greater
-  // than number of input points
-  Neighbor_search search(tree,query,k+1);
-  Search_iterator search_iterator = search.begin();
-  FT sum_distances = (FT)0.0;
-  unsigned int i;
-  for(i=0;i<(k+1);i++)
-  {
-    if(search_iterator == search.end())
-      break; // premature ending
-
-    Point p = search_iterator->first;
-    sum_distances += std::sqrt(CGAL::squared_distance(query,p));
-    search_iterator++;
-  }
-
-  // output average spacing
-  return sum_distances / (FT)i;
-}
-
-
-#ifdef CGAL_LINKED_WITH_TBB
-  template <typename Kernel, typename Tree>
-  class Compute_average_spacings {
-    typedef typename Kernel::Point_3 Point;
-    typedef typename Kernel::FT FT;
-    const Tree& tree;
-    const unsigned int k;
-    const std::vector<Point>& input;
-    std::vector<FT>& output;
-
-  public:
-    Compute_average_spacings(Tree& tree, unsigned int k, std::vector<Point>& points,
-			     std::vector<FT>& output)
-      : tree(tree), k (k), input (points), output (output)
-    { }
-    
-    void operator()(const tbb::blocked_range<std::size_t>& r) const
-    {
-      for( std::size_t i = r.begin(); i != r.end(); ++i)
-	output[i] = CGAL::internal::compute_average_spacing<Kernel,Tree>(input[i], tree, k);
-    }
-
-  };
-#endif // CGAL_LINKED_WITH_TBB
-
-} /* namespace internal */
-/// \endcond
-
-
-
-// ----------------------------------------------------------------------------
-// Public section
-// ----------------------------------------------------------------------------
-
-/// \ingroup PkgPointSetProcessing
-/// Computes average spacing from k nearest neighbors.
-///
-/// \pre `k >= 2.`
-///
-/// @tparam Concurrency_tag enables sequential versus parallel algorithm.
-///                         Possible values are `Sequential_tag`
-///                         and `Parallel_tag`.
-/// @tparam InputIterator iterator over input points.
-/// @tparam PointPMap is a model of `ReadablePropertyMap` with value type `Point_3<Kernel>`.
-///        It can be omitted if the value type of `InputIterator`  is convertible to `Point_3<Kernel>`.
-/// @tparam Kernel Geometric traits class.
-///        It can be omitted and deduced automatically from the value type of `PointPMap`.
-///
-/// @return average spacing (scalar).
-
-// This variant requires the kernel.
-template <typename Concurrency_tag,
-	  typename InputIterator,
-          typename PointPMap,
-          typename Kernel
->
-typename Kernel::FT
-compute_average_spacing(
-  InputIterator first,  ///< iterator over the first input point.
-  InputIterator beyond, ///< past-the-end iterator over the input points.
-  PointPMap point_pmap, ///< property map: value_type of InputIterator -> Point_3
-  unsigned int k, ///< number of neighbors.
-  const Kernel& /*kernel*/) ///< geometric traits.
-{
-  // basic geometric types
-  typedef typename Kernel::Point_3 Point;
-
-  // types for K nearest neighbors search structure
-  typedef typename Kernel::FT FT;
-  typedef Search_traits_3<Kernel> Tree_traits;
-  typedef Orthogonal_k_neighbor_search<Tree_traits> Neighbor_search;
-  typedef typename Neighbor_search::Tree Tree;
-
-  // precondition: at least one element in the container.
-  // to fix: should have at least three distinct points
-  // but this is costly to check
-  CGAL_point_set_processing_precondition(first != beyond);
-
-  // precondition: at least 2 nearest neighbors
-  CGAL_point_set_processing_precondition(k >= 2);
-
-  // Instanciate a KD-tree search.
-  // Note: We have to convert each input iterator to Point_3.
-  std::vector<Point> kd_tree_points; 
-  for(InputIterator it = first; it != beyond; it++)
-  {
-  #ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-      Point point = get(point_pmap, it);
-  #else
-      Point point = get(point_pmap, *it);
-  #endif
-      kd_tree_points.push_back(point);
-  }
-  Tree tree(kd_tree_points.begin(), kd_tree_points.end());
-
-  // iterate over input points, compute and output normal
-  // vectors (already normalized)
-  FT sum_spacings = (FT)0.0;
-
-#ifndef CGAL_LINKED_WITH_TBB
-  CGAL_static_assertion_msg (!(boost::is_convertible<Concurrency_tag, Parallel_tag>::value),
-			     "Parallel_tag is enabled but TBB is unavailable.");
-#else
-   if (boost::is_convertible<Concurrency_tag,Parallel_tag>::value)
-   {
-     std::vector<FT> spacings (kd_tree_points.size ());
-     CGAL::internal::Compute_average_spacings<Kernel, Tree>
-       f (tree, k, kd_tree_points, spacings);
-     tbb::parallel_for(tbb::blocked_range<size_t>(0, kd_tree_points.size ()), f);
-     for (unsigned int i = 0; i < spacings.size (); ++ i)
-       sum_spacings += spacings[i];
-   }
-   else
-#endif
-     {
-       for(InputIterator it = first; it != beyond; it++)
-	 {
-	   sum_spacings += internal::compute_average_spacing<Kernel,Tree>(
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-									  get(point_pmap,it),
-#else
-									  get(point_pmap,*it),
-#endif
-									  tree,k);
-	 }
-     }
-   
-  // return average spacing
-   return sum_spacings / (FT)(kd_tree_points.size ());
-}
-
-/// @cond SKIP_IN_MANUAL
-// This variant deduces the kernel from the iterator type.
-template <typename Concurrency_tag,
-	  typename InputIterator,
-          typename PointPMap
->
-typename Kernel_traits<typename boost::property_traits<PointPMap>::value_type>::Kernel::FT
-compute_average_spacing(
-  InputIterator first,    ///< iterator over the first input point.
-  InputIterator beyond,   ///< past-the-end iterator over the input points.
-  PointPMap point_pmap, ///< property map: value_type of InputIterator -> Point_3
-  unsigned int k) ///< number of neighbors
-{
-  typedef typename boost::property_traits<PointPMap>::value_type Point;
-  typedef typename Kernel_traits<Point>::Kernel Kernel;
-  return compute_average_spacing<Concurrency_tag>(
-    first,beyond,
-    point_pmap,
-    k,
-    Kernel());
-}
-/// @endcond
-
-/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Identity_property_map.
-template < typename Concurrency_tag, typename InputIterator >
-typename Kernel_traits<typename std::iterator_traits<InputIterator>::value_type>::Kernel::FT
-compute_average_spacing(
-  InputIterator first,    ///< iterator over the first input point.
-  InputIterator beyond,   ///< past-the-end iterator over the input points.
-  unsigned int k) ///< number of neighbors.
-{
-  return compute_average_spacing<Concurrency_tag>(
-    first,beyond,
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-    make_dereference_property_map(first),
-#else
-    make_identity_property_map(
-    typename std::iterator_traits<InputIterator>::value_type()),
-#endif
-    k);
-}
-/// @endcond
-
-
-} //namespace CGAL
-
-#endif // CGAL_AVERAGE_SPACING_3_H
-
diff --git a/3rdparty/CGAL-4.8/include/CGAL/config.h b/3rdparty/CGAL-4.8/include/CGAL/config.h
deleted file mode 100644
index 9586fa1..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/config.h
+++ /dev/null
@@ -1,519 +0,0 @@
-// Copyright (c) 1997-2013
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved. 
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Wieger Wesselink 
-//                 Michael Hoffmann <hoffmann at inf.ethz.ch>
-//                 Sylvain Pion
-//                 Laurent Rineau
-
-#ifndef CGAL_CONFIG_H
-#define CGAL_CONFIG_H
-
-// Workaround for a bug in Boost, that checks WIN64 instead of _WIN64
-//   https://svn.boost.org/trac/boost/ticket/5519
-#if defined(_WIN64) && ! defined(WIN64)
-#  define WIN64
-#endif
-
-#ifdef CGAL_INCLUDE_WINDOWS_DOT_H
-// Mimic users including this file which defines min max macros
-// and other names leading to name clashes
-#include <windows.h>
-#endif
-
-#if defined(CGAL_TEST_SUITE) && defined(NDEBUG)
-#  error The test-suite needs no NDEBUG defined
-#endif // CGAL_TEST_SUITE and NDEBUG
-
-// See [[Small features/Visual_Leak_Detector]] in CGAL developers wiki
-// See also: http://vld.codeplex.com/
-#if defined(CGAL_ENABLE_VLD)
-#  include <vld.h>
-#endif // CGAL_ENABLE_VLD
-
-// Workaround to the following bug:
-// https://bugreports.qt-project.org/browse/QTBUG-22829
-#ifdef Q_MOC_RUN
-// When Qt moc runs on CGAL files, do not process
-// <boost/type_traits/has_operator.hpp>
-#  define BOOST_TT_HAS_OPERATOR_HPP_INCLUDED
-#  define BOOST_TT_HAS_BIT_AND_ASSIGN_HPP_INCLUDED
-#  define BOOST_TT_HAS_BIT_OR_HPP_INCLUDED
-#  define BOOST_TT_HAS_BIT_OR_ASSIGN_HPP_INCLUDED
-#  define BOOST_TT_HAS_BIT_XOR_HPP_INCLUDED
-#  define BOOST_TT_HAS_BIT_XOR_ASSIGN_HPP_INCLUDED
-#  define BOOST_TT_HAS_DIVIDES_HPP_INCLUDED
-#  define BOOST_TT_HAS_DIVIDES_ASSIGN_HPP_INCLUDED
-#  define BOOST_TT_HAS_EQUAL_TO_HPP_INCLUDED
-#  define BOOST_TT_HAS_GREATER_HPP_INCLUDED
-#  define BOOST_TT_HAS_GREATER_EQUAL_HPP_INCLUDED
-#  define BOOST_TT_HAS_LEFT_SHIFT_HPP_INCLUDED
-#  define BOOST_TT_HAS_LEFT_SHIFT_ASSIGN_HPP_INCLUDED
-#  define BOOST_TT_HAS_LESS_HPP_INCLUDED
-#  define BOOST_TT_HAS_LESS_EQUAL_HPP_INCLUDED
-#  define BOOST_TT_HAS_LOGICAL_AND_HPP_INCLUDED
-#  define BOOST_TT_HAS_LOGICAL_OR_HPP_INCLUDED
-#  define BOOST_TT_HAS_MINUS_HPP_INCLUDED
-#  define BOOST_TT_HAS_MINUS_ASSIGN_HPP_INCLUDED
-#  define BOOST_TT_HAS_MODULUS_HPP_INCLUDED
-#  define BOOST_TT_HAS_MODULUS_ASSIGN_HPP_INCLUDED
-#  define BOOST_TT_HAS_MULTIPLIES_HPP_INCLUDED
-#  define BOOST_TT_HAS_MULTIPLIES_ASSIGN_HPP_INCLUDED
-#  define BOOST_TT_HAS_NOT_EQUAL_TO_HPP_INCLUDED
-#  define BOOST_TT_HAS_PLUS_HPP_INCLUDED
-#  define BOOST_TT_HAS_PLUS_ASSIGN_HPP_INCLUDED
-#  define BOOST_TT_HAS_RIGHT_SHIFT_HPP_INCLUDED
-#  define BOOST_TT_HAS_RIGHT_SHIFT_ASSIGN_HPP_INCLUDED
-// do not include <boost/random.hpp> either
-// it includes <boost/type_traits/has_binary_operator.hpp>
-#  define BOOST_RANDOM_HPP
-#endif
-
-// The following header file defines among other things  BOOST_PREVENT_MACRO_SUBSTITUTION 
-#include <boost/config.hpp>
-#include <boost/version.hpp>
-
-// bug-fix for g++-5.x and Boost.Config<1.57
-//    https://svn.boost.org/trac/boost/ticket/10500
-#if BOOST_VERSION < 105700 && BOOST_GCC < 60000 && \
-  ! defined(__GXX_EXPERIMENTAL_CXX0X__) && defined(BOOST_HAS_VARIADIC_TMPL)
-#  undef BOOST_HAS_VARIADIC_TMPL
-#  define BOOST_NO_CXX11_VARIADIC_TEMPLATES
-#endif
-
-#include <CGAL/version.h>
-
-//----------------------------------------------------------------------//
-//  platform specific workaround flags (CGAL_CFG_...)
-//----------------------------------------------------------------------//
-
-#include <CGAL/compiler_config.h>
-
-//----------------------------------------------------------------------//
-//  Support for DLL on Windows (CGAL_EXPORT macro)
-//----------------------------------------------------------------------//
-
-#include <CGAL/export/CGAL.h>
-
-//----------------------------------------------------------------------//
-//  Use an implementation of fabs with sse2 on Windows
-//----------------------------------------------------------------------//
-
-#if (_M_IX86_FP >= 2) || defined(_M_X64)
-#define CGAL_USE_SSE2_FABS
-#endif
-
-//----------------------------------------------------------------------//
-//  Detect features at compile-time. Some macros have only been
-//  introduced as of Boost 1.40. In that case, we simply say that the
-//  feature is not available, even if that is wrong.
-//  ----------------------------------------------------------------------//
-
-#if defined(BOOST_NO_CXX11_RANGE_BASED_FOR) || BOOST_VERSION < 105000
-#define CGAL_CFG_NO_CPP0X_RANGE_BASED_FOR 1
-#endif
-#if defined(BOOST_NO_0X_HDR_ARRAY) || \
-    defined(BOOST_NO_CXX11_HDR_ARRAY) || BOOST_VERSION < 104000
-#define CGAL_CFG_NO_CPP0X_ARRAY 1
-#endif
-#if defined(BOOST_NO_DECLTYPE) || \
-    defined(BOOST_NO_CXX11_DECLTYPE) || (BOOST_VERSION < 103600)
-#define CGAL_CFG_NO_CPP0X_DECLTYPE 1
-#endif
-#if defined(BOOST_NO_DELETED_FUNCTIONS) || \
-    defined(BOOST_NO_DEFAULTED_FUNCTIONS) || \
-    defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) || \
-    defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) || (BOOST_VERSION < 103600)
-#define CGAL_CFG_NO_CPP0X_DELETED_AND_DEFAULT_FUNCTIONS 1
-#endif
-#if defined(BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS) || \
-    defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) || \
-    (BOOST_VERSION < 104100)
-#define CGAL_CFG_NO_CPP0X_DEFAULT_TEMPLATE_ARGUMENTS_FOR_FUNCTION_TEMPLATES 1
-#endif
-#if defined(BOOST_NO_INITIALIZER_LISTS) || \
-    defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) || (BOOST_VERSION < 103900)
-#define CGAL_CFG_NO_CPP0X_INITIALIZER_LISTS 1
-#endif
-#if defined(BOOST_MSVC)
-#define CGAL_CFG_NO_CPP0X_ISFINITE 1 // used in <CGAL/CORE/Filter.h>
-#endif
-#if defined(BOOST_NO_LONG_LONG) || (BOOST_VERSION < 103600)
-#define CGAL_CFG_NO_CPP0X_LONG_LONG 1
-#endif
-#if defined(BOOST_NO_LAMBDAS) || \
-    defined(BOOST_NO_CXX11_LAMBDAS) || BOOST_VERSION < 104000
-#define CGAL_CFG_NO_CPP0X_LAMBDAS 1
-#endif
-#if defined(BOOST_NO_RVALUE_REFERENCES) || \
-    defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || (BOOST_VERSION < 103600)
-#define CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE 1
-#endif
-#if defined(BOOST_NO_STATIC_ASSERT) || \
-    defined(BOOST_NO_CXX11_STATIC_ASSERT) || (BOOST_VERSION < 103600)
-#define CGAL_CFG_NO_CPP0X_STATIC_ASSERT 1
-#endif
-#if defined(BOOST_NO_0X_HDR_TUPLE) || \
-    defined(BOOST_NO_CXX11_HDR_TUPLE) || (BOOST_VERSION < 104000)
-#define CGAL_CFG_NO_CPP0X_TUPLE 1
-#endif
-#if defined(BOOST_NO_VARIADIC_TEMPLATES) || \
-    defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || (BOOST_VERSION < 103600)
-#define CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES 1
-#endif
-// never use TR1
-#define CGAL_CFG_NO_TR1_ARRAY 1
-// never use TR1
-#define CGAL_CFG_NO_TR1_TUPLE 1
-#if !defined(__GNUC__) || defined(__INTEL_COMPILER)
-#define CGAL_CFG_NO_STATEMENT_EXPRESSIONS 1
-#endif
-#if defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) || (BOOST_VERSION < 105100) || _MSC_VER==1800
-#define CGAL_CFG_NO_CPP0X_UNIFIED_INITIALIZATION_SYNTAX
-#endif
-#if __cplusplus < 201103L && !(_MSC_VER >= 1600)
-#define CGAL_CFG_NO_CPP0X_COPY_N 1
-#define CGAL_CFG_NO_CPP0X_NEXT_PREV 1
-#endif
-#if defined(BOOST_NO_EXPLICIT_CONVERSION_OPERATIONS) \
-    || defined(BOOST_NO_EXPLICIT_CONVERSION_OPERATORS) \
-    || defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS) \
-    || (BOOST_VERSION < 103600)
-#define CGAL_CFG_NO_CPP0X_EXPLICIT_CONVERSION_OPERATORS 1
-#endif
-
-// Some random list to let us write C++11 without thinking about
-// each feature we are using.
-#if __cplusplus >= 201103L && \
-    !defined CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES && \
-    !defined CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE && \
-    !defined CGAL_CFG_NO_CPP0X_EXPLICIT_CONVERSION_OPERATORS && \
-    !defined CGAL_CFG_NO_CPP0X_TUPLE && \
-    !defined CGAL_CFG_NO_CPP0X_UNIFIED_INITIALIZATION_SYNTAX && \
-    !defined CGAL_CFG_NO_CPP0X_STATIC_ASSERT && \
-    !defined CGAL_CFG_NO_CPP0X_DECLTYPE && \
-    !defined CGAL_CFG_NO_CPP0X_DELETED_AND_DEFAULT_FUNCTIONS && \
-    !defined CGAL_CFG_NO_CPP0X_DEFAULT_TEMPLATE_ARGUMENTS_FOR_FUNCTION_TEMPLATES
-#define CGAL_CXX11
-#endif
-
-#if defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) || BOOST_VERSION < 105000
-#define CGAL_CFG_NO_STD_HASH 1
-#endif
-
-//----------------------------------------------------------------------//
-//  auto-link the CGAL library on platforms that support it
-//----------------------------------------------------------------------//
-
-#include <CGAL/auto_link/CGAL.h>
-
-//----------------------------------------------------------------------//
-//  do some post processing for the flags
-//----------------------------------------------------------------------//
-
-#ifdef CGAL_CFG_NO_STL
-#  error "This compiler does not have a working STL"
-#endif
-
-// This macro computes the version number from an x.y.z release number.
-// It only works for public releases.
-#define CGAL_VERSION_NUMBER(x,y,z) (1000001 + 10000*x + 100*y + 10*z) * 1000
-
-#ifndef CGAL_NO_DEPRECATED_CODE
-#define CGAL_BEGIN_NAMESPACE  namespace CGAL { 
-#define CGAL_END_NAMESPACE }
-#endif
-
-
-#ifndef CGAL_CFG_NO_CPP0X_LONG_LONG
-#  define CGAL_USE_LONG_LONG
-#endif
-
-
-#ifndef CGAL_CFG_TYPENAME_BEFORE_DEFAULT_ARGUMENT_BUG
-#  define CGAL_TYPENAME_DEFAULT_ARG typename
-#else
-#  define CGAL_TYPENAME_DEFAULT_ARG
-#endif
-
-
-#ifdef CGAL_CFG_NO_CPP0X_DELETED_AND_DEFAULT_FUNCTIONS
-#  define CGAL_DELETED
-#  define CGAL_EXPLICITLY_DEFAULTED
-#else
-#  define CGAL_DELETED = delete
-#  define CGAL_EXPLICITLY_DEFAULTED = default
-#endif
-
-
-// Big endian or little endian machine.
-// ====================================
-
-#if (BOOST_VERSION >= 105500)
-#  include <boost/predef.h>
-#  if BOOST_ENDIAN_BIG_BYTE
-#    define CGAL_BIG_ENDIAN
-#  elif BOOST_ENDIAN_LITTLE_BYTE
-#    define CGAL_LITTLE_ENDIAN
-#  else
-#    error Unknown endianness
-#  endif
-#elif defined (__GLIBC__)
-#  include <endian.h>
-#  if (__BYTE_ORDER == __LITTLE_ENDIAN)
-#    define CGAL_LITTLE_ENDIAN
-#  elif (__BYTE_ORDER == __BIG_ENDIAN)
-#    define CGAL_BIG_ENDIAN
-#  else
-#    error Unknown endianness
-#  endif
-#elif defined(__sparc) || defined(__sparc__) \
-   || defined(_POWER) || defined(__powerpc__) \
-   || defined(__ppc__) || defined(__hppa) \
-   || defined(_MIPSEB) || defined(_POWER) \
-   || defined(__s390__)
-#  define CGAL_BIG_ENDIAN
-#elif defined(__i386__) || defined(__alpha__) \
-   || defined(__x86_64) || defined(__x86_64__) \
-   || defined(__ia64) || defined(__ia64__) \
-   || defined(_M_IX86) || defined(_M_IA64) \
-   || defined(_M_ALPHA) || defined(_WIN64)
-#  define CGAL_LITTLE_ENDIAN
-#else
-#  error Unknown endianness
-#endif
-
-
-// Symbolic constants to tailor inlining. Inlining Policy.
-// =======================================================
-#ifndef CGAL_MEDIUM_INLINE
-#  define CGAL_MEDIUM_INLINE inline
-#endif
-
-#ifndef CGAL_LARGE_INLINE
-#  define CGAL_LARGE_INLINE
-#endif
-
-#ifndef CGAL_HUGE_INLINE
-#  define CGAL_HUGE_INLINE
-#endif
-
-
-//----------------------------------------------------------------------//
-// SunPRO specific.
-//----------------------------------------------------------------------//
-#ifdef __SUNPRO_CC
-#  include <iterator>
-#  ifdef _RWSTD_NO_CLASS_PARTIAL_SPEC
-#    error "CGAL does not support SunPRO with the old Rogue Wave STL: use STLPort."
-#  endif
-#endif
-
-#ifdef __SUNPRO_CC
-// SunPRO 5.9 emits warnings "The variable tag has not yet been assigned a value"
-// even for empty "tag" variables.  No way to write a config/testfile for this.
-#  define CGAL_SUNPRO_INITIALIZE(C) C
-#else
-#  define CGAL_SUNPRO_INITIALIZE(C)
-#endif
-
-//----------------------------------------------------------------------//
-// MacOSX specific.
-//----------------------------------------------------------------------//
-
-#ifdef __APPLE__
-#  if defined(__GNUG__) && (__GNUG__ == 4) && (__GNUC_MINOR__ == 0) \
-   && defined(__OPTIMIZE__) && !defined(CGAL_NO_WARNING_FOR_MACOSX_GCC_4_0_BUG)
-#    warning "Your configuration may exhibit run-time errors in CGAL code"
-#    warning "This appears with g++ 4.0 on MacOSX when optimizing"
-#    warning "You can disable this warning using -DCGAL_NO_WARNING_FOR_MACOSX_GCC_4_0_BUG"
-#    warning "For more information, see http://www.cgal.org/FAQ.html#mac_optimization_bug"
-#  endif
-#endif
-
-//-------------------------------------------------------------------//
-// When the global min and max are no longer defined (as macros) 
-// because of NOMINMAX flag definition, we define our own global 
-// min/max functions to make the Microsoft headers compile. (afxtempl.h)
-// Users that does not want the global min/max 
-// should define CGAL_NOMINMAX
-//-------------------------------------------------------------------//
-#include <algorithm>
-#if defined NOMINMAX && !defined CGAL_NOMINMAX
-using std::min;
-using std::max;
-#endif
-
-//-------------------------------------------------------------------//
-// Is Geomview usable ?
-#if !defined(_MSC_VER) && !defined(__MINGW32__)
-#  define CGAL_USE_GEOMVIEW
-#endif
-
-
-//-------------------------------------------------------------------//
-// Compilers provide different macros to access the current function name
-#ifdef _MSC_VER
-#  define CGAL_PRETTY_FUNCTION __FUNCSIG__
-#elif defined __GNUG__
-#  define CGAL_PRETTY_FUNCTION __PRETTY_FUNCTION__
-#else 
-#  define CGAL_PRETTY_FUNCTION __func__
-// with sunpro, this requires -features=extensions
-#endif
-
-// Macro to detect GCC versions.
-// It evaluates to 0 if the compiler is not GCC. Be careful that the Intel
-// compilers on Linux, and the LLVM/clang compiler both define GCC version
-// macros.
-#define CGAL_GCC_VERSION (__GNUC__ * 10000       \
-                          + __GNUC_MINOR__ * 100 \
-                          + __GNUC_PATCHLEVEL__)
-
-// Macros to detect features of clang. We define them for the other
-// compilers.
-// See http://clang.llvm.org/docs/LanguageExtensions.html
-#ifndef __has_feature
-  #define __has_feature(x) 0  // Compatibility with non-clang compilers.
-#endif
-#ifndef __has_include
-  #define __has_include(x) 0  // Compatibility with non-clang compilers.
-#endif
-#ifndef __has_extension
-  #define __has_extension __has_feature // Compatibility with pre-3.0 compilers.
-#endif
-#ifndef __has_builtin
-  #define __has_builtin(x) 0  // Compatibility with non-clang compilers.
-#endif
-#ifndef __has_attribute
-  #define __has_attribute(x) 0  // Compatibility with non-clang compilers.
-#endif
-#ifndef __has_warning
-  #define __has_warning(x) 0  // Compatibility with non-clang compilers.
-#endif
-
-// Macro to trigger deprecation warnings
-#ifdef CGAL_NO_DEPRECATION_WARNINGS
-#  define CGAL_DEPRECATED
-#elif defined(__GNUC__) || __has_attribute(__deprecated__)
-#  define CGAL_DEPRECATED __attribute__((__deprecated__))
-#elif defined (_MSC_VER) && (_MSC_VER > 1300)
-#  define CGAL_DEPRECATED __declspec(deprecated)
-#else
-#  define CGAL_DEPRECATED
-#endif
-
-
-// Macro to specify a 'noreturn' attribute.
-#if defined(__GNUG__) || __has_attribute(__noreturn__)
-#  define CGAL_NORETURN  __attribute__ ((__noreturn__))
-#else
-#  define CGAL_NORETURN
-#endif
-
-// Macro to specify a 'unused' attribute.
-#if defined(__GNUG__) || __has_attribute(__unused__)
-#  define CGAL_UNUSED  __attribute__ ((__unused__))
-#else
-#  define CGAL_UNUSED
-#endif
-
-// Macro CGAL_ASSUME
-// Call a builtin of the compiler to pass a hint to the compiler
-#if __has_builtin(__builtin_unreachable) || (CGAL_GCC_VERSION >= 40500 && !__STRICT_ANSI__)
-// From g++ 4.5, there exists a __builtin_unreachable()
-// Also in LLVM/clang
-#  define CGAL_ASSUME(EX) if(!(EX)) { __builtin_unreachable(); }
-#elif defined(_MSC_VER)
-// MSVC has __assume
-#  define CGAL_ASSUME(EX) __assume(EX)
-#endif
-// If CGAL_ASSUME is not defined, then CGAL_assume and CGAL_assume_code are
-// defined differently, in <CGAL/assertions.h>
-
-// If CGAL_HAS_THREADS is not defined, then CGAL code assumes
-// it can do any thread-unsafe things (like using static variables).
-#if !defined CGAL_HAS_THREADS && !defined CGAL_HAS_NO_THREADS
-#  if defined BOOST_HAS_THREADS || defined _OPENMP
-#    define CGAL_HAS_THREADS
-#  endif
-#endif
-
-#if __has_feature(cxx_thread_local) || \
-    ( (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L ) || \
-    ( _MSC_VER >= 1900 )
-#define CGAL_CAN_USE_CXX11_THREAD_LOCAL
-#endif
-
-#if ( BOOST_VERSION >= 105000 && ! defined(BOOST_NO_CXX11_HDR_MUTEX) ) || \
-    (__has_include(<mutex>) && __cplusplus >= 201103L ) | \
-    ( (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L ) || \
-    ( _MSC_VER >= 1700 )
-#define CGAL_CAN_USE_CXX11_MUTEX
-#endif
-
-#if ( BOOST_VERSION >= 105600 && ! defined(BOOST_NO_CXX11_HDR_ATOMIC) ) || \
-    (__has_include(<atomic>) && __cplusplus >= 201103L ) || \
-    ( (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L ) || \
-    ( _MSC_VER >= 1700 )
-#define CGAL_CAN_USE_CXX11_ATOMIC
-#endif
-
-// Support for LEDA with threads
-//   Not that, if CGAL_HAS_THREADS is defined, and you want to use LEDA,
-//   you must link with a version of LEDA libraries that support threads.
-#if defined(CGAL_HAS_THREADS) && CGAL_USE_LEDA
-#  define LEDA_MULTI_THREAD 1
-#endif
-// Support for LEDA_numbers on Windows
-#define LEDA_NUMBERS_DLL 1
-
-// Helper macros to disable macros
-#if defined(__clang__) || (BOOST_GCC >= 40600)
-#  define CGAL_PRAGMA_DIAG_PUSH _Pragma("GCC diagnostic push")
-#  define CGAL_PRAGMA_DIAG_POP  _Pragma("GCC diagnostic pop")
-#else
-#  define CGAL_PRAGMA_DIAG_PUSH
-#  define CGAL_PRAGMA_DIAG_POP
-#endif
-
-namespace CGAL {
-
-// Typedef for the type of NULL.
-typedef const void * Nullptr_t;   // Anticipate C++0x's std::nullptr_t
-
-} //namespace CGAL
-
-//Support for c++11 noexcept
-#if BOOST_VERSION > 104600 && !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_NOEXCEPT)
-#define CGAL_NOEXCEPT(x) noexcept(x)
-#else
-#define CGAL_NOEXCEPT(x)
-#endif
-
-#ifndef CGAL_NO_ASSERTIONS
-#  define CGAL_NO_ASSERTIONS_BOOL false
-#else
-#  define CGAL_NO_ASSERTIONS_BOOL true
-#endif
-
-#endif // CGAL_CONFIG_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/corefinement_operations.h b/3rdparty/CGAL-4.8/include/CGAL/corefinement_operations.h
deleted file mode 100644
index fc527a0..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/corefinement_operations.h
+++ /dev/null
@@ -1,477 +0,0 @@
-// Copyright (c) 2011 GeometryFactory (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Sebastien Loriot
-
-#ifndef CGAL_COREFINEMENT_OPERATIONS_H
-#define CGAL_COREFINEMENT_OPERATIONS_H
-
-#include <CGAL/intersection_of_Polyhedra_3.h>
-#include <CGAL/intersection_of_Polyhedra_3_refinement_visitor.h>
-
-namespace CGAL{
-/** \cond */
-namespace internal{
-  
-template <class HDS>
-class Import_volume_as_polyhedron : public CGAL::Modifier_base<HDS> {
-  typedef typename HDS::Halfedge_handle Halfedge_handle;
-  typedef typename HDS::Vertex_handle   Vertex_handle;
-  typedef typename HDS::Face_handle     Face_handle;
-  typedef typename HDS::Vertex          Vertex;
-  typedef typename HDS::Halfedge        Halfedge;
-  typedef typename HDS::Face            Face;
-  
-  //data members
-  Face_handle current_face;
-  std::vector< typename Vertex::Point >   points;
-  std::size_t nb_edges;
-  std::vector<CGAL::cpp11::tuple<unsigned,unsigned,unsigned> >           faces;
-
-public:
-  
-  //to import each piece individually
-  template <class Combinatorial_map_3>
-  Import_volume_as_polyhedron(const Combinatorial_map_3& map,typename Combinatorial_map_3::Dart_const_handle dart):nb_edges(0)
-  {
-    typedef Combinatorial_map_3 CMap;
-    typedef std::map<const typename Vertex::Point*,unsigned int> Vertex_map;
-    Vertex_map vertex_map;
-    unsigned int index=0;
-    //recover all the vertices in the current volumeiterator over all the point
-    //map the vertex to the index of the point in the vector
-    for (typename CMap::template One_dart_per_incident_cell_const_range<0,3>::const_iterator 
-         it=map.template one_dart_per_incident_cell<0,3>(dart).begin(),
-         itend=map.template one_dart_per_incident_cell<0,3>(dart).end();
-       it!=itend; ++it)
-    {
-      points.push_back(it->template attribute<0>()->point());
-      vertex_map.insert(std::make_pair(&it->template attribute<0>()->point(),index++));
-    }
-    
-    //count the number of edges    
-    nb_edges+=map.template one_dart_per_incident_cell<1,3>(dart).size();
-
-    //recover one dart per face
-    for (typename CMap::template  One_dart_per_incident_cell_const_range<2,3>::const_iterator 
-         it=map.template one_dart_per_incident_cell<2,3>(dart).begin(),
-         itend=map.template one_dart_per_incident_cell<2,3>(dart).end();
-       it!=itend; ++it)
-    {
-      //warning: the convention used into a polyhedron is that the normal 
-      //         of a triangle indicates the outside of the object; thus 
-      //         we need to reverse the orientation of the faces of the
-      //         combinatorial map.
-      unsigned int i=vertex_map[&it->template attribute<0>()->point()];
-      unsigned int j=vertex_map[&it->beta(0)->template attribute<0>()->point()];
-      unsigned int k=vertex_map[&it->beta(1)->template attribute<0>()->point()];
-      faces.push_back(CGAL::cpp11::make_tuple(i,j,k));
-    }
-  }
-  
-  //for intersection and symetric difference
-  template <class Combinatorial_map_3,class Iterator>
-  Import_volume_as_polyhedron(const Combinatorial_map_3& map,
-                              Iterator dart_begin,
-                              Iterator dart_end):nb_edges(0)
-  {
-    typedef Combinatorial_map_3 CMap;
-    typedef std::map<const typename Vertex::Point*,unsigned int> Vertex_map;
-    Vertex_map vertex_map;
-    unsigned int index=0;
-    
-    for (Iterator it=dart_begin;it!=dart_end;++it)
-    {
-      typename Combinatorial_map_3::Dart_const_handle dart=*it;
-      //recover all the vertices in the current volumeiterator over all the point
-      //map the vertex to the index of the point in the vector
-      for (typename CMap::template  One_dart_per_incident_cell_const_range<0,3>::const_iterator 
-           it=map.template one_dart_per_incident_cell<0,3>(dart).begin(),
-           itend=map.template one_dart_per_incident_cell<0,3>(dart).end();
-         it!=itend; ++it)
-      {
-        if ( vertex_map.insert(std::make_pair(&it->template attribute<0>()->point(),index)).second )
-        {          
-          points.push_back(it->template attribute<0>()->point());
-          ++index;
-        }
-      }
-      
-       //count the number of edges    
-      nb_edges+=map.template one_dart_per_incident_cell<1,3>(dart).size();
-
-      //recover one dart per face
-      for (typename CMap::template One_dart_per_incident_cell_const_range<2,3>::const_iterator 
-           it=map.template one_dart_per_incident_cell<2,3>(dart).begin(),
-           itend=map.template one_dart_per_incident_cell<2,3>(dart).end();
-         it!=itend; ++it)
-      {
-        //warning: the convention used into a polyhedron is that the normal 
-        //         of a triangle indicates the outside of the object; thus 
-        //         we need to reverse the orientation of the faces of the
-        //         combinatorial map.        
-        unsigned int i=vertex_map[&it->template attribute<0>()->point()];
-        unsigned int j=vertex_map[&it->beta(0)->template attribute<0>()->point()];
-        unsigned int k=vertex_map[&it->beta(1)->template attribute<0>()->point()];
-        faces.push_back(CGAL::cpp11::make_tuple(i,j,k));
-      }
-    }
-  }
-  
-  //for union : use the inverse of the complementary
-  template <class Combinatorial_map_3,class Iterator>
-  Import_volume_as_polyhedron(const Combinatorial_map_3& map,
-                              Iterator dart_begin,
-                              Iterator dart_end,bool):nb_edges(0)
-  {
-    typedef Combinatorial_map_3 CMap;
-    typedef std::map<const typename Vertex::Point*,unsigned int> Vertex_map;
-    Vertex_map vertex_map;
-    unsigned int index=0;
-    
-    for (Iterator it=dart_begin;it!=dart_end;++it)
-    {
-      typename Combinatorial_map_3::Dart_const_handle dart=*it;
-      //recover all the vertices in the current volumeiterator over all the point
-      //map the vertex to the index of the point in the vector
-      for (typename CMap::template One_dart_per_incident_cell_const_range<0,3>::const_iterator 
-           it=map.template one_dart_per_incident_cell<0,3>(dart).begin(),
-           itend=map.template one_dart_per_incident_cell<0,3>(dart).end();
-         it!=itend; ++it)
-      {
-        if (vertex_map.insert(std::make_pair(&it->template attribute<0>()->point(),index)).second )
-        {
-          points.push_back(it->template attribute<0>()->point());
-          ++index;
-        }
-      }
-      
-      //count the number of edges  
-      nb_edges+=map.template one_dart_per_incident_cell<1,3>(dart).size();
-
-      //recover one dart per face
-      for (typename CMap::template One_dart_per_incident_cell_const_range<2,3>::const_iterator 
-           it=map.template one_dart_per_incident_cell<2,3>(dart).begin(),
-           itend=map.template one_dart_per_incident_cell<2,3>(dart).end();
-         it!=itend; ++it)
-      {
-        //warning: the convention used into a polyhedron is that the normal 
-        //         of a triangle indicates the outside of the object; thus 
-        //         we need to reverse the orientation of the faces of the
-        //         combinatorial map. Since to get the complementary we 
-        //         also need to reverse the orientation, we finally do
-        //         not change it.
-        unsigned int i=vertex_map[&it->template attribute<0>()->point()];
-        unsigned int j=vertex_map[&it->beta(1)->template attribute<0>()->point()];
-        unsigned int k=vertex_map[&it->beta(0)->template attribute<0>()->point()];
-        faces.push_back(CGAL::cpp11::make_tuple(i,j,k));
-      }
-    }
-  }
-    
-  
-  void operator()( HDS& hds)
-  {
-    CGAL::Polyhedron_incremental_builder_3<HDS> B(hds, true);
-    B.begin_surface( points.size(), faces.size(),2*nb_edges);
-    
-    //insert vertices
-    for (typename std::vector<typename Vertex::Point>::iterator it=points.begin();it!=points.end();++it)
-      B.add_vertex(*it);
-
-    //create faces
-    for (std::vector<CGAL::cpp11::tuple<unsigned,unsigned,unsigned> >::iterator it=faces.begin();it!=faces.end();++it)
-    {
-      B.begin_facet();
-      B.add_vertex_to_facet(CGAL::cpp11::get<0>(*it));
-      B.add_vertex_to_facet(CGAL::cpp11::get<1>(*it));
-      B.add_vertex_to_facet(CGAL::cpp11::get<2>(*it));
-      B.end_facet();
-    }
-    B.end_surface();    
-  }
-};
-
-}
-/** \endcond */
-
-/*! \class Polyhedron_corefinement corefinement_operations.h CGAL/corefinement_operations.h
-  * Function object to compute the decomposition of the space induced by two polyhedra.
-  * @tparam Polyhedron must be an instantiation of  CGAL::Polyhedron_3<Traits>.
-  * @tparam Kernel must be a CGAL Kernel compatible with the underlying kernel of Polyhedron.
-  * @tparam Output_polyhedron is a polyhedron type used as output. `Kernel` must be compatible with the underlying kernel of `Output_polyhedron`.
-  */
-template <class Polyhedron,class Kernel=typename Polyhedron::Traits::Kernel, class Output_polyhedron=Polyhedron>
-class Polyhedron_corefinement
-{
-  typedef internal::Import_volume_as_polyhedron<typename Output_polyhedron::HalfedgeDS> Volume_import_modifier;
-  
-public:
-  /** Enumeration of the different feature tags, listing all kind of space decomposition the functor can compute given two input polyhedra P and Q.*/
-  enum Boolean_operation_tag
-  {
-    Join_tag=1,           /*!< the union of P and Q. */  
-    Intersection_tag=2,   /*!< the intersection of P and Q. */  
-    P_minus_Q_tag=4,      /*!< P minus Q. */  
-    Q_minus_P_tag=8,      /*!< Q minus P. */  
-    Parts_of_P_tag=32,    /*!< decomposition of the volume bounded by P induced by Q. */  
-    Parts_of_Q_tag=64,    /*!< decomposition of the volume bounded by Q induced by P. */  
-    Decomposition_tag=16  /*!< Both decompositions of P and Q. */  
-  };
-
-  /**
-    * This computes different polyhedra according to the value of features.
-    * Each input polyhedron is expected to bound a volume: the volume is bounded by the surface polyhedron with facet
-    * normals pointing outside the volume. Each facet is supposed to be counterclockwise oriented, that is its vertex 
-    * sequence (induced by halfedges) is seen counterclockwise from the side of the facet pointed by its normal. If one or
-    * both polyhedra are not closed, the algorithm will end up correctly if each intersection polyline separates each surface
-    * in two components. In that case for each triangle of each surface path boundary, the interior of the volume is considered
-    * to be on the side opposite of that pointed by it normals (but the orientation must be consistent on each patch). 
-    * the surface the volume bounded by an open surface is considered to be an infinite volume above
-    * or below the surface (the side not pointed by normal vectors). 
-    * @tparam Polyline_output_iterator must be an output iterator of std::vector<Kernel::Point_3>.
-    * @tparam Polyhedron_ptr_and_type_output_iterator an output iterator of std::pair<Polyhedron*,int>.
-    * @param P is the first input triangulated polyhedron. Note that a reference is taken and P will be updated to contain the 1D intersection between the two surfaces P and Q.
-    * @param Q is the first input triangulated polyhedron. Note that a reference is taken and Q will be updated to contain the 1D intersection between the two surfaces P and Q.
-    * @param polyline_output is an output iterator that collects intersection polylines between P and Q.
-    * @param poly_output is an output iterator that collects output polyhedra. Note that each polyhedron is allocated within this function (thus must be explicitly deleted when no longer used). The integer is a feature tag corresponding to the volume represented by the polyhedron of the pair.
-    * @param features is an integer indicating what polyhedra the function must compute. If several kind of polyhedra are expected, feature tags must be combined by |. For example if features = Polyhedron_corefinement<Polyhedron,Kernel>::Join_tag | Polyhedron_corefinement<Polyhedron,Kernel>::Intersection_tag, then poly_output will collect two polyhedra, the union and the intersection of P and Q. 
-    */
-  template <class Polyline_output_iterator,class Polyhedron_ptr_and_type_output_iterator>
-  void operator()(  Polyhedron& P, Polyhedron& Q,
-                    Polyline_output_iterator polyline_output,
-                    Polyhedron_ptr_and_type_output_iterator poly_output,
-                    int features) const
-  {
-    typedef CGAL::Node_visitor_refine_polyhedra<Polyhedron> Split_visitor;
-    Split_visitor visitor;
-    CGAL::Intersection_of_Polyhedra_3<Polyhedron,
-      Kernel,
-      Split_visitor> polyline_intersections(visitor);
-
-    polyline_intersections(P, Q, polyline_output);
-
-    typedef typename Split_visitor::Combinatorial_map_3  Combinatorial_map_3;
-    typedef typename Split_visitor::Volume_info  Volume_info;
-    typedef typename Combinatorial_map_3::Dart_const_handle Dart_const_handle;
-    
-    const typename Split_visitor::Combinatorial_map_3& final_map=visitor.combinatorial_map();
-   
-    typename Combinatorial_map_3::template One_dart_per_cell_const_range<3> cell_range=final_map.template one_dart_per_cell<3>();
-
-    std::list<Dart_const_handle> intersection;
-    std::list<Dart_const_handle> union_;
-    std::list<Dart_const_handle> P_minus_Q;
-    std::list<Dart_const_handle> Q_minus_P;
-        
-    for (typename Combinatorial_map_3::template One_dart_per_cell_const_range<3>::const_iterator 
-      it = cell_range.begin(), it_end= cell_range.end();
-      it!= it_end;
-      ++it )
-    {
-
-      const Volume_info& info=it->template attribute<3>()->info();
-      std::size_t inside_size=info.inside.size();
-      std::size_t outside_size=info.outside.size();
-
-      if ( inside_size + outside_size != 2){
-        std::cerr << "Error: One volume cannot be represented using a polyhedron. Aborted.\n";
-        break;
-      }
-
-      switch (outside_size)
-      {
-        case 2:
-          if (features & Join_tag) union_.push_back(it);
-          break;
-        case 0:
-          if (features & Intersection_tag) intersection.push_back(it);
-          break;
-        default:
-          if ( *info.inside.begin() == &P )
-          { if (features & P_minus_Q_tag) P_minus_Q.push_back(it); }
-          else
-          { if (features & Q_minus_P_tag) Q_minus_P.push_back(it); }
-      }
-      
-      if ( features&Decomposition_tag )
-      {
-        Volume_import_modifier modifier(final_map,it);
-        Output_polyhedron* new_poly=new Output_polyhedron();
-        new_poly->delegate(modifier);
-        *poly_output++ = std::make_pair( new_poly,static_cast<int>(Decomposition_tag) );
-      }
-      
-      if ( features&Parts_of_P_tag && info.inside.find(&P)!=info.inside.end() )
-      {
-        Volume_import_modifier modifier(final_map,it);
-        Output_polyhedron* new_poly=new Output_polyhedron();
-        new_poly->delegate(modifier);
-        *poly_output++ = std::make_pair( new_poly,static_cast<int>(Parts_of_P_tag) );
-      }
-
-      if ( features&Parts_of_Q_tag && info.inside.find(&Q)!=info.inside.end() )
-      {
-        Volume_import_modifier modifier(final_map,it);
-        Output_polyhedron* new_poly=new Output_polyhedron();
-        new_poly->delegate(modifier);
-        *poly_output++ = std::make_pair( new_poly,static_cast<int>(Parts_of_Q_tag) );
-      }
-    }
-    
-    if (!intersection.empty())
-    {
-      Volume_import_modifier modifier(final_map,intersection.begin(),intersection.end());
-      Output_polyhedron* new_poly=new Output_polyhedron();
-      new_poly->delegate(modifier);
-      *poly_output++=std::make_pair( new_poly,static_cast<int>(Intersection_tag) );
-    }
-    
-    if (!P_minus_Q.empty())
-    {
-      Volume_import_modifier modifier(final_map,P_minus_Q.begin(),P_minus_Q.end());
-      Output_polyhedron* new_poly=new Output_polyhedron();
-      new_poly->delegate(modifier);
-      *poly_output++=std::make_pair( new_poly,static_cast<int>(P_minus_Q_tag) );
-    }
-
-    if (!Q_minus_P.empty())
-    {
-      Volume_import_modifier modifier(final_map,Q_minus_P.begin(),Q_minus_P.end());
-      Output_polyhedron* new_poly=new Output_polyhedron();
-      new_poly->delegate(modifier);
-      *poly_output++=std::make_pair( new_poly,static_cast<int>(Q_minus_P_tag) );
-    }
-    
-    if (!union_.empty())
-    {
-      Volume_import_modifier modifier(final_map,union_.begin(),union_.end(),true);
-      Output_polyhedron* new_poly=new Output_polyhedron();
-      new_poly->delegate(modifier);
-      *poly_output++=std::make_pair( new_poly,static_cast<int>(Join_tag) );
-    }
-  }
-  /**
-    * This updates P according to the value of features.
-    * Each input polyhedron is expected to bound a volume: the volume is bounded by the surface polyhedron with facet
-    * normals pointing outside the volume. Each facet is supposed to be counterclockwise oriented, that is its vertex 
-    * sequence (induced by halfedges) is seen counterclockwise from the side of the facet pointed by its normal. If one or
-    * both polyhedra are not closed, the algorithm will end up correctly if each intersection polyline separates each surface
-    * in two components. In that case for each triangle of each surface path boundary, the interior of the volume is considered
-    * to be on the side opposite of that pointed by it normals (but the orientation must be consistent on each patch). 
-    * the surface the volume bounded by an open surface is considered to be an infinite volume above
-    * or below the surface (the side not pointed by normal vectors). 
-    * @tparam Polyline_output_iterator must be an output iterator of std::vector<Kernel::Point_3>.
-    * @param P is the first input triangulated polyhedron. Note that a reference is taken and P will be updated to contain the 1D intersection between the two surfaces P and Q.
-    * @param Q is the first input triangulated polyhedron. Note that a reference is taken and Q will be updated to contain the 1D intersection between the two surfaces P and Q.
-    * @param polyline_output is an output iterator that collects intersection polylines between P and Q.
-    * @param features is either Join_tag, Intersection_tag, P_minus_Q_tag or Q_minus_P_tag
-    */
-  template <class Polyline_output_iterator>
-  void operator()(  Polyhedron& P, Polyhedron& Q,
-                    Polyline_output_iterator polyline_output,
-                    Boolean_operation_tag features) const
-  {
-    typedef CGAL::Node_visitor_refine_polyhedra<Polyhedron> Split_visitor;
-    Split_visitor visitor;
-    CGAL::Intersection_of_Polyhedra_3<Polyhedron,
-      Kernel,
-      Split_visitor> polyline_intersections(visitor);
-
-    polyline_intersections(P, Q, polyline_output);
-
-    typedef typename Split_visitor::Combinatorial_map_3  Combinatorial_map_3;
-    typedef typename Split_visitor::Volume_info  Volume_info;
-    typedef typename Combinatorial_map_3::Dart_const_handle Dart_const_handle;
-    
-    const typename Split_visitor::Combinatorial_map_3& final_map=visitor.combinatorial_map();
-   
-    typename Combinatorial_map_3::template One_dart_per_cell_const_range<3> cell_range=final_map.template one_dart_per_cell<3>();
-
-    std::list<Dart_const_handle> darts;
-        
-    for (typename Combinatorial_map_3::template One_dart_per_cell_const_range<3>::const_iterator 
-      it = cell_range.begin(), it_end= cell_range.end();
-      it!= it_end;
-      ++it )
-    {
-
-      const Volume_info& info=it->template attribute<3>()->info();
-      std::size_t inside_size=info.inside.size();
-      std::size_t outside_size=info.outside.size();
-
-      if ( inside_size + outside_size != 2){
-        std::cerr << "Error: One volume cannot be represented using a polyhedron. Aborted.\n";
-        break;
-      }
-
-      switch (outside_size)
-      {
-        case 2:
-          if ( features==Join_tag ) darts.push_back(it);
-          break;
-        case 0:
-          if ( features==Intersection_tag ) darts.push_back(it);
-          break;
-        default:
-          if ( *info.inside.begin() == &P )
-          { if (features == P_minus_Q_tag) darts.push_back(it); }
-          else
-          { if (features == Q_minus_P_tag) darts.push_back(it); }
-      }
-    }
-    
-    P.clear();
-    
-    if (!darts.empty())
-    {
-      Volume_import_modifier modifier=
-      features==Join_tag?
-          Volume_import_modifier(final_map,darts.begin(),darts.end(),true)
-        : Volume_import_modifier(final_map,darts.begin(),darts.end());
-      P.delegate(modifier);
-    }
-  }
-  
-  /** \cond */
-  static std::string get_type_str(const std::string& Pname,const std::string& Qname,int i)
-  {
-    switch (i)
-    {
-      case Join_tag: 
-        return Pname+std::string("_union_")+Qname;
-      case P_minus_Q_tag: 
-        return Pname+std::string("_minus_")+Qname;
-      case Q_minus_P_tag:
-        return Qname+std::string("_minus_")+Pname;
-      case Intersection_tag:
-        return Pname+std::string("_inter_")+Qname;
-      case Decomposition_tag:
-        return std::string("Decomposition");
-    }
-    return std::string("Unknow");
-  }
-  /** \endcond */ 
-};
-
-
-
-
-}
-
-#endif // CGAL_COREFINEMENT_OPERATIONS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/edge_aware_upsample_point_set.h b/3rdparty/CGAL-4.8/include/CGAL/edge_aware_upsample_point_set.h
deleted file mode 100644
index 6f1df10..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/edge_aware_upsample_point_set.h
+++ /dev/null
@@ -1,659 +0,0 @@
-// Copyright (c) 2013-06  INRIA Sophia-Antipolis (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
-// 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(s) : Shihao Wu, Clement Jamin, Pierre Alliez 
-
-#ifndef CGAL_UPSAMPLE_POINT_SET_H
-#define CGAL_UPSAMPLE_POINT_SET_H
-
-#include <CGAL/property_map.h>
-#include <CGAL/point_set_processing_assertions.h>
-#include <CGAL/internal/Rich_grid.h>
-#include <CGAL/Real_timer.h>
-#include <CGAL/Memory_sizer.h>
-#include <CGAL/compute_average_spacing.h>
-
-#include <iterator>
-#include <set>
-#include <utility>
-
-#include <boost/version.hpp>
-#if BOOST_VERSION >= 104000
-  #include <boost/property_map/property_map.hpp>
-#else
-  #include <boost/property_map.hpp>
-#endif
-
-//#define  CGAL_PSP3_VERBOSE
-
-namespace CGAL {
-
-// ----------------------------------------------------------------------------
-// Private section
-// ----------------------------------------------------------------------------
-/// \cond SKIP_IN_MANUAL
-
-namespace upsample_internal{
-
-/// For each query point, select a best "base point" in its neighborhoods.
-/// Then, a new point will be interpolated between query point and "base point".
-/// This is the key part of the upsample algorithm 
-/// 
-/// \pre `radius > 0`
-///
-/// @tparam Kernel Geometric traits class.
-///
-/// @return local density length
-template <typename Kernel>
-typename Kernel::FT
-base_point_selection(
-  const rich_grid_internal::Rich_point<Kernel>& query, ///< 3D point to project
-  const std::vector<rich_grid_internal::Rich_point<Kernel> >& 
-                    neighbor_points,///< neighbor sample points
-  const typename Kernel::FT edge_sensitivity,///< edge sensitivity parameter
-  unsigned int& output_base_index ///< base point index
-  )
-{
-  // basic geometric types
-  typedef typename Kernel::Point_3 Point;
-  typedef typename Kernel::Vector_3 Vector;
-  typedef typename Kernel::FT FT;
-  typedef typename rich_grid_internal::Rich_point<Kernel> Rich_point;
-
-  if (neighbor_points.empty())
-  {
-#ifdef CGAL_PSP3_VERBOSE
-    std::cout << "empty neighborhood" << std::endl;
-#endif
-    output_base_index = query.index;
-    return 0.0;
-  }
-
-  FT best_dist2 = -10.0;
-  const Rich_point& v = query;
-  typename std::vector<Rich_point>::const_iterator iter = neighbor_points.begin();
-  for (; iter != neighbor_points.end(); ++iter)
-  {
-    const Point& t = iter->pt;
-
-    const Vector& vm = v.normal;
-    const Vector& tm = iter->normal;
-
-    Vector diff_v_t = t - v.pt;
-    Point mid_point = v.pt + (diff_v_t * FT(0.5));
-    
-    FT dot_produce = std::pow((FT(2.0) - vm * tm), edge_sensitivity);
-
-    Vector diff_t_mid = mid_point - t;
-    FT project_t = diff_t_mid * tm;
-    FT min_dist2 = diff_t_mid.squared_length() - project_t * project_t;
-
-    typename std::vector<Rich_point>::const_iterator iter_in = neighbor_points.begin();
-    for (; iter_in != neighbor_points.end(); ++iter_in)
-    {
-      Vector diff_s_mid = mid_point - iter_in->pt;
-      FT project_s = diff_s_mid * iter_in->normal;
-
-      FT proj_min2 = diff_s_mid.squared_length() - project_s * project_s;
-
-      if (proj_min2 < min_dist2)
-      {
-        min_dist2 = proj_min2;
-      }
-    }
-    min_dist2 *= dot_produce;
-
-    if (min_dist2 > best_dist2)
-    {
-      best_dist2 = min_dist2;
-      output_base_index = iter->index;
-    }
-  }
-
-  return best_dist2; 
-}
-
-/// For each new inserted point, we need to do the following job
-/// 1, get neighbor information from the two "parent points"
-/// 2, update position and determine normal by bilateral projection 
-/// 3, update neighbor information again
-///
-/// \pre `radius > 0`
-///
-/// @tparam Kernel Geometric traits class.
-///
-template <typename Kernel>
-void
-update_new_point(
-  unsigned int new_point_index, ///< new inserted point
-  unsigned int father_index, ///< father point index
-  unsigned int mother_index, ///< mother point index
-  std::vector<rich_grid_internal::Rich_point<Kernel> >& rich_point_set,
-                                                           ///< all rich points
-  const typename Kernel::FT radius,          ///< accept neighborhood radius
-  const typename Kernel::FT sharpness_bandwidth  ///< control sharpness
-)
-{
-  // basic geometric types
-  typedef typename Kernel::Vector_3 Vector;
-  typedef typename Kernel::FT FT;
-  typedef typename rich_grid_internal::Rich_point<Kernel> Rich_point;
-
-  CGAL_assertion_code( unsigned int size = static_cast<unsigned int>(rich_point_set.size()) );
-  CGAL_point_set_processing_precondition(father_index >= 0 &&
-                                         father_index < size);
-  CGAL_point_set_processing_precondition(mother_index >= 0 &&
-                                           mother_index < size);
-
-  // 1, get neighbor information from the two "parent points"
-  Rich_point& new_v = rich_point_set[new_point_index];
-  Rich_point& father_v = rich_point_set[father_index];
-  Rich_point& mother_v = rich_point_set[mother_index];
-
-  std::set<int> neighbor_indexes;
-  std::vector<unsigned int>::iterator iter;
-  for (iter = father_v.neighbors.begin();
-       iter != father_v.neighbors.end();
-       ++iter)
-  {
-    neighbor_indexes.insert(*iter);
-  }
-
-  for (iter = mother_v.neighbors.begin();
-       iter != mother_v.neighbors.end();
-       ++iter)
-  {
-    neighbor_indexes.insert(*iter);
-  }
-
-  neighbor_indexes.insert(father_v.index);
-  neighbor_indexes.insert(mother_v.index);
-
-  FT radius2 = radius * radius;
-
-  new_v.neighbors.clear();
-  std::set<int>::iterator set_iter;
-  for (set_iter = neighbor_indexes.begin(); 
-       set_iter != neighbor_indexes.end(); ++set_iter)
-  {
-    Rich_point& t = rich_point_set[*set_iter];
-    FT dist2 =  CGAL::squared_distance(new_v.pt, t.pt);
-
-    if (dist2 < radius2)
-    {
-      new_v.neighbors.push_back(t.index);
-    }
-  }
-
-  // 2, update position and normal by bilateral projection 
-  const unsigned int candidate_num = 2; // we have two normal candidates:
-                                        // we say father's is 0
-                                        //        mother's is 1
-  std::vector<Vector> normal_cadidate(candidate_num);
-  normal_cadidate[0] = father_v.normal;
-  normal_cadidate[1] = mother_v.normal;
-
-  std::vector<FT> project_dist_sum(candidate_num, FT(0.0));
-  std::vector<FT> weight_sum(candidate_num, FT(0.0));
-  std::vector<Vector> normal_sum(candidate_num, NULL_VECTOR);
-   
-  FT radius16 = FT(-4.0) / radius2;
-
-  for (unsigned int i = 0; i < new_v.neighbors.size(); ++i)
-  {
-    const Rich_point& t = rich_point_set[new_v.neighbors[i]];
-    FT dist2 = CGAL::squared_distance(new_v.pt, t.pt);
-    FT theta = std::exp(dist2 * radius16);
-
-    for (unsigned int j = 0; j < candidate_num; j++)
-    {
-      FT psi = std::exp(-std::pow(1 - normal_cadidate[j] * t.normal, 2)
-                       / sharpness_bandwidth);
-      FT project_diff_t_v = (t.pt - new_v.pt) * t.normal;
-      FT weight = psi * theta;
-
-      project_dist_sum[j] += project_diff_t_v * weight;
-      normal_sum[j] = normal_sum[j] + t.normal * weight;
-      weight_sum[j] += weight;
-    }
-  }
-
-  // select best candidate
-  FT min_project_dist = (std::numeric_limits<FT>::max)();
-  unsigned int best = 0;
-
-  for (unsigned int i = 0; i < candidate_num; ++i)
-  {
-    FT absolute_dist = CGAL::abs(project_dist_sum[i] / weight_sum[i]);
-    if (absolute_dist < min_project_dist)
-    {
-      min_project_dist = absolute_dist;
-      best = i;
-    }
-  }
-
-  // update position and normal
-  Vector update_normal = normal_sum[best] / weight_sum[best];
-  new_v.normal = update_normal / sqrt(update_normal.squared_length());
-
-  FT project_dist = project_dist_sum[best] / weight_sum[best];
-  new_v.pt = new_v.pt + new_v.normal * project_dist;
-
-
-  // 3, update neighbor information again
-  new_v.neighbors.clear();
-  for (set_iter = neighbor_indexes.begin(); 
-       set_iter != neighbor_indexes.end(); ++set_iter)
-  {
-    Rich_point& t = rich_point_set[*set_iter];
-    FT dist2 =  CGAL::squared_distance(new_v.pt, t.pt);
-
-    if (dist2 < radius2)
-    {
-      new_v.neighbors.push_back(t.index);
-      t.neighbors.push_back(new_v.index);
-    }
-  }
-}
-
-} /* namespace upsample_internal */
-
-/// \endcond
-
-// ----------------------------------------------------------------------------
-// Public section
-// ----------------------------------------------------------------------------
-
-/// \ingroup PkgPointSetProcessing
-/// This method progressively upsamples the point set while 
-/// approaching the edge singularities (detected by normal variation), which 
-/// generates a denser point set from an input point set. This has applications 
-/// in point-based rendering, hole filling, and sparse surface reconstruction. 
-/// Normals of points are required as input. For more details, please refer to \cgalCite{ear-2013}.
-/// 
-/// @tparam Concurrency_tag enables sequential versus parallel
-///                         versions of `compute_average_spacing()` (called internally).
-///                         Possible values are `Sequential_tag`
-///                         and `Parallel_tag`.
-/// @tparam OutputIterator Type of the output iterator. 
-///         The type of the objects put in it is 
-///         `std::pair<Kernel::Point_3, Kernel::Vector_3>`.
-///         Note that the user may use a 
-///         <A HREF="http://www.boost.org/libs/iterator/doc/function_output_iterator.html">function_output_iterator</A>
-///         to match specific needs.
-/// @tparam ForwardIterator iterator over input points.
-/// @tparam PointPMap is a model of `ReadablePropertyMap` 
-///         with the value type of `ForwardIterator` as key and `Kernel::Point_3` as value type.
-///         It can be omitted if the value type of `ForwardIterator` is convertible to 
-///         `Kernel::Point_3`.
-/// @tparam NormalPMap is a model of `ReadablePropertyMap` with the value type of `ForwardIterator` as key
-///         and `Kernel::Vector_3` as value type.
-/// @tparam Kernel Geometric traits class.
-///      It can be omitted and deduced automatically from the value type of  `PointPMap`
-///      using `Kernel_traits`.
-///
-
-// This variant requires all parameters.
-template <typename Concurrency_tag,
-	  typename OutputIterator,
-          typename ForwardIterator, 
-          typename PointPMap, 
-          typename NormalPMap,
-          typename Kernel>
-OutputIterator
-edge_aware_upsample_point_set(
-  ForwardIterator first,  ///< forward iterator on the first input point.
-  ForwardIterator beyond, ///< past-the-end iterator.
-  OutputIterator output,  ///< output iterator where output points and normals 
-                          ///< are put.
-  PointPMap point_pmap,   ///< point property map.
-  NormalPMap normal_pmap, ///< vector property map.
-  const typename Kernel::FT sharpness_angle,  ///< 
-                    ///< controls the preservation of sharp features. 
-                    ///< The larger the value is,
-                    ///< the smoother the result will be.
-                    ///< The range of possible values is `[0, 90]`.
-                    ///< See section \ref Point_set_processing_3Upsample_Parameter2
-                    ///< for an example.
-  typename Kernel::FT edge_sensitivity,  ///<  
-                    ///< larger values of edge-sensitivity give higher priority 
-                    ///< to inserting points along sharp features.
-                    ///< The range of possible values is `[0, 1]`.
-                    ///< See section \ref Point_set_processing_3Upsample_Parameter1
-                    ///< for an example.
-  typename Kernel::FT neighbor_radius, ///< 
-                    ///< indicates the radius of the largest hole that should be filled.
-                    ///< The default value is set to 3 times the average spacing of the point set.
-                    ///< If the value given by user is smaller than the average spacing, 
-                    ///< the function will use the default value instead.
-  const std::size_t number_of_output_points,///< number of output
-                                             ///< points to generate.
-  const Kernel& /*kernel*/ ///< geometric traits.
-)
-{
-  // basic geometric types
-  typedef typename Kernel::Point_3 Point;
-  typedef typename Kernel::Vector_3 Vector;
-  typedef typename Kernel::FT FT;
-  typedef typename rich_grid_internal::Rich_point<Kernel> Rich_point;
-
-  // preconditions
-  CGAL_point_set_processing_precondition(first != beyond);
-  CGAL_point_set_processing_precondition(sharpness_angle >= 0 
-                                       &&sharpness_angle <= 90);
-  CGAL_point_set_processing_precondition(edge_sensitivity >= 0 
-                                       &&edge_sensitivity <= 1);
-  CGAL_point_set_processing_precondition(neighbor_radius > 0);
-
-  edge_sensitivity *= 10;  // just project [0, 1] to [0, 10].
-
-  std::size_t number_of_input = std::distance(first, beyond);
-  CGAL_point_set_processing_precondition(number_of_output_points > number_of_input);
-
-
-  const unsigned int nb_neighbors = 6; // 1 ring
-  FT average_spacing = CGAL::compute_average_spacing<Concurrency_tag>(
-                   first, beyond,
-                   point_pmap,
-                   nb_neighbors);
-
-  if (neighbor_radius < average_spacing)
-  {
-    neighbor_radius = average_spacing * 3.0f;
-#ifdef CGAL_PSP3_VERBOSE
-    std::cout << "neighbor radius: " << neighbor_radius << std::endl;
-#endif
-  }
-  
-  Real_timer task_timer;
-
-  // copy rich point set
-  std::vector<Rich_point> rich_point_set(number_of_input);
-  CGAL::Bbox_3 bbox(0., 0., 0., 0., 0., 0.);
-  
-  ForwardIterator it = first; // point iterator
-  for(unsigned int i = 0; it != beyond; ++it, ++i)
-  {
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-    rich_point_set[i].pt = get(point_pmap, it);
-    rich_point_set[i].normal = get(normal_pmap, it);
-#else
-    rich_point_set[i].pt = get(point_pmap, *it);
-    rich_point_set[i].normal = get(normal_pmap, *it);
-#endif
-
-    rich_point_set[i].index = i;
-    bbox += rich_point_set[i].pt.bbox();
-    CGAL_point_set_processing_precondition(rich_point_set[i].normal.squared_length() > 1e-10);
-  }
-
-  // compute neighborhood
-  rich_grid_internal::compute_ball_neighbors_one_self(rich_point_set,
-                                                      bbox,
-                                                      neighbor_radius);
-
-  //
-  FT cos_sigma = static_cast<FT>(std::cos(CGAL::to_double(sharpness_angle) / 180.0 * CGAL_PI));
-  FT sharpness_bandwidth = std::pow((CGAL::max)((FT)1e-8, (FT)1.0 - cos_sigma), 2);
-
-  FT sum_density = 0.0;
-  unsigned int count_density = 1;
-  double max_iter_time = 20;
-  FT current_radius = neighbor_radius;
-  FT density_pass_threshold = 0.0;
-
-  for (unsigned int iter_time = 0; iter_time < max_iter_time; ++iter_time)
-  {
-  #ifdef CGAL_PSP3_VERBOSE
-     std::cout << std::endl << "iter_time: " << iter_time + 1  << std::endl;
-  #endif
-    if (iter_time > 0)
-    {
-      current_radius *= 0.75;
-      if (current_radius < density_pass_threshold * 3) //3 ring
-      {
-        current_radius = density_pass_threshold * 3;
-      }
-      rich_grid_internal::compute_ball_neighbors_one_self(rich_point_set,
-                                                          bbox,
-                                                          current_radius);
-    }
- #ifdef CGAL_PSP3_VERBOSE
-    std::cout << "current radius: " << current_radius << std::endl; 
- #endif
-
-    std::size_t current_size = rich_point_set.size();
-    std::vector<bool> is_pass_threshold(current_size, false);
-
-    if (iter_time == 0)
-    {
-      //estimate density threshold for the first time
-      for (unsigned int i = 0; i < rich_point_set.size() * 0.05; ++i)
-      {
-        const Rich_point& v = rich_point_set[i];
-
-        if (v.neighbors.empty())
-          continue;
-
-        // extract neighbor rich points by index
-        std::vector<Rich_point> neighbor_rich_points(v.neighbors.size());
-        for (unsigned int n = 0; n < v.neighbors.size(); n++)
-        {
-          neighbor_rich_points[n] = rich_point_set[v.neighbors[n]];
-        }
-
-        unsigned int base_index = 0;
-        FT density2 = upsample_internal::
-                              base_point_selection(v,
-                                                   neighbor_rich_points,
-                                                   edge_sensitivity,
-                                                   base_index);
-
-        if (density2 < 0)
-        {
-          continue;
-        }
-
-        sum_density += density2;
-        count_density++;
-      }
-    }
-
-    density_pass_threshold = static_cast<FT>(sqrt(sum_density / count_density) * FT(0.65));
-    sum_density = 0.;
-    count_density = 1;
-
-    FT density_pass_threshold2 = density_pass_threshold * 
-                                 density_pass_threshold;
- #ifdef CGAL_PSP3_VERBOSE
-    std::cout << "pass_threshold:  " << density_pass_threshold << std::endl;
- #endif
-    // insert new points until all the points' density pass the threshold
-    unsigned int max_loop_time = 3;
-    unsigned int loop = 0;
-    while (true)
-    {
-   #ifdef CGAL_PSP3_VERBOSE
-      std::cout << "loop_time: " << loop + 1 << std::endl;
-   #endif
-      unsigned int count_not_pass = 0;
-      loop++;
-      for (unsigned int i = 0; i < rich_point_set.size(); ++i)
-      {
-        if (is_pass_threshold[i])
-        {
-          continue;
-        }
-
-        const Rich_point& v = rich_point_set[i];
-
-        if (v.neighbors.empty())
-          continue;
-
-        // extract neighbor rich points by index
-        std::vector<Rich_point> neighbor_rich_points(v.neighbors.size());
-        for (unsigned int n = 0; n < v.neighbors.size(); ++n)
-        {
-          neighbor_rich_points[n] = rich_point_set[v.neighbors[n]];
-        }
-
-        // select base point 
-        unsigned int base_index = 0;
-        FT density2 = upsample_internal::
-                              base_point_selection(v,
-                                                   neighbor_rich_points,
-                                                   edge_sensitivity,
-                                                   base_index);
-
-        // test if it pass the density threshold
-        if (density2 < density_pass_threshold2)
-        {
-          is_pass_threshold[i] = true;
-          continue;
-        }
-        count_not_pass++;
-
-        sum_density += density2;
-        count_density++;
-
-        // insert a new rich point
-        unsigned int father_index = v.index;
-        unsigned int mother_index = base_index;
-
-        Rich_point new_v;
-        Rich_point& base = rich_point_set[mother_index];
-        Vector diff_v_base = base.pt - v.pt;
-        new_v.pt = v.pt + (diff_v_base * FT(0.5));
-        new_v.index = static_cast<unsigned int>(rich_point_set.size());
-
-        unsigned int new_point_index = new_v.index;
-        rich_point_set.push_back(new_v);
-        is_pass_threshold.push_back(false);
-
-        //update new rich point
-        upsample_internal::update_new_point(new_point_index, 
-                                            father_index, 
-                                            mother_index, 
-                                            rich_point_set, 
-                                            current_radius,
-                                            sharpness_bandwidth);
-
-        if (rich_point_set.size() >= number_of_output_points)
-        {
-          break;
-        }
-      }
-   #ifdef CGAL_PSP3_VERBOSE
-      std::cout << "current size: " << rich_point_set.size() << std::endl;
-   #endif
-      if (count_not_pass == 0 || 
-          loop >= max_loop_time || 
-          rich_point_set.size() >= number_of_output_points)
-      {
-        break;
-      }
-
-    }
-
-    if (rich_point_set.size() >= number_of_output_points)
-    {
-      break;
-    }
-  }
-
-  for (std::size_t i = number_of_input; i < rich_point_set.size(); ++i)
-  {
-    const Rich_point& v = rich_point_set[i];
-    Point point = v.pt;
-    Vector normal = v.normal;
-    *output++ = std::make_pair(point, normal);
-  }
- 
-  return output;
-}
-
-
-/// @cond SKIP_IN_MANUAL
-// This variant deduces the kernel from the point property map.
-template <typename Concurrency_tag,
-	  typename OutputIterator,
-          typename ForwardIterator,
-          typename PointPMap,
-          typename NormalPMap>
-OutputIterator
-edge_aware_upsample_point_set(
-  ForwardIterator first,    ///< forward iterator to the first input point.
-  ForwardIterator beyond,   ///< past-the-end iterator.
-  OutputIterator output, ///< output iterator over points.
-  PointPMap point_pmap, ///< property map: `ForwardIterator` -> Point_3.
-  NormalPMap normal_pmap, ///< property map: `ForwardIterator` -> Vector_3.
-  double sharpness_angle,  ///< control sharpness(0-90)
-  double edge_sensitivity,  ///< edge sensitivity(0-5)
-  double neighbor_radius, ///< initial size of neighbors.
-  const std::size_t number_of_output_points///< number of iterations.   
-  )
-{
-  typedef typename boost::property_traits<PointPMap>::value_type Point;
-  typedef typename Kernel_traits<Point>::Kernel Kernel;
-  typedef typename Kernel::FT FT;
-  return edge_aware_upsample_point_set<Concurrency_tag>(
-    first, beyond,
-    output,
-    point_pmap,
-    normal_pmap,
-    static_cast<FT>(sharpness_angle), 
-    static_cast<FT>(edge_sensitivity),
-    static_cast<FT>(neighbor_radius), 
-    number_of_output_points,
-    Kernel());
-}
-/// @endcond
-
-
-/// @cond SKIP_IN_MANUAL
-template <typename Concurrency_tag,
-	  typename OutputIterator,
-          typename ForwardIterator,
-          typename NormalPMap>
-OutputIterator
-edge_aware_upsample_point_set(
-  ForwardIterator first, ///< iterator over the first input point
-  ForwardIterator beyond, ///< past-the-end iterator
-  OutputIterator output, ///< output iterator over points.
-  NormalPMap normal_pmap, ///< property map:  OutputIterator -> Vector_3.
-  double sharpness_angle = 30,  ///< control sharpness(0-90)
-  double edge_sensitivity = 1,  ///< edge sensitivity(0-5)
-  double neighbor_radius = -1, ///< initial size of neighbors.
-  const std::size_t number_of_output_points = 1000///< number of output points.     
-  )
-{
-  // just deduce value_type of OutputIterator
-  return edge_aware_upsample_point_set
-    <Concurrency_tag, typename value_type_traits<OutputIterator>::type>(
-    first, beyond,
-    output,
-    normal_pmap,
-    sharpness_angle, 
-    edge_sensitivity,
-    neighbor_radius, 
-    number_of_output_points);
-}
-/// @endcond
-
-} //namespace CGAL
-
-#endif // CGAL_UPSAMPLE_POINT_SET_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/extract_mean_curvature_flow_skeleton.h b/3rdparty/CGAL-4.8/include/CGAL/extract_mean_curvature_flow_skeleton.h
deleted file mode 100644
index b0d6e34..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/extract_mean_curvature_flow_skeleton.h
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright (c) 2014  GeometryFactory (France). All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Sebastien Loriot
-//
-
-#ifndef CGAL_EXTRACT_MEAN_CURVATURE_FLOW_SKELETON_H
-#define CGAL_EXTRACT_MEAN_CURVATURE_FLOW_SKELETON_H
-
-#include <CGAL/Polyhedron_3.h>
-#include <CGAL/Polyhedron_items_with_id_3.h>
-#include <CGAL/FaceGraph_to_Polyhedron_3.h>
-#ifdef CGAL_EIGEN3_ENABLED
-#include <CGAL/Eigen_solver_traits.h>  // for sparse linear system solver
-#endif
-
-#include <CGAL/Mean_curvature_flow_skeletonization.h>
-
-namespace CGAL{
-
-#if defined(DOXYGEN_RUNNING) || defined(CGAL_EIGEN3_ENABLED)
-/// \ingroup PkgMeanCurvatureSkeleton3
-/// @brief extracts a medially centered curve skeleton for the triangle mesh `tmesh`.
-/// This function uses the class CGAL::Mean_curvature_flow_skeletonization with the default parameters.
-/// This function is provided only if \ref thirdpartyEigen "Eigen" 3.2 (or greater) is available and `CGAL_EIGEN3_ENABLED` is defined.
-/// @pre `tmesh` is a triangle mesh without borders and having exactly one connected component.
-/// @pre The specialization `boost::property_map<TriangleMesh, CGAL::vertex_point_t>::%type` and `get(vertex_point, tmesh)` are defined.
-/// @pre The value type of `boost::property_map<TriangleMesh, CGAL::vertex_point_t>::%type` is a point type from a \cgal Kernel.
-///
-/// @tparam TriangleMesh
-///         a model of `FaceListGraph`
-///
-/// @param tmesh
-///        input mesh
-/// @param skeleton
-///        graph that will contain the skeleton of `tmesh`.
-///        For each vertex descriptor `vd` of `skeleton`, the corresponding point
-///        and the set of input vertices that contracted to `vd` can be retrieved
-///        using `skeleton[vd].point` and `skeleton[vd].vertices` respectively.
-///
-template <class TriangleMesh>
-void extract_mean_curvature_flow_skeleton(const TriangleMesh& tmesh,
-                                          typename Mean_curvature_flow_skeletonization<TriangleMesh>::Skeleton& skeleton)
-{
-  // extract the skeleton
-  typedef CGAL::Mean_curvature_flow_skeletonization<TriangleMesh> Mcfskel;
-  Mcfskel mcfs(tmesh);
-  mcfs(skeleton);
-}
-#endif
-
-}// end of namespace CGAL
-
-#endif //CGAL_EXTRACT_MEAN_CURVATURE_FLOW_SKELETON_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/grid_simplify_point_set.h b/3rdparty/CGAL-4.8/include/CGAL/grid_simplify_point_set.h
deleted file mode 100644
index c87ab9a..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/grid_simplify_point_set.h
+++ /dev/null
@@ -1,235 +0,0 @@
-// Copyright (c) 2007-09  INRIA Sophia-Antipolis (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
-// 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(s) : Nader Salman and Laurent Saboret 
-
-#ifndef CGAL_GRID_SIMPLIFY_POINT_SET_H
-#define CGAL_GRID_SIMPLIFY_POINT_SET_H
-
-#include <CGAL/property_map.h>
-#include <CGAL/Kernel_traits.h>
-#include <CGAL/point_set_processing_assertions.h>
-
-#include <iterator>
-#include <set>
-#include <deque>
-#include <algorithm>
-#include <cmath>
-
-namespace CGAL {
-
-
-// ----------------------------------------------------------------------------
-// Private section
-// ----------------------------------------------------------------------------
-/// \cond SKIP_IN_MANUAL
-
-namespace internal {
-
-
-/// Utility class for grid_simplify_point_set():
-/// Less_epsilon_points_3 defines a 3D points order / 2 points are equal
-/// iff they belong to the same cell of a grid of cell size = epsilon.
-template <class Point_3, class PointPMap>
-struct Less_epsilon_points_3
-{
-private:
-
-    double m_epsilon;
-    PointPMap point_pmap;
-    
-public:
-
-    Less_epsilon_points_3 (double epsilon, PointPMap p_pmap) 
-        : m_epsilon (epsilon), point_pmap(p_pmap)
-    {
-        CGAL_point_set_processing_precondition(epsilon > 0);
-    }
-
-    bool operator() (const Point_3& a, const Point_3& b) const
-    {
-        typedef typename boost::property_traits<PointPMap>::value_type Point;
-        
-        // Round points to multiples of m_epsilon, then compare.
-    #ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-        Point a_n = get(point_pmap,&a);
-        Point b_n = get(point_pmap,&b);
-    #else
-        Point a_n = get(point_pmap,a);
-        Point b_n = get(point_pmap,b);
-    #endif
-        
-        Point rounded_a(round_epsilon(a_n.x(), m_epsilon),
-                        round_epsilon(a_n.y(), m_epsilon),
-                        round_epsilon(a_n.z(), m_epsilon));
-        Point rounded_b(round_epsilon(b_n.x(), m_epsilon),
-                        round_epsilon(b_n.y(), m_epsilon),
-                        round_epsilon(b_n.z(), m_epsilon));
-                        
-        return (rounded_a < rounded_b);
-    }
-
-private:
-
-    // Round number to multiples of epsilon
-    static inline double round_epsilon(double value, double epsilon)
-    {
-        return std::floor(value/epsilon) * epsilon;
-    }
-};
-
-
-
-} /* namespace internal */
-
-
-// ----------------------------------------------------------------------------
-// Public section
-// ----------------------------------------------------------------------------
-
-
-/// Utility class for grid_simplify_point_set():
-/// 3D points set which allows at most 1 point per cell
-/// of a grid of cell size = epsilon.
-///
-/// Warning:
-/// This class is a container sorted wrt points position
-/// => you should not modify directly the order or the position of points.
-
-template <class Point_3, class PointPMap>
-class Epsilon_point_set_3
-  : public std::set<Point_3, internal::Less_epsilon_points_3<Point_3, PointPMap> >
-{
-private:
-
-    // superclass
-    typedef std::set<Point_3, internal::Less_epsilon_points_3<Point_3, PointPMap> > Base;
-
-public:
-
-    Epsilon_point_set_3 (double epsilon, PointPMap point_pmap)
-        : Base( internal::Less_epsilon_points_3<Point_3, PointPMap>(epsilon, point_pmap) )
-    {
-        CGAL_point_set_processing_precondition(epsilon > 0);
-    }
-
-    // default copy constructor, operator =() and destructor are fine.
-};
-
-/// \endcond
-
-/// \ingroup PkgPointSetProcessing
-/// Merges points which belong to the same cell of a grid of cell size = `epsilon`.
-///
-/// This method modifies the order of input points so as to pack all remaining points first,
-/// and returns an iterator over the first point to remove (see erase-remove idiom).
-/// For this reason it should not be called on sorted containers.
-///
-/// \pre `epsilon > 0`
-///
-/// @tparam ForwardIterator iterator over input points.
-/// @tparam PointPMap is a model of `ReadablePropertyMap` with value type `Point_3<Kernel>`.
-///        It can be omitted if the value type of `ForwardIterator` is convertible to `Point_3<Kernel>`.
-/// @tparam Kernel Geometric traits class.
-///        It can be omitted and deduced automatically from the value type of `PointPMap`.
-///
-/// @return iterator over the first point to remove.
-
-// This variant requires all parameters.
-template <typename ForwardIterator,
-          typename PointPMap,
-          typename Kernel>
-ForwardIterator grid_simplify_point_set(
-  ForwardIterator first,  ///< iterator over the first input point.
-  ForwardIterator beyond, ///< past-the-end iterator over the input points.
-  PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3
-  double epsilon, ///< tolerance value when merging 3D points.
-  const Kernel& /*kernel*/) ///< geometric traits.
-{
-  // actual type of input points
-  typedef typename std::iterator_traits<ForwardIterator>::value_type Enriched_point;
-
-  CGAL_point_set_processing_precondition(epsilon > 0);
-
-  // Merges points which belong to the same cell of a grid of cell size = epsilon.
-  // points_to_keep[] will contain 1 point per cell; the others will be in points_to_remove[].
-  Epsilon_point_set_3<Enriched_point, PointPMap> points_to_keep(epsilon, point_pmap);
-  std::deque<Enriched_point> points_to_remove;
-  for (ForwardIterator it=first ; it != beyond ; it++)
-  {
-      std::pair<typename Epsilon_point_set_3<Enriched_point, PointPMap>::iterator,bool> result;
-      result = points_to_keep.insert(*it);
-      if (!result.second) // if not inserted
-        points_to_remove.push_back(*it);
-  }
-
-  // Replaces `[first, beyond)` range by the content of points_to_keep, then points_to_remove.
-  ForwardIterator first_point_to_remove =
-    std::copy(points_to_keep.begin(), points_to_keep.end(), first);
-    std::copy(points_to_remove.begin(), points_to_remove.end(), first_point_to_remove);
-
-  return first_point_to_remove;
-}
-
-/// @cond SKIP_IN_MANUAL
-// This variant deduces the kernel from the iterator type.
-template <typename ForwardIterator,
-          typename PointPMap
->
-ForwardIterator
-grid_simplify_point_set(
-  ForwardIterator first, ///< iterator over the first input point
-  ForwardIterator beyond, ///< past-the-end iterator
-  PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3
-  double epsilon) ///< tolerance value when merging 3D points
-{
-  typedef typename boost::property_traits<PointPMap>::value_type Point;
-  typedef typename Kernel_traits<Point>::Kernel Kernel;
-  return grid_simplify_point_set(
-    first,beyond,
-    point_pmap,
-    epsilon,
-    Kernel());
-}
-/// @endcond
-
-/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Identity_property_map.
-template <typename ForwardIterator
->
-ForwardIterator
-grid_simplify_point_set(
-  ForwardIterator first, ///< iterator over the first input point
-  ForwardIterator beyond, ///< past-the-end iterator
-  double epsilon) ///< tolerance value when merging 3D points
-{
-  return grid_simplify_point_set(
-    first,beyond,
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-    make_dereference_property_map(first),
-#else
-    make_identity_property_map(
-    typename std::iterator_traits<ForwardIterator>::value_type()),
-#endif
-    epsilon);
-}
-/// @endcond
-
-
-} //namespace CGAL
-
-#endif // CGAL_GRID_SIMPLIFY_POINT_SET_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/hierarchy_simplify_point_set.h b/3rdparty/CGAL-4.8/include/CGAL/hierarchy_simplify_point_set.h
deleted file mode 100644
index a2090f5..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/hierarchy_simplify_point_set.h
+++ /dev/null
@@ -1,385 +0,0 @@
-// Copyright (c) 2012  INRIA Sophia-Antipolis (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
-// 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(s) : Simon Giraudot, Pierre Alliez
-
-
-#ifndef HIERARCHY_SIMPLIFY_POINT_SET_H
-#define HIERARCHY_SIMPLIFY_POINT_SET_H
-
-#include <cmath>
-#include <stack>
-
-#include <CGAL/property_map.h>
-#include <CGAL/basic.h>
-#include <CGAL/Dimension.h>
-#include <CGAL/Object.h>
-#include <CGAL/centroid.h>
-#include <CGAL/point_set_processing_assertions.h>
-#include <CGAL/Default_diagonalize_traits.h>
-#include <CGAL/PCA_util.h>
-
-namespace CGAL {
-
-
-  namespace internal {
-
-    template < typename InputIterator,
-	       typename PointPMap,
-	       typename K >
-    typename K::Point_3
-    hsps_centroid(InputIterator begin, 
-		 InputIterator end,
-		 PointPMap& point_pmap,	     
-		 const K&)
-    {
-      typedef typename K::Point_3 Point;
-      typedef typename K::FT FT;
-
-      CGAL_precondition(begin != end);
-
-      FT x = (FT)0., y = (FT)0., z = (FT)0.;
-      unsigned int nb_pts = 0;
-      while(begin != end) 
-	{
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-	  const Point& point = get(point_pmap, begin);
-#else
-	  const Point& point = get(point_pmap, *begin);
-#endif
-	  x += point.x ();  y += point.y ();  z += point.z ();
-	  ++ nb_pts;
-	  ++ begin;
-	}
-      return Point (x/nb_pts, y/nb_pts, z/nb_pts);
-    }
-
-    template < typename Input_type,
-	       typename PointPMap,
-	       typename K >
-    void
-    hsc_terminate_cluster (std::list<Input_type>& cluster,
-			   std::list<Input_type>& points_to_keep,
-			   std::list<Input_type>& points_to_remove,
-			   PointPMap& point_pmap,
-			   const typename K::Point_3& centroid,
-			   const K&)
-    {
-      typedef typename std::list<Input_type>::iterator Iterator;
-      typedef typename K::FT FT;
-      typedef typename K::Point_3 Point;
-
-      FT dist_min = (std::numeric_limits<FT>::max)();
-
-      typename std::list<Input_type>::iterator point_min;
-      for (Iterator it = cluster.begin (); it != cluster.end (); ++ it)
-	{
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-	  const Point& point = get(point_pmap, it);
-#else
-	  const Point& point = get(point_pmap, *it);
-#endif
-	  FT dist = CGAL::squared_distance (point, centroid);
-	  if (dist < dist_min)
-	    {
-	      dist_min = dist;
-	      point_min = it;
-	    }
-	}
-
-      points_to_keep.splice (points_to_keep.end (), cluster, point_min);
-      points_to_remove.splice (points_to_remove.end (), cluster, cluster.begin (), cluster.end ());
-    }			       
-			    
-
-
-
-  } // namespace internal
-    
-
-  /// \ingroup PkgPointSetProcessing
-  
-  /// Recursively split the point set in smaller clusters until the
-  /// clusters have less than `size` elements or until their variation
-  /// factor is below `var_max`. 
-  ///
-  /// This method modifies the order of input points so as to pack all remaining points first,
-  /// and returns an iterator over the first point to remove (see erase-remove idiom).
-  /// For this reason it should not be called on sorted containers.
-  ///
-  /// \pre `0 < var_max < 1/3`
-  /// \pre `size > 0`
-  ///
-  /// @tparam ForwardIterator iterator over input points.
-  /// @tparam PointPMap is a model of `ReadablePropertyMap` with value type `Point_3<Kernel>`.
-  ///        It can be omitted if the value type of `ForwardIterator` is convertible to `Point_3<Kernel>`.
-  /// @tparam DiagonalizeTraits is a model of `DiagonalizeTraits`. It
-  ///        can be omitted: if Eigen 3 (or greater) is available and
-  ///        `CGAL_EIGEN3_ENABLED` is defined then an overload using
-  ///        `Eigen_diagonalize_traits` is provided. Otherwise, the internal
-  ///        implementation `Internal_diagonalize_traits` is used.
-  /// @tparam Kernel Geometric traits class.
-  ///        It can be omitted and deduced automatically from the value type of `PointPMap`.
-  ///
-  /// @return iterator over the first point to remove.
-
-
-  // This variant requires all parameters.
-
-  template <typename ForwardIterator,
-	    typename PointPMap,
-	    typename DiagonalizeTraits,
-	    typename Kernel>
-  ForwardIterator hierarchy_simplify_point_set (ForwardIterator begin,
-						ForwardIterator end,
-						PointPMap point_pmap,
-						const unsigned int size,
-						const double var_max,
-						const DiagonalizeTraits&,
-						const Kernel&)
-  {
-    typedef typename std::iterator_traits<ForwardIterator>::value_type Input_type;
-    typedef typename Kernel::FT FT;
-    typedef typename Kernel::Point_3  Point;
-    typedef typename Kernel::Vector_3 Vector;
-
-    // We define a cluster as a point set + its centroid (useful for
-    // faster computations of centroids - to be implemented)
-    typedef std::pair< std::list<Input_type>, Point > cluster;
-
-    std::list<cluster> clusters_stack;
-    typedef typename std::list<cluster>::iterator cluster_iterator;
-
-    CGAL_precondition (begin != end);
-    CGAL_point_set_processing_precondition (size > 0);
-    CGAL_point_set_processing_precondition (var_max > 0.0);
-
-    // The first cluster is the whole input point set
-    clusters_stack.push_front (cluster (std::list<Input_type>(), Point (0., 0., 0.)));
-    std::copy (begin, end, std::back_inserter (clusters_stack.front ().first));
-    
-    clusters_stack.front ().second = internal::hsps_centroid (clusters_stack.front ().first.begin (),
-							     clusters_stack.front ().first.end (),
-							     point_pmap, Kernel());
-
-    std::list<Input_type> points_to_keep;
-    std::list<Input_type> points_to_remove;
-    
-    while (!(clusters_stack.empty ()))
-      {
-	cluster_iterator current_cluster = clusters_stack.begin ();
-
-	// If the cluster only has 1 element, we add it to the list of
-	// output points
-	if (current_cluster->first.size () == 1)
-	  {
-	    points_to_keep.splice (points_to_keep.end (), current_cluster->first,
-				   current_cluster->first.begin ());
-	    clusters_stack.pop_front ();
-	    continue;
-	  }
-
-	// Compute the covariance matrix of the set
-	cpp11::array<FT, 6> covariance = {{ 0., 0., 0., 0., 0., 0. }};
-
-	for (typename std::list<Input_type>::iterator it = current_cluster->first.begin ();
-	     it != current_cluster->first.end (); ++ it)
-	  {
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-	    const Point& point = get(point_pmap, it);
-#else
-	    const Point& point = get(point_pmap, *it);
-#endif
-	    Vector d = point - current_cluster->second;
-	    covariance[0] += d.x () * d.x ();
-	    covariance[1] += d.x () * d.y ();
-	    covariance[2] += d.x () * d.z ();
-	    covariance[3] += d.y () * d.y ();
-	    covariance[4] += d.y () * d.z ();
-	    covariance[5] += d.z () * d.z ();
-	  }
-
-	cpp11::array<FT, 3> eigenvalues = {{ 0., 0., 0. }};
-	cpp11::array<FT, 9> eigenvectors = {{ 0., 0., 0.,
-					      0., 0., 0.,
-					      0., 0., 0. }};
-	// Linear algebra = get eigenvalues and eigenvectors for
-	// PCA-like analysis
-	DiagonalizeTraits::diagonalize_selfadjoint_covariance_matrix
-	  (covariance, eigenvalues, eigenvectors);
-	
-	// Variation of the set defined as lambda_min / (lambda_0 + lambda_1 + lambda_2)
-	double var = eigenvalues[0] / (eigenvalues[0] + eigenvalues[1] + eigenvalues[2]);
-
-	// Split the set if size OR variance of the cluster is too large
-	if (current_cluster->first.size () > size || var > var_max)
-	  {
-	    clusters_stack.push_front (cluster (std::list<Input_type>(), Point (0., 0., 0.)));
-	    cluster_iterator negative_side = clusters_stack.begin ();
-	    // positive_side is built directly from current_cluster
-	    
-	    // The plane which splits the point set into 2 point sets:
-	    //  * Normal to the eigenvector with highest eigenvalue
-	    //  * Passes through the centroid of the set
-	    Vector v (eigenvectors[6], eigenvectors[7], eigenvectors[8]);
-
-	    std::size_t current_cluster_size = 0;
-	    typename std::list<Input_type>::iterator it = current_cluster->first.begin ();
-	    while (it != current_cluster->first.end ())
-	      {
-		typename std::list<Input_type>::iterator current = it ++;
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-                const Point& point = get(point_pmap, current);
-#else
-                const Point& point = get(point_pmap, *current);
-#endif
-
-		// Test if point is on negative side of plane and
-		// transfer it to the negative_side cluster if it is
-		if (Vector (current_cluster->second, point) * v < 0)
-		  negative_side->first.splice (negative_side->first.end (),
-					       current_cluster->first, current);
-		++ current_cluster_size;
-	      }
-
-	    // If one of the clusters is empty, stop to avoid infinite
-	    // loop and keep the non-empty one
-	    if (current_cluster->first.empty () || negative_side->first.empty ())
-	      {
-		cluster_iterator nonempty = (current_cluster->first.empty ()
-					     ? negative_side : current_cluster);
-
-		// Compute the centroid
-		nonempty->second = internal::hsps_centroid (nonempty->first.begin (),
-							    nonempty->first.end (),
-							    point_pmap, Kernel());
-		
-		internal::hsc_terminate_cluster (nonempty->first,
-						 points_to_keep,
-						 points_to_remove,
-						 point_pmap,
-						 nonempty->second,
-						 Kernel ());
-		clusters_stack.pop_front ();
-		clusters_stack.pop_front ();
-	      }
-	    else
-	      {
-		// Save old centroid for faster computation
-		Point old_centroid = current_cluster->second;
-		
-		// Compute the first centroid
-		current_cluster->second = internal::hsps_centroid (current_cluster->first.begin (),
-								   current_cluster->first.end (),
-								   point_pmap, Kernel());
-
-		// The second centroid can be computed with the first and
-		// the old ones :
-		// centroid_neg = (n_total * old_centroid - n_pos * first_centroid)
-		//                 / n_neg;
-		negative_side->second = Point ((current_cluster_size * old_centroid.x ()
-						- current_cluster->first.size () * current_cluster->second.x ())
-					       / negative_side->first.size (),
-					       (current_cluster_size * old_centroid.y ()
-						- current_cluster->first.size () * current_cluster->second.y ())
-					       / negative_side->first.size (),
-					       (current_cluster_size * old_centroid.z ()
-						- current_cluster->first.size () * current_cluster->second.z ())
-					       / negative_side->first.size ());
-	      }
-	  }
-	// If the size/variance are small enough, add the centroid as
-	// and output point
-	else
-	  {
-	    internal::hsc_terminate_cluster (current_cluster->first,
-					     points_to_keep,
-					     points_to_remove,
-					     point_pmap,
-					     current_cluster->second,
-					     Kernel ());
-	    clusters_stack.pop_front ();
-	  }
-      }
-    ForwardIterator first_point_to_remove =
-      std::copy (points_to_keep.begin(), points_to_keep.end(), begin);
-    std::copy (points_to_remove.begin(), points_to_remove.end(), first_point_to_remove);
-
-    return first_point_to_remove;
-
-  }
-  /// @endcond
-
-
-  /// @cond SKIP_IN_MANUAL
-  // This variant deduces the kernel from the iterator type.
-  template <typename ForwardIterator,
-	    typename PointPMap,
-	    typename DiagonalizeTraits>
-  ForwardIterator hierarchy_simplify_point_set (ForwardIterator begin,
-						ForwardIterator end,
-						PointPMap point_pmap,
-						const unsigned int size,
-						const double var_max,
-						const DiagonalizeTraits& diagonalize_traits)
-  {
-    typedef typename boost::property_traits<PointPMap>::value_type Point;
-    typedef typename Kernel_traits<Point>::Kernel Kernel;
-    return hierarchy_simplify_point_set (begin, end, point_pmap, size, var_max,
-					 diagonalize_traits, Kernel());
-  }
-  /// @endcond
-
-  /// @cond SKIP_IN_MANUAL  
-  // This variant uses default diagonalize traits
-  template <typename ForwardIterator,
-	    typename PointPMap >
-  ForwardIterator hierarchy_simplify_point_set (ForwardIterator begin,
-						ForwardIterator end,
-						PointPMap point_pmap,
-						const unsigned int size,
-						const double var_max)
-  {
-    typedef typename boost::property_traits<PointPMap>::value_type Point;
-    typedef typename Kernel_traits<Point>::Kernel Kernel;
-    return hierarchy_simplify_point_set (begin, end, point_pmap, size, var_max,
-					 Default_diagonalize_traits<double, 3> (), Kernel());
-  }
-  /// @endcond  
-
-  /// @cond SKIP_IN_MANUAL
-  // This variant creates a default point property map = Identity_property_map.
-  template <typename ForwardIterator >
-  ForwardIterator hierarchy_simplify_point_set (ForwardIterator begin,
-						ForwardIterator end,
-						const unsigned int size = 10,
-						const double var_max = 0.333)
-  {
-    return hierarchy_simplify_point_set
-      (begin, end,
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-       make_dereference_property_map(first),
-#else
-       make_identity_property_map (typename std::iterator_traits<ForwardIterator>::value_type()),
-#endif
-       size, var_max);
-  }
-  /// @endcond  
-
-} // namespace CGAL
-
-#endif // HIERARCHY_SIMPLIFY_POINT_SET_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/int.h b/3rdparty/CGAL-4.8/include/CGAL/int.h
deleted file mode 100644
index 0f36a7f..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/int.h
+++ /dev/null
@@ -1,292 +0,0 @@
-// Copyright (c) 1999,2007  
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved. 
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Stefan Schirra, Michael Hemmer
-
-
-#ifndef CGAL_INT_H
-#define CGAL_INT_H
-
-#include <CGAL/number_type_basic.h>
-#include <CGAL/Modular_traits.h>
-
-namespace CGAL {
-
-namespace INTERN_INT {
-    template< class Type >
-    class Is_square_per_double_conversion
-      : public std::binary_function< Type, Type&,
-                                bool > {
-      public:
-        bool operator()( const Type& x,
-                         Type& y ) const {
-          y = (Type) std::sqrt( (double)x );
-          return x == y * y;
-        }
-        bool operator()( const Type& x ) const {
-            Type y =
-                (Type) std::sqrt( (double)x );
-            return x == y * y;
-        }
-
-    };
-} // INTERN_INT
-
-// int
-template<> class Algebraic_structure_traits< int >
-  : public Algebraic_structure_traits_base< int, Euclidean_ring_tag > {
-
-  public:
-    typedef Tag_false            Is_exact;
-    typedef Tag_true             Is_numerical_sensitive;
-
-    typedef INTERN_AST::Div_per_operator< Type >  Div;
-    typedef INTERN_AST::Mod_per_operator< Type >  Mod;
-
-    typedef INTERN_INT::
-       Is_square_per_double_conversion< Type > Is_square;
-};
-
-template <> class Real_embeddable_traits< int >
-  : public INTERN_RET::Real_embeddable_traits_base< int , CGAL::Tag_true > {};
-
-/*! \ingroup CGAL_Modular_traits_spec
-  \brief Specialization of CGAL::Modular_traits for \c int.
-  
-  A model of concept ModularTraits, supports \c int. 
-*/
-  template <typename T>
-  class Modular_traits;
-
-template<>
-class Modular_traits<int>{
-public: 
-    typedef int NT;
-    typedef ::CGAL::Tag_true Is_modularizable;
-    typedef Residue Residue_type;
- 
-    struct Modular_image{
-        Residue_type operator()(int i){
-            return Residue_type(i);
-        }
-    };    
-    struct Modular_image_representative{
-        NT operator()(const Residue_type& x){
-            return x.get_value();
-        }
-    };    
-};
-
-// long
-
-template<> class Algebraic_structure_traits< long int >
-  : public Algebraic_structure_traits_base< long int,
-                                            Euclidean_ring_tag > {
-
-  public:
-    typedef Tag_false            Is_exact;
-    typedef Tag_true           Is_numerical_sensitive;
-
-    typedef INTERN_AST::Div_per_operator< Type >  Div;
-    typedef INTERN_AST::Mod_per_operator< Type >  Mod;
-
-    typedef INTERN_INT::
-       Is_square_per_double_conversion< Type > Is_square;
-};
-
-template <> class Real_embeddable_traits< long int >
-  : public INTERN_RET::Real_embeddable_traits_base< long int , CGAL::Tag_true > {
-public:
-
-    class To_interval
-      : public std::unary_function< Type, std::pair< double, double > > {
-      public:
-        std::pair<double, double> operator()( const Type& x ) const {
-          return Interval_nt<true>(x).pair();
-        }
-    };
-};
-
-
-/*! \ingroup CGAL_Modular_traits_spec
-  \brief Specialization of CGAL::Modular_traits for \c long.
-  
-  A model of concept ModularTraits, supports \c long. 
-*/
-template<>
-class Modular_traits<long>{
-public: 
-    typedef long NT;
-    typedef ::CGAL::Tag_true Is_modularizable;
-    typedef Residue Residue_type;
- 
-    struct Modular_image{
-        Residue_type operator()(long i){
-            return Residue_type(i);
-        }
-    };   
-    struct Modular_image_representative{
-        NT operator()(const Residue_type& x){
-            return NT(x.get_value());
-        }
-    };    
-};
-
-// short
-
-template<> class Algebraic_structure_traits< short int >
-  : public Algebraic_structure_traits_base< short int,
-                                            Euclidean_ring_tag > {
-
-  public:
-    typedef Tag_false            Is_exact;
-    typedef Tag_true             Is_numerical_sensitive;
-
-    // Explicitly defined functors which have no support for implicit
-    //  interoperability. This is nescessary because of the implicit conversion
-    //  to int for binary operations between short ints.
-    class Integral_division
-      : public std::binary_function< Type, Type,
-                                Type > {
-      public:
-        Type operator()( const Type& x,
-                                        const Type& y) const {
-          Algebraic_structure_traits<Type>::Div actual_div;
-          CGAL_precondition_msg( actual_div( x, y) * y == x,
-                  "'x' must be divisible by 'y' in "
-                  "Algebraic_structure_traits<...>::Integral_div()(x,y)" );
-          return actual_div( x, y);
-        }
-    };
-
-    class Gcd
-      : public std::binary_function< Type, Type,
-                                Type > {
-      public:
-        Type operator()( const Type& x,
-                                        const Type& y) const {
-          Algebraic_structure_traits<Type>::Mod mod;
-          Algebraic_structure_traits<Type>::Unit_part unit_part;
-          Algebraic_structure_traits<Type>::Integral_division integral_div;
-          // First: the extreme cases and negative sign corrections.
-          if (x == Type(0)) {
-              if (y == Type(0))
-                  return Type(0);
-              return integral_div( y, unit_part(y) );
-          }
-          if (y == Type(0))
-              return integral_div(x, unit_part(x) );
-          Type u = integral_div( x, unit_part(x) );
-          Type v = integral_div( y, unit_part(y) );
-          // Second: assuming mod is the most expensive op here, we don't compute it
-          // unnecessarily if u < v
-          if (u < v) {
-              v = mod(v,u);
-              // maintain invariant of v > 0 for the loop below
-              if ( v == Type(0) )
-                  return u;
-          }
-
-          Type w;
-          do {
-              w = mod(u,v);
-              if ( w == Type(0))
-                  return v;
-              u = mod(v,w);
-              if ( u == Type(0))
-                  return w;
-              v = mod(w,u);
-          } while (v != Type(0));
-          return u;
-        }
-    };
-
-    class Div_mod {
-      public:
-        typedef Type    first_argument_type;
-        typedef Type    second_argument_type;
-        typedef Type&   third_argument_type;
-        typedef Type&   fourth_argument_type;
-        typedef void  result_type;
-        void operator()( const Type& x,
-                         const Type& y,
-                         Type& q, Type& r) const {
-          q = x / y;
-          r = x % y;
-          return;
-        }
-    };
-
-    // based on \c Div_mod.
-    class Div
-      : public std::binary_function< Type, Type,
-                                Type > {
-      public:
-        Type operator()( const Type& x,
-                                        const Type& y) const {
-          return x / y;
-        };
-    };
-
-    // based on \c Div_mod.
-    class Mod
-      : public std::binary_function< Type, Type,
-                                Type > {
-      public:
-        Type operator()( const Type& x,
-                                        const Type& y) const {
-          return x % y;
-        };
-    };
-
-    typedef INTERN_INT::
-       Is_square_per_double_conversion< Type > Is_square;
-};
-
-template <> class Real_embeddable_traits< short int >
-  : public INTERN_RET::Real_embeddable_traits_base< short int , CGAL::Tag_true > {};
-
-// unsigned int
-
-template <> class Real_embeddable_traits< unsigned int >
-   : public INTERN_RET::Real_embeddable_traits_base< unsigned int , CGAL::Tag_true > {};
-
-// unsigned long
-
-template <> class Real_embeddable_traits< unsigned long >
-   : public INTERN_RET::Real_embeddable_traits_base< unsigned long , CGAL::Tag_true > {
-public:
-
-    class To_interval
-      : public std::unary_function< Type, std::pair< double, double > > {
-      public:
-        std::pair<double, double> operator()( const Type& x ) const {
-          return Interval_nt<true>(x).pair();
-        }
-    };
-};
-
-// Note : "long long" support is in <CGAL/long_long.h>
-
-} //namespace CGAL
-
-#endif // CGAL_INT_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/AABB_tree/AABB_node.h b/3rdparty/CGAL-4.8/include/CGAL/internal/AABB_tree/AABB_node.h
deleted file mode 100644
index dda29f4..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/internal/AABB_tree/AABB_node.h
+++ /dev/null
@@ -1,199 +0,0 @@
-// Copyright (c) 2008  INRIA Sophia-Antipolis (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
-// 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(s) : Camille Wormser, Pierre Alliez, Stephane Tayeb
-
-#ifndef CGAL_AABB_NODE_H
-#define CGAL_AABB_NODE_H
-
-#include <CGAL/Profile_counter.h>
-#include <CGAL/Cartesian_converter.h>
-#include <CGAL/intersections.h>
-#include <CGAL/Bbox_3.h>
-#include <vector>
-
-namespace CGAL {
-
-/**
- * @class AABB_node
- *
- *
- */
-template<typename AABBTraits>
-class AABB_node
-{
-public:
-  typedef typename AABBTraits::Bounding_box Bounding_box;
-
-  /// Constructor
-  AABB_node()
-    : m_bbox()
-    , m_p_left_child(NULL)
-    , m_p_right_child(NULL)      { };
-
-  /// Non virtual Destructor
-  /// Do not delete children because the tree hosts and delete them
-  ~AABB_node() { };
-
-  /// Returns the bounding box of the node
-  const Bounding_box& bbox() const { return m_bbox; }
-
-  /**
-   * @brief Builds the tree by recursive expansion.
-   * @param first the first primitive to insert
-   * @param last the last primitive to insert
-   * @param range the number of primitive of the range
-   *
-   * [first,last[ is the range of primitives to be added to the tree.
-   */
-  template<typename ConstPrimitiveIterator>
-  void expand(ConstPrimitiveIterator first,
-              ConstPrimitiveIterator beyond,
-              const std::size_t range,
-              const AABBTraits&);
-
-  /**
-   * @brief General traversal query
-   * @param query the query
-   * @param traits the traversal traits that define the traversal behaviour
-   * @param nb_primitives the number of primitive
-   *
-   * General traversal query. The traits class allows using it for the various
-   * traversal methods we need: listing, counting, detecting intersections,
-   * drawing the boxes.
-   */
-  template<class Traversal_traits, class Query>
-  void traversal(const Query& query,
-                 Traversal_traits& traits,
-                 const std::size_t nb_primitives) const;
-
-private:
-  typedef AABBTraits AABB_traits;
-  typedef AABB_node<AABB_traits> Node;
-  typedef typename AABB_traits::Primitive Primitive;
-
-  /// Helper functions
-  const Node& left_child() const
-                     { return *static_cast<Node*>(m_p_left_child); }
-  const Node& right_child() const
-                     { return *static_cast<Node*>(m_p_right_child); }
-  const Primitive& left_data() const
-                     { return *static_cast<Primitive*>(m_p_left_child); }
-  const Primitive& right_data() const
-                     { return *static_cast<Primitive*>(m_p_right_child); }
-
-  Node& left_child() { return *static_cast<Node*>(m_p_left_child); }
-  Node& right_child() { return *static_cast<Node*>(m_p_right_child); }
-  Primitive& left_data() { return *static_cast<Primitive*>(m_p_left_child); }
-  Primitive& right_data() { return *static_cast<Primitive*>(m_p_right_child); }
-
-private:
-  /// node bounding box
-  Bounding_box m_bbox;
-
-  /// children nodes, either pointing towards children (if children are not leaves),
-  /// or pointing toward input primitives (if children are leaves).
-  void *m_p_left_child;
-  void *m_p_right_child;
-
-private:
-  // Disabled copy constructor & assignment operator
-  typedef AABB_node<AABBTraits> Self;
-  AABB_node(const Self& src);
-  Self& operator=(const Self& src);
-
-};  // end class AABB_node
-
-
-template<typename Tr>
-template<typename ConstPrimitiveIterator>
-void
-AABB_node<Tr>::expand(ConstPrimitiveIterator first,
-                      ConstPrimitiveIterator beyond,
-                      const std::size_t range,
-                      const Tr& traits)
-{
-  m_bbox = traits.compute_bbox_object()(first, beyond);
-
-  // sort primitives along longest axis aabb
-  traits.sort_primitives_object()(first, beyond, m_bbox);
-
-  switch(range)
-  {
-  case 2:
-    m_p_left_child = &(*first);
-    m_p_right_child = &(*(++first));
-    break;
-  case 3:
-    m_p_left_child = &(*first);
-    m_p_right_child = static_cast<Node*>(this)+1;
-    right_child().expand(first+1, beyond, 2,traits);
-    break;
-  default:
-    const std::size_t new_range = range/2;
-    m_p_left_child = static_cast<Node*>(this) + 1;
-    m_p_right_child = static_cast<Node*>(this) + new_range;
-    left_child().expand(first, first + new_range, new_range,traits);
-    right_child().expand(first + new_range, beyond, range - new_range,traits);
-  }
-}
-
-
-template<typename Tr>
-template<class Traversal_traits, class Query>
-void
-AABB_node<Tr>::traversal(const Query& query,
-                         Traversal_traits& traits,
-                         const std::size_t nb_primitives) const
-{
-  // Recursive traversal
-  switch(nb_primitives)
-  {
-  case 2:
-    traits.intersection(query, left_data());
-    if( traits.go_further() )
-    {
-      traits.intersection(query, right_data());
-    }
-    break;
-  case 3:
-    traits.intersection(query, left_data());
-    if( traits.go_further() && traits.do_intersect(query, right_child()) )
-    {
-      right_child().traversal(query, traits, 2);
-    }
-    break;
-  default:
-    if( traits.do_intersect(query, left_child()) )
-    {
-      left_child().traversal(query, traits, nb_primitives/2);
-      if( traits.go_further() && traits.do_intersect(query, right_child()) )
-      {
-        right_child().traversal(query, traits, nb_primitives-nb_primitives/2);
-      }
-    }
-    else if( traits.do_intersect(query, right_child()) )
-    {
-      right_child().traversal(query, traits, nb_primitives-nb_primitives/2);
-    }
-  }
-}
-
-} // end namespace CGAL
-
-#endif // CGAL_AABB_NODE_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/AABB_tree/Halfedge_and_face_graph_property_maps.h b/3rdparty/CGAL-4.8/include/CGAL/internal/AABB_tree/Halfedge_and_face_graph_property_maps.h
deleted file mode 100644
index 4b9a8fc..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/internal/AABB_tree/Halfedge_and_face_graph_property_maps.h
+++ /dev/null
@@ -1,203 +0,0 @@
-// Copyright (c) 2012 GeometryFactory (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Sebastien Loriot
-//
-
-#ifndef HALFEDGE_AND_FACE_GRAPH_PROPERTY_MAPS_H
-#define HALFEDGE_AND_FACE_GRAPH_PROPERTY_MAPS_H
-
-#include <CGAL/property_map.h>
-#include <CGAL/boost/graph/properties.h>
-#include <boost/type_traits/is_const.hpp>
-#include <boost/mpl/if.hpp>
-#include <boost/type_traits/remove_const.hpp>
-
-namespace CGAL{
-
-//property map
-template <class FaceGraph,
-           class VertexPointPMap >
-struct Triangle_from_face_descriptor_property_map{
-  typename boost::remove_const<FaceGraph>::type* m_graph;
-  VertexPointPMap m_vppm;
-
-  Triangle_from_face_descriptor_property_map() : m_graph(NULL)
-  {}
-
-  Triangle_from_face_descriptor_property_map(FaceGraph* g)
-    : m_graph( const_cast<typename boost::remove_const<FaceGraph>::type*>(g) ),
-      m_vppm( get(vertex_point, *m_graph) )
-  {}
-
-  Triangle_from_face_descriptor_property_map(FaceGraph* g,
-                                          VertexPointPMap vppm )
-    : m_graph(const_cast<typename boost::remove_const<FaceGraph>::type*>(g)),
-      m_vppm(vppm)
-  {}
-
-  typedef typename boost::property_traits< VertexPointPMap >::value_type Point_3;
-  typedef typename Kernel_traits<Point_3>::Kernel::Triangle_3 Triangle_3;
- 
-  //classical typedefs
-  typedef typename boost::graph_traits<FaceGraph>::face_descriptor key_type;
-  typedef Triangle_3 value_type;
-  typedef value_type reference;
-  typedef boost::readable_property_map_tag category;
-
-  //get function for property map
-  inline friend
-  Triangle_3
-  get(const Triangle_from_face_descriptor_property_map<FaceGraph,VertexPointPMap>& pmap,
-      typename Triangle_from_face_descriptor_property_map<FaceGraph,VertexPointPMap>::key_type f)
-  {
-    typedef typename boost::property_traits< VertexPointPMap >::value_type Point_3;
-    typedef typename Kernel_traits<Point_3>::Kernel::Triangle_3 Triangle_3;
-    typename boost::remove_const<FaceGraph>::type & g = *(pmap.m_graph);
-
-    CGAL_precondition(halfedge(f,g) == next(next(next(halfedge(f,g),g),g),g));
-    const Point_3& a = get(pmap.m_vppm, target(halfedge(f,g),g));
-    const Point_3& b = get(pmap.m_vppm, target(next(halfedge(f,g),g),g));
-    const Point_3& c = get(pmap.m_vppm,target(next(next(halfedge(f,g),g),g),g));
- 
-    return Triangle_3(a,b,c);
-  }
-};
-
-
-template < class HalfedgeGraph,
-           class VertexPointPMap >
-struct Segment_from_edge_descriptor_property_map{
-
-  Segment_from_edge_descriptor_property_map()  : m_graph(NULL)
-  {}
-
-Segment_from_edge_descriptor_property_map(HalfedgeGraph* g)
-  : m_graph( const_cast<typename boost::remove_const<HalfedgeGraph>::type*>(g) ),
-    m_vppm( get(vertex_point, *m_graph) )
-  {}
-
-  Segment_from_edge_descriptor_property_map(HalfedgeGraph* g,
-                                            VertexPointPMap vppm )
-    : m_graph( const_cast<typename boost::remove_const<HalfedgeGraph>::type*>(g) ),
-      m_vppm(vppm)
-  {}
-
-  //classical typedefs
-  typedef typename boost::property_traits< VertexPointPMap >::value_type Point;
-  typedef typename boost::graph_traits<HalfedgeGraph>::edge_descriptor key_type;
-  typedef typename Kernel_traits<Point>::Kernel::Segment_3 value_type;
-  typedef value_type reference;
-  typedef boost::readable_property_map_tag category;
-  //data
-  typename boost::remove_const<HalfedgeGraph>::type* m_graph;
-  VertexPointPMap m_vppm;
-
-  //get function for property map
-  inline friend
-  value_type
-  get(Segment_from_edge_descriptor_property_map<HalfedgeGraph,VertexPointPMap> pmap,
-      key_type h)
-  {
-    typedef typename boost::property_traits< VertexPointPMap >::value_type Point;
-    typedef typename Kernel_traits<Point>::Kernel::Segment_3 Segment_3;
-
-    return Segment_3(get(pmap.m_vppm, source(h, *pmap.m_graph) ),
-                     get(pmap.m_vppm, target(h, *pmap.m_graph) ) );
-  }
-};
-
-//property map to access a point from a facet handle
-template <class FaceGraph,
-          class VertexPointPMap>
-struct One_point_from_face_descriptor_property_map{
-  One_point_from_face_descriptor_property_map()  : m_graph(NULL)
-  {}
-
-  One_point_from_face_descriptor_property_map(FaceGraph* g)
-    : m_graph( const_cast<typename boost::remove_const<FaceGraph>::type*>(g) )
-    , m_vppm( get(vertex_point, *m_graph) )
-  {}
-
-  One_point_from_face_descriptor_property_map(FaceGraph* g, VertexPointPMap vppm )
-    : m_graph( const_cast<typename boost::remove_const<FaceGraph>::type*>(g) ),
-      m_vppm(vppm)
-  {}
-
-  typename boost::remove_const<FaceGraph>::type* m_graph;
-  VertexPointPMap m_vppm;
-
-  //classical typedefs
-  typedef typename boost::graph_traits<FaceGraph>::face_descriptor key_type;
-  typedef typename boost::property_traits< VertexPointPMap >::value_type value_type;
-  typedef typename boost::property_traits< VertexPointPMap >::reference reference;
-  typedef boost::lvalue_property_map_tag category;
-
-  //get function for property map
-  inline friend
-  reference
-  get(const One_point_from_face_descriptor_property_map<FaceGraph,VertexPointPMap>& m,
-      key_type f)
-  {
-    return get(m.m_vppm, target(halfedge(f, *m.m_graph), *m.m_graph));
-  }
-};
-
-//property map to access a point from an edge
-template < class HalfedgeGraph,
-           class VertexPointPMap >
-struct Source_point_from_edge_descriptor{
-  Source_point_from_edge_descriptor()  : m_graph(NULL)
-  {}
-
-  Source_point_from_edge_descriptor(HalfedgeGraph* g)
-    : m_graph( const_cast<typename boost::remove_const<HalfedgeGraph>::type*>(g) )
-    , m_vppm( get(vertex_point, *m_graph) )
-  {}
-
-  Source_point_from_edge_descriptor(
-    HalfedgeGraph* g,
-    VertexPointPMap vppm ) :
-  m_graph( const_cast<typename boost::remove_const<HalfedgeGraph>::type*>(g) ),
-  m_vppm(vppm)
-  {}
-
-  //classical typedefs
-  typedef typename boost::property_traits< VertexPointPMap >::value_type value_type;
-  typedef typename boost::property_traits< VertexPointPMap >::reference reference;
-  typedef typename boost::graph_traits<HalfedgeGraph>::edge_descriptor key_type;
-  typedef boost::readable_property_map_tag category;
-  //data
-  typename boost::remove_const<HalfedgeGraph>::type* m_graph;
-  VertexPointPMap m_vppm;
-
-  //get function for property map
-  inline friend
-  reference
-  get(Source_point_from_edge_descriptor<HalfedgeGraph,VertexPointPMap> pmap,
-      key_type h)
-  {
-    return  get(vertex_point,
-                       *pmap.m_graph,
-                       source(h, *pmap.m_graph) );
-  }
-};
-
-} //namespace CGAL
-
-#endif //HALFEDGE_AND_FACE_GRAPH_PROPERTY_MAPS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Combinatorial_map_group_functors.h b/3rdparty/CGAL-4.8/include/CGAL/internal/Combinatorial_map_group_functors.h
deleted file mode 100644
index 6c6b830..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/internal/Combinatorial_map_group_functors.h
+++ /dev/null
@@ -1,972 +0,0 @@
-// Copyright (c) 2010-2011 CNRS and LIRIS' Establishments (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Guillaume Damiand <guillaume.damiand at liris.cnrs.fr>
-//
-#ifndef CGAL_COMBINATORIAL_MAP_GROUP_FUNCTORS_H
-#define CGAL_COMBINATORIAL_MAP_GROUP_FUNCTORS_H
-
-#include <CGAL/Unique_hash_map.h>
-#include <CGAL/Combinatorial_map_functors.h>
-
-/* Definition of functors used to group/ungroup attributes (we need functors
- * as attributes are stored in tuple, thus all the access must be done at
- * compiling time). Some of these functors are used with
- * Foreach_enabled_attributes to iterate through all the non void attribs.
- * These functors used other functors defined in Combinatorial_map_functors.h
- *
- * Group_attribute_functor_of_dart<CMap> to group the <i>-attributes of two
- *    given darts (except for j-dim). Only the attributes of the two given
- *    darts are possibly modified.
- *
- * Group_attribute_functor_of_dart_run<CMap,i> same than
- *   Group_attribute_functor_of_dart<CMap>::run<i>, with i template argument
- *   given in the struct to enable specialization.
- *
- * Group_attribute_functor<CMap> to group the <i>-attributes of two
- *    given i-cells (except for j-adim). If one i-attribute is NULL, we set the
- *    darts of its i-cell to the second attribute. If both i-attributes are
- *    non NULL, we overide all the i-attribute of the second i-cell to the
- *    first i-attribute.
- *
- * Degroup_attribute_functor_run<CMap> to degroup one i-attributes in two
- *   (except for j-adim).
- *
- * Test_split_attribute_functor<CMap,i> to test if there is some i-attributes
- *   that are split after an operation. Modified darts are given in a
- *   std::deque.
- */
-namespace CGAL
-{
-namespace internal
-{
-// ************************************************************************
-/// Functor used for link_beta to update the i-attributes of
-/// dh2 on the attributes of dh1 dart, except if i=j.
-///    (j is the dimension of the beta modified between dh1 and dh2,
-///     so that after the modification we will have beta_j(dh1)==dh2)
-/// Only attributes of dh1 or dh2 can be modified. If one dart as its
-/// attribute equal to null, it takes the attributes of the second dart.
-/// If both attributes are non null, dh2 takes the attribute of dh1.
-template<typename CMap, unsigned int i, unsigned int j=CMap::dimension+1,
-         typename T=typename CMap::template Attribute_type<i>::type>
-struct Group_attribute_functor_of_dart_run
-{
-  /// Group the i-attribute of dh1 and dh2.
-  static void run(CMap* amap,
-                  typename CMap::Dart_handle dh1,
-                  typename CMap::Dart_handle dh2)
-  {
-    CGAL_static_assertion( 1<=i && i<=CMap::dimension );
-    CGAL_static_assertion( i!=j && (i!=1 || j!=0) );
-    CGAL_static_assertion_msg(CMap::Helper::template
-                              Dimension_index<i>::value>=0,
-                              "Group_attribute_functor_of_dart_run<i> but "
-                              "i-attributes are disabled");
-    typename CMap::template Attribute_handle<i>::type
-        a1=amap->template attribute<i>(dh1);
-    typename CMap::template Attribute_handle<i>::type
-        a2=amap->template attribute<i>(dh2);
-
-    // If the two attributes are equal, nothing to do.
-    if ( a1==a2 ) return;
-
-    if ( a1==CMap::null_handle ) amap->template set_dart_attribute<i>(dh1, a2);
-    else amap->template set_dart_attribute<i>(dh2, a1);
-  }
-};
-// Specialization for i=0 and 2<=j. We modify 0-attribute for beta_j j>=2.
-template<typename CMap, unsigned int j, typename T>
-struct Group_attribute_functor_of_dart_run<CMap, 0, j, T>
-{
-  static void run(CMap* amap,
-                  typename CMap::Dart_handle dh1,
-                  typename CMap::Dart_handle dh2)
-  {
-    CGAL_static_assertion(j!=0 && j!=1);
-    CGAL_static_assertion_msg(CMap::Helper::template
-                              Dimension_index<0>::value>=0,
-                              "Group_attribute_functor_of_dart_run<0> but "
-                              "0-attributes are disabled");
-    typename CMap::template Attribute_handle<0>::type
-        a1=CMap::null_handle, a2=CMap::null_handle;
-
-    // First extremity
-    typename CMap::Dart_handle od = amap->other_extremity(dh2);
-    if ( od!=amap->null_handle )
-    {
-      a1=amap->template attribute<0>(dh1);
-      a2=amap->template attribute<0>(od);
-
-      if ( a1==CMap::null_handle && a2!=CMap::null_handle )
-        amap->template set_dart_attribute<0>(dh1, a2);
-    }
-
-    // Second extremity
-    od = amap->other_extremity(dh1);
-    if ( od!=amap->null_handle )
-    {
-      a1=amap->template attribute<0>(od);
-      if ( a1!=CMap::null_handle )
-        amap->template set_dart_attribute<0>(dh2, a1);
-    }
-  }
-};
-// Specialization for i=0 and j=0. We modify 0-attribute for beta_0.
-template<typename CMap, typename T>
-struct Group_attribute_functor_of_dart_run<CMap, 0, 0, T>
-{
-  static void run(CMap* amap,
-                  typename CMap::Dart_handle dh1,
-                  typename CMap::Dart_handle dh2)
-  {
-    CGAL_static_assertion_msg(CMap::Helper::template
-                              Dimension_index<0>::value>=0,
-                              "Group_attribute_functor_of_dart_run<0> but "
-                              "0-attributes are disabled");
-    typename CMap::Dart_handle od = amap->other_extremity(dh2);
-    if ( od!=amap->null_handle )
-    {
-      typename CMap::template Attribute_handle<0>::type
-          a1=amap->template attribute<0>(dh1);
-      typename CMap::template Attribute_handle<0>::type
-          a2=amap->template attribute<0>(od);
-
-      if ( a1==CMap::null_handle && a2!=CMap::null_handle )
-        amap->template set_dart_attribute<0>(dh1, a2);
-    }
-  }
-};
-// Specialization for i=0 and j=1. We modify 0-attribute for beta_1.
-template<typename CMap, typename T>
-struct Group_attribute_functor_of_dart_run<CMap, 0, 1, T>
-{
-  static void run(CMap* amap,
-                  typename CMap::Dart_handle dh1,
-                  typename CMap::Dart_handle dh2)
-  {
-    CGAL_static_assertion_msg(CMap::Helper::template
-                              Dimension_index<0>::value>=0,
-                              "Group_attribute_functor_of_dart_run<0> but "
-                              "0-attributes are disabled");
-    typename CMap::Dart_handle od = amap->other_extremity(dh1);
-    if ( od!=amap->null_handle )
-    {
-      typename CMap::template Attribute_handle<0>::type
-          a1=amap->template attribute<0>(od);
-
-      if ( a1!=CMap::null_handle )
-        amap->template set_dart_attribute<0>(dh2, a1);
-    }
-  }
-};
-// Specialization for void attributes.
-template<typename CMap, unsigned int i, unsigned int j>
-struct Group_attribute_functor_of_dart_run<CMap, i, j, CGAL::Void>
-{
-  static void run(CMap*,
-                  typename CMap::Dart_handle,
-                  typename CMap::Dart_handle)
-  {}
-};
-// Specialization for i=j. Do nothing as j is the dimension to not consider.
-template<typename CMap, unsigned int i, typename T>
-struct Group_attribute_functor_of_dart_run<CMap,i,i,T>
-{
-  static void run(CMap*,
-                  typename CMap::Dart_handle,
-                  typename CMap::Dart_handle)
-  {}
-};
-// Specialization for i=1 and j=0. Do nothing as edges attributes are not
-// modify when we modify beta_0.
-template<typename CMap, typename T>
-struct Group_attribute_functor_of_dart_run<CMap,1,0,T>
-{
-  static void run(CMap*,
-                  typename CMap::Dart_handle,
-                  typename CMap::Dart_handle)
-  {}
-};
-// ************************************************************************
-/// Functor used for link_beta to update the attributes of
-/// adart2 on the attributes of this dart, except for j-attributes.
-///    (j is the dimension of the beta modified between adart1 and adart2,
-///     so that after the modification we will have beta_j(adart1)==adart2)
-/// We define run<i> to allows to use this functor with
-/// Foreach_enabled_attributes.
-///   If you know i at compiling time, use directly
-///   Group_attribute_functor_of_dart_run.
-template<typename CMap, unsigned int j=CMap::dimension+1>
-struct Group_attribute_functor_of_dart
-{
-  template <unsigned int i>
-  static void run(CMap* amap,
-                  typename CMap::Dart_handle adart1,
-                  typename CMap::Dart_handle adart2)
-  {
-    CGAL::internal::Group_attribute_functor_of_dart_run<CMap,i,j>::
-        run(amap,adart1,adart2);
-  }
-};
-// ************************************************************************
-// Functor used to group the two i-attributes of the two i-cells, except
-// the attribute of j
-//    (j is the dimension of the beta modified between adart1 and adart2).
-template<typename CMap, unsigned int i, unsigned int j=CMap::dimension+1,
-         typename T=typename CMap::template Attribute_type<i>::type>
-struct Group_attribute_functor_run
-{
-  static void run(CMap* amap,
-                  typename CMap::Dart_handle adart1,
-                  typename CMap::Dart_handle adart2)
-  {
-    CGAL_static_assertion( 1<=i && i<=CMap::dimension );
-    CGAL_static_assertion( i!=j );
-    CGAL_static_assertion_msg
-        ( CMap::Helper::template Dimension_index<i>::value>=0,
-          "Group_attribute_functor_run<i> but i-attributes are disabled" );
-    typename CMap::template Attribute_handle<i>::type
-        a1=amap->template attribute<i>(adart1);
-    typename CMap::template Attribute_handle<i>::type
-        a2=amap->template attribute<i>(adart2);
-
-    // If the two attributes are equal, nothing to do.
-    if ( a1 == a2 ) return;
-
-    typename CMap::Dart_handle toSet = amap->null_handle;
-
-    // If the attribute associated to adart1 is NULL, set it with
-    // the attribute associated to adart2 (necessarily != NULL)
-    if (a1 == CMap::null_handle)
-    { toSet  = adart1; a1 = a2; }
-    else
-    {
-      toSet = adart2;
-      if (a2 != CMap::null_handle)
-      {
-        CGAL::internal::Call_merge_functor<CMap, i>::run(amap, a1, a2);
-      }
-    }
-    amap->template set_attribute<i>(toSet, a1);
-  }
-};
-// Specialization for i=0 and 2<=j. We update 0-attributes for beta_j j>=2.
-// We need to update both extremities of the edge dh1.
-template<typename CMap, unsigned int j, typename T>
-struct Group_attribute_functor_run<CMap, 0, j, T>
-{
-  static void run( CMap* amap,
-                   typename CMap::Dart_handle dh1,
-                   typename CMap::Dart_handle dh2 )
-  {
-    CGAL_static_assertion_msg
-        ( CMap::Helper::template Dimension_index<0>::value>=0,
-          "Group_attribute_functor_run<0> but 0-attributes are disabled" );
-    CGAL_static_assertion(j!=0 && j!=1);
-
-    typename CMap::template Attribute_handle<0>::type
-        a1=CMap::null_handle, a2=CMap::null_handle;
-    typename CMap::Dart_handle toSet=amap->null_handle;
-    // First extremity
-    typename CMap::Dart_handle od=amap->other_extremity(dh2);
-    if ( od!=amap->null_handle )
-    {
-      a1=amap->template attribute<0>(dh1);
-      a2=amap->template attribute<0>(od);
-      if ( a1!=a2 )
-      {
-        if ( a1==CMap::null_handle )
-        { toSet=dh1; a1=a2; }
-        else
-        {
-          toSet=od;
-          if ( a2!=CMap::null_handle )
-          {
-            CGAL::internal::Call_merge_functor<CMap, 0>::run(amap, a1, a2);
-          }
-        }
-        amap->template set_attribute<0>(toSet, a1);
-      }
-    }
-    // Second extremity
-    od = amap->other_extremity(dh1);
-    if ( od!=amap->null_handle )
-    {
-      a1=amap->template attribute<0>(od);
-      a2=amap->template attribute<0>(dh2);
-      if ( a1!=a2 )
-      {
-        if ( a1==CMap::null_handle )
-        { toSet=od; a1=a2; }
-        else
-        {
-          toSet=dh2;
-          if ( a2!=CMap::null_handle )
-          {
-            CGAL::internal::Call_merge_functor<CMap, 0>::run(amap, a1, a2);
-          }
-        }
-        amap->template set_attribute<0>(toSet, a1);
-      }
-    }
-  }
-};
-// Specialization for i=0 and j=0. We update 0-attributes for beta_0.
-// We need to update the first extremity of the edge dh1.
-template<typename CMap, typename T>
-struct Group_attribute_functor_run<CMap, 0, 0, T>
-{
-  static void run( CMap* amap,
-                   typename CMap::Dart_handle dh1,
-                   typename CMap::Dart_handle dh2 )
-  {
-    CGAL_static_assertion_msg
-        ( CMap::Helper::template Dimension_index<0>::value>=0,
-          "Group_attribute_functor_run<0> but 0-attributes are disabled" );
-    typename CMap::Dart_handle od=amap->other_extremity(dh2);
-    if ( od!=amap->null_handle )
-    {
-      typename CMap::Dart_handle toSet=amap->null_handle;
-      typename CMap::template Attribute_handle<0>::type
-          a1=amap->template attribute<0>(dh1);
-      typename CMap::template Attribute_handle<0>::type
-          a2=amap->template attribute<0>(od);
-      if ( a1!=a2 )
-      {
-        if ( a1==CMap::null_handle )
-        { toSet=dh1; a1=a2; }
-        else
-        {
-          toSet=od;
-          if ( a2!=CMap::null_handle )
-          {
-            CGAL::internal::Call_merge_functor<CMap, 0>::run(amap, a1, a2);
-          }
-        }
-        amap->template set_attribute<0>(toSet, a1);
-      }
-    }
-  }
-};
-// Specialization for i=0 and j=1. We update 0-attributes for beta_1.
-// We need to update the second extremity of the edge dh1.
-template<typename CMap, typename T>
-struct Group_attribute_functor_run<CMap, 0, 1, T>
-{
-  static void run( CMap* amap,
-                   typename CMap::Dart_handle dh1,
-                   typename CMap::Dart_handle dh2 )
-  {
-    CGAL_static_assertion_msg
-        ( CMap::Helper::template Dimension_index<0>::value>=0,
-          "Group_attribute_functor_run<0> but 0-attributes are disabled" );
-    typename CMap::Dart_handle od =amap->other_extremity(dh1);
-    if ( od!=amap->null_handle )
-    {
-      typename CMap::Dart_handle toSet=amap->null_handle;
-      typename CMap::template Attribute_handle<0>::type
-          a1=amap->template attribute<0>(od);
-      typename CMap::template Attribute_handle<0>::type
-          a2=amap->template attribute<0>(dh2);
-      if ( a1!=a2 )
-      {
-        if ( a1==CMap::null_handle )
-        { toSet=od; a1=a2; }
-        else
-        {
-          toSet=dh2;
-          if ( a2!=CMap::null_handle )
-          {
-            CGAL::internal::Call_merge_functor<CMap, 0>::run(amap, a1, a2);
-          }
-        }
-        amap->template set_attribute<0>(toSet, a1);
-      }
-    }
-  }
-};
-// Specialization for void attributes.
-template<typename CMap, unsigned int i, unsigned int j>
-struct Group_attribute_functor_run<CMap, i, j, CGAL::Void>
-{
-  static void run( CMap*,
-                   typename CMap::Dart_handle,
-                   typename CMap::Dart_handle )
-  {}
-};
-// Specialization for i=j. Do nothing as j is the dimension to not consider.
-template<typename CMap, unsigned int i, typename T>
-struct Group_attribute_functor_run<CMap,i,i,T>
-{
-  static void run(CMap*,
-                  typename CMap::Dart_handle,
-                  typename CMap::Dart_handle)
-  {}
-};
-// Specialization for i=1 and j=0. Do nothing as edges attributes are not
-// modify when we modify beta_0.
-template<typename CMap, typename T>
-struct Group_attribute_functor_run<CMap,1,0,T>
-{
-  static void run(CMap*,
-                  typename CMap::Dart_handle,
-                  typename CMap::Dart_handle)
-  {}
-};
-// ************************************************************************
-/// Functor used for sew to update the attributes of
-/// adart2 on the attributes of this dart, except for j-attributes.
-///    (j is the dimension of the beta modified between adart1 and adart2,
-///     so that after the modification we will have beta_j(adart1)==adart2)
-/// We define run<i> to allows to use this functor with
-/// Foreach_enabled_attributes.
-///   If you know i at compiling time, use directly
-///   Group_attribute_functor_run.
-template<typename CMap, unsigned int j=CMap::dimension+1>
-struct Group_attribute_functor
-{
-  template <unsigned int i>
-  static void run(CMap* amap,
-                  typename CMap::Dart_handle adart1,
-                  typename CMap::Dart_handle adart2)
-  { CGAL::internal::Group_attribute_functor_run<CMap,i,j>::
-        run(amap,adart1,adart2); }
-};
-// ************************************************************************
-// Functor used to degroup one i-attribute of one i-cell in two, except the
-// attribute of j.
-template<typename CMap, unsigned int i, unsigned int j=CMap::dimension+1,
-         typename T=typename CMap::template Attribute_type<i>::type>
-struct Degroup_attribute_functor_run
-{
-  static void run(CMap* amap,
-                  typename CMap::Dart_handle adart1,
-                  typename CMap::Dart_handle adart2)
-  {
-    CGAL_static_assertion( i<=CMap::dimension );
-    CGAL_static_assertion( i!=j );
-    CGAL_static_assertion_msg
-        ( CMap::Helper::template Dimension_index<i>::value>=0,
-          "Degroup_attribute_functor_run<i> but i-attributes are disabled" );
-
-    typename CMap::template Attribute_handle<i>::type
-        a1=amap->template attribute<i>(adart1);
-
-    // If there is no first attribute, nothing to degroup.
-    if ( a1==CMap::null_handle ) return;
-
-    // If the second attribute is non null and already different from a1,
-    // nothing to do.
-    if ( a1!=amap->template attribute<i>(adart2) &&
-         amap->template attribute<i>(adart2)!=CMap::null_handle ) return;
-
-    CGAL_assertion( (!CGAL::belong_to_same_cell<CMap,i>
-                     (*amap, adart1, adart2)) );
-
-    // As we split, we set the dart of the first attribute to adart1 for which
-    // we are sure it belongs to the first i-cell.
-    amap->template get_attribute<i>(a1).set_dart(adart1);
-
-    typename CMap::template Attribute_handle<i>::type
-      a2 = amap->template
-      create_attribute<i>(amap->template get_attribute<i>(a1));
-
-    amap->template set_attribute<i>(adart2, a2);
-    CGAL::internal::Call_split_functor<CMap, i>::run(amap, a1, a2);
-  }
-};
-// Specialization for void attributes.
-template<typename CMap, unsigned int i, unsigned int j>
-struct Degroup_attribute_functor_run<CMap, i, j, CGAL::Void>
-{
-  static void run(CMap*,
-                  typename CMap::Dart_handle,
-                  typename CMap::Dart_handle)
-  {}
-};
-// Specialization for i==j.
-template<typename CMap, unsigned int i, typename T>
-struct Degroup_attribute_functor_run<CMap, i, i, T>
-{
-  static void run(CMap*,
-                  typename CMap::Dart_handle,
-                  typename CMap::Dart_handle)
-  {}
-};
-// ************************************************************************
-// Function used by Test_split_attribute_functor_run to process one dart.
-// Test the split of the i-cell containing the given dart adart.
-// When we process a dart, we search in the Unique_hash_map if its
-// i-attribute was already found. If yes, it means that we already
-// found an i-cell with this attribute, thus this attribute is split.
-// We mark (with mark) all the darts of the i-cell containing adart to
-// process them exactly once.
-template<typename CMap, unsigned int i>
-void test_split_attribute_functor_one_dart
-( CMap* amap, typename CMap::Dart_handle adart,
-  CGAL::Unique_hash_map<typename CMap::template Attribute_handle<i>::type,
-                        unsigned int, typename CMap::Hash_function> &
-  found_attributes, typename CMap::size_type mark )
-{
-  CGAL_assertion( amap!=NULL );
-  CGAL_static_assertion_msg(CMap::Helper::template
-                            Dimension_index<i>::value>=0,
-                            "Test_split_attribute_functor_one_dart<i> but "
-                            "i-attributes are disabled");
-
-  typedef typename CMap::template Attribute_handle<i>::type
-      Attribute_handle_i;
-
-  // If the current dart has no attribute, or if it is aldready marked,
-  // nothing to do.
-  if ( amap->template attribute<i>(adart)==CMap::null_handle ||
-       amap->is_marked(adart, mark) )
-    return;
-
-  Attribute_handle_i a1 = amap->template attribute<i>(adart);
-  if ( found_attributes.is_defined(a1) )
-  {  // Here the attribute was already present in the hash_map
-    Attribute_handle_i a2 = amap->template
-      create_attribute<i>(amap->template get_attribute<i>(a1));
-
-    for ( CGAL::CMap_dart_iterator_basic_of_cell<CMap, i>
-          itj(*amap, adart, mark); itj.cont(); ++itj )
-    {
-      amap->template set_dart_attribute<i>(itj, a2);
-      amap->mark(itj, mark);
-    }
-    CGAL::internal::Call_split_functor<CMap, i>::run(amap, a1, a2);
-  }
-  else
-  {
-    // Here the attribute was not in the hash_map.
-    found_attributes[a1]=1;
-    amap->template set_dart_of_attribute<i>(a1, adart);
-
-    for ( CGAL::CMap_dart_iterator_basic_of_cell<CMap, i>
-          itj(*amap, adart, mark); itj.cont(); ++itj )
-    {
-      CGAL_assertion( amap->template attribute<i>(itj)==a1 );
-      amap->mark(itj, mark);
-    }
-  }
-}
-// ************************************************************************
-/// Functor used for unsew to test if i-attributes are split after an
-/// operation, except for j-attributes.
-///   (j is the dimension of the beta modified for darts in modified_darts,
-///    if j==0 modified_darts2 are the darts modified for beta_1).
-template<typename CMap, unsigned int i, unsigned int j=CMap::dimension+1,
-         typename T=typename CMap::template Attribute_type<i>::type>
-struct Test_split_attribute_functor_run
-{
-  // modified_darts is the set of modified darts for beta_j
-  static void run( CMap* amap,
-                   const std::deque<typename CMap::Dart_handle>
-                   &modified_darts,
-                   typename CMap::size_type mark_modified_darts=CMap::INVALID_MARK)
-  {
-    CGAL_static_assertion( 1<=i && i<=CMap::dimension );
-    CGAL_assertion( i!=j );
-    CGAL_assertion( amap!=NULL );
-    CGAL_static_assertion_msg(CMap::Helper::template
-                              Dimension_index<i>::value>=0,
-                              "Test_split_attribute_functor_run<i> but "
-                              "i-attributes are disabled");
-
-    typedef typename CMap::template Attribute_handle<i>::type
-        Attribute_handle_i;
-
-    CGAL::Unique_hash_map<Attribute_handle_i, unsigned int,
-                          typename CMap::Hash_function> found_attributes;
-
-    typename CMap::size_type mark = amap->get_new_mark(); // to mark incident cells.
-    typename std::deque<typename CMap::Dart_handle>::const_iterator
-        it=modified_darts.begin();
-    for ( ; it!=modified_darts.end(); ++it )
-    {
-      CGAL::internal::test_split_attribute_functor_one_dart<CMap,i>
-          (amap, *it, found_attributes, mark);
-    }
-
-    // Now we unmark all the marked darts.
-    amap->negate_mark(mark);
-    for ( it=modified_darts.begin(); it!=modified_darts.end(); ++it )
-    {
-      if ( mark_modified_darts!=CMap::INVALID_MARK )
-        amap->unmark(*it, mark_modified_darts);
-
-      if ( !amap->is_marked(*it, mark) )
-        CGAL::mark_cell<CMap, i>(*amap, *it, mark);
-    }
-
-    CGAL_assertion( amap->is_whole_map_marked(mark) );
-    amap->free_mark(mark);
-  }
-  static void run( CMap* amap,
-                   const std::deque<typename CMap::Dart_handle>
-                   &modified_darts,
-                   const std::deque<typename CMap::Dart_handle>
-                   &modified_darts2,
-                   typename CMap::size_type mark_modified_darts=CMap::INVALID_MARK)
-  {
-    CGAL_static_assertion( 1<=i && i<=CMap::dimension );
-    CGAL_assertion( i!=j );
-    CGAL_assertion( amap!=NULL );
-    CGAL_static_assertion_msg(CMap::Helper::template
-                              Dimension_index<i>::value>=0,
-                              "Test_split_attribute_functor_run<i> but "
-                              "i-attributes are disabled");
-
-    typedef typename CMap::template Attribute_handle<i>::type
-        Attribute_handle_i;
-
-    CGAL::Unique_hash_map<Attribute_handle_i, unsigned int,
-                          typename CMap::Hash_function> found_attributes;
-
-    typename CMap::size_type mark = amap->get_new_mark(); // to mark incident cells.
-    typename std::deque<typename CMap::Dart_handle>::const_iterator
-        it=modified_darts.begin();
-    for ( ; it!=modified_darts.end(); ++it )
-    {
-      CGAL::internal::test_split_attribute_functor_one_dart<CMap,i>
-          (amap, *it, found_attributes, mark);
-    }
-    typename std::deque<typename CMap::Dart_handle>::const_iterator
-        it2=modified_darts2.begin();
-    for ( ; it2!=modified_darts2.end(); ++it2 )
-    {
-      CGAL::internal::test_split_attribute_functor_one_dart<CMap,i>
-          (amap, *it2, found_attributes, mark);
-    }
-
-    // Now we unmark all the marked darts.
-    amap->negate_mark(mark);
-    for ( it=modified_darts.begin(); it!=modified_darts.end(); ++it )
-    {
-      if ( mark_modified_darts!=CMap::INVALID_MARK )
-        amap->unmark(*it, mark_modified_darts);
-
-      if ( !amap->is_marked(*it, mark) )
-        CGAL::mark_cell<CMap, i>(*amap, *it, mark);
-    }
-    for ( it2=modified_darts2.begin(); it2!=modified_darts2.end(); ++it2 )
-    {
-      if ( mark_modified_darts!=CMap::INVALID_MARK )
-        amap->unmark(*it2, mark_modified_darts);
-
-      if ( !amap->is_marked(*it2, mark) )
-        CGAL::mark_cell<CMap, i>(*amap, *it2, mark);
-    }
-
-    CGAL_assertion( amap->is_whole_map_marked(mark) );
-    amap->free_mark(mark);
-  }
-};
-// Specialization for i=0 and 2<=j.
-template<typename CMap, unsigned int j, typename T>
-struct Test_split_attribute_functor_run<CMap, 0, j, T>
-{
-  static void run( CMap* amap,
-                   const std::deque<typename CMap::Dart_handle>
-                   &modified_darts,
-                   typename CMap::size_type mark_modified_darts=CMap::INVALID_MARK)
-  {
-    CGAL_assertion( j!=0 && j!=1 );
-    CGAL_assertion( amap!=NULL );
-    CGAL_static_assertion_msg(CMap::Helper::template
-                              Dimension_index<0>::value>=0,
-                              "Test_split_attribute_functor_run<0> but "
-                              "0-attributes are disabled");
-
-    typedef typename CMap::template Attribute_handle<0>::type
-        Attribute_handle_0;
-
-    CGAL::Unique_hash_map<Attribute_handle_0, unsigned int,
-                          typename CMap::Hash_function> found_attributes;
-    typename CMap::Dart_handle od=amap->null_handle;
-
-    typename CMap::size_type mark = amap->get_new_mark(); // to mark incident cells.
-    typename std::deque<typename CMap::Dart_handle>::const_iterator
-        it=modified_darts.begin();
-    for ( ; it!=modified_darts.end(); ++it )
-    {
-      CGAL::internal::test_split_attribute_functor_one_dart<CMap,0>
-          (amap, *it, found_attributes, mark);
-
-      od=amap->other_extremity(*it);
-      if ( od!=amap->null_handle )
-        CGAL::internal::test_split_attribute_functor_one_dart<CMap,0>
-            (amap, od, found_attributes, mark);
-    }
-
-    // Now we unmark all the marked darts.
-    amap->negate_mark(mark);
-    for ( it=modified_darts.begin(); it!=modified_darts.end(); ++it )
-    {
-      if ( mark_modified_darts!=CMap::INVALID_MARK )
-        amap->unmark(*it, mark_modified_darts);
-
-      if ( !amap->is_marked(*it, mark) )
-        CGAL::mark_cell<CMap, 0>(*amap, *it, mark);
-
-      od=amap->other_extremity(*it);
-      if ( od!=amap->null_handle && !amap->is_marked(od, mark) )
-        CGAL::mark_cell<CMap, 0>(*amap, od, mark);
-    }
-
-    CGAL_assertion( amap->is_whole_map_marked(mark) );
-    amap->free_mark(mark);
-  }
-  static void run( CMap* amap,
-                   const std::deque<typename CMap::Dart_handle>
-                   &modified_darts,
-                   const std::deque<typename CMap::Dart_handle>
-                   &modified_darts2,
-                   typename CMap::size_type mark_modified_darts=CMap::INVALID_MARK)
-  {
-    CGAL_assertion( j!=0 && j!=1 );
-    CGAL_assertion( amap!=NULL );
-    CGAL_static_assertion_msg(CMap::Helper::template
-                              Dimension_index<0>::value>=0,
-                              "Test_split_attribute_functor_run<0> but "
-                              "0-attributes are disabled");
-
-    typedef typename CMap::template Attribute_handle<0>::type
-        Attribute_handle_0;
-
-    CGAL::Unique_hash_map<Attribute_handle_0, unsigned int,
-                          typename CMap::Hash_function> found_attributes;
-    typename CMap::Dart_handle od=amap->null_handle;
-
-    typename CMap::size_type mark = amap->get_new_mark(); // to mark incident cells.
-    typename std::deque<typename CMap::Dart_handle>::const_iterator
-        it=modified_darts.begin();
-    for ( ; it!=modified_darts.end(); ++it )
-    {
-      CGAL::internal::test_split_attribute_functor_one_dart<CMap,0>
-          (amap, *it, found_attributes, mark);
-
-      od=amap->other_extremity(*it);
-      if ( od!=amap->null_handle )
-        CGAL::internal::test_split_attribute_functor_one_dart<CMap,0>
-            (amap, od, found_attributes, mark);
-    }
-    typename std::deque<typename CMap::Dart_handle>::const_iterator
-        it2=modified_darts2.begin();
-    for ( ; it2!=modified_darts2.end(); ++it2 )
-    {
-      CGAL::internal::test_split_attribute_functor_one_dart<CMap,0>
-          (amap, *it2, found_attributes, mark);
-
-      od=amap->other_extremity(*it2);
-      if ( od!=amap->null_handle )
-        CGAL::internal::test_split_attribute_functor_one_dart<CMap,0>
-            (amap, od, found_attributes, mark);
-    }
-
-    // Now we unmark all the marked darts.
-    amap->negate_mark(mark);
-    for ( it=modified_darts.begin(); it!=modified_darts.end(); ++it )
-    {
-      if ( mark_modified_darts!=CMap::INVALID_MARK )
-        amap->unmark(*it, mark_modified_darts);
-
-      if ( !amap->is_marked(*it, mark) )
-        CGAL::mark_cell<CMap, 0>(*amap, *it, mark);
-
-      od=amap->other_extremity(*it);
-      if ( od!=amap->null_handle && !amap->is_marked(od, mark) )
-        CGAL::mark_cell<CMap, 0>(*amap, od, mark);
-    }
-    for ( it2=modified_darts2.begin(); it2!=modified_darts2.end(); ++it2 )
-    {
-      if ( mark_modified_darts!=CMap::INVALID_MARK )
-        amap->unmark(*it2, mark_modified_darts);
-
-      if ( !amap->is_marked(*it2, mark) )
-        CGAL::mark_cell<CMap, 0>(*amap, *it2, mark);
-
-      od=amap->other_extremity(*it2);
-      if ( od!=amap->null_handle && !amap->is_marked(od, mark) )
-        CGAL::mark_cell<CMap, 0>(*amap, od, mark);
-    }
-
-    CGAL_assertion( amap->is_whole_map_marked(mark) );
-    amap->free_mark(mark);
-  }
-};
-// Specialization for i=0 and j=0.
-// For j==0 or j==1, we use only the version with two list of darts,
-// modified_darts are darts modified for beta0, and
-// modified_darts2 are darts modified for beta1.
-template<typename CMap, typename T>
-struct Test_split_attribute_functor_run<CMap, 0, 0, T>
-{
-  static void run( CMap*, const std::deque<typename CMap::Dart_handle>&,
-                   typename CMap::size_type =CMap::INVALID_MARK)
-  { CGAL_assertion(false); }
-  static void run( CMap* amap,
-                   const std::deque<typename CMap::Dart_handle>
-                   &modified_darts,
-                   const std::deque<typename CMap::Dart_handle>
-                   &modified_darts2,
-                   typename CMap::size_type mark_modified_darts=CMap::INVALID_MARK)
-  {
-    CGAL_assertion( amap!=NULL );
-    CGAL_static_assertion_msg(CMap::Helper::template
-                              Dimension_index<0>::value>=0,
-                              "Test_split_attribute_functor_run<0> but "
-                              "0-attributes are disabled");
-
-    typedef typename CMap::template Attribute_handle<0>::type
-        Attribute_handle_0;
-
-    CGAL::Unique_hash_map<Attribute_handle_0, unsigned int,
-                          typename CMap::Hash_function> found_attributes;
-    typename CMap::Dart_handle od=amap->null_handle;
-
-    typename CMap::size_type mark = amap->get_new_mark(); // to mark incident cells.
-    typename std::deque<typename CMap::Dart_handle>::const_iterator
-        it=modified_darts.begin();
-    for ( ; it!=modified_darts.end(); ++it )
-    {
-      CGAL::internal::test_split_attribute_functor_one_dart<CMap,0>
-          (amap, *it, found_attributes, mark);
-    }
-    typename std::deque<typename CMap::Dart_handle>::const_iterator
-        it2=modified_darts2.begin();
-    for ( ; it2!=modified_darts2.end(); ++it2 )
-    {
-      od=amap->other_extremity(*it2);
-      if ( od!=amap->null_handle )
-        CGAL::internal::test_split_attribute_functor_one_dart<CMap,0>
-            (amap, od, found_attributes, mark);
-    }
-
-    // Now we unmark all the marked darts.
-    amap->negate_mark(mark);
-    for ( it=modified_darts.begin(); it!=modified_darts.end(); ++it )
-    {
-      if ( mark_modified_darts!=CMap::INVALID_MARK )
-        amap->unmark(*it, mark_modified_darts);
-
-      if ( !amap->is_marked(*it, mark) )
-        CGAL::mark_cell<CMap, 0>(*amap, *it, mark);
-    }
-    for ( it2=modified_darts2.begin(); it2!=modified_darts2.end(); ++it2 )
-    {
-      if ( mark_modified_darts!=CMap::INVALID_MARK )
-        amap->unmark(*it2, mark_modified_darts);
-
-      od=amap->other_extremity(*it2);
-      if ( od!=amap->null_handle && !amap->is_marked(od, mark) )
-        CGAL::mark_cell<CMap, 0>(*amap, od, mark);
-    }
-
-    CGAL_assertion( amap->is_whole_map_marked(mark) );
-    amap->free_mark(mark);
-  }
-};
-// Specialization for i=0 and j=1.
-// Equivalent to i=0 and j=0.
-template<typename CMap, typename T>
-struct Test_split_attribute_functor_run<CMap, 0, 1, T>
-{
-  static void run( CMap*, const std::deque<typename CMap::Dart_handle>&,
-                   typename CMap::size_type =CMap::INVALID_MARK)
-  { CGAL_assertion(false); }
-  static void run( CMap* amap, const std::deque<typename CMap::Dart_handle>&
-                   modified_darts,
-                   const std::deque<typename CMap::Dart_handle>&
-                   modified_darts2, typename CMap::size_type mark_modified_darts=CMap::INVALID_MARK)
-  { CGAL::internal::Test_split_attribute_functor_run<CMap, 0, 0, T>::
-        run(amap, modified_darts, modified_darts2, mark_modified_darts); }
-};
-// Specialization for void attributes.
-template<typename CMap, unsigned int i, unsigned int j>
-struct Test_split_attribute_functor_run<CMap, i, j, CGAL::Void>
-{
-  static void run( CMap*, const std::deque<typename CMap::Dart_handle>&,
-                   typename CMap::size_type=CMap::INVALID_MARK)
-  {}
-  static void run( CMap*, const std::deque<typename CMap::Dart_handle>&,
-                   const std::deque<typename CMap::Dart_handle>&, typename CMap::size_type=CMap::INVALID_MARK)
-  {}
-};
-// Specialization for i=j.
-template<typename CMap, unsigned int i, typename T>
-struct Test_split_attribute_functor_run<CMap, i, i, T>
-{
-  static void run( CMap*, const std::deque<typename CMap::Dart_handle>&,
-                   typename CMap::size_type=CMap::INVALID_MARK)
-  {}
-  static void run( CMap*, const std::deque<typename CMap::Dart_handle>&,
-                   const std::deque<typename CMap::Dart_handle>&, typename CMap::size_type=CMap::INVALID_MARK)
-  {}
-};
-// Specialization for i=1 and j=0 (edge attributes are not modified
-// when we modify beta_0).
-template<typename CMap, typename T>
-struct Test_split_attribute_functor_run<CMap, 1, 0, T>
-{
-  static void run( CMap*, const std::deque<typename CMap::Dart_handle>&,
-                   typename CMap::size_type=CMap::INVALID_MARK)
-  {}
-  static void run( CMap*, const std::deque<typename CMap::Dart_handle>&,
-                   const std::deque<typename CMap::Dart_handle>&, typename CMap::size_type=CMap::INVALID_MARK)
-  {}
-};
-// ************************************************************************
-/// Functor used for unsew to test if i-attributes are split after an
-/// operation, except for j-attributes.
-/// We define run<i> to allows to use this functor with
-/// Foreach_enabled_attributes.
-template<typename CMap, unsigned int j=CMap::dimension+1>
-struct Test_split_attribute_functor
-{
-  // Test the split of i-attributes, for all modified darts given in
-  // modified_darts, and marked with mark_modified_darts.
-  // For each split attribute, create a new i-attribute, associate
-  // it with the new i-cell and call onsplit functors.
-  template <unsigned int i>
-  static void run( CMap* amap,
-                   const std::deque<typename CMap::Dart_handle>
-                   &modified_darts,
-                   typename CMap::size_type mark_modified_darts=CMap::INVALID_MARK)
-  {
-    CGAL::internal::Test_split_attribute_functor_run<CMap, i, j>::
-        run(amap, modified_darts, mark_modified_darts);
-  }
-  template <unsigned int i>
-  static void run( CMap* amap,
-                   const std::deque<typename CMap::Dart_handle>
-                   &modified_darts,
-                   const std::deque<typename CMap::Dart_handle>
-                   &modified_darts2,
-                   typename CMap::size_type mark_modified_darts=CMap::INVALID_MARK)
-  {
-    CGAL::internal::Test_split_attribute_functor_run<CMap, i, j>::
-        run(amap, modified_darts, modified_darts2, mark_modified_darts);
-  }
-};
-// ************************************************************************
-} // namespace internal
-} // namespace CGAL
-
-#endif // CGAL_COMBINATORIAL_MAP_GROUP_FUNCTORS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Mesh_3/Graph_manipulations.h b/3rdparty/CGAL-4.8/include/CGAL/internal/Mesh_3/Graph_manipulations.h
deleted file mode 100644
index dc07c34..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/internal/Mesh_3/Graph_manipulations.h
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright (c) 2015 GeometryFactory
-// 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
-// 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(s)     : Laurent Rineau
-
-#ifndef CGAL_INTERNAL_MESH_3_INTERNAL_GRAPH_MANIPULATIONS
-#define CGAL_INTERNAL_MESH_3_INTERNAL_GRAPH_MANIPULATIONS
-
-#include <CGAL/Kernel/global_functions_3.h>
-// Assumes the point is a CGAL point.
-
-#include <boost/graph/graph_traits.hpp>
-
-#include <map>
-
-namespace CGAL {
-namespace internal {
-namespace Mesh_3 {
-
-template <typename Graph, typename Point_3>
-struct Graph_manipulations
-{
-  typedef typename boost::graph_traits<Graph>::vertex_descriptor vertex_descriptor;
-  typedef typename boost::graph_traits<Graph>::edge_descriptor edge_descriptor;
-
-  std::map<Point_3, vertex_descriptor> p2v;
-  Graph& g;
-
-  Graph_manipulations(Graph& g) : g(g) {}
-
-  vertex_descriptor get_vertex(const Point_3& p) {
-    typename std::map<Point_3, vertex_descriptor>::iterator
-      it = p2v.find(p);
-    if(it == p2v.end()){
-      vertex_descriptor v0 = add_vertex(g);
-      p2v[p] = v0;
-      g[v0] = p;
-      return v0;
-    } else {
-      return it->second;
-    }
-  }
-
-  vertex_descriptor split(const Point_3& a, const Point_3& b) {
-    const Point_3 mid = a < b ? midpoint(a, b) : midpoint(b, a);
-    vertex_descriptor vmid = get_vertex(mid);
-    typename std::map<Point_3, vertex_descriptor>::iterator
-      it_a = p2v.find(a),
-      it_b = p2v.find(b);
-    if(it_a != p2v.end() && it_b != p2v.end()) {
-      vertex_descriptor va = it_a->second;
-      vertex_descriptor vb = it_b->second;
-      edge_descriptor edge;
-      bool b;
-      // test if the edge is already here, using add_edge
-      boost::tie(edge, b) = add_edge(va, vb, g);
-      remove_edge(edge, g);
-      if(!b) {
-        // The edge was already here.
-        try_add_edge(va, vmid);
-        try_add_edge(vb, vmid);
-        return vmid;
-      }
-    }
-    return vmid;
-  }
-
-  bool try_add_edge(vertex_descriptor v1, vertex_descriptor v2) {
-    if(v1 != v2) {
-      edge_descriptor edge;
-      bool b;
-      boost::tie(edge, b) = add_edge(v1, v2, g);
-      return b;
-    } else
-      return false;
-  }
-}; // struct template Graph_manipulations
-
-} // namespace Mesh_3
-} // namespace internal
-} // namespace CGAL
-
-#endif //CGAL_INTERNAL_MESH_3_INTERNAL_GRAPH_MANIPULATIONS
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Mesh_3/get_index.h b/3rdparty/CGAL-4.8/include/CGAL/internal/Mesh_3/get_index.h
deleted file mode 100644
index f13995f..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/internal/Mesh_3/get_index.h
+++ /dev/null
@@ -1,170 +0,0 @@
-// Copyright (c) 2009 INRIA Sophia-Antipolis (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
-// 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: https://scm.gforge.inria.fr/svn/cgal/branches/features/Mesh_3-experimental-GF/Mesh_3/include/CGAL/internal/Mesh_3/get_index.h $
-// $Id: get_index.h 67573 2012-02-02 14:54:51Z lrineau $
-//
-//
-// Author(s)     : Stéphane Tayeb
-//
-//******************************************************************************
-// File Description :
-//
-//
-//******************************************************************************
-
-#ifndef CGAL_INTERNAL_MESH_3_GET_INDEX_3_H
-#define CGAL_INTERNAL_MESH_3_GET_INDEX_3_H
-
-#include <boost/type_traits/is_same.hpp>
-#include <CGAL/Mesh_3/Has_features.h>
-
-namespace CGAL {
-namespace internal {
-namespace Mesh_3 {
-  
-  
-template <typename T, typename Boost_variant>
-const T& get_index(const Boost_variant& x,
-                   typename boost::disable_if<boost::is_same<T, Boost_variant> >::type * = 0)
-{ return boost::get<T>(x); }
-
-template <typename T>
-const T& get_index(const T& x) { return x; }
-
-template <typename Mesh_domain, 
-          bool has_feature = Has_features<Mesh_domain>::value> 
-struct Read_mesh_domain_index {
-  // here we have has_feature==true
-
-  typedef Mesh_domain MT; // was named "mesh traits" previously
-
-  typename Mesh_domain::Index 
-  operator()(int dimension, std::istream& is) const {
-    switch(dimension) {
-    case 0: 
-      typename MT::Corner_index ci;
-      if(is_ascii(is)) is >> ci;
-      else CGAL::read(is, ci);
-      return  ci;
-      break;
-    case 1: 
-      typename MT::Curve_segment_index si;
-      if(is_ascii(is)) is >> si;
-      else CGAL::read(is, si);
-      return  si;
-      break;
-    default:
-      return Read_mesh_domain_index<Mesh_domain, false>()(dimension, is);
-    }
-  }
-}; // end template partial specialization 
-   // Read_mesh_domain_index<Mesh_domain, true>
-
-template <typename Mesh_domain, 
-          bool has_feature = Has_features<Mesh_domain>::value> 
-struct Write_mesh_domain_index {
-  // here we have has_feature==true
-
-  typedef Mesh_domain MT; // was named "mesh traits" previously
-  typedef typename MT::Corner_index Ci;
-  typedef typename MT::Curve_segment_index  Si;
-
-  void
-  operator()(std::ostream& os, int dimension,
-             const typename Mesh_domain::Index& index) const {
-    switch(dimension) {
-    case 0: {
-      const Ci& ci = get_index<Ci>(index);
-      if(is_ascii(os)) os << ci;
-      else CGAL::write(os, ci);
-    }
-      break;
-    case 1: {
-      const Si& si = get_index<Si>(index);
-      if(is_ascii(os)) os << si;
-      else CGAL::write(os, si);
-    }
-      break;
-    default:
-      Write_mesh_domain_index<Mesh_domain, false>()(os, dimension, index);
-    }
-  }
-}; // end template partial specialization 
-   // Write_mesh_domain_index<Mesh_domain, true>
-
-template <typename Mesh_domain>
-struct Read_mesh_domain_index<Mesh_domain, false> {
-  // here we have has_feature==false
-
-  typedef Mesh_domain MT; // was named "mesh traits" previously
-
-  typename Mesh_domain::Index 
-  operator()(int dimension, std::istream& is) const {
-    switch(dimension) {
-    case 2: {
-      typename MT::Surface_patch_index spi;
-      if(is_ascii(is)) is >> spi;
-      else CGAL::read(is, spi);
-      return  spi;
-    }
-      break;
-    default: {// 3
-      typename MT::Subdomain_index di;
-      if(is_ascii(is)) is >> di;
-      else CGAL::read(is, di);
-      return  di;
-    }
-      break;
-    }
-  }
-}; // end template partial specialization 
-   // Read_mesh_domain_index<Mesh_domain, false>
-
-template <typename Mesh_domain>
-struct Write_mesh_domain_index<Mesh_domain, false> {
-  // here we have has_feature==false
-
-  typedef Mesh_domain MT; // was named "mesh traits" previously
-  typedef typename MT::Surface_patch_index Spi;
-  typedef typename MT::Subdomain_index Di;
-
-  void
-  operator()(std::ostream& os, int dimension,
-             const typename Mesh_domain::Index& index) const {
-    switch(dimension) {
-    case 2: {
-      const Spi& spi = get_index<Spi>(index);
-      if(is_ascii(os)) os << spi;
-      else CGAL::write(os, spi);
-    }
-      break;
-    default: {// 3
-      const Di& di = get_index<Di>(index);
-      if(is_ascii(os)) os << di;
-      else CGAL::write(os, di);
-    }
-      break;
-    }
-  }
-}; // end template partial specialization 
-   // Write_mesh_domain_index<Mesh_domain, false>
-
-
-
-}
-}
-}
-
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Mesh_3/split_in_polylines.h b/3rdparty/CGAL-4.8/include/CGAL/internal/Mesh_3/split_in_polylines.h
deleted file mode 100644
index 36c17c7..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/internal/Mesh_3/split_in_polylines.h
+++ /dev/null
@@ -1,219 +0,0 @@
-// Copyright (c) 2012-2015  GeometryFactory Sarl (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
-// 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(s)     : Andreas Fabri, Laurent Rineau
-
-#ifndef CGAL_SPLIT_IN_POLYLINES_H
-#define CGAL_SPLIT_IN_POLYLINES_H
-
-#include <vector>
-#include <set>
-#include <iostream>
-#include <fstream>
-#include <boost/foreach.hpp>
-#include <CGAL/number_utils.h>
-#include <boost/graph/graph_traits.hpp>
-
-namespace CGAL {
-namespace internal {
-namespace Mesh_3 {
-
-template <typename Graph>
-void dump_graph_edges(std::ostream& out, const Graph& g)
-{
-  typedef typename boost::graph_traits<Graph>::vertex_descriptor vertex_descriptor;
-  typedef typename boost::graph_traits<Graph>::edge_descriptor edge_descriptor;
-
-  BOOST_FOREACH(edge_descriptor e, edges(g))
-  {
-    vertex_descriptor s = source(e, g);
-    vertex_descriptor t = target(e, g);
-    out.precision(17);
-    out << "2 " << g[s] << " " << g[t] << "\n";
-  }
-}
-
-template <typename Graph>
-void dump_graph_edges(const char* filename, const Graph& g)
-{
-  std::ofstream out(filename);
-  dump_graph_edges(out, g);
-}
-
-/// Splits a graph at vertices with degree higher than two.
-/// The vertices are duplicated, and new incident edges created.
-template <typename Graph, typename Kernel>
-void split_in_polylines(Graph& G, Kernel)
-{
-  typedef typename boost::graph_traits<Graph>::vertex_descriptor vertex_descriptor;
-  typedef typename boost::graph_traits<Graph>::edge_descriptor edge_descriptor;
-  typedef typename boost::graph_traits<Graph>::vertex_iterator vertex_iterator;
-  typedef typename boost::graph_traits<Graph>::out_edge_iterator out_edge_iterator;
-
-  vertex_iterator b,e;
-  boost::tie(b,e) = vertices(G);
-  std::vector<vertex_descriptor> V(b,e);
-  for(typename std::vector<vertex_descriptor>::iterator it = V.begin();
-      it != V.end();
-      ++it){
-    vertex_descriptor v = *it;
-    bool split = false;
-
-    if(out_degree(v,G) > 2) {
-      split = true;
-    } else if(out_degree(v, G) == 2) {
-      out_edge_iterator out_edge_it, out_edges_end;
-      boost::tie(out_edge_it, out_edges_end) = out_edges(v, G);
-
-      vertex_descriptor v1 = target(*out_edge_it++, G);
-      vertex_descriptor v2 = target(*out_edge_it++, G);
-      CGAL_assertion(out_edge_it == out_edges_end);
-
-      const typename Kernel::Point_3& p = G[v];
-      const typename Kernel::Point_3& p1 = G[v1];
-      const typename Kernel::Point_3& p2 = G[v2];
-
-      const typename Kernel::Vector_3 e1 = p1 - p;
-      const typename Kernel::Vector_3 e2 = p2 - p;
-      const typename Kernel::FT sc_prod = e1 * e2;
-      if( sc_prod >= 0 ||   // angle < 135 degrees (3*pi/4)
-          (sc_prod < 0 &&
-           CGAL::square(sc_prod) < (e1 * e1) * (e2 * e2) / 2 ) )
-      {
-        split = true;
-      }
-    }
-
-    if(split) {
-      out_edge_iterator b,e;
-      boost::tie(b,e) = out_edges(v,G);
-      std::vector<edge_descriptor> E(b,e);
-      for(unsigned int i = 1; i < E.size(); ++i){
-        edge_descriptor e = E[i];
-        vertex_descriptor w = target(e,G);
-        remove_edge(e,G);
-        vertex_descriptor vc = add_vertex(G);
-        G[vc] = G[v];
-        add_edge(vc,w,G);
-      }
-    }
-  }
-  CGAL_assertion_code(
-  BOOST_FOREACH(vertex_descriptor v, vertices(G))
-  {
-    typename boost::graph_traits<Graph>::degree_size_type 
-      n = out_degree(v, G);
-
-    CGAL_assertion(n == 1 || n == 2);
-  }
-  BOOST_FOREACH(edge_descriptor e, edges(G))
-  {
-    vertex_descriptor v = target(e,G);
-    vertex_descriptor w = source(e, G);
-    CGAL_assertion(v != w);
-    CGAL_assertion(G[v] != G[w]);
-  }
-                      )
-}
-
-
-template <typename Graph, typename Polylines_container, typename Kernel>
-void split_in_polylines(Graph& G, Polylines_container& polylines, Kernel k)
-{
-  typedef typename Polylines_container::value_type Polyline;
-  typedef typename boost::graph_traits<Graph>::vertex_descriptor vertex_descriptor;
-  typedef typename boost::graph_traits<Graph>::vertex_iterator vertex_iterator;
-  typedef typename boost::graph_traits<Graph>::out_edge_iterator out_edge_iterator;
-
-  // dump_graph_edges("edges.polylines.txt", G);
-  split_in_polylines(G, k);
-  std::set<vertex_descriptor> terminal;
-  vertex_iterator b,e;
-  for(boost::tie(b,e) = vertices(G); b!=e; ++b){
-    if(degree(*b,G) == 1){
-      terminal.insert(*b);
-    }
-  }
-
-  while(! terminal.empty()){
-    typename std::set<vertex_descriptor>::iterator it = terminal.begin();
-    vertex_descriptor u = *it;
-    terminal.erase(u);
-    Polyline V;
-    polylines.push_back(V);
-    Polyline& polyline = polylines.back();
-    polyline.push_back(G[u]);
-
-    while(out_degree(u,G)!=0){
-      CGAL_assertion(out_degree(u,G) == 1);
-      out_edge_iterator b,e;
-      boost::tie(b,e) = out_edges(u,G);
-      vertex_descriptor v = target(*b,G);
-      CGAL_assertion(G[v] != polyline.back());
-      polyline.push_back(G[v]);
-      remove_edge(b,G);
-      u = v;
-    }
-    terminal.erase(u);
-
-    if(polyline.back() == polyline.front())
-    {
-      CGAL_assertion(polyline.size() > 3);
-      // Fake cycle. We intended that cycle to be split at polyline.front()
-      // Split the line in two, arbitrary.
-      std::size_t n = polyline.size() / 2;
-      Polyline new_line(polyline.begin() + n,
-                        polyline.end());
-      polyline.resize(n+1);
-      polylines.push_back(new_line);
-    }
-  }
-  // dump_graph_edges("only-cycle-edges.polylines.txt", G);
-
-  std::size_t nb_cycles = 0;
-  // process cycles
-  while(num_edges(G) != 0)
-  {
-    vertex_descriptor u = source(*edges(G).first, G);
-
-    Polyline V;
-    polylines.push_back(V);
-    Polyline& polyline = polylines.back();
-    polyline.push_back(G[u]);
-
-    ++nb_cycles;
-
-    CGAL_assertion_code(bool first = true);
-    while(out_degree(u,G)!=0){
-      CGAL_assertion(out_degree(u,G) == 1 ||
-                     (first && out_degree(u, G) == 2));
-      out_edge_iterator b,e;
-      boost::tie(b,e) = out_edges(u,G);
-      vertex_descriptor v = target(*b,G);
-      polyline.push_back(G[v]);
-      remove_edge(b,G);
-      u = v;
-      CGAL_assertion_code(first = false);
-    }
-  }
-}
-
-} // namespace Mesh_3
-} // namespace internal
-} // namespace CGAL
-
-#endif // CGAL_SPLIT_IN_POLYLINES_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Polyhedron_plane_clipping_3.h b/3rdparty/CGAL-4.8/include/CGAL/internal/Polyhedron_plane_clipping_3.h
deleted file mode 100644
index a562dde..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/internal/Polyhedron_plane_clipping_3.h
+++ /dev/null
@@ -1,391 +0,0 @@
-// Copyright (c) 2015 GeometryFactory (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Sebastien Loriot
-
-#ifndef CGAL_INTERNAL_POLYHEDRON_PLANE_CLIPPING_3_H
-#define CGAL_INTERNAL_POLYHEDRON_PLANE_CLIPPING_3_H
-
-#include <CGAL/corefinement_operations.h>
-#include <CGAL/iterator.h>
-#include <CGAL/Bbox_3.h>
-#include <CGAL/array.h>
-#include <CGAL/Delaunay_triangulation_2.h>
-#include <CGAL/Triangulation_2_filtered_projection_traits_3.h>
-#include <CGAL/convex_hull_3.h>
-#include <CGAL/Polygon_mesh_processing/connected_components.h>
-#include <CGAL/convex_hull_3.h>
-
-namespace CGAL{
-namespace corefinement{
-
-namespace internal{
- template <class HDS,class T>
- class Builder_from_T_2 : public CGAL::Modifier_base<HDS> {
-   typedef std::map<typename T::Vertex_handle,unsigned> Vertex_map;
-
-   const T& t;
-   template <class Builder>
-   static unsigned get_vertex_index( Vertex_map& vertex_map,
-                                     typename T::Vertex_handle vh,
-                                     Builder& builder,
-                                     unsigned& vindex)
-   {
-     std::pair<typename Vertex_map::iterator,bool>
-       res=vertex_map.insert(std::make_pair(vh,vindex));
-     if (res.second){
-       builder.add_vertex(vh->point());
-         ++vindex;
-     }
-     return res.first->second;
-   }
-
-   public:
-   Builder_from_T_2(const T& t_):t(t_)
-   {
-     CGAL_assertion(t.dimension()==2);
-   }
-   void operator()( HDS& hds) {
-     // Postcondition: `hds' is a valid polyhedral surface.
-     CGAL::Polyhedron_incremental_builder_3<HDS> B( hds, true);
-     Vertex_map vertex_map;
-     //start the surface
-     B.begin_surface( t.number_of_vertices(), t.number_of_faces());
-     unsigned vindex=0;
-     for (typename T::Finite_faces_iterator it=t.finite_faces_begin();
-                                            it!=t.finite_faces_end();++it)
-     {
-       unsigned i0=get_vertex_index(vertex_map,it->vertex(0),B,vindex);
-       unsigned i1=get_vertex_index(vertex_map,it->vertex(1),B,vindex);
-       unsigned i2=get_vertex_index(vertex_map,it->vertex(2),B,vindex);
-       B.begin_facet();
-       B.add_vertex_to_facet( i0 );
-       B.add_vertex_to_facet( i1 );
-       B.add_vertex_to_facet( i2 );
-       B.end_facet();
-     }
-     B.end_surface();
-   }
- };
-} // end of namespace internal
-
-template <class Polyhedron, class Plane_3>
-Polyhedron clip_to_bbox(const Bbox_3& bbox, const Plane_3& plane)
-{
-  typedef typename Polyhedron::Traits::Kernel Kernel;
-  typedef typename Kernel::Point_3 Point_3;
-  typedef typename Kernel::Segment_3 Segment_3;
-  cpp11::array<typename Kernel::Point_3,8> corners= {{
-    Point_3(bbox.xmin(),bbox.ymin(),bbox.zmin()),
-    Point_3(bbox.xmin(),bbox.ymax(),bbox.zmin()),
-    Point_3(bbox.xmax(),bbox.ymax(),bbox.zmin()),
-    Point_3(bbox.xmax(),bbox.ymin(),bbox.zmin()),
-    Point_3(bbox.xmin(),bbox.ymin(),bbox.zmax()),
-    Point_3(bbox.xmin(),bbox.ymax(),bbox.zmax()),
-    Point_3(bbox.xmax(),bbox.ymax(),bbox.zmax()),
-    Point_3(bbox.xmax(),bbox.ymin(),bbox.zmax())
-  }};
-
-  cpp11::array<CGAL::Oriented_side,8> orientations = {{
-    plane.oriented_side(corners[0]),
-    plane.oriented_side(corners[1]),
-    plane.oriented_side(corners[2]),
-    plane.oriented_side(corners[3]),
-    plane.oriented_side(corners[4]),
-    plane.oriented_side(corners[5]),
-    plane.oriented_side(corners[6]),
-    plane.oriented_side(corners[7])
-  }};
-
-  std::vector<Point_3> intersection_points;
-  // first look for intersections at corners
-  for (int i=0; i<8; ++i)
-    if (orientations[i]==ON_ORIENTED_BOUNDARY)
-      intersection_points.push_back(corners[i]);
-  // second look for intersections on edges
-  cpp11::array<int,24> edge_indices = {{ // 2 *12 edges
-    0,1, 1,2, 2,3, 3,0, // bottom face edges
-    4,5, 5,6, 6,7, 7,4, // top face edges
-    0,4, 1,5, 2,6, 3,7
-  }};
-
-  for (int i=0; i<12; ++i)
-  {
-    int i1=edge_indices[2*i], i2=edge_indices[2*i+1];
-    if (orientations[i1]==ON_ORIENTED_BOUNDARY) continue;
-    if (orientations[i2]==ON_ORIENTED_BOUNDARY) continue;
-    if (orientations[i1]!=orientations[i2])
-      intersection_points.push_back(
-        get<Point_3>(
-          *CGAL::intersection(plane, Segment_3(corners[i1], corners[i2]) )
-        )
-      );
-  }
-
-  Polyhedron P;
-
-  //if less that 3 points there will be nothing to clipping.
-  if (intersection_points.size()<3) return P;
-
-  //triangulate the set of intersection points (I know it's overkill)
-  typedef CGAL::Triangulation_2_filtered_projection_traits_3<Kernel>   P_traits;
-  typedef CGAL::Delaunay_triangulation_2<P_traits> DT;
-  DT dt(P_traits(plane.orthogonal_vector()));
-  dt.insert(intersection_points.begin(),
-            intersection_points.end());
-
-  // tangency with the bbox -> no intersection
-  if (dt.dimension()!=2) return P;
-
-  //now create the polyhedron from the triangulation
-  internal::Builder_from_T_2< typename Polyhedron::HalfedgeDS,DT > builder(dt);
-  P.delegate(builder);
-
-  return P;
-}
-
-template <class Polyhedron, class Plane_3>
-Polyhedron clip_bbox(const Bbox_3& bbox, const Plane_3& plane)
-{
-  typedef typename Polyhedron::Traits::Kernel Kernel;
-  typedef typename Kernel::Point_3 Point_3;
-  typedef typename Kernel::Segment_3 Segment_3;
-  cpp11::array<typename Kernel::Point_3,8> corners= {{
-    Point_3(bbox.xmin(),bbox.ymin(),bbox.zmin()),
-    Point_3(bbox.xmin(),bbox.ymax(),bbox.zmin()),
-    Point_3(bbox.xmax(),bbox.ymax(),bbox.zmin()),
-    Point_3(bbox.xmax(),bbox.ymin(),bbox.zmin()),
-    Point_3(bbox.xmin(),bbox.ymin(),bbox.zmax()),
-    Point_3(bbox.xmin(),bbox.ymax(),bbox.zmax()),
-    Point_3(bbox.xmax(),bbox.ymax(),bbox.zmax()),
-    Point_3(bbox.xmax(),bbox.ymin(),bbox.zmax())
-  }};
-
-  cpp11::array<CGAL::Oriented_side,8> orientations = {{
-    plane.oriented_side(corners[0]),
-    plane.oriented_side(corners[1]),
-    plane.oriented_side(corners[2]),
-    plane.oriented_side(corners[3]),
-    plane.oriented_side(corners[4]),
-    plane.oriented_side(corners[5]),
-    plane.oriented_side(corners[6]),
-    plane.oriented_side(corners[7])
-  }};
-
-  std::vector<Point_3> points;
-  // first look for intersections at corners
-  for (int i=0; i<8; ++i)
-    if (orientations[i]==ON_ORIENTED_BOUNDARY)
-      points.push_back(corners[i]);
-  // second look for intersections on edges
-  cpp11::array<int,24> edge_indices = {{ // 2 *12 edges
-    0,1, 1,2, 2,3, 3,0, // bottom face edges
-    4,5, 5,6, 6,7, 7,4, // top face edges
-    0,4, 1,5, 2,6, 3,7
-  }};
-
-  for (int i=0; i<12; ++i)
-  {
-    int i1=edge_indices[2*i], i2=edge_indices[2*i+1];
-    if (orientations[i1]==ON_ORIENTED_BOUNDARY) continue;
-    if (orientations[i2]==ON_ORIENTED_BOUNDARY) continue;
-    if (orientations[i1]!=orientations[i2])
-      points.push_back(
-        get<Point_3>(
-          *CGAL::intersection(plane, Segment_3(corners[i1], corners[i2]) )
-        )
-      );
-  }
-
-  Polyhedron P;
-
-  //if less that 3 points there will be nothing to clipping.
-  if (points.size()<3) return P;
-
-  for (int i=0; i<8; ++i)
-    if (orientations[i]==ON_NEGATIVE_SIDE)
-      points.push_back(corners[i]);
-
-  // take the convex hull of the points on the negative side+intersection points
-  // overkill...
-  CGAL::convex_hull_3(points.begin(), points.end(), P);
-
-  return P;
-}
-
-template <class Polyhedron>
-Polyhedron* clip_polyhedron(Polyhedron& P, Polyhedron& clipping_polyhedron)
-{
-  std::pair <Polyhedron*,int> result;
-  typedef CGAL::Polyhedron_corefinement<Polyhedron> Corefinement;
-  Corefinement coref;
-  CGAL::Emptyset_iterator emptyset_iterator;
-  coref(P, clipping_polyhedron, emptyset_iterator,
-        &result, Corefinement::Intersection_tag);
-
-  return result.first;
-}
-
-template <class Polyhedron, class Plane_3>
-Polyhedron* clip_polyhedron(const Polyhedron& P, const Plane_3& p)
-{
-  if(P.empty()) return new Polyhedron();
-  CGAL::Bbox_3 bbox( CGAL::bbox_3(P.points_begin(), P.points_end()) );
-  //extend the bbox a bit to avoid border cases
-  double xd=(bbox.xmax()-bbox.xmin())/100;
-  double yd=(bbox.ymax()-bbox.ymin())/100;
-  double zd=(bbox.zmax()-bbox.zmin())/100;
-  bbox=CGAL::Bbox_3(bbox.xmin()-xd, bbox.ymin()-yd, bbox.zmin()-zd,
-                    bbox.xmax()+xd, bbox.ymax()+yd, bbox.zmax()+zd);
-  Polyhedron clipping_polyhedron=clip_bbox<Polyhedron>(bbox, p);
-
-  if (clipping_polyhedron.empty()) //no intersection, result is all or nothing
-  {
-    if (p.oriented_side(*P.points_begin())==ON_POSITIVE_SIDE)
-      return new Polyhedron();
-    else
-      return new Polyhedron(P);
-  }
-  Polyhedron copy(P);
-  return clip_polyhedron(copy, clipping_polyhedron);
-}
-
-namespace internal{
-
-template<class Polyhedron>
-struct Edge_is_marked4coref{
-  std::set<typename Polyhedron::Halfedge_handle>& marked_halfedges;
-  typedef bool value_type;
-  typedef value_type reference;
-  typedef std::pair<typename Polyhedron::Halfedge_handle,Polyhedron*> key_type;
-  typedef boost::read_write_property_map_tag category;
-
-  Edge_is_marked4coref(std::set<typename Polyhedron::Halfedge_handle>& mh)
-  : marked_halfedges(mh)
-  {}
-
-  friend reference get(Edge_is_marked4coref& map,const key_type& key) {
-    return map.marked_halfedges.count(key.first)!=0;
-  }
-  friend void put(Edge_is_marked4coref& map,key_type key,value_type v) {
-    if (v) map.marked_halfedges.insert(key.first);
-    else  map.marked_halfedges.erase(key.first);
-  }
-};
-
-template<class Polyhedron>
-struct Edge_is_marked{
-  const std::set<typename Polyhedron::Halfedge_handle>* marked_halfedges;
-  typedef bool value_type;
-  typedef value_type reference;
-  typedef typename boost::graph_traits<Polyhedron>::edge_descriptor key_type;
-  typedef boost::readable_property_map_tag category;
-
-  Edge_is_marked(){}
-  Edge_is_marked(const std::set<typename Polyhedron::Halfedge_handle>& mh)
-  : marked_halfedges(&mh)
-  {}
-
-  friend reference get(const Edge_is_marked& map,const key_type& key) {
-    return map.marked_halfedges->count(key.halfedge())!=0;
-  }
-};
-
-} //end of internal namespace
-
-template <class Polyhedron, class Plane_3>
-void inplace_clip_open_polyhedron(Polyhedron& P, const Plane_3& p)
-{
-  CGAL::Bbox_3 bbox( CGAL::bbox_3(P.points_begin(), P.points_end()) );
-  //extend the bbox a bit to avoid border cases
-  double xd=(bbox.xmax()-bbox.xmin())/100;
-  double yd=(bbox.ymax()-bbox.ymin())/100;
-  double zd=(bbox.zmax()-bbox.zmin())/100;
-  bbox=CGAL::Bbox_3(bbox.xmin()-xd, bbox.ymin()-yd, bbox.zmin()-zd,
-                    bbox.xmax()+xd, bbox.ymax()+yd, bbox.zmax()+zd);
-  Polyhedron clipping_polyhedron=clip_to_bbox<Polyhedron>(bbox, p);
-
-  if (clipping_polyhedron.empty()) //no intersection, result is all or nothing
-  {
-    if (p.oriented_side(*P.points_begin())==ON_POSITIVE_SIDE)
-      P.clear();
-    return;
-  }
-
-  // set for marking edges of P intersected by the clipping plane
-  std::set<typename Polyhedron::Halfedge_handle> marked_halfedges;
-  internal::Edge_is_marked4coref<Polyhedron> cr_edge_is_marked(marked_halfedges);
-  typedef typename Polyhedron::Traits::Kernel K;
-  typedef CGAL::Node_visitor_refine_polyhedra<
-            Polyhedron,K,internal::Edge_is_marked4coref<Polyhedron> >
-                  Split_visitor;
-    Split_visitor visitor(NULL, true, cr_edge_is_marked);
-    CGAL::Intersection_of_Polyhedra_3<Polyhedron,K,Split_visitor>
-      polyline_intersections(visitor);
-    CGAL::Emptyset_iterator emptyset_iterator;
-    // corefinement P and clipping_polyhedron
-    polyline_intersections(P,clipping_polyhedron,emptyset_iterator);
-
-    // extract connected components bounded by marked edges
-    internal::Edge_is_marked<Polyhedron> edge_is_marked(marked_halfedges);
-    namespace PMP=Polygon_mesh_processing;
-    std::map<typename Polyhedron::Face_handle, std::size_t> face_ccs;
-    std::size_t nb_cc=PMP::connected_components(P,
-      boost::make_assoc_property_map(face_ccs),
-      PMP::parameters::edge_is_constrained_map(edge_is_marked)
-        .face_index_map(get(boost::face_external_index,P))
-    );
-
-    // remove cc on the positive side of the plane
-    std::vector<bool> cc_handled(nb_cc, false);
-    std::vector<std::size_t> ccs_to_remove;
-    BOOST_FOREACH(typename Polyhedron::Face_handle f, faces(P))
-    {
-      std::size_t cc_id=face_ccs[f];
-      if (cc_handled[cc_id]) continue;
-
-      //look for a vertex not on the intersection
-      typename Polyhedron::Halfedge_handle h=f->halfedge();
-      for(int i=0;i<3;++i){
-        bool no_marked_edge=true;
-        BOOST_FOREACH(typename Polyhedron::Halfedge_handle h, halfedges_around_target(h, P))
-          if ( marked_halfedges.count(h) )
-            no_marked_edge=false;
-        if (no_marked_edge){
-          if ( p.oriented_side(h->vertex()->point())==ON_POSITIVE_SIDE )
-            ccs_to_remove.push_back(cc_id);
-          cc_handled[cc_id]=true;
-          if (--nb_cc==0) break;
-          break;
-        }
-        h=h->next();
-      }
-    }
-
-  //now remove the faces on the positive side
-  PMP::remove_connected_components(P,
-    ccs_to_remove,
-    boost::make_assoc_property_map(face_ccs),
-    PMP::parameters::vertex_index_map(get(boost::vertex_external_index,P))
-  );
-}
-
-} } // CGAL::corefinement
-
-
-#endif // CGAL_INTERNAL_POLYHEDRON_PLANE_CLIPPING_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Periodic_3_orientation_3.h b/3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Periodic_3_orientation_3.h
deleted file mode 100644
index 34e739a..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Periodic_3_orientation_3.h
+++ /dev/null
@@ -1,267 +0,0 @@
-// Copyright (c) 2001,2004,2008-2009   INRIA Sophia-Antipolis (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
-// 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(s)     : Sylvain Pion <Sylvain.Pion at sophia.inria.fr>
-//                 Manuel Caroli <Manuel.Caroli at sophia.inria.fr>
-
-#ifndef CGAL_INTERNAL_STATIC_FILTERS_PERIODIC_3_ORIENTATION_3_H
-#define CGAL_INTERNAL_STATIC_FILTERS_PERIODIC_3_ORIENTATION_3_H
-
-#include <CGAL/Profile_counter.h>
-#include <CGAL/internal/Static_filters/Static_filter_error.h>
-
-#include <CGAL/Periodic_3_offset_3.h>
-
-#include <cmath>
-
-namespace CGAL { namespace internal { namespace Static_filters_predicates {
-
-template < typename K_base >
-class Periodic_3_orientation_3
-  : public K_base::Orientation_3
-{
-  typedef typename K_base::Orientation_3    Base;
-  
-  typedef typename K_base::Point_3          Point_3;
-  typedef typename K_base::Vector_3         Vector_3;
-  typedef typename K_base::Iso_cuboid_3     Iso_cuboid_3;
-  typedef typename K_base::Sphere_3         Sphere_3;
-  typedef CGAL::Periodic_3_offset_3         Offset;
-
-public:
-  const Iso_cuboid_3 * const _dom;
-
-public:
- typedef typename Base::result_type  result_type;
-
- template <class EX, class AP>
- Periodic_3_orientation_3(const Iso_cuboid_3 * const dom,
-     const EX * dom_e, const AP * dom_f) : Base(dom_e,dom_f), _dom(dom) {
- }
-
-#ifndef CGAL_CFG_MATCHING_BUG_6
-  using Base::operator();
-#else 
-  result_type
-  operator()(const Vector_3& u, const Vector_3& v, const Vector_3& w) const
-  { 
-    return Base::operator()(u,v,w);
-  }  
-
-  result_type
-  operator()(const Sphere_3& s) const
-  { 
-    return Base::operator()(s);
-  }
-#endif
-
-  result_type 
-  operator()(const Point_3 &p, const Point_3 &q,
-	     const Point_3 &r, const Point_3 &s) const
-  {
-      CGAL_PROFILER("Periodic_3_orientation_3 calls");
-
-      double px, py, pz, qx, qy, qz, rx, ry, rz, sx, sy, sz;
-
-      if (fit_in_double(p.x(), px) && fit_in_double(p.y(), py) &&
-          fit_in_double(p.z(), pz) &&
-          fit_in_double(q.x(), qx) && fit_in_double(q.y(), qy) &&
-          fit_in_double(q.z(), qz) &&
-          fit_in_double(r.x(), rx) && fit_in_double(r.y(), ry) &&
-          fit_in_double(r.z(), rz) &&
-          fit_in_double(s.x(), sx) && fit_in_double(s.y(), sy) &&
-          fit_in_double(s.z(), sz))
-      {
-          CGAL_PROFILER("Periodic_3_orientation_3 semi-static attempts");
-
-          double pqx = qx - px;
-          double pqy = qy - py;
-          double pqz = qz - pz;
-          double prx = rx - px;
-          double pry = ry - py;
-          double prz = rz - pz;
-          double psx = sx - px;
-          double psy = sy - py;
-          double psz = sz - pz;
-
-          // Then semi-static filter.
-          double maxx = CGAL::abs(pqx);
-          double maxy = CGAL::abs(pqy);
-          double maxz = CGAL::abs(pqz);
-
-          double aprx = CGAL::abs(prx);
-          double apsx = CGAL::abs(psx);
-
-          double apry = CGAL::abs(pry);
-          double apsy = CGAL::abs(psy);
-
-          double aprz = CGAL::abs(prz);
-          double apsz = CGAL::abs(psz);
-
-          if (maxx < aprx) maxx = aprx;
-          if (maxx < apsx) maxx = apsx;
-          if (maxy < apry) maxy = apry;
-          if (maxy < apsy) maxy = apsy;
-          if (maxz < aprz) maxz = aprz;
-          if (maxz < apsz) maxz = apsz;
-          double eps = 5.1107127829973299e-15 * maxx * maxy * maxz;
-          double det = CGAL::determinant(pqx, pqy, pqz,
-                                         prx, pry, prz,
-                                         psx, psy, psz);
-
-          // Sort maxx < maxy < maxz.
-          if (maxx > maxz)
-              std::swap(maxx, maxz);
-          if (maxy > maxz)
-              std::swap(maxy, maxz);
-          else if (maxy < maxx)
-              std::swap(maxx, maxy);
-
-          // Protect against underflow in the computation of eps.
-          if (maxx < 1e-97) /* cbrt(min_double/eps) */ {
-            if (maxx == 0)
-              return ZERO;
-          }
-          // Protect against overflow in the computation of det.
-          else if (maxz < 1e102) /* cbrt(max_double [hadamard]/4) */ {
-            if (det > eps)  return POSITIVE;
-            if (det < -eps) return NEGATIVE;
-          }
-
-          CGAL_PROFILER("Periodic_3_orientation_3 semi-static failures");
-      }
-
-      return Base::operator()(p, q, r, s);
-  }
-
-  result_type
-  operator()(const Point_3 &p, const Point_3 &q,
-      const Point_3 &r, const Point_3 &s,
-      const Offset &o_p, const Offset &o_q,
-      const Offset &o_r, const Offset &o_s) const {
-
-      CGAL_PROFILER("Periodic_3_orientation_3 calls");
-
-      double px, py, pz, qx, qy, qz, rx, ry, rz, sx, sy, sz;
-      double domxmax, domxmin, domymax, domymin, domzmax, domzmin;
-      int opx = o_p.x();
-      int opy = o_p.y();
-      int opz = o_p.z();
-
-      if (fit_in_double(p.x(), px) && fit_in_double(p.y(), py) &&
-          fit_in_double(p.z(), pz) &&
-          fit_in_double(q.x(), qx) && fit_in_double(q.y(), qy) &&
-          fit_in_double(q.z(), qz) &&
-          fit_in_double(r.x(), rx) && fit_in_double(r.y(), ry) &&
-          fit_in_double(r.z(), rz) &&
-          fit_in_double(s.x(), sx) && fit_in_double(s.y(), sy) &&
-          fit_in_double(s.z(), sz) &&
-	  fit_in_double(_dom->xmax(), domxmax) &&
-	  fit_in_double(_dom->xmin(), domxmin) &&
-	  fit_in_double(_dom->ymax(), domymax) &&
-	  fit_in_double(_dom->ymin(), domymin) &&
-	  fit_in_double(_dom->zmax(), domzmax) &&
-	  fit_in_double(_dom->zmin(), domzmin))
-      {
-          CGAL_PROFILER("Periodic_3_orientation_3 semi-static attempts");
-
-	  double domx = domxmax - domxmin;
-	  double domy = domymax - domymin;
-	  double domz = domzmax - domzmin;
-
-          double pqx = qx - px + domx * ( o_q.x() - opx );
-          double pqy = qy - py + domy * ( o_q.y() - opy );
-          double pqz = qz - pz + domz * ( o_q.z() - opz );
-          double prx = rx - px + domx * ( o_r.x() - opx );
-          double pry = ry - py + domy * ( o_r.y() - opy );
-          double prz = rz - pz + domz * ( o_r.z() - opz );
-          double psx = sx - px + domx * ( o_s.x() - opx );
-          double psy = sy - py + domy * ( o_s.y() - opy );
-          double psz = sz - pz + domz * ( o_s.z() - opz );
-
-          // Then semi-static filter.
-          double maxx = CGAL::abs(pqx);
-          double maxy = CGAL::abs(pqy);
-          double maxz = CGAL::abs(pqz);
-
-          double aprx = CGAL::abs(prx);
-          double apry = CGAL::abs(pry);
-          double aprz = CGAL::abs(prz);
-
-          double apsx = CGAL::abs(psx);
-          double apsy = CGAL::abs(psy);
-          double apsz = CGAL::abs(psz);
-
-          if (maxx < aprx) maxx = aprx;
-          if (maxx < apsx) maxx = apsx;
-
-          if (maxy < apry) maxy = apry;
-          if (maxy < apsy) maxy = apsy;
-
-          if (maxz < aprz) maxz = aprz;
-          if (maxz < apsz) maxz = apsz;
-          double eps = 4.111024169857068197e-15 * maxx * maxy * maxz;
-          double det = CGAL::determinant(pqx, pqy, pqz,
-                                         prx, pry, prz,
-                                         psx, psy, psz);
-
-          // Sort maxx < maxy < maxz.
-          if (maxx > maxz)
-              std::swap(maxx, maxz);
-          if (maxy > maxz)
-              std::swap(maxy, maxz);
-          else if (maxy < maxx)
-              std::swap(maxx, maxy);
-
-          // Protect against underflow in the computation of eps.
-          if (maxx < 1e-97) /* cbrt(min_double/eps) */ {
-            if (maxx == 0)
-              return ZERO;
-          }
-          // Protect against overflow in the computation of det.
-          else if (maxz < 1e102) /* cbrt(max_double [hadamard]/4) */ {
-            if (det > eps)  return POSITIVE;
-            if (det < -eps) return NEGATIVE;
-          }
-
-          CGAL_PROFILER("Periodic_3_orientation_3 semi-static failures");
-      }
-
-      return Base::operator()(p,q,r,s,o_p,o_q,o_r,o_s);
-  }
-
-  // Computes the epsilon for Periodic_3_orientation_3.
-  static double compute_epsilon()
-  {
-    typedef Static_filter_error F;
-    F t1 = F(1, F::ulp()/4);         // First translation
-    F det = CGAL::determinant(t1, t1, t1,
-                              t1, t1, t1,
-                              t1, t1, t1); // Full det
-    double err = det.error();
-    err += err * 2 * F::ulp(); // Correction due to "eps * maxx * maxy...".
-    std::cerr << "*** epsilon for Periodic_3_orientation_3 = " << err 
-	      << std::endl;
-    return err;
-  }
-
-};
-
-} } } // namespace CGAL::internal::Static_filters_predicates
-
-#endif // CGAL_INTERNAL_STATIC_FILTERS_PERIODIC_3_ORIENTATION_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Periodic_3_side_of_oriented_sphere_3.h b/3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Periodic_3_side_of_oriented_sphere_3.h
deleted file mode 100644
index a88d2cc..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Periodic_3_side_of_oriented_sphere_3.h
+++ /dev/null
@@ -1,299 +0,0 @@
-// Copyright (c) 2001,2004,2008-2009   INRIA Sophia-Antipolis (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
-// 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(s)     : Sylvain Pion <Sylvain.Pion at sophia.inria.fr>
-//                 Manuel Caroli <Manuel.Caroli at sophia.inria.fr>
-
-#ifndef CGAL_INTERNAL_STATIC_FILTERS_PERIODIC_3_SIDE_OF_ORIENTED_SPHERE_3_H
-#define CGAL_INTERNAL_STATIC_FILTERS_PERIODIC_3_SIDE_OF_ORIENTED_SPHERE_3_H
-
-#include <CGAL/Profile_counter.h>
-#include <CGAL/internal/Static_filters/Static_filter_error.h>
-
-#include <CGAL/Periodic_3_offset_3.h>
-
-namespace CGAL { namespace internal { namespace Static_filters_predicates {
-
-template < typename K_base >
-class Periodic_3_side_of_oriented_sphere_3
-  : public K_base::Side_of_oriented_sphere_3
-{
-  typedef typename K_base::Side_of_oriented_sphere_3    Base;
-
-  typedef typename K_base::Point_3                      Point_3;
-  typedef typename K_base::Iso_cuboid_3                 Iso_cuboid_3;
-  typedef CGAL::Periodic_3_offset_3                     Offset;
-
-public:
-  const Iso_cuboid_3 * _dom;
-
-public:
-  typedef typename Base::result_type  result_type;
-
-  template <class EX, class AP>
-  Periodic_3_side_of_oriented_sphere_3(const Iso_cuboid_3 * dom,
-					    const EX * dom_e,
-					    const AP * dom_f)
-      : Base(dom_e,dom_f), _dom(dom) { }
-
-  Oriented_side
-  operator()(const Point_3 &p, const Point_3 &q, const Point_3 &r,
-             const Point_3 &s, const Point_3 &t) const
-  {
-      CGAL_PROFILER("Periodic_3_side_of_oriented_sphere_3 calls");
-
-
-      double px, py, pz, qx, qy, qz, rx, ry, rz, sx, sy, sz, tx, ty, tz;
-
-      if (fit_in_double(p.x(), px) && fit_in_double(p.y(), py) &&
-          fit_in_double(p.z(), pz) &&
-          fit_in_double(q.x(), qx) && fit_in_double(q.y(), qy) &&
-          fit_in_double(q.z(), qz) &&
-          fit_in_double(r.x(), rx) && fit_in_double(r.y(), ry) &&
-          fit_in_double(r.z(), rz) &&
-          fit_in_double(s.x(), sx) && fit_in_double(s.y(), sy) &&
-          fit_in_double(s.z(), sz) &&
-          fit_in_double(t.x(), tx) && fit_in_double(t.y(), ty) &&
-          fit_in_double(t.z(), tz))
-      {
-          CGAL_PROFILER("Periodic_3_side_of_oriented_sphere_3 semi-static attempts");
-
-          double ptx = px - tx;
-          double pty = py - ty;
-          double ptz = pz - tz;
-          double pt2 = CGAL_NTS square(ptx) + CGAL_NTS square(pty)
-	             + CGAL_NTS square(ptz);
-          double qtx = qx - tx;
-          double qty = qy - ty;
-          double qtz = qz - tz;
-          double qt2 = CGAL_NTS square(qtx) + CGAL_NTS square(qty)
-	             + CGAL_NTS square(qtz);
-          double rtx = rx - tx;
-          double rty = ry - ty;
-          double rtz = rz - tz;
-          double rt2 = CGAL_NTS square(rtx) + CGAL_NTS square(rty)
-	             + CGAL_NTS square(rtz);
-          double stx = sx - tx;
-          double sty = sy - ty;
-          double stz = sz - tz;
-          double st2 = CGAL_NTS square(stx) + CGAL_NTS square(sty)
-	             + CGAL_NTS square(stz);
-
-          // Compute the semi-static bound.
-          double maxx = CGAL::abs(ptx);
-          double maxy = CGAL::abs(pty);
-          double maxz = CGAL::abs(ptz);
-
-          double aqtx = CGAL::abs(qtx);
-          double aqty = CGAL::abs(qty);
-          double aqtz = CGAL::abs(qtz);
-
-          double artx = CGAL::abs(rtx);
-          double arty = CGAL::abs(rty);
-          double artz = CGAL::abs(rtz);
-
-          double astx = CGAL::abs(stx);
-          double asty = CGAL::abs(sty);
-          double astz = CGAL::abs(stz);
-          
-          if (maxx < aqtx) maxx = aqtx;
-          if (maxx < artx) maxx = artx;
-          if (maxx < astx) maxx = astx;
-
-          if (maxy < aqty) maxy = aqty;
-          if (maxy < arty) maxy = arty;
-          if (maxy < asty) maxy = asty;
-
-          if (maxz < aqtz) maxz = aqtz;
-          if (maxz < artz) maxz = artz;
-          if (maxz < astz) maxz = astz;
-
-          // Sort maxx < maxy < maxz.
-          if (maxx > maxz)
-              std::swap(maxx, maxz);
-          if (maxy > maxz)
-              std::swap(maxy, maxz);
-          else if (maxy < maxx)
-              std::swap(maxx, maxy);
-
-          double eps = 1.2466136531027298e-13 * maxx * maxy * maxz
-                     * (maxz * maxz);
-
-          double det = CGAL::determinant(ptx,pty,ptz,pt2,
-                                         rtx,rty,rtz,rt2,
-                                         qtx,qty,qtz,qt2,
-                                         stx,sty,stz,st2);
-
-          // Protect against underflow in the computation of eps.
-          if (maxx < 1e-58) /* sqrt^5(min_double/eps) */ {
-            if (maxx == 0)
-              return ON_ORIENTED_BOUNDARY;
-          }
-          // Protect against overflow in the computation of det.
-          else if (maxz < 1e61) /* sqrt^5(max_double/4 [hadamard]) */ {
-            if (det > eps)  return ON_POSITIVE_SIDE;
-            if (det < -eps) return ON_NEGATIVE_SIDE;
-          }
-
-          CGAL_PROFILER("Periodic_3_side_of_oriented_sphere_3 semi-static failures");
-      }
-      return Base::operator()(p, q, r, s, t);
-  }
-
-  Oriented_side
-  operator()(const Point_3 &p, const Point_3 &q, const Point_3 &r,
-      const Point_3 &s, const Point_3 &t, const Offset &o_p,
-      const Offset &o_q, const Offset &o_r,
-      const Offset &o_s, const Offset &o_t) const {
-
-    CGAL_PROFILER("Periodic_3_side_of_oriented_sphere_3 calls");
-
-
-    double px, py, pz, qx, qy, qz, rx, ry, rz, sx, sy, sz, tx, ty, tz;
-    double domxmax, domxmin, domymax, domymin, domzmax, domzmin;
-    int otx = o_t.x();
-    int oty = o_t.y();
-    int otz = o_t.z();
-
-    if (fit_in_double(p.x(), px) && fit_in_double(p.y(), py) &&
-        fit_in_double(p.z(), pz) &&
-        fit_in_double(q.x(), qx) && fit_in_double(q.y(), qy) &&
-        fit_in_double(q.z(), qz) &&
-        fit_in_double(r.x(), rx) && fit_in_double(r.y(), ry) &&
-        fit_in_double(r.z(), rz) &&
-        fit_in_double(s.x(), sx) && fit_in_double(s.y(), sy) &&
-        fit_in_double(s.z(), sz) &&
-        fit_in_double(t.x(), tx) && fit_in_double(t.y(), ty) &&
-        fit_in_double(t.z(), tz) &&
-	fit_in_double(_dom->xmax(), domxmax) &&
-	fit_in_double(_dom->xmin(), domxmin) &&
-	fit_in_double(_dom->ymax(), domymax) &&
-	fit_in_double(_dom->ymin(), domymin) &&
-	fit_in_double(_dom->zmax(), domzmax) &&
-	fit_in_double(_dom->zmin(), domzmin))
-    {
-      CGAL_PROFILER("Periodic_3_side_of_oriented_sphere_3 semi-static attempts");
-
-      double domx = domxmax - domxmin;
-      double domy = domymax - domymin;
-      double domz = domzmax - domzmin;
-
-      double ptx = px - tx + domx * (o_p.x() - otx);
-      double pty = py - ty + domy * (o_p.y() - oty);
-      double ptz = pz - tz + domz * (o_p.z() - otz);
-      double pt2 = CGAL_NTS square(ptx) + CGAL_NTS square(pty)
-            + CGAL_NTS square(ptz);
-      double qtx = qx - tx + domx * (o_q.x() - otx);
-      double qty = qy - ty + domy * (o_q.y() - oty);
-      double qtz = qz - tz + domz * (o_q.z() - otz);
-      double qt2 = CGAL_NTS square(qtx) + CGAL_NTS square(qty)
-            + CGAL_NTS square(qtz);
-      double rtx = rx - tx + domx * (o_r.x() - otx);
-      double rty = ry - ty + domy * (o_r.y() - oty);
-      double rtz = rz - tz + domz * (o_r.z() - otz);
-      double rt2 = CGAL_NTS square(rtx) + CGAL_NTS square(rty)
-            + CGAL_NTS square(rtz);
-      double stx = sx - tx + domx * (o_s.x() - otx);
-      double sty = sy - ty + domy * (o_s.y() - oty);
-      double stz = sz - tz + domz * (o_s.z() - otz);
-      double st2 = CGAL_NTS square(stx) + CGAL_NTS square(sty)
-            + CGAL_NTS square(stz);
-
-      // Compute the semi-static bound.
-      double maxx = CGAL::abs(ptx);
-      double maxy = CGAL::abs(pty);
-      double maxz = CGAL::abs(ptz);
-      
-      double aqtx = CGAL::abs(qtx);
-      double aqty = CGAL::abs(qty);
-      double aqtz = CGAL::abs(qtz);
-
-      double artx = CGAL::abs(rtx);
-      double arty = CGAL::abs(rty);
-      double artz = CGAL::abs(rtz);
-
-      double astx = CGAL::abs(stx);
-      double asty = CGAL::abs(sty);
-      double astz = CGAL::abs(stz);
-      
-      if (maxx < aqtx) maxx = aqtx;
-      if (maxx < artx) maxx = artx;
-      if (maxx < astx) maxx = astx;
-
-      if (maxy < aqty) maxy = aqty;
-      if (maxy < arty) maxy = arty;
-      if (maxy < asty) maxy = asty;
-
-      if (maxz < aqtz) maxz = aqtz;
-      if (maxz < artz) maxz = artz;
-      if (maxz < astz) maxz = astz;
-
-      // Sort maxx < maxy < maxz.
-      if (maxx > maxz)
-          std::swap(maxx, maxz);
-      if (maxy > maxz)
-          std::swap(maxy, maxz);
-      else if (maxy < maxx)
-          std::swap(maxx, maxy);
-
-      double eps = 1.0466759304746772485e-13 * maxx * maxy * maxz
-                  * (maxz * maxz);
-
-      double det = CGAL::determinant(ptx,pty,ptz,pt2,
-                                      rtx,rty,rtz,rt2,
-                                      qtx,qty,qtz,qt2,
-                                      stx,sty,stz,st2);
-
-      // Protect against underflow in the computation of eps.
-      if (maxx < 1e-58) /* sqrt^5(min_double/eps) */ {
-        if (maxx == 0)
-          return ON_ORIENTED_BOUNDARY;
-      }
-      // Protect against overflow in the computation of det.
-      else if (maxz < 1e61) /* sqrt^5(max_double/4 [hadamard]) */ {
-        if (det > eps)  return ON_POSITIVE_SIDE;
-        if (det < -eps) return ON_NEGATIVE_SIDE;
-      }
-
-      CGAL_PROFILER("Periodic_3_side_of_oriented_sphere_3 semi-static failures");
-    }
-    return Base::operator()(p, q, r, s, t, o_p, o_q, o_r, o_s, o_t);
-  }
-
-  // Computes the epsilon for Periodic_3_side_of_oriented_sphere_3.
-  static double compute_epsilon()
-  {
-    typedef Static_filter_error F;
-    F t1 = F(1,F::ulp()/4);   // First translations
-    F sq = t1*t1+t1*t1+t1*t1; // squares
-    F det = CGAL::determinant(t1, t1, t1, sq,
-                              t1, t1, t1, sq,
-                              t1, t1, t1, sq,
-                              t1, t1, t1, sq); // Full det
-    double err = det.error();
-    err += err * 3 * F::ulp(); // Correction due to "eps * maxx * ...".
-
-    std::cerr << "*** epsilon for Periodic_3_side_of_oriented_sphere_3 = "
-	      << err << std::endl;
-    return err;
-  }
-};
-
-} } } // namespace CGAL::internal::Static_filters_predicates
-
-#endif // CGAL_INTERNAL_STATIC_FILTERS_PERIODIC_3_SIDE_OF_ORIENTED_SPHERE_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Static_filters.h b/3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Static_filters.h
deleted file mode 100644
index c373d36..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Static_filters.h
+++ /dev/null
@@ -1,302 +0,0 @@
-// Copyright (c) 2001,2004  INRIA Sophia-Antipolis (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(s)     : Sylvain Pion
- 
-#ifndef CGAL_INTERNAL_STATIC_FILTERS_H
-#define CGAL_INTERNAL_STATIC_FILTERS_H
-
-// This kernel wrapper gathers optimized predicates written by hand, using
-// a few steps of filtering.  It should work if the initial traits has
-// cartesian coordinates which fit exactly in doubles.
-//
-// Purely static filters code has been removed, since it requires additional
-// logic and is not plug'n play (requires users providing bounds).
-// If it should be provided again, it should probably be separate.
-
-#include <CGAL/basic.h>
-
-#include <CGAL/Kernel/function_objects.h>
-#include <CGAL/Cartesian/function_objects.h>
-
-#include <CGAL/internal/Static_filters/tools.h>
-#include <CGAL/internal/Static_filters/Orientation_2.h>
-#include <CGAL/internal/Static_filters/Orientation_3.h>
-
-// for static filters added nov./dec. 2011
-#ifdef CGAL_DISABLE_STATIC_FILTERS_ADDED_2011
-#  define CGAL_NO_EQUAL_3_STATIC_FILTERS 1
-#  define CGAL_NO_IS_DEGENERATE_3_STATIC_FILTERS 1
-#  define CGAL_NO_ANGLE_3_STATIC_FILTERS 1
-#  define CGAL_NO_DO_INTERSECT_3_STATIC_FILTERS 1
-#endif // CGAL_DISABLE_STATIC_FILTERS_ADDED_2011
-
-
-#ifndef CGAL_NO_EQUAL_3_STATIC_FILTERS
-#  include <CGAL/internal/Static_filters/Equal_3.h>
-#endif // NOT CGAL_NO_EQUAL_3_STATIC_FILTERS
-
-#ifndef CGAL_NO_IS_DEGENERATE_3_STATIC_FILTERS
-#  include <CGAL/internal/Static_filters/Is_degenerate_3.h>
-#endif // NOT CGAL_NO_IS_DEGENERATE_3_STATIC_FILTERS
-
-#ifndef CGAL_NO_ANGLE_3_STATIC_FILTERS
-#  include <CGAL/internal/Static_filters/Angle_3.h>
-#endif // NOT CGAL_NO_ANGLE_3_STATIC_FILTERS
-
-#ifndef CGAL_NO_DO_INTERSECT_3_STATIC_FILTERS
-#  include <CGAL/internal/Static_filters/Do_intersect_3.h>
-#endif // NOT NOT CGAL_NO_DO_INTERSECT_3_STATIC_FILTERS
-
-#include <CGAL/internal/Static_filters/Compare_y_at_x_2.h>
-#include <CGAL/internal/Static_filters/Side_of_oriented_circle_2.h>
-#include <CGAL/internal/Static_filters/Side_of_oriented_sphere_3.h>
-#include <CGAL/internal/Static_filters/Compare_squared_radius_3.h>
-
-// #include <CGAL/internal/Static_filters/Coplanar_orientation_3.h>
-// #include <CGAL/internal/Static_filters/Coplanar_side_of_bounded_circle_3.h>
-
-// TODO :
-// - add more predicates :
-//   - all lexicographical comparisons
-//   - left_turn (via generic adapter to orientation)
-//   - power_tests
-//   - others ?
-// - benchmark on more algorithms.
-// - improve fit_in_double() for other NTs (MP_Float, Lazy). cf tools.h.
-// - try to automatize : have a struct a la Static_filter_error, with one part
-//   which is runtime, and the other which can be constant-propagated by the
-//   compiler.  g++ 4.0 should be able to cprop the second part...
-
-
-// Note about the second parameter of Static_filters<K,bool>:
-// - if the access to Cartesian exact coordinates is cheap
-//   (Simple_cartesian, Cartesian), then one can implement predicates that
-//   just compare coordinates without filtering, using unfiltered
-//   predicates defined in the namespace CartesianKernelFunctors.
-// 
-// - in the case of Lazy_kernel, where the access to p.x(), for a point p,
-//   triggers the construction of a Lazy_exact_nt object, one does not want
-//   to use the functors from the namespace CartesianKernelFunctors.
-
-namespace CGAL { namespace internal {
-
-// Here is the case when has_cheap_access_to_cartesian_coordinates is
-// false, used by Lazy_kernel
-// The K_base argument is supposed to provide exact primitives.
-template < typename K_base, 
-           bool has_cheap_access_to_cartesian_coordinates = true>
-class Static_filters : public K_base {
-
-
-  typedef Static_filters<K_base, 
-                         has_cheap_access_to_cartesian_coordinates>         Self;
-
-public:
-#ifndef CGAL_NO_EQUAL_3_STATIC_FILTERS
-  typedef Static_filters_predicates::Equal_3<K_base>                        Equal_3;
-#endif // NOT CGAL_NO_EQUAL_3_STATIC_FILTERS
-
-#ifndef CGAL_NO_IS_DEGENERATE_3_STATIC_FILTERS
-  typedef Static_filters_predicates::Is_degenerate_3<K_base, Self>          Is_degenerate_3;
-#endif // NOT CGAL_NO_IS_DEGENERATE_3_STATIC_FILTERS
-  typedef Static_filters_predicates::Orientation_2<K_base>                  Orientation_2;
-  typedef Static_filters_predicates::Orientation_3<K_base>                  Orientation_3;
-#ifndef CGAL_NO_ANGLE_3_STATIC_FILTERS
-  typedef Static_filters_predicates::Angle_3<K_base>                        Angle_3;
-#endif // NOT CGAL_NO_ANGLE_3_STATIC_FILTERS
-#ifndef CGAL_NO_DO_INTERSECT_3_STATIC_FILTERS
-  typedef Static_filters_predicates::Do_intersect_3<K_base,Self>            Do_intersect_3;
-#endif // NOT CGAL_NO_DO_INTERSECT_3_STATIC_FILTERS
-  typedef Static_filters_predicates::Side_of_oriented_circle_2<K_base>      Side_of_oriented_circle_2;
-  typedef Static_filters_predicates::Side_of_oriented_sphere_3<K_base>      Side_of_oriented_sphere_3;
-  typedef Static_filters_predicates::Compare_squared_radius_3<K_base>       Compare_squared_radius_3;
-
-  Orientation_2
-  orientation_2_object() const
-  { return Orientation_2(); }
-
-  Orientation_3
-  orientation_3_object() const
-  { return Orientation_3(); }
-
-#ifndef CGAL_NO_EQUAL_3_STATIC_FILTERS
- Equal_3
-  equal_3_object() const
-  { return Equal_3(); }
-#endif // NOT CGAL_NO_EQUAL_3_STATIC_FILTERS
-
-#ifndef CGAL_NO_IS_DEGENERATE_3_STATIC_FILTERS
- Is_degenerate_3
-  is_degenerate_3_object() const
-  { return Is_degenerate_3(); }
-#endif // NOT CGAL_NO_IS_DEGENERATE_3_STATIC_FILTERS
-
-#ifndef CGAL_NO_ANGLE_3_STATIC_FILTERS
-  Angle_3
-  angle_3_object() const
-  { return Angle_3(); }
-#endif // NOT CGAL_NO_ANGLE_3_STATIC_FILTERS
-
-#ifndef CGAL_NO_DO_INTERSECT_3_STATIC_FILTERS
-  Do_intersect_3
-  do_intersect_3_object() const
-  { return Do_intersect_3(); }
-#endif // NOT CGAL_NO_DO_INTERSECT_3_STATIC_FILTERS
-
-  Side_of_oriented_circle_2
-  side_of_oriented_circle_2_object() const
-  { return Side_of_oriented_circle_2(); }
-
-  Side_of_oriented_sphere_3
-  side_of_oriented_sphere_3_object() const
-  { return Side_of_oriented_sphere_3(); }
-
-  Compare_squared_radius_3
-  compare_squared_radius_3_object() const
-  { return Compare_squared_radius_3(); }
-
-  enum { Has_static_filters = true };
-}; // end of class template Static_filters<K_base, false>
-
-
-// Here is the case when has_cheap_access_to_cartesian_coordinates is true,
-// the default, used by Filtered_kernel<CK>.
-// The K_base argument is supposed to provide exact primitives.
-template < typename K_base>
-class Static_filters<K_base, true> // has_cheap_access_to_cartesian_coordinates==true
-  : public Static_filters<K_base, false>
-{
-  typedef Static_filters<K_base, true>              Self;
-
-public:
-
-  typedef Static_filters_predicates::Compare_y_at_x_2<K_base,Self>          Compare_y_at_x_2;
-
-  // The following do not require filtering as they only do
-  // comparisons.  We must be careful that *all* their function
-  // operators must not do any comparisons.
-  // In case we would like to avoid filtering only some of
-  // the function operators, we need to make a new functors.
-  typedef CommonKernelFunctors::Left_turn_2<Self>   Left_turn_2;
-
-  typedef CartesianKernelFunctors::Less_x_2<Self>   Less_x_2;
-  typedef CartesianKernelFunctors::Less_y_2<Self>   Less_y_2;
-  typedef CartesianKernelFunctors::Less_xy_2<Self>  Less_xy_2;
-  typedef CartesianKernelFunctors::Less_yx_2<Self>  Less_yx_2;
-
-  typedef CartesianKernelFunctors::Less_x_3<Self>   Less_x_3;
-  typedef CartesianKernelFunctors::Less_y_3<Self>   Less_y_3;
-  typedef CartesianKernelFunctors::Less_z_3<Self>   Less_z_3;
-  typedef CartesianKernelFunctors::Less_xy_3<Self>  Less_xy_3;
-  typedef CartesianKernelFunctors::Less_xyz_3<Self> Less_xyz_3;
-
-  typedef CartesianKernelFunctors::Compare_xy_2<Self>  Compare_xy_2;
-  typedef CartesianKernelFunctors::Compare_x_3<Self>   Compare_x_3;
-  typedef CartesianKernelFunctors::Compare_y_3<Self>   Compare_y_3;
-  typedef CartesianKernelFunctors::Compare_z_3<Self>   Compare_z_3;
-  typedef CartesianKernelFunctors::Compare_xy_3<Self>  Compare_xy_3;
-  typedef CartesianKernelFunctors::Compare_xyz_3<Self> Compare_xyz_3;
-
-  Compare_xy_2
-  compare_xy_2_object() const
-  { return Compare_xy_2(); }
-
-  Compare_x_3
-  compare_x_3_object() const
-  { return Compare_x_3(); }
-
-  Compare_y_3
-  compare_y_3_object() const
-  { return Compare_y_3(); }
-
-  Compare_z_3
-  compare_z_3_object() const
-  { return Compare_z_3(); }
-
-  Compare_xy_3
-  compare_xy_3_object() const
-  { return Compare_xy_3(); }
-
-  Compare_xyz_3
-  compare_xyz_3_object() const
-  { return Compare_xyz_3(); }
-
-  Left_turn_2
-  left_turn_2_object() const
-  { return Left_turn_2(); }
-
-  Less_x_2
-  less_x_2_object() const
-  { return Less_x_2(); }
-
-  Less_y_2
-  less_y_2_object() const
-  { return Less_y_2(); }
-
-  Less_xy_2
-  less_xy_2_object() const
-  { return Less_xy_2(); }
-
-  Less_yx_2
-  less_yx_2_object() const
-  { return Less_yx_2(); }
-
-  Less_x_3
-  less_x_3_object() const
-  { return Less_x_3(); }
-
-  Less_y_3
-  less_y_3_object() const
-  { return Less_y_3(); }
-
-  Less_z_3
-  less_z_3_object() const
-  { return Less_z_3(); }
-
-  Less_xy_3
-  less_xy_3_object() const
-  { return Less_xy_3(); }
-
-  Less_xyz_3
-  less_xyz_3_object() const
-  { return Less_xyz_3(); }
-
-  Compare_y_at_x_2
-  compare_y_at_x_2_object() const
-  { return Compare_y_at_x_2(); }
-
-  // The two following are for degenerate cases, so I'll update them later.
-  //
-  // typedef Static_filters_predicates::Coplanar_orientation_3<Point_3, Orientation_2>
-  //                                                   Coplanar_orientation_3;
-  // typedef Static_filters_predicates::Side_of_bounded_circle_3<Point_3>
-  //                                         Coplanar_side_of_bounded_circle_3;
-
-  // Coplanar_orientation_3
-  // coplanar_orientation_3_object() const
-  // { return Coplanar_orientation_3(); }
-
-  // Coplanar_side_of_bounded_circle_3
-  // coplanar_side_of_bounded_circle_3_object() const
-  // { return Coplanar_side_of_bounded_circle_3(); }
-};
-
-} } // namespace CGAL::internal
-
-#endif // CGAL_INTERNAL_STATIC_FILTERS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/tools.h b/3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/tools.h
deleted file mode 100644
index 2556177..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/tools.h
+++ /dev/null
@@ -1,193 +0,0 @@
-// Copyright (c) 2001,2004  INRIA Sophia-Antipolis (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(s)     : Sylvain Pion
- 
-#ifndef CGAL_INTERNAL_STATIC_FILTERS_TOOLS_H
-#define CGAL_INTERNAL_STATIC_FILTERS_TOOLS_H
-
-#include <CGAL/basic.h>
-#include <CGAL/function_objects.h>
-#include <boost/mpl/has_xxx.hpp>
-
-namespace CGAL {
-
-template < typename ET >
-class Lazy_exact_nt;
-
-namespace internal {
-
-// Utility function to check a posteriori that a subtraction was performed
-// without rounding error.
-inline bool diff_was_exact(double a, double b, double ab)
-{
-    return ab+b == a && a-ab == b;
-}
-
-template < typename T >
-inline void init_double(double&, T* ) {}
-
-template < typename T >
-inline void init_double(double&, double&, T* ) {}
-
-template < typename T >
-inline void init_double(double&, double&, double&, T* ) {}
-
-template < typename T >
-inline void init_double(double&, double&, double&, double&, T* ) {}
-
-template < typename T >
-inline void init_double(double&, double&, double&, double&, double&, T* ) {}
-
-template < typename T >
-inline void init_double(double&, double&, double&, double&, double&, double&, T* ) {}
-
-template < typename T >
-inline void init_double(double&, double&, double&, double&, double&, double&, double&, T* ) {}
-
-template < typename T >
-inline void init_double(double&, double&, double&, double&, double&, double&, double&, double&, T* ) {}
-
-template < typename T >
-inline void init_double(double&, double&, double&,double&, double&, double&, double&, double&, double&, T* ) {}
-
-template < typename T >
-inline void init_double(double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, T* ) {}
-
-
-template < typename T >
-inline void init_double(double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, T* ) {}
-
-
-template < typename T >
-inline void init_double(double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, T* ) {}
-
-
-template < typename T >
-inline void init_double(double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, T* ) {}
-
-
-
-template < typename ET >
-inline void init_double(double& d0, Lazy_exact_nt<ET>* )
-{d0 = 0;}
-
-template < typename ET >
-inline void init_double(double& d0, double& d1, Lazy_exact_nt<ET>* )
-{d0 = d1 = 0;}
-
-template < typename ET >
-inline void init_double(double& d0, double& d1, double& d2, Lazy_exact_nt<ET>* )
-{d0 = d1 = d2 = 0;}
-
-template < typename ET >
-inline void init_double(double& d0, double& d1, double& d2, double& d3, Lazy_exact_nt<ET>* )
-{d0 = d1 = d2 = d3 = 0;}
-
-template < typename ET >
-inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, Lazy_exact_nt<ET>* )
-{d0 = d1 = d2 = d3 = d4 = 0;}
-
-template < typename ET >
-inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, double& d5, Lazy_exact_nt<ET>* )
-{d0 = d1 = d2 = d3 = d4 = d5 = 0;}
-
-template < typename ET >
-inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, double& d5, double& d6, Lazy_exact_nt<ET>* )
-{d0 = d1 = d2 = d3 = d4 = d5 = d6 = 0;}
-
-template < typename ET >
-inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, double& d5, double& d6, double& d7, Lazy_exact_nt<ET>* )
-{d0 = d1 = d2 = d3 = d4 = d5 = d6 = d7 = 0;}
-
-template < typename ET >
-inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, double& d5, double& d6, double& d7, double& d8, Lazy_exact_nt<ET>* )
-{d0 = d1 = d2 = d3 = d4 = d5 = d6 = d7 = d8 = 0;}
-
-template < typename ET >
-inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, double& d5, double& d6, double& d7, double&d8, double& d9, Lazy_exact_nt<ET>* )
-{d0 = d1 = d2 = d3 = d4 = d5 = d6 = d7 = d8 = d9 = 0;}
-
-template < typename ET >
-inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, double& d5, double& d6, double& d7, double&d8, double& d9, double& d10, Lazy_exact_nt<ET>* )
-{d0 = d1 = d2 = d3 = d4 = d5 = d6 = d7 = d8 = d9 = d10 = 0;}
-
-template < typename ET >
-inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, double& d5, double& d6, double& d7, double&d8, double& d9, double& d10, double& d11, Lazy_exact_nt<ET>* )
-{d0 = d1 = d2 = d3 = d4 = d5 = d6 = d7 = d8 = d9 = d10 = d11 = 0;}
-
-template < typename ET >
-inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, double& d5, double& d6, double& d7, double&d8, double& d9, double& d10, double& d11, double& d12, Lazy_exact_nt<ET>* )
-{d0 = d1 = d2 = d3 = d4 = d5 = d6 = d7 = d8 = d9 = d10 = d11 = d12 = 0;}
-
-
-// Auxiliary function to check if static filters can be applied, that is,
-// if to_double() does not add roundoff errors.
-// TODO :
-// - generalize it to other number types.
-// - promote it as a number type requirement ?
-// - naming : is_representable_in_double() ?
-//            is_representable<T>() for representable in T ?
-
-// Current semantics :  bool fit_in_double(const NT& n, double &)
-//
-// - returns true means that "n" is exactly representable by a double,
-//   _and_ then "returns" it in the reference.
-// - it is fine to return false conservatively.
-
-template < typename T >
-inline bool fit_in_double(const T&, double&) { return false; }
-
-inline bool fit_in_double(const double& d, double& r) { r = d; return true; }
-
-inline bool fit_in_double(const float& f, double& r) { r = f; return true; }
-
-inline bool fit_in_double(const int& i, double& r) { r = i; return true; }
-
-template < typename ET >
-inline bool fit_in_double(const Lazy_exact_nt<ET>&, double&);
-
-
-// Auxiliary functor, to get the approximation of a kernel object:
-//   - for a Point_3 of the Lazy_kernel<...>, one needs to call approx(),
-//   - for a Point_3 of Simple_cartesian<double>, for example, the
-//     approximation is the object itself.
-
-namespace Static_filters_predicates {
-
-BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Kernel_object_has_approx, \
-                                  Approximate_type, \
-                                  false)
-
-template <typename T, bool has_approx = Kernel_object_has_approx<T>::value>
-struct Get_approx : public CGAL::Identity<T> {
-  // If has_approx==false, this functor is the identity.
-};
-
-template <typename T>
-struct Get_approx<T, true> {
-  // If has_approx==false, this functor get .approx() on its argument.
-  const typename T::Approximate_type& operator()(const T& x) const { return x.approx(); }
-  typename T::Approximate_type& operator()(T& x) const { return x.approx(); }
-};
-
-} // end namespace Static_filters_predicates
-
-} } // namespace CGAL::internal
-
-#endif // CGAL_INTERNAL_STATIC_FILTERS_TOOLS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Surface_mesh_segmentation/AABB_traversal_traits.h b/3rdparty/CGAL-4.8/include/CGAL/internal/Surface_mesh_segmentation/AABB_traversal_traits.h
deleted file mode 100644
index d470fc2..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/internal/Surface_mesh_segmentation/AABB_traversal_traits.h
+++ /dev/null
@@ -1,76 +0,0 @@
-#ifndef CGAL_INTERNAL_SURFACE_MESH_SEGMENTATION_AABB_TRAVERSAL_TRAITS_H
-// Copyright (c) 2014  GeometryFactory Sarl (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
-// 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.
-
-
-#define CGAL_INTERNAL_SURFACE_MESH_SEGMENTATION_AABB_TRAVERSAL_TRAITS_H
-
-namespace CGAL
-{
-
-/// @cond CGAL_DOCUMENT_INTERNAL
-
-/**
- * @class Special case for ray/segment-triangle
- * the only difference with the offical one (Listing_intersection_traits) is that
- * is the do_intersect which is made prior to the intersection call.
- */
-template<typename AABBTraits, typename Query, typename Output_iterator>
-class Listing_intersection_traits_ray_or_segment_triangle
-{
-  typedef typename AABBTraits::FT FT;
-  typedef typename AABBTraits::Point_3 Point;
-  typedef typename AABBTraits::Primitive Primitive;
-  typedef typename AABBTraits::Bounding_box Bounding_box;
-  typedef typename AABBTraits::Primitive::Id Primitive_id;
-  typedef typename AABBTraits::Point_and_primitive_id Point_and_primitive_id;
-  typedef typename AABBTraits::Object_and_primitive_id Object_and_primitive_id;
-  typedef ::CGAL::AABB_node<AABBTraits> Node;
-  typedef typename ::CGAL::AABB_tree<AABBTraits>::size_type size_type;
-
-public:
-  Listing_intersection_traits_ray_or_segment_triangle(Output_iterator out_it,
-      const AABBTraits& traits)
-    : m_out_it(out_it), m_traits(traits) {}
-
-  bool go_further() const {
-    return true;
-  }
-
-  void intersection(const Query& query, const Primitive& primitive) {
-    //SL: using Kernel_traits is not bad in this context cause we expect a Ray/Segment from a CGAL Kernel here
-    typedef typename Kernel_traits<Query>::Kernel GeomTraits;
-    if ( GeomTraits().do_intersect_3_object()(query,
-         primitive.datum(m_traits.shared_data())) ) {
-      boost::optional<Object_and_primitive_id> intersection;
-      intersection = m_traits.intersection_object()(query, primitive);
-      if(intersection) {
-        *m_out_it++ = *intersection;
-      }
-    }
-  }
-
-  bool do_intersect(const Query& query, const Node& node) const {
-    return m_traits.do_intersect_object()(query, node.bbox());
-  }
-
-private:
-  Output_iterator m_out_it;
-  const AABBTraits& m_traits;
-};
-
-/// @endcond
-
-} //namespace CGAL
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Surface_mesh_segmentation/SDF_calculation.h b/3rdparty/CGAL-4.8/include/CGAL/internal/Surface_mesh_segmentation/SDF_calculation.h
deleted file mode 100644
index 5954489..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/internal/Surface_mesh_segmentation/SDF_calculation.h
+++ /dev/null
@@ -1,519 +0,0 @@
-#ifndef CGAL_SURFACE_MESH_SEGMENTATION_SDF_CALCULATION_H
-// Copyright (c) 2014  GeometryFactory Sarl (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
-// 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.
-
-
-#define CGAL_SURFACE_MESH_SEGMENTATION_SDF_CALCULATION_H
-
-#include <CGAL/AABB_tree.h>
-#include <CGAL/AABB_face_graph_triangle_primitive.h>
-#include <CGAL/internal/Surface_mesh_segmentation/AABB_traversal_traits.h>
-#include <CGAL/internal/Surface_mesh_segmentation/AABB_traits.h>
-#include <CGAL/internal/Surface_mesh_segmentation/Disk_samplers.h>
-#include <CGAL/constructions/kernel_ftC3.h>
-#include <vector>
-#include <algorithm>
-
-#include <boost/tuple/tuple.hpp>
-#include <boost/optional.hpp>
-
-#define CGAL_NUMBER_OF_MAD 1.5
-
-namespace CGAL
-{
-/// @cond CGAL_DOCUMENT_INTERNAL
-namespace internal
-{
-
-template<class ID>
-struct SkipPrimitiveFunctor {
-
-  bool operator()(const ID& skip_me) const {
-    return skip_me == skip;
-  }
-
-  SkipPrimitiveFunctor(const ID& skip) : skip(skip) { }
-
-  ID skip;
-};
-
-template<class ID>
-struct FirstIntersectionVisitor {
-
-  void operator()(const ID& /*closest*/, double /*distance*/) const {
-  }
-};
-
-/**
- * @brief Responsible for calculating Shape Diameter Function over surface of the mesh.
- *
- * @tparam Polyhedron a CGAL polyhedron
- * @tparam GeomTraits a model of SegmentationGeomTraits
- */
-template <
-      class Polyhedron,
-      class VertexPointPmap,
-      class GeomTraits = typename Polyhedron::Traits,
-      bool fast_bbox_intersection = true
-      >
-class SDF_calculation
-{
-//type definitions
-private:
-
-  typedef typename GeomTraits::Vector_3   Vector;
-  typedef typename GeomTraits::Point_3    Point;
-  typedef typename GeomTraits::Ray_3      Ray;
-  typedef typename GeomTraits::Plane_3    Plane;
-  typedef typename GeomTraits::Segment_3  Segment;
-  typedef typename GeomTraits::FT         FT;
-
-  typedef typename boost::graph_traits<Polyhedron>::face_iterator face_iterator;
-  typedef typename boost::graph_traits<Polyhedron>::face_descriptor   face_handle;
-
-  typedef AABB_face_graph_triangle_primitive<Polyhedron, VertexPointPmap> Primitive;
-  typedef AABB_traits_SDF<GeomTraits, Primitive, fast_bbox_intersection>
-  AABB_traits_internal;
-  typedef typename CGAL::AABB_tree<AABB_traits_internal>                 Tree;
-
-  typedef typename Tree::Object_and_primitive_id
-  Object_and_primitive_id;
-  typedef typename Tree::Primitive_id
-  Primitive_id;
-
-  // Sampled points from disk, t1 = coordinate-x, t2 = coordinate-y, t3 = weight.
-  typedef boost::tuple<double, double, double> Disk_sample;
-  typedef std::vector<Disk_sample>             Disk_samples_list;
-
-  // DiskSampling class responsible for the sampling points in a disk. It is used for generating rays in the cones. For different example see Disk_samplers.h
-  typedef Vogel_disk_sampling<boost::tuple<double, double, double> >
-  Default_sampler;
-
-// member variables
-private:
-  GeomTraits traits;
-  const Polyhedron& mesh;
-  VertexPointPmap vertex_point_map;
-
-  typename GeomTraits::Angle_3                         angle_functor;
-  typename GeomTraits::Construct_scaled_vector_3       scale_functor;
-  typename GeomTraits::Construct_sum_of_vectors_3      sum_functor;
-  typename GeomTraits::Construct_normal_3              normal_functor;
-  typename GeomTraits::Construct_translated_point_3    translated_point_functor;
-  typename GeomTraits::Construct_centroid_3            centroid_functor;
-
-  Tree tree;
-
-  double max_diagonal;
-  bool   use_diagonal;
-public:
-  /**
-   * Construct AABB tree with a mesh.
-   * @param mesh `CGAL Polyhedron` on which AABB tree constructed
-   * @param build_kd_tree requirement on internal kd-tree (it is only required if find_closest_with_AABB_distance is planned to use)
-   * @param use_diagonal if true: calculates diagonal of AABB tree and cast segments instead of rays using diagonal length
-   * @param traits trait object
-   */
-  SDF_calculation(const Polyhedron& mesh,
-                  VertexPointPmap vertex_point_map,
-                  bool build_kd_tree = false,
-                  bool use_diagonal = true, GeomTraits traits = GeomTraits())
-    :
-    traits(traits),
-    mesh(mesh),
-    vertex_point_map(vertex_point_map),
-    angle_functor(traits.angle_3_object()),
-    scale_functor(traits.construct_scaled_vector_3_object()),
-    sum_functor(traits.construct_sum_of_vectors_3_object()),
-    normal_functor(traits.construct_normal_3_object()),
-    translated_point_functor(traits.construct_translated_point_3_object()),
-    centroid_functor(traits.construct_centroid_3_object()),
-    use_diagonal(use_diagonal) 
-  {
-    tree.insert(faces(mesh).first, faces(mesh).second, mesh, vertex_point_map);
-    tree.build();
-
-    if(build_kd_tree) {
-      tree.accelerate_distance_queries();
-    }
-
-    if(use_diagonal) {
-      CGAL::Bbox_3 bbox = tree.bbox();
-      max_diagonal =
-        std::sqrt(
-          CGAL::squared_distanceC3( bbox.xmin(), bbox.ymin(), bbox.zmin(), bbox.xmax(),
-                                    bbox.ymax(), bbox.zmax() )
-        );
-    }
-  }
-
-  /**
-   * Calculates SDF values for each facet in a range, and stores them in @a sdf_values. Note that sdf values are neither smoothed nor normalized.
-   * @tparam FacetValueMap `WritablePropertyMap` with `boost::graph_traits<Polyhedron>::face_handle` as key and `double` as value type
-   * @tparam InputIterator Iterator over polyhedrons. Its value type is `pointer to polyhedron`.
-   * @param facet_begin range begin
-   * @param facet_end range past-the-end
-   * @param cone_angle opening angle for cone, expressed in radians
-   * @param number_of_rays number of rays picked from cone for each facet
-   * @param[out] sdf_values
-   */
-  template <class FacetValueMap, class InputIterator, class DiskSampling>
-  void calculate_sdf_values(
-    InputIterator facet_begin,
-    InputIterator facet_end,
-    double cone_angle,
-    std::size_t number_of_rays,
-    FacetValueMap sdf_values,
-    DiskSampling disk_sampler) const {
-    Disk_samples_list disk_samples;
-    disk_sampler(number_of_rays, std::back_inserter(disk_samples));
-
-    for( ; facet_begin != facet_end; ++facet_begin) {
-      boost::optional<double> sdf_value = calculate_sdf_value_of_facet(*facet_begin,
-                                          cone_angle, true, disk_samples);
-
-      if(sdf_value) {
-        sdf_values[*facet_begin] = *sdf_value;
-      } else          {
-        sdf_values[*facet_begin] = -1.0;
-      }
-    }
-  }
-
-  /**
-   * Overload for default sampling parameter
-   */
-  template <class FacetValueMap, class InputIterator>
-  void calculate_sdf_values(
-    InputIterator facet_begin,
-    InputIterator facet_end,
-    double cone_angle,
-    std::size_t number_of_rays,
-    FacetValueMap sdf_values) const {
-    calculate_sdf_values(facet_begin, facet_end, cone_angle, number_of_rays,
-                         sdf_values, Default_sampler());
-  }
-
-  /**
-   * Cast rays inside code located around normal with apex at center.
-   * Any encountered primitives are tested with `skip`, and accepted if `skip` returns false.
-   * For each ray, closest encountered primitive send to `visitor`.
-   *
-   * \note: normal should have unit length
-   */
-  template<class SkipPrimitiveFunctor, class FirstIntersectionVisitor>
-  boost::optional<double> calculate_sdf_value_of_point(
-    Point center,
-    Vector normal,
-    SkipPrimitiveFunctor skip,
-    FirstIntersectionVisitor visitor,
-    double cone_angle,
-    std::size_t number_of_rays,
-    bool accept_if_acute) const {
-    return calculate_sdf_value_of_point(center, normal, skip, visitor, cone_angle,
-                                        number_of_rays, accept_if_acute,
-                                        Default_sampler() );
-  }
-
-  /**
-   * Overload for taking DiskSampling as template parameter
-   */
-  template<class SkipPrimitiveFunctor, class FirstIntersectionVisitor, class DiskSampling>
-  boost::optional<double> calculate_sdf_value_of_point(
-    Point center,
-    Vector normal,
-    SkipPrimitiveFunctor skip,
-    FirstIntersectionVisitor visitor,
-    double cone_angle,
-    std::size_t number_of_rays,
-    bool accept_if_acute,
-    DiskSampling disk_sampler) const {
-    Disk_samples_list disk_samples;
-    disk_sampler(number_of_rays, std::back_inserter(disk_samples));
-
-    return calculate_sdf_value_of_point(center, normal, skip, visitor, cone_angle,
-                                        accept_if_acute, disk_samples);
-  }
-
-  /**
-   * Overload for directly taking sampled points from disk as parameter
-   */
-  template<class SkipPrimitiveFunctor, class FirstIntersectionVisitor>
-  boost::optional<double> calculate_sdf_value_of_point(
-    const Point& center,
-    const Vector& normal,
-    SkipPrimitiveFunctor skip,
-    FirstIntersectionVisitor visitor,
-    double cone_angle,
-    bool accept_if_acute,
-    const Disk_samples_list& disk_samples) const {
-    if(cone_angle < 0.0 || cone_angle > CGAL_PI) {
-      CGAL_warning(false && "Cone angle is clamped between [0, CGAL_PI].");
-      cone_angle = (std::min)(CGAL_PI, (std::max)(0.0, cone_angle));
-    }
-
-    Plane plane(center, normal);
-    Vector v1 = plane.base1(), v2 = plane.base2();
-    v1 = scale_functor(v1, FT(1.0 / CGAL::sqrt( to_double(v1.squared_length()) )));
-    v2 = scale_functor(v2, FT(1.0 / CGAL::sqrt( to_double(v2.squared_length()) )));
-
-    std::vector<std::pair<double, double> > ray_distances;
-    ray_distances.reserve(disk_samples.size());
-
-    const FT normal_multiplier( cos(cone_angle / 2.0) );
-    const FT disk_multiplier  ( sin(cone_angle / 2.0) );
-
-    const Vector& scaled_normal = scale_functor(normal, normal_multiplier);
-
-    for(Disk_samples_list::const_iterator sample_it = disk_samples.begin();
-        sample_it != disk_samples.end(); ++sample_it) {
-      bool is_intersected, intersection_is_acute;
-      double min_distance;
-      Primitive_id closest_id;
-
-      Vector disk_vector = sum_functor(
-                             scale_functor(v1, FT(disk_multiplier * sample_it->get<0>())),
-                             scale_functor(v2, FT(disk_multiplier * sample_it->get<1>())) );
-      Vector ray_direction = sum_functor(scaled_normal, disk_vector);
-
-      if(use_diagonal) {
-        FT max_distance( max_diagonal / std::sqrt(to_double(
-                           ray_direction.squared_length())));
-        const Vector scaled_direction = scale_functor(ray_direction, max_distance);
-        const Vector target_vector = sum_functor( Vector(Point(ORIGIN), center),
-                                     scaled_direction);
-        const Point  target_point = translated_point_functor(Point(ORIGIN),
-                                    target_vector);
-        Segment segment(center, target_point);
-
-        if(traits.is_degenerate_3_object()(segment)) {
-          CGAL_warning(false &&
-                       "A degenerate segment is constructed. Most probable reason is using CGAL_PI as cone_angle parameter and also picking center of disk as a sample.");
-        }
-
-        boost::tie(is_intersected, intersection_is_acute, min_distance, closest_id)
-          = cast_and_return_minimum(segment, skip, accept_if_acute);
-      } else {
-        Ray ray(center, ray_direction);
-
-        if(traits.is_degenerate_3_object()(ray)) {
-          CGAL_warning(false &&
-                       "A degenerate ray is constructed. Most probable reason is using CGAL_PI as cone_angle parameter and also picking center of disk as a sample.");
-        }
-
-        boost::tie(is_intersected, intersection_is_acute, min_distance, closest_id)
-          = cast_and_return_minimum(ray, skip, accept_if_acute);
-      }
-
-      if(!intersection_is_acute) {
-        continue;
-      }
-
-      visitor(closest_id, min_distance);
-
-      ray_distances.push_back(std::make_pair(min_distance, sample_it->get<2>()));
-    }
-
-    if(ray_distances.empty()) {
-      return boost::optional<double>();
-    }
-
-    return boost::optional<double>(remove_outliers_and_calculate_sdf_value(
-                                     ray_distances));
-  }
-
-  /**
-   * Finds closest distance to center using `closest_point` query on AABB.
-   * @return squared distance
-   */
-  double find_closest_with_AABB_distance(Point center) const {
-    Point closest = tree.closest_point(center);
-    return (closest - center).squared_length();
-  }
-private:
-  /**
-   * Calculates SDF value for parameter @a facet.
-   * @param facet
-   * @param tree AABB tree which is built from polyhedron
-   * @param samples sampled points from a unit-disk which are corresponds to rays picked from cone
-   * @return calculated SDF value
-   */
-  boost::optional<double> calculate_sdf_value_of_facet(
-    face_handle facet,
-    double cone_angle,
-    bool accept_if_acute,
-    const Disk_samples_list& disk_samples) const {
-    
-    const Point p1 = get(vertex_point_map,target(halfedge(facet,mesh),mesh));
-    const Point p2 = get(vertex_point_map,target(next(halfedge(facet,mesh),mesh),mesh));
-    const Point p3 = get(vertex_point_map,target(prev(halfedge(facet,mesh),mesh),mesh));
-    const Point center  = centroid_functor(p1, p2, p3);
-    Vector normal = normal_functor(p2, p1, p3);
-    normal=scale_functor(normal,
-                         FT(1.0/std::sqrt(to_double(normal.squared_length()))));
-
-    CGAL::internal::SkipPrimitiveFunctor<face_handle>
-    skip(facet);
-    CGAL::internal::FirstIntersectionVisitor<face_handle>
-    visitor;
-
-    return calculate_sdf_value_of_point(center, normal, skip, visitor, cone_angle,
-                                        accept_if_acute, disk_samples);
-  }
-
-  /**
-   * Finds closest intersection for parameter @a query.
-   * @param query `Segment` or `Ray` type query
-   * @param tree AABB tree which includes polyhedron
-   * @param facet parent facet of @a query
-   * (since numerical limitations on both center calculation and intersection test, query might intersect with related facet, should be skipped in such case)
-   * @return tuple of:
-   *   - get<0> bool   : true if any intersection is found
-   *   - get<1> bool   : true if intersection is found and is acceptable (i.e. accute angle with surface normal)
-   *   - get<2> double : distance between ray/segment origin and intersection point (0.0 if get<0> is false)
-   *   - get<3> Primitive_id : closest intersected primitive if get<0> is true, else Primitive_id()
-   */
-  template <class Query, class SkipPrimitiveFunctor> // Query can be templated for just Ray and Segment types.
-  boost::tuple<bool, bool, double, Primitive_id> cast_and_return_minimum(
-    const Query& query, SkipPrimitiveFunctor skip, bool accept_if_acute) const {
-    boost::tuple<bool, bool, double, Primitive_id>
-    min_distance(false, false, 0.0, Primitive_id());
-    std::list<Object_and_primitive_id> intersections;
-
-    //SL: the difference with all_intersections is that in the traversal traits, we do do_intersect before calling intersection.
-    typedef  std::back_insert_iterator< std::list<Object_and_primitive_id> >
-    Output_iterator;
-    Listing_intersection_traits_ray_or_segment_triangle<typename Tree::AABB_traits,Query,Output_iterator>
-    traversal_traits(std::back_inserter(intersections), tree.traits());
-    tree.traversal(query,traversal_traits);
-
-    Vector min_i_ray(NULL_VECTOR);
-    Primitive_id min_id;
-    for(typename std::list<Object_and_primitive_id>::iterator op_it =
-          intersections.begin();
-        op_it != intersections.end() ; ++op_it) {
-      Object object = op_it->first;
-      Primitive_id id = op_it->second;
-      if( skip(id) ) {
-        continue;
-      }
-
-      const Point* i_point;
-      if(!(i_point = object_cast<Point>(&object))) {
-        continue;  // continue in case of segment.
-      }
-
-      Vector i_ray(*i_point, query.source());
-      double new_distance = to_double( i_ray.squared_length() );
-      if(!min_distance.template get<0>()
-          || new_distance < min_distance.template get<2>()) {
-        min_distance.template get<3>() = id;
-        min_distance.template get<2>() = new_distance;
-        min_distance.template get<0>() = true;
-        min_id = id;
-        min_i_ray = i_ray;
-      }
-    }
-    if(!min_distance.template get<0>()) {
-      return min_distance;
-    }
-
-    if(accept_if_acute) {
-      // check whether the ray makes acute angle with intersected facet
-      const Point& min_v1 = get(vertex_point_map,target(halfedge(min_id,mesh),mesh));
-      const Point& min_v2 = get(vertex_point_map,target(next(halfedge(min_id,mesh),mesh),mesh));
-      const Point& min_v3 = get(vertex_point_map,target(prev(halfedge(min_id,mesh),mesh),mesh));
-      Vector min_normal = scale_functor(normal_functor(min_v1, min_v2, min_v3), -1.0);
-
-      if(angle_functor(translated_point_functor(Point(ORIGIN), min_i_ray),
-                       Point(ORIGIN),
-                       translated_point_functor(Point(ORIGIN), min_normal)) != ACUTE) {
-        return min_distance;
-      }
-    }
-
-    min_distance.template get<1>() = true; // founded intersection is acceptable.
-    min_distance.template get<2>() = std::sqrt(min_distance.template get<2>());
-    return min_distance;
-  }
-
-  /**
-   * Uses Median Absolute Deviation and removes rays which don't fall into `CGAL_NUMBER_OF_MAD` * MAD.
-   * Also takes weighted average of accepted rays and calculate final sdf value.
-   * @param ray_distances contains distance & weight pairs for each ray
-   * @return outlier removed and averaged sdf value
-   */
-  double remove_outliers_and_calculate_sdf_value(
-    std::vector<std::pair<double, double> >& ray_distances) const {
-    // pair first -> distance, second -> weight
-
-    const std::size_t accepted_ray_count = ray_distances.size();
-    if(accepted_ray_count == 0)      {
-      return 0.0;
-    } else if(accepted_ray_count == 1) {
-      return ray_distances[0].first;
-    }
-
-    /* Calculate median sdf */
-    const std::size_t half_ray_count = accepted_ray_count / 2;
-    std::nth_element(ray_distances.begin(), ray_distances.begin() + half_ray_count,
-                     ray_distances.end());
-    double median_sdf = ray_distances[half_ray_count].first;
-    if(accepted_ray_count % 2 == 0) {
-      median_sdf += std::max_element(ray_distances.begin(),
-                                     ray_distances.begin() + half_ray_count)->first;
-      median_sdf /= 2.0;
-    }
-
-    /* Calculate median absolute deviation */
-    std::vector<double> absolute_deviation;
-    absolute_deviation.reserve(accepted_ray_count);
-    for(std::vector<std::pair<double, double> >::iterator it =
-          ray_distances.begin(); it != ray_distances.end(); ++it) {
-      absolute_deviation.push_back(std::abs(it->first - median_sdf));
-    }
-
-    std::nth_element(absolute_deviation.begin(),
-                     absolute_deviation.begin() + half_ray_count, absolute_deviation.end());
-    double median_deviation = absolute_deviation[half_ray_count];
-    if(accepted_ray_count % 2 == 0) {
-      median_deviation += *std::max_element(absolute_deviation.begin(),
-                                            absolute_deviation.begin() + half_ray_count);
-      median_deviation /= 2.0;
-    }
-
-    /* Calculate sdf, accept rays if ray_dist - median < (median_deviation * Factor) */
-    double total_weights = 0.0, total_distance = 0.0;
-    for(std::vector<std::pair<double, double> >::iterator it =
-          ray_distances.begin(); it != ray_distances.end(); ++it) {
-      if(std::abs(it->first - median_sdf) > (median_deviation * CGAL_NUMBER_OF_MAD)) {
-        continue;
-      }
-      total_distance += it->first * it->second;
-      total_weights += it->second;
-    }
-
-    if(total_distance == 0.0) {
-      return median_sdf;  // no ray is accepted, return median.
-    } else                      {
-      return total_distance / total_weights;
-    }
-  }
-};
-}//namespace internal
-/// @endcond
-}//namespace CGAL
-#undef CGAL_NUMBER_OF_MAD
-
-#endif //CGAL_SURFACE_MESH_SEGMENTATION_SDF_CALCULATION_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Surface_mesh_segmentation/Surface_mesh_segmentation.h b/3rdparty/CGAL-4.8/include/CGAL/internal/Surface_mesh_segmentation/Surface_mesh_segmentation.h
deleted file mode 100644
index c8b4ddf..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/internal/Surface_mesh_segmentation/Surface_mesh_segmentation.h
+++ /dev/null
@@ -1,545 +0,0 @@
-#ifndef CGAL_SURFACE_MESH_SEGMENTATION_H
-// Copyright (c) 2014  GeometryFactory Sarl (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
-// 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.
-
-
-#define CGAL_SURFACE_MESH_SEGMENTATION_H
-
-#include <CGAL/internal/Surface_mesh_segmentation/Expectation_maximization.h>
-#include <CGAL/internal/Surface_mesh_segmentation/Filters.h>
-#include <CGAL/internal/Surface_mesh_segmentation/Alpha_expansion_graph_cut.h>
-#include <CGAL/internal/Surface_mesh_segmentation/SDF_calculation.h>
-
-#include <CGAL/Mesh_3/dihedral_angle_3.h>
-
-#include <CGAL/property_map.h>
-
-#include <cmath>
-#include <vector>
-#include <algorithm>
-#include <utility>
-#include <map>
-
-#define CGAL_NORMALIZATION_ALPHA 5.0
-#define CGAL_CONVEX_FACTOR 0.08
-#define CGAL_SMOOTHING_LAMBDA_MULTIPLIER 100.0
-
-namespace CGAL
-{
-/// @cond CGAL_DOCUMENT_INTERNAL
-namespace internal
-{
-
-// Post-process functions for sdf values
-template<class Polyhedron>
-class Postprocess_sdf_values
-{
-  typedef typename boost::graph_traits<Polyhedron>::face_descriptor   face_descriptor;
-  typedef typename boost::graph_traits<Polyhedron>::face_iterator face_iterator;
-
-  typedef Bilateral_filtering<Polyhedron>           Default_filter;
-
-public:
-
-  template <class Filter, class SDFPropertyMap>
-  std::pair<double, double>
-  postprocess(const Polyhedron& mesh, SDFPropertyMap sdf_pmap) {
-    check_missing_sdf_values(mesh, sdf_pmap);
-    Filter()(mesh, get_window_size(mesh), sdf_pmap);
-    return linear_normalize_sdf_values(mesh, sdf_pmap);
-  }
-
-  template <class SDFPropertyMap>
-  std::pair<double, double>
-  postprocess(const Polyhedron& mesh, SDFPropertyMap sdf_pmap) {
-    return postprocess<Default_filter>(mesh, sdf_pmap);
-  }
-
-  /**
-   * Finds facets which have missing (indicated by -1) sdf values.
-   * Sdf values on these facets are assigned to average sdf value of its neighbors.
-   * If still there is any facet which has no sdf value, assigns minimum sdf value to it.
-   * This is meaningful since (being an outlier) zero sdf values might effect normalization & log extremely.
-   * @param[in, out] sdf_values `ReadWritePropertyMap` with `Polyhedron::face_descriptor` as key and `double` as value type
-   */
-  template<class SDFPropertyMap>
-  void check_missing_sdf_values(const Polyhedron& mesh,
-                                SDFPropertyMap sdf_values) {
-    std::vector<face_descriptor> still_missing_facets;
-    double min_sdf = (std::numeric_limits<double>::max)();
-    // If there is any facet which has no sdf value, assign average sdf value of its neighbors
-    face_iterator facet_it, fend;
-    for(boost::tie(facet_it,fend) = faces(mesh);
-        facet_it != fend; ++facet_it) {
-      double sdf_value = sdf_values[*facet_it];
-      CGAL_assertion(sdf_value == -1 || sdf_value >= 0); // validity check
-      if(sdf_value != -1.0) {
-        min_sdf = (std::min)(sdf_value, min_sdf);
-        continue;
-      }
-
-      Halfedge_around_face_circulator<Polyhedron> facet_circulator(halfedge(*facet_it,mesh),mesh), done(facet_circulator);
-
-      double total_neighbor_sdf = 0.0;
-      std::size_t nb_valid_neighbors = 0;
-      do {
-        if(!(face(opposite(*facet_circulator,mesh),mesh) == boost::graph_traits<Polyhedron>::null_face())) {
-            double neighbor_sdf = sdf_values[face(opposite(*facet_circulator,mesh),mesh)];
-          if(neighbor_sdf != -1) {
-            total_neighbor_sdf += neighbor_sdf;
-            ++nb_valid_neighbors;
-          }
-        }
-      } while( ++facet_circulator != done);
-
-      if(nb_valid_neighbors == 0) {
-        still_missing_facets.push_back(*facet_it);
-      } else {
-        sdf_value = total_neighbor_sdf / nb_valid_neighbors;
-        sdf_values[*facet_it] = sdf_value;
-        // trying to update min_sdf is pointless, since it is interpolated one of the neighbors sdf will be smaller than it
-      }
-    }
-    // If still there is any facet which has no sdf value, assign minimum sdf value.
-    // This is meaningful since (being an outlier) 0 sdf values might effect normalization & log extremely.
-    for(typename std::vector<face_descriptor>::iterator it =
-          still_missing_facets.begin();
-        it != still_missing_facets.end(); ++it) {
-      sdf_values[*it] = min_sdf;
-    }
-  }
-
-  template<class SDFPropertyMap>
-  std::pair<double, double> min_max_value(const Polyhedron& mesh,
-                                          SDFPropertyMap sdf_values) {
-    double min_sdf = (std::numeric_limits<double>::max)();
-    double max_sdf = -min_sdf;
-    face_iterator facet_it, fend;
-    for(boost::tie(facet_it,fend) = faces(mesh);
-        facet_it != fend; ++facet_it) {
-      double sdf_value = sdf_values[*facet_it];
-      max_sdf = (std::max)(sdf_value, max_sdf);
-      min_sdf = (std::min)(sdf_value, min_sdf);
-    }
-    return std::make_pair(min_sdf, max_sdf);
-  }
-  /**
-   * Normalize sdf values between [0-1].
-   * @param sdf_values `ReadWritePropertyMap` with `Polyhedron::face_descriptor` as key and `double` as value type
-   * @return minimum and maximum SDF values before normalization
-   */
-  template<class SDFPropertyMap>
-  std::pair<double, double> linear_normalize_sdf_values(const Polyhedron& mesh,
-      SDFPropertyMap sdf_values) {
-    double min_sdf, max_sdf;
-    boost::tie(min_sdf, max_sdf) = min_max_value(mesh, sdf_values);
-
-    if(min_sdf == max_sdf) {
-      CGAL_warning(min_sdf == max_sdf && !"Linear normalization is not applicable!");
-      return std::make_pair(min_sdf, max_sdf);
-    }
-
-    const double max_min_dif = max_sdf - min_sdf;
-    face_iterator facet_it, fend;
-    for(boost::tie(facet_it,fend) = faces(mesh);
-        facet_it != fend; ++facet_it) {
-      sdf_values[*facet_it] = (sdf_values[*facet_it] - min_sdf) / max_min_dif;
-    }
-    return std::make_pair(min_sdf, max_sdf);
-  }
-
-  /**
-   * Simple window-size determination function for smoothing.
-   * It is proportional to square root of size of facets in polyhedron.
-   * @return size of the window
-   *  - 0-2000     -> 1
-   *  - 2000-8000  -> 2
-   *  - 8000-18000 -> 3
-   *  - ...
-   */
-  std::size_t get_window_size(const Polyhedron& mesh) {
-    double facet_sqrt = std::sqrt(num_faces(mesh) / 2000.0);
-    return static_cast<std::size_t>(facet_sqrt) + 1;
-  }
-};
-
-/**
- * @brief Main entry point for mesh segmentation algorithm.
- *
- * It is a connector class which uses:
- *   -  SDF_calculation for calculating sdf values
- *   -  Expectation_maximization for soft clustering
- *   -  An implementation of alpha-expansion graph cut for hard clustering
- *
- * Other than being a connector, it is also responsible for pre-process and postprocess on intermediate data, which are:
- *   - log-normalizing probabilities received from soft clustering
- *   - log-normalizing and calculating dihedral-angle based weights for edges
- *   - smoothing and log-normalizing sdf values received from sdf calculation (Filters.h)
- *   - assigning segment-id for each facet after hard clustering
- *
- * @tparam Polyhedron a CGAL polyhedron
- * @tparam GeomTraits a model of SegmentationGeomTraits
- * @tparam GraphCut chosen graph-cut implementation from Alpha_expansion_graph_cut.h
- * @tparam Filter chosen filtering method from Filters.h
- */
-template <
-class Polyhedron,
-      class GeomTraits,
-  class VertexPointPmap,
-      bool fast_bbox_intersection = true,
-#ifndef CGAL_DO_NOT_USE_BOYKOV_KOLMOGOROV_MAXFLOW_SOFTWARE
-      class GraphCut = Alpha_expansion_graph_cut_boykov_kolmogorov,
-#else
-      class GraphCut = Alpha_expansion_graph_cut_boost,
-#endif
-      class Filter = Bilateral_filtering<Polyhedron>
-      >
-class Surface_mesh_segmentation
-{
-//type definitions
-public:
-  typedef typename boost::graph_traits<Polyhedron>::face_descriptor      face_descriptor;
-
-private:
-  //typedef typename Polyhedron::Traits Kernel;
-  typedef typename GeomTraits::Point_3 Point;
-
-  typedef typename boost::graph_traits<Polyhedron>::edge_iterator     edge_iterator;
-  typedef typename boost::graph_traits<Polyhedron>::halfedge_descriptor  halfedge_descriptor;
-  typedef typename boost::graph_traits<Polyhedron>::halfedge_iterator halfedge_iterator;
-  typedef typename boost::graph_traits<Polyhedron>::face_iterator    face_iterator;
-  typedef typename boost::graph_traits<Polyhedron>::vertex_iterator   vertex_iterator;
-
-  typedef SDF_calculation<Polyhedron, VertexPointPmap, GeomTraits, fast_bbox_intersection>
-  SDF_calculation_class;
-
-// member variables
-private:
-  const Polyhedron& mesh;
-  GeomTraits traits;
-  VertexPointPmap vertex_point_pmap;
-// member functions
-public:
-  /**
-   * @pre @a polyhedron.is_pure_triangle()
-   * @param mesh `CGAL Polyhedron` on which other functions operate.
-   */
-  Surface_mesh_segmentation(const Polyhedron& mesh, GeomTraits traits, VertexPointPmap vertex_point_pmap)
-    : mesh(mesh), traits(traits), vertex_point_pmap(vertex_point_pmap) {
-    //    CGAL_precondition(is_pure_triangle(mesh));
-  }
-
-// Use these two functions together
-  template <class SDFPropertyMap>
-  std::pair<double, double>
-  calculate_sdf_values(double cone_angle, std::size_t number_of_rays,
-                       SDFPropertyMap sdf_pmap, bool postprocess_req) {
-    // calculate sdf values
-    SDF_calculation_class sdf_calculator(mesh, vertex_point_pmap, false, true, traits);
-    sdf_calculator.calculate_sdf_values(faces(mesh).first, faces(mesh).second,
-                                        cone_angle, number_of_rays, sdf_pmap);
-
-    Postprocess_sdf_values<Polyhedron> p;
-    return postprocess_req ? p.template postprocess<Filter>(mesh,
-           sdf_pmap) : // return minimum and maximum sdf values before normalization
-           p.min_max_value(mesh, sdf_pmap);
-  }
-
-  template <class FacetSegmentMap, class SDFPropertyMap>
-  std::size_t partition(std::size_t number_of_centers, double smoothing_lambda,
-                        SDFPropertyMap sdf_pmap, FacetSegmentMap segment_pmap,
-                        bool clusters_to_segments) {
-    smoothing_lambda = (std::max)(0.0, smoothing_lambda); // min zero
-    smoothing_lambda *=
-      CGAL_SMOOTHING_LAMBDA_MULTIPLIER; // scale it into meaningful range for graph-cut
-
-    // log normalize sdf values
-    std::vector<double> sdf_values;
-    log_normalize_sdf_values(sdf_pmap, sdf_values);
-
-    // soft clustering using GMM-fitting initialized with k-means
-    Expectation_maximization fitter(number_of_centers, sdf_values,
-                                    Expectation_maximization::K_MEANS_INITIALIZATION, 1);
-
-    std::vector<std::size_t> labels;
-    fitter.fill_with_center_ids(labels);
-
-    std::vector<std::vector<double> > probability_matrix;
-    fitter.fill_with_probabilities(probability_matrix);
-    log_normalize_probability_matrix(probability_matrix);
-
-    // calculating edge weights
-    std::vector<std::pair<std::size_t, std::size_t> > edges;
-    std::vector<double> edge_weights;
-    calculate_and_log_normalize_dihedral_angles(smoothing_lambda, edges,
-        edge_weights);
-
-    // apply graph cut
-    GraphCut()(edges, edge_weights, probability_matrix, labels);
-    std::vector<std::size_t>::iterator label_it = labels.begin();
-    face_iterator facet_it, fend;
-    for(boost::tie(facet_it,fend) = faces(mesh);
-        facet_it != fend;
-        ++facet_it, ++label_it) {
-      segment_pmap[*facet_it] = *label_it; // fill with cluster-ids
-    }
-    if(clusters_to_segments) {
-      // assign a segment id for each facet
-      std::size_t number_of_segments = assign_segments(number_of_centers, sdf_pmap,
-                                       segment_pmap);
-      return number_of_segments;
-    }
-    return number_of_centers;
-  }
-
-private:
-
-  /**
-   * Calculates dihedral angle between facets and normalize them between [0-1] from [0 - 2*pi].
-   * Also convex dihedral angles are multiplied by a factor smaller than 1.0 which reduces their effect in graph-cut.
-   * @pre parameter @a edge should not be a border.
-   * @param edge whose dihedral angle is computed using incident facets
-   * @return computed dihedral angle
-   */
-  double calculate_dihedral_angle_of_edge(halfedge_descriptor edge) const {
-
-    CGAL_precondition( (! (face(edge,mesh)==boost::graph_traits<Polyhedron>::null_face()))
-                       && (! (face(opposite(edge,mesh),mesh)==boost::graph_traits<Polyhedron>::null_face())) );
-    const Point a = get(vertex_point_pmap,target(edge,mesh));
-    const Point b = get(vertex_point_pmap,target(prev(edge,mesh),mesh));
-    const Point c = get(vertex_point_pmap,target(next(edge,mesh),mesh));
-    const Point d = get(vertex_point_pmap,target(next(opposite(edge,mesh),mesh),mesh));
-    // As far as I check: if, say, dihedral angle is 5, this returns 175,
-    // if dihedral angle is -5, this returns -175.
-    // Another words this function returns angle between planes.
-    double n_angle = to_double( ::CGAL::Mesh_3::dihedral_angle(a, b, c, d) );
-    n_angle /= 180.0;
-    bool concave = n_angle > 0;
-    double angle = 1 + ((concave ? -1 : +1) * n_angle);
-
-    if(!concave) {
-      angle *= CGAL_CONVEX_FACTOR;
-    }
-    return angle;
-  }
-
-  /**
-   * Normalize sdf values using function:
-   * normalized_sdf = log( alpha * ( current_sdf - min_sdf ) / ( max_sdf - min_sdf ) + 1 ) / log( alpha + 1 )
-   * @param sdf_values `ReadablePropertyMap` with `Polyhedron::face_descriptor` as key and `double` as value type
-   * @param[out] normalized_sdf_values normalized values stored in facet iteration order
-   * Important note: @a sdf_values parameter should contain linearly normalized values between [0-1]
-   */
-  template<class SDFPropertyMap>
-  void log_normalize_sdf_values(SDFPropertyMap sdf_values,
-                                std::vector<double>& normalized_sdf_values) {
-    normalized_sdf_values.reserve(num_faces(mesh));
-    face_iterator facet_it, fend;
-    for(boost::tie(facet_it,fend) = faces(mesh);
-        facet_it != fend; ++facet_it) {
-      double log_normalized = log(sdf_values[*facet_it] * CGAL_NORMALIZATION_ALPHA +
-                                  1) / log(CGAL_NORMALIZATION_ALPHA + 1);
-      normalized_sdf_values.push_back(log_normalized);
-    }
-  }
-
-  /**
-   * Receives probability-matrix with probabilities between [0-1], and returns log-normalized probabilities
-   * which are suitable to use in graph-cut.
-   * @param[in, out] probabilities probability matrix in [center][facet] order
-   */
-  void log_normalize_probability_matrix(std::vector<std::vector<double> >&
-                                        probabilities) const {
-    const double epsilon = 5e-6;
-    for(std::vector<std::vector<double> >::iterator it_i = probabilities.begin();
-        it_i != probabilities.end(); ++it_i) {
-      for(std::vector<double>::iterator it = it_i->begin(); it != it_i->end(); ++it) {
-        double probability = (std::max)(*it,
-                                        epsilon); // give every facet a little probability to be in any cluster
-        probability = -log(probability);
-        *it = (std::max)(probability, std::numeric_limits<double>::epsilon());
-        // zero values are not accepted in max-flow as weights for edges which connects some vertex with Source or Sink (in boost::boykov..)
-      }
-    }
-  }
-
-  /**
-   * Calculates dihedral-angle based weight for each edge which is not a border edge.
-   * @param smoothing_lambda a factor for each weight (weight *= smoothing_lambda).
-   * @param[out] edges list of pair of neighbor facet ids
-   * @param[out] edge_weights calculated weight for each edge in @a edges
-   */
-  void calculate_and_log_normalize_dihedral_angles(double smoothing_lambda,
-      std::vector<std::pair<std::size_t, std::size_t> >& a_edges,
-      std::vector<double>& edge_weights) const {
-    // associate each facet with an id
-    // important note: ids should be compatible with iteration order of facets:
-    // [0 <- facet_begin(),...., size_of_facets() -1 <- facet_end()]
-    // Why ? it is send to graph cut algorithm where other data associated with facets are also sorted according to iteration order.
-    std::map<face_descriptor, std::size_t> facet_index_map;
-    std::size_t facet_index = 0;
-    face_iterator facet_it, fend;
-    for(boost::tie(facet_it,fend) = faces(mesh);
-        facet_it != fend;
-        ++facet_it, ++facet_index) {
-      facet_index_map[*facet_it] = facet_index;
-    }
-
-    const double epsilon = 5e-6;
-    // edges and their weights. pair<std::size_t, std::size_t> stores facet-id pairs (see above) (may be using boost::tuple can be more suitable)
-    edge_iterator edge_it, eend;
-    for(boost::tie(edge_it,eend) = edges(mesh);
-        edge_it != eend; ++edge_it) {
-      halfedge_descriptor hd = halfedge(*edge_it,mesh);
-      halfedge_descriptor ohd = opposite(hd,mesh);
-      if((face(hd,mesh)==boost::graph_traits<Polyhedron>::null_face())
-         || (face(ohd,mesh)==boost::graph_traits<Polyhedron>::null_face()))  {
-        continue;  // if edge does not contain two neighbor facets then do not include it in graph-cut
-      }
-      const std::size_t index_f1 = facet_index_map[face(hd,mesh)];
-      const std::size_t index_f2 = facet_index_map[face(ohd,mesh)];
-      a_edges.push_back(std::make_pair(index_f1, index_f2));
-
-      double angle = calculate_dihedral_angle_of_edge(hd);
-
-      angle = (std::max)(angle, epsilon);
-      angle = -log(angle);
-      angle *= smoothing_lambda;
-
-      edge_weights.push_back(angle);
-    }
-  }
-
-  template<class Pair>
-  struct Sort_pairs_with_second {
-    bool operator() (const Pair& pair_1, const Pair& pair_2) const {
-      return pair_1.second < pair_2.second;
-    }
-  };
-
-/////////////////////////////////////
-//  0 0 1 1 0 0      0 0 2 2 4 4   //
-//  0 0 1 1 0 0      0 0 2 2 4 4   //
-//  1 0 2 2 1 1  ->  1 0 3 3 5 5   //
-//  1 0 2 2 1 1      1 0 3 3 5 5   //
-//  cluster-ids  ->  segment-ids   //
-  /**
-   * Definitions:
-   *   -Cluster is a set of facet which can be connected or disconnected.
-   *   -Segment is a connected set of facets which are placed under same cluster (after graph-cut).
-   * Function takes a map which contains a cluster-id per facet. It then fills the map with segment-ids by giving a unique id to each
-   * set of connected facets which are placed under same cluster. Note that returned segment-ids are ordered by average sdf value of segment ascen.
-   *
-   * @param number_of_clusters cluster-ids in @a segments should be between [0, number_of_clusters -1]
-   * @param sdf_values `ReadablePropertyMap` with `Polyhedron::face_descriptor` as key and `double` as value type
-   * @param[in, out] segments `ReadWritePropertyMap` with `Polyhedron::face_descriptor` as key and `std::size_t` as value type.
-   * @return number of segments
-   */
-  template<class SegmentPropertyMap, class SDFProperyMap>
-  std::size_t assign_segments(std::size_t number_of_clusters,
-                              SDFProperyMap sdf_values, SegmentPropertyMap segments) {
-    // assign a segment-id to each facet
-    std::size_t segment_id = number_of_clusters;
-    std::vector<std::pair<std::size_t, double> > segments_with_average_sdf_values;
-    face_iterator facet_it, fend;
-    for(boost::tie(facet_it,fend) = faces(mesh);
-        facet_it != fend; ++facet_it) {
-      if(segments[*facet_it] <
-          number_of_clusters) { // not visited by depth_first_traversal
-        double average_sdf_value = breadth_first_traversal(*facet_it, segment_id,
-                                   sdf_values, segments);
-
-        segments_with_average_sdf_values.push_back(std::make_pair(segment_id,
-            average_sdf_value));
-        ++segment_id;
-      }
-    }
-    // sort segments according to their average sdf value
-    sort(segments_with_average_sdf_values.begin(),
-         segments_with_average_sdf_values.end(),
-         Sort_pairs_with_second<std::pair<std::size_t, double> >());
-    // map each segment-id to its new sorted index
-    std::vector<std::size_t> segment_id_to_sorted_id_map(
-      segments_with_average_sdf_values.size());
-    for(std::size_t index = 0; index < segments_with_average_sdf_values.size();
-        ++index) {
-      std::size_t segment_id = segments_with_average_sdf_values[index].first -
-                               number_of_clusters;
-      segment_id_to_sorted_id_map[segment_id] = index;
-    }
-    // make one-pass on facets. First make segment-id zero based by subtracting number_of_clusters
-    //                        . Then place its sorted index to pmap
-    for(boost::tie(facet_it,fend) = faces(mesh);
-        facet_it != fend; ++facet_it) {
-      std::size_t segment_id = segments[*facet_it] - number_of_clusters;
-      segments[*facet_it] = segment_id_to_sorted_id_map[segment_id];
-    }
-    return segment_id - number_of_clusters;
-  }
-
-  /**
-   * Breadth-first traverse all connected facets which has same cluster with @a facet.
-   * Each visited facet assigned to @a segment_id.
-   * @param facet root facet
-   * @param segment_id segment-id of root facet
-   * @param sdf_values `ReadablePropertyMap` with `Polyhedron::face_descriptor` as key and `double` as value type
-   * @param[in, out] segments `ReadWritePropertyMap` with `Polyhedron::face_descriptor` as key and `std::size_t` as value type.
-   * @return average sdf value for segment
-   */
-  template<class SegmentPropertyMap, class SDFProperyMap>
-  double
-  breadth_first_traversal(face_descriptor root, std::size_t segment_id,
-                          SDFProperyMap sdf_values, SegmentPropertyMap segments) {
-    std::queue<face_descriptor> facet_queue;
-    facet_queue.push(root);
-
-    std::size_t prev_segment_id = segments[root];
-    segments[root] = segment_id;
-
-    double total_sdf_value = sdf_values[root];
-    std::size_t    visited_facet_count = 1;
-
-    while(!facet_queue.empty()) {
-      face_descriptor facet = facet_queue.front();
-
-      Halfedge_around_face_circulator<Polyhedron> facet_circulator(halfedge(facet,mesh),mesh), done(facet_circulator);
-      do {
-        if(face(opposite(*facet_circulator,mesh),mesh)==boost::graph_traits<Polyhedron>::null_face()) {
-          continue;  // no facet to traversal
-        }
-        face_descriptor neighbor = face(opposite(*facet_circulator,mesh),mesh);
-        if(prev_segment_id == segments[neighbor]) {
-          segments[neighbor] = segment_id;
-          facet_queue.push(neighbor);
-
-          total_sdf_value += sdf_values[neighbor];
-          ++visited_facet_count;
-        }
-      } while( ++facet_circulator != done);
-
-      facet_queue.pop();
-    }
-
-    return total_sdf_value / visited_facet_count;
-  }
-
-};
-}//namespace internal
-/// @endcond
-} //namespace CGAL
-
-#undef CGAL_NORMALIZATION_ALPHA
-#undef CGAL_CONVEX_FACTOR
-#undef CGAL_SMOOTHING_LAMBDA_MULTIPLIER
-#endif //CGAL_SURFACE_MESH_SEGMENTATION_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Surface_mesh_skeletonization/get_normal.h b/3rdparty/CGAL-4.8/include/CGAL/internal/Surface_mesh_skeletonization/get_normal.h
deleted file mode 100644
index 559663e..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/internal/Surface_mesh_skeletonization/get_normal.h
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright (c) 2015 GeometryFactory (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Sebastien Loriot
-
-#ifndef CGAL_MCS_GET_NORMAL_H
-#define CGAL_MCS_GET_NORMAL_H
-
-namespace CGAL {
-
-namespace internal {
-
-template <class Traits>
-void normalize(typename Traits::Vector_3& v, const Traits& traits)
-{
-  double norm = std::sqrt(traits.compute_squared_length_3_object()(v));
-  v = traits.construct_divided_vector_3_object()(v, norm);
-}
-
-
-template <class Vertex, class Traits>
-typename Traits::Vector_3 get_vertex_normal(
-  Vertex& v,
-  const Traits& traits)
-{
-  typedef typename Traits::Point_3 Point;
-  typedef typename Traits::Vector_3 Vector;
-  typedef typename Vertex::Halfedge_around_vertex_const_circulator HV_circulator;
-  Vector normal = traits.construct_vector_3_object()(CGAL::NULL_VECTOR);
-  HV_circulator he = v.vertex_begin();
-  HV_circulator end = he;
-  CGAL_For_all(he,end)
-  {
-    if(!he->is_border())
-    {
-      const Point& prev = he->prev()->vertex()->point();
-      const Point& curr = he->vertex()->point();
-      const Point& next = he->next()->vertex()->point();
-
-      Vector p1 = traits.construct_vector_3_object()(curr, next);
-      normalize(p1, traits);
-      Vector p2 = traits.construct_vector_3_object()(curr, prev);
-      normalize(p2, traits);
-
-      double cosine = traits.compute_scalar_product_3_object()(p1, p2);
-      if      (cosine < -1.0) cosine = -1.0;
-      else if (cosine >  1.0) cosine =  1.0;
-      double angle = acos(cosine);
-
-      Vector n = traits.construct_cross_product_vector_3_object()(
-        traits.construct_vector_3_object()(curr, next),
-        traits.construct_vector_3_object()(curr, prev) );
-      normalize(n, traits);
-      n = traits.construct_scaled_vector_3_object()(n, angle);
-
-      normal = traits.construct_sum_of_vectors_3_object()(normal, n);
-    }
-  }
-  normalize(normal, traits);
-  return normal;
-}
-
-} //namespace internal
-
-} //namespace CGAL
-
-#endif // CGAL_MCS_GET_NORMAL_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Voronoi_covariance_3/voronoi_covariance_3.h b/3rdparty/CGAL-4.8/include/CGAL/internal/Voronoi_covariance_3/voronoi_covariance_3.h
deleted file mode 100644
index e411c56..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/internal/Voronoi_covariance_3/voronoi_covariance_3.h
+++ /dev/null
@@ -1,229 +0,0 @@
-// Copyright (c) 2014  INRIA Sophia-Antipolis (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
-// 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(s) : Jocelyn Meyron and Quentin Mérigot
-//
-
-#ifndef CGAL_INTERNAL_VCM_VORONOI_COVARIANCE_3_HPP
-#define CGAL_INTERNAL_VCM_VORONOI_COVARIANCE_3_HPP
-
-#include <list>
-#include <CGAL/array.h>
-#include <CGAL/internal/Voronoi_covariance_3/voronoi_covariance_sphere_3.h>
-#ifdef CGAL_VORONOI_COVARIANCE_USE_CONSTRUCTIONS
-#include <CGAL/Convex_hull_3/dual/halfspace_intersection_with_constructions_3.h>
-#else
-#include <CGAL/Convex_hull_3/dual/halfspace_intersection_3.h>
-#endif
-
-/// \cond SKIP_IN_MANUAL
-
-namespace CGAL {
-    namespace Voronoi_covariance_3 {
-        namespace internal {
-            template <class FT>
-                inline void
-                covariance_matrix_tetrahedron (FT ax, FT ay, FT az,
-                                               FT bx, FT by, FT bz,
-                                               FT cx, FT cy, FT cz,
-                                               cpp11::array<FT,6> &R)
-                {
-                    const FT det = (ax*cz*by - ax*bz*cy - ay*bx*cz +
-                                    ay*cx*bz + az*bx*cy - az*cx*by) / 60.0;
-
-                    R[0] += (ax*ax + ax*bx + ax*cx +
-                             bx*bx + bx*cx + cx*cx) * det;
-                    R[1] += (ax*ay + ax*by/2.0 + ax*cy/2.0 +
-                             bx*ay/2.0 + bx*by + bx*cy/2.0 +
-                             cx*ay/2.0 + cx*by/2.0 + cx*cy) * det;
-                    R[2] += (ax*az + ax*bz/2.0 + ax*cz/2.0 +
-                             bx*az/2.0 + bx*bz + bx*cz/2.0 +
-                             cx*az/2.0 + cx*bz/2.0 + cx*cz) * det;
-
-                    R[3] += (ay*ay + ay*by + ay*cy +
-                             by*by + by*cy + cy*cy) * det;
-                    R[4] += (az*ay + az*by/2.0 + az*cy/2.0 +
-                             bz*ay/2.0 + bz*by + bz*cy/2.0 +
-                             cz*ay/2.0 + cz*by/2.0 + cz*cy) * det;
-
-                    R[5] += (az*az + az*bz + az*cz +
-                             bz*bz + bz*cz + cz*cz) * det;
-                }
-
-            template <class FT>
-                class Covariance_accumulator_3
-                {
-                    public:
-                        typedef cpp11::array<FT, 6> Result_type;
-
-                    private:
-                        Result_type _result;
-
-                    public:
-                        Covariance_accumulator_3()
-                        {
-                            std::fill (_result.begin(), _result.end(), FT(0));
-                        }
-
-                        template <class Point>
-                            inline void operator () (const Point &a,
-                                                     const Point &b,
-                                                     const Point &c)
-                            {
-                                internal::covariance_matrix_tetrahedron (a[0], a[1], a[2],
-                                                                         b[0], b[1], b[2],
-                                                                         c[0], c[1], c[2],
-                                                                         _result);
-                            }
-
-                        const Result_type &result() const
-                        {
-                            return _result;
-                        }
-                };
-
-            template <class FT>
-                class Volume_accumulator_3
-                {
-                    public:
-                        typedef FT Result_type;
-
-                    private:
-                        Result_type _result;
-
-                    public:
-                        Volume_accumulator_3() : _result(0.0)
-                    {}
-
-                        template <class Point>
-                            inline void operator () (const Point &a,
-                                                     const Point &b,
-                                                     const Point &c)
-                            {
-                                const double  vol = CGAL::volume(a, b, c, Point(CGAL::ORIGIN));
-                                //std::cerr << "vol = " << vol << "\n";
-                                _result += vol;
-                            }
-
-                        const Result_type &result() const
-                        {
-                            return _result;
-                        }
-                };
-
-
-            template <class DT, class Sphere, class F>
-                F& tessellate_and_intersect(const DT &dt,
-                                            typename DT::Vertex_handle v,
-                                            const Sphere &sphere,
-                                            F &f)
-                {
-                    typedef typename DT::Vertex_handle Vertex_handle;
-                    typedef typename DT::Geom_traits::Kernel K;
-                    typedef typename K::Plane_3 Plane;
-                    typedef typename K::Point_3 Point;
-                    typedef typename K::Vector_3 Vector;
-                    typedef typename CGAL::Convex_hull_traits_3<K> Traits;
-                    typedef typename Traits::Polyhedron_3 Polyhedron;
-
-                    std::list<Vertex_handle> vertices;
-                    dt.incident_vertices(v,std::back_inserter(vertices));
-
-                    // construct intersection of half-planes using the convex hull function
-                    std::list<Plane> planes;
-                    for(typename std::list<Vertex_handle>::iterator it = vertices.begin();
-                        it != vertices.end(); ++it)
-                    {
-                        Vector p = ((*it)->point() - v->point())/2;
-                        planes.push_back (Plane(CGAL::ORIGIN+p, p));
-                    }
-
-                    // add half-planes defining the sphere discretization
-                    sphere(std::back_inserter(planes));
-
-                    Polyhedron P;
-                    #ifdef CGAL_VORONOI_COVARIANCE_USE_CONSTRUCTIONS
-                    halfspace_intersection_with_constructions_3
-                    #else
-                    halfspace_intersection_3
-                    #endif
-                      (planes.begin(),
-                       planes.end(),
-                       P,
-                       boost::make_optional(Point(CGAL::ORIGIN)));
-
-                    // apply f to the triangles on the boundary of P
-                    for (typename Polyhedron::Facet_iterator it = P.facets_begin();
-                         it != P.facets_end(); ++it)
-                    {
-                        typename Polyhedron::Halfedge_around_facet_circulator
-                            h0 = it->facet_begin(), hf = h0--, hs = cpp11::next(hf);
-
-                        while(hs != h0)
-                        {
-                            f (h0->vertex()->point(), hf->vertex()->point(),
-                               hs->vertex()->point());
-                            ++hs; ++hf;
-                        }
-                    }
-                    return f;
-                }
-        } // namespace internal
-
-        template <class DT, class Sphere, class FT>
-            void
-            voronoi_covariance_3 (const DT &dt,
-                                  typename DT::Vertex_handle v,
-                                  const Sphere &sphere,
-                                  FT covariance[6])
-            {
-                typename internal::Covariance_accumulator_3<FT> ca;
-                internal::tessellate_and_intersect(dt, v, sphere, ca);
-                std::copy (ca.result().begin(), ca.result().end(), covariance);
-            }
-
-        template <class DT, class Sphere>
-            array<typename DT::Geom_traits::FT, 6>
-            voronoi_covariance_3 (const DT &dt,
-                                  typename DT::Vertex_handle v,
-                                  const Sphere &sphere)
-            {
-                typedef typename DT::Geom_traits::FT FT;
-                typename internal::Covariance_accumulator_3<FT> ca;
-
-                return internal::tessellate_and_intersect(dt, v, sphere, ca).result();
-            }
-
-        template <class DT, class Sphere>
-            typename DT::Geom_traits::FT
-            voronoi_volume_3 (const DT &dt,
-                              typename DT::Vertex_handle v,
-                              const Sphere &sphere)
-            {
-                typedef typename DT::Geom_traits::FT FT;
-                typename internal::Volume_accumulator_3<FT> va;
-
-                return internal::tessellate_and_intersect(dt, v, sphere, va).result();
-            }
-
-    } // namespace Voronoi_covariance_3
-} // namespace CGAL
-
-/// \endcond
-
-#endif // CGAL_INTERNAL_VCM_VORONOI_COVARIANCE_3_HPP
-
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/boost/mutable_queue.hpp b/3rdparty/CGAL-4.8/include/CGAL/internal/boost/mutable_queue.hpp
deleted file mode 100644
index db94a9b..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/internal/boost/mutable_queue.hpp
+++ /dev/null
@@ -1,153 +0,0 @@
-//
-//=======================================================================
-// Copyright 1997, 1998, 1999, 2000 University of Notre Dame.
-// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek
-//
-// Distributed under the Boost Software License, Version 1.0. (See
-// accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//=======================================================================
-//
-// $URL$
-// $Id$
-//
-// NOTE: this file have been taken from boost 1.46.1 for using
-//       with Modificable_priority_queue (to enhance the 
-//       non-documented mutable_queue).
-//       original file is <boost/pending/mutable_queue.hpp>
-//
-#ifndef CGAL_INTERNAL_BOOST_MUTABLE_QUEUE_HPP
-#define CGAL_INTERNAL_BOOST_MUTABLE_QUEUE_HPP
-
-#include <vector>
-#include <algorithm>
-#include <functional>
-#include <CGAL/internal/boost/property_map.h>
-#include <CGAL/internal/boost/mutable_heap.hpp>
-#include <CGAL/internal/boost/array_binary_tree.hpp>
-#include <iterator>
-
-namespace CGAL { namespace internal {
-namespace boost_ {
-
-  // The mutable queue whose elements are indexed
-  //
-  // This adaptor provides a special kind of priority queue that has
-  // and update operation. This allows the ordering of the items to
-  // change. After the ordering criteria for item x changes, one must
-  // call the Q.update(x)
-  //
-  // In order to efficiently find x in the queue, a functor must be
-  // provided to map value_type to a unique ID, which the
-  // mutable_queue will then use to map to the location of the
-  // item. The ID's generated must be between 0 and N, where N is the
-  // value passed to the constructor of mutable_queue
-
-  template <class IndexedType,
-            class RandomAccessContainer = std::vector<IndexedType>,
-            class Comp = std::less<typename RandomAccessContainer::value_type>,
-            class ID = ::boost::identity_property_map >
-  class mutable_queue {
-  public:
-    typedef IndexedType value_type;
-    typedef typename RandomAccessContainer::size_type size_type;
-  protected:
-    typedef typename RandomAccessContainer::iterator iterator;
-#if !defined BOOST_NO_STD_ITERATOR_TRAITS
-    typedef array_binary_tree_node<iterator, ID> Node;
-#else
-    typedef array_binary_tree_node<iterator, value_type, ID> Node;
-#endif
-    typedef compare_array_node<RandomAccessContainer,Comp> Compare;
-    typedef std::vector<size_type> IndexArray;
-  public:
-    typedef Compare value_compare;
-    typedef ID id_generator;
-
-    mutable_queue(size_type n, const Comp& x, const ID& _id)
-      : index_array(n), comp(x), id(_id) {
-      c.reserve(n);
-    }
-//SL: added this constructor so that index_array is filled with
-//    indices equals to n. Maintaining this property in pop allows
-//    to have a method to detect if an element is in the queue
-    mutable_queue(size_type n, const Comp& x, const ID& _id,bool)
-      : index_array(n,n), comp(x), id(_id) {
-      c.reserve(n);
-    }
-    
-    template <class ForwardIterator>
-    mutable_queue(ForwardIterator first, ForwardIterator last,
-                  const Comp& x, const ID& _id)
-      : index_array(std::distance(first, last)), comp(x), id(_id)
-    {
-      while( first != last ) {
-        push(*first);
-        ++first;
-      }
-    }
-
-    bool empty() const { return c.empty(); }
-//SL: modified this function so that the element popped from the queue
-//    has its index set to the max number of element. That way we know
-//    that an element is not in the tree if its index is the max number
-//    of elements.
-    void pop() {
-      value_type tmp = c.back();
-      c.back() = c.front();
-      c.front() = tmp;
-
-      size_type id_f = get(id, c.back());
-      size_type id_b = get(id, tmp);
-      //SL was: size_type i = index_array[ id_b ];
-      index_array[ id_b ] = index_array[ id_f ];
-      //SL was: index_array[ id_f ] = i; 
-      index_array[ id_f ] = index_array.size(); /*SL added*/
-      c.pop_back();
-      Node node(c.begin(), c.end(), c.begin(), id);
-      down_heap(node, comp, index_array);
-    }
-    void push(const IndexedType& x) {
-      c.push_back(x);
-      /*set index-array*/
-      index_array[ get(id, x) ] = c.size()-1;
-      Node node(c.begin(), c.end(), c.end() - 1, id);
-      up_heap(node, comp, index_array);
-    }
-
-    void update(const IndexedType& x) {
-      size_type current_pos = index_array[ get(id, x) ];
-      c[current_pos] = x;
-
-      Node node(c.begin(), c.end(), c.begin()+current_pos, id);
-      update_heap(node, comp, index_array);
-    }
-
-    value_type& front() { return c.front(); }
-    value_type& top() { return c.front(); }
-
-    const value_type& front() const { return c.front(); }
-    const value_type& top() const { return c.front(); }
-
-    size_type size() const { return c.size(); }
-
-    void clear() { c.clear(); }
-
-#if 0
-        // dwa 2003/7/11 - I don't know what compiler is supposed to
-        // be able to compile this, but is_heap is not standard!!
-    bool test() {
-      return std::is_heap(c.begin(), c.end(), Comp());
-    }
-#endif
-
-   protected:
-    IndexArray index_array;
-    Compare comp;
-    RandomAccessContainer c;
-    ID id;
-  };
-
-
-} } } //namespace CGAL::internal::boost_
-#endif // CGAL_INTERNAL_BOOST_MUTABLE_QUEUE_HPP
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/boost/property_map.h b/3rdparty/CGAL-4.8/include/CGAL/internal/boost/property_map.h
deleted file mode 100644
index 296f03c..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/internal/boost/property_map.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright (c) 2011  GeometryFactory (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Laurent Rineau
-
-// This file includes either <boost/property_map/property_map.hpp> or
-// <boost/property_map.hpp> depending on the version of Boost.
-
-#ifndef CGAL_INTERNAL_BOOST_PROPERTY_MAP_H
-#define CGAL_INTERNAL_BOOST_PROPERTY_MAP_H
-
-#include <boost/version.hpp>
-#if BOOST_VERSION >= 104000
-  #include <boost/property_map/property_map.hpp>
-#else
-  #include <boost/property_map.hpp>
-#endif
-
-#endif // CGAL_INTERNAL_BOOST_PROPERTY_MAP_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/corefinement/Combinatorial_map_for_corefinement.h b/3rdparty/CGAL-4.8/include/CGAL/internal/corefinement/Combinatorial_map_for_corefinement.h
deleted file mode 100644
index 5013c08..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/internal/corefinement/Combinatorial_map_for_corefinement.h
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright (c) 2012  GeometryFactory Sarl (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
-// 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.
-//
-// $UR$
-// $Id$
-//
-//
-// Author(s)     : Sebastien Loriot
-
-#ifndef CGAL_INTERNAL_COMBINATORIAL_MAP_FOR_COREFINEMENT_H
-#define CGAL_INTERNAL_COMBINATORIAL_MAP_FOR_COREFINEMENT_H
-
-#define CGAL_CMAP_DEPRECATED 1
-
-#include <CGAL/Combinatorial_map.h>
-#include <CGAL/Combinatorial_map_constructors.h>
-#include <CGAL/Cell_attribute.h>
-#include <set>
-
-namespace CGAL{
-  namespace internal_IOP{
-
-template <class Polyhedron>
-struct Volume_info{
-  std::set<Polyhedron*> outside;
-  std::set<Polyhedron*> inside;
-  bool is_empty;
-  Volume_info():is_empty(false){}
-};
-
-struct Volume_on_merge
-{
-  template <class Attribute>
-  void operator() (Attribute& a1,const Attribute& a2) const
-  {
-    CGAL_assertion(!a1.info().is_empty && !a2.info().is_empty);
-    std::copy(a2.info().outside.begin(),a2.info().outside.end(),std::inserter(a1.info().outside,a1.info().outside.begin()));
-    std::copy(a2.info().inside.begin(),a2.info().inside.end(),std::inserter(a1.info().inside,a1.info().inside.begin()));
-  }
-};
-
-#ifndef NDEBUG
-struct Point_on_merge
-{
-  template <class Attribute>
-  void operator() (Attribute& a1,const Attribute& a2) const
-  {
-    CGAL_assertion(a1.point()==a2.point() );
-    CGAL_USE(a1); CGAL_USE(a2);
-  }
-};
-#endif
-
-
-template < class Refs, class T, class Point_,
-           class Functor_on_merge_=CGAL::Null_functor,
-           class Functor_on_split_=CGAL::Null_functor >
-class My_cell_attribute_with_point :
-  public CGAL::Cell_attribute_without_info<Refs, T, Functor_on_merge_, Functor_on_split_>
-{
-   Point_ mpoint;
-public:
-  typedef Point_            Point;
-  typedef Functor_on_merge_ Functor_on_merge;
-  typedef Functor_on_split_ Functor_on_split;
-
-  My_cell_attribute_with_point(){}
-  My_cell_attribute_with_point(const Point& apoint) : mpoint(apoint) {}
-  Point& point()             { return mpoint; }
-  const Point& point() const { return mpoint; }  
-    
-};
-
-template <typename Traits_,class Polyhedron>
-class Item_with_points_and_volume_info
-{
-public:
-  public:
-    static const unsigned int dimension = 3;
-    static const unsigned int NB_MARKS = 32;
-    template<class Refs>
-    struct Dart_wrapper
-    {
-      typedef CGAL::Dart<3, Refs >       Dart;
-      typedef Traits_                    Traits;
-      typedef typename Traits::FT        FT;
-      typedef typename Traits::Point_3   Point;
-      typedef typename Traits::Vector_3  Vector;
-      #ifndef NDEBUG
-      typedef My_cell_attribute_with_point< Refs,CGAL::Tag_true,Point,Point_on_merge>                 Vertex_attribute;
-      #else
-      typedef My_cell_attribute_with_point< Refs,CGAL::Tag_true,Point>                                Vertex_attribute;
-      #endif
-      typedef CGAL::Cell_attribute< Refs,Volume_info<Polyhedron>,CGAL::Tag_true,Volume_on_merge >     Volume_attribute;
-      typedef CGAL::cpp11::tuple< Vertex_attribute,
-                                  void,
-                                  void,
-                                  Volume_attribute>    Attributes;
-    };
-};
-
-} } //namespace CGAL::internal_IOP
-
-#endif //CGAL_INTERNAL_COMBINATORIAL_MAP_FOR_COREFINEMENT_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/intersection_of_Polyhedra_3.h b/3rdparty/CGAL-4.8/include/CGAL/intersection_of_Polyhedra_3.h
deleted file mode 100644
index c43f117..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/intersection_of_Polyhedra_3.h
+++ /dev/null
@@ -1,2108 +0,0 @@
-// Copyright (c) 2010-2012 GeometryFactory (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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(s)     : Sebastien Loriot
-
-#ifndef CGAL_INTERSECTION_OF_POLYHEDRA_3_H
-#define CGAL_INTERSECTION_OF_POLYHEDRA_3_H
-
-#define CGAL_CMAP_DEPRECATED 1
-
-#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
-#include <CGAL/Cartesian_converter.h>
-#include <CGAL/box_intersection_d.h>
-#include <CGAL/Bbox_3.h>
-#include <CGAL/intersections.h>
-
-#include <boost/next_prior.hpp>
-#include <set>
-#include <vector>
-#include <list>
-#include <algorithm>
-#include <CGAL/tuple.h>
-#include <CGAL/iterator.h>
-
-#include <CGAL/Modifier_base.h>
-#include <CGAL/internal/corefinement/Polyhedron_constness_types.h>
-#include <CGAL/internal/corefinement/intersection_triangle_segment_3.h>
-#include <CGAL/internal/corefinement/intersection_coplanar_triangles_3.h>
-#include <CGAL/use.h>
-
-#include <boost/type_traits/is_base_of.hpp>
-#include <boost/type_traits/is_floating_point.hpp>
-
-#include <boost/foreach.hpp>
-#include <CGAL/Polygon_mesh_processing/self_intersections.h>
-
-#ifdef CGAL_COREFINEMENT_DEBUG
-#warning look at CGAL/Mesh_3/Robust_intersection_traits.h and the statically filtered decision tree
-#endif
-
-namespace CGAL{
-
-//This functor computes the pairwise intersection of polyhedral surfaces.
-//Intersection are given as a set of polylines
-//The algorithm works as follow:
-//From each polyhedral surface we can get it as a set of segments or as a set of triangles.
-//We first use Box_intersection_d to filter intersection between all polyhedral
-//surface segments and polyhedral triangles.
-//From this filtered set, for each pair (segment,triangle), we look at the
-//intersection type. If not empty, we can have three different cases
-//  1)the segment intersect the interior of the triangle:
-//        We compute the intersection point and for each triangle incident
-//        to the segment, we write the fact that the point belong to the intersection
-//        of these two triangles.
-//  2)the segment intersect the triangle on an edge
-//        We do the same thing as described above but
-//        for all triangle incident to the edge intersected
-//  3)the segment intersect the triangle at a vertex
-//        for each edge incident to the vertex, we do
-//        the same operations as in 2)
-//
-//In case the segment intersect the triangle at one of the segment endpoint,  
-//we repeat the same procedure for each segment incident to this
-//endpoint.
-//
-//Note that given a pair (segment,triangle)=(S,T), if S belongs 
-//to the plane of T, we have nothing to do in the following cases:
-//  -- no triangle T' contains S such that T and T' are coplanar
-//  -- at least one triangle contains S
-// Indeed, the intersection points of S and T will be found using segments
-// of T or segments adjacent to S.
-//
-// -- Sebastien Loriot, 2010/04/07
-
-namespace internal_IOP {
-  //an enum do decide which kind of intersection points are needed
-  struct No_predicates_on_constructions{};
-  struct Predicates_on_constructions{};
-} // namespace internal_IOP
-
-template<class Polyhedron>
-struct Empty_node_visitor{
-  typedef typename Polyhedron::Halfedge_const_handle Halfedge_handle;
-  void new_node_added(int,internal_IOP::Intersection_type,Halfedge_handle,Halfedge_handle,bool,bool){}
-  template<class Iterator>
-  void annotate_graph(Iterator,Iterator){}
-  void update_terminal_nodes(std::vector<bool>&){}
-  void set_number_of_intersection_points_from_coplanar_facets(int){};
-  void add_filtered_intersection(Halfedge_handle,Halfedge_handle,const Polyhedron&,const Polyhedron&){}
-  void start_new_polyline(int,int){}
-  void add_node_to_polyline(int){}
-  void new_input_polyhedron(const Polyhedron&){}
-  template<class T>
-  void finalize(T&){}
-  typedef internal_IOP::No_predicates_on_constructions Node_storage_type;
-  typedef Tag_true Is_polyhedron_const;
-  static const bool do_need_vertex_graph = false;
-};
-
-namespace internal_IOP{
-  
-template <class Polyhedron,class Is_const>
-struct Compare_handles{
-  typedef typename Polyhedron_types<Polyhedron,Is_const>::Halfedge_handle   Halfedge_handle;
-  typedef typename Polyhedron_types<Polyhedron,Is_const>::Halfedge          Halfedge;
-  typedef typename Polyhedron_types<Polyhedron,Is_const>::Vertex            Vertex;
-  typedef typename Polyhedron_types<Polyhedron,Is_const>::Facet             Facet;
-  typedef typename Polyhedron_types<Polyhedron,Is_const>::Facet_handle      Facet_handle;
-  typedef std::pair<const Vertex*,const Vertex*>                            Vertex_handle_pair;
-  
-  static inline Vertex_handle_pair 
-  make_sorted_pair_of_vertices(Halfedge_handle h) {
-    const Vertex* v1=&(* h->vertex() );
-    const Vertex* v2=&(* h->opposite()->vertex() );
-    if ( v1 < v2 )
-      return Vertex_handle_pair(v1,v2);
-    return Vertex_handle_pair(v2,v1);
-  }
-  
-  bool operator()(Halfedge_handle h1,Halfedge_handle h2) const {
-    Vertex_handle_pair p1=make_sorted_pair_of_vertices(h1);
-    Vertex_handle_pair p2=make_sorted_pair_of_vertices(h2);
-    return  p1 < p2; 
-  }
-  
-  bool operator()(Facet_handle f1,Facet_handle f2) const {
-    return &(*f1) < &(*f2);
-  }
-  
-  bool operator()(const std::pair<Halfedge_handle,Polyhedron*>& p1, const std::pair<Halfedge_handle,Polyhedron*>& p2) const{
-    Halfedge* h1= (std::min) ( &(*(p1.first)), &(*(p1.first->opposite())) );
-    Halfedge* h2= (std::min) ( &(*(p2.first)), &(*(p2.first->opposite())) );
-    return h1<h2;
-  }
-};
-
-//could not put it in the above struct (gcc complains about an ambiguous call)
-template <class Polyhedron,class Is_const>
-struct Compare_handle_pairs{
-  typedef typename Polyhedron_types<Polyhedron,Is_const>::Facet             Facet;
-  typedef typename Polyhedron_types<Polyhedron,Is_const>::Facet_handle      Facet_handle;  
-  typedef std::pair<Facet_handle,Facet_handle>                              Facet_pair;
-  typedef std::pair<Facet_pair,int>                                         Facet_pair_and_int;
-  
-  bool operator()(const Facet_pair& p1, const Facet_pair& p2) const{
-    Facet* f1=&(*p1.first);
-    Facet* f2=&(*p2.first);
-    if (f1==f2){
-      f1=&(*p1.second);
-      f2=&(*p2.second);
-    }
-    return f1<f2;
-  }
-
-  bool operator()(const Facet_pair_and_int& p1, const Facet_pair_and_int& p2) const{
-    Facet* f1=&(*p1.first.first);
-    Facet* f2=&(*p2.first.first);
-    if (f1==f2){
-      f1=&(*p1.first.second);
-      f2=&(*p2.first.second);
-    }
-    if (f1<f2) return true;
-    if (f1>f2) return false;
-    return p1.second<p2.second;
-  }
-};
-
-template<class Polyhedron,class Nodes_vector,class Is_const>
-struct Order_along_a_halfedge{
-  typedef typename Polyhedron_types<Polyhedron,Is_const>::Halfedge_handle Halfedge_handle;
-  const Nodes_vector& nodes;
-  Halfedge_handle hedge;
-  
-  Order_along_a_halfedge(Halfedge_handle hedge_,const Nodes_vector& nodes_):nodes(nodes_),hedge(hedge_){}
-  bool operator()(int i,int j) const {
-    //returns true, iff q lies strictly between p and r.
-    typename Nodes_vector::Protector p;
-    try{
-      CGAL::internal::use(p);
-
-      return CGAL::collinear_are_strictly_ordered_along_line(nodes.to_interval(hedge->vertex()->point()),
-                                                             nodes.interval_node(j),
-                                                             nodes.interval_node(i));
-    }
-    catch(CGAL::Uncertain_conversion_exception&){
-      return CGAL::collinear_are_strictly_ordered_along_line(nodes.to_exact(hedge->vertex()->point()),
-                                                             nodes.exact_node(j),
-                                                             nodes.exact_node(i));      
-    }
-  }
-};
-
-
-template <class HDS>
-class Split_halfedge_at_point : public CGAL::Modifier_base<HDS> {
-  typedef typename HDS::Halfedge_handle Halfedge_handle;
-  typedef typename HDS::Vertex_handle   Vertex_handle;
-  typedef typename HDS::Vertex          Vertex;
-  Halfedge_handle hedge;
-  Vertex          vertex;
-  
-  typename HDS::Halfedge::Base*
-  unlock_halfedge(Halfedge_handle h){
-    return static_cast<typename HDS::Halfedge::Base*>(&(*h));
-  }
-  
-public:
-  
-  template <class Point_3>
-  Split_halfedge_at_point( Halfedge_handle h,const Point_3& point):hedge(h),vertex(point){}
-
-  //   new_hedge    hedge
-  //  ----------->   ----------->
-  //               v
-  //  <-----------   <-----------
-  //   new_opposite     opposite 
-  //  
-  void operator()( HDS& hds) {
-    
-    Vertex_handle v=hds.vertices_push_back(vertex);
-    Halfedge_handle opposite=hedge->opposite();
-    
-    Halfedge_handle new_hedge=hds.edges_push_back(*hedge);
-    Halfedge_handle new_opposite=new_hedge->opposite();
-    
-    //update next relations
-    unlock_halfedge(new_hedge)->set_next(hedge);
-    unlock_halfedge(new_hedge->prev())->set_next(new_hedge);
-    unlock_halfedge(hedge)->set_prev(new_hedge);
-
-    unlock_halfedge(opposite)->set_next(new_opposite);
-    unlock_halfedge(new_opposite)->set_prev(opposite);    
-    unlock_halfedge(new_opposite->next())->set_prev(new_opposite);
-
-    unlock_halfedge(opposite)->set_vertex(v);
-    unlock_halfedge(new_hedge)->set_vertex(v);
-
-    v->set_halfedge(new_hedge);
-    new_opposite->vertex()->set_halfedge(new_opposite);
-  }
-};
-
-
-
-} //namespace internal_IOP
-
-
-
-//WARNING THIS IS DONE ONLY FOR POLYHEDRON
-template<class Polyhedron,class Halfedge_predicate,
-         class Set_vertex_corner, class Kernel=typename Polyhedron::Traits::Kernel>
-class Node_visitor_for_polyline_split{
-//typedefs  
-  typedef typename Polyhedron::Halfedge_handle                         Halfedge_handle;
-  typedef typename Polyhedron::Halfedge                                Halfedge;
-  typedef typename Polyhedron::Vertex_handle                           Vertex_handle;
-  //Info stores information about a particular intersection on an
-  //edge or a vertex of a polyhedron. The two first elements in 
-  //the template describe the intersected simplex of the considered 
-  //polyhedron; the two last elements describe the element of the 
-  //second polyhedron (can be either a vertex, an edge of a facet)
-  //involved in the intersection
-  typedef CGAL::cpp11::tuple<internal_IOP::Intersection_type,
-                             Halfedge_handle,
-                             internal_IOP::Intersection_type,
-                             Halfedge_handle>                          Info;
-  typedef std::map<Halfedge*,Polyhedron*>                              Hedge_to_polyhedron_map;
-  typedef std::vector<Info>                                            Infos;
-  typedef std::map<int,Infos >                                         Node_to_infos_map;
-//data members
-  Node_to_infos_map   node_infos;
-  Hedge_to_polyhedron_map hedge_to_polyhedron;
-  Halfedge_predicate is_on_polyline;
-  Set_vertex_corner set_as_corner;
-//functions  
-  void handle_principal_edge(int node_id,
-                             internal_IOP::Intersection_type type,
-                             Halfedge_handle principal_edge,
-                             Halfedge_handle additional_edge,
-                             bool is_vertex_coplanar,
-                             bool is_vertex_opposite_coplanar)
-  {
-    bool coplanar_v=false;
-    if (is_vertex_coplanar) coplanar_v=true;
-    else if (is_vertex_opposite_coplanar){
-      principal_edge=principal_edge->opposite();
-      coplanar_v=true;
-    }
-    
-    if (coplanar_v)
-      handle_on_vertex(node_id,principal_edge,type,additional_edge);
-    else{
-      if ( is_on_polyline(principal_edge) ){
-        typename Node_to_infos_map::iterator it_res=
-          node_infos.insert(std::make_pair(node_id,Infos())).first; 
-          it_res->second.push_back( Info(internal_IOP::EDGE,principal_edge,type,additional_edge) );
-      }
-    }
-  }
-  
-  void handle_on_vertex(int node_id,Halfedge_handle edge,internal_IOP::Intersection_type type,Halfedge_handle additional_edge){
-    Halfedge_handle current=edge;
-    do{
-      if (is_on_polyline(current)){
-        typename Node_to_infos_map::iterator it_res=
-          node_infos.insert(std::make_pair(node_id,Infos())).first; 
-          it_res->second.push_back( Info(internal_IOP::VERTEX,current,type,additional_edge) );        
-        break;
-      }
-      current=current->next()->opposite();
-    }
-    while(current!=edge);    
-  }
-  
-  Halfedge* make_unique_key(Halfedge_handle h){
-    if (&(*h) < &(*h->opposite()))
-      return &(*h);
-    else
-      return &(*h->opposite());
-  }
-  
-  //   new_hedge    hedge
-  //  ----------->   ----------->
-  //               v
-  //  <-----------   <-----------
-  //   new_opposite     opposite 
-  //  
-  void split_edge_and_retriangulate(Halfedge_handle hedge,const typename Kernel::Point_3& point,Polyhedron& P){
-    internal_IOP::Split_halfedge_at_point<typename Polyhedron::HalfedgeDS> delegated(hedge,point);
-    P.delegate( delegated );
-    CGAL_assertion(P.is_valid());
-    //triangulate the two adjacent facets
-    if (!hedge->is_border())
-      P.split_facet(hedge->prev(),hedge->next());
-    if (!hedge->opposite()->is_border())
-      P.split_facet(hedge->opposite(),hedge->opposite()->next()->next());
-    CGAL_assertion(P.is_valid());
-  }
-
-  //sort node ids so that we can split the hedge
-  //consecutively
-  template <class Nodes_vector>
-  void sort_vertices_along_hedge(std::vector<int>& node_ids,Halfedge_handle hedge,const Nodes_vector& nodes)
-  {
-    std::sort(node_ids.begin(),
-              node_ids.end(),
-              internal_IOP::Order_along_a_halfedge<Polyhedron,Nodes_vector,Is_polyhedron_const>(hedge,nodes)
-    );
-  }
-  
-public:
-  static const bool do_need_vertex_graph = false;  
-  typedef internal_IOP::Predicates_on_constructions  Node_storage_type;  
-  typedef Tag_false Is_polyhedron_const;
-
-  Node_visitor_for_polyline_split(){}
-  Node_visitor_for_polyline_split(const Halfedge_predicate& getting,
-                                  const Set_vertex_corner& setting)
-    :is_on_polyline(getting),set_as_corner(setting){}
-
-  void new_node_added(int node_id,
-                      internal_IOP::Intersection_type type,
-                      Halfedge_handle principal_edge,
-                      Halfedge_handle additional_edge,
-                      bool is_vertex_coplanar,
-                      bool is_vertex_opposite_coplanar)
-  {
-    switch(type)
-    {
-      case internal_IOP::FACET: //Facet intersected by an edge
-        handle_principal_edge(node_id,type,principal_edge,additional_edge,is_vertex_coplanar,is_vertex_opposite_coplanar);
-        break;
-      case internal_IOP::EDGE: //Edge intersected by an edge
-        handle_principal_edge(node_id,type,principal_edge,additional_edge,is_vertex_coplanar,is_vertex_opposite_coplanar);
-        if ( is_on_polyline(additional_edge) ){
-          typename Node_to_infos_map::iterator it_res=
-            node_infos.insert(std::make_pair(node_id,Infos())).first; 
-            it_res->second.push_back( Info(type,additional_edge,
-                                           ( is_vertex_coplanar||is_vertex_opposite_coplanar ) ? internal_IOP::VERTEX:internal_IOP::EDGE,
-                                           is_vertex_opposite_coplanar?principal_edge->opposite():principal_edge) );
-        }
-        break;
-      case internal_IOP::VERTEX://Vertex intersected by an edge
-        handle_principal_edge(node_id,type,principal_edge,additional_edge,is_vertex_coplanar,is_vertex_opposite_coplanar);
-        handle_on_vertex( node_id,additional_edge,
-                          ( is_vertex_coplanar||is_vertex_opposite_coplanar ) ? internal_IOP::VERTEX:internal_IOP::EDGE,
-                          is_vertex_opposite_coplanar?principal_edge->opposite():principal_edge);
-        break;
-      default:
-        break;
-    }
-  }
-  
-  template<class Iterator>
-  void annotate_graph(Iterator begin,Iterator end){
-    for(Iterator it=begin;it!=end;++it){
-      typename Node_to_infos_map::iterator it_res=node_infos.find(it->first);
-      if (it_res!=node_infos.end())
-        it->second.make_terminal();
-    }
-  }
-  
-  void update_terminal_nodes(std::vector<bool>& terminal_bools){
-    for (typename Node_to_infos_map::iterator it=node_infos.begin();it!=node_infos.end();++it){
-      terminal_bools[it->first]=true;
-    }
-  }
-  
-  void new_input_polyhedron(const Polyhedron&){}
-  void start_new_polyline(int,int){}
-  void add_node_to_polyline(int){}
-  void set_number_of_intersection_points_from_coplanar_facets(int){}
-  
-  void add_filtered_intersection(Halfedge_handle eh,Halfedge_handle fh,Polyhedron& Pe,Polyhedron& Pf){
-    hedge_to_polyhedron.insert(std::make_pair(make_unique_key(eh),&Pe));
-    hedge_to_polyhedron.insert(std::make_pair(make_unique_key(fh),&Pf));
-    hedge_to_polyhedron.insert(std::make_pair(make_unique_key(fh->next()),&Pf));
-    hedge_to_polyhedron.insert(std::make_pair(make_unique_key(fh->next()->next()),&Pf));
-  }
-    
-  //split_halfedges
-  template <class Nodes_vector>
-  void finalize(const Nodes_vector& nodes){
-    typedef std::map<std::pair<Halfedge_handle,Polyhedron*>,
-                     std::vector<int>,internal_IOP::Compare_handles<Polyhedron,Is_polyhedron_const> >  Halfedges_to_split;
-    
-    Halfedges_to_split halfedges_to_split;
-    
-    for (typename Node_to_infos_map::iterator it=node_infos.begin();it!=node_infos.end();++it){
-      int node_id=it->first;
-      const Infos& infos=it->second;
-      std::map<Polyhedron*,std::vector<Halfedge_handle> > hedges_to_split;
-      
-      //collect information about halfedge to split
-      typename Infos::const_iterator it_info=infos.begin();
-      for (;it_info!=infos.end();++it_info)
-      {
-        typename Hedge_to_polyhedron_map::iterator  it_poly=
-          hedge_to_polyhedron.find(make_unique_key(CGAL::cpp11::get<1>(*it_info)));
-        CGAL_assertion(it_poly!=hedge_to_polyhedron.end());
-        //associate information to an intersection point:
-        //we give which simplex of the other polyhedron intersect the simplex considered
-        set_as_corner.add_info_to_node(node_id,it_poly->second,*it_info);
-        switch(CGAL::cpp11::get<0>(*it_info))
-        {
-          case internal_IOP::EDGE:
-          {
-            halfedges_to_split.insert(
-              std::make_pair( std::make_pair(CGAL::cpp11::get<1>(*it_info),&(*(it_poly->second))),std::vector<int>() )
-            ).first->second.push_back(node_id);
-          break;
-          }
-          case internal_IOP::VERTEX:
-            set_as_corner(CGAL::cpp11::get<1>(*it_info)->vertex(),node_id,it_poly->second);
-          break;
-          default:
-            CGAL_assertion(false);
-            //should never be here
-        }
-      }
-    }
-    
-    
-    //do the split
-    for(typename Halfedges_to_split::iterator it=halfedges_to_split.begin();it!=halfedges_to_split.end();++it){
-      Halfedge_handle hedge=it->first.first;
-      Polyhedron* P=it->first.second;
-      std::vector<int>& node_ids=it->second;
-      
-      sort_vertices_along_hedge(node_ids,hedge,nodes);
-      for (std::vector<int>::iterator it_id=node_ids.begin();it_id!=node_ids.end();++it_id){
-        split_edge_and_retriangulate(hedge,nodes[*it_id],*P);
-        set_as_corner(hedge->opposite()->vertex(),*it_id,(Polyhedron*)(0));
-      }
-    }
-  }
-};
-
-
-namespace internal_IOP{
-  
-  template <class Polyhedron,class In_kernel,class Exact_kernel>
-  typename Exact_kernel::Point_3
-  compute_triangle_segment_intersection_point(
-    typename Polyhedron::Vertex_const_handle vh1,typename Polyhedron::Vertex_const_handle vh2,
-    typename Polyhedron::Vertex_const_handle vf1,typename Polyhedron::Vertex_const_handle vf2,typename Polyhedron::Vertex_const_handle vf3,
-    const Exact_kernel& ek)       
-  {
-    CGAL::Cartesian_converter<In_kernel,Exact_kernel> to_exact;
-    typename Exact_kernel::Triangle_3 t(to_exact( vf1->point() ),
-                                        to_exact( vf2->point() ),
-                                        to_exact( vf3->point() )
-    );
-    
-    typename Exact_kernel::Segment_3 s (to_exact( vh1->point() ),
-                                        to_exact( vh2->point() )
-    );
-    
-    typename Exact_kernel::Intersect_3 exact_intersect=ek.intersect_3_object();
-    CGAL::Object inter=exact_intersect(t,s);
-    CGAL_assertion(CGAL::do_intersect(t,s));
-    const typename Exact_kernel::Point_3* e_pt=CGAL::object_cast<typename Exact_kernel::Point_3>(&inter);
-    CGAL_assertion(e_pt!=NULL);
-    return *e_pt;
-  }
-  
-  template <class Polyhedron,class In_kernel,class Exact_kernel>
-  typename Exact_kernel::Point_3
-  compute_triangle_segment_intersection_point(
-    typename Polyhedron::Halfedge_const_handle edge,
-    typename Polyhedron::Facet_const_handle facet,
-    const Exact_kernel& ek) 
-  {
-    return compute_triangle_segment_intersection_point<Polyhedron,In_kernel,Exact_kernel>(
-            edge->vertex(),edge->opposite()->vertex(),
-            facet->halfedge()->vertex(),facet->halfedge()->next()->vertex(),facet->halfedge()->opposite()->vertex(),
-            ek);
-            
-  }    
-    
-  
-  //A class containing a vector of the intersection points.
-  //The third template parameter indicates whether an
-  //exact representation is required
-  template <class Polyhedron,class Kernel,class Node_storage,bool Has_exact_constructions=!boost::is_floating_point<typename Kernel::FT>::value>
-  class Triangle_segment_intersection_points;
-  
-  
-  //Store only the double version of the intersection points.
-  template <class Polyhedron,class Kernel>
-  class Triangle_segment_intersection_points<Polyhedron,Kernel,No_predicates_on_constructions,false>
-  {
-  //typedefs
-    typedef std::vector <typename Kernel::Point_3>             Nodes_vector;
-    typedef typename Polyhedron::Halfedge_const_handle         Halfedge_handle;
-    typedef typename Polyhedron::Facet_const_handle            Facet_handle;
-    typedef CGAL::Exact_predicates_exact_constructions_kernel  Exact_kernel;
-    typedef CGAL::Cartesian_converter<Exact_kernel,Kernel>     Exact_to_double;    
-  //members
-    Nodes_vector nodes;
-    Exact_kernel ek;
-    Exact_to_double exact_to_double;
-  public:
-    typedef CGAL::Interval_nt<true>::Protector                 Protector;
-  
-    const typename Kernel::Point_3&
-    operator[](int i) const {
-      return nodes[i];
-    }
-    
-    const typename Kernel::Point_3& exact_node(int i) const {return nodes[i];}
-    const typename Kernel::Point_3& interval_node(int i) const {return nodes[i];}
-    const typename Kernel::Point_3& to_exact(const typename Kernel::Point_3& p) const {return p;}
-    const typename Kernel::Point_3& to_interval(const typename Kernel::Point_3& p) const {return p;}
-    
-    size_t size() const {return nodes.size();}
-    
-    void add_new_node(const typename Exact_kernel::Point_3& p)
-    {
-      nodes.push_back(  exact_to_double(p) );
-    }
-
-    //add a new node in the final graph.
-    //it is the intersection of the triangle with the segment
-    void add_new_node(Halfedge_handle edge,Facet_handle facet)
-    {
-      add_new_node(
-        compute_triangle_segment_intersection_point<Polyhedron,Kernel>(edge,facet,ek)
-      );
-    }
-
-
-    void add_new_node(const typename Kernel::Point_3& p)
-    {
-      nodes.push_back(p);
-    }    
-  }; // end specialization
-     // Triangle_segment_intersection_points<Polyhedron,Kernel,No_predicates_on_constructions,false>
-
-
-  //second specializations: store an exact copy of the points so that we can answer exactly predicates
-  //FYI, it used to have two specializations (one in the case the polyhedron
-  //can be edited and on if it cannot) building exact representation on demand.
-  //In the former case, we were using facet and halfedge while in the latter
-  //triple of vertex_handle and pair of vertex_handle
-  template <class Polyhedron,class Kernel>
-  class Triangle_segment_intersection_points<Polyhedron,Kernel,Predicates_on_constructions,false>
-  {
-  //typedefs
-  public: 
-    typedef CGAL::Simple_cartesian<CGAL::Interval_nt<false> >  Ikernel;
-    typedef CGAL::Exact_predicates_exact_constructions_kernel  Exact_kernel;
-  private:
-    typedef CGAL::Cartesian_converter<Ikernel,Kernel>          Interval_to_double;
-    typedef CGAL::Cartesian_converter<Kernel,Ikernel>          Double_to_interval;
-    typedef CGAL::Cartesian_converter<Exact_kernel,Ikernel>    Exact_to_interval;
-    typedef CGAL::Cartesian_converter<Kernel,Exact_kernel>     Double_to_exact;
-  
-    typedef typename Polyhedron::Vertex_const_handle           Vertex_handle;
-    typedef typename Polyhedron::Halfedge_const_handle         Halfedge_handle;
-    typedef typename Polyhedron::Facet_const_handle            Facet_handle; 
-    
-    typedef std::vector <Ikernel::Point_3>      Interval_nodes;
-    typedef std::vector <Exact_kernel::Point_3> Exact_nodes;
- 
-        
-  //members
-    Interval_nodes  inodes;
-    Exact_nodes enodes;
-  
-    Interval_to_double  interval_to_double;
-    Exact_to_interval   exact_to_interval;
-    Double_to_interval  double_to_interval;
-    Double_to_exact double_to_exact;
-    Exact_kernel        ek;
-    
-  public:
-    typedef CGAL::Interval_nt<false>::Protector                 Protector;  
-  
-    typename Kernel::Point_3
-    operator[](int i) const {
-      return interval_to_double(inodes[i]);
-    }
-    
-    const typename Ikernel::Point_3&
-    interval_node(int i) const {
-      return inodes[i];
-    }
-    
-    typename Ikernel::Point_3
-    to_interval(const typename Kernel::Point_3& p) const {
-      return double_to_interval(p);
-    }
-    
-    const Exact_kernel::Point_3
-    exact_node(int i) const {
-      return enodes[i];
-    }
-
-    typename Exact_kernel::Point_3
-    to_exact(const typename Kernel::Point_3& p) const {
-      return double_to_exact(p);
-    }    
-    
-    
-    size_t size() const {return enodes.size();}
-
-    void add_new_node(const Exact_kernel::Point_3& p){
-      const Ikernel::Point_3& p_approx=p.approx();
-      if ( !has_smaller_relative_precision(p_approx.x(),Lazy_exact_nt<typename Exact_kernel::FT>::get_relative_precision_of_to_double()) ||
-           !has_smaller_relative_precision(p_approx.y(),Lazy_exact_nt<typename Exact_kernel::FT>::get_relative_precision_of_to_double()) ||
-           !has_smaller_relative_precision(p_approx.z(),Lazy_exact_nt<typename Exact_kernel::FT>::get_relative_precision_of_to_double()) ) p.exact();
-      enodes.push_back(p);
-      inodes.push_back( exact_to_interval(p) );
-    }
-
-    void add_new_node(Halfedge_handle edge,Facet_handle facet)
-    {
-      add_new_node(compute_triangle_segment_intersection_point<Polyhedron,Kernel>(edge,facet,ek) );
-    }
-
-    //the point is an input
-    void add_new_node(const typename Kernel::Point_3& p){
-      enodes.push_back(to_exact(p));
-      inodes.push_back( double_to_interval(p) );
-    }
-  }; // end specialization
-     // Triangle_segment_intersection_points<Polyhedron,Kernel,Predicates_on_constructions,false>
-  
-  //Third specialization: The kernel already has exact constructions.
-  template <class Polyhedron,class Kernel,class Node_storage>
-  class Triangle_segment_intersection_points<Polyhedron,Kernel,Node_storage,true>
-  {
-  //typedefs
-    typedef std::vector <typename Kernel::Point_3>             Nodes_vector;
-    typedef typename Polyhedron::Halfedge_const_handle         Halfedge_handle;
-    typedef typename Polyhedron::Facet_const_handle            Facet_handle;
-  //members
-    Nodes_vector nodes;
-    Kernel k;
-  public:
-    typedef Kernel Ikernel;
-    typedef Kernel Exact_kernel;
-    typedef void* Protector;
-    const typename Kernel::Point_3&
-    operator[](int i) const {
-      return nodes[i];
-    }
-   
-    size_t size() const {return nodes.size();}
-    const typename Kernel::Point_3& exact_node(int i) const {return nodes[i];}
-    const typename Kernel::Point_3& interval_node(int i) const {return nodes[i];}
-    
-    //add a new node in the final graph.
-    //it is the intersection of the triangle with the segment
-    void add_new_node(Halfedge_handle edge,Facet_handle facet)
-    {
-      nodes.push_back (  
-        compute_triangle_segment_intersection_point<Polyhedron,Kernel>(edge,facet,k)
-      );
-    }
-
-    void add_new_node(const typename Kernel::Point_3& p)
-    {
-      nodes.push_back(p);
-    }
-    
-    const typename Kernel::Point_3& to_interval(const typename Kernel::Point_3& p) const { return p; }
-    const typename Kernel::Point_3& to_exact(const typename Kernel::Point_3& p) const { return p; }
-
-  }; // end specialization
-     // Triangle_segment_intersection_points<Polyhedron,Kernel,Node_storage,true>
-  
-}
-
-#ifdef CGAL_COREFINEMENT_DO_REPORT_SELF_INTERSECTIONS
-struct Intersection_of_Polyhedra_3_self_intersection_exception
-  : public std::logic_error
-  {
-    Intersection_of_Polyhedra_3_self_intersection_exception()
-      : std::logic_error("Self-intersection found in the facets involved in the intersection")
-    {}
-  };
-#endif
-
-//TODO an important requirement is that the Polyhedron should be based on a list-based
-//HDS. We use a lot of maps that use the address of Facet,Halfedge and a reallocation would
-//be dramatic.
-
-template< class Polyhedron,
-          class Kernel=typename Polyhedron::Traits::Kernel,
-          class Node_visitor=Empty_node_visitor<Polyhedron>,
-          class Node_storage_type=typename Node_visitor::Node_storage_type,
-          class Use_const_polyhedron=typename Node_visitor::Is_polyhedron_const
-         >
-class Intersection_of_Polyhedra_3{
-
-//typedefs  
-  typedef typename Kernel::Triangle_3                        Triangle;
-  typedef typename Kernel::Segment_3                         Segment;
-  typedef internal_IOP::
-    Polyhedron_types<Polyhedron,Use_const_polyhedron>        Polyhedron_types;
-  
-  typedef typename Polyhedron_types::Polyhedron_ref          Polyhedron_ref;
-  typedef typename Polyhedron_types::Halfedge_handle         Halfedge_handle;
-  typedef typename Polyhedron_types::Halfedge_iterator       Halfedge_iterator;
-  typedef typename Polyhedron_types::Facet_iterator          Facet_iterator;
-  typedef typename Polyhedron_types::Facet_handle            Facet_handle;
-  typedef typename Polyhedron_types::Vertex_handle           Vertex_handle;
-  typedef typename Polyhedron_types::Vertex                  Vertex;
-  typedef typename Polyhedron_types::Facet                   Facet;
-  typedef CGAL::Box_intersection_d::Box_with_handle_d<
-            double, 3, Halfedge_handle>                      Box;
-  typedef std::pair<Facet_handle,Facet_handle>               Facet_pair;
-  typedef std::pair<Facet_pair,int>                          Facet_pair_and_int;
-  
-  typedef internal_IOP::
-            Compare_handles<Polyhedron,Use_const_polyhedron> Compare_handles;
-
-  typedef internal_IOP::
-       Compare_handle_pairs<Polyhedron,Use_const_polyhedron> Compare_handle_pairs;
-  
-
-  typedef std::map<Facet_pair_and_int,                                           //we use Facet_pair_and_int and not Facet_pair to handle coplanar case.
-                   std::set<int>,Compare_handle_pairs>       Facets_to_nodes_map;//Indeed the boundary of the intersection of two coplanar triangles may contain several segments.
-  typedef std::set<Facet_pair,Compare_handle_pairs>          Coplanar_facets_set;//any insertion should be done with make_sorted_pair_of_facets
-  typedef typename Kernel::Point_3                           Node;
-  typedef internal_IOP::Triangle_segment_intersection_points
-            <Polyhedron,Kernel,Node_storage_type>            Nodes_vector;
-
-  typedef typename internal_IOP::
-    Intersection_types<Polyhedron,Use_const_polyhedron>
-      ::Intersection_result                                  Intersection_result;
-
-  typedef std::set<Facet_handle,Compare_handles>             Facet_set;
-
-  typedef std::map
-            <Halfedge_handle,Facet_set,Compare_handles>      Edge_to_intersected_facets;
-  #ifdef USE_DETECTION_MULTIPLE_DEFINED_EDGES
-  typedef std::set<Facet_pair,Compare_handle_pairs>          Coplanar_duplicated_intersection_set;
-  #endif
-//helper functions
-  static inline Facet_pair 
-  make_sorted_pair_of_facets(Facet_handle fh1,Facet_handle fh2) {
-    const Facet* f1=&(*fh1);
-    const Facet* f2=&(*fh2);
-    if (f1 < f2)
-      return Facet_pair(fh1,fh2);
-    return Facet_pair(fh2,fh1);
-  }
-
-  static inline Facet_pair_and_int
-  make_sorted_pair_of_facets_with_int(Facet_handle fh1,Facet_handle fh2,int i) {
-    return std::make_pair(make_sorted_pair_of_facets(fh1,fh2),i);
-  }
-
-  static inline std::pair<void*,void*> make_sorted_void_pair(void* v1,void* v2){
-    if (v1<v2) return std::make_pair(v1,v2);
-    return std::make_pair(v2,v1);
-  }
-
-  static inline Halfedge_handle smaller_handle(Halfedge_handle h){
-    if ( &(*h)<&(*h->opposite()) ) return h;
-    return h->opposite();
-  }
-  
-//member variables
-  Edge_to_intersected_facets  edge_to_sfacet; //Associate a segment to a filtered set of facets that may be intersected
-  Facets_to_nodes_map         f_to_node;      //Associate a pair of triangle to their intersection points
-  Coplanar_facets_set         coplanar_facets;//Contains all pairs of triangular facets intersecting that are coplanar
-  Nodes_vector                nodes;          //Contains intersection points of polyhedra
-  Node_visitor*               visitor;
-  bool                        is_default_visitor; //indicates whether the visitor need to be deleted
-  #ifdef USE_DETECTION_MULTIPLE_DEFINED_EDGES
-  //this does not occur only when one extremity of an edge is inside a face.
-  // The problem occur every time an edge or a part of an edge with two incident triangles
-  // is on the intersection polyline, I choose to direcly filter the output by removing duplicated edges
-  Coplanar_duplicated_intersection_set coplanar_duplicated_intersection;//Set containing edges that are duplicated because of edges (partially) included in a triangle
-  #endif
-  
-//functions that should come from a traits class
-  bool has_at_least_two_incident_faces(Halfedge_handle edge)
-  {
-    return !edge->is_border_edge();
-  }
-  
-  template <class Output_iterator>
-  void get_incident_facets(Halfedge_handle edge,Output_iterator out){
-    if (!edge->is_border()) *out++=edge->facet();
-    if (!edge->opposite()->is_border()) *out++=edge->opposite()->facet();
-  }
-
-  template <class Output_iterator>
-  void get_incident_edges_to_vertex(Halfedge_handle edge,Output_iterator out){
-    Halfedge_handle current=edge;
-    do{
-      *out++=current;
-      current=current->next()->opposite();
-    }
-    while(current!=edge);
-  }
-
-//internal functions
-  
-  class Map_edge_facet_bbox_intersection {
-    Edge_to_intersected_facets& edge_to_sfacet;
-    Polyhedron_ref polyhedron_triangle;
-    Polyhedron_ref polyhedron_edge;
-    Node_visitor& visitor;
-  public:
-    Map_edge_facet_bbox_intersection(Edge_to_intersected_facets& map_,
-                                     Polyhedron_ref  P,
-                                     Polyhedron_ref Q,
-                                     Node_visitor& visitor_)
-      :edge_to_sfacet(map_),polyhedron_triangle(P),polyhedron_edge(Q),visitor(visitor_){}
-
-    void operator()( const Box* fb, const Box* eb) const {
-      Halfedge_handle fh = fb->handle();
-      Halfedge_handle eh = eb->handle();
-
-      // The following call to map::insert() attempts an insertion of a pair
-      // into 'edge_to_sfacet'. If 'eh' is already inserted in the map,
-      // then the result 'res' is the current entry in the map for 'eh'.
-      typename Edge_to_intersected_facets::iterator res=
-        edge_to_sfacet.insert(std::make_pair(eh,Facet_set())).first;
-
-      res->second.insert(fh->facet());
-      // That could have been shortened to:
-      //
-      //       edge_to_sfacet[eh].insert(fh->facet())
-      //
-      // -- Laurent Rineau, 2012/11/01
-
-      visitor.add_filtered_intersection(eh,fh,polyhedron_edge,polyhedron_triangle);
-    }
-  };
-
-  class Map_edge_facet_bbox_intersection_extract_coplanar {
-    Edge_to_intersected_facets& edge_to_sfacet;
-    Coplanar_facets_set& coplanar_facets;
-    Polyhedron_ref polyhedron_triangle;
-    Polyhedron_ref polyhedron_edge;
-    Node_visitor& visitor;
-  public:
-    Map_edge_facet_bbox_intersection_extract_coplanar(
-      Edge_to_intersected_facets& map_,
-      Coplanar_facets_set& coplanar_facets_,
-      Polyhedron_ref  P,
-      Polyhedron_ref Q,
-      Node_visitor& visitor_)
-      :edge_to_sfacet(map_),coplanar_facets(coplanar_facets_),polyhedron_triangle(P),polyhedron_edge(Q),visitor(visitor_)
-    {}
-
-    void operator()( const Box* fb, const Box* eb) const {
-      Halfedge_handle fh = fb->handle(); //handle for the face
-      Halfedge_handle eh = eb->handle(); //handle for the edge
-      if(eh->is_border()) eh = eh->opposite();
-      CGAL_assertion(!eh->is_border());
-      
-      //check if the segment intersects the plane of the facet or if it is included in the plane
-      const typename Kernel::Point_3 & a = fh->vertex()->point();
-      const typename Kernel::Point_3 & b = fh->next()->vertex()->point();
-      const typename Kernel::Point_3 & c = fh->next()->next()->vertex()->point();
-      const Orientation abcp = orientation(a,b,c,eh->vertex()->point());
-      const Orientation abcq = orientation(a,b,c,eh->opposite()->vertex()->point());
-      if (abcp==abcq){
-        if (abcp!=COPLANAR){
-//          std::cout << "rejected " << &(*fh->facet()) << "{" << &(*eh->facet()) << " " <<&(*eh->opposite()->facet()) << " "<< eh->vertex()->point() << " " << eh->opposite()->vertex()->point() << "}" <<std::endl;
-          return; //no intersection
-        }
-        //WARNING THIS IS DONE ONLY FOR POLYHEDRON (MAX TWO INCIDENT FACETS TO EDGE)
-        if (/* !eh->is_border() && */ orientation(a,b,c,eh->next()->vertex()->point())==COPLANAR){
-          coplanar_facets.insert(make_sorted_pair_of_facets(eh->facet(),fh->facet()));
-        }
-        if (!eh->opposite()->is_border() && orientation(a,b,c,eh->opposite()->next()->vertex()->point())==COPLANAR){
-          coplanar_facets.insert(make_sorted_pair_of_facets(eh->opposite()->facet(),fh->facet()));
-        }
-        visitor.add_filtered_intersection(eh,fh,polyhedron_edge,polyhedron_triangle);
-        //in case only the edge is coplanar, the intersection points will be detected using an incident facet 
-        //(see remark at the beginning of the file)
-        return; 
-      }
-      
-      typename Edge_to_intersected_facets::iterator res=
-        edge_to_sfacet.insert(std::make_pair(eh,Facet_set())).first;
-      res->second.insert(fh->facet());
-      visitor.add_filtered_intersection(eh,fh,polyhedron_edge,polyhedron_triangle);
-    }
-  };
-
-  class Map_edge_facet_bbox_intersection_extract_coplanar_filter_self_intersections {
-    Polyhedron_ref polyhedron_triangle;
-    Polyhedron_ref polyhedron_edge;
-
-    std::set<Facet_handle>& m_reported_facets;
-    std::vector<std::pair<const Box*,const Box*> >& m_intersecting_bboxes;
-  public:
-    Map_edge_facet_bbox_intersection_extract_coplanar_filter_self_intersections(
-      Polyhedron_ref  P,
-      Polyhedron_ref Q,
-      std::set<Facet_handle>& reported_facets,
-      std::vector<std::pair<const Box*,const Box*> >& intersecting_bboxes
-    )
-      : polyhedron_triangle(P)
-      , polyhedron_edge(Q)
-      , m_reported_facets(reported_facets)
-      , m_intersecting_bboxes(intersecting_bboxes)
-    {}
-
-    void operator()( const Box* fb, const Box* eb) {
-      m_reported_facets.insert( fb->handle()->facet() );
-      m_intersecting_bboxes.push_back( std::make_pair(fb, eb) );
-    }
-
-    bool self_intersections_found()
-    {
-      try{
-        typedef typename CGAL::Box_intersection_d::Box_with_info_d<double, 3, Facet_handle> Box;
-
-        // make one box per facet
-        std::vector<Box> boxes;
-        boxes.reserve(m_reported_facets.size());
-
-        BOOST_FOREACH(Facet_handle fh, m_reported_facets)
-        {
-          boxes.push_back( Box( fh->halfedge()->vertex()->point().bbox() +
-                                fh->halfedge()->next()->vertex()->point().bbox() +
-                                fh->halfedge()->opposite()->vertex()->point().bbox(), fh )
-          );
-        }
-
-        // generate box pointers
-        std::vector<const Box*> box_ptr;
-        box_ptr.reserve(boxes.size());
-        typename std::vector<Box>::iterator b;
-        for(b = boxes.begin();
-          b != boxes.end();
-          b++)
-          box_ptr.push_back(&*b);
-
-        // compute self-intersections filtered out by boxes
-        typedef boost::function_output_iterator<internal::Throw_at_output> OutputIterator;
-        OutputIterator out;
-        internal::Intersect_facets<Polyhedron,Kernel,
-                                   Box,OutputIterator,
-                                   typename boost::property_map<Polyhedron,boost::vertex_point_t>::type>
-          intersect_facets(polyhedron_triangle, out, get(boost::vertex_point, polyhedron_triangle), Kernel());
-        std::ptrdiff_t cutoff = 2000;
-        CGAL::box_self_intersection_d(box_ptr.begin(), box_ptr.end(),intersect_facets,cutoff);
-        return false;
-      }
-      catch( internal::Throw_at_output::Throw_at_output_exception& )
-      {
-        return true;
-      }
-    }
-  };
-  
-  // This function tests the intersection of the faces of P with the edges of Q
-  void filter_intersections( Polyhedron_ref P, Polyhedron_ref Q) {
-    std::vector<Box> facet_boxes, edge_boxes;
-    facet_boxes.reserve( P.size_of_facets());
-    for ( Facet_iterator i = P.facets_begin(); i != P.facets_end(); ++i){
-        facet_boxes.push_back(
-            Box( i->halfedge()->vertex()->point().bbox()
-               + i->halfedge()->next()->vertex()->point().bbox()
-               + i->halfedge()->next()->next()->vertex()->point().bbox(),
-                 i->halfedge()));
-    }
-    std::vector<const Box*> facet_box_ptr;
-    facet_box_ptr.reserve( P.size_of_facets());
-    for ( typename std::vector<Box>::iterator j = facet_boxes.begin(); j != facet_boxes.end(); ++j){
-        facet_box_ptr.push_back( &*j);
-    }
-      
-    for ( Halfedge_iterator i = Q.halfedges_begin(); i != Q.halfedges_end(); ++i){
-      if(&*i < &*(i->opposite())){
-        edge_boxes.push_back(
-            Box( i->vertex()->point().bbox()
-                 + i->opposite()->vertex()->point().bbox(),
-                 i));
-      }
-   }
-   
-    std::vector<const Box*> edge_box_ptr;
-    edge_box_ptr.reserve( Q.size_of_halfedges()/2);
-    for ( typename std::vector<Box>::iterator j = edge_boxes.begin(); j != edge_boxes.end(); ++j){
-        edge_box_ptr.push_back( &*j);
-    }
-
-  #ifdef CGAL_COREFINEMENT_DO_REPORT_SELF_INTERSECTIONS
-    // this version first collect faces involved in the intersection and first
-    // check if they are involved in a self-intersection.
-    std::set<Facet_handle> reported_facets;
-    std::vector<std::pair<const Box*,const Box*> > intersecting_bboxes;
-    Map_edge_facet_bbox_intersection_extract_coplanar_filter_self_intersections
-      inter_functor4selfi(P, Q, reported_facets, intersecting_bboxes);
-    CGAL::box_intersection_d( facet_box_ptr.begin(), facet_box_ptr.end(),
-                              edge_box_ptr.begin(), edge_box_ptr.end(),
-                              inter_functor4selfi, std::ptrdiff_t(2000) );
-
-    if (inter_functor4selfi.self_intersections_found()) throw Intersection_of_Polyhedra_3_self_intersection_exception();
-
-    #ifdef DO_NOT_HANDLE_COPLANAR_FACETS
-    Map_edge_facet_bbox_intersection inter_functor(edge_to_sfacet,P,Q,*visitor);
-    #else // not DO_NOT_HANDLE_COPLANAR_FACETS
-    Map_edge_facet_bbox_intersection_extract_coplanar inter_functor(edge_to_sfacet,coplanar_facets,P,Q,*visitor);
-    #endif // not DO_NOT_HANDLE_COPLANAR_FACETS
-
-    typedef std::pair<const Box*,const Box*> Type_pair;
-    BOOST_FOREACH(const Type_pair& p, intersecting_bboxes)
-      inter_functor(p.first, p.second);
-  #else
-    CGAL::box_intersection_d( facet_box_ptr.begin(), facet_box_ptr.end(),
-                              edge_box_ptr.begin(), edge_box_ptr.end(),
-    #ifdef DO_NOT_HANDLE_COPLANAR_FACETS
-                              // Note that 'edge_to_sfacet' is passed by
-                              // non-const reference, here, to be filled.
-                              Map_edge_facet_bbox_intersection(edge_to_sfacet,P,Q,*visitor),
-    #else // not DO_NOT_HANDLE_COPLANAR_FACETS
-                              Map_edge_facet_bbox_intersection_extract_coplanar(edge_to_sfacet,coplanar_facets,P,Q,*visitor),
-    #endif // not DO_NOT_HANDLE_COPLANAR_FACETS
-                              std::ptrdiff_t(2000)
-    );
-  #endif
-  }
-
-
-  void add_intersection_point_to_facet_and_all_edge_incident_facets(Facet_handle facet,
-                                                                    Halfedge_handle edge,
-                                                                    int node_id)
-  {
-    std::vector<Facet_handle> incident_facets;
-    get_incident_facets(edge,std::back_inserter(incident_facets));
-    for (typename std::vector<Facet_handle>::iterator it=incident_facets.begin();
-         it!=incident_facets.end();++it)
-    {
-      CGAL_assertion(cgal_do_intersect_debug(facet,*it));
-      
-      Facet_pair facet_pair = make_sorted_pair_of_facets(facet,*it);
-      if ( !coplanar_facets.empty() && coplanar_facets.find(facet_pair)!=coplanar_facets.end() ) continue;
-      typename Facets_to_nodes_map::iterator it_list=
-        f_to_node.insert( std::make_pair( Facet_pair_and_int(facet_pair,0),std::set<int>()) ).first;
-      it_list->second.insert(node_id);
-    }
-  }
-
-  void cip_handle_case_edge(int node_id,
-                            Facet_set* fset,
-                            Halfedge_handle edge,
-                            Halfedge_handle edge_intersected)
-  {
-    //associate the intersection point to all facets incident to the intersected edge using edge
-    std::vector<Facet_handle> incident_facets;
-    get_incident_facets(edge_intersected,std::back_inserter(incident_facets));
-    for (typename std::vector<Facet_handle>::iterator it=incident_facets.begin();
-         it!=incident_facets.end();++it)
-    {
-      add_intersection_point_to_facet_and_all_edge_incident_facets(*it,edge,node_id);
-      if (fset!=NULL) fset->erase(*it);
-    }
-    incident_facets.clear();
-
-    //associate the intersection point to all facets incident to edge using the intersected edge
-    //at least one pair of facets is already handle above
-    
-    typename Edge_to_intersected_facets::iterator it_fset=edge_to_sfacet.find(edge_intersected);
-    if (it_fset==edge_to_sfacet.end()) return;
-    Facet_set& fset_bis=it_fset->second;
-    get_incident_facets(edge,std::back_inserter(incident_facets));
-    for (typename std::vector<Facet_handle>::iterator it=incident_facets.begin();
-         it!=incident_facets.end();++it)
-    {
-//      add_intersection_point_to_facet_and_all_edge_incident_facets(*it,edge_intersected,node_id); //this call is not needed, already done in the first loop
-      fset_bis.erase(*it);
-    }
-  }
-
-  void cip_handle_case_vertex(int node_id,
-                              Facet_set* fset,
-                              Halfedge_handle edge,
-                              Halfedge_handle vertex_intersected)
-  {
-    std::vector<Halfedge_handle> incident_halfedges;
-    get_incident_edges_to_vertex(vertex_intersected,std::back_inserter(incident_halfedges));
-    for (typename std::vector<Halfedge_handle>::iterator 
-      it=incident_halfedges.begin();it!=incident_halfedges.end();++it)
-    {
-      cip_handle_case_edge(node_id,fset,edge,*it);
-    }
-  }
-
-  //add a new node in the final graph.
-  //it is the intersection of the triangle with the segment
-  void add_new_node(Halfedge_handle edge,
-                    Facet_handle facet,
-                    const Intersection_result& inter_res,
-                    Nodes_vector& nodes)
-  {
-    bool is_vertex_coplanar = CGAL::cpp11::get<2>(inter_res);
-    if (is_vertex_coplanar)
-      nodes.add_new_node(edge->vertex()->point());
-    else{
-      bool is_opposite_vertex_coplanar = CGAL::cpp11::get<3>(inter_res);
-      if (is_opposite_vertex_coplanar)
-        nodes.add_new_node(edge->opposite()->vertex()->point());
-      else
-        nodes.add_new_node(edge,facet);
-    }
-  }
-
-  //either the exact or input point can be used to create a node
-  //with this function
-  template<class Point>
-  void add_new_node(const Point& pt)
-  {
-    nodes.add_new_node(pt);
-  }
-
-  
-  #ifdef USE_DETECTION_MULTIPLE_DEFINED_EDGES
-  void check_coplanar_edge(Halfedge_handle hedge,Facet_handle facet)
-  {
-    const typename Kernel::Point_3& p0=facet->halfedge()->vertex()->point();
-    const typename Kernel::Point_3& p1=facet->halfedge()->next()->vertex()->point();
-    const typename Kernel::Point_3& p2=facet->halfedge()->opposite()->vertex()->point();
-    CGAL_precondition( orientation( p0,p1,p2,hedge->vertex()->point() ) == COPLANAR );
-
-    if ( has_at_least_two_incident_faces(hedge) &&  orientation( p0,p1,p2,hedge->opposite()->vertex()->point() ) == COPLANAR )
-    {
-      //In case two facets are incident along such this edge, the intersection
-      //will be reported twice. We keep track of this so that at the end, we can remove one intersecting edge out of the two
-      //choose the smaller of the two faces (only one need to de deleted)
-      Facet_handle smaller=make_sorted_pair_of_facets(hedge->face(),hedge->opposite()->face()).first;
-      coplanar_duplicated_intersection.insert(make_sorted_pair_of_facets(smaller,facet));
-    }    
-  }
-  
-  bool are_incident_facets_coplanar(Halfedge_handle hedge){
-    const typename Kernel::Point_3& p0=hedge->vertex()->point();
-    const typename Kernel::Point_3& p1=hedge->next()->vertex()->point();
-    const typename Kernel::Point_3& p2=hedge->opposite()->vertex()->point();
-    const typename Kernel::Point_3& p3=hedge->opposite()->next()->vertex()->point();
-    return orientation( p0,p1,p2,p3 ) == COPLANAR;
-  }
-
-  void check_coplanar_edge(Halfedge_handle hedge,Halfedge_handle additional_edge,internal_IOP::Intersection_type type)
-  {
-    switch(type){
-      case internal_IOP::FACET:
-        check_coplanar_edge(hedge,additional_edge->face());
-      break;
-      
-      case internal_IOP::EDGE:
-        if ( !additional_edge->is_border() ){
-          check_coplanar_edge(hedge,additional_edge->face());
-        }
-        if (!additional_edge->opposite()->is_border())
-          check_coplanar_edge(hedge,additional_edge->opposite()->face());
-      break;        
-      case internal_IOP::VERTEX:
-      {
-        //consider  all incident faces
-        Halfedge_handle current=additional_edge;
-        do{
-          if( !current->is_border() )
-          check_coplanar_edge(hedge,current->face());
-          current=current->next()->opposite();
-        }
-        while(current!=additional_edge);
-      }
-      break;
-      
-      default:
-        CGAL_assertion(type==internal_IOP::COPLNR);
-      break;
-    }    
-  }
-  
-  void check_coplanar_edge_old(Halfedge_handle hedge,Halfedge_handle additional_edge,internal_IOP::Intersection_type type)
-  {
-    switch(type){
-      case internal_IOP::FACET:
-        check_coplanar_edge(hedge,additional_edge->face());
-      break;
-      
-      case internal_IOP::EDGE:
-      {
-        if ( !additional_edge->is_border() ){
-          if (!additional_edge->opposite()->is_border()){
-            if ( are_incident_facets_coplanar(additional_edge) )
-            {
-              Facet_handle facet=additional_edge->face();
-              const typename Kernel::Point_3& p0=facet->halfedge()->vertex()->point();
-              const typename Kernel::Point_3& p1=facet->halfedge()->next()->vertex()->point();
-              const typename Kernel::Point_3& p2=facet->halfedge()->opposite()->vertex()->point();
-              CGAL_precondition( orientation( p0,p1,p2,hedge->vertex()->point() ) == COPLANAR );
-
-              if ( has_at_least_two_incident_faces(hedge) &&  orientation( p0,p1,p2,hedge->opposite()->vertex()->point() ) == COPLANAR )
-              {
-                //In case two facets are incident along a common edge of two coplanar triangles.
-                //We need to remove three out of the four reported pair
-                Facet_handle smaller=make_sorted_pair_of_facets(hedge->face(),hedge->opposite()->face()).first;
-                coplanar_duplicated_intersection.insert(make_sorted_pair_of_facets(hedge->face(),facet));
-                coplanar_duplicated_intersection.insert(make_sorted_pair_of_facets(hedge->opposite()->face(),facet));
-                coplanar_duplicated_intersection.insert(make_sorted_pair_of_facets(hedge->opposite()->face(),additional_edge->opposite()->face()));
-              }              
-            }
-            else
-            {
-              check_coplanar_edge(hedge,additional_edge->face());
-              check_coplanar_edge(hedge,additional_edge->opposite()->face());
-            }
-          }
-          else
-            check_coplanar_edge(hedge,additional_edge->face());
-        }
-        else{
-          CGAL_assertion(!additional_edge->opposite()->is_border());
-          check_coplanar_edge(hedge,additional_edge->opposite()->face());
-        }
-      }
-      break;        
-      case internal_IOP::VERTEX:
-        
-      break;
-      
-      default:
-        CGAL_assertion(type==internal_IOP::COPLNR);
-      break;
-    }    
-  }
-  
-  template <class Hedge_iterator>
-  void check_coplanar_edges(Hedge_iterator begin,Hedge_iterator end,Halfedge_handle additional_edge,internal_IOP::Intersection_type type)
-  {
-    for (Hedge_iterator it=begin;it!=end;++it)
-      check_coplanar_edge(*it,additional_edge,type);
-  }
-  #endif // USE_DETECTION_MULTIPLE_DEFINED_EDGES
-  
-  void print_type_debug(internal_IOP::Intersection_type type,bool cpl,bool opp_cpl)
-  {
-    switch(type){
-      case internal_IOP::COPLNR:
-        std::cout << "COPLNR " << cpl << " " <<  opp_cpl << std::endl;
-      break;
-      case internal_IOP::EMPTY:
-        std::cout << "EMPTY " << cpl << " " <<  opp_cpl << std::endl;
-      break;
-      
-      case internal_IOP::FACET:
-        std::cout << "FACET " << cpl << " " <<  opp_cpl << std::endl;
-      break;
-      
-      case internal_IOP::EDGE:
-        std::cout << "EDGE " << cpl << " " <<  opp_cpl << std::endl;
-      break;        
-      case internal_IOP::VERTEX:
-        std::cout << "VERTEX " << cpl << " " <<  opp_cpl << std::endl;
-      break;
-    }
-  }
-  
-
-  void handle_coplanar_case_VERTEX_FACET(Halfedge_handle vertex,Halfedge_handle facet,int node_id){
-    visitor->new_node_added(node_id,internal_IOP::FACET,vertex,facet,true,false);
-    std::vector<Halfedge_handle> all_edges;
-    get_incident_edges_to_vertex(vertex,std::back_inserter(all_edges));
-    typename std::vector<Halfedge_handle>::iterator it_edge=all_edges.begin();
-    for (;it_edge!=all_edges.end();++it_edge){
-      add_intersection_point_to_facet_and_all_edge_incident_facets(facet->facet(),*it_edge,node_id);
-      typename Edge_to_intersected_facets::iterator it_ets=edge_to_sfacet.find(*it_edge);
-      if (it_ets!=edge_to_sfacet.end()) it_ets->second.erase(facet->facet());
-    }
-  }
-  
-  void handle_coplanar_case_VERTEX_EDGE(Halfedge_handle vertex,Halfedge_handle edge,int node_id){
-    visitor->new_node_added(node_id,internal_IOP::VERTEX,edge,vertex,false,false);
-    std::vector<Halfedge_handle> all_edges;
-    get_incident_edges_to_vertex(vertex,std::back_inserter(all_edges));
-    typename std::vector<Halfedge_handle>::iterator it_edge=all_edges.begin();
-    for (;it_edge!=all_edges.end();++it_edge){
-      typename Edge_to_intersected_facets::iterator it_ets=edge_to_sfacet.find(*it_edge);
-      Facet_set* fset = (it_ets!=edge_to_sfacet.end())?&(it_ets->second):NULL;
-      cip_handle_case_edge(node_id,fset,*it_edge,edge);
-    }
-  }
-
-  void handle_coplanar_case_VERTEX_VERTEX(Halfedge_handle vertex1,Halfedge_handle vertex2,int node_id){
-    visitor->new_node_added(node_id,internal_IOP::VERTEX,vertex2,vertex1,true,false);
-    std::vector<Halfedge_handle> all_edges;
-    get_incident_edges_to_vertex(vertex1,std::back_inserter(all_edges));
-    typename std::vector<Halfedge_handle>::iterator it_edge=all_edges.begin();          
-    for (;it_edge!=all_edges.end();++it_edge){
-      typename Edge_to_intersected_facets::iterator it_ets=edge_to_sfacet.find(*it_edge);
-      Facet_set* fset = (it_ets!=edge_to_sfacet.end())?&(it_ets->second):NULL;
-      cip_handle_case_vertex(node_id,fset,*it_edge,vertex2);
-    }
-  }
-  
-  
-  template<class Cpl_inter_pt,class Coplanar_node_map>
-  int get_or_create_node(Cpl_inter_pt& ipt,int& current_node,Coplanar_node_map& coplanar_node_map){
-    void *v1, *v2;
-    switch(ipt.type_1){
-      case internal_IOP::VERTEX: v1=(void*)( &(*(ipt.info_1->vertex()))     );  break;
-      case internal_IOP::EDGE  : v1=(void*)( &(*smaller_handle(ipt.info_1)) );  break;
-      case internal_IOP::FACET : v1=(void*)( &(*(ipt.info_1->facet()))      );  break;
-      default: CGAL_error_msg("Should not get there!");
-    }
-
-    switch(ipt.type_2){
-      case internal_IOP::VERTEX: v2=(void*)( &(*(ipt.info_2->vertex()))     );  break;
-      case internal_IOP::EDGE  : v2=(void*)( &(*smaller_handle(ipt.info_2)) );  break;
-      case internal_IOP::FACET : v2=(void*)( &(*(ipt.info_2->facet()))      );  break;
-      default: CGAL_error_msg("Should not get there!");
-    }
-
-    std::pair<void*,void*> key=make_sorted_void_pair(v1,v2);
-
-    std::pair<typename Coplanar_node_map::iterator,bool> res=coplanar_node_map.insert(std::make_pair(key,current_node+1));
-    if (res.second){ //insert a new node
-      
-      if (ipt.type_1==internal_IOP::VERTEX)
-        add_new_node(ipt.info_1->vertex()->point());
-      else{
-        if(ipt.type_2==internal_IOP::VERTEX)
-          add_new_node(ipt.info_2->vertex()->point());
-        else
-          add_new_node(ipt.point);
-      }
-      return ++current_node;
-    }
-    return res.first->second;
-  }
-  
-  void compute_intersection_of_coplanar_facets(int& current_node){
-    typedef std::map<std::pair<void*,void*>,int> Coplanar_node_map;
-    Coplanar_node_map coplanar_node_map;
-    
-    for (typename Coplanar_facets_set::iterator it=coplanar_facets.begin();it!=coplanar_facets.end();++it){
-      Facet_handle f1=it->first;
-      Facet_handle f2=it->second;
-      typedef internal_IOP::Intersection_point_with_info<Kernel,Halfedge_handle> Cpl_inter_pt;
-      std::list<Cpl_inter_pt> inter_pts;
-      internal_IOP::intersection_coplanar_facets<Kernel>(f1->halfedge(),f2->halfedge(),inter_pts);
-//      std::cout << "found " << inter_pts.size() << " inter pts: "; 
-      std::size_t nb_pts=inter_pts.size();
-      std::vector<int> cpln_nodes; cpln_nodes.reserve(nb_pts);
-      for (typename std::list<Cpl_inter_pt>::iterator iti=inter_pts.begin();iti!=inter_pts.end();++iti){
-        #ifdef CGAL_COREFINEMENT_DEBUG
-        //iti->print_debug();
-        #endif
-        CGAL_assertion(iti->is_valid());
-        int node_id=get_or_create_node(*iti,current_node,coplanar_node_map);
-        cpln_nodes.push_back(node_id);
-
-        switch(iti->type_1){
-          case internal_IOP::VERTEX:
-          {
-            switch(iti->type_2){
-              case internal_IOP::VERTEX: handle_coplanar_case_VERTEX_VERTEX(iti->info_1,iti->info_2,node_id); break;
-              case internal_IOP::EDGE  : handle_coplanar_case_VERTEX_EDGE(iti->info_1,iti->info_2,node_id);   break;
-              case internal_IOP::FACET : handle_coplanar_case_VERTEX_FACET(iti->info_1,iti->info_2,node_id);  break;
-              default: CGAL_error_msg("Should not get there!");
-            }
-          }
-          break;
-          case internal_IOP::EDGE:{
-            switch(iti->type_2){
-              case internal_IOP::VERTEX:handle_coplanar_case_VERTEX_EDGE(iti->info_2,iti->info_1,node_id);break;
-              case internal_IOP::EDGE:
-              {
-                visitor->new_node_added(node_id,internal_IOP::EDGE,iti->info_1,iti->info_2,false,false);
-                typename Edge_to_intersected_facets::iterator it_ets=edge_to_sfacet.find(iti->info_1);
-                Facet_set* fset = (it_ets!=edge_to_sfacet.end())?&(it_ets->second):NULL;
-                cip_handle_case_edge(node_id,fset,iti->info_1,iti->info_2);                
-              }
-              break;
-              default: CGAL_error_msg("Should not get there!");
-            }
-          }            
-          break;
-          
-          case internal_IOP::FACET:
-          {
-            CGAL_assertion(iti->type_2==internal_IOP::VERTEX);
-            handle_coplanar_case_VERTEX_FACET(iti->info_2,iti->info_1,node_id);
-          }
-          break;
-          
-          default: CGAL_error_msg("Should not get there!");
-        }
-      }
-      switch (nb_pts){
-        case 0: break;
-        case 1:
-        {
-          typename Facets_to_nodes_map::iterator it_list=  
-            f_to_node.insert( std::make_pair( Facet_pair_and_int(*it,1),std::set<int>()) ).first;
-          it_list->second.insert(cpln_nodes[0]);
-        }
-        break;
-        default:
-        {
-          int i=0;
-          std::size_t stop=nb_pts + (nb_pts<3?-1:0);
-          for (std::size_t k=0;k<stop;++k){
-            typename Facets_to_nodes_map::iterator it_list=
-              f_to_node.insert( std::make_pair( Facet_pair_and_int(*it,++i),std::set<int>()) ).first;
-            it_list->second.insert( cpln_nodes[k] );
-            it_list->second.insert( cpln_nodes[(k+1)%nb_pts] );
-          }
-        }
-      }
-//      std::cout << std::endl;
-    }
-  }
-  
-  void compute_intersection_points(int& current_node){
-    for(typename Edge_to_intersected_facets::iterator it=edge_to_sfacet.begin();it!=edge_to_sfacet.end();++it){
-      Halfedge_handle edge=it->first;
-      Facet_set& fset=it->second;
-      while (!fset.empty()){
-        Facet_handle facet=*fset.begin();
-        
-        Intersection_result res=internal_IOP::do_intersect<Polyhedron,Kernel,Use_const_polyhedron>(edge,facet);
-        internal_IOP::Intersection_type type=CGAL::cpp11::get<0>(res);
-        
-        //handle degenerate case: one extremity of edge below to facet
-        std::vector<Halfedge_handle> all_edges;
-        if ( CGAL::cpp11::get<2>(res) )
-          get_incident_edges_to_vertex(edge,std::back_inserter(all_edges));
-        else{
-          if ( CGAL::cpp11::get<3>(res) )
-            get_incident_edges_to_vertex(edge->opposite(),std::back_inserter(all_edges));
-          else
-            all_edges.push_back(edge);
-        }
-        
-        CGAL_precondition(*all_edges.begin()==edge || *all_edges.begin()==edge->opposite());
-//        print_type_debug(type,CGAL::cpp11::get<2>(res),CGAL::cpp11::get<3>(res));
-       
-        #ifdef USE_DETECTION_MULTIPLE_DEFINED_EDGES
-        check_coplanar_edges(boost::next(all_edges.begin()),all_edges.end(),CGAL::cpp11::get<1>(res),type);
-        #endif
-        
-        typename std::vector<Halfedge_handle>::iterator it_edge=all_edges.begin();
-        switch(type){
-          case internal_IOP::COPLNR:
-            #ifndef DO_NOT_HANDLE_COPLANAR_FACETS
-            CGAL_assertion(!"COPLANR : this point should never be reached!");
-            #else
-            //nothing need to be done, cf. comments at the beginning of the file
-            #endif
-          break;
-          case internal_IOP::EMPTY:
-            fset.erase(fset.begin());
-            CGAL_assertion(!cgal_do_intersect_debug(edge,facet));
-          break;
-
-          // Case when the edge pierces the facet in its interior.
-          case internal_IOP::FACET:
-          {
-            CGAL_assertion(cgal_do_intersect_debug(edge,facet));
-            CGAL_assertion(facet==CGAL::cpp11::get<1>(res)->face());
-
-            int node_id=++current_node;
-            add_new_node(edge,facet,res,nodes);
-            visitor->new_node_added(node_id,internal_IOP::FACET,edge,facet->halfedge(),CGAL::cpp11::get<2>(res),CGAL::cpp11::get<3>(res));
-            for (;it_edge!=all_edges.end();++it_edge){
-              add_intersection_point_to_facet_and_all_edge_incident_facets(facet,*it_edge,node_id);
-              //erase facet from the list to test intersection with it_edge
-              if ( it_edge==all_edges.begin() )
-                fset.erase(fset.begin());
-              else
-              {
-                typename Edge_to_intersected_facets::iterator it_ets=edge_to_sfacet.find(*it_edge);
-                if(it_ets!=edge_to_sfacet.end()) it_ets->second.erase(facet);
-              }
-            }
-          } // end case FACET
-          break;
-
-          // Case when the edge intersect one edge of the facet.
-          case internal_IOP::EDGE:
-          {
-            CGAL_assertion(cgal_do_intersect_debug(edge,facet));
-            int node_id=++current_node;
-            add_new_node(edge,facet,res,nodes);
-            Halfedge_handle edge_intersected=CGAL::cpp11::get<1>(res);
-            visitor->new_node_added(node_id,internal_IOP::EDGE,edge,edge_intersected,CGAL::cpp11::get<2>(res),CGAL::cpp11::get<3>(res));
-            for (;it_edge!=all_edges.end();++it_edge){
-              if ( it_edge!=all_edges.begin() ){
-                typename Edge_to_intersected_facets::iterator it_ets=edge_to_sfacet.find(*it_edge);
-                Facet_set* fset_bis = (it_ets!=edge_to_sfacet.end())?&(it_ets->second):NULL;
-                cip_handle_case_edge(node_id,fset_bis,*it_edge,edge_intersected);
-              }
-              else
-                cip_handle_case_edge(node_id,&fset,*it_edge,edge_intersected);
-            }
-          } // end case EDGE
-          break;
-
-          case internal_IOP::VERTEX:
-          {
-            CGAL_assertion(cgal_do_intersect_debug(edge,facet));
-            int node_id=++current_node;
-            Halfedge_handle vertex_intersected=CGAL::cpp11::get<1>(res);
-            add_new_node(vertex_intersected->vertex()->point()); //we use the original vertex to create the node
-            //before it was internal_IOP::FACET but do not remember why, probably a bug...
-            visitor->new_node_added(node_id,internal_IOP::VERTEX,edge,vertex_intersected,CGAL::cpp11::get<2>(res),CGAL::cpp11::get<3>(res));
-            for (;it_edge!=all_edges.end();++it_edge){
-              if ( it_edge!=all_edges.begin() ){
-                typename Edge_to_intersected_facets::iterator it_ets=edge_to_sfacet.find(*it_edge);
-                Facet_set* fset_bis = (it_ets!=edge_to_sfacet.end())?&(it_ets->second):NULL;                
-                cip_handle_case_vertex(node_id,fset_bis,*it_edge,vertex_intersected);
-              }
-              else
-                cip_handle_case_vertex(node_id,&fset,*it_edge,vertex_intersected);
-            }
-          } // end case VERTEX
-          break;
-
-        } // end switch on the type of the intersection
-      } // end loop on all facets that intersect the edge
-    } // end loop on all entries (edges) in 'edge_to_sfacet'
-    CGAL_assertion(nodes.size()==unsigned(current_node+1));
-  }
-  
-  #ifdef USE_DETECTION_MULTIPLE_DEFINED_EDGES
-  void remove_duplicated_intersecting_edges()
-  {
-    for (typename Coplanar_duplicated_intersection_set::iterator 
-        it=coplanar_duplicated_intersection.begin();
-        it!=coplanar_duplicated_intersection.end();
-        ++it)
-    {
-      typename Facets_to_nodes_map::iterator res=f_to_node.find(*it);
-      //CGAL_assertion(res!=f_to_node.end());
-      //we cannot use a precondition here: in some cases the coplanarity test is not sufficient.
-      //if on surface1 we have to coplanar triangle incident along edge e. Then in surface2, take a triangle
-      //with one edge inside one triangle of surface1 such that one vertex in on e. Then the collinearity test
-      //return true for both faces but only one implies a duplicated edge
-      if(res!=f_to_node.end())
-        f_to_node.erase(res);
-    }
-  }
-  #else // not USE_DETECTION_MULTIPLE_DEFINED_EDGES
-  void remove_duplicated_intersecting_edges()
-  {
-    std::set< std::pair<int,int> > already_seen;
-    std::list<typename Facets_to_nodes_map::iterator> to_erase;
-    for (typename Facets_to_nodes_map::iterator 
-          it=f_to_node.begin();
-          it!=f_to_node.end();
-          ++it
-    )
-    {
-      if (it->second.size()==1) continue;
-      CGAL_precondition(it->second.size()==2);
-      //it->second is a set so int are already sorted
-      bool is_new=already_seen.insert(  std::make_pair(
-                                       *(it->second.begin()),
-                                       *boost::next(it->second.begin()) )
-      ).second;
-      
-      if (!is_new)
-        to_erase.push_back(it);
-    }
-    
-    for ( typename std::list<typename Facets_to_nodes_map::iterator>::iterator
-          it=to_erase.begin();it!=to_erase.end();++it
-    )
-      f_to_node.erase(*it);
-  }
-  #endif // not USE_DETECTION_MULTIPLE_DEFINED_EDGES
-
-
-  struct Graph_node{
-    std::set<int> neighbors;
-    unsigned size;
-    
-    Graph_node():size(0){}
-    
-    void insert(int i){
-      ++size;
-      CGAL_assertion(neighbors.find(i)==neighbors.end());
-      neighbors.insert(i);
-    }
-    
-    void erase(int i){
-      CGAL_assertion(neighbors.find(i)!=neighbors.end());
-      neighbors.erase(i);
-    }
-    void make_terminal() {size=45;}
-    bool is_terminal()const {return size!=2;}
-    bool empty() const {return neighbors.empty();}
-    int top() const {return *neighbors.begin();}
-    void pop() {
-      CGAL_assertion(!neighbors.empty());
-      neighbors.erase(neighbors.begin());
-    }
-  };
-
-
-  template <class Output_iterator>
-  void construct_polylines(Nodes_vector& nodes,Output_iterator out){
-    typedef std::map<int,Graph_node> Graph;
-    Graph graph;
-    
-    //counts the number of time each node has been seen
-    std::size_t nb_nodes=nodes.size();
-    std::vector<int> node_mult(nb_nodes,0);
-    bool isolated_point_seen=false;
-    for (typename Facets_to_nodes_map::iterator it=f_to_node.begin();it!=f_to_node.end();++it){
-      const std::set<int>& segment=it->second;
-      CGAL_assertion(segment.size()==2 || segment.size()==1);
-      if (segment.size()==2){
-        int i=*segment.begin();
-        int j=*boost::next(segment.begin());
-        typename Graph::iterator ins_res=graph.insert(std::make_pair(i,Graph_node())).first;
-        ins_res->second.insert(j);
-        ins_res=graph.insert(std::make_pair(j,Graph_node())).first;
-        ins_res->second.insert(i);
-        ++(node_mult[i]);
-        ++(node_mult[j]);
-      }
-      else{
-        CGAL_assertion(segment.size()==1);
-        isolated_point_seen=true;
-      }
-    }
-    
-    //add isolated points
-    if (isolated_point_seen){
-      for (unsigned index=0;index<nb_nodes;++index)
-        if (node_mult[index]==0){
-          *out++=std::vector<typename Kernel::Point_3>(1,nodes[index]);
-          visitor->start_new_polyline(index,index);
-        }
-    }
-    
-    //visitor call
-    visitor->annotate_graph(graph.begin(),graph.end());
-    
-    bool only_cycle=false;
-    while (!graph.empty()){
-      typename Graph::iterator it=graph.begin();
-      for (;!only_cycle && it!=graph.end();++it){
-        if (it->second.is_terminal()) break;
-      }
-      
-      std::vector<typename Kernel::Point_3> polyline;
-      
-      if(!only_cycle && it!=graph.end()){
-        //this is a polyline
-        int i=it->first;
-        int j=it->second.top();
-        visitor->start_new_polyline(i,j);
-        CGAL_assertion(i!=j);
-        it->second.pop();
-        if (it->second.empty())
-          graph.erase(it);
-        polyline.push_back(nodes[i]);
-        visitor->add_node_to_polyline(i);
-        while(true){
-          it=graph.find(j);
-          CGAL_assertion(it!=graph.end());
-          it->second.erase(i);
-          i=j;
-          polyline.push_back(nodes[i]);
-          visitor->add_node_to_polyline(i);
-          if (it->second.empty()){
-            graph.erase(it);
-            break;
-          }
-          if (it->second.is_terminal()) break;
-          j=it->second.top();
-          it->second.pop();
-          if (it->second.empty())
-            graph.erase(it);
-        }
-        *out++=polyline;
-      }
-      else{
-        //it remains only cycles
-        only_cycle=true;
-        it=graph.begin();
-        int i=it->first;
-        int j=it->second.top();
-        visitor->start_new_polyline(i,j);
-        graph.erase(it);
-        polyline.push_back(nodes[i]);
-        visitor->add_node_to_polyline(i);
-        int first=i;
-        do{
-          it=graph.find(j);
-          it->second.erase(i);
-          i=j;
-          polyline.push_back(nodes[i]);
-          visitor->add_node_to_polyline(i);
-          j=it->second.top();
-          graph.erase(it);
-        }while(j!=first);
-        polyline.push_back(nodes[j]);// we duplicate first point for cycles
-        visitor->add_node_to_polyline(j);
-        *out++=polyline;      
-      }
-    }
-  }
-  
-  int get_other_int(const std::set<int>& s,int i) const {
-    if (*s.begin()!=i) return *s.begin();
-    return *boost::next(s.begin());
-  }
-  
-  template <class T,class Dispatch_out_it>
-  bool is_grabbed(const Dispatch_out_it&) const{
-    return CGAL::Is_in_tuple<T,typename Dispatch_out_it::Value_type_tuple>::value;
-  }
-  
-  
-  template <class OutputIterator>
-  struct Is_dispatch_based_ouput_iterator{
-    typedef  boost::false_type type;
-  };
-
-  template <template<class V_,class O_> class Dispatch_based_output_it,class V,class O>
-  struct Is_dispatch_based_ouput_iterator<Dispatch_based_output_it<V,O> >{
-    typedef typename boost::is_base_of< Dispatch_output_iterator<V,O>,
-                                        Dispatch_based_output_it<V,O>  >::type type;
-  };
-  
-  template <class Output_iterator>
-  inline void construct_polylines_with_info(Nodes_vector& nodes,Output_iterator out){
-    return construct_polylines_with_info(nodes,out,typename Is_dispatch_based_ouput_iterator<Output_iterator>::type());
-  }
-    
-  template <class Output_iterator>
-  void construct_polylines_with_info(Nodes_vector& nodes,Output_iterator out,boost::false_type){
-    construct_polylines_with_info(nodes,
-                                  dispatch_or_drop_output<std::vector<typename Kernel::Point_3> >(out),boost::true_type());
-  }
-  
-  template <template<class V_,class O_> class Dispatch_based_output_it,class V,class O>
-  void construct_polylines_with_info(Nodes_vector& nodes,
-                                     Dispatch_based_output_it<V,O> out,boost::true_type)
-  {
-    typedef typename Facets_to_nodes_map::value_type Edge;
-    typedef std::list<Facet_pair> Polyline_info;
-    
-    
-    std::size_t nb_nodes=nodes.size();
-    std::vector<int> node_mult(nb_nodes,0);
-    std::vector<bool> terminal_bools(nb_nodes,false);
-    std::vector< std::set<Edge*> > connections(nb_nodes);
-    // --counts the number of time each node has been seen
-    // --associate to each node its incident edges. An edge = a pair of Facet_handle+2 indices of intersection points
-    for (typename Facets_to_nodes_map::iterator it=f_to_node.begin();it!=f_to_node.end();++it){
-      const std::set<int>& segment=it->second;
-      CGAL_assertion(segment.size()==2 || segment.size()==1);
-      if (segment.size()==2){
-        int i=*segment.begin();
-        int j=*boost::next(segment.begin());
-        connections[i].insert(&(*it));
-        connections[j].insert(&(*it));
-        ++(node_mult[i]);
-        ++(node_mult[j]);
-      }
-    }
-
-    //detect terminal nodes and isolated nodes
-    for (unsigned k=0;k<nb_nodes;++k){
-      if (node_mult[k]!=2) terminal_bools[k]=true;
-      if (node_mult[k]==0){
-        *out++=std::vector<typename Kernel::Point_3>(1,nodes[k]);
-        if ( is_grabbed<std::vector<Facet_pair> >(out))
-          *out++=std::vector<Facet_pair>();
-      }
-    }
-   
-    //visitor call
-    visitor->update_terminal_nodes(terminal_bools);
-    
-    //We start from a node N and recursively walk one edge to find other
-    // node. If this is a cycle we stop when we are back at the node N;
-    //otherwise we stop at a terminal node and restart a walk from N
-    //following another edge (if N is not terminal) until finding a terminal
-    //node. With this we can associate to each edge the pair of facet_handle
-    //intersecting that define this edge.
-    unsigned current_node=0;
-    while (current_node!=nb_nodes){
-      if (connections[current_node].empty()){
-        ++current_node;
-        continue;
-      }
-      
-      Edge* edge=*connections[current_node].begin();
-      connections[current_node].erase(connections[current_node].begin());
-      
-      Polyline_info polyline_info;
-      std::list<typename Kernel::Point_3> polyline_embedding;
-      
-      if ( is_grabbed<std::vector<Facet_pair> >(out))
-        polyline_info.push_back(edge->first.first);
-      polyline_embedding.push_back(nodes[current_node]);
-      
-      unsigned i=current_node;
-      unsigned start_node=current_node;
-      bool reverse=false;
-      while (true){
-        i=get_other_int(edge->second,i);
-        connections[i].erase(edge);
-        
-        if (reverse) polyline_embedding.push_front(nodes[i]);
-        else         polyline_embedding.push_back(nodes[i]);
-        
-        if (i==start_node) break;
-        if (terminal_bools[i]){
-          if (reverse || terminal_bools[current_node]) break;
-          reverse=true;
-          i=current_node;
-          if ( connections[i].empty() ) break;
-        }
-        
-        edge=*connections[i].begin();
-        connections[i].erase(connections[i].begin());
-        
-        if ( is_grabbed<std::vector<Facet_pair> >(out)){
-          if (reverse) polyline_info.push_front(edge->first.first);
-          else         polyline_info.push_back(edge->first.first);
-        }
-          
-      }
-      
-      *out++=std::vector<typename Kernel::Point_3>(polyline_embedding.begin(),polyline_embedding.end());
-      if ( is_grabbed<std::vector<Facet_pair> >(out)){
-        CGAL_assertion(polyline_embedding.size()==polyline_info.size()+1);
-        *out++=std::vector<Facet_pair>(polyline_info.begin(),polyline_info.end());
-      }
-    }
-  }
-  
-//debug functions
-  
-  bool cgal_do_intersect_debug(Halfedge_handle eh,Facet_handle fh){
-    Triangle t( fh->halfedge()->vertex()->point(),
-                fh->halfedge()->next()->vertex()->point(),
-                fh->halfedge()->next()->next()->vertex()->point());
-
-    Segment s( eh->vertex()->point(),
-               eh->opposite()->vertex()->point());
-
-    return CGAL::do_intersect( s, t);
-  }
-
-  bool cgal_do_intersect_debug(Facet_handle fh1,Facet_handle fh2){
-    Triangle t1( fh1->halfedge()->vertex()->point(),
-                 fh1->halfedge()->next()->vertex()->point(),
-                 fh1->halfedge()->next()->next()->vertex()->point());
-    Triangle t2( fh2->halfedge()->vertex()->point(),
-                 fh2->halfedge()->next()->vertex()->point(),
-                 fh2->halfedge()->next()->next()->vertex()->point());
-
-
-    return CGAL::do_intersect( t1, t2);
-  }
-  
-  void print_f_to_node_debug(){
-    std::cout << "print_f_to_node_debug " << &f_to_node << std::endl;
-    for (typename Facets_to_nodes_map::iterator it=f_to_node.begin();it!=f_to_node.end();++it){
-      std::cout << &(*(it->first.first.first)) << " " << &(*(it->first.first.second)) << " " << it->first.second << " -> {";
-      std::copy(it->second.begin(),it->second.end(),std::ostream_iterator<int>(std::cout,","));
-      std::cout << "}" <<std::endl;
-    }
-  }
-  
-  void print_graph_debug(const std::map<int,Graph_node>& graph){
-    for (typename std::map<int,Graph_node>::const_iterator it=graph.begin();it!=graph.end();++it){
-      std::cout << it->first << " -> {";
-      std::copy(it->second.neighbors.begin(),it->second.neighbors.end(),std::ostream_iterator<int>(std::cout,","));
-      std::cout << "}" <<std::endl;      
-    }
-  }
-  
-  void print_edge_to_sfacet_debug(){
-    std::cout << "Potential intersection "<< edge_to_sfacet.size() << std::endl;
-    for(typename Edge_to_intersected_facets::iterator it=edge_to_sfacet.begin();it!=edge_to_sfacet.end();++it){
-      Facet_set& fset=it->second;
-      std::cout << &fset << " fset size " << fset.size() << std::endl;
-    }
-  }
-  
-  
-  template <class OutputIterator>
-  OutputIterator main_run(OutputIterator out,bool build_polylines=true){
-    // std::cout << edge_to_sfacet.size() << std::endl;
-    int current_node=-1;
-    
-    //print_edge_to_sfacet_debug();
-    #ifndef DO_NOT_HANDLE_COPLANAR_FACETS
-    //first handle coplanar triangles
-    compute_intersection_of_coplanar_facets(current_node);
-    visitor->set_number_of_intersection_points_from_coplanar_facets(current_node+1);
-    #endif // not DO_NOT_HANDLE_COPLANAR_FACETS
-    //print_edge_to_sfacet_debug();
-    //compute intersection points of segments and triangles.
-    //build node of the graph
-    //build connectivity info
-    compute_intersection_points(current_node); // 'current_node' is passed by
-                                               // non-const reference
-    
-    if (!build_polylines){
-      visitor->finalize(nodes);
-      return out;
-    }
-    //remove duplicated intersecting edges:      
-    //  In case two facets are incident along such an edge coplanar in a facet of another polyhedron (and one extremity inside the facet), the intersection
-    //  will be reported twice. We kept track (check_coplanar_edge(s)) of this so that, we can remove one intersecting edge out of the two
-    //print_f_to_node_debug();
-    remove_duplicated_intersecting_edges();
-    
-    //std::cout << "f_to_node "<< f_to_node.size() << std::endl;
-    //print_f_to_node_debug();
-    //collect connectivity infos and create polylines
-    if ( Node_visitor::do_need_vertex_graph )
-      construct_polylines(nodes,out); //using the graph approach (at some point we know all connections between intersection points)
-    else
-      construct_polylines_with_info(nodes,out); //direct construction by propagation
-    
-    visitor->finalize(nodes);    
-    
-    return out;
-  }
-  
-public:
-  Intersection_of_Polyhedra_3():visitor(new Node_visitor()),is_default_visitor(true){}
-  Intersection_of_Polyhedra_3(Node_visitor& v):visitor(&v),is_default_visitor(false){}
-  ~Intersection_of_Polyhedra_3(){if (is_default_visitor) delete visitor;}
-  //pairwise intersection between all elements in the range
-  template <class InputIterator, class OutputIterator>
-  OutputIterator
-  operator()(InputIterator begin, InputIterator end, OutputIterator out) {
-    for(InputIterator it1=begin;it1!=end;++it1){
-      CGAL_precondition( it1->is_pure_triangle() );
-      Polyhedron_ref P=*it1;
-      visitor->new_input_polyhedron(P);
-      for(InputIterator it2=boost::next(it1);it2!=end;++it2){  
-        CGAL_precondition( it2->is_pure_triangle() );
-        Polyhedron_ref Q=*it2;
-        filter_intersections(P, Q);
-        filter_intersections(Q, P);
-      }
-    }
-    
-    return main_run(out);
-  }
-  
-  //pairwise intersection between all elements in the range
-  //(pointers version)
-  template <class InputIterator, class OutputIterator>
-  OutputIterator
-  operator()(InputIterator begin, InputIterator end, OutputIterator out, int) {
-    for(InputIterator it1=begin;it1!=end;++it1){
-      CGAL_precondition( (*it1)->is_pure_triangle() );
-      Polyhedron_ref P=**it1;
-      visitor->new_input_polyhedron(P);
-      for(InputIterator it2=boost::next(it1);it2!=end;++it2){  
-        CGAL_precondition( (*it2)->is_pure_triangle() );
-        Polyhedron_ref Q=**it2;
-        filter_intersections(P, Q);
-        filter_intersections(Q, P);
-      }
-    }
-    
-    return main_run(out);
-  }
-  
-  //intersection between P and each element in the range
-  template <class InputIterator, class OutputIterator>
-  OutputIterator
-  operator()( Polyhedron_ref P, InputIterator begin, InputIterator end, OutputIterator out) {
-    CGAL_precondition( P.is_pure_triangle() );
-    visitor->new_input_polyhedron(P);
-    for(InputIterator it=begin;it!=end;++it){
-      CGAL_precondition( it->is_pure_triangle() );
-      Polyhedron_ref Q=*it;
-      visitor->new_input_polyhedron(Q);
-      filter_intersections(P, Q);
-      filter_intersections(Q, P);
-    }
-    return main_run(out);
-  }
-  
-  //intersection between P and each element in the range
-  //(pointers version)
-  template <class InputIterator, class OutputIterator>
-  OutputIterator
-  operator()(Polyhedron_ref P, InputIterator begin, InputIterator end, OutputIterator out, int) {
-    CGAL_precondition( P.is_pure_triangle() );
-    visitor->new_input_polyhedron(P);
-    for(InputIterator it=begin;it!=end;++it){
-      CGAL_precondition( (*it)->is_pure_triangle() );
-      Polyhedron_ref Q=**it;
-      visitor->new_input_polyhedron(Q);
-      filter_intersections(P, Q);
-      filter_intersections(Q, P);
-    }
-    return main_run(out);
-  }
-  
-  //intersection between P and Q
-  template <class OutputIterator>
-  OutputIterator
-  operator()(Polyhedron_ref P, Polyhedron_ref Q, OutputIterator out) {
-    visitor->new_input_polyhedron(P);
-    visitor->new_input_polyhedron(Q);
-    filter_intersections(P, Q);
-    filter_intersections(Q, P);
-    return main_run(out);
-  }
-
-  //intersection between P and Q, only visitor called not polyline is constructed
-  void operator()(Polyhedron_ref P, Polyhedron_ref Q) {
-    visitor->new_input_polyhedron(P);
-    visitor->new_input_polyhedron(Q);
-    filter_intersections(P, Q);
-    filter_intersections(Q, P);
-    main_run(Emptyset_iterator(),false);
-  }
-};
-
-template <typename Polyhedron, typename OutputIterator>
-OutputIterator
-intersection_Polyhedron_3_Polyhedron_3(const Polyhedron& P, const Polyhedron& Q, OutputIterator out)
-{
-  return Intersection_of_Polyhedra_3<Polyhedron>()(P,Q,out);
-}
-
-}// namespace CGAL
-
-#endif //CGAL_INTERSECTION_OF_POLYHEDRA_3_H
-
-/*
-  // Local variables for Emacs:
-  //   - set special indentation of case labels, compared to usual C/C++
-  //     indentation styles.
-  Local Variables:
-  c-file-offsets:((case-label . +))
-  End:
-*/
diff --git a/3rdparty/CGAL-4.8/include/CGAL/intersection_of_Polyhedra_3_refinement_visitor.h b/3rdparty/CGAL-4.8/include/CGAL/intersection_of_Polyhedra_3_refinement_visitor.h
deleted file mode 100644
index c623c59..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/intersection_of_Polyhedra_3_refinement_visitor.h
+++ /dev/null
@@ -1,2260 +0,0 @@
-// Copyright (c) 2011 GeometryFactory (France).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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.
-//
-// $UR$
-// $Id$
-//
-//
-// Author(s)     : Sebastien Loriot
-
-#ifndef CGAL_INTERSECTION_OF_POLYHEDRA_3_REFINEMENT_VISITOR_H
-#define CGAL_INTERSECTION_OF_POLYHEDRA_3_REFINEMENT_VISITOR_H
-
-#include <CGAL/intersection_of_Polyhedra_3.h>
-#include <CGAL/Polygon_mesh_processing/connected_components.h>
-#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
-#include <CGAL/Constrained_Delaunay_triangulation_2.h>
-#include <CGAL/Triangulation_vertex_base_with_info_2.h>
-#include <CGAL/Default.h>
-
-#include <CGAL/internal/corefinement/Combinatorial_map_for_corefinement.h> 
-
-#include <CGAL/Side_of_triangle_mesh.h>
-#include <CGAL/property_map.h>
-#include <boost/optional.hpp>
-#include <boost/next_prior.hpp>
-
-#include <fstream>
-#include <sstream>
-
-//  TODOCUMENT
-//  --We suppose that the two input polyhedra are triangulated orientable surfaces.
-//  --Any polyhedron defines two bounding volumes: one inside and one outside.
-//    The convention used is the following: the normal of a triangle always indicates
-//    the outside of the object.
-//  --The  input polyhedra should not touch at only one point locally. If so, the current
-//    implementation just ignore it (TAG SL001)
-//  --Polyhedron type should be list-based or should guarantee no reallocation. We use maps
-//    on pointer of halfedges,facets and vertices
-//  --Polyhedral_mesh_domain requires the domain tp be closed: do not provided as input
-//    an open polyhedral surface and a polyhedron with a connected component free from intersection
-//OPTIMIZATIONS
-//  --cdt: try using intervals? in that case, only points inside the face should be considered
-//         and points on edge should be handled by hand (simply start using the point opposite to the edge)
-//  --filtered_order_around_edge: can be done using the original supporting planes
-//  --in intersection_of_Polyhedra_3: upon call to Triangle_segment_intersection_point::add_new_node, interval and exact nodes are
-//    inserted into a vector. Since we do not know the final size of vector this lead to reallocation of data.   
-//  --in Triangle_segment_intersection_point, try using EPEC instead of Interval_nt+SC<Gmpq>
-//  --use a sorted pair of indices in edge_to_hedge+simplify the code TAG_SLXX1
-//  --in sew_2_marked_darts arrange how darts are passed to avoid comparing to a Point_3
-//TODO:
-//  --validity of the embedding: points inserted in polyhedron are approximation of the real
-//    intersection points. It may happen that because of the approximation, the embedding gets
-//    wrong. To avoid this, for each new triangle created, we should make an orientation test
-//    with the approximated point to check if this is correct. If not, points must be moved
-//    within their double interval so that all triangles incident to each of these points are correctly
-//    oriented. This is probably an expensive test that can be activated only with a template parameter
-//    of something similar.
-namespace CGAL
-{
-  
-  namespace internal_IOP
-  {
-    template <class Polyhedron>
-    struct Compare_unik_address{
-      typedef typename Polyhedron::Halfedge_handle        Halfedge_handle;
-      typedef typename Polyhedron::Halfedge_const_handle  Halfedge_const_handle;
-      typedef typename Polyhedron::Halfedge               Halfedge;
-      
-      bool operator()(Halfedge_handle h1,Halfedge_handle h2) const {
-        Halfedge* ph1=&(*h1) < &(*h1->opposite()) ? &(*h1) : &(*h1->opposite());
-        Halfedge* ph2=&(*h2) < &(*h2->opposite()) ? &(*h2) : &(*h2->opposite());
-        return  ph1 < ph2; 
-      }
-
-      bool operator()(Halfedge_const_handle h1,Halfedge_const_handle h2) const {
-        const Halfedge* ph1=&(*h1) < &(*h1->opposite()) ? &(*h1) : &(*h1->opposite());
-        const Halfedge* ph2=&(*h2) < &(*h2->opposite()) ? &(*h2) : &(*h2->opposite());
-        return  ph1 < ph2; 
-      }
-    };
-
-  template <class Polyhedron>
-  struct Compare_address{
-    typedef typename Polyhedron::Halfedge_handle        Halfedge_handle;
-    typedef typename Polyhedron::Halfedge_const_handle  Halfedge_const_handle;
-    typedef typename Polyhedron::Halfedge               Halfedge;
-    
-    bool operator()(Halfedge_handle h1,Halfedge_handle h2) const {
-      return  &(*h1) < &(*h2); 
-    }
-
-    bool operator()(Halfedge_const_handle h1,Halfedge_const_handle h2) const {
-      return  &(*h1) < &(*h2); 
-    }
-  };
-
-  template <class Polyhedron>
-  class Non_intersection_halfedge{
-    typedef std::map< typename Polyhedron::Halfedge_const_handle,
-                      std::pair<int,int>,
-                      Compare_unik_address<Polyhedron> 
-                    >  Intersection_hedges_set;
-    Intersection_hedges_set intersection_hedges_;
-  public:  
-    Non_intersection_halfedge(const Intersection_hedges_set& the_set) : intersection_hedges_(the_set){}
-  
-  
-    bool operator()(typename Polyhedron::Halfedge_const_handle h) const
-    {
-      return intersection_hedges_.find(h)==intersection_hedges_.end();
-    }
-  };
-
-    
-  template <class HDS, class NestedFacetConstruct, class NewNodeVertexVisitor>
-  class Triangulate_a_face : public CGAL::Modifier_base<HDS> {
-    typedef typename HDS::Halfedge_handle Halfedge_handle;
-    typedef typename HDS::Vertex_handle   Vertex_handle;
-    typedef typename HDS::Face_handle     Face_handle;
-    typedef typename HDS::Vertex          Vertex;
-    typedef typename HDS::Halfedge        Halfedge;
-    typedef typename HDS::Face            Face;
-    
-    //data members
-    Face_handle current_face;
-    std::map<int,typename Vertex::Point >                  nodes_;
-    std::map<int,Vertex_handle>&                           node_to_polyhedron_vertex_;
-    std::map<std::pair<int,int>,Halfedge_handle>&          edge_to_hedge_;
-    std::vector<std::pair<int,int> >                       edges_to_create_;
-    std::vector<CGAL::cpp11::tuple<int,int,int> >          faces_to_create_;
-    NestedFacetConstruct facet_construct;
-    NewNodeVertexVisitor& node_vertex_visitor;
-
-    typename HDS::Halfedge::Base*
-    unlock_halfedge(Halfedge_handle h){
-      return static_cast<typename HDS::Halfedge::Base*>(&(*h));
-    }
-    
-    typename HDS::Face::Base*
-    unlock_face(Face_handle f){
-      return static_cast<typename HDS::Face::Base*>(&(*f));
-    }    
-    
-  public:
-    
-    template <class Nodes_vector,class Triangulation>
-    Triangulate_a_face( Face_handle face,
-                        const Nodes_vector& nodes,
-                        const std::vector<int>& node_ids,
-                        std::map<int,Vertex_handle>& node_to_polyhedron_vertex,
-                        std::map<std::pair<int,int>,Halfedge_handle>& edge_to_hedge,
-                        const Triangulation& triangulation,
-                        const NestedFacetConstruct& fc,
-                        NewNodeVertexVisitor& nv)
-    :current_face(face), node_to_polyhedron_vertex_(node_to_polyhedron_vertex), edge_to_hedge_(edge_to_hedge), facet_construct(fc), node_vertex_visitor(nv)
-    {
-      //grab vertices to be inserted to copy them from the vector
-      for (std::vector<int>::const_iterator it=node_ids.begin();it!=node_ids.end();++it)
-      {
-        nodes_.insert(std::make_pair(*it,nodes[*it]));
-      }
-      //grab edges that are not on the convex hull (these have already been created)
-      for (typename Triangulation::Finite_edges_iterator 
-        it=triangulation.finite_edges_begin();
-        it!=triangulation.finite_edges_end();
-        ++it)
-      {
-        typename Triangulation::Vertex_handle v0=it->first->vertex((it->second+1)%3);
-        typename Triangulation::Vertex_handle v1=it->first->vertex((it->second+2)%3);
-        //warning in degenerate cases you can insert outsite expected convex hull edges: need exact here.
-        //an alternative is to test if one the incident faces are infinite (cf assertion below)
-        if ( edge_to_hedge_.find(std::make_pair(v0->info(),v1->info()))==edge_to_hedge_.end() &&
-             edge_to_hedge_.find(std::make_pair(v1->info(),v0->info()))==edge_to_hedge_.end()    )
-        {
-          edges_to_create_.push_back( std::make_pair(v0->info(),v1->info()) );
-        }
-        else
-            CGAL_assertion( triangulation.is_infinite(it->first->vertex(it->second)) || triangulation.is_infinite( triangulation.mirror_vertex(it->first,it->second)) );
-      }
-      //grab triangles.
-      for (typename Triangulation::Finite_faces_iterator 
-        it=triangulation.finite_faces_begin();
-        it!=triangulation.finite_faces_end();
-        ++it)
-      {
-        typename Triangulation::Vertex_handle v0=it->vertex(0);
-        typename Triangulation::Vertex_handle v1=it->vertex(1);
-        typename Triangulation::Vertex_handle v2=it->vertex(2);
-        //warning in degenerate case we can have non wanted triangles: need exact here
-        faces_to_create_.push_back( CGAL::cpp11::make_tuple( v0->info(),v1->info(),v2->info() ) );
-      }
-    }
-
-
-  
-    void operator()( HDS& hds) {
-//      std::cerr << "node_to_polyhedron_vertex_"<< std::endl;
-//      for (typename std::map<int,Vertex_handle>::iterator it=node_to_polyhedron_vertex_.begin();it!=node_to_polyhedron_vertex_.end();++it)
-//        std::cerr << it->first << " " << &(*(it->second)) << std::endl;
-      
-      //insert the intersection point interior to the face inside the polyhedron and
-      //save their Polyhedron::vertex_handle 
-      for (typename std::map<int,typename Vertex::Point>::iterator it=nodes_.begin();it!=nodes_.end();++it)
-      {
-        Vertex_handle v=hds.vertices_push_back(Vertex(it->second));
-        node_vertex_visitor.new_vertex_added(it->first, v);
-        CGAL_assertion( node_to_polyhedron_vertex_.find( it->first ) == node_to_polyhedron_vertex_.end());
-        node_to_polyhedron_vertex_.insert( std::make_pair(it->first,v) );
-//        std::cerr << "vertices " << it->first  << " " << &(*v) << std::endl;
-      }
-      
-      //insert the new halfedge and set their incident vertex
-      for (typename std::vector<std::pair<int,int> >::iterator 
-        it=edges_to_create_.begin();it!=edges_to_create_.end();++it)
-      {
-        Halfedge_handle he=hds.edges_push_back(Halfedge(),Halfedge());
-        
-        //associate edge <i,j> to halfedge going from i to j with j as incident vertex
-        CGAL_assertion(node_to_polyhedron_vertex_.find(it->second)!= node_to_polyhedron_vertex_.end());
-        Vertex_handle v=node_to_polyhedron_vertex_.find(it->second)->second;
-        unlock_halfedge(he)->set_vertex( v );
-        v->set_halfedge(he);
-//        std::cerr << "  --in edge " << &(*v) << std::endl;
-        edge_to_hedge_.insert( std::make_pair(*it,he) ); 
-        v=node_to_polyhedron_vertex_.find(it->first)->second;
-//        std::cerr << "  --in edge " << &(*v) << std::endl;
-        unlock_halfedge( he->opposite() )->set_vertex( v );
-        v->set_halfedge(he->opposite());
-        edge_to_hedge_.insert( std::make_pair(std::make_pair(it->second,it->first),he->opposite()) );
-//        std::cerr << "edges " << it->first <<  " " << it->second << std::endl;
-      }
-      
-      std::vector<CGAL::cpp11::tuple<int,int,int> >::iterator it=faces_to_create_.begin();
-      Face_handle face_triangulated = current_face;
-      //create the new faces and update adjacencies
-      while (true)
-      {
-        int i=cpp11::get<0>(*it),j=cpp11::get<1>(*it),k=cpp11::get<2>(*it);
-//        std::cerr << "faces " << i <<  " " << j  << " " << k<< std::endl;        
-        Halfedge_handle current  = edge_to_hedge_.find(std::make_pair(i,j))->second;
-        Halfedge_handle next     = edge_to_hedge_.find(std::make_pair(j,k))->second;
-        Halfedge_handle previous = edge_to_hedge_.find(std::make_pair(k,i))->second;
- 
-
-        CGAL_assertion (edge_to_hedge_.find(std::make_pair(i,j))!=edge_to_hedge_.end());
-        CGAL_assertion (edge_to_hedge_.find(std::make_pair(j,k))!=edge_to_hedge_.end());
-        CGAL_assertion (edge_to_hedge_.find(std::make_pair(k,i))!=edge_to_hedge_.end());
-        
-        CGAL_assertion(current->vertex()==node_to_polyhedron_vertex_.find(j)->second);
-        CGAL_assertion(next->vertex()==node_to_polyhedron_vertex_.find(k)->second);
-        CGAL_assertion(previous->vertex()==node_to_polyhedron_vertex_.find(i)->second);
-        
-        unlock_halfedge(current)->set_next(next);
-        unlock_halfedge(next)->set_next(previous);
-        unlock_halfedge(previous)->set_next(current);
-        
-        unlock_halfedge(current)->set_prev(previous);
-        unlock_halfedge(next)->set_prev(current);
-        unlock_halfedge(previous)->set_prev(next);
-        
-        //update face halfedge
-        unlock_face(current_face)->set_halfedge(current);
-        
-        //update face of halfedges
-        unlock_halfedge(current)  ->set_face(current_face);
-        unlock_halfedge(next)     ->set_face(current_face);
-        unlock_halfedge(previous) ->set_face(current_face);        
-        
-        if ( ++it!=faces_to_create_.end() )
-          current_face=hds.faces_push_back( facet_construct(*face_triangulated) );
-        else
-          break;
-      }
-    }
-  };    
- 
-  } //namespace internal_IOP
-
-  
-//Considering the plane with normal vector [O_prime,O] and containing O. 
-//We define the counterclockwise order around O when looking from the side of the plane 
-//into which the vector [O_prime,O] is pointing.
-//We consider the portion of the plane defined by rotating a ray starting at O
-//from the planar projection of P1 to the planar projection of P2 in counterclockwise order.
-//The predicates indicates whether the planar projection of point Q lies in this portion of the plane.
-//Preconditions:
-//  O_prime,O,P1 are not collinear
-//  O_prime,O,P2 are not collinear
-//  O_prime,O,Q are not collinear
-//  O_prime,O,P1,Q are not coplanar or coplanar_orientation(O,O_prime,P1,Q)==NEGATIVE
-//  O_prime,O,P2,Q are not coplanar or coplanar_orientation(O,O_prime,P2,Q)==NEGATIVE
-template <class Kernel>
-bool  is_in_interior_of_object(
-    const typename Kernel::Point_3& O_prime,const typename Kernel::Point_3& O,
-    const typename Kernel::Point_3& P1,const typename Kernel::Point_3& P2,
-    const typename Kernel::Point_3& Q)
-{
-  //guarantee to have non-flat triangles
-  CGAL_precondition( !collinear(O_prime,O,P1) );
-  CGAL_precondition( !collinear(O_prime,O,P2) );
-  CGAL_precondition( !collinear(O_prime,O,Q)  );
-
-  //no two triangles are coplanar and on the same side of their common edge
-  CGAL_precondition( !coplanar(O_prime,O,P1,Q) || coplanar_orientation(O,O_prime,P1,Q)==NEGATIVE );
-  CGAL_precondition( !coplanar(O_prime,O,P2,Q) || coplanar_orientation(O,O_prime,P2,Q)==NEGATIVE );
-  
-  Sign s0 = sign( determinant(O-O_prime,P1-O,P2-O) );
-  
-  if ( s0==ZERO ){
-    //O, O_prime, P1 and P2 are coplanar
-    Orientation o=orientation(O_prime,O,P1,Q);
-    CGAL_precondition(o!=COPLANAR);
-    return o==POSITIVE;
-  }
-  
-  //O, O_prime, P1 and P2 are not coplanar
-  Sign s1 = sign( determinant(O-O_prime,P1-O,Q -O) );
-  Sign s2 = sign( determinant(O-O_prime,Q -O,P2-O) );
-
-  if (s0 == POSITIVE) // the angle P1,O,P2 is smaller that Pi.
-    return ( s1 == POSITIVE ) && ( s2 ==POSITIVE ); //true if the angles P1,O,Q and Q,O,P2 are smaller than Pi
-  else
-    return ( s1 != NEGATIVE ) || ( s2 != NEGATIVE ); //true if the angle P1,O,Q or the angle Q,O,P2 is smaller than or equal to Pi
-}
-
-//import into the combinatorial map facets in the given range.
-//they are supposed to be in the same connected component.
-//two volume are created (each facets gives two opposite orientation 2-cell in the map)
-template<class Polyhedron, class Map, class Face_iterator, class Non_special_edge_predicate,class Halfedge_to_dart_map_ >
-typename Map::Dart_handle import_from_polyhedron_subset(  Map& amap,
-                                                          Face_iterator faces_begin,
-                                                          Face_iterator faces_end,
-                                                          const Non_special_edge_predicate& is_non_special_edge,
-                                                          Halfedge_to_dart_map_& selected_hedge_to_dart,
-                                                          int mark_index
-  )
-{
-  typedef typename Polyhedron::Halfedge_const_handle  Halfedge_const_handle;
-  typedef std::map < Halfedge_const_handle, typename Map::Dart_handle,internal_IOP::Compare_address<Polyhedron> > Halfedge_to_dart_map;
-   
-  Halfedge_to_dart_map hedge_to_dart;
-  typename Map::Dart_handle first_dart = NULL;
-  // First traversal to build the darts and link them.
-  for (Face_iterator it_face = faces_begin; it_face != faces_end; ++it_face)
-  {
-    Halfedge_const_handle start=(*it_face)->halfedge();
-    
-    CGAL_precondition(start->next()!=start);
-    
-    Halfedge_const_handle current=start;
-    typename Map::Dart_handle prev = NULL;
-    typename Map::Dart_handle first_dart_of_face = NULL;
-    do
-    {
-      typename Map::Dart_handle d = amap.create_dart();
-      amap.template link_beta<3>(d,amap.create_dart()); //for opposite volume
-      hedge_to_dart[current] = d;
-             
-      if (prev != NULL){
-        amap.template link_beta<1>(prev, d);
-        amap.template link_beta<1>(d->beta(3),prev->beta(3));//for opposite volume
-      }
-      else 
-      {
-        first_dart_of_face = d;
-        if (first_dart==NULL) first_dart=d;
-      }
-      
-      if ( is_non_special_edge (current) ){
-        if ( !current->is_border_edge() ){
-          CGAL_assertion(current != current->opposite());
-          typename Halfedge_to_dart_map::iterator it = hedge_to_dart.find(current->opposite());
-          if (it != hedge_to_dart.end()){ //link the opposites halfedges only when both corresponding darts have been created
-            amap.template link_beta<2>(d, it->second);
-            amap.template link_beta<2>(d->beta(3), it->second->beta(3));//for opposite volume
-          }
-        }
-      }
-      else{
-        typename Halfedge_to_dart_map_::iterator it_hedge_map=selected_hedge_to_dart.find(current);
-         //all marked hedges are not the selected one for its polyline
-        if ( it_hedge_map!=selected_hedge_to_dart.end() ) it_hedge_map->second=d;
-        //darts d and d->beta(3) are special edges
-        amap.mark(d,mark_index);
-        amap.mark(d->beta(3),mark_index);
-      }
-      prev = d;
-      current=current->next();
-    }
-    while (current != start);
-    amap.template link_beta<1>(prev, first_dart_of_face);
-    amap.template link_beta<1>(first_dart_of_face->beta(3),prev->beta(3));//for opposite volume
-  }
-
-  // Second traversal to update the geometry.
-  // We run one again through the facets of the HDS.
-  for (Face_iterator it_face = faces_begin; it_face != faces_end; ++it_face)
-  {
-    Halfedge_const_handle start=(*it_face)->halfedge();
-    Halfedge_const_handle current=start;
-    do
-    {
-      typename Map::Dart_handle d = hedge_to_dart[current]; // Get the dart associated to the Halfedge
-      if (d->template attribute<0>() == NULL)
-      {	    
-        amap.template set_attribute<0>(d,
-           amap.template create_attribute<0>(current->opposite()->vertex()->point()));
-      }
-      current=current->next();
-    }
-    while (current != start);
-  }
-  
-  return first_dart;
-}
-
- //turn around the target vertex of dart to find a marked dart
-template <class Combinatorial_map_3>
-boost::optional<typename Combinatorial_map_3::Dart_handle> 
-next_marked_dart_around_target_vertex(
-  const Combinatorial_map_3& final_map,
-  typename Combinatorial_map_3::Dart_handle dart,
-  int mark_index)
-{
-  CGAL_precondition(final_map.is_marked(dart,mark_index));
-  typename Combinatorial_map_3::Dart_handle next=dart->beta(1);
-  while ( ! final_map.is_marked(next,mark_index) ){
-    if (next->is_free(2) )//we reach a boundary
-      return  boost::optional<typename Combinatorial_map_3::Dart_handle>();
-    next=next->beta(2)->beta(1);
-  }
-  if (next == dart) //no new dart have been found  
-    return  boost::optional<typename Combinatorial_map_3::Dart_handle>();
-  CGAL_precondition(&dart->beta(1)->template attribute<0>()->point() == &next->template attribute<0>()->point());
-  return boost::optional<typename Combinatorial_map_3::Dart_handle> (next);
-}
-
-//turn around the target vertex of dart to find a marked dart
-//with expected_target as target vertex
-template <class Combinatorial_map_3>
-typename Combinatorial_map_3::Dart_handle
-get_next_marked_dart_around_target_vertex(
-  const Combinatorial_map_3& final_map,
-  typename Combinatorial_map_3::Dart_handle dart,
-  int mark_index)
-{
-  CGAL_precondition(final_map.is_marked(dart,mark_index));
-  typename Combinatorial_map_3::Dart_handle next=dart->beta(1);
-  while ( !final_map.is_marked(next,mark_index) ){
-    CGAL_assertion( !next->is_free(2) );
-    next=next->beta(2)->beta(1);
-    CGAL_assertion(next != dart);
-  }
-  CGAL_precondition(&dart->beta(1)->template attribute<0>()->point() == &next->template attribute<0>()->point());
-  return next;
-}
-
-//turn around the source vertex of dart to find a marked dart
-//with expected_source as source vertex
-template <class Combinatorial_map_3>
-typename Combinatorial_map_3::Dart_handle 
-get_next_marked_dart_around_source_vertex(  
-  const Combinatorial_map_3& final_map,
-  typename Combinatorial_map_3::Dart_handle dart,
-  int mark_index)
-{
-  CGAL_precondition(final_map.is_marked(dart,mark_index));
-  typename Combinatorial_map_3::Dart_handle next=dart->beta(0);
-  while ( ! final_map.is_marked(next,mark_index) ){ 
-    CGAL_assertion( !next->is_free(2) );
-    next=next->beta(2)->beta(0);
-    CGAL_assertion(next != dart);
-  }
-  CGAL_precondition(&dart->template attribute<0>()->point() == &next->beta(1)->template attribute<0>()->point());
-  return next;
-}
-
-//given two marked darts, this function links these two darts with beta<2>
-//but in addition it follows the marked darts connected to the same vertex
-//(there should be only one) to connect them all together
-//( this function is a kind of zipper ;) )
-template <class Combinatorial_map_3,class Nodes_vector>
-void sew_2_marked_darts( Combinatorial_map_3& final_map,
-                         typename Combinatorial_map_3::Dart_handle dart_1 , 
-                         typename Combinatorial_map_3::Dart_handle dart_2 ,
-                         int mark_index,
-                         const Nodes_vector& nodes,
-                         const std::pair<int,int>& indices,
-                         const std::pair<bool,int>& polyline_info)
-{
-  CGAL_precondition( dart_1->is_free(2) );
-  CGAL_precondition( dart_2->is_free(2) );
-  CGAL_precondition( final_map.is_marked(dart_1,mark_index) );
-  CGAL_precondition( final_map.is_marked(dart_2,mark_index) );
-  CGAL_precondition( dart_1->template attribute<0>()->point() == dart_2->beta(1)->template attribute<0>()->point() );
-  CGAL_precondition( dart_1->beta(1)->template attribute<0>()->point() == dart_2->template attribute<0>()->point() );
-  
-  int src_index = ( ( indices.first < indices.second) ==  polyline_info.first )
-                  ? indices.second:indices.first;
-  
-  if ( dart_1->template attribute<0>()->point() != nodes[ src_index ] ) std::swap(dart_1,dart_2);
-  
-  int nb_segs=polyline_info.second-1,k=1;
-  
-  do{
-    CGAL_precondition( final_map.template is_sewable<2>(dart_1,dart_2) );
-    final_map.template sew<2>(dart_1,dart_2);
-    
-    if (k==nb_segs) break;
-      
-    dart_1=get_next_marked_dart_around_target_vertex(final_map,dart_1,mark_index);
-    dart_2=get_next_marked_dart_around_source_vertex(final_map,dart_2,mark_index);
-  }
-  while(++k);
-}
-
-//not_top and not_down are two darts from volumes that get merged with an existing
-//other one because of a set of identical coplanar triangles.
-//top and down is the dart of the volumes "replacing" that of not_top and not down respectively, 
-//The function is considering all triangles that are bounded by a cycle of marked edges.
-//The volume not_top and not_down are part of are those that will disappear at the
-//end of the main algorithm.
-//( this function is a kind of facet gluer ;) )
-template <class Combinatorial_map_3>
-void sew_3_marked_darts( Combinatorial_map_3& final_map,
-                         typename Combinatorial_map_3::Dart_handle not_top , 
-                         typename Combinatorial_map_3::Dart_handle not_down ,
-                         typename Combinatorial_map_3::Dart_handle top , 
-                         typename Combinatorial_map_3::Dart_handle down ,
-                         int mark_index,
-                         std::set<typename Combinatorial_map_3::Dart_handle>& darts_to_remove)
-{
-  typedef boost::optional<typename Combinatorial_map_3::Dart_handle> O_Dart_handle;
-
-  if ( not_top->template attribute<3>()->info().is_empty ){
-    CGAL_assertion(not_down->template attribute<3>()->info().is_empty);
-    return;
-  }
-   
-  CGAL_assertion(!not_down->template attribute<3>()->info().is_empty);
-
-  //merge attribute of the two volumes:
-  internal_IOP::Volume_on_merge merge_attributes;
-  merge_attributes(*top->template attribute<3>(),*not_top->template attribute<3>());
-  merge_attributes(*down->template attribute<3>(),*not_down->template attribute<3>());
-  
-  //set volume attributes as empty to avoid double sew_3 of the same topological disk of triangles
-  not_top->template attribute<3>()->info().is_empty=true;
-  not_down->template attribute<3>()->info().is_empty=true;
-  
-  CGAL_precondition( final_map.is_marked(not_top,mark_index) && final_map.is_marked(top,mark_index) );
-  CGAL_precondition( final_map.is_marked(not_down,mark_index) && final_map.is_marked(down,mark_index) );
-  CGAL_precondition( not_top->template attribute<0>()->point() == not_down->beta(1)->template attribute<0>()->point() );
-  CGAL_precondition( not_top->beta(1)->template attribute<0>()->point() == not_down->template attribute<0>()->point() );
-  CGAL_precondition( not_top->template attribute<0>()->point() == top->template attribute<0>()->point() );
-  CGAL_precondition( not_down->template attribute<0>()->point() == down->template attribute<0>()->point() );
-  
-  CGAL_assertion( top->beta(3)==down );
-
-  //set to be removed the darts of the two no longer used volumes
-  typename Combinatorial_map_3::Dart_handle start=not_top;
-  do
-  {
-    CGAL_assertion(!not_top->is_free(3));
-    darts_to_remove.insert(not_top);   darts_to_remove.insert(not_top->beta(1)); darts_to_remove.insert(not_top->beta(1)->beta(1));
-    darts_to_remove.insert(not_top->beta(3));   darts_to_remove.insert(not_top->beta(3)->beta(1)); darts_to_remove.insert(not_top->beta(3)->beta(1)->beta(1));
-    O_Dart_handle current_1=next_marked_dart_around_target_vertex(final_map,not_top,mark_index);
-    CGAL_precondition(bool(current_1));
-    not_top=*current_1;
-  }
-  while(not_top!=start);
-}
-
-template<class Polyhedron>
-struct Dummy_edge_mark_property_map{
-  typedef bool value_type;
-  typedef value_type reference;
-  typedef std::pair<typename Polyhedron::Halfedge_handle,Polyhedron*> key_type;
-  typedef boost::read_write_property_map_tag category;  
-
-  Dummy_edge_mark_property_map(){}
-
-  friend reference get(Dummy_edge_mark_property_map,key_type) {return false;}
-  friend void put(Dummy_edge_mark_property_map,key_type,value_type) {}
-};
-
-template <class Polyhedron>
-struct Default_facet_construct{
-  typename Polyhedron::Facet operator()( const typename Polyhedron::Facet& )
-  { return typename Polyhedron::Facet(); }
-};
-
-template <class Polyhedron>
-struct Default_node_vertex_visitor{
-  void new_node_added(  int /* node_id */,
-                        internal_IOP::Intersection_type /* type */,
-                        typename Polyhedron::Halfedge_handle /* principal_edge */,
-                        typename Polyhedron::Halfedge_handle /* additional_edge */,
-                        bool /* is_vertex_coplanar */,
-                        bool /* is_vertex_opposite_coplanar */ )
-  {}
-
-  void new_vertex_added(int /* node_id */, typename Polyhedron::Vertex_handle /* vh */){}
-};
-
-template< class Polyhedron,
-          class Kernel_=Default,
-          class EdgeMarkPropertyMap_=Default,
-          class NestedFacetConstruct_=Default,
-          class NewNodeVertexVisitor_=Default
-        >
-class Node_visitor_refine_polyhedra{
-//Default typedefs
-  typedef typename Default::Get<Kernel_, typename Polyhedron::Traits::Kernel>::type Kernel;
-  typedef typename Default::Get<EdgeMarkPropertyMap_, Dummy_edge_mark_property_map<Polyhedron> >::type EdgeMarkPropertyMap;
-  typedef typename Default::Get<NestedFacetConstruct_, Default_facet_construct<Polyhedron > >::type NestedFacetConstruct;
-  typedef typename Default::Get<NewNodeVertexVisitor_, Default_node_vertex_visitor<Polyhedron> >::type NewNodeVertexVisitor;
-//typedefs  
-  typedef typename Polyhedron::Halfedge_handle                         Halfedge_handle;
-  typedef typename Polyhedron::Halfedge_const_handle                   Halfedge_const_handle;
-  typedef typename Polyhedron::Face_handle                             Face_handle;
-  typedef typename Polyhedron::Halfedge                                Halfedge;
-  typedef typename Polyhedron::Vertex_handle                           Vertex_handle;
-  typedef internal_IOP::Compare_handles<Polyhedron,CGAL::Tag_false>    Cmp_handle; //This ensures uniqueness of edges when comparing halfedges
-  typedef internal_IOP::Compare_unik_address<Polyhedron>               Cmp_unik_ad; //This ensures uniqueness of edges when comparing halfedges
-  
-  //constrained triangulation used for triangulation interior of faces
-  #ifdef DO_NO_USE_EXACT_CDT 
-  typedef CGAL::Triangulation_vertex_base_with_info_2<int,Kernel>       Vbi;
-  typedef CGAL::Constrained_triangulation_face_base_2<Kernel>           Fb;
-  typedef CGAL::Triangulation_data_structure_2<Vbi,Fb>                  TDS_2;
-  typedef CGAL::Constrained_Delaunay_triangulation_2<Kernel,TDS_2,CGAL::No_intersection_tag> CDT;  //DO WE NEED DELAUNAY????
-  #else
-  /// \todo change this, use it only if not already exact
-  typedef CGAL::Exact_predicates_exact_constructions_kernel             Exact_kernel;
-  typedef CGAL::Triangulation_vertex_base_with_info_2<int,Exact_kernel> Vbi;
-  typedef CGAL::Constrained_triangulation_face_base_2<Exact_kernel>           Fb;
-  typedef CGAL::Triangulation_data_structure_2<Vbi,Fb>                  TDS_2;
-  typedef CGAL::Constrained_Delaunay_triangulation_2<Exact_kernel,TDS_2,CGAL::No_intersection_tag> CDT;  //DO WE NEED DELAUNAY????  
-  #endif
-  
-  typedef std::map<Halfedge_handle,Polyhedron*,Cmp_unik_ad>            Hedge_to_polyhedron_map;
-
-  typedef std::vector<int>                                             Node_ids;
-  typedef std::set<int>                                                Node_id_set; //avoid having duplicated node on edge of coplanar triangles
-  typedef std::map< Face_handle,Node_ids,Cmp_handle >                  In_face_map; 
-  typedef std::map< Halfedge_handle,Node_id_set,Cmp_unik_ad >          In_halfedge_map;
-  //to keep the correspondance between node_id and vertex_handle in each polyhedron
-  typedef std::map<int,Vertex_handle> Node_to_polyhedron_vertex_map;
-  typedef std::map<Polyhedron*, Node_to_polyhedron_vertex_map > Poly_to_map_node;
-  //to maintain an polyhedron halfedge on each polyline + pair<bool,int>
-  //with first = "is the key (pair<int,int>) was reversed?" and second is the number of edges +1 in the polyline
-  typedef std::map< std::pair<int,int>, std::pair< std::map<Polyhedron*,Halfedge_handle>,std::pair<bool,int> > > An_edge_per_polyline_map;  
-  //to handle coplanar halfedge of polyhedra that are full in the intersection
-  typedef std::map< int,Halfedge_handle >                              Node_to_target_of_hedge_map;
-  typedef std::map< Polyhedron*,Node_to_target_of_hedge_map>           Poly_to_vertices_on_intersection_map;
-
-  //Combinatorial map typedefs
-  typedef internal_IOP::Item_with_points_and_volume_info<Kernel,Polyhedron> Items;
-  typedef CGAL::Combinatorial_map<3,Items> Combinatorial_map_3_;
-  typedef typename Combinatorial_map_3_::Dart_handle Dart_handle;
-  
-//data members
-  Hedge_to_polyhedron_map               hedge_to_polyhedron;
-  In_face_map                           in_face;
-  In_halfedge_map                       in_hedge;
-  std::map< int,std::set<int> >         graph_of_constraints;
-  std::map< int,std::set<int> >         coplanar_constraints;
-  An_edge_per_polyline_map              an_edge_per_polyline;
-  typename An_edge_per_polyline_map::iterator last_polyline;
-  Poly_to_vertices_on_intersection_map  poly_to_vertices_on_inter;
-  Poly_to_map_node                      polyhedron_to_map_node_to_polyhedron_vertex;
-  std::set<int>                         non_manifold_nodes; //contain nodes that are original vertices of input polyhedron and that neighborhood is not a topological disk
-  std::map<Vertex_handle,int>           nodes_that_are_original_vertices;//to keep the correspondance between original polyhedron vertices that are also nodes
-  
-  Combinatorial_map_3_*                 final_map_ptr;
-  Combinatorial_map_3_&                 final_map() {return *final_map_ptr;}
-  bool final_map_comes_from_outside;
-  //   new_hedge    hedge
-  //  ----------->   ----------->
-  //               v
-  //  <-----------   <-----------
-  //   new_opposite     opposite 
-  //  
-  Vertex_handle split_edge( Halfedge_handle hedge,
-                            const typename Kernel::Point_3& point,
-                            Polyhedron& P)
-  {
-    internal_IOP::Split_halfedge_at_point<typename Polyhedron::HalfedgeDS> delegated(hedge,point);
-    P.delegate( delegated );
-    CGAL_assertion(P.is_valid());
-    
-    //update marker tags. If the edge was marked, then the resulting edges in the split must be marked
-    if ( get(m_edge_mark_pmap,std::make_pair(hedge,&P)) )
-    {
-      CGAL_assertion( get(m_edge_mark_pmap,std::make_pair(hedge->opposite(),&P)) );
-      put(m_edge_mark_pmap,std::make_pair(hedge->prev(),&P),true);
-      put(m_edge_mark_pmap,std::make_pair(hedge->prev()->opposite(),&P),true);
-      put(m_edge_mark_pmap,std::make_pair(hedge->opposite()->next(),&P),true);
-      put(m_edge_mark_pmap,std::make_pair(hedge->opposite()->next()->opposite(),&P),true);
-    }
-    
-    Vertex_handle v=boost::prior(P.vertices_end());
-    CGAL_assertion(v->point()==point);
-    return v;
-  }
-
-  //sort node ids so that we can split the hedge
-  //consecutively
-  template <class Nodes_vector>
-  void sort_vertices_along_hedge(std::vector<int>& node_ids,Halfedge_handle hedge,const Nodes_vector& nodes)
-  {
-    std::sort(node_ids.begin(),
-              node_ids.end(),
-              internal_IOP::Order_along_a_halfedge<Polyhedron,Nodes_vector,Is_polyhedron_const>(hedge,nodes)
-    );
-  }
-  
-  //insert intersection as constrained edges  in a CDT triangulation
-  template <class CDT>
-  void insert_constrained_edges_coplanar_case(int node_id,
-                                              CDT& triangulation,
-                                              std::map<int,typename CDT::Vertex_handle>& id_to_CDT_vh)
-  {
-    if (node_id < number_coplanar_vertices){
-      //XSL_TAG_CPL_VERT
-      //Insert constrained edges from coplanar facets that have been retriangulated. This ensure that triangulations are compatible
-      std::map< int,std::set<int> >::iterator it_neighbors=coplanar_constraints.find(node_id);
-      if (it_neighbors!=coplanar_constraints.end())
-      {
-        typename CDT::Vertex_handle vh=id_to_CDT_vh.find(node_id)->second;
-        for (std::set<int>::iterator it_n=it_neighbors->second.begin();it_n!=it_neighbors->second.end();++it_n){
-          typename std::map<int,typename CDT::Vertex_handle>::iterator it_vh=id_to_CDT_vh.find(*it_n);
-          // this condition ensures to consider only graph edges that are in the same triangle (not in a neighbor one when involving node on a triangle edge)
-          // here we can't make the difference between a point on the interior or the boundary, so points_on_triangle is not used.
-          if ( it_vh!=id_to_CDT_vh.end() ){
-            triangulation.insert_constraint(vh,id_to_CDT_vh.find(*it_n)->second);
-          }
-        }
-      }
-    }
-  }
-  //insert intersection as constrained edges  in a CDT triangulation
-  template <class CDT,class Constrained_edges_map>
-  void insert_constrained_edges(Node_ids& node_ids, //index of vertices we are interested in
-                                CDT& triangulation,
-                                std::map<int,typename CDT::Vertex_handle>& id_to_CDT_vh,
-                                Constrained_edges_map& constrained_edges, //list of pair of int to indicate edges that are constrained
-                                bool points_on_triangle=false)
-  {
-    for (Node_ids::iterator it_node_id=node_ids.begin();it_node_id!=node_ids.end();++it_node_id){
-      std::map< int,std::set<int> >::iterator it_neighbors=graph_of_constraints.find(*it_node_id);
-      if (it_neighbors!=graph_of_constraints.end())
-      {
-        typename CDT::Vertex_handle vh=id_to_CDT_vh.find(*it_node_id)->second;
-        for (std::set<int>::iterator it_n=it_neighbors->second.begin();it_n!=it_neighbors->second.end();++it_n){
-          typename std::map<int,typename CDT::Vertex_handle>::iterator it_vh=id_to_CDT_vh.find(*it_n);
-          // this condition ensures to consider only graph edges that are in the same triangle (not in a neighbor one when involving node on a triangle edge)
-          if ( !points_on_triangle || it_vh!=id_to_CDT_vh.end() ){ 
-            CGAL_assertion(it_vh!=id_to_CDT_vh.end());
-            triangulation.insert_constraint(vh,id_to_CDT_vh.find(*it_n)->second);
-            constrained_edges.push_back(std::make_pair(*it_node_id,*it_n));
-          }
-        }
-      }
-      #ifdef CGAL_COREFINEMENT_DEBUG
-      else
-      {
-        std::cout << "X0: Found an isolated point" << std::endl;
-      }
-      #endif
-      
-      insert_constrained_edges_coplanar_case(*it_node_id,triangulation,id_to_CDT_vh);
-    }
-  }
-  
-  std::pair<int,int> make_sorted_pair(int i,int j) const {return i<j ? std::make_pair(i,j):std::make_pair(j,i);} 
-  
-  void update_edge_per_polyline(Polyhedron* P,std::pair<int,int> indices,typename Polyhedron::Halfedge_handle hedge)
-  {
-    std::pair<int,int> sorted_pair=make_sorted_pair(indices.first,indices.second);
-    typename An_edge_per_polyline_map::iterator it=an_edge_per_polyline.find(sorted_pair);
-    if (it!=an_edge_per_polyline.end()){
-      it->second.first.insert(std::make_pair( P,sorted_pair.first==indices.first?hedge:hedge->opposite() ));
-    }
-  }
-
-  int node_index_of_incident_vertex(Halfedge_const_handle h,
-                                    const std::map<Halfedge_const_handle,std::pair<int,int>,Cmp_unik_ad >& border_halfedges)
-  {
-    //WARNING this may be expensive
-    typedef std::map<Halfedge_const_handle,std::pair<int,int>,Cmp_unik_ad > Border_halfedges_map;
-
-    Halfedge_const_handle start=h;
-    Halfedge_const_handle curr=start;
-    do{
-      typename Border_halfedges_map::const_iterator it_border=border_halfedges.find( curr );
-      if (it_border!=border_halfedges.end())
-        return it_border->first==curr?it_border->second.second:it_border->second.first;      
-      curr=curr->next()->opposite();
-    }while(curr!=start);
-    
-    return -1;
-  }
-  
-  template <class Nodes_vector>
-  bool filtered_order_around_edge(int O_prime_index,
-                                  int O_index,
-                                  int P1_index,
-                                  int P2_index,
-                                  int Q_index,
-                                  Vertex_handle P1,
-                                  Vertex_handle P2,
-                                  Vertex_handle Q,
-                                  const Nodes_vector& nodes)
-  {
-    try{
-      return is_in_interior_of_object<typename Nodes_vector::Ikernel>(
-        nodes.interval_node(O_prime_index),
-        nodes.interval_node(O_index),
-        P1_index == -1 ? nodes.to_interval(P1->point()): nodes.interval_node(P1_index),
-        P2_index == -1 ? nodes.to_interval(P2->point()): nodes.interval_node(P2_index),
-        Q_index  == -1 ? nodes.to_interval(Q->point()) : nodes.interval_node(Q_index )
-      );
-    }
-    catch(Uncertain_conversion_exception&){
-      return is_in_interior_of_object<typename Nodes_vector::Exact_kernel>(
-        nodes.exact_node(O_prime_index),
-        nodes.exact_node(O_index),
-        P1_index == -1 ? nodes.to_exact(P1->point()): nodes.exact_node(P1_index),
-        P2_index == -1 ? nodes.to_exact(P2->point()): nodes.exact_node(P2_index),
-        Q_index  == -1 ? nodes.to_exact(Q->point()) : nodes.exact_node(Q_index )
-      );
-    }
-  }
-
-//keep track of the fact that a polyhedron original vertex is a node
-void all_incident_faces_got_a_node_as_vertex(Halfedge_handle incident_to_vertex_edge,int node_id)
-{
-  nodes_that_are_original_vertices.insert(std::make_pair(incident_to_vertex_edge->vertex(),node_id));
-}
-
-//if an original polyhedron vertex is also a node, do no use a fake id
-void set_triangle_boundary_indices(
-  Vertex_handle* triangle_boundary,
-  int* triangle_boundary_indices)
-{
-  triangle_boundary_indices[0]=-1;
-  triangle_boundary_indices[1]=-2;
-  triangle_boundary_indices[2]=-3;
-  
-  for (int k=0;k<3;++k){
-    typename std::map<Vertex_handle,int>::iterator it=nodes_that_are_original_vertices.find(triangle_boundary[k]);
-    if (it!=nodes_that_are_original_vertices.end())
-      triangle_boundary_indices[k]=it->second;
-  }
-}
-
-//======================================================================//
-//functions internally used to glue piece of the final combinatorial map//
-//======================================================================//
-
-
-  //-----first polyhedron
-template <class Halfedge_to_dart_map>
-inline Dart_handle get_associated_dart(Halfedge_handle hedge,Halfedge_to_dart_map& selected_hedge_to_dart){
-  typename Halfedge_to_dart_map::iterator it_saved_dart=selected_hedge_to_dart.find(hedge);
-  CGAL_assertion(it_saved_dart!=selected_hedge_to_dart.end());
-  return it_saved_dart->second;
-}
-
-//first_hedge defines four volumes, second_hedge only two
-//first_poly is not needed as inside/outside volume is update during the merge
-//of the sew. Only second_poly is needed
-template <class Nodes_vector,class Border_halfedges_map,class Halfedge_to_dart_map>
-void sew_2_three_volumes_case(  Halfedge_handle first_hedge, Halfedge_handle second_hedge,
-                                const std::pair<int,int>& indices,
-                                const Nodes_vector& nodes,
-                                Border_halfedges_map& border_halfedges,
-                                Halfedge_to_dart_map& selected_hedge_to_dart, 
-                                Polyhedron* /*first_poly*/, Polyhedron* second_poly,
-                                int mark_index,
-                                std::set<Dart_handle>& darts_to_remove,
-                                const std::pair<bool,int>& polyline_info)
-{
-  bool took_opposite=second_hedge->is_border();
-  if (took_opposite) second_hedge=second_hedge->opposite();
-  
-  Vertex_handle P1=first_hedge->opposite()->next()->vertex();
-  Vertex_handle P2=first_hedge->next()->vertex();
-  //    when looking from the side of indices.second, the interior of the first polyhedron is described 
-  //    by turning counterclockwise from P1 to P2
-  
-  Vertex_handle Q = second_hedge->next()->vertex();
-  
-  //check if the third point of each triangular face is an original point (stay -1)
-  //or a intersection point (in that case we need the index of the corresponding node to
-  //have the exact value of the point)      
-  int index_p1=node_index_of_incident_vertex(first_hedge->opposite()->next(),border_halfedges);
-  int index_p2=node_index_of_incident_vertex(first_hedge->next(),border_halfedges);
-  int index_q =node_index_of_incident_vertex(second_hedge->next(),border_halfedges);      
-
-  //Recover the dart that will be the start point of the different sewing
-  //  dof_X_outside = dart of face of , meaning the triangle containing the
-  //  point X and part of the volume outside of the corresponding polyhedron      
-  //-----first polyhedron
-  Dart_handle dof_P1_outside = get_associated_dart(first_hedge->opposite(),selected_hedge_to_dart);
-  Dart_handle dof_P2_outside = get_associated_dart(first_hedge,selected_hedge_to_dart);
-  //-----second polyhedron
-  Dart_handle dof_Q_outside = get_associated_dart(second_hedge,selected_hedge_to_dart);
-  
-  if (index_p1!=-1 && index_p1==index_q){
-    Dart_handle top=dof_P1_outside->beta(3), not_top=took_opposite?dof_Q_outside->beta(3):dof_Q_outside;
-    Dart_handle down=dof_P1_outside, not_down=took_opposite?dof_Q_outside:dof_Q_outside->beta(3);
-
-    if ( top->template attribute<3>()->info().is_empty ) std::swap(not_top,top);
-    if ( down->template attribute<3>()->info().is_empty ) std::swap(not_down,down);
-    CGAL_assertion( !top->template attribute<3>()->info().is_empty );
-    CGAL_assertion( !down->template attribute<3>()->info().is_empty );
-
-    sew_2_marked_darts( final_map(),top             , dof_P2_outside->beta(3)     ,mark_index, nodes, indices, polyline_info); //P1P2 or QP2      
-    sew_2_marked_darts( final_map(),dof_P2_outside  , down                        ,mark_index, nodes, indices, polyline_info); //P2Q or P2P1
-    sew_3_marked_darts( final_map(),not_top,not_down,top,down,mark_index,darts_to_remove);
-    
-    return;
-  }
-
-  if (index_p2!=-1 && index_p2==index_q){
-    Dart_handle top=dof_P2_outside->beta(3), not_top=took_opposite?dof_Q_outside:dof_Q_outside->beta(3);
-    Dart_handle down=dof_P2_outside, not_down=took_opposite?dof_Q_outside->beta(3):dof_Q_outside;
-
-    if ( top->template attribute<3>()->info().is_empty ) std::swap(not_top,top);
-    if ( down->template attribute<3>()->info().is_empty ) std::swap(not_down,down);
-    CGAL_assertion( !top->template attribute<3>()->info().is_empty );
-    CGAL_assertion( !down->template attribute<3>()->info().is_empty );
-
-    sew_2_marked_darts( final_map(),dof_P1_outside->beta(3) , top              ,mark_index, nodes, indices, polyline_info); //P1Q or P1P2      
-    sew_2_marked_darts( final_map(),down                    , dof_P1_outside   ,mark_index, nodes, indices, polyline_info); //QP1 or P2P1
-    sew_3_marked_darts( final_map(),not_top,not_down,top,down,mark_index,darts_to_remove);
-    
-    return;
-  }
-  
-  bool Q_is_between_P1P2 = filtered_order_around_edge(indices.first,indices.second,index_p1,index_p2,index_q,P1,P2,Q,nodes);
-
-
-  if (Q_is_between_P1P2)
-  {
-    // poly_first  - poly_second            = took_opposite?P1Q:QP2
-    // poly_second - poly_first             = {0}
-    // poly_first \cap poly_second          = took_opposite?QP2:P1Q
-    // opposite( poly_first U poly_second ) = P2P1
-    sew_2_marked_darts( final_map(),dof_P1_outside->beta(3)                            , took_opposite?dof_Q_outside:dof_Q_outside->beta(3)  ,mark_index, nodes, indices, polyline_info); //P1Q
-    sew_2_marked_darts( final_map(),took_opposite?dof_Q_outside->beta(3):dof_Q_outside , dof_P2_outside->beta(3)                             ,mark_index, nodes, indices, polyline_info); //QP2
-    sew_2_marked_darts( final_map(),dof_P2_outside                                     , dof_P1_outside                                      ,mark_index, nodes, indices, polyline_info); //P2P1
-    dof_P1_outside->template attribute<3>()->info().outside.insert(second_poly); //update P2P1 outside poly
-  }
-  else
-  {
-    // poly_first  - poly_second            = P1P2
-    // poly_second - poly_first             = took_opposite?QP1:P2Q
-    // poly_first \cap poly_second          = {0}
-    // opposite( poly_first U poly_second ) = took_opposite?P2Q:QP1
-    sew_2_marked_darts( final_map(),dof_P2_outside                                     , took_opposite?dof_Q_outside:dof_Q_outside->beta(3)  ,mark_index, nodes, indices, polyline_info); //P2Q
-    sew_2_marked_darts( final_map(),took_opposite?dof_Q_outside->beta(3):dof_Q_outside , dof_P1_outside                                      ,mark_index, nodes, indices, polyline_info); //QP1
-    sew_2_marked_darts( final_map(),dof_P1_outside->beta(3)                            , dof_P2_outside->beta(3)                             ,mark_index, nodes, indices, polyline_info); //P1P2
-    dof_P1_outside->beta(3)->template attribute<3>()->info().outside.insert(second_poly); //update P1P2 outside poly
-  }
-}
-
-//first_hedge defines two volumes, second_hedge only two
-template <class Halfedge_to_dart_map,class Border_halfedges_map,class Nodes_vector>
-void sew_2_two_volumes_case(  Halfedge_handle first_hedge, Halfedge_handle second_hedge,
-                              Border_halfedges_map& border_halfedges,
-                              Halfedge_to_dart_map& selected_hedge_to_dart,
-                              int mark_index,
-                              std::set<Dart_handle>& darts_to_remove,
-                              const Nodes_vector& nodes,
-                              const std::pair<int,int>& indices,
-                              const std::pair<bool,int>& polyline_info)
-{
-  bool first_took_opposite=first_hedge->is_border();
-  if (first_took_opposite) first_hedge=first_hedge->opposite();
-  bool second_took_opposite=second_hedge->is_border();
-  if (second_took_opposite) second_hedge=second_hedge->opposite();
-  
-    //-----first polyhedron
-  Dart_handle dof_P_outside = get_associated_dart(first_hedge,selected_hedge_to_dart);
-  //-----second polyhedron
-  Dart_handle dof_Q_outside = get_associated_dart(second_hedge,selected_hedge_to_dart);
-  
-  
-  
-  
-  int index_p =node_index_of_incident_vertex(first_hedge->next(),border_halfedges);
-  int index_q =node_index_of_incident_vertex(second_hedge->next(),border_halfedges);
-
-  if (index_p!=-1 && index_q!=-1 && index_p==index_q){
-    Dart_handle top=dof_P_outside, not_top=dof_Q_outside->beta(3);
-    Dart_handle down=dof_P_outside->beta(3), not_down=dof_Q_outside;
-    
-    if (first_took_opposite==second_took_opposite)
-    {
-      top=dof_P_outside->beta(3); not_top=dof_Q_outside->beta(3);
-      down=dof_P_outside; not_down=dof_Q_outside;
-    }
-    
-    if ( top->template attribute<3>()->info().is_empty ) std::swap(not_top,top);
-    if ( down->template attribute<3>()->info().is_empty ) std::swap(not_down,down);
-    CGAL_assertion( !top->template attribute<3>()->info().is_empty );
-    CGAL_assertion( !down->template attribute<3>()->info().is_empty );
-
-    sew_3_marked_darts( final_map(),not_top,not_down,top,down,mark_index,darts_to_remove);
-    
-    return;
-  }
-  
-  
-  
-  //since the edge is shared, the inside of each polyhedron must be on opposite orientation halfedges
-  if (first_took_opposite==second_took_opposite)
-  {
-    //sew out with in
-    sew_2_marked_darts( final_map(),dof_P_outside->beta(3)  , dof_Q_outside  ,mark_index, nodes, indices, polyline_info); //PQ
-    sew_2_marked_darts( final_map(),dof_Q_outside->beta(3)  , dof_P_outside  ,mark_index, nodes, indices, polyline_info); //QP
-  }
-  else
-  {
-    //sew in with in
-  sew_2_marked_darts( final_map(),dof_P_outside         , dof_Q_outside          ,mark_index, nodes, indices, polyline_info); //PQ
-  sew_2_marked_darts( final_map(),dof_Q_outside->beta(3), dof_P_outside->beta(3) ,mark_index, nodes, indices, polyline_info); //QP
-  }
-}
-
-//4 volume case with 2 identical volume
-//Q2 is supposed to be identical to P2
-template <class Nodes_vector,class Halfedge_to_dart_map>
-void sew_2_four_volumes_case_1(  Halfedge_handle first_hedge, Halfedge_handle second_hedge,
-                                 const std::pair<int,int>& indices,
-                                 const Nodes_vector& nodes,
-                                 int index_p1, int index_p2, int index_q1,
-                                 Halfedge_to_dart_map& selected_hedge_to_dart,
-                                 int mark_index,
-                                 std::set<Dart_handle>& darts_to_remove,
-                                 const std::pair<bool,int>& polyline_info,
-                                 bool swap_in_out_Q=false)
-{
-  Vertex_handle P1=first_hedge->opposite()->next()->vertex();
-  Vertex_handle P2=first_hedge->next()->vertex();
-  //    when looking from the side of indices.second, the interior of the first polyhedron is described 
-  //    by turning counterclockwise from P1 to P2
-  Vertex_handle Q1=second_hedge->opposite()->next()->vertex();
-  // Vertex_handle Q2=second_hedge->next()->vertex();  
-  bool Q1_is_between_P1P2 = filtered_order_around_edge(indices.first,indices.second,index_p1,index_p2,index_q1,P1,P2,Q1,nodes);
-  
-  
-  //Recover the dart that will be the start point of the different sewing
-  //  dof_X_outside = dart of face of , meaning the triangle containing the
-  //  point X and part of the volume outside of the corresponding polyhedron      
-  //-----first polyhedron
-  Dart_handle dof_P1_outside = get_associated_dart(first_hedge->opposite(),selected_hedge_to_dart);
-  Dart_handle dof_P2_outside = get_associated_dart(first_hedge,selected_hedge_to_dart);
-  //-----second polyhedron
-  Dart_handle dof_Q1_outside = get_associated_dart(second_hedge->opposite(),selected_hedge_to_dart);
-  Dart_handle dof_Q2_outside = get_associated_dart(second_hedge,selected_hedge_to_dart);  
-  
-  if( swap_in_out_Q ){
-    dof_Q1_outside=dof_Q1_outside->beta(3);
-    dof_Q2_outside=dof_Q2_outside->beta(3);
-  }
-  
-  if (Q1_is_between_P1P2){
-      Dart_handle top=dof_Q2_outside->beta(3), not_top=dof_P2_outside->beta(3);
-      Dart_handle down=dof_Q2_outside, not_down=dof_P2_outside;
-      if ( top->template attribute<3>()->info().is_empty ) std::swap(not_top,top);
-      if ( down->template attribute<3>()->info().is_empty ) std::swap(not_down,down);
-      CGAL_assertion( !top->template attribute<3>()->info().is_empty );
-      CGAL_assertion( !down->template attribute<3>()->info().is_empty );
-    
-      // poly_first  - poly_second            = P1Q1
-      // poly_second - poly_first             = {0}
-      // poly_first \cap poly_second          = Q1P2 or Q1Q2
-      // opposite( poly_first U poly_second ) = Q2P1 or P2P1
-      sew_2_marked_darts( final_map(),dof_P1_outside->beta(3) , dof_Q1_outside          ,mark_index, nodes, indices, polyline_info); //P1Q1      
-      sew_2_marked_darts( final_map(),dof_Q1_outside->beta(3) , top                     ,mark_index, nodes, indices, polyline_info); //Q1P2 or Q1Q2
-      sew_2_marked_darts( final_map(),down                    , dof_P1_outside          ,mark_index, nodes, indices, polyline_info); //Q2P1 or P2P1
-      sew_3_marked_darts( final_map(),not_top,not_down,top,down,mark_index,darts_to_remove);
-
-  }
-  else{
-      Dart_handle top=dof_Q2_outside->beta(3), not_top=dof_P2_outside->beta(3);
-      Dart_handle down=dof_Q2_outside, not_down=dof_P2_outside;
-      if ( top->template attribute<3>()->info().is_empty ) std::swap(not_top,top);
-      if ( down->template attribute<3>()->info().is_empty ) std::swap(not_down,down);
-      CGAL_assertion( !top->template attribute<3>()->info().is_empty );
-      CGAL_assertion( !down->template attribute<3>()->info().is_empty );
-
-      // poly_first  - poly_second            = {0}
-      // poly_second - poly_first             = Q1P1
-      // poly_first \cap poly_second          = P1P2 or P1Q2
-      // opposite( poly_first U poly_second ) = Q2Q1 or P2Q1
-      sew_2_marked_darts( final_map(),dof_Q1_outside->beta(3) , dof_P1_outside          ,mark_index, nodes, indices, polyline_info); //Q1P1
-      sew_2_marked_darts( final_map(),dof_P1_outside->beta(3) , top                     ,mark_index, nodes, indices, polyline_info); //P1P2 or P1Q2
-      sew_2_marked_darts( final_map(),down                    , dof_Q1_outside          ,mark_index, nodes, indices, polyline_info); //Q2Q1 or P2Q1
-      sew_3_marked_darts( final_map(),not_top,not_down,top,down,mark_index,darts_to_remove);
-  }  
-}
-
-template <class Nodes_vector,class Halfedge_to_dart_map>
-bool coplanar_triangles_case_handled(Halfedge_handle first_hedge,Halfedge_handle second_hedge,
-                                     const std::pair<int,int>& indices,
-                                     const Nodes_vector& nodes,
-                                     int index_p1, int index_p2, int index_q1,int index_q2,
-                                     Halfedge_to_dart_map& selected_hedge_to_dart,
-                                     int mark_index,
-                                     std::set<Dart_handle>& darts_to_remove,
-                                     const std::pair<bool,int>& polyline_info)
-{
-  if( index_p1!=-1 ){
-    if (index_p1==index_q1){
-      if(index_p2!=-1){
-        CGAL_assertion(index_p2!=index_q1);
-        if(index_p2==index_q2){
-          //-----first polyhedron
-          Dart_handle dof_P1_outside = get_associated_dart(first_hedge->opposite(),selected_hedge_to_dart);
-          Dart_handle dof_P2_outside = get_associated_dart(first_hedge,selected_hedge_to_dart);
-          //-----second polyhedron
-          Dart_handle dof_Q1_outside = get_associated_dart(second_hedge->opposite(),selected_hedge_to_dart);
-          Dart_handle dof_Q2_outside = get_associated_dart(second_hedge,selected_hedge_to_dart);      
-    
-          Dart_handle top_1=dof_P1_outside->beta(3), not_top_1=dof_Q1_outside->beta(3);
-          Dart_handle top_2=dof_P2_outside->beta(3), not_top_2=dof_Q2_outside->beta(3);
-          Dart_handle down_1=dof_P1_outside, not_down_1=dof_Q1_outside;
-          Dart_handle down_2=dof_P2_outside, not_down_2=dof_Q2_outside;
-          if ( top_1->template attribute<3>()->info().is_empty ) std::swap(top_1,not_top_1);
-          if ( top_2->template attribute<3>()->info().is_empty ) std::swap(top_2,not_top_2);
-          if ( down_1->template attribute<3>()->info().is_empty ) std::swap(down_1,not_down_1);
-          if ( down_2->template attribute<3>()->info().is_empty ) std::swap(down_2,not_down_2);
-          CGAL_assertion( !top_1->template attribute<3>()->info().is_empty );
-          CGAL_assertion( !top_2->template attribute<3>()->info().is_empty );
-          CGAL_assertion( !down_1->template attribute<3>()->info().is_empty );
-          CGAL_assertion( !down_2->template attribute<3>()->info().is_empty );
-          
-          // poly_first  - poly_second            = {0}
-          // poly_second - poly_first             = {0}
-          // poly_first \cap poly_second          = P1P2 or Q1Q2 or P1Q1 or Q1P2
-          // opposite( poly_first U poly_second ) = P2P1 or Q2Q1 or P2Q1 or Q2P1
-          sew_2_marked_darts( final_map(),top_1    , top_2     ,mark_index, nodes, indices, polyline_info); //P1P2 or Q1Q2 or P1Q1 or Q1P2
-          sew_2_marked_darts( final_map(),down_2   , down_1    ,mark_index, nodes, indices, polyline_info); //P2P1 or Q2Q1 or P2Q1 or Q2P1
-          sew_3_marked_darts( final_map(),not_top_1, not_down_1 ,top_1,down_1,mark_index,darts_to_remove);
-          sew_3_marked_darts( final_map(),not_top_2, not_down_2 ,top_2,down_2,mark_index,darts_to_remove);
-          return true;
-        }
-      }
-      sew_2_four_volumes_case_1(first_hedge->opposite(),second_hedge->opposite(),std::make_pair(indices.second,indices.first),nodes,index_p2,index_p1,index_q2,selected_hedge_to_dart,mark_index,darts_to_remove,polyline_info);
-      return true;
-    }
-    if (index_p1==index_q2){
-      if(index_p2!=-1){
-        CGAL_assertion(index_p2!=index_q2);
-        if(index_p2==index_q1){
-          //-----first polyhedron
-          Dart_handle dof_P1_outside = get_associated_dart(first_hedge->opposite(),selected_hedge_to_dart);
-          Dart_handle dof_P2_outside = get_associated_dart(first_hedge,selected_hedge_to_dart);
-          //-----second polyhedron
-          Dart_handle dof_Q1_outside = get_associated_dart(second_hedge->opposite(),selected_hedge_to_dart);
-          Dart_handle dof_Q2_outside = get_associated_dart(second_hedge,selected_hedge_to_dart);  
-          
-          Dart_handle top_1=dof_P1_outside->beta(3), not_top_1=dof_Q2_outside;
-          Dart_handle top_2=dof_P2_outside->beta(3), not_top_2=dof_Q1_outside;
-          Dart_handle down_1=dof_P1_outside, not_down_1=dof_Q2_outside->beta(3);
-          Dart_handle down_2=dof_P2_outside, not_down_2=dof_Q1_outside->beta(3);
-          if ( top_1->template attribute<3>()->info().is_empty ) std::swap(top_1,not_top_1);
-          if ( top_2->template attribute<3>()->info().is_empty ) std::swap(top_2,not_top_2);
-          if ( down_1->template attribute<3>()->info().is_empty ) std::swap(down_1,not_down_1);
-          if ( down_2->template attribute<3>()->info().is_empty ) std::swap(down_2,not_down_2);
-          CGAL_assertion( !top_1->template attribute<3>()->info().is_empty );
-          CGAL_assertion( !top_2->template attribute<3>()->info().is_empty );
-          CGAL_assertion( !down_1->template attribute<3>()->info().is_empty );
-          CGAL_assertion( !down_2->template attribute<3>()->info().is_empty );          
-          
-          // poly_first  - poly_second            = P1P2 or P1Q1 or Q2P2 or Q2Q1
-          // poly_second - poly_first             = Q1Q2 or Q1P1 or P2P1 or P2Q2
-          // poly_first \cap poly_second          = {0}
-          // opposite( poly_first U poly_second ) = all space
-          sew_2_marked_darts( final_map(),top_1    , top_2     ,mark_index, nodes, indices, polyline_info); //P1P2 or Q1Q2 or P1Q1 or Q1P2
-          sew_2_marked_darts( final_map(),down_2   , down_1    ,mark_index, nodes, indices, polyline_info); //P2P1 or Q2Q1 or P2Q1 or Q2P1
-          sew_3_marked_darts( final_map(),not_top_1, not_down_1 ,top_1,down_1,mark_index,darts_to_remove);
-          sew_3_marked_darts( final_map(),not_top_2, not_down_2 ,top_2,down_2,mark_index,darts_to_remove);
-          return true;           
-        }
-      }
-      sew_2_four_volumes_case_1(first_hedge->opposite(),second_hedge,std::make_pair(indices.second,indices.first),nodes,index_p2,index_p1,index_q1,selected_hedge_to_dart,mark_index,darts_to_remove,polyline_info,true);              
-      return true;
-    }
-  }
-  
-  if(index_p2!=-1){
-    if (index_p2==index_q1){
-      sew_2_four_volumes_case_1(first_hedge,second_hedge->opposite(),indices,nodes,index_p1,index_p2,index_q2,selected_hedge_to_dart,mark_index,darts_to_remove,polyline_info,true);
-      return true;
-    }
-    if(index_p2==index_q2){
-      sew_2_four_volumes_case_1(first_hedge,second_hedge,indices,nodes,index_p1,index_p2,index_q1,selected_hedge_to_dart,mark_index,darts_to_remove,polyline_info);
-      return true;
-    }
-  }
-  
-  
-  return false;
-}
-
-//===//
-//end//
-//===//
-  bool do_not_build_cmap; //set to true in the case only the corefinement must be done
-  int number_coplanar_vertices; //number of intersection points between coplanar facets, see fixes XSL_TAG_CPL_VERT
-  EdgeMarkPropertyMap m_edge_mark_pmap;     //property map to mark halfedge of the original polyhedra that are on the intersection
-  NestedFacetConstruct facet_construct;  // functor called to create new triangular faces inside a given face
-  NewNodeVertexVisitor node_vertex_visitor; // functor called when a new node is created and when a new vertex is added
-public:
-  Node_visitor_refine_polyhedra (
-    Combinatorial_map_3_* ptr=NULL,
-    bool do_not_build_cmap_=false,
-    EdgeMarkPropertyMap pmap=EdgeMarkPropertyMap(),
-    const NestedFacetConstruct& fc = NestedFacetConstruct(),
-    const NewNodeVertexVisitor& nv = NewNodeVertexVisitor()
-  ):do_not_build_cmap(do_not_build_cmap_), m_edge_mark_pmap(pmap), facet_construct(fc), node_vertex_visitor(nv)
-  {
-    if (ptr!=NULL){
-      final_map_comes_from_outside=true;
-      final_map_ptr=ptr;
-    }
-    else if (!do_not_build_cmap_) {
-      final_map_comes_from_outside=false;
-      final_map_ptr=new Combinatorial_map_3_();
-    }
-  }
-  
-  ~Node_visitor_refine_polyhedra(){
-    if(!do_not_build_cmap && !final_map_comes_from_outside) {
-      delete final_map_ptr;
-    }
-  }
-
-  
-  typedef internal_IOP::Predicates_on_constructions Node_storage_type;
-  typedef Tag_false Is_polyhedron_const;
-  static const bool do_need_vertex_graph = true;  //because we need to know which edges are constrained
-
-  typedef Combinatorial_map_3_ Combinatorial_map_3;
-  typedef internal_IOP::Volume_info<Polyhedron> Volume_info;
-
-  const Combinatorial_map_3& combinatorial_map() const {return *final_map_ptr;}
-  
-  void set_number_of_intersection_points_from_coplanar_facets(int n){
-    number_coplanar_vertices=n;
-  }
-  
-  void check_node_on_non_manifold_vertex(int node_id,Halfedge_handle hedge){
-    //we turn around the hedge and check no halfedge is a border halfedge
-    Halfedge_handle curr=hedge;
-    do{
-      if ( curr->is_border_edge() ){
-        non_manifold_nodes.insert(node_id);
-        return;
-      }
-      curr=curr->next()->opposite();
-    }
-    while(curr!=hedge);
-  }  
-  
-  void check_node_on_non_manifold_edge(int node_id,Halfedge_handle hedge){
-    if ( hedge->is_border_edge() ) non_manifold_nodes.insert(node_id);
-  }
-  
-  void new_node_added(int node_id,
-                      internal_IOP::Intersection_type type,
-                      Halfedge_handle principal_edge,
-                      Halfedge_handle additional_edge,
-                      bool is_vertex_coplanar,
-                      bool is_vertex_opposite_coplanar)
-  {
-    //forward to the visitor
-    node_vertex_visitor.new_node_added(node_id, type, principal_edge, additional_edge, is_vertex_coplanar, is_vertex_opposite_coplanar);
-    switch(type)
-    {
-      case internal_IOP::FACET: //Facet intersected by an edge
-      {
-        typename In_face_map::iterator it_fmap=in_face.insert(std::make_pair(additional_edge->face(), Node_ids())).first;
-        it_fmap->second.push_back(node_id);
-      }
-      break;
-      case internal_IOP::EDGE: //Edge intersected by an edge
-      {
-        typename In_halfedge_map::iterator it_hedge_map=in_hedge.insert(std::make_pair(additional_edge,Node_id_set())).first;
-        it_hedge_map->second.insert(node_id);
-        check_node_on_non_manifold_edge(node_id,additional_edge);
-      }
-      break;
-      case internal_IOP::VERTEX:
-      {
-        //grab original vertex that is on commom intersection
-        typename Hedge_to_polyhedron_map::iterator it=hedge_to_polyhedron.find(additional_edge->facet()->halfedge());
-        CGAL_assertion(it!=hedge_to_polyhedron.end());
-        poly_to_vertices_on_inter[it->second].insert(std::make_pair(node_id,additional_edge));
-        polyhedron_to_map_node_to_polyhedron_vertex[it->second].insert(std::make_pair(node_id,additional_edge->vertex()));
-        all_incident_faces_got_a_node_as_vertex(additional_edge,node_id);
-        check_node_on_non_manifold_vertex(node_id,additional_edge);
-      }
-      break;
-      default:
-      return;
-    }
-    
-    CGAL_assertion(!is_vertex_coplanar || !is_vertex_opposite_coplanar); //coplanar edge are not forwarded
-    
-    
-    if ( is_vertex_coplanar )
-    {
-      //grab original vertex that is on commom intersection
-      typename Hedge_to_polyhedron_map::iterator it=hedge_to_polyhedron.find(principal_edge->facet()->halfedge());
-      poly_to_vertices_on_inter[it->second].insert(std::make_pair(node_id,principal_edge));
-      polyhedron_to_map_node_to_polyhedron_vertex[it->second].insert(std::make_pair(node_id,principal_edge->vertex()));
-      all_incident_faces_got_a_node_as_vertex(principal_edge,node_id);
-      check_node_on_non_manifold_vertex(node_id,principal_edge);
-    }
-    else{
-      if ( is_vertex_opposite_coplanar ){
-        //grab original vertex that is on commom intersection
-        typename Hedge_to_polyhedron_map::iterator it=hedge_to_polyhedron.find(principal_edge->facet()->halfedge());
-        poly_to_vertices_on_inter[it->second].insert(std::make_pair(node_id,principal_edge->opposite()));
-        polyhedron_to_map_node_to_polyhedron_vertex[it->second].insert(std::make_pair(node_id,principal_edge->opposite()->vertex()));
-        all_incident_faces_got_a_node_as_vertex(principal_edge->opposite(),node_id);
-        check_node_on_non_manifold_vertex(node_id,principal_edge->opposite());
-      }
-      else{
-        //handle intersection on principal edge
-        typename In_halfedge_map::iterator it_hedge_map=in_hedge.insert(std::make_pair(principal_edge,Node_id_set())).first;
-        it_hedge_map->second.insert(node_id);
-        check_node_on_non_manifold_edge(node_id,principal_edge);
-      }
-    }
-  }
-  
-  template<class Iterator>
-  void annotate_graph(Iterator begin,Iterator end)
-  {
-//    std::cout << "Annotation graph..." << std::endl;
-    for (Iterator it=begin;it!=end;++it)
-    {
-      int node_id=it->first;
-      if (non_manifold_nodes.find(node_id)!=non_manifold_nodes.end()) it->second.make_terminal();
-      const std::set<int>& neighbors = it->second.neighbors;
-      graph_of_constraints.insert(std::make_pair(node_id,neighbors));
-    }
-  }
-  
-  void update_terminal_nodes(std::vector<bool>&)
-  {
-    CGAL_assertion(!"Must not call this function");
-  }
-  
-  void add_filtered_intersection(Halfedge_handle eh,Halfedge_handle fh,Polyhedron& Pe,Polyhedron& Pf){
-    //use the representant halfedge of the facet as key
-    //--set polyhedron for the two facets incident to the edge
-    CGAL_assertion(!eh->is_border());
-    hedge_to_polyhedron.insert(std::make_pair(eh->facet()->halfedge(),&Pe));
-    if ( !eh->opposite()->is_border() )
-      hedge_to_polyhedron.insert(std::make_pair(eh->opposite()->facet()->halfedge(),&Pe));
-    //--set polyhedron for the facet intersected by the edge
-    hedge_to_polyhedron.insert(std::make_pair(fh->facet()->halfedge(),&Pf));
-  }
-  
-
-  struct Polyhedron_face_boundary{
-    std::vector<int> node_ids_array[3]; // the node_ids on each halfedges
-    std::map<Halfedge_handle,int,Cmp_unik_ad> hedges_ids;
-    Halfedge_handle halfedges[3]; //the three halfedges of the original face
-    Vertex_handle   vertices[3];  //the three vertices  of the original face
-    //node_ids_array[0] corresponds to the original edge vertices[0],vertices[1] = halfedges[0]
-    //node_ids_array[1] corresponds to the original edge vertices[1],vertices[2] = halfedges[1]
-    //node_ids_array[2] corresponds to the original edge vertices[2],vertices[0] = halfedges[2]
-    Polyhedron_face_boundary(Halfedge_handle first)
-    {
-      CGAL_assertion(first->next()->next()->next()==first); //the face is a triangle
-      hedges_ids.insert(std::make_pair(first,0));
-      hedges_ids.insert(std::make_pair(first->next(),1));
-      hedges_ids.insert(std::make_pair(first->next()->next(),2));
-      halfedges[0]=first;
-      halfedges[1]=first->next();
-      halfedges[2]=first->next()->next();
-      
-      vertices[0]=halfedges[0]->opposite()->vertex();
-      vertices[1]=halfedges[1]->opposite()->vertex();
-      vertices[2]=halfedges[2]->opposite()->vertex();
-    }
-    
-    //used when object was create with hedge but opposite was used to split the original face
-    void update_original_halfedge(Halfedge_handle original,Halfedge_handle new_hedge)
-    {
-      typename std::map<Halfedge_handle,int,Cmp_unik_ad>::iterator it_id=hedges_ids.find(original);
-      CGAL_assertion(it_id!=hedges_ids.end());
-      int index=it_id->second;
-      CGAL_assertion(halfedges[index]==original);
-      hedges_ids.erase(it_id);
-      hedges_ids.insert(std::make_pair(new_hedge,index));
-      halfedges[index]=new_hedge;
-    }
-    
-    template <class Iterator>
-    void copy_node_ids(Halfedge_handle hedge,Iterator begin,Iterator end)
-    {
-      typename std::map<Halfedge_handle,int,Cmp_unik_ad>::iterator it_id=hedges_ids.find(hedge);
-      CGAL_assertion(it_id!=hedges_ids.end());
-      std::copy(begin,end,std::back_inserter(node_ids_array[it_id->second]));
-    }
-  };
-  
-  
-  void start_new_polyline(int i, int j)
-  {
-    if ( i==j ) //case of a single point
-    {
-      //TAG SL001
-      //nothing is done
-      return;
-    }
-    std::pair<typename An_edge_per_polyline_map::iterator,bool> res=
-      an_edge_per_polyline.insert( 
-        std::make_pair( make_sorted_pair(i,j),
-          std::make_pair( std::map<Polyhedron*,Halfedge_handle>(),std::make_pair(false,0))  )
-      );
-    CGAL_assertion(res.second);
-    last_polyline=res.first;
-    if ( i !=last_polyline->first.first ) 
-      last_polyline->second.second.first=true;
-  }
-  
-  void add_node_to_polyline(int){
-    ++(last_polyline->second.second.second);
-  }
-  
-  void new_input_polyhedron(Polyhedron& P)
-  {
-    typedef std::pair<typename Poly_to_map_node::iterator,bool> Res;
-    CGAL_USE_TYPE(Res);
-    CGAL_assertion_code(Res res = )
-      polyhedron_to_map_node_to_polyhedron_vertex.insert(std::make_pair( &P,Node_to_polyhedron_vertex_map() ));
-    CGAL_assertion(res.second == true);
-  }
-  
-  //1) split_halfedges and retriangulate faces with no intersection point interior to the facet
-  //2) retriangulate using a constrained Delaunay triangulation each triangle in each Polyhedron that contains at least
-  //   one intersection point inside the facet
-  //3) mark polyhedron edges that are on the intersection
-  //4) create one output polyhedron per connected component of polyhedron, connected by an edge which is not an intersection edge   
-  //5) import each piece into a common combinatorial map
-  //6) glue all the pieces together
-  template <class Nodes_vector>
-  void finalize(const Nodes_vector& nodes){
-    //mark halfedge that are on the intersection
-    //SL: I needed to use a map because to get the orientation around the edge,
-    //    I need to know in the case the third vertex is a node its index (for exact construction)
-    typedef std::map<Halfedge_const_handle,std::pair<int,int>,Cmp_unik_ad > Border_halfedges_map;
-    Border_halfedges_map border_halfedges;
-    
-    //store for each triangle facet which boundary is intersected by the other surface,
-    //original vertices (and halfedges in the refined mesh pointing on these vertices)
-    typedef std::map<Face_handle,Polyhedron_face_boundary,Cmp_handle> Faces_boundary;
-    Faces_boundary faces_boundary; 
-    
-    //0) For each polyhedron, collect original vertices that belongs to the intersection.
-    //   From the graph of constaints, extract intersection edges that are incident to such vertices. In case
-    //   there exists another original vertex adjacent to the first one found, this halfedge must be
-    //   marked on the boundary (and possibly update an_edge_per_polyline).
-    //   This is done first to avoid halfedges stored to be modified in the steps following.
-    for (typename Poly_to_vertices_on_intersection_map::iterator 
-      it=poly_to_vertices_on_inter.begin();
-      it!=poly_to_vertices_on_inter.end();
-      ++it)
-    {
-      Polyhedron* poly=it->first;
-      std::set<std::pair<int,int> > already_done;
-      Node_to_target_of_hedge_map& nodes_to_hedge=it->second;
-      for(typename Node_to_target_of_hedge_map::iterator 
-        it_node_2_hedge=nodes_to_hedge.begin();
-        it_node_2_hedge!=nodes_to_hedge.end();
-        ++it_node_2_hedge)
-      {
-        int node_id_of_first=it_node_2_hedge->first;
-        std::map< int,std::set<int> >::iterator it_neighbors=graph_of_constraints.find(node_id_of_first);
-        if ( it_neighbors!=graph_of_constraints.end() )
-        {
-          std::set<int>& neighbors=it_neighbors->second;
-          for (std::set<int>::iterator it_id=neighbors.begin();it_id!=neighbors.end();++it_id){
-            if ( already_done.find(std::make_pair(*it_id,node_id_of_first))!=already_done.end() ) continue;//already done for the opposite
-            typename Node_to_target_of_hedge_map::iterator it_node_2_hedge_two=nodes_to_hedge.find(*it_id);
-            if ( it_node_2_hedge_two!=nodes_to_hedge.end() ) //a full edge is on intersection
-            {
-              //get the corresponding halfedge with vertex corresponding to node_id_of_first
-              Halfedge_handle hedge=it_node_2_hedge->second;
-              CGAL_assertion_code(Halfedge_handle start=hedge;)
-              while ( hedge->opposite()->vertex()!=it_node_2_hedge_two->second->vertex() ){
-                hedge=hedge->next()->opposite();
-                CGAL_assertion(hedge!=start);
-              }
-              std::pair<int,int> edge_pair(*it_id,node_id_of_first);
-              border_halfedges.insert( std::make_pair(hedge,edge_pair) );
-              put(m_edge_mark_pmap,std::make_pair(hedge,poly),true);
-              put(m_edge_mark_pmap,std::make_pair(hedge->opposite(),poly),true);
-              update_edge_per_polyline(poly,edge_pair,hedge); 
-              //save the fact that we already handle this edge
-              already_done.insert(std::make_pair(node_id_of_first,*it_id));
-            }
-          }
-        }
-        #ifdef CGAL_COREFINEMENT_DEBUG
-        else
-        {
-          std::cout << "X1: Found an isolated point" << std::endl;
-        }
-        #endif
-      }
-    }
-    
-    //1) First split halfedges cut by the intersection polyline(s)
-    for (typename In_halfedge_map::iterator it=in_hedge.begin();it!=in_hedge.end();++it)
-    {
-      Halfedge_handle hedge=it->first; //the halfedge to be split (and its opposite too)
-      Node_ids node_ids;   //indices of the intersection points to be inserted
-      //we used a set to avoid having duplicated nodes reported on an edge of two coplanar triangles
-      std::copy(it->second.begin(),it->second.end(),std::back_inserter(node_ids));
-      typename Hedge_to_polyhedron_map::iterator  it_poly=hedge_to_polyhedron.find( hedge->facet()->halfedge() );
-      CGAL_assertion(it_poly!=hedge_to_polyhedron.end());
-      Polyhedron* P=it_poly->second;  //the polyhedron in which vertices should be added
-      
-      sort_vertices_along_hedge(node_ids,hedge,nodes);
-
-      //save original face and nodes for face of hedge (1)
-      if ( !hedge->is_border() ){
-        typename Faces_boundary::iterator it_face=faces_boundary.find(hedge->face());
-        if (it_face==faces_boundary.end())
-          it_face=faces_boundary.insert(std::make_pair(hedge->face(),Polyhedron_face_boundary(hedge))).first;
-        it_face->second.copy_node_ids(hedge,node_ids.begin(),node_ids.end());
-      }
-      
-      //save original face and nodes for face of hedge->opposite (2)
-      typename Faces_boundary::iterator opposite_original_info=faces_boundary.end();
-      if ( !hedge->opposite()->is_border() ){
-        opposite_original_info=faces_boundary.find(hedge->opposite()->face());
-        if (opposite_original_info==faces_boundary.end()) 
-          opposite_original_info=faces_boundary.insert(std::make_pair(hedge->opposite()->face(),Polyhedron_face_boundary(hedge->opposite()))).first;
-        opposite_original_info->second.copy_node_ids(hedge->opposite(),node_ids.rbegin(),node_ids.rend());      
-      }      
-      
-      typename Poly_to_map_node::iterator it_map=polyhedron_to_map_node_to_polyhedron_vertex.find(P);
-      CGAL_assertion(it_map!=polyhedron_to_map_node_to_polyhedron_vertex.end());
-      //a map to identify the vertex in the polyhedron corresponding to an intersection point
-      Node_to_polyhedron_vertex_map& node_to_polyhedron_vertex=it_map->second; 
-            
-      CGAL_assertion_code(Vertex_handle original_vertex=hedge->opposite()->vertex();)
-      
-      //We need an edge incident to the source vertex of hedge. This is the first opposite edge created.      
-      bool first=true; Halfedge_handle hedge_incident_to_src;
-      //do split the edges
-      for (std::vector<int>::const_iterator it_id=node_ids.begin();it_id!=node_ids.end();++it_id){
-        Vertex_handle v=split_edge(hedge,nodes[*it_id],*P);
-        node_vertex_visitor.new_vertex_added(*it_id, v);
-        node_to_polyhedron_vertex.insert(std::make_pair(*it_id,v));
-        if (first){
-          first=false;
-          hedge_incident_to_src=hedge->opposite()->next();
-        }
-      }
-      
-      CGAL_assertion(hedge_incident_to_src->vertex()==original_vertex);
-      CGAL_assertion(hedge_incident_to_src->face()==hedge->opposite()->face());
-
-      //save original face and nodes for face of hedge->opposite (2)
-      if ( !hedge->opposite()->is_border() ){
-        CGAL_assertion(opposite_original_info!=faces_boundary.end());
-        opposite_original_info->second.update_original_halfedge(hedge->opposite(),hedge_incident_to_src);
-      }
-      
-      //insert the two incident faces in in_face map so that they will be triangulated.
-      if (!hedge->is_border()) in_face.insert(std::make_pair(hedge->face(),Node_ids()));
-      if (!hedge->opposite()->is_border()) in_face.insert(std::make_pair(hedge->opposite()->face(),Node_ids()));
-    }
-    
-    //2)triangulation of the triangle faces containing intersection point in their interior
-    //  and also those with intersection points only on the boundary.
-    for (typename In_face_map::iterator it=in_face.begin();it!=in_face.end();++it)
-    {
-      Face_handle f = it->first; //the face to be retriangulated
-      Node_ids& node_ids  = it->second; //the index of the intersection point that are interior to the face
-      typename Faces_boundary::iterator it_fb=faces_boundary.find(f);
-
-      
-      typename Hedge_to_polyhedron_map::iterator it_polyhedron = hedge_to_polyhedron.find (f->halfedge()); //we can do this because the halfedge is still the same (at least its address)+no Face::set_halfedge called
-      CGAL_assertion(it_polyhedron != hedge_to_polyhedron.end());
-      Polyhedron* P=it_polyhedron->second;
-      typename Poly_to_map_node::iterator it_map=polyhedron_to_map_node_to_polyhedron_vertex.find(P);
-      CGAL_assertion(it_map!=polyhedron_to_map_node_to_polyhedron_vertex.end());
-      //a map to identify the vertex in the polyhedron corresponding to an intersection point
-      Node_to_polyhedron_vertex_map& node_to_polyhedron_vertex=it_map->second;
-      
-      std::map<int,typename CDT::Vertex_handle> id_to_CDT_vh;
-      
-      //associate an edge of the triangulation to a halfedge in a given polyhedron
-      std::map<std::pair<int,int>,Halfedge_handle> edge_to_hedge;
-      
-      Vertex_handle triangle_boundary[3];
-      int triangle_boundary_indices[3]; //the node_id of the triangle original vertex or a fake id
-      if (it_fb!=faces_boundary.end()){ //the boundary of the triangle face was refined
-        triangle_boundary[0]=it_fb->second.vertices[0];
-        triangle_boundary[1]=it_fb->second.vertices[1];
-        triangle_boundary[2]=it_fb->second.vertices[2];
-        set_triangle_boundary_indices(triangle_boundary,triangle_boundary_indices);
-      }
-      else{
-        triangle_boundary[0]=f->halfedge()->vertex(); //-1
-        triangle_boundary[1]=f->halfedge()->next()->vertex(); //-2
-        triangle_boundary[2]=f->halfedge()->next()->next()->vertex(); //-3
-        CGAL_assertion(f->halfedge()->next()->next()->next()==f->halfedge());//check this is a triangle
-        set_triangle_boundary_indices(triangle_boundary,triangle_boundary_indices);        
-        edge_to_hedge.insert (std::make_pair( std::make_pair( triangle_boundary_indices[2],triangle_boundary_indices[0] ) , f->halfedge() ) );
-        edge_to_hedge.insert (std::make_pair( std::make_pair( triangle_boundary_indices[0],triangle_boundary_indices[1] ) , f->halfedge()->next() ) );
-        edge_to_hedge.insert (std::make_pair( std::make_pair( triangle_boundary_indices[1],triangle_boundary_indices[2] ) , f->halfedge()->next()->next() ) );
-      }
-
-      
-      #ifdef DO_NO_USE_EXACT_CDT
-      typename Kernel::Plane_3 plane(triangle_boundary[0]->point(),triangle_boundary[1]->point(),triangle_boundary[2]->point());
-      #else
-      CGAL::Cartesian_converter<Kernel,Exact_kernel> convert;
-      typename Exact_kernel::Plane_3 plane(convert(triangle_boundary[0]->point()),convert(triangle_boundary[1]->point()),convert(triangle_boundary[2]->point()));
-      #endif
-      CDT triangulation;
-      //insert point inside face
-      for (std::vector<int>::iterator it_node_id=node_ids.begin();it_node_id!=node_ids.end();++it_node_id){
-        #ifdef DO_NO_USE_EXACT_CDT
-        typename CDT::Vertex_handle vh=triangulation.insert(plane.to_2d(nodes[*it_node_id]));
-        #else
-        typename CDT::Vertex_handle vh=triangulation.insert(plane.to_2d(nodes.exact_node(*it_node_id)));
-        #endif
-        vh->info()=*it_node_id;
-        id_to_CDT_vh.insert(std::make_pair(*it_node_id,vh));
-      }
-      
-      
-      typename CDT::Vertex_handle triangle_vertices[3];
-      #ifdef DO_NO_USE_EXACT_CDT
-      triangle_vertices[0]=triangulation.insert(plane.to_2d(triangle_boundary[0]->point()));
-      triangle_vertices[1]=triangulation.insert(plane.to_2d(triangle_boundary[1]->point()));
-      triangle_vertices[2]=triangulation.insert(plane.to_2d(triangle_boundary[2]->point()));
-      #else
-      //we can do this because these are input points.
-      triangle_vertices[0]=triangulation.insert(plane.to_2d(convert(triangle_boundary[0]->point())));
-      triangle_vertices[1]=triangulation.insert(plane.to_2d(convert(triangle_boundary[1]->point())));
-      triangle_vertices[2]=triangulation.insert(plane.to_2d(convert(triangle_boundary[2]->point())));      
-      #endif
-      
-      triangle_vertices[0]->info()=triangle_boundary_indices[0];
-      triangle_vertices[1]->info()=triangle_boundary_indices[1];
-      triangle_vertices[2]->info()=triangle_boundary_indices[2];
-      //insert face_extremities: we use operator[] because indice -1,-2,-3 are used in each loop and are specific to the current face
-      node_to_polyhedron_vertex[-1]=triangle_boundary[0];
-      node_to_polyhedron_vertex[-2]=triangle_boundary[1];
-      node_to_polyhedron_vertex[-3]=triangle_boundary[2];
-      
-      //if one of the triangle original vertex is also a node
-      for (int ik=0;ik<3;++ik){
-        if ( triangle_boundary_indices[ik]>=0 )
-          id_to_CDT_vh.insert(std::make_pair(triangle_boundary_indices[ik],triangle_vertices[ik]));
-      }
-      //insert points on edges 
-      #ifdef DO_NO_USE_EXACT_CDT
-      //and constrains these edges
-      #endif
-      if (it_fb!=faces_boundary.end()) //is there at least one intersection point on the boundary of the face?
-      {
-        //in the following loop, for each original edge of the triangle, we insert the constrained edges
-        // and we recover the halfedge_handle corresponding to these constrained (they are already in the polyhedron)
-        for (int i=0;i<3;++i){
-//          std::cerr << "Boundary edges" << std::endl;
-//          std::cerr <<  "  " << -1-i <<std::endl;
-          //handle case of halfedge starting at triangle_vertices[i] and ending at triangle_vertices[(i+1)%3]
-          Node_ids& bounding_ids=it_fb->second.node_ids_array[i];
-          typename CDT::Vertex_handle previous=triangle_vertices[i];
-          int previous_index=triangle_boundary_indices[i]; //index of original Polyhedron vertex
-          Halfedge_handle hedge = it_fb->second.halfedges[ (i+2) % 3]->next();
-          CGAL_assertion( hedge->opposite()->vertex()==it_fb->second.vertices[i] );
-          if (!bounding_ids.empty()){ //is there al least one intersection point on this edge?
-            for (Node_ids::iterator it_id=bounding_ids.begin();it_id!=bounding_ids.end();++it_id){
-//              std::cerr << "  "<<  *it_id << std::endl;
-              #ifdef DO_NO_USE_EXACT_CDT
-              typename CDT::Vertex_handle vh=triangulation.insert(plane.to_2d(nodes[*it_id]));
-              #else
-              typename CDT::Vertex_handle vh=triangulation.insert(plane.to_2d(nodes.exact_node(*it_id))); 
-              #endif
-              vh->info()=*it_id;
-              id_to_CDT_vh.insert(std::make_pair(*it_id,vh));
-              #ifdef DO_NO_USE_EXACT_CDT
-              triangulation.insert_constraint(previous,vh);
-              #endif
-              edge_to_hedge.insert (std::make_pair( std::make_pair(previous_index,*it_id),hedge) );
-              previous=vh;
-              hedge=hedge->next();
-              previous_index=*it_id;
-            }
-          }
-          else{
-            CGAL_assertion( it_fb->second.halfedges[i]->vertex() == it_fb->second.vertices[ (i+1) % 3 ] );
-            CGAL_assertion( it_fb->second.halfedges[i]->opposite()->vertex() == it_fb->second.vertices[ i ] );
-          }
-          CGAL_assertion(hedge==it_fb->second.halfedges[i]);
-          edge_to_hedge.insert (std::make_pair( std::make_pair(previous_index,triangle_boundary_indices[(i+1) % 3]) , it_fb->second.halfedges[i] ) );
-//          std::cerr <<  "  " << -1 - ( (i+1) % 3 ) <<std::endl;
-          #ifdef DO_NO_USE_EXACT_CDT
-          triangulation.insert_constraint(previous,triangle_vertices[(i+1)%3]);
-          #endif
-        }
-      }
-      
-      std::list<std::pair<int,int> > constrained_edges;
-      
-      //insert constraints that are interior to the triangle (in the case no edges are collinear in the meshes)
-      insert_constrained_edges(node_ids,triangulation,id_to_CDT_vh,constrained_edges);
-      
-      //insert constraints between points that are on the boundary (not a contrained on the triangle boundary)
-      if (it_fb!=faces_boundary.end()) //is there at least one intersection point on the boundary of the face?
-      {
-        for (int i=0;i<3;++i){
-          Node_ids& bounding_ids=it_fb->second.node_ids_array[i];  
-          insert_constrained_edges(bounding_ids,triangulation,id_to_CDT_vh,constrained_edges,true);
-        }
-      }
-      
-      //insert coplanar edges for endpoints of triangles
-      for (int i=0;i<3;++i){
-        int nindex=triangle_vertices[i]->info();
-        if ( nindex >=0 )
-          insert_constrained_edges_coplanar_case(nindex,triangulation,id_to_CDT_vh);
-      }
-      
-      //XSL_TAG_CPL_VERT
-      //collect edges incident to a point that is the intersection of two coplanar faces.
-      //This ensure that triangulations are compatible.
-      if (it_fb!=faces_boundary.end()) //is there at least one intersection point on the boundary of the face?
-      {
-        for (typename CDT::Finite_vertices_iterator vit=triangulation.finite_vertices_begin(),
-                                                vit_end=triangulation.finite_vertices_end();vit_end!=vit;++vit)
-        {
-          //skip original vertices (that are not nodes) and non-coplanar facet issued vertices 
-          //(this is working because intersection points between coplanar facets are the first inserted)
-          if ( vit->info() < 0 || vit->info() >= number_coplanar_vertices) continue;
-          std::map< int,std::set<int> >::iterator res=coplanar_constraints.insert(std::make_pair(vit->info(),std::set<int>())).first;
-          //turn around the vertex and get incident edge
-          typename CDT::Edge_circulator  start=triangulation.incident_edges(vit);
-          typename CDT::Edge_circulator  curr=start;
-          do{
-            if (triangulation.is_infinite(*curr) ) continue;
-            typename CDT::Edge mirror_edge=triangulation.mirror_edge(*curr);
-            if ( triangulation.is_infinite( curr->first->vertex(curr->second) ) ||
-                 triangulation.is_infinite( mirror_edge.first->vertex(mirror_edge.second) ) )            
-              continue; //skip edges that are on the boundary of the triangle (these are already constrained)
-            //insert edges in the set of constraints
-            int nindex = 
-              curr->first->vertex( (curr->second+1)%3 )==static_cast<typename CDT::Vertex_handle>(vit)?
-              (curr->second+2)%3:(curr->second+1)%3;
-            typename CDT::Vertex_handle vn=curr->first->vertex(nindex);
-            if ( vit->info() > vn->info() ) continue; //take only one out of the two edges + skip negative vn->info()
-            CGAL_assertion(vn->info()>=0);            
-            res->second.insert( vn->info() );
-          }while(start!=++curr);
-        }
-        
-// this is a working alternative that should be slower        
-//        for (typename CDT::Finite_edges_iterator eit=triangulation.finite_edges_begin(),
-//                                             eit_end=triangulation.finite_edges_end();eit_end!=eit;++eit)
-//        {
-//          typename CDT::Edge mirror_edge=triangulation.mirror_edge(*eit);
-//          if ( triangulation.is_infinite( eit->first->vertex(eit->second) ) ||
-//              triangulation.is_infinite( mirror_edge.first->vertex(mirror_edge.second) ) )
-//            continue; //skip edges that are on the boundary of the triangle (these are already constrained)
-//          typename CDT::Vertex_handle v1=eit->first->vertex( (eit->second+1)%3 ),
-//                                      v2=eit->first->vertex( (eit->second+2)%3 );
-//          if (v1->info()<0 || v2->info()<0) continue;
-//          if ( v1->info() > v2->info() ) std::swap(v1,v2);
-//          coplanar_constraints.insert(std::make_pair(v1->info(),std::set<int>())).first->second.insert(v2->info());
-//        }
-      }
-      
-      
-      //create a modifier to insert nodes and copy the triangulation of the face
-      //inside the polyhedron
-      internal_IOP::Triangulate_a_face<typename Polyhedron::HalfedgeDS, NestedFacetConstruct, NewNodeVertexVisitor> modifier(
-        f, nodes, node_ids, node_to_polyhedron_vertex, edge_to_hedge, triangulation, facet_construct, node_vertex_visitor);
-      
-      CGAL_assertion(P->is_valid());
-      P->delegate(modifier);
-      CGAL_assertion(P->is_valid());
-      
-      //3) mark halfedges that are common to two polyhedral surfaces
-      //recover halfedges inserted that are on the intersection
-      for (std::list<std::pair<int,int> >::iterator it_cst=constrained_edges.begin();it_cst!=constrained_edges.end();++it_cst)
-      {
-        typename std::map<std::pair<int,int>,Halfedge_handle>::iterator it_poly_hedge=edge_to_hedge.find(*it_cst);
-        //we cannot have an assertion here in the case an edge or part of an edge is a constraints.
-        //Indeed, the graph_of_constraints report an edge 0,1 and 1,0 for example while only one of the two
-        //is defined as one of them defines an adjacent face
-        //CGAL_assertion(it_poly_hedge!=edge_to_hedge.end());
-        if( it_poly_hedge!=edge_to_hedge.end() ){
-          border_halfedges.insert( std::make_pair(Halfedge_const_handle(it_poly_hedge->second),*it_cst) );
-          put(m_edge_mark_pmap,std::make_pair(it_poly_hedge->second,P),true);
-          put(m_edge_mark_pmap,std::make_pair(it_poly_hedge->second->opposite(),P),true); //setting the opposite is only needed for border edges (done in adjacent triangle otherwise)
-          update_edge_per_polyline(P,it_poly_hedge->first,it_poly_hedge->second);
-        }
-        else{
-          //WARNING: in few case this is needed if the marked edge is on the border
-          //to optimize it might be better to only use sorted pair. TAG_SLXX1
-          std::pair<int,int> opposite_pair(it_cst->second,it_cst->first);
-          it_poly_hedge=edge_to_hedge.find(opposite_pair);
-          CGAL_assertion( it_poly_hedge!=edge_to_hedge.end() );
-
-          border_halfedges.insert( std::make_pair(Halfedge_const_handle(it_poly_hedge->second),opposite_pair) );
-          put(m_edge_mark_pmap,std::make_pair(it_poly_hedge->second,P),true);
-          put(m_edge_mark_pmap,std::make_pair(it_poly_hedge->second->opposite(),P),true); //setting the opposite is only needed for border edges (done in adjacent triangle otherwise)
-          update_edge_per_polyline(P,it_poly_hedge->first,it_poly_hedge->second);          
-        }
-      }
-    }
-   
-    if (do_not_build_cmap) return;
-    
-    //4) create one output polyhedron per connected component of polyhedron,
-    //   connected by an edge which is not an intersection edge  
-    //5) import into a Combinatorial map
-    #ifdef CGAL_COREFINEMENT_DEBUG
-    std::cout << "Nb marked edges " << border_halfedges.size() << std::endl;
-//    for (typename Border_halfedges_map::iterator it=border_halfedges.begin();it!=border_halfedges.end();++it)
-//      std::cout << it->first->opposite()->vertex()->point() << " " << it->first->vertex()->point() << " is constrained " << std::endl;
-    std::cout << "Nb polylines " << an_edge_per_polyline.size() << std::endl;
-    #endif
-    
-    internal_IOP::Non_intersection_halfedge<Polyhedron> criterium(border_halfedges);
-
-    int mark_index = static_cast<int>(final_map().get_new_mark());
-                     //mark used to tag dart that are on an intersection
-
-    //define a map that will contain the correspondance between selected halfedges of the boundary and
-    //their corresponding Dart_handle in the cmap.
-    typedef std::map<Halfedge_const_handle,typename Combinatorial_map_3::Dart_handle,internal_IOP::Compare_address<Polyhedron> > Halfedge_to_dart_map;
-    Halfedge_to_dart_map selected_hedge_to_dart;
-    for (typename An_edge_per_polyline_map::iterator it=an_edge_per_polyline.begin();it!=an_edge_per_polyline.end();++it)
-    {
-      CGAL_assertion(it->second.first.size()==2);
-      //orientation of faces around the edge (to be sure we can do it)
-      Halfedge_handle first_hedge=it->second.first.begin()->second;
-      Halfedge_handle second_hedge=boost::next(it->second.first.begin())->second;
-      
-      if (!first_hedge->is_border())               selected_hedge_to_dart.insert(std::make_pair(first_hedge,Dart_handle(NULL)));
-      if (!first_hedge->opposite()->is_border())   selected_hedge_to_dart.insert(std::make_pair(first_hedge->opposite(),Dart_handle(NULL)));
-      if (!second_hedge->is_border())              selected_hedge_to_dart.insert(std::make_pair(second_hedge,Dart_handle(NULL)));
-      if (!second_hedge->opposite()->is_border())  selected_hedge_to_dart.insert(std::make_pair(second_hedge->opposite(),Dart_handle(NULL)));
-    }
-    
-    #ifdef CGAL_COREFINEMENT_DEBUG
-    int polynb=0;
-    #endif
-    for (typename Poly_to_map_node::iterator 
-          it=polyhedron_to_map_node_to_polyhedron_vertex.begin();
-          it!=polyhedron_to_map_node_to_polyhedron_vertex.end();
-          ++it
-        )
-    {
-      typedef typename Polyhedron::Facet_const_handle Facet_const_handle;
-      typedef ::CGAL::Union_find<Facet_const_handle> UF;
-      typedef typename UF::handle UF_handle;
-      typedef std::map<Facet_const_handle,std::list<Facet_const_handle>,internal::corefinement::Compare_handle_ptr<Polyhedron> > Result;
-      typedef std::map<Facet_const_handle,UF_handle,internal::corefinement::Compare_handle_ptr<Polyhedron> > Facet_to_handle_map;
-      
-      UF uf;
-      Facet_to_handle_map map_f2h;
-      Result result;
-      Polyhedron* current_poly=it->first;
-      
-      #ifdef CGAL_COREFINEMENT_DEBUG
-      std::cout << "writing poly debug"<< std::endl;
-      std::stringstream ss; 
-      ss << "output_debug-" << ++polynb << ".off";
-      std::ofstream output_debug(ss.str().c_str());
-      output_debug << *current_poly;
-      #endif
-      
-      internal::corefinement::extract_connected_components(*(static_cast<Polyhedron const *> (current_poly) ),criterium,uf,map_f2h,result);
-
-      
-      //add each connected component in the map with 2 volumes per component.
-      for (typename Result::iterator it_res=result.begin();it_res!=result.end();++it_res)
-      {
-        //create in the final Cmap a 2D component containing faces of a connected component 
-        //(twice: one with same orientation and one with the opposite orientation to model the other volume)
-        Dart_handle d = import_from_polyhedron_subset<Polyhedron>(final_map(),it_res->second.begin(),it_res->second.end(),criterium,selected_hedge_to_dart,mark_index);
-        //set an attribute to one volume represented by this component to indicates 
-        //a part outside of the polyhedron current_poly
-        typename Combinatorial_map_3_::template Attribute_range<3>::type::iterator attrib=final_map().template create_attribute<3>();
-        attrib->info().outside.insert(current_poly);
-        final_map().template set_attribute<3>(d,attrib);
-        //set the attribute for the opposite volume: represent a part inside current_poly
-        attrib=final_map().template create_attribute<3>();
-        attrib->info().inside.insert(current_poly);
-        final_map().template set_attribute<3>(d->beta(3),attrib);        
-        
-        #ifdef CGAL_COREFINEMENT_DEBUG
-        final_map().display_characteristics(std::cout);
-        std::cout << std::endl;
-        #endif
-      }
-    }
-    #ifndef NDEBUG
-    for(typename Halfedge_to_dart_map::iterator it=selected_hedge_to_dart.begin();it!=selected_hedge_to_dart.end();++it)
-      CGAL_assertion(it->second!=Dart_handle(NULL));
-    #endif
-    
-    CGAL_assertion(final_map().is_valid());
-
-    std::set<Dart_handle> darts_to_remove;
-    
-    //6) Glue pieces together
-    //   using one edge per intersection polyline, we merge the different volumes
-    for (typename An_edge_per_polyline_map::iterator it=an_edge_per_polyline.begin();it!=an_edge_per_polyline.end();++it)
-    {
-      CGAL_assertion(it->second.first.size()==2);
-      //orientation of faces around the edge (to be sure we can do it)
-      std::pair<int,int> indices = it->first;
-      const std::pair<bool,int>& polyline_info=it->second.second;
-
-      //get the two halfedges incident to the edge [indices.first,indices.second]
-      Halfedge_handle first_hedge=it->second.first.begin()->second;
-      Halfedge_handle second_hedge=boost::next(it->second.first.begin())->second;
-
-      CGAL_assertion(nodes[indices.second]==first_hedge->vertex()->point());
-      CGAL_assertion(nodes[indices.first]==first_hedge->opposite()->vertex()->point());
-      CGAL_assertion(nodes[indices.second]==second_hedge->vertex()->point());
-      CGAL_assertion(nodes[indices.first]==second_hedge->opposite()->vertex()->point());
-      
-      Polyhedron* first_poly  = it->second.first.begin()->first;
-      Polyhedron* second_poly = boost::next(it->second.first.begin())->first;
-      
-      //different handling depending on the number of incident triangles to the edge.
-      //After sewing there are two,three or four volumes if there are two,three or four incident triangles respectively
-      if ( first_hedge->is_border() || first_hedge->opposite()->is_border() ){
-        if (second_hedge->is_border()  || second_hedge->opposite()->is_border())
-          sew_2_two_volumes_case(first_hedge,second_hedge,border_halfedges,selected_hedge_to_dart,mark_index,darts_to_remove,nodes,indices,polyline_info);
-        else
-          sew_2_three_volumes_case(second_hedge, first_hedge,indices,nodes,border_halfedges,selected_hedge_to_dart,second_poly,first_poly,mark_index,darts_to_remove,polyline_info);
-      }
-      else
-        if (second_hedge->is_border()  || second_hedge->opposite()->is_border())
-          sew_2_three_volumes_case(first_hedge, second_hedge,indices,nodes,border_halfedges,selected_hedge_to_dart,first_poly,second_poly,mark_index,darts_to_remove,polyline_info);
-        else
-        {
-          //Sort the four triangle facets around their common edge
-          //  we suppose that the exterior of the polyhedron is indicated by
-          //  counterclockwise oriented facets.
-          Vertex_handle P1=first_hedge->opposite()->next()->vertex();
-          Vertex_handle P2=first_hedge->next()->vertex();
-          //    when looking from the side of indices.second, the interior of the first polyhedron is described 
-          //    by turning counterclockwise from P1 to P2
-          Vertex_handle Q1=second_hedge->opposite()->next()->vertex();
-          Vertex_handle Q2=second_hedge->next()->vertex();
-          //    when looking from the side of indices.second, the interior of the second polyhedron is described 
-          //    by turning from Q1 to Q2
-          
-          //check if the third point of each triangular face is an original point (stay -1)
-          //or a intersection point (in that case we need the index of the corresponding node to
-          //have the exact value of the point)      
-          int index_p1=node_index_of_incident_vertex(first_hedge->opposite()->next(),border_halfedges);
-          int index_p2=node_index_of_incident_vertex(first_hedge->next(),border_halfedges);
-          int index_q1=node_index_of_incident_vertex(second_hedge->opposite()->next(),border_halfedges);
-          int index_q2=node_index_of_incident_vertex(second_hedge->next(),border_halfedges);      
-          
-          #ifdef CGAL_COREFINEMENT_DEBUG
-          std::cout << index_p1 << " " << index_p2 << " " << index_q1 << " " <<index_q2 << std::endl;
-          std::cout << nodes[indices.first] << " | " << nodes[indices.second] << std::endl;
-          std::cout << P1->point() << " | " << P2->point() << " | " << Q1->point() << " | " <<Q2->point() << std::endl;
-          #endif
-          
-          if ( coplanar_triangles_case_handled(first_hedge,second_hedge,indices,nodes,index_p1,index_p2,index_q1,index_q2,selected_hedge_to_dart,mark_index,darts_to_remove,polyline_info) )
-            continue;
-          
-          CGAL_assertion(P1->point() !=Q1->point() && P1->point()!=Q2->point() && P2->point() !=Q1->point() && P2->point()!=Q2->point());
-          
-          bool Q1_is_between_P1P2 = filtered_order_around_edge(indices.first,indices.second,index_p1,index_p2,index_q1,P1,P2,Q1,nodes);
-          bool Q2_is_between_P1P2 = filtered_order_around_edge(indices.first,indices.second,index_p1,index_p2,index_q2,P1,P2,Q2,nodes);
-          
-          
-          //Recover the dart that will be the start point of the different sewing
-          //  dof_X_outside = dart of face of , meaning the triangle containing the
-          //  point X and part of the volume outside of the corresponding polyhedron      
-          //-----first polyhedron
-          Dart_handle dof_P1_outside = get_associated_dart(first_hedge->opposite(),selected_hedge_to_dart);
-          Dart_handle dof_P2_outside = get_associated_dart(first_hedge,selected_hedge_to_dart);
-          //-----second polyhedron
-          Dart_handle dof_Q1_outside = get_associated_dart(second_hedge->opposite(),selected_hedge_to_dart);
-          Dart_handle dof_Q2_outside = get_associated_dart(second_hedge,selected_hedge_to_dart);   
-          
-          if ( Q1_is_between_P1P2 ){
-            if( Q2_is_between_P1P2 )
-            {
-              bool P1_is_between_Q1Q2 = filtered_order_around_edge(indices.first,indices.second,index_q1,index_q2,index_p1,Q1,Q2,P1,nodes);
-              if (!P1_is_between_Q1Q2){
-                // poly_first  - poly_second            = P1Q1 U Q2P2
-                // poly_second - poly_first             = {0}
-                // poly_first \cap poly_second          = Q1Q2
-                // opposite( poly_first U poly_second ) = P2P1
-                sew_2_marked_darts( final_map(),dof_P1_outside->beta(3) , dof_Q1_outside          ,mark_index, nodes, indices, polyline_info); //P1Q1
-                sew_2_marked_darts( final_map(),dof_Q2_outside          , dof_P2_outside->beta(3) ,mark_index, nodes, indices, polyline_info); //Q2P2
-                sew_2_marked_darts( final_map(),dof_Q1_outside->beta(3) , dof_Q2_outside->beta(3) ,mark_index, nodes, indices, polyline_info); //Q1Q2
-                sew_2_marked_darts( final_map(),dof_P2_outside          , dof_P1_outside          ,mark_index, nodes, indices, polyline_info); //P2P1
-                //update inside outside info (because darts from the same volume have been merged)
-                dof_Q1_outside->beta(3)->template attribute<3>()->info().inside.insert(first_poly); //update Q1Q2 inside poly
-                dof_P2_outside->template attribute<3>()->info().outside.insert(second_poly);//update P2P1 outside poly
-              }
-              else{
-                // poly_first  - poly_second            = Q2Q1
-                // poly_second - poly_first             = P2P1
-                // poly_first \cap poly_second          = P1Q2 U Q1P2
-                // opposite( poly_first U poly_second ) = {O}
-                sew_2_marked_darts( final_map(),dof_Q2_outside          , dof_Q1_outside          ,mark_index, nodes, indices, polyline_info); //Q2Q1
-                sew_2_marked_darts( final_map(),dof_P2_outside          , dof_P1_outside          ,mark_index, nodes, indices, polyline_info); //P2P1
-                sew_2_marked_darts( final_map(),dof_Q1_outside->beta(3) , dof_P2_outside->beta(3) ,mark_index, nodes, indices, polyline_info); //Q1P2
-                sew_2_marked_darts( final_map(),dof_P1_outside->beta(3) , dof_Q2_outside->beta(3) ,mark_index, nodes, indices, polyline_info); //P1Q2
-                //update inside outside info (because darts from the same volume have been merged)
-                dof_Q2_outside->template attribute<3>()->info().inside.insert(first_poly); //update Q2Q1 inside poly
-                dof_P2_outside->template attribute<3>()->info().inside.insert(second_poly);//update P2P1 inside poly            
-              }
-            }
-            else
-            {
-              // poly_first  - poly_second            = P1Q1
-              // poly_second - poly_first             = P2Q2
-              // poly_first \cap poly_second          = Q1P2
-              // opposite( poly_first U poly_second ) = Q2P1
-              sew_2_marked_darts( final_map(),dof_P1_outside->beta(3) , dof_Q1_outside          ,mark_index, nodes, indices, polyline_info); //P1Q1
-              sew_2_marked_darts( final_map(),dof_P2_outside          , dof_Q2_outside->beta(3) ,mark_index, nodes, indices, polyline_info); //P2Q2
-              sew_2_marked_darts( final_map(),dof_Q1_outside->beta(3) , dof_P2_outside->beta(3) ,mark_index, nodes, indices, polyline_info); //Q1P2
-              sew_2_marked_darts( final_map(),dof_Q2_outside          , dof_P1_outside          ,mark_index, nodes, indices, polyline_info); //Q2P1
-            }        
-          }
-          else
-          {
-            if( Q2_is_between_P1P2 )
-            {
-              // poly_first  - poly_second            = Q2P2
-              // poly_second - poly_first             = Q1P1
-              // poly_first \cap poly_second          = P1Q2
-              // opposite( poly_first U poly_second ) = P2Q1
-              sew_2_marked_darts( final_map(),dof_Q2_outside          , dof_P2_outside->beta(3) ,mark_index, nodes, indices, polyline_info); //Q2P2
-              sew_2_marked_darts( final_map(),dof_Q1_outside->beta(3) , dof_P1_outside          ,mark_index, nodes, indices, polyline_info); //Q1P1
-              sew_2_marked_darts( final_map(),dof_P1_outside->beta(3) , dof_Q2_outside->beta(3) ,mark_index, nodes, indices, polyline_info); //P1Q2
-              sew_2_marked_darts( final_map(),dof_P2_outside          , dof_Q1_outside          ,mark_index, nodes, indices, polyline_info); //P2Q1
-            }
-            else
-            {
-              bool P1_is_between_Q1Q2 = filtered_order_around_edge(indices.first,indices.second,index_q1,index_q2,index_p1,Q1,Q2,P1,nodes);
-              if (!P1_is_between_Q1Q2){
-                // poly_first  - poly_second            = P1P2
-                // poly_second - poly_first             = Q1Q2
-                // poly_first \cap poly_second          = {0}
-                // opposite( poly_first U poly_second ) = P2Q1 U Q2P1
-                sew_2_marked_darts( final_map(),dof_P1_outside->beta(3) , dof_P2_outside->beta(3) ,mark_index, nodes, indices, polyline_info); //P1P2
-                sew_2_marked_darts( final_map(),dof_Q1_outside->beta(3) , dof_Q2_outside->beta(3) ,mark_index, nodes, indices, polyline_info); //Q1Q2
-                sew_2_marked_darts( final_map(),dof_P2_outside          , dof_Q1_outside          ,mark_index, nodes, indices, polyline_info); //P2Q1
-                sew_2_marked_darts( final_map(),dof_Q2_outside          , dof_P1_outside          ,mark_index, nodes, indices, polyline_info); //Q2P1
-                //update inside outside info (because darts from the same volume have been merged)
-                dof_Q1_outside->beta(3)->template attribute<3>()->info().outside.insert(first_poly); //update Q1Q2 outside poly
-                dof_P1_outside->beta(3)->template attribute<3>()->info().outside.insert(second_poly);//update P2P1 outside poly            
-              }
-              else{
-                // poly_first  - poly_second            = {0}
-                // poly_second - poly_first             = Q1P1 U P2Q2
-                // poly_first \cap poly_second          = P1P2
-                // opposite( poly_first U poly_second ) = Q2Q1
-                sew_2_marked_darts( final_map(),dof_Q1_outside->beta(3) , dof_P1_outside          ,mark_index, nodes, indices, polyline_info); //Q1P1
-                sew_2_marked_darts( final_map(),dof_P2_outside          , dof_Q2_outside->beta(3) ,mark_index, nodes, indices, polyline_info); //P2Q2
-                sew_2_marked_darts( final_map(),dof_P1_outside->beta(3) , dof_P2_outside->beta(3) ,mark_index, nodes, indices, polyline_info); //P1P2
-                sew_2_marked_darts( final_map(),dof_Q2_outside          , dof_Q1_outside          ,mark_index, nodes, indices, polyline_info); //Q2Q1
-                //update inside outside info (because darts from the same volume have been merged)
-                dof_P1_outside->beta(3)->template attribute<3>()->info().inside.insert(second_poly); //update P1P2 inside poly
-                dof_Q2_outside->template attribute<3>()->info().outside.insert(first_poly);//update Q2Q1 outside poly            
-              }
-            }
-          }
-        }      
-    }
-    
-    #ifdef CGAL_COREFINEMENT_DEBUG
-    std::cout << "number of darts to remove: " << darts_to_remove.size() <<std::endl;
-    #endif
-    //remove darts from empty volumes
-    for (typename std::set<Dart_handle>::iterator itdart=darts_to_remove.begin(),end=darts_to_remove.end();itdart!=end;++itdart){
-      final_map().erase_dart(*itdart);
-    }
-    
-    //remove empty volumes
-    typedef typename Combinatorial_map_3_::template Attribute_range<3>::type Volume_attribute_range;
-    Volume_attribute_range& ratrib=final_map().template attributes<3>();     
-    typename Volume_attribute_range::iterator curr=ratrib.begin(),end=ratrib.end();
-    do{
-      if (curr->info().is_empty)
-        final_map().template erase_attribute<3>(curr++);
-      else
-        ++curr;
-    }
-    while(curr!=end);
-    
-    CGAL_assertion(final_map().is_valid());
-    
-    //update the info of each volume knowing about only one polyhedron:
-    //this happens when one polyhedron has a connected component
-    //that do not intersect the other polyhedron
-
-    typedef Side_of_triangle_mesh<Polyhedron, Kernel> Inside_poly_test;
-
-    CGAL_precondition(polyhedron_to_map_node_to_polyhedron_vertex.size()==2);
-    Polyhedron* Poly_A = polyhedron_to_map_node_to_polyhedron_vertex.begin()->first;
-    Polyhedron* Poly_B = boost::next(polyhedron_to_map_node_to_polyhedron_vertex.begin())->first;
-    Inside_poly_test* inside_A_test_ptr=NULL;
-    Inside_poly_test* inside_B_test_ptr=NULL;
-    bool Poly_A_is_closed = Poly_A->is_closed();
-    bool Poly_B_is_closed = Poly_B->is_closed();
-
-    #ifdef CGAL_COREFINEMENT_DEBUG
-    final_map().display_characteristics(std::cout); std::cout << "\n";
-    #endif
-
-    typename Combinatorial_map_3::template  One_dart_per_cell_range<3> cell_range=final_map().template one_dart_per_cell<3>();
-    for (typename Combinatorial_map_3::template  One_dart_per_cell_range<3>::iterator
-      it = cell_range.begin(), it_end=cell_range.end();
-      it_end!= it;
-      ++it )
-    {
-      internal_IOP::Volume_info<Polyhedron>& info=it->template attribute<3>()->info();
-      std::size_t inside_size=info.inside.size();
-      std::size_t outside_size=info.outside.size();
-
-      // if a volume is not classified wrt the two polyhedra, it means the component we look at does not
-      // is a disjoint (but maybe at a vertex TAG SL001)
-      if ( inside_size + outside_size == 1)
-      {
-        bool is_inside = (inside_size==1);
-        Polyhedron* current_poly= is_inside? (*info.inside.begin()):(*info.outside.begin());
-        Polyhedron* test_poly;
-        Inside_poly_test* inside_test_ptr;
-        if ( current_poly==Poly_A)
-        {
-          // is the polyhedron is not closed, we set Poly_A to be outside by default
-          if (!Poly_B_is_closed){
-            info.outside.insert(Poly_B);
-            continue;
-          }
-          test_poly=Poly_B;
-          if (inside_B_test_ptr == NULL) inside_B_test_ptr=new Inside_poly_test(*Poly_B);
-          inside_test_ptr=inside_B_test_ptr;
-        }
-        else
-        {
-          // is the polyhedron is not closed, we set Poly_B to be outside by default
-          if (!Poly_A_is_closed){
-            info.outside.insert(Poly_A);
-            continue;
-          }
-          test_poly=Poly_A;
-          if (inside_A_test_ptr == NULL) inside_A_test_ptr=new Inside_poly_test(*Poly_A);
-          inside_test_ptr=inside_A_test_ptr;
-        }
-
-        // We need to find a point of the volume that is not on the boundary of the other volume.
-        // Then the position of this point give the position of the volume. If all the points are on
-        // the bounday, we take the mid-point of an edge (which must not be on the boundary otherwise
-        // it contradicts the fact that volumes are disjoint
-        // We first use the dart we have since one_dart_per_incident_cell has a non-negligeable cost.
-        typename Kernel::Point_3 query=it->template attribute<0>()->point();
-        CGAL::Bounded_side res = (*inside_test_ptr)(query);
-        if (res==ON_BOUNDARY)
-        {
-          typedef typename Combinatorial_map_3::
-            template One_dart_per_incident_cell_range<0,3> Vertex_range;
-
-          Vertex_range vertex_range =
-            final_map().template one_dart_per_incident_cell<0,3>(it);
-          typename Vertex_range::iterator vit = vertex_range.begin();
-
-          CGAL_assertion( typename Combinatorial_map_3::Dart_handle(vit) ==
-                          typename Combinatorial_map_3::Dart_handle(it) );
-          ++vit;
-          for ( ; vit!=vertex_range.end(); ++vit)
-          {
-            query=vit->template attribute<0>()->point();
-            res = (*inside_test_ptr)(query);
-            if ( res != ON_BOUNDARY ) break;
-          }
-
-          //take edge midpoint
-          if (res == ON_BOUNDARY)
-          {
-            /// \todo see do a better test here. At least the construction cannot fail
-            ///  but the mid-point can fall outside of the volume...
-            #ifdef CGAL_COREFINEMENT_DEBUG
-            #warning this is not exact!!!
-            #endif
-            typename Kernel::Point_3 p1=it->template attribute<0>()->point();
-            typename Kernel::Point_3 p2=it->beta(1)->template attribute<0>()->point();
-            query=midpoint(p1,p2);
-            res = (*inside_test_ptr)(query);
-          }
-
-          CGAL_assertion( res!= ON_BOUNDARY );
-        }
-
-        if (res  == ON_BOUNDED_SIDE )
-          info.inside.insert(test_poly);
-        else
-          info.outside.insert(test_poly);
-      }
-
-      #ifdef CGAL_COREFINEMENT_DEBUG
-      std::cout << "This volume has inside: ";
-      for (typename std::set<Polyhedron*>::iterator itpoly=info.inside.begin();itpoly!=info.inside.end();++itpoly)
-        std::cout << " " << *itpoly;
-      std::cout << " and outside: ";
-      for (typename std::set<Polyhedron*>::iterator itpoly=info.outside.begin();itpoly!=info.outside.end();++itpoly)
-        std::cout << " " << *itpoly;
-      std::cout << std::endl;
-      #endif
-    }
-    if (inside_A_test_ptr!=NULL) delete inside_A_test_ptr;
-    if (inside_B_test_ptr!=NULL) delete inside_B_test_ptr;
-  }
-};
-
-}//namespace CGAL
-  
-
-
-#endif //CGAL_INTERSECTION_OF_POLYHEDRA_3_REFINEMENT_VISITOR_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/ipower.h b/3rdparty/CGAL-4.8/include/CGAL/ipower.h
deleted file mode 100644
index 6b10781..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/ipower.h
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright (c) 2008 Max-Planck-Institute Saarbruecken (Germany).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Michael Hemmer 
-//
-// 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$
-
-#ifndef CGAL_IPOWER_H
-#define CGAL_IPOWER_H
-
-#include <CGAL/assertions.h>
-
-namespace CGAL {
-
-template <typename NT>
-inline
-NT ipower(const NT& base, int expn) {
-    // compute base^expn using square-and-multiply
-    CGAL_precondition(expn >= 0);
-    
-    // handle trivial cases efficiently
-    if (expn == 0) return NT(1);
-    if (expn == 1) return base;
-    
-    // find the most significant non-zero bit of expn
-    int e = expn, msb = 0;
-    while (e >>= 1) msb++;
-    
-    // computing base^expn by square-and-multiply
-    NT res = base;
-    int b = 1<<msb;
-    while (b >>= 1) { // is there another bit right of what we saw so far?
-        res *= res;
-        if (expn & b) res *= base;
-    }
-    return res;
-}
-
-template <typename NT>
-inline
-NT ipower(const NT& base, long expn) {
-    // compute base^expn using square-and-multiply
-    CGAL_precondition(expn >= 0);
-    
-    // handle trivial cases efficiently
-    if (expn == 0) return NT(1);
-    if (expn == 1) return base;
-    
-    // find the most significant non-zero bit of expn
-    int e = expn, msb = 0;
-    while (e >>= 1) msb++;
-    
-    // computing base^expn by square-and-multiply
-    NT res = base;
-    int b = 1<<msb;
-    while (b >>= 1) { // is there another bit right of what we saw so far?
-        res *= res;
-        if (expn & b) res *= base;
-    }
-    return res;
-}
-
-} //namespace CGAL
-
-#endif // CGAL_IPOWER_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/jet_estimate_normals.h b/3rdparty/CGAL-4.8/include/CGAL/jet_estimate_normals.h
deleted file mode 100644
index ca714a3..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/jet_estimate_normals.h
+++ /dev/null
@@ -1,362 +0,0 @@
-// Copyright (c) 2007-09  INRIA Sophia-Antipolis (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
-// 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(s) : Pierre Alliez and Laurent Saboret and Marc Pouget and Frederic Cazals
-
-#ifndef CGAL_JET_ESTIMATE_NORMALS_H
-#define CGAL_JET_ESTIMATE_NORMALS_H
-
-#include <CGAL/trace.h>
-#include <CGAL/Search_traits_3.h>
-#include <CGAL/Orthogonal_k_neighbor_search.h>
-#include <CGAL/Monge_via_jet_fitting.h>
-#include <CGAL/property_map.h>
-#include <CGAL/point_set_processing_assertions.h>
-#include <CGAL/Memory_sizer.h>
-
-#include <iterator>
-#include <list>
-
-#ifdef CGAL_LINKED_WITH_TBB
-#include <tbb/parallel_for.h>
-#include <tbb/blocked_range.h>
-#include <tbb/scalable_allocator.h>  
-#endif // CGAL_LINKED_WITH_TBB
-
-namespace CGAL {
-
-
-// ----------------------------------------------------------------------------
-// Private section
-// ----------------------------------------------------------------------------
-/// \cond SKIP_IN_MANUAL
-namespace internal {
-
-
-/// Estimates normal direction using jet fitting
-/// on the k nearest neighbors.
-///
-/// \pre `k >= 2`
-///
-/// @tparam Kernel Geometric traits class.
-/// @tparam Tree KD-tree.
-///
-/// @return Computed normal. Orientation is random.
-template < typename Kernel,
-           typename SvdTraits,
-           typename Tree
->
-typename Kernel::Vector_3
-jet_estimate_normal(const typename Kernel::Point_3& query, ///< point to compute the normal at
-                    Tree& tree, ///< KD-tree
-                    unsigned int k, ///< number of neighbors
-                    unsigned int degree_fitting)
-{
-  // basic geometric types
-  typedef typename Kernel::Point_3  Point;
-
-  // types for K nearest neighbors search
-  typedef typename CGAL::Search_traits_3<Kernel> Tree_traits;
-  typedef typename CGAL::Orthogonal_k_neighbor_search<Tree_traits> Neighbor_search;
-  typedef typename Neighbor_search::iterator Search_iterator;
-
-  // types for jet fitting
-  typedef Monge_via_jet_fitting< Kernel,
-                                 Simple_cartesian<double>,
-                                 SvdTraits> Monge_jet_fitting;
-  typedef typename Monge_jet_fitting::Monge_form Monge_form;
-
-  // Gather set of (k+1) neighboring points.
-  // Perform k+1 queries (as in point set, the query point is
-  // output first). Search may be aborted if k is greater
-  // than number of input points.
-  std::vector<Point> points; points.reserve(k+1);
-  Neighbor_search search(tree,query,k+1);
-  Search_iterator search_iterator = search.begin();
-  unsigned int i;
-  for(i=0;i<(k+1);i++)
-  {
-    if(search_iterator == search.end())
-      break; // premature ending
-    points.push_back(search_iterator->first);
-    search_iterator++;
-  }
-  CGAL_point_set_processing_precondition(points.size() >= 1);
-
-  // performs jet fitting
-  Monge_jet_fitting monge_fit;
-  const unsigned int degree_monge = 1; // we seek for normal and not more.
-  Monge_form monge_form = monge_fit(points.begin(), points.end(),
-                                    degree_fitting, degree_monge);
-
-  // output normal vector (already normalized in monge form)
-  return monge_form.normal_direction();
-}
-
-#ifdef CGAL_LINKED_WITH_TBB
-  template <typename Kernel, typename SvdTraits, typename Tree>
-  class Jet_estimate_normals {
-    typedef typename Kernel::Point_3 Point;
-    typedef typename Kernel::Vector_3 Vector;
-    const Tree& tree;
-    const unsigned int k;
-    const unsigned int degree_fitting;
-    const std::vector<Point>& input;
-    std::vector<Vector>& output;
-
-  public:
-    Jet_estimate_normals(Tree& tree, unsigned int k, std::vector<Point>& points,
-		     unsigned int degree_fitting, std::vector<Vector>& output)
-      : tree(tree), k (k), degree_fitting (degree_fitting), input (points), output (output)
-    { }
-    
-    void operator()(const tbb::blocked_range<std::size_t>& r) const
-    {
-      for( std::size_t i = r.begin(); i != r.end(); ++i)
-	output[i] = CGAL::internal::jet_estimate_normal<Kernel,SvdTraits>(input[i], tree, k, degree_fitting);
-    }
-
-  };
-#endif // CGAL_LINKED_WITH_TBB
-
-
-  
-} /* namespace internal */
-/// \endcond
-
-
-
-// ----------------------------------------------------------------------------
-// Public section
-// ----------------------------------------------------------------------------
-
-/// \ingroup PkgPointSetProcessing
-/// Estimates normal directions of the `[first, beyond)` range of points
-/// using jet fitting on the k nearest neighbors.
-/// The output normals are randomly oriented.
-///
-/// \pre `k >= 2`
-///
-/// @tparam Concurrency_tag enables sequential versus parallel algorithm.
-///                         Possible values are `Sequential_tag`
-///                         and `Parallel_tag`.
-/// @tparam ForwardIterator iterator model of the concept of the same name over input points and able to store output normals.
-/// @tparam PointPMap is a model of `ReadablePropertyMap` with  value type `Point_3<Kernel>`.
-///        It can be omitted if the value type of `ForwardIterator` is convertible to `Point_3<Kernel>`.
-/// @tparam NormalPMap is a model of `WritablePropertyMap` with value type `Vector_3<Kernel>`.
-/// @tparam Kernel Geometric traits class.
-///        It can be omitted and deduced automatically from the value type of `PointPMap`.
-/// @tparam SvdTraits template parameter for the class `Monge_via_jet_fitting` that
-///         can be ommited under conditions described in the documentation of `Monge_via_jet_fitting`.
-
-// This variant requires all parameters.
-template <typename Concurrency_tag,
-	  typename ForwardIterator,
-          typename PointPMap,
-          typename NormalPMap,
-          typename Kernel,
-          typename SvdTraits
->
-void
-jet_estimate_normals(
-  ForwardIterator first,  ///< iterator over the first input point.
-  ForwardIterator beyond, ///< past-the-end iterator over the input points.
-  PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3.
-  NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3.
-  unsigned int k, ///< number of neighbors.
-  const Kernel& /*kernel*/, ///< geometric traits.
-  unsigned int degree_fitting = 2) ///< fitting degree
-{
-  CGAL_TRACE("Calls jet_estimate_normals()\n");
-
-  // basic geometric types
-  typedef typename Kernel::Point_3 Point;
-
-  // Input points types
-  typedef typename boost::property_traits<NormalPMap>::value_type Vector;
-
-  // types for K nearest neighbors search structure
-  typedef typename CGAL::Search_traits_3<Kernel> Tree_traits;
-  typedef typename CGAL::Orthogonal_k_neighbor_search<Tree_traits> Neighbor_search;
-  typedef typename Neighbor_search::Tree Tree;
-
-  // precondition: at least one element in the container.
-  // to fix: should have at least three distinct points
-  // but this is costly to check
-  CGAL_point_set_processing_precondition(first != beyond);
-
-  // precondition: at least 2 nearest neighbors
-  CGAL_point_set_processing_precondition(k >= 2);
-
-  std::size_t memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE("  %ld Mb allocated\n", memory>>20);
-  CGAL_TRACE("  Creates KD-tree\n");
-
-  ForwardIterator it;
-
-  // Instanciate a KD-tree search.
-  // Note: We have to convert each input iterator to Point_3.
-  std::vector<Point> kd_tree_points; 
-  for(it = first; it != beyond; it++)
-  {
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-    Point point = get(point_pmap, it);
-#else
-    Point point = get(point_pmap, *it);
-#endif
-    kd_tree_points.push_back(point);
-  }
-  Tree tree(kd_tree_points.begin(), kd_tree_points.end());
-
-  memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE("  %ld Mb allocated\n", memory>>20);
-  CGAL_TRACE("  Computes normals\n");
-
-  // iterate over input points, compute and output normal
-  // vectors (already normalized)
-#ifndef CGAL_LINKED_WITH_TBB
-  CGAL_static_assertion_msg (!(boost::is_convertible<Concurrency_tag, Parallel_tag>::value),
-			     "Parallel_tag is enabled but TBB is unavailable.");
-#else
-   if (boost::is_convertible<Concurrency_tag,Parallel_tag>::value)
-   {
-     std::vector<Vector> normals (kd_tree_points.size ());
-     CGAL::internal::Jet_estimate_normals<Kernel, SvdTraits, Tree>
-       f (tree, k, kd_tree_points, degree_fitting, normals);
-     tbb::parallel_for(tbb::blocked_range<size_t>(0, kd_tree_points.size ()), f);
-     unsigned int i = 0;
-     for(it = first; it != beyond; ++ it, ++ i)
-       {
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-	 put (normal_pmap, it, normals[i]);
-#else
-	 put (normal_pmap, *it, normals[i]);
-#endif  
-       }
-   }
-   else
-#endif
-     {
-       for(it = first; it != beyond; it++)
-	 {
-	   Vector normal = internal::jet_estimate_normal<Kernel,SvdTraits,Tree>(
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-										get(point_pmap,it), 
-#else
-										get(point_pmap,*it), 
-#endif      
-										tree, k, degree_fitting);
-
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-	   put(normal_pmap, it, normal); // normal_pmap[it] = normal
-#else
-	   put(normal_pmap, *it, normal); // normal_pmap[it] = normal
-#endif 
-    
-	 }
-     }
-
-
-  memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE("  %ld Mb allocated\n", memory>>20);
-  CGAL_TRACE("End of jet_estimate_normals()\n");
-}
-
-#if defined(CGAL_EIGEN3_ENABLED) || defined(CGAL_LAPACK_ENABLED)
-/// @cond SKIP_IN_MANUAL
-template <typename Concurrency_tag,
-	  typename ForwardIterator,
-          typename PointPMap,
-          typename NormalPMap,
-          typename Kernel
->
-void
-jet_estimate_normals(
-  ForwardIterator first,
-  ForwardIterator beyond,
-  PointPMap point_pmap,
-  NormalPMap normal_pmap,
-  unsigned int k,
-  const Kernel& kernel,
-  unsigned int degree_fitting = 2)
-{
-  #ifdef CGAL_EIGEN3_ENABLED
-  typedef Eigen_svd SvdTraits;
-  #else
-  typedef Lapack_svd SvdTraits;
-  #endif
-  jet_estimate_normals<Concurrency_tag,ForwardIterator,PointPMap,NormalPMap,Kernel,SvdTraits>(
-    first, beyond, point_pmap, normal_pmap, k,  kernel, degree_fitting);
-}
-
-/// @cond SKIP_IN_MANUAL
-// This variant deduces the kernel from the point property map.
-template <typename Concurrency_tag,
-	  typename ForwardIterator,
-          typename PointPMap,
-          typename NormalPMap
->
-void
-jet_estimate_normals(
-  ForwardIterator first,  ///< iterator over the first input point.
-  ForwardIterator beyond, ///< past-the-end iterator over the input points.
-  PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3.
-  NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3.
-  unsigned int k, ///< number of neighbors.
-  unsigned int degree_fitting = 2)
-{
-  typedef typename boost::property_traits<PointPMap>::value_type Point;
-  typedef typename Kernel_traits<Point>::Kernel Kernel;
-  jet_estimate_normals<Concurrency_tag>(
-    first,beyond,
-    point_pmap, 
-    normal_pmap,
-    k,
-    Kernel(),
-    degree_fitting);
-}
-/// @endcond
-
-/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Identity_property_map.
-template <typename Concurrency_tag,
-	  typename ForwardIterator,
-          typename NormalPMap
->
-void
-jet_estimate_normals(
-  ForwardIterator first,  ///< iterator over the first input point.
-  ForwardIterator beyond, ///< past-the-end iterator over the input points.
-  NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3.
-  unsigned int k, ///< number of neighbors.
-  unsigned int degree_fitting = 2)
-{
-  jet_estimate_normals<Concurrency_tag>(
-    first,beyond,
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-    make_dereference_property_map(first),
-#else
-    make_identity_property_map(
-    typename std::iterator_traits<ForwardIterator>::value_type()),
-#endif
-    normal_pmap,
-    k,
-    degree_fitting);
-}
-/// @endcond
-#endif
-
-} //namespace CGAL
-
-#endif // CGAL_JET_ESTIMATE_NORMALS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/jet_smooth_point_set.h b/3rdparty/CGAL-4.8/include/CGAL/jet_smooth_point_set.h
deleted file mode 100644
index e00461b..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/jet_smooth_point_set.h
+++ /dev/null
@@ -1,345 +0,0 @@
-// Copyright (c) 2007-09  INRIA Sophia-Antipolis (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
-// 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(s) : Pierre Alliez, Marc Pouget and Laurent Saboret
-
-#ifndef CGAL_JET_SMOOTH_POINT_SET_H
-#define CGAL_JET_SMOOTH_POINT_SET_H
-
-#include <CGAL/trace.h>
-#include <CGAL/Search_traits_3.h>
-#include <CGAL/Orthogonal_k_neighbor_search.h>
-#include <CGAL/Monge_via_jet_fitting.h>
-#include <CGAL/property_map.h>
-#include <CGAL/point_set_processing_assertions.h>
-
-#include <iterator>
-#include <list>
-
-#ifdef CGAL_LINKED_WITH_TBB
-#include <tbb/parallel_for.h>
-#include <tbb/blocked_range.h>
-#include <tbb/scalable_allocator.h>  
-#endif // CGAL_LINKED_WITH_TBB
-
-namespace CGAL {
-
-
-// ----------------------------------------------------------------------------
-// Private section
-// ----------------------------------------------------------------------------
-/// \cond SKIP_IN_MANUAL
-
-namespace internal {
-
-/// Smoothes one point position using jet fitting on the k
-/// nearest neighbors and reprojection onto the jet.
-///
-/// \pre `k >= 2`
-///
-/// @tparam Kernel Geometric traits class.
-/// @tparam Tree KD-tree.
-///
-/// @return computed point
-template <typename Kernel,
-          typename SvdTraits,
-          typename Tree
-          >
-typename Kernel::Point_3
-jet_smooth_point(
-  const typename Kernel::Point_3& query, ///< 3D point to project
-  Tree& tree, ///< KD-tree
-  const unsigned int k, ///< number of neighbors.
-  const unsigned int degree_fitting,
-  const unsigned int degree_monge)
-{
-  // basic geometric types
-  typedef typename Kernel::Point_3 Point;
-
-  // types for K nearest neighbors search
-  typedef typename CGAL::Search_traits_3<Kernel> Tree_traits;
-  typedef typename CGAL::Orthogonal_k_neighbor_search<Tree_traits> Neighbor_search;
-  typedef typename Neighbor_search::iterator Search_iterator;
-
-  // types for jet fitting
-  typedef Monge_via_jet_fitting< Kernel,
-                                 Simple_cartesian<double>,
-                                 SvdTraits> Monge_jet_fitting;
-  typedef typename Monge_jet_fitting::Monge_form Monge_form;
-
-  // Gather set of (k+1) neighboring points.
-  // Performs k + 1 queries (if unique the query point is
-  // output first). Search may be aborted if k is greater
-  // than number of input points.
-  std::vector<Point> points; points.reserve(k+1);
-  Neighbor_search search(tree,query,k+1);
-  Search_iterator search_iterator = search.begin();
-  unsigned int i;
-  for(i=0;i<(k+1);i++)
-  {
-    if(search_iterator == search.end())
-      break; // premature ending
-    points.push_back(search_iterator->first);
-    search_iterator++;
-  }
-  CGAL_point_set_processing_precondition(points.size() >= 1);
-
-  // performs jet fitting
-  Monge_jet_fitting monge_fit;
-  Monge_form monge_form = monge_fit(points.begin(), points.end(),
-                                    degree_fitting, degree_monge);
-
-  // output projection of query point onto the jet
-  return monge_form.origin();
-}
-
-#ifdef CGAL_LINKED_WITH_TBB
-  template <typename Kernel, typename SvdTraits, typename Tree>
-  class Jet_smooth_pwns {
-    typedef typename Kernel::Point_3 Point;
-    const Tree& tree;
-    const unsigned int k;
-    unsigned int degree_fitting;
-    unsigned int degree_monge;
-    const std::vector<Point>& input;
-    std::vector<Point>& output;
-
-  public:
-    Jet_smooth_pwns (Tree& tree, unsigned int k, std::vector<Point>& points,
-		     unsigned int degree_fitting, unsigned int degree_monge, std::vector<Point>& output)
-      : tree(tree), k (k), degree_fitting (degree_fitting),
-	degree_monge (degree_monge), input (points), output (output)
-    { }
-    
-    void operator()(const tbb::blocked_range<std::size_t>& r) const
-    {
-      for( std::size_t i = r.begin(); i != r.end(); ++i)
-	output[i] = CGAL::internal::jet_smooth_point<Kernel, SvdTraits>(input[i], tree, k,
-									degree_fitting,
-									degree_monge);
-    }
-
-  };
-#endif // CGAL_LINKED_WITH_TBB
-
-
-} /* namespace internal */
-
-/// \endcond
-
-
-
-// ----------------------------------------------------------------------------
-// Public section
-// ----------------------------------------------------------------------------
-
-/// \ingroup PkgPointSetProcessing
-/// Smoothes the `[first, beyond)` range of points using jet fitting on the k
-/// nearest neighbors and reprojection onto the jet.
-/// As this method relocates the points, it
-/// should not be called on containers sorted w.r.t. point locations.
-///
-/// \pre `k >= 2`
-///
-/// @tparam Concurrency_tag enables sequential versus parallel algorithm.
-///                         Possible values are `Sequential_tag`
-///                         and `Parallel_tag`.
-/// @tparam InputIterator iterator over input points.
-/// @tparam PointPMap is a model of `ReadWritePropertyMap` with value type `Point_3<Kernel>`.
-///        It can be omitted if  the value type of `InputIterator` is convertible to `Point_3<Kernel>`.
-/// @tparam Kernel Geometric traits class.
-///        It can be omitted and deduced automatically from the value type of `PointPMap`.
-/// @tparam SvdTraits template parameter for the class `Monge_via_jet_fitting` that
-///         can be ommited under conditions described in the documentation of `Monge_via_jet_fitting`.
-
-// This variant requires all parameters.
-template <typename Concurrency_tag,
-	  typename InputIterator,
-          typename PointPMap,
-          typename Kernel,
-          typename SvdTraits
->
-void
-jet_smooth_point_set(
-  InputIterator first,  ///< iterator over the first input point.
-  InputIterator beyond, ///< past-the-end iterator over the input points.
-  PointPMap point_pmap, ///< property map: value_type of InputIterator -> Point_3.
-  unsigned int k, ///< number of neighbors.
-  const Kernel& /*kernel*/, ///< geometric traits.
-  unsigned int degree_fitting = 2, ///< fitting degree
-  unsigned int degree_monge = 2)  ///< Monge degree
-{
-  // basic geometric types
-  typedef typename Kernel::Point_3 Point;
-
-  // types for K nearest neighbors search structure
-  typedef typename CGAL::Search_traits_3<Kernel> Tree_traits;
-  typedef typename CGAL::Orthogonal_k_neighbor_search<Tree_traits> Neighbor_search;
-  typedef typename Neighbor_search::Tree Tree;
-
-  // precondition: at least one element in the container.
-  // to fix: should have at least three distinct points
-  // but this is costly to check
-  CGAL_point_set_processing_precondition(first != beyond);
-
-  // precondition: at least 2 nearest neighbors
-  CGAL_point_set_processing_precondition(k >= 2);
-  
-  InputIterator it;
-
-  // Instanciate a KD-tree search.
-  // Note: We have to convert each input iterator to Point_3.
-  std::vector<Point> kd_tree_points; 
-  for(it = first; it != beyond; it++)
-  {
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-    Point point = get(point_pmap, it);
-#else
-    Point point = get(point_pmap, *it);
-#endif  
-    kd_tree_points.push_back(point);
-  }
-  Tree tree(kd_tree_points.begin(), kd_tree_points.end());
-
-  // Iterates over input points and mutates them.
-  // Implementation note: the cast to Point& allows to modify only the point's position.
-
-#ifndef CGAL_LINKED_WITH_TBB
-  CGAL_static_assertion_msg (!(boost::is_convertible<Concurrency_tag, Parallel_tag>::value),
-			     "Parallel_tag is enabled but TBB is unavailable.");
-#else
-   if (boost::is_convertible<Concurrency_tag,Parallel_tag>::value)
-   {
-     std::vector<Point> mutated_points (kd_tree_points.size ());
-     CGAL::internal::Jet_smooth_pwns<Kernel, SvdTraits, Tree>
-       f (tree, k, kd_tree_points, degree_fitting, degree_monge,
-	  mutated_points);
-     tbb::parallel_for(tbb::blocked_range<size_t>(0, kd_tree_points.size ()), f);
-     unsigned int i = 0;
-     for(it = first; it != beyond; ++ it, ++ i)
-       {
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-	 put(point_pmap, it , mutated_points[i]);
-#else
-	 put(point_pmap, *it, mutated_points[i]);
-#endif  
-       }
-   }
-   else
-#endif
-     {
-       for(it = first; it != beyond; it++)
-	 {
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-	   const Point& p = get(point_pmap, it);
-	   put(point_pmap, it ,
-	       internal::jet_smooth_point<Kernel, SvdTraits>(
-							     p,tree,k,degree_fitting,degree_monge) );
-#else
-	   const Point& p = get(point_pmap, *it);
-	   put(point_pmap, *it ,
-	       internal::jet_smooth_point<Kernel, SvdTraits>(
-							     p,tree,k,degree_fitting,degree_monge) );
-#endif  
-	 }
-     }
-}
-
-
-#if defined(CGAL_EIGEN3_ENABLED) || defined(CGAL_LAPACK_ENABLED)
-/// @cond SKIP_IN_MANUAL
-template <typename Concurrency_tag,
-	  typename InputIterator,
-          typename PointPMap,
-          typename Kernel
->
-void
-jet_smooth_point_set(
-  InputIterator first,  ///< iterator over the first input point.
-  InputIterator beyond, ///< past-the-end iterator over the input points.
-  PointPMap point_pmap, ///< property map: value_type of InputIterator -> Point_3.
-  unsigned int k, ///< number of neighbors.
-  const Kernel& kernel, ///< geometric traits.
-  unsigned int degree_fitting = 2, ///< fitting degree
-  unsigned int degree_monge = 2)  ///< Monge degree
-{
-  #ifdef CGAL_EIGEN3_ENABLED
-  typedef Eigen_svd SvdTraits;
-  #else
-  typedef Lapack_svd SvdTraits;
-  #endif
-  jet_smooth_point_set<Concurrency_tag, InputIterator, PointPMap, Kernel, SvdTraits>(
-    first, beyond, point_pmap, k, kernel, degree_fitting, degree_monge);
-}
-
-/// @cond SKIP_IN_MANUAL
-// This variant deduces the kernel from the point property map.
-template <typename Concurrency_tag,
-	  typename InputIterator,
-          typename PointPMap
->
-void
-jet_smooth_point_set(
-  InputIterator first, ///< iterator over the first input point
-  InputIterator beyond, ///< past-the-end iterator
-  PointPMap point_pmap, ///< property map: value_type of InputIterator -> Point_3
-  unsigned int k, ///< number of neighbors.
-  const unsigned int degree_fitting = 2,
-  const unsigned int degree_monge = 2)
-{
-  typedef typename boost::property_traits<PointPMap>::value_type Point;
-  typedef typename Kernel_traits<Point>::Kernel Kernel;
-  jet_smooth_point_set<Concurrency_tag>(
-    first,beyond,
-    point_pmap,
-    k,
-    Kernel(),
-    degree_fitting,degree_monge);
-}
-/// @endcond
-
-/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Identity_property_map.
-template <typename Concurrency_tag,
-	  typename InputIterator
->
-void
-jet_smooth_point_set(
-  InputIterator first, ///< iterator over the first input point
-  InputIterator beyond, ///< past-the-end iterator
-  unsigned int k, ///< number of neighbors.
-  const unsigned int degree_fitting = 2,
-  const unsigned int degree_monge = 2)
-{
-  jet_smooth_point_set<Concurrency_tag>(
-    first,beyond,
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-    make_dereference_property_map(first),
-#else
-    make_identity_property_map(
-    typename std::iterator_traits<InputIterator>::value_type()),
-#endif
-    k,
-    degree_fitting,degree_monge);
-}
-/// @endcond
-#endif
-
-} //namespace CGAL
-
-#endif // CGAL_JET_SMOOTH_POINT_SET_H
-
diff --git a/3rdparty/CGAL-4.8/include/CGAL/kernel_to_kernel.h b/3rdparty/CGAL-4.8/include/CGAL/kernel_to_kernel.h
deleted file mode 100644
index 5c3f8c8..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/kernel_to_kernel.h
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright (c) 1999  
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved. 
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Stefan Schirra
- 
-#ifndef CGAL_KERNEL_TO_KERNEL_H
-#define CGAL_KERNEL_TO_KERNEL_H
-
-#include <CGAL/config.h>
-
-#ifdef CGAL_USE_LEDA
-#include <CGAL/LEDA_basic.h>
-#include <CGAL/leda_integer.h>
-#if CGAL_LEDA_VERSION < 500
-#include <LEDA/rat_point.h>
-#else
-#include <LEDA/geo/rat_point.h>
-#endif
-#endif
-
-#include <CGAL/Point_2.h>
-#include <CGAL/Segment_2.h>
-#include <CGAL/Cartesian.h>
-#include <CGAL/Homogeneous.h>
-
-namespace CGAL {
-
-template <class NumberType>
-struct Cartesian_double_to_Homogeneous
-{
-  typedef Point_2< Homogeneous< NumberType> >    Point2;
-  typedef Segment_2< Homogeneous< NumberType> >  Segment;
-
-  Cartesian_double_to_Homogeneous() {}
-
-  Point2
-  operator()(  const Point_2<Cartesian<double> >& p) const
-  { return Point2( NumberType(p.x()), NumberType(p.y()) ); }
-
-  Segment
-  operator()(  const Segment_2<Cartesian<double> >& s) const
-  {
-    return Segment( Point2( NumberType(s.source().x()),
-                            NumberType(s.source().y()) ),
-                    Point2( NumberType(s.target().x()),
-                            NumberType(s.target().y()) ) );
-  }
-};
-
-#ifdef CGAL_USE_LEDA
-struct Cartesian_double_to_H_double_int
-{
-  typedef Point_2< Homogeneous< double> >    Point2;
-  typedef Segment_2< Homogeneous< double> >  Segment;
-
-  Segment
-  operator()(  const Segment_2< Cartesian< double> >& s) const
-  {
-    leda_rat_point rs =  leda_point(s.source().x(), s.source().y());
-    leda_rat_point rt =  leda_point(s.target().x(), s.target().y());
-
-    return Segment(
-      Point2(CGAL_LEDA_SCOPE::to_double(rs.X()),
-             CGAL_LEDA_SCOPE::to_double(rs.Y()),
-             CGAL_LEDA_SCOPE::to_double(rs.W())),
-      Point2(CGAL_LEDA_SCOPE::to_double(rt.X()),
-             CGAL_LEDA_SCOPE::to_double(rt.Y()),
-             CGAL_LEDA_SCOPE::to_double(rt.W())) );
-  }
-};
-
-struct Cartesian_float_to_H_double_int
-{
-  typedef Point_2< Homogeneous< double> >    Point2;
-  typedef Segment_2< Homogeneous< double> >  Segment;
-
-  Segment
-  operator()(  const Segment_2< Cartesian< float> >& s) const
-  {
-    leda_rat_point rs =  leda_point(s.source().x(), s.source().y());
-    leda_rat_point rt =  leda_point(s.target().x(), s.target().y());
-
-    return Segment(
-      Point2(CGAL_LEDA_SCOPE::to_double(rs.X()),
-             CGAL_LEDA_SCOPE::to_double(rs.Y()),
-             CGAL_LEDA_SCOPE::to_double(rs.W())),
-      Point2(CGAL_LEDA_SCOPE::to_double(rt.X()),
-             CGAL_LEDA_SCOPE::to_double(rt.Y()),
-             CGAL_LEDA_SCOPE::to_double(rt.W())) );
-  }
-};
-#endif // CGAL_USE_LEDA
-
-} //namespace CGAL
-
-#endif // CGAL_KERNEL_TO_KERNEL_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/leda_bigfloat.h b/3rdparty/CGAL-4.8/include/CGAL/leda_bigfloat.h
deleted file mode 100644
index 3b57085..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/leda_bigfloat.h
+++ /dev/null
@@ -1,161 +0,0 @@
-// Copyright (c) 1999,2007  
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved. 
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Stefan Schirra, Michael Hemmer
-
-#ifndef CGAL_LEDA_BIGFLOAT_H
-#define CGAL_LEDA_BIGFLOAT_H
-
-#include <CGAL/basic.h>
-
-#include <utility>
-#include <CGAL/leda_coercion_traits.h>
-#include <CGAL/Interval_nt.h>
-
-#include <CGAL/LEDA_basic.h>
-#if CGAL_LEDA_VERSION < 500
-#include <LEDA/bigfloat.h>
-#else
-#include <LEDA/numbers/bigfloat.h>
-#endif
-
-namespace CGAL {
-
-template <> class Algebraic_structure_traits< leda_bigfloat >
-  : public Algebraic_structure_traits_base< leda_bigfloat,
-                                            Field_with_kth_root_tag >  {
-  public:
-    typedef Tag_false           Is_exact;
-    typedef Tag_true            Is_numerical_sensitive;
-
-    class Sqrt
-      : public std::unary_function< Type, Type > {
-      public:
-        Type operator()( const Type& x ) const {
-          return CGAL_LEDA_SCOPE::sqrt( x );
-        }
-    };
-
-    class Kth_root
-      : public std::binary_function<int, Type, Type> {
-      public:
-        Type operator()( int k,
-                                        const Type& x) const {
-            CGAL_precondition_msg(k > 0, "'k' must be positive for k-th roots");
-            // heuristic: we ask for as many precision as the argument has
-            long d = x.get_significant_length();
-            if ( d < 53) // O.K. we want at least double precision
-                d = 53;
-            return CGAL_LEDA_SCOPE::sqrt_d( x, d, k);
-        }
-    };
-
-};
-
-template <> class Real_embeddable_traits< leda_bigfloat >
-  : public INTERN_RET::Real_embeddable_traits_base< leda_bigfloat , CGAL::Tag_true > {
-public:
-  
-    class Abs
-      : public std::unary_function< Type, Type > {
-      public:
-        Type operator()( const Type& x ) const {
-            return CGAL_LEDA_SCOPE::abs( x );
-        }
-    };
-
-    class Sgn
-      : public std::unary_function< Type, ::CGAL::Sign > {
-      public:
-        ::CGAL::Sign operator()( const Type& x ) const {
-          return (::CGAL::Sign) CGAL_LEDA_SCOPE::sign( x );
-        }
-    };
-
-    class Compare
-      : public std::binary_function< Type, Type,
-                                Comparison_result > {
-      public:
-        Comparison_result operator()( const Type& x,
-                                            const Type& y ) const {
-          return (Comparison_result) CGAL_LEDA_SCOPE::compare( x, y );
-        }
-        
-        CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT( Type, 
-                Comparison_result )
-    };
-
-    class To_double
-      : public std::unary_function< Type, double > {
-      public:
-        double operator()( const Type& x ) const {
-          return x.to_double();
-        }
-    };
-
-    class To_interval
-      : public std::unary_function< Type, std::pair< double, double > > {
-      public:
-        std::pair<double, double> operator()( const Type& x ) const {
-
-          // assuming leda_bigfloat guarantee 1 bit error max
-          Protect_FPU_rounding<true> P (CGAL_FE_TONEAREST);
-          Interval_nt_advanced approx (CGAL_LEDA_SCOPE::to_double(x));
-          FPU_set_cw(CGAL_FE_UPWARD);
-          approx += Interval_nt<false>::smallest();
-          return approx.pair();
-        }
-    };
-
-    class Is_finite
-      : public std::unary_function< Type, bool > {
-      public:
-        bool operator()( const Type& x )  const {
-          return !( CGAL_LEDA_SCOPE::isInf(x) || CGAL_LEDA_SCOPE::isNaN(x) );
-        }
-    };
-};
-
-template<>
-class Is_valid< leda_bigfloat >
-  : public std::unary_function< leda_bigfloat, bool > {
-  public :
-    bool operator()( const leda_bigfloat& x ) const {
-      return !( CGAL_LEDA_SCOPE::isNaN(x) );
-    }
-};
-
-
-} //namespace CGAL
-
-// Unary + is missing for leda::bigfloat
-namespace leda {
-    inline bigfloat operator+( const bigfloat& i) { return i; }
-} // namespace leda
-
-//since types are included by LEDA_coercion_traits.h:
-#include <CGAL/leda_integer.h>
-#include <CGAL/leda_rational.h>
-#include <CGAL/leda_real.h>
-#include <CGAL/LEDA_arithmetic_kernel.h>
-
-#endif // CGAL_LEDA_BIGFLOAT_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/leda_bigfloat_interval.h b/3rdparty/CGAL-4.8/include/CGAL/leda_bigfloat_interval.h
deleted file mode 100644
index 8f26e52..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/leda_bigfloat_interval.h
+++ /dev/null
@@ -1,492 +0,0 @@
-// Copyright (c) 2008 Max-Planck-Institute Saarbruecken (Germany).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Michael Hemmer
-// TODO: add sign to RET
-
-
-#ifndef CGAL_LEDA_BIGFLOAT_INTERVAL_H
-#define CGAL_LEDA_BIGFLOAT_INTERVAL_H
-
-#include <CGAL/basic.h>
-
-#include <CGAL/LEDA_basic.h>
-#if CGAL_LEDA_VERSION < 500
-#include <LEDA/bigfloat.h>
-#else
-#include <LEDA/numbers/bigfloat.h>
-#endif
-
-#include <boost/numeric/interval.hpp>
-
-#include <CGAL/Interval_traits.h>
-#include <CGAL/Bigfloat_interval_traits.h>
-#include <CGAL/ipower.h>
-
-namespace CGAL {
-namespace internal {
-
-struct Rounding_for_leda_bigfloat {
-private:  typedef leda::bigfloat T;
-public:
-    Rounding_for_leda_bigfloat(){};
-    ~Rounding_for_leda_bigfloat(){};
-    
-    T conv_down(const T& a){
-        return round(a,leda::bigfloat::get_precision(),leda::TO_N_INF);
-    };
-    T conv_up  (const T& a){
-        return round(a,leda::bigfloat::get_precision(),leda::TO_P_INF);
-    };  
-    // mathematical operations
-    T add_down(const T& a, const T& b){
-        return add(a,b,leda::bigfloat::get_precision(),leda::TO_N_INF);
-    };
-    T add_up  (const T& a, const T& b){
-        return add(a,b,leda::bigfloat::get_precision(),leda::TO_P_INF);
-    };  
-    T sub_down(const T& a, const T& b){
-        return sub(a, b, leda::bigfloat::get_precision(),leda::TO_N_INF);
-    };
-    T sub_up  (const T& a, const T& b){
-        return sub(a, b, leda::bigfloat::get_precision(),leda::TO_P_INF);
-    }; 
-    T mul_down(const T& a, const T& b){
-        return mul(a, b, leda::bigfloat::get_precision(),leda::TO_N_INF);
-    };
-    T mul_up  (const T& a, const T& b){
-        return mul(a, b, leda::bigfloat::get_precision(),leda::TO_P_INF);
-    }; 
-    T div_down(const T& a, const T& b){
-        return div(a, b, leda::bigfloat::get_precision(),leda::TO_N_INF);
-    };
-    T div_up  (const T& a, const T& b){
-        return div(a, b, leda::bigfloat::get_precision(),leda::TO_P_INF);
-    };         
-    T sqrt_down(const T& a){
-        return sqrt(a, leda::bigfloat::get_precision(),leda::TO_N_INF);
-    };
-    T sqrt_up  (const T& a){
-        return sqrt(a, leda::bigfloat::get_precision(),leda::TO_P_INF);
-    }; 
-
-    T median(const T& a, const T& b){ return (a+b)/2;    };   
-    T int_down(const T& a)          { return T(floor(a));};   
-    T int_up  (const T& a)          { return T(ceil(a)); };
-};
-
-class Checking_for_leda_bigfloat {
-        
-    typedef leda::bigfloat T;
-
-public:
-        
-    static T pos_inf() {
-        T b = T(5) / T(0);
-        CGAL_assertion(leda::ispInf(b));
-        return b;
-    }
-
-    static T neg_inf() {
-        T b = T(-5) / T(0);
-        CGAL_assertion(leda::isnInf(b));
-        return b;
-    }
-        
-    static T nan() {
-        T b = T(0)*pos_inf();
-        CGAL_assertion(leda::isNaN(b));
-        return b;
-    }
-
-    static bool is_nan(const T& b) {
-        return leda::isNaN(b);
-    }
-
-    static T empty_lower() {
-        return T(1);
-    }
-
-    static T empty_upper() {
-        return T(0);
-    }
-
-    static bool is_empty(const T& a, const T& b) {
-      //return a==T(1) && b == T(0);
-      return a > b; 
-    }
-};
-
-} // namespace internal
-} //namespace CGAL
-
-namespace boost {
-namespace numeric {
-inline
-std::ostream& operator << 
-    (std::ostream& os, const boost::numeric::interval<leda::bigfloat>& x)
-{
-    os << "[" 
-       << x.lower().get_significant() << "*2^" << x.lower().get_exponent() 
-       << " , "
-       << x.upper().get_significant() << "*2^" << x.upper().get_exponent()
-       << "]";
-    return os;
-}
-
-
-}//namespace numeric
-}//namespace boost
-
-namespace CGAL {
-
-typedef boost::numeric::interval
-< leda::bigfloat,
-    boost::numeric::interval_lib::policies
-      < internal::Rounding_for_leda_bigfloat,
-        internal::Checking_for_leda_bigfloat > > 
-leda_bigfloat_interval;
-
-} //end of namespace CGAL
-
-#include <CGAL/leda_integer.h>
-#include <CGAL/leda_rational.h>
-#include <CGAL/leda_real.h>
-#include <CGAL/leda_bigfloat.h>
-
-namespace CGAL {
-
-template <> class Algebraic_structure_traits< leda_bigfloat_interval >
-    : public Algebraic_structure_traits_base< leda_bigfloat_interval,
-                                            Field_with_sqrt_tag >  {
-public:
-    typedef Tag_false           Is_exact;
-    typedef Tag_true            Is_numerical_sensitive;
-
-    class Sqrt
-        : public std::unary_function< Type, Type > {
-    public:
-        Type operator()( const Type& x ) const {
-            return ::boost::numeric::sqrt(x);
-        }
-    };
-};
-
-template <> class Real_embeddable_traits< leda_bigfloat_interval >
-    : public INTERN_RET::Real_embeddable_traits_base< leda_bigfloat_interval , CGAL::Tag_true > {
-public:
-  
-    class Abs
-        : public std::unary_function< Type, Type > {
-    public:
-        Type operator()( const Type& x ) const {
-            return ::boost::numeric::abs(x);
-        }
-    };
-
-    class To_double
-        : public std::unary_function< Type, double > {
-    public:
-        double operator()( const Type& x ) const {
-            return CGAL::to_double(::boost::numeric::median(x));
-        }
-    };
-
-    class To_interval
-        : public std::unary_function< Type, std::pair< double, double > > {
-    public:
-        std::pair<double, double> operator()( const Type& x ) const {            
-            std::pair<double, double> lower_I(CGAL::to_interval(x.lower()));
-            std::pair<double, double> upper_I(CGAL::to_interval(x.upper()));
-            return std::pair< double, double >(
-                    CGAL::min(lower_I.first , upper_I.first ),
-                    CGAL::max(lower_I.second, upper_I.second));
-        }
-    };
-};
-
-
-// Coercion traits:
-CGAL_DEFINE_COERCION_TRAITS_FROM_TO(short      ,leda_bigfloat_interval)
-CGAL_DEFINE_COERCION_TRAITS_FROM_TO(int        ,leda_bigfloat_interval)
-CGAL_DEFINE_COERCION_TRAITS_FROM_TO(long       ,leda_bigfloat_interval)
-CGAL_DEFINE_COERCION_TRAITS_FROM_TO(float      ,leda_bigfloat_interval)
-CGAL_DEFINE_COERCION_TRAITS_FROM_TO(double     ,leda_bigfloat_interval)
-CGAL_DEFINE_COERCION_TRAITS_FROM_TO(::leda::bigfloat   ,leda_bigfloat_interval)
-
-template <>
-struct Coercion_traits< leda_bigfloat_interval , ::leda::integer >{
-    typedef Tag_true  Are_explicit_interoperable;
-    typedef Tag_false Are_implicit_interoperable;
-    
-    typedef leda_bigfloat_interval Type;
-    
-    struct Cast{
-        typedef Type result_type;
-        Type operator()(const leda_bigfloat_interval& x)  const { return x;}
-        Type operator()(const ::leda::integer& x) const {
-            leda::bigfloat tmp(x);
-            leda_bigfloat_interval result(
-                    round(tmp,leda::bigfloat::get_precision(),leda::TO_N_INF),
-                    round(tmp,leda::bigfloat::get_precision(),leda::TO_P_INF));
-            CGAL_postcondition( result.lower() <= x );
-            CGAL_postcondition( result.upper() >= x );
-            return result; 
-        }
-    };
-};
-
-template <>
-struct Coercion_traits< leda_bigfloat_interval , ::leda::rational >{
-    typedef Tag_true  Are_explicit_interoperable;
-    typedef Tag_false Are_implicit_interoperable;
-    
-    typedef leda_bigfloat_interval Type;
-    
-    struct Cast{
-        typedef Type result_type;
-        Type operator()(const leda_bigfloat_interval& x)  const { return x;}
-        Type operator()(const ::leda::rational& x) const {
-            long prec = ::leda::bigfloat::get_precision();
-            leda_bigfloat_interval result (
-                    leda_bigfloat::from_rational(x,prec,leda::TO_N_INF),
-                    leda_bigfloat::from_rational(x,prec,leda::TO_P_INF));
-            CGAL_postcondition( result.lower() <= x );
-            CGAL_postcondition( result.upper() >= x );
-            return result; 
-        }
-    };
-};
-
-template <>
-struct Coercion_traits< leda_bigfloat_interval , ::leda::real >{
-    typedef Tag_true  Are_explicit_interoperable;
-    typedef Tag_false Are_implicit_interoperable;
-    
-    typedef leda_bigfloat_interval Type;
-    
-    struct Cast{
-        typedef Type result_type;
-        Type operator()(const leda_bigfloat_interval& x)  const { return x;}
-        Type operator()(const ::leda::real& x) const {
-            long current_prec = ::leda::bigfloat::get_precision();
-            x.guarantee_relative_error(current_prec);
-            leda_bigfloat_interval 
-                result(x.get_lower_bound(), x.get_upper_bound());
-            CGAL_postcondition( result.lower() <= x );
-            CGAL_postcondition( result.upper() >= x );
-            return result;
-        }
-    };
-};
-
-template <> struct Coercion_traits< ::leda::integer, leda_bigfloat_interval >
-    :public Coercion_traits< leda_bigfloat_interval , ::leda::integer >{}; 
-
-template <> struct Coercion_traits< ::leda::rational, leda_bigfloat_interval >
-    :public Coercion_traits< leda_bigfloat_interval , ::leda::rational >{}; 
-
-template <> struct Coercion_traits< ::leda::real, leda_bigfloat_interval >
-    :public Coercion_traits< leda_bigfloat_interval , ::leda::real>{};        
-        
-
-
-template<>
-class Interval_traits<leda_bigfloat_interval>
-  :public internal::Interval_traits_base<leda_bigfloat_interval>
-{
-public: 
-    typedef Interval_traits<leda_bigfloat_interval> Self; 
-    typedef leda_bigfloat_interval Interval; 
-    typedef leda::bigfloat Bound; 
-    typedef CGAL::Tag_true Is_interval; 
-    typedef CGAL::Tag_true With_empty_interval; 
-
-    struct Construct :public std::binary_function<Bound,Bound,Interval>{
-        Interval operator()( const Bound& l,const Bound& r) const {
-            CGAL_precondition( l < r ); 
-            return Interval(l,r);
-        }
-    };
-
-    struct Lower :public std::unary_function<Interval,Bound>{
-        Bound operator()( const Interval& a ) const {
-            return a.lower();
-        }
-    };
-
-    struct Upper :public std::unary_function<Interval,Bound>{
-        Bound operator()( const Interval& a ) const {
-            return a.upper();
-        }
-    };
-
-    struct Width :public std::unary_function<Interval,Bound>{
-        Bound operator()( const Interval& a ) const {
-            return ::boost::numeric::width(a);
-        }
-    };
-
-    struct Median :public std::unary_function<Interval,Bound>{
-        Bound operator()( const Interval& a ) const {
-            return ::boost::numeric::median(a);
-        }
-    };
-    
-    struct Norm :public std::unary_function<Interval,Bound>{
-        Bound operator()( const Interval& a ) const {
-            return ::boost::numeric::norm(a);
-        }
-    };
-
-    struct Empty :public std::unary_function<Interval,bool>{
-        bool operator()( const Interval& a ) const {
-            return ::boost::numeric::empty(a);
-        }
-    };
-
-    struct Singleton :public std::unary_function<Interval,bool>{
-        bool operator()( const Interval& a ) const {
-            return ::boost::numeric::singleton(a);
-        }
-    };
-
-    struct Zero_in :public std::unary_function<Interval,bool>{
-        bool operator()( const Interval& a ) const {
-            return ::boost::numeric::in_zero(a);
-        }
-    };
-
-    struct In :public std::binary_function<Bound,Interval,bool>{
-        bool operator()( Bound x, const Interval& a ) const {
-            return ::boost::numeric::in(x,a);
-        }
-    };
-
-    struct Equal :public std::binary_function<Interval,Interval,bool>{
-        bool operator()( const Interval& a, const Interval& b ) const {
-            return ::boost::numeric::equal(a,b);
-        }
-    };
-    
-    struct Overlap :public std::binary_function<Interval,Interval,bool>{
-        bool operator()( const Interval& a, const Interval& b ) const {
-            return ::boost::numeric::overlap(a,b);
-        }
-    };
-    
-    struct Subset :public std::binary_function<Interval,Interval,bool>{
-        bool operator()( const Interval& a, const Interval& b ) const {
-            return ::boost::numeric::subset(a,b);
-        }
-    };
-    
-    struct Proper_subset :public std::binary_function<Interval,Interval,bool>{
-        bool operator()( const Interval& a, const Interval& b ) const {
-            return ::boost::numeric::proper_subset(a,b);
-        }
-    };
-    
-    struct Hull :public std::binary_function<Interval,Interval,Interval>{
-        Interval operator()( const Interval& a, const Interval& b ) const {
-            return ::boost::numeric::hull(a,b);
-        }
-    };
-    
-    struct Intersection :public std::binary_function<Interval,Interval,Interval>{
-        Interval operator()( const Interval& a, const Interval& b ) const {
-            Interval r = ::boost::numeric::intersect(a,b);      
-            return r;
-        }
-    };
-};
-
-template<>
-class Bigfloat_interval_traits<leda_bigfloat_interval>
-    :public Interval_traits<leda_bigfloat_interval> 
-{
-  typedef leda_bigfloat_interval NT;
-  typedef leda::bigfloat BF; 
-public:
-  typedef Bigfloat_interval_traits<leda_bigfloat_interval> Self;
-  typedef CGAL::Tag_true Is_bigfloat_interval; 
-  
-
-//   struct Get_significant_bits : public std::unary_function<NT,long>{
-//         long operator()( NT x) const {
-//             CGAL_precondition(!Singleton()(x));
-//             leda::bigfloat lower = x.lower();
-//             leda::bigfloat upper = x.upper();
-//             leda::integer lower_m = lower.get_significant();
-//             leda::integer upper_m = upper.get_significant();
-//             leda::integer lower_exp = lower.get_exponent();
-//             leda::integer upper_exp = upper.get_exponent();
-//             long shift = (upper_exp - lower_exp).to_long();
-//             if(shift >= 0 ) upper_m = (upper_m <<  shift);
-//             else            lower_m = (lower_m << -shift);
-//             //CGAL_postcondition(lower_m.length() == upper_m.length());
-//             leda::integer err = upper_m - lower_m; 
-//             std::cout <<"LEDA: " << lower_m << " " << err << " " << std::endl; 
-//             return CGAL::abs(lower_m.length()-err.length());
-//         }
-//     };
-
-    
-  struct Relative_precision: public std::unary_function<NT,long>{
-    long operator()(const NT& x) const {
-      CGAL_precondition(!Singleton()(x));
-      CGAL_precondition(!CGAL::zero_in(x));
-
-      leda::bigfloat w = Width()(x);
-      w = leda::div(w,Lower()(x),Get_precision()(),leda::TO_P_INF); 
-      return -leda::ilog2(w).to_long();
-    }
-  };
-  
-  struct Set_precision : public std::unary_function<long,long> {
-    long operator()( long prec ) const {
-      return BF::set_precision(prec); 
-    }
-  };
-     
-    struct Get_precision {
-        // type for the \c AdaptableGenerator concept.
-        typedef long  result_type;  
-        long operator()() const {
-            return BF::get_precision(); 
-        }
-    };
-};
-
-
-::leda::bigfloat inline relative_error(const leda_bigfloat_interval& x){
-    if(in_zero(x)){
-        return CGAL::abs(x).upper();
-    }else{
-        return (width(x) / CGAL::abs(x)).upper();
-    }
-}
-
-leda_bigfloat_interval inline ipower(const leda_bigfloat_interval& x, int i ){
-    return ::boost::numeric::pow(x,i);
-}
-
-
-} //namespace CGAL
-
-#endif //  CGAL_LEDA_BIGFLOAT_INTERVAL_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/leda_coercion_traits.h b/3rdparty/CGAL-4.8/include/CGAL/leda_coercion_traits.h
deleted file mode 100644
index 7fe2781..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/leda_coercion_traits.h
+++ /dev/null
@@ -1,135 +0,0 @@
-// Copyright (c) 2006-2008 Max-Planck-Institute Saarbruecken (Germany).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Michael Hemmer   <hemmer at mpi-inf.mpg.de>
-
-
-/*! \file NiX/LEDA/Coercion_traits.h
- *  \brief Provides specializations of Coercion_traits for the LEDA number types.
- */
-
-#ifndef CGAL_LEDA_COERCION_TRAITS_H
-#define CGAL_LEDA_COERCION_TRAITS_H
-
-#include <CGAL/number_type_basic.h>
-
-#ifdef CGAL_USE_LEDA
-
-#include <CGAL/LEDA_basic.h>
-#if CGAL_LEDA_VERSION < 500
-#include <LEDA/integer.h>
-#include <LEDA/bigfloat.h>
-#include <LEDA/rational.h>
-#include <LEDA/real.h>
-#else
-#include <LEDA/numbers/integer.h>
-#include <LEDA/numbers/bigfloat.h>
-#include <LEDA/numbers/rational.h>
-#include <LEDA/numbers/real.h>
-#endif
-
-namespace CGAL {
-
-
-//LEDA internal coercions:
-
-    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(::leda::integer,::leda::bigfloat)
-    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(::leda::integer,::leda::rational)
-    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(::leda::integer,::leda::real)
-
-// CGAL_DEFINE_COERCION_TRAITS_FROM_TO(::leda::bigfloat,::leda::rational); see below
-    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(::leda::bigfloat,::leda::real)
-
-    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(::leda::rational,::leda::real)
-
-// The following definitions reflect the interaction of the LEDA number types
-// with the built in types,
-// leda integer:
-    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(short    ,::leda::integer)
-    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(int      ,::leda::integer)
-    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(long     ,::leda::integer)
-
-// leda rational:
-    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(short      ,::leda::rational)
-    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(int        ,::leda::rational)
-    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(long       ,::leda::rational)
-
-    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(float      ,::leda::rational)
-    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(double     ,::leda::rational)
-    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(long double,::leda::rational)
-
-// leda bigfloat:      :
-    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(short      ,::leda::bigfloat)
-    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(int        ,::leda::bigfloat)
-    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(long       ,::leda::bigfloat)
-    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(float      ,::leda::bigfloat)
-    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(double     ,::leda::bigfloat)
-
-// leda real:
-    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(short      ,::leda::real)
-    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(int        ,::leda::real)
-    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(float      ,::leda::real)
-    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(double     ,::leda::real)
-
-
-//not provided by LEDA
-//Note that this is not symmetric to CORE
-//CGAL_DEFINE_COERCION_TRAITS_FROM_TO(long long,::leda::integer);
-//CGAL_DEFINE_COERCION_TRAITS_FROM_TO(long long,::leda::rational);
-//CGAL_DEFINE_COERCION_TRAITS_FROM_TO(long long  ,::leda::bigfloat);
-//CGAL_DEFINE_COERCION_TRAITS_FROM_TO(long double,::leda::bigfloat);
-//CGAL_DEFINE_COERCION_TRAITS_FROM_TO(long       ,::leda::real);
-//CGAL_DEFINE_COERCION_TRAITS_FROM_TO(long long  ,::leda::real);
-//CGAL_DEFINE_COERCION_TRAITS_FROM_TO(long double,::leda::real);
-
-
-template <>
-struct Coercion_traits< ::leda::bigfloat ,::leda::rational  >{
-    typedef Tag_true  Are_explicit_interoperable;
-    typedef Tag_false Are_implicit_interoperable;
-    typedef ::leda::rational Type;
-    struct Cast{
-        typedef Type result_type;
-        Type operator()(const ::leda::rational& x)  const { return x;}
-        Type operator()(const ::leda::bigfloat& x) const {
-#if CGAL_LEDA_VERSION < 500
-            ::leda::integer e = x.get_exponent();
-            ::leda::integer s = x.get_significant();
-            if(e<0) {
-                ::leda::bigfloat b_two_to_e = ::leda::ipow2(-e);
-                ::leda::integer two_to_e = ::leda::floor(b_two_to_e);
-                return ::leda::rational(s,two_to_e);
-            }
-            // e >= 0
-            ::leda::bigfloat b_two_to_e = ::leda::ipow2(e);
-            ::leda::integer two_to_e = ::leda::floor(b_two_to_e);
-            return ::leda::rational(s * two_to_e);
-#else
-            return x.to_rational();
-#endif
-        }
-    };
-};
-template <> struct Coercion_traits< ::leda::rational, ::leda::bigfloat >
-    :public Coercion_traits< ::leda::bigfloat , ::leda::rational >{};
-
-
-} //namespace CGAL
-#endif // CGAL_USE_LEDA
-#endif //CGAL_LEDA_COERCION_TRAITS_H
-//EOF
diff --git a/3rdparty/CGAL-4.8/include/CGAL/leda_integer.h b/3rdparty/CGAL-4.8/include/CGAL/leda_integer.h
deleted file mode 100644
index d9737b3..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/leda_integer.h
+++ /dev/null
@@ -1,282 +0,0 @@
-// Copyright (c) 1999,2007  
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved. 
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Andreas Fabri, Michael Hemmer
-
-#ifndef CGAL_LEDA_INTEGER_H
-#define CGAL_LEDA_INTEGER_H
-
-#include <CGAL/number_type_basic.h>
-
-#include <utility>
-
-#include <CGAL/leda_coercion_traits.h>
-#include <CGAL/Interval_nt.h>
-
-#include <CGAL/LEDA_basic.h>
-#if CGAL_LEDA_VERSION < 500
-#include <LEDA/integer.h>
-#include <LEDA/bigfloat.h>// for To_interval
-#else
-#include <LEDA/numbers/integer.h>
-#include <LEDA/numbers/bigfloat.h>// for To_interval
-#endif
-
-#include <CGAL/Residue.h>
-#include <CGAL/Modular_traits.h>
-
-namespace CGAL {
-
-
-template <> class Algebraic_structure_traits< leda_integer >
-  : public Algebraic_structure_traits_base< leda_integer,
-                                            Euclidean_ring_tag >  {
-  public:
-    typedef Tag_true            Is_exact;
-    typedef Tag_false           Is_numerical_sensitive;
-
-    typedef INTERN_AST::Is_square_per_sqrt< Type >
-                                                                 Is_square;
-
-    class Gcd
-      : public std::binary_function< Type, Type,
-                                Type > {
-      public:
-        Type operator()( const Type& x,
-                                        const Type& y ) const {
-          // By definition gcd(0,0) == 0
-          if( x == Type(0) && y == Type(0) )
-            return Type(0);
-
-          return CGAL_LEDA_SCOPE::gcd( x, y );
-        }
-
-        CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( Type )
-    };
-
-    // Unfortunately the behaviour of leda has changed here several times
-    // The following Div_mod is invariant under these changes
-    // However, the Div and Mod defined below might be more efficient 
-    // TODO: recover Div Mod implementation for all leda versions
-    class Div_mod {
-    public: 
-        typedef Type first_argument_type;
-        typedef Type second_argument_type; 
-        typedef Type& third_argument_type; 
-        typedef Type& fourth_argument_type; 
-        typedef void result_type;
-        
-        void operator()(const Type& x, const Type& y, Type& q, Type& r) const {
-            
-            q = x / y;             
-            r = x - q*y;
-            CGAL_postcondition(x == y*q + r);  
-            
-            if (r == 0) return;   
-             
-            // round q towards zero 
-            if ( r.sign() != x.sign() ){
-                q -= x.sign();
-                r -= x.sign()*y;
-            }
-
-            CGAL_postcondition(x == y*q + r);            
-            CGAL_postcondition(r.sign() == x.sign());
-        }  
-    };
-    // Div defined via base using Div_mod
-    // Mod defined via base using Div_mod
-
-    // This code results in an inconsisten div/mod for some leda versions 
-    // TODO: reactivate this code 
-
-//     typedef INTERN_AST::Div_per_operator< Type > Div;
-//     class Mod
-//       : public std::binary_function< Type, Type,
-//                                 Type > {
-//       public:
-//         Type operator()( const Type& x, const Type& y ) const {
-//           Type m = x % y;
-// #if CGAL_LEDA_VERSION < 520
-//           // Fix wrong leda result
-//           if( x < 0 && m != 0 )
-//             m -= y;
-// #elif CGAL_LEDA_VERSION < 600
-//           // Fix another wrong leda result
-//           if( x < 0 && y > 0 && m != 0 )
-//             m -= y;
-// #else
-//           // Do nothing, it seems to work now!
-//           // TODO: be careful for future improvements of LEDA
-// #endif
-//           return m;
-//         }
-//         CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( Type )
-//     };
-
-    class Sqrt
-      : public std::unary_function< Type, Type > {
-      public:
-        Type operator()( const Type& x ) const {
-          return CGAL_LEDA_SCOPE::sqrt( x );
-        }
-    };
-};
-
-template <> class Real_embeddable_traits< leda_integer >
-  : public INTERN_RET::Real_embeddable_traits_base< leda_integer , CGAL::Tag_true > {
-  public:
-  
-    class Abs
-      : public std::unary_function< Type, Type > {
-      public:
-        Type operator()( const Type& x ) const {
-            return CGAL_LEDA_SCOPE::abs( x );
-        }
-    };
-
-    class Sgn
-      : public std::unary_function< Type, ::CGAL::Sign > {
-      public:
-        ::CGAL::Sign operator()( const Type& x ) const {
-            return (::CGAL::Sign) CGAL_LEDA_SCOPE::sign( x );
-        }
-    };
-
-    class Compare
-      : public std::binary_function< Type, Type,
-                                Comparison_result > {
-      public:
-        Comparison_result operator()( const Type& x,
-                                            const Type& y ) const {
-          return (Comparison_result) CGAL_LEDA_SCOPE::compare( x, y );
-        }
-
-    };
-
-    class To_double
-      : public std::unary_function< Type, double > {
-      public:
-        double operator()( const Type& x ) const {
-          return x.to_double();
-        }
-    };
-
-    class To_interval
-      : public std::unary_function< Type, std::pair< double, double > > {
-      public:
-      std::pair<double, double> operator()( const Type& x ) const {
-        leda::bigfloat h(x);
-	double abs_err = 0;
-	double  low =h.to_double(abs_err, leda::TO_N_INF);
-	double high =h.to_double(abs_err, leda::TO_P_INF);
-	return std::make_pair(low,high);
-      }
-    };
-};
-
-template<>
-class Modular_traits< ::leda::integer > {
-    typedef Residue MOD;
- public:
-    typedef ::leda::integer NT;
-    typedef ::CGAL::Tag_true Is_modularizable;
-    typedef MOD Residue_type;
-
-    struct Modular_image{
-        Residue_type operator()(const NT& a){
-            return Residue_type ((a%NT(MOD::get_current_prime())).to_long());
-        }
-    };
-    struct Modular_image_representative{
-        NT operator()(const Residue_type& x){
-            return NT(x.get_value());
-        }
-    };    
-};
-
-//
-// Needs_parens_as_product
-//
-template <>
-struct Needs_parens_as_product<leda_integer> {
-  bool operator()(const leda_integer& x) {
-    return CGAL_NTS is_negative(x);
-  }
-};
-
-// missing mixed operators
-inline
-bool
-operator==(int a, const leda_integer& b)
-{ return b == a; }
-
-inline
-bool
-operator!=(int a, const leda_integer& b)
-{ return b != a; }
-
-
-template <>
-struct Split_double<leda_integer>
-{
-  void operator()(double d, leda_integer &num, leda_integer &den) const
-  {
-    std::pair<double, double> p = split_numerator_denominator(d);
-    num = leda_integer(p.first);
-    den = leda_integer(p.second);
-  }
-};
-
-// Benchmark_rep specialization 
-template<>
-class Benchmark_rep< leda_integer > {
-    const leda_integer& t;
-public:
-    //! initialize with a const reference to \a t.
-    Benchmark_rep( const leda_integer& tt) : t(tt) {}
-    //! perform the output, calls \c operator\<\< by default.
-    std::ostream& operator()( std::ostream& out) const { 
-            out << t;
-            return out;
-    }
-    
-    static std::string get_benchmark_name() {
-        return "Integer";
-    }
-};
-
-
-} //namespace CGAL
-
-// Unary + is missing for leda::integer
-namespace leda {
-    inline integer operator+( const integer& i) { return i; }
-} // namespace leda
-
-//since types are included by LEDA_coercion_traits.h:
-#include <CGAL/leda_rational.h>
-#include <CGAL/leda_bigfloat.h>
-#include <CGAL/leda_real.h>
-#include <CGAL/LEDA_arithmetic_kernel.h>
-
-#endif // CGAL_LEDA_INTEGER_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/leda_rational.h b/3rdparty/CGAL-4.8/include/CGAL/leda_rational.h
deleted file mode 100644
index f242f76..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/leda_rational.h
+++ /dev/null
@@ -1,308 +0,0 @@
-// Copyright (c) 1999,2007  
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved. 
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Andreas Fabri, Michael Hemmer
-
-#ifndef CGAL_LEDA_RATIONAL_H
-#define CGAL_LEDA_RATIONAL_H
-
-#include <CGAL/IO/io.h>
-#include <CGAL/number_type_basic.h>
-
-#include <CGAL/leda_coercion_traits.h>
-#include <CGAL/Interval_nt.h>
-
-#include <CGAL/Needs_parens_as_product.h>
-
-#include <utility>
-#include <limits>
-
-#include <CGAL/LEDA_basic.h>
-#if CGAL_LEDA_VERSION < 500
-#  include <LEDA/rational.h>
-#  include <LEDA/interval.h>
-#else
-#  include <LEDA/numbers/rational.h>
-#  if defined(  _MSC_VER )
-#    pragma push_macro("ERROR")  
-#    undef ERROR
-#  endif // _MSC_VER
-#  include <LEDA/numbers/interval.h>
-#  if defined(  _MSC_VER )
-#    pragma pop_macro("ERROR")  
-#  endif
-#endif
-
-#include <CGAL/leda_integer.h> // for GCD in Fraction_traits
-
-namespace CGAL {
-
-template <> class Algebraic_structure_traits< leda_rational >
-  : public Algebraic_structure_traits_base< leda_rational,
-                                            Field_tag >  {
-  public:
-    typedef Tag_true            Is_exact;
-    typedef Tag_false           Is_numerical_sensitive;
-
-//    TODO: How to implement this without having sqrt?
-//    typedef INTERN_AST::Is_square_per_sqrt< Type >
-//                                                                 Is_square;
-
-    class Simplify
-      : public std::unary_function< Type&, void > {
-      public:
-        void operator()( Type& x) const {
-            x.normalize();
-        }
-    };
-
-};
-
-template <> class Real_embeddable_traits< leda_rational >
-  : public INTERN_RET::Real_embeddable_traits_base< leda_rational , CGAL::Tag_true > {
-  public:
-  
-    class Abs
-      : public std::unary_function< Type, Type > {
-      public:
-        Type operator()( const Type& x ) const {
-            return CGAL_LEDA_SCOPE::abs( x );
-        }
-    };
-
-    class Sgn
-      : public std::unary_function< Type, ::CGAL::Sign > {
-      public:
-        ::CGAL::Sign operator()( const Type& x ) const {
-            return (::CGAL::Sign) CGAL_LEDA_SCOPE::sign( x );
-        }
-    };
-
-    class Compare
-      : public std::binary_function< Type, Type,
-                                Comparison_result > {
-      public:
-        Comparison_result operator()( const Type& x,
-                                      const Type& y ) const {
-          return (Comparison_result) CGAL_LEDA_SCOPE::compare( x, y );
-        }
-        CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT(Type,Comparison_result)
-    };
-
-    class To_double
-      : public std::unary_function< Type, double > {
-      public:
-        double operator()( const Type& x ) const {
-          return x.to_double();
-        }
-    };
-
-    class To_interval
-      : public std::unary_function< Type, std::pair< double, double > > {
-      public:
-        std::pair<double, double> operator()( const Type& x ) const {
-
-#if CGAL_LEDA_VERSION >= 501
-          CGAL_LEDA_SCOPE::interval temp(x);
-          std::pair<double, double> result(temp.lower_bound(),temp.upper_bound());
-          CGAL_assertion_code( double infinity=std::numeric_limits<double>::infinity(); )
-          CGAL_postcondition(result.first  == -infinity || Type(result.first)<=x);
-          CGAL_postcondition(result.second ==  infinity || Type(result.second)>=x);
-          return result;
-#else
-          CGAL_LEDA_SCOPE::bigfloat xnum = x.numerator();
-          CGAL_LEDA_SCOPE::bigfloat xden = x.denominator();
-          CGAL_LEDA_SCOPE::bigfloat xupp =
-                                    div(xnum,xden,53,CGAL_LEDA_SCOPE::TO_P_INF);
-          CGAL_LEDA_SCOPE::bigfloat xlow =
-                                    div(xnum,xden,53,CGAL_LEDA_SCOPE::TO_N_INF);
-
-          // really smallest positive double
-          double MinDbl = CGAL_LEDA_SCOPE::fp::compose_parts(0,0,0,1);
-
-          double low = xlow.to_double();
-          while(Type(low) > x) low = low - MinDbl;
-
-          double upp = xupp.to_double();
-          while(Type(upp) < x) upp = upp + MinDbl;
-
-          std::pair<double, double> result(low,upp);
-          CGAL_postcondition(Type(result.first)<=x);
-          CGAL_postcondition(Type(result.second)>=x);
-          return result;
-#endif
-          // Original CGAL to_interval (seemed to be inferior)
-          //  // There's no guarantee about the error of to_double(), so I add
-          //  //  3 ulps...
-          //  Protect_FPU_rounding<true> P (CGAL_FE_TONEAREST);
-          //  Interval_nt_advanced approx (z.to_double());
-          //  FPU_set_cw(CGAL_FE_UPWARD);
-          //
-          //  approx += Interval_nt<false>::smallest();
-          //  approx += Interval_nt<false>::smallest();
-          //  approx += Interval_nt<false>::smallest();
-          //  return approx.pair();
-
-        }
-    };
-};
-
-/*! \ingroup NiX_Fraction_traits_spec
- *  \brief Specialization of Fraction_traits for ::leda::rational
- */
-template <>
-class Fraction_traits< leda_rational > {
-public:
-    typedef leda_rational Type;
-    typedef ::CGAL::Tag_true Is_fraction;
-    typedef leda_integer Numerator_type;
-    typedef Numerator_type Denominator_type;
-
-    typedef Algebraic_structure_traits< Numerator_type >::Gcd Common_factor;
-
-    class Decompose {
-    public:
-        typedef Type first_argument_type;
-        typedef Numerator_type& second_argument_type;
-        typedef Numerator_type& third_argument_type;
-        void operator () (
-                const Type& rat,
-                Numerator_type& num,
-                Numerator_type& den) {
-            num = rat.numerator();
-            den = rat.denominator();
-        }
-    };
-
-    class Compose {
-    public:
-        typedef Numerator_type first_argument_type;
-        typedef Numerator_type second_argument_type;
-        typedef Type result_type;
-        Type operator ()(
-                const Numerator_type& num ,
-                const Numerator_type& den ) {
-            Type result(num, den);
-            result.normalize();
-            return result;
-        }
-    };
-};
-
-template <class F>
-class Output_rep< leda_rational, F> {
-    const leda_rational& t;
-public:
-    //! initialize with a const reference to \a t.
-    Output_rep( const leda_rational& tt) : t(tt) {}
-    //! perform the output, calls \c operator\<\< by default.
-    std::ostream& operator()( std::ostream& out) const {
-        switch (get_mode(out)) {
-        case IO::PRETTY:{
-            if(t.denominator() == leda_integer(1))
-                return out <<t.numerator();
-            else
-                return out << t.numerator()
-                           << "/"
-                           << t.denominator();
-            break;
-        }
-
-        default:
-            return out << t.numerator()
-                       << "/"
-                       << t.denominator();
-        }
-    }
-};
-
-template <>
-struct Needs_parens_as_product< leda_rational >{
-    bool operator()( leda_rational t){
-        if (t.denominator() != 1 )
-            return true;
-        else
-            return needs_parens_as_product(t.numerator()) ;
-    }
-};
-
-template <>
-class Output_rep< leda_rational, Parens_as_product_tag > {
-    const leda_rational& t;
-public:
-    // Constructor
-    Output_rep( const leda_rational& tt) : t(tt) {}
-    // operator
-    std::ostream& operator()( std::ostream& out) const {
-        Needs_parens_as_product< leda_rational > needs_parens_as_product;
-        if (needs_parens_as_product(t))
-            return out <<"("<< oformat(t) <<")";
-        else
-            return out << oformat(t);
-    }
-};
-
-template < >
-class Benchmark_rep< leda_rational > {
-    const leda_rational& t;
-public:
-    //! initialize with a const reference to \a t.
-    Benchmark_rep( const leda_rational& tt) : t(tt) {}
-    //! perform the output, calls \c operator\<\< by default.
-    std::ostream& operator()( std::ostream& out) const { 
-            return 
-                out << "Rational(" << t.numerator() << "," 
-                    << t.denominator() << ")";
-    }
-
-    static std::string get_benchmark_name() {
-        return "Rational";
-    }
-
-};
-
-namespace internal {
-  // See: Stream_support/include/CGAL/IO/io.h
-  template <typename ET>
-  void read_float_or_quotient(std::istream & is, ET& et);
-
-  template <>
-  inline void read_float_or_quotient(std::istream & is, leda_rational& et)
-  {
-    internal::read_float_or_quotient<leda_integer,leda_rational>(is, et);
-  }
-} // namespace internal
-
-} //namespace CGAL
-
-// Unary + is missing for leda::rational
-namespace leda{
-inline rational operator+( const rational& i) { return i; }
-}
-
-//since types are included by LEDA_coercion_traits.h:
-#include <CGAL/leda_integer.h>
-#include <CGAL/leda_bigfloat.h>
-#include <CGAL/leda_real.h>
-#include <CGAL/LEDA_arithmetic_kernel.h>
-
-#endif  // CGAL_LEDA_RATIONAL_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/leda_real.h b/3rdparty/CGAL-4.8/include/CGAL/leda_real.h
deleted file mode 100644
index b3503a8..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/leda_real.h
+++ /dev/null
@@ -1,259 +0,0 @@
-// Copyright (c) 1999,2007  
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved. 
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Stefan Schirra, Michael Hemmer
-
-#ifndef CGAL_LEDA_REAL_H
-#define CGAL_LEDA_REAL_H
-
-#include <CGAL/number_type_basic.h>
-
-#include <CGAL/leda_coercion_traits.h>
-
-#include <CGAL/utils.h>
-#include <CGAL/Interval_nt.h>
-
-#include <utility>
-
-#include <CGAL/LEDA_basic.h>
-#if CGAL_LEDA_VERSION < 500
-#include <LEDA/real.h>
-#include <LEDA/interval.h>
-#else
-#include <LEDA/numbers/real.h>
-#endif
-
-
-namespace CGAL {
-
-template <> class Algebraic_structure_traits< leda_real >
-
-#if CGAL_LEDA_VERSION >= 500
-  : public Algebraic_structure_traits_base< leda_real,
-                                            Field_with_root_of_tag >  {
-#else
-  : public Algebraic_structure_traits_base< leda_real,
-                                            Field_with_kth_root_tag >  {
-#endif
-
-  public:
-    typedef Tag_true           Is_exact;
-    typedef Tag_true           Is_numerical_sensitive;
-
-    class Sqrt
-      : public std::unary_function< Type, Type > {
-      public:
-        Type operator()( const Type& x ) const {
-          return CGAL_LEDA_SCOPE::sqrt( x );
-        }
-    };
-
-    class Kth_root
-      : public std::binary_function<int, Type, Type> {
-      public:
-        Type operator()( int k,
-                                        const Type& x) const {
-            CGAL_precondition_msg(k > 0, "'k' must be positive for k-th roots");
-            return CGAL_LEDA_SCOPE::root( x, k);
-        }
-    };
-
-// Root_of is only available for LEDA versions >= 5.0
-#if CGAL_LEDA_VERSION >= 500
-    class Root_of {
-      public:
-        typedef Type result_type;
-
-//        typedef leda_rational Boundary;
-      private:
-        template< class ForwardIterator >
-        inline
-        CGAL_LEDA_SCOPE::polynomial<Type>
-        make_polynomial(ForwardIterator begin,
-                        ForwardIterator end) const {
-          CGAL_LEDA_SCOPE::growing_array<Type> coeffs;
-          for(ForwardIterator it = begin; it < end; it++)
-              coeffs.push_back(*it);
-          return CGAL_LEDA_SCOPE::polynomial<Type>(coeffs);
-        }
-      public:
-        template <class ForwardIterator>
-        Type operator()( int k,
-                       ForwardIterator begin,
-                       ForwardIterator end) const {
-            return CGAL_LEDA_SCOPE::diamond(k,make_polynomial(begin,end));
-        }
-/*        template <class ForwardIterator>
-        Type operator()( leda_rational lower,
-                                        leda_rational upper,
-                                        ForwardIterator begin,
-                                        ForwardIterator end) const {
-            return CGAL_LEDA_SCOPE::diamond(lower,upper,
-                                             make_polynomial(begin,end));
-        };*/
-    };
-
-#endif
-
-
-};
-
-template <> class Real_embeddable_traits< leda_real >
-  : public INTERN_RET::Real_embeddable_traits_base< leda_real , CGAL::Tag_true > {
-  public:
-    class Abs
-      : public std::unary_function< Type, Type > {
-      public:
-        Type operator()( const Type& x ) const {
-            return CGAL_LEDA_SCOPE::abs( x );
-        }
-    };
-
-    class Sgn
-      : public std::unary_function< Type, ::CGAL::Sign > {
-      public:
-        ::CGAL::Sign operator()( const Type& x ) const {
-          return (::CGAL::Sign) CGAL_LEDA_SCOPE::sign( x );
-        }
-    };
-
-    class Compare
-      : public std::binary_function< Type, Type,
-                                Comparison_result > {
-      public:
-        Comparison_result operator()( const Type& x,
-                                            const Type& y ) const {
-          return (Comparison_result) CGAL_LEDA_SCOPE::compare( x, y );
-        }
-
-        CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT( Type,
-                                                      Comparison_result )
-
-    };
-
-    class To_double
-      : public std::unary_function< Type, double > {
-      public:
-        double operator()( const Type& x ) const {
-          // this call is required to get reasonable values for the double
-          // approximation (as of LEDA-4.3.1)
-          x.improve_approximation_to(53);
-          return x.to_double();
-        }
-    };
-
-    class To_interval
-      : public std::unary_function< Type, std::pair< double, double > > {
-      public:
-        std::pair<double, double> operator()( const Type& x ) const {
-
-#if CGAL_LEDA_VERSION >= 501
-            leda_bigfloat bnum = x.to_bigfloat();
-            leda_bigfloat berr = x.get_bigfloat_error();
-
-            double dummy;
-            double low = CGAL_LEDA_SCOPE::sub(bnum, berr, 53, CGAL_LEDA_SCOPE::TO_N_INF).to_double(dummy,
-                                                     CGAL_LEDA_SCOPE::TO_N_INF);
-            double upp = CGAL_LEDA_SCOPE::add(bnum, berr, 53, CGAL_LEDA_SCOPE::TO_P_INF).to_double(dummy,
-                                                     CGAL_LEDA_SCOPE::TO_P_INF);
-
-            std::pair<double, double> result(low, upp);
-            CGAL_postcondition(Type(result.first)<=x);
-            CGAL_postcondition(Type(result.second)>=x);
-            return result;
-#else
-            CGAL_LEDA_SCOPE::interval temp(x); //bug in leda
-            std::pair<double, double> result(temp.lower_bound(),temp.upper_bound());
-            CGAL_postcondition_msg(Type(result.first)<=x,
-                                                    "Known bug in LEDA <=5.0");
-            CGAL_postcondition_msg(Type(result.first)>=x,
-                                                    "Known bug in LEDA <=5.0");
-            return result;
-            // If x is very small and we look closer at x
-            // (i.e. comparison or to_double() or to_bigfloat())
-            // then x gets 0, which is really bad.
-            // Therefore we do not touch x.
-            // The LEDA interval above returns (-inf, inf) for
-            // very small x, which is also bad and leads to
-            // problems lateron. The postcondition fails in this
-            // situation.
-#endif
-              // Original CGAL to_interval:
-            //  Protect_FPU_rounding<true> P (CGAL_FE_TONEAREST);
-            //  double approx = z.to_double();
-            //  double rel_error = z.get_double_error();
-            //  FPU_set_cw(CGAL_FE_UPWARD);
-            //  Interval_nt_advanced ina(-rel_error,rel_error);
-            //  ina += 1;
-            //  ina *= approx;
-            //  return ina.pair();
-        }
-    };
-};
-
-
-template <>
-class Output_rep< ::leda::real > {
-    const ::leda::real& t;
-public:
-    //! initialize with a const reference to \a t.
-    Output_rep( const ::leda::real& tt) : t(tt) {}
-    //! perform the output, calls \c operator\<\< by default.
-    std::ostream& operator()( std::ostream& out) const {
-        out << CGAL_NTS to_double(t);
-        return out;
-    }
-
-};
-
-template <>
-class Output_rep< ::leda::real, CGAL::Parens_as_product_tag > {
-    const ::leda::real& t;
-public:
-    //! initialize with a const reference to \a t.
-    Output_rep( const ::leda::real& tt) : t(tt) {}
-    //! perform the output, calls \c operator\<\< by default.
-    std::ostream& operator()( std::ostream& out) const {
-        if (t<0) out << "(" << ::CGAL::oformat(t)<<")";
-        else out << ::CGAL::oformat(t);
-        return out;
-    }
-};
-
-
-
-} //namespace CGAL
-
-// Unary + is missing for leda::real
-
-namespace leda {
-    inline real operator+( const real& i) { return i; }
-} // namespace leda
-
-
-//since types are included by LEDA_coercion_traits.h:
-#include <CGAL/leda_integer.h>
-#include <CGAL/leda_rational.h>
-#include <CGAL/leda_bigfloat.h>
-#include <CGAL/LEDA_arithmetic_kernel.h>
-
-#endif // CGAL_LEDA_REAL_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/make_mesh_3.h b/3rdparty/CGAL-4.8/include/CGAL/make_mesh_3.h
deleted file mode 100644
index 4e08d34..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/make_mesh_3.h
+++ /dev/null
@@ -1,452 +0,0 @@
-// Copyright (c) 2009 INRIA Sophia-Antipolis (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
-// 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(s)     : Stéphane Tayeb
-//
-//******************************************************************************
-// File Description : make_mesh_3 function definition.
-//******************************************************************************
-
-#ifndef CGAL_MAKE_MESH_3_H
-#define CGAL_MAKE_MESH_3_H
-
-#include <CGAL/Mesh_3/config.h>
-#include <CGAL/Mesh_3/global_parameters.h>
-#include <CGAL/refine_mesh_3.h>
-#include <CGAL/tags.h>
-#include <CGAL/Mesh_3/Protect_edges_sizing_field.h>
-#include <CGAL/Mesh_3/Has_features.h>
-
-#include <boost/mpl/has_xxx.hpp>
-
-namespace CGAL {
-  
-namespace parameters {
-  namespace internal {
-    // Features
-    struct Features_options
-    {
-      Features_options(bool b) : b_(b) {}
-      bool features() const { return b_; }
-    private:
-      bool b_;
-    };
-    
-    // -----------------------------------
-    // Features generator
-    // -----------------------------------
-    // struct Features_option_generator
-    template <typename HasFeatures>
-    struct Features_options_generator {};
-    
-    template<>
-    struct Features_options_generator<CGAL::Tag_true>
-    {
-      Features_options operator()() { return Features_options(true); }
-    };
-    
-    template<>
-    struct Features_options_generator<CGAL::Tag_false>
-    {
-      Features_options operator()() { return Features_options(false); }
-    };
-    
-    // struct Domain_features_generator is designed to handle cases where
-    // MeshDomain::Has_features is not a valid type
-    template< typename MeshDomain, bool MeshDomainHasHasFeatures >
-    struct Domain_features_generator {};
-    
-    template< typename MeshDomain >
-    struct Domain_features_generator< MeshDomain, false >
-    {
-      Features_options operator()()
-      { 
-        return Features_options_generator<CGAL::Tag_false>()();
-      }
-    };
-    
-    template< typename MeshDomain >
-    struct Domain_features_generator< MeshDomain, true >
-    {
-      Features_options operator()()
-      { 
-        return Features_options_generator<typename MeshDomain::Has_features>()();
-      }
-    };
-
-  } // end namespace internal
-
-  // -----------------------------------
-  // Features_options
-  // -----------------------------------
-  inline internal::Features_options
-  features() { return internal::Features_options(true); }
-
-  inline internal::Features_options
-  no_features() { return internal::Features_options(false); }
-  
-  template < typename MeshDomain >
-  inline internal::Features_options
-  features(const MeshDomain& /*domain*/)
-  {
-    typedef typename internal::Domain_features_generator<
-      MeshDomain,
-      CGAL::internal::Mesh_3::has_Has_features<MeshDomain>::value > Generator;
-    
-    return Generator()();
-  }
-  
-  // -----------------------------------
-  // Parameters
-  // -----------------------------------
-
-// see <CGAL/config.h>
-CGAL_PRAGMA_DIAG_PUSH
-// see <CGAL/Mesh_3/config.h>
-CGAL_MESH_3_IGNORE_BOOST_PARAMETER_NAME_WARNINGS
-
-  BOOST_PARAMETER_NAME( features_param )
-
-CGAL_PRAGMA_DIAG_POP
-  
-} // end namespace parameters::internal
-
-
-// -----------------------------------
-// Initialize c3t3 stuff
-// -----------------------------------
-namespace internal {
-namespace Mesh_3 {
-
-template < typename C3T3, typename MeshDomain, typename MeshCriteria >
-void
-init_c3t3(C3T3& c3t3, const MeshDomain& domain, const MeshCriteria&,
-          const int nb_initial_points)
-{
-  typedef typename MeshDomain::Point_3 Point_3;
-  typedef typename MeshDomain::Index Index;
-  typedef std::vector<std::pair<Point_3, Index> > Initial_points_vector;
-  typedef typename Initial_points_vector::iterator Ipv_iterator;
-  typedef typename C3T3::Vertex_handle Vertex_handle;
-  
-  // Mesh initialization : get some points and add them to the mesh
-  Initial_points_vector initial_points;
-  if (nb_initial_points > 0)
-    domain.construct_initial_points_object()(std::back_inserter(initial_points),
-                                             nb_initial_points);
-  else //use default number of points
-    domain.construct_initial_points_object()(std::back_inserter(initial_points));
-
-  // Insert points and set their index and dimension
-  for ( Ipv_iterator it = initial_points.begin() ;
-       it != initial_points.end() ;
-       ++it )
-  {
-    Vertex_handle v = c3t3.triangulation().insert(it->first);
-    
-    // v could be null if point is hidden
-    if ( v != Vertex_handle() )
-    {
-      c3t3.set_dimension(v,2); // by construction, points are on surface
-      c3t3.set_index(v,it->second);      
-    }
-  }
-}
-
-template < typename EdgeCriteria >
-struct Edge_criteria_sizing_field_wrapper
-{
-  typedef typename EdgeCriteria::Index    Index;
-  typedef typename EdgeCriteria::FT       FT;
-  typedef typename EdgeCriteria::Point_3  Point_3;
-  
-  Edge_criteria_sizing_field_wrapper(const EdgeCriteria& ec) : ec_(ec) {}
-  FT operator()(const Point_3& p, const int dim, const Index& index) const
-  { return ec_.sizing_field(p,dim,index); }
-
-private:
-  // No need to copy EdgeCriteria here
-  const EdgeCriteria& ec_;
-};
-
-template < typename C3T3, typename MeshDomain, typename MeshCriteria >
-void
-init_c3t3_with_features(C3T3& c3t3,
-                        const MeshDomain& domain,
-                        const MeshCriteria& criteria)
-{
-  typedef typename MeshCriteria::Edge_criteria Edge_criteria;
-  typedef Edge_criteria_sizing_field_wrapper<Edge_criteria> Sizing_field;
-
-  CGAL::Mesh_3::Protect_edges_sizing_field<C3T3,MeshDomain,Sizing_field>     
-    protect_edges(c3t3, domain, Sizing_field(criteria.edge_criteria_object()));
-  
-  protect_edges(true);
-}
-  
-
-// C3t3_initializer: initialize c3t3
-template < typename C3T3,
-           typename MeshDomain,
-           typename MeshCriteria,
-           bool MeshDomainHasHasFeatures,
-           typename HasFeatures = int>
-struct C3t3_initializer {};
-  
-// Partial specialization of C3t3_initializer
-// Handle cases where MeshDomain::Has_features is not a valid type
-template < typename C3T3, typename MD, typename MC, typename HasFeatures >
-struct C3t3_initializer < C3T3, MD, MC, false, HasFeatures >
-{
-  void operator()(C3T3& c3t3,
-                  const MD& domain,
-                  const MC& criteria,
-                  bool with_features,
-                  const int nb_initial_points = -1)
-  {
-    if ( with_features )
-    {
-      std::cerr << "Warning: you requested a mesh with features from a domain"
-                << " without features !" << std::endl;
-    }
-    
-    init_c3t3(c3t3,domain,criteria,nb_initial_points);
-  }
-};
-
-// Partial specialization of C3t3_initializer
-// Handles cases where MeshDomain::Has_features is a valid type
-template < typename C3T3, typename MD, typename MC, typename HasFeatures >
-struct C3t3_initializer < C3T3, MD, MC, true, HasFeatures >
-{
-  void operator()(C3T3& c3t3,
-                  const MD& domain,
-                  const MC& criteria,
-                  bool with_features,
-                  const int nb_initial_points = -1)
-  {
-    C3t3_initializer < C3T3, MD, MC, true, typename MD::Has_features >()
-      (c3t3,domain,criteria,with_features,nb_initial_points);
-  }  
-};
-
-// Partial specialization of C3t3_initializer
-// Handles cases where MeshDomain::Has_features is a valid type and is defined
-// to CGAL::Tag_true
-template < typename C3T3, typename MD, typename MC >
-struct C3t3_initializer < C3T3, MD, MC, true, CGAL::Tag_true >
-{
-  void operator()(C3T3& c3t3,
-                  const MD& domain,
-                  const MC& criteria,
-                  bool with_features,
-                  const int nb_initial_points = -1)
-  {
-    if ( with_features ) { init_c3t3_with_features(c3t3,domain,criteria); }
-    else { init_c3t3(c3t3,domain,criteria,nb_initial_points); }
-  }
-};
-  
-// Partial specialization of C3t3_initializer
-// Handles cases where MeshDomain::Has_features is a valid type and is defined
-// to CGAL::Tag_false
-template < typename C3T3, typename MD, typename MC >
-struct C3t3_initializer < C3T3, MD, MC, true, CGAL::Tag_false >
-{
-  void operator()(C3T3& c3t3,
-                  const MD& domain,
-                  const MC& criteria,
-                  bool with_features,
-                  const int nb_initial_points = -1)
-  {
-    if ( with_features )
-    {
-      std::cerr << "Warning: you requested a mesh with features from a domain"
-                << " without features !" << std::endl;
-    }
-    
-    init_c3t3(c3t3,domain,criteria,nb_initial_points);
-  }
-};
-
-}} // end namespace internal::Mesh_3
-  
-
-// -----------------------------------
-// make_mesh_3 stuff
-// -----------------------------------
-
-// Manual redirections
-// boost::parameter can't handle make_mesh_3 return_type alone...
-#ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
-
-template <typename C3T3, typename MD, typename MC, typename ... T>
-C3T3 make_mesh_3(const MD& md, const MC& mc, const T& ...t)
-{
-  C3T3 c3t3;
-  make_mesh_3_bp(c3t3,md,mc,t...);
-  return c3t3;  
-}
-
-#else
-
-template <typename C3T3, typename MD, typename MC>
-C3T3 make_mesh_3(const MD& md, const MC& mc)
-{ 
-  C3T3 c3t3;
-  make_mesh_3_bp(c3t3,md,mc);
-  return c3t3;
-}
-  
-template <typename C3T3, typename MD, typename MC,
-  typename Arg1>
-C3T3 make_mesh_3(const MD& md, const MC& mc, const Arg1& a1)
-{ 
-  C3T3 c3t3;
-  make_mesh_3_bp(c3t3,md,mc,a1);
-  return c3t3;
-}
-
-template <typename C3T3, typename MD, typename MC,
-  typename Arg1, typename Arg2>
-C3T3 make_mesh_3(const MD& md, const MC& mc, const Arg1& a1, const Arg2& a2)
-{
-  C3T3 c3t3; 
-  make_mesh_3_bp(c3t3,md,mc,a1,a2);
-  return c3t3;
-}
-
-template <typename C3T3, typename MD, typename MC,
-  typename Arg1, typename Arg2, typename Arg3>
-C3T3 make_mesh_3(const MD& md, const MC& mc, const Arg1& a1, const Arg2& a2,
-                 const Arg3& a3)
-{ 
-  C3T3 c3t3;
-  make_mesh_3_bp(c3t3,md,mc,a1,a2,a3);
-  return c3t3;
-}
-
-template <typename C3T3, typename MD, typename MC,
-  typename Arg1, typename Arg2, typename Arg3, typename Arg4>
-C3T3 make_mesh_3(const MD& md, const MC& mc, const Arg1& a1, const Arg2& a2,
-                 const Arg3& a3, const Arg4& a4)
-{ 
-  C3T3 c3t3;
-  make_mesh_3_bp(c3t3,md,mc,a1,a2,a3,a4);
-  return c3t3;
-}
-
-template <typename C3T3, typename MD, typename MC,
-  typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5>
-C3T3 make_mesh_3(const MD& md, const MC& mc, const Arg1& a1, const Arg2& a2,
-                 const Arg3& a3, const Arg4& a4, const Arg5& a5)
-{ 
-  C3T3 c3t3;
-  make_mesh_3_bp(c3t3,md,mc,a1,a2,a3,a4,a5);
-  return c3t3;
-}
-
-#endif  
-  
-// see <CGAL/config.h>
-CGAL_PRAGMA_DIAG_PUSH
-// see <CGAL/Mesh_3/config.h>
-CGAL_MESH_3_IGNORE_BOOST_PARAMETER_NAME_WARNINGS
-
-BOOST_PARAMETER_FUNCTION(
-  (void),
-  make_mesh_3_bp,
-  parameters::tag,
-  (required (in_out(c3t3),*) (domain,*) (criteria,*) ) // nondeduced
-  (deduced 
-    (optional
-      (features_param, (parameters::internal::Features_options), parameters::features(domain))
-      (exude_param, (parameters::internal::Exude_options), parameters::exude())
-      (perturb_param, (parameters::internal::Perturb_options), parameters::perturb())
-      (odt_param, (parameters::internal::Odt_options), parameters::no_odt())
-      (lloyd_param, (parameters::internal::Lloyd_options), parameters::no_lloyd())
-      (mesh_options_param, (parameters::internal::Mesh_3_options), 
-                           parameters::internal::Mesh_3_options())
-    )
-  )
-)
-{
-  make_mesh_3_impl(c3t3, domain, criteria,
-                   exude_param, perturb_param, odt_param, lloyd_param,
-                   features_param.features(), mesh_options_param);
-}
-CGAL_PRAGMA_DIAG_POP
-
-/**
- * @brief This function meshes the domain defined by mesh_traits
- * (respecting criteria), and outputs the mesh to c3t3
- *
- * @param domain the domain to be discretized
- * @param criteria the criteria
- * @param exude if it is set to \c true, an exudation step will be done at
- *   the end of the Delaunay refinement process
- *
- * @return The mesh as a C3T3 object
- */
-template<class C3T3, class MeshDomain, class MeshCriteria>
-void make_mesh_3_impl(C3T3& c3t3,
-                      const MeshDomain&   domain,
-                      const MeshCriteria& criteria,
-                      const parameters::internal::Exude_options& exude,
-                      const parameters::internal::Perturb_options& perturb,
-                      const parameters::internal::Odt_options& odt,
-                      const parameters::internal::Lloyd_options& lloyd,
-                      const bool with_features,
-                      const parameters::internal::Mesh_3_options& 
-                        mesh_options = parameters::internal::Mesh_3_options())
-{
-#ifdef CGAL_MESH_3_INITIAL_POINTS_NO_RANDOM_SHOOTING
-  CGAL::default_random = CGAL::Random(0);
-#endif
-
-  // Initialize c3t3
-  internal::Mesh_3::C3t3_initializer< 
-    C3T3,
-    MeshDomain,
-    MeshCriteria,
-    internal::Mesh_3::has_Has_features<MeshDomain>::value > () (c3t3,
-            domain,
-            criteria,
-            with_features,
-            mesh_options.number_of_initial_points);
-
-  // If c3t3 initialization is not sufficient (may happen if there is only
-  // a planar curve as feature for example), add some surface points
-  if ( c3t3.triangulation().dimension() != 3 )
-  {
-    internal::Mesh_3::init_c3t3(c3t3, domain, criteria,
-              mesh_options.number_of_initial_points);
-  }
-  CGAL_assertion( c3t3.triangulation().dimension() == 3 );
-  
-  // Build mesher and launch refinement process
-  // Don't reset c3t3 as we just created it
-  refine_mesh_3(c3t3, domain, criteria,
-                exude, perturb, odt, lloyd, parameters::no_reset_c3t3(), mesh_options);
-}
-
-
-}  // end namespace CGAL
-
-
-#endif // CGAL_MAKE_MESH_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/mesh_segmentation.h b/3rdparty/CGAL-4.8/include/CGAL/mesh_segmentation.h
deleted file mode 100644
index 00674d1..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/mesh_segmentation.h
+++ /dev/null
@@ -1,491 +0,0 @@
-#ifndef CGAL_SURFACE_MESH_SEGMENTATION_MESH_SEGMENTATION_H
-// Copyright (c) 2014  GeometryFactory Sarl (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
-// 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.
-
-
-#define CGAL_SURFACE_MESH_SEGMENTATION_MESH_SEGMENTATION_H
-
-/**
- * @file mesh_segmentation.h
- * @brief The API which contains free template functions for SDF computation and mesh segmentation.
- */
-#include <CGAL/internal/Surface_mesh_segmentation/Surface_mesh_segmentation.h>
-#include <boost/config.hpp>
-
-namespace CGAL
-{
-
-
-/// @cond SKIP_IN_MANUAL
-template <bool Fast_sdf_calculation_mode, class Polyhedron,
-         class SDFPropertyMap,
-         class PointPropertyMap
-#ifdef DOXYGEN_RUNNING
-         = typename boost::property_map<Polyhedron, boost::vertex_point_t>::type
-#endif
-         , class GeomTraits
-#ifdef DOXYGEN_RUNNING
-         = typename Kernel_traits<typename boost::property_traits<PointPropertyMap>::value_type>::Kernel
-#endif
-         >
-std::pair<double, double>
-sdf_values( const Polyhedron& polyhedron,
-            SDFPropertyMap sdf_values_map,
-            double cone_angle = 2.0 / 3.0 * CGAL_PI,
-            std::size_t number_of_rays = 25,
-            bool postprocess = true,
-            PointPropertyMap ppmap = PointPropertyMap(),
-            GeomTraits traits = GeomTraits())
-{
-  typedef PointPropertyMap VPMap;
-  internal::Surface_mesh_segmentation<Polyhedron, GeomTraits, VPMap, Fast_sdf_calculation_mode>
-    algorithm(polyhedron, traits, ppmap);
-  return algorithm.calculate_sdf_values(cone_angle, number_of_rays,
-                                        sdf_values_map, postprocess);
-}
-/// @endcond
-
-/*!
- * \ingroup PkgSurfaceSegmentation
- * @brief Function computing the Shape Diameter Function over a surface mesh.
- *
- * This function implements the Shape Diameter Function (SDF) as described in \cgalCite{shapira2008consistent}.
- * It is possible to compute raw SDF values (without post-processing). In such a case,
- * -1 is used to indicate when no SDF value could be computed for a facet.
- *
- * @pre @a polyhedron.is_pure_triangle()
- *
- * @tparam Polyhedron a model of `FaceListGraph`
- * @tparam SDFPropertyMap  a `ReadWritePropertyMap` with `boost::graph_traits<Polyhedron>::%face_descriptor` as key and `double` as value type
- * @tparam GeomTraits a model of `SegmentationGeomTraits`
- * @tparam PointPropertyMap a `ReadablePropertyMap` with `boost::graph_traits<Polyhedron>::%vertex_descriptor` as key and `GeomTraits::Point_3` as value type.
- *
- * @param polyhedron surface mesh on which SDF values are computed
- * @param[out] sdf_values_map the SDF value of each facet
- * @param cone_angle opening angle in radians for the cone of each facet
- * @param number_of_rays number of rays picked in the cone of each facet. In our experiments, we observe that increasing the number of rays beyond the default has little effect on the quality of the segmentation result
- * @param postprocess if `true`, `CGAL::sdf_values_postprocessing()` is called on raw SDF value computed.
- * @param traits traits class
- * @param ppmap point property map. An overload is provided with `get(boost::vertex_point,polyhedron)` as default.
- *
- * @return minimum and maximum raw SDF values if @a postprocess is `true`, otherwise minimum and maximum SDF values (before linear normalization)
- */
-template <class Polyhedron, class SDFPropertyMap, class PointPropertyMap
-#ifdef DOXYGEN_RUNNING
-         = typename boost::property_map<Polyhedron, boost::vertex_point_t>::type
-#endif
-, class GeomTraits
-#ifdef DOXYGEN_RUNNING
-=  typename Kernel_traits<typename boost::property_traits<PointPropertyMap>::value_type>::Kernel
-#endif
->
-std::pair<double, double>
-sdf_values( const Polyhedron& polyhedron,
-            SDFPropertyMap sdf_values_map,
-            double cone_angle = 2.0 / 3.0 * CGAL_PI,
-            std::size_t number_of_rays = 25,
-            bool postprocess = true,
-            PointPropertyMap ppmap = PointPropertyMap(),
-            GeomTraits traits = GeomTraits())
-{
-  return sdf_values<true, Polyhedron, SDFPropertyMap, PointPropertyMap, GeomTraits>
-         (polyhedron, sdf_values_map, cone_angle, number_of_rays, postprocess, ppmap, traits);
-}
-
-
-/*!
- * \ingroup PkgSurfaceSegmentation
- * @brief Function post-processing raw SDF values computed per facet.
- *
- * Post-processing steps applied :
- *   - Facets with -1 SDF values are assigned the average SDF value of their edge-adjacent neighbors.
- *     If there is still a facet having -1 SDF value, the minimum valid SDF value assigned to it. Note that this step is not inherited from the paper.
- *     The main reason for not assigning 0 to facets with no SDF values (i.e. -1) is that it can obstruct log-normalization process which takes place at the beginning of `CGAL::segmentation_from_sdf_values()`.
- *   - SDF values are smoothed with bilateral filtering.
- *   - SDF values are linearly normalized between [0,1].
- *
- * See the section \ref Surface_mesh_segmentationPostprocessing for more details.
- *
- * @pre @a polyhedron.is_pure_triangle()
- * @pre Raw values should be greater or equal to 0. -1 indicates when no value could be computed
- *
- * @tparam Polyhedron a model of `FaceListGraph`
- * @tparam SDFPropertyMap  a `ReadWritePropertyMap` with `boost::graph_traits<Polyhedron>::%face_descriptor` as key and `double` as value type
- *
- * @param polyhedron surface mesh on which SDF values are computed
- * @param[in, out] sdf_values_map the SDF value of each facet
- *
- * @return minimum and maximum SDF values before linear normalization
- */
-template<class Polyhedron, class SDFPropertyMap>
-std::pair<double, double>
-sdf_values_postprocessing(const Polyhedron& polyhedron,
-                          SDFPropertyMap sdf_values_map)
-{
-  CGAL_precondition(polyhedron.is_pure_triangle());
-  return internal::Postprocess_sdf_values<Polyhedron>().postprocess(polyhedron,
-         sdf_values_map);
-}
-
-
-/*!
- * \ingroup PkgSurfaceSegmentation
- * @brief Function computing the segmentation of a surface mesh given an SDF value per facet.
- *
- * This function fills a property map which associates a segment-id (in [0, number of segments -1])
- * or a cluster-id (in [0, `number_of_clusters` -1]) to each facet.
- * A segment is a set of connected facets which are placed under the same cluster (see \cgalFigureRef{Cluster_vs_segment}).
- *
- * \note Log-normalization is applied on `sdf_values_map` before segmentation.
- *       As described in the original paper \cgalCite{shapira2008consistent},
- *       this normalization is done to preserve thin parts of the mesh
- *       by increasing the distance between smaller SDF values and reducing
- *       it between larger ones.
- * \note There is no direct relation between the parameter `number_of_clusters`
- * and the final number of segments after segmentation. However, setting a large number of clusters will result in a detailed segmentation of the mesh with a large number of segments.
- *
- * @pre @a polyhedron.is_pure_triangle()
- * @pre @a number_of_clusters > 0
- *
- * @tparam Polyhedron a model of `FaceListGraph`
- * @tparam SDFPropertyMap  a `ReadablePropertyMap` with `boost::graph_traits<Polyhedron>::%face_descriptor` as key and `double` as value type
- * @tparam SegmentPropertyMap a `ReadWritePropertyMap` with `boost::graph_traits<Polyhedron>::%face_descriptor` as key and `std::size_t` as value type
- * @tparam GeomTraits a model of `SegmentationGeomTraits`
- * @tparam PointPropertyMap a `ReadablePropertyMap` with `boost::graph_traits<Polyhedron>::%vertex_descriptor` as key and `GeomTraits::Point_3` as value type.
- *
- * @param polyhedron surface mesh corresponding to the SDF values
- * @param sdf_values_map the SDF value of each facet between [0-1]
- * @param[out] segment_ids the segment or cluster id of each facet
- * @param number_of_clusters number of clusters for the soft clustering
- * @param smoothing_lambda factor which indicates the importance of the surface features for the energy minimization. It is recommended to choose a value in the interval [0,1]. See the section \ref Surface_mesh_segmentationGraphCut for more details.
- * @param output_cluster_ids if `false` fill `segment_ids` with segment-ids, and with cluster-ids otherwise (see \cgalFigureRef{Cluster_vs_segment})
- * @param traits traits class
- * @param ppmap point property map. An overload is provided with `get(boost::vertex_point,polyhedron)` as default.
- *
- * @return number of segments if `output_cluster_ids` is set to `false` and `number_of_clusters` otherwise
- */
-template <class Polyhedron, class SDFPropertyMap, class SegmentPropertyMap,
-          class PointPropertyMap
-#ifdef DOXYGEN_RUNNING
-         = typename boost::property_map<Polyhedron, boost::vertex_point_t>::type
-#endif
-         , class GeomTraits
-#ifdef DOXYGEN_RUNNING
-         = typename Kernel_traits<typename boost::property_traits<PointPropertyMap>::value_type>::Kernel
-#endif
-         >
-std::size_t
-segmentation_from_sdf_values( const Polyhedron& polyhedron,
-                              SDFPropertyMap sdf_values_map,
-                              SegmentPropertyMap segment_ids,
-                              std::size_t number_of_clusters = 5,
-                              double smoothing_lambda = 0.26,
-                              bool output_cluster_ids = false,
-                              PointPropertyMap ppmap=PointPropertyMap(),
-                              GeomTraits traits=GeomTraits())
-{
-  typedef typename boost::property_map<Polyhedron, boost::vertex_point_t>::type VPMap;
-  internal::Surface_mesh_segmentation<Polyhedron, GeomTraits, VPMap> algorithm(polyhedron, traits, ppmap);
-  return algorithm.partition(number_of_clusters, smoothing_lambda, sdf_values_map,
-                             segment_ids, !output_cluster_ids);
-}
-
-///\cond SKIP_IN_MANUAL
-template < bool Fast_sdf_calculation_mode, class Polyhedron,
-         class SegmentPropertyMap, class PointPropertyMap
-#ifdef DOXYGEN_RUNNING
-         = typename boost::property_map<Polyhedron, boost::vertex_point_t>::type
-#endif
-        , class GeomTraits
-#ifdef DOXYGEN_RUNNING
-         = typename Kernel_traits<typename boost::property_traits<PointPropertyMap>::value_type>::Kernel
-#endif
-        >
-std::size_t
-segmentation_via_sdf_values(const Polyhedron& polyhedron,
-                            SegmentPropertyMap segment_ids,
-                            double cone_angle = 2.0 / 3.0 * CGAL_PI,
-                            std::size_t number_of_rays = 25,
-                            std::size_t number_of_clusters = 5,
-                            double smoothing_lambda = 0.26,
-                            bool output_cluster_ids = false,
-                            PointPropertyMap ppmap=PointPropertyMap(),
-                            GeomTraits traits=GeomTraits() )
-{
-  typedef typename boost::graph_traits<Polyhedron>::face_descriptor face_descriptor;
-  typedef std::map<face_descriptor, double>
-  Facet_double_map;
-  Facet_double_map internal_sdf_map;
-  boost::associative_property_map<Facet_double_map> sdf_property_map(
-    internal_sdf_map);
-
-  sdf_values<Fast_sdf_calculation_mode, Polyhedron, boost::associative_property_map<Facet_double_map>, PointPropertyMap, GeomTraits>
-  (polyhedron, sdf_property_map, cone_angle, number_of_rays, true, ppmap, traits);
-  return segmentation_from_sdf_values<Polyhedron, boost::associative_property_map<Facet_double_map>, SegmentPropertyMap, PointPropertyMap, GeomTraits>
-         (polyhedron, sdf_property_map, segment_ids, number_of_clusters,
-          smoothing_lambda, output_cluster_ids, ppmap, traits);
-}
-/// \endcond
-
-
-/*!
- * \ingroup PkgSurfaceSegmentation
- * @brief Function computing the segmentation of a surface mesh.
- *
- * This function is equivalent to calling the functions `CGAL::sdf_values()` and
- * `CGAL::segmentation_from_sdf_values()` with the same parameters.
- *
- * \note There is no direct relation between the parameter `number_of_clusters`
- * and the final number of segments after segmentation. However, setting a large number of clusters will result in a detailed segmentation of the mesh with a large number of segments.
- * \note For computing segmentations of the mesh with different parameters (i.e. number of levels, and smoothing lambda),
- * it is more efficient to first compute the SDF values using `CGAL::sdf_values()` and use them in different calls to
- * `CGAL::segmentation_from_sdf_values()`.
- *
- * @pre @a polyhedron.is_pure_triangle()
- * @pre @a number_of_clusters > 0
- *
- * @tparam Polyhedron a model of `FaceListGraph`
- * @tparam SegmentPropertyMap a `ReadWritePropertyMap` with `boost::graph_traits<Polyhedron>::%face_descriptor` as key and `std::size_t` as value type
- * @tparam GeomTraits a model of `SegmentationGeomTraits`
- * @tparam PointPropertyMap a `ReadablePropertyMap` with `boost::graph_traits<Polyhedron>::%vertex_descriptor` as key and `GeomTraits::Point_3` as value type.
- *
- * @param polyhedron surface mesh on which SDF values are computed
- * @param[out] segment_ids the segment or cluster id of each facet
- * @param cone_angle opening angle in radians for the cone of each facet
- * @param number_of_rays number of rays picked in the cone of each facet. In our experiments, we observe that increasing the number of rays beyond the default has a little effect on the quality of the segmentation result
- * @param number_of_clusters number of clusters for the soft clustering
- * @param smoothing_lambda factor which indicates the importance of the surface features for the energy minimization. It is recommended to choose a value in the interval [0,1]. See the section \ref Surface_mesh_segmentationGraphCut for more details.
- * @param output_cluster_ids if `false` fill `segment_ids` with segment-ids, and with cluster-ids otherwise (see \cgalFigureRef{Cluster_vs_segment})
- * @param traits traits class
- * @param ppmap point property map. An overload is provided with `get(boost::vertex_point,polyhedron)` as default.
- *
- * @return number of segments if `output_cluster_ids` is set to `false` and `number_of_clusters` otherwise
- */
-template < class Polyhedron, class SegmentPropertyMap, class PointPropertyMap
-#ifdef DOXYGEN_RUNNING
-         = typename boost::property_map<Polyhedron, boost::vertex_point_t>::type
-#endif
-, class GeomTraits
-#ifdef DOXYGEN_RUNNING
-= typename Kernel_traits<typename boost::property_traits<PointPropertyMap>::value_type>::Kernel
-#endif
->
-std::size_t
-segmentation_via_sdf_values(const Polyhedron& polyhedron,
-                            SegmentPropertyMap segment_ids,
-                            double cone_angle = 2.0 / 3.0 * CGAL_PI,
-                            std::size_t number_of_rays = 25,
-                            std::size_t number_of_clusters = 5,
-                            double smoothing_lambda = 0.26,
-                            bool output_cluster_ids = false,
-                            PointPropertyMap ppmap=PointPropertyMap(),
-                            GeomTraits traits=GeomTraits())
-{
-  return segmentation_via_sdf_values<true, Polyhedron, SegmentPropertyMap, PointPropertyMap, GeomTraits>
-         (polyhedron, segment_ids, cone_angle, number_of_rays, number_of_clusters,
-          smoothing_lambda, output_cluster_ids, ppmap, traits);
-}
-
-#ifndef DOXYGEN_RUNNING
-// we need these overloads for the default of the point property map
-
-/// sdf_values ///
-template < bool Fast_sdf_calculation_mode, class Polyhedron, class SDFPropertyMap, class PointPropertyMap>
-std::pair<double, double>
-sdf_values( const Polyhedron& polyhedron,
-            SDFPropertyMap sdf_values_map,
-            double cone_angle = 2.0 / 3.0 * CGAL_PI,
-            std::size_t number_of_rays = 25,
-            bool postprocess = true,
-            PointPropertyMap ppmap = PointPropertyMap())
-{
-  typedef typename boost::property_traits<PointPropertyMap>::value_type Point_3;
-  typedef typename Kernel_traits<Point_3>::Kernel GeomTraits;
-  GeomTraits traits;
-  return sdf_values<Fast_sdf_calculation_mode, Polyhedron, SDFPropertyMap, PointPropertyMap, GeomTraits>
-         (polyhedron, sdf_values_map, cone_angle, number_of_rays, postprocess, ppmap, traits);
-}
-
-template < bool Fast_sdf_calculation_mode, class Polyhedron, class SDFPropertyMap>
-std::pair<double, double>
-sdf_values( const Polyhedron& polyhedron,
-            SDFPropertyMap sdf_values_map,
-            double cone_angle = 2.0 / 3.0 * CGAL_PI,
-            std::size_t number_of_rays = 25,
-            bool postprocess = true)
-{
-  typedef typename boost::property_map<Polyhedron, boost::vertex_point_t>::type PointPropertyMap;
-  PointPropertyMap ppmap = get(boost::vertex_point, const_cast<Polyhedron&>(polyhedron));
-  typedef typename boost::property_traits<PointPropertyMap>::value_type Point_3;
-  typedef typename Kernel_traits<Point_3>::Kernel GeomTraits;
-  GeomTraits traits;
-  return sdf_values<Fast_sdf_calculation_mode, Polyhedron, SDFPropertyMap, PointPropertyMap, GeomTraits>
-         (polyhedron, sdf_values_map, cone_angle, number_of_rays, postprocess, ppmap, traits);
-}
-
-template < class Polyhedron, class SDFPropertyMap, class PointPropertyMap>
-std::pair<double, double>
-sdf_values( const Polyhedron& polyhedron,
-            SDFPropertyMap sdf_values_map,
-            double cone_angle = 2.0 / 3.0 * CGAL_PI,
-            std::size_t number_of_rays = 25,
-            bool postprocess = true,
-            PointPropertyMap ppmap = PointPropertyMap())
-{
-  typedef typename boost::property_traits<PointPropertyMap>::value_type Point_3;
-  typedef typename Kernel_traits<Point_3>::Kernel GeomTraits;
-  GeomTraits traits;
-  return sdf_values<true, Polyhedron, SDFPropertyMap, PointPropertyMap, GeomTraits>
-         (polyhedron, sdf_values_map, cone_angle, number_of_rays, postprocess, ppmap, traits);
-}
-
-template < class Polyhedron, class SDFPropertyMap>
-std::pair<double, double>
-sdf_values( const Polyhedron& polyhedron,
-            SDFPropertyMap sdf_values_map,
-            double cone_angle = 2.0 / 3.0 * CGAL_PI,
-            std::size_t number_of_rays = 25,
-            bool postprocess = true)
-{
-  typedef typename boost::property_map<Polyhedron, boost::vertex_point_t>::type PointPropertyMap;
-  PointPropertyMap ppmap = get(boost::vertex_point, const_cast<Polyhedron&>(polyhedron));
-  typedef typename boost::property_traits<PointPropertyMap>::value_type Point_3;
-  typedef typename Kernel_traits<Point_3>::Kernel GeomTraits;
-  GeomTraits traits;
-  return sdf_values<true, Polyhedron, SDFPropertyMap, PointPropertyMap, GeomTraits>
-         (polyhedron, sdf_values_map, cone_angle, number_of_rays, postprocess, ppmap, traits);
-}
-
-/// segmentation_from_sdf_values ///
-template <class Polyhedron, class SDFPropertyMap, class SegmentPropertyMap, class PointPropertyMap>
-std::size_t
-segmentation_from_sdf_values(const Polyhedron& polyhedron,
-                             SDFPropertyMap sdf_values_map,
-                             SegmentPropertyMap segment_ids,
-                             std::size_t number_of_clusters = 5,
-                             double smoothing_lambda = 0.26,
-                             bool output_cluster_ids = false,
-                             PointPropertyMap ppmap = PointPropertyMap() )
-{
-  typedef typename boost::property_traits<PointPropertyMap>::value_type Point_3;
-  typedef typename Kernel_traits<Point_3>::Kernel GeomTraits;
-  GeomTraits traits;
-  return segmentation_from_sdf_values<Polyhedron, SDFPropertyMap, SegmentPropertyMap, PointPropertyMap, GeomTraits>
-         (polyhedron, sdf_values_map, segment_ids, number_of_clusters, smoothing_lambda,
-          output_cluster_ids, ppmap, traits);
-}
-
-template <class Polyhedron, class SDFPropertyMap, class SegmentPropertyMap>
-std::size_t
-segmentation_from_sdf_values(const Polyhedron& polyhedron,
-                             SDFPropertyMap sdf_values_map,
-                             SegmentPropertyMap segment_ids,
-                             std::size_t number_of_clusters = 5,
-                             double smoothing_lambda = 0.26,
-                             bool output_cluster_ids = false)
-{
-  typedef typename boost::property_map<Polyhedron, boost::vertex_point_t>::type PointPropertyMap;
-  PointPropertyMap ppmap = get(boost::vertex_point, const_cast<Polyhedron&>(polyhedron));
-  typedef typename boost::property_traits<PointPropertyMap>::value_type Point_3;
-  typedef typename Kernel_traits<Point_3>::Kernel GeomTraits;
-  GeomTraits traits;
-  return segmentation_from_sdf_values<Polyhedron, SDFPropertyMap, SegmentPropertyMap, PointPropertyMap, GeomTraits>
-         (polyhedron, sdf_values_map, segment_ids, number_of_clusters, smoothing_lambda,
-          output_cluster_ids, ppmap, traits);
-}
-
-/// segmentation_via_sdf_values ///
-template <bool Fast_sdf_calculation_mode, class Polyhedron, class SegmentPropertyMap, class PointPropertyMap>
-std::size_t
-segmentation_via_sdf_values(const Polyhedron& polyhedron,
-                            SegmentPropertyMap segment_ids,
-                            double cone_angle = 2.0 / 3.0 * CGAL_PI,
-                            std::size_t number_of_rays = 25,
-                            std::size_t number_of_clusters = 5,
-                            double smoothing_lambda = 0.26,
-                            bool output_cluster_ids = false,
-                            PointPropertyMap ppmap = PointPropertyMap() )
-{
-  typedef typename boost::property_traits<PointPropertyMap>::value_type Point_3;
-  typedef typename Kernel_traits<Point_3>::Kernel GeomTraits;
-  GeomTraits traits;
-  return segmentation_via_sdf_values<Fast_sdf_calculation_mode, Polyhedron, SegmentPropertyMap, PointPropertyMap, GeomTraits>
-         (polyhedron, segment_ids, cone_angle, number_of_rays, number_of_clusters,
-          smoothing_lambda, output_cluster_ids, ppmap, traits);
-}
-
-template <bool Fast_sdf_calculation_mode, class Polyhedron, class SegmentPropertyMap>
-std::size_t
-segmentation_via_sdf_values(const Polyhedron& polyhedron,
-                            SegmentPropertyMap segment_ids,
-                            double cone_angle = 2.0 / 3.0 * CGAL_PI,
-                            std::size_t number_of_rays = 25,
-                            std::size_t number_of_clusters = 5,
-                            double smoothing_lambda = 0.26,
-                            bool output_cluster_ids = false)
-{
-  typedef typename boost::property_map<Polyhedron, boost::vertex_point_t>::type PointPropertyMap;
-  PointPropertyMap ppmap = get(boost::vertex_point, const_cast<Polyhedron&>(polyhedron));
-  typedef typename boost::property_traits<PointPropertyMap>::value_type Point_3;
-  typedef typename Kernel_traits<Point_3>::Kernel GeomTraits;
-  GeomTraits traits;
-  return segmentation_via_sdf_values<Fast_sdf_calculation_mode, Polyhedron, SegmentPropertyMap, PointPropertyMap, GeomTraits>
-         (polyhedron, segment_ids, cone_angle, number_of_rays, number_of_clusters,
-          smoothing_lambda, output_cluster_ids, ppmap, traits);
-}
-
-template <class Polyhedron, class SegmentPropertyMap, class PointPropertyMap>
-std::size_t
-segmentation_via_sdf_values(const Polyhedron& polyhedron,
-                            SegmentPropertyMap segment_ids,
-                            double cone_angle = 2.0 / 3.0 * CGAL_PI,
-                            std::size_t number_of_rays = 25,
-                            std::size_t number_of_clusters = 5,
-                            double smoothing_lambda = 0.26,
-                            bool output_cluster_ids = false,
-                            PointPropertyMap ppmap = PointPropertyMap() )
-{
-  typedef typename boost::property_traits<PointPropertyMap>::value_type Point_3;
-  typedef typename Kernel_traits<Point_3>::Kernel GeomTraits;
-  GeomTraits traits;
-  return segmentation_via_sdf_values<true, Polyhedron, SegmentPropertyMap, PointPropertyMap, GeomTraits>
-         (polyhedron, segment_ids, cone_angle, number_of_rays, number_of_clusters,
-          smoothing_lambda, output_cluster_ids, ppmap, traits);
-}
-
-template <class Polyhedron, class SegmentPropertyMap>
-std::size_t
-segmentation_via_sdf_values(const Polyhedron& polyhedron,
-                            SegmentPropertyMap segment_ids,
-                            double cone_angle = 2.0 / 3.0 * CGAL_PI,
-                            std::size_t number_of_rays = 25,
-                            std::size_t number_of_clusters = 5,
-                            double smoothing_lambda = 0.26,
-                            bool output_cluster_ids = false)
-{
-  typedef typename boost::property_map<Polyhedron, boost::vertex_point_t>::type PointPropertyMap;
-  PointPropertyMap ppmap = get(boost::vertex_point, const_cast<Polyhedron&>(polyhedron));
-  typedef typename boost::property_traits<PointPropertyMap>::value_type Point_3;
-  typedef typename Kernel_traits<Point_3>::Kernel GeomTraits;
-  GeomTraits traits;
-  return segmentation_via_sdf_values<true, Polyhedron, SegmentPropertyMap, PointPropertyMap, GeomTraits>
-         (polyhedron, segment_ids, cone_angle, number_of_rays, number_of_clusters,
-          smoothing_lambda, output_cluster_ids, ppmap, traits);
-}
-#endif
-
-
-}//namespace CGAL
-
-#endif // CGAL_SURFACE_MESH_SEGMENTATION_MESH_SEGMENTATION_H //
diff --git a/3rdparty/CGAL-4.8/include/CGAL/minkowski_sum_2.h b/3rdparty/CGAL-4.8/include/CGAL/minkowski_sum_2.h
deleted file mode 100644
index 5e46415..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/minkowski_sum_2.h
+++ /dev/null
@@ -1,478 +0,0 @@
-// Copyright (c) 2006  Tel-Aviv University (Israel).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org).
-// You can redistribute it and/or modify it under the terms of the GNU
-// 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.
-//
-// Author(s) : Ron Wein   <wein_r at yahoo.com>
-//             Efi Fogel  <efifogel at gmail.com>
-
-#ifndef CGAL_MINKOWSKI_SUM_2_H
-#define CGAL_MINKOWSKI_SUM_2_H
-
-#include <CGAL/basic.h>
-#include <CGAL/Polygon_with_holes_2.h>
-
-#include <CGAL/Minkowski_sum_2/Hole_filter_2.h>
-#include <CGAL/Minkowski_sum_2/Minkowski_sum_by_reduced_convolution_2.h>
-#include <CGAL/Minkowski_sum_2/Minkowski_sum_conv_2.h>
-#include <CGAL/Minkowski_sum_2/Minkowski_sum_decomp_2.h>
-#include <list>
-
-namespace CGAL {
-
-/*!
- * Computes the Minkowski sum \f$ P \oplus Q\f$ of two given polygons.
- * The function computes the reduced convolution of the two polygons and
- * extracts those loops of the convolution which are part of the Minkowsi
- * sum. This method works very efficiently, regardless of whether `P` and
- * `Q` are convex or non-convex.
- * Note that as the input polygons may not be convex, their Minkowski
- * sum may not be a simple polygon. The result is therefore represented
- * as a polygon with holes.
- * \param[in] pgn1 The first polygon.
- * \param[in] pgn2 The second polygon.
- * \pre Both `P` and `Q` are simple, counterclockwise-oriented polygons.
- */
-template <typename Kernel_, typename Container_>
-Polygon_with_holes_2<Kernel_, Container_>
-minkowski_sum_by_reduced_convolution_2(const Polygon_2<Kernel_,
-                                       Container_>& pgn1,
-                                       const Polygon_2<Kernel_,
-                                       Container_>& pgn2)
-{
-  typedef Kernel_                                    Kernel;
-  typedef Container_                                 Container;
-
-  Minkowski_sum_by_reduced_convolution_2<Kernel, Container> mink_sum;
-  Polygon_2<Kernel, Container>                              sum_bound;
-  std::list<Polygon_2<Kernel, Container> >                  sum_holes;
-
-  if (pgn1.size() > pgn2.size())
-    mink_sum(pgn1, pgn2, sum_bound, std::back_inserter(sum_holes));
-  else mink_sum(pgn2, pgn1, sum_bound, std::back_inserter(sum_holes));
-
-  return (Polygon_with_holes_2<Kernel,Container>(sum_bound,
-                                                 sum_holes.begin(),
-                                                 sum_holes.end()));
-}
-
-/*!
- * Computes the Minkowski sum \f$ P \oplus Q\f$ of two given polygons with
- * holes.
- * The function computes the reduced convolution of the two polygons and
- * extracts those loops of the convolution which are part of the Minkowsi
- * sum. This method works very efficiently, regardless of whether `P` and
- * `Q` are convex or non-convex.
- * The result is also represented as a polygon with holes.
- * \param[in] pgn1 The first polygon.
- * \param[in] pgn2 The second polygon.
- */
-template <typename Kernel_, typename Container_>
-Polygon_with_holes_2<Kernel_, Container_>
-minkowski_sum_by_reduced_convolution_2
-(const Polygon_with_holes_2<Kernel_, Container_>& pgn1,
- const Polygon_with_holes_2<Kernel_, Container_>& pgn2)
-{
-  typedef Kernel_                                    Kernel;
-  typedef Container_                                 Container;
-
-  Hole_filter_2<Kernel, Container> hole_filter;
-
-  Polygon_with_holes_2<Kernel, Container> filtered_pgn1;
-  Polygon_with_holes_2<Kernel, Container> filtered_pgn2;
-
-  hole_filter(pgn1, pgn2, filtered_pgn1);
-  hole_filter(pgn2, pgn1, filtered_pgn2);
-
-  Minkowski_sum_by_reduced_convolution_2<Kernel, Container> mink_sum;
-  Polygon_2<Kernel, Container>                              sum_bound;
-  std::list<Polygon_2<Kernel, Container> >                  sum_holes;
-
-  mink_sum(filtered_pgn1, filtered_pgn2, sum_bound,
-           std::back_inserter(sum_holes));
-
-  return (Polygon_with_holes_2<Kernel,Container>(sum_bound,
-                                                 sum_holes.begin(),
-                                                 sum_holes.end()));
-}
-
-/*!
- * Computes the Minkowski sum \f$ P \oplus Q\f$ of a simple polygon and a
- * polygon with holes.
- * The function computes the reduced convolution of the two polygons and
- * extracts those loops of the convolution which are part of the Minkowsi
- * sum. This method works very efficiently, regardless of whether `P` and
- * `Q` are convex or non-convex.
- * The result is also represented as a polygon with holes.
- * \param[in] pgn1 The simple polygon.
- * \param[in] pgn2 The polygon with holes.
- */
-template <typename Kernel_, typename Container_>
-Polygon_with_holes_2<Kernel_, Container_>
-minkowski_sum_by_reduced_convolution_2
-(const Polygon_2<Kernel_, Container_>& pgn1,
- const Polygon_with_holes_2<Kernel_, Container_>& pgn2)
-{
-  typedef Kernel_                                    Kernel;
-  typedef Container_                                 Container;
-
-  Hole_filter_2<Kernel, Container> hole_filter;
-  Polygon_with_holes_2<Kernel, Container> filtered_pgn2;
-  hole_filter(pgn2, pgn1, filtered_pgn2);
-  Minkowski_sum_by_reduced_convolution_2<Kernel, Container> mink_sum;
-  Polygon_2<Kernel, Container>                              sum_bound;
-  std::list<Polygon_2<Kernel, Container> >                  sum_holes;
-  mink_sum(pgn1, filtered_pgn2, sum_bound, std::back_inserter(sum_holes));
-  return (Polygon_with_holes_2<Kernel,Container>(sum_bound,
-                                                 sum_holes.begin(),
-                                                 sum_holes.end()));
-}
-
-/*!
- * Computes the Minkowski sum \f$ P \oplus Q\f$ of a simple polygon and a
- * polygon with holes.
- * The function computes the reduced convolution of the two polygons and
- * extracts those loops of the convolution which are part of the Minkowsi
- * sum. This method works very efficiently, regardless of whether `P` and
- * `Q` are convex or non-convex.
- * The result is also represented as a polygon with holes.
- * \param[in] pgn1 The polygon with holes.
- * \param[in] pgn2 The simple polygon.
- */
-template <typename Kernel_, typename Container_>
-Polygon_with_holes_2<Kernel_, Container_>
-minkowski_sum_by_reduced_convolution_2
-(const Polygon_with_holes_2<Kernel_, Container_>& pgn1,
- const Polygon_2<Kernel_, Container_>& pgn2)
-{ return minkowski_sum_by_reduced_convolution_2(pgn2, pgn1); }
-
-/*!
- * Compute the Minkowski sum of two simple polygons using the (full)
- * convolution method.
- * Note that as the input polygons may not be convex, their Minkowski sum may
- * not be a simple polygon. The result is therefore represented as a polygon
- * with holes.
- * \param[in] pgn1 The first polygon.
- * \param[in] pgn2 The second polygon.
- * \return The resulting polygon with holes, representing the sum.
- */
-template <typename Kernel_, typename Container_>
-Polygon_with_holes_2<Kernel_, Container_>
-minkowski_sum_by_full_convolution_2(const Polygon_2<Kernel_, Container_>& pgn1,
-                                    const Polygon_2<Kernel_, Container_>& pgn2)
-{
-  typedef Kernel_                                    Kernel;
-  typedef Container_                                 Container;
-
-  Minkowski_sum_by_convolution_2<Kernel, Container> mink_sum;
-  Polygon_2<Kernel, Container>                      sum_bound;
-  std::list<Polygon_2<Kernel, Container> >          sum_holes;
-
-  if (pgn1.size() > pgn2.size())
-    mink_sum(pgn1, pgn2, sum_bound, std::back_inserter(sum_holes));
-  else mink_sum(pgn2, pgn1, sum_bound, std::back_inserter(sum_holes));
-  return (Polygon_with_holes_2<Kernel, Container>(sum_bound,
-                                                  sum_holes.begin(),
-                                                  sum_holes.end()));
-}
-
-/*!
- * Compute the Minkowski sum of two simple polygons using the convolution
- * method. This function defaults to calling the reduced convolution method,
- * as it is more efficient in most cases.
- * Note that as the input polygons may not be convex, their Minkowski sum may
- * not be a simple polygon. The result is therefore represented as a polygon
- * with holes.
- * \param[in] pgn1 The first polygon.
- * \param[in] pgn2 The second polygon.
- * \return The resulting polygon with holes, representing the sum.
- *
- * \sa `CGAL::minkowski_sum_by_reduced_convolution_2()`
- * \sa `CGAL::minkowski_sum_by_full_convolution_2()`
- */
-template <typename Kernel_, typename Container_>
-Polygon_with_holes_2<Kernel_, Container_>
-minkowski_sum_2(const Polygon_2<Kernel_, Container_>& pgn1,
-                const Polygon_2<Kernel_, Container_>& pgn2)
-{ return minkowski_sum_by_reduced_convolution_2(pgn1, pgn2); }
-
-/*!
- * Compute the Minkowski sum of two polygons with holes using the convolution
- * method. This function defaults to calling the reduced convolution method,
- * as it is more efficient in most cases.
- * Note that the result may not be a simple polygon. The result is therefore
- * represented as a polygon with holes.
- * \param[in] pgn1 The first polygon with holes.
- * \param[in] pgn2 The second polygon with holes.
- * \return The resulting polygon with holes, representing the sum.
- *
- * \sa `CGAL::minkowski_sum_by_reduced_convolution_2()`
- * \sa `CGAL::minkowski_sum_by_full_convolution_2()`
- */
-template <typename Kernel_, typename Container_>
-Polygon_with_holes_2<Kernel_, Container_>
-minkowski_sum_2(const Polygon_with_holes_2<Kernel_, Container_>& pgn1,
-                const Polygon_with_holes_2<Kernel_, Container_>& pgn2)
-{ return minkowski_sum_by_reduced_convolution_2(pgn1, pgn2); }
-
-/*!
- * Compute the Minkowski sum of a simple polygon and a polygon with holes
- * using the convolution method. This function defaults to calling the reduced
- * convolution method, as it is more efficient in most cases.
- * Note that the result may not be a simple polygon. The result is therefore
- * represented as a polygon with holes.
- * \param[in] pgn1 The simple polygon.
- * \param[in] pgn2 The polygon with holes.
- * \return The resulting polygon with holes, representing the sum.
- *
- * \sa `CGAL::minkowski_sum_by_reduced_convolution_2()`
- * \sa `CGAL::minkowski_sum_by_full_convolution_2()`
- */
-template <typename Kernel_, typename Container_>
-Polygon_with_holes_2<Kernel_, Container_>
-minkowski_sum_2(const Polygon_2<Kernel_, Container_>& pgn1,
-                const Polygon_with_holes_2<Kernel_, Container_>& pgn2)
-{ return minkowski_sum_by_reduced_convolution_2(pgn1, pgn2); }
-
-  /*!
- * Compute the Minkowski sum of a simple polygon and a polygon with holes
- * using the convolution method. This function defaults to calling the reduced
- * convolution method, as it is more efficient in most cases.
- * Note that the result may not be a simple polygon. The result is therefore
- * represented as a polygon with holes.
- * \param[in] pgn1 The polygon with holes.
- * \param[in] pgn2 The simple polygon.
- * \return The resulting polygon with holes, representing the sum.
- *
- * \sa `CGAL::minkowski_sum_by_reduced_convolution_2()`
- * \sa `CGAL::minkowski_sum_by_full_convolution_2()`
- */
-template <typename Kernel_, typename Container_>
-Polygon_with_holes_2<Kernel_, Container_>
-minkowski_sum_2(const Polygon_with_holes_2<Kernel_, Container_>& pgn1,
-                const Polygon_2<Kernel_, Container_>& pgn2)
-{ return minkowski_sum_by_reduced_convolution_2(pgn1, pgn2); }
-
-/*!
- * Compute the Minkowski sum of two simple polygons by decomposing each
- * polygon to convex sub-polygons and computing the union of the pairwise
- * Minkowski sums of the sub-polygons.
- * Note that as the input polygons may not be convex, their Minkowski sum may
- * not be a simple polygon. The result is therefore represented as a polygon
- * with holes.
- * \param[in] pgn1 The first polygon.
- * \param[in] pgn2 The second polygon.
- * \param[in] decomposition_strategy A functor for decomposing polygons.
- * \return The resulting polygon with holes, representing the sum.
- */
-template <typename Kernel_, typename Container_,
-          typename DecompositionStrategy_>
-Polygon_with_holes_2<Kernel_, Container_>
-minkowski_sum_2(const Polygon_2<Kernel_, Container_>& pgn1,
-                const Polygon_2<Kernel_, Container_>& pgn2,
-                const DecompositionStrategy_& decomposition_strategy)
-{
-  typename Minkowski_sum_by_decomposition_2<DecompositionStrategy_,
-                                            Container_>::Traits_2 traits;
-  return minkowski_sum_2(pgn1, pgn2, decomposition_strategy, traits);
-}
-
-/*!
- * Compute the Minkowski sum of two simple polygons by decomposing each
- * polygon to convex sub-polygons and computing the union of the pairwise
- * Minkowski sums of the sub-polygons.
- * Note that as the input polygons may not be convex, their Minkowski sum may
- * not be a simple polygon. The result is therefore represented as a polygon
- * with holes.
- * \param[in] pgn1 The first polygon.
- * \param[in] pgn2 The second polygon.
- * \param[in] decomposition_strategy A functor for decomposing polygons.
- * \param[in] traits The traits.
- * \return The resulting polygon with holes, representing the sum.
- */
-template <typename Kernel_, typename Container_,
-          typename DecompositionStrategy_>
-Polygon_with_holes_2<Kernel_, Container_>
-minkowski_sum_2(const Polygon_2<Kernel_, Container_>& pgn1,
-                const Polygon_2<Kernel_, Container_>& pgn2,
-                const DecompositionStrategy_& decomposition_strategy,
-                const typename
-                Minkowski_sum_by_decomposition_2<DecompositionStrategy_,
-                                                 Container_>::Traits_2& traits)
-{
-  typedef Container_                            Container;
-  typedef DecompositionStrategy_                Decomposition_strategy;
-
-  Minkowski_sum_by_decomposition_2<Decomposition_strategy, Container>
-    mink_sum(decomposition_strategy, traits);
-  return mink_sum(pgn1, pgn2);
-}
-
-/*!
- * Compute the Minkowski sum of two polygon with holes by decomposing each
- * polygon to convex sub-polygons and computing the union of the pairwise
- * Minkowski sums of the sub-polygons.
- * The result is also represented as a polygon with holes.
- * \param[in] pgn1 The first polygon.
- * \param[in] pgn2 The second polygon.
- * \param[in] decomposition_strategy A functor for decomposing polygons.
- * \return The resulting polygon with holes, representing the sum.
- */
-template <typename Kernel_, typename Container_,
-          typename DecompositionStrategy_>
-Polygon_with_holes_2<Kernel_, Container_>
-minkowski_sum_2(const Polygon_with_holes_2<Kernel_, Container_>& pgn1,
-                const Polygon_with_holes_2<Kernel_, Container_>& pgn2,
-                const DecompositionStrategy_& decomposition_strategy)
-{
-  typename Minkowski_sum_by_decomposition_2<DecompositionStrategy_,
-                                            Container_>::Traits_2 traits;
-  return minkowski_sum_2(pgn1, pgn2, decomposition_strategy, traits);
-}
-
-/*!
- * Compute the Minkowski sum of two polygon with holes by decomposing each
- * polygon to convex sub-polygons and computing the union of the pairwise
- * Minkowski sums of the sub-polygons.
- * The result is also represented as a polygon with holes.
- * \param[in] pgn1 The first polygon.
- * \param[in] pgn2 The second polygon.
- * \param[in] decomposition_strategy A functor for decomposing polygons.
- * \param[in] traits The traits.
- * \return The resulting polygon with holes, representing the sum.
- */
-template <typename Kernel_, typename Container_,
-          typename DecompositionStrategy_>
-Polygon_with_holes_2<Kernel_, Container_>
-minkowski_sum_2(const Polygon_with_holes_2<Kernel_, Container_>& pgn1,
-                const Polygon_with_holes_2<Kernel_, Container_>& pgn2,
-                const DecompositionStrategy_& decomposition_strategy,
-                const typename
-                Minkowski_sum_by_decomposition_2<DecompositionStrategy_,
-                                                 Container_>::Traits_2& traits)
-{
-  typedef Kernel_                               Kernel;
-  typedef Container_                            Container;
-  typedef DecompositionStrategy_                Decomposition_strategy;
-
-  Minkowski_sum_by_decomposition_2<Decomposition_strategy, Container>
-    mink_sum(decomposition_strategy, traits);
-  Hole_filter_2<Kernel, Container> hole_filter;
-  Polygon_with_holes_2<Kernel,Container> filtered_pgn1;
-  Polygon_with_holes_2<Kernel,Container> filtered_pgn2;
-  hole_filter(pgn1, pgn2, filtered_pgn1);
-  hole_filter(pgn2, pgn1, filtered_pgn2);
-  return mink_sum(filtered_pgn1, filtered_pgn2);
-}
-
-/*!
- * Compute the Minkowski sum of a simple polygon and a polygon with holes
- * by decomposing each polygon to convex sub-polygons and computing the union
- * of the pairwise Minkowski sums of the sub-polygons.  The result is also
- * represented as a polygon with holes.
- * \param[in] pgn1 The first polygon.
- * \param[in] pgn2 The second polygon.
- * \param[in] decomposition_strategy A functor for decomposing polygons.
- * \return The resulting polygon with holes, representing the sum.
- */
-template <typename Kernel_, typename Container_,
-          typename DecompositionStrategy_>
-Polygon_with_holes_2<Kernel_, Container_>
-minkowski_sum_2(const Polygon_2<Kernel_, Container_>& pgn1,
-                const Polygon_with_holes_2<Kernel_, Container_>& pgn2,
-                const DecompositionStrategy_& decomposition_strategy)
-{
-  typename Minkowski_sum_by_decomposition_2<DecompositionStrategy_,
-                                            Container_>::Traits_2 traits;
-  return minkowski_sum_2(pgn1, pgn2, decomposition_strategy, traits);
-}
-
-/*!
- * Compute the Minkowski sum of a simple polygon and a polygon with holes
- * by decomposing each polygon to convex sub-polygons and computing the union
- * of the pairwise Minkowski sums of the sub-polygons.  The result is also
- * represented as a polygon with holes.
- * \param[in] pgn1 The simple polygon.
- * \param[in] pgn2 The polygon with holes.
- * \param[in] decomposition_strategy A functor for decomposing polygons.
- * \param[in] traits The traits.
- * \return The resulting polygon with holes, representing the sum.
- */
-template <typename Kernel_, typename Container_,
-          typename DecompositionStrategy_>
-Polygon_with_holes_2<Kernel_, Container_>
-minkowski_sum_2(const Polygon_2<Kernel_, Container_>& pgn1,
-                const Polygon_with_holes_2<Kernel_, Container_>& pgn2,
-                const DecompositionStrategy_& decomposition_strategy,
-                const typename
-                Minkowski_sum_by_decomposition_2<DecompositionStrategy_,
-                                                 Container_>::Traits_2& traits)
-{
-  typedef Kernel_                               Kernel;
-  typedef Container_                            Container;
-  typedef DecompositionStrategy_                Decomposition_strategy;
-
-  Minkowski_sum_by_decomposition_2<Decomposition_strategy, Container>
-    mink_sum(decomposition_strategy, traits);
-  Hole_filter_2<Kernel, Container> hole_filter;
-  Polygon_with_holes_2<Kernel,Container> filtered_pgn2;
-  hole_filter(pgn2, pgn1, filtered_pgn2);
-  return mink_sum(pgn1, filtered_pgn2);
-}
-
-/*!
- * Compute the Minkowski sum of a simple polygon and a polygon with holes
- * by decomposing each polygon to convex sub-polygons and computing the union
- * of the pairwise Minkowski sums of the sub-polygons.  The result is also
- * represented as a polygon with holes.
- * \param[in] pgn1 The second polygon.
- * \param[in] pgn2 The first polygon.
- * \param[in] decomposition_strategy A functor for decomposing polygons.
- * \return The resulting polygon with holes, representing the sum.
- */
-template <typename Kernel_, typename Container_,
-          typename DecompositionStrategy_>
-Polygon_with_holes_2<Kernel_, Container_>
-minkowski_sum_2(const Polygon_with_holes_2<Kernel_, Container_>& pgn1,
-                const Polygon_2<Kernel_, Container_>& pgn2,
-                const DecompositionStrategy_& decomposition_strategy)
-{
-  typename Minkowski_sum_by_decomposition_2<DecompositionStrategy_,
-                                            Container_>::Traits_2 traits;
-  return minkowski_sum_2(pgn1, pgn2, decomposition_strategy, traits);
-}
-
-/*!
- * Compute the Minkowski sum of a simple polygon and a polygon with holes
- * by decomposing each polygon to convex sub-polygons and computing the union
- * of the pairwise Minkowski sums of the sub-polygons.  The result is also
- * represented as a polygon with holes.
- * \param[in] pgn1 The polygon with holes.
- * \param[in] pgn2 The simple polygon.
- * \param[in] decomposition_strategy A functor for decomposing polygons.
- * \param[in] traits The traits.
- * \return The resulting polygon with holes, representing the sum.
- */
-template <typename Kernel_, typename Container_,
-          typename DecompositionStrategy_>
-Polygon_with_holes_2<Kernel_, Container_>
-minkowski_sum_2(const Polygon_with_holes_2<Kernel_, Container_>& pgn1,
-                const Polygon_2<Kernel_, Container_>& pgn2,
-                const DecompositionStrategy_& decomposition_strategy,
-                const typename
-                Minkowski_sum_by_decomposition_2<DecompositionStrategy_,
-                                                 Container_>::Traits_2& traits)
-{ return minkowski_sum_2(pgn2, pgn1, decomposition_strategy, traits); }
-
-} //namespace CGAL
-
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/mst_orient_normals.h b/3rdparty/CGAL-4.8/include/CGAL/mst_orient_normals.h
deleted file mode 100644
index cf2734f..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/mst_orient_normals.h
+++ /dev/null
@@ -1,716 +0,0 @@
-// Copyright (c) 2007-09  INRIA Sophia-Antipolis (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
-// 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(s) : Laurent Saboret and Andreas Fabri
-
-#ifndef CGAL_MST_ORIENT_NORMALS_H
-#define CGAL_MST_ORIENT_NORMALS_H
-
-#include <CGAL/trace.h>
-#include <CGAL/Search_traits_3.h>
-#include <CGAL/Orthogonal_k_neighbor_search.h>
-#include <CGAL/Search_traits_vertex_handle_3.h>
-#include <CGAL/property_map.h>
-#include <CGAL/Index_property_map.h>
-#include <CGAL/Memory_sizer.h>
-#include <CGAL/point_set_processing_assertions.h>
-#include <CGAL/use.h>
-
-#include <iterator>
-#include <list>
-#include <climits>
-#include <math.h>
-
-#include <CGAL/property_map.h>
-#include <boost/graph/adjacency_list.hpp>
-#include <CGAL/boost/graph/dijkstra_shortest_paths.h> // work around a bug in boost 1.54
-#include <boost/graph/prim_minimum_spanning_tree.hpp>
-
-namespace CGAL {
-
-
-// ----------------------------------------------------------------------------
-// Private section
-// ----------------------------------------------------------------------------
-/// \cond SKIP_IN_MANUAL
-namespace internal {
-
-/// Generalization of std::distance() to compute the distance between 2 integers
-inline std::size_t
-distance(std::size_t _First, std::size_t _Last)
-{
-  // return int difference
-  return _Last - _First;
-}
-
-// Bring std::distance() to scope
-using std::distance;
-
-
-/// Helper class: Riemannian graph.
-///
-/// This class is used internally by mst_orient_normals()
-/// to encode:
-/// - the adjacency relations of vertices in a K-neighboring.
-/// - vertices contain the corresponding input point iterator.
-/// - the edge weight = edge weight = 1 - | normal1 * normal2 |
-///   where normal1 and normal2 are the normal at the edge extremities.
-
-template <typename ForwardIterator> ///< Input point iterator
-struct Riemannian_graph_vertex_properties {
-    ForwardIterator input_point; ///< Input point
-};
-template <typename ForwardIterator> ///< Input point iterator
-class Riemannian_graph
-  : public boost::adjacency_list< boost::vecS, boost::vecS,
-                                  boost::undirectedS,
-                                  Riemannian_graph_vertex_properties<ForwardIterator>,
-                                  boost::property<boost::edge_weight_t, float> >
-{
-};
-
-
-/// Helper class: MST graph
-///
-/// This class is used internally by mst_orient_normals()
-/// to encode:
-/// - the adjacency relations of vertices in a Minimum Spanning Tree.
-/// - vertices contain the corresponding input point iterator
-//    and a boolean indicating if the normal is oriented.
-
-template <typename ForwardIterator> ///< Input point iterator
-struct MST_graph_vertex_properties {
-    ForwardIterator input_point; ///< Input point
-    bool is_oriented; ///< Is input point's normal oriented?
-};
-template <typename ForwardIterator, ///< Input point iterator
-          typename NormalPMap, ///< property map: value_type of ForwardIterator -> Normal
-          typename Kernel ///< Geometric traits class
->
-class MST_graph
-  : public boost::adjacency_list< boost::vecS, boost::vecS,
-                                  boost::directedS,
-                                  MST_graph_vertex_properties<ForwardIterator> >
-{
-public:
-    MST_graph(NormalPMap normal_pmap) : m_normal_pmap(normal_pmap) {}
-
-// Public data
-    const NormalPMap m_normal_pmap;
-};
-
-
-/// Helper class: Propagate_normal_orientation
-///
-/// This class is used internally by mst_orient_normals()
-/// to propage the normal orientation, starting from a source point
-/// and following the adjacency relations of vertices in a Minimum Spanning Tree.
-/// It does not orient normals that are already oriented.
-/// It does not propagate the orientation if the angle between 2 normals > angle_max.
-///
-/// \pre Normals must be unit vectors
-/// \pre `0 < angle_max <= PI/2`
-///
-/// @tparam ForwardIterator iterator over input points.
-/// @tparam NormalPMap is a model of `ReadWritePropertyMap`.
-/// @tparam Kernel Geometric traits class.
-
-template <typename ForwardIterator, ///< Input point iterator
-          typename NormalPMap, ///< property map: value_type of ForwardIterator -> Normal
-          typename Kernel
->
-struct Propagate_normal_orientation
-  : public boost::base_visitor< Propagate_normal_orientation<ForwardIterator, NormalPMap, Kernel> >
-{
-    typedef internal::MST_graph<ForwardIterator, NormalPMap, Kernel> MST_graph;
-    typedef boost::on_examine_edge event_filter;
-
-    Propagate_normal_orientation(double angle_max = CGAL_PI/2.) ///< max angle to propagate the normal orientation (radians)
-    : m_angle_max(angle_max)
-    {
-        // Precondition: 0 < angle_max <= PI/2
-        CGAL_point_set_processing_precondition(0 < angle_max && angle_max <= CGAL_PI/2.);
-    }
-
-    template <class Edge>
-    void operator()(Edge& edge, const MST_graph& mst_graph)
-    {
-        typedef typename boost::property_traits<NormalPMap>::value_type Vector;
-        typedef typename MST_graph::vertex_descriptor vertex_descriptor;
-
-        // Gets source normal
-        vertex_descriptor source_vertex = source(edge, mst_graph);
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-        const Vector source_normal = get(mst_graph.m_normal_pmap, mst_graph[source_vertex].input_point);
-#else
-        const Vector source_normal = get(mst_graph.m_normal_pmap, *(mst_graph[source_vertex].input_point) );
-#endif
-        const bool source_normal_is_oriented = mst_graph[source_vertex].is_oriented;
-        // Gets target normal
-        vertex_descriptor target_vertex = target(edge, mst_graph);
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-        const Vector& target_normal = get( mst_graph.m_normal_pmap, mst_graph[target_vertex].input_point);
-#else
-        const Vector& target_normal = get( mst_graph.m_normal_pmap, *(mst_graph[target_vertex].input_point) );
-#endif
-        bool& target_normal_is_oriented = ((MST_graph&)mst_graph)[target_vertex].is_oriented;
-        if ( ! target_normal_is_oriented )
-        {
-          //             ->                        ->
-          // Orients target_normal parallel to source_normal
-          double normals_dot = source_normal * target_normal;
-          if (normals_dot < 0)
-          {
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-            put( mst_graph.m_normal_pmap, mst_graph[target_vertex].input_point, -target_normal);
-#else
-            put( mst_graph.m_normal_pmap, *(mst_graph[target_vertex].input_point), -target_normal );
-#endif
-          }
-
-          // Is orientation robust?
-          target_normal_is_oriented
-            = source_normal_is_oriented &&
-              (std::abs(normals_dot) >= std::cos(m_angle_max)); // oriented iff angle <= m_angle_max
-        }
-    }
-
-// Data
-// Implementation note: boost::breadth_first_search() makes copies of this object => data must be constant or shared.
-private:
-    const double m_angle_max; ///< max angle to propagate the normal orientation (radians).
-};
-
-/// Orients the normal of the point with maximum Z towards +Z axis.
-///
-/// @tparam ForwardIterator iterator over input points.
-/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3<Kernel>.
-/// @tparam NormalPMap is a model of `ReadWritePropertyMap` with a value_type = Vector_3<Kernel>.
-/// @tparam Kernel Geometric traits class.
-///
-/// @return iterator over the top point.
-template <typename ForwardIterator,
-          typename PointPMap,
-          typename NormalPMap,
-          typename Kernel
->
-ForwardIterator
-mst_find_source(
-    ForwardIterator first,   ///< iterator over the first input point.
-    ForwardIterator beyond,  ///< past-the-end iterator over the input points.
-    PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3
-    NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3
-    const Kernel& /*kernel*/)    ///< geometric traits.
-{
-    CGAL_TRACE("  mst_find_source()\n");
-
-    // Input points types
-    typedef typename boost::property_traits<NormalPMap>::value_type Vector;
-
-    // Precondition: at least one element in the container
-    CGAL_point_set_processing_precondition(first != beyond);
-
-    // Find top point
-    ForwardIterator top_point = first;
-    for (ForwardIterator v = ++first; v != beyond; v++)
-    {
-      
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-      double top_z = get(point_pmap,top_point).z(); // top_point's Z coordinate
-      double z = get(point_pmap,v).z();
-#else
-      double top_z = get(point_pmap,*top_point).z(); // top_point's Z coordinate
-      double z = get(point_pmap,*v).z();
-#endif  
-      
-      if (top_z < z)
-        top_point = v;
-    }
-
-    // Orients its normal towards +Z axis
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-    const Vector& normal = get(normal_pmap,top_point);
-#else
-    const Vector& normal = get(normal_pmap,*top_point);
-#endif
-    const Vector Z(0, 0, 1);
-    if (Z * normal < 0) {
-      CGAL_TRACE("  Flip top point normal\n");
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-    put(normal_pmap,top_point, -normal);
-#else
-    put(normal_pmap,*top_point, -normal);
-#endif
-    }
-
-    return top_point;
-}
-
-/// Iterates over input points and creates Riemannian Graph:
-/// - vertices are numbered like the input points index.
-/// - vertices contain the corresponding input point iterator.
-/// - we add the edge (i, j) if either vertex i is in the k-neighborhood of vertex j,
-///   or vertex j is in the k-neighborhood of vertex i.
-///
-/// \pre Normals must be unit vectors.
-/// \pre `k >= 2`
-///
-/// @tparam ForwardIterator iterator over input points.
-/// @tparam IndexPMap is a model of `ReadablePropertyMap` with an integral value_type.
-/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3<Kernel>.
-/// @tparam NormalPMap is a model of `ReadWritePropertyMap` with a value_type = Vector_3<Kernel>.
-/// @tparam Kernel Geometric traits class.
-///
-/// @return the Riemannian graph
-template <typename ForwardIterator,
-          typename PointPMap,
-          typename NormalPMap,
-          typename IndexPMap,
-          typename Kernel
->
-Riemannian_graph<ForwardIterator>
-create_riemannian_graph(
-    ForwardIterator first,  ///< iterator over the first input point.
-    ForwardIterator beyond, ///< past-the-end iterator over the input points.
-    PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3
-    NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3
-    IndexPMap index_pmap, ///< property map ForwardIterator -> index
-    unsigned int k, ///< number of neighbors
-    const Kernel& /*kernel*/) ///< geometric traits.
-{
-    // Input points types
-    typedef typename boost::property_traits<PointPMap>::value_type Point;
-    typedef typename boost::property_traits<NormalPMap>::value_type Vector;
-
-    // Types for K nearest neighbors search structure
-    typedef Point_vertex_handle_3<ForwardIterator> Point_vertex_handle_3;
-    typedef Search_traits_vertex_handle_3<ForwardIterator> Traits;
-    typedef Euclidean_distance_vertex_handle_3<ForwardIterator> KDistance;
-    typedef Orthogonal_k_neighbor_search<Traits,KDistance> Neighbor_search;
-    typedef typename Neighbor_search::Tree Tree;
-    typedef typename Neighbor_search::iterator Search_iterator;
-
-    // Riemannian_graph types
-    typedef internal::Riemannian_graph<ForwardIterator> Riemannian_graph;
-    typedef typename boost::property_map<Riemannian_graph, boost::edge_weight_t>::type Riemannian_graph_weight_map;
-
-    // Precondition: at least one element in the container.
-    CGAL_point_set_processing_precondition(first != beyond);
-
-    // Precondition: at least 2 nearest neighbors
-    CGAL_point_set_processing_precondition(k >= 2);
-
-    // Number of input points
-    const std::size_t num_input_points = distance(first, beyond);
-
-    std::size_t memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE("  %ld Mb allocated\n", memory>>20);
-    CGAL_TRACE("  Creates KD-tree\n");
-
-    // Instanciate a KD-tree search.
-    // Notes: We have to wrap each input point by a Point_vertex_handle_3.
-    //        The KD-tree is allocated dynamically to recover RAM as soon as possible.
-    std::vector<Point_vertex_handle_3> kd_tree_points; kd_tree_points.reserve(num_input_points);
-    for (ForwardIterator it = first; it != beyond; it++)
-    {
-        
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-        Point point = get(point_pmap, it);
-#else
-        Point point = get(point_pmap, *it);
-#endif  
-        Point_vertex_handle_3 point_wrapper(point.x(), point.y(), point.z(), it);
-        kd_tree_points.push_back(point_wrapper);
-    }
-    boost::shared_ptr<Tree> tree( new Tree(kd_tree_points.begin(), kd_tree_points.end()) );
-
-    // Recover RAM
-    kd_tree_points.clear();
-
-    memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE("  %ld Mb allocated\n", memory>>20);
-    CGAL_TRACE("  Creates Riemannian Graph\n");
-
-    // Iterates over input points and creates Riemannian Graph:
-    // - vertices are numbered like the input points index.
-    // - vertices contain the corresponding input point iterator.
-    // - we add the edge (i, j) if either vertex i is in the k-neighborhood of vertex j,
-    //   or vertex j is in the k-neighborhood of vertex i.
-    Riemannian_graph riemannian_graph;
-    //
-    // add vertices
-    for (ForwardIterator it = first; it != beyond; it++)
-    {
-        typename Riemannian_graph::vertex_descriptor v = add_vertex(riemannian_graph);
-        CGAL_point_set_processing_assertion(v == get(index_pmap,it));
-        riemannian_graph[v].input_point = it;
-    }
-    //
-    // add edges
-    Riemannian_graph_weight_map riemannian_graph_weight_map = get(boost::edge_weight, riemannian_graph);
-    for (ForwardIterator it = first; it != beyond; it++)
-    {
-        std::size_t it_index = get(index_pmap,it);
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-        Vector it_normal_vector = get(normal_pmap,it);
-#else
-        Vector it_normal_vector = get(normal_pmap,*it);
-#endif  
-        
-        // Gather set of (k+1) neighboring points.
-        // Perform k+1 queries (as in point set, the query point is
-        // output first). Search may be aborted if k is greater
-        // than number of input points.
-        
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-        Point point = get(point_pmap, it);
-#else
-        Point point = get(point_pmap, *it);
-#endif  
-        Point_vertex_handle_3 point_wrapper(point.x(), point.y(), point.z(), it);
-        Neighbor_search search(*tree, point_wrapper, k+1);
-        Search_iterator search_iterator = search.begin();
-        for(std::size_t i=0;i<(k+1);i++)
-        {
-            if(search_iterator == search.end())
-                break; // premature ending
-
-            ForwardIterator neighbor = search_iterator->first;
-            std::size_t neighbor_index = get(index_pmap,neighbor);
-            if (neighbor_index > it_index) // undirected graph
-            {
-                // Add edge
-                typename boost::graph_traits<Riemannian_graph>::edge_descriptor e;
-                bool inserted;
-                boost::tie(e, inserted) = add_edge(vertex(it_index, riemannian_graph),
-                                                   vertex(neighbor_index, riemannian_graph),
-                                                   riemannian_graph);
-                CGAL_point_set_processing_assertion(inserted);
-
-                //                               ->        ->
-                // Computes edge weight = 1 - | normal1 * normal2 |
-                // where normal1 and normal2 are the normal at the edge extremities.
-                
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-                Vector neighbor_normal_vector = get(normal_pmap,neighbor);
-#else
-                Vector neighbor_normal_vector = get(normal_pmap,*neighbor);
-#endif  
-                double weight = 1.0 - std::abs(it_normal_vector * neighbor_normal_vector);
-                if (weight < 0)
-                    weight = 0; // safety check
-                riemannian_graph_weight_map[e] = (float)weight;
-            }
-
-            search_iterator++;
-        }
-    }
-
-    return riemannian_graph;
-}
-
-/// Computes Minimum Spanning Tree and store it in a Boost graph:
-/// - vertices are numbered like the input points index.
-/// - vertices contain the corresponding input point iterator.
-/// - we add the edge (predecessor[i], i) for each element of the MST.
-///
-/// \pre Normals must be unit vectors.
-///
-/// @tparam ForwardIterator iterator over input points.
-/// @tparam IndexPMap is a model of `ReadablePropertyMap` with an integral value_type.
-/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3<Kernel>.
-/// @tparam NormalPMap is a model of `ReadWritePropertyMap` with a value_type = Vector_3<Kernel>.
-/// @tparam Kernel Geometric traits class.
-///
-/// @return the MST graph.
-template <typename ForwardIterator,
-          typename PointPMap,
-          typename NormalPMap,
-          typename IndexPMap,
-          typename Kernel
->
-MST_graph<ForwardIterator, NormalPMap, Kernel>
-create_mst_graph(
-    ForwardIterator first,  ///< iterator over the first input point.
-    ForwardIterator beyond, ///< past-the-end iterator over the input points.
-    PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3
-    NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3
-    IndexPMap index_pmap, ///< property map ForwardIterator -> index
-    unsigned int k, ///< number of neighbors
-    const Kernel& kernel, ///< geometric traits.
-    const Riemannian_graph<ForwardIterator>& riemannian_graph, ///< graph connecting each vertex to its knn
-    ForwardIterator source_point) ///< source point (with an oriented normal)
-{
-    // prevents warnings
-    CGAL_USE(point_pmap);
-    CGAL_USE(k);
-    CGAL_USE(kernel);
-
-    // Bring private stuff to scope
-    using namespace internal;
-
-    // Riemannian_graph types
-    typedef internal::Riemannian_graph<ForwardIterator> Riemannian_graph;
-    typedef typename boost::property_map<Riemannian_graph, boost::edge_weight_t>::const_type Riemannian_graph_weight_map;
-
-    // MST_graph types
-    typedef internal::MST_graph<ForwardIterator, NormalPMap, Kernel> MST_graph;
-
-    // Precondition: at least one element in the container.
-    CGAL_point_set_processing_precondition(first != beyond);
-
-    // Number of input points
-    const std::size_t num_input_points = num_vertices(riemannian_graph);
-
-    std::size_t memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE("  %ld Mb allocated\n", memory>>20);
-    CGAL_TRACE("  Calls boost::prim_minimum_spanning_tree()\n");
-
-    // Computes Minimum Spanning Tree.
-    std::size_t source_point_index = get(index_pmap, source_point);
-    Riemannian_graph_weight_map riemannian_graph_weight_map = get(boost::edge_weight, riemannian_graph);
-    typedef std::vector<typename Riemannian_graph::vertex_descriptor> PredecessorMap;
-    PredecessorMap predecessor(num_input_points);
-    boost::prim_minimum_spanning_tree(riemannian_graph, &predecessor[0],
-                                      weight_map( riemannian_graph_weight_map )
-                                     .root_vertex( vertex(source_point_index, riemannian_graph) ));
-
-    memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE("  %ld Mb allocated\n", memory>>20);
-    CGAL_TRACE("  Creates MST Graph\n");
-
-    // Converts predecessor map to a MST graph:
-    // - vertices are numbered like the input points index.
-    // - vertices contain the corresponding input point iterator.
-    // - we add the edge (predecessor[i], i) for each element of the predecessor map.
-    MST_graph mst_graph(normal_pmap);
-    //
-    // Add vertices. source_point is the unique point marked "oriented".
-    for (ForwardIterator it = first; it != beyond; it++)
-    {
-        // With C++11, the following line triggers a bug in Boost versions
-        // 1.56 and 1.57:
-        //   https://svn.boost.org/trac/boost/ticket/10382
-        typename MST_graph::vertex_descriptor v = add_vertex(mst_graph);
-        CGAL_point_set_processing_assertion(v == get(index_pmap,it));
-        mst_graph[v].input_point = it;
-        mst_graph[v].is_oriented = (it == source_point);
-    }
-    // add edges
-    for (std::size_t i=0; i < predecessor.size(); i++) // add edges
-    {
-        if (i != predecessor[i])
-        {
-            // check that bi-directed graph is useless
-            CGAL_point_set_processing_assertion(predecessor[predecessor[i]] != i);
-
-            add_edge(vertex(predecessor[i], mst_graph),
-                     vertex(i,     mst_graph),
-                     mst_graph);
-        }
-    }
-
-    return mst_graph;
-}
-
-} /* namespace internal */
-/// \endcond
-
-// ----------------------------------------------------------------------------
-// Public section
-// ----------------------------------------------------------------------------
-
-/// \ingroup PkgPointSetProcessing
-/// Orients the normals of the `[first, beyond)` range of points using the propagation
-/// of a seed orientation through a minimum spanning tree of the Riemannian graph [Hoppe92].
-///
-/// This method modifies the order of input points so as to pack all sucessfully oriented points first,
-/// and returns an iterator over the first point with an unoriented normal (see erase-remove idiom).
-/// For this reason it should not be called on sorted containers.
-/// \warning This function may fail when Boost version 1.54 is used,
-/// because of the following bug: https://svn.boost.org/trac/boost/ticket/9012
-///
-/// \pre Normals must be unit vectors
-/// \pre `k >= 2`
-///
-/// @tparam ForwardIterator iterator over input points.
-/// @tparam PointPMap is a model of `ReadablePropertyMap` with value type  `Point_3<Kernel>`.
-///        It can be omitted if the value type of `ForwardIterator` is convertible to `Point_3<Kernel>`.
-/// @tparam NormalPMap is a model of `ReadWritePropertyMap` with value type `Vector_3<Kernel>` .
-/// @tparam Kernel Geometric traits class.
-///        It can be omitted and deduced automatically from the value type of `PointPMap`.
-///
-/// @return iterator over the first point with an unoriented normal.
-
-// This variant requires all parameters.
-template <typename ForwardIterator,
-          typename PointPMap,
-          typename NormalPMap,
-          typename Kernel
->
-ForwardIterator
-mst_orient_normals(
-    ForwardIterator first,  ///< iterator over the first input point.
-    ForwardIterator beyond, ///< past-the-end iterator over the input points.
-    PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3.
-    NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3.
-    unsigned int k, ///< number of neighbors
-    const Kernel& kernel) ///< geometric traits.
-{
-    CGAL_TRACE("Calls mst_orient_normals()\n");
-
-    // Bring private stuff to scope
-    using namespace internal;
-
-    // Input points types
-    typedef typename std::iterator_traits<ForwardIterator>::value_type Enriched_point; // actual type of input points
-    // Property map ForwardIterator -> index
-    typedef Index_property_map<ForwardIterator> IndexPMap;
-
-    // Riemannian_graph types
-    typedef Riemannian_graph<ForwardIterator> Riemannian_graph;
-
-    // MST_graph types
-    typedef MST_graph<ForwardIterator, NormalPMap, Kernel> MST_graph;
-
-    // Precondition: at least one element in the container.
-    CGAL_point_set_processing_precondition(first != beyond);
-
-    // Precondition: at least 2 nearest neighbors
-    CGAL_point_set_processing_precondition(k >= 2);
-
-    std::size_t memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE("  %ld Mb allocated\n", memory>>20);
-    CGAL_TRACE("  Create Index_property_map\n");
-
-    // Create a property map Iterator -> index.
-    // - if ForwardIterator is a random access iterator (typically vector and deque),
-    // get() just calls std::distance() and is very efficient;
-    // - else, the property map allocates a std::map to store indices
-    // and get() requires a lookup in the map.
-    IndexPMap index_pmap(first, beyond);
-
-    // Orients the normal of the point with maximum Z towards +Z axis.
-    ForwardIterator source_point
-      = mst_find_source(first, beyond,
-                        point_pmap, normal_pmap,
-                        kernel);
-
-    // Iterates over input points and creates Riemannian Graph:
-    // - vertices are numbered like the input points index.
-    // - vertices are empty.
-    // - we add the edge (i, j) if either vertex i is in the k-neighborhood of vertex j,
-    //   or vertex j is in the k-neighborhood of vertex i.
-    Riemannian_graph riemannian_graph
-      = create_riemannian_graph(first, beyond,
-                                point_pmap, normal_pmap, index_pmap,
-                                k,
-                                kernel);
-
-    // Creates a Minimum Spanning Tree starting at source_point
-    MST_graph mst_graph = create_mst_graph(first, beyond,
-                                           point_pmap, normal_pmap, index_pmap,
-                                           k,
-                                           kernel,
-                                           riemannian_graph,
-                                           source_point);
-
-    memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE("  %ld Mb allocated\n", memory>>20);
-    CGAL_TRACE("  Calls boost::breadth_first_search()\n");
-
-    // Traverse the point set along the MST to propagate source_point's orientation
-    Propagate_normal_orientation<ForwardIterator, NormalPMap, Kernel> orienter;
-    std::size_t source_point_index = get(index_pmap, source_point);
-    boost::breadth_first_search(mst_graph,
-                                vertex(source_point_index, mst_graph), // source
-                                visitor(boost::make_bfs_visitor(orienter)));
-
-    // Copy points with robust normal orientation to oriented_points[], the others to unoriented_points[].
-    std::deque<Enriched_point> oriented_points, unoriented_points;
-    for (ForwardIterator it = first; it != beyond; it++)
-    {
-        std::size_t it_index = get(index_pmap,it);
-        typename MST_graph::vertex_descriptor v = vertex(it_index, mst_graph);
-        if (mst_graph[v].is_oriented)
-          oriented_points.push_back(*it);
-        else
-          unoriented_points.push_back(*it);
-    }
-
-    // Replaces [first, beyond) range by the content of oriented_points[], then unoriented_points[].
-    ForwardIterator first_unoriented_point =
-      std::copy(oriented_points.begin(), oriented_points.end(), first);
-    std::copy(unoriented_points.begin(), unoriented_points.end(), first_unoriented_point);
-
-    // At this stage, we have typically 0 unoriented normals if k is large enough
-    CGAL_TRACE("  => %u normals are unoriented\n", unoriented_points.size());
-
-    memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE("  %ld Mb allocated\n", memory>>20);
-    CGAL_TRACE("End of mst_orient_normals()\n");
-
-    return first_unoriented_point;
-}
-
-/// @cond SKIP_IN_MANUAL
-// This variant deduces the kernel from the point property map.
-template <typename ForwardIterator,
-          typename PointPMap,
-          typename NormalPMap
->
-ForwardIterator
-mst_orient_normals(
-    ForwardIterator first,  ///< iterator over the first input point.
-    ForwardIterator beyond, ///< past-the-end iterator over the input points.
-    PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3.
-    NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3.
-    unsigned int k) ///< number of neighbors
-{
-    typedef typename boost::property_traits<PointPMap>::value_type Point;
-    typedef typename Kernel_traits<Point>::Kernel Kernel;
-    return mst_orient_normals(
-      first,beyond,
-      point_pmap,
-      normal_pmap,
-      k,
-      Kernel());
-}
-/// @endcond
-
-/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Identity_property_map.
-template <typename ForwardIterator,
-          typename NormalPMap
->
-ForwardIterator
-mst_orient_normals(
-    ForwardIterator first,  ///< iterator over the first input point.
-    ForwardIterator beyond, ///< past-the-end iterator over the input points.
-    NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3.
-    unsigned int k) ///< number of neighbors
-{
-    return mst_orient_normals(
-      first,beyond,
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-      make_dereference_property_map(first),
-#else
-      make_identity_property_map(
-      typename std::iterator_traits<ForwardIterator>::value_type()),
-#endif
-      normal_pmap,
-      k);
-}
-/// @endcond
-
-
-} //namespace CGAL
-
-#endif // CGAL_MST_ORIENT_NORMALS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/number_utils.h b/3rdparty/CGAL-4.8/include/CGAL/number_utils.h
deleted file mode 100644
index b3e5528..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/number_utils.h
+++ /dev/null
@@ -1,318 +0,0 @@
-// Copyright (c) 1999  
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved. 
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Stefan Schirra
-
-#ifndef CGAL_NUMBER_UTILS_H
-#define CGAL_NUMBER_UTILS_H
-
-#include <CGAL/number_type_config.h>
-#include <CGAL/Algebraic_structure_traits.h>
-#include <CGAL/Real_embeddable_traits.h>
-
-namespace CGAL {
-CGAL_NTS_BEGIN_NAMESPACE
-
-
-// AST-Functor adapting functions UNARY 
-template< class AS >
-inline 
-void
-simplify( AS& x ) {
-    typename Algebraic_structure_traits< AS >::Simplify simplify;
-    simplify( x );
-}
-
-template< class AS >
-inline
-typename Algebraic_structure_traits< AS >::Unit_part::result_type
-unit_part( const AS& x ) {
-    typename Algebraic_structure_traits< AS >::Unit_part unit_part;
-    return unit_part( x );
-}
-
-
-template< class AS >
-inline
-typename Algebraic_structure_traits< AS >::Is_square::result_type
-is_square( const AS& x, 
-           typename Algebraic_structure_traits< AS >::Is_square::second_argument_type y ) 
-{
-    typename Algebraic_structure_traits< AS >::Is_square is_square;
-    return is_square( x, y );
-}
-
-template< class AS >
-inline
-typename Algebraic_structure_traits< AS >::Is_square::result_type
-is_square( const AS& x){
-    typename Algebraic_structure_traits< AS >::Is_square is_square;
-    return is_square( x );
-}
-
-
-template< class AS >
-inline
-typename Algebraic_structure_traits< AS >::Square::result_type
-square( const AS& x ) {
-    typename Algebraic_structure_traits< AS >::Square square;
-    return square( x );
-}
-
-
-template< class AS >
-inline
-typename Algebraic_structure_traits< AS >::Inverse::result_type
-inverse( const AS& x ) {
-    typename Algebraic_structure_traits< AS >::Inverse inverse;
-    return inverse( x );
-}
-
-template< class AS >
-inline 
-typename Algebraic_structure_traits<AS>::Is_one::result_type
-is_one( const AS& x ) {
-    typename Algebraic_structure_traits< AS >::Is_one is_one;
-    return is_one( x );
-}
-
-template< class AS >
-inline
-typename Algebraic_structure_traits< AS >::Sqrt::result_type
-sqrt( const AS& x ) {
-    typename Algebraic_structure_traits< AS >::Sqrt sqrt;
-    return sqrt( x );
-}
-
-
-
-// AST-Functor adapting functions BINARY
-
-template< class A, class B >
-inline
-typename Algebraic_structure_traits< typename Coercion_traits<A,B>::Type>
-::Integral_division::result_type
-integral_division( const A& x, const B& y ) {
-    typedef typename Coercion_traits<A,B>::Type Type;
-    typename Algebraic_structure_traits< Type >::Integral_division 
-        integral_division;
-    return integral_division( x, y );
-}
-
-template< class A, class B >
-inline
-typename Algebraic_structure_traits< typename Coercion_traits<A,B>::Type> 
-::Divides::result_type
-divides( const A& x, const B& y ) {
-  typedef typename Coercion_traits<A,B>::Type Type;
-  typename Algebraic_structure_traits< Type >::Divides  divides;
-  return divides( x, y );
-}
-
-template< class Type >
-inline
-typename Algebraic_structure_traits<Type>::Divides::result_type
-divides( const Type& x, const Type& y, Type& q ) {
-  typename Algebraic_structure_traits< Type >::Divides  divides;
-  return divides( x, y, q);
-}
-
-template< class A, class B >
-inline
-typename Algebraic_structure_traits< typename Coercion_traits<A,B>::Type >
-::Gcd::result_type
-gcd( const A& x, const B& y ) {
-    typedef typename Coercion_traits<A,B>::Type      Type;
-    typename Algebraic_structure_traits< Type >::Gcd gcd;
-    return gcd( x, y );
-}
-
-
-template< class A, class B >
-inline
-typename Algebraic_structure_traits< typename Coercion_traits<A,B>::Type >
-::Mod::result_type
-mod( const A& x, const B& y ) {
-    typedef typename Coercion_traits<A,B>::Type Type;
-    typename Algebraic_structure_traits<Type >::Mod mod;
-    return mod( x, y );
-}
-
-template< class A, class B >
-inline
-typename Algebraic_structure_traits< typename Coercion_traits<A,B>::Type>::Div::result_type
-div( const A& x, const B& y ) {
-    typedef typename Coercion_traits<A,B>::Type Type;
-    typename Algebraic_structure_traits<Type >::Div div;
-    return div( x, y );
-}
-
-template< class A, class B >
-inline 
-void
-div_mod( 
-        const A& x,
-        const B& y,
-        typename Coercion_traits<A,B>::Type& q, 
-        typename Coercion_traits<A,B>::Type& r ) {
-    typedef typename Coercion_traits<A,B>::Type Type;
-    typename Algebraic_structure_traits< Type >::Div_mod div_mod;
-    div_mod( x, y, q, r );
-}
-
-// others 
-template< class AS >
-inline
-typename Algebraic_structure_traits< AS >::Kth_root::result_type
-kth_root( int k, const AS& x ) {
-    typename Algebraic_structure_traits< AS >::Kth_root
-        kth_root;
-    return kth_root( k, x );                                                                    
-}
-
-
-template< class Input_iterator >
-inline
-typename Algebraic_structure_traits< typename std::iterator_traits<Input_iterator>::value_type >
-::Root_of::result_type
-root_of( int k, Input_iterator begin, Input_iterator end ) {
-    typedef typename std::iterator_traits<Input_iterator>::value_type AS; 
-    return typename Algebraic_structure_traits<AS>::Root_of()( k, begin, end );
-}
-
-// AST- and RET-functor adapting function
-template< class Number_type >
-inline 
-// select a Is_zero functor
-typename boost::mpl::if_c< 
- ::boost::is_same< typename Algebraic_structure_traits< Number_type >::Is_zero,
- Null_functor  >::value ,
-  typename Real_embeddable_traits< Number_type >::Is_zero,
-  typename Algebraic_structure_traits< Number_type >::Is_zero
->::type::result_type
-is_zero( const Number_type& x ) {
-    // We take the Algebraic_structure_traits<>::Is_zero functor by default. If it
-    //  is not available, we take the Real_embeddable_traits functor
-    typename ::boost::mpl::if_c< 
-        ::boost::is_same<
-             typename Algebraic_structure_traits< Number_type >::Is_zero,
-             Null_functor >::value ,
-       typename Real_embeddable_traits< Number_type >::Is_zero,
-       typename Algebraic_structure_traits< Number_type >::Is_zero >::type
-       is_zero;
-return is_zero( x );                                                                    
-}
-
-
-template <class A, class B>
-inline
-typename Real_embeddable_traits< typename Coercion_traits<A,B>::Type >
-::Compare::result_type 
-compare(const A& a, const B& b)
-{ 
-    typedef typename Coercion_traits<A,B>::Type Type;
-    typename Real_embeddable_traits<Type>::Compare compare;
-    return compare (a,b);
-    // return (a < b) ? SMALLER : (b < a) ? LARGER : EQUAL; 
-}
-
-
-// RET-Functor adapting functions
-template< class Real_embeddable >
-inline 
-//Real_embeddable 
-typename Real_embeddable_traits< Real_embeddable >::Abs::result_type 
-abs( const Real_embeddable& x ) {
-    typename Real_embeddable_traits< Real_embeddable >::Abs abs;
-    return abs( x );
-}
-
-template< class Real_embeddable >
-inline 
-//::Sign 
-typename Real_embeddable_traits< Real_embeddable >::Sgn::result_type
-sign( const Real_embeddable& x ) {
-    typename Real_embeddable_traits< Real_embeddable >::Sgn sgn;
-    return sgn( x );
-}
-
-template< class Real_embeddable >
-inline 
-//bool
-typename Real_embeddable_traits< Real_embeddable >::Is_finite::result_type
-is_finite( const Real_embeddable& x ) {
-    return typename Real_embeddable_traits< Real_embeddable >::Is_finite()( x );
-}
-
-template< class Real_embeddable >
-inline 
-typename Real_embeddable_traits< Real_embeddable >::Is_positive::result_type
-is_positive( const Real_embeddable& x ) {
-    typename Real_embeddable_traits< Real_embeddable >::Is_positive 
-        is_positive;
-    return is_positive( x );
-}
-
-template< class Real_embeddable >
-inline
-typename Real_embeddable_traits< Real_embeddable >::Is_negative::result_type
-is_negative( const Real_embeddable& x ) {
-    typename Real_embeddable_traits< Real_embeddable >::Is_negative
-        is_negative;
-    return is_negative( x );
-}
-
-/*
-template< class Real_embeddable >
-inline
-typename Real_embeddable_traits< Real_embeddable >::Compare::result_type
-//Comparison_result
-compare( const Real_embeddable& x, const Real_embeddable& y ) {
-    typename Real_embeddable_traits< Real_embeddable >::Compare compare;
-    return compare( x, y );
-}
-*/
-
-template< class Real_embeddable >
-inline
-typename Real_embeddable_traits< Real_embeddable >::To_double::result_type
-//double
-to_double( const Real_embeddable& x ) {
-    typename Real_embeddable_traits< Real_embeddable >::To_double to_double;  
-    return to_double( x );
-}
-
-template< class Real_embeddable >
-inline
-typename Real_embeddable_traits< Real_embeddable >::To_interval::result_type
-//std::pair< double, double >
-to_interval( const Real_embeddable& x) {
-    typename Real_embeddable_traits< Real_embeddable >::To_interval 
-        to_interval;
-    return to_interval( x );
-}
-
-
-CGAL_NTS_END_NAMESPACE
-} //namespace CGAL
-
-#endif // CGAL_NUMBER_UTILS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/pca_estimate_normals.h b/3rdparty/CGAL-4.8/include/CGAL/pca_estimate_normals.h
deleted file mode 100644
index d633cd7..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/pca_estimate_normals.h
+++ /dev/null
@@ -1,317 +0,0 @@
-// Copyright (c) 2007-09  INRIA Sophia-Antipolis (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
-// 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(s) : Pierre Alliez and Laurent Saboret
-
-#ifndef CGAL_PCA_ESTIMATE_NORMALS_H
-#define CGAL_PCA_ESTIMATE_NORMALS_H
-
-#include <CGAL/trace.h>
-#include <CGAL/Dimension.h>
-#include <CGAL/Search_traits_3.h>
-#include <CGAL/Orthogonal_k_neighbor_search.h>
-#include <CGAL/linear_least_squares_fitting_3.h>
-#include <CGAL/property_map.h>
-#include <CGAL/point_set_processing_assertions.h>
-#include <CGAL/Memory_sizer.h>
-
-#include <iterator>
-#include <list>
-
-#ifdef CGAL_LINKED_WITH_TBB
-#include <tbb/parallel_for.h>
-#include <tbb/blocked_range.h>
-#include <tbb/scalable_allocator.h>  
-#endif // CGAL_LINKED_WITH_TBB
-
-namespace CGAL {
-
-
-// ----------------------------------------------------------------------------
-// Private section
-// ----------------------------------------------------------------------------
-/// \cond SKIP_IN_MANUAL
-namespace internal {
-
-
-/// Estimates normal direction using linear least
-/// squares fitting of a plane on the K nearest neighbors.
-///
-/// \pre `k >= 2`
-///
-/// @tparam Kernel Geometric traits class.
-/// @tparam Tree KD-tree.
-///
-/// @return Computed normal. Orientation is random.
-template < typename Kernel,
-           typename Tree
->
-typename Kernel::Vector_3
-pca_estimate_normal(const typename Kernel::Point_3& query, ///< point to compute the normal at
-                    const Tree& tree, ///< KD-tree
-                    unsigned int k) ///< number of neighbors
-{
-  // basic geometric types
-  typedef typename Kernel::Point_3  Point;
-  typedef typename Kernel::Plane_3  Plane;
-
-  // types for K nearest neighbors search
-  typedef typename CGAL::Search_traits_3<Kernel> Tree_traits;
-  typedef typename CGAL::Orthogonal_k_neighbor_search<Tree_traits> Neighbor_search;
-  typedef typename Neighbor_search::iterator Search_iterator;
-
-  // Gather set of (k+1) neighboring points.
-  // Perform k+1 queries (as in point set, the query point is
-  // output first). Search may be aborted if k is greater
-  // than number of input points.
-  std::vector<Point> points; points.reserve(k+1);
-  Neighbor_search search(tree,query,k+1);
-  Search_iterator search_iterator = search.begin();
-  unsigned int i;
-  for(i=0;i<(k+1);i++)
-  {
-    if(search_iterator == search.end())
-      break; // premature ending
-    points.push_back(search_iterator->first);
-    search_iterator++;
-  }
-  CGAL_point_set_processing_precondition(points.size() >= 1);
-
-  // performs plane fitting by point-based PCA
-  Plane plane;
-  linear_least_squares_fitting_3(points.begin(),points.end(),plane,Dimension_tag<0>());
-
-  // output normal vector (already normalized by PCA)
-  return plane.orthogonal_vector();
-}
-
-
-#ifdef CGAL_LINKED_WITH_TBB
-  template <typename Kernel, typename Tree>
-  class PCA_estimate_normals {
-    typedef typename Kernel::Point_3 Point;
-    typedef typename Kernel::Vector_3 Vector;
-    const Tree& tree;
-    const unsigned int k;
-    const std::vector<Point>& input;
-    std::vector<Vector>& output;
-
-  public:
-    PCA_estimate_normals(Tree& tree, unsigned int k, std::vector<Point>& points,
-			 std::vector<Vector>& output)
-      : tree(tree), k (k), input (points), output (output)
-    { }
-    
-    void operator()(const tbb::blocked_range<std::size_t>& r) const
-    {
-      for( std::size_t i = r.begin(); i != r.end(); ++i)
-	output[i] = CGAL::internal::pca_estimate_normal<Kernel,Tree>(input[i], tree, k);
-    }
-
-  };
-#endif // CGAL_LINKED_WITH_TBB
-  
-
-} /* namespace internal */
-/// \endcond
-
-
-
-// ----------------------------------------------------------------------------
-// Public section
-// ----------------------------------------------------------------------------
-
-/// \ingroup PkgPointSetProcessing
-/// Estimates normal directions of the `[first, beyond)` range of points
-/// by linear least squares fitting of a plane over the k nearest neighbors.
-/// The output normals are randomly oriented.
-///
-/// \pre `k >= 2`
-///
-/// @tparam Concurrency_tag enables sequential versus parallel algorithm.
-///                         Possible values are `Sequential_tag`
-///                         and `Parallel_tag`.
-/// @tparam ForwardIterator iterator over input points.
-/// @tparam PointPMap is a model of `ReadablePropertyMap` with value type `Point_3<Kernel>`.
-///        It can be omitted if the value type of  `ForwardIterator` is convertible to `Point_3<Kernel>`.
-/// @tparam NormalPMap is a model of `WritablePropertyMap` with value type  `Vector_3<Kernel>`.
-/// @tparam Kernel Geometric traits class.
-///        It can be omitted and deduced automatically from the value type of `PointPMap`.
-
-// This variant requires all parameters.
-template <typename Concurrency_tag,
-	  typename ForwardIterator,
-          typename PointPMap,
-          typename NormalPMap,
-          typename Kernel
->
-void
-pca_estimate_normals(
-  ForwardIterator first,  ///< iterator over the first input point.
-  ForwardIterator beyond, ///< past-the-end iterator over the input points.
-  PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3.
-  NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3.
-  unsigned int k, ///< number of neighbors.
-  const Kernel& /*kernel*/) ///< geometric traits.
-{
-  CGAL_TRACE("Calls pca_estimate_normals()\n");
-
-  // basic geometric types
-  typedef typename Kernel::Point_3 Point;
-
-  // Input points types
-  typedef typename boost::property_traits<NormalPMap>::value_type Vector;
-
-  // types for K nearest neighbors search structure
-  typedef typename CGAL::Search_traits_3<Kernel> Tree_traits;
-  typedef typename CGAL::Orthogonal_k_neighbor_search<Tree_traits> Neighbor_search;
-  typedef typename Neighbor_search::Tree Tree;
-
-  // precondition: at least one element in the container.
-  // to fix: should have at least three distinct points
-  // but this is costly to check
-  CGAL_point_set_processing_precondition(first != beyond);
-
-  // precondition: at least 2 nearest neighbors
-  CGAL_point_set_processing_precondition(k >= 2);
-
-  std::size_t memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE("  %ld Mb allocated\n", memory>>20);
-  CGAL_TRACE("  Creates KD-tree\n");
-
-  ForwardIterator it;
-
-  // Instanciate a KD-tree search.
-  // Note: We have to convert each input iterator to Point_3.
-  std::vector<Point> kd_tree_points; 
-  for(it = first; it != beyond; it++)
-  {
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-    Point point = get(point_pmap, it);
-#else
-    Point point = get(point_pmap, *it);
-#endif  
-    kd_tree_points.push_back(point);
-  }
-  Tree tree(kd_tree_points.begin(), kd_tree_points.end());
-
-  memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE("  %ld Mb allocated\n", memory>>20);
-  CGAL_TRACE("  Computes normals\n");
-
-  // iterate over input points, compute and output normal
-  // vectors (already normalized)
-#ifndef CGAL_LINKED_WITH_TBB
-  CGAL_static_assertion_msg (!(boost::is_convertible<Concurrency_tag, Parallel_tag>::value),
-			     "Parallel_tag is enabled but TBB is unavailable.");
-#else
-  if (boost::is_convertible<Concurrency_tag,Parallel_tag>::value)
-    {
-      std::vector<Vector> normals (kd_tree_points.size ());
-      CGAL::internal::PCA_estimate_normals<Kernel, Tree>
-	f (tree, k, kd_tree_points, normals);
-      tbb::parallel_for(tbb::blocked_range<size_t>(0, kd_tree_points.size ()), f);
-      unsigned int i = 0;
-      for(it = first; it != beyond; ++ it, ++ i)
-	{
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-	  put (normal_pmap, it, normals[i]);
-#else
-	  put (normal_pmap, *it, normals[i]);
-#endif  
-	}
-    }
-  else
-#endif
-    {
-      for(it = first; it != beyond; it++)
-	{
-	  Vector normal = internal::pca_estimate_normal<Kernel,Tree>(      
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-								     get(point_pmap,it),
-#else
-								     get(point_pmap,*it),
-#endif  
-								     tree,
-								     k);
-
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-	  put(normal_pmap, it, normal); // normal_pmap[it] = normal
-#else
-	  put(normal_pmap, *it, normal); // normal_pmap[it] = normal
-#endif 
-	}
-    }
-   
-  memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE("  %ld Mb allocated\n", memory>>20);
-  CGAL_TRACE("End of pca_estimate_normals()\n");
-}
-  
-/// @cond SKIP_IN_MANUAL
-// This variant deduces the kernel from the point property map.
-template <typename Concurrency_tag,
-	  typename ForwardIterator,
-          typename PointPMap,
-          typename NormalPMap
->
-void
-pca_estimate_normals(
-  ForwardIterator first,  ///< iterator over the first input point.
-  ForwardIterator beyond, ///< past-the-end iterator over the input points.
-  PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3.
-  NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3.
-  unsigned int k) ///< number of neighbors.
-{
-  typedef typename boost::property_traits<PointPMap>::value_type Point;
-  typedef typename Kernel_traits<Point>::Kernel Kernel;
-  pca_estimate_normals<Concurrency_tag>(
-    first,beyond,
-    point_pmap,
-    normal_pmap,
-    k,
-    Kernel());
-}
-/// @endcond
-
-/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Identity_property_map.
-template <typename Concurrency_tag,
-	  typename ForwardIterator,
-          typename NormalPMap
->
-void
-pca_estimate_normals(
-  ForwardIterator first,  ///< iterator over the first input point.
-  ForwardIterator beyond, ///< past-the-end iterator over the input points.
-  NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3.
-  unsigned int k) ///< number of neighbors.
-{
-  pca_estimate_normals<Concurrency_tag>(
-    first,beyond,
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-    make_dereference_property_map(first),
-#else
-    make_identity_property_map(
-    typename std::iterator_traits<ForwardIterator>::value_type()),
-#endif
-    normal_pmap,
-    k);
-}
-/// @endcond
-
-
-} //namespace CGAL
-
-#endif // CGAL_PCA_ESTIMATE_NORMALS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/point_generators_2.h b/3rdparty/CGAL-4.8/include/CGAL/point_generators_2.h
deleted file mode 100644
index 48101f0..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/point_generators_2.h
+++ /dev/null
@@ -1,547 +0,0 @@
-// Copyright (c) 1997  
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved. 
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Lutz Kettner  <kettner at inf.ethz.ch>
-//                 Pedro Machado Manhaes de Castro  <pmmc at cin.ufpe.br>
-//                 Alexandru Tifrea
-
-#ifndef CGAL_POINT_GENERATORS_2_H
-#define CGAL_POINT_GENERATORS_2_H 1
-#include <CGAL/generators.h>
-#include <iterator>
-#include <CGAL/number_type_basic.h>
-
-namespace CGAL {
-
-template < class P, class Creator = 
-                  Creator_uniform_2<typename Kernel_traits<P>::Kernel::RT,P> >
-class Random_points_in_disc_2 : public Random_generator_base<P>{
-    void generate_point();
-public:
-    typedef Random_points_in_disc_2<P,Creator> This;
-    Random_points_in_disc_2( double r = 1, Random& rnd = CGAL::get_default_random())
-        // g is an input iterator creating points of type `P' uniformly
-        // distributed in the open disc with radius r, i.e. |`*g'| < r .
-        // Two random numbers are needed from `rnd' for each point.
-    : Random_generator_base<P>(r, rnd) { generate_point(); }
-    This& operator++() {
-        generate_point();
-        return *this;
-    }
-    This  operator++(int) {
-        This tmp = *this;
-        ++(*this);
-        return tmp;
-    }
-};
-
-template < class P, class Creator >
-void
-Random_points_in_disc_2<P,Creator>::
-generate_point() {
-    typedef typename Creator::argument_type T;
-    double alpha = this->_rnd.get_double() * 2.0 * CGAL_PI;
-    double r = this->d_range * std::sqrt( this->_rnd.get_double());
-    Creator creator;
-    this->d_item = creator( T(r * std::cos(alpha)), 
-                            T(r * std::sin(alpha)));
-}
-
-
-template < class P, class Creator = 
-                  Creator_uniform_2<typename Kernel_traits<P>::Kernel::RT, P> >
-class Random_points_on_circle_2 : public Random_generator_base<P> {
-    void generate_point();
-public:
-    typedef Random_points_on_circle_2<P,Creator> This;
-    Random_points_on_circle_2( double r = 1, Random& rnd = CGAL::get_default_random())
-        // g is an input iterator creating points of type `P' uniformly
-        // distributed on the circle with radius r, i.e. |`*g'| == r . A
-        // single random number is needed from `rnd' for each point.
-    : Random_generator_base<P>(r, rnd) { generate_point(); }
-    This& operator++()    {
-        generate_point();
-        return *this;
-    }
-    This  operator++(int) {
-        This tmp = *this;
-        ++(*this);
-        return tmp;
-    }
-};
-
-template < class P, class Creator >
-void
-Random_points_on_circle_2<P,Creator>::
-generate_point() {
-    typedef typename Creator::argument_type T;
-    double a = this->_rnd.get_double() * 2.0 * CGAL_PI;
-    Creator creator;
-    this->d_item = creator( T(this->d_range * std::cos(a)), 
-                            T(this->d_range * std::sin(a)));
-}
-
-
-template < class P, class Creator = 
-                   Creator_uniform_2<typename Kernel_traits<P>::Kernel::RT,P> >
-class Random_points_in_square_2 : public Random_generator_base<P> {
-    void generate_point();
-public:
-    typedef Random_points_in_square_2<P,Creator> This;
-    Random_points_in_square_2( double a = 1, Random& rnd = CGAL::get_default_random())
-        // g is an input iterator creating points of type `P' uniformly
-        // distributed in the half-open square with side length a,
-        // centered around the origin, i.e. \forall p = `*g': -\frac{a}{2}
-        // <= p.x() < \frac{a}{2} and -\frac{a}{2} <= p.y() < \frac{a}{2}
-        // . Two random numbers are needed from `rnd' for each point.
-    : Random_generator_base<P>( a, rnd) { generate_point(); }
-    This& operator++()    {
-        generate_point();
-        return *this;
-    }
-    This  operator++(int) {
-        This tmp = *this;
-        ++(*this);
-        return tmp;
-    }
-};
-
-template < class P, class Creator >
-void
-Random_points_in_square_2<P,Creator>::
-generate_point() {
-    typedef typename Creator::argument_type  T;
-    Creator creator;
-    this->d_item =
-	    creator( T(this->d_range * (2 * this->_rnd.get_double() - 1.0)),
-                     T(this->d_range * (2 * this->_rnd.get_double() - 1.0)));
-}
-
-
-template < class P, class Creator = 
-                   Creator_uniform_2<typename Kernel_traits<P>::Kernel::RT,P> >
-class Random_points_on_square_2 : public Random_generator_base<P> {
-    void generate_point();
-public:
-    typedef Random_points_on_square_2<P,Creator> This;
-    Random_points_on_square_2( double a = 1, Random& rnd = CGAL::get_default_random())
-        // g is an input iterator creating points of type `P' uniformly
-        // distributed on the boundary of the square with side length a,
-        // centered around the origin, i.e. \forall p = `*g': one
-        // coordinate is either \frac{a}{2} or -\frac{a}{2} and for the
-        // other coordinate c holds -\frac{a}{2} <= c < \frac{a}{2} . A
-        // single random number is needed from `rnd' for each point.
-    : Random_generator_base<P>( a, rnd)  { generate_point(); }
-    This& operator++()    {
-        generate_point();
-        return *this;
-    }
-    This  operator++(int) {
-        This tmp = *this;
-        ++(*this);
-        return tmp;
-    }
-};
-
-template < class P, class Creator >
-void
-Random_points_on_square_2<P,Creator>::
-generate_point() {
-    typedef typename Creator::argument_type  T;
-    double d = this->_rnd.get_double() * 4.0;
-    int    k = int(d);
-    d = this->d_range * (2 * (d - k) - 1.0);
-    CGAL_assertion( - this->d_range <= d && d < this->d_range);
-    Creator creator;
-    switch (k) {
-    case 0:
-        this->d_item = creator(              T(d), T(-this->d_range));
-        break;
-    case 1:
-        this->d_item = creator(              T(d),  T(this->d_range));
-        break;
-    case 2:
-        this->d_item = creator( T(-this->d_range),        T(d));
-        break;
-    case 3:
-        this->d_item = creator( T( this->d_range),        T(d));
-        break;
-    }
-}
-
-
-template < class P, class Creator = 
-                   Creator_uniform_2<typename Kernel_traits<P>::Kernel::RT,P> >
-class Random_points_in_iso_rectangle_2 : public Random_generator_base<P> {
-  double left, right, top, bottom;
-    void generate_point();
-public:
-    typedef Random_points_in_iso_rectangle_2<P,Creator> This;
-    Random_points_in_iso_rectangle_2( const P&p, const P& q, Random& rnd = CGAL::get_default_random())
-      : Random_generator_base<P>( 1.0 , rnd)
-  {
-    left = (std::min)(to_double(p.x()), to_double(q.x()));
-    right = (std::max)(to_double(p.x()), to_double(q.x()));
-    top = (std::min)(to_double(p.y()), to_double(q.y()));
-    bottom = (std::max)(to_double(p.y()), to_double(q.y()));
-    generate_point(); 
-  }
-
-    This& operator++()    {
-        generate_point();
-        return *this;
-    }
-    This  operator++(int) {
-        This tmp = *this;
-        ++(*this);
-        return tmp;
-    }
-};
-
-template < class P, class Creator >
-void
-Random_points_in_iso_rectangle_2<P,Creator>::
-generate_point() {
-    typedef typename Creator::argument_type  T;
-    Creator creator;
-    this->d_item =
-	    creator( T(this->_rnd.get_double(left,right)),
-                     T(this->_rnd.get_double(top,bottom)));
-}
-
-
-
-template < class P, class Creator = 
-                   Creator_uniform_2<typename Kernel_traits<P>::Kernel::RT,P> >
-class Random_points_on_segment_2 : public Random_generator_base<P> {
-    P _p;
-    P _q;
-    void generate_point();
-public:
-    typedef Random_points_on_segment_2<P,Creator> This;
-    Random_points_on_segment_2( const P& p = P( -1, 0),
-                                const P& q = P(  1, 0),
-                                Random& rnd = CGAL::get_default_random())
-        // g is an input iterator creating points of type `P' uniformly
-        // distributed on the segment from p to q except q, i.e. `*g' ==
-        // \lambda p + (1-\lambda)\, q where 0 <= \lambda < 1 . A single
-        // random number is needed from `rnd' for each point.
-      : Random_generator_base<P>( (std::max)( (std::max)( to_double(p.x()), to_double(q.x())),
-                                              (std::max)( to_double(p.y()),
-                                                          to_double(q.y()))),
-                                  rnd) , _p(p), _q(q)
-    {
-        generate_point();
-    }
-    const P&  source() const { return _p; }
-    const P&  target() const { return _q; }
-    This& operator++()    {
-        generate_point();
-        return *this;
-    }
-    This  operator++(int) {
-        This tmp = *this;
-        ++(*this);
-        return tmp;
-    }
-};
-
-template < class P, class Creator >
-void
-Random_points_on_segment_2<P,Creator>::
-generate_point() {
-    typedef typename Creator::argument_type  T;
-    double la = this->_rnd.get_double();
-    double mu = 1.0 - la;
-    Creator creator;
-    this->d_item = creator(T(mu * to_double(_p.x()) + la * to_double(_q.x())),
-                           T(mu * to_double(_p.y()) + la * to_double(_q.y())));
-}
-
-template < class P >
-class Points_on_segment_2 : public Generator_base<P> {
-    P _p;
-    P _q;
-    std::size_t  d_i;
-    std::size_t  d_mx;
-    void generate_point();
-public:
-    typedef Points_on_segment_2<P> This;
-    Points_on_segment_2() {}
-    Points_on_segment_2( const P& p, const P& q,
-                         std::size_t mx, std::size_t i = 0)
-      : Generator_base<P>( (std::max)( (std::max)( to_double(p.x()), to_double(q.x())),
-                                       (std::max)( to_double(p.y()), to_double(q.y())))),
-        _p(p), _q(q), d_i(i), d_mx(mx) 
-    {
-        generate_point();
-    }
-    const P&  source() const { return _p; }
-    const P&  target() const { return _q; }
-    // Sufficient equality test.
-    bool operator==( const This& base) const { return ( d_i == base.d_i); }
-    bool operator!=( const This& base) const { return ! operator==(base); }
-    This& operator++()    {
-        d_i++;
-        generate_point();
-        return *this;
-    }
-    This  operator++(int) {
-        This tmp = *this;
-        ++(*this);
-        return tmp;
-    }
-};
-
-template < class P >
-void
-Points_on_segment_2<P>::
-generate_point() { this->d_item = _p + (_q-_p) * static_cast<double>(d_i) / (static_cast<double>(d_mx)-1); }
-
-template <class OutputIterator, class Creator>
-OutputIterator
-points_on_square_grid_2( double a, std::size_t n, OutputIterator o,
-                         Creator creator)
-{
-    typedef typename Creator::argument_type T;
-    if  (n == 0)
-        return o;
-    int m = int(std::ceil(std::sqrt(static_cast<double>(n))));
-    double base = -a;  // Left and bottom boundary.
-    double step = (2*a)/(m - 1);
-    int j = 0;
-    double px = base;
-    double py = base;
-    *o++ = creator( T(px), T(py));
-    for (std::size_t i = 1; i < n; i++) {
-        j++;
-        if ( j == m) {
-            px = base;
-            py = py + step;
-            j = 0;
-        } else {
-            px = px + step;
-        }
-        *o++ = creator( T(px), T(py));
-    }
-    return o;
-}
-
-template <class OutputIterator>
-OutputIterator
-points_on_square_grid_2( double a, std::size_t n, OutputIterator o)
-{
-    typedef std::iterator_traits<OutputIterator> ITraits;
-    typedef typename ITraits::value_type         P;
-    return points_on_square_grid_2(a, n, o, 
-                Creator_uniform_2<typename Kernel_traits<P>::Kernel::RT,P>());
-}
-
-template <class P, class OutputIterator>
-OutputIterator
-points_on_segment_2( const P& p, const P& q, std::size_t n,
-                     OutputIterator o)
-    // creates n points regular spaced on the segment from p to q, i.e.
-    // \forall i: 0 <= i < n: o[i] := \frac{n-i-1}{n-1} p + \frac{i}{n-1
-    // } q.
-{
-    for (std::size_t i = 0; i < n; i++) {
-      *o++ = p + (q-p) * static_cast<typename Kernel_traits<P>::Kernel::FT>(static_cast<double>(i) / (static_cast<double>(n)-1));
-    }
-    return o;
-}
-
-template <class ForwardIterator, class Creator>
-void perturb_points_2( ForwardIterator first,
-                       ForwardIterator last,
-                       double xeps,
-                       double yeps,
-                       Random& rnd,
-                       Creator creator)
-    // perturbs the points in the range [`first',`last') by replacing
-    // each point with a random point from the rectangle `xeps' \times
-    // `yeps' centered around the original point. Two random numbers are
-    // needed from `rnd' for each point. Precondition:
-    // The expression `to_double((*first).x())' and `to_double((
-    // *begin).y())' must be legal.
-{
-    typedef typename Creator::argument_type T;
-    xeps *= 2.0;
-    yeps *= 2.0;
-    for ( ; first != last; ++first) {
-        double x = to_double( (*first).x());
-        double y = to_double( (*first).y());
-        x += xeps * (rnd.get_double() - 0.5);
-        y += yeps * (rnd.get_double() - 0.5);
-        *first = creator( T(x), T(y));
-    }
-}
-
-template <class ForwardIterator>
-void perturb_points_2( ForwardIterator first,
-                       ForwardIterator last,
-                       double xeps,
-                       double yeps,
-                       Random& rnd)
-{
-    typedef std::iterator_traits<ForwardIterator> ITraits;
-    typedef typename ITraits::value_type          P;
-    perturb_points_2( first, last, xeps, yeps, rnd,
-                 Creator_uniform_2<typename Kernel_traits<P>::Kernel::RT,P>());
-}
-
-template <class ForwardIterator>
-inline
-void perturb_points_2( ForwardIterator first,
-                       ForwardIterator last,
-                       double xeps,
-                       Random& rnd)
-{
-    perturb_points_2( first, last, xeps, xeps, rnd);
-}
-
-template <class ForwardIterator>
-void perturb_points_2( ForwardIterator first,
-                       ForwardIterator last,
-                       double xeps,
-                       double yeps)
-{
-    perturb_points_2( first, last, xeps, yeps, CGAL::get_default_random());
-}
-
-template <class ForwardIterator>
-void perturb_points_2( ForwardIterator first,
-                       ForwardIterator last,
-                       double xeps)
-{
-    perturb_points_2( first, last, xeps, xeps, CGAL::get_default_random());
-}
-template <class RandomAccessIterator, class OutputIterator, class Creator>
-OutputIterator random_collinear_points_2(
-                       RandomAccessIterator first,
-                       RandomAccessIterator last,
-                       std::size_t n,
-                       OutputIterator first2,
-                       Random& rnd,
-                       Creator creator)
-{
-    typedef typename Creator::result_type   Point;
-    typedef typename Creator::argument_type T;
-
-    std::ptrdiff_t m = last - first;
-    for ( std::size_t i = 0; i < n; i++) {
-      const Point& p = first[ rnd.uniform_int<std::ptrdiff_t>( 0, m-1)];
-        const Point& q = first[ rnd.uniform_int<std::ptrdiff_t>( 0, m-1)];
-        double la = rnd.get_double();
-        double mu = 1.0 - la;
-        *first2++ = creator(T(mu * to_double(p.x()) +
-                              la * to_double(q.x())),
-                            T(mu * to_double(p.y()) +
-                              la * to_double(q.y())));
-    }
-    return first2;
-}
-
-template <class RandomAccessIterator, class OutputIterator>
-OutputIterator random_collinear_points_2(
-                       RandomAccessIterator first,
-                       RandomAccessIterator last,
-                       std::size_t n,
-                       OutputIterator first2,
-                       Random& rnd)
-    // choose two random points from the range [`first',`last'), create a
-    // random third point on the segment connecting this two points, and
-    // write it to `first2'. Repeat this n times, thus writing n points to
-    // `first2' that are collinear with points in the range [`first',
-    // `last'). Three random numbers are needed from `rnd' for each point.
-    // Returns the value of `first2' after inserting the n points.
-    // Precondition: The expression `to_double((*first).x()
-    // )' and `to_double((*first).y())' must be legal.
-{
-    typedef std::iterator_traits<RandomAccessIterator> ITraits;
-    typedef typename ITraits::value_type               P;
-    return random_collinear_points_2( first, last, n, first2, rnd,
-                 Creator_uniform_2<typename Kernel_traits<P>::Kernel::RT,P>());
-}
-
-template <class RandomAccessIterator, class OutputIterator>
-OutputIterator random_collinear_points_2(
-                       RandomAccessIterator first,
-                       RandomAccessIterator last,
-                       std::size_t n,
-                       OutputIterator first2)
-{
-    return  random_collinear_points_2( first, last, n, first2,
-                                       CGAL::get_default_random());
-}
-
-template < class P, class Creator = 
-Creator_uniform_2<typename Kernel_traits<P>::Kernel::RT,P> >
-class Random_points_in_triangle_2 : public Random_generator_base<P> {
-	P _p,_q,_r;
-	void generate_point();
-public:
-	typedef P result_type;
-	typedef Random_points_in_triangle_2<P> This;
-	typedef typename Kernel_traits<P>::Kernel::Triangle_2 Triangle_2;
-	Random_points_in_triangle_2() {}
-	Random_points_in_triangle_2( const This& x,Random& rnd = default_random)
-	: Random_generator_base<P>( 1, rnd ),_p(x._p),_q(x._q),_r(x._r) {
-		generate_point();
-	}
-	Random_points_in_triangle_2( const P& p, const P& q, const P& r, Random& rnd = default_random)
-	: Random_generator_base<P>( 1, rnd ),_p(p),_q(q),_r(r) {
-		generate_point();
-	}
-	Random_points_in_triangle_2( const Triangle_2& triangle,Random& rnd = default_random)
-	: Random_generator_base<P>( 1,
-			rnd),_p(triangle[0]),_q(triangle[1]),_r(triangle[2]) {
-		generate_point();
-	}
-	This& operator++() {
-		generate_point();
-		return *this;
-	}
-	This operator++(int) {
-		This tmp = *this;
-		++(*this);
-		return tmp;
-	}
-};
-	
-template<class P, class Creator >
-void Random_points_in_triangle_2<P, Creator>::generate_point() {
-	typedef typename Creator::argument_type T;
-	Creator creator;
-	double a1 = this->_rnd.get_double(0,1);
-	double a2 = this->_rnd.get_double(0,1);
-	if(a1>a2) std::swap(a1,a2);
-	double b1 = a1;
-	double b2 = a2-a1;
-	double b3 = 1.0-a2;
-	this->d_item = creator(T(to_double(_p.x())*b1+to_double(_q.x())*b2+to_double(_r.x())*b3),
-							T(to_double(_p.y())*b1+to_double(_q.y())*b2+to_double(_r.y())*b3));
-}
-
-} //namespace CGAL
-#endif // CGAL_POINT_GENERATORS_2_H //
-// EOF //
diff --git a/3rdparty/CGAL-4.8/include/CGAL/point_generators_3.h b/3rdparty/CGAL-4.8/include/CGAL/point_generators_3.h
deleted file mode 100644
index 5b9670c..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/point_generators_3.h
+++ /dev/null
@@ -1,309 +0,0 @@
-// Copyright (c) 1997  
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved. 
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Lutz Kettner  <kettner at inf.ethz.ch>
-//                 Pedro Machado Manhaes de Castro  <pmmc at cin.ufpe.br>
-//                 Alexandru Tifrea
-
-#ifndef CGAL_POINT_GENERATORS_3_H
-#define CGAL_POINT_GENERATORS_3_H 1
-#include <CGAL/generators.h>
-#include <CGAL/point_generators_2.h>
-#include <CGAL/number_type_basic.h>
-
-namespace CGAL {
-
-template < class P, class Creator = 
-                   Creator_uniform_3<typename Kernel_traits<P>::Kernel::RT,P> >
-class Random_points_in_sphere_3 : public Random_generator_base<P> {
-    void generate_point();
-public:
-    typedef Random_points_in_sphere_3<P,Creator> This;
-    Random_points_in_sphere_3( double r = 1, Random& rnd = CGAL::get_default_random())
-        // g is an input iterator creating points of type `P' uniformly
-        // distributed in the open sphere with radius r, i.e. |`*g'| < r .
-        // Three random numbers are needed from `rnd' for each point
-    : Random_generator_base<P>( r, rnd) { generate_point(); }
-    This& operator++()    {
-        generate_point();
-        return *this;
-    }
-    This  operator++(int) {
-        This tmp = *this;
-        ++(*this);
-        return tmp;
-    }
-};
-
-template < class P, class Creator >
-void
-Random_points_in_sphere_3<P,Creator>::
-generate_point() {
-  // A strip between z and z+dz has an area independant of z
-    typedef typename Creator::argument_type T;
-    double alpha = this->_rnd.get_double() * 2.0 * CGAL_PI;
-    double z     = 2 * this->_rnd.get_double() - 1.0;
-    double r     = std::sqrt( 1 - z * z);
-    r *= std::pow( this->_rnd.get_double() , 1.0/3.0 );  
-    Creator creator;
-    this->d_item = creator( T(this->d_range * r * std::cos(alpha)),
-                            T(this->d_range * r * std::sin(alpha)),
-                            T(this->d_range * z));
-}
-
-
-template < class P, class Creator = 
-                   Creator_uniform_3<typename Kernel_traits<P>::Kernel::RT,P> >
-class Random_points_on_sphere_3 : public Random_generator_base<P> {
-    void generate_point();
-public:
-    typedef Random_points_on_sphere_3<P,Creator> This;
-    Random_points_on_sphere_3( double r = 1, Random& rnd = CGAL::get_default_random())
-        // g is an input iterator creating points of type `P' uniformly
-        // distributed on the sphere with radius r, i.e. |`*g'| == r . A
-        // two random numbers are needed from `rnd' for each point.
-    : Random_generator_base<P>( r, rnd) { generate_point(); }
-    This& operator++()    {
-        generate_point();
-        return *this;
-    }
-    This  operator++(int) {
-        This tmp = *this;
-        ++(*this);
-        return tmp;
-    }
-};
-
-template < class P, class Creator >
-void
-Random_points_on_sphere_3<P,Creator>::
-generate_point() {
-  // A strip between z and z+dz has an area independant of z
-    typedef typename Creator::argument_type T;
-    double alpha = this->_rnd.get_double() * 2.0 * CGAL_PI;
-    double z     = 2 * this->_rnd.get_double() - 1.0;
-    double r     = std::sqrt( 1 - z * z);
-    Creator creator;
-    this->d_item = creator( T(this->d_range * r * std::cos(alpha)),
-                            T(this->d_range * r * std::sin(alpha)),
-                            T(this->d_range * z));
-}
-
-
-template < class P, class Creator = 
-                   Creator_uniform_3<typename Kernel_traits<P>::Kernel::RT,P> >
-class Random_points_in_cube_3 : public Random_generator_base<P>{
-    void generate_point();
-public:
-    typedef Random_points_in_cube_3<P,Creator> This;
-    Random_points_in_cube_3( double a = 1, Random& rnd = CGAL::get_default_random())
-    : Random_generator_base<P>( a, rnd) { generate_point(); }
-    This& operator++()    {
-        generate_point();
-        return *this;
-    }
-    This  operator++(int) {
-        This tmp = *this;
-        ++(*this);
-        return tmp;
-    }
-};
-
-template < class P, class Creator >
-void
-Random_points_in_cube_3<P,Creator>::
-generate_point() {
-    typedef typename Creator::argument_type T;
-    Creator creator;
-    this->d_item =
-	     creator( T(this->d_range * ( 2 * this->_rnd.get_double() - 1.0)),
-                      T(this->d_range * ( 2 * this->_rnd.get_double() - 1.0)),
-                      T(this->d_range * ( 2 * this->_rnd.get_double() - 1.0)));
-}
-
-
-template <class OutputIterator, class Creator>
-OutputIterator
-points_on_cube_grid_3( double a, std::size_t n, 
-                         OutputIterator o, Creator creator)
-{
-    if  (n == 0)
-        return o;
-
-    int m = int(std::ceil(
-                  std::sqrt(std::sqrt(static_cast<double>(n)))));
-
-    while (m*m*m < int(n)) m++;
-
-    double base = -a;  // Left and bottom boundary.
-    double step = 2*a/(m-1);
-    int j = 0;
-    int k = 0;
-    double px = base;
-    double py = base;
-    double pz = base;
-    *o++ = creator( px, py, pz);
-    for (std::size_t i = 1; i < n; i++) {
-        j++;
-        if ( j == m) {
-           k++;
-           if ( k == m) {
-              py = base;
-              px = base;
-              pz = pz + step;
-              k = 0;
-           }
-           else {
-              px = base;
-              py = py + step;
-           }
-           j = 0;
-        } else {
-           px = px + step;
-        }
-        *o++ = creator( px, py, pz);
-    }
-    return o;
-}
-
-template <class OutputIterator>
-OutputIterator
-points_on_cube_grid_3( double a, std::size_t n, OutputIterator o)
-{
-    typedef std::iterator_traits<OutputIterator> ITraits;
-    typedef typename ITraits::value_type         P;
-    return points_on_square_grid_3(a, n, o, 
-                 Creator_uniform_3<typename Kernel_traits<P>::Kernel::RT,P>());
-}
-
-template < class P, class Creator = 
-Creator_uniform_3<typename Kernel_traits<P>::Kernel::RT,P> >
-class Random_points_in_triangle_3 : public Random_generator_base<P> {
-	P _p,_q,_r;
-	void generate_point();
-public:
-	typedef P result_type;
-	typedef Random_points_in_triangle_3<P> This;
-	typedef typename Kernel_traits<P>::Kernel::Triangle_3 Triangle_3;
-	Random_points_in_triangle_3() {}
-	Random_points_in_triangle_3( const This& x,Random& rnd = default_random)
-	: Random_generator_base<P>( 1, rnd ),_p(x._p),_q(x._q),_r(x._r) {
-		generate_point();
-	}
-	Random_points_in_triangle_3( const P& p, const P& q, const P& r, Random& rnd = default_random)
-	: Random_generator_base<P>( 1, rnd ),_p(p),_q(q),_r(r) {
-		generate_point();
-	}
-	Random_points_in_triangle_3( const Triangle_3& triangle,Random& rnd = default_random)
-	: Random_generator_base<P>( 1,
-			rnd),_p(triangle[0]),_q(triangle[1]),_r(triangle[2]) {
-		generate_point();
-	}
-	This& operator++() {
-		generate_point();
-		return *this;
-	}
-	This operator++(int) {
-		This tmp = *this;
-		++(*this);
-		return tmp;
-	}
-};
-
-
-template<class P, class Creator >
-void Random_points_in_triangle_3<P, Creator>::generate_point() {
-	typedef typename Creator::argument_type T;
-	Creator creator;
-	double a1 = this->_rnd.get_double(0,1);
-	double a2 = this->_rnd.get_double(0,1);
-	if(a1>a2) std::swap(a1,a2);
-	double b1 = a1;
-	double b2 = a2-a1;
-	double b3 = 1.0-a2;
-	T ret[3];
-	for(int i = 0; i < 3; ++i) {
-	    ret[i] = T(to_double(_p[i])*b1+to_double(_q[i])*b2+to_double(_r[i])*b3);
-	}
-	this->d_item = creator(ret[0],ret[1],ret[2]);
-}
-
-template < class P, class Creator = 
-Creator_uniform_3<typename Kernel_traits<P>::Kernel::RT,P> >
-class Random_points_in_tetrahedron_3 : public Random_generator_base<P> {
-	P _p,_q,_r,_s;
-	void generate_point();
-public:
-	typedef P result_type;
-	typedef Random_points_in_tetrahedron_3<P> This;
-	typedef typename Kernel_traits<P>::Kernel::Tetrahedron_3 Tetrahedron_3;
-	Random_points_in_tetrahedron_3() {}
-	Random_points_in_tetrahedron_3( const This& x,Random& rnd = default_random)
-	: Random_generator_base<P>( 1, rnd ),_p(x._p),_q(x._q),_r(x._r),_s(x._s) {
-		generate_point();
-	}
-	Random_points_in_tetrahedron_3( const P& p, const P& q, const P& r, const P& s,Random& rnd = default_random)
-	: Random_generator_base<P>( 1, rnd ),_p(p),_q(q),_r(r),_s(s) {
-		generate_point();
-	}
-	Random_points_in_tetrahedron_3( const Tetrahedron_3& tetrahedron,Random& rnd = default_random)
-	: Random_generator_base<P>( 1, rnd),_p(tetrahedron[0]),_q(tetrahedron[1]),_r(tetrahedron[2]),_s(tetrahedron[3]) {
-		generate_point();
-	}
-	This& operator++() {
-		generate_point();
-		return *this;
-	}
-	This operator++(int) {
-		This tmp = *this;
-		++(*this);
-		return tmp;
-	}
-};
-
-template<class P, class Creator >
-void Random_points_in_tetrahedron_3<P, Creator>::generate_point() {
-	typedef typename Creator::argument_type T;
-	Creator creator;
-	double a[3];
-	for(int i = 0; i < 3; ++i) {
-		a[i]=this->_rnd.get_double(0,1);
-	}
-	std::sort(a,a+3);
-	double b[4];
-	b[0]=a[0];
-	b[1]=a[1]-a[0];
-	b[2]=a[2]-a[1];
-	b[3]=1.0-a[2];
-	T ret[3];
-	for(int i = 0; i < 3; ++i) {
-	    ret[i] = T(to_double(_p[i])*b[0]+to_double(_q[i])*b[1]+to_double(_r[i])*b[2]+to_double(_s[i])*b[3]);
-	}
-	this->d_item = creator(ret[0],ret[1],ret[2]);
-}
-
-
-
-} //namespace CGAL
-
-#endif // CGAL_POINT_GENERATORS_3_H //
-// EOF //
diff --git a/3rdparty/CGAL-4.8/include/CGAL/primes.h b/3rdparty/CGAL-4.8/include/CGAL/primes.h
deleted file mode 100644
index e1cf782..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/primes.h
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright (c) 2006-2008 Max-Planck-Institute Saarbruecken (Germany).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Michael Hemmer    <hemmer at mpi-inf.mpg.de>
-//
-// =============================================================================
-
-#ifndef CGAL_PRIMES_H
-#define CGAL_PRIMES_H
-
-#include <CGAL/basic.h>
-
-namespace CGAL { 
-namespace internal {
-CGAL_EXPORT extern const int primes[2000];
-
-static inline 
-int get_next_lower_prime(int current_prime){
-    bool is_prime = false;
-    
-    int i;
-    CGAL_precondition_msg(current_prime != 2 ," primes definitely exhausted ");
-
-    if((current_prime <= 7) && (current_prime > 2)){
-        if(current_prime <= 5){
-            if(current_prime == 3)
-                return 2;
-            return 3;
-        }
-        return 5;
-    }                
-    for(i=current_prime-2;(i>1 && !is_prime);i=i-2){
-        int r = 1;
-        for(int j=3; (j <= i/2 && (r != 0)); j++){
-            r = i % j;
-//                std::cout<<"i " <<i<<std::endl;
-//                std::cout<<"j " <<j<<std::endl;
-//                std::cout<<"i%j " <<i%j<<std::endl;
-            if(j==i/2 && r != 0)
-                is_prime = true;
-        }
-    }
-//    CGAL_precondition_msg(is_prime," primes definitely exhausted ");
-    return i+2;
-}
-
-
-}
-}
-
-#ifdef CGAL_HEADER_ONLY
-#include <CGAL/primes_impl.h>
-#endif // CGAL_HEADER_ONLY
-
-#endif // CGAL_PRIMES_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/primes_impl.h b/3rdparty/CGAL-4.8/include/CGAL/primes_impl.h
deleted file mode 100644
index 340b50b..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/primes_impl.h
+++ /dev/null
@@ -1,293 +0,0 @@
-// Copyright (c) Max-Planck-Institute Saarbruecken (Germany).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Michael Hemmer, Alexander Kobel
-
-#include <CGAL/basic.h>
-
-namespace CGAL {
-namespace internal {
-
-const int primes [2000] = {
-  /*
-   * Generated in SAGE with:
-   *
-   * N = 2000
-   * p = 2^26
-   * L = []
-   * while len(L) < N:
-   *   p = previous_prime(p)
-   *   if GF(p)(2).is_primitive_root():
-   *     L.append(p)
-   * k = 8
-   * for i in range(N/k):
-   *   print '  ' + ', '.join (str(p) for p in L[k*i:k*(i+1)]) + ','
-  */
-  67108859, 67108819, 67108763, 67108757, 67108747, 67108739, 67108709, 67108693,
-  67108669, 67108667, 67108661, 67108597, 67108579, 67108507, 67108493, 67108453,
-  67108387, 67108373, 67108331, 67108219, 67108187, 67108109, 67108037, 67108003,
-  67107941, 67107797, 67107787, 67107773, 67107757, 67107749, 67107707, 67107643,
-  67107541, 67107539, 67107533, 67107461, 67107427, 67107389, 67107323, 67107317,
-  67107301, 67107253, 67107203, 67107149, 67107043, 67106987, 67106821, 67106813,
-  67106797, 67106749, 67106717, 67106693, 67106483, 67106477, 67106357, 67106339,
-  67106323, 67106243, 67106213, 67106189, 67106107, 67106099, 67106093, 67106059,
-  67105963, 67105933, 67105877, 67105867, 67105811, 67105771, 67105763, 67105699,
-  67105691, 67105517, 67105459, 67105453, 67105373, 67105349, 67105267, 67105187,
-  67105141, 67105133, 67105061, 67104997, 67104931, 67104923, 67104893, 67104883,
-  67104859, 67104803, 67104757, 67104707, 67104691, 67104589, 67104581, 67104571,
-  67104563, 67104539, 67104517, 67104437, 67104419, 67104379, 67104341, 67104293,
-  67104277, 67104251, 67104227, 67104139, 67104061, 67104053, 67103963, 67103909,
-  67103867, 67103851, 67103837, 67103821, 67103731, 67103669, 67103653, 67103587,
-  67103579, 67103549, 67103507, 67103483, 67103219, 67103173, 67103149, 67103147,
-  67103107, 67103083, 67103051, 67103027, 67103021, 67102963, 67102949, 67102901,
-  67102843, 67102733, 67102627, 67102613, 67102531, 67102499, 67102459, 67102397,
-  67102333, 67102331, 67102283, 67102237, 67102181, 67102163, 67102099, 67102093,
-  67102069, 67102067, 67102019, 67101997, 67101989, 67101899, 67101883, 67101877,
-  67101779, 67101739, 67101691, 67101637, 67101613, 67101509, 67101493, 67101491,
-  67101469, 67101443, 67101413, 67101341, 67101323, 67101299, 67101187, 67101173,
-  67101053, 67100987, 67100981, 67100963, 67100947, 67100939, 67100909, 67100899,
-  67100861, 67100851, 67100827, 67100773, 67100731, 67100699, 67100669, 67100659,
-  67100653, 67100587, 67100459, 67100357, 67100347, 67100179, 67100141, 67100123,
-  67100101, 67099987, 67099957, 67099931, 67099861, 67099853, 67099829, 67099819,
-  67099699, 67099589, 67099547, 67099541, 67099517, 67099499, 67099397, 67099387,
-  67099363, 67099339, 67099267, 67099213, 67099141, 67099133, 67099037, 67098931,
-  67098923, 67098917, 67098907, 67098827, 67098821, 67098739, 67098653, 67098589,
-  67098419, 67098389, 67098347, 67098341, 67098323, 67098299, 67098277, 67098259,
-  67098203, 67098197, 67098179, 67098149, 67098067, 67098029, 67097917, 67097819,
-  67097813, 67097803, 67097747, 67097699, 67097669, 67097659, 67097579, 67097413,
-  67097363, 67097339, 67097333, 67097291, 67097269, 67097123, 67097053, 67096987,
-  67096979, 67096973, 67096907, 67096867, 67096837, 67096693, 67096669, 67096507,
-  67096499, 67096483, 67096411, 67096387, 67096373, 67096301, 67096109, 67096067,
-  67096021, 67096013, 67095989, 67095971, 67095893, 67095869, 67095797, 67095731,
-  67095701, 67095683, 67095667, 67095659, 67095629, 67095499, 67095421, 67095419,
-  67095349, 67095317, 67095173, 67095139, 67095131, 67095101, 67095037, 67095011,
-  67094987, 67094981, 67094917, 67094899, 67094891, 67094837, 67094827, 67094723,
-  67094717, 67094707, 67094701, 67094581, 67094557, 67094507, 67094501, 67094459,
-  67094437, 67094411, 67094389, 67094309, 67094299, 67094267, 67094141, 67094123,
-  67094099, 67093979, 67093933, 67093931, 67093861, 67093853, 67093757, 67093723,
-  67093699, 67093627, 67093619, 67093613, 67093603, 67093597, 67093547, 67093349,
-  67093307, 67093181, 67093171, 67093163, 67093157, 67093109, 67093069, 67093043,
-  67093003, 67092997, 67092947, 67092869, 67092821, 67092787, 67092757, 67092749,
-  67092709, 67092691, 67092643, 67092611, 67092563, 67092539, 67092491, 67092461,
-  67092419, 67092331, 67092323, 67092301, 67092227, 67092203, 67092197, 67092107,
-  67091987, 67091939, 67091933, 67091923, 67091797, 67091779, 67091771, 67091669,
-  67091611, 67091491, 67091477, 67091443, 67091357, 67091341, 67091243, 67091203,
-  67091149, 67091107, 67091029, 67090979, 67090973, 67090939, 67090861, 67090763,
-  67090627, 67090613, 67090589, 67090579, 67090549, 67090547, 67090523, 67090459,
-  67090451, 67090411, 67090403, 67090307, 67090259, 67090229, 67090189, 67090117,
-  67090099, 67090091, 67090043, 67090027, 67090013, 67089949, 67089829, 67089739,
-  67089733, 67089707, 67089683, 67089587, 67089541, 67089461, 67089299, 67089283,
-  67089277, 67089221, 67089059, 67088963, 67088821, 67088797, 67088779, 67088717,
-  67088683, 67088653, 67088627, 67088621, 67088603, 67088597, 67088573, 67088509,
-  67088501, 67088453, 67088429, 67088381, 67088347, 67088267, 67088117, 67088093,
-  67088059, 67087973, 67087957, 67087901, 67087883, 67087859, 67087723, 67087717,
-  67087637, 67087571, 67087547, 67087459, 67087451, 67087421, 67087277, 67087259,
-  67087243, 67087187, 67087123, 67087019, 67086949, 67086931, 67086917, 67086893,
-  67086869, 67086827, 67086757, 67086667, 67086637, 67086629, 67086611, 67086589,
-  67086421, 67086347, 67086323, 67086317, 67086307, 67086293, 67086259, 67086109,
-  67086067, 67086053, 67086043, 67086013, 67085939, 67085933, 67085899, 67085869,
-  67085867, 67085861, 67085819, 67085813, 67085803, 67085771, 67085741, 67085677,
-  67085531, 67085443, 67085437, 67085429, 67085357, 67085341, 67085267, 67085189,
-  67085173, 67085171, 67085099, 67085093, 67085003, 67084981, 67084973, 67084931,
-  67084861, 67084789, 67084757, 67084709, 67084643, 67084637, 67084603, 67084547,
-  67084517, 67084483, 67084427, 67084349, 67084333, 67084331, 67084309, 67084189,
-  67084187, 67084139, 67084013, 67083883, 67083859, 67083811, 67083803, 67083787,
-  67083739, 67083707, 67083629, 67083619, 67083613, 67083539, 67083517, 67083461,
-  67083437, 67083371, 67083323, 67083221, 67083197, 67083067, 67082989, 67082987,
-  67082963, 67082933, 67082909, 67082891, 67082861, 67082843, 67082779, 67082707,
-  67082699, 67082579, 67082549, 67082531, 67082453, 67082363, 67082339, 67082227,
-  67082189, 67082131, 67082123, 67082101, 67082003, 67081957, 67081829, 67081811,
-  67081787, 67081741, 67081733, 67081709, 67081691, 67081661, 67081579, 67081499,
-  67081477, 67081429, 67081283, 67081237, 67081213, 67081211, 67081139, 67081123,
-  67081051, 67080971, 67080947, 67080917, 67080859, 67080821, 67080803, 67080763,
-  67080701, 67080653, 67080557, 67080491, 67080437, 67080413, 67080323, 67080179,
-  67080173, 67080131, 67080107, 67080061, 67079981, 67079963, 67079941, 67079933,
-  67079917, 67079693, 67079587, 67079491, 67079459, 67079429, 67079347, 67079333,
-  67079323, 67079317, 67079267, 67079237, 67079219, 67079213, 67079203, 67079149,
-  67079141, 67079123, 67079083, 67079027, 67078981, 67078931, 67078877, 67078819,
-  67078813, 67078789, 67078763, 67078643, 67078573, 67078469, 67078387, 67078331,
-  67078309, 67078301, 67078283, 67078213, 67078181, 67078139, 67078133, 67078069,
-  67078061, 67078013, 67077947, 67077917, 67077851, 67077827, 67077797, 67077757,
-  67077643, 67077611, 67077541, 67077539, 67077419, 67077403, 67077379, 67077349,
-  67077341, 67077299, 67077293, 67077259, 67077181, 67077173, 67077133, 67076899,
-  67076869, 67076851, 67076843, 67076803, 67076773, 67076741, 67076693, 67076683,
-  67076677, 67076651, 67076629, 67076627, 67076573, 67076539, 67076413, 67076411,
-  67076357, 67076341, 67076291, 67076189, 67076147, 67076117, 67076077, 67076069,
-  67076029, 67075973, 67075949, 67075933, 67075907, 67075867, 67075787, 67075691,
-  67075669, 67075573, 67075493, 67075373, 67075363, 67075277, 67075243, 67075147,
-  67075109, 67075091, 67075069, 67075067, 67075037, 67074947, 67074901, 67074859,
-  67074853, 67074851, 67074829, 67074691, 67074619, 67074613, 67074611, 67074587,
-  67074523, 67074467, 67074317, 67074307, 67074277, 67074269, 67074179, 67073947,
-  67073917, 67073899, 67073803, 67073731, 67073707, 67073701, 67073683, 67073651,
-  67073603, 67073597, 67073579, 67073533, 67073459, 67073387, 67073339, 67073333,
-  67073323, 67073309, 67073261, 67073197, 67073189, 67073107, 67073051, 67073003,
-  67072997, 67072979, 67072909, 67072877, 67072781, 67072757, 67072739, 67072693,
-  67072541, 67072373, 67072363, 67072339, 67072309, 67072283, 67072277, 67072253,
-  67072139, 67072037, 67071997, 67071989, 67071947, 67071923, 67071899, 67071883,
-  67071877, 67071821, 67071707, 67071637, 67071547, 67071419, 67071413, 67071317,
-  67071299, 67071293, 67071157, 67071149, 67071139, 67071061, 67070989, 67070981,
-  67070909, 67070869, 67070837, 67070827, 67070813, 67070803, 67070749, 67070699,
-  67070621, 67070573, 67070539, 67070459, 67070357, 67070317, 67070291, 67070261,
-  67070251, 67070203, 67070053, 67070027, 67069979, 67069819, 67069813, 67069787,
-  67069781, 67069763, 67069669, 67069661, 67069549, 67069531, 67069469, 67069427,
-  67069397, 67069339, 67069157, 67069133, 67069109, 67069099, 67069043, 67069021,
-  67068971, 67068931, 67068787, 67068653, 67068643, 67068629, 67068571, 67068557,
-  67068539, 67068509, 67068493, 67068371, 67068301, 67068269, 67068259, 67068227,
-  67068203, 67068187, 67068181, 67068173, 67068163, 67068101, 67067971, 67067933,
-  67067909, 67067789, 67067779, 67067773, 67067723, 67067629, 67067597, 67067501,
-  67067453, 67067437, 67067389, 67067387, 67067339, 67067293, 67067269, 67067213,
-  67067173, 67067171, 67067069, 67067059, 67067029, 67066907, 67066861, 67066859,
-  67066771, 67066757, 67066723, 67066709, 67066667, 67066619, 67066613, 67066379,
-  67066277, 67066243, 67066211, 67066157, 67066093, 67066061, 67066019, 67065979,
-  67065931, 67065917, 67065883, 67065827, 67065787, 67065667, 67065659, 67065653,
-  67065643, 67065619, 67065563, 67065461, 67065437, 67065389, 67065373, 67065293,
-  67065283, 67065227, 67065211, 67065157, 67065091, 67064843, 67064827, 67064819,
-  67064773, 67064771, 67064741, 67064717, 67064693, 67064611, 67064597, 67064587,
-  67064579, 67064549, 67064467, 67064299, 67064267, 67064237, 67064213, 67064197,
-  67064171, 67064147, 67064131, 67064093, 67064059, 67063853, 67063813, 67063723,
-  67063643, 67063637, 67063523, 67063517, 67063397, 67063349, 67063307, 67063189,
-  67063163, 67063133, 67063123, 67063099, 67063093, 67063069, 67063043, 67063037,
-  67063019, 67062923, 67062893, 67062883, 67062859, 67062659, 67062629, 67062613,
-  67062539, 67062509, 67062469, 67062461, 67062379, 67062349, 67062299, 67062221,
-  67062179, 67062157, 67062067, 67062029, 67062011, 67061987, 67061947, 67061933,
-  67061909, 67061867, 67061861, 67061789, 67061747, 67061693, 67061627, 67061597,
-  67061563, 67061531, 67061333, 67061299, 67061227, 67061219, 67061179, 67061173,
-  67061147, 67061003, 67060997, 67060957, 67060949, 67060933, 67060837, 67060813,
-  67060627, 67060549, 67060523, 67060517, 67060507, 67060451, 67060421, 67060373,
-  67060333, 67060307, 67060277, 67060261, 67060229, 67060187, 67060171, 67060141,
-  67060109, 67060067, 67060043, 67060027, 67060013, 67059989, 67059907, 67059899,
-  67059869, 67059779, 67059757, 67059749, 67059731, 67059709, 67059701, 67059637,
-  67059613, 67059581, 67059547, 67059533, 67059523, 67059437, 67059427, 67059259,
-  67059173, 67059061, 67058963, 67058941, 67058909, 67058899, 67058891, 67058867,
-  67058843, 67058723, 67058699, 67058669, 67058627, 67058531, 67058389, 67058347,
-  67058339, 67058323, 67058309, 67058269, 67058227, 67058213, 67058141, 67058003,
-  67057883, 67057853, 67057819, 67057813, 67057763, 67057733, 67057723, 67057717,
-  67057709, 67057643, 67057499, 67057493, 67057387, 67057381, 67057379, 67057363,
-  67057307, 67057147, 67057141, 67056989, 67056971, 67056917, 67056877, 67056763,
-  67056677, 67056667, 67056659, 67056637, 67056611, 67056581, 67056461, 67056419,
-  67056371, 67056259, 67056251, 67056179, 67056107, 67056083, 67056053, 67056043,
-  67056013, 67055957, 67055909, 67055843, 67055789, 67055771, 67055629, 67055539,
-  67055491, 67055477, 67055467, 67055347, 67055309, 67055299, 67055291, 67055267,
-  67055243, 67055203, 67055179, 67055147, 67054997, 67054979, 67054907, 67054877,
-  67054859, 67054763, 67054733, 67054717, 67054541, 67054523, 67054483, 67054411,
-  67054387, 67054301, 67054213, 67054051, 67054037, 67053997, 67053971, 67053941,
-  67053893, 67053787, 67053733, 67053659, 67053653, 67053643, 67053629, 67053619,
-  67053563, 67053557, 67053523, 67053517, 67053419, 67053397, 67053373, 67053317,
-  67053251, 67053229, 67053197, 67053179, 67053149, 67053037, 67053029, 67052963,
-  67052939, 67052933, 67052819, 67052813, 67052779, 67052723, 67052677, 67052509,
-  67052477, 67052467, 67052243, 67052021, 67051979, 67051949, 67051909, 67051883,
-  67051861, 67051813, 67051811, 67051781, 67051709, 67051651, 67051643, 67051573,
-  67051571, 67051547, 67051493, 67051379, 67051373, 67051331, 67051253, 67051189,
-  67051181, 67051099, 67051069, 67051021, 67050979, 67050931, 67050917, 67050869,
-  67050827, 67050749, 67050707, 67050701, 67050619, 67050611, 67050541, 67050509,
-  67050443, 67050421, 67050419, 67050371, 67050301, 67050299, 67050251, 67050187,
-  67050101, 67050077, 67049987, 67049981, 67049963, 67049909, 67049891, 67049867,
-  67049837, 67049813, 67049747, 67049707, 67049693, 67049629, 67049627, 67049603,
-  67049573, 67049539, 67049453, 67049413, 67049267, 67049261, 67049251, 67049179,
-  67049149, 67049141, 67049093, 67049027, 67048963, 67048859, 67048819, 67048757,
-  67048733, 67048693, 67048627, 67048621, 67048523, 67048469, 67048411, 67048349,
-  67048277, 67048259, 67048141, 67048123, 67048109, 67047989, 67047859, 67047787,
-  67047763, 67047749, 67047733, 67047731, 67047683, 67047619, 67047613, 67047611,
-  67047581, 67047517, 67047509, 67047413, 67047397, 67047283, 67047131, 67047077,
-  67047061, 67047059, 67047053, 67047037, 67047011, 67046989, 67046939, 67046899,
-  67046797, 67046779, 67046731, 67046549, 67046531, 67046477, 67046467, 67046437,
-  67046429, 67046411, 67046387, 67046363, 67046341, 67046333, 67046261, 67046197,
-  67046107, 67046069, 67046059, 67046051, 67045973, 67045949, 67045907, 67045877,
-  67045723, 67045613, 67045579, 67045571, 67045549, 67045541, 67045507, 67045403,
-  67045339, 67045301, 67045267, 67045261, 67045211, 67045189, 67045133, 67045117,
-  67045109, 67045061, 67045037, 67045019, 67044973, 67044907, 67044829, 67044797,
-  67044779, 67044773, 67044763, 67044739, 67044541, 67044427, 67044371, 67044347,
-  67044301, 67044283, 67044203, 67044157, 67044083, 67044077, 67044067, 67044053,
-  67043981, 67043939, 67043909, 67043813, 67043797, 67043707, 67043507, 67043477,
-  67043443, 67043243, 67043147, 67043107, 67043083, 67043069, 67043059, 67043051,
-  67043027, 67042979, 67042973, 67042949, 67042931, 67042709, 67042643, 67042637,
-  67042589, 67042571, 67042541, 67042523, 67042501, 67042453, 67042427, 67042363,
-  67042307, 67042301, 67042259, 67042211, 67042091, 67042043, 67041907, 67041893,
-  67041869, 67041797, 67041749, 67041731, 67041701, 67041613, 67041581, 67041563,
-  67041547, 67041539, 67041509, 67041467, 67041461, 67041419, 67041371, 67041307,
-  67041283, 67041269, 67041203, 67041187, 67041179, 67041043, 67040917, 67040893,
-  67040789, 67040773, 67040723, 67040629, 67040627, 67040621, 67040587, 67040549,
-  67040509, 67040443, 67040387, 67040381, 67040317, 67040291, 67040261, 67040243,
-  67040219, 67040203, 67040069, 67040021, 67039997, 67039957, 67039883, 67039877,
-  67039867, 67039853, 67039811, 67039757, 67039723, 67039699, 67039669, 67039627,
-  67039613, 67039571, 67039547, 67039501, 67039499, 67039309, 67039307, 67039253,
-  67039187, 67039139, 67039051, 67039003, 67038947, 67038941, 67038877, 67038869,
-  67038827, 67038787, 67038739, 67038637, 67038589, 67038557, 67038539, 67038533,
-  67038427, 67038371, 67038341, 67038299, 67038277, 67038221, 67038197, 67038173,
-  67038149, 67038133, 67038131, 67038067, 67038029, 67038011, 67037843, 67037837,
-  67037819, 67037797, 67037771, 67037723, 67037683, 67037627, 67037603, 67037563,
-  67037483, 67037459, 67037429, 67037389, 67037261, 67037227, 67037213, 67037107,
-  67037101, 67037053, 67036979, 67036909, 67036901, 67036877, 67036867, 67036843,
-  67036819, 67036811, 67036747, 67036643, 67036589, 67036547, 67036507, 67036469,
-  67036397, 67036379, 67036357, 67036259, 67036243, 67036187, 67036181, 67036157,
-  67036093, 67036027, 67036019, 67035989, 67035949, 67035931, 67035901, 67035803,
-  67035707, 67035659, 67035653, 67035643, 67035589, 67035499, 67035491, 67035469,
-  67035413, 67035349, 67035347, 67035307, 67035277, 67035149, 67035107, 67035077,
-  67034987, 67034819, 67034699, 67034683, 67034677, 67034477, 67034419, 67034381,
-  67034339, 67034309, 67034293, 67034171, 67034117, 67034069, 67034021, 67033859,
-  67033763, 67033741, 67033709, 67033699, 67033667, 67033619, 67033613, 67033597,
-  67033541, 67033507, 67033469, 67033429, 67033403, 67033357, 67033331, 67033283,
-  67033277, 67033229, 67033157, 67033117, 67033061, 67032997, 67032941, 67032811,
-  67032803, 67032701, 67032661, 67032653, 67032613, 67032587, 67032541, 67032523,
-  67032517, 67032491, 67032461, 67032451, 67032443, 67032421, 67032389, 67032349,
-  67032347, 67032299, 67032221, 67032179, 67032101, 67031941, 67031933, 67031893,
-  67031851, 67031819, 67031813, 67031749, 67031693, 67031509, 67031483, 67031443,
-  67031429, 67031387, 67031243, 67031219, 67031203, 67031189, 67031149, 67031147,
-  67031123, 67031101, 67031059, 67030963, 67030933, 67030907, 67030867, 67030853,
-  67030757, 67030741, 67030739, 67030693, 67030669, 67030597, 67030517, 67030451,
-  67030427, 67030333, 67030331, 67030181, 67030069, 67030013, 67029947, 67029931,
-  67029923, 67029917, 67029901, 67029811, 67029779, 67029763, 67029749, 67029709,
-  67029707, 67029581, 67029541, 67029509, 67029491, 67029451, 67029437, 67029427,
-  67029421, 67029373, 67029341, 67029323, 67029293, 67029269, 67029253, 67029229,
-  67029077, 67029059, 67029043, 67029013, 67028981, 67028917, 67028771, 67028669,
-  67028653, 67028651, 67028597, 67028557, 67028539, 67028477, 67028413, 67028387,
-  67028243, 67028197, 67028083, 67028069, 67028021, 67027997, 67027963, 67027949,
-  67027931, 67027867, 67027861, 67027811, 67027693, 67027627, 67027619, 67027547,
-  67027507, 67027453, 67027427, 67027339, 67027283, 67027237, 67027189, 67027187,
-  67027069, 67027027, 67027019, 67027013, 67026979, 67026907, 67026829, 67026811,
-  67026803, 67026787, 67026643, 67026613, 67026539, 67026469, 67026467, 67026451,
-  67026437, 67026403, 67026307, 67026299, 67026227, 67026187, 67026139, 67026131,
-  67026109, 67026107, 67026083, 67026067, 67025971, 67025963, 67025957, 67025843,
-  67025779, 67025773, 67025723, 67025701, 67025683, 67025669, 67025579, 67025573,
-  67025531, 67025501, 67025459, 67025411, 67025363, 67025219, 67025213, 67025173,
-  67025107, 67025051, 67025029, 67024987, 67024957, 67024901, 67024891, 67024733,
-  67024637, 67024621, 67024613, 67024499, 67024483, 67024429, 67024411, 67024339,
-  67024157, 67024141, 67024003, 67023989, 67023899, 67023893, 67023779, 67023763,
-  67023667, 67023653, 67023493, 67023443, 67023421, 67023419, 67023371, 67023349,
-  67023347, 67023331, 67023293, 67023259, 67023227, 67023211, 67023179, 67023157,
-  67023139, 67023133, 67023091, 67023059, 67023053, 67023043, 67023037, 67023029,
-  67022869, 67022819, 67022797, 67022723, 67022707, 67022701, 67022699, 67022693,
-  67022539, 67022507, 67022477, 67022467, 67022387, 67022261, 67022243, 67022237,
-  67022213, 67022147, 67022077, 67022027, 67021979, 67021963, 67021901, 67021861,
-  67021741, 67021739, 67021723, 67021637, 67021621, 67021613, 67021499, 67021469,
-  67021459, 67021363, 67021301, 67021237, 67021147, 67021139, 67021099, 67021067,
-  67021043, 67020979, 67020973, 67020917, 67020893, 67020869, 67020797, 67020763,
-  67020683, 67020589, 67020587, 67020557, 67020491, 67020397, 67020323, 67020299,
-  67020251, 67020179, 67020077, 67020053, 67020013, 67019963, 67019867, 67019837,
-  67019819, 67019747, 67019741, 67019653, 67019587, 67019549, 67019483, 67019437,
-  67019371, 67019299, 67019123, 67019077, 67019027, 67019003, 67018997, 67018843,
-  67018837, 67018771, 67018733, 67018717, 67018667, 67018613, 67018499, 67018493,
-  67018429, 67018397, 67018387, 67018309, 67018181, 67018163, 67018141, 67018139,
-  67018069, 67018051, 67017971, 67017931, 67017803, 67017763, 67017733, 67017707,
-  67017677, 67017661, 67017659, 67017571, 67017563, 67017547, 67017413, 67017371,
-  67017299, 67017277, 67017227, 67017211, 67017163, 67017157, 67017107, 67017059,
-  67016869, 67016821, 67016813, 67016723, 67016717, 67016707, 67016693, 67016627,
-  67016611, 67016483, 67016437, 67016387, 67016269, 67016197, 67016189, 67016179,
-};
-
-} // namespace internal
-} // namespace CGAL
diff --git a/3rdparty/CGAL-4.8/include/CGAL/property_map.h b/3rdparty/CGAL-4.8/include/CGAL/property_map.h
deleted file mode 100644
index a4a8f87..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/property_map.h
+++ /dev/null
@@ -1,396 +0,0 @@
-// Copyright (c) 2008-2009 GeometryFactory and INRIA
-// 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
-// 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(s)     : Andreas Fabri and Laurent Saboret
-
-#ifndef CGAL_POINT_SET_PROPERTY_MAP_H
-#define CGAL_POINT_SET_PROPERTY_MAP_H
-
-#include <CGAL/value_type_traits.h>
-
-#include <boost/version.hpp>
-#if BOOST_VERSION >= 104000
-  #include <boost/property_map/property_map.hpp>
-#else
-  #include <boost/property_map.hpp>
-  #include <boost/vector_property_map.hpp>
-
-#endif
-#include <boost/tuple/tuple.hpp>
-
-#include <utility> // defines std::pair
-
-namespace CGAL {
-
-
-/// \cond SKIP_DOXYGEN
-
-
-template <typename PM1, typename PM2>
-class OR_property_map {
-  typedef typename PM1::key_type key_type;
-  typedef typename PM1::value_type value_type;
-  typedef typename PM1::reference reference;
-  typedef boost::read_write_property_map_tag category;
-
-  PM1 pm1;
-  PM2 pm2;
-
- public:
-  OR_property_map(PM1 pm1, PM2 pm2)
-    : pm1(pm1),pm2(pm2)
-  {}
-
-  inline friend
-    value_type
-    get(const OR_property_map& pm, const key_type& k)
-  {
-    return get(pm.pm1,k) || get(pm.pm2,k);
-  }
-
-  inline friend
-    void
-  put(OR_property_map& pm, const key_type& k, const value_type& v)
-  {
-    put(pm.pm1,k, v);
-    put(pm.pm2,k, v);
-  }
-
-};
-
-/// Property map that accesses a value from an iterator
-///
-/// \cgalModels `ReadablePropertyMap`
-///
-/// \tparam InputIterator an input iterator
-/// \endcond
-template<class InputIterator>
-struct Input_iterator_property_map{
-  typedef InputIterator key_type;
-  typedef typename std::iterator_traits<InputIterator>::value_type value_type;
-  typedef typename std::iterator_traits<InputIterator>::reference reference;
-  typedef boost::readable_property_map_tag category;
-
-  /// Free function to use a get the value from an iterator using Input_iterator_property_map.
-  inline friend
-  typename std::iterator_traits<InputIterator>::reference
-  get(Input_iterator_property_map<InputIterator>,InputIterator it){ return *it; }
-};
-
-/// \ingroup PkgProperty_map
-/// Property map that converts a `T*` pointer (or in general an iterator
-/// over `T` elements) to the `T` object.
-///
-/// \cgalModels `LvaluePropertyMap`
-template <typename T>
-struct Dereference_property_map
-  : public boost::put_get_helper<T&, Dereference_property_map<T> >
-{
-  typedef T* key_type; ///< typedef to 'T*'
-  typedef T value_type; ///< typedef to 'T'
-  typedef value_type& reference; ///< typedef to 'T&'
-  typedef boost::lvalue_property_map_tag category; ///< `boost::lvalue_property_map_tag`
-
-  /// Access a property map element.
-  ///
-  /// @tparam Iter Type convertible to `key_type`.
-  template <class Iter>
-  reference operator[](Iter it) const { return reference(*it); }
-};
-
-/// Free function to create a `Dereference_property_map` property map.
-///
-/// \relates Dereference_property_map 
-template <class Iter> // Type convertible to `key_type`
-Dereference_property_map<typename CGAL::value_type_traits<Iter>::type>
-make_dereference_property_map(Iter)
-{
-  // value_type_traits is a workaround as back_insert_iterator's `value_type` is void
-  return Dereference_property_map<typename CGAL::value_type_traits<Iter>::type>();
-}
-
-/// \ingroup PkgProperty_map
-/// A `LvaluePropertyMap` property map mapping a key to itself (by reference).
-///
-/// \cgalModels `LvaluePropertyMap`
-template <typename T>
-struct Identity_property_map
-{
-  typedef T key_type; ///< typedef to `T`
-  typedef T value_type; ///< typedef to `T`
-  typedef T& reference; ///< typedef to `T&`
-  typedef boost::lvalue_property_map_tag category; ///< `boost::lvalue_property_map_tag`
-  /// Access a property map element.
-  /// @param k a key which is returned as mapped value.
-  reference operator[](key_type& k) const { return k; }
-
-  typedef Identity_property_map<T> Self;
-  /// \name Put/get free functions
-  /// @{
-  friend const value_type& get(const Self&,const key_type& k) {return k;}
-  friend         reference get(const Self&,      key_type& k) {return k;}
-  friend void put(const Self&,key_type& k, const value_type& v) {k=v;}
-  /// @}
-};
-
-/// Free function to create a `Identity_property_map` property map.
-///
-/// \relates Identity_property_map 
-template <class T> // Key and value type
-Identity_property_map<T>
-  make_identity_property_map(T)
-{
-  return Identity_property_map<T>();
-}
-
-
-//=========================================================================
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-/// \ingroup PkgProperty_map
-/// Property map that accesses the first item of a `std::pair`. 
-/// \tparam Pair Instance of `std::pair`. 
-/// \cgalModels `LvaluePropertyMap`
-///
-/// \sa `CGAL::Second_of_pair_property_map<Pair>`
-template <typename Pair>
-struct First_of_pair_property_map
-  : public boost::put_get_helper<typename Pair::first_type&,
-                                 First_of_pair_property_map<Pair> >
-{
-  typedef Pair* key_type; ///< typedef to `Pair*`
-  typedef typename Pair::first_type value_type; ///< typedef to `Pair::first_type`
-  typedef value_type& reference; ///< typedef to `value_type&`
-  typedef boost::lvalue_property_map_tag category; ///< boost::lvalue_property_map_tag
-
-  /// Access a property map element.
-  ///
-  /// @tparam Iter Type convertible to `key_type`.
-  template <class Iter>
-  reference operator[](Iter pair) const { return reference(pair->first); }
-};
-
-/// Free function to create a `First_of_pair_property_map` property map. 
-///
-/// \relates First_of_pair_property_map 
-template <class Iter> // Type convertible to key_type
-First_of_pair_property_map<typename CGAL::value_type_traits<Iter>::type>
-  make_first_of_pair_property_map(Iter)
-{
-  // value_type_traits is a workaround as back_insert_iterator's value_type is void
-  return First_of_pair_property_map<typename CGAL::value_type_traits<Iter>::type>();
-}
-#else
-/// \ingroup PkgProperty_map
-/// Property map that accesses the first item of a `std::pair`. 
-/// \tparam Pair Instance of `std::pair`. 
-/// \cgalModels `LvaluePropertyMap`
-///
-/// \sa `CGAL::Second_of_pair_property_map<Pair>`
-template <typename Pair>
-struct First_of_pair_property_map
-{
-  typedef Pair key_type; ///< typedef to `Pair`
-  typedef typename Pair::first_type value_type; ///< typedef to `Pair::first_type`
-  typedef value_type& reference; ///< typedef to `value_type&`
-  typedef boost::lvalue_property_map_tag category; ///< boost::lvalue_property_map_tag
-
-  /// Access a property map element.
-  /// @param pair a key whose first item is accessed
-  reference operator[](key_type& pair) const { return pair.first; }
-
-  typedef First_of_pair_property_map<Pair> Self;
-  /// \name Put/get free functions
-  /// @{
-  friend const value_type& get(const Self&,const key_type& k) {return k.first;}
-  friend         reference get(const Self&,      key_type& k) {return k.first;}
-  friend void put(const Self&,key_type& k, const value_type& v) {k.first=v;}
-  /// @}
-};
-
-/// Free function to create a `First_of_pair_property_map` property map. 
-///
-/// \relates First_of_pair_property_map 
-template <class Pair> // Pair type
-First_of_pair_property_map<Pair>
-  make_first_of_pair_property_map(Pair)
-{
-  return First_of_pair_property_map<Pair>();
-}
-#endif
-
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-/// \ingroup PkgProperty_map
-/// 
-/// Property map that accesses the second item of a `std::pair`. 
-/// 
-/// \tparam Pair Instance of `std::pair`. 
-/// 
-/// \cgalModels `LvaluePropertyMap`
-/// 
-/// \sa `CGAL::First_of_pair_property_map<Pair>`
-template <typename Pair>
-struct Second_of_pair_property_map
-  : public boost::put_get_helper<typename Pair::second_type&,
-                                 Second_of_pair_property_map<Pair> >
-{
-  typedef Pair* key_type; ///< typedef to `Pair*`
-  typedef typename Pair::second_type value_type; ///< typedef to `Pair::second_type`
-  typedef value_type& reference; ///< typedef to `value_type&`
-  typedef boost::lvalue_property_map_tag category; ///< `boost::lvalue_property_map_tag`
-
-  /// Access a property map element.
-  ///
-  /// @tparam Iter Type convertible to `key_type`.
-  template <class Iter>
-  reference operator[](Iter pair) const { return reference(pair->second); }
-};
-
-/// Free function to create a Second_of_pair_property_map property map.
-///
-/// \relates Second_of_pair_property_map 
-template <class Iter> // Type convertible to key_type
-Second_of_pair_property_map<typename CGAL::value_type_traits<Iter>::type>
-  make_second_of_pair_property_map(Iter)
-{
-  // value_type_traits is a workaround as back_insert_iterator's value_type is void
-  return Second_of_pair_property_map<typename CGAL::value_type_traits<Iter>::type>();
-}
-#else
-/// \ingroup PkgProperty_map
-/// 
-/// Property map that accesses the second item of a `std::pair`. 
-/// 
-/// \tparam Pair Instance of `std::pair`. 
-/// 
-/// \cgalModels `LvaluePropertyMap`
-/// 
-/// \sa `CGAL::First_of_pair_property_map<Pair>`
-template <typename Pair>
-struct Second_of_pair_property_map
-{
-  typedef Pair key_type; ///< typedef to `Pair`
-  typedef typename Pair::second_type value_type; ///< typedef to `Pair::first_type`
-  typedef value_type& reference; ///< typedef to `value_type&`
-  typedef boost::lvalue_property_map_tag category; ///< boost::lvalue_property_map_tag
-
-  /// Access a property map element.
-  /// @param pair a key whose second item is accessed
-  reference operator[](key_type& pair) const { return pair.second; }
-
-  typedef Second_of_pair_property_map<Pair> Self;
-  /// \name Put/get free functions
-  /// @{
-  friend const value_type& get(const Self&,const key_type& k) {return k.second;}
-  friend         reference get(const Self&,      key_type& k) {return k.second;}
-  friend void put(const Self&,key_type& k, const value_type& v) {k.second=v;}
-  /// @}
-};
-
-/// Free function to create a Second_of_pair_property_map property map.
-///
-/// \relates Second_of_pair_property_map 
-template <class Pair> // Pair type
-Second_of_pair_property_map<Pair>
-  make_second_of_pair_property_map(Pair)
-{
-  return Second_of_pair_property_map<Pair>();
-}
-#endif
-
-
-
-//=========================================================================
-
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-/// \ingroup PkgProperty_map
-/// 
-/// Property map that accesses the Nth item of a `boost::tuple`. 
-/// 
-/// \tparam N %Index of the item to access.
-/// \tparam Tuple Instance of `boost::tuple`.
-/// 
-/// \cgalModels `LvaluePropertyMap`
-template <int N, typename Tuple>
-struct Nth_of_tuple_property_map
-  : public boost::put_get_helper<typename boost::tuples::element<N,Tuple>::type&,
-                                 Nth_of_tuple_property_map<N,Tuple> >
-{
-  typedef Tuple* key_type; ///< typedef to `Tuple*`
-  typedef typename boost::tuples::element<N,Tuple>::type value_type; ///< typedef to `boost::tuples::element<N,Tuple>::%type`
-  typedef value_type& reference; ///< typedef to `value_type&`
-  typedef boost::lvalue_property_map_tag category; ///< `boost::lvalue_property_map_tag`
-
-  /// Access a property map element.
-  ///
-  /// @tparam Iter Type convertible to `key_type`.
-  template <class Iter>
-  reference operator[](Iter tuple) const { return (reference) tuple->template get<N>(); }
-};
-
-/// Free function to create a Nth_of_tuple_property_map property map.
-///
-/// \relates Nth_of_tuple_property_map
-template <int N, class Iter> // Type convertible to key_type
-Nth_of_tuple_property_map<N, typename CGAL::value_type_traits<Iter>::type>
-  make_nth_of_tuple_property_map(Iter)
-{
-  // value_type_traits is a workaround as back_insert_iterator's `value_type` is void
-  return Nth_of_tuple_property_map<N, typename CGAL::value_type_traits<Iter>::type>();
-}
-#else
-/// \ingroup PkgProperty_map
-/// 
-/// Property map that accesses the Nth item of a `boost::tuple`. 
-/// 
-/// \tparam N %Index of the item to access.
-/// \tparam Tuple Instance of `boost::tuple`.
-/// 
-/// \cgalModels `LvaluePropertyMap`
-template <int N, typename Tuple>
-struct Nth_of_tuple_property_map
-{
-  typedef Tuple key_type; ///< typedef to `Tuple`
-  typedef typename boost::tuples::element<N,Tuple>::type value_type; ///< typedef to `boost::tuples::element<N,Tuple>::%type`
-  typedef value_type& reference; ///< typedef to `value_type&`
-  typedef boost::lvalue_property_map_tag category; ///< `boost::lvalue_property_map_tag`
-  /// Access a property map element.
-  /// @param tuple a key whose Nth item is accessed
-  reference operator[](key_type& tuple) const { return tuple.template get<N>(); }
-
-  typedef Nth_of_tuple_property_map<N,Tuple> Self;
-  /// \name Put/get free functions
-  /// @{
-  friend const value_type& get(const Self&,const key_type& k) {return k.template get<N>();}
-  friend         reference get(const Self&,      key_type& k) {return k.template get<N>();}
-  friend void put(const Self&,key_type& k, const value_type& v) {k.template get<N>()=v;}
-  /// @}
-};
-
-/// Free function to create a Nth_of_tuple_property_map property map.
-///
-/// \relates Nth_of_tuple_property_map
-template <int N, class Tuple> // Tuple type
-Nth_of_tuple_property_map<N, Tuple>
-  make_nth_of_tuple_property_map(Tuple)
-{
-  return Nth_of_tuple_property_map<N, Tuple>();
-}
-#endif
-
-} // namespace CGAL
-
-#endif // CGAL_POINT_SET_PROPERTY_MAP_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/radial_orient_normals.h b/3rdparty/CGAL-4.8/include/CGAL/radial_orient_normals.h
deleted file mode 100644
index 8a5e728..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/radial_orient_normals.h
+++ /dev/null
@@ -1,197 +0,0 @@
-// Copyright (c) 2007-08  INRIA Sophia-Antipolis (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
-// 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(s) : Laurent Saboret
-
-#ifndef CGAL_RADIAL_ORIENT_NORMALS_H
-#define CGAL_RADIAL_ORIENT_NORMALS_H
-
-#include <CGAL/Origin.h>
-#include <CGAL/trace.h>
-#include <CGAL/property_map.h>
-#include <CGAL/point_set_processing_assertions.h>
-
-#include <deque>
-#include <math.h>
-
-namespace CGAL {
-
-/// \cond SKIP_IN_MANUAL
-
-/// Radial orientation of the `[first, beyond)` range of points.
-/// Normals are oriented towards exterior of the point set.
-/// This very fast method is intended to convex objects.
-///
-/// This method modifies the order of input points so as to pack all oriented points first,
-/// and returns an iterator over the first point with an unoriented normal (see erase-remove idiom).
-/// For this reason it should not be called on sorted containers.
-///
-/// \pre normals must be unit vectors
-///
-/// @tparam ForwardIterator iterator over input points.
-/// @tparam PointPMap is a model of `ReadablePropertyMap` with value type `Point_3<Kernel>`.
-///        It can be omitted if the value type of `ForwardIterator` is convertible to `Point_3<Kernel>`.
-/// @tparam NormalPMap is a model of `ReadWritePropertyMap` with value type `Vector_3<Kernel>`.
-/// @tparam Kernel Geometric traits class.
-///        It can be omitted and deduced automatically from the value type of `PointPMap`.
-///
-/// @return iterator over the first point with an unoriented normal.
-
-// This variant requires all parameters.
-template <typename ForwardIterator,
-          typename PointPMap,
-          typename NormalPMap,
-          typename Kernel
->
-ForwardIterator
-radial_orient_normals(
-    ForwardIterator first,  ///< iterator over the first input point.
-    ForwardIterator beyond, ///< past-the-end iterator over the input points.
-    PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3.
-    NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3.
-    const Kernel& kernel) ///< geometric traits.
-{
-    CGAL_TRACE("Calls radial_orient_normals()\n");
-
-    // Input points types
-    typedef typename std::iterator_traits<ForwardIterator>::value_type Enriched_point;
-    typedef typename boost::property_traits<PointPMap>::value_type Point;
-    typedef typename boost::property_traits<NormalPMap>::value_type Vector;
-    typedef typename Kernel::FT FT;
-
-    // Precondition: at least one element in the container.
-    CGAL_point_set_processing_precondition(first != beyond);
-
-    // Find points barycenter.
-    // Note: We should use CGAL::centroid() from PCA component.
-    //       Unfortunately, it is not compatible with property maps.
-    Vector sum = CGAL::NULL_VECTOR;
-    int nb_points = 0;
-    for (ForwardIterator it = first; it != beyond; it++)
-    {
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-      Point point = get(point_pmap, it);
-#else
-      Point point = get(point_pmap, *it);
-#endif  
-      sum = sum + (point - CGAL::ORIGIN);
-      nb_points++;
-    }
-    Point barycenter = CGAL::ORIGIN + sum / (FT)nb_points;
-
-    // Iterates over input points and orients normals towards exterior of the point set.
-    // Copy points with robust normal orientation to oriented_points[], the others to unoriented_points[].
-    std::deque<Enriched_point> oriented_points, unoriented_points;
-    for (ForwardIterator it = first; it != beyond; it++)
-    {
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-      Point point = get(point_pmap, it);
-#else
-      Point point = get(point_pmap, *it);
-#endif 
-      // Radial vector towards exterior of the point set
-      Vector vec1 = point - barycenter;
-
-      // Point's normal
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-      Vector vec2 = get(normal_pmap, it);
-#else
-      Vector vec2 = get(normal_pmap, *it);
-#endif
-      
-      //         ->               ->
-      // Orients vec2 parallel to vec1
-      double dot = vec1 * vec2;
-      if (dot < 0)
-        vec2 = -vec2;
-
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-      put(normal_pmap, it, vec2); 
-#else
-      put(normal_pmap, *it, vec2);
-#endif
-
-      // Is orientation robust?
-      bool oriented = (std::abs(dot) > std::cos(80.*CGAL_PI/180.)); // robust iff angle < 80 degrees
-      if (oriented)
-        oriented_points.push_back(*it);
-      else
-        unoriented_points.push_back(*it);
-    }
-
-    // Replaces [first, beyond) range by the content of oriented_points[], then unoriented_points[].
-    ForwardIterator first_unoriented_point =
-      std::copy(oriented_points.begin(), oriented_points.end(), first);
-    std::copy(unoriented_points.begin(), unoriented_points.end(), first_unoriented_point);
-
-    CGAL_TRACE("  => %u normals are unoriented\n", unoriented_points.size());
-    CGAL_TRACE("End of radial_orient_normals()\n");
-
-    return first_unoriented_point;
-}
-
-/// @cond SKIP_IN_MANUAL
-// This variant deduces the kernel from the iterator type.
-template <typename ForwardIterator,
-          typename PointPMap,
-          typename NormalPMap
->
-ForwardIterator
-radial_orient_normals(
-    ForwardIterator first,  ///< iterator over the first input point.
-    ForwardIterator beyond, ///< past-the-end iterator over the input points.
-    PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3.
-    NormalPMap normal_pmap) ///< property map: value_type of ForwardIterator -> Vector_3.
-{
-    typedef typename boost::property_traits<PointPMap>::value_type Point;
-    typedef typename Kernel_traits<Point>::Kernel Kernel;
-    return radial_orient_normals(
-      first,beyond,
-      point_pmap, normal_pmap, 
-      Kernel());
-}
-/// @endcond
-
-/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Identity_property_map.
-template <typename ForwardIterator,
-          typename NormalPMap
->
-ForwardIterator
-radial_orient_normals(
-    ForwardIterator first,  ///< iterator over the first input point.
-    ForwardIterator beyond, ///< past-the-end iterator over the input points.
-    NormalPMap normal_pmap) ///< property map: value_type of ForwardIterator -> Vector_3.
-{
-    return radial_orient_normals(
-      first,beyond,
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-      make_dereference_property_map(first),
-#else
-      make_identity_property_map(
-      typename std::iterator_traits<ForwardIterator>::value_type()),
-#endif
-      normal_pmap);
-}
-/// @endcond
-
-/// @endcond
-
-
-} //namespace CGAL
-
-#endif // CGAL_RADIAL_ORIENT_NORMALS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/random_simplify_point_set.h b/3rdparty/CGAL-4.8/include/CGAL/random_simplify_point_set.h
deleted file mode 100644
index 5bc32fc..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/random_simplify_point_set.h
+++ /dev/null
@@ -1,123 +0,0 @@
-// Copyright (c) 2007-09  INRIA Sophia-Antipolis (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
-// 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(s) : Laurent Saboret
-
-#ifndef CGAL_RANDOM_SIMPLIFY_POINT_SET_H
-#define CGAL_RANDOM_SIMPLIFY_POINT_SET_H
-
-#include <CGAL/Kernel_traits.h>
-#include <CGAL/property_map.h>
-#include <CGAL/point_set_processing_assertions.h>
-
-#include <iterator>
-#include <set>
-#include <algorithm>
-#include <cmath>
-
-namespace CGAL {
-
-/// \ingroup PkgPointSetProcessing
-/// Randomly deletes a user-specified fraction of the input points.
-///
-/// This method modifies the order of input points so as to pack all remaining points first,
-/// and returns an iterator over the first point to remove (see erase-remove idiom).
-/// For this reason it should not be called on sorted containers.
-///
-/// @tparam ForwardIterator iterator over input points.
-/// @tparam PointPMap is a model of `ReadablePropertyMap` with value type `Point_3<Kernel>`.
-///        It can be omitted if the value type of `ForwardIterator` is convertible to `Point_3<Kernel>`.
-/// @tparam Kernel Geometric traits class.
-///        It can be omitted and deduced automatically from the value type of `PointPMap`.
-///
-/// @return iterator over the first point to remove.
-
-// This variant requires all parameters.
-template <typename ForwardIterator,
-          typename PointPMap,
-          typename Kernel
->
-ForwardIterator
-random_simplify_point_set(
-  ForwardIterator first,  ///< iterator over the first input point.
-  ForwardIterator beyond, ///< past-the-end iterator over the input points.
-  PointPMap /*point_pmap*/, ///< property map: value_type of ForwardIterator -> Point_3
-  double removed_percentage, ///< percentage of points to remove.
-  const Kernel& /*kernel*/) ///< geometric traits.
-{
-  CGAL_point_set_processing_precondition(removed_percentage >= 0 && removed_percentage <= 100);
-
-  // Random shuffle
-  std::random_shuffle (first, beyond);
-
-  // Computes first iterator to remove
-  std::size_t nb_points = std::distance(first, beyond);
-  std::size_t first_index_to_remove = (std::size_t)(double(nb_points) * ((100.0-removed_percentage)/100.0));
-  ForwardIterator first_point_to_remove = first;
-  std::advance(first_point_to_remove, first_index_to_remove);
-
-  return first_point_to_remove;
-}
-
-/// @cond SKIP_IN_MANUAL
-// This variant deduces the kernel from the iterator type.
-template <typename ForwardIterator,
-          typename PointPMap
->
-ForwardIterator
-random_simplify_point_set(
-  ForwardIterator first, ///< iterator over the first input point
-  ForwardIterator beyond, ///< past-the-end iterator
-  PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3
-  double removed_percentage) ///< percentage of points to remove
-{
-  typedef typename boost::property_traits<PointPMap>::value_type Point;
-  typedef typename Kernel_traits<Point>::Kernel Kernel;
-  return random_simplify_point_set(
-    first,beyond,
-    point_pmap,
-    removed_percentage,
-    Kernel());
-}
-/// @endcond
-
-/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Identity_property_map.
-template <typename ForwardIterator
->
-ForwardIterator
-random_simplify_point_set(
-  ForwardIterator first, ///< iterator over the first input point
-  ForwardIterator beyond, ///< past-the-end iterator
-  double removed_percentage) ///< percentage of points to remove
-{
-  return random_simplify_point_set(
-    first,beyond,
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-    make_dereference_property_map(first),
-#else
-    make_identity_property_map(
-    typename std::iterator_traits<ForwardIterator>::value_type()),
-#endif
-    removed_percentage);
-}
-/// @endcond
-
-
-} //namespace CGAL
-
-#endif // CGAL_RANDOM_SIMPLIFY_POINT_SET_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/refine_mesh_3.h b/3rdparty/CGAL-4.8/include/CGAL/refine_mesh_3.h
deleted file mode 100644
index 7cd170b..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/refine_mesh_3.h
+++ /dev/null
@@ -1,502 +0,0 @@
-// Copyright (c) 2009 INRIA Sophia-Antipolis (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
-// 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(s)     : Stephane Tayeb
-//
-//******************************************************************************
-// File Description : refine_mesh_3 function declaration and implementation.
-//******************************************************************************
-
-#ifndef CGAL_REFINE_MESH_3_H
-#define CGAL_REFINE_MESH_3_H
-
-#include <CGAL/config.h>
-#include <CGAL/Mesh_3/config.h>
-#include <CGAL/Mesh_3/Dump_c3t3.h>
-#include <CGAL/Mesh_3/global_parameters.h>
-#include <CGAL/Mesh_3/Mesher_3.h>
-#include <CGAL/optimize_mesh_3.h>
-
-namespace CGAL {
-
-  namespace details {
-    
-    /**
-     * @class Insert_vertex_in_c3t3
-     *
-     * A functor designed to insert unweighted points into the triangulation
-     * of a C3T3 from C3T3::Tr::Vertex , keeping the dimension and indices.
-     */
-    template <typename C3T3>
-    class Insert_vertex_in_c3t3
-    {
-    private:
-      typedef typename C3T3::Vertex_handle          Vertex_handle;
-      typedef typename C3T3::Index                  Index;
-      
-      typedef typename C3T3::Triangulation          Tr;
-      typedef typename Tr::Vertex                   Vertex;
-      typedef typename Tr::Point                    Weighted_point;
-      typedef typename Tr::Point::Weight            Weight;
-      
-    public:
-      Insert_vertex_in_c3t3(C3T3& c3t3)
-        : r_c3t3_(c3t3) {}
-      
-      void operator()(const Vertex& vertex) const
-      {
-        // Get vh properties
-        int dimension = vertex.in_dimension();
-        Weight w = (dimension < 2) ? vertex.point().weight() : 0;
-        Weighted_point point(vertex.point().point(),w);
-        Index index = vertex.index();
-
-        // Insert point and restore handle properties
-        Vertex_handle new_vertex = r_c3t3_.triangulation().insert(point);
-        r_c3t3_.set_index(new_vertex, index);
-        r_c3t3_.set_dimension(new_vertex, dimension);
-
-#if defined(CGAL_LINKED_WITH_TBB)\
- && !defined(CGAL_PARALLEL_MESH_3_DO_NOT_ADD_OUTSIDE_POINTS_ON_A_FAR_SPHERE)
-        if (boost::is_convertible<typename C3T3::Concurrency_tag, CGAL::Parallel_tag>::value)
-        {
-          if (dimension == -1)
-            r_c3t3_.add_far_point(new_vertex);
-        }
-#endif
-#ifdef CGAL_SEQUENTIAL_MESH_3_ADD_OUTSIDE_POINTS_ON_A_FAR_SPHERE
-        if (boost::is_convertible<typename C3T3::Concurrency_tag, CGAL::Sequential_tag>::value)
-        {
-          if (dimension == -1)
-            r_c3t3_.add_far_point(new_vertex);
-        }
-#endif
-      }
-
-    private:
-      C3T3& r_c3t3_;
-    };
-  }
-  
-  
-namespace parameters {
-  
-  namespace internal {
-    
-    const int undef_parameter = -1;
-    
-    // Helpers
-    struct Optimization_options_base
-    {
-      Optimization_options_base(bool b)
-      : b_(b), time_limit_(undef_parameter), bound_(undef_parameter) {}
-      
-      operator bool() const { return b_; }
-      
-      bool is_time_limit_set() const { return time_limit_ != undef_parameter; }
-      void set_time_limit(double d) { time_limit_ = d; }
-      double time_limit() const { return time_limit_; }
-      
-      bool is_bound_set() const { return bound_ != undef_parameter; }
-      void set_bound(double d) { bound_ = d; }
-      double bound() const { return bound_; }
-      
-    private:
-      bool b_;
-      double time_limit_;
-      double bound_;
-    };
-    
-    struct Global_optimization_options_base
-    {
-      Global_optimization_options_base()
-      : convergence_(undef_parameter), max_it_nb_(undef_parameter) {}
-      
-      bool is_convergence_set() const { return convergence_ != undef_parameter; }
-      void set_convergence(double d) { convergence_ = d; }
-      double convergence() const { return convergence_; }
-      
-      bool is_max_iteration_number_set() const { return max_it_nb_ != undef_parameter; }
-      void set_max_iteration_number(int i) { max_it_nb_ = i; }
-      int max_iteration_number() const { return max_it_nb_; }
-      
-    private:
-      double convergence_;
-      int max_it_nb_; 
-    };
-    
-    // Perturb
-    struct Perturb_options : public Optimization_options_base
-    {
-      Perturb_options(bool b) : Optimization_options_base(b) {}
-    };
-    
-    // Exude
-    struct Exude_options : public Optimization_options_base
-    {
-      Exude_options(bool b) : Optimization_options_base(b) {}
-    };
-    
-    // Odt
-    struct Odt_options : public Optimization_options_base
-    , public Global_optimization_options_base
-    {
-      Odt_options(bool b) : Optimization_options_base(b)
-      , Global_optimization_options_base() {}
-    };
-    
-    // Lloyd
-    struct Lloyd_options : public Optimization_options_base
-    , public Global_optimization_options_base
-    {
-      Lloyd_options(bool b) : Optimization_options_base(b)
-      , Global_optimization_options_base() {}
-    };
-
-    // Various Mesh_3 option
-    struct Mesh_3_options {
-      Mesh_3_options() 
-        : dump_after_init_prefix()
-        , dump_after_refine_surface_prefix()
-        , dump_after_refine_prefix()
-        , dump_after_glob_opt_prefix()
-        , dump_after_perturb_prefix()
-        , dump_after_exude_prefix()
-        , number_of_initial_points()
-      {}
-
-      std::string dump_after_init_prefix;
-      std::string dump_after_refine_surface_prefix;
-      std::string dump_after_refine_prefix;
-      std::string dump_after_glob_opt_prefix;
-      std::string dump_after_perturb_prefix;
-      std::string dump_after_exude_prefix;
-      int number_of_initial_points;
-
-    }; // end struct Mesh_3_options
-
-  } // end namespace internal
-
-// see <CGAL/config.h>
-CGAL_PRAGMA_DIAG_PUSH
-// see <CGAL/Mesh_3/config.h>
-CGAL_MESH_3_IGNORE_BOOST_PARAMETER_NAME_WARNINGS
-
-
-  // -----------------------------------
-  // Perturb
-  // -----------------------------------
-  BOOST_PARAMETER_FUNCTION((internal::Perturb_options), perturb, tag,
-                           (optional (time_limit_, *, internal::undef_parameter )
-                                     (sliver_bound_, *, default_values::perturb_sliver_bound )))
-  { 
-    internal::Perturb_options options(true);
-    
-    if ( internal::undef_parameter != time_limit_ )
-      options.set_time_limit(time_limit_);
-    
-    options.set_bound(sliver_bound_);
-    
-    return options;
-  }
-  
-  inline internal::Perturb_options no_perturb() { return internal::Perturb_options(false); }
-  
-  // -----------------------------------
-  // Exude
-  // -----------------------------------
-  BOOST_PARAMETER_FUNCTION((internal::Exude_options), exude, tag,
-                           (optional (time_limit_, *, internal::undef_parameter )
-                                     (sliver_bound_, *, default_values::exude_sliver_bound )))
-  { 
-    internal::Exude_options options(true);
-    
-    if ( internal::undef_parameter != time_limit_ )
-      options.set_time_limit(time_limit_);
-
-    options.set_bound(sliver_bound_);
-    
-    return options;
-  }
-  
-  inline internal::Exude_options no_exude() { return internal::Exude_options(false); }
-  
-  // -----------------------------------
-  // Odt
-  // -----------------------------------
-  BOOST_PARAMETER_FUNCTION((internal::Odt_options), odt, tag,
-                           (optional (time_limit_, *, 0 )
-                                     (max_iteration_number_, *, 0 )
-                                     (convergence_, *, default_values::odt_convergence_ratio )
-                                     (freeze_bound_, *, default_values::odt_freeze_ratio )))
-  { 
-    internal::Odt_options options(true);
-
-    options.set_time_limit(time_limit_);
-    options.set_bound(freeze_bound_);
-    options.set_convergence(convergence_);
-    options.set_max_iteration_number(max_iteration_number_);
-    
-    return options;
-  }
-  
-  inline internal::Odt_options no_odt() { return internal::Odt_options(false); }
-  
-  // -----------------------------------
-  // Lloyd
-  // -----------------------------------
-  BOOST_PARAMETER_FUNCTION((internal::Lloyd_options), lloyd, tag,
-                           (optional (time_limit_, *, 0 )
-                                     (max_iteration_number_, *, 0 )
-                                     (convergence_, *, default_values::lloyd_convergence_ratio )
-                                     (freeze_bound_, *, default_values::lloyd_freeze_ratio )))
-  { 
-    internal::Lloyd_options options(true);
-    
-    options.set_time_limit(time_limit_);
-    options.set_bound(freeze_bound_);
-    options.set_convergence(convergence_);
-    options.set_max_iteration_number(max_iteration_number_);
-    
-    return options;
-  }
-  
-  inline internal::Lloyd_options no_lloyd() { return internal::Lloyd_options(false); }
-  
-  // Mesh options
-  // -----------------------------------
-
-  // Undocumented Boost parameter for refine_mesh_3 and make_mesh_3.
-  // Allows to dump the mesh at given stage of the mesh generation
-  // algorithm.
-  BOOST_PARAMETER_FUNCTION((internal::Mesh_3_options), mesh_3_options, tag,
-                           (optional 
-                            (dump_after_init_prefix_, (std::string), "" )
-                            (dump_after_refine_surface_prefix_, (std::string), "" )
-                            (dump_after_refine_prefix_, (std::string), "" )
-                            (dump_after_glob_opt_prefix_, (std::string), "" )
-                            (dump_after_perturb_prefix_, (std::string), "" )
-                            (dump_after_exude_prefix_, (std::string), "" )
-                            (number_of_initial_points_, (int), -1)
-                            )
-                           )
-  { 
-    internal::Mesh_3_options options;
-
-    options.dump_after_init_prefix=dump_after_init_prefix_;
-    options.dump_after_refine_surface_prefix=dump_after_refine_surface_prefix_;
-    options.dump_after_refine_prefix=dump_after_refine_prefix_;
-    options.dump_after_glob_opt_prefix=dump_after_glob_opt_prefix_;
-    options.dump_after_perturb_prefix=dump_after_perturb_prefix_;
-    options.dump_after_exude_prefix=dump_after_exude_prefix_;
-    options.number_of_initial_points=number_of_initial_points_;
-
-    return options;
-  }
-  
-  // Undocumented Boost parameter for refine_mesh_3 and make_mesh_3.
-  // Default Mesh_3_options: dump at every stage of the mesh generation.
-  inline internal::Mesh_3_options mesh_3_dump()
-  {
-    internal::Mesh_3_options options;
-
-    options.dump_after_init_prefix="mesh_dump_after_init";
-    options.dump_after_refine_surface_prefix="mesh_dump_after_refine_surface";
-    options.dump_after_refine_prefix="mesh_dump_after_refine";
-    options.dump_after_glob_opt_prefix="mesh_dump_after_glob_opt";
-    options.dump_after_perturb_prefix="mesh_dump_after_perturb";
-    options.dump_after_exude_prefix="mesh_dump_after_exude";
-    
-    return options;
-  }
-
-CGAL_PRAGMA_DIAG_POP
-
-  // -----------------------------------
-  // Reset_c3t3 (undocumented)
-  // -----------------------------------
-  CGAL_MESH_BOOLEAN_PARAMETER(Reset,reset_c3t3,no_reset_c3t3)
-  // CGAL_MESH_BOOLEAN_PARAMETER defined in <CGAL/Mesh_3/global_parameters.h>
-  
-// see <CGAL/config.h>
-CGAL_PRAGMA_DIAG_PUSH
-// see <CGAL/Mesh_3/config.h>
-CGAL_MESH_3_IGNORE_BOOST_PARAMETER_NAME_WARNINGS
-
-  // -----------------------------------
-  // Parameters
-  // -----------------------------------
-  BOOST_PARAMETER_NAME( exude_param )
-  BOOST_PARAMETER_NAME( perturb_param )
-  BOOST_PARAMETER_NAME( odt_param )
-  BOOST_PARAMETER_NAME( lloyd_param )
-  BOOST_PARAMETER_NAME( reset_param )
-  BOOST_PARAMETER_NAME( mesh_options_param )
-
-CGAL_PRAGMA_DIAG_POP
-} // end namespace parameters
-  
-// see <CGAL/config.h>
-CGAL_PRAGMA_DIAG_PUSH
-// see <CGAL/Mesh_3/config.h>
-CGAL_MESH_3_IGNORE_BOOST_PARAMETER_NAME_WARNINGS
-
-BOOST_PARAMETER_FUNCTION(
-  (void),
-  refine_mesh_3,
-  parameters::tag,
-  (required (in_out(c3t3),*) (domain,*) (criteria,*) ) // nondeduced
-  (deduced 
-    (optional
-      (exude_param, (parameters::internal::Exude_options), parameters::exude())
-      (perturb_param, (parameters::internal::Perturb_options), parameters::perturb())
-      (odt_param, (parameters::internal::Odt_options), parameters::no_odt())
-      (lloyd_param, (parameters::internal::Lloyd_options), parameters::no_lloyd())
-      (reset_param, (parameters::Reset), parameters::reset_c3t3())
-      (mesh_options_param, (parameters::internal::Mesh_3_options), 
-                           parameters::internal::Mesh_3_options())
-    )
-  )
-)
-{
-  return refine_mesh_3_impl(c3t3,
-                            domain,
-                            criteria,
-                            exude_param,
-                            perturb_param,
-                            odt_param,
-                            lloyd_param,
-                            reset_param(),
-                            mesh_options_param);
-}
-
-CGAL_PRAGMA_DIAG_POP
-
-  
-/**
- * @brief This function refines the mesh c3t3 wrt domain & criteria
- *
- * @param c3t3 the mesh to be refined.
- * @param domain the domain to be discretized
- * @param criteria the criteria
- * @param exude if \c true, an exudation step will be done at
- *   the end of the Delaunay refinement process
- * @param perturb if \c true, an explicit vertex perturbation step will be
- *   done at the end of refinement process
- * @param reset_c3t3 if \c true, a new C3T3 will be construct from param c3t3.
- *   The new c3t3 keeps only the vertices (as NON-weighted points with their
- *   dimension and Index) of the triangulation. That allows to refine a mesh
- *   which has been exuded.
- * @param mesh_3_various_options is a struct object used to pass
- * non-documented options, for debugging purpose.
- */
-template<class C3T3, class MeshDomain, class MeshCriteria>
-void refine_mesh_3_impl(C3T3& c3t3,
-                        const MeshDomain&   domain,
-                        const MeshCriteria& criteria,
-                        const parameters::internal::Exude_options& exude,
-                        const parameters::internal::Perturb_options& perturb,
-                        const parameters::internal::Odt_options& odt,
-                        const parameters::internal::Lloyd_options& lloyd,
-                        bool reset_c3t3,
-                        const parameters::internal::Mesh_3_options& 
-                          mesh_options = parameters::internal::Mesh_3_options())
-{
-  typedef Mesh_3::Mesher_3<C3T3, MeshCriteria, MeshDomain> Mesher;
-
-  // Reset c3t3 (i.e. remove weights) if needed
-  if ( reset_c3t3 )
-  {
-    C3T3 tmp_c3t3;
-    std::for_each(c3t3.triangulation().finite_vertices_begin(),
-                  c3t3.triangulation().finite_vertices_end(),
-                  details::Insert_vertex_in_c3t3<C3T3>(tmp_c3t3));
-    // TODO: corners and edges are not restored
-    c3t3.swap(tmp_c3t3);
-  }
-  
-  dump_c3t3(c3t3, mesh_options.dump_after_init_prefix);
-
-  // Build mesher and launch refinement process
-  Mesher mesher (c3t3, domain, criteria);
-  double refine_time = mesher.refine_mesh(mesh_options.dump_after_refine_surface_prefix);
-  c3t3.clear_manifold_info();
-
-  dump_c3t3(c3t3, mesh_options.dump_after_refine_prefix);
-
-  // Odt
-  if ( odt )
-  {
-    odt_optimize_mesh_3(c3t3,
-                        domain,
-                        parameters::time_limit = odt.time_limit(),
-                        parameters::max_iteration_number = odt.max_iteration_number(),
-                        parameters::convergence = odt.convergence(),
-                        parameters::freeze_bound = odt.bound());
-  }
-  
-  // Lloyd
-  if ( lloyd )
-  {
-    lloyd_optimize_mesh_3(c3t3,
-                          domain,
-                          parameters::time_limit = lloyd.time_limit(),
-                          parameters::max_iteration_number = lloyd.max_iteration_number(),
-                          parameters::convergence = lloyd.convergence(),
-                          parameters::freeze_bound = lloyd.bound());
-  }
-    
-  dump_c3t3(c3t3, mesh_options.dump_after_glob_opt_prefix);
-
-  // Perturbation
-  if ( perturb )
-  {
-    double perturb_time_limit = refine_time;
-    
-    if ( perturb.is_time_limit_set() )
-      perturb_time_limit = perturb.time_limit();
-
-    perturb_mesh_3(c3t3,
-                   domain,
-                   parameters::time_limit = perturb_time_limit,
-                   parameters::sliver_bound = perturb.bound());
-  }
-  
-  dump_c3t3(c3t3, mesh_options.dump_after_perturb_prefix);
-
-  // Exudation
-  if ( exude )
-  {
-    double exude_time_limit = refine_time;
-    
-    if ( exude.is_time_limit_set() )
-      exude_time_limit = exude.time_limit();
-    
-    exude_mesh_3(c3t3,
-                 parameters::time_limit = exude_time_limit,
-                 parameters::sliver_bound = exude.bound());
-  }
-  
-  dump_c3t3(c3t3, mesh_options.dump_after_exude_prefix);
-
-}
-
-}  // end namespace CGAL
-
-
-#endif // CGAL_REFINE_MESH_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/remove_outliers.h b/3rdparty/CGAL-4.8/include/CGAL/remove_outliers.h
deleted file mode 100644
index 717876a..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/remove_outliers.h
+++ /dev/null
@@ -1,257 +0,0 @@
-// Copyright (c) 2007-09  INRIA Sophia-Antipolis (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
-// 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(s) : Laurent Saboret and Nader Salman and Pierre Alliez
-
-#ifndef CGAL_REMOVE_OUTLIERS_H
-#define CGAL_REMOVE_OUTLIERS_H
-
-#include <CGAL/Search_traits_3.h>
-#include <CGAL/Orthogonal_k_neighbor_search.h>
-#include <CGAL/property_map.h>
-#include <CGAL/point_set_processing_assertions.h>
-
-#include <iterator>
-#include <algorithm>
-#include <map>
-
-namespace CGAL {
-
-
-// ----------------------------------------------------------------------------
-// Private section
-// ----------------------------------------------------------------------------
-/// \cond SKIP_IN_MANUAL
-namespace internal {
-
-
-/// Utility function for remove_outliers():
-/// Computes average squared distance to the K nearest neighbors.
-///
-/// \pre `k >= 2`
-///
-/// @tparam Kernel Geometric traits class.
-/// @tparam Tree KD-tree.
-///
-/// @return computed distance.
-template < typename Kernel,
-           typename Tree >
-typename Kernel::FT
-compute_avg_knn_sq_distance_3(
-    const typename Kernel::Point_3& query, ///< 3D point to project
-    Tree& tree,                            ///< KD-tree
-    unsigned int k)                        ///< number of neighbors
-{
-    // geometric types
-    typedef typename Kernel::FT FT;
-    typedef typename Kernel::Point_3 Point;
-
-    // types for K nearest neighbors search
-    typedef typename CGAL::Search_traits_3<Kernel> Tree_traits;
-    typedef typename CGAL::Orthogonal_k_neighbor_search<Tree_traits> Neighbor_search;
-    typedef typename Neighbor_search::iterator Search_iterator;
-
-    // Gather set of (k+1) neighboring points.
-    // Perform k+1 queries (if in point set, the query point is
-    // output first). Search may be aborted if k is greater
-    // than number of input points.
-    std::vector<Point> points; points.reserve(k+1);
-    Neighbor_search search(tree,query,k+1);
-    Search_iterator search_iterator = search.begin();
-    unsigned int i;
-    for(i=0;i<(k+1);i++)
-    {
-        if(search_iterator == search.end())
-            break; // premature ending
-        points.push_back(search_iterator->first);
-        search_iterator++;
-    }
-    CGAL_point_set_processing_precondition(points.size() >= 1);
-
-    // compute average squared distance
-    typename Kernel::Compute_squared_distance_3 sqd;
-    FT sq_distance = (FT)0.0;
-    for(typename std::vector<Point>::iterator neighbor = points.begin(); neighbor != points.end(); neighbor++)
-        sq_distance += sqd(*neighbor, query);
-    sq_distance /= FT(points.size());
-    return sq_distance;
-}
-
-} /* namespace internal */
-/// \endcond
-
-
-// ----------------------------------------------------------------------------
-// Public section
-// ----------------------------------------------------------------------------
-
-/// \ingroup PkgPointSetProcessing
-/// Removes outliers:
-/// - computes average squared distance to the K nearest neighbors,
-/// - and sorts the points in increasing order of average distance.
-///
-/// This method modifies the order of input points so as to pack all remaining points first,
-/// and returns an iterator over the first point to remove (see erase-remove idiom).
-/// For this reason it should not be called on sorted containers.
-///
-/// \pre `k >= 2`
-///
-/// @tparam InputIterator iterator over input points.
-/// @tparam PointPMap is a model of `ReadablePropertyMap` with value type `Point_3<Kernel>`.
-///        It can be omitted ifthe value type of `InputIterator` is convertible to `Point_3<Kernel>`.
-/// @tparam Kernel Geometric traits class.
-///        It can be omitted and deduced automatically from the value type of `PointPMap`.
-///
-/// @return iterator over the first point to remove.
-
-// This variant requires all parameters.
-template <typename InputIterator,
-          typename PointPMap,
-          typename Kernel
->
-InputIterator
-remove_outliers(
-  InputIterator first,  ///< iterator over the first input point.
-  InputIterator beyond, ///< past-the-end iterator over the input points.
-  PointPMap point_pmap, ///< property map: value_type of InputIterator -> Point_3
-  unsigned int k, ///< number of neighbors.
-  double threshold_percent, ///< percentage of points to remove.
-  const Kernel& /*kernel*/) ///< geometric traits.
-{
-  // geometric types
-  typedef typename Kernel::FT FT;
-  
-  // basic geometric types
-  typedef typename Kernel::Point_3 Point;
-
-  // actual type of input points
-  typedef typename std::iterator_traits<InputIterator>::value_type Enriched_point;
-
-  // types for K nearest neighbors search structure
-  typedef typename CGAL::Search_traits_3<Kernel> Tree_traits;
-  typedef typename CGAL::Orthogonal_k_neighbor_search<Tree_traits> Neighbor_search;
-  typedef typename Neighbor_search::Tree Tree;
-
-  // precondition: at least one element in the container.
-  // to fix: should have at least three distinct points
-  // but this is costly to check
-  CGAL_point_set_processing_precondition(first != beyond);
-
-  // precondition: at least 2 nearest neighbors
-  CGAL_point_set_processing_precondition(k >= 2);
-
-  CGAL_point_set_processing_precondition(threshold_percent >= 0 && threshold_percent <= 100);
-
-  InputIterator it;
-
-  // Instanciate a KD-tree search.
-  // Note: We have to convert each input iterator to Point_3.
-  std::vector<Point> kd_tree_points; 
-  for(it = first; it != beyond; it++)
-  {
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-    Point point = get(point_pmap, it);
-#else
-    Point point = get(point_pmap, *it);
-#endif 
-    kd_tree_points.push_back(point);
-  }
-  Tree tree(kd_tree_points.begin(), kd_tree_points.end());
-
-  // iterate over input points and add them to multimap sorted by distance to k
-  std::multimap<FT,Enriched_point> sorted_points;
-  for(it = first; it != beyond; it++)
-  {
-    FT sq_distance = internal::compute_avg_knn_sq_distance_3<Kernel>(
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-      get(point_pmap,it),
-#else
-      get(point_pmap,*it),
-#endif 
-      tree, k);
-    sorted_points.insert( std::make_pair(sq_distance, *it) );
-  }
-
-  // Replaces [first, beyond) range by the multimap content.
-  // Returns the iterator after the (100-threshold_percent) % best points.
-  InputIterator first_point_to_remove = beyond;
-  InputIterator dst = first;
-  int first_index_to_remove = int(double(sorted_points.size()) * ((100.0-threshold_percent)/100.0));
-  typename std::multimap<FT,Enriched_point>::iterator src;
-  int index;
-  for (src = sorted_points.begin(), index = 0;
-       src != sorted_points.end();
-       ++src, ++index)
-  {
-    *dst++ = src->second;
-    if (index == first_index_to_remove)
-      first_point_to_remove = dst;
-  }
-
-  return first_point_to_remove;
-}
-
-/// @cond SKIP_IN_MANUAL
-// This variant deduces the kernel from the iterator type.
-template <typename InputIterator,
-          typename PointPMap
->
-InputIterator
-remove_outliers(
-  InputIterator first, ///< iterator over the first input point
-  InputIterator beyond, ///< past-the-end iterator
-  PointPMap point_pmap, ///< property map: value_type of InputIterator -> Point_3
-  unsigned int k, ///< number of neighbors.
-  double threshold_percent) ///< percentage of points to remove
-{
-  typedef typename boost::property_traits<PointPMap>::value_type Point;
-  typedef typename Kernel_traits<Point>::Kernel Kernel;
-  return remove_outliers(
-    first,beyond,
-    point_pmap,
-    k,threshold_percent,
-    Kernel());
-}
-/// @endcond
-
-/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Identity_property_map.
-template <typename InputIterator
->
-InputIterator
-remove_outliers(
-  InputIterator first, ///< iterator over the first input point
-  InputIterator beyond, ///< past-the-end iterator
-  unsigned int k, ///< number of neighbors.
-  double threshold_percent) ///< percentage of points to remove
-{
-  return remove_outliers(
-    first,beyond,
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-    make_dereference_property_map(first),
-#else
-    make_identity_property_map(
-    typename std::iterator_traits<InputIterator>::value_type()),
-#endif
-    k,threshold_percent);
-}
-/// @endcond
-
-
-} //namespace CGAL
-
-#endif // CGAL_REMOVE_OUTLIERS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/squared_distance_3_1.h b/3rdparty/CGAL-4.8/include/CGAL/squared_distance_3_1.h
deleted file mode 100644
index 0f1e0bb..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/squared_distance_3_1.h
+++ /dev/null
@@ -1,928 +0,0 @@
-// Copyright (c) 1998-2004  
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved. 
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Geert-Jan Giezeman, Andreas Fabri
-
-
-#ifndef CGAL_DISTANCE_3_1_H
-#define CGAL_DISTANCE_3_1_H
-
-
-#include <CGAL/squared_distance_3_0.h>
-
-#include <CGAL/Segment_3.h>
-#include <CGAL/Line_3.h>
-#include <CGAL/Ray_3.h>
-
-
-namespace CGAL {
-
-namespace internal {
-
-template <class K>
-typename K::FT
-squared_distance(
-    const typename K::Point_3 &pt,
-    const typename K::Line_3 &line,
-    const K& k)
-{
-  typedef typename K::Vector_3 Vector_3;
-  typename K::Construct_vector_3 construct_vector;
-  Vector_3 dir(line.direction().vector());
-  Vector_3 diff = construct_vector(line.point(), pt);
-  return internal::squared_distance_to_line(dir, diff, k);
-}
-
-template <class K>
-inline
-typename K::FT
-squared_distance(
-    const typename K::Line_3 & line,
-    const typename K::Point_3 & pt,
-    const K& k)
-{
-    return squared_distance(pt, line, k);
-}
-
-
-template <class K>
-typename K::FT
-squared_distance(
-    const typename K::Point_3 &pt,
-    const typename K::Ray_3 &ray,
-    const K& k)
-{
-  typename K::Construct_vector_3 construct_vector;
-  typedef typename K::Vector_3 Vector_3;
-
-    Vector_3 diff = construct_vector(ray.source(), pt);
-    const Vector_3 &dir = ray.direction().vector();
-    if (!is_acute_angle(dir,diff, k) )
-        return (typename K::FT)(diff*diff);
-    return squared_distance_to_line(dir, diff, k);
-}
-
-
-template <class K>
-inline
-typename K::FT
-squared_distance(
-    const typename K::Ray_3 & ray,
-    const typename K::Point_3 & pt,
-    const K& k)
-{
-    return squared_distance(pt, ray, k);
-}
-
-
-
-
-template <class K>
-typename K::FT
-squared_distance(
-    const typename K::Point_3 &pt,
-    const typename K::Segment_3 &seg,
-    const K& k,
-    const Homogeneous_tag)
-{
-    typename K::Construct_vector_3 construct_vector;
-    typedef typename K::Vector_3 Vector_3;
-    typedef typename K::RT RT;
-    typedef typename K::FT FT;
-    // assert that the segment is valid (non zero length).
-    Vector_3 diff = construct_vector(seg.source(), pt);
-    Vector_3 segvec = construct_vector(seg.source(), seg.target());
-    RT d = wdot(diff,segvec, k);
-    if (d <= (RT)0)
-        return (FT(diff*diff));
-    RT e = wdot(segvec,segvec, k);
-    if ( (d * segvec.hw()) > (e * diff.hw()))
-        return squared_distance(pt, seg.target(), k);
-
-    Vector_3 wcr = wcross(segvec, diff, k);
-    return FT(wcr*wcr)/FT(e * diff.hw() * diff.hw());
-}
-
-template <class K>
-typename K::FT
-squared_distance(
-    const typename K::Point_3 &pt,
-    const typename K::Segment_3 &seg,
-    const K& k,
-    const Cartesian_tag&)
-{
-    typename K::Construct_vector_3 construct_vector;
-    typedef typename K::Vector_3 Vector_3;
-    typedef typename K::RT RT;
-    typedef typename K::FT FT;
-    // assert that the segment is valid (non zero length).
-    Vector_3 diff = construct_vector(seg.source(), pt);
-    Vector_3 segvec = construct_vector(seg.source(), seg.target());
-    RT d = wdot(diff,segvec, k);
-    if (d <= (RT)0)
-        return (FT(diff*diff));
-    RT e = wdot(segvec,segvec, k);
-    if (d > e)
-        return squared_distance(pt, seg.target(), k);
-
-    Vector_3 wcr = wcross(segvec, diff, k);
-    return FT(wcr*wcr)/e;
-}
-
-
-template <class K>
-inline
-typename K::FT
-squared_distance(
-    const typename K::Point_3 &pt,
-    const typename K::Segment_3 &seg,
-    const K& k)
-{ 
-  typedef typename K::Kernel_tag Tag;
-  Tag tag;
-  return squared_distance(pt, seg, k, tag);
-}
-
-
-template <class K>
-inline 
-typename K::FT
-squared_distance(
-    const typename K::Segment_3 & seg,
-    const typename K::Point_3 & pt,
-    const K& k)
-{
-    return squared_distance(pt, seg, k);
-}
-
-
-
-
-template <class K>
-typename K::FT
-squared_distance_parallel(
-    const typename K::Segment_3 &seg1,
-    const typename K::Segment_3 &seg2,
-    const K& k)
-{
-  typedef typename K::Vector_3 Vector_3;
-    const Vector_3 &dir1 = seg1.direction().vector();
-    const Vector_3 &dir2 = seg2.direction().vector();
- 
-    if (same_direction(dir1, dir2, k)) {
-        if (!is_acute_angle(seg1.source(), seg1.target(), seg2.source(), k))
-            return squared_distance(seg1.target(), seg2.source(), k);
-        if (!is_acute_angle(seg1.target(), seg1.source(), seg2.target(), k))
-            return squared_distance(seg1.source(), seg2.target(), k);
-    } else {
-        if (!is_acute_angle(seg1.source(), seg1.target(), seg2.target(), k))
-            return squared_distance(seg1.target(), seg2.target(), k);
-        if (!is_acute_angle(seg1.target(), seg1.source(), seg2.source(), k))
-            return squared_distance(seg1.source(), seg2.source(), k);
-    }
-    return squared_distance(seg2.source(), seg1.supporting_line(), k);
-}
-
-
-
-template <class K>
-inline
-typename K::RT 
-_distance_measure_sub(typename K::RT startwdist, typename K::RT endwdist,
-			 const typename K::Vector_3 &start, 
-			 const typename K::Vector_3 &end,
-			 const K&)
-{
-    return  CGAL_NTS abs(wmult((K*)0, startwdist, end.hw())) -
-            CGAL_NTS abs(wmult((K*)0, endwdist, start.hw()));
-}
-
-
-template <class K>
-typename K::FT
-squared_distance(
-    const typename K::Segment_3 &seg1,
-    const typename K::Segment_3 &seg2,
-    const K& k)
-{
-    typename K::Construct_vector_3 construct_vector;
-    typedef typename K::Vector_3 Vector_3;
-    typedef typename K::Point_3 Point_3;
-    typedef typename K::RT RT;
-    typedef typename K::FT FT;
-    const Point_3 &start1 = seg1.source();
-    const Point_3 &start2 = seg2.source();
-    const Point_3 &end1 = seg1.target();
-    const Point_3 &end2 = seg2.target();
-
-    if (start1 == end1)
-        return squared_distance(start1, seg2, k);
-    if (start2 == end2)
-        return squared_distance(start2, seg1, k);
-    
-    Vector_3 dir1, dir2, normal;
-    dir1 = seg1.direction().vector();
-    dir2 = seg2.direction().vector();
-    normal = wcross(dir1, dir2, k);
-    if (is_null(normal, k))
-        return squared_distance_parallel(seg1, seg2, k);
-    
-    bool crossing1, crossing2;
-    RT sdm_s1to2, sdm_e1to2, sdm_s2to1, sdm_e2to1;
-    Vector_3 perpend1, perpend2, s2mins1, e2mins1, e1mins2;
-    perpend1 = wcross(dir1, normal, k);
-    perpend2 = wcross(dir2, normal, k);
-    s2mins1 = construct_vector(start1, start2);
-    e2mins1 = construct_vector(start1, end2);
-    e1mins2 = construct_vector(start2, end1);
-    sdm_s1to2 = -RT(wdot(perpend2, s2mins1, k));
-    sdm_e1to2 = wdot(perpend2, e1mins2, k);
-    sdm_s2to1 = wdot(perpend1, s2mins1, k);
-    sdm_e2to1 = wdot(perpend1, e2mins1, k);
-    
-    if (sdm_s1to2 < RT(0)) {
-        crossing1 = (sdm_e1to2 >= RT(0));
-    } else {
-        if (sdm_e1to2 <= RT(0)) {
-            crossing1 = true;
-        } else {
-            crossing1 = (sdm_s1to2 == RT(0));
-        }
-    }
-    if (sdm_s2to1 < RT(0)) {
-        crossing2 = (sdm_e2to1 >= RT(0));
-    } else {
-        if (sdm_e2to1 <= RT(0)) {
-            crossing2 = true;
-        } else {
-            crossing2 = (sdm_s2to1 == RT(0));
-        }
-    }
-    
-    if (crossing1) {
-        if (crossing2) {
-            return squared_distance_to_plane(normal, s2mins1, k);
-        }
-    
-        RT dm;
-        dm = _distance_measure_sub(
-                  sdm_s2to1, sdm_e2to1, s2mins1, e2mins1, k);
-        if (dm < RT(0)) {
-            return squared_distance(start2, seg1, k);
-        } else {
-            if (dm > RT(0)) {
-                return squared_distance(end2, seg1, k);
-            } else {
-                // should not happen with exact arithmetic.
-                return squared_distance_parallel(seg1, seg2, k);
-            }
-        }
-    } else {
-        if (crossing2) {
-            RT dm;
-            dm =_distance_measure_sub(
-                 sdm_s1to2, sdm_e1to2, s2mins1, e1mins2, k);
-            if (dm < RT(0)) {
-                return squared_distance(start1, seg2, k);
-            } else {
-                if (dm > RT(0)) {
-                    return squared_distance(end1, seg2, k);
-                } else {
-                    // should not happen with exact arithmetic.
-                    return squared_distance_parallel(seg1, seg2, k);
-                }
-            }
-        } else {
-            FT min1, min2;
-            RT dm;
-            dm = _distance_measure_sub(
-                     sdm_s1to2, sdm_e1to2, s2mins1, e1mins2, k);
-            if (dm == RT(0)) // should not happen with exact arithmetic.
-               return squared_distance_parallel(seg1, seg2, k);
-            min1 = (dm < RT(0)) ?
-                squared_distance(seg1.source(), seg2, k):
-                squared_distance(end1, seg2, k);
-            dm = _distance_measure_sub(
-                     sdm_s2to1, sdm_e2to1, s2mins1, e2mins1, k);
-            if (dm == RT(0)) // should not happen with exact arithmetic.
-                return squared_distance_parallel(seg1, seg2, k);
-            min2 = (dm < RT(0)) ?
-                squared_distance(start2, seg1, k):
-                squared_distance(end2, seg1, k);
-            return (min1 < min2) ? min1 : min2;
-        }
-    }
-    
-}
-
-
-
-
-
-
-template <class K>
-typename K::FT
-squared_distance_parallel(
-    const typename K::Segment_3 &seg,
-    const typename K::Ray_3 &ray,
-    const K& k)
-{
-
-  typedef typename K::Vector_3 Vector_3;
-  bool same_direction;
-  const Vector_3 &dir1 = seg.direction().vector();
-  const Vector_3 &dir2 = ray.direction().vector();
-  if (CGAL_NTS abs(dir1.hx()) > CGAL_NTS abs(dir1.hy())) {
-    same_direction = (CGAL_NTS sign(dir1.hx()) == CGAL_NTS sign(dir2.hx()));
-  } else {
-    same_direction = (CGAL_NTS sign(dir1.hy()) == CGAL_NTS sign(dir2.hy()));
-  }
-  if (same_direction) {
-    if (!is_acute_angle(seg.source(), seg.target(), ray.source(), k))
-      return squared_distance(seg.target(), ray.source(), k);
-  } else {
-    if (!is_acute_angle(seg.target(), seg.source(), ray.source(), k))
-      return squared_distance(seg.source(), ray.source(), k);
-  }
-  return squared_distance(ray.source(), seg.supporting_line(), k);
-}
-
-
-template <class K>
-typename K::FT
-squared_distance(
-    const typename K::Segment_3 &seg,
-    const typename K::Ray_3 &ray,
-    const K& k)
-{
-    typename K::Construct_vector_3 construct_vector;
-    typedef typename K::Point_3 Point_3;
-    typedef typename K::Vector_3 Vector_3;
-    typedef typename K::RT RT;
-    typedef typename K::FT FT;
-    const Point_3 & ss = seg.source();
-    const Point_3 & se = seg.target();
-    if (ss == se)
-        return squared_distance(ss, ray, k);
-    Vector_3 raydir, segdir, normal;
-    raydir = ray.direction().vector();
-    segdir = seg.direction().vector();
-    normal = wcross(segdir, raydir, k);
-    if (is_null(normal, k))
-        return squared_distance_parallel(seg, ray, k);
-
-    bool crossing1, crossing2;
-    RT sdm_ss2r, sdm_se2r, sdm_rs2s, sdm_re2s;
-    Vector_3 perpend2seg, perpend2ray, ss_min_rs, se_min_rs;
-    perpend2seg = wcross(segdir, normal, k);
-    perpend2ray = wcross(raydir, normal, k);
-    ss_min_rs = construct_vector(ray.source(), ss);
-    se_min_rs = construct_vector(ray.source(), se);
-    sdm_ss2r = wdot(perpend2ray, ss_min_rs, k);
-    sdm_se2r = wdot(perpend2ray, se_min_rs, k);
-    if (sdm_ss2r < RT(0)) {
-        crossing1 = (sdm_se2r >= RT(0));
-    } else {
-        if (sdm_se2r <= RT(0)) {
-            crossing1 = true;
-        } else {
-            crossing1 = (sdm_ss2r == RT(0));
-        }
-    }
-
-    sdm_rs2s = -RT(wdot(perpend2seg, ss_min_rs, k));
-    sdm_re2s = wdot(perpend2seg, raydir, k);
-    if (sdm_rs2s < RT(0)) {
-        crossing2 = (sdm_re2s >= RT(0));
-    } else {
-        if (sdm_re2s <= RT(0)) {
-            crossing2 = true;
-        } else {
-            crossing2 = (sdm_rs2s == RT(0));
-        }
-    }
-
-    if (crossing1) {
-        if (crossing2) {
-            return squared_distance_to_plane(normal, ss_min_rs, k);
-        }
-        return squared_distance(ray.source(), seg, k);
-    } else {
-        if (crossing2) {
-            RT dm;
-            dm = _distance_measure_sub(
-                    sdm_ss2r, sdm_se2r, ss_min_rs, se_min_rs, k);
-            if (dm < RT(0)) {
-                return squared_distance(ss, ray, k);
-            } else {
-                if (dm > RT(0)) {
-                    return squared_distance(se, ray, k);
-                } else {
-                    // parallel, should not happen (no crossing)
-                    return squared_distance_parallel(seg, ray, k);
-                }
-            }
-        } else {
-            FT min1, min2;
-            RT dm;
-            dm = _distance_measure_sub(
-                    sdm_ss2r, sdm_se2r, ss_min_rs, se_min_rs, k);
-            if (dm == RT(0))
-                return squared_distance_parallel(seg, ray, k);
-            min1 = (dm < RT(0))
-                 ? squared_distance(ss, ray, k)
-                 : squared_distance(se, ray, k);
-            min2 = squared_distance(ray.source(), seg, k);
-            return (min1 < min2) ? min1 : min2;
-        }
-    }
-}
-
-
-
-template <class K>
-inline
-typename K::FT
-squared_distance(
-    const typename K::Ray_3 & ray,
-    const typename K::Segment_3 & seg,
-    const K& k)
-{
-    return squared_distance(seg, ray, k);
-}
-
-
-template <class K>
-typename K::FT
-squared_distance(
-    const typename K::Segment_3 &seg,
-    const typename K::Line_3 &line,
-    const K& k)
-{
-    typename K::Construct_vector_3 construct_vector;
-    typedef typename K::Vector_3 Vector_3;
-    typedef typename K::Point_3 Point_3;
-    typedef typename K::RT RT;
-    const Point_3 &linepoint = line.point();
-    const Point_3 &start = seg.source();
-    const Point_3 &end = seg.target();
-
-    if (start == end)
-        return squared_distance(start, line, k);
-    Vector_3 linedir = line.direction().vector();
-    Vector_3 segdir = seg.direction().vector();
-    Vector_3 normal = wcross(segdir, linedir, k);
-    if (is_null(normal, k))
-        return squared_distance_to_line(linedir, 
-					construct_vector(linepoint,start), k);
-
-    bool crossing;
-    RT sdm_ss2l, sdm_se2l;
-    Vector_3 perpend2line, start_min_lp, end_min_lp;
-    perpend2line = wcross(linedir, normal, k);
-    start_min_lp = construct_vector(linepoint, start);
-    end_min_lp = construct_vector(linepoint, end);
-    sdm_ss2l = wdot(perpend2line, start_min_lp, k);
-    sdm_se2l = wdot(perpend2line, end_min_lp, k);
-    if (sdm_ss2l < RT(0)) {
-        crossing = (sdm_se2l >= RT(0));
-    } else {
-        if (sdm_se2l <= RT(0)) {
-            crossing = true;
-        } else {
-            crossing = (sdm_ss2l == RT(0));
-        }
-    }
-
-    if (crossing) {
-        return squared_distance_to_plane(normal, start_min_lp, k);
-    } else {
-        RT dm;
-        dm = _distance_measure_sub(
-                sdm_ss2l, sdm_se2l, start_min_lp, end_min_lp, k);
-        if (dm <= RT(0)) {
-            return squared_distance_to_line(linedir, start_min_lp, k);
-        } else {
-            return squared_distance_to_line(linedir, end_min_lp, k);
-        }
-    }
-}
-
-
-template <class K>
-inline 
-typename K::FT
-squared_distance(
-    const typename K::Line_3 & line,
-    const typename K::Segment_3 & seg,
-    const K& k)
-{
-    return squared_distance(seg, line, k);
-}
-
-
-
-
-template <class K>
-typename K::FT
-ray_ray_squared_distance_parallel(
-    const typename K::Vector_3 &ray1dir,
-    const typename K::Vector_3 &ray2dir,
-    const typename K::Vector_3 &s1_min_s2,
-    const K& k)
-{
-  if (!is_acute_angle(ray2dir, s1_min_s2, k)) {
-    if (!same_direction(ray1dir, ray2dir, k))
-      return (typename K::FT)(s1_min_s2*s1_min_s2);
-  }
-  return squared_distance_to_line(ray1dir, s1_min_s2, k);
-}
-
-
-template <class K>
-typename K::FT
-squared_distance(
-    const typename K::Ray_3 &ray1,
-    const typename K::Ray_3 &ray2,
-    const K& k)
-{
-  typename K::Construct_vector_3 construct_vector;
-    typedef typename K::Vector_3 Vector_3;
-    typedef typename K::Point_3 Point_3;
-    typedef typename K::RT RT;
-    typedef typename K::FT FT;
-    const Point_3 & s1 = ray1.source();
-    const Point_3 & s2 = ray2.source();
-    Vector_3 dir1, dir2, normal;
-    dir1 = ray1.direction().vector();
-    dir2 = ray2.direction().vector();
-    normal = wcross(dir1, dir2, k);
-    Vector_3 s1_min_s2 = construct_vector(s2, s1);
-    if (is_null(normal, k))
-        return ray_ray_squared_distance_parallel(dir1, dir2, s1_min_s2, k);
-
-    bool crossing1, crossing2;
-    RT sdm_s1_2, sdm_s2_1;
-    Vector_3 perpend1, perpend2;
-    perpend1 = wcross(dir1, normal, k);
-    perpend2 = wcross(dir2, normal, k);
-
-    sdm_s1_2 = wdot(perpend2, s1_min_s2, k);
-    if (sdm_s1_2 < RT(0)) {
-        crossing1 = (RT(wdot(perpend2, dir1, k)) >= RT(0));
-    } else {
-        if (RT(wdot(perpend2, dir1, k)) <= RT(0)) {
-            crossing1 = true;
-        } else {
-            crossing1 = (sdm_s1_2 == RT(0));
-        }
-    }
-    sdm_s2_1 = -RT(wdot(perpend1, s1_min_s2, k));
-    if (sdm_s2_1 < RT(0)) {
-        crossing2 = (RT(wdot(perpend1, dir2, k)) >= RT(0));
-    } else {
-        if (RT(wdot(perpend1, dir2, k)) <= RT(0)) {
-            crossing2 = true;
-        } else {
-            crossing2 = (sdm_s2_1 == RT(0));
-        }
-    }
-    if (crossing1) {
-        if (crossing2)
-            return squared_distance_to_plane(normal, s1_min_s2, k);
-        return squared_distance(ray2.source(), ray1, k);
-    } else {
-        if (crossing2) {
-            return squared_distance(ray1.source(), ray2, k);
-        } else {
-          FT min1, min2;
-            min1 = squared_distance(ray1.source(), ray2, k);
-            min2 = squared_distance(ray2.source(), ray1, k);
-            return (min1 < min2) ? min1 : min2;
-        }
-    }
-}
-
-
-
-
-
-template <class K>
-typename K::FT
-squared_distance(
-    const typename K::Line_3 &line,
-    const typename K::Ray_3 &ray,
-    const K& k)
-{
-  typename K::Construct_vector_3 construct_vector;
-  typedef typename K::Vector_3 Vector_3;
-  typedef typename K::Point_3 Point_3;
-    typedef typename K::RT RT;
-    const Point_3 & rs =ray.source();
-    Vector_3 raydir, linedir, normal;
-    linedir = line.direction().vector();
-    raydir = ray.direction().vector();
-    normal = wcross(raydir, linedir, k);
-    Vector_3 rs_min_lp = construct_vector(line.point(), rs);
-    if (is_null(normal, k))
-        return squared_distance_to_line(linedir, rs_min_lp, k);
-
-    bool crossing;
-    RT sdm_sr_l;
-    Vector_3 perpend2l;
-    perpend2l = wcross(linedir, normal, k);
-
-    sdm_sr_l = wdot(perpend2l, rs_min_lp, k);
-    if (sdm_sr_l < RT(0)) {
-        crossing = (RT(wdot(perpend2l, raydir, k)) >= RT(0));
-    } else {
-        if (RT(wdot(perpend2l, raydir, k)) <= RT(0)) {
-            crossing = true;
-        } else {
-            crossing = (sdm_sr_l == RT(0));
-        }
-    }
-
-    if (crossing)
-        return squared_distance_to_plane(normal, rs_min_lp, k);
-    else
-        return squared_distance_to_line(linedir, rs_min_lp, k);
-}
-
-
-template <class K>
-inline typename K::FT
-squared_distance(
-    const typename K::Ray_3 & ray,
-    const typename K::Line_3 & line,
-    const K& k)
-{
-    return squared_distance(line, ray, k);
-}
-
-
-
-
-template <class K>
-typename K::FT
-squared_distance(
-    const typename K::Line_3 &line1,
-    const typename K::Line_3 &line2,
-    const K& k)
-{   
-  typename K::Construct_vector_3 construct_vector;
-    typedef typename K::Vector_3 Vector_3;
-
-    Vector_3 dir1, dir2, normal, diff;
-    dir1 = line1.direction().vector();
-    dir2 = line2.direction().vector();
-    normal = wcross(dir1, dir2, k);
-    diff = construct_vector(line1.point(), line2.point());
-    if (is_null(normal, k))
-        return squared_distance_to_line(dir2, diff, k);
-    return squared_distance_to_plane(normal, diff, k);
-}
-
-
-
-} // namespace internal
-
-
-
-template <class K>
-inline
-typename K::FT
-squared_distance(const Point_3<K> &pt,
-		 const Line_3<K> &line)
-{
-  return internal::squared_distance(pt, line, K());
-}
-
-
-template <class K>
-inline
-typename K::FT
-squared_distance(
-    const Line_3<K> & line,
-    const Point_3<K> & pt)
-{
-  return internal::squared_distance(pt, line, K());
-}
-
-
-template <class K>
-inline
-typename K::FT
-squared_distance(
-    const Point_3<K> &pt,
-    const Ray_3<K> &ray)
-{
-    return internal::squared_distance(pt, ray, K());
-}
-
-
-template <class K>
-inline 
-typename K::FT
-squared_distance(
-    const Ray_3<K> & ray,
-    const Point_3<K> & pt)
-{
-    return internal::squared_distance(pt, ray, K());
-}
-
-
-template <class K>
-inline
-typename K::FT
-squared_distance(
-    const Point_3<K> &pt,
-    const Segment_3<K> &seg)
-{
-  return internal::squared_distance(pt, seg, K());
-}
-
-
-template <class K>
-inline 
-typename K::FT
-squared_distance(
-    const Segment_3<K> & seg,
-    const Point_3<K> & pt)
-{
-    return internal::squared_distance(pt, seg, K());
-}
-
-
-
-
-template <class K>
-inline
-typename K::FT
-squared_distance_parallel(
-    const Segment_3<K> &seg1,
-    const Segment_3<K> &seg2)
-{
-  return internal::squared_distance_parallel(seg1, seg2, K());
-}
-
-
-
-
-template <class K>
-inline
-typename K::FT
-squared_distance(const Segment_3<K> &seg1,
-		 const Segment_3<K> &seg2)
-{
-  return internal::squared_distance(seg1, seg2, K());
-}
-
-
-
-
-
-
-template <class K>
-inline
-typename K::FT
-squared_distance_parallel(
-    const Segment_3<K> &seg,
-    const Ray_3<K> &ray)
-{
-  return internal::squared_distance_parallel(ray,seg, K());
-}
-
-
-template <class K>
-inline
-typename K::FT
-squared_distance(
-    const Segment_3<K> &seg,
-    const Ray_3<K> &ray)
-{
-  return internal::squared_distance(ray, seg, K());
-}
-
-
-
-template <class K>
-inline
-typename K::FT
-squared_distance(
-    const Ray_3<K> & ray,
-    const Segment_3<K> & seg)
-{
-    return internal::squared_distance(seg, ray, K());
-}
-
-
-template <class K>
-inline
-typename K::FT
-squared_distance(
-    const Segment_3<K> &seg,
-    const Line_3<K> &line)
-{
-  return internal::squared_distance(seg, line, K());
-}
-
-
-template <class K>
-inline 
-typename K::FT
-squared_distance(
-    const Line_3<K> & line,
-    const Segment_3<K> & seg)
-{
-    return internal::squared_distance(seg, line, K());
-}
-
-
-
-
-template <class K>
-inline
-typename K::FT
-ray_ray_squared_distance_parallel(
-    const Vector_3<K> &ray1dir,
-    const Vector_3<K> &ray2dir,
-    const Vector_3<K> &s1_min_s2)
-{
-  return internal::ray_ray_squared_distance_parallel(ray1dir, ray2dir, 
-						  s1_min_s2, K());
-}
-
-template <class K>
-inline
-typename K::FT
-squared_distance(
-    const Ray_3<K> &ray1,
-    const Ray_3<K> &ray2)
-{
-  return internal::squared_distance(ray1, ray2, K());
-}
-
-
-
-
-
-template <class K>
-inline
-typename K::FT
-squared_distance(
-    const Line_3<K> &line,
-    const Ray_3<K> &ray)
-{
-  return internal::squared_distance(line, ray, K());
-}
-
-
-template <class K>
-inline
-typename K::FT
-squared_distance(
-    const Ray_3<K> & ray,
-    const Line_3<K> & line)
-{
-    return internal::squared_distance(line, ray, K());
-}
-
-
-
-
-template <class K>
-inline
-typename K::FT
-squared_distance(
-    const Line_3<K> &line1,
-    const Line_3<K> &line2)
-{  
-    return internal::squared_distance(line1, line2, K());
-}
-
-
-
-} //namespace CGAL
-
-
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/squared_distance_3_2.h b/3rdparty/CGAL-4.8/include/CGAL/squared_distance_3_2.h
deleted file mode 100644
index dac9b5b..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/squared_distance_3_2.h
+++ /dev/null
@@ -1,302 +0,0 @@
-// Copyright (c) 1998-2004  
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved. 
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Geert-Jan Giezeman, Andreas Fabri
-
-
-#ifndef CGAL_DISTANCE_3_2_H
-#define CGAL_DISTANCE_3_2_H
-
-#include <CGAL/squared_distance_3_0.h>
-
-#include <CGAL/Segment_3.h>
-#include <CGAL/Line_3.h>
-#include <CGAL/Ray_3.h>
-#include <CGAL/Plane_3.h>
-
-namespace CGAL {
-
-namespace internal {
-
-template <class K>
-bool
-contains_vector(const typename K::Plane_3 &pl, 
-		const typename K::Vector_3 &vec,
-		const K&)
-{
-  typedef typename K::RT RT;
-  return pl.a()*vec.hx() + pl.b()*vec.hy() + pl.c() * vec.hz() == RT(0);
-}
-
-
-template <class K>
-inline typename K::FT
-squared_distance(
-    const typename K::Point_3 & pt,
-    const typename K::Plane_3 & plane,
-    const K& k)
-{
-  typename K::Construct_vector_3 construct_vector;
-  typedef typename K::Vector_3 Vector_3;
-  Vector_3 diff = construct_vector(plane.point(), pt);
-  return squared_distance_to_plane(plane.orthogonal_vector(), diff, k);
-}
-
-
-
-template <class K>
-inline typename K::FT
-squared_distance(
-    const typename K::Plane_3 & plane,
-    const typename K::Point_3 & pt,
-    const K& k)
-{
-    return squared_distance(pt, plane, k);
-}
-
-template <class K>
-typename K::FT
-squared_distance(
-    const typename K::Line_3 &line,
-    const typename K::Plane_3 &plane,
-    const K& k)
-{
-    typedef typename K::FT FT;
-    if (contains_vector(plane, line.direction().vector(), k))
-        return squared_distance(plane, line.point(), k);
-    return FT(0);
-}
-
-
-template <class K>
-inline typename K::FT
-squared_distance(
-    const typename K::Plane_3 & p,
-    const typename K::Line_3 & line,
-    const K& k)
-{
-    return squared_distance(line, p, k);
-}
-
-template <class K>
-typename K::FT
-squared_distance(
-    const typename K::Ray_3 &ray,
-    const typename K::Plane_3 &plane,
-    const K& k)
-{
-    typename K::Construct_vector_3 construct_vector;
-    typedef typename K::Point_3 Point_3;
-    typedef typename K::Vector_3 Vector_3;
-    typedef typename K::RT RT;
-    typedef typename K::FT FT;
-    const Point_3 &start = ray.start();
-    const Point_3 &planepoint = plane.point();
-    Vector_3 start_min_pp = construct_vector(planepoint, start);
-    Vector_3 end_min_pp = ray.direction().vector();
-    const Vector_3 &normal = plane.orthogonal_vector();
-    RT sdm_rs2pp = wdot(normal, start_min_pp, k);
-    RT sdm_re2pp = wdot(normal, end_min_pp, k);
-    switch (CGAL_NTS sign(sdm_rs2pp)) {
-    case -1:
-        if (sdm_re2pp > RT(0))
-            return FT(0);
-        return squared_distance_to_plane(normal, start_min_pp, k);
-    case 0:
-    default:
-        return FT(0);
-    case 1:
-        if (sdm_re2pp < RT(0))
-            return FT(0);
-        return squared_distance_to_plane(normal, start_min_pp, k);
-    }
-}
-
-
-template <class K>
-inline typename K::FT
-squared_distance(
-    const typename K::Plane_3 & plane,
-    const typename K::Ray_3 & ray,
-    const K& k)
-{
-    return squared_distance(ray, plane, k);
-}
-
-template <class K>
-typename K::FT
-squared_distance(
-    const typename K::Segment_3 &seg,
-    const typename K::Plane_3 &plane,
-    const K& k)
-{
-    typename K::Construct_vector_3 construct_vector;
-    typedef typename K::Point_3 Point_3;
-    typedef typename K::Vector_3 Vector_3;
-    typedef typename K::RT RT;
-    typedef typename K::FT FT;
-    const Point_3 &start = seg.start();
-    const Point_3 &end = seg.end();
-    if (start == end)
-        return squared_distance(start, plane, k);
-    const Point_3 &planepoint = plane.point();
-    Vector_3 start_min_pp = construct_vector(planepoint, start);
-    Vector_3 end_min_pp = construct_vector(planepoint, end);
-    const Vector_3 &normal = plane.orthogonal_vector();
-    RT sdm_ss2pp = wdot(normal, start_min_pp, k);
-    RT sdm_se2pp = wdot(normal, end_min_pp, k);
-    switch (CGAL_NTS sign(sdm_ss2pp)) {
-    case -1:
-        if (sdm_se2pp >= RT(0))
-            return FT(0);
-        if (sdm_ss2pp * end_min_pp.hw() >= sdm_se2pp * start_min_pp.hw())
-            return squared_distance_to_plane(normal, start_min_pp, k);
-        else
-            return squared_distance_to_plane(normal, end_min_pp, k);
-    case 0:
-    default:
-        return FT(0);
-    case 1:
-        if (sdm_se2pp <= RT(0))
-            return FT(0);
-        if (sdm_ss2pp  * end_min_pp.hw() <= sdm_se2pp * start_min_pp.hw())
-            return squared_distance_to_plane(normal, start_min_pp, k);
-        else
-            return squared_distance_to_plane(normal, end_min_pp, k);
-    }
-}
-
-
-template <class K>
-inline typename K::FT
-squared_distance(
-    const typename K::Plane_3 & plane,
-    const typename K::Segment_3 & seg,
-    const K& k)
-{
-    return squared_distance(seg, plane, k);
-}
-
-
-} // namespace internal
-
-
-template <class K>
-bool
-contains_vector(const Plane_3<K> &pl, const Vector_3<K> &vec)
-{
-  return internal::contains_vector(pl,vec, K());
-}
-
-
-template <class K>
-inline 
-typename K::FT
-squared_distance(
-    const Point_3<K> & pt,
-    const Plane_3<K> & plane)
-{
-  return internal::squared_distance(pt, plane, K());
-}
-
-
-
-template <class K>
-inline 
-typename K::FT
-squared_distance(
-    const Plane_3<K> & plane,
-    const Point_3<K> & pt)
-{
-    return internal::squared_distance(pt, plane, K());
-}
-
-template <class K>
-inline
-typename K::FT
-squared_distance(
-    const Line_3<K> &line,
-    const Plane_3<K> &plane)
-{
-    return internal::squared_distance(line, plane, K());
-}
-
-
-template <class K>
-inline 
-typename K::FT
-squared_distance(
-    const Plane_3<K> & p,
-    const Line_3<K> & line)
-{
-    return internal::squared_distance(line, p, K());
-}
-
-template <class K>
-inline
-typename K::FT
-squared_distance(
-    const Ray_3<K> &ray,
-    const Plane_3<K> &plane)
-{
-  return internal::squared_distance(ray, plane, K());
-}
-
-
-
-template <class K>
-inline 
-typename K::FT
-squared_distance(
-    const Plane_3<K> & plane,
-    const Ray_3<K> & ray)
-{
-    return internal::squared_distance(ray, plane, K());
-}
-
-template <class K>
-inline
-typename K::FT
-squared_distance(
-    const Segment_3<K> &seg,
-    const Plane_3<K> &plane)
-{
-  return internal::squared_distance(seg, plane, K());
-
-}
-
-
-template <class K>
-inline 
-typename K::FT
-squared_distance(
-    const Plane_3<K> & plane,
-    const Segment_3<K> & seg)
-{
-    return internal::squared_distance(seg, plane, K());
-}
-
-
-} //namespace CGAL
-
-
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/sse2.h b/3rdparty/CGAL-4.8/include/CGAL/sse2.h
deleted file mode 100644
index 6ac5173..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/sse2.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (c) 1999,2007  
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved. 
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     :  Andreas Fabri
-
-#ifndef CGAL_SSE2_H
-#define CGAL_SSE2_H
-
-#include <emmintrin.h>
-
-#if defined ( _WIN32 )
-#define CGAL_ALIGN_16  __declspec(align(16))
-#elif defined( __GNUC__ ) || defined(__MINGW64__)
-#define  CGAL_ALIGN_16 __attribute__((aligned(16))) 
-#endif
-
-#endif // CGAL_SSE2_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/test_FPU_rounding_mode_impl.h b/3rdparty/CGAL-4.8/include/CGAL/test_FPU_rounding_mode_impl.h
deleted file mode 100644
index 306330b..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/test_FPU_rounding_mode_impl.h
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright (c) 2008  GeometryFactory (France)
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Laurent Rineau
-
-#ifdef CGAL_HEADER_ONLY
-#define CGAL_INLINE_FUNCTION inline
-#else
-#define CGAL_INLINE_FUNCTION
-#endif
-
-#ifndef CGAL_NDEBUG
-
-#include <CGAL/basic.h>
-#include <CGAL/assertions.h>
-
-namespace CGAL {
-
-struct Check_FPU_rounding_mode_is_restored {
-  FPU_CW_t mode;
-
-  Check_FPU_rounding_mode_is_restored()
-    : mode( FPU_get_cw()) {}
-
-  ~Check_FPU_rounding_mode_is_restored()
-  {
-    CGAL_assertion_msg( FPU_get_cw() == mode,
-                        "The default FPU rounding mode has not been restored "
-                        " before the exit of the program. "
-                        "That may be a bug in some CGAL kernel code.");
-  }
-};
-
-#ifdef CGAL_HEADER_ONLY
-
-inline const Check_FPU_rounding_mode_is_restored& get_static_check_fpu_rounding_mode_is_restored()
-{
-  static const Check_FPU_rounding_mode_is_restored check_fpu_rounding_mode_is_restored;
-  return check_fpu_rounding_mode_is_restored;
-}
-
-#else
-
-// A global object that emits a warning if the rounding mode at the
-// beginning and the end of the program are not the same.
-static const Check_FPU_rounding_mode_is_restored check_fpu_rounding_mode_is_restored;
-
-inline const Check_FPU_rounding_mode_is_restored& get_static_check_fpu_rounding_mode_is_restored()
-{ return check_fpu_rounding_mode_is_restored; }
-
-#endif // CGAL_HEADER_ONLY
-
-} // end namespace CGAL
-
-#endif // #ifnedef CGAL_NDEBUG
diff --git a/3rdparty/CGAL-4.8/include/CGAL/utility.h b/3rdparty/CGAL-4.8/include/CGAL/utility.h
deleted file mode 100644
index 8b41584..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/utility.h
+++ /dev/null
@@ -1,351 +0,0 @@
-// Copyright (c) 2003  
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved. 
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Michael Hoffmann <hoffmann at inf.ethz.ch>
-//                 Lutz Kettner <kettner at mpi-sb.mpg.de>
-//                 Sylvain Pion
-
-#ifndef CGAL_UTILITY_H
-#define CGAL_UTILITY_H 1
-
-#include <CGAL/config.h>
-#include <utility>
-#include <functional>
-
-// The Triple and Quadruple classes are NOT RECOMMENDED anymore.
-// We recommend that you use cpp11::tuple or cpp11::array instead
-// for new uses.
-
-namespace CGAL {
-
-namespace internal {
-
-template <int i, typename T>
-struct Tuple_get;
-
-template <typename T>
-struct Tuple_get<0, T>
-{
-  typedef typename T::first_type result_type;
-  static result_type       & get(T       & t) { return t.first; }
-  static result_type const & get(T const & t) { return t.first; }
-};
-
-template <typename T>
-struct Tuple_get<1, T>
-{
-  typedef typename T::second_type result_type;
-  static result_type       & get(T       & t) { return t.second; }
-  static result_type const & get(T const & t) { return t.second; }
-};
-
-template <typename T>
-struct Tuple_get<2, T>
-{
-  typedef typename T::third_type result_type;
-  static result_type       & get(T       & t) { return t.third; }
-  static result_type const & get(T const & t) { return t.third; }
-};
-
-template <typename T>
-struct Tuple_get<3, T>
-{
-  typedef typename T::fourth_type result_type;
-  static result_type       & get(T       & t) { return t.fourth; }
-  static result_type const & get(T const & t) { return t.fourth; }
-};
-
-}
-
-//+---------------------------------------------------------------------+
-//| Triple class                                                        |
-//+---------------------------------------------------------------------+
-
-template <class T1, class T2, class T3>
-class Triple
-{
-  typedef Triple<T1, T2, T3> Self;
-
-public:
-
-  typedef T1 first_type;
-  typedef T2 second_type;
-  typedef T3 third_type;
-
-  T1 first;
-  T2 second;
-  T3 third;
-
-  Triple() {}
-
-  Triple(const T1& a, const T2& b, const T3& c)
-  : first(a), second(b), third(c)
-  {}
-
-  template <class U, class V, class W>
-  Triple(const U& a, const V& b, const W& c)
-  : first(a), second(b), third(c)
-  {}
-
-  template <class U, class V, class W>
-  Triple& operator=(const Triple<U, V, W> &t) {
-    first = t.first;
-    second = t.second;
-    third = t.third;
-    return *this;
-  }
-
-  template < int i >
-  typename internal::Tuple_get<i, Self>::result_type const &
-  get() const
-  {
-    return internal::Tuple_get<i, Self>::get(*this);
-  }
-
-  template < int i >
-  typename internal::Tuple_get<i, Self>::result_type &
-  get()
-  {
-    return internal::Tuple_get<i, Self>::get(*this);
-  }
-
-};
-
-template <class T1, class T2, class T3>
-inline
-Triple<T1, T2, T3> make_triple(const T1& x, const T2& y, const T3& z)
-{
-  return Triple<T1, T2, T3>(x, y, z);
-}
-
-template <class T1, class T2, class T3>
-inline
-Triple<T1, T2, T3> make_tuple(const T1& x, const T2& y, const T3& z)
-{
-  return Triple<T1, T2, T3>(x, y, z);
-}
-
-template <class T1, class T2, class T3>
-inline bool operator==(const Triple<T1, T2, T3>& x,
-                       const Triple<T1, T2, T3>& y)
-{
-  return ( (x.first == y.first) &&
-           (x.second == y.second) &&
-           (x.third == y.third) );
-}
-
-template <class T1, class T2, class T3>
-inline bool operator!=(const Triple<T1, T2, T3>& x,
-                       const Triple<T1, T2, T3>& y)
-{
-  return !(x == y);
-}
-
-template <class T1, class T2, class T3>
-inline
-bool operator<(const Triple<T1, T2, T3>& x,
-               const Triple<T1, T2, T3>& y)
-{
-  return ( x.first < y.first ||
-           ( !(y.first < x.first) &&
-             ( x.second < y.second ||
-               ( !(y.second < x.second) && x.third < y.third ) ) ) );
-}
-//+---------------------------------------------------------------------+
-//| Quadruple class                                                     |
-//+---------------------------------------------------------------------+
-
-template <class T1, class T2, class T3, class T4>
-class Quadruple
-{
-  typedef Quadruple<T1, T2, T3, T4>  Self;
-
-public:
-
-  typedef T1 first_type;
-  typedef T2 second_type;
-  typedef T3 third_type;
-  typedef T4 fourth_type;
-
-  T1 first;
-  T2 second;
-  T3 third;
-  T4 fourth;
-
-  Quadruple() {}
-
-  Quadruple(const T1& a, const T2& b, const T3& c, const T4& d)
-  : first(a), second(b), third(c), fourth(d)
-  {}
-
-  template <class U, class V, class W, class X>
-  Quadruple(const U& a, const V& b, const W& c, const X& d)
-  : first(a), second(b), third(c), fourth(d)
-  {}
-
-  template <class U, class V, class W, class X>
-  Quadruple& operator=(const Quadruple<U, V, W, X> &q) {
-    first = q.first;
-    second = q.second;
-    third = q.third;
-    fourth = q.fourth;
-    return *this;
-  }
-
-  template < int i >
-  typename internal::Tuple_get<i, Self>::result_type const &
-  get() const
-  {
-    return internal::Tuple_get<i, Self>::get(*this);
-  }
-
-  template < int i >
-  typename internal::Tuple_get<i, Self>::result_type &
-  get()
-  {
-    return internal::Tuple_get<i, Self>::get(*this);
-  }
-};
-
-template <class T1, class T2, class T3, class T4>
-inline
-Quadruple<T1, T2, T3, T4>
-make_quadruple(const T1& x, const T2& y, const T3& z, const T4& zz)
-{
-  return Quadruple<T1, T2, T3, T4>(x, y, z, zz);
-}
-
-template <class T1, class T2, class T3, class T4>
-inline
-Quadruple<T1, T2, T3, T4>
-make_tuple(const T1& x, const T2& y, const T3& z, const T4& zz)
-{
-  return Quadruple<T1, T2, T3, T4>(x, y, z, zz);
-}
-
-template <class T1, class T2, class T3, class T4>
-inline
-bool
-operator==(const Quadruple<T1, T2, T3, T4>& x,
-           const Quadruple<T1, T2, T3, T4>& y)
-{
-  return ( (x.first == y.first) &&
-           (x.second == y.second) &&
-           (x.third == y.third) &&
-           (x.fourth == y.fourth) );
-}
-
-template <class T1, class T2, class T3, class T4>
-inline
-bool
-operator!=(const Quadruple<T1, T2, T3, T4>& x,
-           const Quadruple<T1, T2, T3, T4>& y)
-{
-  return ! (x == y);
-}
-
-template <class T1, class T2, class T3, class T4>
-inline
-bool
-operator<(const Quadruple<T1, T2, T3, T4>& x,
-          const Quadruple<T1, T2, T3, T4>& y)
-{
-  return ( x.first < y.first ||
-           ( !(y.first < x.first) &&
-             ( x.second < y.second ||
-               ( !(y.second < x.second) &&
-                 ( x.third < y.third ||
-                   (!(y.third < x.third) && x.fourth < y.fourth)) ) ) ) );
-}
-
-#if defined(CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE) || \
-    defined(CGAL_CFG_NO_CPP0X_DEFAULT_TEMPLATE_ARGUMENTS_FOR_FUNCTION_TEMPLATES) || \
-    BOOST_VERSION < 105000 || \
-    defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS)
-template <class T, class Compare>
-inline
-std::pair<  T, T >
-make_sorted_pair(const T& t1, const T& t2, Compare comp)
-{
-  return comp(t1, t2) ? std::make_pair(t1,t2) : std::make_pair(t2,t1);
-}
-
-template <class T>
-inline
-std::pair<T,T>
-make_sorted_pair(const T& t1, const T& t2)
-{
-  return make_sorted_pair(t1,t2, std::less<T>());
-}
-#else
-
-} //end of namespace CGAL
-
-#include <type_traits>
-
-namespace CGAL {
-
-struct Default_using_type
-{
-  template <typename Argument, typename Value>
-  struct Get {
-      typedef Argument type;
-  };
-
-  template <typename Value>
-  struct Get<Default_using_type, Value> {
-      typedef typename Value::type type;
-  };
-};
-
-template <class T_ = Default_using_type>
-struct less_cpp14
-{
-  template <class T1, class T2>
-  bool operator() (T1&& t1, T2&& t2) const
-  {
-    typedef typename Default_using_type::Get<
-      T_,
-      typename std::common_type<typename std::decay<T1>::type,
-                                typename std::decay<T2>::type> >::type T;
-    return std::less<T>()(t1,t2);
-  }
-};
-
-template <class T = Default_using_type,
-          class Compare = less_cpp14<T>,
-          class T1, class T2,
-          class A = typename Default_using_type::Get<T,
-            typename std::common_type<
-              typename std::decay<T1>::type,
-              typename std::decay<T2>::type > >::type,
-          class P = std::pair<A, A> >
-inline P make_sorted_pair(T1&& t1, T2&& t2, Compare comp = Compare())
-{
-  return comp(t1, t2) ? P(std::forward<T1>(t1), std::forward<T2>(t2))
-                      : P(std::forward<T2>(t2), std::forward<T1>(t1));
-}
-#endif
-
-} //namespace CGAL
-
-#endif // CGAL_UTILITY_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/value_type_traits.h b/3rdparty/CGAL-4.8/include/CGAL/value_type_traits.h
deleted file mode 100644
index be2410f..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/value_type_traits.h
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright (c) 2007-09  INRIA Sophia-Antipolis (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
-// 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(s) : Alberto Ganesh Barbati and Laurent Saboret
-
-#ifndef CGAL_VALUE_TYPE_TRAITS_H
-#define CGAL_VALUE_TYPE_TRAITS_H
-
-#include <iterator>
-
-namespace CGAL {
-
-/// \ingroup PkgPointSetProcessing
-/// Class providing the value type of an iterator, and
-/// in the case of an output iterator, a type of objects that can be put in it.
-///
-template <class T>
-struct value_type_traits
-{
-  #ifndef DOXYGEN_RUNNING
-  typedef typename std::iterator_traits<T>::value_type type;
-  #else
-  /// If `T` is `std::insert_iterator<Container>`, `std::back_insert_iterator<Container>` or
-  /// `std::front_insert_iterator<Container>`, then `type` is `Container::value_type`.
-  /// Otherwise, `type` is `std::iterator_traits<T>::%value_type`.
-
-  typedef unspecified_type type;
-  #endif
-};
-
-template <class Container>
-struct value_type_traits<std::back_insert_iterator<Container> >
-{
-  typedef typename Container::value_type type;
-};
-
-template <class Container>
-struct value_type_traits<std::insert_iterator<Container> >
-{
-  typedef typename Container::value_type type;
-};
-
-template <class Container>
-struct value_type_traits<std::front_insert_iterator<Container> >
-{
-  typedef typename Container::value_type type;
-};
-
-} //namespace CGAL
-
-#endif // CGAL_VALUE_TYPE_TRAITS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/version.h b/3rdparty/CGAL-4.8/include/CGAL/version.h
deleted file mode 100644
index a9fc6a9..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/version.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright (c) 2006  Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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.
-//
-// Author(s)     : -
-
-// This file is automatically created by create_internal_release.
-// Do not edit manually.
-
-#ifndef CGAL_VERSION_H
-#define CGAL_VERSION_H
-
-#define CGAL_xstr(s) #s
-#define CGAL_str(s) CGAL_xstr(s)
-
-#define CGAL_VERSION 4.8
-#define CGAL_VERSION_NR 1040801000
-#define CGAL_SVN_REVISION 99999
-#define CGAL_GIT_HASH dbb2be14621e43d107cfa7c3adf73d5374f5b618
-#define CGAL_VERSION_STR CGAL_str(CGAL_VERSION)
-
-#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/wlop_simplify_and_regularize_point_set.h b/3rdparty/CGAL-4.8/include/CGAL/wlop_simplify_and_regularize_point_set.h
deleted file mode 100644
index 03752c4..0000000
--- a/3rdparty/CGAL-4.8/include/CGAL/wlop_simplify_and_regularize_point_set.h
+++ /dev/null
@@ -1,715 +0,0 @@
-// Copyright (c) 2013-06  INRIA Sophia-Antipolis (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
-// 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(s) : Shihao Wu, Clement Jamin, Pierre Alliez 
-
-#ifndef CGAL_wlop_simplify_and_regularize_point_set_H
-#define CGAL_wlop_simplify_and_regularize_point_set_H
-
-#include <CGAL/Search_traits_3.h>
-#include <CGAL/Orthogonal_k_neighbor_search.h>
-#include <CGAL/property_map.h>
-#include <CGAL/point_set_processing_assertions.h>
-#include <CGAL/Memory_sizer.h>
-#include <CGAL/compute_average_spacing.h>
-
-#include <iterator>
-#include <set>
-#include <algorithm>
-#include <cmath>
-#include <ctime>
-
-#ifdef CGAL_LINKED_WITH_TBB
-#include <tbb/parallel_for.h>
-#include <tbb/blocked_range.h>
-#endif // CGAL_LINKED_WITH_TBB
-
-#include <CGAL/Simple_cartesian.h>
-#include <CGAL/Fuzzy_sphere.h>
-#include <CGAL/Search_traits_3.h>
-#include <CGAL/Bbox_3.h>
-
-namespace CGAL {
-// ----------------------------------------------------------------------------
-// Private section
-// ----------------------------------------------------------------------------
-/// \cond SKIP_IN_MANUAL
-
-namespace simplify_and_regularize_internal{
-
-// Item in the Kd-tree: position (Point_3) + index
-template <typename Kernel>
-class Kd_tree_element : public Kernel::Point_3
-{
-public:
-  unsigned int index;
-
-  // basic geometric types
-  typedef typename CGAL::Origin Origin;
-  typedef typename Kernel::Point_3 Base;
-
-  Kd_tree_element(const Origin& o = ORIGIN, unsigned int id=0)
-    : Base(o), index(id)
-  {}
-  Kd_tree_element(const Base& p, unsigned int id=0)
-    : Base(p), index(id)
-  {}
-  Kd_tree_element(const Kd_tree_element& other)
-    : Base(other), index(other.index)
-  {}
-};
-
-// Helper class for the Kd-tree
-template <typename Kernel>
-class Kd_tree_gt : public Kernel
-{
-public:
-  typedef Kd_tree_element<Kernel> Point_3;
-};
-
-template <typename Kernel>
-class Kd_tree_traits : public CGAL::Search_traits_3<Kd_tree_gt<Kernel> >
-{
-public:
-  typedef typename Kernel::Point_3 PointType;
-};
-
-/// Compute average and repulsion term, then 
-/// compute and update sample point locations
-/// 
-/// \pre `radius > 0`
-///
-/// @tparam Kernel Geometric traits class.
-/// @tparam Tree Kd-tree.
-///
-/// @return average term vector
-template <typename Kernel,
-          typename Tree,
-          typename RandomAccessIterator>
-typename Kernel::Point_3
-compute_update_sample_point(
-  const typename Kernel::Point_3& query, ///< 3D point to project
-  const Tree& original_kd_tree,          ///< original Kd-tree
-  const Tree& sample_kd_tree,            ///< sample Kd-tree
-  const typename Kernel::FT radius,      ///< neighborhood radius square
-  const std::vector<typename Kernel::FT>& original_densities, ///<  
-  const std::vector<typename Kernel::FT>& sample_densities ///< 
-)
-{
-  CGAL_point_set_processing_precondition(radius > 0);
-  bool is_original_densities_empty = original_densities.empty();
-  bool is_sample_densities_empty = sample_densities.empty();
-
-  // basic geometric types
-  typedef typename Kernel::Point_3 Point;
-  typedef typename Kernel::Vector_3 Vector;
-  typedef typename Kernel::FT FT;
-
-  //types for range search
-  typedef simplify_and_regularize_internal::Kd_tree_element<Kernel> Kd_tree_point;
-  typedef simplify_and_regularize_internal::Kd_tree_traits<Kernel> Traits;
-  typedef CGAL::Fuzzy_sphere<Traits> Fuzzy_sphere;
-
-  //range search for original neighborhood
-  Fuzzy_sphere fs(query, radius, 0.0);
-  std::vector<Kd_tree_point> neighbor_original_points;
-  original_kd_tree.search(std::back_inserter(neighbor_original_points), fs);
-
-  //Compute average term
-  FT radius2 = radius * radius;
-  Vector average = CGAL::NULL_VECTOR; 
-  FT weight = (FT)0.0, average_weight_sum = (FT)0.0;
-  FT iradius16 = -(FT)4.0 / radius2;
-
-  typename std::vector<Kd_tree_point>::iterator iter;
-  iter = neighbor_original_points.begin();
-  for (; iter != neighbor_original_points.end(); ++iter)
-  {
-    const Point& np = *iter;
-
-    Kd_tree_point& kp = *iter;
-    int original_index = kp.index;
-
-    FT dist2 = CGAL::squared_distance(query, np);
-    if (dist2 < 1e-10) continue;
-
-    weight = exp(dist2 * iradius16);
-
-    if (!is_original_densities_empty)
-    {
-      weight *= original_densities[original_index];
-    }
-    average_weight_sum += weight;
-    average = average + (np - CGAL::ORIGIN) * weight;
-  }
-
-  if (neighbor_original_points.empty() || average_weight_sum < FT(1e-10))
-  {
-    average = query - CGAL::ORIGIN;
-  }
-  else
-  {
-    average = average / average_weight_sum; 
-  }
-  neighbor_original_points.clear();
-  
-
-  //Compute repulsion term
-
-  Fuzzy_sphere fs2(query, radius, 0.0);
-  std::vector<Kd_tree_point> neighbor_sample_points;
-  sample_kd_tree.search(std::back_inserter(neighbor_sample_points), fs2);
-
-  weight = (FT)0.0;
-  FT repulsion_weight_sum = (FT)0.0;
-  Vector repulsion = CGAL::NULL_VECTOR; 
-
-  iter = neighbor_sample_points.begin();
-  for(; iter != neighbor_sample_points.end(); ++iter)
-  {
-    const Point& np = *iter;
-
-    Kd_tree_point& kp = *iter;
-    int sample_index = kp.index;
-
-    FT dist2 = CGAL::squared_distance(query, np);
-    if (dist2 < 1e-10) continue;
-    FT dist = std::sqrt(dist2);
-    
-    weight = std::exp(dist2 * iradius16) * std::pow(FT(1.0) / dist, 2); // L1
-   
-    if (!is_sample_densities_empty)
-    {
-      weight *= sample_densities[sample_index];
-    }
-
-    Vector diff = query - np;
-
-    repulsion_weight_sum += weight;
-    repulsion = repulsion + diff * weight;
-  }
-
-  if (neighbor_sample_points.size() < 3 || repulsion_weight_sum < FT(1e-10))
-  {
-    repulsion = CGAL::NULL_VECTOR;
-  }
-  else
-  {
-    repulsion = repulsion / repulsion_weight_sum; 
-  }
-  neighbor_sample_points.clear();
-
-  // Compute update sample point
-  Point update_sample = CGAL::ORIGIN + average + FT(0.45) * repulsion;
-  return update_sample;
-}
-
-
-/// Compute density weight for each original points,
-/// according to their neighbor original points
-/// 
-/// \pre `k >= 2`, radius > 0
-///
-/// @tparam Kernel Geometric traits class.
-/// @tparam Tree Kd-tree.
-///
-/// @return computed point
-template <typename Kernel, typename Tree>
-typename Kernel::FT
-compute_density_weight_for_original_point(
-  const typename Kernel::Point_3& query, ///< 3D point to project
-  Tree& original_kd_tree,                       ///< Kd-tree
-  const typename Kernel::FT radius       ///< neighbor radius square
-)
-{
-  CGAL_point_set_processing_precondition(radius > 0);
-
-  // basic geometric types
-  typedef typename Kernel::Point_3                         Point;
-  typedef typename Kernel::FT                              FT;
-                                                          
-  //types for range search
-  typedef simplify_and_regularize_internal::Kd_tree_element<Kernel> Kd_tree_point;
-  typedef simplify_and_regularize_internal::Kd_tree_traits<Kernel> Traits;
-  typedef CGAL::Fuzzy_sphere<Traits> Fuzzy_sphere;
-
-  //range search for original neighborhood
-  Fuzzy_sphere fs(query, radius, 0.0);
-  std::vector<Kd_tree_point> neighbor_original_points;
-
-  original_kd_tree.search(std::back_inserter(neighbor_original_points), fs);
-
-  //Compute density weight
-  FT radius2 = radius * radius;
-  FT density_weight = (FT)1.0;
-  FT iradius16 = -(FT)4.0 / radius2;
-
-  typename std::vector<Kd_tree_point>::iterator iter;
-  iter = neighbor_original_points.begin();
-
-  for (; iter != neighbor_original_points.end(); iter++)
-  {
-    const Point& np = *iter;
-
-    FT dist2 = CGAL::squared_distance(query, np);
-    if (dist2 < 1e-8) continue;
-    
-    density_weight += std::exp(dist2 * iradius16);
-  }
-
-  // output
-  return FT(1.0) / density_weight;
-}
-
-
-/// Compute density weight for sample point,
-/// according to their neighbor sample points
-/// 
-/// \pre `k >= 2`, radius > 0
-///
-/// @tparam Kernel Geometric traits class.
-/// @tparam Tree Kd-tree.
-///
-/// @return computed point
-template <typename Kernel, typename Tree>
-typename Kernel::FT
-compute_density_weight_for_sample_point(
-  const typename Kernel::Point_3& query, ///< 3D point to project
-  Tree& sample_kd_tree,                ///< Kd-tree
-  const typename Kernel::FT radius       ///< neighbor radius square
-)
-{
-  // basic geometric types
-  typedef typename Kernel::Point_3                          Point;
-  typedef typename Kernel::FT                               FT;
-
-  //types for range search
-  typedef simplify_and_regularize_internal::Kd_tree_element<Kernel> Kd_tree_point;
-  typedef simplify_and_regularize_internal::Kd_tree_traits<Kernel> Traits;
-  typedef CGAL::Fuzzy_sphere<Traits> Fuzzy_sphere;
-
-  //range search for original neighborhood
-  Fuzzy_sphere fs(query, radius, 0.0);
-  std::vector<Kd_tree_point> neighbor_sample_points;
-  sample_kd_tree.search(std::back_inserter(neighbor_sample_points), fs);
-
-  //Compute density weight
-  FT radius2 = radius * radius;
-  FT density_weight = (FT)1.0;
-  FT iradius16 = -(FT)4.0 / radius2;
-
-  typename std::vector<Kd_tree_point>::iterator iter;
-  iter = neighbor_sample_points.begin();
-
-  for (; iter != neighbor_sample_points.end(); iter++)
-  {
-    const Point& np = *iter;
-
-    FT dist2 = CGAL::squared_distance(query, np);
-    density_weight += std::exp(dist2 * iradius16);
-  }
-  
-  return density_weight;
-}
-
-} // namespace simplify_and_regularize_internal
-
-/// \endcond
-
-#ifdef CGAL_LINKED_WITH_TBB
-/// \cond SKIP_IN_MANUAL
-/// This is for parallelization of function: compute_denoise_projection()
-template <typename Kernel, typename Tree, typename RandomAccessIterator>
-class Sample_point_updater 
-{
-  typedef typename Kernel::Point_3   Point;
-  typedef typename Kernel::FT        FT;
-
-  std::vector<Point> &update_sample_points;
-  std::vector<Point> &sample_points;
-  const Tree &original_kd_tree;            
-  const Tree &sample_kd_tree;              
-  const typename Kernel::FT radius;  
-  const std::vector<typename Kernel::FT> &original_densities;
-  const std::vector<typename Kernel::FT> &sample_densities; 
-
-public:
-  Sample_point_updater(
-    std::vector<Point> &out,
-    std::vector<Point> &in,
-    const Tree &_original_kd_tree,            
-    const Tree &_sample_kd_tree,              
-    const typename Kernel::FT _radius,
-    const std::vector<typename Kernel::FT> &_original_densities,
-    const std::vector<typename Kernel::FT> &_sample_densities): 
-  update_sample_points(out), 
-    sample_points(in),
-    original_kd_tree(_original_kd_tree),
-    sample_kd_tree(_sample_kd_tree),
-    radius(_radius),
-    original_densities(_original_densities),
-    sample_densities(_sample_densities){} 
-
-
-  void operator() ( const tbb::blocked_range<size_t>& r ) const 
-  { 
-    for (size_t i = r.begin(); i != r.end(); ++i) 
-    {
-      update_sample_points[i] = simplify_and_regularize_internal::
-        compute_update_sample_point<Kernel, Tree, RandomAccessIterator>(
-        sample_points[i], 
-        original_kd_tree,
-        sample_kd_tree,
-        radius, 
-        original_densities,
-        sample_densities);
-    }
-  }
-};
-/// \endcond  
-#endif // CGAL_LINKED_WITH_TBB
-
-
-// ----------------------------------------------------------------------------
-// Public section
-// ----------------------------------------------------------------------------
-
-//=============================================================================
-/// \ingroup PkgPointSetProcessing
-/// This is an implementation of the Weighted Locally Optimal Projection (WLOP) simplification algorithm.
-/// The WLOP simplification algorithm can produce a set of 
-/// denoised, outlier-free and evenly distributed particles over the original 
-/// dense point cloud. 
-/// The core of the algorithm is a Weighted Locally Optimal Projection operator
-/// with a density uniformization term. 
-/// For more details, please refer to \cgalCite{wlop-2009}.
-///
-/// A parallel version of WLOP is provided and requires the executable to be 
-/// linked against the <a href="http://www.threadingbuildingblocks.org">Intel TBB library</a>.
-/// To control the number of threads used, the user may use the tbb::task_scheduler_init class.
-/// See the <a href="http://www.threadingbuildingblocks.org/documentation">TBB documentation</a> 
-/// for more details.
-///
-/// @tparam Concurrency_tag enables sequential versus parallel algorithm.
-///                         Possible values are `Sequential_tag`
-///                         and `Parallel_tag`.
-/// @tparam OutputIterator Type of the output iterator. 
-///         It must accept objects of type `Kernel::Point_3`.
-/// @tparam RandomAccessIterator Iterator over input points.
-/// @tparam PointPMap is a model of `ReadablePropertyMap` 
-///         with the value type of `ForwardIterator` as key type and `Kernel::Point_3` as value type.
-///         It can be omitted if the value type of ` RandomAccessIterator` is convertible  
-///         to `Kernel::Point_3`.
-/// @tparam Kernel Geometric traits class.
-///      It can be omitted and deduced automatically from the value type of `PointPMap`
-///      using `Kernel_traits`.
-
-// This variant requires all parameters.
-template <typename Concurrency_tag,
-          typename OutputIterator,
-          typename RandomAccessIterator,
-          typename PointPMap,
-          typename Kernel>
-OutputIterator
-wlop_simplify_and_regularize_point_set(
-  RandomAccessIterator first,  ///< random-access iterator to the first input point.
-  RandomAccessIterator beyond, ///< past-the-end iterator.
-  OutputIterator output,       ///< output iterator where output points are put.
-  PointPMap point_pmap,        ///< point property map.
-  double select_percentage,    ///< percentage of points to retain. 
-                               ///< The default value is set to 5 (\%).
-  double radius,               ///< spherical neighborhood radius.
-                               ///< This is a key parameter that needs to be finely tuned.  
-                               ///< The result will be irregular if too small, but a larger
-                               ///< value will impact the runtime.
-                               ///< In practice, choosing a radius such that the neighborhood of each sample point
-                               ///< includes at least two rings of neighboring sample points
-                               ///< gives satisfactory result.
-                               ///< The default value is set to 8 times the average spacing of the point set.
-  unsigned int iter_number,    ///< number of iterations to solve the optimsation problem. The default value is 35.
-                               ///< More iterations give a more regular result but increase the runtime.
-  bool require_uniform_sampling,///< an optional preprocessing, which will give better result
-                               ///< if the distribution of the input points is highly non-uniform. 
-                               ///< The default value is `false`. 
-  const Kernel&                ///< geometric traits.
-)
-{
-  // basic geometric types
-  typedef typename Kernel::Point_3   Point;
-  typedef typename Kernel::FT        FT;
-
-  // types for K nearest neighbors search structure
-  typedef simplify_and_regularize_internal::Kd_tree_element<Kernel> Kd_tree_element;
-  typedef simplify_and_regularize_internal::Kd_tree_traits<Kernel> Tree_traits;
-  typedef CGAL::Orthogonal_k_neighbor_search<Tree_traits> Neighbor_search;
-  typedef typename Neighbor_search::Tree Kd_Tree;
-
-  // precondition: at least one element in the container.
-  // to fix: should have at least three distinct points
-  // but this is costly to check
-  CGAL_point_set_processing_precondition(first != beyond);
-  CGAL_point_set_processing_precondition(select_percentage >= 0 
-                                         && select_percentage <= 100);
-
-  // Random shuffle
-  std::random_shuffle (first, beyond);
-
-  // Computes original(input) and sample points size 
-  std::size_t number_of_original = std::distance(first, beyond);
-  std::size_t number_of_sample = (std::size_t)(FT(number_of_original) * 
-                                 (select_percentage / FT(100.0)));
-  std::size_t first_index_to_sample = number_of_original - number_of_sample;
-
-  // The first point iter of original and sample points
-  RandomAccessIterator it;                             // point iterator
-  RandomAccessIterator first_original_iter = first;
-  RandomAccessIterator first_sample_iter = first;
-  std::advance(first_sample_iter, first_index_to_sample);
-
-  //Copy sample points
-  std::vector<Point> sample_points;
-  sample_points.reserve(number_of_sample);
-  unsigned int i;                                     
-
-  for(it = first_sample_iter; it != beyond; ++it)
-  {
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-    sample_points.push_back(get(point_pmap, it));
-#else
-    sample_points.push_back(get(point_pmap, *it));
-#endif
-  }
-  
-  //compute default neighbor_radius, if no radius in
-  if (radius < 0)
-  {
-    const unsigned int nb_neighbors = 6; // 1 ring
-    FT average_spacing = CGAL::compute_average_spacing<Concurrency_tag>(
-                               first, beyond,
-                               point_pmap,
-                               nb_neighbors);
-    radius = average_spacing * 8.0;
-
-#ifdef CGAL_PSP3_VERBOSE
-    std::cout << "The estimated radius size is: " << radius << std::endl;
-    std::cout << "Be careful! Using this radius estimation may not be able to have good performance/result for different input" << std::endl;
-#endif
-  }
-
-  FT radius2 = radius * radius;
-  CGAL_point_set_processing_precondition(radius > 0);
-
-  // Initiate a KD-tree search for original points
-  std::vector<Kd_tree_element> original_treeElements;
-  for (it = first_original_iter, i=0 ; it != beyond ; ++it, ++i)
-  {
-#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-      Point& p0 = get(point_pmap, it);
-#else
-      Point& p0 = get(point_pmap, *it);
-#endif 
-    
-    original_treeElements.push_back(Kd_tree_element(p0, i));
-  }
-  Kd_Tree original_kd_tree(original_treeElements.begin(), 
-                           original_treeElements.end());
-
-
-  std::vector<Point> update_sample_points(number_of_sample);
-  typename std::vector<Point>::iterator sample_iter;
-  
-  // Compute original density weight for original points if user needed
-  std::vector<FT> original_density_weights;
-
-  if (require_uniform_sampling)//default value is false
-  {
-    //todo: this part could also be parallelized if needed
-    for (it = first_original_iter, i = 0; it != beyond ; ++it, ++i)
-    {
-      FT density = simplify_and_regularize_internal::
-                   compute_density_weight_for_original_point<Kernel, Kd_Tree>
-                                         (
-                                         #ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-                                           get(point_pmap, it),
-                                         #else
-                                           get(point_pmap, *it),
-                                         #endif  
-                                           original_kd_tree, 
-                                           radius);
-
-      original_density_weights.push_back(density);
-    }
-  }
-
-  for (unsigned int iter_n = 0; iter_n < iter_number; ++iter_n)
-  {
-    // Initiate a KD-tree search for sample points
-    std::vector<Kd_tree_element> sample_treeElements;
-    for (i=0 ; i < sample_points.size(); i++)
-    {
-      Point& p0 = sample_points[i];
-      sample_treeElements.push_back(Kd_tree_element(p0,i));
-    }
-    Kd_Tree sample_kd_tree(sample_treeElements.begin(), sample_treeElements.end());
-
-    // Compute sample density weight for sample points
-    std::vector<FT> sample_density_weights;
-
-    for (sample_iter = sample_points.begin();
-         sample_iter != sample_points.end(); ++sample_iter)
-    {
-      FT density = simplify_and_regularize_internal::
-                   compute_density_weight_for_sample_point<Kernel, Kd_Tree>
-                   (*sample_iter, 
-                    sample_kd_tree, 
-                    radius);
-
-      sample_density_weights.push_back(density);
-    }
-    
-
-    typename std::vector<Point>::iterator update_iter = update_sample_points.begin();
-#ifndef CGAL_LINKED_WITH_TBB
-  CGAL_static_assertion_msg (!(boost::is_convertible<Concurrency_tag, Parallel_tag>::value),
-			     "Parallel_tag is enabled but TBB is unavailable.");
-#else
-    //parallel
-    if (boost::is_convertible<Concurrency_tag, Parallel_tag>::value)
-    {
-      tbb::blocked_range<size_t> block(0, number_of_sample);
-      Sample_point_updater<Kernel, Kd_Tree, RandomAccessIterator> sample_updater(
-                           update_sample_points,
-                           sample_points,          
-                           original_kd_tree,
-                           sample_kd_tree,
-                           radius, 
-                           original_density_weights,
-                           sample_density_weights);
-
-       tbb::parallel_for(block, sample_updater);
-    }else
-#endif
-    {
-      //sequential
-      for (sample_iter = sample_points.begin();
-        sample_iter != sample_points.end(); ++sample_iter, ++update_iter)
-      {
-        *update_iter = simplify_and_regularize_internal::
-          compute_update_sample_point<Kernel,
-                                      Kd_Tree,
-                                      RandomAccessIterator>
-                                      (*sample_iter,
-                                       original_kd_tree,
-                                       sample_kd_tree,
-                                       radius2,
-                                       original_density_weights,
-                                       sample_density_weights);
-      }
-    }
-    
-    sample_iter = sample_points.begin();
-    for (update_iter = update_sample_points.begin();
-         update_iter != update_sample_points.end();
-         ++update_iter, ++sample_iter)
-    {
-      *sample_iter = *update_iter;
-    }
-  }
-
-  // final output
-  for(sample_iter = sample_points.begin(); 
-      sample_iter != sample_points.end(); ++sample_iter)
-  {
-    *output++ = *sample_iter;
-  }
-
-  return output;
-}
-
-/// @cond SKIP_IN_MANUAL
-// This variant deduces the kernel from the iterator type.
-template <typename Concurrency_tag,
-          typename OutputIterator,     
-          typename RandomAccessIterator, 
-          typename PointPMap>
-OutputIterator 
-wlop_simplify_and_regularize_point_set(
-  RandomAccessIterator  first,  ///< iterator over the first input point
-  RandomAccessIterator  beyond, ///< past-the-end iterator
-  OutputIterator output,        ///< add back-inserter
-  PointPMap point_pmap, ///< property map RandomAccessIterator  -> Point_3
-  const double select_percentage,     ///< percentage of points to retain
-  double neighbor_radius,       ///< size of neighbors.
-  const unsigned int max_iter_number, ///< number of iterations.
-  const bool require_uniform_sampling     ///< if needed to compute density 
-                                      ///  to generate more rugularized result.                                 
-) 
-{
-  typedef typename boost::property_traits<PointPMap>::value_type  Point;
-  typedef typename Kernel_traits<Point>::Kernel                   Kernel;
-  
-  return wlop_simplify_and_regularize_point_set<Concurrency_tag>(
-      first, beyond,
-      output,
-      point_pmap,
-      select_percentage,
-      neighbor_radius,
-      max_iter_number,
-      require_uniform_sampling,
-      Kernel());
-}
-/// @endcond
-
-
-
-/// @cond SKIP_IN_MANUAL
-/// This variant creates a default point property map=Dereference_property_map.
-template <typename Concurrency_tag, 
-          typename OutputIterator,     
-          typename RandomAccessIterator >
-OutputIterator
-wlop_simplify_and_regularize_point_set(
-  RandomAccessIterator  first,  ///< iterator to the first input point.
-  RandomAccessIterator  beyond, ///< past-the-end iterator.
-  OutputIterator output,        ///< add back-inserter.
-  const double select_percentage = 5, ///< percentage of points to retain
-  double neighbor_radius = -1,  ///< size of neighbors.
-  const unsigned int max_iter_number = 35, ///< number of iterations.
-  const bool require_uniform_sampling = false ///< if needed to compute density   
-                                           ///to generate a more uniform result. 
-)
-{
-  return wlop_simplify_and_regularize_point_set<Concurrency_tag>(
-          first, beyond,
-          output,
-        #ifdef CGAL_USE_PROPERTY_MAPS_API_V1
-          make_dereference_property_map(first),
-        #else
-          make_identity_property_map(typename std::iterator_traits
-                                     <RandomAccessIterator >::
-                                     value_type()),
-        #endif
-          select_percentage, 
-          neighbor_radius, 
-          max_iter_number, 
-          require_uniform_sampling);
-}
-/// @endcond
-
-} //namespace CGAL
-
-#endif // CGAL_wlop_simplify_and_regularize_point_set_H
diff --git a/3rdparty/CGAL-4.8/scripts/cgal_create_CMakeLists b/3rdparty/CGAL-4.8/scripts/cgal_create_CMakeLists
deleted file mode 100755
index a0bc802..0000000
--- a/3rdparty/CGAL-4.8/scripts/cgal_create_CMakeLists
+++ /dev/null
@@ -1,639 +0,0 @@
-#!/bin/bash
-
-# Copyright (c) 1999,2000,2002-2007,2009,2011,2012
-# Utrecht University (The Netherlands),
-# ETH Zurich (Switzerland),
-# INRIA Sophia-Antipolis (France),
-# Max-Planck-Institute for Informatics Saarbruecken (Germany), 
-# and Tel-Aviv University (Israel).  All rights reserved.
-#
-# This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public License as
-# 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: svn+ssh://fcacciola@scm.gforge.inria.fr/svn/cgal/trunk/Scripts/scripts/cgal_create_makefile $
-# $Id: cgal_create_makefile 36976 2007-03-09 22:53:24Z reichel $
-#
-# Author(s)     : various
-
-# This script creates a CGAL cmake script with entries for files with a common
-# C++ file extension (as mentioned in the g++ man page) in the current directory.
-# Some options can be given or specified in a file.
-
-
-#LEDA
-#GMP
-#GMPXX
-#MPFR
-#MPFI
-#RS
-#BLAS
-#LAPACK
-#OPENNL
-#QGLViewer (or implied by Qt4?)
-#ESBTL
-#NTL
-
-#Core (implies GMP+GMPXX)
-#Qt4 (implies QT4)
-#ImageIO
-
-#not (yet) supported
-#F2C (comes with BLAS/LAPACK - something like that)
-#IPE (ask Laurent)
-#MKL (ask Andreas)
-
-create_cmake_script_with_options()
-{
-  qt4='n'
-
-  # parse options file
-  if [ -e "$OPTIONS_FILE" ]; then
-
-    OLDIFS="$IFS"
-    IFS=$'\n'
-    for LINE in `cat $OPTIONS_FILE`; do 
-
-      # CGAL components
-      if [ -z "$CGAL_COMPONENTS_GIVEN" ]; then # read file only if not given!
-        next_cgal_component=`echo $LINE | grep -v "#" | grep CGAL_COMPONENT`
-        if [ ! -z "$next_cgal_component" ]; then
-          next_cgal_component=${next_cgal_component/CGAL_COMPONENT /}
-          if [ -z "$CGAL_COMPONENTS" ]; then 
-            CGAL_COMPONENTS=$next_cgal_component
-          else
-            CGAL_COMPONENTS=$CGAL_COMPONENTS":"$next_cgal_component
-          fi
-        fi
-      fi
-
-      # Boost components
-      if [ -z "$BOOST_COMPONENTS_GIVEN" ]; then # read file only if not given!
-        next_boost_component=`echo $LINE | grep -v "#" | grep BOOST_COMPONENT`
-        if [ ! -z "$next_boost_component" ]; then
-          next_boost_component=${next_boost_component/BOOST_COMPONENT /}
-          if [ -z "$BOOST_COMPONENTS" ]; then 
-            BOOST_COMPONENTS=$next_boost_component
-          else
-            BOOST_COMPONENTS=$BOOST_COMPONENTS":"$next_boost_component
-          fi
-        fi
-      fi
-
-    done
-    IFS="$OLDIFS"
-  fi
-
-
-  # print makefile header
-  #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
-  cat << 'EOF'
-# Created by the script cgal_create_CMakeLists
-# This is the CMake script for compiling a set of CGAL applications.
-
-EOF
-  #---------------------------------------------------------------------------
-  if [ "$SINGLE_SOURCE" = "n" ]; then
-    echo "project( ${PROJECT} )"
-  else 
-    echo "project( ${SOURCE} )"
-  fi
-
-  #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
-  cat << 'EOF'
-
-
-cmake_minimum_required(VERSION 2.8.11)
-
-# CGAL and its components
-EOF
-if [ -n "$ENABLE_CTEST" ]; then
-  echo "enable_testing()"
-fi
-  #---------------------------------------------------------------------------
-  # echo "CGAL_COMPONENTS: $CGAL_COMPONENTS"
-  # echo "CGAL_PRECONFIGURED_LIBS: $CGAL_PRECONFIGURED_LIBS"
-  if [ ! -z "$CGAL_COMPONENTS" ]; then
-    # ensure capitalization
-
-    # CGAL: Core, Qt4, PDB, ImageIO
-    CGAL_COMPONENTS=${CGAL_COMPONENTS//[c|C][o|O][r|R][e|E]/Core}
-    CGAL_COMPONENTS=${CGAL_COMPONENTS//[q|Q][t|T]4/Qt4}
-    CGAL_COMPONENTS=${CGAL_COMPONENTS//[i|I][m|M][a|A][g|G][e|E][i|I][o|O]/ImageIO}
-  
-    # external libs
-
-    CGAL_COMPONENTS=${CGAL_COMPONENTS//[g|G][m|M][p|P]/GMP}
-    CGAL_COMPONENTS=${CGAL_COMPONENTS//[g|G][m|M][p|P][x|X][x|X]/GMPXX}
-
-    CGAL_COMPONENTS=${CGAL_COMPONENTS//[m|M][p|P][f|F][r|R]/MPFR}
-    CGAL_COMPONENTS=${CGAL_COMPONENTS//[l|L][e|E][d|D][a|A]/LEDA}
-    CGAL_COMPONENTS=${CGAL_COMPONENTS//[m|M][p|P][f|F][i|I]/MPFI}
-    CGAL_COMPONENTS=${CGAL_COMPONENTS//[r|R][s|S]/RS}
-
-    CGAL_COMPONENTS=${CGAL_COMPONENTS//[o|O][p|P][e|E][n|N][n|N][l|L]/OpenNL}
-    CGAL_COMPONENTS=${CGAL_COMPONENTS//[b|B][l|L][a|A][s|S]/BLAS}
-    CGAL_COMPONENTS=${CGAL_COMPONENTS//[l|L][a|A][p|P][a|A][c|C][k|K]/LAPACK}
-
-    CGAL_COMPONENTS=${CGAL_COMPONENTS//[q|Q][g|G][l|L][v|V][i|I][e|E][w|W][e|E][r|R]/QGLViewer}
-
-    CGAL_COMPONENTS=${CGAL_COMPONENTS//[z|Z][l|L][i|I][b|B]/zlib}
-
-    CGAL_COMPONENTS=${CGAL_COMPONENTS//[e|E][s|S][b|B][t|T][l|L]/ESBTL}
-
-    CGAL_COMPONENTS=${CGAL_COMPONENTS//[n|N][t|T][l|L]/NTL}
-
-    CGAL_COMPONENTS=${CGAL_COMPONENTS//[o|O][p|P][e|E][n|N][g|G][l|L]/OpenGL}
-
-
-#F2C?
-#IPE?
-#MKL?
-
-    OLDIFS="$IFS"
-    IFS=':'
-    for cgal_component in $CGAL_COMPONENTS; do
-      COMPONENT=`echo $cgal_component | tr '[:upper:]' '[:lower:]'`
-
-      # for qtmoc
-      if [ "$COMPONENT" = "qt4" ]; then
-        qt4='y'
-      fi
-
-    done
-    IFS=$OLDIFS
-
-  fi
-
-  if [ "$CGAL_PRECONFIGURED_LIBS" = "y" ]; then
-    CGAL_COMPONENTS=${CGAL_COMPONENTS}" ALL_PRECONFIGURED_LIBS"
-  fi
-
-  echo "find_package( CGAL QUIET COMPONENTS ${CGAL_COMPONENTS//:/ } )"
-
-  #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
-  cat << 'EOF'
-
-if ( NOT CGAL_FOUND )
-
-  message(STATUS "This project requires the CGAL library, and will not be compiled.")
-  return()  
-
-endif()
-
-# include helper file
-include( ${CGAL_USE_FILE} )
-
-EOF
-  #---------------------------------------------------------------------------
-
-  #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
-  cat << 'EOF'
-
-# Boost and its components
-EOF
-  #---------------------------------------------------------------------------
-
-  if [ ! -z "$BOOST_COMPONENTS" ]; then
-
-    echo "find_package( Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS//:/ } )"
-
-  else
-
-    echo "find_package( Boost REQUIRED )"
-
-  fi # additional Boost components
-
-  #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
-  cat << 'EOF'
-
-if ( NOT Boost_FOUND )
-
-  message(STATUS "This project requires the Boost library, and will not be compiled.")
-
-  return()  
-
-endif()
-EOF
-  #---------------------------------------------------------------------------
-
-
-  #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
-  cat << 'EOF'
-
-# include for local directory
-EOF
-  #---------------------------------------------------------------------------
-
-  if [ -d include ] ; then
-    echo 'include_directories( BEFORE include )'
-  fi		
-
-  #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
-  cat << 'EOF'
-
-# include for local package
-EOF
-  #---------------------------------------------------------------------------
-
-  # includes for local package
-  if [ -d ../../include ] ; then
-    echo 'include_directories( BEFORE ../../include )'
-  fi
-  if [ -d ../include ] ; then
-    echo 'include_directories( BEFORE ../include )'
-  fi
-
-  if [ ! -z "$PACKAGES" ]; then
-    #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
-    cat << 'EOF'
-
-# include of additional packages
-EOF
-    #-------------------------------------------------------------------------
-  fi
-
-  # Qt4
-  if [ "$qt4" = "y" ]; then
-
-    #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
-    cat << 'EOF'
-
-# Qt4
-set( QT_USE_QTXML     true )
-set( QT_USE_QTMAIN    true )
-set( QT_USE_QTSCRIPT  true )
-set( QT_USE_QTOPENGL  true )
-
-find_package(Qt4)  
-
-if ( NOT QT_FOUND )
-
-  message(STATUS "This project requires the Qt4 library, and will not be compiled.")
-  return()  
-
-endif()
-EOF
-    #-------------------------------------------------------------------------
-
-  fi #qt4
-
-  if [ ! -z "$BOOST_COMPONENTS" ]; then
-    #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
-    cat << 'EOF'
-
-# Boost linking
-EOF
-    #-------------------------------------------------------------------------
-
-    OLDIFS="$IFS"
-    IFS=':'
-    for boost_component in $BOOST_COMPONENTS; do
-      BOOST_COMPONENT=`echo $boost_component | tr '[:lower:]' '[:upper:]'`
-      echo "add_definitions( \"-DCGAL_USE_BOOST_${BOOST_COMPONENT}\" )"
-      echo "list(APPEND CGAL_3RD_PARTY_LIBRARIES \${Boost_${BOOST_COMPONENT}_LIBRARY} )"
-    done
-    IFS=$OLDIFS
-
-  fi # additional Boost components
-
-
-  # All Files or Single Source
-
-  if [ "$SINGLE_SOURCE" = "n" ]; then #=======================================
-
-    ###############
-    # ALL SOURCES #
-    ###############
-
-    #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
-    cat << 'EOF'
-
-
-# Creating entries for all C++ files with "main" routine
-# ##########################################################
-
-EOF
-    #-------------------------------------------------------------------------
-
-
-    if [ "$qt4" = "y" ]; then
-
-      echo "include( CGAL_CreateSingleSourceCGALProgramQt4 )"
-
-    else
- 
-      echo "include( CGAL_CreateSingleSourceCGALProgram )"
-
-    fi
-    # add a new line
-    echo
-
-    # Qt4
-    if [ "$qt4" = "y" ]; then
-      #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
-      cat << 'EOF'
-
-if ( CGAL_Qt4_FOUND AND QT_FOUND )
-
-  include( ${QT_USE_FILE} )
-  include_directories( ${QT_INCLUDE_DIR} )  
-
-endif()
-
-EOF
-      #-----------------------------------------------------------------------
-    fi # qt4
-
-    for file in `ls *.cc *.cp *.cxx *.cpp *.CPP *.c++ *.C 2> /dev/null | sort` ; do
-      # Create an executable for each cpp that  contains a function "main()"
-      BASE=`basename $file .cc`
-      BASE=`basename $BASE .cp`
-      BASE=`basename $BASE .cxx`
-      BASE=`basename $BASE .cpp`
-      BASE=`basename $BASE .CPP`
-      BASE=`basename $BASE .c++`
-      BASE=`basename $BASE .C`
-      egrep '\bmain[ \t]*\(' $file >/dev/null 2>&1
-      if [ $? -eq 0 ]; then
-        if [ "$qt4" = "y" ]; then
-          echo "create_single_source_cgal_program_qt4( \"$file\" )"
-        else
-          echo "create_single_source_cgal_program( \"$file\" )"
-        fi
-        if [ -n "$ENABLE_CTEST" ]; then 
-          if [ -f "$BASE.cin" ] ; then
-            CIN=" < $BASE.cin"
-          else
-            CIN=
-          fi
-          cat <<EOF
-add_test( "$BASE" \${CMAKE_CTEST_COMMAND}
-  --build-and-test "\${CMAKE_CURRENT_SOURCE_DIR}"
-                   "\${CMAKE_CURRENT_BINARY_DIR}"
-  --build-generator "\${CMAKE_GENERATOR}"
-  --build-makeprogram "\${CMAKE_MAKE_PROGRAM}"
-  --build-target $BASE
-  --build-no-clean
-  --build-run-dir "\${CMAKE_CURRENT_SOURCE_DIR}"
-  --test-command sh -c "\${CMAKE_CURRENT_BINARY_DIR}/$BASE$CIN" )
-EOF
-        fi
-      fi
-      #add a new line
-      echo 
-    done
-    
-  else #======================================================================
-
-    #################
-    # SINGLE_SOURCE #
-    #################
-
-    target_name=$SOURCE
-
-    echo
-    echo
-    echo "# Creating entries for target: $target_name"
-    #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
-    cat << 'EOF'
-# ############################
-EOF
-    #-------------------------------------------------------------------------
-
-    for file in `ls *.cc *.cp *.cxx *.cpp *.CPP *.c++ *.C 2> /dev/null | sort` ; do
-      all="$all $file"
-    done
-
-    # Qt4
-    if [ "$qt4" = "y" ]; then
-      #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
-      cat << 'EOF'
-
-if ( CGAL_Qt4_FOUND AND QT_FOUND )
-
-  include( ${QT_USE_FILE} )
-  include_directories( ${QT_INCLUDE_DIR} )  
-
-EOF
-      #-----------------------------------------------------------------------
-
-      echo "  # UI files (Qt Designer files)"
-      for file in `ls *.ui 2> /dev/null | sort`; do
-        echo "  qt4_wrap_ui( DT_UI_FILES $file )"
-      done
-      echo
-      echo "  # qrc files (resources files, that contain icons, at least)"
-      for file in `ls *.qrc 2> /dev/null | sort`; do
-        echo "  qt4_add_resources ( DT_RESOURCE_FILES ./$file )"
-      done
-      echo
-      MOC_FILES=""
-      echo "  # use the Qt MOC preprocessor on classes that derives from QObject"
-      for file in `ls include/*.h 2> /dev/null | sort`; do
-        BASE=`basename $file .h`
-        egrep 'Q_OBJECT' $file >/dev/null 2>&1
-        if [ $? -eq 0 ]; then
-          echo "  qt4_generate_moc( include/${BASE}.h ${BASE}.moc )"
-          MOC_FILES="${BASE}.moc $MOC_FILES"
-        fi
-      done
-      for file in `ls *.h 2> /dev/null | sort`; do
-        BASE=`basename $file .h`
-        egrep 'Q_OBJECT' $file >/dev/null 2>&1
-        if [ $? -eq 0 ]; then
-          echo "  qt4_generate_moc( ${BASE}.h ${BASE}.moc )"
-          MOC_FILES="${BASE}.moc $MOC_FILES"
-        fi
-      done
-      for file in `ls *.cc *.cp *.cxx *.cpp *.CPP *.c++ *.C 2> /dev/null | sort` ; do
-        BASE=`basename $file .cc`
-        BASE=`basename $BASE .cp`
-        BASE=`basename $BASE .cxx`
-        BASE=`basename $BASE .cpp`
-        BASE=`basename $BASE .CPP`
-        BASE=`basename $BASE .c++`
-        BASE=`basename $BASE .C`
-        egrep 'Q_OBJECT' $file >/dev/null 2>&1
-        if [ $? -eq 0 ]; then
-          echo "  qt4_generate_moc( ${BASE}.cpp ${BASE}.moc )"
-          MOC_FILES="${BASE}.moc $MOC_FILES"
-        fi
-      done
-
-      #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
-      cat << 'EOF'
-
-endif()
-EOF
-      #-----------------------------------------------------------------------
-
-      all="${all} ${MOC_FILES} \${DT_UI_FILES} \${DT_RESOURCE_FILES}"
-
-    fi # qt4
-
-    # no 'cat' here, as variable substitution required
-    echo
-    echo "add_executable( ${target_name} ${all} )"
-    echo
-    echo "add_to_cached_list( CGAL_EXECUTABLE_TARGETS ${target_name} )"
-    echo
-    echo "# Link the executable to CGAL and third-party libraries"
-    LIBS=""
-    if [ "$qt4" = "y" ]; then
-      LIBS="\${QT_LIBRARIES}" 
-    fi
-    LIBS=$LIBS" \${CGAL_LIBRARIES} \${CGAL_3RD_PARTY_LIBRARIES}"
-    echo "target_link_libraries(${target_name}  $LIBS )"
-
-  fi # single source or all files #===========================================
-
-  #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
-  cat << 'EOF'
-EOF
-  #---------------------------------------------------------------------------
-
-echo
-
-}
-
-usage()
-{
-  echo "Usage: `basename $0` [-s source] [-c cgal-component1:cgal-component2:...] [-b boost-component1:boost-component2:...] [-p] [-o options_file='`pwd`/cgal_cmake_options:$HOME/.cgal_cmake_options_rc'] [-v] [-h]" >&2
-  echo >&2
-  echo "  -s source If this parameter is given the script will create one single executable for 'source' with all source files; otherwise it creates one executable for each main'ed source." >&2
-  echo "  cgal_componentX - must be a valid cgal component, examples are 'Core','ImageIO','Qt4' ('benchmark', 'symbolic')." >&2
-  echo "  boost_componentX - must be a valid boost component, like 'filesystem', 'program_options'." >&2
-  echo "  -p use all of CGAL's preconfigured libraries" >&2
-  echo "  -o options_file - file with PACKAGE, DIRECTORY, CGAL_COMPONENT, and BOOST_COMPONENT directives" >&2
-  echo "  -v the version" >&2
-  echo "  -h this info screen" >&2
-  echo  >&2
-}
-
-
-SINGLE_SOURCE='n'
-SOURCE=""
-
-CGAL_COMPONENTS_GIVEN=""
-CGAL_COMPONENTS=""
-
-CGAL_PRECONFIGURED_LIBS='n'
-
-BOOST_COMPONENTS_GIVEN=""
-BOOST_COMPONENTS=""
-
-OPTIONS_FILE=`pwd`"/cgal_cmake_options"
-
-if [ ! -e "$OPTIONS_FILE" ]; then
-  OPTIONS_FILE="${HOME}/.cgal_cmake_options_rc"
-fi
-
-# parse command line arguments
-while getopts s:c:b:o:phvt OPT; do
-  case "$OPT" in
-    s)  SINGLE_SOURCE='y'
-        SOURCE=$OPTARG
-        if [ "${SOURCE:(-3)}" = ".cc" ]; then
-           echo "Error: Source must not end with '.cc'!" >&2
-           echo
-           usage
-           exit 2
-        fi
-        if [ "${SOURCE:(-3)}" = ".cp" ]; then
-           echo "Error: Source must not end with '.cp'!" >&2
-           echo
-           usage
-           exit 2
-        fi
-        if [ "${SOURCE:(-4)}" = ".cxx" ]; then
-           echo "Error: Source must not end with '.cxx'!" >&2
-           echo
-           usage
-           exit 2
-        fi
-        if [ "${SOURCE:(-4)}" = ".cpp" ]; then
-           echo "Error: Source must not end with '.cpp'!" >&2
-           echo
-           usage
-           exit 2
-        fi
-        if [ "${SOURCE:(-4)}" = ".CPP" ]; then
-           echo "Error: Source must not end with '.CPP'!" >&2
-           echo
-           usage
-           exit 2
-        fi
-        if [ "${SOURCE:(-4)}" = ".c++" ]; then
-           echo "Error: Source must not end with '.c++'!" >&2
-           echo
-           usage
-           exit 2
-        fi
-        if [ "${SOURCE:(-2)}" = ".C" ]; then
-           echo "Error: Source must not end with '.C'!" >&2
-           echo
-           usage
-           exit 2
-        fi
-
-        ;;
-
-    c)  CGAL_COMPONENTS_GIVEN='y'
-        CGAL_COMPONENTS=$OPTARG
-        ;;
-    b)  BOOST_COMPONENTS_GIVEN='y'
-        BOOST_COMPONENTS=$OPTARG
-        ;;
-
-    o)  OPTIONS_FILE=$OPTARG
-        if [ ! -e "$OPTIONS_FILE" ]; then
-          echo "Options-file '$OPTIONS_FILE' does not exist." >&2
-          exit 1
-        fi
-        ;;
-    p)  CGAL_PRECONFIGURED_LIBS='y'
-        ;;
-    t)  ENABLE_CTEST='y'
-        ;;
-    h)  usage
-        exit 0
-        ;;
-    v)  echo "`basename $0` version 0.1"
-        exit 0
-        ;;
-    \?) # getopts issues an error message
-        usage
-        exit 1
-        ;;
-  esac
-done
-
-shift `expr $OPTIND - 1`
-
-#echo "FILE: $OPTIONS_FILE"
-#echo "BOOST_COMPONENTS: $BOOST_COMPONENTS"
-echo "CGAL_COMPONENTS: $CGAL_COMPONENTS"
-#echo "SINGLE_SOURCE: $SINGLE_SOURCE"
-#echo "SOURCE: $SOURCE"
-
-OUTPUTFILE=CMakeLists.txt
-PROJECT=`basename $PWD`
-
-if [ -f ${OUTPUTFILE} ] ; then
-  echo "moving $OUTPUTFILE to ${OUTPUTFILE}.bak ..."
-  echo
-  mv -f $OUTPUTFILE ${OUTPUTFILE}.bak
-fi
-
-create_cmake_script_with_options | tee $OUTPUTFILE
-
-echo
-echo "created $OUTPUTFILE in $PWD ..."
diff --git a/3rdparty/CGAL-4.8/src/CGAL/CMakeLists.txt b/3rdparty/CGAL-4.8/src/CGAL/CMakeLists.txt
deleted file mode 100644
index 2d6af2a..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL/CMakeLists.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-message("Configuring libCGAL")
-
-use_essential_libs()
-
-include_directories (SYSTEM ${CGAL_3RD_PARTY_INCLUDE_DIRS})
-
-add_definitions(${CGAL_3RD_PARTY_DEFINITIONS})
-
-link_directories(${CGAL_3RD_PARTY_LIBRARIES_DIRS})
-
-collect_cgal_library(CGAL "") 
-
-target_link_libraries(CGAL ${CGAL_3RD_PARTY_LIBRARIES})
-
-message("libCGAL is configured")
diff --git a/3rdparty/CGAL-4.8/src/CGAL/Random.cpp b/3rdparty/CGAL-4.8/src/CGAL/Random.cpp
deleted file mode 100644
index 471accc..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL/Random.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (c) 1997-2001  
-// Utrecht University (The Netherlands),
-// ETH Zurich (Switzerland),
-// INRIA Sophia-Antipolis (France),
-// Max-Planck-Institute Saarbruecken (Germany),
-// and Tel-Aviv University (Israel).  All rights reserved. 
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// 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(s)     : Sven Schönherr <sven at inf.ethz.ch>
-
-#ifndef CGAL_HEADER_ONLY
-
-#include <CGAL/Random.h>
-#include <CGAL/Random_impl.h>
-
-namespace CGAL {
-
-Random  default_random;
-
-} //namespace CGAL
-
-#endif
diff --git a/3rdparty/CGAL-4.8/src/CGAL/primes.cpp b/3rdparty/CGAL-4.8/src/CGAL/primes.cpp
deleted file mode 100644
index 63b8b4d..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL/primes.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (c) Max-Planck-Institute Saarbruecken (Germany).
-// All rights reserved.
-//
-// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation; 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(s)     : Michael Hemmer
-
-#ifndef CGAL_HEADER_ONLY
-
-#include <CGAL/primes.h>
-#include <CGAL/primes_impl.h>
-
-#endif
diff --git a/3rdparty/CGAL-4.8/src/CGAL_Core/CMakeLists.txt b/3rdparty/CGAL-4.8/src/CGAL_Core/CMakeLists.txt
deleted file mode 100644
index 08b450f..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_Core/CMakeLists.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-message("Configuring libCGAL_Core")
- 
-use_essential_libs()
-
-include_directories (SYSTEM ${CGAL_3RD_PARTY_INCLUDE_DIRS})
-
-add_definitions(${CGAL_3RD_PARTY_DEFINITIONS})
-
-link_directories    ( ${CGAL_LIBRARIES_DIR} ${CGAL_3RD_PARTY_LIBRARIES_DIRS} )
-
-collect_cgal_library(CGAL_Core "")
- 
-# CGAL_Core does not depend on CGAL in either DEBUG or RELEASE, but we
-# still link it.
-target_link_libraries( CGAL_Core CGAL ${CGAL_3RD_PARTY_LIBRARIES} )
-
-add_dependencies( CGAL_Core CGAL )
-
-message("libCGAL_Core is configured")
-
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/CMakeLists.txt b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/CMakeLists.txt
deleted file mode 100644
index 7b0a1fa..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/CMakeLists.txt
+++ /dev/null
@@ -1,54 +0,0 @@
-message("Configuring libCGAL_ImageIO")
-
-find_package( OpenGL )
-find_package( ZLIB )
-
-
-if(OPENGL_FOUND)
-  message( STATUS "OpenGL include:     ${OPENGL_INCLUDE_DIR}" )
-  message( STATUS "OpenGL libraries:   ${OPENGL_LIBRARIES}" )
-  
-  cache_set(CGAL_ImageIO_3RD_PARTY_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR} )
-  cache_set(CGAL_ImageIO_3RD_PARTY_LIBRARIES    ${OPENGL_LIBRARIES}   )
-
-  if(ZLIB_FOUND)
-    get_dependency_version(ZLIB)
-    cache_set(CGAL_ImageIO_3RD_PARTY_INCLUDE_DIRS ${CGAL_ImageIO_3RD_PARTY_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR} )
-    cache_set(CGAL_ImageIO_3RD_PARTY_LIBRARIES    ${CGAL_ImageIO_3RD_PARTY_LIBRARIES} ${ZLIB_LIBRARY} )
-    cache_set(CGAL_ImageIO_3RD_PARTY_DEFINITIONS  "-DCGAL_USE_ZLIB")
-    cache_set(CGAL_ImageIO_USE_ZLIB "ON")
-  endif(ZLIB_FOUND)
-
-  set( CGAL_ImageIO_BASENAME CGAL_ImageIO)
-  
-  if(COMMAND add_config_flag)
-    set( CGAL_HAS_IMAGEIO TRUE ) 
-    add_config_flag( CGAL_HAS_IMAGEIO )
-  endif()
-
-  use_essential_libs()
-
-  include_directories( SYSTEM ${CGAL_3RD_PARTY_INCLUDE_DIRS} ${CGAL_ImageIO_3RD_PARTY_INCLUDE_DIRS} .)
-  
-  link_directories    ( ${CGAL_LIBRARIES_DIR} ${CGAL_3RD_PARTY_LIBRARIES_DIRS} )
-
-  collect_cgal_library( CGAL_ImageIO "")
-  
-  add_dependencies( CGAL_ImageIO CGAL )
-  
-  add_definitions( ${CGAL_3RD_PARTY_DEFINITIONS} ${CGAL_ImageIO_3RD_PARTY_DEFINITIONS} )
-  
-  # CGAL_ImageIO only depends on CGAL in DEBUG, but we still link it
-  # in both build types.
-  target_link_libraries( CGAL_ImageIO CGAL ${CGAL_3RD_PARTY_LIBRARIES} ${CGAL_ImageIO_3RD_PARTY_LIBRARIES} )
-  
-message("libCGAL_ImageIO is configured")
-    
-else(OPENGL_FOUND)
-  message( STATUS "libCGAL_ImageIO needs OpenGL, cannot be configured.")
-endif(OPENGL_FOUND)
-  
-if(NOT ZLIB_FOUND)
-  message( STATUS "NOTICE: libCGAL_ImageIO needs ZLib to read compressed files. That feature will not be activated.")
-endif(NOT ZLIB_FOUND) 
-
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/analyze.cpp b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/analyze.cpp
deleted file mode 100644
index a40db32..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/analyze.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-#ifndef CGAL_HEADER_ONLY
-
-#include "analyze.h"
-#include "analyze_impl.h"
-
-#endif // CGAL_HEADER_ONLY
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/analyze.h b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/analyze.h
deleted file mode 100644
index 7014b92..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/analyze.h
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-#ifndef ANALYZE_H
-#define ANALYZE_H
-
-#ifdef _MSC_VER
-#pragma warning ( disable : 4068 4786 4081 4267 )
-#endif
-
-
-
-#include <CGAL/ImageIO.h>
-
-/* read analyse format header
-
-   return:
-   -1: error
-   0: success
- */
-int readAnalyzeHeader(const char* name,_image *im);
-
-int testAnalyzeHeader(char *magic,const char *name);
-
-/** creates an return the file format structure associated with the Analyze file format */
-PTRIMAGE_FORMAT createAnalyzeFormat();
-
-/* 
-   return:
-   -1: error
-    1: success
- */
-int writeAnalyze( char *basename, _image* im ) ;
-
-
-/* 
-   return:
-   -1: error
-    1: success
- */
-int writeAnalyzeHeader( const _image* im ) ;
-
-
-
-/* 
-   return:
-   -1: error
-    1: success
- */
-int writeAnalyzeData( const _image* im ) ;
-
-#ifdef CGAL_HEADER_ONLY
-#include "analyze_impl.h"
-#endif // CGAL_HEADER_ONLY
-
-#endif
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/analyze_impl.h b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/analyze_impl.h
deleted file mode 100644
index 4f92374..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/analyze_impl.h
+++ /dev/null
@@ -1,852 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-#include <cstring>
-
-#ifdef CGAL_HEADER_ONLY
-#define CGAL_INLINE_FUNCTION inline
-#else
-#define CGAL_INLINE_FUNCTION
-#endif
-
-/* compile time endianness */
-/* replaced by _getEndianness()
-   see below
-#if (defined (_ALPHA_) || defined (_LINUX_))
-#define ARCHITECTURE_ENDIANNESS END_LITTLE
-#else
-#define ARCHITECTURE_ENDIANNESS END_BIG
-#endif
-*/
-
-/** Magic header for ANALYZE files written in little endian format */
-#define ANALYZE_LE_MAGIC "\000\000\001\134"
-/** Magic header for ANALYZE files written in big endian format */
-#define ANALYZE_BE_MAGIC "\134\001\000\000"
-
-#define DT_NONE			0 
-#define DT_UNKNOWN              0 /*Unknown data type*/ 
-#define DT_BINARY               1 /*Binary (1 bit per voxel)*/ 
-#define DT_UNSIGNED_CHAR        2 /*Unsigned character (8 bits per voxel)*/ 
-#define DT_SIGNED_SHORT         4 /*Signed short (16 bits per voxel)*/ 
-#define DT_SIGNED_INT           8 /*Signed integer (32 bits per voxel)*/ 
-#define DT_FLOAT                16 /*Floating point (32 bits per voxel)*/ 
-#define DT_COMPLEX              32 /*Complex (64 bits per voxel; 2 floating point numbers) */
-#define DT_DOUBLE               64 /*Double precision (64 bits per voxel)*/ 
-#define DT_RGB                  128 /* */
-#define DT_ALL                  255 /* */
-
-#include <cstring>
-
-struct header_key                       /*      header_key       */
-    {                                           /* off + size*/
-        int sizeof_hdr;                         /* 0 + 4     */
-        char data_type[10];                     /* 4 + 10    */
-        char db_name[18];                       /* 14 + 18   */
-        int extents;                            /* 32 + 4    */
-        short int session_error;                /* 36 + 2    */
-        char regular;                           /* 38 + 1    */
-        char hkey_un0;                          /* 39 + 1    */
-    };                                          /* total=40  */
-
-struct image_dimension                  /*      image_dimension  */
-    {                                           /* off + size*/
-        short int dim[8];                       /* 0 + 16    */
-        char vox_units[4];                      /* 16 + 4    */
-        char cal_units[8];                      /* 20 + 4    */
-        short int unused1;                      /* 24 + 2    */
-        short int datatype;                     /* 30 + 2    */
-        short int bitpix;                       /* 32 + 2    */
-        short int dim_un0;                      /* 34 + 2    */
-        float pixdim[8];                        /* 36 + 32   */
-                        /* 
-                                pixdim[] specifies the voxel dimensions:
-                                pixdim[1] - voxel width
-                                pixdim[2] - voxel height
-                                pixdim[3] - interslice distance
-                                        ..etc
-                        */
-        float vox_offset;                       /* 68 + 4    */
-        float funused1;                         /* 72 + 4    */
-        float funused2;                         /* 76 + 4    */
-        float funused3;                         /* 80 + 4    */
-        float cal_max;                          /* 84 + 4    */
-        float cal_min;                          /* 88 + 4    */
-        int compressed;                         /* 92 + 4    */
-        int verified;                           /* 96 + 4    */
-        int glmax, glmin;                       /* 100 + 8   */
-    };                                          /* total=108 */
-         
-struct data_history                     /*      data_history     */
-    {                                           /* off + size*/
-        char descrip[80];                       /* 0 + 80    */
-        char aux_file[24];                      /* 80 + 24   */
-        char orient;                            /* 104 + 1   */
-        char originator[10];                    /* 105 + 10  */
-        char generated[10];                     /* 115 + 10  */
-        char scannum[10];                       /* 125 + 10  */
-        char patient_id[10];                    /* 135 + 10  */
-        char exp_date[10];                      /* 145 + 10  */
-        char exp_time[10];                      /* 155 + 10  */
-        char hist_un0[3];                       /* 165 + 3   */
-        int views;                              /* 168 + 4   */
-        int vols_added;                         /* 172 + 4   */
-        int start_field;                        /* 176 + 4   */
-        int field_skip;                         /* 180 + 4   */
-        int omax,omin;                          /* 184 + 8   */
-        int smax,smin;                          /* 192 + 8   */
-    };                                        
-
-
-struct dsr                                   /*      dsr              */
-   {                                         /* off + size*/
-     struct header_key hk;                   /* 0 + 40    */
-     struct image_dimension dime;            /* 40 + 108  */
-     struct data_history hist;               /* 148 + 200 */
-   };                                        /* total=348 */
-
- 
-
-
-/*---------------- _swapLong ------------------------------------------------*/
-CGAL_INLINE_FUNCTION
-static void _swapLong( unsigned char *pntr)
-{
-  unsigned char b0, b1, b2, b3;
-  
-  b0 = *pntr;
-  b1 = *(pntr+1);
-  b2 = *(pntr+2);
-  b3 = *(pntr+3);
-  
-  *pntr = b3;
-  *(pntr+1) = b2;
-  *(pntr+2) = b1;
-  *(pntr+3) = b0;
-}
-        
-/*---------------- _swapShort -----------------------------------------------*/
-CGAL_INLINE_FUNCTION
-static void _swapShort( unsigned char *pntr)
-{
-  unsigned char b0, b1;
-  
-  b0 = *pntr;
-  b1 = *(pntr+1);
-
-  *pntr = b1;
-  *(pntr+1) = b0;
-}
-
-/*---------------- _swapAnalyzeHdr ------------------------------------------*/
-CGAL_INLINE_FUNCTION
-static void _swapAnalyzeHdr( struct dsr *pntr)
-{
-  
-  _swapLong((unsigned char*) &pntr->hk.sizeof_hdr) ;
-  _swapLong((unsigned char*) &pntr->hk.extents) ;
-  _swapShort((unsigned char*) &pntr->hk.session_error) ;
-  _swapShort((unsigned char*) &pntr->dime.dim[0]) ;
-  _swapShort((unsigned char*) &pntr->dime.dim[1]) ;
-  _swapShort((unsigned char*) &pntr->dime.dim[2]) ;
-  _swapShort((unsigned char*) &pntr->dime.dim[3]) ;
-  _swapShort((unsigned char*) &pntr->dime.dim[4]) ;
-  _swapShort((unsigned char*) &pntr->dime.dim[5]) ;
-  _swapShort((unsigned char*) &pntr->dime.dim[6]) ;
-  _swapShort((unsigned char*) &pntr->dime.dim[7]) ;
-  _swapShort((unsigned char*) &pntr->dime.unused1) ;
-  _swapShort((unsigned char*) &pntr->dime.datatype) ;
-  _swapShort((unsigned char*) &pntr->dime.bitpix) ;
-  _swapLong((unsigned char*) &pntr->dime.pixdim[0]) ;
-  _swapLong((unsigned char*) &pntr->dime.pixdim[1]) ;
-  _swapLong((unsigned char*) &pntr->dime.pixdim[2]) ;
-  _swapLong((unsigned char*) &pntr->dime.pixdim[3]) ;
-  _swapLong((unsigned char*) &pntr->dime.pixdim[4]) ;
-  _swapLong((unsigned char*) &pntr->dime.pixdim[5]) ;
-  _swapLong((unsigned char*) &pntr->dime.pixdim[6]) ;
-  _swapLong((unsigned char*) &pntr->dime.pixdim[7]) ;
-  _swapLong((unsigned char*) &pntr->dime.vox_offset) ;
-  _swapLong((unsigned char*) &pntr->dime.funused1) ;
-  _swapLong((unsigned char*) &pntr->dime.funused2) ;
-  _swapLong((unsigned char*) &pntr->dime.cal_max) ;
-  _swapLong((unsigned char*) &pntr->dime.cal_min) ;
-  _swapLong((unsigned char*) &pntr->dime.compressed) ;
-  _swapLong((unsigned char*) &pntr->dime.verified) ;
-  _swapShort((unsigned char*) &pntr->dime.dim_un0) ;
-  _swapLong((unsigned char*) &pntr->dime.glmax) ;
-  _swapLong((unsigned char*) &pntr->dime.glmin) ;
-}
-
-CGAL_INLINE_FUNCTION
-PTRIMAGE_FORMAT createAnalyzeFormat() {
-  PTRIMAGE_FORMAT f=(PTRIMAGE_FORMAT) ImageIO_alloc(sizeof(IMAGE_FORMAT));
-
-  f->testImageFormat=&testAnalyzeHeader;
-  f->readImageHeader=&readAnalyzeHeader;
-  f->writeImage=&writeAnalyze;
-  strcpy(f->fileExtension,".hdr,.hdr.gz,.img,.img.gz");
-  strcpy(f->realName,"Analyze");
-  return f;
-}
-
-CGAL_INLINE_FUNCTION
-int testAnalyzeHeader(char *magic,const char *) {
-   /* opened image is an ANALYZE */
-  if( !memcmp(magic,ANALYZE_LE_MAGIC,4) ||
-      !memcmp(magic,ANALYZE_BE_MAGIC,4)) 
-    return 0;
-  else 
-    return -1;
-}
-
-CGAL_INLINE_FUNCTION
-int writeAnalyze( char *name, _image* im) {
-  char *outputName;
-  int length, extLength=0, res;
-
-
-  length=strlen(name);
-  outputName= (char *)ImageIO_alloc(length+8);
-  
-  if ( strncmp( name+length-4, ".hdr", 4 ) == 0 ) {
-    extLength = 4;
-  }
-  else if ( strncmp( name+length-4, ".img", 4 ) == 0 ) {
-    extLength = 4;
-  }
-  else if ( strncmp( name+length-7, ".img.gz", 7 ) == 0 ) {
-    extLength = 7;
-  }
-  else if ( strncmp( name+length-7, ".hdr.gz", 7 ) == 0 ) {
-    extLength = 7;
-  }
-
-  strncpy( outputName, name, length-extLength );
-  if ( strncmp( name+length-7, ".hdr.gz", 7 ) == 0 )
-    strcpy( outputName+length-extLength, ".hdr.gz" );
-  else
-    strcpy( outputName+length-extLength, ".hdr" );
-  
-  _openWriteImage(im, outputName);
-  if( !im->fd ) {
-    fprintf(stderr, "writeAnalyze: error: unable to open file \'%s\'\n", outputName);
-    if ( outputName != NULL ) ImageIO_free( outputName );
-    return ImageIO_OPENING;
-  }
-
-  res = writeAnalyzeHeader(im);
-  if ( res < 0 ) {
-    fprintf(stderr, "writeAnalyze: error: unable to write header of \'%s\'\n",
-	    outputName);
-    if ( outputName != NULL ) ImageIO_free( outputName );
-    ImageIO_close( im );
-    im->fd = NULL;
-    im->openMode = OM_CLOSE;
-    return( res );
-  }
-  
-  ImageIO_close(im);
-  
-  strncpy( outputName, name, length-extLength );
-  if ( strncmp( name+length-3, ".gz", 3 ) == 0 ) {
-    strcpy( outputName+length-extLength, ".img.gz" );
-  }
-  else {
-    strcpy( outputName+length-extLength, ".img" );
-  }
-
-  _openWriteImage(im, outputName);
-
-  if( !im->fd ) {
-    fprintf(stderr, "writeAnalyze: error: unable to open file \'%s\'\n", outputName);
-    if ( outputName != NULL ) ImageIO_free( outputName );
-    return ImageIO_OPENING;
-  }
-
-  res = writeAnalyzeData(im);
-  if (res < 0) {
-    fprintf(stderr, "writeAnalyze: error: unable to write data in \'%s\'\n",
-	    outputName );
-    ImageIO_close( im );
-    im->fd = NULL;
-    im->openMode = OM_CLOSE;
-    return( res );
-  }
-
-  if ( outputName != NULL ) ImageIO_free( outputName );
-  ImageIO_close( im );
-  im->fd = NULL;
-  im->openMode = OM_CLOSE;
-
-  return ( res );
-}
-
-/* 
-   return:
-   -1: error
-   0: success
- */
-
-CGAL_INLINE_FUNCTION
-int _readAnalyzeHeader( _image* im, const char* name, 
-			struct dsr *analyzeHeader )
-{
-
-   unsigned int i ;
-   /* compile time endianness */
-   ENDIANNESS ARCHITECTURE_ENDIANNESS = _getEndianness();
-
-   if(im->openMode != OM_CLOSE) {
-      
-     ImageIO_read( im, analyzeHeader, sizeof(struct dsr) );
-      
-      if( analyzeHeader->hk.sizeof_hdr == sizeof(struct dsr) )
-      {
-	 im->endianness = ARCHITECTURE_ENDIANNESS ;
-      }
-      else
-      {
-	_swapAnalyzeHdr( analyzeHeader );
-	 if( analyzeHeader->hk.sizeof_hdr != sizeof(struct dsr) )
-	 {
-	    fprintf (stderr,
-		     "_readAnalyzeHeader: error: unknown magic (%d)...\n",
-		     analyzeHeader->hk.sizeof_hdr );
-	    return -1;
-	 }
-	 if( ARCHITECTURE_ENDIANNESS == END_LITTLE )
-	 {
-	    im->endianness = END_BIG;
-	 }
-	 else
-	 {
-	    im->endianness = END_LITTLE;
-	 }
-      }
-      
-      if ( analyzeHeader->dime.dim[0] > 4 ) {
-	 fprintf (stderr,
-		  "_readAnalyzeHeader: error: dimensionality not supported (%d)...\n",
-		  analyzeHeader->dime.dim[0] );
-	 return -1;
-      }
-      
-      im->xdim = analyzeHeader->dime.dim[1];
-      im->ydim = analyzeHeader->dime.dim[2];
-      im->zdim = analyzeHeader->dime.dim[3];
-
-      /* 0 time-points is a convention for one volume only at MNI */
-      /* Corrected by X. Pennec following a bug report by Irina Kezele at MNI */
-      if( analyzeHeader->dime.dim[4] == 0 ){
-	fprintf (stderr,
-		 "_readAnalyzeHeader: warning: time dimension / number if volume (dim[4]) is 0. Assuming this means 1 (otherwise there would be no image...). \n");
-	analyzeHeader->dime.dim[4] = 1; 
-      }
-
-      /* Analyze doesn't support vector images.
-	 The forth dimension relates to time. */
-      if( analyzeHeader->dime.dim[4] != 1 )
-      {
-	 fprintf (stderr,
-		  "_readAnalyzeHeader: error: time dimension not supported (%d)...\n",
-		  analyzeHeader->dime.dim[4] );
-	 return -1;
-      }
-      im->vectMode = VM_SCALAR;
-      
-      im->vx = analyzeHeader->dime.pixdim[1];
-      im->vy = analyzeHeader->dime.pixdim[2];
-      im->vz = analyzeHeader->dime.pixdim[3];
-
-      if( im->vx == 0.0 ) im->vx = 1.0 ;
-      if( im->vy == 0.0 ) im->vy = im->vx ;
-      if( im->vz == 0.0 ) im->vz = im->vy ;
-      
-      switch(analyzeHeader->dime.datatype)
-      {
-	 case DT_BINARY:
-	 case DT_UNSIGNED_CHAR:
-	 case DT_SIGNED_SHORT:
-	 case DT_SIGNED_INT:
-	 case DT_FLOAT:
-	 case DT_COMPLEX:
-	 case DT_DOUBLE:
-	    im->vdim = 1;
-	    break ;
-	    
-	 case DT_RGB:
-	    im->vdim = 3;
-	    break ;
-	    
-	 default:
-	    fprintf (stderr,
-		     "_readAnalyzeHeader: error: data type not supported (%d)...\n",
-		     analyzeHeader->dime.datatype );
-	    return -1;
-      }
-      
-      switch(analyzeHeader->dime.datatype)
-      {
-	 case DT_BINARY:
-	 case DT_UNSIGNED_CHAR:
-	 case DT_SIGNED_SHORT:
-	 case DT_SIGNED_INT:
-	 case DT_RGB:
-	    im->wordKind = WK_FIXED;
-	    break ;
-	    
-	 case DT_FLOAT:
-	 case DT_COMPLEX:
-	 case DT_DOUBLE:
-	    im->wordKind = WK_FLOAT;
-	    break ;
-	    
-	 default:
-	    fprintf (stderr,
-		     "_readAnalyzeHeader: error: data type not supported (%d)...\n",
-		     analyzeHeader->dime.datatype );
-	    return -1;
-      }
-      
-      switch(analyzeHeader->dime.datatype)
-      {
-	 case DT_BINARY:
-	 case DT_UNSIGNED_CHAR:
-	 case DT_RGB:
-	    im->sign = SGN_UNSIGNED;
-	    break ;
-	    
-	 case DT_SIGNED_SHORT:
-	 case DT_SIGNED_INT:
-	 case DT_FLOAT:
-	 case DT_COMPLEX:
-	 case DT_DOUBLE:
-	    im->sign = SGN_SIGNED;
-	    break ;
-	    
-	 default:
-	    fprintf (stderr,
-		     "_readAnalyzeHeader: error: data type not supported (%d)...\n",
-		     analyzeHeader->dime.datatype );
-	    return -1;
-      }
-      
-      im->wdim = analyzeHeader->dime.bitpix;
-      if( analyzeHeader->dime.datatype == DT_RGB )
-      {
-	 im->wdim /= 3 ;
-      }
-      if(im->wdim != 8 && im->wdim != 16 && im->wdim != 32 && im->wdim != 64)
-      {
-	 fprintf (stderr,
-		  "_readAnalyzeHeader: error: pixel size not supported (%d)...\n",
-		  analyzeHeader->dime.bitpix );
-	 return -1;
-      }
-      im->wdim >>= 3 ;
-      
-      /* There are 17 optional data fields 
-	 be careful in the allocation
-       */
-      im->nuser = 1 + 17 ;
-      im->user = (char **) ImageIO_alloc(im->nuser * sizeof(char *));
-      for ( i=0; i<im->nuser; i++ ) im->user[i] = NULL;
-      i = 0 ;
-      
-      im->user[i] = (char *) ImageIO_alloc((strlen("Data lost in the Analyze -> ImageIO conversion:") + 1));
-      sprintf( im->user[i++], "Data lost in the Analyze -> ImageIO conversion:" );
-      
-      im->user[i] = (char *) ImageIO_alloc((strlen("  descrip: ") + 1 + strlen(analyzeHeader->hist.descrip) ));
-      sprintf( im->user[i++], "  descrip: %s", analyzeHeader->hist.descrip );
-      
-      im->user[i] = (char *) ImageIO_alloc((strlen("  aux_file: ") + 1 + strlen(analyzeHeader->hist.descrip) ));
-      sprintf( im->user[i++], "  aux_file: %s", analyzeHeader->hist.descrip );
-      
-      im->user[i] = (char *) ImageIO_alloc((strlen("  orient: ") + 1+ 2));
-      sprintf( im->user[i++], "  orient: %d", analyzeHeader->hist.orient );
-      
-      im->user[i] = (char *) ImageIO_alloc((strlen("  originator: ") + 1 + strlen(analyzeHeader->hist.originator) ));
-      sprintf( im->user[i++], "  originator: %s", analyzeHeader->hist.originator );
-      
-      im->user[i] = (char *) ImageIO_alloc((strlen("  generated: ") + 1 + strlen(analyzeHeader->hist.generated) ));
-      sprintf( im->user[i++], "  generated: %s", analyzeHeader->hist.generated );
-      
-      im->user[i] = (char *) ImageIO_alloc((strlen("  scannum: ") + 1 + strlen(analyzeHeader->hist.scannum) ));
-      sprintf( im->user[i++], "  scannum: %s", analyzeHeader->hist.scannum );
-      
-      im->user[i] = (char *) ImageIO_alloc((strlen("  patient_id: ") + 1 + strlen(analyzeHeader->hist.patient_id) ));
-      sprintf( im->user[i++], "  patient_id: %s", analyzeHeader->hist.patient_id );
-      
-      im->user[i] = (char *) ImageIO_alloc((strlen("  exp_date: ") + 1 + strlen(analyzeHeader->hist.exp_date) ));
-      sprintf( im->user[i++], "  exp_date: %s", analyzeHeader->hist.exp_date );
-      
-      im->user[i] = (char *) ImageIO_alloc((strlen("  exp_time: ") + 1 + strlen(analyzeHeader->hist.exp_time) ));
-      sprintf( im->user[i++], "  exp_time: %s", analyzeHeader->hist.exp_time );
-
-      /* A 32 bit int doesn't print on more than 11 chars */
-      im->user[i] = (char *) ImageIO_alloc((strlen("  views: ") + 11 + 1));
-      sprintf( im->user[i++], "  views: %d", analyzeHeader->hist.views );
-      
-      im->user[i] = (char *) ImageIO_alloc((strlen("  vols_added: ") + 11 + 1));
-      sprintf( im->user[i++], "  vols_added: %d", analyzeHeader->hist.vols_added );
-      
-      im->user[i] = (char *) ImageIO_alloc((strlen("  start_field: ") + 11 + 1));
-      sprintf( im->user[i++], "  start_field: %d", analyzeHeader->hist.start_field );
-      
-      im->user[i] = (char *) ImageIO_alloc((strlen("  field_skip: ") + 11 + 1));
-      sprintf( im->user[i++], "  field_skip: %d", analyzeHeader->hist.field_skip );
-      
-      im->user[i] = (char *) ImageIO_alloc((strlen("  omax: ") + 11 + 1));
-      sprintf( im->user[i++], "  omax: %d", analyzeHeader->hist.omax );
-      
-      im->user[i] = (char *) ImageIO_alloc((strlen("  omin: ") + 11 + 1));
-      sprintf( im->user[i++], "  omin: %d", analyzeHeader->hist.omin );
-      
-      im->user[i] = (char *) ImageIO_alloc((strlen("  smax: ") + 11 + 1));
-      sprintf( im->user[i++], "  smax: %d", analyzeHeader->hist.smax );
-      
-      im->user[i] = (char *) ImageIO_alloc((strlen("  smin: ") + 11 + 1));
-      sprintf( im->user[i++], "  smin: %d", analyzeHeader->hist.smin );
-
-
-      /* header is read. close header file and open data file. */
-      if( name != NULL ) {
-
-	int length = strlen(name) ;
-	char* data_filename = (char *) ImageIO_alloc(length+4) ;
-	
-	if( strcmp( name+length-4, ".hdr" ) )
-	  {
-	    fprintf (stderr,
-		     "_readAnalyzeHeader: error: file header extension must be .hdr\n");
-	    ImageIO_free( data_filename );
-	    return -1;
-	  }
-	 
-	ImageIO_close(im);
-	
-	strcpy(data_filename,name);
-	strcpy(data_filename+length-3, "img.gz");
-	_openReadImage(im,data_filename);
-	
-	if(!im->fd) {
-
-	  strcpy(data_filename,name);
-	  strcpy(data_filename+length-3, "img");
-	  _openReadImage(im,data_filename);
-	  if(!im->fd) {
-	    fprintf(stderr, "_readAnalyzeHeader: error: unable to open data file \'%s\'\n", data_filename);
-	    ImageIO_free( data_filename );
-	    return -1;
-	    
-	  }
-	}
-	ImageIO_free( data_filename );
-      }
-      
-      /* check header validity */
-      if(im->xdim > 0 && im->ydim > 0 && im->zdim > 0 && im->vdim > 0 &&
-	 im->vx > 0.0 && im->vy > 0.0 && im->vz > 0.0 &&
-	 (im->wordKind == WK_FLOAT || (im->wordKind == WK_FIXED &&
-				       im->sign != SGN_UNKNOWN)) &&
-	 im->endianness != END_UNKNOWN) {
-	 return 0;
-      }
-      else return -1;
-   }
-   else return -1;
-}
-
-
-
-
-
-
-CGAL_INLINE_FUNCTION
-int readAnalyzeHeader( const char* name, _image* im)
-{
-  struct dsr analyzeHeader ;
-  return( _readAnalyzeHeader( im, name, &analyzeHeader ) );
-}
-
-
-
-CGAL_INLINE_FUNCTION
-int
-writeAnalyzeHeader( const _image* im )
-{
-  const char *proc = "writeAnalyzeHeader";
-  struct dsr hdr;
-  int i ;
-  int imin = 0;
-  int imax = 0;
- 
-   memset(&hdr,0, sizeof(struct dsr));
-   
-   for(i=0;i<8;i++) {
-      hdr.dime.pixdim[i] = 0.0;
-   }
-   hdr.dime.vox_offset  = 0.0;
-   hdr.dime.funused1    = 0.0;
-   hdr.dime.funused2    = 0.0;
-   hdr.dime.funused3    = 0.0;
-   hdr.dime.cal_max     = 0.0;
-   hdr.dime.cal_min     = 0.0;
-
-   hdr.dime.dim[0] = 4;
-   hdr.dime.dim[1] = im->xdim;
-   hdr.dime.dim[2] = im->ydim;
-   hdr.dime.dim[3] = im->zdim;
-   hdr.dime.dim[4] = 1 ;
-
-   if ( im->wordKind == WK_FIXED && im->sign == SGN_UNSIGNED ) {
-     if( im->wdim == 1 ) {
-       
-	if ( im->vdim == 1 ) {
-	  hdr.dime.datatype = DT_UNSIGNED_CHAR ;
-	}
-	else if ( im->vdim == 3 ) {
-	  hdr.dime.datatype = DT_RGB ;
-	}
-	else {
-	  fprintf( stderr, "%s: unsupported image type\n", proc );
-	  return -1;
-	}
-	
-	{
-	  unsigned char *buf = (unsigned char *)im->data;
-	  int size = im->xdim * im->ydim * im->zdim * im->vdim;
-	  imin = imax = *buf;
-	  for (i=0; i<size; i++, buf++) {
-	    if ( imax < *buf ) imax = *buf;
-	    if ( imin > *buf ) imin = *buf;
-	  }
-	}
-	
-      }
-      else if ( im->wdim == 2 ) {
-	if ( im->vdim == 1 ) {
-	  unsigned short int *buf = (unsigned short int*)im->data;
-	  int size = im->xdim * im->ydim *im->zdim;
-	  int i;
-	  imin = imax = *buf;
-	  for (i=0; i<size; i++, buf++) {
-	    if ( imax < *buf ) imax = *buf;
-	    if ( imin > *buf ) imin = *buf;
-	  }
-	  if ( imax < 32768 ) {
-	    hdr.dime.datatype = DT_SIGNED_SHORT ;
-	  } 
-	  else {
-	    fprintf( stderr, "%s: conversion from unsigned short to short impossible, max=%d\n", proc, imax );
-	    return -1;
-	  }
-	}
-	else {
-	  fprintf( stderr, "%s: unsupported image type\n", proc );
-	  return -1;
-	}
-      }
-      
-      else {
-	  fprintf( stderr, "%s: unsupported image type\n", proc );
-	  return -1;
-      }
-      
-   } /* if ( im->wordKind == WK_FIXED && im->sign == SGN_UNSIGNED ) */
-
-   else if( im->wordKind == WK_FIXED && im->sign == SGN_SIGNED ) {
-     if ( im->vdim != 1 ) {
-       fprintf( stderr, "%s: unsupported image type\n", proc );
-       return -1;
-     }
-     if( im->wdim == 2 ) {
-       short int *buf = (short int*)im->data;
-       int size = im->xdim * im->ydim *im->zdim;
-       int i;
-       imin = imax = *buf;
-       for (i=0; i<size; i++, buf++) {
-	 if ( imax < *buf ) imax = *buf;
-	 if ( imin > *buf ) imin = *buf;
-       }
-       hdr.dime.datatype = DT_SIGNED_SHORT ;
-     }
-     else if( im->wdim == 4 ) {
-       int *buf = (int*)im->data;
-       int size = im->xdim * im->ydim *im->zdim;
-       int i;
-       imin = imax = *buf;
-       for (i=0; i<size; i++, buf++) {
-	 if ( imax < *buf ) imax = *buf;
-	 if ( imin > *buf ) imin = *buf;
-       }
-       hdr.dime.datatype = DT_SIGNED_INT ;
-     }
-     else {
-       fprintf( stderr, "%s: unsupported image type\n", proc );
-       return -1;
-     }
-   }
-   else if( im->wordKind == WK_FLOAT ) {
-     if ( im->vdim != 1 ) {
-       fprintf( stderr, "%s: unsupported image type\n", proc );
-       return -1;
-     }
-     if( im->wdim == 4 ) {
-       hdr.dime.datatype = DT_FLOAT ;
-     }
-     else if( im->wdim == 8 ) {
-       hdr.dime.datatype = DT_DOUBLE ;
-     }
-     else {
-       fprintf( stderr, "%s: unsupported image type\n", proc );
-       return -1;
-     }
-   }
-   else
-   {
-      fprintf( stderr, "%s: unsupported image type\n", proc );
-      return -1;
-   }
-	 
-   hdr.dime.bitpix = 8*im->wdim*im->vdim ;
-
-   hdr.hk.regular = 'r';
-   hdr.hk.sizeof_hdr = sizeof(struct dsr);
-
-   /* this is probably bad and should be changed to the
-      real values, but I'm too lazy to do it now. AG */
-   hdr.dime.glmax  = 0 ;  /* maximum voxel value  */
-   hdr.dime.glmin  = 0 ;  /* minimum voxel value */
-   
-   /* corrected GM
-    */
-   hdr.dime.glmax  = imax ;  /* maximum voxel value  */
-   hdr.dime.glmin  = imin ;  /* minimum voxel value */
-    
-/*     Set the voxel dimension fields: 
-       A value of 0.0 for these fields implies that the value is unknown.
-         Change these values to what is appropriate for your data
-         or pass additional command line arguments     */      
-         
-    hdr.dime.pixdim[1] = (float)im->vx;
-    hdr.dime.pixdim[2] = (float)im->vy;
-    hdr.dime.pixdim[3] = (float)im->vz;
-    
-/*   Assume zero offset in .img file, byte at which pixel
-       data starts in the image file */
-
-    hdr.dime.vox_offset = 0.0; 
-    
-/*   Planar Orientation;    */
-/*   Movie flag OFF: 0 = transverse, 1 = coronal, 2 = sagittal
-     Movie flag ON:  3 = transverse, 4 = coronal, 5 = sagittal  */  
-
-    hdr.hist.orient     = 0;  
-    
-/*   up to 3 characters for the voxels units label; i.e. mm., um., cm. */
-
-    strcpy(hdr.dime.vox_units,"mm.");
-   
-/*   up to 7 characters for the calibration units label; i.e. HU */
-
-    strcpy(hdr.dime.cal_units," ");  
-    
-/*     Calibration maximum and minimum values;  
-       values of 0.0 for both fields imply that no 
-       calibration max and min values are used    */
-
-    hdr.dime.cal_max = 0.0; 
-    hdr.dime.cal_min = 0.0;
-
-    if(ImageIO_write(im, &hdr, sizeof(struct dsr)) !=sizeof(struct dsr) )
-       return -1;
-
-    return 1 ;
-}
-
-
-
-
-
-/* Writes the given image body in an already opened file.*/
-CGAL_INLINE_FUNCTION
-int writeAnalyzeData(const _image *im) {
-  unsigned int lineSize = im->wdim * im->xdim * im->vdim ;
-  unsigned long size = lineSize * im->ydim * im->zdim;
-  unsigned int nwrt ;
-
-  if(im->openMode != OM_CLOSE) {
-
-#ifdef _REVERSE_LINES_IN_ANALYZE_
-    char* data = (char *)im->data ;
-    char* buf = data + size - lineSize ;
-    
-    while( buf >= data )
-      {
-	nwrt = ImageIO_write(im, buf, lineSize);
-	if(nwrt != lineSize) return -1;
-	buf -= lineSize ;
-      }
-#else
-    nwrt = ImageIO_write(im, im->data, size);
-    if(nwrt != size) return -1;
-#endif    
-
-    return 1 ;
-  }
-  else return -1;
-}
-
-
-/* Writes the given image body in an already opened file.*/
-CGAL_INLINE_FUNCTION
-int printAnalyzeHeader( const char* name )
-{
-  _image *im;
-  struct dsr analyzeHeader ;
-
-  im = _initImage();
-  _openReadImage(im, name);
-  if(!im->fd) {
-    fprintf(stderr, "printAnalyzeHeader: error: unable to open file \'%s\'\n", name);
-    _freeImage(im);
-    return -1;
-  }
-
-  if ( _readAnalyzeHeader( im, name, &analyzeHeader ) != 1 ) {
-    fprintf(stderr, "printAnalyzeHeader: error: unable to read header in file \'%s\'\n", name);
-    _freeImage(im);
-    return -1;
-  }
-
-
-  
-
-
-  ImageIO_close(im);
-  im->fd = NULL;
-  im->openMode = OM_CLOSE;
-  _freeImage(im);
-  return( 1 );
-
-
-}
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmp.cpp b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmp.cpp
deleted file mode 100644
index e9b862e..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmp.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-#ifndef CGAL_HEADER_ONLY
-
-#include "bmp.h"
-#include "bmp_impl.h"
-
-#endif // CGAL_HEADER_ONLY
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmp.h b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmp.h
deleted file mode 100644
index 2d0e865..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmp.h
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-/*************************************************************************
- * iobmp.h - I procedures for BMP raw images
- *
- * $Id$
- *
- * Copyright INRIA
- *
- * AUTHOR:
- * Gregoire Malandain (greg at sophia.inria.fr)
- * 
- * CREATION DATE: 
- * Wed Oct  6 17:03:48 MET DST 1999
- *
- * ADDITIONS, CHANGES
- *
- *
- */
-
-#ifndef _bmp_h_
-#define _bmp_h_
-
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <fcntl.h> /* open, close */
-#include <sys/stat.h> /* open, close */
-#include <sys/types.h> /* open, close */
-#include <string.h>
-#include <CGAL/ImageIO.h>
-extern int readBmpImage(const char *name, _image *im);
-extern void *_readBmpImage( const char *name, int *dimx, int *dimy, int *dimz );
-int testBmpHeader(char *magic,const char *name);
-/** creates an return the file format structure associated with the BMP file format */
-PTRIMAGE_FORMAT createBMPFormat();
-
-extern void IoBmp_verbose ( );
-extern void IoBmp_noverbose ( );
-
-#ifdef CGAL_HEADER_ONLY
-#include "bmp_impl.h"
-#endif // CGAL_HEADER_ONLY
-
-#endif /* _bmp_h_ */
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmp_impl.h b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmp_impl.h
deleted file mode 100644
index 155f38d..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmp_impl.h
+++ /dev/null
@@ -1,518 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-#ifdef CGAL_HEADER_ONLY
-#define CGAL_INLINE_FUNCTION inline
-#else
-#define CGAL_INLINE_FUNCTION
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "bmptypes.h"
-#include "bmpendian.h"
-#include "bmpread.h"
-
-
-
-
-
-
-/** Magic header for bmp */
-#define BMP_MAGIC "BM"
-
-
-#ifdef CGAL_HEADER_ONLY
-
-inline int& get_static_verbose_bmp()
-{
-  static int _VERBOSE_BMP_ = 1;
-  return _VERBOSE_BMP_;
-}
-
-#else // CGAL_HEADER_ONLY
-
-static int _VERBOSE_BMP_ = 1;
-inline int& get_static_verbose_bmp()
-{ return _VERBOSE_BMP_; }
-
-#endif // CGAL_HEADER_ONLY
-
-
-CGAL_INLINE_FUNCTION
-int testBmpHeader(char *magic,const char *) {
-  if( !strncmp(magic, BMP_MAGIC, strlen(BMP_MAGIC)))
-    return 0;
-  else 
-    return -1;
-}
-
-CGAL_INLINE_FUNCTION
-PTRIMAGE_FORMAT createBMPFormat() {
-  PTRIMAGE_FORMAT f=(PTRIMAGE_FORMAT) ImageIO_alloc(sizeof(IMAGE_FORMAT));
-
-  f->testImageFormat=&testBmpHeader;
-  f->readImageHeader=&readBmpImage;
-  f->writeImage=0;
-  strcpy(f->fileExtension,".bmp");
-  strcpy(f->realName,"BMP");
-  return f;
-}
-
-CGAL_INLINE_FUNCTION
-int readBmpImage( const char *name,_image *im)
-{
-  int dimx, dimy, dimv;
-
-  im->data = _readBmpImage( name, &dimx,  &dimy,  &dimv );
-  if ( im->data == NULL ) {
-    fprintf( stderr, "readBmpImage: unable to read \'%s\'\n", name );
-    return( -1 );
-  }
-
-  im->xdim = dimx;
-  im->ydim = dimy;
-  im->vdim = dimv;
-
-  im->zdim = 1;
-
-  im->wdim = 1;
-  im->wordKind = WK_FIXED;
-  im->sign = SGN_UNSIGNED;
-
-  return 1;
-}
-
-
-
-CGAL_INLINE_FUNCTION
-void *_readBmpImage( const char *name, 
-		     int *dimx, int *dimy, int *dimz )
-{
-  const char *proc="_readBmpImage";
-  void *buf = (void*)NULL;
-  unsigned char *myBuf;
-
-  FILE *fp;
-  RGB **argbs;
-  char **xorMasks, **andMasks;
-  CGAL_UINT32 *heights, *widths, row, col;
-  CGAL_UINT16 fileType;
-  long filePos;
-  int numImages, i;
-  int rc;
-    
-    fp = fopen(name, "rb");
-    if (fp == NULL) {
-      if ( get_static_verbose_bmp() ) 
-	fprintf( stderr, "%s: error in opening %s\n", proc, name );
-      return( (void*)NULL );
-    }
-
-
-    /*
-     * Read the first two bytes as little-endian to determine the file type.
-     * Preserve the file position.
-     */
-    filePos = ftell(fp);
-    rc = readUINT16little(fp, &fileType);
-    if (rc != 0) {
-      if ( get_static_verbose_bmp() ) 
-	fprintf( stderr, "%s: error in getting file type %s\n", proc, name );
-      return( (void*)NULL );
-    }
-    fseek(fp, filePos, SEEK_SET);
-
-    /*
-     * Read the images.
-     */
-    switch (fileType) {
-    case TYPE_ARRAY:
-	/*
-	 * If this is an array of images, read them.  All the arrays we need
-	 * will be allocated by the reader function.
-	 */
-	rc = readMultipleImage(fp, &argbs, &xorMasks, &andMasks, &heights,
-			       &widths, &numImages);
-	break;
-    case TYPE_BMP:
-    case TYPE_ICO:
-    case TYPE_ICO_COLOR:
-    case TYPE_PTR:
-    case TYPE_PTR_COLOR:
-	/*
-	 * If this is a single-image file, we've a little more work.  In order
-	 * to make the output part of this test program easy to write, we're
-	 * going to allocate dummy arrays that represent what
-	 * readMultipleImage would have allocated.  We'll read the data into
-	 * those arrays.
-	 */
-	argbs = (RGB **)calloc(1, sizeof(RGB *));
-	if (argbs == NULL)
-	{
-	    rc = 1005;
-	    break;
-	}
-	xorMasks = (char **)calloc(1, sizeof(char *));
-	if (xorMasks == NULL)
-	{
-	    free(argbs);
-	    rc = 1005;
-	    break;
-	}
-	andMasks = (char **)calloc(1, sizeof(char *));
-	if (andMasks == NULL)
-	{
-	    free(argbs);
-	    free(xorMasks);
-	    rc = 1005;
-	    break;
-	}
-	heights = (CGAL_UINT32 *)calloc(1, sizeof(CGAL_UINT32));
-	if (heights == NULL)
-	{
-	    free(argbs);
-	    free(xorMasks);
-	    free(andMasks);
-	    rc = 1005;
-	    break;
-	}
-	widths = (CGAL_UINT32 *)calloc(1, sizeof(CGAL_UINT32));
-	if (widths == NULL)
-	{
-	    free(argbs);
-	    free(xorMasks);
-	    free(andMasks);
-	    free(heights);
-	    rc = 1005;
-	    break;
-	}
-	numImages = 1;
-
-	/*
-	 * Now that we have our arrays allocted, read the image into them.
-	 */
-	switch (fileType) {
-	case TYPE_BMP:
-	    rc = readSingleImageBMP(fp, argbs, widths, heights);
-	    break;
-	case TYPE_ICO:
-	case TYPE_PTR:
-	    rc = readSingleImageICOPTR(fp, xorMasks, andMasks, widths,
-				       heights);
-	    break;
-	case TYPE_ICO_COLOR:
-	case TYPE_PTR_COLOR:
-	    rc = readSingleImageColorICOPTR(fp, argbs, xorMasks, andMasks,
-					    widths, heights);
-	    break;
-	}
-	break;
-    default:
-	rc = 1000;
-    }
-    fclose(fp);
-
-
-  
-    /*
-     * At this point, everything's been read.  Display status messages based
-     * on the return values.
-     */
-    switch (rc) {
-    case 1000:
-    case 1006:
-      if ( get_static_verbose_bmp() ) 
-	fprintf( stderr, "%s: File is not a valid bitmap file\n", proc );
-      break;
-    case 1001:
-      if ( get_static_verbose_bmp() ) 
-	fprintf( stderr, "%s: Illegal information in an image\n", proc );
-      break;
-    case 1002:
-      if ( get_static_verbose_bmp() ) 
-	fprintf( stderr, "%s: Legal information that I can't handle yet in an image\n", proc );
-      break;
-    case 1003:
-    case 1004:
-    case 1005:
-      if ( get_static_verbose_bmp() ) 
-	fprintf( stderr, "%s: Ran out of memory\n", proc );
-      break;
-    case 0:
-      if ( get_static_verbose_bmp() > 1 ) 
-	fprintf( stderr, "%s: Got good data from file, writing results\n", proc );
-      break;
-    default:
-      if ( get_static_verbose_bmp() ) 
-	fprintf( stderr, "%s: Error reading file rc=%d\n", proc,rc );
-      break;
-    }
-
-    /*
-     * If the return value wasn't 0, something went wrong.
-     */
-    if (rc != 0)
-    {
-	if (rc != 1000 && rc != 1005)
-	{
-	    for (i=0; i<numImages; i++)
-	    {
-		if (argbs[i] != NULL)
-		    free(argbs[i]);
-		if (andMasks[i] != NULL)
-		    free(andMasks[i]);
-		if (xorMasks[i] != NULL)
-		    free(xorMasks[i]);
-	    }
-	    free(argbs);
-	    free(andMasks);
-	    free(xorMasks);
-	    free(widths);
-	    free(heights);
-	}
-	return( (void*)NULL );
-    }
-    
-    
-    /*
-     * Dump the images.
-     */
-    if ( get_static_verbose_bmp() > 1 ) 
-      fprintf (stderr, "%s: There are %d images in the file\n", proc, numImages);
-
-    if ( numImages >= 2 ) 
-      fprintf (stderr, "%s: read only first image among %d\n", proc, numImages );
-    
-    /*
-     * my stuff:
-     * just reading one bmp image
-     */
-    if ( (numImages > 0) &&
-	 (argbs[0] != NULL) ) {
-
-      buf = (void*)malloc( widths[0]*heights[0]*3 * sizeof( unsigned char ) );
-      if ( buf == (void*)NULL ) {
-	if ( get_static_verbose_bmp() ) 
-	  fprintf( stderr, "%s: error in allocating data buffer for %s\n", proc, name );
-
-	for (i=0; i<numImages; i++) {
-	  if (argbs[i] != NULL)
-	    free(argbs[i]);
-	  if (andMasks[i] != NULL)
-	    free(andMasks[i]);
-	  if (xorMasks[i] != NULL)
-	    free(xorMasks[i]);
-	}
-	free(argbs);
-	free(andMasks);
-	free(xorMasks);
-	free(widths);
-	free(heights);
-
-	return( (void*)NULL );
-      }
-
-      myBuf = (unsigned char*)buf;
-      i = 0;
-      for (row = 0; row < heights[0]; row++)
-      for (col = 0; col < widths[0]; col++,i+=3) {
-	myBuf[i  ] = argbs[0][row * widths[0] + col].red;
-	myBuf[i+1] = argbs[0][row * widths[0] + col].green;
-	myBuf[i+2] = argbs[0][row * widths[0] + col].blue;
-      }
-      
-      *dimx = widths[0];
-      *dimy = heights[0];
-      *dimz = 3;
-
-    } else {
-      if ( get_static_verbose_bmp() ) 
-	fprintf( stderr, "%s: no image or null image\n", proc );
-      
-      for (i=0; i<numImages; i++) {
-	if (argbs[i] != NULL)
-	  free(argbs[i]);
-	if (andMasks[i] != NULL)
-	  free(andMasks[i]);
-	if (xorMasks[i] != NULL)
-	  free(xorMasks[i]);
-      }
-      free(argbs);
-      free(andMasks);
-      free(xorMasks);
-      free(widths);
-      free(heights);
-      
-      return( (void*)NULL );
-    }
-
-
-
-    for (i=0; i<numImages; i++) {
-      if (argbs[i] != NULL)
-	free(argbs[i]);
-      if (andMasks[i] != NULL)
-	free(andMasks[i]);
-      if (xorMasks[i] != NULL)
-	free(xorMasks[i]);
-    }
-    free(argbs);
-    free(andMasks);
-    free(xorMasks);
-    free(widths);
-    free(heights);
-    
-    return( buf );
-
-
-
-
-
-#if 0
-    /*
-     * old stuff from test.c
-     */
-
-    for (i=0; i<numImages; i++)
-    {
-	/*
-	 * Loop through all the images that were returned.
-	 */
-      if ( get_static_verbose_bmp() ) {
-	fprintf (stderr, "%s: Doing image number %d\n\n", proc, i+1);
-	fprintf (stderr, "%s: Image dimensions: (%ld,%ld)\n", proc, widths[i], heights[i]);
-      }
-
-      if (argbs[i] != NULL) {
-	/*
-	 * If the image has colors, dump them (BMP, color ICO and color
-	 * PTR files
-	 */
-	fprintf(stderr, "Colors");
-	for (row = 0; row < heights[i]; row++)
-	  {
-	    fprintf (stderr, "\n\nRow %ld pixels (R,G,B), hex values:\n",
-		     row);
-	    for (col = 0; col < widths[i]; col++)
-	      {
-		fprintf (stderr, "(%2.2x,%2.2x,%2.2x)",
-			 argbs[i][row * widths[i] + col].red,
-			 argbs[i][row * widths[i] + col].green,
-			 argbs[i][row * widths[i] + col].blue);
-	      }
-	  }
-      } else {
-	/*
-	 * If there image has no colors, say so.  (monochrome ICO and PTR
-	 * files) 
-	 */
-	fprintf (stderr, "No color image\n");
-      }
-
-
-      
-      if (xorMasks[i] != NULL) {
-	/*
-	 * If the image has an xor mask, dump it.  (ICO and PTR files)
-	 */
-	fprintf (stderr, "\nXOR mask\n");
-	for (row = 0; row < heights[i]; row++)
-	  {
-	    for (col = 0; col < widths[i]; col++)
-	      {
-		fprintf (stderr, "%c",
-			 xorMasks[i][row * widths[i] + col] ? '@' : '.');
-	      }
-	    fprintf (stderr, "\n");
-	  }
-      } else {
-	/*
-	 * If the image has no xor mask, say so.  (BMP files).
-	 */
-	fprintf (stderr, "No xor mask\n");
-      }
-      
-
-
-      if (andMasks[i] != NULL) {
-	/*
-	 * If the image has an and mask, dump it.  (ICO and PTR files)
-	 */
-	fprintf (stderr, "\nAND mask\n");
-	for (row = 0; row < heights[i]; row++)
-	  {
-	    for (col = 0; col < widths[i]; col++)
-	      {
-		fprintf (stderr, "%c",
-			 andMasks[i][row * widths[i] + col] ? '@' : '.');
-	      }
-	    fprintf (stderr, "\n");
-	  }
-      } else {
-	/*
-	 * If the image has noand mask, say so.  (BMP files)
-	 */
-	fprintf (stderr, "No and mask\n");
-      }
-      
-
-      if (i != numImages-1)
-	fprintf (stderr, "\n------------------------------------------\n\n");
-      
-    }
-    
-    /*
-     * Dumping is complete.  Free all the arrays and quit
-     */
-    for (i=0; i<numImages; i++)
-    {
-	if (argbs[i] != NULL)
-	    free(argbs[i]);
-	if (andMasks[i] != NULL)
-	    free(andMasks[i]);
-	if (xorMasks[i] != NULL)
-	    free(xorMasks[i]);
-    }
-    free(argbs);
-    free(andMasks);
-    free(xorMasks);
-    free(widths);
-    free(heights);
-    
-    return( buf );
-#endif
-}
-
-CGAL_INLINE_FUNCTION
-void IoBmp_verbose ( )
-{
-  if ( get_static_verbose_bmp() <= 0 )
-    get_static_verbose_bmp() = 1;
-  else 
-    get_static_verbose_bmp() += 1;
-}
-
-CGAL_INLINE_FUNCTION
-void IoBmp_noverbose ( )
-{
-  get_static_verbose_bmp() = 0;
-}
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmpendian.cpp b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmpendian.cpp
deleted file mode 100644
index f252541..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmpendian.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-#ifndef CGAL_HEADER_ONLY
-
-#include "bmpendian.h"
-#include "bmpendian_impl.h"
-
-#endif // CGAL_HEADER_ONLY
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmpendian.h b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmpendian.h
deleted file mode 100644
index fa09c65..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmpendian.h
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-/*
- * from bmp.zip, see the url http://www.ddj.com/ftp/1995/1995.03/
- * author Dr. Dobb's
- */
-
-/*
- * This is the header for endian.c - functions to read/write our
- * CGAL_INT8, CGAL_INT16 and CGAL_INT32 types from/to a little-endian file.
- */
-
-#ifndef __ENDIAN_H_INCLUDED__
-#define __ENDIAN_H_INCLUDED__
-
-#include <cstdio>
-#include "bmptypes.h"
-#include <cstdio>
-
-/*
- * Read the basic types as little-endian values.  The return value will be
- * zero if successful, EOF, otherwise.
- */
-extern int readINT8little(FILE *f, CGAL_INT8 *i);
-extern int readINT16little(FILE *f, CGAL_INT16 *i);
-extern int readINT32little(FILE *f, CGAL_INT32 *i);
-extern int readUINT8little(FILE *f, CGAL_UINT8 *i);
-extern int readUINT16little(FILE *f, CGAL_UINT16 *i);
-extern int readUINT32little(FILE *f, CGAL_UINT32 *i);
-
-/*
- * Write the basic types as little-endian values.  The return value will be
- * zero if successful, EOF otherwise.
- */
-int writeINT8little(FILE *f, CGAL_INT8 i);
-int writeINT16little(FILE *f, CGAL_INT16 i);
-int writeINT32little(FILE *f, CGAL_INT32 i);
-int writeUINT8little(FILE *f, CGAL_UINT8 i);
-int writeUINT16little(FILE *f, CGAL_UINT16 i);
-int writeUINT32little(FILE *f, CGAL_UINT32 i);
-
-#ifdef CGAL_HEADER_ONLY
-#include "bmpendian_impl.h"
-#endif // CGAL_HEADER_ONLY
-
-#endif  /* __ENDIAN_H_INCLUDED__ */
-
-
-/*
- * Formatting information for emacs in c-mode
- *
- * Local Variables:
- * c-indent-level:4
- * c-continued-statement-offset:4
- * c-brace-offset:-4
- * c-brace-imaginary-offset:0
- * c-argdecl-indent:4
- * c-label-offset:-4
- * End:
- */
-
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmpendian_impl.h b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmpendian_impl.h
deleted file mode 100644
index 8686a18..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmpendian_impl.h
+++ /dev/null
@@ -1,257 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-#ifdef CGAL_HEADER_ONLY
-#define CGAL_INLINE_FUNCTION inline
-#else
-#define CGAL_INLINE_FUNCTION
-#endif
-
-/*
- * These functions read and write our basic integer types from a little-endian
- * file.  The endian and word-size of the host machine will not affect this
- * code.  The only assumption made is that the C data type (char) is one byte
- * long.  This should be a safe assumption.
- */
-
-#include <stdio.h>
-#include "bmptypes.h"
-
-/*****************************************************************************
-*
-* Read functions.  All read functions take an open file pointer as the first
-* parameter and a pointer to data as the second parameter.  The return value
-* will be 0 on success, and EOF on failure.  If successful, the second
-* parameter will point to the data read.
-*/
-
-/*
- * The CGAL_INT8 and CGAL_UINT8 types are stored as a single byte on disk.  The INT8
- * type is a signed integer with range (-128..127).  The CGAL_UINT8 type is an
- * unsigned integer with range (0..255).
- */
-CGAL_INLINE_FUNCTION
-int readINT8little(FILE *f, CGAL_INT8 *i)
-{
-    int rc;
-    
-    rc = fgetc(f);
-    if (rc == EOF)
-	return rc;
-    
-    *i = (rc & 0xff);
-    return 0;
-}
-
-CGAL_INLINE_FUNCTION
-int readUINT8little(FILE *f, CGAL_UINT8 *i)
-{
-    int  rc;
-    
-    rc = fgetc(f);
-    if (rc == EOF)
-	return rc;
-    
-    *i = (rc & 0xff);
-    return 0;
-}
-
-
-/*
- * The CGAL_INT16 and CGAL_UINT16 types are stored as two bytes on disk.  The INT16 type
- * is a signed integer with range (-32768..32767).  The CGAL_UINT16 type is an
- * unisgned integer with range (0..65535).
- */
-CGAL_INLINE_FUNCTION
-int readINT16little(FILE *f, CGAL_INT16 *i)
-{
-    int rc;
-    CGAL_INT16 temp = 0;
-    
-    temp = (fgetc(f) & 0xff);
-    
-    rc = fgetc(f);
-    if (rc == EOF)
-	return rc;
-    
-    temp |= ((rc & 0xff) << 8);
-    *i = temp;
-    return 0;
-}
-
-CGAL_INLINE_FUNCTION
-int readUINT16little(FILE *f, CGAL_UINT16 *i)
-{
-    int rc;
-    CGAL_UINT16 temp = 0;
-    
-    temp = (fgetc(f) & 0xff);
-    
-    rc = fgetc(f);
-    if (rc == EOF)
-	return rc;
-    
-    temp |= ((rc & 0xff) << 8);
-    *i = temp;
-    return 0;
-}
-
-/*
- * The CGAL_INT32 and CGAL_UINT32 types are stored as four bytes on disk.  The INT32
- * type is a signed integer with range (-2147483648..2147483647).  The CGAL_UINT32
- * type is an unisgned integer with range (0..4294967295).
- */
-CGAL_INLINE_FUNCTION
-int readINT32little(FILE *f, CGAL_INT32 *i)
-{
-    int rc;
-    CGAL_INT32 temp = 0;
-    
-    temp = ((long)fgetc(f) & 0xff);
-    temp |= (((long)fgetc(f) & 0xff) << 8);
-    temp |= (((long)fgetc(f) & 0xff) << 16);
-    
-    rc = fgetc(f);
-    if (rc == EOF)
-	return rc;
-    
-    temp |= (((long)rc & 0xff) << 24);
-    *i = temp;
-    return 0;
-}
-
-CGAL_INLINE_FUNCTION
-int readUINT32little(FILE *f, CGAL_UINT32 *i)
-{
-    int rc;
-    CGAL_UINT32 temp = 0;
-    
-    temp = ((long)fgetc(f) & 0xff);
-    temp |= (((long)fgetc(f) & 0xff) << 8);
-    temp |= (((long)fgetc(f) & 0xff) << 16);
-    
-    rc = fgetc(f);
-    if (rc == EOF)
-	return rc;
-    
-    temp |= (((long)rc & 0xff) << 24);
-    *i = temp;
-    return 0;
-}
-
-/*****************************************************************************
-*
-* Write functions.  All write functions take an open file pointer as the first
-* parameter and a data as the second parameter.  The return value will be 0 on
-* success, and EOF on failure.  If successful, the second parameter will have
-* been written to the open file.
-*/
-
-CGAL_INLINE_FUNCTION
-int writeINT8little(FILE *f, CGAL_INT8 i)
-{
-    return fputc(i, f);
-}
-
-CGAL_INLINE_FUNCTION
-int writeUINT8little(FILE *f, CGAL_UINT8 i)
-{
-    return fputc(i, f);
-}
-
-CGAL_INLINE_FUNCTION
-int writeINT16little(FILE *f, CGAL_INT16 i)
-{
-    int rc;
-    
-    rc = fputc((i & 0xff), f);
-    if (rc == EOF)
-	return rc;
-    
-    return fputc(((i >> 8) & 0xff), f);
-}
-
-CGAL_INLINE_FUNCTION
-int writeUINT16little(FILE *f, CGAL_UINT16 i)
-{
-    int rc;
-    
-    rc = fputc((i & 0xff), f);
-    if (rc == EOF)
-	return rc;
-    
-    return fputc(((i >> 8) & 0xff), f);
-}
-
-CGAL_INLINE_FUNCTION
-int writeINT32little(FILE *f, CGAL_INT32 i)
-{
-    int rc;
-    
-    rc = fputc((i & 0xff), f);
-    if (rc == EOF)
-	return rc;
-    
-    rc = fputc(((i >> 8) & 0xff), f);
-    if (rc == EOF)
-	return rc;
-    
-    rc = fputc(((i >> 16) & 0xff), f);
-    if (rc == EOF)
-	return rc;
-    
-    return fputc(((i >> 24) & 0xff), f);
-}
-
-
-CGAL_INLINE_FUNCTION
-int writeUINT32little(FILE *f, CGAL_UINT32 i)
-{
-    int rc;
-    
-    rc = fputc((i & 0xff), f);
-    if (rc == EOF)
-	return rc;
-    
-    rc = fputc(((i >> 8) & 0xff), f);
-    if (rc == EOF)
-	return rc;
-    
-    rc = fputc(((i >> 16) & 0xff), f);
-    if (rc == EOF)
-	return rc;
-    
-    return fputc(((i >> 24) & 0xff), f);
-}
-
-/*
- * Formatting information for emacs in c-mode
- *
- * Local Variables:
- * c-indent-level:4
- * c-continued-statement-offset:4
- * c-brace-offset:-4
- * c-brace-imaginary-offset:0
- * c-argdecl-indent:4
- * c-label-offset:-4
- * End:
- */
-
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmpread.cpp b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmpread.cpp
deleted file mode 100644
index 6e77cb0..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmpread.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-#ifndef CGAL_HEADER_ONLY
-
-#include "bmpread.h"
-#include "bmpread_impl.h"
-
-#endif // CGAL_HEADER_ONLY
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmpread.h b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmpread.h
deleted file mode 100644
index 90208bb..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmpread.h
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-/*
- * from bmp.zip, see the url http://www.ddj.com/ftp/1995/1995.03/
- * author Dr. Dobb's
- */
-
-/*
- * This is the header for readbmp.c - functions to read the bitmap file
- * structures.  See readbmp.c for details.
- */
-
-#ifndef __READBMP_H_INCLUDED__
-#define __READBMP_H_INCLUDED__
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "bmptypes.h"
-#include "bmpendian.h"
-
-/*
- * Mid-level functions
- */
-int readBitmapFileHeader(FILE *fp, Bitmapfileheader *bfh);
-int readBitmapArrayHeader(FILE *fp, BITMAPARRAYHEADER *bah);
-int readBitmapHeader(FILE *fp, BITMAPHEADER *bh);
-int readRgb(FILE *fp, RGB *rgb, int numBytes);
-int readColorTable(FILE *fp, RGB *rgb, int numEntries, int numBytesPerEntry);
-
-int readBitsUncompressed(FILE *fp, RGB *image, int width, int height,
-			 int depth, RGB* colorTable);
-int readMaskBitsUncompressed(FILE *fp, char *image, int width, int height);
-
-void reflectYRGB(RGB *image, int width, int height);
-void reflectYchar(char *image, int width, int height);
-
-/*
- * High level functions.
- */
-int readSingleImageBMP(FILE *fp, RGB **argb, CGAL_UINT32 *width, CGAL_UINT32 *height);
-int readSingleImageICOPTR(FILE *fp, char **xorMask, char **andMask,
-		          CGAL_UINT32 *width, CGAL_UINT32 *height);
-int readSingleImageColorICOPTR(FILE *fp, RGB **argb, char **xorMask,
-			       char **andMask, CGAL_UINT32 *width, CGAL_UINT32 *height);
-int readMultipleImage(FILE *fp, RGB ***argbs, char ***xorMasks,
-		      char ***andMasks, CGAL_UINT32 **widths, CGAL_UINT32 **heights,
-		      int *imageCount);
-
-#ifdef CGAL_HEADER_ONLY
-#include "bmpread_impl.h"
-#endif // CGAL_HEADER_ONLY
-
-#endif
-
-/*
- * Formatting information for emacs in c-mode
- *
- * Local Variables:
- * c-indent-level:4
- * c-continued-statement-offset:4
- * c-brace-offset:-4
- * c-brace-imaginary-offset:0
- * c-argdecl-indent:4
- * c-label-offset:-4
- * End:
- */
-
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmpread_impl.h b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmpread_impl.h
deleted file mode 100644
index 3bea18c..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmpread_impl.h
+++ /dev/null
@@ -1,1237 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-/*
- * from bmp.zip, see the url http://www.ddj.com/ftp/1995/1995.03/
- * author Dr. Dobb's
- */
-
-/*
- * This file contains mid-level functions for reading bitmap structures and
- * high-level functions that read bitmap files.
- */
-
-#ifdef CGAL_HEADER_ONLY
-#define CGAL_INLINE_FUNCTION inline
-#else
-#define CGAL_INLINE_FUNCTION
-#endif
-
-/*****************************************************************************
- *
- * Mid-level functions.
- *
- * These functions read in the various structures defined in bmptypes.h.  Each
- * function assumes that the file pointer is positioned at the start of the
- * given structure.  Upon completion, each function will leave the file
- * pointer positioned on the byte immediately following the structure.  Return
- * values will be 0 for success and non-zero for failure.  In all cases, a
- * return value of non-zero means that the file position has been left in an
- * indeterminate state and further reading should not be attempted.
- */
-
-/*
- * Read a Bitmapfileheader structure.
- */
-CGAL_INLINE_FUNCTION
-int readBitmapFileHeader(FILE *fp, Bitmapfileheader *bfh)
-{
-    int rc;
-  
-    rc = readUINT16little(fp, &(bfh->type));
-    if (rc != 0)
-	return rc;
-    
-    rc = readUINT32little(fp, &(bfh->size));
-    if (rc != 0)
-	return rc;
-    
-    rc = readINT16little(fp, &(bfh->xHotspot));
-    if (rc != 0)
-	return rc;
-    
-    rc = readINT16little(fp, &(bfh->yHotspot));
-    if (rc != 0)
-	return rc;
-    
-    rc = readUINT32little(fp, &(bfh->offsetToBits));
-    return rc;
-}
-
-/*
- * Read a BITMAPARRAYHEADER
- */
-CGAL_INLINE_FUNCTION
-int readBitmapArrayHeader(FILE *fp, BITMAPARRAYHEADER *bah)
-{
-    int rc;
-    
-    rc = readUINT16little(fp, &(bah->type));
-    if (rc != 0)
-	return rc;
-    rc = readUINT32little(fp, &(bah->size));
-    if (rc != 0)
-	return rc;
-    rc = readUINT32little(fp, &(bah->next));
-    if (rc != 0)
-	return rc;
-    rc = readUINT16little(fp, &(bah->screenWidth));
-    if (rc != 0)
-	return rc;
-    rc = readUINT16little(fp, &(bah->screenHeight));
-    return rc;
-}
-
-/*
- * Read the BITMAPHEADER structure.  This one requires a bit of sanity
- * checking.  The length of the structure on the disk is specified in the
- * first field.  We must stop reading after that many bytes, and if that value
- * is longer than sizeof(BITMAPHEADER), we must skip over any leftover bytes.
- * Finally, if size is 12, then width an height are really 16-bit values, and
- * we have to read them differently so they'll be properly stored in the
- * 32-bit fields BITMAPHEADER uses.
- */
-CGAL_INLINE_FUNCTION
-int readBitmapHeader(FILE *fp, BITMAPHEADER *bh)
-{
-    int    rc, oldFormat;
-	unsigned int bytesRead;
-    CGAL_UINT16 tempVal;
-    
-    /*
-     * Clear the structure.  Default values for all fields are zeros.  This
-     * will prevent garbage from being returned if the structure is truncated
-     * on disk.
-     */
-    memset(bh, 0, sizeof(BITMAPHEADER));
-    
-    /*
-     * Read the size of the structure.  From here on in, we'll have to be sure
-     * we don't read more bytes than this value.
-     */
-    rc = readUINT32little(fp, &(bh->size));
-    if (rc != 0)
-	return rc;
-    bytesRead = 4;
-    
-    /*
-     * If the size is 12 bytes or less, than this is an "old format"
-     * structure.  So the width and height fields will have to be read
-     * differently.
-     */
-    if (bh->size <= 12)
-	oldFormat = 1;
-    else
-	oldFormat = 0;
-    
-    /*
-     * Width and height are read differently for old and new format files.  In
-     * the old format, they're 16-bit values.  In the new format, they're
-     * 32-bits long.
-     */
-    if (oldFormat)
-    {
-	rc = readUINT16little(fp, &tempVal);
-	if (rc != 0)
-	    return rc;
-	bh->width = tempVal;
-	bytesRead += 2;
-    }
-    else
-    {
-	rc = readINT32little(fp, &(bh->width));
-	if (rc != 0)
-	    return rc;
-	bytesRead += 4;
-    }
-    if (bytesRead >= bh->size)
-	return 0;
-    
-    if (oldFormat)
-    {
-	rc = readUINT16little(fp, &tempVal);
-	if (rc != 0)
-	    return rc;
-	bh->height = tempVal;
-	bytesRead += 2;
-    }
-    else
-    {
-	rc = readINT32little(fp, &(bh->height));
-	if (rc != 0)
-	    return rc;
-	bytesRead += 4;
-    }
-    if (bytesRead >= bh->size)
-	return 0;
-    
-    /*
-     * From this point on, old and new formats are identical to each other,
-     * and we can proceed as if there was no difference.  For each field, we
-     * read it in and increment the count of bytes read.  If at any time we
-     * have read the amount we got earlier (in the size field), then stop and
-     * leave the rest of the fields as zeros.
-     */
-    rc = readUINT16little(fp, &(bh->numBitPlanes));
-    if (rc != 0)
-	return rc;
-    bytesRead += 2;
-    if (bytesRead >= bh->size)
-	return 0;
-    
-    rc = readUINT16little(fp, &(bh->numBitsPerPlane));
-    if (rc != 0)
-	return rc;
-    bytesRead += 2;
-    if (bytesRead >= bh->size)
-	return 0;
-  
-    /*
-     * Old format stop here.  But we don't have to check, because in that
-     * format, 12 bytes have been read and the function will have exited 
-     * without any extra checking.
-     */
-    rc = readUINT32little(fp, &(bh->compressionScheme));
-    if (rc != 0)
-	return rc;
-    bytesRead += 4;
-    if (bytesRead >= bh->size)
-	return 0;
-    
-    rc = readUINT32little(fp, &(bh->sizeOfImageData));
-    if (rc != 0)
-	return rc;
-    bytesRead += 4;
-    if (bytesRead >= bh->size)
-	return 0;
-    
-    rc = readUINT32little(fp, &(bh->xResolution));
-    if (rc != 0)
-	return rc;
-    bytesRead += 4;
-    if (bytesRead >= bh->size)
-	return 0;
-    
-    rc = readUINT32little(fp, &(bh->yResolution));
-    if (rc != 0)
-	return rc;
-    bytesRead += 4;
-    if (bytesRead >= bh->size)
-	return 0;
-    
-    rc = readUINT32little(fp, &(bh->numColorsUsed));
-    if (rc != 0)
-	return rc;
-    bytesRead += 4;
-    if (bytesRead >= bh->size)
-	return 0;
-    
-    rc = readUINT32little(fp, &(bh->numImportantColors));
-    if (rc != 0)
-	return rc;
-    bytesRead += 4;
-    if (bytesRead >= bh->size)
-	return 0;
-    
-    rc = readUINT16little(fp, &(bh->resolutionUnits));
-    if (rc != 0)
-	return rc;
-    bytesRead += 2;
-    if (bytesRead >= bh->size)
-	return 0;
-    
-    rc = readUINT16little(fp, &(bh->padding));
-    if (rc != 0)
-	return rc;
-    bytesRead += 2;
-    if (bytesRead >= bh->size)
-	return 0;
-    
-    rc = readUINT16little(fp, &(bh->origin));
-    if (rc != 0)
-	return rc;
-    bytesRead += 2;
-    if (bytesRead >= bh->size)
-	return 0;
-    
-    rc = readUINT16little(fp, &(bh->halftoning));
-    if (rc != 0)
-	return rc;
-    bytesRead += 2;
-    if (bytesRead >= bh->size)
-	return 0;
-    
-    rc = readUINT32little(fp, &(bh->halftoningParam1));
-    if (rc != 0)
-	return rc;
-    bytesRead += 4;
-    if (bytesRead >= bh->size)
-	return 0;
-    
-    rc = readUINT32little(fp, &(bh->halftoningParam2));
-    if (rc != 0)
-	return rc;
-    bytesRead += 4;
-    if (bytesRead >= bh->size)
-	return 0;
-  
-    rc = readUINT32little(fp, &(bh->colorEncoding));
-    if (rc != 0)
-	return rc;
-    bytesRead += 4;
-    if (bytesRead >= bh->size)
-	return 0;
-    
-    rc = readUINT32little(fp, &(bh->identifier));
-    if (rc != 0)
-	return rc;
-    bytesRead += 4;
-    if (bytesRead >= bh->size)
-	return 0;
-    
-    /*
-     * If there are more bytes in the file than this, then the file is using a
-     * future format that doesn't exist yet.  Skip over the bytes.  Assuming
-     * this future format somewhat resembles what we know now, ignoring the
-     * fields will be safe.  We _MUST_ skip them, though, since the color
-     * table begins on the byte after this structure, and we have to position
-     * the file pointer there.
-     */
-    return fseek(fp, (bh->size - bytesRead), SEEK_CUR);
-}
-
-
-/*
- * readRgb reads in a single RGB structure from the disk.  The numBytes field
- * indicates how many bytes the field occupies on the disk.  It assumes that
- * each component is one byte on disk and the rest is padding.  This will
- * compensate for the old/new differences in color tables.  (Old format
- * bitmaps use 3 bytes per entry, while new format bitmaps use 4.)  Note how
- * it will never read more than the number of bytes requested.
- */
-CGAL_INLINE_FUNCTION
-int readRgb(FILE *fp, RGB *rgb, int numBytes)
-{
-    int rc;
-    
-    if (numBytes == 0)
-	return 0;
-    rc = readUINT8little(fp, &(rgb->blue));
-    if (rc != 0)
-	return rc;
-    
-    if (numBytes == 1)
-	return 0;
-    rc = readUINT8little(fp, &(rgb->green));
-    if (rc != 0)
-	return rc;
-    
-    if (numBytes == 2)
-	return 0;
-    rc = readUINT8little(fp, &(rgb->red));
-    if (rc != 0)
-	return rc;
-    
-    if (numBytes == 3)
-	return 0;
-    
-    /* Skip over extra bytes if more than three were requested */
-    return fseek(fp, (numBytes - 3), SEEK_CUR);
-}
-
-/*
- * A color table is a block of RGB structures, all the same size.  Read it by
- * calling readRgb repeatedly.
- */
-CGAL_INLINE_FUNCTION
-int readColorTable(FILE *fp, RGB *rgb, int numEntries, int numBytesPerEntry)
-{
-    int i, rc;
-    
-    for (i=0; i<numEntries; i++)
-    {
-	rc = readRgb(fp, &(rgb[i]), numBytesPerEntry);
-	if (rc != 0)
-	    return rc;
-    }
-    return 0;
-}
-
-
-/*
- * ReadBitsUncompressed.  Reads pixel values into an array of RGB
- * values.  It assmes that there is no compression.  Note that there we're
- * only handling bit depths of 1, 4, 8, 16, and 24. Note that OS/2 bitmaps
- * can (in theory) have any number of bits per pixel, so you might find a
- * strange bitmap file that this can't handle, but the chances of finding such
- * a file this are nearly zero.
- *
- * Each row of pixels is always padded to a 4-byte boundary.
- */
-CGAL_INLINE_FUNCTION
-int readBitsUncompressed(FILE *fp, RGB *image, int width, int height,
-			 int depth, RGB *colorTable)
-{
-    CGAL_UINT8 temp;
-    int   rc, padBytes, i;
-    long  row, column, pixel, value;
-    
-    switch (depth) {
-    case 1:
-	/*
-	 * For 1 bit per pixel, each byte is 8 pixels.  Each one is an index
-	 * into the color table (1 or 0).  Most significant byte first.  All
-	 * is padded to 32-bit boundaries as well.
-	 */
-	pixel = 0;
-	if (((width % 32) == 0) || ((width % 32) > 24))
-	    padBytes = 0;
-	else if ((width % 32) <= 8)
-	    padBytes = 3;
-	else if ((width % 32) <= 16)
-	    padBytes = 2;
-	else
-	    padBytes = 1;
-
-	for (row = height; row > 0; row--)
-	{
-	    for (column = width; column > 0; column -= 8)
-	    {
-		rc = readUINT8little(fp, &temp);
-		if (rc != 0)
-		    return rc;
-		for (i=0; i < ((column < 8) ? column : 8); i++)
-		{
-		    /*
-		     * For each byte read, bit-decompose it.  Note that the
-		     * last byte on a row could have less than 8 bits used.
-		     * Most significant bits come first.
-		     */
-		    value = ((temp & (1 << (7-i))) == 0) ? 0 : 1;
-		    image[pixel].red   = colorTable[value].red;
-		    image[pixel].green = colorTable[value].green;
-		    image[pixel].blue  = colorTable[value].blue;
-		    pixel++;
-		}
-	    }
-	    if (padBytes != 0)
-	    {
-		rc = fseek(fp, padBytes, SEEK_CUR);
-		if (rc != 0)
-		    return rc;
-	    }
-	}
-	break;
-
-    case 4:
-	/*
-	 * For 4 bits per pixel, each byte is two pixels.  The upper half go to
-	 * the first pixel, and the lower half to the second.
-	 */
-	pixel = 0;
-	if (((width % 8) == 0) || ((width % 8) > 6))
-	    padBytes = 0;
-	else if ((width % 8) <= 2)
-	    padBytes = 3;
-	else if ((width % 8) <= 4)
-	    padBytes = 2;
-	else
-	    padBytes = 1;
-	
-	for (row = height; row > 0; row--)
-	{
-	    for (column = width; column > 0; column -= 2)
-	    {
-		/*
-		 * Each byte here is two pixels.  Note that the last byte on a
-		 * row may only contain one pixel.
-		 */
-		rc = readUINT8little(fp, &temp);
-		if (rc != 0)
-		    return rc;
-		/*
-		 * First pixel is the upper 4 bits
-		 */
-		value = temp >> 4;
-		image[pixel].red   = colorTable[value].red;
-		image[pixel].green = colorTable[value].green;
-		image[pixel].blue  = colorTable[value].blue;
-		pixel++;
-
-		/*
-		 * Second pixel is lower 4 bits.  If this is the last byte in
-		 * the row, and there are an odd number of pixels per row, then
-		 * this is not valid data.
-		 */
-		if (column == 1)
-		{
-		    value = temp & 0x0f;
-		    image[pixel].red   = colorTable[value].red;
-		    image[pixel].green = colorTable[value].green;
-		    image[pixel].blue  = colorTable[value].blue;
-		    pixel++;
-		}
-	    }
-	    if (padBytes != 0)
-	    {
-		rc = fseek(fp, padBytes, SEEK_CUR);
-		if (rc != 0)
-		    return rc;
-	    }
-	}
-	break;
-
-    case 8:
-	/*
-	 * For 8 bits per pixel, each byte is one pixel.
-	 */
-	pixel = 0;
-	padBytes = ((width % 4) == 0) ? 0 : (4 - (width % 4));
-
-	for (row=height; row > 0; row--)
-	{
-	    for (column=width; column > 0; column--)
-	    {
-		rc = readUINT8little(fp, &temp);
-		if (rc != 0)
-		    return rc;
-		image[pixel].red   = colorTable[temp].red;
-		image[pixel].green = colorTable[temp].green;
-		image[pixel].blue  = colorTable[temp].blue;
-		pixel++;
-	    }
-	    if (padBytes != 0)
-	    {
-		rc = fseek(fp, padBytes, SEEK_CUR);
-		if (rc != 0)
-		    return rc;
-	    }
-	}
-	break;
-
-    case 16:
-	/*
-	 * For 16 bits per pixel, you must read two bytes per pixel.  But
-	 * there's a catch. The data is big endian!  This is because all pixel
-	 * data (for all formats, actually) is stored as a packed array,
-	 * stored in pixel order.
-	 */
-	pixel = 0;
-	padBytes = ((width % 2) == 0) ? 0 : 2;
-	for (row=height; row > 0; row--)
-	{
-	    for (column=width; column > 0; column--)
-	    {
-		/*
-		 * Read a 16-bit integer as big endian.  Do this by reading
-		 * two bytes and mathematically combine them.  After that,
-		 * proceed as usual.
-		 */
-		rc = readUINT8little(fp, &temp);
-		if (rc != 0)
-		    return rc;
-		value = ((long)temp) << 8;
-		rc = readUINT8little(fp, &temp);
-		if (rc != 0)
-		    return rc;
-		value |= temp;
-
-		image[pixel].red   = colorTable[value].red;
-		image[pixel].green = colorTable[value].green;
-		image[pixel].blue  = colorTable[value].blue;
-		pixel++;
-	    }
-	    if (padBytes != 0)
-	    {
-		rc = fseek(fp, padBytes, SEEK_CUR);
-		if (rc != 0)
-		    return rc;
-	    }
-	}
-	break;
-
-    case 24:
-	/*
-	 * For 24 bits per pixel, it's an RGB structure.  Note that the color
-	 * table is ignore for bit depths greater than 24 bits.
-	 */
-	pixel = 0;
-	padBytes = width % 4;
-
-	for (row=height; row > 0; row--)
-	{
-	    for (column=width; column > 0; column--)
-	    {
-		rc = readRgb(fp, image+pixel, 3);
-		pixel++;
-	    }
-	    if (padBytes != 0)
-	    {
-		rc = fseek(fp, padBytes, SEEK_CUR);
-		if (rc != 0)
-		    return rc;
-	    }
-	}          
-	break;
-    }
-    
-    return 0;
-}
-
-
-/*
- * ReadMaskBitsUncompressed.  Reads a monochrome mask into an array of
- * characters.  It assmes that there is no compression.  This is very similar
- * (internally) to the readBitsUncompressed function.  Note that if the data
- * read isn't really one-bit-deep data, you'll probably get garbage back.
- */
-CGAL_INLINE_FUNCTION
-int readMaskBitsUncompressed(FILE *fp, char *image, int width, int height)
-{
-    CGAL_UINT8 temp;
-    int   rc, padBytes, i;
-    long  row, column, pixel;
-    char value;
-    
-    /*
-     * see the one-bit-depth part of readBitsUncompressed for comments
-     */
-    pixel = 0;
-    if (((width % 32) == 0) || ((width % 32) > 24))
-	padBytes = 0;
-    else if ((width % 32) <= 8)
-	padBytes = 3;
-    else if ((width % 32) <= 16)
-	padBytes = 2;
-    else
-	padBytes = 1;
-
-    for (row = height; row > 0; row--)
-    {
-	for (column = width; column > 0; column -= 8)
-	{
-	    rc = readUINT8little(fp, &temp);
-	    if (rc != 0)
-		return rc;
-	    for (i=0; i < ((column < 8) ? column : 8); i++)
-	    {
-		value = ((temp & (1 << (7-i))) == 0) ? 0 : 1;
-		image[pixel] = value;
-		pixel++;
-	    }
-	}
-	if (padBytes != 0)
-	{
-	    rc = fseek(fp, padBytes, SEEK_CUR);
-	    if (rc != 0)
-		return rc;
-	}
-    }
-
-    return 0;
-}
-
-
-/*
- * reflectYRGB takes an array of RGB vales and the dimensions they represent
- * and flips it vertically.  This will convert a bottom-left origin array to a
- * top-left origin array.
- */
-CGAL_INLINE_FUNCTION
-void reflectYRGB(RGB *image, int width, int height)
-{
-    int row, col;
-    RGB temp;
-    
-    for (row = 0; row < (height / 2); row++)
-    {
-	for (col = 0; col < width; col++)
-	{
-	    /* Swap pixels at (x,y) with (x,height-y) */
-	    memcpy(&temp, image+(row * width + col), sizeof(RGB));
-	    memcpy(image+(row * width + col),
-		   image+((height - row - 1) * width + col), sizeof(RGB));
-	    memcpy(image+((height - row - 1) * width + col), &temp,
-		   sizeof(RGB));
-	}
-    }
-}
-/*
- * reflectYchar takes an array of char values and the dimensions they
- * represent and flips it vertically.  This will convert a bottom-left origin
- * array to a top-left origin array.
- */
-CGAL_INLINE_FUNCTION
-void reflectYchar(char *image, int width, int height)
-{
-    int row, col;
-    char temp;
-    
-    for (row = 0; row < (height / 2); row++)
-    {
-	for (col = 0; col < width; col++)
-	{
-	    /* Swap values at (x,y) with (x,height-y) */
-	    temp = image[row * width + col];
-	    image[row * width + col]=image[(height - row - 1) * width + col];
-	    image[(height - row - 1) * width + col] = temp;
-	}
-    }
-}
-
-/*****************************************************************************
- *
- * High-level functions
- *
- * These functions read in specific types of bitmap files.  Each assumes that
- * the file pointer is positioned at the appropriate place in a bitmap file.
- * (At the start of a Bitmapfileheader for all functions except
- * readMultipleImages, which assumes the file pointer to be positioned on the
- * start of a BITMAPARRAYHEADER.  These functions will leave the file pointer
- * on the byte after the image's color table.
- *
- * The coordinate speaces in the returned arrays will have an upper-left
- * origin.   As before, a non-zero return value indicates that something went
- * wrong.
- *
- * Note that the BMP and mono-ICO functions will not return 1000 if the image
- * is of type color-icon.  This is because a color icon consists of a bitmap
- * and a monochrome icon.
- *
- * return values:
- *	   0 - success
- *	1000 - incorrect file type for the routine called
- *	1001 - image data out of range or damaged file
- *	1002 - good data, but the routine called can't handle it (yet)
- *	1003 - out of memory allocating color table
- *	1004 - out of memory allocating image
- *	1005 - out of memory allocating image arrays
- *	1006 - Illegal image type in a multi-image array
- *
- *     other - I/O error of some kind
- */
-
-
-/*
- * readSingleImageBMP will read a single BMP image and generate an array of RGB
- * triples that contain the RGB values for every pixel.  It will also return
- * the dimensions of the image.
- */
-CGAL_INLINE_FUNCTION
-int readSingleImageBMP(FILE *fp, RGB **argb, CGAL_UINT32 *width, CGAL_UINT32 *height)
-{
-    Bitmapfileheader  bfh;
-    BITMAPHEADER      bh;
-    RGB              *colorTable = (RGB*)NULL;
-    RGB              *image = (RGB*)NULL;
-    int               rc, depth, inverted;
-    long              numColors, numPixels, endPos;
-    
-    /*
-     * First, get the file header and sanity check it.  The type field must be
-     * TYPE_BMP or we're aborting.
-     */
-    rc = readBitmapFileHeader(fp, &bfh);
-    if (rc != 0)
-	return rc;
-    if ((bfh.type != TYPE_BMP) &&
-	(bfh.type != TYPE_ICO_COLOR) &&
-	(bfh.type != TYPE_PTR_COLOR))
-	return 1000;
-    
-    /*
-     * Immediately following a file header is always the bitmap header.  Read
-     * it.  Sanity check any values we might need.  Specifically, less than
-     * 32-bit depth, known compression scheme, known origin, and known color
-     * encoding, and valid height/width.  Note that negative height is OK,
-     * that indicates an upper-left origin for a Windows bitmap.
-     */
-    rc = readBitmapHeader(fp, &bh);
-    if (rc != 0)
-	return rc;
-    depth = bh.numBitPlanes * bh.numBitsPerPlane;
-    if ((depth > 32) ||
-	(bh.compressionScheme > COMPRESSION_LAST) ||
-	(bh.origin > ORIGIN_LAST) ||
-	(bh.colorEncoding > COLOR_ENCODING_LAST) ||
-	(bh.width < 1) ||
-	(bh.height == 0))
-	return 1001;
-    
-    /*
-     * If the height is negative, then this is a Windows bitmap whose origin
-     * is the upper-left corner and not the lower-left.  The inverted flag
-     * indicates a lower-left origin.  Our code will be outputting an
-     * upper-left origin pixel array.
-     */
-    if (bh.height < 0)
-    {
-	inverted = 0;
-	bh.height = -bh.height;
-    }
-    else
-	inverted = 1;
-    
-    /*
-     * Now, sanity check a few fields that are valid, but I don't have code to
-     * deal with them yet.  This includes: more than one bit plane, any
-     * compression scheme, and bit depths that are not 1, 4, 8, 16, or 24.
-     */
-    if ((bh.numBitPlanes > 1) ||
-	((bh.numBitsPerPlane != 1) &&
-	 (bh.numBitsPerPlane != 4) &&
-	 (bh.numBitsPerPlane != 8) &&
-	 (bh.numBitsPerPlane != 16) &&
-	 (bh.numBitsPerPlane != 24)) ||
-	(bh.compressionScheme != COMPRESSION_NONE))
-	return 1002;
-    
-    /*
-     * Allocate and read the color table.  The file pointer has been
-     * positioned in the right place by the readBitmapHeader function.  Note
-     * that images with 24-bits or more color depth have no color table.  They
-     * are  already RGB.  When reading the color table, be sure to check for
-     * old/new format bitmaps. 
-     */
-    if (depth < 24)
-    {
-	numColors = 1 << depth;
-	colorTable = (RGB *)calloc(numColors, sizeof(RGB));
-	if (colorTable == NULL)
-	    return 1003;
-	if (bh.size <= 12)
-	    rc = readColorTable(fp, colorTable, numColors, 3);
-	else
-	    rc = readColorTable(fp, colorTable, numColors, 4);
-	if (rc != 0)
-	{
-	    free(colorTable);
-	    return rc;
-	}
-    }
-    
-    /*
-     * We're at the end of the color table.  Preserve this position.  We'll
-     * need to leave the file pointer there before returning from this
-     * function. 
-     */
-    endPos = ftell(fp);
-
-    /*
-     * Allocate the array of pixels and fill it in.
-     */
-    numPixels = bh.width * bh.height;
-    image = (RGB *)calloc(numPixels, sizeof(RGB));
-    if (image == NULL)
-    {
-	free (colorTable);
-	return 1004;
-    }
-    
-    /*
-     * Seek to the bits
-     */
-    rc = fseek(fp, bfh.offsetToBits, SEEK_SET);
-    if (rc != 0)
-    {
-	free (colorTable);
-	free (image);
-	return rc;
-    }
-    
-    /*
-     * Read the bits.  If code for decompressing bits should be written,
-     * insert the call here.
-     */
-    switch ((int)bh.compressionScheme) {
-    case COMPRESSION_NONE:
-	rc = readBitsUncompressed(fp, image, bh.width, bh.height, depth,
-				  colorTable);
-	break;
-    }
-    
-    if (rc != 0)
-    {
-	free(image);
-	return rc;
-    }
-    
-    /*
-     * If the origin is lower-left, flip the image upside down
-     */
-    if (inverted)
-	reflectYRGB(image, bh.width, bh.height);
-
-    /*
-     * Return the output values.  Set the file pointer to the byte after the
-     * color table.
-     */
-    *argb = image;
-    *width = bh.width;
-    *height = bh.height;
-    fseek(fp, endPos, SEEK_SET);
-
-    /*
-     * Clean up and return.  Note that we don't return the color table.  This
-     * is because we're returning an array of RGB values for the image - such
-     * a table would be redundant.
-     */
-    if (colorTable != NULL)
-	free(colorTable);
-
-    return 0;
-}
-
-
-/*
- * Read in a monochrome OS/2 icon/pointer.  return two arrays of bytes
- * (interpreted as booleans) for the XOR and AND masks.
- */
-CGAL_INLINE_FUNCTION
-int readSingleImageICOPTR(FILE *fp, char **xorMask, char **andMask,
-		          CGAL_UINT32 *width, CGAL_UINT32 *height) 
-{
-    Bitmapfileheader  bfh;
-    BITMAPHEADER      bh;
-    char             *mask1, *mask2;
-    int               rc;
-    long              numPixels, endPos;
-
-    /*
-     * Read and sanity check the header.  Monochrom OS/2 icons are TYPE_ICO.
-     * Monochrome pointers are TYPE_PTR.  Color ICO and PTR is also allowed,
-     * because monochrome masks are part of those images.
-     */
-    rc = readBitmapFileHeader(fp, &bfh);
-    if (rc != 0)
-	return rc;
-    if ((bfh.type != TYPE_ICO) &&
-	(bfh.type != TYPE_PTR) &&
-	(bfh.type != TYPE_ICO_COLOR) &&
-	(bfh.type != TYPE_PTR_COLOR))
-	return 1000;
-
-    /*
-     * Now read the bitmap data and sanity check it.  Since this is a
-     * monochrome icon, bit depth must be 1.  Additionally, a known
-     * compression scheme, known origin, known color encoding, and valid
-     * height/width.  Height can't be less than 0, as it can with color
-     * images, since this code is only used on for OS/2-type images.
-     */
-    rc = readBitmapHeader(fp, &bh);
-    if (rc != 0)
-	return rc;
-    if ((bh.numBitPlanes != 1) ||
-	(bh.numBitsPerPlane != 1) ||
-	(bh.compressionScheme > COMPRESSION_LAST) ||
-	(bh.origin > ORIGIN_LAST) ||
-	(bh.colorEncoding > COLOR_ENCODING_LAST) ||
-	(bh.width < 1) ||
-	(bh.height < 1))
-	return 1001;
-
-    /*
-     * Sanity check some valid fields that I can't deal with yet.
-     */
-    if (bh.compressionScheme != COMPRESSION_NONE)
-	return 1002;
-
-    /*
-     * Skip over the color table, since this is a monochrome mask.  Note that
-     * the size is already known - 2 entries - which is 6 or 8 bytes.
-     * this isn't, and we don't.
-     */
-    if (bh.size <= 12)
-	rc = fseek(fp, 6, SEEK_CUR);
-    else
-	rc = fseek(fp, 8, SEEK_CUR);
-    if (rc != 0)
-    {
-	return rc;
-    }
-
-    /*
-     * Save this file position.  we'll have to seek back to it after reading
-     * in the image data.
-     */
-    endPos = ftell(fp);
-
-    /*
-     * The image is actually two images.  The top half is an AND mask and the
-     * bottom half is an XOR mask.  Allocate the images.
-     */
-    numPixels = bh.width * bh.height / 2;
-    mask1 = (char *)malloc(numPixels);
-    if (mask1 == NULL)
-	return 1004;
-    mask2 = (char *)malloc(numPixels);
-    if (mask2 == NULL)
-    {
-	free(mask1);
-	return 1004;
-    }
-
-    /*
-     * Seek to the bit data
-     */
-    rc = fseek(fp, bfh.offsetToBits, SEEK_SET);
-    if (rc != 0)
-    {
-	free (mask1);
-	free (mask2);
-	return rc;
-    }
-
-    /*
-     * Read in the bits.  Note: since these are really two images, two calls
-     * to readMaskBitsUncompressed are made, and the height used is 1/2 the
-     * height mentioned in the header.
-     */
-    switch ((int) bh.compressionScheme) {
-    case COMPRESSION_NONE:
-	rc = readMaskBitsUncompressed(fp, mask1, bh.width, bh.height/2);
-	if (rc == 0)
-	    rc = readMaskBitsUncompressed(fp, mask2, bh.width, bh.height/2);
-	break;
-    }
-
-    if (rc != 0)
-    {
-	free (mask1);
-	free (mask2);
-	return rc;
-    }
-
-    /*
-     * A mask will never have an upper-left origin, since Windows will never
-     * produce one in a bitmap file.
-     */
-    reflectYchar(mask1, bh.width, bh.height / 2);
-    reflectYchar(mask2, bh.width, bh.height / 2);
-
-    /*
-     * Return everything we've read.
-     */
-    *xorMask = mask1;
-    *andMask = mask2;
-    *width = bh.width;
-    *height = bh.height / 2;
-    fseek(fp, endPos, SEEK_SET);
-    
-    return 0;
-}
-
-
-/*
- * Read in a color OS/2 icon.  return an array of RGBs for the colors.
- * and two arrays of bytes (interpreted as booleans) for the XOR and AND
- * masks.
- */
-CGAL_INLINE_FUNCTION
-int readSingleImageColorICOPTR(FILE *fp, RGB **argb, char **xorMask,
-			       char **andMask, CGAL_UINT32 *width, CGAL_UINT32 *height)
-{
-    CGAL_UINT32 width1, height1, width2, height2;
-    int rc;
-
-    /*
-     * Color icons consist of a monochrome icon followed by a bitmap.  This
-     * makes reading them easy - first do a monochrome mask read, and then do
-     * a color bitmap read.  We should probably add some more descriptive
-     * error codes here.
-     *
-     * First read the mask.
-     */
-    rc = readSingleImageICOPTR(fp, xorMask, andMask, &width2, &height2);
-    if (rc != 0)
-    {
-	return rc;
-    }
-
-    /*
-     * Next, read the color bitmap part
-     */
-    rc = readSingleImageBMP(fp, argb, &width1, &height1);
-    if (rc != 0)
-    {
-	return rc;
-    }
-
-    /*
-     * Now, just sanity check the image - the dimensions for the image should
-     * match the dimensions of the masks.
-     */
-    if ((width1 != width2) || (height1 != height2))
-	return 1001;
-
-    *width = width1;
-    *height = height1;
-    return 0;
-}
-
-
-/*
- * readMultipleImage runs down the list of images in a file and returns them
- * all.  ImageCount is the number of images in the file.  The other returned
- * values are parallel arrays.  If an element in aargb, axorMask, or aandMask
- * is NULL, then that image has no such array.  (Bitmaps have no xor or and
- * masks, monochrome icons have no color arrays.
- *
- * Note that on errors other than 1000 and 1005, the arrays will contain good
- * data - the images that have been read properly will be in the arrays.
- * Images that have not yet been read will consist of NULL pointers in the
- * arrays. 
- */
-CGAL_INLINE_FUNCTION
-int readMultipleImage(FILE *fp, RGB ***argbs, char ***xorMasks,
-		      char ***andMasks, CGAL_UINT32 **widths, CGAL_UINT32 **heights,
-		      int *imageCount)
-{
-    int rc;
-    long filePos;
-    BITMAPARRAYHEADER bah;
-    CGAL_UINT16 imageType;
-    int count;
-    
-    /*
-     * First count the images.  Preserve the file position for later.  If some
-     * structure in the list isn't an array header, return 1000.
-     */
-    filePos = ftell(fp);
-    count = 0;
-    do
-    {
-	rc = readBitmapArrayHeader(fp, &bah);
-	if (rc != 0)
-	    return rc;
-	if (bah.type != TYPE_ARRAY)
-	    return 1000;
-	fseek(fp, bah.next, SEEK_SET);
-	count++;
-    } while (bah.next != 0);
-    fseek(fp, filePos, SEEK_SET);
-    
-    /*
-     * Allocate the arrays.  Return 1005 on any failures
-     */
-    *argbs = (RGB **)calloc(count, sizeof(RGB *));
-    if (*argbs == NULL)
-	return 1005;
-    *xorMasks = (char **)calloc(count, sizeof(char *));
-    if (*xorMasks == NULL)
-    {
-	free(*argbs);
-	return 1005;
-    }
-    *andMasks = (char **)calloc(count, sizeof(char *));
-    if (*andMasks == NULL)
-    {
-	free(*argbs);
-	free(*xorMasks);
-	return 1005;
-    }
-    *widths = (CGAL_UINT32 *)calloc(count, sizeof(CGAL_UINT32));
-    if (*widths == NULL)
-    {
-	free(*argbs);
-	free(*xorMasks);
-	free(*andMasks);
-	return 1005;
-    }
-    *heights = (CGAL_UINT32 *)calloc(count, sizeof(CGAL_UINT32));
-    if (*heights == NULL)
-    {
-	free(*argbs);
-	free(*xorMasks);
-	free(*andMasks);
-	free(*widths);
-	return 1005;
-    }
-    *imageCount = count;
-
-    /*
-     * Loop through the images again.  This time, read each image
-     */
-    count = 0;
-    do
-    {
-	rc = readBitmapArrayHeader(fp, &bah);
-	if (rc != 0)
-	    return rc;
-	/*
-	 * Get the image type.  Preserve the position, since we're reading
-	 * into the next structure.
-	 */
-	filePos = ftell(fp);
-	rc = readUINT16little(fp, &imageType);
-	if (rc != 0)
-	    return rc;
-	rc = fseek(fp, filePos, SEEK_SET);
-
-	/*
-	 * Now that we know what kind of image we're about to read, read it. 
-	 */
-	switch(imageType) {
-	case TYPE_BMP:
-	    rc = readSingleImageBMP(fp, (*argbs)+count, (*widths)+count,
-				    (*heights)+count);
-	    break;
-	case TYPE_ICO:
-	case TYPE_PTR:
-	    rc = readSingleImageICOPTR(fp, (*xorMasks)+count,
-				       (*andMasks)+count, (*widths)+count,
-				       (*heights)+count);
-	    break;
-	case TYPE_ICO_COLOR:
-	case TYPE_PTR_COLOR:
-	    rc = readSingleImageColorICOPTR(fp, (*argbs)+count,
-					    (*xorMasks)+count,
-					    (*andMasks)+count,
-					    (*widths)+count,
-					    (*heights)+count);
-	    break;
-	default:
-	    return 1006;
-	}
-	if (rc != 0)
-	    return rc;
-	
-	fseek(fp, bah.next, SEEK_SET);
-	count++;
-    } while (bah.next != 0);
-
-    return 0;
-}
-
-
-/*
- * Formatting information for emacs in c-mode
- *
- * Local Variables:
- * c-indent-level:4
- * c-continued-statement-offset:4
- * c-brace-offset:-4
- * c-brace-imaginary-offset:0
- * c-argdecl-indent:4
- * c-label-offset:-4
- * End:
- */
-
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmptypes.h b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmptypes.h
deleted file mode 100644
index c6e924f..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/bmptypes.h
+++ /dev/null
@@ -1,222 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-/*
- * from bmp.zip, see the url http://www.ddj.com/ftp/1995/1995.03/
- * author Dr. Dobb's
- */
-
-/*
- * Data types used in bitmap files.
- */
-
-#ifndef __BMPTYPES_H_INCLUDED__
-#define __BMPTYPES_H_INCLUDED__
-
-/*****************************************************************************
-*
-* Data types.
-*
-* CGAL_INT8 is an integer of at least 8 bits wide.
-* CGAL_INT16 is an integer of at least 16 bits wide.
-* CGAL_INT32 is an integer of at least 32 bits wide.
-*
-* CGAL_UINT8 is an unsigned CGAL_INT8
-* CGAL_UINT16 is an unsigned CGAL_INT16
-* CGAL_UINT32 is an unsigned CGAL_INT32
-*/
-
-typedef char           CGAL_INT8;
-typedef short          CGAL_INT16;
-typedef long           CGAL_INT32;
-typedef unsigned char  CGAL_UINT8;
-typedef unsigned short CGAL_UINT16;
-typedef unsigned long  CGAL_UINT32;
-
-/*****************************************************************************
-*
-* Constants.  Each set corresponds to a field in a structure.  Note that some
-* sets only have one value.  Default values for all fields are the value
-* corresponding to 0. 
-*/
-
-/*
- * Constants used in the "type" field of Bitmapfileheader and
- * BITMAPARRAYHEADER structures.  Note that these are all two-character
- * mnemonics as well as integer constants.
- */
-#define TYPE_ICO        (0x4349)   /* 'IC' */
-#define TYPE_BMP        (0x4d42)   /* 'BM' */
-#define TYPE_PTR        (0x5450)   /* 'PT' */
-#define TYPE_ICO_COLOR  (0x4943)   /* 'CI' */
-#define TYPE_PTR_COLOR  (0x5043)   /* 'CP' */
-#define TYPE_ARRAY      (0x4142)   /* 'BA' */
-   
-/*
- * Compression schemes.  Note that BITFIELDS (from NT) uses the same number as
- * HUFFMAN1D (from OS/2)
- */
-#define COMPRESSION_NONE       (0)
-#define COMPRESSION_RLE_8      (1)
-#define COMPRESSION_RLE_4      (2)
-#define COMPRESSION_HUFFMAN1D  (3)
-#define COMPRESSION_BITFIELDS  (3)
-#define COMPRESSION_RLE_24     (4)
-#define COMPRESSION_LAST       (4)
-   
-/*
- * units of resolution
- */
-#define UNITS_PELS_PER_METER (0)
-#define UNITS_LAST           (0)
-
-/*
- * origin of coordinate space
- */   
-#define ORIGIN_LOWER_LEFT  (0)
-#define ORIGIN_LAST        (0)
-
-/*
- * halftoning algorithms
- */   
-#define HALFTONING_NONE             (0)
-#define HALFTONING_ERROR_DIFFUSION  (1)
-#define HALFTONING_PANDA            (2)
-#define HALFTONING_SUPER_CIRCLE     (3)
-#define HALFTONING_LAST             (3)
-   
-/*
- * color table encoding
- */
-#define COLOR_ENCODING_RGB   (0)
-#define COLOR_ENCODING_LAST  (0)
-
-/*****************************************************************************
-*
-* Structures.
-*/
-   
-/*
- * Bitmapfileheader defines a single bitmap image.  Its analogue in the
- * Windows SDK is the Bitmapfileheader.  Its analogues in the OS/2 Toolkit are
- * the Bitmapfileheader and Bitmapfileheader2 structures.
- *
- * A BITMAPHEADER structure is always concatenated to the end of a
- * Bitmapfileheader structure.
- */
-typedef struct Bitmapfileheader
-{
-    CGAL_UINT16    type;
-    CGAL_UINT32    size;
-    CGAL_INT16     xHotspot;
-    CGAL_INT16     yHotspot;
-    CGAL_UINT32    offsetToBits;
-} Bitmapfileheader;
-
-
-/*
- * BITMAPARRAYHEADER is used to establish a linked list of Bitmapfileheader
- * structures for a bitmap file with multiple images in it.  There is no
- * equivalent structure in the Windows SDK.  Its analogues in the OS/2 toolkit
- * are the BITMAPARRAYFILEHEADER and BITMAPARRAYFILEHEADER2 strucutres.
- *
- * A Bitmapfileheader structure is always concatenated to the end of a
- * BITMAPARRAYHEADER structure.
- */
-typedef struct BITMAPARRAYHEADER
-{
-    CGAL_UINT16    type;
-    CGAL_UINT32    size;
-    CGAL_UINT32    next;
-    CGAL_UINT16    screenWidth;
-    CGAL_UINT16    screenHeight;
-} BITMAPARRAYHEADER;
-   
-
-/*
- * BITMAPHEADER defines the properties of a bitmap.  Its analogues in the
- * Windows SDK are the BITMAPCOREINFOHEADER and BITMAPINFOHEADER structures.
- * Its analogues in the OS/2 Toolkit are the BITMAPINFOHEADER and
- * BITMAPINFOHEADER2 structures.
- *
- * A color table is concatenated to this structure.  The number of elements in
- * the color table determined by the bit-depth of the image.
- *
- * Note, that if the field "size" is 12 or less, then the width and height
- * fields should be read as CGAL_UINT16's instead of CGAL_UINT32's.
- *
- * Also note that if the field "size" is greater than 12, then the color table
- * will have an extra byte of padding between each structures (to longword
- * align it)
- *
- * The different sizes for the width, height, and color table are the only
- * differences between the "old" and "new" bitmap file formats.
- */
-typedef struct BITMAPHEADER
-{
-    CGAL_UINT32 size;
-    CGAL_INT32  width;
-    CGAL_INT32  height;
-    CGAL_UINT16 numBitPlanes;
-    CGAL_UINT16 numBitsPerPlane;
-    CGAL_UINT32 compressionScheme;
-    CGAL_UINT32 sizeOfImageData;
-    CGAL_UINT32 xResolution;
-    CGAL_UINT32 yResolution;
-    CGAL_UINT32 numColorsUsed;
-    CGAL_UINT32 numImportantColors;
-    CGAL_UINT16 resolutionUnits;
-    CGAL_UINT16 padding;
-    CGAL_UINT16 origin;
-    CGAL_UINT16 halftoning;
-    CGAL_UINT32 halftoningParam1;
-    CGAL_UINT32 halftoningParam2;
-    CGAL_UINT32 colorEncoding;
-    CGAL_UINT32 identifier;
-} BITMAPHEADER;
-
-
-/*
- * RGB defines a single color palette entry.  Its analogues in the Windows SDK
- * are the RGBTRIPLE and RGBQUAD structures.  Its analogues in the OS/2
- * Toolkit are the RGB and RGB2 structure. 
- */
-typedef struct RGB
-{
-    CGAL_UINT8 blue;
-    CGAL_UINT8 green;
-    CGAL_UINT8 red;
-} RGB;
-
-#endif   /* __BMPTYPES_H_INCLUDED__ */
-
-/*
- * Formatting information for emacs in c-mode
- *
- * Local Variables:
- * c-indent-level:4
- * c-continued-statement-offset:4
- * c-brace-offset:-4
- * c-brace-imaginary-offset:0
- * c-argdecl-indent:4
- * c-label-offset:-4
- * End:
- */
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/convert.cpp b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/convert.cpp
deleted file mode 100644
index 52e8792..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/convert.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-#ifndef CGAL_HEADER_ONLY
-
-#include "convert.h"
-#include "convert_impl.h"
-
-#endif // CGAL_HEADER_ONLY
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/convert.h b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/convert.h
deleted file mode 100644
index 3f163f7..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/convert.h
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-/*************************************************************************
- * convert.h - conversion between types
- *
- * $Id$
- *
- * Copyright©INRIA 1998
- *
- * AUTHOR:
- * Gregoire Malandain (greg at sophia.inria.fr)
- * http://www.inria.fr/epidaure/personnel/malandain/
- * 
- * CREATION DATE: 
- * June, 9 1998
- *
- * ADDITIONS, CHANGES
- *
- */
-
-#ifndef _convert_h_
-#define _convert_h_
-
-
-
-
-
-
-
-#include <stdio.h> /* memcpy */
-#include <string.h> /* memcpy */
-#include "typedefs.h"
-
-
-
-
-
-
-/* Converts buffers from one type into another.
- *
- * DESCRIPTION:
- *
- * Conversions from types DOUBLE or FLOAT to 
- * others types are all implemented. I hope
- * I do not make mistakes.
- *
- * - When a real value is converted into an integer
- *   one, we take the nearest integer, i.e.
- *   (int)(real value - 0.5) for negative
- *   numbers, and (int)(real value + 0.5) for 
- *   positive ones.
- *
- * - Some conversions are not yet implemented.
- *
- * - When types and pointers are equal, nothing is
- *   done.
- */
-extern void ConvertBuffer( void *bufferIn, /* buffer to be converted */
-			   bufferType typeIn, /* type of this buffer */
-			   void *bufferOut, /* result buffer */
-			   bufferType typeOut, /* type of this buffer */
-			   int bufferLength /* buffers' length */
-			   );
-
-extern void Convert_r32_to_s8( r32 *theBuf,
-			       s8 *resBuf,
-			       int size );
-
-extern void Convert_r32_to_u8( r32 *theBuf,
-			       u8 *resBuf,
-			       int size );
-
-extern void Convert_r32_to_s16( r32 *theBuf,
-				s16 *resBuf,
-				int size );
-
-extern void Convert_r32_to_u16( r32 *theBuf,
-				u16 *resBuf,
-				int size );
-
-
-
-
-
-#ifdef CGAL_HEADER_ONLY
-#include "convert_impl.h"
-#endif // CGAL_HEADER_ONLY
-
-#endif
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/convert_impl.h b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/convert_impl.h
deleted file mode 100644
index b078823..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/convert_impl.h
+++ /dev/null
@@ -1,490 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-/*************************************************************************
- * convert.c - conversion between types
- *
- * $Id$
- *
- * Copyright©INRIA 1999
- *
- * AUTHOR:
- * Gregoire Malandain (greg at sophia.inria.fr)
- * 
- * CREATION DATE: 
- * June, 9 1998
- *
- * ADDITIONS, CHANGES
- *
- * - Tue Feb 22 11:25:39 MET 2000 (G. Malandain)
- *   add in ConvertBuffer():
- *       USHORT to UCHAR
- *       USHORT to SHORT
- *
- */
-
-#ifdef CGAL_HEADER_ONLY
-#define CGAL_INLINE_FUNCTION inline
-#else
-#define CGAL_INLINE_FUNCTION
-#endif
-
-CGAL_INLINE_FUNCTION
-void ConvertBuffer( void *bufferIn,
-		    bufferType typeIn,
-		    void *bufferOut,
-		    bufferType typeOut,
-		    int bufferLength )
-{
-  const char *proc = "ConvertBuffer";
-  int i, min, max;
-  u8 *u8buf;
-  s8 *s8buf;
-  u16 *u16buf;
-  s16 *s16buf;
-  s32 *s32buf;
-  r32 *r32buf;
-  r64 *r64buf;
-
-  if ( (typeOut == typeIn) && (bufferOut == bufferIn) )
-    return;
-
-  if ( bufferLength <= 0 ) {
-    fprintf( stderr, " Fatal error in %s: buffer length is negative or zero.\n", 
-	     proc );
-    return;
-  }
-  if ( (bufferIn == (void*)NULL) || (bufferOut == (void*)NULL) ) {
-    fprintf( stderr, " Fatal error in %s: NULL buffer(s).\n", 
-	     proc );
-    return;
-  }
-  
-  switch ( typeOut ) {
-  case CGAL_SCHAR :
-    s8buf = (s8*)bufferOut;
-    min = -128; max = 127;
-    switch( typeIn ) {
-    case CGAL_SCHAR :
-      if ( bufferOut == bufferIn ) return;
-      (void)memcpy( bufferOut, bufferIn, bufferLength * sizeof(s8) );
-      break;
-    case CGAL_FLOAT :
-      r32buf = (r32*)bufferIn;
-      for (i=bufferLength; i>0; i--, s8buf++, r32buf++ ) {
-	if ( *r32buf < min ) *s8buf = min;
-	else if ( *r32buf < 0.0 ) *s8buf = (int)(*r32buf - 0.5);
-	else if ( *r32buf < max ) *s8buf = (int)(*r32buf + 0.5);
-	else *s8buf = max;
-      }
-      break;
-    case CGAL_DOUBLE :
-      r64buf = (r64*)bufferIn;
-      for (i=bufferLength; i>0; i--, s8buf++, r64buf++ ) {
-	if ( *r64buf < min ) *s8buf = min;
-	else if ( *r64buf < 0.0 ) *s8buf = (int)(*r64buf - 0.5);
-	else if ( *r64buf < max ) *s8buf = (int)(*r64buf + 0.5);
-	else *s8buf = max;
-      }
-      break;
-    default :
-      fprintf( stderr, " Error in %s: such conversion not yet implemented.\n", 
-	       proc );
-      return;
-    }
-    break; /* end case typeOut = CGAL_SCHAR */
-
-
-
-
-    
-  case CGAL_UCHAR :
-    u8buf = (u8*)bufferOut;
-    min = 0; max = 255;
-    switch( typeIn ) {
-    case CGAL_UCHAR :
-      if ( bufferOut == bufferIn ) return;
-      (void)memcpy( bufferOut, bufferIn, bufferLength * sizeof(u8) );
-      break;
-    case CGAL_USHORT :
-      u16buf = (u16*)bufferIn;
-      for (i=bufferLength; i>0; i--, u8buf++, u16buf++ ) {
-	if ( *u16buf < max ) *u8buf = (u8)*u16buf;
-	else *u8buf = max;
-      }
-      break;
-    case CGAL_FLOAT :
-      r32buf = (r32*)bufferIn;
-      for (i=bufferLength; i>0; i--, u8buf++, r32buf++ ) {
-	if ( *r32buf < min ) *u8buf = min;
-	else if ( *r32buf < max ) *u8buf = (int)(*r32buf + 0.5);
-	else *u8buf = max;
-      }
-      break;
-    case CGAL_DOUBLE :
-      r64buf = (r64*)bufferIn;
-      for (i=bufferLength; i>0; i--, u8buf++, r64buf++ ) {
-	if ( *r64buf < min ) *u8buf = min;
-	else if ( *r64buf < max ) *u8buf = (int)(*r64buf + 0.5);
-	else *u8buf = max;
-      }
-      break;
-    default :
-      fprintf( stderr, " Error in %s: such conversion not yet implemented.\n", 
-	       proc );
-      return;
-    }
-    break; /* end case typeOut = CGAL_UCHAR */
-
-
-
-
-
-    
-  case CGAL_SSHORT :
-    s16buf = (s16*)bufferOut;
-    min = -32768; max = 32767;
-    switch( typeIn ) {
-    case CGAL_SSHORT :
-      if ( bufferOut == bufferIn ) return;
-      (void)memcpy( bufferOut, bufferIn, bufferLength * sizeof(s16) );
-      break;
-    case CGAL_USHORT :
-      u16buf = (u16*)bufferIn;
-      for (i=bufferLength; i>0; i--, s16buf++, u16buf++ ) {
-	if ( *u16buf < max ) *s16buf = (s16)*u16buf;
-	else *s16buf = max;
-      }
-      break;
-    case CGAL_FLOAT :
-      r32buf = (r32*)bufferIn;
-      for (i=bufferLength; i>0; i--, s16buf++, r32buf++ ) {
-	if ( *r32buf < min ) *s16buf = min;
-	else if ( *r32buf < 0.0 ) *s16buf = (int)(*r32buf - 0.5);
-	else if ( *r32buf < max ) *s16buf = (int)(*r32buf + 0.5);
-	else *s16buf = max;
-      }
-      break;
-    case CGAL_DOUBLE :
-      r64buf = (r64*)bufferIn;
-      for (i=bufferLength; i>0; i--, s16buf++, r64buf++ ) {
-	if ( *r64buf < min ) *s16buf = min;
-	else if ( *r64buf < 0.0 ) *s16buf = (int)(*r64buf - 0.5);
-	else if ( *r64buf < max ) *s16buf = (int)(*r64buf + 0.5);
-	else *s16buf = max;
-      }
-      break;
-    default :
-      fprintf( stderr, " Error in %s: such conversion not yet implemented.\n",
-	       proc );
-      return;
-    }
-    break; /* end case typeOut = CGAL_SSHORT */
-
-
-
-
-    
-  case CGAL_USHORT :
-    u16buf = (u16*)bufferOut;
-    min = 0; max = 65535;
-    switch( typeIn ) {
-    case CGAL_USHORT :
-      if ( bufferOut == bufferIn ) return;
-      (void)memcpy( bufferOut, bufferIn, bufferLength * sizeof(u16) );
-      break;
-    case CGAL_FLOAT :
-      r32buf = (r32*)bufferIn;
-      for (i=bufferLength; i>0; i--, u16buf++, r32buf++ ) {
-	if ( *r32buf < min ) *u16buf = min;
-	else if ( *r32buf < 0.0 ) *u16buf = (int)(*r32buf - 0.5);
-	else if ( *r32buf < max ) *u16buf = (int)(*r32buf + 0.5);
-	else *u16buf = max;
-      }
-      break;
-    case CGAL_DOUBLE :
-      r64buf = (r64*)bufferIn;
-      for (i=bufferLength; i>0; i--, u16buf++, r64buf++ ) {
-	if ( *r64buf < min ) *u16buf = min;
-	else if ( *r64buf < 0.0 ) *u16buf = (int)(*r64buf - 0.5);
-	else if ( *r64buf < max ) *u16buf = (int)(*r64buf + 0.5);
-	else *u16buf = max;
-      }
-      break;
-    default :
-      fprintf( stderr, " Error in %s: such conversion not yet implemented.\n",
-	       proc );
-      return;
-    }
-    break; /* end case typeOut = CGAL_USHORT */
-
-
-
-
-
-    
-  case CGAL_INT :
-    s32buf = (s32*)bufferOut;
-    switch( typeIn ) {
-    case CGAL_INT :
-      if ( bufferOut == bufferIn ) return;
-      (void)memcpy( bufferOut, bufferIn, bufferLength * sizeof(s32) );
-      break;
-    case CGAL_FLOAT :
-      r32buf = (r32*)bufferIn;
-      for (i=bufferLength; i>0; i--, s32buf++, r32buf++ ) {
-	*s32buf = (int)(*r32buf);
-      }
-      break;
-    case CGAL_DOUBLE :
-      r64buf = (r64*)bufferIn;
-      for (i=bufferLength; i>0; i--, s32buf++, r64buf++ ) {
-	*s32buf = (int)(*r64buf);
-      }
-      break;
-    default :
-      fprintf( stderr, " Error in %s: such conversion not yet implemented.\n",
-	       proc );
-      return;
-    }
-    break; /* end case typeOut = CGAL_INT */
-
-
-
-
-
-    
-  case CGAL_FLOAT :
-    r32buf = (r32*)bufferOut;
-    switch( typeIn ) {
-    case CGAL_UCHAR :
-      u8buf = (u8*)bufferIn;
-      for (i=bufferLength; i>0; i--, r32buf++, u8buf++ ) {
-	*r32buf = (float)(*u8buf);
-      }
-      break;
-    case CGAL_SCHAR :
-      s8buf = (s8*)bufferIn;
-      for (i=bufferLength; i>0; i--, r32buf++, s8buf++ ) {
-	*r32buf = (float)(*s8buf);
-      }
-      break;
-    case CGAL_USHORT :
-      u16buf = (u16*)bufferIn;
-      for (i=bufferLength; i>0; i--, r32buf++, u16buf++ ) {
-	*r32buf = (float)(*u16buf);
-      }
-      break;
-    case CGAL_SSHORT :
-      s16buf = (s16*)bufferIn;
-      for (i=bufferLength; i>0; i--, r32buf++, s16buf++ ) {
-	*r32buf = (float)(*s16buf);
-      }
-      break;
-    case CGAL_INT :
-      s32buf = (s32*)bufferIn;
-      for (i=bufferLength; i>0; i--, r32buf++, s32buf++ ) {
-	*r32buf = (float)(*s32buf);
-      }
-      break;
-    case CGAL_FLOAT :
-      if ( bufferOut == bufferIn ) return;
-      (void)memcpy( bufferOut, bufferIn, bufferLength * sizeof(r32) );
-      break;
-    case CGAL_DOUBLE :
-      r64buf = (r64*)bufferIn;
-      for (i=bufferLength; i>0; i--, r32buf++, r64buf++ ) {
-	*r32buf = (float)(*r64buf);
-      }
-      break;
-    default :
-      fprintf( stderr, " Error in %s: such conversion not yet implemented.\n",
-	       proc );
-      return;
-    }
-    break; /* end case typeOut = CGAL_FLOAT */
-
-
-
-
-    
-  case CGAL_DOUBLE :
-    r64buf = (r64*)bufferOut;
-    switch( typeIn ) {
-    case CGAL_UCHAR :
-      u8buf = (u8*)bufferIn;
-      for (i=bufferLength; i>0; i--, r64buf++, u8buf++ ) {
-	*r64buf = (double)(*u8buf);
-      }
-      break;
-    case CGAL_SCHAR :
-      s8buf = (s8*)bufferIn;
-      for (i=bufferLength; i>0; i--, r64buf++, s8buf++ ) {
-	*r64buf = (double)(*s8buf);
-      }
-      break;
-    case CGAL_USHORT :
-      u16buf = (u16*)bufferIn;
-      for (i=bufferLength; i>0; i--, r64buf++, u16buf++ ) {
-	*r64buf = (double)(*u16buf);
-      }
-      break;
-    case CGAL_SSHORT :
-      s16buf = (s16*)bufferIn;
-      for (i=bufferLength; i>0; i--, r64buf++, s16buf++ ) {
-	*r64buf = (double)(*s16buf);
-      }
-      break;
-    case CGAL_INT :
-      s32buf = (s32*)bufferIn;
-      for (i=bufferLength; i>0; i--, r64buf++, s32buf++ ) {
-	*r64buf = (double)(*s32buf);
-      }
-      break;
-    case CGAL_FLOAT :
-      r32buf = (r32*)bufferIn;
-      for (i=bufferLength; i>0; i--, r32buf++, r64buf++ ) {
-	*r64buf = (double)(*r32buf);
-      }
-      break;
-    case CGAL_DOUBLE :
-      if ( bufferOut == bufferIn ) return;
-      (void)memcpy( bufferOut, bufferIn, bufferLength * sizeof(r64) );
-      break;
-    default :
-      fprintf( stderr, " Error in %s: such conversion not yet implemented.\n", 
-	       proc );
-      return;
-    }
-    break; /* end case typeOut = CGAL_DOUBLE */
-
-
-
-   
-  default :
-    fprintf( stderr, " Error in %s: such output type not yet handled.\n",
-	     proc );
-    return;
-  }
-}
-
-
-
-
-
-CGAL_INLINE_FUNCTION
-void Convert_r32_to_s8( r32 *theBuf,
-			s8 *resBuf,
-			int size )
-{
-  int i;
-  r32* tb = theBuf;
-  s8* rb = resBuf;
-  
-  for ( i=0; i<size; i++, tb++, rb++ ) {
-    if ( *tb < -128.0 ) {
-      *rb = -128;
-    } else if ( *tb < 0.0 ) {
-      *rb = (int)(*tb - 0.5);
-    } else if ( *tb < 127.0 ) {
-      *rb = (int)(*tb + 0.5);
-    } else {
-      *rb = 127;
-    }
-  }
-}
-
-
-
-
-
-CGAL_INLINE_FUNCTION
-void Convert_r32_to_u8( r32 *theBuf,
-			u8 *resBuf,
-			int size )
-{
-  int i;
-  r32* tb = theBuf;
-  u8* rb = resBuf;
-  
-  for ( i=0; i<size; i++, tb++, rb++ ) {
-    if ( *tb < 0.0 ) {
-      *rb = 0;
-    } else if ( *tb < 255.0 ) {
-      *rb = (int)(*tb + 0.5);
-    } else {
-      *rb = 255;
-    }
-  }
-}
-
-
-
-
-
-CGAL_INLINE_FUNCTION
-void Convert_r32_to_s16( r32 *theBuf,
-			 s16 *resBuf,
-			 int size )
-{
-  int i;
-  r32* tb = theBuf;
-  s16* rb = resBuf;
-  
-  for ( i=0; i<size; i++, tb++, rb++ ) {
-    if ( *tb < -32768.0 ) {
-      *rb = -32768;
-    } else if ( *tb < 0.0 ) {
-      *rb = (int)(*tb - 0.5);
-    } else if ( *tb < 32767.0 ) {
-      *rb = (int)(*tb + 0.5);
-    } else {
-      *rb = 32767;
-    }
-  }
-}
-
-
-
-
-
-CGAL_INLINE_FUNCTION
-void Convert_r32_to_u16( r32 *theBuf,
-			 u16 *resBuf,
-			 int size )
-{
-  int i;
-  r32* tb = theBuf;
-  u16* rb = resBuf;
-  
-  for ( i=0; i<size; i++, tb++, rb++ ) {
-    if ( *tb < 0.0 ) {
-      *rb = 0;
-    } else if ( *tb < 65535.0 ) {
-      *rb = (int)(*tb + 0.5);
-    } else {
-      *rb = 65535;
-    }
-  }
-}
-
-
-      
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/fgetns.cpp b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/fgetns.cpp
deleted file mode 100644
index f5c95d1..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/fgetns.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-#ifndef CGAL_HEADER_ONLY
-
-#include "fgetns.h"
-#include "fgetns_impl.h"
-
-#endif // CGAL_HEADER_ONLY
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/fgetns.h b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/fgetns.h
deleted file mode 100644
index 73f2f58..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/fgetns.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-#ifndef FGETNS_H
-#define FGETNS_H
-
-#include <CGAL/ImageIO.h>
-
-/* get a string from a file and discard the ending newline character
-   if any */
-char *fgetns(char *str, int n,  _image *im );
-
-#ifdef CGAL_HEADER_ONLY
-#include "fgetns_impl.h"
-#endif // CGAL_HEADER_ONLY
-
-#endif // FGETNS_H
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/fgetns_impl.h b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/fgetns_impl.h
deleted file mode 100644
index c1ded43..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/fgetns_impl.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-#ifdef CGAL_HEADER_ONLY
-#define CGAL_INLINE_FUNCTION inline
-#else
-#define CGAL_INLINE_FUNCTION
-#endif
-
-#include <string.h>
-
-/* get a string from a file and discard the ending newline character
-   if any */
-CGAL_INLINE_FUNCTION
-char *fgetns(char *str, int n,  _image *im ) {
-  char *ret;
-  int l;
-
-  memset( str, 0, n );
-  ret = ImageIO_gets( im, str, n );
-
-  if(!ret) return NULL;
-
-  l = strlen(str);
-  if(l > 0 && str[l-1] == '\n') str[l-1] = '\0';
-  return ret;
-}
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/gif.cpp b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/gif.cpp
deleted file mode 100644
index c1735c6..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/gif.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-#ifndef CGAL_HEADER_ONLY
-
-#include "gif.h"
-#include "gif_impl.h"
-
-#endif // CGAL_HEADER_ONLY
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/gif.h b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/gif.h
deleted file mode 100644
index 467f918..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/gif.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-#ifndef GIF_H
-#define GIF_H
-
-
-#include <stdio.h>
-#include <CGAL/ImageIO.h>
-int readGifImage(const char *name,_image *im);
-
-int testGifHeader(char *magic,const char *name);
-/** creates an return the file format structure associated with the Gif file format */
-PTRIMAGE_FORMAT createGifFormat();
-
-#ifdef CGAL_HEADER_ONLY
-#include "gif_impl.h"
-#endif // CGAL_HEADER_ONLY
-
-#endif
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/gif_impl.h b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/gif_impl.h
deleted file mode 100644
index ed9ac0b..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/gif_impl.h
+++ /dev/null
@@ -1,700 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-#ifdef CGAL_HEADER_ONLY
-#define CGAL_INLINE_FUNCTION inline
-#else
-#define CGAL_INLINE_FUNCTION
-#endif
-
-#include <string.h>
-
-#ifdef WIN32
-#include <io.h>
-#endif
-
-#ifdef CGAL_HEADER_ONLY
-  
-  #define CGAL_GLOBAL_STATE_VAR(TYPE, NAME, VALUE)  \
-    inline TYPE & get_static_##NAME()               \
-    {                                               \
-      static TYPE NAME = VALUE;                     \
-      return NAME;                                  \
-    }
-  
-#else // CGAL_HEADER_ONLY
-
-  #define CGAL_GLOBAL_STATE_VAR(TYPE, NAME, VALUE)  \
-    TYPE NAME;                                      \
-    inline TYPE& get_static_##NAME()                \
-    {                                               \
-      return NAME;                                  \
-    }
-
-#endif // CGAL_HEADER_ONLY
-
-
-/** Magic header for GIF files */
-#define GIF_MAGIC "GIF8"
-
-
-
-typedef unsigned char byte;
-#define TRUE 1
-#define FALSE 0
-
-#define NEXTBYTE      (*ptr++)
-#define EXTENSION     0x21
-#define IMAGESEP      0x2c
-#define TRAILER       0x3b
-#define INTERLACEMASK 0x40
-#define COLORMAPMASK  0x80
-
-
-#define DEBUG 0
-
-//FILE *fp;
-//int   gif89 = 0;
-static const char *id87 = "GIF87a";
-static const char *id89 = "GIF89a";
-
-static int EGApalette[16][3] = {
-  {0,0,0},       {0,0,128},     {0,128,0},     {0,128,128}, 
-  {128,0,0},     {128,0,128},   {128,128,0},   {200,200,200},
-  {100,100,100}, {100,100,255}, {100,255,100}, {100,255,255},
-  {255,100,100}, {255,100,255}, {255,255,100}, {255,255,255} };
-  
-
-static int  ReadCode();
-static void DoInterlace(byte);
-static int GifError(const char *);
-
-CGAL_GLOBAL_STATE_VAR(byte *, Raster, NULL) /* The raster data stream, unblocked */
-CGAL_GLOBAL_STATE_VAR(byte *, RawGIF, NULL)
-CGAL_GLOBAL_STATE_VAR(byte *, r, NULL)
-CGAL_GLOBAL_STATE_VAR(byte *, g, NULL)
-CGAL_GLOBAL_STATE_VAR(byte *, b, NULL)     /* The colormap */
-CGAL_GLOBAL_STATE_VAR(int, BitOffset, 0)    /* Bit Offset of next code */
-CGAL_GLOBAL_STATE_VAR(int, XC, 0)
-CGAL_GLOBAL_STATE_VAR(int, YC, 0)	    /* Output X and Y coords of current pixel */
-CGAL_GLOBAL_STATE_VAR(int, CodeSize, 0)	    /* Code size, read from GIF header */
-CGAL_GLOBAL_STATE_VAR(int, ReadMask, 0)     /* Code AND mask for current code size */
-CGAL_GLOBAL_STATE_VAR(int, Pass, 0)	    /* Used by output routine if interlaced pic */
-CGAL_GLOBAL_STATE_VAR(int, Width, 0)
-CGAL_GLOBAL_STATE_VAR(int, Height, 0)       /* image dimensions */
-CGAL_GLOBAL_STATE_VAR(unsigned char *, org, NULL)
-CGAL_GLOBAL_STATE_VAR(unsigned char *, buf, NULL)
-
-CGAL_INLINE_FUNCTION
-int testGifHeader(char *magic,const char *) {
-  if (!strcmp(magic, GIF_MAGIC))
-    return 0;
-  else 
-    return -1;
-}
-CGAL_INLINE_FUNCTION
-PTRIMAGE_FORMAT createGifFormat() {
-  PTRIMAGE_FORMAT f=(PTRIMAGE_FORMAT) ImageIO_alloc(sizeof(IMAGE_FORMAT));
-
-  f->testImageFormat=&testGifHeader;
-  f->readImageHeader=&readGifImage;
-  f->writeImage=0;
-  strcpy(f->fileExtension,".gif");
-  strcpy(f->realName,"Gif");
-  return f;
-}
-
-CGAL_INLINE_FUNCTION
-void use(int) {} // warning killer
-
-/*****************************/
-CGAL_INLINE_FUNCTION
-int readGifImage(const char *name,_image *im) {
-FILE *fp;
-int   gif89 = 0;
-
-  byte ch, ch1;
-  byte *ptr, *ptr1;
-  int i, block;
-  int npixels, maxpixels, aspect, filesize;
-  float normaspect;
-  int OutCount = 0,		/* Decompressor output 'stack count' */
-    RWidth, RHeight,		/* screen dimensions */
-    /*LeftOfs, TopOfs,		 image offset */
-    BitsPerPixel,		/* Bits per pixel, read from GIF header */
-    ColorMapSize,		/* number of colors */
-    Background,		         /* background color */
-    InitCodeSize,		/* Starting code size, used during Clear */
-    Code,			/* Value returned by ReadCode */
-    MaxCode,			/* limiting value for current code size */
-    ClearCode,			/* GIF clear code */
-    EOFCode,			/* GIF end-of-information code */
-    CurCode, OldCode=0, InCode,	/* Decompressor variables */
-    FirstFree,			/* First free code, generated per GIF spec */
-    FreeCode,			/* Decompressor,next free slot in hash table */
-    FinChar=0,			/* Decompressor variable */
-    BitMask,			/* AND mask for data size */
-    Misc;                       /* miscellaneous bits (interlace, local cmap)*/
-  int Interlace, HasColormap;
-  /* not used
-   */
-  /* char header[10]; */
-
-  /* The hash table used by the decompressor */
-  int Prefix[4096];
-  int Suffix[4096];
-  /* An output array used by the decompressor */
-  int OutCode[4097];
-
-  /* initialize variables */
-  get_static_BitOffset() =
-    get_static_XC() =
-    get_static_YC() =
-    get_static_Pass() =
-    OutCount =
-    npixels =
-    maxpixels = 0;
-  get_static_RawGIF() = get_static_Raster() = NULL;
-  gif89 = 0;
-
-#ifdef WIN32
- fp = fopen(name,"rb");
-#else
-  fp = fopen(name,"r");
-#endif
-  fp = fopen(name,"rb");
-  if (!fp) {
-    return(GifError("could not open a GIF file"));
-  }
-  /* find the size of the file */
-  fseek(fp, 0L, 2);
-  filesize = ftell(fp);
-  fseek(fp, 0L, 0);
-
- /* the +256's are so we can read truncated GIF files without fear of 
-     segmentation violation */
-  if (!(ptr = get_static_RawGIF() = (byte *) ImageIO_alloc(filesize+256)))
-    return( GifError("not enough memory to read gif file") );
-  
-  if (!(get_static_Raster() = (byte *) ImageIO_alloc(filesize+256)))    
-    return( GifError("not enough memory to read gif file") );
-  
-  if (fread(ptr, filesize, 1, fp) != 1)
-    return( GifError("GIF data read failed") );
-   if      (strncmp((char *) ptr, id87, 6)==0) gif89 = 0;
-  else if (strncmp((char *) ptr, id89, 6)==0) gif89 = 1;
-  else    return( GifError("not a GIF file"));
-  
-  ptr += 6;
- /* Get variables from the GIF screen descriptor */
-  
-  ch = NEXTBYTE;
-  RWidth = ch + 0x100 * NEXTBYTE;	/* screen dimensions... not used. */
-  ch = NEXTBYTE;
-  RHeight = ch + 0x100 * NEXTBYTE;
-  use(RWidth);
-  use(RHeight);
-  
-  ch = NEXTBYTE;
-  HasColormap = ((ch & COLORMAPMASK) ? TRUE : FALSE);
-  
-  BitsPerPixel = (ch & 7) + 1;
-  ColorMapSize = 1 << BitsPerPixel;
-  BitMask = ColorMapSize - 1;
-  
-  Background = NEXTBYTE;		/* background color... not used. */
-  use(Background);
-
-
-  aspect = NEXTBYTE;
-  if (aspect) {
-    if (!gif89) return(GifError("corrupt GIF file (screen descriptor)"));
-    else normaspect = (float) (aspect + 15) / 64.0f;   /* gif89 aspect ratio */
-    if (DEBUG) fprintf(stderr,"GIF89 aspect = %f\n", normaspect);
-  }
-
-
-  /* Read in global colormap. */
-  if (HasColormap)
-    {
-      get_static_r() = (byte *) ImageIO_alloc(ColorMapSize * sizeof(byte));
-      get_static_g() = (byte *) ImageIO_alloc(ColorMapSize * sizeof(byte));
-      get_static_b() = (byte *) ImageIO_alloc(ColorMapSize * sizeof(byte));
-
-      for (i = 0; i < ColorMapSize; i++) {
-	get_static_r()[i] = NEXTBYTE;
-	get_static_g()[i] = NEXTBYTE;
-        get_static_b()[i] = NEXTBYTE;
-      }
-    }
-  else {
-    /* no colormap in GIF file */
-    /* put std EGA palette (repeated 16 times) into colormap, for lack of
-       anything better to do */
-    ColorMapSize = 256;
-    get_static_r() = (byte *) ImageIO_alloc(256 * sizeof(byte));
-    get_static_g() = (byte *) ImageIO_alloc(256 * sizeof(byte));
-    get_static_b() = (byte *) ImageIO_alloc(256 * sizeof(byte));
-   
-    for (i = 0; i < 256; i++) {
-      get_static_r()[i] = EGApalette[i&15][0];
-      get_static_g()[i] = EGApalette[i&15][1];
-      get_static_b()[i] = EGApalette[i&15][2];
-    }
-  }
-
-  /* possible things at this point are:
-   *   an application extension block
-   *   a comment extension block
-   *   an (optional) graphic control extension block
-   *       followed by either an image
-   *	   or a plaintext extension
-   */
-  while (1) {
-    block = NEXTBYTE;
-   
-    if (block == EXTENSION) {  /* parse extension blocks */
-      int i, fn, blocksize, aspnum, aspden;
-	  
-      /* read extension block */
-      fn = NEXTBYTE;
-	  
-      if (DEBUG) fprintf(stderr,"GIF extension type 0x%02x\n", fn);
-	  
-      if (fn == 'R') {                  /* GIF87 aspect extension */
-	blocksize = NEXTBYTE;
-	if (blocksize == 2) {
-	  aspnum = NEXTBYTE;
-	  aspden = NEXTBYTE;
-	  if (aspden>0 && aspnum>0) 
-	    normaspect = (float) aspnum / (float) aspden;
-	  else { normaspect = 1.0;  aspnum = aspden = 1; }
-			
-	  if (DEBUG) fprintf(stderr,"GIF87 aspect extension: %d:%d = %f\n\n", 
-			     aspnum, aspden,normaspect);
-	}
-	else {
-	  for (i=0; i<blocksize; i++) (void)NEXTBYTE;
-	}
-      }
-	  
-      else if (fn == 0xFE) {  /* Comment Extension.  just eat it */
-	int ch, j, sbsize;
-		 
-	if (DEBUG) fprintf(stderr,"Comment extension:  ");
-	/* read (and ignore) data sub-blocks */
-	do {
-	  j = 0;  sbsize = NEXTBYTE;
-	  while (j<sbsize) {
-	    ch = NEXTBYTE;  j++;
-	    if (DEBUG) fprintf(stderr,"%c", ch);
-	  }
-	} while (sbsize);
-	if (DEBUG) fprintf(stderr,"\n\n");
-      }
-	  
-      else if (fn == 0x01) {  /* PlainText Extension */
-	int j,sbsize,ch;
-	int tgLeft, tgTop, tgWidth, tgHeight, cWidth, cHeight, fg, bg;
-		 
-	/*	SetISTR(ISTR_WARNING, 
-		"PlainText extension found in GIF file.  Ignored.");*/
-		 
-	sbsize   = NEXTBYTE;
-	tgLeft   = NEXTBYTE;  tgLeft   += (NEXTBYTE)<<8;
-	tgTop    = NEXTBYTE;  tgTop    += (NEXTBYTE)<<8;
-	tgWidth  = NEXTBYTE;  tgWidth  += (NEXTBYTE)<<8;
-	tgHeight = NEXTBYTE;  tgHeight += (NEXTBYTE)<<8;
-	cWidth   = NEXTBYTE;
-	cHeight  = NEXTBYTE;
-	fg       = NEXTBYTE;
-	bg       = NEXTBYTE;
-	i=12;
-	for ( ; i<sbsize; i++) (void)NEXTBYTE;   /* read rest of first subblock */
-		 
-	if (DEBUG) fprintf(stderr,
-			   "PlainText: tgrid=%d,%d %dx%d  cell=%dx%d  col=%d,%d\n",
-			   tgLeft, tgTop, tgWidth, tgHeight, cWidth, cHeight,
-			   fg, bg);
-		 
-	/* read (and ignore) data sub-blocks */
-	do {
-	  j = 0;
-	  sbsize = NEXTBYTE;
-	  while (j<sbsize) {
-	    ch = NEXTBYTE;  j++;
-	    if (DEBUG) fprintf(stderr,"%c", ch);
-	  }
-	} while (sbsize);
-	if (DEBUG) fprintf(stderr,"\n\n");
-      }
-	  
-	  
-      else if (fn == 0xF9) {  /* Graphic Control Extension */
-	int j, sbsize;
-		 
-	if (DEBUG) fprintf(stderr,"Graphic Control extension\n\n");
-		 
-	/*	SetISTR(ISTR_WARNING, 
-		"Graphic Control Extension in GIF file.  Ignored.");*/
-		 
-	/* read (and ignore) data sub-blocks */
-	do {
-	  j = 0; sbsize = NEXTBYTE;
-	  while (j<sbsize) { (void)NEXTBYTE;  j++; }
-	} while (sbsize);
-      }
-      
-	  
-      else { /* unknown extension */
-	int j, sbsize;
-		 
-	if (DEBUG) fprintf(stderr,"unknown GIF extension 0x%02x\n\n", fn);
-		 
-	/*	SetISTR(ISTR_WARNING, 
-		"Unknown extension 0x%02x in GIF file.  Ignored.",fn);*/
-		 
-	/* read (and ignore) data sub-blocks */
-	do {
-	  j = 0; sbsize = NEXTBYTE;
-	  while (j<sbsize) { (void)NEXTBYTE;  j++; }
-	} while (sbsize);
-      }
-    }
-   
-    else if (block == IMAGESEP) break;   /* read an image */
-
-    else if (block == TRAILER) {
-      return( GifError("no image data found in GIF file") );
-    }
-   
-    else return (GifError("Unknown block type found in file."));
-  }
-
-
-  /* read in values from the image descriptor */
-  ch = NEXTBYTE;
-  /* LeftOfs = ch + 0x100 * NEXTBYTE;*/
-  ch = NEXTBYTE;
-  /* TopOfs = ch + 0x100 * NEXTBYTE; */
-  ch = NEXTBYTE;
-  ch = NEXTBYTE;
-  ch = NEXTBYTE;
-  get_static_Width() = ch + 0x100 * NEXTBYTE;
-  ch = NEXTBYTE;
-  get_static_Height() = ch + 0x100 * NEXTBYTE;
-
-  Misc = NEXTBYTE;
-  Interlace = ((Misc & INTERLACEMASK) ? TRUE : FALSE);
-
-  if (Misc & 0x80) {
-    for (i=0; i< 1 << ((Misc&7)+1); i++) {
-      get_static_r()[i] = NEXTBYTE;
-      get_static_g()[i] = NEXTBYTE;
-      get_static_b()[i] = NEXTBYTE;
-    }
-  }
-
-
-  if (!HasColormap && !(Misc&0x80)) {
-    /* no global or local colormap */
-    /*    SetISTR(ISTR_WARNING,
-	  "No colormap in this GIF file.  Assuming EGA colors.");*/
-  }
-
-
-
-  /* Start reading the raster data. First we get the intial code size
-   * and compute decompressor constant values, based on this code size.
-   */
-  
-  /*  SetISTR(ISTR_FORMAT, "GIF%s, %d bits per pixel, %sinterlaced.  (%d bytes)",
-      (gif89) ? "89" : "87", BitsPerPixel, 
-      Interlace ? "" : "non-", filesize);*/
-
-  get_static_CodeSize() = NEXTBYTE;
-
-  ClearCode = (1 << get_static_CodeSize());
-  EOFCode = ClearCode + 1;
-  FreeCode = FirstFree = ClearCode + 2;
-
-  /* The GIF spec has it that the code size is the code size used to
-   * compute the above values is the code size given in the file, but the
-   * code size used in compression/decompression is the code size given in
-   * the file plus one. (thus the ++).
-   */
-  get_static_CodeSize()++;
-  InitCodeSize = get_static_CodeSize();
-  MaxCode = (1 << get_static_CodeSize());
-  get_static_ReadMask() = MaxCode - 1;
-
-  /* UNBLOCK:
-   * Read the raster data.  Here we just transpose it from the GIF array
-   * to the Raster array, turning it from a series of blocks into one long
-   * data stream, which makes life much easier for ReadCode().
-   */
-  
-  ptr1 = get_static_Raster();
-  do {
-    ch = ch1 = NEXTBYTE;
-    while (ch--) { 
-		*ptr1 = NEXTBYTE; 
-		ptr1++; }
-    if ((ptr - get_static_RawGIF()) > filesize) {
-      /*      SetISTR(ISTR_WARNING,
-	      "This GIF file seems to be truncated.  Winging it.");*/
-      break;
-    }
-  } while(ch1);
-  ImageIO_free(get_static_RawGIF());  get_static_RawGIF() = NULL;
-
-
-  if (DEBUG) {
-    fprintf(stderr,"xv: LoadGIF() - picture is %dx%d, %d bits, %sinterlaced\n",
-	    get_static_Width(), get_static_Height(), BitsPerPixel, Interlace ? "" : "non-");
-  }
-  
-
-  /* Allocate the 'pic' */
-  maxpixels = get_static_Width()*get_static_Height();
-  im->xdim = get_static_Width();
-  im->ydim = get_static_Height();
-  im->zdim = 1;
-  im->vdim = 3;
-  im->wdim = 1;
-  im->wordKind = WK_FIXED;
-  im->sign = SGN_UNSIGNED;
-  im->data = ImageIO_alloc(get_static_Width() * get_static_Height() * 3);
-  get_static_org() = get_static_buf() = (unsigned char *) im->data;
-
-  if (!get_static_org())
-    return( GifError("not enough memory for image buffer") );
-
-
-  /* Decompress the file, continuing until you see the GIF EOF code.
-   * One obvious enhancement is to add checking for corrupt files here.
-   */
-  Code = ReadCode();
-  while (Code != EOFCode) {
-   /* Clear code sets everything back to its initial value, then reads the
-     * immediately subsequent code as uncompressed data.
-     */
-   
-	  if (Code == ClearCode) { 
-      get_static_CodeSize() = InitCodeSize;
-      MaxCode = (1 << get_static_CodeSize());
-      get_static_ReadMask() = MaxCode - 1;
-      FreeCode = FirstFree;
-      Code = ReadCode();
-      CurCode = OldCode = Code;
-      FinChar = CurCode & BitMask;
-      if (!Interlace) {
-	*get_static_buf()++ = get_static_r()[FinChar];
-	*get_static_buf()++ = get_static_g()[FinChar];
-	*get_static_buf()++ = get_static_b()[FinChar];
-      }
-      else DoInterlace((byte)FinChar);
-      npixels++;
-    }
-
-    else {
-      /* If not a clear code, must be data: save same as CurCode and InCode */
-	   
-      /* if we're at maxcode and didn't get a clear, stop loading */
-      if (FreeCode>=4096) { 
-		  printf("freecode blew up\n"); 
-	      break;
-	  }
-	   
-      CurCode = InCode = Code;
-	   
-      /* If greater or equal to FreeCode, not in the hash table yet;
-       * repeat the last character decoded
-       */
-	   
-      if (CurCode >= FreeCode) {
-	CurCode = OldCode;
-	if (OutCount > 4096) {   
-		printf("outcount1 blew up\n");  break; }
-	OutCode[OutCount++] = FinChar;
-      }
-	   
-      /* Unless this code is raw data, pursue the chain pointed to by CurCode
-       * through the hash table to its end; each code in the chain puts its
-       * associated output code on the output queue.
-       */
-	   
-      while (CurCode > BitMask) {
-		  if (OutCount > 4096) {
-			  fprintf(stderr,"outcount2 blew up\n"); break;}   /* corrupt file */
-	OutCode[OutCount++] = Suffix[CurCode];
-	CurCode = Prefix[CurCode];
-      }
-	   
-      if (OutCount > 4096) {  
-		  printf("outcount blew up\n");  break; }
-	   
-      /* The last code in the chain is treated as raw data. */
-	   
-      FinChar = CurCode & BitMask;
-      OutCode[OutCount++] = FinChar;
-	   
-      /* Now we put the data out to the Output routine.
-       * It's been stacked LIFO, so deal with it that way...
-       */
-
-      /* safety thing:  prevent exceeding range of 'pic' */
-      if (npixels + OutCount > maxpixels) OutCount = maxpixels-npixels;
-	   
-      npixels += OutCount;
-      if (!Interlace) for (i=OutCount-1; i>=0; i--) {
-          *get_static_buf()++ = get_static_r()[OutCode[i]];
-          *get_static_buf()++ = get_static_g()[OutCode[i]];
-          *get_static_buf()++ = get_static_b()[OutCode[i]];
-      }
-      else  for (i=OutCount-1; i>=0; i--) DoInterlace((byte)OutCode[i]);
-      OutCount = 0;
-	   
-      /* Build the hash table on-the-fly. No table is stored in the file. */
-      
-      Prefix[FreeCode] = OldCode;
-      Suffix[FreeCode] = FinChar;
-      OldCode = InCode;
-	   
-      /* Point to the next slot in the table.  If we exceed the current
-       * MaxCode value, increment the code size unless it's already 12.  If it
-       * is, do nothing: the next code decompressed better be CLEAR
-       */
-	   
-      FreeCode++;
-      if (FreeCode >= MaxCode) {
-	if (get_static_CodeSize() < 12) {
-	  get_static_CodeSize()++;
-	  MaxCode *= 2;
-	  get_static_ReadMask() = (1 << get_static_CodeSize()) - 1;
-	}
-      }
-    }
-    Code = ReadCode();
-    if (npixels >= maxpixels) break;
-  }
-  ImageIO_free(get_static_Raster());  get_static_Raster() = NULL;
-
-  if (npixels != maxpixels) {
-    /*    SetISTR(ISTR_WARNING,"This GIF file seems to be truncated.  Winging it.");*/
-    if (!Interlace)
-      memset(get_static_buf(), 0, 3*(maxpixels-npixels)); /* clear to EOBuffer */
-  }
-  /*  SetDirRButt(F_FORMAT, F_GIF);
-      SetDirRButt(F_COLORS, F_FULLCOLOR);*/
-  return 1;
-}
-
-
-/* Fetch the next code from the raster data stream.  The codes can be
- * any length from 3 to 12 bits, packed into 8-bit bytes, so we have to
- * maintain our location in the Raster array as a BIT Offset.  We compute
- * the byte Offset into the raster array by dividing this by 8, pick up
- * three bytes, compute the bit Offset into our 24-bit chunk, shift to
- * bring the desired code to the bottom, then mask it off and return it. 
- */
-
-CGAL_INLINE_FUNCTION
-static int ReadCode()
-{
-  int RawCode, ByteOffset;
-  
-  ByteOffset = get_static_BitOffset() / 8;
-  RawCode = get_static_Raster()[ByteOffset] + (get_static_Raster()[ByteOffset + 1] << 8);
-  if (get_static_CodeSize() >= 8)
-    RawCode += ( ((int) get_static_Raster()[ByteOffset + 2]) << 16);
-  RawCode >>= (get_static_BitOffset() % 8);
-  get_static_BitOffset() += get_static_CodeSize();
-
-  return(RawCode & get_static_ReadMask());
-}
-
-
-/***************************/
-CGAL_INLINE_FUNCTION
-static void DoInterlace(byte Index) {
-  static byte *ptr = NULL;
-  static int   oldYC = -1;
-  
-  if (oldYC != get_static_YC()) {
-    ptr = get_static_org() + 3 * get_static_YC() * get_static_Width();
-    oldYC = get_static_YC();
-  }
-  
-  if (get_static_YC() < get_static_Height()) {
-    *ptr++ = get_static_r()[Index];
-    *ptr++ = get_static_g()[Index];
-    *ptr++ = get_static_b()[Index];
-  }
-  
-  /* Update the X-coordinate, and if it overflows, update the Y-coordinate */
-  if (++get_static_XC() == get_static_Width()) {
-    
-    /* deal with the interlace as described in the GIF
-     * spec.  Put the decoded scan line out to the screen if we haven't gone
-     * past the bottom of it
-     */
-    
-    get_static_XC() = 0;
-    
-    switch (get_static_Pass()) {
-    case 0:
-      get_static_YC() += 8;
-      if (get_static_YC() >= get_static_Height()) { get_static_Pass()++; get_static_YC() = 4; }
-      break;
-      
-    case 1:
-      get_static_YC() += 8;
-      if (get_static_YC() >= get_static_Height()) { get_static_Pass()++; get_static_YC() = 2; }
-      break;
-      
-    case 2:
-      get_static_YC() += 4;
-      if (get_static_YC() >= get_static_Height()) { get_static_Pass()++; get_static_YC() = 1; }
-      break;
-      
-    case 3:
-      get_static_YC() += 2;  break;
-      
-    default:
-      break;
-    }
-  }
-}
-
-
-      
-/*****************************/
-CGAL_INLINE_FUNCTION
-static int GifError(const char *st) {
-  fprintf(stderr,"readGifImage: error: %s\n",st);
-
-  if (get_static_RawGIF() != NULL) ImageIO_free(get_static_RawGIF());
-  if (get_static_Raster() != NULL) ImageIO_free(get_static_Raster());
-  
-  return -1;
-}
-
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/gis.cpp b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/gis.cpp
deleted file mode 100644
index bc3bd71..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/gis.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-#ifndef CGAL_HEADER_ONLY
-
-#include "gis.h"
-#include "gis_impl.h"
-
-#endif // CGAL_HEADER_ONLY
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/gis.h b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/gis.h
deleted file mode 100644
index c12cc76..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/gis.h
+++ /dev/null
@@ -1,141 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-#ifndef GIS_H
-#define GIS_H
-
-
-#include <CGAL/ImageIO.h>
-
-
-
-
-/* read gis format header
-
-   Format du fichier texte associe aux fichiers binaires (images)
-
-exemple :
-         512 512 100 2
-	 -type U16
-	 -dx 1. 
-	 -dy 2.
-	 -dz .5
-	 -z2 5
-         -ar SUN
-	 -mod MR
-         -txt image acquise sur SIGNA 1.5T au CHRU de Caen
-         donnees brutes sans traitement  -endtxt
-	
-- la première ligne comporte les dimensions de l'image, respectivement, le nombre de colonnes, de lignes, de coupes et de temps; ces deux, trois ou quatre entiers doivent être strictement positifs et rester inférieurs à 4096.
-
-- les lignes suivantes comportent des champs indiques par des mots clefs:
-			
-   -type typespecifier
-
-   U8 entier non signé codé sur 8 bit (unsigned char) 
-   S8  entier signé codé sur 8 bit (signed char)
-   U16  entier non signé codé sur 16 bit (unsigned short)
-   S16  entier signé codé sur 16 bit (signed short)	
-   U32  entier non signé codé sur 32 bit (unsigned int)
-   S32  entier signé codé sur 32 bit (signed int)
-   FLOAT  flottant simple précision (float)
-   DOUBLE  flottant double précision (double)
-			
-   -dx double  (taille du voxel en x)
-   -dy double  (taille du voxel en y)
-   -dz double  (taille du voxel en z)
-               (les tailles sont donnees en millimetres)
-   -dt double  (taille du voxel en t)
-               (taille donnee en secondes)
-
-   (spécification d'un sous-volume)
-   -x1 entier  	
-   -x2 entier  	
-   -y1 entier  
-   -y2 entier  
-   -z1 entier  
-   -z2 entier  
-   -ref nom x y z t   
-        (origine d'un sous-volume : fichier correspondant a une
-         sous-image de "nom")
-
-   -ar architecture (string)
-   -mod modalite (string) : MR, PET, fMR, etc.
-   -dir plan de coupe (string) : sagittal, frontal, axial
-   -min double (valeur physique correspondant au minimum des voxels)
-   -max double (valeur physique correspondant au maximum des voxels)
-   -ca x y z (3 entiers pour la position de CA)
-   -cp x y z (3 entiers pour la position de CP)
-   -ip a b c d (4 double pour les coefficients du plan inter-hemispherique
-                equation de la forme ax+by+cz+d = 0)
-   -td d1 d2 d3 d4 d5 d6 (6 entiers pour les distances au repere de
-		Talairach, en voxels :
-		d1 : Talairach anterior plane-CA distance
-		d2 : Talairach posterior plane-CP distance
-		d3 : Talairach left plane-IP distance
-		d4 : Talairach right plane-IP distance
-   		d5 : Talairach bottom plane-CACP distance
-   		d6 : Talairach top plane-CACP distance
-   -a age (entier)
-   -s sexe (1/2)
-   -l lateralite
-   -txt texte libre (ascii)
-   -endtxt (fin du texte)
-
-
-   return:
-   -1: error
-   0: success
- */
-int readGisHeader(const char* name,_image *im);
-
-
-int testGisHeader(char *magic,const char *name);
-
-/** creates an return the file format structure associated with the Gis file format */
-PTRIMAGE_FORMAT createGisFormat();
-
-/* 
-   return:
-   -1: error
-    1: success
- */
-int writeGis( char *basename, _image* im ) ;
-/* 
-   return:
-   -1: error
-    1: success
- */
-int writeGisHeader( const _image* im ) ;
-
-
-/* 
-   return:
-   -1: error
-    1: success
- */
-int writeGisData( const _image* im ) ;
-
-#ifdef CGAL_HEADER_ONLY
-#include "gis_impl.h"
-#endif // CGAL_HEADER_ONLY
-
-#endif
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/gis_impl.h b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/gis_impl.h
deleted file mode 100644
index fbd3b53..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/gis_impl.h
+++ /dev/null
@@ -1,730 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-#ifdef CGAL_HEADER_ONLY
-#define CGAL_INLINE_FUNCTION inline
-#else
-#define CGAL_INLINE_FUNCTION
-#endif
-
-#include <string>
-#include <sstream>
-#include <cstring>
-
-#include "inr.h"
-#include "fgetns.h"
-
-#define _LGTH_STRING_ 1024
-
-CGAL_INLINE_FUNCTION
-PTRIMAGE_FORMAT createGisFormat() {
-  PTRIMAGE_FORMAT f=(PTRIMAGE_FORMAT) ImageIO_alloc(sizeof(IMAGE_FORMAT));
-
-  f->testImageFormat=&testGisHeader;
-  f->readImageHeader=&readGisHeader;
-  f->writeImage=&writeGis;
-  strcpy(f->fileExtension,".dim,.dim.gz,.ima,.ima.gz");
-  strcpy(f->realName,"Gis");
-  return f;
-}
-CGAL_INLINE_FUNCTION
-int writeGis( char *name, _image* im) {
-  char *outputName;
-  int length, extLength=0, res;
-
-
-  length=strlen(name);
-  outputName= (char *)ImageIO_alloc(length+8);
-  
-  if ( strncmp( name+length-4, ".dim", 4 ) == 0 ) {
-    extLength = 4;
-  }
-  else if ( strncmp( name+length-4, ".ima", 4 ) == 0 ) {
-    extLength = 4;
-  }
-  else if ( strncmp( name+length-7, ".ima.gz", 7 ) == 0 ) {
-    extLength = 7;
-  }
-  else if ( strncmp( name+length-7, ".dim.gz", 7 ) == 0 ) {
-    extLength = 7;
-  }
-
-  strncpy( outputName, name, length-extLength );
-  if ( strncmp( name+length-7, ".dim.gz", 7 ) == 0 )
-    strcpy( outputName+length-extLength, ".dim.gz" );
-  else
-    strcpy( outputName+length-extLength, ".dim" );
-
-  _openWriteImage(im, outputName);
-  if( !im->fd ) {
-    fprintf(stderr, "writeGis: error: unable to open file \'%s\'\n", outputName);
-    if ( outputName != NULL ) ImageIO_free( outputName );
-    return ImageIO_OPENING;
-  }
-
-  res = writeGisHeader(im);
-  if (res < 0 ) {
-    fprintf(stderr, "writeGis: error: unable to write header of \'%s\'\n",
-	    outputName);
-    if ( outputName != NULL ) ImageIO_free( outputName );
-    ImageIO_close( im );
-    im->fd = NULL;
-    im->openMode = OM_CLOSE;
-    return( res );
-  }
-
-  ImageIO_close(im);
-  
-  strncpy( outputName, name, length-extLength );
-  if ( strncmp( name+length-3, ".gz", 3 ) == 0 ) {
-    strcpy( outputName+length-extLength, ".ima.gz" );
-  }
-  else {
-    strcpy( outputName+length-extLength, ".ima" );
-  }
-
-  _openWriteImage(im, outputName);
-
-  if( !im->fd ) {
-    fprintf(stderr, "writeGis: error: unable to open file \'%s\'\n", outputName);
-    if ( outputName != NULL ) ImageIO_free( outputName );
-    return ImageIO_OPENING;
-  }
-
-  if ( im->dataMode == DM_ASCII ) {
-    int i, j, n, size;
-    char *str = (char*)ImageIO_alloc( _LGTH_STRING_+1 );
-    size = im->xdim * im->ydim * im->zdim * im->vdim;
-    n = ( im->xdim < 16 ) ? im->xdim : 16;
-    i = 0;
-
-    switch( im->wordKind ) {
-    default :
-      fprintf(stderr, "writeGis: such word kind not handled in ascii mode for file \'%s\'\n", outputName);
-      if ( outputName != NULL ) ImageIO_free( outputName );
-      return( -3 );
-    case WK_FIXED :
-      switch ( im->wdim ) {
-      default :
-	fprintf(stderr, "writeGis: such word dim not handled in ascii mode for file \'%s\'\n", outputName);
-	if ( outputName != NULL ) ImageIO_free( outputName );
-	return( -3 );
-      case 1 :
-	switch ( im->sign ) {
-	default :
-	  fprintf(stderr, "writeGis: such sign not handled in ascii mode for file \'%s\'\n", outputName);
-	  if ( outputName != NULL ) ImageIO_free( outputName );
-	  return( -3 );
-	case SGN_UNSIGNED :
-	  {
-	    unsigned char *theBuf = ( unsigned char * )im->data;
-	    do {
-	      memset( str, 0, _LGTH_STRING_ );
-	      for ( j=0; j<n && i<size; j++, i++ ) {
-		sprintf( str+strlen(str), "%d", theBuf[i] );
-		if ( j<n && i<size ) sprintf( str+strlen(str), " " );
-	      }
-	      sprintf( str+strlen(str), "\n" );
-	      res = ImageIO_write( im, str, strlen( str )  );
-	      if ( res  <= 0 ) {
-		fprintf(stderr, "writeGis: error when writing data in \'%s\'\n", outputName);
-		if ( outputName != NULL ) ImageIO_free( outputName );
-		return( -3 );
-	      }
-	    } while ( i < size );
-	  }
-	  break;
-	case SGN_SIGNED :
-	  {
-	    char *theBuf = ( char * )im->data;
-	    do {
-	      memset( str, 0, _LGTH_STRING_ );
-	      for ( j=0; j<n && i<size; j++, i++ ) {
-		sprintf( str+strlen(str), "%d", theBuf[i] );
-		if ( j<n && i<size ) sprintf( str+strlen(str), " " );
-	      }
-	      sprintf( str+strlen(str), "\n" );
-	      res = ImageIO_write( im, str, strlen( str )  );
-	      if ( res  <= 0 ) {
-		fprintf(stderr, "writeGis: error when writing data in \'%s\'\n", outputName);
-		if ( outputName != NULL ) ImageIO_free( outputName );
-		return( -3 );
-	      }
-	    } while ( i < size );
-	  }
-	  break;
-	} /* end of switch ( im->sign ) */
-	break;
-      case 2 :
-	switch ( im->sign ) {
-	default :
-	  fprintf(stderr, "writeGis: such sign not handled in ascii mode for file \'%s\'\n", outputName);
-	  if ( outputName != NULL ) ImageIO_free( outputName );
-	  return( -3 );
-	case SGN_UNSIGNED :
-	  {
-	    unsigned short int *theBuf = ( unsigned short int * )im->data;
-	    do {
-	      memset( str, 0, _LGTH_STRING_ );
-	      for ( j=0; j<n && i<size; j++, i++ ) {
-		sprintf( str+strlen(str), "%d", theBuf[i] );
-		if ( j<n && i<size ) sprintf( str+strlen(str), " " );
-	      }
-	      sprintf( str+strlen(str), "\n" );
-	      res = ImageIO_write( im, str, strlen( str )  );
-	      if ( res  <= 0 ) {
-		fprintf(stderr, "writeGis: error when writing data in \'%s\'\n", outputName);
-		if ( outputName != NULL ) ImageIO_free( outputName );
-		return( -3 );
-	      }
-	    } while ( i < size );
-	  }
-	  break;
-	case SGN_SIGNED :
-	  {
-	    short int *theBuf = ( short int * )im->data;
-	    do {
-	      memset( str, 0, _LGTH_STRING_ );
-	      for ( j=0; j<n && i<size; j++, i++ ) {
-		sprintf( str+strlen(str), "%d", theBuf[i] );
-		if ( j<n && i<size ) sprintf( str+strlen(str), " " );
-	      }
-	      sprintf( str+strlen(str), "\n" );
-	      res = ImageIO_write( im, str, strlen( str )  );
-	      if ( res  <= 0 ) {
-		fprintf(stderr, "writeGis: error when writing data in \'%s\'\n", outputName);
-		if ( outputName != NULL ) ImageIO_free( outputName );
-		return( -3 );
-	      }
-	    } while ( i < size );
-	  }
-	  break;
-	} /* end of switch ( im->sign ) */
-	break;	
-      } /* end of switch ( im->wdim ) */
-    } /* end of switch( im->wordKind ) */
-
-    ImageIO_free( str ); 
-  }
-  else {
-    res = _writeInrimageData(im);
-  }
-  if ( outputName != NULL ) ImageIO_free( outputName );
-  return res;
-  
-}
-
-CGAL_INLINE_FUNCTION
-int testGisHeader(char *,const char *name) {
-   if (( !strncmp(name+strlen(name)-4, ".dim", 4)) || 
-       ( !strncmp(name+strlen(name)-4, ".ima", 4)) || 
-       ( !strncmp(name+strlen(name)-7, ".ima.gz", 7)) || 
-       ( !strncmp(name+strlen(name)-7, ".dim.gz", 7)) )
-     return 0;
-  else 
-    return -1;
-}
-
-
-
-CGAL_INLINE_FUNCTION
-int readGisHeader( const char* name,_image* im)
-{
-  char *s, *str = NULL;
-  int status;
-  int n=0, nusermax = 20;
-
-  str = (char*)ImageIO_alloc( _LGTH_STRING_+1 );
-  
-  if ( !fgetns(str, _LGTH_STRING_, im) ) 
-    { ImageIO_free( str ); return -1; }
-
-  std::istringstream iss;
-  iss.str(str);
-  iss >> im->xdim >> im->ydim >> im->zdim >> im->vdim;
-
-  status = iss.str().length();
-  switch ( status ) {
-  case 2 :    im->zdim = 1;
-  case 3 :    im->vdim = 1;
-  case 4 :    break;
-  default :
-    fprintf( stderr, "readGisHeader: unable to read dimensions in '%s'\n", name );
-    ImageIO_free( str ); 
-    return -1;
-  }
-  if ( im->vdim > 1 ) {
-    im->vectMode = VM_INTERLACED;
-  } 
-  else {
-    im->vectMode = VM_SCALAR;
-  }
-#define ADD_USER_STRING { \
-    if ( n == 0 ) { \
-      im->user = (char**)ImageIO_alloc( nusermax * sizeof( char*) ); \
-      for ( n=0; n<nusermax; n++ ) im->user[n] = NULL; \
-      n = 0; \
-    } \
-    im->user[n] = (char*)ImageIO_alloc( 1+strlen( s ) ); \
-    strcpy( im->user[n++], s ); \
-  }
-
-
-
-  while( fgetns( str, _LGTH_STRING_, im ) != 0 ) {
-    s = str;
-    do {
-
-      while ( *s == ' ' || *s == '\t' ) s++;
-
-      if ( !strncmp( s, "-dx ", 4 ) ) {
-	s += 4;
-	status = sscanf( s, "%lf", &(im->vx) );
-	if ( status != 1 ) {
-	  fprintf( stderr, "readGisHeader: error while reading -dx in '%s'\n", s-4 );
-	  *s = '\0';
-	} 
-	else {
-	  while ( *s == '.' || (*s >= '0' && *s <= '9') ) s++;
-	}
-      }
-      else if ( !strncmp( s, "-dy ", 4 ) ) {
-	s += 4;
-	status = sscanf( s, "%lf", &(im->vy) );
-	if ( status != 1 ) {
-	  fprintf( stderr, "readGisHeader: error while reading -dy in '%s'\n", s-4 );
-	  *s = '\0';
-	} 
-	else {
-	  while ( *s == '.' || (*s >= '0' && *s <= '9') ) s++;
-	}
-      }
-      else if ( !strncmp( s, "-dz ", 4 ) ) {
-	s += 4;
-	status = sscanf( s, "%lf", &(im->vz) );
-	if ( status != 1 ) {
-	  fprintf( stderr, "readGisHeader: error while reading -dz in '%s'\n", s-4 );
-	  *s = '\0';
-	} 
-	else {
-	  while ( *s == '.' || (*s >= '0' && *s <= '9') ) s++;
-	}
-      }
-      else if ( !strncmp( s, "-dt ", 4 ) ) {
-	ADD_USER_STRING
-	s += 4; 
-	while ( *s == '.' || (*s >= '0' && *s <= '9') ) s++; 
-      }
-
-      else if ( !strncmp( s, "-type ", 6 ) ) {
-	s += 6; 
-	if ( !strncmp( s, "U8", 2 ) ) {
-	  im->wdim     = 1;
-	  im->wordKind = WK_FIXED;
-	  im->sign     = SGN_UNSIGNED;
-	  s += 2;
-	}
-	else if ( !strncmp( s, "S8", 2 ) ) {
-	  im->wdim     = 1;
-	  im->wordKind = WK_FIXED;
-	  im->sign     = SGN_SIGNED;
-	  s += 2;
-	} 
-	else if ( !strncmp( s, "U16", 3 ) ) {
-	  im->wdim     = 2;
-	  im->wordKind = WK_FIXED;
-	  im->sign     = SGN_UNSIGNED;
-	  s += 3;
-	}
-	else if ( !strncmp( s, "S16", 3 ) ) {
-	  im->wdim     = 2;
-	  im->wordKind = WK_FIXED;
-	  im->sign     = SGN_SIGNED;
-	  s += 3;
-	}
-	else if ( !strncmp( s, "U32", 3 ) ) {
-	  im->wdim     = 4;
-	  im->wordKind = WK_FIXED;
-	  im->sign     = SGN_UNSIGNED;
-	  s += 3;
-	}
-	else if ( !strncmp( s, "S32", 3 ) ) {
-	  im->wdim     = 4;
-	  im->wordKind = WK_FIXED;
-	  im->sign     = SGN_SIGNED;
-	  s += 3;
-	}
-	else if ( !strncmp( s, "FLOAT", 5 ) ) {
-	  im->wdim     = sizeof( float );
-	  im->wordKind = WK_FLOAT;
-	  im->sign     = SGN_UNKNOWN;
-	  s += 5;
-	}
-	else if ( !strncmp( s, "DOUBLE", 6 ) ) {
-	  im->wdim     = sizeof( double );
-	  im->wordKind = WK_FLOAT;
-	  im->sign     = SGN_UNKNOWN;
-	  s += 6;
-	}
-	else {
-	  fprintf( stderr, "readGisHeader: unknown type '%s'\n", s-6 );
-	  *s = '\0'; 
-	}
-      }
-
-      else if ( !strncmp( s, "-bo ", 4 ) ) {
-	s += 4;
-	if ( !strncmp( s, "ABCD", 4 ) ) {
-	  im->endianness = END_BIG;
-	  s += 4;
-	}
-	else if ( !strncmp( s, "SUN", 3 ) ) {
-	  im->endianness = END_BIG;
-	  s += 3;
-	}
-	else if ( !strncmp( s, "DCBA", 4 ) ) {
-	  im->endianness = END_LITTLE;
-	  s += 4;
-	}
-	else if ( !strncmp( s, "ALPHA", 5 ) ) {
-	  im->endianness = END_LITTLE;
-	  s += 5;
-	}
-	else {
-	  fprintf( stderr, "readGisHeader: unknown byte order '%s'\n", s-4 );
-	  *s = '\0'; 
-	}
-      }
-
-      else if ( !strncmp( s, "-ar ", 4 ) ) {
-	s += 4;
-	if ( !strncmp( s, "SUN", 3 ) ) {
-	  im->endianness = END_BIG;
-	  s += 3;
-	}
-	else if ( !strncmp( s, "ALPHA", 5 ) ) {
-	  im->endianness = END_LITTLE;
-	  s += 5;
-	}
-	else {
-	  fprintf( stderr, "readGisHeader: unknown architecture '%s'\n", s-4 );
-	  *s = '\0'; 
-	}
-      }
-
-      else if ( !strncmp( s, "-om ", 4 ) ) {
-	s += 4;
-	if ( !strncmp( s, "binar", 5 ) ) {
-	  im->dataMode = DM_BINARY;
-	  s += 5;
-	} 
-	else if ( !strncmp( s, "ascii", 5 ) ) {
-	  im->dataMode = DM_ASCII;
-	  s += 5;
-	} 
-	else {
-	  fprintf( stderr, "readGisHeader: unknown data type '%s'\n", s-4 );
-	  ImageIO_free( str );
-	  return -1;
-	}
-      }
-      
-      
-      else {
-	fprintf( stderr, "readGisHeader: unknown indentifier '%s'\n", s );
-	ADD_USER_STRING
-	*s = '\0'; 
-      }
-
-    } while( *s != '\0' && *s != '\n' );
-
-  }
-  ImageIO_free( str );
-  
-
-  if ( im->endianness == END_UNKNOWN ) {
-    im->endianness = _getEndianness();
-  }
-
-
-  /* header is read. close header file and open data file. */
-  if( name != NULL ) {
-    
-    int length = strlen(name) ;
-    char* data_filename = (char *) ImageIO_alloc(length+4) ;
-    
-    if( strcmp( name+length-4, ".dim" ) ) {
-      fprintf (stderr,
-	       "readGisHeader: error: file header extension must be .dim\n");
-      ImageIO_free( data_filename );
-      return -1;
-    }
-    
-    ImageIO_close(im);
-
-
-    /* open data file
-     */
-    
-    strcpy(data_filename,name);
-    strcpy(data_filename+length-3, "ima.gz");
-    _openReadImage(im,data_filename);
-    
-    if(!im->fd) {
-      
-      strcpy(data_filename,name);
-      strcpy(data_filename+length-3, "ima");
-      _openReadImage(im,data_filename);
-      if(!im->fd) {
-	fprintf(stderr, "readGisHeader: error: unable to open data file \'%s\'\n", data_filename);
-	ImageIO_free( data_filename );
-	return -1;
-	
-      }
-    }
-    ImageIO_free( data_filename );
-
-
-
-
-
-    /* read data if ascii
-       only U8 and S8
-     */
-    if ( im->dataMode == DM_ASCII ) {
-      int size = im->xdim * im->ydim * im->zdim * im->vdim * im->wdim;
-      unsigned int n;
-      char *tmp;
-      int ret, iv=0;
-      
-      if ( im->wdim != 1 || im->wordKind != WK_FIXED ) {
-	fprintf(stderr, "readGisHeader: error: unable to read such ascii type\n" );
-	return -1;
-      }
-
-      n = 0 ;
-      if ( size <= 0 ) return -1;
-      if(!im->data) {
-	im->data = ( void*) ImageIO_alloc(size);
-	if(!im->data) return -1;
-      }
-      
-      n = 0;
-      str = (char*)ImageIO_alloc( _LGTH_STRING_+1 );
-      while( fgetns( str, _LGTH_STRING_, im ) != 0 &&
-	     n < im->xdim * im->ydim * im->zdim * im->vdim ) {
-	tmp = str;
-	while ( *tmp != '\n' && *tmp != '\0' && *tmp != EOF &&
-		n < im->xdim * im->ydim * im->zdim * im->vdim ) {
-	  /* skip trailing whitespace
-	   */
-	  while ( *tmp == ' ' || *tmp == '\t' )
-	    tmp++;
-	  if ( *tmp == '\0' || *tmp == '\n' || *tmp == EOF )
-	    continue;
-	  
-	  /* read a number
-	   */
-	  switch ( im->wordKind ) {
-	  case WK_FIXED :
-	    ret = sscanf( tmp, "%d", &iv );
-	  break;
-	  default :
-	    ImageIO_free( im->data ); im->data = NULL;
-	    ImageIO_free( str );
-	    return -1;
-	  }
-	  
-	  if ( ret != 1 ) {
-	    fprintf( stderr, "readGisHeader: error in reading ascii data\n" );
-	    ImageIO_free( im->data ); im->data = NULL;
-	    ImageIO_free( str );
-	    return -1;	
-	  }
-	  
-	  if ( im->wordKind == WK_FIXED 
-	       && im->sign == SGN_UNSIGNED 
-	       && im->wdim == 1 ) {
-	    unsigned char *buf = (unsigned char *)im->data;
-	    buf += n;
-	    if ( iv < 0 )        *buf = (unsigned char)0;
-	    else if ( iv > 255 ) *buf = (unsigned char)255;
-	    else                 *buf = (unsigned char)iv;
-	    n ++;
-	  }
-	  else if ( im->wordKind == WK_FIXED 
-		    && im->sign == SGN_SIGNED 
-		    && im->wdim == 1 ) {
-	    char *buf = (char *)im->data;
-	    buf += n;
-	    if ( iv < -128 )     *buf = (char)-128;
-	    else if ( iv > 127 ) *buf = (char)127;
-	    else                 *buf = (char)iv;
-	    n ++;
-	  }
-	  else if ( im->wordKind == WK_FIXED 
-		    && im->sign == SGN_UNSIGNED 
-		    && im->wdim == 2 ) {
-	    unsigned short int *buf = (unsigned short int *)im->data;
-	    buf += n;
-	    if ( iv < 0 )          *buf = (unsigned short int)0;
-	    else if ( iv > 65535 ) *buf = (unsigned short int)65535;
-	    else                   *buf = (unsigned short int)iv;
-	    n ++;
-	  }
-	  else if ( im->wordKind == WK_FIXED 
-		    && im->sign == SGN_SIGNED 
-		    && im->wdim == 2 ) {
-	    short int *buf = (short int *)im->data;
-	    buf += n;
-	    if ( iv < -32768 )     *buf = (short int)-32768;
-	    else if ( iv > 32767 ) *buf = (short int)32767;
-	    else                   *buf = (short int)iv;
-	    n ++;
-	  }
-	  else {
-	    ImageIO_free( im->data ); im->data = NULL;
-	    ImageIO_free( str );
-	    return -1;
-	  }
-	  
-
-
-	  /* skip a number 
-	   */
-	  while ( (*tmp >= '0' && *tmp <= '9') || *tmp == '.' || *tmp == '-' )
-	    tmp++;
-	}
-      }
-      ImageIO_free( str );
-      ImageIO_close(im);
-    }
-
-  }
-
-  
-  /* check header validity */
-  if ( im->xdim > 0 && im->ydim > 0 && im->zdim > 0 && im->vdim > 0 &&
-       im->vx > 0.0 && im->vy > 0.0 && im->vz > 0.0 &&
-       ( im->wordKind == WK_FLOAT ||
-	 (im->wordKind == WK_FIXED && im->sign != SGN_UNKNOWN) ) &&
-       im->endianness != END_UNKNOWN ) {
-    return 0;
-  }
-
-  return -1;
-}
-
-
-
-CGAL_INLINE_FUNCTION
-int writeGisHeader( const _image* inr )
-{
-  const char *proc = "writeGisHeader";
-  std::ostringstream oss;
-
-  if ( inr->vectMode == VM_NON_INTERLACED ) {
-    fprintf( stderr, "%s: can not write non interlaced data\n", proc );
-    return -1;
-  }
-
-  /* dimensions
-   */
-  oss << " " << inr->xdim << " " << inr->ydim;
-  if ( inr->vdim > 1 ) {
-    oss << " " << inr->zdim << " " << inr->vdim;
-  }
-  else if ( inr->zdim > 1 ) {
-    oss << " " << inr->zdim;
-  }
-  oss << "\n";
-
-  /* type
-   */
-  oss << "-type ";
-  switch ( inr->wordKind ) {
-  case WK_FIXED :
-    switch( inr->sign ) {
-    case SGN_UNSIGNED :
-      oss << "U" << 8*inr->wdim;
-      break;
-    case SGN_SIGNED :
-      oss << "S" << 8*inr->wdim;
-      break;
-    default :
-      fprintf( stderr, "%s: unknown wordSign\n", proc );
-      return -1;    
-    }
-    break;
-  case WK_FLOAT :
-    if ( inr->wdim == sizeof( float ) ) {
-      oss << "FLOAT";
-    }
-    else if ( inr->wdim  == sizeof( double ) ) {
-      oss << "DOUBLE";
-    }
-    else {
-      fprintf( stderr, "%s: unknown WK_FLOAT word dim\n", proc );
-      return -1;    
-    }
-    break;
-  default :
-    fprintf( stderr, "%s: unknown wordKind for image\n", proc );
-    return -1;  
-  }
-  oss << "\n";
-  
-  oss << "-dx "<< inr->vx <<"\n";
-  oss << "-dy "<< inr->vy <<"\n";
-  if ( inr->zdim > 1 )
-    oss << "-dz " << inr->vz << "\n";
-
-  if ( inr->wdim > 1 ) {
-    oss << "-bo ";
-    switch ( _getEndianness() ) {
-    default :
-    case END_LITTLE :
-      oss << "DCBA"; break;
-    case END_BIG :
-      oss << "ABCD"; break;
-    }
-    oss << "\n";
-  }
-  switch ( inr->dataMode ) {
-  default :
-  case DM_BINARY :
-    oss << "-om binar\n";
-    break;
-  case DM_ASCII :
-    oss << "-om ascii\n";
-  }
-  if( ImageIO_write( inr, oss.str().data(), oss.str().length()) == 0) {
-    return -1;
-  }
-  return 1;
-}
-
-
-CGAL_INLINE_FUNCTION
-int writeGisData( const _image*) 
-{
-  return -1;
-}
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/inr.cpp b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/inr.cpp
deleted file mode 100644
index 6560f74..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/inr.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-#ifndef CGAL_HEADER_ONLY
-
-#include "inr.h"
-#include "inr_impl.h"
-
-#endif // CGAL_HEADER_ONLY
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/inr.h b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/inr.h
deleted file mode 100644
index 5ec6460..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/inr.h
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-
-#ifndef INR_H
-#define INR_H
-
-
-#include <CGAL/ImageIO.h>
-
-
-
-/** Writes the given inrimage header in an already opened file.
-    @param im image descriptor
-    @param end image data endianness (END_UNKNOWN to use architecture endianness) */
-int _writeInrimageHeader(const _image *im,
-			 ENDIANNESS end);
-
-/** Writes the given image body in an already opened file.
-    @param im image descriptor */
-int _writeInrimageData(const _image *im);
-
-/** read header from an opened inrimage file
-    @param im opened inrmage descriptor */
-int readInrimageHeader(const char *,_image *im);
-
-/** test if an image file has the Inrimage format, given the magic string
-    and filename
-    @param magic this string is of size 5 and corresponds to the first 4 characters of the file (terminated with a null character)
-    @param filename the file name
-    @return -1 if it is not an Inrimage file and 0 otherwise */
-int testInrimageHeader(char *magic,const char *filename); 
-
-/** calls _writeInrimageHeader and _writeInrimageData
-    @param basename the file name without any extension 
-    @param im structure
-    @return same as  _writeInrimageHeader*/
-int writeInrimage(char *basename,_image *im);
-/** creates an return the file format structure associated with the Inrimage file format */
-PTRIMAGE_FORMAT createInrimageFormat();
-
-#ifdef CGAL_HEADER_ONLY
-#include "inr_impl.h"
-#endif // CGAL_HEADER_ONLY
-
-
-#endif
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/inr_impl.h b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/inr_impl.h
deleted file mode 100644
index dc67262..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/inr_impl.h
+++ /dev/null
@@ -1,517 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-#ifdef CGAL_HEADER_ONLY
-#define CGAL_INLINE_FUNCTION inline
-#else
-#define CGAL_INLINE_FUNCTION
-#endif
-
-#include "fgetns.h"
-
-#include <string>
-#include <sstream>
-#include <string.h>
-
-/* Magic header for inrimages v4 */
-#define INR4_MAGIC "#INRIMAGE-4#{"
-
-
-/** Magic header for inrimages */
-#define INR_MAGIC "#INR"
-
-typedef struct stringListElementStruct {
-  char *string;
-  struct stringListElementStruct *next;
-} stringListElement;
-/* list element with a pointer on a string */
-
-typedef struct {
-  stringListElement *begin, *end;
-} stringListHead;
-/* string list descriptor */
-
-#include <clocale>
-class Set_numeric_locale {
-  const char * old_locale;
-public:
-  Set_numeric_locale(const char* locale) 
-    : old_locale(std::setlocale(LC_NUMERIC, locale))
-  {
-  }
-
-  ~Set_numeric_locale() {
-    std::setlocale(LC_NUMERIC, old_locale);
-  }
-};
-
-static void addStringElement(stringListHead *strhead,
-			     const char *str);
-/* add a string element at the tail of given list */
-
-static void concatStringElement(const stringListHead *strhead,
-				const char *str);
-/* concat given string at the last element of given list */
-
-
-/* Writes the given inrimage header in an already opened file.*/
-CGAL_INLINE_FUNCTION
-int _writeInrimageHeader(const _image *im, ENDIANNESS end) {
-  unsigned int pos, i;
-  char type[30], endianness[5], buf[257], scale[20];
-  std::ostringstream oss;
-
-  Set_numeric_locale num_locale("C");
-
-  if(im->openMode != OM_CLOSE) {
-    /* fix word kind */
-    switch(im->wordKind) {
-
-    case WK_FLOAT:
-      sprintf(type, "float");
-      scale[0] = '\0';
-      break;
-
-    case WK_FIXED:
-      switch(im->sign) {
-      case SGN_SIGNED:
-	sprintf(type, "signed fixed");
-	break;
-      case SGN_UNSIGNED:
-	sprintf(type, "unsigned fixed");
-	break;
-      default:
-	return -1;
-      }
-      sprintf(scale, "SCALE=2**0\n");
-      break;
-      
-    default:
-      return -1;
-    }
-    
-    switch(end) {
-    case END_LITTLE:
-      sprintf(endianness, "decm");
-      break;
-    case END_BIG:
-      sprintf(endianness, "sun");
-      break;
-    default:
-      /* fix architecture endianness */
-      if( _getEndianness() == END_LITTLE)
-	sprintf(endianness, "decm");
-      else
-	sprintf(endianness, "sun");
-      break;
-    }
-
-    /* write header information */
-    oss << INR4_MAGIC << "\n";
-    oss << "XDIM=" << im->xdim << "\n";
-    oss << "YDIM=" << im->ydim << "\n";
-    oss << "ZDIM=" << im->zdim << "\n";
-    oss << "VDIM=" << im->vdim << "\n";
-    oss << "TYPE=" << type << "\n";
-    oss << "PIXSIZE=" << im->wdim*8 <<" bits\n";
-    oss << scale << "CPU=" << endianness << "\n";
-    oss << "VX=" << im->vx << "\n";
-    oss << "VY=" << im->vy << "\n";
-    oss << "VZ=" << im->vz << "\n";
-
-    if ( im->cx != 0 ) 
-      oss << "XO="<< im->cx << "\n";
-    if ( im->cy != 0 ) 
-      oss << "YO="<< im->cy << "\n";
-    if ( im->cz != 0 ) 
-      oss << "ZO="<< im->cz << "\n";
-    if ( im->tx != 0.0 ) 
-      oss << "TX="<< im->tx << "\n";
-    if ( im->ty != 0.0 ) 
-      oss << "TY="<< im->ty << "\n";
-    if ( im->tz != 0.0 ) 
-      oss << "TZ="<< im->tz << "\n";
-    if ( im->rx != 0.0 ) 
-      oss << "RX="<< im->rx <<"\n";
-    if ( im->ry != 0.0 ) 
-      oss << "RY="<< im->ry << "\n";
-    if ( im->rz != 0.0 ) 
-      oss << "RZ=" << im->rz <<"\n";
-
-    pos = oss.str().length();
-    
-    if(ImageIO_write(im, oss.str().data(), oss.str().length()) == 0)
-      return -1;
-    
-    
-    /* write user strings */
-    if ( im->user != NULL ) {
-      for(i = 0; i < im->nuser; i++) {
-	if ( im->user[i] == NULL ) continue;
-	pos += strlen(im->user[i]) + 2;
-	if(ImageIO_write(im, "#", 1) == 0) return -1;
-	if(ImageIO_write(im, im->user[i], strlen(im->user[i])) == 0) return -1;
-	if(ImageIO_write(im, "\n", 1) == 0) return -1;
-      }
-    }
-    /* write end of header */
-    pos = pos % 256;
-    if(pos > 252) {
-      for(i = pos; i < 256; i++)
-	if(ImageIO_write(im, "\n", 1) != 1) return -1;
-      pos = 0;
-    }
-    buf[0] = '\0';
-    for(i = pos; i < 252; i++) strcat(buf, "\n");
-    strcat(buf, "##}\n");
-    
-    if(ImageIO_write(im, buf, strlen(buf)) == 0) return -1;
-    else return 1;
-  }
-
-  else return -1;
-}
-
-
-
-/* Writes the given image body in an already opened file.*/
-CGAL_INLINE_FUNCTION
-int _writeInrimageData(const _image *im) {
-  unsigned long size, nbv, nwrt, i;
-  unsigned int v;
-  unsigned char **vp;
-  
-  if(im->openMode != OM_CLOSE) {
-
-    /* scalar or interlaced vectors */
-    if(im->vectMode != VM_NON_INTERLACED) {
-      size = im->xdim * im->ydim * im->zdim * im->vdim * im->wdim;
-      nwrt = ImageIO_write(im, im->data, size);
-      if(nwrt != size) return -1;
-      else return 1;
-    }
-
-    /* non interlaced vectors: interlace for saving */
-    else {
-      nbv = im->xdim * im->ydim * im->zdim;
-      size = im->xdim * im->ydim * im->zdim * im->wdim;
-      vp = (unsigned char **) ImageIO_alloc(im->vdim * sizeof(unsigned char *));
-      for(v = 0; v < im->vdim; v++)
-	vp[v] = (unsigned char *) im->data + v * size;
-      for(i = 0; i < nbv; i++)
-	for(v = 0; v < im->vdim; v++) {
-	  if(ImageIO_write(im, (const void *) vp[v], im->wdim) != im->wdim)
-	    return -1;
-	  vp[v] += im->wdim;
-	}
-      ImageIO_free(vp);
-      return 1;
-    }
-  }
-  else return -1;
-}
-
-
-
-
-/* read header of an opened inrimage */
-CGAL_INLINE_FUNCTION
-int readInrimageHeader(const char *,_image *im) {
-  char str[257];
-  int n, nusr;
-  stringListHead strl = { NULL, NULL };
-  stringListElement *oel, *el;
-
-  Set_numeric_locale num_locale("C");
-
-  if(im->openMode != OM_CLOSE) {
-    /* read image magic number */
-    if(!fgetns(str, 257, im )) return -1;
-    if(strcmp(str, INR4_MAGIC)) return -1;
-
-
-    /* while read line does not begin with '#' or '\n', read line
-       and decode field */
-    if(!fgetns(str, 257, im)) return -1;
-
-    while(str[0] != '#' && str[0] != '\0') {
-
-      if(!strncmp(str, "XDIM=", 5)) {
-        std::istringstream iss(str+5);
-        if(!(iss >> im->xdim)) return -1;
-      }
-      else if(!strncmp(str, "YDIM=", 5)) {
-        std::istringstream iss(str+5);
-        if(!(iss >> im->ydim)) return -1;
-      }
-      else if(!strncmp(str, "ZDIM=", 5)) {
-        std::istringstream iss(str+5);
-        if(!(iss >> im->zdim)) return -1;
-      }
-      else if(!strncmp(str, "VDIM=", 5)) {
-        std::istringstream iss(str+5);
-        if(!(iss >> im->vdim)) return -1;
-	if(im->vdim == 1) im->vectMode = VM_SCALAR;
-	else im->vectMode = VM_INTERLACED;
-      }
-      else if(!strncmp(str, "VX=", 3)) {
-        std::istringstream iss(str+3);
-        if(!(iss >> im->vx)) return -1;
-      }
-      else if(!strncmp(str, "VY=", 3)) {
-        std::istringstream iss(str+3);
-        if(!(iss >> im->vy)) return -1;
-      }
-      else if(!strncmp(str, "VZ=", 3)) {
-        std::istringstream iss(str+3);
-        if(!(iss >> im->vz)) return -1;
-      }
-      else if(!strncmp(str, "TYPE=", 5)) {
-	if(!strncmp(str+5, "float", 5)) im->wordKind = WK_FLOAT;
-	else {
-	  if(!strncmp(str+5, "signed fixed", 12)) {
-	    im->wordKind = WK_FIXED;
-	    im->sign = SGN_SIGNED;
-	  }
-	  else if(!strncmp(str+5, "unsigned fixed", 14)) {
-	    im->wordKind = WK_FIXED;
-	    im->sign = SGN_UNSIGNED;
-	  }
-	  else return -1;
-	}
-      }
-      /* before "sscanf(str+8, "%i %n", &im->wdim, &n) != 1"
-	 was used. 
-	 However the man said 
-         ...
-	 n      Nothing is expected; instead, the number of charac­
-              ters consumed thus far from  the  input  is  stored
-              through  the  next pointer, which must be a pointer
-              to int.  This is not a conversion, although it  can
-              be  suppressed  with  the  *  flag.  The C standard
-              says: `Execution of a %n directive does not  incre­
-              ment  the  assignment count returned at the comple­
-              tion of execution' but  the  Corrigendum  seems  to
-              contradict  this.  Probably  it is wise not to make
-              any assumptions on the effect of %n conversions  on
-              the return value.
-	 ...
-	 Thus I change it. It was yielding a RETURN_FAILURE with 
-	 insight (GM).
-      */
-      else if(!strncmp(str, "PIXSIZE=", 8)) {
-        std::istringstream iss(str+8);
-        if(!(iss >> im->wdim)) return -1;
-	if(im->wdim != 8 && im->wdim != 16 && im->wdim != 32 &&
-	   im->wdim != 64) return -1;
-	
-	if ( im->wdim <= 9 ) {
-	  if(strncmp(str+8+1, " bits", 5)) return -1;
-	}
-	else if ( im->wdim <= 99 ) {
-	  if(strncmp(str+8+2, " bits", 5)) return -1;
-	}
-	else {
-	  return -1;
-	}
-
-	im->wdim >>= 3;
-      }
-      else if(!strncmp(str, "SCALE=", 6)) ;
-      else if(!strncmp(str, "CPU=", 4)) {
-	if(!strncmp(str+4, "decm", 4)) im->endianness = END_LITTLE;
-	else if(!strncmp(str+4, "alpha", 5)) im->endianness = END_LITTLE;
-	else if(!strncmp(str+4, "pc", 2)) im->endianness = END_LITTLE;
-	else if(!strncmp(str+4, "sun", 3)) im->endianness = END_BIG;
-	else if(!strncmp(str+4, "sgi", 3)) im->endianness = END_BIG;
-	else return -1;
-      }
-
-      else if(!strncmp(str, "XO=", 3)) {
-        std::istringstream iss(str+3);
-        if(!(iss >> im->cx)) return -1;
-      }
-      else if(!strncmp(str, "YO=", 3)) {
-        std::istringstream iss(str+3);
-        if(!(iss >> im->cy)) return -1;
-      }
-      else if(!strncmp(str, "ZO=", 3)) {
-        std::istringstream iss(str+3);
-        if(!(iss >> im->cz)) return -1;
-      }
-
-      else if(!strncmp(str, "TX=", 3)) {
-        std::istringstream iss(str+3);
-        if(!(iss >> im->tx)) return -1;
-      }
-      else if(!strncmp(str, "TY=", 3)) {
-        std::istringstream iss(str+3);
-        if(!(iss >> im->ty)) return -1;
-      }
-      else if(!strncmp(str, "TZ=", 3)) {
-        std::istringstream iss(str+3);
-        if(!(iss >> im->tz)) return -1;
-      }
-      else if(!strncmp(str, "RX=", 3)) {
-        std::istringstream iss(str+3);
-        if(!(iss >> im->rx)) return -1;
-      }
-      else if(!strncmp(str, "RY=", 3)) {
-        std::istringstream iss(str+3);
-        if(!(iss >> im->ry)) return -1;
-      }
-      else if(!strncmp(str, "RZ=", 3)) {
-        std::istringstream iss(str+3);
-        if(!(iss >> im->rz)) return -1;
-      }
-
-      if(!fgetns(str, 257, im)) return -1;
-    }
-
-    /* parse user strings */
-    im->nuser = nusr = 0;
-    while(str[0] == '#' && strncmp(str, "##}", 3)) {
-      addStringElement(&strl, str + 1);
-      while(strlen(str) == 256) {
-	if(!fgetns(str, 257, im)) return -1;
-	concatStringElement(&strl, str);
-      }
-      nusr++;
-      if(!fgetns(str, 257, im)) return -1;      
-    }
-    
-    /* go to end of header */
-    while(strncmp(str, "##}", 3)) {
-      if(!fgetns(str, 257, im)) return -1;
-    }
-    
-
-    /* check header validity */
-    if(im->xdim > 0 && im->ydim > 0 && im->zdim > 0 && im->vdim > 0 &&
-       im->vx > 0.0 && im->vy > 0.0 && im->vz > 0.0 &&
-       (im->wordKind == WK_FLOAT || (im->wordKind == WK_FIXED &&
-				     im->sign != SGN_UNKNOWN)) &&
-       im->endianness != END_UNKNOWN) {
-      if(nusr > 0) {
-	im->nuser = nusr;
-	im->user = (char **) ImageIO_alloc(im->nuser * sizeof(char *));
-	oel = NULL;
-	for(el = strl.begin, n = 0; el != NULL; el = oel, n++) {
-	  im->user[n] = el->string;
-	  oel = el->next;
-	  ImageIO_free(el);
-	}
-      }
-      return 0;
-    }
-    else return -1;
-
-  }
-  else return -1;
-}
-
-
-
-/* add a string element at the tail of given list */
-static void addStringElement(stringListHead *strhead, const char *str) {
-  stringListElement *el;
-
-  el = (stringListElement *) ImageIO_alloc(sizeof(stringListElement));
-  /* was strdup(str); */
-  el->string = (char*)ImageIO_alloc( strlen(str)+1);
-  memcpy(el->string, str,  strlen(str)+1);
-  el->next = NULL;
-  if(strhead->begin == NULL)
-    strhead->begin = strhead->end = el;
-  else {
-    strhead->end->next = el;
-    strhead->end = el;
-  }
-}
-
-
-/* concat given string at the last element of given list */
-static void concatStringElement(const stringListHead *strhead,
-				const char *str) {
-  stringListElement *el;
-
-  el = strhead->end;
-  el->string = (char *) realloc(el->string,
-				strlen(el->string) + strlen(str) + 1);
-  strcat(el->string, str);
-}
-
-CGAL_INLINE_FUNCTION
-int testInrimageHeader(char *magic,const char *) {
-  if (!strcmp(magic, INR_MAGIC))
-    return 0;
-  else 
-    return -1;
-}
-CGAL_INLINE_FUNCTION
-int writeInrimage(char *name,_image *im) {
-  int res;
-
-  _openWriteImage( im, name );
-
-  if(!im->fd) {
-    fprintf(stderr, "writeInrimage: error: unable to open file \'%s\'\n", name );
-    return ImageIO_OPENING;
-  }
-
-  res = _writeInrimageHeader(im, END_UNKNOWN);
-  if (res < 0) {
-    fprintf(stderr, "writeInrimage: error: unable to write header of \'%s\'\n",
-	    name);
-    ImageIO_close( im );
-    im->fd = NULL;
-    im->openMode = OM_CLOSE;
-    return( res );
-  }
-  
-  res = _writeInrimageData( im );
-  if (res < 0) {
-    fprintf(stderr, "writeInrimage: error: unable to write data of \'%s\'\n",
-	    name);
-    ImageIO_close( im );
-    im->fd = NULL;
-    im->openMode = OM_CLOSE;
-    return( res );
-  }
-
-  ImageIO_close( im );
-  im->fd = NULL;
-  im->openMode = OM_CLOSE;
-
-  return ( res );  
-}
-
-CGAL_INLINE_FUNCTION
-PTRIMAGE_FORMAT createInrimageFormat() {
-  PTRIMAGE_FORMAT f=(PTRIMAGE_FORMAT) ImageIO_alloc(sizeof(IMAGE_FORMAT));
-
-  f->testImageFormat=&testInrimageHeader;
-  f->readImageHeader=&readInrimageHeader;
-  f->writeImage=&writeInrimage;
-  strcpy(f->fileExtension,".inr,.inr.gz,.gradient,.gradient.gz,.gradient_direction,.gradient_direction.gz");
-  strcpy(f->realName,"Inrimage");
-  return f;
-}
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/iris.cpp b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/iris.cpp
deleted file mode 100644
index 7113137..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/iris.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-#ifndef CGAL_HEADER_ONLY
-
-#include "iris.h"
-#include "iris_impl.h"
-
-#endif // CGAL_HEADER_ONLY
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/iris.h b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/iris.h
deleted file mode 100644
index 81eb52e..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/iris.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-#ifndef IRIS_H
-#define IRIS_H
-
-#include <CGAL/ImageIO.h>
-
-
-
-PTRIMAGE_FORMAT createIrisFormat();
-int readIrisImage( const char *name, _image *im );
-int testIrisHeader(char *magic,const char *name);
-
-#ifdef CGAL_HEADER_ONLY
-#include <CGAL/iris_impl.h>
-#endif // CGAL_HEADER_ONLY
-
-#endif
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/iris_impl.h b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/iris_impl.h
deleted file mode 100644
index c42f296..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/iris_impl.h
+++ /dev/null
@@ -1,499 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-/*
- * xviris.c - load routine for IRIS 'rgb' format pictures
- *
- * LoadIRIS()
- * WriteIRIS()
- */
-
-#ifdef CGAL_HEADER_ONLY
-#define CGAL_INLINE_FUNCTION inline
-#else
-#define CGAL_INLINE_FUNCTION
-#endif
-
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-
-
-
-/** Magic header for RGB files */
-#define IRIS_MAGIC 0732
-
-
-
-typedef unsigned char byte;
-
-#define BPPMASK			0x00ff
-#define ITYPE_VERBATIM		0x0000
-#define ITYPE_RLE		0x0100
-#define ISRLE(type)		(((type) & 0xff00) == ITYPE_RLE)
-#define ISVERBATIM(type)	(((type) & 0xff00) == ITYPE_VERBATIM)
-#define BPP(type)		((type) & BPPMASK)
-#define RLE(bpp)		(ITYPE_RLE | (bpp))
-#define VERBATIM(bpp)		(ITYPE_VERBATIM | (bpp))
-
-
-
-
-
-
-#define TAGLEN	(5)
-
-#define RINTLUM (79)
-#define GINTLUM (156)
-#define BINTLUM (21)
-
-#define OFFSET_R	3	/* this is byte order dependent */
-#define OFFSET_G	2
-#define OFFSET_B	1
-#define OFFSET_A	0
-
-#define ILUM(r,g,b)     ((int)(RINTLUM*(r)+GINTLUM*(g)+BINTLUM*(b))>>8)
-#define CHANOFFSET(z)	(3-(z))	/* this is byte order dependent */
-
-static byte    *getimagedata  (const _image *im, unsigned short, int, int, int);
-static void     interleaverow (byte *, byte *, int, int);
-static void     expandrow     (byte *, byte *, int);
-static void     readtab       (const _image *im, unsigned long *, int);
-static void     addimgtag     (byte *, int, int);
-
-
-static unsigned short  getshort      (const _image *im);
-static unsigned long   getlong       (const _image *im);
-
-
-CGAL_INLINE_FUNCTION
-int testIrisHeader(char *magic,const char *) {
-  if((((unsigned char *)magic)[0]<<8) + ((unsigned char *)magic)[1]
-     == IRIS_MAGIC)
-    return 0;
-  else 
-    return -1;
-}
-
-CGAL_INLINE_FUNCTION
-PTRIMAGE_FORMAT createIrisFormat() {
-  PTRIMAGE_FORMAT f=(PTRIMAGE_FORMAT) ImageIO_alloc(sizeof(IMAGE_FORMAT));
-
-  f->testImageFormat=&testIrisHeader;
-  f->readImageHeader=&readIrisImage;
-  f->writeImage=0;
-  strcpy(f->fileExtension,".rgb");
-  strcpy(f->realName,"IRIS");
-  return f;
-}
-
-
-
-/******************************************/
-static void interleaverow(byte *lptr, byte *cptr, int z, int n)
-{
-  lptr += z;
-  while(n--) {
-    *lptr = *cptr++;
-    lptr += 4;
-  }
-}
-
-
-/******************************************/
-static void expandrow(byte *optr, byte *iptr, int z)
-{
-  byte pixel, count;
-
-  optr += z;
-  while (1) {
-    pixel = *iptr++;
-    if ( !(count = (pixel & 0x7f)) ) return;
-    if (pixel & 0x80) {
-      while (count>=8) {
-	optr[0*4] = iptr[0];
-	optr[1*4] = iptr[1];
-	optr[2*4] = iptr[2];
-	optr[3*4] = iptr[3];
-	optr[4*4] = iptr[4];
-	optr[5*4] = iptr[5];
-	optr[6*4] = iptr[6];
-	optr[7*4] = iptr[7];
-	optr += 8*4;
-	iptr += 8;
-	count -= 8;
-      }
-      while(count--) {
-	*optr = *iptr++;
-	optr+=4;
-      }
-    }
-    else {
-      pixel = *iptr++;
-      while(count>=8) {
-	optr[0*4] = pixel;
-	optr[1*4] = pixel;
-	optr[2*4] = pixel;
-	optr[3*4] = pixel;
-	optr[4*4] = pixel;
-	optr[5*4] = pixel;
-	optr[6*4] = pixel;
-	optr[7*4] = pixel;
-	optr += 8*4;
-	count -= 8;
-      }
-      while(count--) {
-	*optr = pixel;
-	optr+=4;
-      }
-    }
-  }
-}
-
-/****************************************************/
-static void readtab(const _image *im, unsigned long *tab, int n)
-{
-  while (n) {
-    *tab++ = getlong(im);
-    n--;
-  }
-}
-
-
-/*****************************************************/
-static void addimgtag(byte *dptr, int xsize, int ysize)
-{
-  /* this is used to extract image data from core dumps. 
-     I doubt this is necessary...  --jhb */
-
-  dptr    = dptr + (xsize * ysize * 4);
-  dptr[0] = 0x12;  dptr[1] = 0x34;  dptr[2] = 0x56;  dptr[3] = 0x78;
-  dptr += 4;
-
-  dptr[0] = 0x59;  dptr[1] = 0x49;  dptr[2] = 0x33;  dptr[3] = 0x33;
-  dptr += 4;
-
-  dptr[0] = 0x69;  dptr[1] = 0x43;  dptr[2] = 0x42;  dptr[3] = 0x22;
-  dptr += 4;
-
-  dptr[0] = (xsize>>24)&0xff;
-  dptr[1] = (xsize>>16)&0xff;
-  dptr[2] = (xsize>> 8)&0xff;
-  dptr[3] = (xsize    )&0xff;
-  dptr += 4;
-
-  dptr[0] = (ysize>>24)&0xff;
-  dptr[1] = (ysize>>16)&0xff;
-  dptr[2] = (ysize>> 8)&0xff;
-  dptr[3] = (ysize    )&0xff;
-}
-
-/* byte order independent read/write of shorts and longs. */
-/*****************************************************/
-static unsigned short getshort( const _image *im)
-{
-  byte buf[2];
-  ImageIO_read( im, buf, (size_t) 2);
-  return (buf[0]<<8)+(buf[1]<<0);
-}
-
-/*****************************************************/
-static unsigned long getlong( const _image *im )
-{
-  byte buf[4];
-  ImageIO_read( im, buf, (size_t) 4);
-  return (((unsigned long) buf[0])<<24) + (((unsigned long) buf[1])<<16)
-       + (((unsigned long) buf[2])<<8) + buf[3];
-}
-
-/*****************************************************/
-CGAL_INLINE_FUNCTION
-int readIrisImage( const char *, _image *im ) {
-  byte   *rawdata, *rptr;
-  byte   *pic824,  *bptr, *iptr;
-  int     i, j, size;
-  unsigned short imagic, type;
-  int xsize, ysize, zsize;
-
-
-  /* read header information from file */
-  imagic = getshort( im );
-  type   = getshort( im );
-  getshort( im );
-  xsize  = getshort( im );
-  ysize  = getshort( im );
-  zsize  = getshort( im );
-
-  if ( ImageIO_error(im) ) return( 0 );
-
-  if (imagic != IRIS_MAGIC) return( 0 );
-
-  rawdata = getimagedata(im, type, xsize, ysize, zsize);
-  if (!rawdata) return( 0 );
-
-  if ( ImageIO_error(im) ) return( 0 );   /* probably truncated file */
-
-
-  /*  t1=texture_alloc();
-  (void) strcpy(t1->name,fname);
-  t1->type=IRIS;
-  
-  t1->nrows = ysize;
-  t1->ncols = xsize;
-    
-  t1->image = create_int_array(t1->nrows,t1->ncols);*/
-
-  /* got the raw image data.  Convert to an XV image (1,3 bytes / pix) */
-  if (zsize < 3) 
-    {  /* grayscale */
-      im->xdim = xsize;
-      im->ydim = ysize;
-      im->zdim = 1;
-      im->vdim = 1;
-      im->wdim = 1;
-      im->wordKind = WK_FIXED;
-      im->sign = SGN_UNSIGNED;
-      im->data = ImageIO_alloc(xsize * ysize);
-
-      pic824 = (byte *) ImageIO_alloc((size_t) xsize * ysize);
-      if (!pic824) exit(-1);
-      
-      /* copy plane 3 from rawdata into pic824, inverting pic vertically */
-      for (i = 0, bptr = pic824; i < (int) ysize; i++) 
-	{
-	  rptr = rawdata + 3 + ((ysize - 1) - i) * (xsize * 4);
-	  for (j = 0; j < (int) xsize; j++, bptr++, rptr += 4)
-	    *bptr = *rptr;
-	}
-      
-      
-      size = im->xdim * im->ydim;
-      for (bptr = pic824, iptr = (unsigned char *) im->data,
-	     i = 0; i < size; ++i, ++iptr, ++bptr)
-	{
-	  *iptr = *bptr;
-	}
-      
-      ImageIO_free(pic824);
-    
-  }
-
-  else {  /* truecolor */
-    im->xdim = xsize;
-    im->ydim = ysize;
-    im->zdim = zsize / 3;
-    im->vdim = 4;
-    im->wdim = 1;
-    im->wordKind = WK_FIXED;
-    im->sign = SGN_UNSIGNED;
-    im->data = ImageIO_alloc(xsize * ysize * im->zdim * 4);
-
-    pic824 = (byte *) ImageIO_alloc((size_t) xsize * ysize * 3);
-    if (!pic824) 
-      exit(1);
-    
-    /* copy plane 3 from rawdata into pic824, inverting pic vertically */
-    for (i = 0, bptr = pic824; i<(int) ysize; i++) 
-      {
-	rptr = rawdata + ((ysize - 1) - i) * (xsize * 4);
-
-	for (j=0; j<(int) xsize; j++, rptr += 4) {
-	  *bptr++ = rptr[3];
-	  *bptr++ = rptr[2];
-	  *bptr++ = rptr[1];
-	}
-      }
-    
-    
-    size = im->xdim * im->ydim;
-    for (bptr = pic824, iptr = (unsigned char *) im->data, i = 0;
-	 i < size; ++i, iptr += 4, bptr += 3)
-      {
-	if ( _getEndianness() == END_LITTLE ) {
-	  iptr[0] = 0xFF;
-	  iptr[1] = bptr[2];
-	  iptr[2] = bptr[1];
-	  iptr[3] = bptr[0];
-	}
-	else {
-	  iptr[0] = bptr[0];
-	  iptr[1] = bptr[1];
-	  iptr[2] = bptr[2];
-	  iptr[3] = 0xFF;
-	}
-      }
-      ImageIO_free(pic824);
-  }
-
-  ImageIO_free(rawdata);
-
-  return 1;
-}     
-
-
-
-
-/****************************************************/
-static byte *getimagedata(const _image *im, unsigned short type, int xsize, int ysize,
-			  int zsize)
-{
-  /* read in a B/W RGB or RGBA iris image file and return a 
-     pointer to an array of 4-byte pixels, arranged ABGR, NULL on error */
-
-  byte   *base, *lptr;
-  byte   *verdat;
-  int     y, z, tablen;
-  int     bpp, rle, badorder;
-  int     rlebuflen;
-  byte *rledat;
-  unsigned long *starttab, *lengthtab, cur;
-
-
-  rle     = ISRLE(type);
-  bpp     = BPP(type);
-
-  if (bpp != 1) {
-    return (byte *) NULL;
-  }
-
-  if (rle) {
-
-    rlebuflen = 2 * xsize + 10;
-    tablen    = ysize * zsize;
-    starttab  = (unsigned long *) ImageIO_alloc((size_t) tablen * sizeof(long));
-    lengthtab = (unsigned long *) ImageIO_alloc((size_t) tablen * sizeof(long));
-    rledat    = (byte *)   ImageIO_alloc((size_t) rlebuflen);
-
-    if (!starttab || !lengthtab || !rledat) 
-      exit(1);
-
-    ImageIO_seek( im, 512L, SEEK_SET );
-    readtab(im, starttab,  tablen);
-    readtab(im, lengthtab, tablen);
-
-    if ( ImageIO_error(im) ) {
-      ImageIO_free(starttab);  ImageIO_free(lengthtab);  ImageIO_free(rledat);
-      return (byte *) NULL;
-    }
-
-
-    /* check data order */
-    cur = 0;
-    badorder = 0;
-    for (y=0; y<ysize && !badorder; y++) {
-      for (z=0; z<zsize && !badorder; z++) {
-	if (starttab[y+z*ysize] < cur) badorder = 1;
-	else cur = starttab[y+z*ysize];
-      }
-    }
-
-    ImageIO_seek( im, (long) (512 + 2*tablen*4), 0);
-
-    cur = 512 + 2*tablen*4;
-
-    base = (byte *) ImageIO_alloc((size_t) (xsize*ysize+TAGLEN) * 4);
-    if (!base) 
-      exit(1);
-
-    addimgtag(base,xsize,ysize);
-
-    if (badorder) {
-      for (z=0; z<zsize; z++) {
-	lptr = base;
-	for (y=0; y<ysize; y++) {
-	  if (cur != starttab[y+z*ysize]) {
-	    ImageIO_seek( im, (long) starttab[y+z*ysize], 0);
-	    cur = starttab[y+z*ysize];
-	  }
-
-	  if (lengthtab[y+z*ysize]>(unsigned long)rlebuflen) {
-	    ImageIO_free(starttab); ImageIO_free(lengthtab); ImageIO_free(rledat); ImageIO_free(base);
-	    return (byte *) NULL;
-	  }
-	  ImageIO_read(im, rledat, (size_t) lengthtab[y+z*ysize]);
-	  cur += lengthtab[y+z*ysize];
-	  expandrow(lptr,rledat,3-z);
-	  lptr += (xsize * 4);
-	}
-      }
-    }
-    else {
-      lptr = base;
-      for (y=0; y<ysize; y++) {
-	for (z=0; z<zsize; z++) {
-	  if (cur != starttab[y+z*ysize]) {
-	    ImageIO_seek( im, (long) starttab[y+z*ysize], 0);
-	    cur = starttab[y+z*ysize];
-	  }
-	  
-	  ImageIO_read(im, rledat, (size_t) lengthtab[y+z*ysize]);
-	  cur += lengthtab[y+z*ysize];
-	  expandrow(lptr,rledat,3-z);
-	}
-	lptr += (xsize * 4);
-      }
-    }
-
-    ImageIO_free(starttab);
-    ImageIO_free(lengthtab);
-    ImageIO_free(rledat);
-    return base;
-  }      /* end of RLE case */
-
-  else {  /* not RLE */
-    verdat = (byte *) ImageIO_alloc((size_t) xsize);
-    base   = (byte *) ImageIO_alloc((size_t) (xsize*ysize+TAGLEN) * 4);
-    if (!base || !verdat) 
-      exit(1);
-
-    addimgtag(base,xsize,ysize);
-
-    ImageIO_seek( im, 512L,0);
-
-    for (z=0; z<zsize; z++) {
-      lptr = base;
-      for (y=0; y<ysize; y++) {
-	ImageIO_read(im, verdat, (size_t) xsize);
-	interleaverow(lptr,verdat,3-z,xsize);
-	lptr += (xsize * 4);
-      }
-    }
-
-    ImageIO_free(verdat);
-    return base;
-  }
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/mincio.cpp b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/mincio.cpp
deleted file mode 100644
index 8bf8b33..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/mincio.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-#ifndef CGAL_HEADER_ONLY
-
-#include "mincio.h"
-#include "mincio_impl.h"
-
-#endif // CGAL_HEADER_ONLY
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/mincio.h b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/mincio.h
deleted file mode 100644
index 46cd034..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/mincio.h
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-#ifndef MINCIO_H
-#define MINCIO_H
-
-#ifdef MINC_FILES
-
-#include <CGAL/ImageIO.h>
-#include <minc.h>
-
-
-/** read an image from a minc file
-    @param im image structure
-    @param name image file name
-    @param startx returned X coordinate of origin vertor
-    @param starty returned Y coordinate of origin vertor
-    @param startz returned Z coordinate of origin vertor
-    @param stepx returned X coordinate of step vertor
-    @param stepy returned Y coordinate of step vertor
-    @param stepz returned Z coordinate of step vertor
-    @param Xcosine 3 dimensional array containing X axis cosine directions
-    @param Ycosine 3 dimensional array containing Y axis cosine directions
-    @param Zcosine 3 dimensional array containing Z axis cosine directions
-    @return a negative value in case of failure */
-int readMincHeader(_image *im, const char* name,
-		   double *startx, double *starty, double *startz,
-		   double *stepx, double *stepy, double *stepz,
-		   double *Xcosine, double *Ycosine, double *Zcosine);
-
-/** write an image in a minc file
-    @param im image structure
-    @param name image file name
-    @param sourceName original minc file name
-    @param startx origin X coordinate
-    @param starty origin Y coordinate
-    @param startz origin Z coordinate
-    @param stepx returned X coordinate of step vertor
-    @param stepy returned Y coordinate of step vertor
-    @param stepz returned Z coordinate of step vertor
-    @param Xcosine 3 dimensional array containing X axis cosine directions
-    @param Ycosine 3 dimensional array containing Y axis cosine directions
-    @param Zcosine 3 dimensional array containing Z axis cosine directions
-    @param range 2 dimensional array containing min an max image intensity
-    @return a negative value in case of failure */
-int writeMincFile( const _image* im, const char *name, const char *sourceName,
-		   double startx, double starty, double startz,
-		   double stepx, double stepy, double stepz,
-		   const double *Xcosine, const double *Ycosine,
-		   const double *Zcosine, const double *range );
-
-
-#endif
-
-#ifdef CGAL_HEADER_ONLY
-#include "mincio_impl.h"
-#endif // CGAL_HEADER_ONLY
-
-#endif
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/pnm.cpp b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/pnm.cpp
deleted file mode 100644
index 47e0eb2..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/pnm.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-#ifndef CGAL_HEADER_ONLY
-
-#include "pnm.h"
-#include "pnm_impl.h"
-
-#endif // CGAL_HEADER_ONLY
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/pnm.h b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/pnm.h
deleted file mode 100644
index 6a5d379..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/pnm.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-#ifndef PNM_H
-#define PNM_H
-
-#include <stdio.h>
-
-#include <CGAL/ImageIO.h>
-
-
-int readPpmImage(const char *name,_image *im);
-int writePpmImage(char *name, _image *im);
-int readPgmAsciiImage(const char *name,_image *im);
-int readPgmImage(const char *name,_image *im);
-int writePgmImage(char *name,  _image *im);
-int testPgmAsciiHeader(char *magic,const char *name);
-int testPgmHeader(char *magic,const char *name);
-int testPpmHeader(char *magic,const char *name);
-PTRIMAGE_FORMAT createPgmFormat();
-PTRIMAGE_FORMAT createPgmAscIIFormat();
-PTRIMAGE_FORMAT createPpmFormat();
-
-#ifdef CGAL_HEADER_ONLY
-#include "pnm_impl.h"
-#endif // CGAL_HEADER_ONLY
-
-#endif
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/pnm_impl.h b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/pnm_impl.h
deleted file mode 100644
index 58c5a98..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/pnm_impl.h
+++ /dev/null
@@ -1,643 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-#ifdef CGAL_HEADER_ONLY
-#define CGAL_INLINE_FUNCTION inline
-#else
-#define CGAL_INLINE_FUNCTION
-#endif
-
-#ifdef _MSC_VER
-#pragma warning ( disable : 4068 4786 4081 )
-#endif
-
-#include <string.h>
-#include <sstream>
-
-#include "fgetns.h"
-
-
-
-
-/** pnm - portable anymap file format */
-/** Magic header for pgm - portable graymap file format */
-#define PGM_ASCII_MAGIC "P2"
-#define PGM_MAGIC "P5"
-
-/** Magic header for ppm - portable pixmap file format */
-#define PPM_MAGIC "P6"
-
-
-
-#define _LGTH_STRING_ 1024
-
-
-CGAL_INLINE_FUNCTION
-int testPpmHeader(char *magic,const char *) {
-  if( !strncmp(magic, PPM_MAGIC, strlen(PPM_MAGIC))) 
-    return 0;
-  else 
-    return -1;
-}
-CGAL_INLINE_FUNCTION
-int testPgmHeader(char *magic,const char *) {
-  if (( !strncmp(magic, PGM_MAGIC, strlen(PGM_MAGIC))))
-    return 0;
-  else 
-    return -1;
-}
-CGAL_INLINE_FUNCTION
-int testPgmAsciiHeader(char *magic,const char *) {
-  if  ( !strncmp(magic, PGM_ASCII_MAGIC, strlen(PGM_ASCII_MAGIC)))
-    return 0;
-  else 
-    return -1;
-}
-
-CGAL_INLINE_FUNCTION
-PTRIMAGE_FORMAT createPgmFormat() {
-  PTRIMAGE_FORMAT f=(PTRIMAGE_FORMAT) ImageIO_alloc(sizeof(IMAGE_FORMAT));
-
-  f->testImageFormat=&testPgmHeader;
-  f->readImageHeader=&readPgmImage;
-  f->writeImage=&writePgmImage;
-  strcpy(f->fileExtension,".pgm,.pgm.gz");
-  strcpy(f->realName,"Pgm");
-  return f;
-}
-
-CGAL_INLINE_FUNCTION
-PTRIMAGE_FORMAT createPgmAscIIFormat() {
-  PTRIMAGE_FORMAT f=(PTRIMAGE_FORMAT) ImageIO_alloc(sizeof(IMAGE_FORMAT));
-
-  f->testImageFormat=&testPgmAsciiHeader;
-  f->readImageHeader=&readPgmAsciiImage;
-  f->writeImage=&writePgmImage;
-  strcpy(f->fileExtension,".pgm,.pgm.gz");
-  strcpy(f->realName,"Pgm-ASCII");
-  return f;
-}
-
-CGAL_INLINE_FUNCTION
-PTRIMAGE_FORMAT createPpmFormat() {
-  PTRIMAGE_FORMAT f=(PTRIMAGE_FORMAT) ImageIO_alloc(sizeof(IMAGE_FORMAT));
-
-  f->testImageFormat=&testPpmHeader;
-  f->readImageHeader=&readPpmImage;
-  f->writeImage=&writePpmImage;
-  strcpy(f->fileExtension,".ppm,.ppm.gz");
-  strcpy(f->realName,"Ppm");
-  return f;
-}
-
-
-/*
-       The  portable pixmap format is a lowest common denominator
-       color image file format.
-
-       The definition is as follows:
-
-       - A  "magic  number" for identifying the file type.  A pgm
-         file's magic number is the two characters "P6".
-
-       - Whitespace (blanks, TABs, CRs, LFs).
-
-       - A width, formatted as ASCII characters in decimal.
-
-       - Whitespace.
-
-       - A height, again in ASCII decimal.
-       - Whitespace.
-
-       - The maximum color value (Maxval), again in  ASCII  deci-
-         mal.  Must be less than 65536.
-
-       - Newline or other single whitespace character.
-
-       - A  raster  of  Width * Height pixels, proceeding through
-         the image in normal English reading order.   Each  pixel
-         is  a  triplet  of red, green, and blue samples, in that
-         order.  Each sample is represented  in  pure  binary  by
-         either 1 or 2 bytes.  If the Maxval is less than 256, it
-         is 1 byte.  Otherwise, it is 2 bytes.  The most signifi-
-         cant byte is first.
-
-       - In the raster, the sample values are proportional to the
-         intensity of the CIE Rec. 709 red, green,  and  blue  in
-         the pixel.  A value of Maxval for all three samples rep-
-         resents CIE D65 white and the most intense color in  the
-         color  universe  of  which  the image is part (the color
-         universe is all the colors in all images to  which  this
-         image might be compared).
-
-       - Characters  from  a  "#" to the next end-of-line, before
-         the maxval line, are comments and are ignored.
-
-*/
-CGAL_INLINE_FUNCTION
-int readPpmImage(const char *name,_image *im)
-{
-  char string[256];
-  int x=0, y=0;
-  int max=0;
-  
-  fgetns( string, 255, im );
-  if ( strncmp(string, PPM_MAGIC, strlen(PPM_MAGIC) ) ) {
-    fprintf( stderr, "readPpmImage: bad magic string in \'%s\'\n", name );
-    return( -1 );
-  }
-  
-  do {
-    fgetns( string, 255, im );
-
-    if ( string[0] != '#' ) {
-      if ( x == 0 && y == 0 ) {
-	sscanf( string, "%d %d", &x, &y );
-      }
-      else if ( max == 0 ) {
-	sscanf( string, "%d", &max );
-      }
-    }
-  } while ( max == 0 );
-
-
-  im->xdim = static_cast<std::size_t>(x);
-  im->ydim = static_cast<std::size_t>(y);
-  im->zdim = 1;
-  im->vdim = 3;
-
-  im->wordKind = WK_FIXED;
-  im->sign = SGN_UNSIGNED;
-
-  if ( max < 256 ) im->wdim = 1;
-  else if ( max < 65536 ) {
-    im->wdim = 2;
-    fprintf( stderr, "readPpmImage: Warning, data of \'%s\' may have to be swapped\n", name );
-  }
-  else {
-    fprintf( stderr, "readPpmImage: max value too large (%d) in \'%s\'\n", max, name );
-    return( -1 );
-  }
-  im->data = ImageIO_alloc( x*y*3 );		     
-  
-  ImageIO_read( im, im->data,  x*y*3 );
-  
-  return 1;
-}
-
-CGAL_INLINE_FUNCTION
-int writePpmImage( char *name,_image *im )
-{
-  std::ostringstream string;
-  int max;
-  unsigned int i;
-
-  if ( im->xdim <= 0 || im->ydim <= 0 || im->zdim != 1 || im->vdim != 3 ) {
-    fprintf( stderr, "writePpmImage: bad dimensions, unable to write '%s'\n", name );
-    return -1;
-  }
-  if ( im->wordKind != WK_FIXED || im->sign != SGN_UNSIGNED 
-       || ( im->wdim != 1 && im->wdim != 2 ) ) {
-    fprintf( stderr, "writePpmImage: bad type, unable to write '%s'\n", name );
-    return -1;  
-  }
-  
-  _openWriteImage( im, name );
-  
-  if(!im->fd) {
-    fprintf(stderr, "writeInrimage: error: unable to open file \'%s\'\n", name );
-    return ImageIO_OPENING;
-  }
-
-  string << PPM_MAGIC << "\n";
-  string << "# CREATOR: pnm.c $Revision$ $Date$\n";
-  string << im->xdim << " " << im->ydim << "\n";
-
-  max = 0;
-  switch ( im->wdim ) {
-  case 1 :
-    {
-      unsigned char *buf = (unsigned char *)im->data;
-      for ( i=0; i<im->xdim*im->ydim*3; i++, buf++ )
-	if ( max < *buf ) max = *buf;
-    }
-    break;
-  case 2 :
-    {
-      unsigned short *buf = (unsigned short *)im->data;
-      for ( i=0; i<im->xdim*im->ydim*3; i++, buf++ )
-	if ( max < *buf ) max = *buf;
-    }
-    break;
-  }
-
-  if ( max == 0 ) max = 1;
-  string << max << "\n";
-  ImageIO_write(im, string.str().data(), string.str().length());
-
-  if ( im->wdim == 1 || ( im->wdim == 2 && max > 255 ) ) {
-    ImageIO_write( im, im->data, im->xdim*im->ydim*3*im->wdim );
-  }
-  else {
-    /* 2 octets, but max <= 255
-       has to be converted on one octet
-    */
-    unsigned short *buf = (unsigned short *)im->data;
-    unsigned char *tmp = (unsigned char *)ImageIO_alloc( im->xdim*im->ydim*3 );
-    if ( tmp == NULL ) {
-      fprintf( stderr, "writePpmImage: unable to allocate auxiliary buffer\n" );
-      return -1; 
-    }
-    for ( i=0; i<im->xdim*im->ydim*3; i++, buf++ )
-      tmp[i] = (unsigned char)*buf;
-    ImageIO_write( im, tmp, im->xdim*im->ydim*3 );
-    ImageIO_free( tmp );
-  }
-  ImageIO_close( im );
-  im->openMode = OM_CLOSE;
-  return 1;
-}
-
-
-
-/*
-       The portable graymap format is a lowest common denominator
-       grayscale file format.  The definition is as follows:
-
-       - A "magic number" for identifying the file type.   A  pgm
-         file's magic number is the two characters "P2".
-
-       - Whitespace (blanks, TABs, CRs, LFs).
-
-       - A width, formatted as ASCII characters in decimal.
-
-       - Whitespace.
-       - A height, again in ASCII decimal.
-
-       - Whitespace.
-
-       - The maximum gray value (Maxval), again in ASCII decimal.
-         Must be less than 65536.
-
-       - Newline or other single whitespace character.
-
-       - A raster of  Width  *  Height  gray  values,  proceeding
-         through the image in normal English reading order.  Each
-         gray value is a number from 0  through  Maxval,  with  0
-         being  black and Maxval being white.  Each gray value is
-         represented in pure binary by either 1 or 2  bytes.   If
-         the  Maxval  is less than 256, it is 1 byte.  Otherwise,
-         it is 2 bytes.  The most significant byte is first.
-
-       - Characters from a "#" to the  next  end-of-line,  before
-         the maxval line, are comments and are ignored.
-*/
-CGAL_INLINE_FUNCTION
-int readPgmAsciiImage(const char *name,_image *im)
-{
-  char string[256];
-  int x=0, y=0;
-  int max=0;
-
-  int n;
-  char *tmp;
-  int iv;
-
-  fgetns( string, 255, im );
-  if ( strncmp(string, PGM_ASCII_MAGIC, strlen(PGM_ASCII_MAGIC) ) ) {
-    fprintf( stderr, "readAsciiPgmImage: bad magic string in \'%s\'\n", name );
-    return( -1 );
-  }
-  
-  do {
-    fgetns( string, 255, im );
-
-    if ( string[0] != '#' ) {
-      if ( x == 0 && y == 0 ) {
-	sscanf( string, "%d %d", &x, &y );
-      }
-      else if ( max == 0 ) {
-	sscanf( string, "%d", &max );
-      }
-    }
-  } while ( max == 0 );
-
-  im->xdim = x;
-  im->ydim = y;
-  im->zdim = 1;
-  im->vdim = 1;
-
-  im->wordKind = WK_FIXED;
-  im->sign = SGN_UNSIGNED;
-
-  if ( max < 256 ) im->wdim = 1;
-  else if ( max < 65536 ) {
-    im->wdim = 2;
-  }
-  else {
-    fprintf( stderr, "readAsciiPgmImage: max value too large (%d) in \'%s\'\n", max, name );
-    return( -1 );
-  }
-  im->data = ImageIO_alloc( x*y );		     
-  
-  n=0;
-
-  while( fgetns( string, 255, im ) != 0 && n < x*y ) {
-    tmp = string;
-    while ( *tmp != '\n' && *tmp != '\0' && *tmp != EOF && n < x*y ) {
-      /* skip trailing whitespace
-       */
-      while ( *tmp == ' ' || *tmp == '\t' )
-	tmp++;
-      if ( *tmp == '\0' || *tmp == '\n' || *tmp == EOF )
-	continue;
-      
-      /* read a number
-       */
-      switch ( im->wordKind ) {
-      case WK_FIXED :
-	if ( sscanf( tmp, "%d", &iv ) != 1 ) {
-	  fprintf( stderr, "readAsciiPgmImage: error in reading ascii data\n" );
-	  ImageIO_free( im->data ); im->data = NULL;
-	  return 0;
-	}
-	break;
-      default :
-	ImageIO_free( im->data ); im->data = NULL;
-	return 0;
-      }
-	  
-      if ( im->wdim == 1 ) {
-	unsigned char *buf = (unsigned char *)im->data;
-	buf += n;
-	if ( iv < 0 )        *buf = (unsigned char)0;
-	else if ( iv > 255 ) *buf = (unsigned char)255;
-	else                 *buf = (unsigned char)iv;
-	n ++;
-      }
-      else if ( im->wdim == 2 ) {
-	unsigned short int *buf = (unsigned short int *)im->data;
-	buf += n;
-	if ( iv < 0 )          *buf = (unsigned short int)0;
-	else if ( iv > 65535 ) *buf = (unsigned short int)65535;
-	else                   *buf = (unsigned short int)iv;
-	n ++;
-      }
-      else {
-	fprintf( stderr, "readAsciiPgmImage: word im not handled\n" );
-	ImageIO_free( im->data ); im->data = NULL;
-	return 0;
-      }
-      
-      /* skip a number 
-       */
-      while ( (*tmp >= '0' && *tmp <= '9') || *tmp == '.' || *tmp == '-' )
-	tmp++;
-    }
-  }
-
-  
-  return 1;
-}
-
-
-
-
-/*
-       The portable graymap format is a lowest common denominator
-       grayscale file format.  The definition is as follows:
-
-       - A "magic number" for identifying the file type.   A  pgm
-         file's magic number is the two characters "P5".
-
-       - Whitespace (blanks, TABs, CRs, LFs).
-
-       - A width, formatted as ASCII characters in decimal.
-
-       - Whitespace.
-       - A height, again in ASCII decimal.
-
-       - Whitespace.
-
-       - The maximum gray value (Maxval), again in ASCII decimal.
-         Must be less than 65536.
-
-       - Newline or other single whitespace character.
-
-       - A raster of  Width  *  Height  gray  values,  proceeding
-         through the image in normal English reading order.  Each
-         gray value is a number from 0  through  Maxval,  with  0
-         being  black and Maxval being white.  Each gray value is
-         represented in pure binary by either 1 or 2  bytes.   If
-         the  Maxval  is less than 256, it is 1 byte.  Otherwise,
-         it is 2 bytes.  The most significant byte is first.
-
-       - Characters from a "#" to the  next  end-of-line,  before
-         the maxval line, are comments and are ignored.
-*/
-CGAL_INLINE_FUNCTION
-int readPgmImage(const char *name,_image *im)
-{
-  
-  char string[256];
-  int x=0, y=0;
-  int max=0;
-  
-  fgetns( string, 255, im );
-  if ( strncmp(string, PGM_MAGIC, strlen(PGM_MAGIC) ) ) {
-    fprintf( stderr, "readPgmImage: bad magic string in \'%s\'\n", name );
-    return( -1 );
-  }
-  
-  do {
-    fgetns( string, 255, im );
-
-    if ( string[0] != '#' ) {
-      if ( x == 0 && y == 0 ) {
-	sscanf( string, "%d %d", &x, &y );
-      }
-      else if ( max == 0 ) {
-	sscanf( string, "%d", &max );
-      }
-    }
-  } while ( max == 0 );
-
-
-  im->xdim = x;
-  im->ydim = y;
-  im->zdim = 1;
-  im->vdim = 1;
-
-  im->wordKind = WK_FIXED;
-  im->sign = SGN_UNSIGNED;
-
-  if ( max < 256 ) im->wdim = 1;
-  else if ( max < 65536 ) {
-    im->wdim = 2;
-    fprintf( stderr, "readPgmImage: Warning, data of \'%s\' may have to be swapped\n", name );
-  }
-  else {
-    fprintf( stderr, "readPgmImage: max value too large (%d) in \'%s\'\n", max, name );
-    return( -1 );
-  }
-  im->data = ImageIO_alloc( x*y );		     
-  
-  ImageIO_read( im, im->data,  x*y );
-  
-  return 1;
-}
-
-CGAL_INLINE_FUNCTION
-int writePgmImage(char *name,_image *im  )
-{
-  char string[256];
-  int max;
-  unsigned int i;
-
-  if ( im->xdim <= 0 || im->ydim <= 0 || im->zdim != 1 || im->vdim != 1 ) {
-    fprintf( stderr, "writePgmImage: bad dimensions, unable to write '%s'\n", name );
-    return -1;
-  }
-  if ( im->wordKind != WK_FIXED || im->sign != SGN_UNSIGNED 
-       || ( im->wdim != 1 && im->wdim != 2 ) ) {
-    fprintf( stderr, "writePgmImage: bad type, unable to write '%s'\n", name );
-    return -1;  
-  }
-
-  if ( 0 )
-    im->dataMode = DM_ASCII;
-  
-  _openWriteImage( im, name );
-  
-  if(!im->fd) {
-    fprintf(stderr, "writePgmImage: error: unable to open file \'%s\'\n", name );
-    return ImageIO_OPENING;
-  }
-  
-  if ( im->dataMode == DM_ASCII ) 
-    sprintf( string, "%s\n", PGM_ASCII_MAGIC );
-  else 
-    sprintf( string, "%s\n", PGM_MAGIC );
-  
-  ImageIO_write( im, string, strlen( string ) );
-  sprintf( string, "# CREATOR: pnm.c $Revision$ $Date$\n" );
-  ImageIO_write( im, string, strlen( string ) );
-  sprintf( string, "%zu %zu\n", im->xdim, im->ydim );
-  ImageIO_write( im, string, strlen( string ) );
-  max = 0;
-  switch ( im->wdim ) {
-  case 1 :
-    {
-      unsigned char *buf = (unsigned char *)im->data;
-      for ( i=0; i<im->xdim*im->ydim; i++, buf++ )
-	if ( max < *buf ) max = *buf;
-    }
-    break;
-  case 2 :
-    {
-      unsigned short *buf = (unsigned short *)im->data;
-      for ( i=0; i<im->xdim*im->ydim; i++, buf++ )
-	if ( max < *buf ) max = *buf;
-    }
-    break;
-  }
-  /* max == 0 causes problems for xv */
-  if ( max == 0 ) max = 1;
-  sprintf( string, "%d\n", max );
-  ImageIO_write( im, string, strlen( string ) );
-
-  if ( im->dataMode == DM_ASCII ) {
-    int i, j, n, size;
-    char *str = (char*)ImageIO_alloc( _LGTH_STRING_+1 );
-    size = im->xdim * im->ydim * im->zdim * im->vdim;
-    n = ( im->xdim < 16 ) ? im->xdim : 16;
-    i = 0;
-    switch( im->wdim ) {
-    default :
-      /* can not occur */
-      fprintf( stderr, "writePgmImage: bad type, unable to write '%s'\n", name );
-      ImageIO_close( im );
-      im->openMode = OM_CLOSE;
-      return -1;
-    case 1 :
-      {
-	unsigned char *theBuf = ( unsigned char * )im->data;
-	do {
-	  memset( str, 0, _LGTH_STRING_ );
-	  for ( j=0; j<n && i<size; j++, i++ ) {
-	    sprintf( str+strlen(str), "%d", theBuf[i] );
-	    if ( j<n && i<size ) sprintf( str+strlen(str), " " );
-	  }
-	  sprintf( str+strlen(str), "\n" );
-	  if ( ImageIO_write( im, str, strlen( str ) ) <= 0 ) {
-	    fprintf(stderr, "writePgmImage: error when writing data in \'%s\'\n", name );
-	    return( -3 );
-	  }
-	} while ( i < size );
-      }
-      break;
-    case 2 :
-      {
-	unsigned short int *theBuf = ( unsigned short int * )im->data;
-	do {
-	  memset( str, 0, _LGTH_STRING_ );
-	  for ( j=0; j<n && i<size; j++, i++ ) {
-	    sprintf( str+strlen(str), "%d", theBuf[i] );
-	    if ( j<n && i<size ) sprintf( str+strlen(str), " " );
-	  }
-	  sprintf( str+strlen(str), "\n" );
-	  if ( ImageIO_write( im, str, strlen( str ) ) <= 0 ) {
-	    fprintf(stderr, "writePgmImage: error when writing data in \'%s\'\n", name );
-	    return( -3 );
-	  }
-	} while ( i < size );
-      }
-      break;
-    }
-  }
-  else {
-    if ( im->wdim == 1 || ( im->wdim == 2 && max > 255 ) ) {
-      ImageIO_write( im, im->data, im->xdim*im->ydim*im->wdim );
-    }
-    else {
-      /* 2 octets, but max <= 255
-	 has to be converted on one octet
-      */
-      unsigned short *buf = (unsigned short *)im->data;
-      unsigned char *tmp = (unsigned char *)ImageIO_alloc( im->xdim*im->ydim );
-      if ( tmp == NULL ) {
-	fprintf( stderr, "writePgmImage: unable to allocate auxiliary buffer\n" );
-	return -1; 
-      }
-      for ( i=0; i<im->xdim*im->ydim; i++, buf++ )
-	tmp[i] = (unsigned char)*buf;
-      ImageIO_write( im, tmp, im->xdim*im->ydim );
-      ImageIO_free( tmp );
-    }
-  }
-
-  ImageIO_close( im );
-  im->openMode = OM_CLOSE;
-  return 1;
-}
-
-
-
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/recbuffer.cpp b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/recbuffer.cpp
deleted file mode 100644
index e5d6f00..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/recbuffer.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-#ifndef CGAL_HEADER_ONLY
-
-#include "recbuffer.h"
-#include "recbuffer_impl.h"
-
-#endif // CGAL_HEADER_ONLY
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/recbuffer.h b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/recbuffer.h
deleted file mode 100644
index 79951bf..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/recbuffer.h
+++ /dev/null
@@ -1,203 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-/*************************************************************************
- * recbuffer.h - tools for recursive filtering of 3D and 2D image buffers
- *
- * $Id$
- *
- * Copyright©INRIA 1999
- *
- * DESCRIPTION: 
- *
- *
- *
- * AUTHOR:
- * Gregoire Malandain (greg at sophia.inria.fr)
- * http://www.inria.fr/epidaure/personnel/malandain/
- * 
- * CREATION DATE: 
- * June, 9 1998
- *
- * Copyright Gregoire Malandain, INRIA
- *
- * ADDITIONS, CHANGES
- *
- *
- */
-
-
-#ifndef _recbuffer_h_
-#define _recbuffer_h_
-
-
-#include "typedefs.h"
-#include "recline.h"
-
-
-
-
-
-extern int GradientModulus( void *bufferIn, bufferType typeIn,
-			    void *bufferOut, bufferType typeOut,
-			    int *bufferDims, int *borderLengths,
-			    float *filterCoefs, recursiveFilterType filterType );
-extern int Laplacian_2D( void *bufferIn, bufferType typeIn,
-			 void *bufferOut, bufferType typeOut,
-			 int *bufferDims, int *borderLengths,
-			 float *filterCoefs, recursiveFilterType filterType );
-extern int Laplacian( void *bufferIn, bufferType typeIn,
-		      void *bufferOut, bufferType typeOut,
-		      int *bufferDims, int *borderLengths,
-		      float *filterCoefs, recursiveFilterType filterType );
-
-extern int GradientHessianGradient_2D( void *bufferIn, bufferType typeIn,
-			 void *bufferOut, bufferType typeOut,
-			 int *bufferDims, int *borderLengths,
-			 float *filterCoefs, recursiveFilterType filterType );
-extern int GradientHessianGradient( void *bufferIn, bufferType typeIn,
-		      void *bufferOut, bufferType typeOut,
-		      int *bufferDims, int *borderLengths,
-		      float *filterCoefs, recursiveFilterType filterType );
-
-
-
-
-
-/* Recursive filtering on 3D buffers.
- *
- * DESCRIPTION:
- * Performs recursive filtering on 3D buffers.
- * Each direction (X, Y or Z) is performed 
- * independently (separability).
- *
- * A direction is filtered if there are enough
- * points along this direction (at least 5),
- * if the coefficient along this direction is 
- * positive, and if the derivative's order along
- * this direction is not NODERIVATIVE (see
- * derivativeOrder).
- *
- * Once a line along a direction is extracted for
- * filtering, one may want to add points at both 
- * ends of the line to avoid cut-off effects. The
- * value of each endpoint is repeated n times.
- * Thus the length of the line is increased by 
- * 2*n.
- *
- * PARAMETERS:
- *
- * - bufferDims[0] is the dimension along X,
- *
- *   bufferDims[1] is the dimension along Y,
- *
- *   bufferDims[2] is the dimension along Y.
- *
- * - borderLengths[0] is the number of points to be
- *   added at both ends of each X line (if
- *   positive). The value of each endpoint is 
- *   repeated borderLengths[0] times to produce
- *   a line of length 
- *   bufferDims[0] + 2 * borderLengths[0].
- *
- *   borderLengths[1] is the number of points to be
- *   added at both ends of each Y line.
- *
- *   borderLengths[2] is the number of points to be
- *   added at both ends of each Z line.
- *
- * - derivatives[0] is the order of the derivative 
- *   to be computed along direction X. 
- *
- *   derivatives[1] is the order of the derivative 
- *   to be computed along direction Y. 
- *
- *   derivatives[2] is the order of the derivative 
- *   to be computed along direction Z. 
- *
- * - filterCoefs[0] is the coefficient of the filter
- *   to be applied along direction X. 
- *
- *   filterCoefs[1] is the coefficient of the filter
- *   to be applied along direction Y. 
- *
- *   filterCoefs[2] is the coefficient of the filter
- *   to be applied along direction Z. 
- *
- * - filterType is the type of recursive filter to
- *   be applied to the 3D buffer.
- *
- * RETURN:
- *
- * - 0 in case of error
- *
- * - 1 if successful
- *
- * SEE ALSO:
- *
- * - bufferType.
- *
- * - derivativeOrder.
- *
- * - recursiveFilterType.
- *
- * - InitRecursiveCoefficients
- */
-extern int RecursiveFilterOnBuffer( void *bufferIn, /* input buffer */
-				    bufferType typeIn, /* type of the input buffer */
-				    void *bufferOut, /* output buffer */
-				    bufferType typeOut, /* type of the output buffer */
-				    int *bufferDims, /* buffers' dimensions */
-				    int *borderLengths, /* number of points to be added at both ends */
-				    derivativeOrder *derivatives, /* order of derivatives to be computed */
-				    float *filterCoefs, /* coefficients of the filters to be applied */
-				    recursiveFilterType filterType /* type of the recursive filter to be applied */
-				    );
-
-
-
-/* Turn on verbose mode.
- *
- * DESCRIPTION:
- * Some information will be written on stderr when processing.
- * It will turn on the verbose mode of recline too, by 
- * calling Recline_verbose();
- */
-extern void Recbuffer_verbose ( );
-
-
-
-/* Turn off verbose mode.
- *
- * DESCRIPTION:
- * Nothing will be written on stderr when processing.
- * Exactly the contrary of Recbuffer_verbose ().
- * It will turn off the verbose mode of recline too.
- */
-extern void Recbuffer_noverbose ( );
-
-
-#ifdef CGAL_HEADER_ONLY
-#include "recbuffer_impl.h"
-#endif // CGAL_HEADER_ONLY
-
-
-#endif /* _recbuffer_h_ */
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/recbuffer_impl.h b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/recbuffer_impl.h
deleted file mode 100644
index 43c8a53..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/recbuffer_impl.h
+++ /dev/null
@@ -1,1743 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-/*************************************************************************
- * recbuffer.c - tools for recursive filtering of 3D and 2D image buffers
- *
- * $Id$
- *
- * Copyright©INRIA 1999
- *
- * DESCRIPTION: 
- *
- * recursive filtering of a buffer (a [1,2,3]D array)
- * according that the filtering is separable
- *
- *
- *
- * AUTHOR:
- * Gregoire Malandain (greg at sophia.inria.fr)
- * 
- * CREATION DATE: 
- * June, 9 1998
- *
- * Copyright Gregoire Malandain, INRIA
- *
- * ADDITIONS, CHANGES
- *
- * * Jul 6 1999 (Gregoire Malandain)
- *   a bug in RecursiveFilterOnBuffer (*&%^@$^ cut and paste)
- *
- */
-
-#ifdef CGAL_HEADER_ONLY
-#define CGAL_INLINE_FUNCTION inline
-#else
-#define CGAL_INLINE_FUNCTION
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-
-#include "convert.h"
-
-#ifdef CGAL_HEADER_ONLY
-
-inline int& get_static_verbose_recbuffer()
-{
-  static int _VERBOSE_ = 0;
-  return _VERBOSE_;
-}
-
-#else // CGAL_HEADER_ONLY
-
-static int _VERBOSE_ = 0;
-
-inline int& get_static_verbose_recbuffer()
-{ return _VERBOSE_; }
-
-#endif // CGAL_HEADER_ONLY
-
-
-#define EXIT_ON_FAILURE 0
-#define EXIT_ON_SUCCESS 1
-
-/*
- *
- * Gradient modulus
- *
- *
- */
-CGAL_INLINE_FUNCTION
-int GradientModulus( void *bufferIn,
-		     bufferType typeIn,
-		     void *bufferOut,
-		     bufferType typeOut,
-		     int *bufferDims,
-		     int *borderLengths,
-		     float *filterCoefs,
-		     recursiveFilterType filterType )
-{
-  const char *proc = "GradientModulus";
-  float *auxBuf = NULL;
-  float *tmpBuf = NULL, *grdBuf = NULL;
-  int sizeAuxBuf = 0;
-  derivativeOrder derivatives[3];
-  int i;
-
-
-  sizeAuxBuf = bufferDims[0] * bufferDims[1] * bufferDims[2];
-  if ( typeOut != CGAL_FLOAT || bufferIn == bufferOut )
-    sizeAuxBuf *= 2;
-
-
-  /* allocation des buffers de calcul
-   */
-  auxBuf = (float*)malloc( sizeAuxBuf * sizeof(float) );
-  if ( auxBuf == NULL ) {
-    if ( _VERBOSE_ > 0 )
-      fprintf( stderr, "%s: unable to allocate auxiliary buffer\n", proc );
-    return( EXIT_ON_FAILURE );
-  }
-  tmpBuf = auxBuf;
-  if ( typeOut != CGAL_FLOAT || bufferIn == bufferOut ) {
-    grdBuf  = tmpBuf;
-    grdBuf += bufferDims[0] * bufferDims[1] * bufferDims[2];
-  } else {
-    grdBuf  = (float*)bufferOut;
-  }
-  
-  /* cas 2D
-   */
-  if ( bufferDims[2] == 1 ) {
-
-    derivatives[0] = DERIVATIVE_1; 
-    derivatives[1] = DERIVATIVE_0;
-    derivatives[2] = NODERIVATIVE;
-    if ( RecursiveFilterOnBuffer( bufferIn, typeIn, (void*)grdBuf, CGAL_FLOAT,
-				  bufferDims, borderLengths, derivatives,
-				  filterCoefs, filterType ) != EXIT_ON_SUCCESS ) {
-      if ( _VERBOSE_ ) 
-	fprintf( stderr, "%s: unable to compute X derivative (2D)\n", proc );
-      free( auxBuf );
-      return( EXIT_ON_FAILURE );
-    }
-
-    derivatives[0] = DERIVATIVE_0; 
-    derivatives[1] = DERIVATIVE_1;
-    derivatives[2] = NODERIVATIVE;
-    if ( RecursiveFilterOnBuffer( bufferIn, typeIn, (void*)tmpBuf, CGAL_FLOAT,
-				  bufferDims, borderLengths, derivatives,
-				  filterCoefs, filterType ) != EXIT_ON_SUCCESS ) {
-      if ( _VERBOSE_ ) 
-	fprintf( stderr, "%s: unable to compute Y derivative (2D)\n", proc );
-      free( auxBuf );
-      return( EXIT_ON_FAILURE );
-    }
-    
-    sizeAuxBuf = bufferDims[0] * bufferDims[1] * bufferDims[2];
-    for ( i = 0; i < sizeAuxBuf; i++ )
-      grdBuf[i] = (float)sqrt( grdBuf[i]*grdBuf[i] + tmpBuf[i]*tmpBuf[i] );
-    
-  } else {
-    
-    derivatives[0] = NODERIVATIVE;
-    derivatives[1] = NODERIVATIVE;
-    derivatives[2] = DERIVATIVE_0;
-    if ( RecursiveFilterOnBuffer( bufferIn, typeIn, (void*)tmpBuf, CGAL_FLOAT,
-				  bufferDims, borderLengths, derivatives,
-				  filterCoefs, filterType ) != EXIT_ON_SUCCESS ) {
-      if ( _VERBOSE_ ) 
-	fprintf( stderr, "%s: unable to compute Z smoothing (3D)\n", proc );
-      free( auxBuf );
-      return( EXIT_ON_FAILURE );
-    }
-
-    derivatives[0] = DERIVATIVE_1; 
-    derivatives[1] = DERIVATIVE_0;
-    derivatives[2] = NODERIVATIVE;
-    if ( RecursiveFilterOnBuffer( (void*)tmpBuf, CGAL_FLOAT, (void*)grdBuf, CGAL_FLOAT,
-				  bufferDims, borderLengths, derivatives,
-				  filterCoefs, filterType ) != EXIT_ON_SUCCESS ) {
-      if ( _VERBOSE_ ) 
-	fprintf( stderr, "%s: unable to compute X derivative (3D)\n", proc );
-      free( auxBuf );
-      return( EXIT_ON_FAILURE );
-    }
-
-    derivatives[0] = DERIVATIVE_0; 
-    derivatives[1] = DERIVATIVE_1;
-    derivatives[2] = NODERIVATIVE;
-    if ( RecursiveFilterOnBuffer( (void*)tmpBuf, CGAL_FLOAT, (void*)tmpBuf, CGAL_FLOAT,
-				  bufferDims, borderLengths, derivatives,
-				  filterCoefs, filterType ) != EXIT_ON_SUCCESS ) {
-      if ( _VERBOSE_ ) 
-	fprintf( stderr, "%s: unable to compute Y derivative (3D)\n", proc );
-      free( auxBuf );
-      return( EXIT_ON_FAILURE );
-    }
-
-    sizeAuxBuf = bufferDims[0] * bufferDims[1] * bufferDims[2];
-    for ( i = 0; i < sizeAuxBuf; i++ )
-      grdBuf[i] = grdBuf[i]*grdBuf[i] + tmpBuf[i]*tmpBuf[i];
-    
-    derivatives[0] = DERIVATIVE_0;
-    derivatives[1] = DERIVATIVE_0;
-    derivatives[2] = DERIVATIVE_1;
-    if ( RecursiveFilterOnBuffer( bufferIn, typeIn, (void*)tmpBuf, CGAL_FLOAT,
-				  bufferDims, borderLengths, derivatives,
-				  filterCoefs, filterType ) != EXIT_ON_SUCCESS ) {
-      if ( _VERBOSE_ ) 
-	fprintf( stderr, "%s: unable to compute Z derivative (3D)\n", proc );
-      free( auxBuf );
-      return( EXIT_ON_FAILURE );
-    }
-    
-    for ( i = 0; i < sizeAuxBuf; i++ )
-      grdBuf[i] = (float)sqrt( grdBuf[i] + tmpBuf[i]*tmpBuf[i] );
-    
-  }
-
-  if ( grdBuf != bufferOut ) 
-    ConvertBuffer( grdBuf, CGAL_FLOAT, bufferOut, typeOut,
-		   bufferDims[0]*bufferDims[1]*bufferDims[2] );
-  free( auxBuf );
-  return( EXIT_ON_SUCCESS );
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-/*
- *
- * Laplacian
- *
- *
- */
-CGAL_INLINE_FUNCTION
-int Laplacian_2D ( void *bufferIn,
-		   bufferType typeIn,
-		   void *bufferOut,
-		   bufferType typeOut,
-		   int *bufferDims,
-		   int *borderLengths,
-		   float *filterCoefs,
-		   recursiveFilterType filterType )
-{
-  const char *proc = "Laplacian_2D";
-  float *theXX = NULL;
-  float *theYY = NULL;
-
-  derivativeOrder XXderiv[3] = { DERIVATIVE_2, SMOOTHING, NODERIVATIVE };
-  derivativeOrder YYderiv[3] = { SMOOTHING, DERIVATIVE_2, NODERIVATIVE };
-  int sliceDims[3];
-  int z, i, dimxXdimy;
-
-  void *sliceOut = NULL;
-
-
-
-  /* 
-   * We check the buffers' dimensions.
-   */
-  if ( (bufferDims[0] <= 0) || (bufferDims[1] <= 0) || (bufferDims[2] <= 0) ) {
-    if ( _VERBOSE_ > 0 )
-      fprintf( stderr, " Fatal error in %s: improper buffer's dimension.\n", proc );
-    return( EXIT_ON_FAILURE );
-  }
-  
-  /*
-   * test of the coefficients
-   */
-  if ( (filterCoefs[0] < 0.0) || (filterCoefs[1] < 0.0) ||
-       (filterCoefs[2] < 0.0) ) {
-    if ( _VERBOSE_ > 0 )
-      fprintf( stderr, " Error in %s: negative coefficient's value.\n", proc );
-    return( EXIT_ON_FAILURE );
-  }
-  
-
-  /*
-   *
-   */
-  dimxXdimy = bufferDims[0] * bufferDims[1];
-  sliceDims[0] = bufferDims[0];
-  sliceDims[1] = bufferDims[1];
-  sliceDims[2] = 1;
-  
-
-  if ( typeOut == CGAL_FLOAT ) {
-    theXX = (float*)malloc( dimxXdimy * sizeof( float ) );
-  } else {
-    theXX = (float*)malloc( 2 * dimxXdimy * sizeof( float ) );
-  }
-  
-  if ( theXX == NULL ) {
-    if ( _VERBOSE_ > 0 ) {
-      fprintf( stderr, " Fatal error in %s:", proc );
-      fprintf( stderr, " unable to allocate auxiliary buffer.\n" );
-    }
-    return( EXIT_ON_FAILURE );
-  }
-
-  if ( typeOut != CGAL_FLOAT ) {
-    theYY  = theXX;
-    theYY += dimxXdimy;
-  }
-  
-  
-  
-  for ( z=0; z<bufferDims[2]; z++ ) {
-
-    if ( typeOut == CGAL_FLOAT ) {
-      theYY = ((float*)bufferOut) + z * dimxXdimy;
-    }
-    
-    if ( RecursiveFilterOnBuffer( bufferIn, typeIn, theXX, CGAL_FLOAT, 
-				  sliceDims, borderLengths,
-				  XXderiv, filterCoefs, filterType ) == 0 ) {
-      if ( _VERBOSE_ > 0 ) {
-	fprintf( stderr, " Fatal error in %s:", proc );
-	fprintf( stderr, " unable to compute X^2 derivative.\n" );
-      }
-      free( theXX );
-      return( EXIT_ON_FAILURE );
-    }
-
-    if ( RecursiveFilterOnBuffer( bufferIn, typeIn, theYY, CGAL_FLOAT, 
-				  sliceDims, borderLengths,
-				  YYderiv, filterCoefs, filterType ) == 0 ) {
-      if ( _VERBOSE_ > 0 ) {
-	fprintf( stderr, " Fatal error in %s:", proc );
-	fprintf( stderr, " unable to compute Y^2 derivative.\n" );
-      }
-      free( theXX );
-      return( EXIT_ON_FAILURE );
-    }
-    
-    
-    for ( i=0; i<dimxXdimy; i++ ) theYY[i] += theXX[i];
-    if ( typeOut != CGAL_FLOAT ) {
-      switch ( typeOut ) {
-      case CGAL_UCHAR :
-	sliceOut = (((u8*)bufferOut) + z * dimxXdimy);
-	break;
-      case CGAL_SCHAR :
-	sliceOut = (((s8*)bufferOut) + z * dimxXdimy);
-	break;
-      case CGAL_SSHORT :
-	sliceOut = (((s16*)bufferOut) + z * dimxXdimy);
-	break;
-      case CGAL_DOUBLE :
-	sliceOut = (((r64*)bufferOut) + z * dimxXdimy);
-	break;
-      default :
-	if ( _VERBOSE_ > 0 )
-	  fprintf( stderr, " Error in %s: such output type not handled.\n", proc );
-	free( theXX );
-	return( EXIT_ON_FAILURE );
-      }
-      ConvertBuffer( theYY, CGAL_FLOAT, sliceOut, typeOut, dimxXdimy );
-    }
-  }
-
-  return( EXIT_ON_SUCCESS );
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-CGAL_INLINE_FUNCTION
-int Laplacian ( void *bufferIn,
-		   bufferType typeIn,
-		   void *bufferOut,
-		   bufferType typeOut,
-		   int *bufferDims,
-		   int *borderLengths,
-		   float *filterCoefs,
-		   recursiveFilterType filterType )
-{
-  const char *proc = "Laplacian";
-  float *theSL = NULL;
-  float *theZZ = NULL;
-  float *theZ0 = NULL;
-
-
-  derivativeOrder XXderiv[3] = { DERIVATIVE_2, SMOOTHING, NODERIVATIVE };
-  derivativeOrder YYderiv[3] = { SMOOTHING, DERIVATIVE_2, NODERIVATIVE };
-  derivativeOrder Zsmooth[3] = { NODERIVATIVE, NODERIVATIVE, SMOOTHING };
-  derivativeOrder ZZderiv[3] = { SMOOTHING, SMOOTHING, DERIVATIVE_2 };
-  
-  int sliceDims[3];
-  int z, i, j, dimxXdimy;
-
-
-
-
-  /* 
-   * We check the buffers' dimensions.
-   */
-  if ( bufferDims[2] == 1 ) {
-    return( Laplacian_2D ( bufferIn, typeIn, bufferOut, typeOut,
-			   bufferDims, borderLengths, filterCoefs, filterType ) );
-  }
-
-  if ( (bufferDims[0] <= 0) || (bufferDims[1] <= 0) || (bufferDims[2] <= 0) ) {
-    if ( _VERBOSE_ > 0 )
-      fprintf( stderr, " Fatal error in %s: improper buffer's dimension.\n", proc );
-    return( EXIT_ON_FAILURE );
-  }
-  
-  /*
-   * test of the coefficients
-   */
-  if ( (filterCoefs[0] < 0.0) || (filterCoefs[1] < 0.0) ||
-       (filterCoefs[2] < 0.0) ) {
-    if ( _VERBOSE_ > 0 )
-      fprintf( stderr, " Error in %s: negative coefficient's value.\n", proc );
-    return( EXIT_ON_FAILURE );
-  }
-  
-
-  /*
-   *
-   */
-  dimxXdimy = bufferDims[0] * bufferDims[1];
-  sliceDims[0] = bufferDims[0];
-  sliceDims[1] = bufferDims[1];
-  sliceDims[2] = 1;
-
-  
-
-  if ( typeOut == CGAL_FLOAT ) {
-    theSL = (float*)malloc( (1+bufferDims[2]) * dimxXdimy * sizeof( float ) );
-  } else {
-    theSL = (float*)malloc( (1+2*bufferDims[2]) * dimxXdimy * sizeof( float ) );
-  }
-
-
-  
-  if ( theSL == NULL ) {
-    if ( _VERBOSE_ > 0 ) {
-      fprintf( stderr, " Fatal error in %s:", proc );
-      fprintf( stderr, " unable to allocate auxiliary buffer.\n" );
-    }
-    return( EXIT_ON_FAILURE );
-  }
-
-
-
-  theZ0 = theSL;
-  theZ0 += dimxXdimy;
-
-
-  
-  if ( typeOut == CGAL_FLOAT ) {
-    theZZ = (float*) bufferOut;
-  } else {
-    theZZ  = theZ0;
-    theZZ += dimxXdimy * bufferDims[2];
-  }
-  
-  
-  
-  /*
-   *
-   * 3D filtering / filtering along Z
-   *
-   */
-
-  if ( RecursiveFilterOnBuffer( bufferIn, typeIn, theZ0, CGAL_FLOAT, 
-				bufferDims, borderLengths,
-				Zsmooth, filterCoefs, filterType ) == 0 ) {
-    if ( _VERBOSE_ > 0 ) {
-      fprintf( stderr, " Fatal error in %s:", proc );
-      fprintf( stderr, " unable to compute Z^0 derivative.\n" );
-    }
-    free( theSL );
-    return( EXIT_ON_FAILURE );
-  }
-  if ( RecursiveFilterOnBuffer( bufferIn, typeIn, theZZ, CGAL_FLOAT, 
-				bufferDims, borderLengths,
-				ZZderiv, filterCoefs, filterType ) == 0 ) {
-    if ( _VERBOSE_ > 0 ) {
-      fprintf( stderr, " Fatal error in %s:", proc );
-      fprintf( stderr, " unable to compute Z^2 derivative.\n" );
-    }
-    free( theSL );
-    return( EXIT_ON_FAILURE );
-  }
-  
-
-
-
-
-
-  for ( z=0; z<bufferDims[2]; z++ ) {
-
-    /*
-     *
-     * 2D filtering / filtering along X and Y
-     *
-     */
-
-    if ( RecursiveFilterOnBuffer( theZ0+z*dimxXdimy, CGAL_FLOAT, theSL, CGAL_FLOAT, 
-				  sliceDims, borderLengths,
-				  XXderiv, filterCoefs, filterType ) == 0 ) {
-      if ( _VERBOSE_ > 0 ) {
-	fprintf( stderr, " Fatal error in %s:", proc );
-	fprintf( stderr, " unable to compute X^2 derivative.\n" );
-      }
-      free( theSL );
-      return( EXIT_ON_FAILURE );
-    }
-
-    for ( j=z*dimxXdimy, i=0; i<dimxXdimy; j++, i++ ) {
-      theZZ[j] += theSL[i];
-    }
-
-    if ( RecursiveFilterOnBuffer( theZ0+z*dimxXdimy, CGAL_FLOAT, theSL, CGAL_FLOAT, 
-				  sliceDims, borderLengths,
-				  YYderiv, filterCoefs, filterType ) == 0 ) {
-      if ( _VERBOSE_ > 0 ) {
-	fprintf( stderr, " Fatal error in %s:", proc );
-	fprintf( stderr, " unable to compute Y^2 derivative.\n" );
-      }
-      free( theSL );
-      return( EXIT_ON_FAILURE );
-    }
-    
-    for ( j=z*dimxXdimy, i=0; i<dimxXdimy; j++, i++ ) {
-      theZZ[j] += theSL[i];
-    }
-
-  }
-
-  if ( typeOut != CGAL_FLOAT ) {
-    ConvertBuffer( theZZ, CGAL_FLOAT, bufferOut, typeOut, bufferDims[2]*dimxXdimy );
-  }
-
-  return( EXIT_ON_SUCCESS );
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-/*
- *
- * Gradient . Hessian * Gradient
- *
- *
- */
-CGAL_INLINE_FUNCTION
-int GradientHessianGradient_2D ( void *bufferIn,
-		   bufferType typeIn,
-		   void *bufferOut,
-		   bufferType typeOut,
-		   int *bufferDims,
-		   int *borderLengths,
-		   float *filterCoefs,
-		   recursiveFilterType filterType )
-{
-  const char *proc = "GradientHessianGradient_2D";
-  float *theXX = NULL;
-  float *theYY = NULL;
-  float *theXY = NULL;
-  float *theX  = NULL;
-  float *theY  = NULL;
-
-  derivativeOrder Xsmooth[3] = { SMOOTHING,          NODERIVATIVE,       NODERIVATIVE };
-  derivativeOrder Yderiv[3]  = { NODERIVATIVE,       DERIVATIVE_1_EDGES, NODERIVATIVE };
-  derivativeOrder YYderiv[3] = { NODERIVATIVE,       DERIVATIVE_2,       NODERIVATIVE };
-
-  derivativeOrder Ysmooth[3] = { NODERIVATIVE,       SMOOTHING,          NODERIVATIVE };
-  derivativeOrder Xderiv[3]  = { DERIVATIVE_1_EDGES, NODERIVATIVE,       NODERIVATIVE };
-  derivativeOrder XXderiv[3] = { DERIVATIVE_2,       NODERIVATIVE,       NODERIVATIVE };
-
-  derivativeOrder XYderiv[3] = { DERIVATIVE_1,       DERIVATIVE_1,       NODERIVATIVE };
-
-  int sliceDims[3];
-  int z, i, dimxXdimy;
-
-  void *sliceIn = NULL;
-  void *sliceOut = NULL;
-
-  double gx, gy, g;
-
-  /* 
-   * We check the buffers' dimensions.
-   */
-  if ( (bufferDims[0] <= 0) || (bufferDims[1] <= 0) || (bufferDims[2] <= 0) ) {
-    if ( _VERBOSE_ > 0 )
-      fprintf( stderr, " Fatal error in %s: improper buffer's dimension.\n", proc );
-    return( EXIT_ON_FAILURE );
-  }
-  
-  /*
-   * test of the coefficients
-   */
-  if ( (filterCoefs[0] < 0.0) || (filterCoefs[1] < 0.0) ||
-       (filterCoefs[2] < 0.0) ) {
-    if ( _VERBOSE_ > 0 )
-      fprintf( stderr, " Error in %s: negative coefficient's value.\n", proc );
-    return( EXIT_ON_FAILURE );
-  }
-  
-
-  /*
-   *
-   */
-  dimxXdimy = bufferDims[0] * bufferDims[1];
-  sliceDims[0] = bufferDims[0];
-  sliceDims[1] = bufferDims[1];
-  sliceDims[2] = 1;
-  
-
-  if ( typeOut == CGAL_FLOAT ) {
-    theXX = (float*)malloc( 4 * dimxXdimy * sizeof( float ) );
-  } else {
-    theXX = (float*)malloc( 5 * dimxXdimy * sizeof( float ) );
-  }
-  
-  if ( theXX == NULL ) {
-    if ( _VERBOSE_ > 0 ) {
-      fprintf( stderr, " Fatal error in %s:", proc );
-      fprintf( stderr, " unable to allocate auxiliary buffer.\n" );
-    }
-    return( EXIT_ON_FAILURE );
-  }
-  
-
-
-  theX = theY = theYY = theXX;
-  theYY +=   dimxXdimy;
-  theX  += 2*dimxXdimy;
-  theY  += 3*dimxXdimy;
-
-
-
-  if ( typeOut != CGAL_FLOAT ) {
-    theXY  =   theXX;
-    theXY += 4*dimxXdimy;
-  }
-  
-  
-  
-  for ( z=0; z<bufferDims[2]; z++ ) {
-
-    switch( typeIn ) {
-    default :
-      break;
-    case CGAL_UCHAR :
-    case CGAL_SCHAR :
-      sliceIn = (void*)( ((u8*)bufferIn) + z*dimxXdimy ); break;
-    case CGAL_USHORT :
-    case CGAL_SSHORT :
-      sliceIn = (void*)( ((u16*)bufferIn) + z*dimxXdimy ); break;
-    case CGAL_FLOAT :
-      sliceIn = (void*)( ((float*)bufferIn) + z*dimxXdimy ); break;
-    case CGAL_DOUBLE :
-      sliceIn = (void*)( ((double*)bufferIn) + z*dimxXdimy ); break;
-    }
-    if ( typeOut == CGAL_FLOAT ) {
-      theXY = ((float*)bufferOut) + z * dimxXdimy;
-    }
-    
-    if ( RecursiveFilterOnBuffer( sliceIn, typeIn, theX, CGAL_FLOAT, 
-				  sliceDims, borderLengths,
-				  Ysmooth, filterCoefs, filterType ) == 0 ) {
-      if ( _VERBOSE_ > 0 ) {
-	fprintf( stderr, " Fatal error in %s:", proc );
-	fprintf( stderr, " unable to compute Y^0 derivative.\n" );
-      }
-      free( theXX );
-      return( EXIT_ON_FAILURE );
-    }
-
-    if ( RecursiveFilterOnBuffer( sliceIn, typeIn, theY, CGAL_FLOAT, 
-				  sliceDims, borderLengths,
-				  Xsmooth, filterCoefs, filterType ) == 0 ) {
-      if ( _VERBOSE_ > 0 ) {
-	fprintf( stderr, " Fatal error in %s:", proc );
-	fprintf( stderr, " unable to compute X^0 derivative.\n" );
-      }
-      free( theXX );
-      return( EXIT_ON_FAILURE );
-    }
-
-
-
-
-    if ( RecursiveFilterOnBuffer( sliceIn, typeIn, theXY, CGAL_FLOAT, 
-				  sliceDims, borderLengths,
-				  XYderiv, filterCoefs, filterType ) == 0 ) {
-      if ( _VERBOSE_ > 0 ) {
-	fprintf( stderr, " Fatal error in %s:", proc );
-	fprintf( stderr, " unable to compute X^1Y^1 derivative.\n" );
-      }
-      free( theXX );
-      return( EXIT_ON_FAILURE );
-    }
-
-
-
-
-    if ( RecursiveFilterOnBuffer( theX, CGAL_FLOAT, theXX, CGAL_FLOAT, 
-				  sliceDims, borderLengths,
-				  XXderiv, filterCoefs, filterType ) == 0 ) {
-      if ( _VERBOSE_ > 0 ) {
-	fprintf( stderr, " Fatal error in %s:", proc );
-	fprintf( stderr, " unable to compute X^2 derivative.\n" );
-      }
-      free( theXX );
-      return( EXIT_ON_FAILURE );
-    }
-
-    if ( RecursiveFilterOnBuffer( theY, CGAL_FLOAT, theYY, CGAL_FLOAT, 
-				  sliceDims, borderLengths,
-				  YYderiv, filterCoefs, filterType ) == 0 ) {
-      if ( _VERBOSE_ > 0 ) {
-	fprintf( stderr, " Fatal error in %s:", proc );
-	fprintf( stderr, " unable to compute Y^2 derivative.\n" );
-      }
-      free( theXX );
-      return( EXIT_ON_FAILURE );
-    }
-
-
-
-
-    if ( RecursiveFilterOnBuffer( theX, CGAL_FLOAT, theX, CGAL_FLOAT, 
-				  sliceDims, borderLengths,
-				  Xderiv, filterCoefs, filterType ) == 0 ) {
-      if ( _VERBOSE_ > 0 ) {
-	fprintf( stderr, " Fatal error in %s:", proc );
-	fprintf( stderr, " unable to compute X^1 derivative.\n" );
-      }
-      free( theXX );
-      return( EXIT_ON_FAILURE );
-    }
-
-    if ( RecursiveFilterOnBuffer( theY, CGAL_FLOAT, theY, CGAL_FLOAT, 
-				  sliceDims, borderLengths,
-				  Yderiv, filterCoefs, filterType ) == 0 ) {
-      if ( _VERBOSE_ > 0 ) {
-	fprintf( stderr, " Fatal error in %s:", proc );
-	fprintf( stderr, " unable to compute Y^1 derivative.\n" );
-      }
-      free( theXX );
-      return( EXIT_ON_FAILURE );
-    }
-
-
-    
-    
-    for ( i=0; i<dimxXdimy; i++ ) {
-      gx = theX[i];
-      gy = theY[i];
-      g = (gx*gx + gy*gy);
-      theXY[i] = (float)(gx * ( theXX[i] * gx + theXY[i] * gy ) +
-			 gy * ( theXY[i] * gx + theYY[i] * gy ));
-      if ( g > 1e-10 ) theXY[i] = (float)(theXY[i] / g);
-    }
-
-    if ( typeOut != CGAL_FLOAT ) {
-      switch ( typeOut ) {
-      case CGAL_UCHAR :
-	sliceOut = (((u8*)bufferOut) + z * dimxXdimy);
-	break;
-      case CGAL_SCHAR :
-	sliceOut = (((s8*)bufferOut) + z * dimxXdimy);
-	break;
-      case CGAL_SSHORT :
-	sliceOut = (((s16*)bufferOut) + z * dimxXdimy);
-	break;
-      case CGAL_DOUBLE :
-	sliceOut = (((r64*)bufferOut) + z * dimxXdimy);
-	break;
-      default :
-	if ( _VERBOSE_ > 0 )
-	  fprintf( stderr, " Error in %s: such output type not handled.\n", proc );
-	free( theXX );
-	return( EXIT_ON_FAILURE );
-      }
-      ConvertBuffer( theXY, CGAL_FLOAT, sliceOut, typeOut, dimxXdimy );
-    }
-  }
-
-  return( EXIT_ON_SUCCESS );
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-CGAL_INLINE_FUNCTION
-int GradientHessianGradient ( void *bufferIn,
-		   bufferType typeIn,
-		   void *bufferOut,
-		   bufferType typeOut,
-		   int *bufferDims,
-		   int *borderLengths,
-		   float *filterCoefs,
-		   recursiveFilterType filterType )
-{
-  const char *proc = "GradientHessianGradient";
-
-
-
-  float *theZZ = NULL;
-  float *theZ  = NULL;
-  float *theZ1 = NULL;
-  float *theZ0 = NULL;
-
-  float *theXZ = NULL;
-  float *theYZ = NULL;
-
-  float *theXX = NULL;
-  float *theYY = NULL;
-  float *theXY = NULL;
-
-  float *theX  = NULL;
-  float *theY  = NULL;
-
-
-  derivativeOrder ZZderiv[3] = { SMOOTHING,    SMOOTHING,    DERIVATIVE_2 };
-  derivativeOrder Zderiv[3]  = { SMOOTHING,    SMOOTHING,    DERIVATIVE_1 };
-  derivativeOrder Z1deriv[3] = { NODERIVATIVE, NODERIVATIVE, DERIVATIVE_1 };
-  derivativeOrder Z0deriv[3] = { NODERIVATIVE, NODERIVATIVE, SMOOTHING };
-
-  derivativeOrder XZderiv[3] = { DERIVATIVE_1, SMOOTHING,    NODERIVATIVE };
-  derivativeOrder YZderiv[3] = { SMOOTHING,    DERIVATIVE_1, NODERIVATIVE };
-
-  derivativeOrder XXderiv[3] = { DERIVATIVE_2, SMOOTHING,    NODERIVATIVE };
-  derivativeOrder YYderiv[3] = { SMOOTHING,    DERIVATIVE_2, NODERIVATIVE };
-  derivativeOrder XYderiv[3] = { DERIVATIVE_1, DERIVATIVE_1, NODERIVATIVE };
-
-  derivativeOrder Xderiv[3]  = { DERIVATIVE_1, SMOOTHING,    NODERIVATIVE };
-  derivativeOrder Yderiv[3]  = { SMOOTHING,    DERIVATIVE_1, NODERIVATIVE };
-
-  int sliceDims[3];
-  int z, i, j, dimxXdimy;
-
-  double gx, gy, gz, g;
-
-  /* 
-   * We check the buffers' dimensions.
-   */
-  if ( bufferDims[2] == 1 ) {
-    return( GradientHessianGradient_2D ( bufferIn, typeIn, bufferOut, typeOut,
-			   bufferDims, borderLengths, filterCoefs, filterType ) );
-  }
-
-  if ( (bufferDims[0] <= 0) || (bufferDims[1] <= 0) || (bufferDims[2] <= 0) ) {
-    if ( _VERBOSE_ > 0 )
-      fprintf( stderr, " Fatal error in %s: improper buffer's dimension.\n", proc );
-    return( EXIT_ON_FAILURE );
-  }
-  
-  /*
-   * test of the coefficients
-   */
-  if ( (filterCoefs[0] < 0.0) || (filterCoefs[1] < 0.0) ||
-       (filterCoefs[2] < 0.0) ) {
-    if ( _VERBOSE_ > 0 )
-      fprintf( stderr, " Error in %s: negative coefficient's value.\n", proc );
-    return( EXIT_ON_FAILURE );
-  }
-  
-
-  /*
-   *
-   */
-  dimxXdimy = bufferDims[0] * bufferDims[1];
-  sliceDims[0] = bufferDims[0];
-  sliceDims[1] = bufferDims[1];
-  sliceDims[2] = 1;
-  
-
-  if ( typeOut == CGAL_FLOAT ) {
-    theX  = (float*)malloc( (7+3*bufferDims[2]) * dimxXdimy * sizeof( float ) );
-  } else {
-    theX = (float*)malloc( (7+4*bufferDims[2]) * dimxXdimy * sizeof( float ) );
-  }
-
-  
-  if ( theX == NULL ) {
-    if ( _VERBOSE_ > 0 ) {
-      fprintf( stderr, " Fatal error in %s:", proc );
-      fprintf( stderr, " unable to allocate auxiliary buffer.\n" );
-    }
-    return( EXIT_ON_FAILURE );
-  }
-  
-  /*
-   * BUFFERS
-   *
-   * slices  : theX  theY  theXY theYY theXX theYZ theXZ
-   *
-   * volumes : theZ0 theZ1 theZ  theZZ
-   *
-   */
-
-  theY  = theXX = theXY = theYY = theYZ = theXZ = theX;
-  theZ0 = theZ1 = theZ  = theX;
-
-  theY  +=   dimxXdimy;
-  theXY += 2*dimxXdimy;
-  theYY += 3*dimxXdimy;
-  theXX += 4*dimxXdimy;
-  theYZ += 5*dimxXdimy;
-  theXZ += 6*dimxXdimy;
- 
-  theZ0 += 7*dimxXdimy;
-  theZ1 += 7*dimxXdimy +   bufferDims[2]*dimxXdimy;
-  theZ  += 7*dimxXdimy + 2*bufferDims[2]*dimxXdimy;
-
-  if ( typeOut == CGAL_FLOAT ) {
-    theZZ  = (float*)bufferOut;
-  } else {
-    theZZ  = theX;
-    theZZ += 7*dimxXdimy + 3*bufferDims[2]*dimxXdimy;
-  }
-  
-  
-  
-  /*
-   *
-   * 3D filtering / filtering along Z
-   *
-   */
-
-  if ( RecursiveFilterOnBuffer( bufferIn, typeIn, theZ0, CGAL_FLOAT, 
-				bufferDims, borderLengths,
-				Z0deriv, filterCoefs, filterType ) == 0 ) {
-    if ( _VERBOSE_ > 0 ) {
-      fprintf( stderr, " Fatal error in %s:", proc );
-      fprintf( stderr, " unable to compute Z^0 derivative.\n" );
-    }
-    free( theX );
-    return( EXIT_ON_FAILURE );
-  }
-  
-  if ( RecursiveFilterOnBuffer( bufferIn, typeIn, theZ1, CGAL_FLOAT, 
-				bufferDims, borderLengths,
-				Z1deriv, filterCoefs, filterType ) == 0 ) {
-    if ( _VERBOSE_ > 0 ) {
-      fprintf( stderr, " Fatal error in %s:", proc );
-      fprintf( stderr, " unable to compute Z^1 derivative.\n" );
-    }
-    free( theX );
-    return( EXIT_ON_FAILURE );
-  }
-  
-  if ( RecursiveFilterOnBuffer( bufferIn, typeIn, theZ, CGAL_FLOAT, 
-				bufferDims, borderLengths,
-				Zderiv, filterCoefs, filterType ) == 0 ) {
-    if ( _VERBOSE_ > 0 ) {
-      fprintf( stderr, " Fatal error in %s:", proc );
-      fprintf( stderr, " unable to compute Z^1 derivative (edge).\n" );
-    }
-    free( theX );
-    return( EXIT_ON_FAILURE );
-  }
-  
-  if ( RecursiveFilterOnBuffer( bufferIn, typeIn, theZZ, CGAL_FLOAT, 
-				bufferDims, borderLengths,
-				ZZderiv, filterCoefs, filterType ) == 0 ) {
-    if ( _VERBOSE_ > 0 ) {
-      fprintf( stderr, " Fatal error in %s:", proc );
-      fprintf( stderr, " unable to compute Z^2 derivative.\n" );
-    }
-    free( theX );
-    return( EXIT_ON_FAILURE );
-  }
-
-
-  /*
-   * theZ0 : smoothed         along Z
-   * theZ1 : first derivative along Z
-   * theZ  : first derivative along Z, smoothed along X and Y
-   * theZZ : second derivative along Z, smoothed along X and Y
-   */
-
-
-
-  for ( z=0; z<bufferDims[2]; z++ ) {
-    fprintf( stderr, "%s: processing slice %3d/%d\r",
-	     proc, z, bufferDims[2] );
-    /*
-     *
-     * 2D filtering / filtering along X and Y
-     *
-     */
-    
-    if ( RecursiveFilterOnBuffer( theZ1+z*dimxXdimy, CGAL_FLOAT, theXZ, CGAL_FLOAT, 
-				  sliceDims, borderLengths,
-				  XZderiv, filterCoefs, filterType ) == 0 ) {
-      if ( _VERBOSE_ > 0 ) {
-	fprintf( stderr, " Fatal error in %s:", proc );
-	fprintf( stderr, " unable to compute X^1Z^1 derivative.\n" );
-      }
-      free( theX );
-      return( EXIT_ON_FAILURE );
-    }
-
-    if ( RecursiveFilterOnBuffer( theZ1+z*dimxXdimy, CGAL_FLOAT, theYZ, CGAL_FLOAT, 
-				  sliceDims, borderLengths,
-				  YZderiv, filterCoefs, filterType ) == 0 ) {
-      if ( _VERBOSE_ > 0 ) {
-	fprintf( stderr, " Fatal error in %s:", proc );
-	fprintf( stderr, " unable to compute Y^1Z^1 derivative.\n" );
-      }
-      free( theX );
-      return( EXIT_ON_FAILURE );
-    }
-
-
-
-
-    if ( RecursiveFilterOnBuffer( theZ0+z*dimxXdimy, CGAL_FLOAT, theXX, CGAL_FLOAT,
-				  sliceDims, borderLengths,
-				  XXderiv, filterCoefs, filterType ) == 0 ) {
-      if ( _VERBOSE_ > 0 ) {
-	fprintf( stderr, " Fatal error in %s:", proc );
-	fprintf( stderr, " unable to compute X^2 derivative.\n" );
-      }
-      free( theX );
-      return( EXIT_ON_FAILURE );
-    }
-
-    if ( RecursiveFilterOnBuffer( theZ0+z*dimxXdimy, CGAL_FLOAT, theYY, CGAL_FLOAT,
-				  sliceDims, borderLengths,
-				  YYderiv, filterCoefs, filterType ) == 0 ) {
-      if ( _VERBOSE_ > 0 ) {
-	fprintf( stderr, " Fatal error in %s:", proc );
-	fprintf( stderr, " unable to compute Y^2 derivative.\n" );
-      }
-      free( theX );
-      return( EXIT_ON_FAILURE );
-    }
-
-    if ( RecursiveFilterOnBuffer( theZ0+z*dimxXdimy, CGAL_FLOAT, theXY, CGAL_FLOAT,
-				  sliceDims, borderLengths,
-				  XYderiv, filterCoefs, filterType ) == 0 ) {
-      if ( _VERBOSE_ > 0 ) {
-	fprintf( stderr, " Fatal error in %s:", proc );
-	fprintf( stderr, " unable to compute X^1Y^1 derivative.\n" );
-      }
-      free( theX );
-      return( EXIT_ON_FAILURE );
-    }
-
-
-
-    if ( RecursiveFilterOnBuffer( theZ0+z*dimxXdimy, CGAL_FLOAT, theX, CGAL_FLOAT,
-				  sliceDims, borderLengths,
-				  Xderiv, filterCoefs, filterType ) == 0 ) {
-      if ( _VERBOSE_ > 0 ) {
-	fprintf( stderr, " Fatal error in %s:", proc );
-	fprintf( stderr, " unable to compute X^1 derivative (edge).\n" );
-      }
-      free( theX );
-      return( EXIT_ON_FAILURE );
-    }
-
-    if ( RecursiveFilterOnBuffer( theZ0+z*dimxXdimy, CGAL_FLOAT, theY, CGAL_FLOAT,
-				  sliceDims, borderLengths,
-				  Yderiv, filterCoefs, filterType ) == 0 ) {
-      if ( _VERBOSE_ > 0 ) {
-	fprintf( stderr, " Fatal error in %s:", proc );
-	fprintf( stderr, " unable to compute Y^1 derivative (edge).\n" );
-      }
-      free( theX );
-      return( EXIT_ON_FAILURE );
-    }
-
-    
-    
-    for ( j=z*dimxXdimy, i=0; i<dimxXdimy; j++, i++ ) {
-      gx = theX[i];
-      gy = theY[i];
-      gz = theZ[j];
-      g = gx*gx + gy*gy + gz*gz;
-      theZZ[j] = (float)(gx * ( theXX[i] * gx + theXY[i] * gy  + theXZ[i] * gz ) +
-			 gy * ( theXY[i] * gx + theYY[i] * gy  + theYZ[i] * gz ) +
-			 gz * ( theXZ[i] * gx + theYZ[i] * gy  + theZZ[j] * gz ));
-      if ( g > 1e-10 ) theZZ[j] = (float)(theZZ[j] / g);
-
-    }
-
-  }
-
-  if ( typeOut != CGAL_FLOAT ) {
-    ConvertBuffer( theZZ, CGAL_FLOAT, bufferOut, typeOut, bufferDims[2]*dimxXdimy );
-  }
-  
-  free( theX );
-
-  return( EXIT_ON_SUCCESS );
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-/*
- *
- * 
- *
- *
- */
-CGAL_INLINE_FUNCTION
-int RecursiveFilterOnBuffer( void *bufferIn,
-			     bufferType typeIn,
-			     void *bufferOut,
-			     bufferType typeOut,
-			     int *bufferDims,
-			     int *borderLengths,
-			     derivativeOrder *derivatives,
-			     float *filterCoefs,
-			     recursiveFilterType filterType )
-{
-  const char *proc = "RecursiveFilterOnBuffer";
-  int dimx, dimxXdimy;
-  int dimy, dimz;
-  int x, y, z;
-  /* 
-   *obviously, we need to perform the computation 
-   * with float or double values. For this reason,
-   * we allocate an auxiliary buffer if the output buffer
-   * is not of type float or double.
-   */
-  void *bufferToBeProcessed = (void*)NULL;
-  bufferType typeToBeProcessed = TYPE_UNKNOWN;
-  void *bufferResult = (void*)NULL;
-  bufferType typeResult = TYPE_UNKNOWN;
-  /*
-   * lines' lengths
-   */
-  int lengthX = 0;
-  int lengthY = 0;
-  int lengthZ = 0;
-  int maxLengthline = 0;
-  int borderXlength = 0;
-  int borderYlength = 0;
-  int borderZlength = 0;
-  /*
-   * 1D arrays for computations.
-   */
-  double *theLine = (double*)NULL;
-  double *resLine = (double*)NULL;
-  double *tmpLine = (double*)NULL;
-  /*
-   * pointers for computations;
-   */
-  r32 *r32firstPoint = (r32*)NULL;
-  r64 *r64firstPoint = (r64*)NULL;
-  r32 *r32_pt = (r32*)NULL;
-  r64 *r64_pt = (r64*)NULL;
-  double *dbl_pt1 = (double*)NULL;
-  double *dbl_pt2 = (double*)NULL;
-  double dbl_first = 0.0;
-  double dbl_last = 0.0;
-  int offsetLastPoint = 0;
-  int offsetNextFirstPoint = 0;
-  r32 *r32firstPointResult = (r32*)NULL;
-  r64 *r64firstPointResult = (r64*)NULL;
-  double *theLinePlusBorder = (double*)NULL;
-  double *resLinePlusBorder = (double*)NULL;
-
-  RFcoefficientType *RFC = NULL;
-
-  /* 
-   * We check the buffers' dimensions.
-   */
-  dimx = bufferDims[0];   dimy = bufferDims[1];   dimz = bufferDims[2];
-  dimxXdimy = dimx * dimy;
-  if ( (dimx <= 0) || (dimy <= 0) || (dimz <= 0) ) {
-    if ( _VERBOSE_ > 0 )
-      fprintf( stderr, " Fatal error in %s: improper buffer's dimension.\n", proc );
-    return( EXIT_ON_FAILURE );
-  }
-  /*
-   * We check the pointers.
-   */
-  if ( (bufferIn == (void*)NULL) || (bufferOut == (void*)NULL) ) {
-    if ( _VERBOSE_ > 0 )
-      fprintf( stderr, " Fatal error in %s: NULL pointer on buffer.\n", proc );
-    return( EXIT_ON_FAILURE );
-  }
-
-  /* 
-   * May we use the buffer bufferOut as the bufferResult?
-   * If its type is CGAL_FLOAT or CGAL_DOUBLE, then yes.
-   * If not, we have to allocate an auxiliary buffer.
-   */
-  if ( (typeOut == CGAL_FLOAT) || (typeOut == CGAL_DOUBLE) ) {
-    bufferResult = bufferOut;
-    typeResult = typeOut;
-  } else {
-    bufferResult = (void*)malloc( (dimx*dimy*dimz) * sizeof(r32) );
-    if ( bufferResult == (void*)NULL ) {
-      if ( _VERBOSE_ > 0 )
-	fprintf( stderr, " Fatal error in %s: unable to allocate auxiliary buffer.\n", proc );
-      return( EXIT_ON_FAILURE );
-    }
-    typeResult = CGAL_FLOAT;
-  }
-  
-  /* 
-   * May we consider the buffer bufferIn as the bufferToBeProcessed?
-   * If its type is CGAL_FLOAT or CGAL_DOUBLE, then yes.
-   * If not, we convert it into the buffer bufferResult, and this
-   * last buffer is the bufferToBeProcessed.
-   */
-  if ( (typeIn == CGAL_FLOAT) || (typeIn == CGAL_DOUBLE) ) {
-    bufferToBeProcessed = bufferIn;
-    typeToBeProcessed = typeIn;
-  } else {
-    ConvertBuffer( bufferIn, typeIn, bufferResult, typeResult, (dimx*dimy*dimz) );
-    bufferToBeProcessed = bufferResult;
-    typeToBeProcessed = typeResult;
-  }
-
-  /*
-   * Estimation of the lines' length along each direction.
-   */
-  if ( borderLengths != NULL ) {
-    borderXlength = borderLengths[0];
-    borderYlength = borderLengths[1];
-    borderZlength = borderLengths[2];
-    if ( borderXlength < 0 ) borderXlength = 0;
-    if ( borderYlength < 0 ) borderYlength = 0;
-    if ( borderZlength < 0 ) borderZlength = 0;
-  }
-
-  /*
-   * Tue Jul  6 19:15:15 MET DST 1999 (gregoire Malandain)
-   * changes 3 x dimx -> dimx, dimy, dimz
-   */
-  lengthX = dimx + 2 * borderXlength;
-  lengthY = dimy + 2 * borderYlength;
-  lengthZ = dimz + 2 * borderZlength;
-  maxLengthline = lengthX;
-  if ( maxLengthline < lengthY ) maxLengthline = lengthY;
-  if ( maxLengthline < lengthZ ) maxLengthline = lengthZ;
-  if ( maxLengthline <= 0 ) {
-    if ( _VERBOSE_ > 0 )
-      fprintf( stderr, " Error in %s: unable to deal with dimensions = 0.\n", proc );
-    if ( (typeOut != CGAL_FLOAT) && (typeOut != CGAL_DOUBLE) )
-      free( bufferResult );
-    return( EXIT_ON_FAILURE );
-  }
-  /*
-   * Allocations of work arrays. 
-   * We will use them to process each line.
-   */
-  theLine = (double*)malloc( 3 * maxLengthline * sizeof(double) );
-  if ( theLine == (double*)NULL ) {
-    if ( _VERBOSE_ > 0 )
-      fprintf( stderr, " Fatal error in %s: unable to allocate auxiliary work arrays.\n", proc );
-    if ( (typeOut != CGAL_FLOAT) && (typeOut != CGAL_DOUBLE) )
-      free( bufferResult );
-    return( EXIT_ON_FAILURE );
-  }
-  resLine = theLine + maxLengthline;
-  tmpLine = resLine + maxLengthline;
-
-  /*
-   * From now,
-   * typeToBeProcessed is either CGAL_FLOAT or CGAL_DOUBLE
-   * so is typeResult.
-   */
-
-
-  /*
-   * Processing along X.
-   */
-  if ( dimx > 4 )
-  if (derivatives[0] != NODERIVATIVE)
-  if (filterCoefs[0] > 0.0) {
-
-    if ( _VERBOSE_ != 0 )
-      fprintf( stderr, " %s: processing along X.\n", proc );
-
-    RFC = InitRecursiveCoefficients( (double)filterCoefs[0], filterType, derivatives[0] );
-
-    if ( RFC == NULL ) {
-      if ( _VERBOSE_ != 0 )
-	fprintf( stderr, " %s: unable to allocate coefficients\n", proc );
-      if ( (typeOut != CGAL_FLOAT) && (typeOut != CGAL_DOUBLE) )
-	free( bufferResult );
-      return( EXIT_ON_FAILURE );
-    }
-    
-    r64firstPoint = (r64*)bufferToBeProcessed;
-    r32firstPoint = (r32*)bufferToBeProcessed;
-
-    r64firstPointResult = (r64*)bufferResult;
-    r32firstPointResult = (r32*)bufferResult;
-
-    offsetLastPoint = borderXlength + dimx - 1;
-
-    theLinePlusBorder = theLine + borderXlength;
-    resLinePlusBorder = resLine + borderXlength;
-
-    /*
-     * There are dimz*dimy X lines to be processed.
-     */
-    for ( z=0; z<dimz; z++ )
-    for ( y=0; y<dimy; y++ ) {
-      /*
-       * Acquiring a X line.
-       */ 
-      dbl_pt1 = theLinePlusBorder;
-      switch ( typeToBeProcessed ) {
-      case CGAL_DOUBLE :
-	(void)memcpy( (void*)dbl_pt1, (void*)r64firstPoint, dimx * sizeof(r64) );
-	r64firstPoint += dimx;
-	break;
-      case CGAL_FLOAT :
-      default :
-	for ( x=0; x<dimx; x++, dbl_pt1++, r32firstPoint++ ) *dbl_pt1 = *r32firstPoint;
-      }
-      /*
-       * Adding points at both ends of the line.
-       */
-      if ( borderXlength > 0 ) {
-	dbl_pt1 = theLine + borderXlength;   dbl_first = *dbl_pt1;
-	dbl_pt2 = theLine + offsetLastPoint; dbl_last  = *dbl_pt2;
-	for ( x=0; x<borderXlength; x++ ) {
-	  *--dbl_pt1 = dbl_first;
-	  *++dbl_pt2 = dbl_last;
-	}
-      }
-      /*
-       * Processing the line.
-       */
-      if ( RecursiveFilter1D( RFC, theLine, resLine, tmpLine, resLine, lengthX ) == 0 ) {
-	if ( _VERBOSE_ != 0 ) 
-	  fprintf(stderr," Error in %s: unable to process X line (y=%d,z=%d).\n", proc, y, z);
-	if ( (typeOut != CGAL_FLOAT) && (typeOut != CGAL_DOUBLE) )
-	  free( bufferResult );
-	free( (void*)theLine );
-	return( EXIT_ON_FAILURE );
-      }
-      /*
-       * Copy the result into the buffer bufferResult.
-       */
-      dbl_pt1 = resLinePlusBorder;
-      switch ( typeResult ) {
-      case CGAL_DOUBLE :
-	(void)memcpy( (void*)r64firstPointResult, (void*)dbl_pt1, dimx * sizeof(r64) );
-	r64firstPointResult += dimx;
-	break;
-      case CGAL_FLOAT :
-      default :
-	for ( x=0; x<dimx; x++, dbl_pt1++, r32firstPointResult++ )
-	  *r32firstPointResult = (r32)(*dbl_pt1);
-      }
-    }
-    
-    /*
-     * The next buffer to be processed is the buffer
-     * bufferResult.
-     */
-    bufferToBeProcessed = bufferResult;
-    typeToBeProcessed = typeResult;
-    
-    free( RFC );
-    RFC = NULL;
-
-  } /* end of Processing along X. */
-  
-  /*
-   * Processing along Y.
-   */
-  if ( dimy > 4 )
-  if (derivatives[1] != NODERIVATIVE)
-  if (filterCoefs[1] > 0.0) {
-
-    if ( _VERBOSE_ != 0 )
-      fprintf( stderr, " %s: processing along Y.\n", proc );
-
-    RFC = InitRecursiveCoefficients( (double)filterCoefs[1], filterType, derivatives[1] );
-
-    if ( RFC == NULL ) {
-      if ( _VERBOSE_ != 0 )
-	fprintf( stderr, " %s: unable to allocate coefficients\n", proc );
-      if ( (typeOut != CGAL_FLOAT) && (typeOut != CGAL_DOUBLE) )
-	free( bufferResult );
-      return( EXIT_ON_FAILURE );
-    }
-
-    r64firstPoint = (r64*)bufferToBeProcessed;
-    r32firstPoint = (r32*)bufferToBeProcessed;
-
-    r64firstPointResult = (r64*)bufferResult;
-    r32firstPointResult = (r32*)bufferResult;
-
-    offsetLastPoint = borderYlength + dimy - 1;
-    offsetNextFirstPoint = dimx * dimy - dimx;
-
-    theLinePlusBorder = theLine + borderYlength;
-    resLinePlusBorder = resLine + borderYlength;
-
-    /*
-     * There are dimz*dimx Y lines to be processed.
-     */
-    for ( z=0; z<dimz; z++ ) {
-      for ( x=0; x<dimx; x++ ) {
-      /*
-       * Acquiring a Y line.
-       */ 
-	dbl_pt1 = theLinePlusBorder;
-	switch ( typeToBeProcessed ) {
-	case CGAL_DOUBLE :
-	  r64_pt = r64firstPoint;
-	  for ( y=0; y<dimy; y++, dbl_pt1++, r64_pt += dimx ) *dbl_pt1 = *r64_pt;
-	  /*
-	   * Going to the first point of the next Y line
-	   */
-	  r64firstPoint ++;
-	  break;
-	case CGAL_FLOAT :
-	default :
-	  r32_pt = r32firstPoint;
-	  for ( y=0; y<dimy; y++, dbl_pt1++, r32_pt += dimx ) *dbl_pt1 = *r32_pt;
-	  r32firstPoint ++;
-	}
-	/*
-	 * Adding points at both ends of the line.
-	 */
-	if ( borderYlength > 0 ) {
-	  dbl_pt1 = theLine + borderYlength;   dbl_first = *dbl_pt1;
-	  dbl_pt2 = theLine + offsetLastPoint; dbl_last  = *dbl_pt2;
-	  for ( y=0; y<borderYlength; y++ ) {
-	    *--dbl_pt1 = dbl_first;
-	    *++dbl_pt2 = dbl_last;
-	  }
-	}
-	/*
-	 * Processing the line.
-	 */
-	if ( RecursiveFilter1D( RFC, theLine, resLine, tmpLine, resLine, lengthY ) == 0 ) {
-	  if ( _VERBOSE_ != 0 ) 
-	    fprintf(stderr," Error in %s: unable to process Y line (x=%d,z=%d).\n", proc, x, z);
-	  if ( (typeOut != CGAL_FLOAT) && (typeOut != CGAL_DOUBLE) )
-	    free( bufferResult );
-	  free( (void*)theLine );
-	  return( EXIT_ON_FAILURE );
-	}
-	/*
-	 * Copy the result into the buffer bufferResult.
-	 */
-	dbl_pt1 = resLinePlusBorder;
-	switch ( typeResult ) {
-	case CGAL_DOUBLE :
-	  r64_pt = r64firstPointResult;
-	  for ( y=0; y<dimy; y++, dbl_pt1++, r64_pt += dimx ) *r64_pt = *dbl_pt1;
-	  r64firstPointResult ++;
-	  break;
-	case CGAL_FLOAT :
-	default :
-	  r32_pt = r32firstPointResult;
-	  for ( y=0; y<dimy; y++, dbl_pt1++, r32_pt += dimx ) 
-	    *r32_pt = (float)*dbl_pt1;
-	  r32firstPointResult ++;
-	}
-      }
-      /*
-       * Going to the first point of the next Y line
-       * which is the first Y line of the next slice.
-       *
-       * The pointer r[32,64]firstPoint[Result] has
-       * already been increased by dimx. To reach
-       * the first point of the next slice, we
-       * have to increase it by (dimx*dimy)-dimx.
-       */
-      switch ( typeToBeProcessed ) {
-      case CGAL_DOUBLE :
-	r64firstPoint += offsetNextFirstPoint;
-	break;
-      case CGAL_FLOAT :
-      default :
-	r32firstPoint += offsetNextFirstPoint;
-      }
-      switch ( typeResult ) {
-      case CGAL_DOUBLE :
-	r64firstPointResult += offsetNextFirstPoint;
-	break;
-      case CGAL_FLOAT :
-      default :
-	r32firstPointResult += offsetNextFirstPoint;
-      }
-    }
-    
-    /*
-     * The next buffer to be processed is the buffer
-     * bufferResult.
-     */
-    bufferToBeProcessed = bufferResult;
-    typeToBeProcessed = typeResult;
-  
-    free( RFC );
-    RFC = NULL;
-
-  } /* end of Processing along Y. */
-  
-
-  /*
-   * Processing along Z.
-   */
-  if ( dimz > 4 )
-  if (derivatives[2] != NODERIVATIVE)
-  if (filterCoefs[2] > 0.0) {
-
-    if ( _VERBOSE_ != 0 )
-      fprintf( stderr, " %s: processing along Z.\n", proc );
-    
-    RFC = InitRecursiveCoefficients( (double)filterCoefs[2], filterType, derivatives[2] );
-    
-    if ( RFC == NULL ) {
-      if ( _VERBOSE_ != 0 )
-	fprintf( stderr, " %s: unable to allocate coefficients\n", proc );
-      if ( (typeOut != CGAL_FLOAT) && (typeOut != CGAL_DOUBLE) )
-	free( bufferResult );
-      return( EXIT_ON_FAILURE );
-    }
-
-    r64firstPoint = (r64*)bufferToBeProcessed;
-    r32firstPoint = (r32*)bufferToBeProcessed;
-
-    offsetLastPoint = borderZlength + dimz - 1;
-
-    r64firstPointResult = (r64*)bufferResult;
-    r32firstPointResult = (r32*)bufferResult;
-
-    offsetLastPoint = borderZlength + dimz - 1;
-
-    theLinePlusBorder = theLine + borderYlength;
-    resLinePlusBorder = resLine + borderYlength;
-
-    /*
-     * There are dimy*dimx Z lines to be processed.
-     */
-    for ( y=0; y<dimy; y++ )
-    for ( x=0; x<dimx; x++ ) {
-      /*
-       * Acquiring a Z line.
-       */ 
-      dbl_pt1 = theLinePlusBorder;
-      switch ( typeToBeProcessed ) {
-      case CGAL_DOUBLE :
-	r64_pt = r64firstPoint;
-	for ( z=0; z<dimz; z++, dbl_pt1++, r64_pt += dimxXdimy ) *dbl_pt1 = *r64_pt;
-	/*
-	 * Going to the first point of the next Z line
-	 */
-	r64firstPoint ++;
-	break;
-      case CGAL_FLOAT :
-      default :
-	r32_pt = r32firstPoint;
-	for ( z=0; z<dimz; z++, dbl_pt1++, r32_pt += dimxXdimy ) *dbl_pt1 = *r32_pt;
-	r32firstPoint ++;
-      }
-      /*
-       * Adding points at both ends of the line.
-       */
-      if ( borderZlength > 0 ) {
-	dbl_pt1 = theLine + borderZlength;   dbl_first = *dbl_pt1;
-	dbl_pt2 = theLine + offsetLastPoint; dbl_last  = *dbl_pt2;
-	for ( z=0; z<borderZlength; z++ ) {
-	  *--dbl_pt1 = dbl_first;
-	  *++dbl_pt2 = dbl_last;
-	}
-      }
-      /*
-       * Processing the line.
-       */
-      if ( RecursiveFilter1D( RFC, theLine, resLine, tmpLine, resLine, lengthZ ) == 0 ) {
-	if ( _VERBOSE_ != 0 ) 
-	  fprintf(stderr," Error in %s: unable to process Z line (x=%d,y=%d).\n", proc, x, y);
-	if ( (typeOut != CGAL_FLOAT) && (typeOut != CGAL_DOUBLE) )
-	  free( bufferResult );
-	free( (void*)theLine );
-	return( EXIT_ON_FAILURE );
-      }
-      
-      /*
-       * Copy the result into the buffer bufferResult.
-       */
-      dbl_pt1 = resLinePlusBorder;
-      switch ( typeResult ) {
-      case CGAL_DOUBLE :
-	r64_pt = r64firstPointResult;
-	for ( z=0; z<dimz; z++, dbl_pt1++, r64_pt += dimxXdimy ) 
-	  *r64_pt = *dbl_pt1;
-	r64firstPointResult ++;
-	break;
-      case CGAL_FLOAT :
-      default :
-	r32_pt = r32firstPointResult;
-	for ( z=0; z<dimz; z++, dbl_pt1++, r32_pt += dimxXdimy ) 
-	  *r32_pt = (float)*dbl_pt1;
-	r32firstPointResult ++;
-      }
-    }
-
-    free( RFC );
-    RFC = NULL;
-
-  } /* end of Processing along Z. */
-  
-
-
-
-  /*
-   * From bufferResult to bufferOut
-   */
-  ConvertBuffer( bufferResult, typeResult, bufferOut, typeOut, (dimx*dimy*dimz) );
-
-  /*
-   * Releasing the buffers.
-   */
-  if ( (typeOut != CGAL_FLOAT) && (typeOut != CGAL_DOUBLE) )
-    free( bufferResult );
-  free( (void*)theLine );
-  
-  return( EXIT_ON_SUCCESS );
-}
-
-CGAL_INLINE_FUNCTION
-void Recbuffer_verbose ( )
-{
-  get_static_verbose_recbuffer() = 1;
-  Recline_verbose ( );
-}
-
-CGAL_INLINE_FUNCTION
-void Recbuffer_noverbose ( )
-{
-  get_static_verbose_recbuffer() = 0;
-  Recline_noverbose ( );
-}
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/recline.cpp b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/recline.cpp
deleted file mode 100644
index 4217062..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/recline.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-#ifndef CGAL_HEADER_ONLY
-
-#include "recline.h"
-#include "recline_impl.h"
-
-#endif // CGAL_HEADER_ONLY
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/recline.h b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/recline.h
deleted file mode 100644
index d2f2bc3..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/recline.h
+++ /dev/null
@@ -1,235 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-/*************************************************************************
- * recline.h - tools for recursive filtering of 1D lines
- *
- * $Id$
- *
- * Copyright©INRIA 1998
- *
- * DESCRIPTION: 
- *
- * Recursive filtering of a line (a 1D array)
- *
- * AUTHOR:
- * Gregoire Malandain (greg at sophia.inria.fr)
- * http://www.inria.fr/epidaure/personnel/malandain/
- * 
- * CREATION DATE: 
- * June, 9 1998
- *
- * Copyright Gregoire Malandain, INRIA
- *
- * ADDITIONS, CHANGES
- *
- */
-
-/*
- * recursive filtering of a line (a 1D array)
- */
-
-#ifndef _recline_h_
-#define _recline_h_
-
-
-
-/* The different recursive filter's types.
- *
- * DESCRIPTION:
- *
- * - ALPHA_DERICHE is the first recurvise filter designed
- *   by R. Deriche. See REFERENCES.
- *
- * - with ALPHA_DERICHE's filters, one can either compute
- *   derivatives from order 0 (smoothing) to 3, or extract edges.
- *
- * - GAUSSIAN_DERICHE is a 4th order recursive filter which
- *   approximates the gaussien. See
- *   "Recursively Implementing The Gaussian and Its Derivatives",
- *   R. Deriche, International Conference On Image Processing,
- *   pp 263-267, Singapore, September 1992. Also INRIA research
- *   report.
- *
- * - with GAUSSIAN_DERICHE's filters, one can either compute
- *   derivatives from order 0 (smoothing) to 2, or extract edges.
- *
- * - Extracting edges with ALPHA_DERICHE's filters is faster but
- *   the modulus of the gradient (the estimated height of the step 
- *   edge) depens on the gradient orientation because the filter
- *   is not isotropic. Heights are better estimated with 
- *   GAUSSIAN_DERICHE's filters but they seem not be perfectly
- *   symmetrical.
- *
- * REFERENCES:
- *
- * - "Optimal edge detection using recursive filtering", R. Deriche,
- *   International Journal of Computer Vision, pp 167-187, 1987.
- *
- * - "Recursive filtering and edge tracking: two primary tools
- *    for 3-D edge detection", O. Monga, R. Deriche,
- *   G. Malandain and J.-P. Cocquerez, Image and Vision
- *   Computing 4:9, pp 203-214, August 1991.
- */
-typedef enum {
-  UNKNOWN_FILTER = 0 /* unknown filter type */,
-  ALPHA_DERICHE = 1 /* Deriche's filter (exponential (- alpha |X|)) */,
-  GAUSSIAN_DERICHE = 2 /* gaussian approximation (Deriche's coefficients) */,
-  GAUSSIAN_FIDRICH = 3 /* gaussian approximation (Fidrich's coefficients) */
-} recursiveFilterType;
-
-
-
-/* Order of the derivative to be computed.
- *
- * DESCRIPTION:
- *
- * - NODERIVATIVE nothing will be done.
- *
- * - DERIVATIVE_0 means smoothing.
- *
- * - DERIVATIVE_1 first derivative. The normalization
- *   of the filter is made so that the response to the
- *   signal i=x will be 1.
- *
- * - DERIVATIVE_1_CONTOURS first derivative but adapted
- *   to edge detections. The normalization of the filter 
- *   is made so that the response to a step edge is 
- *   the step edge height.
- *
- * - DERIVATIVE_2 second derivative. The normalization
- *   of the filter is made so that the response to the
- *   signal i=x*2/2 will be 1.
- *
- * - DERIVATIVE_3 third derivative. The normalization
- *   of the filter is made so that the response to the
- *   signal i=x*3/6 will be 1.
- */
-typedef enum {
-  NODERIVATIVE  = -1 /* no derivative (no filtering) */,
-  DERIVATIVE_0  = 0 /* smoothing */,
-  SMOOTHING     = 0 /* smoothing */,
-  DERIVATIVE_1  = 1 /* derivative of order 1 */,
-  DERIVATIVE_2  = 2 /* derivative of order 2 */,
-  DERIVATIVE_3  = 3 /* derivative of order 3 */,
-  DERIVATIVE_1_CONTOURS = 11 /* derivative of order 1, normalization adapted to
-				contours. The response to a step-edge is the 
-				height of the step. */,
-  DERIVATIVE_1_EDGES = 11 /* derivative of order 1, normalization adapted to
-				contours. The response to a step-edge is the 
-				height of the step. */
-} derivativeOrder;
-
-
-
-typedef struct {
-  /*--- denominateur       ---*/
-  double sd1;
-  double sd2;
-  double sd3;
-  double sd4;
-  /*--- numerateur positif ---*/
-  double sp0;
-  double sp1;
-  double sp2;
-  double sp3;
-  /*--- numerateur negatif ---*/
-  double sn0;
-  double sn1;
-  double sn2;
-  double sn3;
-  double sn4;
-  /*--- type de filtre en cours ---*/
-  recursiveFilterType type_filter;
-  derivativeOrder derivative;
-} RFcoefficientType;
-
-
-
-/* Initialization of coefficients for recursive filtering.
- *
- * PARAMETERS:
- *
- * - the coefficient is the sigma's value in case of
- *   gaussian filtering, or the alpha's value in case
- *   of Deriche's filters.
- *
- * - the coefficient's value must be larger than 0.1
- *   in case of gaussian filtering, and in the
- *   [0.1,1.9] range in case of Deriche's filters.
- *
- * SEE:
- *
- * - recursiveFilterType
- *
- * - derivativeOrder
- */
-extern RFcoefficientType * InitRecursiveCoefficients( double x, /* coefficient's value */
-				       recursiveFilterType filterType, /* filter's type */
-				       derivativeOrder derivative /* derivative's order */ );
-
-
-
-/* 1D recursive filtering along a line.
- *
- * WARNING:
- * Coefficients should already be initialized.
- *
- * SEE:
- *
- * - recursiveFilterType
- *
- * - derivativeOrder
- *
- * RETURN:
- *
- * - 0 in case of error
- *
- * - 1 if successful
- */
-extern int RecursiveFilter1D( RFcoefficientType *RFC,
-			      double *in, /* input line */ 
-			      double *out, /* output line */
-			      double *work1, /* first work array */
-			      double *work2, /* second work array, 
-						could be out if out is different from in */
-			      int dim /* lines' length */ );
-
-
-/* Turn on verbose mode.
- *
- * DESCRIPTION:
- * Some information will be written on stderr when processing.
- */
-extern void Recline_verbose ( );
-
-/* Turn off verbose mode.
- *
- * DESCRIPTION:
- * Nothing will be written on stderr when processing.
- */
-extern void Recline_noverbose ( );
-
-#ifdef CGAL_HEADER_ONLY
-#include "recline_impl.h"
-#endif // CGAL_HEADER_ONLY
-
-#endif /* _recline_h_ */
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/reech4x4.cpp b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/reech4x4.cpp
deleted file mode 100644
index 2c01578..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/reech4x4.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-#ifndef CGAL_HEADER_ONLY
-
-#include "reech4x4.h"
-#include "reech4x4_impl.h"
-
-#endif // CGAL_HEADER_ONLY
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/reech4x4.h b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/reech4x4.h
deleted file mode 100644
index 11f84f7..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/reech4x4.h
+++ /dev/null
@@ -1,288 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-/*************************************************************************
- * reech4x4.h -
- *
- * $Id$
- *
- * Copyright©INRIA 1999
- *
- * AUTHOR:
- * Gregoire Malandain (greg at sophia.inria.fr)
- * 
- * CREATION DATE: 
- *
- *
- * ADDITIONS, CHANGES
- *	
- *	
- *	
- *
- */
-
-
-/* CAUTION
-   DO NOT EDIT THIS FILE,
-   UNLESS YOU HAVE A VERY GOOD REASON 
- */
-
-#ifndef _reech4x4_h_
-#define _reech4x4_h_
-
-
-
-
-
-
-
-
-
-extern void Reech3DTriLin4x4_u8 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim,  /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat   /* transformation matrix */
-			     );
-extern void Reech3DTriLin4x4gb_u8 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim, /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat,   /* transformation matrix */
-			     float gain,
-			     float bias );
-extern void Reech3DNearest4x4_u8 ( void* theBuf, /* buffer to be resampled */
-			      int *theDim,  /* dimensions of this buffer */
-			      void* resBuf, /* result buffer */
-			      int *resDim,  /* dimensions of this buffer */
-			      double* mat   /* transformation matrix */
-			      );
-extern void Reech2DTriLin4x4_u8 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim,  /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat   /* transformation matrix */
-			     );
-extern void Reech2DTriLin4x4gb_u8 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim, /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat,   /* transformation matrix */
-			     float gain,
-			     float bias );
-extern void Reech2DNearest4x4_u8 ( void* theBuf, /* buffer to be resampled */
-			      int *theDim,  /* dimensions of this buffer */
-			      void* resBuf, /* result buffer */
-			      int *resDim,  /* dimensions of this buffer */
-			      double* mat   /* transformation matrix */
-			      );
-
-
-
-
-
-
-extern void Reech3DTriLin4x4_s8 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim,  /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat   /* transformation matrix */
-			     );
-extern void Reech3DTriLin4x4gb_s8 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim, /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat,   /* transformation matrix */
-			     float gain,
-			     float bias );
-extern void Reech3DNearest4x4_s8 ( void* theBuf, /* buffer to be resampled */
-			      int *theDim,  /* dimensions of this buffer */
-			      void* resBuf, /* result buffer */
-			      int *resDim,  /* dimensions of this buffer */
-			      double* mat   /* transformation matrix */
-			      );
-extern void Reech2DTriLin4x4_s8 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim,  /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat   /* transformation matrix */
-			     );
-extern void Reech2DTriLin4x4gb_s8 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim, /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat,   /* transformation matrix */
-			     float gain,
-			     float bias );
-extern void Reech2DNearest4x4_s8 ( void* theBuf, /* buffer to be resampled */
-			      int *theDim,  /* dimensions of this buffer */
-			      void* resBuf, /* result buffer */
-			      int *resDim,  /* dimensions of this buffer */
-			      double* mat   /* transformation matrix */
-			      );
-
-
-
-
-
-
-extern void Reech3DTriLin4x4_u16 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim,  /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat   /* transformation matrix */
-			     );
-extern void Reech3DTriLin4x4gb_u16 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim, /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat,   /* transformation matrix */
-			     float gain,
-			     float bias );
-extern void Reech3DNearest4x4_u16 ( void* theBuf, /* buffer to be resampled */
-			      int *theDim,  /* dimensions of this buffer */
-			      void* resBuf, /* result buffer */
-			      int *resDim,  /* dimensions of this buffer */
-			      double* mat   /* transformation matrix */
-			      );
-extern void Reech2DTriLin4x4_u16 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim,  /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat   /* transformation matrix */
-			     );
-extern void Reech2DTriLin4x4gb_u16 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim, /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat,   /* transformation matrix */
-			     float gain,
-			     float bias );
-extern void Reech2DNearest4x4_u16 ( void* theBuf, /* buffer to be resampled */
-			      int *theDim,  /* dimensions of this buffer */
-			      void* resBuf, /* result buffer */
-			      int *resDim,  /* dimensions of this buffer */
-			      double* mat   /* transformation matrix */
-			      );
-
-
-
-
-
-
-extern void Reech3DTriLin4x4_s16 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim,  /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat   /* transformation matrix */
-			     );
-extern void Reech3DTriLin4x4gb_s16 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim, /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat,   /* transformation matrix */
-			     float gain,
-			     float bias );
-extern void Reech3DNearest4x4_s16 ( void* theBuf, /* buffer to be resampled */
-			      int *theDim,  /* dimensions of this buffer */
-			      void* resBuf, /* result buffer */
-			      int *resDim,  /* dimensions of this buffer */
-			      double* mat   /* transformation matrix */
-			      );
-extern void Reech2DTriLin4x4_s16 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim,  /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat   /* transformation matrix */
-			     );
-extern void Reech2DTriLin4x4gb_s16 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim, /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat,   /* transformation matrix */
-			     float gain,
-			     float bias );
-extern void Reech2DNearest4x4_s16 ( void* theBuf, /* buffer to be resampled */
-			      int *theDim,  /* dimensions of this buffer */
-			      void* resBuf, /* result buffer */
-			      int *resDim,  /* dimensions of this buffer */
-			      double* mat   /* transformation matrix */
-			      );
-
-
-
-
-
-
-extern void Reech3DTriLin4x4_r32 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim,  /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat   /* transformation matrix */
-			     );
-extern void Reech3DTriLin4x4gb_r32 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim, /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat,   /* transformation matrix */
-			     float gain,
-			     float bias );
-extern void Reech3DNearest4x4_r32 ( void* theBuf, /* buffer to be resampled */
-			      int *theDim,  /* dimensions of this buffer */
-			      void* resBuf, /* result buffer */
-			      int *resDim,  /* dimensions of this buffer */
-			      double* mat   /* transformation matrix */
-			      );
-extern void Reech2DTriLin4x4_r32 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim,  /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat   /* transformation matrix */
-			     );
-extern void Reech2DTriLin4x4gb_r32 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim, /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat,   /* transformation matrix */
-			     float gain,
-			     float bias );
-extern void Reech2DNearest4x4_r32 ( void* theBuf, /* buffer to be resampled */
-			      int *theDim,  /* dimensions of this buffer */
-			      void* resBuf, /* result buffer */
-			      int *resDim,  /* dimensions of this buffer */
-			      double* mat   /* transformation matrix */
-			      );
-
-
-
-
-
-
-
-extern void Reech4x4_verbose ( );
-extern void Reech4x4_noverbose ( );
-
-#ifdef CGAL_HEADER_ONLY
-#include "reech4x4_impl.h"
-#endif // CGAL_HEADER_ONLY
-
-
-#endif
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/reech4x4_impl.h b/3rdparty/CGAL-4.8/src/CGAL_ImageIO/reech4x4_impl.h
deleted file mode 100644
index 26ef27a..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/reech4x4_impl.h
+++ /dev/null
@@ -1,3176 +0,0 @@
-// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
-// All rights reserved.
-//
-// This file is part of the ImageIO Library, and as been adapted for
-// 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.
-//
-// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// $URL$
-// $Id$
-//
-//
-// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
-
-/*************************************************************************
- * reech4x4.c -
- *
- * $Id$
- *
- * Copyright©INRIA 1999
- *
- * AUTHOR:
- * Gregoire Malandain (greg at sophia.inria.fr)
- * 
- * CREATION DATE: 
- *
- *
- * ADDITIONS, CHANGES
- *	
- *	
- *	
- *
- */
-
-#ifdef CGAL_HEADER_ONLY
-#define CGAL_INLINE_FUNCTION inline
-#else
-#define CGAL_INLINE_FUNCTION
-#endif
-
-/* CAUTION
-   DO NOT EDIT THIS FILE,
-   UNLESS YOU HAVE A VERY GOOD REASON 
- */
-
-#include <stdio.h>
-#include "typedefs.h"
-
-#define _CONVERTR_(R) ( R )
-#define _CONVERTI_(R) ( (R) >= 0.0 ? ((int)((R)+0.5)) : ((int)((R)-0.5)) )
-
-
-#ifdef CGAL_HEADER_ONLY
-
-inline int& get_static_verbose_reech4x4()
-{
-  static int _VERBOSE_REECH_ = 0;
-  return _VERBOSE_REECH_;
-}
-
-#else // CGAL_HEADER_ONLY
-
-static int _VERBOSE_REECH_ = 0;
-
-inline int& get_static_verbose_reech4x4()
-{ return _VERBOSE_REECH_; }
-
-#endif // CGAL_HEADER_ONLY
-
-
-
-
-
-
-/* Resampling procedure.
-
-   Work for 3D images, not for vectorial ones.
-   
-   (double* mat) is the matrix which permits to get
-   from resBuf into theBuf. 
-   If one only have the matrix from theBuf into resBuf,
-   it must be inverted first.
-
-   Soit x le point transforme et ix=(int)x;
-   nous allons distinguer les cas suivants :
-    x < -0.5               => resultat = 0
-    -0.5 <= x < 0.0        => ix=0, on n'interpole pas selon X
-    0.0 < x && ix < dimx-1 => on interpole selon X
-    x < dimx-0.5           => ix=dimx-1, on n'interpole pas selon X
-    x >= dimx-0.5          => resultat = 0
-
-*/
-
-CGAL_INLINE_FUNCTION
-void Reech3DTriLin4x4_u8 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim, /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat   /* transformation matrix */
-			     )
-{
-  int i, j, k, ix, iy, iz;
-  double x, y, z, dx, dy, dz, dxdy,dxdz,dydz,dxdydz;
-  double res;
-  double v6, v5, v4;
-  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
-  int tdimx=theDim[0], tdimy=theDim[1], tdimz=theDim[2];
-  int tdimxy=tdimx*tdimy;
-  int toffset1=tdimxy+tdimx+1, toffset2=tdimxy-tdimx-1;
-  int t1dimx=tdimx-1, t1dimy=tdimy-1, t1dimz=tdimz-1;
-  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
-  double ddimz = (double)tdimz-0.5;
-  u8 *tbuf = (u8*)theBuf;
-  u8 *tpt;
-  u8 *rbuf = (u8*)resBuf;
-
-  for ( k = 0; k < rdimz; k ++ ) {
-    if ( get_static_verbose_reech4x4() != 0 )
-      fprintf( stderr, "Processing slice %d\r", k );
-    for ( j = 0; j < rdimy; j ++ )
-    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
-      /* computation of the corresponding point coordinates in theBuf */
-      x = mat[0] * i +  mat[1] * j + mat[2] * k + mat[3];
-      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
-      y = mat[4] * i +  mat[5] * j + mat[6] * k + mat[7];
-      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
-      z = mat[8] * i +  mat[9] * j + mat[10] * k + mat[11];
-      if ((z < -0.5) || ( z > ddimz)) { *rbuf = 0; continue; }
-
-      /* here, the point lies on the borders or completely inside
-	 the image */
-      ix = (int)x;
-      iy = (int)y;
-      iz = (int)z;
-      tpt = (u8 *)tbuf;
-      
-      /* are we on the border or not ? */
-      if ( (x > 0.0) && (ix < t1dimx) &&
-	   (y > 0.0) && (iy < t1dimy) &&
-	   (z > 0.0) && (iz < t1dimz) ) {
-	/* the corresponding point is in the box defined 
-	   by (ix[+1],iy[+1],iz[+1]) */
-	dx = x - ix;
-	dy = y - iy;
-	dz = z - iz;
-	dxdy = dx*dy;
-	dxdz = dx*dz;
-	dydz = dy*dz;
-	dxdydz = dxdy*dz;
-
-	/* we have
-	   v[7]=dxdydz;            coefficient of tbuf(ix+1,iy+1,iz+1)
-	   v[6]=dxdz-dxdydz;       coefficient of tbuf(ix+1,iy,  iz+1)
-	   v[5]=dxdy-dxdydz;       coefficient of tbuf(ix+1,iy+1,iz  )
-	   v[4]=dx-dxdy-v[6];      coefficient of tbuf(ix+1,iy  ,iz  )
-	   v[3]=dydz-dxdydz;       coefficient of tbuf(ix  ,iy+1,iz+1)
-	   v[2]=dz-dydz-v[6];      coefficient of tbuf(ix  ,iy  ,iz+1)
-	   v[1]=dy-dydz-v[5];      coefficient of tbuf(ix  ,iy+1,iz  )
-	   v[0]=1-dy-dz+dydz-v[4]; coefficient of tbuf(ix  ,iy  ,iz  )
-	*/
-	tpt += ix + iy * tdimx + iz * tdimxy + toffset1;
-	v6 = dxdz-dxdydz;
-	v5 = dxdy-dxdydz;
-	v4 = dx-dxdy-v6;
-
-	res = 0;
-	res += dxdydz * (*tpt);            /* tbuf(ix+1,iy+1,iz+1) */
-	tpt --;
-	res += (dydz-dxdydz) * (*tpt);     /* tbuf(ix  ,iy+1,iz+1) */
-	tpt -= t1dimx;
-	res += v6 * (*tpt);                /* tbuf(ix+1  ,iy,  iz+1) */
-	tpt --;
-	res += (dz-dydz-v6) * (*tpt);      /* tbuf(ix  ,iy  ,iz+1) */
-	tpt -= toffset2;
-	res += v5 * (*tpt);                /* tbuf(ix+1,iy+1,iz  ) */
-	tpt --;
-	res += (dy-dydz-v5) * (*tpt);      /* tbuf(ix  ,iy+1,iz  ) */
-	tpt -= t1dimx;
-	res += v4 * (*tpt);                /* tbuf(ix+1,iy  ,iz  ) */
-	tpt --;
-	res += (1-dy-dz+dydz-v4) * (*tpt); /* tbuf(ix  ,iy  ,iz  ) */
-	*rbuf = (u8)_CONVERTI_( res );
-	continue;
-      }
-      /* here, we are sure we are on some border */
-      tpt += ix + iy * tdimx + iz * tdimxy;
-      if ( (x < 0.0) || (ix == t1dimx) ) {
-	if ( (y < 0.0) || (iy == t1dimy) ) {
-	  if ( (z < 0.0) || (iz == t1dimz) ) {
-	    *rbuf = *tpt;
-	    continue;
-	  }
-	  dz = z - iz;
-	  res  = (1-dz) * (*tpt); /* (1-dz)* tbuf(ix,iy,iz) */
-	  tpt += tdimxy;
-	  res += dz * (*tpt);     /* dz * tbuf(ix,iy,iz+1) */
-	  *rbuf = (u8)_CONVERTI_( res );
-	  continue;
-	}
-	dy = y - iy;
-	if ( (z < 0.0) || (iz == t1dimz) ) {
-	  res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy,iz) */
-	  tpt += tdimx;
-	  res += dy * (*tpt);     /* dy * tbuf(ix,iy+1,iz) */
-	  *rbuf = (u8)_CONVERTI_( res );
-	  continue;
- 	}
-	dz = z - iz;
-	res = (1-dy)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
-	tpt += tdimx;
-	res += dy*(1-dz) * (*tpt);    /* tbuf(ix,iy+1,iz) */
-	tpt += toffset2+1;
-	res += (1-dy)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
-	tpt += tdimx;
-	res += dy*dz * (*tpt);        /* tbuf(ix,iy+1,iz+1) */
-	*rbuf = (u8)_CONVERTI_( res );
-	continue;
-      }
-      /* here we are sure that the border is either
-	 along the Y or the Z axis */
-      dx = x - ix;
-      if ( (y < 0.0) || (iy == t1dimy) ) {
-	if ( (z < 0.0) || (iz == t1dimz) ) {
-	  res = (1-dx) * (*tpt); /* tbuf(ix,iy,iz) */
-	  tpt ++;
-	  res += dx * (*tpt);    /* tbuf(ix+1,iy,iz) */
-	  *rbuf = (u8)_CONVERTI_( res );
-	  continue;
-	}
-	dz = z - iz;
-	res = (1-dx)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
-	tpt ++;
-	res += dx*(1-dz) * (*tpt);    /* tbuf(ix+1,iy,iz) */
-	tpt += tdimxy-1;
-	res += (1-dx)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
-	tpt ++;
-	res += dx*dz * (*tpt);        /* tbuf(ix+1,iy,iz+1) */
-	*rbuf = (u8)_CONVERTI_( res );
-	continue;
-      }
-      /* here we are sure that the border is along the Z axis */
-      dy = y - iy;
-      res = (1-dx)*(1-dy) * (*tpt); /* tbuf(ix,iy,iz) */
-      tpt ++;
-      res += dx*(1-dy) * (*tpt);    /* tbuf(ix+1,iy,iz) */
-      tpt += t1dimx;
-      res += (1-dx)*dy * (*tpt);    /* tbuf(ix,iy+1,iz) */
-      tpt ++;
-      res += dx*dy * (*tpt);        /* tbuf(ix+1,iy+1,iz) */
-      *rbuf = (u8)_CONVERTI_( res );
-    }
-  }
-}
-
-CGAL_INLINE_FUNCTION
-void Reech3DTriLin4x4gb_u8 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim, /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat,   /* transformation matrix */
-			     float gain,
-			     float bias )
-{
-  int i, j, k, ix, iy, iz;
-  double x, y, z, dx, dy, dz, dxdy,dxdz,dydz,dxdydz;
-  double res;
-  double v6, v5, v4;
-  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
-  int tdimx=theDim[0], tdimy=theDim[1], tdimz=theDim[2];
-  int tdimxy=tdimx*tdimy;
-  int toffset1=tdimxy+tdimx+1, toffset2=tdimxy-tdimx-1;
-  int t1dimx=tdimx-1, t1dimy=tdimy-1, t1dimz=tdimz-1;
-  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
-  double ddimz = (double)tdimz-0.5;
-  u8 *tbuf = (u8*)theBuf;
-  u8 *tpt;
-  u8 *rbuf = (u8*)resBuf;
-  double b=bias;
-  double g=gain;
-
-  for ( k = 0; k < rdimz; k ++ ) {
-    if ( get_static_verbose_reech4x4() != 0 )
-      fprintf( stderr, "Processing slice %d\r", k );
-    for ( j = 0; j < rdimy; j ++ )
-    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
-      /* computation of the corresponding point coordinates in theBuf */
-      x = mat[0] * i +  mat[1] * j + mat[2] * k + mat[3];
-      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
-      y = mat[4] * i +  mat[5] * j + mat[6] * k + mat[7];
-      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
-      z = mat[8] * i +  mat[9] * j + mat[10] * k + mat[11];
-      if ((z < -0.5) || ( z > ddimz)) { *rbuf = 0; continue; }
-
-      /* here, the point lies on the borders or completely inside
-	 the image */
-      ix = (int)x;
-      iy = (int)y;
-      iz = (int)z;
-      tpt = (u8 *)tbuf;
-      
-      /* are we on the border or not ? */
-      if ( (x > 0.0) && (ix < t1dimx) &&
-	   (y > 0.0) && (iy < t1dimy) &&
-	   (z > 0.0) && (iz < t1dimz) ) {
-	/* the corresponding point is in the box defined 
-	   by (ix[+1],iy[+1],iz[+1]) */
-	dx = x - ix;
-	dy = y - iy;
-	dz = z - iz;
-	dxdy = dx*dy;
-	dxdz = dx*dz;
-	dydz = dy*dz;
-	dxdydz = dxdy*dz;
-
-	/* we have
-	   v[7]=dxdydz;            coefficient of tbuf(ix+1,iy+1,iz+1)
-	   v[6]=dxdz-dxdydz;       coefficient of tbuf(ix+1,iy,  iz+1)
-	   v[5]=dxdy-dxdydz;       coefficient of tbuf(ix+1,iy+1,iz  )
-	   v[4]=dx-dxdy-v[6];      coefficient of tbuf(ix+1,iy  ,iz  )
-	   v[3]=dydz-dxdydz;       coefficient of tbuf(ix  ,iy+1,iz+1)
-	   v[2]=dz-dydz-v[6];      coefficient of tbuf(ix  ,iy  ,iz+1)
-	   v[1]=dy-dydz-v[5];      coefficient of tbuf(ix  ,iy+1,iz  )
-	   v[0]=1-dy-dz+dydz-v[4]; coefficient of tbuf(ix  ,iy  ,iz  )
-	*/
-	tpt += ix + iy * tdimx + iz * tdimxy + toffset1;
-	v6 = dxdz-dxdydz;
-	v5 = dxdy-dxdydz;
-	v4 = dx-dxdy-v6;
-
-	res = 0;
-	res += dxdydz * (*tpt);            /* tbuf(ix+1,iy+1,iz+1) */
-	tpt --;
-	res += (dydz-dxdydz) * (*tpt);     /* tbuf(ix  ,iy+1,iz+1) */
-	tpt -= t1dimx;
-	res += v6 * (*tpt);                /* tbuf(ix+1  ,iy,  iz+1) */
-	tpt --;
-	res += (dz-dydz-v6) * (*tpt);      /* tbuf(ix  ,iy  ,iz+1) */
-	tpt -= toffset2;
-	res += v5 * (*tpt);                /* tbuf(ix+1,iy+1,iz  ) */
-	tpt --;
-	res += (dy-dydz-v5) * (*tpt);      /* tbuf(ix  ,iy+1,iz  ) */
-	tpt -= t1dimx;
-	res += v4 * (*tpt);                /* tbuf(ix+1,iy  ,iz  ) */
-	tpt --;
-	res += (1-dy-dz+dydz-v4) * (*tpt); /* tbuf(ix  ,iy  ,iz  ) */
-	res = res * g + b;
-	*rbuf = (u8)_CONVERTI_( res );
-	continue;
-      }
-      /* here, we are sure we are on some border */
-      tpt += ix + iy * tdimx + iz * tdimxy;
-      if ( (x < 0.0) || (ix == t1dimx) ) {
-	if ( (y < 0.0) || (iy == t1dimy) ) {
-	  if ( (z < 0.0) || (iz == t1dimz) ) {
-	    res = (double)(*tpt) * g + b;
-	    *rbuf = (u8)_CONVERTI_( res );
-	    continue;
-	  }
-	  dz = z - iz;
-	  res  = (1-dz) * (*tpt); /* (1-dz)* tbuf(ix,iy,iz) */
-	  tpt += tdimxy;
-	  res += dz * (*tpt);     /* dz * tbuf(ix,iy,iz+1) */
-	  res = res * g + b;
-	  *rbuf = (u8)_CONVERTI_( res );
-	  continue;
-	}
-	dy = y - iy;
-	if ( (z < 0.0) || (iz == t1dimz) ) {
-	  res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy,iz) */
-	  tpt += tdimx;
-	  res += dy * (*tpt);     /* dy * tbuf(ix,iy+1,iz) */
-	  res = res * g + b;
-	  *rbuf = (u8)_CONVERTI_( res );
-	  continue;
- 	}
-	dz = z - iz;
-	res = (1-dy)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
-	tpt += tdimx;
-	res += dy*(1-dz) * (*tpt);    /* tbuf(ix,iy+1,iz) */
-	tpt += toffset2+1;
-	res += (1-dy)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
-	tpt += tdimx;
-	res += dy*dz * (*tpt);        /* tbuf(ix,iy+1,iz+1) */
-	res = res * g + b;
-	*rbuf = (u8)_CONVERTI_( res );
-	continue;
-      }
-      /* here we are sure that the border is either
-	 along the Y or the Z axis */
-      dx = x - ix;
-      if ( (y < 0.0) || (iy == t1dimy) ) {
-	if ( (z < 0.0) || (iz == t1dimz) ) {
-	  res = (1-dx) * (*tpt); /* tbuf(ix,iy,iz) */
-	  tpt ++;
-	  res += dx * (*tpt);    /* tbuf(ix+1,iy,iz) */
-	  res = res * g + b;
-	  *rbuf = (u8)_CONVERTI_( res );
-	  continue;
-	}
-	dz = z - iz;
-	res = (1-dx)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
-	tpt ++;
-	res += dx*(1-dz) * (*tpt);    /* tbuf(ix+1,iy,iz) */
-	tpt += tdimxy-1;
-	res += (1-dx)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
-	tpt ++;
-	res += dx*dz * (*tpt);        /* tbuf(ix+1,iy,iz+1) */
-	res = res * g + b;
-	*rbuf = (u8)_CONVERTI_( res );
-	continue;
-      }
-      /* here we are sure that the border is along the Z axis */
-      dy = y - iy;
-      res = (1-dx)*(1-dy) * (*tpt); /* tbuf(ix,iy,iz) */
-      tpt ++;
-      res += dx*(1-dy) * (*tpt);    /* tbuf(ix+1,iy,iz) */
-      tpt += t1dimx;
-      res += (1-dx)*dy * (*tpt);    /* tbuf(ix,iy+1,iz) */
-      tpt ++;
-      res += dx*dy * (*tpt);        /* tbuf(ix+1,iy+1,iz) */
-      res = res * g + b;
-      *rbuf = (u8)_CONVERTI_( res );
-    }
-  }
-}
-
-CGAL_INLINE_FUNCTION
-void Reech3DNearest4x4_u8 ( void* theBuf, /* buffer to be resampled */
-			      int *theDim,  /* dimensions of this buffer */
-			      void* resBuf, /* result buffer */
-			      int *resDim,  /* dimensions of this buffer */
-			      double* mat   /* transformation matrix */
-			      )
-{
-  int i, j, k, ix, iy, iz;
-  double x, y, z;
-  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
-  int tdimx=theDim[0], tdimy=theDim[1], tdimz=theDim[2];
-  int tdimxy=tdimx*tdimy;
-  int t1dimx=tdimx-1, t1dimy=tdimy-1, t1dimz=tdimz-1;
-  u8 *tbuf = (u8*)theBuf;
-  u8 *rbuf = (u8*)resBuf;
-
-  for ( k = 0; k < rdimz; k ++ ) {
-    if ( get_static_verbose_reech4x4() != 0 )
-      fprintf( stderr, "Processing slice %d\r", k );
-    for ( j = 0; j < rdimy; j ++ )
-    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
-      /* computation of the corresponding point coordinates in theBuf */
-      x = mat[0] * i +  mat[1] * j + mat[2] * k + mat[3];
-      ix = (int)(x+0.5);
-      if (( x < -0.5 ) || ( ix > t1dimx)) { *rbuf = 0; continue; }
-      y = mat[4] * i +  mat[5] * j + mat[6] * k + mat[7];
-      iy = (int)(y+0.5);
-      if (( y < -0.5 ) || ( iy > t1dimy)) { *rbuf = 0; continue; }
-      z = mat[8] * i +  mat[9] * j + mat[10] * k + mat[11];
-      iz = (int)(z+0.5);
-      if (( z < -0.5 ) || ( iz > t1dimz)) { *rbuf = 0; continue; }
-      
-      *rbuf = tbuf[ ix + iy * tdimx + iz * tdimxy ];
-    }
-  }
-}
-
-CGAL_INLINE_FUNCTION
-void Reech2DTriLin4x4_u8 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim,  /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat   /* transformation matrix */
-			     )
-{
-  int i, j, k, ix, iy;
-  double x, y, dx, dy, dxdy;
-  double res, v;
-  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
-  int tdimx=theDim[0], tdimy=theDim[1];
-  int toffset=tdimx-1;
-  int t1dimx=tdimx-1, t1dimy=tdimy-1;
-  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
-  u8 *tbuf = (u8*)theBuf;
-  u8 *tpt;
-  u8 *rbuf = (u8*)resBuf;
-
-  for ( k = 0; k < rdimz; k ++ ) {
-    if ( get_static_verbose_reech4x4() != 0 )
-      fprintf( stderr, "Processing slice %d\r", k );
-    /* tbuf represente le premier point du plan */
-    tbuf  = (u8*)theBuf;
-    tbuf += k*(tdimx * tdimy);
-    for ( j = 0; j < rdimy; j ++ )
-    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
-      /* computation of the corresponding point coordinates in theBuf */
-      x = mat[0] * i +  mat[1] * j +              mat[3];
-      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
-      y = mat[4] * i +  mat[5] * j +              mat[7];
-      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
-
-      /* here, the point lies on the borders or completely inside
-	 the image */
-      ix = (int)x;      
-      iy = (int)y;
-      tpt = (u8 *)tbuf;
-      tpt += ix + iy * tdimx;
-      
-      /* are we on the border or not ? */
-      if ( (x > 0.0) && (ix < t1dimx) &&
-	   (y > 0.0) && (iy < t1dimy) ) {
-	dx = x - ix;
-	dy = y - iy;
-	dxdy = dx*dy;
-	/* we have
-	   v[5]=dxdy;         coefficient of tbuf(ix+1,iy+1)
-	   v[4]=dx-dxdy;      coefficient of tbuf(ix+1,iy  )
-	   v[1]=dy-dxdy;      coefficient of tbuf(ix  ,iy+1)
-	   v[0]=1-dx-dy+dxdy; coefficient of tbuf(ix  ,iy  )
-	*/
-	v = dy-dxdy;
-	res = 0;
-	res += (1-dx-v) * (*tpt);  /* tbuf(ix  ,iy  ) */
-	tpt ++;
-	res += (dx-dxdy) * (*tpt); /* tbuf(ix+1,iy  ) */
-	tpt += toffset;
-	res += v * (*tpt);       /* tbuf(ix,iy+1  ) */
-	tpt ++;
-	res += dxdy * (*tpt);      /* tbuf(ix+1,iy+1) */
-	*rbuf = (u8)_CONVERTI_( res );
-	continue;
-      }
-
-      /* here, we are sure we are on some border */
-      if ( (x < 0.0) || (ix == t1dimx) ) {
-	/* we just look at y */
-	if ( (y < 0.0) || (iy == t1dimy) ) {
-	  *rbuf = *tpt;
-	  continue;
-	}
-	dy = y - iy;
-	res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy) */
-	tpt += tdimx;
-	res += dy * (*tpt);     /* dy * tbuf(ix,iy+1) */
-	*rbuf = (u8)_CONVERTI_( res );
-	continue;
-      }
-      dx = x - ix;
-      res  = (1-dx) * (*tpt); /* (1-dx)* tbuf(ix,iy) */
-      tpt ++;
-      res += dx * (*tpt);     /* dx * tbuf(ix+1,iy) */
-      *rbuf = (u8)_CONVERTI_( res );
-    }
-  }
-}
-
-CGAL_INLINE_FUNCTION
-void Reech2DTriLin4x4gb_u8 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim,  /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat,   /* transformation matrix */
-			     float gain,
-			     float bias )
-{
-  int i, j, k, ix, iy;
-  double x, y, dx, dy, dxdy;
-  double res, v;
-  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
-  int tdimx=theDim[0], tdimy=theDim[1];
-  int toffset=tdimx-1;
-  int t1dimx=tdimx-1, t1dimy=tdimy-1;
-  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
-  u8 *tbuf = (u8*)theBuf;
-  u8 *tpt;
-  u8 *rbuf = (u8*)resBuf;
-  double b=bias;
-  double g=gain;
-
-  for ( k = 0; k < rdimz; k ++ ) {
-    if ( get_static_verbose_reech4x4() != 0 )
-      fprintf( stderr, "Processing slice %d\r", k );
-    /* tbuf represente le premier point du plan */
-    tbuf  = (u8*)theBuf;
-    tbuf += k*(tdimx * tdimy);
-    for ( j = 0; j < rdimy; j ++ )
-    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
-      /* computation of the corresponding point coordinates in theBuf */
-      x = mat[0] * i +  mat[1] * j +              mat[3];
-      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
-      y = mat[4] * i +  mat[5] * j +              mat[7];
-      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
-
-      /* here, the point lies on the borders or completely inside
-	 the image */
-      ix = (int)x;      
-      iy = (int)y;
-      tpt = (u8 *)tbuf;
-      tpt += ix + iy * tdimx;
-      
-      /* are we on the border or not ? */
-      if ( (x > 0.0) && (ix < t1dimx) &&
-	   (y > 0.0) && (iy < t1dimy) ) {
-	dx = x - ix;
-	dy = y - iy;
-	dxdy = dx*dy;
-	/* we have
-	   v[5]=dxdy;         coefficient of tbuf(ix+1,iy+1)
-	   v[4]=dx-dxdy;      coefficient of tbuf(ix+1,iy  )
-	   v[1]=dy-dxdy;      coefficient of tbuf(ix  ,iy+1)
-	   v[0]=1-dx-dy+dxdy; coefficient of tbuf(ix  ,iy  )
-	*/
-	v = dy-dxdy;
-	res = 0;
-	res += (1-dx-v) * (*tpt);  /* tbuf(ix  ,iy  ) */
-	tpt ++;
-	res += (dx-dxdy) * (*tpt); /* tbuf(ix+1,iy  ) */
-	tpt += toffset;
-	res += v * (*tpt);       /* tbuf(ix,iy+1  ) */
-	tpt ++;
-	res += dxdy * (*tpt);      /* tbuf(ix+1,iy+1) */
-	res = res * g + b;
-	*rbuf = (u8)_CONVERTI_( res );
-	continue;
-      }
-
-      /* here, we are sure we are on some border */
-      if ( (x < 0.0) || (ix == t1dimx) ) {
-	/* we just look at y */
-	if ( (y < 0.0) || (iy == t1dimy) ) {
-	  res = (double)(*tpt) * g + b;
-	  *rbuf = (u8)_CONVERTI_( res );
-	  continue;
-	}
-	dy = y - iy;
-	res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy) */
-	tpt += tdimx;
-	res += dy * (*tpt);     /* dy * tbuf(ix,iy+1) */
-	res = (double)(*tpt) * g + b;
-	*rbuf = (u8)_CONVERTI_( res );
-	continue;
-      }
-      dx = x - ix;
-      res  = (1-dx) * (*tpt); /* (1-dx)* tbuf(ix,iy) */
-      tpt ++;
-      res += dx * (*tpt);     /* dx * tbuf(ix+1,iy) */
-      res = res * g + b;
-            *rbuf = (u8)_CONVERTI_( res );
-    }
-  }
-}
-
-CGAL_INLINE_FUNCTION
-void Reech2DNearest4x4_u8 ( void* theBuf, /* buffer to be resampled */
-			      int *theDim,  /* dimensions of this buffer */
-			      void* resBuf, /* result buffer */
-			      int *resDim,  /* dimensions of this buffer */
-			      double* mat   /* transformation matrix */
-			      )
-{
-  int i, j, k, ix, iy;
-  double x, y;
-  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
-  int tdimx=theDim[0], tdimy=theDim[1];
-  int t1dimx=tdimx-1, t1dimy=tdimy-1;
-  u8 *tbuf = (u8*)theBuf;
-  u8 *rbuf = (u8*)resBuf;
-
-  for ( k = 0; k < rdimz; k ++ ) {
-    if ( get_static_verbose_reech4x4() != 0 )
-      fprintf( stderr, "Processing slice %d\r", k );
-    /* tbuf represente le premier point du plan */
-    tbuf  = (u8*)theBuf;
-    tbuf += k*(tdimx * tdimy);
-    for ( j = 0; j < rdimy; j ++ )
-    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
-      /* computation of the corresponding point coordinates in theBuf */
-      x = mat[0] * i +  mat[1] * j + mat[3];
-      ix = (int)(x+0.5);
-      if (( x < -0.5 ) || ( ix > t1dimx)) { *rbuf = 0; continue; }
-      y = mat[4] * i +  mat[5] * j + mat[7];
-      iy = (int)(y+0.5);
-      if (( y < -0.5 ) || ( iy > t1dimy)) { *rbuf = 0; continue; }
-      
-      *rbuf = tbuf[ ix + iy * tdimx ];
-    }
-  }
-}
-
-
-
-
-
-
-/* Resampling procedure.
-
-   Work for 3D images, not for vectorial ones.
-   
-   (double* mat) is the matrix which permits to get
-   from resBuf into theBuf. 
-   If one only have the matrix from theBuf into resBuf,
-   it must be inverted first.
-
-   Soit x le point transforme et ix=(int)x;
-   nous allons distinguer les cas suivants :
-    x < -0.5               => resultat = 0
-    -0.5 <= x < 0.0        => ix=0, on n'interpole pas selon X
-    0.0 < x && ix < dimx-1 => on interpole selon X
-    x < dimx-0.5           => ix=dimx-1, on n'interpole pas selon X
-    x >= dimx-0.5          => resultat = 0
-
-*/
-CGAL_INLINE_FUNCTION
-void Reech3DTriLin4x4_s8 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim, /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat   /* transformation matrix */
-			     )
-{
-  int i, j, k, ix, iy, iz;
-  double x, y, z, dx, dy, dz, dxdy,dxdz,dydz,dxdydz;
-  double res;
-  double v6, v5, v4;
-  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
-  int tdimx=theDim[0], tdimy=theDim[1], tdimz=theDim[2];
-  int tdimxy=tdimx*tdimy;
-  int toffset1=tdimxy+tdimx+1, toffset2=tdimxy-tdimx-1;
-  int t1dimx=tdimx-1, t1dimy=tdimy-1, t1dimz=tdimz-1;
-  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
-  double ddimz = (double)tdimz-0.5;
-  s8 *tbuf = (s8*)theBuf;
-  s8 *tpt;
-  s8 *rbuf = (s8*)resBuf;
-
-  for ( k = 0; k < rdimz; k ++ ) {
-    if ( get_static_verbose_reech4x4() != 0 )
-      fprintf( stderr, "Processing slice %d\r", k );
-    for ( j = 0; j < rdimy; j ++ )
-    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
-      /* computation of the corresponding point coordinates in theBuf */
-      x = mat[0] * i +  mat[1] * j + mat[2] * k + mat[3];
-      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
-      y = mat[4] * i +  mat[5] * j + mat[6] * k + mat[7];
-      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
-      z = mat[8] * i +  mat[9] * j + mat[10] * k + mat[11];
-      if ((z < -0.5) || ( z > ddimz)) { *rbuf = 0; continue; }
-
-      /* here, the point lies on the borders or completely inside
-	 the image */
-      ix = (int)x;
-      iy = (int)y;
-      iz = (int)z;
-      tpt = (s8 *)tbuf;
-      
-      /* are we on the border or not ? */
-      if ( (x > 0.0) && (ix < t1dimx) &&
-	   (y > 0.0) && (iy < t1dimy) &&
-	   (z > 0.0) && (iz < t1dimz) ) {
-	/* the corresponding point is in the box defined 
-	   by (ix[+1],iy[+1],iz[+1]) */
-	dx = x - ix;
-	dy = y - iy;
-	dz = z - iz;
-	dxdy = dx*dy;
-	dxdz = dx*dz;
-	dydz = dy*dz;
-	dxdydz = dxdy*dz;
-
-	/* we have
-	   v[7]=dxdydz;            coefficient of tbuf(ix+1,iy+1,iz+1)
-	   v[6]=dxdz-dxdydz;       coefficient of tbuf(ix+1,iy,  iz+1)
-	   v[5]=dxdy-dxdydz;       coefficient of tbuf(ix+1,iy+1,iz  )
-	   v[4]=dx-dxdy-v[6];      coefficient of tbuf(ix+1,iy  ,iz  )
-	   v[3]=dydz-dxdydz;       coefficient of tbuf(ix  ,iy+1,iz+1)
-	   v[2]=dz-dydz-v[6];      coefficient of tbuf(ix  ,iy  ,iz+1)
-	   v[1]=dy-dydz-v[5];      coefficient of tbuf(ix  ,iy+1,iz  )
-	   v[0]=1-dy-dz+dydz-v[4]; coefficient of tbuf(ix  ,iy  ,iz  )
-	*/
-	tpt += ix + iy * tdimx + iz * tdimxy + toffset1;
-	v6 = dxdz-dxdydz;
-	v5 = dxdy-dxdydz;
-	v4 = dx-dxdy-v6;
-
-	res = 0;
-	res += dxdydz * (*tpt);            /* tbuf(ix+1,iy+1,iz+1) */
-	tpt --;
-	res += (dydz-dxdydz) * (*tpt);     /* tbuf(ix  ,iy+1,iz+1) */
-	tpt -= t1dimx;
-	res += v6 * (*tpt);                /* tbuf(ix+1  ,iy,  iz+1) */
-	tpt --;
-	res += (dz-dydz-v6) * (*tpt);      /* tbuf(ix  ,iy  ,iz+1) */
-	tpt -= toffset2;
-	res += v5 * (*tpt);                /* tbuf(ix+1,iy+1,iz  ) */
-	tpt --;
-	res += (dy-dydz-v5) * (*tpt);      /* tbuf(ix  ,iy+1,iz  ) */
-	tpt -= t1dimx;
-	res += v4 * (*tpt);                /* tbuf(ix+1,iy  ,iz  ) */
-	tpt --;
-	res += (1-dy-dz+dydz-v4) * (*tpt); /* tbuf(ix  ,iy  ,iz  ) */
-	*rbuf = (s8)_CONVERTI_( res );
-	continue;
-      }
-      /* here, we are sure we are on some border */
-      tpt += ix + iy * tdimx + iz * tdimxy;
-      if ( (x < 0.0) || (ix == t1dimx) ) {
-	if ( (y < 0.0) || (iy == t1dimy) ) {
-	  if ( (z < 0.0) || (iz == t1dimz) ) {
-	    *rbuf = *tpt;
-	    continue;
-	  }
-	  dz = z - iz;
-	  res  = (1-dz) * (*tpt); /* (1-dz)* tbuf(ix,iy,iz) */
-	  tpt += tdimxy;
-	  res += dz * (*tpt);     /* dz * tbuf(ix,iy,iz+1) */
-	  *rbuf = (s8)_CONVERTI_( res );
-	  continue;
-	}
-	dy = y - iy;
-	if ( (z < 0.0) || (iz == t1dimz) ) {
-	  res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy,iz) */
-	  tpt += tdimx;
-	  res += dy * (*tpt);     /* dy * tbuf(ix,iy+1,iz) */
-	  *rbuf = (s8)_CONVERTI_( res );
-	  continue;
- 	}
-	dz = z - iz;
-	res = (1-dy)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
-	tpt += tdimx;
-	res += dy*(1-dz) * (*tpt);    /* tbuf(ix,iy+1,iz) */
-	tpt += toffset2+1;
-	res += (1-dy)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
-	tpt += tdimx;
-	res += dy*dz * (*tpt);        /* tbuf(ix,iy+1,iz+1) */
-	*rbuf = (s8)_CONVERTI_( res );
-	continue;
-      }
-      /* here we are sure that the border is either
-	 along the Y or the Z axis */
-      dx = x - ix;
-      if ( (y < 0.0) || (iy == t1dimy) ) {
-	if ( (z < 0.0) || (iz == t1dimz) ) {
-	  res = (1-dx) * (*tpt); /* tbuf(ix,iy,iz) */
-	  tpt ++;
-	  res += dx * (*tpt);    /* tbuf(ix+1,iy,iz) */
-	  *rbuf = (s8)_CONVERTI_( res );
-	  continue;
-	}
-	dz = z - iz;
-	res = (1-dx)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
-	tpt ++;
-	res += dx*(1-dz) * (*tpt);    /* tbuf(ix+1,iy,iz) */
-	tpt += tdimxy-1;
-	res += (1-dx)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
-	tpt ++;
-	res += dx*dz * (*tpt);        /* tbuf(ix+1,iy,iz+1) */
-	*rbuf = (s8)_CONVERTI_( res );
-	continue;
-      }
-      /* here we are sure that the border is along the Z axis */
-      dy = y - iy;
-      res = (1-dx)*(1-dy) * (*tpt); /* tbuf(ix,iy,iz) */
-      tpt ++;
-      res += dx*(1-dy) * (*tpt);    /* tbuf(ix+1,iy,iz) */
-      tpt += t1dimx;
-      res += (1-dx)*dy * (*tpt);    /* tbuf(ix,iy+1,iz) */
-      tpt ++;
-      res += dx*dy * (*tpt);        /* tbuf(ix+1,iy+1,iz) */
-      *rbuf = (s8)_CONVERTI_( res );
-    }
-  }
-}
-
-CGAL_INLINE_FUNCTION
-void Reech3DTriLin4x4gb_s8 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim, /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat,   /* transformation matrix */
-			     float gain,
-			     float bias )
-{
-  int i, j, k, ix, iy, iz;
-  double x, y, z, dx, dy, dz, dxdy,dxdz,dydz,dxdydz;
-  double res;
-  double v6, v5, v4;
-  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
-  int tdimx=theDim[0], tdimy=theDim[1], tdimz=theDim[2];
-  int tdimxy=tdimx*tdimy;
-  int toffset1=tdimxy+tdimx+1, toffset2=tdimxy-tdimx-1;
-  int t1dimx=tdimx-1, t1dimy=tdimy-1, t1dimz=tdimz-1;
-  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
-  double ddimz = (double)tdimz-0.5;
-  s8 *tbuf = (s8*)theBuf;
-  s8 *tpt;
-  s8 *rbuf = (s8*)resBuf;
-  double b=bias;
-  double g=gain;
-
-  for ( k = 0; k < rdimz; k ++ ) {
-    if ( get_static_verbose_reech4x4() != 0 )
-      fprintf( stderr, "Processing slice %d\r", k );
-    for ( j = 0; j < rdimy; j ++ )
-    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
-      /* computation of the corresponding point coordinates in theBuf */
-      x = mat[0] * i +  mat[1] * j + mat[2] * k + mat[3];
-      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
-      y = mat[4] * i +  mat[5] * j + mat[6] * k + mat[7];
-      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
-      z = mat[8] * i +  mat[9] * j + mat[10] * k + mat[11];
-      if ((z < -0.5) || ( z > ddimz)) { *rbuf = 0; continue; }
-
-      /* here, the point lies on the borders or completely inside
-	 the image */
-      ix = (int)x;
-      iy = (int)y;
-      iz = (int)z;
-      tpt = (s8 *)tbuf;
-      
-      /* are we on the border or not ? */
-      if ( (x > 0.0) && (ix < t1dimx) &&
-	   (y > 0.0) && (iy < t1dimy) &&
-	   (z > 0.0) && (iz < t1dimz) ) {
-	/* the corresponding point is in the box defined 
-	   by (ix[+1],iy[+1],iz[+1]) */
-	dx = x - ix;
-	dy = y - iy;
-	dz = z - iz;
-	dxdy = dx*dy;
-	dxdz = dx*dz;
-	dydz = dy*dz;
-	dxdydz = dxdy*dz;
-
-	/* we have
-	   v[7]=dxdydz;            coefficient of tbuf(ix+1,iy+1,iz+1)
-	   v[6]=dxdz-dxdydz;       coefficient of tbuf(ix+1,iy,  iz+1)
-	   v[5]=dxdy-dxdydz;       coefficient of tbuf(ix+1,iy+1,iz  )
-	   v[4]=dx-dxdy-v[6];      coefficient of tbuf(ix+1,iy  ,iz  )
-	   v[3]=dydz-dxdydz;       coefficient of tbuf(ix  ,iy+1,iz+1)
-	   v[2]=dz-dydz-v[6];      coefficient of tbuf(ix  ,iy  ,iz+1)
-	   v[1]=dy-dydz-v[5];      coefficient of tbuf(ix  ,iy+1,iz  )
-	   v[0]=1-dy-dz+dydz-v[4]; coefficient of tbuf(ix  ,iy  ,iz  )
-	*/
-	tpt += ix + iy * tdimx + iz * tdimxy + toffset1;
-	v6 = dxdz-dxdydz;
-	v5 = dxdy-dxdydz;
-	v4 = dx-dxdy-v6;
-
-	res = 0;
-	res += dxdydz * (*tpt);            /* tbuf(ix+1,iy+1,iz+1) */
-	tpt --;
-	res += (dydz-dxdydz) * (*tpt);     /* tbuf(ix  ,iy+1,iz+1) */
-	tpt -= t1dimx;
-	res += v6 * (*tpt);                /* tbuf(ix+1  ,iy,  iz+1) */
-	tpt --;
-	res += (dz-dydz-v6) * (*tpt);      /* tbuf(ix  ,iy  ,iz+1) */
-	tpt -= toffset2;
-	res += v5 * (*tpt);                /* tbuf(ix+1,iy+1,iz  ) */
-	tpt --;
-	res += (dy-dydz-v5) * (*tpt);      /* tbuf(ix  ,iy+1,iz  ) */
-	tpt -= t1dimx;
-	res += v4 * (*tpt);                /* tbuf(ix+1,iy  ,iz  ) */
-	tpt --;
-	res += (1-dy-dz+dydz-v4) * (*tpt); /* tbuf(ix  ,iy  ,iz  ) */
-	res = res * g + b;
-	*rbuf = (s8)_CONVERTI_( res );
-	continue;
-      }
-      /* here, we are sure we are on some border */
-      tpt += ix + iy * tdimx + iz * tdimxy;
-      if ( (x < 0.0) || (ix == t1dimx) ) {
-	if ( (y < 0.0) || (iy == t1dimy) ) {
-	  if ( (z < 0.0) || (iz == t1dimz) ) {
-	    res = (double)(*tpt) * g + b;
-	    *rbuf = (s8)_CONVERTI_( res );
-	    continue;
-	  }
-	  dz = z - iz;
-	  res  = (1-dz) * (*tpt); /* (1-dz)* tbuf(ix,iy,iz) */
-	  tpt += tdimxy;
-	  res += dz * (*tpt);     /* dz * tbuf(ix,iy,iz+1) */
-	  res = res * g + b;
-	  *rbuf = (s8)_CONVERTI_( res );
-	  continue;
-	}
-	dy = y - iy;
-	if ( (z < 0.0) || (iz == t1dimz) ) {
-	  res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy,iz) */
-	  tpt += tdimx;
-	  res += dy * (*tpt);     /* dy * tbuf(ix,iy+1,iz) */
-	  res = res * g + b;
-	  *rbuf = (s8)_CONVERTI_( res );
-	  continue;
- 	}
-	dz = z - iz;
-	res = (1-dy)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
-	tpt += tdimx;
-	res += dy*(1-dz) * (*tpt);    /* tbuf(ix,iy+1,iz) */
-	tpt += toffset2+1;
-	res += (1-dy)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
-	tpt += tdimx;
-	res += dy*dz * (*tpt);        /* tbuf(ix,iy+1,iz+1) */
-	res = res * g + b;
-	*rbuf = (s8)_CONVERTI_( res );
-	continue;
-      }
-      /* here we are sure that the border is either
-	 along the Y or the Z axis */
-      dx = x - ix;
-      if ( (y < 0.0) || (iy == t1dimy) ) {
-	if ( (z < 0.0) || (iz == t1dimz) ) {
-	  res = (1-dx) * (*tpt); /* tbuf(ix,iy,iz) */
-	  tpt ++;
-	  res += dx * (*tpt);    /* tbuf(ix+1,iy,iz) */
-	  res = res * g + b;
-	  *rbuf = (s8)_CONVERTI_( res );
-	  continue;
-	}
-	dz = z - iz;
-	res = (1-dx)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
-	tpt ++;
-	res += dx*(1-dz) * (*tpt);    /* tbuf(ix+1,iy,iz) */
-	tpt += tdimxy-1;
-	res += (1-dx)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
-	tpt ++;
-	res += dx*dz * (*tpt);        /* tbuf(ix+1,iy,iz+1) */
-	res = res * g + b;
-	*rbuf = (s8)_CONVERTI_( res );
-	continue;
-      }
-      /* here we are sure that the border is along the Z axis */
-      dy = y - iy;
-      res = (1-dx)*(1-dy) * (*tpt); /* tbuf(ix,iy,iz) */
-      tpt ++;
-      res += dx*(1-dy) * (*tpt);    /* tbuf(ix+1,iy,iz) */
-      tpt += t1dimx;
-      res += (1-dx)*dy * (*tpt);    /* tbuf(ix,iy+1,iz) */
-      tpt ++;
-      res += dx*dy * (*tpt);        /* tbuf(ix+1,iy+1,iz) */
-      res = res * g + b;
-      *rbuf = (s8)_CONVERTI_( res );
-    }
-  }
-}
-
-CGAL_INLINE_FUNCTION
-void Reech3DNearest4x4_s8 ( void* theBuf, /* buffer to be resampled */
-			      int *theDim,  /* dimensions of this buffer */
-			      void* resBuf, /* result buffer */
-			      int *resDim,  /* dimensions of this buffer */
-			      double* mat   /* transformation matrix */
-			      )
-{
-  int i, j, k, ix, iy, iz;
-  double x, y, z;
-  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
-  int tdimx=theDim[0], tdimy=theDim[1], tdimz=theDim[2];
-  int tdimxy=tdimx*tdimy;
-  int t1dimx=tdimx-1, t1dimy=tdimy-1, t1dimz=tdimz-1;
-  s8 *tbuf = (s8*)theBuf;
-  s8 *rbuf = (s8*)resBuf;
-
-  for ( k = 0; k < rdimz; k ++ ) {
-    if ( get_static_verbose_reech4x4() != 0 )
-      fprintf( stderr, "Processing slice %d\r", k );
-    for ( j = 0; j < rdimy; j ++ )
-    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
-      /* computation of the corresponding point coordinates in theBuf */
-      x = mat[0] * i +  mat[1] * j + mat[2] * k + mat[3];
-      ix = (int)(x+0.5);
-      if (( x < -0.5 ) || ( ix > t1dimx)) { *rbuf = 0; continue; }
-      y = mat[4] * i +  mat[5] * j + mat[6] * k + mat[7];
-      iy = (int)(y+0.5);
-      if (( y < -0.5 ) || ( iy > t1dimy)) { *rbuf = 0; continue; }
-      z = mat[8] * i +  mat[9] * j + mat[10] * k + mat[11];
-      iz = (int)(z+0.5);
-      if (( z < -0.5 ) || ( iz > t1dimz)) { *rbuf = 0; continue; }
-      
-      *rbuf = tbuf[ ix + iy * tdimx + iz * tdimxy ];
-    }
-  }
-}
-
-CGAL_INLINE_FUNCTION
-void Reech2DTriLin4x4_s8 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim,  /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat   /* transformation matrix */
-			     )
-{
-  int i, j, k, ix, iy;
-  double x, y, dx, dy, dxdy;
-  double res, v;
-  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
-  int tdimx=theDim[0], tdimy=theDim[1];
-  int toffset=tdimx-1;
-  int t1dimx=tdimx-1, t1dimy=tdimy-1;
-  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
-  s8 *tbuf = (s8*)theBuf;
-  s8 *tpt;
-  s8 *rbuf = (s8*)resBuf;
-
-  for ( k = 0; k < rdimz; k ++ ) {
-    if ( get_static_verbose_reech4x4() != 0 )
-      fprintf( stderr, "Processing slice %d\r", k );
-    /* tbuf represente le premier point du plan */
-    tbuf  = (s8*)theBuf;
-    tbuf += k*(tdimx * tdimy);
-    for ( j = 0; j < rdimy; j ++ )
-    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
-      /* computation of the corresponding point coordinates in theBuf */
-      x = mat[0] * i +  mat[1] * j +              mat[3];
-      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
-      y = mat[4] * i +  mat[5] * j +              mat[7];
-      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
-
-      /* here, the point lies on the borders or completely inside
-	 the image */
-      ix = (int)x;      
-      iy = (int)y;
-      tpt = (s8 *)tbuf;
-      tpt += ix + iy * tdimx;
-      
-      /* are we on the border or not ? */
-      if ( (x > 0.0) && (ix < t1dimx) &&
-	   (y > 0.0) && (iy < t1dimy) ) {
-	dx = x - ix;
-	dy = y - iy;
-	dxdy = dx*dy;
-	/* we have
-	   v[5]=dxdy;         coefficient of tbuf(ix+1,iy+1)
-	   v[4]=dx-dxdy;      coefficient of tbuf(ix+1,iy  )
-	   v[1]=dy-dxdy;      coefficient of tbuf(ix  ,iy+1)
-	   v[0]=1-dx-dy+dxdy; coefficient of tbuf(ix  ,iy  )
-	*/
-	v = dy-dxdy;
-	res = 0;
-	res += (1-dx-v) * (*tpt);  /* tbuf(ix  ,iy  ) */
-	tpt ++;
-	res += (dx-dxdy) * (*tpt); /* tbuf(ix+1,iy  ) */
-	tpt += toffset;
-	res += v * (*tpt);       /* tbuf(ix,iy+1  ) */
-	tpt ++;
-	res += dxdy * (*tpt);      /* tbuf(ix+1,iy+1) */
-	*rbuf = (s8)_CONVERTI_( res );
-	continue;
-      }
-
-      /* here, we are sure we are on some border */
-      if ( (x < 0.0) || (ix == t1dimx) ) {
-	/* we just look at y */
-	if ( (y < 0.0) || (iy == t1dimy) ) {
-	  *rbuf = *tpt;
-	  continue;
-	}
-	dy = y - iy;
-	res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy) */
-	tpt += tdimx;
-	res += dy * (*tpt);     /* dy * tbuf(ix,iy+1) */
-	*rbuf = (s8)_CONVERTI_( res );
-	continue;
-      }
-      dx = x - ix;
-      res  = (1-dx) * (*tpt); /* (1-dx)* tbuf(ix,iy) */
-      tpt ++;
-      res += dx * (*tpt);     /* dx * tbuf(ix+1,iy) */
-      *rbuf = (s8)_CONVERTI_( res );
-    }
-  }
-}
-
-CGAL_INLINE_FUNCTION
-void Reech2DTriLin4x4gb_s8 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim,  /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat,   /* transformation matrix */
-			     float gain,
-			     float bias )
-{
-  int i, j, k, ix, iy;
-  double x, y, dx, dy, dxdy;
-  double res, v;
-  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
-  int tdimx=theDim[0], tdimy=theDim[1];
-  int toffset=tdimx-1;
-  int t1dimx=tdimx-1, t1dimy=tdimy-1;
-  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
-  s8 *tbuf = (s8*)theBuf;
-  s8 *tpt;
-  s8 *rbuf = (s8*)resBuf;
-  double b=bias;
-  double g=gain;
-
-  for ( k = 0; k < rdimz; k ++ ) {
-    if ( get_static_verbose_reech4x4() != 0 )
-      fprintf( stderr, "Processing slice %d\r", k );
-    /* tbuf represente le premier point du plan */
-    tbuf  = (s8*)theBuf;
-    tbuf += k*(tdimx * tdimy);
-    for ( j = 0; j < rdimy; j ++ )
-    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
-      /* computation of the corresponding point coordinates in theBuf */
-      x = mat[0] * i +  mat[1] * j +              mat[3];
-      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
-      y = mat[4] * i +  mat[5] * j +              mat[7];
-      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
-
-      /* here, the point lies on the borders or completely inside
-	 the image */
-      ix = (int)x;      
-      iy = (int)y;
-      tpt = (s8 *)tbuf;
-      tpt += ix + iy * tdimx;
-      
-      /* are we on the border or not ? */
-      if ( (x > 0.0) && (ix < t1dimx) &&
-	   (y > 0.0) && (iy < t1dimy) ) {
-	dx = x - ix;
-	dy = y - iy;
-	dxdy = dx*dy;
-	/* we have
-	   v[5]=dxdy;         coefficient of tbuf(ix+1,iy+1)
-	   v[4]=dx-dxdy;      coefficient of tbuf(ix+1,iy  )
-	   v[1]=dy-dxdy;      coefficient of tbuf(ix  ,iy+1)
-	   v[0]=1-dx-dy+dxdy; coefficient of tbuf(ix  ,iy  )
-	*/
-	v = dy-dxdy;
-	res = 0;
-	res += (1-dx-v) * (*tpt);  /* tbuf(ix  ,iy  ) */
-	tpt ++;
-	res += (dx-dxdy) * (*tpt); /* tbuf(ix+1,iy  ) */
-	tpt += toffset;
-	res += v * (*tpt);       /* tbuf(ix,iy+1  ) */
-	tpt ++;
-	res += dxdy * (*tpt);      /* tbuf(ix+1,iy+1) */
-	res = res * g + b;
-	*rbuf = (s8)_CONVERTI_( res );
-	continue;
-      }
-
-      /* here, we are sure we are on some border */
-      if ( (x < 0.0) || (ix == t1dimx) ) {
-	/* we just look at y */
-	if ( (y < 0.0) || (iy == t1dimy) ) {
-	  res = (double)(*tpt) * g + b;
-	  *rbuf = (s8)_CONVERTI_( res );
-	  continue;
-	}
-	dy = y - iy;
-	res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy) */
-	tpt += tdimx;
-	res += dy * (*tpt);     /* dy * tbuf(ix,iy+1) */
-	res = (double)(*tpt) * g + b;
-	*rbuf = (s8)_CONVERTI_( res );
-	continue;
-      }
-      dx = x - ix;
-      res  = (1-dx) * (*tpt); /* (1-dx)* tbuf(ix,iy) */
-      tpt ++;
-      res += dx * (*tpt);     /* dx * tbuf(ix+1,iy) */
-      res = res * g + b;
-            *rbuf = (s8)_CONVERTI_( res );
-    }
-  }
-}
-
-CGAL_INLINE_FUNCTION
-void Reech2DNearest4x4_s8 ( void* theBuf, /* buffer to be resampled */
-			      int *theDim,  /* dimensions of this buffer */
-			      void* resBuf, /* result buffer */
-			      int *resDim,  /* dimensions of this buffer */
-			      double* mat   /* transformation matrix */
-			      )
-{
-  int i, j, k, ix, iy;
-  double x, y;
-  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
-  int tdimx=theDim[0], tdimy=theDim[1];
-  int t1dimx=tdimx-1, t1dimy=tdimy-1;
-  s8 *tbuf = (s8*)theBuf;
-  s8 *rbuf = (s8*)resBuf;
-
-  for ( k = 0; k < rdimz; k ++ ) {
-    if ( get_static_verbose_reech4x4() != 0 )
-      fprintf( stderr, "Processing slice %d\r", k );
-    /* tbuf represente le premier point du plan */
-    tbuf  = (s8*)theBuf;
-    tbuf += k*(tdimx * tdimy);
-    for ( j = 0; j < rdimy; j ++ )
-    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
-      /* computation of the corresponding point coordinates in theBuf */
-      x = mat[0] * i +  mat[1] * j + mat[3];
-      ix = (int)(x+0.5);
-      if (( x < -0.5 ) || ( ix > t1dimx)) { *rbuf = 0; continue; }
-      y = mat[4] * i +  mat[5] * j + mat[7];
-      iy = (int)(y+0.5);
-      if (( y < -0.5 ) || ( iy > t1dimy)) { *rbuf = 0; continue; }
-      
-      *rbuf = tbuf[ ix + iy * tdimx ];
-    }
-  }
-}
-
-
-
-
-
-
-/* Resampling procedure.
-
-   Work for 3D images, not for vectorial ones.
-   
-   (double* mat) is the matrix which permits to get
-   from resBuf into theBuf. 
-   If one only have the matrix from theBuf into resBuf,
-   it must be inverted first.
-
-   Soit x le point transforme et ix=(int)x;
-   nous allons distinguer les cas suivants :
-    x < -0.5               => resultat = 0
-    -0.5 <= x < 0.0        => ix=0, on n'interpole pas selon X
-    0.0 < x && ix < dimx-1 => on interpole selon X
-    x < dimx-0.5           => ix=dimx-1, on n'interpole pas selon X
-    x >= dimx-0.5          => resultat = 0
-
-*/
-
-CGAL_INLINE_FUNCTION
-void Reech3DTriLin4x4_u16 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim, /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat   /* transformation matrix */
-			     )
-{
-  int i, j, k, ix, iy, iz;
-  double x, y, z, dx, dy, dz, dxdy,dxdz,dydz,dxdydz;
-  double res;
-  double v6, v5, v4;
-  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
-  int tdimx=theDim[0], tdimy=theDim[1], tdimz=theDim[2];
-  int tdimxy=tdimx*tdimy;
-  int toffset1=tdimxy+tdimx+1, toffset2=tdimxy-tdimx-1;
-  int t1dimx=tdimx-1, t1dimy=tdimy-1, t1dimz=tdimz-1;
-  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
-  double ddimz = (double)tdimz-0.5;
-  u16 *tbuf = (u16*)theBuf;
-  u16 *tpt;
-  u16 *rbuf = (u16*)resBuf;
-
-  for ( k = 0; k < rdimz; k ++ ) {
-    if ( get_static_verbose_reech4x4() != 0 )
-      fprintf( stderr, "Processing slice %d\r", k );
-    for ( j = 0; j < rdimy; j ++ )
-    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
-      /* computation of the corresponding point coordinates in theBuf */
-      x = mat[0] * i +  mat[1] * j + mat[2] * k + mat[3];
-      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
-      y = mat[4] * i +  mat[5] * j + mat[6] * k + mat[7];
-      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
-      z = mat[8] * i +  mat[9] * j + mat[10] * k + mat[11];
-      if ((z < -0.5) || ( z > ddimz)) { *rbuf = 0; continue; }
-
-      /* here, the point lies on the borders or completely inside
-	 the image */
-      ix = (int)x;
-      iy = (int)y;
-      iz = (int)z;
-      tpt = (u16 *)tbuf;
-      
-      /* are we on the border or not ? */
-      if ( (x > 0.0) && (ix < t1dimx) &&
-	   (y > 0.0) && (iy < t1dimy) &&
-	   (z > 0.0) && (iz < t1dimz) ) {
-	/* the corresponding point is in the box defined 
-	   by (ix[+1],iy[+1],iz[+1]) */
-	dx = x - ix;
-	dy = y - iy;
-	dz = z - iz;
-	dxdy = dx*dy;
-	dxdz = dx*dz;
-	dydz = dy*dz;
-	dxdydz = dxdy*dz;
-
-	/* we have
-	   v[7]=dxdydz;            coefficient of tbuf(ix+1,iy+1,iz+1)
-	   v[6]=dxdz-dxdydz;       coefficient of tbuf(ix+1,iy,  iz+1)
-	   v[5]=dxdy-dxdydz;       coefficient of tbuf(ix+1,iy+1,iz  )
-	   v[4]=dx-dxdy-v[6];      coefficient of tbuf(ix+1,iy  ,iz  )
-	   v[3]=dydz-dxdydz;       coefficient of tbuf(ix  ,iy+1,iz+1)
-	   v[2]=dz-dydz-v[6];      coefficient of tbuf(ix  ,iy  ,iz+1)
-	   v[1]=dy-dydz-v[5];      coefficient of tbuf(ix  ,iy+1,iz  )
-	   v[0]=1-dy-dz+dydz-v[4]; coefficient of tbuf(ix  ,iy  ,iz  )
-	*/
-	tpt += ix + iy * tdimx + iz * tdimxy + toffset1;
-	v6 = dxdz-dxdydz;
-	v5 = dxdy-dxdydz;
-	v4 = dx-dxdy-v6;
-
-	res = 0;
-	res += dxdydz * (*tpt);            /* tbuf(ix+1,iy+1,iz+1) */
-	tpt --;
-	res += (dydz-dxdydz) * (*tpt);     /* tbuf(ix  ,iy+1,iz+1) */
-	tpt -= t1dimx;
-	res += v6 * (*tpt);                /* tbuf(ix+1  ,iy,  iz+1) */
-	tpt --;
-	res += (dz-dydz-v6) * (*tpt);      /* tbuf(ix  ,iy  ,iz+1) */
-	tpt -= toffset2;
-	res += v5 * (*tpt);                /* tbuf(ix+1,iy+1,iz  ) */
-	tpt --;
-	res += (dy-dydz-v5) * (*tpt);      /* tbuf(ix  ,iy+1,iz  ) */
-	tpt -= t1dimx;
-	res += v4 * (*tpt);                /* tbuf(ix+1,iy  ,iz  ) */
-	tpt --;
-	res += (1-dy-dz+dydz-v4) * (*tpt); /* tbuf(ix  ,iy  ,iz  ) */
-	*rbuf = (u16)_CONVERTI_( res );
-	continue;
-      }
-      /* here, we are sure we are on some border */
-      tpt += ix + iy * tdimx + iz * tdimxy;
-      if ( (x < 0.0) || (ix == t1dimx) ) {
-	if ( (y < 0.0) || (iy == t1dimy) ) {
-	  if ( (z < 0.0) || (iz == t1dimz) ) {
-	    *rbuf = *tpt;
-	    continue;
-	  }
-	  dz = z - iz;
-	  res  = (1-dz) * (*tpt); /* (1-dz)* tbuf(ix,iy,iz) */
-	  tpt += tdimxy;
-	  res += dz * (*tpt);     /* dz * tbuf(ix,iy,iz+1) */
-	  *rbuf = (u16)_CONVERTI_( res );
-	  continue;
-	}
-	dy = y - iy;
-	if ( (z < 0.0) || (iz == t1dimz) ) {
-	  res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy,iz) */
-	  tpt += tdimx;
-	  res += dy * (*tpt);     /* dy * tbuf(ix,iy+1,iz) */
-	  *rbuf = (u16)_CONVERTI_( res );
-	  continue;
- 	}
-	dz = z - iz;
-	res = (1-dy)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
-	tpt += tdimx;
-	res += dy*(1-dz) * (*tpt);    /* tbuf(ix,iy+1,iz) */
-	tpt += toffset2+1;
-	res += (1-dy)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
-	tpt += tdimx;
-	res += dy*dz * (*tpt);        /* tbuf(ix,iy+1,iz+1) */
-	*rbuf = (u16)_CONVERTI_( res );
-	continue;
-      }
-      /* here we are sure that the border is either
-	 along the Y or the Z axis */
-      dx = x - ix;
-      if ( (y < 0.0) || (iy == t1dimy) ) {
-	if ( (z < 0.0) || (iz == t1dimz) ) {
-	  res = (1-dx) * (*tpt); /* tbuf(ix,iy,iz) */
-	  tpt ++;
-	  res += dx * (*tpt);    /* tbuf(ix+1,iy,iz) */
-	  *rbuf = (u16)_CONVERTI_( res );
-	  continue;
-	}
-	dz = z - iz;
-	res = (1-dx)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
-	tpt ++;
-	res += dx*(1-dz) * (*tpt);    /* tbuf(ix+1,iy,iz) */
-	tpt += tdimxy-1;
-	res += (1-dx)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
-	tpt ++;
-	res += dx*dz * (*tpt);        /* tbuf(ix+1,iy,iz+1) */
-	*rbuf = (u16)_CONVERTI_( res );
-	continue;
-      }
-      /* here we are sure that the border is along the Z axis */
-      dy = y - iy;
-      res = (1-dx)*(1-dy) * (*tpt); /* tbuf(ix,iy,iz) */
-      tpt ++;
-      res += dx*(1-dy) * (*tpt);    /* tbuf(ix+1,iy,iz) */
-      tpt += t1dimx;
-      res += (1-dx)*dy * (*tpt);    /* tbuf(ix,iy+1,iz) */
-      tpt ++;
-      res += dx*dy * (*tpt);        /* tbuf(ix+1,iy+1,iz) */
-      *rbuf = (u16)_CONVERTI_( res );
-    }
-  }
-}
-
-CGAL_INLINE_FUNCTION
-void Reech3DTriLin4x4gb_u16 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim, /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat,   /* transformation matrix */
-			     float gain,
-			     float bias )
-{
-  int i, j, k, ix, iy, iz;
-  double x, y, z, dx, dy, dz, dxdy,dxdz,dydz,dxdydz;
-  double res;
-  double v6, v5, v4;
-  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
-  int tdimx=theDim[0], tdimy=theDim[1], tdimz=theDim[2];
-  int tdimxy=tdimx*tdimy;
-  int toffset1=tdimxy+tdimx+1, toffset2=tdimxy-tdimx-1;
-  int t1dimx=tdimx-1, t1dimy=tdimy-1, t1dimz=tdimz-1;
-  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
-  double ddimz = (double)tdimz-0.5;
-  u16 *tbuf = (u16*)theBuf;
-  u16 *tpt;
-  u16 *rbuf = (u16*)resBuf;
-  double b=bias;
-  double g=gain;
-
-  for ( k = 0; k < rdimz; k ++ ) {
-    if ( get_static_verbose_reech4x4() != 0 )
-      fprintf( stderr, "Processing slice %d\r", k );
-    for ( j = 0; j < rdimy; j ++ )
-    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
-      /* computation of the corresponding point coordinates in theBuf */
-      x = mat[0] * i +  mat[1] * j + mat[2] * k + mat[3];
-      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
-      y = mat[4] * i +  mat[5] * j + mat[6] * k + mat[7];
-      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
-      z = mat[8] * i +  mat[9] * j + mat[10] * k + mat[11];
-      if ((z < -0.5) || ( z > ddimz)) { *rbuf = 0; continue; }
-
-      /* here, the point lies on the borders or completely inside
-	 the image */
-      ix = (int)x;
-      iy = (int)y;
-      iz = (int)z;
-      tpt = (u16 *)tbuf;
-      
-      /* are we on the border or not ? */
-      if ( (x > 0.0) && (ix < t1dimx) &&
-	   (y > 0.0) && (iy < t1dimy) &&
-	   (z > 0.0) && (iz < t1dimz) ) {
-	/* the corresponding point is in the box defined 
-	   by (ix[+1],iy[+1],iz[+1]) */
-	dx = x - ix;
-	dy = y - iy;
-	dz = z - iz;
-	dxdy = dx*dy;
-	dxdz = dx*dz;
-	dydz = dy*dz;
-	dxdydz = dxdy*dz;
-
-	/* we have
-	   v[7]=dxdydz;            coefficient of tbuf(ix+1,iy+1,iz+1)
-	   v[6]=dxdz-dxdydz;       coefficient of tbuf(ix+1,iy,  iz+1)
-	   v[5]=dxdy-dxdydz;       coefficient of tbuf(ix+1,iy+1,iz  )
-	   v[4]=dx-dxdy-v[6];      coefficient of tbuf(ix+1,iy  ,iz  )
-	   v[3]=dydz-dxdydz;       coefficient of tbuf(ix  ,iy+1,iz+1)
-	   v[2]=dz-dydz-v[6];      coefficient of tbuf(ix  ,iy  ,iz+1)
-	   v[1]=dy-dydz-v[5];      coefficient of tbuf(ix  ,iy+1,iz  )
-	   v[0]=1-dy-dz+dydz-v[4]; coefficient of tbuf(ix  ,iy  ,iz  )
-	*/
-	tpt += ix + iy * tdimx + iz * tdimxy + toffset1;
-	v6 = dxdz-dxdydz;
-	v5 = dxdy-dxdydz;
-	v4 = dx-dxdy-v6;
-
-	res = 0;
-	res += dxdydz * (*tpt);            /* tbuf(ix+1,iy+1,iz+1) */
-	tpt --;
-	res += (dydz-dxdydz) * (*tpt);     /* tbuf(ix  ,iy+1,iz+1) */
-	tpt -= t1dimx;
-	res += v6 * (*tpt);                /* tbuf(ix+1  ,iy,  iz+1) */
-	tpt --;
-	res += (dz-dydz-v6) * (*tpt);      /* tbuf(ix  ,iy  ,iz+1) */
-	tpt -= toffset2;
-	res += v5 * (*tpt);                /* tbuf(ix+1,iy+1,iz  ) */
-	tpt --;
-	res += (dy-dydz-v5) * (*tpt);      /* tbuf(ix  ,iy+1,iz  ) */
-	tpt -= t1dimx;
-	res += v4 * (*tpt);                /* tbuf(ix+1,iy  ,iz  ) */
-	tpt --;
-	res += (1-dy-dz+dydz-v4) * (*tpt); /* tbuf(ix  ,iy  ,iz  ) */
-	res = res * g + b;
-	*rbuf = (u16)_CONVERTI_( res );
-	continue;
-      }
-      /* here, we are sure we are on some border */
-      tpt += ix + iy * tdimx + iz * tdimxy;
-      if ( (x < 0.0) || (ix == t1dimx) ) {
-	if ( (y < 0.0) || (iy == t1dimy) ) {
-	  if ( (z < 0.0) || (iz == t1dimz) ) {
-	    res = (double)(*tpt) * g + b;
-	    *rbuf = (u16)_CONVERTI_( res );
-	    continue;
-	  }
-	  dz = z - iz;
-	  res  = (1-dz) * (*tpt); /* (1-dz)* tbuf(ix,iy,iz) */
-	  tpt += tdimxy;
-	  res += dz * (*tpt);     /* dz * tbuf(ix,iy,iz+1) */
-	  res = res * g + b;
-	  *rbuf = (u16)_CONVERTI_( res );
-	  continue;
-	}
-	dy = y - iy;
-	if ( (z < 0.0) || (iz == t1dimz) ) {
-	  res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy,iz) */
-	  tpt += tdimx;
-	  res += dy * (*tpt);     /* dy * tbuf(ix,iy+1,iz) */
-	  res = res * g + b;
-	  *rbuf = (u16)_CONVERTI_( res );
-	  continue;
- 	}
-	dz = z - iz;
-	res = (1-dy)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
-	tpt += tdimx;
-	res += dy*(1-dz) * (*tpt);    /* tbuf(ix,iy+1,iz) */
-	tpt += toffset2+1;
-	res += (1-dy)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
-	tpt += tdimx;
-	res += dy*dz * (*tpt);        /* tbuf(ix,iy+1,iz+1) */
-	res = res * g + b;
-	*rbuf = (u16)_CONVERTI_( res );
-	continue;
-      }
-      /* here we are sure that the border is either
-	 along the Y or the Z axis */
-      dx = x - ix;
-      if ( (y < 0.0) || (iy == t1dimy) ) {
-	if ( (z < 0.0) || (iz == t1dimz) ) {
-	  res = (1-dx) * (*tpt); /* tbuf(ix,iy,iz) */
-	  tpt ++;
-	  res += dx * (*tpt);    /* tbuf(ix+1,iy,iz) */
-	  res = res * g + b;
-	  *rbuf = (u16)_CONVERTI_( res );
-	  continue;
-	}
-	dz = z - iz;
-	res = (1-dx)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
-	tpt ++;
-	res += dx*(1-dz) * (*tpt);    /* tbuf(ix+1,iy,iz) */
-	tpt += tdimxy-1;
-	res += (1-dx)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
-	tpt ++;
-	res += dx*dz * (*tpt);        /* tbuf(ix+1,iy,iz+1) */
-	res = res * g + b;
-	*rbuf = (u16)_CONVERTI_( res );
-	continue;
-      }
-      /* here we are sure that the border is along the Z axis */
-      dy = y - iy;
-      res = (1-dx)*(1-dy) * (*tpt); /* tbuf(ix,iy,iz) */
-      tpt ++;
-      res += dx*(1-dy) * (*tpt);    /* tbuf(ix+1,iy,iz) */
-      tpt += t1dimx;
-      res += (1-dx)*dy * (*tpt);    /* tbuf(ix,iy+1,iz) */
-      tpt ++;
-      res += dx*dy * (*tpt);        /* tbuf(ix+1,iy+1,iz) */
-      res = res * g + b;
-      *rbuf = (u16)_CONVERTI_( res );
-    }
-  }
-}
-
-CGAL_INLINE_FUNCTION
-void Reech3DNearest4x4_u16 ( void* theBuf, /* buffer to be resampled */
-			      int *theDim,  /* dimensions of this buffer */
-			      void* resBuf, /* result buffer */
-			      int *resDim,  /* dimensions of this buffer */
-			      double* mat   /* transformation matrix */
-			      )
-{
-  int i, j, k, ix, iy, iz;
-  double x, y, z;
-  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
-  int tdimx=theDim[0], tdimy=theDim[1], tdimz=theDim[2];
-  int tdimxy=tdimx*tdimy;
-  int t1dimx=tdimx-1, t1dimy=tdimy-1, t1dimz=tdimz-1;
-  u16 *tbuf = (u16*)theBuf;
-  u16 *rbuf = (u16*)resBuf;
-
-  for ( k = 0; k < rdimz; k ++ ) {
-    if ( get_static_verbose_reech4x4() != 0 )
-      fprintf( stderr, "Processing slice %d\r", k );
-    for ( j = 0; j < rdimy; j ++ )
-    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
-      /* computation of the corresponding point coordinates in theBuf */
-      x = mat[0] * i +  mat[1] * j + mat[2] * k + mat[3];
-      ix = (int)(x+0.5);
-      if (( x < -0.5 ) || ( ix > t1dimx)) { *rbuf = 0; continue; }
-      y = mat[4] * i +  mat[5] * j + mat[6] * k + mat[7];
-      iy = (int)(y+0.5);
-      if (( y < -0.5 ) || ( iy > t1dimy)) { *rbuf = 0; continue; }
-      z = mat[8] * i +  mat[9] * j + mat[10] * k + mat[11];
-      iz = (int)(z+0.5);
-      if (( z < -0.5 ) || ( iz > t1dimz)) { *rbuf = 0; continue; }
-      
-      *rbuf = tbuf[ ix + iy * tdimx + iz * tdimxy ];
-    }
-  }
-}
-
-CGAL_INLINE_FUNCTION
-void Reech2DTriLin4x4_u16 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim,  /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat   /* transformation matrix */
-			     )
-{
-  int i, j, k, ix, iy;
-  double x, y, dx, dy, dxdy;
-  double res, v;
-  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
-  int tdimx=theDim[0], tdimy=theDim[1];
-  int toffset=tdimx-1;
-  int t1dimx=tdimx-1, t1dimy=tdimy-1;
-  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
-  u16 *tbuf = (u16*)theBuf;
-  u16 *tpt;
-  u16 *rbuf = (u16*)resBuf;
-
-  for ( k = 0; k < rdimz; k ++ ) {
-    if ( get_static_verbose_reech4x4() != 0 )
-      fprintf( stderr, "Processing slice %d\r", k );
-    /* tbuf represente le premier point du plan */
-    tbuf  = (u16*)theBuf;
-    tbuf += k*(tdimx * tdimy);
-    for ( j = 0; j < rdimy; j ++ )
-    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
-      /* computation of the corresponding point coordinates in theBuf */
-      x = mat[0] * i +  mat[1] * j +              mat[3];
-      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
-      y = mat[4] * i +  mat[5] * j +              mat[7];
-      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
-
-      /* here, the point lies on the borders or completely inside
-	 the image */
-      ix = (int)x;      
-      iy = (int)y;
-      tpt = (u16 *)tbuf;
-      tpt += ix + iy * tdimx;
-      
-      /* are we on the border or not ? */
-      if ( (x > 0.0) && (ix < t1dimx) &&
-	   (y > 0.0) && (iy < t1dimy) ) {
-	dx = x - ix;
-	dy = y - iy;
-	dxdy = dx*dy;
-	/* we have
-	   v[5]=dxdy;         coefficient of tbuf(ix+1,iy+1)
-	   v[4]=dx-dxdy;      coefficient of tbuf(ix+1,iy  )
-	   v[1]=dy-dxdy;      coefficient of tbuf(ix  ,iy+1)
-	   v[0]=1-dx-dy+dxdy; coefficient of tbuf(ix  ,iy  )
-	*/
-	v = dy-dxdy;
-	res = 0;
-	res += (1-dx-v) * (*tpt);  /* tbuf(ix  ,iy  ) */
-	tpt ++;
-	res += (dx-dxdy) * (*tpt); /* tbuf(ix+1,iy  ) */
-	tpt += toffset;
-	res += v * (*tpt);       /* tbuf(ix,iy+1  ) */
-	tpt ++;
-	res += dxdy * (*tpt);      /* tbuf(ix+1,iy+1) */
-	*rbuf = (u16)_CONVERTI_( res );
-	continue;
-      }
-
-      /* here, we are sure we are on some border */
-      if ( (x < 0.0) || (ix == t1dimx) ) {
-	/* we just look at y */
-	if ( (y < 0.0) || (iy == t1dimy) ) {
-	  *rbuf = *tpt;
-	  continue;
-	}
-	dy = y - iy;
-	res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy) */
-	tpt += tdimx;
-	res += dy * (*tpt);     /* dy * tbuf(ix,iy+1) */
-	*rbuf = (u16)_CONVERTI_( res );
-	continue;
-      }
-      dx = x - ix;
-      res  = (1-dx) * (*tpt); /* (1-dx)* tbuf(ix,iy) */
-      tpt ++;
-      res += dx * (*tpt);     /* dx * tbuf(ix+1,iy) */
-      *rbuf = (u16)_CONVERTI_( res );
-    }
-  }
-}
-
-CGAL_INLINE_FUNCTION
-void Reech2DTriLin4x4gb_u16 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim,  /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat,   /* transformation matrix */
-			     float gain,
-			     float bias )
-{
-  int i, j, k, ix, iy;
-  double x, y, dx, dy, dxdy;
-  double res, v;
-  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
-  int tdimx=theDim[0], tdimy=theDim[1];
-  int toffset=tdimx-1;
-  int t1dimx=tdimx-1, t1dimy=tdimy-1;
-  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
-  u16 *tbuf = (u16*)theBuf;
-  u16 *tpt;
-  u16 *rbuf = (u16*)resBuf;
-  double b=bias;
-  double g=gain;
-
-  for ( k = 0; k < rdimz; k ++ ) {
-    if ( get_static_verbose_reech4x4() != 0 )
-      fprintf( stderr, "Processing slice %d\r", k );
-    /* tbuf represente le premier point du plan */
-    tbuf  = (u16*)theBuf;
-    tbuf += k*(tdimx * tdimy);
-    for ( j = 0; j < rdimy; j ++ )
-    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
-      /* computation of the corresponding point coordinates in theBuf */
-      x = mat[0] * i +  mat[1] * j +              mat[3];
-      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
-      y = mat[4] * i +  mat[5] * j +              mat[7];
-      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
-
-      /* here, the point lies on the borders or completely inside
-	 the image */
-      ix = (int)x;      
-      iy = (int)y;
-      tpt = (u16 *)tbuf;
-      tpt += ix + iy * tdimx;
-      
-      /* are we on the border or not ? */
-      if ( (x > 0.0) && (ix < t1dimx) &&
-	   (y > 0.0) && (iy < t1dimy) ) {
-	dx = x - ix;
-	dy = y - iy;
-	dxdy = dx*dy;
-	/* we have
-	   v[5]=dxdy;         coefficient of tbuf(ix+1,iy+1)
-	   v[4]=dx-dxdy;      coefficient of tbuf(ix+1,iy  )
-	   v[1]=dy-dxdy;      coefficient of tbuf(ix  ,iy+1)
-	   v[0]=1-dx-dy+dxdy; coefficient of tbuf(ix  ,iy  )
-	*/
-	v = dy-dxdy;
-	res = 0;
-	res += (1-dx-v) * (*tpt);  /* tbuf(ix  ,iy  ) */
-	tpt ++;
-	res += (dx-dxdy) * (*tpt); /* tbuf(ix+1,iy  ) */
-	tpt += toffset;
-	res += v * (*tpt);       /* tbuf(ix,iy+1  ) */
-	tpt ++;
-	res += dxdy * (*tpt);      /* tbuf(ix+1,iy+1) */
-	res = res * g + b;
-	*rbuf = (u16)_CONVERTI_( res );
-	continue;
-      }
-
-      /* here, we are sure we are on some border */
-      if ( (x < 0.0) || (ix == t1dimx) ) {
-	/* we just look at y */
-	if ( (y < 0.0) || (iy == t1dimy) ) {
-	  res = (double)(*tpt) * g + b;
-	  *rbuf = (u16)_CONVERTI_( res );
-	  continue;
-	}
-	dy = y - iy;
-	res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy) */
-	tpt += tdimx;
-	res += dy * (*tpt);     /* dy * tbuf(ix,iy+1) */
-	res = (double)(*tpt) * g + b;
-	*rbuf = (u16)_CONVERTI_( res );
-	continue;
-      }
-      dx = x - ix;
-      res  = (1-dx) * (*tpt); /* (1-dx)* tbuf(ix,iy) */
-      tpt ++;
-      res += dx * (*tpt);     /* dx * tbuf(ix+1,iy) */
-      res = res * g + b;
-            *rbuf = (u16)_CONVERTI_( res );
-    }
-  }
-}
-
-CGAL_INLINE_FUNCTION
-void Reech2DNearest4x4_u16 ( void* theBuf, /* buffer to be resampled */
-			      int *theDim,  /* dimensions of this buffer */
-			      void* resBuf, /* result buffer */
-			      int *resDim,  /* dimensions of this buffer */
-			      double* mat   /* transformation matrix */
-			      )
-{
-  int i, j, k, ix, iy;
-  double x, y;
-  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
-  int tdimx=theDim[0], tdimy=theDim[1];
-  int t1dimx=tdimx-1, t1dimy=tdimy-1;
-  u16 *tbuf = (u16*)theBuf;
-  u16 *rbuf = (u16*)resBuf;
-
-  for ( k = 0; k < rdimz; k ++ ) {
-    if ( get_static_verbose_reech4x4() != 0 )
-      fprintf( stderr, "Processing slice %d\r", k );
-    /* tbuf represente le premier point du plan */
-    tbuf  = (u16*)theBuf;
-    tbuf += k*(tdimx * tdimy);
-    for ( j = 0; j < rdimy; j ++ )
-    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
-      /* computation of the corresponding point coordinates in theBuf */
-      x = mat[0] * i +  mat[1] * j + mat[3];
-      ix = (int)(x+0.5);
-      if (( x < -0.5 ) || ( ix > t1dimx)) { *rbuf = 0; continue; }
-      y = mat[4] * i +  mat[5] * j + mat[7];
-      iy = (int)(y+0.5);
-      if (( y < -0.5 ) || ( iy > t1dimy)) { *rbuf = 0; continue; }
-      
-      *rbuf = tbuf[ ix + iy * tdimx ];
-    }
-  }
-}
-
-
-
-
-
-
-/* Resampling procedure.
-
-   Work for 3D images, not for vectorial ones.
-   
-   (double* mat) is the matrix which permits to get
-   from resBuf into theBuf. 
-   If one only have the matrix from theBuf into resBuf,
-   it must be inverted first.
-
-   Soit x le point transforme et ix=(int)x;
-   nous allons distinguer les cas suivants :
-    x < -0.5               => resultat = 0
-    -0.5 <= x < 0.0        => ix=0, on n'interpole pas selon X
-    0.0 < x && ix < dimx-1 => on interpole selon X
-    x < dimx-0.5           => ix=dimx-1, on n'interpole pas selon X
-    x >= dimx-0.5          => resultat = 0
-
-*/
-
-CGAL_INLINE_FUNCTION
-void Reech3DTriLin4x4_s16 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim, /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat   /* transformation matrix */
-			     )
-{
-  int i, j, k, ix, iy, iz;
-  double x, y, z, dx, dy, dz, dxdy,dxdz,dydz,dxdydz;
-  double res;
-  double v6, v5, v4;
-  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
-  int tdimx=theDim[0], tdimy=theDim[1], tdimz=theDim[2];
-  int tdimxy=tdimx*tdimy;
-  int toffset1=tdimxy+tdimx+1, toffset2=tdimxy-tdimx-1;
-  int t1dimx=tdimx-1, t1dimy=tdimy-1, t1dimz=tdimz-1;
-  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
-  double ddimz = (double)tdimz-0.5;
-  s16 *tbuf = (s16*)theBuf;
-  s16 *tpt;
-  s16 *rbuf = (s16*)resBuf;
-
-  for ( k = 0; k < rdimz; k ++ ) {
-    if ( get_static_verbose_reech4x4() != 0 )
-      fprintf( stderr, "Processing slice %d\r", k );
-    for ( j = 0; j < rdimy; j ++ )
-    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
-      /* computation of the corresponding point coordinates in theBuf */
-      x = mat[0] * i +  mat[1] * j + mat[2] * k + mat[3];
-      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
-      y = mat[4] * i +  mat[5] * j + mat[6] * k + mat[7];
-      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
-      z = mat[8] * i +  mat[9] * j + mat[10] * k + mat[11];
-      if ((z < -0.5) || ( z > ddimz)) { *rbuf = 0; continue; }
-
-      /* here, the point lies on the borders or completely inside
-	 the image */
-      ix = (int)x;
-      iy = (int)y;
-      iz = (int)z;
-      tpt = (s16 *)tbuf;
-      
-      /* are we on the border or not ? */
-      if ( (x > 0.0) && (ix < t1dimx) &&
-	   (y > 0.0) && (iy < t1dimy) &&
-	   (z > 0.0) && (iz < t1dimz) ) {
-	/* the corresponding point is in the box defined 
-	   by (ix[+1],iy[+1],iz[+1]) */
-	dx = x - ix;
-	dy = y - iy;
-	dz = z - iz;
-	dxdy = dx*dy;
-	dxdz = dx*dz;
-	dydz = dy*dz;
-	dxdydz = dxdy*dz;
-
-	/* we have
-	   v[7]=dxdydz;            coefficient of tbuf(ix+1,iy+1,iz+1)
-	   v[6]=dxdz-dxdydz;       coefficient of tbuf(ix+1,iy,  iz+1)
-	   v[5]=dxdy-dxdydz;       coefficient of tbuf(ix+1,iy+1,iz  )
-	   v[4]=dx-dxdy-v[6];      coefficient of tbuf(ix+1,iy  ,iz  )
-	   v[3]=dydz-dxdydz;       coefficient of tbuf(ix  ,iy+1,iz+1)
-	   v[2]=dz-dydz-v[6];      coefficient of tbuf(ix  ,iy  ,iz+1)
-	   v[1]=dy-dydz-v[5];      coefficient of tbuf(ix  ,iy+1,iz  )
-	   v[0]=1-dy-dz+dydz-v[4]; coefficient of tbuf(ix  ,iy  ,iz  )
-	*/
-	tpt += ix + iy * tdimx + iz * tdimxy + toffset1;
-	v6 = dxdz-dxdydz;
-	v5 = dxdy-dxdydz;
-	v4 = dx-dxdy-v6;
-
-	res = 0;
-	res += dxdydz * (*tpt);            /* tbuf(ix+1,iy+1,iz+1) */
-	tpt --;
-	res += (dydz-dxdydz) * (*tpt);     /* tbuf(ix  ,iy+1,iz+1) */
-	tpt -= t1dimx;
-	res += v6 * (*tpt);                /* tbuf(ix+1  ,iy,  iz+1) */
-	tpt --;
-	res += (dz-dydz-v6) * (*tpt);      /* tbuf(ix  ,iy  ,iz+1) */
-	tpt -= toffset2;
-	res += v5 * (*tpt);                /* tbuf(ix+1,iy+1,iz  ) */
-	tpt --;
-	res += (dy-dydz-v5) * (*tpt);      /* tbuf(ix  ,iy+1,iz  ) */
-	tpt -= t1dimx;
-	res += v4 * (*tpt);                /* tbuf(ix+1,iy  ,iz  ) */
-	tpt --;
-	res += (1-dy-dz+dydz-v4) * (*tpt); /* tbuf(ix  ,iy  ,iz  ) */
-	*rbuf = (s16)_CONVERTI_( res );
-	continue;
-      }
-      /* here, we are sure we are on some border */
-      tpt += ix + iy * tdimx + iz * tdimxy;
-      if ( (x < 0.0) || (ix == t1dimx) ) {
-	if ( (y < 0.0) || (iy == t1dimy) ) {
-	  if ( (z < 0.0) || (iz == t1dimz) ) {
-	    *rbuf = *tpt;
-	    continue;
-	  }
-	  dz = z - iz;
-	  res  = (1-dz) * (*tpt); /* (1-dz)* tbuf(ix,iy,iz) */
-	  tpt += tdimxy;
-	  res += dz * (*tpt);     /* dz * tbuf(ix,iy,iz+1) */
-	  *rbuf = (s16)_CONVERTI_( res );
-	  continue;
-	}
-	dy = y - iy;
-	if ( (z < 0.0) || (iz == t1dimz) ) {
-	  res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy,iz) */
-	  tpt += tdimx;
-	  res += dy * (*tpt);     /* dy * tbuf(ix,iy+1,iz) */
-	  *rbuf = (s16)_CONVERTI_( res );
-	  continue;
- 	}
-	dz = z - iz;
-	res = (1-dy)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
-	tpt += tdimx;
-	res += dy*(1-dz) * (*tpt);    /* tbuf(ix,iy+1,iz) */
-	tpt += toffset2+1;
-	res += (1-dy)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
-	tpt += tdimx;
-	res += dy*dz * (*tpt);        /* tbuf(ix,iy+1,iz+1) */
-	*rbuf = (s16)_CONVERTI_( res );
-	continue;
-      }
-      /* here we are sure that the border is either
-	 along the Y or the Z axis */
-      dx = x - ix;
-      if ( (y < 0.0) || (iy == t1dimy) ) {
-	if ( (z < 0.0) || (iz == t1dimz) ) {
-	  res = (1-dx) * (*tpt); /* tbuf(ix,iy,iz) */
-	  tpt ++;
-	  res += dx * (*tpt);    /* tbuf(ix+1,iy,iz) */
-	  *rbuf = (s16)_CONVERTI_( res );
-	  continue;
-	}
-	dz = z - iz;
-	res = (1-dx)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
-	tpt ++;
-	res += dx*(1-dz) * (*tpt);    /* tbuf(ix+1,iy,iz) */
-	tpt += tdimxy-1;
-	res += (1-dx)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
-	tpt ++;
-	res += dx*dz * (*tpt);        /* tbuf(ix+1,iy,iz+1) */
-	*rbuf = (s16)_CONVERTI_( res );
-	continue;
-      }
-      /* here we are sure that the border is along the Z axis */
-      dy = y - iy;
-      res = (1-dx)*(1-dy) * (*tpt); /* tbuf(ix,iy,iz) */
-      tpt ++;
-      res += dx*(1-dy) * (*tpt);    /* tbuf(ix+1,iy,iz) */
-      tpt += t1dimx;
-      res += (1-dx)*dy * (*tpt);    /* tbuf(ix,iy+1,iz) */
-      tpt ++;
-      res += dx*dy * (*tpt);        /* tbuf(ix+1,iy+1,iz) */
-      *rbuf = (s16)_CONVERTI_( res );
-    }
-  }
-}
-
-CGAL_INLINE_FUNCTION
-void Reech3DTriLin4x4gb_s16 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim, /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat,   /* transformation matrix */
-			     float gain,
-			     float bias )
-{
-  int i, j, k, ix, iy, iz;
-  double x, y, z, dx, dy, dz, dxdy,dxdz,dydz,dxdydz;
-  double res;
-  double v6, v5, v4;
-  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
-  int tdimx=theDim[0], tdimy=theDim[1], tdimz=theDim[2];
-  int tdimxy=tdimx*tdimy;
-  int toffset1=tdimxy+tdimx+1, toffset2=tdimxy-tdimx-1;
-  int t1dimx=tdimx-1, t1dimy=tdimy-1, t1dimz=tdimz-1;
-  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
-  double ddimz = (double)tdimz-0.5;
-  s16 *tbuf = (s16*)theBuf;
-  s16 *tpt;
-  s16 *rbuf = (s16*)resBuf;
-  double b=bias;
-  double g=gain;
-
-  for ( k = 0; k < rdimz; k ++ ) {
-    if ( get_static_verbose_reech4x4() != 0 )
-      fprintf( stderr, "Processing slice %d\r", k );
-    for ( j = 0; j < rdimy; j ++ )
-    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
-      /* computation of the corresponding point coordinates in theBuf */
-      x = mat[0] * i +  mat[1] * j + mat[2] * k + mat[3];
-      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
-      y = mat[4] * i +  mat[5] * j + mat[6] * k + mat[7];
-      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
-      z = mat[8] * i +  mat[9] * j + mat[10] * k + mat[11];
-      if ((z < -0.5) || ( z > ddimz)) { *rbuf = 0; continue; }
-
-      /* here, the point lies on the borders or completely inside
-	 the image */
-      ix = (int)x;
-      iy = (int)y;
-      iz = (int)z;
-      tpt = (s16 *)tbuf;
-      
-      /* are we on the border or not ? */
-      if ( (x > 0.0) && (ix < t1dimx) &&
-	   (y > 0.0) && (iy < t1dimy) &&
-	   (z > 0.0) && (iz < t1dimz) ) {
-	/* the corresponding point is in the box defined 
-	   by (ix[+1],iy[+1],iz[+1]) */
-	dx = x - ix;
-	dy = y - iy;
-	dz = z - iz;
-	dxdy = dx*dy;
-	dxdz = dx*dz;
-	dydz = dy*dz;
-	dxdydz = dxdy*dz;
-
-	/* we have
-	   v[7]=dxdydz;            coefficient of tbuf(ix+1,iy+1,iz+1)
-	   v[6]=dxdz-dxdydz;       coefficient of tbuf(ix+1,iy,  iz+1)
-	   v[5]=dxdy-dxdydz;       coefficient of tbuf(ix+1,iy+1,iz  )
-	   v[4]=dx-dxdy-v[6];      coefficient of tbuf(ix+1,iy  ,iz  )
-	   v[3]=dydz-dxdydz;       coefficient of tbuf(ix  ,iy+1,iz+1)
-	   v[2]=dz-dydz-v[6];      coefficient of tbuf(ix  ,iy  ,iz+1)
-	   v[1]=dy-dydz-v[5];      coefficient of tbuf(ix  ,iy+1,iz  )
-	   v[0]=1-dy-dz+dydz-v[4]; coefficient of tbuf(ix  ,iy  ,iz  )
-	*/
-	tpt += ix + iy * tdimx + iz * tdimxy + toffset1;
-	v6 = dxdz-dxdydz;
-	v5 = dxdy-dxdydz;
-	v4 = dx-dxdy-v6;
-
-	res = 0;
-	res += dxdydz * (*tpt);            /* tbuf(ix+1,iy+1,iz+1) */
-	tpt --;
-	res += (dydz-dxdydz) * (*tpt);     /* tbuf(ix  ,iy+1,iz+1) */
-	tpt -= t1dimx;
-	res += v6 * (*tpt);                /* tbuf(ix+1  ,iy,  iz+1) */
-	tpt --;
-	res += (dz-dydz-v6) * (*tpt);      /* tbuf(ix  ,iy  ,iz+1) */
-	tpt -= toffset2;
-	res += v5 * (*tpt);                /* tbuf(ix+1,iy+1,iz  ) */
-	tpt --;
-	res += (dy-dydz-v5) * (*tpt);      /* tbuf(ix  ,iy+1,iz  ) */
-	tpt -= t1dimx;
-	res += v4 * (*tpt);                /* tbuf(ix+1,iy  ,iz  ) */
-	tpt --;
-	res += (1-dy-dz+dydz-v4) * (*tpt); /* tbuf(ix  ,iy  ,iz  ) */
-	res = res * g + b;
-	*rbuf = (s16)_CONVERTI_( res );
-	continue;
-      }
-      /* here, we are sure we are on some border */
-      tpt += ix + iy * tdimx + iz * tdimxy;
-      if ( (x < 0.0) || (ix == t1dimx) ) {
-	if ( (y < 0.0) || (iy == t1dimy) ) {
-	  if ( (z < 0.0) || (iz == t1dimz) ) {
-	    res = (double)(*tpt) * g + b;
-	    *rbuf = (s16)_CONVERTI_( res );
-	    continue;
-	  }
-	  dz = z - iz;
-	  res  = (1-dz) * (*tpt); /* (1-dz)* tbuf(ix,iy,iz) */
-	  tpt += tdimxy;
-	  res += dz * (*tpt);     /* dz * tbuf(ix,iy,iz+1) */
-	  res = res * g + b;
-	  *rbuf = (s16)_CONVERTI_( res );
-	  continue;
-	}
-	dy = y - iy;
-	if ( (z < 0.0) || (iz == t1dimz) ) {
-	  res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy,iz) */
-	  tpt += tdimx;
-	  res += dy * (*tpt);     /* dy * tbuf(ix,iy+1,iz) */
-	  res = res * g + b;
-	  *rbuf = (s16)_CONVERTI_( res );
-	  continue;
- 	}
-	dz = z - iz;
-	res = (1-dy)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
-	tpt += tdimx;
-	res += dy*(1-dz) * (*tpt);    /* tbuf(ix,iy+1,iz) */
-	tpt += toffset2+1;
-	res += (1-dy)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
-	tpt += tdimx;
-	res += dy*dz * (*tpt);        /* tbuf(ix,iy+1,iz+1) */
-	res = res * g + b;
-	*rbuf = (s16)_CONVERTI_( res );
-	continue;
-      }
-      /* here we are sure that the border is either
-	 along the Y or the Z axis */
-      dx = x - ix;
-      if ( (y < 0.0) || (iy == t1dimy) ) {
-	if ( (z < 0.0) || (iz == t1dimz) ) {
-	  res = (1-dx) * (*tpt); /* tbuf(ix,iy,iz) */
-	  tpt ++;
-	  res += dx * (*tpt);    /* tbuf(ix+1,iy,iz) */
-	  res = res * g + b;
-	  *rbuf = (s16)_CONVERTI_( res );
-	  continue;
-	}
-	dz = z - iz;
-	res = (1-dx)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
-	tpt ++;
-	res += dx*(1-dz) * (*tpt);    /* tbuf(ix+1,iy,iz) */
-	tpt += tdimxy-1;
-	res += (1-dx)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
-	tpt ++;
-	res += dx*dz * (*tpt);        /* tbuf(ix+1,iy,iz+1) */
-	res = res * g + b;
-	*rbuf = (s16)_CONVERTI_( res );
-	continue;
-      }
-      /* here we are sure that the border is along the Z axis */
-      dy = y - iy;
-      res = (1-dx)*(1-dy) * (*tpt); /* tbuf(ix,iy,iz) */
-      tpt ++;
-      res += dx*(1-dy) * (*tpt);    /* tbuf(ix+1,iy,iz) */
-      tpt += t1dimx;
-      res += (1-dx)*dy * (*tpt);    /* tbuf(ix,iy+1,iz) */
-      tpt ++;
-      res += dx*dy * (*tpt);        /* tbuf(ix+1,iy+1,iz) */
-      res = res * g + b;
-      *rbuf = (s16)_CONVERTI_( res );
-    }
-  }
-}
-
-CGAL_INLINE_FUNCTION
-void Reech3DNearest4x4_s16 ( void* theBuf, /* buffer to be resampled */
-			      int *theDim,  /* dimensions of this buffer */
-			      void* resBuf, /* result buffer */
-			      int *resDim,  /* dimensions of this buffer */
-			      double* mat   /* transformation matrix */
-			      )
-{
-  int i, j, k, ix, iy, iz;
-  double x, y, z;
-  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
-  int tdimx=theDim[0], tdimy=theDim[1], tdimz=theDim[2];
-  int tdimxy=tdimx*tdimy;
-  int t1dimx=tdimx-1, t1dimy=tdimy-1, t1dimz=tdimz-1;
-  s16 *tbuf = (s16*)theBuf;
-  s16 *rbuf = (s16*)resBuf;
-
-  for ( k = 0; k < rdimz; k ++ ) {
-    if ( get_static_verbose_reech4x4() != 0 )
-      fprintf( stderr, "Processing slice %d\r", k );
-    for ( j = 0; j < rdimy; j ++ )
-    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
-      /* computation of the corresponding point coordinates in theBuf */
-      x = mat[0] * i +  mat[1] * j + mat[2] * k + mat[3];
-      ix = (int)(x+0.5);
-      if (( x < -0.5 ) || ( ix > t1dimx)) { *rbuf = 0; continue; }
-      y = mat[4] * i +  mat[5] * j + mat[6] * k + mat[7];
-      iy = (int)(y+0.5);
-      if (( y < -0.5 ) || ( iy > t1dimy)) { *rbuf = 0; continue; }
-      z = mat[8] * i +  mat[9] * j + mat[10] * k + mat[11];
-      iz = (int)(z+0.5);
-      if (( z < -0.5 ) || ( iz > t1dimz)) { *rbuf = 0; continue; }
-      
-      *rbuf = tbuf[ ix + iy * tdimx + iz * tdimxy ];
-    }
-  }
-}
-
-CGAL_INLINE_FUNCTION
-void Reech2DTriLin4x4_s16 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim,  /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat   /* transformation matrix */
-			     )
-{
-  int i, j, k, ix, iy;
-  double x, y, dx, dy, dxdy;
-  double res, v;
-  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
-  int tdimx=theDim[0], tdimy=theDim[1];
-  int toffset=tdimx-1;
-  int t1dimx=tdimx-1, t1dimy=tdimy-1;
-  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
-  s16 *tbuf = (s16*)theBuf;
-  s16 *tpt;
-  s16 *rbuf = (s16*)resBuf;
-
-  for ( k = 0; k < rdimz; k ++ ) {
-    if ( get_static_verbose_reech4x4() != 0 )
-      fprintf( stderr, "Processing slice %d\r", k );
-    /* tbuf represente le premier point du plan */
-    tbuf  = (s16*)theBuf;
-    tbuf += k*(tdimx * tdimy);
-    for ( j = 0; j < rdimy; j ++ )
-    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
-      /* computation of the corresponding point coordinates in theBuf */
-      x = mat[0] * i +  mat[1] * j +              mat[3];
-      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
-      y = mat[4] * i +  mat[5] * j +              mat[7];
-      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
-
-      /* here, the point lies on the borders or completely inside
-	 the image */
-      ix = (int)x;      
-      iy = (int)y;
-      tpt = (s16 *)tbuf;
-      tpt += ix + iy * tdimx;
-      
-      /* are we on the border or not ? */
-      if ( (x > 0.0) && (ix < t1dimx) &&
-	   (y > 0.0) && (iy < t1dimy) ) {
-	dx = x - ix;
-	dy = y - iy;
-	dxdy = dx*dy;
-	/* we have
-	   v[5]=dxdy;         coefficient of tbuf(ix+1,iy+1)
-	   v[4]=dx-dxdy;      coefficient of tbuf(ix+1,iy  )
-	   v[1]=dy-dxdy;      coefficient of tbuf(ix  ,iy+1)
-	   v[0]=1-dx-dy+dxdy; coefficient of tbuf(ix  ,iy  )
-	*/
-	v = dy-dxdy;
-	res = 0;
-	res += (1-dx-v) * (*tpt);  /* tbuf(ix  ,iy  ) */
-	tpt ++;
-	res += (dx-dxdy) * (*tpt); /* tbuf(ix+1,iy  ) */
-	tpt += toffset;
-	res += v * (*tpt);       /* tbuf(ix,iy+1  ) */
-	tpt ++;
-	res += dxdy * (*tpt);      /* tbuf(ix+1,iy+1) */
-	*rbuf = (s16)_CONVERTI_( res );
-	continue;
-      }
-
-      /* here, we are sure we are on some border */
-      if ( (x < 0.0) || (ix == t1dimx) ) {
-	/* we just look at y */
-	if ( (y < 0.0) || (iy == t1dimy) ) {
-	  *rbuf = *tpt;
-	  continue;
-	}
-	dy = y - iy;
-	res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy) */
-	tpt += tdimx;
-	res += dy * (*tpt);     /* dy * tbuf(ix,iy+1) */
-	*rbuf = (s16)_CONVERTI_( res );
-	continue;
-      }
-      dx = x - ix;
-      res  = (1-dx) * (*tpt); /* (1-dx)* tbuf(ix,iy) */
-      tpt ++;
-      res += dx * (*tpt);     /* dx * tbuf(ix+1,iy) */
-      *rbuf = (s16)_CONVERTI_( res );
-    }
-  }
-}
-
-CGAL_INLINE_FUNCTION
-void Reech2DTriLin4x4gb_s16 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim,  /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat,   /* transformation matrix */
-			     float gain,
-			     float bias )
-{
-  int i, j, k, ix, iy;
-  double x, y, dx, dy, dxdy;
-  double res, v;
-  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
-  int tdimx=theDim[0], tdimy=theDim[1];
-  int toffset=tdimx-1;
-  int t1dimx=tdimx-1, t1dimy=tdimy-1;
-  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
-  s16 *tbuf = (s16*)theBuf;
-  s16 *tpt;
-  s16 *rbuf = (s16*)resBuf;
-  double b=bias;
-  double g=gain;
-
-  for ( k = 0; k < rdimz; k ++ ) {
-    if ( get_static_verbose_reech4x4() != 0 )
-      fprintf( stderr, "Processing slice %d\r", k );
-    /* tbuf represente le premier point du plan */
-    tbuf  = (s16*)theBuf;
-    tbuf += k*(tdimx * tdimy);
-    for ( j = 0; j < rdimy; j ++ )
-    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
-      /* computation of the corresponding point coordinates in theBuf */
-      x = mat[0] * i +  mat[1] * j +              mat[3];
-      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
-      y = mat[4] * i +  mat[5] * j +              mat[7];
-      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
-
-      /* here, the point lies on the borders or completely inside
-	 the image */
-      ix = (int)x;      
-      iy = (int)y;
-      tpt = (s16 *)tbuf;
-      tpt += ix + iy * tdimx;
-      
-      /* are we on the border or not ? */
-      if ( (x > 0.0) && (ix < t1dimx) &&
-	   (y > 0.0) && (iy < t1dimy) ) {
-	dx = x - ix;
-	dy = y - iy;
-	dxdy = dx*dy;
-	/* we have
-	   v[5]=dxdy;         coefficient of tbuf(ix+1,iy+1)
-	   v[4]=dx-dxdy;      coefficient of tbuf(ix+1,iy  )
-	   v[1]=dy-dxdy;      coefficient of tbuf(ix  ,iy+1)
-	   v[0]=1-dx-dy+dxdy; coefficient of tbuf(ix  ,iy  )
-	*/
-	v = dy-dxdy;
-	res = 0;
-	res += (1-dx-v) * (*tpt);  /* tbuf(ix  ,iy  ) */
-	tpt ++;
-	res += (dx-dxdy) * (*tpt); /* tbuf(ix+1,iy  ) */
-	tpt += toffset;
-	res += v * (*tpt);       /* tbuf(ix,iy+1  ) */
-	tpt ++;
-	res += dxdy * (*tpt);      /* tbuf(ix+1,iy+1) */
-	res = res * g + b;
-	*rbuf = (s16)_CONVERTI_( res );
-	continue;
-      }
-
-      /* here, we are sure we are on some border */
-      if ( (x < 0.0) || (ix == t1dimx) ) {
-	/* we just look at y */
-	if ( (y < 0.0) || (iy == t1dimy) ) {
-	  res = (double)(*tpt) * g + b;
-	  *rbuf = (s16)_CONVERTI_( res );
-	  continue;
-	}
-	dy = y - iy;
-	res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy) */
-	tpt += tdimx;
-	res += dy * (*tpt);     /* dy * tbuf(ix,iy+1) */
-	res = (double)(*tpt) * g + b;
-	*rbuf = (s16)_CONVERTI_( res );
-	continue;
-      }
-      dx = x - ix;
-      res  = (1-dx) * (*tpt); /* (1-dx)* tbuf(ix,iy) */
-      tpt ++;
-      res += dx * (*tpt);     /* dx * tbuf(ix+1,iy) */
-      res = res * g + b;
-            *rbuf = (s16)_CONVERTI_( res );
-    }
-  }
-}
-
-CGAL_INLINE_FUNCTION
-void Reech2DNearest4x4_s16 ( void* theBuf, /* buffer to be resampled */
-			      int *theDim,  /* dimensions of this buffer */
-			      void* resBuf, /* result buffer */
-			      int *resDim,  /* dimensions of this buffer */
-			      double* mat   /* transformation matrix */
-			      )
-{
-  int i, j, k, ix, iy;
-  double x, y;
-  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
-  int tdimx=theDim[0], tdimy=theDim[1];
-  int t1dimx=tdimx-1, t1dimy=tdimy-1;
-  s16 *tbuf = (s16*)theBuf;
-  s16 *rbuf = (s16*)resBuf;
-
-  for ( k = 0; k < rdimz; k ++ ) {
-    if ( get_static_verbose_reech4x4() != 0 )
-      fprintf( stderr, "Processing slice %d\r", k );
-    /* tbuf represente le premier point du plan */
-    tbuf  = (s16*)theBuf;
-    tbuf += k*(tdimx * tdimy);
-    for ( j = 0; j < rdimy; j ++ )
-    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
-      /* computation of the corresponding point coordinates in theBuf */
-      x = mat[0] * i +  mat[1] * j + mat[3];
-      ix = (int)(x+0.5);
-      if (( x < -0.5 ) || ( ix > t1dimx)) { *rbuf = 0; continue; }
-      y = mat[4] * i +  mat[5] * j + mat[7];
-      iy = (int)(y+0.5);
-      if (( y < -0.5 ) || ( iy > t1dimy)) { *rbuf = 0; continue; }
-      
-      *rbuf = tbuf[ ix + iy * tdimx ];
-    }
-  }
-}
-
-
-
-
-
-
-/* Resampling procedure.
-
-   Work for 3D images, not for vectorial ones.
-   
-   (double* mat) is the matrix which permits to get
-   from resBuf into theBuf. 
-   If one only have the matrix from theBuf into resBuf,
-   it must be inverted first.
-
-   Soit x le point transforme et ix=(int)x;
-   nous allons distinguer les cas suivants :
-    x < -0.5               => resultat = 0
-    -0.5 <= x < 0.0        => ix=0, on n'interpole pas selon X
-    0.0 < x && ix < dimx-1 => on interpole selon X
-    x < dimx-0.5           => ix=dimx-1, on n'interpole pas selon X
-    x >= dimx-0.5          => resultat = 0
-
-*/
-
-CGAL_INLINE_FUNCTION
-void Reech3DTriLin4x4_r32 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim, /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat   /* transformation matrix */
-			     )
-{
-  int i, j, k, ix, iy, iz;
-  double x, y, z, dx, dy, dz, dxdy,dxdz,dydz,dxdydz;
-  double res;
-  double v6, v5, v4;
-  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
-  int tdimx=theDim[0], tdimy=theDim[1], tdimz=theDim[2];
-  int tdimxy=tdimx*tdimy;
-  int toffset1=tdimxy+tdimx+1, toffset2=tdimxy-tdimx-1;
-  int t1dimx=tdimx-1, t1dimy=tdimy-1, t1dimz=tdimz-1;
-  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
-  double ddimz = (double)tdimz-0.5;
-  r32 *tbuf = (r32*)theBuf;
-  r32 *tpt;
-  r32 *rbuf = (r32*)resBuf;
-
-  for ( k = 0; k < rdimz; k ++ ) {
-    if ( get_static_verbose_reech4x4() != 0 )
-      fprintf( stderr, "Processing slice %d\r", k );
-    for ( j = 0; j < rdimy; j ++ )
-    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
-      /* computation of the corresponding point coordinates in theBuf */
-      x = mat[0] * i +  mat[1] * j + mat[2] * k + mat[3];
-      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
-      y = mat[4] * i +  mat[5] * j + mat[6] * k + mat[7];
-      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
-      z = mat[8] * i +  mat[9] * j + mat[10] * k + mat[11];
-      if ((z < -0.5) || ( z > ddimz)) { *rbuf = 0; continue; }
-
-      /* here, the point lies on the borders or completely inside
-	 the image */
-      ix = (int)x;
-      iy = (int)y;
-      iz = (int)z;
-      tpt = (r32 *)tbuf;
-      
-      /* are we on the border or not ? */
-      if ( (x > 0.0) && (ix < t1dimx) &&
-	   (y > 0.0) && (iy < t1dimy) &&
-	   (z > 0.0) && (iz < t1dimz) ) {
-	/* the corresponding point is in the box defined 
-	   by (ix[+1],iy[+1],iz[+1]) */
-	dx = x - ix;
-	dy = y - iy;
-	dz = z - iz;
-	dxdy = dx*dy;
-	dxdz = dx*dz;
-	dydz = dy*dz;
-	dxdydz = dxdy*dz;
-
-	/* we have
-	   v[7]=dxdydz;            coefficient of tbuf(ix+1,iy+1,iz+1)
-	   v[6]=dxdz-dxdydz;       coefficient of tbuf(ix+1,iy,  iz+1)
-	   v[5]=dxdy-dxdydz;       coefficient of tbuf(ix+1,iy+1,iz  )
-	   v[4]=dx-dxdy-v[6];      coefficient of tbuf(ix+1,iy  ,iz  )
-	   v[3]=dydz-dxdydz;       coefficient of tbuf(ix  ,iy+1,iz+1)
-	   v[2]=dz-dydz-v[6];      coefficient of tbuf(ix  ,iy  ,iz+1)
-	   v[1]=dy-dydz-v[5];      coefficient of tbuf(ix  ,iy+1,iz  )
-	   v[0]=1-dy-dz+dydz-v[4]; coefficient of tbuf(ix  ,iy  ,iz  )
-	*/
-	tpt += ix + iy * tdimx + iz * tdimxy + toffset1;
-	v6 = dxdz-dxdydz;
-	v5 = dxdy-dxdydz;
-	v4 = dx-dxdy-v6;
-
-	res = 0;
-	res += dxdydz * (*tpt);            /* tbuf(ix+1,iy+1,iz+1) */
-	tpt --;
-	res += (dydz-dxdydz) * (*tpt);     /* tbuf(ix  ,iy+1,iz+1) */
-	tpt -= t1dimx;
-	res += v6 * (*tpt);                /* tbuf(ix+1  ,iy,  iz+1) */
-	tpt --;
-	res += (dz-dydz-v6) * (*tpt);      /* tbuf(ix  ,iy  ,iz+1) */
-	tpt -= toffset2;
-	res += v5 * (*tpt);                /* tbuf(ix+1,iy+1,iz  ) */
-	tpt --;
-	res += (dy-dydz-v5) * (*tpt);      /* tbuf(ix  ,iy+1,iz  ) */
-	tpt -= t1dimx;
-	res += v4 * (*tpt);                /* tbuf(ix+1,iy  ,iz  ) */
-	tpt --;
-	res += (1-dy-dz+dydz-v4) * (*tpt); /* tbuf(ix  ,iy  ,iz  ) */
-	*rbuf = (r32)_CONVERTR_( res );
-	continue;
-      }
-      /* here, we are sure we are on some border */
-      tpt += ix + iy * tdimx + iz * tdimxy;
-      if ( (x < 0.0) || (ix == t1dimx) ) {
-	if ( (y < 0.0) || (iy == t1dimy) ) {
-	  if ( (z < 0.0) || (iz == t1dimz) ) {
-	    *rbuf = *tpt;
-	    continue;
-	  }
-	  dz = z - iz;
-	  res  = (1-dz) * (*tpt); /* (1-dz)* tbuf(ix,iy,iz) */
-	  tpt += tdimxy;
-	  res += dz * (*tpt);     /* dz * tbuf(ix,iy,iz+1) */
-	  *rbuf = (r32)_CONVERTR_( res );
-	  continue;
-	}
-	dy = y - iy;
-	if ( (z < 0.0) || (iz == t1dimz) ) {
-	  res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy,iz) */
-	  tpt += tdimx;
-	  res += dy * (*tpt);     /* dy * tbuf(ix,iy+1,iz) */
-	  *rbuf = (r32)_CONVERTR_( res );
-	  continue;
- 	}
-	dz = z - iz;
-	res = (1-dy)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
-	tpt += tdimx;
-	res += dy*(1-dz) * (*tpt);    /* tbuf(ix,iy+1,iz) */
-	tpt += toffset2+1;
-	res += (1-dy)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
-	tpt += tdimx;
-	res += dy*dz * (*tpt);        /* tbuf(ix,iy+1,iz+1) */
-	*rbuf = (r32)_CONVERTR_( res );
-	continue;
-      }
-      /* here we are sure that the border is either
-	 along the Y or the Z axis */
-      dx = x - ix;
-      if ( (y < 0.0) || (iy == t1dimy) ) {
-	if ( (z < 0.0) || (iz == t1dimz) ) {
-	  res = (1-dx) * (*tpt); /* tbuf(ix,iy,iz) */
-	  tpt ++;
-	  res += dx * (*tpt);    /* tbuf(ix+1,iy,iz) */
-	  *rbuf = (r32)_CONVERTR_( res );
-	  continue;
-	}
-	dz = z - iz;
-	res = (1-dx)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
-	tpt ++;
-	res += dx*(1-dz) * (*tpt);    /* tbuf(ix+1,iy,iz) */
-	tpt += tdimxy-1;
-	res += (1-dx)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
-	tpt ++;
-	res += dx*dz * (*tpt);        /* tbuf(ix+1,iy,iz+1) */
-	*rbuf = (r32)_CONVERTR_( res );
-	continue;
-      }
-      /* here we are sure that the border is along the Z axis */
-      dy = y - iy;
-      res = (1-dx)*(1-dy) * (*tpt); /* tbuf(ix,iy,iz) */
-      tpt ++;
-      res += dx*(1-dy) * (*tpt);    /* tbuf(ix+1,iy,iz) */
-      tpt += t1dimx;
-      res += (1-dx)*dy * (*tpt);    /* tbuf(ix,iy+1,iz) */
-      tpt ++;
-      res += dx*dy * (*tpt);        /* tbuf(ix+1,iy+1,iz) */
-      *rbuf = (r32)_CONVERTR_( res );
-    }
-  }
-}
-
-CGAL_INLINE_FUNCTION
-void Reech3DTriLin4x4gb_r32 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim, /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat,   /* transformation matrix */
-			     float gain,
-			     float bias )
-{
-  int i, j, k, ix, iy, iz;
-  double x, y, z, dx, dy, dz, dxdy,dxdz,dydz,dxdydz;
-  double res;
-  double v6, v5, v4;
-  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
-  int tdimx=theDim[0], tdimy=theDim[1], tdimz=theDim[2];
-  int tdimxy=tdimx*tdimy;
-  int toffset1=tdimxy+tdimx+1, toffset2=tdimxy-tdimx-1;
-  int t1dimx=tdimx-1, t1dimy=tdimy-1, t1dimz=tdimz-1;
-  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
-  double ddimz = (double)tdimz-0.5;
-  r32 *tbuf = (r32*)theBuf;
-  r32 *tpt;
-  r32 *rbuf = (r32*)resBuf;
-  double b=bias;
-  double g=gain;
-
-  for ( k = 0; k < rdimz; k ++ ) {
-    if ( get_static_verbose_reech4x4() != 0 )
-      fprintf( stderr, "Processing slice %d\r", k );
-    for ( j = 0; j < rdimy; j ++ )
-    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
-      /* computation of the corresponding point coordinates in theBuf */
-      x = mat[0] * i +  mat[1] * j + mat[2] * k + mat[3];
-      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
-      y = mat[4] * i +  mat[5] * j + mat[6] * k + mat[7];
-      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
-      z = mat[8] * i +  mat[9] * j + mat[10] * k + mat[11];
-      if ((z < -0.5) || ( z > ddimz)) { *rbuf = 0; continue; }
-
-      /* here, the point lies on the borders or completely inside
-	 the image */
-      ix = (int)x;
-      iy = (int)y;
-      iz = (int)z;
-      tpt = (r32 *)tbuf;
-      
-      /* are we on the border or not ? */
-      if ( (x > 0.0) && (ix < t1dimx) &&
-	   (y > 0.0) && (iy < t1dimy) &&
-	   (z > 0.0) && (iz < t1dimz) ) {
-	/* the corresponding point is in the box defined 
-	   by (ix[+1],iy[+1],iz[+1]) */
-	dx = x - ix;
-	dy = y - iy;
-	dz = z - iz;
-	dxdy = dx*dy;
-	dxdz = dx*dz;
-	dydz = dy*dz;
-	dxdydz = dxdy*dz;
-
-	/* we have
-	   v[7]=dxdydz;            coefficient of tbuf(ix+1,iy+1,iz+1)
-	   v[6]=dxdz-dxdydz;       coefficient of tbuf(ix+1,iy,  iz+1)
-	   v[5]=dxdy-dxdydz;       coefficient of tbuf(ix+1,iy+1,iz  )
-	   v[4]=dx-dxdy-v[6];      coefficient of tbuf(ix+1,iy  ,iz  )
-	   v[3]=dydz-dxdydz;       coefficient of tbuf(ix  ,iy+1,iz+1)
-	   v[2]=dz-dydz-v[6];      coefficient of tbuf(ix  ,iy  ,iz+1)
-	   v[1]=dy-dydz-v[5];      coefficient of tbuf(ix  ,iy+1,iz  )
-	   v[0]=1-dy-dz+dydz-v[4]; coefficient of tbuf(ix  ,iy  ,iz  )
-	*/
-	tpt += ix + iy * tdimx + iz * tdimxy + toffset1;
-	v6 = dxdz-dxdydz;
-	v5 = dxdy-dxdydz;
-	v4 = dx-dxdy-v6;
-
-	res = 0;
-	res += dxdydz * (*tpt);            /* tbuf(ix+1,iy+1,iz+1) */
-	tpt --;
-	res += (dydz-dxdydz) * (*tpt);     /* tbuf(ix  ,iy+1,iz+1) */
-	tpt -= t1dimx;
-	res += v6 * (*tpt);                /* tbuf(ix+1  ,iy,  iz+1) */
-	tpt --;
-	res += (dz-dydz-v6) * (*tpt);      /* tbuf(ix  ,iy  ,iz+1) */
-	tpt -= toffset2;
-	res += v5 * (*tpt);                /* tbuf(ix+1,iy+1,iz  ) */
-	tpt --;
-	res += (dy-dydz-v5) * (*tpt);      /* tbuf(ix  ,iy+1,iz  ) */
-	tpt -= t1dimx;
-	res += v4 * (*tpt);                /* tbuf(ix+1,iy  ,iz  ) */
-	tpt --;
-	res += (1-dy-dz+dydz-v4) * (*tpt); /* tbuf(ix  ,iy  ,iz  ) */
-	res = res * g + b;
-	*rbuf = (r32)_CONVERTR_( res );
-	continue;
-      }
-      /* here, we are sure we are on some border */
-      tpt += ix + iy * tdimx + iz * tdimxy;
-      if ( (x < 0.0) || (ix == t1dimx) ) {
-	if ( (y < 0.0) || (iy == t1dimy) ) {
-	  if ( (z < 0.0) || (iz == t1dimz) ) {
-	    res = (double)(*tpt) * g + b;
-	    *rbuf = (r32)_CONVERTR_( res );
-	    continue;
-	  }
-	  dz = z - iz;
-	  res  = (1-dz) * (*tpt); /* (1-dz)* tbuf(ix,iy,iz) */
-	  tpt += tdimxy;
-	  res += dz * (*tpt);     /* dz * tbuf(ix,iy,iz+1) */
-	  res = res * g + b;
-	  *rbuf = (r32)_CONVERTR_( res );
-	  continue;
-	}
-	dy = y - iy;
-	if ( (z < 0.0) || (iz == t1dimz) ) {
-	  res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy,iz) */
-	  tpt += tdimx;
-	  res += dy * (*tpt);     /* dy * tbuf(ix,iy+1,iz) */
-	  res = res * g + b;
-	  *rbuf = (r32)_CONVERTR_( res );
-	  continue;
- 	}
-	dz = z - iz;
-	res = (1-dy)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
-	tpt += tdimx;
-	res += dy*(1-dz) * (*tpt);    /* tbuf(ix,iy+1,iz) */
-	tpt += toffset2+1;
-	res += (1-dy)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
-	tpt += tdimx;
-	res += dy*dz * (*tpt);        /* tbuf(ix,iy+1,iz+1) */
-	res = res * g + b;
-	*rbuf = (r32)_CONVERTR_( res );
-	continue;
-      }
-      /* here we are sure that the border is either
-	 along the Y or the Z axis */
-      dx = x - ix;
-      if ( (y < 0.0) || (iy == t1dimy) ) {
-	if ( (z < 0.0) || (iz == t1dimz) ) {
-	  res = (1-dx) * (*tpt); /* tbuf(ix,iy,iz) */
-	  tpt ++;
-	  res += dx * (*tpt);    /* tbuf(ix+1,iy,iz) */
-	  res = res * g + b;
-	  *rbuf = (r32)_CONVERTR_( res );
-	  continue;
-	}
-	dz = z - iz;
-	res = (1-dx)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
-	tpt ++;
-	res += dx*(1-dz) * (*tpt);    /* tbuf(ix+1,iy,iz) */
-	tpt += tdimxy-1;
-	res += (1-dx)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
-	tpt ++;
-	res += dx*dz * (*tpt);        /* tbuf(ix+1,iy,iz+1) */
-	res = res * g + b;
-	*rbuf = (r32)_CONVERTR_( res );
-	continue;
-      }
-      /* here we are sure that the border is along the Z axis */
-      dy = y - iy;
-      res = (1-dx)*(1-dy) * (*tpt); /* tbuf(ix,iy,iz) */
-      tpt ++;
-      res += dx*(1-dy) * (*tpt);    /* tbuf(ix+1,iy,iz) */
-      tpt += t1dimx;
-      res += (1-dx)*dy * (*tpt);    /* tbuf(ix,iy+1,iz) */
-      tpt ++;
-      res += dx*dy * (*tpt);        /* tbuf(ix+1,iy+1,iz) */
-      res = res * g + b;
-      *rbuf = (r32)_CONVERTR_( res );
-    }
-  }
-}
-
-CGAL_INLINE_FUNCTION
-void Reech3DNearest4x4_r32 ( void* theBuf, /* buffer to be resampled */
-			      int *theDim,  /* dimensions of this buffer */
-			      void* resBuf, /* result buffer */
-			      int *resDim,  /* dimensions of this buffer */
-			      double* mat   /* transformation matrix */
-			      )
-{
-  int i, j, k, ix, iy, iz;
-  double x, y, z;
-  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
-  int tdimx=theDim[0], tdimy=theDim[1], tdimz=theDim[2];
-  int tdimxy=tdimx*tdimy;
-  int t1dimx=tdimx-1, t1dimy=tdimy-1, t1dimz=tdimz-1;
-  r32 *tbuf = (r32*)theBuf;
-  r32 *rbuf = (r32*)resBuf;
-
-  for ( k = 0; k < rdimz; k ++ ) {
-    if ( get_static_verbose_reech4x4() != 0 )
-      fprintf( stderr, "Processing slice %d\r", k );
-    for ( j = 0; j < rdimy; j ++ )
-    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
-      /* computation of the corresponding point coordinates in theBuf */
-      x = mat[0] * i +  mat[1] * j + mat[2] * k + mat[3];
-      ix = (int)(x+0.5);
-      if (( x < -0.5 ) || ( ix > t1dimx)) { *rbuf = 0; continue; }
-      y = mat[4] * i +  mat[5] * j + mat[6] * k + mat[7];
-      iy = (int)(y+0.5);
-      if (( y < -0.5 ) || ( iy > t1dimy)) { *rbuf = 0; continue; }
-      z = mat[8] * i +  mat[9] * j + mat[10] * k + mat[11];
-      iz = (int)(z+0.5);
-      if (( z < -0.5 ) || ( iz > t1dimz)) { *rbuf = 0; continue; }
-      
-      *rbuf = tbuf[ ix + iy * tdimx + iz * tdimxy ];
-    }
-  }
-}
-
-CGAL_INLINE_FUNCTION
-void Reech2DTriLin4x4_r32 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim,  /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat   /* transformation matrix */
-			     )
-{
-  int i, j, k, ix, iy;
-  double x, y, dx, dy, dxdy;
-  double res, v;
-  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
-  int tdimx=theDim[0], tdimy=theDim[1];
-  int toffset=tdimx-1;
-  int t1dimx=tdimx-1, t1dimy=tdimy-1;
-  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
-  r32 *tbuf = (r32*)theBuf;
-  r32 *tpt;
-  r32 *rbuf = (r32*)resBuf;
-
-  for ( k = 0; k < rdimz; k ++ ) {
-    if ( get_static_verbose_reech4x4() != 0 )
-      fprintf( stderr, "Processing slice %d\r", k );
-    /* tbuf represente le premier point du plan */
-    tbuf  = (r32*)theBuf;
-    tbuf += k*(tdimx * tdimy);
-    for ( j = 0; j < rdimy; j ++ )
-    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
-      /* computation of the corresponding point coordinates in theBuf */
-      x = mat[0] * i +  mat[1] * j +              mat[3];
-      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
-      y = mat[4] * i +  mat[5] * j +              mat[7];
-      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
-
-      /* here, the point lies on the borders or completely inside
-	 the image */
-      ix = (int)x;      
-      iy = (int)y;
-      tpt = (r32 *)tbuf;
-      tpt += ix + iy * tdimx;
-      
-      /* are we on the border or not ? */
-      if ( (x > 0.0) && (ix < t1dimx) &&
-	   (y > 0.0) && (iy < t1dimy) ) {
-	dx = x - ix;
-	dy = y - iy;
-	dxdy = dx*dy;
-	/* we have
-	   v[5]=dxdy;         coefficient of tbuf(ix+1,iy+1)
-	   v[4]=dx-dxdy;      coefficient of tbuf(ix+1,iy  )
-	   v[1]=dy-dxdy;      coefficient of tbuf(ix  ,iy+1)
-	   v[0]=1-dx-dy+dxdy; coefficient of tbuf(ix  ,iy  )
-	*/
-	v = dy-dxdy;
-	res = 0;
-	res += (1-dx-v) * (*tpt);  /* tbuf(ix  ,iy  ) */
-	tpt ++;
-	res += (dx-dxdy) * (*tpt); /* tbuf(ix+1,iy  ) */
-	tpt += toffset;
-	res += v * (*tpt);       /* tbuf(ix,iy+1  ) */
-	tpt ++;
-	res += dxdy * (*tpt);      /* tbuf(ix+1,iy+1) */
-	*rbuf = (r32)_CONVERTR_( res );
-	continue;
-      }
-
-      /* here, we are sure we are on some border */
-      if ( (x < 0.0) || (ix == t1dimx) ) {
-	/* we just look at y */
-	if ( (y < 0.0) || (iy == t1dimy) ) {
-	  *rbuf = *tpt;
-	  continue;
-	}
-	dy = y - iy;
-	res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy) */
-	tpt += tdimx;
-	res += dy * (*tpt);     /* dy * tbuf(ix,iy+1) */
-	*rbuf = (r32)_CONVERTR_( res );
-	continue;
-      }
-      dx = x - ix;
-      res  = (1-dx) * (*tpt); /* (1-dx)* tbuf(ix,iy) */
-      tpt ++;
-      res += dx * (*tpt);     /* dx * tbuf(ix+1,iy) */
-      *rbuf = (r32)_CONVERTR_( res );
-    }
-  }
-}
-
-CGAL_INLINE_FUNCTION
-void Reech2DTriLin4x4gb_r32 ( void* theBuf, /* buffer to be resampled */
-			     int *theDim,  /* dimensions of this buffer */
-			     void* resBuf, /* result buffer */
-			     int *resDim,  /* dimensions of this buffer */
-			     double* mat,   /* transformation matrix */
-			     float gain,
-			     float bias )
-{
-  int i, j, k, ix, iy;
-  double x, y, dx, dy, dxdy;
-  double res, v;
-  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
-  int tdimx=theDim[0], tdimy=theDim[1];
-  int toffset=tdimx-1;
-  int t1dimx=tdimx-1, t1dimy=tdimy-1;
-  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
-  r32 *tbuf = (r32*)theBuf;
-  r32 *tpt;
-  r32 *rbuf = (r32*)resBuf;
-  double b=bias;
-  double g=gain;
-
-  for ( k = 0; k < rdimz; k ++ ) {
-    if ( get_static_verbose_reech4x4() != 0 )
-      fprintf( stderr, "Processing slice %d\r", k );
-    /* tbuf represente le premier point du plan */
-    tbuf  = (r32*)theBuf;
-    tbuf += k*(tdimx * tdimy);
-    for ( j = 0; j < rdimy; j ++ )
-    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
-      /* computation of the corresponding point coordinates in theBuf */
-      x = mat[0] * i +  mat[1] * j +              mat[3];
-      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
-      y = mat[4] * i +  mat[5] * j +              mat[7];
-      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
-
-      /* here, the point lies on the borders or completely inside
-	 the image */
-      ix = (int)x;      
-      iy = (int)y;
-      tpt = (r32 *)tbuf;
-      tpt += ix + iy * tdimx;
-      
-      /* are we on the border or not ? */
-      if ( (x > 0.0) && (ix < t1dimx) &&
-	   (y > 0.0) && (iy < t1dimy) ) {
-	dx = x - ix;
-	dy = y - iy;
-	dxdy = dx*dy;
-	/* we have
-	   v[5]=dxdy;         coefficient of tbuf(ix+1,iy+1)
-	   v[4]=dx-dxdy;      coefficient of tbuf(ix+1,iy  )
-	   v[1]=dy-dxdy;      coefficient of tbuf(ix  ,iy+1)
-	   v[0]=1-dx-dy+dxdy; coefficient of tbuf(ix  ,iy  )
-	*/
-	v = dy-dxdy;
-	res = 0;
-	res += (1-dx-v) * (*tpt);  /* tbuf(ix  ,iy  ) */
-	tpt ++;
-	res += (dx-dxdy) * (*tpt); /* tbuf(ix+1,iy  ) */
-	tpt += toffset;
-	res += v * (*tpt);       /* tbuf(ix,iy+1  ) */
-	tpt ++;
-	res += dxdy * (*tpt);      /* tbuf(ix+1,iy+1) */
-	res = res * g + b;
-	*rbuf = (r32)_CONVERTR_( res );
-	continue;
-      }
-
-      /* here, we are sure we are on some border */
-      if ( (x < 0.0) || (ix == t1dimx) ) {
-	/* we just look at y */
-	if ( (y < 0.0) || (iy == t1dimy) ) {
-	  res = (double)(*tpt) * g + b;
-	  *rbuf = (r32)_CONVERTR_( res );
-	  continue;
-	}
-	dy = y - iy;
-	res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy) */
-	tpt += tdimx;
-	res += dy * (*tpt);     /* dy * tbuf(ix,iy+1) */
-	res = (double)(*tpt) * g + b;
-	*rbuf = (r32)_CONVERTR_( res );
-	continue;
-      }
-      dx = x - ix;
-      res  = (1-dx) * (*tpt); /* (1-dx)* tbuf(ix,iy) */
-      tpt ++;
-      res += dx * (*tpt);     /* dx * tbuf(ix+1,iy) */
-      res = res * g + b;
-            *rbuf = (r32)_CONVERTR_( res );
-    }
-  }
-}
-
-CGAL_INLINE_FUNCTION
-void Reech2DNearest4x4_r32 ( void* theBuf, /* buffer to be resampled */
-			      int *theDim,  /* dimensions of this buffer */
-			      void* resBuf, /* result buffer */
-			      int *resDim,  /* dimensions of this buffer */
-			      double* mat   /* transformation matrix */
-			      )
-{
-  int i, j, k, ix, iy;
-  double x, y;
-  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
-  int tdimx=theDim[0], tdimy=theDim[1];
-  int t1dimx=tdimx-1, t1dimy=tdimy-1;
-  r32 *tbuf = (r32*)theBuf;
-  r32 *rbuf = (r32*)resBuf;
-
-  for ( k = 0; k < rdimz; k ++ ) {
-    if ( get_static_verbose_reech4x4() != 0 )
-      fprintf( stderr, "Processing slice %d\r", k );
-    /* tbuf represente le premier point du plan */
-    tbuf  = (r32*)theBuf;
-    tbuf += k*(tdimx * tdimy);
-    for ( j = 0; j < rdimy; j ++ )
-    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
-      /* computation of the corresponding point coordinates in theBuf */
-      x = mat[0] * i +  mat[1] * j + mat[3];
-      ix = (int)(x+0.5);
-      if (( x < -0.5 ) || ( ix > t1dimx)) { *rbuf = 0; continue; }
-      y = mat[4] * i +  mat[5] * j + mat[7];
-      iy = (int)(y+0.5);
-      if (( y < -0.5 ) || ( iy > t1dimy)) { *rbuf = 0; continue; }
-      
-      *rbuf = tbuf[ ix + iy * tdimx ];
-    }
-  }
-}
-
-
-
-
-
-
-CGAL_INLINE_FUNCTION
-void Reech4x4_verbose ( )
-{
-  get_static_verbose_reech4x4() = 1;
-}
-
-CGAL_INLINE_FUNCTION
-void Reech4x4_noverbose ( )
-{
-  get_static_verbose_reech4x4() = 0;
-}
diff --git a/3rdparty/CGAL-4.8/src/CGAL_Qt5/CMakeLists.txt b/3rdparty/CGAL-4.8/src/CGAL_Qt5/CMakeLists.txt
deleted file mode 100644
index 546e1cf..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_Qt5/CMakeLists.txt
+++ /dev/null
@@ -1,94 +0,0 @@
-message("Configuring libCGAL_Qt5")
-
-if(POLICY CMP0043)
-  cmake_policy(SET CMP0043 OLD)
-endif()
-
-find_package(Qt5 QUIET COMPONENTS OpenGL Svg QUIET)
-find_package(OpenGL QUIET)
-
-set(CGAL_Qt5_MISSING_DEPS "")
-if(NOT Qt5OpenGL_FOUND)
-  set(CGAL_Qt5_MISSING_DEPS "Qt5OpenGL")
-endif()
-if(NOT Qt5Svg_FOUND)
-  set(CGAL_Qt5_MISSING_DEPS "${CGAL_Qt5_MISSING_DEPS} Qt5Svg")
-endif()
-if(NOT Qt5_FOUND)
-  set(CGAL_Qt5_MISSING_DEPS "${CGAL_Qt5_MISSING_DEPS} Qt5")
-endif()
-if(NOT OPENGL_FOUND)
-  set(CGAL_Qt5_MISSING_DEPS "${CGAL_Qt5_MISSING_DEPS} OpenGL")
-endif()
-
-if(CGAL_Qt5_MISSING_DEPS)
-  message(STATUS "libCGAL_Qt5 is missing the dependencies: ${CGAL_Qt5_MISSING_DEPS} cannot be configured.")
-  return()
-endif()
-
-include_directories (BEFORE ../../include)
-
-message( STATUS "USING Qt5_VERSION = '${Qt5Core_VERSION_STRING}'" )
-if(COMMAND add_config_flag)
-  set( CGAL_HAS_QT5 TRUE )
-  add_config_flag( CGAL_HAS_QT5 )
-endif()
-
-get_property(QT_UIC_EXECUTABLE TARGET Qt5::uic PROPERTY LOCATION)
-message( STATUS "OpenGL include:      ${OPENGL_INCLUDE_DIR}" )
-message( STATUS "OpenGL libraries:    ${OPENGL_LIBRARIES}" )
-message( STATUS "OpenGL definitions:  ${OPENGL_DEFINITIONS}" )
-message( STATUS "Qt5Core include:     ${Qt5Core_INCLUDE_DIRS}" )
-message( STATUS "Qt5 libraries:       ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Svg_LIBRARIES} ${Qt5OpenGL_LIBRARIES}" )
-message( STATUS "Qt5Core definitions: ${Qt5Core_DEFINITIONS}" )
-message( STATUS "moc executable:      ${QT_MOC_EXECUTABLE}" )
-message( STATUS "uic executable:      ${QT_UIC_EXECUTABLE}" )
-
-cache_set(CGAL_Qt5_3RD_PARTY_INCLUDE_DIRS ${QT_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR} )
-cache_set(CGAL_Qt5_3RD_PARTY_LIBRARIES    ${QT_LIBRARIES}   ${OPENGL_LIBRARIES}   )
-cache_set(CGAL_Qt5_3RD_PARTY_DEFINITIONS  ${QT_DEFINITIONS} ${OPENGL_DEFINITIONS} )
-
-set(mocfiles "")
-set(RESOURCE_FILES "")
-
-foreach (package ${CGAL_CONFIGURED_PACKAGES} )
-  file(GLOB PACKAGE_QTMOC_FILES "${package}/src/CGAL_Qt5/*.qtmoc.cmake")
-  foreach(package_qtmoc_file ${PACKAGE_QTMOC_FILES})
-    # includes 'moccing' for sources/headers in package + collects lists of moc-files for dependency (to properly build the lib)
-    include(${package_qtmoc_file}) 
-    #        message(STATUS QTMOC------------FILE: ${package_qtmoc_file})      
-  endforeach()
-endforeach()
-
-foreach(mocfile ${mocfiles})
-  list(APPEND additional_files ${mocfile})
-endforeach()
-foreach(resfile ${RESOURCE_FILES})
-  list(APPEND additional_files ${resfile})
-endforeach()
-
-#    message(STATUS "Additional input files: ${additional_files}")
-
-use_essential_libs()
-
-include_directories( SYSTEM ${CGAL_3RD_PARTY_INCLUDE_DIRS} ${CGAL_Qt5_3RD_PARTY_INCLUDE_DIRS} )
-
-link_directories    ( ${CGAL_LIBRARIES_DIR} ${CGAL_3RD_PARTY_LIBRARIES_DIRS} )
-
-collect_cgal_library( CGAL_Qt5 "${additional_files}")
-
-qt5_use_modules(CGAL_Qt5 OpenGL Svg)
-
-add_dependencies( CGAL_Qt5 CGAL )
-
-# CGAL_Qt5 only depends on CGAL in DEBUG, but we still link it in
-# both build types.
-target_link_libraries( CGAL_Qt5 CGAL ${CGAL_3RD_PARTY_LIBRARIES} ${CGAL_Qt5_3RD_PARTY_LIBRARIES} )
-
-add_definitions ( ${CGAL_3RD_PARTY_DEFINITIONS} ${CGAL_Qt5_3RD_PARTY_DEFINITIONS} )
-
-if($ENV{CGAL_FAKE_PUBLIC_RELEASE})
-  add_definitions( -DCGAL_FAKE_PUBLIC_RELEASE )
-endif()
-
-message("libCGAL_Qt5 is configured")
diff --git a/3rdparty/CGAL-4.8/src/CGAL_Qt5/GraphicsView.qtmoc.cmake b/3rdparty/CGAL-4.8/src/CGAL_Qt5/GraphicsView.qtmoc.cmake
deleted file mode 100644
index 86b463e..0000000
--- a/3rdparty/CGAL-4.8/src/CGAL_Qt5/GraphicsView.qtmoc.cmake
+++ /dev/null
@@ -1,9 +0,0 @@
-# moc files that are compiled directly as cpp files
-qt5_wrap_cpp(mocfiles ../../include/CGAL/Qt/GraphicsViewNavigation.h
-                      ../../include/CGAL/Qt/DemosMainWindow.h
-                      ../../include/CGAL/Qt/GraphicsItem.h
-                      ../../include/CGAL/Qt/GraphicsViewInput.h)
-
-# qrc files (resources files, that contain icons, at least)
-qt5_add_resources ( RESOURCE_FILES ../../demo/resources/CGAL.qrc ../../demo/icons/Input.qrc ../../demo/icons/File.qrc ../../demo/icons/Triangulation_2.qrc)
-
diff --git a/3rdparty/CGAL-4.8/src/CMakeLists.txt b/3rdparty/CGAL-4.8/src/CMakeLists.txt
deleted file mode 100644
index c819ce1..0000000
--- a/3rdparty/CGAL-4.8/src/CMakeLists.txt
+++ /dev/null
@@ -1,195 +0,0 @@
-function (collect_cgal_library LIBRARY_NAME ADDITIONAL_FILES)
-  # IMPORTANT: First delete all_files.cpp
-  if (EXISTS ${CMAKE_CURRENT_BINARY_DIR}/all_files.cpp)
-    file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/all_files.cpp)
-  endif()
-
-  # THEN collect *.cpp
-  foreach (package ${CGAL_CONFIGURED_PACKAGES} )
-    file(GLOB CGAL_LIBRARY_SOURCE_FILES_TMP ${package}/src/${LIBRARY_NAME}/*.cpp)
-    foreach(file ${CGAL_LIBRARY_SOURCE_FILES_TMP})
-      if(NOT ${file} MATCHES "/qrc_.*")
-        list(APPEND CGAL_LIBRARY_SOURCE_FILES ${file})
-      endif()
-    endforeach()
-  endforeach()
-
-  foreach(source ${CGAL_LIBRARY_SOURCE_FILES})
-    # It may happen that a file all_files.cpp had been created in-source by
-    # a previous in-source build. We certainly do not want to include that
-    # file in the new all_files.cpp because .cpp files would be included
-    # twice, and that breaks the one-definition rule (ODR).
-    if(NOT source MATCHES ".*/all_files.cpp")
-      file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/all_files.cpp "\#include \"${source}\"\n")
-    endif()
-  endforeach()
-
-  if(CGAL_BUILD_SHARED_LIBS)
-    set(CGAL_LIB_PREFIX "")
-  else()
-    set(CGAL_LIB_PREFIX "lib")
-  endif()
-
-  set(RELEASE_MANGLED_NAME        "${CGAL_LIB_PREFIX}${LIBRARY_NAME}-${CGAL_TOOLSET}-mt-${CGAL_FULL_VERSION}" ) 
-  set(DEBUG_MANGLED_NAME          "${CGAL_LIB_PREFIX}${LIBRARY_NAME}-${CGAL_TOOLSET}-mt-gd-${CGAL_FULL_VERSION}" ) 
-
-  if(CGAL_BUILD_SHARED_LIBS AND WIN32)
-    configure_file(${CGAL_INSTALLATION_PACKAGE_DIR}/src/CGAL_libs_verinfo.rc.in ${LIBRARY_NAME}_verinfo.rc @ONLY)
-    set(rc_file ${CMAKE_CURRENT_BINARY_DIR}/${LIBRARY_NAME}_verinfo.rc)
-  else()
-    set(rc_file )
-  endif()
-
-  add_library (${LIBRARY_NAME}
-    ${CMAKE_CURRENT_BINARY_DIR}/all_files.cpp 
-    ${rc_file}
-    ${ADDITIONAL_FILES})
-  if(CGAL_SOVERSION AND CGAL_SONAME_VERSION)
-    set_target_properties(${LIBRARY_NAME} PROPERTIES 
-      VERSION "${CGAL_SOVERSION}" 
-      SOVERSION "${CGAL_SONAME_VERSION}")
-  endif()
-
-  if(CGAL_AUTO_LINK_ENABLED)
-    set_target_properties( ${LIBRARY_NAME} PROPERTIES 
-      OUTPUT_NAME_DEBUG          "${DEBUG_MANGLED_NAME}" 
-      OUTPUT_NAME_RELEASE        "${RELEASE_MANGLED_NAME}" 
-      OUTPUT_NAME_MINSIZEREL     "${RELEASE_MANGLED_NAME}" 
-      OUTPUT_NAME_RELWITHDEBINFO "${RELEASE_MANGLED_NAME}" 
-      )
-    
-    if ( HAS_CFG_INTDIR )
-      add_custom_command(TARGET ${LIBRARY_NAME} POST_BUILD COMMAND if exist \"$(TargetDir)$(TargetName).dll\" copy /Y \"$(TargetDir)$(TargetName).dll\" \"$(TargetDir)..\" )
-      add_custom_command(TARGET ${LIBRARY_NAME} POST_BUILD COMMAND if exist \"$(TargetDir)$(TargetName).pdb\" copy /Y \"$(TargetDir)$(TargetName).pdb\" \"$(TargetDir)..\" )
-      add_custom_command(TARGET ${LIBRARY_NAME} POST_BUILD COMMAND if exist \"$(SolutionDir)lib\\$(ConfigurationName)\\$(TargetName).lib\" copy /Y \"$(SolutionDir)lib\\$(ConfigurationName)\\$(TargetName).lib\" \"$(SolutionDir)lib\" )
-    endif()
-  endif()
-
-  install(TARGETS ${LIBRARY_NAME} EXPORT ${LIBRARY_NAME}Exports
-    RUNTIME DESTINATION "${CGAL_INSTALL_BIN_DIR}"
-    LIBRARY DESTINATION "${CGAL_INSTALL_LIB_DIR}"
-    ARCHIVE DESTINATION "${CGAL_INSTALL_LIB_DIR}")
-  install(EXPORT ${LIBRARY_NAME}Exports
-    DESTINATION "${CGAL_INSTALL_CMAKE_DIR}"
-    NAMESPACE CGAL::)
-
-  # We have to call configure_file twice to force double expansion of variables.
-  configure_file("${CGAL_MODULES_DIR}/CGALLibConfig.cmake.in"
-    "${CMAKE_BINARY_DIR}/${LIBRARY_NAME}LibConfig.cmake" @ONLY)
-  configure_file("${CMAKE_BINARY_DIR}/${LIBRARY_NAME}LibConfig.cmake"
-    "${CMAKE_BINARY_DIR}/${LIBRARY_NAME}LibConfig.cmake" @ONLY)
-  install(FILES "${CMAKE_BINARY_DIR}/${LIBRARY_NAME}LibConfig.cmake" DESTINATION ${CGAL_INSTALL_CMAKE_DIR})
-endfunction()
-
-function( configure_component DIR COMPONENT )
-  set(enabled_by_default ON)
-  option( WITH_${COMPONENT} "Enable CGAL component ${COMPONENT}" ${enabled_by_default})
-  if ( WITH_${COMPONENT})
-    add_subdirectory( ${DIR} ${COMPONENT} )
-  endif()
-endfunction()
-
-# Output directory of libraries (.so, .dylib, non-static .lib)
-set(CGAL_LIBRARIES_DIR ${CMAKE_BINARY_DIR}/lib)
-set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CGAL_LIBRARIES_DIR})
-# Output directory of static libraries (.a, static .lib)
-set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CGAL_LIBRARIES_DIR})
-
-# For output directory of DLLs (.dll files)
-set(CGAL_RUNTIME_DIR ${CMAKE_BINARY_DIR}/bin)
-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CGAL_RUNTIME_DIR})
-
-## Prevent use of intermediate directory with MSVC, because we use name
-## mangling
-#foreach(Conf_type ${CMAKE_CONFIGURATION_TYPES})
-#  # Conf_type is Debug, Release, DebWithDebInfo...
-#  string(TOUPPER ${Conf_type} CONF_TYPE)
-#  # CONF_TYPE is DEBUG, RELEASE, DEBWITHDEBINFO
-#  set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CONF_TYPE} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
-#  set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CONF_TYPE} ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY})
-#  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CONF_TYPE} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
-#endforeach()
-
-# TODO: Seems useless, because it is called again in ../CMakeLists.txt
-#       Should probably be removed. -- Laurent Rineau, 2014/07/22
-create_CGALconfig_files()
-
-set(CGAL_DIR ${CMAKE_BINARY_DIR})
-
-add_subdirectory(CGAL)
-
-# search libs
-set(CGAL_CONFIGURED_LIBRARIES "")
- 
-foreach(package ${CGAL_CONFIGURED_PACKAGES}) 
-  file(GLOB CONFIGURED_LIBS_IN_PACKAGE ${package}/src/CGAL_*/CMakeLists.txt)
-  foreach (libconfigfile ${CONFIGURED_LIBS_IN_PACKAGE})
-    get_filename_component(CGAL_CONFIGURED_LIBRARY_NAME ${libconfigfile} PATH)
-    get_filename_component(CGAL_CONFIGURED_LIBRARY_NAME ${CGAL_CONFIGURED_LIBRARY_NAME} NAME)
-
-    if (NOT ${CGAL_CONFIGURED_LIBRARY_NAME} STREQUAL "CGAL")
-
-     message(STATUS "Sources for CGAL component library '${CGAL_CONFIGURED_LIBRARY_NAME}' detected")
-      list(APPEND CGAL_CONFIGURED_LIBRARIES ${CGAL_CONFIGURED_LIBRARY_NAME})
-      #message(STATUS "Library config detected: ${CGAL_CONFIGURED_LIBRARIES}")
-
-      cache_set(${CGAL_CONFIGURED_LIBRARY_NAME}_LIBRARY                  "" )
-      cache_set(${CGAL_CONFIGURED_LIBRARY_NAME}_3RD_PARTY_DEFINITIONS    "" )
-      cache_set(${CGAL_CONFIGURED_LIBRARY_NAME}_3RD_PARTY_INCLUDE_DIRS   "" )
-      cache_set(${CGAL_CONFIGURED_LIBRARY_NAME}_3RD_PARTY_LIBRARIES      "" )
-      cache_set(${CGAL_CONFIGURED_LIBRARY_NAME}_3RD_PARTY_LIBRARIES_DIRS "" ) 
-      if (${CGAL_CONFIGURED_LIBRARY_NAME} STREQUAL "CGAL_Core") 
-        if (NOT CGAL_NO_CORE)
-          configure_component( ${package}/src/${CGAL_CONFIGURED_LIBRARY_NAME} ${CGAL_CONFIGURED_LIBRARY_NAME})
-        else(NOT CGAL_NO_CORE)
-          message( STATUS "CGAL_Core is not being configured (missing GMP, or 64bit architecture).")
-        endif(NOT CGAL_NO_CORE)
-      else()
-        configure_component( ${package}/src/${CGAL_CONFIGURED_LIBRARY_NAME} ${CGAL_CONFIGURED_LIBRARY_NAME})
-      endif()
-
-     cache_get(${CGAL_CONFIGURED_LIBRARY_NAME}_LIBRARY)
-
-     cache_get(${CGAL_CONFIGURED_LIBRARY_NAME}_3RD_PARTY_DEFINITIONS   )
-     cache_get(${CGAL_CONFIGURED_LIBRARY_NAME}_3RD_PARTY_INCLUDE_DIRS  )
-     cache_get(${CGAL_CONFIGURED_LIBRARY_NAME}_3RD_PARTY_LIBRARIES     )
-     cache_get(${CGAL_CONFIGURED_LIBRARY_NAME}_3RD_PARTY_LIBRARIES_DIRS) 
-
-    else() 
- 
-      list(APPEND CGAL_CONFIGURED_LIBRARIES CGAL)
-
-    endif()
-  endforeach()
-endforeach()
-
-if (NOT CGAL_CONFIGURED_LIBRARIES) 
-   message(FATAL_ERROR "No component library in configured packages found. Please fix package-file.")
-endif()
-
-list(REMOVE_DUPLICATES CGAL_CONFIGURED_LIBRARIES)
-list(SORT CGAL_CONFIGURED_LIBRARIES)
-cache_set(CGAL_CONFIGURED_LIBRARIES "${CGAL_CONFIGURED_LIBRARIES}")
-
-# CGAL_CONFIGURED_LIBRARIES is a virtually useless variable, because
-# we do not know if those components actually created a target.  It
-# might seem bad that we hardcode the target names here, but they have
-# always been hardcoded in the CGALConfig files, so we do not make it
-# any worse. We can also not use export(EXPORT) since that is only
-# available in newer CMake versions.
-set(CGAL_ACTUAL_CONFIGURED_LIBRARIES "")
-macro(CGAL_add_if_target TARGET)
-  if(TARGET ${TARGET})
-    list(APPEND CGAL_ACTUAL_CONFIGURED_LIBRARIES ${TARGET})
-  endif()
-endmacro()
-
-CGAL_add_if_target(CGAL)
-CGAL_add_if_target(CGAL_Core)
-CGAL_add_if_target(CGAL_ImageIO)
-CGAL_add_if_target(CGAL_Qt5)
-
-export(TARGETS ${CGAL_ACTUAL_CONFIGURED_LIBRARIES} NAMESPACE CGAL:: FILE "${CMAKE_BINARY_DIR}/CGALExports.cmake")
-
-message(STATUS "Sources for CGAL component libraries '${CGAL_CONFIGURED_LIBRARIES}' detected")
-
diff --git a/3rdparty/CGAL-4.8/AUTHORS b/3rdparty/CGAL/AUTHORS
similarity index 100%
rename from 3rdparty/CGAL-4.8/AUTHORS
rename to 3rdparty/CGAL/AUTHORS
diff --git a/3rdparty/CGAL/CHANGES b/3rdparty/CGAL/CHANGES
new file mode 100644
index 0000000..9392f15
--- /dev/null
+++ b/3rdparty/CGAL/CHANGES
@@ -0,0 +1,4557 @@
+
+-------------------------------- Release 4.9 --------------------------------
+
+Release date: Sept 2016
+
+
+* Header-only mode
+
+  - CGAL can now be used in headers only mode, i.e. without compiling the CGAL
+    libraries and linking with these libraries when compiling examples, tests
+    and demos. Note that running CMake on CGAL is still required in order to
+    generate some configuration files.
+
+
+* Cone Based Spanners (new package)
+
+  - This package provides algorithms for constructing two kinds of cone-based
+    spanners: Yao graph and Theta graph, given a set of vertices on the plane
+    and the directions of cone boundaries.
+
+
+* 2D Minkowski Sums
+
+  - Introduce a convex decomposition strategy, namely
+    Polygon_nop_decomposition_2, that merely passed the input polygon to the
+    list of output polygons.
+
+  - Introduce overloads of the function minkowski_sum_2(), which accepts 2
+    decomposition strategies.
+
+  - Introduce an overloaded function called minkowski_sum_by_decomposition_2(P,
+    Q, decom_no_holes, decomp_with_holes), which computes the 2D Minkowski sum
+    using optimal choices of decomposition strategies.
+
+
+* Combinatorial Maps
+
+  - Deprecate global functions (make_combinatorial_hexahedron(),
+    make_combinatorial_polygon(), make_combinatorial_tetrahedron(), make_edge
+    (), insert_cell_0_in_cell_1(), insert_cell_0_in_cell_2(),
+    insert_cell_1_in_cell_2(), insert_cell_2_in_cell_3(),
+    insert_dangling_cell_1_in_cell_2(), is_insertable_cell_1_in_cell_2(),
+    is_insertable_cell_2_in_cell_3(), is_removable(), remove_cell()) which are
+    now member functions in the CombinatorialMap concept.
+
+  - It is not longer possible to use the old API switched on by defining the
+    macro CGAL_CMAP_DEPRECATED. This API was deprecated since CGAL 4.4.
+
+
+* Point Set Processing
+
+  - New function CGAL::read_ply_custom_points() that allows the user to read
+    any additional point attribute from a PLY input point set.
+
+
+* Point Set Shape Detection
+
+  - New post-processing algorithm: CGAL::regularize_planes(). This allows the
+    user to favor parallelism, orthogonality, coplanarity and/or axial symmetry
+    between detected planes.
+
+
+* Polygon Mesh Processing
+
+  - Add the function CGAL::Polygon_mesh_processing::
+    is_polygon_soup_a_polygon_mesh() to check whether a polygon soup is a
+    polygon mesh.
+
+  - Add some new features to CGAL::isotropic_remeshing():
+
+      - It is now possible to select fixed vertices that survive the remeshing
+        process, and to keep face attributes such as colors valid after
+        remeshing.
+
+      - The user can choose the number of relaxation steps happening at each
+        loop, and to run 1-dimensional relaxation along constrained polylines.
+
+
+  - The functions CGAL::Polygon_mesh_processing::triangulate_face() and CGAL::
+    Polygon_mesh_processing::triangulate_faces() now indicate whether some
+    faces have not been triangulated.
+
+
+* Surface Mesh Deformation
+
+  - Add a new tag SRE_ARAP to use the Smoothed Rotation Enhanced As-Rigid-As-
+    Possible deformation algorithm.
+
+
+* 3D Fast Intersection and Distance Computation
+
+  - Add the functions AABB_tree::first_intersection() and AABB_tree::
+    first_intersected_primitive() that compute the intersection which is
+    closest to the source of a ray
+
+
+* CGAL and the Boost Graph Library (BGL)
+
+  - Add a helper function CGAL::copy_face_graph() to copy a source
+    FaceListGraph into another FaceListGraph of different type.
+
+  - Add a class CGAL::Dual that creates the dual view of a FaceGraph and a
+    creation function CGAL::dual(primal).
+
+
+ ** CGAL and Boost Property Maps
+
+  - It is not longer possible to use the old API of the property maps provided
+    by CGAL, switched on by defining the macro CGAL_USE_PROPERTY_MAPS_API_V1.
+    This API was deprecated since CGAL 4.3.
+
+
+-------------------------------- Release 4.8 --------------------------------
+
+Release date: April 2016
+
+
+* General
+
+  - The support for Qt3 is dropped and all demos using it got removed.
+
+
+* Installation
+
+  - Starting with Visual C++ 2015 we no longer require Boost.Thread as we use
+    the C++11 keyword thread_local and the C+11 class std::mutex .
+
+  - The same holds for g++ 4.8 or later when the C++11 standard is used.
+
+
+* Optimal Transportation Curve Reconstruction (new package)
+
+  - This package implements a method to reconstruct and simplify 2D point sets.
+    The input is a set of 2D points with mass attributes, possibly hampered by
+    noise and outliers. The output is a set of line segments and isolated
+    points which approximate the input points.
+
+
+* 2D Regularized Boolean Set-Operations
+
+  - Improve the performance of operations in some settings.
+    Breaking change: This improvement requires changes of the face and halfedge
+    type of the underlying arrangement Dcel. See the concepts
+    GeneralPolygonSetDcelHalfedge and GeneralPolygonSetDcelFace for more
+    details. If you use a different simplex types, inheriting your simplices
+    from CGAL::Gps_face_base and CGAL::Gps_halfedge_base is sufficient to
+    accommodate for the update.
+
+
+* 3D Boolean Operations on Nef Polyhedra
+
+  - Add 3 new constructors: from a point range, from a point, and from a
+    segment.
+
+
+* Combinatorial Maps
+
+  - Breaking change: Change the type of Boolean marks, old type is int, new
+    type is size_type. If no more mark is available, get_new_mark throws an
+    exception, instead of returning -1.
+
+
+* 2D Arrangements
+
+  - Speed up the edge removal in case the incident faces contains many holes.
+
+  - Set the format of polylines and polycurves. The format of a general
+    polyline or polycurve consists of the sequence of subcurves that comprise
+    the original curve. The format of a polyline of linear segments consists of
+    the sequence of points that define the original curve. (The latter restores
+    the format used before polycurves were introduced in 4.7.) Fix the
+    extraction from istream and insertion into ostream operators of polylines
+    and polycurves accordingly.
+
+  - Fix the traits class that handles Bezier curves. In particular, fix the
+    case where the curve is closed (i.e, the first and last control points
+    coincide).
+
+
+* 3D Mesh Generation
+
+  - Add support of 3D gray level images as input for the tetrahedral mesh
+    generation.
+
+  - Breaking change: All models of the concept MeshDomain_3 must now provide a
+    member function bbox().
+
+
+* Advancing Front Surface Reconstruction
+
+  - Optional template functor Filter is replaced by another optional template
+    functor Priority. This allows to change the way facets are prioritized by
+    the algorithm instead of having a simple option to reject some facets.
+    Breaking change: Programs using the old Filter API will not compile anymore
+    as it must be replaced with the Priority API as described in the manual.
+    Codes using the default behavior are not impacted.
+
+
+* Polygon Mesh Processing
+
+  - Add a new triangle-based isotropic remeshing algorithm for triangulated
+    surface meshes, CGAL::Polygon_mesh_processing::isotropic_remeshing() and a
+    helper function for isotropic remeshing : CGAL::Polygon_mesh_processing::
+    split_long_edges()
+
+  - Add the function CGAL::Polygon_mesh_processing::border_halfedges() to
+    collect the border of a given face range
+
+  - Add the function CGAL::Polygon_mesh_processing::remove_isolated_vertices()
+    to be used on any polygon mesh
+
+  - Add the function CGAL::Polygon_mesh_processing::triangulate_face() to
+    triangulate a single face of a polygon mesh
+
+  - Add an overload for CGAL::Polygon_mesh_processing::triangulate_faces() to
+    triangulate a range of faces of a polygon mesh
+
+  - Add function keep_large_connected_components()
+
+  - Add measuring functions for polygon meshes, to compute length, area, and
+    volume of simplices or group of simplices of a polygon mesh.
+
+  - Add function bbox_3() to compute the bounding box of a polygon mesh.
+
+
+* Surface Mesh Parameterization
+
+  - LSCM_parameterizer_3 now uses by default Eigen instead of OpenNL as a model
+    of SparseLinearAlgebraTraits_d.
+
+
+* Point Set Processing
+
+  - Breaking change: new template parameter Concurrency_tag for the functions
+    compute_average_spacing(), edge_aware_upsample_point_set(),
+    jet_estimate_normals(), jet_smooth_point_set(), and pca_estimate_normals().
+    To update your code simply add as first template parameter CGAL::
+    Sequential_tag or CGAL::Parallel_tag when calling one of these functions.
+
+  - CGAL::Parallel_tag can no longer be used in Point Set Processing algorithms
+    if TBB is not available.
+
+  - Add a new simplification algorithm based on hierarchical clustering: CGAL::
+    hierarchy_simplify_point_set(). It allows either to uniformly simplify the
+    point set or to automatically adapt the local density of points to the
+    local variation of the input computed by principal component analysis.
+
+  - New IO functions for PLY format (Polygon File Format): CGAL::
+    read_ply_points(), CGAL::read_ply_points_and_normals(), CGAL::
+    write_ply_points() and CGAL::write_ply_points_and_normals().
+
+
+* Surface Mesh Parameterization
+
+  - LSCM_parameterizer_3 now uses by default Eigen instead of OpenNL as a model
+    of SparseLinearAlgebraTraits_d.
+
+
+* Spatial Searching
+
+  - Add function to find any point in a range query, that is neither all
+    points, nor the closest one.
+
+
+* Principal Component Analysis
+
+  - Add a template parameter DiagonalizeTraits for functions CGAL::
+    linear_least_squares_fitting_2() and CGAL::linear_least_squares_fitting_3
+    (). This allows to either choose the legacy internal diagonalization code
+    from CGAL or the Eigen implementation (or any class that is a model of
+    DiagonalizeTraits). Variants of the function that automatically deduce the
+    kernel also automatically select the diagonalizer, so the API is mostly
+    preserved.
+
+
+* CGAL and Solvers
+
+  - This package now includes all CGAL concepts for solvers with models using
+    the third party Eigen library.
+
+
+* CGAL and the Boost Graph Library (BGL)
+
+  - Add function CGAL::split_graph_into_polylines() that allows to extract from
+    a soup of segments given as a graph, polylines with nodes of degree at most
+    2. In addition a functor can be passed to the function to specify
+    additional polyline endpoints.
+
+  - New functions to manipulate selection of faces, edges and vertices in a
+    halfedge graph are added: CGAL::expand_face_selection(), CGAL::
+    reduce_face_selection(), CGAL::expand_edge_selection(), CGAL::
+    reduce_edge_selection() CGAL::expand_vertex_selection(), CGAL::
+    reduce_vertex_selection() and CGAL::select_incident_faces().
+
+  - Add a helper function CGAL::clear which clears a MutableFaceGraph
+    efficiently and generically.
+
+
+-------------------------------- Release 4.7 --------------------------------
+
+Release date: October 2015
+
+
+* Installation
+
+  - The minimum required version of CMake is now 2.8.11. CMake versions 3.1,
+    3.2, and 3.3 are supported.
+
+  - All Qt4 demos have been updated and now require Qt5 to be compiled. Qt5
+    version 5.3 or higher is required. The support for Qt4 is dropped. To
+    compile libCGAL_Qt5 and demos, you must set the cmake or environment
+    variable Qt5_DIR to point to the path to the directory containing the file
+    Qt5Config.cmake created by your Qt5 installation. If you are using the open
+    source edition it should be /path-to/qt-everywhere-opensource-src-
+    <version>/qtbase/lib/cmake/Qt5.
+
+  - The code of the 3D demos now uses modern OpenGL, with shaders, instead of
+    the fixed pipeline API of OpenGL-1.
+
+  - The Microsoft Windows Visual C++ compiler 2015 (VC14) is now supported.
+    However, since this compiler is not officially supported by Intel TBB 4.4
+    and Qt 5.5 (the latest versions available at the time of this release), the
+    parallelism features of CGAL and Qt5 demos will not work.
+
+
+* L Infinity Segment Delaunay Graphs (new package)
+
+  - The package provides the geometric traits for constructing the segment
+    Delaunay graph in the max-norm (L Infinity). The traits also contain
+    methods to draw the edges of the dual of the segment Delaunay graph in the
+    max-norm i.e., the segment Voronoi diagram in the max-norm. The algorithm
+    and traits rely on the segment Delaunay graph algorithm and traits under
+    the Euclidean distance. The segment Voronoi diagram in the max-norm has
+    applications in VLSI CAD.
+
+
+* Advancing Front Surface Reconstruction (new package)
+
+  - This package provides a greedy algorithm for surface reconstruction from an
+    unorganized point set. Starting from a seed facet, a piecewise linear
+    surface is grown by adding Delaunay triangles one by one. The most
+    plausible triangles are added first, in a way that avoids the appearance of
+    topological singularities.
+
+
+* Triangulated Surface Mesh Shortest Paths (new package)
+
+  - The package provides methods for computing shortest path on triangulated
+    surface meshes. Given a set of source points on the surface, this package
+    provides a data structure that can efficiently provides the shortest path
+    from any point on the surface to the sources points. There is no
+    restriction on the genus or the number of connected components of the mesh.
+
+
+* Triangulated Surface Mesh Skeletonization (new package)
+
+  - This package provides a (1D) curve skeleton extraction algorithm for a
+    triangulated polygonal mesh without borders based on the mean curvature
+    flow. The particularity of this skeleton is that it captures the topology
+    of the input. For each skeleton vertex one can obtain its location and its
+    corresponding vertices from the input mesh. The code is generic and works
+    with any model of the `FaceListGraph` concept.
+
+
+* 3D Point-Set Shape Detection (new package)
+
+  - This package implements the efficient RANSAC method for shape detection,
+    contributed by Schnabel et al. From an unstructured point set with
+    unoriented normals, the algorithm detects a set of shapes. Five types of
+    primitive shapes are provided by this package: plane, sphere, cylinder,
+    cone and torus. Detecting other types of shapes is possible by implementing
+    a class derived from a base shape.
+
+
+* 2D Visibility (new package)
+
+  - This package provides several variants to compute the visibility area of a
+    point within polygonal regions in two dimensions.
+
+
+* Polygon Mesh Processing (new package)
+
+  - This package implements a collection of methods and classes for polygon
+    mesh processing, ranging from basic operations on simplices, to complex
+    geometry processing algorithms. The implementation of this package mainly
+    follows algorithms and references given in Botsch et al.'s book on polygon
+    mesh processing.
+
+
+* General
+
+  - Support for unordered sets and maps of the stdlib and of boost for handle
+    and index classes.
+
+
+
+
+* Approximation of Ridges and Umbilics on Triangulated Surface Meshes
+
+  - This package now supports any model of the concept FaceGraph.
+
+  - Breaking change: The package no longer supports models of
+    TriangulatedSurfaceMesh which are not at the same time models of the
+    concept FaceGraph.
+
+
+* dD Geometry Kernel
+
+  - Epick_d gains 3 new functors: Construct_circumcenter_d,
+    Compute_squared_radius_d, Side_of_bounded_sphere_d. Those are essential for
+    the computation of alpha-shapes.
+
+
+* 2D Arrangements
+
+  - Introduced a new traits class, called
+    Arr_polycurve_traits_2<SubcurveTraits>, which handles general piece-wise
+    (polycurve) curves. The pieces do not necessarily have to be linear.
+
+  - Introduced two new concepts called ArrangementApproximateTraits_2 and
+    ArrangementConstructXMonotoneCurveTraits_2.
+
+      - The existing ArrangementLandmarkTraits_2 concept, which has two
+        requirements, now refines the two respective concepts above.
+
+      - The template parameter of the existing
+        Arr_polyline_traits_2<SegmentTraits> template must be substituted with
+        a traits class that is a model of the
+        ArrangementConstructXMonotoneTraits_2 concept among the other when
+        Arr_polyline_traits_2 is instantiated.
+
+
+
+* 2D Minkowski Sums
+
+  - Added support for polygons with holes and optimized the construction of
+    Minkowski sums.
+
+      - Introduced an implementation of the "reduced convolution" method, a
+        variant of the method described in "2D Minkowski Sum of Polygons Using
+        Reduced Convolution" by Behar and Lien. The new method supports
+        polygons with holes and in many cases out pergorms the implementation
+        of the exsisting (full) convolution method.
+
+      - Introduced two new classes that decompose polygons into convex pieces
+        (models of the PolygonConvexDecomposition_2 concept) based on vertical
+        decomposition and constrained Delaunay triangulation, respectively.
+        These new models also support the convex decomposition of polygons with
+        holes.
+
+
+
+* 3D Periodic Triangulations
+
+  - Rename Periodic_3_triangulation_traits_3 to
+    Periodic_3_Delaunay_triangulation_traits_3.
+
+  - Rename the concept Periodic_3TriangulationTraits_3 to
+    Periodic_3DelaunayTriangulationTraits_3.
+
+  - Create Periodic_3_triangulation_traits_3 and the concept
+    Periodic_3TriangulationTraits_3.
+
+
+* 2D Conforming Triangulations and Meshes
+
+  - Add an optimization method CGAL::lloyd_optimize_mesh_2() that implements
+    the Lloyd (or Centroidal Voronoi Tesselation) optimization algorithm in a
+    Constrained Delaunay Triangulation. For optimization, the triangulation
+    data structure on which the mesher relies needs its VertexBase template
+    parameter to be a model of the new concept DelaunayMeshVertexBase_2.
+
+
+* Point Set Processing and Surface Reconstruction from Point Sets
+
+  - Add the function CGAL::compute_vcm() for computing the Voronoi Covariance
+    Measure (VCM) of a point set. The output of this function can be used with
+    the function CGAL::vcm_is_on_feature_edge() to determine whether a point is
+    on or close to a feature edge. The former function is also internally used
+    by CGAL::vcm_estimate_normals() to estimate the normals of a point set and
+    it is particularly suited to point sets with noise.
+
+
+* Spatial Sorting
+
+  - Add the possibility to sort points on a sphere along a space-filling curve
+    using the functions CGAL::hilbert_sort_on_sphere and CGAL::
+    spatial_sort_on_sphere.
+
+
+* Geometric Object Generators
+
+  - Add new random generator of points in a 2D and 3D triangle and in a
+    tetrahedron (CGAL::Random_points_in_triangle_2, CGAL::
+    Random_points_in_triangle_3, CGAL::Random_points_in_tetrahedron_3).
+
+
+-------------------------------- Release 4.6.2 --------------------------------
+
+Release date: August 2015
+
+This release only fixes bugs. See the list of fixed bugs on Github:
+
+https://github.com/CGAL/cgal/issues?q=milestone%3A4.6.2
+
+
+-------------------------------- Release 4.6.1 --------------------------------
+
+Release date: June 2015
+
+This release only fixes bugs. See the list of fixed bugs on Github:
+
+https://github.com/CGAL/cgal/issues?q=milestone%3A4.6.1+-label%3Ainvalid
+
+
+-------------------------------- Release 4.6 --------------------------------
+
+Release date: April 2015
+
+
+* Installation
+
+  - The required version of Boost is now 1.48 or higher.
+
+
+* 2D Polyline Simplification (new package)
+
+  - This package enables to simplify polylines with the guarantee that the
+    topology of the polylines does not change. This can be done for a single
+    polyline as well as for a set of polyline constraints in a constrained
+    triangulation. The simplification can be controlled with cost and stop
+    functions.
+
+
+* 2D Generalized Barycentric Coordinates (new package)
+
+  - This package offers an efficient and robust implementation of two-
+    dimensional closed-form generalized barycentric coordinates defined for
+    simple two-dimensional polygons.
+
+
+* Scale-Space Surface Reconstruction (new package)
+
+  - This new package provides a class gathering a dedicated smoothing algorithm
+    and some convenience functions to help the creation of a surface out of a
+    point set using the 3D Alpha Shapes package. The particularity of this
+    reconstruction pipeline is that the input point are in the output and no
+    new points are created. Note that in the current version, the output is a
+    triangle soup that is not necessarily a valid (manifold) polyhedral
+    surface.
+
+
+* Surface Mesh (new package)
+
+  - The surface mesh class provided by this package is an implementation of the
+    halfedge data structure allowing to represent polyhedral surfaces. It is an
+    alternative to the packages CGAL::Polyhedron_3 and CGAL::HalfedgeDS.
+
+
+* dD Triangulation (new package)
+
+  - This new package provides classes for manipulating triangulations in
+    Euclidean spaces whose dimension can be specified at compile-time or at
+    run-time. It also provides a class that represents Delaunay triangulations.
+
+
+* dD Convex Hulls and Delaunay Triangulations
+
+  - This package is deprecated and the new package Triangulation should be used
+    instead.
+
+
+
+
+* dD Geometry Kernel
+
+  - It has been reported that the recently introduced Epick_d kernel may not
+    work with Intel C++ Compiler prior to version 15. Documentation has been
+    updated.
+
+
+* 3D Convex Hulls
+
+  - Add functions halfspace_intersection_3 and
+    halfspace_intersection_with_constructions_3 to compute the intersection of
+    halfspaces defining a closed polyhedron.
+
+  - Fix a bug introduced in CGAL 4.5 that can appear while computing the convex
+    hull of coplanar points.
+
+  - Fix a robustness issue in Convex_hull_traits_3. This traits is used by
+    default with the kernel Exact_predicates_inexact_constructions_kernel.
+
+  - The function CGAL::convex_hull_incremental_3 is deprecated and the function
+    convex_hull_3 should be used instead.
+
+
+
+
+* Combinatorial Maps and Linear Cell Complex
+
+  - Added correct_invalid_attributes, set_automatic_attributes_management and
+    are_attributes_automatically_managed methods in CombinatorialMap concept.
+    This allows high level operations to not update non void attributes during
+    massive calls of these operations, but only after the end of their
+    executions.
+
+
+
+
+* 2D Triangulations
+
+  - The class Constrained_triangulation_plus_2 now can handle polylines as
+    constraints.
+
+  - As a consequence a Constraint_id has been introduced which replaces
+    pair<Vertex_handle,Vertex_handle> as identifier of a constraint.
+
+
+
+
+* 3D Mesh Generation
+
+  - Add member functions output_boundary_to_off and
+    output_facets_in_complex_to_off in the class CGAL::
+    Mesh_complex_3_in_triangulation_3 to export the boundary of a domain or a
+    subdomain.
+
+
+
+
+* 3D Fast Intersection and Distance Computation
+
+  - Add new constructors to AABB_halfedge_graph_segment_primitive and
+    AABB_face_graph_triangle_primitive in order to be able to build primitives
+    one by one.
+
+
+* Spatial Searching
+
+  - Fixed a bug in CGAL::Splitters.h sliding midpoint rule, where degenerated
+    point sets (e.g.,points on segment) caused the kd-tree to get linear.
+
+  - Improved performance of Orthogonal_k_neighbor_search. Note that VC 2013
+    does not compile boost::container::deque of Boost 1_55 and does hence have
+    a workaround which does not have the improvement.
+
+  - Breaking change: The concept OrthogonalDistance has new function overloads
+    for min_distance_to_rectangle and max_distance_to_rectangle with an
+    additional reference parameter std::vector.
+
+  - Breaking change: The order of the points in the iterator range [tree.begin
+    (),tree.end()] is not the order of insertion of the points into the tree.
+    This was not guaranteed before but might have been observed and exploited
+    by users.
+
+  - Derived kd_tree_leaf_node and kd_tree_internal_node from kd_tree_node to
+    save memory.
+
+
+
+
+* Geometric Object Generators
+
+  - Add a new function random_convex_hull_in_disc_2 that efficiently generates
+    a random polygon as the convex hull of uniform random points chosen in a
+    disc.
+
+
+-------------------------------- Release 4.5.2 --------------------------------
+
+Release date: February 2015
+
+
+* General
+
+  - Fix a bug that prevented the compilation with recent versions of Boost
+    (>=1.56) when explicit conversions operators (from C++11) are supported.
+    That prevented the compilation with Microsoft Visual Studio 2013.
+
+
+* 3D Convex Hulls
+
+  - Fix a non-robust predicate bug that was showing up when input points where
+    lexicographically sorted.
+
+
+* 3D Mesh Generation
+
+  - Fix a bug in the sliver perturbation optimization method. It could create
+    some holes on the surface of the mesh.
+
+
+-------------------------------- Release 4.5.1 --------------------------------
+
+Release date: December 2014
+
+
+* 3D Mesh Generation
+
+  - Fix a bug in the sliver exudation preservation of boundaries.
+
+
+-------------------------------- Release 4.5 --------------------------------
+
+Release date: October 2014
+
+
+* Installation
+
+  - Changes in the set of supported platforms:
+
+      - The Microsoft Windows Visual C++ compiler 2008 (VC9) is no longer
+        supported since CGAL-4.5.
+
+
+  - Since CGAL version 4.0, Eigen was the recommended third-party library to
+    use with Planar Parameterization of Triangulated Surface Meshes, Surface
+    Reconstruction from Point Sets, Approximation of Ridges and Umbilics on
+    Triangulated Surface Meshes, and Estimation of Local Differential
+    Properties of Point-Sampled Surfaces packages. From CGAL version 4.5,
+    Taucs, Blas and Lapack are no longer supported.
+
+  - CGAL is now compatible with the new CMake version 3.0.
+
+
+* Triangulated Surface Mesh Deformation (new package)
+
+  - This package allows to deform a triangulated surface mesh under positional
+    constraints of some of its vertices without requiring any additional
+    structure other than the surface mesh itself. The methods provided
+    implements an as-rigid-as-possible deformation. Note that the main class
+    name has changed between the 4.5-beta1 and the 4.5 releases to better match
+    the CGAL naming conventions (from CGAL::Deform_mesh to CGAL::
+    Surface_mesh_deformation).
+
+
+* CGAL and the Boost Graph Library (major changes)
+
+  - Cleanup of the HalfedgeGraph concept. In particular:
+
+      - Introduction of the notion of halfedge_descriptor in the specialization
+        of the class boost::graph_traits.
+
+      - Deprecation of halfedge_graph_traits.
+
+      - A model of HalfedgeGraph is considered as an undirected graph. Thus any
+        call to edges() should be replaced by halfedges() and num_edges() now
+        returns the number of (undirected) edges.
+
+      - Breaking change: is_border_edge and is_border_halfedge properties are
+        removed. The free functions is_border() and is_border_edge() should be
+        used instead.
+
+      - Renaming of HalfedgeGraph specific free functions.
+
+
+  - Introduction of the FaceGraph concept.
+
+  - Adaptation of the package Triangulated Surface Mesh Simplification and of
+    the class AABB_halfedge_graph_segment_primitive from the package 3D Fast
+    Intersection and Distance Computation to the API change.
+
+  - Update of the package Triangulated Surface Mesh Segmentation and of the
+    class AABB_face_graph_triangle_primitive from the package 3D Fast
+    Intersection and Distance Computation to accept model of the newly
+    introduced concepts.
+
+  - Offer Euler operations as free functions for models of the graph concepts
+    provided by CGAL.
+
+  - Specialization of boost::graph_traits for OpenMesh::PolyMesh_ArrayKernelT
+    as proof of concept. A OpenMesh::PolyMesh_ArrayKernelT becomes a model of
+    the aforementioned concepts when including CGAL/boost/graph/
+    graph_traits_PolyMesh_ArrayKernelT.h.
+
+
+* dD Geometry Kernel
+
+  - A new model Epick_d of the Kernel_d concept is introduced. It provides
+    better performance through arithmetic filtering and specializations for
+    fixed dimensions. It may not work with compilers as old as gcc-4.2, but was
+    tested with gcc-4.4.
+
+
+* 3D Convex Hulls
+
+  - Clean up the documentation of the concepts
+
+
+* 2D Arrangements
+
+  - Fixed a bug in removing an unbounded curve (e.g., a ray) from an
+    arrangement induced by unbounded curves.
+
+
+* 2D Snap Rounding
+
+  - Replaced use of private kd_tree with CGAL's official Kd_tree from
+    Spatial_searching package; results in a small performance gain. Removed the
+    private kd_tree package.
+
+
+* 3D Triangulations
+
+  - Add an experimental parallel version of the Delaunay triangulation and the
+    regular triangulation algorithms, which allows parallel insertion and
+    removal of point ranges.
+
+  - Add caching of circumcenters to Regular_triangulation_cell_base_3. The
+    cache value is computed when cell->circumcenter() or rt.dual(cell)
+    functions are called.
+
+
+* 3D Periodic Triangulations
+
+  - Add a method to locate point with inexact predicates.
+
+
+* 3D Mesh Generation
+
+  - Add a new constructor for the class Labeled_mesh_domain_3 which takes an
+    Iso_cuboid_3.
+
+  - Add a new labeling function wrapper for meshing multi-domain.
+
+  - The meshing functionality in the Qt demos in demo/Polyhedron/ and demo/
+    Mesh_3/ can now use the handling of 1d-features, that exists in CGAL since
+    version 3.8.
+
+  - Add an experimental parallel version of the 3D mesh refinement and mesh
+    optimization methods.
+
+
+* Point Set Processing and Surface Reconstruction from Point Sets
+
+  - The former demo has been removed and is fully merge in the Polyhedron demo.
+
+
+* Point Set Processing
+
+  - Workaround a bug in dijsktra shortest path of boost 1.54 by shipping and
+    using the boost header from the 1.55 release. This header will be used only
+    if you are using the version 1.54 of boost.
+
+
+* Triangulated Surface Mesh Simplification
+
+  - Breaking change: Due to the cleanup of the concepts of the package CGAL and
+    the Boost Graph Library, the named parameter edge_is_border_map has been
+    removed, and the named parameter edge_is_constrained_map now expects a
+    property map with an edge descriptor as key type (vs. halfedge descriptor
+    before).
+
+  - Add some optimization in the code making the implementation faster
+    (depending on the cost and the placement chosen). However, for an edge
+    which collapse is not topologically valid, the vector of vertices of the
+    link provided by its profile might contains duplicates, thus also breaking
+    the orientation guarantee in the vector. This must not be a problem for
+    users as the edge is not collapsible anyway but if it is a absolute
+    requirement for user defined cost/placement, defining the macro
+    CGAL_SMS_EDGE_PROFILE_ALWAYS_NEED_UNIQUE_VERTEX_IN_LINK will restore the
+    former behavior.
+
+
+* dD Spatial Searching
+
+  - Added methods reserve(size_t size) and size_t capacity() to class Kd_tree
+    to allocate memory to store size points and to report that number (STL
+    compliance).
+
+
+* STL Extensions for CGAL
+
+  - Add Compact_container::operator[], allowing a direct access to the ith
+    element of a compact container.
+
+  - Add Concurrent_compact_container, a compact container which allows
+    concurrent insertion and removal.
+
+
+-------------------------------- Release 4.4 --------------------------------
+
+Release date: April 2014
+
+
+* Installation
+
+  - Additional supported platforms:
+
+      - The Apple Clang compiler version 5.0 is now supported on
+        OS X Mavericks.
+
+      - The Microsoft Windows Visual C++ compiler 2013 (VC12) is now supported.
+
+
+
+* Triangulated Surface Mesh Segmentation (new package)
+
+  - This package implements the segmentation of triangulated surface meshes
+    based on the Shape Diameter Function (SDF). In addition, it also provides
+    functions to generate segmentations based on a user defined alternative to
+    the SDF.
+
+
+* Number Types
+
+  - A new class CGAL::Mpzf is introduced on some platforms for exact ring
+    operations. It is used to improve the speed of the evaluation of predicates
+    in degenerate situations.
+
+
+* 2D and 3D Geometry Kernel
+
+  - Fix a bug introduced in CGAL 4.3 when computing the intersection of two 3D
+    triangles.
+
+
+* 2D Polygon Partitioning
+
+  - Bug fix to make the partition algorithms working with a Lazy kernel such as
+    Exact_predicates_exact_constructions_kernel.
+
+
+* 2D Regularized Boolean Set-Operations
+
+  - Fix two memory leaks in CGAL::General_polygon_set_2.
+
+
+* Combinatorial Maps and Linear Cell Complex
+
+  - null_dart_handle is no longer a static data member in the CombinatorialMap
+    concept. This implies to move the following methods of Dart concept into
+    CombinatorialMap concept: is_free, highest_nonfree_dimension, opposite and
+    other_extremity. We also transform the static methods vertex_attribute and
+    point of Linear_cell_complex class into non static methods. You can define
+    the CGAL_CMAP_DEPRECATED macro to keep the old behavior.
+
+
+* 2D Arrangements
+
+  - Revise the API of polylines. In particular, construction is now done using
+    functors and iteration is possible only on the segments of a polyline.
+
+  - Fix a bug in the Landmark point-location strategy.
+
+
+* 2D Snap Rounding
+
+  - Fix a memory leak
+
+
+* 2D Triangulations
+
+  - Add different overloads of the function insert_constraints that inserts a
+    range of points and segments, or a range of segments. These functions uses
+    the spatial sorting in order to speed up the time needed for the insertion.
+
+
+* 3D Alpha Shapes
+
+  - Add member functions in CGAL::Alpha_shape_3 to give access to the alpha
+    status of edges and facets (get_alpha_status()).
+
+  - Add another filtration method (filtration_with_alpha_values()) that reports
+    the alpha value at which each face appears in the filtration.
+
+
+* 3D Mesh Generation
+
+  - Fix the access to functions number_of_facets and number_of_cells in
+    Mesh_complex_3_in_triangulation_3.
+
+  - Change the internal API of the sliver perturber, to make possible for
+    developers to optimize another criterion than the (default) minimal
+    dihedral angle. Developers can also define a new perturbation vector (for
+    angles we had gradient of squared circumradius, gradient of volume,
+    gradient of minimal dihedral angle, and random) which is better suitable to
+    optimize their criterion.
+
+  - Improve the use of cache values in Mesh_cell_base_3 to (re)compute
+    circumcenters and sliver criterion values only when needed.
+
+
+* Triangulated Surface Mesh Simplification
+
+  - Fix a bug in the way edges can be marked as non-removable by adding a
+    named-parameter edge_is_constrained_map to the function edge_collapse
+
+
+* dD Spatial Searching
+
+  - Fix a documentation bug: The property map passed as template parameter to
+    the classes Search_traits_adapter and Distance_adapter must be a lvalue
+    property map. To avoid incorrect usage, a static assertion has been added
+    in the CGAL code to prevent the user from instantiating these classes with
+    an incorrect property map type.
+
+
+* CGAL ipelets
+
+  - Better description of the demo ipelets in the user manual
+
+  - New ipelet for pencils of circles
+
+  - New ipelet for hyperbolic geometry in Poincaré model
+
+  - The generator ipelet now generates point in a selected zone
+
+  - Hilbert sort ipelet implements two policies
+
+
+-------------------------------- Release 4.3 --------------------------------
+
+Release date: October 2013
+
+
+* The CGAL Manual
+
+  - The documentation of CGAL is now generated with Doxygen.
+
+
+* 2D Periodic Triangulations (new package)
+
+  - This package allows to build and handle triangulations of point sets in the
+    two dimensional flat torus. Triangulations are built incrementally and can
+    be modified by insertion or removal of vertices. They offer point location
+    facilities. The package provides Delaunay triangulations and offers nearest
+    neighbor queries and primitives to build the dual Voronoi diagrams.
+
+
+* API Changes
+
+ ** 2D and 3D Geometry Kernel
+
+  - The intersection functions and functors used to return a CGAL::Object in
+    order to deal with the different possible return types. However, depending
+    on the arguments it is possible to reduce the possible return types to a
+    small set. For this reason and to take advantage of the type safety, we
+    decided to use boost::variant instead of CGAL::Object. The result_of
+    protocol is now even more useful to determine the return type of the
+    intersection functions and functors. The change should be relatively
+    transparent to the user thanks to the implicit constructor added to CGAL::
+    Object. However, it is recommended to upgrade your code. The previous
+    behavior can be restored by defining the macro CGAL_INTERSECTION_VERSION
+    to 1.
+
+
+ ** 2D Arrangements
+
+  - The type of the result of point location queries changed to boost::variant
+    (from CGAL::Object). For convenience, the previous behavior can be restored
+    by defining the macro CGAL_ARR_POINT_LOCATION_VERSION to 1.
+
+  - Introduced an optimization for operations on large and dense arrangements.
+
+
+ ** 3D Fast Intersection and Distance Computation
+
+  - Following the intersection API change, Object_and_primitive_id has been
+    replaced by a template class Intersection_and_primitive_id<Query> to
+    determine the type depending on the query object type.
+
+
+ ** CGAL and Boost Property Maps
+
+  - The key_type of the property maps provided by CGAL used to be an iterator.
+    In order to be more easily re-used, the key_type has been changed to be the
+    value_type of the iterator. The packages that have been updated to match
+    these changes are Point Set Processing and Surface Reconstruction from
+    Point Sets. However, for most users this change should be transparent if
+    the default property maps were used. For convenience, the former behavior
+    can be enabled by defining the macro CGAL_USE_PROPERTY_MAPS_API_V1.
+
+
+* Algebraic Foundations
+
+  - For convenience, add an overload of make_rational() taking a pair of
+    numbers.
+
+
+* 2D and 3D Geometry Kernel
+
+  - A Iso_rectangle_2 can now be constructed from a Bbox_2 and an Iso_cuboid_3
+    from a Bbox_3.
+
+  - The implementation of CGAL::Object has been updated and now uses boost::
+    shared_ptr and boost::any. This implementation is faster.
+
+  - Add to Bbox_2 and Bbox_3 a += operator as well as free functions to get the
+    bounding box of a range of geometric objects.
+
+
+* Combinatorial Maps
+
+  - Two bug fixes: do not use the 2 least significant bits for cell attribute
+    without dart support; share the mark when copying a CMap_cell_iterator.
+
+  - Add a constructor taking a given combinatorial map as argument, possibly
+    with different dimension and/or different attributes. This allows to
+    transform a combinatorial map.
+
+  - Add operator= and swap method.
+
+  - Add dynamic onmerge/onsplit functions that can be associated dynamically to
+    i-attributes and which are automatically called when i-cells are split/
+    merged.
+
+  - Add a function allowing to reverse the orientation of a combinatorial map,
+    and another one to reverse one connected component of a combinatorial map.
+
+
+* 3D Boolean Operations on Nef Polyhedra
+
+  - Bug-fix in IO when using Lazy_exact_nt as number type or
+    Exact_predicates_exact_constructions_kernel as kernel.
+
+
+* 2D Triangulations
+
+  - Extend the concept TriangulationDataStructure_2 to require a more general
+    copy_tds function that allows a copy between TDS of different types. The
+    CGAL model has been updated.
+
+  - Add a way to efficiently insert a range of points with information into the
+    2D constrained Delaunay triangulations.
+
+
+* 3D Triangulations
+
+  - Extend the concept TriangulationDataStructure_3 to require a more general
+    copy_tds function that allows a copy between TDS of different types. The
+    CGAL model has been updated.
+
+  - Add an advanced function to set the infinite vertex of the triangulation
+    for low level operations
+
+  - Fix a bug in the function inserting a range of points with info when the
+    Fast_location tag is used
+
+
+* 2D Segment Delaunay Graph
+
+  - Add functions insert_points and insert_segments to insert a range of points
+    and segments. These functions uses the spatial sorting in order to speed up
+    the time needed for the insertion. The function insert(Input_iterator
+    first, Input_iterator beyond, Tag_true) has been updated to dispatch the
+    input when possible to these functions.
+
+
+* 2D Apollonius Graphs
+
+  - Modified insertion algorithm so that the code can handle pseudo-circles as
+    well.
+
+  - Updated implementation of the vertex conflict predicate by a faster
+    version.
+
+
+* 3D Mesh Generation
+
+  - Speed-up Mesh_3 and in particular the global optimizers (Lloyd and ODT) by
+    introducing a parameter do_freeze to prevent from moving vertices which
+    would move of very small displacements.
+
+  - Introduce new data structures and options for speed-up and compacity. Note
+    that Compact_mesh_cell_base_3 and Mesh_vertex_base_3 are now our favoured
+    implementations of the concepts MeshCellBase_3 and MeshVertexBase_3.
+
+  - Introduce a new constructor for Polyhedral_mesh_domain_3 that takes a
+    bounding polyhedron to be meshed along with a polyhedral surface entirely
+    included in it. This allows the user to mesh a polyhedral domain with
+    internal surface(s) which can be non-watertight and even non-manifold.
+
+  - Several documentation bug fixes.
+
+  - Provide the ability to plug in custom cell_base/vertex_base classes into
+    the Mesh_triangulation_3 class.
+
+
+* Triangulated Surface Mesh Simplification
+
+  - Fix a segmentation fault that was happening when some edges of length 0
+    were in the input mesh.
+
+
+* 3D Fast Intersection and Distance Computation
+
+  - Following the intersection API change, Object_and_primitive_id has been
+    replaced by a template class Intersection_and_primitive_id<Query> to
+    determine the type depending on the query object type.
+
+  - Introduce the class AABB_halfedge_graph_segment_primitive, which replaces
+    the class AABB_polyhedron_segment_primitive (which is now deprecated). The
+    new class is more general and can be used with any model of HalfedgeGraph.
+
+  - Introduce the class AABB_face_graph_triangle_primitive which replaces the
+    class AABB_polyhedron_triangle_primitive (which is now deprecated).
+
+  - Document the classes AABB_segment_primitive and AABB_triangle_primitive
+    that were already used in some examples.
+
+  - Add a generic primitive class AABB_primitive that allows to define a
+    primitive type by defining only two property maps.
+
+  - Introduce a new concept of primitive AABBPrimitiveWithSharedData. It allows
+    to have some data shared between the primitives stored in a AABB_tree. With
+    this you can, for example have a primitive wrapping an integer which refers
+    to the position of a geometric object in a std::vector. Only one reference
+    to this vector will be stored in the traits of the tree. The concept
+    AABBTraits, its model AABB_traits and the class AABB_tree have been updated
+    accordingly. However, everything is backward compatible.
+
+  - Fix a memory leak in the destructor of the class AABB-tree
+
+
+* STL Extensions for CGAL
+
+  - Add to Dispatch_output_iterator and Dispatch_or_drop_output_iterator an
+    operator to accept and dispatch a tuple of values.
+
+
+* Concurrency in CGAL
+
+  - Add a FindTBB CMake module so that one can easily link with TBB to write
+    shared-memory parallel code.
+
+  - Introduce two new tags: Sequential_tag and Parallel_tag
+
+
+-------------------------------- Release 4.2 --------------------------------
+
+Release date: March 2013
+
+
+* Installation
+
+  - Additional supported platforms:
+
+      - The Microsoft Windows Visual C++ compiler 2012 (VC11) is now supported.
+
+
+  - With Microsoft Visual C++ (all supported versions), the compiler flags /
+    bigobj and /wd4503 are added by CGAL CMake scripts.
+
+  - This is the last release whose "UseCGAL.cmake" file (if using CGAL in a
+    CMake build environment) contains the line
+      link_libraries(${CGAL_LIBRARIES_DIR} ${CGAL_3RD_PARTY_LIBRARIES_DIRS})
+    as this is a deprecated CMake command. The correct way to link with CGAL's
+    libraries (as for required 3rd party libraries) is to use
+    'target_link_libraries' which specifies for each build target which
+    libraries should be linked. The following serves as example:
+      find_package(CGAL)
+      include(${CGAL_USE_FILE})
+      add_executable(myexe main.cpp)
+      target_link_libraries(myexe ${CGAL_LIBRARIES}
+                                  ${CGAL_3RD_PARTY_LIBRARIES})
+    We also expect further changes in CGAL's CMake setup (change of variable
+    names, consistency of filename and output, removing essential libraries,
+    building executables, removal of '${CGAL_3RD_PARTY_LIBRARIES}').
+
+
+* 2D Arrangements
+
+  - Enhanced the 2D-arrangements demonstration program and ported it to Qt4.
+    The new demonstration program makes use of the CGAL Graphics View
+    framework, in which the 2D primitives are individually represented as
+    objects in a scene. (The implementations of several demos in CGAL already
+    make use of this framework.) This project was carried out as part of the
+    2012 Google Summer of Code program.
+
+  - Fixed a bug in the Walk-Along-A-Line point location strategy for
+    arrangements induced by unbounded curves.
+
+
+* 2D Circular Geometry Kernel
+
+  - Fix the intersection type computed when intersecting two identical circles.
+
+  - Forward correctly the result type of the linear kernel functors
+
+
+* 2D Triangulations
+
+  - Add mechanism to avoid call stack overflow in Delaunay_triangulation_2 and
+    Constrained_Delaunay_triangulation_2.
+
+  - Add a constructor for Regular_triangulation_2 and Delaunay_triangulation_2
+    from a range of points or a range of points with info.
+
+
+* 2D Voronoi Diagram Adaptor
+
+  - Bug-fix: Add ccb() method in face type as documented.
+
+
+* 3D Minkowski Sum of Polyhedra
+
+  - Fix a memory leak.
+
+
+* 3D Fast Intersection and Distance Computation
+
+  - Update requirements of the concepts AABBTraits and AABBGeomTraits to match
+    the implementation of the package.
+
+
+* Generator
+
+  - Addition of the Combination_enumerator
+
+
+* STL Extensions
+
+  - Introduction of CGAL::cpp11::result_of as an alias to the tr1
+    implementation from boost of the result_of mechanism. When all compilers
+    supported by CGAL will have a Standard compliant implemention of the C++11
+    decltype feature, it will become an alias to std::result_of.
+
+
+* Surface Reconstruction from Point Sets
+
+  - Performance improvements and addition of an option to better reconstruct
+    undersampled zones. The poisson reconstruction plugin of the Polyhedron
+    demo has an option to switch it on.
+
+
+-------------------------------- Release 4.1 --------------------------------
+
+Release date: October 2012
+
+
+* Installation
+
+  - Additional supported platforms:
+
+      - The Apple Clang compiler versions 3.1 and 3.2 are now supported on
+        Mac OS X.
+
+
+  - Improved configuration for essential and optional external third party
+    software
+
+  - Added more general script to create CMakeLists.txt files:
+    cgal_create_CMakeLists
+
+  - Availability tests for C++11 features are now performed with the help of
+    Boost.Config. A Boost version of 1.40.0 or higher is needed to use C++11
+    features.
+
+
+* 2D Arrangement
+
+  - Improved the implementation of the incremental randomized trapezoidal
+    decomposition point-location strategy. The new implementation enables point
+    location in unbounded arrangements. It constructs a search structure of
+    guaranteed linear size with guaranteed logarithmic query time.
+
+
+* 2D Convex Hulls and Extreme Points
+
+  - Speed up the preprocessing stage of the Akl-Toussaint implementation (used
+    by the free function convex_hull_2 when forward iterators are provided as
+    input).
+
+
+* Combinatorial Maps
+
+  - Minor bugfix; replace some functors by methods.
+
+
+* Linear Cell Complex
+
+  - Improve the demo: add a widget showing all the volumes and an operation to
+    create a Menger sponge.
+
+
+* Kernels
+
+  - All Kernel functors now support the result_of protocol.
+
+
+* STL_Extensions for CGAL
+
+  - The namespace cpp0x has been renamed cpp11. The old name is still available
+    for backward compatibility.
+
+
+-------------------------------- Release 4.0.2 --------------------------------
+
+Release date: Jul 2012
+
+This is a bug fix release. It fixes a bug in the CMakeLists.txt for CGAL-4.0.1,
+that prevented even building the libraries.
+
+
+-------------------------------- Release 4.0.1 --------------------------------
+
+Release date: Jul 2012
+
+This is a bug fix release. Apart various minor fixes in the documentation, the
+following has been changed since CGAL-4.0:
+
+
+* 2D Voronoi Diagram Adaptor (re-added)
+
+  - The package 2D Voronoi Diagram Adaptor was temporarily removed from the
+    CGAL distribution because of license issues. That package is now back into
+    CGAL.
+
+
+* 2D and 3D Geometry Kernel
+
+  - Fix a bug in the Segment_3-Triangle_3 intersection function in the case the
+    segment is collinear with a triangle edge.
+
+  - Fix a bug in the Projection_traits_.._3 class in the case a segment was
+    parallel to the x-axis.
+
+
+* Algebraic Kernel
+
+  - Avoid the linking error "duplicate symbols" when two compilation units
+    using the algebraic kernel are linked.
+
+
+* 3D Boolean Operations on Nef Polygons Embedded on the Sphere
+
+  - Fix a memory leak due to the usage of an internal mechanism that has been
+    replaced by boost::any. This also influences the packages 2D Boolean
+    Operations on Nef Polygons, 3D Boolean Operations on Nef Polyhedra, Convex
+    Decomposition of Polyhedra, and 3D Minkowski Sum of Polyhedra.
+
+
+* 2D Arrangement
+
+  - Fix several memory leaks.
+
+
+* 2D Mesh Generation
+
+  - Fix a compilation error in the header <CGAL/Mesh_2/Do_not_refine_edges.h>
+    when g++ version 4.7 is used.
+
+
+* Surface Mesh Generation and 3D Mesh Generation
+
+  - Fix an important bug in the CGAL_ImageIO library, that could lead to wrong
+    result when meshing from a 3D image.
+
+  - Fix the compilation of the demo in demo/Surface_mesher, when Boost version
+    1.48 or 1.49 is used.
+
+
+* Surface Mesh Parameterization
+
+  - Fix a memory leak.
+
+  - Fix a compatibility issue with Eigen-3.1 of Eigen_solver_traits. This fix
+    also affects the usage of that class in the package Surface Reconstruction
+    from Point Sets.
+
+
+-------------------------------- Release 4.0 --------------------------------
+
+Release date: March 2012
+
+CGAL 4.0 offers the following improvements and new functionality :
+
+
+* License Changes
+The whole CGAL-3.x series was released under a combination of LGPLv2 (for the
+foundations of CGAL), and QPL (for the high-level packages). QPL was the former
+license of the graphical toolkit Qt, but that license is not supported by any
+major free software project. Furthermore, the terms of the LGPLv2 license are
+ambiguous for a library of C++ templates, like CGAL.
+
+The CGAL project, driven by the CGAL Editorial Board, has decided to change the
+license scheme of CGAL. We increased the major number of the CGAL version to
+'4' in order to reflect this license change. The CGAL-4.x series is released
+under:
+
+
+  - LGPLv3+ (that is LGPL "either version 3 of the License, or (at your option)
+    any later version"), for the foundations of CGAL, instead of LGPLv2,
+
+  - GPLv3+ for the high-level packages, instead of QPL.
+
+
+* General
+
+  - On Windows, CGAL libraries are now built by default as shared libraries
+    (also called DLL). To run applications that use .dll files of CGAL, you
+    must either copy the .dll files into the directory of the application, or
+    add the path of the directory that contains those .dll files into the PATH
+    environment variable.
+
+  - On Windows, the CMake scripts of CGAL now search for shared version of the
+    Boost libraries. You must ensure that the .dll files of Boost are found by
+    the dynamic linker. You can, for example, add the path to the Boost .dll
+    files to the PATH environment variable.
+
+  - On Windows, CMake version 2.8.6 or higher is now required.
+
+  - Eigen version 3.1 or later is now the recommended third party library to
+    use in Planar Parameterization of Triangulated Surface Meshes, Surface
+    Reconstruction from Point Sets, Approximation of Ridges and Umbilics on
+    Triangulated Surface Meshes, and Estimation of Local Differential
+    Properties of Point-Sampled Surfaces packages. If you use Eigen you no
+    longer need Taucs, Lapack or Blas to use those packages (and any other in
+    CGAL).
+
+
+* Linear Cell Complex (new package)
+
+  - This package implements linear cell complexes, objects in d-dimension with
+    linear geometry. The combinatorial part of objects is described by a
+    combinatorial map, representing all the cells of the object plus the
+    incidence and adjacency relations between cells. Geometry is added to
+    combinatorial maps simply by associating a point to each vertex of the map.
+    This data structure can be seen as the generalization in dD of the
+    Polyhedron_3.
+
+
+* 2D Voronoi Diagram Adaptor (temporarily removed)
+
+  - As the copyright holder of this package has not granted the right to switch
+    from QPL to GPL, this package is removed from the distribution. Note that
+    it is "only" an adapter, that is the functionality of point/segment/disk
+    Voronoi diagram is offered through the Delaunay triangulation, segment
+    Delaunay graph, and Apollonius graph.
+
+
+* AABB Tree
+
+  - Document constness of member functions of the AABB_tree class.
+
+  - The class AABB_tree is now guaranteed to be read-only thread-safe. As usual
+    in CGAL, this small overhead introduced for thread-safety can be
+    deactivated by defining CGAL_HAS_NO_THREADS.
+
+
+* 2D Alpha Shapes
+
+  - Add an extra template parameter to the class Alpha_shape_2 that allows a
+    certified construction using a traits class with exact predicates and
+    inexact constructions.
+
+  - An object of type Alpha_shape_2 can now be constructed from a
+    triangulation.
+
+
+* 3D Alpha Shapes
+
+  - Add an extra template parameter to the class Alpha_shape_3 that allows a
+    certified construction using a traits class with exact predicates and
+    inexact constructions.
+
+
+* Geometric Object Generators
+
+  - Random_points_in_iso_box_d (deprecated since 3.8) has been removed. Use
+    Random_points_in_cube_d instead.
+
+
+* Linear and Quadratic Programming Solver
+
+  - Minor bugfix.
+
+
+* Spatial Searching
+
+  - The const-correctness of this package have been worked out. The transition
+    for users should be smooth in general, however adding few const in user
+    code might be needed in some cases.
+
+  - The class Kd_tree is now guaranteed to be read-only thread-safe. As usual
+    in CGAL, this small overhead introduced for thread-safety can be
+    deactivated by defining CGAL_HAS_NO_THREADS.
+
+  - Bug-fix in Orthogonal_incremental_neighbor_search and
+    Incremental_neighbor_search classes. Several calls to begin() now allow to
+    make several nearest neighbor search queries independently.
+
+
+* STL Extension
+
+  - CGAL::copy_n is now deprecated for CGAL::cpp0x::copy_n which uses std::
+    copy_n, if available on the platform.
+
+  - CGAL::successor and CGAL::predecessor are now deprecated for CGAL::cpp0x::
+    next and CGAL::cpp0x::prev. These functions use the standard versions if
+    available on the platform. Otherwise, boost::next and boost::prior are
+    used.
+
+
+* Triangulation_2
+
+  - Fix a thread-safety issue in Delaunay_triangulation_2 remove functions. As
+    usual in CGAL, the small overhead introduced for thread-safety can be
+    deactivated by defining CGAL_HAS_NO_THREADS.
+
+  - Add extraction operator for the class Constrained_triangulation_2 (and thus
+    to all inheriting classes).
+
+
+-------------------------------- Release 3.9 --------------------------------
+
+Release date: September 2011
+
+CGAL 3.9 offers the following improvements and new functionality :
+
+
+* General
+
+  - The class Root_of_2 is now deprecated. It is recommended to use the class
+    Sqrt_extension instead.
+
+  - The class Sqrt_extension is now used everywhere in CGAL where an algebraic
+    number of degree 2 is needed. This change has been done in the
+    Root_of_traits mechanism (indirectly packages 2D Circular kernel and 3D
+    Spherical kernel) and the packages 2D Segment Delaunay Graphs and 2D
+    Arrangements.
+
+  - Various fixes in the manual.
+
+
+* Combinatorial Maps (new package)
+
+  - This package provides a new combinatorial data structure allowing to
+    describe any orientable subdivided object whatever its dimension. It
+    describes all cells of the subdivision and all the incidence and adjacency
+    relations between these cells. For example it allows to describe a 3D
+    object subdivided in vertices, edges, faces and volumes. This data
+    structure can be seen as the generalization in dD of the halfedge data
+    structure.
+
+
+* 3D Convex Hull (major performance improvement)
+
+  - The quickhull implementation of CGAL (CGAL::convex_hull_3) has been worked
+    out to provide very better performances.
+
+  - The function CGAL::convex_hull_3 no longer computes the plane equations of
+    the facets of the output polyhedron. However an example is provided to show
+    how to compute them easily.
+
+  - A global function convex_hull_3_to_polyhedron_3 is now provided to extract
+    the convex hull of a 3D points set from a triangulation of these points.
+
+
+* dD Spatial Searching (major new feature added)
+
+  - A traits-class and distance adapter that together with a point property
+    map, allow to make nearest neighbor queries on keys instead of points have
+    been added.
+
+  - Few bug fixes in the documentation have revealed some inconsistencies that
+    have been corrected. Two traits class concept are now documented
+    (RangeSearchTraits and SearchTraits). Most other changes concerns only
+    classes documented as advanced. One issue that user can encounter is due to
+    an additional requirement on the nested class
+    Construct_cartesian_const_iterator_d defined in the concept SearchTraits
+    that must provide a nested type result_type.
+
+
+* Spatial Sorting (major new feature added)
+
+  - General dimension is now supported.
+
+  - Hilbert sorting admits now two policies: splitting at median or at middle
+    (see user manual).
+
+  - Using a property map, sorting on keys instead of points is now easier
+
+
+* dD Kernel
+
+  - The d-dimensional kernel concept and models have been modified to
+    additionally provide two new functors Less_coordinate_d and
+    Point_dimension_d.
+
+
+* 2D Arrangements
+
+  - A new geometry-traits class that handles rational arcs, namely
+    Arr_rational_function_traits_2, has been introduced. It replaced an old
+    traits class, which handled the same family of curves, but it was less
+    efficient. The new traits exploits CGAL algebraic kernels and polynomials,
+    which were not available at the time the old traits class was developed.
+
+  - A new geometry traits concept called ArrangementOpenBoundaryTraits_2 has
+    been introduced. A model of this concept supports curves that approach the
+    open boundary of an iso-rectangular area called parameter space, which can
+    be unbounded or bounded. The general code of the package, however, supports
+    only the unbounded parameter space. We intend to enhance the general code
+    to support also bounded parameter spaces in a future release.
+
+  - The deprecated member function is_at_infinity() of Arrangement_2::Vertex
+    has been removed. It has been previously replaced new function
+    is_at_open_boundary().
+
+  - The tags in the geometry traits that indicate the type of boundary of the
+    embedding surface were replaced by the following new tags:
+             Left_side_category
+             Bottom_side_category
+             Top_side_category
+             Right_side_category
+    It is still possible not to indicate the tags at all. Default values are
+    assumed. This however will produce warning messages, and should be avoided.
+
+
+-------------------------------- Release 3.8 --------------------------------
+
+Release date: April 2011
+
+CGAL 3.8 offers the following improvements and new functionality :
+
+
+* General
+
+  - Boost version 1.39 at least is now required.
+
+  - Initial support for the LLVM Clang compiler (prereleases of version 2.9).
+
+  - Full support for the options -strict-ansi of the Intel Compiler 11, and -
+    ansi of the GNU g++ compiler.
+
+  - Adding a concept of ranges. In the following releases, it will be the way
+    to provide a set of objects (vs. a couple of iterators).
+
+  - Fix a memory leak in CORE polynomials.
+
+  - Various fixes in the manual.
+
+
+* 3D Mesh Generation (major new feature added)
+
+  - Adding the possibility to handle sharp features: the 3D Mesh generation
+    package now offers the possibility to get in the final mesh an accurate
+    representation of 1-dimensional sharp features present in the description
+    of the input domain.
+
+
+* 2D Triangulations (major new feature added)
+
+  - Add a way to efficiently insert a range of points with information into a
+    2D Delaunay and regular triangulation.
+
+  - Add member function mirror_edge taking an edge as parameter.
+
+  - Fix an infinite loop in constrained triangulation.
+
+
+* 3D Triangulations (major new feature added)
+
+  - Add a way to efficiently insert a range of points with information into a
+    3D Delaunay and regular triangulation.
+
+  - Add a member function to remove a cluster of points from a Delaunay or
+    regular triangulation.
+
+  - function vertices_in_conflict is renamed vertices_on_conflict_zone_boundary
+    for Delaunay and regular triangulation. Function
+    vertices_inside_conflict_zone is added to regular triangulation.
+
+  - Structural filtering is now internally used in locate function of Delaunay
+    and regular triangulation. It improves average construction time by 20%.
+
+  - Added demo.
+
+
+* 3D Alpha Shapes (major new feature added)
+
+  - The new class Fixed_alpha_shape_3 provides a robust and faster way to
+    compute one alpha shape (with a fixed value of alpha).
+
+
+* AABB tree
+
+  - Adding the possibility to iteratively add primitives to an existing tree
+    and to build it only when no further insertion is needed.
+
+
+* 2D and 3D Kernel
+
+  - Better handling of 2D points with elevation (3D points projected onto
+    trivial planes). More general traits classes (Projection_traits_xy_3,
+    Projection_traits_yz_3,Projection_traits_yz_3) are provided to work with
+    triangulations, algorithms on polygons, alpha-shapes, convex hull
+    algorithm... Usage of former equivalent traits classes in different
+    packages is now deprecated.
+
+  - Exact_predicates_exact_constructions_kernel now better use the static
+    filters which leads to performance improvements.
+
+  - Add an overload for the global function angle, taking three 3D points.
+
+  - In the 2D and 3D kernel concept, the constant Boolean
+    Has_filtered_predicates is now deprecated. It is now required to use
+    Has_filtered_predicates_tag (being either Tag_true or Tag_false).
+
+  - Compare_distance_2 and Compare_distance_3 provide additional operators for
+    3 and 4 elements.
+
+  - Add intersection test and intersection computation capabilities between an
+    object of type Ray_3 and either an object of type Line_3, Segment_3 or
+    Ray_3.
+
+  - Improve intersection test performance between an object of type Bbox_3 and
+    an object of type Plane_3 or Triangle_3 by avoiding arithmetic filter
+    failures.
+
+
+* 2D Envelope
+
+  - Env_default_diagram_1 is deprecated, Envelope_diagram_1 should be used
+    instead.
+
+
+* 3D Envelope
+
+  - A new demo program called L1_Voronoi_diagram_2 has been introduced. It
+    demonstrates how 2D Voronoi diagrams of points under the L1 metric are
+    constructed using lower envelopes.
+
+
+* dD Kernel
+
+  - Add functor Compute_coordinate_d to Kernel_d concept.
+
+
+* Geometric Object Generators
+
+  - CGAL::Random uses boost::rand48 instead of std::rand.
+
+  - Adding to CGAL::Random a way to generate random integers.
+
+  - Adding generators for dD points.
+
+
+* Algebraic Foundations
+
+  - Algebraic_structure_traits now provides an Inverse functor for Fields.
+    There is also a new global function inverse.
+
+
+* Bounding Volumes
+
+  - dD Min sphere of spheres has a new traits class for the min sphere of
+    points.
+
+
+* Triangulated Surface Mesh Simplification
+
+  - The priority queue internally used to prioritize edge simplifications is no
+    longer a relaxed heap but a binomial heap. This fix guarantees that all
+    edges satisfying a simplification criteria are removed (if possible).
+
+
+* 3D Boolean Operations on Nef Polyhedra
+
+  - Allow construction of a 3D nef polyhedron from a 3D polyhedron with
+    normals.
+
+
+* 2D Arrangements
+
+  - Fix a bug in the method insert_at_vertices of the Arrangement_2 class.
+
+  - Fix several bugs in the traits class Arr_Bezier_curve_traits_2 for
+    arrangement of Bezier curves.
+
+
+* 2D Minkowski Sums
+
+  - A bug in the convolution method was fixed.
+
+
+-------------------------------- Release 3.7 --------------------------------
+
+Release date: October 2010
+
+CGAL 3.7 offers the following improvements and new functionality :
+
+
+* General
+
+  - The configuration of CGAL libraries now requires CMake>=2.6.
+
+  - Changes in the set of supported platforms:
+
+      - GNU g++ 4.5 supported (with or without the compilation option -
+        std=c++0x).
+
+      - Initial support for the option -strict-ansi of the Intel Compiler 11.
+        The CGAL libraries compile with that option, and most CGAL headers have
+        been fixed. The packages "3D Boolean Operations on Nef Polyhedra"
+        (Nef_3), "Convex Decomposition of Polyhedra" (Convex_decomposition_3),
+        and "3D Minkowski Sum of Polyhedra" (Minkowski_sum_3) are known to
+        still fail to compile with that compiler flag.
+
+      - The Microsoft Windows Visual C++ compiler 2010 (VC10), that was
+        experimentally supported by CGAL-3.6.1, is now fully supported. Note
+        that CMake>=2.8.2 is required for that support.
+
+      - The Microsoft Windows Visual C++ compiler 2005 (VC8) is no longer
+        supported by the CGAL project since CGAL-3.7.
+
+      - With Microsoft Windows Visual C++ (VC9 and VC10), the optional
+        dependencies Gmp, Mpfr, Blas, Lapack, Taucs no longer use Boost-style
+        name mangling. Only one variant is now provided by the CGAL Windows
+        installer (release, with dynamic runtime).
+
+
+  - Some demos now require a version of Qt4 >= 4.3.
+
+  - CGAL_PDB is no longer provided with CGAL. An alternative solution for
+    people interested in reading PDB files is to use ESBTL (http://
+    esbtl.sourceforge.net/).
+
+  - Fix issues of the CGAL wrappers around the CORE library, on 64 bits
+    platforms.
+
+
+* Arithmetic and Algebra
+
+  - New models Algebraic_kernel_d_1 and Algebraic_kernel_d_2 for the
+    corresponding concepts. They provide generic support for various
+    coefficient types
+
+
+* Arrangements
+
+  - A new model Arr_algebraic_segment_traits_2 of ArrangementTraits_2 that
+    supports algebraic curves of arbitrary degree in the plane
+
+
+* 2D Triangulations
+
+  - The Delaunay and regular 2D triangulations now use a symbolic perturbation
+    to choose a particular triangulation in co-circular cases.
+
+  - The return type of the template member function insert(It beg, It end),
+    taking an iterator range of points, has been changed from int to std::
+    ptrdiff_t.
+
+  - Classes Triangulation_euclidean_traits_xy_3,
+    Triangulation_euclidean_traits_yz_3 and Triangulation_euclidean_traits_xz_3
+    are now model of the concept ConstrainedTriangulationTraits_2. They can be
+    used with and without intersection of constraints.
+
+  - 2D Delaunay and basic triangulations now provide vertex relocation by the
+    mean of these two new methods: move and move_if_no_collision. The methods
+    are also available for the hierarchy (Triangulation_hierarchy_2).
+
+
+* 3D Triangulations
+
+  - The return type of the template member function insert(It beg, It end),
+    taking an iterator range of points, has been changed from int to std::
+    ptrdiff_t.
+
+  - 3D Delaunay triangulations now provide vertex relocation by the mean of
+    these two new methods: move and move_if_no_collision. This works in both
+    Compact_policy and Fast_policy.
+
+
+* 2D and 3D Alpha Shapes
+
+  - The type int in the API has been changed to std::size_t so that CGAL can
+    deal with large data sets (64 bit addresses).
+
+
+* 2D Mesh Generation
+
+  - The execution of the 2D mesh generator is now deterministic (same at each
+    run).
+
+
+* 3D Mesh Generation
+
+  - The efficiency of the 3D mesh generator has been improved (the number of
+    calls to the oracle per inserted vertex has globally decrease). This is
+    achieved through a slight change of the mesh generator strategy which
+    implies that a surface component that is not detected at the surface mesher
+    level will never be discovered by chance, owing to the refinement of some
+    tetrahedra, as it could happen before. Please note that defining the macro
+    CGAL_MESH_3_USE_OLD_SURFACE_RESTRICTED_DELAUNAY_UPDATE switches back to the
+    old behavior.
+
+  - A demo program is now available.
+
+
+* Surface Reconstruction from Point Sets
+
+  - Improved performance and minor bug fix.
+
+
+* 2D Range and Neighbor Search
+
+  - The type int in the API has been changed to std::size_t so that CGAL can
+    deal with large data sets (64 bit addresses).
+
+
+-------------------------------- Release 3.6.1 --------------------------------
+
+Release date: June 2010
+
+This is a bug fix release. The following has been changed since CGAL-3.6:
+
+
+* General
+
+  - Fix compilation errors with recent Boost versions (since 1.40).
+
+  - Initial support for the Microsoft Visual C++ compiler 10.0 (MSVC 2010). For
+    that support, CMake>=2.8.2 is required. Note also that the compiler option
+    "/bigobj" is necessary to compile some CGAL programs with MSVC 2010.
+
+
+* Polynomial
+
+  - Fix compilation errors with the Microsoft Visual C++ compiler and the Intel
+    C++ compiler.
+
+
+* Polyhedron
+
+  - Fix a compilation errors in demo/Polyhedron/:
+
+  - issue with the location of qglobal.h of Qt4 on MacOS X,
+
+  - missing texture.cpp, if TAUCS is used,
+
+  - Fix the location of built plugins of demo/Polyhedron/, when CGAL is
+    configured with WITH_demos=ON
+
+
+* 3D Periodic Triangulations
+
+  - Fixed bug in the triangulation hierarchy for periodic triangulations.
+
+
+* 2D Mesh Generation
+
+  - Fix a bug that lead to precondition violation.
+
+  - Improve the user manual about the member function is_in_domain() of the
+    Face type.
+
+  - The 2D meshing process is now deterministic (sorting of bad faces no longer
+    relies on pointers comparisons).
+
+
+* 3D Mesh Generation
+
+  - Fix a linking errors (duplicate symbols) when <CGAL/refine_mesh_3.h> is
+    included in different compilation units.
+
+
+* Spatial Searching
+
+  - Fix a bug in <CGAL/Orthogonal_k_neighbor_search.h> when several nearest
+    neighbors are at the same distance from the query point.
+
+
+* IO Streams
+
+  - Fix a bug in <CGAL/IO/VRML_2_ostream.h> that generated VRML 2 files with an
+    invalid syntax for IndexedFaceSet nodes.
+
+
+* Triangulation_2
+
+  - Add missing Compare_distance_2 functor in trait classes
+    Triangulation_euclidean_traits_xy_3 Triangulation_euclidean_traits_yz_3 and
+    Triangulation_euclidean_traits_xz_3. This was preventing calling member
+    function nearest_vertex of Delaunay_triangulation_2 instantiated with one
+    of these traits.
+
+
+-------------------------------- Release 3.6 --------------------------------
+
+Release date: March 2010
+
+CGAL 3.6 offers the following improvements and new functionality :
+
+
+* General
+
+  - Boost version 1.34.1 at least is now required.
+
+
+* Arithmetic and Algebra
+
+ ** Algebraic Kernel (new package)
+
+  - This new package is targeted to provide black-box implementations of state-
+    of-the-art algorithms to determine, compare and approximate real roots of
+    univariate polynomials and bivariate polynomial systems. It includes models
+    of the univariate algebraic kernel concept, based on the library RS.
+
+
+ ** Number Types
+
+  - Two new arbitrary fixed-precision floating-point number types have been
+    added: the scalar type Gmpfr and the interval type Gmpfi, based on the MPFR
+    and MPFI libraries respectively.
+
+
+* Geometry Kernels
+
+ ** 2D and 3D Geometry Kernel
+
+  - Add new do_intersect() and intersection() overloads:
+
+      - do_intersect(Bbox_3, Bbox_3/Line_3/Ray_3/Segment_3)
+
+      - intersection(Triangle_3, Line_3/Ray_3/Segment_3)
+
+
+
+* Polygons
+
+ ** 2D Regularized Boolean Set-Operations
+
+  - Fixed General_polygon_set_2::arrangement() to return the proper type of
+    object.
+
+
+* Arrangement
+
+ ** 2D Arrangements
+
+  - Fixed passing a (const) traits object to the constructor of Arrangement_2.
+
+  - Introduced Arrangement_2::fictitious_face(), which returns the fictitious
+    face in case of an unbounded arrangement.
+
+  - Fixed a bug in Bezier-curve handling.
+
+  - Added (back) iterator, number_of_holes(), holes_begin(), and holes_end() to
+    the default DCEL for backward compatibility.
+
+  - Added (simple) versions of the free overlay() function. It employs the
+    default overlay-traits, which practically does nothing.
+
+
+* Polyhedron
+
+  - Fix a compilation errors in demo/Polyhedron/:
+
+      - issue with the location of qglobal.h of Qt4 on MacOS X,
+
+      - missing texture.cpp, if TAUCS is used,
+
+
+  - Fix the location of built plugins of demo/Polyhedron/, when CGAL is
+    configured with WITH_demos=ON
+
+  - Fix a bug in test_facet function of the incremental builder: the function
+    did not test if while a new facet makes a vertex manifold, no other facet
+    incident to that vertex breaks the manifold property.
+
+
+* Triangulations and Delaunay Triangulations
+
+ ** 2D/3D Regular Triangulations
+
+  - Weighted_point now has a constructor from Cartesian coordinates.
+
+
+ ** 3D Triangulations
+
+  - Regular_triangulation_3 : semi-static floating-point filters are now used
+    in its predicates, which can speed up its construction by a factor of about
+    3 when Exact_predicates_inexact_constructions_kernel is used.
+
+  - The class Regular_triangulation_filtered_traits_3 is deprecated, the class
+    Regular_triangulation_euclidean_traits_3 must be used instead. The
+    predicates of that traits will be filtered if the kernel given as template
+    parameter of that traits is itself a filtered kernel.
+
+  - Triangulation_hierarchy_3 is now deprecated, and replaced by a simpler
+    CGAL::Fast_location policy template parameter of Delaunay_triangulation_3.
+
+  - The old version of remove() (enabled with CGAL_DELAUNAY_3_OLD_REMOVE) has
+    been deleted.
+
+
+ ** 3D Periodic Triangulations
+
+  - New demo: 3D periodic Lloyd algorithm.
+
+  - New functionality for Voronoi diagrams: dual of an edge and of a vertex,
+    volume and centroid of the dual of a vertex.
+
+  - The package can now be used with the 3D Alpha Shapes package to compute
+    periodic alpha shapes.
+
+
+ ** 3D Alpha shapes
+
+  - The class Weighted_alpha_shape_euclidean_traits_3 is deprecated, the class
+    Regular_triangulation_euclidean_traits_3 must be used instead.
+
+  - The package can now be used together with the 3D Periodic Triangulation
+    package to compute periodic alpha shapes.
+
+
+ ** 2D/3D Triangulations, 2D Segment Delaunay Graph, 2D Apollonius Graph, and
+3D Periodic Triangulations
+
+  - The constructor and insert function taking ranges now produce structures
+    whose iterator orders is now deterministic (same at each run).
+
+
+* Mesh Generation
+
+ ** 2D Mesh Generation
+
+  - The 2D mesh generator can now be used with a constrained Delaunay
+    triangulation with constraints hierarchy
+    (Constrained_triangulation_plus_2).
+
+  - In some cases (refinement of a constrained edge that is on the convex
+    hull), the 2D mesh generator from CGAL-3.4 and CGAL-3.5 could create
+    invalid triangulations. This bug is now fixed.
+
+
+ ** 3D Mesh Generation
+
+  - The mesh generator has been enriched with an optimization phase to provide
+    3D meshes with well shaped tetrahedra (and in particular no slivers). The
+    optimization phase involves four different optimization processes: two
+    global optimization processes (ODT and Lloyd), a perturber and an exuder.
+    Each of these processes can be activated or not, and tuned to the users
+    needs and to available computer resources.
+
+
+* Support library
+
+ ** CGAL ipelets
+
+  - Add support for version 7 of Ipe.
+
+
+-------------------------------- Release 3.5.1 --------------------------------
+
+Release date: December 2009
+
+This is a bug fix release.
+
+
+* Documentation
+
+  - Fixes in the documentation (the online documentation of CGAL-3.5 is now
+    based on CGAL-3.5.1).
+
+  - Fixes to the bibliographic references.
+
+
+* Windows installer
+
+  - The Windows installer of CGAL-3.5.1 fixes an issue with downloading of
+    precompiled binaries of the external library TAUCS.
+
+
+* Bug fixes in the following CGAL packages
+
+ ** AABB tree
+
+  - Fix a linker issue in do_intersect(Bbox_3,Bbox_3).
+
+  - Fix compilation issue in do_intersect(Bbox_3,Ray_3) when using the
+    parameters in this order.
+
+
+ ** 3D Mesh Generation
+
+  - Fix a bug in initial points construction of a polyhedral surface.
+
+
+-------------------------------- Release 3.5 --------------------------------
+
+Release date: October 2009
+
+CGAL releases will now be published about every six months. As a transition
+release, CGAL-3.5 has been developed during 9 months from the release CGAL-3.4.
+
+Version 3.5 differs from version 3.4 in the platforms that are supported and in
+functionality. There have also been a number of bug fixes for this release.
+
+
+* General
+
+  - Additional supported platforms:
+
+      - GNU g++ 4.4 supported.
+
+      - Intel Compiler 11 supported on Linux
+
+
+  - Fixed ABI incompatibilities when mixing CGAL and Boost Program Options on
+    Windows/Visual C++ (the compilation flag -D_SECURE_SCL=0 is not longer use
+    in Debug mode).
+
+
+* Geometry Kernels
+
+ ** 3D Spherical Geometry Kernel
+
+  - Add functionalities to manipulate circles, circular arcs and points that
+    belong to the same sphere.
+
+
+* Polygons
+
+ ** 2D Regularized Boolean Set-Operations
+
+  - The polygon validation operations were enhanced and their interface was
+    improved. They are now offered as free functions and applied properly.
+
+
+ ** 2D Straight Skeleton and Polygon Offsetting
+
+  - Updated the manual to document the new partial skeletons feature (already
+    in the code since 3.4)
+
+
+* Arrangements
+
+ ** 2D Arrangements
+
+  - The member function is_at_infinity() of Arrangement_2::Vertex was replaced
+    by the new function is_at_open_boundary(). The former is deprecated. While
+    still supported in version 3.5, It will not be supported in future
+    releases. The member functions boundary_type_in_x() and boundary_type_in_y
+    () were permanently replaced by the functions parameter_space_in_x() and
+    parameter_space_in_y(), respectively. The 2 new functions return an
+    enumeration of a new type, namely Arr_parameter_space.
+
+  - The tags in the geometry traits that indicate the type of boundary of the
+    embedding surface were replaced by the following new tags:
+    Arr_left_side_tag Arr_bottom_side_tag Arr_top_side_tag Arr_right_side_tag
+    In addition, the code was change, and now it is possible not to indicate
+    the tags at all. Default values are assumed. This however will produce
+    warning messages, and should be avoided.
+
+  - All operations of the geometry traits-class were made 'const'. This change
+    was reflected in the code of this package and all other packages that are
+    based on it. Traits classes that maintain state, should declare the data
+    members that store the state as mutable.
+
+
+ ** Envelopes of Surfaces in 3D
+
+  - A few bugs in the code that computes envelopes were fixed, in particular in
+    the code that computes the envelopes of planes.
+
+
+* Triangulations and Delaunay Triangulations
+
+ ** 3D Periodic Triangulations (new package)
+
+  - This package allows to build and handle triangulations of point sets in the
+    three dimensional flat torus. Triangulations are built incrementally and
+    can be modified by insertion or removal of vertices. They offer point
+    location facilities.
+
+
+* Mesh Generation
+
+ ** Surface Reconstruction from Point Sets (new package)
+
+  - This CGAL package implements an implicit surface reconstruction method:
+    Poisson Surface Reconstruction. The input is an unorganized point set with
+    oriented normals.
+
+
+ ** 3D Mesh Generation (new package)
+
+  - This package generates 3 dimensional meshes. It computes isotropic
+    simplicial meshes for domains or multidomains provided that a domain
+    descriptor, able to answer queries from a few different types on the
+    domain, is given. In the current version, Mesh_3 generate meshes for domain
+    described through implicit functional, 3D images or polyhedral boundaries.
+    The output is a 3D mesh of the domain volume and conformal surface meshes
+    for all the boundary and subdividing surfaces.
+
+
+* Geometry Processing
+
+ ** Triangulated Surface Mesh Simplification
+
+  - BREAKING API change in the passing of the visitor object.
+
+  - Fixed a bug in the link_condition test
+
+  - Added a geometric test to avoid folding of facets
+
+  - Fixed a bug in the handling of overflow in the LindstromTurk computations
+
+  - Updated the manual to account for the new visitor interface
+
+
+ ** Point Set Processing (new package)
+
+  - This packages implements a set of algorithms for analysis, processing, and
+    normal estimation and orientation of point sets.
+
+
+* Spatial Searching and Sorting
+
+ ** AABB tree (new package)
+
+  - This package implements a hierarchy of axis-aligned bounding boxes (a AABB
+    tree) for efficient intersection and distance computations between 3D
+    queries and sets of input 3D geometric objects.
+
+
+* Support Library
+
+ ** CGAL_ipelets (new package):
+
+  - Object that eases the writing of Ipe's plugins that use CGAL. Plugins for
+    CGAL main 2D algorithm are provided as demo.
+
+
+-------------------------------- Release 3.4 --------------------------------
+
+Release date: January 2009
+
+Version 3.4 differs from version 3.3.1 in the platforms that are supported and
+in functionality. There have also been a number of bug fixes for this release.
+
+
+* General
+
+  - GNU g++ 4.3 supported. Support for g++ 3.3 is dropped.
+
+  - Visual 9 supported. Support for Visual 7 is dropped.
+
+  - Boost version 1.33 at least is now required.
+
+  - CGAL now depends on Boost.Threads, which implies to link against a compiled
+    part of Boost.
+
+  - The new macro CGAL_NO_DEPRECATED_CODE can be defined to disable deprecated
+    code, helping users discover if they rely on code that may be removed in
+    subsequent releases.
+
+  - Assertion behaviour: It is not possible anymore to set the CONTINUE mode
+    for assertion failures. Functions that allow to change the assertion
+    behaviour are now declared in <CGAL/assertions_behaviour.h>.
+
+  - Qt3 based demos are still there but the documentation has been removed as
+    the CGAL::Qt_Widget will be deprecated.
+
+  - Qt4 based demos use the Qt GraphicsView framework and the libQGLViewer.
+
+
+* Installation
+
+  - install_cgal has been replaced by CMake.
+
+
+* Polynomial (new package)
+
+  - This package introduces a concept Polynomial_d, a concept for multivariate
+    polynomials in d variables.
+
+
+* Modular Arithmetic (new package)
+
+  - This package provides arithmetic over finite fields.
+
+
+* Number Types
+
+  - the counter Interval_nt::number_of_failures() has been removed, replaced by
+    a profiling counter enabled with CGAL_PROFILE.
+
+  - Fix of a bug in CORE/Expr.h; as a consequence, the arrangement demo works
+    properly when handling arrangements of conics, for example, when defining
+    an arc with 5 points.
+
+
+* 3D Spherical Geometry Kernel (new package)
+
+  - This package is an extension of the linear CGAL Kernel. It offers
+    functionalities on spheres, circles, circular arcs and line segments in the
+    3D space.
+
+
+* Linear Kernel
+
+  - We recommend that you use the object_cast() function instead of assign() to
+    extract an object from a CGAL::Object, for efficiency reasons.
+
+  - The Kernel archetypes provided by the 2D/3D linear kernel have been
+    removed.
+
+  - The deprecated linear kernel functors Construct_supporting_line_2 and
+    Construct_supporting_line_3 have been removed.
+
+  - Ambiant_dimension and Feature_dimenison have been added to retrieve the
+    potentially compile-time dimension of a space or of an object.
+
+  - barycenter() functions have been added.
+
+  - The geometric object Circle_3 as well as predicates and constructions have
+    been added to the kernel
+
+  - The missing intersection/do_intersect between Line_3 and Line_3 has been
+    added as well.
+
+
+* 3D Triangulations
+
+  - Removed the deprecated functions Cell:mirror_index() and Cell::
+    mirror_vertex().
+
+  - Derecursification of two functions that in some cases lead to stack
+    overflows
+
+
+* 3D Nef Polyhedron
+
+  - n-ary union/intersection
+
+  - intersection with halfspace under standard kernel
+
+  - constructor for polylines
+
+
+* CGAL and the Qt4 GraphicsView (new package)
+
+  - 2D CGAL Kernel objects and many data structures have can be rendered in a
+    QGraphicsView
+
+
+* STL Extensions:
+
+  - The functor adaptors for argument binding and composition (bind_*, compose,
+    compose_shared, swap_*, negate, along with the helper functions set_arity_*
+    and Arity class and Arity_tag typedefs) which were provided by <CGAL/
+    functional.h> have been removed. Please use the better boost::bind mecanism
+    instead. The concept AdaptableFunctor has been changed accordingly such
+    that only a nested result_type is required.
+
+  - The accessory classes Twotuple, Threetuple, Fourtuple and Sixtuple are also
+    deprecated (use CGAL::array instead).
+
+  - CGAL::Triple and CGAL::Quadruple are in the process of being replaced by
+    boost::tuple. As a first step, we strongly recommend that you replace the
+    direct access to the data members (.first, .second, .third, .fourth), by
+    the get<i>() member function; and replace the make_triple and
+    make_quadruple maker functions by make_tuple.
+    This way, in a further release, we will be able to switch to boost::tuple
+    more easily.
+
+  - The class CGAL::Uncertain<> has been documented. It is typically used to
+    report uncertain results for predicates using interval arithmetic, and
+    other filtering techniques.
+
+
+* 2D Arrangements
+
+  - Changed the name of the arrangement package from Arrangement_2 to
+    Arrangement_on_surface_2 to reflect the potential capabilities of the
+    package to construct and maintain arrangements induced by curves embedded
+    on two dimensional surfaces in three space. Most of these capabilities will
+    become available only in future releases though.
+
+  - Enhanced the geometry traits concept to handle arrangements embedded on
+    surfaces. Each geometry-traits class must now define the
+    'Boundary_category' tag.
+
+  - Fixed a bug in Arr_polyline_traits_2.h, where the operator that compares
+    two curves failed to evaluate the correct result (true) when the curves are
+    different, but their graphs are identical.
+
+  - Permanently removed IO/Arr_postscript_file_stream.h and IO/
+    Polyline_2_postscript_file_stream.h, as they depend on obsolete features
+    and LEDA.
+
+  - Fixed several bugs in the arrangement demo and enhanced it. e.g., fixed
+    background color change, allowed vertex coloring , enabled "smart" color
+    selection, etc.
+
+  - Enhanced the arrangement demo with new features, such as allowing the
+    abortion of the merge function (de-select), updated the how-to description,
+    etc.
+
+  - Replace the functions CGAL::insert_curve(), CGAL::insert_curves(), CGAL::
+    insert_x_monotone_curve(), and CGAL::insert_x_monotone_curves() with a
+    single overloaded function CGAL::insert(). The former 4 functions are now
+    deprecated, and may no longer be supported in future releases.
+
+
+* Envelopes of Surfaces in 3D
+
+  - Fixed a bug in the computation of the envelope of unbounded planes caused
+    by multiple removals of vertices at infinity.
+
+
+* 2D Regularized Boolean Set-Operations
+
+  - Fixed a bug in connect_holes() that caused failures when connecting holes
+    touching the outer boundary.
+
+  - Fixed the concept GeneralPolygonSetTraits_2. Introduced two new concepts
+    GpsTraitsGeneralPolygon_2 and GpsTraitsGeneralPolygonWithHoles_2. Fixed the
+    definition of the two nested required types Polygon_2 and
+    Polygon_with_holes_2 of the GeneralPolygonSetTraits_2 concept. They must
+    model now the two new concepts above.
+
+  - Added a default template parameter to 'General_polygon_set_2' to allow
+    users to pass their specialized DCEL used to instantiate the underlying
+    arrangement.
+
+  - Enhanced the BOP demo to use multiple windows.
+
+
+* 2D Minkowski Sums
+
+  - Fixed a few bugs in the approximate offset function, making it robust to
+    highly degenerate inputs.
+
+  - Fixed a bug in the exact Minkowski sum computation when processing
+    degenerate inputs that induce overlapping of contiguous segments in the
+    convolution cycles.
+
+  - Optimized the approximate offset function (reduced time consumption up to a
+    factor of 2 in some cases).
+
+  - Added functionality to compute the offset (or to approximate the offset) of
+    a Polygon_with_holes_2 (and not just of a Polygon_2).
+
+  - Added the functionality to compute (or to approximate) the inner offset of
+    a polygon.
+
+
+-------------------------------- Release 3.3.1 --------------------------------
+
+Release date: August 2007
+
+This is a bug fix release.
+
+
+* General
+
+  - Intel C++ 9 was wrongly recognized as unsupported by install_cgal.
+
+  - Added autolink (for Visual C++) for the CGALImageIO and CGALPDB libraries.
+
+  - Fixed bug in Memory_sizer when using more than 4GB of memory (64bit).
+
+
+* Number Types
+
+  - Fixed bug in FPU rounding mode macros (affected only the alpha
+    architecture).
+
+  - Fixed bug in MP_Float constructor from double for some particular values.
+
+  - Fixed bug in to_double(Lazy_exact_nt) sometimes returning NaN.
+
+
+* Kernel
+
+  - Fixed forgotten derivation in Circular_kernel_2::Has_on_2
+
+  - Added some missing functions in Bbox_3 compared to Bbox_2.
+
+
+* Skin Surface Meshing
+
+  - The new Skin Surface Meshing package had been forgotten in the list of
+    changes and the release announcement of CGAL 3.3: This package allows to
+    build a triangular mesh of a skin surface. Skin surfaces are used for
+    modeling large molecules in biological computing.
+
+
+* Arrangements
+
+  - Fixed a bug in the Arrangement_2 package in dual arrangement representation
+    for Boost graphs when reporting all halfedges of a face.
+
+  - Fixed a bug in the Arrangement sweep-line when using a specific polyline
+    configuration.
+
+  - Fixed bug in Arrangement_2 in walk along a line point location for
+    unbounded curves.
+
+  - Fixed bug in aggregated insertion to Arrangement_2.
+
+  - Fixed bug in Arrangment_2 class when inserting an unbounded curve from an
+    existing vertex.
+
+  - Fixed bug when dealing with a degenerate conic arc in Arr_conic_traits_2 of
+    the Arrangment package, meaning a line segment which is part of a
+    degenerate parabola/hyperbola.
+
+  - Fixed bug in the Bezier traits-class: properly handle line segments.
+    properly handle comparison near a vertical tangency.
+
+
+* 2D Polygon
+
+  - Fixed bug in degenerate case of Polygon_2::is_convex() for equal points.
+
+
+* 2D Triangulations
+
+  - Fixed bug in Regular_triangulation_2.
+
+
+* 3D Triangulations
+
+  - Added a circumcenter() function in the default Cell type parameter
+    Triangulation_ds_cell_base_3, so that the .dual() member function of
+    Delaunay still work as before, without requiring the explicit use of
+    Triangulation_cell_base.
+
+  - Added missing operator->() to Facet_circulator.
+
+
+* Interpolation
+
+  - Fixed bug in Interpolation 3D about the normalization coefficient
+    initialization.
+
+
+* 3D Boolean Operations on Nef Polyhedra
+
+  - Fixed bug in construction of Nef_polyhedron_3 from off-file. Now, always
+    the inner volume is selected.
+
+  - Fixed bug in conversion from Nef_polyhedron_3 to Polyhedron_3. Polyhedron_3
+    was not cleared at the beginning.
+
+  - Fixed bug in Nef_polyhedron_3 in update of indexes for construction of
+    external structure.
+
+
+* Third Party Libraries Shipped with CGAL
+
+  - TAUCS supports now 64 bits platforms.
+
+  - CAUTION: Since version 3.3.1, CGAL is no longer compatible with the
+    official release of TAUCS (currently 2.2). Make sure to use the version
+    modified by the CGAL project and available from the download section of
+    http://www.cgal.org.
+
+
+-------------------------------- Release 3.3 --------------------------------
+
+Release date: May 2007
+
+Version 3.3 differs from version 3.2.1 in the platforms that are supported and
+in functionality. There have also been a number of bug fixes for this release.
+
+Additional supported platforms
+
+  - GNU g++ 4.1 and 4.2
+
+  - Intel C++ compiler 9
+
+  - Microsoft Visual C++ compiler 8.0
+
+
+The following platforms are no longer supported:
+
+  - Intel 8
+
+
+CGAL now supports Visual C++ "Checked iterators" as well as the debug mode of
+GNU g++'s STL (-D_GLIBCXX_DEBUG).
+
+CGAL now works around the preprocessor macros 'min' and 'max' defined in
+<windows.h> which were clashing with min/max functions.
+
+
+* Installation
+
+  - On Windows the libraries built in Developer Studio now have names which
+    encode the compiler version, the runtime and whether it was built in
+    release or debug mode. The libraries to link against are chosen with linker
+    pragmas in header files.
+
+  - On all platforms but Windows shared and static versions of the libraries
+    are generated
+
+
+* Manuals
+
+  - The Package Overview page now also hosts the precompiled demos.
+
+
+* Algebraic Foundations
+
+  - Algebraic Foundations (new package)
+    This package defines what algebra means for CGAL, in terms of concepts,
+    classes and functions. The main features are: (i) explicit concepts for
+    interoperability of types (ii) separation between algebraic types (not
+    necessarily embeddable into the reals), and number types (embeddable into
+    the reals).
+
+  - Number Types
+    Fixed_precision_nt and Filtered_exact number types have been removed.
+
+
+
+* Kernels
+
+  - 2D Circular Kernel
+    Efficiency improved through geometric filtering of predicates, introduced
+    with the filtered kernel Filtered_bbox_circular_kernel_2<.>, and also
+    chosen for the predefined kernel Exact_circular_kernel_2.
+
+  - Linear Kernel
+    Exact_predicates_exact_constructions_kernel memory and run-time
+    improvements through usage of lazy geometric constructions instead of lazy
+    arithmetic.
+
+
+
+* Data Structures and Algorithms
+
+  - Surface Mesh Simplification (new package)
+    This package provides a mesh simplification framework using edge collapse
+    operations, and provides the Turk/Lindstrom simplification algorithm.
+
+  - Skin Surface Meshing (new package)
+    This package allows to build a triangular mesh of a skin surface. Skin
+    surfaces are used for modeling large molecules in biological computing. The
+    surface is defined by a set of balls, representing the atoms of the
+    molecule, and a shrink factor that determines the size of the smooth
+    patches gluing the balls together.
+
+  - Estimation of Local Differential Properties (new package)
+    This package allows to compute local differential quantities of a surface
+    from a point sample
+
+  - Approximation of Ridges and Umbilics on Triangulated Surface Meshes (new
+    package)
+    This package enables the approximation of differential features on
+    triangulated surface meshes. Such curvature related features are lines:
+    ridges or crests, and points: umbilics.
+
+  - Envelopes of Curves in 2D (new package)
+    This package contains two sets of functions that construct the lower and
+    upper envelope diagram for a given range of bounded or unbounded curves.
+
+  - Envelopes of Surfaces in 3D (new package)
+    This package contains two sets of functions that construct the lower and
+    upper envelope diagram for a given range of bounded or unbounded surfaces.
+    The envelope diagram is realized as a 2D arrangement.
+
+  - Minkowski Sums in 2D (new package)
+    This package contains functions for computing planar Minkowski sums of two
+    closed polygons, and for a polygon and a disc (an operation also known as
+    offsetting or dilating a polygon). The package also contains an efficient
+    approximation algorithm for the offset computation, which provides a
+    guaranteed approximation bound while significantly expediting the running
+    times w.r.t. the exact computation procedure.
+
+  - Surface Mesh Parametrization
+    Added Jacobi and SSOR preconditioners to OpenNL solver, which makes it much
+    faster and more stable.
+
+  - 2D Arrangements
+
+      - Added support for unbounded curves.
+
+      - Added a traits class that supports bounded and unbounded linear
+        objects, namely lines, rays and line segments.
+
+      - Added traits classes that handle circular arcs based on the circular
+        kernel.
+
+      - Added a traits class that supports Bezier curves.
+
+      - Enhanced the traits class that supports rational functions to handle
+        unbounded (as well as bounded) arcs
+
+      - Added a free function called decompose() that produces the symbolic
+        vertical decomposition of a given arrangement, performing a batched
+        vertical ray-shooting query from all arrangement vertices.
+
+      - Fixed a memory leak in the sweep-line code.
+
+      - Fixed a bug in computing the minor axis of non-degenerate hyperbolas.
+
+
+  - Boolean Set Operations
+
+      - Added the DCEL as a default template parameter to the
+        General_polygon_set_2 and Polygon_set_2 classes. This allows users to
+        extend the DCEL of the underlying arrangement.
+
+      - Added a function template called connect_holes() that connects the
+        holes in a given polygon with holes, turning it into a sequence of
+        points, where the holes are connceted to the outer boundary using zero-
+        width passages.
+
+      - Added a non-const function member to General_polygon_set_2 that obtains
+        the underlying arrangement.
+
+
+  - 2D and 3D Triangulations
+
+      - The constructors and insert member functions which take an iterator
+        range perform spatial sorting in order to speed up the insertion.
+
+
+  - Optimal Distances
+
+      - Polytope_distance_d: has support for homogeneous points; bugfix in fast
+        exact version.
+
+
+  - Bounding Volumes
+
+      - Min_annulus_d has support for homogeneous points; bugfix in fast exact
+        version.
+
+
+
+
+* Support Library
+
+  - CGAL and the Boost Graph Library (BGL) (new package)
+    This package provides the glue layer for several CGAL data structures such
+    that they become models of the BGL graph concept.
+
+  - Spatial Sorting (new package)
+    This package allows to sort points and other objects along a Hilbert curve
+    which can improve the performance of algorithms like triangulations. It is
+    used by the constructors of the triangulation package which have an
+    iterator range of points as argument.
+
+  - Linear and Quadratic Programming Solver (new package)
+    This package contains algorithms for minimizing linear and convex quadratic
+    functions over polyhedral domains, described by linear equations and
+    inequalities.
+
+
+-------------------------------- Release 3.2.1 --------------------------------
+
+Release date: July 2006
+
+This is a bug fix release
+
+
+* Number Types
+
+  - Fix MP_Float constructor which crashed for some values.
+
+
+* Kernel
+
+  - Rename Bool to avoid a clash with a macro in X11 headers.
+
+
+* Arrangement
+
+  - Derived the Arr_segment_traits_2 Arrangement_2 traits class from the
+    parameterized Kernel. This allows the use of this traits class in an
+    extended range of applications that require kernel objects and operations
+    on these objects beyond the ones required by the Arrangement_2 class
+    itself.
+
+  - Fixed a compilation bug in the code that handles overlay of arrangements
+    instantiated with different DCEL classes.
+
+  - Fixed a couple of bugs in the implementation of the Trapezoidal RIC point-
+    location strategy
+
+
+* Triangulation, Alpha Shapes
+
+  - Qualify calls to filter_iterator with "CGAL::" to avoid overload
+    ambiguities with Boost's filter_iterator.
+
+
+* Surface Mesher
+
+  - Fixed a bug in iterators of the class template
+    Surface_mesh_complex_2_in_triangulation_3
+
+
+* Surface Mesh Parametrisation
+
+  - Updated the precompiled taucs lib
+
+
+* Kinetic Data Structures
+
+  - Fixed problems caused by old versions of gcc being confused by operator!
+    and operator int()
+
+  - Added point removal support to the Active_objects_vector
+
+
+-------------------------------- Release 3.2 --------------------------------
+
+Release date: May 2006
+
+Version 3.2 differs from version 3.1 in the platforms that are supported and in
+functionality. There have also been a number of bug fixes for this release.
+
+The following platforms are no longer supported:
+
+  - SunPro CC versions 5.4 and 5.5 on Solaris
+
+  - SGI Mips Pro
+
+
+For Visual C++ the installation scripts choose the multi-threaded dynamically
+linked runtime (/MD). Before it was the single-threaded static runtime (/ML).
+
+
+* Installation
+
+  - The install tool tries to find third party libraries at "standard"
+    locations.
+
+  - Installers for Apple, Windows, and rpms.
+
+
+* Manuals
+
+  - User and Reference manual pages of a package are in the same chapter
+
+
+* Kernels
+
+  - 2D Circular Kernel (new package)
+    This package is an extension of the linear CGAL Kernel. It offers
+    functionalities on circles, circular arcs and line segments in the plane.
+
+
+
+* Data Structures and Algorithms
+
+  - 2D Regularized Boolean Set-Operations (new package)
+    This package consists of the implementation of Boolean set-operations on
+    point sets bounded by weakly x-monotone curves in 2-dimensional Euclidean
+    space. In particular, it contains the implementation of regularized Boolean
+    set-operations, intersection predicates, and point containment predicates.
+
+  - 2D Straight Skeleton and Polygon Offsetting (new package)
+    This package implements an algorithm to construct a halfedge data structure
+    representing the straight skeleton in the interior of 2D polygons with
+    holes and an algorithm to construct inward offset polygons at any offset
+    distance given a straight skeleton.
+
+  - 2D Voronoi Diagram Adaptor (new package)
+    This package provides an adaptor that adapts a 2-dimensional triangulated
+    Delaunay graph to the corresponding Voronoi diagram, represented as a
+    doubly connected edge list (DCEL) data structure. The adaptor has the
+    ability to automatically eliminate, in a consistent manner, degenerate
+    features of the Voronoi diagram, that are artifacts of the requirement that
+    Delaunay graphs should be triangulated even in degenerate configurations.
+    Depending on the type of operations that the underlying Delaunay graph
+    supports, the adaptor allows for the incremental or dynamic construction of
+    Voronoi diagrams and can support point location queries.
+
+  - 3D Surface Mesher (new package)
+    This package provides functions to generate surface meshes that interpolate
+    smooth surfaces. The meshing algorithm is based on Delaunay refinement and
+    provides some guarantees on the resulting mesh: the user is able to control
+    the size and shape of the mesh elements and the accuracy of the surface
+    approximation. There is no restriction on the topology and number of
+    components of input surfaces. The surface mesher may also be used for non
+    smooth surfaces but without guarantee.
+    Currently, implementations are provided for implicit surfaces described as
+    the zero level set of some function and surfaces described as a gray level
+    set in a three-dimensional image.
+
+
+  - 3D Surface Subdivision Methods (new package)
+    Subdivision methods recursively refine a control mesh and generate points
+    approximating the limit surface. This package consists of four popular
+    subdivision methods and their refinement hosts. Supported subdivision
+    methods include Catmull-Clark, Loop, Doo-Sabin and sqrt(3) subdivisions.
+    Their respective refinement hosts are PQQ, PTQ, DQQ and sqrt(3)
+    refinements. Variations of those methods can be easily extended by
+    substituting the geometry computation of the refinement host.
+
+  - Planar Parameterization of Triangulated Surface Meshes (new package)
+    Parameterizing a surface amounts to finding a one-to-one mapping from a
+    suitable domain to the surface. In this package, we focus on triangulated
+    surfaces that are homeomorphic to a disk and on piecewise linear mappings
+    into a planar domain. This package implements some of the state-of-the-art
+    surface mesh parameterization methods, such as least squares conformal
+    maps, discrete conformal map, discrete authalic parameterization, Floater
+    mean value coordinates or Tutte barycentric mapping.
+
+  - Principal Component Analysis (new package)
+    This package provides functions to compute global informations on the shape
+    of a set of 2D or 3D objects such as points. It provides the computation of
+    axis-aligned bounding boxes, centroids of point sets, barycenters of
+    weighted point sets, as well as linear least squares fitting for point sets
+    in 2D, and point sets as well as triangle sets in 3D.
+
+  - 2D Placement of Streamlines (new package)
+    Visualizing vector fields is important for many application domains. A good
+    way to do it is to generate streamlines that describe the flow behaviour.
+    This package implements the "Farthest Point Seeding" algorithm for placing
+    streamlines in 2D vector fields. It generates a list of streamlines
+    corresponding to an input flow using a specified separating distance. The
+    algorithm uses a Delaunay triangulation to model objects and adress
+    different queries, and relies on choosing the centers of the biggest empty
+    circles to start the integration of the streamlines.
+
+  - Kinetic Data Structures (new package)
+    Kinetic data structures allow combinatorial structures to be maintained as
+    the primitives move. The package provides implementations of kinetic data
+    structures for Delaunay triangulations in two and three dimensions, sorting
+    of points in one dimension and regular triangulations in three dimensions.
+    The package supports exact or inexact operations on primitives which move
+    along polynomial trajectories.
+
+  - Kinetic Framework (new package)
+    Kinetic data structures allow combinatorial geometric structures to be
+    maintained as the primitives move. The package provides a framework to ease
+    implementing and debugging kinetic data structures. The package supports
+    exact or inexact operations on primitives which move along polynomial
+    trajectories.
+
+  - Smallest Enclosing Ellipsoid (new package)
+    This algorithm is new in the chapter Geometric Optimisation.
+
+  - 2D Arrangement (major revision)
+    This package can be used to construct, maintain, alter, and display
+    arrangements in the plane. Once an arrangement is constructed, the package
+    can be used to obtain results of various queries on the arrangement, such
+    as point location. The package also includes generic implementations of two
+    algorithmic frameworks, that are, computing the zone of an arrangement, and
+    line-sweeping the plane, the arrangements is embedded on.
+    Arrangements and arrangement components can also be extended to store
+    additional data. An important extension stores the construction history of
+    the arrangement, such that it is possible to obtain the originating curve
+    of an arrangement subcurve.
+
+
+  - Geometric Optimisation (major revision)
+    The underlying QP solver which is the foundation for several algorithms in
+    the Geometric Optimisation chapter has been completely rewritten.
+
+  - 3D Triangulation (new functionality)
+    Regular_triangulation_3 now offers vertex removal.
+
+
+
+-------------------------------- Release 3.1 --------------------------------
+
+Release date: December 2004
+
+Version 3.1 differs from version 3.0 in the platforms that are supported and in
+functionality. There have also been a number of bug fixes for this release.
+
+Additional supported platforms:
+
+  - MS Visual C++, version 7.3. and 8.0
+
+  - Intel 8.0
+
+  - SunPro CC versions 5.4 and 5.5 on Solaris
+
+  - GNU g++ versions 3.4 on Linux, Solaris, Irix, cygwin, FreeBSD, and MacOS X
+
+  - Darwin (MacOS X) and IA64/Linux support.
+
+
+The following platforms are no longer supported:
+
+  - MS Visual C++, version 7.0
+
+
+The following functionality has been added or changed:
+
+
+
+* All
+
+  - The CORE 1.7 library for exact real arithmetic.
+
+  - Updated GMP to 4.1.3.
+
+  - Added Mpfr a library for multiple-precision floating-point computations
+    with exact rounding.
+
+  - Added Boost 1.32.0 (only include files).
+
+
+* Installation
+
+  - new option --disable-shared to omit building libCGAL.so.
+
+
+* Manuals
+
+  - Merged all major manuals in one multi-part manual, which provides now
+    cross-links between the CGAL Kernel, the CGAL Basic Library, and the CGAL
+    Support Library HTML manuals.
+
+  - Improved layout.
+
+
+* Kernels
+
+  - Improved efficiency of filtered kernels.
+
+  - More predicates and constructions.
+
+
+* Basic Library
+
+  - 2D Segment Voronoi Diagram (new package)
+    A data structure for Voronoi diagrams of segments in the plane under the
+    Euclidean metric. The Voronoi edges are arcs of straight lines and
+    parabolas. The algorithm provided in this package is incremental.
+
+  - 2D Conforming Triangulations and Meshes (new package)
+    An implementation of Shewchuk's algorithm to construct conforming
+    triangulations and 2D meshes.
+
+  - 3D Boolean Operations on Nef Polyhedra (new package)
+    A new class (Nef_polyhedron_3) representing 3D Nef polyhedra, a boundary
+    representation for cell-complexes bounded by halfspaces that supports
+    boolean operations and topological operations in full generality including
+    unbounded cells, mixed dimensional cells (e.g., isolated vertices and
+    antennas). Nef polyhedra distinguish between open and closed sets and can
+    represent non-manifold geometry.
+
+  - 2D and Surface Function Interpolation (new package)
+    This package implements different methods for scattered data interpolation:
+    Given measures of a function on a set of discrete data points, the task is
+    to interpolate this function on an arbitrary query point. The package
+    further offers functions for natural neighbor interpolation.
+
+  - Planar Nef polyhedra embedded on the sphere (new package)
+    A new class (Nef_polyhedron_S2) designed and supported mainly to represent
+    sphere neighborhoods around vertices of the three- dimensional Nef
+    polyhedra.
+
+  - Box_intersection_d (new package)
+    A new efficient algorithm for finding all intersecting pairs for large
+    numbers of iso-oriented boxes, i.e., typically these will be bounding boxes
+    of more complicated geometries. Useful for (self-) intersection tests of
+    surfaces etc.
+
+  - 2D Snap Rounding (new package)
+    Snap Rounding is a well known method for converting arbitrary-precision
+    arrangements of segments into a fixed-precision representation. In the
+    study of robust geometric computing, it can be classified as a finite
+    precision approximation technique. Iterated Snap Roundingis a modification
+    of Snap Rounding in which each vertex is at least half-the-width-of-a-pixel
+    away from any non-incident edge. This package supports both methods.
+
+  - 3D Triangulations
+
+      - Triangulation_3: added operator==(),removed push_back() and
+        copy_triangulation().
+
+      - Delaunay_3 : added nearest_vertex(), move_point(), vertices_in_conflict
+        ().
+
+      - Regular_3 : added filtered traits class, and nearest_power_vertex().
+
+
+  - Planar_map and Arrangement_2
+
+      - The interface of the two traits functions that compute the intersection
+        of two given curves changed. The functions
+        nearest_intersection_to_right() and nearest_intersection_to_left()
+        return an object of type CGAL::Object that represents either an empty
+        intersection, a point, or an overlapping subcurve.
+
+      - Requirements to define two binary tags were added to the traits concept
+        of the Planar_map as follows: Has_left_category - indicates whether the
+        functions curves_compare_y_at_x_left() and nearest_intersection_to_left
+        () are implemented in the traits model. Has_reflect_category -
+        indicates whether the functions point_reflect_in_x_and_y() and
+        curve_reflect_in_x_and_y() are implemented in the traits model. They
+        can be used as an alternative to the two function in the previous item.
+
+      - A new constructor of the Segment_cached_2 type that represents a
+        segment in the Arr_segment_cached_traits_2 traits class was introduced.
+        The new constructor accepts the segment endpoints as well as the
+        coefficients of the underlying line.
+
+      - A new version of the conic-arc traits, based on CORE version 1.7 was
+        introduced. This new traits class makes use of CORE's rootOf() operator
+        to compute the intersection points in the arrangement, making its code
+        much simpler and more elegant than the previous version. In addition,
+        new constructors for conic arcs are provided. The new traits class
+        usually performs about 30% faster than the version included in CGAL 3.0
+
+      - The traits class that handles continuous piecewise linear curves,
+        namely Arr_polyline_traits_2, was rewritten. The new class is
+        parametrized with a traits class that handles segments, say
+        Segment_traits. The polyline curve defined within the
+        Arr_polyline_traits_2 class is implemented as a vector of segments of
+        type Segment_traits::Curve_2.
+
+      - A meta traits class, namely Arr_curve_data_traits_2, that extends the
+        curve type of the planar-map with arbitrary additional data was
+        introduced. It should be instantiated with a regular traits-class and a
+        class that contains all extraneous data associated with a curve.
+
+      - The class that represents the trapezoidal-decomposition point location
+        strategy was renamed to Pm_trapezoid_ric_point_location.
+
+      - The Arrangement demo was rewritten. It covers many more features, has a
+        much better graphical user interface, and comes with online
+        documentation.
+
+      - Few bugs in the sweep-line module related to overlapping vertical
+        segments were fixed. This module is used by the aggregate insert method
+        that inserts a collection of curves at once.
+
+
+  - Triangulation_2
+
+      - added a filtered trait class in the regular triangulation
+
+      - added split and join operations in the triangulation data structure
+        class
+
+
+  - Alpha_shapes_3
+
+      - major changes in the implementation of the class Alpha_shapes_3.
+
+      - New implementation results in a true GENERAL mode allowing null and
+        negative alpha-values. It also fixed the edges classification bug and
+        introduces a classification of vertices.
+
+
+  - Min_ellipse_2
+
+      - made access to approximate double representation public
+
+      - fixed bugs in conversion to double representation
+
+      - added is_circle() method
+
+      - minor performance improvements
+
+
+  - Min_sphere_of_spheres_d:
+
+      - The models Min_sphere_of_spheres_d_traits_2<K,FT,UseSqrt,Algorithm>,
+        Min_sphere_of_spheres_d_traits_3<K,FT,UseSqrt,Algorithm>, and
+        Min_sphere_of_spheres_d_traits_d<K,FT,Dim,UseSqrt,Algorithm> of concept
+        MinSphereOfSpheresTraits now represent a sphere as a std::
+        pair<Point,Radius> (and not any more as a CGAL::
+        Weighted_point<Point,Weight>)
+
+      - Internal code cleanup; in particular, implementation details don't
+        pollute the namespace CGAL anymore
+
+
+  - Polyhedron_3
+
+      - New Tutorial on CGAL Polyhedron for Subdivision Algorithms with
+        interactive demo viewer in source code available.
+
+      - Added example program for efficient self-intersection test. - Added
+        small helper functions, such as vertex_degree, facet_degree, edge_flip,
+        and is_closed.
+
+
+  - Apollonius Graph (Voronoi of Circles)
+
+      - Reduced memory requirements by approximately a factor of two.
+
+
+
+-------------------------------- Release 3.0.1 --------------------------------
+
+Release date: February 2004
+
+This is a bug-fix release. No new features have been added in 3.0.1. Here is
+the list of bug-fixes.
+
+
+* Polyhedral Surface
+
+  - Fixed wrong include files for output support. Added example.
+
+
+* Planar_map
+
+  - Fixed the so called "Walk-along-a-line" point-location strategy to
+    correctly handle a degenerate case.
+
+
+* 2D Triangulation
+
+  - added missing figure in html doc
+
+  - in Line_face_circulator_2.h:
+    Fixed changes made to support handles with a typedef to iterator. The fix
+    concerns operator== and !=.
+
+
+* Alpha_shapes_3
+
+  - fixed classify member function for edges.
+
+
+* Number types
+
+  - Lazy_exact_nt:
+
+      - added the possibility to select the relative precision of to_double()
+        (by default 1e-5). This should fix reports that some circumcenters
+        computations have poor coordinates, e.g. nan).
+
+      - when exact computation is triggered, the interval is recomputed, this
+        should speed up some kinds of computations.
+
+
+  - to_interval(Quotient<MP_Float>): avoid spurious overflows.
+
+
+* Kernel
+
+  - missing acknowledgment in the manual and minor clarification of
+    intersection() documentation.
+
+
+-------------------------------- Release 3.0 --------------------------------
+
+Release date: October 2003
+
+Version 3.0 differs from version 2.4 in the platforms that are supported and in
+functionality. There have also been a number of bug fixes for this release.
+
+The license has been changed to either the LGPL (GNU Lesser General Public
+License v2.1) or the QPL (Q Public License v1.0) depending on each package. So
+CGAL remains free of use for you, if your usage meets the criteria of these
+licenses, otherwise, a commercial license has to be purchased from
+GeometryFactory.
+
+Additional supported platforms:
+
+  - MS Visual C++, version 7.1.
+
+  - SunPro CC versions 5.4 and 5.5 on Solaris
+
+  - GNU g++ versions 3.2 and 3.3 on Linux, Solaris, Irix, cygwin, and FreeBSD.
+
+  - MipsPRO CC 7.30 and 7.40 with both the n32 and n64 ABIs.
+
+
+The following platforms are no longer supported:
+
+  - MS Visual C++, version 6.
+
+  - GNU g++ 2.95.2 (2.95.3 is still supported)
+
+  - Kai C++ and Borland C++, all versions
+
+
+The following functionality has been added or changed:
+
+All
+
+  - The CORE library for exact computations is now distributed as part of CGAL
+    as well.
+
+
+
+* Kernels
+
+  - 3 typedefs have been added to ease the choice of a robust and fast kernel:
+
+      - Exact_predicates_inexact_constructions_kernel
+
+      - Exact_predicates_exact_constructions_kernel
+
+      - Exact_predicates_exact_constructions_kernel_with_sqrt
+
+
+  - Progress has been made towards the complete adaptability and extensibility
+    of our kernels.
+
+  - New faster Triangle_3 intersection test routines.
+    (see Erratum)
+
+  - Added a Kernel concept archetype to check that generic algorithms don't use
+    more functionality than they should.
+
+  - A few more miscellaneous functions.
+
+
+* Basic Library
+
+  - 2D Apollonius Graph (new package)
+    Algorithms for computing the Apollonius graph in two dimensions. The
+    Apollonius graph is the dual of the Apollonius diagram, also known as the
+    additively weighted Voronoi diagram. The latter can be thought of as the
+    Voronoi diagram of a set of circles under the Euclidean metric, and it is a
+    generalization of the standard Voronoi diagram for points. The algorithms
+    provided are dynamic.
+
+  - dD Min Sphere of Spheres (new package)
+    Algorithms to compute the smallest enclosing sphere of a given set of
+    spheres in Rd. The package provides an algorithm with maximal expected
+    running time O(2O(d) n) and a fast and robust heuristic (for dimension less
+    than 30).
+
+  - Spatial Searching (new package)
+    Provides exact and approximate distance browsing in a set of points in d-
+    dimensional space using implementations of algorithms supporting:
+
+      - both nearest and furthest neighbor searching
+
+      - both exact and approximate searching
+
+      - (approximate) range searching
+
+      - (approximate) k-nearest and k-furthest neighbor searching
+
+      - (approximate) incremental nearest and incremental furthest neighbor
+        searching
+
+      - query items representing points and spatial objects.
+
+
+  - Kd-tree
+    this package is deprecated, its documentation is removed. It is replaced by
+    the Spatial Searching package.
+
+  - Largest_empty_rectangle_2
+    Given a set of points P in the plane, the class
+    Largest_empty_iso_rectangle_2 is a data structure that maintains an iso-
+    rectangle with the largest area among all iso-rectangles that are inside a
+    given iso-rectangle bounding box, and that do not contain any point of the
+    point set P.
+
+  - 2D Triangulation and 3D Triangulation
+
+      - The classes Triangulation_data_structure_2 (and 3), which implements
+        the data structure for 2D triangulation class, now makes use of CGAL::
+        Compact_container (see Support Library section below).
+
+      - The triangulation classes use a Rebind mecanism to provide the full
+        flexibility on Vertex and Face base classes. This means that it is
+        possible for the user to derive its own Face of Vertex base class,
+        adding a functionality that makes use of types defined by the
+        triangulation data structure like Face_handle or Vertex_handle.
+
+      - New classes Triangulation_vertex_base_with_info_2 (and 3) and
+        Triangulation_face_base_with_info_2 (and 3) to make easier the
+        customisation of base classes in most cases.
+
+
+  - 2D Triangulation
+
+      - Regular triangulation provides an easy access to hidden points.
+
+      - The Triangulation_hierarchy_2, which provide an efficient location data
+        structure, can now be used with any 2D triangulation class plugged in
+        (including Regular triangulations).
+
+
+  - 3D Triangulation
+
+      - faster vertex removal function in Delaunay_triangulation_3.
+
+      - Delaunay_triangulation_3 is now independent of the order of insertions
+        of the points (in case of degenerate cosphericity).
+
+      - Regular_triangulation_3 now hides vertices (and updates itself) when
+        inserting a coinciding point with greater weight. This required a new
+        predicate.
+
+      - deprecated functions: copy_triangulation(), push_back(),
+        set_number_of_vertices().
+
+      - Triangulation_3 now gives non-const access to the data structure.
+
+
+  - Interval Skip List (new package)
+    An interval skip list is a data strucure for finding all intervals that
+    contain a point, and for stabbing queries, that is for answering the
+    question whether a given point is contained in an interval or not.
+
+  - Planar Maps and Arrangements
+    The changes concern mainly the traits classes.
+       1. New traits hierarchy and interface: The set of requirements was made
+          sound and complete. A couple of requirements were eliminated, few
+          others were redefined, and some were renamed. A hierarchy of three
+          traits classes for the Planar_map_2, Planar_map_with_intersections_2,
+          and Arrangement_2 types was established to include only the necessary
+          requirements at each level. It was determined that for the aggregate
+          insertion- operation based on a sweep-line algorithm only a subset of
+          the requirements is needed. Preconditions were added where
+          appropriate to tighten the requirements further.
+          The following functions have been renamed:
+
+            - point_is_same() renamed to point_equal()
+
+            - curve_is_same() renamed to curve_equal()
+
+            - curve_is_in_x_range() renamed to point_in_x_range()
+
+            - curve_compare_at_x() renamed to curves_compare_y_at_x()
+              Furthermore, a precondition has been added that the reference
+              point is in the x-range of both curves.
+
+            - curve_compare_at_x_right() renamed to
+              curves_compare_y_at_x_to_right(). Furthermore, a precondition has
+              been added that both curves are equal at the reference point and
+              defined to its right.
+
+            - curve_compare_at_x_left() renamed to
+              curves_compare_y_at_x_to_left(). Furthermore, a precondition has
+              been added that both curves are equal at the reference point and
+              defined to its right.
+
+            - curve_get_point_status() renamed to curve_compare_y_at_x().
+              Furthermore, a precondition has been added that the point is in
+              the x-range of the curve. Consequently, the function now returns
+              a Comparison_result (instead of a special enum).
+
+            - make_x_monotone() renamed to curve_make_x_monotone() See more
+              details below.
+
+            - curve_flip() renamed to curve_opposite()
+
+          The following functions have been removed:
+
+            - curve_is_between_cw()
+
+            - point_to_left()
+
+            - point_to_right()
+
+            - is_x_monotone()
+
+            - point_reflect_in_x_and_y()
+
+            - curve_reflect_in_x_and_y()
+
+            - do_intersect_to_right()
+
+            - do_intersect_to_left()
+
+          Most functions, are required by the PlanarMapTraits_2 concept, except
+          for the make_x_monotone(), nearest_intersection_to_right(),
+          nearest_intersection_to_left(), curves_overlap() and curve_opposite
+          (). PlanarMapWithIntersectionsTraits_2 requires all these functions,
+          except curve_opposite(), needed only by the ArrangementTraits_2
+          concept.
+
+          Furthermore, the two functions curve_compare_at_x_left() and
+          nearest_intersection_to_left() can be omitted, if the two functions
+          point_reflect_in_x() and curve_reflect_in_x() are implemented.
+          Reflection can be avoided, if the two _left functions are supplied.
+
+       2. The type X_curve_2 of the PlanarMapWithIntersectionsTraits_2 concept
+          was renamed to X_monotone_curve_2, and the distinction between this
+          type and the Curve_2 type was made firm. The method is_x_monotone()
+          of the PlanarMapWithIntersectionsTraits_2 concept was removed. The
+          related method curve_make_x_monotone() is now called for each input
+          curve of type Curve_2 when curves are inserted into a
+          Planar_map_with_intersections_2 to subdivide the input curve into x-
+          monotone sub-curves (and in case the curve is already x-monotone,
+          this function is responsible for casting it to an x-monotone curve).
+       3. New and improved traits classes:
+       4. Conic traits - Arr_conic_traits_2 Support finite segments of
+          ellipses, hyperbolas and parabolas, as well as line segments. The
+          traits require an exact real number- type, such as leda_real or
+          CORE::Expr.
+       5. Segment cached traits - Arr_segment_cached_traits_2 This class uses
+          an improved representation for segments that helps avoiding cascaded
+          computations, thus achieving faster running times. To work properly,
+          an exact rational number-type should be used.
+       6. Polyline traits - Arr_polyline_traits_2 The polyline traits class has
+          been reimplemented to work in a more efficient, generic manner. The
+          new class replaces the obsolete Arr_polyline_traits class. It is
+          parameterized with a segment traits class.
+       7. Hyperbola and segment traits - Arr_hyper_segment_traits_2 Supports
+          line segments and segments of canonical hyperbolas. This is the type
+          of curves that arise when projecting segments in three-space
+          rotationally around a line onto a plane containing the line. Such
+          projections are often useful in CAD/CAM problems.
+       8. Removed old traits class:
+
+            - The models of the PlanarMapWithIntersectionsTraits_2 concept
+              below became obsolete, as the new conic traits, namely
+              Arr_conic_traits_2, supports the same functionality and is much
+              more efficient.
+
+                - Arr_circles_real_traits
+
+                - Arr_segment_circle_traits
+
+
+            - The segment traits class and the new polyline traits class were
+              reimplemented using standard CGAL-kernel calls. This essentially
+              eliminated the corresponding leda traits classes, namely:
+
+                - Pm_leda_segment_traits_2
+
+                - Arr_leda_segment_traits_2
+
+                - Arr_leda_polyline_traits
+
+              With the use of the Leda_rat_kernel new external package the same
+              functionality can be achieved with less overhead and more
+              efficiency.
+
+       9. Sweep Line
+
+            - The Sweep_line_2 package was reimplemented. As a consequence it
+              is much more efficient, its traits is tighter (namely neither the
+              two _left nor the reflection functions are required), and its
+              interface has changed a bit.
+                 1. The following global functions have been removed:
+
+                      - sweep_to_produce_subcurves_2()
+
+                      - sweep_to_produce_points_2()
+
+                      - sweep_to_construct_planar_map_2()
+
+                    Instead, the public methods of the Sweep_line_2 class
+                    listed below were introduced:
+
+                      - get_subcurves() - Given a container of curves, this
+                        function returns a list of curves that are created by
+                        intersecting the input curves.
+
+                      - get_intersection_points() - Given a range of curves,
+                        this function returns a list of points that are the
+                        intersection points of the curves.
+
+                      - get_intersecting_curves() - Given a range of curves,
+                        this function returns an iterator to the beginning of a
+                        range that contains the list of curves for each
+                        intersection point between any two curves in the
+                        specified range.
+
+                 2. It is possible to construct a planar map with intersections
+                    (or an arrangement) by inserting a range of curves into an
+                    empty map. This will invoke the sweep-line process to
+                    construct the map more efficiently.
+
+            - New interface functions to the Planar_map_with_intersections_2
+              class. The Planar_map_with_intersections_2 class maintains a
+              planar map of input curves that possibly intersect each other and
+              are not necessarily x-monotone. If an input curve, or a set of
+              input curves, are known to be x-monotone and pairwise disjoint,
+              the new functions below can be used to insert them into the map
+              efficiently.
+
+
+  - Polyhedral Surface
+
+      - The old design that was deprecated since CGAL 2.3 has been removed.
+
+      - Class Polyhedron_incremental_builder_3:
+
+          - Renamed local enum ABSOLUTE to ABSOLUTE_INDEXING, and RELATIVE to
+            RELATIVE_INDEXING to avoid conflicts with similarly named macros of
+            another library.
+
+          - Changed member functions add_vertex(), begin_facet(), and end_facet
+            () to return useful handles.
+
+          - Added test_facet() to check facets for validity before adding them.
+
+          - Added vertex( size_t i) to return Vertex_handle for index i.
+
+
+
+  - Halfedge Data Structure
+
+      - The old design that was deprecated since CGAL 2.3 has been removed.
+
+
+
+* Support Library
+
+  - New container class Compact_container, which (roughly) provides the
+    flexibility of std::list, with the memory compactness of std::vector.
+
+  - Geomview_stream: added a function gv.draw_triangles(InputIterator begin,
+    InputIterator end) which draws a set of triangles much more quickly than
+    one by one.
+
+  - Number types:
+
+      - number types are now required to provide a function: std::pair<double,
+        double> to_interval(const NT &).
+
+      - number types are now required to provide mixed operators with "int".
+
+      - CLN support removed.
+
+      - faster square() for MP_Float.
+
+      - added Gmp_q.
+
+
+  - Qt_widget:
+
+      - New classes:
+
+          - Qt_help_window: provides a simple way to show some helpful
+            information about a demo as an HTML page.
+
+          - Qt_widget_history: provides basic functionality to manipulate
+            intervals of Qt_widget class. The current visible area of Qt_widget
+            is mapped to an interval. Each interval could be stored in the
+            Qt_widget_history object. So you can use this object to navigate in
+            history. It is mostly used by Qt_widget_standard_toolbar.
+
+
+      - Changes:
+
+          - Qt_widget_standard_toolbar: is derived from QToolBar class, so pay
+            attention to modify your code, if you used this class. Some public
+            methods were introduced to control the history object that the
+            toolbar use to navigate.
+
+          - the icons are now part of libCGALQt.
+
+
+      - Deprecated members of Qt_widget:
+
+          - add_to_history(), clear_history(), back(), forth(): use forward(),
+            back() and clear_history() of the Qt_widget_standard_toolbar
+            instead.
+
+          - custom_redraw(): use redraw_on_back() and redraw_on_front()
+            instead.
+
+
+      - Optimizations: the output operators of the following classes have been
+        optimized:
+
+          - CGAL::Segment_2 (now tests for intersection with the drawing area)
+
+          - CGAL::Triangle_2 (now tests for intersection with the drawing area)
+
+          - CGAL::Triangulation_2 (is optimized for faster display on zooming)
+
+
+
+
+* Erratum in the Kernel manual
+
+  - Intersection test routines
+    The documentation of CGAL::do_intersect should mention, for the 3D case:
+    Also, in three-dimensional space Type1 can be
+
+      - either Plane_3<Kernel>
+
+      - or Triangle_3<Kernel>
+
+    and Type2 any of
+
+      - Plane_3<Kernel>
+
+      - Line_3<Kernel>
+
+      - Ray_3<Kernel>
+
+      - Segment_3<Kernel>
+
+      - Triangle_3<Kernel>
+
+
+    In the same way, for Kernel::DoIntersect_3:
+    for all pairs Type1 and Type2, where the type Type1 is
+
+      - either Kernel::Plane_3
+
+      - or Kernel::Triangle_3
+
+    and Type2 can be any of the following:
+
+      - Kernel::Plane_3
+
+      - Kernel::Line_3
+
+      - Kernel::Ray_3
+
+      - Kernel::Segment_3
+
+      - Kernel::Triangle_3
+
+
+    Philippe Guigue (INRIA Sophia-Antipolis) should be mentioned as one of the
+    authors.
+
+
+
+-------------------------------- Release 2.4 --------------------------------
+
+Release date: May 2002
+
+Version 2.4 differs from version 2.3 in the platforms that are supported and in
+functionality. There have also been a number of bug fixes for this release.
+
+Additional supported platforms:
+
+  - Microsoft Visual C++, version 7.
+
+  - SunPro 5.3 (with patch 111685-05) on Solaris
+
+  - g++ 3.1 on Linux and Solaris
+
+
+The following functionality has been added or changed:
+
+
+
+* Kernels
+
+  - Point_d has been removed from the 2D and 3D kernels. This type is now
+    available from the d-dimensional kernel only.
+
+
+* Basic Library
+
+  - 2D Polygon Partitioning
+    Traits requirements for optimal partitioning have been changed slightly.
+
+
+  - 2D Sweep line
+    A new package that implements a sweep-line algorithm to compute
+    arrangements of curves for different families of curves, which are not
+    necessarily line segments (e.g., it also works for circular arcs). The
+    resulting output can be the list of vertex points, the resulting subcurves
+    or a planar map.
+
+
+  - Planar Maps and Arrangements
+
+      - New quicker insertion functions of Planar_map_2 for cases where more
+        precomputed information is available regarding the position of the
+        inserted curve in the map.
+
+      - New query function for planar maps that determines whether a given
+        point is within a given face of the planar map.
+
+      - New iterator over edges of planar maps in addition to the existing
+        iterator over halfedges.
+
+      - New copy constructor and assignment operator for arrangements.
+
+
+
+
+  - Polyhedral Surface
+
+      - new design introduced with release 2.3 now supported by VC7 compiler
+
+      - Extended functionality of Polyhedron_incremental_builder: absolute
+        indexing allows one to add new surfaces to existing ones.
+
+
+
+
+  - 2D Triangulation
+
+      - There is a new triangulation data structure replacing the two previous
+        ones. This new data structure is coherent with the 3d triangulation
+        data structure and offer the advantages of both previous ones. Backward
+        compatibility is ensured and this change is transparent for the user of
+        triangulation classes.
+
+      - Constrained and Delaunay constrained triangulations are now able to
+        handle intersecting input constraints. The behavior of constrained
+        triangulations with repect to intersection of input constraints can be
+        customized using an intersection tag.
+
+      - A new class Constrained_triangulation_plus offers a constrained
+        hierarchy on top of a constrained triangulations. This additionnal data
+        structure describes the subdivision of the original constraints into
+        edges of the triangulations.
+
+
+
+
+  - 3D Triangulation
+
+      - Running time improved by a better and more compact management of memory
+        allocation
+
+      - Various improvements and small functionalities added:
+
+          - Triangulation_3<GT,Tds>::triangle() returns a triangle oriented
+            towards the outside of the cell c for facet (c,i)
+
+          - New function insert(Point, Locate_type, Cell_handle, int, int)
+            which avoids the location step.
+
+          - New function to get access to cells in conflict in a Delaunay
+            insertion : find_conflicts() and insert_in_hole()
+
+          - New function TDS::delete_cells(begin, end).
+
+          - New functions : degree(v), reorient(), remove_decrease_dimension(),
+            remove_from_simplex().
+
+
+      - Changes of interface:
+
+          - vertices and cells are the same for the triangulation data
+            structure and the geometric triangulation
+
+          - the triangulation data structure uses Vertex_handle (resp
+            Cell_handle) instead of Vertex* (resp Cell*).
+
+          - incident_cells() and incident_vertices() are templated by output
+            iterators
+
+          - changes in the iterators and circulators interface:
+
+              - Iterators and circulators are convertible to handles
+                automatically, no need to call "->handle()" anymore.
+
+              - Vertex_iterator split into All_vertices_iterator and
+                Finite_vertices_iterator (and similar for cells...).
+
+              - TDS::Edge/Facet iterators now support operator->.
+
+
+
+
+
+
+  - 2D Search structures
+    Additional range search operations taking a predicate functor have been
+    added
+
+
+* Support Library
+
+  - Qt_widget
+
+      - We have added a new class for visualization of 2D CGAL objects. It is
+        derived from Trolltech's Qt class QWidget and privdes a used to scale
+        and pan.
+
+      - Some demos were developed for the following packages: 2D Alpha shapes,
+        2D Convex Hull, Largest empty 2D rectangle, Maximum k-gon, Minimum
+        ellipse, Minimum 2D quadrilateral, 2D polygon partitioning 2D regular
+        and constrained triangulation.
+
+      - Tutorials are available to help users get used to Qt_widget
+
+
+
+
+  - Timer
+    Fixed Timer class (for user process time) to have no wrap-around anymore on
+    Posix-compliant systems.
+
+The following functionality is no longer supported:
+
+  - Planar maps of infinite curves (the so-called planar map bounding-box).
+
+
+Bugs in the following packages have been fixed: 3D Convex hull, 2D Polygon
+partition, simple polygon generator
+
+Also attempts have been made to assure compatability with the upcoming LEDA
+release that introduces the leda namespace.
+
+
+* Known problems
+
+  - 2D Nef Polyhedra contains a memory leak. Memory problems are also the
+    likely cause of occasional run-time errors on some platforms.
+
+  - The d-dimensional convex hull computation produces run-time errors on some
+    platforms because of memory management bugs.
+
+  - The new Halfedge Data Structure design introduced with release 2.3 does not
+    work on VC6. See the release notes in the manual for more information.
+
+  - The following deficiencies relate to planar maps, planar maps of
+    intersecting curves (pmwx), arrangements and sweep line.
+
+      - On KCC, Borland and SunPro we guarantee neither compilation nor correct
+        execution for all of the packages above.
+
+      - On VC6 and VC7 we guarantee neither compilation nor correct execution
+        of the sweep line package.
+
+      - On CC (on Irix 6.5) the trapezoidal decomposition point location
+        strategy is problematic when used with planar maps, pmwx, or
+        arrangements (mind that this is the default for planar maps).
+
+      - On CC (on Irix 6.5) sweep line with polyline traits does not compile
+        (mind that the so-called leda polyline traits does compile).
+
+      - On g++ (on Irix 6.5) the segment-circle (Arr_segment_circle_traits_2)
+        traits does not compile for either of the above packages.
+
+
+
+-------------------------------- Release 2.3 --------------------------------
+
+Release date: August 2001
+
+Version 2.3 differs from version 2.2 in the platforms that are supported and in
+functionality.
+
+Additional supported platform:
+
+  - Gnu g++ 3.0 on Solaris and Linux
+
+
+The following functionality has been added:
+
+
+
+* Kernels
+
+  - The 2D and 3D kernels now serve as models of the new kernel concept
+    described in the recent paper, "An Adaptable and Extensible Geometry
+    Kernel" by Susan Hert, Micheal Hoffmann, Lutz Kettner, Sylvain Pion, and
+    Michael Seel to be presented at WAE 2001 (and soon available as a technical
+    report). This new kernel is completely compatible with the previous design
+    but is more flexible in that it allows geometric predicates as well as
+    objects to be easily exchanged and adapted individually to users' needs.
+
+  - A new kernel called Simple_homogeneous is available. It is equivalent to
+    Homogeneous but without reference-counted objects.
+
+  - A new kernel called Filtered_kernel is available that allows one to build
+    kernel traits classes that use exact and efficient predicates.
+
+  - There are two classes, Cartesian_converter and Homogeneous_converter that
+    allows one to convert objects between different Cartesian and homogeneous
+    kernels, respectively.
+
+  - A new d-dimensional kernel, Kernel_d is available. It provides diverse
+    kernel objects, predicates and constructions in d dimensions with two
+    representations based on the kernel families Cartesean_d and Homogeneous_d
+
+
+* Basic Library
+Almost all packages in the basic library have been adapted to the new kernel
+design to realize the flexibility this design makes possible. In several
+packages, this means that the traits class requirements have changed to conform
+to the function objects offered in the kernels so the kernels themselves can be
+used as traits classes in many instances.
+
+
+  - 2D Convex Hull
+    The traits requirements have changed slightly to bring them in line with
+    the CGAL kernels.
+
+  - 3D Convex Hull
+
+      - The function convex_hull_3 now uses a new implementation of the
+        quickhull algorithm and no longer requires LEDA.
+
+      - A new convex_hull_incremental_3 function based on the new d-dimensional
+        convex hull class is available for comparison purposes.
+
+
+
+  - Convex_hull_d, Delaunay_d
+    Two new application classes offering the calculation of d-dimensional
+    convex hulls and delaunay triangulations
+
+
+  - Polygons and Polygon Operations
+
+      - The traits class requirements have been changed.
+
+      - The simplicity test has a completely new implementation.
+
+      - Properties like convexity, simplicity and area can now be cached by
+        polygons. You need to set a flag to select this behaviour.
+
+
+
+
+
+  - Planar Nef Polyhedra
+    A new class (Nef_polyhedron_2) representing planar Nef polyhedra =
+    rectilinearly bounded points sets that are the result of binary and
+    topological operations starting from halfplanes.
+
+
+  - A new package offering functions to partition planar polygons into convex
+    and y-monotone pieces is available.
+
+
+  - Planar Maps and Arrangements
+
+      - A new class Planar_map_with_intersections_2<Planar_map> for planar maps
+        of possibly intersecting, possibly non-x-monotone, possibly overlapping
+        curves (like Arrangement_2 but without the hierarchy tree).
+
+      - I/O utilities for planar maps and arrangements for textual and
+        graphical streams. (It is possible to save and later reload built
+        planar maps or arrangements.)
+
+      - New arrangement traits class for line segments and circular arcs
+        (Arr_segment_circle_traits<NT>).
+
+      - New faster traits for polylines specialized for using the LEDA rational
+        kernel (Arr_leda_polylines_traits). The LEDA traits for segments was
+        also made faster.
+
+      - A new point location strategy (Pm_simple_point_location<Planar_map>).
+
+
+
+
+  - Halfedge Data Structure
+
+    The halfedge data structure has been completely revised. The new design is
+    more in line with the STL naming scheme and it provides a safe and coherent
+    type system throughout the whole design (no void* pointers anymore), which
+    allows for better extendibility. A user can add new incidences in the mesh
+    easily. The new design also uses standard allocators with a new template
+    parameter that has a suitable default.
+
+    The old design is still available, but its use is deprecated, see the
+    manual of deprecated packages for its documentation. Reported bugs in
+    copying the halfedge data structure (and therefore also polyhedral
+    surfaces) have been fixed in both designs. Copying a list-based
+    representation is now based on hash maps instead of std::map and is
+    therefore considerably faster.
+
+
+  - Polyhedral Surface
+
+    The polyhedral surface has been rewritten to work with the new halfedge
+    data structure design. The user level interface of the CGAL::Polyhedron_3
+    class is almost backwards compatible with the previous class. The
+    exceptions are the template parameter list, everything that relies on the
+    flexibility of the underlying halfedge data structure, such as a self-
+    written facet class, and that the distinction between supported normals and
+    supported planes has been removed. Only planes are supported. See the
+    manuals for suggestions how to handle normals instead of planes.
+
+    More example programs are provided with polyhedral surfaces, for example,
+    one about Euler operator and one computing a subdivision surface given a
+    control mesh as input.
+
+    The old design is still available for backwards compatibility and to
+    support older compiler, such as MSVC++6.0. For the polyhedral surface, old
+    and new design cannot be used simultaneously (they have identical include
+    file names and class names). The include files select automatically the old
+    design for MSVC++6.0 and the new design otherwise. This automatism can be
+    overwritten by defining appropriate macros before the include files. The
+    old design is selected with the CGAL_USE_POLYHEDRON_DESIGN_ONE macro. The
+    new design is selected with the CGAL_USE_POLYHEDRON_DESIGN_TWO macro.
+
+
+  - 2D Triangulation
+
+      - The geometric traits class requirements have been changed to conform to
+        the new CGAL kernels. CGAL kernel classes can be used as traits classes
+        for all 2D triangulations except for regular triangulations.
+
+      - Additionnal functionality:
+
+          - dual method for regular triangulations (to build a power diagram)
+
+          - unified names and signatures for various "find_conflicts()" member
+            functions in Delaunay and constrained Delaunay triangulation.
+
+          - As an alternative to the simple insert() member function, insertion
+            of points in those triangulation can be performed using the
+            combination of find_conflicts() and star_hole() which eventually
+            allows the user to keep track of deleted faces.
+
+
+      - More demos and examples
+
+
+
+  - 3D Triangulation
+
+      - Major improvements
+
+          - A new class Triangulation_hierarchy_3 that allows a faster point
+            location, and thus construction of the Delaunay triangulation
+
+          - A new method for removing a vertex from a Delaunay triangulation
+            that solves all degenerate cases
+
+          - Running time of the usual location and insertion methods improved
+
+
+      - A bit more functionality, such as
+
+          - New geomview output
+
+          - dual methods in Delaunay triangulations to draw the Voronoi diagram
+
+
+      - More demos and examples
+
+      - Changes in interface
+
+          - Traits classes requirements have been modified
+
+          - The kernel can be used directly as a traits class (except for
+            regular triangulation)
+
+          - insert methods in Triangulation_data_structure have a new interface
+
+
+
+
+  - A new class (Alpha_shapes_3) that computes Alpha shapes of point sets in 3D
+    is available.
+
+
+  - The traits requirements for matrix search and minimum quadrilaterals have
+    been changed to bring them in line with the CGAL kernels.
+
+
+  - Point_set_2
+
+      - now independent of LEDA; based on the CGAL Delaunay triangulation
+
+      - traits class requirements adapted to new kernel concept.
+
+      - function template versions of the provided query operations are
+        available
+
+
+
+* Support Library
+
+  - Number types:
+
+      - Lazy_exact_nt<NT> is a new number type wrapper to speed up exact number
+        types.
+
+      - MP_Float is a new multiprecision floating point number type. It can do
+        exact additions, subtractions and multiplications over floating point
+        values.
+
+
+  - In_place_list has a new third template parameter (with a suitable default)
+    for an STL-compliant allocator.
+
+  - Unique_hash_map is a new support class.
+
+  - Union_find is a new support class.
+
+  - Geomview_stream :
+
+      - Geomview version 1.8.1 is now required.
+
+      - no need to have a ~/.geomview file anymore.
+
+      - new output operators for triangulations.
+
+      - new output operators for Ray_2, Line_2, Ray_3, Line_3, Sphere_3.
+
+      - various new manipulators.
+
+
+  - Window stream In cooperation with Algorithmic Solutions, GmBH (distributors
+    of the LEDA library), we can now offer a visualization package downloadable
+    in binary form that supports visualization on a ported version of the LEDA
+    window lib.
+
+
+-------------------------------- Release 2.2 --------------------------------
+
+Release date: October 2000
+
+Version 2.2 differs from version 2.1 in the platforms that are supported and in
+functionality.
+
+Additional supported platforms:
+
+  - the KAI compiler (4.0) on Solaris 5.8
+
+  - Borland C++ (5.5)
+
+
+The following functionality has been added:
+
+  - There is a new, non-reference-counted kernel, Simple_cartesian. Because
+    reference counting is not used, and thus coordinates are stored within a
+    class, debugging is easier using this kernel. This kernel can also be
+    faster in some cases than the reference-counted Cartesian kernel.
+
+  - New optimisation algorithms
+
+      - Min_annulus_d - Algorithm for computing the smallest enclosing annulus
+        of points in arbitrary dimension
+
+      - Polytope_distance_d - Algorithm for computing the (squared) distance
+        between two convex polytopes in arbitrary dimension
+
+      - Width_3 - Algorithm for computing the (squared) width of points sets in
+        three dimensions
+
+
+  - 2D Triangulations
+
+      - There are now two triangulation data structures available in CGAL. The
+        new one uses a list to store the faces and allows one to represent two-
+        dimensional triangulations embedded in three spaces as well as planar
+        triangulations.
+
+      - The triangulation hierarchy which allows fast location query is now
+        available.
+
+
+  - Inifinite objects can now be included in planar maps.
+
+  - Removal as well as insertions of vertices for 3D Delaunay triangulations is
+    now possible.
+
+  - A generator for ``random'' simple polygons is now available.
+
+  - In directory demo/Robustness, programs that demonstrate typical robustness
+    problems in geometric computing are presented along with the solutions to
+    these problems that CGAL provides.
+
+
+The following functionality has been removed:
+
+  - The binary operations on polygons (union, intersection ...) have been
+    removed. Those operations were not documented in the previous release
+    (2.1). Arrangements can often be used as a substitute.
+
+
+
+-------------------------------- Release 2.1 --------------------------------
+
+Release date: January 2000
+
+Version 2.1 differs from version 2.0 in the platforms that are supported and in
+functionality.
+
+Supported platforms:
+
+  - the newest gnu compiler (2.95.2) on Sun, SGI, Linux and Windows.
+
+  - the Microsoft Visual C++ compiler, version 6.
+
+  - the mips CC compiler version 7.3 under Irix.
+
+Support for the old g++ compiler (2.8) and for mips CC 7.2 has been dropped.
+
+The following functionality has been added:
+
+  - Alpha shapes and weighted alpha shapes in 2D. Alpha shapes are a
+    generalization of the convex hull of a point set.
+
+  - Arrangements in 2D. Arrangements are related to and based on planar maps.
+    The major difference between the two is that curves are allowed to
+    intersect in the case of arrangements.
+
+  - Extensions to triangulations in 2D. Constrained triangulations are now
+    dynamic: they support insertions of new constraint as well as removal of
+    existing constraints. There are also constrained Delaunay triangulations.
+
+  - Triangulations in 3D were added, both Delaunay triangulations and regular
+    triangulations.
+
+  - Min_quadrilateral optimisations have been added. These are algorithms to
+    compute the minimum enclosing rectangle/parallelogram (arbitrary
+    orientation) and the minimum enclosing strip of a convex point set.
+
+  - 2d Point_set is a package for 2d range search operations, Delaunay
+    triangulation, nearest neighbor queries. This package works only if LEDA is
+    installed.
+
+  - Support for GeoWin visualization library. This also depends on LEDA.
+
+  - Support for using the CLN number type together with CGAL.
+
+
+
+-------------------------------- Release 2.0 --------------------------------
+
+Release date: June 1999
+
+The main difference from release 1.2 is the introduction of namespaces -
+- namespace std for code from the standard library and namespace CGAL for the
+CGAL library.
+
+
+-------------------------------- Release 1.2 --------------------------------
+
+Release date: January 1999
+
+Additions to release 1.1 include:
+
+
+  - topological map
+
+  - planar map overlay
+
+  - regular and constrained triangulations
+
+
+-------------------------------- Release 1.1 --------------------------------
+
+Release date: July 1998
+
+Additions to release 1.0 include:
+
+  - 3D intersections
+
+  - kD points
+
+  - 3D convex hull
+
+  - kD smallest enclosing sphere
+
+
+
+-------------------------------- Release 1.0 --------------------------------
+
+Release date: April 1998
+
+Additions to release 0.9 include:
+
+  - Polyhedral surfaces
+
+  - Halfedge Data Structure
+
+  - Planar maps
+
+
+
+-------------------------------- Release 0.9 --------------------------------
+
+Release date: June 1997
+
+Initial (beta) release of the CGAL library.
+
diff --git a/3rdparty/CGAL/CMakeLists.txt b/3rdparty/CGAL/CMakeLists.txt
new file mode 100644
index 0000000..0058828
--- /dev/null
+++ b/3rdparty/CGAL/CMakeLists.txt
@@ -0,0 +1,1079 @@
+# Top level CMakeLists.txt for CGAL
+# The name of our project is "CGAL".  CMakeLists files in this project can
+# refer to the root source directory of the project as ${CMAKE_SOURCE_DIR} or
+# ${CMAKE_SOURCE_DIR} and to the root binary directory of the project as
+# ${CMAKE_BINARY_DIR} or ${CMAKE_BINARY_DIR}.
+project(CGAL CXX C)
+
+# Minimal version of CMake:
+cmake_minimum_required(VERSION 2.8.11)
+
+# Tested version:
+cmake_policy(VERSION 2.8.11)
+
+#
+# Compatibility with CMake 3.0
+#
+if(POLICY CMP0042)
+  # Do not enable the use of MACOSX_RPATH
+  # http://www.cmake.org/cmake/help/v3.0/policy/CMP0042.html
+  cmake_policy(SET CMP0042 OLD)
+endif()
+
+# Compatibility with CMake 3.1
+if(POLICY CMP0054)
+  # http://www.cmake.org/cmake/help/v3.1/policy/CMP0054.html
+  # See the discussion https://github.com/CGAL/cgal/issues/189
+  cmake_policy(SET CMP0054 NEW)
+endif()
+
+if(POLICY CMP0056)
+  # http://www.cmake.org/cmake/help/v3.2/policy/CMP0056.html
+  #
+  # Fix a bug: `try_compile` should use `CMAKE_EXE_LINKER_FLAGS`.
+  # That variable can contain important flags like
+  #
+  #     -static-libstdc++ -static-libgcc
+  #
+  cmake_policy(SET CMP0056 NEW)
+endif()
+
+# Use GNUInstallDirst to get canonical paths
+include(GNUInstallDirs)
+
+#--------------------------------------------------------------------------------------------------
+#
+#                                    -= HEADER ONLY =-
+#
+#--------------------------------------------------------------------------------------------------
+if(CMAKE_MAJOR_VERSION GREATER 2)
+  # In header only mode, we use INTERFACE libraries, which was introduced in cmake 3.0.
+  # Thus this option is only enabled for cmake >= 3.0.
+  option(CGAL_HEADER_ONLY "Enable the header only version of CGAL" OFF )
+
+  if (CGAL_HEADER_ONLY)
+    set(CGAL_HEADER_ONLY TRUE CACHE BOOL "Enable cgal header only" FORCE)
+    add_definitions(-DCGAL_HEADER_ONLY)
+  endif (CGAL_HEADER_ONLY)
+
+endif()
+
+#--------------------------------------------------------------------------------------------------
+#
+#                                    -= PACKAGE SETUP =-
+#
+#--------------------------------------------------------------------------------------------------
+
+message( "== Setting paths ==" )
+
+if ( CGAL_BRANCH_BUILD )
+
+  message( STATUS "Build CGAL from ${CGAL_SCM_NAME}-branch: ${CGAL_SCM_BRANCH_NAME}" )
+
+  # list packages
+  file(GLOB CGAL_CONFIGURED_PACKAGES RELATIVE ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/*")
+  list(SORT CGAL_CONFIGURED_PACKAGES)
+  list(REMOVE_ITEM CGAL_CONFIGURED_PACKAGES copyright CMakeLists.txt .svn .git)
+
+  # detect and remove not existing package-directories
+  foreach (package ${CGAL_CONFIGURED_PACKAGES})
+    if (NOT IS_DIRECTORY "${CMAKE_SOURCE_DIR}/${package}")
+      list(APPEND CGAL_WRONG_PACKAGES ${package})
+    elseif(NOT IS_DIRECTORY "${CMAKE_SOURCE_DIR}/${package}/package_info")
+      list(APPEND CGAL_WRONG_PACKAGES ${package})
+    endif()
+  endforeach()
+
+  find_program(CGAL_CREATE_CMAKE_SCRIPT cgal_create_cmake_script
+               HINT ${CMAKE_SOURCE_DIR}/Scripts/scripts
+	       DOC "Script cgal_create_cmake_script, that creates CMakeLists.txt files"
+	       NO_DEFAULT_PATH
+	       NO_CMAKE_ENVIRONMENT_PATH)
+
+  if (DEFINED CGAL_WRONG_PACKAGES)
+    message(STATUS "Removed not-a-package: ${CGAL_WRONG_PACKAGES}")
+    list(REMOVE_ITEM CGAL_CONFIGURED_PACKAGES ${CGAL_WRONG_PACKAGES})
+  endif()
+
+  set(CGAL_CONFIGURED_PACKAGES_NAMES ${CGAL_CONFIGURED_PACKAGES})
+  set(CGAL_CONFIGURED_PACKAGES)
+  foreach (package ${CGAL_CONFIGURED_PACKAGES_NAMES})
+    list(APPEND CGAL_CONFIGURED_PACKAGES "${CMAKE_SOURCE_DIR}/${package}")
+  endforeach()
+
+
+  set(CGAL_INSTALLATION_PACKAGE_DIR "${CMAKE_SOURCE_DIR}/Installation" CACHE INTERNAL "Directory containing the Installation package")
+  set(CGAL_MAINTENANCE_PACKAGE_DIR "${CMAKE_SOURCE_DIR}/Maintenance" CACHE INTERNAL "Directory containing the Maintenance package")
+  set(CGAL_CORE_PACKAGE_DIR "${CMAKE_SOURCE_DIR}/Core" CACHE INTERNAL "Directory containing the Core package")
+  set(CGAL_GRAPHICSVIEW_PACKAGE_DIR "${CMAKE_SOURCE_DIR}/GraphicsView" CACHE INTERNAL "Directory containing the GraphicsView package")
+
+  message(STATUS "Installation package directory: ${CGAL_INSTALLATION_PACKAGE_DIR}")
+  message(STATUS "Maintenance package directory: ${CGAL_MAINTENANCE_PACKAGE_DIR}")
+  message(STATUS "Core package directory: ${CGAL_CORE_PACKAGE_DIR}")
+
+else ( CGAL_BRANCH_BUILD )
+
+  # get release name
+  file(TO_CMAKE_PATH ${CMAKE_SOURCE_DIR} CMAKE_SOURCE_CDIR)
+  string(REGEX REPLACE "^/" "" CMAKE_SOURCE_DDIR ${CMAKE_SOURCE_CDIR})
+  string(REPLACE "/" ";" CMAKE_SOURCE_PDIR ${CMAKE_SOURCE_DDIR})
+  list(GET CMAKE_SOURCE_PDIR -1 CGAL_RELEASE_NAME)
+  message( STATUS "Build CGAL from release in directory ${CGAL_RELEASE_NAME}" )
+
+  set(CGAL_CONFIGURED_PACKAGES_NAMES ${CGAL_RELEASE_NAME})
+
+  # list packages
+  set(CGAL_CONFIGURED_PACKAGES "${CMAKE_SOURCE_DIR}")
+
+  set(CGAL_INSTALLATION_PACKAGE_DIR "${CMAKE_SOURCE_DIR}" CACHE INTERNAL "Directory containing the Installation package")
+  set(CGAL_MAINTENANCE_PACKAGE_DIR "${CMAKE_SOURCE_DIR}" CACHE INTERNAL "Directory containing the Maintenance package")
+  set(CGAL_CORE_PACKAGE_DIR "${CMAKE_SOURCE_DIR}" CACHE INTERNAL "Directory containing the Core package")
+  set(CGAL_GRAPHICSVIEW_PACKAGE_DIR "${CMAKE_SOURCE_DIR}" CACHE INTERNAL "Directory containing the GraphicsView package")
+
+endif (CGAL_BRANCH_BUILD )
+
+#message(STATUS "Packages found: ${CGAL_CONFIGURED_PACKAGES}")
+
+list(SORT CGAL_CONFIGURED_PACKAGES_NAMES)
+if(IS_DIRECTORY "${CMAKE_SOURCE_DIR}/Documentation")
+  # Rescope CGAL_CONFIGURED_PACKAGES_NAMES
+  # We need this variable in the Doxygen configuration process. Reset it
+  # and change the scope to the parent scope.
+  # Philipp Moeller, 2013-05-302013-05-302013-05-30
+  set(CGAL_CONFIGURED_PACKAGES_NAMES ${CGAL_CONFIGURED_PACKAGES_NAMES} PARENT_SCOPE)
+endif()
+
+message(STATUS "Packagenames: ${CGAL_CONFIGURED_PACKAGES_NAMES}")
+message( "== Setting paths (DONE) ==\n" )
+
+message( "== Generate version files ==")
+
+if ( CGAL_BRANCH_BUILD ) 
+    
+  #
+  # Create version files
+  #
+
+  file(STRINGS "${CGAL_MAINTENANCE_PACKAGE_DIR}/release_building/MAJOR_NUMBER" CGAL_MAJOR_VERSION REGEX "[0-9]*")
+  file(STRINGS "${CGAL_MAINTENANCE_PACKAGE_DIR}/release_building/MINOR_NUMBER" CGAL_MINOR_VERSION REGEX "[0-9]*")
+  file(STRINGS "${CGAL_MAINTENANCE_PACKAGE_DIR}/release_building/BUGFIX_NUMBER" CGAL_BUGFIX_VERSION REGEX "[0-9]*")
+
+  file(REMOVE ${CMAKE_BINARY_DIR}/VERSION)
+  if (CGAL_BUGFIX_VERSION AND CGAL_BUGFIX_VERSION GREATER 0)  
+    set(CGAL_CREATED_VERSION_NUM "${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}.${CGAL_BUGFIX_VERSION}")
+  else()
+    set(CGAL_CREATED_VERSION_NUM "${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}")
+  endif()
+
+  # Accessed in the documentation.
+  set(CGAL_CREATED_VERSION_NUM ${CGAL_CREATED_VERSION_NUM} PARENT_SCOPE)
+
+  # TODO EBEB set number of internal release (replace "900")
+  set(CGAL_BUILD_VERSION 900)
+  set(CGAL_CREATED_VERSION "${CGAL_CREATED_VERSION_NUM}-I-${CGAL_BUILD_VERSION}")
+  set(CGAL_VERSION "${CGAL_CREATED_VERSION_NUM}-I-${CGAL_BUILD_VERSION}")
+
+  file(WRITE "${CMAKE_BINARY_DIR}/VERSION" "${CGAL_CREATED_VERSION_NUM}")
+
+  message(STATUS "CGAL_VERSION is ${CGAL_CREATED_VERSION}")
+  set(CGAL_FULL_VERSION ${CGAL_CREATED_VERSION} CACHE INTERNAL "CGAL version")
+
+
+  #define CGAL_VERSION_NR 1030500135
+  string (LENGTH "${CGAL_MAJOR_VERSION}" CGAL_MAJOR_LEN)
+  if ("${CGAL_MAJOR_LEN}" EQUAL 1) 
+    set(CGAL_TMP_MAJOR "0${CGAL_MAJOR_VERSION}")
+  endif()
+  string (LENGTH "${CGAL_MINOR_VERSION}" CGAL_MINOR_LEN)
+  if ("${CGAL_MINOR_LEN}" EQUAL 1) 
+    set(CGAL_TMP_MINOR "0${CGAL_MINOR_VERSION}")
+  else()
+    set(CGAL_TMP_MINOR "${CGAL_MINOR_VERSION}")
+  endif()
+
+  set(CGAL_TMP_BUILD "${CGAL_BUILD_VERSION}")
+  string(LENGTH "${CGAL_TMP_BUILD}" CGAL_BUILD_LEN)
+
+  while(CGAL_BUILD_LEN LESS 4)
+    set(CGAL_TMP_BUILD "0${CGAL_TMP_BUILD}")
+    string(LENGTH "${CGAL_TMP_BUILD}" CGAL_BUILD_LEN)
+  endwhile()
+
+  set(CGAL_CREATED_VERSION_NR "1${CGAL_TMP_MAJOR}${CGAL_TMP_MINOR}${CGAL_BUGFIX_VERSION}${CGAL_TMP_BUILD}")
+  message(STATUS "CGAL_VERSION_NR is ${CGAL_CREATED_VERSION_NR}")
+
+  message(STATUS "CGAL_GIT_HASH is ${CGAL_GIT_HASH}")
+  message(STATUS "CGAL_CREATED_SVN_REVISION is ${CGAL_CREATED_SVN_REVISION} (dummy)")
+
+  file(REMOVE ${CMAKE_BINARY_DIR}/include/CGAL/version.h)
+  configure_file(${CGAL_INSTALLATION_PACKAGE_DIR}/config/version.h.in ${CMAKE_BINARY_DIR}/include/CGAL/version.h @ONLY)
+
+  #
+  # Duplicate files
+  #
+
+  if (CGAL_REPORT_DUPLICATE_FILES) 
+
+    message("== Searching for duplicate files ==")
+
+    foreach (package ${CGAL_CONFIGURED_PACKAGES})
+
+      file(GLOB_RECURSE CGAL_PACKAGE_HEADER_FILES FOLLOW_SYMLINKS ${package}/*.h)
+      list(SORT CGAL_PACKAGE_HEADER_FILES)
+      foreach (file ${CGAL_PACKAGE_HEADER_FILES})
+        string(REPLACE "${package}/" "" pure_file ${file})
+        if (NOT ${pure_file} MATCHES ".*CMakeFiles.*")
+          list(APPEND CGAL_HEADER_FILES ${pure_file})
+        endif()
+      endforeach()
+
+      file(GLOB_RECURSE CGAL_PACKAGE_CPP_FILES FOLLOW_SYMLINKS ${package}/*.cpp)
+      list(SORT CGAL_PACKAGE_CPP_FILES)
+      foreach (file ${CGAL_PACKAGE_CPP_FILES})
+        string(REPLACE "${package}/" "" pure_file ${file})
+        if (NOT ${pure_file} MATCHES ".*CMakeFiles.*")
+          list(APPEND CGAL_CPP_FILES ${pure_file})
+        endif()
+      endforeach()
+
+    endforeach()
+
+    list(SORT CGAL_HEADER_FILES)
+    set(CGAL_UNIQUE_HEADER_FILES ${CGAL_HEADER_FILES})
+    set(CGAL_DUPLICATE_HEADER_FILES ${CGAL_HEADER_FILES})
+    list(REMOVE_DUPLICATES CGAL_UNIQUE_HEADER_FILES)
+    #message(STATUS "Headers: ${CGAL_HEADER_FILES}")
+    foreach (file ${CGAL_UNIQUE_HEADER_FILES})
+      list(FIND CGAL_DUPLICATE_HEADER_FILES "${file}" CGAL_FILE_IDX)
+      list(REMOVE_AT CGAL_DUPLICATE_HEADER_FILES ${CGAL_FILE_IDX})
+    endforeach()
+    message(STATUS "Duplicate header files (will be repeated at end): ${CGAL_DUPLICATE_HEADER_FILES}")
+
+    list(SORT CGAL_CPP_FILES)
+    set(CGAL_UNIQUE_CPP_FILES ${CGAL_CPP_FILES})
+    set(CGAL_DUPLICATE_CPP_FILES ${CGAL_CPP_FILES})
+    list(REMOVE_DUPLICATES CGAL_UNIQUE_CPP_FILES)
+    #message(STATUS "CPPs: ${CGAL_CPP_FILES}")
+    foreach (file ${CGAL_UNIQUE_CPP_FILES})
+      list(FIND CGAL_DUPLICATE_CPP_FILES "${file}" CGAL_FILE_IDX)
+      list(REMOVE_AT CGAL_DUPLICATE_CPP_FILES ${CGAL_FILE_IDX})
+    endforeach()
+    message(STATUS "Duplicate cpp files (will be repeated at end): ${CGAL_DUPLICATE_CPP_FILES}")
+
+  endif(CGAL_REPORT_DUPLICATE_FILES)
+
+else()
+
+  if (NOT EXISTS "${CMAKE_SOURCE_DIR}/VERSION" OR NOT EXISTS "${CMAKE_SOURCE_DIR}/include/CGAL/version.h")
+    message(FATAL_ERROR "File VERSION or include/CGAL/version.h are missing, required by release-build.")
+  endif()
+
+  # 
+  # Read and parse CGAL version number from VERSION file
+  #
+
+  file( READ "${CMAKE_SOURCE_DIR}/VERSION" CGAL_VERSION )
+  # Comment from Laurent Rineau, 2012/06/28:
+  #   file(READ ..) should be replace by file(STRINGS ..), and then we take
+  #   the first line. That would avoid parsing errors when the VERSION file
+  #   contains a CR character!
+
+  set(CGAL_FULL_VERSION ${CGAL_VERSION})
+  string( REPLACE "-" "." CGAL_VERSION_TOKENS1 ${CGAL_VERSION} )
+  string( REPLACE "." ";" CGAL_VERSION_TOKENS ${CGAL_VERSION_TOKENS1} )
+  list( LENGTH CGAL_VERSION_TOKENS CGAL_VERSION_TOKENS_LEN )
+  list( GET CGAL_VERSION_TOKENS 0 CGAL_MAJOR_VERSION )
+
+  set(CGAL_MINOR_VERSION)
+  set(CGAL_BUGFIX_VERSION)
+  set(CGAL_BUILD_VERSION 1000)
+
+  if ( CGAL_VERSION_TOKENS_LEN GREATER 1 )
+    list( GET CGAL_VERSION_TOKENS 1 CGAL_MINOR_VERSION )
+  endif()
+
+  if ( CGAL_VERSION_TOKENS_LEN GREATER 2 )
+    list( GET CGAL_VERSION_TOKENS 2 CGAL_BUGFIX_VERSION )
+
+    # The following condition will be true the token #2 is not a number (if
+    # it is for example "I" or "Ic"):
+    if(NOT CGAL_BUGFIX_VERSION GREATER 0 AND NOT CGAL_BUGFIX_VERSION EQUAL 0)
+      set(CGAL_BUGFIX_VERSION 0)
+      if( CGAL_VERSION_TOKENS_LEN GREATER 3 )
+        list( GET CGAL_VERSION_TOKENS 3 CGAL_BUILD_VERSION )
+      endif()
+    else()
+      if( CGAL_VERSION_TOKENS_LEN GREATER 4 )
+        list( GET CGAL_VERSION_TOKENS 4 CGAL_BUILD_VERSION )
+      endif()
+    endif()
+    # If CGAL_BUILD_VERSION is not a strictly positive number, error
+    if(NOT CGAL_BUILD_VERSION GREATER 0)
+      message(WARNING 
+        "Error parsing VERSION file: CGAL_BUILD_VERSION is not a number.\n"
+        "The content of the VERSION file is:\n${CGAL_VERSION}\n"
+        "CGAL_BUILD_VERSION was set to:\n${CGAL_BUILD_VERSION}")
+      set(CGAL_BUILD_VERSION 1000)
+    endif()
+  endif()
+
+  if(NOT CGAL_BUGFIX_VERSION)
+    set(CGAL_BUGFIX_VERSION 0)
+  endif()
+
+  if(CGAL_BUGFIX_VERSION AND CGAL_BUGFIX_VERSION GREATER 0)
+    set(CGAL_CREATED_VERSION_NUM "${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}.${CGAL_BUGFIX_VERSION}")
+  else()
+    set(CGAL_CREATED_VERSION_NUM "${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}")
+  endif()
+endif()
+
+
+#--------------------------------------------------------------------------------------------------
+#
+#                                    -= BASIC SETUP =-
+#
+#--------------------------------------------------------------------------------------------------
+
+message( STATUS "CGAL_MAJOR_VERSION=${CGAL_MAJOR_VERSION}" )
+message( STATUS "CGAL_MINOR_VERSION=${CGAL_MINOR_VERSION}" )
+message( STATUS "CGAL_BUGFIX_VERSION=${CGAL_BUGFIX_VERSION}" )
+if(CGAL_BUILD_VERSION LESS 1000)
+  message( STATUS "CGAL_BUILD_VERSION=${CGAL_BUILD_VERSION}" )
+endif()
+
+# SONAME, SOVERSION
+#
+# The rule is that each new release or bug fix release should increse the soversion.
+#
+# SOVERSION is $(SONAME_VERSION).$(SOVERSION_MINOR).$(SOVERSION_RELEASE)
+#
+# - If the binary interface of libraries do not change from previous release
+#   (example: most bug fix releases), increase SOVERSION_RELEASE (this third number).
+# - If the binary interface is changed, but remains compatible with
+#   previous release (example: only addition of new functions), then increase
+#   SOVERSION_MINOR (second number) and set SOVERSION_RELEASE to 0.
+# - If the binary interface is changed in an incompatible way to previous
+#   release, then increase the SONAME_VERSION, and set the two other
+#   numbers to 0.
+# 
+# SOVERSION history: 
+#   CGAL<=3.5  : (unversionned)
+#   CGAL-3.5   : 4.0.0
+#   CGAL-3.5.1 : 4.0.1
+#   CGAL-3.6   : 5.0.0
+#   CGAL-3.6.1 : 5.0.0 (should have been 5.0.1)
+#   CGAL-3.7   : 6.0.0 (certainly: some types have been turned from int to
+#                        std::size_t, which is different on some platforms)
+#   CGAL-3.8   : 7.0.0 (At least CGAL::Random has changed its member fields.)
+#   CGAL-3.9   : 8.0.0 (No way to check the binary compatibility.)
+#   CGAL-4.0   : 9.0.0 (No way to check the binary compatibility.)
+#   CGAL-4.1   : 10.0.0 (No way to check the binary compatibility.)
+#   CGAL-4.2   : 10.0.1 (Nothing different in CGAL compiled libraries¹.)
+#   CGAL-4.3   : 10.0.2 (Nothing different in CGAL compiled libraries¹.)
+#   CGAL-4.4   : 10.0.3 (Nothing different in CGAL compiled libraries¹.)
+#   CGAL-4.5   : 10.0.4 (Nothing different in CGAL compiled libraries¹.)
+#   CGAL-4.6   : 11.0.0 (int->size_t in CGAL_ImageIO)
+#   CGAL-4.7   : 11.0.1 (Nothing different in CGAL compiled libraries.)
+#   CGAL-4.8   : 11.0.2 (Nothing different in CGAL compiled libraries.)
+#   CGAL-4.9   : 12.0.0 (Change the API/ABI in CGAL_ImageIO, but issue with 4GB images.)
+# ¹) According to http://upstream-tracker.org/versions/cgal.html
+
+set( CGAL_SONAME_VERSION "12" )
+set( CGAL_SOVERSION      "12.0.0" )
+
+message( STATUS "CGAL_SONAME_VERSION=${CGAL_SONAME_VERSION}" )
+message( STATUS "CGAL_SOVERSION     =${CGAL_SOVERSION}" )
+set( CGAL_BUILDING_LIBS TRUE )
+
+set( CGAL_VERSION_DIR     CGAL-${CGAL_VERSION} )
+set( CGAL_MODULES_REL_DIR cmake/modules )
+set( CGAL_MODULES_DIR     ${CGAL_INSTALLATION_PACKAGE_DIR}/${CGAL_MODULES_REL_DIR} )
+
+include(${CGAL_MODULES_DIR}/CGAL_Macros.cmake)
+cgal_setup_module_path()
+
+message( STATUS "CGAL_REFERENCE_CACHE_DIR=${CGAL_REFERENCE_CACHE_DIR}" )
+
+if ( RUNNING_CGAL_AUTO_TEST )
+  message(STATUS "Operating system:")
+  execute_process(COMMAND uname -a
+    TIMEOUT 5
+    OUTPUT_VARIABLE uname_a
+    ERROR_VARIABLE uname_a)
+  message(STATUS "${uname_a}")
+  CGAL_display_compiler_version()
+  if ( NOT "${CGAL_REFERENCE_CACHE_DIR}" STREQUAL "" )
+    if ( EXISTS ${CGAL_REFERENCE_CACHE_DIR} )
+      if ( EXISTS ${CGAL_REFERENCE_CACHE_DIR}/CMakeCache.txt )
+        message( STATUS "Loading reference cache from ${CGAL_REFERENCE_CACHE_DIR}" )
+        load_cache( ${CGAL_REFERENCE_CACHE_DIR} 
+          EXCLUDE CGAL_Core_LIBRARY 
+                  CGAL_CORE_PACKAGE_DIR
+                  WITH_CGAL_Core
+                  CGAL_INSTALLATION_PACKAGE_DIR
+                  CGAL_MAINTENANCE_PACKAGE_DIR
+                  CGAL_PDB_BINARY_DIR
+                  CGAL_PDB_SOURCE_DIR
+                  CGAL_BINARY_DIR
+                  CGAL_SOURCE_DIR)
+#        message("List of cache variables:")
+
+        ## The following lines removes nasty loaded cache values. We do not
+        ## want that the current build tree depends on binaries that were
+        ## build in the reference build tree.
+        get_property(cache_variables DIRECTORY PROPERTY CACHE_VARIABLES)
+        foreach(var ${cache_variables}) 
+#          get_property(var_value CACHE ${var} PROPERTY VALUE)
+#          get_property(type CACHE ${var} PROPERTY TYPE)
+          string(REGEX MATCH "^CGAL(_.*_(DEPENDS|BINARY_DIR)|_.*LIBRARY)$" var_name_matches ${var})
+          if(var_name_matches)
+            unset(${var} CACHE)
+#          else()
+#            message("${var}:${var_type}=${var_value}")
+          endif()
+        endforeach()
+
+
+      endif()
+    endif()
+  endif()
+endif()
+
+include(CGAL_Common)
+include(CGAL_GeneratorSpecificSettings)
+include(CGAL_CheckCXXFileRuns)
+
+mark_as_advanced(CMAKE_BACKWARDS_COMPATIBILITY)
+
+message( STATUS "USING CMake version: ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" )
+message( STATUS "System: ${CMAKE_SYSTEM_NAME}" )
+
+#--------------------------------------------------------------------------------------------------
+#
+#                                    -= FLAGS =-
+#
+#--------------------------------------------------------------------------------------------------
+
+if( MSVC )
+  
+  uniquely_add_flags ( CGAL_CXX_FLAGS "-D_CRT_SECURE_NO_DEPRECATE;-D_SCL_SECURE_NO_DEPRECATE;-D_CRT_SECURE_NO_WARNINGS;-D_SCL_SECURE_NO_WARNINGS" )
+  uniquely_add_flags ( CGAL_CXX_FLAGS "/fp:strict" )
+  uniquely_add_flags ( CGAL_CXX_FLAGS "/fp:except-" )
+  uniquely_add_flags ( CGAL_CXX_FLAGS "/wd4503" ) # Suppress warnings C4503 about "decorated name length exceeded"
+  uniquely_add_flags ( CGAL_CXX_FLAGS "/bigobj" ) # Use /bigobj by default
+
+  if ( RUNNING_CGAL_AUTO_TEST )
+    set(CMAKE_CXX_WARNING_LEVEL 2 CACHE STRING "MSVC C++ compiler warning level" FORCE)
+    mark_as_advanced(CMAKE_CXX_WARNING_LEVEL)
+  endif()
+    
+endif()
+
+if( "\"${CMAKE_CXX_COMPILER_ID}\"" MATCHES "SunPro" )
+  message( STATUS "Using SunPro compiler, using STLPort 4." )
+  
+  uniquely_add_flags( CGAL_CXX_FLAGS "-features=extensions;-library=stlport4;-D_GNU_SOURCE" )
+  uniquely_add_flags( CGAL_SHARED_LINKER_FLAGS "-library=stlport4" )
+  uniquely_add_flags( CGAL_EXE_LINKER_FLAGS    "-library=stlport4" )
+endif()
+
+if( "${CMAKE_CXX_COMPILER}" MATCHES "icl" OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc")
+  message( STATUS "Intel compiler is detected." )
+  set( IntelCompiler_FOUND TRUE )
+
+  get_dependency_version(IntelCompiler)
+
+  if( "${IntelCompiler_VERSION}" LESS "1100" )
+    message("Intel Compiler version ${IntelCompiler_VERSION} is not supported by CGAL-${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}! (too old, must be 11.0 or after)")
+  else()
+    message( STATUS "Using Intel Compiler version 11 or later. Adding -fp-model strict" )
+    if(WIN32)
+      uniquely_add_flags( CGAL_CXX_FLAGS "/fp:strict" )
+    else()
+      uniquely_add_flags( CGAL_CXX_FLAGS "-fp-model strict" )
+    endif()
+  endif()
+endif()
+
+
+if ( CMAKE_COMPILER_IS_GNUCXX )
+
+  set( GCC_FOUND TRUE )
+  
+  get_dependency_version(GCC)
+  
+  if ( "${GCC_VERSION}" MATCHES "Not" OR "${GCC_VERSION}" MATCHES "Unknown" )
+    set( GCC_FOUND FALSE )
+  endif()
+  
+  if ( GCC_FOUND )
+  
+    if ( RUNNING_CGAL_AUTO_TEST )
+      uniquely_add_flags( CGAL_CXX_FLAGS "-Wall" )
+      # Remove -g from the relevant CMAKE_CXX_FLAGS. This will also
+      # propagate to the rest of the tests, since we overwrite those
+      # flags with the ones used to build CGAL.
+      string(REGEX REPLACE "-g( |$)" ""
+        CMAKE_CXX_FLAGS
+        "${CMAKE_CXX_FLAGS}")
+      # We only allow the release types DEBUG and RELEASE, but handle
+      # all possible values just to be sure.
+      foreach(release_type DEBUG RELEASE MINSIZEREL RELWITHDEBINFO)
+        string(REGEX REPLACE "-g( |$)" ""
+          CMAKE_CXX_FLAGS_${release_type}
+          "${CMAKE_CXX_FLAGS_${release_type}}")
+      endforeach()
+
+    endif()
+    
+    if ( "${GCC_VERSION}" MATCHES "^[4-9]." )
+      message( STATUS "Using gcc version 4 or later. Adding -frounding-math" )
+      uniquely_add_flags( CGAL_CXX_FLAGS "-frounding-math" )
+    endif()
+    
+    if ( "${GCC_VERSION}" MATCHES "^4.2" )
+      message( STATUS "Using gcc version 4.2. Adding -fno-strict-aliasing" )
+      uniquely_add_flags( CGAL_CXX_FLAGS "-fno-strict-aliasing" )
+    endif()
+    
+    if ( "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "alpha" )
+      message( STATUS "Using gcc on alpha. Adding -mieee -mfp-rounding-mode=d" )
+      uniquely_add_flags( CGAL_CXX_FLAGS "-mieee -mfp-rounding-mode=d" )
+    endif()
+    
+  endif()
+  
+endif()
+
+message( "== Generate version files (DONE) ==\n")
+
+#--------------------------------------------------------------------------------------------------
+#
+#                                    -= External libraries =-
+#
+#--------------------------------------------------------------------------------------------------
+ 
+message("== Set up flags ==")
+
+include(CGAL_SetupFlags)
+
+message("== Set up flags (DONE) ==\n")
+
+message("== Detect external libraries ==")
+
+# this is the place to tell which external libs are supporting
+# Remarks: 
+#  External libs configured when Qt5 lib of cgal are required
+#  Coin is used in KDS, but no FindCoin or FindCOIN exists
+#  There exists FindF2C, FindIPE, FindMKL, but they are only used to support supporting libs
+list (INSERT CGAL_SUPPORTING_3RD_PARTY_LIBRARIES 0 GMP MPFR ZLIB OpenGL LEDA MPFI RS RS3 OpenNL Eigen3 BLAS LAPACK QGLViewer ESBTL Coin3D NTL IPE)
+if (NOT WIN32)
+  # GMPXX is not supported on WIN32 machines
+  list (INSERT CGAL_SUPPORTING_3RD_PARTY_LIBRARIES 1 GMPXX)
+endif()
+
+# Where CMake is run several times, to avoid duplicates
+list(REMOVE_DUPLICATES CGAL_SUPPORTING_3RD_PARTY_LIBRARIES)
+hide_variable(CGAL_SUPPORTING_3RD_PARTY_LIBRARIES)
+
+# set some to have special prefix
+macro( set_special_prefix library prefix)
+set(SPECIAL_PREFIXES "${SPECIAL_PREFIXES}set(CGAL_EXT_LIB_${library}_PREFIX \"${prefix}\")\n")
+set(CGAL_EXT_LIB_${library}_PREFIX ${prefix})
+endmacro()
+
+set_special_prefix(Qt5 QT)
+set_special_prefix(Eigen3 EIGEN3)
+set_special_prefix(QGLViewer QGLVIEWER)
+set_special_prefix(Coin3D COIN3D)
+
+# some libraries are essential (stl and Boost.Thread are treated in another way) 
+if($ENV{CGAL_DISABLE_GMP})
+  set(CGAL_DISABLE_GMP ON CACHE INTERNAL "")
+endif()
+if(CGAL_DISABLE_GMP)
+  message("Disable the GMP support")
+  list(LENGTH CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES CGAL_ESSENTIAL_LENGTH)
+  if(NOT CGAL_ESSENTIAL_LENGTH EQUAL 0)
+    list(REMOVE_ITEM CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES GMP MPFR)
+  endif()
+  unset(CGAL_CONFIGURED_LIBRARIES)
+  unset(CGAL_CONFIGURED_LIBRARIES CACHE)
+  unset(GMP_FOUND)
+  unset(GMP_FOUND CACHE)
+  unset(GMPXX_FOUND)
+  unset(GMPXX_FOUND CACHE)
+  unset(MPFR_FOUND)
+  unset(MPFR_FOUND CACHE)
+  unset(WITH_CGAL_Core)
+  unset(WITH_CGAL_Core CACHE)
+  unset(WITH_GMP)
+  unset(WITH_GMP CACHE)
+  unset(WITH_GMPXX)
+  unset(WITH_GMPXX CACHE)
+  unset(WITH_MPFR)
+  unset(WITH_MPFR CACHE)
+
+  # Nasty trick to make sure <gmp.h> is not used when CGAL_DISABLE_GMP is TRUE
+  file(WRITE "${CMAKE_BINARY_DIR}/include/gmp.h"
+    "#error GMP is disabled by the CMake option CGAL_DISABLE_GMP")
+else()
+  list(APPEND      CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES GMP MPFR)
+  # Where CMake is run several times, to avoid duplicates
+  list (REMOVE_DUPLICATES CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES)
+  file(REMOVE "${CMAKE_BINARY_DIR}/include/gmp.h")
+endif()
+hide_variable(CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES)
+
+foreach (lib ${CGAL_SUPPORTING_3RD_PARTY_LIBRARIES}) 
+
+  # set standard prefix
+  if(NOT DEFINED CGAL_EXT_LIB_${lib}_PREFIX)
+    set(CGAL_EXT_LIB_${lib}_PREFIX ${lib})
+  endif()
+  hide_variable(CGAL_EXT_LIB_${lib}_PREFIX)
+
+  # add option
+  list( FIND CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES "${lib}" POSITION )
+  if ( "${POSITION}" STRGREATER "-1" ) # if lib is essential
+   option(WITH_${lib} "Select external library ${lib}" ON)
+  else()
+    option(WITH_${lib} "Select external library ${lib}" OFF)
+  endif()
+
+endforeach()
+
+#--------------------------------------------------------------------------------------------------
+#
+#                                    -= DEPENDENCIES =-
+#
+#--------------------------------------------------------------------------------------------------
+
+#
+# The following variables are in the cache just so subdirectories can set them persistently.
+# But they are not intended to persist from run to run as normal cache variables.
+# Similar variables are created when a library is detected.
+#
+cache_set(CGAL_3RD_PARTY_PRECONFIGURED  "" )
+
+cache_set(CGAL_3RD_PARTY_DEFINITIONS    "" )
+cache_set(CGAL_3RD_PARTY_INCLUDE_DIRS   "" )
+cache_set(CGAL_3RD_PARTY_LIBRARIES      "" )
+cache_set(CGAL_3RD_PARTY_LIBRARIES_DIRS "" ) 
+
+# default is on, but some use-cases need to set it to off, e.g., debian packages
+option( CGAL_ENABLE_PRECONFIG "Select to allow to preconfiguration of external libraries" ON)
+
+# additional info: some header files in CGAL add additional code if
+# certain optional libs are installed, and some examples/tests rely on
+# this; e.g. in MPFI/RS in Algebraic_kernel_d. For these cases CGAL
+# and the example/test must be configured with MPFI (just one is not sufficient)
+
+include(CGAL_SetupDependencies)
+
+message("== Detect external libraries (DONE) ==\n")
+
+#--------------------------------------------------------------------------------------------------
+#
+#                                    -= Generation of compiler_config.h =-
+#
+#--------------------------------------------------------------------------------------------------
+
+# The variables set are the #defines expected by compiler_config.h
+# Note: CMake will not notice when files are added or removed
+# but this is probably OK for the installation procedure.
+
+message("== Write compiler_config.h ==")
+
+macro(add_config_flag flag)
+  if(${flag})
+      file(APPEND ${CMAKE_BINARY_DIR}/include/CGAL/compiler_config.h "#define ${flag} 1\n\n")
+    else()
+      file(APPEND ${CMAKE_BINARY_DIR}/include/CGAL/compiler_config.h "//#define ${flag} 1\n\n")
+    endif()
+endmacro()
+
+file(GLOB all_config_tests "${CGAL_INSTALLATION_PACKAGE_DIR}/config/testfiles/*.cpp")
+list(SORT all_config_tests)
+
+file(WRITE ${CMAKE_BINARY_DIR}/include/CGAL/compiler_config.h "//\n// compiler_config.h is included by CGAL headers to load the needed compiler settings.\n//\n// DO NOT EDIT compiler_config.h. It is generated by CMake.\n//\n\n")
+
+foreach(config_test_cpp ${all_config_tests})
+  # Test's name is .cpp's base name
+  get_filename_component(config_test_name ${config_test_cpp} NAME_WE)
+
+  # Compile and run ${config_test_cpp}. Exit code is stored in ${config_test_name}.
+  CHECK_CXX_FILE_RUNS(${config_test_cpp} ${config_test_name} ${config_test_name})
+  if(${config_test_name})
+    set(${config_test_name} 0)
+  else()
+    set(${config_test_name} 1)
+  endif()
+
+  add_config_flag(${config_test_name} ${config_test_name})
+endforeach()
+
+add_config_flag(CGAL_USE_GMP)
+add_config_flag(CGAL_USE_MPFR)
+add_config_flag(CGAL_USE_GMPXX)
+add_config_flag(CGAL_USE_LEDA)
+add_config_flag(CGAL_USE_MPFI)
+add_config_flag(CGAL_USE_RS)
+add_config_flag(CGAL_USE_NTL)
+
+add_config_flag( CGAL_BUILD_SHARED_LIBS )
+
+if (NOT ${WITH_CGAL_Core}) 
+  set(CGAL_USE_CORE FALSE)
+else()
+  set(CGAL_USE_CORE ${CGAL_USE_GMP})
+endif()
+add_config_flag( CGAL_USE_CORE )
+# ^^ there is CGAL_USE_CORE and not CGAL_HAS_CORE, as CORE is considered
+# as external lib and not as CGAL component (EBEB: 24 Jan 2012)
+
+if ( RUNNING_CGAL_AUTO_TEST AND MSVC )
+  file( APPEND "${CMAKE_BINARY_DIR}/include/CGAL/compiler_config.h" "#include <CGAL/Testsuite/vc_debug_hook.h>\n\n" )
+endif()
+
+#--------------------------------------------------------------------------------------------------
+#
+#                                    -= Installation Setup =-
+#
+#--------------------------------------------------------------------------------------------------
+
+set ( CGAL_INSTALL_INC_DIR "${CMAKE_INSTALL_INCLUDEDIR}" CACHE STRING "The folder where CGAL header files will be installed, relative to CMAKE_INSTALL_PREFIX" )
+set ( CGAL_INSTALL_LIB_DIR "${CMAKE_INSTALL_LIBDIR}"     CACHE STRING "The folder where CGAL libraries will be installed, relative to CMAKE_INSTALL_PREFIX" )
+
+if ( CGAL_WIN32_CMAKE_ON_CYGWIN )
+  exec_program(cygpath ARGS -w "${CMAKE_INSTALL_PREFIX}" OUTPUT_VARIABLE CMAKE_INSTALL_PREFIX2 )
+  file ( TO_CMAKE_PATH ${CMAKE_INSTALL_PREFIX2} CMAKE_INSTALL_PREFIX )
+endif()
+
+set ( CGAL_INSTALL_BIN_DIR   "${CMAKE_INSTALL_BINDIR}"
+  CACHE STRING "The folder where CGAL user-side scripts will be installed, relative to CMAKE_INSTALL_PREFIX"
+  )
+
+set ( CGAL_INSTALL_CMAKE_DIR "${CGAL_INSTALL_LIB_DIR}/CGAL"
+  CACHE STRING "The folder where CGAL CMake modules will be installed, relative to CMAKE_INSTALL_PREFIX" 
+  )
+
+set ( CGAL_INSTALL_DOC_DIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/doc/${CGAL_VERSION_DIR}"
+  CACHE STRING "The folder where CGAL documentation and license files will be installed, relative to CMAKE_INSTALL_PREFIX"
+  )
+
+set ( CGAL_INSTALL_MAN_DIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/man/man1"
+  CACHE STRING "The folder where manual pages for CGAL scripts will be installed, relative to CMAKE_INSTALL_PREFIX"
+  )
+
+message("== Write compiler_config.h (DONE) ==\n")
+
+#--------------------------------------------------------------------------------------------------
+#
+#                                    -= Build =-
+#
+#--------------------------------------------------------------------------------------------------
+
+
+# Enable testing with BUILD_TESTING
+option(BUILD_TESTING "Build the testing tree." OFF)
+include(CTest)
+
+message("== Generating build files ==")
+
+set(CGAL_LIBRARIES_DIR ${CMAKE_BINARY_DIR}/lib)
+
+set(CGAL_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/include)
+
+foreach (package ${CGAL_CONFIGURED_PACKAGES})
+  set(CGAL_INCLUDE_DIRS ${CGAL_INCLUDE_DIRS} ${package}/include)
+endforeach()
+
+include_directories (${CGAL_INCLUDE_DIRS})
+
+cache_get(CGAL_3RD_PARTY_PRECONFIGURED )
+
+cache_get(CGAL_3RD_PARTY_DEFINITIONS   )
+cache_get(CGAL_3RD_PARTY_INCLUDE_DIRS  )
+cache_get(CGAL_3RD_PARTY_LIBRARIES     )
+cache_get(CGAL_3RD_PARTY_LIBRARIES_DIRS) 
+
+add_subdirectory(src)
+
+#
+# Repeat some problems
+#
+message("== Generating build files (DONE) ==\n")
+
+if (CGAL_BRANCH_BUILD AND CGAL_REPORT_DUPLICATE_FILES )
+
+  message( STATUS "Problems: ")
+
+  if (CGAL_DUPLICATE_HEADER_FILES)
+    message(WARNING "WARNING: Duplicate header files")
+    foreach(hfile ${CGAL_DUPLICATE_HEADER_FILES})
+      message(STATUS "  File '${hfile}' multiply found in ")
+      foreach (package ${CGAL_CONFIGURED_PACKAGES})
+        file(GLOB_RECURSE CGAL_PACKAGE_HEADER_FILES FOLLOW_SYMLINKS ${package}/*.h)
+        list(SORT CGAL_PACKAGE_HEADER_FILES)
+        foreach (file ${CGAL_PACKAGE_HEADER_FILES})
+          string(REPLACE "${package}/" "" pure_file ${file})
+          if ("${pure_file}" STREQUAL "${hfile}")
+            message(STATUS "    ${package}")
+          endif()
+        endforeach()
+      endforeach()
+    endforeach()
+  endif()
+
+  if (CGAL_DUPLICATE_CPP_FILES)
+    message(WARNING "WARNING: Duplicate cpp files")
+    foreach(cfile ${CGAL_DUPLICATE_CPP_FILES})
+      message(STATUS "  File '${cfile}' multiply found in ")
+      foreach (package ${CGAL_CONFIGURED_PACKAGES})
+        file(GLOB_RECURSE CGAL_PACKAGE_CPP_FILES FOLLOW_SYMLINKS ${package}/*.cpp)
+        list(SORT CGAL_PACKAGE_CPP_FILES)
+        foreach (file ${CGAL_PACKAGE_CPP_FILES})
+          string(REPLACE "${package}/" "" pure_file ${file})
+          if ("${pure_file}" STREQUAL "${cfile}")
+            message(STATUS "    ${package}")
+          endif()
+        endforeach()
+      endforeach()
+    endforeach()
+  endif()
+
+endif()
+
+create_CGALconfig_files()
+
+#--------------------------------------------------------------------------------------------------
+#
+#                                    -= Installation Commands =-
+#
+#--------------------------------------------------------------------------------------------------
+
+# DESTINATION option is mandatory; skipping it breaks CPack!
+
+if(CGAL_INSTALL_DOC_DIR)
+  install(FILES AUTHORS CHANGES LICENSE LICENSE.FREE_USE LICENSE.GPL LICENSE.LGPL DESTINATION ${CGAL_INSTALL_DOC_DIR} )
+endif()
+
+#install all includes collected in trunk et cetera
+
+
+foreach (dir ${CGAL_CONFIGURED_PACKAGES})
+  if (EXISTS ${dir}/include/CGAL) 
+    install(DIRECTORY ${dir}/include/CGAL              DESTINATION ${CGAL_INSTALL_INC_DIR} PATTERN ".svn" EXCLUDE)
+  endif()
+endforeach()
+install(DIRECTORY ${CMAKE_BINARY_DIR}/include/CGAL     DESTINATION ${CGAL_INSTALL_INC_DIR} PATTERN ".svn" EXCLUDE)
+
+file(GLOB scripts "scripts/*")
+list(SORT scripts)
+list(REMOVE_ITEM scripts 
+  ${CMAKE_CURRENT_SOURCE_DIR}/scripts/cgal_create_assertions.sh 
+  ${CMAKE_CURRENT_SOURCE_DIR}/scripts/cgal_create_cmake_script_with_options)
+install(PROGRAMS ${scripts} DESTINATION ${CGAL_INSTALL_BIN_DIR})
+
+install(DIRECTORY ${CGAL_MODULES_REL_DIR}/                DESTINATION ${CGAL_INSTALL_CMAKE_DIR} )
+install(FILES     ${CGAL_MODULES_REL_DIR}/UseCGAL.cmake   DESTINATION ${CGAL_INSTALL_CMAKE_DIR} )
+
+if ( GMP_IN_AUXILIARY )
+  install(DIRECTORY auxiliary/gmp/include/ DESTINATION ${CGAL_INSTALL_INC_DIR} )
+  install(DIRECTORY auxiliary/gmp/lib/     DESTINATION ${CGAL_INSTALL_LIB_DIR} )
+endif()
+
+if ( ZLIB_IN_AUXILIARY )
+  install(DIRECTORY auxiliary/zlib/include/ DESTINATION ${CGAL_INSTALL_INC_DIR} )
+  install(DIRECTORY auxiliary/zlib/lib/     DESTINATION ${CGAL_INSTALL_LIB_DIR} )
+endif()
+
+
+install(FILES ${CMAKE_BINARY_DIR}/config/CGALConfig.cmake DESTINATION ${CGAL_INSTALL_CMAKE_DIR} )
+
+if(CGAL_INSTALL_MAN_DIR)
+  install(FILES auxiliary/cgal_create_cmake_script.1 DESTINATION ${CGAL_INSTALL_MAN_DIR} )
+endif()
+
+#--------------------------------------------------------------------------------------------------
+#
+#              -= Special installation commands to copy FindCGAL to the cmake directory =-
+#
+#--------------------------------------------------------------------------------------------------
+
+# Installing FindCGAL into cmake itself is implemented as a custom target
+# because it requires superuser privileges
+
+if ( NOT "${CMAKE_ROOT}" STREQUAL "" )
+  if ( EXISTS ${CMAKE_ROOT}/Modules )
+    add_custom_target( install_FindCGAL
+                      COMMAND ${CMAKE_COMMAND} -E copy ${CGAL_MODULES_DIR}/FindCGAL.cmake ${CMAKE_ROOT}/Modules
+                    ) 
+  endif()
+endif()  
+
+#--------------------------------------------------------------------------------------------------
+#
+#                                    -= APPLICATIONS =-
+#
+#--------------------------------------------------------------------------------------------------
+
+macro( add_programs subdir target ON_OFF )
+
+  cache_set( CGAL_EXECUTABLE_TARGETS "" )
+  
+  add_custom_target( ${target} )
+  
+  option( WITH_${target} "Select ${target}" ${ON_OFF} )
+  if ( WITH_${target} )
+    add_subdirectory( ${subdir} EXCLUDE_FROM_ALL )
+  endif()
+  
+  cache_get( CGAL_EXECUTABLE_TARGETS )
+  
+  foreach( CGAL_EXECUTABLE_TARGET ${CGAL_EXECUTABLE_TARGETS} )
+    add_dependencies( ${target} ${CGAL_EXECUTABLE_TARGET} )
+  endforeach()
+     
+endmacro()
+
+# This allows programs to locate CGALConfig.cmake
+set(CGAL_DIR ${CMAKE_BINARY_DIR} )
+
+if ( NOT RUNNING_CGAL_AUTO_TEST )
+
+  add_programs(examples examples OFF )
+  add_programs(demo     demos    OFF )
+  if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/test")
+    add_programs(test     tests    OFF )
+  endif()
+endif()
+
+#--------------------------------------------------------------------------------------------------
+#
+#                                            -= CPack =-
+#
+#--------------------------------------------------------------------------------------------------
+
+#option( WITH_CPACK "Create package generation rules")
+if( WITH_CPACK AND EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake" )
+
+    set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "CGAL - Computational Geometry Algorithms Library")
+    set(CPACK_PACKAGE_VENDOR "CGAL Open Source Project")
+    set(CPACK_PACKAGE_DESCRIPTION_FILE "${CGAL_INSTALLATION_PACKAGE_DIR}/README")
+    set(CPACK_RESOURCE_FILE_LICENSE "${CGAL_INSTALLATION_PACKAGE_DIR}/LICENSE")
+    set(CPACK_PACKAGE_VERSION_MAJOR "${CGAL_MAJOR_VERSION}")
+    set(CPACK_PACKAGE_VERSION_MINOR "${CGAL_MINOR_VERSION}")
+    set(CPACK_PACKAGE_VERSION_PATCH "${CGAL_BUGFIX_VERSION}")
+    set(CPACK_PACKAGE_INSTALL_DIRECTORY "CGAL ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
+    set(CPACK_SOURCE_PACKAGE_FILE_NAME "CGAL-${CGAL_VERSION}")
+    set(CPACK_RESOURCE_FILE_LICENSE "${CGAL_INSTALLATION_PACKAGE_DIR}/LICENSE")
+    
+    if(NOT DEFINED CPACK_SYSTEM_NAME)
+      set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
+    endif()
+    
+    if(${CPACK_SYSTEM_NAME} MATCHES "Windows")
+      if(CMAKE_CL_64)
+        set(CPACK_SYSTEM_NAME win64-${CMAKE_SYSTEM_PROCESSOR})
+      else()
+        set(CPACK_SYSTEM_NAME win32-${CMAKE_SYSTEM_PROCESSOR})
+      endif()
+    endif()
+    
+    if(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
+      set(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}-${CPACK_SYSTEM_NAME}")
+    endif()
+    
+    set(CPACK_PACKAGE_EXECUTABLES "CGAL" "CGAL")
+
+    if(WIN32 AND NOT UNIX)
+        set(CPACK_GENERATOR "NSIS")
+        # There is a bug in NSI that does not handle full unix paths properly. Make
+        # sure there is at least one set of four (4) backlasshes.
+        #set(CPACK_PACKAGE_ICON "${CGAL_INSTALLATION_PACKAGE_DIR}\\\\cgal_install.gif")
+        #set(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\CGAL.exe")
+        set(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} Computational Geometry Algorithms Library")
+        set(CPACK_NSIS_HELP_LINK "http:\\\\\\\\www.cgal.org")
+        set(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.cgal.org")
+        set(CPACK_NSIS_CONTACT "info at cgal.org")
+        set(CPACK_NSIS_MODIfY_PATH ON)
+    else()
+        set(CPACK_STRIP_FILES "")
+        set(CPACK_SOURCE_STRIP_FILES "")
+    endif()
+
+    include(CPack)
+    
+endif()
+
+
+if ( CGAL_BRANCH_BUILD )
+  option(CGAL_ENABLE_CHECK_HEADERS 
+    "Enable the special targets \"check_pkg_headers\", and \"check_pkg_<package>_headers\" for each package"
+    FALSE)
+
+  if(CGAL_ENABLE_CHECK_HEADERS)
+
+    if(NOT DEFINED CGAL_CHECK_SYNTAX_ONLY)
+      execute_process(COMMAND 
+        ${CMAKE_CXX_COMPILER} -x c++ -fsyntax-only ${CMAKE_CURRENT_SOURCE_DIR}/config/support/test_syntaxonly.cpp
+        ERROR_QUIET
+        RESULT_VARIABLE ok)
+      if(ok EQUAL 0)
+        set(CGAL_CHECK_SYNTAX_ONLY ON CACHE INTERNAL "")
+      else()
+        set(CGAL_CHECK_SYNTAX_ONLY OFF CACHE INTERNAL "")
+      endif()
+    endif(NOT DEFINED CGAL_CHECK_SYNTAX_ONLY)
+
+    if(NOT CGAL_CHECK_SYNTAX_ONLY)
+      message(FATAL_ERROR "Your compiler does not seem to support -fsyntax-only.
+You must disable CGAL_ENABLE_CHECK_HEADERS.")
+    endif()
+
+    ## Fill the variable include_options with all the -I and -isystem options
+    set(include_options)
+    foreach (incdir ${CGAL_INCLUDE_DIRS})
+      list(APPEND include_options "-I${incdir}")
+    endforeach()
+    foreach (incdir ${CGAL_3RD_PARTY_INCLUDE_DIRS})
+      list(APPEND include_options "-isystem${incdir}")
+    endforeach()
+    include_directories ( SYSTEM ${CGAL_3RD_PARTY_INCLUDE_DIRS} )
+
+    ## Loop on package and headers
+    set(check_pkg_target_list)
+    foreach (package ${CGAL_CONFIGURED_PACKAGES_NAMES})
+      if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../${package}/include)
+        set(depends "")
+        file(GLOB ${package}_HEADERS 
+          RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/../${package}/include" 
+          "${CMAKE_CURRENT_SOURCE_DIR}/../${package}/include/CGAL/*.h")
+        list(SORT ${package}_HEADERS)
+        foreach(header ${${package}_HEADERS})
+          string(REPLACE "/" "__" header2 "${header}")
+          string(REPLACE "." "_" header2 "${header2}")
+          add_custom_command(OUTPUT check_${header2}
+            COMMAND ${CMAKE_CXX_COMPILER} ${CGAL_3RD_PARTY_DEFINITIONS} ${CGAL_DEFINITIONS} ${include_options} -x c++ -fsyntax-only "${CMAKE_CURRENT_SOURCE_DIR}/../${package}/include/${header}"
+            COMMAND ${CMAKE_COMMAND} -E touch check_${header2}
+            DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/../${package}/include/${header}"
+            VERBATIM
+            COMMENT "Check header ${header}"
+            )
+          list(APPEND depends check_${header2})
+        endforeach() # look on headers
+        add_custom_target(check_pkg_${package}_headers DEPENDS ${depends})
+        list(APPEND check_pkg_target_list check_pkg_${package}_headers)
+      endif() # if the package has an include directory
+    endforeach() # loop on packages
+    add_custom_target(check_headers DEPENDS ${check_pkg_target_list})
+  endif()
+endif( CGAL_BRANCH_BUILD )
+
+if(NOT CGAL_BRANCH_BUILD AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/doc")
+  # in a non-branch build this is the top-level CMakeLists.txt
+  add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/doc")
+endif()
diff --git a/3rdparty/CGAL-4.8/INSTALL.md b/3rdparty/CGAL/INSTALL.md
similarity index 100%
rename from 3rdparty/CGAL-4.8/INSTALL.md
rename to 3rdparty/CGAL/INSTALL.md
diff --git a/3rdparty/CGAL-4.8/LICENSE b/3rdparty/CGAL/LICENSE
similarity index 100%
rename from 3rdparty/CGAL-4.8/LICENSE
rename to 3rdparty/CGAL/LICENSE
diff --git a/3rdparty/CGAL-4.8/LICENSE.BSL b/3rdparty/CGAL/LICENSE.BSL
similarity index 100%
rename from 3rdparty/CGAL-4.8/LICENSE.BSL
rename to 3rdparty/CGAL/LICENSE.BSL
diff --git a/3rdparty/CGAL-4.8/LICENSE.FREE_USE b/3rdparty/CGAL/LICENSE.FREE_USE
similarity index 100%
rename from 3rdparty/CGAL-4.8/LICENSE.FREE_USE
rename to 3rdparty/CGAL/LICENSE.FREE_USE
diff --git a/3rdparty/CGAL-4.8/LICENSE.GPL b/3rdparty/CGAL/LICENSE.GPL
similarity index 100%
rename from 3rdparty/CGAL-4.8/LICENSE.GPL
rename to 3rdparty/CGAL/LICENSE.GPL
diff --git a/3rdparty/CGAL-4.8/LICENSE.LGPL b/3rdparty/CGAL/LICENSE.LGPL
similarity index 100%
rename from 3rdparty/CGAL-4.8/LICENSE.LGPL
rename to 3rdparty/CGAL/LICENSE.LGPL
diff --git a/3rdparty/CGAL-4.8/README b/3rdparty/CGAL/README
similarity index 100%
rename from 3rdparty/CGAL-4.8/README
rename to 3rdparty/CGAL/README
diff --git a/3rdparty/CGAL/VERSION b/3rdparty/CGAL/VERSION
new file mode 100644
index 0000000..899dd4f
--- /dev/null
+++ b/3rdparty/CGAL/VERSION
@@ -0,0 +1 @@
+4.9
\ No newline at end of file
diff --git a/3rdparty/CGAL-4.8/auxiliary/cgal_app.icns b/3rdparty/CGAL/auxiliary/cgal_app.icns
similarity index 100%
rename from 3rdparty/CGAL-4.8/auxiliary/cgal_app.icns
rename to 3rdparty/CGAL/auxiliary/cgal_app.icns
diff --git a/3rdparty/CGAL/auxiliary/cgal_create_cmake_script.1 b/3rdparty/CGAL/auxiliary/cgal_create_cmake_script.1
new file mode 100644
index 0000000..1912a5c
--- /dev/null
+++ b/3rdparty/CGAL/auxiliary/cgal_create_cmake_script.1
@@ -0,0 +1,42 @@
+.TH CGAL_CREATE_CMAKE_SCRIPT "1" "September 2016" "CGAL 4.9" "User Commands"
+.SH NAME
+cgal_create_cmake_script \- create a cmake script for applications using CGAL
+.SH SYNOPSIS
+.B cgal_create_cmake_script
+.BR [ example | demo | test ]
+.SH DESCRIPTION
+The script
+.B cgal_create_cmake_script
+allows the simple creation of cmake scripts for applications which use the CGAL
+library. The parameter selects one of three script types, the default type
+is
+.BR example .
+.SH OPTIONS
+.PP
+.TP
+.B example
+Create a cmake script for several simple applications. Each
+.I C
+and
+.IR cpp
+file in the current directory containing a
+.I main()
+function is compiled and linked as a separate executable.
+.TP
+.B demo
+Create a cmake script for a single application. All
+.I C
+and
+.IR cpp
+files in the current directory are compiled and linked into one executable.
+.TP
+.B test
+Create a cmake script that is suited for the testsuite used by the CGAL developers.
+.SH AUTHOR
+The CGAL project (http://www.cgal.org/).
+.SH "REPORTING BUGS"
+Report bugs to <cgal-discuss at inria.fr> (see http://www.cgal.org/
+for further instructions).
+.SH "SEE ALSO"
+The full documentation for CGAL is available at http://www.cgal.org/ in PDF and
+HTML format.
diff --git a/3rdparty/CGAL-4.8/auxiliary/gdb/python/CGAL/__init__.py b/3rdparty/CGAL/auxiliary/gdb/python/CGAL/__init__.py
similarity index 100%
rename from 3rdparty/CGAL-4.8/auxiliary/gdb/python/CGAL/__init__.py
rename to 3rdparty/CGAL/auxiliary/gdb/python/CGAL/__init__.py
diff --git a/3rdparty/CGAL-4.8/auxiliary/gdb/python/CGAL/printers.py b/3rdparty/CGAL/auxiliary/gdb/python/CGAL/printers.py
similarity index 100%
rename from 3rdparty/CGAL-4.8/auxiliary/gdb/python/CGAL/printers.py
rename to 3rdparty/CGAL/auxiliary/gdb/python/CGAL/printers.py
diff --git a/3rdparty/CGAL-4.8/auxiliary/gdb/test-gdb.py b/3rdparty/CGAL/auxiliary/gdb/test-gdb.py
similarity index 100%
rename from 3rdparty/CGAL-4.8/auxiliary/gdb/test-gdb.py
rename to 3rdparty/CGAL/auxiliary/gdb/test-gdb.py
diff --git a/3rdparty/CGAL-4.8/auxiliary/gdb/test.cpp b/3rdparty/CGAL/auxiliary/gdb/test.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/auxiliary/gdb/test.cpp
rename to 3rdparty/CGAL/auxiliary/gdb/test.cpp
diff --git a/3rdparty/CGAL-4.8/auxiliary/gmp/README b/3rdparty/CGAL/auxiliary/gmp/README
similarity index 100%
rename from 3rdparty/CGAL-4.8/auxiliary/gmp/README
rename to 3rdparty/CGAL/auxiliary/gmp/README
diff --git a/3rdparty/CGAL/cmake/modules/CGALConfig_binary.cmake.in b/3rdparty/CGAL/cmake/modules/CGALConfig_binary.cmake.in
new file mode 100644
index 0000000..c03d935
--- /dev/null
+++ b/3rdparty/CGAL/cmake/modules/CGALConfig_binary.cmake.in
@@ -0,0 +1,199 @@
+#
+# This files contains definitions needed to use CGAL in a program.
+# DO NOT EDIT THIS. The definitons have been generated by CMake at configuration time.
+# This file is loaded by cmake via the command "find_package(CGAL)"
+#
+# This file correspond to a possibly out-of-sources CGAL configuration, thus the actual location
+# must be given by the cmake variable or enviroment variable CGAL_DIR.
+
+set(CGAL_CONFIG_LOADED TRUE)
+
+get_filename_component(CGAL_CONFIG_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
+
+set(CGAL_HEADER_ONLY "@CGAL_HEADER_ONLY@" )
+
+# The code for including exported targets is different from
+# CGAL_Config_install.cmake. We do not have separate export files in
+# an installed version and we need to make sure that we are not
+# currently building CGAL. Note that for CMake<=2.8.11 (detected by
+# the absence of CMP0024), the else() condition is never used.
+if(NOT POLICY CMP0024 OR NOT CGAL_BUILDING_LIBS)
+  include("${CGAL_CONFIG_DIR}/CGALExports.cmake")
+
+  macro(CGAL_get_property_optional VAR TARGET PROPERTY)
+    if(TARGET ${TARGET})
+      get_property(${VAR} TARGET ${TARGET} PROPERTY ${PROPERTY})
+    else()
+      set(${VAR} "")
+    endif()
+  endmacro()
+
+  if(NOT MSVC AND NOT CGAL_HEADER_ONLY)
+    CGAL_get_property_optional(CGAL_LIBRARY CGAL::CGAL LOCATION)
+    CGAL_get_property_optional(CGAL_Core_LIBRARY CGAL::CGAL_Core LOCATION)
+    CGAL_get_property_optional(CGAL_ImageIO_LIBRARY CGAL::CGAL_ImageIO LOCATION)
+    CGAL_get_property_optional(CGAL_Qt5_LIBRARY CGAL::CGAL_Qt5 LOCATION)
+  else()
+    set(CGAL_LIBRARY         "")
+    set(CGAL_Core_LIBRARY    "")
+    set(CGAL_ImageIO_LIBRARY "")
+    set(CGAL_Qt5_LIBRARY     "")
+  endif()
+else()
+  # We are currently in a CGAL Build and CGALExports.cmake has not
+  # necessarily been created yet. Just alias the targets. Also don't
+  # access the LOCATION property here to set lib_LIBRARY, since those
+  # targets are not imported and this is disallowed by CMP0026. Just
+  # set it to the target name.
+  macro(CGAL_alias_library lib)
+    if(TARGET ${lib} AND NOT TARGET CGAL::${lib})
+      add_library(CGAL::${lib} ALIAS ${lib})
+      set(${lib}_LIBRARY CGAL::${lib})
+    else()
+      set(${lib}_LIBRARY "")
+    endif()
+  endmacro()
+
+  CGAL_alias_library(CGAL)
+  CGAL_alias_library(CGAL_Core)
+  CGAL_alias_library(CGAL_ImageIO)
+  CGAL_alias_library(CGAL_Qt5)
+endif()
+
+# Check for possible config files of our libraries and include them.
+file(GLOB CGAL_CONFIG_FILES LIST_DIRECTORIES false
+  RELATIVE "${CGAL_CONFIG_DIR}" "${CGAL_CONFIG_DIR}/*LibConfig.cmake")
+list(SORT CGAL_CONFIG_FILES)
+foreach(configfile ${CGAL_CONFIG_FILES})
+  include("${CGAL_CONFIG_DIR}/${configfile}")
+endforeach()
+
+set(CGAL_INSTALLATION_PACKAGE_DIR "@CGAL_INSTALLATION_PACKAGE_DIR@")
+set(CGAL_CORE_PACKAGE_DIR "@CGAL_CORE_PACKAGE_DIR@")
+set(CGAL_GRAPHICSVIEW_PACKAGE_DIR "@CGAL_GRAPHICSVIEW_PACKAGE_DIR@")
+
+set(CGAL_MAJOR_VERSION    "@CGAL_MAJOR_VERSION@" )
+set(CGAL_MINOR_VERSION    "@CGAL_MINOR_VERSION@" )
+set(CGAL_BUILD_VERSION    "@CGAL_BUILD_VERSION@" )
+set(CGAL_SCM_BRANCH_NAME  "@CGAL_SCM_BRANCH_NAME@")
+set(CGAL_GIT_SHA1         "@CGAL_GIT_SHA1@")
+
+set(CGAL_BUILD_SHARED_LIBS        "@CGAL_BUILD_SHARED_LIBS@" )
+set(CGAL_Boost_USE_STATIC_LIBS    "@CGAL_Boost_USE_STATIC_LIBS@" )
+
+set(CGAL_CXX_FLAGS_INIT                   "@CMAKE_CXX_FLAGS@" )
+set(CGAL_CXX_FLAGS_RELEASE_INIT           "@CMAKE_CXX_FLAGS_RELEASE@" )
+set(CGAL_CXX_FLAGS_DEBUG_INIT             "@CMAKE_CXX_FLAGS_DEBUG@" )
+set(CGAL_MODULE_LINKER_FLAGS_INIT         "@CMAKE_MODULE_LINKER_FLAGS@" )
+set(CGAL_MODULE_LINKER_FLAGS_RELEASE_INIT "@CMAKE_MODULE_LINKER_FLAGS_RELEASE@" )
+set(CGAL_MODULE_LINKER_FLAGS_DEBUG_INIT   "@CMAKE_MODULE_LINKER_FLAGS_DEBUG@" )
+set(CGAL_SHARED_LINKER_FLAGS_INIT         "@CMAKE_SHARED_LINKER_FLAGS@" )
+set(CGAL_SHARED_LINKER_FLAGS_RELEASE_INIT "@CMAKE_SHARED_LINKER_FLAGS_RELEASE@" )
+set(CGAL_SHARED_LINKER_FLAGS_DEBUG_INIT   "@CMAKE_SHARED_LINKER_FLAGS_DEBUG@" )
+set(CGAL_BUILD_TYPE_INIT                  "@CMAKE_BUILD_TYPE@" )
+
+set(CGAL_INCLUDE_DIRS      "@CGAL_INCLUDE_DIRS@" )
+set(CGAL_MODULES_DIR       "@CGAL_MODULES_DIR@" )
+set(CGAL_LIBRARIES_DIR     "@CGAL_LIBRARIES_DIR@" )
+
+# If CGAL_ImageIO is built, tell if it was linked with Zlib.
+set(CGAL_ImageIO_USE_ZLIB                 "@CGAL_ImageIO_USE_ZLIB@" )
+
+set(CGAL_VERSION "${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}.${CGAL_BUILD_VERSION}")
+
+set(CGAL_USE_FILE "${CGAL_MODULES_DIR}/UseCGAL.cmake" )
+
+if ( CGAL_FIND_REQUIRED )
+  set( CHECK_CGAL_COMPONENT_MSG_ON_ERROR TRUE        )
+  set( CHECK_CGAL_COMPONENT_ERROR_TYPE   FATAL_ERROR )
+  set( CHECK_CGAL_COMPONENT_ERROR_TITLE  "ERROR:"    )
+else()
+  if ( NOT CGAL_FIND_QUIETLY )
+    set( CHECK_CGAL_COMPONENT_MSG_ON_ERROR TRUE      )
+    set( CHECK_CGAL_COMPONENT_ERROR_TYPE   STATUS    )
+    set( CHECK_CGAL_COMPONENT_ERROR_TITLE "NOTICE:" )
+  else()
+    set( CHECK_CGAL_COMPONENT_MSG_ON_ERROR FALSE )
+  endif()
+endif()
+
+set(CGAL_CONFIGURED_LIBRARIES "@CGAL_CONFIGURED_LIBRARIES@")
+
+macro(check_cgal_component COMPONENT)
+
+  set( CGAL_LIB ${COMPONENT} )
+  #message("LIB: ${CGAL_LIB}")
+
+  if ( "${CGAL_LIB}" STREQUAL "CGAL" )
+    set( CGAL_FOUND TRUE )
+    set( CHECK_CGAL_ERROR_TAIL "" )
+  else( "${CGAL_LIB}" STREQUAL "CGAL" )
+    if ( WITH_${CGAL_LIB} )
+      if(CGAL_HEADER_ONLY OR TARGET CGAL::${CGAL_LIB})
+        if ("${CGAL_LIB}" STREQUAL "CGAL_Qt5")
+          find_package(Qt5 QUIET COMPONENTS OpenGL Svg)
+          find_package(OpenGL QUIET)
+
+          set(CGAL_Qt5_MISSING_DEPS "")
+          if(NOT Qt5OpenGL_FOUND)
+            set(CGAL_Qt5_MISSING_DEPS "Qt5OpenGL")
+          endif()
+          if(NOT Qt5Svg_FOUND)
+            set(CGAL_Qt5_MISSING_DEPS "${CGAL_Qt5_MISSING_DEPS} Qt5Svg")
+          endif()
+          if(NOT Qt5_FOUND)
+            set(CGAL_Qt5_MISSING_DEPS "${CGAL_Qt5_MISSING_DEPS} Qt5")
+          endif()
+          if(NOT OPENGL_FOUND)
+            set(CGAL_Qt5_MISSING_DEPS "${CGAL_Qt5_MISSING_DEPS} OpenGL")
+          endif()
+
+          if(CGAL_Qt5_MISSING_DEPS)
+            set( ${CGAL_LIB}_FOUND FALSE )
+            message(STATUS "libCGAL_Qt5 is missing the dependencies: ${CGAL_Qt5_MISSING_DEPS} cannot be configured.")
+          else()
+            set( ${CGAL_LIB}_FOUND TRUE )
+            if (CGAL_HEADER_ONLY)
+              include("${CGAL_MODULES_DIR}/Use_CGAL_Qt5_headers.cmake")
+            endif()
+          endif()
+        else("${CGAL_LIB}" STREQUAL "CGAL_Qt5")
+          # Librairies that have no dependencies
+          set( ${CGAL_LIB}_FOUND TRUE )
+        endif("${CGAL_LIB}" STREQUAL "CGAL_Qt5")
+      else(CGAL_HEADER_ONLY OR TARGET CGAL::${CGAL_LIB})
+        set( ${CGAL_LIB}_FOUND FALSE )
+        set( CHECK_${CGAL_LIB}_ERROR_TAIL " CGAL was configured with WITH_${CGAL_LIB}=ON, but one of the dependencies of ${CGAL_LIB} was not configured properly." )
+      endif(CGAL_HEADER_ONLY OR TARGET CGAL::${CGAL_LIB})
+    else( WITH_${CGAL_LIB} )
+      set( ${CGAL_LIB}_FOUND FALSE )
+      set( CHECK_${CGAL_LIB}_ERROR_TAIL " Please configure CGAL using WITH_${CGAL_LIB}=ON." )
+    endif( WITH_${CGAL_LIB} )
+  endif( "${CGAL_LIB}" STREQUAL "CGAL" )
+
+  if ( NOT ${CGAL_LIB}_FOUND AND CHECK_CGAL_COMPONENT_MSG_ON_ERROR )
+    message( ${CHECK_CGAL_COMPONENT_ERROR_TYPE} "${CHECK_CGAL_COMPONENT_ERROR_TITLE} The ${CGAL_LIB} library was not configured.${CHECK_${CGAL_LIB}_ERROR_TAIL}" )
+  endif()
+
+endmacro()
+
+check_cgal_component("CGAL")
+
+foreach( CGAL_COMPONENT ${CGAL_FIND_COMPONENTS} )
+  list (FIND CGAL_CONFIGURED_LIBRARIES "CGAL_${CGAL_COMPONENT}" POSITION)
+  if ("${POSITION}" STRGREATER "-1") # means: CGAL_COMPONENT is contained in list
+    check_cgal_component("CGAL_${CGAL_COMPONENT}")
+# TODO EBEB do something for supporting lib in check_component?
+  endif()
+endforeach()
+
+# Starting with cmake 2.6.3, CGAL_FIND_COMPONENTS is cleared out when find_package returns.
+# But we need it within UseCGAL.cmake, so we save it aside into another variable
+set( CGAL_REQUESTED_COMPONENTS ${CGAL_FIND_COMPONENTS} )
+
+# for preconfigured libs
+set(CGAL_ENABLE_PRECONFIG "@CGAL_ENABLE_PRECONFIG@")
+set(CGAL_SUPPORTING_3RD_PARTY_LIBRARIES "@CGAL_SUPPORTING_3RD_PARTY_LIBRARIES@")
+set(CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES "@CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES@")
+
+set(CGAL_DISABLE_GMP "@CGAL_DISABLE_GMP@")
diff --git a/3rdparty/CGAL/cmake/modules/CGALConfig_install.cmake.in b/3rdparty/CGAL/cmake/modules/CGALConfig_install.cmake.in
new file mode 100644
index 0000000..ec8bb90
--- /dev/null
+++ b/3rdparty/CGAL/cmake/modules/CGALConfig_install.cmake.in
@@ -0,0 +1,154 @@
+#
+# This files contains definitions needed to use CGAL in a program.
+# DO NOT EDIT THIS. The definitons have been generated by CMake at configuration time.
+# This file is loaded by cmake via the command "find_package(CGAL)"
+#
+# This file correspond to a CGAL installation with "make install", thus the actual location
+# must be given by the cmake variable or enviroment variable CGAL_DIR.
+
+set(CGAL_CONFIG_LOADED TRUE)
+
+get_filename_component(CGAL_CONFIG_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
+
+set(CGAL_HEADER_ONLY "@CGAL_HEADER_ONLY@" )
+
+# CGAL_DIR is the directory where this CGALConfig.cmake is installed
+string(REPLACE "@CGAL_INSTALL_CMAKE_DIR@" "" CGAL_INSTALL_PREFIX "${CGAL_CONFIG_DIR}")
+
+set(CGAL_MAJOR_VERSION    "@CGAL_MAJOR_VERSION@" )
+set(CGAL_MINOR_VERSION    "@CGAL_MINOR_VERSION@" )
+set(CGAL_BUILD_VERSION    "@CGAL_BUILD_VERSION@" )
+set(CGAL_SCM_BRANCH_NAME  "@CGAL_SCM_BRANCH_NAME@")
+set(CGAL_GIT_SHA1         "@CGAL_GIT_SHA1@")
+
+set(CGAL_BUILD_SHARED_LIBS        "@CGAL_BUILD_SHARED_LIBS@" )
+set(CGAL_Boost_USE_STATIC_LIBS    "@CGAL_Boost_USE_STATIC_LIBS@" )
+
+set(CGAL_CXX_FLAGS_INIT                   "@CMAKE_CXX_FLAGS@" )
+set(CGAL_CXX_FLAGS_RELEASE_INIT           "@CMAKE_CXX_FLAGS_RELEASE@" )
+set(CGAL_CXX_FLAGS_DEBUG_INIT             "@CMAKE_CXX_FLAGS_DEBUG@" )
+set(CGAL_MODULE_LINKER_FLAGS_INIT         "@CMAKE_MODULE_LINKER_FLAGS@" )
+set(CGAL_MODULE_LINKER_FLAGS_RELEASE_INIT "@CMAKE_MODULE_LINKER_FLAGS_RELEASE@" )
+set(CGAL_MODULE_LINKER_FLAGS_DEBUG_INIT   "@CMAKE_MODULE_LINKER_FLAGS_DEBUG@" )
+set(CGAL_SHARED_LINKER_FLAGS_INIT         "@CMAKE_SHARED_LINKER_FLAGS@" )
+set(CGAL_SHARED_LINKER_FLAGS_RELEASE_INIT "@CMAKE_SHARED_LINKER_FLAGS_RELEASE@" )
+set(CGAL_SHARED_LINKER_FLAGS_DEBUG_INIT   "@CMAKE_SHARED_LINKER_FLAGS_DEBUG@" )
+set(CGAL_BUILD_TYPE_INIT                  "@CMAKE_BUILD_TYPE@" )
+
+set(CGAL_INCLUDE_DIRS  "${CGAL_INSTALL_PREFIX}/@CGAL_INSTALL_INC_DIR@" )
+set(CGAL_MODULES_DIR   "${CGAL_INSTALL_PREFIX}/@CGAL_INSTALL_CMAKE_DIR@" )
+set(CGAL_LIBRARIES_DIR "${CGAL_INSTALL_PREFIX}/@CGAL_INSTALL_LIB_DIR@" )
+
+# If CGAL_ImageIO is built, tell if it was linked with Zlib.
+set(CGAL_ImageIO_USE_ZLIB                 "@CGAL_ImageIO_USE_ZLIB@" )
+
+set(CGAL_VERSION "${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}.${CGAL_BUILD_VERSION}")
+
+set(CGAL_USE_FILE "${CGAL_MODULES_DIR}/UseCGAL.cmake" )
+set(CGAL_GRAPHICSVIEW_PACKAGE_DIR "${CGAL_INCLUDE_DIRS}/CGAL/" CACHE INTERNAL "Directory containing the GraphicsView package")
+
+if ( CGAL_FIND_REQUIRED )
+  set( CHECK_CGAL_COMPONENT_MSG_ON_ERROR TRUE        )
+  set( CHECK_CGAL_COMPONENT_ERROR_TYPE   FATAL_ERROR )
+  set( CHECK_CGAL_COMPONENT_ERROR_TITLE  "ERROR:"    )
+else()
+  if ( NOT CGAL_FIND_QUIETLY )
+    set( CHECK_CGAL_COMPONENT_MSG_ON_ERROR TRUE      )
+    set( CHECK_CGAL_COMPONENT_ERROR_TYPE   STATUS    )
+    set( CHECK_CGAL_COMPONENT_ERROR_TITLE "NOTICE:" )
+  else()
+    set( CHECK_CGAL_COMPONENT_MSG_ON_ERROR FALSE )
+  endif()
+endif()
+
+set(CGAL_CONFIGURED_LIBRARIES "@CGAL_CONFIGURED_LIBRARIES@")
+
+macro(check_cgal_component COMPONENT)
+
+  set( CGAL_LIB ${COMPONENT} )
+  #message("LIB: ${CGAL_LIB}")
+
+  if ( "${CGAL_LIB}" STREQUAL "CGAL" )
+    set( CGAL_FOUND TRUE )
+    # include CGAL export file
+    include(${CGAL_CONFIG_DIR}/CGALExports.cmake)
+    # include config file
+    include(${CGAL_CONFIG_DIR}/CGALLibConfig.cmake)
+    set( CHECK_CGAL_ERROR_TAIL "" )
+  else()
+    if (EXISTS ${CGAL_CONFIG_DIR}/${CGAL_LIB}Exports.cmake)
+      # include export files for requested component
+      include(${CGAL_CONFIG_DIR}/${CGAL_LIB}Exports.cmake)
+      # include config file (defining WITH_${CGAL_LIB})
+      include(${CGAL_CONFIG_DIR}/${CGAL_LIB}LibConfig.cmake)
+    endif()
+
+    if ( WITH_${CGAL_LIB} )
+      if(CGAL_HEADER_ONLY OR TARGET CGAL::${CGAL_LIB})
+        if ("${CGAL_LIB}" STREQUAL "CGAL_Qt5")
+          find_package(Qt5 QUIET COMPONENTS OpenGL Svg)
+          find_package(OpenGL QUIET)
+
+          set(CGAL_Qt5_MISSING_DEPS "")
+          if(NOT Qt5OpenGL_FOUND)
+            set(CGAL_Qt5_MISSING_DEPS "Qt5OpenGL")
+          endif()
+          if(NOT Qt5Svg_FOUND)
+            set(CGAL_Qt5_MISSING_DEPS "${CGAL_Qt5_MISSING_DEPS} Qt5Svg")
+          endif()
+          if(NOT Qt5_FOUND)
+            set(CGAL_Qt5_MISSING_DEPS "${CGAL_Qt5_MISSING_DEPS} Qt5")
+          endif()
+          if(NOT OPENGL_FOUND)
+            set(CGAL_Qt5_MISSING_DEPS "${CGAL_Qt5_MISSING_DEPS} OpenGL")
+          endif()
+
+          if(CGAL_Qt5_MISSING_DEPS)
+            set( ${CGAL_LIB}_FOUND FALSE )
+            message(STATUS "libCGAL_Qt5 is missing the dependencies: ${CGAL_Qt5_MISSING_DEPS} cannot be configured.")
+          else()
+            set( ${CGAL_LIB}_FOUND TRUE )
+            if (CGAL_HEADER_ONLY)
+              include("${CGAL_MODULES_DIR}/Use_CGAL_Qt5_headers.cmake")
+            endif()
+          endif()
+        else("${CGAL_LIB}" STREQUAL "CGAL_Qt5")
+          # Librairies that have no dependencies
+          set( ${CGAL_LIB}_FOUND TRUE )
+        endif("${CGAL_LIB}" STREQUAL "CGAL_Qt5")
+      else(CGAL_HEADER_ONLY OR TARGET CGAL::${CGAL_LIB})
+        set( ${CGAL_LIB}_FOUND FALSE )
+        set( CHECK_${CGAL_LIB}_ERROR_TAIL " CGAL was configured with WITH_${CGAL_LIB}=ON, but one of the dependencies of ${CGAL_LIB} was not configured properly." )
+      endif(CGAL_HEADER_ONLY OR TARGET CGAL::${CGAL_LIB})
+    else( WITH_${CGAL_LIB} )
+      set( ${CGAL_LIB}_FOUND FALSE )
+      set( CHECK_${CGAL_LIB}_ERROR_TAIL " Please configure CGAL using WITH_${CGAL_LIB}=ON." )
+    endif( WITH_${CGAL_LIB} )
+  endif()
+
+  if ( NOT ${CGAL_LIB}_FOUND AND CHECK_CGAL_COMPONENT_MSG_ON_ERROR )
+    message( ${CHECK_CGAL_COMPONENT_ERROR_TYPE} "${CHECK_CGAL_COMPONENT_ERROR_TITLE} The ${CGAL_LIB} library was not configured.${CHECK_${CGAL_LIB}_ERROR_TAIL}" )
+  endif()
+
+endmacro()
+
+check_cgal_component("CGAL")
+
+foreach( CGAL_COMPONENT ${CGAL_FIND_COMPONENTS} )
+  list (FIND CGAL_CONFIGURED_LIBRARIES "CGAL_${CGAL_COMPONENT}" POSITION)
+  if ("${POSITION}" STRGREATER "-1") # means: CGAL_COMPONENT is contained in list
+    check_cgal_component("CGAL_${CGAL_COMPONENT}")
+# TODO EBEB do something for supporting lib in check_component?
+  endif()
+endforeach()
+
+# Starting with cmake 2.6.3, CGAL_FIND_COMPONENTS is cleared out when find_package returns.
+# But we need it within UseCGAL.cmake, so we save it aside into another variable
+set( CGAL_REQUESTED_COMPONENTS ${CGAL_FIND_COMPONENTS} )
+
+# for preconfigured libs
+set(CGAL_ENABLE_PRECONFIG "@CGAL_ENABLE_PRECONFIG@")
+set(CGAL_SUPPORTING_3RD_PARTY_LIBRARIES "@CGAL_SUPPORTING_3RD_PARTY_LIBRARIES@")
+set(CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES "@CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES@")
+
+set(CGAL_DISABLE_GMP "@CGAL_DISABLE_GMP@")
diff --git a/3rdparty/CGAL/cmake/modules/CGALLibConfig.cmake.in b/3rdparty/CGAL/cmake/modules/CGALLibConfig.cmake.in
new file mode 100644
index 0000000..700446f
--- /dev/null
+++ b/3rdparty/CGAL/cmake/modules/CGALLibConfig.cmake.in
@@ -0,0 +1,32 @@
+set(WITH_ at LIBRARY_NAME@ "ON")
+
+# The else condition of this code is never used in an installed
+# version since it cannot happen there. Note also that for
+# CMake<=2.8.11 (detected by the absence of CMP0024), the else()
+# condition is never used.
+if(NOT POLICY CMP0024 OR NOT CGAL_BUILDING_LIBS)
+  if(NOT MSVC AND NOT CGAL_HEADER_ONLY)
+    get_property(@LIBRARY_NAME at _LIBRARY TARGET CGAL::@LIBRARY_NAME@ PROPERTY LOCATION)
+  else()
+    set(@LIBRARY_NAME at _LIBRARY "")
+  endif()
+else()
+  # We are currently in a CGAL Build and CGALExports.cmake has not
+  # necessarily been created yet. Just alias the targets. Also don't
+  # access the LOCATION property here to set lib_LIBRARY, since those
+  # targets are not imported and this is disallowed by CMP0026. Just
+  # set it to the target name.
+  if(TARGET @LIBRARY_NAME@ AND NOT TARGET CGAL::@LIBRARY_NAME@ AND NOT CGAL_HEADER_ONLY)
+    add_library(CGAL::@LIBRARY_NAME@ ALIAS @LIBRARY_NAME@)
+    set(@LIBRARY_NAME at _LIBRARY CGAL::@LIBRARY_NAME@)
+  else()
+    set(@LIBRARY_NAME at _LIBRARY "")
+  endif()
+endif()
+
+
+# 3RD_PARTY variables.
+set(@LIBRARY_NAME at _3RD_PARTY_INCLUDE_DIRS   "@@LIBRARY_NAME at _3RD_PARTY_INCLUDE_DIRS@")
+set(@LIBRARY_NAME at _3RD_PARTY_DEFINITIONS    "@@LIBRARY_NAME at _3RD_PARTY_DEFINITIONS@")
+set(@LIBRARY_NAME at _3RD_PARTY_LIBRARIES_DIRS "@@LIBRARY_NAME at _3RD_PARTY_LIBRARIES_DIRS@")
+set(@LIBRARY_NAME at _3RD_PARTY_LIBRARIES      "@@LIBRARY_NAME at _3RD_PARTY_LIBRARIES@")
diff --git a/3rdparty/CGAL-4.8/cmake/modules/CGAL_CheckCXXFileRuns.cmake b/3rdparty/CGAL/cmake/modules/CGAL_CheckCXXFileRuns.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/CGAL_CheckCXXFileRuns.cmake
rename to 3rdparty/CGAL/cmake/modules/CGAL_CheckCXXFileRuns.cmake
diff --git a/3rdparty/CGAL/cmake/modules/CGAL_Common.cmake b/3rdparty/CGAL/cmake/modules/CGAL_Common.cmake
new file mode 100644
index 0000000..2110d9c
--- /dev/null
+++ b/3rdparty/CGAL/cmake/modules/CGAL_Common.cmake
@@ -0,0 +1,61 @@
+include(CGAL_Macros)
+
+if(RUNNING_CGAL_AUTO_TEST)
+# Just to avoid a warning from CMake if that variable is set on the command line...
+endif()
+
+# Common settings for CGAL cmake scripts
+if( NOT CGAL_COMMON_FILE_INCLUDED )
+  set(CGAL_COMMON_FILE_INCLUDED 1 )
+
+  # CMAKE_ROOT must be properly configured, but is not by the CMake windows installer, so check here
+  if (NOT CMAKE_ROOT)
+    message( FATAL_ERROR "CMAKE_ROOT environment variable not set. It should point to the directory where CMake is installed.")
+  endif()
+
+  # CMAKE_VERSION was introduced in 2.6.3 so we use it to detect the fact
+  if ( CMAKE_VERSION )
+    set( CMAKE_2_6_3_OR_ABOVE TRUE )
+  else()
+    set( CMAKE_2_6_3_OR_ABOVE FALSE )
+  endif()
+    
+  if ( CGAL_BUILDING_LIBS )
+    option(BUILD_SHARED_LIBS "Build shared libraries" ON)
+    set(CGAL_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
+
+    if ( BUILD_SHARED_LIBS )
+      message( STATUS "Building shared libraries" )
+    else()
+      message( STATUS "Building static libraries" )
+    endif()
+  endif()
+  
+  if ( WIN32 )
+    find_program(CMAKE_UNAME uname /bin /usr/bin /usr/local/bin )
+    if(CMAKE_UNAME)
+      exec_program(uname ARGS -s OUTPUT_VARIABLE CMAKE_SYSTEM_NAME2)
+      if ( CMAKE_SYSTEM_NAME2 MATCHES "CYGWIN" )
+        message( STATUS "This is the Windows CMake running within the cygwin platform." )
+        set( CGAL_WIN32_CMAKE_ON_CYGWIN TRUE CACHE INTERNAL "This is the cygwin platform." )
+      endif()
+    endif()
+    hide_variable(CMAKE_UNAME)
+
+    # Optionally setup the Visual Leak Detector
+    include(CGAL_SetupVLD)
+    CGAL_SetupVLD()
+    if(VLD_FOUND)
+      message(STATUS "Visual Leak Detector (VLD) is enabled.")
+    else()
+      message(STATUS "Visual Leak Detector (VLD) is not found.")
+    endif()
+  endif()
+
+  # set minimal version of some optional libraries:
+  set( Eigen3_FIND_VERSION "3.1.0")
+  # set use-file for Eigen3 (needed to have default solvers)
+  set(EIGEN3_USE_FILE "UseEigen3")
+
+
+endif()
diff --git a/3rdparty/CGAL/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake b/3rdparty/CGAL/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake
new file mode 100644
index 0000000..8549d00
--- /dev/null
+++ b/3rdparty/CGAL/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake
@@ -0,0 +1,53 @@
+function(create_single_source_cgal_program firstfile )
+
+  if(NOT IS_ABSOLUTE "${firstfile}")
+    set(firstfile "${CMAKE_CURRENT_SOURCE_DIR}/${firstfile}")
+  endif()
+
+  get_filename_component(exe_name ${firstfile} NAME_WE)
+
+  if(EXISTS "${firstfile}")
+
+    set( all "${firstfile}" )
+
+    # remaining files
+    foreach( i ${ARGN} )
+      set( all ${all} ${CMAKE_CURRENT_SOURCE_DIR}/${i} )
+    endforeach()
+
+
+    add_executable(${exe_name} ${all})
+
+    if(BUILD_TESTING)
+      if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${exe_name}.cin")
+        set(ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${exe_name}.cin")
+      elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${exe_name}.cmd")
+        file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/${exe_name}.cmd" ARGS LIMIT_COUNT 1)
+        # TODO: handle multi-lines .cmd files
+        # see https://github.com/CGAL/cgal/pull/1295/files/c65d3abe17bb3e677b8077996cdaf8672f9c4c6f#r71705451
+      endif()
+      message(STATUS "add test for ${exe_name}")
+      add_test(NAME ${exe_name}
+        COMMAND ${exe_name} ${ARGS}
+        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+      set_property(TEST "${exe_name}"
+        APPEND PROPERTY LABELS "${PROJECT_NAME}")
+    endif(BUILD_TESTING)
+
+    add_to_cached_list( CGAL_EXECUTABLE_TARGETS ${exe_name} )
+
+    # Link the executable to CGAL and third-party libraries
+    if ( CGAL_AUTO_LINK_ENABLED )
+
+      target_link_libraries(${exe_name} ${CGAL_3RD_PARTY_LIBRARIES} )
+
+    else()
+
+      target_link_libraries(${exe_name} ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} )
+
+    endif()
+  else()
+    message(AUTHOR_WARNING "The executable ${exe_name} will not be created because the source file ${firstfile} does not exist.")
+  endif()
+
+endfunction()
diff --git a/3rdparty/CGAL-4.8/cmake/modules/CGAL_GeneratorSpecificSettings.cmake b/3rdparty/CGAL/cmake/modules/CGAL_GeneratorSpecificSettings.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/CGAL_GeneratorSpecificSettings.cmake
rename to 3rdparty/CGAL/cmake/modules/CGAL_GeneratorSpecificSettings.cmake
diff --git a/3rdparty/CGAL-4.8/cmake/modules/CGAL_Locate_CGAL_TAUCS.cmake b/3rdparty/CGAL/cmake/modules/CGAL_Locate_CGAL_TAUCS.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/CGAL_Locate_CGAL_TAUCS.cmake
rename to 3rdparty/CGAL/cmake/modules/CGAL_Locate_CGAL_TAUCS.cmake
diff --git a/3rdparty/CGAL/cmake/modules/CGAL_Macros.cmake b/3rdparty/CGAL/cmake/modules/CGAL_Macros.cmake
new file mode 100644
index 0000000..43c7e5b
--- /dev/null
+++ b/3rdparty/CGAL/cmake/modules/CGAL_Macros.cmake
@@ -0,0 +1,717 @@
+if( NOT CGAL_MACROS_FILE_INCLUDED )
+  set(CGAL_MACROS_FILE_INCLUDED 1 )
+
+  include("${CGAL_MODULES_DIR}/CGAL_VersionUtils.cmake")
+
+  # Probably unused. -- Laurent Rineau, 2011/07/21
+  macro(assert _arg )
+    if ( NOT ${_arg} )
+      message( FATAL_ERROR "Variable ${_arg} must be defined" )
+    endif()
+  endmacro()
+
+  macro( hide_variable var )
+    set ( ${var} ${${var}} CACHE INTERNAL "Variable hidden from user" FORCE )
+  endmacro()
+
+  macro( cache_set var )
+    set ( ${var} ${ARGN} CACHE INTERNAL "" )
+    set ( ${var} ${ARGN} CACHE INTERNAL "" )
+  endmacro()
+
+  macro( typed_cache_set type doc var )
+    set ( ${var} ${ARGN} CACHE ${type} ${doc} FORCE )
+    set ( ${var} ${ARGN} CACHE ${type} ${doc} FORCE )
+  endmacro()
+
+  macro( cache_get var )
+    set ( ${var} )
+  endmacro()
+
+  # Splits inlist in the first element (head) and the rest (tail)
+  macro( list_split head tail )
+    set( ${head} )
+    set( ${tail} )
+    set( _LS_is_head TRUE )
+    foreach( _LS_item ${ARGN} )
+      if ( _LS_is_head )
+        set( ${head} ${_LS_item} )
+        set( _LS_is_head FALSE )
+      else()
+        list( APPEND ${tail} ${_LS_item} )
+      endif()
+    endforeach()
+  endmacro()
+
+  # adds elements to an internal cached list
+  macro( add_to_cached_list listname )
+    cache_get ( ${listname} )
+    set( _ATC_${listname}_tmp  ${${listname}} )
+    if ( NOT "${ARGN}" STREQUAL "" )
+      list( APPEND _ATC_${listname}_tmp ${ARGN} )
+    endif()
+    cache_set ( ${listname} ${_ATC_${listname}_tmp} )
+  endmacro()
+
+  # adds elements to an in-memory variable named 'listname'
+  macro( add_to_memory_list listname )
+    if ( NOT "${ARGN}" STREQUAL "" )
+      list( APPEND ${listname} ${ARGN} )
+    endif()
+  endmacro()
+
+  # adds elements to a list.
+  # If the first argument after 'listname' is PERSISTENT then 'listname'
+  # is a persistent internal cached variable, otherwise is a memory variable.
+  macro( add_to_list listname )
+    list_split( _ATL_ARGN_HEAD _ATL_ARGN_TAIL ${ARGN} )
+    if ( "${_ATL_ARGN_HEAD}" STREQUAL "PERSISTENT" )
+      add_to_cached_list( ${listname} ${_ATL_ARGN_TAIL} )
+    else()
+      add_to_memory_list( ${listname} ${ARGN} )
+    endif()
+  endmacro()
+
+  # Probably unused. -- Laurent Rineau, 2011/07/21
+  macro( at list idx var )
+    list( LENGTH ${list} ${list}_length )
+    if ( ${idx} LESS ${${list}_length} )
+      list( GET ${list} ${idx} ${var} )
+    else()
+      set( ${var} "NOTFOUND" )
+    endif()
+  endmacro()
+
+  macro( found_in_list item_list item result )
+    set( ${result} "FALSE" )
+    foreach( element ${${item_list}} )
+      if ( "${element}" STREQUAL "${item}" )
+        set( ${result} "TRUE" )
+      endif()
+    endforeach()
+  endmacro()
+
+  macro( uniquely_add_flags target_var )
+    if ( "${ARGC}" GREATER "1"  )
+      set( target_list "${${target_var}}" )
+      set( source_list "${ARGN}" )
+      separate_arguments( target_list )
+      separate_arguments( source_list )
+      foreach( flag ${source_list} )
+        found_in_list( target_list ${flag} ${flag}_FOUND )
+        if ( NOT ${flag}_FOUND )
+          typed_cache_set( STRING "User-defined flags" ${target_var} "${${target_var}} ${flag}" )
+        endif()
+      endforeach()
+    endif()
+  endmacro()
+
+  function( CGAL_display_compiler_version )
+    set(search_dirs "")
+    message("Compiler version:")
+    set(version "Unknown compiler. Cannot display its version")
+    if(MSVC)
+      execute_process(COMMAND "${CMAKE_CXX_COMPILER}"
+        RESULT_VARIABLE ok
+        ERROR_VARIABLE out_version
+        TIMEOUT 5)
+      if(ok EQUAL 0)
+        set(version "${out_version}")
+      endif()
+    else()
+      foreach(flag "-V" "--version" "-v")
+        execute_process(COMMAND "${CMAKE_CXX_COMPILER}" ${flag}
+          RESULT_VARIABLE ok
+          OUTPUT_VARIABLE out_version
+          ERROR_VARIABLE out_version
+          TIMEOUT 5)
+        if(ok EQUAL 0)
+          if("${out_version}" MATCHES "^clang")
+            execute_process(COMMAND "${CMAKE_CXX_COMPILER}" -print-search-dirs
+              RESULT_VARIABLE ok
+              OUTPUT_VARIABLE out_search_dirs
+              TIMEOUT 5)
+            if(ok EQUAL 0)
+              set(search_dirs "${out_search_dirs}")
+            endif()
+          endif()
+          set(version "${out_version}")
+          break()
+        endif()
+      endforeach()
+    endif()
+    message("${version}")
+    if(search_dirs)
+      message("Search dirs:")
+      message("${search_dirs}")
+    endif()
+  endfunction()
+
+  macro( get_dependency_version LIB )
+
+    if ( "${ARGC}" GREATER "1" )
+      set( PKG ${ARGV1} )
+    else()
+      set( PKG ${LIB} )
+    endif()
+
+    if ( ${PKG}_FOUND )
+
+      set ( ${LIB}_VERSION "unknown" )
+
+      try_run( ${LIB}_RUN_RES
+               ${LIB}_COMPILE_RES
+               "${CMAKE_BINARY_DIR}"
+               "${CGAL_INSTALLATION_PACKAGE_DIR}/config/support/print_${LIB}_version.cpp"
+               CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${${PKG}_INCLUDE_DIR};${${PKG}_DEPENDENCY_INCLUDE_DIR}"
+                           "-DLINK_LIBRARIES:STRING=${${PKG}_LIBRARIES};${${PKG}_DEPENDENCY_LIBRARIES}"
+                           "-DLINK_DIRECTORIES:STRING=${${PKG}_LIBRARIES_DIR};${${PKG}_DEPENDENCY_LIBRARIES_DIR}"
+               OUTPUT_VARIABLE ${LIB}_OUTPUT
+            )
+
+      if ( ${LIB}_COMPILE_RES )
+
+        if ( ${LIB}_RUN_RES EQUAL "0" )
+
+          string( REGEX MATCH "version=.*\$" ${LIB}_VERSION_LINE ${${LIB}_OUTPUT}  )
+          string( REPLACE "\n" "" ${LIB}_VERSION_LINE2 ${${LIB}_VERSION_LINE} )
+          string( REPLACE "\r" "" ${LIB}_VERSION_LINE3 ${${LIB}_VERSION_LINE2} )
+          string( REPLACE "version=" "" ${LIB}_VERSION ${${LIB}_VERSION_LINE3} )
+
+        else()
+
+          message( STATUS "WARNING: ${LIB} found but print_${LIB}_version.cpp exited with error condition: ${${LIB}_RUN_RES}" )
+          message( STATUS "${PKG}_INCLUDE_DIR=${${PKG}_INCLUDE_DIR}" )
+          message( STATUS "${PKG}_LIBRARIES=${${PKG}_LIBRARIES}" )
+          message( STATUS "${PKG}_LIBRARIES_DIR=${${PKG}_LIBRARIES_DIR}" )
+          message( STATUS "${${LIB}_OUTPUT}" )
+
+        endif()
+
+      else()
+
+        message( STATUS "WARNING: ${LIB} found but could not compile print_${LIB}_version.cpp:")
+        message( STATUS "${PKG}_INCLUDE_DIR=${${PKG}_INCLUDE_DIR}" )
+        message( STATUS "${PKG}_LIBRARIES=${${PKG}_LIBRARIES}" )
+        message( STATUS "${PKG}_LIBRARIES_DIR=${${PKG}_LIBRARIES_DIR}" )
+        message( STATUS "${${LIB}_OUTPUT}" )
+
+      endif()
+
+      message( STATUS "USING ${LIB}_VERSION = '${${LIB}_VERSION}'" )
+
+    endif()
+
+  endmacro()
+
+  macro( use_lib )
+
+    set (lib "${ARGV0}")
+
+    set (vlib ${CGAL_EXT_LIB_${lib}_PREFIX} )
+
+    if ( ${vlib}_FOUND AND (NOT TARGET CGAL OR WITH_${lib}))
+
+      if ( NOT ${vlib}_SETUP ) # avoid double usage
+
+        if ( "${ARGC}" EQUAL "2" )
+
+          set (usefile "${ARGV1}")
+
+          include( ${usefile} )
+          message (STATUS "Configured ${lib} from UseLIB-file: ${usefile}")
+
+          # UseLIB-file has to set ${vlib}_SETUP to TRUE
+          # TODO EBEB what about Qt5, zlib?
+
+        else()
+
+          ####message( STATUS "${lib} include:     ${${vlib}_INCLUDE_DIR}" )
+          include_directories ( SYSTEM ${${vlib}_INCLUDE_DIR} )
+
+          # TODO EBEB remove definitions?
+          ####message( STATUS "${lib} definitions: ${${vlib}_DEFINITIONS}" )
+          add_definitions( ${${vlib}_DEFINITIONS} "-DCGAL_USE_${vlib}" )
+
+          if ( ${vlib}_LIBRARIES )
+            ####message( STATUS "${lib} libraries:   ${${vlib}_LIBRARIES}" )
+            link_libraries( ${${vlib}_LIBRARIES} )
+          endif()
+
+          ####message (STATUS "Configured ${lib} in standard way")
+
+          set( ${vlib}_SETUP TRUE )
+
+        endif()
+
+      endif()
+
+      if (NOT ${vlib}_SETUP )
+
+         message( WARNING "${vlib} has not been set up" )
+
+      endif()
+
+    else()
+
+      if ( WITH_${lib} )
+        message( SEND_ERROR "Try to use ${lib} that is not found")
+      endif()
+
+    endif()
+
+  endmacro()
+
+
+  macro( use_component component)
+
+    message (STATUS "Requested component: ${component}")
+
+    if(WITH_CGAL_${component})
+      if(TARGET CGAL_${component})
+        add_to_list( CGAL_LIBRARIES CGAL_${component} )
+      else()
+        add_to_list( CGAL_LIBRARIES ${CGAL_${component}_LIBRARY} )
+      endif()
+      add_to_list( CGAL_3RD_PARTY_LIBRARIES  ${CGAL_${component}_3RD_PARTY_LIBRARIES}  )
+
+      add_to_list( CGAL_3RD_PARTY_INCLUDE_DIRS   ${CGAL_${component}_3RD_PARTY_INCLUDE_DIRS}   )
+      add_to_list( CGAL_3RD_PARTY_DEFINITIONS    ${CGAL_${component}_3RD_PARTY_DEFINITIONS}    )
+      add_to_list( CGAL_3RD_PARTY_LIBRARIES_DIRS ${CGAL_${component}_3RD_PARTY_LIBRARIES_DIRS} )
+
+      # Nothing to add for Core
+
+      if (${component} STREQUAL "ImageIO")
+        find_package( ZLIB QUIET )
+
+        if(ZLIB_FOUND)
+          cache_set(CGAL_ImageIO_USE_ZLIB "ON")
+          add_definitions("-DCGAL_USE_ZLIB")
+          include_directories( SYSTEM ${ZLIB_INCLUDE_DIR} )
+        endif(ZLIB_FOUND)
+
+      endif()
+
+      if (${component} STREQUAL "Qt5")
+        find_package(OpenGL QUIET)
+        find_package(Qt5 COMPONENTS OpenGL Gui Core Script ScriptTools QUIET)
+      endif()
+
+    else(WITH_CGAL_${component})
+
+      # now we are talking about 3rd party libs
+      list( FIND CGAL_CONFIGURED_LIBRARIES "CGAL_${component}" POSITION )
+      if ( "${POSITION}" EQUAL "-1" ) # if component is not a CGAL_<lib>
+
+        if (NOT DEFINED CGAL_EXT_LIB_${component}_PREFIX)
+          set(CGAL_EXT_LIB_${component}_PREFIX ${component})
+        endif()
+
+        set( vlib "${CGAL_EXT_LIB_${component}_PREFIX}" )
+
+        if ( NOT CGAL_IGNORE_PRECONFIGURED_${component} AND ${vlib}_FOUND)
+
+          ####message( STATUS "External library ${component} has been preconfigured")
+          use_lib( ${component} ${${vlib}_USE_FILE})
+
+        else()
+
+          ####message( STATUS "External library ${component} has not been preconfigured")
+          if (${component} STREQUAL "ImageIO")
+            find_package( ZLIB QUIET )
+
+            if(ZLIB_FOUND)
+              cache_set(CGAL_ImageIO_USE_ZLIB "ON")
+              add_definitions("-DCGAL_USE_ZLIB")
+              include_directories( SYSTEM ${ZLIB_INCLUDE_DIR} )
+            endif(ZLIB_FOUND)
+
+          endif()
+
+          if (${component} STREQUAL "Qt5")
+            set(CGAL_${component}_FOUND TRUE)
+            find_package(OpenGL QUIET)
+            find_package(Qt5 COMPONENTS OpenGL Gui Core Script ScriptTools QUIET)
+          endif()
+          ####message( STATUS "External library ${vlib} after find")
+          if (${vlib}_FOUND)
+            ####message( STATUS "External library ${vlib} about to be used")
+            use_lib( ${component} ${${vlib}_USE_FILE})
+          endif()
+
+        endif()
+      else()
+
+        if (NOT WITH_CGAL_${component}) 
+          message(STATUS "NOTICE: The CGAL_${component} library seems to be required but is not build. Thus, it is expected that some executables will not be compiled.")
+        endif()
+
+      endif()
+
+    endif(WITH_CGAL_${component})
+
+  endmacro()
+
+  macro( use_essential_libs )
+
+    # Comment: This is subject to be changed in the future
+    #          - either more specific (giving precise include_dir- and link-order)
+    #          - or even less specific if order becomes less relevant
+    # Eric Berberich 2012/06/29
+
+    if(NOT CGAL_DISABLE_GMP)
+      if(RS_FOUND)
+        use_component( RS )
+      endif()
+
+      if(MPFI_FOUND)
+        use_component( MPFI )
+      endif()
+
+      if(MPFR_FOUND)
+        use_component( MPFR )
+      endif()
+
+      if (GMPXX_FOUND)
+        use_component( GMPXX )
+      endif()
+
+      if(GMP_FOUND)
+        use_component( GMP )
+      endif()
+    endif(NOT CGAL_DISABLE_GMP)
+
+    if(LEDA_FOUND)
+      use_component( LEDA )
+    endif()
+
+    if(NTL_FOUND)
+      use_component( NTL )
+    endif()
+  endmacro()
+
+
+  function( cgal_setup_module_path )
+    # Avoid to modify the modules path twice
+    if(NOT CGAL_MODULE_PATH_IS_SET)
+      # Where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
+      set(CGAL_CMAKE_MODULE_PATH ${CGAL_MODULES_DIR})
+
+      set(ORIGINAL_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} PARENT_SCOPE)
+
+      set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CGAL_CMAKE_MODULE_PATH})
+
+      # Export those variables to the parent scope (the scope that calls the function)
+      set(CGAL_MODULE_PATH_IS_SET TRUE PARENT_SCOPE)
+      set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" PARENT_SCOPE)
+      set(CGAL_CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" PARENT_SCOPE)
+      set(ORIGINAL_CMAKE_MODULE_PATH "${ORIGINAL_CMAKE_MODULE_PATH}" PARENT_SCOPE)
+    endif()
+  endfunction()
+
+  macro( create_CGALconfig_files )
+
+    # CGALConfig.cmake is platform specific so it is generated and stored in the binary folder.
+    configure_file("${CGAL_MODULES_DIR}/CGALConfig_binary.cmake.in"  "${CMAKE_BINARY_DIR}/CGALConfig.cmake"        @ONLY)
+
+    # There is also a version of CGALConfig.cmake that is prepared in case CGAL in installed in CMAKE_INSTALL_PREFIX.
+    configure_file("${CGAL_MODULES_DIR}/CGALConfig_install.cmake.in" "${CMAKE_BINARY_DIR}/config/CGALConfig.cmake" @ONLY)
+
+    #write prefix exceptions
+    file( APPEND ${CMAKE_BINARY_DIR}/CGALConfig.cmake "${SPECIAL_PREFIXES}\n")
+    file( APPEND ${CMAKE_BINARY_DIR}/config/CGALConfig.cmake "${SPECIAL_PREFIXES}")
+
+     foreach( lib ${CGAL_SUPPORTING_3RD_PARTY_LIBRARIES} )
+
+       list( FIND CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES "${lib}" POSITION )
+       # if lib is essential or preconfiguration for an activated library ...
+       if ( ("${POSITION}" STRGREATER "-1") OR ( CGAL_ENABLE_PRECONFIG AND WITH_${lib} ))
+
+         set (vlib ${CGAL_EXT_LIB_${lib}_PREFIX} )
+         #the next 'if' is needed to avoid ${vlib} config variables to be overidden in case of a local configuration change
+         file( APPEND ${CMAKE_BINARY_DIR}/CGALConfig.cmake "if (NOT CGAL_IGNORE_PRECONFIGURED_${lib})\n")
+         file( APPEND ${CMAKE_BINARY_DIR}/CGALConfig.cmake "  set( ${vlib}_FOUND           \"${${vlib}_FOUND}\" )\n")
+         file( APPEND ${CMAKE_BINARY_DIR}/CGALConfig.cmake "  set( ${vlib}_USE_FILE        \"${${vlib}_USE_FILE}\" )\n")
+         file( APPEND ${CMAKE_BINARY_DIR}/CGALConfig.cmake "  set( ${vlib}_INCLUDE_DIR     \"${${vlib}_INCLUDE_DIR}\" )\n")
+         file( APPEND ${CMAKE_BINARY_DIR}/CGALConfig.cmake "  set( ${vlib}_LIBRARIES       \"${${vlib}_LIBRARIES}\" )\n")
+         file( APPEND ${CMAKE_BINARY_DIR}/CGALConfig.cmake "  set( ${vlib}_DEFINITIONS     \"${${vlib}_DEFINITIONS}\" )\n")
+         file( APPEND ${CMAKE_BINARY_DIR}/CGALConfig.cmake "endif()\n\n")
+
+
+         #the next 'if' is needed to avoid ${vlib} config variables to be overidden in case of a local configuration change
+         file( APPEND ${CMAKE_BINARY_DIR}/config/CGALConfig.cmake "if (NOT CGAL_IGNORE_PRECONFIGURED_${lib})\n")
+         file( APPEND ${CMAKE_BINARY_DIR}/config/CGALConfig.cmake "  set( ${vlib}_FOUND           \"${${vlib}_FOUND}\")\n")
+         file( APPEND ${CMAKE_BINARY_DIR}/config/CGALConfig.cmake "  set( ${vlib}_USE_FILE        \"${${vlib}_USE_FILE}\" )\n")
+         file( APPEND ${CMAKE_BINARY_DIR}/config/CGALConfig.cmake "  set( ${vlib}_INCLUDE_DIR     \"${${vlib}_INCLUDE_DIR}\" )\n")
+         file( APPEND ${CMAKE_BINARY_DIR}/config/CGALConfig.cmake "  set( ${vlib}_LIBRARIES       \"${${vlib}_LIBRARIES}\" )\n")
+         file( APPEND ${CMAKE_BINARY_DIR}/config/CGALConfig.cmake "  set( ${vlib}_DEFINITIONS     \"${${vlib}_DEFINITIONS}\" )\n")
+         file( APPEND ${CMAKE_BINARY_DIR}/config/CGALConfig.cmake "endif()\n\n")
+       endif()
+
+     endforeach()
+
+  endmacro()
+
+  macro ( fetch_env_var VAR )
+    if ( "${${VAR}}" STREQUAL "" )
+      set( ${VAR}_env_value "$ENV{${VAR}}" )
+      if ( NOT "${${VAR}_env_value}" STREQUAL "" )
+        # Convert Windows path to Unix-style
+        FILE(TO_CMAKE_PATH ${${VAR}_env_value} ${VAR})
+      endif()
+    endif()
+  endmacro()
+
+## All the following macros are probably unused. -- Laurent Rineau, 2011/07/21
+
+  # Composes a tagged list of libraries: a list with interpersed keywords or tags
+  # indicating that all following libraries, up to the next tag, are to be linked only for the
+  # corresponding build type. The 'general' tag indicates libraries that corresponds to all build types.
+  # 'optimized' corresponds to release builds and 'debug' to debug builds. Tags are case sensitve and
+  # the inital range of libraries listed before any tag is implicitely 'general'
+  #
+  # This macro takes 3 lists of general, optimized and debug libraries, resp, and populates the list
+  # given in the fourth argument.
+  #
+  # The first three parameters must be strings containing a semi-colon separated list of elements.
+  # All three lists must be passed, but any of them can be an empty string "".
+  # The fourth parameter, corresponding to the result, must be a variable name and it will be APPENDED
+  # (retaining any previous contents)
+  #
+  # If there is a last parameter whose value is "PERSISTENT" then the result is an internal cached variable,
+  # otherwise it is an in-memory variable
+  #
+  macro( compose_tagged_libraries libs_general libs_optimized libs_debug libs )
+
+    if ( "${ARGN}" STREQUAL "PERSISTENT" )
+      set( _CTL_IN_CACHE "PERSISTENT" )
+    else()
+      set( _CTL_IN_CACHE )
+    endif()
+
+    if ( NOT "${libs_general}" STREQUAL "" )
+      add_to_list( ${libs} ${_CTL_IN_CACHE} ${libs_general} )
+    endif()
+
+    if ( NOT "${libs_optimized}" STREQUAL "" )
+      add_to_list( ${libs} ${_CTL_IN_CACHE} optimized ${libs_optimized} )
+    endif()
+
+    if ( NOT "${libs_debug}" STREQUAL "" )
+      add_to_list( ${libs} ${_CTL_IN_CACHE} debug ${libs_debug} )
+    endif()
+
+  endmacro()
+
+  # Decomposes a tagged list of libraries (see macro compose_tagged_libraries).
+  # The first argument is the tagged list and the next 3 arguments are the lists
+  # where the general, optimized and debug libraries are collected.
+  #
+  # The first parameter must be a string containing a semi-colon separated list of elements.
+  # It cannot be ommitted, but it can be an empty string ""
+  #
+  # TThe next three arguments must be the names of the variables containing the result, and they
+  # will be APPENDED (retaining any previous contents)
+  #
+  # If there is a last parameter whose value is "PERSISTENT" then the result variables are internal in the cache,
+  # otherwise they are in-memory.
+  #
+  macro( decompose_tagged_libraries libs libs_general libs_optimized libs_debug )
+
+    if ( "${ARGN}" STREQUAL "PERSISTENT" )
+      set( _DTL_IN_CACHE "PERSISTENT" )
+    else()
+      set( _DTL_IN_CACHE )
+    endif()
+
+    set( _DTL_tag general )
+
+    foreach( _DTL_lib ${libs} )
+
+      if ( "${_DTL_lib}" STREQUAL "general" OR "${_DTL_lib}" STREQUAL "optimized" OR "${_DTL_lib}" STREQUAL "debug" )
+
+        set( _DTL_tag "${_DTL_lib}" )
+
+      else()
+
+        if (     "${_DTL_tag}" STREQUAL "general"   )
+                                                       set( _DTL_target ${libs_general}   )
+        elseif ( "${_DTL_tag}" STREQUAL "optimized" )
+                                                       set( _DTL_target ${libs_optimized} )
+        else()
+                                                       set( _DTL_target ${libs_debug}     )
+        endif()
+
+        add_to_list( ${_DTL_target} ${_DTL_IN_CACHE} ${_DTL_lib} )
+
+      endif()
+
+    endforeach()
+
+  endmacro()
+
+  # Given lists of optimized and debug libraries, creates a tagged list which will
+  # contain the libraries listed in the 'general' section if any of the two lists is empty,
+  #
+  # All arguments are variable names (not values), thus the input list can be undefined or empty.
+  # The return variable ('libs') will be APPENDED the result (retaining any previous contents)
+  #
+  # If there is a last parameter whose value is "PERSISTENT" then the result is an internal cached variable,
+  # otherwise it is an in-memory variable
+  #
+  # Example:
+  #
+  #   set( LIBS_1 libA.so libB.so )
+  #   set( LIBS_2 libC.so )
+  #
+  #   tag_libraries( LIBS_1 LIBS_2 LIBS_R )
+  #
+  # LIBS_R -> optimized;libA.so;libB.so;debug;libC.so
+  #
+  #   tag_libraries( LIBS_1 SOME_UNDEFINED_VARIABLE_OR_EMPTY_LIST LIBS_R )
+  #
+  # LIBS_R -> libA.so;libB.so  (implicitely 'general' since there is no tag)
+  #
+  #   tag_libraries( SOME_UNDEFINED_VARIABLE_OR_EMPTY_LIST LIBS_2 LIBS_R )
+  #
+  # LIBS_R -> libC.so  (implicitely 'general' since there is no tag)
+  #
+  macro( tag_libraries libs_general_or_optimized libs_general_or_debug libs )
+
+    list( LENGTH ${libs_general_or_optimized} _TL_libs_general_or_optimized_len )
+    list( LENGTH ${libs_general_or_debug}     _TL_libs_general_or_debug_len     )
+
+    if ( _TL_libs_general_or_optimized_len EQUAL 0 )
+                                                     compose_tagged_libraries( "${${libs_general_or_debug}}"     ""                                 ""                           ${libs} ${ARGN} )
+    elseif ( _TL_libs_general_or_debug_len EQUAL 0 )
+                                                     compose_tagged_libraries( "${${libs_general_or_optimized}}" ""                                 ""                           ${libs} ${ARGN} )
+    else()
+                                                     compose_tagged_libraries( ""                                "${${libs_general_or_optimized}}" "${${libs_general_or_debug}}" ${libs} ${ARGN} )
+    endif()
+
+  endmacro()
+
+  # add_to_tagged_libraries( libsR ${libsA} <PERSISTENT> )
+  #
+  # Appends the list of tagged libraries contained in the variable 'libA' to the list
+  # of tagged libraries contained in the variable 'libR', properly redistributing each tagged subsequence.
+  #
+  # The first argument is the name of the variable recieving the list. It will be APPENDED
+  # (retaining any previous contents).
+  # The second parameter is a single string value containing the tagged
+  # lists of libraries to append (as a semi-colon separated list). It can be empty, in which case noting is added.
+  #
+  # If there is a third parameter whose value is PERSISTENT, then 'libR' is an internal cached variable, otherwise
+  # it is an in-memory variable.
+  #
+  # It is not possible to append more than one list in the same call.
+  #
+  # Example:
+  #
+  #   set( LIBS_1 libG0.so libG1.so optimized libO0.so)
+  #   set( LIBS_2 libG2.so debug libD0.so)
+  #   set( LIBS_3 debug libD1.so optimized libO1.so libO2.so )
+  #
+  #   concat_tagged_libraries( LIBS_R ${LIBS_1} PERSISTENT )
+  #   concat_tagged_libraries( LIBS_R ${LIBS_2} PERSISTENT )
+  #   concat_tagged_libraries( LIBS_R ${LIBS_3} PERSISTENT )
+  #
+  # LIBS_R -> libG0.so;libG1.so;libG2.so;optimized;libO0.so;libO1.so;libO2.so;debug;libD0.so;libD1.so, in the cache
+  #
+  macro( add_to_tagged_libraries libsR in_cache libsA  )
+
+    if ( "${in_cache}" STREQUAL "PERSISTENT" )
+      set( _CTL_IN_CACHE "PERSISTENT" )
+    else()
+      set( _CTL_IN_CACHE )
+    endif()
+
+    set( _CTL_general_0   )
+    set( _CTL_optimized_0 )
+    set( _CTL_debug_0     )
+    set( _CTL_general_1   )
+    set( _CTL_optimized_1 )
+    set( _CTL_debug_0     )
+
+    decompose_tagged_libraries( "${${libsR}}" _CTL_general_0 _CTL_optimized_0 _CTL_debug_0 )
+    decompose_tagged_libraries( "${libsA}"    _CTL_general_1 _CTL_optimized_1 _CTL_debug_1 )
+
+    add_to_list( _CTL_general_0   ${_CTL_general_1}   )
+    add_to_list( _CTL_optimized_0 ${_CTL_optimized_1} )
+    add_to_list( _CTL_debug_0     ${_CTL_debug_1}     )
+
+    if ( "${_CTL_IN_CACHE}" STREQUAL "PERSISTENT" )
+      cache_set( ${libsR} )
+    else()
+      set( ${libsR} )
+    endif()
+
+    compose_tagged_libraries( "${_CTL_general_0}" "${_CTL_optimized_0}" "${_CTL_debug_0}" ${libsR} ${_CTL_IN_CACHE} )
+
+  endmacro()
+
+
+  macro( add_to_persistent_tagged_libraries libsR )
+    add_to_tagged_libraries( ${libsR} PERSISTENT "${ARGN}" )
+  endmacro()
+
+  macro( add_to_in_memory_tagged_libraries libsR )
+    add_to_tagged_libraries( ${libsR} NOT_PERSISTENT "${ARGN}" )
+  endmacro()
+
+
+endif()
+
+
+function(process_CGAL_subdirectory entry subdir type_name)
+  # For example, subdir can be "examples", type_name "example", and entry "Mesh_2"
+
+  if ( CGAL_BRANCH_BUILD )
+    string( REGEX REPLACE "${CMAKE_SOURCE_DIR}/.*/${subdir}/" "" ENTRY_DIR_NAME "${entry}" )
+  else()
+    string( REGEX REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" ENTRY_DIR_NAME "${entry}" )
+  endif()
+
+  if( NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") # out-of-source
+    make_directory("${CMAKE_BINARY_DIR}/${subdir}/${ENTRY_DIR_NAME}")
+  endif()
+
+  set(ADD_SUBDIR TRUE)
+
+  if(EXISTS ${entry}/../../dont_submit)
+    file(STRINGS ${entry}/../../dont_submit dont_submit_grep REGEX "^${ENTRY_DIR_NAME}/?\$")
+    if(dont_submit_grep)
+      set(ADD_SUBDIR FALSE)
+    endif()
+    file(STRINGS ${entry}/../../dont_submit dont_submit_grep REGEX "^${subdir}/${ENTRY_DIR_NAME}/?\$")
+    if(dont_submit_grep)
+      set(ADD_SUBDIR FALSE)
+    endif()
+    file(STRINGS ${entry}/../../dont_submit dont_submit_grep REGEX "^${subdir}/?\$")
+    if(dont_submit_grep)
+      set(ADD_SUBDIR FALSE)
+    endif()
+  endif()
+
+  if(ADD_SUBDIR)
+    message("\n-- Configuring ${subdir} in ${subdir}/${ENTRY_DIR_NAME}")
+    if(EXISTS ${entry}/CMakeLists.txt)
+      add_subdirectory( ${entry} ${CMAKE_BINARY_DIR}/${subdir}/${ENTRY_DIR_NAME} )
+    else()
+      if(CGAL_CREATE_CMAKE_SCRIPT)
+#        message("bah ${CGAL_CREATE_CMAKE_SCRIPT} ${type_name} --source_dir ${entry}")
+        execute_process(
+          COMMAND bash ${CGAL_CREATE_CMAKE_SCRIPT} ${type_name} --source_dir "${entry}"
+          WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/${subdir}/${ENTRY_DIR_NAME}"
+          RESULT_VARIABLE RESULT_VAR OUTPUT_QUIET)
+        if(NOT RESULT_VAR)
+#          message("Subdir ${CMAKE_BINARY_DIR}/${subdir}/${ENTRY_DIR_NAME}")
+          add_subdirectory( "${CMAKE_BINARY_DIR}/${subdir}/${ENTRY_DIR_NAME}" "${CMAKE_BINARY_DIR}/${subdir}/${ENTRY_DIR_NAME}")
+        endif()
+      endif()
+    endif()
+  else()
+    message(STATUS "${subdir}/${ENTRY_DIR_NAME} is in dont_submit")
+  endif()
+endfunction()
+
diff --git a/3rdparty/CGAL-4.8/cmake/modules/CGAL_SCM.cmake b/3rdparty/CGAL/cmake/modules/CGAL_SCM.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/CGAL_SCM.cmake
rename to 3rdparty/CGAL/cmake/modules/CGAL_SCM.cmake
diff --git a/3rdparty/CGAL/cmake/modules/CGAL_SetupBoost.cmake b/3rdparty/CGAL/cmake/modules/CGAL_SetupBoost.cmake
new file mode 100644
index 0000000..506faa0
--- /dev/null
+++ b/3rdparty/CGAL/cmake/modules/CGAL_SetupBoost.cmake
@@ -0,0 +1,63 @@
+if ( NOT CGAL_Boost_Setup )
+
+  include(CGAL_TweakFindBoost)
+
+  set ( CGAL_requires_Boost_libs TRUE )
+  if ( DEFINED  MSVC_VERSION AND "${MSVC_VERSION}" GREATER 1800)
+    set ( CGAL_requires_Boost_libs FALSE )
+  endif()
+
+  if ( CMAKE_COMPILER_IS_GNUCXX
+      AND(
+        #CMAKE_CXX_STANDARD_DEFAULT is available starting cmake 3.4
+        ( DEFINED CMAKE_CXX_STANDARD_DEFAULT
+          AND ${CMAKE_CXX_STANDARD_DEFAULT} GREATER 03
+          AND ${CMAKE_CXX_STANDARD_DEFAULT} LESS 98 )
+        #GCC 4.8+ with c++11 on
+        OR ( NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8
+          AND CMAKE_CXX_FLAGS MATCHES "\\-std=(c|gnu)\\+\\+[01][14yxz]")
+        #GCC 6.0+ without c++03 on
+        OR ( NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0
+             AND NOT CMAKE_CXX_FLAGS MATCHES "\\-std=(c|gnu)\\+\\+[90][83]"
+             AND NOT CMAKE_CXX_FLAGS MATCHES "\\-ansi")
+      ) )
+    set ( CGAL_requires_Boost_libs FALSE )
+  endif()
+
+  if (CGAL_requires_Boost_libs)
+    find_package( Boost 1.48 REQUIRED thread system )
+  else()
+    find_package( Boost 1.48 REQUIRED )
+  endif()
+
+  if(Boost_FOUND)
+    if(DEFINED Boost_DIR AND NOT Boost_DIR)
+      # Unset that cache variable that is set in the cache by FindBoost
+      # (while it was searching for boost-cmake).
+      unset(Boost_DIR CACHE)
+      set(Boost_NO_BOOST_CMAKE TRUE CACHE INTERNAL "Avoid future search of boost-cmake")
+    endif()
+  endif()
+  
+  message( STATUS "Boost include:     ${Boost_INCLUDE_DIRS}" )
+  message( STATUS "Boost libraries:   ${Boost_LIBRARIES}" )
+  message( STATUS "Boost definitions: ${Boost_DEFINITIONS}" )
+  
+  set ( CGAL_USE_BOOST 1 )
+  
+  include(CGAL_Macros)
+  
+  add_to_cached_list(CGAL_3RD_PARTY_INCLUDE_DIRS   ${Boost_INCLUDE_DIRS} )
+  add_to_cached_list(CGAL_3RD_PARTY_LIBRARIES_DIRS ${Boost_LIBRARY_DIRS} )
+  add_to_cached_list(CGAL_3RD_PARTY_DEFINITIONS    ${Boost_DEFINITIONS}  )
+  
+  if ( NOT MSVC )
+    add_to_cached_list(CGAL_3RD_PARTY_LIBRARIES ${Boost_LIBRARIES} )
+  endif()
+  
+  message( STATUS "USING BOOST_VERSION = '${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}'" )
+  
+  set ( CGAL_Boost_Setup TRUE )
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/cmake/modules/CGAL_SetupDependencies.cmake b/3rdparty/CGAL/cmake/modules/CGAL_SetupDependencies.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/CGAL_SetupDependencies.cmake
rename to 3rdparty/CGAL/cmake/modules/CGAL_SetupDependencies.cmake
diff --git a/3rdparty/CGAL-4.8/cmake/modules/CGAL_SetupFlags.cmake b/3rdparty/CGAL/cmake/modules/CGAL_SetupFlags.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/CGAL_SetupFlags.cmake
rename to 3rdparty/CGAL/cmake/modules/CGAL_SetupFlags.cmake
diff --git a/3rdparty/CGAL-4.8/cmake/modules/CGAL_SetupVLD.cmake b/3rdparty/CGAL/cmake/modules/CGAL_SetupVLD.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/CGAL_SetupVLD.cmake
rename to 3rdparty/CGAL/cmake/modules/CGAL_SetupVLD.cmake
diff --git a/3rdparty/CGAL-4.8/cmake/modules/CGAL_TweakFindBoost.cmake b/3rdparty/CGAL/cmake/modules/CGAL_TweakFindBoost.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/CGAL_TweakFindBoost.cmake
rename to 3rdparty/CGAL/cmake/modules/CGAL_TweakFindBoost.cmake
diff --git a/3rdparty/CGAL-4.8/cmake/modules/CGAL_UseBLAS.cmake b/3rdparty/CGAL/cmake/modules/CGAL_UseBLAS.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/CGAL_UseBLAS.cmake
rename to 3rdparty/CGAL/cmake/modules/CGAL_UseBLAS.cmake
diff --git a/3rdparty/CGAL-4.8/cmake/modules/CGAL_UseLAPACK.cmake b/3rdparty/CGAL/cmake/modules/CGAL_UseLAPACK.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/CGAL_UseLAPACK.cmake
rename to 3rdparty/CGAL/cmake/modules/CGAL_UseLAPACK.cmake
diff --git a/3rdparty/CGAL-4.8/cmake/modules/CGAL_UseLEDA.cmake b/3rdparty/CGAL/cmake/modules/CGAL_UseLEDA.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/CGAL_UseLEDA.cmake
rename to 3rdparty/CGAL/cmake/modules/CGAL_UseLEDA.cmake
diff --git a/3rdparty/CGAL-4.8/cmake/modules/CGAL_UseMKL.cmake b/3rdparty/CGAL/cmake/modules/CGAL_UseMKL.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/CGAL_UseMKL.cmake
rename to 3rdparty/CGAL/cmake/modules/CGAL_UseMKL.cmake
diff --git a/3rdparty/CGAL-4.8/cmake/modules/CGAL_UseMPFI.cmake b/3rdparty/CGAL/cmake/modules/CGAL_UseMPFI.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/CGAL_UseMPFI.cmake
rename to 3rdparty/CGAL/cmake/modules/CGAL_UseMPFI.cmake
diff --git a/3rdparty/CGAL-4.8/cmake/modules/CGAL_UseRS.cmake b/3rdparty/CGAL/cmake/modules/CGAL_UseRS.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/CGAL_UseRS.cmake
rename to 3rdparty/CGAL/cmake/modules/CGAL_UseRS.cmake
diff --git a/3rdparty/CGAL-4.8/cmake/modules/CGAL_UseRS3.cmake b/3rdparty/CGAL/cmake/modules/CGAL_UseRS3.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/CGAL_UseRS3.cmake
rename to 3rdparty/CGAL/cmake/modules/CGAL_UseRS3.cmake
diff --git a/3rdparty/CGAL-4.8/cmake/modules/CGAL_UseTAUCS.cmake b/3rdparty/CGAL/cmake/modules/CGAL_UseTAUCS.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/CGAL_UseTAUCS.cmake
rename to 3rdparty/CGAL/cmake/modules/CGAL_UseTAUCS.cmake
diff --git a/3rdparty/CGAL-4.8/cmake/modules/CGAL_VersionUtils.cmake b/3rdparty/CGAL/cmake/modules/CGAL_VersionUtils.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/CGAL_VersionUtils.cmake
rename to 3rdparty/CGAL/cmake/modules/CGAL_VersionUtils.cmake
diff --git a/3rdparty/CGAL-4.8/cmake/modules/FindBLAS.cmake b/3rdparty/CGAL/cmake/modules/FindBLAS.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/FindBLAS.cmake
rename to 3rdparty/CGAL/cmake/modules/FindBLAS.cmake
diff --git a/3rdparty/CGAL-4.8/cmake/modules/FindCGAL.cmake b/3rdparty/CGAL/cmake/modules/FindCGAL.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/FindCGAL.cmake
rename to 3rdparty/CGAL/cmake/modules/FindCGAL.cmake
diff --git a/3rdparty/CGAL-4.8/cmake/modules/FindCGAL_CORE.cmake b/3rdparty/CGAL/cmake/modules/FindCGAL_CORE.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/FindCGAL_CORE.cmake
rename to 3rdparty/CGAL/cmake/modules/FindCGAL_CORE.cmake
diff --git a/3rdparty/CGAL-4.8/cmake/modules/FindCORE.cmake b/3rdparty/CGAL/cmake/modules/FindCORE.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/FindCORE.cmake
rename to 3rdparty/CGAL/cmake/modules/FindCORE.cmake
diff --git a/3rdparty/CGAL-4.8/cmake/modules/FindESBTL.cmake b/3rdparty/CGAL/cmake/modules/FindESBTL.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/FindESBTL.cmake
rename to 3rdparty/CGAL/cmake/modules/FindESBTL.cmake
diff --git a/3rdparty/CGAL/cmake/modules/FindEigen3.cmake b/3rdparty/CGAL/cmake/modules/FindEigen3.cmake
new file mode 100644
index 0000000..e56005e
--- /dev/null
+++ b/3rdparty/CGAL/cmake/modules/FindEigen3.cmake
@@ -0,0 +1,84 @@
+# - Try to find Eigen3 lib
+#
+# This module supports requiring a minimum version, e.g. you can do
+#   find_package(Eigen3 3.1.2)
+# to require version 3.1.2 or newer of Eigen3.
+#
+# Once done this will define
+#
+#  EIGEN3_FOUND - system has eigen lib with correct version
+#  EIGEN3_INCLUDE_DIR - the eigen include directory
+#  EIGEN3_VERSION - eigen version
+
+# Copyright (c) 2006, 2007 Montel Laurent, <montel at kde.org>
+# Copyright (c) 2008, 2009 Gael Guennebaud, <g.gael at free.fr>
+# Copyright (c) 2009 Benoit Jacob <jacob.benoit.1 at gmail.com>
+# Redistribution and use is allowed according to the terms of the 2-clause BSD license.
+
+include(FindPackageHandleStandardArgs)
+
+if(NOT Eigen3_FIND_VERSION)
+  if(NOT Eigen3_FIND_VERSION_MAJOR)
+    set(Eigen3_FIND_VERSION_MAJOR 2)
+  endif(NOT Eigen3_FIND_VERSION_MAJOR)
+  if(NOT Eigen3_FIND_VERSION_MINOR)
+    set(Eigen3_FIND_VERSION_MINOR 91)
+  endif(NOT Eigen3_FIND_VERSION_MINOR)
+  if(NOT Eigen3_FIND_VERSION_PATCH)
+    set(Eigen3_FIND_VERSION_PATCH 0)
+  endif(NOT Eigen3_FIND_VERSION_PATCH)
+
+  set(Eigen3_FIND_VERSION "${Eigen3_FIND_VERSION_MAJOR}.${Eigen3_FIND_VERSION_MINOR}.${Eigen3_FIND_VERSION_PATCH}")
+endif(NOT Eigen3_FIND_VERSION)
+
+macro(_eigen3_get_version)
+  file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen3_version_header)
+
+  string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen3_world_version_match "${_eigen3_version_header}")
+  set(EIGEN3_WORLD_VERSION "${CMAKE_MATCH_1}")
+  string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen3_major_version_match "${_eigen3_version_header}")
+  set(EIGEN3_MAJOR_VERSION "${CMAKE_MATCH_1}")
+  string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen3_minor_version_match "${_eigen3_version_header}")
+  set(EIGEN3_MINOR_VERSION "${CMAKE_MATCH_1}")
+
+  set(EIGEN3_VERSION ${EIGEN3_WORLD_VERSION}.${EIGEN3_MAJOR_VERSION}.${EIGEN3_MINOR_VERSION})
+endmacro(_eigen3_get_version)
+
+if (EIGEN3_INCLUDE_DIR)
+
+  if (EXISTS ${EIGEN3_INCLUDE_DIR}/signature_of_eigen3_matrix_library)
+    # in cache already and valid
+    _eigen3_get_version()
+    set(EIGEN3_FOUND ${EIGEN3_VERSION_OK})
+
+    find_package_handle_standard_args(Eigen3 
+      REQUIRED_VARS EIGEN3_INCLUDE_DIR
+      VERSION_VAR EIGEN3_VERSION)
+
+  else()
+    message(STATUS "Eigen3 path specified in cmake variable EIGEN3_INCLUDE_DIR is "
+                    "set to ${EIGEN3_INCLUDE_DIR}, but that path does not contains the file "
+                    "signature_of_eigen3_matrix_library and is considered as invalid.")
+  endif()
+
+
+
+else (EIGEN3_INCLUDE_DIR)
+
+  find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library
+      HINTS ENV EIGEN3_INC_DIR
+            ENV EIGEN3_DIR
+      PATHS ${KDE4_INCLUDE_DIR}
+      PATH_SUFFIXES include eigen3 eigen
+      DOC "Directory containing the Eigen3 header files"
+    )
+
+  if(EIGEN3_INCLUDE_DIR)
+    _eigen3_get_version()
+  endif(EIGEN3_INCLUDE_DIR)
+
+  find_package_handle_standard_args(Eigen3 
+    REQUIRED_VARS EIGEN3_INCLUDE_DIR
+    VERSION_VAR EIGEN3_VERSION)
+
+endif(EIGEN3_INCLUDE_DIR)
diff --git a/3rdparty/CGAL-4.8/cmake/modules/FindF2C.cmake b/3rdparty/CGAL/cmake/modules/FindF2C.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/FindF2C.cmake
rename to 3rdparty/CGAL/cmake/modules/FindF2C.cmake
diff --git a/3rdparty/CGAL-4.8/cmake/modules/FindGLEW.cmake b/3rdparty/CGAL/cmake/modules/FindGLEW.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/FindGLEW.cmake
rename to 3rdparty/CGAL/cmake/modules/FindGLEW.cmake
diff --git a/3rdparty/CGAL-4.8/cmake/modules/FindGMP.cmake b/3rdparty/CGAL/cmake/modules/FindGMP.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/FindGMP.cmake
rename to 3rdparty/CGAL/cmake/modules/FindGMP.cmake
diff --git a/3rdparty/CGAL-4.8/cmake/modules/FindGMPXX.cmake b/3rdparty/CGAL/cmake/modules/FindGMPXX.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/FindGMPXX.cmake
rename to 3rdparty/CGAL/cmake/modules/FindGMPXX.cmake
diff --git a/3rdparty/CGAL-4.8/cmake/modules/FindIPE.cmake b/3rdparty/CGAL/cmake/modules/FindIPE.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/FindIPE.cmake
rename to 3rdparty/CGAL/cmake/modules/FindIPE.cmake
diff --git a/3rdparty/CGAL-4.8/cmake/modules/FindLAPACK.cmake b/3rdparty/CGAL/cmake/modules/FindLAPACK.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/FindLAPACK.cmake
rename to 3rdparty/CGAL/cmake/modules/FindLAPACK.cmake
diff --git a/3rdparty/CGAL-4.8/cmake/modules/FindLEDA.cmake b/3rdparty/CGAL/cmake/modules/FindLEDA.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/FindLEDA.cmake
rename to 3rdparty/CGAL/cmake/modules/FindLEDA.cmake
diff --git a/3rdparty/CGAL-4.8/cmake/modules/FindMKL.cmake b/3rdparty/CGAL/cmake/modules/FindMKL.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/FindMKL.cmake
rename to 3rdparty/CGAL/cmake/modules/FindMKL.cmake
diff --git a/3rdparty/CGAL-4.8/cmake/modules/FindMPFI.cmake b/3rdparty/CGAL/cmake/modules/FindMPFI.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/FindMPFI.cmake
rename to 3rdparty/CGAL/cmake/modules/FindMPFI.cmake
diff --git a/3rdparty/CGAL-4.8/cmake/modules/FindMPFR.cmake b/3rdparty/CGAL/cmake/modules/FindMPFR.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/FindMPFR.cmake
rename to 3rdparty/CGAL/cmake/modules/FindMPFR.cmake
diff --git a/3rdparty/CGAL-4.8/cmake/modules/FindNTL.cmake b/3rdparty/CGAL/cmake/modules/FindNTL.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/FindNTL.cmake
rename to 3rdparty/CGAL/cmake/modules/FindNTL.cmake
diff --git a/3rdparty/CGAL-4.8/cmake/modules/FindOpenGL.cmake b/3rdparty/CGAL/cmake/modules/FindOpenGL.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/FindOpenGL.cmake
rename to 3rdparty/CGAL/cmake/modules/FindOpenGL.cmake
diff --git a/3rdparty/CGAL-4.8/cmake/modules/FindOpenMesh.cmake b/3rdparty/CGAL/cmake/modules/FindOpenMesh.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/FindOpenMesh.cmake
rename to 3rdparty/CGAL/cmake/modules/FindOpenMesh.cmake
diff --git a/3rdparty/CGAL-4.8/cmake/modules/FindQGLViewer.cmake b/3rdparty/CGAL/cmake/modules/FindQGLViewer.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/FindQGLViewer.cmake
rename to 3rdparty/CGAL/cmake/modules/FindQGLViewer.cmake
diff --git a/3rdparty/CGAL-4.8/cmake/modules/FindRS.cmake b/3rdparty/CGAL/cmake/modules/FindRS.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/FindRS.cmake
rename to 3rdparty/CGAL/cmake/modules/FindRS.cmake
diff --git a/3rdparty/CGAL-4.8/cmake/modules/FindRS3.cmake b/3rdparty/CGAL/cmake/modules/FindRS3.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/FindRS3.cmake
rename to 3rdparty/CGAL/cmake/modules/FindRS3.cmake
diff --git a/3rdparty/CGAL-4.8/cmake/modules/FindTAUCS.cmake b/3rdparty/CGAL/cmake/modules/FindTAUCS.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/FindTAUCS.cmake
rename to 3rdparty/CGAL/cmake/modules/FindTAUCS.cmake
diff --git a/3rdparty/CGAL/cmake/modules/FindTBB.cmake b/3rdparty/CGAL/cmake/modules/FindTBB.cmake
new file mode 100644
index 0000000..13f4d92
--- /dev/null
+++ b/3rdparty/CGAL/cmake/modules/FindTBB.cmake
@@ -0,0 +1,425 @@
+# Locate Intel Threading Building Blocks include paths and libraries
+# FindTBB.cmake can be found at https://code.google.com/p/findtbb/
+# Written by Hannes Hofmann <hannes.hofmann _at_ informatik.uni-erlangen.de>
+# Improvements by Gino van den Bergen <gino _at_ dtecta.com>,
+#   Florian Uhlig <F.Uhlig _at_ gsi.de>,
+#   Jiri Marsik <jiri.marsik89 _at_ gmail.com>
+
+# The MIT License
+#
+# Copyright (c) 2011 Hannes Hofmann
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+# GvdB: This module uses the environment variable TBB_ARCH_PLATFORM which defines architecture and compiler.
+#   e.g. "ia32/vc8" or "em64t/cc4.1.0_libc2.4_kernel2.6.16.21"
+#   TBB_ARCH_PLATFORM is set by the build script tbbvars[.bat|.sh|.csh], which can be found
+#   in the TBB installation directory (TBB_INSTALL_DIR).
+#
+# GvdB: Mac OS X distribution places libraries directly in lib directory.
+#
+# For backwards compatibility, you may explicitely set the CMake variables TBB_ARCHITECTURE and TBB_COMPILER.
+# TBB_ARCHITECTURE [ ia32 | em64t | itanium ]
+#   which architecture to use
+# TBB_COMPILER e.g. vc9 or cc3.2.3_libc2.3.2_kernel2.4.21 or cc4.0.1_os10.4.9
+#   which compiler to use (detected automatically on Windows)
+
+# This module respects
+# TBB_INSTALL_DIR or $ENV{TBB21_INSTALL_DIR} or $ENV{TBB_INSTALL_DIR}
+
+# This module defines
+# TBB_INCLUDE_DIRS, where to find task_scheduler_init.h, etc.
+# TBB_LIBRARY_DIRS, where to find TBB libraries
+# TBB_INSTALL_DIR, the base TBB install directory.
+# TBB_LIBRARIES, all the following TBB libraries (both release and debug versions, using "optimized" and "debug" CMake keywords). Note that if the debug versions are not found, the release versions will be used instead for the debug mode.
+#   TBB_RELEASE_LIBRARY, the TBB release library
+#   TBB_MALLOC_RELEASE_LIBRARY, the TBB release malloc library
+#   TBB_DEBUG_LIBRARY, the TBB debug library
+#   TBB_MALLOC_DEBUG_LIBRARY, the TBB debug malloc library
+# TBB_FOUND, If false, don't try to use TBB.
+# TBB_INTERFACE_VERSION, as defined in tbb/tbb_stddef.h
+# TBB_MALLOCPROXY_DEBUG_LIBRARY, the TBB debug malloc_proxy library (not included in TBB_LIBRARIES since it's optionnal)
+# TBB_MALLOCPROXY_RELEASE_LIBRARY, the TBB release malloc_proxy library (not included in TBB_LIBRARIES since it's optionnal)
+
+include(CheckCXXSourceCompiles)
+
+# Usage:
+#   try_TBB_with_pthread(<result_var_name> [additional linker args...])
+function(try_TBB_with_pthread result_var)
+    set(TBB_try_ts_source "
+          #include <tbb/enumerable_thread_specific.h>
+          int main() {
+            tbb::enumerable_thread_specific<
+              bool*,
+              tbb::cache_aligned_allocator<bool*>,
+              tbb::ets_key_per_instance> grid;
+          }
+          ")
+    set(CMAKE_REQUIRED_LIBRARIES ${ALL_TBB_LIBRARIES} ${ARGN})
+    set(CMAKE_REQUIRED_INCLUDES ${TBB_INCLUDE_DIR})
+    check_cxx_source_compiles("${TBB_try_ts_source}" ${result_var})
+    set(${result_var} ${${result_var}} PARENT_SCOPE)
+endfunction(try_TBB_with_pthread)
+
+if (WIN32)
+    # has em64t/vc8 em64t/vc9
+    # has ia32/vc7.1 ia32/vc8 ia32/vc9
+    set(_TBB_DEFAULT_INSTALL_DIR "C:/Program Files/Intel/TBB" "C:/Program Files (x86)/Intel/TBB")
+    set(_TBB_LIB_RELEASE_NAME "tbb")
+    set(_TBB_LIB_MALLOC_RELEASE_NAME "${_TBB_LIB_RELEASE_NAME}malloc")
+    set(_TBB_LIB_MALLOCPROXY_RELEASE_NAME "${_TBB_LIB_RELEASE_NAME}malloc_proxy")
+    set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_RELEASE_NAME}_debug")
+    set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_RELEASE_NAME}_debug")
+    set(_TBB_LIB_MALLOCPROXY_DEBUG_NAME "${_TBB_LIB_MALLOCPROXY_RELEASE_NAME}_debug")
+    if (MSVC71)
+        set (_TBB_COMPILER "vc7.1")
+    endif(MSVC71)
+    if (MSVC80)
+        set(_TBB_COMPILER "vc8")
+    endif(MSVC80)
+    if (MSVC90)
+        set(_TBB_COMPILER "vc9")
+    endif(MSVC90)
+    if(MSVC10)
+        set(_TBB_COMPILER "vc10")
+    endif(MSVC10)
+    if(MSVC11)
+        set(_TBB_COMPILER "vc11")
+    endif(MSVC11)
+    if(MSVC12)
+	set(_TBB_COMPILER "vc12")
+    endif(MSVC12)
+    #note there was no MSVC13
+    if(MSVC14)
+	set(_TBB_COMPILER "vc14")
+    endif(MSVC14)
+    # Todo: add other Windows compilers such as ICL.
+    set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
+endif (WIN32)
+
+if (UNIX)
+    if (APPLE)
+        # MAC
+        set(_TBB_DEFAULT_INSTALL_DIR "/Library/Frameworks/Intel_TBB.framework/Versions")
+        # libs: libtbb.dylib, libtbbmalloc.dylib, *_debug
+        set(_TBB_LIB_RELEASE_NAME "tbb")
+        set(_TBB_LIB_MALLOC_RELEASE_NAME "${_TBB_LIB_RELEASE_NAME}malloc")
+        #set(_TBB_LIB_MALLOCPROXY_RELEASE_NAME "${_TBB_LIB_RELEASE_NAME}malloc_proxy")
+        set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_RELEASE_NAME}_debug")
+        set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_RELEASE_NAME}_debug")
+        #set(_TBB_LIB_MALLOCPROXY_DEBUG_NAME "${_TBB_LIB_MALLOCPROXY_RELEASE_NAME}_debug")
+        # default flavor on apple: ia32/cc4.0.1_os10.4.9
+        # Jiri: There is no reason to presume there is only one flavor and
+        #       that user's setting of variables should be ignored.
+        if(NOT TBB_COMPILER)
+            set(_TBB_COMPILER "cc4.0.1_os10.4.9")
+        elseif (NOT TBB_COMPILER)
+            set(_TBB_COMPILER ${TBB_COMPILER})
+        endif(NOT TBB_COMPILER)
+        if(NOT TBB_ARCHITECTURE)
+            set(_TBB_ARCHITECTURE "ia32")
+        elseif(NOT TBB_ARCHITECTURE)
+            set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
+        endif(NOT TBB_ARCHITECTURE)
+    else (APPLE)
+        # LINUX
+        set(_TBB_DEFAULT_INSTALL_DIR "/opt/intel/tbb" "/usr/local/include" "/usr/include")
+        set(_TBB_LIB_RELEASE_NAME "tbb")
+        set(_TBB_LIB_MALLOC_RELEASE_NAME "${_TBB_LIB_RELEASE_NAME}malloc")
+        set(_TBB_LIB_MALLOCPROXY_RELEASE_NAME "${_TBB_LIB_RELEASE_NAME}malloc_proxy")
+        set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_RELEASE_NAME}_debug")
+        set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_RELEASE_NAME}_debug")
+        set(_TBB_LIB_MALLOCPROXY_DEBUG_NAME "${_TBB_LIB_MALLOCPROXY_RELEASE_NAME}_debug")
+        # has em64t/cc3.2.3_libc2.3.2_kernel2.4.21 em64t/cc3.3.3_libc2.3.3_kernel2.6.5 em64t/cc3.4.3_libc2.3.4_kernel2.6.9 em64t/cc4.1.0_libc2.4_kernel2.6.16.21
+        # has ia32/*
+        # has itanium/*
+        set(_TBB_COMPILER ${TBB_COMPILER})
+        set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
+    endif (APPLE)
+endif (UNIX)
+
+if (CMAKE_SYSTEM MATCHES "SunOS.*")
+# SUN
+# not yet supported
+# has em64t/cc3.4.3_kernel5.10
+# has ia32/*
+endif (CMAKE_SYSTEM MATCHES "SunOS.*")
+
+
+#-- Clear the public variables
+set (TBB_FOUND "NO")
+
+
+#-- Find TBB install dir and set ${_TBB_INSTALL_DIR} and cached ${TBB_INSTALL_DIR}
+# first: use CMake variable TBB_INSTALL_DIR
+if (TBB_INSTALL_DIR)
+    set (_TBB_INSTALL_DIR ${TBB_INSTALL_DIR})
+endif (TBB_INSTALL_DIR)
+# second: use environment variable
+if (NOT _TBB_INSTALL_DIR)
+    if (NOT "$ENV{TBBROOT}" STREQUAL "")
+        set (_TBB_INSTALL_DIR $ENV{TBBROOT})
+    endif (NOT "$ENV{TBBROOT}" STREQUAL "")
+    if (NOT "$ENV{TBB_INSTALL_DIR}" STREQUAL "")
+        set (_TBB_INSTALL_DIR $ENV{TBB_INSTALL_DIR})
+    endif (NOT "$ENV{TBB_INSTALL_DIR}" STREQUAL "")
+    # Intel recommends setting TBB21_INSTALL_DIR
+    if (NOT "$ENV{TBB21_INSTALL_DIR}" STREQUAL "")
+        set (_TBB_INSTALL_DIR $ENV{TBB21_INSTALL_DIR})
+    endif (NOT "$ENV{TBB21_INSTALL_DIR}" STREQUAL "")
+    if (NOT "$ENV{TBB22_INSTALL_DIR}" STREQUAL "")
+        set (_TBB_INSTALL_DIR $ENV{TBB22_INSTALL_DIR})
+    endif (NOT "$ENV{TBB22_INSTALL_DIR}" STREQUAL "")
+    if (NOT "$ENV{TBB30_INSTALL_DIR}" STREQUAL "")
+        set (_TBB_INSTALL_DIR $ENV{TBB30_INSTALL_DIR})
+    endif (NOT "$ENV{TBB30_INSTALL_DIR}" STREQUAL "")
+endif (NOT _TBB_INSTALL_DIR)
+# third: try to find path automatically
+if (NOT _TBB_INSTALL_DIR)
+    if (_TBB_DEFAULT_INSTALL_DIR)
+        set (_TBB_INSTALL_DIR ${_TBB_DEFAULT_INSTALL_DIR})
+    endif (_TBB_DEFAULT_INSTALL_DIR)
+endif (NOT _TBB_INSTALL_DIR)
+# sanity check
+if (NOT _TBB_INSTALL_DIR)
+    message ("ERROR: Unable to find Intel TBB install directory. ${_TBB_INSTALL_DIR}")
+else (NOT _TBB_INSTALL_DIR)
+# finally: set the cached CMake variable TBB_INSTALL_DIR
+if (NOT TBB_INSTALL_DIR)
+    set (TBB_INSTALL_DIR ${_TBB_INSTALL_DIR} CACHE PATH "Intel TBB install directory")
+    mark_as_advanced(TBB_INSTALL_DIR)
+endif (NOT TBB_INSTALL_DIR)
+
+
+#-- A macro to rewrite the paths of the library. This is necessary, because
+#   find_library() always found the em64t/vc9 version of the TBB libs
+macro(TBB_CORRECT_LIB_DIR var_name)
+#    if (NOT "${_TBB_ARCHITECTURE}" STREQUAL "em64t")
+        string(REPLACE em64t "${_TBB_ARCHITECTURE}" ${var_name} ${${var_name}})
+#    endif (NOT "${_TBB_ARCHITECTURE}" STREQUAL "em64t")
+    string(REPLACE ia32 "${_TBB_ARCHITECTURE}" ${var_name} ${${var_name}})
+    string(REGEX REPLACE "vc[0-9]+(\.[0-9]+)?" "${_TBB_COMPILER}" ${var_name} ${${var_name}})
+endmacro(TBB_CORRECT_LIB_DIR var_content)
+
+
+#-- Look for include directory and set ${TBB_INCLUDE_DIR}
+set (TBB_INC_SEARCH_DIR ${_TBB_INSTALL_DIR}/include)
+# Jiri: tbbvars now sets the CPATH environment variable to the directory
+#       containing the headers.
+#  LR: search first with NO_DEFAULT_PATH...
+find_path(TBB_INCLUDE_DIR
+    tbb/task_scheduler_init.h
+    PATHS ${TBB_INC_SEARCH_DIR} ENV CPATH
+    NO_DEFAULT_PATH
+)
+if(NOT TBB_INCLUDE_DIR)
+#  LR: ... and then search again with NO_DEFAULT_PATH if nothing was found in
+#  hinted paths
+  find_path(TBB_INCLUDE_DIR
+      tbb/task_scheduler_init.h
+      PATHS ${TBB_INC_SEARCH_DIR} ENV CPATH
+  )
+endif()
+mark_as_advanced(TBB_INCLUDE_DIR)
+
+
+#-- Look for libraries
+# GvdB: $ENV{TBB_ARCH_PLATFORM} is set by the build script tbbvars[.bat|.sh|.csh]
+if (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "")
+    set (_TBB_LIBRARY_DIR
+         ${_TBB_INSTALL_DIR}/lib/$ENV{TBB_ARCH_PLATFORM}
+         ${_TBB_INSTALL_DIR}/$ENV{TBB_ARCH_PLATFORM}/lib
+        )
+endif (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "")
+# Jiri: This block isn't mutually exclusive with the previous one
+#       (hence no else), instead I test if the user really specified
+#       the variables in question.
+if ((NOT ${TBB_ARCHITECTURE} STREQUAL "") AND (NOT ${TBB_COMPILER} STREQUAL ""))
+    # HH: deprecated
+    message(STATUS "[Warning] FindTBB.cmake: The use of TBB_ARCHITECTURE and TBB_COMPILER is deprecated and may not be supported in future versions. Please set \$ENV{TBB_ARCH_PLATFORM} (using tbbvars.[bat|csh|sh]).")
+    # Jiri: It doesn't hurt to look in more places, so I store the hints from
+    #       ENV{TBB_ARCH_PLATFORM} and the TBB_ARCHITECTURE and TBB_COMPILER
+    #       variables and search them both.
+    set (_TBB_LIBRARY_DIR "${_TBB_INSTALL_DIR}/${_TBB_ARCHITECTURE}/${_TBB_COMPILER}/lib" ${_TBB_LIBRARY_DIR})
+endif ((NOT ${TBB_ARCHITECTURE} STREQUAL "") AND (NOT ${TBB_COMPILER} STREQUAL ""))
+
+# GvdB: Mac OS X distribution places libraries directly in lib directory.
+list(APPEND _TBB_LIBRARY_DIR ${_TBB_INSTALL_DIR}/lib)
+
+# Jiri: No reason not to check the default paths. From recent versions,
+#       tbbvars has started exporting the LIBRARY_PATH and LD_LIBRARY_PATH
+#       variables, which now point to the directories of the lib files.
+#       It all makes more sense to use the ${_TBB_LIBRARY_DIR} as a HINTS
+#       argument instead of the implicit PATHS as it isn't hard-coded
+#       but computed by system introspection. Searching the LIBRARY_PATH
+#       and LD_LIBRARY_PATH environment variables is now even more important
+#       that tbbvars doesn't export TBB_ARCH_PLATFORM and it facilitates
+#       the use of TBB built from sources.
+#  LR: search first with NO_DEFAULT_PATH...
+find_library(TBB_RELEASE_LIBRARY ${_TBB_LIB_RELEASE_NAME} HINTS ${_TBB_LIBRARY_DIR}
+        PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH NO_DEFAULT_PATH)
+find_library(TBB_MALLOC_RELEASE_LIBRARY ${_TBB_LIB_MALLOC_RELEASE_NAME} HINTS ${_TBB_LIBRARY_DIR}
+        PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH NO_DEFAULT_PATH)
+find_library(TBB_MALLOCPROXY_RELEASE_LIBRARY ${_TBB_LIB_MALLOCPROXY_RELEASE_NAME} HINTS ${_TBB_LIBRARY_DIR}
+        PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH NO_DEFAULT_PATH)
+if(NOT TBB_RELEASE_LIBRARY OR NOT TBB_MALLOC_RELEASE_LIBRARY OR NOT TBB_MALLOCPROXY_RELEASE_LIBRARY)
+# LR: ... and then search again with NO_DEFAULT_PATH if nothing was found
+#  in hinted paths
+    find_library(TBB_RELEASE_LIBRARY ${_TBB_LIB_RELEASE_NAME} HINTS ${_TBB_LIBRARY_DIR}
+            PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
+    find_library(TBB_MALLOC_RELEASE_LIBRARY ${_TBB_LIB_MALLOC_RELEASE_NAME} HINTS ${_TBB_LIBRARY_DIR}
+            PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
+    find_library(TBB_MALLOCPROXY_RELEASE_LIBRARY ${_TBB_LIB_MALLOCPROXY_RELEASE_NAME} HINTS ${_TBB_LIBRARY_DIR}
+            PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
+endif()
+
+#Extract path from TBB_RELEASE_LIBRARY name
+get_filename_component(TBB_RELEASE_LIBRARY_DIR ${TBB_RELEASE_LIBRARY} PATH)
+
+#TBB_CORRECT_LIB_DIR(TBB_RELEASE_LIBRARY)
+#TBB_CORRECT_LIB_DIR(TBB_MALLOC_RELEASE_LIBRARY)
+#TBB_CORRECT_LIB_DIR(TBB_MALLOCPROXY_RELEASE_LIBRARY)
+mark_as_advanced(TBB_RELEASE_LIBRARY TBB_MALLOC_RELEASE_LIBRARY TBB_MALLOCPROXY_RELEASE_LIBRARY)
+
+#-- Look for debug libraries
+# Jiri: Changed the same way as for the release libraries.
+find_library(TBB_DEBUG_LIBRARY ${_TBB_LIB_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}
+        PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH NO_DEFAULT_PATH)
+find_library(TBB_MALLOC_DEBUG_LIBRARY ${_TBB_LIB_MALLOC_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}
+        PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH NO_DEFAULT_PATH)
+find_library(TBB_MALLOCPROXY_DEBUG_LIBRARY ${_TBB_LIB_MALLOCPROXY_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}
+        PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH NO_DEFAULT_PATH)
+if(NOT TBB_DEBUG_LIBRARY OR NOT TBB_MALLOC_DEBUG_LIBRARY OR NOT TBB_MALLOCPROXY_DEBUG_LIBRARY)
+    find_library(TBB_DEBUG_LIBRARY ${_TBB_LIB_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}
+            PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
+    find_library(TBB_MALLOC_DEBUG_LIBRARY ${_TBB_LIB_MALLOC_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}
+            PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
+    find_library(TBB_MALLOCPROXY_DEBUG_LIBRARY ${_TBB_LIB_MALLOCPROXY_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}
+            PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
+endif()
+
+# Jiri: Self-built TBB stores the debug libraries in a separate directory.
+#       Extract path from TBB_DEBUG_LIBRARY name
+get_filename_component(TBB_DEBUG_LIBRARY_DIR ${TBB_DEBUG_LIBRARY} PATH)
+
+#TBB_CORRECT_LIB_DIR(TBB_DEBUG_LIBRARY)
+#TBB_CORRECT_LIB_DIR(TBB_MALLOC_DEBUG_LIBRARY)
+#TBB_CORRECT_LIB_DIR(TBB_MALLOCPROXY_DEBUG_LIBRARY)
+mark_as_advanced(TBB_DEBUG_LIBRARY TBB_MALLOC_DEBUG_LIBRARY TBB_MALLOCPROXY_DEBUG_LIBRARY)
+
+if (TBB_INCLUDE_DIR)
+    if (TBB_RELEASE_LIBRARY)
+        set (TBB_FOUND "YES")
+
+        # NOTE: Removed because we don't want to link with the malloc_proxy by default
+        #if (NOT "${TBB_MALLOCPROXY_RELEASE_LIBRARY}" STREQUAL "TBB_MALLOCPROXY_RELEASE_LIBRARY-NOTFOUND")
+        #    mark_as_advanced(TBB_MALLOCPROXY_RELEASE_LIBRARY)
+        #    set (_TBB_MALLOCPROXY optimized ${TBB_MALLOCPROXY_RELEASE_LIBRARY})
+        #endif (NOT "${TBB_MALLOCPROXY_RELEASE_LIBRARY}" STREQUAL "TBB_MALLOCPROXY_RELEASE_LIBRARY-NOTFOUND")
+        #if (NOT "${TBB_MALLOCPROXY_DEBUG_LIBRARY}" STREQUAL "TBB_MALLOCPROXY_DEBUG_LIBRARY-NOTFOUND")
+        #    mark_as_advanced(TBB_MALLOCPROXY_DEBUG_LIBRARY)
+        #    set (_TBB_MALLOCPROXY ${_TBB_MALLOCPROXY} debug ${TBB_MALLOCPROXY_DEBUG_LIBRARY})
+        #endif (NOT "${TBB_MALLOCPROXY_DEBUG_LIBRARY}" STREQUAL "TBB_MALLOCPROXY_DEBUG_LIBRARY-NOTFOUND")
+
+        # TBB release library
+        set (ALL_TBB_LIBRARIES optimized ${TBB_RELEASE_LIBRARY})
+
+        # TBB debug library found?
+        if (TBB_DEBUG_LIBRARY)
+            list(APPEND ALL_TBB_LIBRARIES debug ${TBB_DEBUG_LIBRARY})
+        else (TBB_DEBUG_LIBRARY)
+            # Otherwise, link with the release library even in debug mode
+            list(APPEND ALL_TBB_LIBRARIES debug ${TBB_RELEASE_LIBRARY})
+        endif (TBB_DEBUG_LIBRARY)
+
+        # TBB malloc - release
+        if (TBB_MALLOC_RELEASE_LIBRARY)
+            list(APPEND ALL_TBB_LIBRARIES optimized ${TBB_MALLOC_RELEASE_LIBRARY})
+
+            # TBB malloc - debug
+            if (TBB_MALLOC_DEBUG_LIBRARY)
+                list(APPEND ALL_TBB_LIBRARIES debug ${TBB_MALLOC_DEBUG_LIBRARY})
+            else (TBB_MALLOC_DEBUG_LIBRARY)
+                list(APPEND ALL_TBB_LIBRARIES debug ${TBB_MALLOC_RELEASE_LIBRARY})
+            endif (TBB_MALLOC_DEBUG_LIBRARY)
+        endif (TBB_MALLOC_RELEASE_LIBRARY)
+
+        if(UNIX AND NOT APPLE)
+            # On Fedora, code using TBB might need -pthread
+
+            # First check without pthread
+            try_TBB_with_pthread(TBB_without_pthread)
+
+            if(NOT TBB_without_pthread)
+                # Then check with -pthread
+                try_TBB_with_pthread(TBB_with_pthread -pthread)
+                if(TBB_with_pthread)
+                    list(APPEND ALL_TBB_LIBRARIES general -pthread)
+                endif(TBB_with_pthread)
+                endif(NOT TBB_without_pthread)
+        endif(UNIX AND NOT APPLE)
+
+        set (TBB_LIBRARIES ${ALL_TBB_LIBRARIES}
+             CACHE PATH "TBB libraries" FORCE)
+
+        # Include dirs
+        set (TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR} CACHE PATH "TBB include directory" FORCE)
+
+        # Library dirs
+        if( "${TBB_DEBUG_LIBRARY_DIR}" STREQUAL "" OR "${TBB_RELEASE_LIBRARY_DIR}" STREQUAL "${TBB_DEBUG_LIBRARY_DIR}" )
+            set (TBB_LIBRARY_DIRS
+                ${TBB_RELEASE_LIBRARY_DIR}
+                CACHE PATH "TBB library directories" FORCE)
+        else( "${TBB_DEBUG_LIBRARY_DIR}" STREQUAL "" OR "${TBB_RELEASE_LIBRARY_DIR}" STREQUAL "${TBB_DEBUG_LIBRARY_DIR}" )
+            set (TBB_LIBRARY_DIRS
+                ${TBB_RELEASE_LIBRARY_DIR} ${TBB_DEBUG_LIBRARY_DIR}
+                CACHE PATH "TBB library directories" FORCE)
+        endif( "${TBB_DEBUG_LIBRARY_DIR}" STREQUAL "" OR "${TBB_RELEASE_LIBRARY_DIR}" STREQUAL "${TBB_DEBUG_LIBRARY_DIR}" )
+
+        message(STATUS "Found Intel TBB")
+    endif (TBB_RELEASE_LIBRARY)
+endif (TBB_INCLUDE_DIR)
+
+if (NOT TBB_FOUND)
+    if(NOT TBB_FIND_QUIETLY)
+        message("ERROR: Intel TBB NOT found! Please define the TBBROOT (or TBB_INSTALL_DIR) and/or TBB_ARCH_PLATFORM environment variables.")
+        message(STATUS "Looked for Threading Building Blocks in ${_TBB_INSTALL_DIR}")
+    endif(NOT TBB_FIND_QUIETLY)
+    SET(TBB_INSTALL_DIR "TBB_INSTALL_DIR_NOT_FOUND" CACHE STRING "Intel TBB install directory")
+    # do only throw fatal, if this pkg is REQUIRED
+    if (TBB_FIND_REQUIRED)
+        message(FATAL_ERROR "Could NOT find TBB library.")
+    endif (TBB_FIND_REQUIRED)
+endif (NOT TBB_FOUND)
+
+endif (NOT _TBB_INSTALL_DIR)
+
+if (TBB_FOUND)
+    set(TBB_INTERFACE_VERSION 0)
+    FILE(READ "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h" _TBB_VERSION_CONTENTS)
+    STRING(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1" TBB_INTERFACE_VERSION "${_TBB_VERSION_CONTENTS}")
+    set(TBB_INTERFACE_VERSION "${TBB_INTERFACE_VERSION}")
+endif (TBB_FOUND)
+
+set(TBB_USE_FILE "UseTBB")
+
+### ** Emacs settings **
+### Local Variables:
+### cmake-tab-width: 4
+### End:
diff --git a/3rdparty/CGAL/cmake/modules/UseCGAL.cmake b/3rdparty/CGAL/cmake/modules/UseCGAL.cmake
new file mode 100644
index 0000000..814d4bf
--- /dev/null
+++ b/3rdparty/CGAL/cmake/modules/UseCGAL.cmake
@@ -0,0 +1,65 @@
+#
+# UseCGAL.cmake can be included in a project to set the needed compiler and linker
+# settings to use CGAL in a program.
+#
+# The variables used here are defined in the CGALConfig.cmake generated when CGAL was installed.
+#
+#
+include(${CGAL_MODULES_DIR}/CGAL_Macros.cmake)
+
+cgal_setup_module_path()
+
+if(NOT USE_CGAL_FILE_INCLUDED)
+  set(USE_CGAL_FILE_INCLUDED 1)
+
+  include(CGAL_Common)
+  include(CGAL_SetupFlags)
+  include(CGAL_GeneratorSpecificSettings)
+  include(CGAL_TweakFindBoost)
+
+  set(CGAL_INSTALLED_SCM_BRANCH_NAME ${CGAL_SCM_BRANCH_NAME})
+  set(CGAL_SCM_BRANCH_NAME "")
+
+  if( NOT "${CGAL_INSTALLED_SCM_BRANCH_NAME}" STREQUAL "" )
+    include(CGAL_SCM)
+    if ( NOT "${CGAL_SCM_BRANCH_NAME}" STREQUAL "" )
+      message ( STATUS "Code taken from Git branch: ${CGAL_SCM_BRANCH_NAME}" )
+      if ( NOT "${CGAL_SCM_BRANCH_NAME}" STREQUAL "${CGAL_INSTALLED_SCM_BRANCH_NAME}")
+        message (AUTHOR_WARNING "Branch '${CGAL_SCM_BRANCH_NAME}' does not match branch '${CGAL_INSTALLED_SCM_BRANCH_NAME}' from which CGAL has been installed. Please consider rebuilding CGAL from this branch.")
+      endif()
+    endif()
+  endif()
+
+  set( CGAL_LIBRARIES )
+
+  foreach ( component ${CGAL_REQUESTED_COMPONENTS} )
+    use_component( ${component} )
+  endforeach()
+
+  use_essential_libs()
+
+  include_directories( "${CMAKE_CURRENT_BINARY_DIR}" )
+
+  if(TARGET CGAL)
+    add_to_list( CGAL_LIBRARIES CGAL )
+  else()
+    add_to_list( CGAL_LIBRARIES ${CGAL_LIBRARY} )
+  endif()
+
+  #message (STATUS "LIB: ${CGAL_LIBRARY}")
+  #message (STATUS "LIBS: ${CGAL_LIBRARIES}")
+
+  include_directories ( ${CGAL_INCLUDE_DIRS})
+  include_directories ( SYSTEM ${CGAL_3RD_PARTY_INCLUDE_DIRS} )
+  add_definitions     ( ${CGAL_3RD_PARTY_DEFINITIONS}  ${CGAL_DEFINITIONS}  )
+
+  if (CGAL_HEADER_ONLY)
+    add_definitions(-DCGAL_HEADER_ONLY)
+    link_directories    ( ${CGAL_3RD_PARTY_LIBRARIES_DIRS} )
+    link_libraries      ( ${CGAL_3RD_PARTY_LIBRARIES}      )
+  else()
+    link_directories    ( ${CGAL_LIBRARIES_DIR} ${CGAL_3RD_PARTY_LIBRARIES_DIRS} )
+    link_libraries      ( ${CGAL_LIBRARIES}     ${CGAL_3RD_PARTY_LIBRARIES}      )
+  endif()
+
+endif()
diff --git a/3rdparty/CGAL-4.8/cmake/modules/UseESBTL.cmake b/3rdparty/CGAL/cmake/modules/UseESBTL.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/UseESBTL.cmake
rename to 3rdparty/CGAL/cmake/modules/UseESBTL.cmake
diff --git a/3rdparty/CGAL-4.8/cmake/modules/UseEigen3.cmake b/3rdparty/CGAL/cmake/modules/UseEigen3.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/UseEigen3.cmake
rename to 3rdparty/CGAL/cmake/modules/UseEigen3.cmake
diff --git a/3rdparty/CGAL-4.8/cmake/modules/UseOpenMesh.cmake b/3rdparty/CGAL/cmake/modules/UseOpenMesh.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/UseOpenMesh.cmake
rename to 3rdparty/CGAL/cmake/modules/UseOpenMesh.cmake
diff --git a/3rdparty/CGAL-4.8/cmake/modules/UseTBB.cmake b/3rdparty/CGAL/cmake/modules/UseTBB.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/UseTBB.cmake
rename to 3rdparty/CGAL/cmake/modules/UseTBB.cmake
diff --git a/3rdparty/CGAL/cmake/modules/Use_CGAL_Qt5_headers.cmake b/3rdparty/CGAL/cmake/modules/Use_CGAL_Qt5_headers.cmake
new file mode 100644
index 0000000..4132d77
--- /dev/null
+++ b/3rdparty/CGAL/cmake/modules/Use_CGAL_Qt5_headers.cmake
@@ -0,0 +1,13 @@
+qt5_wrap_cpp(CGAL_Qt5_MOC_FILES
+  ${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/include/CGAL/Qt/GraphicsViewNavigation.h
+  ${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/include/CGAL/Qt/DemosMainWindow.h
+  ${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/include/CGAL/Qt/GraphicsItem.h
+  ${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/include/CGAL/Qt/GraphicsViewInput.h)
+
+# qrc files (resources files, that contain icons, at least)
+qt5_add_resources (CGAL_Qt5_RESOURCE_FILES
+  ${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/demo/resources/CGAL.qrc
+  ${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/demo/icons/Input.qrc
+  ${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/demo/icons/File.qrc
+  ${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/demo/icons/Triangulation_2.qrc)
+
diff --git a/3rdparty/CGAL-4.8/cmake/modules/test_MPFI.cpp b/3rdparty/CGAL/cmake/modules/test_MPFI.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/cmake/modules/test_MPFI.cpp
rename to 3rdparty/CGAL/cmake/modules/test_MPFI.cpp
diff --git a/3rdparty/CGAL-4.8/config/support/print_BOOST_version.cpp b/3rdparty/CGAL/config/support/print_BOOST_version.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/support/print_BOOST_version.cpp
rename to 3rdparty/CGAL/config/support/print_BOOST_version.cpp
diff --git a/3rdparty/CGAL-4.8/config/support/print_GCC_version.cpp b/3rdparty/CGAL/config/support/print_GCC_version.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/support/print_GCC_version.cpp
rename to 3rdparty/CGAL/config/support/print_GCC_version.cpp
diff --git a/3rdparty/CGAL-4.8/config/support/print_GMP_version.cpp b/3rdparty/CGAL/config/support/print_GMP_version.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/support/print_GMP_version.cpp
rename to 3rdparty/CGAL/config/support/print_GMP_version.cpp
diff --git a/3rdparty/CGAL-4.8/config/support/print_IntelCompiler_version.cpp b/3rdparty/CGAL/config/support/print_IntelCompiler_version.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/support/print_IntelCompiler_version.cpp
rename to 3rdparty/CGAL/config/support/print_IntelCompiler_version.cpp
diff --git a/3rdparty/CGAL-4.8/config/support/print_LEDA_version.cpp b/3rdparty/CGAL/config/support/print_LEDA_version.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/support/print_LEDA_version.cpp
rename to 3rdparty/CGAL/config/support/print_LEDA_version.cpp
diff --git a/3rdparty/CGAL-4.8/config/support/print_MPFI_version.cpp b/3rdparty/CGAL/config/support/print_MPFI_version.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/support/print_MPFI_version.cpp
rename to 3rdparty/CGAL/config/support/print_MPFI_version.cpp
diff --git a/3rdparty/CGAL-4.8/config/support/print_MPFR_version.cpp b/3rdparty/CGAL/config/support/print_MPFR_version.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/support/print_MPFR_version.cpp
rename to 3rdparty/CGAL/config/support/print_MPFR_version.cpp
diff --git a/3rdparty/CGAL-4.8/config/support/print_OPENGL_version.cpp b/3rdparty/CGAL/config/support/print_OPENGL_version.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/support/print_OPENGL_version.cpp
rename to 3rdparty/CGAL/config/support/print_OPENGL_version.cpp
diff --git a/3rdparty/CGAL-4.8/config/support/print_QT4_version.cpp b/3rdparty/CGAL/config/support/print_QT4_version.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/support/print_QT4_version.cpp
rename to 3rdparty/CGAL/config/support/print_QT4_version.cpp
diff --git a/3rdparty/CGAL-4.8/config/support/print_QT_version.cpp b/3rdparty/CGAL/config/support/print_QT_version.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/support/print_QT_version.cpp
rename to 3rdparty/CGAL/config/support/print_QT_version.cpp
diff --git a/3rdparty/CGAL-4.8/config/support/print_ZLIB_version.cpp b/3rdparty/CGAL/config/support/print_ZLIB_version.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/support/print_ZLIB_version.cpp
rename to 3rdparty/CGAL/config/support/print_ZLIB_version.cpp
diff --git a/3rdparty/CGAL-4.8/config/support/test_ATLAS.cpp b/3rdparty/CGAL/config/support/test_ATLAS.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/support/test_ATLAS.cpp
rename to 3rdparty/CGAL/config/support/test_ATLAS.cpp
diff --git a/3rdparty/CGAL-4.8/config/support/test_BLAS.cpp b/3rdparty/CGAL/config/support/test_BLAS.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/support/test_BLAS.cpp
rename to 3rdparty/CGAL/config/support/test_BLAS.cpp
diff --git a/3rdparty/CGAL-4.8/config/support/test_BOOST.cpp b/3rdparty/CGAL/config/support/test_BOOST.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/support/test_BOOST.cpp
rename to 3rdparty/CGAL/config/support/test_BOOST.cpp
diff --git a/3rdparty/CGAL-4.8/config/support/test_BOOST_PROGRAM_OPTIONS.cpp b/3rdparty/CGAL/config/support/test_BOOST_PROGRAM_OPTIONS.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/support/test_BOOST_PROGRAM_OPTIONS.cpp
rename to 3rdparty/CGAL/config/support/test_BOOST_PROGRAM_OPTIONS.cpp
diff --git a/3rdparty/CGAL-4.8/config/support/test_BOOST_THREAD.cpp b/3rdparty/CGAL/config/support/test_BOOST_THREAD.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/support/test_BOOST_THREAD.cpp
rename to 3rdparty/CGAL/config/support/test_BOOST_THREAD.cpp
diff --git a/3rdparty/CGAL-4.8/config/support/test_GMP.cpp b/3rdparty/CGAL/config/support/test_GMP.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/support/test_GMP.cpp
rename to 3rdparty/CGAL/config/support/test_GMP.cpp
diff --git a/3rdparty/CGAL-4.8/config/support/test_GMPXX.cpp b/3rdparty/CGAL/config/support/test_GMPXX.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/support/test_GMPXX.cpp
rename to 3rdparty/CGAL/config/support/test_GMPXX.cpp
diff --git a/3rdparty/CGAL-4.8/config/support/test_LAPACK.cpp b/3rdparty/CGAL/config/support/test_LAPACK.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/support/test_LAPACK.cpp
rename to 3rdparty/CGAL/config/support/test_LAPACK.cpp
diff --git a/3rdparty/CGAL-4.8/config/support/test_LEDA.cpp b/3rdparty/CGAL/config/support/test_LEDA.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/support/test_LEDA.cpp
rename to 3rdparty/CGAL/config/support/test_LEDA.cpp
diff --git a/3rdparty/CGAL-4.8/config/support/test_LEDAWIN.cpp b/3rdparty/CGAL/config/support/test_LEDAWIN.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/support/test_LEDAWIN.cpp
rename to 3rdparty/CGAL/config/support/test_LEDAWIN.cpp
diff --git a/3rdparty/CGAL-4.8/config/support/test_LIDIA.cpp b/3rdparty/CGAL/config/support/test_LIDIA.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/support/test_LIDIA.cpp
rename to 3rdparty/CGAL/config/support/test_LIDIA.cpp
diff --git a/3rdparty/CGAL-4.8/config/support/test_MPFR.cpp b/3rdparty/CGAL/config/support/test_MPFR.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/support/test_MPFR.cpp
rename to 3rdparty/CGAL/config/support/test_MPFR.cpp
diff --git a/3rdparty/CGAL-4.8/config/support/test_OPENGL.cpp b/3rdparty/CGAL/config/support/test_OPENGL.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/support/test_OPENGL.cpp
rename to 3rdparty/CGAL/config/support/test_OPENGL.cpp
diff --git a/3rdparty/CGAL-4.8/config/support/test_QT.cpp b/3rdparty/CGAL/config/support/test_QT.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/support/test_QT.cpp
rename to 3rdparty/CGAL/config/support/test_QT.cpp
diff --git a/3rdparty/CGAL-4.8/config/support/test_X11.cpp b/3rdparty/CGAL/config/support/test_X11.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/support/test_X11.cpp
rename to 3rdparty/CGAL/config/support/test_X11.cpp
diff --git a/3rdparty/CGAL-4.8/config/support/test_ZLIB.cpp b/3rdparty/CGAL/config/support/test_ZLIB.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/support/test_ZLIB.cpp
rename to 3rdparty/CGAL/config/support/test_ZLIB.cpp
diff --git a/3rdparty/CGAL-4.8/config/support/test_syntaxonly.cpp b/3rdparty/CGAL/config/support/test_syntaxonly.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/support/test_syntaxonly.cpp
rename to 3rdparty/CGAL/config/support/test_syntaxonly.cpp
diff --git a/3rdparty/CGAL-4.8/config/testfiles/CGAL_CFG_DENORMALS_COMPILE_BUG.cpp b/3rdparty/CGAL/config/testfiles/CGAL_CFG_DENORMALS_COMPILE_BUG.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/testfiles/CGAL_CFG_DENORMALS_COMPILE_BUG.cpp
rename to 3rdparty/CGAL/config/testfiles/CGAL_CFG_DENORMALS_COMPILE_BUG.cpp
diff --git a/3rdparty/CGAL-4.8/config/testfiles/CGAL_CFG_FPU_ROUNDING_MODE_UNWINDING_VC_BUG.cpp b/3rdparty/CGAL/config/testfiles/CGAL_CFG_FPU_ROUNDING_MODE_UNWINDING_VC_BUG.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/testfiles/CGAL_CFG_FPU_ROUNDING_MODE_UNWINDING_VC_BUG.cpp
rename to 3rdparty/CGAL/config/testfiles/CGAL_CFG_FPU_ROUNDING_MODE_UNWINDING_VC_BUG.cpp
diff --git a/3rdparty/CGAL-4.8/config/testfiles/CGAL_CFG_IEEE_754_BUG.cpp b/3rdparty/CGAL/config/testfiles/CGAL_CFG_IEEE_754_BUG.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/testfiles/CGAL_CFG_IEEE_754_BUG.cpp
rename to 3rdparty/CGAL/config/testfiles/CGAL_CFG_IEEE_754_BUG.cpp
diff --git a/3rdparty/CGAL-4.8/config/testfiles/CGAL_CFG_ISTREAM_INT_BUG.cpp b/3rdparty/CGAL/config/testfiles/CGAL_CFG_ISTREAM_INT_BUG.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/testfiles/CGAL_CFG_ISTREAM_INT_BUG.cpp
rename to 3rdparty/CGAL/config/testfiles/CGAL_CFG_ISTREAM_INT_BUG.cpp
diff --git a/3rdparty/CGAL-4.8/config/testfiles/CGAL_CFG_MATCHING_BUG_5.cpp b/3rdparty/CGAL/config/testfiles/CGAL_CFG_MATCHING_BUG_5.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/testfiles/CGAL_CFG_MATCHING_BUG_5.cpp
rename to 3rdparty/CGAL/config/testfiles/CGAL_CFG_MATCHING_BUG_5.cpp
diff --git a/3rdparty/CGAL-4.8/config/testfiles/CGAL_CFG_MATCHING_BUG_6.cpp b/3rdparty/CGAL/config/testfiles/CGAL_CFG_MATCHING_BUG_6.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/testfiles/CGAL_CFG_MATCHING_BUG_6.cpp
rename to 3rdparty/CGAL/config/testfiles/CGAL_CFG_MATCHING_BUG_6.cpp
diff --git a/3rdparty/CGAL-4.8/config/testfiles/CGAL_CFG_MATCHING_BUG_7.cpp b/3rdparty/CGAL/config/testfiles/CGAL_CFG_MATCHING_BUG_7.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/testfiles/CGAL_CFG_MATCHING_BUG_7.cpp
rename to 3rdparty/CGAL/config/testfiles/CGAL_CFG_MATCHING_BUG_7.cpp
diff --git a/3rdparty/CGAL-4.8/config/testfiles/CGAL_CFG_MATCHING_BUG_8.cpp b/3rdparty/CGAL/config/testfiles/CGAL_CFG_MATCHING_BUG_8.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/testfiles/CGAL_CFG_MATCHING_BUG_8.cpp
rename to 3rdparty/CGAL/config/testfiles/CGAL_CFG_MATCHING_BUG_8.cpp
diff --git a/3rdparty/CGAL-4.8/config/testfiles/CGAL_CFG_NESTED_CLASS_FRIEND_DECLARATION_BUG.cpp b/3rdparty/CGAL/config/testfiles/CGAL_CFG_NESTED_CLASS_FRIEND_DECLARATION_BUG.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/testfiles/CGAL_CFG_NESTED_CLASS_FRIEND_DECLARATION_BUG.cpp
rename to 3rdparty/CGAL/config/testfiles/CGAL_CFG_NESTED_CLASS_FRIEND_DECLARATION_BUG.cpp
diff --git a/3rdparty/CGAL-4.8/config/testfiles/CGAL_CFG_NO_LIMITS.cpp b/3rdparty/CGAL/config/testfiles/CGAL_CFG_NO_LIMITS.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/testfiles/CGAL_CFG_NO_LIMITS.cpp
rename to 3rdparty/CGAL/config/testfiles/CGAL_CFG_NO_LIMITS.cpp
diff --git a/3rdparty/CGAL-4.8/config/testfiles/CGAL_CFG_NO_NEXTAFTER.cpp b/3rdparty/CGAL/config/testfiles/CGAL_CFG_NO_NEXTAFTER.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/testfiles/CGAL_CFG_NO_NEXTAFTER.cpp
rename to 3rdparty/CGAL/config/testfiles/CGAL_CFG_NO_NEXTAFTER.cpp
diff --git a/3rdparty/CGAL-4.8/config/testfiles/CGAL_CFG_NO_STL.cpp b/3rdparty/CGAL/config/testfiles/CGAL_CFG_NO_STL.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/testfiles/CGAL_CFG_NO_STL.cpp
rename to 3rdparty/CGAL/config/testfiles/CGAL_CFG_NO_STL.cpp
diff --git a/3rdparty/CGAL-4.8/config/testfiles/CGAL_CFG_NUMERIC_LIMITS_BUG.cpp b/3rdparty/CGAL/config/testfiles/CGAL_CFG_NUMERIC_LIMITS_BUG.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/testfiles/CGAL_CFG_NUMERIC_LIMITS_BUG.cpp
rename to 3rdparty/CGAL/config/testfiles/CGAL_CFG_NUMERIC_LIMITS_BUG.cpp
diff --git a/3rdparty/CGAL-4.8/config/testfiles/CGAL_CFG_OUTOFLINE_MEMBER_DEFINITION_BUG.cpp b/3rdparty/CGAL/config/testfiles/CGAL_CFG_OUTOFLINE_MEMBER_DEFINITION_BUG.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/testfiles/CGAL_CFG_OUTOFLINE_MEMBER_DEFINITION_BUG.cpp
rename to 3rdparty/CGAL/config/testfiles/CGAL_CFG_OUTOFLINE_MEMBER_DEFINITION_BUG.cpp
diff --git a/3rdparty/CGAL-4.8/config/testfiles/CGAL_CFG_TEMPLATE_IN_DEFAULT_PARAMETER_BUG.cpp b/3rdparty/CGAL/config/testfiles/CGAL_CFG_TEMPLATE_IN_DEFAULT_PARAMETER_BUG.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/testfiles/CGAL_CFG_TEMPLATE_IN_DEFAULT_PARAMETER_BUG.cpp
rename to 3rdparty/CGAL/config/testfiles/CGAL_CFG_TEMPLATE_IN_DEFAULT_PARAMETER_BUG.cpp
diff --git a/3rdparty/CGAL-4.8/config/testfiles/CGAL_CFG_TYPENAME_BEFORE_DEFAULT_ARGUMENT_BUG.cpp b/3rdparty/CGAL/config/testfiles/CGAL_CFG_TYPENAME_BEFORE_DEFAULT_ARGUMENT_BUG.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/testfiles/CGAL_CFG_TYPENAME_BEFORE_DEFAULT_ARGUMENT_BUG.cpp
rename to 3rdparty/CGAL/config/testfiles/CGAL_CFG_TYPENAME_BEFORE_DEFAULT_ARGUMENT_BUG.cpp
diff --git a/3rdparty/CGAL-4.8/config/testfiles/CGAL_CFG_USING_BASE_MEMBER_BUG_2.cpp b/3rdparty/CGAL/config/testfiles/CGAL_CFG_USING_BASE_MEMBER_BUG_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/testfiles/CGAL_CFG_USING_BASE_MEMBER_BUG_2.cpp
rename to 3rdparty/CGAL/config/testfiles/CGAL_CFG_USING_BASE_MEMBER_BUG_2.cpp
diff --git a/3rdparty/CGAL-4.8/config/version.h.in b/3rdparty/CGAL/config/version.h.in
similarity index 100%
rename from 3rdparty/CGAL-4.8/config/version.h.in
rename to 3rdparty/CGAL/config/version.h.in
diff --git a/3rdparty/CGAL-4.8/demo/AABB_tree/AABB_demo.cpp b/3rdparty/CGAL/demo/AABB_tree/AABB_demo.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/AABB_tree/AABB_demo.cpp
rename to 3rdparty/CGAL/demo/AABB_tree/AABB_demo.cpp
diff --git a/3rdparty/CGAL-4.8/demo/AABB_tree/AABB_demo.pdf b/3rdparty/CGAL/demo/AABB_tree/AABB_demo.pdf
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/AABB_tree/AABB_demo.pdf
rename to 3rdparty/CGAL/demo/AABB_tree/AABB_demo.pdf
diff --git a/3rdparty/CGAL-4.8/demo/AABB_tree/AABB_demo.qrc b/3rdparty/CGAL/demo/AABB_tree/AABB_demo.qrc
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/AABB_tree/AABB_demo.qrc
rename to 3rdparty/CGAL/demo/AABB_tree/AABB_demo.qrc
diff --git a/3rdparty/CGAL/demo/AABB_tree/CMakeLists.txt b/3rdparty/CGAL/demo/AABB_tree/CMakeLists.txt
new file mode 100644
index 0000000..a2df1b4
--- /dev/null
+++ b/3rdparty/CGAL/demo/AABB_tree/CMakeLists.txt
@@ -0,0 +1,96 @@
+# This is the CMake script for compiling the AABB tree demo.
+
+project( AABB_demo )
+
+# Find includes in corresponding build directories
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+# Instruct CMake to run moc automatically when needed.
+set(CMAKE_AUTOMOC ON)
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+# Include this package's headers first
+include_directories( BEFORE ./ ./include ../../include )
+
+# Find CGAL and CGAL Qt5
+find_package(CGAL COMPONENTS Qt5)
+
+# Find Qt5 itself
+find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Gui Svg)
+
+include( ${CGAL_USE_FILE} )
+
+# Find OpenGL
+find_package(OpenGL)
+
+# Find QGLViewer
+if(Qt5_FOUND)
+  find_package(QGLViewer)
+endif(Qt5_FOUND)
+
+if(CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
+
+  include_directories ( ${QGLVIEWER_INCLUDE_DIR} )
+
+  qt5_wrap_ui( UI_FILES MainWindow.ui )
+
+  include(AddFileDependencies)
+
+  qt5_generate_moc( "MainWindow.h" "${CMAKE_CURRENT_BINARY_DIR}/MainWindow_moc.cpp" )
+  add_file_dependencies( MainWindow_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/MainWindow.h" )
+
+  qt5_generate_moc( "Viewer.h" "${CMAKE_CURRENT_BINARY_DIR}/Viewer_moc.cpp" )
+  add_file_dependencies( Viewer_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/Viewer.h" )
+
+  qt5_generate_moc( "Scene.h" "${CMAKE_CURRENT_BINARY_DIR}/Scene_moc.cpp" )
+  add_file_dependencies( Scene_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/Scene.h" )
+
+  qt5_add_resources ( CGAL_Qt5_RESOURCE_FILES AABB_demo.qrc )
+
+  add_file_dependencies( AABB_demo.cpp "${CMAKE_CURRENT_BINARY_DIR}/MainWindow_moc.cpp"
+                                       "${CMAKE_CURRENT_BINARY_DIR}/Viewer_moc.cpp"
+                                       "${CMAKE_CURRENT_BINARY_DIR}/Scene_moc.cpp" )
+
+  add_executable  ( AABB_demo AABB_demo.cpp ${UI_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES})
+  qt5_use_modules(AABB_demo Gui OpenGL Xml Script Svg )
+  # Link with Qt libraries
+  target_link_libraries( AABB_demo ${QT_LIBRARIES} )
+
+  # Link with CGAL
+  target_link_libraries( AABB_demo ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} )
+
+  # Link with libQGLViewer, OpenGL
+  target_link_libraries( AABB_demo ${QGLVIEWER_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
+
+  add_to_cached_list( CGAL_EXECUTABLE_TARGETS AABB_demo )
+
+
+else (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
+
+  set(AABB_MISSING_DEPS "")
+
+  if(NOT CGAL_FOUND)
+    set(AABB_MISSING_DEPS "the CGAL library, ${AABB_MISSING_DEPS}")
+  endif()
+
+  if(NOT CGAL_Qt5_FOUND)
+    set(AABB_MISSING_DEPS "CGAL_Qt5, ${AABB_MISSING_DEPS}")
+  endif()
+
+  if(NOT Qt5_FOUND)
+    set(AABB_MISSING_DEPS "Qt5, ${AABB_MISSING_DEPS}")
+  endif()
+
+  if(NOT OPENGL_FOUND)
+    set(AABB_MISSING_DEPS "OpenGL, ${AABB_MISSING_DEPS}")
+  endif()
+
+  if(NOT QGLVIEWER_FOUND)
+    set(AABB_MISSING_DEPS "QGLViewer, ${AABB_MISSING_DEPS}")
+  endif()
+
+  message(STATUS "NOTICE: This demo requires ${AABB_MISSING_DEPS}and will not be compiled.")
+
+endif (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
diff --git a/3rdparty/CGAL-4.8/demo/AABB_tree/Color_ramp.h b/3rdparty/CGAL/demo/AABB_tree/Color_ramp.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/AABB_tree/Color_ramp.h
rename to 3rdparty/CGAL/demo/AABB_tree/Color_ramp.h
diff --git a/3rdparty/CGAL-4.8/demo/AABB_tree/MainWindow.cpp b/3rdparty/CGAL/demo/AABB_tree/MainWindow.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/AABB_tree/MainWindow.cpp
rename to 3rdparty/CGAL/demo/AABB_tree/MainWindow.cpp
diff --git a/3rdparty/CGAL-4.8/demo/AABB_tree/MainWindow.h b/3rdparty/CGAL/demo/AABB_tree/MainWindow.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/AABB_tree/MainWindow.h
rename to 3rdparty/CGAL/demo/AABB_tree/MainWindow.h
diff --git a/3rdparty/CGAL-4.8/demo/AABB_tree/MainWindow.ui b/3rdparty/CGAL/demo/AABB_tree/MainWindow.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/AABB_tree/MainWindow.ui
rename to 3rdparty/CGAL/demo/AABB_tree/MainWindow.ui
diff --git a/3rdparty/CGAL-4.8/demo/AABB_tree/Refiner.h b/3rdparty/CGAL/demo/AABB_tree/Refiner.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/AABB_tree/Refiner.h
rename to 3rdparty/CGAL/demo/AABB_tree/Refiner.h
diff --git a/3rdparty/CGAL/demo/AABB_tree/Scene.cpp b/3rdparty/CGAL/demo/AABB_tree/Scene.cpp
new file mode 100644
index 0000000..a87cd91
--- /dev/null
+++ b/3rdparty/CGAL/demo/AABB_tree/Scene.cpp
@@ -0,0 +1,1337 @@
+#include "Scene.h"
+
+#include <iostream>
+#include <fstream>
+
+#include <QtCore/qglobal.h>
+#include <QString>
+#include <QTextStream>
+#include <QFileInfo>
+#include <QInputDialog>
+
+#include "Refiner.h"
+//#include "render_edges.h"
+
+#include <CGAL/Timer.h>
+#include <CGAL/IO/Polyhedron_iostream.h>
+#include <CGAL/Subdivision_method_3.h>
+
+#include <QOpenGLShader>
+#include <QDebug>
+#include "Viewer.h"
+
+
+// constants
+const int slow_distance_grid_size = 100;
+const int fast_distance_grid_size = 20;
+#define _SIGNED 0
+#define _UNSIGNED 1
+
+Scene::Scene()
+    : m_frame (new ManipulatedFrame())
+    , m_view_plane(false)
+    , m_grid_size(slow_distance_grid_size)
+    , m_cut_plane(NONE)
+{
+    m_pPolyhedron = NULL;
+
+    // view options
+    m_view_points = true;
+    m_view_segments = true;
+    m_view_polyhedron = true;
+
+    // distance function
+    m_red_ramp.build_red();
+    m_blue_ramp.build_blue();
+    m_max_distance_function = (FT)0.0;
+    texture = new Texture(m_grid_size,m_grid_size);
+    startTimer(0);
+    ready_to_cut = false;
+    are_buffers_initialized = false;
+    gl_init = false;
+
+}
+
+Scene::~Scene()
+{
+    delete m_pPolyhedron;
+    delete m_frame;
+
+    buffers[0].destroy();
+    buffers[1].destroy();
+    buffers[2].destroy();
+    buffers[3].destroy();
+    buffers[4].destroy();
+    buffers[5].destroy();
+    buffers[6].destroy();
+    buffers[7].destroy();
+    vao[0].destroy();
+    vao[1].destroy();
+    vao[2].destroy();
+    vao[3].destroy();
+    vao[4].destroy();
+    vao[5].destroy();
+    vao[6].destroy();
+
+
+}
+
+void Scene::compile_shaders()
+{
+    if(! buffers[0].create() || !buffers[1].create() || !buffers[2].create() || !buffers[3].create() || !buffers[4].create() || !buffers[5].create() || !buffers[6].create() || !buffers[7].create())
+    {
+        std::cerr<<"VBO Creation FAILED"<<std::endl;
+    }
+
+    if(!vao[0].create() || !vao[1].create() || !vao[2].create() || !vao[3].create() || !vao[4].create() || !vao[5].create() || !vao[6].create())
+    {
+        std::cerr<<"VAO Creation FAILED"<<std::endl;
+    }
+
+
+    //Vertex source code
+    const char vertex_source[] =
+    {
+        "#version 120 \n"
+        "attribute highp vec4 vertex;\n"
+        "uniform highp mat4 mvp_matrix;\n"
+        "uniform highp mat4 f_matrix;\n"
+        "void main(void)\n"
+        "{\n"
+        "   gl_Position = mvp_matrix * f_matrix * vertex;\n"
+        "}"
+    };
+    //Vertex source code
+    const char fragment_source[] =
+    {
+        "#version 120 \n"
+        "uniform highp vec4 color; \n"
+        "void main(void) { \n"
+        "gl_FragColor = color; \n"
+        "} \n"
+        "\n"
+    };
+    QOpenGLShader *vertex_shader = new QOpenGLShader(QOpenGLShader::Vertex);
+    if(!vertex_shader->compileSourceCode(vertex_source))
+    {
+        std::cerr<<"Compiling vertex source FAILED"<<std::endl;
+    }
+
+    QOpenGLShader *fragment_shader= new QOpenGLShader(QOpenGLShader::Fragment);
+    if(!fragment_shader->compileSourceCode(fragment_source))
+    {
+        std::cerr<<"Compiling fragmentsource FAILED"<<std::endl;
+    }
+
+    if(!rendering_program.addShader(vertex_shader))
+    {
+        std::cerr<<"adding vertex shader FAILED"<<std::endl;
+    }
+    if(!rendering_program.addShader(fragment_shader))
+    {
+        std::cerr<<"adding fragment shader FAILED"<<std::endl;
+    }
+    if(!rendering_program.link())
+    {
+        std::cerr<<"linking Program FAILED"<<std::endl;
+    }
+    rendering_program.bind();
+
+    //Vertex source code
+    const char tex_vertex_source[] =
+    {
+        "#version 120 \n"
+        "attribute highp vec4 vertex;\n"
+        "attribute highp vec2 tex_coord; \n"
+        "uniform highp mat4 mvp_matrix;\n"
+        "uniform highp mat4 f_matrix;\n"
+        "varying highp vec2 texc;\n"
+        "void main(void)\n"
+        "{\n"
+        "   gl_Position = mvp_matrix * f_matrix * vertex;\n"
+        "    texc = tex_coord;\n"
+        "}"
+    };
+    //Vertex source code
+    const char tex_fragment_source[] =
+    {
+        "#version 120 \n"
+        "uniform sampler2D texture;\n"
+        "varying highp vec2 texc;\n"
+        "void main(void) { \n"
+        "gl_FragColor = texture2D(texture, texc.st);\n"
+        "} \n"
+        "\n"
+    };
+    QOpenGLShader *tex_vertex_shader = new QOpenGLShader(QOpenGLShader::Vertex);
+    if(!tex_vertex_shader->compileSourceCode(tex_vertex_source))
+    {
+        std::cerr<<"Compiling vertex source FAILED"<<std::endl;
+    }
+
+    QOpenGLShader *tex_fragment_shader= new QOpenGLShader(QOpenGLShader::Fragment);
+    if(!tex_fragment_shader->compileSourceCode(tex_fragment_source))
+    {
+        std::cerr<<"Compiling fragmentsource FAILED"<<std::endl;
+    }
+
+    if(!tex_rendering_program.addShader(tex_vertex_shader))
+    {
+        std::cerr<<"adding vertex shader FAILED"<<std::endl;
+    }
+    if(!tex_rendering_program.addShader(tex_fragment_shader))
+    {
+        std::cerr<<"adding fragment shader FAILED"<<std::endl;
+    }
+    if(!tex_rendering_program.link())
+    {
+        std::cerr<<"linking Program FAILED"<<std::endl;
+    }
+    tex_rendering_program.bind();
+
+}
+
+void Scene::initialize_buffers()
+{
+    //Points
+    vao[0].bind();
+    buffers[0].bind();
+    buffers[0].allocate(pos_points.data(),
+                        static_cast<int>(pos_points.size()*sizeof(float)));
+    points_vertexLocation = rendering_program.attributeLocation("vertex");
+    rendering_program.bind();
+    rendering_program.enableAttributeArray(points_vertexLocation);
+    rendering_program.setAttributeBuffer(points_vertexLocation,GL_FLOAT,0,3);
+    buffers[0].release();
+    rendering_program.release();
+    vao[0].release();
+
+    //Lines
+    vao[1].bind();
+    buffers[1].bind();
+    buffers[1].allocate(pos_lines.data(),
+                        static_cast<int>(pos_lines.size()*sizeof(float)));
+    lines_vertexLocation = rendering_program.attributeLocation("vertex");
+    rendering_program.bind();
+    rendering_program.setAttributeBuffer(lines_vertexLocation,GL_FLOAT,0,3);
+    buffers[1].release();
+    rendering_program.enableAttributeArray(lines_vertexLocation);
+    rendering_program.release();
+    vao[1].release();
+
+    //Polyhedron's edges
+    vao[2].bind();
+    buffers[2].bind();
+    buffers[2].allocate(pos_poly.data(),
+                        static_cast<int>(pos_poly.size()*sizeof(float)));
+    poly_vertexLocation = rendering_program.attributeLocation("vertex");
+    rendering_program.bind();
+    rendering_program.setAttributeBuffer(poly_vertexLocation,GL_FLOAT,0,3);
+    rendering_program.enableAttributeArray(poly_vertexLocation);
+    buffers[2].release();
+    rendering_program.release();
+    vao[2].release();
+
+    //cutting segments
+    vao[3].bind();
+    buffers[3].bind();
+    buffers[3].allocate(pos_cut_segments.data(),
+                        static_cast<int>(pos_cut_segments.size()*sizeof(float)));
+    poly_vertexLocation = rendering_program.attributeLocation("vertex");
+    rendering_program.bind();
+    rendering_program.setAttributeBuffer(poly_vertexLocation,GL_FLOAT,0,3);
+    rendering_program.enableAttributeArray(poly_vertexLocation);
+    buffers[3].release();
+    rendering_program.release();
+    vao[3].release();
+
+    //cutting plane
+    vao[4].bind();
+    buffers[4].bind();
+    buffers[4].allocate(pos_plane.data(), static_cast<int>(pos_plane.size()*sizeof(float)));
+    poly_vertexLocation = rendering_program.attributeLocation("vertex");
+    rendering_program.bind();
+    rendering_program.setAttributeBuffer(poly_vertexLocation,GL_FLOAT,0,3);
+    rendering_program.enableAttributeArray(poly_vertexLocation);
+    buffers[4].release();
+    rendering_program.release();
+
+    vao[4].release();
+
+    //grid
+    vao[5].bind();
+    buffers[5].bind();
+    buffers[5].allocate(pos_grid.data(), static_cast<int>(pos_grid.size()*sizeof(float)));
+    poly_vertexLocation = rendering_program.attributeLocation("vertex");
+    rendering_program.bind();
+    rendering_program.setAttributeBuffer(poly_vertexLocation,GL_FLOAT,0,3);
+    rendering_program.enableAttributeArray(poly_vertexLocation);
+    buffers[5].release();
+    rendering_program.release();
+    vao[5].release();
+
+    //cutting plane
+    vao[6].bind();
+    buffers[6].bind();
+    buffers[6].allocate(pos_plane.data(), static_cast<int>(pos_plane.size()*sizeof(float)));
+    poly_vertexLocation = tex_rendering_program.attributeLocation("vertex");
+    tex_rendering_program.bind();
+    tex_rendering_program.setAttributeBuffer(poly_vertexLocation,GL_FLOAT,0,3);
+    tex_rendering_program.enableAttributeArray(poly_vertexLocation);
+    buffers[6].release();
+    tex_rendering_program.release();
+
+    buffers[7].bind();
+    buffers[7].allocate(tex_map.data(), static_cast<int>(tex_map.size()*sizeof(float)));
+    tex_Location = tex_rendering_program.attributeLocation("tex_coord");
+    tex_rendering_program.bind();
+    tex_rendering_program.setAttributeBuffer(tex_Location,GL_FLOAT,0,2);
+    tex_rendering_program.enableAttributeArray(tex_Location);
+    buffers[7].release();
+    tex_rendering_program.release();
+
+    gl->glBindTexture(GL_TEXTURE_2D, textureId);
+    gl->glTexImage2D(GL_TEXTURE_2D,
+                 0,
+                 GL_RGB,
+                 texture->getWidth(),
+                 texture->getHeight(),
+                 0,
+                 GL_RGB,
+                 GL_UNSIGNED_BYTE,
+                 texture->getData());
+    gl->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+    gl->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+    gl->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE );
+    gl->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE );
+    vao[6].release();
+
+    are_buffers_initialized = true;
+
+
+
+}
+
+void Scene::compute_elements(int mode)
+{
+    pos_points.resize(0);
+    pos_lines.resize(0);
+    pos_poly.resize(0);
+    pos_cut_segments.resize(0);
+    tex_map.resize(0);
+    pos_grid.resize(66);
+    pos_plane.resize(18);
+    float diag = .6f * float(bbox_diag());
+    //The Points
+    {
+        std::list<Point>::iterator pit;
+        for(pit = m_points.begin(); pit != m_points.end(); pit++)
+        {
+            const Point& p = *pit;
+            pos_points.push_back(p.x());
+            pos_points.push_back(p.y());
+            pos_points.push_back(p.z());
+        }
+    }
+    //The Segements
+    {
+        std::list<Segment>::iterator sit;
+        for(sit = m_segments.begin(); sit != m_segments.end(); sit++)
+        {
+            const Segment& s = *sit;
+            const Point& p = s.source();
+            const Point& q = s.target();
+
+            pos_lines.push_back(p.x());
+            pos_lines.push_back(p.y());
+            pos_lines.push_back(p.z());
+
+            pos_lines.push_back(q.x());
+            pos_lines.push_back(q.y());
+            pos_lines.push_back(q.z());
+        }
+    }
+    //The Polygon's edges
+    {
+        Polyhedron::Edge_iterator he;
+        for(he = m_pPolyhedron->edges_begin();
+            he != m_pPolyhedron->edges_end();
+            he++)
+        {
+            const Point& a = he->vertex()->point();
+            const Point& b = he->opposite()->vertex()->point();
+            pos_poly.push_back(a.x());
+            pos_poly.push_back(a.y());
+            pos_poly.push_back(a.z());
+
+            pos_poly.push_back(b.x());
+            pos_poly.push_back(b.y());
+            pos_poly.push_back(b.z());
+        }
+    }
+    //The cutting segments
+    {
+        for ( std::vector<Segment>::const_iterator csit = m_cut_segments.begin(),
+              end = m_cut_segments.end() ; csit != end ; ++csit )
+        {
+            const Point& a = csit->source();
+            const Point& b = csit->target();
+
+            pos_cut_segments.push_back(a.x());
+            pos_cut_segments.push_back(a.y());
+            pos_cut_segments.push_back(a.z());
+
+            pos_cut_segments.push_back(b.x());
+            pos_cut_segments.push_back(b.y());
+            pos_cut_segments.push_back(b.z());
+        }
+    }
+    //The cutting plane
+    {
+
+        pos_plane[0]= -diag; pos_plane[1]=-diag; pos_plane[2]=0.0;
+        pos_plane[3]= -diag; pos_plane[4]= diag; pos_plane[5]=0.;
+        pos_plane[6]=  diag; pos_plane[7]= diag; pos_plane[8]=0.;
+        pos_plane[9]= -diag; pos_plane[10]= -diag; pos_plane[11]=0.;
+        pos_plane[12]= diag;    pos_plane[13]= diag; pos_plane[14]= 0.;
+        pos_plane[15]= diag;    pos_plane[16]= -diag; pos_plane[17]= 0.;
+
+        //UV Mapping
+        tex_map.push_back(-0.11f);
+        tex_map.push_back(-0.11f);
+
+        tex_map.push_back(-0.11f);
+        tex_map.push_back(1.11f);
+
+        tex_map.push_back(1.11f);
+        tex_map.push_back(1.11f);
+
+        tex_map.push_back(-0.11f);
+        tex_map.push_back(-0.11f);
+
+        tex_map.push_back(1.11f);
+        tex_map.push_back(1.11f);
+
+        tex_map.push_back(1.11f);
+        tex_map.push_back(-0.11f);
+
+
+
+
+
+    }
+    //The grid
+    {
+        float z = 0;
+        float x = (2 * diag)/10.0;
+        float y = (2 * diag)/10.0;
+        for(int u = 0; u < 11; u++)
+        {
+
+            pos_grid.push_back(-diag + x* u);
+            pos_grid.push_back(-diag);
+            pos_grid.push_back(z);
+
+            pos_grid.push_back(-diag + x* u);
+            pos_grid.push_back(diag);
+            pos_grid.push_back(z);
+        }
+        for(int v=0; v<11; v++)
+        {
+
+            pos_grid.push_back(-diag);
+            pos_grid.push_back(-diag + v * y);
+            pos_grid.push_back(z);
+
+            pos_grid.push_back(diag);
+            pos_grid.push_back(-diag + v * y);
+            pos_grid.push_back(z);
+
+        }
+
+    }
+    //The texture
+    switch(mode)
+    {
+    case _SIGNED:
+        for( int i=0 ; i < texture->getWidth(); i++ )
+        {
+            for( int j=0 ; j < texture->getHeight() ; j++)
+            {
+                compute_texture(i,j,m_red_ramp,m_blue_ramp);
+            }
+        }
+        break;
+    case _UNSIGNED:
+        for( int i=0 ; i < texture->getWidth(); i++ )
+        {
+            for( int j=0 ; j < texture->getHeight() ; j++)
+            {
+                compute_texture(i,j,m_thermal_ramp,m_thermal_ramp);
+            }
+        }
+        break;}
+    sampler_location = tex_rendering_program.attributeLocation("texture");
+}
+
+void Scene::compute_texture(int i, int j,Color_ramp pos_ramp ,Color_ramp neg_ramp)
+{
+
+
+    const FT& d00 = m_distance_function[i][j].second;
+    // determines grey level
+    unsigned int i00 = 255-(unsigned)(255.0 * (double)std::fabs(d00) / m_max_distance_function);
+
+    if(d00 > 0.0)
+        texture->setData(i,j,pos_ramp.r(i00),pos_ramp.g(i00),pos_ramp.b(i00));
+    else
+        texture->setData(i,j,neg_ramp.r(i00),neg_ramp.g(i00),neg_ramp.b(i00));
+
+
+}
+
+void Scene::attrib_buffers(QGLViewer* viewer)
+{
+    QMatrix4x4 mvpMatrix;
+    double mat[16];
+    viewer->camera()->getModelViewProjectionMatrix(mat);
+    for(int i=0; i < 16; i++)
+    {
+        mvpMatrix.data()[i] = (float)mat[i];
+    }
+    rendering_program.bind();
+    mvpLocation = rendering_program.uniformLocation("mvp_matrix");
+    fLocation = rendering_program.uniformLocation("f_matrix");
+    colorLocation = rendering_program.uniformLocation("color");
+    rendering_program.setUniformValue(mvpLocation, mvpMatrix);
+    rendering_program.release();
+
+    tex_rendering_program.bind();
+    tex_mvpLocation = tex_rendering_program.uniformLocation("mvp_matrix");
+    tex_fLocation = tex_rendering_program.uniformLocation("f_matrix");
+    tex_rendering_program.setUniformValue(tex_mvpLocation, mvpMatrix);
+    tex_rendering_program.release();
+}
+
+void Scene::changed()
+{
+    if(m_cut_plane == UNSIGNED_FACETS || m_cut_plane == UNSIGNED_EDGES)
+        compute_elements(_UNSIGNED);
+    else
+        compute_elements(_SIGNED);
+    are_buffers_initialized = false;
+
+}
+
+int Scene::open(QString filename)
+{
+    QTextStream cerr(stderr);
+    cerr << QString("Opening file \"%1\"\n").arg(filename);
+    QApplication::setOverrideCursor(QCursor(::Qt::WaitCursor));
+
+    QFileInfo fileinfo(filename);
+    std::ifstream in(filename.toUtf8());
+
+    if(!in || !fileinfo.isFile() || ! fileinfo.isReadable())
+    {
+        std::cerr << "unable to open file" << std::endl;
+        QApplication::restoreOverrideCursor();
+        return -1;
+    }
+
+    if(m_pPolyhedron != NULL)
+        delete m_pPolyhedron;
+
+    // allocate new polyhedron
+    m_pPolyhedron = new Polyhedron;
+    in >> *m_pPolyhedron;
+    if(!in)
+    {
+        std::cerr << "invalid OFF file" << std::endl;
+        QApplication::restoreOverrideCursor();
+
+        delete m_pPolyhedron;
+        m_pPolyhedron = NULL;
+
+        return -1;
+    }
+
+    // clear tree
+    clear_internal_data();
+
+    QApplication::restoreOverrideCursor();
+    changed();
+    return 0;
+}
+
+void Scene::update_bbox()
+{
+    std::cout << "Compute bbox...";
+    m_bbox = Bbox();
+
+    if(m_pPolyhedron == NULL)
+    {
+        std::cout << "failed (no polyhedron)." << std::endl;
+        return;
+    }
+
+    if(m_pPolyhedron->empty())
+    {
+        std::cout << "failed (empty polyhedron)." << std::endl;
+        return;
+    }
+
+    Polyhedron::Point_iterator it = m_pPolyhedron->points_begin();
+    m_bbox = (*it).bbox();
+    for(; it != m_pPolyhedron->points_end();it++)
+        m_bbox = m_bbox + (*it).bbox();
+    std::cout << "done (" << m_pPolyhedron->size_of_facets()
+              << " facets)" << std::endl;
+}
+
+void Scene::draw(QGLViewer* viewer)
+{       
+    if(!gl_init)
+        initGL();
+    if(!are_buffers_initialized)
+        initialize_buffers();
+    QColor color;
+    QMatrix4x4 fMatrix;
+    fMatrix.setToIdentity();
+    if(m_view_polyhedron && pos_poly.size()>0)
+    {
+        vao[2].bind();
+        attrib_buffers(viewer);
+        rendering_program.bind();
+        color.setRgbF(0.0,0.0,0.0);
+        rendering_program.setUniformValue(colorLocation, color);
+        rendering_program.setUniformValue(fLocation, fMatrix);
+        gl->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(pos_poly.size()/3));
+        rendering_program.release();
+        vao[2].release();
+    }
+    if(m_view_points && pos_points.size()>0)
+    {
+        gl->glPointSize(2.0f);
+        vao[0].bind();
+        attrib_buffers(viewer);
+        rendering_program.bind();
+        color.setRgbF(0.7,0.0,0.0);
+        rendering_program.setUniformValue(colorLocation, color);
+        rendering_program.setUniformValue(fLocation, fMatrix);
+        gl->glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(pos_points.size()/3));
+        rendering_program.release();
+        vao[0].release();
+    }
+
+    if(m_view_segments && pos_lines.size()>0)
+    {
+        vao[1].bind();
+        attrib_buffers(viewer);
+        rendering_program.bind();
+        color.setRgbF(0.0,0.7,0.0);
+        rendering_program.setUniformValue(colorLocation, color);
+        rendering_program.setUniformValue(fLocation, fMatrix);
+        gl->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(pos_lines.size()/3));
+        rendering_program.release();
+        vao[1].release();
+    }
+    if (m_view_plane && pos_plane.size()>0)
+    {
+        switch( m_cut_plane )
+        {
+        case UNSIGNED_EDGES:
+        case UNSIGNED_FACETS:
+        case SIGNED_FACETS:
+
+            gl->glActiveTexture(GL_TEXTURE0);
+            gl->glBindTexture(GL_TEXTURE_2D, textureId);
+
+            for(int i=0; i< 16 ; i++)
+                fMatrix.data()[i] =  m_frame->matrix()[i];
+            vao[6].bind();
+            attrib_buffers(viewer);
+            tex_rendering_program.bind();
+            tex_rendering_program.setUniformValue(tex_fLocation, fMatrix);
+
+            gl->glDrawArrays(GL_TRIANGLES, 0,static_cast<GLsizei>(pos_plane.size()/3));
+            tex_rendering_program.release();
+            vao[6].release();
+            break;
+
+        case CUT_SEGMENTS:
+
+            //cutting_segments
+            fMatrix.setToIdentity();
+            ::glLineWidth(2.0f);
+            vao[3].bind();
+            attrib_buffers(viewer);
+            rendering_program.bind();
+            color.setRgbF(1.0,0.0,0.0);
+            rendering_program.setUniformValue(colorLocation, color);
+            rendering_program.setUniformValue(fLocation, fMatrix);
+            gl->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(pos_cut_segments.size()/3));
+            ::glLineWidth(1.0f);
+            rendering_program.release();
+            vao[3].release();
+            //grid
+            for(int i=0; i< 16 ; i++)
+                fMatrix.data()[i] =  m_frame->matrix()[i];
+            vao[5].bind();
+            attrib_buffers(viewer);
+            rendering_program.bind();
+            color.setRgbF(.6f, .6f, .6f);
+            rendering_program.setUniformValue(colorLocation, color);
+            rendering_program.setUniformValue(fLocation, fMatrix);
+            gl->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(pos_grid.size()/3));
+            rendering_program.release();
+            vao[5].release();
+
+            //cutting_plane
+            // for(int i=0; i< 16 ; i++)
+            //     fMatrix.data()[i] =  m_frame->matrix()[i];
+            ::glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
+            ::glEnable(GL_BLEND);
+            vao[4].bind();
+            attrib_buffers(viewer);
+            rendering_program.bind();
+            color.setRgbF(.6f, .85f, 1.f, .65f);
+            rendering_program.setUniformValue(colorLocation, color);
+            rendering_program.setUniformValue(fLocation, fMatrix);
+            gl->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(pos_plane.size()/3));
+            ::glDisable(GL_BLEND);
+            rendering_program.release();
+            vao[4].release();
+
+            break;
+        case NONE: // do nothing
+            break;
+        }
+    }
+
+
+}
+
+FT Scene::random_in(const double a,
+                    const double b)
+{
+    double r = rand() / (double)RAND_MAX;
+    return (FT)(a + (b - a) * r);
+}
+
+Point Scene::random_point(const CGAL::Bbox_3& bbox)
+{
+    FT x = random_in(bbox.xmin(),bbox.xmax());
+    FT y = random_in(bbox.ymin(),bbox.ymax());
+    FT z = random_in(bbox.zmin(),bbox.zmax());
+    return Point(x,y,z);
+}
+
+Vector Scene::random_vector()
+{
+    FT x = random_in(0.0,1.0);
+    FT y = random_in(0.0,1.0);
+    FT z = random_in(0.0,1.0);
+    return Vector(x,y,z);
+}
+
+Ray Scene::random_ray(const CGAL::Bbox_3& bbox)
+{
+    Point p = random_point(bbox);
+    Point q = random_point(bbox);
+    return Ray(p,q);
+}
+
+Segment Scene::random_segment(const CGAL::Bbox_3& bbox)
+{
+    Point p = random_point(bbox);
+    Point q = random_point(bbox);
+    return Segment(p,q);
+}
+
+Line Scene::random_line(const CGAL::Bbox_3& bbox)
+{
+    Point p = random_point(bbox);
+    Point q = random_point(bbox);
+    return Line(p,q);
+}
+
+Plane Scene::random_plane(const CGAL::Bbox_3& bbox)
+{
+    Point p = random_point(bbox);
+    Vector vec = random_vector();
+    return Plane(p,vec);
+}
+
+Plane Scene::frame_plane() const
+{
+    const qglviewer::Vec& pos = m_frame->position();
+    const qglviewer::Vec& n = m_frame->inverseTransformOf(qglviewer::Vec(0.f, 0.f, 1.f));
+
+    return Plane(n[0], n[1],  n[2], - n * pos);
+}
+
+Aff_transformation Scene::frame_transformation() const
+{
+    const ::GLdouble* m = m_frame->matrix();
+
+    // OpenGL matrices are row-major matrices
+    return Aff_transformation (m[0], m[4], m[8], m[12],
+            m[1], m[5], m[9], m[13],
+            m[2], m[6], m[10], m[14]);
+}
+
+FT Scene::bbox_diag() const
+{
+    double dx = m_bbox.xmax()-m_bbox.xmin();
+    double dy = m_bbox.ymax()-m_bbox.ymin();
+    double dz = m_bbox.zmax()-m_bbox.zmin();
+
+    return FT(std::sqrt(dx*dx + dy*dy + dz*dz));
+}
+
+void Scene::build_facet_tree()
+{
+    if ( NULL == m_pPolyhedron )
+    {
+        std::cerr << "Build facet tree failed: load polyhedron first." << std::endl;
+        return;
+    }
+
+    // Don't rebuild tree if it is already built
+    if ( !m_facet_tree.empty() ) { return; }
+
+    // build tree
+    CGAL::Timer timer;
+    timer.start();
+    std::cout << "Construct Facet AABB tree...";
+    m_facet_tree.rebuild(faces(*m_pPolyhedron).first, faces(*m_pPolyhedron).second,*m_pPolyhedron);
+    m_facet_tree.accelerate_distance_queries();
+    std::cout << "done (" << timer.time() << " s)" << std::endl;
+}
+
+void Scene::build_edge_tree()
+{
+    if ( NULL == m_pPolyhedron )
+    {
+        std::cerr << "Build edge tree failed: load polyhedron first." << std::endl;
+        return;
+    }
+
+    // Don't rebuild tree if it is already built
+    if ( !m_edge_tree.empty() ) { return; }
+
+    // build tree
+    CGAL::Timer timer;
+    timer.start();
+    std::cout << "Construct Edge AABB tree...";
+    m_edge_tree.rebuild(edges(*m_pPolyhedron).first,edges(*m_pPolyhedron).second,*m_pPolyhedron);
+    m_edge_tree.accelerate_distance_queries();
+    std::cout << "done (" << timer.time() << " s)" << std::endl;
+}
+
+void Scene::clear_internal_data()
+{
+    m_facet_tree.clear();
+    m_edge_tree.clear();
+
+    clear_points();
+    clear_segments();
+    clear_cutting_plane();
+}
+
+void Scene::clear_cutting_plane()
+{
+    m_cut_segments.clear();
+    m_cut_plane = NONE;
+
+    deactivate_cutting_plane();
+    changed();
+}
+
+void Scene::update_grid_size()
+{
+    m_grid_size = m_fast_distance ? fast_distance_grid_size
+                                  : slow_distance_grid_size;
+    texture = new Texture(m_grid_size,m_grid_size);
+}
+
+void Scene::generate_points_in(const unsigned int nb_points,
+                               const double min,
+                               const double max)
+{
+    if(m_pPolyhedron == NULL)
+    {
+        std::cout << "Load polyhedron first." << std::endl;
+        return;
+    }
+
+    typedef CGAL::AABB_face_graph_triangle_primitive<Polyhedron> Primitive;
+    typedef CGAL::AABB_traits<Kernel, Primitive> Traits;
+    typedef CGAL::AABB_tree<Traits> Tree;
+
+    std::cout << "Construct AABB tree...";
+    Tree tree(faces(*m_pPolyhedron).first, faces(*m_pPolyhedron).second, *m_pPolyhedron);
+    std::cout << "done." << std::endl;
+
+    CGAL::Timer timer;
+    timer.start();
+    std::cout << "Generate " << nb_points << " points in interval ["
+              << min << ";" << max << "]";
+
+    unsigned int nb_trials = 0;
+    Vector vec = random_vector();
+    while(m_points.size() < nb_points)
+    {
+        Point p = random_point(tree.bbox());
+
+        // measure distance
+        FT signed_distance = std::sqrt(tree.squared_distance(p));
+
+        // measure sign
+        Ray ray(p,vec);
+        int nb_intersections = (int)tree.number_of_intersected_primitives(ray);
+        if(nb_intersections % 2 != 0)
+            signed_distance *= -1.0;
+
+        if(signed_distance >= min &&
+                signed_distance <= max)
+        {
+            m_points.push_back(p);
+            if(m_points.size()%(nb_points/10) == 0)
+                std::cout << "."; // ASCII progress bar
+        }
+        nb_trials++;
+    }
+    double speed = (double)nb_trials / timer.time();
+    std::cout << "done (" << nb_trials << " trials, "
+              << timer.time() << " s, "
+              << speed << " queries/s)" << std::endl;
+    changed();
+}
+
+
+void Scene::generate_inside_points(const unsigned int nb_points)
+{
+    if(m_pPolyhedron == NULL)
+    {
+        std::cout << "Load polyhedron first." << std::endl;
+        return;
+    }
+
+    typedef CGAL::AABB_face_graph_triangle_primitive<Polyhedron> Primitive;
+    typedef CGAL::AABB_traits<Kernel, Primitive> Traits;
+    typedef CGAL::AABB_tree<Traits> Tree;
+
+    std::cout << "Construct AABB tree...";
+    Tree tree(faces(*m_pPolyhedron).first, faces(*m_pPolyhedron).second,*m_pPolyhedron);
+    std::cout << "done." << std::endl;
+
+    CGAL::Timer timer;
+    timer.start();
+    std::cout << "Generate " << nb_points << " inside points";
+
+    unsigned int nb_trials = 0;
+    Vector vec = random_vector();
+    while(m_points.size() < nb_points)
+    {
+        Point p = random_point(tree.bbox());
+        Ray ray(p,vec);
+        int nb_intersections = (int)tree.number_of_intersected_primitives(ray);
+        if(nb_intersections % 2 != 0)
+        {
+            m_points.push_back(p);
+            if(m_points.size()%(nb_points/10) == 0)
+                std::cout << "."; // ASCII progress bar
+        }
+        nb_trials++;
+    }
+    double speed = (double)nb_trials / timer.time();
+    std::cout << "done (" << nb_trials << " trials, "
+              << timer.time() << " s, "
+              << speed << " queries/s)" << std::endl;
+    changed();
+}
+
+void Scene::generate_boundary_segments(const unsigned int nb_slices)
+{
+    if(m_pPolyhedron == NULL)
+    {
+        std::cout << "Load polyhedron first." << std::endl;
+        return;
+    }
+
+    typedef CGAL::AABB_face_graph_triangle_primitive<Polyhedron> Primitive;
+    typedef CGAL::AABB_traits<Kernel, Primitive> Traits;
+    typedef CGAL::AABB_tree<Traits> Tree;
+    typedef Tree::Object_and_primitive_id Object_and_primitive_id;
+
+    std::cout << "Construct AABB tree...";
+    Tree tree(faces(*m_pPolyhedron).first,faces(*m_pPolyhedron).second,*m_pPolyhedron);
+    std::cout << "done." << std::endl;
+
+    CGAL::Timer timer;
+    timer.start();
+    std::cout << "Generate boundary segments from " << nb_slices << " slices: ";
+
+    Vector normal((FT)0.0,(FT)0.0,(FT)1.0);
+    unsigned int i;
+
+    const double dz = m_bbox.zmax() - m_bbox.zmin();
+    for(i=0;i<nb_slices;i++)
+    {
+        FT z = m_bbox.zmin() + (FT)i / (FT)nb_slices * dz;
+        Point p((FT)0.0, (FT)0.0, z);
+        Plane plane(p,normal);
+
+        std::list<Object_and_primitive_id> intersections;
+        tree.all_intersections(plane,std::back_inserter(intersections));
+
+        std::list<Object_and_primitive_id>::iterator it;
+        for(it = intersections.begin();
+            it != intersections.end();
+            it++)
+        {
+            Object_and_primitive_id op = *it;
+            CGAL::Object object = op.first;
+            Segment segment;
+            if(CGAL::assign(segment,object))
+                m_segments.push_back(segment);
+        }
+    }
+    std::cout << m_segments.size() << " segments, " << timer.time() << " s." << std::endl;
+    changed();
+}
+
+void Scene::generate_boundary_points(const unsigned int nb_points)
+{
+    if(m_pPolyhedron == NULL)
+    {
+        std::cout << "Load polyhedron first." << std::endl;
+        return;
+    }
+
+    typedef CGAL::AABB_face_graph_triangle_primitive<Polyhedron> Primitive;
+    typedef CGAL::AABB_traits<Kernel, Primitive> Traits;
+    typedef CGAL::AABB_tree<Traits> Tree;
+    typedef Tree::Object_and_primitive_id Object_and_primitive_id;
+
+    std::cout << "Construct AABB tree...";
+    Tree tree(faces(*m_pPolyhedron).first, faces(*m_pPolyhedron).second,*m_pPolyhedron);
+    std::cout << "done." << std::endl;
+
+    CGAL::Timer timer;
+    timer.start();
+    std::cout << "Generate boundary points: ";
+
+    unsigned int nb = 0;
+    unsigned int nb_lines = 0;
+    while(nb < nb_points)
+    {
+        Line line = random_line(tree.bbox());
+
+        std::list<Object_and_primitive_id> intersections;
+        tree.all_intersections(line,std::back_inserter(intersections));
+        nb_lines++;
+
+        std::list<Object_and_primitive_id>::iterator it;
+        for(it = intersections.begin();
+            it != intersections.end();
+            it++)
+        {
+            Object_and_primitive_id op = *it;
+            CGAL::Object object = op.first;
+            Point point;
+            if(CGAL::assign(point,object))
+            {
+                m_points.push_back(point);
+                nb++;
+            }
+        }
+    }
+    std::cout << nb_lines << " line queries, " << timer.time() << " s." << std::endl;
+    changed();
+}
+
+void Scene::generate_edge_points(const unsigned int nb_points)
+{
+    if(m_pPolyhedron == NULL)
+    {
+        std::cout << "Load polyhedron first." << std::endl;
+        return;
+    }
+
+    typedef CGAL::AABB_halfedge_graph_segment_primitive<Polyhedron> Primitive;
+    typedef CGAL::AABB_traits<Kernel, Primitive> Traits;
+    typedef CGAL::AABB_tree<Traits> Tree;
+    typedef Tree::Object_and_primitive_id Object_and_primitive_id;
+
+    std::cout << "Construct AABB tree...";
+    Tree tree( CGAL::edges(*m_pPolyhedron).first,
+               CGAL::edges(*m_pPolyhedron).second,
+               *m_pPolyhedron);
+    std::cout << "done." << std::endl;
+
+    CGAL::Timer timer;
+    timer.start();
+    std::cout << "Generate edge points: ";
+
+    unsigned int nb = 0;
+    unsigned int nb_planes = 0;
+    while(nb < nb_points)
+    {
+        Plane plane = random_plane(tree.bbox());
+
+        std::list<Object_and_primitive_id> intersections;
+        tree.all_intersections(plane,std::back_inserter(intersections));
+        nb_planes++;
+
+        std::list<Object_and_primitive_id>::iterator it;
+        for(it = intersections.begin();
+            it != intersections.end();
+            it++)
+        {
+            Object_and_primitive_id op = *it;
+            CGAL::Object object = op.first;
+            Point point;
+            if(CGAL::assign(point,object))
+            {
+                m_points.push_back(point);
+                nb++;
+            }
+        }
+    }
+    std::cout << nb_planes << " plane queries, " << timer.time() << " s." << std::endl;
+    changed();
+}
+
+
+template <typename Tree>
+void Scene::compute_distance_function(const Tree& tree)
+{
+    // Get transformation
+    Aff_transformation t = frame_transformation();
+    m_max_distance_function = FT(0);
+    FT diag = bbox_diag();
+
+    const FT dx = diag;
+    const FT dy = diag;
+    const FT z (0);
+    const FT fd =  FT(2);
+    for(int i=0 ; i<m_grid_size ; ++i)
+    {
+        FT x = -diag/fd + FT(i)/FT(m_grid_size) * dx;
+
+        for(int j=0 ; j<m_grid_size ; ++j)
+        {
+            FT y = -diag/fd + FT(j)/FT(m_grid_size) * dy;
+            Point query = t( Point(x,y,z) );
+            FT dist = CGAL::sqrt( tree.squared_distance(query) );
+
+            m_distance_function[i][j] = Point_distance(query,dist);
+            m_max_distance_function = (std::max)(dist, m_max_distance_function);
+        }
+    }
+}
+
+template <typename Tree>
+void Scene::sign_distance_function(const Tree& tree)
+{
+    typedef typename Tree::size_type size_type;
+    Vector random_vec = random_vector();
+
+    for(int i=0 ; i<m_grid_size ; ++i)
+    {
+        for(int j=0 ; j<m_grid_size ; ++j)
+        {
+            const Point& p = m_distance_function[i][j].first;
+            const FT unsigned_distance = m_distance_function[i][j].second;
+
+            // get sign through ray casting (random vector)
+            Ray ray(p, random_vec);
+            size_type nbi = tree.number_of_intersected_primitives(ray);
+
+            FT sign ( (nbi&1) == 0 ? 1 : -1);
+            m_distance_function[i][j].second = sign * unsigned_distance;
+        }
+    }
+    changed();
+}
+
+
+void Scene::unsigned_distance_function()
+{
+    // Build tree (if build fail, exit)
+    build_facet_tree();
+    if ( m_facet_tree.empty() ) { return; }
+
+    compute_distance_function(m_facet_tree);
+
+    m_cut_plane = UNSIGNED_FACETS;
+    changed();
+}
+
+
+void Scene::unsigned_distance_function_to_edges()
+{
+    // Build tree (if build fail, exit)
+    build_edge_tree();
+    if ( m_edge_tree.empty() ) { return; }
+
+    compute_distance_function(m_edge_tree);
+
+    m_cut_plane = UNSIGNED_EDGES;
+    changed();
+}
+
+
+void Scene::signed_distance_function()
+{
+    // Build tree (if build fail, exit)
+    build_facet_tree();
+    if ( m_facet_tree.empty() ) { return; }
+
+    compute_distance_function(m_facet_tree);
+    sign_distance_function(m_facet_tree);
+
+    m_cut_plane = SIGNED_FACETS;
+    changed();
+}
+
+
+void Scene::cut_segment_plane()
+{
+    // Build tree (if build fail, exit)
+    build_facet_tree();
+    if ( m_facet_tree.empty() ) { return; }
+
+    Plane plane = frame_plane();
+
+    // Compute intersections
+    typedef std::vector<Facet_tree::Object_and_primitive_id> Intersections;
+    Intersections intersections;
+    m_facet_tree.all_intersections(plane, std::back_inserter(intersections));
+
+    // Fill data structure
+    m_cut_segments.clear();
+    for ( Intersections::iterator it = intersections.begin(),
+          end = intersections.end() ; it != end ; ++it )
+    {
+        const Segment* inter_seg = CGAL::object_cast<Segment>(&(it->first));
+
+        if ( NULL != inter_seg )
+        {
+            m_cut_segments.push_back(*inter_seg);
+        }
+    }
+
+    m_cut_plane = CUT_SEGMENTS;
+    changed();
+}
+
+void Scene::cutting_plane(bool override)
+{
+    if(ready_to_cut || override)
+    {
+        ready_to_cut = false;
+        switch( m_cut_plane )
+        {
+        case UNSIGNED_FACETS:
+            return unsigned_distance_function();
+        case SIGNED_FACETS:
+            return signed_distance_function();
+        case UNSIGNED_EDGES:
+            return unsigned_distance_function_to_edges();
+        case CUT_SEGMENTS:
+            return cut_segment_plane();
+        case NONE: // do nothing
+            return;
+        }
+
+        // Should not be here
+        std::cerr << "Unknown cut_plane type" << std::endl;
+        CGAL_assertion(false);
+    }
+}
+
+void Scene::toggle_view_poyhedron()
+{
+    m_view_polyhedron = !m_view_polyhedron;
+}
+
+void Scene::toggle_view_segments()
+{
+    m_view_segments = !m_view_segments;
+}
+
+void Scene::toggle_view_points()
+{
+    m_view_points = !m_view_points;
+}
+
+void Scene::toggle_view_plane()
+{
+    m_view_plane = !m_view_plane;
+}
+
+void Scene::refine_bisection(const FT max_sqlen)
+{
+    if(m_pPolyhedron == NULL)
+    {
+        std::cout << "Load polyhedron first." << std::endl;
+        return;
+    }
+    std::cout << "Refine through recursive longest edge bisection...";
+    Refiner<Kernel,Polyhedron> refiner(m_pPolyhedron);
+    refiner(max_sqlen);
+    std::cout << "done (" << m_pPolyhedron->size_of_facets() << " facets)" << std::endl;
+
+    clear_internal_data();
+}
+
+void Scene::refine_loop()
+{
+    if(m_pPolyhedron == NULL)
+    {
+        std::cout << "Load polyhedron first." << std::endl;
+        return;
+    }
+    std::cout << "Loop subdivision...";
+    CGAL::Subdivision_method_3::Loop_subdivision(*m_pPolyhedron, 1);
+    std::cout << "done (" << m_pPolyhedron->size_of_facets() << " facets)" << std::endl;
+
+    clear_internal_data();
+}
+
+
+void Scene::activate_cutting_plane()
+{
+    connect(m_frame, SIGNAL(modified()), this, SLOT(cutting_plane()));
+    m_view_plane = true;
+}
+
+void Scene::deactivate_cutting_plane()
+{
+    disconnect(m_frame, SIGNAL(modified()), this, SLOT(cutting_plane()));
+    m_view_plane = false;
+}
+void Scene::initGL()
+{
+    gl = new QOpenGLFunctions_2_1();
+   if(!gl->initializeOpenGLFunctions())
+    {
+        qFatal("ERROR : OpenGL Functions not initialized. Check your OpenGL Verison (should be >=3.3)");
+        exit(1);
+    }
+
+    gl->glGenTextures(1, &textureId);
+    compile_shaders();
+    gl_init = true;
+}
+
+void Scene::timerEvent(QTimerEvent *)
+{
+    if(manipulatedFrame()->isSpinning())
+        set_fast_distance(true);
+    ready_to_cut = true;
+}
diff --git a/3rdparty/CGAL-4.8/demo/AABB_tree/Scene.h b/3rdparty/CGAL/demo/AABB_tree/Scene.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/AABB_tree/Scene.h
rename to 3rdparty/CGAL/demo/AABB_tree/Scene.h
diff --git a/3rdparty/CGAL-4.8/demo/AABB_tree/Viewer.cpp b/3rdparty/CGAL/demo/AABB_tree/Viewer.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/AABB_tree/Viewer.cpp
rename to 3rdparty/CGAL/demo/AABB_tree/Viewer.cpp
diff --git a/3rdparty/CGAL-4.8/demo/AABB_tree/Viewer.h b/3rdparty/CGAL/demo/AABB_tree/Viewer.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/AABB_tree/Viewer.h
rename to 3rdparty/CGAL/demo/AABB_tree/Viewer.h
diff --git a/3rdparty/CGAL-4.8/demo/AABB_tree/benchmarks.cpp b/3rdparty/CGAL/demo/AABB_tree/benchmarks.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/AABB_tree/benchmarks.cpp
rename to 3rdparty/CGAL/demo/AABB_tree/benchmarks.cpp
diff --git a/3rdparty/CGAL-4.8/demo/AABB_tree/data/hand.off b/3rdparty/CGAL/demo/AABB_tree/data/hand.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/AABB_tree/data/hand.off
rename to 3rdparty/CGAL/demo/AABB_tree/data/hand.off
diff --git a/3rdparty/CGAL-4.8/demo/AABB_tree/data/knot.off b/3rdparty/CGAL/demo/AABB_tree/data/knot.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/AABB_tree/data/knot.off
rename to 3rdparty/CGAL/demo/AABB_tree/data/knot.off
diff --git a/3rdparty/CGAL-4.8/demo/AABB_tree/data/part.off b/3rdparty/CGAL/demo/AABB_tree/data/part.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/AABB_tree/data/part.off
rename to 3rdparty/CGAL/demo/AABB_tree/data/part.off
diff --git a/3rdparty/CGAL-4.8/demo/AABB_tree/data/u.off b/3rdparty/CGAL/demo/AABB_tree/data/u.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/AABB_tree/data/u.off
rename to 3rdparty/CGAL/demo/AABB_tree/data/u.off
diff --git a/3rdparty/CGAL-4.8/demo/AABB_tree/resources/about.html b/3rdparty/CGAL/demo/AABB_tree/resources/about.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/AABB_tree/resources/about.html
rename to 3rdparty/CGAL/demo/AABB_tree/resources/about.html
diff --git a/3rdparty/CGAL-4.8/demo/AABB_tree/resources/cgal_logo.xpm b/3rdparty/CGAL/demo/AABB_tree/resources/cgal_logo.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/AABB_tree/resources/cgal_logo.xpm
rename to 3rdparty/CGAL/demo/AABB_tree/resources/cgal_logo.xpm
diff --git a/3rdparty/CGAL-4.8/demo/AABB_tree/types.h b/3rdparty/CGAL/demo/AABB_tree/types.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/AABB_tree/types.h
rename to 3rdparty/CGAL/demo/AABB_tree/types.h
diff --git a/3rdparty/CGAL-4.8/demo/Alpha_shapes_2/Alpha_shapes_2.cpp b/3rdparty/CGAL/demo/Alpha_shapes_2/Alpha_shapes_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Alpha_shapes_2/Alpha_shapes_2.cpp
rename to 3rdparty/CGAL/demo/Alpha_shapes_2/Alpha_shapes_2.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Alpha_shapes_2/Alpha_shapes_2.qrc b/3rdparty/CGAL/demo/Alpha_shapes_2/Alpha_shapes_2.qrc
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Alpha_shapes_2/Alpha_shapes_2.qrc
rename to 3rdparty/CGAL/demo/Alpha_shapes_2/Alpha_shapes_2.qrc
diff --git a/3rdparty/CGAL-4.8/demo/Alpha_shapes_2/Alpha_shapes_2.ui b/3rdparty/CGAL/demo/Alpha_shapes_2/Alpha_shapes_2.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Alpha_shapes_2/Alpha_shapes_2.ui
rename to 3rdparty/CGAL/demo/Alpha_shapes_2/Alpha_shapes_2.ui
diff --git a/3rdparty/CGAL/demo/Alpha_shapes_2/CMakeLists.txt b/3rdparty/CGAL/demo/Alpha_shapes_2/CMakeLists.txt
new file mode 100644
index 0000000..2f68379
--- /dev/null
+++ b/3rdparty/CGAL/demo/Alpha_shapes_2/CMakeLists.txt
@@ -0,0 +1,50 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+project (Alpha_shapes_2_demo)
+
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+find_package(CGAL COMPONENTS Qt5)
+
+include(${CGAL_USE_FILE})
+
+find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
+include_directories (BEFORE ../../include)
+include_directories (BEFORE ./include)
+
+if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
+add_definitions(-DQT_NO_KEYWORDS)
+
+#--------------------------------
+# The "Delaunay" demo: Alpha_shapes_2
+#--------------------------------
+# UI files (Qt Designer files)
+qt5_wrap_ui( DT_UI_FILES Alpha_shapes_2.ui )
+
+# qrc files (resources files, that contain icons, at least)
+qt5_add_resources ( CGAL_Qt5_RESOURCE_FILES ./Alpha_shapes_2.qrc )
+
+# use the Qt MOC preprocessor on classes that derives from QObject
+qt5_generate_moc( Alpha_shapes_2.cpp Alpha_shapes_2.moc )
+
+# The executable itself.
+add_executable  ( Alpha_shapes_2 Alpha_shapes_2.cpp Alpha_shapes_2.moc ${DT_UI_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES})
+
+qt5_use_modules(Alpha_shapes_2 Xml Script OpenGL Svg)
+
+add_to_cached_list( CGAL_EXECUTABLE_TARGETS Alpha_shapes_2 )
+
+# Link with Qt libraries
+target_link_libraries( Alpha_shapes_2 ${QT_LIBRARIES} )
+# Link with CGAL
+target_link_libraries( Alpha_shapes_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES})
+
+else()
+
+  message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
+
+endif()
diff --git a/3rdparty/CGAL-4.8/demo/Alpha_shapes_2/about_Alpha_shapes_2.html b/3rdparty/CGAL/demo/Alpha_shapes_2/about_Alpha_shapes_2.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Alpha_shapes_2/about_Alpha_shapes_2.html
rename to 3rdparty/CGAL/demo/Alpha_shapes_2/about_Alpha_shapes_2.html
diff --git a/3rdparty/CGAL-4.8/demo/Alpha_shapes_3/Alpha_shape_3.cpp b/3rdparty/CGAL/demo/Alpha_shapes_3/Alpha_shape_3.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Alpha_shapes_3/Alpha_shape_3.cpp
rename to 3rdparty/CGAL/demo/Alpha_shapes_3/Alpha_shape_3.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Alpha_shapes_3/Alpha_shape_3.qrc b/3rdparty/CGAL/demo/Alpha_shapes_3/Alpha_shape_3.qrc
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Alpha_shapes_3/Alpha_shape_3.qrc
rename to 3rdparty/CGAL/demo/Alpha_shapes_3/Alpha_shape_3.qrc
diff --git a/3rdparty/CGAL/demo/Alpha_shapes_3/CMakeLists.txt b/3rdparty/CGAL/demo/Alpha_shapes_3/CMakeLists.txt
new file mode 100644
index 0000000..e00e28f
--- /dev/null
+++ b/3rdparty/CGAL/demo/Alpha_shapes_3/CMakeLists.txt
@@ -0,0 +1,49 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+project (Alpha_shape_3)
+# Find includes in corresponding build directories
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+# Instruct CMake to run moc automatically when needed.
+set(CMAKE_AUTOMOC ON)
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+find_package(CGAL COMPONENTS Qt5)
+include(${CGAL_USE_FILE})
+
+find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
+
+find_package(OpenGL)
+find_package(QGLViewer)
+
+if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND )
+
+  add_definitions(-DQT_NO_KEYWORDS)
+
+ # include(${QT_USE_FILE})
+
+  include_directories (${QGLVIEWER_INCLUDE_DIR})
+  include_directories (BEFORE ../../include ./ )
+
+  # ui file, created wih Qt Designer
+  qt5_wrap_ui( uis MainWindow.ui )
+
+  # qrc files (resources files, that contain icons, at least)
+  qt5_add_resources ( CGAL_Qt5_RESOURCE_FILES ./Alpha_shape_3.qrc )
+
+  add_executable  ( Alpha_shape_3 Alpha_shape_3.cpp MainWindow.cpp Viewer.cpp ${uis}  ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES})
+  qt5_use_modules(Alpha_shape_3 Xml Script OpenGL Svg)
+  add_to_cached_list( CGAL_EXECUTABLE_TARGETS Alpha_shape_3 )
+
+  target_link_libraries( Alpha_shape_3 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES})
+  target_link_libraries( Alpha_shape_3 ${QT_LIBRARIES} ${QGLVIEWER_LIBRARIES} )
+  target_link_libraries( Alpha_shape_3 ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
+
+else()
+
+  message(STATUS "NOTICE: This demo requires CGAL, the QGLViewer, OpenGL and Qt5, and will not be compiled.")
+
+endif()
diff --git a/3rdparty/CGAL-4.8/demo/Alpha_shapes_3/MainWindow.cpp b/3rdparty/CGAL/demo/Alpha_shapes_3/MainWindow.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Alpha_shapes_3/MainWindow.cpp
rename to 3rdparty/CGAL/demo/Alpha_shapes_3/MainWindow.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Alpha_shapes_3/MainWindow.h b/3rdparty/CGAL/demo/Alpha_shapes_3/MainWindow.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Alpha_shapes_3/MainWindow.h
rename to 3rdparty/CGAL/demo/Alpha_shapes_3/MainWindow.h
diff --git a/3rdparty/CGAL-4.8/demo/Alpha_shapes_3/MainWindow.ui b/3rdparty/CGAL/demo/Alpha_shapes_3/MainWindow.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Alpha_shapes_3/MainWindow.ui
rename to 3rdparty/CGAL/demo/Alpha_shapes_3/MainWindow.ui
diff --git a/3rdparty/CGAL-4.8/demo/Alpha_shapes_3/Viewer.cpp b/3rdparty/CGAL/demo/Alpha_shapes_3/Viewer.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Alpha_shapes_3/Viewer.cpp
rename to 3rdparty/CGAL/demo/Alpha_shapes_3/Viewer.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Alpha_shapes_3/Viewer.h b/3rdparty/CGAL/demo/Alpha_shapes_3/Viewer.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Alpha_shapes_3/Viewer.h
rename to 3rdparty/CGAL/demo/Alpha_shapes_3/Viewer.h
diff --git a/3rdparty/CGAL-4.8/demo/Alpha_shapes_3/about_Alpha_shapes_3.html b/3rdparty/CGAL/demo/Alpha_shapes_3/about_Alpha_shapes_3.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Alpha_shapes_3/about_Alpha_shapes_3.html
rename to 3rdparty/CGAL/demo/Alpha_shapes_3/about_Alpha_shapes_3.html
diff --git a/3rdparty/CGAL-4.8/demo/Alpha_shapes_3/typedefs.h b/3rdparty/CGAL/demo/Alpha_shapes_3/typedefs.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Alpha_shapes_3/typedefs.h
rename to 3rdparty/CGAL/demo/Alpha_shapes_3/typedefs.h
diff --git a/3rdparty/CGAL-4.8/demo/Apollonius_graph_2/Apollonius_graph_2.cpp b/3rdparty/CGAL/demo/Apollonius_graph_2/Apollonius_graph_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Apollonius_graph_2/Apollonius_graph_2.cpp
rename to 3rdparty/CGAL/demo/Apollonius_graph_2/Apollonius_graph_2.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Apollonius_graph_2/Apollonius_graph_2.qrc b/3rdparty/CGAL/demo/Apollonius_graph_2/Apollonius_graph_2.qrc
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Apollonius_graph_2/Apollonius_graph_2.qrc
rename to 3rdparty/CGAL/demo/Apollonius_graph_2/Apollonius_graph_2.qrc
diff --git a/3rdparty/CGAL-4.8/demo/Apollonius_graph_2/Apollonius_graph_2.ui b/3rdparty/CGAL/demo/Apollonius_graph_2/Apollonius_graph_2.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Apollonius_graph_2/Apollonius_graph_2.ui
rename to 3rdparty/CGAL/demo/Apollonius_graph_2/Apollonius_graph_2.ui
diff --git a/3rdparty/CGAL/demo/Apollonius_graph_2/CMakeLists.txt b/3rdparty/CGAL/demo/Apollonius_graph_2/CMakeLists.txt
new file mode 100644
index 0000000..94254e2
--- /dev/null
+++ b/3rdparty/CGAL/demo/Apollonius_graph_2/CMakeLists.txt
@@ -0,0 +1,48 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+project (Apollonius_graph_2_demo)
+
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+find_package(CGAL COMPONENTS Qt5)
+
+include(${CGAL_USE_FILE})
+
+find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
+include_directories (BEFORE ../../include)
+
+
+if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
+add_definitions(-DQT_NO_KEYWORDS)
+
+#--------------------------------
+# UI files (Qt Designer files)
+qt5_wrap_ui( DT_UI_FILES Apollonius_graph_2.ui )
+
+# qrc files (resources files, that contain icons, at least)
+qt5_add_resources ( CGAL_Qt5_RESOURCE_FILES ./Apollonius_graph_2.qrc )
+
+# use the Qt MOC preprocessor on classes that derives from QObject
+qt5_generate_moc( Apollonius_graph_2.cpp Apollonius_graph_2.moc )
+
+# The executable itself.
+add_executable  ( Apollonius_graph_2 Apollonius_graph_2.cpp Apollonius_graph_2.moc ${DT_UI_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES})
+
+qt5_use_modules(Apollonius_graph_2 Xml Script OpenGL Svg)
+
+add_to_cached_list( CGAL_EXECUTABLE_TARGETS Apollonius_graph_2 )
+
+# Link with Qt libraries
+target_link_libraries( Apollonius_graph_2 ${QT_LIBRARIES} )
+# Link with CGAL
+target_link_libraries( Apollonius_graph_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES})
+
+else()
+
+  message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
+
+endif()
diff --git a/3rdparty/CGAL-4.8/demo/Apollonius_graph_2/about_Apollonius_graph_2.html b/3rdparty/CGAL/demo/Apollonius_graph_2/about_Apollonius_graph_2.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Apollonius_graph_2/about_Apollonius_graph_2.html
rename to 3rdparty/CGAL/demo/Apollonius_graph_2/about_Apollonius_graph_2.html
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ArrangementCurveInputCallback.h b/3rdparty/CGAL/demo/Arrangement_on_surface_2/ArrangementCurveInputCallback.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ArrangementCurveInputCallback.h
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/ArrangementCurveInputCallback.h
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ArrangementDemoGraphicsView.cpp b/3rdparty/CGAL/demo/Arrangement_on_surface_2/ArrangementDemoGraphicsView.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ArrangementDemoGraphicsView.cpp
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/ArrangementDemoGraphicsView.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ArrangementDemoGraphicsView.h b/3rdparty/CGAL/demo/Arrangement_on_surface_2/ArrangementDemoGraphicsView.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ArrangementDemoGraphicsView.h
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/ArrangementDemoGraphicsView.h
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ArrangementDemoPropertiesDialog.cpp b/3rdparty/CGAL/demo/Arrangement_on_surface_2/ArrangementDemoPropertiesDialog.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ArrangementDemoPropertiesDialog.cpp
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/ArrangementDemoPropertiesDialog.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ArrangementDemoPropertiesDialog.h b/3rdparty/CGAL/demo/Arrangement_on_surface_2/ArrangementDemoPropertiesDialog.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ArrangementDemoPropertiesDialog.h
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/ArrangementDemoPropertiesDialog.h
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ArrangementDemoPropertiesDialog.ui b/3rdparty/CGAL/demo/Arrangement_on_surface_2/ArrangementDemoPropertiesDialog.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ArrangementDemoPropertiesDialog.ui
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/ArrangementDemoPropertiesDialog.ui
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ArrangementDemoTab.cpp b/3rdparty/CGAL/demo/Arrangement_on_surface_2/ArrangementDemoTab.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ArrangementDemoTab.cpp
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/ArrangementDemoTab.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ArrangementDemoTab.h b/3rdparty/CGAL/demo/Arrangement_on_surface_2/ArrangementDemoTab.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ArrangementDemoTab.h
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/ArrangementDemoTab.h
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ArrangementDemoWindow.cpp b/3rdparty/CGAL/demo/Arrangement_on_surface_2/ArrangementDemoWindow.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ArrangementDemoWindow.cpp
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/ArrangementDemoWindow.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ArrangementDemoWindow.h b/3rdparty/CGAL/demo/Arrangement_on_surface_2/ArrangementDemoWindow.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ArrangementDemoWindow.h
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/ArrangementDemoWindow.h
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ArrangementDemoWindow.qrc b/3rdparty/CGAL/demo/Arrangement_on_surface_2/ArrangementDemoWindow.qrc
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ArrangementDemoWindow.qrc
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/ArrangementDemoWindow.qrc
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ArrangementDemoWindow.ui b/3rdparty/CGAL/demo/Arrangement_on_surface_2/ArrangementDemoWindow.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ArrangementDemoWindow.ui
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/ArrangementDemoWindow.ui
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ArrangementGraphicsItem.cpp b/3rdparty/CGAL/demo/Arrangement_on_surface_2/ArrangementGraphicsItem.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ArrangementGraphicsItem.cpp
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/ArrangementGraphicsItem.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ArrangementGraphicsItem.h b/3rdparty/CGAL/demo/Arrangement_on_surface_2/ArrangementGraphicsItem.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ArrangementGraphicsItem.h
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/ArrangementGraphicsItem.h
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ArrangementPainterOstream.h b/3rdparty/CGAL/demo/Arrangement_on_surface_2/ArrangementPainterOstream.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ArrangementPainterOstream.h
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/ArrangementPainterOstream.h
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ArrangementSegmentInputCallback.h b/3rdparty/CGAL/demo/Arrangement_on_surface_2/ArrangementSegmentInputCallback.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ArrangementSegmentInputCallback.h
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/ArrangementSegmentInputCallback.h
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ArrangementTypes.h b/3rdparty/CGAL/demo/Arrangement_on_surface_2/ArrangementTypes.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ArrangementTypes.h
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/ArrangementTypes.h
diff --git a/3rdparty/CGAL/demo/Arrangement_on_surface_2/CMakeLists.txt b/3rdparty/CGAL/demo/Arrangement_on_surface_2/CMakeLists.txt
new file mode 100644
index 0000000..ee6a26b
--- /dev/null
+++ b/3rdparty/CGAL/demo/Arrangement_on_surface_2/CMakeLists.txt
@@ -0,0 +1,83 @@
+# This is the CMake script for compiling a CGAL application.
+
+project( Arrangement_2 ) 
+
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+find_package(CGAL COMPONENTS Core Qt5 )
+include( ${CGAL_USE_FILE} )
+
+find_package( Qt5 QUIET COMPONENTS Script Widgets )
+
+if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND CGAL_Core_FOUND)
+  include_directories( ./ )
+  # Arrangement package includes
+  include_directories( BEFORE ../../include )
+
+  qt5_wrap_ui( arrangement_2_uis
+    ArrangementDemoWindow.ui
+    NewTabDialog.ui
+    OverlayDialog.ui
+    ArrangementDemoPropertiesDialog.ui
+  )
+  qt5_wrap_cpp( CGAL_Qt5_MOC_FILES
+    ArrangementDemoWindow.h
+    ArrangementDemoTab.h
+    Callback.h
+#    NewTabDialog.h
+    OverlayDialog.h
+    ArrangementDemoPropertiesDialog.h
+    ColorItemEditor.h
+    DeleteCurveModeItemEditor.h
+    PropertyValueDelegate.h
+    #PropertyValueDelegate.cpp
+  )
+  qt5_add_resources( CGAL_Qt5_RESOURCE_FILES
+    ArrangementDemoWindow.qrc
+  )
+  add_executable( arrangement_2
+    arrangement_2.cpp
+    ArrangementGraphicsItem.cpp
+    ArrangementDemoWindow.cpp
+    ArrangementDemoTab.cpp
+    ArrangementDemoGraphicsView.cpp
+    Callback.cpp
+    VerticalRayShootCallback.cpp
+    EnvelopeCallback.cpp
+    SplitEdgeCallback.cpp
+    FillFaceCallback.cpp
+    GraphicsViewSegmentInput.cpp
+    GraphicsViewCurveInput.cpp
+    Utils.cpp
+    NewTabDialog.cpp
+    OverlayDialog.cpp
+    ArrangementDemoPropertiesDialog.cpp
+    ColorItemEditor.cpp
+    PropertyValueDelegate.cpp
+    DeleteCurveMode.cpp
+    DeleteCurveModeItemEditor.cpp
+    PointsGraphicsItem.cpp
+    VerticalRayGraphicsItem.cpp
+   ${CGAL_Qt5_MOC_FILES}
+   ${arrangement_2_uis}
+   ${CGAL_Qt5_RESOURCE_FILES}
+  )
+  qt5_use_modules(arrangement_2 Widgets Script)
+  target_link_libraries( arrangement_2
+    ${CGAL_LIBRARIES}
+    ${CGAL_3RD_PARTY_LIBRARIES}
+    ${QT_LIBRARIES}
+  )
+
+  add_to_cached_list( CGAL_EXECUTABLE_TARGETS arrangement_2 )
+
+else()
+
+  message(STATUS "NOTICE: This demo requires CGAL, CGAL-Core and Qt5, and will not be compiled.")
+
+endif()
+
+# add_subdirectory( tests )
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/Callback.cpp b/3rdparty/CGAL/demo/Arrangement_on_surface_2/Callback.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/Callback.cpp
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/Callback.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/Callback.h b/3rdparty/CGAL/demo/Arrangement_on_surface_2/Callback.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/Callback.h
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/Callback.h
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ColorItemEditor.cpp b/3rdparty/CGAL/demo/Arrangement_on_surface_2/ColorItemEditor.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ColorItemEditor.cpp
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/ColorItemEditor.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ColorItemEditor.h b/3rdparty/CGAL/demo/Arrangement_on_surface_2/ColorItemEditor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ColorItemEditor.h
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/ColorItemEditor.h
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/Conic_reader.h b/3rdparty/CGAL/demo/Arrangement_on_surface_2/Conic_reader.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/Conic_reader.h
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/Conic_reader.h
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/CurveGraphicsItem.h b/3rdparty/CGAL/demo/Arrangement_on_surface_2/CurveGraphicsItem.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/CurveGraphicsItem.h
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/CurveGraphicsItem.h
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/DeleteCurveCallback.h b/3rdparty/CGAL/demo/Arrangement_on_surface_2/DeleteCurveCallback.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/DeleteCurveCallback.h
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/DeleteCurveCallback.h
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/DeleteCurveMode.cpp b/3rdparty/CGAL/demo/Arrangement_on_surface_2/DeleteCurveMode.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/DeleteCurveMode.cpp
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/DeleteCurveMode.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/DeleteCurveMode.h b/3rdparty/CGAL/demo/Arrangement_on_surface_2/DeleteCurveMode.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/DeleteCurveMode.h
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/DeleteCurveMode.h
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/DeleteCurveModeItemEditor.cpp b/3rdparty/CGAL/demo/Arrangement_on_surface_2/DeleteCurveModeItemEditor.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/DeleteCurveModeItemEditor.cpp
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/DeleteCurveModeItemEditor.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/DeleteCurveModeItemEditor.h b/3rdparty/CGAL/demo/Arrangement_on_surface_2/DeleteCurveModeItemEditor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/DeleteCurveModeItemEditor.h
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/DeleteCurveModeItemEditor.h
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/EnvelopeCallback.cpp b/3rdparty/CGAL/demo/Arrangement_on_surface_2/EnvelopeCallback.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/EnvelopeCallback.cpp
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/EnvelopeCallback.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/EnvelopeCallback.h b/3rdparty/CGAL/demo/Arrangement_on_surface_2/EnvelopeCallback.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/EnvelopeCallback.h
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/EnvelopeCallback.h
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/FillFaceCallback.cpp b/3rdparty/CGAL/demo/Arrangement_on_surface_2/FillFaceCallback.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/FillFaceCallback.cpp
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/FillFaceCallback.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/FillFaceCallback.h b/3rdparty/CGAL/demo/Arrangement_on_surface_2/FillFaceCallback.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/FillFaceCallback.h
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/FillFaceCallback.h
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/GraphicsViewCurveInput.cpp b/3rdparty/CGAL/demo/Arrangement_on_surface_2/GraphicsViewCurveInput.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/GraphicsViewCurveInput.cpp
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/GraphicsViewCurveInput.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/GraphicsViewCurveInput.h b/3rdparty/CGAL/demo/Arrangement_on_surface_2/GraphicsViewCurveInput.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/GraphicsViewCurveInput.h
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/GraphicsViewCurveInput.h
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/GraphicsViewSegmentInput.cpp b/3rdparty/CGAL/demo/Arrangement_on_surface_2/GraphicsViewSegmentInput.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/GraphicsViewSegmentInput.cpp
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/GraphicsViewSegmentInput.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/GraphicsViewSegmentInput.h b/3rdparty/CGAL/demo/Arrangement_on_surface_2/GraphicsViewSegmentInput.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/GraphicsViewSegmentInput.h
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/GraphicsViewSegmentInput.h
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ISnappable.h b/3rdparty/CGAL/demo/Arrangement_on_surface_2/ISnappable.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/ISnappable.h
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/ISnappable.h
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/MergeEdgeCallback.h b/3rdparty/CGAL/demo/Arrangement_on_surface_2/MergeEdgeCallback.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/MergeEdgeCallback.h
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/MergeEdgeCallback.h
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/NewTabDialog.cpp b/3rdparty/CGAL/demo/Arrangement_on_surface_2/NewTabDialog.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/NewTabDialog.cpp
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/NewTabDialog.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/NewTabDialog.h b/3rdparty/CGAL/demo/Arrangement_on_surface_2/NewTabDialog.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/NewTabDialog.h
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/NewTabDialog.h
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/NewTabDialog.ui b/3rdparty/CGAL/demo/Arrangement_on_surface_2/NewTabDialog.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/NewTabDialog.ui
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/NewTabDialog.ui
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/OverlayDialog.cpp b/3rdparty/CGAL/demo/Arrangement_on_surface_2/OverlayDialog.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/OverlayDialog.cpp
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/OverlayDialog.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/OverlayDialog.h b/3rdparty/CGAL/demo/Arrangement_on_surface_2/OverlayDialog.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/OverlayDialog.h
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/OverlayDialog.h
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/OverlayDialog.ui b/3rdparty/CGAL/demo/Arrangement_on_surface_2/OverlayDialog.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/OverlayDialog.ui
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/OverlayDialog.ui
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/PointLocationCallback.h b/3rdparty/CGAL/demo/Arrangement_on_surface_2/PointLocationCallback.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/PointLocationCallback.h
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/PointLocationCallback.h
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/PointsGraphicsItem.cpp b/3rdparty/CGAL/demo/Arrangement_on_surface_2/PointsGraphicsItem.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/PointsGraphicsItem.cpp
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/PointsGraphicsItem.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/PointsGraphicsItem.h b/3rdparty/CGAL/demo/Arrangement_on_surface_2/PointsGraphicsItem.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/PointsGraphicsItem.h
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/PointsGraphicsItem.h
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/PropertyValueDelegate.cpp b/3rdparty/CGAL/demo/Arrangement_on_surface_2/PropertyValueDelegate.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/PropertyValueDelegate.cpp
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/PropertyValueDelegate.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/PropertyValueDelegate.h b/3rdparty/CGAL/demo/Arrangement_on_surface_2/PropertyValueDelegate.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/PropertyValueDelegate.h
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/PropertyValueDelegate.h
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/SplitEdgeCallback.cpp b/3rdparty/CGAL/demo/Arrangement_on_surface_2/SplitEdgeCallback.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/SplitEdgeCallback.cpp
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/SplitEdgeCallback.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/SplitEdgeCallback.h b/3rdparty/CGAL/demo/Arrangement_on_surface_2/SplitEdgeCallback.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/SplitEdgeCallback.h
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/SplitEdgeCallback.h
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/Utils.cpp b/3rdparty/CGAL/demo/Arrangement_on_surface_2/Utils.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/Utils.cpp
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/Utils.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/Utils.h b/3rdparty/CGAL/demo/Arrangement_on_surface_2/Utils.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/Utils.h
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/Utils.h
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/VerticalRayGraphicsItem.cpp b/3rdparty/CGAL/demo/Arrangement_on_surface_2/VerticalRayGraphicsItem.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/VerticalRayGraphicsItem.cpp
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/VerticalRayGraphicsItem.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/VerticalRayGraphicsItem.h b/3rdparty/CGAL/demo/Arrangement_on_surface_2/VerticalRayGraphicsItem.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/VerticalRayGraphicsItem.h
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/VerticalRayGraphicsItem.h
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/VerticalRayShootCallback.cpp b/3rdparty/CGAL/demo/Arrangement_on_surface_2/VerticalRayShootCallback.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/VerticalRayShootCallback.cpp
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/VerticalRayShootCallback.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/VerticalRayShootCallback.h b/3rdparty/CGAL/demo/Arrangement_on_surface_2/VerticalRayShootCallback.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/VerticalRayShootCallback.h
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/VerticalRayShootCallback.h
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/arrangement_2.cpp b/3rdparty/CGAL/demo/Arrangement_on_surface_2/arrangement_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/arrangement_2.cpp
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/arrangement_2.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/algebraic/alg_circle.arr b/3rdparty/CGAL/demo/Arrangement_on_surface_2/data/algebraic/alg_circle.arr
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/algebraic/alg_circle.arr
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/data/algebraic/alg_circle.arr
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/algebraic/cubic.arr b/3rdparty/CGAL/demo/Arrangement_on_surface_2/data/algebraic/cubic.arr
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/algebraic/cubic.arr
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/data/algebraic/cubic.arr
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/algebraic/erdos_lemiscate.arr b/3rdparty/CGAL/demo/Arrangement_on_surface_2/data/algebraic/erdos_lemiscate.arr
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/algebraic/erdos_lemiscate.arr
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/data/algebraic/erdos_lemiscate.arr
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/algebraic/infinitesimal.arr b/3rdparty/CGAL/demo/Arrangement_on_surface_2/data/algebraic/infinitesimal.arr
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/algebraic/infinitesimal.arr
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/data/algebraic/infinitesimal.arr
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/algebraic/trifolium.arr b/3rdparty/CGAL/demo/Arrangement_on_surface_2/data/algebraic/trifolium.arr
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/algebraic/trifolium.arr
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/data/algebraic/trifolium.arr
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/conic/big_circ_arcs.arr b/3rdparty/CGAL/demo/Arrangement_on_surface_2/data/conic/big_circ_arcs.arr
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/conic/big_circ_arcs.arr
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/data/conic/big_circ_arcs.arr
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/conic/big_circ_arcs.dat b/3rdparty/CGAL/demo/Arrangement_on_surface_2/data/conic/big_circ_arcs.dat
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/conic/big_circ_arcs.dat
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/data/conic/big_circ_arcs.dat
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/conic/circles_21.dat b/3rdparty/CGAL/demo/Arrangement_on_surface_2/data/conic/circles_21.dat
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/conic/circles_21.dat
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/data/conic/circles_21.dat
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/polyline/ps_circs.dat b/3rdparty/CGAL/demo/Arrangement_on_surface_2/data/polyline/ps_circs.dat
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/polyline/ps_circs.dat
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/data/polyline/ps_circs.dat
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/polyline/random_polylines_10_20.dat b/3rdparty/CGAL/demo/Arrangement_on_surface_2/data/polyline/random_polylines_10_20.dat
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/polyline/random_polylines_10_20.dat
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/data/polyline/random_polylines_10_20.dat
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/polyline/sines.dat b/3rdparty/CGAL/demo/Arrangement_on_surface_2/data/polyline/sines.dat
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/polyline/sines.dat
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/data/polyline/sines.dat
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/segment/fork0505_mc.seg.rand.dat b/3rdparty/CGAL/demo/Arrangement_on_surface_2/data/segment/fork0505_mc.seg.rand.dat
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/segment/fork0505_mc.seg.rand.dat
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/data/segment/fork0505_mc.seg.rand.dat
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/segment/non_degenerate_100_x.dat b/3rdparty/CGAL/demo/Arrangement_on_surface_2/data/segment/non_degenerate_100_x.dat
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/segment/non_degenerate_100_x.dat
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/data/segment/non_degenerate_100_x.dat
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/segment/onebig_100.dat b/3rdparty/CGAL/demo/Arrangement_on_surface_2/data/segment/onebig_100.dat
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/segment/onebig_100.dat
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/data/segment/onebig_100.dat
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/segment/onebig_100_x.dat b/3rdparty/CGAL/demo/Arrangement_on_surface_2/data/segment/onebig_100_x.dat
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/segment/onebig_100_x.dat
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/data/segment/onebig_100_x.dat
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/segment/onebig_250_x.dat b/3rdparty/CGAL/demo/Arrangement_on_surface_2/data/segment/onebig_250_x.dat
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/segment/onebig_250_x.dat
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/data/segment/onebig_250_x.dat
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/segment/polygon_100.dat b/3rdparty/CGAL/demo/Arrangement_on_surface_2/data/segment/polygon_100.dat
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/segment/polygon_100.dat
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/data/segment/polygon_100.dat
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/segment/random_segments_100.dat b/3rdparty/CGAL/demo/Arrangement_on_surface_2/data/segment/random_segments_100.dat
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/segment/random_segments_100.dat
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/data/segment/random_segments_100.dat
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/segment/random_segments_100_x.dat b/3rdparty/CGAL/demo/Arrangement_on_surface_2/data/segment/random_segments_100_x.dat
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/segment/random_segments_100_x.dat
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/data/segment/random_segments_100_x.dat
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/segment/random_segments_500_x.dat b/3rdparty/CGAL/demo/Arrangement_on_surface_2/data/segment/random_segments_500_x.dat
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/segment/random_segments_500_x.dat
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/data/segment/random_segments_500_x.dat
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/segment/tilt_grid_200.dat b/3rdparty/CGAL/demo/Arrangement_on_surface_2/data/segment/tilt_grid_200.dat
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/segment/tilt_grid_200.dat
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/data/segment/tilt_grid_200.dat
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/segment/world.seg.cut.rand.dat b/3rdparty/CGAL/demo/Arrangement_on_surface_2/data/segment/world.seg.cut.rand.dat
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/data/segment/world.seg.cut.rand.dat
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/data/segment/world.seg.cut.rand.dat
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/help/about.html b/3rdparty/CGAL/demo/Arrangement_on_surface_2/help/about.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/help/about.html
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/help/about.html
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/help/index.html b/3rdparty/CGAL/demo/Arrangement_on_surface_2/help/index.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/help/index.html
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/help/index.html
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/blue_icon.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/blue_icon.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/blue_icon.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/blue_icon.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/conic.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/conic.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/conic.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/conic.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/conic_types.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/conic_types.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/conic_types.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/conic_types.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/delete.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/delete.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/delete.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/delete.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_arrow_down.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_arrow_down.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_arrow_down.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_arrow_down.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_arrow_up.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_arrow_up.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_arrow_up.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_arrow_up.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_colors.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_colors.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_colors.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_colors.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_conic_3points.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_conic_3points.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_conic_3points.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_conic_3points.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_conic_5points.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_conic_5points.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_conic_5points.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_conic_5points.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_conic_circle.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_conic_circle.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_conic_circle.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_conic_circle.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_conic_ellipse.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_conic_ellipse.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_conic_ellipse.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_conic_ellipse.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_conic_line.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_conic_line.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_conic_line.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_conic_line.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_conic_ray.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_conic_ray.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_conic_ray.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_conic_ray.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_conic_segment.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_conic_segment.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_conic_segment.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_conic_segment.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_delete.bmp b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_delete.bmp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_delete.bmp
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_delete.bmp
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_delete.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_delete.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_delete.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_delete.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_fill.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_fill.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_fill.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_fill.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_insert.bmp b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_insert.bmp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_insert.bmp
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_insert.bmp
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_insert.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_insert.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_insert.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_insert.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_merge.bmp b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_merge.bmp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_merge.bmp
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_merge.bmp
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_merge.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_merge.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_merge.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_merge.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_pointlocation.bmp b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_pointlocation.bmp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_pointlocation.bmp
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_pointlocation.bmp
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_pointlocation.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_pointlocation.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_pointlocation.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_pointlocation.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_rayshoot.bmp b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_rayshoot.bmp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_rayshoot.bmp
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_rayshoot.bmp
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_rayshoot.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_rayshoot.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_rayshoot.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_rayshoot.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_rayshoot_down.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_rayshoot_down.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_rayshoot_down.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_rayshoot_down.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_rayshoot_up.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_rayshoot_up.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_rayshoot_up.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_rayshoot_up.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_snapgrid.bmp b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_snapgrid.bmp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_snapgrid.bmp
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_snapgrid.bmp
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_snapgrid.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_snapgrid.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_snapgrid.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_snapgrid.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_snapvertex.bmp b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_snapvertex.bmp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_snapvertex.bmp
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_snapvertex.bmp
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_snapvertex.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_snapvertex.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_snapvertex.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_snapvertex.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_split.bmp b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_split.bmp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_split.bmp
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_split.bmp
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_split.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_split.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_split.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_split.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_zoomin.bmp b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_zoomin.bmp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_zoomin.bmp
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_zoomin.bmp
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_zoomin.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_zoomin.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_zoomin.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_zoomin.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_zoomout.bmp b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_zoomout.bmp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_zoomout.bmp
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_zoomout.bmp
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_zoomout.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_zoomout.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/demo_zoomout.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/demo_zoomout.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/draw.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/draw.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/draw.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/draw.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/green_icon.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/green_icon.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/green_icon.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/green_icon.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/grid.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/grid.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/grid.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/grid.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/hand.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/hand.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/hand.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/hand.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/insert.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/insert.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/insert.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/insert.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/lower_env_xpm.bmp b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/lower_env_xpm.bmp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/lower_env_xpm.bmp
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/lower_env_xpm.bmp
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/lower_env_xpm.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/lower_env_xpm.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/lower_env_xpm.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/lower_env_xpm.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/merge.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/merge.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/merge.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/merge.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/none.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/none.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/none.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/none.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/po.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/po.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/po.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/po.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/points.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/points.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/points.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/points.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/polyline.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/polyline.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/polyline.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/polyline.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/ray_shooting.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/ray_shooting.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/ray_shooting.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/ray_shooting.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/ray_shooting2.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/ray_shooting2.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/ray_shooting2.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/ray_shooting2.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/red_icon.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/red_icon.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/red_icon.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/red_icon.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/snap.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/snap.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/snap.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/snap.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/split.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/split.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/split.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/split.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/upper_env_xpm.bmp b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/upper_env_xpm.bmp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/upper_env_xpm.bmp
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/upper_env_xpm.bmp
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/upper_env_xpm.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/upper_env_xpm.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/upper_env_xpm.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/upper_env_xpm.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/voronoi.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/voronoi.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/voronoi.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/voronoi.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/yellow_icon.xpm b/3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/yellow_icon.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/icons/yellow_icon.xpm
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/icons/yellow_icon.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/tests/CMakeLists.txt b/3rdparty/CGAL/demo/Arrangement_on_surface_2/tests/CMakeLists.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/tests/CMakeLists.txt
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/tests/CMakeLists.txt
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/tests/Test.cpp b/3rdparty/CGAL/demo/Arrangement_on_surface_2/tests/Test.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/tests/Test.cpp
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/tests/Test.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/tests/TestAlgebraic.cpp b/3rdparty/CGAL/demo/Arrangement_on_surface_2/tests/TestAlgebraic.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/tests/TestAlgebraic.cpp
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/tests/TestAlgebraic.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/tests/TestRayPL.cpp b/3rdparty/CGAL/demo/Arrangement_on_surface_2/tests/TestRayPL.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Arrangement_on_surface_2/tests/TestRayPL.cpp
rename to 3rdparty/CGAL/demo/Arrangement_on_surface_2/tests/TestRayPL.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Bounding_volumes/Bounding_volumes.cpp b/3rdparty/CGAL/demo/Bounding_volumes/Bounding_volumes.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Bounding_volumes/Bounding_volumes.cpp
rename to 3rdparty/CGAL/demo/Bounding_volumes/Bounding_volumes.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Bounding_volumes/Bounding_volumes.qrc b/3rdparty/CGAL/demo/Bounding_volumes/Bounding_volumes.qrc
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Bounding_volumes/Bounding_volumes.qrc
rename to 3rdparty/CGAL/demo/Bounding_volumes/Bounding_volumes.qrc
diff --git a/3rdparty/CGAL-4.8/demo/Bounding_volumes/Bounding_volumes.ui b/3rdparty/CGAL/demo/Bounding_volumes/Bounding_volumes.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Bounding_volumes/Bounding_volumes.ui
rename to 3rdparty/CGAL/demo/Bounding_volumes/Bounding_volumes.ui
diff --git a/3rdparty/CGAL/demo/Bounding_volumes/CMakeLists.txt b/3rdparty/CGAL/demo/Bounding_volumes/CMakeLists.txt
new file mode 100644
index 0000000..ee7fa78
--- /dev/null
+++ b/3rdparty/CGAL/demo/Bounding_volumes/CMakeLists.txt
@@ -0,0 +1,53 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+project (Bounding_volumes)
+
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+find_package(CGAL COMPONENTS Qt5)
+
+include(${CGAL_USE_FILE})
+
+find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
+include_directories (BEFORE ../../include)
+include_directories (BEFORE ./include)
+include_directories (BEFORE ../../../Matrix_search/include)
+
+
+if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
+
+add_definitions(-DQT_NO_KEYWORDS)
+
+#----------------------------------------------
+# The "Bounding volumes" demo: Bounding_volumes
+#----------------------------------------------
+# UI files (Qt Designer files)
+qt5_wrap_ui( DT_UI_FILES Bounding_volumes.ui )
+
+# qrc files (resources files, that contain icons, at least)
+qt5_add_resources ( CGAL_Qt5_RESOURCE_FILES ./Bounding_volumes.qrc )
+
+# use the Qt MOC preprocessor on classes that derives from QObject
+qt5_generate_moc( "Bounding_volumes.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Bounding_volumes.moc" )
+
+# The executable itself.
+add_executable  ( Bounding_volumes Bounding_volumes.cpp Bounding_volumes.moc ${DT_UI_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES})
+
+qt5_use_modules(Bounding_volumes Xml Script OpenGL Svg)
+
+add_to_cached_list( CGAL_EXECUTABLE_TARGETS Bounding_volumes )
+
+# Link with Qt libraries
+target_link_libraries( Bounding_volumes ${QT_LIBRARIES} )
+# Link with CGAL
+target_link_libraries( Bounding_volumes ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES})
+
+else()
+
+  message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
+
+endif()
diff --git a/3rdparty/CGAL-4.8/demo/Bounding_volumes/Ellipse.h b/3rdparty/CGAL/demo/Bounding_volumes/Ellipse.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Bounding_volumes/Ellipse.h
rename to 3rdparty/CGAL/demo/Bounding_volumes/Ellipse.h
diff --git a/3rdparty/CGAL-4.8/demo/Bounding_volumes/about_Bounding_volumes.html b/3rdparty/CGAL/demo/Bounding_volumes/about_Bounding_volumes.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Bounding_volumes/about_Bounding_volumes.html
rename to 3rdparty/CGAL/demo/Bounding_volumes/about_Bounding_volumes.html
diff --git a/3rdparty/CGAL-4.8/demo/Bounding_volumes/icons/convex_hull.png b/3rdparty/CGAL/demo/Bounding_volumes/icons/convex_hull.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Bounding_volumes/icons/convex_hull.png
rename to 3rdparty/CGAL/demo/Bounding_volumes/icons/convex_hull.png
diff --git a/3rdparty/CGAL-4.8/demo/Bounding_volumes/icons/min_circle.pdf b/3rdparty/CGAL/demo/Bounding_volumes/icons/min_circle.pdf
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Bounding_volumes/icons/min_circle.pdf
rename to 3rdparty/CGAL/demo/Bounding_volumes/icons/min_circle.pdf
diff --git a/3rdparty/CGAL-4.8/demo/Bounding_volumes/icons/min_circle.png b/3rdparty/CGAL/demo/Bounding_volumes/icons/min_circle.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Bounding_volumes/icons/min_circle.png
rename to 3rdparty/CGAL/demo/Bounding_volumes/icons/min_circle.png
diff --git a/3rdparty/CGAL-4.8/demo/Bounding_volumes/icons/min_ellipse.png b/3rdparty/CGAL/demo/Bounding_volumes/icons/min_ellipse.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Bounding_volumes/icons/min_ellipse.png
rename to 3rdparty/CGAL/demo/Bounding_volumes/icons/min_ellipse.png
diff --git a/3rdparty/CGAL-4.8/demo/Bounding_volumes/icons/min_parallelogram.png b/3rdparty/CGAL/demo/Bounding_volumes/icons/min_parallelogram.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Bounding_volumes/icons/min_parallelogram.png
rename to 3rdparty/CGAL/demo/Bounding_volumes/icons/min_parallelogram.png
diff --git a/3rdparty/CGAL-4.8/demo/Bounding_volumes/icons/min_quadrilateral.png b/3rdparty/CGAL/demo/Bounding_volumes/icons/min_quadrilateral.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Bounding_volumes/icons/min_quadrilateral.png
rename to 3rdparty/CGAL/demo/Bounding_volumes/icons/min_quadrilateral.png
diff --git a/3rdparty/CGAL-4.8/demo/Bounding_volumes/icons/p_center.png b/3rdparty/CGAL/demo/Bounding_volumes/icons/p_center.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Bounding_volumes/icons/p_center.png
rename to 3rdparty/CGAL/demo/Bounding_volumes/icons/p_center.png
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/CMakeLists.txt b/3rdparty/CGAL/demo/CGAL_ipelets/CMakeLists.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/CMakeLists.txt
rename to 3rdparty/CGAL/demo/CGAL_ipelets/CMakeLists.txt
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/alpha_shapes.cpp b/3rdparty/CGAL/demo/CGAL_ipelets/alpha_shapes.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/alpha_shapes.cpp
rename to 3rdparty/CGAL/demo/CGAL_ipelets/alpha_shapes.cpp
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/arrangement.cpp b/3rdparty/CGAL/demo/CGAL_ipelets/arrangement.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/arrangement.cpp
rename to 3rdparty/CGAL/demo/CGAL_ipelets/arrangement.cpp
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/bbox_restriction.cpp b/3rdparty/CGAL/demo/CGAL_ipelets/bbox_restriction.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/bbox_restriction.cpp
rename to 3rdparty/CGAL/demo/CGAL_ipelets/bbox_restriction.cpp
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/circle_pencils.cpp b/3rdparty/CGAL/demo/CGAL_ipelets/circle_pencils.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/circle_pencils.cpp
rename to 3rdparty/CGAL/demo/CGAL_ipelets/circle_pencils.cpp
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/diagrams.cpp b/3rdparty/CGAL/demo/CGAL_ipelets/diagrams.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/diagrams.cpp
rename to 3rdparty/CGAL/demo/CGAL_ipelets/diagrams.cpp
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/distance.cpp b/3rdparty/CGAL/demo/CGAL_ipelets/distance.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/distance.cpp
rename to 3rdparty/CGAL/demo/CGAL_ipelets/distance.cpp
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/generator.cpp b/3rdparty/CGAL/demo/CGAL_ipelets/generator.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/generator.cpp
rename to 3rdparty/CGAL/demo/CGAL_ipelets/generator.cpp
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/hilbert_sort.cpp b/3rdparty/CGAL/demo/CGAL_ipelets/hilbert_sort.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/hilbert_sort.cpp
rename to 3rdparty/CGAL/demo/CGAL_ipelets/hilbert_sort.cpp
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/hull.cpp b/3rdparty/CGAL/demo/CGAL_ipelets/hull.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/hull.cpp
rename to 3rdparty/CGAL/demo/CGAL_ipelets/hull.cpp
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/hyperbolic.cpp b/3rdparty/CGAL/demo/CGAL_ipelets/hyperbolic.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/hyperbolic.cpp
rename to 3rdparty/CGAL/demo/CGAL_ipelets/hyperbolic.cpp
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/include/CGAL_ipelets/k_delaunay.h b/3rdparty/CGAL/demo/CGAL_ipelets/include/CGAL_ipelets/k_delaunay.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/include/CGAL_ipelets/k_delaunay.h
rename to 3rdparty/CGAL/demo/CGAL_ipelets/include/CGAL_ipelets/k_delaunay.h
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/include/CGAL_ipelets/pencils.h b/3rdparty/CGAL/demo/CGAL_ipelets/include/CGAL_ipelets/pencils.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/include/CGAL_ipelets/pencils.h
rename to 3rdparty/CGAL/demo/CGAL_ipelets/include/CGAL_ipelets/pencils.h
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_alpha_shapes.lua b/3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_alpha_shapes.lua
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_alpha_shapes.lua
rename to 3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_alpha_shapes.lua
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_arrangement.lua b/3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_arrangement.lua
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_arrangement.lua
rename to 3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_arrangement.lua
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_bbox_restriction.lua b/3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_bbox_restriction.lua
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_bbox_restriction.lua
rename to 3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_bbox_restriction.lua
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_circle_pencils.lua b/3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_circle_pencils.lua
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_circle_pencils.lua
rename to 3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_circle_pencils.lua
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_diagrams.lua b/3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_diagrams.lua
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_diagrams.lua
rename to 3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_diagrams.lua
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_distance.lua b/3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_distance.lua
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_distance.lua
rename to 3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_distance.lua
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_generator.lua b/3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_generator.lua
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_generator.lua
rename to 3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_generator.lua
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_hilbert_sort.lua b/3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_hilbert_sort.lua
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_hilbert_sort.lua
rename to 3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_hilbert_sort.lua
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_hull.lua b/3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_hull.lua
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_hull.lua
rename to 3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_hull.lua
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_hyperbolic.lua b/3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_hyperbolic.lua
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_hyperbolic.lua
rename to 3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_hyperbolic.lua
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_mesh_2.lua b/3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_mesh_2.lua
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_mesh_2.lua
rename to 3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_mesh_2.lua
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_minkowski.lua b/3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_minkowski.lua
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_minkowski.lua
rename to 3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_minkowski.lua
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_multi_delaunay.lua b/3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_multi_delaunay.lua
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_multi_delaunay.lua
rename to 3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_multi_delaunay.lua
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_multi_regular.lua b/3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_multi_regular.lua
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_multi_regular.lua
rename to 3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_multi_regular.lua
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_partition.lua b/3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_partition.lua
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_partition.lua
rename to 3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_partition.lua
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_pca.lua b/3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_pca.lua
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_pca.lua
rename to 3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_pca.lua
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_simple_triangulation.lua b/3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_simple_triangulation.lua
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_simple_triangulation.lua
rename to 3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_simple_triangulation.lua
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_skeleton.lua b/3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_skeleton.lua
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_skeleton.lua
rename to 3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_skeleton.lua
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_svdlinf.lua b/3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_svdlinf.lua
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_svdlinf.lua
rename to 3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_svdlinf.lua
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_triangulation.lua b/3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_triangulation.lua
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/lua/libCGAL_triangulation.lua
rename to 3rdparty/CGAL/demo/CGAL_ipelets/lua/libCGAL_triangulation.lua
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/mesh_2.cpp b/3rdparty/CGAL/demo/CGAL_ipelets/mesh_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/mesh_2.cpp
rename to 3rdparty/CGAL/demo/CGAL_ipelets/mesh_2.cpp
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/minkowski.cpp b/3rdparty/CGAL/demo/CGAL_ipelets/minkowski.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/minkowski.cpp
rename to 3rdparty/CGAL/demo/CGAL_ipelets/minkowski.cpp
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/multi_delaunay.cpp b/3rdparty/CGAL/demo/CGAL_ipelets/multi_delaunay.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/multi_delaunay.cpp
rename to 3rdparty/CGAL/demo/CGAL_ipelets/multi_delaunay.cpp
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/multi_regular.cpp b/3rdparty/CGAL/demo/CGAL_ipelets/multi_regular.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/multi_regular.cpp
rename to 3rdparty/CGAL/demo/CGAL_ipelets/multi_regular.cpp
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/partition.cpp b/3rdparty/CGAL/demo/CGAL_ipelets/partition.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/partition.cpp
rename to 3rdparty/CGAL/demo/CGAL_ipelets/partition.cpp
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/pca.cpp b/3rdparty/CGAL/demo/CGAL_ipelets/pca.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/pca.cpp
rename to 3rdparty/CGAL/demo/CGAL_ipelets/pca.cpp
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/simple_triangulation.cpp b/3rdparty/CGAL/demo/CGAL_ipelets/simple_triangulation.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/simple_triangulation.cpp
rename to 3rdparty/CGAL/demo/CGAL_ipelets/simple_triangulation.cpp
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/skeleton.cpp b/3rdparty/CGAL/demo/CGAL_ipelets/skeleton.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/skeleton.cpp
rename to 3rdparty/CGAL/demo/CGAL_ipelets/skeleton.cpp
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/svdlinf.cpp b/3rdparty/CGAL/demo/CGAL_ipelets/svdlinf.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/svdlinf.cpp
rename to 3rdparty/CGAL/demo/CGAL_ipelets/svdlinf.cpp
diff --git a/3rdparty/CGAL-4.8/demo/CGAL_ipelets/triangulation.cpp b/3rdparty/CGAL/demo/CGAL_ipelets/triangulation.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CGAL_ipelets/triangulation.cpp
rename to 3rdparty/CGAL/demo/CGAL_ipelets/triangulation.cpp
diff --git a/3rdparty/CGAL-4.8/demo/CMakeLists.txt b/3rdparty/CGAL/demo/CMakeLists.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/CMakeLists.txt
rename to 3rdparty/CGAL/demo/CMakeLists.txt
diff --git a/3rdparty/CGAL-4.8/demo/Circular_kernel_2/ArcsGraphicsItem.h b/3rdparty/CGAL/demo/Circular_kernel_2/ArcsGraphicsItem.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Circular_kernel_2/ArcsGraphicsItem.h
rename to 3rdparty/CGAL/demo/Circular_kernel_2/ArcsGraphicsItem.h
diff --git a/3rdparty/CGAL/demo/Circular_kernel_2/CMakeLists.txt b/3rdparty/CGAL/demo/Circular_kernel_2/CMakeLists.txt
new file mode 100644
index 0000000..2f90547
--- /dev/null
+++ b/3rdparty/CGAL/demo/Circular_kernel_2/CMakeLists.txt
@@ -0,0 +1,53 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+project (Circular_kernel_2)
+
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+find_package(CGAL COMPONENTS Qt5)
+
+include(${CGAL_USE_FILE})
+
+
+
+find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
+
+include_directories (BEFORE ../../include)
+
+if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
+  add_definitions(-DQT_NO_KEYWORDS)
+  
+
+  #--------------------------------
+  # The demo: Circular_kernel_2
+  #--------------------------------
+  # UI files (Qt Designer files)
+  qt5_wrap_ui( DT_UI_FILES Circular_kernel_2.ui )
+
+  # qrc files (resources files, that contain icons, at least)
+  qt5_add_resources ( CGAL_Qt5_RESOURCE_FILES ./Circular_kernel_2.qrc )
+
+  # use the Qt MOC preprocessor on classes that derives from QObject
+  qt5_generate_moc( "Circular_kernel_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Circular_kernel_2.moc" )
+
+  # The executable itself.
+  add_executable  ( Circular_kernel_2 Circular_kernel_2.cpp Circular_kernel_2.moc ${DT_UI_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES})
+
+  qt5_use_modules(Circular_kernel_2 Xml Script OpenGL Svg)
+
+  add_to_cached_list( CGAL_EXECUTABLE_TARGETS Circular_kernel_2 )
+
+  # Link with Qt libraries
+  target_link_libraries( Circular_kernel_2 ${QT_LIBRARIES} )
+  # Link with CGAL
+  target_link_libraries( Circular_kernel_2 ${CGAL_LIBRARIES}  ${CGAL_3RD_PARTY_LIBRARIES})
+
+else()
+
+  message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
+
+endif()
diff --git a/3rdparty/CGAL-4.8/demo/Circular_kernel_2/Circular_kernel_2.cpp b/3rdparty/CGAL/demo/Circular_kernel_2/Circular_kernel_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Circular_kernel_2/Circular_kernel_2.cpp
rename to 3rdparty/CGAL/demo/Circular_kernel_2/Circular_kernel_2.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Circular_kernel_2/Circular_kernel_2.qrc b/3rdparty/CGAL/demo/Circular_kernel_2/Circular_kernel_2.qrc
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Circular_kernel_2/Circular_kernel_2.qrc
rename to 3rdparty/CGAL/demo/Circular_kernel_2/Circular_kernel_2.qrc
diff --git a/3rdparty/CGAL-4.8/demo/Circular_kernel_2/Circular_kernel_2.ui b/3rdparty/CGAL/demo/Circular_kernel_2/Circular_kernel_2.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Circular_kernel_2/Circular_kernel_2.ui
rename to 3rdparty/CGAL/demo/Circular_kernel_2/Circular_kernel_2.ui
diff --git a/3rdparty/CGAL-4.8/demo/Circular_kernel_2/about_Circular_kernel_2.html b/3rdparty/CGAL/demo/Circular_kernel_2/about_Circular_kernel_2.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Circular_kernel_2/about_Circular_kernel_2.html
rename to 3rdparty/CGAL/demo/Circular_kernel_2/about_Circular_kernel_2.html
diff --git a/3rdparty/CGAL-4.8/demo/Circular_kernel_2/arcs.arc b/3rdparty/CGAL/demo/Circular_kernel_2/arcs.arc
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Circular_kernel_2/arcs.arc
rename to 3rdparty/CGAL/demo/Circular_kernel_2/arcs.arc
diff --git a/3rdparty/CGAL-4.8/demo/Circular_kernel_2/data/circle_grid.cgal b/3rdparty/CGAL/demo/Circular_kernel_2/data/circle_grid.cgal
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Circular_kernel_2/data/circle_grid.cgal
rename to 3rdparty/CGAL/demo/Circular_kernel_2/data/circle_grid.cgal
diff --git a/3rdparty/CGAL-4.8/demo/Circular_kernel_2/data/circles_21.cgal b/3rdparty/CGAL/demo/Circular_kernel_2/data/circles_21.cgal
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Circular_kernel_2/data/circles_21.cgal
rename to 3rdparty/CGAL/demo/Circular_kernel_2/data/circles_21.cgal
diff --git a/3rdparty/CGAL/demo/Circular_kernel_3/CMakeLists.txt b/3rdparty/CGAL/demo/Circular_kernel_3/CMakeLists.txt
new file mode 100644
index 0000000..316f82d
--- /dev/null
+++ b/3rdparty/CGAL/demo/Circular_kernel_3/CMakeLists.txt
@@ -0,0 +1,36 @@
+project (Circular_kernel_3)
+
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+find_package(CGAL COMPONENTS Qt5)
+include(${CGAL_USE_FILE})
+
+find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL)
+
+find_package(OpenGL)
+find_package(QGLViewer)
+
+if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND )
+
+
+  include_directories (${QGLVIEWER_INCLUDE_DIR})
+  include_directories (BEFORE ../../include ./ )
+
+  add_executable (Circular_kernel_3 Circular_kernel_3.cpp Viewer.cpp ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES})
+
+  qt5_use_modules( Circular_kernel_3 Xml Script OpenGL)
+
+  add_to_cached_list( CGAL_EXECUTABLE_TARGETS Circular_kernel_3 )
+
+  target_link_libraries( Circular_kernel_3 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES})
+  target_link_libraries( Circular_kernel_3 ${QT_LIBRARIES} ${QGLVIEWER_LIBRARIES} )
+  target_link_libraries( Circular_kernel_3 ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
+
+else()
+
+  message(STATUS "NOTICE: This demo requires CGAL, the QGLViewer, OpenGL and Qt5, and will not be compiled.")
+
+endif()
diff --git a/3rdparty/CGAL-4.8/demo/Circular_kernel_3/Circular_kernel_3.cpp b/3rdparty/CGAL/demo/Circular_kernel_3/Circular_kernel_3.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Circular_kernel_3/Circular_kernel_3.cpp
rename to 3rdparty/CGAL/demo/Circular_kernel_3/Circular_kernel_3.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Circular_kernel_3/Viewer.cpp b/3rdparty/CGAL/demo/Circular_kernel_3/Viewer.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Circular_kernel_3/Viewer.cpp
rename to 3rdparty/CGAL/demo/Circular_kernel_3/Viewer.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Circular_kernel_3/Viewer.h b/3rdparty/CGAL/demo/Circular_kernel_3/Viewer.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Circular_kernel_3/Viewer.h
rename to 3rdparty/CGAL/demo/Circular_kernel_3/Viewer.h
diff --git a/3rdparty/CGAL/demo/Convex_hull_3/CMakeLists.txt b/3rdparty/CGAL/demo/Convex_hull_3/CMakeLists.txt
new file mode 100644
index 0000000..f8b71af
--- /dev/null
+++ b/3rdparty/CGAL/demo/Convex_hull_3/CMakeLists.txt
@@ -0,0 +1,27 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Convex_hull_3_Demo )
+
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  create_single_source_cgal_program( "quickhull_3_demo.cpp" )
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/demo/Convex_hull_3/README b/3rdparty/CGAL/demo/Convex_hull_3/README
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Convex_hull_3/README
rename to 3rdparty/CGAL/demo/Convex_hull_3/README
diff --git a/3rdparty/CGAL-4.8/demo/Convex_hull_3/quickhull_3_demo.cpp b/3rdparty/CGAL/demo/Convex_hull_3/quickhull_3_demo.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Convex_hull_3/quickhull_3_demo.cpp
rename to 3rdparty/CGAL/demo/Convex_hull_3/quickhull_3_demo.cpp
diff --git a/3rdparty/CGAL/demo/Generator/CMakeLists.txt b/3rdparty/CGAL/demo/Generator/CMakeLists.txt
new file mode 100644
index 0000000..cb5451f
--- /dev/null
+++ b/3rdparty/CGAL/demo/Generator/CMakeLists.txt
@@ -0,0 +1,50 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+project (GeneratorDemo)
+
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+find_package(CGAL COMPONENTS Qt5)
+
+include(${CGAL_USE_FILE})
+
+find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
+
+include_directories (BEFORE ../../include)
+
+if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
+
+  add_definitions(-DQT_NO_KEYWORDS)
+  #--------------------------------
+  # Demo: Generator_2
+  #--------------------------------
+  # UI files (Qt Designer files)
+  qt5_wrap_ui( DT_UI_FILES Generator_2.ui )
+
+  # qrc files (resources files, that contain icons, at least)
+  qt5_add_resources ( CGAL_Qt5_RESOURCE_FILES ./Generator_2.qrc )
+
+  # use the Qt MOC preprocessor on classes that derives from QObject
+  qt5_generate_moc( "Generator_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Generator_2.moc" )
+
+  # The executable itself.
+  add_executable  ( Generator_2 Generator_2.cpp Generator_2.moc ${DT_UI_FILES}  ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES} )
+
+  qt5_use_modules(Generator_2 Xml Script OpenGL Svg)
+
+  add_to_cached_list( CGAL_EXECUTABLE_TARGETS Generator_2 )
+
+  # Link with Qt libraries
+  target_link_libraries( Generator_2 ${QT_LIBRARIES} )
+  # And with CGAL libraries
+  target_link_libraries( Generator_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} )
+
+else()
+
+  message(STATUS "NOTICE: This demo requires CGAL, and Qt5, and will not be compiled.")
+
+endif()
diff --git a/3rdparty/CGAL-4.8/demo/Generator/Generator_2.cpp b/3rdparty/CGAL/demo/Generator/Generator_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Generator/Generator_2.cpp
rename to 3rdparty/CGAL/demo/Generator/Generator_2.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Generator/Generator_2.qrc b/3rdparty/CGAL/demo/Generator/Generator_2.qrc
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Generator/Generator_2.qrc
rename to 3rdparty/CGAL/demo/Generator/Generator_2.qrc
diff --git a/3rdparty/CGAL-4.8/demo/Generator/Generator_2.ui b/3rdparty/CGAL/demo/Generator/Generator_2.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Generator/Generator_2.ui
rename to 3rdparty/CGAL/demo/Generator/Generator_2.ui
diff --git a/3rdparty/CGAL-4.8/demo/Generator/about_Generator_2.html b/3rdparty/CGAL/demo/Generator/about_Generator_2.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Generator/about_Generator_2.html
rename to 3rdparty/CGAL/demo/Generator/about_Generator_2.html
diff --git a/3rdparty/CGAL/demo/Geomview/CMakeLists.txt b/3rdparty/CGAL/demo/Geomview/CMakeLists.txt
new file mode 100644
index 0000000..4734ca5
--- /dev/null
+++ b/3rdparty/CGAL/demo/Geomview/CMakeLists.txt
@@ -0,0 +1,29 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Geomview_Demo )
+
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  create_single_source_cgal_program( "input.cpp" )
+  create_single_source_cgal_program( "kernel.cpp" )
+  create_single_source_cgal_program( "gv_terrain.cpp" )
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/demo/Geomview/README b/3rdparty/CGAL/demo/Geomview/README
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Geomview/README
rename to 3rdparty/CGAL/demo/Geomview/README
diff --git a/3rdparty/CGAL-4.8/demo/Geomview/data/points3 b/3rdparty/CGAL/demo/Geomview/data/points3
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Geomview/data/points3
rename to 3rdparty/CGAL/demo/Geomview/data/points3
diff --git a/3rdparty/CGAL-4.8/demo/Geomview/gv_terrain.cpp b/3rdparty/CGAL/demo/Geomview/gv_terrain.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Geomview/gv_terrain.cpp
rename to 3rdparty/CGAL/demo/Geomview/gv_terrain.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Geomview/input.cpp b/3rdparty/CGAL/demo/Geomview/input.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Geomview/input.cpp
rename to 3rdparty/CGAL/demo/Geomview/input.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Geomview/kernel.cpp b/3rdparty/CGAL/demo/Geomview/kernel.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Geomview/kernel.cpp
rename to 3rdparty/CGAL/demo/Geomview/kernel.cpp
diff --git a/3rdparty/CGAL/demo/GraphicsView/CMakeLists.txt b/3rdparty/CGAL/demo/GraphicsView/CMakeLists.txt
new file mode 100644
index 0000000..fdc8576
--- /dev/null
+++ b/3rdparty/CGAL/demo/GraphicsView/CMakeLists.txt
@@ -0,0 +1,35 @@
+# This is the CMake script for compiling a CGAL application.
+
+project (GraphicsView)
+
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+find_package(CGAL COMPONENTS Qt5)
+
+include(${CGAL_USE_FILE})
+
+find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
+
+if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
+
+  add_definitions(-DQT_NO_KEYWORDS)
+
+  add_executable  ( min min.cpp  ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES})
+
+  qt5_use_modules(min Xml Script OpenGL Svg)
+
+  add_to_cached_list( CGAL_EXECUTABLE_TARGETS min )
+
+  # Link with Qt libraries
+  target_link_libraries( min ${QT_LIBRARIES} )
+  # Link with CGAL
+  target_link_libraries( min ${CGAL_LIBRARIES}  ${CGAL_3RD_PARTY_LIBRARIES})
+
+else()
+
+  message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
+
+endif()
diff --git a/3rdparty/CGAL-4.8/demo/GraphicsView/min.cpp b/3rdparty/CGAL/demo/GraphicsView/min.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/GraphicsView/min.cpp
rename to 3rdparty/CGAL/demo/GraphicsView/min.cpp
diff --git a/3rdparty/CGAL/demo/Interpolation/CMakeLists.txt b/3rdparty/CGAL/demo/Interpolation/CMakeLists.txt
new file mode 100644
index 0000000..edf5538
--- /dev/null
+++ b/3rdparty/CGAL/demo/Interpolation/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Interpolation_ )
+
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  create_single_source_cgal_program( "interpolation_2_demo.cpp" )
+  create_single_source_cgal_program( "surface_voronoi.cpp" )
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/demo/Interpolation/README b/3rdparty/CGAL/demo/Interpolation/README
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Interpolation/README
rename to 3rdparty/CGAL/demo/Interpolation/README
diff --git a/3rdparty/CGAL-4.8/demo/Interpolation/interpolation_2_demo.cpp b/3rdparty/CGAL/demo/Interpolation/interpolation_2_demo.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Interpolation/interpolation_2_demo.cpp
rename to 3rdparty/CGAL/demo/Interpolation/interpolation_2_demo.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Interpolation/surface_voronoi.cpp b/3rdparty/CGAL/demo/Interpolation/surface_voronoi.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Interpolation/surface_voronoi.cpp
rename to 3rdparty/CGAL/demo/Interpolation/surface_voronoi.cpp
diff --git a/3rdparty/CGAL/demo/L1_Voronoi_diagram_2/CMakeLists.txt b/3rdparty/CGAL/demo/L1_Voronoi_diagram_2/CMakeLists.txt
new file mode 100644
index 0000000..ef902b0
--- /dev/null
+++ b/3rdparty/CGAL/demo/L1_Voronoi_diagram_2/CMakeLists.txt
@@ -0,0 +1,52 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+project (L1_voronoi_diagram_2)
+
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+find_package(CGAL COMPONENTS Qt5)
+
+include(${CGAL_USE_FILE})
+
+find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
+include_directories (BEFORE ../../include)
+include_directories (BEFORE ./include)
+
+
+if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
+
+add_definitions(-DQT_NO_KEYWORDS)
+
+#--------------------------------
+# The "L1 Voronoi diagram" demo: L1_voronoi_diagram_2
+#--------------------------------
+# UI files (Qt Designer files)
+qt5_wrap_ui( DT_UI_FILES L1_voronoi_diagram_2.ui )
+
+# qrc files (resources files, that contain icons, at least)
+qt5_add_resources ( CGAL_Qt5_RESOURCE_FILES ./L1_voronoi_diagram_2.qrc )
+
+# use the Qt MOC preprocessor on classes that derives from QObject
+qt5_generate_moc( L1_voronoi_diagram_2.cpp L1_voronoi_diagram_2.moc )
+
+# The executable itself.
+add_executable  ( L1_voronoi_diagram_2 L1_voronoi_diagram_2.cpp L1_voronoi_diagram_2.moc ${DT_UI_FILES}  ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES} )
+
+qt5_use_modules(L1_voronoi_diagram_2 Xml Script OpenGL Svg)
+
+add_to_cached_list( CGAL_EXECUTABLE_TARGETS L1_voronoi_diagram_2 )
+
+# Link with Qt libraries
+target_link_libraries( L1_voronoi_diagram_2 ${QT_LIBRARIES} )
+# Link with CGAL
+target_link_libraries( L1_voronoi_diagram_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES})
+
+else()
+
+  message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
+
+endif()
diff --git a/3rdparty/CGAL-4.8/demo/L1_Voronoi_diagram_2/L1_voronoi_diagram_2.cpp b/3rdparty/CGAL/demo/L1_Voronoi_diagram_2/L1_voronoi_diagram_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/L1_Voronoi_diagram_2/L1_voronoi_diagram_2.cpp
rename to 3rdparty/CGAL/demo/L1_Voronoi_diagram_2/L1_voronoi_diagram_2.cpp
diff --git a/3rdparty/CGAL-4.8/demo/L1_Voronoi_diagram_2/L1_voronoi_diagram_2.qrc b/3rdparty/CGAL/demo/L1_Voronoi_diagram_2/L1_voronoi_diagram_2.qrc
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/L1_Voronoi_diagram_2/L1_voronoi_diagram_2.qrc
rename to 3rdparty/CGAL/demo/L1_Voronoi_diagram_2/L1_voronoi_diagram_2.qrc
diff --git a/3rdparty/CGAL-4.8/demo/L1_Voronoi_diagram_2/L1_voronoi_diagram_2.ui b/3rdparty/CGAL/demo/L1_Voronoi_diagram_2/L1_voronoi_diagram_2.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/L1_Voronoi_diagram_2/L1_voronoi_diagram_2.ui
rename to 3rdparty/CGAL/demo/L1_Voronoi_diagram_2/L1_voronoi_diagram_2.ui
diff --git a/3rdparty/CGAL-4.8/demo/L1_Voronoi_diagram_2/about_L1_voronoi_diagram_2.html b/3rdparty/CGAL/demo/L1_Voronoi_diagram_2/about_L1_voronoi_diagram_2.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/L1_Voronoi_diagram_2/about_L1_voronoi_diagram_2.html
rename to 3rdparty/CGAL/demo/L1_Voronoi_diagram_2/about_L1_voronoi_diagram_2.html
diff --git a/3rdparty/CGAL-4.8/demo/L1_Voronoi_diagram_2/include/CGAL/L1_voronoi_traits_2.h b/3rdparty/CGAL/demo/L1_Voronoi_diagram_2/include/CGAL/L1_voronoi_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/L1_Voronoi_diagram_2/include/CGAL/L1_voronoi_traits_2.h
rename to 3rdparty/CGAL/demo/L1_Voronoi_diagram_2/include/CGAL/L1_voronoi_traits_2.h
diff --git a/3rdparty/CGAL-4.8/demo/L1_Voronoi_diagram_2/include/CGAL/Qt/ArrangementGraphicsItem.h b/3rdparty/CGAL/demo/L1_Voronoi_diagram_2/include/CGAL/Qt/ArrangementGraphicsItem.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/L1_Voronoi_diagram_2/include/CGAL/Qt/ArrangementGraphicsItem.h
rename to 3rdparty/CGAL/demo/L1_Voronoi_diagram_2/include/CGAL/Qt/ArrangementGraphicsItem.h
diff --git a/3rdparty/CGAL-4.8/demo/L1_Voronoi_diagram_2/include/CGAL/Qt/ArrangementPointInput.h b/3rdparty/CGAL/demo/L1_Voronoi_diagram_2/include/CGAL/Qt/ArrangementPointInput.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/L1_Voronoi_diagram_2/include/CGAL/Qt/ArrangementPointInput.h
rename to 3rdparty/CGAL/demo/L1_Voronoi_diagram_2/include/CGAL/Qt/ArrangementPointInput.h
diff --git a/3rdparty/CGAL-4.8/demo/L1_Voronoi_diagram_2/include/CGAL/Qt/SetGraphicsItem.h b/3rdparty/CGAL/demo/L1_Voronoi_diagram_2/include/CGAL/Qt/SetGraphicsItem.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/L1_Voronoi_diagram_2/include/CGAL/Qt/SetGraphicsItem.h
rename to 3rdparty/CGAL/demo/L1_Voronoi_diagram_2/include/CGAL/Qt/SetGraphicsItem.h
diff --git a/3rdparty/CGAL/demo/Largest_empty_rect_2/CMakeLists.txt b/3rdparty/CGAL/demo/Largest_empty_rect_2/CMakeLists.txt
new file mode 100644
index 0000000..b3ee42b
--- /dev/null
+++ b/3rdparty/CGAL/demo/Largest_empty_rect_2/CMakeLists.txt
@@ -0,0 +1,51 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+project (Largest_empty_rectangleDemo)
+
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+find_package(CGAL COMPONENTS Qt5)
+
+include(${CGAL_USE_FILE})
+
+find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
+
+include_directories (BEFORE ../../include)
+
+if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
+
+  add_definitions(-DQT_NO_KEYWORDS)
+  
+  #--------------------------------
+  # Demo: Largest_empty_rectangle_2
+  #--------------------------------
+  # UI files (Qt Designer files)
+  qt5_wrap_ui( DT_UI_FILES Largest_empty_rectangle_2.ui )
+
+  # qrc files (resources files, that contain icons, at least)
+  qt5_add_resources ( CGAL_Qt5_RESOURCE_FILES ./Largest_empty_rectangle_2.qrc )
+
+  # use the Qt MOC preprocessor on classes that derives from QObject
+  qt5_generate_moc( Largest_empty_rectangle_2.cpp Largest_empty_rectangle_2.moc )
+
+  # The executable itself.
+  add_executable  ( Largest_empty_rectangle_2 Largest_empty_rectangle_2.cpp Largest_empty_rectangle_2.moc ${DT_UI_FILES}  ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES} )
+
+  qt5_use_modules(Largest_empty_rectangle_2 Xml Script OpenGL Svg)
+
+  add_to_cached_list( CGAL_EXECUTABLE_TARGETS Largest_empty_rectangle_2 )
+
+  # Link with Qt libraries
+  target_link_libraries( Largest_empty_rectangle_2 ${QT_LIBRARIES} )
+  # And with CGAL libraries
+  target_link_libraries( Largest_empty_rectangle_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} )
+
+else()
+
+  message(STATUS "NOTICE: This demo requires CGAL, and Qt5, and will not be compiled.")
+
+endif()
diff --git a/3rdparty/CGAL-4.8/demo/Largest_empty_rect_2/Largest_empty_rectangle_2.cpp b/3rdparty/CGAL/demo/Largest_empty_rect_2/Largest_empty_rectangle_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Largest_empty_rect_2/Largest_empty_rectangle_2.cpp
rename to 3rdparty/CGAL/demo/Largest_empty_rect_2/Largest_empty_rectangle_2.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Largest_empty_rect_2/Largest_empty_rectangle_2.qrc b/3rdparty/CGAL/demo/Largest_empty_rect_2/Largest_empty_rectangle_2.qrc
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Largest_empty_rect_2/Largest_empty_rectangle_2.qrc
rename to 3rdparty/CGAL/demo/Largest_empty_rect_2/Largest_empty_rectangle_2.qrc
diff --git a/3rdparty/CGAL-4.8/demo/Largest_empty_rect_2/Largest_empty_rectangle_2.ui b/3rdparty/CGAL/demo/Largest_empty_rect_2/Largest_empty_rectangle_2.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Largest_empty_rect_2/Largest_empty_rectangle_2.ui
rename to 3rdparty/CGAL/demo/Largest_empty_rect_2/Largest_empty_rectangle_2.ui
diff --git a/3rdparty/CGAL-4.8/demo/Largest_empty_rect_2/about_Largest_empty_rectangle_2.html b/3rdparty/CGAL/demo/Largest_empty_rect_2/about_Largest_empty_rectangle_2.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Largest_empty_rect_2/about_Largest_empty_rectangle_2.html
rename to 3rdparty/CGAL/demo/Largest_empty_rect_2/about_Largest_empty_rectangle_2.html
diff --git a/3rdparty/CGAL/demo/Linear_cell_complex/CMakeLists.txt b/3rdparty/CGAL/demo/Linear_cell_complex/CMakeLists.txt
new file mode 100644
index 0000000..da6c523
--- /dev/null
+++ b/3rdparty/CGAL/demo/Linear_cell_complex/CMakeLists.txt
@@ -0,0 +1,79 @@
+# Created by the script cgal_create_cmake_script (and then adapted manually).
+# This is the CMake script for compiling a CGAL application.
+# cmake ../ -DCMAKE_BUILD_TYPE=Debug
+
+project (Linear_cell_complex_3_demo)
+
+# Find includes in corresponding build directories
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+# Instruct CMake to run moc automatically when needed.
+set(CMAKE_AUTOMOC ON)
+
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+## To add expensive tests
+# add_definitions("-DCGAL_CHECK_EXPENSIVE")
+# add_definitions("-Wall -Wextra")
+
+## For profilling with gprof
+# add_definitions("-pg")
+# SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
+
+## To add an is_valid test after each operation (only in debug mode)
+# add_definitions("-DCGAL_CMAP_TEST_VALID_REMOVALS")
+# add_definitions("-DCGAL_CMAP_TEST_VALID_CONTRACTIONS")
+# add_definitions("-DCGAL_CMAP_TEST_VALID_INSERTIONS")
+
+# Option allowing to profile each operation of the demo (cout times on stdout).
+add_definitions(-DCGAL_PROFILE_LCC_DEMO)
+
+##################
+find_package(CGAL COMPONENTS Qt5)
+include(${CGAL_USE_FILE})
+
+find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
+
+find_package(OpenGL)
+find_package(QGLViewer)
+
+if ( NOT (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND
+      OPENGL_FOUND AND QGLVIEWER_FOUND) )
+
+  MESSAGE(STATUS "NOTICE: This demo requires CGAL, QGLViewer, OpenGL "
+    "and Qt5, and will not be compiled.")
+
+else()
+
+add_definitions(-DQT_NO_KEYWORDS)
+
+include_directories(${QGLVIEWER_INCLUDE_DIR})
+include_directories(BEFORE . ../../include/)
+
+# ui file, created wih Qt Designer
+qt5_wrap_ui(uis MainWindow.ui CreateMesh.ui CreateMenger.ui
+                CreateSierpinskiCarpet.ui CreateSierpinskiTriangle.ui)
+
+# qrc files (resources files, that contain icons, at least)
+qt5_add_resources (CGAL_Qt5_RESOURCE_FILES ./Linear_cell_complex_3.qrc)
+
+
+add_executable(Linear_cell_complex_3_demo
+  Linear_cell_complex_3_demo.cpp MainWindow.cpp
+  Viewer.cpp Linear_cell_complex_3_subdivision.cpp
+  Linear_cell_complex_pqq_subdivision.cpp
+  ${uis} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES})
+
+qt5_use_modules(Linear_cell_complex_3_demo Xml Script OpenGL Svg)
+add_to_cached_list(CGAL_EXECUTABLE_TARGETS Linear_cell_complex_3_demo)
+
+target_link_libraries(Linear_cell_complex_3_demo ${CGAL_LIBRARIES}
+                                                 ${CGAL_3RD_PARTY_LIBRARIES})
+target_link_libraries(Linear_cell_complex_3_demo ${QT_LIBRARIES}
+                                                 ${QGLVIEWER_LIBRARIES} )
+target_link_libraries(Linear_cell_complex_3_demo ${OPENGL_gl_LIBRARY}
+                                                 ${OPENGL_glu_LIBRARY} )
+
+endif()
diff --git a/3rdparty/CGAL-4.8/demo/Linear_cell_complex/CreateMenger.ui b/3rdparty/CGAL/demo/Linear_cell_complex/CreateMenger.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Linear_cell_complex/CreateMenger.ui
rename to 3rdparty/CGAL/demo/Linear_cell_complex/CreateMenger.ui
diff --git a/3rdparty/CGAL-4.8/demo/Linear_cell_complex/CreateMesh.ui b/3rdparty/CGAL/demo/Linear_cell_complex/CreateMesh.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Linear_cell_complex/CreateMesh.ui
rename to 3rdparty/CGAL/demo/Linear_cell_complex/CreateMesh.ui
diff --git a/3rdparty/CGAL-4.8/demo/Linear_cell_complex/CreateSierpinskiCarpet.ui b/3rdparty/CGAL/demo/Linear_cell_complex/CreateSierpinskiCarpet.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Linear_cell_complex/CreateSierpinskiCarpet.ui
rename to 3rdparty/CGAL/demo/Linear_cell_complex/CreateSierpinskiCarpet.ui
diff --git a/3rdparty/CGAL-4.8/demo/Linear_cell_complex/CreateSierpinskiTriangle.ui b/3rdparty/CGAL/demo/Linear_cell_complex/CreateSierpinskiTriangle.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Linear_cell_complex/CreateSierpinskiTriangle.ui
rename to 3rdparty/CGAL/demo/Linear_cell_complex/CreateSierpinskiTriangle.ui
diff --git a/3rdparty/CGAL-4.8/demo/Linear_cell_complex/Linear_cell_complex_3.qrc b/3rdparty/CGAL/demo/Linear_cell_complex/Linear_cell_complex_3.qrc
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Linear_cell_complex/Linear_cell_complex_3.qrc
rename to 3rdparty/CGAL/demo/Linear_cell_complex/Linear_cell_complex_3.qrc
diff --git a/3rdparty/CGAL-4.8/demo/Linear_cell_complex/Linear_cell_complex_3_demo.cpp b/3rdparty/CGAL/demo/Linear_cell_complex/Linear_cell_complex_3_demo.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Linear_cell_complex/Linear_cell_complex_3_demo.cpp
rename to 3rdparty/CGAL/demo/Linear_cell_complex/Linear_cell_complex_3_demo.cpp
diff --git a/3rdparty/CGAL/demo/Linear_cell_complex/Linear_cell_complex_3_subdivision.cpp b/3rdparty/CGAL/demo/Linear_cell_complex/Linear_cell_complex_3_subdivision.cpp
new file mode 100644
index 0000000..a3c63c0
--- /dev/null
+++ b/3rdparty/CGAL/demo/Linear_cell_complex/Linear_cell_complex_3_subdivision.cpp
@@ -0,0 +1,202 @@
+// Copyright (c) 2011 CNRS and LIRIS' Establishments (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Guillaume Damiand <guillaume.damiand at liris.cnrs.fr>
+//
+#include "typedefs.h"
+
+#define PI 3.1415926535897932
+
+// Smoth a vertex depending on the vertices of its incident facet.
+class Smooth_old_vertex
+{
+public:
+  /**  Constructor.
+   * @param alcc is the lcc to smooth
+   * @param amark is a mark designing old darts (i.e. darts not created during
+   *        the triangulation step)
+   */
+  Smooth_old_vertex (LCC & alcc, LCC::size_type /* TODO amark*/):mlcc (alcc)
+  {
+  }
+
+  Vertex operator  () (Vertex & v) const
+  {
+    Dart_handle d = v.dart ();
+
+    int degree = 0;
+    bool open = false;
+
+    LCC::One_dart_per_incident_cell_range<1,0>::iterator it (mlcc, d),
+      itend(mlcc.one_dart_per_incident_cell<1,0>(d).end());
+    for (; it != itend; ++it)
+    {
+      ++degree;
+      if (mlcc.is_free(it, 2)) open = true;
+    }
+
+    if (open)
+      return v;
+
+    LCC::FT alpha = (4.0f - 2.0f *
+                     (LCC::FT) cos (2.0f * PI / (LCC::FT) degree)) / 9.0f;
+    LCC::Vector vec =
+      LCC::Traits::Construct_scaled_vector()
+      ( LCC::Traits::Construct_vector() (CGAL::ORIGIN, v.point()), (1.0f - alpha));
+
+    for (it.rewind (); it != itend; ++it)
+    {
+      CGAL_assertion (!mlcc.is_free(it,2));
+      vec = vec + (mlcc.point(mlcc.beta(it,2)) - CGAL::ORIGIN)
+        * alpha / degree;
+    }
+
+    Vertex res= LCC::Traits::Construct_translated_point() (CGAL::ORIGIN, vec);
+    res.set_dart (d);
+
+    return res;
+  }
+private:
+  LCC & mlcc;
+};
+
+// Flip an edge, work only in 2D and 3D
+Dart_handle
+flip_edge (LCC & m, Dart_handle d)
+{
+  CGAL_assertion ( !m.is_free(d,2) );
+  CGAL_assertion ( !m.is_free(d,1) && !m.is_free(d,0) );
+  CGAL_assertion ( !m.is_free(m.beta(d,2), 0) && !m.is_free(m.beta(d, 2), 1) );
+  
+  if (!m.is_removable<1>(d)) return LCC::null_handle;
+
+  Dart_handle d1 = m.beta(d,1);
+  Dart_handle d2 = m.beta(d,2,0);
+
+  CGAL_assertion ( !m.is_free(d1,1) && !m.is_free(d2,0) );
+
+  Dart_handle d3 = m.beta(d1,1);
+  Dart_handle d4 = m.beta(d2, 0);
+
+  // We isolated the edge
+  m.basic_link_beta_1(m.beta(d,0), m.beta(d,2,1));
+  m.basic_link_beta_0(m.beta(d,1), m.beta(d,2,0));
+  if ( !m.is_free(d,3) )
+  {
+    m.basic_link_beta_0(m.beta(d,0,3), m.beta(d,2,1,3));
+    m.basic_link_beta_1(m.beta(d,1,3), m.beta(d,2,0,3));
+  }
+
+  // Then we push the two extremities.
+  m.basic_link_beta_0(d3, d);
+  m.basic_link_beta_0(d2, m.beta(d,2));
+  m.link_beta_1(d4, d);
+  m.link_beta_1(d1, m.beta(d,2));
+
+  if ( !m.is_free(d,3) )
+  {
+    m.basic_link_beta_0(m.beta(d4,3), m.beta(d,3));
+    m.basic_link_beta_0(m.beta(d1,3), m.beta(d,2,3));
+    m.link_beta_1(m.beta(d3,3), m.beta(d,3));
+    m.link_beta_1(m.beta(d2,3), m.beta(d,2,3));
+  }
+  
+  // CGAL::remove_cell<LCC,1>(m, d);
+  // insert_cell_1_in_cell_2(m, d1, d1->beta(1)->beta(1));
+
+  return d;
+}
+
+// Subdivide each facet of the lcc by using sqrt(3)-subdivision.
+void
+subdivide_lcc_3 (LCC & m)
+{
+  if (m.number_of_darts () == 0)
+    return;
+
+  LCC::size_type mark = m.get_new_mark ();
+  LCC::size_type treated = m.get_new_mark ();
+  m.negate_mark (mark);  // All the old darts are marked in O(1).
+
+  // 1) We smoth the old vertices.
+  std::vector < Vertex > vertices;  // smooth the old vertices
+  vertices.reserve (m.number_of_attributes<0> ());  // get intermediate space
+  std::transform (m.vertex_attributes().begin (), 
+		  m.vertex_attributes().end (),
+		  std::back_inserter (vertices), 
+		  Smooth_old_vertex (m, mark));
+
+  // 2) We subdivide each facet.
+  m.negate_mark (treated);  // All the darts are marked in O(1).
+  unsigned int nb = 0;
+  for (LCC::Dart_range::iterator it (m.darts().begin ());
+       m.number_of_marked_darts (treated) > 0; ++it)
+  {
+    ++nb;
+    if (m.is_marked (it, treated))
+    {
+      // We unmark the darts of the facet to process only once dart/facet.
+      CGAL::unmark_cell < LCC, 2 > (m, it, treated);
+      // We triangulate the facet.
+      m.insert_barycenter_in_cell<2>(it);
+    }
+  }
+
+  CGAL_assertion (m.is_whole_map_unmarked (treated));
+  CGAL_assertion (m.is_valid ());
+  m.free_mark (treated);
+
+  // 3) We update the coordinates of old vertices.
+  for (std::vector < Vertex >::iterator vit = vertices.begin ();
+       vit != vertices.end (); ++vit)
+  {
+    m.point(vit->dart())=vit->point();
+  }
+
+  // 4) We flip all the old edges.
+  m.negate_mark (mark);  // Now only new darts are marked.
+  Dart_handle d2 =LCC::null_handle;
+  for (LCC::Dart_range::iterator it (m.darts().begin ());
+       it != m.darts().end ();)
+  {
+    d2 = it++;
+    if (!m.is_marked (d2, mark))  // This is an old dart.
+    {
+      // We process only the last dart of a same edge.
+      if (!m.is_free(d2,2) && (m.beta(d2,2,3)==m.beta(d2,3,2)))
+      {
+        if (m.is_marked(m.beta(d2,2), mark) &&
+            (m.is_free(d2,3) ||
+             (m.is_marked(m.beta(d2,3), mark) &&
+              m.is_marked(m.beta(d2,2,3), mark))))
+        {
+          flip_edge (m, d2);
+          m.mark(d2, mark);
+        }
+        else
+          m.mark (d2, mark);
+      }
+      else
+        m.mark (d2, mark);
+    }
+  }
+
+  CGAL_assertion (m.is_whole_map_marked (mark));
+  m.free_mark (mark);
+  
+  CGAL_postcondition ( m.is_valid ());
+}
diff --git a/3rdparty/CGAL/demo/Linear_cell_complex/Linear_cell_complex_pqq_subdivision.cpp b/3rdparty/CGAL/demo/Linear_cell_complex/Linear_cell_complex_pqq_subdivision.cpp
new file mode 100644
index 0000000..d0dbe3d
--- /dev/null
+++ b/3rdparty/CGAL/demo/Linear_cell_complex/Linear_cell_complex_pqq_subdivision.cpp
@@ -0,0 +1,327 @@
+// Copyright (c) 2011 CNRS and LIRIS' Establishments (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Guillaume Damiand <guillaume.damiand at liris.cnrs.fr> 
+//		   Jérémy Girerd-Rey <jeremy.girerd-rey at etu.univ-lyon1.fr>
+//
+
+#include "typedefs.h"
+
+// Smooth a vertex depending on the vertices of its incidents facets.
+class Smooth_edge_pqq
+{
+public:
+  /**  Constructor.
+   * @param alcc is the lcc to smooth
+   * @param amark is a mark designing old darts (i.e. darts not created during
+   *        the subdivision step)
+   */
+  Smooth_edge_pqq (LCC & alcc, LCC::size_type o):mlcc (alcc), old(o)
+  {
+  }
+
+  Vertex operator  () (Vertex & v) const
+  {
+    Dart_handle d = v.dart ();
+
+    // Old points aren't concerned.
+    if (mlcc.is_marked(d, old))
+    {       
+    return v;
+    }
+
+    std::vector<LCC::Point> facetsPoints;
+    facetsPoints.resize(0);
+
+    // We search barycenter point of incidents facets.
+    for (LCC::One_dart_per_incident_cell_range<1,0>::iterator it =
+           mlcc.one_dart_per_incident_cell<1,0>(d).begin();
+         it != mlcc.one_dart_per_incident_cell<1,0>(d).end(); ++it)
+    {
+      // If the vertex is on a border.
+      if (mlcc.is_free(it,2))
+      { 
+        return v;
+      }
+      // If we found barycenter of a facet.
+      if (!mlcc.is_marked(mlcc.opposite(it), old))
+      {       
+        facetsPoints.push_back(mlcc.point(mlcc.opposite(it)));
+      }
+    }
+
+    // If we found more than two points we are on a vertice barycenter of a facet.
+    // They aren't concerned.
+    if (facetsPoints.size() > 2 || facetsPoints.size() < 2)
+    {       
+      return v;
+    }
+
+    // Average.
+    LCC::Vector averageFacetsV = LCC::Traits::Construct_vector() 
+			          ( CGAL::ORIGIN, LCC::Point(0,0,0) );                                                   
+
+    for (unsigned int i=0; i < facetsPoints.size(); i++)
+    {
+      averageFacetsV = LCC::Traits::Construct_sum_of_vectors()
+      		       (averageFacetsV, 
+       		       LCC::Traits::Construct_vector() (CGAL::ORIGIN, facetsPoints[i]));
+     }
+
+    averageFacetsV = LCC::Traits::Construct_scaled_vector()
+                     ( averageFacetsV, (1.0f/facetsPoints.size()) );
+
+    // Barycenter point.
+    LCC::Vector barycenterV = LCC::Traits::Construct_sum_of_vectors()
+      		              ( LCC::Traits::Construct_vector() (CGAL::ORIGIN, v.point()), averageFacetsV );
+
+    barycenterV = LCC::Traits::Construct_scaled_vector()
+                  ( barycenterV, (1.0f/2.0f) );
+
+    Vertex res = LCC::Traits::Construct_translated_point() (CGAL::ORIGIN, barycenterV);
+    res.set_dart (d);
+
+    return res;
+  }
+private:
+  LCC & mlcc;
+  LCC::size_type old;
+};
+
+// Smooth an old vertex depending on the vertices of its incident facet and edge.
+class Smooth_vertex_pqq
+{
+public:
+  /**  Constructor.
+   * @param alcc is the lcc to smooth
+   * @param amark is a mark designing old darts (i.e. darts not created during
+   *        the triangulation step)
+   */
+  Smooth_vertex_pqq (LCC & alcc, LCC::size_type o):mlcc (alcc), old(o)
+  {
+  }
+
+  Vertex operator  () (Vertex & v) const
+  {
+    Dart_handle d = v.dart ();
+
+    // Just old points are concerned.
+    if (!mlcc.is_marked(d, old))
+    {       
+      return v;
+    }
+
+    unsigned int degree = 0;
+    std::vector<LCC::Point> edgesPoints;
+    edgesPoints.resize(0);    
+    
+    std::vector<LCC::Point> facetsPoints;
+    facetsPoints.resize(0);    
+
+    // We search barycenter point of incidents facets, and incidents edges points.
+    for (LCC::One_dart_per_incident_cell_range<1,0>::iterator it =
+           mlcc.one_dart_per_incident_cell<1,0>(d).begin();
+        it != mlcc.one_dart_per_incident_cell<1,0>(d).end(); ++it)
+    {
+      // If the vertex is on a border
+      if (mlcc.is_free(it,2))
+      { 
+        return v;
+      }
+      // If incident isn't an old point, it's an edge point.
+      if (!mlcc.is_marked(mlcc.opposite(it), old))
+      {       
+        edgesPoints.push_back (mlcc.point(mlcc.opposite(it)));
+      }
+      // We go find the "facet point" of incidents facet (barycenter of a facet).
+      facetsPoints.push_back (mlcc.point(mlcc.beta(mlcc.opposite(it), 0)));
+      ++degree;
+    }
+
+    CGAL_assertion (facetsPoints.size() != 0 && edgesPoints.size() != 0);
+
+    if (facetsPoints.size() < 3 || edgesPoints.size() < 3 )
+    {       
+      return v;
+    }
+
+    // Average of incidents "edge points".
+    LCC::Vector averageEdgesV = LCC::Traits::Construct_vector() 
+			        (CGAL::ORIGIN, LCC::Point(0,0,0));                                                   
+
+    for (unsigned int i=0; i < edgesPoints.size(); i++)
+    {
+      averageEdgesV = LCC::Traits::Construct_sum_of_vectors()
+                      ( averageEdgesV, 
+       		      LCC::Traits::Construct_vector() (CGAL::ORIGIN, edgesPoints[i]));
+    }
+
+    averageEdgesV = LCC::Traits::Construct_scaled_vector()
+                    ( averageEdgesV, 1.0f/ (LCC::FT) edgesPoints.size() );
+
+    // Average of incidents "facet points".
+    LCC::Vector averageFacetsV = LCC::Traits::Construct_vector() 
+			         (CGAL::ORIGIN, LCC::Point(0,0,0));                                                   
+
+    for (unsigned int i=0; i < facetsPoints.size(); i++)
+    {
+      averageFacetsV = LCC::Traits::Construct_sum_of_vectors()
+      		       ( averageFacetsV, 
+       		       LCC::Traits::Construct_vector() (CGAL::ORIGIN, facetsPoints[i]));
+    }
+
+    averageFacetsV = LCC::Traits::Construct_scaled_vector()
+                     ( averageFacetsV, (1.0f/ (LCC::FT) facetsPoints.size()) );
+
+    // COEFFICIENTS of PQQ - Catmull–Clark subdivision : 
+    // point = ( averageFacets + 2*averageEdges + point*(degree-3) )/degree
+
+    averageFacetsV = LCC::Traits::Construct_scaled_vector()
+      		     ( averageFacetsV, 1.0f/ (LCC::FT) degree);
+
+    averageEdgesV = LCC::Traits::Construct_scaled_vector()
+      		    ( averageEdgesV, 2.0f/ (LCC::FT) degree);
+
+    LCC::Vector pointV = LCC::Traits::Construct_scaled_vector()
+      		         ( LCC::Traits::Construct_vector() (CGAL::ORIGIN, v.point() ), 
+                         (LCC::FT) (degree-3)/ (LCC::FT) degree );
+
+    // New position of the old point.
+    LCC::Vector	newPosition = LCC::Traits::Construct_sum_of_vectors()
+      		              ( averageFacetsV, averageEdgesV);
+    
+    newPosition = LCC::Traits::Construct_sum_of_vectors()
+      		  ( newPosition, pointV);
+
+    Vertex res = LCC::Traits::Construct_translated_point() (CGAL::ORIGIN, newPosition);
+    res.set_dart (d);
+
+    return res;
+  }
+private:
+  LCC & mlcc;
+  LCC::size_type old;
+};
+
+
+// Subdivide each facet of the lcc by using pqq-subdivision.
+void
+subdivide_lcc_pqq (LCC & m)
+{
+  if (m.number_of_darts () == 0)
+    return;
+
+  LCC::size_type old = m.get_new_mark ();
+  LCC::size_type treated = m.get_new_mark ();
+  m.negate_mark (old);  // All the old darts are marked in O(1).
+
+  // 1) We subdivide each edge.
+  m.negate_mark (treated);  // All the darts are marked in O(1).
+  
+  for (LCC::Dart_range::iterator it (m.darts().begin ());
+       m.number_of_marked_darts (treated) > 0; ++it)
+  {
+    if (m.is_marked (it, treated))
+    {
+      // We unmark the darts of the facet to process only once dart/facet.
+      CGAL::unmark_cell < LCC, 1 > (m, it, treated);
+
+      // We insert barycenter in the middle of the edge.
+      m.insert_barycenter_in_cell<1>(it);
+    }
+  }
+
+  // 2) We create a barycenter point for each facets.
+  Dart_handle dc;
+  std::vector<Dart_handle> remove;
+  remove.resize(0);
+
+  m.negate_mark (treated);  // All the darts are marked in O(1).
+  for (LCC::Dart_range::iterator it (m.darts().begin ());
+       m.number_of_marked_darts (treated) > 0; ++it)
+  {
+    if (m.is_marked (it, treated))
+    {
+      // We unmark the darts of the facet to process only once dart/facet.
+      CGAL::unmark_cell < LCC, 2 > (m, it, treated);
+      // We insert barycenter of the facet.
+      dc =  m.insert_barycenter_in_cell<2>(it);
+
+      // We remove useless edges.
+      for (LCC::One_dart_per_incident_cell_range<1,0>::iterator it2 =
+             m.one_dart_per_incident_cell<1,0>(dc).begin(); 
+          it2 != m.one_dart_per_incident_cell<1,0>(dc).end(); ++it2)
+      {
+        // If the edge join the center and a corner.
+        // We remove the edge.
+        if( m.is_marked(m.beta(it2,1), old) )
+        {
+          remove.push_back(it2);
+        }
+      }
+
+      // Remove edges. 
+      for (std::vector <Dart_handle>::iterator dit = remove.begin ();
+          dit != remove.end (); ++dit)
+      {
+        CGAL_assertion( (m.is_removable<1>(*dit)) );
+        m.remove_cell<1>(*dit);
+      }
+      remove.resize(0); 
+      // CGAL_assertion( m.is_valid() );
+    }
+  }
+
+  m.negate_mark (treated);
+  CGAL_assertion (m.is_whole_map_marked (treated));
+  m.free_mark (treated);
+
+  // 3) Smooth old points. 
+  std::vector < Vertex > old_vertices; // smooth the old vertices.
+  old_vertices.reserve (m.number_of_attributes<0> ()); // get intermediate space.
+  std::transform (m.vertex_attributes().begin (), 
+		  m.vertex_attributes().end (),
+		  std::back_inserter (old_vertices), 
+		  Smooth_vertex_pqq (m, old));
+
+  // Update.
+  for (std::vector < Vertex >::iterator vit = old_vertices.begin ();
+      vit != old_vertices.end (); ++vit)
+  {
+    m.point(vit->dart())=vit->point();
+  }
+
+  // 4) Smooth new edges points.	  
+  std::vector < Vertex > vertices; // smooth the old vertices.
+  vertices.reserve (m.number_of_attributes<0> ()); // get intermediate space.
+  std::transform (m.vertex_attributes().begin (), 
+		  m.vertex_attributes().end (),
+		  std::back_inserter (vertices), 
+		  Smooth_edge_pqq (m, old));
+
+  // Update.
+  for (std::vector < Vertex >::iterator vit = vertices.begin ();
+      vit != vertices.end (); ++vit)
+  {
+    m.point(vit->dart())=vit->point();
+  }
+
+  m.unmark_all (old);
+  m.free_mark (old);
+  CGAL_postcondition ( m.is_valid ());
+}
+
diff --git a/3rdparty/CGAL/demo/Linear_cell_complex/MainWindow.cpp b/3rdparty/CGAL/demo/Linear_cell_complex/MainWindow.cpp
new file mode 100644
index 0000000..564b540
--- /dev/null
+++ b/3rdparty/CGAL/demo/Linear_cell_complex/MainWindow.cpp
@@ -0,0 +1,3390 @@
+// Copyright (c) 2011 CNRS and LIRIS' Establishments (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Guillaume Damiand <guillaume.damiand at liris.cnrs.fr>
+// Contributor(s): Kumar Snehasish <kumar.snehasish at gmail.com>
+//                 Sylvain Brandel <sylvain.brandel at liris.cnrs.fr>
+//
+#include "MainWindow.h"
+#include <CGAL/Delaunay_triangulation_3.h>
+#include <QSettings>
+#include <CGAL/Timer.h>
+#include <CGAL/ipower.h>
+#include "import_moka.h"
+
+// Function defined in Linear_cell_complex_3_subivision.cpp
+void subdivide_lcc_3 (LCC & m);
+
+// Function defined in Linear_cell_complex_pqq_subivision.cpp
+void subdivide_lcc_pqq (LCC & m);
+
+#define DELAY_STATUSMSG 1500
+
+MainWindow::MainWindow (QWidget * parent):CGAL::Qt::DemosMainWindow (parent),
+  nbcube      (0),
+  dialogmesh  (this),
+  dialogmenger(this),
+  dialogsierpinskicarpet(this),
+  dialogsierpinskitriangle(this)
+{
+  setupUi (this);
+  scene.lcc = new LCC;
+  
+  volumeListDock = new QDockWidget(QString(tr("Volume List")),this);
+  volumeListDock->setAllowedAreas(Qt::RightDockWidgetArea |
+                                  Qt::LeftDockWidgetArea);
+  volumeList = new QTableWidget(0,4,volumeListDock);
+  volumeList->verticalHeader()->hide();
+  volumeList->setColumnHidden(3,true);
+  QObject::connect(this->volumeList, SIGNAL(cellChanged(int,int)),
+                   this, SLOT(onCellChanged(int,int)));
+
+  QStringList labels(QString(tr("Color")));
+  labels.append(QString(tr("Filled")));
+  labels.append(QString(tr("Hidden")));
+  volumeList->setHorizontalHeaderLabels(labels);
+  //volumeList->resizeColumnsToContents();
+  volumeList->setFixedWidth(220);
+/*  volumeList->setColumnWidth(0,85);
+  volumeList->setColumnWidth(1,35);
+  volumeList->setColumnWidth(2,35);*/
+
+  volumeList->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
+ 
+  volumeList->setSelectionMode(QAbstractItemView::NoSelection);
+  //volumeList->setSelectionBehavior(QAbstractItemView::SelectRows);
+  volumeListDock->setWidget(volumeList);
+  addDockWidget(Qt::RightDockWidgetArea,volumeListDock);
+  menuView->addAction(volumeListDock->toggleViewAction());
+
+  QObject::connect(&dialogmesh, SIGNAL(accepted()),
+                   this, SLOT(onCreateMeshOk()));
+  this->viewer->setScene(&scene);
+
+  connect_actions ();
+  this->addAboutDemo (":/cgal/help/about_Linear_cell_complex_3.html");
+  this->addAboutCGAL ();
+
+  this->addRecentFiles (this->menuFile, this->actionQuit);
+  connect (this, SIGNAL (openRecentFile (QString)),
+           this, SLOT (load_depend_on_extension(QString)));
+
+  statusMessage = new QLabel
+      ("Darts: 0,  Vertices: 0  (Points: 0),  Edges: 0, Facets: 0,"
+       " Volume: 0 (Vol color: 0),  Connected components: 0");
+  statusBar ()->addWidget (statusMessage);
+
+}
+
+void MainWindow::connect_actions ()
+{
+  QObject::connect (this->actionQuit, SIGNAL (triggered ()),
+                    qApp, SLOT (quit ()));
+
+  QObject::connect (this, SIGNAL (sceneChanged ()),
+                    this, SLOT (onSceneChanged ()));
+
+  QObject::connect(this->volumeList->horizontalHeader(),
+                   SIGNAL(sectionClicked(int)),
+                   this, SLOT(onHeaderClicked(int)));
+  QObject::connect(dialogmenger.mengerLevel, SIGNAL(valueChanged(int)),
+                   this, SLOT(onMengerChange(int)));
+  QObject::connect(dialogmenger.updateAttributes, SIGNAL(clicked(bool)),
+                   this, SLOT(onMengerUpdateAttributes(bool)));
+  QObject::connect(&dialogmenger, SIGNAL(accepted()),
+                   this, SLOT(onMengerOk()));
+  QObject::connect(&dialogmenger, SIGNAL(rejected()),
+                   this, SLOT(onMengerCancel()));
+
+  QObject::connect(dialogsierpinskicarpet.level, SIGNAL(valueChanged(int)),
+                   this, SLOT(onSierpinskiCarpetChangeLevel(int)));
+  QObject::connect(dialogsierpinskicarpet.updateAttributes, SIGNAL(clicked(bool)),
+                   this, SLOT(onSierpinskiCarpetUpdateAttributes(bool)));
+/*  QObject::connect(dialogsierpinskicarpet.never, SIGNAL(clicked(bool)),
+                   this, SLOT(onSierpinskiCarpetNeverUpdateAttributes(bool)));
+  QObject::connect(dialogsierpinskicarpet.during, SIGNAL(clicked(bool)),
+                   this, SLOT(onSierpinskiCarpetDuringConstructionUpdateAttributes(bool)));
+  QObject::connect(dialogsierpinskicarpet.after, SIGNAL(clicked(bool)),
+                   this, SLOT(onSierpinskiCarpetAfterConstructionUpdateAttributes(bool)));
+  QObject::connect(dialogsierpinskicarpet.stdmap, SIGNAL(clicked(bool)),
+                   this, SLOT(onSierpinskiCarpetUpdateAttributesMethodStdMap(bool)));
+  QObject::connect(dialogsierpinskicarpet.traversal, SIGNAL(clicked(bool)),
+                   this, SLOT(onSierpinskiCarpetUpdateAttributesMethodTraversal(bool)));
+  QObject::connect(dialogsierpinskicarpet.computeGeometry, SIGNAL(clicked(bool)),
+                   this, SLOT(onSierpinskiCarpetComputeGeometry(bool)));*/
+  QObject::connect(&dialogsierpinskicarpet, SIGNAL(accepted()),
+                   this, SLOT(onSierpinskiCarpetOk()));
+  QObject::connect(&dialogsierpinskicarpet, SIGNAL(rejected()),
+                   this, SLOT(onSierpinskiCarpetCancel()));
+
+  QObject::connect(dialogsierpinskitriangle.level, SIGNAL(valueChanged(int)),
+                   this, SLOT(onSierpinskiTriangleChangeLevel(int)));
+  QObject::connect(dialogsierpinskitriangle.updateAttributes, SIGNAL(clicked(bool)),
+                   this, SLOT(onSierpinskiTriangleUpdateAttributes(bool)));
+  QObject::connect(&dialogsierpinskitriangle, SIGNAL(accepted()),
+                   this, SLOT(onSierpinskiTriangleOk()));
+  QObject::connect(&dialogsierpinskitriangle, SIGNAL(rejected()),
+                   this, SLOT(onSierpinskiTriangleCancel()));
+}
+
+void MainWindow::connectVolumeListHandlers()
+{
+  QObject::connect(this->volumeList, SIGNAL(cellChanged(int,int)),
+                   this, SLOT(onCellChanged(int,int)));
+}
+
+void MainWindow::update_operations_entries(bool show)
+{
+  actionImportOFF->setEnabled(show);
+  actionAddOFF->setEnabled(show);
+  actionImport3DTDS->setEnabled(show);
+  actionCompute_Voronoi_3D->setEnabled(show);
+  actionClear->setEnabled(show);
+  menuCreations->setEnabled(show);
+  menuOperations->setEnabled(show);
+}
+
+void MainWindow::onSceneChanged ()
+{
+  QApplication::setOverrideCursor( Qt::WaitCursor );
+
+  LCC::size_type mark = scene.lcc->get_new_mark ();
+  scene.lcc->negate_mark (mark);
+
+  std::vector<unsigned int> cells;
+  cells.push_back(0);
+  cells.push_back(1);
+  cells.push_back(2);
+  cells.push_back(3);
+  cells.push_back(4);
+
+  std::vector<unsigned int> res = scene.lcc->count_cells (cells);
+
+  std::ostringstream os;
+  os << "Darts: " << scene.lcc->number_of_darts ()
+     << ",  Vertices:" << res[0]
+     <<",  (Points:"<<scene.lcc->number_of_attributes<0>()<<")"
+    << ",  Edges:" << res[1]
+    << ",  Facets:" << res[2]
+    << ",  Volumes:" << res[3]
+    <<",  (Vol color:"<<scene.lcc->number_of_attributes<3>()<<")"
+   << ",  Connected components:" << res[4]
+   <<",  Valid:"<<(scene.lcc->is_valid()?"true":"FALSE");
+
+  scene.lcc->negate_mark (mark);
+  scene.lcc->free_mark (mark);
+
+  // statusBar()->showMessage (QString ("Update OpenGL lists"), DELAY_STATUSMSG);
+
+  viewer->sceneChanged ();
+
+  statusMessage->setText (os.str().c_str ());
+  QApplication::restoreOverrideCursor();
+}
+
+void MainWindow::clear_all()
+{
+  scene.lcc->clear();
+  nbcube=0;
+
+  volumeList->clearContents();
+  volumeList->setRowCount(0);
+}
+
+void MainWindow::on_new_volume(Dart_handle adart)
+{
+  CGAL_assertion( scene.lcc->attribute<3>(adart)==LCC::null_handle);
+  CGAL::Set_i_attribute_functor<LCC, 3>::
+      run(scene.lcc, adart, scene.lcc->create_attribute<3>());
+  update_volume_list_add(scene.lcc->attribute<3>(adart));
+}
+
+void MainWindow::init_all_new_volumes()
+{
+  for (LCC::One_dart_per_cell_range<3>::iterator
+       it(scene.lcc->one_dart_per_cell<3>().begin());
+       it.cont(); ++it)
+    if ( scene.lcc->attribute<3>(it)==LCC::null_handle )
+    { on_new_volume(it); }
+}
+
+void MainWindow::on_actionSave_triggered ()
+{
+  QString fileName = QFileDialog::getSaveFileName (this,
+                                                   tr ("Save"),
+                                                   "save.3map",
+                                                   tr ("3-map files (*.3map)"));
+
+  if (!fileName.isEmpty ())
+  {
+     save(fileName);
+  }
+}
+
+void MainWindow::on_actionLoad_triggered ()
+{
+  QString fileName = QFileDialog::getOpenFileName (this,
+                                                   tr ("Load"),
+                                                   "./3map",
+                                                   tr ("3-map files (*.3map)"));
+
+  if (!fileName.isEmpty ())
+  {
+    load(fileName, true);
+  }
+}
+
+void MainWindow::on_actionImportOFF_triggered ()
+{
+  QString fileName = QFileDialog::getOpenFileName (this,
+                                                   tr ("Import OFF"),
+                                                   "./off",
+                                                   tr ("off files (*.off)"));
+
+  if (!fileName.isEmpty ())
+  {
+    load_off (fileName, true);
+  }
+}
+
+void MainWindow::on_actionImportMoka_triggered()
+{
+  QString fileName = QFileDialog::getOpenFileName (this,
+                                                   tr ("Import Moka"),
+                                                   "./moka",
+                                                   tr ("Moka files (*.moka)"));
+
+  if (!fileName.isEmpty ())
+  {
+    load_moka(fileName, true);
+  }
+}
+
+void MainWindow::on_actionImport3DTDS_triggered ()
+{
+  QString fileName = QFileDialog::getOpenFileName (this,
+                                                   tr ("Import 3DTDS"),
+                                                   ".",
+                                                   tr ("Data file (*)"));
+
+  if (!fileName.isEmpty ())
+  {
+    load_3DTDS (fileName, true);
+    statusBar ()->showMessage (QString ("Import 3DTDS file") + fileName,
+                               DELAY_STATUSMSG);
+  }
+}
+
+void MainWindow::on_actionAddOFF_triggered()
+{
+  QString fileName = QFileDialog::getOpenFileName (this,
+                                                   tr ("Add OFF"),
+                                                   "./off",
+                                                   tr ("off files (*.off)"));
+
+  if (!fileName.isEmpty ())
+  {
+    load_off (fileName, false);
+  }
+}
+
+void MainWindow::load_depend_on_extension(const QString & fileName, bool clear)
+{
+  QString ext = QFileInfo(fileName).suffix();
+  if ( ext=="3map")
+  {
+    load(fileName, clear);
+  }
+  else if (ext=="off")
+  {
+    load_off(fileName, clear);
+  }
+  else if (ext=="moka")
+  {
+    load_moka(fileName, clear);
+  }
+  else
+  {
+    std::cout<<"Extension not considered."<<std::endl;
+  }
+}
+
+void MainWindow::load(const QString & fileName, bool clear)
+{
+  QApplication::setOverrideCursor (Qt::WaitCursor);
+
+  if (clear) this->clear_all();
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  CGAL::Timer timer;
+  timer.start();
+#endif
+
+  bool res = load_combinatorial_map(fileName.toStdString().c_str(), *(scene.lcc));
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  timer.stop();
+  std::cout<<"Time to load 3-map "<<qPrintable(fileName)<<": "
+           <<timer.time()<<" seconds."<<std::endl;
+#endif
+
+  recreate_whole_volume_list();
+
+  this->addToRecentFiles(fileName);
+  QApplication::restoreOverrideCursor ();
+
+  if (res)
+    statusBar ()->showMessage (QString ("3-map loaded ") + fileName,
+                               DELAY_STATUSMSG);
+  else
+    statusBar ()->showMessage (QString ("Problem: 3-map not loaded ") + fileName,
+                               DELAY_STATUSMSG);
+  Q_EMIT (sceneChanged ());
+}
+
+void MainWindow::save(const QString & fileName)
+{
+  QApplication::setOverrideCursor (Qt::WaitCursor);
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  CGAL::Timer timer;
+  timer.start();
+#endif
+
+  if ( save_combinatorial_map(*(scene.lcc), fileName.toStdString().c_str()) )
+    statusBar ()->showMessage (QString ("3-map saved ") + fileName,
+                               DELAY_STATUSMSG);
+  else
+    statusBar ()->showMessage (QString ("Problem: 3-map not saved ") + fileName,
+                               DELAY_STATUSMSG);
+  QApplication::restoreOverrideCursor ();
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  timer.stop();
+  std::cout<<"Time to save 3-map "<<qPrintable(fileName)<<": "
+           <<timer.time()<<" seconds."<<std::endl;
+#endif
+}
+
+void MainWindow::load_off (const QString & fileName, bool clear)
+{
+  QApplication::setOverrideCursor (Qt::WaitCursor);
+
+  if (clear) this->clear_all();
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  CGAL::Timer timer;
+  timer.start();
+#endif
+
+  std::ifstream ifs (qPrintable (fileName));
+
+  CGAL::import_from_polyhedron_3_flux < LCC > (*scene.lcc, ifs);
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  timer.stop();
+  std::cout<<"Time to load off "<<qPrintable(fileName)<<": "
+           <<timer.time()<<" seconds."<<std::endl;
+#endif
+
+  init_all_new_volumes();
+
+  this->addToRecentFiles (fileName);
+  QApplication::restoreOverrideCursor ();
+
+  if (clear)
+    statusBar ()->showMessage (QString ("Load off file") + fileName,
+                               DELAY_STATUSMSG);
+  else
+    statusBar ()->showMessage (QString ("Add off file") + fileName,
+                               DELAY_STATUSMSG);
+  Q_EMIT (sceneChanged ());
+}
+
+void MainWindow::load_3DTDS (const QString & fileName, bool clear)
+{
+  QApplication::setOverrideCursor (Qt::WaitCursor);
+
+  if (clear) this->clear_all();
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  CGAL::Timer timer;
+  timer.start();
+#endif
+
+  typedef CGAL::Delaunay_triangulation_3 < LCC::Traits > Triangulation;
+  Triangulation T;
+
+  std::ifstream ifs (qPrintable (fileName));
+  T.insert (std::istream_iterator < Point_3 >(ifs),
+            std::istream_iterator < Point_3 >() );
+
+  CGAL::import_from_triangulation_3 < LCC, Triangulation >(*scene.lcc, T);
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  timer.stop();
+  std::cout<<"Time to import the 3DTDS from "<<qPrintable(fileName)<<": "
+           <<timer.time()
+           <<" seconds (counting the time to compute denaulay triangulation)."
+           <<std::endl;
+#endif
+
+  init_all_new_volumes();
+
+  QApplication::restoreOverrideCursor ();
+  Q_EMIT (sceneChanged ());
+}
+
+void MainWindow::load_moka(const QString & fileName, bool clear)
+{
+  QApplication::setOverrideCursor (Qt::WaitCursor);
+
+  if (clear) this->clear_all();
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  CGAL::Timer timer;
+  timer.start();
+#endif
+
+  CGAL::import_from_moka < LCC > (*scene.lcc, qPrintable (fileName));
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  timer.stop();
+  std::cout<<"Time to load off "<<qPrintable(fileName)<<": "
+           <<timer.time()<<" seconds."<<std::endl;
+#endif
+
+  init_all_new_volumes();
+  recreate_whole_volume_list();
+
+  this->addToRecentFiles (fileName);
+  QApplication::restoreOverrideCursor ();
+
+  if (clear)
+    statusBar ()->showMessage (QString ("Load off file") + fileName,
+                               DELAY_STATUSMSG);
+  else
+    statusBar ()->showMessage (QString ("Add off file") + fileName,
+                               DELAY_STATUSMSG);
+  Q_EMIT (sceneChanged ());
+}
+
+Dart_handle MainWindow::make_iso_cuboid(const Point_3 basepoint, LCC::FT lg)
+{
+  Dart_handle dh = scene.lcc->make_hexahedron(basepoint,
+                                    LCC::Traits::Construct_translated_point()
+                                    (basepoint,LCC::Traits::Vector(lg,0,0)),
+                                    LCC::Traits::Construct_translated_point()
+                                    (basepoint,LCC::Traits::Vector(lg,lg,0)),
+                                    LCC::Traits::Construct_translated_point()
+                                    (basepoint,LCC::Traits::Vector(0,lg,0)),
+                                    LCC::Traits::Construct_translated_point()
+                                    (basepoint,LCC::Traits::Vector(0,lg,lg)),
+                                    LCC::Traits::Construct_translated_point()
+                                    (basepoint,LCC::Traits::Vector(0,0,lg)),
+                                    LCC::Traits::Construct_translated_point()
+                                    (basepoint,LCC::Traits::Vector(lg,0,lg)),
+                                    LCC::Traits::Construct_translated_point()
+                                    (basepoint,LCC::Traits::Vector(lg,lg,lg)));
+
+  scene.lcc->reverse_orientation_connected_component(dh);
+  return dh;
+}
+
+Dart_handle MainWindow::on_actionCreate_cube_triggered ()
+{
+  Point_3 basepoint(nbcube%5, (nbcube/5)%5, nbcube/25);
+
+  Dart_handle d = make_iso_cuboid(basepoint, 1);
+
+  on_new_volume(d);
+
+  ++nbcube;
+
+  statusBar ()->showMessage (QString ("Cube created"),DELAY_STATUSMSG);
+
+  Q_EMIT (sceneChanged ());
+
+  return d;
+}
+
+void MainWindow::on_actionCreate3Cubes_triggered ()
+{
+  Dart_handle d1 = make_iso_cuboid (Point_3 (nbcube, nbcube, nbcube),1);
+  Dart_handle d2 = make_iso_cuboid (Point_3 (nbcube + 1, nbcube, nbcube),1);
+  Dart_handle d3 = make_iso_cuboid (Point_3 (nbcube, nbcube + 1, nbcube), 1);
+
+  on_new_volume(d1);
+  on_new_volume(d2);
+  on_new_volume(d3);
+
+  scene.lcc->sew<3>(scene.lcc->beta(d1,1,1,2), scene.lcc->beta(d2,2));
+  scene.lcc->sew<3>(scene.lcc->beta(d1,2,1,1,2), d3);
+
+  ++nbcube;
+
+  statusBar ()->showMessage (QString ("3 cubes were created"),
+                             DELAY_STATUSMSG);
+
+  Q_EMIT (sceneChanged ());
+}
+
+void MainWindow::on_actionCreate2Volumes_triggered ()
+{
+  Dart_handle d1 = make_iso_cuboid(Point_3(nbcube, nbcube, nbcube),1);
+  Dart_handle d2 = make_iso_cuboid(Point_3(nbcube + 1, nbcube, nbcube), 1);
+  Dart_handle d3 = make_iso_cuboid(Point_3(nbcube, nbcube + 1, nbcube), 1);
+  Dart_handle d4 = make_iso_cuboid(Point_3(nbcube + 1, nbcube + 1, nbcube), 1);
+
+  scene.lcc->sew<3>(scene.lcc->beta(d1,1,1,2), scene.lcc->beta(d2,2));
+  scene.lcc->sew<3>(scene.lcc->beta(d1,2,1,1,2), d3);
+
+  scene.lcc->sew<3>(scene.lcc->beta(d3,1,1,2), scene.lcc->beta(d4,2));
+  scene.lcc->sew<3>(scene.lcc->beta(d2,2,1,1,2), d4);
+
+  scene.lcc->remove_cell<2>(d3);
+  scene.lcc->remove_cell<2>(scene.lcc->beta(d2,2));
+
+  on_new_volume(d1);
+  on_new_volume(d4);
+
+  ++nbcube;
+  statusBar ()->showMessage (QString ("2 volumes were created"),
+                             DELAY_STATUSMSG);
+
+  Q_EMIT (sceneChanged());
+}
+
+void MainWindow::on_actionCreate_mesh_triggered ()
+{
+  dialogmesh.show();
+}
+
+void MainWindow::onCreateMeshOk()
+{
+  QApplication::setOverrideCursor (Qt::WaitCursor);
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  CGAL::Timer timer;
+  timer.start();
+#endif
+
+  for (int x=0; x<dialogmesh.getX(); ++x)
+    for (int y=0; y<dialogmesh.getY(); ++y)
+      for (int z=0; z<dialogmesh.getZ(); ++z)
+      {
+        Dart_handle d = make_iso_cuboid
+          (Point_3 (x+nbcube, y+nbcube, z+nbcube), 1);
+        on_new_volume(d);
+      }
+  nbcube+=dialogmesh.getX();
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  timer.stop();
+  std::cout<<"Time to create mesh ("<<dialogmesh.getX()<<", "
+           <<dialogmesh.getY()<<", "<<dialogmesh.getZ()<<"): "
+           <<timer.time()<<" seconds."<<std::endl;
+#endif
+
+  statusBar ()->showMessage (QString ("Mesh created"),DELAY_STATUSMSG);
+
+  QApplication::restoreOverrideCursor ();
+  Q_EMIT (sceneChanged ());
+}
+
+void MainWindow::on_actionSubdivide_triggered ()
+{
+  QApplication::setOverrideCursor (Qt::WaitCursor);
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  CGAL::Timer timer;
+  timer.start();
+#endif
+
+  subdivide_lcc_3 (*(scene.lcc));
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  timer.stop();
+  std::cout<<"Time to subdivide the current LCC: "
+           <<timer.time()<<" seconds."<<std::endl;
+#endif
+
+  QApplication::restoreOverrideCursor ();
+  Q_EMIT (sceneChanged ());
+  statusBar ()->showMessage (QString ("Objects were subdivided"),
+                             DELAY_STATUSMSG);
+}
+
+void MainWindow::on_actionSubdivide_pqq_triggered ()
+{
+  QApplication::setOverrideCursor (Qt::WaitCursor);
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  CGAL::Timer timer;
+  timer.start();
+#endif
+
+  subdivide_lcc_pqq (*(scene.lcc));
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  timer.stop();
+  std::cout<<"Time to pqq-subdivide the current LCC: "
+           <<timer.time()<<" seconds."<<std::endl;
+#endif
+
+  QApplication::restoreOverrideCursor ();
+  Q_EMIT (sceneChanged ());
+  statusBar ()->showMessage (QString ("Objects were subdivided"),
+                             DELAY_STATUSMSG);
+}
+
+
+void MainWindow::on_actionClear_triggered()
+{
+  clear_all();
+  statusBar ()->showMessage (QString ("Scene cleared"), DELAY_STATUSMSG);
+  Q_EMIT (sceneChanged ());
+}
+
+void MainWindow::on_actionCompute_Voronoi_3D_triggered ()
+{
+  QString fileName = QFileDialog::getOpenFileName (this,
+                                                   tr ("Voronoi 3D"),
+                                                   ".",
+                                                   tr ("Data file (*)"));
+
+  if (fileName.isEmpty ()) return;
+
+  QApplication::setOverrideCursor (Qt::WaitCursor);
+
+  this->clear_all();
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  CGAL::Timer timer;
+  timer.start();
+#endif
+
+  typedef CGAL::Delaunay_triangulation_3 < LCC::Traits > Triangulation;
+  Triangulation T;
+
+  LCC delaunay_lcc;
+  Dart_handle dh;
+
+  std::ifstream ifs (qPrintable (fileName));
+  T.insert (std::istream_iterator < Point_3 >(ifs),
+            std::istream_iterator < Point_3 >() );
+
+  std::map<Triangulation::Cell_handle,
+      LCC::Dart_handle > vol_to_dart;
+
+  dh = CGAL::import_from_triangulation_3 < LCC, Triangulation >
+      (delaunay_lcc, T, &vol_to_dart);
+
+  Dart_handle ddh=delaunay_lcc.dual(*scene.lcc, dh);
+
+  // We transform all the darts in vol_to_dart into their dual.
+  {
+    LCC::Dart_range::iterator it1=delaunay_lcc.darts().begin();
+    LCC::Dart_range::iterator it2=scene.lcc->darts().begin();
+
+    std::map<LCC::Dart_handle, LCC::Dart_handle> dual;
+
+    for ( ; it1!=delaunay_lcc.darts().end(); ++it1, ++it2 )
+    {
+      dual[it1]=it2;
+    }
+
+    // We update the geometry of dual_lcc by using the std::map face_to_dart.
+    for ( std::map<Triangulation::Cell_handle, LCC::Dart_handle>
+          ::iterator it=vol_to_dart.begin(), itend=vol_to_dart.end();
+          it!=itend; ++it)
+    {
+      vol_to_dart[it->first]=dual[it->second];
+      if ( !T.is_infinite(it->first) )
+        scene.lcc->set_vertex_attribute
+            (it->second,scene.lcc->create_vertex_attribute(T.dual(it->first)));
+      /*       else
+                alcc.set_vertex_attribute(it->second,alcc.create_vertex_attribute());*/
+    }
+  }
+
+  // We remove the infinite volume and all its adjacent volumes.
+  {
+    std::stack<Dart_handle> toremove;
+    LCC::size_type mark_toremove=scene.lcc->get_new_mark();
+    toremove.push(ddh);
+    CGAL::mark_cell<LCC,3>(*scene.lcc, ddh, mark_toremove);
+    for (LCC::Dart_of_cell_range<3>::iterator
+         it=scene.lcc->darts_of_cell<3>(ddh).begin(),
+         itend=scene.lcc->darts_of_cell<3>(ddh).end(); it!=itend; ++it)
+    {
+      if ( !scene.lcc->is_marked(scene.lcc->beta(it,3), mark_toremove) )
+      {
+        CGAL::mark_cell<LCC,3>(*scene.lcc,
+                               scene.lcc->beta(it,3), mark_toremove);
+        toremove.push(scene.lcc->beta(it,3));
+      }
+    }
+    while( !toremove.empty() )
+    {
+      scene.lcc->remove_cell<3>(toremove.top());
+      toremove.pop();
+    }
+    CGAL_assertion(scene.lcc->is_whole_map_unmarked(mark_toremove));
+    scene.lcc->free_mark(mark_toremove);
+  }
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  timer.stop();
+  std::cout<<"Time to compute Voronoi 3D from "<<qPrintable(fileName)<<": "
+           <<timer.time()<<" seconds."<<std::endl;
+#endif
+
+  init_all_new_volumes();
+  QApplication::restoreOverrideCursor ();
+  Q_EMIT (sceneChanged ());
+  statusBar ()->showMessage (QString ("Voronoi 3D of points in ") + fileName,
+                             DELAY_STATUSMSG);
+}
+
+void MainWindow::on_actionDual_3_triggered ()
+{
+  if ( !scene.lcc->is_without_boundary(3) )
+  {
+    statusBar()->showMessage
+        (QString ("Dual impossible: the lcc has some 3-boundary"),
+         DELAY_STATUSMSG);
+    return;
+  }
+
+  QApplication::setOverrideCursor (Qt::WaitCursor);
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  CGAL::Timer timer;
+  timer.start();
+#endif
+
+  LCC* duallcc = new LCC;
+  scene.lcc->dual_points_at_barycenter(*duallcc);
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  timer.stop();
+  std::cout<<"Time to compute the dual: "
+           <<timer.time()<<" seconds."<<std::endl;
+#endif
+
+  this->clear_all();
+  delete scene.lcc;
+  scene.lcc = duallcc;
+  this->viewer->setScene(&scene);
+  init_all_new_volumes();
+
+  statusBar ()->showMessage (QString ("Dual_3 computed"), DELAY_STATUSMSG);
+  QApplication::restoreOverrideCursor ();
+  Q_EMIT (sceneChanged ());
+}
+
+void MainWindow::on_actionClose_volume_triggered()
+{
+  QApplication::setOverrideCursor (Qt::WaitCursor);
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  CGAL::Timer timer;
+  timer.start();
+#endif
+
+  if ( scene.lcc->close<3>() > 0 )
+  {
+    init_all_new_volumes();
+    statusBar ()->showMessage (QString ("All volume(s) closed"),
+                               DELAY_STATUSMSG);
+    Q_EMIT (sceneChanged ());
+  }
+  else
+    statusBar ()->showMessage
+        (QString ("LCC already 3-closed"), DELAY_STATUSMSG);
+
+  QApplication::restoreOverrideCursor ();
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  timer.stop();
+  std::cout<<"Time to 3-close the current lcc: "
+           <<timer.time()<<" seconds."<<std::endl;
+#endif
+
+}
+
+void MainWindow::on_actionSew3_same_facets_triggered()
+{
+  LCC::size_type mymark = scene.lcc->get_new_mark();
+  mark_all_filled_and_visible_volumes(mymark);
+
+  QApplication::setOverrideCursor (Qt::WaitCursor);
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  CGAL::Timer timer;
+  timer.start();
+#endif
+
+  if ( scene.lcc->sew3_same_facets(mymark) > 0 )
+  {
+    statusBar()->showMessage
+        (QString ("Same facets of visible and filled volume(s) are 3-sewn"),
+         DELAY_STATUSMSG);
+    Q_EMIT (sceneChanged ());
+  }
+  else
+    statusBar()->showMessage (QString ("No facets 3-sewn"), DELAY_STATUSMSG);
+
+  scene.lcc->free_mark(mymark);
+
+  QApplication::restoreOverrideCursor ();
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  timer.stop();
+  std::cout<<"Time to sew3 all same facets: "
+           <<timer.time()<<" seconds."<<std::endl;
+#endif
+}
+
+void MainWindow::on_actionUnsew3_all_triggered()
+{
+  unsigned int nb=0;
+  QApplication::setOverrideCursor (Qt::WaitCursor);
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  CGAL::Timer timer;
+  timer.start();
+#endif
+
+  for (LCC::Dart_range::iterator it=scene.lcc->darts().begin();
+       it!=scene.lcc->darts().end(); ++it)
+  {
+    if ( !scene.lcc->is_free(it,3) &&
+         scene.lcc->info<3>(it).is_filled_and_visible() &&
+         scene.lcc->info<3>(scene.lcc->beta(it,3))
+           .is_filled_and_visible())
+    { scene.lcc->unsew<3>(it); ++nb; }
+  }
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  timer.stop();
+  std::cout<<"Time to unsew3 all filled volumes: "
+           <<timer.time()<<" seconds."<<std::endl;
+#endif
+  QApplication::restoreOverrideCursor ();
+
+  if ( nb > 0 )
+  {
+    statusBar()->showMessage
+        (QString ("Darts between visible and filled volume(s) are 3-unsewn"),
+         DELAY_STATUSMSG);
+    Q_EMIT (sceneChanged ());
+  }
+  else
+    statusBar()->showMessage (QString ("No dart 3-unsewn"), DELAY_STATUSMSG);
+}
+
+void MainWindow::on_actionRemove_filled_volumes_triggered()
+{
+  QApplication::setOverrideCursor (Qt::WaitCursor);
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  CGAL::Timer timer;
+  timer.start();
+#endif
+
+  unsigned int count = 0;
+  for (LCC::Attribute_range<3>::type::iterator
+       it=scene.lcc->attributes<3>().begin(),
+       itend=scene.lcc->attributes<3>().end(); it!=itend; )
+  {
+    LCC::Attribute_handle<3>::type cur = it++;
+    if( scene.lcc->get_attribute<3>(cur).info().is_filled_and_visible() )
+    {
+      scene.lcc->remove_cell<3>(scene.lcc->get_attribute<3>(cur).dart());
+      ++count;
+    }
+  }
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  timer.stop();
+  std::cout<<"Time to remove all filled volumes: "
+           <<timer.time()<<" seconds."<<std::endl;
+#endif
+
+  recreate_whole_volume_list();
+  QApplication::restoreOverrideCursor ();
+  Q_EMIT( sceneChanged());
+
+  statusBar()->showMessage
+      (QString::number(count)+QString("Visible and filled volume(s) removed"),
+       DELAY_STATUSMSG);
+}
+
+void MainWindow::on_actionInsert_center_vertices_triggered()
+{
+  QApplication::setOverrideCursor (Qt::WaitCursor);
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  CGAL::Timer timer;
+  timer.start();
+#endif
+
+  std::vector<LCC::Dart_handle> v;
+  for (LCC::One_dart_per_cell_range<2>::iterator
+       it(scene.lcc->one_dart_per_cell<2>().begin()); it.cont(); ++it)
+  {
+    if ( scene.lcc->info<3>(it).is_filled_and_visible() )
+      v.push_back(it);
+  }
+  for (std::vector<LCC::Dart_handle>::iterator itv(v.begin());
+       itv!=v.end(); ++itv)
+    scene.lcc->insert_barycenter_in_cell<2>(*itv);
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  timer.stop();
+  std::cout<<"Time to insert center vertices in all filled faces: "
+           <<timer.time()<<" seconds."<<std::endl;
+#endif
+
+  QApplication::restoreOverrideCursor ();
+  Q_EMIT (sceneChanged ());
+  statusBar()->showMessage
+      (QString ("Vertices are inserted in center of facets of visible and filled volume(s)"),
+       DELAY_STATUSMSG);
+}
+
+double compute_angle3d(const Vector_3& v1, const Vector_3& v2)
+{
+  double a = CGAL::to_double( (v1*v2) /
+                              ( sqrt(v1.squared_length()) * sqrt(v2.squared_length()) ) ) ;
+
+  if (a < -1.0) return acos(-1.0)/M_PI*180.0;
+  else if (a > 1.0) return acos(1.0)/M_PI*180.0;
+  else return acos(a)/M_PI*180.0;
+}
+
+void MainWindow::on_actionMerge_coplanar_faces_triggered()
+{
+  QApplication::setOverrideCursor (Qt::WaitCursor);
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  CGAL::Timer timer;
+  timer.start();
+#endif
+
+  scene.lcc->set_update_attributes(false);
+
+  std::vector<Dart_handle> edges;
+  LCC::size_type treated  = scene.lcc->get_new_mark();
+  LCC::size_type treated2 = scene.lcc->get_new_mark();
+
+  for ( LCC::Dart_range::iterator it= scene.lcc->darts().begin(),
+          itend = scene.lcc->darts().end(); it!=itend; ++it )
+  {
+    if (!scene.lcc->is_marked(it, treated) )
+    {
+      if ( scene.lcc->is_removable<1>(it) )
+      {
+        LCC::Vector normal1 = CGAL::compute_normal_of_cell_2(*scene.lcc,it);
+        LCC::Vector normal2 = CGAL::compute_normal_of_cell_2(*scene.lcc, scene.lcc->beta<2>(it) );
+        double angle = compute_angle3d(normal1, normal2);
+
+        if ( ((angle<5.0 || angle>355.0) || (angle<185.0 && angle>175.0)) )
+        {
+          edges.push_back(it);
+        }
+      }
+      CGAL::mark_cell<LCC, 1>(*scene.lcc, it, treated);
+    }
+  }
+
+
+  for (std::vector<Dart_handle>::iterator it=edges.begin(),
+         itend=edges.end(); it!=itend; ++it)
+  {
+    CGAL::mark_cell<LCC, 1>(*scene.lcc, *it, treated2);
+
+    if ( scene.lcc->beta<0, 2>(*it)==*it || scene.lcc->beta<1, 2>(*it)==*it)
+    { // To process dangling edges
+
+      Dart_handle actu = *it, prev=NULL;
+      do
+      {
+        if ( scene.lcc->beta<0, 2>(actu)==actu ) prev = scene.lcc->beta<1>(actu);
+        else prev = scene.lcc->beta<0>(actu);
+
+        if (scene.lcc->is_marked(actu, treated2) &&
+            (scene.lcc->beta<0, 2>(actu)!=actu || scene.lcc->beta<1, 2>(actu)!=actu) )
+        {
+          scene.lcc->remove_cell<1>(actu);
+          actu = prev;
+        }
+        else
+          actu = NULL;
+      }
+      while (actu!=NULL && (scene.lcc->beta<0, 2>(actu)==actu || scene.lcc->beta<1, 2>(actu)==actu));
+    }
+    else if ( !CGAL::belong_to_same_cell<LCC, 2>(*scene.lcc, *it,
+                                                 scene.lcc->beta<2>(*it)) )
+      scene.lcc->remove_cell<1>(*it);
+  }
+
+  assert(scene.lcc->is_whole_map_marked(treated));
+  scene.lcc->free_mark(treated);
+  scene.lcc->free_mark(treated2);
+
+  scene.lcc->set_update_attributes(true);
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  timer.stop();
+  std::cout<<"Time to merge all coplanar faces: "
+           <<timer.time()<<" seconds."<<std::endl;
+#endif
+
+  recreate_whole_volume_list();
+
+  QApplication::restoreOverrideCursor ();
+  Q_EMIT (sceneChanged ());
+  statusBar()->showMessage
+      (QString ("Coplanar face(s) merged"), DELAY_STATUSMSG);
+}
+
+void MainWindow::on_actionMerge_all_volumes_triggered()
+{
+  QApplication::setOverrideCursor (Qt::WaitCursor);
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  CGAL::Timer timer;
+  timer.start();
+#endif
+
+  scene.lcc->set_update_attributes(false);
+
+  Dart_handle prev = scene.lcc->null_handle;
+  for (LCC::Dart_range::iterator it(scene.lcc->darts().begin()),
+       itend=scene.lcc->darts().end(); it!=itend; )
+  {
+    if ( !scene.lcc->is_free(it,3) &&
+         scene.lcc->info<3>(it).is_filled_and_visible() &&
+         scene.lcc->info<3>(scene.lcc->beta(it,3))
+          .is_filled_and_visible())
+    {
+      scene.lcc->remove_cell<2>(it);
+      itend=scene.lcc->darts().end();
+      if ( prev==scene.lcc->null_handle ) it=scene.lcc->darts().begin();
+      else { it=prev; if ( it!=itend ) ++it; }
+    }
+    else
+      ++it;
+  }
+
+  scene.lcc->set_update_attributes(true);
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  timer.stop();
+  std::cout<<"Time to merge all filled volumes: "
+           <<timer.time()<<" seconds."<<std::endl;
+#endif
+
+  recreate_whole_volume_list();
+
+  QApplication::restoreOverrideCursor ();
+  Q_EMIT (sceneChanged ());
+  statusBar()->showMessage
+      (QString ("Visible and filled volume(s) merged"), DELAY_STATUSMSG);
+}
+
+bool is_external(CDT::Face_handle fh)
+{
+  return fh->info().is_external;
+}
+
+int number_of_existing_edge(CDT::Face_handle fh)
+{
+  unsigned res=0;
+  for (int i=0; i<3; ++i)
+    if (fh->info().exist_edge[i]) ++res;
+  return res;
+}
+
+int get_free_edge(CDT::Face_handle fh)
+{
+  CGAL_assertion( number_of_existing_edge(fh)==2 );
+  for (int i=0; i<3; ++i)
+    if (!fh->info().exist_edge[i]) return i;
+
+  CGAL_assertion(false);
+  return -1;
+}
+
+void constrained_delaunay_triangulation(LCC &lcc, Dart_handle d1)
+{
+  Vector_3 normal = CGAL::compute_normal_of_cell_2(lcc,d1);
+  P_traits cdt_traits(normal);
+  CDT cdt(cdt_traits);
+
+  //inserting the constraints edge by edge
+  LCC::Dart_of_orbit_range<1>::iterator
+    it(lcc.darts_of_orbit<1>(d1).begin());
+
+  CDT::Vertex_handle previous=LCC::null_handle, first=LCC::null_handle,
+    vh=LCC::null_handle;
+
+   for (LCC::Dart_of_orbit_range<1>::iterator
+          itend(lcc.darts_of_orbit<1>(d1).end()); it!=itend; ++it)
+   {
+     vh = cdt.insert(lcc.point(it));
+     vh->info().dh=it;
+     if( first==NULL )
+     {
+       first=vh;
+     }
+     if( previous!=NULL)
+     {
+       CGAL_assertion( previous !=vh );
+       cdt.insert_constraint(previous,vh);
+     }
+
+     previous=vh;
+   }
+   cdt.insert_constraint(previous,first);
+   CGAL_assertion(cdt.is_valid());
+
+   // sets mark is_external
+   for( CDT::All_faces_iterator fit = cdt.all_faces_begin(),
+          fitend = cdt.all_faces_end(); fit != fitend; ++fit)
+   {
+     fit->info().is_external = true;
+     fit->info().is_process = false;
+     fit->info().exist_edge[0]=false;
+     fit->info().exist_edge[1]=false;
+     fit->info().exist_edge[2]=false;
+   }
+
+   std::queue<CDT::Face_handle> face_queue;
+   CDT::Face_handle face_internal = NULL;
+
+   face_queue.push(cdt.infinite_vertex()->face());
+   while(! face_queue.empty() )
+   {
+     CDT::Face_handle fh = face_queue.front();
+     face_queue.pop();
+     if(!fh->info().is_process)
+     {
+       fh->info().is_process = true;
+       for(int i = 0; i <3; ++i)
+       {
+         if(!cdt.is_constrained(std::make_pair(fh, i)))
+         {
+           face_queue.push(fh->neighbor(i));
+         }
+         else if (face_internal==NULL)
+         {
+           face_internal = fh->neighbor(i);
+         }
+       }
+     }
+   }
+   if ( face_internal!=NULL )
+     face_queue.push(face_internal);
+   
+   while(! face_queue.empty() )
+   {
+     CDT::Face_handle fh = face_queue.front();
+     face_queue.pop();
+     if(!fh->info().is_process)
+     {
+       fh->info().is_process = true;
+       fh->info().is_external = false;
+       for(int i = 0; i <3; ++i)
+       {
+         if(!cdt.is_constrained(std::make_pair(fh, i)))
+         {
+           face_queue.push(fh->neighbor(i));
+         }
+       }
+     }
+   }
+   
+   for( CDT::Finite_edges_iterator eit = cdt.finite_edges_begin(),
+          eitend = cdt.finite_edges_end(); eit != eitend; ++eit)
+   {
+     CDT::Face_handle fh = eit->first;
+     int index = eit->second;
+     CDT::Face_handle opposite_fh = fh->neighbor(index);
+     if(cdt.is_constrained(std::make_pair(fh, index)))
+     {
+       fh->info().exist_edge[index]=true;
+       opposite_fh->info().exist_edge[cdt.mirror_index(fh,index)]=true;
+
+       if ( !fh->info().is_external && number_of_existing_edge(fh)==2 )
+         face_queue.push(fh);
+       if ( !opposite_fh->info().is_external &&
+            number_of_existing_edge(opposite_fh)==2 )
+         face_queue.push(opposite_fh);
+     }
+   }
+
+   while( !face_queue.empty() )
+   {
+     CDT::Face_handle fh = face_queue.front();
+     face_queue.pop();
+     CGAL_assertion( number_of_existing_edge(fh)>=2 ); // i.e. ==2 or ==3
+     CGAL_assertion( !fh->info().is_external );
+
+     if (number_of_existing_edge(fh)==2)
+     {
+       int index = get_free_edge(fh);
+       CDT::Face_handle opposite_fh = fh->neighbor(index);
+
+       CGAL_assertion( !fh->info().exist_edge[index] );
+       CGAL_assertion( !opposite_fh->info().
+                       exist_edge[cdt.mirror_index(fh,index)] );
+       // triangle is (vc, vb, va)
+       const CDT::Vertex_handle va = fh->vertex(cdt. cw(index));
+       const CDT::Vertex_handle vb = fh->vertex(cdt.ccw(index));
+       const CDT::Vertex_handle vc = fh->vertex(index);
+       
+       Dart_handle dd1 = NULL;
+       for (LCC::Dart_of_cell_range<0, 2>::iterator it(lcc.darts_of_cell<0, 2>(va->info().dh).begin());
+            dd1==NULL && it.cont(); ++it)
+       {
+         if (lcc.point(lcc.beta<1>(it))==vc->point())
+           dd1=it;
+       }
+       
+       Dart_handle dd2 = NULL;
+       for (LCC::Dart_of_cell_range<0, 2>::iterator it(lcc.darts_of_cell<0, 2>(vb->info().dh).begin());
+            dd2==NULL && it.cont(); ++it)
+       {
+         if (lcc.point(lcc.beta<0>(it))==vc->point())
+           dd2=it;
+       }
+       
+       //       assert(((lcc.beta<0,0>(dd1)==dd2) || lcc.beta<1,1>(dd1)==dd2));
+       
+       Dart_handle ndart=lcc.insert_cell_1_in_cell_2(dd1, dd2);
+       va->info().dh=lcc.beta<2>(ndart);
+
+       fh->info().exist_edge[index]=true;
+       opposite_fh->info().exist_edge[cdt.mirror_index(fh,index)]=true;
+
+       if ( !opposite_fh->info().is_external &&
+            number_of_existing_edge(opposite_fh)==2 )
+         face_queue.push(opposite_fh);
+     }
+   }
+}
+
+void MainWindow::on_actionTriangulate_all_facets_triggered()
+{
+  QApplication::setOverrideCursor (Qt::WaitCursor);
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  CGAL::Timer timer;
+  timer.start();
+#endif
+
+  std::vector<LCC::Dart_handle> v;
+  for (LCC::One_dart_per_cell_range<2>::iterator
+       it(scene.lcc->one_dart_per_cell<2>().begin()); it.cont(); ++it)
+  {
+    if ( scene.lcc->info<3>(it).is_filled_and_visible() ||
+         (!scene.lcc->is_free<3>(it) &&
+          scene.lcc->info<3>(scene.lcc->beta<3>(it)).is_filled_and_visible()) )
+      v.push_back(it);
+  }
+
+  for (std::vector<LCC::Dart_handle>::iterator itv(v.begin());
+       itv!=v.end(); ++itv)
+    constrained_delaunay_triangulation(*scene.lcc, *itv);
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  timer.stop();
+  std::cout<<"Time to triangulate all filled faces: "
+           <<timer.time()<<" seconds."<<std::endl;
+#endif
+
+  recreate_whole_volume_list();
+
+  QApplication::restoreOverrideCursor ();
+  Q_EMIT (sceneChanged ());
+  statusBar()->showMessage
+      (QString ("All visible and filled faces were triangulated"), DELAY_STATUSMSG);
+}
+
+bool MainWindow::is_volume_in_list(LCC::Attribute_handle<3>::type ah)
+{
+  for(int row=0; row < volumeList->rowCount(); ++row)
+  {
+    LCC::Attribute_type<3>::type* ptr=
+        reinterpret_cast<LCC::Attribute_type<3>::type*>
+        ( volumeList->item(row,3)->data(Qt::UserRole).value<quintptr>() );
+
+    if(ptr==&(scene.lcc->get_attribute<3>(ah))) return true;
+  }
+
+  return false;
+}
+
+void MainWindow::update_volume_list_add(LCC::Attribute_handle<3>::type ah)
+{
+  // CGAL_assertion( !is_volume_in_list(ah) );
+
+  volumeList->disconnect(this);
+
+  int newRow = volumeList->rowCount();
+  volumeList->setRowCount(newRow+1);
+
+  QTableWidgetItem* volumeLabel = new QTableWidgetItem
+    (QString((scene.lcc->get_attribute<3>(ah).info().color_name().c_str())));
+  volumeLabel->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
+  volumeLabel->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
+  volumeList->setItem(newRow,0,volumeLabel);
+
+  QTableWidgetItem* fillCB = new QTableWidgetItem;
+  fillCB->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+  if ( scene.lcc->get_attribute<3>(ah).info().is_filled() )
+    fillCB->setCheckState(Qt::Checked);
+  else
+    fillCB->setCheckState(Qt::Unchecked);
+  volumeList->setItem(newRow,1, fillCB);
+
+  QTableWidgetItem* hiddenCB = new QTableWidgetItem();
+  hiddenCB->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+  if ( scene.lcc->get_attribute<3>(ah).info().is_visible() )
+    hiddenCB->setCheckState(Qt::Unchecked);
+  else
+    hiddenCB->setCheckState(Qt::Checked);
+  volumeList->setItem(newRow,2,hiddenCB);
+
+  QTableWidgetItem* attribHandle = new QTableWidgetItem;
+  attribHandle->setData
+      (Qt::UserRole,
+       reinterpret_cast<quintptr>(&scene.lcc->get_attribute<3>(ah)));
+
+  volumeList->setItem(newRow,3,attribHandle);
+
+  connectVolumeListHandlers();
+}
+
+void MainWindow::update_volume_list_remove(int i)
+{
+  CGAL_assertion(i<volumeList->rowCount());
+  volumeList->removeRow(i);
+}
+
+void MainWindow::update_volume_list_remove(LCC::Attribute_handle<3>::type ah)
+{
+  for(int row=0; row < volumeList->rowCount(); ++row)
+  {
+    LCC::Attribute_type<3>::type* ptr=
+        reinterpret_cast<LCC::Attribute_type<3>::type*>
+        ( volumeList->item(row,3)->data(Qt::UserRole).value<quintptr>() );
+
+    if(ptr==&scene.lcc->get_attribute<3>(ah))
+    {
+      update_volume_list_remove(row);
+      return;
+    }
+  }
+}
+
+void MainWindow::update_volume_list_all_ckeckstates()
+{
+  volumeList->disconnect(this);
+
+  for(int row=0; row < volumeList->rowCount(); ++row)
+  {
+    LCC::Attribute_type<3>::type* ptr=
+        reinterpret_cast<LCC::Attribute_type<3>::type*>
+        ( volumeList->item(row,3)->data(Qt::UserRole).value<quintptr>() );
+
+    if ( ptr->info().is_filled() )
+      volumeList->item(row,1)->setCheckState(Qt::Checked);
+    else
+      volumeList->item(row,1)->setCheckState(Qt::Unchecked);
+
+    if ( !ptr->info().is_visible() )
+      volumeList->item(row,2)->setCheckState(Qt::Checked);
+    else
+      volumeList->item(row,2)->setCheckState(Qt::Unchecked);
+  }
+
+  connectVolumeListHandlers();
+}
+
+void MainWindow::recreate_whole_volume_list()
+{
+  volumeList->clearContents();
+  volumeList->setRowCount(0);
+
+  for (LCC::Attribute_range<3>::type::iterator
+       it=scene.lcc->attributes<3>().begin(),
+       itend=scene.lcc->attributes<3>().end(); it!=itend; ++it)
+    update_volume_list_add(it);
+}
+
+void MainWindow::onCellChanged(int row, int col)
+{
+  volumeList->disconnect(this);
+
+  LCC::Attribute_type<3>::type* ptr=
+      reinterpret_cast<LCC::Attribute_type<3>::type*>
+      ( volumeList->item(row,3)->data(Qt::UserRole).value<quintptr>() );
+
+  if ( col==1 )
+  {
+    ptr->info().negate_filled();
+  }
+  else if ( col==2 )
+  {
+    ptr->info().negate_visible();
+    if ( !ptr->info().is_visible() )
+      volumeList->item(row,1)->setFlags
+          (volumeList->item(row,1)->flags()^Qt::ItemIsEnabled);
+    else
+      volumeList->item(row,1)->setFlags
+          (volumeList->item(row,1)->flags()|Qt::ItemIsEnabled);
+  }
+
+  connectVolumeListHandlers();
+  Q_EMIT( sceneChanged());
+}
+
+void MainWindow::onHeaderClicked(int col)
+{
+  if(col != 0)
+  {
+    volumeList->disconnect(this);
+
+    for(int i = 0; i < volumeList->rowCount(); ++i)
+    {
+      LCC::Attribute_type<3>::type* ptr=
+          reinterpret_cast<LCC::Attribute_type<3>::type*>
+          ( volumeList->item(i,3)->data(Qt::UserRole).value<quintptr>() );
+
+      switch(qApp->keyboardModifiers())
+      {
+      case(Qt::ShiftModifier):
+        if (col==1)
+          ptr->info().set_filled(false);
+        else if (col==2)
+        {
+          ptr->info().set_visible(true);
+          volumeList->item(i,1)->setFlags
+              (volumeList->item(i,1)->flags()|Qt::ItemIsEnabled);
+        }
+        volumeList->item(i,col)->setCheckState(Qt::Unchecked);
+        break;
+      case(Qt::ControlModifier):
+        if (col==1)
+          ptr->info().negate_filled();
+        else if (col==2)
+        {
+          ptr->info().negate_visible();
+          if ( !ptr->info().is_visible() )
+            volumeList->item(i,1)->setFlags
+                (volumeList->item(i,1)->flags()^Qt::ItemIsEnabled);
+          else
+            volumeList->item(i,1)->setFlags
+                (volumeList->item(i,1)->flags()|Qt::ItemIsEnabled);
+        }
+        volumeList->item(i,col)->
+            setCheckState(volumeList->item(i,col)->checkState() ?
+                            Qt::Unchecked: Qt::Checked);
+        break;
+      default:
+        if (col==1)
+          ptr->info().set_filled(true);
+        else if (col==2)
+        {
+          if ( ptr->info().is_visible() )
+          {
+            ptr->info().set_visible(false);
+            volumeList->item(i,1)->setFlags
+              (volumeList->item(i,1)->flags()^Qt::ItemIsEnabled);
+          }
+        }
+        volumeList->item(i,col)->setCheckState(Qt::Checked);
+        break;
+      }
+    }
+
+    connectVolumeListHandlers();
+    Q_EMIT( sceneChanged());
+  }
+}
+
+void MainWindow::mark_all_filled_and_visible_volumes(LCC::size_type amark)
+{
+  for (LCC::Attribute_range<3>::type::iterator
+       it=scene.lcc->attributes<3>().begin(),
+       itend=scene.lcc->attributes<3>().end(); it!=itend; ++it)
+  {
+    if ( scene.lcc->get_attribute<3>(it).info().is_filled_and_visible() &&
+         !scene.lcc->is_marked(it->dart(), amark) )
+      CGAL::mark_cell<LCC,3>(*scene.lcc,
+                             scene.lcc->get_attribute<3>(it).dart(), amark);
+  }
+}
+
+void MainWindow::on_actionExtend_filled_volumes_triggered()
+{
+  volumeList->disconnect(this);
+
+  std::vector<LCC::Attribute_handle<3>::type> tofill;
+
+  LCC::size_type mark_volume = scene.lcc->get_new_mark();
+  bool already_tofill;
+
+  for (LCC::Attribute_range<3>::type::iterator
+       it=scene.lcc->attributes<3>().begin(),
+       itend=scene.lcc->attributes<3>().end(); it!=itend; ++it)
+  {
+    if ( !scene.lcc->is_marked(it->dart(), mark_volume) )
+    {
+      if ( !scene.lcc->get_attribute<3>(it).info().is_filled() )
+      {
+        already_tofill = false;
+        for (LCC::Dart_of_cell_basic_range<3>::iterator it2=
+               scene.lcc->darts_of_cell_basic<3>(it->dart(), mark_volume).begin();
+             it2.cont(); ++it2 )
+        {
+          scene.lcc->mark(it2, mark_volume);
+          if ( !scene.lcc->is_free(it2,3) &&
+               scene.lcc->info<3>(scene.lcc->beta(it2,3)).
+                 is_filled() && !already_tofill)
+          {
+            tofill.push_back(scene.lcc->attribute<3>(it2));
+            already_tofill = true;
+          }
+        }
+      }
+      else
+        CGAL::mark_cell<LCC,3>(*scene.lcc, it->dart(), mark_volume);
+    }
+  }
+
+  CGAL_assertion( scene.lcc->is_whole_map_marked(mark_volume) );
+  scene.lcc->free_mark(mark_volume);
+
+  if ( tofill.size()>0 )
+  {
+    for ( std::vector<LCC::Attribute_handle<3>::type>::iterator
+            it=tofill.begin(), itend=tofill.end(); it!=itend; ++it )
+    {
+      scene.lcc->get_attribute<3>(*it).info().set_filled(true);
+    }
+
+    update_volume_list_all_ckeckstates();
+    Q_EMIT( sceneChanged());
+  }
+
+  connectVolumeListHandlers();
+}
+
+void MainWindow::on_actionExtend_hidden_volumes_triggered()
+{
+  volumeList->disconnect(this);
+
+  std::vector<LCC::Attribute_handle<3>::type> tohide;
+
+  LCC::size_type mark_volume = scene.lcc->get_new_mark();
+  bool already_tohide;
+
+  for (LCC::Attribute_range<3>::type::iterator
+       it=scene.lcc->attributes<3>().begin(),
+       itend=scene.lcc->attributes<3>().end(); it!=itend; ++it)
+  {
+    if ( !scene.lcc->is_marked(it->dart(), mark_volume) )
+    {
+      if ( scene.lcc->get_attribute<3>(it).info().is_visible() )
+      {
+        already_tohide = false;
+        for (LCC::Dart_of_cell_basic_range<3>::iterator it2=
+               scene.lcc->darts_of_cell_basic<3>(it->dart(), mark_volume).begin();
+             it2.cont(); ++it2 )
+        {
+          scene.lcc->mark(it2, mark_volume);
+          if ( !scene.lcc->is_free(it2,3) &&
+               !scene.lcc->info<3>(scene.lcc->beta(it2,3)).
+                  is_visible() && !already_tohide)
+          {
+            tohide.push_back(scene.lcc->attribute<3>(it2));
+            already_tohide = true;
+          }
+        }
+      }
+      else
+        CGAL::mark_cell<LCC,3>(*scene.lcc, it->dart(), mark_volume);
+    }
+  }
+
+  CGAL_assertion( scene.lcc->is_whole_map_marked(mark_volume) );
+  scene.lcc->free_mark(mark_volume);
+
+  if ( tohide.size()>0 )
+  {
+    for ( std::vector<LCC::Attribute_handle<3>::type>::iterator
+            it=tohide.begin(), itend=tohide.end(); it!=itend; ++it )
+    {
+      scene.lcc->get_attribute<3>(*it).info().set_visible(false);
+    }
+
+    update_volume_list_all_ckeckstates();
+    Q_EMIT( sceneChanged());
+  }
+
+  connectVolumeListHandlers();
+}
+
+void MainWindow::on_actionCreate_Menger_Sponge_triggered ()
+{
+  dialogmenger.mengerLevel->disconnect(this);
+
+  mengerUpdateAttributes = dialogmenger.updateAttributes->isChecked();
+
+  dialogmenger.mengerLevel->setValue(0);
+  mengerLevel=0;
+  CGAL_assertion( mengerVolumes.empty() );
+  mengerVolumes.push_back(on_actionCreate_cube_triggered());
+  update_operations_entries(false);
+
+  QObject::connect(dialogmenger.mengerLevel, SIGNAL(valueChanged(int)),
+                   this, SLOT(onMengerChange(int)));
+
+  dialogmenger.show();
+}
+
+void MainWindow::onMengerCancel()
+{
+  for(std::vector<Dart_handle>::iterator it=mengerVolumes.begin();
+      it!=mengerVolumes.end(); ++it)
+  {
+    scene.lcc->remove_cell<3>(*it);
+  }
+
+  recreate_whole_volume_list();
+  mengerVolumes.clear();
+  update_operations_entries(true);
+  statusBar()->showMessage (QString ("Menger sponge creation canceled"),
+                            DELAY_STATUSMSG);
+  Q_EMIT( sceneChanged());
+}
+
+void MainWindow::onMengerOk()
+{
+  update_operations_entries(true);
+  mengerVolumes.clear();
+}
+
+void MainWindow::onMengerChange(int newLevel)
+{
+  while ( newLevel > mengerLevel ) onMengerInc();
+  while ( newLevel < mengerLevel ) onMengerDec();
+}
+
+void MainWindow::onMengerUpdateAttributes(bool newValue)
+{
+  mengerUpdateAttributes = newValue;
+}
+
+void MainWindow::onMengerInc()
+{
+  QApplication::setOverrideCursor (Qt::WaitCursor);
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  CGAL::Timer timer;
+  timer.start();
+#endif
+
+  this->mengerLevel++;
+
+  if (!mengerUpdateAttributes)
+  {
+    scene.lcc->set_update_attributes(false);
+  }
+
+  std::vector<Dart_handle> edges;
+  std::vector<Dart_handle> faces;
+  std::size_t nbvolinit = mengerVolumes.size();
+
+  LCC::size_type markEdges = (scene.lcc)->get_new_mark();
+  LCC::size_type markFaces = (scene.lcc)->get_new_mark();
+  LCC::size_type markVols  = (scene.lcc)->get_new_mark();
+
+  for(std::vector<Dart_handle>::iterator itvol=mengerVolumes.begin();
+        itvol!=mengerVolumes.end(); ++itvol)
+  {
+    CGAL_assertion( !(scene.lcc)->is_marked(*itvol, markVols) );
+    for (LCC::Dart_of_cell_basic_range<3>::iterator
+         it=(scene.lcc)->darts_of_cell_basic<3>(*itvol, markVols).begin(),
+         itend=(scene.lcc)->darts_of_cell_basic<3>(*itvol, markVols).end();
+         it!=itend; ++it)
+    {
+      if ( !(scene.lcc)->is_marked(it, markEdges) )
+      {
+        edges.push_back(it);
+        CGAL::mark_cell<LCC,1>(*(scene.lcc), it, markEdges);
+      }
+      if ( !(scene.lcc)->is_marked(it, markFaces) )
+      {
+        faces.push_back(it);
+        CGAL::mark_cell<LCC,2>(*(scene.lcc), it, markFaces);
+      }
+    }
+  }
+
+  (scene.lcc)->negate_mark(markVols);
+  for(std::vector<Dart_handle>::iterator itvol=mengerVolumes.begin();
+        itvol!=mengerVolumes.end(); ++itvol)
+  {
+    for (LCC::Dart_of_cell_basic_range<3>::iterator
+         it=(scene.lcc)->darts_of_cell_basic<3>(*itvol, markVols).begin(),
+         itend=(scene.lcc)->darts_of_cell_basic<3>(*itvol, markVols).end();
+         it!=itend; ++it)
+    {
+      (scene.lcc)->unmark(it, markEdges);
+      (scene.lcc)->unmark(it, markFaces);
+    }
+  }
+
+  (scene.lcc)->negate_mark(markVols);
+  CGAL_assertion( (scene.lcc)->is_whole_map_unmarked(markVols) );
+  CGAL_assertion( (scene.lcc)->is_whole_map_unmarked(markFaces) );
+  CGAL_assertion( (scene.lcc)->is_whole_map_unmarked(markEdges) );
+
+  (scene.lcc)->free_mark(markEdges);
+  (scene.lcc)->free_mark(markFaces);
+  (scene.lcc)->free_mark(markVols);
+
+  for(std::size_t i = 0; i < edges.size(); i++)
+  {
+    split_edge_in_three(edges[i]);
+  }
+  edges.clear();
+
+  for(std::size_t i = 0; i < faces.size(); i++)
+  {
+    split_face_in_nine(faces[i]);
+  }
+  faces.clear();
+
+  for(std::size_t i = 0; i < nbvolinit; i++)
+  {
+    split_vol_in_twentyseven(mengerVolumes[i]);
+  }
+
+  if (!mengerUpdateAttributes)
+  {
+    for(std::size_t i = nbvolinit; i < mengerVolumes.size(); i++)
+    {
+      LCC::Attribute_handle<3>::type ah = (scene.lcc)->create_attribute<3>();
+      scene.lcc->set_attribute<3>(mengerVolumes[i], ah);
+      scene.lcc->info<3>(mengerVolumes[i]).color()=
+          (CGAL::Color(myrandom.get_int(0,256),
+                       myrandom.get_int(0,256),
+                       myrandom.get_int(0,256)));
+
+        update_volume_list_add(scene.lcc->attribute<3>(mengerVolumes[i]));
+    }
+
+    scene.lcc->set_update_attributes(true);
+  }
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  timer.stop();
+  std::cout<<"Menger sponge "
+           <<this->mengerLevel-1<<" -> "<<this->mengerLevel<<", "
+          <<"attributes updated "
+         <<(mengerUpdateAttributes ? "DURING" : "AFTER")
+        << " construction: "
+        <<timer.time()<<" seconds."<<std::endl;
+#endif
+
+  CGAL_assertion( (scene.lcc)->is_valid() );
+
+  QApplication::restoreOverrideCursor ();
+  statusBar()->showMessage(QString ("Menger sponge creation %1 -> %2").
+                           arg(this->mengerLevel-1).arg(this->mengerLevel),
+                           DELAY_STATUSMSG);
+
+  Q_EMIT( sceneChanged());
+}
+
+void MainWindow::split_edge_in_three(Dart_handle dh)
+{
+  LCC::Point p1 = scene.lcc->point(dh);
+  LCC::Point p2 = scene.lcc->point(scene.lcc->other_extremity(dh));
+
+  LCC::Vector v1 = LCC::Traits::Construct_vector() (p1,p2);
+  LCC::Vector v2 = LCC::Traits::Construct_scaled_vector() (v1,1.0/3);
+  LCC::Vector v3 = LCC::Traits::Construct_scaled_vector() (v1,2.0/3);
+
+  LCC::Point p3 = LCC::Traits::Construct_translated_point() (p1,v2);
+  LCC::Point p4 = LCC::Traits::Construct_translated_point() (p1,v3);
+
+  (scene.lcc)->insert_point_in_cell<1>(dh,p4);
+  (scene.lcc)->insert_point_in_cell<1>(dh,p3);
+}
+
+void MainWindow::split_face_in_three(Dart_handle dh)
+{
+  scene.lcc->insert_cell_1_in_cell_2(scene.lcc->beta(dh,1,1,1),
+                                     scene.lcc->beta(dh,0,0));
+  scene.lcc->insert_cell_1_in_cell_2(scene.lcc->beta(dh,1,1),
+                                     scene.lcc->beta(dh,0));
+}
+
+void MainWindow::split_face_in_nine(Dart_handle dh)
+{
+  Dart_handle d2 = scene.lcc->beta(dh,1,1,1,1,1,1,1);
+
+  Dart_handle e2= scene.lcc->insert_cell_1_in_cell_2
+    (scene.lcc->beta(dh,1,1),d2);
+  Dart_handle e1= scene.lcc->insert_cell_1_in_cell_2
+    (scene.lcc->beta(dh,1),scene.lcc->beta(d2,1));
+
+  split_edge_in_three(e1);
+  split_edge_in_three(e2);
+
+  split_face_in_three(dh);
+  split_face_in_three(d2);
+  split_face_in_three(scene.lcc->beta(e2,0));
+}
+
+void MainWindow::split_vol_in_three(Dart_handle dh, bool removecenter)
+{
+  std::vector<Dart_handle> edges1;
+  std::vector<Dart_handle> edges2;
+
+  Dart_handle curd = scene.lcc->beta(dh,2,1,1,2);
+  for (unsigned int i=0;i<4;++i)
+  {
+    edges1.push_back(curd);
+    curd=scene.lcc->beta(curd,1,2,1);
+  }
+  CGAL_assertion( curd==scene.lcc->beta(dh,2,1,1,2) );
+
+  curd = scene.lcc->beta(curd,1,1,2);
+  for (unsigned int i=0;i<4;++i)
+  {
+    edges2.push_back(curd);
+    curd=scene.lcc->beta(curd,1,2,1);
+  }
+  CGAL_assertion( curd==
+                  scene.lcc->beta(dh,2,1,1,2,1,1,2) );
+
+  Dart_handle f1=
+      scene.lcc->insert_cell_2_in_cell_3(edges1.begin(),edges1.end());
+
+  Dart_handle f2=
+      scene.lcc->insert_cell_2_in_cell_3(edges2.begin(),edges2.end());
+
+  if (scene.lcc->are_attributes_automatically_managed())
+  {
+    scene.lcc->info<3>(f1).color()=
+      (CGAL::Color(myrandom.get_int(0,256),
+                   myrandom.get_int(0,256),
+                   myrandom.get_int(0,256)));
+    scene.lcc->info<3>(f2).color()=
+      (CGAL::Color(myrandom.get_int(0,256),
+                   myrandom.get_int(0,256),
+                   myrandom.get_int(0,256)));
+
+    update_volume_list_add(scene.lcc->attribute<3>(dh));
+  }
+
+  if ( removecenter )
+    scene.lcc->remove_cell<3>(f1);
+  else
+  {
+    mengerVolumes.push_back(f1);
+
+    if (scene.lcc->are_attributes_automatically_managed())
+      update_volume_list_add(scene.lcc->attribute<3>(f1));
+  }
+
+  mengerVolumes.push_back(f2);
+}
+
+void MainWindow::split_vol_in_nine(Dart_handle dh, bool removecenter)
+{
+  std::vector<Dart_handle> edges1;
+  std::vector<Dart_handle> edges2;
+
+  Dart_handle curd = scene.lcc->beta(dh,1,2);
+  for (unsigned int i=0;i<8;++i)
+  {
+    edges1.push_back(curd);
+    curd=scene.lcc->beta(curd,1,2,1);
+  }
+  CGAL_assertion( curd==scene.lcc->beta(dh,1,2) );
+
+  curd = scene.lcc->beta(curd,1,1,2);
+  for (unsigned int i=0;i<8;++i)
+  {
+    edges2.push_back(curd);
+    curd=scene.lcc->beta(curd,1,2,1);
+  }
+  CGAL_assertion( curd==scene.lcc->beta(dh,1,2,1,1,2) );
+
+  Dart_handle f1=
+      scene.lcc->insert_cell_2_in_cell_3(edges1.begin(),edges1.end());
+
+  Dart_handle f2=
+      scene.lcc->insert_cell_2_in_cell_3(edges2.begin(),edges2.end());
+
+  if (scene.lcc->are_attributes_automatically_managed())
+  {
+    scene.lcc->info<3>(f1).color()=
+      (CGAL::Color(myrandom.get_int(0,256),
+                   myrandom.get_int(0,256),
+                   myrandom.get_int(0,256)));
+    scene.lcc->info<3>(f2).color()=
+      (CGAL::Color(myrandom.get_int(0,256),
+                   myrandom.get_int(0,256),
+                   myrandom.get_int(0,256)));
+
+    update_volume_list_add(scene.lcc->attribute<3>(dh));
+    if ( !removecenter)
+      update_volume_list_add(scene.lcc->attribute<3>(f1));
+  }
+
+  split_face_in_three(f1);
+  split_face_in_three(f2);
+
+  split_vol_in_three(dh,removecenter);
+
+  mengerVolumes.push_back(scene.lcc->beta(f2,2,1));
+  split_vol_in_three(scene.lcc->beta(f2,2,1),removecenter);
+
+  if ( removecenter )
+    scene.lcc->remove_cell<3>(f1);
+  else
+  {
+    mengerVolumes.push_back(scene.lcc->beta(f1,2,1));
+    split_vol_in_three(scene.lcc->beta(f1,2,1),true);
+  }
+}
+
+void MainWindow::split_vol_in_twentyseven(Dart_handle dh)
+{
+  std::vector<Dart_handle> edges1;
+  std::vector<Dart_handle> edges2;
+
+  Dart_handle curd = scene.lcc->beta(dh,1,1,2);
+  for (unsigned int i=0;i<12;++i)
+  {
+    edges1.push_back(curd);
+    curd=scene.lcc->beta(curd,1,2,1);
+  }
+  CGAL_assertion( curd==scene.lcc->beta(dh,1,1,2) );
+
+  curd = scene.lcc->beta(curd,1,1,2);
+  for (unsigned int i=0;i<12;++i)
+  {
+    edges2.push_back(curd);
+    curd=scene.lcc->beta(curd,1,2,1);
+  }
+  CGAL_assertion( curd==scene.lcc->beta(dh,1,1,2,1,1,2) );
+
+  Dart_handle f1=
+      scene.lcc->insert_cell_2_in_cell_3(edges1.begin(),edges1.end());
+
+  Dart_handle f2=
+      scene.lcc->insert_cell_2_in_cell_3(edges2.begin(),edges2.end());
+
+  if (scene.lcc->are_attributes_automatically_managed())
+  {
+    scene.lcc->info<3>(f1).color()=
+      (CGAL::Color(myrandom.get_int(0,256),
+                   myrandom.get_int(0,256),
+                   myrandom.get_int(0,256)));
+    scene.lcc->info<3>(f2).color()=
+      (CGAL::Color(myrandom.get_int(0,256),
+                   myrandom.get_int(0,256),
+                   myrandom.get_int(0,256)));
+    update_volume_list_add(scene.lcc->attribute<3>(dh));
+    update_volume_list_add(scene.lcc->attribute<3>(f1));
+
+  }
+
+  mengerVolumes.push_back(scene.lcc->beta(f1,2));
+  mengerVolumes.push_back(scene.lcc->beta(f2,2));
+
+  split_face_in_nine(scene.lcc->beta(f1,1));
+  split_face_in_nine(scene.lcc->beta(f2,1));
+
+  split_vol_in_nine(dh,false);
+  split_vol_in_nine(scene.lcc->beta(f1,2),true);
+  split_vol_in_nine(scene.lcc->beta(f2,2),false);
+}
+
+void MainWindow::process_full_slice(Dart_handle init,
+                                  std::vector<Dart_handle>& faces,
+                                  LCC::size_type markVols)
+{
+  Dart_handle d[12];
+  d[0]=scene.lcc->beta(init,1,2);
+  d[1]=scene.lcc->beta(d[0],3,1,2,1);
+  d[2]=scene.lcc->beta(d[1],1,2,1);
+  d[3]=scene.lcc->beta(d[2],3,1,2,1);
+
+  d[4]=scene.lcc->beta(init,1,1,2);
+  d[5]=scene.lcc->beta(d[4],3,0,2,0);
+  d[6]=scene.lcc->beta(d[5],0,2,0);
+
+  d[7]=scene.lcc->beta(d[6],3,0,2,0);
+  d[8]=scene.lcc->beta(d[7],3,0,2,0);
+  d[9]=scene.lcc->beta(d[8],0,2,0);
+
+  d[10]=scene.lcc->beta(d[9],3,0,2,0);
+  d[11]=scene.lcc->beta(d[10],3,0,2,0);
+
+  for (unsigned int j=0; j<12; ++j)
+  {
+    if ( !(scene.lcc)->is_marked(d[j], markVols) )
+    {
+      CGAL::mark_cell<LCC,3>(*(scene.lcc), d[j], markVols);
+    }
+    faces.push_back(d[j]);
+  }
+}
+
+void MainWindow::process_inter_slice(Dart_handle init,
+                                   std::vector<Dart_handle>& faces,
+                                   LCC::size_type markVols)
+{
+  Dart_handle d[24];
+  d[0]=init;
+  d[1]=scene.lcc->beta(d[0],0,2,3,2,0);
+  d[2]=scene.lcc->beta(d[1],0,2,3,2,0);
+  d[3]=scene.lcc->beta(d[2],1,1,2,3,2);
+  d[4]=scene.lcc->beta(d[3],1,1,2,3,2);
+  d[5]=scene.lcc->beta(d[0],1,1,2,3,2);
+  d[6]=scene.lcc->beta(d[5],1,1,2,3,2);
+  d[7]=scene.lcc->beta(d[6],0,2,3,2,0);
+
+  init = scene.lcc->beta(init,3,2,1,1,2);
+  d[8]=init;
+  d[9]=scene.lcc->beta(d[8],3,1,2,3,2,1);
+  d[10]=scene.lcc->beta(d[9],1,2,3,2,1,3);
+  d[11]=scene.lcc->beta(d[10],3,0,0,2,3,2);
+  d[12]=scene.lcc->beta(d[11],0,0,2,3,2,3);
+  d[13]=scene.lcc->beta(d[8],3,0,0,2,3,2);
+  d[14]=scene.lcc->beta(d[13],0,0,2,3,2,3);
+  d[15]=scene.lcc->beta(d[14],3,1,2,3,2,1);
+
+  d[16]=scene.lcc->beta(d[0],3,1,2);
+  d[17]=scene.lcc->beta(d[0],3,1,1,2);
+
+  d[18]=scene.lcc->beta(d[4],3,2);
+  d[19]=scene.lcc->beta(d[4],3,0,2);
+
+  d[20]=scene.lcc->beta(d[2],3,0,2);
+  d[21]=scene.lcc->beta(d[2],3,1,1,2);
+
+  d[22]=scene.lcc->beta(d[6],3,2);
+  d[23]=scene.lcc->beta(d[6],3,1,2);
+
+  for (unsigned int j=0; j<24; ++j)
+  {
+    CGAL_assertion( d[j]!=(scene.lcc)->null_dart_handle );
+    if ( !(scene.lcc)->is_marked(d[j], markVols) )
+    {
+      CGAL::mark_cell<LCC,3>(*(scene.lcc), d[j], markVols);
+    }
+    faces.push_back(d[j]);
+  }
+}
+
+void MainWindow::onMengerDec()
+{
+  QApplication::setOverrideCursor (Qt::WaitCursor);
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  CGAL::Timer timer;
+  timer.start();
+#endif
+
+  this->mengerLevel--;
+
+  // We know here the number of Menger volume: 20^mengerLevel
+  // thus we can directly "cut" the std::vector to the correct size.
+  mengerVolumes.resize(CGAL::ipower(20,mengerLevel));
+
+  LCC::size_type markVols     = (scene.lcc)->get_new_mark();
+  LCC::size_type markVertices = (scene.lcc)->get_new_mark();
+
+  std::vector<Dart_handle> faces;
+  std::vector<Dart_handle> edges;
+  std::vector<Dart_handle> vertices;
+
+  // First we remove faces.
+  for ( std::vector<Dart_handle>::iterator itvol=mengerVolumes.begin();
+        itvol!=mengerVolumes.end(); ++itvol)
+  {
+    if ( !(scene.lcc)->is_marked(*itvol, markVols) )
+    {
+      Dart_handle init=*itvol;
+      CGAL::mark_cell<LCC,3>(*(scene.lcc), init, markVols);
+      process_full_slice(init, faces, markVols);
+      init=scene.lcc->beta(init, 2,1,1,2);
+      process_inter_slice(init, faces, markVols);
+      init=scene.lcc->beta(init, 3,2,1,1,2,3);
+      process_full_slice(init, faces, markVols);
+    }
+  }
+
+  for(std::size_t i = 0; i < faces.size(); i++)
+  {
+    scene.lcc->remove_cell<2>(faces[i],mengerUpdateAttributes);
+  }
+  faces.clear();
+
+  // Now we remove edges.
+  for ( std::vector<Dart_handle>::iterator itvol=mengerVolumes.begin();
+        itvol!=mengerVolumes.end(); ++itvol)
+  {
+    if ( (scene.lcc)->is_marked(*itvol, markVols) )
+      CGAL::unmark_cell<LCC,3>(*(scene.lcc), *itvol, markVols);
+
+    for (LCC::Dart_of_cell_range<3>::iterator
+           it=scene.lcc->darts_of_cell<3>(*itvol).begin(),
+           itend=scene.lcc->darts_of_cell<3>(*itvol).end();
+         it!=itend; ++it)
+    {
+      if ( scene.lcc->is_free(it,2) &&
+           ( scene.lcc->is_free(it,3) || it<scene.lcc->beta(it,3) ) )
+        edges.push_back(it);
+    }
+  }
+
+  CGAL_assertion( (scene.lcc)->is_whole_map_unmarked(markVols) );
+
+  for(std::size_t i = 0; i < edges.size(); i++)
+  {
+    scene.lcc->remove_cell<1>(scene.lcc->beta(edges[i],0),mengerUpdateAttributes);
+    scene.lcc->remove_cell<1>(scene.lcc->beta(edges[i],1),mengerUpdateAttributes);
+    scene.lcc->remove_cell<1>(edges[i],mengerUpdateAttributes);
+  }
+  edges.clear();
+
+  // Lastly we remove vertices.
+  for ( std::vector<Dart_handle>::iterator itvol=mengerVolumes.begin();
+        itvol!=mengerVolumes.end(); ++itvol)
+  {
+    for (LCC::Dart_of_cell_basic_range<3>::iterator
+         it=(scene.lcc)->darts_of_cell_basic<3>
+           (*itvol, markVols).begin(),
+         itend=(scene.lcc)->darts_of_cell_basic<3>
+           (*itvol, markVols).end(); it!=itend; ++it)
+    {
+      if ( !(scene.lcc)->is_marked(it, markVertices) )
+      {
+        if ( scene.lcc->is_removable<0>(it) )
+          vertices.push_back(it);
+        CGAL::mark_cell<LCC, 0>(*scene.lcc, it, markVertices);
+      }
+    }
+  }
+
+  (scene.lcc)->negate_mark(markVols);
+  for ( std::vector<Dart_handle>::iterator itvol=mengerVolumes.begin();
+        itvol!=mengerVolumes.end(); ++itvol)
+  {
+    for (LCC::Dart_of_cell_basic_range<3>::iterator
+         it=(scene.lcc)->darts_of_cell_basic<3>
+           (*itvol, markVols).begin(),
+         itend=(scene.lcc)->darts_of_cell_basic<3>
+           (*itvol, markVols).end(); it!=itend; ++it)
+    {
+      if ( (scene.lcc)->is_marked(it, markVertices) )
+        CGAL::unmark_cell<LCC, 0>(*scene.lcc, it, markVertices);
+    }
+  }
+
+  (scene.lcc)->negate_mark(markVols);
+  CGAL_assertion( (scene.lcc)->is_whole_map_unmarked(markVols) );
+  CGAL_assertion( (scene.lcc)->is_whole_map_unmarked(markVertices) );
+
+  for(std::size_t i = 0; i < vertices.size(); i++)
+  {
+    scene.lcc->remove_cell<0>(vertices[i],mengerUpdateAttributes);
+  }
+  vertices.clear();
+
+  (scene.lcc)->free_mark(markVols);
+  (scene.lcc)->free_mark(markVertices);
+
+  if (!mengerUpdateAttributes)
+  {
+    scene.lcc->correct_invalid_attributes();
+  }
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  timer.stop();
+  std::cout<<"Menger sponge "
+           <<this->mengerLevel+1<<" -> "<<this->mengerLevel<<", "
+          <<"attributes updated "
+         <<(mengerUpdateAttributes ? "DURING" : "AFTER")
+        << " construction: "
+        <<timer.time()<<" seconds."<<std::endl;
+#endif
+
+  recreate_whole_volume_list();
+
+  statusBar()->showMessage(QString ("Menger sponge creation %1 -> %2").
+                           arg(this->mengerLevel+1).arg(this->mengerLevel),
+                           DELAY_STATUSMSG);
+
+  QApplication::restoreOverrideCursor ();
+  Q_EMIT( sceneChanged());
+}
+
+///////////////////////////////////////////////////////////////////////////////////
+// SIERPINSKI CARPET
+///////////////////////////////////////////////////////////////////////////////////
+
+void MainWindow::on_actionCreate_Sierpinski_Carpet_triggered ()
+{
+  /*neverUpdateAttributes = dialogsierpinskicarpet.never->isChecked();
+  duringConstructionUpdateAttributes = dialogsierpinskicarpet.during->isChecked();
+  afterConstructionUpdateAttributes = dialogsierpinskicarpet.after->isChecked();
+  updateAttributesMethodStdMap = dialogsierpinskicarpet.stdmap->isChecked();
+  updateAttributesMethodTraversal = dialogsierpinskicarpet.traversal->isChecked();
+  // By default, the geometry will be computed after the construction
+  isComputableGeometry = true;*/
+
+  computeGeometry = false;
+
+  sierpinskiCarpetUpdateAttributes
+    = dialogsierpinskicarpet.updateAttributes->isChecked();
+
+  dialogsierpinskicarpet.level->disconnect(this);
+
+  dialogsierpinskicarpet.level->setValue(0);
+  sierpinskiCarpetLevel=0;
+  CGAL_assertion( sierpinskiCarpetSurfaces.empty() );
+
+  Point_3 basepoint(nbcube%5, (nbcube/5)%5, nbcube/25);
+
+  Dart_handle d = scene.lcc->make_quadrangle(basepoint,
+                                             LCC::Traits::Construct_translated_point()
+                                             (basepoint,LCC::Traits::Vector(1,0,0)),
+                                             LCC::Traits::Construct_translated_point()
+                                             (basepoint,LCC::Traits::Vector(1,1,0)),
+                                             LCC::Traits::Construct_translated_point()
+                                             (basepoint,LCC::Traits::Vector(0,1,0)));
+
+  on_new_volume(d);
+
+  ++nbcube;
+
+  statusBar ()->showMessage (QString ("Square created"),DELAY_STATUSMSG);
+
+  Q_EMIT (sceneChanged ());
+
+  sierpinskiCarpetSurfaces.push_back(d);
+  update_operations_entries(false);
+
+  QObject::connect(dialogsierpinskicarpet.level, SIGNAL(valueChanged(int)),
+                   this, SLOT(onSierpinskiCarpetChangeLevel(int)));
+
+  dialogsierpinskicarpet.show();
+}
+
+void MainWindow::onSierpinskiCarpetCancel()
+{
+  QApplication::setOverrideCursor (Qt::WaitCursor);
+  for(std::vector<Dart_handle>::iterator it=sierpinskiCarpetSurfaces.begin();
+      it!=sierpinskiCarpetSurfaces.end(); ++it)
+  {
+    scene.lcc->remove_cell<2>(*it);
+  }
+
+  recreate_whole_volume_list();
+  sierpinskiCarpetSurfaces.clear();
+  update_operations_entries(true);
+  QApplication::restoreOverrideCursor ();
+  Q_EMIT( sceneChanged());
+}
+
+void MainWindow::onSierpinskiCarpetOk()
+{
+  update_operations_entries(true);
+  sierpinskiCarpetSurfaces.clear();
+}
+
+void MainWindow::onSierpinskiCarpetChangeLevel(int newLevel)
+{
+  while ( newLevel > sierpinskiCarpetLevel ) onSierpinskiCarpetInc();
+  while ( newLevel < sierpinskiCarpetLevel ) onSierpinskiCarpetDec();
+}
+
+void MainWindow::onSierpinskiCarpetUpdateAttributes(bool newValue)
+{
+  sierpinskiCarpetUpdateAttributes = newValue;
+}
+
+void MainWindow::onSierpinskiCarpetInc()
+{
+  QApplication::setOverrideCursor (Qt::WaitCursor);
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  CGAL::Timer timer;
+  timer.start();
+#endif
+
+  this->sierpinskiCarpetLevel++;
+
+/*  if (computeGeometry)
+  {
+    // Here case where the geometry could be computed after the construction, but it was not updated.
+    computeGeometry = false;
+    dialogsierpinskicarpet.computeGeometry->setEnabled(false);
+    //  => geometry will not be computed later.
+    isComputableGeometry = false;
+  }*/
+
+  std::vector<Dart_handle> edges;
+  nbfacesinit = sierpinskiCarpetSurfaces.size();
+
+  LCC::size_type markEdges = (scene.lcc)->get_new_mark();
+  LCC::size_type markFaces = (scene.lcc)->get_new_mark();
+
+  for(std::vector<Dart_handle>::iterator itfaces=sierpinskiCarpetSurfaces.begin();
+        itfaces!=sierpinskiCarpetSurfaces.end(); ++itfaces)
+  {
+    CGAL_assertion( !(scene.lcc)->is_marked(*itfaces, markFaces) );
+    for (LCC::Dart_of_cell_basic_range<2>::iterator
+         it=(scene.lcc)->darts_of_cell_basic<2>(*itfaces, markFaces).begin(),
+         itend=(scene.lcc)->darts_of_cell_basic<2>(*itfaces, markFaces).end();
+         it!=itend; ++it)
+    {
+      if ( !(scene.lcc)->is_marked(it, markEdges) )
+      {
+        edges.push_back(it);
+        CGAL::mark_cell<LCC,1>(*(scene.lcc), it, markEdges);
+      }
+    }
+  }
+
+  (scene.lcc)->negate_mark(markFaces);
+  for(std::vector<Dart_handle>::iterator itfaces=sierpinskiCarpetSurfaces.begin();
+        itfaces!=sierpinskiCarpetSurfaces.end(); ++itfaces)
+  {
+    for (LCC::Dart_of_cell_basic_range<2>::iterator
+         it=(scene.lcc)->darts_of_cell_basic<2>(*itfaces, markFaces).begin(),
+         itend=(scene.lcc)->darts_of_cell_basic<2>(*itfaces, markFaces).end();
+         it!=itend; ++it)
+    {
+      (scene.lcc)->unmark(it, markEdges);
+    }
+  }
+
+  (scene.lcc)->negate_mark(markFaces);
+  CGAL_assertion( (scene.lcc)->is_whole_map_unmarked(markFaces) );
+  CGAL_assertion( (scene.lcc)->is_whole_map_unmarked(markEdges) );
+
+  (scene.lcc)->free_mark(markEdges);
+  (scene.lcc)->free_mark(markFaces);
+
+/*  if (afterConstructionUpdateAttributes)
+  {
+    if (updateAttributesMethodStdMap)
+    {
+      // We create a map to associate embeddings to new darts
+      for(std::size_t i = 0; i < edges.size(); i++)
+      {
+        dart_map.insert(std::pair<Dart_handle, LCC::Point>
+                        (edges[i], scene.lcc->point(edges[i])));
+        if (!(scene.lcc)->is_free(edges[i],2))
+        {
+          dart_map.insert(std::pair<Dart_handle, LCC::Point>
+                          ((scene.lcc)->beta(edges[i],2),
+                           scene.lcc->point((scene.lcc)->beta(edges[i],2))));
+        }
+      }
+    }
+  }*/
+
+  for(std::size_t i = 0; i < edges.size(); i++)
+  {
+    sierpinski_carpet_split_edge_in_three(edges[i]);
+  }
+  edges.clear();
+
+  for(std::size_t i = 0; i < nbfacesinit; i++)
+  {
+    sierpinski_carpet_split_face_in_nine(sierpinskiCarpetSurfaces[i]);
+  }
+
+  if (!sierpinskiCarpetUpdateAttributes)
+  {
+    sierpinski_carpet_update_geometry();
+  }
+
+/*  if (neverUpdateAttributes)
+  {
+    scene.lcc->correct_invalid_attributes();
+
+    // Now that the map is valid, we can compute the geometry
+    if (isComputableGeometry)
+    {
+      computeGeometry = true;
+      dialogsierpinskicarpet.computeGeometry->setEnabled(true);
+    }
+  }*/
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  timer.stop();
+  std::cout<<"Sierpinski carpet "
+           <<this->sierpinskiCarpetLevel-1<<" -> "
+          <<this->sierpinskiCarpetLevel<<", "
+         <<"attributes updated "
+        <<(sierpinskiCarpetUpdateAttributes ? "DURING" : "AFTER")
+       << " construction: "
+       <<timer.time()<<" seconds."<<std::endl;
+#endif
+
+  CGAL_assertion( (scene.lcc)->is_valid() );
+
+  statusBar()->showMessage(QString ("Sierpinski carpet creation %1 -> %2").
+                           arg(this->sierpinskiCarpetLevel-1).
+                           arg(this->sierpinskiCarpetLevel),
+                           DELAY_STATUSMSG);
+
+  QApplication::restoreOverrideCursor ();
+  Q_EMIT( sceneChanged());
+}
+
+void MainWindow::sierpinski_carpet_update_geometry()
+{
+/*  if (updateAttributesMethodStdMap)
+  {
+    for(std::size_t i = 0; i < new_darts.size(); i++)
+    {
+      sierpinski_carpet_copy_attributes_and_embed_vertex(new_darts[i], dart_map[new_darts[i]]);
+    }
+
+    dart_map.clear();
+    new_darts.clear();
+  }
+
+  if (updateAttributesMethodTraversal)*/
+  {
+    LCC::size_type markVertices = (scene.lcc)->get_new_mark();
+
+    for(std::size_t i = 0; i < nbfacesinit; i++)
+    {
+      // Geometry of the 4 corners of the current face
+      LCC::Point p[4][4];
+      Dart_handle d00 = sierpinskiCarpetSurfaces[i];
+      Dart_handle d03 = scene.lcc->beta(d00,1,2,1,1,2,1,1);
+      Dart_handle d33 = scene.lcc->beta(d03,1,2,1,1,2,1,1);
+      Dart_handle d30 = scene.lcc->beta(d33,1,2,1,1,2,1,1);
+      sierpinski_carpet_compute_4x4_geometry_matrix(p,
+                                                    scene.lcc->point(d00),
+                                                    scene.lcc->point(d03),
+                                                    scene.lcc->point(d33),
+                                                    scene.lcc->point(d30));
+
+      Dart_handle dh = sierpinskiCarpetSurfaces[i];
+
+      // bottom border
+      dh = scene.lcc->beta(dh,1,2,1);
+      if ( ! (scene.lcc)->is_marked(dh, markVertices) )
+      {
+        sierpinski_carpet_copy_attributes_and_embed_vertex(dh, p[0][1]);
+        CGAL::mark_cell<LCC,0>(*(scene.lcc), dh, markVertices);
+      }
+      dh = scene.lcc->beta(dh,1,2,1);
+      if ( ! (scene.lcc)->is_marked(dh, markVertices) )
+      {
+        sierpinski_carpet_copy_attributes_and_embed_vertex(dh, p[0][2]);
+        CGAL::mark_cell<LCC,0>(*(scene.lcc), dh, markVertices);
+      }
+
+      // right border
+      dh = scene.lcc->beta(dh,1,1,2,1);
+      if ( ! (scene.lcc)->is_marked(dh, markVertices) )
+      {
+        sierpinski_carpet_copy_attributes_and_embed_vertex(dh, p[1][3]);
+        CGAL::mark_cell<LCC,0>(*(scene.lcc), dh, markVertices);
+      }
+      dh = scene.lcc->beta(dh,1,2,1);
+      if ( ! (scene.lcc)->is_marked(dh, markVertices) )
+      {
+        sierpinski_carpet_copy_attributes_and_embed_vertex(dh, p[2][3]);
+        CGAL::mark_cell<LCC,0>(*(scene.lcc), dh, markVertices);
+      }
+
+      // top border
+      dh = scene.lcc->beta(dh,1,1,2,1);
+      if ( ! (scene.lcc)->is_marked(dh, markVertices) )
+      {
+        sierpinski_carpet_copy_attributes_and_embed_vertex(dh, p[3][2]);
+        CGAL::mark_cell<LCC,0>(*(scene.lcc), dh, markVertices);
+      }
+      dh = scene.lcc->beta(dh,1,2,1);
+      if ( ! (scene.lcc)->is_marked(dh, markVertices) )
+      {
+        sierpinski_carpet_copy_attributes_and_embed_vertex(dh, p[3][1]);
+        CGAL::mark_cell<LCC,0>(*(scene.lcc), dh, markVertices);
+      }
+
+      // left border
+      dh = scene.lcc->beta(dh,1,1,2,1);
+      if ( ! (scene.lcc)->is_marked(dh, markVertices) )
+      {
+        sierpinski_carpet_copy_attributes_and_embed_vertex(dh, p[2][0]);
+        CGAL::mark_cell<LCC,0>(*(scene.lcc), dh, markVertices);
+      }
+      dh = scene.lcc->beta(dh,1,2,1);
+      if ( ! (scene.lcc)->is_marked(dh, markVertices) )
+      {
+        sierpinski_carpet_copy_attributes_and_embed_vertex(dh, p[1][0]);
+        CGAL::mark_cell<LCC,0>(*(scene.lcc), dh, markVertices);
+      }
+
+      dh = sierpinskiCarpetSurfaces[i];
+
+      // middle vertex, bottom left
+      dh = scene.lcc->beta(dh,1,1);
+      sierpinski_carpet_copy_attributes_and_embed_vertex(dh, p[1][1]);
+
+      // middle vertex, top left
+      dh = scene.lcc->beta(dh,2,1,1);
+      sierpinski_carpet_copy_attributes_and_embed_vertex(dh, p[2][1]);
+
+      // middle vertex, top right
+      dh = scene.lcc->beta(dh,2,1,2,1,1,2,1);
+      sierpinski_carpet_copy_attributes_and_embed_vertex(dh, p[2][2]);
+
+      // middle vertex, bottom right
+      dh = scene.lcc->beta(dh,2,1,1);
+      sierpinski_carpet_copy_attributes_and_embed_vertex(dh, p[1][2]);
+    }
+
+    scene.lcc->unmark_all(markVertices);
+    CGAL_assertion( (scene.lcc)->is_whole_map_unmarked(markVertices) );
+  }
+}
+
+void MainWindow::sierpinski_carpet_compute_geometry()
+{
+  LCC::size_type markVertices = (scene.lcc)->get_new_mark();
+
+  for(std::size_t i = 0; i < nbfacesinit; i++)
+  {
+    // on récupère la géométrie des 4 coins de la face courante
+    LCC::Point p[4][4];
+    Dart_handle d00 = sierpinskiCarpetSurfaces[i];
+    Dart_handle d03 = scene.lcc->beta(d00,1,2,1,1,2,1,1);
+    Dart_handle d33 = scene.lcc->beta(d03,1,2,1,1,2,1,1);
+    Dart_handle d30 = scene.lcc->beta(d33,1,2,1,1,2,1,1);
+    sierpinski_carpet_compute_4x4_geometry_matrix(p, scene.lcc->point(d00), scene.lcc->point(d03), scene.lcc->point(d33), scene.lcc->point(d30));
+
+    Dart_handle dh = sierpinskiCarpetSurfaces[i];
+
+    // Geometry of the 4 corners of the current face
+    // bottom border
+    dh = scene.lcc->beta(dh,1,2,1);
+    if ( ! (scene.lcc)->is_marked(dh, markVertices) )
+    {
+      scene.lcc->point(dh) = p[0][1];
+      CGAL::mark_cell<LCC,0>(*(scene.lcc), dh, markVertices);
+    }
+    dh = scene.lcc->beta(dh,1,2,1);
+    if ( ! (scene.lcc)->is_marked(dh, markVertices) )
+    {
+      scene.lcc->point(dh) = p[0][2];
+      CGAL::mark_cell<LCC,0>(*(scene.lcc), dh, markVertices);
+    }
+
+    // right border
+    dh = scene.lcc->beta(dh,1,1,2,1);
+    if ( ! (scene.lcc)->is_marked(dh, markVertices) )
+    {
+      scene.lcc->point(dh) = p[1][3];
+      CGAL::mark_cell<LCC,0>(*(scene.lcc), dh, markVertices);
+    }
+    dh = scene.lcc->beta(dh,1,2,1);
+    if ( ! (scene.lcc)->is_marked(dh, markVertices) )
+    {
+      scene.lcc->point(dh) = p[2][3];
+      CGAL::mark_cell<LCC,0>(*(scene.lcc), dh, markVertices);
+    }
+
+    // top border
+    dh = scene.lcc->beta(dh,1,1,2,1);
+    if ( ! (scene.lcc)->is_marked(dh, markVertices) )
+    {
+      scene.lcc->point(dh) = p[3][2];
+      CGAL::mark_cell<LCC,0>(*(scene.lcc), dh, markVertices);
+    }
+    dh = scene.lcc->beta(dh,1,2,1);
+    if ( ! (scene.lcc)->is_marked(dh, markVertices) )
+    {
+      scene.lcc->point(dh) = p[3][1];
+      CGAL::mark_cell<LCC,0>(*(scene.lcc), dh, markVertices);
+    }
+
+    // left border
+    dh = scene.lcc->beta(dh,1,1,2,1);
+    if ( ! (scene.lcc)->is_marked(dh, markVertices) )
+    {
+      scene.lcc->point(dh) = p[2][0];
+      CGAL::mark_cell<LCC,0>(*(scene.lcc), dh, markVertices);
+    }
+    dh = scene.lcc->beta(dh,1,2,1);
+    if ( ! (scene.lcc)->is_marked(dh, markVertices) )
+    {
+      scene.lcc->point(dh) = p[1][0];
+      CGAL::mark_cell<LCC,0>(*(scene.lcc), dh, markVertices);
+    }
+
+    dh = sierpinskiCarpetSurfaces[i];
+
+    // middle vertex, bottom left
+    dh = scene.lcc->beta(dh,1,1);
+    scene.lcc->point(dh) = p[1][1];
+
+    // middle vertex, top left
+    dh = scene.lcc->beta(dh,2,1,1);
+    scene.lcc->point(dh) = p[2][1];
+
+    // middle vertex, top right
+    dh = scene.lcc->beta(dh,2,1,2,1,1,2,1);
+    scene.lcc->point(dh) = p[2][2];
+
+    // middle vertex, bottom right
+    dh = scene.lcc->beta(dh,2,1,1);
+    scene.lcc->point(dh) = p[1][2];
+
+    }
+
+  scene.lcc->unmark_all(markVertices);
+  CGAL_assertion( (scene.lcc)->is_whole_map_unmarked(markVertices) );
+}
+
+void MainWindow::sierpinski_carpet_compute_4x4_geometry_matrix
+(LCC::Point p[4][4], LCC::Point& p00, LCC::Point& p03,
+ LCC::Point& p33, LCC::Point& p30)
+{
+  p[0][0] = p00;
+  p[0][3] = p03;
+  p[3][3] = p33;
+  p[3][0] = p30;
+
+  LCC::Vector v1, v2, v3;
+
+  // bottom border
+  v1 = LCC::Traits::Construct_vector() (p[0][0],p[0][3]);
+  v2 = LCC::Traits::Construct_scaled_vector() (v1,1.0/3);
+  v3 = LCC::Traits::Construct_scaled_vector() (v1,2.0/3);
+  p[0][1] = LCC::Traits::Construct_translated_point() (p[0][0],v2);
+  p[0][2] = LCC::Traits::Construct_translated_point() (p[0][0],v3);
+  // right border
+  v1 = LCC::Traits::Construct_vector() (p[0][3],p[3][3]);
+  v2 = LCC::Traits::Construct_scaled_vector() (v1,1.0/3);
+  v3 = LCC::Traits::Construct_scaled_vector() (v1,2.0/3);
+  p[1][3] = LCC::Traits::Construct_translated_point() (p[0][3],v2);
+  p[2][3] = LCC::Traits::Construct_translated_point() (p[0][3],v3);
+  // top border
+  v1 = LCC::Traits::Construct_vector() (p[3][3],p[3][0]);
+  v2 = LCC::Traits::Construct_scaled_vector() (v1,1.0/3);
+  v3 = LCC::Traits::Construct_scaled_vector() (v1,2.0/3);
+  p[3][2] = LCC::Traits::Construct_translated_point() (p[3][3],v2);
+  p[3][1] = LCC::Traits::Construct_translated_point() (p[3][3],v3);
+  // left border
+  v1 = LCC::Traits::Construct_vector() (p[3][0],p[0][0]);
+  v2 = LCC::Traits::Construct_scaled_vector() (v1,1.0/3);
+  v3 = LCC::Traits::Construct_scaled_vector() (v1,2.0/3);
+  p[2][0] = LCC::Traits::Construct_translated_point() (p[3][0],v2);
+  p[1][0] = LCC::Traits::Construct_translated_point() (p[3][0],v3);
+  // middle, left column
+  v1 = LCC::Traits::Construct_vector() (p[0][1],p[3][1]);
+  v2 = LCC::Traits::Construct_scaled_vector() (v1,1.0/3);
+  v3 = LCC::Traits::Construct_scaled_vector() (v1,2.0/3);
+  p[1][1] = LCC::Traits::Construct_translated_point() (p[0][1],v2);
+  p[2][1] = LCC::Traits::Construct_translated_point() (p[0][1],v3);
+  // middle, right column
+  v1 = LCC::Traits::Construct_vector() (p[3][2],p[0][2]);
+  v2 = LCC::Traits::Construct_scaled_vector() (v1,1.0/3);
+  v3 = LCC::Traits::Construct_scaled_vector() (v1,2.0/3);
+  p[2][2] = LCC::Traits::Construct_translated_point() (p[3][2],v2);
+  p[1][2] = LCC::Traits::Construct_translated_point() (p[3][2],v3);
+}
+
+void MainWindow::sierpinski_carpet_copy_attributes_and_embed_vertex
+(Dart_handle dh, LCC::Point& p)
+{
+  LCC::Attribute_handle<0>::type ah = (scene.lcc)->create_vertex_attribute(p);
+  for ( LCC::Dart_of_cell_range<0>::iterator
+        it=(scene.lcc)->darts_of_cell<0>(dh).begin();
+        it != (scene.lcc)->darts_of_cell<0>(dh).end(); ++it )
+  {
+    // We copy all the attributes except for dim=0
+    LCC::Helper::Foreach_enabled_attributes_except
+      <CGAL::internal::Group_attribute_functor_of_dart<LCC>, 0>::
+      run(scene.lcc,sierpinskiCarpetSurfaces[0],it);
+    // We initialise the 0-atttrib to ah
+    CGAL::internal::Set_i_attribute_of_dart_functor<LCC, 0>::
+        run(scene.lcc, it, ah);
+  }
+}
+
+void MainWindow::sierpinski_carpet_split_edge_in_three(Dart_handle dh)
+{
+  if (sierpinskiCarpetUpdateAttributes)
+  {
+    LCC::Point p1 = scene.lcc->point(dh);
+    LCC::Point p2 = scene.lcc->point(scene.lcc->other_extremity(dh));
+
+    LCC::Vector v1 = LCC::Traits::Construct_vector() (p1,p2);
+    LCC::Vector v2 = LCC::Traits::Construct_scaled_vector() (v1,1.0/3);
+    LCC::Vector v3 = LCC::Traits::Construct_scaled_vector() (v1,2.0/3);
+
+    LCC::Point p3 = LCC::Traits::Construct_translated_point() (p1,v2);
+    LCC::Point p4 = LCC::Traits::Construct_translated_point() (p1,v3);
+
+    (scene.lcc)->insert_point_in_cell<1>(dh,p4);
+    (scene.lcc)->insert_point_in_cell<1>(dh,p3);
+  }
+  else
+  {
+    LCC::Point p3, p4;
+
+    /*if (afterConstructionUpdateAttributes && updateAttributesMethodStdMap)
+    {
+      LCC::Point p1 = dart_map[dh];
+      LCC::Point p2 = dart_map[scene.lcc->other_extremity(dh)];
+      LCC::Vector v1 = LCC::Traits::Construct_vector() (p1,p2);
+      LCC::Vector v2 = LCC::Traits::Construct_scaled_vector() (v1,1.0/3);
+      LCC::Vector v3 = LCC::Traits::Construct_scaled_vector() (v1,2.0/3);
+
+      p3 = LCC::Traits::Construct_translated_point() (p1,v2);
+      p4 = LCC::Traits::Construct_translated_point() (p1,v3);
+    }*/
+
+    //    Dart_handle d1=
+        scene.lcc->insert_cell_0_in_cell_1
+          (dh, LCC::null_handle, false);
+
+    /*if (afterConstructionUpdateAttributes && updateAttributesMethodStdMap)
+    {
+      dart_map.insert(std::pair<Dart_handle, LCC::Point>(d1, p4));
+      if (!(scene.lcc)->is_free(d1,2))
+      {
+        dart_map.insert(std::pair<Dart_handle, LCC::Point>((scene.lcc)->beta(d1,2,1), p4));
+      }
+      new_darts.push_back((scene.lcc)->beta(dh,1));
+    }*/
+
+    //    Dart_handle d2=
+        scene.lcc->insert_cell_0_in_cell_1
+          (dh,LCC::null_handle,false);
+
+    /*if (afterConstructionUpdateAttributes && updateAttributesMethodStdMap)
+    {
+      dart_map.insert(std::pair<Dart_handle, LCC::Point>(d2, p3));
+      if (!(scene.lcc)->is_free(d2,2))
+      {
+        dart_map.insert(std::pair<Dart_handle, LCC::Point>((scene.lcc)->beta(d2,2,1), p3));
+      }
+      new_darts.push_back((scene.lcc)->beta(dh,1));
+    }*/
+  }
+}
+
+void MainWindow::sierpinski_carpet_split_face_in_three(Dart_handle dh,
+                                                       bool removecenter)
+{
+  Dart_handle d1=
+  scene.lcc->insert_cell_1_in_cell_2
+    (scene.lcc->beta(dh,1,1,1),scene.lcc->beta(dh,0,0),
+     sierpinskiCarpetUpdateAttributes);
+  Dart_handle d2=
+  scene.lcc->insert_cell_1_in_cell_2
+    (scene.lcc->beta(dh,1,1),scene.lcc->beta(dh,0),
+     sierpinskiCarpetUpdateAttributes);
+
+  if ( removecenter )
+  {
+    scene.lcc->remove_cell<2>(d2,sierpinskiCarpetUpdateAttributes);
+  }
+  else
+  {
+    sierpinskiCarpetSurfaces.push_back(d2);
+  }
+
+  sierpinskiCarpetSurfaces.push_back(d1);
+}
+
+void MainWindow::sierpinski_carpet_split_face_in_nine(Dart_handle dh)
+{
+  Dart_handle d1 = scene.lcc->beta(dh,1,1);
+  Dart_handle d2 = scene.lcc->beta(dh,1,1,1,1,1,1,1);
+  Dart_handle d3 = scene.lcc->beta(dh,1);
+  Dart_handle d4 = scene.lcc->beta(d2,1);
+
+  Dart_handle e2=
+  scene.lcc->insert_cell_1_in_cell_2
+    (d1,d2,sierpinskiCarpetUpdateAttributes);
+
+  /*if (afterConstructionUpdateAttributes && updateAttributesMethodStdMap)
+  {
+    dart_map.insert(std::pair<Dart_handle, LCC::Point>(e2, dart_map[d2]));
+    dart_map.insert(std::pair<Dart_handle, LCC::Point>((scene.lcc)->beta(e2,2), dart_map[d1]));
+  }*/
+
+  Dart_handle e1=
+  scene.lcc->insert_cell_1_in_cell_2
+    (d3,d4,sierpinskiCarpetUpdateAttributes);
+
+  /*if (afterConstructionUpdateAttributes && updateAttributesMethodStdMap)
+  {
+    dart_map.insert(std::pair<Dart_handle, LCC::Point>(e1, dart_map[d4]));
+    dart_map.insert(std::pair<Dart_handle, LCC::Point>((scene.lcc)->beta(e1,2), dart_map[d3]));
+  }*/
+
+  sierpinskiCarpetSurfaces.push_back(e2);
+  sierpinskiCarpetSurfaces.push_back(e1);
+
+  // We give the beta2 to not insert in new_darts a dart that will be removed
+  // during the removal of the middle face
+  sierpinski_carpet_split_edge_in_three(scene.lcc->beta(e1,2));
+  sierpinski_carpet_split_edge_in_three(e2);
+
+  sierpinski_carpet_split_face_in_three(dh, false);
+  sierpinski_carpet_split_face_in_three(d2, true);
+  sierpinski_carpet_split_face_in_three(scene.lcc->beta(e2,0), false);
+}
+
+void MainWindow::onSierpinskiCarpetDec()
+{
+  QApplication::setOverrideCursor (Qt::WaitCursor);
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  CGAL::Timer timer;
+  timer.start();
+#endif
+
+  this->sierpinskiCarpetLevel--;
+
+  // We know here the number of Sierpinski surfaces: 8^sierpinskiCarpetLevel
+  // thus we can directly "cut" the std::vector to the correct size.
+  sierpinskiCarpetSurfaces.resize(CGAL::ipower(8,sierpinskiCarpetLevel));
+
+  LCC::size_type markSurfaces = (scene.lcc)->get_new_mark();
+  LCC::size_type markVertices = (scene.lcc)->get_new_mark();
+
+  std::vector<Dart_handle> edges;
+  std::vector<Dart_handle> vertices;
+
+  // First we remove edges.
+  for ( std::vector<Dart_handle>::iterator
+        itsurfaces=sierpinskiCarpetSurfaces.begin();
+        itsurfaces!=sierpinskiCarpetSurfaces.end(); ++itsurfaces)
+  {
+    Dart_handle dh = *itsurfaces;
+    dh = scene.lcc->beta(dh,1,1,2,1);
+    edges.push_back(dh);
+    dh = scene.lcc->beta(dh,1,2,1,2,1);
+    edges.push_back(dh);
+    dh = scene.lcc->beta(dh,1,2,1,2,1);
+    edges.push_back(dh);
+    dh = scene.lcc->beta(dh,1,2,1,2,1);
+    edges.push_back(dh);
+  }
+
+  for(std::size_t i = 0; i < edges.size(); i++)
+  {
+    scene.lcc->remove_cell<1>(scene.lcc->beta(edges[i],0),
+                             sierpinskiCarpetUpdateAttributes);
+    scene.lcc->remove_cell<1>(scene.lcc->beta(edges[i],1),
+                             sierpinskiCarpetUpdateAttributes);
+    scene.lcc->remove_cell<1>(edges[i],
+                             sierpinskiCarpetUpdateAttributes);
+  }
+  edges.clear();
+
+  // Lastly we remove vertices.
+  for ( std::vector<Dart_handle>::iterator
+        itsurfaces=sierpinskiCarpetSurfaces.begin();
+        itsurfaces!=sierpinskiCarpetSurfaces.end(); ++itsurfaces)
+  {
+    Dart_handle dh = scene.lcc->beta(*itsurfaces,1);
+    // we proceed side by side
+    for (unsigned int i = 0; i < 4; i++)
+    {
+      if ( !(scene.lcc)->is_marked(dh, markVertices) )
+      {
+        vertices.push_back(dh);
+        CGAL::mark_cell<LCC, 0>(*scene.lcc, dh, markVertices);
+      }
+      dh = scene.lcc->beta(dh,1);
+      if ( !(scene.lcc)->is_marked(dh, markVertices) )
+      {
+        vertices.push_back(dh);
+        CGAL::mark_cell<LCC, 0>(*scene.lcc, dh, markVertices);
+      }
+      dh = scene.lcc->beta(dh,1,1);
+    }
+  }
+
+  (scene.lcc)->negate_mark(markSurfaces);
+  for ( std::vector<Dart_handle>::iterator
+        itsurfaces=sierpinskiCarpetSurfaces.begin();
+        itsurfaces!=sierpinskiCarpetSurfaces.end(); ++itsurfaces)
+  {
+    Dart_handle dh = scene.lcc->beta(*itsurfaces,1);
+    for (unsigned int i = 0; i < 4; i++)
+    {
+      if ( (scene.lcc)->is_marked(dh, markVertices) )
+        CGAL::unmark_cell<LCC, 0>(*scene.lcc, dh, markVertices);
+      dh = scene.lcc->beta(dh,1);
+      if ( (scene.lcc)->is_marked(dh, markVertices) )
+        CGAL::unmark_cell<LCC, 0>(*scene.lcc, dh, markVertices);
+      dh = scene.lcc->beta(dh,1,1);
+    }
+  }
+
+  (scene.lcc)->negate_mark(markSurfaces);
+  CGAL_assertion( (scene.lcc)->is_whole_map_unmarked(markSurfaces) );
+  CGAL_assertion( (scene.lcc)->is_whole_map_unmarked(markVertices) );
+
+  for(std::size_t i = 0; i < vertices.size(); i++)
+  {
+    scene.lcc->remove_cell<0>(vertices[i],
+                              sierpinskiCarpetUpdateAttributes);
+  }
+  vertices.clear();
+
+  (scene.lcc)->free_mark(markSurfaces);
+  (scene.lcc)->free_mark(markVertices);
+
+  if (!sierpinskiCarpetUpdateAttributes)
+  {
+    scene.lcc->correct_invalid_attributes();
+  }
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  timer.stop();
+  std::cout<<"Sierpinski carpet "
+           <<this->sierpinskiCarpetLevel+1<<" -> "
+          <<this->sierpinskiCarpetLevel<<", "
+         <<"attributes updated "
+        <<(sierpinskiCarpetUpdateAttributes ? "DURING" : "AFTER")
+       << " construction: "
+       <<timer.time()<<" seconds."<<std::endl;
+#endif
+
+  recreate_whole_volume_list();
+  QApplication::restoreOverrideCursor ();
+
+  statusBar()->showMessage(QString ("Sierpinski carpet creation %1 -> %2").
+                           arg(this->sierpinskiCarpetLevel+1).
+                           arg(this->sierpinskiCarpetLevel),
+                           DELAY_STATUSMSG);
+  Q_EMIT( sceneChanged());
+}
+
+///////////////////////////////////////////////////////////////////////////////////
+// SIERPINSKI TRIANGLE
+///////////////////////////////////////////////////////////////////////////////////
+void MainWindow::on_actionCreate_Sierpinski_Triangle_triggered ()
+{
+  sierpinskiTriangleUpdateAttributes
+    = dialogsierpinskitriangle.updateAttributes->isChecked();
+
+  dialogsierpinskitriangle.level->disconnect(this);
+
+  dialogsierpinskitriangle.level->setValue(0);
+  sierpinskiTriangleLevel=0;
+  CGAL_assertion( sierpinskiTriangleSurfaces.empty() );
+
+  CGAL_assertion( removedTriangles.empty() );
+
+  Point_3 basepoint(nbcube%5, (nbcube/5)%5, nbcube/25);
+
+  Dart_handle d = scene.lcc->make_triangle(basepoint,
+                                           LCC::Traits::Construct_translated_point()
+                                           (basepoint,LCC::Traits::Vector(1,0,0)),
+                                           LCC::Traits::Construct_translated_point()
+                                           (basepoint,LCC::Traits::Vector(0.5f,CGAL::sqrt(3.f)/2.f,0)));
+
+  on_new_volume(d);
+
+  ++nbcube;
+
+  statusBar ()->showMessage (QString ("Triangle created"),DELAY_STATUSMSG);
+
+  Q_EMIT (sceneChanged ());
+
+  sierpinskiTriangleSurfaces.push_back(d);
+  update_operations_entries(false);
+
+  QObject::connect(dialogsierpinskitriangle.level, SIGNAL(valueChanged(int)),
+                   this, SLOT(onSierpinskiTriangleChangeLevel(int)));
+
+  dialogsierpinskitriangle.show();
+}
+
+void MainWindow::onSierpinskiTriangleCancel()
+{
+  for(std::vector<Dart_handle>::iterator it=sierpinskiTriangleSurfaces.begin();
+      it!=sierpinskiTriangleSurfaces.end(); ++it)
+  {
+    scene.lcc->remove_cell<2>(*it);
+  }
+
+  recreate_whole_volume_list();
+  sierpinskiTriangleSurfaces.clear();
+  update_operations_entries(true);
+  Q_EMIT( sceneChanged());
+}
+
+void MainWindow::onSierpinskiTriangleOk()
+{
+  update_operations_entries(true);
+  sierpinskiTriangleSurfaces.clear();
+}
+
+void MainWindow::onSierpinskiTriangleChangeLevel(int newLevel)
+{
+  while ( newLevel > sierpinskiTriangleLevel ) onSierpinskiTriangleInc();
+  while ( newLevel < sierpinskiTriangleLevel ) onSierpinskiTriangleDec();
+}
+
+void MainWindow::onSierpinskiTriangleUpdateAttributes(bool newValue)
+{
+  sierpinskiTriangleUpdateAttributes = newValue;
+}
+
+void MainWindow::onSierpinskiTriangleInc()
+{
+  QApplication::setOverrideCursor (Qt::WaitCursor);
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  CGAL::Timer timer;
+  timer.start();
+#endif
+
+  this->sierpinskiTriangleLevel++;
+
+  std::vector<Dart_handle> edges;
+  nbfacesinit = sierpinskiTriangleSurfaces.size();
+
+  LCC::size_type markEdges = (scene.lcc)->get_new_mark();
+  LCC::size_type markFaces = (scene.lcc)->get_new_mark();
+
+  for(std::vector<Dart_handle>::iterator itfaces=sierpinskiTriangleSurfaces.begin();
+        itfaces!=sierpinskiTriangleSurfaces.end(); ++itfaces)
+  {
+    CGAL_assertion( !(scene.lcc)->is_marked(*itfaces, markFaces) );
+    for (LCC::Dart_of_cell_basic_range<2>::iterator
+         it=(scene.lcc)->darts_of_cell_basic<2>(*itfaces, markFaces).begin(),
+         itend=(scene.lcc)->darts_of_cell_basic<2>(*itfaces, markFaces).end();
+         it!=itend; ++it)
+    {
+      if ( !(scene.lcc)->is_marked(it, markEdges) )
+      {
+        edges.push_back(it);
+        CGAL::mark_cell<LCC,1>(*(scene.lcc), it, markEdges);
+      }
+    }
+  }
+
+  (scene.lcc)->negate_mark(markFaces);
+  for(std::vector<Dart_handle>::iterator itfaces=sierpinskiTriangleSurfaces.begin();
+        itfaces!=sierpinskiTriangleSurfaces.end(); ++itfaces)
+  {
+    for (LCC::Dart_of_cell_basic_range<2>::iterator
+         it=(scene.lcc)->darts_of_cell_basic<2>(*itfaces, markFaces).begin(),
+         itend=(scene.lcc)->darts_of_cell_basic<2>(*itfaces, markFaces).end();
+         it!=itend; ++it)
+    {
+      (scene.lcc)->unmark(it, markEdges);
+    }
+  }
+
+  (scene.lcc)->negate_mark(markFaces);
+  CGAL_assertion( (scene.lcc)->is_whole_map_unmarked(markFaces) );
+  CGAL_assertion( (scene.lcc)->is_whole_map_unmarked(markEdges) );
+
+  (scene.lcc)->free_mark(markEdges);
+  (scene.lcc)->free_mark(markFaces);
+
+  for(std::size_t i = 0; i < edges.size(); i++)
+  {
+    sierpinski_triangle_split_edge_in_two(edges[i]);
+  }
+  edges.clear();
+
+  for(std::size_t i = 0; i < nbfacesinit; i++)
+  {
+    sierpinski_triangle_split_face_in_four(sierpinskiTriangleSurfaces[i],true);
+  }
+
+  if (!sierpinskiTriangleUpdateAttributes)
+  {
+    for(std::size_t i = nbfacesinit; i < sierpinskiTriangleSurfaces.size(); i++)
+    {
+      LCC::Attribute_handle<3>::type ah = (scene.lcc)->create_attribute<3>();
+        CGAL::Set_i_attribute_functor<LCC, 3>::
+            run(scene.lcc, sierpinskiTriangleSurfaces[i], ah);
+        scene.lcc->info<3>(sierpinskiTriangleSurfaces[i]).color()=
+          (CGAL::Color(myrandom.get_int(0,256),
+                       myrandom.get_int(0,256),
+                       myrandom.get_int(0,256)));
+
+        update_volume_list_add(scene.lcc->attribute<3>(sierpinskiTriangleSurfaces[i]));
+    }
+
+    scene.lcc->correct_invalid_attributes();
+  }
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  timer.stop();
+  std::cout<<"Sierpinski triangle "
+           <<this->sierpinskiTriangleLevel-1<<" -> "
+          <<this->sierpinskiTriangleLevel<<", "
+         <<"attributes updated "
+        <<(sierpinskiTriangleUpdateAttributes ? "DURING" : "AFTER")
+       << " construction: "
+       <<timer.time()<<" seconds."<<std::endl;
+#endif
+
+  //CGAL_assertion( (scene.lcc)->is_valid() );
+  statusBar()->showMessage(QString ("Sierpinski triangle creation %1 -> %2").
+                           arg(this->sierpinskiTriangleLevel-1).
+                           arg(this->sierpinskiTriangleLevel),
+                           DELAY_STATUSMSG);
+  QApplication::restoreOverrideCursor ();
+
+  Q_EMIT( sceneChanged());
+}
+
+void MainWindow::sierpinski_triangle_split_edge_in_two(Dart_handle dh)
+{
+  LCC::Point p1 = scene.lcc->point(dh);
+  LCC::Point p2 = scene.lcc->point(scene.lcc->other_extremity(dh));
+
+  LCC::Vector v1 = LCC::Traits::Construct_vector() (p1,p2);
+  LCC::Vector v2 = LCC::Traits::Construct_scaled_vector() (v1,1.0/2);
+
+  LCC::Point p3 = LCC::Traits::Construct_translated_point() (p1,v2);
+
+  (scene.lcc)->insert_point_in_cell<1>(dh,p3,sierpinskiTriangleUpdateAttributes);
+}
+
+void MainWindow::sierpinski_triangle_split_face_in_four(Dart_handle dh, bool removecenter)
+{
+  Dart_handle d1=
+  scene.lcc->insert_cell_1_in_cell_2
+    (scene.lcc->beta(dh,1),scene.lcc->beta(dh,1,1,1),
+     sierpinskiTriangleUpdateAttributes);
+
+  Dart_handle d2=
+  scene.lcc->insert_cell_1_in_cell_2
+    (scene.lcc->beta(d1,2,1),scene.lcc->beta(d1,2,1,1,1),
+     sierpinskiTriangleUpdateAttributes);
+
+  Dart_handle d3=
+  scene.lcc->insert_cell_1_in_cell_2
+    (scene.lcc->beta(d2,2,1),scene.lcc->beta(d2,2,1,1,1),
+     sierpinskiTriangleUpdateAttributes);
+  if ( removecenter )
+  {
+    Triplet <Dart_handle, Dart_handle, Dart_handle> triplet(d1,d2,d3);
+    removedTriangles.push_back(triplet);
+
+    // at this step, the map is correctly 0-embedded, any other attribute is set
+    //  (call of insert_point_in_cell<1> with update_attributes set to true)
+    scene.lcc->remove_cell<2>(scene.lcc->beta(d3,2),sierpinskiTriangleUpdateAttributes);
+
+    if (sierpinskiTriangleUpdateAttributes)
+    {
+      update_volume_list_add(scene.lcc->attribute<3>(scene.lcc->beta(d2,0)));
+      update_volume_list_add(scene.lcc->attribute<3>(scene.lcc->beta(d1,0)));
+    }
+    else
+    {
+      // we dupplicate all 0-embeddings to set them to the splitted vertices
+      (scene.lcc)->set_dart_attribute<0>(scene.lcc->beta(d2,1),(scene.lcc)->create_vertex_attribute(scene.lcc->point(d1)));
+      (scene.lcc)->set_dart_attribute<0>(scene.lcc->beta(d3,1),(scene.lcc)->create_vertex_attribute(scene.lcc->point(d2)));
+      (scene.lcc)->set_dart_attribute<0>(scene.lcc->beta(d1,1),(scene.lcc)->create_vertex_attribute(scene.lcc->point(d3)));
+    }
+  }
+  else
+  {
+    sierpinskiTriangleSurfaces.push_back(scene.lcc->beta(d3,2));
+  }
+
+  sierpinskiTriangleSurfaces.push_back(scene.lcc->beta(d2,0));
+  sierpinskiTriangleSurfaces.push_back(scene.lcc->beta(d1,0));
+}
+
+void MainWindow::onSierpinskiTriangleDec()
+{
+  QApplication::setOverrideCursor( Qt::WaitCursor );
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  CGAL::Timer timer;
+  timer.start();
+#endif
+
+  this->sierpinskiTriangleLevel--;
+
+  int nbt = CGAL::ipower(3,this->sierpinskiTriangleLevel);
+
+  // First we add triangles removed during construction process
+  for ( std::size_t i = removedTriangles.size() - nbt; i < removedTriangles.size(); i++)
+  {
+    Dart_handle d1 = scene.lcc->create_dart();
+    Dart_handle d2 = scene.lcc->create_dart();
+    Dart_handle d3 = scene.lcc->create_dart();
+    scene.lcc->sew<1>(d1,d2);
+    scene.lcc->sew<1>(d2,d3);
+    scene.lcc->sew<1>(d3,d1);
+    scene.lcc->sew<2>(d1, removedTriangles[i].first);
+    scene.lcc->sew<2>(d2, removedTriangles[i].second);
+    scene.lcc->sew<2>(d3, removedTriangles[i].third);
+  }
+
+  removedTriangles.resize(removedTriangles.size() - nbt);
+
+  // We know here the number of Sierpinski surfaces: 3^sierpinskiTriangleLevel
+  // thus we can directly "cut" the std::vector to the correct size.
+  sierpinskiTriangleSurfaces.resize(CGAL::ipower(3,sierpinskiTriangleLevel));
+
+  LCC::size_type markSurfaces = (scene.lcc)->get_new_mark();
+  LCC::size_type markVertices = (scene.lcc)->get_new_mark();
+
+  std::vector<Dart_handle> edges;
+  std::vector<Dart_handle> vertices;
+
+  // Now we remove edges.
+  for ( std::vector<Dart_handle>::iterator
+        itsurfaces=sierpinskiTriangleSurfaces.begin();
+        itsurfaces!=sierpinskiTriangleSurfaces.end(); ++itsurfaces)
+  {
+    Dart_handle dh = *itsurfaces;
+    dh = scene.lcc->beta(dh,1);
+    edges.push_back(dh);
+    dh = scene.lcc->beta(dh,2,1,2);
+    edges.push_back(dh);
+    dh = scene.lcc->beta(dh,2,1,2);
+    edges.push_back(dh);
+  }
+
+  for(std::size_t i = 0; i < edges.size(); i++)
+  {
+    scene.lcc->remove_cell<1>(edges[i],
+                              sierpinskiTriangleUpdateAttributes);
+  }
+  edges.clear();
+
+  // Lastly we remove vertices.
+  for ( std::vector<Dart_handle>::iterator
+        itsurfaces=sierpinskiTriangleSurfaces.begin();
+        itsurfaces!=sierpinskiTriangleSurfaces.end(); ++itsurfaces)
+  {
+    Dart_handle dh = scene.lcc->beta(*itsurfaces,1);
+    if ( !(scene.lcc)->is_marked(dh, markVertices) )
+    {
+      vertices.push_back(dh);
+      CGAL::mark_cell<LCC, 0>(*scene.lcc, dh, markVertices);
+    }
+    dh = scene.lcc->beta(dh,1,1);
+    if ( !(scene.lcc)->is_marked(dh, markVertices) )
+    {
+      vertices.push_back(dh);
+      CGAL::mark_cell<LCC, 0>(*scene.lcc, dh, markVertices);
+    }
+    dh = scene.lcc->beta(dh,1,1);
+    if ( !(scene.lcc)->is_marked(dh, markVertices) )
+    {
+      vertices.push_back(dh);
+      CGAL::mark_cell<LCC, 0>(*scene.lcc, dh, markVertices);
+    }
+  }
+
+  (scene.lcc)->negate_mark(markSurfaces);
+  for ( std::vector<Dart_handle>::iterator
+        itsurfaces=sierpinskiTriangleSurfaces.begin();
+        itsurfaces!=sierpinskiTriangleSurfaces.end(); ++itsurfaces)
+  {
+    Dart_handle dh = scene.lcc->beta(*itsurfaces,1);
+    if ( (scene.lcc)->is_marked(dh, markVertices) )
+      CGAL::unmark_cell<LCC, 0>(*scene.lcc, dh, markVertices);
+    dh = scene.lcc->beta(dh,1,1);
+    if ( (scene.lcc)->is_marked(dh, markVertices) )
+      CGAL::unmark_cell<LCC, 0>(*scene.lcc, dh, markVertices);
+    dh = scene.lcc->beta(dh,1,1);
+    if ( (scene.lcc)->is_marked(dh, markVertices) )
+      CGAL::unmark_cell<LCC, 0>(*scene.lcc, dh, markVertices);
+  }
+
+  (scene.lcc)->negate_mark(markSurfaces);
+  CGAL_assertion( (scene.lcc)->is_whole_map_unmarked(markSurfaces) );
+  CGAL_assertion( (scene.lcc)->is_whole_map_unmarked(markVertices) );
+
+  for(std::size_t i = 0; i < vertices.size(); i++)
+  {
+    scene.lcc->remove_cell<0>(vertices[i],
+                              sierpinskiTriangleUpdateAttributes);
+  }
+  vertices.clear();
+
+  (scene.lcc)->free_mark(markSurfaces);
+  (scene.lcc)->free_mark(markVertices);
+
+  if (!sierpinskiTriangleUpdateAttributes)
+  {
+    scene.lcc->correct_invalid_attributes();
+  }
+
+#ifdef CGAL_PROFILE_LCC_DEMO
+  timer.stop();
+  std::cout<<"Sierpinski triangle "
+           <<this->sierpinskiTriangleLevel+1<<" -> "
+          <<this->sierpinskiTriangleLevel<<", "
+         <<"attributes updated "
+        <<(sierpinskiTriangleUpdateAttributes ? "DURING" : "AFTER")
+       << " construction: "
+       <<timer.time()<<" seconds."<<std::endl;
+#endif
+
+  recreate_whole_volume_list();
+  statusBar()->showMessage(QString ("Sierpinski triangle creation %1 -> %2").
+                           arg(this->sierpinskiTriangleLevel+1).
+                           arg(this->sierpinskiTriangleLevel),
+                           DELAY_STATUSMSG);
+  QApplication::restoreOverrideCursor ();
+
+  Q_EMIT( sceneChanged());
+}
+
+#undef DELAY_STATUSMSG
diff --git a/3rdparty/CGAL-4.8/demo/Linear_cell_complex/MainWindow.h b/3rdparty/CGAL/demo/Linear_cell_complex/MainWindow.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Linear_cell_complex/MainWindow.h
rename to 3rdparty/CGAL/demo/Linear_cell_complex/MainWindow.h
diff --git a/3rdparty/CGAL-4.8/demo/Linear_cell_complex/MainWindow.ui b/3rdparty/CGAL/demo/Linear_cell_complex/MainWindow.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Linear_cell_complex/MainWindow.ui
rename to 3rdparty/CGAL/demo/Linear_cell_complex/MainWindow.ui
diff --git a/3rdparty/CGAL-4.8/demo/Linear_cell_complex/Viewer.cpp b/3rdparty/CGAL/demo/Linear_cell_complex/Viewer.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Linear_cell_complex/Viewer.cpp
rename to 3rdparty/CGAL/demo/Linear_cell_complex/Viewer.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Linear_cell_complex/Viewer.h b/3rdparty/CGAL/demo/Linear_cell_complex/Viewer.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Linear_cell_complex/Viewer.h
rename to 3rdparty/CGAL/demo/Linear_cell_complex/Viewer.h
diff --git a/3rdparty/CGAL-4.8/demo/Linear_cell_complex/about_Linear_cell_complex_3.html b/3rdparty/CGAL/demo/Linear_cell_complex/about_Linear_cell_complex_3.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Linear_cell_complex/about_Linear_cell_complex_3.html
rename to 3rdparty/CGAL/demo/Linear_cell_complex/about_Linear_cell_complex_3.html
diff --git a/3rdparty/CGAL-4.8/demo/Linear_cell_complex/import_moka.h b/3rdparty/CGAL/demo/Linear_cell_complex/import_moka.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Linear_cell_complex/import_moka.h
rename to 3rdparty/CGAL/demo/Linear_cell_complex/import_moka.h
diff --git a/3rdparty/CGAL/demo/Linear_cell_complex/typedefs.h b/3rdparty/CGAL/demo/Linear_cell_complex/typedefs.h
new file mode 100644
index 0000000..1d5a0e9
--- /dev/null
+++ b/3rdparty/CGAL/demo/Linear_cell_complex/typedefs.h
@@ -0,0 +1,205 @@
+// Copyright (c) 2011 CNRS and LIRIS' Establishments (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Guillaume Damiand <guillaume.damiand at liris.cnrs.fr>
+//
+#ifndef TYPEDEFS_H
+#define TYPEDEFS_H
+
+#include <CGAL/Linear_cell_complex.h>
+#include <CGAL/Linear_cell_complex_constructors.h>
+#include <CGAL/Linear_cell_complex_operations.h>
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+#include <CGAL/Combinatorial_map_save_load.h>
+
+#include <CGAL/Triangulation_2_projection_traits_3.h>
+#include <CGAL/Triangulation_vertex_base_with_info_2.h>
+#include <CGAL/Triangulation_face_base_with_info_2.h>
+#include <CGAL/Constrained_Delaunay_triangulation_2.h>
+#include <CGAL/Constrained_triangulation_plus_2.h>
+
+#include <CGAL/IO/Color.h>
+#include <CGAL/Timer.h>
+#include <CGAL/Random.h>
+
+#include <cstdio>
+#include <cstring>
+#include <iostream>
+#include <fstream>
+#include <vector>
+#include <list>
+
+// Global random
+extern CGAL::Random myrandom;
+
+// Use to define properties on volumes.
+#define LCC_DEMO_VISIBLE 1 // if not visible => hidden
+#define LCC_DEMO_FILLED  2 // if not filled, wireframe
+
+class Volume_info
+{
+  friend void CGAL::read_cmap_attribute_node<Volume_info>
+  (const boost::property_tree::ptree::value_type &v,Volume_info &val);
+
+  friend void CGAL::write_cmap_attribute_node<Volume_info>(boost::property_tree::ptree & node,
+                                                           const Volume_info& arg);
+public:
+  Volume_info() : m_color(CGAL::Color(myrandom.get_int(0,256),
+                                      myrandom.get_int(0,256),
+                                      myrandom.get_int(0,256))),
+    m_status( LCC_DEMO_VISIBLE | LCC_DEMO_FILLED )
+  {}
+
+  CGAL::Color& color()
+  { return m_color; }
+  const CGAL::Color& color() const
+  { return m_color; }
+
+  std::string color_name() const
+  {
+    std::ostringstream ss;
+    ss<<std::setfill('0');
+    ss<<"#"<<std::hex<<std::setw(2)<<(int)m_color.red()
+     <<std::setw(2)<<(int)m_color.green()<<std::setw(2)<<(int)m_color.blue();
+    return ss.str();
+  }
+
+  bool is_visible() const
+  { return (m_status & LCC_DEMO_VISIBLE)!=0; }
+  bool is_filled() const
+  { return (m_status & LCC_DEMO_FILLED)!=0; }
+  bool is_filled_and_visible() const
+  { return is_filled() && is_visible(); }
+
+  void set_visible(bool val=true)
+  {
+    if ( is_visible()==val ) return;
+    if ( val ) m_status = m_status | LCC_DEMO_VISIBLE;
+    else       m_status = m_status ^ LCC_DEMO_VISIBLE;
+  }
+  void set_filled(bool val=true)
+  {
+    if ( is_filled()==val ) return;
+    if ( val ) m_status = m_status | LCC_DEMO_FILLED;
+    else       m_status = m_status ^ LCC_DEMO_FILLED;
+  }
+
+  void negate_visible()
+  { set_visible(!is_visible()); }
+  void negate_filled()
+  { set_filled(!is_filled()); }
+
+private:
+  CGAL::Color m_color;
+  char        m_status;
+};
+
+namespace CGAL
+{
+
+template<>
+inline void read_cmap_attribute_node<Volume_info>
+(const boost::property_tree::ptree::value_type &v,Volume_info &val)
+{
+  try
+  {
+    val.m_status = v.second.get<int>("status");
+  }
+  catch(const std::exception &  )
+  {}
+
+  try
+  {
+    char r = v.second.get<int>("color-r");
+    char g = v.second.get<int>("color-g");
+    char b = v.second.get<int>("color-b");
+    val.m_color = CGAL::Color(r,g,b);
+  }
+  catch(const std::exception &  )
+  {}
+}
+
+// Definition of function allowing to save custon information.
+template<>
+inline void write_cmap_attribute_node<Volume_info>(boost::property_tree::ptree & node,
+                                                   const Volume_info& arg)
+{
+  boost::property_tree::ptree & nValue = node.add("v","");
+  nValue.add("status",(int)arg.m_status);
+  nValue.add("color-r",(int)arg.m_color.r());
+  nValue.add("color-g",(int)arg.m_color.g());
+  nValue.add("color-b",(int)arg.m_color.b());
+}
+
+}
+
+class Myitems
+{
+public:
+  template < class Refs >
+  struct Dart_wrapper
+  {
+    typedef CGAL::Dart<3, Refs > Dart;
+
+    typedef CGAL::Cell_attribute_with_point< Refs > Vertex_attrib;
+    typedef CGAL::Cell_attribute< Refs, Volume_info> Volume_attrib;
+
+    typedef CGAL::cpp11::tuple<Vertex_attrib,void,void,
+                               Volume_attrib> Attributes;
+  };
+};
+
+typedef CGAL::Linear_cell_complex_traits
+<3,CGAL::Exact_predicates_inexact_constructions_kernel> Mytraits;
+
+typedef CGAL::Linear_cell_complex<3,3,Mytraits,Myitems> LCC;
+typedef LCC::Dart_handle      Dart_handle;
+typedef LCC::Vertex_attribute Vertex;
+
+typedef LCC::Point    Point_3;
+typedef LCC::Vector   Vector_3;
+
+typedef CGAL::Timer Timer;
+
+struct Vertex_info
+{
+  Dart_handle dh;
+  Vector_3 v;
+};
+
+struct Face_info {
+  bool exist_edge[3];
+  bool is_external;
+  bool is_process;
+};
+
+typedef CGAL::Triangulation_2_projection_traits_3<Mytraits> P_traits;
+typedef CGAL::Triangulation_vertex_base_with_info_2<Vertex_info, P_traits> Vb;
+
+typedef CGAL::Triangulation_face_base_with_info_2<Face_info,P_traits> Fb1;
+
+typedef CGAL::Constrained_triangulation_face_base_2<P_traits, Fb1>    Fb;
+typedef CGAL::Triangulation_data_structure_2<Vb,Fb>                   TDS;
+typedef CGAL::No_intersection_tag                                     Itag;
+typedef CGAL::Constrained_Delaunay_triangulation_2<P_traits, TDS,
+                                                   Itag>              CDT;
+
+struct Scene {
+  LCC* lcc;
+};
+
+#endif
diff --git a/3rdparty/CGAL/demo/Mesh_2/CMakeLists.txt b/3rdparty/CGAL/demo/Mesh_2/CMakeLists.txt
new file mode 100644
index 0000000..eafe883
--- /dev/null
+++ b/3rdparty/CGAL/demo/Mesh_2/CMakeLists.txt
@@ -0,0 +1,34 @@
+# Created by the script cgal_create_cmake_script (and then adapted manually).
+# This is the CMake script for compiling a CGAL application.
+
+project( mesh_2_demo )
+
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+ 
+find_package(CGAL QUIET)
+include( ${CGAL_USE_FILE} )
+
+include_directories(BEFORE ../../include)
+include_directories(BEFORE ../../../Triangulation_2/include)
+
+
+if ( CGAL_FOUND )
+
+  # conform target
+  add_executable  (conform conform.cpp)
+  target_link_libraries(conform ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} )
+  add_to_cached_list( CGAL_EXECUTABLE_TARGETS conform )
+
+  # mesh target
+  add_executable  (mesh mesh.cpp)
+  target_link_libraries(mesh ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} )
+  add_to_cached_list( CGAL_EXECUTABLE_TARGETS mesh )
+
+else()
+
+  message(STATUS "NOTICE: This demo requires CGAL and will not be compiled.")
+
+endif()
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_2/README.txt b/3rdparty/CGAL/demo/Mesh_2/README.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_2/README.txt
rename to 3rdparty/CGAL/demo/Mesh_2/README.txt
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_2/conform.cpp b/3rdparty/CGAL/demo/Mesh_2/conform.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_2/conform.cpp
rename to 3rdparty/CGAL/demo/Mesh_2/conform.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_2/data/butterfly.edg b/3rdparty/CGAL/demo/Mesh_2/data/butterfly.edg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_2/data/butterfly.edg
rename to 3rdparty/CGAL/demo/Mesh_2/data/butterfly.edg
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_2/data/clusters.edg b/3rdparty/CGAL/demo/Mesh_2/data/clusters.edg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_2/data/clusters.edg
rename to 3rdparty/CGAL/demo/Mesh_2/data/clusters.edg
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_2/data/clusters.poly b/3rdparty/CGAL/demo/Mesh_2/data/clusters.poly
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_2/data/clusters.poly
rename to 3rdparty/CGAL/demo/Mesh_2/data/clusters.poly
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_2/data/clusters2.edg b/3rdparty/CGAL/demo/Mesh_2/data/clusters2.edg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_2/data/clusters2.edg
rename to 3rdparty/CGAL/demo/Mesh_2/data/clusters2.edg
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_2/data/fish.edg b/3rdparty/CGAL/demo/Mesh_2/data/fish.edg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_2/data/fish.edg
rename to 3rdparty/CGAL/demo/Mesh_2/data/fish.edg
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_2/data/fish.poly b/3rdparty/CGAL/demo/Mesh_2/data/fish.poly
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_2/data/fish.poly
rename to 3rdparty/CGAL/demo/Mesh_2/data/fish.poly
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_2/data/img1.edg b/3rdparty/CGAL/demo/Mesh_2/data/img1.edg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_2/data/img1.edg
rename to 3rdparty/CGAL/demo/Mesh_2/data/img1.edg
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_2/data/img2.edg b/3rdparty/CGAL/demo/Mesh_2/data/img2.edg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_2/data/img2.edg
rename to 3rdparty/CGAL/demo/Mesh_2/data/img2.edg
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_2/data/img3.edg b/3rdparty/CGAL/demo/Mesh_2/data/img3.edg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_2/data/img3.edg
rename to 3rdparty/CGAL/demo/Mesh_2/data/img3.edg
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_2/data/img4.edg b/3rdparty/CGAL/demo/Mesh_2/data/img4.edg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_2/data/img4.edg
rename to 3rdparty/CGAL/demo/Mesh_2/data/img4.edg
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_2/data/img5.edg b/3rdparty/CGAL/demo/Mesh_2/data/img5.edg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_2/data/img5.edg
rename to 3rdparty/CGAL/demo/Mesh_2/data/img5.edg
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_2/data/img6.edg b/3rdparty/CGAL/demo/Mesh_2/data/img6.edg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_2/data/img6.edg
rename to 3rdparty/CGAL/demo/Mesh_2/data/img6.edg
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_2/data/img7.edg b/3rdparty/CGAL/demo/Mesh_2/data/img7.edg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_2/data/img7.edg
rename to 3rdparty/CGAL/demo/Mesh_2/data/img7.edg
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_2/data/img8.edg b/3rdparty/CGAL/demo/Mesh_2/data/img8.edg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_2/data/img8.edg
rename to 3rdparty/CGAL/demo/Mesh_2/data/img8.edg
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_2/data/lettre_A.edg b/3rdparty/CGAL/demo/Mesh_2/data/lettre_A.edg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_2/data/lettre_A.edg
rename to 3rdparty/CGAL/demo/Mesh_2/data/lettre_A.edg
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_2/data/lettre_A_2.edg b/3rdparty/CGAL/demo/Mesh_2/data/lettre_A_2.edg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_2/data/lettre_A_2.edg
rename to 3rdparty/CGAL/demo/Mesh_2/data/lettre_A_2.edg
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_2/data/trivial.poly b/3rdparty/CGAL/demo/Mesh_2/data/trivial.poly
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_2/data/trivial.poly
rename to 3rdparty/CGAL/demo/Mesh_2/data/trivial.poly
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_2/mesh.cpp b/3rdparty/CGAL/demo/Mesh_2/mesh.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_2/mesh.cpp
rename to 3rdparty/CGAL/demo/Mesh_2/mesh.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/C3t3_type.h b/3rdparty/CGAL/demo/Mesh_3/C3t3_type.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/C3t3_type.h
rename to 3rdparty/CGAL/demo/Mesh_3/C3t3_type.h
diff --git a/3rdparty/CGAL/demo/Mesh_3/CMakeLists.txt b/3rdparty/CGAL/demo/Mesh_3/CMakeLists.txt
new file mode 100644
index 0000000..8643834
--- /dev/null
+++ b/3rdparty/CGAL/demo/Mesh_3/CMakeLists.txt
@@ -0,0 +1,391 @@
+# This is the CMake script for compiling the CGAL Mesh_3 demo.
+
+project( Mesh_3_demo )
+
+# Find includes in corresponding build directories
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+# Instruct CMake to run moc automatically when needed.
+set(CMAKE_AUTOMOC ON)
+
+
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+# Compatibility with CMake 3.0
+if(POLICY CMP0042)
+  # Do not enable the use of MACOSX_RPATH
+  # http://www.cmake.org/cmake/help/v3.0/policy/CMP0042.html
+  cmake_policy(SET CMP0042 OLD)
+endif()
+
+
+# Creates a new CMake option, turned ON by default
+option(ACTIVATE_MSVC_PRECOMPILED_HEADERS
+  "Activate precompiled headers in MSVC"
+  OFF)
+
+# Macro to add precompiled headers for MSVC
+# This function does two things:
+# 1. Enable precompiled headers on each file which is listed in "SourcesVar".
+# 2. Add the content of "PrecompiledSource" (e.g. "StdAfx.cpp") to "SourcesVar".
+MACRO(ADD_MSVC_PRECOMPILED_HEADER PrecompiledHeader PrecompiledSource SourcesVar)
+  IF(MSVC AND ACTIVATE_MSVC_PRECOMPILED_HEADERS)
+    GET_FILENAME_COMPONENT(PrecompiledBasename ${PrecompiledHeader} NAME_WE)
+    SET(Sources ${${SourcesVar}})
+
+    SET_SOURCE_FILES_PROPERTIES(${PrecompiledSource}
+                                PROPERTIES COMPILE_FLAGS "/Yc\"${PrecompiledHeader}\"")
+    SET_SOURCE_FILES_PROPERTIES(${Sources}
+                                PROPERTIES COMPILE_FLAGS "/Yu\"${PrecompiledHeaders}\" /FI\"${PrecompiledHeader}\"")
+    # Add precompiled header to SourcesVar
+    LIST(APPEND ${SourcesVar} ${PrecompiledSource})
+  ENDIF(MSVC AND ACTIVATE_MSVC_PRECOMPILED_HEADERS)
+ENDMACRO(ADD_MSVC_PRECOMPILED_HEADER)
+# The compiler might need more memory because of precompiled headers
+if(MSVC AND ACTIVATE_MSVC_PRECOMPILED_HEADERS AND NOT(MSVC_VERSION LESS 1310))
+  set(CGAL_C_FLAGS "${CGAL_C_FLAGS} /Zm1000")
+  set(CGAL_CXX_FLAGS "${CGAL_CXX_FLAGS} /Zm1000")
+endif()
+
+# Let plugins be compiled in the same directory as the executable.
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
+
+#option(MESH_3_DEMO_ENABLE_FORWARD_DECL "In the Mesh_3 demo, enable " OFF)
+#mark_as_advanced(MESH_3_DEMO_ENABLE_FORWARD_DECL)
+
+# Include this package's headers first
+include_directories( BEFORE ./ ./include ../../include )
+
+# Disable deprecated Mesh_3 names
+add_definitions(-DCGAL_MESH_3_NO_DEPRECATED_SURFACE_INDEX
+                -DCGAL_MESH_3_NO_DEPRECATED_C3T3_ITERATORS)
+
+# Add specific Find.cmake modules
+set(CMAKE_MODULE_PATH 
+  ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
+
+# Activate concurrency ? (turned OFF by default)
+option(ACTIVATE_CONCURRENT_MESH_3
+  "Activate parallelism in Mesh_3"
+  OFF)
+  
+# Find CGAL and CGAL Qt5
+find_package(CGAL COMPONENTS Qt5 ImageIO)
+include( ${CGAL_USE_FILE} )
+# And add -DCGAL_CONCURRENT_MESH_3 if that option is ON
+if( ACTIVATE_CONCURRENT_MESH_3 )
+  add_definitions( -DCGAL_CONCURRENT_MESH_3 )
+  find_package( TBB REQUIRED )
+else( ACTIVATE_CONCURRENT_MESH_3 )
+  option( LINK_WITH_TBB
+    "Link with TBB anyway so we can use TBB timers for profiling"
+    ON)
+  if( LINK_WITH_TBB )
+    find_package( TBB )
+  endif( LINK_WITH_TBB )
+endif()
+
+if( TBB_FOUND )
+  include(${TBB_USE_FILE})
+endif()
+
+# Find Qt5 itself
+find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL)
+
+# Find OpenGL
+find_package(OpenGL)
+
+# Find everybodies darling
+find_package(Boost COMPONENTS thread system)
+
+# Find QGLViewer
+
+if(Qt5_FOUND)
+
+ add_definitions(-DQT_NO_KEYWORDS)
+ add_definitions(-DSCENE_SEGMENTED_IMAGE_GL_BUFFERS_AVAILABLE)
+
+ find_package(QGLViewer )
+endif(Qt5_FOUND)
+
+
+if(CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND AND Boost_FOUND)
+
+  # Add directory containing implicit function plugin source files
+  add_subdirectory("implicit_functions")
+
+  include_directories ( ${QGLVIEWER_INCLUDE_DIR} )
+
+  qt5_wrap_ui( UI_FILES ui_files/MainWindow.ui )
+  qt5_wrap_ui( meshingUI_FILES  ui_files/Meshing_dialog.ui)
+  qt5_wrap_ui( optimUI_FILES  ui_files/Smoother_dialog.ui ui_files/LocalOptim_dialog.ui)
+  qt5_wrap_ui( ribUI_FILES  ui_files/Rib_dialog.ui)
+  qt5_wrap_ui( funcUI_FILES  ui_files/Function_dialog.ui)
+  qt5_wrap_ui( imgUI_FILES ui_files/Image_res_dialog.ui)
+
+  include(AddFileDependencies)
+
+  # Shared demo files directory
+  set(DEMO_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/CGAL_demo")
+  set(DEMO_H_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/CGAL_demo")
+
+  qt5_generate_moc( "MainWindow.h" "${CMAKE_CURRENT_BINARY_DIR}/MainWindow_moc.cpp" )
+  add_file_dependencies( MainWindow_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/MainWindow.h" )
+
+  qt5_generate_moc( "${DEMO_H_DIR}/Viewer.h" Viewer_moc.cpp )
+  add_file_dependencies( Viewer_moc.cpp "${DEMO_H_DIR}/Viewer.h" )
+
+  qt5_generate_moc( "${DEMO_H_DIR}/Scene.h" Scene_moc.cpp )
+  add_file_dependencies( Scene_moc.cpp "${DEMO_H_DIR}/Scene.h" )
+
+  qt5_generate_moc( "${DEMO_H_DIR}/Scene_item.h" Scene_item_moc.cpp )
+  add_file_dependencies( Scene_item_moc.cpp "${DEMO_H_DIR}/Scene_item.h" )
+
+  qt5_wrap_cpp( VOLUME_MOC_OUTFILES ${CMAKE_CURRENT_SOURCE_DIR}/Volume_plane_thread.h )
+  qt5_wrap_cpp( VOLUME_MOC_OUTFILES ${CMAKE_CURRENT_SOURCE_DIR}/Volume_plane_interface.h )
+
+  qt5_add_resources ( CGAL_Qt5_RESOURCE_FILES Mesh_3.qrc )
+
+  # put plugins (which are shared libraries) at the same location as
+  # executable files
+  set(LIBRARY_OUTPUT_PATH ${RUNTIME_OUTPUT_PATH})
+
+  # prefix for Mesh_3 libs to avoid conflicts with Polyhedron demo
+  set(MESH_3_LIB_PREFIX "mesh_3_demo_")
+
+  # AUXILIARY LIBRARIES
+  set(VIEWER_LIB "${MESH_3_LIB_PREFIX}viewer")
+  add_library(${VIEWER_LIB} SHARED
+    ${DEMO_SRC_DIR}/Viewer.cpp Viewer_moc.cpp)
+  qt5_use_modules(${VIEWER_LIB} Xml Script OpenGL Svg)
+  target_link_libraries(${VIEWER_LIB} ${QGLVIEWER_LIBRARIES} ${QT_LIBRARIES} ${OPENGL_LIBRARIES})
+  set_target_properties(${VIEWER_LIB} PROPERTIES DEFINE_SYMBOL viewer_EXPORTS)
+
+  set(SCENE_ITEM_LIB "${MESH_3_LIB_PREFIX}scene_item")
+  add_library(${SCENE_ITEM_LIB} SHARED
+    ${DEMO_SRC_DIR}/Scene_item.cpp
+    Scene_item_moc.cpp
+    ${DEMO_SRC_DIR}/Plugin_helper.cpp)
+  qt5_use_modules(${SCENE_ITEM_LIB} Xml Script OpenGL Svg)
+  set_target_properties(${SCENE_ITEM_LIB} PROPERTIES DEFINE_SYMBOL scene_item_EXPORTS)
+  target_link_libraries(${SCENE_ITEM_LIB} ${QT_LIBRARIES} ${OPENGL_LIBRARIES})
+
+  set(SCENE_SEGMENTED_IMAGE_ITEM_LIB "${MESH_3_LIB_PREFIX}scene_segmented_image_item")
+  add_library(${SCENE_SEGMENTED_IMAGE_ITEM_LIB} SHARED
+    Scene_segmented_image_item.cpp)
+  qt5_use_modules(${SCENE_SEGMENTED_IMAGE_ITEM_LIB} Xml Script OpenGL Svg)
+  target_link_libraries(${SCENE_SEGMENTED_IMAGE_ITEM_LIB} ${SCENE_ITEM_LIB} ${QGLVIEWER_LIBRARIES} ${CGAL_LIBRARIES} ${TBB_LIBRARIES})
+  set_target_properties(${SCENE_SEGMENTED_IMAGE_ITEM_LIB} PROPERTIES DEFINE_SYMBOL scene_segmented_image_item_EXPORTS)
+
+  set(SCENE_POLYHEDRON_ITEM_LIB "${MESH_3_LIB_PREFIX}scene_polyhedron_item")
+  add_library(${SCENE_POLYHEDRON_ITEM_LIB} SHARED
+    Scene_polyhedron_item.cpp )
+  qt5_use_modules(${SCENE_POLYHEDRON_ITEM_LIB} Xml Script OpenGL Svg)
+  target_link_libraries(${SCENE_POLYHEDRON_ITEM_LIB} ${SCENE_ITEM_LIB}  ${QGLVIEWER_LIBRARIES} ${CGAL_LIBRARIES} ${TBB_LIBRARIES})
+  set_target_properties(${SCENE_POLYHEDRON_ITEM_LIB} PROPERTIES DEFINE_SYMBOL scene_polyhedron_item_EXPORTS)
+
+  set(POLYGON_SOUP_LIB "${MESH_3_LIB_PREFIX}polygon_soup")
+  add_library(${POLYGON_SOUP_LIB} SHARED
+    Scene_polygon_soup.cpp )
+  qt5_use_modules(${POLYGON_SOUP_LIB} Xml Script OpenGL Svg)
+  target_link_libraries(${POLYGON_SOUP_LIB} ${SCENE_ITEM_LIB}  ${QGLVIEWER_LIBRARIES} ${CGAL_LIBRARIES} ${TBB_LIBRARIES})
+  set_target_properties(${POLYGON_SOUP_LIB} PROPERTIES DEFINE_SYMBOL polygon_soup_EXPORTS)
+
+  set(SCENE_C3T3_ITEM_LIB "${MESH_3_LIB_PREFIX}scene_c3t3_item")
+  set (SCENE_C3T3_ITEM_LIB_SOURCE_FILES Scene_c3t3_item.cpp)
+  ADD_MSVC_PRECOMPILED_HEADER("StdAfx.h" "StdAfx.cpp" SCENE_C3T3_ITEM_LIB_SOURCE_FILES)
+
+  add_library(${SCENE_C3T3_ITEM_LIB} SHARED
+    ${SCENE_C3T3_ITEM_LIB_SOURCE_FILES})
+  qt5_use_modules(${SCENE_C3T3_ITEM_LIB} Xml Script OpenGL Svg)
+  target_link_libraries(${SCENE_C3T3_ITEM_LIB} ${SCENE_ITEM_LIB} ${QGLVIEWER_LIBRARIES} ${QT_LIBRARIES} ${CGAL_LIBRARIES} ${Boost_LIBRARIES} ${TBB_LIBRARIES})
+  set_target_properties(${SCENE_C3T3_ITEM_LIB} PROPERTIES DEFINE_SYMBOL scene_c3t3_item_EXPORTS)
+
+  set(SCENE_IMPLICIT_FUNCTION_ITEM_LIB "${MESH_3_LIB_PREFIX}scene_implicit_function_item")
+  add_library(${SCENE_IMPLICIT_FUNCTION_ITEM_LIB} SHARED
+    Scene_implicit_function_item.cpp Color_ramp.cpp)
+  qt5_use_modules(${SCENE_IMPLICIT_FUNCTION_ITEM_LIB} Xml Script OpenGL Svg)
+  target_link_libraries(${SCENE_IMPLICIT_FUNCTION_ITEM_LIB} ${SCENE_ITEM_LIB} ${QGLVIEWER_LIBRARIES} ${QT_LIBRARIES} ${TBB_LIBRARIES})
+  set_target_properties(${SCENE_IMPLICIT_FUNCTION_ITEM_LIB} PROPERTIES DEFINE_SYMBOL scene_implicit_function_item_EXPORTS)
+
+  
+  add_definitions(-DUSE_FORWARD_DECL)
+  add_definitions(-DQT_STATICPLUGIN)
+    set (MESH_3_SOURCE_FILES 
+      MainWindow.cpp
+      Mesh_3.cpp
+      ${DEMO_SRC_DIR}/Scene.cpp
+
+      Scene_moc.cpp)
+    #ADD_MSVC_PRECOMPILED_HEADER("StdAfx.h" "StdAfx.cpp" MESH_3_SOURCE_FILES)
+    LIST(APPEND MESH_3_SOURCE_FILES ${UI_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES})
+    add_executable( Mesh_3 ${MESH_3_SOURCE_FILES} )
+    qt5_use_modules(Mesh_3 Xml Script OpenGL Svg)
+    add_to_cached_list( CGAL_EXECUTABLE_TARGETS Mesh_3 )
+
+  # Link with Qt libraries
+  target_link_libraries( Mesh_3 ${QT_LIBRARIES} )
+
+  # Link with CGAL
+  target_link_libraries( Mesh_3 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ${TBB_LIBRARIES})
+
+  # Link with libQGLViewer, OpenGL
+  target_link_libraries( Mesh_3 ${QGLVIEWER_LIBRARIES} ${OPENGL_gl_LIBRARY})
+
+#  # Link with the scene_item library.
+#  target_link_libraries( Mesh_3 scene_item )
+
+  target_link_libraries( Mesh_3 ${VIEWER_LIB} )
+
+
+  add_to_cached_list( CGAL_EXECUTABLE_TARGETS Mesh_3 )
+
+
+  ###########
+  # PLUGINS #
+  ###########
+  remove_definitions(-DQT_STATICPLUGIN)
+
+  # polyhedron_demo_plugin is a macro copied from demo/Polyhedron/CMakeLists.txt
+  macro(polyhedron_demo_plugin plugin_name plugin_implementation_base_name)
+    list_split(option ARGN_TAIL ${ARGN} )
+    if(NOT ${option} STREQUAL "EXCLUDE_FROM_ALL")
+      set(other_sources ${ARGN})
+      set(option "")
+    else()
+      set(other_sources ${ARGN_TAIL})
+    endif()
+    qt5_generate_moc( "${CMAKE_CURRENT_SOURCE_DIR}/${plugin_implementation_base_name}.cpp" ${plugin_implementation_base_name}.moc )
+    add_file_dependencies( ${plugin_implementation_base_name}.moc "${CMAKE_CURRENT_SOURCE_DIR}/${plugin_implementation_base_name}.cpp" )
+
+    add_library(${plugin_name} MODULE ${option} ${plugin_implementation_base_name}.moc ${plugin_implementation_base_name}.cpp ${other_sources})
+    qt5_use_modules(${plugin_name} Xml Script OpenGL Svg)
+    add_to_cached_list( CGAL_EXECUTABLE_TARGETS ${plugin_name} )
+    # Link with Qt
+    target_link_libraries( ${plugin_name} ${QT_LIBRARIES} )
+    # Link with scene_item
+    target_link_libraries( ${plugin_name} ${SCENE_ITEM_LIB})
+    # Link with CGAL
+    target_link_libraries( ${plugin_name} ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ${TBB_LIBRARIES})
+  endmacro(polyhedron_demo_plugin)
+
+  set(IO_IMAGE_PLUGIN_LIB "${MESH_3_LIB_PREFIX}io_image_plugin")
+  polyhedron_demo_plugin(${IO_IMAGE_PLUGIN_LIB} Io_image_plugin ${imgUI_FILES})
+  target_link_libraries(${IO_IMAGE_PLUGIN_LIB} ${SCENE_SEGMENTED_IMAGE_ITEM_LIB})
+
+  set(IO_OFF_PLUGIN_LIB "${MESH_3_LIB_PREFIX}io_off_plugin")
+  polyhedron_demo_plugin(${IO_OFF_PLUGIN_LIB} Io_off_plugin)
+  target_link_libraries(${IO_OFF_PLUGIN_LIB} ${SCENE_POLYHEDRON_ITEM_LIB} ${POLYGON_SOUP_LIB})
+
+  if(Qt5_FOUND)
+    set(VOLUME_PLANES_PLUGIN_LIB "${MESH_3_LIB_PREFIX}volume_planes_plugin")
+    polyhedron_demo_plugin(${VOLUME_PLANES_PLUGIN_LIB} Volume_planes_plugin
+                           ${VOLUME_MOC_OUTFILES}
+                           Volume_plane_intersection.cpp)
+    target_link_libraries(${VOLUME_PLANES_PLUGIN_LIB} ${SCENE_SEGMENTED_IMAGE_ITEM_LIB} ${VIEWER_LIB})
+  endif()
+
+  set(IO_C3T3_PLUGIN_LIB "${MESH_3_LIB_PREFIX}io_c3t3_plugin")
+  polyhedron_demo_plugin(${IO_C3T3_PLUGIN_LIB} Io_c3t3_plugin)
+  target_link_libraries(${IO_C3T3_PLUGIN_LIB} ${SCENE_C3T3_ITEM_LIB})
+
+  if ( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/C3t3_rib_exporter_plugin.cpp" )
+    set(C3T3_RIB_EXPORTER_PLUGIN_LIB "${MESH_3_LIB_PREFIX}c3t3_rib_exporter_plugin")
+    polyhedron_demo_plugin(${C3T3_RIB_EXPORTER_PLUGIN_LIB} C3t3_rib_exporter_plugin ${ribUI_FILES})
+    target_link_libraries(${C3T3_RIB_EXPORTER_PLUGIN_LIB} ${SCENE_C3T3_ITEM_LIB} ${VIEWER_LIB})
+  endif()
+
+  set(IO_IMPLICIT_FUNCTION_PLUGIN_LIB "${MESH_3_LIB_PREFIX}io_implicit_function_plugin")
+  polyhedron_demo_plugin(${IO_IMPLICIT_FUNCTION_PLUGIN_LIB} Io_implicit_function_plugin ${funcUI_FILES})
+  target_link_libraries(${IO_IMPLICIT_FUNCTION_PLUGIN_LIB} ${SCENE_IMPLICIT_FUNCTION_ITEM_LIB})
+
+  set(MESH_3_PLUGIN_LIB "${MESH_3_LIB_PREFIX}mesh_3_plugin") 
+  set(MESH_3_PLUGIN_SOURCE_FILES
+    Mesh_3_plugin.cpp
+    Mesh_3_plugin_polyhedron_cgal_code.cpp
+    Mesh_3_plugin_image_cgal_code.cpp
+    Mesh_3_plugin_implicit_function_cgal_code.cpp
+    Meshing_thread.cpp)
+  ADD_MSVC_PRECOMPILED_HEADER("StdAfx.h" "StdAfx.cpp" MESH_3_PLUGIN_SOURCE_FILES)
+  LIST(REMOVE_AT MESH_3_PLUGIN_SOURCE_FILES 0) # Remove Mesh_3_plugin.cpp since it's added by polyhedron_demo_plugin
+  LIST(APPEND MESH_3_PLUGIN_SOURCE_FILES  ${meshingUI_FILES})
+  polyhedron_demo_plugin(${MESH_3_PLUGIN_LIB} Mesh_3_plugin ${MESH_3_PLUGIN_SOURCE_FILES})
+
+#  set(MESH_3_PLUGIN_LIB "${MESH_3_LIB_PREFIX}mesh_3_plugin") 
+#  polyhedron_demo_plugin(${MESH_3_PLUGIN_LIB} Mesh_3_plugin 
+#                         Mesh_3_plugin_polyhedron_cgal_code.cpp
+#                         Mesh_3_plugin_image_cgal_code.cpp
+#                         Mesh_3_plugin_implicit_function_cgal_code.cpp
+#                         Meshing_thread.cpp
+#                         Scene_c3t3_item.moc
+#                         ${meshingUI_FILES})
+
+  target_link_libraries(${MESH_3_PLUGIN_LIB}
+                        ${SCENE_C3T3_ITEM_LIB}
+                        ${SCENE_POLYHEDRON_ITEM_LIB}
+                        ${SCENE_SEGMENTED_IMAGE_ITEM_LIB}
+                        ${SCENE_IMPLICIT_FUNCTION_ITEM_LIB}
+                        ${QGLVIEWER_LIBRARIES}
+                        ${OPENGL_gl_LIBRARY}
+                        ${TBB_LIBRARIES})
+
+  set(MESH_3_OPTIMIZATION_PLUGIN_LIB "${MESH_3_LIB_PREFIX}mesh_3_optimization_plugin")
+  set(MESH_3_OPTIMIZATION_PLUGIN_SOURCE_FILES
+    Mesh_3_optimization_plugin.cpp
+    Mesh_3_optimization_plugin_cgal_code.cpp
+    Optimizer_thread.cpp)
+  ADD_MSVC_PRECOMPILED_HEADER("StdAfx.h" "StdAfx.cpp" MESH_3_OPTIMIZATION_PLUGIN_SOURCE_FILES)
+  LIST(REMOVE_AT MESH_3_OPTIMIZATION_PLUGIN_SOURCE_FILES 0) # Remove Mesh_3_optimization_plugin.cpp since it's added by polyhedron_demo_plugin
+  LIST(APPEND MESH_3_OPTIMIZATION_PLUGIN_SOURCE_FILES ${optimUI_FILES})
+  polyhedron_demo_plugin(${MESH_3_OPTIMIZATION_PLUGIN_LIB} Mesh_3_optimization_plugin ${MESH_3_OPTIMIZATION_PLUGIN_SOURCE_FILES})
+
+  target_link_libraries(${MESH_3_OPTIMIZATION_PLUGIN_LIB}
+                        ${SCENE_C3T3_ITEM_LIB}
+                        ${SCENE_POLYHEDRON_ITEM_LIB}
+                        ${SCENE_SEGMENTED_IMAGE_ITEM_LIB}
+                        ${SCENE_IMPLICIT_FUNCTION_ITEM_LIB}
+                        ${QGLVIEWER_LIBRARIES}
+                        ${OPENGL_gl_LIBRARY}
+                        ${TBB_LIBRARIES})
+
+
+else (CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND AND Boost_FOUND)
+
+  set(MESH_3_MISSING_DEPS "")
+
+  if(NOT CGAL_Qt5_FOUND)
+    set(MESH_3_MISSING_DEPS "the CGAL Qt5 library, ${MESH_3_MISSING_DEPS}")
+  endif()
+
+  if(NOT Qt5_FOUND)
+    set(MESH_3_MISSING_DEPS "Qt5, ${MESH_3_MISSING_DEPS}")
+  endif()
+
+  if(NOT OPENGL_FOUND)
+    set(MESH_3_MISSING_DEPS "OpenGL, ${MESH_3_MISSING_DEPS}")
+  endif()
+
+  if(NOT QGLVIEWER_FOUND)
+    set(MESH_3_MISSING_DEPS "QGLViewer, ${MESH_3_MISSING_DEPS}")
+  endif()
+
+  if(NOT QGLVIEWER_FOUND)
+    set(MESH_3_MISSING_DEPS "QGLViewer, ${MESH_3_MISSING_DEPS}")
+  endif()
+
+  if(NOT QGLVIEWER_FOUND)
+    set(MESH_3_MISSING_DEPS "QGLViewer, ${MESH_3_MISSING_DEPS}")
+  endif()
+
+  if(NOT Boost_FOUND)
+    set(MESH_3_MISSING_DEPS "Boost, ${MESH_3_MISSING_DEPS}")
+  endif()
+
+  message(STATUS "NOTICE: This demo requires ${MESH_3_MISSING_DEPS}and will not be compiled.")
+
+endif (CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND AND Boost_FOUND)
+
+
+
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Color_ramp.cpp b/3rdparty/CGAL/demo/Mesh_3/Color_ramp.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Color_ramp.cpp
rename to 3rdparty/CGAL/demo/Mesh_3/Color_ramp.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Color_ramp.h b/3rdparty/CGAL/demo/Mesh_3/Color_ramp.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Color_ramp.h
rename to 3rdparty/CGAL/demo/Mesh_3/Color_ramp.h
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Image_type.h b/3rdparty/CGAL/demo/Mesh_3/Image_type.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Image_type.h
rename to 3rdparty/CGAL/demo/Mesh_3/Image_type.h
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Image_type_fwd.h b/3rdparty/CGAL/demo/Mesh_3/Image_type_fwd.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Image_type_fwd.h
rename to 3rdparty/CGAL/demo/Mesh_3/Image_type_fwd.h
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Io_c3t3_plugin.cpp b/3rdparty/CGAL/demo/Mesh_3/Io_c3t3_plugin.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Io_c3t3_plugin.cpp
rename to 3rdparty/CGAL/demo/Mesh_3/Io_c3t3_plugin.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Io_image_plugin.cpp b/3rdparty/CGAL/demo/Mesh_3/Io_image_plugin.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Io_image_plugin.cpp
rename to 3rdparty/CGAL/demo/Mesh_3/Io_image_plugin.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Io_implicit_function_plugin.cpp b/3rdparty/CGAL/demo/Mesh_3/Io_implicit_function_plugin.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Io_implicit_function_plugin.cpp
rename to 3rdparty/CGAL/demo/Mesh_3/Io_implicit_function_plugin.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Io_off_plugin.cpp b/3rdparty/CGAL/demo/Mesh_3/Io_off_plugin.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Io_off_plugin.cpp
rename to 3rdparty/CGAL/demo/Mesh_3/Io_off_plugin.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/MainWindow.cpp b/3rdparty/CGAL/demo/Mesh_3/MainWindow.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/MainWindow.cpp
rename to 3rdparty/CGAL/demo/Mesh_3/MainWindow.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/MainWindow.h b/3rdparty/CGAL/demo/Mesh_3/MainWindow.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/MainWindow.h
rename to 3rdparty/CGAL/demo/Mesh_3/MainWindow.h
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Mesh_3.cpp b/3rdparty/CGAL/demo/Mesh_3/Mesh_3.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Mesh_3.cpp
rename to 3rdparty/CGAL/demo/Mesh_3/Mesh_3.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Mesh_3.qrc b/3rdparty/CGAL/demo/Mesh_3/Mesh_3.qrc
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Mesh_3.qrc
rename to 3rdparty/CGAL/demo/Mesh_3/Mesh_3.qrc
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Mesh_3_optimization_plugin.cpp b/3rdparty/CGAL/demo/Mesh_3/Mesh_3_optimization_plugin.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Mesh_3_optimization_plugin.cpp
rename to 3rdparty/CGAL/demo/Mesh_3/Mesh_3_optimization_plugin.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Mesh_3_optimization_plugin_cgal_code.cpp b/3rdparty/CGAL/demo/Mesh_3/Mesh_3_optimization_plugin_cgal_code.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Mesh_3_optimization_plugin_cgal_code.cpp
rename to 3rdparty/CGAL/demo/Mesh_3/Mesh_3_optimization_plugin_cgal_code.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Mesh_3_plugin.cpp b/3rdparty/CGAL/demo/Mesh_3/Mesh_3_plugin.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Mesh_3_plugin.cpp
rename to 3rdparty/CGAL/demo/Mesh_3/Mesh_3_plugin.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Mesh_3_plugin_image_cgal_code.cpp b/3rdparty/CGAL/demo/Mesh_3/Mesh_3_plugin_image_cgal_code.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Mesh_3_plugin_image_cgal_code.cpp
rename to 3rdparty/CGAL/demo/Mesh_3/Mesh_3_plugin_image_cgal_code.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Mesh_3_plugin_implicit_function_cgal_code.cpp b/3rdparty/CGAL/demo/Mesh_3/Mesh_3_plugin_implicit_function_cgal_code.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Mesh_3_plugin_implicit_function_cgal_code.cpp
rename to 3rdparty/CGAL/demo/Mesh_3/Mesh_3_plugin_implicit_function_cgal_code.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Mesh_3_plugin_polyhedron_cgal_code.cpp b/3rdparty/CGAL/demo/Mesh_3/Mesh_3_plugin_polyhedron_cgal_code.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Mesh_3_plugin_polyhedron_cgal_code.cpp
rename to 3rdparty/CGAL/demo/Mesh_3/Mesh_3_plugin_polyhedron_cgal_code.cpp
diff --git a/3rdparty/CGAL/demo/Mesh_3/Mesh_function.h b/3rdparty/CGAL/demo/Mesh_3/Mesh_function.h
new file mode 100644
index 0000000..821c7b8
--- /dev/null
+++ b/3rdparty/CGAL/demo/Mesh_3/Mesh_function.h
@@ -0,0 +1,265 @@
+// Copyright (c) 2010 INRIA Sophia-Antipolis (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
+// 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(s)     : Stephane Tayeb
+//
+//******************************************************************************
+// File Description : 
+//******************************************************************************
+
+#ifndef CGAL_DEMO_MESH_3_MESH_FUNCTION_H
+#define CGAL_DEMO_MESH_3_MESH_FUNCTION_H
+
+#define CGAL_MESH_3_MESHER_STATUS_ACTIVATED 1
+
+#include <CGAL/Mesh_3/Concurrent_mesher_config.h>
+
+#include <QStringList>
+#include <QString>
+
+#include <CGAL/Mesh_3/Mesher_3.h>
+#include <CGAL/Mesh_criteria_3.h>
+#include <CGAL/Mesh_3/Protect_edges_sizing_field.h>
+
+#include "C3t3_type.h"
+#include "Meshing_thread.h"
+#include <CGAL/make_mesh_3.h> // for C3t3_initializer
+#include <CGAL/use.h>
+
+struct Mesh_parameters
+{
+  double facet_angle;
+  double facet_sizing;
+  double facet_approx;
+  
+  double tet_shape;
+  double tet_sizing;
+  bool protect_features;
+  
+  inline QStringList log() const;
+};
+
+
+template < typename Domain_ >
+class Mesh_function
+  : public Mesh_function_interface
+{
+  typedef Domain_ Domain;
+  
+public:
+  Mesh_function(C3t3& c3t3, Domain* domain, const Mesh_parameters& p);
+  
+  ~Mesh_function();
+  
+  // Launch
+  virtual void launch();
+  
+  // Stop
+  virtual void stop();
+  
+  // Logs
+  virtual QStringList parameters_log() const;
+  virtual QString status(double time_period) const;
+
+private:
+  typedef typename Domain::Point_3                  Point_3;
+  typedef typename Domain::Index                    Index;
+  typedef std::vector<std::pair<Point_3, Index> >   Initial_points_vector;
+  typedef typename Initial_points_vector::iterator  Ipv_iterator;
+  typedef C3t3::Vertex_handle                       Vertex_handle;
+  
+  typedef C3t3::Triangulation                       Tr;
+  typedef CGAL::Mesh_criteria_3<Tr>                 Mesh_criteria;
+  typedef Mesh_criteria::Edge_criteria              Edge_criteria;
+  typedef Mesh_criteria::Facet_criteria             Facet_criteria;
+  typedef Mesh_criteria::Cell_criteria              Cell_criteria;
+  
+  typedef CGAL::Mesh_3::Mesher_3<C3t3, Mesh_criteria, Domain>   Mesher;
+  
+private:
+  C3t3& c3t3_;
+  Domain* domain_;
+  Mesh_parameters p_;
+  bool continue_;
+  Mesher* mesher_;
+#ifdef CGAL_MESH_3_MESHER_STATUS_ACTIVATED
+  mutable typename Mesher::Mesher_status last_report_;
+#endif
+};
+
+
+
+// -----------------------------------
+// Class Mesh_parameters
+// -----------------------------------
+inline
+QStringList
+Mesh_parameters::
+log() const
+{
+  return QStringList()
+  << QString("facet min angle: %1").arg(facet_angle)
+  << QString("facet max size: %1").arg(facet_sizing)
+  << QString("facet approx error: %1").arg(facet_approx)
+  << QString("tet shape (radius-edge): %1").arg(tet_shape)
+  << QString("tet max size: %1").arg(tet_sizing)
+  << QString("protect features: %1").arg(protect_features);
+}
+
+
+// -----------------------------------
+// Class Mesh_function
+// -----------------------------------
+template < typename D_ >
+Mesh_function<D_>::
+Mesh_function(C3t3& c3t3, Domain* domain, const Mesh_parameters& p)
+: c3t3_(c3t3)
+, domain_(domain)
+, p_(p)
+, continue_(true)
+, mesher_(NULL)
+#ifdef CGAL_MESH_3_MESHER_STATUS_ACTIVATED
+, last_report_(0,0,0)
+#endif
+{
+#ifdef CGAL_CONCURRENT_MESH_3
+  Concurrent_mesher_config::load_config_file(CONFIG_FILENAME, false);
+#endif
+}
+
+
+template < typename D_ >
+Mesh_function<D_>::
+~Mesh_function()
+{
+  delete domain_;
+  delete mesher_;
+}
+
+
+template < typename D_ >
+void
+Mesh_function<D_>::
+launch()
+{
+#ifdef CGAL_MESH_3_INITIAL_POINTS_NO_RANDOM_SHOOTING
+  CGAL::get_default_random() = CGAL::Random(0);
+#endif
+
+  // Create mesh criteria
+  Mesh_criteria criteria(Edge_criteria(p_.facet_sizing),
+                         Facet_criteria(p_.facet_angle,
+                                        p_.facet_sizing,
+                                        p_.facet_approx),
+                         Cell_criteria(p_.tet_shape,
+                                       p_.tet_sizing));
+
+  // Initialization of the mesh, either with the protection of sharp
+  // features, or with the initial points (or both).
+  CGAL::internal::Mesh_3::C3t3_initializer<
+    C3t3,
+    Domain,
+    Mesh_criteria,
+    CGAL::internal::Mesh_3::has_Has_features<Domain>::value >()
+    (c3t3_,
+     *domain_,
+     criteria,
+     p_.protect_features);
+
+  // Build mesher and launch refinement process
+  mesher_ = new Mesher(c3t3_, *domain_, criteria);
+
+#ifdef CGAL_MESH_3_PROFILING
+  CGAL::Real_timer t;
+  t.start();
+#endif
+
+#if CGAL_MESH_3_MESHER_STATUS_ACTIVATED
+  mesher_->initialize();
+  while ( ! mesher_->is_algorithm_done() && continue_ )
+  {
+    mesher_->one_step();
+  }
+#else // not CGAL_MESH_3_MESHER_STATUS_ACTIVATED
+  mesher_->refine_mesh();
+#endif
+
+#ifdef CGAL_MESH_3_PROFILING
+  std::cerr << "Full refinement time (without fix_c3t3): " << t.time() << " seconds." << std::endl;
+#endif
+
+  // Ensure c3t3 is ok (usefull if process has been stop by the user)
+  mesher_->fix_c3t3();
+}
+
+
+template < typename D_ >
+void
+Mesh_function<D_>::
+stop()
+{
+  continue_ = false;
+}
+
+
+template < typename D_ >
+QStringList
+Mesh_function<D_>::
+parameters_log() const
+{
+  return p_.log();
+}
+
+
+template < typename D_ >
+QString
+Mesh_function<D_>::
+status(double time_period) const
+{
+  QString result;
+
+  CGAL_USE(time_period); // to avoid a warning when the macro
+                         // CGAL_MESH_3_MESHER_STATUS_ACTIVATED is not
+                         // defined
+#ifdef CGAL_MESH_3_MESHER_STATUS_ACTIVATED
+  // If mesher_ is not yet created, it means that either launch() has not
+  // been called or that initial points have not been founded
+  if ( NULL == mesher_ )
+  {
+    return QString("Initialization in progress...");
+  }
+  
+  // Get status and return a string corresponding to it
+  typename Mesher::Mesher_status s = mesher_->status();
+  
+  result = QString("Vertices: %1 \n"
+                           "Vertices inserted last %2s: %3 \n\n"
+                           "Bad facets: %4 \n"
+                           "Bad cells: %5")
+    .arg(s.vertices)
+    .arg(time_period)
+    .arg(s.vertices - last_report_.vertices)
+    .arg(s.facet_queue)
+    .arg(s.cells_queue);
+  
+  last_report_ = s;
+#endif
+  return result;
+}
+
+#endif // CGAL_DEMO_MESH_3_MESH_FUNCTION_H
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Meshing_thread.cpp b/3rdparty/CGAL/demo/Mesh_3/Meshing_thread.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Meshing_thread.cpp
rename to 3rdparty/CGAL/demo/Mesh_3/Meshing_thread.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Meshing_thread.h b/3rdparty/CGAL/demo/Mesh_3/Meshing_thread.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Meshing_thread.h
rename to 3rdparty/CGAL/demo/Mesh_3/Meshing_thread.h
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Optimizer_thread.cpp b/3rdparty/CGAL/demo/Mesh_3/Optimizer_thread.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Optimizer_thread.cpp
rename to 3rdparty/CGAL/demo/Mesh_3/Optimizer_thread.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Optimizer_thread.h b/3rdparty/CGAL/demo/Mesh_3/Optimizer_thread.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Optimizer_thread.h
rename to 3rdparty/CGAL/demo/Mesh_3/Optimizer_thread.h
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Polyhedron_type.h b/3rdparty/CGAL/demo/Mesh_3/Polyhedron_type.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Polyhedron_type.h
rename to 3rdparty/CGAL/demo/Mesh_3/Polyhedron_type.h
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Polyhedron_type_fwd.h b/3rdparty/CGAL/demo/Mesh_3/Polyhedron_type_fwd.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Polyhedron_type_fwd.h
rename to 3rdparty/CGAL/demo/Mesh_3/Polyhedron_type_fwd.h
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Scene_c3t3_item.cpp b/3rdparty/CGAL/demo/Mesh_3/Scene_c3t3_item.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Scene_c3t3_item.cpp
rename to 3rdparty/CGAL/demo/Mesh_3/Scene_c3t3_item.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Scene_c3t3_item.h b/3rdparty/CGAL/demo/Mesh_3/Scene_c3t3_item.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Scene_c3t3_item.h
rename to 3rdparty/CGAL/demo/Mesh_3/Scene_c3t3_item.h
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Scene_c3t3_item_config.h b/3rdparty/CGAL/demo/Mesh_3/Scene_c3t3_item_config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Scene_c3t3_item_config.h
rename to 3rdparty/CGAL/demo/Mesh_3/Scene_c3t3_item_config.h
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Scene_implicit_function_item.cpp b/3rdparty/CGAL/demo/Mesh_3/Scene_implicit_function_item.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Scene_implicit_function_item.cpp
rename to 3rdparty/CGAL/demo/Mesh_3/Scene_implicit_function_item.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Scene_implicit_function_item.h b/3rdparty/CGAL/demo/Mesh_3/Scene_implicit_function_item.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Scene_implicit_function_item.h
rename to 3rdparty/CGAL/demo/Mesh_3/Scene_implicit_function_item.h
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Scene_implicit_function_item_config.h b/3rdparty/CGAL/demo/Mesh_3/Scene_implicit_function_item_config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Scene_implicit_function_item_config.h
rename to 3rdparty/CGAL/demo/Mesh_3/Scene_implicit_function_item_config.h
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Scene_polygon_soup.cpp b/3rdparty/CGAL/demo/Mesh_3/Scene_polygon_soup.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Scene_polygon_soup.cpp
rename to 3rdparty/CGAL/demo/Mesh_3/Scene_polygon_soup.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Scene_polygon_soup.h b/3rdparty/CGAL/demo/Mesh_3/Scene_polygon_soup.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Scene_polygon_soup.h
rename to 3rdparty/CGAL/demo/Mesh_3/Scene_polygon_soup.h
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Scene_polygon_soup_config.h b/3rdparty/CGAL/demo/Mesh_3/Scene_polygon_soup_config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Scene_polygon_soup_config.h
rename to 3rdparty/CGAL/demo/Mesh_3/Scene_polygon_soup_config.h
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Scene_polyhedron_item.cpp b/3rdparty/CGAL/demo/Mesh_3/Scene_polyhedron_item.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Scene_polyhedron_item.cpp
rename to 3rdparty/CGAL/demo/Mesh_3/Scene_polyhedron_item.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Scene_polyhedron_item.h b/3rdparty/CGAL/demo/Mesh_3/Scene_polyhedron_item.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Scene_polyhedron_item.h
rename to 3rdparty/CGAL/demo/Mesh_3/Scene_polyhedron_item.h
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Scene_polyhedron_item_config.h b/3rdparty/CGAL/demo/Mesh_3/Scene_polyhedron_item_config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Scene_polyhedron_item_config.h
rename to 3rdparty/CGAL/demo/Mesh_3/Scene_polyhedron_item_config.h
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Scene_segmented_image_item.cpp b/3rdparty/CGAL/demo/Mesh_3/Scene_segmented_image_item.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Scene_segmented_image_item.cpp
rename to 3rdparty/CGAL/demo/Mesh_3/Scene_segmented_image_item.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Scene_segmented_image_item.h b/3rdparty/CGAL/demo/Mesh_3/Scene_segmented_image_item.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Scene_segmented_image_item.h
rename to 3rdparty/CGAL/demo/Mesh_3/Scene_segmented_image_item.h
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Scene_segmented_image_item_config.h b/3rdparty/CGAL/demo/Mesh_3/Scene_segmented_image_item_config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Scene_segmented_image_item_config.h
rename to 3rdparty/CGAL/demo/Mesh_3/Scene_segmented_image_item_config.h
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/StdAfx.cpp b/3rdparty/CGAL/demo/Mesh_3/StdAfx.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/StdAfx.cpp
rename to 3rdparty/CGAL/demo/Mesh_3/StdAfx.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/StdAfx.h b/3rdparty/CGAL/demo/Mesh_3/StdAfx.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/StdAfx.h
rename to 3rdparty/CGAL/demo/Mesh_3/StdAfx.h
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Volume_plane.h b/3rdparty/CGAL/demo/Mesh_3/Volume_plane.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Volume_plane.h
rename to 3rdparty/CGAL/demo/Mesh_3/Volume_plane.h
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Volume_plane_interface.h b/3rdparty/CGAL/demo/Mesh_3/Volume_plane_interface.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Volume_plane_interface.h
rename to 3rdparty/CGAL/demo/Mesh_3/Volume_plane_interface.h
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Volume_plane_intersection.cpp b/3rdparty/CGAL/demo/Mesh_3/Volume_plane_intersection.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Volume_plane_intersection.cpp
rename to 3rdparty/CGAL/demo/Mesh_3/Volume_plane_intersection.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Volume_plane_intersection.h b/3rdparty/CGAL/demo/Mesh_3/Volume_plane_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Volume_plane_intersection.h
rename to 3rdparty/CGAL/demo/Mesh_3/Volume_plane_intersection.h
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Volume_plane_thread.h b/3rdparty/CGAL/demo/Mesh_3/Volume_plane_thread.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Volume_plane_thread.h
rename to 3rdparty/CGAL/demo/Mesh_3/Volume_plane_thread.h
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/Volume_planes_plugin.cpp b/3rdparty/CGAL/demo/Mesh_3/Volume_planes_plugin.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/Volume_planes_plugin.cpp
rename to 3rdparty/CGAL/demo/Mesh_3/Volume_planes_plugin.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/concurrent_mesher_config.cfg b/3rdparty/CGAL/demo/Mesh_3/concurrent_mesher_config.cfg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/concurrent_mesher_config.cfg
rename to 3rdparty/CGAL/demo/Mesh_3/concurrent_mesher_config.cfg
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/config.h b/3rdparty/CGAL/demo/Mesh_3/config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/config.h
rename to 3rdparty/CGAL/demo/Mesh_3/config.h
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/implicit_functions/CMakeLists.txt b/3rdparty/CGAL/demo/Mesh_3/implicit_functions/CMakeLists.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/implicit_functions/CMakeLists.txt
rename to 3rdparty/CGAL/demo/Mesh_3/implicit_functions/CMakeLists.txt
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/implicit_functions/Implicit_function_interface.h b/3rdparty/CGAL/demo/Mesh_3/implicit_functions/Implicit_function_interface.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/implicit_functions/Implicit_function_interface.h
rename to 3rdparty/CGAL/demo/Mesh_3/implicit_functions/Implicit_function_interface.h
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/implicit_functions/Klein_implicit_function.cpp b/3rdparty/CGAL/demo/Mesh_3/implicit_functions/Klein_implicit_function.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/implicit_functions/Klein_implicit_function.cpp
rename to 3rdparty/CGAL/demo/Mesh_3/implicit_functions/Klein_implicit_function.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/implicit_functions/Sphere_implicit_function.cpp b/3rdparty/CGAL/demo/Mesh_3/implicit_functions/Sphere_implicit_function.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/implicit_functions/Sphere_implicit_function.cpp
rename to 3rdparty/CGAL/demo/Mesh_3/implicit_functions/Sphere_implicit_function.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/implicit_functions/Tanglecube_implicit_function.cpp b/3rdparty/CGAL/demo/Mesh_3/implicit_functions/Tanglecube_implicit_function.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/implicit_functions/Tanglecube_implicit_function.cpp
rename to 3rdparty/CGAL/demo/Mesh_3/implicit_functions/Tanglecube_implicit_function.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/include/CGAL_demo/Io_plugin_interface.h b/3rdparty/CGAL/demo/Mesh_3/include/CGAL_demo/Io_plugin_interface.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/include/CGAL_demo/Io_plugin_interface.h
rename to 3rdparty/CGAL/demo/Mesh_3/include/CGAL_demo/Io_plugin_interface.h
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/include/CGAL_demo/Messages_interface.h b/3rdparty/CGAL/demo/Mesh_3/include/CGAL_demo/Messages_interface.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/include/CGAL_demo/Messages_interface.h
rename to 3rdparty/CGAL/demo/Mesh_3/include/CGAL_demo/Messages_interface.h
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/include/CGAL_demo/Plugin_helper.h b/3rdparty/CGAL/demo/Mesh_3/include/CGAL_demo/Plugin_helper.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/include/CGAL_demo/Plugin_helper.h
rename to 3rdparty/CGAL/demo/Mesh_3/include/CGAL_demo/Plugin_helper.h
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/include/CGAL_demo/Plugin_interface.h b/3rdparty/CGAL/demo/Mesh_3/include/CGAL_demo/Plugin_interface.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/include/CGAL_demo/Plugin_interface.h
rename to 3rdparty/CGAL/demo/Mesh_3/include/CGAL_demo/Plugin_interface.h
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/include/CGAL_demo/Scene.h b/3rdparty/CGAL/demo/Mesh_3/include/CGAL_demo/Scene.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/include/CGAL_demo/Scene.h
rename to 3rdparty/CGAL/demo/Mesh_3/include/CGAL_demo/Scene.h
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/include/CGAL_demo/Scene_draw_interface.h b/3rdparty/CGAL/demo/Mesh_3/include/CGAL_demo/Scene_draw_interface.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/include/CGAL_demo/Scene_draw_interface.h
rename to 3rdparty/CGAL/demo/Mesh_3/include/CGAL_demo/Scene_draw_interface.h
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/include/CGAL_demo/Scene_interface.h b/3rdparty/CGAL/demo/Mesh_3/include/CGAL_demo/Scene_interface.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/include/CGAL_demo/Scene_interface.h
rename to 3rdparty/CGAL/demo/Mesh_3/include/CGAL_demo/Scene_interface.h
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/include/CGAL_demo/Scene_item.h b/3rdparty/CGAL/demo/Mesh_3/include/CGAL_demo/Scene_item.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/include/CGAL_demo/Scene_item.h
rename to 3rdparty/CGAL/demo/Mesh_3/include/CGAL_demo/Scene_item.h
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/include/CGAL_demo/Scene_item_config.h b/3rdparty/CGAL/demo/Mesh_3/include/CGAL_demo/Scene_item_config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/include/CGAL_demo/Scene_item_config.h
rename to 3rdparty/CGAL/demo/Mesh_3/include/CGAL_demo/Scene_item_config.h
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/include/CGAL_demo/Viewer.h b/3rdparty/CGAL/demo/Mesh_3/include/CGAL_demo/Viewer.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/include/CGAL_demo/Viewer.h
rename to 3rdparty/CGAL/demo/Mesh_3/include/CGAL_demo/Viewer.h
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/include/CGAL_demo/Viewer_config.h b/3rdparty/CGAL/demo/Mesh_3/include/CGAL_demo/Viewer_config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/include/CGAL_demo/Viewer_config.h
rename to 3rdparty/CGAL/demo/Mesh_3/include/CGAL_demo/Viewer_config.h
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/resources/about.html b/3rdparty/CGAL/demo/Mesh_3/resources/about.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/resources/about.html
rename to 3rdparty/CGAL/demo/Mesh_3/resources/about.html
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/resources/cgal_logo.xpm b/3rdparty/CGAL/demo/Mesh_3/resources/cgal_logo.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/resources/cgal_logo.xpm
rename to 3rdparty/CGAL/demo/Mesh_3/resources/cgal_logo.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/resources/check-off.png b/3rdparty/CGAL/demo/Mesh_3/resources/check-off.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/resources/check-off.png
rename to 3rdparty/CGAL/demo/Mesh_3/resources/check-off.png
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/resources/check-off.svg b/3rdparty/CGAL/demo/Mesh_3/resources/check-off.svg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/resources/check-off.svg
rename to 3rdparty/CGAL/demo/Mesh_3/resources/check-off.svg
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/resources/check-on.png b/3rdparty/CGAL/demo/Mesh_3/resources/check-on.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/resources/check-on.png
rename to 3rdparty/CGAL/demo/Mesh_3/resources/check-on.png
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/resources/check.svg b/3rdparty/CGAL/demo/Mesh_3/resources/check.svg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/resources/check.svg
rename to 3rdparty/CGAL/demo/Mesh_3/resources/check.svg
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/resources/editcopy.png b/3rdparty/CGAL/demo/Mesh_3/resources/editcopy.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/resources/editcopy.png
rename to 3rdparty/CGAL/demo/Mesh_3/resources/editcopy.png
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/resources/minus.png b/3rdparty/CGAL/demo/Mesh_3/resources/minus.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/resources/minus.png
rename to 3rdparty/CGAL/demo/Mesh_3/resources/minus.png
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/resources/plus.png b/3rdparty/CGAL/demo/Mesh_3/resources/plus.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/resources/plus.png
rename to 3rdparty/CGAL/demo/Mesh_3/resources/plus.png
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/src/CGAL_demo/Plugin_helper.cpp b/3rdparty/CGAL/demo/Mesh_3/src/CGAL_demo/Plugin_helper.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/src/CGAL_demo/Plugin_helper.cpp
rename to 3rdparty/CGAL/demo/Mesh_3/src/CGAL_demo/Plugin_helper.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/src/CGAL_demo/Scene.cpp b/3rdparty/CGAL/demo/Mesh_3/src/CGAL_demo/Scene.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/src/CGAL_demo/Scene.cpp
rename to 3rdparty/CGAL/demo/Mesh_3/src/CGAL_demo/Scene.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/src/CGAL_demo/Scene_item.cpp b/3rdparty/CGAL/demo/Mesh_3/src/CGAL_demo/Scene_item.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/src/CGAL_demo/Scene_item.cpp
rename to 3rdparty/CGAL/demo/Mesh_3/src/CGAL_demo/Scene_item.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/src/CGAL_demo/Viewer.cpp b/3rdparty/CGAL/demo/Mesh_3/src/CGAL_demo/Viewer.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/src/CGAL_demo/Viewer.cpp
rename to 3rdparty/CGAL/demo/Mesh_3/src/CGAL_demo/Viewer.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/ui_files/Function_dialog.ui b/3rdparty/CGAL/demo/Mesh_3/ui_files/Function_dialog.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/ui_files/Function_dialog.ui
rename to 3rdparty/CGAL/demo/Mesh_3/ui_files/Function_dialog.ui
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/ui_files/Image_res_dialog.ui b/3rdparty/CGAL/demo/Mesh_3/ui_files/Image_res_dialog.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/ui_files/Image_res_dialog.ui
rename to 3rdparty/CGAL/demo/Mesh_3/ui_files/Image_res_dialog.ui
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/ui_files/LocalOptim_dialog.ui b/3rdparty/CGAL/demo/Mesh_3/ui_files/LocalOptim_dialog.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/ui_files/LocalOptim_dialog.ui
rename to 3rdparty/CGAL/demo/Mesh_3/ui_files/LocalOptim_dialog.ui
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/ui_files/MainWindow.ui b/3rdparty/CGAL/demo/Mesh_3/ui_files/MainWindow.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/ui_files/MainWindow.ui
rename to 3rdparty/CGAL/demo/Mesh_3/ui_files/MainWindow.ui
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/ui_files/Meshing_dialog.ui b/3rdparty/CGAL/demo/Mesh_3/ui_files/Meshing_dialog.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/ui_files/Meshing_dialog.ui
rename to 3rdparty/CGAL/demo/Mesh_3/ui_files/Meshing_dialog.ui
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/ui_files/Rib_dialog.ui b/3rdparty/CGAL/demo/Mesh_3/ui_files/Rib_dialog.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/ui_files/Rib_dialog.ui
rename to 3rdparty/CGAL/demo/Mesh_3/ui_files/Rib_dialog.ui
diff --git a/3rdparty/CGAL-4.8/demo/Mesh_3/ui_files/Smoother_dialog.ui b/3rdparty/CGAL/demo/Mesh_3/ui_files/Smoother_dialog.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Mesh_3/ui_files/Smoother_dialog.ui
rename to 3rdparty/CGAL/demo/Mesh_3/ui_files/Smoother_dialog.ui
diff --git a/3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/CMakeLists.txt b/3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/CMakeLists.txt
new file mode 100644
index 0000000..1791094
--- /dev/null
+++ b/3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/CMakeLists.txt
@@ -0,0 +1,126 @@
+# This is the CMake script for compiling the Optimal_transportation_reconstruction_2 demo.
+
+project(Otr2_demo)
+
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+# Include this package's headers first
+include_directories( BEFORE ./ ./include ../../include )
+
+# Find CGAL and CGAL Qt5
+find_package(CGAL COMPONENTS Qt5)
+include( ${CGAL_USE_FILE} )
+
+# Find Qt5 itself
+find_package(Qt5 5.4 QUIET COMPONENTS OpenGL)
+if(Qt5_FOUND)
+  add_definitions(-DQT_NO_KEYWORDS)
+endif(Qt5_FOUND)
+
+# Find OpenGL
+find_package(OpenGL)
+
+# Find CImg
+find_path(CIMG_INCLUDE_DIR
+          NAMES CImg.h
+          HINTS ENV CIMG_INC_DIR
+          DOC "Path to the header of the CImg library")
+
+if (CIMG_INCLUDE_DIR)
+  add_definitions(-DCGAL_USE_CIMG)
+  include_directories(${CIMG_INCLUDE_DIR})
+  MESSAGE(STATUS "CImg library found, the demo can load point set from image files.")
+else()
+  MESSAGE(STATUS "CImg library was not found, the demo will not be able to load point set from image files. "
+                 "Try setting the environment variable CIMG_INC_DIR to point to the path of the directory containing CImg.h.")
+endif()
+
+if(CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND)
+
+  set(
+  SRCS 
+  glviewer.cpp 
+  Otr2_demo.cpp 
+  window.cpp 
+  render.cpp 
+  )
+
+  set( 
+  CGAL_Qt5_MOC_FILES 
+  moc_dialog_options.cxx 
+  moc_glviewer.cxx 
+  moc_window.cxx 
+  )
+
+  set(
+  UIS
+  pwsrec.ui 
+  options.ui
+  )
+  
+  qt5_wrap_ui( UI_FILES ${UIS} )
+
+  include(AddFileDependencies)
+
+  qt5_generate_moc( "window.h" "${CMAKE_CURRENT_BINARY_DIR}/moc_window.cxx" )
+  add_file_dependencies( moc_window.cxx "${CMAKE_CURRENT_SOURCE_DIR}/window.h" )
+
+  qt5_generate_moc( "glviewer.h" "${CMAKE_CURRENT_BINARY_DIR}/moc_glviewer.cxx" )
+  add_file_dependencies( moc_glviewer.cxx "${CMAKE_CURRENT_SOURCE_DIR}/glviewer.h" )
+
+  qt5_generate_moc( "dialog_options.h" "${CMAKE_CURRENT_BINARY_DIR}/moc_dialog_options.cxx" )
+  add_file_dependencies( moc_dialog_options.cxx "${CMAKE_CURRENT_SOURCE_DIR}/dialog_options.h" )
+
+  qt5_add_resources ( CGAL_Qt5_RESOURCE_FILES pwsrec.qrc )
+
+  add_executable  ( Otr2_demo ${SRCS} ${CGAL_Qt5_MOC_FILES} ${UI_FILES} ${CGAL_Qt5_RESOURCE_FILES})
+  
+  qt5_use_modules(Otr2_demo OpenGL)
+
+  # Link with Qt libraries
+  target_link_libraries( Otr2_demo ${QT_LIBRARIES} )
+
+  # Link with CGAL
+  target_link_libraries( Otr2_demo ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} )
+
+  # Link with OpenGL
+  target_link_libraries( Otr2_demo ${OPENGL_gl_LIBRARY} )
+  
+  # Link with pthread if necessary
+  if (CIMG_INCLUDE_DIR)
+    # Is pthread around? If yes, we need to link against it
+    set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
+    find_package (Threads)
+    if (CMAKE_USE_PTHREADS_INIT)
+      target_link_libraries( Otr2_demo ${CMAKE_THREAD_LIBS_INIT} )
+    endif()
+  endif()
+    
+  add_to_cached_list( CGAL_EXECUTABLE_TARGETS Otr2_demo )
+
+else (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND )
+
+  set(OTR2_MISSING_DEPS "")
+
+  if(NOT CGAL_FOUND)
+    set(OTR2_MISSING_DEPS "the CGAL library, ${OTR2_MISSING_DEPS}")
+  endif()
+
+  if(NOT CGAL_Qt5_FOUND)
+    set(OTR2_MISSING_DEPS "the CGAL Qt5 library, ${OTR2_MISSING_DEPS}")
+  endif()
+
+  if(NOT Qt5_FOUND)
+    set(OTR2_MISSING_DEPS "Qt5.4, ${OTR2_MISSING_DEPS}")
+  endif()
+
+  if(NOT OPENGL_FOUND)
+    set(OTR2_MISSING_DEPS "OpenGL, ${OTR2_MISSING_DEPS}")
+  endif()
+
+  message(STATUS "NOTICE: This demo requires ${OTR2_MISSING_DEPS}and will not be compiled.")
+
+endif (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND)
diff --git a/3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/Otr2_demo.cpp b/3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/Otr2_demo.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/Otr2_demo.cpp
rename to 3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/Otr2_demo.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/Otr2_kerneled.h b/3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/Otr2_kerneled.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/Otr2_kerneled.h
rename to 3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/Otr2_kerneled.h
diff --git a/3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/data/blob00.xy b/3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/data/blob00.xy
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/data/blob00.xy
rename to 3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/data/blob00.xy
diff --git a/3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/data/maple_leaf_embroidery.bmp b/3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/data/maple_leaf_embroidery.bmp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/data/maple_leaf_embroidery.bmp
rename to 3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/data/maple_leaf_embroidery.bmp
diff --git a/3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/data/round_rect00.xy b/3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/data/round_rect00.xy
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/data/round_rect00.xy
rename to 3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/data/round_rect00.xy
diff --git a/3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/data/skyline_noisy00.xy b/3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/data/skyline_noisy00.xy
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/data/skyline_noisy00.xy
rename to 3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/data/skyline_noisy00.xy
diff --git a/3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/data/stair-noise00.xy b/3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/data/stair-noise00.xy
similarity index 100%
copy from 3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/data/stair-noise00.xy
copy to 3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/data/stair-noise00.xy
diff --git a/3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/dialog_options.h b/3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/dialog_options.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/dialog_options.h
rename to 3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/dialog_options.h
diff --git a/3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/glviewer.cpp b/3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/glviewer.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/glviewer.cpp
rename to 3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/glviewer.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/glviewer.h b/3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/glviewer.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/glviewer.h
rename to 3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/glviewer.h
diff --git a/3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/icons/Voronoi_diagram_2.png b/3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/icons/Voronoi_diagram_2.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/icons/Voronoi_diagram_2.png
rename to 3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/icons/Voronoi_diagram_2.png
diff --git a/3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/icons/fileNew.png b/3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/icons/fileNew.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/icons/fileNew.png
rename to 3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/icons/fileNew.png
diff --git a/3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/icons/fileOpen.png b/3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/icons/fileOpen.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/icons/fileOpen.png
rename to 3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/icons/fileOpen.png
diff --git a/3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/icons/fileSave.png b/3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/icons/fileSave.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/icons/fileSave.png
rename to 3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/icons/fileSave.png
diff --git a/3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/icons/fit-page-32.png b/3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/icons/fit-page-32.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/icons/fit-page-32.png
rename to 3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/icons/fit-page-32.png
diff --git a/3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/icons/inputPoint.png b/3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/icons/inputPoint.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/icons/inputPoint.png
rename to 3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/icons/inputPoint.png
diff --git a/3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/icons/snapshot.png b/3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/icons/snapshot.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/icons/snapshot.png
rename to 3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/icons/snapshot.png
diff --git a/3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/icons/triangulation.png b/3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/icons/triangulation.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/icons/triangulation.png
rename to 3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/icons/triangulation.png
diff --git a/3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/icons/until.png b/3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/icons/until.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/icons/until.png
rename to 3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/icons/until.png
diff --git a/3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/icons/vertex.png b/3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/icons/vertex.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/icons/vertex.png
rename to 3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/icons/vertex.png
diff --git a/3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/options.ui b/3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/options.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/options.ui
rename to 3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/options.ui
diff --git a/3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/pwsrec.qrc b/3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/pwsrec.qrc
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/pwsrec.qrc
rename to 3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/pwsrec.qrc
diff --git a/3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/pwsrec.ui b/3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/pwsrec.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/pwsrec.ui
rename to 3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/pwsrec.ui
diff --git a/3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/random.h b/3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/random.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/random.h
rename to 3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/random.h
diff --git a/3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/render.cpp b/3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/render.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/render.cpp
rename to 3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/render.cpp
diff --git a/3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/scene.h b/3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/scene.h
new file mode 100644
index 0000000..dd826b0
--- /dev/null
+++ b/3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/scene.h
@@ -0,0 +1,917 @@
+#ifndef SCENE_H_
+#define SCENE_H_
+
+// STL
+#include <fstream>
+
+//Qt
+#include <QtOpenGL>
+#include <QWidget>
+
+// local
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+#include "Otr2_kerneled.h"
+#include <CGAL/Optimal_transportation_reconstruction_2.h>
+
+
+#ifdef CGAL_USE_CIMG
+#define cimg_display 0 // To avoid X11 or Windows-GDI dependency
+#include <CImg.h>
+#endif
+#include "random.h"
+#include <utility>      // std::pair
+#include <vector>
+#include <CGAL/property_map.h>
+#include <CGAL/value_type_traits.h>
+
+class Scene {
+
+public:
+  typedef std::pair<Point, FT> PointMassPair;
+
+  typedef std::vector<PointMassPair> PointMassList;
+  typedef PointMassList::const_iterator InputIterator;
+
+  typedef CGAL::value_type_traits<InputIterator>::type MassPoint;
+
+  typedef CGAL::First_of_pair_property_map<PointMassPair> Point_property_map;
+  typedef CGAL::Second_of_pair_property_map<PointMassPair> Mass_property_map;
+
+  typedef CGAL::Optimal_transportation_reconstruction_2<K, Point_property_map,
+    Mass_property_map> R_s_2;
+
+  typedef K::Segment_2 Segment;
+
+  typedef R_s_2::Vector Vector;
+
+  typedef R_s_2::Vertex Vertex;
+  typedef R_s_2::Vertex_handle Vertex_handle;
+  typedef R_s_2::Vertex_iterator Vertex_iterator;
+  typedef R_s_2::Vertex_circulator Vertex_circulator;
+  typedef R_s_2::Finite_vertices_iterator Finite_vertices_iterator;
+
+  typedef R_s_2::Edge Edge;
+  typedef R_s_2::Edge_circulator Edge_circulator;
+  typedef R_s_2::Finite_edges_iterator Finite_edges_iterator;
+
+  typedef R_s_2::Face_handle Face_handle;
+  typedef R_s_2::Face_circulator Face_circulator;
+  typedef R_s_2::Finite_faces_iterator Finite_faces_iterator;
+
+  typedef R_s_2::Vertex_handle_map Vertex_handle_map;
+  typedef R_s_2::Face_handle_map Face_handle_map;
+
+  typedef R_s_2::Vertex_handle_set Vertex_handle_set;
+  typedef R_s_2::Edge_set Edge_set;
+
+  typedef R_s_2::Edge_vector Edge_vector;
+
+  typedef R_s_2::Sample_ Sample_;
+  typedef R_s_2::Sample_vector Sample_vector;
+  typedef R_s_2::Sample_vector_const_iterator Sample_vector_const_iterator;
+
+  typedef R_s_2::PSample PSample;
+  typedef R_s_2::SQueue SQueue;
+
+  typedef R_s_2::Rec_edge_2 PEdge;
+
+
+private:
+  // data
+  std::vector<Sample_> m_samples;
+
+  Optimal_transportation_reconstruction_kerneled_2* m_pwsrec;
+  int m_ignore;
+  bool m_init_done;
+  double m_percentage;
+
+  // bbox
+  double m_bbox_x;
+  double m_bbox_y;
+  double m_bbox_size;
+
+public:
+  Scene() {
+    srand(0); // for sake of repeatability
+    m_ignore = 0;
+    m_init_done = false;
+    m_percentage = 1.;
+    m_bbox_x = 0.0;
+    m_bbox_y = 0.0;
+    m_bbox_size = 1.0;
+
+    m_pwsrec = new Optimal_transportation_reconstruction_kerneled_2();
+  }
+
+  ~Scene() {
+    delete m_pwsrec;
+  }
+
+  void clear() {
+    delete m_pwsrec;
+    m_pwsrec = new Optimal_transportation_reconstruction_kerneled_2();
+    m_samples.clear();
+  }
+
+
+
+  void subdivide() {
+    if (m_samples.size() < 3)
+      return;
+
+    std::vector<Sample_> new_samples;
+    std::vector<Sample_>::const_iterator it = m_samples.begin();
+    std::vector<Sample_>::const_iterator last = it++;
+    while (it != m_samples.end()) {
+      Point p = CGAL::midpoint(last->point(), it->point());
+      FT m = 0.5 * (last->mass() + it->mass());
+      new_samples.push_back(Sample_(p, m));
+      last = it++;
+    }
+    it = m_samples.begin();
+    Point p = CGAL::midpoint(last->point(), it->point());
+    FT m = 0.5 * (last->mass() + it->mass());
+    new_samples.push_back(Sample_(p, m));
+
+    std::vector<Sample_> final_samples;
+    std::vector<Sample_>::const_iterator it2 = new_samples.begin();
+    while (it != m_samples.end() && it2 != new_samples.end()) {
+      final_samples.push_back(*it);
+      final_samples.push_back(*it2);
+      it++;
+      it2++;
+    }
+
+    m_samples = final_samples;
+  }
+
+  // SAMPLE //
+
+  void add_sample(const Point& point, const FT mass = 1.0) {
+    m_samples.push_back(Sample_(point, mass));
+    m_init_done = false;
+  }
+
+  void add_outliers(const unsigned int nb) {
+    std::cerr << "adding " << nb << " outliers...";
+    for (unsigned int i = 0; i < nb; i++) {
+      Point outlier = CGAL::ORIGIN + random_vec<Vector>(1.3);
+      m_samples.push_back(outlier);
+    }
+    m_init_done = false;
+    std::cerr << "done" << std::endl;
+  }
+
+  void noise(const FT scale) {
+    std::cerr << "noising by " << scale << "...";
+    std::vector<Sample_>::iterator it;
+    for (it = m_samples.begin(); it != m_samples.end(); it++) {
+      Sample_& sample = *it;
+      Point& point = sample.point();
+      point = point + random_vec<Vector>(scale);
+    }
+    std::cerr << "done" << std::endl;
+  }
+
+  void normalize_points() {
+    noise(1e-5);
+    compute_bbox(m_bbox_x, m_bbox_y, m_bbox_size);
+    if (m_bbox_size == 0.0)
+      return;
+
+    Point center(m_bbox_x, m_bbox_y);
+    std::vector<Sample_>::iterator it;
+    for (it = m_samples.begin(); it != m_samples.end(); ++it) {
+      Sample_& sample = *it;
+      Vector vec = (sample.point() - center) / m_bbox_size;
+      sample.point() = CGAL::ORIGIN + vec;
+    }
+    m_bbox_x = m_bbox_y = 0.0;
+    m_bbox_size = 1.0;
+  }
+
+  void compute_bbox(double &x, double &y, double &scale) {
+    if (m_samples.empty()) {
+      x = y = 0.0;
+      scale = 1.0;
+      return;
+    }
+
+    FT x_min, x_max, y_min, y_max;
+    std::vector<Sample_>::const_iterator it = m_samples.begin();
+    Point p = it->point();
+    x_min = x_max = p.x();
+    y_min = y_max = p.y();
+    ++it;
+    for (; it != m_samples.end(); ++it) {
+      p = it->point();
+      x_min = (std::min)(x_min, p.x());
+      x_max = (std::max)(x_max, p.x());
+      y_min = (std::min)(y_min, p.y());
+      y_max = (std::max)(y_max, p.y());
+    }
+
+    x = 0.5 * (x_min + x_max);
+    y = 0.5 * (y_min + y_max);
+    scale = (std::max)(x_max - x_min, y_max - y_min);
+    if (scale == 0.0)
+      scale = 1.0;
+  }
+
+  // IO SAMPLES //
+
+  void load(const QString& filename, QWidget* qw) {
+
+    if (filename.contains(".xy", Qt::CaseInsensitive)) {
+      load_xy_file(filename);
+      normalize_points();
+      return;
+    }
+
+#ifdef CGAL_USE_CIMG
+    if (filename.contains(".bmp", Qt::CaseInsensitive)) {
+      bool use_gradient = false;
+
+      QMessageBox::StandardButton reply;
+      reply = QMessageBox::question(qw, QString("Open BMP"), "Use gradient?",
+        QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
+      if (reply == QMessageBox::Yes)
+        use_gradient = true;
+      else if (reply == QMessageBox::No)
+        use_gradient = false;
+      else
+        return;
+
+      if (use_gradient)
+        load_gradient(filename);
+      else
+        load_image(filename);
+      normalize_points();
+      return;
+    }
+
+    std::cerr << "Invalid file (try .xy, .bmp)" << std::endl;
+#else
+    CGAL_USE(qw);
+    std::cerr << "Invalid file (try .xy)" << std::endl;
+#endif
+
+
+  }
+
+  void load_xy_file(const QString& fileName) {
+
+    std::cout << "filename: " << fileName.toUtf8().constData() << std::endl;
+    std::ifstream ifs(qPrintable(fileName));
+    std::cerr << "reading xy...";
+    Point point;
+    unsigned int nb = 0;
+    while (ifs >> point) {
+      add_sample(point, 1.0);
+      nb++;
+    }
+    std::cerr << "done (" << nb << " points)" << std::endl;
+    ifs.close();
+  }
+
+
+#ifdef CGAL_USE_CIMG
+  void load_image(const QString& fileName) {
+    std::cerr << "reading image...";
+    cimg_library::CImg<float> image(qPrintable(fileName));
+    std::cerr << "done" << std::endl;
+
+    std::cerr << "computing grayscale...";
+    cimg_library::CImg<float> grayscale =
+      image.RGBtoHSV().get_channel(2).normalize(0.0f, 1.0f);
+    std::cerr << "done" << std::endl;
+
+    // turn pixels into weighted samples
+    std::cerr << "adding samples...";
+    for (int i = 0; i < grayscale.width(); i++) {
+      for (int j = 0; j < grayscale.height(); j++) {
+        float mass = 1.0f - grayscale.atXY(i, j);
+        double x = double(i) / grayscale.width();
+        double y = 1.0 - double(j) / grayscale.height();
+        if (mass > 0.f)
+          add_sample(Point(x, y), mass);
+      }
+    }
+    std::cerr << "done (" << m_samples.size() << ")" << std::endl;
+  }
+
+  void load_gradient(const QString& fileName) {
+    std::cerr << "reading image...";
+    cimg_library::CImg<float> image(qPrintable(fileName));
+    std::cerr << "done" << std::endl;
+
+    std::cerr << "computing gradient...";
+    cimg_library::CImgList<float> grad = image.get_gradient();
+    cimg_library::CImg<float> normgrad = sqrt(
+      grad[0].pow(2) + grad[1].pow(2)).normalize(0.0f, 1.0f);
+    std::cerr << "done" << std::endl;
+
+    // turn pixels into weighted samples
+    std::cerr << "adding samples...";
+    for (int i = 0; i < normgrad.width(); i++) {
+      for (int j = 0; j < normgrad.height(); j++) {
+        float mass = normgrad.atXY(i, j);
+        double x = double(i) / normgrad.width();
+        double y = 1.0 - double(j) / normgrad.height();
+        add_sample(Point(x, y), mass);
+      }
+    }
+    std::cerr << "done (" << m_samples.size() << ")" << std::endl;
+  }
+#endif
+
+  void print_vertex(Vertex vertex) {
+    std::cout << "vertex " << vertex << std::endl;
+  }
+
+
+  void print_edge(PEdge edge) {
+    int i = ((edge).edge()).second;
+    Point a = ((edge).edge()).first->vertex((i + 1) % 3)->point();
+    Point b = ((edge).edge()).first->vertex((i + 2) % 3)->point();
+    std::cout << "( " << (edge).priority() << ") ( " << a
+      << " , " << b << " )" << std::endl;
+  }
+
+
+  void debug_print()
+  {
+    std::vector<Point> isolated_points;
+    std::vector<Segment> edges;
+
+    m_pwsrec->list_output(std::back_inserter(isolated_points), std::back_inserter(edges));
+
+    int vertex_count = 0;
+    for (std::vector<Point>::iterator it = isolated_points.begin();
+      it != isolated_points.end(); it++) {
+      vertex_count++;
+      std::cout << *it << std::endl;
+    }
+    CGAL_assertion(vertex_count == 18);
+
+    int edge_count = 0;
+    for (std::vector<Segment>::iterator it = edges.begin();
+      it != edges.end(); it++) {
+      std::cout << *it << std::endl;
+      edge_count++;
+    }
+  }
+
+  void save(const QString& filename)
+  {
+    Sample_vector samples;
+    for (std::vector<Sample_>::iterator it = m_samples.begin();
+      it != m_samples.end(); ++it) {
+      Sample_& s = *it;
+      samples.push_back(&s);
+    }
+
+    if (filename.contains(".xy", Qt::CaseInsensitive)) {
+      save_xy(filename, samples);
+      return;
+    }
+
+    std::cerr << "Error: not an XY file." << std::endl;
+  }
+
+
+
+  void save_xy(const QString& filename, const Sample_vector& samples) {
+    std::ofstream ofs(qPrintable(filename));
+    for (Sample_vector_const_iterator it = samples.begin();
+      it != samples.end(); ++it) {
+      Sample_* sample = *it;
+      ofs << sample->point() << std::endl;
+    }
+    ofs.close();
+  }
+
+
+  // RECONSTRUCTION //
+
+  void set_options(const int verbose, const int mchoice,
+    const bool use_flip, const unsigned int relocation,
+    const double ghost, const double percentage) {
+
+    m_pwsrec->set_verbose(verbose);
+    m_pwsrec->set_random_sample_size(mchoice);
+    m_pwsrec->set_use_flip(use_flip);
+    m_pwsrec->set_relocation(relocation);
+    m_pwsrec->set_relevance(ghost);
+    m_percentage = percentage;
+  }
+
+  bool init_reconstruction(const double percentage) {
+    std::cout << " init_reconstruction with " << (unsigned int)(100.*percentage) << "% of points" << std::endl;
+
+    if (m_samples.empty()) {
+      std::cerr << "initialization failed (empty point set)" << std::endl;
+      return false;
+    }
+
+    Sample_vector vertices, samples;
+    select_samples(percentage, vertices, samples);
+
+    PointMassList vertices_mass_list;
+    Sample_vector_const_iterator it;
+    for (it = vertices.begin(); it != vertices.end(); it++) {
+      vertices_mass_list.push_back(
+        std::make_pair((*it)->point(), (*it)->mass()));
+    }
+    PointMassList samples_mass_list;
+    for (it = samples.begin(); it != samples.end(); it++) {
+      samples_mass_list.push_back(
+        std::make_pair((*it)->point(), (*it)->mass()));
+    }
+
+    Point_property_map point_pmap;
+    Mass_property_map mass_pmap;
+    MassPoint mp;
+
+    m_pwsrec->initialize_with_custom_vertices
+      (samples_mass_list.begin(), samples_mass_list.end(),
+       vertices_mass_list.begin(), vertices_mass_list.end(),
+       point_pmap, mass_pmap);
+
+    m_init_done = true;
+
+    return true;
+  }
+
+  void decimate(const double percentage) {
+    std::cout << "decimating from " << m_samples.size() << " to...";
+    std::vector<Sample_> selected;
+
+    std::vector<Sample_>::iterator it;
+    for (it = m_samples.begin(); it != m_samples.end(); it++) {
+      const double rd = random_double(0.0, 1.0);
+      if (rd >= percentage)
+        selected.push_back(*it);
+    }
+
+    m_samples.clear();
+    std::copy(selected.begin(), selected.end(),
+      std::back_inserter(m_samples));
+    std::cout << m_samples.size() << std::endl;
+  }
+
+
+  void select_samples(const double percentage, Sample_vector& vertices,
+    Sample_vector& samples) {
+    std::vector<Sample_>::iterator it;
+    for (it = m_samples.begin(); it != m_samples.end(); ++it) {
+      Sample_& s = *it;
+
+      samples.push_back(&s);
+      FT rv = random_double(0.0, 1.0);
+      if (rv <= percentage)
+        vertices.push_back(&s);
+    }
+  }
+
+  void reconstruct_until(const unsigned int nv) {
+    std::cout << "reconstruct_until" << std::endl;
+    if (!m_init_done)
+      init_reconstruction(m_percentage);
+    m_pwsrec->run_until(nv);
+  }
+
+  void reconstruct(const unsigned int steps) {
+    std::cout << "reconstruct" << std::endl;
+    if (!m_init_done)
+      init_reconstruction(m_percentage);
+    m_pwsrec->run(steps);
+  }
+
+  void relocate_all_points() {
+    std::cout << "relocate_all_points" << std::endl;
+    m_pwsrec->relocate_all_points();
+  }
+
+  void output_console()
+  {
+    std::cout << std::endl;
+    std::cout << "OFF OUTPUT" << std::endl;
+    std::vector<Point> points;
+    std::vector<std::size_t> isolated_vertices;
+    std::vector<std::pair<std::size_t, std::size_t> > edges;
+
+    m_pwsrec->indexed_output(
+      std::back_inserter(points),
+      std::back_inserter(isolated_vertices),
+      std::back_inserter(edges));
+
+    std::cout << "OFF " << points.size() << " 0 " << edges.size() << std::endl;
+
+    // points
+    std::vector<Point>::iterator pit;
+    for (pit = points.begin(); pit != points.end(); pit++)
+      std::cout << *pit << std::endl;
+
+    // isolated vertices
+    std::vector<std::size_t>::iterator vit;
+    for (vit = isolated_vertices.begin(); vit != isolated_vertices.end(); vit++)
+      std::cout << "1 " << *vit << std::endl;
+
+    // edges
+    std::vector<std::pair<std::size_t, std::size_t> >::iterator eit;
+    for (eit = edges.begin(); eit != edges.end(); eit++)
+      std::cout << "2 " << eit->first << " " << eit->second << std::endl;
+  }
+
+  // RENDER //
+
+  void render(const bool view_points, const bool view_vertices,
+    const bool view_edges, const bool view_ghost_edges,
+    const bool view_edge_cost, const bool view_edge_priority,
+    const bool view_bins, const bool view_foot_points,
+    const bool view_relocation, const bool view_edge_relevance,
+    const float point_size, const float vertex_size,
+    const float line_thickness)
+  {
+    if (m_pwsrec == NULL) {
+      return;
+    }
+
+    if (view_edges)
+      m_pwsrec->draw_edges(0.5f * line_thickness, 0.9f, 0.9f, 0.9f);
+
+    if (view_edge_cost)
+      m_pwsrec->draw_costs(line_thickness, view_ghost_edges);
+
+    if (view_edge_priority)
+      m_pwsrec->draw_pedges(line_thickness);
+
+    if (view_edge_relevance)
+      m_pwsrec->draw_relevance(line_thickness, m_ignore);
+
+    if (view_relocation)
+      m_pwsrec->draw_relocation();
+
+    if (view_vertices)
+      m_pwsrec->draw_vertices(vertex_size, 0.0f, 0.0f, 0.5f);
+
+    if (view_bins)
+      m_pwsrec->draw_bins(0.5f * line_thickness);
+
+    if (view_foot_points)
+      m_pwsrec->draw_footpoints(line_thickness, 0.2f, 0.8f, 0.2f);
+
+    if (view_points)
+      draw_samples(point_size);
+  }
+
+  void draw_samples(const float point_size) {
+
+    ::glPointSize(point_size);
+    ::glBegin(GL_POINTS);
+
+    std::vector<Sample_>::const_iterator it;
+    for (it = m_samples.begin(); it != m_samples.end(); it++) {
+      double mass = it->mass();
+
+      float value = mass;
+      float grey = 0.9 * (1.0f - value);
+      ::glColor3f(grey, grey, grey);
+      const Point& p = it->point();
+      ::glVertex2d(p.x(), p.y());
+    }
+    ::glEnd();
+  }
+
+
+  // PREDEFINED EXAMPLES //
+
+  void make_line(const unsigned int nb, const Point& start,
+    const Point& end) {
+    Point curr = start;
+    Vector incr = (end - start) / nb;
+    for (unsigned int i = 0; i < nb; i++) {
+      add_sample(curr);
+      curr = curr + incr;
+    }
+  }
+
+  void make_circle_arc(const unsigned int nb, const Point& c,
+    const double radius, const double min_angle = 0.0,
+    const double max_angle = 360.0) {
+    const double range = max_angle - min_angle;
+    const double incr = range / double(nb);
+    for (double angle = min_angle; angle < max_angle; angle += incr) {
+      double angle_rad = (angle / 360.0) * 6.2831853;
+      double x = c.x() + radius * cos(angle_rad);
+      double y = c.y() + radius * sin(angle_rad);
+      Point point(x, y);
+      add_sample(point);
+    }
+  }
+
+  void append_widely_variable_sampling(const float d1, const float d2) {
+    double angle;
+    double incr = d1;
+    Point c = Point(0.5, 0.5);
+    const double radius = 0.5;
+    // 0-90 deg -> d1
+    for (angle = 0.0; angle < 90.0; angle += incr) {
+      double angle_rad = (angle / 360.0) * 6.2831853;
+      double x = c.x() + radius * cos(angle_rad);
+      double y = c.y() + radius * sin(angle_rad);
+      Point point(x, y);
+      add_sample(point);
+    }
+    // 90-180 deg -> d1 -> d2
+    for (angle = 90.0; angle < 180.0; angle += incr) {
+      double angle_rad = (angle / 360.0) * 6.2831853;
+      double x = c.x() + radius * cos(angle_rad);
+      double y = c.y() + radius * sin(angle_rad);
+      Point point(x, y);
+      add_sample(point);
+      incr = d1 + (d2 - d1) / 90.0 * (angle - 90);
+    }
+    // 180-270 deg -> d2
+    incr = d2;
+    for (angle = 180.0; angle < 270.0; angle += incr) {
+      double angle_rad = (angle / 360.0) * 6.2831853;
+      double x = c.x() + radius * cos(angle_rad);
+      double y = c.y() + radius * sin(angle_rad);
+      Point point(x, y);
+      add_sample(point);
+    }
+    // 270-360 deg -> d2 -> d1
+    incr = d2;
+    for (angle = 270.0; angle < 360.0; angle += incr) {
+      double angle_rad = (angle / 360.0) * 6.2831853;
+      double x = c.x() + radius * cos(angle_rad);
+      double y = c.y() + radius * sin(angle_rad);
+      Point point(x, y);
+      add_sample(point);
+      incr = d2 + (d1 - d2) / 90.0 * (angle - 270.0);
+    }
+  }
+
+  void append_predefined_line(const int density) {
+    std::cerr << "append line...";
+    Point start(0.0, 0.5);
+    Point end(1.0, 0.5);
+    make_line(density, start, end);
+    std::cerr << "done" << std::endl;
+  }
+
+  void append_predefined_parallel_lines(const int nb_lines, const float space,
+    const int density) {
+    std::cerr << "append parallel lines...";
+    FT x[4];
+    x[0] = 0.0;
+    x[1] = 0.75;
+    x[2] = 1.0;
+    x[3] = 1.75;
+    FT y = 0.0;
+    for (int i = 0; i < nb_lines; ++i) {
+      int j = i % 2;
+      Point start(x[j], y);
+      Point end(x[j + 2], y);
+      make_line(density, start, end);
+      y += space;
+    }
+    std::cerr << "done" << std::endl;
+  }
+
+  void append_predefined_circle(const int density, const float x,
+    const float y, const float radius) {
+    std::cerr << "append circle...";
+    Point center(x, y);
+    make_circle_arc(density, center, radius);
+    std::cerr << "done" << std::endl;
+  }
+
+  void append_predefined_spiral(const int nb_loops, const int density) {
+    std::cerr << "append spiral...";
+    Point center(0.5, 0.5);
+    const FT max_radius = 0.5;
+    const FT spacing = 10. / density; // target spacing
+    double radius = max_radius;
+    const double max_angle = nb_loops * 360.0;
+    for (double angle = max_angle; angle > 0.0; /**/) {
+      double angle_rad = (angle / 360.0) * 6.2831853;
+      double x = center.x() + radius * cos(angle_rad);
+      double y = center.y() + radius * sin(angle_rad);
+      Point point(x, y);
+      add_sample(point);
+
+      const double angle_incr = atan(spacing / radius);
+      angle -= angle_incr;
+      radius = max_radius * angle / max_angle;
+    }
+    std::cerr << "done" << std::endl;
+  }
+
+  void append_predefined_half_circle(const int density) {
+    std::cerr << "append half circle...";
+    Point center(0.5, 0.5);
+    make_circle_arc(density, center, 0.5, 0.0, 180.0);
+    std::cerr << "done" << std::endl;
+  }
+
+  void append_predefined_box(const int density, const float x, const float y,
+    const float size_x, const float size_y) {
+    std::cerr << "append box...";
+    Point a(x - size_x / 2, y - size_y / 2);
+    Point b(x + size_x / 2, y - size_y / 2);
+    Point c(x + size_x / 2, y + size_y / 2);
+    Point d(x - size_x / 2, y + size_y / 2);
+    make_line(density, a, b);
+    make_line(density, b, c);
+    make_line(density, c, d);
+    make_line(density, d, a);
+    std::cerr << "done" << std::endl;
+  }
+
+  void append_predefined_box_with_boundaries(const int density) {
+    std::cerr << "append box with boundaries...";
+
+    Point a(0.1, 0.1);
+    Point b(0.4, 0.1);
+    Point c(0.6, 0.1);
+    Point d(0.9, 0.1);
+    Point e(0.9, 0.4);
+    Point f(0.9, 0.6);
+    Point g(0.9, 0.9);
+    Point h(0.6, 0.9);
+    Point i(0.4, 0.9);
+    Point j(0.1, 0.9);
+    Point k(0.1, 0.6);
+    Point l(0.1, 0.4);
+
+    make_line(density, a, b);
+    make_line(density, c, d);
+    make_line(density, d, e);
+    make_line(density, f, g);
+    make_line(density, g, h);
+    make_line(density, i, j);
+    make_line(density, j, k);
+    make_line(density, l, a);
+
+    std::cerr << "done" << std::endl;
+  }
+
+  void append_predefined_box_with_missing_corners(const int density) {
+    std::cerr << "append box with missing corners...";
+    Point a(0.12, 0.1);
+    Point b(0.88, 0.1);
+    Point c(0.9, 0.12);
+    Point d(0.9, 0.88);
+    Point e(0.88, 0.9);
+    Point f(0.12, 0.9);
+    Point g(0.1, 0.88);
+    Point h(0.1, 0.12);
+    make_line(density, a, b);
+    make_line(density, c, d);
+    make_line(density, e, f);
+    make_line(density, g, h);
+    std::cerr << "done" << std::endl;
+  }
+
+  void append_predefined_boxes(const int density) {
+    std::cerr << "append two boxes...";
+    Point a(0.0, 0.0);
+    Point b(0.2, 0.0);
+    Point c(0.2, 1.0);
+    Point d(0.0, 1.0);
+    make_line(2 * density, a, b);
+    make_line(10 * density, b, c);
+    make_line(2 * density, c, d);
+    make_line(10 * density, d, a);
+
+    Point e(0.3, 0.0);
+    Point f(0.4, 0.0);
+    Point g(0.4, 0.3);
+    Point h(0.3, 0.3);
+    make_line(1 * density, e, f);
+    make_line(3 * density, f, g);
+    make_line(1 * density, g, h);
+    make_line(3 * density, h, e);
+    std::cerr << "done" << std::endl;
+  }
+
+  void append_predefined_stair(const int density) {
+    std::cerr << "append stair...";
+    Point a(0.0, 0.0);
+    Point b(0.1, 0.0);
+    Point c(0.1, 0.1);
+    Point d(0.2, 0.1);
+    Point e(0.2, 0.2);
+    Point f(0.3, 0.2);
+    Point g(0.3, 0.3);
+    Point h(0.4, 0.3);
+    Point i(0.4, 0.4);
+
+    make_line(density, a, b);
+    make_line(density, b, c);
+    make_line(density, c, d);
+    make_line(density, d, e);
+    make_line(density, e, f);
+    make_line(density, f, g);
+    make_line(density, g, h);
+    make_line(density, h, i);
+    std::cerr << "done" << std::endl;
+  }
+
+  void append_predefined_skyline(const int density) {
+    std::cerr << "append skyline...";
+    Point a(0.0, 0.0);
+    Point b(0.1, 0.0);
+    Point c(0.1, 0.5);
+    Point d(0.3, 0.5);
+    Point e(0.3, 0.2);
+    Point f(0.4, 0.2);
+    Point g(0.4, 0.4);
+    Point h(0.6, 0.4);
+    Point i(0.6, -0.1);
+    Point j(0.7, -0.1);
+    Point k(0.7, 0.2);
+    Point l(0.8, 0.2);
+    Point m(0.8, 0.7);
+    Point n(0.9, 0.7);
+    Point o(0.9, 0.5);
+    Point p(1.0, 0.5);
+    Point q(1.0, 0.1);
+    Point r(1.1, 0.1);
+    Point s(1.1, -0.1);
+    Point t(1.2, -0.1);
+
+    make_line(1 * density, a, b);
+    make_line(5 * density, b, c);
+    make_line(2 * density, c, d);
+    make_line(3 * density, d, e);
+    make_line(1 * density, e, f);
+    make_line(2 * density, f, g);
+    make_line(2 * density, g, h);
+    make_line(5 * density, h, i);
+    make_line(1 * density, i, j);
+    make_line(3 * density, j, k);
+    make_line(1 * density, k, l);
+    make_line(5 * density, l, m);
+    make_line(1 * density, m, n);
+    make_line(2 * density, n, o);
+    make_line(1 * density, o, p);
+    make_line(4 * density, p, q);
+    make_line(1 * density, q, r);
+    make_line(2 * density, r, s);
+    make_line(1 * density, s, t);
+    std::cerr << "done" << std::endl;
+  }
+
+  void append_star(const int nb_branches, const int density) {
+    std::cerr << "append star...";
+    const double deg_in_rad = 3.1415926535897932384626 / 180.0;
+    const double incr = 180.0 / nb_branches;
+    double angle = 0.0;
+    const Point center(0.5, 0.5);
+    for (int i = 0; i < nb_branches; i++) {
+      const double angle_rad = angle * deg_in_rad;
+      Vector v(sin(angle_rad), cos(angle_rad));
+      Point a = center + v;
+      Point b = center - v;
+      make_line(density, a, b);
+      angle += incr;
+    }
+    std::cerr << "done" << std::endl;
+  }
+
+  void append_predefined_increasingly_sharp_angles(const int density,
+    const double min_angle) {
+    const double deg_in_rad = 3.1415926535897932384626 / 180.0;
+    double prev_angle = 0.0;
+    double curr_angle = min_angle;
+    double incr = min_angle;
+    const double r1 = 0.5;
+    const Point center(0.5, 0.5);
+    while (curr_angle < 360.0) {
+      Vector va(r1 * cos(prev_angle * deg_in_rad),
+        r1 * sin(prev_angle * deg_in_rad));
+      Vector vb(r1 * cos(curr_angle * deg_in_rad),
+        r1 * sin(curr_angle * deg_in_rad));
+      const double average_angle = 0.5 * (prev_angle + curr_angle);
+      Vector vc(r1 * cos(average_angle * deg_in_rad),
+        r1 * sin(average_angle * deg_in_rad));
+      Point a = center + va;
+      Point b = center + vb;
+      Point c = center + 2 * vc;
+
+      make_line(density, a, c);
+      make_line(density, b, c);
+
+      prev_angle = curr_angle;
+      curr_angle += incr;
+      incr += 2.0;
+    }
+    noise(1e-5);
+  }
+};
+
+#endif // SCENE_H_
diff --git a/3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/window.cpp b/3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/window.cpp
new file mode 100644
index 0000000..31dbfff
--- /dev/null
+++ b/3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/window.cpp
@@ -0,0 +1,642 @@
+// STL
+#include <fstream>
+
+// Qt
+#include <QtGui>
+#include <QDialog>
+#include <QActionGroup>
+#include <QFileDialog>
+#include <QInputDialog>
+#include <QClipboard>
+
+// local
+#include "window.h"
+#include "ui_options.h"
+#include "dialog_options.h"
+
+MainWindow::MainWindow() : 
+QMainWindow(), Ui_MainWindow(), 
+maxNumRecentFiles(15), recentFileActs(15)
+{
+  setupUi(this);
+
+  // init scene
+  m_scene = new Scene;
+  viewer->set_scene(m_scene);
+
+  // options
+  m_verbose = 0;
+  m_mchoice = 0;
+  m_relevance = 1.0;
+  m_use_flip = true;
+  m_percent  = 100.0;
+  m_relocation = 2;
+
+  // accepts drop events
+  setAcceptDrops(true);
+
+  // Handling actions
+  addRecentFiles(menuFile, actionQuit);
+  connect(actionQuit, SIGNAL(triggered()), this, SLOT(close()));
+  connect(this, SIGNAL(openRecentFile(QString)), this, SLOT(open(QString)));
+  Q_EMIT update();
+  viewer->update();
+}
+
+MainWindow::~MainWindow()
+{
+  delete m_scene;
+}
+
+void MainWindow::addToRecentFiles(QString fileName)
+{
+  QSettings settings;
+  QStringList files = settings.value("recentFileList").toStringList();
+  files.removeAll(fileName);
+  files.prepend(fileName);
+  while (files.size() > (int)maxNumRecentFiles)
+    files.removeLast();
+  settings.setValue("recentFileList", files);
+  updateRecentFileActions();
+}
+
+void MainWindow::dropEvent(QDropEvent *event)
+{
+  Q_FOREACH(QUrl url, event->mimeData()->urls())
+  {
+    QString filename = url.toLocalFile();
+    if (!filename.isEmpty())
+    {
+      QTextStream(stderr) << QString("dropEvent(\"%1\")\n").arg(filename);
+      open(filename);
+    }
+  }
+  event->acceptProposedAction();
+}
+
+void MainWindow::closeEvent(QCloseEvent *event)
+{
+  event->accept();
+}
+
+void MainWindow::dragEnterEvent(QDragEnterEvent *event)
+{
+  if (event->mimeData()->hasFormat("text/uri-list"))
+    event->acceptProposedAction();
+}
+
+void MainWindow::openRecentFile_aux()
+{
+  QAction* action = qobject_cast<QAction*>(sender());
+  if (action)
+    Q_EMIT openRecentFile(action->data().toString());
+}
+
+void MainWindow::updateRecentFileActions()
+{
+  QSettings settings;
+  QStringList files = settings.value("recentFileList").toStringList();
+
+  int numRecentFiles = qMin(files.size(), (int)maxNumberOfRecentFiles());
+  for (int i = 0; i < numRecentFiles; ++i) {
+    QString strippedName = QFileInfo(files[i]).fileName();
+    QString text = tr("&%1 %2").arg(i).arg(strippedName);
+    recentFileActs[i]->setText(text);
+    recentFileActs[i]->setData(files[i]);
+    recentFileActs[i]->setVisible(true);
+  }
+  for (unsigned int j = numRecentFiles; j < maxNumberOfRecentFiles(); ++j)
+    recentFileActs[j]->setVisible(false);
+
+  recentFilesSeparator->setVisible(numRecentFiles > 0);
+}
+
+void MainWindow::addRecentFiles(QMenu* menu, QAction* insertBeforeAction)
+{
+  if (insertBeforeAction)
+    recentFilesSeparator = menu->insertSeparator(insertBeforeAction);
+  else
+    recentFilesSeparator = menu->addSeparator();
+  recentFilesSeparator->setVisible(false);
+
+  for (unsigned int i = 0; i < maxNumberOfRecentFiles(); ++i) {
+    recentFileActs[i] = new QAction(this);
+    recentFileActs[i]->setVisible(false);
+    connect(recentFileActs[i], SIGNAL(triggered()), this, SLOT(openRecentFile_aux()));
+    if (insertBeforeAction)
+      menu->insertAction(insertBeforeAction, recentFileActs[i]);
+    else
+      menu->addAction(recentFileActs[i]);
+  }
+  updateRecentFileActions();
+}
+
+void MainWindow::open(const QString& filename)
+{
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  m_scene->load(filename, this);
+  QApplication::restoreOverrideCursor();
+  addToRecentFiles(filename);
+  on_actionRecenter_triggered();
+  update();
+}
+
+void MainWindow::save(const QString& filename)
+{
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  m_scene->save(filename);
+  QApplication::restoreOverrideCursor();
+}
+
+void MainWindow::update()
+{
+  viewer->repaint();
+}
+
+void MainWindow::on_actionClear_triggered()
+{
+  m_scene->clear();
+  update();
+}
+
+void MainWindow::on_actionLoadPoints_triggered()
+{
+  QString fileName =
+      QFileDialog::getOpenFileName(this, tr("Open point set"), ".");
+  if (fileName.isEmpty()) return;
+  open(fileName);
+}
+
+void MainWindow::on_actionSave_triggered()
+{
+  QString filename =
+    QFileDialog::getSaveFileName(this, tr("Save point set"), ".", tr("*.xy"));
+  if (filename.isEmpty()) return;
+  save(filename);
+}
+
+
+void MainWindow::on_actionInsertPoint_toggled() 
+{
+  viewer->toggle_insert_points();
+  update();
+}
+
+void MainWindow::on_actionRecenter_triggered() 
+{
+  double center_x, center_y, scale;
+  m_scene->compute_bbox(center_x, center_y, scale);
+  viewer->set_camera(center_x, center_y, 1. / scale);
+  update();
+}
+
+
+///////////////////////////
+// PREDEFINED POINT SETS //
+///////////////////////////
+
+void MainWindow::on_actionCircle_triggered()
+{
+  bool ok;
+  int density = QInputDialog::getInt(
+      this, tr("Density"), tr("Density:"), 300, 10, 10000, 1, &ok);
+  if (!ok) return;
+
+  float x = QInputDialog::getDouble(
+      this, tr("Center x"), tr("Center x:"), 0.0, 0.0, 10, 1, &ok);
+  if (!ok) return;
+
+  float y = QInputDialog::getDouble(
+      this, tr("Center y"), tr("Center y:"), 0.0, 0.0, 10, 1, &ok);
+  if (!ok) return;
+
+  float radius = QInputDialog::getDouble(
+      this, tr("Radius"), tr("Radius:"), 0.5, 0.1, 10, 1, &ok);
+  if (!ok) return;
+
+  m_scene->append_predefined_circle(density, x, y, radius);
+  update();
+}
+
+void MainWindow::on_actionHalf_circle_triggered()
+{
+  bool ok;
+  unsigned int density = QInputDialog::getInt(
+      this, tr("Density"), tr("Density:"), 150, 10, 10000, 1, &ok);
+  if (!ok) return;
+
+  m_scene->append_predefined_half_circle(density);
+  update();
+}
+
+void MainWindow::on_actionSpiral_triggered()
+{
+  bool ok;
+
+  int loops = QInputDialog::getInt(
+      this, tr("Loops"), tr("Number:"), 3, 1, 10000, 1, &ok);
+  if (!ok) return;
+
+  int density = QInputDialog::getInt(
+      this, tr("Density"), tr("Density:"), 10, 1, 10000, 1, &ok);
+  if (!ok) return;
+
+  m_scene->append_predefined_spiral(loops,density);
+  update();
+}
+
+
+void MainWindow::on_actionLine_triggered()
+{
+  bool ok;
+  unsigned int density = QInputDialog::getInt(
+      this, tr("Density"), tr("Density:"), 50, 1, 10000, 1, &ok);
+  if (!ok) return;
+
+  m_scene->append_predefined_line(density);
+  update();
+}
+
+void MainWindow::on_actionBox_triggered()
+{
+  bool ok;
+  int density = QInputDialog::getInt(
+      this, tr("Density"), tr("Density:"), 100, 1, 10000, 1, &ok);
+  if (!ok) return;
+
+  float x = QInputDialog::getDouble(
+      this, tr("x"), tr("x:"), 0.0, 0.0, 10.0, 1, &ok);
+  if (!ok) return;
+
+  float y = QInputDialog::getDouble(
+      this, tr("y"), tr("y:"), 0.0, 0.0, 10.0, 1, &ok);
+  if (!ok) return;
+
+  float sx = QInputDialog::getDouble(
+      this, tr("size x"), tr("size x:"), 1.0, 0.1, 10.0, 1, &ok);
+  if (!ok) return;
+
+  float sy = QInputDialog::getDouble(
+      this, tr("size y"), tr("size y:"), 1.0, 0.1, 10.0, 1, &ok);
+  if (!ok) return;
+
+  m_scene->append_predefined_box(density, x, y, sx, sy);
+  update();
+}
+
+void MainWindow::on_actionBoxes_triggered()
+{
+  bool ok;
+  unsigned int density = QInputDialog::getInt(
+      this, tr("Density"), tr("Density:"), 10, 1, 10000, 1, &ok);
+  if (!ok) return;
+
+  m_scene->append_predefined_boxes(density);
+  update();
+}
+
+void MainWindow::on_actionParallel_lines_triggered()
+{
+  bool ok;
+
+  int lines = QInputDialog::getInt(
+      this, tr("Lines"), tr("Number:"), 3, 1, 10000, 1, &ok);
+  if(!ok) return;
+
+  float space = QInputDialog::getDouble(
+      this, tr("Space"), tr("Space:"), 0.2, 0.1, 10, 1, &ok);
+  if (!ok) return;
+
+  int density = QInputDialog::getInt(
+      this, tr("Density"), tr("Density:"), 10, 1, 10000, 1, &ok);
+  if(!ok) return;
+
+  m_scene->append_predefined_parallel_lines(lines, space, density);
+  update();
+}
+
+void MainWindow::on_actionBox_with_boundaries_triggered()
+{
+  bool ok;
+  unsigned int density = QInputDialog::getInt(
+      this, tr("Density"), tr("Density:"), 10, 1, 10000, 1, &ok);
+  if (!ok) return;
+
+  m_scene->append_predefined_box_with_boundaries(density);
+  update();
+}
+
+void MainWindow::on_actionBox_with_missing_corners_triggered()
+{
+  bool ok;
+  unsigned int density = QInputDialog::getInt(
+      this, tr("Density"), tr("Density:"), 10, 1, 10000, 1, &ok);
+  if (!ok) return;
+
+  m_scene->append_predefined_box_with_missing_corners(density);
+  update();
+}
+
+void MainWindow::on_actionStar_triggered()
+{
+  bool ok;
+  int nb_branches = QInputDialog::getInt(
+      this, tr("Branches"), tr("Branches:"), 20, 2, 10000, 1, &ok);
+  if(!ok) return;
+
+  int density = QInputDialog::getInt(
+      this, tr("Density"), tr("Density:"), 100, 10, 10000, 1, &ok);
+  if(!ok) return;
+
+  m_scene->append_star(nb_branches,density);
+  update();
+}
+
+
+void MainWindow::on_actionStair_triggered()
+{
+  bool ok;
+  unsigned int density = QInputDialog::getInt(
+      this, tr("Density"), tr("Density:"), 30, 2, 10000, 1, &ok);
+  if (!ok) return;
+
+  m_scene->append_predefined_stair(density);
+  on_actionRecenter_triggered();
+  update();
+}
+
+void MainWindow::on_actionSkyline_triggered()
+{
+  bool ok;
+  unsigned int density = QInputDialog::getInt(
+      this, tr("Density"), tr("Density:"), 10, 1, 10000, 1, &ok);
+  if (!ok) return;
+
+  m_scene->append_predefined_skyline(density);
+  on_actionRecenter_triggered();
+  update();
+}
+
+void MainWindow::on_actionIncreasingly_sharp_angles_triggered()
+{
+  bool ok;
+  unsigned int density = QInputDialog::getInt(
+      this, tr("Density"), tr("Density:"), 100, 1, 10000, 1, &ok);
+  if (!ok) return;
+
+  double min_angle = QInputDialog::getDouble(
+      this, tr("Min Angle"), tr("Min Angle:"), 1.0, 1.0, 360.0, 1.0, &ok);
+  if (!ok) return;
+
+  m_scene->append_predefined_increasingly_sharp_angles(density, min_angle);
+  on_actionRecenter_triggered();
+  update();
+}
+
+void MainWindow::on_actionWidely_variable_sampling_triggered()
+{
+  bool ok;
+  float d1 = QInputDialog::getDouble(
+      this, tr("Delta-angle"), tr("Delta-angle:"), 1, 0.01, 20.0, 2, &ok);
+  if (!ok) return;
+
+  float d2 = QInputDialog::getDouble(
+      this, tr("Delta-angle"), tr("Delta-angle:"), 10, 0.01, 30.0, 2, &ok);
+  if (!ok) return;
+
+  m_scene->append_widely_variable_sampling(d1, d2);
+  update();
+}
+
+void MainWindow::on_actionNoise_triggered()
+{
+  bool ok;
+  double noise = QInputDialog::getDouble(
+      this, tr("Noise"), tr("Amount:"), 0.003, 0.0, 1000.0, 8, &ok);
+  if (!ok) return;
+
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  m_scene->noise(noise);
+  QApplication::restoreOverrideCursor();
+  update();
+}
+
+void MainWindow::on_actionAdd_outliers_triggered()
+{
+  bool ok;
+  unsigned int nb = (unsigned)
+        QInputDialog::getInt(
+            this, tr("Outliers"), tr("How many:"), 10, 1, 100000, 1, &ok);
+  if (!ok) return;
+
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  m_scene->add_outliers(nb);
+  QApplication::restoreOverrideCursor();
+  update();
+}
+
+void MainWindow::on_actionSubdivide_triggered()
+{
+  m_scene->subdivide();
+  update();
+}
+
+void MainWindow::on_actionDecimate_triggered()
+{
+  bool ok;
+  int percent = QInputDialog::getInt(
+      this, tr("Decimate"), tr("Percentage:"), 50, 1, 100, 1, &ok);
+  if (!ok) return;
+
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  const double percentage = double(percent) / 100.0;
+  m_scene->decimate(percentage);
+  QApplication::restoreOverrideCursor();
+  update();
+}
+
+
+////////////////////
+// RECONSTRUCTION //
+////////////////////
+
+void MainWindow::set_scene_options()
+{
+  m_scene->set_options(m_verbose, m_mchoice, m_use_flip,
+      m_relocation, m_relevance, percentage());
+}
+
+void MainWindow::on_actionReconstruction_reinit_triggered()
+{
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  set_scene_options();
+  m_scene->init_reconstruction(percentage());
+  QApplication::restoreOverrideCursor();
+  update();
+}
+
+void MainWindow::on_actionReconstruction_one_step_triggered()
+{
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  set_scene_options();
+  m_scene->reconstruct(1);
+  QApplication::restoreOverrideCursor();
+  update();
+}
+
+void MainWindow::on_actionReconstruction_10_steps_triggered()
+{
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  set_scene_options();
+  m_scene->reconstruct(10);
+  QApplication::restoreOverrideCursor();
+  update();
+}
+
+void MainWindow::on_actionReconstruction_100_steps_triggered()
+{
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  set_scene_options();
+  m_scene->reconstruct(100);
+  QApplication::restoreOverrideCursor();
+  update();
+}
+
+void MainWindow::on_actionReconstruction_1000_steps_triggered()
+{
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  set_scene_options();
+  m_scene->reconstruct(1000);
+  QApplication::restoreOverrideCursor();
+  update();
+}
+
+void MainWindow::on_actionReconstruction_until_triggered()
+{
+  bool ok;
+  int nb_points = QInputDialog::getInt(
+      this, tr("Number of Points"), tr("Nb:"), 4, 1, 1000000, 1, &ok);
+  if (!ok) return;
+
+  set_scene_options();
+
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  m_scene->reconstruct_until(nb_points);
+  QApplication::restoreOverrideCursor();
+
+  update();
+}
+
+void MainWindow::on_actionRelocate_vertices_triggered()
+{
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  m_scene->relocate_all_points();
+  QApplication::restoreOverrideCursor();
+  update();
+}
+
+void MainWindow::on_actionOutput_console_triggered()
+{
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  m_scene->output_console();
+  QApplication::restoreOverrideCursor();
+  update();
+}
+
+
+
+//////////
+// VIEW //
+//////////
+
+void MainWindow::on_actionView_points_toggled()
+{
+  viewer->toggle_view_points();
+  update();
+}
+
+void MainWindow::on_actionView_vertices_toggled()
+{
+  viewer->toggle_view_vertices();
+  update();
+}
+
+void MainWindow::on_actionView_edges_toggled()
+{
+  viewer->toggle_view_edges();
+  update();
+}
+
+void MainWindow::on_actionView_ghost_toggled()
+{
+  viewer->toggle_view_ghost_edges();
+  update();
+}
+
+void MainWindow::on_actionView_edge_cost_toggled()
+{
+  viewer->toggle_view_edge_cost();
+  update();
+}
+
+void MainWindow::on_actionView_edge_priority_toggled()
+{
+  viewer->toggle_view_edge_priority();
+  update();
+}
+
+void MainWindow::on_actionView_bins_toggled()
+{
+  viewer->toggle_view_bins();
+  update();
+}
+
+void MainWindow::on_actionView_foot_points_toggled()
+{
+  viewer->toggle_view_foot_points();
+  update();
+}
+
+void MainWindow::on_actionView_relocation_toggled()
+{
+  viewer->toggle_view_relocation();
+  update();
+}
+
+void MainWindow::on_actionView_relevance_toggled()
+{
+  viewer->toggle_view_edge_relevance();
+  update();
+}
+
+void MainWindow::on_actionSet_options_triggered()
+{
+  Dialog_options dlg;
+  dlg.set_all_ranges();
+  dlg.set_verbose(m_verbose);
+  dlg.set_random_sample_size(m_mchoice);
+  dlg.set_percent(m_percent);
+  dlg.set_relocation(m_relocation);
+  dlg.set_relevance(m_relevance);
+  dlg.set_use_flip(m_use_flip);
+  dlg.set_multiple_choice_checkbox(m_mchoice != 0);
+  dlg.set_line_thickness(viewer->line_thickness());
+  dlg.set_point_size(viewer->point_size());
+  dlg.set_vertex_size(viewer->vertex_size());
+
+  if (dlg.exec() == QDialog::Accepted)
+  {
+    m_verbose = dlg.get_verbose();
+    m_mchoice = dlg.get_mchoice();
+    m_percent = dlg.get_percent();
+    m_relocation = dlg.get_relocation();
+    m_relevance  = dlg.get_relevance();
+    m_use_flip   = dlg.get_use_flip();
+
+    set_scene_options();
+    viewer->line_thickness() = dlg.get_line_thickness();
+    viewer->point_size()  = dlg.get_point_size();
+    viewer->vertex_size() = dlg.get_vertex_size();
+    update();
+  }
+}
diff --git a/3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/window.h b/3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/window.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/window.h
rename to 3rdparty/CGAL/demo/Optimal_transportation_reconstruction_2/window.h
diff --git a/3rdparty/CGAL/demo/Periodic_2_triangulation_2/CMakeLists.txt b/3rdparty/CGAL/demo/Periodic_2_triangulation_2/CMakeLists.txt
new file mode 100644
index 0000000..17970b4
--- /dev/null
+++ b/3rdparty/CGAL/demo/Periodic_2_triangulation_2/CMakeLists.txt
@@ -0,0 +1,61 @@
+project (Periodic_2_Triangulation_2_demo)
+
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+find_package(CGAL COMPONENTS Qt5)
+
+include(${CGAL_USE_FILE})
+
+
+
+find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
+include_directories (BEFORE ../../../include)
+include_directories (BEFORE ./include)
+
+if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
+
+add_definitions(-DQT_NO_KEYWORDS)
+
+
+#--------------------------------
+# The "2D Periodic triangulation" demo: Periodic_2_triangulation_2
+#--------------------------------
+# UI files (Qt Designer files)
+qt5_wrap_ui( DT_UI_FILES Periodic_2_triangulation_2.ui )
+
+# qrc files (resources files, that contain icons, at least)
+qt5_add_resources ( CGAL_Qt5_RESOURCE_FILES ./Periodic_2_triangulation_2.qrc )
+
+# use the Qt MOC preprocessor on classes that derives from QObject
+qt5_generate_moc( Periodic_2_Delaunay_triangulation_2.cpp Periodic_2_triangulation_2.moc )
+
+# find header files for projects that can show them
+file(GLOB headers "*.h")
+file(GLOB QT_headers "include/CGAL/Qt/*.h")
+file(GLOB P2T2_headers "../../../include/CGAL/*.h")
+SOURCE_GROUP("P2T2" FILES ${P2T2_headers})
+SOURCE_GROUP("QT" FILES ${QT_headers})
+
+# The executable itself.
+add_executable  ( Periodic_2_Delaunay_triangulation_2 
+  Periodic_2_Delaunay_triangulation_2.cpp
+  Periodic_2_triangulation_2.moc 
+  ${DT_UI_FILES}  ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES}
+  ${headers} ${QT_headers} ${P2T2_headers})
+
+qt5_use_modules( Periodic_2_Delaunay_triangulation_2 Xml Script OpenGL Svg)
+
+add_to_cached_list( CGAL_EXECUTABLE_TARGETS Periodic_2_Delaunay_triangulation_2 )
+
+# Link with Qt libraries
+target_link_libraries( Periodic_2_Delaunay_triangulation_2 ${QT_LIBRARIES} )
+# Link with CGAL
+target_link_libraries( Periodic_2_Delaunay_triangulation_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES})
+else()
+
+  message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
+
+endif()
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/Periodic_2_Delaunay_triangulation_2.cpp b/3rdparty/CGAL/demo/Periodic_2_triangulation_2/Periodic_2_Delaunay_triangulation_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/Periodic_2_Delaunay_triangulation_2.cpp
rename to 3rdparty/CGAL/demo/Periodic_2_triangulation_2/Periodic_2_Delaunay_triangulation_2.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/Periodic_2_triangulation_2.qrc b/3rdparty/CGAL/demo/Periodic_2_triangulation_2/Periodic_2_triangulation_2.qrc
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/Periodic_2_triangulation_2.qrc
rename to 3rdparty/CGAL/demo/Periodic_2_triangulation_2/Periodic_2_triangulation_2.qrc
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/Periodic_2_triangulation_2.ui b/3rdparty/CGAL/demo/Periodic_2_triangulation_2/Periodic_2_triangulation_2.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/Periodic_2_triangulation_2.ui
rename to 3rdparty/CGAL/demo/Periodic_2_triangulation_2/Periodic_2_triangulation_2.ui
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/TriangulationCircumcircle.h b/3rdparty/CGAL/demo/Periodic_2_triangulation_2/TriangulationCircumcircle.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/TriangulationCircumcircle.h
rename to 3rdparty/CGAL/demo/Periodic_2_triangulation_2/TriangulationCircumcircle.h
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/TriangulationConflictZone.h b/3rdparty/CGAL/demo/Periodic_2_triangulation_2/TriangulationConflictZone.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/TriangulationConflictZone.h
rename to 3rdparty/CGAL/demo/Periodic_2_triangulation_2/TriangulationConflictZone.h
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/TriangulationMovingPoint.h b/3rdparty/CGAL/demo/Periodic_2_triangulation_2/TriangulationMovingPoint.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/TriangulationMovingPoint.h
rename to 3rdparty/CGAL/demo/Periodic_2_triangulation_2/TriangulationMovingPoint.h
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/TriangulationPointInputAndConflictZone.h b/3rdparty/CGAL/demo/Periodic_2_triangulation_2/TriangulationPointInputAndConflictZone.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/TriangulationPointInputAndConflictZone.h
rename to 3rdparty/CGAL/demo/Periodic_2_triangulation_2/TriangulationPointInputAndConflictZone.h
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/TriangulationRemoveVertex.h b/3rdparty/CGAL/demo/Periodic_2_triangulation_2/TriangulationRemoveVertex.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/TriangulationRemoveVertex.h
rename to 3rdparty/CGAL/demo/Periodic_2_triangulation_2/TriangulationRemoveVertex.h
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/about_Periodic_2_triangulation_2.html b/3rdparty/CGAL/demo/Periodic_2_triangulation_2/about_Periodic_2_triangulation_2.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/about_Periodic_2_triangulation_2.html
rename to 3rdparty/CGAL/demo/Periodic_2_triangulation_2/about_Periodic_2_triangulation_2.html
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/icons/circumcenter.pdf b/3rdparty/CGAL/demo/Periodic_2_triangulation_2/icons/circumcenter.pdf
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/icons/circumcenter.pdf
rename to 3rdparty/CGAL/demo/Periodic_2_triangulation_2/icons/circumcenter.pdf
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/icons/circumcenter.png b/3rdparty/CGAL/demo/Periodic_2_triangulation_2/icons/circumcenter.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/icons/circumcenter.png
rename to 3rdparty/CGAL/demo/Periodic_2_triangulation_2/icons/circumcenter.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/icons/conflict_zone.pdf b/3rdparty/CGAL/demo/Periodic_2_triangulation_2/icons/conflict_zone.pdf
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/icons/conflict_zone.pdf
rename to 3rdparty/CGAL/demo/Periodic_2_triangulation_2/icons/conflict_zone.pdf
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/icons/conflict_zone.png b/3rdparty/CGAL/demo/Periodic_2_triangulation_2/icons/conflict_zone.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/icons/conflict_zone.png
rename to 3rdparty/CGAL/demo/Periodic_2_triangulation_2/icons/conflict_zone.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/icons/constrained_triangulation.pdf b/3rdparty/CGAL/demo/Periodic_2_triangulation_2/icons/constrained_triangulation.pdf
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/icons/constrained_triangulation.pdf
rename to 3rdparty/CGAL/demo/Periodic_2_triangulation_2/icons/constrained_triangulation.pdf
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/icons/constrained_triangulation.png b/3rdparty/CGAL/demo/Periodic_2_triangulation_2/icons/constrained_triangulation.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/icons/constrained_triangulation.png
rename to 3rdparty/CGAL/demo/Periodic_2_triangulation_2/icons/constrained_triangulation.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/icons/constrained_triangulation_show_constraints.pdf b/3rdparty/CGAL/demo/Periodic_2_triangulation_2/icons/constrained_triangulation_show_constraints.pdf
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/icons/constrained_triangulation_show_constraints.pdf
rename to 3rdparty/CGAL/demo/Periodic_2_triangulation_2/icons/constrained_triangulation_show_constraints.pdf
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/icons/constrained_triangulation_show_constraints.png b/3rdparty/CGAL/demo/Periodic_2_triangulation_2/icons/constrained_triangulation_show_constraints.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/icons/constrained_triangulation_show_constraints.png
rename to 3rdparty/CGAL/demo/Periodic_2_triangulation_2/icons/constrained_triangulation_show_constraints.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/icons/constrained_triangulation_show_in_domain.pdf b/3rdparty/CGAL/demo/Periodic_2_triangulation_2/icons/constrained_triangulation_show_in_domain.pdf
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/icons/constrained_triangulation_show_in_domain.pdf
rename to 3rdparty/CGAL/demo/Periodic_2_triangulation_2/icons/constrained_triangulation_show_in_domain.pdf
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/icons/constrained_triangulation_show_in_domain.png b/3rdparty/CGAL/demo/Periodic_2_triangulation_2/icons/constrained_triangulation_show_in_domain.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/icons/constrained_triangulation_show_in_domain.png
rename to 3rdparty/CGAL/demo/Periodic_2_triangulation_2/icons/constrained_triangulation_show_in_domain.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/icons/fit-page-32.png b/3rdparty/CGAL/demo/Periodic_2_triangulation_2/icons/fit-page-32.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/icons/fit-page-32.png
rename to 3rdparty/CGAL/demo/Periodic_2_triangulation_2/icons/fit-page-32.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/icons/inputPoint.png b/3rdparty/CGAL/demo/Periodic_2_triangulation_2/icons/inputPoint.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/icons/inputPoint.png
rename to 3rdparty/CGAL/demo/Periodic_2_triangulation_2/icons/inputPoint.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/icons/moving_point.pdf b/3rdparty/CGAL/demo/Periodic_2_triangulation_2/icons/moving_point.pdf
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/icons/moving_point.pdf
rename to 3rdparty/CGAL/demo/Periodic_2_triangulation_2/icons/moving_point.pdf
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/icons/moving_point.png b/3rdparty/CGAL/demo/Periodic_2_triangulation_2/icons/moving_point.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/icons/moving_point.png
rename to 3rdparty/CGAL/demo/Periodic_2_triangulation_2/icons/moving_point.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/icons/triangulation.pdf b/3rdparty/CGAL/demo/Periodic_2_triangulation_2/icons/triangulation.pdf
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/icons/triangulation.pdf
rename to 3rdparty/CGAL/demo/Periodic_2_triangulation_2/icons/triangulation.pdf
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/icons/triangulation.png b/3rdparty/CGAL/demo/Periodic_2_triangulation_2/icons/triangulation.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/icons/triangulation.png
rename to 3rdparty/CGAL/demo/Periodic_2_triangulation_2/icons/triangulation.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/include/CGAL/Qt/PeriodicTriangulationGraphicsItem.h b/3rdparty/CGAL/demo/Periodic_2_triangulation_2/include/CGAL/Qt/PeriodicTriangulationGraphicsItem.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/include/CGAL/Qt/PeriodicTriangulationGraphicsItem.h
rename to 3rdparty/CGAL/demo/Periodic_2_triangulation_2/include/CGAL/Qt/PeriodicTriangulationGraphicsItem.h
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/include/CGAL/Qt/PeriodicVoronoiGraphicsItem.h b/3rdparty/CGAL/demo/Periodic_2_triangulation_2/include/CGAL/Qt/PeriodicVoronoiGraphicsItem.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_2_triangulation_2/include/CGAL/Qt/PeriodicVoronoiGraphicsItem.h
rename to 3rdparty/CGAL/demo/Periodic_2_triangulation_2/include/CGAL/Qt/PeriodicVoronoiGraphicsItem.h
diff --git a/3rdparty/CGAL/demo/Periodic_3_triangulation_3/CMakeLists.txt b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/CMakeLists.txt
new file mode 100644
index 0000000..028a036
--- /dev/null
+++ b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/CMakeLists.txt
@@ -0,0 +1,102 @@
+
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+project( Periodic_3_triangulation_3_demo )
+
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+# Find CGAL
+find_package(CGAL COMPONENTS Qt5)
+include( ${CGAL_USE_FILE} )
+
+# Find Qt5 itself
+find_package(Qt5 QUIET COMPONENTS Xml OpenGL Help Core)
+
+# Find OpenGL
+find_package(OpenGL)
+
+# Find QGLViewer
+if(Qt5_FOUND)
+  add_definitions(-DQT_NO_KEYWORDS)
+  find_package(QGLViewer)
+endif(Qt5_FOUND)
+
+if (CGAL_FOUND AND CGAL_Qt5_FOUND AND OPENGL_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND AND TARGET Qt5::qcollectiongenerator)
+
+   include_directories( ${QGLVIEWER_INCLUDE_DIR} )
+
+  # UI files (Qt Designer files)
+  qt5_wrap_ui ( UI_FILES MainWindow.ui )
+
+  # qrc files (resource files)
+  qt5_add_resources( CGAL_Qt5_RESOURCE_FILES ./Periodic_3_triangulation_3.qrc )
+
+  # use the Qt MOC preprocessor on classes that derive from QObject
+  qt5_generate_moc( "Scene.h" "${CMAKE_CURRENT_BINARY_DIR}/moc_Scene.cpp" )
+  qt5_generate_moc( "MainWindow.h" "${CMAKE_CURRENT_BINARY_DIR}/moc_MainWindow.cpp" )
+  qt5_generate_moc( "Viewer.h" "${CMAKE_CURRENT_BINARY_DIR}/moc_Viewer.cpp" )
+
+  if(DEFINED QT_QCOLLECTIONGENERATOR_EXECUTABLE)
+  else()
+    set(QT_QCOLLECTIONGENERATOR_EXECUTABLE qcollectiongenerator)
+  endif()
+
+  # generate QtAssistant collection file
+  add_custom_command ( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Periodic_3_triangulation_3.qhc
+      DEPENDS Periodic_3_triangulation_3.qhp Periodic_3_triangulation_3.qhcp
+      COMMAND Qt5::qcollectiongenerator
+                 ${CMAKE_CURRENT_SOURCE_DIR}/Periodic_3_triangulation_3.qhcp
+                 -o ${CMAKE_CURRENT_BINARY_DIR}/Periodic_3_triangulation_3.qhc
+  )
+
+  # Make sure the compiler can find generated .moc files
+  include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
+  include_directories( ${QT_INCLUDE_DIR} )
+  include_directories( ../../include .)
+
+  # The executable itself
+  add_executable  ( periodic_3_triangulation_3_demo
+                    Scene.cpp moc_Scene.cpp
+                    Viewer.cpp moc_Viewer.cpp
+                    periodic_3_triangulation_3_demo.cpp
+                    MainWindow.ui moc_MainWindow.cpp
+                    ${UI_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES} Periodic_3_triangulation_3.qhc)
+
+  qt5_use_modules(periodic_3_triangulation_3_demo Xml Help OpenGL)
+
+  add_to_cached_list( CGAL_EXECUTABLE_TARGETS periodic_3_triangulation_3_demo)
+
+  # Link the executable to CGAL and third-party libraries
+  target_link_libraries(periodic_3_triangulation_3_demo ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ${QT_LIBRARIES} ${QGLVIEWER_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
+
+else ()
+
+  set(PERIODIC_TRIANGULATION_MISSING_DEPS "")
+
+  if(NOT CGAL_Qt5_FOUND)
+    set(PERIODIC_TRIANGULATION_MISSING_DEPS "the CGAL Qt5 library, ${PERIODIC_TRIANGULATION_MISSING_DEPS}")
+  endif()
+
+  if(NOT Qt5_FOUND)
+    set(PERIODIC_TRIANGULATION_MISSING_DEPS "Qt5, ${PERIODIC_TRIANGULATION_MISSING_DEPS}")
+  endif()
+
+  if(NOT OPENGL_FOUND)
+    set(PERIODIC_TRIANGULATION_MISSING_DEPS "OpenGL, ${PERIODIC_TRIANGULATION_MISSING_DEPS}")
+  endif()
+
+  if(NOT QGLVIEWER_FOUND)
+    set(PERIODIC_TRIANGULATION_MISSING_DEPS "QGLViewer, ${PERIODIC_TRIANGULATION_MISSING_DEPS}")
+  endif()
+
+  if (NOT TARGET Qt5::qcollectiongenerator)
+    set(PERIODIC_TRIANGULATION_MISSING_DEPS "qcollectiongenerator, ${PERIODIC_TRIANGULATION_MISSING_DEPS}")
+  endif()
+
+  message(STATUS "NOTICE: This demo requires ${PERIODIC_TRIANGULATION_MISSING_DEPS}and will not be compiled.")
+
+endif ()
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/MainWindow.h b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/MainWindow.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/MainWindow.h
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/MainWindow.h
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/MainWindow.ui b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/MainWindow.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/MainWindow.ui
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/MainWindow.ui
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/Periodic_3_triangulation_3.qhcp b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/Periodic_3_triangulation_3.qhcp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/Periodic_3_triangulation_3.qhcp
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/Periodic_3_triangulation_3.qhcp
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/Periodic_3_triangulation_3.qhp b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/Periodic_3_triangulation_3.qhp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/Periodic_3_triangulation_3.qhp
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/Periodic_3_triangulation_3.qhp
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/Periodic_3_triangulation_3.qrc b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/Periodic_3_triangulation_3.qrc
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/Periodic_3_triangulation_3.qrc
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/Periodic_3_triangulation_3.qrc
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/Scene.cpp b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/Scene.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/Scene.cpp
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/Scene.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/Scene.h b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/Scene.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/Scene.h
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/Scene.h
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/Scene_utils.h b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/Scene_utils.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/Scene_utils.h
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/Scene_utils.h
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/Viewer.cpp b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/Viewer.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/Viewer.cpp
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/Viewer.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/Viewer.h b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/Viewer.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/Viewer.h
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/Viewer.h
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/data/oneH.xyz b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/data/oneH.xyz
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/data/oneH.xyz
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/data/oneH.xyz
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/data/oneK.xyz b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/data/oneK.xyz
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/data/oneK.xyz
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/data/oneK.xyz
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/data/points b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/data/points
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/data/points
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/data/points
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/documentation/images/mainwindow.png b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/documentation/images/mainwindow.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/documentation/images/mainwindow.png
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/documentation/images/mainwindow.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/documentation/index.html b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/documentation/index.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/documentation/index.html
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/documentation/index.html
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/documentation/introduction.html b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/documentation/introduction.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/documentation/introduction.html
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/documentation/introduction.html
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/documentation/menu.html b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/documentation/menu.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/documentation/menu.html
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/documentation/menu.html
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/ball.png b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/ball.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/ball.png
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/ball.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/camera.png b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/camera.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/camera.png
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/camera.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/clipping.png b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/clipping.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/clipping.png
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/clipping.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/clippingOff.png b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/clippingOff.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/clippingOff.png
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/clippingOff.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/conflict.png b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/conflict.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/conflict.png
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/conflict.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/cover1.png b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/cover1.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/cover1.png
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/cover1.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/cover27.png b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/cover27.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/cover27.png
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/cover27.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/fileOpen.png b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/fileOpen.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/fileOpen.png
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/fileOpen.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/init0.png b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/init0.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/init0.png
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/init0.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/init1.png b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/init1.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/init1.png
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/init1.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/initGrid.png b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/initGrid.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/initGrid.png
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/initGrid.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/initRand.png b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/initRand.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/initRand.png
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/initRand.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/initRandPlanar.png b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/initRandPlanar.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/initRandPlanar.png
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/initRandPlanar.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/inputPointBall.png b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/inputPointBall.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/inputPointBall.png
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/inputPointBall.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/inputPointRandom.png b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/inputPointRandom.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/inputPointRandom.png
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/inputPointRandom.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/license.txt b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/license.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/license.txt
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/license.txt
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/locate.png b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/locate.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/locate.png
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/locate.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/multiple.png b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/multiple.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/multiple.png
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/multiple.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/multipleOff.png b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/multipleOff.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/multipleOff.png
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/multipleOff.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/pause.png b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/pause.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/pause.png
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/pause.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/planar.png b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/planar.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/planar.png
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/planar.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/play.png b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/play.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/play.png
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/play.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/twoColorClipping.png b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/twoColorClipping.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/twoColorClipping.png
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/twoColorClipping.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/wireframe.png b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/wireframe.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/wireframe.png
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/wireframe.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/wireframeOff.png b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/wireframeOff.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/icons/wireframeOff.png
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/icons/wireframeOff.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/periodic_3_triangulation_3_demo.cpp b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/periodic_3_triangulation_3_demo.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/periodic_3_triangulation_3_demo.cpp
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/periodic_3_triangulation_3_demo.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/resources/about.html b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/resources/about.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/resources/about.html
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/resources/about.html
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/resources/about_CGAL.html b/3rdparty/CGAL/demo/Periodic_3_triangulation_3/resources/about_CGAL.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_3_triangulation_3/resources/about_CGAL.html
rename to 3rdparty/CGAL/demo/Periodic_3_triangulation_3/resources/about_CGAL.html
diff --git a/3rdparty/CGAL/demo/Periodic_Lloyd_3/CMakeLists.txt b/3rdparty/CGAL/demo/Periodic_Lloyd_3/CMakeLists.txt
new file mode 100644
index 0000000..0249cc2
--- /dev/null
+++ b/3rdparty/CGAL/demo/Periodic_Lloyd_3/CMakeLists.txt
@@ -0,0 +1,90 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+project (Periodic_Lloyd_3)
+
+# Find includes in corresponding build directories
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+# Instruct CMake to run moc automatically when needed.
+set(CMAKE_AUTOMOC ON)
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+find_package(CGAL COMPONENTS Qt5)
+include(${CGAL_USE_FILE})
+
+
+find_package(Qt5 QUIET COMPONENTS Xml Script Help OpenGL Svg)
+
+find_package(OpenGL)
+
+if(Qt5_FOUND)
+  find_package(QGLViewer)
+endif(Qt5_FOUND)
+
+if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND AND TARGET Qt5::qcollectiongenerator )
+
+
+  include_directories (${QGLVIEWER_INCLUDE_DIR})
+  include_directories (BEFORE ../../include ./ )
+
+  # ui file, created wih Qt Designer
+  qt5_wrap_ui( uis MainWindow.ui )
+
+  # qrc files (resources files, that contain icons, at least)
+  qt5_add_resources ( CGAL_Qt5_RESOURCE_FILES ./Periodic_Lloyd_3.qrc )
+
+
+  if(DEFINED QT_QCOLLECTIONGENERATOR_EXECUTABLE)
+  else()
+    set(QT_QCOLLECTIONGENERATOR_EXECUTABLE qcollectiongenerator)
+  endif()
+
+  # generate QtAssistant collection file
+  add_custom_command ( OUTPUT Periodic_Lloyd_3.qhc
+      DEPENDS Periodic_Lloyd_3.qhp Periodic_Lloyd_3.qhcp
+      COMMAND Qt5::qcollectiongenerator
+                ${CMAKE_CURRENT_SOURCE_DIR}/Periodic_Lloyd_3.qhcp
+                -o ${CMAKE_CURRENT_BINARY_DIR}/Periodic_Lloyd_3.qhc
+      WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+  )
+
+  add_executable  ( Periodic_Lloyd_3 Periodic_Lloyd_3.qhc Periodic_Lloyd_3.cpp MainWindow.cpp Viewer.cpp ${uis}  ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES})
+
+  qt5_use_modules(Periodic_Lloyd_3 Xml Script Help OpenGL Svg)
+  add_to_cached_list( CGAL_EXECUTABLE_TARGETS Periodic_Lloyd_3 )
+
+  target_link_libraries( Periodic_Lloyd_3 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES})
+  target_link_libraries( Periodic_Lloyd_3 ${QT_LIBRARIES} ${QGLVIEWER_LIBRARIES} )
+  target_link_libraries( Periodic_Lloyd_3 ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
+
+else( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND AND QT_QCOLLECTIONGENERATOR_EXECUTABLE )
+
+  set(PERIODIC_LLOYD_MISSING_DEPS "")
+
+  if(NOT CGAL_Qt5_FOUND)
+    set(PERIODIC_LLOYD_MISSING_DEPS "the CGAL Qt5 library, ${PERIODIC_LLOYD_MISSING_DEPS}")
+  endif()      	   
+
+  if(NOT Qt5_FOUND)
+    set(PERIODIC_LLOYD_MISSING_DEPS "Qt5, ${PERIODIC_LLOYD_MISSING_DEPS}")
+  endif()      	   
+
+  if(NOT OPENGL_FOUND)
+    set(PERIODIC_LLOYD_MISSING_DEPS "OpenGL, ${PERIODIC_LLOYD_MISSING_DEPS}")
+  endif()      	   
+
+  if(NOT QGLVIEWER_FOUND)
+    set(PERIODIC_LLOYD_MISSING_DEPS "QGLViewer, ${PERIODIC_LLOYD_MISSING_DEPS}")
+  endif()      	   
+
+  if(NOT QT_QCOLLECTIONGENERATOR_EXECUTABLE)
+    set(PERIODIC_LLOYD_MISSING_DEPS "qcollectiongenerator, ${PERIODIC_LLOYD_MISSING_DEPS}")
+  endif()
+
+
+  message(STATUS "NOTICE: This demo requires ${PERIODIC_LLOYD_MISSING_DEPS}and will not be compiled.")
+
+endif()
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/MainWindow.cpp b/3rdparty/CGAL/demo/Periodic_Lloyd_3/MainWindow.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/MainWindow.cpp
rename to 3rdparty/CGAL/demo/Periodic_Lloyd_3/MainWindow.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/MainWindow.h b/3rdparty/CGAL/demo/Periodic_Lloyd_3/MainWindow.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/MainWindow.h
rename to 3rdparty/CGAL/demo/Periodic_Lloyd_3/MainWindow.h
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/MainWindow.ui b/3rdparty/CGAL/demo/Periodic_Lloyd_3/MainWindow.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/MainWindow.ui
rename to 3rdparty/CGAL/demo/Periodic_Lloyd_3/MainWindow.ui
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/Periodic_Lloyd_3.cpp b/3rdparty/CGAL/demo/Periodic_Lloyd_3/Periodic_Lloyd_3.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/Periodic_Lloyd_3.cpp
rename to 3rdparty/CGAL/demo/Periodic_Lloyd_3/Periodic_Lloyd_3.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/Periodic_Lloyd_3.qhcp b/3rdparty/CGAL/demo/Periodic_Lloyd_3/Periodic_Lloyd_3.qhcp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/Periodic_Lloyd_3.qhcp
rename to 3rdparty/CGAL/demo/Periodic_Lloyd_3/Periodic_Lloyd_3.qhcp
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/Periodic_Lloyd_3.qhp b/3rdparty/CGAL/demo/Periodic_Lloyd_3/Periodic_Lloyd_3.qhp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/Periodic_Lloyd_3.qhp
rename to 3rdparty/CGAL/demo/Periodic_Lloyd_3/Periodic_Lloyd_3.qhp
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/Periodic_Lloyd_3.qrc b/3rdparty/CGAL/demo/Periodic_Lloyd_3/Periodic_Lloyd_3.qrc
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/Periodic_Lloyd_3.qrc
rename to 3rdparty/CGAL/demo/Periodic_Lloyd_3/Periodic_Lloyd_3.qrc
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/Scene.h b/3rdparty/CGAL/demo/Periodic_Lloyd_3/Scene.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/Scene.h
rename to 3rdparty/CGAL/demo/Periodic_Lloyd_3/Scene.h
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/Viewer.cpp b/3rdparty/CGAL/demo/Periodic_Lloyd_3/Viewer.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/Viewer.cpp
rename to 3rdparty/CGAL/demo/Periodic_Lloyd_3/Viewer.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/Viewer.h b/3rdparty/CGAL/demo/Periodic_Lloyd_3/Viewer.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/Viewer.h
rename to 3rdparty/CGAL/demo/Periodic_Lloyd_3/Viewer.h
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/about_CGAL.html b/3rdparty/CGAL/demo/Periodic_Lloyd_3/about_CGAL.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/about_CGAL.html
rename to 3rdparty/CGAL/demo/Periodic_Lloyd_3/about_CGAL.html
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/about_Periodic_Lloyd_3.html b/3rdparty/CGAL/demo/Periodic_Lloyd_3/about_Periodic_Lloyd_3.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/about_Periodic_Lloyd_3.html
rename to 3rdparty/CGAL/demo/Periodic_Lloyd_3/about_Periodic_Lloyd_3.html
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/documentation/images/mainwindow.png b/3rdparty/CGAL/demo/Periodic_Lloyd_3/documentation/images/mainwindow.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/documentation/images/mainwindow.png
rename to 3rdparty/CGAL/demo/Periodic_Lloyd_3/documentation/images/mainwindow.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/documentation/index.html b/3rdparty/CGAL/demo/Periodic_Lloyd_3/documentation/index.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/documentation/index.html
rename to 3rdparty/CGAL/demo/Periodic_Lloyd_3/documentation/index.html
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/documentation/introduction.html b/3rdparty/CGAL/demo/Periodic_Lloyd_3/documentation/introduction.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/documentation/introduction.html
rename to 3rdparty/CGAL/demo/Periodic_Lloyd_3/documentation/introduction.html
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/documentation/menu.html b/3rdparty/CGAL/demo/Periodic_Lloyd_3/documentation/menu.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/documentation/menu.html
rename to 3rdparty/CGAL/demo/Periodic_Lloyd_3/documentation/menu.html
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/icons/cp8.png b/3rdparty/CGAL/demo/Periodic_Lloyd_3/icons/cp8.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/icons/cp8.png
rename to 3rdparty/CGAL/demo/Periodic_Lloyd_3/icons/cp8.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/icons/fileNew.png b/3rdparty/CGAL/demo/Periodic_Lloyd_3/icons/fileNew.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/icons/fileNew.png
rename to 3rdparty/CGAL/demo/Periodic_Lloyd_3/icons/fileNew.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/icons/fileOpen.png b/3rdparty/CGAL/demo/Periodic_Lloyd_3/icons/fileOpen.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/icons/fileOpen.png
rename to 3rdparty/CGAL/demo/Periodic_Lloyd_3/icons/fileOpen.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/icons/fileSave.png b/3rdparty/CGAL/demo/Periodic_Lloyd_3/icons/fileSave.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/icons/fileSave.png
rename to 3rdparty/CGAL/demo/Periodic_Lloyd_3/icons/fileSave.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/icons/pause.png b/3rdparty/CGAL/demo/Periodic_Lloyd_3/icons/pause.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/icons/pause.png
rename to 3rdparty/CGAL/demo/Periodic_Lloyd_3/icons/pause.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/icons/planar.png b/3rdparty/CGAL/demo/Periodic_Lloyd_3/icons/planar.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/icons/planar.png
rename to 3rdparty/CGAL/demo/Periodic_Lloyd_3/icons/planar.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/icons/play.png b/3rdparty/CGAL/demo/Periodic_Lloyd_3/icons/play.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/icons/play.png
rename to 3rdparty/CGAL/demo/Periodic_Lloyd_3/icons/play.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/icons/step.png b/3rdparty/CGAL/demo/Periodic_Lloyd_3/icons/step.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/icons/step.png
rename to 3rdparty/CGAL/demo/Periodic_Lloyd_3/icons/step.png
diff --git a/3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/typedefs.h b/3rdparty/CGAL/demo/Periodic_Lloyd_3/typedefs.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Periodic_Lloyd_3/typedefs.h
rename to 3rdparty/CGAL/demo/Periodic_Lloyd_3/typedefs.h
diff --git a/3rdparty/CGAL/demo/Polygon/CMakeLists.txt b/3rdparty/CGAL/demo/Polygon/CMakeLists.txt
new file mode 100644
index 0000000..cf9d013
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polygon/CMakeLists.txt
@@ -0,0 +1,59 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+project (GraphicsView)
+
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+find_package(CGAL COMPONENTS Qt5 Core)
+
+include(${CGAL_USE_FILE})
+
+find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
+
+include_directories (BEFORE ../../include)
+
+if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
+
+  add_definitions(-DQT_NO_KEYWORDS)
+
+  if( CGAL_Core_FOUND)
+    add_definitions(-DCGAL_USE_CORE)
+  endif()
+
+  #--------------------------------
+  # Demo: Polygon_2
+  #--------------------------------
+  # UI files (Qt Designer files)
+  qt5_wrap_ui( DT_UI_FILES Polygon_2.ui )
+
+  # qrc files (resources files, that contain icons, at least)
+  qt5_add_resources ( CGAL_Qt5_RESOURCE_FILES ./Polygon_2.qrc )
+
+  # use the Qt MOC preprocessor on classes that derives from QObject
+  qt5_generate_moc( Polygon_2.cpp "${CMAKE_CURRENT_BINARY_DIR}/Polygon_2.moc" )
+
+#  add_library( CGAL SHARED IMPORTED ) 
+#  SET_PROPERTY(TARGET CGAL PROPERTY IMPORTED_LOCATION ${CGAL_LIBRARY} )
+
+  # The executable itself.
+  add_executable  ( Polygon_2 Polygon_2.cpp Polygon_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES} )
+
+  qt5_use_modules(Polygon_2 Xml Script OpenGL Svg)
+
+  add_to_cached_list( CGAL_EXECUTABLE_TARGETS Polygon_2 )
+
+
+  # Link with Qt libraries
+  target_link_libraries( Polygon_2 ${QT_LIBRARIES} )
+  # And with CGAL libraries
+  target_link_libraries( Polygon_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} )
+
+else()
+
+  message(STATUS "NOTICE: This demo requires CGAL, CGAL_Core, and Qt5, and will not be compiled.")
+
+endif()
diff --git a/3rdparty/CGAL-4.8/demo/Polygon/Polygon_2.cpp b/3rdparty/CGAL/demo/Polygon/Polygon_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polygon/Polygon_2.cpp
rename to 3rdparty/CGAL/demo/Polygon/Polygon_2.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Polygon/Polygon_2.qrc b/3rdparty/CGAL/demo/Polygon/Polygon_2.qrc
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polygon/Polygon_2.qrc
rename to 3rdparty/CGAL/demo/Polygon/Polygon_2.qrc
diff --git a/3rdparty/CGAL-4.8/demo/Polygon/Polygon_2.ui b/3rdparty/CGAL/demo/Polygon/Polygon_2.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polygon/Polygon_2.ui
rename to 3rdparty/CGAL/demo/Polygon/Polygon_2.ui
diff --git a/3rdparty/CGAL-4.8/demo/Polygon/about_Polygon_2.html b/3rdparty/CGAL/demo/Polygon/about_Polygon_2.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polygon/about_Polygon_2.html
rename to 3rdparty/CGAL/demo/Polygon/about_Polygon_2.html
diff --git a/3rdparty/CGAL-4.8/demo/Polygon/unweighted_polygon.poly b/3rdparty/CGAL/demo/Polygon/unweighted_polygon.poly
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polygon/unweighted_polygon.poly
rename to 3rdparty/CGAL/demo/Polygon/unweighted_polygon.poly
diff --git a/3rdparty/CGAL-4.8/demo/Polygon/weighted_polygon.wsl b/3rdparty/CGAL/demo/Polygon/weighted_polygon.wsl
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polygon/weighted_polygon.wsl
rename to 3rdparty/CGAL/demo/Polygon/weighted_polygon.wsl
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/C2t3_type.h b/3rdparty/CGAL/demo/Polyhedron/C2t3_type.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/C2t3_type.h
rename to 3rdparty/CGAL/demo/Polyhedron/C2t3_type.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/C3t3_type.h b/3rdparty/CGAL/demo/Polyhedron/C3t3_type.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/C3t3_type.h
rename to 3rdparty/CGAL/demo/Polyhedron/C3t3_type.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/CGAL_polyhedron_demoConfig.cmake.in b/3rdparty/CGAL/demo/Polyhedron/CGAL_polyhedron_demoConfig.cmake.in
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/CGAL_polyhedron_demoConfig.cmake.in
rename to 3rdparty/CGAL/demo/Polyhedron/CGAL_polyhedron_demoConfig.cmake.in
diff --git a/3rdparty/CGAL/demo/Polyhedron/CMakeLists.txt b/3rdparty/CGAL/demo/Polyhedron/CMakeLists.txt
new file mode 100644
index 0000000..e81976c
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/CMakeLists.txt
@@ -0,0 +1,381 @@
+# This is the CMake script for compiling the CGAL Polyhedron demo.
+
+project( Polyhedron )
+# Find includes in corresponding build directories
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+# Instruct CMake to run moc automatically when needed.
+set(CMAKE_AUTOMOC ON)
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+# Compatibility with CMake 3.0
+if(POLICY CMP0042)
+  # Do not enable the use of MACOSX_RPATH
+  # http://www.cmake.org/cmake/help/v3.0/policy/CMP0042.html
+  cmake_policy(SET CMP0042 OLD)
+endif()
+
+#Defines flags to emulate windows behavior for linking error generation
+if(CMAKE_CXX_COMPILER_ID EQUAL Clang OR CMAKE_COMPILER_IS_GNUCC  OR CMAKE_COMPILER_IS_GNUCXX)
+  if(UNIX OR APPLE)
+    SET( CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS} -fvisibility=hidden" )
+  endif()
+  if(UNIX AND NOT APPLE)
+    SET( CMAKE_EXE_LINKER_FLAGS  "${CMAKE_EXE_LINKER_FLAGS} -z defs")
+    SET( CMAKE_MODULE_LINKER_FLAGS  "${CMAKE_MODULE_LINKER_FLAGS} -z defs")
+    SET( CMAKE_SHARED_LINKER_FLAGS  "${CMAKE_SHARED_LINKER_FLAGS} -z defs")
+  endif()
+endif()
+# Let plugins be compiled in the same directory as the executable.
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
+
+# Include this package's headers first
+include_directories( BEFORE ./ ./include ../../include ./CGAL_demo )
+list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}")
+
+add_subdirectory( implicit_functions )
+
+# Find CGAL
+
+option( POLYHEDRON_QTSCRIPT_DEBUGGER 
+  "Activate the use of Qt Script Debugger in Polyhedron_3 demo" OFF)
+
+# Find Qt5 itself
+find_package(CGAL COMPONENTS Qt5 ImageIO)
+include( ${CGAL_USE_FILE} )
+
+find_package(Qt5
+             QUIET
+             COMPONENTS            OpenGL Script Svg Xml
+             OPTIONAL_COMPONENTS   ScriptTools)
+
+# Find OpenGL
+find_package(OpenGL)
+
+# Find QGLViewer
+if(Qt5_FOUND)
+
+  add_definitions(-DQT_NO_KEYWORDS)
+  add_definitions(-DSCENE_IMAGE_GL_BUFFERS_AVAILABLE)
+  find_package(QGLViewer )
+
+endif(Qt5_FOUND)
+
+find_package(Eigen3 3.2.0) #(requires 3.2.0 or greater)
+if (EIGEN3_FOUND)
+  include( ${EIGEN3_USE_FILE} )
+endif(EIGEN3_FOUND)
+
+# Activate concurrency?
+option(POLYHEDRON_DEMO_ACTIVATE_CONCURRENCY
+  "Enable concurrency"
+  ON)
+
+if( POLYHEDRON_DEMO_ACTIVATE_CONCURRENCY )
+  find_package( TBB )
+  if( TBB_FOUND )
+    include( ${TBB_USE_FILE} )
+    list( APPEND CGAL_3RD_PARTY_LIBRARIES ${TBB_LIBRARIES} )
+  else()
+    message( STATUS "NOTICE: Intel TBB was not found. Bilateral smoothing and WLOP plugins are faster if TBB is linked." )
+  endif()
+endif()
+
+
+# Activate concurrency ? (turned OFF by default)
+option(ACTIVATE_CONCURRENT_MESH_3
+  "Activate parallelism in Mesh_3"
+  OFF)
+
+# And add -DCGAL_CONCURRENT_MESH_3 if that option is ON
+if( ACTIVATE_CONCURRENT_MESH_3 OR ENV{ACTIVATE_CONCURRENT_MESH_3} )
+  add_definitions( -DCGAL_CONCURRENT_MESH_3 )
+  if(NOT TBB_FOUND)
+    find_package( TBB REQUIRED )
+    if( TBB_FOUND )
+      include(${TBB_USE_FILE})
+      list(APPEND CGAL_3RD_PARTY_LIBRARIES ${TBB_LIBRARIES})
+    else()
+      message(STATUS "NOTICE: Intel TBB was not found. Mesh_3 is faster if TBB is linked.")
+    endif()
+  endif()
+
+else( ACTIVATE_CONCURRENT_MESH_3 OR ENV{ACTIVATE_CONCURRENT_MESH_3} )
+  option( LINK_WITH_TBB
+    "Link with TBB anyway so we can use TBB timers for profiling"
+    ON)
+  if( LINK_WITH_TBB )
+    find_package( TBB )
+  endif( LINK_WITH_TBB )
+endif()
+
+
+
+
+if(CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
+
+  set(Boost_USE_MULTITHREADED      ON)
+  find_package(Boost COMPONENTS thread system)
+
+  include_directories ( ${QGLVIEWER_INCLUDE_DIR} )
+  qt5_wrap_ui( MainWindowUI_files MainWindow.ui)
+  qt5_wrap_ui( statisticsUI_FILES Statistics_on_item_dialog.ui)
+  qt5_wrap_ui( FileLoaderDialogUI_files FileLoaderDialog.ui )
+  qt5_wrap_ui( Show_point_dialogUI_FILES Show_point_dialog.ui )
+  qt5_wrap_ui( PreferencesUI_FILES   Preferences.ui )
+  qt5_wrap_ui( Show_point_dialogUI_FILES Show_point_dialog.ui )
+  qt5_wrap_ui( ViewerUI_FILES  ImageInterface.ui)
+  qt5_generate_moc( "File_loader_dialog.h" "${CMAKE_CURRENT_BINARY_DIR}/File_loader_dialog_moc.cpp" )
+  add_file_dependencies( File_loader_dialog_moc_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/File_loader_dialog.h" )
+
+  add_file_dependencies( Viewer_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/Viewer.h" )
+
+  include( ${CMAKE_CURRENT_SOURCE_DIR}/polyhedron_demo_macros.cmake )
+
+
+  qt5_add_resources ( CGAL_Qt5_RESOURCE_FILES Polyhedron_3.qrc )
+  qt5_add_resources(gl_splat_rc GlSplat/glsplat.qrc)
+  add_library(gl_splat SHARED
+      GlSplat/GlSplat.cpp GlSplat/Shader.cpp ${gl_splat_rc})
+  qt5_use_modules(gl_splat OpenGL Gui Xml)
+  target_link_libraries(gl_splat ${OPENGL_gl_LIBRARY})
+
+  find_path(CGAL_THREE_HEADERS_PATH
+    NAME CGAL/Three/Scene_item.h
+    HINTS ${CGAL_INCLUDE_DIRS}
+    NO_DEFAULT_PATH
+    DOC "Path to CGAL/Three/Scene_item.h")
+  
+  if(CGAL_THREE_HEADERS_PATH)
+    qt5_generate_moc( "${CGAL_THREE_HEADERS_PATH}/CGAL/Three/Viewer_interface.h"
+      "${CMAKE_CURRENT_BINARY_DIR}/Viewer_interface_moc.cpp" )
+    qt5_generate_moc( "${CGAL_THREE_HEADERS_PATH}/CGAL/Three/Scene_item.h"
+      "${CMAKE_CURRENT_BINARY_DIR}/Scene_item_moc.cpp" )
+    qt5_generate_moc( "${CGAL_THREE_HEADERS_PATH}/CGAL/Three/Scene_group_item.h"
+      "${CMAKE_CURRENT_BINARY_DIR}/Scene_group_item_moc.cpp" )
+    qt5_generate_moc( "${CGAL_THREE_HEADERS_PATH}/CGAL/Three/TextRenderer.h"
+      "${CMAKE_CURRENT_BINARY_DIR}/TextRenderer_moc.cpp" )
+  else()
+    message(FATAL_ERROR "Cannot find <CGAL/Three/Viewer_interface.h>")
+  endif()
+
+  unset(CGAL_THREE_HEADERS_PATH CACHE)
+
+# AUXILIARY LIBRARIES
+
+  # put s (which are shared libraries) at the same location as
+  # executable files
+  set(CGAL_POLYHEDRON_DEMO_PLUGINS_DIR "${RUNTIME_OUTPUT_PATH}")
+  set(LIBRARY_OUTPUT_PATH "${CGAL_POLYHEDRON_DEMO_PLUGINS_DIR}")
+
+  add_library(demo_framework SHARED
+    Scene.cpp
+    Viewer.cpp
+    ${ViewerUI_FILES}
+    Viewer_interface_moc.cpp
+    Scene_item_moc.cpp
+    Scene_item.cpp
+    Scene_group_item.cpp
+    Scene_group_item_moc.cpp
+    TextRenderer.cpp
+    TextRenderer_moc.cpp
+    Polyhedron_demo_plugin_helper.cpp)
+    qt5_use_modules(demo_framework OpenGL Gui Widgets Script Xml)
+  target_link_libraries(demo_framework
+    ${QGLVIEWER_LIBRARIES}
+    ${OPENGL_gl_LIBRARY}
+    ${OPENGL_glu_LIBRARY}
+    gl_splat
+    )
+
+  add_library(scene_basic_objects SHARED
+    Scene_plane_item.cpp
+    Scene_spheres_item.cpp
+)
+  target_link_libraries(scene_basic_objects 
+    demo_framework
+    ${CGAL_LIBRARIES}
+    ${QGLVIEWER_LIBRARIES}
+    ${OPENGL_gl_LIBRARY}
+    ${OPENGL_glu_LIBRARY}
+    gl_splat
+    )
+  qt5_use_modules(scene_basic_objects OpenGL Gui Xml Script Widgets)
+
+  add_library(scene_color_ramp SHARED Color_ramp.cpp)
+  qt5_use_modules(scene_color_ramp Core)
+
+  add_library(point_dialog SHARED Show_point_dialog.cpp Show_point_dialog.ui ${Show_point_dialogUI_FILES})
+  qt5_use_modules(point_dialog OpenGL Gui Xml Script Widgets)
+
+  macro(add_item item_name)
+    add_library(${item_name} SHARED ${ARGN})
+    qt5_use_modules(${item_name} OpenGL Gui Xml Script Widgets)
+    target_link_libraries(${item_name} demo_framework ${CGAL_LIBRARIES} ${Boost_LIBRARIES})
+  endmacro(add_item)
+
+  add_item(scene_c2t3_item Scene_c2t3_item.cpp)
+  add_item(scene_c3t3_item Scene_c3t3_item.cpp)
+  target_link_libraries(scene_c3t3_item scene_polyhedron_item scene_polygon_soup_item scene_basic_objects ${TBB_LIBRARIES})
+  add_item(scene_polyhedron_item Scene_polyhedron_item.cpp)
+  add_item(scene_polyhedron_transform_item Plugins/PCA/Scene_polyhedron_transform_item.cpp )
+  add_item(scene_image_item Scene_image_item.cpp)
+
+  # special
+  target_link_libraries(scene_polyhedron_transform_item scene_polyhedron_item)
+
+  add_item(scene_combinatorial_map_item Plugins/Operations_on_polyhedra/Scene_combinatorial_map_item.cpp)
+  # special
+  target_link_libraries(scene_combinatorial_map_item scene_polyhedron_item)
+
+  add_item(scene_polylines_item Scene_polylines_item.cpp)
+  target_link_libraries(scene_polylines_item scene_basic_objects)
+
+  add_item(scene_polyhedron_item_decorator Scene_polyhedron_item_decorator.cpp )
+  target_link_libraries(scene_polyhedron_item_decorator scene_polyhedron_item)
+  
+  add_item(scene_polyhedron_item_k_ring_selection Scene_polyhedron_item_k_ring_selection.cpp)
+  target_link_libraries(scene_polyhedron_item_k_ring_selection scene_polyhedron_item)
+ 
+  add_item(scene_polyhedron_selection_item Scene_polyhedron_selection_item.cpp)
+  target_link_libraries(scene_polyhedron_selection_item scene_polyhedron_item_decorator scene_polyhedron_item_k_ring_selection)
+
+  add_item(scene_polyhedron_shortest_path_item Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.cpp)
+
+  add_item(scene_surface_mesh_item Scene_surface_mesh_item.cpp)
+  
+  target_link_libraries(scene_polyhedron_shortest_path_item scene_polyhedron_item_decorator scene_polyhedron_item scene_polylines_item)
+
+  if(EIGEN3_FOUND )
+    qt5_wrap_ui( editionUI_FILES Plugins/Surface_mesh_deformation/Deform_mesh.ui )
+    add_item(scene_textured_polyhedron_item Scene_textured_polyhedron_item.cpp texture.cpp)
+    add_item(scene_edit_polyhedron_item Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp
+           ${editionUI_FILES})
+           target_link_libraries(scene_edit_polyhedron_item scene_polyhedron_item scene_polyhedron_item_k_ring_selection
+               scene_basic_objects)
+  endif()
+
+  add_item(scene_implicit_function_item Scene_implicit_function_item.cpp )
+  target_link_libraries(scene_implicit_function_item scene_color_ramp)
+
+  add_item(scene_polygon_soup_item Scene_polygon_soup_item.cpp)
+  target_link_libraries(scene_polygon_soup_item scene_polyhedron_item)
+  add_item(scene_nef_polyhedron_item Scene_nef_polyhedron_item.cpp)
+  
+  target_link_libraries(scene_nef_polyhedron_item scene_polyhedron_item)
+  add_item(scene_points_with_normal_item Scene_points_with_normal_item.cpp)
+  target_link_libraries( scene_points_with_normal_item gl_splat)
+
+  target_link_libraries( demo_framework gl_splat)
+
+  
+
+
+  foreach( lib 
+      demo_framework
+      scene_basic_objects
+      scene_color_ramp
+      scene_polyhedron_item
+      scene_polygon_soup_item
+      scene_nef_polyhedron_item)
+    add_to_cached_list( CGAL_EXECUTABLE_TARGETS ${lib} )
+  endforeach()
+
+  add_definitions( -DUSE_FORWARD_DECL)
+  add_library(polyhedron_demo SHARED
+    MainWindow.cpp
+    Polyhedron_demo.cpp
+    File_loader_dialog_moc.cpp
+    ${FileLoaderDialogUI_files} ${MainWindowUI_files} ${PreferencesUI_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${statisticsUI_FILES} ${CGAL_Qt5_MOC_FILES})
+  target_link_libraries(polyhedron_demo demo_framework point_dialog)
+  qt5_use_modules(polyhedron_demo Gui OpenGL Xml Widgets Script Svg )
+  add_executable  ( Polyhedron_3 Polyhedron_3.cpp )
+  target_link_libraries( Polyhedron_3 polyhedron_demo )
+  add_to_cached_list( CGAL_EXECUTABLE_TARGETS Polyhedron_3 )
+
+  if( POLYHEDRON_QTSCRIPT_DEBUGGER )
+    if(TARGET Qt5::ScriptTools)
+      qt5_use_modules(Polyhedron_3 ScriptTools)
+    else()
+      message(STATUS "POLYHEDRON_QTSCRIPT_DEBUGGER is set to TRUE but the Qt5 ScriptTools library was not found.")
+    endif()
+  endif()
+  target_link_libraries( Polyhedron_3 demo_framework )
+
+  # Link with CGAL
+  target_link_libraries( Polyhedron_3 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} )
+
+  # Link with libQGLViewer, OpenGL
+  target_link_libraries( Polyhedron_3 ${QGLVIEWER_LIBRARIES} ${OPENGL_gl_LIBRARY})
+
+  add_to_cached_list( CGAL_EXECUTABLE_TARGETS Polyhedron_3 )
+
+
+  ###########
+  # PLUGINS #
+  ###########
+
+
+  file(GLOB DEMO_PLUGINS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/Plugins/" "${CMAKE_CURRENT_SOURCE_DIR}/Plugins/*")
+  FOREACH(SUB_DIR ${DEMO_PLUGINS})
+      add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/Plugins/${SUB_DIR}")
+  ENDFOREACH()
+
+#
+# Exporting
+#
+  if(TARGET CGAL_Qt5)
+    export(TARGETS CGAL CGAL_Qt5 FILE polyhedron_demo_targets.cmake NAMESPACE Polyhedron_)
+  else()
+    export(TARGETS FILE polyhedron_demo_targets.cmake NAMESPACE Polyhedron_)
+  endif()
+  export(
+    TARGETS
+    demo_framework
+    scene_polyhedron_item
+    scene_points_with_normal_item
+    scene_color_ramp
+    scene_implicit_function_item
+    scene_polylines_item
+    scene_basic_objects
+    scene_polyhedron_selection_item
+    scene_polyhedron_item_decorator
+    scene_polyhedron_item_k_ring_selection
+    NAMESPACE Polyhedron_
+    APPEND FILE polyhedron_demo_targets.cmake)
+
+  export(
+    TARGETS
+    gl_splat
+    NAMESPACE Polyhedron_
+    APPEND FILE polyhedron_demo_targets.cmake)
+
+  configure_file(CGAL_polyhedron_demoConfig.cmake.in  CGAL_polyhedron_demoConfig.cmake)
+#TO DO script the activation of all the plugins.
+
+else (CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
+
+  set(POLYHEDRON_MISSING_DEPS "")
+
+  if(NOT CGAL_Qt5_FOUND)
+    set(POLYHEDRON_MISSING_DEPS "the CGAL Qt5 library, ${POLYHEDRON_MISSING_DEPS}")
+  endif()
+
+  if(NOT Qt5_FOUND)
+    set(POLYHEDRON_MISSING_DEPS "Qt5, ${POLYHEDRON_MISSING_DEPS}")
+  endif()
+
+  if(NOT OPENGL_FOUND)
+    set(POLYHEDRON_MISSING_DEPS "OpenGL, ${POLYHEDRON_MISSING_DEPS}")
+  endif()
+
+  if(NOT QGLVIEWER_FOUND)
+    set(POLYHEDRON_MISSING_DEPS "QGLViewer, ${POLYHEDRON_MISSING_DEPS}")
+  endif()
+
+  message(STATUS "NOTICE: This demo requires ${POLYHEDRON_MISSING_DEPS}and will not be compiled.")
+
+
+endif (CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Color_map.h b/3rdparty/CGAL/demo/Polyhedron/Color_map.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Color_map.h
rename to 3rdparty/CGAL/demo/Polyhedron/Color_map.h
diff --git a/3rdparty/CGAL/demo/Polyhedron/Color_ramp.cpp b/3rdparty/CGAL/demo/Polyhedron/Color_ramp.cpp
new file mode 100644
index 0000000..c2d18de
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Color_ramp.cpp
@@ -0,0 +1,142 @@
+#include "Color_ramp.h"
+#include <iostream>
+
+// -----------------------------------
+// Color_component
+// -----------------------------------
+Color_component::
+Color_component()
+{
+  add(0,0);
+  add(1,1);
+}
+
+Color_component::
+Color_component(const double c0, const double c1)
+{
+  add(0,c0);
+  add(1,c1);
+}
+
+double 
+Color_component::
+interpolate(const double v) const
+{
+  Values::const_iterator next = next_it(v);
+
+  // next is just after v
+  Values::const_iterator prev = --next;
+  ++next;
+
+  if ( v>=1 && next != values_.end())
+    std::cerr << ".";
+  
+  if ( next == values_.end() )
+  {
+    return prev->second;
+  }
+
+  const double& a = prev->first;
+  const double& b = next->first;
+  return (b-v)/(b-a) * prev->second + (v-a)/(b-a) * next->second;
+
+}
+
+void
+Color_component::
+add(const double v, double color)
+{
+  if ( color > 1 ) { color = 1; }
+  if ( color < 0 ) { color = 0; }
+  
+  Values::iterator next = next_it(v);
+  values_.insert(next, std::make_pair(v,color));
+}
+
+
+void
+Color_component::
+rebuild(const double c0, const double c1)
+{
+  values_.clear();
+  add(1,c1);
+  add(0,c0);
+}
+
+void
+Color_component::
+print() const
+{
+  for ( Values::const_iterator it = values_.begin(),
+       end = values_.end() ; it != end ; ++it )
+  { 
+    std::cout << "<" << it->first << "," << it->second << "> ";
+  }
+  
+  std::cout << std::endl;
+}
+
+
+// -----------------------------------
+// Color_ramp
+// -----------------------------------
+Color_ramp::Color_ramp()
+  : r_()
+  , g_()
+  , b_()
+{ 
+}
+
+void 
+Color_ramp::build_red()
+{
+  r_.rebuild(1,0.5);
+  g_.rebuild(1,0);
+  b_.rebuild(1,0);
+
+  r_.add(0.3,1);
+  r_.add(0.05,1);
+  g_.add(0.05,0.95);
+  g_.add(0.3,0.5);
+  b_.add(0.05,0);
+}
+
+void 
+Color_ramp::build_blue()
+{
+  r_.rebuild(1,0);
+  g_.rebuild(1,0);
+  b_.rebuild(1,0.5);
+  
+  b_.add(0.1,0.8);
+  g_.add(0.1,0.4);
+  r_.add(0.1,0.4);
+}
+
+void
+Color_ramp::build_thermal()
+{
+  r_.rebuild(1,0.5);
+  g_.rebuild(1,0);
+  b_.rebuild(1,0);
+
+  r_.add(0.3,1);
+  r_.add(0.05,1);
+  g_.add(0.05,0.8);
+  g_.add(0.3,0.5);
+  b_.add(0.05,0.6);
+  b_.add(0.05,0.3);
+}
+
+void
+Color_ramp::
+print() const
+{
+  std::cout << "r: ";
+  r_.print();
+  std::cout << "g: ";
+  g_.print();
+  std::cout << "b: ";
+  b_.print();
+}
+
diff --git a/3rdparty/CGAL/demo/Polyhedron/Color_ramp.h b/3rdparty/CGAL/demo/Polyhedron/Color_ramp.h
new file mode 100644
index 0000000..a7733cf
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Color_ramp.h
@@ -0,0 +1,95 @@
+#ifndef _COLOR_RAMP_H
+#define _COLOR_RAMP_H
+
+#include <QtCore/qglobal.h>
+#ifdef scene_color_ramp_EXPORTS
+#  define SCENE_COLOR_RAMP_EXPORT Q_DECL_EXPORT
+#else
+#  define SCENE_COLOR_RAMP_EXPORT Q_DECL_IMPORT
+#endif
+
+#include <list>
+
+class SCENE_COLOR_RAMP_EXPORT Color_component
+{
+  typedef std::list<std::pair<double,double> > Values;
+  
+public:
+  Color_component();
+  Color_component(const double c0, const double c1);
+  ~Color_component() {}
+  
+  double interpolate(const double v) const;
+  void add(const double v, double color);
+  void rebuild(const double c0, const double c1);
+  void print() const;
+  
+private:
+  inline Values::const_iterator next_it(const double v) const;
+  inline Values::iterator next_it(const double v);
+  
+private:
+  Values values_;
+};
+
+
+class SCENE_COLOR_RAMP_EXPORT Color_ramp
+{
+public :
+	Color_ramp();
+	~Color_ramp() {}
+
+public :
+  inline double r(double v) const;
+  inline double g(double v) const;
+  inline double b(double v) const;
+
+	void build_red();
+	void build_blue();
+        void build_thermal();
+  void print() const;
+
+private :
+  Color_component r_;
+  Color_component g_;
+  Color_component b_;
+};
+
+
+inline
+Color_component::Values::const_iterator
+Color_component::
+next_it(const double v) const
+{
+  Values::const_iterator next = values_.begin();
+  while ( next != values_.end() && v >= next->first ) { ++next; }
+  return next;
+}
+
+inline
+Color_component::Values::iterator
+Color_component::
+next_it(const double v)
+{
+  Values::iterator next = values_.begin();
+  while ( next != values_.end() && v >= next->first ) { ++next; }
+  return next;
+}
+
+inline
+double
+Color_ramp::r(double v) const
+{ return r_.interpolate(v); }
+
+inline
+double
+Color_ramp::g(double v) const
+{ return g_.interpolate(v);  }
+
+inline
+double
+Color_ramp::b(double v) const
+{ return b_.interpolate(v);  }
+
+
+#endif // _COLOR_RAMP_H
diff --git a/3rdparty/CGAL/demo/Polyhedron/FileLoaderDialog.ui b/3rdparty/CGAL/demo/Polyhedron/FileLoaderDialog.ui
new file mode 100644
index 0000000..fe10da9
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/FileLoaderDialog.ui
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>FileLoaderDialog</class>
+ <widget class="QDialog" name="FileLoaderDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>382</width>
+    <height>112</height>
+   </rect>
+  </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="windowTitle">
+   <string>Select a Loader</string>
+  </property>
+  <property name="layoutDirection">
+   <enum>Qt::LeftToRight</enum>
+  </property>
+  <property name="sizeGripEnabled">
+   <bool>false</bool>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <property name="sizeConstraint">
+    <enum>QLayout::SetFixedSize</enum>
+   </property>
+   <item>
+    <widget class="QLabel" name="label">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="text">
+      <string>TextLabel</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QComboBox" name="pluginBox">
+     <property name="statusTip">
+      <string/>
+     </property>
+     <property name="whatsThis">
+      <string/>
+     </property>
+     <property name="accessibleName">
+      <string/>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="layoutDirection">
+      <enum>Qt::LeftToRight</enum>
+     </property>
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QCheckBox" name="alwaysUse">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Minimum" vsizetype="Expanding">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="text">
+      <string/>
+     </property>
+     <property name="checked">
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>FileLoaderDialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>248</x>
+     <y>254</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>FileLoaderDialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>316</x>
+     <y>260</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/File_loader_dialog.h b/3rdparty/CGAL/demo/Polyhedron/File_loader_dialog.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/File_loader_dialog.h
rename to 3rdparty/CGAL/demo/Polyhedron/File_loader_dialog.h
diff --git a/3rdparty/CGAL/demo/Polyhedron/GlSplat/CMakeLists.txt b/3rdparty/CGAL/demo/Polyhedron/GlSplat/CMakeLists.txt
new file mode 100644
index 0000000..152bfd4
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/GlSplat/CMakeLists.txt
@@ -0,0 +1,36 @@
+
+project(GlSplat)
+
+cmake_minimum_required(VERSION 2.6.0)
+if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
+  cmake_policy(VERSION 2.8.4)
+else()
+  cmake_policy(VERSION 2.6)
+endif()
+set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
+
+find_package(Qt4 REQUIRED)
+find_package(OpenGL)
+
+set(QT_USE_QTOPENGL TRUE)
+set(QT_USE_QTXML TRUE)
+include(${QT_USE_FILE})
+include_directories( ${QT_QTOPENGL_INCLUDE_DIR} ${QT_QTXML_INCLUDE_DIR})
+
+set(srcs Shader.cpp GlSplat.cpp)
+
+qt4_automoc( ${srcs})
+qt4_add_resources(srcs glsplat.qrc)
+
+add_library(GlSplat SHARED ${srcs})
+target_link_libraries(GlSplat ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY} ${OPENGL_gl_LIBRARY})
+
+find_package(QGLViewer)
+if(QGLVIEWER_FOUND AND OPENGL_FOUND)
+  include_directories( ${QGLViewer_INCLUDES})
+  add_executable(demo demo.cpp)
+  target_link_libraries(demo ${QT_QTXML_LIBRARY} ${QGLViewer_LIBRARIES} ${OPENGL_gl_LIBRARY} GlSplat)
+else()
+  message("QGLViewer or OpenGL not found, demo won't be built")
+endif()
+include( polyhedron_demo_macros )
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/GlSplat/GlSplat.cpp b/3rdparty/CGAL/demo/Polyhedron/GlSplat/GlSplat.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/GlSplat/GlSplat.cpp
rename to 3rdparty/CGAL/demo/Polyhedron/GlSplat/GlSplat.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/GlSplat/GlSplat.h b/3rdparty/CGAL/demo/Polyhedron/GlSplat/GlSplat.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/GlSplat/GlSplat.h
rename to 3rdparty/CGAL/demo/Polyhedron/GlSplat/GlSplat.h
diff --git a/3rdparty/CGAL/demo/Polyhedron/GlSplat/GlSplat_config.h b/3rdparty/CGAL/demo/Polyhedron/GlSplat/GlSplat_config.h
new file mode 100644
index 0000000..4c4457c
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/GlSplat/GlSplat_config.h
@@ -0,0 +1,12 @@
+#ifndef GLSPLAT_CONFIG_H
+#define GLSPLAT_CONFIG_H
+
+#include <CGAL/export/helpers.h>
+
+#ifdef gl_splat_EXPORTS
+  #define GLSPLAT_EXPORT Q_DECL_EXPORT
+#else
+  #define GLSPLAT_EXPORT Q_DECL_IMPORT
+#endif
+
+#endif // GLSPLAT_CONFIG_H
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/GlSplat/Shader.cpp b/3rdparty/CGAL/demo/Polyhedron/GlSplat/Shader.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/GlSplat/Shader.cpp
rename to 3rdparty/CGAL/demo/Polyhedron/GlSplat/Shader.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/GlSplat/Shader.h b/3rdparty/CGAL/demo/Polyhedron/GlSplat/Shader.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/GlSplat/Shader.h
rename to 3rdparty/CGAL/demo/Polyhedron/GlSplat/Shader.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/GlSplat/cmake/FindQGLViewer.cmake b/3rdparty/CGAL/demo/Polyhedron/GlSplat/cmake/FindQGLViewer.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/GlSplat/cmake/FindQGLViewer.cmake
rename to 3rdparty/CGAL/demo/Polyhedron/GlSplat/cmake/FindQGLViewer.cmake
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/GlSplat/demo.cpp b/3rdparty/CGAL/demo/Polyhedron/GlSplat/demo.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/GlSplat/demo.cpp
rename to 3rdparty/CGAL/demo/Polyhedron/GlSplat/demo.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/GlSplat/glsplat.qrc b/3rdparty/CGAL/demo/Polyhedron/GlSplat/glsplat.qrc
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/GlSplat/glsplat.qrc
rename to 3rdparty/CGAL/demo/Polyhedron/GlSplat/glsplat.qrc
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/GlSplat/shaders/Finalization.glsl b/3rdparty/CGAL/demo/Polyhedron/GlSplat/shaders/Finalization.glsl
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/GlSplat/shaders/Finalization.glsl
rename to 3rdparty/CGAL/demo/Polyhedron/GlSplat/shaders/Finalization.glsl
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/GlSplat/shaders/Raycasting.glsl b/3rdparty/CGAL/demo/Polyhedron/GlSplat/shaders/Raycasting.glsl
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/GlSplat/shaders/Raycasting.glsl
rename to 3rdparty/CGAL/demo/Polyhedron/GlSplat/shaders/Raycasting.glsl
diff --git a/3rdparty/CGAL/demo/Polyhedron/ImageInterface.ui b/3rdparty/CGAL/demo/Polyhedron/ImageInterface.ui
new file mode 100644
index 0000000..79b16b5
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/ImageInterface.ui
@@ -0,0 +1,358 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ImageInterface</class>
+ <widget class="QDialog" name="ImageInterface">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>484</width>
+    <height>447</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Image Settings</string>
+  </property>
+  <layout class="QVBoxLayout">
+   <property name="spacing">
+    <number>6</number>
+   </property>
+   <property name="leftMargin">
+    <number>9</number>
+   </property>
+   <property name="topMargin">
+    <number>9</number>
+   </property>
+   <property name="rightMargin">
+    <number>9</number>
+   </property>
+   <property name="bottomMargin">
+    <number>9</number>
+   </property>
+   <item>
+    <layout class="QGridLayout" name="gridLayout">
+     <property name="leftMargin">
+      <number>0</number>
+     </property>
+     <property name="topMargin">
+      <number>0</number>
+     </property>
+     <property name="rightMargin">
+      <number>0</number>
+     </property>
+     <property name="bottomMargin">
+      <number>0</number>
+     </property>
+     <item row="0" column="4">
+      <widget class="QSpinBox" name="imgHeight">
+       <property name="toolTip">
+        <string>Height of the image (in pixels)</string>
+       </property>
+       <property name="suffix">
+        <string> px</string>
+       </property>
+       <property name="minimum">
+        <number>1</number>
+       </property>
+       <property name="maximum">
+        <number>32000</number>
+       </property>
+      </widget>
+     </item>
+     <item row="0" column="1">
+      <widget class="QSpinBox" name="imgWidth">
+       <property name="toolTip">
+        <string>Width of the image (in pixels)</string>
+       </property>
+       <property name="suffix">
+        <string> px</string>
+       </property>
+       <property name="minimum">
+        <number>1</number>
+       </property>
+       <property name="maximum">
+        <number>32000</number>
+       </property>
+      </widget>
+     </item>
+     <item row="0" column="0">
+      <widget class="QLabel" name="label_2">
+       <property name="text">
+        <string>Width</string>
+       </property>
+      </widget>
+     </item>
+     <item row="0" column="2">
+      <spacer>
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>20</width>
+         <height>22</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item row="0" column="3">
+      <widget class="QLabel" name="label_3">
+       <property name="text">
+        <string>Height</string>
+       </property>
+      </widget>
+     </item>
+     <item row="1" column="4">
+      <widget class="QCheckBox" name="ratioCheckBox">
+       <property name="text">
+        <string>Keep Ratio</string>
+       </property>
+       <property name="checked">
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <layout class="QHBoxLayout">
+     <property name="spacing">
+      <number>6</number>
+     </property>
+     <property name="leftMargin">
+      <number>0</number>
+     </property>
+     <property name="topMargin">
+      <number>0</number>
+     </property>
+     <property name="rightMargin">
+      <number>0</number>
+     </property>
+     <property name="bottomMargin">
+      <number>0</number>
+     </property>
+     <item>
+      <widget class="QLabel" name="label_4">
+       <property name="text">
+        <string>Image Quality</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QSpinBox" name="imgQuality">
+       <property name="toolTip">
+        <string>Between 0 (smallest files) and 100 (highest quality)</string>
+       </property>
+       <property name="minimum">
+        <number>0</number>
+       </property>
+       <property name="maximum">
+        <number>100</number>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer>
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <layout class="QHBoxLayout">
+     <property name="spacing">
+      <number>6</number>
+     </property>
+     <property name="leftMargin">
+      <number>0</number>
+     </property>
+     <property name="topMargin">
+      <number>0</number>
+     </property>
+     <property name="rightMargin">
+      <number>0</number>
+     </property>
+     <property name="bottomMargin">
+      <number>0</number>
+     </property>
+     <item>
+      <widget class="QLabel" name="label">
+       <property name="text">
+        <string>Oversampling</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QDoubleSpinBox" name="oversampling">
+       <property name="toolTip">
+        <string>Antialiases image (when larger then 1.0)</string>
+       </property>
+       <property name="prefix">
+        <string>x </string>
+       </property>
+       <property name="decimals">
+        <number>1</number>
+       </property>
+       <property name="minimum">
+        <double>0.100000000000000</double>
+       </property>
+       <property name="maximum">
+        <double>64.000000000000000</double>
+       </property>
+       <property name="singleStep">
+        <double>1.000000000000000</double>
+       </property>
+       <property name="value">
+        <double>1.000000000000000</double>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer>
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <widget class="QComboBox" name="color_comboBox">
+     <item>
+      <property name="text">
+       <string>Use current background color</string>
+      </property>
+     </item>
+     <item>
+      <property name="text">
+       <string>Use transparent background</string>
+      </property>
+     </item>
+     <item>
+      <property name="text">
+       <string>Choose background color</string>
+      </property>
+     </item>
+    </widget>
+   </item>
+   <item>
+    <widget class="QCheckBox" name="expandFrustum">
+     <property name="toolTip">
+      <string>When image aspect ratio differs from viewer's one, expand frustum as needed. Fits inside current frustum otherwise.</string>
+     </property>
+     <property name="text">
+      <string>Expand Frustum if Needed</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <spacer>
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>16</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item>
+    <layout class="QHBoxLayout">
+     <property name="spacing">
+      <number>6</number>
+     </property>
+     <property name="leftMargin">
+      <number>0</number>
+     </property>
+     <property name="topMargin">
+      <number>0</number>
+     </property>
+     <property name="rightMargin">
+      <number>0</number>
+     </property>
+     <property name="bottomMargin">
+      <number>0</number>
+     </property>
+     <item>
+      <spacer>
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>131</width>
+         <height>31</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QPushButton" name="okButton">
+       <property name="text">
+        <string>OK</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="cancelButton">
+       <property name="text">
+        <string>Cancel</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>okButton</sender>
+   <signal>clicked()</signal>
+   <receiver>ImageInterface</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>135</x>
+     <y>184</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>96</x>
+     <y>254</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>cancelButton</sender>
+   <signal>clicked()</signal>
+   <receiver>ImageInterface</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>226</x>
+     <y>184</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>179</x>
+     <y>282</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Image_type.h b/3rdparty/CGAL/demo/Polyhedron/Image_type.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Image_type.h
rename to 3rdparty/CGAL/demo/Polyhedron/Image_type.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Image_type_fwd.h b/3rdparty/CGAL/demo/Polyhedron/Image_type_fwd.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Image_type_fwd.h
rename to 3rdparty/CGAL/demo/Polyhedron/Image_type_fwd.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Kernel_type.h b/3rdparty/CGAL/demo/Polyhedron/Kernel_type.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Kernel_type.h
rename to 3rdparty/CGAL/demo/Polyhedron/Kernel_type.h
diff --git a/3rdparty/CGAL/demo/Polyhedron/MainWindow.cpp b/3rdparty/CGAL/demo/Polyhedron/MainWindow.cpp
new file mode 100644
index 0000000..b55b4f3
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/MainWindow.cpp
@@ -0,0 +1,1866 @@
+#include "config.h"
+#include "MainWindow.h"
+#include "Scene.h"
+#include <CGAL/Three/Scene_item.h>
+#include <CGAL/Three/TextRenderer.h>
+#include <CGAL/Qt/debug.h>
+
+#include <QtDebug>
+#include <QFileDialog>
+#include <QFileInfo>
+#include <QSettings>
+#include <QHeaderView>
+#include <QMenu>
+#include <QMenuBar>
+#include <QChar>
+#include <QAction>
+#include <QShortcut>
+#include <QKeySequence>
+#include <QLibrary>
+#include <QPluginLoader>
+#include <QMessageBox>
+#include <QScrollBar>
+#include <QColor>
+#include <QColorDialog>
+#include <QClipboard>
+#include <QCloseEvent>
+#include <QInputDialog>
+#include <QTreeView>
+#include <QSortFilterProxyModel>
+#include <QMap>
+#include <QStandardItemModel>
+#include <QStandardItem>
+#include <stdexcept>
+#ifdef QT_SCRIPT_LIB
+#  include <QScriptValue>
+#  ifdef QT_SCRIPTTOOLS_LIB
+#    include <QScriptEngineDebugger>
+#  endif
+#endif
+
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+#include <CGAL/Three/Polyhedron_demo_io_plugin_interface.h>
+
+#include "ui_MainWindow.h"
+#include "ui_Preferences.h"
+#include "ui_Statistics_on_item_dialog.h"
+#include "Show_point_dialog.h"
+#include "File_loader_dialog.h"
+
+#include <QGLViewer/manipulatedCameraFrame.h>
+#include <QGLViewer/manipulatedFrame.h>
+
+#ifdef QT_SCRIPT_LIB
+#  include <QScriptEngine>
+#  include <QScriptValue>
+using namespace CGAL::Three;
+QScriptValue 
+myScene_itemToScriptValue(QScriptEngine *engine, 
+                          CGAL::Three::Scene_item* const &in)
+{ 
+  return engine->newQObject(in); 
+}
+
+void myScene_itemFromScriptValue(const QScriptValue &object, 
+                                 CGAL::Three::Scene_item* &out)
+{
+  out = qobject_cast<CGAL::Three::Scene_item*>(object.toQObject());
+}
+#endif // QT_SCRIPT_LIB
+
+#ifdef QT_SCRIPT_LIB
+#  ifdef QT_SCRIPTTOOLS_LIB
+
+const QScriptEngineDebugger::DebuggerWidget debug_widgets[9] = {
+  QScriptEngineDebugger::ConsoleWidget,
+  QScriptEngineDebugger::StackWidget,
+  QScriptEngineDebugger::ScriptsWidget,
+  QScriptEngineDebugger::LocalsWidget,
+  QScriptEngineDebugger::CodeWidget,
+  QScriptEngineDebugger::CodeFinderWidget,
+  QScriptEngineDebugger::BreakpointsWidget,
+  QScriptEngineDebugger::DebugOutputWidget,
+  QScriptEngineDebugger::ErrorLogWidget
+};
+const QString debug_widgets_names[9] = {
+  "Script console",
+  "Stack",
+  "Scripts",
+  "Locals",
+  "Code",
+  "CodeFinder",
+  "Breakpoints",
+  "DebugOutput",
+  "ErrorLog"
+};
+
+#  endif
+#endif
+
+QScriptValue myPrintFunction(QScriptContext *context, QScriptEngine *engine)
+{
+  MainWindow* mw = qobject_cast<MainWindow*>(engine->parent());
+  QString result;
+  for (int i = 0; i < context->argumentCount(); ++i) {
+    if (i > 0)
+      result.append(" ");
+    result.append(context->argument(i).toString());
+  }
+
+  if(mw) mw->message(QString("QtScript: ") + result, "");
+
+  return engine->undefinedValue();
+}
+
+MainWindow::~MainWindow()
+{
+  delete ui;
+  delete statistics_ui;
+}
+MainWindow::MainWindow(QWidget* parent)
+  : CGAL::Qt::DemosMainWindow(parent)
+{
+  ui = new Ui::MainWindow;
+  ui->setupUi(this);
+  menu_map[ui->menuOperations->title()] = ui->menuOperations;
+  // remove the Load Script menu entry, when the demo has not been compiled with QT_SCRIPT_LIB
+#if !defined(QT_SCRIPT_LIB)
+  ui->menuBar->removeAction(ui->actionLoadScript);
+#endif
+  // Save some pointers from ui, for latter use.
+  sceneView = ui->sceneView;
+  viewer = ui->viewer;
+  // do not save the state of the viewer (anoying)
+  viewer->setStateFileName(QString::null);
+
+  // setup scene
+  scene = new Scene(this);
+  viewer->textRenderer->setScene(scene);
+  viewer->setScene(scene);
+  ui->actionMaxTextItemsDisplayed->setText(QString("Set Maximum Text Items Displayed : %1").arg(viewer->textRenderer->getMax_textItems()));
+  {
+    QShortcut* shortcut = new QShortcut(QKeySequence(Qt::ALT+Qt::Key_Q), this);
+    connect(shortcut, SIGNAL(activated()),
+            this, SLOT(setFocusToQuickSearch()));
+  }
+
+  proxyModel = new QSortFilterProxyModel(this);
+  proxyModel->setSourceModel(scene);
+  SceneDelegate *delegate = new SceneDelegate(this);
+  delegate->setProxy(proxyModel);
+  delegate->setScene(scene);
+
+
+  connect(ui->searchEdit, SIGNAL(textChanged(QString)),
+          proxyModel, SLOT(setFilterFixedString(QString)));
+  sceneView->setModel(proxyModel);
+
+  // setup the sceneview: delegation and columns sizing...
+  sceneView->setItemDelegate(delegate);
+
+ //sceneView->header()->setStretchLastSection(false);
+  /* sceneView->header()->setSectionResizeMode(Scene::NameColumn, QHeaderView::Stretch);
+   sceneView->header()->setSectionResizeMode(Scene::NameColumn, QHeaderView::Stretch);
+  sceneView->header()->setSectionResizeMode(Scene::ColorColumn, QHeaderView::ResizeToContents);
+  sceneView->header()->setSectionResizeMode(Scene::RenderingModeColumn, QHeaderView::Fixed);
+  sceneView->header()->setSectionResizeMode(Scene::ABColumn, QHeaderView::Fixed);
+  sceneView->header()->setSectionResizeMode(Scene::VisibleColumn, QHeaderView::Fixed);
+  sceneView->resizeColumnToContents(Scene::ColorColumn);
+  sceneView->resizeColumnToContents(Scene::RenderingModeColumn);
+  sceneView->resizeColumnToContents(Scene::ABColumn);
+  sceneView->resizeColumnToContents(Scene::VisibleColumn);
+*/
+  // setup connections
+  connect(scene, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex & )),
+          this, SLOT(updateInfo()));
+  
+  connect(scene, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex & )),
+          this, SLOT(updateDisplayInfo()));
+
+  connect(scene, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex & )),
+          viewer, SLOT(update()));
+
+  connect(scene, SIGNAL(updated()),
+          viewer, SLOT(update()));
+
+  connect(scene, SIGNAL(updated()),
+          this, SLOT(selectionChanged()));
+
+  connect(scene, SIGNAL(itemAboutToBeDestroyed(CGAL::Three::Scene_item*)),
+          this, SLOT(removeManipulatedFrame(CGAL::Three::Scene_item*)));
+
+  connect(scene, SIGNAL(updated_bbox()),
+          this, SLOT(updateViewerBBox()));
+
+  connect(scene, SIGNAL(selectionChanged(int)),
+          this, SLOT(selectSceneItem(int)));
+
+  connect(scene, SIGNAL(itemPicked(const QModelIndex &)),
+          this, SLOT(recenterSceneView(const QModelIndex &)));
+
+  connect(sceneView->selectionModel(), 
+          SIGNAL(selectionChanged ( const QItemSelection & , const QItemSelection & ) ),
+          this, SLOT(updateInfo()));
+
+  connect(sceneView->selectionModel(), 
+          SIGNAL(selectionChanged ( const QItemSelection & , const QItemSelection & ) ),
+          this, SLOT(updateDisplayInfo()));
+
+  connect(sceneView->selectionModel(), 
+          SIGNAL(selectionChanged ( const QItemSelection & , const QItemSelection & ) ),
+          this, SLOT(selectionChanged()));
+
+  sceneView->setContextMenuPolicy(Qt::CustomContextMenu);
+  connect(sceneView, SIGNAL(customContextMenuRequested(const QPoint & )),
+          this, SLOT(showSceneContextMenu(const QPoint &)));
+
+  connect(sceneView, SIGNAL(expanded(QModelIndex)),
+          this, SLOT(setExpanded(QModelIndex)));
+
+  connect(sceneView, SIGNAL(collapsed(QModelIndex)),
+          this, SLOT(setCollapsed(QModelIndex)));
+  connect(this, SIGNAL(collapsed(QModelIndex)),
+          scene, SLOT(setCollapsed(QModelIndex)));
+  connect(this, SIGNAL(expanded(QModelIndex)),
+          scene, SLOT(setExpanded(QModelIndex)));
+
+  connect(scene, SIGNAL(restoreCollapsedState()),
+          this, SLOT(restoreCollapseState()));
+
+  connect(viewer, SIGNAL(selected(int)),
+          this, SLOT(selectSceneItem(int)));
+  connect(viewer, SIGNAL(selectedPoint(double, double, double)),
+          this, SLOT(showSelectedPoint(double, double, double)));
+
+  connect(viewer, SIGNAL(selectionRay(double, double, double, 
+                                      double, double, double)),
+          scene, SIGNAL(selectionRay(double, double, double,
+                                     double, double, double)));
+
+  connect(viewer, SIGNAL(requestContextMenu(QPoint)),
+          this, SLOT(contextMenuRequested(QPoint)));
+  connect(viewer, SIGNAL(sendMessage(QString)),
+          this, SLOT(information(QString)));
+
+  // The contextMenuPolicy of infoLabel is now the default one, so that one
+  // can easily copy-paste its text.
+  // connect(ui->infoLabel, SIGNAL(customContextMenuRequested(const QPoint & )),
+  //         this, SLOT(showSceneContextMenu(const QPoint &)));
+
+  connect(ui->actionRecenterScene, SIGNAL(triggered()),
+          viewer, SLOT(update()));
+
+  connect(ui->actionAntiAliasing, SIGNAL(toggled(bool)),
+          viewer, SLOT(setAntiAliasing(bool)));
+
+  connect(ui->actionDrawTwoSides, SIGNAL(toggled(bool)),
+          viewer, SLOT(setTwoSides(bool)));
+  connect(ui->actionQuickCameraMode, SIGNAL(toggled(bool)),
+          viewer, SLOT(setFastDrawing(bool)));
+
+  // add the "About CGAL..." and "About demo..." entries
+  this->addAboutCGAL();
+  this->addAboutDemo(":/cgal/Polyhedron_3/about.html");
+
+  // Connect the button "addButton" with actionLoad
+  ui->addButton->setDefaultAction(ui->actionLoad);
+  // Same with "removeButton" and "duplicateButton"
+  ui->removeButton->setDefaultAction(ui->actionErase);
+  ui->duplicateButton->setDefaultAction(ui->actionDuplicate);
+
+  // Connect actionQuit (Ctrl+Q) and qApp->quit()
+  connect(ui->actionQuit, SIGNAL(triggered()),
+          this, SLOT(quit()));
+  // Connect "Select all items"
+  connect(ui->actionSelectAllItems, SIGNAL(triggered()),
+          this, SLOT(selectAll()));
+
+  // Recent files menu
+  this->addRecentFiles(ui->menuFile, ui->actionQuit);
+  connect(this, SIGNAL(openRecentFile(QString)),
+	  this, SLOT(open(QString)));
+
+  // Reset the "Operation menu"
+  clearMenu(ui->menuOperations);
+
+#ifdef QT_SCRIPT_LIB
+  std::cerr << "Enable scripts.\n";
+  script_engine = new QScriptEngine(this);
+  qScriptRegisterMetaType<CGAL::Three::Scene_item*>(script_engine,
+                                       myScene_itemToScriptValue,
+                                       myScene_itemFromScriptValue);
+#  ifdef QT_SCRIPTTOOLS_LIB
+  QScriptEngineDebugger* debugger = new QScriptEngineDebugger(this);
+  debugger->setObjectName("qt script debugger");
+  QAction* debuggerMenuAction = 
+    menuBar()->addMenu(debugger->createStandardMenu());
+  debuggerMenuAction->setText(tr("Qt Script &Debug"));
+  for(unsigned int i = 0; i < 9; ++i)
+  {
+    QDockWidget* dock = new QDockWidget(debug_widgets_names[i], this);
+    dock->setObjectName(debug_widgets_names[i]);
+    dock->setWidget(debugger->widget(debug_widgets[i]));
+    this->addDockWidget(Qt::BottomDockWidgetArea, dock);
+    dock->hide();
+  }
+  debugger->setAutoShowStandardWindow(false);
+  debugger->attachTo(script_engine);
+#  endif // QT_SCRIPTTOOLS_LIB
+  QScriptValue fun = script_engine->newFunction(myPrintFunction);
+  script_engine->globalObject().setProperty("print", fun);
+  
+  //  evaluate_script("print('hello', 'world', 'from QtScript!')");
+  QScriptValue mainWindowObjectValue = script_engine->newQObject(this);
+  script_engine->globalObject().setProperty("main_window", mainWindowObjectValue);
+
+  QScriptValue sceneObjectValue = script_engine->newQObject(scene);
+  mainWindowObjectValue.setProperty("scene", sceneObjectValue);
+  script_engine->globalObject().setProperty("scene", sceneObjectValue);
+
+  QScriptValue viewerObjectValue = script_engine->newQObject(viewer);
+  mainWindowObjectValue.setProperty("viewer", viewerObjectValue);
+  script_engine->globalObject().setProperty("viewer", viewerObjectValue);
+
+  QScriptValue cameraObjectValue = script_engine->newQObject(viewer->camera());
+  viewerObjectValue.setProperty("camera", cameraObjectValue);
+  script_engine->globalObject().setProperty("camera", cameraObjectValue);
+
+  evaluate_script("var plugins = new Array();");
+#  ifdef QT_SCRIPTTOOLS_LIB
+  QScriptValue debuggerObjectValue = script_engine->newQObject(debugger);
+  script_engine->globalObject().setProperty("debugger", debuggerObjectValue);
+#  endif
+#endif
+
+  readSettings(); // Among other things, the column widths are stored.
+
+  // Load plugins, and re-enable actions that need it.
+  loadPlugins();
+
+  // Setup the submenu of the View menu that can toggle the dockwidgets
+  Q_FOREACH(QDockWidget* widget, findChildren<QDockWidget*>()) {
+    ui->menuDockWindows->addAction(widget->toggleViewAction());
+  }
+  ui->menuDockWindows->removeAction(ui->dummyAction);
+
+
+  this->readState("MainWindow", Size|State);
+
+  //Manages the group_item creation
+  actionAddToGroup= new QAction("Add New Group", this);
+
+  if(actionAddToGroup) {
+    connect(actionAddToGroup, SIGNAL(triggered()),
+            this, SLOT(makeNewGroup()));
+  }
+
+  QMenu* menuFile = findChild<QMenu*>("menuFile");
+  if ( NULL != menuFile )
+  {
+    QList<QAction*> menuFileActions = menuFile->actions();
+
+    // Look for action just after "Load..." action
+    QAction* actionAfterLoad = NULL;
+    for ( QList<QAction*>::iterator it_action = menuFileActions.begin(),
+         end = menuFileActions.end() ; it_action != end ; ++ it_action ) //Q_FOREACH( QAction* action, menuFileActions)
+    {
+      if ( NULL != *it_action && (*it_action)->text().contains("Load") )
+      {
+        ++it_action;
+        if ( it_action != end && NULL != *it_action )
+        {
+          actionAfterLoad = *it_action;
+        }
+      }
+    }
+
+    // Insert "Load implicit function" action
+    if ( NULL != actionAfterLoad )
+    {
+      menuFile->insertAction(actionAfterLoad,actionAddToGroup);
+    }
+  }
+
+  statistics_dlg = NULL;
+  statistics_ui = new Ui::Statistics_on_item_dialog();
+
+#ifdef QT_SCRIPT_LIB
+  // evaluate_script("print(plugins);");
+  Q_FOREACH(QAction* action, findChildren<QAction*>()) {
+    if(action->objectName() != "") {
+      QScriptValue objectValue = script_engine->newQObject(action);
+      script_engine->globalObject().setProperty(action->objectName(),
+                                                objectValue);
+    }
+  }
+  // debugger->action(QScriptEngineDebugger::InterruptAction)->trigger();
+#endif
+
+  // setup menu filtering
+  connect(ui->menuOperations, SIGNAL(aboutToShow()), this, SLOT(filterOperations()));
+}
+
+//Recursive function that do a pass over a menu and its sub-menus(etc.) and hide them when they are empty
+void filterMenuOperations(QMenu* menu)
+{
+    Q_FOREACH(QAction* action, menu->actions()) {
+        if(QMenu* menu = action->menu())
+        {
+            filterMenuOperations(menu);
+            action->setVisible(!(menu->isEmpty()));
+        }
+    }
+
+}
+
+void MainWindow::filterOperations()
+{
+  Q_FOREACH(const PluginNamePair& p, plugins) {
+    Q_FOREACH(QAction* action, p.first->actions()) {
+        action->setVisible( p.first->applicable(action) );
+    }
+  }
+  // do a pass over all menus in Operations and their sub-menus(etc.) and hide them when they are empty
+  filterMenuOperations(ui->menuOperations);
+}
+#ifdef QT_SCRIPT_LIB
+void MainWindow::evaluate_script(QString script,
+                                 const QString& filename,
+                                 const bool quiet) {
+  QScriptValue value = script_engine->evaluate(script, filename);
+  if(script_engine->hasUncaughtException()) {
+    QTextStream err(stderr);
+    err << "Qt Script exception:\n"
+        << script_engine->uncaughtException().toString()
+        << "\nBacktrace:\n";
+    Q_FOREACH(QString line, script_engine->uncaughtExceptionBacktrace()) {
+      err << "  " << line << "\n";
+    }
+  }
+  else if(!quiet && !value.isNull() && !value.isUndefined()) {
+    QTextStream(stderr) << "Qt Script evaluated to \""
+                        << value.toString() << "\"\n";
+  }
+}
+
+void MainWindow::evaluate_script_quiet(QString script,
+                                       const QString& filename)
+{
+  evaluate_script(script, filename, true);
+}
+#endif
+
+void MainWindow::enableScriptDebugger(bool b /* = true */)
+{
+  Q_UNUSED(b);
+#ifdef QT_SCRIPT_LIB
+#  ifdef QT_SCRIPTTOOLS_LIB
+  QScriptEngineDebugger* debugger =
+    findChild<QScriptEngineDebugger*>("qt script debugger");
+  if(debugger) {
+    if(b) {
+      debugger->action(QScriptEngineDebugger::InterruptAction)->trigger();
+    }
+  }
+  return;
+#  endif
+#endif
+  // If we are here, then the debugger is not available
+  this->error(tr("Your version of Qt is too old, and for that reason "
+                 "the Qt Script Debugger is not available."));
+}
+
+namespace {
+bool actionsByName(QAction* x, QAction* y) {
+  return x->text() < y->text();
+}
+}
+
+//Recursively creates all subMenus containing an action.
+void MainWindow::setMenus(QString name, QString parentName, QAction* a )
+{
+  bool hasSub = false;
+  QString menuName, subMenuName;
+  if (name.isNull())
+    return;
+  //Get the menu and submenu names
+  for(int i=0; i<name.size(); i++)
+  {
+    if(name.at(i)=='/')
+    {
+      hasSub = true;
+      break;
+    }
+  }
+
+  if(!hasSub)
+    menuName= name;
+  else
+  {
+    int i;
+    for(i = 0; name.at(i)!='/'; i++)
+      menuName.append(name.at(i));
+    i++;
+    for(int j = i; j<name.size(); j++)
+      subMenuName.append(name.at(j));
+    setMenus(subMenuName, name, a);
+  }
+
+  //Create the menu and sub menu
+  QMenu* menu = 0;
+  QMenu* parentMenu = 0;
+  //If the menu already exists, don't create a new one.
+  if(menu_map.contains(name))
+  {
+    menu = menu_map[name];
+  }
+
+  bool hasAction = false;
+  if(menu == 0){
+    menu = new QMenu(menuName, this);
+    menu_map[name] = menu;
+  }
+  else //checks the action is not already in the menu
+    if(a->property("added").toBool())
+      hasAction = true;
+  if(!hasAction)
+  {
+    ui->menuOperations->removeAction(a);
+    menu->addAction(a);
+  }
+  a->setProperty("added", true);
+  //If the parent menu already exists, don't create a new one.
+  if(menu_map.contains(parentName))
+  {
+    parentMenu = menu_map[parentName];
+  }
+  if(parentMenu == 0)
+  {//get the parentMenu title :
+    QString parentTitle;
+    for(int i=0; parentName.at(i)!='/'; i++)
+      parentTitle.append(parentName.at(i));
+    parentMenu = new QMenu(parentTitle, this);
+    menu_map[parentName] = parentMenu;
+  }
+  parentMenu->addMenu(menu);
+}
+
+void MainWindow::load_plugin(QString fileName, bool blacklisted)
+{
+    if(fileName.contains("plugin") && QLibrary::isLibrary(fileName)) {
+      //set plugin name
+      QFileInfo fileinfo(fileName);
+      //set plugin name
+      QString name = fileinfo.fileName();
+      name.remove(QRegExp("^lib"));
+      name.remove(QRegExp("\\..*"));
+      //do not load it if it is in the blacklist
+      if(blacklisted)
+      {
+        if ( plugin_blacklist.contains(name) ){
+          qDebug("### Ignoring plugin \"%s\".", qPrintable(fileName));
+          return;
+        }
+      }
+      QDebug qdebug = qDebug();
+      qdebug << "### Loading \"" << fileName.toUtf8().data() << "\"... ";
+      QPluginLoader loader;
+      loader.setFileName(fileinfo.absoluteFilePath());
+      QObject *obj = loader.instance();
+      if(obj) {
+        obj->setObjectName(name);
+        bool init1 = initPlugin(obj);
+        bool init2 = initIOPlugin(obj);
+        if (!init1 && !init2)
+          qdebug << "not for this program";
+        else
+          qdebug << "success";
+      }
+      else {
+        qdebug << "error: " << qPrintable(loader.errorString());
+      }
+    }
+}
+
+void MainWindow::loadPlugins()
+{
+  Q_FOREACH(QObject *obj, QPluginLoader::staticInstances())
+  {
+    initPlugin(obj);
+    initIOPlugin(obj);
+  }
+  QList<QDir> plugins_directories;
+  QString dirPath = qApp->applicationDirPath();
+  plugins_directories<<dirPath;
+
+  QDir msvc_dir(dirPath);
+  QString build_dir_name = msvc_dir.dirName();//Debug or Release for msvc
+  msvc_dir.cdUp();
+
+  QFileInfoList filist = QDir(dirPath).entryInfoList();
+  filist << msvc_dir.entryInfoList();
+
+  Q_FOREACH(QFileInfo fileinfo, filist)
+  {
+      //checks if the path leads to a directory
+      if(fileinfo.baseName().contains("Plugins"))
+      {
+        QString plugins_dir = fileinfo.absolutePath();
+        plugins_dir.append("/").append(fileinfo.baseName());
+
+        Q_FOREACH(QString package_dir,
+                  QDir(plugins_dir).entryList(QDir::Dirs))
+        {
+          QString package_dir_path(plugins_dir);
+          package_dir_path.append("/").append(package_dir);
+
+          QString libdir_path(package_dir_path);
+          libdir_path.append("/").append(build_dir_name);
+
+          if (QDir(libdir_path).exists())
+            plugins_directories << QDir(libdir_path);
+          else
+            plugins_directories << QDir(package_dir_path);
+        }
+      }
+  }
+  QString env_path = qgetenv("POLYHEDRON_DEMO_PLUGINS_PATH");
+  if(!env_path.isEmpty()) {
+    Q_FOREACH (QString pluginsDir, 
+               env_path.split(":", QString::SkipEmptyParts)) {
+      QDir dir(pluginsDir);
+      if(dir.isReadable())
+        plugins_directories << dir;
+    }
+  }
+  Q_FOREACH (QDir pluginsDir, plugins_directories) {
+    qDebug("# Looking for plugins in directory \"%s\"...",
+           qPrintable(pluginsDir.absolutePath()));
+    Q_FOREACH(QString fileName, pluginsDir.entryList(QDir::Files))
+      load_plugin(pluginsDir.absoluteFilePath(fileName), true);
+  }
+  updateMenus();
+}
+  //Creates sub-Menus for operations.
+void MainWindow::updateMenus()
+{
+  QList<QAction*> as = ui->menuOperations->actions();
+  Q_FOREACH(QAction* a, as)
+  {
+    QString menuPath = a->property("subMenuName").toString();
+    setMenus(menuPath, ui->menuOperations->title(), a);
+  }
+  // sort the operations menu by name
+  as = ui->menuOperations->actions();
+  qSort(as.begin(), as.end(), actionsByName);
+  ui->menuOperations->clear();
+  ui->menuOperations->addActions(as);
+}
+bool MainWindow::hasPlugin(const QString& pluginName) const
+{
+  Q_FOREACH(const PluginNamePair& p, plugins) {
+    if(p.second == pluginName) return true;
+  }
+  return false;
+}
+
+bool MainWindow::initPlugin(QObject* obj)
+{
+  QObjectList childs = this->children();
+  CGAL::Three::Polyhedron_demo_plugin_interface* plugin =
+    qobject_cast<CGAL::Three::Polyhedron_demo_plugin_interface*>(obj);
+  if(plugin) {
+    // Call plugin's init() method
+    obj->setParent(this);
+    plugin->init(this, this->scene, this);
+    plugins << qMakePair(plugin, obj->objectName());
+#ifdef QT_SCRIPT_LIB
+    QScriptValue objectValue =
+      script_engine->newQObject(obj);
+    script_engine->globalObject().setProperty(obj->objectName(), objectValue);
+    evaluate_script_quiet(QString("plugins.push(%1);").arg(obj->objectName()));
+#endif
+
+    Q_FOREACH(QAction* action, plugin->actions()) {
+      // If action does not belong to the menus, add it to "Operations" menu
+      if(!childs.contains(action)) {
+        ui->menuOperations->addAction(action);
+      }
+      // Show and enable menu item
+      addAction(action);
+    }
+    return true;
+  }
+  else 
+    return false;
+}
+
+bool MainWindow::initIOPlugin(QObject* obj)
+{
+  CGAL::Three::Polyhedron_demo_io_plugin_interface* plugin =
+    qobject_cast<CGAL::Three::Polyhedron_demo_io_plugin_interface*>(obj);
+  if(plugin) {
+    io_plugins << plugin;
+    return true;
+  }
+  else 
+    return false;
+}
+
+void MainWindow::clearMenu(QMenu* menu)
+{
+  Q_FOREACH(QAction* action, menu->actions())
+  {
+    QMenu* menu = action->menu();
+    if(menu) {
+      clearMenu(menu);
+    }
+    action->setVisible(false);
+  }
+  menu->menuAction()->setEnabled(false);
+}
+
+void MainWindow::addAction(QAction* action)
+{
+  if(!action) return;
+
+  action->setVisible(true);
+  action->setEnabled(true);
+  Q_FOREACH(QWidget* widget, action->associatedWidgets())
+  {
+//     qDebug() << QString("%1 (%2)\n")
+//       .arg(widget->objectName())
+//       .arg(widget->metaObject()->className());
+    QMenu* menu = qobject_cast<QMenu*>(widget);
+    if(menu)
+    {
+      addAction(menu->menuAction());
+    }
+  }
+}
+
+void MainWindow::addAction(QString actionName,
+                           QString actionText,
+                           QString menuName) {
+  QMenu* menu = 0;
+  Q_FOREACH(QAction* action, findChildren<QAction*>()) {
+    if(!action->menu()) continue;
+    QString menuText = action->menu()->title();
+    if(menuText != menuName) continue;
+    menu = action->menu();
+  }
+  if(menu == 0) {
+    menu = new QMenu(menuName, this);
+    menuBar()->insertMenu(ui->menuView->menuAction(), menu);
+  }
+  QAction* action = new QAction(actionText, this);
+  action->setObjectName(actionName);
+  menu->addAction(action);
+#ifdef QT_SCRIPT_LIB
+  QScriptValue objectValue = script_engine->newQObject(action);
+  script_engine->globalObject().setProperty(action->objectName(),
+                                            objectValue);
+#endif
+}
+
+void MainWindow::viewerShow(float xmin,
+                            float ymin,
+                            float zmin,
+                            float xmax,
+                            float ymax,
+                            float zmax)
+{
+  qglviewer::Vec
+    min_(xmin, ymin, zmin),
+    max_(xmax, ymax, zmax);
+#if QGLVIEWER_VERSION >= 0x020502
+  viewer->camera()->setPivotPoint((min_+max_)*0.5);
+#else
+  viewer->camera()->setRevolveAroundPoint((min_+max_)*0.5);
+#endif
+
+  qglviewer::ManipulatedCameraFrame backup_frame(*viewer->camera()->frame());
+  viewer->camera()->fitBoundingBox(min_, max_);
+  qglviewer::ManipulatedCameraFrame new_frame(*viewer->camera()->frame());
+  *viewer->camera()->frame() = backup_frame;
+  viewer->camera()->interpolateTo(new_frame, 1.f);
+  viewer->setVisualHintsMask(1);
+}
+
+void MainWindow::viewerShow(float x, float y, float z) {
+  // viewer->camera()->lookAt(qglviewer::Vec(x, y, z));
+
+  qglviewer::ManipulatedCameraFrame backup_frame(*viewer->camera()->frame());
+  viewer->camera()->fitSphere(qglviewer::Vec(x, y, z),
+                              viewer->camera()->sceneRadius()/100);
+  qglviewer::ManipulatedCameraFrame new_frame(*viewer->camera()->frame());
+  *viewer->camera()->frame() = backup_frame;
+  viewer->camera()->interpolateTo(new_frame, 1.f);
+  viewer->setVisualHintsMask(1);
+
+#if QGLVIEWER_VERSION >= 0x020502
+  viewer->camera()->setPivotPoint(qglviewer::Vec(x, y, z));
+#else
+  viewer->camera()->setRevolveAroundPoint(qglviewer::Vec(x, y, z));
+#endif
+}
+
+void MainWindow::message(QString message, QString colorName, QString font) {
+  if (message.endsWith('\n')) {
+    message.remove(message.length()-1, 1);
+  }
+  statusBar()->showMessage(message, 5000);
+  message = "<font color=\"" + colorName + "\" style=\"font-style: " + font + ";\" >" +
+    message + "</font><br>";
+  message = "[" + QTime::currentTime().toString() + "] " + message;
+  ui->consoleTextEdit->insertHtml(message);
+  ui->consoleTextEdit->verticalScrollBar()->setValue(ui->consoleTextEdit->verticalScrollBar()->maximum());
+}
+
+void MainWindow::information(QString text) {
+  this->message("INFO: " + text, "");
+}
+
+void MainWindow::warning(QString text) {
+  this->message("WARNING: " + text, "blue");
+}
+
+void MainWindow::error(QString text) {
+  this->message("ERROR: " + text, "red");
+}
+
+void MainWindow::updateViewerBBox()
+{
+  const Scene::Bbox bbox = scene->bbox();
+  const double xmin = bbox.xmin();
+  const double ymin = bbox.ymin();
+  const double zmin = bbox.zmin();
+  const double xmax = bbox.xmax();
+  const double ymax = bbox.ymax();
+  const double zmax = bbox.zmax();
+   //qDebug() << QString("Bounding box: (%1, %2, %3) - (%4, %5, %6)\n")
+   //.arg(xmin).arg(ymin).arg(zmin).arg(xmax).arg(ymax).arg(zmax);
+  qglviewer::Vec 
+    vec_min(xmin, ymin, zmin),
+    vec_max(xmax, ymax, zmax);
+  viewer->setSceneBoundingBox(vec_min,
+                              vec_max);
+  viewer->camera()->showEntireScene();
+}
+
+void MainWindow::reloadItem() {
+  QAction* sender_action = qobject_cast<QAction*>(sender());
+  if(!sender_action) return;
+  
+  bool ok;
+  int item_index = sender_action->data().toInt(&ok);
+  QObject* item_object = scene->item(item_index);
+  if(!ok || !item_object || sender_action->data().type() != QVariant::Int) {
+    std::cerr << "Cannot reload item: "
+              << "the reload action has not item attached\n";
+    return;
+  }
+  CGAL::Three::Scene_item* item = qobject_cast<CGAL::Three::Scene_item*>(item_object);
+  if(!item) {
+    std::cerr << "Cannot reload item: "
+              << "the reload action has a QObject* pointer attached\n"
+              << "that is not a Scene_item*\n";
+    return;
+  }
+  QString filename = item->property("source filename").toString();
+  QString loader_name = item->property("loader_name").toString();
+  if(filename.isEmpty() || loader_name.isEmpty()) {
+    std::cerr << "Cannot reload item: "
+              << "the item has no \"source filename\" or no \"loader_name\" attached\n";
+    return;
+  }
+
+  CGAL::Three::Polyhedron_demo_io_plugin_interface* fileloader = findLoader(loader_name);
+  QFileInfo fileinfo(filename);
+
+  CGAL::Three::Scene_item* new_item = loadItem(fileinfo, fileloader);
+
+  new_item->setName(item->name());
+  new_item->setColor(item->color());
+  new_item->setRenderingMode(item->renderingMode());
+  new_item->setVisible(item->visible());
+  new_item->invalidateOpenGLBuffers();
+  scene->replaceItem(item_index, new_item, true);
+  item->deleteLater();
+}
+
+CGAL::Three::Polyhedron_demo_io_plugin_interface* MainWindow::findLoader(const QString& loader_name) const {
+  Q_FOREACH(CGAL::Three::Polyhedron_demo_io_plugin_interface* io_plugin,
+            io_plugins) {
+    if(io_plugin->name() == loader_name) {
+      return io_plugin;
+    }
+  }
+  throw std::invalid_argument(QString("No loader found with the name %1 available")
+                              .arg(loader_name).toStdString()) ;
+}
+
+bool MainWindow::file_matches_filter(const QString& filters,
+                                     const QString& filename )
+{
+  QFileInfo fileinfo(filename);
+  QString filename_striped=fileinfo.fileName();
+
+  //match all filters between ()
+  QRegExp all_filters_rx("\\((.*)\\)");
+
+  QStringList split_filters = filters.split(";;");
+  Q_FOREACH(const QString& filter, split_filters) {
+    //extract filters
+    if ( all_filters_rx.indexIn(filter)!=-1 ){
+      Q_FOREACH(const QString& pattern,all_filters_rx.cap(1).split(' ')){
+        QRegExp rx(pattern);
+        rx.setPatternSyntax(QRegExp::Wildcard);
+        if ( rx.exactMatch(filename_striped) ){
+          return true;
+        }
+      }
+    }
+  }
+  return false;
+}
+
+void MainWindow::open(QString filename)
+{
+  QFileInfo fileinfo(filename);
+
+#ifdef QT_SCRIPT_LIB
+  // Handles the loading of script file from the command line arguments,
+  // and the special command line arguments that start with "javascript:"
+  // or "qtscript:"
+  QString program;
+  if(filename.startsWith("javascript:")) {
+    program=filename.right(filename.size() - 11);
+  }
+  if(filename.startsWith("qtscript:")) {
+    program=filename.right(filename.size() - 9);
+  }
+  if(filename.endsWith(".js")) {
+    loadScript(fileinfo);
+    return;
+  }
+  if(!program.isEmpty())
+  {
+    {
+      QTextStream(stderr) << "Execution of script \"" 
+                          << filename << "\"\n";
+                          // << filename << "\", with following content:\n"
+                          // << program;
+    }
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    evaluate_script(program, filename);
+    QApplication::restoreOverrideCursor();
+    return;
+  }
+#endif
+
+  if ( !fileinfo.exists() ){
+    QMessageBox::warning(this,
+                         tr("Cannot open file"),
+                         tr("File %1 does not exist.")
+                         .arg(filename));
+    return;
+  }
+
+
+  QStringList selected_items;
+  QStringList all_items;
+
+  QMap<QString,QString>::iterator dfs_it = 
+    default_plugin_selection.find( fileinfo.completeSuffix() );
+  
+  if ( dfs_it==default_plugin_selection.end() )
+  {
+    // collect all io_plugins and offer them to load if the file extension match one name filter
+    // also collect all available plugin in case of a no extension match
+    Q_FOREACH(CGAL::Three::Polyhedron_demo_io_plugin_interface* io_plugin, io_plugins) {
+      if ( !io_plugin->canLoad() ) continue;
+      all_items << io_plugin->name();
+      if ( file_matches_filter(io_plugin->loadNameFilters(), filename) )
+        selected_items << io_plugin->name();
+    }
+  }
+  else
+    selected_items << *dfs_it;
+  
+  bool ok;
+  std::pair<QString, bool> load_pair;
+  
+  switch( selected_items.size() )
+  {
+    case 1:
+      load_pair = std::make_pair(selected_items.first(), false);
+      ok=true;
+      break;
+    case 0:
+      load_pair = File_loader_dialog::getItem(fileinfo.fileName(), all_items, &ok);
+      break;
+    default:
+      load_pair = File_loader_dialog::getItem(fileinfo.fileName(), selected_items, &ok);
+  }
+  viewer->context()->makeCurrent();
+  if(!ok || load_pair.first.isEmpty()) { return; }
+  
+  if (load_pair.second)
+     default_plugin_selection[fileinfo.completeSuffix()]=load_pair.first;
+  
+  
+  QSettings settings;
+  settings.setValue("OFF open directory",
+                    fileinfo.absoluteDir().absolutePath());
+  CGAL::Three::Scene_item* scene_item = loadItem(fileinfo, findLoader(load_pair.first));
+  if(scene_item != 0) {
+    this->addToRecentFiles(fileinfo.absoluteFilePath());
+  }
+  selectSceneItem(scene->addItem(scene_item));
+}
+
+bool MainWindow::open(QString filename, QString loader_name) {
+  QFileInfo fileinfo(filename); 
+  CGAL::Three::Scene_item* item;
+  try {
+    item = loadItem(fileinfo, findLoader(loader_name));
+  }
+  catch(std::logic_error e) {
+    std::cerr << e.what() << std::endl;
+    return false;
+  }
+  selectSceneItem(scene->addItem(item));
+  return true;
+}
+
+
+CGAL::Three::Scene_item* MainWindow::loadItem(QFileInfo fileinfo, CGAL::Three::Polyhedron_demo_io_plugin_interface* loader) {
+  CGAL::Three::Scene_item* item = NULL;
+  if(!fileinfo.isFile() || !fileinfo.isReadable()) {
+    throw std::invalid_argument(QString("File %1 is not a readable file.")
+                                .arg(fileinfo.absoluteFilePath()).toStdString());
+  }
+
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  item = loader->load(fileinfo);
+  QApplication::restoreOverrideCursor();
+  if(!item) {
+    throw std::logic_error(QString("Could not load item from file %1 using plugin %2")
+                           .arg(fileinfo.absoluteFilePath()).arg(loader->name()).toStdString());
+  }
+
+  item->setProperty("source filename", fileinfo.absoluteFilePath());
+  item->setProperty("loader_name", loader->name());
+  return item;
+}
+
+
+void MainWindow::setFocusToQuickSearch()
+{
+  ui->searchEdit->setFocus(Qt::ShortcutFocusReason);
+}
+
+void MainWindow::selectSceneItem(int i)
+{
+  if(i < 0 || i >= scene->numberOfEntries()) {
+    sceneView->selectionModel()->clearSelection();
+    updateInfo();
+    updateDisplayInfo();
+  }
+  else {
+    QItemSelection s =
+      proxyModel->mapSelectionFromSource(scene->createSelection(i));
+
+    sceneView->selectionModel()->select(s,
+                                        QItemSelectionModel::ClearAndSelect);
+  }
+}
+
+
+void MainWindow::showSelectedPoint(double x, double y, double z)
+{
+  static double x_prev = 0;
+  static double y_prev = 0;
+  static double z_prev = 0;
+  double dist = std::sqrt((x-x_prev)*(x-x_prev) + (y-y_prev)*(y-y_prev) + (z-z_prev)*(z-z_prev)); 
+  information(QString("Selected point: (%1, %2, %3) distance to previous: %4").
+              arg(x, 0, 'g', 10).
+              arg(y, 0, 'g', 10).
+              arg(z, 0, 'g', 10).
+              arg(dist,0,'g',10));
+  x_prev = x;
+  y_prev = y;
+  z_prev = z;
+}
+
+void MainWindow::unSelectSceneItem(int i)
+{
+  removeSceneItemFromSelection(i);
+}
+
+void MainWindow::addSceneItemInSelection(int i)
+{
+  QItemSelection s =
+    proxyModel->mapSelectionFromSource(scene->createSelection(i));
+  sceneView->selectionModel()->select(s, QItemSelectionModel::Select);
+  scene->itemChanged(i);
+}
+
+void MainWindow::removeSceneItemFromSelection(int i)
+{
+  QItemSelection s =
+    proxyModel->mapSelectionFromSource(scene->createSelection(i));
+  sceneView->selectionModel()->select(s,
+                                      QItemSelectionModel::Deselect);
+  scene->itemChanged(i);
+}
+
+void MainWindow::selectAll()
+{
+  QItemSelection s =
+    proxyModel->mapSelectionFromSource(scene->createSelectionAll());
+  sceneView->selectionModel()->select(s, 
+                                      QItemSelectionModel::ClearAndSelect);
+}
+
+int MainWindow::getSelectedSceneItemIndex() const
+{
+  QModelIndexList selectedRows = sceneView->selectionModel()->selectedIndexes();
+  if(selectedRows.size() == 0)
+    return -1;
+  else {
+    QModelIndex i = proxyModel->mapToSource(selectedRows.first());
+    return scene->getIdFromModelIndex(i);
+  }
+}
+
+QList<int> MainWindow::getSelectedSceneItemIndices() const
+{
+  QModelIndexList selectedIndices = sceneView->selectionModel()->selectedIndexes();
+  QList<int> result;
+  Q_FOREACH(QModelIndex index, selectedIndices) {
+      int temp = scene->getIdFromModelIndex(proxyModel->mapToSource(index));
+      if(!result.contains(temp))
+          result<<temp;
+  }
+  return result;
+}
+
+void MainWindow::selectionChanged()
+{
+  scene->setSelectedItemIndex(getSelectedSceneItemIndex());
+  scene->setSelectedItemsList(getSelectedSceneItemIndices());
+  CGAL::Three::Scene_item* item = scene->item(getSelectedSceneItemIndex());
+  if(item != NULL && item->manipulatable()) {
+    viewer->setManipulatedFrame(item->manipulatedFrame());
+  } else {
+    viewer->setManipulatedFrame(0);
+  }
+  if(viewer->manipulatedFrame() == 0) {
+    Q_FOREACH(CGAL::Three::Scene_item* item, scene->entries()) {
+      if(item->manipulatable() && item->manipulatedFrame() != 0) {
+        if(viewer->manipulatedFrame() != 0) {
+          // there are at least two possible frames
+          viewer->setManipulatedFrame(0);
+          break;
+        } else {
+          viewer->setManipulatedFrame(item->manipulatedFrame());
+        }
+      }
+    }
+  }
+  if(viewer->manipulatedFrame() != 0) {
+    connect(viewer->manipulatedFrame(), SIGNAL(modified()),
+            this, SLOT(updateInfo()));
+  }
+  viewer->update();
+}
+
+void MainWindow::contextMenuRequested(const QPoint& global_pos) {
+  int index = scene->mainSelectionIndex();
+  showSceneContextMenu(index, global_pos);
+}
+
+void MainWindow::showSceneContextMenu(int selectedItemIndex,
+                                      const QPoint& global_pos)
+{
+  CGAL::Three::Scene_item* item = scene->item(selectedItemIndex);
+  if(!item) return;
+
+  const char* prop_name = "Menu modified by MainWindow.";
+
+  QMenu* menu = item->contextMenu();
+  if(menu) {
+    bool menuChanged = menu->property(prop_name).toBool();
+    if(!menuChanged) {
+      if(item->has_stats())
+      {
+        QAction* actionStatistics =
+            menu->addAction(tr("Statistics..."));
+        actionStatistics->setObjectName("actionStatisticsOnPolyhedron");
+        connect(actionStatistics, SIGNAL(triggered()),
+                this, SLOT(statisticsOnItem()));
+      }
+      menu->addSeparator();
+      if(!item->property("source filename").toString().isEmpty()) {
+        QAction* reload = menu->addAction(tr("&Reload Item from File"));
+        reload->setData(qVariantFromValue(selectedItemIndex));
+        connect(reload, SIGNAL(triggered()),
+                this, SLOT(reloadItem()));
+      }
+      QAction* saveas = menu->addAction(tr("&Save as..."));
+      saveas->setData(qVariantFromValue(selectedItemIndex));
+      connect(saveas,  SIGNAL(triggered()),
+              this, SLOT(on_actionSaveAs_triggered()));
+      QAction* showobject = menu->addAction(tr("&Zoom to this Object"));
+      showobject->setData(qVariantFromValue(selectedItemIndex));
+      connect(showobject, SIGNAL(triggered()),
+              this, SLOT(viewerShowObject()));
+
+      menu->setProperty(prop_name, true);
+    }
+  }
+  menu->addMenu(ui->menuOperations);
+  if(menu)
+    menu->exec(global_pos);
+}
+
+void MainWindow::showSceneContextMenu(const QPoint& p) {
+  QWidget* sender = qobject_cast<QWidget*>(this->sender());
+  if(!sender) return;
+
+  int index = -1;
+  if(sender == sceneView) {
+      QModelIndex modelIndex = sceneView->indexAt(p);
+      if(!modelIndex.isValid())
+      {
+          const char* prop_name = "Menu modified by MainWindow.";
+
+          QMenu* menu = ui->menuFile;
+          if(menu) {
+              bool menuChanged = menu->property(prop_name).toBool();
+              if(!menuChanged) {
+                  menu->setProperty(prop_name, true);
+              }
+          }
+          if(menu)
+              menu->exec(sender->mapToGlobal(p));
+          return;
+      }
+      else
+      {
+          index = scene->getIdFromModelIndex(proxyModel->mapToSource(modelIndex));
+          scene->setSelectedItemIndex(index);
+      }
+  }
+  else {
+    index = scene->mainSelectionIndex();
+  }
+
+  showSceneContextMenu(index, sender->mapToGlobal(p));
+}
+
+void MainWindow::removeManipulatedFrame(CGAL::Three::Scene_item* item)
+{
+  if(item->manipulatable() &&
+     item->manipulatedFrame() == viewer->manipulatedFrame()) {
+    viewer->setManipulatedFrame(0);
+  }
+}
+
+void MainWindow::updateInfo() {
+  CGAL::Three::Scene_item* item = scene->item(getSelectedSceneItemIndex());
+  if(item) {
+    QString item_text = item->toolTip();
+    QString item_filename = item->property("source filename").toString();
+    if(item->bbox()!=CGAL::Bbox_3())
+      item_text += QString("<div>Bounding box: min (%1,%2,%3), max (%4,%5,%6)</div>")
+          .arg(item->bbox().xmin())
+          .arg(item->bbox().ymin())
+          .arg(item->bbox().zmin())
+          .arg(item->bbox().xmax())
+          .arg(item->bbox().ymax())
+          .arg(item->bbox().zmax());
+    if(!item_filename.isEmpty()) {
+      item_text += QString("<div>File:<i> %1</div>").arg(item_filename);
+    }
+    ui->infoLabel->setText(item_text);
+  }
+  else
+    ui->infoLabel->clear();
+}
+void MainWindow::updateDisplayInfo() {
+  CGAL::Three::Scene_item* item = scene->item(getSelectedSceneItemIndex());
+  if(item)
+    ui->displayLabel->setPixmap(item->graphicalToolTip());
+  else 
+    ui->displayLabel->clear();
+}
+
+void MainWindow::readSettings()
+{
+    QSettings settings;
+    // enable anti-aliasing 
+    ui->actionAntiAliasing->setChecked(settings.value("antialiasing", false).toBool());
+    // read plugin blacklist
+    QStringList blacklist=settings.value("plugin_blacklist",QStringList()).toStringList();
+    Q_FOREACH(QString name,blacklist){ plugin_blacklist.insert(name); }
+}
+
+void MainWindow::writeSettings()
+{
+  this->writeState("MainWindow");
+  {
+    QSettings settings;
+    settings.setValue("antialiasing", 
+                      ui->actionAntiAliasing->isChecked());
+    //setting plugin blacklist
+    QStringList blacklist;
+    Q_FOREACH(QString name,plugin_blacklist){ blacklist << name; }
+    if ( !blacklist.isEmpty() ) settings.setValue("plugin_blacklist",blacklist);
+    else settings.remove("plugin_blacklist");
+  }
+  std::cerr << "Write setting... done.\n";
+}
+
+void MainWindow::quit()
+{
+  close();
+}
+
+void MainWindow::closeEvent(QCloseEvent *event)
+{
+    for(int i=0; i<plugins.size(); i++)
+    {
+      plugins[i].first->closure();
+    }
+  writeSettings();
+  event->accept();
+}
+
+bool MainWindow::loadScript(QString filename)
+{
+  QFileInfo fileinfo(filename);
+  return loadScript(fileinfo);
+}
+
+bool MainWindow::loadScript(QFileInfo info)
+{
+#if defined(QT_SCRIPT_LIB)
+  QString program;
+  QString filename = info.absoluteFilePath();
+  QFile script_file(filename);
+  script_file.open(QIODevice::ReadOnly);
+  program = script_file.readAll();
+  if(!program.isEmpty())
+  {
+    QTextStream(stderr) 
+      << "Execution of script \"" 
+      << filename << "\"\n";
+    evaluate_script(program, filename);
+    return true;
+  }
+#endif
+  return false;
+}
+
+void MainWindow::on_actionLoadScript_triggered() 
+{
+#if defined(QT_SCRIPT_LIB)
+  QString filename = QFileDialog::getOpenFileName(
+    this,
+    tr("Select a script to run..."),
+    ".",
+    "QTScripts (*.js);;All Files (*)");
+
+  loadScript(QFileInfo(filename));
+#endif
+}
+
+void MainWindow::on_actionLoad_triggered()
+{
+  QStringList filters;
+  // we need to special case our way out of this
+  filters << "All Files (*)";
+
+  QStringList extensions;
+
+  typedef QMap<QString, CGAL::Three::Polyhedron_demo_io_plugin_interface*> FilterPluginMap;
+  FilterPluginMap filterPluginMap;
+  
+  Q_FOREACH(CGAL::Three::Polyhedron_demo_io_plugin_interface* plugin, io_plugins) {
+    QStringList split_filters = plugin->loadNameFilters().split(";;");
+    Q_FOREACH(const QString& filter, split_filters) {
+      FilterPluginMap::iterator it = filterPluginMap.find(filter);
+      if(it != filterPluginMap.end()) {
+        qDebug() << "Duplicate Filter: " << it.value();
+        qDebug() << "This filter will not be available.";
+      } else {
+        filterPluginMap[filter] = plugin;
+      }
+      filters << filter;
+    }
+  }
+
+  QSettings settings;
+  QString directory = settings.value("OFF open directory",
+                                     QDir::current().dirName()).toString();
+
+  QFileDialog dialog(this);
+  dialog.setDirectory(directory);
+  dialog.setNameFilters(filters);
+  dialog.setFileMode(QFileDialog::ExistingFiles);
+
+  if(dialog.exec() != QDialog::Accepted) { return; }
+  FilterPluginMap::iterator it = 
+    filterPluginMap.find(dialog.selectedNameFilter());
+  
+  CGAL::Three::Polyhedron_demo_io_plugin_interface* selectedPlugin = NULL;
+
+  if(it != filterPluginMap.end()) {
+    selectedPlugin = it.value();
+  }
+
+  Q_FOREACH(const QString& filename, dialog.selectedFiles()) {
+    CGAL::Three::Scene_item* item = NULL;
+    if(selectedPlugin) {
+      QFileInfo info(filename);
+      item = loadItem(info, selectedPlugin);
+      Scene::Item_id index = scene->addItem(item);
+      selectSceneItem(index);
+      this->addToRecentFiles(filename);
+    } else {
+      open(filename);
+    }
+  }
+}
+
+void MainWindow::on_actionSaveAs_triggered()
+{
+  int index = -1;
+  QAction* sender_action = qobject_cast<QAction*>(sender());
+  if(sender_action && !sender_action->data().isNull()) {
+    index = sender_action->data().toInt();
+  }
+
+  if(index < 0) {
+    QModelIndexList selectedRows = sceneView->selectionModel()->selectedRows();
+    if(selectedRows.size() != 1)
+      return;
+    index = getSelectedSceneItemIndex();
+  }
+  CGAL::Three::Scene_item* item = scene->item(index);
+
+  if(!item)
+    return;
+
+  QVector<CGAL::Three::Polyhedron_demo_io_plugin_interface*> canSavePlugins;
+  QStringList filters;
+  Q_FOREACH(CGAL::Three::Polyhedron_demo_io_plugin_interface* plugin, io_plugins) {
+    if(plugin->canSave(item)) {
+      canSavePlugins << plugin;
+      filters += plugin->saveNameFilters();
+    }
+  }
+  filters << tr("All files (*)");
+
+  if(canSavePlugins.isEmpty()) {
+    QMessageBox::warning(this,
+                         tr("Cannot save"),
+                         tr("The selected object %1 cannot be saved.")
+                         .arg(item->name()));
+    return;
+  }
+
+  QString caption = tr("Save %1 to File...").arg(item->name());
+  QString filename = 
+    QFileDialog::getSaveFileName(this,
+                                 caption,
+                                 QString(),
+                                 filters.join(";;"));
+  save(filename, item);
+}
+
+void MainWindow::save(QString filename, CGAL::Three::Scene_item* item) {
+  QFileInfo fileinfo(filename);
+  bool saved = false;
+  Q_FOREACH(CGAL::Three::Polyhedron_demo_io_plugin_interface* plugin, io_plugins) {
+    if(  plugin->canSave(item) &&
+        file_matches_filter(plugin->saveNameFilters(),filename) )
+    {
+      if(plugin->save(item, fileinfo))
+      {
+        saved = true;
+        break;
+      }
+    }
+  }
+  if(!saved)
+    QMessageBox::warning(this,
+                         tr("Cannot save"),
+                         tr("The selected object %1 was not saved. (Maybe a wrong extension ?)")
+                         .arg(item->name()));
+}
+
+void MainWindow::on_actionSaveSnapshot_triggered()
+{
+  viewer->saveSnapshot(false);
+}
+
+bool MainWindow::on_actionErase_triggered()
+{
+  int next_index = scene->erase(scene->selectionIndices());
+  //Secure the case where erase triggers other items deletions
+  if(scene->numberOfEntries()< next_index +1 )
+    next_index = -1;
+  selectSceneItem(next_index);
+  return next_index >= 0;
+}
+
+void MainWindow::on_actionEraseAll_triggered()
+{
+  while(on_actionErase_triggered()) {
+  }
+}
+
+void MainWindow::on_actionDuplicate_triggered()
+{
+  int index = scene->duplicate(getSelectedSceneItemIndex());
+  selectSceneItem(index);
+}
+
+void MainWindow::on_actionShowHide_triggered()
+{
+  Q_FOREACH(QModelIndex index, sceneView->selectionModel()->selectedRows())
+  {
+    int i = scene->getIdFromModelIndex(proxyModel->mapToSource(index));
+    CGAL::Three::Scene_item* item = scene->item(i);
+    item->setVisible(!item->visible());
+    scene->itemChanged(i);
+  }
+}
+
+void MainWindow::on_actionSetPolyhedronA_triggered()
+{
+  int i = getSelectedSceneItemIndex();
+  scene->setItemA(i);
+}
+
+void MainWindow::on_actionSetPolyhedronB_triggered()
+{
+  int i = getSelectedSceneItemIndex();
+  scene->setItemB(i);
+}
+void MainWindow::on_actionPreferences_triggered()
+{
+  QDialog dialog(this);
+  Ui::PreferencesDialog prefdiag;
+  prefdiag.setupUi(&dialog);
+  
+  
+  QStandardItemModel* iStandardModel = new QStandardItemModel(this);
+  //add blacklisted plugins
+  Q_FOREACH(QString name, plugin_blacklist)
+  {
+    QStandardItem* item =  new QStandardItem(name);
+    item->setCheckable(true);
+    item->setCheckState(Qt::Checked);
+    iStandardModel->appendRow(item);
+  }
+
+  //add operations plugins
+  Q_FOREACH(PluginNamePair pair,plugins){
+    QStandardItem* item =  new QStandardItem(pair.second);
+    item->setCheckable(true);
+    iStandardModel->appendRow(item);
+  }
+  
+  //add io-plugins
+  Q_FOREACH(CGAL::Three::Polyhedron_demo_io_plugin_interface* plugin, io_plugins)
+  {
+    QStandardItem* item =  new QStandardItem(plugin->name());
+    item->setCheckable(true);
+    if ( plugin_blacklist.contains(plugin->name()) ) item->setCheckState(Qt::Checked);
+    iStandardModel->appendRow(item);
+  }
+
+  //Setting the model
+  prefdiag.listView->setModel(iStandardModel);
+  
+  dialog.exec();  
+  
+  if ( dialog.result() )
+  {
+    plugin_blacklist.clear();
+    for (int k=0,k_end=iStandardModel->rowCount();k<k_end;++k)
+    {
+      QStandardItem* item=iStandardModel->item(k);
+      if (item->checkState()==Qt::Checked)
+        plugin_blacklist.insert(item->text());
+    }
+  }
+  
+  for (int k=0,k_end=iStandardModel->rowCount();k<k_end;++k) delete iStandardModel->item(k);
+  delete iStandardModel;
+}
+
+void MainWindow::on_actionSetBackgroundColor_triggered()
+{
+  QColor c =  QColorDialog::getColor();
+  if(c.isValid()) {
+    viewer->setBackgroundColor(c);
+  }
+}
+
+void MainWindow::on_actionLookAt_triggered()
+{
+  Show_point_dialog dialog(this);
+  dialog.setWindowTitle(tr("Look at..."));
+  int i = dialog.exec();
+  if( i == QDialog::Accepted &&
+      dialog.has_correct_coordinates() )
+  {
+    viewerShow((float)dialog.get_x(),
+               (float)dialog.get_y(),
+               (float)dialog.get_z());
+  }
+}
+
+void MainWindow::viewerShowObject()
+{
+  int index = -1;
+  QAction* sender_action = qobject_cast<QAction*>(sender());
+  if(sender_action && !sender_action->data().isNull()) {
+    index = sender_action->data().toInt();
+  }
+  if(index >= 0) {
+    const Scene::Bbox bbox = scene->item(index)->bbox();
+    viewerShow((float)bbox.xmin(), (float)bbox.ymin(), (float)bbox.zmin(),
+               (float)bbox.xmax(), (float)bbox.ymax(), (float)bbox.zmax());
+  }
+}
+
+QString MainWindow::cameraString() const
+{
+  return viewer->dumpCameraCoordinates();
+}
+
+void MainWindow::on_actionDumpCamera_triggered()
+{
+  information(QString("Camera: %1")
+              .arg(cameraString()));
+}
+
+void MainWindow::on_actionCopyCamera_triggered()
+{
+  qApp->clipboard()->setText(this->cameraString());
+}
+
+void MainWindow::on_actionPasteCamera_triggered()
+{
+  QString s = qApp->clipboard()->text();
+  viewer->moveCameraToCoordinates(s, 0.5f);
+}
+
+void MainWindow::setAddKeyFrameKeyboardModifiers(::Qt::KeyboardModifiers m)
+{
+  viewer->setAddKeyFrameKeyboardModifiers(m);
+}
+
+void MainWindow::on_actionRecenterScene_triggered()
+{
+  updateViewerBBox();
+  viewer->camera()->interpolateToFitScene();
+}
+
+void MainWindow::on_actionLoadPlugin_triggered()
+{
+    //pop a dialog of path selection, get the path and add it to plugins_directory
+
+    QString filters("Library files (*.dll *.DLL *.so *.a *.sl *.dylib *.bundle);;"
+                    "Any files (*)");
+
+    QStringList paths = QFileDialog::getOpenFileNames(
+                this,
+                tr("Select the directory containing your plugins:"),
+                ".",filters);
+    Q_FOREACH(QString name, paths)
+      load_plugin(name, false);
+
+    updateMenus();
+}
+
+void MainWindow::recurseExpand(QModelIndex index)
+{
+    int row = index.row();
+    if(index.child(0,0).isValid())
+    {
+        recurseExpand(index.child(0,0));
+    }
+
+    QString name = scene->item(scene->getIdFromModelIndex(index))->name();
+        CGAL::Three::Scene_group_item* group =
+                qobject_cast<CGAL::Three::Scene_group_item*>(scene->item(scene->getIdFromModelIndex(index)));
+        if(group && group->isExpanded())
+        {
+            sceneView->setExpanded(proxyModel->mapFromSource(index), true);
+        }
+        else if (group && !group->isExpanded()){
+            sceneView->setExpanded(proxyModel->mapFromSource(index), false);
+        }
+
+        if( index.sibling(row+1,0).isValid())
+            recurseExpand(index.sibling(row+1,0));
+}
+void MainWindow::restoreCollapseState()
+{
+    QModelIndex modelIndex = scene->index(0,0,scene->invisibleRootItem()->index());
+    if(modelIndex.isValid())
+        recurseExpand(modelIndex);
+}
+void MainWindow::makeNewGroup()
+{
+    Scene_group_item * group = new Scene_group_item("New group");
+    scene->addItem(group);
+}
+
+void MainWindow::on_upButton_pressed()
+{
+    scene->moveRowUp();
+}
+
+void MainWindow::on_downButton_pressed()
+{
+    scene->moveRowDown();
+}
+
+void MainWindow::recenterSceneView(const QModelIndex &id)
+{
+    if(id.isValid())
+    {
+        // mapFromSource is necessary to convert the QModelIndex received
+        // from the Scene into a valid QModelIndex in the view, beacuse of
+        // the proxymodel
+        sceneView->scrollTo(proxyModel->mapFromSource(id));
+    }
+}
+
+void MainWindow::statisticsOnItem()
+{
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+
+  if (statistics_dlg == NULL)
+  {
+    statistics_dlg = new QDialog(this);
+    statistics_ui->setupUi(statistics_dlg);
+    connect(statistics_ui->okButtonBox, SIGNAL(accepted()),
+            statistics_dlg, SLOT(accept()));
+    connect(statistics_ui->updateButton, SIGNAL(clicked()),
+            this, SLOT(statisticsOnItem()));
+  }
+  statistics_ui->label_htmltab->setText(get_item_stats());
+
+  statistics_dlg->show();
+  statistics_dlg->raise();
+
+  QApplication::restoreOverrideCursor();
+}
+
+/* Creates a string containing an html table. This string is constructed by appending each parts of each row, so that the data can
+  depend on the number of selected items. This String is then returned.*/
+QString MainWindow::get_item_stats()
+{
+  //1st step : get all classnames of the selected items
+  QList<QString> classnames;
+  Q_FOREACH(int id, getSelectedSceneItemIndices())
+  {
+    QString classname = scene->item(id)->metaObject()->className();
+    if(!classnames.contains(classname))
+      classnames << classname;
+  }
+  //2nd step : separate the selection in lists corresponding to their classname
+  QVector< QList<Scene_item*> > items;
+  items.resize(classnames.size());
+  Q_FOREACH(int id, getSelectedSceneItemIndices())
+  {
+    Scene_item* s_item = scene->item(id);
+    for(int i=0; i<items.size(); i++)
+      if(classnames.at(i).contains(s_item->metaObject()->className()))
+      {
+        items[i] << s_item;
+        break;
+      }
+  }
+  //last step :: making tables for each type of item
+  QString str;
+  for(int i=0; i< classnames.size(); i++)
+  {
+    CGAL::Three::Scene_item::Header_data data = items[i].at(0)->header();
+    int title = 0;
+    int titles_limit =0;
+    if(data.titles.size()>0)
+    {
+      //1st row : item names
+      str.append("<html> <table border=1>""<tr><td colspan = 2></td>");
+      Q_FOREACH(Scene_item* sit, items[i])
+      {
+        str.append(QString("<td>%1</td>").arg(sit->name()));
+      }
+
+
+
+      for(int j=0; j<data.categories.size(); j++)
+      {
+        str.append(QString("<tr><th rowspan=%1> %2 </th>")
+                   .arg(QString::number(data.categories[j].second))
+                   .arg(data.categories[j].first));
+        titles_limit+=data.categories[j].second;
+        str.append(QString("<td> %1 </td>").arg(data.titles.at(title)));
+        Q_FOREACH(Scene_item* sit, items[i])
+        {
+          str.append(QString("<td>%1</td>").arg(sit->computeStats(title)));
+        }
+        title++;
+        for(;title<titles_limit; title++)
+        {
+          str.append(QString("</tr><tr><td> %1 </td>").arg(data.titles.at(title)));
+          Q_FOREACH(Scene_item* sit, items[i])
+          {
+            str.append(QString("<td>%1</td>").arg(sit->computeStats(title)));
+          }
+        }
+
+        str.append("</tr>");
+      }
+
+      str.append(QString("</tr>""</table></html>"));
+    }
+  }
+  return str;
+}
+
+void MainWindow::setCollapsed(QModelIndex index)
+{
+  Q_EMIT collapsed(proxyModel->mapToSource(index));
+}
+
+void MainWindow::setExpanded(QModelIndex index)
+{
+  Q_EMIT expanded(proxyModel->mapToSource(index));
+}
+
+
+void MainWindow::on_actionMaxTextItemsDisplayed_triggered()
+{
+  bool ok;
+  bool valid;
+  QString text = QInputDialog::getText(this, tr("Maximum Number of Text Items"),
+                                       tr("Maximum Text Items Diplayed:"), QLineEdit::Normal,
+                                       QString("%1").arg(viewer->textRenderer->getMax_textItems()), &ok);
+  text.toInt(&valid);
+  if (ok && valid){
+    viewer->textRenderer->setMax(text.toInt());
+    ui->actionMaxTextItemsDisplayed->setText(QString("Set Maximum Text Items Displayed : %1").arg(text.toInt()));
+  }
+}
diff --git a/3rdparty/CGAL/demo/Polyhedron/MainWindow.h b/3rdparty/CGAL/demo/Polyhedron/MainWindow.h
new file mode 100644
index 0000000..1e7c3bb
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/MainWindow.h
@@ -0,0 +1,389 @@
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+#include "config.h"
+#include "MainWindow_config.h"
+
+#include <QtOpenGL/qgl.h>
+#include <CGAL/Qt/DemosMainWindow.h>
+#ifdef QT_SCRIPT_LIB
+#  include  <QScriptEngine>
+#endif
+
+#include <QVector>
+#include <QList>
+#include <QFileInfo>
+#include <QStringList>
+#include <QSet>
+#include <QModelIndex>
+class Scene;
+class Viewer;
+class QTreeView;
+class QMenu;
+namespace CGAL {
+namespace Three{
+class Polyhedron_demo_io_plugin_interface;
+class Polyhedron_demo_plugin_interface;
+class Scene_item;
+}
+}
+
+class QSortFilterProxyModel;
+
+namespace Ui {
+  class MainWindow;
+  class Statistics_on_item_dialog;
+}
+
+#include "Polyhedron_type_fwd.h"
+
+#include "Messages_interface.h"
+
+/*!
+ * \brief The main window of the applicatipon.
+ * It contains all the widgets, the menus and the elements of interface
+ * of the application.*/
+
+class MAINWINDOW_EXPORT MainWindow : 
+  public CGAL::Qt::DemosMainWindow,
+  public Messages_interface
+{
+  Q_OBJECT
+  Q_INTERFACES(Messages_interface)
+public:
+  /*! \brief The constructor
+   * It links the class with its UI file and sets it up.
+   * It also saves pointers to viewer and the sceneView.
+   * Then it creates and initializes the scene and do the
+   * connexions with the UI. Finally it loads the plugins.*/
+
+  MainWindow(QWidget* parent = 0);
+  ~MainWindow();
+
+  /*! Find an IO plugin.
+   * throws std::invalid_argument if no loader with that argument can be found
+   @returns the IO plugin associated with `loader_name`*/
+  CGAL::Three::Polyhedron_demo_io_plugin_interface* findLoader(const QString& loader_name) const;
+
+  /*! \brief Load an item with a given loader.
+   * throws `std::logic_error` if loading does not succeed or
+   * `std::invalid_argument` if `fileinfo` specifies an invalid file*/
+  CGAL::Three::Scene_item* loadItem(QFileInfo fileinfo, CGAL::Three::Polyhedron_demo_io_plugin_interface*);
+
+Q_SIGNALS:
+  void on_closure();
+  void expanded(QModelIndex);
+  void collapsed(QModelIndex);
+
+
+public Q_SLOTS:
+  //!Creates a new group and adds it to the scene.
+  void makeNewGroup();
+  void updateViewerBBox();
+  void open(QString);
+  void on_upButton_pressed();
+  void on_downButton_pressed();
+  void restoreCollapseState();
+  void setExpanded(QModelIndex);
+  void setCollapsed(QModelIndex);
+  bool file_matches_filter(const QString& filters, const QString& filename);
+  //!Prints a dialog containing statistics on the selected polyhedrons.
+  void statisticsOnItem();
+  /*! Open a file with a given loader, and return true if it was successful.
+   This slot is for use by scripts.*/
+  bool open(QString filename, QString loader_name);
+
+  /*! Reloads an item. Expects to be called by a QAction with the
+   index of the item to be reloaded as data attached to the action.
+   The index must identify a valid `Scene_item`.*/
+  void reloadItem();
+  
+  /*!
+   * This is an overloaded function.
+   * If QT_SCRIPT_LIB is defined, returns true if the script is valid.
+   * If not, returns false.
+   */
+  bool loadScript(QString filename);
+
+  /*! If QT_SCRIPT_LIB is defined, returns true if the script is valid.
+  * If not, returns false.
+  */
+  bool loadScript(QFileInfo);
+
+  /*!
+   * Gives the keyboard input focus to the widget searchEdit.
+   */
+  void setFocusToQuickSearch();
+
+  /*!
+   * Clears the current selection and select the scene_item with
+   * the index i in the sceneView. Calls itemChanged(i) from the scene.
+   */
+  void selectSceneItem(int i);
+  /*!
+   * Prints coordinates of a point and its distance to the last
+   * position printed by this function.
+   */
+  void showSelectedPoint(double, double, double);
+  /*!
+   * Calls removeSceneItemFromSelection(i).
+   */
+  void unSelectSceneItem(int i);
+  /*!
+   * Clears the current selection and select all the scene_items
+   * in the sceneView.
+   */
+  void selectAll();
+  /*!
+   * Adds the scene_item with the index i in the sceneView to the
+   * current selection. Calls itemChanged(i) from the scene.
+   */
+  void addSceneItemInSelection(int i);
+
+  /*!
+   * Removes the scene_item with the index i in the sceneView to the
+   * current selection. Calls itemChanged(i) from the scene.
+   */
+  void removeSceneItemFromSelection(int i);
+
+  /*!
+   * Calls setAddKeyFrameKeyboardModifiers(m) from the viewer.
+   */
+  void setAddKeyFrameKeyboardModifiers(Qt::KeyboardModifiers);
+  /*!
+   * Set the visibility of all actions from the targeted menu
+   * and its submenus to false and disables them.
+   */
+  void clearMenu(QMenu*);
+  /*!
+   * Enables and sets the targeted action's visibility to true.
+   * Does the same in all the menus of the widgets associated with
+   * this action.
+   */
+  void addAction(QAction*);
+  /*!
+   * Creates an action with text actionText named actionName and
+   * adds it to the menu menuName. If menuName does not exist,
+   * it is created.
+   */
+  void addAction(QString actionName,
+                 QString actionText,
+                 QString menuName);
+  /*!
+   * Sets the scene center to the target position and makes the
+   * scene slide to this new center. Also sets the pivotPoint of
+   * the camera to this position.
+   */
+  void viewerShow(float, float, float);
+  /*!
+   * Sets the scene center to be the center of the target BBox.
+   * Also sets the pivotPoint of the camera to this position.
+   */
+  void viewerShow(float, float, float, float, float, float);
+  /*!
+   * Centers the scene on the target object.
+   */
+  void viewerShowObject();
+  /*!
+   * Displays a text preceded by the mention "INFO :".
+   */
+  void information(QString);
+  /*!
+   * Displays a blue text preceded by the mention "WARNING :".
+   */
+  void warning(QString);
+  /*!
+   * Displays a red text preceded by the mention "ERROR :".
+   */
+  void error(QString);
+
+    //!Displays a text in the chosen html color with the chosen html font.
+
+  void message(QString, QString, QString = QString("normal"));
+
+    //!Returns true if the target plugin is present. If not, returns false.
+  bool hasPlugin(const QString&) const;
+  /*!
+   * If able, finds a script debugger and interrupts current action. Default
+   * value for parameter is true.
+   */
+  void enableScriptDebugger(bool = true);
+
+protected Q_SLOTS:
+
+   //!Gets the new selected item(s) from the sceneView and updates the scene
+   //!and viewer accordingly.
+  /*!
+   * Set the scene selected item or selected item list. Sets the manipulated
+   * frame of the viewer to the new selected item's and calls updateGL().
+   */
+  void selectionChanged();
+  //! Scrolls to the new selected item.
+  void recenterSceneView(const QModelIndex &id);
+
+  /*!
+   * Invoques a context menu for the currently selected item at the requested
+   * position.
+   */
+  void contextMenuRequested(const QPoint& global_pos);
+  /*!
+   * Invoques a context menu for the requested item at the requested
+   * position.
+   */
+  void showSceneContextMenu(int selectedItemIndex,
+                            const QPoint& global_pos);
+
+  //!This is an overloaded function. Invoques a context menu at the requested
+  //!position.
+  /*!
+   * If the widget which received the request is not the sceneView, the index
+   * chosen by default for the menu is the one of the currently selected item.
+   * If it is the sceneView, then the index of the clicked item is collected.
+   * If this index is valid, then it is used for the menu. If not, the function
+   * returns.
+   */
+  void showSceneContextMenu(const QPoint& local_pos_of_treeview);
+
+  //!Prints information about the currently selected item if able.
+  void updateInfo();
+  //!Prints graphical information about the currently selected item if able.
+  void updateDisplayInfo();
+  //!Sets the current manipulated frame to 0.
+  void removeManipulatedFrame(CGAL::Three::Scene_item*);
+
+  // settings
+  //!Closes the main window.
+  void quit();
+  //!Reads the plugin_blacklist contents and apply them.
+  void readSettings();
+  //!Sets up the plugin_blacklist.
+  void writeSettings();
+
+  // load, erase, duplicate
+  //!Loops on on_actionErase_triggered();
+  void on_actionEraseAll_triggered();
+  //!Opens a dialog to open one or several files.
+  void on_actionLoad_triggered();
+  //!Erases the selected items. Returns true if items remain in the sceneView.
+  bool on_actionErase_triggered();
+  //!Duplicates the selected item and selects the new item.
+  void on_actionDuplicate_triggered();
+  //!If QT_SCRIPT_LIB is defined, opens a dialog to choose a script.
+  void on_actionLoadScript_triggered();
+  //!Loads a plugin from a specified directory
+  void on_actionLoadPlugin_triggered();
+  // Show/Hide
+  //!Swap the visibility of the selected item(s).
+  void on_actionShowHide_triggered();
+  //!Pops a dialog to change the max TextItems
+  void on_actionMaxTextItemsDisplayed_triggered();
+  // Select A/B
+  //!Sets the selected item as item_A.
+  void on_actionSetPolyhedronA_triggered();
+  //!Sets the selected item as Item_B.
+  void on_actionSetPolyhedronB_triggered();
+
+  //Preferences edition
+  //!Opens the Preferences dialog.
+  void on_actionPreferences_triggered();
+  // save as...
+  //!Opens a dialog to save selected item if able.
+  void on_actionSaveAs_triggered(); 
+  //!Calls the function save of the current plugin if able.
+  void save(QString filename, CGAL::Three::Scene_item* item);
+  //!Calls the function saveSnapShot of the viewer.
+  void on_actionSaveSnapshot_triggered();
+  //!Opens a Dialog to choose a color and make it the background color.
+  void on_actionSetBackgroundColor_triggered();
+  /*! Opens a Dialog to enter coordinates of the new center point and sets it
+   * with viewerShow.
+   *@see viewerShow(float, float, float, float, float, float)
+   */
+  void on_actionLookAt_triggered();
+  //!Returns the position and orientation of the current camera frame.
+  QString cameraString() const;
+  /*! Prints the position and orientation of the current camera frame.
+   * @see cameraString()
+   */
+  void on_actionDumpCamera_triggered();
+  //!Sets the coordinates of the camera in the clipboard text.
+  void on_actionCopyCamera_triggered();
+  //!Gets coordinates from the clipboard and sets them as the current ones for
+  //!the camera.
+  void on_actionPasteCamera_triggered();
+  //!Hides not available operations and show available operations in all the
+  //!menus.
+  void filterOperations();
+  //!Updates the bounding box and moves the camera to fits the scene.
+  void on_actionRecenterScene_triggered();
+protected:
+  QList<QAction*> createSubMenus(QList<QAction*>);
+  /*! For each objects in the sceneView, loads the associated plugins.
+   * Gets the property "submenuName" of all the actions and creates submenus.
+   * Sorts the Operations menu by name.
+   * @see initPlugin(QObject*);
+   * @see initIOPlugin(QObject*);
+   */
+  void loadPlugins();
+  /*!
+   * \brief Initializes the plugins.
+   * Makes pairs between plugins and object names and fills the Operations menu.
+   * Called only once.
+   */
+  bool initPlugin(QObject*);
+  //!Initializes the IO plugin for the target object.
+  bool initIOPlugin(QObject*);
+  /*!
+   * Calls writeSettings() and set the flag accepted for the event.
+   * @see writeSettings()
+   */
+  void closeEvent(QCloseEvent *event);
+  /*! Returns the currently selected item in the sceneView. Returns -1
+   * if none is selected.
+   */
+  int getSelectedSceneItemIndex() const;
+  //! Returns a list of the selected items in the sceneView.
+  QList<int> getSelectedSceneItemIndices() const;
+private:
+  void updateMenus();
+  void load_plugin(QString names, bool blacklisted);
+  void recurseExpand(QModelIndex index);
+  QMap<QString, QMenu*> menu_map;
+  QString get_item_stats();
+  QString strippedName(const QString &fullFileName);
+  void setMenus(QString, QString, QAction *a);
+  /// plugin black-list
+  QSet<QString> plugin_blacklist;
+  Scene* scene;
+  Viewer* viewer;
+  QSortFilterProxyModel* proxyModel;
+  QTreeView* sceneView;
+  Ui::MainWindow* ui;
+  QVector<CGAL::Three::Polyhedron_demo_io_plugin_interface*> io_plugins;
+  QMap<QString,QString> default_plugin_selection;
+  // typedef to make Q_FOREACH work
+  typedef QPair<CGAL::Three::Polyhedron_demo_plugin_interface*, QString> PluginNamePair;
+  QVector<PluginNamePair > plugins;
+  //!Called when "Add new group" in the file menu is triggered.
+  QAction* actionAddToGroup;
+  void print_message(QString message) { messages->information(message); }
+  Messages_interface* messages;
+
+  QDialog *statistics_dlg;
+  Ui::Statistics_on_item_dialog* statistics_ui;
+
+#ifdef QT_SCRIPT_LIB
+  QScriptEngine* script_engine;
+public:
+  /*! Evaluates a script and search for uncaught exceptions. If quiet is false, prints the
+   *backtrace of the uncaught exceptions.
+   */
+  void evaluate_script(QString script, 
+                       const QString & fileName = QString(),
+                       const bool quiet = false);
+  //! Calls evaluate_script(script, filename, true).
+  void evaluate_script_quiet(QString script, 
+                             const QString & fileName = QString());
+#endif
+};
+
+#endif // ifndef MAINWINDOW_H
diff --git a/3rdparty/CGAL/demo/Polyhedron/MainWindow.ui b/3rdparty/CGAL/demo/Polyhedron/MainWindow.ui
new file mode 100644
index 0000000..b49869d
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/MainWindow.ui
@@ -0,0 +1,679 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>978</width>
+    <height>594</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>CGAL Three</string>
+  </property>
+  <property name="windowIcon">
+   <iconset resource="Polyhedron_3.qrc">
+    <normaloff>:/cgal/icons/resources/cgal_logo.xpm</normaloff>:/cgal/icons/resources/cgal_logo.xpm</iconset>
+  </property>
+  <widget class="QWidget" name="centralwidget">
+   <layout class="QVBoxLayout" name="verticalLayout_2">
+    <item>
+     <widget class="Viewer" name="viewer" native="true">
+      <property name="sizePolicy">
+       <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+        <horstretch>0</horstretch>
+        <verstretch>1</verstretch>
+       </sizepolicy>
+      </property>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+  <widget class="QMenuBar" name="menubar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>978</width>
+     <height>20</height>
+    </rect>
+   </property>
+   <widget class="QMenu" name="menuFile">
+    <property name="title">
+     <string>&File</string>
+    </property>
+    <addaction name="actionLoad"/>
+    <addaction name="actionErase"/>
+    <addaction name="actionEraseAll"/>
+    <addaction name="actionDuplicate"/>
+    <addaction name="actionSaveAs"/>
+    <addaction name="actionSaveSnapshot"/>
+    <addaction name="separator"/>
+    <addaction name="actionLoadScript"/>
+    <addaction name="separator"/>
+    <addaction name="actionLoadPlugin"/>
+    <addaction name="separator"/>
+    <addaction name="actionQuit"/>
+   </widget>
+   <widget class="QMenu" name="menuEdit">
+    <property name="title">
+     <string>&Edit</string>
+    </property>
+    <addaction name="actionShowHide"/>
+    <addaction name="actionSetPolyhedronA"/>
+    <addaction name="actionSetPolyhedronB"/>
+    <addaction name="actionSelectAllItems"/>
+    <addaction name="actionPreferences"/>
+   </widget>
+   <widget class="QMenu" name="menuOperations">
+    <property name="title">
+     <string>&Operations</string>
+    </property>
+   </widget>
+   <widget class="QMenu" name="menuView">
+    <property name="title">
+     <string>&View</string>
+    </property>
+    <widget class="QMenu" name="menuDockWindows">
+     <property name="title">
+      <string>&Dock Windows</string>
+     </property>
+     <addaction name="dummyAction"/>
+    </widget>
+    <widget class="QMenu" name="menuCamera">
+     <property name="title">
+      <string>Ca&mera</string>
+     </property>
+     <addaction name="actionDumpCamera"/>
+     <addaction name="actionCopyCamera"/>
+     <addaction name="actionPasteCamera"/>
+    </widget>
+    <addaction name="actionRecenterScene"/>
+    <addaction name="actionLookAt"/>
+    <addaction name="actionAntiAliasing"/>
+    <addaction name="actionDrawTwoSides"/>
+    <addaction name="actionQuickCameraMode"/>
+    <addaction name="actionMaxTextItemsDisplayed"/>
+    <addaction name="actionSetBackgroundColor"/>
+    <addaction name="menuDockWindows"/>
+    <addaction name="menuCamera"/>
+   </widget>
+   <addaction name="menuFile"/>
+   <addaction name="menuEdit"/>
+   <addaction name="menuOperations"/>
+   <addaction name="menuView"/>
+  </widget>
+  <widget class="QStatusBar" name="statusbar"/>
+  <widget class="QDockWidget" name="sceneDockWidget">
+   <property name="locale">
+    <locale language="English" country="UnitedStates"/>
+   </property>
+   <property name="windowTitle">
+    <string>Geometric Objects</string>
+   </property>
+   <attribute name="dockWidgetArea">
+    <number>1</number>
+   </attribute>
+   <widget class="QWidget" name="dockWidgetContent">
+    <layout class="QGridLayout" name="gridLayout_2">
+     <item row="0" column="0">
+      <layout class="QVBoxLayout" name="verticalLayout">
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout">
+         <item>
+          <widget class="QToolButton" name="addButton">
+           <property name="text">
+            <string>+</string>
+           </property>
+           <property name="icon">
+            <iconset resource="Polyhedron_3.qrc">
+             <normaloff>:/cgal/icons/plus</normaloff>:/cgal/icons/plus</iconset>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QToolButton" name="removeButton">
+           <property name="text">
+            <string>-</string>
+           </property>
+           <property name="icon">
+            <iconset resource="Polyhedron_3.qrc">
+             <normaloff>:/cgal/icons/minus</normaloff>:/cgal/icons/minus</iconset>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QToolButton" name="duplicateButton">
+           <property name="text">
+            <string>...</string>
+           </property>
+           <property name="icon">
+            <iconset resource="Polyhedron_3.qrc">
+             <normaloff>:/cgal/icons/duplicate</normaloff>:/cgal/icons/duplicate</iconset>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QToolButton" name="upButton">
+           <property name="text">
+            <string>...</string>
+           </property>
+           <property name="icon">
+            <iconset resource="Polyhedron_3.qrc">
+             <normaloff>:/cgal/icons/resources/up.png</normaloff>:/cgal/icons/resources/up.png</iconset>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QToolButton" name="downButton">
+           <property name="text">
+            <string>...</string>
+           </property>
+           <property name="icon">
+            <iconset resource="Polyhedron_3.qrc">
+             <normaloff>:/cgal/icons/resources/down.png</normaloff>:/cgal/icons/resources/down.png</iconset>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer name="horizontalSpacer">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>40</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <widget class="QLineEdit" name="searchEdit">
+           <property name="placeholderText">
+            <string>Quick filter... <Alt+Q></string>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+       <item>
+        <widget class="QTreeView" name="sceneView">
+         <property name="editTriggers">
+          <set>QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked</set>
+         </property>
+         <property name="dragDropMode">
+          <enum>QAbstractItemView::InternalMove</enum>
+         </property>
+         <property name="alternatingRowColors">
+          <bool>true</bool>
+         </property>
+         <property name="selectionMode">
+          <enum>QAbstractItemView::ExtendedSelection</enum>
+         </property>
+         <property name="selectionBehavior">
+          <enum>QAbstractItemView::SelectRows</enum>
+         </property>
+         <property name="indentation">
+          <number>10</number>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+    </layout>
+   </widget>
+  </widget>
+  <widget class="QDockWidget" name="consoleDockWidget">
+   <property name="allowedAreas">
+    <set>Qt::BottomDockWidgetArea|Qt::LeftDockWidgetArea|Qt::TopDockWidgetArea</set>
+   </property>
+   <property name="windowTitle">
+    <string>Console</string>
+   </property>
+   <attribute name="dockWidgetArea">
+    <number>8</number>
+   </attribute>
+   <widget class="QWidget" name="dockWidgetContents">
+    <layout class="QVBoxLayout" name="verticalLayout_3">
+     <item>
+      <widget class="QTextEdit" name="consoleTextEdit">
+       <property name="readOnly">
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </widget>
+  </widget>
+  <widget class="QDockWidget" name="infoDockWidget">
+   <property name="windowTitle">
+    <string>Infos</string>
+   </property>
+   <attribute name="dockWidgetArea">
+    <number>8</number>
+   </attribute>
+   <widget class="QWidget" name="dockWidgetContents_2">
+    <layout class="QHBoxLayout" name="horizontalLayout_2">
+     <item>
+      <layout class="QVBoxLayout" name="verticalLayout_4" stretch="0,0">
+       <property name="spacing">
+        <number>0</number>
+       </property>
+       <item>
+        <widget class="QScrollArea" name="scrollArea">
+         <property name="minimumSize">
+          <size>
+           <width>350</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="frameShape">
+          <enum>QFrame::NoFrame</enum>
+         </property>
+         <property name="widgetResizable">
+          <bool>true</bool>
+         </property>
+         <widget class="QWidget" name="scrollAreaWidgetContents">
+          <property name="geometry">
+           <rect>
+            <x>0</x>
+            <y>0</y>
+            <width>541</width>
+            <height>175</height>
+           </rect>
+          </property>
+          <layout class="QGridLayout" name="gridLayout">
+           <item row="0" column="0">
+            <widget class="QLabel" name="infoLabel">
+             <property name="sizePolicy">
+              <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+               <horstretch>0</horstretch>
+               <verstretch>1</verstretch>
+              </sizepolicy>
+             </property>
+             <property name="contextMenuPolicy">
+              <enum>Qt::DefaultContextMenu</enum>
+             </property>
+             <property name="lineWidth">
+              <number>0</number>
+             </property>
+             <property name="alignment">
+              <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+             </property>
+             <property name="textInteractionFlags">
+              <set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
+             </property>
+            </widget>
+           </item>
+          </layout>
+         </widget>
+        </widget>
+       </item>
+       <item>
+        <widget class="QLabel" name="displayLabel">
+         <property name="text">
+          <string/>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+    </layout>
+   </widget>
+  </widget>
+  <action name="actionQuit">
+   <property name="text">
+    <string>&Quit</string>
+   </property>
+   <property name="shortcut">
+    <string>Ctrl+Q</string>
+   </property>
+  </action>
+  <action name="actionSimplify">
+   <property name="text">
+    <string>&Simplification</string>
+   </property>
+  </action>
+  <action name="actionCatmullClark">
+   <property name="text">
+    <string>&Catmull-Clark</string>
+   </property>
+  </action>
+  <action name="actionKernel">
+   <property name="text">
+    <string>&Kernel</string>
+   </property>
+  </action>
+  <action name="actionUnion">
+   <property name="text">
+    <string>&Union (A/B)</string>
+   </property>
+   <property name="shortcut">
+    <string>Ctrl+O, U</string>
+   </property>
+  </action>
+  <action name="actionIntersection">
+   <property name="text">
+    <string>&Intersection (A/B)</string>
+   </property>
+   <property name="shortcut">
+    <string>Ctrl+O, I</string>
+   </property>
+  </action>
+  <action name="actionDifference">
+   <property name="text">
+    <string>&Difference (A/B)</string>
+   </property>
+   <property name="shortcut">
+    <string>Ctrl+O, D</string>
+   </property>
+  </action>
+  <action name="actionFitPlane">
+   <property name="text">
+    <string>Fit &Plane</string>
+   </property>
+  </action>
+  <action name="actionFitLine">
+   <property name="text">
+    <string>Fit &Line</string>
+   </property>
+  </action>
+  <action name="actionEstimateCurvature">
+   <property name="text">
+    <string>&Curvature Estimation</string>
+   </property>
+  </action>
+  <action name="actionLoad">
+   <property name="icon">
+    <iconset resource="Polyhedron_3.qrc">
+     <normaloff>:/cgal/icons/plus</normaloff>:/cgal/icons/plus</iconset>
+   </property>
+   <property name="text">
+    <string>&Load...</string>
+   </property>
+   <property name="shortcut">
+    <string>Ctrl+L</string>
+   </property>
+  </action>
+  <action name="actionErase">
+   <property name="icon">
+    <iconset resource="Polyhedron_3.qrc">
+     <normaloff>:/cgal/icons/minus</normaloff>:/cgal/icons/minus</iconset>
+   </property>
+   <property name="text">
+    <string>&Erase</string>
+   </property>
+   <property name="shortcut">
+    <string>Del</string>
+   </property>
+  </action>
+  <action name="actionDuplicate">
+   <property name="icon">
+    <iconset resource="Polyhedron_3.qrc">
+     <normaloff>:/cgal/icons/duplicate</normaloff>:/cgal/icons/duplicate</iconset>
+   </property>
+   <property name="text">
+    <string>&Duplicate</string>
+   </property>
+   <property name="shortcut">
+    <string>Ctrl+D</string>
+   </property>
+  </action>
+  <action name="actionSqrt3">
+   <property name="text">
+    <string>&Sqrt3</string>
+   </property>
+  </action>
+  <action name="actionAntiAliasing">
+   <property name="checkable">
+    <bool>true</bool>
+   </property>
+   <property name="text">
+    <string>&Antialiasing</string>
+   </property>
+  </action>
+  <action name="dummyAction">
+   <property name="text">
+    <string>n/a</string>
+   </property>
+  </action>
+  <action name="actionConvexHull">
+   <property name="text">
+    <string>&Convex Hull</string>
+   </property>
+  </action>
+  <action name="actionEraseAll">
+   <property name="text">
+    <string>&Erase All</string>
+   </property>
+  </action>
+  <action name="actionOptions">
+   <property name="text">
+    <string>&Options...</string>
+   </property>
+  </action>
+  <action name="actionLoop">
+   <property name="text">
+    <string>&Loop</string>
+   </property>
+  </action>
+  <action name="actionSaveAs">
+   <property name="text">
+    <string>Save &as...</string>
+   </property>
+  </action>
+  <action name="actionSave">
+   <property name="text">
+    <string>&Save</string>
+   </property>
+  </action>
+  <action name="actionSaveAll">
+   <property name="text">
+    <string>Save A&ll</string>
+   </property>
+  </action>
+  <action name="actionMergeAll">
+   <property name="text">
+    <string>Mer&ge All</string>
+   </property>
+  </action>
+  <action name="actionMerge">
+   <property name="text">
+    <string>&Merge</string>
+   </property>
+  </action>
+  <action name="actionSelfIntersection">
+   <property name="text">
+    <string>Self-&intersection</string>
+   </property>
+  </action>
+  <action name="actionSelectAll">
+   <property name="text">
+    <string>Select &All</string>
+   </property>
+  </action>
+  <action name="actionSelectNone">
+   <property name="text">
+    <string>Select &None</string>
+   </property>
+  </action>
+  <action name="actionSelectInvert">
+   <property name="text">
+    <string>&Invert Selection</string>
+   </property>
+  </action>
+  <action name="actionShowHide">
+   <property name="text">
+    <string>Show/Hide</string>
+   </property>
+   <property name="shortcut">
+    <string>Ctrl+Space</string>
+   </property>
+  </action>
+  <action name="actionSetPolyhedronA">
+   <property name="text">
+    <string>Set Polyhedron A</string>
+   </property>
+  </action>
+  <action name="actionSetPolyhedronB">
+   <property name="text">
+    <string>Set Polyhedron B</string>
+   </property>
+  </action>
+  <action name="actionInsideOut">
+   <property name="text">
+    <string>&Inside-Out</string>
+   </property>
+  </action>
+  <action name="actionRemeshing">
+   <property name="text">
+    <string>&Remeshing</string>
+   </property>
+  </action>
+  <action name="actionConvexDecomposition">
+   <property name="text">
+    <string>Convex Decomposition</string>
+   </property>
+  </action>
+  <action name="actionMVC">
+   <property name="text">
+    <string>Mean &Value Coordinates</string>
+   </property>
+  </action>
+  <action name="actionDCP">
+   <property name="text">
+    <string>Discrete &Conformal Maps</string>
+   </property>
+  </action>
+  <action name="actionExplode">
+   <property name="text">
+    <string>Explode</string>
+   </property>
+  </action>
+  <action name="actionToNef">
+   <property name="text">
+    <string>Convert to Nef Polyhedron</string>
+   </property>
+  </action>
+  <action name="actionToPoly">
+   <property name="text">
+    <string>Convert to Normal Polyhedron</string>
+   </property>
+  </action>
+  <action name="actionDrawTwoSides">
+   <property name="checkable">
+    <bool>true</bool>
+   </property>
+   <property name="text">
+    <string>Draw &Two Sides</string>
+   </property>
+   <property name="shortcut">
+    <string>Ctrl+T</string>
+   </property>
+  </action>
+  <action name="actionRecenterScene">
+   <property name="text">
+    <string>Re&center Scene</string>
+   </property>
+   <property name="shortcut">
+    <string>Ctrl+R</string>
+   </property>
+  </action>
+  <action name="actionSetBackgroundColor">
+   <property name="text">
+    <string>Change &Background Color...</string>
+   </property>
+  </action>
+  <action name="actionMinkowskiSum">
+   <property name="text">
+    <string>&Minkowski Sum (A/B)</string>
+   </property>
+   <property name="shortcut">
+    <string>Ctrl+O, M</string>
+   </property>
+  </action>
+  <action name="actionLookAt">
+   <property name="text">
+    <string>&Look at...</string>
+   </property>
+  </action>
+  <action name="actionSaveSnapshot">
+   <property name="text">
+    <string>Save Snapshot</string>
+   </property>
+  </action>
+  <action name="actionDumpCamera">
+   <property name="text">
+    <string>&Dump Camera Coordinates</string>
+   </property>
+  </action>
+  <action name="actionCopyCamera">
+   <property name="text">
+    <string>&Copy Camera</string>
+   </property>
+  </action>
+  <action name="actionPasteCamera">
+   <property name="text">
+    <string>&Paste Camera</string>
+   </property>
+  </action>
+  <action name="actionSelectAllItems">
+   <property name="text">
+    <string>Select All Items</string>
+   </property>
+   <property name="shortcut">
+    <string>Ctrl+A</string>
+   </property>
+  </action>
+  <action name="actionLoadScript">
+   <property name="text">
+    <string>Load &Script</string>
+   </property>
+  </action>
+  <action name="actionPreferences">
+   <property name="text">
+    <string>&Preferences</string>
+   </property>
+  </action>
+  <action name="actionLSC">
+   <property name="text">
+    <string>Least Square Conformal Maps</string>
+   </property>
+  </action>
+  <action name="actionLoadPlugin">
+   <property name="text">
+    <string>Load Plugin</string>
+   </property>
+  </action>
+  <action name="actionQuickCameraMode">
+   <property name="checkable">
+    <bool>true</bool>
+   </property>
+   <property name="checked">
+    <bool>true</bool>
+   </property>
+   <property name="text">
+    <string>Quick Camera Mode</string>
+   </property>
+  </action>
+  <action name="actionMaxTextItemsDisplayed">
+   <property name="text">
+    <string>Set Maximum  Text Items Displayed :</string>
+   </property>
+  </action>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>Viewer</class>
+   <extends>QWidget</extends>
+   <header>Viewer.h</header>
+  </customwidget>
+ </customwidgets>
+ <resources>
+  <include location="Polyhedron_3.qrc"/>
+ </resources>
+ <connections/>
+</ui>
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/MainWindow_config.h b/3rdparty/CGAL/demo/Polyhedron/MainWindow_config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/MainWindow_config.h
rename to 3rdparty/CGAL/demo/Polyhedron/MainWindow_config.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Mainpage.md b/3rdparty/CGAL/demo/Polyhedron/Mainpage.md
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Mainpage.md
rename to 3rdparty/CGAL/demo/Polyhedron/Mainpage.md
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Messages_interface.h b/3rdparty/CGAL/demo/Polyhedron/Messages_interface.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Messages_interface.h
rename to 3rdparty/CGAL/demo/Polyhedron/Messages_interface.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Nef_type.h b/3rdparty/CGAL/demo/Polyhedron/Nef_type.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Nef_type.h
rename to 3rdparty/CGAL/demo/Polyhedron/Nef_type.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Nef_type_fwd.h b/3rdparty/CGAL/demo/Polyhedron/Nef_type_fwd.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Nef_type_fwd.h
rename to 3rdparty/CGAL/demo/Polyhedron/Nef_type_fwd.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/One_ring_iterators.h b/3rdparty/CGAL/demo/Polyhedron/One_ring_iterators.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/One_ring_iterators.h
rename to 3rdparty/CGAL/demo/Polyhedron/One_ring_iterators.h
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/AABB_tree/CMakeLists.txt b/3rdparty/CGAL/demo/Polyhedron/Plugins/AABB_tree/CMakeLists.txt
new file mode 100644
index 0000000..a1f0c9c
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/AABB_tree/CMakeLists.txt
@@ -0,0 +1,4 @@
+include( polyhedron_demo_macros )
+
+polyhedron_demo_plugin(cut_plugin Cut_plugin )
+target_link_libraries(cut_plugin scene_polyhedron_item scene_basic_objects scene_color_ramp)
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/AABB_tree/Cut_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/AABB_tree/Cut_plugin.cpp
new file mode 100644
index 0000000..efa86a2
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/AABB_tree/Cut_plugin.cpp
@@ -0,0 +1,1389 @@
+
+#include <fstream>
+#include <QtCore/qglobal.h>
+#include <CGAL/AABB_intersections.h>
+
+#include "Scene.h"
+#include "Color_ramp.h"
+#include "Messages_interface.h"
+#include "Scene_plane_item.h"
+#include "Scene_polyhedron_item.h"
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+#include <CGAL/Three/Polyhedron_demo_io_plugin_interface.h>
+#include <CGAL/Three/Scene_interface.h>
+#include <CGAL/Three/Viewer_interface.h>
+#include <CGAL/gl.h>
+
+#include <CGAL/AABB_tree.h>
+#include <CGAL/AABB_traits.h>
+#include <CGAL/AABB_face_graph_triangle_primitive.h>
+#include <CGAL/AABB_halfedge_graph_segment_primitive.h>
+#include <CGAL/internal/AABB_tree/AABB_drawing_traits.h>
+//#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+#include <CGAL/Simple_cartesian.h>
+
+#include <CGAL/bounding_box.h>
+
+#include "Polyhedron_type.h"
+
+#include <QTime>
+
+#include <QAction>
+#include <QMainWindow>
+#include <QApplication>
+#include <CGAL/Three/Scene_item.h>
+#include <QMouseEvent>
+
+#ifdef CGAL_LINKED_WITH_TBB
+#include <tbb/parallel_for.h>
+#include <tbb/blocked_range.h>
+#include <tbb/scalable_allocator.h>
+#endif // CGAL_LINKED_WITH_TBB
+
+typedef CGAL::Simple_cartesian<double> Simple_kernel;
+typedef Simple_kernel::FT FT;
+typedef Simple_kernel::Point_3 Point;
+typedef std::pair<Point,FT> Point_distance;
+
+
+FT random_in(const double a,
+                    const double b)
+{
+    double r = rand() / (double)RAND_MAX;
+    return (FT)(a + (b - a) * r);
+}
+
+Simple_kernel::Vector_3 random_vector()
+{
+    FT x = random_in(0.0,1.0);
+    FT y = random_in(0.0,1.0);
+    FT z = random_in(0.0,1.0);
+    return Simple_kernel::Vector_3(x,y,z);
+}
+
+#ifdef CGAL_LINKED_WITH_TBB
+//functor for tbb parallelization
+template <typename Tree>
+class FillGridSize {
+  std::size_t grid_size;
+  Point_distance (&distance_function)[100][100];
+  FT diag;
+  FT& max_distance_function;
+  QMap<QObject*, Tree*> *trees;
+  bool is_signed;
+  qglviewer::ManipulatedFrame* frame;
+public:
+  FillGridSize(std::size_t grid_size, FT diag, Point_distance (&distance_function)[100][100],
+  FT& max_distance_function,QMap<QObject*, Tree*>* trees,
+  bool is_signed, qglviewer::ManipulatedFrame* frame)
+  : grid_size(grid_size), distance_function (distance_function), diag(diag),
+    max_distance_function(max_distance_function),
+    trees(trees), is_signed(is_signed), frame(frame)
+  {
+  }
+  void operator()(const tbb::blocked_range<std::size_t>& r) const
+  {
+    const GLdouble* m = frame->matrix();
+    Simple_kernel::Aff_transformation_3 transfo = Simple_kernel::Aff_transformation_3 (m[0], m[4], m[8], m[12],
+        m[1], m[5], m[9], m[13],
+        m[2], m[6], m[10], m[14]);
+    const FT dx = 2*diag;
+    const FT dy = 2*diag;
+    const FT z (0);
+    const FT fd =  FT(1);
+    Tree *min_tree = NULL ;
+    for( std::size_t t = r.begin(); t != r.end(); ++t)
+    {
+      int i(t%grid_size), j(t/grid_size);
+      FT x = -diag/fd + FT(i)/FT(grid_size) * dx;
+      {
+        FT y = -diag/fd + FT(j)/FT(grid_size) * dy;
+
+        Point query = transfo( Point(x,y,z) );
+        FT min = DBL_MAX;
+
+        Q_FOREACH(Tree *tree, trees->values())
+        {
+          if(is_signed && !qobject_cast<Scene_polyhedron_item*>(trees->key(tree))->polyhedron()->is_closed())
+            continue;
+          FT dist = CGAL::sqrt( tree->squared_distance(query) );
+          if(dist < min)
+          {
+            min = dist;
+            if(is_signed)
+              min_tree = tree;
+          }
+        }
+        distance_function[i][j] = Point_distance(query,min);
+        max_distance_function = (std::max)(min, max_distance_function);
+
+
+        if(is_signed)
+        {
+          if(!min_tree)
+          {
+            distance_function[i][j] = Point_distance(query,DBL_MAX);
+            max_distance_function = DBL_MAX;//(std::max)(min, max_distance_function);
+            continue;
+          }
+          typedef typename Tree::size_type size_type;
+          Simple_kernel::Vector_3 random_vec = random_vector();
+
+          const Simple_kernel::Point_3& p = distance_function[i][j].first;
+          const FT unsigned_distance = distance_function[i][j].second;
+
+          // get sign through ray casting (random vector)
+          Simple_kernel::Ray_3  ray(p, random_vec);
+          size_type nbi = min_tree->number_of_intersected_primitives(ray);
+
+          FT sign ( (nbi&1) == 0 ? 1 : -1);
+          distance_function[i][j].second = sign * unsigned_distance;
+        }
+      }
+    }
+  }
+};
+#endif
+
+const int slow_distance_grid_size = 100;
+const int fast_distance_grid_size = 20;
+class Texture{
+private:
+     int Width;
+     int Height;
+     int size;
+    GLubyte *data;
+public:
+    Texture(int w, int h)
+    {
+        Width = w;
+        Height = h;
+        size = 3*Height*Width;
+        data = new GLubyte[Height*Width*3];
+    }
+    int getWidth() const {return Width;}
+    int getHeight() const {return Height;}
+    int getSize() const {return size;}
+    void setData(int i, int j, int r, int g, int b){
+        data[3*(Width*j+i) + 0] = r;
+        data[3*(Width*j+i) + 1] = g;
+        data[3*(Width*j+i) + 2] = b;
+    }
+
+    GLubyte* getData(){return data; }
+
+};
+typedef CGAL::Simple_cartesian<double> Simple_kernel;
+
+//typedef CGAL::Exact_predicates_inexact_constructions_kernel         Simple_kernel;
+struct PPMAP
+{
+  typedef boost::readable_property_map_tag category;
+  typedef Simple_kernel::Point_3 value_type;
+  typedef const Simple_kernel::Point_3& reference;
+  typedef boost::graph_traits<Polyhedron>::vertex_descriptor key_type;
+  friend reference get(const PPMAP&, key_type v)
+  {
+    return reinterpret_cast<const Simple_kernel::Point_3&>(v->point());
+  }
+};
+
+typedef CGAL::AABB_face_graph_triangle_primitive<Polyhedron, PPMAP> Facet_primitive;
+typedef CGAL::AABB_traits<Simple_kernel, Facet_primitive>           Facet_traits;
+typedef CGAL::AABB_tree<Facet_traits>                               Facet_tree;
+
+typedef CGAL::AABB_halfedge_graph_segment_primitive<Polyhedron, PPMAP> Edge_primitive;
+typedef CGAL::AABB_traits<Simple_kernel, Edge_primitive>              Edge_traits;
+typedef CGAL::AABB_tree<Edge_traits>                                Edge_tree;
+
+
+typedef QMap<QObject*, Facet_tree*>                   Facet_trees;
+typedef QMap<QObject*, Edge_tree*>                    Edge_trees;
+
+
+class Q_DECL_EXPORT Scene_aabb_item : public CGAL::Three::Scene_item
+{
+  Q_OBJECT
+public:
+  Scene_aabb_item(const Facet_tree& tree_) : CGAL::Three::Scene_item(1,1), tree(tree_)
+  {
+      positions_lines.resize(0);
+      invalidateOpenGLBuffers();
+  }
+
+    ~Scene_aabb_item()
+    {
+    }
+
+  bool isFinite() const { return true; }
+  bool isEmpty() const { return tree.empty(); }
+  void compute_bbox() const {
+    const CGAL::Bbox_3 bbox = tree.bbox();
+    _bbox = Bbox(bbox.xmin(),
+                bbox.ymin(),
+                bbox.zmin(),
+                bbox.xmax(),
+                bbox.ymax(),
+                bbox.zmax());
+    qDebug()<<this->name()<<" at creation: "<<bbox.xmin()<<", "<<bbox.xmax()<<", "<<bbox.ymin()<<", "<<bbox.ymax()<<", "
+              <<bbox.zmin()<<", "<<bbox.zmax();
+  }
+
+  Scene_aabb_item* clone() const {
+    return 0;
+  }
+
+  QString toolTip() const {
+    return
+      tr("<p><b>%1</b> (mode: %2, color: %3)<br />"
+         "<i>AABB_tree</i></p>"
+         "<p>Number of nodes: %4</p>")
+      .arg(this->name())
+      .arg(this->renderingModeName())
+      .arg(this->color().name())
+      .arg(tree.size());
+  }
+  
+
+  // Indicate if rendering mode is supported
+  bool supportsRenderingMode(RenderingMode m) const {
+    return (m == Wireframe);
+  }
+
+  // Wireframe OpenGL drawing in a display list
+  void invalidateOpenGLBuffers()
+  {
+      computeElements();
+      are_buffers_filled = false;
+  }
+public:
+  const Facet_tree& tree;
+private:
+   mutable  std::vector<float> positions_lines;
+
+    mutable QOpenGLShaderProgram *program;
+
+    using CGAL::Three::Scene_item::initializeBuffers;
+    void initializeBuffers(CGAL::Three::Viewer_interface *viewer)const
+    {
+        program = getShaderProgram(PROGRAM_NO_SELECTION, viewer);
+        program->bind();
+        vaos[0]->bind();
+
+        buffers[0].bind();
+        buffers[0].allocate(positions_lines.data(),
+                            static_cast<int>(positions_lines.size()*sizeof(float)));
+        program->enableAttributeArray("vertex");
+        program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
+        buffers[0].release();
+        program->release();
+
+        vaos[0]->release();
+        are_buffers_filled = true;
+    }
+
+    void computeElements() const
+    {
+       QApplication::setOverrideCursor(Qt::WaitCursor);
+       positions_lines.clear();
+
+       CGAL::AABB_drawing_traits<Facet_primitive, CGAL::AABB_node<Facet_traits> > traits;
+       traits.v_edges = &positions_lines;
+
+       tree.traversal(0, traits);
+       QApplication::restoreOverrideCursor();
+    }
+    void drawEdges(CGAL::Three::Viewer_interface* viewer) const
+    {
+        if(!are_buffers_filled)
+            initializeBuffers(viewer);
+        vaos[0]->bind();
+        program = getShaderProgram(PROGRAM_NO_SELECTION);
+        attribBuffers(viewer, PROGRAM_NO_SELECTION);
+        program->bind();
+        program->setAttributeValue("colors",this->color());
+        viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(positions_lines.size()/3));
+        program->release();
+        vaos[0]->release();
+    }
+}; // end class Scene_aabb_item
+
+class Q_DECL_EXPORT Scene_edges_item : public CGAL::Three::Scene_item
+{
+  Q_OBJECT
+public:
+    Scene_edges_item():CGAL::Three::Scene_item(1,1)
+    {
+        positions_lines.resize(0);
+    }
+  ~Scene_edges_item()
+  {
+  }
+    bool isFinite() const { return true; }
+  bool isEmpty() const { return edges.empty(); }
+  void compute_bbox() const {
+    if(isEmpty())
+      _bbox = Bbox();
+    return;
+    CGAL::Bbox_3 bbox = edges.begin()->bbox();
+    for(size_t i = 1, end = edges.size(); i < end; ++i) {
+      bbox = bbox + edges[i].bbox();
+    }
+    _bbox = Bbox(bbox.xmin(),
+                bbox.ymin(),
+                bbox.zmin(),
+                bbox.xmax(),
+                bbox.ymax(),
+                bbox.zmax());
+  }
+  void invalidateOpenGLBuffers()
+  {
+      computeElements();
+      are_buffers_filled = false;
+      compute_bbox();
+  }
+
+  Scene_edges_item* clone() const {
+    Scene_edges_item* item = new Scene_edges_item();
+    item->edges = edges;
+    return item;
+  }
+
+  QString toolTip() const {
+    return
+      tr("<p><b>%1</b> (mode: %2, color: %3)<br />"
+         "<i>Edges</i></p>"
+         "<p>Number of edges: %4</p>")
+      .arg(this->name())
+      .arg(this->renderingModeName())
+      .arg(this->color().name())
+      .arg(edges.size());
+  }
+
+  // Indicate if rendering mode is supported
+  bool supportsRenderingMode(RenderingMode m) const {
+    return (m == Wireframe);
+  }
+
+
+
+  bool save(std::ostream& os) const
+  {
+    os.precision(17);
+    for(size_t i = 0, end = edges.size(); i < end; ++i){
+      os << "2 " << edges[i].source() << " " <<  edges[i].target() << "\n";
+    }
+    return true;
+  }
+
+public:
+  std::vector<Simple_kernel::Segment_3> edges;
+private:
+    mutable std::vector<float> positions_lines;
+
+  mutable QOpenGLShaderProgram *program;
+
+    using CGAL::Three::Scene_item::initializeBuffers;
+    void initializeBuffers(CGAL::Three::Viewer_interface *viewer)const
+    {
+        program = getShaderProgram(PROGRAM_NO_SELECTION, viewer);
+        program->bind();
+        vaos[0]->bind();
+
+        buffers[0].bind();
+        buffers[0].allocate(positions_lines.data(),
+                            static_cast<int>(positions_lines.size()*sizeof(float)));
+        program->enableAttributeArray("vertex");
+        program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
+        buffers[0].release();
+        program->release();
+
+        vaos[0]->release();
+        are_buffers_filled = true;
+    }
+    void computeElements() const
+    {
+       QApplication::setOverrideCursor(Qt::WaitCursor);
+       positions_lines.clear();
+
+       for(size_t i = 0, end = edges.size();
+           i < end; ++i)
+       {
+         const Simple_kernel::Point_3& a = edges[i].source();
+         const Simple_kernel::Point_3& b = edges[i].target();
+         positions_lines.push_back(a.x()); positions_lines.push_back(a.y()); positions_lines.push_back(a.z());
+         positions_lines.push_back(b.x()); positions_lines.push_back(b.y()); positions_lines.push_back(b.z());
+       }
+       QApplication::restoreOverrideCursor();
+    }
+    void drawEdges(CGAL::Three::Viewer_interface* viewer) const
+    {
+        if(!are_buffers_filled)
+            initializeBuffers(viewer);
+        vaos[0]->bind();
+        program = getShaderProgram(PROGRAM_NO_SELECTION);
+        attribBuffers(viewer, PROGRAM_NO_SELECTION);
+        program->bind();
+        program->setAttributeValue("colors",this->color());
+        viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(positions_lines.size()/3));
+        vaos[0]->release();
+        program->release();
+
+    }
+
+}; // end class Scene_edges_item
+
+class Q_DECL_EXPORT Scene_aabb_plane_item : public Scene_plane_item
+{
+  Q_OBJECT
+
+public:
+
+  typedef Simple_kernel::FT                                                  FT;
+  enum Cut_planes_types {
+    UNSIGNED_FACETS = 0, SIGNED_FACETS, UNSIGNED_EDGES, CUT_SEGMENTS
+  };
+  Scene_aabb_plane_item(const CGAL::Three::Scene_interface* scene_interface)
+    :Scene_plane_item(scene_interface)
+  {
+    for(int i=0; i<NbVaos; i++)
+    {
+      QOpenGLVertexArrayObject* n_vao = new QOpenGLVertexArrayObject();
+      vaos.push_back(n_vao);
+      n_vao->create();
+    }
+    for(int i=0; i<NbVbos; i++)
+    {
+      QOpenGLBuffer n_buf;
+      buffers.push_back(n_buf);
+      buffers[i].create();
+    }
+    m_grid_size = slow_distance_grid_size;
+    m_red_ramp.build_red();
+    m_blue_ramp.build_blue();
+    m_thermal_ramp.build_thermal();
+
+
+    texture = new Texture(m_grid_size,m_grid_size);
+    //UV Mapping
+    tex_map.push_back(0.0f);
+    tex_map.push_back(0.0f);
+
+    tex_map.push_back(0.0f);
+    tex_map.push_back(1.0f);
+
+    tex_map.push_back(1.0f);
+    tex_map.push_back(0.0f);
+
+    tex_map.push_back(1.0f);
+    tex_map.push_back(0.0f);
+
+    tex_map.push_back(0.0f);
+    tex_map.push_back(1.0f);
+
+    tex_map.push_back(1.0f);
+    tex_map.push_back(1.0f);
+
+    //Vertex source code
+    const char tex_vertex_source[] =
+    {
+        "#version 120 \n"
+        "attribute highp vec4 vertex;\n"
+        "attribute highp vec2 tex_coord; \n"
+        "uniform highp mat4 mvp_matrix;\n"
+        "uniform highp mat4 f_matrix;\n"
+        "varying highp vec2 texc;\n"
+        "void main(void)\n"
+        "{\n"
+        "   gl_Position = mvp_matrix * f_matrix * vertex;\n"
+        "    texc = tex_coord;\n"
+        "}"
+    };
+    //Vertex source code
+    const char tex_fragment_source[] =
+    {
+        "#version 120 \n"
+        "uniform sampler2D texture;\n"
+        "varying highp vec2 texc;\n"
+        "void main(void) { \n"
+        "gl_FragColor = texture2D(texture, texc.st);\n"
+        "} \n"
+        "\n"
+    };
+    QOpenGLShader *tex_vertex_shader = new QOpenGLShader(QOpenGLShader::Vertex);
+    if(!tex_vertex_shader->compileSourceCode(tex_vertex_source))
+    {
+        std::cerr<<"Compiling vertex source FAILED"<<std::endl;
+    }
+
+    QOpenGLShader *tex_fragment_shader= new QOpenGLShader(QOpenGLShader::Fragment);
+    if(!tex_fragment_shader->compileSourceCode(tex_fragment_source))
+    {
+        std::cerr<<"Compiling fragmentsource FAILED"<<std::endl;
+    }
+
+    tex_rendering_program = new QOpenGLShaderProgram();
+    if(!tex_rendering_program->addShader(tex_vertex_shader))
+    {
+        std::cerr<<"adding vertex shader FAILED"<<std::endl;
+    }
+    if(!tex_rendering_program->addShader(tex_fragment_shader))
+    {
+        std::cerr<<"adding fragment shader FAILED"<<std::endl;
+    }
+    if(!tex_rendering_program->link())
+    {
+        std::cerr<<"linking Program FAILED"<<std::endl;
+    }
+    Scene_plane_item::compute_normals_and_vertices();
+  }
+
+  ~Scene_aabb_plane_item()
+  {
+    delete texture;
+  }
+
+  void update_grid_size()const
+  {
+      m_grid_size = m_fast_distance ? fast_distance_grid_size
+                                    : slow_distance_grid_size;
+      delete texture;
+      texture = new Texture(m_grid_size,m_grid_size);
+  }
+
+  void set_facet_trees(Facet_trees *facet_trees)
+  {
+    this->facet_trees = facet_trees;
+  }
+
+  void set_edge_trees(Edge_trees *edge_trees)
+  {
+    this->edge_trees = edge_trees;
+  }
+  void draw(CGAL::Three::Viewer_interface* viewer) const
+  {
+    if(!are_buffers_filled)
+      initializeBuffers(viewer);
+    QMatrix4x4 fMatrix;
+    fMatrix.setToIdentity();
+    for(int i=0; i< 16 ; i++)
+      fMatrix.data()[i] =  frame->matrix()[i];
+
+    switch( m_cut_plane )
+    {
+    case UNSIGNED_EDGES:
+    case UNSIGNED_FACETS:
+    case SIGNED_FACETS:
+
+      viewer->glActiveTexture(GL_TEXTURE0);
+      viewer->glBindTexture(GL_TEXTURE_2D, textureId);
+
+      vaos[TexturedCutplane]->bind();
+
+      attribTexBuffers(viewer);
+
+      tex_rendering_program->bind();
+      tex_rendering_program->setUniformValue("f_matrix", fMatrix);
+      viewer->glDrawArrays(GL_TRIANGLES, 0,static_cast<GLsizei>(positions_quad.size()/3));
+      tex_rendering_program->release();
+      vaos[TexturedCutplane]->release();
+      break;
+
+    case CUT_SEGMENTS:
+      vaos[Facets]->bind();
+      program = getShaderProgram(PROGRAM_NO_SELECTION, viewer);
+      attribBuffers(viewer, PROGRAM_NO_SELECTION);
+      program->bind();
+      program->setUniformValue("f_matrix", fMatrix);
+      program->setAttributeValue("colors", this->color());
+      viewer->glDrawArrays(GL_TRIANGLES, 0,static_cast<GLsizei>(positions_quad.size()/3));
+
+      program->release();
+      vaos[Facets]->release();
+      break;
+    }
+  }
+  void drawEdges(CGAL::Three::Viewer_interface *viewer) const
+  {
+    if(m_cut_plane != CUT_SEGMENTS)
+      return;
+    QMatrix4x4 fMatrix;
+    fMatrix.setToIdentity();
+    for(int i=0; i< 16 ; i++)
+      fMatrix.data()[i] =  frame->matrix()[i];
+    vaos[Edges]->bind();
+    program = getShaderProgram(PROGRAM_NO_SELECTION, viewer);
+    attribBuffers(viewer, PROGRAM_NO_SELECTION);
+    program->bind();
+    program->setUniformValue("f_matrix", fMatrix);
+    program->setAttributeValue("colors", QColor(Qt::black));
+    viewer->glDrawArrays(GL_LINES, 0,static_cast<GLsizei>(positions_lines.size()/3));
+    program->release();
+    vaos[Edges]->release();
+  }
+
+  void invalidateOpenGLBuffers()
+  {
+    computeElements();
+    are_buffers_filled = false;
+  }
+
+  void set_fast_distance(bool b)const  { m_fast_distance = b; update_grid_size(); }
+  void setCutPlaneType(Cut_planes_types type){ m_cut_plane = type;}
+  Cut_planes_types cutPlaneType()const {return m_cut_plane;}
+private:
+  Edge_trees* edge_trees;
+  Facet_trees* facet_trees;
+  enum VAOs{
+    Facets = 0,
+    Edges,
+    TexturedCutplane,
+    NbVaos
+  };
+  enum VBOs{
+    Facets_vertices = 0,
+    Edges_vertices,
+    UVCoords,
+    NbVbos
+  };
+  typedef std::pair<Simple_kernel::Point_3,Simple_kernel::FT> Point_distance;
+  std::vector<QOpenGLVertexArrayObject*> vaos;
+  mutable int m_grid_size;
+  mutable bool m_fast_distance;
+  mutable QOpenGLShaderProgram* tex_rendering_program;
+  mutable Point_distance m_distance_function[100][100];
+  mutable GLuint textureId;
+  mutable Texture *texture;
+  // An aabb_tree indexing polyhedron facets/segments
+  mutable Color_ramp m_red_ramp;
+  mutable Color_ramp m_blue_ramp;
+  mutable Color_ramp m_thermal_ramp;
+  mutable Simple_kernel::FT m_max_distance_function;
+  mutable std::vector<float> tex_map;
+  mutable Cut_planes_types m_cut_plane;
+  mutable std::vector<QOpenGLBuffer> buffers;
+
+  template <typename Tree>
+  void compute_distance_function(QMap<QObject*, Tree*> *trees, bool is_signed = false)const
+  {
+
+    m_max_distance_function = FT(0);
+    FT diag = scene_diag();
+#ifndef CGAL_LINKED_WITH_TBB
+    const GLdouble* m = frame->matrix();
+    Simple_kernel::Aff_transformation_3 t = Simple_kernel::Aff_transformation_3 (m[0], m[4], m[8], m[12],
+        m[1], m[5], m[9], m[13],
+        m[2], m[6], m[10], m[14]);
+    const FT dx = 2*diag;
+    const FT dy = 2*diag;
+    const FT z (0);
+    const FT fd =  FT(1);
+    Tree *min_tree = NULL;
+    for(int i=0 ; i<m_grid_size ; ++i)
+    {
+      FT x = -diag/fd + FT(i)/FT(m_grid_size) * dx;
+      for(int j=0 ; j<m_grid_size ; ++j)
+      {
+        FT y = -diag/fd + FT(j)/FT(m_grid_size) * dy;
+
+        Simple_kernel::Point_3 query = t( Simple_kernel::Point_3(x,y,z) );
+        FT min = DBL_MAX;
+
+        Q_FOREACH(Tree *tree, trees->values())
+        {
+          if(is_signed && !qobject_cast<Scene_polyhedron_item*>(trees->key(tree))->polyhedron()->is_closed())
+            continue;
+          FT dist = CGAL::sqrt( tree->squared_distance(query) );
+          if(dist < min)
+          {
+            min = dist;
+            if(is_signed)
+              min_tree = tree;
+          }
+        }
+        if(min == DBL_MAX)
+          return;
+        m_distance_function[i][j] = Point_distance(query,min);
+        m_max_distance_function = (std::max)(min, m_max_distance_function);
+      }
+    }
+    if(is_signed)
+    {
+      for(int i=0 ; i<m_grid_size ; ++i)
+        for(int j=0 ; j<m_grid_size ; ++j)
+        {
+          typedef typename Tree::size_type size_type;
+          Simple_kernel::Vector_3 random_vec = random_vector();
+
+          const Simple_kernel::Point_3& p = m_distance_function[i][j].first;
+          const FT unsigned_distance = m_distance_function[i][j].second;
+
+          // get sign through ray casting (random vector)
+          Simple_kernel::Ray_3  ray(p, random_vec);
+          size_type nbi = min_tree->number_of_intersected_primitives(ray);
+
+          FT sign ( (nbi&1) == 0 ? 1 : -1);
+          m_distance_function[i][j].second = sign * unsigned_distance;
+        }
+    }
+#else
+    FillGridSize<Tree> f(m_grid_size, diag, m_distance_function, m_max_distance_function, trees, is_signed, frame);
+    tbb::parallel_for(tbb::blocked_range<size_t>(0, m_grid_size*m_grid_size), f);
+#endif
+  }
+
+  void compute_texture(int i, int j,Color_ramp pos_ramp ,Color_ramp neg_ramp)const
+  {
+    const FT& d00 = m_distance_function[i][j].second;
+    // determines grey level
+    FT i00 = (double)std::fabs(d00) / m_max_distance_function;
+
+    if(d00 > 0.0)
+      texture->setData(i,j,255*pos_ramp.r(i00),255*pos_ramp.g(i00),255*pos_ramp.b(i00));
+    else
+      texture->setData(i,j,255*neg_ramp.r(i00),255*neg_ramp.g(i00),255*neg_ramp.b(i00));
+
+
+  }
+
+#ifdef CGAL_LINKED_WITH_TBB
+  class FillTexture
+  {
+    std::size_t grid_size;
+    Color_ramp pos_ramp;
+    Color_ramp neg_ramp;
+    Scene_aabb_plane_item* item;
+  public :
+    FillTexture(std::size_t grid_size,
+                 Color_ramp pos_ramp,
+                 Color_ramp neg_ramp,
+                 Scene_aabb_plane_item* item
+                 )
+      :grid_size(grid_size), pos_ramp(pos_ramp), neg_ramp(neg_ramp), item(item) {}
+
+    void operator()(const tbb::blocked_range<std::size_t>& r) const
+    {
+      for(std::size_t t = r.begin(); t!= r.end(); ++t)
+      {
+        int i(t%grid_size), j(t/grid_size);
+        item->compute_texture(i,j, pos_ramp, neg_ramp);
+      }
+    }
+  };
+#endif
+
+  void computeElements()
+  {
+    switch(m_cut_plane)
+    {
+    case UNSIGNED_FACETS:
+      if ( facet_trees->empty() ) { return; }
+      compute_distance_function(facet_trees);
+      break;
+    case SIGNED_FACETS:
+      if ( facet_trees->empty() ) { return; }
+      compute_distance_function(facet_trees, true);
+
+      break;
+    case UNSIGNED_EDGES:
+      if ( edge_trees->empty() ) { return; }
+      compute_distance_function(edge_trees);
+      break;
+    default:
+      break;
+    }
+    //The texture
+    switch(m_cut_plane)
+    {
+    case SIGNED_FACETS:
+    {
+#ifndef CGAL_LINKED_WITH_TBB
+        for( int i=0 ; i < texture->getWidth(); i++ )
+        {
+            for( int j=0 ; j < texture->getHeight() ; j++)
+            {
+                compute_texture(i,j,m_red_ramp,m_blue_ramp);
+            }
+        }
+#else
+      FillTexture f(m_grid_size, m_red_ramp, m_blue_ramp, this);
+      tbb::parallel_for(tbb::blocked_range<size_t>(0, m_grid_size * m_grid_size), f);
+#endif
+        break;
+    }
+    case UNSIGNED_FACETS:
+    case UNSIGNED_EDGES:
+    {
+      #ifndef CGAL_LINKED_WITH_TBB
+        for( int i=0 ; i < texture->getWidth(); i++ )
+        {
+            for( int j=0 ; j < texture->getHeight() ; j++)
+            {
+                compute_texture(i,j,m_thermal_ramp,m_thermal_ramp);
+            }
+        }
+#else
+      FillTexture f(m_grid_size, m_thermal_ramp, m_thermal_ramp, this);
+      tbb::parallel_for(tbb::blocked_range<size_t>(0, m_grid_size * m_grid_size), f);
+#endif
+        break;
+    }
+    default:
+      break;
+    }
+  }
+
+  void initializeBuffers(CGAL::Three::Viewer_interface *viewer) const
+  {
+    if(GLuint(-1) == textureId) {
+        viewer->glGenTextures(1, &textureId);
+    }
+
+    //vaos for the basic cutting plane
+    {
+      program = getShaderProgram(PROGRAM_NO_SELECTION, viewer);
+      program->bind();
+      vaos[Facets]->bind();
+
+      buffers[Facets_vertices].bind();
+      buffers[Facets_vertices].allocate(positions_quad.data(),
+                          static_cast<int>(positions_quad.size()*sizeof(float)));
+      program->enableAttributeArray("vertex");
+      program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
+      buffers[Facets_vertices].release();
+      vaos[Facets]->release();
+
+
+      vaos[Edges]->bind();
+      buffers[Edges_vertices].bind();
+      buffers[Edges_vertices].allocate(positions_lines.data(),
+                          static_cast<int>(positions_lines.size()*sizeof(float)));
+      program->enableAttributeArray("vertex");
+      program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
+      buffers[Edges_vertices].release();
+      vaos[Edges]->release();
+
+
+      program->release();
+    }
+    //vao for the textured cutting planes
+    {
+      tex_rendering_program->bind();
+      vaos[TexturedCutplane]->bind();
+      buffers[Facets_vertices].bind();
+      tex_rendering_program->enableAttributeArray("vertex");
+      tex_rendering_program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
+      buffers[Facets_vertices].release();
+
+      buffers[UVCoords].bind();
+      buffers[UVCoords].allocate(tex_map.data(), static_cast<int>(tex_map.size()*sizeof(float)));
+      tex_rendering_program->attributeLocation("tex_coord");
+      tex_rendering_program->setAttributeBuffer("tex_coord",GL_FLOAT,0,2);
+      tex_rendering_program->enableAttributeArray("tex_coord");
+      buffers[UVCoords].release();
+
+      viewer->glBindTexture(GL_TEXTURE_2D, textureId);
+      viewer->glTexImage2D(GL_TEXTURE_2D,
+                   0,
+                   GL_RGB,
+                   texture->getWidth(),
+                   texture->getHeight(),
+                   0,
+                   GL_RGB,
+                   GL_UNSIGNED_BYTE,
+                   texture->getData());
+      viewer->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+      viewer->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+      viewer->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE );
+      viewer->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE );
+      tex_rendering_program->release();
+    }
+    are_buffers_filled = true;
+  }
+
+  void attribTexBuffers(CGAL::Three::Viewer_interface* viewer)const
+  {
+    QMatrix4x4 mvpMatrix;
+    double mat[16];
+    viewer->camera()->getModelViewProjectionMatrix(mat);
+    for(int i=0; i < 16; i++)
+    {
+        mvpMatrix.data()[i] = (float)mat[i];
+    }
+    tex_rendering_program->bind();
+    tex_rendering_program->setUniformValue("mvp_matrix", mvpMatrix);
+    tex_rendering_program->release();
+  }
+};
+using namespace CGAL::Three;
+class Polyhedron_demo_cut_plugin :
+  public QObject,
+  public Polyhedron_demo_plugin_interface,
+  public Polyhedron_demo_io_plugin_interface 
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+public:
+  Polyhedron_demo_cut_plugin() : QObject(), edges_item(0) {
+  }
+  
+  virtual ~Polyhedron_demo_cut_plugin();
+
+  bool applicable(QAction*) const {
+    // returns true if one polyhedron is in the entries
+    for (int i=0; i< scene->numberOfEntries(); ++i)
+    {
+      if ( qobject_cast<Scene_polyhedron_item*>(scene->item(i)) )
+        return true;
+    }
+    return false;
+  }
+
+  virtual QString name() const
+  {
+    return "cut-plugin";
+  }
+
+
+  virtual QString nameFilters() const
+  {
+    return "Segment soup file (*.polylines.txt *.cgal)";
+  }
+
+
+  bool canLoad() const
+  {
+    return false;
+  }
+
+  virtual CGAL::Three::Scene_item* load(QFileInfo /* fileinfo */)
+  {
+    return 0;
+  }
+
+  virtual bool canSave(const CGAL::Three::Scene_item* item)
+  {
+    // This plugin supports edges items
+    bool b = qobject_cast<const Scene_edges_item*>(item) != 0;
+    return b;
+  }
+
+
+  virtual bool save(const CGAL::Three::Scene_item* item, QFileInfo fileinfo)
+  {  // This plugin supports edges items
+    const Scene_edges_item* edges_item = 
+      qobject_cast<const Scene_edges_item*>(item);
+    
+    if(!edges_item){
+      return false;
+    }
+    
+    std::ofstream out(fileinfo.filePath().toUtf8());
+    
+    return (out && edges_item->save(out));
+  }
+
+  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface,
+            Messages_interface* m);
+  QList<QAction*> actions() const;
+
+  bool eventFilter(QObject *, QEvent *event)
+  {
+    if(!plane_item)
+      return false;
+    if(event->type() == QEvent::MouseButtonPress)
+    {
+      QMouseEvent * mevent = static_cast<QMouseEvent*>(event);
+      if ( mevent->modifiers() == Qt::ControlModifier )
+      {
+        plane_item->set_fast_distance(true);
+        plane_item->invalidateOpenGLBuffers();
+        plane_item->itemChanged();
+      }
+    }
+    else if(event->type() == QEvent::MouseButtonRelease)
+    {
+      QMouseEvent * mevent = static_cast<QMouseEvent*>(event);
+      if ( mevent->modifiers() == Qt::ControlModifier )
+      {
+        plane_item->set_fast_distance(false);
+        plane_item->invalidateOpenGLBuffers();
+        plane_item->itemChanged();
+      }
+    }
+    return false;
+  }
+
+public Q_SLOTS:
+
+  void updateCutPlane()
+  {
+    if(plane_item->manipulatedFrame()->isSpinning())
+      plane_item->set_fast_distance(true);
+     ready_to_cut = true;
+     QTimer::singleShot(0,this,SLOT(cut()));
+  }
+  void cut();
+  void computeIntersection();
+  void reset_edges() {
+    edges_item = 0;
+  }
+  void Intersection();
+  void SignedFacets();
+  void UnsignedFacets();
+  void UnsignedEdges();
+  void resetPlane()
+  {
+    plane_item = NULL;
+  }
+  void uncheckActions()
+  {
+   Q_FOREACH(QAction* action, _actions)
+    if(action->isChecked())
+    {
+      action->setChecked(false);
+      return;
+    }
+  }
+  void deleteTrees(CGAL::Three::Scene_item* sender)
+  {
+    Scene_polyhedron_item* item = qobject_cast<Scene_polyhedron_item*>(sender);
+    if(!item)
+      return;
+    if(facet_trees.keys().contains(item))
+    {
+      delete facet_trees[item];
+      facet_trees.remove(item);
+    }
+    if(edge_trees.keys().contains(item))
+    {
+      delete edge_trees[item];
+      edge_trees.remove(item);
+    }
+    if(facet_trees.empty())
+    {
+      if(plane_item)
+        scene->erase(scene->item_id(plane_item));
+      if(edges_item)
+        scene->erase(scene->item_id(edges_item));
+    }
+    else
+    {
+      ready_to_cut = true;
+      cut();
+    }
+  }
+  void updateTrees(int id);
+private:
+  QList<QAction*>_actions;
+  void createCutPlane();
+  CGAL::Three::Scene_interface* scene;
+  Messages_interface* messages;
+  Scene_aabb_plane_item* plane_item;
+  Scene_edges_item* edges_item;
+  QAction* actionIntersection;
+  QAction* actionSignedFacets;
+  QAction* actionUnsignedFacets;
+  QAction* actionUnsignedEdges;
+
+  bool ready_to_cut;
+  Facet_trees facet_trees;
+  Edge_trees edge_trees;
+}; // end Polyhedron_demo_cut_plugin
+
+
+Polyhedron_demo_cut_plugin::~Polyhedron_demo_cut_plugin()
+{
+  Q_FOREACH(Facet_tree *tree, facet_trees.values())
+  {
+    delete tree;
+  }
+    Q_FOREACH(Edge_tree *tree, edge_trees.values())
+    {
+      delete tree;
+    }
+}
+
+
+void Polyhedron_demo_cut_plugin::init(QMainWindow* mainWindow,
+                                      CGAL::Three::Scene_interface* scene_interface,
+                                      Messages_interface* m)
+{
+  scene = scene_interface;
+  messages = m;
+  actionIntersection = new QAction(tr("Cut Segments"), mainWindow);
+  actionSignedFacets = new QAction(tr("Signed Distance Function to Facets"), mainWindow);
+  actionUnsignedFacets= new QAction(tr("Unsigned Distance Function to Facets"), mainWindow);
+  actionUnsignedEdges = new QAction(tr("Unsigned Distance Function to Edges"), mainWindow);
+
+  actionIntersection->setProperty("subMenuName","3D Fast Intersection and Distance Computation");
+  actionSignedFacets->setProperty("subMenuName","3D Fast Intersection and Distance Computation");
+  actionUnsignedFacets->setProperty("subMenuName","3D Fast Intersection and Distance Computation");
+  actionUnsignedEdges->setProperty("subMenuName","3D Fast Intersection and Distance Computation");
+
+  ready_to_cut = true;
+  connect(actionIntersection, SIGNAL(triggered()),
+          this, SLOT(Intersection()));
+  connect(actionSignedFacets, SIGNAL(triggered()),
+          this, SLOT(SignedFacets()));
+  connect(actionUnsignedFacets, SIGNAL(triggered()),
+          this, SLOT(UnsignedFacets()));
+  connect(actionUnsignedEdges, SIGNAL(triggered()),
+          this, SLOT(UnsignedEdges()));
+  plane_item = NULL;
+  Scene* real_scene = static_cast<Scene*>(scene);
+    connect(real_scene, SIGNAL(itemAboutToBeDestroyed(CGAL::Three::Scene_item*)),
+            this, SLOT(deleteTrees(CGAL::Three::Scene_item*)));
+    connect(real_scene, SIGNAL(newItem(int)),
+            this, SLOT(updateTrees(int)));
+
+  QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
+  viewer->installEventFilter(this);
+
+  _actions << actionIntersection
+           << actionSignedFacets
+           << actionUnsignedFacets
+           << actionUnsignedEdges;
+  QActionGroup *group = new QActionGroup(mainWindow);
+  group->setExclusive(true);
+
+  Q_FOREACH(QAction *action, _actions)
+  {
+    action->setActionGroup(group);
+    action->setCheckable(true);
+  }
+
+}
+
+QList<QAction*> Polyhedron_demo_cut_plugin::actions() const {
+  return _actions;
+}
+
+void Polyhedron_demo_cut_plugin::updateTrees(int id)
+{
+if(plane_item &&
+   qobject_cast<Scene_polyhedron_item*>(scene->item(id)))
+  createCutPlane();
+}
+
+void Polyhedron_demo_cut_plugin::createCutPlane() {
+  bool updating = false;
+  Scene_aabb_plane_item::Cut_planes_types type;
+  int plane_id = -1;
+  if(plane_item)
+      updating = true;
+  if(updating)
+  {
+    type = plane_item->cutPlaneType();
+    plane_id = scene->item_id(plane_item);
+  }
+
+  plane_item = new Scene_aabb_plane_item(scene);
+  const CGAL::Three::Scene_interface::Bbox& bbox = scene->bbox();
+  plane_item->setPosition((bbox.xmin()+bbox.xmax())/2.f,
+                          (bbox.ymin()+bbox.ymax())/2.f,
+                          (bbox.zmin()+bbox.zmax())/2.f);
+  plane_item->setNormal(0., 0., 1.);
+  plane_item->setManipulatable(true);
+  plane_item->setClonable(false);
+  plane_item->setColor(Qt::green);
+  plane_item->setName(tr("Cutting plane"));
+  connect(plane_item->manipulatedFrame(), SIGNAL(modified()),
+          this, SLOT(updateCutPlane()));
+  connect(plane_item, SIGNAL(aboutToBeDestroyed()),
+          this, SLOT(resetPlane()));
+  connect(plane_item, SIGNAL(aboutToBeDestroyed()),
+          this, SLOT(uncheckActions()));
+  if(updating)
+  {
+    scene->replaceItem(plane_id, plane_item)->deleteLater();
+    plane_item->setCutPlaneType(type);
+  }
+  else
+    scene->addItem(plane_item);
+  // Hide polyhedrons and call cut() (avoid that nothing shows up until user
+  // decides to move the plane item)
+  for(int i = 0, end = scene->numberOfEntries(); i < end; ++i) {
+    CGAL::Three::Scene_item* item = scene->item(i);
+    Scene_polyhedron_item* poly_item = qobject_cast<Scene_polyhedron_item*>(item);
+    if ( NULL != poly_item )
+      poly_item->setVisible(false);
+  }
+  //fills the tree maps
+  for(int i = 0, end = scene->numberOfEntries(); i < end; ++i) {
+    CGAL::Three::Scene_item* item = scene->item(i);
+    Scene_polyhedron_item* poly_item = qobject_cast<Scene_polyhedron_item*>(item);
+    if(!poly_item) continue;
+    if(!poly_item->polyhedron()->is_pure_triangle())
+    {
+      messages->warning(QString("%1 ignored (not a triangulated mesh)").arg(poly_item->name()));
+      continue;
+    }
+    if(!poly_item->polyhedron()->is_closed())
+    {
+      messages->warning(QString("%1 is not closed. Signed function will not be displayed.").arg(poly_item->name()));
+    }
+    if(facet_trees.find(poly_item) == facet_trees.end()) {
+      facet_trees[poly_item] = new Facet_tree();
+      PPMAP pmap;
+      //filter facets to ignore degenerated ones
+      for(Polyhedron::Facet_iterator
+          fit = poly_item->polyhedron()->facets_begin(),
+          end = poly_item->polyhedron()->facets_end();
+          fit!=end; ++fit)
+      {
+        Polyhedron::Point a(fit->halfedge()->vertex()->point()),
+            b(fit->halfedge()->next()->vertex()->point()),
+            c(fit->halfedge()->prev()->vertex()->point());
+
+        if(!CGAL::collinear(a,b,c))
+          facet_trees[poly_item]->insert(Facet_primitive(fit, *poly_item->polyhedron(), pmap));
+      }
+
+      Scene_aabb_item* aabb_item = new Scene_aabb_item(*facet_trees[poly_item]);
+      aabb_item->setName(tr("AABB tree of %1").arg(poly_item->name()));
+      aabb_item->setRenderingMode(Wireframe);
+      aabb_item->setColor(Qt::black);
+      aabb_item->setVisible(false);
+      scene->addItem(aabb_item);
+    }
+    if(edge_trees.find(poly_item) == edge_trees.end()) {
+      edge_trees[poly_item] = new Edge_tree();
+      PPMAP pmap;
+      edge_trees[poly_item]->insert(edges(*poly_item->polyhedron()).first,
+                                    edges(*poly_item->polyhedron()).second,
+                                    *poly_item->polyhedron(),
+                                    pmap);
+    }
+  }
+  plane_item->set_facet_trees(&facet_trees);
+  plane_item->set_edge_trees(&edge_trees);
+  ready_to_cut = true;
+  cut();
+}
+
+void Polyhedron_demo_cut_plugin::Intersection()
+{
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  if(!plane_item)
+    createCutPlane();
+  plane_item->setCutPlaneType(Scene_aabb_plane_item::CUT_SEGMENTS);
+  computeIntersection();
+  plane_item->invalidateOpenGLBuffers();
+  QApplication::restoreOverrideCursor();
+}
+
+void Polyhedron_demo_cut_plugin::SignedFacets() {
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  if(!plane_item)
+    createCutPlane();
+  plane_item->setCutPlaneType(Scene_aabb_plane_item::SIGNED_FACETS);
+  plane_item->invalidateOpenGLBuffers();
+  if(edges_item)
+  {
+    scene->erase(scene->item_id(edges_item));
+    edges_item = NULL;
+  }
+  QApplication::restoreOverrideCursor();
+
+}
+void Polyhedron_demo_cut_plugin::UnsignedFacets() {
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  if(!plane_item)
+    createCutPlane();
+  plane_item->setCutPlaneType(Scene_aabb_plane_item::UNSIGNED_FACETS);
+  plane_item->invalidateOpenGLBuffers();
+  if(edges_item)
+  {
+    scene->erase(scene->item_id(edges_item));
+    edges_item = NULL;
+  }
+  QApplication::restoreOverrideCursor();
+}
+void Polyhedron_demo_cut_plugin::UnsignedEdges() {
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  if(!plane_item)
+    createCutPlane();
+  plane_item->setCutPlaneType(Scene_aabb_plane_item::UNSIGNED_EDGES);
+  plane_item->invalidateOpenGLBuffers();
+  if(edges_item)
+  {
+    scene->erase(scene->item_id(edges_item));
+    edges_item = NULL;
+  }
+  QApplication::restoreOverrideCursor();
+}
+
+void Polyhedron_demo_cut_plugin::computeIntersection()
+{
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  if(!edges_item) {
+    edges_item = new Scene_edges_item;
+    edges_item->setName("Edges of the Cut");
+    edges_item->setColor(Qt::red);
+    connect(edges_item, SIGNAL(destroyed()),
+            this, SLOT(reset_edges()));
+    scene->addItem(edges_item);
+  }
+
+  const qglviewer::Vec& pos = plane_item->manipulatedFrame()->position();
+  const qglviewer::Vec& n =
+      plane_item->manipulatedFrame()->inverseTransformOf(qglviewer::Vec(0.f, 0.f, 1.f));
+  Simple_kernel::Plane_3 plane(n[0], n[1],  n[2], - n * pos);
+  //std::cerr << plane << std::endl;
+  edges_item->edges.clear();
+  QTime time;
+  time.start();
+  bool does_intersect = false;
+  for(Facet_trees::iterator it = facet_trees.begin(); it != facet_trees.end(); ++it)
+  {
+    if(!CGAL::do_intersect(plane, it.value()->bbox()))
+      continue;
+    does_intersect = true;
+    std::vector<Facet_tree::Object_and_primitive_id> intersections;
+    it.value()->all_intersections(plane, std::back_inserter(intersections));
+
+    for ( std::vector<Facet_tree::Object_and_primitive_id>::iterator it = intersections.begin(),
+          end = intersections.end() ; it != end ; ++it )
+    {
+      const Simple_kernel::Segment_3* inter_seg =
+          CGAL::object_cast<Simple_kernel::Segment_3>(&(it->first));
+
+      if ( NULL != inter_seg )
+        edges_item->edges.push_back(*inter_seg);
+    }
+  }
+  if(does_intersect)
+    messages->information(QString("cut (%1 ms). %2 edges.").arg(time.elapsed()).arg(edges_item->edges.size()));
+  edges_item->invalidateOpenGLBuffers();
+  edges_item->itemChanged();
+  ready_to_cut = false;
+  QApplication::restoreOverrideCursor();
+}
+
+void Polyhedron_demo_cut_plugin::cut()
+{
+  if(!plane_item)
+    return;
+  switch(plane_item->cutPlaneType())
+  {
+  case Scene_aabb_plane_item::CUT_SEGMENTS:
+    if(ready_to_cut)
+    {
+      computeIntersection();
+    }
+    break;
+  default:
+    if(ready_to_cut)
+    {
+      ready_to_cut = false;
+      plane_item->invalidateOpenGLBuffers();
+    }
+  }
+}
+
+
+#include "Cut_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Camera_position/CMakeLists.txt b/3rdparty/CGAL/demo/Polyhedron/Plugins/Camera_position/CMakeLists.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Camera_position/CMakeLists.txt
rename to 3rdparty/CGAL/demo/Polyhedron/Plugins/Camera_position/CMakeLists.txt
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Camera_position/Camera_positions_list.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Camera_position/Camera_positions_list.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Camera_position/Camera_positions_list.cpp
rename to 3rdparty/CGAL/demo/Polyhedron/Plugins/Camera_position/Camera_positions_list.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Camera_position/Camera_positions_list.h b/3rdparty/CGAL/demo/Polyhedron/Plugins/Camera_position/Camera_positions_list.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Camera_position/Camera_positions_list.h
rename to 3rdparty/CGAL/demo/Polyhedron/Plugins/Camera_position/Camera_positions_list.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Camera_position/Camera_positions_list.ui b/3rdparty/CGAL/demo/Polyhedron/Plugins/Camera_position/Camera_positions_list.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Camera_position/Camera_positions_list.ui
rename to 3rdparty/CGAL/demo/Polyhedron/Plugins/Camera_position/Camera_positions_list.ui
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Camera_position/Camera_positions_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Camera_position/Camera_positions_plugin.cpp
new file mode 100644
index 0000000..2160f71
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Camera_position/Camera_positions_plugin.cpp
@@ -0,0 +1,52 @@
+#include <QtCore/qglobal.h>
+#include "Messages_interface.h"
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+#include <CGAL/Three/Polyhedron_demo_io_plugin_interface.h>
+
+#include "Camera_positions_list.h"
+#include <CGAL/Three/Viewer_interface.h>
+
+#include <QMainWindow>
+using namespace CGAL::Three;
+class Polyhedron_demo_camera_positions_plugin : 
+  public QObject,
+  public Polyhedron_demo_plugin_interface,
+  public CGAL::Three::Polyhedron_demo_io_plugin_interface
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface CGAL::Three::Polyhedron_demo_io_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0")
+
+public:
+  void init(QMainWindow* mainWindow, Scene_interface* scene_interface, Messages_interface* );
+  QList<QAction*> actions() const;
+
+  QString name() const { return "camera_positions_plugin"; }
+  QString nameFilters() const { return "Camera positions (*.camera.txt)"; }
+  bool canLoad() const { return true; }
+  Scene_item* load(QFileInfo fileinfo) { cpl->load(fileinfo.filePath()); return 0; }
+
+  bool canSave(const Scene_item*) { return false; }
+  bool save(const Scene_item*, QFileInfo ) {return false; }
+  bool applicable(QAction*) const {return false;}
+private:
+  Camera_positions_list* cpl;
+};
+
+void Polyhedron_demo_camera_positions_plugin::init(QMainWindow* mainWindow, Scene_interface*, Messages_interface *)
+{
+
+  cpl = new Camera_positions_list(mainWindow);
+  Viewer_interface* viewer = mainWindow->findChild<Viewer_interface*>("viewer");
+  cpl->setViewer(viewer);
+  mainWindow->addDockWidget(Qt::LeftDockWidgetArea, cpl);
+}
+
+QList<QAction*> 
+Polyhedron_demo_camera_positions_plugin::actions() const
+{
+  return QList<QAction*>();
+}
+
+#include "Camera_positions_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Convex_decomposition/CMakeLists.txt b/3rdparty/CGAL/demo/Polyhedron/Plugins/Convex_decomposition/CMakeLists.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Convex_decomposition/CMakeLists.txt
rename to 3rdparty/CGAL/demo/Polyhedron/Plugins/Convex_decomposition/CMakeLists.txt
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Convex_decomposition/Nef_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Convex_decomposition/Nef_plugin.cpp
new file mode 100644
index 0000000..13d28b6
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Convex_decomposition/Nef_plugin.cpp
@@ -0,0 +1,326 @@
+#include "Scene_polyhedron_item.h"
+#include "Scene_nef_polyhedron_item.h"
+
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+
+#include <QString>
+#include <QAction>
+#include <QMenu>
+#include <QMainWindow>
+#include <QApplication>
+#include <QTime>
+#include <QMessageBox>
+using namespace CGAL::Three;
+class Polyhedron_demo_nef_plugin :
+  public QObject,
+    public Polyhedron_demo_plugin_interface
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+public:
+
+void init(QMainWindow* mw,
+          Scene_interface* scene_interface,
+          Messages_interface* )
+{
+    scene = scene_interface;
+    this->mw = mw;
+    QAction *actionConvexDecomposition = new QAction("Convex Decomposition", mw);
+    actionConvexDecomposition->setProperty("subMenuName",
+                                           "Convex Decomposition");
+
+    QAction *actionToNef = new QAction("Convert to Nef Polyhedron", mw);
+    QAction *actionToPoly = new QAction("Convert to Normal Polyhedron", mw);
+    QAction *actionUnion = new QAction("Union (A/B)", mw);
+    QAction *actionIntersection = new QAction("Intersection (A/B)", mw);
+    QAction *actionDifference = new QAction("&Difference (A/B)", mw);
+    QAction *actionMinkowskiSum = new QAction("&Minkowski Sum (A/B)", mw);
+
+    connect(actionToNef       , SIGNAL(triggered()), this, SLOT(on_actionToNef_triggered()));
+    connect(actionToPoly      , SIGNAL(triggered()), this, SLOT(on_actionToPoly_triggered()));
+    connect(actionUnion       , SIGNAL(triggered()), this, SLOT(on_actionUnion_triggered()));
+    connect(actionIntersection, SIGNAL(triggered()), this, SLOT(on_actionIntersection_triggered()));
+    connect(actionDifference  , SIGNAL(triggered()), this, SLOT(on_actionDifference_triggered()));
+    connect(actionMinkowskiSum, SIGNAL(triggered()), this, SLOT(on_actionMinkowskiSum_triggered()));
+
+
+    _actions<< actionToNef
+            << actionToPoly
+            << actionUnion
+            << actionIntersection
+            << actionDifference
+            << actionMinkowskiSum;
+    Q_FOREACH(QAction * action, _actions)
+      action->setProperty("subMenuName",
+                          "Boolean Operations");
+    _actions<< actionConvexDecomposition;
+    connect(actionConvexDecomposition, SIGNAL(triggered()), this, SLOT(on_actionConvexDecomposition_triggered()));
+
+}
+
+  bool applicable(QAction*) const {
+    const int indexA = scene->selectionAindex();
+    const int indexB = scene->selectionBindex();
+
+    return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()))
+      || qobject_cast<Scene_nef_polyhedron_item*>(scene->item(scene->mainSelectionIndex()))
+      || qobject_cast<Scene_polyhedron_item*>(scene->item(indexA))
+      || qobject_cast<Scene_polyhedron_item*>(scene->item(indexB))
+      || qobject_cast<Scene_nef_polyhedron_item*>(scene->item(indexA))
+      || qobject_cast<Scene_nef_polyhedron_item*>(scene->item(indexB))
+      ;
+  }
+
+  QList<QAction*> actions() const {
+    return _actions;
+  }
+
+private:
+  Scene_interface* scene;
+  QList<QAction*> _actions;
+  QMainWindow* mw;
+
+  enum  Boolean_operation { BOOLEAN_UNION,
+                            BOOLEAN_INTERSECTION,
+                            BOOLEAN_DIFFERENCE,
+                            MINKOWSKI_SUM
+  };
+  void boolean_operation(const Boolean_operation operation);
+
+public Q_SLOTS:
+  void on_actionToNef_triggered();
+  void on_actionToPoly_triggered();
+  void on_actionUnion_triggered();
+  void on_actionIntersection_triggered();
+  void on_actionDifference_triggered();
+  void on_actionMinkowskiSum_triggered();
+  void on_actionConvexDecomposition_triggered();
+}; // end class Polyhedron_demo_nef_plugin
+
+void
+Polyhedron_demo_nef_plugin::on_actionToNef_triggered()
+{
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+
+  Scene_polyhedron_item* item =
+    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+
+  if(item)
+  {
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    QTime time;
+    time.start();
+    std::cerr << "Convert polyhedron to nef polyhedron...";
+
+    Scene_nef_polyhedron_item* new_nef_item =
+      Scene_nef_polyhedron_item::from_polyhedron(item);
+
+    new_nef_item->setName(tr("%1 (to nef)").arg(item->name()));
+    new_nef_item->setRenderingMode(item->renderingMode());
+    item->setVisible(false);
+    scene->itemChanged(index);
+    new_nef_item->invalidateOpenGLBuffers();
+    scene->addItem(new_nef_item);
+    std::cerr << "ok (" << time.elapsed() << " ms)" << std::endl;
+    QApplication::restoreOverrideCursor();
+  }
+}
+
+
+void
+Polyhedron_demo_nef_plugin::on_actionConvexDecomposition_triggered()
+{
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+
+  Scene_polyhedron_item* pitem =
+    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+
+  Scene_nef_polyhedron_item* item =
+    (pitem)? Scene_nef_polyhedron_item::from_polyhedron(pitem)
+           : qobject_cast<Scene_nef_polyhedron_item*>(scene->item(index));
+  QApplication::restoreOverrideCursor();
+  if(item) {
+    QTime time;
+    time.start();
+    std::cerr << "Convex decomposition...";
+
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    
+    std::list<Scene_polyhedron_item*> convex_parts;
+    item->convex_decomposition(convex_parts);
+    int i = 0;
+    for(std::list<Scene_polyhedron_item*>::iterator it = convex_parts.begin();
+        it != convex_parts.end();
+        ++it){
+      (*it)->setName(tr("part %1 of %2").arg(i++).arg(item->name()));
+      (*it)->setRenderingMode(item->renderingMode());
+      scene->addItem(*it);
+    }
+
+    if(pitem){
+      delete item;
+      pitem->setVisible(false);
+    } else {
+      item->setVisible(false);
+    }
+
+    std::cerr << "ok (" << time.elapsed() << " ms)" << std::endl;
+    QApplication::restoreOverrideCursor();
+  } else {
+    std::cerr << "Only a Polyhedron or a Nef Polyhedron can be decomposed in convex parts" << std::endl; 
+  }
+}
+
+void
+Polyhedron_demo_nef_plugin::on_actionToPoly_triggered()
+{
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+  
+  Scene_nef_polyhedron_item* item = 
+    qobject_cast<Scene_nef_polyhedron_item*>(scene->item(index));
+
+  if(item)
+  {
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    QTime time;
+    time.start();
+    std::cerr << "Convert nef polyhedron to polyhedron...";
+
+    if(!item->is_simple())
+    {
+      QMessageBox::warning(mw,
+                           tr("Cannot convert"),
+                           tr("The nef polyhedron \"%1\" is not simple, "
+                              "and thus cannot be converted!")
+                              .arg(item->name()));
+      return;
+    }
+
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    
+    Scene_polyhedron_item* new_item = item->convert_to_polyhedron();
+    new_item->setName(tr("%1 (from nef)").arg(item->name()));
+    new_item->setRenderingMode(item->renderingMode());
+    item->setVisible(false);
+    scene->itemChanged(index);
+    scene->addItem(new_item);
+    std::cerr << "ok (" << time.elapsed() << " ms)" << std::endl;
+    QApplication::restoreOverrideCursor();
+  }
+}
+
+void Polyhedron_demo_nef_plugin::on_actionUnion_triggered()
+{
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  boolean_operation(BOOLEAN_UNION);
+  QApplication::restoreOverrideCursor();
+}
+
+void Polyhedron_demo_nef_plugin::on_actionIntersection_triggered()
+{
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  boolean_operation(BOOLEAN_INTERSECTION);
+  QApplication::restoreOverrideCursor();
+}
+
+void Polyhedron_demo_nef_plugin::on_actionDifference_triggered()
+{
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  boolean_operation(BOOLEAN_DIFFERENCE);
+  QApplication::restoreOverrideCursor();
+}
+
+void
+Polyhedron_demo_nef_plugin::on_actionMinkowskiSum_triggered()
+{
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  boolean_operation(MINKOWSKI_SUM);
+  QApplication::restoreOverrideCursor();
+}
+
+void Polyhedron_demo_nef_plugin::boolean_operation(const Boolean_operation operation)
+{
+  const int indexA = scene->selectionAindex();
+  const int indexB = scene->selectionBindex();
+
+  if(indexA < 0 || indexB < 0) return;
+  if(indexA == indexB) return;
+
+  if(qobject_cast<Scene_polyhedron_item*>(scene->item(indexA)) ||
+     qobject_cast<Scene_polyhedron_item*>(scene->item(indexB))) {
+    QMenu* menu = mw->findChild<QMenu*>("menu_Boolean_operations");
+    if(!menu) qWarning("Do not find object named \"menu_Boolean_operations\"!");
+    QMessageBox::warning(mw,
+                         tr("Boolean operation cannot be applied on normal polyhedron"),
+                         tr("You need to call the operation \"%1\" in the menu \"%2\".")
+                         .arg(QString("Convert to Nef Polyhedron"))
+                         .arg(menu ? menu->title() : "Boolean Operations"));
+  }
+  Scene_nef_polyhedron_item* itemA = 
+    qobject_cast<Scene_nef_polyhedron_item*>(scene->item(indexA));
+  Scene_nef_polyhedron_item* itemB = 
+    qobject_cast<Scene_nef_polyhedron_item*>(scene->item(indexB));
+  if(!itemA || !itemB)
+    return;
+
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+
+  // copy itemA
+  Scene_nef_polyhedron_item* new_item = 0;
+  if(operation != MINKOWSKI_SUM) {
+    new_item = new Scene_nef_polyhedron_item(*itemA->nef_polyhedron());
+  };
+
+ // perform Boolean operation
+  std::cout << "Boolean operation...";
+  QTime time;
+  time.start();
+  switch(operation)
+  {
+  case BOOLEAN_UNION:
+    (*new_item) += (*itemB);
+    break;
+  case BOOLEAN_INTERSECTION:
+    (*new_item) *= (*itemB);
+    break;
+  case BOOLEAN_DIFFERENCE:
+    (*new_item) -= (*itemB);
+    break;
+  case MINKOWSKI_SUM:
+    new_item = Scene_nef_polyhedron_item::sum(*itemA, 
+                                              *itemB);
+  }
+  std::cout << "ok (" << time.elapsed() << " ms)" << std::endl;
+
+  QString name;
+  switch(operation)
+  {
+  case BOOLEAN_UNION:
+    name = tr("%1 union %2");
+    break;
+  case BOOLEAN_INTERSECTION:
+    name = tr("%1 intersection %2");
+    break;
+  case BOOLEAN_DIFFERENCE:
+    name = tr("%1 minus %2");
+    break;
+  case MINKOWSKI_SUM:
+    name = tr("Minkowski sum of %1 and %2");
+  }
+  
+  new_item->setName(name.arg(itemA->name(), itemB->name()));
+  new_item->setColor(Qt::green);
+  new_item->setRenderingMode(FlatPlusEdges);
+  itemA->setRenderingMode(Wireframe);
+  itemB->setRenderingMode(Wireframe);
+  scene->addItem(new_item);
+  scene->itemChanged(indexA);
+  scene->itemChanged(indexB);
+
+  QApplication::restoreOverrideCursor();
+}
+
+#include "Nef_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Convex_hull/CMakeLists.txt b/3rdparty/CGAL/demo/Polyhedron/Plugins/Convex_hull/CMakeLists.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Convex_hull/CMakeLists.txt
rename to 3rdparty/CGAL/demo/Polyhedron/Plugins/Convex_hull/CMakeLists.txt
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Convex_hull/Convex_hull_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Convex_hull/Convex_hull_plugin.cpp
new file mode 100644
index 0000000..54a2f58
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Convex_hull/Convex_hull_plugin.cpp
@@ -0,0 +1,132 @@
+#include <QTime>
+#include <QApplication>
+#include <QAction>
+#include <QStringList>
+
+#include "opengl_tools.h"
+#include "Scene_polyhedron_item.h"
+#include "Scene_points_with_normal_item.h"
+#include "Scene_polylines_item.h"
+#include "Scene_polyhedron_selection_item.h"
+#include "Polyhedron_type.h"
+
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+
+#include <CGAL/convex_hull_3.h>
+#include <boost/iterator/transform_iterator.hpp>
+using namespace CGAL::Three;
+class Polyhedron_demo_convex_hull_plugin : 
+  public QObject,
+  public Polyhedron_demo_plugin_interface
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+public:
+    void init(QMainWindow*mw,
+              Scene_interface* scene_interface,
+              Messages_interface*)
+    {
+        scene = scene_interface;
+        QAction *actionConvexHull = new QAction("Convex Hull", mw);
+        actionConvexHull->setProperty("subMenuName","3D Convex Hulls");
+        connect(actionConvexHull, SIGNAL(triggered()), this, SLOT(on_actionConvexHull_triggered()));
+        _actions <<actionConvexHull;
+    }
+
+  QList<QAction*> actions()const {return _actions;}
+
+  bool applicable(QAction*) const {
+    return 
+      qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex())) ||
+      qobject_cast<Scene_polylines_item*>(scene->item(scene->mainSelectionIndex())) ||
+      qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex())) ||
+      qobject_cast<Scene_polyhedron_selection_item*>(scene->item(scene->mainSelectionIndex()));
+  }
+
+public Q_SLOTS:
+  void on_actionConvexHull_triggered();
+private:
+  QList<QAction*> _actions;
+  Scene_interface* scene;
+}; // end Polyhedron_demo_convex_hull_plugin
+
+// for transform iterator
+struct Get_point {
+  typedef const Polyhedron::Point_3& result_type;
+  result_type operator()(const Polyhedron::Vertex_handle v) const
+  { return v->point(); }
+};
+
+void Polyhedron_demo_convex_hull_plugin::on_actionConvexHull_triggered()
+{
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+  
+  Scene_polyhedron_item* poly_item = 
+    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+
+  Scene_points_with_normal_item* pts_item =
+    qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
+  
+  Scene_polylines_item* lines_item = 
+    qobject_cast<Scene_polylines_item*>(scene->item(index));
+  
+  Scene_polyhedron_selection_item* selection_item = 
+    qobject_cast<Scene_polyhedron_selection_item*>(scene->item(index));
+
+  if(poly_item || pts_item || lines_item || selection_item)
+  {
+    // wait cursor
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    
+    QTime time;
+    time.start();
+    std::cout << "Convex hull...";
+
+    // add convex hull as new polyhedron
+    Polyhedron *pConvex_hull = new Polyhedron;
+    if(selection_item) {
+      CGAL::convex_hull_3(
+        boost::make_transform_iterator(selection_item->selected_vertices.begin(), Get_point()),
+        boost::make_transform_iterator(selection_item->selected_vertices.end(), Get_point()),
+        *pConvex_hull);
+    }
+    else if ( poly_item ){
+      Polyhedron* pMesh = poly_item->polyhedron();  
+      CGAL::convex_hull_3(pMesh->points_begin(),pMesh->points_end(),*pConvex_hull);
+    }
+    else{
+      if (pts_item)
+        CGAL::convex_hull_3(pts_item->point_set()->begin(),pts_item->point_set()->end(),*pConvex_hull);
+      else{
+        std::size_t nb_points=0;
+        for(std::list<std::vector<Kernel::Point_3> >::const_iterator it = lines_item->polylines.begin();
+            it != lines_item->polylines.end();
+            ++it)  nb_points+=it->size();
+
+        std::vector<Kernel::Point_3> all_points;
+        all_points.reserve( nb_points );
+
+        for(std::list<std::vector<Kernel::Point_3> >::const_iterator it = lines_item->polylines.begin();
+            it != lines_item->polylines.end();
+            ++it)  std::copy(it->begin(), it->end(),std::back_inserter( all_points ) );
+        
+        CGAL::convex_hull_3(all_points.begin(),all_points.end(),*pConvex_hull);
+      }
+    }
+    std::cout << "ok (" << time.elapsed() << " ms)" << std::endl;
+
+    Scene_polyhedron_item* new_item = new Scene_polyhedron_item(pConvex_hull);
+    new_item->setName(tr("%1 (convex hull)").arg(scene->item(index)->name()));
+    new_item->setColor(Qt::magenta);
+    new_item->setRenderingMode(FlatPlusEdges);
+    scene->addItem(new_item);
+
+    // default cursor
+    QApplication::restoreOverrideCursor();
+  }
+
+
+}
+
+#include "Convex_hull_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Convex_hull/Kernel_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Convex_hull/Kernel_plugin.cpp
new file mode 100644
index 0000000..370f5f8
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Convex_hull/Kernel_plugin.cpp
@@ -0,0 +1,147 @@
+#include <QApplication>
+#include <QMainWindow>
+#include <QMessageBox>
+#include <QAction>
+#include <QStringList>
+
+#include "Scene_polyhedron_item.h"
+#include "Polyhedron_type.h"
+
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+#include <CGAL/Exact_rational.h>
+#include <CGAL/Polyhedron_kernel.h>
+#include <CGAL/convex_hull_3.h>
+#include <CGAL/Dualizer.h>
+#include <CGAL/translate.h>
+
+#include "Kernel_type.h"
+typedef Kernel::Triangle_3 Triangle;
+typedef Kernel::Point_3 Point;
+typedef Kernel::Vector_3 Vector;
+typedef Kernel::Plane_3 Plane;
+typedef Kernel::FT FT;
+using namespace CGAL::Three;
+class Polyhedron_demo_kernel_plugin : 
+  public QObject,
+  public Polyhedron_demo_plugin_interface
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+public:
+  QList<QAction*> actions() const {
+    return _actions;
+  }
+
+  bool applicable(QAction*) const { 
+    return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
+  }
+
+   void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*)
+   {
+     scene = scene_interface;
+     mw = mainWindow;
+     QAction* actionKernel = new QAction(tr("Kernel"), mainWindow);
+     connect(actionKernel, SIGNAL(triggered()),
+             this, SLOT(on_actionKernel_triggered()));
+     _actions << actionKernel;
+   }
+public Q_SLOTS:
+  void on_actionKernel_triggered();
+private:
+  QList<QAction*> _actions;
+  CGAL::Three::Scene_interface* scene;
+  QMainWindow* mw;
+
+}; // end Polyhedron_demo_kernel_plugin
+
+
+void Polyhedron_demo_kernel_plugin::on_actionKernel_triggered()
+{
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+  
+  Scene_polyhedron_item* item = 
+    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+
+  if(item)
+  {
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    Polyhedron* pMesh = item->polyhedron();
+
+    typedef CGAL::Exact_rational ET;
+    typedef Polyhedron_kernel<Kernel,ET> Polyhedron_kernel;
+
+    // get triangles from polyhedron
+    std::list<Triangle> triangles;
+    get_triangles(*pMesh,std::back_inserter(triangles));
+
+    // solve LP 
+    std::cout << "Solve linear program..." << triangles.size();
+    Polyhedron_kernel kernel;
+    if(!kernel.solve(triangles.begin(),triangles.end()))
+    {
+      std::cout << "done (empty kernel)" << std::endl;
+      QMessageBox::information(mw, tr("Empty kernel"),
+                               tr("The kernel of the polyhedron \"%1\" is empty.").
+                               arg(item->name()));
+      QApplication::restoreOverrideCursor();
+      return;
+    }
+    std::cout << "done" << std::endl;
+
+    // add kernel as new polyhedron
+    Polyhedron *pKernel = new Polyhedron;
+
+    // get inside point
+    Point inside_point = kernel.inside_point();
+    Vector translate = inside_point - CGAL::ORIGIN;
+
+    // compute dual of translated polyhedron w.r.t. inside point.
+    std::cout << "Compute dual of translated polyhedron...";
+    std::list<Point> dual_points;
+    std::list<Triangle>::iterator it;
+    for(it = triangles.begin();
+      it != triangles.end();
+      it++)
+    {
+      const Triangle& triangle = *it;
+      const Point p0 = triangle[0] - translate;
+      const Point p1 = triangle[1] - translate;
+      const Point p2 = triangle[2] - translate;
+      Plane plane(p0,p1,p2); 
+      Vector normal = plane.orthogonal_vector();
+      normal = normal / std::sqrt(normal*normal);
+      // compute distance to origin (do not use plane.d())
+      FT distance_to_origin = std::sqrt(CGAL::squared_distance(Point(CGAL::ORIGIN),plane));
+      Point dual_point = CGAL::ORIGIN + normal / distance_to_origin;
+      dual_points.push_back(dual_point);
+    }
+    std::cout << "ok" << std::endl;
+
+    // compute convex hull in dual space
+    std::cout << "convex hull in dual space...";
+    Polyhedron convex_hull;
+    CGAL::convex_hull_3(dual_points.begin(),dual_points.end(),convex_hull);
+    std::cout << "ok" << std::endl;
+
+    // dualize and translate back to get final kernel
+    Dualizer<Polyhedron,Kernel> dualizer;
+    dualizer.run(convex_hull,*pKernel);
+    ::translate<Polyhedron,Kernel>(*pKernel,translate);
+    pKernel->inside_out();
+
+    Scene_polyhedron_item* new_item = new Scene_polyhedron_item(pKernel);
+    new_item->setName(tr("%1 (kernel)").arg(item->name()));
+    new_item->setColor(Qt::magenta);
+    new_item->setRenderingMode(item->renderingMode());
+    item->setRenderingMode(Wireframe);
+
+    scene->addItem(new_item);
+    scene->itemChanged(item);
+
+    QApplication::restoreOverrideCursor();
+  }
+}
+
+#include "Kernel_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/IO/Add_point_set_dialog.ui b/3rdparty/CGAL/demo/Polyhedron/Plugins/IO/Add_point_set_dialog.ui
new file mode 100644
index 0000000..5c3eea4
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/IO/Add_point_set_dialog.ui
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Add_point_set_dialog</class>
+ <widget class="QDialog" name="Add_point_set_dialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Create a Point Set</string>
+  </property>
+  <layout class="QHBoxLayout" name="horizontalLayout_2">
+   <item>
+    <layout class="QVBoxLayout" name="verticalLayout">
+     <property name="sizeConstraint">
+      <enum>QLayout::SetMinimumSize</enum>
+     </property>
+     <item>
+      <widget class="QTextEdit" name="textEdit">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="html">
+        <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;">
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html></string>
+       </property>
+       <property name="overwriteMode">
+        <bool>false</bool>
+       </property>
+       <property name="placeholderText">
+        <string notr="true">Point set format:  Ax Ay A3 Bx By Bz ... Zx Zy Zz </string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <layout class="QHBoxLayout" name="horizontalLayout_3">
+       <item>
+        <widget class="QLabel" name="label">
+         <property name="text">
+          <string>Item's name:</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QLineEdit" name="name_lineEdit">
+         <property name="autoFillBackground">
+          <bool>true</bool>
+         </property>
+         <property name="text">
+          <string/>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+     <item>
+      <layout class="QHBoxLayout" name="horizontalLayout">
+       <property name="sizeConstraint">
+        <enum>QLayout::SetMinimumSize</enum>
+       </property>
+       <item>
+        <widget class="QPushButton" name="add_point_setButton">
+         <property name="text">
+          <string>Add point set</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <spacer name="horizontalSpacer">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>40</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item>
+        <widget class="QPushButton" name="close_point_setButton">
+         <property name="text">
+          <string>Close</string>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/IO/Add_polylines_dialog.ui b/3rdparty/CGAL/demo/Polyhedron/Plugins/IO/Add_polylines_dialog.ui
new file mode 100644
index 0000000..c386531
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/IO/Add_polylines_dialog.ui
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Add_polylines_dialog</class>
+ <widget class="QDialog" name="Add_polylines_dialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>459</width>
+    <height>332</height>
+   </rect>
+  </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="windowTitle">
+   <string>Add polylines</string>
+  </property>
+  <layout class="QHBoxLayout" name="horizontalLayout_2">
+   <item>
+    <layout class="QVBoxLayout" name="verticalLayout">
+     <property name="sizeConstraint">
+      <enum>QLayout::SetMinimumSize</enum>
+     </property>
+     <item>
+      <widget class="QTextEdit" name="textEdit">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="html">
+        <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;">
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html></string>
+       </property>
+       <property name="overwriteMode">
+        <bool>false</bool>
+       </property>
+       <property name="placeholderText">
+        <string notr="true">Polyline format:  Ax Ay Az Bx By Bz ... Zx Zy Zz </string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <layout class="QHBoxLayout" name="horizontalLayout_3">
+       <item>
+        <widget class="QLabel" name="label">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="text">
+          <string>Item's name :</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QLineEdit" name="name_lineEdit">
+         <property name="autoFillBackground">
+          <bool>true</bool>
+         </property>
+         <property name="text">
+          <string/>
+         </property>
+         <property name="clearButtonEnabled">
+          <bool>false</bool>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+     <item>
+      <layout class="QHBoxLayout" name="horizontalLayout">
+       <property name="sizeConstraint">
+        <enum>QLayout::SetMinimumSize</enum>
+       </property>
+       <item>
+        <widget class="QPushButton" name="add_polylineButton">
+         <property name="text">
+          <string>Create Polyline Item</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <spacer name="horizontalSpacer">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>40</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item>
+        <widget class="QPushButton" name="close_polylineButton">
+         <property name="text">
+          <string>Close</string>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/IO/CMakeLists.txt b/3rdparty/CGAL/demo/Polyhedron/Plugins/IO/CMakeLists.txt
new file mode 100644
index 0000000..4f14780
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/IO/CMakeLists.txt
@@ -0,0 +1,59 @@
+include( polyhedron_demo_macros )
+
+polyhedron_demo_plugin(gocad_plugin GOCAD_io_plugin)
+target_link_libraries(gocad_plugin scene_polyhedron_item)
+
+qt5_wrap_ui( funcUI_FILES Function_dialog.ui )
+polyhedron_demo_plugin(io_implicit_function_plugin Implicit_function_io_plugin ${funcUI_FILES})
+target_link_libraries(io_implicit_function_plugin scene_implicit_function_item)
+
+polyhedron_demo_plugin(nef_io_plugin Nef_io_plugin)
+target_link_libraries(nef_io_plugin  scene_nef_polyhedron_item)
+
+qt5_wrap_ui( statisticsPolyhedronUI_FILES Polyhedron_demo_statistics_on_polyhedron_dialog.ui)
+polyhedron_demo_plugin(off_plugin OFF_io_plugin)
+target_link_libraries(off_plugin scene_polyhedron_item scene_polygon_soup_item scene_points_with_normal_item)
+
+polyhedron_demo_plugin(off_to_nef_plugin OFF_to_nef_io_plugin)
+target_link_libraries(off_to_nef_plugin scene_nef_polyhedron_item)
+
+qt5_wrap_ui( polylines_ioUI_FILES Add_polylines_dialog.ui )
+polyhedron_demo_plugin(polylines_io_plugin Polylines_io_plugin ${polylines_ioUI_FILES})
+target_link_libraries(polylines_io_plugin scene_polylines_item)
+
+polyhedron_demo_plugin(selection_io_plugin Selection_io_plugin)
+target_link_libraries(selection_io_plugin scene_polyhedron_selection_item)
+
+polyhedron_demo_plugin(stl_plugin STL_io_plugin)
+target_link_libraries(stl_plugin scene_polyhedron_item scene_polygon_soup_item)
+
+polyhedron_demo_plugin(surface_mesh_io_plugin Surface_mesh_io_plugin)
+target_link_libraries(surface_mesh_io_plugin scene_surface_mesh_item scene_polygon_soup_item)
+
+
+
+find_package(VTK QUIET COMPONENTS
+  vtkCommonCore vtkIOCore vtkIOLegacy vtkIOXML vtkFiltersCore vtkFiltersSources)
+if (VTK_FOUND)
+  include(${VTK_USE_FILE})
+  if ("${VTK_VERSION_MAJOR}" GREATER "5")
+    if(VTK_LIBRARIES)
+      polyhedron_demo_plugin(vtk_plugin VTK_io_plugin)
+      target_link_libraries(vtk_plugin scene_polyhedron_item scene_polylines_item
+                                        vtkCommonCore vtkIOCore vtkIOLegacy vtkIOXML
+                                        vtkFiltersCore vtkFiltersSources)
+    else()
+      message(STATUS "NOTICE : the vtk IO plugin needs VTK libraries and will not be compiled.")
+    endif()
+  else()
+    message(STATUS "NOTICE : the vtk IO plugin needs VTK 6.0 or greater and will not be compiled (incorrect version found).")
+  endif()
+else()
+  message(STATUS "NOTICE : the vtk IO plugin needs VTK 6.0 or greater and will not be compiled.")
+endif()
+qt5_wrap_ui( xyzUI_FILES Add_point_set_dialog.ui)
+polyhedron_demo_plugin(xyz_plugin XYZ_io_plugin ${xyzUI_FILES})
+target_link_libraries(xyz_plugin scene_points_with_normal_item)
+
+polyhedron_demo_plugin(ply_to_xyz_plugin PLY_to_xyz_io_plugin)
+target_link_libraries(ply_to_xyz_plugin scene_points_with_normal_item)
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/IO/Function_dialog.ui b/3rdparty/CGAL/demo/Polyhedron/Plugins/IO/Function_dialog.ui
new file mode 100644
index 0000000..abd1e87
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/IO/Function_dialog.ui
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>FunctionDialog</class>
+ <widget class="QDialog" name="FunctionDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>242</width>
+    <height>97</height>
+   </rect>
+  </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="windowTitle">
+   <string>Load Function</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <widget class="QLabel" name="label">
+     <property name="text">
+      <string>Please choose the function to load:</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QComboBox" name="functionList"/>
+   </item>
+   <item>
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item>
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>FunctionDialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>248</x>
+     <y>254</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>FunctionDialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>316</x>
+     <y>260</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/IO/GOCAD_io_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/IO/GOCAD_io_plugin.cpp
new file mode 100644
index 0000000..30ffd27
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/IO/GOCAD_io_plugin.cpp
@@ -0,0 +1,109 @@
+#include "Scene_polyhedron_item.h"
+#include "Scene_polygon_soup_item.h"
+#include "Kernel_type.h"
+#include "Polyhedron_type.h"
+#include <CGAL/gocad_io.h>
+#include <CGAL/Timer.h>
+#include <CGAL/Three/Polyhedron_demo_io_plugin_interface.h>
+#include <fstream>
+
+#include <QColor>
+
+using namespace CGAL::Three;
+
+class Polyhedron_demo_gocad_plugin :
+  public QObject,
+  public Polyhedron_demo_io_plugin_interface
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0")
+
+public:
+  QString nameFilters() const;
+  QString name() const { return "gocad_plugin"; }
+  bool canLoad() const;
+  CGAL::Three::Scene_item* load(QFileInfo fileinfo);
+
+  bool canSave(const CGAL::Three::Scene_item*);
+  bool save(const CGAL::Three::Scene_item*, QFileInfo fileinfo);
+};
+
+QString Polyhedron_demo_gocad_plugin::nameFilters() const {
+  return "GOCAD files (*.ts)";
+}
+
+bool Polyhedron_demo_gocad_plugin::canLoad() const {
+  return true;
+}
+
+
+CGAL::Three::Scene_item*
+Polyhedron_demo_gocad_plugin::load(QFileInfo fileinfo) {
+
+  // Open file
+  std::ifstream in(fileinfo.filePath().toUtf8());
+  if(!in) {
+    std::cerr << "Error! Cannot open file " << (const char*)fileinfo.filePath().toUtf8() << std::endl;
+    return NULL;
+  }
+    
+  // Try to read GOCAD file in a polyhedron
+
+  CGAL::Timer t;
+  t.start();
+  Scene_polyhedron_item* item = new Scene_polyhedron_item(Polyhedron());
+  Polyhedron& P = * const_cast<Polyhedron*>(item->polyhedron());
+  
+  std::string name, color;
+  if(! read_gocad(P, in, name, color)){
+    // std::cerr << "Error: Invalid polyhedron" << std::endl;
+    delete item;
+    return 0;
+  }   
+
+  t.stop();
+  std::cerr << "Reading took " << t.time() << " sec." << std::endl;
+  if(name.size() == 0){
+    item->setName(fileinfo.baseName());
+  } else {
+    item->setName(name.c_str());
+  }
+  QColor qcolor(color.c_str());
+  if(qcolor.isValid()) 
+  {  
+    item->setColor(qcolor);
+    item->invalidateOpenGLBuffers();
+  }
+  
+
+  return item;
+}
+
+bool Polyhedron_demo_gocad_plugin::canSave(const CGAL::Three::Scene_item* item)
+{
+  // This plugin supports polyhedrons
+  return qobject_cast<const Scene_polyhedron_item*>(item);
+}
+
+bool Polyhedron_demo_gocad_plugin::save(const CGAL::Three::Scene_item* item, QFileInfo fileinfo)
+{
+  // This plugin supports polyhedrons
+  const Scene_polyhedron_item* poly_item = 
+    qobject_cast<const Scene_polyhedron_item*>(item);
+ 
+  if(!poly_item)
+    return false;
+
+  std::ofstream out(fileinfo.filePath().toUtf8());
+  out.precision (std::numeric_limits<double>::digits10 + 2);
+  Polyhedron* poly = const_cast<Polyhedron*>(poly_item->polyhedron());
+
+  write_gocad(*poly, out, qPrintable(fileinfo.baseName()));
+
+  
+  return true;
+
+}
+
+#include "GOCAD_io_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/IO/Implicit_function_io_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/IO/Implicit_function_io_plugin.cpp
new file mode 100644
index 0000000..bfb8d67
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/IO/Implicit_function_io_plugin.cpp
@@ -0,0 +1,210 @@
+// Copyright (c) 2010 INRIA Sophia-Antipolis (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
+// 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(s)     : Stephane Tayeb
+//
+//******************************************************************************
+// File Description : 
+//******************************************************************************
+
+#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
+#include <CGAL/Three/Polyhedron_demo_io_plugin_interface.h>
+
+#include "implicit_functions/Implicit_function_interface.h"
+#include "Scene_implicit_function_item.h"
+#include "ui_Function_dialog.h"
+
+#include <iostream>
+
+#include <QAction>
+#include <QMainWindow>
+#include <QPluginLoader>
+#include <QDir>
+#include <QMenu>
+#include <QList>
+#include <QLibrary>
+using namespace CGAL::Three;
+class Io_implicit_function_plugin :
+  public QObject, 
+  // public Polyhedron_demo_plugin_interface,
+  protected Polyhedron_demo_plugin_helper
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+public:
+  Io_implicit_function_plugin();
+  virtual ~Io_implicit_function_plugin() {}
+
+  bool applicable(QAction*) const { return true; }
+
+  QString name() const { return "implicit functions"; }
+  // QString nameFilters() const { return ""; }
+  // bool canLoad() const { return false; }
+  
+
+  typedef Polyhedron_demo_plugin_helper Plugin_helper;
+  
+  using Plugin_helper::init;
+  virtual void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*);
+  
+  QList<QAction*> actions() const
+  {
+    return QList<QAction*>();
+  }
+  
+public Q_SLOTS:
+  void load_function() const;
+  
+private:
+  void load_function_plugins();
+  
+private:
+  QList<Implicit_function_interface*> functions_;
+};
+
+
+
+Io_implicit_function_plugin::
+Io_implicit_function_plugin()
+{
+  load_function_plugins();
+}
+
+
+void
+Io_implicit_function_plugin::
+init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface *)
+{
+  this->scene = scene_interface;
+  this->mw = mainWindow;
+  
+  QAction* actionLoadFunction = new QAction("Load &Implicit Function", mw);
+  if( NULL != actionLoadFunction )
+  {
+    connect(actionLoadFunction, SIGNAL(triggered()), this, SLOT(load_function()));
+  }
+  
+  QMenu* menuFile = mw->findChild<QMenu*>("menuFile");
+  if ( NULL != menuFile )
+  {
+    QList<QAction*> menuFileActions = menuFile->actions();
+    
+    // Look for action just after "Load..." action
+    QAction* actionAfterLoad = NULL;
+    for ( QList<QAction*>::iterator it_action = menuFileActions.begin(), 
+         end = menuFileActions.end() ; it_action != end ; ++ it_action ) //Q_FOREACH( QAction* action, menuFileActions)
+    {
+      if ( NULL != *it_action && (*it_action)->text().contains("Load") )
+      {
+        ++it_action;
+        if ( it_action != end && NULL != *it_action )
+        {
+          actionAfterLoad = *it_action;
+        }
+      }
+    }
+    
+    // Insert "Load implicit function" action
+    if ( NULL != actionAfterLoad )
+    {
+      menuFile->insertAction(actionAfterLoad,actionLoadFunction);      
+    }
+
+  }
+}
+
+
+void
+Io_implicit_function_plugin::
+load_function() const
+{
+  QDialog dialog(mw);
+  Ui::FunctionDialog ui;
+  ui.setupUi(&dialog);
+  dialog.setWindowFlags(Qt::Dialog|Qt::CustomizeWindowHint|Qt::WindowCloseButtonHint);
+  connect(ui.buttonBox, SIGNAL(accepted()), &dialog, SLOT(accept()));
+  connect(ui.buttonBox, SIGNAL(rejected()), &dialog, SLOT(reject()));
+  
+  // Add loaded functions to the dialog
+  int i=0;
+  Q_FOREACH( Implicit_function_interface* f, functions_ )
+  {
+    ui.functionList->insertItem(i++,f->name());
+  }
+
+  // Open window
+  int return_code = dialog.exec();
+  if(return_code == QDialog::Rejected) { return; }
+  
+  // Get selected function
+  i = ui.functionList->currentIndex();
+  Implicit_function_interface* function = functions_[i];
+  
+  // Create Scene_implicit_function object and add it to the framework
+  Scene_implicit_function_item* item =
+    new Scene_implicit_function_item(function);
+  
+  item->setName(tr("%1").arg(function->name()));
+  item->setRenderingMode(FlatPlusEdges);
+
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+  scene->itemChanged(index);
+    
+  CGAL::Three::Scene_interface::Item_id new_item_id = scene->addItem(item);
+  scene->setSelectedItem(new_item_id);
+}
+
+void
+Io_implicit_function_plugin::
+load_function_plugins()
+{
+  QDir pluginsDir(qApp->applicationDirPath());
+  QString dirname = pluginsDir.dirName();
+  if ( !pluginsDir.cd("implicit_functions") ) { 
+    // In that case, dirname may be "Debug" or "Release" and one has to
+    // search in ../implicit_functions/Debug or
+    // ../implicit_functions/Release
+    QString newDir = QString("../implicit_functions/") + dirname;
+    if( !pluginsDir.cd(newDir) ) return; 
+  }
+  
+  Q_FOREACH (QString fileName, pluginsDir.entryList(QDir::Files))
+  {
+    if ( fileName.contains("plugin") && QLibrary::isLibrary(fileName) )
+    {
+      qDebug("    + Loading Function \"%s\"...", fileName.toUtf8().data());
+      QPluginLoader loader;
+      loader.setFileName(pluginsDir.absoluteFilePath(fileName));
+      QObject *function_plugin = loader.instance();
+      if ( NULL != function_plugin )
+      {
+        Implicit_function_interface* function =
+          qobject_cast<Implicit_function_interface*>(function_plugin);
+        
+        if ( NULL != function )
+        {
+          functions_ << function;
+        }
+      }
+    }
+  }
+}
+
+#include "Implicit_function_io_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/Nef_io_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/IO/Nef_io_plugin.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/Nef_io_plugin.cpp
rename to 3rdparty/CGAL/demo/Polyhedron/Plugins/IO/Nef_io_plugin.cpp
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/IO/OFF_io_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/IO/OFF_io_plugin.cpp
new file mode 100644
index 0000000..259a3db
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/IO/OFF_io_plugin.cpp
@@ -0,0 +1,170 @@
+#include "Scene_polyhedron_item.h"
+#include "Scene_polygon_soup_item.h"
+#include "Scene_points_with_normal_item.h"
+#include "Polyhedron_type.h"
+
+#include <CGAL/Three/Polyhedron_demo_io_plugin_interface.h>
+#include <fstream>
+
+#include <CGAL/IO/File_scanner_OFF.h>
+#include <QMessageBox>
+#include <QApplication>
+
+using namespace CGAL::Three;
+class Polyhedron_demo_off_plugin :
+  public QObject,
+  public Polyhedron_demo_io_plugin_interface
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0")
+
+public:
+  QString name() const { return "off_plugin"; }
+  QString nameFilters() const { return "OFF files (*.off);;Wavefront OBJ (*.obj)"; }
+  bool canLoad() const;
+  CGAL::Three::Scene_item* load(QFileInfo fileinfo);
+   CGAL::Three::Scene_item* load_off(QFileInfo fileinfo);
+   CGAL::Three::Scene_item* load_obj(QFileInfo fileinfo);
+  
+  bool canSave(const CGAL::Three::Scene_item*);
+  bool save(const CGAL::Three::Scene_item*, QFileInfo fileinfo);
+};
+
+bool Polyhedron_demo_off_plugin::canLoad() const {
+  return true;
+}
+
+
+CGAL::Three::Scene_item*
+Polyhedron_demo_off_plugin::load(QFileInfo fileinfo) {
+  if(fileinfo.suffix().toLower() == "off"){
+    return load_off(fileinfo);
+  } else if(fileinfo.suffix().toLower() == "obj"){
+    return load_obj(fileinfo);
+  }
+  return 0;
+}
+
+
+CGAL::Three::Scene_item*
+Polyhedron_demo_off_plugin::load_off(QFileInfo fileinfo) {
+  // Open file
+  std::ifstream in(fileinfo.filePath().toUtf8());
+  if(!in) {
+    std::cerr << "Error! Cannot open file " << (const char*)fileinfo.filePath().toUtf8() << std::endl;
+    return NULL;
+  }
+
+
+  CGAL::File_scanner_OFF scanner( in, false);
+
+  // Try to read .off in a point set
+  if (scanner.size_of_facets() == 0)
+    {
+      in.seekg(0);
+      Scene_points_with_normal_item* item = new Scene_points_with_normal_item();
+      if(!item->read_off_point_set(in))
+        {
+          delete item;
+          return 0;
+        }
+
+      return item;
+    }
+  
+  // to detect isolated vertices
+  std::size_t total_nb_of_vertices = scanner.size_of_vertices();
+  in.seekg(0);
+
+  // Try to read .off in a polyhedron
+  Scene_polyhedron_item* item = new Scene_polyhedron_item();
+  item->setName(fileinfo.completeBaseName());
+  if(!item->load(in))
+  {
+    delete item;
+
+    // Try to read .off in a polygon soup
+    Scene_polygon_soup_item* soup_item = new Scene_polygon_soup_item;
+    soup_item->setName(fileinfo.completeBaseName());
+    in.close();
+    std::ifstream in2(fileinfo.filePath().toUtf8());
+    if(!soup_item->load(in2)) {
+      delete soup_item;
+      return 0;
+    }
+    return soup_item;
+  }
+  else
+    if( total_nb_of_vertices!= item->polyhedron()->size_of_vertices())
+    {
+      item->setNbIsolatedvertices(total_nb_of_vertices - item->polyhedron()->size_of_vertices());
+      //needs two restore, it's not a typo
+      QApplication::restoreOverrideCursor();
+      QMessageBox::warning((QWidget*)NULL,
+                     tr("Isolated vertices found"),
+                     tr("%1 isolated vertices ignored")
+                     .arg(item->getNbIsolatedvertices()));
+    }
+
+  return item;
+}
+
+CGAL::Three::Scene_item*
+Polyhedron_demo_off_plugin::load_obj(QFileInfo fileinfo) {
+  // Open file
+  std::ifstream in(fileinfo.filePath().toUtf8());
+  if(!in) {
+    std::cerr << "Error! Cannot open file " << (const char*)fileinfo.filePath().toUtf8() << std::endl;
+    return NULL;
+  }
+
+  // Try to read .obj in a polyhedron
+  Scene_polyhedron_item* item = new Scene_polyhedron_item();
+  item->setName(fileinfo.completeBaseName());
+  if(!item->load_obj(in))
+    {
+      delete item;
+      return 0;
+    }
+
+
+  return item;
+}
+
+bool Polyhedron_demo_off_plugin::canSave(const CGAL::Three::Scene_item* item)
+{
+  // This plugin supports polyhedrons and polygon soups
+  return qobject_cast<const Scene_polyhedron_item*>(item) ||
+    qobject_cast<const Scene_polygon_soup_item*>(item) ||
+    qobject_cast<const Scene_points_with_normal_item*>(item);
+}
+
+bool Polyhedron_demo_off_plugin::save(const CGAL::Three::Scene_item* item, QFileInfo fileinfo)
+{
+  // This plugin supports point sets, polyhedrons and polygon soups
+  const Scene_points_with_normal_item* points_item =
+    qobject_cast<const Scene_points_with_normal_item*>(item);
+  const Scene_polyhedron_item* poly_item = 
+    qobject_cast<const Scene_polyhedron_item*>(item);
+  const Scene_polygon_soup_item* soup_item = 
+    qobject_cast<const Scene_polygon_soup_item*>(item);
+
+  if(!poly_item && !soup_item && !points_item)
+    return false;
+
+  std::ofstream out(fileinfo.filePath().toUtf8());
+  out.precision (std::numeric_limits<double>::digits10 + 2);
+
+  if(fileinfo.suffix().toLower() == "off"){
+    return (poly_item && poly_item->save(out)) || 
+      (soup_item && soup_item->save(out)) ||
+      (points_item && points_item->write_off_point_set(out));
+  }
+  if(fileinfo.suffix().toLower() == "obj"){
+    return (poly_item && poly_item->save_obj(out));
+  }
+  return false;
+}
+
+#include "OFF_io_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/OFF_to_nef_io_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/IO/OFF_to_nef_io_plugin.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/OFF_to_nef_io_plugin.cpp
rename to 3rdparty/CGAL/demo/Polyhedron/Plugins/IO/OFF_to_nef_io_plugin.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/PLY_to_xyz_io_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/IO/PLY_to_xyz_io_plugin.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/PLY_to_xyz_io_plugin.cpp
rename to 3rdparty/CGAL/demo/Polyhedron/Plugins/IO/PLY_to_xyz_io_plugin.cpp
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/IO/Polylines_io_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/IO/Polylines_io_plugin.cpp
new file mode 100644
index 0000000..2a75bc2
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/IO/Polylines_io_plugin.cpp
@@ -0,0 +1,276 @@
+#include "Scene_polylines_item.h"
+
+#include <QMainWindow>
+#include <CGAL/Three/Polyhedron_demo_io_plugin_interface.h>
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
+#include <fstream>
+#include <QVariant>
+#include <boost/foreach.hpp>
+#include <QMessageBox>
+
+#include "ui_Add_polylines_dialog.h"
+using namespace CGAL::Three;
+namespace Ui{
+    class Add_polylines_dialog;
+}
+class Polyhedron_demo_polylines_io_plugin :
+  public QObject,
+  public Polyhedron_demo_io_plugin_interface,
+  public Polyhedron_demo_plugin_helper
+{
+  Q_OBJECT
+    Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface CGAL::Three::Polyhedron_demo_io_plugin_interface)
+    Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+    Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0")
+
+
+public:
+    // To silent a warning -Woverloaded-virtual
+    // See http://stackoverflow.com/questions/9995421/gcc-woverloaded-virtual-warnings
+
+    //! Adds an action to the menu and configures the widget
+    void init(QMainWindow* mainWindow,
+              CGAL::Three::Scene_interface* scene_interface,
+              Messages_interface*) {
+      //get the references
+      this->scene = scene_interface;
+      this->mw = mainWindow;
+      //creates and link the actions
+      actionAdd_polylines= new QAction("Add Polylines", mw);
+      connect(actionAdd_polylines, SIGNAL(triggered()), this, SLOT(on_actionAdd_polylines_triggered()));
+      QMenu* menuFile = mw->findChild<QMenu*>("menuFile");
+      if ( NULL != menuFile )
+      {
+        QList<QAction*> menuFileActions = menuFile->actions();
+
+        // Look for action just after "Load..." action
+        QAction* actionAfterLoad = NULL;
+        for ( QList<QAction*>::iterator it_action = menuFileActions.begin(),
+             end = menuFileActions.end() ; it_action != end ; ++ it_action ) //Q_FOREACH( QAction* action, menuFileActions)
+        {
+          if ( NULL != *it_action && (*it_action)->text().contains("Load Plugin") )
+          {
+            ++it_action;
+            if ( it_action != end && NULL != *it_action )
+            {
+              actionAfterLoad = *it_action;
+            }
+          }
+        }
+
+        // Insert "Load implicit function" action
+        if ( NULL != actionAfterLoad )
+        {
+          menuFile->insertAction(actionAfterLoad,actionAdd_polylines);
+        }
+      }
+    }
+  QString name() const { return "polylines_io_plugin"; }
+  QString nameFilters() const { return "Polylines files (*.polylines.txt *.cgal)"; }
+  bool canLoad() const;
+  CGAL::Three::Scene_item* load(QFileInfo fileinfo);
+
+  bool canSave(const CGAL::Three::Scene_item*);
+  bool save(const CGAL::Three::Scene_item*, QFileInfo fileinfo);
+  bool applicable(QAction*) const { return true;}
+  QList<QAction*> actions() const {
+    return QList<QAction*>();
+  }
+  protected Q_SLOTS:
+  //!Opens a dialog to add polylines on the fly.
+  void on_actionAdd_polylines_triggered();
+  //!Adds a polyline
+  void addPolylineButton_clicked();
+  //!Closes the dialog
+  void closePolylinesButton_clicked();
+
+private:
+  QAction* actionAdd_polylines;
+  Ui::Add_polylines_dialog *add_polydiagui;
+  QDialog *add_polydiag;
+};
+
+bool Polyhedron_demo_polylines_io_plugin::canLoad() const {
+  return true;
+}
+
+
+CGAL::Three::Scene_item*
+Polyhedron_demo_polylines_io_plugin::load(QFileInfo fileinfo) {
+
+  // Open file
+  std::ifstream ifs(fileinfo.filePath().toUtf8());
+  if(!ifs) {
+    std::cerr << "Error! Cannot open file " << (const char*)fileinfo.filePath().toUtf8() << std::endl;
+    return NULL;
+  }
+
+  std::list<std::vector<Scene_polylines_item::Point_3> > polylines;
+  QStringList polylines_metadata;
+  
+  int counter = 0;
+  std::size_t n;
+  while(ifs >> n) {
+    ++counter;
+    std::cerr << "Polyline #" << polylines.size() << ": " << n << " vertices";
+    polylines.resize(polylines.size()+1);
+    std::vector<Scene_polylines_item::Point_3>& polyline = *(polylines.rbegin());
+    while(n--){
+      Scene_polylines_item::Point_3 p;
+      ifs >> p;
+      polyline.push_back(p);
+      if(!ifs.good()) return 0;
+    }
+    std::string line_remainder;
+    std::getline(ifs, line_remainder);
+    QString metadata(line_remainder.c_str());
+    if(metadata[0].isSpace()) {
+      metadata.remove(0, 1);
+    }
+    polylines_metadata << metadata;
+    if(!metadata.isEmpty()) {
+      std::cerr << " (metadata: \"" << qPrintable(metadata) << "\")\n";
+    } else {
+      std::cerr << "\n";
+    }
+    if(ifs.bad() || ifs.fail()) return 0;
+  }
+  if(counter == 0) return 0;
+  Scene_polylines_item* item = new Scene_polylines_item;
+  item->polylines = polylines;
+  item->setName(fileinfo.baseName());
+  item->setColor(Qt::black);
+  item->setProperty("polylines metadata", polylines_metadata);
+  std::cerr << "Number of polylines in item: " << item->polylines.size() << std::endl;
+  item->invalidateOpenGLBuffers();
+  return item;
+}
+
+bool Polyhedron_demo_polylines_io_plugin::canSave(const CGAL::Three::Scene_item* item)
+{
+  return qobject_cast<const Scene_polylines_item*>(item) != 0;
+}
+
+bool Polyhedron_demo_polylines_io_plugin::save(const CGAL::Three::Scene_item* item, QFileInfo fileinfo)
+{
+  const Scene_polylines_item* poly_item = 
+    qobject_cast<const Scene_polylines_item*>(item);
+
+  if(!poly_item)
+    return false;
+
+  std::ofstream out(fileinfo.filePath().toUtf8());
+
+  out.precision (std::numeric_limits<double>::digits10 + 2);
+
+  if(!out) {
+    std::cerr << "Error! Cannot open file " << (const char*)fileinfo.filePath().toUtf8() << std::endl;
+    return false;
+  }
+
+  typedef Scene_polylines_item::Polylines_container Polylines_container;
+  typedef Polylines_container::value_type Polyline;
+  typedef Polyline::value_type Point_3;
+
+  QStringList metadata = item->property("polylines metadata").toStringList();
+
+  BOOST_FOREACH(const Polyline& polyline, poly_item->polylines) {
+    out << polyline.size();
+    BOOST_FOREACH(const Point_3& p, polyline) {
+      out << " " << p.x() << " " << p.y() << " " << p.z();
+    }
+    if(!metadata.isEmpty()) {
+      out << " " << qPrintable(metadata.front());
+      metadata.pop_front();
+    }
+    out << std::endl;
+  }
+  return (bool) out;
+}
+
+void Polyhedron_demo_polylines_io_plugin::on_actionAdd_polylines_triggered()
+{
+  add_polydiag = new QDialog(mw);
+  add_polydiagui = new Ui::Add_polylines_dialog();
+  add_polydiagui->setupUi(add_polydiag);
+  connect(add_polydiagui->add_polylineButton, SIGNAL(clicked()), this, SLOT(addPolylineButton_clicked()));
+  connect(add_polydiagui->close_polylineButton, SIGNAL(clicked()), this, SLOT(closePolylinesButton_clicked()));
+  add_polydiag->exec();
+}
+
+
+void Polyhedron_demo_polylines_io_plugin::addPolylineButton_clicked()
+{
+    static int nb_of_polylines = 0;
+  QString text = add_polydiagui->textEdit->toPlainText();
+  std::list<std::vector<Scene_polylines_item::Point_3> > polylines;
+  polylines.resize(polylines.size()+1);
+  std::vector<Scene_polylines_item::Point_3>& polyline = *(polylines.rbegin());
+  QStringList polylines_metadata;
+  QStringList list = text.split(QRegExp("\\s+"), QString::SkipEmptyParts);
+  int counter = 0;
+  double coord[3];
+  bool ok = true;
+  if (list.isEmpty()) return;
+  if (list.size()%3!=0){
+    QMessageBox *msgBox = new QMessageBox;
+    msgBox->setWindowTitle("Error");
+    msgBox->setText("ERROR : Input should consists of triplets.");
+    msgBox->exec();
+    return;
+  }
+  Q_FOREACH(QString s, list)
+  {
+      if(!s.isEmpty())
+      {
+          double res = s.toDouble(&ok);
+          if(!ok)
+          {
+              QMessageBox *msgBox = new QMessageBox;
+              msgBox->setWindowTitle("Error");
+              msgBox->setText("ERROR : Coordinates are invalid.");
+              msgBox->exec();
+              break;
+          }
+          else
+          {
+            coord[counter] = res;
+            counter++;
+          }
+      }
+      if(counter == 3)
+      {
+          Scene_polylines_item::Point_3 p(coord[0], coord[1], coord[2]);
+          polyline.push_back(p);
+          counter =0;
+      }
+  }
+    if(ok)
+    {
+        add_polydiagui->textEdit->clear();
+        Scene_polylines_item* item = new Scene_polylines_item;
+        item->polylines = polylines;
+        QString name;
+        if(add_polydiagui->name_lineEdit->text() != "")
+          name = add_polydiagui->name_lineEdit->text();
+        else
+        {
+          nb_of_polylines++;
+          name = QString("Polyline #%1").arg(QString::number(nb_of_polylines));
+        }
+        add_polydiagui->name_lineEdit->clear();
+        item->setName(name);
+        item->setColor(Qt::black);
+        item->setProperty("polylines metadata", polylines_metadata);
+        item->invalidateOpenGLBuffers();
+        scene->addItem(item);
+    }
+}
+
+void Polyhedron_demo_polylines_io_plugin::closePolylinesButton_clicked()
+{
+    add_polydiag->close();
+}
+
+#include "Polylines_io_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/STL_io_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/IO/STL_io_plugin.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/STL_io_plugin.cpp
rename to 3rdparty/CGAL/demo/Polyhedron/Plugins/IO/STL_io_plugin.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/Selection_io_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/IO/Selection_io_plugin.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/IO/Selection_io_plugin.cpp
rename to 3rdparty/CGAL/demo/Polyhedron/Plugins/IO/Selection_io_plugin.cpp
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/IO/Surface_mesh_io_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/IO/Surface_mesh_io_plugin.cpp
new file mode 100644
index 0000000..2f6dcf8
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/IO/Surface_mesh_io_plugin.cpp
@@ -0,0 +1,89 @@
+#include <CGAL/Three/Polyhedron_demo_io_plugin_interface.h>
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+#include <fstream>
+
+#include <QObject>
+#include <QAction>
+#include <QMainWindow>
+#include <QDebug>
+#include "Scene_surface_mesh_item.h"
+#include "Scene_polygon_soup_item.h"
+#include "Messages_interface.h"
+
+
+//This plugin crates an action in Operations that displays "Hello World" in the 'console' dockwidet.
+class SurfaceMeshIoPlugin :
+    public QObject,
+    public CGAL::Three::Polyhedron_demo_io_plugin_interface,
+    public CGAL::Three::Polyhedron_demo_plugin_interface
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface CGAL::Three::Polyhedron_demo_io_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0")
+public:
+  void init(QMainWindow*, CGAL::Three::Scene_interface*, Messages_interface* m)
+  {
+    this->message = m;
+  }
+   bool applicable(QAction*) const
+   {
+     return false;
+   }
+   QList<QAction*> actions() const
+   {
+     return QList<QAction*>();
+   }
+   QString name() const { return "surface_mesh_io_plugin"; }
+   QString nameFilters() const { return "OFF files (*.off)"; }
+   bool canLoad() const { return true; }
+   CGAL::Three::Scene_item* load(QFileInfo fileinfo) {
+     if(fileinfo.suffix().toLower() != "off") return 0;
+
+     // Open file
+     std::ifstream in(fileinfo.filePath().toUtf8());
+     if(!in) {
+      message->error(QString("Cannot open file %1").arg((const char*)fileinfo.filePath().toUtf8()));
+       return NULL;
+     }
+
+     Scene_surface_mesh_item::SMesh *surface_mesh = new Scene_surface_mesh_item::SMesh();
+     in >> *surface_mesh;
+     if(!in || surface_mesh->is_empty())
+     {
+       delete surface_mesh;
+       in.close();
+       // Try to read .off in a polygon soup
+       Scene_polygon_soup_item* soup_item = new Scene_polygon_soup_item();
+       soup_item->setName(fileinfo.completeBaseName());
+       std::ifstream in2(fileinfo.filePath().toUtf8());
+       if(!soup_item->load(in2)) {
+         message->error(QString("Cannot open file %1").arg((const char*)fileinfo.filePath().toUtf8()));
+         delete soup_item;
+         return 0;
+       }
+       message->information("The facets don't seem to be oriented. Loading a Soup of polygons instead."
+                            "To convert it to a Surface_mesh or a Polyhedron, use Polygon Mesh Processing -> Orient polygon soup");
+       return soup_item;
+     }
+     Scene_surface_mesh_item* item = new Scene_surface_mesh_item(surface_mesh);
+     item->setName(fileinfo.completeBaseName());
+     return item;
+
+   }
+   bool canSave(const CGAL::Three::Scene_item* ) {
+     return false;
+   }
+
+   bool save(const CGAL::Three::Scene_item* , QFileInfo ) {
+     return false;
+   }
+
+
+
+private:
+   QList<QAction*> _actions;
+   //The reference to the main window
+   Messages_interface* message;
+};
+#include "Surface_mesh_io_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/IO/VTK_io_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/IO/VTK_io_plugin.cpp
new file mode 100644
index 0000000..a9e3f4e
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/IO/VTK_io_plugin.cpp
@@ -0,0 +1,418 @@
+// Copyright (c) 2015  GeometryFactory (France). All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Sebastien Loriot <sebastien.loriot at cgal.org>,
+//                 Jane Tournois
+//
+
+#include <QtCore/qglobal.h>
+
+#include "Polyhedron_type.h"
+#include "Scene_polyhedron_item.h"
+#include "Scene_polylines_item.h"
+
+#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
+#include <CGAL/Three/Polyhedron_demo_io_plugin_interface.h>
+
+#include <QApplication>
+#include <QMessageBox>
+#include <QMainWindow>
+#include <QFileDialog>
+#include <QString>
+
+#include <fstream>
+
+#include <boost/graph/graph_traits.hpp>
+#include <boost/unordered_map.hpp>
+
+#include <CGAL/boost/graph/properties.h>
+#include <CGAL/boost/graph/Euler_operations.h>
+#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
+#include <CGAL/property_map.h>
+
+#include <vtkSmartPointer.h>
+#include <vtkDataSetReader.h>
+#include <vtkXMLPolyDataReader.h>
+#include <vtkPolyDataWriter.h>
+#include <vtkUnstructuredGrid.h>
+#include <vtkXMLUnstructuredGridReader.h>
+#include <vtkXMLPolyDataWriter.h>
+#include <vtkPolyData.h>
+#include <vtkIdTypeArray.h>
+#include <vtkFieldData.h>
+#include <vtkFloatArray.h>
+#include <vtkDoubleArray.h>
+#include <vtkCell.h>
+#include <vtkCellData.h>
+#include <vtkIdList.h>
+#include <vtkAppendFilter.h>
+#include <vtkSphereSource.h>
+#include <vtkVersion.h>
+#include <vtkXMLUnstructuredGridWriter.h>
+#include <vtkPoints.h>
+#include <vtkCellArray.h>
+#include <vtkType.h>
+#include <vtkCommand.h>
+
+namespace CGAL{
+
+  class ErrorObserverVtk : public vtkCommand
+  {
+  public:
+    ErrorObserverVtk() :
+      Error(false),
+      Warning(false),
+      ErrorMessage(""),
+      WarningMessage("") {}
+    static ErrorObserverVtk *New() { return new ErrorObserverVtk; }
+
+    bool GetError() const          { return this->Error; }
+    bool GetWarning() const        { return this->Warning; }
+    std::string GetErrorMessage()   { return ErrorMessage; }
+    std::string GetWarningMessage() { return WarningMessage; }
+
+    void Clear()
+    {
+      this->Error = false;
+      this->Warning = false;
+      this->ErrorMessage = "";
+      this->WarningMessage = "";
+    }
+    virtual void Execute(vtkObject *vtkNotUsed(caller),
+                         unsigned long event,
+                         void *calldata)
+    {
+      switch (event)
+      {
+      case vtkCommand::ErrorEvent:
+        ErrorMessage = static_cast<char *>(calldata);
+        this->Error = true;
+        break;
+      case vtkCommand::WarningEvent:
+        WarningMessage = static_cast<char *>(calldata);
+        this->Warning = true;
+        break;
+      }
+    }
+
+  private:
+    bool        Error;
+    bool        Warning;
+    std::string ErrorMessage;
+    std::string WarningMessage;
+  };
+
+  template <typename TM>
+  bool vtkPointSet_to_polygon_mesh(vtkPointSet* poly_data,
+                                   TM& tmesh)
+  {
+    typedef typename boost::property_map<TM, CGAL::vertex_point_t>::type VPMap;
+    typedef typename boost::property_map_value<TM, CGAL::vertex_point_t>::type Point_3;
+    typedef typename boost::graph_traits<TM>::vertex_descriptor vertex_descriptor;
+
+    VPMap vpmap = get(CGAL::vertex_point, tmesh);
+
+    // get nb of points and cells
+    vtkIdType nb_points = poly_data->GetNumberOfPoints();
+    vtkIdType nb_cells = poly_data->GetNumberOfCells();
+
+    //extract points
+    std::vector<vertex_descriptor> vertex_map(nb_points);
+    for (vtkIdType i = 0; i<nb_points; ++i)
+    {
+      double coords[3];
+      poly_data->GetPoint(i, coords);
+
+      vertex_descriptor v = add_vertex(tmesh);
+      put(vpmap, v, Point_3(coords[0], coords[1], coords[2]));
+      vertex_map[i]=v;
+    }
+
+    //extract cells
+    for (vtkIdType i = 0; i<nb_cells; ++i)
+    {
+      vtkCell* cell_ptr = poly_data->GetCell(i);
+
+      vtkIdType nb_vertices = cell_ptr->GetNumberOfPoints();
+      if (nb_vertices < 3)
+        return false;
+      std::vector<vertex_descriptor> vr(nb_vertices);
+      for (vtkIdType k=0; k<nb_vertices; ++k)
+        vr[k]=vertex_map[cell_ptr->GetPointId(k)];
+
+      CGAL::Euler::add_face(vr, tmesh);
+    }
+    return true;
+  }
+
+  template <class Point_3>
+  void extract_segments_from_vtkPointSet(vtkPointSet* poly_data,
+                                         std::vector< std::vector<Point_3> >& segments)
+  {
+    // get nb of points and cells
+    vtkIdType nb_points = poly_data->GetNumberOfPoints();
+    vtkIdType nb_cells = poly_data->GetNumberOfCells();
+
+    //extract points
+    std::vector<Point_3> point_map(nb_points);
+    for (vtkIdType i = 0; i<nb_points; ++i)
+    {
+      double coords[3];
+      poly_data->GetPoint(i, coords);
+      point_map[i]=Point_3(coords[0], coords[1], coords[2]);
+    }
+
+    //extract segments
+    for (vtkIdType i = 0; i<nb_cells; ++i)
+    {
+      vtkCell* cell_ptr = poly_data->GetCell(i);
+
+      vtkIdType nb_vertices = cell_ptr->GetNumberOfPoints();
+      if (nb_vertices !=2) continue;
+      segments.push_back( std::vector<Point_3>() );
+      segments.back().push_back(point_map[cell_ptr->GetPointId(0)]);
+      segments.back().push_back(point_map[cell_ptr->GetPointId(1)]);
+    }
+  }
+
+  template<typename VtkWriter, typename PM>
+  void polygon_mesh_to_vtkUnstructured(const PM& pmesh,//PolygonMesh
+                                       const char* filename)
+  {
+    typedef typename boost::graph_traits<PM>::vertex_descriptor   vertex_descriptor;
+    typedef typename boost::graph_traits<PM>::face_descriptor     face_descriptor;
+    typedef typename boost::graph_traits<PM>::halfedge_descriptor halfedge_descriptor;
+
+    typedef typename boost::property_map<PM, CGAL::vertex_point_t>::const_type VPMap;
+    typedef typename boost::property_map_value<PM, CGAL::vertex_point_t>::type Point_3;
+    VPMap vpmap = get(CGAL::vertex_point, pmesh);
+
+    vtkPoints* const vtk_points = vtkPoints::New();
+    vtkCellArray* const vtk_cells = vtkCellArray::New();
+
+    vtk_points->Allocate(pmesh.size_of_vertices());
+    vtk_cells->Allocate(pmesh.size_of_facets());
+
+    std::map<Polyhedron::Vertex_handle, vtkIdType> Vids;
+    vtkIdType inum = 0;
+
+    BOOST_FOREACH(vertex_descriptor v, vertices(pmesh))
+    {
+      const Point_3& p = get(vpmap, v);
+      vtk_points->InsertNextPoint(CGAL::to_double(p.x()),
+                                  CGAL::to_double(p.y()),
+                                  CGAL::to_double(p.z()));
+      Vids[v] = inum++;
+    }
+    BOOST_FOREACH(face_descriptor f, faces(pmesh))
+    {
+      vtkIdList* cell = vtkIdList::New();
+      BOOST_FOREACH(halfedge_descriptor h,
+                    halfedges_around_face(halfedge(f, pmesh), pmesh))
+      {
+        cell->InsertNextId(Vids[target(h, pmesh)]);
+      }
+      vtk_cells->InsertNextCell(cell);
+      cell->Delete();
+    }
+
+    vtkSmartPointer<vtkPolyData> polydata =
+      vtkSmartPointer<vtkPolyData>::New();
+
+    polydata->SetPoints(vtk_points);
+    vtk_points->Delete();
+
+    polydata->SetPolys(vtk_cells);
+    vtk_cells->Delete();
+
+    // Combine the two data sets
+    //vtkSmartPointer<vtkAppendFilter> appendFilter =
+    //  vtkSmartPointer<vtkAppendFilter>::New();
+    //appendFilter->AddInputData(polydata);
+    //appendFilter->Update();
+
+    //vtkSmartPointer<vtkPolyData> unstructuredGrid =
+    //  vtkSmartPointer<vtkPolyData>::New();
+    //unstructuredGrid->ShallowCopy(appendFilter->GetOutput());
+
+    // Write the unstructured grid
+    vtkSmartPointer<VtkWriter> writer =
+      vtkSmartPointer<VtkWriter>::New();
+    writer->SetFileName(filename);
+    writer->SetInputData(polydata);
+    writer->Write();
+  }
+}//end namespace CGAL
+
+
+class Polyhedron_demo_vtk_plugin :
+  public QObject,
+  public CGAL::Three::Polyhedron_demo_io_plugin_interface
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0")
+
+public:
+  typedef boost::graph_traits<Polyhedron>::vertex_descriptor vertex_descriptor;
+  typedef boost::graph_traits<Polyhedron>::face_descriptor face_descriptor;
+
+  QString nameFilters() const {
+    return "VTK PolyData files (*.vtk);; VTK XML PolyData (*.vtp)"; }
+  QString name() const { return "vtk_plugin"; }
+
+  bool canSave(const CGAL::Three::Scene_item* item)
+  {
+    return qobject_cast<const Scene_polyhedron_item*>(item);
+  }
+  bool save(const CGAL::Three::Scene_item* item, QFileInfo fileinfo)
+  {
+    std::string extension = fileinfo.suffix().toLower().toStdString();
+    if ( extension != "vtk" && extension != "vtp")
+      return false;
+
+    std::string output_filename = fileinfo.absoluteFilePath().toStdString();
+
+    const Scene_polyhedron_item* poly_item =
+      qobject_cast<const Scene_polyhedron_item*>(item);
+
+    if (!poly_item)
+      return false;
+    else
+    {
+      if (extension != "vtp")
+        CGAL::polygon_mesh_to_vtkUnstructured<vtkPolyDataWriter>(
+          *poly_item->polyhedron(),
+          output_filename.data());
+      else
+        CGAL::polygon_mesh_to_vtkUnstructured<vtkXMLPolyDataWriter>(
+        *poly_item->polyhedron(),
+        output_filename.data());
+    }
+    return true;
+  }
+
+  bool canLoad() const { return true; }
+
+  template <class vtkReader>
+  vtkSmartPointer<vtkReader>
+  read_vtk_file(const std::string& input_filename,
+                vtkSmartPointer<CGAL::ErrorObserverVtk> errorObserver)
+  {
+    vtkSmartPointer<vtkReader> reader = vtkSmartPointer<vtkReader>::New();
+    reader->AddObserver(vtkCommand::ErrorEvent, errorObserver);
+    reader->AddObserver(vtkCommand::WarningEvent, errorObserver);
+    reader->SetFileName(input_filename.data());
+    reader->Update();
+    return reader;
+  }
+
+  CGAL::Three::Scene_item* load(QFileInfo fileinfo)
+  {
+    std::string extension=fileinfo.suffix().toLower().toStdString();
+    if (extension != "vtk" && extension != "vtp" && extension != "vtu")
+      return 0;
+
+    std::string fname = fileinfo.absoluteFilePath().toStdString();
+
+    Polyhedron poly;
+    // Try to read .vtk in a polyhedron
+    vtkSmartPointer<vtkPointSet> data;
+    vtkSmartPointer<CGAL::ErrorObserverVtk> obs =
+      vtkSmartPointer<CGAL::ErrorObserverVtk>::New();
+
+    if (extension=="vtp")
+      data = read_vtk_file<vtkXMLPolyDataReader>(fname,obs)
+              ->GetOutput();
+    else
+     if (extension=="vtu")
+       data = read_vtk_file<vtkXMLUnstructuredGridReader>(fname,obs)
+                ->GetOutput();
+     else{
+       //read non-XML data
+       vtkSmartPointer<vtkDataSetReader> reader =
+         read_vtk_file<vtkDataSetReader>(fname,obs);
+       data = vtkPolyData::SafeDownCast(reader->GetOutput());
+       if (!data)
+        data = vtkUnstructuredGrid::SafeDownCast(reader->GetOutput());
+     }
+
+    if (obs->GetError())
+    {
+      QMessageBox msgBox;
+      msgBox.setText("This type of data can't be opened");
+      msgBox.setInformativeText(QString("VTK error message :\n")
+        .append(QString(obs->GetErrorMessage().data())));
+      msgBox.setStandardButtons(QMessageBox::Ok);
+      msgBox.setIcon(QMessageBox::Critical);
+      msgBox.exec();
+      return NULL;
+    }
+    if (obs->GetWarning())
+    {
+      QMessageBox msgBox;
+      msgBox.setText("This file generates a warning");
+      msgBox.setInformativeText(QString("VTK warning message :\n")
+        .append(QString(obs->GetWarningMessage().data())));
+      msgBox.setStandardButtons(QMessageBox::Ok);
+      msgBox.setIcon(QMessageBox::Warning);
+      msgBox.exec();
+    }
+    if (obs->GetError())
+    {
+      QMessageBox msgBox;
+      msgBox.setText("This type of data can't be opened");
+      msgBox.setInformativeText(QString("VTK error message :\n")
+        .append(QString(obs->GetErrorMessage().data())));
+      msgBox.setStandardButtons(QMessageBox::Ok);
+      msgBox.setIcon(QMessageBox::Critical);
+      msgBox.exec();
+      return NULL;
+    }
+    if (obs->GetWarning())
+    {
+      QMessageBox msgBox;
+      msgBox.setText("This file generates a warning");
+      msgBox.setInformativeText(QString("VTK warning message :\n")
+        .append(QString(obs->GetWarningMessage().data())));
+      msgBox.setStandardButtons(QMessageBox::Ok);
+      msgBox.setIcon(QMessageBox::Warning);
+      msgBox.exec();
+    }
+
+    if (CGAL::vtkPointSet_to_polygon_mesh(data, poly))
+    {
+      Scene_polyhedron_item* poly_item = new Scene_polyhedron_item(poly);
+      poly_item->setName(fileinfo.fileName());
+      return poly_item;
+    }
+    else{
+      // extract only segments
+      std::vector< std::vector<Polyhedron::Point> > segments;
+      extract_segments_from_vtkPointSet(data,segments);
+      if (segments.empty()) return NULL; /// TODO handle point sets
+      Scene_polylines_item* polyline_item = new Scene_polylines_item();
+      polyline_item->setName(fileinfo.fileName());
+      BOOST_FOREACH(const std::vector<Polyhedron::Point_3>& segment, segments)
+        polyline_item->polylines.push_back(segment);
+      return polyline_item;
+    }
+    return NULL;
+  }
+}; // end Polyhedron_demo_vtk_plugin
+
+
+#include "VTK_io_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/IO/XYZ_io_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/IO/XYZ_io_plugin.cpp
new file mode 100644
index 0000000..bc7edd0
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/IO/XYZ_io_plugin.cpp
@@ -0,0 +1,225 @@
+#include "Scene_points_with_normal_item.h"
+#include "Kernel_type.h"
+
+#include <QMainWindow>
+#include <CGAL/Three/Polyhedron_demo_io_plugin_interface.h>
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
+#include <fstream>
+#include <QMessageBox>
+#include <QMenu>
+
+#include "ui_Add_point_set_dialog.h"
+using namespace CGAL::Three;
+namespace Ui{
+    class Add_point_set_dialog;
+}
+class Polyhedron_demo_xyz_plugin :
+  public QObject,
+  public Polyhedron_demo_io_plugin_interface,
+  public Polyhedron_demo_plugin_helper
+{
+  Q_OBJECT
+    Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface CGAL::Three::Polyhedron_demo_io_plugin_interface)
+    Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+    Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0")
+
+public:
+
+    //! Adds an action to the menu and configures the widget
+    void init(QMainWindow* mainWindow,
+              CGAL::Three::Scene_interface* scene_interface,
+              Messages_interface*) {
+      //get the references
+      this->scene = scene_interface;
+      this->mw = mainWindow;
+      //creates and link the actions
+      actionAdd_point_set= new QAction("Add Point Sets", mw);
+      connect(actionAdd_point_set, SIGNAL(triggered()), this, SLOT(on_actionAdd_point_set_triggered()));
+
+      QMenu* menuFile = mw->findChild<QMenu*>("menuFile");
+      if ( NULL != menuFile )
+      {
+        QList<QAction*> menuFileActions = menuFile->actions();
+
+        // Look for action just after "Load..." action
+        QAction* actionAfterLoad = NULL;
+        for ( QList<QAction*>::iterator it_action = menuFileActions.begin(),
+             end = menuFileActions.end() ; it_action != end ; ++ it_action ) //Q_FOREACH( QAction* action, menuFileActions)
+        {
+          if ( NULL != *it_action && (*it_action)->text().contains("Load Plugin") )
+          {
+            ++it_action;
+            if ( it_action != end && NULL != *it_action )
+            {
+              actionAfterLoad = *it_action;
+            }
+          }
+        }
+
+        // Insert "Load implicit function" action
+        if ( NULL != actionAfterLoad )
+        {
+          menuFile->insertAction(actionAfterLoad,actionAdd_point_set);
+        }
+      }
+    }
+  QString name() const { return "xyz_plugin"; }
+
+  QString nameFilters() const { return "XYZ as Point Set (*.xyz);;Point Set with Normal (*.pwn)"; }
+  bool canLoad() const;
+  CGAL::Three::Scene_item* load(QFileInfo fileinfo);
+
+  bool canSave(const CGAL::Three::Scene_item*);
+  bool save(const CGAL::Three::Scene_item*, QFileInfo fileinfo);
+  bool applicable(QAction*) const { return true;}
+  QList<QAction*> actions() const {
+    return QList<QAction*>();
+  }
+protected Q_SLOTS:
+  //!Opens a dialog to add a point set on the fly.
+  void on_actionAdd_point_set_triggered();
+  //!Adds a point set
+  void addPointSetButton_clicked();
+  //!Closes the dialog
+  void closePointSetButton_clicked();
+private:
+  QAction* actionAdd_point_set;
+  QDialog *add_pointsetdiag;
+  Ui::Add_point_set_dialog *add_pointsetdiagui;
+};
+
+bool Polyhedron_demo_xyz_plugin::canLoad() const {
+  return true;
+}
+
+
+CGAL::Three::Scene_item*
+Polyhedron_demo_xyz_plugin::load(QFileInfo fileinfo)
+{
+  // Open file
+  std::ifstream in(fileinfo.filePath().toUtf8().data());
+  if(!in) {
+    std::cerr << "Error! Cannot open file " << fileinfo.filePath().toStdString() << std::endl;
+    return NULL;
+  }
+
+  // Read .xyz in a point set
+  Scene_points_with_normal_item* point_set_item = new Scene_points_with_normal_item;
+  point_set_item->setName(fileinfo.completeBaseName());
+  if(!point_set_item->read_xyz_point_set(in)) {
+    delete point_set_item;
+    return NULL;
+  }
+  return point_set_item;
+}
+
+bool Polyhedron_demo_xyz_plugin::canSave(const CGAL::Three::Scene_item* item)
+{
+  // This plugin supports point sets
+  return qobject_cast<const Scene_points_with_normal_item*>(item);
+}
+
+bool Polyhedron_demo_xyz_plugin::save(const CGAL::Three::Scene_item* item, QFileInfo fileinfo)
+{
+  // Check extension (quietly)
+  std::string extension = fileinfo.suffix().toUtf8().data();
+  if (extension != "xyz" && extension != "XYZ" &&
+      extension != "pwn" && extension != "PWN")
+    return false;
+
+  // This plugin supports point sets
+  const Scene_points_with_normal_item* point_set_item =
+    qobject_cast<const Scene_points_with_normal_item*>(item);
+  if(!point_set_item)
+    return false;
+
+  // Save point set as .xyz
+  std::ofstream out(fileinfo.filePath().toUtf8().data());
+  out.precision (std::numeric_limits<double>::digits10 + 2);
+  return point_set_item->write_xyz_point_set(out);
+}
+
+
+void Polyhedron_demo_xyz_plugin::on_actionAdd_point_set_triggered()
+{
+  add_pointsetdiag = new QDialog(mw);
+  add_pointsetdiagui = new Ui::Add_point_set_dialog();
+  add_pointsetdiagui->setupUi(add_pointsetdiag);
+  connect(add_pointsetdiagui->add_point_setButton, SIGNAL(clicked()), this, SLOT(addPointSetButton_clicked()));
+  connect(add_pointsetdiagui->close_point_setButton, SIGNAL(clicked()), this, SLOT(closePointSetButton_clicked()));
+  add_pointsetdiag->exec();
+}
+
+void Polyhedron_demo_xyz_plugin::addPointSetButton_clicked()
+{
+    static int nb_of_point_set =0;
+  QString text = add_pointsetdiagui->textEdit->toPlainText();
+  Scene_points_with_normal_item* item = new Scene_points_with_normal_item();
+  QStringList list = text.split(QRegExp("\\s+"), QString::SkipEmptyParts);
+  int counter = 0;
+  double coord[3];
+  bool ok = true;
+  if (list.isEmpty()) return;
+  if (list.size()%3!=0){
+    QMessageBox *msgBox = new QMessageBox;
+    msgBox->setWindowTitle("Error");
+    msgBox->setText("ERROR : Input should consists of triplets.");
+    msgBox->exec();
+    return;
+  }
+  Q_FOREACH(QString s, list)
+  {
+      if(!s.isEmpty())
+      {
+          double res = s.toDouble(&ok);
+          if(!ok)
+          {
+              QMessageBox *msgBox = new QMessageBox;
+              msgBox->setWindowTitle("Error");
+              msgBox->setText("ERROR : Coordinates are invalid.");
+              msgBox->exec();
+              break;
+          }
+          else
+          {
+            coord[counter] = res;
+            counter++;
+          }
+      }
+      if(counter == 3)
+      {
+          const Kernel::Point_3 p(coord[0], coord[1], coord[2]);
+          Kernel::Vector_3 n(0,0,0);
+          UI_point point(p,n);
+          item->point_set()->push_back(point);
+
+
+          counter =0;
+      }
+  }
+    if(ok)
+    {
+        add_pointsetdiagui->textEdit->clear();
+        item->point_set()->unselect_all();
+        QString name;
+        if(add_pointsetdiagui->name_lineEdit->text()!="")
+          name = add_pointsetdiagui->name_lineEdit->text();
+        else
+        {
+          nb_of_point_set++;
+          name = QString("Point_set #%1").arg(QString::number(nb_of_point_set));
+        }
+        item->setName(name);
+        item->setColor(Qt::black);
+        item->invalidateOpenGLBuffers();
+        scene->addItem(item);
+    }
+}
+
+void Polyhedron_demo_xyz_plugin::closePointSetButton_clicked()
+{
+    add_pointsetdiag->close();
+}
+
+#include "XYZ_io_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_2/CMakeLists.txt b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_2/CMakeLists.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_2/CMakeLists.txt
rename to 3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_2/CMakeLists.txt
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_2/Mesh_2_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_2/Mesh_2_plugin.cpp
new file mode 100644
index 0000000..49f0372
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_2/Mesh_2_plugin.cpp
@@ -0,0 +1,448 @@
+
+// Needed for lloyd_optimize_mesh_2 which does it too late
+// (and we don't want to spend the time on finding out who
+// includes the header file that sets it too a value too low
+#define  BOOST_PARAMETER_MAX_ARITY 8
+
+#include <stdexcept>
+
+#define CGAL_CT2_WANTS_TO_HAVE_EXTRA_ACTION_FOR_INTERSECTING_CONSTRAINTS
+#define CGAL_CDT2_EXTRA_ACTION_FOR_INTERSECTING_CONSTRAINTS \
+  throw std::runtime_error("This plugin does not deal with intersecting edges");
+
+#include <QtCore/qglobal.h>
+
+#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+
+#include "Scene_polyhedron_item.h"
+#include "Scene_polylines_item.h"
+#include "Scene_points_with_normal_item.h"
+#include "Polyhedron_type.h"
+
+#include <CGAL/iterator.h>
+
+#include <CGAL/Projection_traits_xy_3.h>
+#include <CGAL/Projection_traits_yz_3.h>
+#include <CGAL/Projection_traits_xz_3.h>
+#include <CGAL/Constrained_Delaunay_triangulation_2.h>
+#include <CGAL/Delaunay_mesh_vertex_base_2.h>
+#include <CGAL/Delaunay_mesh_face_base_2.h>
+#include <CGAL/Delaunay_mesher_2.h>
+#include <CGAL/Delaunay_mesh_size_criteria_2.h>
+#include <CGAL/Triangulation_face_base_with_info_2.h>
+#include <CGAL/lloyd_optimize_mesh_2.h>
+
+#include <CGAL/boost/graph/Euler_operations.h>
+
+#include <QTime>
+#include <QAction>
+#include <QMainWindow>
+#include <QApplication>
+#include <QString>
+#include <QDialog>
+#include <QMessageBox>
+#include <QtPlugin>
+
+#include <vector>
+#include <algorithm>
+#include <queue>
+#include <sstream>
+
+#include "ui_mesh_2_dialog.h"
+
+struct FaceInfo2
+{
+  FaceInfo2(){}
+  int nesting_level;
+  bool in_domain(){
+    return nesting_level%2 == 1;
+  }
+};
+
+template <class CDT>
+void
+mark_domains(CDT& ct,
+             typename CDT::Face_handle start,
+             int index,
+             std::list<typename CDT::Edge>& border )
+{
+  if(start->info().nesting_level != -1){
+    return;
+  }
+  std::list<typename CDT::Face_handle> queue;
+  queue.push_back(start);
+  while(! queue.empty()){
+    typename CDT::Face_handle fh = queue.front();
+    queue.pop_front();
+    if(fh->info().nesting_level == -1){
+      fh->info().nesting_level = index;
+      for(int i = 0; i < 3; i++){
+        typename CDT::Edge e(fh,i);
+        typename CDT::Face_handle n = fh->neighbor(i);
+        if(n->info().nesting_level == -1){
+          if(ct.is_constrained(e)) border.push_back(e);
+          else queue.push_back(n);
+        }
+      }
+    }
+  }
+}
+
+template <class CDT>
+void
+mark_nested_domains(CDT& cdt)
+{
+  for(typename CDT::All_faces_iterator it = cdt.all_faces_begin(); it != cdt.all_faces_end(); ++it){
+    it->info().nesting_level = -1;
+  }
+  std::list<typename CDT::Edge> border;
+  mark_domains(cdt, cdt.infinite_face(), 0, border);
+  while(! border.empty()){
+    typename CDT::Edge e = border.front();
+    border.pop_front();
+    typename CDT::Face_handle n = e.first->neighbor(e.second);
+    if(n->info().nesting_level == -1){
+      mark_domains(cdt, n, e.first->info().nesting_level+1, border);
+    }
+  }
+}
+
+template <class CDT, class TriangleMesh>
+void cdt2_to_face_graph(const CDT& cdt, TriangleMesh& tm, int constant_coordinate_index, double constant_coordinate)
+{
+  typedef typename boost::graph_traits<Polyhedron>::vertex_descriptor vertex_descriptor;
+
+  typedef std::map<typename CDT::Vertex_handle, vertex_descriptor> Map;
+  Map descriptors;
+  for (typename CDT::Finite_faces_iterator fit=cdt.finite_faces_begin(),
+                                           fit_end=cdt.finite_faces_end();
+                                           fit!=fit_end; ++fit)
+  {
+    if (!fit->is_in_domain()) continue;
+    CGAL::cpp11::array<vertex_descriptor,3> vds;
+    for(int i=0; i<3; ++i)
+    {
+      typename Map::iterator it;
+      bool insert_ok;
+      boost::tie(it,insert_ok) =
+        descriptors.insert(std::make_pair(fit->vertex(i),vertex_descriptor()));
+      if (insert_ok){
+        const Kernel::Point_3& pt=fit->vertex(i)->point();
+        double coords[3] = {pt[0], pt[1], pt[2]};
+        coords[constant_coordinate_index]=constant_coordinate;
+        it->second = add_vertex(Kernel::Point_3(coords[0],coords[1],coords[2]), tm);
+      }
+      vds[i]=it->second;
+    }
+
+    CGAL::Euler::add_face(vds, tm);
+  }
+}
+
+class Polyhedron_demo_mesh_2_plugin :
+  public QObject,
+  public CGAL::Three::Polyhedron_demo_plugin_helper
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+public:
+  void init(QMainWindow* mainWindow,
+            CGAL::Three::Scene_interface* scene_interface,
+            Messages_interface*)
+  {
+    this->scene = scene_interface;
+    this->mw = mainWindow;
+
+    actionMesh_2_ = new QAction("Mesh_2", mw);
+    // actionMesh_2_->setProperty("subMenuName", "Polygon Mesh Processing");
+    if (actionMesh_2_) {
+      connect(actionMesh_2_, SIGNAL(triggered()),
+        this, SLOT(run()));
+    }
+  }
+
+  QList<QAction*> actions() const {
+    return QList<QAction*>() << actionMesh_2_;
+  }
+
+  bool applicable(QAction*) const
+  {
+    Q_FOREACH(int index, scene->selectionIndices())
+    {
+      //if one polyhedron is found in the selection, it's fine
+      if (qobject_cast<Scene_polylines_item*>(scene->item(index)))
+        return true;
+    }
+    return false;
+  }
+
+private:
+  Ui::mesh_2_dialog
+  create_dialog(QDialog* dialog, double diag_length, bool no_seeds)
+  {
+    Ui::mesh_2_dialog ui;
+    ui.setupUi(dialog);
+    connect(ui.buttonBox, SIGNAL(accepted()), dialog, SLOT(accept()));
+    connect(ui.buttonBox, SIGNAL(rejected()), dialog, SLOT(reject()));
+
+    //connect checkbox to spinbox
+    connect(ui.runLloyd_checkbox, SIGNAL(toggled(bool)),
+            ui.nbIterations_spinbox, SLOT(setEnabled(bool)));
+    connect(ui.runMesh2_checkbox, SIGNAL(toggled(bool)),
+            ui.edgeLength_dspinbox, SLOT(setEnabled(bool)));
+
+    //Set default parameter edge length
+    ui.edgeLength_dspinbox->setDecimals(3);
+    ui.edgeLength_dspinbox->setSingleStep(0.001);
+    ui.edgeLength_dspinbox->setRange(1e-6 * diag_length, //min
+                                     2.   * diag_length);//max
+    ui.edgeLength_dspinbox->setValue(0.05 * diag_length);
+    ui.edgeLength_dspinbox->setToolTip(
+      "Diagonal length of the Bbox of the selection to mesh is "+
+      QString::number(diag_length)+" - default is 5% of it");
+
+    //Set default for nb iterations
+    ui.nbIterations_spinbox->setSingleStep(1);
+    ui.nbIterations_spinbox->setRange(1/*min*/, 1000/*max*/);
+    ui.nbIterations_spinbox->setValue(1);
+
+    // Run Mesh_2 by default, not Lloyd
+    ui.runLloyd_checkbox->setChecked(false);
+    ui.runMesh2_checkbox->setChecked(true);
+
+    // Domain definition and disabling all options if no Mesh_2 run
+    if (no_seeds){
+      ui.radioSeedsIn->setDisabled(true);
+      ui.radioSeedsOut->setDisabled(true);
+      ui.radioNesting->setChecked(true);
+    }
+    else
+      ui.radioSeedsOut->setChecked(true);
+    return ui;
+  }
+
+  template <class ProjectionTraits>
+  void mesh(const std::vector<Scene_polylines_item*>& polylines_items,
+            const std::vector<Scene_points_with_normal_item*>& points_items,
+            double diagonal_length,
+            int constant_coordinate_index)
+  {
+    // extract seeds
+    std::vector<Kernel::Point_3> seeds;
+    Q_FOREACH(Scene_points_with_normal_item* points_item, points_items)
+      Q_FOREACH(UI_point_3<Kernel> pt, *points_item->point_set())
+        seeds.push_back(pt);
+
+    // Create dialog box
+    QDialog dialog(mw);
+    Ui::mesh_2_dialog ui =
+      create_dialog(&dialog, diagonal_length, seeds.empty());
+    dialog.setWindowFlags(Qt::Dialog|Qt::CustomizeWindowHint|Qt::WindowCloseButtonHint);
+
+    // Get values
+    int i = dialog.exec();
+    if (i == QDialog::Rejected)
+    {
+      std::cout << "2D Meshing aborted" << std::endl;
+      return;
+    }
+    bool runMesh2 = ui.runMesh2_checkbox->isChecked();
+    double target_length = ui.edgeLength_dspinbox->value();
+    unsigned int nb_iter = ui.nbIterations_spinbox->value();
+    bool runLloyd = ui.runLloyd_checkbox->isChecked();
+
+
+    // wait cursor
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    typedef ProjectionTraits                                             Gt;
+    typedef CGAL::Delaunay_mesh_vertex_base_2<Gt>                        Vb;
+    typedef CGAL::Delaunay_mesh_face_base_2<Gt>                          Fm;
+    typedef CGAL::Triangulation_face_base_with_info_2<FaceInfo2,Gt,Fm>   Fb;
+    typedef CGAL::Triangulation_data_structure_2<Vb, Fb>                TDS;
+    typedef CGAL::No_intersection_tag                                   Tag;
+    typedef CGAL::Constrained_Delaunay_triangulation_2<Gt, TDS, Tag>    CDT;
+    typedef CGAL::Delaunay_mesh_size_criteria_2<CDT>               Criteria;
+    typedef CGAL::Delaunay_mesher_2<CDT, Criteria>                   Mesher;
+
+    QTime time; // global timer
+    time.start();
+
+    std::cout << " Building Constrained_Delaunay_triangulation_2..."
+              << std::flush;
+    CDT cdt;
+
+    QTime ltime; //local timer
+    ltime.start();
+    double constant_coordinate =
+      polylines_items.back()->polylines.back().back()[constant_coordinate_index];
+    try{
+      Q_FOREACH(Scene_polylines_item* polylines_item, polylines_items)
+        Q_FOREACH(const std::vector<Kernel::Point_3>& points,
+                    polylines_item->polylines)
+          cdt.insert_constraint(points.begin(),points.end());
+    }catch(std::runtime_error)
+    {
+      QApplication::restoreOverrideCursor();
+      throw;
+    }
+    std::cout << " done (" << ltime.elapsed() << " ms)" << std::endl;
+
+    if (cdt.dimension()!=2){
+      QApplication::restoreOverrideCursor();
+      std::cout << "Triangulation is not of dimension 2" << std::endl;
+      return;
+    }
+
+    // start by marking the domain to mesh
+    Criteria criteria(0.125, target_length);
+    Mesher mesher(cdt, criteria);
+    bool use_seeds=ui.radioSeedsOut->isChecked() ||
+                   ui.radioSeedsIn->isChecked();
+    bool use_nesting = ui.radioNesting->isChecked();
+
+    if (!use_seeds){
+      if (use_nesting){
+        mark_nested_domains(cdt);
+        for(typename CDT::All_faces_iterator fit=cdt.all_faces_begin(),
+                                             fit_end=cdt.all_faces_end();
+                                             fit!=fit_end;++fit)
+        {
+          fit->set_in_domain(fit->info().in_domain());
+        }
+      }
+      mesher.init(use_nesting);
+    }
+    else
+      mesher.set_seeds(seeds.begin(), seeds.end(), ui.radioSeedsIn->isChecked(), true);
+
+    if (runMesh2){
+      time.restart();
+      std::cout << " Running refine_Delaunay_mesh_2 ..." << std::flush;
+      mesher.refine_mesh();
+      std::cout << " done (" << ltime.elapsed() << " ms)" << std::endl;
+    }
+
+    if (runLloyd){
+      ltime.restart();
+      std::cout << " Running lloyd_optimize_mesh_2..." << std::flush;
+      CGAL::lloyd_optimize_mesh_2(cdt,
+        CGAL::parameters::max_iteration_number = nb_iter);
+      std::cout << " done (" << ltime.elapsed() << " ms)" << std::endl;
+    }
+
+    // export result as a polyhedron item
+    QString iname =
+      polylines_items.size()==1?
+      polylines_items.front()->name()+QString("_meshed_"):
+      QString("2dmesh_");
+    iname+=QString::number(target_length);
+    if (runLloyd) iname+=QString("_Lloyd_")+QString::number(nb_iter);
+    Scene_polyhedron_item* poly_item = new Scene_polyhedron_item();
+    poly_item->setName(iname);
+    cdt2_to_face_graph(cdt,
+                       *poly_item->polyhedron(),
+                       constant_coordinate_index,
+                       constant_coordinate);
+    scene->addItem(poly_item);
+    poly_item->invalidateOpenGLBuffers();
+
+    std::cout << "ok (" << time.elapsed() << " ms)" << std::endl;
+    // default cursor
+    QApplication::restoreOverrideCursor();
+  }
+
+  int detect_constant_coordinate(
+    const std::vector<Scene_polylines_item*>& polylines_items,
+    const std::vector<Scene_points_with_normal_item*>& points_items)
+  {
+    int res=-1;
+    Kernel::Point_3 ref = polylines_items.front()->polylines.front().front();
+    Q_FOREACH(Scene_polylines_item* polylines_item, polylines_items)
+      Q_FOREACH(const std::vector<Kernel::Point_3>& points,
+                  polylines_item->polylines)
+        Q_FOREACH(const Kernel::Point_3& pt, points)
+        {
+          int nbe=0, candidate=-1;
+          for (int i=0; i<3; ++i)
+            if (ref[i]==pt[i]){
+              ++nbe;
+              candidate=i;
+            }
+          if (nbe==0) return -1;
+          if (nbe==1){
+            if (res==-1)
+              res=candidate;
+            else
+              if(res!=candidate) return -1;
+          }
+        }
+    if (res==-1) return res;
+    Q_FOREACH(Scene_points_with_normal_item* points_item, points_items)
+      Q_FOREACH(UI_point_3<Kernel> pt, *points_item->point_set())
+        if (pt[res]!=ref[res])
+          return -1;
+    return res;
+  }
+
+public Q_SLOTS:
+
+  void run()
+  {
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    //collect input polylines
+    std::vector<Scene_polylines_item*> polylines_items;
+    std::vector<Scene_points_with_normal_item*> points_items;
+    double inf = std::numeric_limits<double>::infinity();
+    CGAL::Three::Scene_interface::Bbox bbox(inf,inf,inf,-inf,-inf,-inf);
+    Q_FOREACH(int index, scene->selectionIndices())
+    {
+      Scene_polylines_item* polylines_item =
+        qobject_cast<Scene_polylines_item*>(scene->item(index));
+      if (polylines_item){
+        polylines_items.push_back(polylines_item);
+        bbox=bbox+polylines_item->bbox();
+      }
+      else{
+        Scene_points_with_normal_item* points_item =
+          qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
+        if (points_item)
+          points_items.push_back(points_item);
+      }
+    }
+
+    double diag = CGAL::sqrt(
+          (bbox.xmax()-bbox.xmin())*(bbox.xmax()-bbox.xmin())
+          +(bbox.ymax()-bbox.ymin())*(bbox.ymax()-bbox.ymin())
+          +(bbox.zmax()-bbox.zmax()) *(bbox.zmax()-bbox.zmax())
+          );
+    QApplication::restoreOverrideCursor();
+    switch( detect_constant_coordinate(polylines_items, points_items) )
+    {
+      using namespace CGAL;
+      typedef Kernel K;
+      case 0:
+        mesh<Projection_traits_yz_3<K> >(polylines_items, points_items, diag, 0);
+      break;
+      case 1:
+        mesh<Projection_traits_xz_3<K> >(polylines_items, points_items, diag, 1);
+      break;
+      case 2:
+        mesh<Projection_traits_xy_3<K> >(polylines_items, points_items, diag, 2);
+      break;
+      default:
+        QMessageBox::critical(mw,
+                              "Invalid Input Data",
+                              "Polylines and seed points must all be in "
+                              "the same xy, yz or xz plane");
+    }
+  }
+
+private:
+  QAction* actionMesh_2_;
+
+}; // end Mesh_2_plugin
+
+#include "Mesh_2_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_2/mesh_2_dialog.ui b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_2/mesh_2_dialog.ui
new file mode 100644
index 0000000..566c4df
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_2/mesh_2_dialog.ui
@@ -0,0 +1,226 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>mesh_2_dialog</class>
+ <widget class="QDialog" name="mesh_2_dialog">
+  <property name="enabled">
+   <bool>true</bool>
+  </property>
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>424</width>
+    <height>301</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>2D Mesh Criteria</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <widget class="QGroupBox" name="groupBox">
+     <property name="title">
+      <string>Mesh_2</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout" columnstretch="0,1">
+      <item row="3" column="1">
+       <widget class="QCheckBox" name="runLloyd_checkbox">
+        <property name="text">
+         <string/>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="0">
+       <widget class="QLabel" name="edgeLength_label">
+        <property name="text">
+         <string>Maximum edge length</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+        <property name="buddy">
+         <cstring>edgeLength_dspinbox</cstring>
+        </property>
+       </widget>
+      </item>
+      <item row="4" column="0">
+       <widget class="QLabel" name="nbIterations_label">
+        <property name="text">
+         <string>Number of iterations</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+        <property name="buddy">
+         <cstring>nbIterations_spinbox</cstring>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="1">
+       <widget class="QDoubleSpinBox" name="edgeLength_dspinbox">
+        <property name="minimumSize">
+         <size>
+          <width>110</width>
+          <height>0</height>
+         </size>
+        </property>
+        <property name="maximum">
+         <double>1000.000000000000000</double>
+        </property>
+        <property name="singleStep">
+         <double>0.100000000000000</double>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="0">
+       <widget class="QLabel" name="runMesh2_label">
+        <property name="text">
+         <string>Run Mesh Refinement</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+       </widget>
+      </item>
+      <item row="3" column="0">
+       <widget class="QLabel" name="runLloyd_label">
+        <property name="text">
+         <string>Run Lloyd Optimisation</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+       </widget>
+      </item>
+      <item row="4" column="1">
+       <widget class="QSpinBox" name="nbIterations_spinbox">
+        <property name="enabled">
+         <bool>false</bool>
+        </property>
+        <property name="minimumSize">
+         <size>
+          <width>110</width>
+          <height>0</height>
+         </size>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="0">
+       <widget class="QLabel" name="label">
+        <property name="text">
+         <string>Domain Definition:</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="1">
+       <layout class="QVBoxLayout" name="verticalLayout_2">
+        <item>
+         <widget class="QRadioButton" name="radioAll">
+          <property name="text">
+           <string>Whole Domain</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QRadioButton" name="radioNesting">
+          <property name="text">
+           <string>Use Nesting Number</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QRadioButton" name="radioSeedsIn">
+          <property name="text">
+           <string>With Seeds Inside the Domain</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QRadioButton" name="radioSeedsOut">
+          <property name="text">
+           <string>With Seeds Outside the Domain</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+      <item row="0" column="1">
+       <widget class="QCheckBox" name="runMesh2_checkbox">
+        <property name="text">
+         <string/>
+        </property>
+        <property name="checked">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item>
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <tabstops>
+  <tabstop>buttonBox</tabstop>
+ </tabstops>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>mesh_2_dialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>388</x>
+     <y>288</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>195</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>mesh_2_dialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>388</x>
+     <y>288</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>195</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/C3t3_io_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/C3t3_io_plugin.cpp
new file mode 100644
index 0000000..ce74c20
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/C3t3_io_plugin.cpp
@@ -0,0 +1,417 @@
+#include <CGAL/Mesh_3/io_signature.h>
+#include "Scene_c3t3_item.h"
+
+#include <CGAL/Three/Polyhedron_demo_io_plugin_interface.h>
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+#include <CGAL/IO/File_avizo.h>
+#include <iostream>
+#include <fstream>
+
+
+class Polyhedron_demo_c3t3_binary_io_plugin :
+  public QObject,
+  public CGAL::Three::Polyhedron_demo_io_plugin_interface,
+  public CGAL::Three::Polyhedron_demo_plugin_interface
+{
+    Q_OBJECT
+    Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface)
+    Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+    Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+public:
+  void init(QMainWindow*, CGAL::Three::Scene_interface* sc, Messages_interface*)
+  {
+    this->scene = sc;
+  }
+  QString name() const { return "C3t3_io_plugin"; }
+  QString nameFilters() const { return "binary files (*.cgal);;ascii (*.mesh);;maya (*.ma)"; }
+  QString saveNameFilters() const { return "binary files (*.cgal);;ascii (*.mesh);;maya (*.ma);;avizo (*.am);;OFF files (*.off)"; }
+  QString loadNameFilters() const { return "binary files (*.cgal)" ; }
+  QList<QAction*> actions() const
+  {
+    return QList<QAction*>();
+  }
+  bool applicable(QAction*) const
+  {
+    return false;
+  }
+  bool canLoad() const;
+  CGAL::Three::Scene_item* load(QFileInfo fileinfo);
+
+  bool canSave(const CGAL::Three::Scene_item*);
+  bool save(const CGAL::Three::Scene_item*, QFileInfo fileinfo);
+
+private:
+  bool try_load_other_binary_format(std::istream& in, C3t3& c3t3);
+  bool try_load_a_cdt_3(std::istream& in, C3t3& c3t3);
+  CGAL::Three::Scene_interface* scene;
+};
+
+
+bool Polyhedron_demo_c3t3_binary_io_plugin::canLoad() const {
+  return true;
+}
+
+
+CGAL::Three::Scene_item*
+Polyhedron_demo_c3t3_binary_io_plugin::load(QFileInfo fileinfo) {
+
+
+    if(fileinfo.suffix().toLower() == "cgal")
+    {
+        // Open file
+        std::ifstream in(fileinfo.filePath().toUtf8(),
+                         std::ios_base::in|std::ios_base::binary);
+        if(!in) {
+          std::cerr << "Error! Cannot open file "
+                    << (const char*)fileinfo.filePath().toUtf8() << std::endl;
+          return NULL;
+        }
+
+        Scene_c3t3_item* item = new Scene_c3t3_item();
+        item->setName(fileinfo.baseName());
+        item->setScene(scene);
+
+
+        if(item->load_binary(in)) {
+          return item;
+        }
+
+        item->c3t3().clear();
+        in.seekg(0);
+        if(try_load_other_binary_format(in, item->c3t3())) {
+          item->c3t3_changed();
+          item->changed();
+          return item;
+        }
+
+        item->c3t3().clear();
+        in.seekg(0);
+        if(try_load_a_cdt_3(in, item->c3t3())) {
+          item->c3t3_changed();
+          item->changed();
+          return item;
+        }
+    }
+
+
+
+  // if all loading failed...
+  return NULL;
+}
+
+bool Polyhedron_demo_c3t3_binary_io_plugin::canSave(const CGAL::Three::Scene_item* item)
+{
+  // This plugin supports c3t3 items.
+  return qobject_cast<const Scene_c3t3_item*>(item);
+}
+
+bool
+Polyhedron_demo_c3t3_binary_io_plugin::
+save(const CGAL::Three::Scene_item* item, QFileInfo fileinfo)
+{
+    const Scene_c3t3_item* c3t3_item = qobject_cast<const Scene_c3t3_item*>(item);
+    if ( NULL == c3t3_item )
+    {
+      return false;
+    }
+
+    QString path = fileinfo.absoluteFilePath();
+
+    if(path.endsWith(".cgal"))
+    {
+    std::ofstream out(fileinfo.filePath().toUtf8(),
+                     std::ios_base::out|std::ios_base::binary);
+
+    return out && c3t3_item->save_binary(out);
+    }
+
+   else  if (fileinfo.suffix() == "mesh")
+    {
+      std::ofstream medit_file (qPrintable(path));
+      c3t3_item->c3t3().output_to_medit(medit_file,true,true);
+          return true;
+    }
+    else if (fileinfo.suffix() == "ma")
+    {
+      std::ofstream maya_file (qPrintable(path));
+      c3t3_item->c3t3().output_to_maya(
+        maya_file,true);
+          return true;
+    }
+    else if (fileinfo.suffix() == "am")
+    {
+      std::ofstream avizo_file (qPrintable(path));
+      CGAL::output_to_avizo(avizo_file, c3t3_item->c3t3());
+      return true;
+    }
+    else if (fileinfo.suffix() == "off")
+    {
+      std::ofstream off_file(qPrintable(path));
+      c3t3_item->c3t3().output_facets_in_complex_to_off(off_file);
+      return true;
+    }
+    else
+        return false;
+}
+
+struct Fake_mesh_domain {
+  typedef CGAL::Tag_true Has_features;
+  typedef int Subdomain_index;
+  typedef std::pair<int,int> Surface_patch_index;
+  typedef int Curve_segment_index;
+  typedef int Corner_index;
+  typedef boost::variant<Subdomain_index,Surface_patch_index> Index;
+};
+
+typedef Geom_traits Fake_gt;
+typedef CGAL::Mesh_vertex_base_3<Fake_gt, Fake_mesh_domain> Fake_vertex_base;
+typedef CGAL::Compact_mesh_cell_base_3<Fake_gt, Fake_mesh_domain> Fake_cell_base;
+typedef CGAL::Triangulation_data_structure_3<Fake_vertex_base,Fake_cell_base> Fake_tds;
+typedef CGAL::Regular_triangulation_3<Fake_gt, Fake_tds> Fake_tr;
+typedef CGAL::Mesh_complex_3_in_triangulation_3<
+  Fake_tr,
+  Fake_mesh_domain::Corner_index,
+  Fake_mesh_domain::Curve_segment_index> Fake_c3t3;
+
+template <class Vb = CGAL::Triangulation_vertex_base_3<Kernel> >
+struct Fake_CDT_3_vertex_base : public Vb
+{
+  typedef Vb Base;
+  bool steiner;
+  std::size_t ref_1, ref_2;
+
+  template < typename TDS2 >
+  struct Rebind_TDS {
+    typedef typename Base::template Rebind_TDS<TDS2>::Other   Vb2;
+    typedef Fake_CDT_3_vertex_base<Vb2>  Other;
+  };
+};
+
+template <class Vb>
+std::istream&
+operator>>( std::istream& is, Fake_CDT_3_vertex_base<Vb>& v)
+{
+  is >> static_cast<typename Fake_CDT_3_vertex_base<Vb>::Base&>(v);
+  char s;
+  if( CGAL::is_ascii(is) ) {
+    is >> s;
+    if( s == 'S' ) {
+      v.steiner = true;
+      is >> v.ref_1 >> v.ref_2;
+    }
+    else {
+      CGAL_assertion(s == '.' || s == 'F');
+      v.steiner = false;
+    }
+  } else {
+    CGAL::read( is, s );
+    if(is.bad()) return is;
+    if( s == 'S' ) {
+      v.steiner = true;
+      CGAL::read( is, v.ref_1 );
+      CGAL::read( is, v.ref_2 );
+    }
+    else {
+      // if(s != '.') {
+      // 	std::cerr << "v.point()=" << v.point() << std::endl;
+      // 	std::cerr << "s=" << s << " (" << (int)s
+      // 		  << "), just before position "
+      // 		  << is.tellg() << " !\n";
+      // }
+      CGAL_assertion(s == '.' || s== 'F');
+      v.steiner = false;
+    }
+  }
+  return is;
+}
+
+template <class Cb = CGAL::Triangulation_cell_base_3<Kernel> >
+struct Fake_CDT_3_cell_base : public Cb
+{
+  typedef Cb Base;
+  int constrained_facet[4];
+  bool _restoring[6];
+  int to_edge_index( int li, int lj ) const {
+    CGAL_triangulation_precondition( li >= 0 && li < 4 );
+    CGAL_triangulation_precondition( lj >= 0 && lj < 4 );
+    CGAL_triangulation_precondition( li != lj );
+    return ( li==0 || lj==0 ) ? li+lj-1 : li+lj;
+  }
+
+  template < typename TDS2 >
+  struct Rebind_TDS {
+    typedef typename Base::template Rebind_TDS<TDS2>::Other   Cb2;
+    typedef Fake_CDT_3_cell_base<Cb2>  Other;
+  };
+};
+
+template <typename Cb>
+std::istream&
+operator>>( std::istream& is, Fake_CDT_3_cell_base<Cb>& c) {
+  char s;
+  for( int li = 0; li < 4; ++li ) {
+    if( CGAL::is_ascii(is) )
+      is >> c.constrained_facet[li];
+    else
+      CGAL::read( is, c.constrained_facet[li] );
+  }
+
+  if( CGAL::is_ascii(is) ) {
+    is >> s;
+    CGAL_assertion(s == '-');
+  }
+  is >> static_cast<typename Fake_CDT_3_cell_base<Cb>::Base&>(c);
+  for( int li = 0; li < 3; ++li ) {
+    for( int lj = li+1; lj < 4; ++lj ) {
+      char s;
+      is >> s;
+      if(s == 'C') {
+        c._restoring[c.to_edge_index(li, lj)] = true;
+      } else {
+        if(s != '.') {
+          std::cerr << "cDT cell:";
+          for( int li = 0; li < 4; ++li ) {
+            std::cerr << " " << c.constrained_facet[li];
+          }
+          std::cerr << "\n";
+          std::cerr << "s=" << s << " (" << (int)s
+                    << "), just before position "
+                    << is.tellg() << " !\n";	}
+        CGAL_assertion(s == '.');
+        c._restoring[c.to_edge_index(li, lj)] = false;
+      }
+    }
+  }
+  return is;
+}
+
+typedef CGAL::Triangulation_data_structure_3<Fake_CDT_3_vertex_base<>, Fake_CDT_3_cell_base<> > Fake_CDT_3_TDS;
+typedef CGAL::Triangulation_3<Kernel, Fake_CDT_3_TDS> Fake_CDT_3;
+
+typedef Fake_mesh_domain::Surface_patch_index Fake_patch_id;
+
+struct Update_vertex {
+  typedef Fake_mesh_domain::Surface_patch_index Sp_index;
+  template <typename V1, typename V2>
+  bool operator()(const V1& v1, V2& v2) {
+    v2.set_point(v1.point());
+    v2.set_dimension(v1.in_dimension());
+    v2.set_special(v1.is_special());
+    switch(v1.in_dimension()) {
+    case 0:
+    case 1:
+    case 3:
+      v2.set_index(boost::get<int>(v1.index()));
+      break;
+    default: // case 2
+      const typename V1::Index& index = v1.index();
+      const Sp_index sp_index = boost::get<Sp_index>(index);
+      v2.set_index((std::max)(sp_index.first, sp_index.second));
+    }
+    return true;
+  }
+}; // end struct Update_vertex
+
+struct Update_cell {
+  typedef Fake_mesh_domain::Surface_patch_index Sp_index;
+  template <typename C1, typename C2>
+  bool operator()(const C1& c1, C2& c2) {
+    c2.set_subdomain_index(c1.subdomain_index());
+    for(int i = 0; i < 4; ++i) {
+      const Sp_index sp_index = c1.surface_patch_index(i);
+      c2.set_surface_patch_index(i, (std::max)(sp_index.first,
+                                               sp_index.second));
+      CGAL_assertion(c1.is_facet_on_surface(i) ==
+                     c2.is_facet_on_surface(i));
+    }
+    return true;
+  }
+}; // end struct Update_cell
+
+#include <CGAL/Triangulation_file_input.h>
+
+struct Update_vertex_from_CDT_3 {
+  template <typename V1, typename V2>
+  bool operator()(const V1& v1, V2& v2) {
+    v2.set_point(v1.point());
+    v2.set_dimension(2);
+    v2.set_special(false);
+    return true;
+  }
+}; // end struct Update_vertex
+
+struct Update_cell_from_CDT_3 {
+  typedef Fake_mesh_domain::Surface_patch_index Sp_index;
+  template <typename C1, typename C2>
+  bool operator()(const C1& c1, C2& c2) {
+    c2.set_subdomain_index(1);
+    for(int i = 0; i < 4; ++i) {
+      c2.set_surface_patch_index(i, c1.constrained_facet[i]);
+    }
+    return true;
+  }
+}; // end struct Update_cell
+
+bool
+Polyhedron_demo_c3t3_binary_io_plugin::
+try_load_a_cdt_3(std::istream& is, C3t3& c3t3)
+{
+  std::cerr << "Try load a CDT_3...";
+  CGAL::set_binary_mode(is);
+  if(CGAL::file_input<
+     Fake_CDT_3,
+     C3t3::Triangulation,
+     Update_vertex_from_CDT_3,
+     Update_cell_from_CDT_3>(is, c3t3.triangulation()))
+  {
+    c3t3.rescan_after_load_of_triangulation();
+    std::cerr << "Try load a CDT_3... DONE";
+    return true;
+  }
+  else {
+    return false;
+  }
+}
+//Generates a compilation error.
+bool
+Polyhedron_demo_c3t3_binary_io_plugin::
+try_load_other_binary_format(std::istream& is, C3t3& c3t3)
+{
+  CGAL::set_ascii_mode(is);
+  std::string s;
+  if(!(is >> s)) return false;
+  bool binary = false;
+  if(s == "binary") {
+    binary = true;
+    if(!(is >> s)) return false;
+  }
+  if( s != "CGAL" ||
+      !(is >> s) ||
+      s != "c3t3")
+  {
+    return false;
+  }
+  std::getline(is, s);
+  if(s != "") {
+    if(s != std::string(" ") + CGAL::Get_io_signature<Fake_c3t3>()()) {
+      std::cerr << "Polyhedron_demo_c3t3_binary_io_plugin::try_load_other_binary_format:"
+                << "\n  expected format: " << CGAL::Get_io_signature<Fake_c3t3>()()
+                << "\n       got format:" << s << std::endl;
+      return false;
+    }
+  }
+  if(binary) CGAL::set_binary_mode(is);
+  else CGAL::set_ascii_mode(is);
+  std::istream& f_is = CGAL::file_input<
+    Fake_c3t3::Triangulation,
+    C3t3::Triangulation,
+    Update_vertex,
+    Update_cell>(is, c3t3.triangulation());
+
+  c3t3.rescan_after_load_of_triangulation();
+  return f_is.good();
+}
+
+#include <QtPlugin>
+#include "C3t3_io_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt
new file mode 100644
index 0000000..97a7345
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt
@@ -0,0 +1,51 @@
+include( polyhedron_demo_macros )
+
+if ( Boost_VERSION GREATER 103400 )
+  remove_definitions(-DQT_STATICPLUGIN)
+
+  qt5_wrap_cpp( VOLUME_MOC_OUTFILES ${CMAKE_CURRENT_SOURCE_DIR}/Volume_plane_thread.h )
+  qt5_wrap_cpp( VOLUME_MOC_OUTFILES ${CMAKE_CURRENT_SOURCE_DIR}/Volume_plane_interface.h )
+  qt5_wrap_ui( meshingUI_FILES  Meshing_dialog.ui Smoother_dialog.ui Local_optimizers_dialog.ui )
+  qt5_generate_moc( "Polyhedron_demo_mesh_3_plugin_cgal_code.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Scene_c3t3_item.moc" )
+  polyhedron_demo_plugin(mesh_3_plugin Mesh_3_plugin
+                         Mesh_3_plugin_cgal_code.cpp Meshing_thread.cpp
+                         ${meshingUI_FILES})
+  target_link_libraries(mesh_3_plugin scene_polyhedron_item scene_polygon_soup_item scene_polylines_item scene_implicit_function_item scene_image_item
+                        scene_c3t3_item ${QGLVIEWER_LIBRARIES} ${OPENGL_gl_LIBRARY} )
+
+  set(VTK_LIBS "")
+  find_package(VTK QUIET COMPONENTS
+    vtkImagingGeneral  vtkIOImage NO_MODULE)
+  if (VTK_FOUND)
+    include(${VTK_USE_FILE})
+    if ("${VTK_VERSION_MAJOR}" GREATER "5")
+      if(VTK_LIBRARIES)
+        add_definitions(-DCGAL_USE_VTK)
+        set(VTK_LIBS vtkImagingGeneral vtkIOImage)
+      else()
+        message(STATUS "NOTICE : the DICOM files (.dcm) need VTK libraries to be open and will not be able to.")
+      endif()
+    else()
+      message(STATUS "NOTICE : the DICOM files (.dcm) need VTK libraries to be open and will not be able to.")
+    endif()
+  else()
+    message(STATUS "NOTICE : the DICOM files (.dcm) need VTK libraries to be open and will not be able to.")
+  endif()
+  qt5_wrap_ui( imgUI_FILES Image_res_dialog.ui raw_image.ui)
+  polyhedron_demo_plugin(io_image_plugin Io_image_plugin Volume_plane_intersection.cpp Raw_image_dialog.cpp ${imgUI_FILES} ${VOLUME_MOC_OUTFILES})
+  target_link_libraries(io_image_plugin scene_image_item ${VTK_LIBS} )
+  polyhedron_demo_plugin(mesh_3_optimization_plugin Optimization_plugin
+    Optimization_plugin_cgal_code.cpp Optimizer_thread.cpp
+    ${meshingUI_FILES})
+  target_link_libraries(mesh_3_optimization_plugin scene_c3t3_item scene_polyhedron_item scene_image_item scene_implicit_function_item )
+
+
+
+  polyhedron_demo_plugin(c3t3_io_plugin C3t3_io_plugin)
+  target_link_libraries(c3t3_io_plugin  scene_c3t3_item)
+  else( Boost_VERSION GREATER 103400 )
+    message(STATUS "warning: the plugin mesh_3_plugin requires Boost>=1.34.1 and will not be compiled.")
+  endif( Boost_VERSION GREATER 103400 )
+
+  polyhedron_demo_plugin(detect_sharp_edges_plugin Detect_sharp_edges_plugin)
+  target_link_libraries(detect_sharp_edges_plugin scene_polyhedron_item)
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Detect_sharp_edges_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Detect_sharp_edges_plugin.cpp
new file mode 100644
index 0000000..fe0fab5
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Detect_sharp_edges_plugin.cpp
@@ -0,0 +1,126 @@
+#include <QApplication>
+#include <QMainWindow>
+#include <QAction>
+#include <QStringList>
+#include <QInputDialog>
+#include <QtPlugin>
+
+#include "Scene_polyhedron_item.h"
+#include "Scene_polygon_soup_item.h"
+#include "Polyhedron_type.h"
+
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+
+#include "Polyhedron_demo_detect_sharp_edges.h"
+
+using namespace CGAL::Three;
+class Polyhedron_demo_detect_sharp_edges_plugin :
+  public QObject,
+  public Polyhedron_demo_plugin_interface
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+public:
+  void init(QMainWindow* mainWindow, Scene_interface* scene_interface, Messages_interface*) {
+    this->scene = scene_interface;
+    this->mw = mainWindow;
+    actionSharEdges = new QAction("Detect Sharp Features", mw);
+    actionSharEdges->setObjectName("detectSharpFeaturesAction");
+    if(actionSharEdges) {
+      connect(actionSharEdges, SIGNAL(triggered()),
+              this, SLOT(detectSharpEdgesWithInputDialog()));
+    }
+  }
+
+  bool applicable(QAction*) const {
+    Q_FOREACH(int index, scene->selectionIndices())
+    {
+      Scene_polyhedron_item* item =
+        qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+      if (item) return true;
+    }
+    return false;
+  }
+  
+  QList<QAction*> actions() const {
+    return QList<QAction*>() << actionSharEdges;
+  }
+
+public Q_SLOTS:
+void detectSharpEdges(bool input_dialog = false, double angle = 60);
+  void detectSharpEdgesWithInputDialog();
+
+protected:
+  Kernel::Vector_3 facet_normal(Polyhedron::Facet_handle f);
+  bool is_sharp(Polyhedron::Halfedge_handle he);
+
+private:
+  QAction* actionSharEdges;
+  CGAL::Three::Scene_interface* scene;
+  QMainWindow* mw;
+}; // end Polyhedron_demo_detect_sharp_edges_plugin
+
+void Polyhedron_demo_detect_sharp_edges_plugin::detectSharpEdgesWithInputDialog()
+{
+  detectSharpEdges(true);
+}
+
+void Polyhedron_demo_detect_sharp_edges_plugin::detectSharpEdges(bool input_dialog,
+                                                                 double angle)
+{
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  typedef std::pair<int,Polyhedron*> Poly_tuple;
+  
+  // Get selected items
+  QList<Poly_tuple> polyhedrons;
+  Q_FOREACH(int index, scene->selectionIndices())
+  {
+    Scene_polyhedron_item* item = 
+      qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+    if(!item)
+      return;
+    
+    Polyhedron* pMesh = item->polyhedron();
+    if(!pMesh)
+      return;
+    item->show_feature_edges(true);
+    polyhedrons << make_pair(index, pMesh);
+  }
+
+  QApplication::restoreOverrideCursor();
+  if(input_dialog) {
+    bool ok = true;
+    angle = QInputDialog::getDouble(NULL, 
+                                    tr("Sharp edges max angle"),
+                                    tr("Angle in degrees between 0 and 180:"),
+                                    angle, // value
+                                    0.,          // min 
+                                    180., // max
+                                    2,          // decimals
+                                    &ok);
+    if(!ok) return;
+  }
+  // Detect edges
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+
+  Q_FOREACH(Poly_tuple tuple, polyhedrons)
+  {
+    Polyhedron* pMesh = tuple.second;
+    if (!pMesh) continue;
+
+    CGAL::detect_sharp_edges(pMesh, angle);
+
+    //update item
+    scene->item(tuple.first)->invalidateOpenGLBuffers();
+
+    // update scene
+    scene->itemChanged(tuple.first);
+  }
+
+  // default cursor
+  QApplication::restoreOverrideCursor();
+}
+
+#include "Detect_sharp_edges_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Facet_extra_criterion.h b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Facet_extra_criterion.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Facet_extra_criterion.h
rename to 3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Facet_extra_criterion.h
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Image_res_dialog.ui b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Image_res_dialog.ui
new file mode 100644
index 0000000..066201c
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Image_res_dialog.ui
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ImagePrecisionDialog</class>
+ <widget class="QDialog" name="ImagePrecisionDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>421</width>
+    <height>370</height>
+   </rect>
+  </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="windowTitle">
+   <string>Load a 3D image</string>
+  </property>
+  <layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0,0,0,0,0,0,0,0,0,0,0" columnstretch="0,1">
+   <item row="11" column="0" colspan="2">
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>0</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="0" column="1">
+    <widget class="QComboBox" name="imageType"/>
+   </item>
+   <item row="12" column="0" colspan="2">
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="0">
+    <widget class="QLabel" name="label_3">
+     <property name="text">
+      <string>Please choose the image &type</string>
+     </property>
+     <property name="buddy">
+      <cstring>imageType</cstring>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="0" colspan="2">
+    <widget class="QGroupBox" name="groupBox">
+     <property name="title">
+      <string>Drawing settings for a segment image</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout_2">
+      <item row="0" column="0">
+       <layout class="QGridLayout" name="gridLayout_3" columnstretch="0,1">
+        <item row="2" column="1">
+         <widget class="QComboBox" name="precisionList">
+          <property name="editable">
+           <bool>false</bool>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="0">
+         <widget class="QLabel" name="label_2">
+          <property name="font">
+           <font>
+            <pointsize>11</pointsize>
+            <italic>true</italic>
+           </font>
+          </property>
+          <property name="text">
+           <string>1:x means that x voxels of the original image are represented by 1 cube in the drawn image</string>
+          </property>
+          <property name="wordWrap">
+           <bool>true</bool>
+          </property>
+         </widget>
+        </item>
+        <item row="2" column="0">
+         <widget class="QLabel" name="label">
+          <property name="lineWidth">
+           <number>1</number>
+          </property>
+          <property name="text">
+           <string>Please choose the image drawing &precision</string>
+          </property>
+          <property name="wordWrap">
+           <bool>true</bool>
+          </property>
+          <property name="buddy">
+           <cstring>precisionList</cstring>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+     </layout>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>ImagePrecisionDialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>248</x>
+     <y>254</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>ImagePrecisionDialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>316</x>
+     <y>260</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp
new file mode 100644
index 0000000..40221a3
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp
@@ -0,0 +1,1054 @@
+#ifdef _MSC_VER
+#  pragma warning(disable:4244) // conversion with loss of data
+#endif
+
+#include "Volume_plane.h"
+#include "Volume_plane_thread.h"
+#include "Volume_plane_intersection.h"
+#include "Messages_interface.h"
+#include "config.h"
+#include "Scene_image_item.h"
+#include "Image_type.h"
+#include "ui_Image_res_dialog.h"
+
+#include <CGAL/Image_3.h>
+#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+#include <CGAL/Three/Scene_interface.h>
+#include <CGAL/Three/Scene_item.h>
+#include <CGAL/Three/Viewer_interface.h>
+#include <CGAL/config.h>
+#include <CGAL/use.h>
+#include <QAction>
+#include <QMenu>
+#include <QMouseEvent>
+#include <QList>
+#include <QInputDialog>
+#include <QSlider>
+#include <QLabel>
+#include <QHBoxLayout>
+#include <QVBoxLayout>
+#include <QDockWidget>
+#include <QMainWindow>
+#include <QMessageBox>
+#include <QString>
+#include <QFontMetrics>
+#include <QFileDialog>
+
+#include <cassert>
+#include <iostream>
+
+#include <boost/type_traits.hpp>
+#include <boost/optional.hpp>
+#include "Scene.h"
+
+#include <QSettings>
+#include <QUrl>
+#include "Raw_image_dialog.h"
+#include <CGAL/Three/Polyhedron_demo_io_plugin_interface.h>
+#include <fstream>
+#ifdef CGAL_USE_VTK
+#include <CGAL/read_vtk_image_data.h>
+
+#include <vtkImageData.h>
+#include <vtkDICOMImageReader.h>
+#include <vtkImageReader.h>
+#include <vtkImageGaussianSmooth.h>
+#include <vtkDemandDrivenPipeline.h>
+#endif
+
+// Covariant return types don't work for scalar types and we cannot
+// have templates here, hence this unfortunate hack.
+
+// The input float value we are reading is always in
+// 0..1 and min_max is the range it came from.
+struct IntConverter {
+  std::pair<int, int> min_max;
+
+  int operator()(float f) {
+    float s = f * (min_max.second - min_max.first);
+    return s + min_max.first;
+  }
+};
+
+struct DoubleConverter {
+  std::pair<float, float> min_max;
+
+  float operator()(float f) {
+    float s = f * (min_max.second - min_max.first);
+    return s + min_max.first;
+  }
+};
+
+class PixelReader : public QObject
+{
+Q_OBJECT
+public Q_SLOTS:
+  void update(const QMouseEvent *e) {
+    getPixel(e->pos());
+  }
+Q_SIGNALS:
+  void x(int);
+
+public:
+  void setIC(const IntConverter& x) { ic = x; fc = boost::optional<DoubleConverter>(); }
+  void setFC(const DoubleConverter& x) { fc = x; ic = boost::optional<IntConverter>(); }
+  void setViewer(Viewer_interface* viewer) { this->viewer = viewer; }
+
+private:
+  boost::optional<IntConverter> ic;
+  boost::optional<DoubleConverter> fc;
+  Viewer_interface* viewer;
+
+  void getPixel(const QPoint& e) {
+    float data[3];
+    int vp[4];
+    viewer->glGetIntegerv(GL_VIEWPORT, vp);
+    viewer->glReadPixels(e.x(), vp[3] - e.y(), 1, 1, GL_RGB, GL_FLOAT, data);
+
+    if(fc) {
+      Q_EMIT x( (*fc)(data[0]) );
+    } else if(ic) {
+      Q_EMIT x( (*ic)(data[0]) );
+    }
+  }
+};
+
+
+class Plane_slider : public QSlider
+{
+  Q_OBJECT
+public:
+  Plane_slider(const qglviewer::Vec& v, int id, Scene_interface* scene,
+               qglviewer::ManipulatedFrame* frame, Qt::Orientation ori, QWidget* widget)
+    : QSlider(ori, widget), v(v), id(id), scene(scene), frame(frame) {
+    this->setTracking(true);
+    connect(frame,  SIGNAL(manipulated()), this, SLOT(updateCutPlane()));
+  }
+
+public:
+  void sliderChange(SliderChange c) {
+    QSlider::sliderChange(c);
+    if(c == SliderValueChange) {
+      updateFramePosition();
+    }
+
+  }
+
+public Q_SLOTS:
+  void updateCutPlane()
+  {
+     ready_to_cut = true;
+     QTimer::singleShot(0,this,SLOT(updateValue()));
+  }
+
+  void setFramePosition()
+  {
+    if(!ready_to_move)
+      return;
+    qglviewer::Vec v2 = v * (this->value() / scale);
+    frame->setTranslationWithConstraint(v2);
+    scene->itemChanged(id);
+    Q_EMIT realChange(this->value() / scale);
+    ready_to_move = false;
+  }
+  void updateValue() {
+    if(!ready_to_cut)
+      return;
+#if QGLVIEWER_VERSION >= 0x020600
+    typedef qreal qglviewer_real;
+#else // QGLViewer < 2.6.0
+    typedef float qglviewer_real;
+#endif // QGLViewer < 2.6.0
+    qglviewer_real a, b, c;
+    frame->getPosition(a, b, c);
+    float sum1 = float(a + b + c);
+    float sum2 = float(v.x + v.y + v.z);
+    sum1 /= sum2;
+    setValue(sum1 * scale);
+    ready_to_cut = false;
+  }
+
+Q_SIGNALS:
+  void realChange(int);
+
+private:
+  static const unsigned int scale;
+  bool ready_to_cut;
+  bool ready_to_move;
+  qglviewer::Vec v;
+  int id;
+  Scene_interface* scene;
+  qglviewer::ManipulatedFrame* frame;
+  void updateFramePosition()
+  {
+    ready_to_move = true;
+    QTimer::singleShot(0,this,SLOT(setFramePosition()));
+  }
+};
+
+const unsigned int Plane_slider::scale = 100;
+
+class Io_image_plugin :
+  public QObject,
+  public CGAL::Three::Polyhedron_demo_plugin_helper,
+  public CGAL::Three::Polyhedron_demo_io_plugin_interface
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface)
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0")
+
+public:
+
+  bool applicable(QAction*) const {
+    return qobject_cast<Scene_image_item*>(scene->item(scene->mainSelectionIndex()));
+  }
+
+
+  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface *mi) {
+    this->message_interface = mi;
+    this->scene = scene_interface;
+    this->mw = mainWindow;
+    x_control = NULL;
+    y_control = NULL;
+    z_control = NULL;
+    current_control = NULL;
+    planeSwitch = new QAction("Add Volume Planes", mw);
+    QAction *actionLoadDCM = new QAction("Open directory", mw);
+    connect(actionLoadDCM, SIGNAL(triggered()), this, SLOT(on_actionLoadDCM_triggered()));
+    if(planeSwitch) {
+      planeSwitch->setProperty("subMenuName", "3D Mesh Generation");
+      connect(planeSwitch, SIGNAL(triggered()),
+              this, SLOT(selectPlanes()));
+      Scene* true_scene = dynamic_cast<Scene*>(scene);
+      connect(true_scene,SIGNAL(itemIndexSelected(int)),
+              this, SLOT(connect_controls(int)));
+    }
+    Viewer_interface* v = mw->findChild<Viewer_interface*>("viewer");
+    CGAL_assertion(v != 0);
+    pxr_.setViewer(v);
+    connect(v, SIGNAL(pointSelected(const QMouseEvent *)), &pxr_, SLOT(update(const QMouseEvent *)));
+    createOrGetDockLayout();
+
+    QMenu* menuFile = mw->findChild<QMenu*>("menuFile");
+    if ( NULL != menuFile )
+    {
+      QList<QAction*> menuFileActions = menuFile->actions();
+
+      // Look for action just after "Load..." action
+      QAction* actionAfterLoad = NULL;
+      for ( QList<QAction*>::iterator it_action = menuFileActions.begin(),
+           end = menuFileActions.end() ; it_action != end ; ++ it_action ) //Q_FOREACH( QAction* action, menuFileActions)
+      {
+        if ( NULL != *it_action && (*it_action)->text().contains("Load Plugin") )
+        {
+          ++it_action;
+          if ( it_action != end && NULL != *it_action )
+          {
+            actionAfterLoad = *it_action;
+          }
+        }
+      }
+
+      // Insert "Load implicit function" action
+      if ( NULL != actionAfterLoad )
+      {
+        menuFile->insertAction(actionAfterLoad,actionLoadDCM);
+      }
+    }
+  }
+  QList<QAction*> actions() const {
+    return QList<QAction*>() << planeSwitch;
+  }
+  virtual void closure()
+  {
+      QDockWidget* controlDockWidget = mw->findChild<QDockWidget*>("volumePlanesControl");
+      if(controlDockWidget)
+          controlDockWidget->hide();
+  }
+  Io_image_plugin() : planeSwitch(NULL) {}
+
+  QString nameFilters() const;
+  bool canLoad() const;
+  CGAL::Three::Scene_item* load(QFileInfo fileinfo);
+
+  bool canSave(const CGAL::Three::Scene_item*);
+  bool save(const CGAL::Three::Scene_item*, QFileInfo) { return false; }
+  QString name() const { return "segmented images"; }
+
+
+public Q_SLOTS:
+  void on_imageType_changed(int index)
+  {
+    if(index == 0)
+      ui.groupBox->setVisible(true);
+    else
+      ui.groupBox->setVisible(false);
+  }
+  void selectPlanes() {
+
+    std::vector< Scene_image_item* > seg_items;
+    Scene_image_item* seg_img;
+    seg_img = NULL;
+    for(int i = 0; i < scene->numberOfEntries(); ++i) {
+      Scene_image_item* tmp = qobject_cast<Scene_image_item*>(scene->item(i));
+      if(tmp != NULL){
+        seg_items.push_back(tmp);
+      }
+    }
+    if(seg_items.empty()) {
+      QMessageBox::warning(mw, tr("No suitable item found"), tr("Load an inrimage or hdr file to enable Volume Planes."));
+      return;
+    } else {
+      QList<QString> items;
+      for(std::vector< Scene_image_item* >::const_iterator it = seg_items.begin();
+          it != seg_items.end(); ++it) {
+        items << (*it)->name();
+      }
+      bool ok;
+      QString selected = QInputDialog::getItem(mw, tr("Select a dataset:"), tr("Items"), items, 0, false, &ok);
+      if(!ok || selected.isEmpty())
+        return;
+      for(std::vector< Scene_image_item*>::const_iterator it = seg_items.begin();
+          it != seg_items.end(); ++it) {
+        if(selected == (*it)->name())
+          seg_img = *it;
+      }
+    }
+    if(group_map.keys().contains(seg_img))
+      this->message_interface->warning("This item already has volume planes.");
+    else
+    {
+      // Opens a modal Dialog to prevent the user from manipulating things that could mess with the planes creation and cause a segfault.
+      msgBox.setText("Planes created : 0/3");
+      msgBox.setStandardButtons(QMessageBox::NoButton);
+      msgBox.show();
+      createPlanes(seg_img);
+    }
+  }
+
+  void addVP(Volume_plane_thread* thread) {
+    Volume_plane_interface* plane = thread->getItem();
+    plane->init();
+    // add the interface for this Volume_plane
+    int id = scene->addItem(plane);
+    scene->changeGroup(plane, group);
+    group->lockChild(plane);
+    switch(thread->type())
+    {
+    case 'x':
+      delete x_slider;
+      x_slider = new Plane_slider(plane->translationVector(), id, scene, plane->manipulatedFrame(),
+                                         Qt::Horizontal, x_control);
+      x_slider->setRange(0, (plane->cDim() - 1) * 100);
+      connect(x_slider, SIGNAL(realChange(int)), x_cubeLabel, SLOT(setNum(int)));
+      connect(x_slider, SIGNAL(realChange(int)), this, SLOT(set_value()));
+      connect(plane, SIGNAL(manipulated(int)), x_cubeLabel, SLOT(setNum(int)));
+      connect(plane, SIGNAL(aboutToBeDestroyed()), this, SLOT(destroy_x_item()));
+      x_box->addWidget(x_slider);
+      x_box->addWidget(x_cubeLabel);
+      x_control->setVisible(true);
+      break;
+    case 'y':
+      delete y_slider;
+      y_slider = new Plane_slider(plane->translationVector(), id, scene, plane->manipulatedFrame(),
+                                         Qt::Horizontal, y_control);
+      y_slider->setRange(0, (plane->cDim() - 1) * 100);
+      connect(y_slider, SIGNAL(realChange(int)), y_cubeLabel, SLOT(setNum(int)));
+      connect(y_slider, SIGNAL(realChange(int)), this, SLOT(set_value()));
+      connect(plane, SIGNAL(manipulated(int)), y_cubeLabel, SLOT(setNum(int)));
+      connect(plane, SIGNAL(aboutToBeDestroyed()), this, SLOT(destroy_y_item()));
+      y_box->addWidget(y_slider);
+      y_box->addWidget(y_cubeLabel);
+      y_control->setVisible(true);
+      break;
+    case 'z':
+      delete z_slider;
+      z_slider = new Plane_slider(plane->translationVector(), id, scene, plane->manipulatedFrame(),
+                                         Qt::Horizontal, z_control);
+      z_slider->setRange(0, (plane->cDim() - 1) * 100);
+      connect(z_slider, SIGNAL(realChange(int)), z_cubeLabel, SLOT(setNum(int)));
+      connect(z_slider, SIGNAL(realChange(int)), this, SLOT(set_value()));
+      connect(plane, SIGNAL(manipulated(int)), z_cubeLabel, SLOT(setNum(int)));
+      connect(plane, SIGNAL(aboutToBeDestroyed()), this, SLOT(destroy_z_item()));
+      z_box->addWidget(z_slider);
+      z_box->addWidget(z_cubeLabel);
+      z_control->setVisible(true);
+      break;
+    default:
+      break;
+    }
+    std::vector<Volume_plane_thread*>::iterator it = std::find(threads.begin(), threads.end(), thread);
+
+    // this slot has been connected to a thread that hasn't been
+    // registered here.
+    assert(it != threads.end());
+    delete *it;
+    threads.erase(it);
+
+    update_msgBox();
+    Volume_plane_intersection* intersection = dynamic_cast<Volume_plane_intersection*>(scene->item(intersection_id));
+    if(!intersection) {
+      // the intersection is gone before it was initialized
+      return;
+    }
+    // FIXME downcasting mode
+    // FIXME this will bug if two volume planes are generated simultaneously by the plugin
+    if(Volume_plane<x_tag>* p = dynamic_cast< Volume_plane<x_tag>* >(plane)) {
+      intersection->setX(p);
+    } else if(Volume_plane<y_tag>* p = dynamic_cast< Volume_plane<y_tag>* >(plane)) {
+      intersection->setY(p);
+    } else if(Volume_plane<z_tag>* p = dynamic_cast< Volume_plane<z_tag>* >(plane)) {
+      intersection->setZ(p);
+    }
+    connect(plane, SIGNAL(planeDestructionIncoming(Volume_plane_interface*)),
+            intersection, SLOT(planeRemoved(Volume_plane_interface*)));
+
+  }
+
+  void on_actionLoadDCM_triggered()
+  {
+    QSettings settings;
+    QString start_dir = settings.value("Open directory",
+                                       QDir::current().dirName()).toString();
+    QString dir =
+      QFileDialog::getExistingDirectory(mw,
+                                        tr("Open directory"),
+                                        start_dir,
+                                        QFileDialog::ShowDirsOnly
+                                        | QFileDialog::DontResolveSymlinks);
+
+    if (!dir.isEmpty()) {
+      QFileInfo fileinfo(dir);
+      if (fileinfo.isDir() && fileinfo.isReadable())
+      {
+        settings.setValue("Open directory",
+          fileinfo.absoluteDir().absolutePath());
+        QApplication::setOverrideCursor(Qt::WaitCursor);
+        loadDCM(dir);
+        QApplication::restoreOverrideCursor();
+      }
+    }
+
+  }
+private:
+#ifdef CGAL_USE_VTK
+  vtkImageData* vtk_image;
+  vtkDICOMImageReader* dicom_reader;
+  vtkDemandDrivenPipeline* executive;
+  vtkImageGaussianSmooth* smoother;
+#endif // CGAL_USE_VTK
+  Messages_interface* message_interface;
+  QMessageBox msgBox;
+  QAction* planeSwitch;
+  QWidget *x_control, *y_control, *z_control;
+  QSlider *x_slider, *y_slider, *z_slider;
+  QLabel *x_cubeLabel, *y_cubeLabel, *z_cubeLabel;
+  QHBoxLayout *x_box, *y_box, *z_box;
+  PixelReader pxr_;
+  Ui::ImagePrecisionDialog ui;
+
+  CGAL::Three::Scene_group_item* group;
+  std::vector<Volume_plane_thread*> threads;
+  struct Controls{
+    CGAL::Three::Scene_item* group;
+    CGAL::Three::Scene_item* x_item;
+    CGAL::Three::Scene_item* y_item;
+    CGAL::Three::Scene_item* z_item;
+    int x_value;
+    int y_value;
+    int z_value;
+  };
+  Controls *current_control;
+  QMap<CGAL::Three::Scene_item*, Controls> group_map;
+  unsigned int intersection_id;
+  bool loadDCM(QString filename);
+  Image* createDCMImage(QString dirname);
+  QLayout* createOrGetDockLayout() {
+    QLayout* layout = NULL;
+    QDockWidget* controlDockWidget = mw->findChild<QDockWidget*>("volumePlanesControl");;
+
+    if(!controlDockWidget) {
+      controlDockWidget = new QDockWidget(mw);
+      controlDockWidget->setObjectName("volumePlanesControl");
+      QWidget* content = new QWidget(controlDockWidget);
+      layout = new QVBoxLayout(content);
+      layout->setObjectName("vpSliderLayout");
+      controlDockWidget->setWindowTitle("Volume Planes Control");
+      mw->addDockWidget(Qt::LeftDockWidgetArea, controlDockWidget);
+
+      QWidget* vlabels = new QWidget(content);
+      layout->addWidget(vlabels);
+      QHBoxLayout* vbox = new QHBoxLayout(vlabels);
+      vbox->setAlignment(Qt::AlignJustify);
+      QLabel* help = new QLabel(vlabels);
+      help->setText("Cut planes for the \nselected image:");
+      QLabel* text = new QLabel(vlabels);
+      text->setText("Isovalue at point:");
+      QLabel* x = new QLabel(vlabels);
+
+      connect(&pxr_, SIGNAL(x(int)), x, SLOT(setNum(int)));
+
+      layout->addWidget(help); vbox->addWidget(text); vbox->addWidget(x);
+      controlDockWidget->setWidget(content);
+      controlDockWidget->hide();
+
+    } else {
+      layout = controlDockWidget->findChild<QLayout*>("vpSliderLayout");
+      controlDockWidget->show();
+    }
+
+    return layout;
+  }
+
+  void createPlanes(Scene_image_item* seg_img) {
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    //Control widgets creation
+    QLayout* layout = createOrGetDockLayout();
+    if(x_control == NULL)
+    {
+      x_control = new QWidget;
+      x_box = new QHBoxLayout(x_control);
+      layout->addWidget(x_control);
+
+      QLabel* label = new QLabel(x_control);
+      label->setText("X Slice");
+
+      x_cubeLabel = new QLabel(x_control);
+
+      // Find the right width for the label to accommodate at least 9999
+      QFontMetrics metric = x_cubeLabel->fontMetrics();
+      x_cubeLabel->setFixedWidth(metric.width(QString("9999")));
+      x_cubeLabel->setNum(0);
+      x_slider = new QSlider(mw);
+
+      x_box->addWidget(label);
+      x_box->addWidget(x_slider);
+      x_box->addWidget(x_cubeLabel);
+    }
+
+    if(y_control == NULL)
+    {
+      y_control = new QWidget;
+      y_box = new QHBoxLayout(y_control);
+      layout->addWidget(y_control);
+
+      QLabel* label = new QLabel(y_control);
+      label->setText("Y Slice");
+
+      y_cubeLabel = new QLabel(y_control);
+
+      // Find the right width for the label to accommodate at least 9999
+      QFontMetrics metric = y_cubeLabel->fontMetrics();
+      y_cubeLabel->setFixedWidth(metric.width(QString("9999")));
+      y_cubeLabel->setNum(0);
+
+      y_slider = new QSlider(mw);
+
+      y_box->addWidget(label);
+      y_box->addWidget(y_slider);
+      y_box->addWidget(y_cubeLabel);
+    }
+
+    if(z_control == NULL)
+    {
+      z_control = new QWidget;
+      z_box = new QHBoxLayout(z_control);
+      layout->addWidget(z_control);
+
+      QLabel* label = new QLabel(z_control);
+      label->setText("Z Slice");
+
+      z_cubeLabel = new QLabel(z_control);
+
+      // Find the right width for the label to accommodate at least 9999
+      QFontMetrics metric = z_cubeLabel->fontMetrics();
+      z_cubeLabel->setFixedWidth(metric.width(QString("9999")));
+      z_cubeLabel->setNum(0);
+      z_slider = new QSlider(mw);
+
+      z_box->addWidget(label);
+      z_box->addWidget(z_slider);
+      z_box->addWidget(z_cubeLabel);
+    }
+    if(!(seg_img == NULL)) {
+      const CGAL::Image_3* img = seg_img->image();
+      CGAL_IMAGE_IO_CASE(img->image(), this->launchAdders<Word>(seg_img, seg_img->name()))
+
+          Volume_plane_intersection* i
+          = new Volume_plane_intersection(img->xdim() * img->vx(),
+                                          img->ydim() * img->vy(),
+                                          img->zdim() * img->vz());
+      this->intersection_id = scene->addItem(i);
+      scene->changeGroup(i, group);
+      group->lockChild(i);
+    } else {
+      QMessageBox::warning(mw, tr("Something went wrong"), tr("Selected a suitable Object but couldn't get an image pointer."));
+      return;
+    }
+  }
+
+
+  template<typename Word>
+  void launchAdders(Scene_image_item* seg_img, const QString& name) {
+    const CGAL::Image_3* img = seg_img->image();
+    const Word* begin = (const Word*)img->data();
+    const Word* end = (const Word*)img->data() + img->size();
+
+    std::pair<const Word, const Word> minmax(*std::min_element(begin, end), *std::max_element(begin, end));
+
+    Clamp_to_one_zero_range clamper = { minmax };
+
+    switchReaderConverter< Word >(minmax);
+
+    Volume_plane<x_tag> *x_item = new Volume_plane<x_tag>();
+    Volume_plane<y_tag> *y_item = new Volume_plane<y_tag>();
+    Volume_plane<z_tag> *z_item = new Volume_plane<z_tag>();
+    scene->setSelectedItem(-1);
+    group = new Scene_group_item(QString("Planes for %1").arg(seg_img->name()));
+    connect(group, SIGNAL(aboutToBeDestroyed()),
+            this, SLOT(erase_group()));
+    scene->addItem(group);
+    Controls c;
+    c.group = group;
+    c.x_item = x_item;
+    c.y_item = y_item;
+    c.z_item = z_item;
+    c.x_value = 0;
+    c.y_value = 0;
+    c.z_value = 0;
+    group_map[seg_img] = c;
+    current_control = &group_map[seg_img];
+    connect(seg_img, SIGNAL(aboutToBeDestroyed()),
+            this, SLOT(erase_group()));
+
+    threads.push_back(new X_plane_thread<Word>(x_item, img, clamper, name));
+
+    connect(threads.back(), SIGNAL(finished(Volume_plane_thread*)), this, SLOT(addVP(Volume_plane_thread*)));
+    threads.back()->start();
+
+    threads.push_back(new Y_plane_thread<Word>(y_item,img, clamper, name));
+    connect(threads.back(), SIGNAL(finished(Volume_plane_thread*)), this, SLOT(addVP(Volume_plane_thread*)));
+    threads.back()->start();
+
+    threads.push_back(new Z_plane_thread<Word>(z_item,img, clamper, name));
+    connect(threads.back(), SIGNAL(finished(Volume_plane_thread*)), this, SLOT(addVP(Volume_plane_thread*)));
+    threads.back()->start();
+
+  }
+  template<typename T>
+  void switchReaderConverter(std::pair<T, T> minmax) {
+    switchReaderConverter(minmax, typename boost::is_integral<T>::type());
+  }
+
+  template<typename T>
+  void switchReaderConverter(std::pair<T, T> minmax, boost::true_type) {
+    // IntConverter
+    IntConverter x = { minmax }; pxr_.setIC(x);
+  }
+
+  template<typename T>
+  void switchReaderConverter(std::pair<T, T> minmax, boost::false_type) {
+    // IntConverter
+    DoubleConverter x = { minmax }; pxr_.setFC(x);
+  }
+
+private Q_SLOTS:
+  //updates the msgBox
+  void update_msgBox()
+  {
+    static int nbPlanes =0;
+    nbPlanes ++;
+    msgBox.setText(QString("Planes created : %1/3").arg(nbPlanes));
+    if(nbPlanes == 3)
+    {
+      msgBox.hide();
+      nbPlanes = 0;
+      QApplication::restoreOverrideCursor();
+    }
+  }
+  // Avoids the segfault after the deletion of an item
+  void erase_group()
+  {
+
+    CGAL::Three::Scene_group_item* group_item = qobject_cast<CGAL::Three::Scene_group_item*>(sender());
+    if(group_item)
+    {
+
+      Q_FOREACH(CGAL::Three::Scene_item* key, group_map.keys())
+      {
+        if(group_map[key].group == group_item)
+        {
+          group_map[key].x_item = NULL;
+          group_map[key].y_item = NULL;
+          group_map[key].z_item = NULL;
+          group_map.remove(key);
+          break;
+        }
+      }
+    }
+
+    //try to re-connect to another group
+    if(!group_map.isEmpty())
+    {
+      int id = scene->item_id(group_map.keys().first());
+      connect_controls(id);
+    }
+  }
+  void connect_controls(int id)
+  {
+    CGAL::Three::Scene_item* sel_itm = scene->item(id);
+    if(!sel_itm || !group_map.contains(sel_itm)) //the planes are not yet created or the selected item is not a segmented_image
+    {
+      return;
+    }
+    Controls c = group_map[sel_itm];
+    current_control = &group_map[sel_itm];
+    // x line
+    if(c.x_item != NULL)
+    {
+      Volume_plane_interface* x_plane = qobject_cast<Volume_plane_interface*>(c.x_item);
+      if(x_slider)
+        delete x_slider;
+      x_slider = new Plane_slider(x_plane->translationVector(), scene->item_id(x_plane), scene, x_plane->manipulatedFrame(),
+                                  Qt::Horizontal, x_control);
+      x_slider->setRange(0, (x_plane->cDim() - 1) * 100);
+      connect(x_slider, SIGNAL(realChange(int)), x_cubeLabel, SLOT(setNum(int)));
+      connect(x_plane, SIGNAL(manipulated(int)), x_cubeLabel, SLOT(setNum(int)));
+      connect(x_plane, SIGNAL(aboutToBeDestroyed()), this, SLOT(destroy_x_item()));
+      connect(x_slider, SIGNAL(realChange(int)), this, SLOT(set_value()));
+      x_slider->setValue(c.x_value);
+
+      x_box->addWidget(x_slider);
+      x_box->addWidget(x_cubeLabel);
+    }
+    //y line
+    if(c.y_item != NULL)
+    {
+      Volume_plane_interface* y_plane = qobject_cast<Volume_plane_interface*>(c.y_item);
+      if(y_slider)
+        delete y_slider;
+      y_slider = new Plane_slider(y_plane->translationVector(), scene->item_id(y_plane), scene, y_plane->manipulatedFrame(),
+                                  Qt::Horizontal, z_control);
+      y_slider->setRange(0, (y_plane->cDim() - 1) * 100);
+      connect(y_slider, SIGNAL(realChange(int)), y_cubeLabel, SLOT(setNum(int)));
+      connect(y_plane, SIGNAL(manipulated(int)), y_cubeLabel, SLOT(setNum(int)));
+      connect(y_plane, SIGNAL(aboutToBeDestroyed()), this, SLOT(destroy_y_item()));
+      connect(y_slider, SIGNAL(realChange(int)), this, SLOT(set_value()));
+      y_slider->setValue(c.y_value);
+      y_box->addWidget(y_slider);
+      y_box->addWidget(y_cubeLabel);
+    }
+    // z line
+    if(c.z_item != NULL)
+    {
+      Volume_plane_interface* z_plane = qobject_cast<Volume_plane_interface*>(c.z_item);
+      if(z_slider)
+        delete z_slider;
+      z_slider = new Plane_slider(z_plane->translationVector(), scene->item_id(z_plane), scene, z_plane->manipulatedFrame(),
+                                  Qt::Horizontal, z_control);
+      z_slider->setRange(0, (z_plane->cDim() - 1) * 100);
+      connect(z_slider, SIGNAL(realChange(int)), z_cubeLabel, SLOT(setNum(int)));
+      connect(z_plane, SIGNAL(manipulated(int)), z_cubeLabel, SLOT(setNum(int)));
+      connect(z_plane, SIGNAL(aboutToBeDestroyed()), this, SLOT(destroy_z_item()));
+      connect(z_slider, SIGNAL(realChange(int)), this, SLOT(set_value()));
+      z_slider->setValue(c.z_value);
+      z_box->addWidget(z_slider);
+      z_box->addWidget(z_cubeLabel);
+    }
+  }
+//Keeps the position of the planes for the next time
+  void set_value()
+  {
+    current_control->x_value = x_slider->value();
+    current_control->y_value = y_slider->value();
+    current_control->z_value = z_slider->value();
+  }
+
+  void destroy_x_item()
+  {
+    current_control->x_item = NULL;
+    if(group_map.isEmpty())
+      x_control->hide();
+  }
+  void destroy_y_item()
+  {
+    current_control->y_item = NULL;
+    if(group_map.isEmpty())
+      y_control->hide();
+  }
+  void destroy_z_item()
+  {
+    current_control->z_item = NULL;
+    if(group_map.isEmpty())
+      z_control->hide();
+  }
+
+};
+
+
+QString Io_image_plugin::nameFilters() const {
+  return QString("Inrimage files (*.inr *.inr.gz) ;; Analyze files (*.hdr *.img *img.gz)");
+}
+
+
+bool Io_image_plugin::canLoad() const {
+  return true;
+}
+
+CGAL::Three::Scene_item*
+Io_image_plugin::load(QFileInfo fileinfo) {
+  QApplication::restoreOverrideCursor();
+  Image* image = new Image;
+  QApplication::restoreOverrideCursor();
+  if(!image->read(fileinfo.filePath().toUtf8()))
+    {
+      QMessageBox qmb(QMessageBox::NoIcon,
+                      "Raw Dialog",
+                      tr("Error with file <tt>%1</tt>:\n"
+                         "unknown file format!\n"
+                         "\n"
+                         "Open it as a raw image?").arg(fileinfo.fileName()),
+                      QMessageBox::Yes|QMessageBox::No);
+
+      bool success = true;
+      if(qmb.exec() == QMessageBox::Yes) {
+        Raw_image_dialog raw_dialog;
+        raw_dialog.label_file_size->setText(QString("%1 B").arg(fileinfo.size()));
+        if( raw_dialog.exec() ){
+          QApplication::setOverrideCursor(Qt::WaitCursor);
+
+          if(image->read_raw(fileinfo.filePath().toUtf8(),
+			     raw_dialog.dim_x->value(),
+			     raw_dialog.dim_y->value(),
+			     raw_dialog.dim_z->value(),
+			     raw_dialog.spacing_x->value(),
+			     raw_dialog.spacing_y->value(),
+			     raw_dialog.spacing_z->value(),
+                             raw_dialog.offset->value())){
+            QSettings settings;
+            settings.beginGroup(QUrl::toPercentEncoding(fileinfo.absoluteFilePath()));
+            settings.setValue("is_raw", true);
+            settings.setValue("dim_x", raw_dialog.dim_x->value());
+            settings.setValue("dim_y", raw_dialog.dim_y->value());
+            settings.setValue("dim_z", raw_dialog.dim_z->value());
+            settings.setValue("spacing_x", raw_dialog.spacing_x->value());
+            settings.setValue("spacing_y", raw_dialog.spacing_y->value());
+            settings.setValue("spacing_z", raw_dialog.spacing_z->value());
+            settings.setValue("offset", raw_dialog.offset->value());
+            settings.endGroup();
+          }else {
+            success = false;
+          }
+        }else {
+          success = false;
+        }
+      }else {
+        success = false;   
+      }
+      if(!success){
+        delete image;
+        return NULL;
+      }
+    }
+  // Get display precision
+  QDialog dialog;
+  ui.setupUi(&dialog);
+  
+  connect(ui.buttonBox, SIGNAL(accepted()), &dialog, SLOT(accept()));
+  connect(ui.buttonBox, SIGNAL(rejected()), &dialog, SLOT(reject()));
+  connect(ui.imageType, SIGNAL(currentIndexChanged(int)),
+          this, SLOT(on_imageType_changed(int)));
+  dialog.setWindowFlags(Qt::Dialog|Qt::CustomizeWindowHint|Qt::WindowCloseButtonHint);
+  
+  // Add precision values to the dialog
+  for ( int i=1 ; i<9 ; ++i )
+  {
+    QString s = tr("1:%1").arg(i*i*i);
+    ui.precisionList->addItem(s);
+  }
+
+  //Adds Image type
+  ui.imageType->addItem(QString("Segmented image"));
+  ui.imageType->addItem(QString("Gray-level image"));
+
+  
+  // Open window
+  QApplication::restoreOverrideCursor();
+  int return_code = dialog.exec();
+  if(return_code != QDialog::Accepted)
+  {
+    delete image;
+    return NULL;
+  }
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  
+  // Get selected precision
+  int voxel_scale = ui.precisionList->currentIndex() + 1;
+
+  //Get the image type
+  QString type = ui.imageType->currentText();
+  Scene_image_item* image_item;
+  if(type == "Gray-level image")
+  {
+    //Create planes
+    image_item = new Scene_image_item(image,0, true);
+    image_item->setName(fileinfo.baseName());
+    msgBox.setText("Planes created : 0/3");
+    msgBox.setStandardButtons(QMessageBox::NoButton);
+    msgBox.show();
+
+    createPlanes(image_item);
+  }
+  else
+    image_item = new Scene_image_item(image,voxel_scale, false);
+  image_item->setName(fileinfo.baseName());
+  return image_item;
+}
+
+bool Io_image_plugin::canSave(const CGAL::Three::Scene_item*)
+{
+  return false;
+}
+
+bool Io_image_plugin::loadDCM(QString dirname)
+{
+  QApplication::restoreOverrideCursor();
+#ifdef CGAL_USE_VTK
+  QFileInfo fileinfo;
+  fileinfo.setFile(dirname);
+  bool result = true;
+  if(!fileinfo.isReadable())
+  {
+    QMessageBox::warning(mw, mw->windowTitle(),
+                         tr("Cannot read directory <tt>%1</tt>!").arg(dirname));
+    message_interface->warning(tr("Opening of directory %1 failed!").arg(dirname));
+    result = false;
+  }
+  else
+  {
+    // Get display precision
+    QDialog dialog;
+    ui.setupUi(&dialog);
+
+    connect(ui.buttonBox, SIGNAL(accepted()), &dialog, SLOT(accept()));
+    connect(ui.buttonBox, SIGNAL(rejected()), &dialog, SLOT(reject()));
+    connect(ui.imageType, SIGNAL(currentIndexChanged(int)),
+            this, SLOT(on_imageType_changed(int)));
+
+
+    // Add precision values to the dialog
+    for ( int i=1 ; i<9 ; ++i )
+    {
+      QString s = tr("1:%1").arg(i*i*i);
+      ui.precisionList->addItem(s);
+    }
+
+    //Adds Image type
+    ui.imageType->addItem(QString("Segmented image"));
+    ui.imageType->addItem(QString("Gray-level image"));
+
+
+    // Open window
+    QApplication::restoreOverrideCursor();
+    int return_code = dialog.exec();
+    if(return_code != QDialog::Accepted)
+    {
+      return false;
+    }
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+
+    // Get selected precision
+    int voxel_scale = ui.precisionList->currentIndex() + 1;
+
+    //Get the image type
+    QString type = ui.imageType->currentText();
+    Scene_image_item* image_item;
+    if(type == "Gray-level image")
+    {
+
+      Image *image = createDCMImage(dirname);
+      if(image->image() == 0)
+      {
+        QMessageBox::warning(mw, mw->windowTitle(),
+                             tr("Error with file <tt>%1/</tt>:\nunknown file format!").arg(dirname));
+        message_interface->warning(tr("Opening of file %1/ failed!").arg(dirname));
+        result = false;
+      }
+      else
+      {
+        message_interface->information(tr("File %1/ successfully opened.").arg(dirname));
+      }
+      if(result)
+      {
+      //Create planes
+      image_item = new Scene_image_item(image,125, true);
+      msgBox.setText("Planes created : 0/3");
+      msgBox.setStandardButtons(QMessageBox::NoButton);
+      msgBox.show();
+      createPlanes(image_item);
+      image_item->setName(fileinfo.baseName());
+      scene->addItem(image_item);
+      }
+    }
+    else
+    {
+      Image *image = createDCMImage(dirname);
+      if(image->image() == 0)
+      {
+        QMessageBox::warning(mw, mw->windowTitle(),
+                             tr("Error with file <tt>%1/</tt>:\nunknown file format!").arg(dirname));
+        message_interface->warning(tr("Opening of file %1/ failed!").arg(dirname));
+        result = false;
+      }
+      else
+      {
+        message_interface->information(tr("File %1/ successfully opened.").arg(dirname));
+      }
+      if(result)
+      {
+        image_item = new Scene_image_item(image,voxel_scale, false);
+        image_item->setName(fileinfo.baseName());
+        scene->addItem(image_item);
+      }
+    }
+  }
+  return result;
+#else
+  message_interface->warning("You need VTK to read a DCM file");
+  CGAL_USE(dirname);
+  return false;
+#endif
+}
+Image* Io_image_plugin::createDCMImage(QString dirname)
+{
+  Image* image = NULL;
+#ifdef CGAL_USE_VTK
+  dicom_reader = vtkDICOMImageReader::New();
+  dicom_reader->SetDirectoryName(dirname.toUtf8());
+
+  executive =
+    vtkDemandDrivenPipeline::SafeDownCast(dicom_reader->GetExecutive());
+  if (executive)
+  {
+    executive->SetReleaseDataFlag(0, 0); // where 0 is the port index
+  }
+
+  smoother = vtkImageGaussianSmooth::New();
+  smoother->SetStandardDeviations(1., 1., 1.);
+  smoother->SetInputConnection(dicom_reader->GetOutputPort());
+  smoother->Update();
+  vtk_image = smoother->GetOutput();
+  vtk_image->Print(std::cerr);
+  image = new Image;
+  *image = CGAL::read_vtk_image_data(vtk_image);
+#else
+  message_interface->warning("You need VTK to read a DCM file");
+  CGAL_USE(dirname);
+#endif
+  return image;
+
+}
+
+#include "Io_image_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Io_implicit_function_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Io_implicit_function_plugin.cpp
new file mode 100644
index 0000000..bc7f00d
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Io_implicit_function_plugin.cpp
@@ -0,0 +1,213 @@
+// Copyright (c) 2010 INRIA Sophia-Antipolis (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
+// 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(s)     : Stephane Tayeb
+//
+//******************************************************************************
+// File Description : 
+//******************************************************************************
+
+//#include <CGAL_demo/Plugin_interface.h>
+//#include <CGAL_demo/Plugin_helper.h>
+#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
+#include <CGAL/Three/Polyhedron_demo_io_plugin_interface.h>
+
+#include "implicit_functions/Implicit_function_interface.h"
+#include "Scene_implicit_function_item.h"
+#include "ui_Function_dialog.h"
+
+#include <iostream>
+
+#include <QAction>
+#include <QMainWindow>
+#include <QPluginLoader>
+#include <QDir>
+#include <QApplication>
+#include <QMenu>
+#include <QList>
+#include <QLibrary>
+using namespace CGAL::Three;
+class Io_implicit_function_plugin :
+  public QObject, 
+  protected Polyhedron_demo_plugin_helper
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+public:
+  Io_implicit_function_plugin();
+  virtual ~Io_implicit_function_plugin() {}
+
+  bool applicable(QAction*) const { return true; }
+
+  QString name() const { return "implicit functions"; }
+  // QString nameFilters() const { return ""; }
+  // bool canLoad() const { return false; }
+  
+
+  typedef Polyhedron_demo_plugin_helper Plugin_helper;
+  
+  using Plugin_helper::init;
+  virtual void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*);
+  
+  QList<QAction*> actions() const
+  {
+    return QList<QAction*>();
+  }
+  
+public Q_SLOTS:
+  void load_function() const;
+  
+private:
+  void load_function_plugins();
+  
+private:
+  QList<Implicit_function_interface*> functions_;
+};
+
+
+
+Io_implicit_function_plugin::
+Io_implicit_function_plugin()
+{
+  load_function_plugins();
+}
+
+
+void
+Io_implicit_function_plugin::
+init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface *)
+{
+
+  this->scene = scene_interface;
+  this->mw = mainWindow;
+  
+  QAction* actionLoadFunction = new QAction("Load &Implicit Function", mw);
+  if( NULL != actionLoadFunction )
+  {
+    connect(actionLoadFunction, SIGNAL(triggered()), this, SLOT(load_function()));
+  }
+  
+  QMenu* menuFile = mw->findChild<QMenu*>("menuFile");
+  if ( NULL != menuFile )
+  {
+    QList<QAction*> menuFileActions = menuFile->actions();
+    
+    // Look for action just after "Load..." action
+    QAction* actionAfterLoad = NULL;
+    for ( QList<QAction*>::iterator it_action = menuFileActions.begin(), 
+         end = menuFileActions.end() ; it_action != end ; ++ it_action ) //Q_FOREACH( QAction* action, menuFileActions)
+    {
+      if ( NULL != *it_action && (*it_action)->text().contains("Load") )
+      {
+        ++it_action;
+        if ( it_action != end && NULL != *it_action )
+        {
+          actionAfterLoad = *it_action;
+        }
+      }
+    }
+    
+    // Insert "Load implicit function" action
+    if ( NULL != actionAfterLoad )
+    {
+      menuFile->insertAction(actionAfterLoad,actionLoadFunction);      
+    }
+    
+  }
+}
+
+
+void
+Io_implicit_function_plugin::
+load_function() const
+{
+  QDialog dialog(mw);
+  Ui::FunctionDialog ui;
+  ui.setupUi(&dialog);
+  
+  connect(ui.buttonBox, SIGNAL(accepted()), &dialog, SLOT(accept()));
+  connect(ui.buttonBox, SIGNAL(rejected()), &dialog, SLOT(reject()));
+  
+  // Add loaded functions to the dialog
+  int i=0;
+  Q_FOREACH( Implicit_function_interface* f, functions_ )
+  {
+    ui.functionList->insertItem(i++,f->name());
+  }
+
+  // Open window
+  int return_code = dialog.exec();
+  if(return_code == QDialog::Rejected) { return; }
+  
+  // Get selected function
+  i = ui.functionList->currentIndex();
+  Implicit_function_interface* function = functions_[i];
+  
+  // Create Scene_implicit_function object and add it to the framework
+  Scene_implicit_function_item* item =
+    new Scene_implicit_function_item(function);
+  
+  item->setName(tr("%1").arg(function->name()));
+  item->setRenderingMode(FlatPlusEdges);
+
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+  scene->itemChanged(index);
+    
+  CGAL::Three::Scene_interface::Item_id new_item_id = scene->addItem(item);
+  scene->setSelectedItem(new_item_id);
+}
+
+void
+Io_implicit_function_plugin::
+load_function_plugins()
+{
+  QDir pluginsDir(qApp->applicationDirPath());
+  QString dirname = pluginsDir.dirName();
+  if ( !pluginsDir.cd("implicit_functions") ) { 
+    // In that case, dirname may be "Debug" or "Release" and one has to
+    // search in ../implicit_functions/Debug or
+    // ../implicit_functions/Release
+    QString newDir = QString("../implicit_functions/") + dirname;
+    if( !pluginsDir.cd(newDir) ) return; 
+  }
+  
+  Q_FOREACH (QString fileName, pluginsDir.entryList(QDir::Files))
+  {
+    if ( fileName.contains("plugin") && QLibrary::isLibrary(fileName) )
+    {
+      qDebug("    + Loading Function \"%s\"...", fileName.toUtf8().data());
+      QPluginLoader loader;
+      loader.setFileName(pluginsDir.absoluteFilePath(fileName));
+      QObject *function_plugin = loader.instance();
+      if ( NULL != function_plugin )
+      {
+        Implicit_function_interface* function =
+          qobject_cast<Implicit_function_interface*>(function_plugin);
+        
+        if ( NULL != function )
+        {
+          functions_ << function;
+        }
+      }
+    }
+  }
+}
+
+#include "Io_implicit_function_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Local_optimizers_dialog.ui b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Local_optimizers_dialog.ui
new file mode 100644
index 0000000..7b910b9
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Local_optimizers_dialog.ui
@@ -0,0 +1,218 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>LocalOptim_dialog</class>
+ <widget class="QDialog" name="LocalOptim_dialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>546</width>
+    <height>317</height>
+   </rect>
+  </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="minimumSize">
+   <size>
+    <width>0</width>
+    <height>0</height>
+   </size>
+  </property>
+  <property name="windowTitle">
+   <string>Local optimizer parameters</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <widget class="QLabel" name="objectName">
+     <property name="font">
+      <font>
+       <pointsize>15</pointsize>
+       <weight>75</weight>
+       <bold>true</bold>
+      </font>
+     </property>
+     <property name="text">
+      <string>NO OBJECT</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="groupBox">
+     <property name="font">
+      <font>
+       <pointsize>13</pointsize>
+      </font>
+     </property>
+     <property name="title">
+      <string>Parameters</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout_2" columnstretch="0,1,0">
+      <item row="0" column="0">
+       <widget class="QLabel" name="timeLabel">
+        <property name="text">
+         <string>Max CPU running time (s)</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+        <property name="buddy">
+         <cstring>maxTime</cstring>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <widget class="QDoubleSpinBox" name="maxTime">
+        <property name="minimumSize">
+         <size>
+          <width>100</width>
+          <height>0</height>
+         </size>
+        </property>
+        <property name="decimals">
+         <number>1</number>
+        </property>
+        <property name="maximum">
+         <double>9999.000000000000000</double>
+        </property>
+        <property name="value">
+         <double>60.000000000000000</double>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="2">
+       <widget class="QCheckBox" name="noTimeLimit">
+        <property name="text">
+         <string>No time limit</string>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="0">
+       <widget class="QLabel" name="sliverLabel">
+        <property name="text">
+         <string>Min. dihedral angle (degree)</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+        <property name="buddy">
+         <cstring>sliverBound</cstring>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="1">
+       <widget class="QDoubleSpinBox" name="sliverBound">
+        <property name="minimumSize">
+         <size>
+          <width>100</width>
+          <height>0</height>
+         </size>
+        </property>
+        <property name="readOnly">
+         <bool>false</bool>
+        </property>
+        <property name="decimals">
+         <number>1</number>
+        </property>
+        <property name="maximum">
+         <double>180.000000000000000</double>
+        </property>
+        <property name="value">
+         <double>8.000000000000000</double>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="2">
+       <widget class="QCheckBox" name="noBound">
+        <property name="text">
+         <string>No angle bound</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout">
+     <item>
+      <widget class="QCheckBox" name="createNewItem">
+       <property name="layoutDirection">
+        <enum>Qt::RightToLeft</enum>
+       </property>
+       <property name="text">
+        <string>Create a new mesh object</string>
+       </property>
+       <property name="checked">
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <spacer name="verticalSpacer_3">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeType">
+      <enum>QSizePolicy::Expanding</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>0</width>
+       <height>0</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item>
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>LocalOptim_dialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>384</x>
+     <y>191</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>195</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>LocalOptim_dialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>384</x>
+     <y>191</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>195</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp
new file mode 100644
index 0000000..94adb53
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp
@@ -0,0 +1,548 @@
+#include "config.h"
+#include "config_mesh_3.h"
+
+#ifdef CGAL_POLYHEDRON_DEMO_USE_SURFACE_MESHER
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+#include "Messages_interface.h"
+
+#include <QObject>
+#include <QAction>
+#include <QMainWindow>
+#include <QApplication>
+#include <QtPlugin>
+#include "Scene_c3t3_item.h"
+#include <QInputDialog>
+#include <QFileDialog>
+#include <QMessageBox>
+#include <fstream>
+
+#include "Scene_polyhedron_item.h"
+#include "Scene_polylines_item.h"
+
+#ifdef CGAL_MESH_3_DEMO_ACTIVATE_IMPLICIT_FUNCTIONS
+#include "Scene_implicit_function_item.h"
+#endif
+#ifdef CGAL_MESH_3_DEMO_ACTIVATE_SEGMENTED_IMAGES
+#include "Scene_image_item.h"
+#endif
+
+#include "Meshing_thread.h"
+
+#include "ui_Meshing_dialog.h"
+
+using namespace CGAL::Three;
+
+// Constants
+const QColor default_mesh_color(45,169,70);
+
+#include "Mesh_3_plugin_cgal_code.h" // declare functions `cgal_code_mesh_3`
+
+class Mesh_3_plugin :
+  public QObject,
+  protected Polyhedron_demo_plugin_interface
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+public:
+  void init(QMainWindow* mainWindow,
+            CGAL::Three::Scene_interface* scene_interface,
+            Messages_interface* msg_interface)
+  {
+    this->scene = scene_interface;
+    this->mw = mainWindow;
+
+    actionMesh_3 = new QAction("Create a Tetrahedral Mesh", mw);
+    if(actionMesh_3) {
+      actionMesh_3->setProperty("subMenuName", "Tetrahedral Mesh Generation");
+      connect(actionMesh_3, SIGNAL(triggered()),
+              this, SLOT(mesh_3_volume()));
+    }
+
+    actionMesh_3_surface = new QAction("Create a Surface Triangle Mesh", mw);
+    if (actionMesh_3_surface){
+      actionMesh_3_surface->setProperty("subMenuName", "Tetrahedral Mesh Generation");
+      connect(actionMesh_3_surface, SIGNAL(triggered()),
+              this, SLOT(mesh_3_surface()));
+    }
+
+    this->msg = msg_interface;
+  }
+
+  QList<QAction*> actions() const {
+    return QList<QAction*>() << actionMesh_3 << actionMesh_3_surface;
+  }
+
+
+  bool applicable(QAction* a) const {
+#ifdef CGAL_MESH_3_DEMO_ACTIVATE_IMPLICIT_FUNCTIONS
+    if(qobject_cast<Scene_implicit_function_item*>(scene->item(scene->mainSelectionIndex())) != NULL
+      && a == actionMesh_3)
+      return true;
+#endif
+#ifdef CGAL_MESH_3_DEMO_ACTIVATE_SEGMENTED_IMAGES
+    Q_FOREACH(int ind, scene->selectionIndices()){
+      if( qobject_cast<Scene_image_item*>(scene->item(ind)))
+        return true;
+    }
+#endif  
+    Q_FOREACH(int ind, scene->selectionIndices()){
+      Scene_polyhedron_item* poly_item
+        = qobject_cast<Scene_polyhedron_item*>(scene->item(ind));
+      if (NULL == poly_item)
+        continue;
+      if (a == actionMesh_3) return poly_item->polyhedron()->is_closed();
+      else                   return true;
+    }
+    return false;
+  }
+
+public Q_SLOTS:
+  void mesh_3_volume();
+  void mesh_3_surface();
+  void meshing_done(Meshing_thread* t);
+  void status_report(QString str);
+
+private:
+  void mesh_3(const bool surface_only);
+  void launch_thread(Meshing_thread* mesh_thread);
+  void treat_result(Scene_item& source_item, Scene_c3t3_item& result_item) const;
+
+private:
+  QAction* actionMesh_3;
+  QAction* actionMesh_3_surface;
+  Messages_interface* msg;
+  QMessageBox* message_box_;
+  Scene_item* source_item_;
+  CGAL::Three::Scene_interface* scene;
+  QMainWindow* mw;
+}; // end class Mesh_3_plugin
+
+double
+get_approximate(double d, int precision, int& decimals)
+{
+    if ( d<0 ) { return 0; }
+
+    double i = std::pow(10.,precision-1);
+
+    decimals = 0;
+    while ( d > i*10 ) { d = d/10.; ++decimals; }
+    while ( d < i ) { d = d*10.; --decimals; }
+
+    return std::floor(d)*std::pow(10.,decimals);
+}
+
+void Mesh_3_plugin::mesh_3_surface()
+{
+  mesh_3(true);
+}
+void Mesh_3_plugin::mesh_3_volume()
+{
+  mesh_3(false);
+}
+
+void Mesh_3_plugin::mesh_3(const bool surface_only)
+{
+  Scene_polyhedron_item* poly_item = NULL;
+  Scene_implicit_function_item* function_item = NULL;
+  Scene_image_item* image_item = NULL;
+  Scene_polylines_item* polylines_item = NULL;
+
+  Q_FOREACH(int ind, scene->selectionIndices()) {
+
+    if(poly_item == NULL){
+      poly_item = qobject_cast<Scene_polyhedron_item*>(scene->item(ind));
+    }
+#ifdef CGAL_MESH_3_DEMO_ACTIVATE_IMPLICIT_FUNCTIONS
+    if(function_item == NULL){
+      function_item = qobject_cast<Scene_implicit_function_item*>(scene->item(ind));
+    }
+#endif
+#ifdef CGAL_MESH_3_DEMO_ACTIVATE_SEGMENTED_IMAGES
+    if(image_item == NULL){
+      image_item = qobject_cast<Scene_image_item*>(scene->item(ind));
+    }
+#endif
+    if(polylines_item == NULL){
+      polylines_item = qobject_cast<Scene_polylines_item*>(scene->item(ind));
+    }
+  }
+  Scene_item* item = NULL;
+  bool features_protection_available = false;
+  if(NULL != poly_item)
+  {
+    if (!poly_item->polyhedron()->is_pure_triangle())
+    {
+      QMessageBox::warning(mw, tr(""),
+                           tr("Selected Scene_polyhedron_item is not triangulated."));
+      return;
+    }
+    item = poly_item;
+    features_protection_available = true;
+  }
+#ifdef CGAL_MESH_3_DEMO_ACTIVATE_IMPLICIT_FUNCTIONS
+  else if (NULL != function_item) { item = function_item; }
+#endif
+#ifdef CGAL_MESH_3_DEMO_ACTIVATE_SEGMENTED_IMAGES
+  else if (NULL != image_item)
+  {
+    item = image_item;
+    features_protection_available = (polylines_item != NULL) || !image_item->isGray();
+
+    bool fit_wrdtp = true;
+    std::size_t img_wdim = image_item->image()->image()->wdim;
+    WORD_KIND img_wordKind = image_item->image()->image()->wordKind;
+    //check if the word type fits the hardcoded values in the plugin
+    if(image_item->isGray())
+    {
+      if(img_wordKind != WK_FLOAT)
+        fit_wrdtp = false;
+      else
+        if(img_wdim != 4)
+          fit_wrdtp = false;
+    }
+    else
+    {
+      if(img_wordKind != WK_FIXED)
+        fit_wrdtp = false;
+      else
+        if(img_wdim != 1)
+          fit_wrdtp = false;
+    }
+    if(!fit_wrdtp)
+    {
+      QMessageBox::warning(mw, tr(""),
+                           tr("Selected object can't be meshed because the image's word type is not supported by this plugin."));
+      return;
+    }
+  }
+#endif
+
+  if (NULL == item)
+  {
+    QMessageBox::warning(mw, tr(""),
+                         tr("Selected object can't be meshed"));
+    return;
+  }
+  // -----------------------------------
+  // Create Mesh dialog
+  // -----------------------------------
+  QDialog dialog(mw);
+  Ui::Meshing_dialog ui;
+  ui.setupUi(&dialog);
+  dialog.setWindowFlags(Qt::Dialog|Qt::CustomizeWindowHint|Qt::WindowCloseButtonHint);
+  connect(ui.buttonBox, SIGNAL(accepted()),
+          &dialog, SLOT(accept()));
+  connect(ui.buttonBox, SIGNAL(rejected()),
+          &dialog, SLOT(reject()));
+
+  // Connect checkboxes to spinboxes
+  connect(ui.noApprox, SIGNAL(toggled(bool)),
+          ui.approx,   SLOT(setEnabled(bool)));
+
+  connect(ui.noFacetSizing, SIGNAL(toggled(bool)),
+          ui.facetSizing,   SLOT(setEnabled(bool)));
+
+  connect(ui.noAngle,    SIGNAL(toggled(bool)),
+          ui.facetAngle, SLOT(setEnabled(bool)));
+
+  connect(ui.noTetSizing, SIGNAL(toggled(bool)),
+          ui.tetSizing,   SLOT(setEnabled(bool)));
+
+  connect(ui.noTetShape, SIGNAL(toggled(bool)),
+          ui.tetShape,   SLOT(setEnabled(bool)));
+
+  connect(ui.protect, SIGNAL(toggled(bool)),
+          ui.noEdgeSizing,   SLOT(setEnabled(bool)));
+
+  connect(ui.protect, SIGNAL(toggled(bool)),
+          ui.noEdgeSizing,   SLOT(setChecked(bool)));
+
+  connect(ui.noEdgeSizing, SIGNAL(toggled(bool)),
+          ui.edgeLabel,   SLOT(setEnabled(bool)));
+
+  connect(ui.noEdgeSizing, SIGNAL(toggled(bool)),
+          ui.edgeSizing,   SLOT(setEnabled(bool)));
+
+  // Set default parameters
+  CGAL::Three::Scene_interface::Bbox bbox = item->bbox();
+  ui.objectName->setText(item->name());
+  ui.objectNameSize->setText(tr("Object bbox size (w,h,d):  <b>%1</b>,  <b>%2</b>,  <b>%3</b>")
+                             .arg(bbox.xmax() - bbox.xmin(),0,'g',3)
+                             .arg(bbox.ymax() - bbox.ymin(),0,'g',3)
+                             .arg(bbox.zmax() - bbox.zmin(),0,'g',3) );
+
+  double diag = CGAL::sqrt((bbox.xmax()-bbox.xmin())*(bbox.xmax()-bbox.xmin()) + (bbox.ymax()-bbox.ymin())*(bbox.ymax()-bbox.ymin()) + (bbox.zmax()-bbox.zmin())*(bbox.zmax()-bbox.zmin()));
+  int decimals = 0;
+  double sizing_default = get_approximate(diag * 0.05, 2, decimals);
+  ui.facetSizing->setDecimals(-decimals+2);
+  ui.facetSizing->setSingleStep(std::pow(10.,decimals));
+  ui.facetSizing->setRange(diag * 10e-6, // min
+                           diag); // max
+  ui.facetSizing->setValue(sizing_default); // default value
+  ui.edgeSizing->setValue(sizing_default);
+
+  ui.tetSizing->setDecimals(-decimals+2);
+  ui.tetSizing->setSingleStep(std::pow(10.,decimals));
+  ui.tetSizing->setRange(diag * 10e-6, // min
+                         diag); // max
+  ui.tetSizing->setValue(sizing_default); // default value
+
+  double approx_default = get_approximate(diag * 0.005, 2, decimals);
+  ui.approx->setDecimals(-decimals+2);
+  ui.approx->setSingleStep(std::pow(10.,decimals));
+  ui.approx->setRange(diag * 10e-7, // min
+                      diag); // max
+  ui.approx->setValue(approx_default);
+
+  ui.protect->setEnabled(features_protection_available);
+  ui.protect->setChecked(features_protection_available);
+
+  ui.initializationGroup->setVisible(image_item != NULL && !image_item->isGray());
+  ui.grayImgGroup->setVisible(image_item != NULL && image_item->isGray());
+  if (poly_item != NULL)
+    ui.volumeGroup->setVisible(!surface_only && poly_item->polyhedron()->is_closed());
+  else
+    ui.volumeGroup->setVisible(!surface_only);
+  ui.noEdgeSizing->setChecked(ui.protect->isChecked());
+  ui.edgeLabel->setEnabled(ui.noEdgeSizing->isChecked());
+  ui.edgeSizing->setEnabled(ui.noEdgeSizing->isChecked());
+
+  // -----------------------------------
+  // Get values
+  // -----------------------------------
+
+  //reset cursor from the code for the scripts
+  QApplication::restoreOverrideCursor();
+  int i = dialog.exec();
+  if( i == QDialog::Rejected ) { return; }
+
+  // 0 means parameter is not considered
+  const double angle = !ui.noAngle->isChecked() ? 0 : ui.facetAngle->value();
+  const double approx = !ui.noApprox->isChecked() ? 0 : ui.approx->value();
+  const double facet_sizing = !ui.noFacetSizing->isChecked() ? 0 : ui.facetSizing->value();
+  const double radius_edge = !ui.noTetShape->isChecked() ? 0 : ui.tetShape->value();
+  const double tet_sizing = !ui.noTetSizing->isChecked() ? 0  : ui.tetSizing->value();
+  const double edge_size = !ui.noEdgeSizing->isChecked() ? DBL_MAX : ui.edgeSizing->value();
+  const bool protect_features = ui.protect->isChecked();
+  const bool detect_connected_components = ui.detectComponents->isChecked();
+  const int manifold = ui.manifoldCheckBox->isChecked() ? 1 : 0;
+  const float iso_value = ui.iso_value_spinBox->value();
+  const float value_outside = ui.value_outside_spinBox->value();
+  const float inside_is_less =  ui.inside_is_less_checkBox->isChecked();
+
+
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+
+  Meshing_thread* thread = NULL;
+
+  // Polyhedron
+  if ( NULL != poly_item )
+  {
+    Polyhedron* pMesh = poly_item->polyhedron();
+    if (NULL == pMesh)
+    {
+      QMessageBox::critical(mw, tr(""), tr("ERROR: no data in selected item"));
+      return;
+    }
+
+    Scene_polylines_item::Polylines_container plc;
+
+    thread =    cgal_code_mesh_3(pMesh,
+                                 (polylines_item == NULL)?plc:polylines_item->polylines,
+                                 item->name(),
+                                 angle,
+                                 facet_sizing,
+                                 approx,
+                                 tet_sizing,
+                                 edge_size,
+                                 radius_edge,
+                                 protect_features,
+                                 manifold,
+                                 surface_only,
+                                 scene);
+  }
+  // Image
+#ifdef CGAL_MESH_3_DEMO_ACTIVATE_IMPLICIT_FUNCTIONS
+  else if (NULL != function_item)
+  {
+    const Implicit_function_interface* pFunction = function_item->function();
+    if (NULL == pFunction)
+    {
+      QMessageBox::critical(mw, tr(""), tr("ERROR: no data in selected item"));
+      return;
+    }
+
+    thread =    cgal_code_mesh_3(pFunction,
+                                 angle,
+                                 facet_sizing,
+                                 approx,
+                                 tet_sizing,
+                                 edge_size,
+                                 radius_edge,
+                                 manifold,
+                                 scene);
+  }
+#endif
+#ifdef CGAL_MESH_3_DEMO_ACTIVATE_SEGMENTED_IMAGES
+  else if (NULL != image_item)
+  {
+    const Image* pImage = image_item->image();
+    if (NULL == pImage)
+    {
+      QMessageBox::critical(mw, tr(""), tr("ERROR: no data in selected item"));
+      return;
+    }
+
+    Scene_polylines_item::Polylines_container plc;
+
+    thread =    cgal_code_mesh_3(pImage,
+                                 (polylines_item == NULL)?plc:polylines_item->polylines,
+                                 angle,
+                                 facet_sizing,
+                                 approx,
+                                 tet_sizing,
+                                 edge_size,
+                                 radius_edge,
+                                 protect_features,
+                                 manifold,
+                                 scene,
+                                 detect_connected_components,
+                                 image_item->isGray(),
+                                 iso_value,
+                                 value_outside,
+                                 inside_is_less);
+  }
+#endif
+
+  if ( NULL == thread )
+  {
+    QMessageBox::critical(mw,tr(""),tr("ERROR: no thread created"));
+    return;
+  }
+
+  // Launch thread
+  source_item_ = item;
+  launch_thread(thread);
+
+  QApplication::restoreOverrideCursor();
+}
+
+void
+Mesh_3_plugin::
+launch_thread(Meshing_thread* mesh_thread)
+{
+  // -----------------------------------
+  // Create message box with stop button
+  // -----------------------------------
+  message_box_ = new QMessageBox(QMessageBox::NoIcon,
+                                 "Meshing",
+                                 "Mesh generation in progress...",
+                                 QMessageBox::Cancel,
+                                 mw);
+
+  message_box_->setDefaultButton(QMessageBox::Cancel);
+  QAbstractButton* cancelButton = message_box_->button(QMessageBox::Cancel);
+  cancelButton->setText(tr("Stop"));
+
+  QObject::connect(cancelButton, SIGNAL(clicked()),
+                   mesh_thread,  SLOT(stop()));
+
+  message_box_->show();
+
+  // -----------------------------------
+  // Connect main thread to meshing thread
+  // -----------------------------------
+  QObject::connect(mesh_thread, SIGNAL(done(Meshing_thread*)),
+                   this,        SLOT(meshing_done(Meshing_thread*)));
+
+  QObject::connect(mesh_thread, SIGNAL(status_report(QString)),
+                   this,        SLOT(status_report(QString)));
+
+  // -----------------------------------
+  // Launch mesher
+  // -----------------------------------
+  mesh_thread->start();
+}
+
+
+void
+Mesh_3_plugin::
+status_report(QString str)
+{
+  if ( NULL == message_box_ ) { return; }
+
+  message_box_->setInformativeText(str);
+}
+
+
+void
+Mesh_3_plugin::
+meshing_done(Meshing_thread* thread)
+{
+  // Print message in console
+  QString str = QString("Meshing of \"%1\" done in %2s<br>")
+    .arg(source_item_->name())
+    .arg(thread->time());
+
+  Q_FOREACH( QString param, thread->parameters_log() )
+  {
+    str.append(QString("( %1 )<br>").arg(param));
+  }
+
+  Scene_c3t3_item* result_item = thread->item();
+  const Scene_item::Bbox& bbox = result_item->bbox();
+  str.append(QString("BBox (x,y,z): [ %1, %2 ], [ %3, %4 ], [ %5, %6 ], <br>")
+    .arg(bbox.xmin())
+    .arg(bbox.xmax())
+    .arg(bbox.ymin())
+    .arg(bbox.ymax())
+    .arg(bbox.zmin())
+    .arg(bbox.zmax()));
+
+  msg->information(qPrintable(str));
+
+  // Treat new c3t3 item
+  treat_result(*source_item_, *result_item);
+
+  // close message box
+  message_box_->close();
+  message_box_ = NULL;
+
+  // free memory
+  // TODO: maybe there is another way to do that
+  delete thread;
+}
+
+
+void
+Mesh_3_plugin::
+treat_result(Scene_item& source_item,
+             Scene_c3t3_item& result_item) const
+{
+  result_item.setName(tr("%1 [3D Mesh]").arg(source_item.name()));
+
+  result_item.c3t3_changed();
+
+  const Scene_item::Bbox& bbox = result_item.bbox();
+  result_item.setPosition((bbox.xmin() + bbox.xmax())/2.f,
+                          (bbox.ymin() + bbox.ymax())/2.f,
+                          (bbox.zmin() + bbox.zmax())/2.f);
+
+  result_item.setColor(default_mesh_color);
+  result_item.setRenderingMode(source_item.renderingMode());
+  result_item.set_data_item(&source_item);
+
+  source_item.setVisible(false);
+
+  const Scene_interface::Item_id index = scene->mainSelectionIndex();
+  scene->itemChanged(index);
+  scene->setSelectedItem(-1);
+  Scene_interface::Item_id new_item_id = scene->addItem(&result_item);
+  scene->setSelectedItem(new_item_id);
+}
+
+#include "Mesh_3_plugin.moc"
+
+#endif // CGAL_POLYHEDRON_DEMO_USE_SURFACE_MESHER
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.cpp
new file mode 100644
index 0000000..6d6d16c
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.cpp
@@ -0,0 +1,253 @@
+#include "config_mesh_3.h"
+#include "Mesh_3_plugin_cgal_code.h"
+
+#include <CGAL/Mesh_3/polylines_to_protect.h>
+#include <CGAL/Bbox_3.h>
+
+#include <Polyhedron_type.h>
+#include <C3t3_type.h>
+
+#include <Scene_c3t3_item.h>
+
+#include <vector>
+
+#include "Mesh_function.h"
+#include "Facet_extra_criterion.h"
+
+#include <CGAL/Timer.h>
+using namespace CGAL::Three;
+
+typedef Tr::Point Point_3;
+
+Meshing_thread* cgal_code_mesh_3(const Polyhedron* pMesh,
+                                 const Polylines_container& polylines,
+                                 QString filename,
+                                 const double facet_angle,
+                                 const double facet_sizing,
+                                 const double facet_approx,
+                                 const double tet_sizing,
+                                 const double edge_size,
+                                 const double tet_shape,
+                                 bool protect_features,
+                                 const int manifold,
+                                 const bool surface_only,
+                                 CGAL::Three::Scene_interface* scene)
+{
+  if(!pMesh) return 0;
+
+  std::cerr << "Meshing file \"" << qPrintable(filename) << "\"\n";
+  std::cerr << "  angle: " << facet_angle << std::endl
+            << "  edge size bound: " << edge_size << std::endl
+            << "  facets size bound: " << facet_sizing << std::endl
+            << "  approximation bound: " << facet_approx << std::endl;
+  if (pMesh->is_closed())
+    std::cerr << "  tetrahedra size bound: " << tet_sizing << std::endl;
+
+  std::cerr << "Build AABB tree...";
+  CGAL::Timer timer;
+  timer.start();
+
+  // Create domain
+  Polyhedral_mesh_domain* p_domain = NULL;
+  if (!surface_only && pMesh->is_closed())
+    p_domain = new Polyhedral_mesh_domain(*pMesh);
+  else
+  {
+    std::vector<const Polyhedron*> poly_ptrs_vector(1, pMesh);
+    p_domain = new Polyhedral_mesh_domain(poly_ptrs_vector.begin(), poly_ptrs_vector.end());
+  }
+  
+  // Features
+  if(polylines.empty() && protect_features) {
+      p_domain->detect_features();//includes detection of borders in the surface case
+  }
+  if(! polylines.empty()){
+    p_domain->add_features(polylines.begin(), polylines.end());
+    protect_features = true; // so that it will be passed in make_mesh_3
+  }
+
+  std::cerr << "done (" << timer.time() << " ms)" << std::endl;
+
+  Scene_c3t3_item* p_new_item = new Scene_c3t3_item;
+  p_new_item->setScene(scene);
+
+  QString tooltip = QString("<div>From \"") + filename +
+    QString("\" with the following mesh parameters"
+            "<ul>"
+            "<li>Angle: %1</li>"
+            "<li>Edge size bound: %2</li>"
+            "<li>Facets size bound: %3</li>"
+            "<li>Approximation bound: %4</li>")
+    .arg(facet_angle)
+    .arg(edge_size)
+    .arg(facet_sizing)
+    .arg(facet_approx);
+  if (pMesh->is_closed())
+    tooltip += QString("<li>Tetrahedra size bound: %1</li>" )
+        .arg(tet_sizing);
+  tooltip += "</ul></div>";
+
+  p_new_item->setProperty("toolTip",tooltip);
+  Mesh_parameters param;
+  param.facet_angle = facet_angle;
+  param.facet_sizing = facet_sizing;
+  param.facet_approx = facet_approx;
+  param.tet_sizing = tet_sizing;
+  param.tet_shape = tet_shape;
+  param.edge_sizing =  edge_size;
+  param.manifold = manifold;
+  param.protect_features = protect_features;
+
+  typedef ::Mesh_function<Polyhedral_mesh_domain,
+                          CGAL::Tag_false> Mesh_function;
+  Mesh_function* p_mesh_function = new Mesh_function(p_new_item->c3t3(),
+                                                     p_domain, param);
+  return new Meshing_thread(p_mesh_function, p_new_item);
+}
+
+#ifdef CGAL_MESH_3_DEMO_ACTIVATE_IMPLICIT_FUNCTIONS
+
+Meshing_thread* cgal_code_mesh_3(const Implicit_function_interface* pfunction,
+                                 const double facet_angle,
+                                 const double facet_sizing,
+                                 const double facet_approx,
+                                 const double tet_sizing,
+                                 const double edge_size,
+                                 const double tet_shape,
+                                 const int manifold,
+                                 CGAL::Three::Scene_interface* scene)
+{
+  if (pfunction == NULL) { return NULL; }
+
+  CGAL::Bbox_3 domain_bbox(pfunction->bbox().xmin(),
+                           pfunction->bbox().ymin(),
+                           pfunction->bbox().zmin(),
+                           pfunction->bbox().xmax(),
+                           pfunction->bbox().ymax(),
+                           pfunction->bbox().zmax());
+
+  Function_mesh_domain* p_domain =
+    new Function_mesh_domain(Function_wrapper(*pfunction), domain_bbox, 1e-7);
+
+  Scene_c3t3_item* p_new_item = new Scene_c3t3_item;
+  p_new_item->setScene(scene);
+
+  Mesh_parameters param;
+  param.protect_features = false;
+  param.facet_angle = facet_angle;
+  param.facet_sizing = facet_sizing;
+  param.facet_approx = facet_approx;
+  param.tet_sizing = tet_sizing;
+  param.tet_shape = tet_shape;
+  param.edge_sizing = edge_size;
+  param.manifold = manifold;
+
+  typedef ::Mesh_function<Function_mesh_domain,
+                          CGAL::Tag_false> Mesh_function;
+  Mesh_function* p_mesh_function = new Mesh_function(p_new_item->c3t3(),
+                                                     p_domain, param);
+  return new Meshing_thread(p_mesh_function, p_new_item);
+}
+#endif // CGAL_MESH_3_DEMO_ACTIVATE_IMPLICIT_FUNCTIONS
+
+
+#ifdef CGAL_MESH_3_DEMO_ACTIVATE_SEGMENTED_IMAGES
+#include <CGAL/Gray_image_mesh_domain_3.h>
+
+typedef CGAL::Gray_image_mesh_domain_3<CGAL::Image_3, Kernel, float, CGAL::Compare_to_isovalue > Gray_image_domain1;
+typedef CGAL::Polyhedron_demo_labeled_mesh_domain_3<Gray_image_domain1> Gray_image_domain;
+typedef CGAL::Mesh_domain_with_polyline_features_3<Gray_image_domain> Gray_Image_mesh_domain;
+
+Meshing_thread* cgal_code_mesh_3(const Image* pImage,
+                                 const Polylines_container& polylines,
+                                 const double facet_angle,
+                                 const double facet_sizing,
+                                 const double facet_approx,
+                                 const double tet_sizing,
+                                 const double edge_size,
+                                 const double tet_shape,
+                                 bool protect_features,
+                                 const int manifold,
+                                 CGAL::Three::Scene_interface* scene,
+                                 bool detect_connected_components,
+                                 bool is_gray,
+                                 float iso_value,
+                                 float value_outside,
+                                 bool inside_is_less)
+{
+  if (NULL == pImage) { return NULL; }
+  if(! polylines.empty())
+    protect_features = true; // so that it will be passed in make_mesh_3
+
+  Mesh_parameters param;
+  param.protect_features = protect_features;
+  param.detect_connected_components = detect_connected_components;
+  param.facet_angle = facet_angle;
+  param.facet_sizing = facet_sizing;
+  param.facet_approx = facet_approx;
+  param.tet_sizing = tet_sizing;
+  param.edge_sizing = edge_size;
+  param.tet_shape = tet_shape;
+  param.manifold = manifold;
+  param.image_3_ptr = pImage;
+  CGAL::Timer timer;
+  Scene_c3t3_item* p_new_item = new Scene_c3t3_item;
+  p_new_item->setScene(scene);
+  if(!is_gray)
+  {
+    Image_mesh_domain* p_domain = new Image_mesh_domain(*pImage, 1e-6);
+
+    if(protect_features && polylines.empty()){
+      std::vector<std::vector<Point_3> > polylines_on_bbox;
+      CGAL::polylines_to_protect<
+        Point_3,
+        Image_mesh_domain::Image_word_type>(*pImage, polylines_on_bbox);
+      p_domain->add_features(polylines_on_bbox.begin(), polylines_on_bbox.end());
+    }
+    if(! polylines.empty()){
+      // Insert edge in domain
+      p_domain->add_features(polylines.begin(), polylines.end());
+    }
+    timer.start();
+    typedef ::Mesh_function<Image_mesh_domain,
+                            CGAL::Tag_true> Mesh_function;
+    Mesh_function* p_mesh_function = new Mesh_function(p_new_item->c3t3(),
+                                                       p_domain, param);
+    return new Meshing_thread(p_mesh_function, p_new_item);
+  }
+  else
+  {
+    if(CGAL::Compare_to_isovalue(iso_value, inside_is_less)(value_outside) !=0)
+    {
+      std::cerr << "Warning : \"Value inside is less than iso value\"'s value has been inverted to avoid crash.  "
+                << " " << std::endl;
+      inside_is_less = !inside_is_less;
+    }
+    Gray_Image_mesh_domain* p_domain = new Gray_Image_mesh_domain(*pImage, CGAL::Compare_to_isovalue(iso_value, inside_is_less), value_outside);
+    if(protect_features && polylines.empty())
+    {
+      std::cerr << "Warning : Automatic detection of features"
+                << " in Gray images is not implemented yet" << std::endl;
+      //std::vector<std::vector<Point_3> > polylines_on_bbox;
+      //CGAL::polylines_to_protect<Point_3>(*pImage, polylines_on_bbox);
+      //p_domain->add_features(polylines_on_bbox.begin(), polylines_on_bbox.end());
+    }
+    if(! polylines.empty()){
+      // Insert edge in domain
+      p_domain->add_features(polylines.begin(), polylines.end());
+    }
+    timer.start();
+    typedef ::Mesh_function<Gray_Image_mesh_domain,
+                            CGAL::Tag_false> Mesh_function;
+    Mesh_function* p_mesh_function = new Mesh_function(p_new_item->c3t3(),
+                                                       p_domain, param);
+    return new Meshing_thread(p_mesh_function, p_new_item);
+  }
+}
+
+#endif //CGAL_MESH_3_DEMO_ACTIVATE_SEGMENTED_IMAGES
+
+
+//#include "Polyhedron_demo_mesh_3_plugin_cgal_code.moc"
+//#include "Scene_c3t3_item.moc" //Check this one, it's strange moc include.
+
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.h b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.h
new file mode 100644
index 0000000..59faf1b
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.h
@@ -0,0 +1,64 @@
+#include "Polyhedron_type_fwd.h"
+#ifdef CGAL_MESH_3_DEMO_ACTIVATE_SEGMENTED_IMAGES
+#  include "Image_type_fwd.h"
+#endif
+#ifdef CGAL_MESH_3_DEMO_ACTIVATE_IMPLICIT_FUNCTIONS
+#  include "implicit_functions/Implicit_function_interface.h"
+#endif
+
+#include "Kernel_type.h"
+#include "Meshing_thread.h"
+
+struct Mesh_parameters;
+
+namespace CGAL { namespace Three {
+  class Scene_item;
+  class Scene_interface;
+}}
+
+typedef std::list<std::vector<CGAL::Exact_predicates_inexact_constructions_kernel::Point_3> > Polylines_container;
+
+Meshing_thread* cgal_code_mesh_3(const Polyhedron* pMesh,
+                                 const Polylines_container&,
+                                 QString filename,
+                                 const double angle,
+                                 const double facet_sizing,
+                                 const double approx,
+                                 const double tet_sizing,
+                                 const double edge_size,
+                                 const double tet_shape,
+                                 bool protect_features,
+                                 const int manifold,
+                                 const bool surface_only,
+                                 CGAL::Three::Scene_interface* scene);
+
+#ifdef CGAL_MESH_3_DEMO_ACTIVATE_IMPLICIT_FUNCTIONS
+Meshing_thread* cgal_code_mesh_3(const Implicit_function_interface* pfunction,
+                                 const double facet_angle,
+                                 const double facet_sizing,
+                                 const double facet_approx,
+                                 const double tet_sizing,
+                                 const double edge_size,
+                                 const double tet_shape,
+                                 const int manifold,
+                                 CGAL::Three::Scene_interface* scene);
+#endif
+
+#ifdef CGAL_MESH_3_DEMO_ACTIVATE_SEGMENTED_IMAGES
+Meshing_thread* cgal_code_mesh_3(const CGAL::Image_3* pImage,
+                                 const Polylines_container& polylines,
+                                 const double facet_angle,
+                                 const double facet_sizing,
+                                 const double facet_approx,
+                                 const double tet_sizing,
+                                 const double edge_size,
+                                 const double tet_shape,
+                                 bool protect_features,
+                                 const int manifold,
+                                 CGAL::Three::Scene_interface* scene,
+                                 bool detect_connected_components,
+                                 bool is_gray = false,
+                                 float iso_value = 3.f,
+                                 float value_outside = 0.f,
+                                 bool inside_is_less = true);
+#endif
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Mesh_function.h b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Mesh_function.h
new file mode 100644
index 0000000..25537a9
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Mesh_function.h
@@ -0,0 +1,316 @@
+// Copyright (c) 2010 INRIA Sophia-Antipolis (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
+// 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(s)     : Stephane Tayeb
+//
+//******************************************************************************
+// File Description : 
+//******************************************************************************
+
+#ifndef CGAL_DEMO_MESH_3_MESH_FUNCTION_H
+#define CGAL_DEMO_MESH_3_MESH_FUNCTION_H
+
+#define CGAL_MESH_3_MESHER_STATUS_ACTIVATED 1
+
+#include <CGAL/Mesh_3/Concurrent_mesher_config.h>
+
+#include <QStringList>
+#include <QString>
+
+#include <CGAL/Mesh_3/Mesher_3.h>
+#include <CGAL/Mesh_criteria_3.h>
+#include <CGAL/Mesh_3/Protect_edges_sizing_field.h>
+#include <CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h>
+
+#include "C3t3_type.h"
+#include "Meshing_thread.h"
+#include <CGAL/make_mesh_3.h> // for C3t3_initializer
+#include <CGAL/use.h>
+
+namespace CGAL {
+  class Image_3;
+}
+
+struct Mesh_parameters
+{
+  double facet_angle;
+  double facet_sizing;
+  double facet_approx;
+  
+  double tet_shape;
+  double tet_sizing;
+  double edge_sizing;
+  bool protect_features;
+  bool detect_connected_components;
+  int manifold;
+  const CGAL::Image_3* image_3_ptr;
+  
+  inline QStringList log() const;
+};
+
+
+template < typename Domain_, typename Image_tag >
+class Mesh_function
+  : public Mesh_function_interface
+{
+  typedef Domain_ Domain;
+  
+public:
+  Mesh_function(C3t3& c3t3, Domain* domain, const Mesh_parameters& p);
+  
+  ~Mesh_function();
+  
+  // Launch
+  virtual void launch();
+  
+  // Stop
+  virtual void stop();
+  
+  // Logs
+  virtual QStringList parameters_log() const;
+  virtual QString status(double time_period) const;
+
+private:
+  typedef typename Domain::Point_3                  Point_3;
+  typedef typename Domain::Index                    Index;
+  typedef std::vector<std::pair<Point_3, Index> >   Initial_points_vector;
+  typedef typename Initial_points_vector::iterator  Ipv_iterator;
+  typedef C3t3::Vertex_handle                       Vertex_handle;
+  
+  typedef C3t3::Triangulation                       Tr;
+  typedef CGAL::Mesh_criteria_3<Tr>                 Mesh_criteria;
+  typedef Mesh_criteria::Edge_criteria              Edge_criteria;
+  typedef Mesh_criteria::Facet_criteria             Facet_criteria;
+  typedef Mesh_criteria::Cell_criteria              Cell_criteria;
+  
+  typedef CGAL::Mesh_3::Mesher_3<C3t3, Mesh_criteria, Domain>   Mesher;
+  
+  void initialize(const Mesh_criteria& criteria, CGAL::Tag_true);
+  void initialize(const Mesh_criteria& criteria, CGAL::Tag_false);
+
+private:
+  C3t3& c3t3_;
+  Domain* domain_;
+  Mesh_parameters p_;
+  bool continue_;
+  Mesher* mesher_;
+#ifdef CGAL_MESH_3_MESHER_STATUS_ACTIVATED
+  mutable typename Mesher::Mesher_status last_report_;
+#endif
+};
+
+
+
+// -----------------------------------
+// Class Mesh_parameters
+// -----------------------------------
+inline
+QStringList
+Mesh_parameters::
+log() const
+{
+  return QStringList()
+  << QString("edge max size: %1").arg(edge_sizing)
+  << QString("facet min angle: %1").arg(facet_angle)
+  << QString("facet max size: %1").arg(facet_sizing)
+  << QString("facet approx error: %1").arg(facet_approx)
+  << QString("tet shape (radius-edge): %1").arg(tet_shape)
+  << QString("tet max size: %1").arg(tet_sizing)
+  << QString("detect connected components: %1")
+    .arg(detect_connected_components)
+  << QString("protect features: %1").arg(protect_features);
+}
+
+
+// -----------------------------------
+// Class Mesh_function
+// -----------------------------------
+template < typename D_, typename Tag >
+Mesh_function<D_,Tag>::
+Mesh_function(C3t3& c3t3, Domain* domain, const Mesh_parameters& p)
+: c3t3_(c3t3)
+, domain_(domain)
+, p_(p)
+, continue_(true)
+, mesher_(NULL)
+#ifdef CGAL_MESH_3_MESHER_STATUS_ACTIVATED
+, last_report_(0,0,0)
+#endif
+{
+#ifdef CGAL_CONCURRENT_MESH_3
+  Concurrent_mesher_config::load_config_file(CONFIG_FILENAME, false);
+#endif
+}
+
+
+template < typename D_, typename Tag >
+Mesh_function<D_,Tag>::
+~Mesh_function()
+{
+  delete domain_;
+  delete mesher_;
+}
+
+
+CGAL::Mesh_facet_topology topology(int manifold) {
+  return manifold == 0 ? CGAL::FACET_VERTICES_ON_SURFACE :
+    static_cast<CGAL::Mesh_facet_topology>
+    (CGAL::MANIFOLD |
+     CGAL::FACET_VERTICES_ON_SAME_SURFACE_PATCH);
+}
+
+template < typename D_, typename Tag >
+void
+Mesh_function<D_,Tag>::
+initialize(const Mesh_criteria& criteria, CGAL::Tag_true) // for an image
+{
+  if(p_.detect_connected_components) {
+    initialize_triangulation_from_labeled_image(c3t3_
+                                                , *domain_
+                                                , *p_.image_3_ptr
+                                                , criteria
+                                                , typename D_::Image_word_type()
+                                                , p_.protect_features);
+  } else {
+    initialize(criteria, CGAL::Tag_false());
+  }
+}
+
+template < typename D_, typename Tag >
+void
+Mesh_function<D_,Tag>::
+initialize(const Mesh_criteria& criteria, CGAL::Tag_false) // for the other domain types
+{
+  // Initialization of the mesh, either with the protection of sharp
+  // features, or with the initial points (or both).
+  // If `detect_connected_components==true`, the initialization is
+  // already done.
+  CGAL::internal::Mesh_3::C3t3_initializer<
+    C3t3,
+    Domain,
+    Mesh_criteria,
+    CGAL::internal::Mesh_3::has_Has_features<Domain>::value >()
+    (c3t3_,
+     *domain_,
+     criteria,
+     p_.protect_features);
+}
+
+
+template < typename D_, typename Tag >
+void
+Mesh_function<D_,Tag>::
+launch()
+{
+#ifdef CGAL_MESH_3_INITIAL_POINTS_NO_RANDOM_SHOOTING
+  CGAL::default_random = CGAL::Random(0);
+#endif
+
+  // Create mesh criteria
+  Mesh_criteria criteria(Edge_criteria(p_.edge_sizing),
+                         Facet_criteria(p_.facet_angle,
+                                        p_.facet_sizing,
+                                        p_.facet_approx,
+                                        topology(p_.manifold)),
+                         Cell_criteria(p_.tet_shape,
+                                       p_.tet_sizing));
+
+  initialize(criteria, CGAL::Boolean_tag<Tag::value>());
+
+  // Build mesher and launch refinement process
+  mesher_ = new Mesher(c3t3_, *domain_, criteria);
+
+#ifdef CGAL_MESH_3_PROFILING
+  CGAL::Real_timer t;
+  t.start();
+#endif
+
+#if CGAL_MESH_3_MESHER_STATUS_ACTIVATED
+  mesher_->initialize();
+  while ( ! mesher_->is_algorithm_done() && continue_ )
+  {
+    mesher_->one_step();
+  }
+#else // not CGAL_MESH_3_MESHER_STATUS_ACTIVATED
+  mesher_->refine_mesh();
+#endif
+
+#ifdef CGAL_MESH_3_PROFILING
+  std::cerr << "Full refinement time (without fix_c3t3): " << t.time() << " seconds." << std::endl;
+#endif
+
+  // Ensure c3t3 is ok (usefull if process has been stop by the user)
+  mesher_->fix_c3t3();
+}
+
+
+template < typename D_, typename Tag >
+void
+Mesh_function<D_,Tag>::
+stop()
+{
+  continue_ = false;
+}
+
+
+template < typename D_, typename Tag >
+QStringList
+Mesh_function<D_,Tag>::
+parameters_log() const
+{
+  return p_.log();
+}
+
+
+template < typename D_, typename Tag >
+QString
+Mesh_function<D_,Tag>::
+status(double time_period) const
+{
+  QString result;
+
+  CGAL_USE(time_period); // to avoid a warning when the macro
+                         // CGAL_MESH_3_MESHER_STATUS_ACTIVATED is not
+                         // defined
+#ifdef CGAL_MESH_3_MESHER_STATUS_ACTIVATED
+  // If mesher_ is not yet created, it means that either launch() has not
+  // been called or that initial points have not been founded
+  if ( NULL == mesher_ )
+  {
+    return QString("Initialization in progress...");
+  }
+  
+  // Get status and return a string corresponding to it
+  typename Mesher::Mesher_status s = mesher_->status();
+  
+  result = QString("Vertices: %1 \n"
+                           "Vertices inserted last %2s: %3 \n\n"
+                           "Bad facets: %4 \n"
+                           "Bad cells: %5")
+    .arg(s.vertices)
+    .arg(time_period)
+    .arg(s.vertices - last_report_.vertices)
+    .arg(s.facet_queue)
+    .arg(s.cells_queue);
+  
+  last_report_ = s;
+#endif
+  return result;
+}
+
+#endif // CGAL_DEMO_MESH_3_MESH_FUNCTION_H
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Meshing_dialog.ui b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Meshing_dialog.ui
new file mode 100644
index 0000000..e36e0a1
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Meshing_dialog.ui
@@ -0,0 +1,600 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Meshing_dialog</class>
+ <widget class="QDialog" name="Meshing_dialog">
+  <property name="enabled">
+   <bool>true</bool>
+  </property>
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>422</width>
+    <height>643</height>
+   </rect>
+  </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="windowTitle">
+   <string>Meshing criteria</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <property name="sizeConstraint">
+    <enum>QLayout::SetFixedSize</enum>
+   </property>
+   <item>
+    <widget class="QLabel" name="objectName">
+     <property name="font">
+      <font>
+       <pointsize>15</pointsize>
+       <weight>75</weight>
+       <bold>true</bold>
+      </font>
+     </property>
+     <property name="text">
+      <string>NO OBJECT</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QLabel" name="objectNameSize">
+     <property name="text">
+      <string>No size</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="initializationGroup">
+     <property name="title">
+      <string>Mesh initialization</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout_5" columnstretch="0,1,0,0">
+      <item row="0" column="0">
+       <widget class="QLabel" name="detectComponentsLabel">
+        <property name="layoutDirection">
+         <enum>Qt::LeftToRight</enum>
+        </property>
+        <property name="text">
+         <string>&Detect all connected components</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+        <property name="buddy">
+         <cstring>detectComponents</cstring>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="2">
+       <widget class="QCheckBox" name="detectComponents">
+        <property name="text">
+         <string/>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <spacer name="horizontalSpacer">
+        <property name="orientation">
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>40</width>
+          <height>20</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="sharpFeaturesGroup">
+     <property name="layoutDirection">
+      <enum>Qt::LeftToRight</enum>
+     </property>
+     <property name="title">
+      <string>Sharp features</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout" columnstretch="0,1,0">
+      <item row="1" column="2">
+       <widget class="QCheckBox" name="noEdgeSizing">
+        <property name="text">
+         <string/>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="1">
+       <widget class="QDoubleSpinBox" name="edgeSizing">
+        <property name="decimals">
+         <number>4</number>
+        </property>
+        <property name="minimum">
+         <double>0.000000000000000</double>
+        </property>
+        <property name="value">
+         <double>0.000000000000000</double>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="0">
+       <widget class="QLabel" name="edgeLabel">
+        <property name="text">
+         <string>Edge size</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="2">
+       <widget class="QCheckBox" name="protect">
+        <property name="text">
+         <string/>
+        </property>
+        <property name="checked">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="0">
+       <widget class="QLabel" name="protectLabel">
+        <property name="text">
+         <string>&Protect sharp edges</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+        <property name="buddy">
+         <cstring>protect</cstring>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="groupBox">
+     <property name="title">
+      <string>Surface</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout_2" rowstretch="0,0,0,0,0,0,0,0,0" columnstretch="0,1,0">
+      <item row="4" column="0">
+       <widget class="QCheckBox" name="checkBox">
+        <property name="text">
+         <string>See advanced &controls...</string>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="1">
+       <widget class="QDoubleSpinBox" name="facetSizing">
+        <property name="minimumSize">
+         <size>
+          <width>110</width>
+          <height>0</height>
+         </size>
+        </property>
+        <property name="decimals">
+         <number>4</number>
+        </property>
+       </widget>
+      </item>
+      <item row="3" column="0">
+       <widget class="QLabel" name="angleLabel">
+        <property name="text">
+         <string>Facet min. &angle (deg)</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+        <property name="buddy">
+         <cstring>facetAngle</cstring>
+        </property>
+       </widget>
+      </item>
+      <item row="3" column="2">
+       <widget class="QCheckBox" name="noAngle">
+        <property name="toolTip">
+         <string>Enable/Disable parameter</string>
+        </property>
+        <property name="text">
+         <string/>
+        </property>
+        <property name="checked">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="0">
+       <widget class="QLabel" name="approxLabel">
+        <property name="text">
+         <string>Approximation &error</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+        <property name="buddy">
+         <cstring>approx</cstring>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="0">
+       <widget class="QLabel" name="sizingLabel">
+        <property name="text">
+         <string>&Facet max. size</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+        <property name="buddy">
+         <cstring>facetSizing</cstring>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="1">
+       <widget class="QDoubleSpinBox" name="approx">
+        <property name="minimumSize">
+         <size>
+          <width>110</width>
+          <height>0</height>
+         </size>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="2">
+       <widget class="QCheckBox" name="noFacetSizing">
+        <property name="toolTip">
+         <string>Enable/Disable parameter</string>
+        </property>
+        <property name="text">
+         <string/>
+        </property>
+        <property name="checked">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item row="3" column="1">
+       <widget class="QDoubleSpinBox" name="facetAngle">
+        <property name="minimumSize">
+         <size>
+          <width>110</width>
+          <height>0</height>
+         </size>
+        </property>
+        <property name="minimum">
+         <double>1.000000000000000</double>
+        </property>
+        <property name="maximum">
+         <double>30.000000000000000</double>
+        </property>
+        <property name="value">
+         <double>25.000000000000000</double>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="2">
+       <widget class="QCheckBox" name="noApprox">
+        <property name="toolTip">
+         <string>Enable/Disable parameter</string>
+        </property>
+        <property name="text">
+         <string/>
+        </property>
+        <property name="checked">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item row="8" column="0" colspan="3">
+       <widget class="QFrame" name="advanced">
+        <property name="visible">
+         <bool>false</bool>
+        </property>
+        <property name="frameShape">
+         <enum>QFrame::StyledPanel</enum>
+        </property>
+        <property name="frameShadow">
+         <enum>QFrame::Plain</enum>
+        </property>
+        <layout class="QVBoxLayout" name="advancedLayout">
+         <item>
+          <widget class="QLabel" name="manifoldLabel">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="text">
+            <string>The following option forces the meshing engine to produce a 3D mesh with a manifold boundary. That may lead to an infinite loop if the input domain has a non-manifold 2D component.</string>
+           </property>
+           <property name="wordWrap">
+            <bool>true</bool>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QCheckBox" name="manifoldCheckBox">
+           <property name="layoutDirection">
+            <enum>Qt::RightToLeft</enum>
+           </property>
+           <property name="text">
+            <string>&manifold</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="volumeGroup">
+     <property name="title">
+      <string>Volume</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout_3" columnstretch="0,1,0">
+      <item row="0" column="2">
+       <widget class="QCheckBox" name="noTetSizing">
+        <property name="toolTip">
+         <string>Enable/Disable parameter</string>
+        </property>
+        <property name="text">
+         <string/>
+        </property>
+        <property name="checked">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="2">
+       <widget class="QCheckBox" name="noTetShape">
+        <property name="toolTip">
+         <string>Enable/Disable parameter</string>
+        </property>
+        <property name="text">
+         <string/>
+        </property>
+        <property name="checked">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="1">
+       <widget class="QDoubleSpinBox" name="tetShape">
+        <property name="minimumSize">
+         <size>
+          <width>110</width>
+          <height>0</height>
+         </size>
+        </property>
+        <property name="minimum">
+         <double>1.000000000000000</double>
+        </property>
+        <property name="value">
+         <double>3.000000000000000</double>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <widget class="QDoubleSpinBox" name="tetSizing">
+        <property name="minimumSize">
+         <size>
+          <width>110</width>
+          <height>0</height>
+         </size>
+        </property>
+        <property name="decimals">
+         <number>4</number>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="0">
+       <widget class="QLabel" name="label_2">
+        <property name="text">
+         <string>Tetrahedron shape (radius-edge ratio)</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+        <property name="buddy">
+         <cstring>tetShape</cstring>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="0">
+       <widget class="QLabel" name="label">
+        <property name="text">
+         <string>&Tetrahedron max. size</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+        <property name="buddy">
+         <cstring>tetSizing</cstring>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="grayImgGroup">
+     <property name="title">
+      <string>Gray Images</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout_4" columnstretch="0,1">
+      <item row="2" column="1">
+       <widget class="QCheckBox" name="inside_is_less_checkBox">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="toolTip">
+         <string>if unchecked, value inside the domain is greater than isovalue</string>
+        </property>
+        <property name="layoutDirection">
+         <enum>Qt::LeftToRight</enum>
+        </property>
+        <property name="text">
+         <string/>
+        </property>
+        <property name="checked">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="1">
+       <widget class="QDoubleSpinBox" name="iso_value_spinBox">
+        <property name="value">
+         <double>3.000000000000000</double>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <widget class="QDoubleSpinBox" name="value_outside_spinBox"/>
+      </item>
+      <item row="0" column="0">
+       <widget class="QLabel" name="label_4">
+        <property name="toolTip">
+         <string>image value outside the image bounding box</string>
+        </property>
+        <property name="layoutDirection">
+         <enum>Qt::LeftToRight</enum>
+        </property>
+        <property name="text">
+         <string>Value outside</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="0">
+       <widget class="QLabel" name="label_3">
+        <property name="layoutDirection">
+         <enum>Qt::LeftToRight</enum>
+        </property>
+        <property name="text">
+         <string>Iso value</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="0">
+       <widget class="QLabel" name="label_5">
+        <property name="text">
+         <string>Value inside is less than iso value</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeType">
+      <enum>QSizePolicy::MinimumExpanding</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>0</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item>
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <tabstops>
+  <tabstop>approx</tabstop>
+  <tabstop>noApprox</tabstop>
+  <tabstop>facetSizing</tabstop>
+  <tabstop>noFacetSizing</tabstop>
+  <tabstop>facetAngle</tabstop>
+  <tabstop>noAngle</tabstop>
+  <tabstop>tetSizing</tabstop>
+  <tabstop>noTetSizing</tabstop>
+  <tabstop>tetShape</tabstop>
+  <tabstop>noTetShape</tabstop>
+  <tabstop>checkBox</tabstop>
+  <tabstop>manifoldCheckBox</tabstop>
+ </tabstops>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>Meshing_dialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>403</x>
+     <y>655</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>195</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>Meshing_dialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>403</x>
+     <y>655</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>195</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>checkBox</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>advanced</receiver>
+   <slot>setVisible(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>83</x>
+     <y>339</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>78</x>
+     <y>199</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Meshing_thread.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Meshing_thread.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Meshing_thread.cpp
rename to 3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Meshing_thread.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Meshing_thread.h b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Meshing_thread.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Meshing_thread.h
rename to 3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Meshing_thread.h
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Optimization_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Optimization_plugin.cpp
new file mode 100644
index 0000000..1aa3510
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Optimization_plugin.cpp
@@ -0,0 +1,643 @@
+#include <boost/config.hpp>
+#if defined(BOOST_MSVC)
+#  pragma warning( disable : 4503)
+#endif
+
+#include "config.h"
+#include "config_mesh_3.h"
+
+#ifdef CGAL_POLYHEDRON_DEMO_USE_SURFACE_MESHER
+
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+
+#include "Messages_interface.h"
+#include "ui_Smoother_dialog.h"
+#include "ui_Local_optimizers_dialog.h"
+
+#include "Scene_c3t3_item.h"
+#include "C3t3_type.h"
+
+#include "Optimizer_thread.h"
+
+#include <QObject>
+#include <QAction>
+#include <QMainWindow>
+#include <QApplication>
+#include <QtPlugin>
+#include <QInputDialog>
+#include <QFileDialog>
+#include <QMessageBox>
+#include <QTimer>
+
+#include <iostream>
+#include <fstream>
+
+#include <CGAL/Mesh_optimization_return_code.h>
+#include <CGAL/Mesh_3/parameters_defaults.h> // to get default values
+
+// declare the CGAL function
+#ifndef CGAL_MESH_3_DEMO_DISABLE_ODT
+Optimizer_thread* cgal_code_odt_mesh_3(Scene_c3t3_item& c3t3_item,
+                                       const double time_limit,
+                                       const double convergence_ratio,
+                                       const double freeze_ratio,
+                                       const int max_iteration_number,
+                                       const bool create_new_item);
+#endif
+
+#ifndef CGAL_MESH_3_DEMO_DISABLE_LLOYD
+Optimizer_thread* cgal_code_lloyd_mesh_3(Scene_c3t3_item& c3t3_item,
+                                         const double time_limit,
+                                         const double convergence_ratio,
+                                         const double freeze_ratio,
+                                         const int max_iteration_number,
+                                         const bool create_new_item);
+#endif
+
+#ifndef CGAL_MESH_3_DEMO_DISABLE_PERTURBER
+Optimizer_thread* cgal_code_perturb_mesh_3(Scene_c3t3_item& c3t3_item,
+                                           const double time_limit,
+                                           const double sliver_bound,
+                                           const bool create_new_item);
+#endif
+
+#ifndef CGAL_MESH_3_DEMO_DISABLE_EXUDER
+Optimizer_thread* cgal_code_exude_mesh_3(Scene_c3t3_item& c3t3_item,
+                                         const double time_limit,
+                                         const double sliver_bound,
+                                         const bool create_new_item);
+#endif
+
+QString translate(CGAL::Mesh_optimization_return_code rc);
+
+
+// Mesh_3_optimization_plugin class
+using namespace CGAL::Three;
+class Mesh_3_optimization_plugin :
+  public QObject,
+  protected Polyhedron_demo_plugin_interface
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+  typedef Polyhedron_demo_plugin_interface Base;
+public:
+  Mesh_3_optimization_plugin();
+  virtual void init(QMainWindow*, Scene_interface*, Messages_interface*);
+  inline virtual QList<QAction*> actions() const;
+  
+  bool applicable(QAction* a) const {
+    Scene_c3t3_item* item
+      = qobject_cast<Scene_c3t3_item*>(scene->item(scene->mainSelectionIndex()));
+    if (NULL == item)
+      return false;
+
+    if (a == actionOdt || a == actionLloyd)
+      return true;
+    else //actionPerturb or actionExude
+      return item->c3t3().number_of_cells() > 0;
+  }
+
+public Q_SLOTS:
+#ifndef CGAL_MESH_3_DEMO_DISABLE_ODT
+  void odt();
+#endif
+#ifndef CGAL_MESH_3_DEMO_DISABLE_LLOYD
+  void lloyd();
+#endif
+#ifndef CGAL_MESH_3_DEMO_DISABLE_PERTURBER
+  void perturb();
+#endif
+#ifndef CGAL_MESH_3_DEMO_DISABLE_EXUDER
+  void exude();
+#endif
+  
+  void optimization_done(Optimizer_thread* t);
+  void status_report(QString s);
+  
+private:
+  Scene_c3t3_item* get_c3t3_item() const;
+  
+  void treat_result(Scene_c3t3_item& source_item, Scene_c3t3_item& result_item,
+                    const QString& name) const;
+  
+  void launch_thread(Optimizer_thread* thread, const QString& msg);
+
+private:
+  QAction* actionOdt;
+  QAction* actionLloyd;
+  QAction* actionPerturb;
+  QAction* actionExude;
+  Messages_interface* msg;
+  QMessageBox* message_box_;
+  
+  Scene_c3t3_item* source_item_;
+  Scene_interface *scene;
+  QMainWindow* mw;
+}; // end class Mesh_3_optimization_plugin
+
+Mesh_3_optimization_plugin::
+Mesh_3_optimization_plugin()
+  : actionOdt(NULL)
+  , actionLloyd(NULL)
+  , actionPerturb(NULL)
+  , actionExude(NULL)
+  , msg(NULL)
+  , message_box_(NULL)
+  , source_item_(NULL)
+  , scene(NULL)
+  , mw(NULL)
+{
+}
+
+void 
+Mesh_3_optimization_plugin::
+init(QMainWindow* mainWindow,
+     Scene_interface* scene_interface,
+     Messages_interface* msg_interface)
+{
+  this->scene = scene_interface;
+  this->mw = mainWindow;
+  
+  // Create menu items
+#ifndef CGAL_MESH_3_DEMO_DISABLE_ODT
+  actionOdt = new QAction(tr("odt_optimize_mesh_3"), mw);
+  if( NULL != actionOdt )
+  {
+    actionOdt->setProperty("subMenuName", "Tetrahedral Mesh Generation");
+    connect(actionOdt, SIGNAL(triggered()), this, SLOT(odt()));
+  }
+#endif
+  
+#ifndef CGAL_MESH_3_DEMO_DISABLE_LLOYD
+  actionLloyd = new QAction(tr("lloyd_optimize_mesh_3"), mw);
+  if( NULL != actionLloyd )
+  {
+    actionLloyd->setProperty("subMenuName", "Tetrahedral Mesh Generation");
+    connect(actionLloyd, SIGNAL(triggered()), this, SLOT(lloyd()));
+  }
+#endif
+  
+#ifndef CGAL_MESH_3_DEMO_DISABLE_PERTURBER
+  actionPerturb = new QAction(tr("perturb_mesh_3"), mw);
+  if( NULL != actionPerturb )
+  {
+    actionPerturb->setProperty("subMenuName", "Tetrahedral Mesh Generation");
+    connect(actionPerturb, SIGNAL(triggered()), this, SLOT(perturb()));
+  }
+#endif
+  
+#ifndef CGAL_MESH_3_DEMO_DISABLE_EXUDER
+  actionExude =new QAction(tr("exude_mesh_3"), mw);
+  if( NULL != actionExude )
+  {
+    actionExude->setProperty("subMenuName", "Tetrahedral Mesh Generation");
+    connect(actionExude, SIGNAL(triggered()), this, SLOT(exude()));
+  }
+#endif
+  
+  msg = msg_interface;
+}
+
+
+inline
+QList<QAction*> 
+Mesh_3_optimization_plugin::actions() const
+{
+  return QList<QAction*>() << actionOdt << actionLloyd 
+                           << actionPerturb << actionExude;
+}
+
+
+#ifndef CGAL_MESH_3_DEMO_DISABLE_ODT
+void
+Mesh_3_optimization_plugin::odt()
+{
+  // -----------------------------------
+  // Get c3t3 item
+  // -----------------------------------
+  Scene_c3t3_item* item = get_c3t3_item();
+  if ( NULL == item ) { return; }
+
+  // -----------------------------------
+  // Dialog box
+  // -----------------------------------
+  QDialog dialog(mw);
+  Ui::Smoother_dialog ui;
+  ui.setupUi(&dialog);
+  dialog.setWindowFlags(Qt::Dialog|Qt::CustomizeWindowHint|Qt::WindowCloseButtonHint);
+  dialog.setWindowTitle(tr("Odt-smoothing parameters"));
+
+  connect(ui.buttonBox, SIGNAL(accepted()),
+          &dialog, SLOT(accept()));
+  connect(ui.buttonBox, SIGNAL(rejected()),
+          &dialog, SLOT(reject()));
+  
+  connect(ui.noTimeLimit, SIGNAL(toggled(bool)),
+          ui.maxTime,     SLOT(setDisabled(bool)));
+  
+  ui.objectName->setText(item->name());
+
+  namespace cgpd = CGAL::parameters::default_values;
+  ui.convergenceRatio->setValue(cgpd::odt_convergence_ratio);
+  ui.freezeRatio->setValue(cgpd::odt_freeze_ratio);
+  
+  int i = dialog.exec();
+  if(i == QDialog::Rejected)
+    return;
+    
+  // 0 means parameter is not considered
+  const double max_time = ui.noTimeLimit->isChecked() ? 0 : ui.maxTime->value();
+  const int max_iteration_nb = static_cast<int>(ui.maxIterationNb->value());
+  const double convergence = ui.convergenceRatio->value();
+  const double freeze = ui.freezeRatio->value();
+  const bool create_new_item = ui.createNewItem->isChecked();
+  
+  // -----------------------------------
+  // Launch optimization
+  // -----------------------------------
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  
+  Optimizer_thread* opt_thread = cgal_code_odt_mesh_3(*item,
+                                                      max_time,
+                                                      convergence,
+                                                      freeze,
+                                                      max_iteration_nb,
+                                                      create_new_item);
+  
+  if ( NULL == opt_thread )
+  {
+    QApplication::restoreOverrideCursor();
+    return;
+  }
+  
+  source_item_ = item;
+  launch_thread(opt_thread, "Odt iterations are running...");
+  QApplication::restoreOverrideCursor();
+}
+#endif
+
+
+#ifndef CGAL_MESH_3_DEMO_DISABLE_LLOYD
+void
+Mesh_3_optimization_plugin::lloyd()
+{
+  // -----------------------------------
+  // Get c3t3 item
+  // -----------------------------------
+  Scene_c3t3_item* item = get_c3t3_item();
+  if ( NULL == item ) { return; }
+  // -----------------------------------
+  // Dialog box
+  // -----------------------------------
+  QDialog dialog(mw);
+  Ui::Smoother_dialog ui;
+  ui.setupUi(&dialog);
+  dialog.setWindowFlags(Qt::Dialog|Qt::CustomizeWindowHint|Qt::WindowCloseButtonHint);
+  dialog.setWindowTitle(tr("Lloyd-smoothing parameters"));
+  
+  connect(ui.buttonBox, SIGNAL(accepted()),
+          &dialog, SLOT(accept()));
+  connect(ui.buttonBox, SIGNAL(rejected()),
+          &dialog, SLOT(reject()));
+  
+  connect(ui.noTimeLimit, SIGNAL(toggled(bool)),
+          ui.maxTime,     SLOT(setDisabled(bool)));
+  
+  ui.objectName->setText(item->name());
+  
+  namespace cgpd = CGAL::parameters::default_values;
+  ui.convergenceRatio->setValue(cgpd::lloyd_convergence_ratio);
+  ui.freezeRatio->setValue(cgpd::lloyd_freeze_ratio);
+  
+  int i = dialog.exec();
+  if(i == QDialog::Rejected)
+    return;
+  
+  // 0 means parameter is not considered
+  const double max_time = ui.noTimeLimit->isChecked() ? 0 : ui.maxTime->value();
+  const int max_iteration_nb = static_cast<int>(ui.maxIterationNb->value());
+  const double convergence = ui.convergenceRatio->value();
+  const double freeze = ui.freezeRatio->value();
+  const bool create_new_item = ui.createNewItem->isChecked();
+
+  // -----------------------------------
+  // Launch optimization
+  // -----------------------------------
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  
+  Optimizer_thread* opt_thread = cgal_code_lloyd_mesh_3(*item,
+                                                        max_time,
+                                                        convergence,
+                                                        freeze,
+                                                        max_iteration_nb,
+                                                        create_new_item);
+  if ( NULL == opt_thread )
+  {
+    QApplication::restoreOverrideCursor();
+    return;
+  }
+  source_item_ = item;
+  launch_thread(opt_thread, "Lloyd iterations are running...");
+  QApplication::restoreOverrideCursor();
+}
+#endif
+
+
+#ifndef CGAL_MESH_3_DEMO_DISABLE_PERTURBER
+void
+Mesh_3_optimization_plugin::perturb()
+{
+  // -----------------------------------
+  // Get c3t3 item
+  // -----------------------------------
+  Scene_c3t3_item* item = get_c3t3_item();
+  if ( NULL == item ) { return; }
+  
+  // -----------------------------------
+  // Dialog box
+  // -----------------------------------
+  QDialog dialog(mw);
+  Ui::LocalOptim_dialog ui;
+  ui.setupUi(&dialog);
+  dialog.setWindowFlags(Qt::Dialog|Qt::CustomizeWindowHint|Qt::WindowCloseButtonHint);
+  dialog.setWindowTitle(tr("Sliver perturbation parameters"));
+  
+  connect(ui.buttonBox, SIGNAL(accepted()),
+          &dialog, SLOT(accept()));
+  connect(ui.buttonBox, SIGNAL(rejected()),
+          &dialog, SLOT(reject()));
+  
+  connect(ui.noTimeLimit, SIGNAL(toggled(bool)),
+          ui.maxTime,     SLOT(setDisabled(bool)));
+  
+  connect(ui.noBound,     SIGNAL(toggled(bool)),
+          ui.sliverBound, SLOT(setDisabled(bool)));
+  
+  ui.objectName->setText(item->name());
+  
+  int i = dialog.exec();
+  if(i == QDialog::Rejected)
+    return;
+  
+  // 0 means parameter is not considered
+  const double max_time = ui.noTimeLimit->isChecked() ? 0 : ui.maxTime->value();
+  const double sliver_bound = ui.noBound->isChecked() ? 0 : ui.sliverBound->value();
+  const bool create_new_item = ui.createNewItem->isChecked();
+  
+  // -----------------------------------
+  // Launch optimization
+  // -----------------------------------
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  
+  Optimizer_thread* opt_thread = cgal_code_perturb_mesh_3(*item,
+                                                          max_time,
+                                                          sliver_bound,
+                                                          create_new_item);
+  
+
+  if ( NULL == opt_thread )
+  {
+    QApplication::restoreOverrideCursor();
+    return;
+  }
+  
+  source_item_ = item;
+  launch_thread(opt_thread, "Sliver perturbation is running...");
+  QApplication::restoreOverrideCursor();
+}
+#endif
+
+
+#ifndef CGAL_MESH_3_DEMO_DISABLE_EXUDER
+void
+Mesh_3_optimization_plugin::exude()
+{
+  // -----------------------------------
+  // Get c3t3 item
+  // -----------------------------------
+  Scene_c3t3_item* item = get_c3t3_item();
+  if ( NULL == item ) { return; }
+  
+  // -----------------------------------
+  // Dialog box
+  // -----------------------------------
+  QDialog dialog(mw);
+  Ui::LocalOptim_dialog ui;
+  ui.setupUi(&dialog);
+  dialog.setWindowFlags(Qt::Dialog|Qt::CustomizeWindowHint|Qt::WindowCloseButtonHint);
+  dialog.setWindowTitle(tr("Sliver exudation parameters"));
+  
+  connect(ui.buttonBox, SIGNAL(accepted()),
+          &dialog, SLOT(accept()));
+  connect(ui.buttonBox, SIGNAL(rejected()),
+          &dialog, SLOT(reject()));
+  
+  connect(ui.noTimeLimit, SIGNAL(toggled(bool)),
+          ui.maxTime,     SLOT(setDisabled(bool)));
+  
+  connect(ui.noBound,     SIGNAL(toggled(bool)),
+          ui.sliverBound, SLOT(setDisabled(bool)));
+  
+  ui.objectName->setText(item->name());
+  ui.sliverBound->setValue(25.);
+  
+  int i = dialog.exec();
+  if(i == QDialog::Rejected)
+    return;
+  
+  // 0 means parameter is not considered
+  const double max_time = ui.noTimeLimit->isChecked() ? 0 : ui.maxTime->value();
+  const double sliver_bound = ui.noBound->isChecked() ? 0 : ui.sliverBound->value();
+  const bool create_new_item = ui.createNewItem->isChecked();
+  
+  // -----------------------------------
+  // Launch optimization
+  // -----------------------------------
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  
+  Optimizer_thread* opt_thread = cgal_code_exude_mesh_3(*item,
+                                                        max_time,
+                                                        sliver_bound,
+                                                        create_new_item);
+
+  if ( NULL == opt_thread )
+  {
+    QApplication::restoreOverrideCursor();
+    return;
+  }
+  
+  source_item_ = item;
+  launch_thread(opt_thread, "Sliver exudation is running...");
+  QApplication::restoreOverrideCursor();
+}
+#endif
+
+
+Scene_c3t3_item*
+Mesh_3_optimization_plugin::
+get_c3t3_item() const
+{
+  const Scene_interface::Item_id index = scene->mainSelectionIndex();
+  Scene_c3t3_item* item = qobject_cast<Scene_c3t3_item*>(scene->item(index));
+
+  if ( NULL == item )
+  {
+    QMessageBox::warning(mw,tr(""),
+                          tr("Selected object is not a mesh... optimization can't be performed"));
+    return NULL;
+  }
+  
+  if ( NULL == item->data_item() )
+  {
+    QMessageBox::critical(mw,tr(""),
+                          tr("Can't perturb: data object has been destroyed !"));
+    return NULL;
+  }
+  
+  return item;
+}
+
+
+
+void
+Mesh_3_optimization_plugin::
+treat_result(Scene_c3t3_item& source_item,
+             Scene_c3t3_item& result_item,
+             const QString& name) const
+{
+  result_item.setName(tr("%1 [%2]").arg(source_item.name())
+                                   .arg(name));
+  
+  result_item.c3t3_changed();
+  
+  // If a new item has been created
+  if ( &source_item != &result_item)
+  {
+    const Scene_item::Bbox& bbox = result_item.bbox();
+    result_item.setPosition((bbox.xmin() + bbox.xmax())/2.f,
+                            (bbox.ymin() + bbox.ymax())/2.f,
+                            (bbox.zmin() + bbox.zmax())/2.f);
+    
+    result_item.setColor(QColor(59,74,226));
+    result_item.setRenderingMode(source_item.renderingMode());
+    result_item.set_data_item(source_item.data_item());
+
+    source_item.setVisible(false);
+    
+    const Scene_interface::Item_id index = scene->mainSelectionIndex();
+    scene->itemChanged(index);
+    
+    Scene_interface::Item_id new_item_id = scene->addItem(&result_item);
+    scene->setSelectedItem(new_item_id);
+  }
+  else
+  {
+    result_item.update_histogram();
+    
+    const Scene_interface::Item_id index = scene->mainSelectionIndex();
+    scene->itemChanged(index);
+  }
+}
+
+
+void
+Mesh_3_optimization_plugin::
+optimization_done(Optimizer_thread* thread)
+{
+  CGAL::Mesh_optimization_return_code return_code = thread->return_code();
+  QString name = thread->optimizer_name();
+  
+  // Print message in console
+  QString str = QString("%1 of \"%2\" done in %3s<br>"
+                        "End reason: '%4'<br>")
+                  .arg(name)
+                  .arg(source_item_->name())
+                  .arg(thread->time())
+                  .arg(translate(return_code));
+  
+  Q_FOREACH( QString param, thread->parameters_log() )
+  {
+    str.append(QString("( %1 )<br>").arg(param));
+  }
+  
+  msg->information(qPrintable(str));
+  
+  // Treat new c3t3 item
+  Scene_c3t3_item* result_item = thread->item();
+  treat_result( *source_item_, *result_item, name);
+  // close message box
+  message_box_->close();
+  // free memory
+  delete thread;
+}
+
+
+void
+Mesh_3_optimization_plugin::
+launch_thread(Optimizer_thread* opt_thread, const QString& window_text)
+{
+
+  // -----------------------------------
+  // Create message box with stop button
+  // -----------------------------------
+  message_box_ = new QMessageBox(QMessageBox::NoIcon,
+                                 "Optimization...",
+                                 window_text,
+                                 QMessageBox::Cancel,
+                                 mw);
+  
+  message_box_->setDefaultButton(QMessageBox::Cancel);
+  QAbstractButton* cancelButton = message_box_->button(QMessageBox::Cancel);
+  cancelButton->setText(tr("Stop"));
+  
+  QObject::connect(cancelButton, SIGNAL(clicked()),
+                   opt_thread,   SLOT(stop()));
+  
+  message_box_->show();
+  
+  // -----------------------------------
+  // Connect main thread to optimization thread and launch optimizer
+  // -----------------------------------
+  QObject::connect(opt_thread, SIGNAL(done(Optimizer_thread*)),
+                   this,       SLOT(optimization_done(Optimizer_thread*)));
+  
+  QObject::connect(opt_thread, SIGNAL(status_report(QString)),
+                   this,       SLOT(status_report(QString)));
+  
+  opt_thread->start();
+
+}
+
+
+void
+Mesh_3_optimization_plugin::
+status_report(QString str)
+{
+  if ( NULL == message_box_ ) { return; }
+  
+  message_box_->setInformativeText(str);
+}
+
+
+QString
+translate(CGAL::Mesh_optimization_return_code rc)
+{
+  switch (rc)
+  {
+    case CGAL::MESH_OPTIMIZATION_UNKNOWN_ERROR: return QString("Unexpected error");
+    case CGAL::BOUND_REACHED: return QString("Bound reached");
+    case CGAL::TIME_LIMIT_REACHED: return QString("Time limit reached");
+    case CGAL::CANT_IMPROVE_ANYMORE: return QString("Can't improve anymore");
+    case CGAL::CONVERGENCE_REACHED: return QString("Convergence reached");
+    case CGAL::MAX_ITERATION_NUMBER_REACHED: return QString("Max iteration number reached");
+    case CGAL::ALL_VERTICES_FROZEN: return QString("All vertices have been frozen");
+  }
+  
+  return QString("ERROR");
+}
+
+#include "Optimization_plugin.moc"
+
+#endif // CGAL_POLYHEDRON_DEMO_USE_SURFACE_MESHER
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Optimization_plugin_cgal_code.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Optimization_plugin_cgal_code.cpp
new file mode 100644
index 0000000..2efde06
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Optimization_plugin_cgal_code.cpp
@@ -0,0 +1,770 @@
+#include "config.h"
+#include "config_mesh_3.h"
+#include "C3t3_type.h"
+#include "Scene_c3t3_item.h"
+#include "Scene_polyhedron_item.h"
+
+#ifdef CGAL_MESH_3_DEMO_ACTIVATE_SEGMENTED_IMAGES
+#include "Scene_image_item.h"
+#endif
+#ifdef CGAL_MESH_3_DEMO_ACTIVATE_IMPLICIT_FUNCTIONS
+#include "Scene_implicit_function_item.h"
+#include "implicit_functions/Implicit_function_interface.h"
+#endif
+
+#include "Optimizer_thread.h"
+
+#include <CGAL/optimize_mesh_3.h>
+#include <CGAL/Bbox_3.h>
+
+#include <fstream>
+#include <cstddef>
+
+namespace cgp = CGAL::parameters;
+
+
+// -----------------------------------
+// Helper function
+// -----------------------------------
+QString translate_bool(const bool b)
+{
+  return b ? QString("done") 
+           : QString("in progress");
+}
+
+
+// -----------------------------------
+// Optimization_function_base template class
+// -----------------------------------
+template <typename Domain>
+class Optimization_function_base
+  : public Optimization_function_interface
+{
+public:
+  /// Constructor
+  /// Takes the responsability of d
+  explicit
+  Optimization_function_base(C3t3& c3t3, Domain* d)
+    : c3t3_(c3t3), domain_(d) {}
+  
+  /// Destructor
+  virtual ~Optimization_function_base()
+  {
+    delete domain_;
+  }
+  
+  /// Launch
+  virtual CGAL::Mesh_optimization_return_code launch()
+  {
+    return (*this)(c3t3_, *domain_);
+  }
+  
+protected:
+  /// Virtual operator() which should be overloaded
+  virtual CGAL::Mesh_optimization_return_code
+  operator()(C3t3& c3t3, const Domain& domain) = 0;
+  
+private:
+  C3t3& c3t3_;
+  Domain* domain_;
+};
+
+// Prototype which will be partially specialized for each Parameter class
+template < typename Domain, typename Parameters >
+class Optimization_function {};
+
+
+
+// -----------------------------------
+// Optimization generic function (responsible of dynamic casting)
+// -----------------------------------
+template <typename Parameters>
+Optimizer_thread* cgal_code_optimization(Scene_c3t3_item& c3t3_item,
+                                        const Parameters& param,
+                                        const bool create_new_item)
+{
+  // Create result item
+  Scene_c3t3_item* p_result_item = create_new_item ? 
+    new Scene_c3t3_item(c3t3_item.c3t3()) : &c3t3_item;
+
+  if ( NULL == p_result_item )
+  {
+    return NULL;
+  }
+  
+  
+  // Create domain using real type of c3t3_item.data_item()
+  // ------------------
+
+#ifdef CGAL_MESH_3_DEMO_ACTIVATE_SEGMENTED_IMAGES
+  // Image
+  const Scene_image_item* image_item = 
+    qobject_cast<const Scene_image_item*>(c3t3_item.data_item());
+  
+  if ( NULL != image_item )
+  {
+    // Build domain
+    const Image* p_image = image_item->image();
+
+    if ( NULL == p_image )
+    {
+      return NULL;
+    }
+    
+    Image_mesh_domain* p_domain = new Image_mesh_domain(*p_image, 1e-6);
+    
+    // Create thread
+    typedef Optimization_function<Image_mesh_domain,Parameters> Opt_function;
+    Opt_function* p_opt_function = new Opt_function(p_result_item->c3t3(), p_domain, param);
+    
+    return new Optimizer_thread(p_opt_function, p_result_item);
+  }
+#endif
+  
+  // Polyhedron
+  const Scene_polyhedron_item* poly_item = 
+    qobject_cast<const Scene_polyhedron_item*>(c3t3_item.data_item());
+  
+  if ( NULL != poly_item )
+  {
+    // Build domain
+    const Polyhedron* p_poly = poly_item->polyhedron();
+    if ( NULL == p_poly )
+    {
+      return NULL;
+    }
+    
+    Polyhedral_mesh_domain* p_domain = new Polyhedral_mesh_domain(*p_poly);
+    
+    // Create thread
+    typedef Optimization_function<Polyhedral_mesh_domain,Parameters> Opt_function;
+    Opt_function* p_opt_function = new Opt_function(p_result_item->c3t3(), p_domain, param);
+    return new Optimizer_thread(p_opt_function, p_result_item);
+  }
+  
+#ifdef CGAL_MESH_3_DEMO_ACTIVATE_IMPLICIT_FUNCTIONS
+  // Function
+  const Scene_implicit_function_item* function_item = 
+    qobject_cast<const Scene_implicit_function_item*>(c3t3_item.data_item());
+  
+  if ( NULL != function_item )
+  {
+    // Build domain
+    const Implicit_function_interface* p_function = function_item->function();
+    if ( NULL == p_function ) { return NULL; }
+    
+    CGAL::Bbox_3 dom_bbox (p_function->bbox().xmin(),
+                           p_function->bbox().ymin(),
+                           p_function->bbox().zmin(),
+                           p_function->bbox().xmax(),
+                           p_function->bbox().ymax(),
+                           p_function->bbox().zmax());
+    
+    Function_mesh_domain* p_domain =
+      new Function_mesh_domain(Function_wrapper(*p_function), dom_bbox, 1e-7);
+    
+    // Create thread
+    typedef Optimization_function<Function_mesh_domain,Parameters> Opt_function;
+    Opt_function* p_opt_function = new Opt_function(p_result_item->c3t3(), p_domain, param);
+    
+    return new Optimizer_thread(p_opt_function, p_result_item);
+  }
+#endif
+  
+  return NULL;
+}
+
+
+
+// -----------------------------------
+// Global optimization
+// -----------------------------------
+struct Global_optimization_status
+{
+  bool compute_moves_done;
+  bool move_points_done;
+  bool rebuild_restricted_delaunay_done;
+  int iteration_done;
+  
+  Global_optimization_status()
+    : compute_moves_done(false)
+    , move_points_done(false)
+    , rebuild_restricted_delaunay_done(false)
+    , iteration_done(-1) {}
+};
+
+struct Global_visitor
+{
+  Global_visitor(Global_optimization_status* status) : p_status_(status) {}
+  Global_visitor(const Global_visitor& rhs) : p_status_(rhs.p_status_) {}
+  
+  void after_compute_moves() { p_status_->compute_moves_done = true; }
+  void after_move_points() { p_status_->move_points_done = true; }
+  void after_rebuild_restricted_delaunay() { p_status_->rebuild_restricted_delaunay_done = true; }
+  
+  void end_of_iteration(int iteration_number)
+  {
+    p_status_->iteration_done = iteration_number;
+    p_status_->compute_moves_done = false;
+    p_status_->move_points_done = false;
+    p_status_->rebuild_restricted_delaunay_done = false;
+  }
+  
+private:
+  Global_optimization_status* p_status_;
+};
+
+
+template <typename Domain>
+class Global_optimization_function
+  : public Optimization_function_base< Domain >
+{
+  typedef Global_visitor                       Visitor;
+  typedef Optimization_function_base< Domain > Base;  
+  
+public:
+  /// Constructor
+  Global_optimization_function(C3t3& c3t3, Domain* d)
+    : Base(c3t3,d)
+    , status_() {}
+  
+  /// Destructor
+  virtual ~Global_optimization_function() {}
+
+  // Logs
+  virtual QString status(double) const
+  {
+    QString res = QString("Iteration %1<br /><br />"
+                          "Compute moves: %2<br />")
+    .arg(status_.iteration_done + 2)
+    .arg(translate_bool(status_.compute_moves_done));
+    
+    if ( status_.compute_moves_done )
+    {
+      res += QString("Move points: %1<br />")
+      .arg(translate_bool(status_.move_points_done));
+    }
+    
+    if ( status_.move_points_done )
+    {
+      res += QString("Rebuild restricted Delaunay: %1")
+      .arg(translate_bool(status_.rebuild_restricted_delaunay_done));
+    }
+    
+    return res;
+  }
+  
+protected:
+  Global_optimization_status status_;
+};
+
+
+// -----------------------------------
+// Odt
+// -----------------------------------
+
+#ifndef CGAL_MESH_3_DEMO_DISABLE_ODT
+
+struct Odt_parameters
+{
+  double time_limit;
+  double convergence_ratio;
+  double freeze_ratio;
+  bool do_freeze;
+  int max_iteration_nb;
+  
+  QStringList log() const
+  {
+    return QStringList()
+      << QString("time limit: %1").arg(time_limit)
+      << QString("convergence ratio: %1").arg(convergence_ratio)
+      << QString("freeze ratio: %1").arg(freeze_ratio)
+      << QString("do freeze: %1").arg(do_freeze)
+      << QString("maximum iterations: %1").arg(max_iteration_nb);
+  }
+};
+
+
+/**
+ * @class Odt_function
+ * Partial specialization of class Optimization_function for Odt
+ * Runs odt global optimization
+ */
+template <typename Domain>
+class Optimization_function < Domain, Odt_parameters >
+  : public Global_optimization_function< Domain >
+{
+  // Private types
+  typedef C3t3::Triangulation  Tr;
+  typedef CGAL::Mesh_3::Mesh_sizing_field<Tr>    Sizing;
+  typedef CGAL::Mesh_3::Odt_move<C3t3,Sizing>    Move;
+  typedef Global_visitor                         Visitor;
+  
+  typedef typename CGAL::Mesh_3::Mesh_global_optimizer<C3t3,Domain,Move,Visitor> Odt_optimizer;
+
+  typedef Global_optimization_function< Domain > Base;  
+
+public:
+  /// Constructor
+  Optimization_function(C3t3& c3t3, Domain* d, const Odt_parameters& p)
+    : Base(c3t3,d)
+    , odt_(NULL)
+    , p_(p) {}
+  
+  /// Destructor
+  virtual ~Optimization_function() { delete odt_; }
+
+  /// Stops process (set time limit to 1ms)
+  virtual void stop() { odt_->set_time_limit(0.001); }
+  
+  /// Log strings
+  virtual QString name() const { return QString("Odt"); }
+  virtual QStringList parameters_log() const { return p_.log(); }
+  
+protected:
+  /// Launch odt optimization
+  /// The content of this method is taken from CGAL::odt_optimize_mesh_3()
+  virtual CGAL::Mesh_optimization_return_code 
+  operator()(C3t3& c3t3, const Domain& domain)
+  {
+    if ( NULL != odt_ ) { return CGAL::MESH_OPTIMIZATION_UNKNOWN_ERROR; }
+
+    // Create optimizer
+    odt_ = new Odt_optimizer(c3t3, domain, p_.freeze_ratio, p_.do_freeze, p_.convergence_ratio);
+    if ( NULL == odt_ ) { return CGAL::MESH_OPTIMIZATION_UNKNOWN_ERROR; }
+    
+    // Set max time
+    odt_->set_time_limit(p_.time_limit);
+    
+    // 1000 iteration max to avoid infinite loops
+    int max_iteration_nb = ( 0 == p_.max_iteration_nb ) ? 1000
+                                                       : p_.max_iteration_nb;
+      
+    // Launch optimization
+    return (*odt_)(max_iteration_nb, Visitor(&(this->status_)));
+  }
+  
+private:
+  Odt_optimizer* odt_;
+  Odt_parameters p_;
+};
+
+
+/**
+ * Global function cgal_code_odt_mesh_3
+ */
+Optimizer_thread*
+cgal_code_odt_mesh_3(Scene_c3t3_item& c3t3_item,
+                     const double time_limit,
+                     const double convergence_ratio,
+                     const double freeze_ratio,
+                     const int max_iteration_number,
+                     const bool create_new_item)
+{
+  Odt_parameters p;
+  p.time_limit = time_limit;
+  p.convergence_ratio = convergence_ratio;
+  p.freeze_ratio = freeze_ratio;
+  p.max_iteration_nb = max_iteration_number;
+  
+  return cgal_code_optimization(c3t3_item, p, create_new_item);
+}
+#endif
+
+
+
+// -----------------------------------
+// Lloyd
+// -----------------------------------
+
+#ifndef CGAL_MESH_3_DEMO_DISABLE_LLOYD
+
+struct Lloyd_parameters
+{
+  double time_limit;
+  double convergence_ratio;
+  double freeze_ratio;
+  bool do_freeze;
+  int max_iteration_nb;
+  
+  QStringList log() const
+  {
+    return QStringList()
+      << QString("time limit: %1").arg(time_limit)
+      << QString("convergence ratio: %1").arg(convergence_ratio)
+      << QString("freeze ratio: %1").arg(freeze_ratio)
+      << QString("do freeze: %1").arg(do_freeze)
+      << QString("maximum iterations: %1").arg(max_iteration_nb);
+  }
+};
+
+
+/**
+ * @class Lloyd_function
+ * Partial specialization of class Optimization_function for Lloyd
+ * Runs lloyd global optimization
+ */
+template <typename Domain>
+class Optimization_function < Domain, Lloyd_parameters >
+  : public Global_optimization_function< Domain >
+{
+  // Private types
+  typedef C3t3::Triangulation  Tr;
+  typedef CGAL::Mesh_3::Mesh_sizing_field<Tr>    Sizing;
+  typedef CGAL::Mesh_3::Lloyd_move<C3t3,Sizing>  Move;
+  typedef Global_visitor                         Visitor;
+  
+  typedef typename CGAL::Mesh_3::Mesh_global_optimizer<C3t3,Domain,Move,Visitor> Lloyd_optimizer;
+  
+  typedef Global_optimization_function< Domain > Base;
+  
+public:
+  /// Constructor
+  Optimization_function(C3t3& c3t3, Domain* d, const Lloyd_parameters& p)
+    : Base(c3t3,d)
+    , lloyd_(NULL)
+    , p_(p) {}
+  
+  /// Destructor
+  virtual ~Optimization_function() { delete lloyd_; }
+
+  /// Stops process (set time limit to 1ms)
+  virtual void stop() { lloyd_->set_time_limit(0.001); }
+  
+  /// Log strings
+  virtual QString name() const { return QString("Lloyd"); }
+  virtual QStringList parameters_log() const { return p_.log(); }
+  
+protected:
+  /// Launch lloyd optimization
+  /// The content of this method is taken from CGAL::lloyd_optimize_mesh_3()
+  virtual CGAL::Mesh_optimization_return_code 
+  operator()(C3t3& c3t3, const Domain& domain)
+  {
+    if ( NULL != lloyd_ ) { return CGAL::MESH_OPTIMIZATION_UNKNOWN_ERROR; }
+    
+    // Create optimizer
+    lloyd_ = new Lloyd_optimizer(c3t3, domain, p_.freeze_ratio, p_.do_freeze, p_.convergence_ratio);
+    if ( NULL == lloyd_ ) { return CGAL::MESH_OPTIMIZATION_UNKNOWN_ERROR; }
+    
+    // Set max time
+    lloyd_->set_time_limit(p_.time_limit);
+    
+    // 1000 iteration max to avoid infinite loops
+    int max_iteration_nb = ( 0 == p_.max_iteration_nb ) ? 1000
+                                                        : p_.max_iteration_nb;
+    
+    // Launch optimization
+    return (*lloyd_)(max_iteration_nb, Visitor(&(this->status_)));
+  }
+  
+private:
+  Lloyd_optimizer* lloyd_;
+  Lloyd_parameters p_;
+};
+
+
+/**
+ * Global function cgal_code_lloyd_mesh_3
+ */
+Optimizer_thread*
+cgal_code_lloyd_mesh_3(Scene_c3t3_item& c3t3_item,
+                       const double time_limit,
+                       const double convergence_ratio,
+                       const double freeze_ratio,
+                       const int max_iteration_number,
+                       const bool create_new_item)
+{
+  Lloyd_parameters p;
+  p.time_limit = time_limit;
+  p.convergence_ratio = convergence_ratio;
+  p.freeze_ratio = freeze_ratio;
+  p.max_iteration_nb = max_iteration_number;
+
+  return cgal_code_optimization(c3t3_item, p, create_new_item);
+}
+#endif
+
+
+
+// -----------------------------------
+// Perturbation
+// -----------------------------------
+
+#ifndef CGAL_MESH_3_DEMO_DISABLE_PERTURBER
+
+struct Perturb_parameters
+{
+  double time_limit;
+  double sliver_bound;
+  
+  QStringList log() const
+  {
+    return QStringList()
+      << QString("time limit: %1").arg(time_limit)
+      << QString("sliver bound: %1").arg(sliver_bound);
+  }
+};
+
+
+struct Perturb_status
+{
+  double bound_reached;
+  double vertices_left;
+
+  Perturb_status() : bound_reached(0), vertices_left(0) {}
+};
+
+struct Perturb_visitor
+{
+  Perturb_visitor(Perturb_status* status) : p_status_(status) {}
+  Perturb_visitor(const Perturb_visitor& rhs) : p_status_(rhs.p_status_) {}
+  
+  void bound_reached(const double bound) { p_status_->bound_reached = bound; }
+  void end_of_perturbation_iteration(std::size_t v) { p_status_->vertices_left = v;}
+  
+private:
+  Perturb_status* p_status_;
+};
+
+
+/**
+ * @class Perturb_function
+ * Partial specialization of class Optimization_function for perturbation
+ * Runs sliver perturbation
+ */
+template <typename Domain>
+class Optimization_function < Domain, Perturb_parameters >
+  : public Optimization_function_base< Domain >
+{
+  // Private types
+  typedef C3t3::Triangulation                                     Tr;
+  typedef CGAL::Mesh_3::Min_dihedral_angle_criterion<Tr>          Sc;
+  typedef Perturb_visitor                                         Visitor;
+  
+  typedef CGAL::Mesh_3::Sliver_perturber<C3t3,Domain,Sc,Visitor>  Perturber;
+  
+  typedef Optimization_function_base< Domain > Base;
+  
+public:
+  /// Constructor
+  Optimization_function(C3t3& c3t3, Domain* d, const Perturb_parameters& p)
+    : Base(c3t3,d)
+    , perturb_(NULL)
+    , p_(p)
+    , criterion_(p.sliver_bound, c3t3.triangulation()) {}
+  
+  /// Destructor
+  ~Optimization_function() { delete perturb_; }
+
+  /// Stops process (set time limit to 1ms)
+  virtual void stop() { perturb_->set_time_limit(0.001); }
+  
+  /// Log strings
+  virtual QString name() const { return QString("Perturb"); }
+  virtual QStringList parameters_log() const { return p_.log(); }
+  virtual QString status(double) const
+  {
+    return QString("Dihedral angle reached: %1<br /><br />"
+                   "Vertices left in queue (to reach next bound): %2")
+    .arg(status_.bound_reached)
+    .arg(status_.vertices_left);
+  }
+  
+protected:
+  /// Launch sliver perturbation
+  /// The content of this method is taken from CGAL::perturb_mesh_3()
+  virtual CGAL::Mesh_optimization_return_code  
+  operator()(C3t3& c3t3, const Domain& domain)
+  {
+    if ( NULL != perturb_ ) { return CGAL::MESH_OPTIMIZATION_UNKNOWN_ERROR; }
+
+    typedef CGAL::Mesh_3::Sq_radius_perturbation<C3t3,Domain,Sc>      Sq_radius;
+    typedef CGAL::Mesh_3::Volume_perturbation<C3t3,Domain,Sc>         Volume;
+    typedef CGAL::Mesh_3::Dihedral_angle_perturbation<C3t3,Domain,Sc> Dihedral_angle;
+    typedef CGAL::Mesh_3::Li_random_perturbation<C3t3,Domain,Sc>      Li_random;
+    
+    // Build perturber
+    perturb_ = new Perturber(c3t3, domain, criterion_);
+    if ( NULL == perturb_ ) { return CGAL::MESH_OPTIMIZATION_UNKNOWN_ERROR; }
+    
+    // Add perturbations
+    perturb_->add_perturbation(new Sq_radius(40,0.05));
+    perturb_->add_perturbation(new Volume(40,0.05));
+    perturb_->add_perturbation(new Dihedral_angle(40,0.05));
+    perturb_->add_perturbation(new Li_random(100,0.15));
+    
+    // Set max time
+    perturb_->set_time_limit(p_.time_limit);
+    
+    // Set sliver bound (0 means no sliver bound)
+    if ( 0 == p_.sliver_bound ) { p_.sliver_bound = Sc::max_value; }
+    
+    // Launch perturber
+    return (*perturb_)(Visitor(&status_));
+  }
+
+private:
+  Perturber* perturb_;
+  Perturb_parameters p_;
+  Perturb_status status_;
+  Sc criterion_;
+};
+
+
+/**
+ * Global function cgal_code_perturb_mesh_3
+ */
+Optimizer_thread*
+cgal_code_perturb_mesh_3(Scene_c3t3_item& c3t3_item,
+                         const double time_limit,
+                         const double sliver_bound,
+                         const bool create_new_item)
+{
+  Perturb_parameters p;
+  p.sliver_bound = sliver_bound;
+  p.time_limit = time_limit;
+  
+  return cgal_code_optimization(c3t3_item, p, create_new_item);
+}
+#endif
+
+// -----------------------------------
+// Exudation
+// -----------------------------------
+
+#ifndef CGAL_MESH_3_DEMO_DISABLE_EXUDER
+
+struct Exude_parameters
+{
+  double time_limit;
+  double sliver_bound;
+  
+  QStringList log() const
+  {
+    return QStringList()
+      << QString("time limit: %1").arg(time_limit)
+      << QString("sliver bound: %1").arg(sliver_bound);
+  }
+};
+
+
+struct Exude_status
+{
+  double cells_left_in_queue;
+  double vertices_pumped;
+  
+  Exude_status() : cells_left_in_queue(0), vertices_pumped(0) {}
+};
+
+struct Exude_visitor
+{
+  Exude_visitor(Exude_status* status) : p_status_(status) {}
+  Exude_visitor(const Exude_visitor& rhs) : p_status_(rhs.p_status_) {}
+  
+  void after_cell_pumped(std::size_t n) { p_status_->cells_left_in_queue = n; }
+  
+private:
+  Exude_status* p_status_;
+};
+
+
+/**
+ * @class Exude_function
+ * Partial specialization of class Optimization_function for exudation
+ * Runs sliver exudation
+ */
+template <typename Domain>
+class Optimization_function < Domain, Exude_parameters >
+  : public Optimization_function_base< Domain >
+{
+  // Private types
+  typedef C3t3::Triangulation                               Tr;
+  typedef CGAL::Mesh_3::Min_dihedral_angle_criterion<Tr>    Sc;
+  typedef Exude_visitor                                     Visitor;
+  typedef CGAL::Mesh_3::Slivers_exuder<C3t3,Sc,Visitor>     Exuder;
+  
+  typedef Optimization_function_base< Domain > Base;
+  
+public:
+  // Constructor
+  Optimization_function(C3t3& c3t3, Domain* d, const Exude_parameters& p)
+    : Base(c3t3,d)
+    , exude_(NULL)
+    , p_(p)
+    , criterion_(p.sliver_bound, c3t3.triangulation()) {}
+  
+  /// Destructor
+  ~Optimization_function() { delete exude_; }
+  
+  /// Stops process (set time limit to 1ms)
+  virtual void stop() { exude_->set_time_limit(0.001); }
+  
+  // Log strings
+  virtual QString name() const { return QString("Exude"); }
+  virtual QStringList parameters_log() const { return p_.log(); }
+  virtual QString status(double) const
+  {
+    return QString("Cells left in queue: %1<br />")
+                   //"Vertices pumped: %2")
+      .arg(status_.cells_left_in_queue);
+      //.arg(status_.vertices_pumped);
+  }
+  
+protected:
+  /// Launch sliver exudation
+  /// The content of this method is taken from CGAL::exude_mesh_3()
+  virtual CGAL::Mesh_optimization_return_code  
+  operator()(C3t3& c3t3, const Domain&)
+  {
+    if ( NULL != exude_ ) { return CGAL::MESH_OPTIMIZATION_UNKNOWN_ERROR; }
+    
+    // Create exuder
+    exude_ = new Exuder(c3t3, criterion_);
+    if ( NULL == exude_ ) { return CGAL::MESH_OPTIMIZATION_UNKNOWN_ERROR; }
+    
+    // Set time_limit
+    exude_->set_time_limit(p_.time_limit);
+    
+    // Launch exudation
+    return (*exude_)(Visitor(&status_));
+  }
+  
+private:
+  Exuder* exude_;
+  Exude_parameters p_;
+  Exude_status status_;
+  Sc criterion_;
+};
+
+
+/**
+ * Global function cgal_code_exude_mesh_3
+ */
+Optimizer_thread*
+cgal_code_exude_mesh_3(Scene_c3t3_item& c3t3_item,
+                       const double time_limit,
+                       const double sliver_bound,
+                       const bool create_new_item)
+{
+  // Create result item
+  Scene_c3t3_item* p_result_item = create_new_item ? 
+    new Scene_c3t3_item(c3t3_item.c3t3()) : &c3t3_item;
+
+  if ( NULL == p_result_item )
+  {
+    return NULL;
+  }
+  
+  // Exudation
+  Exude_parameters p;
+  p.sliver_bound = sliver_bound;
+  p.time_limit = time_limit;
+
+  // Create thread
+  typedef Optimization_function<int,Exude_parameters> Opt_function;
+  Opt_function* p_opt_function = new Opt_function(p_result_item->c3t3(), NULL, p);
+  
+  return new Optimizer_thread(p_opt_function, p_result_item);
+}
+#endif
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Optimizer_thread.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Optimizer_thread.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Optimizer_thread.cpp
rename to 3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Optimizer_thread.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Optimizer_thread.h b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Optimizer_thread.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Optimizer_thread.h
rename to 3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Optimizer_thread.h
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Polyhedron_demo_mesh_3_labeled_mesh_domain_3.h b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Polyhedron_demo_mesh_3_labeled_mesh_domain_3.h
new file mode 100644
index 0000000..87054a9
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Polyhedron_demo_mesh_3_labeled_mesh_domain_3.h
@@ -0,0 +1,290 @@
+// Copyright (c) 2009 INRIA Sophia-Antipolis (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
+// 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(s)     : Jane Tournois
+//
+//******************************************************************************
+// File Description :
+// class Labeled_mesh_domain_3. See class description.
+//******************************************************************************
+
+#ifndef CGAL_POLYHEDRON_DEMO_LABELED_MESH_DOMAIN_3_H
+#define CGAL_POLYHEDRON_DEMO_LABELED_MESH_DOMAIN_3_H
+
+#include <CGAL/Labeled_mesh_domain_3.h>
+#include <CGAL/Random.h>
+#include "Image_type.h"
+
+#include <boost/type_traits.hpp>
+
+namespace CGAL {
+
+struct Compare_to_isovalue {
+  float iso_value;
+  bool less;
+
+  Compare_to_isovalue(float iso_value, bool less)
+    : iso_value(iso_value), less(less) {}
+
+  bool operator()(float x) const {
+    return (x < iso_value) == less;
+  }
+};
+
+/**
+ * \class Polyhedron_demo_labeled_mesh_domain_3
+ * LabeledDomain must be a Labeled_mesh_domain_3
+ */
+template<class LabeledDomain, class Image = CGAL::Image_3>
+class Polyhedron_demo_labeled_mesh_domain_3
+  : public LabeledDomain
+{
+public:
+  typedef LabeledDomain Base;
+  typedef Polyhedron_demo_labeled_mesh_domain_3 Domain;
+
+  //-------------------------------------------------------
+  // Index Types
+  //-------------------------------------------------------
+  /// Type of indexes for cells of the input complex
+  typedef typename Base::Subdomain_index       Subdomain_index;
+  typedef boost::optional<Subdomain_index>     Subdomain;
+
+  /// Type of indexes for surface patch of the input complex
+  typedef int                                  Surface_patch_index;
+  typedef boost::optional<Surface_patch_index> Surface_patch;
+
+  typedef typename Base::Point_3   Point_3;
+  typedef typename Base::Segment_3 Segment_3;
+
+  /// Type of indexes to characterize the lowest dimensional face of the input
+  /// complex on which a vertex lie
+  typedef int Index;
+  typedef CGAL::cpp11::tuple<Point_3, Index, int> Intersection;
+
+  //constructors
+  Polyhedron_demo_labeled_mesh_domain_3(
+    const typename Base::Fct& f,
+    const typename Base::Bbox_3& bbox,
+    const typename Base::FT& error_bound = Base::FT(1e-3),
+    CGAL::Random* p_rng = NULL)
+    : Base(f, bbox, error_bound,
+           // Subdomain_index(), Null_subdomain_index(),
+           p_rng)
+  {}
+
+  Polyhedron_demo_labeled_mesh_domain_3(
+    const Image& img,
+    const typename Base::FT& error_bound = Base::FT(1e-3),
+    CGAL::Random* p_rng = NULL)
+    : Base(img, error_bound,
+           // Subdomain_index(), Null_subdomain_index(),
+           p_rng)
+  {}
+
+  ///Constructor for the Gray-level Images
+  Polyhedron_demo_labeled_mesh_domain_3(
+    const Image& img,
+    const Compare_to_isovalue iso_value_transform,
+    const float value_outside)
+   : Base(img, iso_value_transform, value_outside)
+  {}
+
+  /**
+   * Returns the index to be stored in a vertex lying on the surface identified
+   * by \c index.
+   */
+  Index index_from_surface_patch_index(
+    const Surface_patch_index& index) const
+  {
+    return Index(index);
+  }
+
+  Index index_from_surface_patch_index(
+    const typename Base::Surface_patch_index& index_pair) const
+  {
+    return Index(index_pair.first * 1000 + index_pair.second);
+  }
+
+  Index index_from_surface_patch_index(
+    const typename Base::Index& index) const
+  {
+    return index_from_surface_patch_index(surface_patch_index(index));
+  }
+
+  Index index_from_index(
+    const typename Base::Index& index) const
+  {
+    if (const typename Base::Surface_patch_index* index_pair =
+      boost::get<typename Base::Surface_patch_index>(&index))
+        return Index(index_pair->first * 1000 + index_pair->second);
+
+    else if (const typename Base::Subdomain_index* sub_index =
+      boost::get<typename Base::Subdomain_index>(&index))
+        return Index(*sub_index);
+
+    return Index(-1);//~error
+  }
+
+  /**
+   * Returns the index to be stored in a vertex lying in the subdomain
+   * identified by \c index.
+   */
+  Index index_from_subdomain_index(const Subdomain_index& index) const
+  { return Index(index); }
+
+  /**
+   * Returns the \c Surface_patch_index of the surface patch
+   * where lies a vertex with dimension 2 and index \c index.
+   */
+  Surface_patch_index
+    surface_patch_index(const Index& index) const
+  {
+    return index;
+  }
+
+  Surface_patch_index
+    surface_patch_index(const typename Base::Index& index) const
+  {
+    typename Base::Surface_patch_index index_pair =
+      boost::get<typename Base::Surface_patch_index>(index);
+    return Surface_patch_index(index_pair.first * 1000 + index_pair.second);
+  }
+
+  typename Base::Surface_patch_index
+    surface_patch_index_base(const Index& index) const
+  {
+    return typename Base::Surface_patch_index(index / 1000,
+                                              index % 1000);
+  }
+
+  /**
+   * Returns the index of the subdomain containing a vertex
+   *  with dimension 3 and index \c index.
+   */
+  Subdomain_index subdomain_index(const Index& index) const
+  { return index; }
+  
+  // -----------------------------------
+  // Backward Compatibility
+  // -----------------------------------
+#ifndef CGAL_MESH_3_NO_DEPRECATED_SURFACE_INDEX
+  typedef Surface_patch_index   Surface_index;
+  
+  Index index_from_surface_index(const Surface_index& index) const
+  { return index_from_surface_patch_index(index); }
+  
+  Surface_index surface_index(const Index& index) const
+  { return surface_patch_index(index); }
+#endif // CGAL_MESH_3_NO_DEPRECATED_SURFACE_INDEX
+  // -----------------------------------
+  // End backward Compatibility
+  // -----------------------------------
+
+
+  struct Construct_initial_points
+  {
+    Construct_initial_points(const Domain& domain)
+      : r_domain_(domain) {}
+
+    template<class OutputIterator>
+    OutputIterator operator()(OutputIterator pts, const int n = 12) const
+    {
+      typename Base::Construct_initial_points cip =
+        r_domain_.Base::construct_initial_points_object();
+
+      std::vector<std::pair<Point_3, typename Base::Index> > initial_points;
+      cip(std::back_inserter(initial_points), n);
+
+      for (std::size_t i = 0; i < initial_points.size(); ++i)
+      {
+        std::pair<Point_3, typename Base::Index> p = initial_points[i];
+        *pts++ = std::make_pair(p.first,
+                                r_domain_.surface_patch_index(p.second));
+      }
+      return pts;
+    }
+
+  private:
+    const Domain& r_domain_;
+  };
+
+  /// Returns Construct_initial_points object
+  Construct_initial_points construct_initial_points_object() const
+  {
+    return Construct_initial_points(*this);
+  }
+
+
+  struct Construct_intersection
+  {
+    Construct_intersection(const Domain& domain)
+      : r_domain_(domain) {}
+
+    template<typename Query>
+    Intersection operator()(const Query& q) const
+    {
+      typename Base::Construct_intersection
+        ci = r_domain_.Base::construct_intersection_object();
+      typename Base::Intersection bi = ci(q);
+
+      return CGAL::cpp11::make_tuple(
+        CGAL::cpp11::get<0>(bi),
+        r_domain_.index_from_index(CGAL::cpp11::get<1>(bi)),
+        CGAL::cpp11::get<2>(bi));
+    }
+
+  private:
+    const Domain& r_domain_;
+  };
+
+  /// Returns Construct_intersection object
+  Construct_intersection construct_intersection_object() const
+  {
+    return Construct_intersection(*this);
+  }
+
+
+private:
+  ///// Returns Surface_patch_index from \c i and \c j
+  //typename Base::Surface_patch_index
+  //  make_surface_index(const Subdomain_index i,
+  //                     const Subdomain_index j) const
+  //{
+  //  if ( i < j )
+  //    return typename Base::Surface_patch_index(i, j);
+  //  else
+  //    return typename Base::Surface_patch_index(j, i);
+  //}
+
+  Surface_patch_index
+    make_surface_index(const Subdomain_index i,
+                       const Subdomain_index j) const
+  {
+    if (i < j)
+      return (i * 1000 + j);
+    else
+      return (j * 1000 + i);
+  }
+
+};  // end class Labeled_mesh_domain_3
+
+}  // end namespace CGAL
+
+#endif // CGAL_POLYHEDRON_DEMO_LABELED_MESH_DOMAIN_3_H
+
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Raw_image_dialog.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Raw_image_dialog.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Raw_image_dialog.cpp
rename to 3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Raw_image_dialog.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Raw_image_dialog.h b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Raw_image_dialog.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/Raw_image_dialog.h
rename to 3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Raw_image_dialog.h
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Smoother_dialog.ui b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Smoother_dialog.ui
new file mode 100644
index 0000000..1f4fdcc
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Smoother_dialog.ui
@@ -0,0 +1,317 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Smoother_dialog</class>
+ <widget class="QDialog" name="Smoother_dialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>507</width>
+    <height>328</height>
+   </rect>
+  </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="minimumSize">
+   <size>
+    <width>0</width>
+    <height>0</height>
+   </size>
+  </property>
+  <property name="windowTitle">
+   <string>Global smoother parameters</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0,0,0,0">
+   <item>
+    <widget class="QLabel" name="objectName">
+     <property name="font">
+      <font>
+       <pointsize>15</pointsize>
+       <weight>75</weight>
+       <bold>true</bold>
+      </font>
+     </property>
+     <property name="text">
+      <string>NO OBJECT</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="groupBox">
+     <property name="font">
+      <font>
+       <pointsize>13</pointsize>
+      </font>
+     </property>
+     <property name="title">
+      <string>Parameters</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout_2" rowstretch="0,0" columnstretch="0,1,0">
+      <property name="topMargin">
+       <number>8</number>
+      </property>
+      <property name="bottomMargin">
+       <number>8</number>
+      </property>
+      <property name="horizontalSpacing">
+       <number>6</number>
+      </property>
+      <item row="1" column="0">
+       <widget class="QLabel" name="timeLabel">
+        <property name="text">
+         <string>Max CPU running time (s)</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+        <property name="buddy">
+         <cstring>maxTime</cstring>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="2">
+       <widget class="QCheckBox" name="noTimeLimit">
+        <property name="layoutDirection">
+         <enum>Qt::LeftToRight</enum>
+        </property>
+        <property name="text">
+         <string>No time limit</string>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="1">
+       <widget class="QDoubleSpinBox" name="maxTime">
+        <property name="minimumSize">
+         <size>
+          <width>100</width>
+          <height>0</height>
+         </size>
+        </property>
+        <property name="decimals">
+         <number>1</number>
+        </property>
+        <property name="maximum">
+         <double>9999.000000000000000</double>
+        </property>
+        <property name="value">
+         <double>60.000000000000000</double>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="groupBox_2">
+     <property name="font">
+      <font>
+       <pointsize>11</pointsize>
+       <italic>true</italic>
+      </font>
+     </property>
+     <property name="title">
+      <string>Advanced Parameters</string>
+     </property>
+     <property name="flat">
+      <bool>false</bool>
+     </property>
+     <property name="checkable">
+      <bool>false</bool>
+     </property>
+     <layout class="QGridLayout" name="gridLayout_3" columnstretch="0,1">
+      <property name="topMargin">
+       <number>8</number>
+      </property>
+      <property name="bottomMargin">
+       <number>8</number>
+      </property>
+      <item row="0" column="0">
+       <widget class="QLabel" name="iterationLabel">
+        <property name="font">
+         <font>
+          <pointsize>11</pointsize>
+          <italic>true</italic>
+         </font>
+        </property>
+        <property name="text">
+         <string>Maximum number of iterations</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+        <property name="buddy">
+         <cstring>maxIterationNb</cstring>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <widget class="QDoubleSpinBox" name="maxIterationNb">
+        <property name="decimals">
+         <number>0</number>
+        </property>
+        <property name="maximum">
+         <double>200.000000000000000</double>
+        </property>
+        <property name="value">
+         <double>100.000000000000000</double>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="0">
+       <widget class="QLabel" name="convergenceLabel">
+        <property name="font">
+         <font>
+          <pointsize>11</pointsize>
+          <italic>true</italic>
+         </font>
+        </property>
+        <property name="text">
+         <string>Convergence ratio</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="1">
+       <widget class="QDoubleSpinBox" name="convergenceRatio">
+        <property name="decimals">
+         <number>4</number>
+        </property>
+        <property name="minimum">
+         <double>0.000100000000000</double>
+        </property>
+        <property name="maximum">
+         <double>1.000000000000000</double>
+        </property>
+        <property name="singleStep">
+         <double>0.010000000000000</double>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="0">
+       <widget class="QLabel" name="freezeLabel">
+        <property name="font">
+         <font>
+          <pointsize>11</pointsize>
+          <italic>true</italic>
+         </font>
+        </property>
+        <property name="text">
+         <string>Freeze ratio</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+        <property name="buddy">
+         <cstring>freezeRatio</cstring>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="1">
+       <widget class="QDoubleSpinBox" name="freezeRatio">
+        <property name="decimals">
+         <number>4</number>
+        </property>
+        <property name="minimum">
+         <double>0.000000000000000</double>
+        </property>
+        <property name="maximum">
+         <double>1.000000000000000</double>
+        </property>
+        <property name="singleStep">
+         <double>0.001000000000000</double>
+        </property>
+        <property name="value">
+         <double>0.000000000000000</double>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout_2">
+     <item>
+      <widget class="QCheckBox" name="createNewItem">
+       <property name="layoutDirection">
+        <enum>Qt::RightToLeft</enum>
+       </property>
+       <property name="text">
+        <string>Create a new mesh object</string>
+       </property>
+       <property name="checked">
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <spacer name="verticalSpacer_3">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeType">
+      <enum>QSizePolicy::Expanding</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>10</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item>
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>Smoother_dialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>384</x>
+     <y>191</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>195</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>Smoother_dialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>384</x>
+     <y>191</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>195</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Volume_plane.h b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Volume_plane.h
new file mode 100644
index 0000000..bab6636
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Volume_plane.h
@@ -0,0 +1,478 @@
+#ifndef CGAL_VOLUME_PLANE_H
+#define CGAL_VOLUME_PLANE_H
+
+#include <CGAL/Three/Scene_item.h>
+
+#include <vector>
+#include <cassert>
+
+#include <QDebug>
+#include <QGLViewer/qglviewer.h>
+
+#include "Volume_plane_interface.h"
+#include <QOpenGLVertexArrayObject>
+#include <QOpenGLBuffer>
+#include <QOpenGLShaderProgram>
+#include <CGAL/Three/Viewer_interface.h>
+#include <CGAL/Qt/debug.h>
+
+using namespace CGAL::Three;
+
+#if !defined(NDEBUG)
+inline
+void printGlError(unsigned int line) {
+ CGAL::Qt::opengl_check_errors(line);
+}
+#else
+inline
+void printGlError(unsigned int) {
+}
+#endif
+
+template<int Dim>
+class Length_constraint : public qglviewer::WorldConstraint {
+public:
+  Length_constraint(double max_) : max_(max_) { }
+
+  void constrainTranslation(qglviewer::Vec& t, qglviewer::Frame* const frame) {
+    WorldConstraint::constrainTranslation(t, frame);
+    qglviewer::Vec pos = frame->position();
+    double start = pos[Dim];
+    double end = t[Dim];
+    start += end;
+
+    if(start > max_ || (start < 0)) {
+      t[Dim] = 0.0;
+    }
+  }
+
+private:
+  double max_;
+};
+
+struct x_tag {};
+struct y_tag {};
+struct z_tag {};
+
+template<typename Tag>
+class Volume_plane : public Volume_plane_interface, public Tag {
+public:
+ Volume_plane();
+
+ void compute_bbox()const
+ {
+   compute_bbox(*this);
+ }
+
+ void compute_bbox(x_tag)const
+ {
+   _bbox = Bbox(0,0,0,
+               0, (adim_ - 1) * yscale_, (bdim_ - 1) * zscale_);
+ }
+
+ void compute_bbox(y_tag)const
+ {
+   _bbox = Bbox(0,0,0,
+               (adim_ - 1) * xscale_, 0, (bdim_ - 1) * zscale_);
+ }
+
+ void compute_bbox(z_tag)const
+ {
+   _bbox = Bbox(0,0,0,
+               (adim_ - 1) * xscale_, (bdim_ - 1) * yscale_, 0);
+ }
+
+ void setData(unsigned int adim, unsigned int bdim, unsigned int cdim,
+                 float xscale, float yscale, float zscale, std::vector<float>& colors);
+
+  virtual ~Volume_plane();
+
+  Volume_plane* clone() const { return NULL; }
+
+  virtual RenderingMode renderingMode() const { return Flat; }
+  bool supportsRenderingMode(RenderingMode m) const { return m == Flat; }
+  
+  QString toolTip() const { return "Plane through a volume"; }
+  QString name() const { return name(*this); }
+
+  bool isFinite() const { return true; }
+  bool isEmpty() const { return false; }
+  bool manipulatable() const { return true; }
+
+  unsigned int cube() {return currentCube; }
+
+  void draw(Viewer_interface* viewer)const;
+
+  unsigned int aDim() const { return adim_; }
+  unsigned int bDim() const { return bdim_; }
+  unsigned int cDim() const { return cdim_; }
+
+  qglviewer::Vec translationVector() const { return translationVector(*this); }
+
+  unsigned int getCurrentCube() const { return currentCube; }
+
+  // uses a public init function to make enable construction in
+  // threads without gl-context
+  void init();
+
+private:
+  static const char* vertexShader_source;
+
+  static const char* fragmentShader_source;
+
+  static const char* vertexShader_bordures_source;
+
+  static const char* fragmentShader_bordures_source;
+
+
+  qglviewer::Vec translationVector(x_tag) const {
+    return qglviewer::Vec(xscale_, 0.0, 0.0);
+  }
+  qglviewer::Vec translationVector(y_tag) const {
+    return qglviewer::Vec(0.0, yscale_, 0.0);
+  }
+  qglviewer::Vec translationVector(z_tag) const {
+    return qglviewer::Vec(0.0, 0.0, zscale_);
+  }
+
+  void initShaders();
+
+  void buildVertex(std::vector<float>& out, unsigned int i, unsigned int j) {
+    buildVertex(out, i, j, *this);
+  }
+
+  void buildVertex(std::vector<float>& out, unsigned int i, unsigned int j, x_tag) {
+    out.push_back(0.0f);
+    out.push_back(i * yscale_);
+    out.push_back(j * zscale_);
+  }
+
+  void buildVertex(std::vector<float>& out, unsigned int i, unsigned int j, y_tag) {
+    out.push_back(i * xscale_);
+    out.push_back(0.0f);
+    out.push_back(j * zscale_);
+  }
+
+  void buildVertex(std::vector<float>& out, unsigned int i, unsigned int j, z_tag) {
+    out.push_back(i * xscale_);
+    out.push_back(j * yscale_);
+    out.push_back(0.0f);
+  }
+
+  unsigned int adim_, bdim_, cdim_;
+  double xscale_, yscale_, zscale_;
+  mutable int currentCube;
+
+  mutable QOpenGLBuffer vVBO;
+  mutable QOpenGLBuffer cbuffer;
+  mutable QOpenGLBuffer rectBuffer;
+  mutable std::vector<float> v_rec;
+  mutable QOpenGLShaderProgram program_bordures;
+  mutable QOpenGLShaderProgram program;
+  mutable std::vector< std::pair<QOpenGLBuffer, unsigned int> > ebos;
+  std::vector< float > colors_;
+
+  QString name(x_tag) const { return tr("X Slice for %1").arg(name_); }
+  QString name(y_tag) const { return tr("Y Slice for %2").arg(name_); }
+  QString name(z_tag) const { return tr("Z Slice for %2").arg(name_); }
+
+  void drawRectangle(x_tag) const {
+
+
+      v_rec.push_back(0.0f); v_rec.push_back(0.0f); v_rec.push_back(0.0f);
+      v_rec.push_back(0.0f); v_rec.push_back((adim_ - 1) * yscale_); v_rec.push_back(0.0f);
+      v_rec.push_back(0.0f); v_rec.push_back((adim_ - 1) * yscale_); v_rec.push_back((bdim_ - 1) * zscale_);
+      v_rec.push_back(0.0f); v_rec.push_back(0.0f); v_rec.push_back((bdim_ - 1) * zscale_);
+
+  }
+
+  void drawRectangle(y_tag) const {
+      v_rec.push_back(0.0f); v_rec.push_back(0.0f); v_rec.push_back(0.0f);
+      v_rec.push_back((adim_ - 1) * xscale_);v_rec.push_back(0.0f); v_rec.push_back(0.0f);
+      v_rec.push_back((adim_ - 1) * xscale_);v_rec.push_back(0.0f);v_rec.push_back( (bdim_ - 1) * zscale_);
+      v_rec.push_back(0.0f); v_rec.push_back(0.0f); v_rec.push_back((bdim_ - 1) * zscale_);
+  }
+
+  void drawRectangle(z_tag) const {
+      v_rec.push_back(0.0f); v_rec.push_back(0.0f); v_rec.push_back(0.0f);
+      v_rec.push_back((adim_ - 1) * xscale_); v_rec.push_back(0.0f); v_rec.push_back(0.0f);
+      v_rec.push_back((adim_ - 1) * xscale_); v_rec.push_back((bdim_ - 1) * yscale_); v_rec.push_back(0.0f);
+      v_rec.push_back(0.0f); v_rec.push_back((bdim_ - 1) * yscale_); v_rec.push_back(0.0f);
+  }
+
+  qglviewer::Constraint* setConstraint(x_tag) {
+    qglviewer::AxisPlaneConstraint* c = new Length_constraint<0>(cdim_ * xscale_);
+    c->setRotationConstraintType(qglviewer::AxisPlaneConstraint::FORBIDDEN);
+    c->setTranslationConstraint(qglviewer::AxisPlaneConstraint::AXIS, qglviewer::Vec(1.0f, 0.0f, 0.0f));
+    return c;
+  }
+  
+  qglviewer::Constraint* setConstraint(y_tag) {
+    qglviewer::AxisPlaneConstraint* c = new Length_constraint<1>(cdim_ * yscale_);
+    c->setRotationConstraintType(qglviewer::AxisPlaneConstraint::FORBIDDEN);
+    c->setTranslationConstraint(qglviewer::AxisPlaneConstraint::AXIS, qglviewer::Vec(0.0f, 1.0f, 0.0f));
+    return c;
+  }
+
+  qglviewer::Constraint* setConstraint(z_tag) {
+    qglviewer::AxisPlaneConstraint* c = new Length_constraint<2>(cdim_ * zscale_);
+    c->setRotationConstraintType(qglviewer::AxisPlaneConstraint::FORBIDDEN);
+    c->setTranslationConstraint(qglviewer::AxisPlaneConstraint::AXIS, qglviewer::Vec(0.0f, 0.0f, 1.0f));
+    return c;
+  }
+
+  void updateCurrentCube() const { currentCube = getTranslation(); }
+
+  GLdouble getTranslation() const { return getTranslation(*this); }
+  GLdouble getTranslation(x_tag) const { return mFrame_->matrix()[12] / xscale_; }
+  GLdouble getTranslation(y_tag) const { return mFrame_->matrix()[13] / yscale_; }
+  GLdouble getTranslation(z_tag) const { return mFrame_->matrix()[14] / zscale_; }
+
+};
+
+template<typename T>
+const char* Volume_plane<T>::vertexShader_source =
+      "#version 120 \n"
+      "attribute highp vec4 vertex; \n"
+      "attribute highp float color; \n"
+      "uniform highp mat4 mvp_matrix; \n"
+      "uniform highp mat4 f_matrix; \n"
+      "varying highp vec4 fullColor; \n"
+      "void main() \n"
+      "{ gl_Position = mvp_matrix * f_matrix * vertex; \n"
+      " fullColor = vec4(color, color, color, 1.0); } \n";
+
+template<typename T>
+const char* Volume_plane<T>::fragmentShader_source =
+      "#version 120\n"
+      "varying highp vec4 fullColor; \n"
+      "void main() { gl_FragColor = fullColor; } \n";
+
+template<typename T>
+const char* Volume_plane<T>::vertexShader_bordures_source =
+      "#version 120 \n"
+      "attribute highp vec4 vertex; \n"
+      "uniform highp vec4 color; \n"
+      "uniform highp mat4 mvp_matrix; \n"
+      "uniform highp mat4 f_matrix; \n"
+      "varying highp vec4 fullColor; \n"
+      "void main() \n"
+      "{ gl_Position = mvp_matrix * f_matrix * vertex; \n"
+      " fullColor = color; } \n";
+
+template<typename T>
+const char* Volume_plane<T>::fragmentShader_bordures_source =
+      "#version 120\n"
+      "varying highp vec4 fullColor; \n"
+      "void main() { gl_FragColor = fullColor; } \n";
+
+
+
+template<typename T>
+Volume_plane<T>::Volume_plane()
+  : Volume_plane_interface(new qglviewer::ManipulatedFrame)
+ {
+ }
+template<typename T>
+void Volume_plane<T>::setData(unsigned int adim, unsigned int bdim, unsigned int cdim, float xscale, float yscale, float zscale, std::vector<float> &colors)
+{
+ adim_ = adim;
+ bdim_ = bdim;
+ cdim_= cdim;
+ xscale_ = xscale;
+ yscale_ =yscale;
+ zscale_ = zscale;
+ currentCube = 0;
+ colors_.swap(colors);
+ mFrame_->setConstraint(setConstraint(*this));
+}
+template<typename T>
+Volume_plane<T>::~Volume_plane() {
+  for(std::vector< std::pair< QOpenGLBuffer, unsigned int> >::iterator it = ebos.begin();
+      it != ebos.end(); ++it) { 
+      it->first.destroy();
+  }
+  program.release();
+}
+
+template<typename T>
+void Volume_plane<T>::draw(Viewer_interface *viewer) const {
+  updateCurrentCube();
+
+
+
+  GLdouble mat[16];
+  viewer->camera()->getModelViewProjectionMatrix(mat);
+  QMatrix4x4 mvp;
+  QMatrix4x4 f;
+  for(int i=0; i<16; i++)
+  {
+      mvp.data()[i] = (float)mat[i];
+      f.data()[i] = (float)mFrame_->matrix()[i];
+  }
+
+
+  program_bordures.bind();
+  program_bordures.setUniformValue("mvp_matrix", mvp);
+  program_bordures.setUniformValue("f_matrix", f);
+  program_bordures.release();
+  GLint renderMode;
+  glGetIntegerv(GL_RENDER_MODE, &renderMode);
+  printGlError(__LINE__);
+
+
+  glLineWidth(4.0f);
+  v_rec.resize(0);
+  drawRectangle(*this);
+
+  program_bordures.bind();
+  rectBuffer.create();
+  rectBuffer.bind();
+  rectBuffer.allocate(v_rec.data(), static_cast<int>(v_rec.size()*sizeof(float)));
+  program_bordures.setAttributeBuffer("vertex",GL_FLOAT,0,3);
+  program_bordures.enableAttributeArray("vertex");
+  program_bordures.setUniformValue("color",this->color());
+  glDrawArrays(GL_LINE_LOOP, 0, static_cast<GLsizei>(v_rec.size()/3));
+  rectBuffer.release();
+  program_bordures.release();
+  glLineWidth(1.0f);
+
+  program.bind();
+  int mvpLoc = program.uniformLocation("mvp_matrix");
+  int fLoc = program.uniformLocation("f_matrix");
+  program.setUniformValue(mvpLoc, mvp);
+  program.setUniformValue(fLoc, f);
+  vVBO.bind();
+  int vloc = program.attributeLocation("vertex");
+  program.enableAttributeArray(vloc);
+  program.setAttributeBuffer(vloc, GL_FLOAT, 0, 3);
+  vVBO.release();
+
+  cbuffer.bind();
+  int colorLoc = program.attributeLocation("color");
+  program.enableAttributeArray(colorLoc);
+  program.setAttributeBuffer(colorLoc, GL_FLOAT, (currentCube*sizeof(float)) * (bdim_) * (adim_), 1, 0 );
+  cbuffer.release();
+
+
+  printGlError(__LINE__);
+
+ for(unsigned int i = 0; i < ebos.size(); ++i)
+  {
+      ebos[i].first.bind();
+      glDrawElements(GL_TRIANGLES, ebos[i].second, GL_UNSIGNED_INT, 0);
+      ebos[i].first.release();
+  }
+
+  cbuffer.release();
+  printGlError(__LINE__);
+  program.release();
+
+  printGlError(__LINE__);
+}
+
+template<typename T>
+void Volume_plane<T>::init() {
+  
+  initShaders();
+
+  // for each vertex
+  std::vector< float > vertices;
+  vertices.reserve(bdim_ * adim_ * 3);
+  for(unsigned int i = 0; i < adim_; ++i) 
+  {
+    for(unsigned int j = 0; j < bdim_; ++j)
+    {
+      buildVertex(vertices, i, j);
+    }
+  }
+    
+  assert(vertices.size() == (3 * adim_ * bdim_));
+
+  int maxi, maxv;
+  glGetIntegerv(GL_MAX_ELEMENTS_INDICES, &maxi);
+  glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, &maxv);
+  assert((vertices.size( ) / 3) < (unsigned int)maxi);
+  vVBO.create();
+  vVBO.bind();
+  vVBO.allocate(vertices.data(),static_cast<int>(sizeof(float) * vertices.size()));
+  vVBO.release();
+  printGlError(__LINE__);
+
+  // for each patch
+  std::vector<unsigned int> indices;
+  for(unsigned int j = 0; j < adim_ - 1; ++j) {
+    for(unsigned int k = 0; k < bdim_ - 1; ++k) {
+        //0
+        indices.push_back( j * bdim_ + k );
+        assert(indices.back() < (vertices.size() / 3));
+
+        //1
+        indices.push_back( j * bdim_ + (k + 1) );
+        assert(indices.back() < (vertices.size() / 3));
+
+        //3
+        indices.push_back( (j+1) * bdim_ + (k+1) );
+        assert(indices.back() < (vertices.size() / 3));
+
+        //0
+        indices.push_back( j * bdim_ + k );
+        assert(indices.back() < (vertices.size() / 3));
+
+        //3
+        indices.push_back( (j+1) * bdim_ + (k+1) );
+        assert(indices.back() < (vertices.size() / 3));
+
+        //2
+        indices.push_back( (j+1) * bdim_ + (k) );
+        assert(indices.back() < (vertices.size() / 3));
+
+    }
+  }
+
+  assert((indices.size() / 6) == (adim_ - 1) * (bdim_ - 1));
+  //slice must be multiple of 3.
+  const unsigned int slice = 63399;
+  for(unsigned int i = 0; i < indices.size(); i+=slice)
+  {
+    QOpenGLBuffer ebo = QOpenGLBuffer(QOpenGLBuffer::IndexBuffer);
+    unsigned int left_over = (i + slice) > indices.size()  ? std::distance(indices.begin() + i, indices.end()) : slice;
+    ebo.create();
+    ebo.bind();
+    ebo.allocate(&indices[i],static_cast<int>(sizeof(unsigned int) * left_over));
+    ebo.release();
+    ebos.push_back(std::make_pair(ebo, left_over));
+  }
+
+  cbuffer.create();
+  cbuffer.bind();
+  cbuffer.allocate(colors_.data(),static_cast<int>(colors_.size()*sizeof(float)));
+  cbuffer.release();
+
+  printGlError(__LINE__);
+}
+
+template<typename T>
+void Volume_plane<T>::initShaders() {
+  QOpenGLShader *vertex = new QOpenGLShader(QOpenGLShader::Vertex);
+
+  vertex->compileSourceCode(vertexShader_source);
+  QOpenGLShader *fragment= new QOpenGLShader(QOpenGLShader::Fragment);
+  fragment->compileSourceCode(fragmentShader_source);
+  program.addShader(vertex);
+  program.addShader(fragment);
+  program.link();
+
+
+  QOpenGLShader *vertex_bordures = new QOpenGLShader(QOpenGLShader::Vertex);
+
+  vertex_bordures->compileSourceCode(vertexShader_bordures_source);
+  QOpenGLShader *fragment_bordures= new QOpenGLShader(QOpenGLShader::Fragment);
+  fragment_bordures->compileSourceCode(fragmentShader_bordures_source);
+  program_bordures.addShader(vertex_bordures);
+  program_bordures.addShader(fragment_bordures);
+  program_bordures.link();
+}
+
+
+#endif /* CGAL_VOLUME_PLANE_H */
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_interface.h b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_interface.h
new file mode 100644
index 0000000..8d70245
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_interface.h
@@ -0,0 +1,52 @@
+#ifndef CGAL_VOLUME_PLANE_INTERFACE_H_
+#define CGAL_VOLUME_PLANE_INTERFACE_H_
+
+#include <QObject>
+#include <QGLViewer/qglviewer.h>
+#include <CGAL/Three/Scene_item.h>
+#include <iostream>
+#include <QGLViewer/manipulatedFrame.h>
+using namespace CGAL::Three;
+class Volume_plane_interface : public Scene_item {
+Q_OBJECT
+public:
+  Volume_plane_interface(qglviewer::ManipulatedFrame* f) : mFrame_(f) { 
+    connect(mFrame_, SIGNAL(manipulated()), this, SLOT(propagateManipulation()));
+  }
+
+  virtual ~Volume_plane_interface() {
+    delete mFrame_;
+  }
+
+  virtual void init() = 0;
+
+  virtual void setData(unsigned int adim, unsigned int bdim, unsigned int cdim, float xscale, float yscale, float zscale, std::vector<float> &colors) =0;
+  virtual unsigned int aDim() const = 0;
+  virtual unsigned int bDim() const = 0;
+  virtual unsigned int cDim() const = 0;
+  virtual qglviewer::Vec translationVector() const = 0;
+  void itemAboutToBeDestroyed(CGAL::Three::Scene_item* item) {
+    if(this == item) {
+      Q_EMIT planeDestructionIncoming(this);
+      Q_EMIT aboutToBeDestroyed();
+    }
+  }
+
+  virtual unsigned int getCurrentCube() const = 0;
+
+  virtual qglviewer::ManipulatedFrame* manipulatedFrame() { return mFrame_; }
+
+Q_SIGNALS:
+  void planeDestructionIncoming(Volume_plane_interface*);
+  void manipulated(int);
+private Q_SLOTS:
+  void propagateManipulation() {
+    Q_EMIT manipulated(getCurrentCube());
+  }
+protected:
+  qglviewer::ManipulatedFrame* mFrame_;
+};
+
+
+#endif /* CGAL_VOLUME_PLANE_INTERFACE_H_ */
+
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_intersection.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_intersection.cpp
new file mode 100644
index 0000000..afebeed
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_intersection.cpp
@@ -0,0 +1,198 @@
+#include "config.h"
+
+#include "Volume_plane_intersection.h"
+#include "Volume_plane_interface.h"
+
+#include <QApplication>
+#include <CGAL/gl.h>
+struct Volume_plane_intersection_priv
+{
+  Volume_plane_intersection_priv(float x, float y, float z, Volume_plane_intersection* parent)
+    : a(NULL), b(NULL), c(NULL), x(x), y(y), z(z) , item(parent)
+  {
+    item->are_buffers_filled = false;
+  }
+  Volume_plane_interface *a, *b, *c;
+  float x, y, z;
+
+  enum VAOs{
+    AArray = 0,
+    BArray,
+    CArray,
+    NumberOfVaos
+  };
+  enum VBOs{
+    AVertex = 0,
+    BVertex,
+    CVertex,
+    NumberOfVbos
+  };
+  std::vector<float> a_vertex;
+  std::vector<float> b_vertex;
+  std::vector<float> c_vertex;
+  mutable QOpenGLShaderProgram *program;
+  void computeElements();
+  void initializeBuffers(Viewer_interface*)const;
+  void attribBuffers(Viewer_interface*) const;
+  Volume_plane_intersection* item;
+};
+
+
+Volume_plane_intersection::~Volume_plane_intersection()
+{
+  delete d;
+}
+
+void Volume_plane_intersection_priv::computeElements()
+{
+   QApplication::setOverrideCursor(Qt::WaitCursor);
+   a_vertex.resize(0);
+   b_vertex.resize(0);
+   c_vertex.resize(0);
+
+   a_vertex.push_back(0.0); a_vertex.push_back(0.0); a_vertex.push_back(0.0);
+   a_vertex.push_back(x);   a_vertex.push_back(0.0); a_vertex.push_back(0.0);
+
+   b_vertex.push_back(0.0); b_vertex.push_back(0.0); b_vertex.push_back(0.0);
+   b_vertex.push_back(0.0); b_vertex.push_back(y);   b_vertex.push_back(0.0);
+
+   c_vertex.push_back(0.0); c_vertex.push_back(0.0); c_vertex.push_back(0.0);
+   c_vertex.push_back(0.0); c_vertex.push_back(0.0); c_vertex.push_back(z);
+
+   item->_bbox =  Scene_item::Bbox( 0, 0, 0,
+                  x, y, z);
+   QApplication::restoreOverrideCursor();
+}
+
+void Volume_plane_intersection_priv::initializeBuffers(Viewer_interface* viewer)const
+{
+  program = item->getShaderProgram(Volume_plane_intersection::PROGRAM_NO_SELECTION, viewer);
+  program->bind();
+  item->vaos[AArray]->bind();
+  item->buffers[AVertex].bind();
+  item->buffers[AVertex].allocate(a_vertex.data(), static_cast<int>(a_vertex.size()*sizeof(float)));
+  program->enableAttributeArray("vertex");
+  program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
+  item->buffers[AVertex].release();
+  item->vaos[AArray]->release();
+
+  item->vaos[BArray]->bind();
+  item->buffers[BVertex].bind();
+  item->buffers[BVertex].allocate(b_vertex.data(), static_cast<int>(b_vertex.size()*sizeof(float)));
+  program->enableAttributeArray("vertex");
+  program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
+  item->buffers[BVertex].release();
+  item->vaos[BArray]->release();
+
+  item->vaos[CArray]->bind();
+  item->buffers[CVertex].bind();
+  item->buffers[CVertex].allocate(c_vertex.data(), static_cast<int>(c_vertex.size()*sizeof(float)));
+  program->enableAttributeArray("vertex");
+  program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
+  item->buffers[CVertex].release();
+  item->vaos[CArray]->release();
+
+  program->release();
+  item->are_buffers_filled = true;
+
+}
+
+void Volume_plane_intersection::draw(Viewer_interface* viewer) const {
+  viewer->glLineWidth(4.0f);
+  if(!are_buffers_filled)
+  {
+    d->computeElements();
+    d->initializeBuffers(viewer);
+  }
+  attribBuffers(viewer, PROGRAM_NO_SELECTION);
+  glDepthRange(0.0,0.9999);
+  if(d->b && d->c) {
+
+    vaos[Volume_plane_intersection_priv::AArray]->bind();
+    d->program->bind();
+    GLdouble mat[16];
+    d->b->manipulatedFrame()->getMatrix(mat);
+    QMatrix4x4 b_mat, c_mat;
+    for(int i=0; i<16; i++)
+    {
+       b_mat.data()[i] = (float)mat[i];
+    }
+    d->c->manipulatedFrame()->getMatrix(mat);
+    for(int i=0; i<16; i++)
+    {
+       c_mat.data()[i] = (float)mat[i];
+    }
+    d->program->setUniformValue("f_matrix", b_mat*c_mat);
+    d->program->setAttributeValue("colors", this->color());
+    viewer->glDrawArrays(GL_LINES, 0, 2);
+    d->program->release();
+    vaos[Volume_plane_intersection_priv::AArray]->release();
+  }
+
+  if(d->a && d->c) {
+      vaos[Volume_plane_intersection_priv::BArray]->bind();
+      d->program->bind();
+      GLdouble mat[16];
+      d->a->manipulatedFrame()->getMatrix(mat);
+      QMatrix4x4 a_mat, c_mat;
+      for(int i=0; i<16; i++)
+      {
+         a_mat.data()[i] = (float)mat[i];
+      }
+      d->c->manipulatedFrame()->getMatrix(mat);
+      for(int i=0; i<16; i++)
+      {
+         c_mat.data()[i] = (float)mat[i];
+      }
+      d->program->setUniformValue("f_matrix", a_mat*c_mat);
+      d->program->setAttributeValue("colors", this->color());
+      viewer->glDrawArrays(GL_LINES, 0, 2);
+      d->program->release();
+      vaos[Volume_plane_intersection_priv::BArray]->release();
+  }
+
+  if(d->a && d->b) {
+      vaos[Volume_plane_intersection_priv::CArray]->bind();
+      d->program->bind();
+      GLdouble mat[16];
+      d->a->manipulatedFrame()->getMatrix(mat);
+      QMatrix4x4 a_mat, b_mat;
+      for(int i=0; i<16; i++)
+      {
+         a_mat.data()[i] = (float)mat[i];
+      }
+      d->b->manipulatedFrame()->getMatrix(mat);
+      for(int i=0; i<16; i++)
+      {
+         b_mat.data()[i] = (float)mat[i];
+      }
+      d->program->setUniformValue("f_matrix", a_mat*b_mat);
+      d->program->setAttributeValue("colors", this->color());
+      viewer->glDrawArrays(GL_LINES, 0, 2);
+      d->program->release();
+      vaos[Volume_plane_intersection_priv::CArray]->release();
+  }
+  viewer->glLineWidth(1.0f);
+  glDepthRange(0.00001,1.0);
+}
+
+Volume_plane_intersection::Volume_plane_intersection(float x, float y, float z)
+  :Scene_item(Volume_plane_intersection_priv::NumberOfVbos, Volume_plane_intersection_priv::NumberOfVaos),
+    d(new Volume_plane_intersection_priv(x,y,z,this))
+{
+  setColor(QColor(255, 0, 0));
+  setName("Volume plane intersection");
+}
+
+void Volume_plane_intersection::setX(Volume_plane_interface* x) { d->a = x; }
+void Volume_plane_intersection::setY(Volume_plane_interface* x) { d->b = x; }
+void Volume_plane_intersection::setZ(Volume_plane_interface* x) { d->c = x; }
+void Volume_plane_intersection::planeRemoved(Volume_plane_interface* i) {
+  if(d->a == i) {
+    d->a = NULL;
+  } else if(d->b == i) {
+    d->b = NULL;
+  } else if(d->c == i) {
+    d->c = NULL;
+  }
+}
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_intersection.h b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_intersection.h
new file mode 100644
index 0000000..0b22c30
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_intersection.h
@@ -0,0 +1,45 @@
+#ifndef CGAL_VOLUME_PLANE_INTERSECTION_H_
+#define CGAL_VOLUME_PLANE_INTERSECTION_H_
+
+#include <CGAL/Three/Scene_item.h>
+
+#include <QColor>
+#include <QString>
+#include <QGLViewer/qglviewer.h>
+#include <QOpenGLVertexArrayObject>
+#include <QOpenGLBuffer>
+#include <QOpenGLShaderProgram>
+#include <CGAL/Three/Viewer_interface.h>
+using namespace CGAL::Three;
+class Volume_plane_interface;
+struct Volume_plane_intersection_priv;
+class Volume_plane_intersection
+  : public Scene_item {
+  typedef std::pair<Volume_plane_interface*, Volume_plane_interface*> Interface_pair;
+Q_OBJECT
+public:
+  Volume_plane_intersection(float x, float y, float z);
+  ~Volume_plane_intersection();
+
+  bool isFinite() const { return true; }
+  bool isEmpty() const { return false; }
+  bool manipulatable() const { return false; }
+  Volume_plane_intersection* clone() const { return 0; }
+  bool supportsRenderingMode(RenderingMode) const { return true; }
+  QString toolTip() const { return "Tooling"; }
+
+  void draw(Viewer_interface*)const;
+
+  void setX(Volume_plane_interface* x);
+  void setY(Volume_plane_interface* x);
+  void setZ(Volume_plane_interface* x);
+
+public Q_SLOTS:
+  void planeRemoved(Volume_plane_interface* i);
+protected:
+  friend struct Volume_plane_intersection_priv;
+  Volume_plane_intersection_priv *d;
+};
+
+#endif /* CGAL_VOLUME_PLANE_INTERSECTION_H_ */
+
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_thread.h b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_thread.h
new file mode 100644
index 0000000..5c3c14e
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_thread.h
@@ -0,0 +1,132 @@
+#ifndef CGAL_VOLUME_PLANE_THREAD_H
+#define CGAL_VOLUME_PLANE_THREAD_H
+
+#include "Volume_plane.h"
+#include <CGAL/Image_3.h>
+
+#include "Scene_image_item.h"
+
+#include <QApplication>
+#include <QThread>
+#include <vector>
+
+struct Clamp_to_one_zero_range {
+  std::pair<float, float> min_max;
+  float operator()(const float& inVal) {
+    float inValNorm = inVal - min_max.first;
+    float aUpperNorm = min_max.second - min_max.first;
+    float bValNorm = inValNorm / aUpperNorm;
+    return bValNorm;
+  }
+};
+
+class Volume_plane_thread : public QThread {
+Q_OBJECT  
+public:
+  Volume_plane_thread(const CGAL::Image_3* img, const Clamp_to_one_zero_range& clamp, const QString& name)
+    : img(img), clamper(clamp), item(NULL), name(name) { _type = 'n';}
+
+  Volume_plane_interface* getItem() {
+    return item;
+  }
+  char type()const{
+    return _type;
+  }
+
+Q_SIGNALS:
+  void finished(Volume_plane_thread*);
+
+protected:
+  const CGAL::Image_3* img;
+  Clamp_to_one_zero_range clamper;
+  Volume_plane_interface* item;
+  std::vector<float> buffer;
+  QString name;
+  char _type;
+};
+
+template<typename Word>
+class X_plane_thread : public Volume_plane_thread {
+public:
+ X_plane_thread(Volume_plane<x_tag>*p_it, const CGAL::Image_3* img, const Clamp_to_one_zero_range& clamp, const QString& name)
+  : Volume_plane_thread(img, clamp, name) { item = p_it; _type = 'x';}
+protected:
+  void run();
+};
+
+template<typename Word>
+class Y_plane_thread : public Volume_plane_thread {
+public:
+ Y_plane_thread(Volume_plane<y_tag>* p_it, const CGAL::Image_3* img, const Clamp_to_one_zero_range& clamp, const QString& name)
+  : Volume_plane_thread(img, clamp, name) {item = p_it; _type = 'y';}
+protected:
+  void run();
+};
+
+template<typename Word>
+class Z_plane_thread : public Volume_plane_thread {
+public:
+ Z_plane_thread(Volume_plane<z_tag>* p_it, const CGAL::Image_3* img, const Clamp_to_one_zero_range& clamp, const QString& name)
+  : Volume_plane_thread(img, clamp, name) {item = p_it; _type = 'z';}
+protected:
+  void run();
+};
+
+template<typename Word>
+void X_plane_thread<Word>::run() {
+    buffer.reserve(img->size());
+    for(unsigned int i = 0; i < img->xdim(); ++i) {
+      for(unsigned int j = 0; j < img->ydim(); ++j) {
+        for(unsigned int k = 0; k < img->zdim(); ++k) {
+          float x = CGAL::IMAGEIO::static_evaluate<Word>(img->image(), i, j, k);
+          x = clamper(x);
+          buffer.push_back(x);
+        }
+      }
+    }
+    item->setData(static_cast<int>(img->ydim()), static_cast<int>(img->zdim()), static_cast<int>(img->xdim()),
+                         img->vx(), img->vy(), img->vz(), buffer);
+
+    item->setName(name);
+    item->moveToThread(QApplication::instance()->thread());
+    Q_EMIT finished(this);
+}
+
+template<typename Word>
+void Y_plane_thread<Word>::run() {
+      buffer.reserve(img->size());
+    for(unsigned int i = 0; i < img->ydim(); ++i) {
+      for(unsigned int j = 0; j < img->xdim(); ++j) {
+        for(unsigned int k = 0; k < img->zdim(); ++k) {
+          float x = CGAL::IMAGEIO::static_evaluate<Word>(img->image(), j, i, k);
+          x = clamper(x);
+          buffer.push_back(x);
+        }
+      }
+    }
+    item->setData(static_cast<int>(img->xdim()), static_cast<int>(img->zdim()), static_cast<int>(img->ydim()),
+                                   img->vx(), img->vy(), img->vz(), buffer);
+    item->setName(name);
+    item->moveToThread(QApplication::instance()->thread());
+    Q_EMIT finished(this);
+}
+
+template<typename Word>
+void Z_plane_thread<Word>::run() {
+  for(unsigned int i = 0; i < img->zdim(); ++i) {
+    for(unsigned int j = 0; j < img->xdim(); ++j) {
+      for(unsigned int k = 0; k < img->ydim(); ++k) {
+        float x = CGAL::IMAGEIO::static_evaluate<Word>(img->image(), j, k, i);
+        x = clamper(x);
+        buffer.push_back(x);
+      }
+    }
+  }
+  item->setData(static_cast<int>(img->xdim()), static_cast<int>(img->ydim()), static_cast<int>(img->zdim()),
+                                 img->vx(), img->vy(), img->vz(), buffer);
+  item->setName(name);
+  item->moveToThread(QApplication::instance()->thread());
+  Q_EMIT finished(this);
+}
+
+#endif /* CGAL_VOLUME_PLANE_THREAD_H */
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/config_mesh_3.h b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/config_mesh_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/config_mesh_3.h
rename to 3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/config_mesh_3.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/raw_image.ui b/3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/raw_image.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Mesh_3/raw_image.ui
rename to 3rdparty/CGAL/demo/Polyhedron/Plugins/Mesh_3/raw_image.ui
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Operations_on_polyhedra/CMakeLists.txt b/3rdparty/CGAL/demo/Polyhedron/Plugins/Operations_on_polyhedra/CMakeLists.txt
new file mode 100644
index 0000000..fe820f4
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Operations_on_polyhedra/CMakeLists.txt
@@ -0,0 +1,10 @@
+include( polyhedron_demo_macros )
+ qt5_wrap_ui( clip_polyhedronUI_FILES Clip_polyhedron_plugin.ui )
+ polyhedron_demo_plugin(clip_polyhedron_plugin Clip_polyhedron_plugin ${clip_polyhedronUI_FILES})
+ target_link_libraries(clip_polyhedron_plugin  scene_polyhedron_item scene_basic_objects)
+ polyhedron_demo_plugin(corefinement_plugin Corefinement_plugin)
+ target_link_libraries(corefinement_plugin  scene_polyhedron_item scene_combinatorial_map_item scene_polylines_item)
+ polyhedron_demo_plugin(intersection_plugin Intersection_plugin)
+ target_link_libraries(intersection_plugin  scene_polyhedron_item scene_polylines_item)
+ polyhedron_demo_plugin(point_set_from_vertices_plugin Point_set_from_vertices_plugin)
+ target_link_libraries(point_set_from_vertices_plugin scene_polyhedron_item scene_polygon_soup_item scene_points_with_normal_item)
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.cpp
new file mode 100644
index 0000000..060bf93
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.cpp
@@ -0,0 +1,297 @@
+#include "Messages_interface.h"
+#include <QApplication>
+#include <QMainWindow>
+#include <QAction>
+#include <QVector>
+#include "Scene_polyhedron_item.h"
+#include "Scene_plane_item.h"
+#include <CGAL/Three/Viewer_interface.h>
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+#include <CGAL/internal/Polyhedron_plane_clipping_3.h>
+#include "ui_Clip_polyhedron_plugin.h"
+#include "Viewer.h"
+
+
+using namespace CGAL::Three;
+// The special 2 faces plane
+class Scene_clipping_plane_item : public Scene_plane_item
+{
+  Q_OBJECT
+
+public:
+  Scene_clipping_plane_item(const CGAL::Three::Scene_interface* scene_interface)
+    :Scene_plane_item(scene_interface)
+  {
+  }
+
+  void draw(CGAL::Three::Viewer_interface* viewer)const
+  {
+    if(!are_buffers_filled)
+      initializeBuffers(viewer);
+    vaos[Facets]->bind();
+    program = getShaderProgram(PROGRAM_PLANE_TWO_FACES);
+    attribBuffers(viewer, PROGRAM_PLANE_TWO_FACES);
+    QMatrix4x4 f_matrix;
+    for(int i=0; i<16; i++)
+      f_matrix.data()[i] = (float)frame->matrix()[i];
+    program->bind();
+    program->setUniformValue("f_matrix", f_matrix);
+    program->setAttributeValue("colors",this->color());
+    QVector3D normal;
+    normal.setX(plane().orthogonal_vector().x());normal.setY(plane().orthogonal_vector().y());normal.setZ(plane().orthogonal_vector().z());
+    program->setUniformValue("plane_normal", normal);
+    QVector3D vd;
+    vd.setX(viewer->camera()->position().x); vd.setY(viewer->camera()->position().y); vd.setZ(viewer->camera()->position().z);
+    program->setUniformValue("dirView", vd);
+    QVector3D pp;
+    pp.setX(plane().point().x());pp.setY(plane().point().y());pp.setZ(plane().point().z());
+    program->setUniformValue("plane_pos", pp);
+
+    viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(positions_quad.size()/3));
+    program->release();
+    vaos[Facets]->release();
+  }
+  void selection_changed(bool b){is_selected = b;}
+
+private:
+  void initializeBuffers(CGAL::Three::Viewer_interface *viewer) const
+  {
+    program = getShaderProgram(PROGRAM_PLANE_TWO_FACES, viewer);
+    program->bind();
+    vaos[Facets]->bind();
+
+    buffers[Facets_vertices].bind();
+    buffers[Facets_vertices].allocate(positions_quad.data(),
+                                      static_cast<int>(positions_quad.size()*sizeof(float)));
+    program->enableAttributeArray("vertex");
+    program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
+    buffers[Facets_vertices].release();
+    vaos[Facets]->release();
+
+
+    vaos[Edges]->bind();
+    buffers[Edges_vertices].bind();
+    buffers[Edges_vertices].allocate(positions_lines.data(),
+                                     static_cast<int>(positions_lines.size()*sizeof(float)));
+    program->enableAttributeArray("vertex");
+    program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
+    buffers[Edges_vertices].release();
+    vaos[Edges]->release();
+
+    program->release();
+    are_buffers_filled = true;
+
+  }
+}; //end of class Scene_triangle_item
+
+
+class Q_DECL_EXPORT Clip_polyhedron_plugin :
+    public QObject,
+    public CGAL::Three::Polyhedron_demo_plugin_interface
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+public :
+  // Adds an action to the menu and configures the widget
+  void init(QMainWindow* mw,
+            CGAL::Three::Scene_interface* scene_interface,
+            Messages_interface* mi) {
+    //get the references
+    this->scene = scene_interface;
+    this->messages = mi;
+    plane = NULL;
+    //creates and link the actions
+    actionClipPolyhedra = new QAction("Clip Polyhedra", mw);
+    actionClipPolyhedra->setProperty("subMenuName","Operations on Polyhedra");
+    dock_widget = new QDockWidget("Polyhedra Clipping", mw);
+    dock_widget->setVisible(false); // do not show at the beginning
+    ui_widget.setupUi(dock_widget);
+    mw->addDockWidget(Qt::LeftDockWidgetArea, dock_widget);
+
+    if(actionClipPolyhedra ) {
+      connect(actionClipPolyhedra , SIGNAL(triggered()),
+              this, SLOT(pop_widget()));
+      connect(ui_widget.clipButton, SIGNAL(clicked()),
+              this, SLOT(clip_polyhedron()));
+    }
+  }
+  bool applicable(QAction*) const
+  {
+    Q_FOREACH(int id, scene->selectionIndices())
+    {
+      if(qobject_cast<Scene_polyhedron_item*>(scene->item(id)))
+        return true;
+    }
+    return false;
+  }
+  QList<QAction*> actions() const {
+    return QList<QAction*>() << actionClipPolyhedra;
+  }
+  void closure() {
+    dock_widget->hide();
+  }
+public Q_SLOTS:
+  void on_plane_destroyed()
+  {
+    plane = NULL;
+    dock_widget->hide();
+  }
+  void pop_widget()
+  {
+    if(dock_widget->isVisible()) { dock_widget->hide(); }
+    else                         { dock_widget->show(); }
+
+    //creates a new  cutting_plane;
+    if(!plane)
+    {
+      const Scene_interface::Bbox scene_bbox = scene->bbox();
+      plane = new Scene_clipping_plane_item(scene);
+      plane->setNormal(0., 0., 1.);
+      plane->setPosition((scene_bbox.xmin() + scene_bbox.xmax())/2.,
+                         (scene_bbox.ymin() + scene_bbox.ymax())/2.,
+                         (scene_bbox.zmin() + scene_bbox.zmax())/2.);
+      plane->setManipulatable(true);
+      plane->setClonable(false);
+      plane->setColor(QColor(0,126,255));
+      plane->setFlatMode();
+      plane->setName(tr("Clipping plane"));
+      connect(plane, SIGNAL(destroyed()),
+              this, SLOT(on_plane_destroyed()));
+      connect(ui_widget.flip_Button, SIGNAL(clicked()),
+              plane, SLOT(flipPlane()));
+      scene->addItem(plane);
+    }
+  }
+  void clip_polyhedron()
+  {
+    if(!plane)
+      return;
+    else
+    {
+      QApplication::setOverrideCursor(Qt::WaitCursor);
+      QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
+      QList<Scene_polyhedron_item*> polyhedra;
+
+      //Fills the list of target polyhedra and the cutting plane
+      Q_FOREACH(int id, scene->selectionIndices())
+      {
+        Scene_polyhedron_item *target_item = qobject_cast<Scene_polyhedron_item*>(scene->item(id));
+        if(target_item)
+        {
+          polyhedra << target_item;
+        }
+      }
+
+      //apply the clipping function
+      Q_FOREACH(Scene_polyhedron_item* poly, polyhedra)
+      {
+
+        if(ui_widget.close_checkBox->isChecked() && poly->polyhedron()->is_closed())
+        {
+          std::pair<Polyhedron*, Polyhedron*>polyhedron;
+          if(ui_widget.clip_radioButton->isChecked())
+          {
+            polyhedron.first = CGAL::corefinement::clip_polyhedron(*(poly->polyhedron()),plane->plane());
+            polyhedron.second = NULL;
+          }
+          else
+          {
+            polyhedron = CGAL::corefinement::split_polyhedron(*(poly->polyhedron()),plane->plane());
+          }
+          if(polyhedron.first != NULL)
+          {
+            Scene_polyhedron_item* new_item = new Scene_polyhedron_item(polyhedron.first);
+            if(polyhedron.second != NULL)
+              new_item->setName(QString("%1 %2").arg(poly->name()).arg("1"));
+            else
+              new_item->setName(poly->name());
+            new_item->setColor(poly->color());
+            new_item->setRenderingMode(poly->renderingMode());
+            new_item->setVisible(poly->visible());
+            new_item->invalidateOpenGLBuffers();
+            new_item->setProperty("source filename", poly->property("source filename"));
+            scene->replaceItem(scene->item_id(poly),new_item);
+            new_item->invalidateOpenGLBuffers();
+            viewer->updateGL();
+            if(ui_widget.clip_radioButton->isChecked())
+              messages->information(QString("%1 clipped").arg(new_item->name()));
+          }
+          else
+          {
+            messages->information(QString("Could not clip %1 : returned polyhedron is null.").arg(poly->name()));
+            delete polyhedron.first;
+          }
+          if(polyhedron.second!= NULL)
+          {
+            Scene_polyhedron_item* new_item = new Scene_polyhedron_item(polyhedron.second);
+            new_item->setName(QString("%1 %2").arg(poly->name()).arg("2"));
+            new_item->setColor(poly->color());
+            new_item->setRenderingMode(poly->renderingMode());
+            new_item->setVisible(poly->visible());
+            new_item->invalidateOpenGLBuffers();
+            new_item->setProperty("source filename", poly->property("source filename"));
+            scene->addItem(new_item);
+            new_item->invalidateOpenGLBuffers();
+            viewer->updateGL();
+            if(!ui_widget.clip_radioButton->isChecked())
+            messages->information(QString("%1 splitted").arg(poly->name()));
+          }
+          if(polyhedron.first != NULL)
+            delete poly;
+        }
+
+        else
+        {
+          Scene_polyhedron_item* poly1 = new Scene_polyhedron_item(*(poly->polyhedron()));
+          poly1->setProperty("source filename", poly->property("source filename"));
+          Scene_polyhedron_item* poly2 = NULL;
+          if(!ui_widget.clip_radioButton->isChecked())
+          {
+            poly2 = new Scene_polyhedron_item(*(poly->polyhedron()));
+            poly2->setProperty("source filename", poly->property("source filename"));
+          }
+
+
+            CGAL::corefinement::inplace_clip_open_polyhedron(*(poly1->polyhedron()),plane->plane());
+            if(poly2 != NULL)
+              poly1->setName(QString("%1 %2").arg(poly->name()).arg("1"));
+            else
+              poly1->setName(poly->name());
+            poly1->setColor(poly->color());
+            poly1->setRenderingMode(poly->renderingMode());
+            poly1->setVisible(poly->visible());
+            scene->replaceItem(scene->item_id(poly),poly1);
+            poly1->invalidateOpenGLBuffers();
+            viewer->updateGL();
+            if(ui_widget.clip_radioButton->isChecked())
+              messages->information(QString("%1 clipped").arg(poly->name()));
+
+          if(poly2 != NULL)
+          {
+            CGAL::corefinement::inplace_clip_open_polyhedron(*(poly2->polyhedron()),plane->plane().opposite());
+            poly2->setName(QString("%1 %2").arg(poly->name()).arg("2"));
+            poly2->setColor(poly->color());
+            poly2->setRenderingMode(poly->renderingMode());
+            poly2->setVisible(poly->visible());
+            scene->addItem(poly2);
+            poly2->invalidateOpenGLBuffers();
+            viewer->updateGL();
+            messages->information(QString("%1 splitted").arg(poly->name()));
+          }
+          delete poly;
+        }
+      }
+    }
+    QApplication::restoreOverrideCursor();
+  }
+private:
+  QAction* actionClipPolyhedra;
+  Ui::ClipPolyhedronWidget ui_widget;
+  QDockWidget* dock_widget;
+  Scene_clipping_plane_item* plane;
+  Messages_interface* messages;
+  Scene_interface* scene;
+}; //end of plugin class
+#include "Clip_polyhedron_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.ui b/3rdparty/CGAL/demo/Polyhedron/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.ui
new file mode 100644
index 0000000..d849b58
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.ui
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ClipPolyhedronWidget</class>
+ <widget class="QDockWidget" name="ClipPolyhedronWidget">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>312</width>
+    <height>307</height>
+   </rect>
+  </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="windowTitle">
+   <string>Clip Polyhedra</string>
+  </property>
+  <widget class="QWidget" name="dockWidgetContents">
+   <layout class="QVBoxLayout" name="verticalLayout_2">
+    <item>
+     <layout class="QVBoxLayout" name="verticalLayout">
+      <item>
+       <widget class="QLabel" name="label">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="text">
+         <string><html><head/><body><p>This function allows to clip all the selected polyhedra against a halfspace. What is on the blue side of the clipping plane will be clipped, and what is on the yellow side will be kept.<br/><br/>If the option <span style=" font-style:italic;">keep closed</span> is checked, the clipped part of each polyhedron will be closed, if it has a closed contour on the clipping plane. Otherwise, it will  [...]
+        </property>
+        <property name="wordWrap">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QGroupBox" name="groupBox">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="title">
+         <string>Behavior</string>
+        </property>
+        <layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0,0,0,0" columnstretch="1,0">
+         <item row="4" column="1">
+          <widget class="QPushButton" name="flip_Button">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="text">
+            <string>Flip plane</string>
+           </property>
+          </widget>
+         </item>
+         <item row="0" column="1">
+          <widget class="QRadioButton" name="split_radioButton">
+           <property name="text">
+            <string>Split</string>
+           </property>
+          </widget>
+         </item>
+         <item row="0" column="0">
+          <widget class="QRadioButton" name="clip_radioButton">
+           <property name="text">
+            <string>Clip</string>
+           </property>
+           <property name="checked">
+            <bool>true</bool>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="1">
+          <widget class="QPushButton" name="clipButton">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="text">
+            <string>&Apply</string>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="0">
+          <widget class="QCheckBox" name="close_checkBox">
+           <property name="layoutDirection">
+            <enum>Qt::LeftToRight</enum>
+           </property>
+           <property name="autoFillBackground">
+            <bool>false</bool>
+           </property>
+           <property name="text">
+            <string>&Keep Closed</string>
+           </property>
+          </widget>
+         </item>
+         <item row="5" column="1">
+          <spacer name="verticalSpacer">
+           <property name="orientation">
+            <enum>Qt::Vertical</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>20</width>
+             <height>40</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+        </layout>
+       </widget>
+      </item>
+     </layout>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Operations_on_polyhedra/Corefinement_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Operations_on_polyhedra/Corefinement_plugin.cpp
new file mode 100644
index 0000000..085d5f6
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Operations_on_polyhedra/Corefinement_plugin.cpp
@@ -0,0 +1,180 @@
+#define CGAL_COREFINEMENT_DO_REPORT_SELF_INTERSECTIONS
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+#include <CGAL/corefinement_operations.h>
+#include <CGAL/bounding_box.h>
+#include "Scene_polyhedron_item.h"
+#include "Scene_combinatorial_map_item.h"
+#include "Polyhedron_type.h"
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+
+#include "Scene_polylines_item.h"
+
+#include <QString>
+#include <QAction>
+#include <QMenu>
+#include <QMainWindow>
+#include <QApplication>
+#include <QTime>
+#include <QMessageBox>
+
+//#define PRINT_EACH_VOLUME
+using namespace CGAL::Three;
+class Polyhedron_demo_corefinement_plugin :
+  public QObject,
+  public Polyhedron_demo_plugin_interface
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+public:
+
+  bool applicable(QAction*) const { 
+    return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
+  }
+
+  QList<QAction*> actions() const {
+    return QList<QAction*>() << actionPolyhedronCorefinement_3;
+  }
+
+  void init(QMainWindow* mw, CGAL::Three::Scene_interface* scene_interface, Messages_interface*) {
+    this->scene = scene_interface;
+    actionPolyhedronCorefinement_3 = new QAction("Polyhedra Corefinement (A/B)", mw);
+    actionPolyhedronCorefinement_3->setProperty("subMenuName", "Operations on Polyhedra");
+    if(actionPolyhedronCorefinement_3) {
+      connect(actionPolyhedronCorefinement_3, SIGNAL(triggered()),
+              this, SLOT(corefinement()));
+    }
+  }
+
+private:
+
+  QAction*  actionPolyhedronCorefinement_3;
+  Scene_interface *scene;
+
+public Q_SLOTS:
+  void corefinement();
+
+}; // end class Polyhedron_demo_corefinement_plugin
+
+
+struct Is_on_polyline{
+  bool operator()(Polyhedron::Halfedge_handle he) const { 
+    return he->is_feature_edge();
+  }
+};
+
+struct Set_vertex_corner{
+  template <typename Info>
+  void add_info_to_node(int, Polyhedron*,const Info&) {
+  }
+
+  void operator()(Polyhedron::Vertex_handle v, int, Polyhedron*) {
+    ++v->nb_of_feature_edges;
+  }
+};
+
+void Polyhedron_demo_corefinement_plugin::corefinement()
+{
+  int indexA = scene->selectionAindex();
+  int indexB = scene->selectionBindex();
+
+  Scene_polyhedron_item* itemA = 
+    qobject_cast<Scene_polyhedron_item*>(scene->item(indexA));
+  Scene_polyhedron_item* itemB = 
+    qobject_cast<Scene_polyhedron_item*>(scene->item(indexB));
+  if(!itemA || !itemB || itemA == itemB)
+  {
+    Q_FOREACH(int index, scene->selectionIndices()) {
+      Scene_polyhedron_item* item = 
+        qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+      if(!item)
+        return;
+    }
+    if(scene->selectionIndices().size() == 2) {
+      indexA = scene->selectionIndices()[0];
+      indexB = scene->selectionIndices()[1];
+      itemA = 
+        qobject_cast<Scene_polyhedron_item*>(scene->item(indexA));
+      itemB = 
+        qobject_cast<Scene_polyhedron_item*>(scene->item(indexB));
+    }
+  }
+  std::vector<Polyhedron*> poly_ptrs;
+  Q_FOREACH(int index, scene->selectionIndices()) {
+    Scene_polyhedron_item* item = 
+      qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+    if(!item)
+      return;
+    else if(item != itemA) {
+      poly_ptrs.push_back(item->polyhedron());
+      if(poly_ptrs.back() == 0) return;
+    }
+  }
+
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+
+  if(itemA && itemB && itemA != itemB) {
+  
+   // perform Boolean operation
+    QTime time;
+    time.start();
+
+    //since the visitor modify input polyhedra, we make copies.
+    Polyhedron A( *itemA->polyhedron() );
+    Polyhedron B( *itemB->polyhedron() );
+    
+    itemA->setVisible(false);
+    itemB->setVisible(false);
+    
+    Scene_polylines_item* new_item = new Scene_polylines_item();
+    
+  #ifdef _COREFINEMENT_OUTPUT_IS_POLYHEDRON
+    typedef CGAL::Polyhedron_corefinement<Polyhedron> Corefinement;
+    Corefinement corefinement;
+
+    typedef std::list<std::pair<Polyhedron*,int> > Decomposition;
+    Decomposition decomposition;
+    
+    #ifndef PRINT_EACH_VOLUME
+    int features=Corefinement::Join_tag+Corefinement::Intersection_tag+Corefinement::P_minus_Q_tag+Corefinement::Q_minus_P_tag;
+    #else
+    int features=Corefinement::Decomposition_tag;
+    #endif
+    corefinement(A, B, std::back_inserter(new_item->polylines),std::back_inserter(decomposition),features);
+    
+    
+    for (Decomposition::iterator it=decomposition.begin();it!=decomposition.end();++it)
+    {
+      Polyhedron* new_poly=it->first;
+      Scene_polyhedron_item* new_item_bool= new Scene_polyhedron_item(new_poly);
+      new_item_bool->setName(
+        QString::fromStdString(
+          corefinement.get_type_str(itemA->name().toStdString(),itemB->name().toStdString(),it->second)
+        )
+      );
+      scene->addItem(new_item_bool);
+    }
+  #else  
+    Scene_combinatorial_map_item* cmap_item = new Scene_combinatorial_map_item(scene,static_cast<void*>(&A)); 
+    typedef CGAL::Node_visitor_refine_polyhedra<Polyhedron> Split_visitor; 
+    cmap_item->m_combinatorial_map=new Combinatorial_map_3();
+    Split_visitor visitor(cmap_item->m_combinatorial_map);
+    CGAL::Intersection_of_Polyhedra_3<Polyhedron,Kernel,Split_visitor> polyline_intersections(visitor);
+    polyline_intersections(A, B, std::back_inserter(new_item->polylines));
+    cmap_item->setName(QString("%1_and_%2_corefined").arg(itemA->name()).arg(itemB->name()));
+    scene->addItem(cmap_item);
+  #endif
+    new_item->setName(tr("boundary intersection"));
+    new_item->setColor(Qt::green);
+    new_item->setRenderingMode(Wireframe);
+    scene->addItem(new_item);  
+    new_item->invalidateOpenGLBuffers();
+    std::cout << "ok (" << time.elapsed() << " ms)" << std::endl;
+      
+  }
+
+  QApplication::restoreOverrideCursor();
+}
+
+#include "Corefinement_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Operations_on_polyhedra/Intersection_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Operations_on_polyhedra/Intersection_plugin.cpp
new file mode 100644
index 0000000..2d8080c
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Operations_on_polyhedra/Intersection_plugin.cpp
@@ -0,0 +1,223 @@
+#define CGAL_COREFINEMENT_DO_REPORT_SELF_INTERSECTIONS
+#define CGAL_USE_SEGMENT_APPROACH
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+#ifdef CGAL_USE_SEGMENT_APPROACH
+#include <CGAL/intersection_of_Polyhedra_3.h>
+#else
+#include <CGAL/intersection_Polyhedron_3_Polyhedron_3.h>
+#endif
+#include <CGAL/iterator.h>
+#include <CGAL/bounding_box.h>
+#include "Scene_polyhedron_item.h"
+#include "Polyhedron_type.h"
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+
+#include "Scene_polylines_item.h"
+
+#include <boost/foreach.hpp>
+
+#include <QString>
+#include <QAction>
+#include <QMenu>
+#include <QMainWindow>
+#include <QApplication>
+#include <QTime>
+#include <QMessageBox>
+using namespace CGAL::Three;
+class Polyhedron_demo_intersection_plugin :
+  public QObject,
+  public Polyhedron_demo_plugin_interface
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+public:
+
+  bool applicable(QAction*) const { 
+    return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
+  }
+
+  QList<QAction*> actions() const {
+    return QList<QAction*>() << actionPolyhedronIntersection_3;
+  }
+
+  void init(QMainWindow* mw, CGAL::Three::Scene_interface* scene_interface, Messages_interface*) {
+    this->scene = scene_interface;
+    actionPolyhedronIntersection_3 = new QAction("Intersect Polyhedra (A/B)", mw);
+    actionPolyhedronIntersection_3->setProperty("subMenuName", "Operations on Polyhedra");
+    if(actionPolyhedronIntersection_3) {
+      connect(actionPolyhedronIntersection_3, SIGNAL(triggered()),
+              this, SLOT(intersection()));
+    }
+  }
+
+private:
+
+  QAction*  actionPolyhedronIntersection_3;
+  Scene_interface *scene;
+
+public Q_SLOTS:
+  void intersection();
+
+}; // end class Polyhedron_demo_intersection_plugin
+
+
+#ifdef CGAL_USE_SEGMENT_APPROACH
+struct Is_on_polyline{
+  bool operator()(Polyhedron::Halfedge_handle he) const { 
+    return he->is_feature_edge();
+  }
+};
+
+struct Set_vertex_corner{
+  template <typename Info>
+  void add_info_to_node(int, Polyhedron*,const Info&) {
+  }
+
+  void operator()(Polyhedron::Vertex_handle v, int, Polyhedron*) {
+    ++v->nb_of_feature_edges;
+  }
+};
+#endif
+
+void Polyhedron_demo_intersection_plugin::intersection()
+{
+  int indexA = scene->selectionAindex();
+  int indexB = scene->selectionBindex();
+
+  Scene_polyhedron_item* itemA = 
+    qobject_cast<Scene_polyhedron_item*>(scene->item(indexA));
+  Scene_polyhedron_item* itemB = 
+    qobject_cast<Scene_polyhedron_item*>(scene->item(indexB));
+  if(!itemA || !itemB || itemA == itemB)
+  {
+    Q_FOREACH(int index, scene->selectionIndices()) {
+      Scene_polyhedron_item* item = 
+        qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+      if(!item)
+        return;
+    }
+    if(scene->selectionIndices().size() == 2) {
+      indexA = scene->selectionIndices()[0];
+      indexB = scene->selectionIndices()[1];
+      itemA = 
+        qobject_cast<Scene_polyhedron_item*>(scene->item(indexA));
+      itemB = 
+        qobject_cast<Scene_polyhedron_item*>(scene->item(indexB));
+    }
+  }
+#ifndef CGAL_USE_SEGMENT_APPROACH
+  if(!itemA || !itemB || itemA == itemB)
+    return;
+#else
+  std::vector<Polyhedron*> poly_ptrs;
+  Q_FOREACH(int index, scene->selectionIndices()) {
+    Scene_polyhedron_item* item = 
+      qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+    if(!item)
+      return;
+    else if(item != itemA) {
+      poly_ptrs.push_back(item->polyhedron());
+      if(poly_ptrs.back() == 0) return;
+    }
+  }
+#endif
+
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+
+  Scene_polylines_item* new_item = new Scene_polylines_item();
+ // perform Boolean operation
+  QTime time;
+  time.start();
+
+#ifdef CGAL_USE_SEGMENT_APPROACH
+  typedef CGAL::Node_visitor_for_polyline_split<Polyhedron,
+    Is_on_polyline, Set_vertex_corner> Split_visitor;
+
+  CGAL::Intersection_of_Polyhedra_3<Polyhedron,
+    Kernel,
+    Split_visitor> polyline_intersections;
+
+  typedef std::pair<Polyhedron::Facet_handle,
+                    Polyhedron::Facet_handle> Pair_of_facet_handles;
+  typedef std::vector<Pair_of_facet_handles> Polyline_info;
+  typedef std::vector<Polyline_info> Polylines_infos;
+  Polylines_infos polylines_infos;
+
+  typedef Scene_polylines_item::Polylines_container Polylines_container;
+  typedef std::back_insert_iterator<Polylines_container> To_container;
+  typedef std::back_insert_iterator<Polylines_infos> To_infos;
+  To_container to_container(new_item->polylines);
+  To_infos to_infos(polylines_infos);
+  CGAL::Dispatch_output_iterator<
+    CGAL::cpp11::tuple<Polylines_container::value_type,
+                       Polyline_info>,
+    CGAL::cpp11::tuple<To_container, 
+                       To_infos> > out_iterator(to_container,
+                                                to_infos);
+
+  if(itemA && itemB && itemA != itemB) {
+    Polyhedron* A = itemA->polyhedron();
+    Polyhedron* B = itemB->polyhedron();
+    polyline_intersections(*A, *B, out_iterator);
+  } else {
+    if(itemA) {
+      Polyhedron* A = itemA->polyhedron();
+      polyline_intersections(*A, 
+                             poly_ptrs.begin(),
+                             poly_ptrs.end(),
+                             out_iterator,
+                             0);
+    } else {
+      polyline_intersections(poly_ptrs.begin(),
+                             poly_ptrs.end(),
+                             out_iterator,
+                             0);
+    }
+  }
+  QStringList polylines_metadata;
+  BOOST_FOREACH(Polyline_info& info, polylines_infos) {
+    std::set<int> indices;
+    BOOST_FOREACH(Pair_of_facet_handles p, info)
+    {
+      indices.insert(p.first->patch_id());
+      indices.insert(p.second->patch_id());
+    }
+    QString metadata;
+    BOOST_FOREACH(int index, indices) {
+      metadata = metadata + QString(" %1").arg(index);
+    }
+    std::cerr << "new polyline metadata: " << qPrintable(metadata) << "\n";
+    polylines_metadata << metadata;
+  }
+  new_item->setProperty("polylines metadata", polylines_metadata);
+  new_item->setName(tr("intersection"));
+#else
+  Polyhedron* A = itemA->polyhedron();
+  Polyhedron* B = itemB->polyhedron();
+  CGAL::intersection_Polyhedron_3_Polyhedron_3(*A, *B, std::back_inserter(new_item->polylines));
+
+  QString name = tr("%1 intersection %2");
+   
+  new_item->setName(name.arg(itemA->name(), itemB->name()));
+  itemA->setRenderingMode(Wireframe);
+  itemB->setRenderingMode(Wireframe);
+  scene->itemChanged(indexA);
+  scene->itemChanged(indexB);
+#endif
+  std::cout << "ok (" << time.elapsed() << " ms)" << std::endl;
+
+  if (new_item->polylines.empty())
+    delete new_item;
+  else{
+    new_item->setColor(Qt::green);
+    new_item->setRenderingMode(Wireframe);
+    scene->addItem(new_item);
+    new_item->invalidateOpenGLBuffers();
+  }
+
+  QApplication::restoreOverrideCursor();
+}
+
+#include "Intersection_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Operations_on_polyhedra/Point_set_from_vertices_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Operations_on_polyhedra/Point_set_from_vertices_plugin.cpp
new file mode 100644
index 0000000..d101dab
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Operations_on_polyhedra/Point_set_from_vertices_plugin.cpp
@@ -0,0 +1,106 @@
+#include <QApplication>
+#include <QAction>
+#include <QList>
+#include <QMainWindow>
+#include <QMessageBox>
+#include <QtDebug>
+
+#include "Scene_points_with_normal_item.h"
+#include "Scene_polyhedron_item.h"
+#include "Scene_polygon_soup_item.h"
+
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+#include "Messages_interface.h"
+
+using namespace CGAL::Three;
+class Polyhedron_demo_point_set_from_vertices_plugin : 
+  public QObject,
+  public Polyhedron_demo_plugin_interface
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+public:
+  void init(QMainWindow* mainWindow,
+            CGAL::Three::Scene_interface* scene_interface, Messages_interface*);
+
+  bool applicable(QAction*) const {
+    const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+
+    return qobject_cast<Scene_polyhedron_item*>(scene->item(index))
+      || qobject_cast<Scene_polygon_soup_item*>(scene->item(index));
+  }
+
+  QList<QAction*> actions() const;
+
+public Q_SLOTS:
+  void createPointSet();
+
+private:
+  CGAL::Three::Scene_interface* scene;
+  QAction* actionPointSetFromPolyhedronVertices;
+
+}; // end Polyhedron_demo_point_set_from_vertices_plugin
+
+void Polyhedron_demo_point_set_from_vertices_plugin::init(QMainWindow* mainWindow,
+                                                          CGAL::Three::Scene_interface* scene_interface,
+                                                          Messages_interface*)
+{
+  scene = scene_interface;
+  actionPointSetFromPolyhedronVertices = new QAction(tr("&Create Point Set from Vertices"), mainWindow);
+  actionPointSetFromPolyhedronVertices->setObjectName("actionPointSetFromPolyhedronVertices");
+  connect(actionPointSetFromPolyhedronVertices, SIGNAL(triggered()),
+          this, SLOT(createPointSet()));
+}
+
+QList<QAction*> Polyhedron_demo_point_set_from_vertices_plugin::actions() const {
+  return QList<QAction*>() << actionPointSetFromPolyhedronVertices;
+}
+
+void Polyhedron_demo_point_set_from_vertices_plugin::createPointSet()
+{
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+
+  Scene_polyhedron_item* poly_item =
+    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+
+  if (poly_item)
+    {
+      Scene_points_with_normal_item* points
+        = new Scene_points_with_normal_item(*(poly_item->polyhedron()));
+
+      if (points)
+        {
+          points->setColor(Qt::blue);
+          points->setName(QString("%1 (vertices)").arg(poly_item->name()));
+          scene->addItem (points);
+        }
+    }
+
+  Scene_polygon_soup_item* soup_item =
+    qobject_cast<Scene_polygon_soup_item*>(scene->item(index));
+
+  if (soup_item)
+    {
+      Scene_points_with_normal_item* points
+        = new Scene_points_with_normal_item();
+      points->setColor(Qt::blue);
+      points->setName(QString("%1 (vertices)").arg(soup_item->name()));
+
+      // TODO get points from polygon soup
+      const std::vector<Kernel::Point_3>& pts
+        = soup_item->points();
+
+      for (std::size_t i = 0; i < pts.size(); ++ i)
+        points->point_set()->push_back (pts[i]);
+      
+      scene->addItem (points);
+    }
+
+  QApplication::restoreOverrideCursor();
+}
+
+
+#include "Point_set_from_vertices_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Operations_on_polyhedra/Scene_combinatorial_map_item.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Operations_on_polyhedra/Scene_combinatorial_map_item.cpp
new file mode 100644
index 0000000..284e733
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Operations_on_polyhedra/Scene_combinatorial_map_item.cpp
@@ -0,0 +1,573 @@
+#include "Scene_combinatorial_map_item.h"
+#include "Scene_polyhedron_item.h"
+#include <CGAL/Three/Scene_interface.h>
+#include <CGAL/Three/Viewer_interface.h>
+
+#include <QObject>
+#include <QMenu>
+#include <QAction>
+#include <QtDebug>
+#include <QApplication>
+#include <QDebug>
+#include <QKeyEvent>
+#include <CGAL/corefinement_operations.h>
+
+struct Scene_combinatorial_map_item_priv
+{
+  Scene_combinatorial_map_item_priv(CGAL::Three::Scene_interface* scene, void* ad_A, Scene_combinatorial_map_item* parent)
+  :last_known_scene(scene),volume_to_display(0),exportSelectedVolume(NULL),address_of_A(ad_A)
+  {
+    item = parent;
+    item->are_buffers_filled = false;
+    nb_points = 0;
+    nb_lines =0;
+    nb_facets =0;
+  }
+
+  Kernel::Vector_3 compute_face_normal(Combinatorial_map_3::Dart_const_handle adart) const;
+
+  template <class Predicate>
+  void export_as_polyhedron(Predicate,const QString&) const;
+  void initialize_buffers(CGAL::Three::Viewer_interface *viewer) const;
+  void compute_elements(void) const;
+
+  Scene_combinatorial_map_item *item;
+  enum VAOs {
+      Edges = 0,
+      Points,
+      Facets,
+      NbOfVaos
+  };
+  enum VBOs {
+      Edges_vertices = 0,
+      Points_vertices,
+      Facets_vertices,
+      Facets_normals,
+      NbOfVbos
+  };
+
+  CGAL::Three::Scene_interface* last_known_scene;
+  std::size_t volume_to_display;
+  QAction* exportSelectedVolume;
+  void* address_of_A;
+
+  mutable QOpenGLShaderProgram *program;
+  mutable std::vector<double> positions_lines;
+  mutable std::vector<double> positions_points;
+  mutable std::vector<double> positions_facets;
+  mutable std::vector<double> normals;
+  mutable std::size_t nb_lines;
+  mutable std::size_t nb_points;
+  mutable std::size_t nb_facets;
+};
+Scene_combinatorial_map_item::Scene_combinatorial_map_item(CGAL::Three::Scene_interface* scene,void* address){m_combinatorial_map=NULL; d = new Scene_combinatorial_map_item_priv(scene, address, this);}
+Scene_combinatorial_map_item::~Scene_combinatorial_map_item(){if (m_combinatorial_map!=NULL) delete m_combinatorial_map; delete d;}
+
+Scene_combinatorial_map_item* Scene_combinatorial_map_item::clone() const{return NULL;}
+
+Kernel::Vector_3 Scene_combinatorial_map_item_priv::compute_face_normal(Combinatorial_map_3::Dart_const_handle adart) const
+{
+    typedef Combinatorial_map_3::Dart_of_orbit_const_range<1> Dart_in_facet_range;
+    typedef Kernel::Vector_3 Vector_3;
+    Vector_3 normal = CGAL::NULL_VECTOR;
+
+    Dart_in_facet_range vertices=item->combinatorial_map().darts_of_orbit<1>(adart);
+    Kernel::Point_3 points[3];
+    int index=0;
+    Dart_in_facet_range::const_iterator pit=vertices.begin();
+    for (;pit!=vertices.end() && index!=3;++pit,++index ){
+        points[index]=pit->attribute<0>()->point();
+    }
+
+    if (index!=3) return normal;
+
+    do{
+        Vector_3 n = CGAL::cross_product(points[2]-points[1],points[0]-points[1]);
+        if (n != Vector_3(0,0,0) )
+            normal = normal + (n / std::sqrt(n*n));
+        points[0]=points[1];
+        points[1]=points[2];
+        if ( pit==vertices.end() ) break;
+
+        points[2]=pit->attribute<0>()->point();
+        ++pit;
+    }while(true);
+
+    return normal == Vector_3(0,0,0)? normal : normal / std::sqrt(normal * normal);
+}  
+
+void Scene_combinatorial_map_item::set_next_volume(){
+    //Update des vectors faits ici
+    ++d->volume_to_display;
+    d->volume_to_display=d->volume_to_display%(combinatorial_map().attributes<3>().size()+1);
+  are_buffers_filled = false;
+  invalidateOpenGLBuffers();
+  Q_EMIT itemChanged();
+
+    if (d->exportSelectedVolume!=NULL && ( d->volume_to_display==1 || d->volume_to_display==0 ) )
+        d->exportSelectedVolume->setEnabled(!d->exportSelectedVolume->isEnabled());
+}
+
+
+template <class Predicate> 
+void Scene_combinatorial_map_item_priv::export_as_polyhedron(Predicate pred,const QString& name) const {
+    typedef Combinatorial_map_3::Dart_const_handle Dart_handle;
+    typedef Combinatorial_map_3::One_dart_per_cell_range<3> One_dart_per_vol_range;
+    typedef CGAL::internal::Import_volume_as_polyhedron<Polyhedron::HalfedgeDS> Volume_import_modifier;
+
+    std::vector<Dart_handle> darts;
+    One_dart_per_vol_range cell_range=item->combinatorial_map().template one_dart_per_cell<3>();
+
+
+    for (One_dart_per_vol_range::const_iterator it = cell_range.begin();it!= cell_range.end() ; ++it )
+        if ( pred(it) ){
+            darts.push_back(it);
+            if (Predicate::only_one_run) break;
+        }
+
+    if (!darts.empty())
+    {
+        Volume_import_modifier modifier=Predicate::swap_orientation?
+                    Volume_import_modifier(item->combinatorial_map(),darts.begin(),darts.end(),Predicate::swap_orientation):
+                    Volume_import_modifier(item->combinatorial_map(),darts.begin(),darts.end());
+
+        Polyhedron* new_poly=new Polyhedron();
+        new_poly->delegate(modifier);
+        Scene_polyhedron_item* new_item = new Scene_polyhedron_item(new_poly);
+        new_item->setName(name);
+        last_known_scene->addItem(new_item);
+    }
+}
+
+struct Select_volume{
+    static const bool only_one_run=true;
+    static const bool swap_orientation=false;
+    Select_volume(std::size_t i):volume_to_select(i),index(0){}
+    template <class Dart_handle>
+    bool operator() (Dart_handle){
+        return ++index==volume_to_select;
+    }
+private:
+    std::size_t volume_to_select;
+    std::size_t index;
+};
+
+void Scene_combinatorial_map_item::export_current_volume_as_polyhedron() const {
+    if (d->volume_to_display==0) return; //no volume selected
+
+    Select_volume predicate(d->volume_to_display);
+    d->export_as_polyhedron(predicate,QString("%1_%2").arg(this->name()).arg(d->volume_to_display-1));
+}
+
+struct Select_union{
+    static const bool only_one_run=false;
+    static const bool swap_orientation=true;
+    template <class Dart_handle>
+    bool operator() (Dart_handle d){ return d->template attribute<3>()->info().outside.size()==2; }
+};
+
+struct Select_inter{
+    static const bool only_one_run=false;
+    static const bool swap_orientation=false;
+    template <class Dart_handle>
+    bool operator() (Dart_handle d){ return d->template attribute<3>()->info().inside.size()==2; }
+};
+
+struct Select_A_minus_B{
+    static const bool only_one_run=false;
+    static const bool swap_orientation=false;
+    Select_A_minus_B(void* address):address_of_A(address){}
+    template <class Dart_handle>
+    bool operator() (Dart_handle d){
+        return d->template attribute<3>()->info().inside.size()==1 &&
+                static_cast<void*>(*d->template attribute<3>()->info().inside.begin())==address_of_A;
+    }
+private:
+    void* address_of_A;
+};
+
+struct Select_B_minus_A{
+    static const bool only_one_run=false;
+    static const bool swap_orientation=false;
+    Select_B_minus_A(void* address):address_of_A(address){}
+    template <class Dart_handle>
+    bool operator() (Dart_handle d){
+        return d->template attribute<3>()->info().inside.size()==1 &&
+                static_cast<void*>(*d->template attribute<3>()->info().inside.begin())!=address_of_A;
+    }
+private:
+    void* address_of_A;
+};
+
+void Scene_combinatorial_map_item::export_union_as_polyhedron() const {
+    d->export_as_polyhedron(Select_union(),QString("%1_union_%2").arg("A").arg("B"));
+}
+void Scene_combinatorial_map_item::export_intersection_as_polyhedron() const{
+    d->export_as_polyhedron(Select_inter(),QString("%1_inter_%2").arg("A").arg("B"));
+}
+void Scene_combinatorial_map_item::export_A_minus_B_as_polyhedron() const{
+    Select_A_minus_B predicate(d->address_of_A);
+    d->export_as_polyhedron(predicate,QString("%1_minus_%2").arg("A").arg("B"));
+}
+void Scene_combinatorial_map_item::export_B_minus_A_as_polyhedron() const{
+    Select_B_minus_A predicate(d->address_of_A);
+    d->export_as_polyhedron(predicate,QString("%1_minus_%2").arg("B").arg("A"));
+}
+
+QMenu* Scene_combinatorial_map_item::contextMenu()
+{
+    const char* prop_name = "Menu modified by Scene_combinatorial_map_item.";
+
+    QMenu* menu = Scene_item::contextMenu();
+
+    // Use dynamic properties:
+    // http://doc.qt.io/qt-5/qobject.html#property
+    bool menuChanged = menu->property(prop_name).toBool();
+
+    if(!menuChanged) {
+        QAction* actionSelectNextVolume =
+                menu->addAction(tr("Iterate over volumes"));
+        actionSelectNextVolume->setObjectName("actionSelectNextVolume");
+        connect(actionSelectNextVolume, SIGNAL(triggered()),this, SLOT(set_next_volume()));
+
+        d->exportSelectedVolume =
+                menu->addAction(tr("Export current volume as polyhedron"));
+        d->exportSelectedVolume->setObjectName("exportSelectedVolume");
+        connect(d->exportSelectedVolume, SIGNAL(triggered()),this, SLOT(export_current_volume_as_polyhedron()));
+        d->exportSelectedVolume->setEnabled(d->volume_to_display!=0);
+        menu->setProperty(prop_name, true);
+
+        if(is_from_corefinement()){
+            //Export union as polyhedron
+            QAction* exportUnion =
+                    menu->addAction(tr("Export union as polyhedron"));
+            exportUnion->setObjectName("exportUnion");
+            connect(exportUnion, SIGNAL(triggered()),this, SLOT(export_union_as_polyhedron()));
+
+            //Export intersection as polyhedron
+            QAction* exportIntersection =
+                    menu->addAction(tr("Export intersection as polyhedron"));
+            exportIntersection->setObjectName("exportIntersection");
+            connect(exportIntersection, SIGNAL(triggered()),this, SLOT(export_intersection_as_polyhedron()));
+
+            //Export A minus B as polyhedron
+            QAction* exportAMinusB =
+                    menu->addAction(tr("Export A minus B as polyhedron"));
+            exportAMinusB->setObjectName("exportAMinusB");
+            connect(exportAMinusB, SIGNAL(triggered()),this, SLOT(export_A_minus_B_as_polyhedron()));
+
+            //Export B minus A as polyhedron
+            QAction* exportBMinusA =
+                    menu->addAction(tr("Export B minus A as polyhedron"));
+            exportBMinusA->setObjectName("exportBMinusA");
+            connect(exportBMinusA, SIGNAL(triggered()),this, SLOT(export_B_minus_A_as_polyhedron()));
+
+        }
+    }
+    return menu;
+}
+
+bool Scene_combinatorial_map_item::keyPressEvent(QKeyEvent* e){
+    if (e->key()==Qt::Key_N){
+        set_next_volume();
+        return true;
+    }
+    return false;
+}
+
+void Scene_combinatorial_map_item_priv::compute_elements(void) const{
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+
+    positions_facets.resize(0);
+    normals.resize(0);
+    positions_lines.resize(0);
+    positions_points.resize(0);
+
+    //Facets
+    {
+    std::size_t index = 0;
+    Combinatorial_map_3::size_type voltreated
+      = item->combinatorial_map().get_new_mark();
+    Combinatorial_map_3::size_type facetreated
+      = item->combinatorial_map().get_new_mark();
+    Combinatorial_map_3::Dart_const_range::const_iterator
+            darts_it=item->combinatorial_map().darts().begin(), darts_end=item->combinatorial_map().darts().end();
+    for( ; darts_it!=darts_end; ++darts_it)
+    {
+        if ( !item->combinatorial_map().is_marked(darts_it,voltreated) )
+        {
+            ++index;
+            //iterate over all the darts of the volume
+            Combinatorial_map_3::Dart_of_cell_const_range<3>::const_iterator
+                    vol_it=item->combinatorial_map().darts_of_cell<3>(darts_it).begin(),
+                    vol_end=item->combinatorial_map().darts_of_cell<3>(darts_it).end();
+            if ( volume_to_display!=0 && index!=volume_to_display )
+            {
+                //only mark darts if the volume is not the one to display
+                for ( ;vol_it!=vol_end; ++vol_it )
+                {
+                    item->combinatorial_map().mark(vol_it,facetreated);
+                    item->combinatorial_map().mark(vol_it, voltreated);
+                }
+            }
+            else
+            {
+                for ( ;vol_it!=vol_end; ++vol_it )
+                {
+                    if ( !item->combinatorial_map().is_marked(vol_it,facetreated) )
+                    {
+                        Kernel::Vector_3 normal = compute_face_normal(vol_it);
+                        for(int i=0; i<3; i++)
+                        {
+                            normals.push_back(normal.x());
+                            normals.push_back(normal.y());
+                            normals.push_back(normal.z());
+                        }
+
+                        //iterate over all darts of facets
+                        for ( Combinatorial_map_3::Dart_of_orbit_const_range<1>::const_iterator
+                              face_it=item->combinatorial_map().darts_of_orbit<1>(vol_it).begin(),
+                              face_end=item->combinatorial_map().darts_of_orbit<1>(vol_it).end();
+                              face_it!=face_end; ++face_it)
+                        {
+                            const Kernel::Point_3& p= face_it->attribute<0>()->point();
+                            positions_facets.push_back(p.x());
+                            positions_facets.push_back(p.y());
+                            positions_facets.push_back(p.z());
+                            item->combinatorial_map().mark(face_it,facetreated);
+                            item->combinatorial_map().mark(face_it, voltreated);
+                        }
+                    }
+                }
+            }
+            if ( index==volume_to_display ) break;
+        }
+    }
+    //mark remaining darts to have an O(1) free_mark
+    for( ;  darts_it!=darts_end; ++darts_it)
+    {
+        item->combinatorial_map().mark(darts_it, facetreated);
+        item->combinatorial_map().mark(darts_it, voltreated);
+    }
+
+    item->combinatorial_map().free_mark(facetreated);
+    item->combinatorial_map().free_mark(voltreated);
+    }
+
+    //edges
+    {
+
+        typedef Combinatorial_map_3::One_dart_per_cell_range<1,3> Edge_darts;
+        Edge_darts darts=item->combinatorial_map().one_dart_per_cell<1>();
+        for (Edge_darts::const_iterator dit=darts.begin();dit!=darts.end();++dit){
+            CGAL_assertion(!item->combinatorial_map().is_free(dit,1));
+            const Kernel::Point_3& a = dit->attribute<0>()->point();
+            const Kernel::Point_3& b = dit->beta(1)->attribute<0>()->point();
+            positions_lines.push_back(a.x());
+            positions_lines.push_back(a.y());
+            positions_lines.push_back(a.z());
+
+            positions_lines.push_back(b.x());
+            positions_lines.push_back(b.y());
+            positions_lines.push_back(b.z());
+
+        }
+    }
+
+    //points
+    {
+        typedef Combinatorial_map_3::Attribute_const_range<0>::type Point_range;
+        const Point_range& points=item->combinatorial_map().attributes<0>();
+        for(Point_range::const_iterator pit=boost::next(points.begin());pit!=points.end();++pit){
+            const Kernel::Point_3& p=pit->point();
+            positions_points.push_back(p.x());
+            positions_points.push_back(p.y());
+            positions_points.push_back(p.z());
+        }
+
+    }
+    QApplication::restoreOverrideCursor();
+}
+
+
+void Scene_combinatorial_map_item_priv::initialize_buffers(CGAL::Three::Viewer_interface *viewer) const
+{
+    //vao for the edges
+    {
+        program = item->getShaderProgram(Scene_combinatorial_map_item::PROGRAM_WITHOUT_LIGHT, viewer);
+        program->bind();
+
+        item->vaos[Scene_combinatorial_map_item_priv::Edges]->bind();
+        item->buffers[Scene_combinatorial_map_item_priv::Edges_vertices].bind();
+        item->buffers[Scene_combinatorial_map_item_priv::Edges_vertices].allocate(positions_lines.data(),
+                            static_cast<int>(positions_lines.size()*sizeof(double)));
+        program->enableAttributeArray("vertex");
+        program->setAttributeBuffer("vertex",GL_DOUBLE,0,3);
+        item->buffers[Scene_combinatorial_map_item_priv::Edges_vertices].release();
+        nb_lines = positions_lines.size();
+        positions_lines.resize(0);
+        std::vector<double>(positions_lines).swap(positions_lines);
+        item->vaos[Scene_combinatorial_map_item_priv::Edges]->release();
+        program->release();
+    }
+    //vao for the points
+    {
+        program = item->getShaderProgram(Scene_combinatorial_map_item::PROGRAM_WITHOUT_LIGHT, viewer);
+        program->bind();
+
+        item->vaos[Scene_combinatorial_map_item_priv::Points]->bind();
+        item->buffers[Scene_combinatorial_map_item_priv::Points_vertices].bind();
+        item->buffers[Scene_combinatorial_map_item_priv::Points_vertices].allocate(positions_points.data(),
+                            static_cast<int>(positions_points.size()*sizeof(double)));
+        program->enableAttributeArray("vertex");
+        program->setAttributeBuffer("vertex",GL_DOUBLE,0,3);
+        item->buffers[Scene_combinatorial_map_item_priv::Points_vertices].release();
+        item->vaos[Scene_combinatorial_map_item_priv::Points]->release();
+        nb_points = positions_points.size();
+        positions_points.resize(0);
+        std::vector<double>(positions_points).swap(positions_points);
+        program->release();
+    }
+    //vao for the facets
+    {
+        program = item->getShaderProgram(Scene_combinatorial_map_item::PROGRAM_WITH_LIGHT, viewer);
+        program->bind();
+
+        item->vaos[Scene_combinatorial_map_item_priv::Facets]->bind();
+        item->buffers[Scene_combinatorial_map_item_priv::Facets_vertices].bind();
+        item->buffers[Scene_combinatorial_map_item_priv::Facets_vertices].allocate(positions_facets.data(),
+                            static_cast<int>(positions_facets.size()*sizeof(double)));
+        program->enableAttributeArray("vertex");
+        program->setAttributeBuffer("vertex",GL_DOUBLE,0,3);
+        item->buffers[Scene_combinatorial_map_item_priv::Facets_vertices].release();
+
+        item->buffers[Scene_combinatorial_map_item_priv::Facets_normals].bind();
+        item->buffers[Scene_combinatorial_map_item_priv::Facets_normals].allocate(normals.data(),
+                            static_cast<int>(normals.size()*sizeof(double)));
+        program->enableAttributeArray("normals");
+        program->setAttributeBuffer("normals",GL_DOUBLE,0,3);
+        item->buffers[Scene_combinatorial_map_item_priv::Facets_normals].release();
+        nb_facets = positions_facets.size();
+        positions_facets.resize(0);
+        std::vector<double>(positions_facets).swap(positions_facets);
+        normals.resize(0);
+        std::vector<double>(normals).swap(normals);
+        item->vaos[Scene_combinatorial_map_item_priv::Facets]->release();
+        program->release();
+    }
+    item->are_buffers_filled = true;
+
+
+}
+
+bool Scene_combinatorial_map_item::isEmpty() const {return combinatorial_map().number_of_darts()==0;}
+
+void
+Scene_combinatorial_map_item::compute_bbox() const {
+    typedef Combinatorial_map_3::Attribute_const_range<0>::type Point_range;
+    const Point_range& points=combinatorial_map().attributes<0>();
+    CGAL::Bbox_3 bbox=points.begin()->point().bbox();
+    for(Point_range::const_iterator pit=boost::next(points.begin());pit!=points.end();++pit)
+        bbox=bbox+pit->point().bbox();
+    _bbox = Bbox(bbox.xmin(),bbox.ymin(),bbox.zmin(),
+                bbox.xmax(),bbox.ymax(),bbox.zmax());
+}
+
+
+QString Scene_combinatorial_map_item::toolTip() const{ 
+    if(!m_combinatorial_map)
+        return QString();
+
+    std::vector<unsigned int> cells(5);
+    for (unsigned int i=0; i<=4; ++i)
+        cells[i]=i;
+    std::vector<unsigned int> res = combinatorial_map().count_cells(cells);
+    if (d->volume_to_display==0)
+        return QObject::tr("<p>Combinatorial_map_3 <b>%1</b> (mode: %8, color: %9)</p>"
+                           "<p>Number of darts: %2<br />"
+                           "Number of vertices: %3<br />"
+                           "Number of edges: %4<br />"
+                           "Number of facets: %5<br />"
+                           "Number of volumes: %6<br />"
+                           "Number of connected components: %7</p>")
+                .arg(this->name())
+                .arg(combinatorial_map().number_of_darts())
+                .arg(res[0])
+                .arg(res[1])
+                .arg(res[2])
+                .arg(res[3])
+                .arg(res[4])
+                .arg(this->renderingModeName())
+                .arg(this->color().name());
+    return QObject::tr("<p>Combinatorial_map_3 <b>%1</b> (mode: %8, color: %9)</p>"
+                       "<p>Number of darts: %2<br />"
+                       "Number of vertices: %3<br />"
+                       "Number of edges: %4<br />"
+                       "Number of facets: %5<br />"
+                       "Number of volumes: %6<br />"
+                       "Number of connected components: %7 <br />"
+                       "Currently Displaying facets of volume: %10 </p>")
+            .arg(this->name())
+            .arg(combinatorial_map().number_of_darts())
+            .arg(res[0])
+            .arg(res[1])
+            .arg(res[2])
+            .arg(res[3])
+            .arg(res[4])
+            .arg(this->renderingModeName())
+            .arg(this->color().name())
+            .arg(d->volume_to_display-1);
+}
+
+
+void Scene_combinatorial_map_item::draw(CGAL::Three::Viewer_interface* viewer) const
+{
+    if(!are_buffers_filled)
+    {
+        d->compute_elements();
+        d->initialize_buffers(viewer);
+    }
+    vaos[Scene_combinatorial_map_item_priv::Facets]->bind();
+    d->program=getShaderProgram(PROGRAM_WITH_LIGHT);
+    attribBuffers(viewer,PROGRAM_WITH_LIGHT);
+    d->program->bind();
+    d->program->setAttributeValue("colors", this->color());
+    viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(d->nb_facets/3));
+    vaos[Scene_combinatorial_map_item_priv::Facets]->release();
+    d->program->release();
+}
+ void Scene_combinatorial_map_item::drawEdges(CGAL::Three::Viewer_interface* viewer) const
+{
+     if(!are_buffers_filled)
+     {
+         d->compute_elements();
+         d->initialize_buffers(viewer);
+     }
+     vaos[Scene_combinatorial_map_item_priv::Edges]->bind();
+     d->program=getShaderProgram(PROGRAM_WITHOUT_LIGHT);
+     attribBuffers(viewer,PROGRAM_WITHOUT_LIGHT);
+     d->program->bind();
+     d->program->setAttributeValue("colors", this->color());
+     viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(d->nb_lines/3));
+     vaos[Scene_combinatorial_map_item_priv::Edges]->release();
+     d->program->release();
+
+}
+ void Scene_combinatorial_map_item::drawPoints(CGAL::Three::Viewer_interface* viewer) const
+{
+     if(!are_buffers_filled)
+     {
+         d->compute_elements();
+         d->initialize_buffers(viewer);
+     }
+     vaos[Scene_combinatorial_map_item_priv::Points]->bind();
+     d->program=getShaderProgram(PROGRAM_WITHOUT_LIGHT);
+     attribBuffers(viewer,PROGRAM_WITHOUT_LIGHT);
+     d->program->bind();
+     d->program->setAttributeValue("colors", this->color());
+     viewer->glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(d->nb_points/3));
+     vaos[Scene_combinatorial_map_item_priv::Points]->release();
+     d->program->release();
+}
+
+ bool Scene_combinatorial_map_item::is_from_corefinement() const{return d->address_of_A!=NULL;}
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Operations_on_polyhedra/Scene_combinatorial_map_item.h b/3rdparty/CGAL/demo/Polyhedron/Plugins/Operations_on_polyhedra/Scene_combinatorial_map_item.h
new file mode 100644
index 0000000..60a9645
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Operations_on_polyhedra/Scene_combinatorial_map_item.h
@@ -0,0 +1,83 @@
+#ifndef SCENE_COMBINATORIAL_MAP_ITEM_H
+#define SCENE_COMBINATORIAL_MAP_ITEM_H
+
+//=========
+#include <CGAL/internal/corefinement/Combinatorial_map_for_corefinement.h>
+#include "Scene_combinatorial_map_item_config.h"
+#include <iostream>
+#include <QOpenGLBuffer>
+#include <QOpenGLShader>
+#include <QOpenGLShaderProgram>
+#include "Polyhedron_type.h"
+#include  <CGAL/Three/Scene_item.h>
+typedef CGAL::internal_IOP::Item_with_points_and_volume_info<Kernel,Polyhedron> Items;
+typedef CGAL::Combinatorial_map<3,Items> Combinatorial_map_3;
+//=========
+struct Scene_combinatorial_map_item_priv;
+class QMenu;
+class QAction;
+namespace CGAL { namespace Three{
+class Scene_interface;
+}}
+class Scene_polyhedron_item;
+class Viewer_interface;
+
+class SCENE_COMBINATORIAL_MAP_ITEM_EXPORT Scene_combinatorial_map_item
+        : public CGAL::Three::Scene_item
+{
+    Q_OBJECT
+public:  
+    Scene_combinatorial_map_item(CGAL::Three::Scene_interface*,void* ad_A=NULL);
+    ~Scene_combinatorial_map_item();
+
+    Scene_combinatorial_map_item* clone() const;
+    // Function to override the context menu
+    QMenu* contextMenu();
+
+    //  bool load(std::istream& in);
+    //  void load(Scene_polyhedron_item*);
+    //  bool save(std::ostream& out) const;
+
+    QString toolTip() const;
+
+    // Indicate if rendering mode is supported
+    virtual bool supportsRenderingMode(RenderingMode m) const { return (m != Gouraud && m!=PointsPlusNormals && m!=Splatting); } // CHECK THIS!
+    //Event handling
+    virtual bool keyPressEvent(QKeyEvent*);
+    //drawing of the scene
+    virtual void drawEdges(CGAL::Three::Viewer_interface* viewer) const;
+    virtual void drawPoints(CGAL::Three::Viewer_interface*) const;
+    virtual void draw(CGAL::Three::Viewer_interface*) const;
+
+    bool isFinite() const { return true; }
+    bool is_from_corefinement() const;
+    bool isEmpty() const;
+    void compute_bbox() const;
+
+    const Combinatorial_map_3& combinatorial_map() const
+    {
+        return *m_combinatorial_map;
+    }
+
+    Combinatorial_map_3& combinatorial_map()
+    {
+        return *m_combinatorial_map;
+    }
+
+    Combinatorial_map_3* m_combinatorial_map;
+
+
+public Q_SLOTS:
+    void set_next_volume();
+    void export_current_volume_as_polyhedron() const;
+    void export_union_as_polyhedron() const;
+    void export_intersection_as_polyhedron() const;
+    void export_A_minus_B_as_polyhedron() const;
+    void export_B_minus_A_as_polyhedron() const;
+protected:
+    friend struct Scene_combinatorial_map_item_priv;
+    Scene_combinatorial_map_item_priv* d;
+
+}; // end class Scene_combinatorial_map_item
+
+#endif // SCENE_COMBINATORIAL_MAP_ITEM_H
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Operations_on_polyhedra/Scene_combinatorial_map_item_config.h b/3rdparty/CGAL/demo/Polyhedron/Plugins/Operations_on_polyhedra/Scene_combinatorial_map_item_config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Operations_on_polyhedra/Scene_combinatorial_map_item_config.h
rename to 3rdparty/CGAL/demo/Polyhedron/Plugins/Operations_on_polyhedra/Scene_combinatorial_map_item_config.h
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/PCA/Affine_transform_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/PCA/Affine_transform_plugin.cpp
new file mode 100644
index 0000000..3b7a718
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/PCA/Affine_transform_plugin.cpp
@@ -0,0 +1,314 @@
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+#include <CGAL/bounding_box.h>
+#include "Scene_polyhedron_transform_item.h"
+#include "Scene_points_with_normal_item.h"
+#include "Polyhedron_type.h"
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+
+#include "Scene_polylines_item.h"
+
+#include <QString>
+#include <QAction>
+#include <QMenu>
+#include <QMainWindow>
+#include <QApplication>
+#include <QTime>
+#include <QMessageBox>
+
+class Scene_transform_point_set_item : public Scene_item
+{
+  Q_OBJECT
+  typedef Point_set_3<Kernel> Point_set;
+public:
+  Scene_transform_point_set_item(Scene_points_with_normal_item *item, const qglviewer::Vec& pos)
+    :Scene_item(1,1),
+      base(item),
+      center_(pos),
+      frame(new CGAL::Three::Scene_item::ManipulatedFrame())
+  {
+    frame->setPosition(pos);
+    Point_set ps= *item->point_set();
+    std::random_shuffle (ps.begin(), ps.end());
+
+
+    std::vector<float> points;
+    points.reserve(3*ps.size());
+    for (Point_set::const_iterator it = ps.begin(); it != ps.first_selected(); it++)
+    {
+      const UI_point& p = *it;
+      points.push_back(p.x()-center_.x);
+      points.push_back(p.y()-center_.y);
+      points.push_back(p.z()-center_.z);
+    }
+    nb_points = points.size();
+    CGAL::Three::Viewer_interface* viewer = static_cast<CGAL::Three::Viewer_interface*>(*QGLViewer::QGLViewerPool().begin());
+    program = getShaderProgram(Scene_polyhedron_transform_item::PROGRAM_WITHOUT_LIGHT, viewer);
+    program->bind();
+
+    vaos[0]->bind();
+    buffers[0].bind();
+    buffers[0].allocate(points.data(),
+                        static_cast<int>(points.size()*sizeof(float)));
+    program->enableAttributeArray("vertex");
+    program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
+    buffers[0].release();
+    vaos[0]->release();
+
+    program->release();
+  }
+
+  bool manipulatable() const { return true; }
+
+  Scene_item* clone()const{ return NULL; }
+
+  bool supportsRenderingMode(RenderingMode m) const { return m==Points ; }
+
+  QString toolTip() const {
+      return QObject::tr("<p>Affine transformation of <b>%1</b></p>"
+                         "<p>Keep <b>Ctrl</b> pressed and use the arcball to define an affine transformation.<br />"
+                         "Press <b>S</b> to apply the affine transformation to a copy of <b>%1</b>.</p>")
+              .arg(getBase()->name());
+  }
+
+  ~Scene_transform_point_set_item() {delete frame; Q_EMIT killed(); }
+  void drawPoints(Viewer_interface *viewer) const
+  {
+    GLfloat point_size;
+    viewer->glGetFloatv(GL_POINT_SIZE, &point_size);
+    viewer->glPointSize(6.f);
+    double ratio_displayed = 1.0;
+    if (viewer->inFastDrawing () &&
+        (nb_points /3 > 300000)) // arbitrary large value
+      ratio_displayed = 3 * 300000. / (double)nb_points;
+
+    vaos[0]->bind();
+    program=getShaderProgram(PROGRAM_NO_SELECTION);
+    attribBuffers(viewer,PROGRAM_NO_SELECTION);
+    program->bind();
+    QMatrix4x4 f_matrix;
+    for (int i=0; i<16; ++i){
+      f_matrix.data()[i] = (float)frame->matrix()[i];
+    }
+    program->setAttributeValue("colors", QColor(Qt::green));
+    program->setUniformValue("f_matrix", f_matrix);
+    program->setUniformValue("is_selected", false);
+    viewer->glDrawArrays(GL_POINTS, 0,
+                         static_cast<GLsizei>(((std::size_t)(ratio_displayed * nb_points)/3)));
+    vaos[0]->release();
+    program->release();
+  }
+  bool keyPressEvent(QKeyEvent* e){
+    if (e->key()==Qt::Key_S){
+      Q_EMIT stop();
+      return true;
+    }
+    return false;
+  }
+  const Scene_points_with_normal_item* getBase()const{return base;}
+  const qglviewer::Vec& center() const { return center_; }
+  CGAL::Three::Scene_item::ManipulatedFrame* manipulatedFrame() { return frame; }
+Q_SIGNALS:
+  void stop();
+  void killed();
+private:
+  const Scene_points_with_normal_item* base;
+  qglviewer::Vec center_;
+  CGAL::Three::Scene_item::ManipulatedFrame* frame;
+  mutable QOpenGLShaderProgram *program;
+  std::size_t nb_points;
+
+};
+using namespace CGAL::Three;
+class Polyhedron_demo_affine_transform_plugin :
+  public QObject,
+  public Polyhedron_demo_plugin_interface
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+public:
+
+  Polyhedron_demo_affine_transform_plugin():started(false){}
+
+  QList<QAction*> actions() const {
+    return QList<QAction*>() << actionTransformPolyhedron;
+  }
+
+  bool applicable(QAction*) const { 
+    return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex())) ||
+           qobject_cast<Scene_polyhedron_transform_item*>(scene->item(scene->mainSelectionIndex())) ||
+           qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex())) ||
+                   qobject_cast<Scene_transform_point_set_item*>(scene->item(scene->mainSelectionIndex()));
+  }
+  
+  void init(QMainWindow* mw, CGAL::Three::Scene_interface* scene_interface, Messages_interface*) {
+    this->scene = scene_interface;
+    actionTransformPolyhedron = new QAction("Affine Transformation", mw);
+    if(actionTransformPolyhedron) {
+      connect(actionTransformPolyhedron, SIGNAL(triggered()),this, SLOT(go()));
+    }
+    transform_item = NULL;
+    transform_points_item = NULL;
+  }
+
+  void start(Scene_polyhedron_item*);
+  void start(Scene_points_with_normal_item*);
+  void end();  
+  
+private:
+
+  QAction*  actionTransformPolyhedron;
+  Scene_polyhedron_transform_item* transform_item;
+  Scene_transform_point_set_item* transform_points_item;
+  CGAL::Three::Scene_interface::Item_id tr_item_index;
+  CGAL::Three::Scene_interface* scene;
+  bool started;
+
+public Q_SLOTS:
+  void go();
+  void transformed_killed();
+}; // end class Polyhedron_demo_affine_transform_plugin
+
+void Polyhedron_demo_affine_transform_plugin::go(){
+  if (!started){
+    Scene_item* item = scene->item(scene->mainSelectionIndex());
+    Scene_points_with_normal_item* points_item = NULL;
+    Scene_polyhedron_item* poly_item = qobject_cast<Scene_polyhedron_item*>(item);
+    if(!poly_item)
+    {
+      points_item = qobject_cast<Scene_points_with_normal_item*>(item);
+      if(!points_item)
+        return;
+    }
+    started=true;
+    actionTransformPolyhedron->setText("Apply affine transformation");
+    if(poly_item)
+      start(poly_item);
+    else if(points_item)
+      start(points_item);
+  }
+  else
+    end();    
+}
+
+void Polyhedron_demo_affine_transform_plugin::transformed_killed(){
+    started=false;
+    actionTransformPolyhedron->setText("Affine Transformation");
+}
+
+void Polyhedron_demo_affine_transform_plugin::start(Scene_polyhedron_item* poly_item){
+  QApplication::setOverrideCursor(Qt::PointingHandCursor);
+  
+  Scene_polyhedron_item::Bbox bbox = poly_item->bbox();
+  double x=(bbox.xmin()+bbox.xmax())/2;
+  double y=(bbox.ymin()+bbox.ymax())/2;
+  double z=(bbox.zmin()+bbox.zmax())/2;
+  
+  transform_item = new Scene_polyhedron_transform_item(qglviewer::Vec(x,y,z),poly_item,scene);
+  transform_item->setManipulatable(true);
+  transform_item->setColor(Qt::green);
+  transform_item->setRenderingMode(Wireframe);
+  transform_item->setName(tr("Affine Transformation"));
+  connect(transform_item, SIGNAL(stop()),this, SLOT(go()));
+  connect(transform_item, SIGNAL(killed()),this, SLOT(transformed_killed()));
+  tr_item_index=scene->addItem(transform_item);
+  scene->setSelectedItem(tr_item_index);
+}
+
+void Polyhedron_demo_affine_transform_plugin::start(Scene_points_with_normal_item* points_item){
+  QApplication::setOverrideCursor(Qt::PointingHandCursor);
+
+  Scene_points_with_normal_item::Bbox bbox = points_item->bbox();
+  double x=(bbox.xmin()+bbox.xmax())/2;
+  double y=(bbox.ymin()+bbox.ymax())/2;
+  double z=(bbox.zmin()+bbox.zmax())/2;
+
+  transform_points_item = new Scene_transform_point_set_item(points_item,qglviewer::Vec(x,y,z));
+  //transform_points_item->setManipulatable(true);
+  transform_points_item->setRenderingMode(Points);
+  transform_points_item->setName(tr("Affine Transformation"));
+  connect(transform_points_item, SIGNAL(stop()),this, SLOT(go()));
+  connect(transform_points_item, SIGNAL(killed()),this, SLOT(transformed_killed()));
+  tr_item_index=scene->addItem(transform_points_item);
+  scene->setSelectedItem(tr_item_index);
+}
+
+
+struct Modifier_transform_vertices : public CGAL::Modifier_base<Polyhedron::HalfedgeDS> {
+  typedef Polyhedron::HalfedgeDS HDS;
+  
+  CGAL::Aff_transformation_3<Kernel> transform;
+  Kernel::Vector_3 frame_center_translation;
+  Modifier_transform_vertices(const GLdouble* m,const qglviewer::Vec& tr):
+    transform(m[0],m[4], m[8],m[12],
+              m[1],m[5], m[9],m[13],
+              m[2],m[6],m[10],m[14],
+              m[15]),
+    frame_center_translation(-tr.x,-tr.y,-tr.z)
+  {
+    CGAL_assertion(m[3]==0);
+    CGAL_assertion(m[7]==0);
+    CGAL_assertion(m[11]==0);
+  }
+  
+  void operator()(HDS& hds)
+  {
+    for (HDS::Vertex_iterator it=hds.vertices_begin(),
+                                   endit=hds.vertices_end();endit!=it;++it)
+    {
+      it->point() = transform( it->point() + frame_center_translation );
+    }
+  }
+};
+
+
+void Polyhedron_demo_affine_transform_plugin::end(){
+  QApplication::restoreOverrideCursor();
+  if(transform_item)
+  {
+    const GLdouble* matrix = transform_item->manipulatedFrame()->matrix();
+    Modifier_transform_vertices modifier(matrix,transform_item->center());
+    Polyhedron* new_poly=new Polyhedron(*transform_item->getBase()->polyhedron());
+    new_poly->delegate(modifier);
+
+    Scene_polyhedron_item* new_item=new Scene_polyhedron_item(new_poly);
+    new_item->setName(tr("%1_transformed").arg(transform_item->getBase()->name()));
+
+    scene->replaceItem(tr_item_index,new_item);
+    delete transform_item;
+    transform_item = NULL;
+  }
+  else if(transform_points_item)
+  {
+    const GLdouble* matrix = transform_points_item->manipulatedFrame()->matrix();
+    QMatrix4x4 transform_matrix;
+    for(int i=0; i<16; ++i)
+      transform_matrix.data()[i] = (float)matrix[i];
+    const Point_set *base_ps = transform_points_item->getBase()->point_set();
+    Point_set* new_ps = new Point_set();
+    new_ps->reserve(base_ps->size());
+    qglviewer::Vec c = transform_points_item->center();
+    for(std::size_t id = 0; id<base_ps->size(); ++id)
+    {
+      QVector3D vec = transform_matrix * QVector3D(base_ps->at(id).x() - c.x,
+                                base_ps->at(id).y() - c.y,
+                                base_ps->at(id).z() - c.z);
+      UI_point p(vec.x(), vec.y(), vec.z());
+      new_ps->push_back(p);
+    }
+
+
+    Scene_points_with_normal_item* new_item=new Scene_points_with_normal_item();
+    for(std::size_t id = 0; id<new_ps->size(); ++id)
+      new_item->point_set()->push_back(new_ps->at(id));
+    new_item->setName(tr("%1_transformed").arg(transform_points_item->getBase()->name()));
+
+    scene->replaceItem(tr_item_index,new_item);
+    delete transform_points_item;
+    transform_points_item = NULL;
+  }
+
+}
+
+#include "Affine_transform_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/PCA/CMakeLists.txt b/3rdparty/CGAL/demo/Polyhedron/Plugins/PCA/CMakeLists.txt
new file mode 100644
index 0000000..5453f04
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/PCA/CMakeLists.txt
@@ -0,0 +1,11 @@
+include( polyhedron_demo_macros )
+polyhedron_demo_plugin(pca_plugin Pca_plugin)
+target_link_libraries(pca_plugin scene_polyhedron_item scene_basic_objects)
+
+polyhedron_demo_plugin(affine_transform_plugin Affine_transform_plugin)
+target_link_libraries(affine_transform_plugin  scene_polyhedron_item scene_polyhedron_transform_item scene_points_with_normal_item)
+
+polyhedron_demo_plugin(trivial_plugin Trivial_plugin)
+
+polyhedron_demo_plugin(create_bbox_mesh_plugin Create_bbox_mesh_plugin)
+target_link_libraries(create_bbox_mesh_plugin scene_polyhedron_item)
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/PCA/Create_bbox_mesh_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/PCA/Create_bbox_mesh_plugin.cpp
new file mode 100644
index 0000000..bc7a01d
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/PCA/Create_bbox_mesh_plugin.cpp
@@ -0,0 +1,165 @@
+#include <QtCore/qglobal.h>
+
+#include <CGAL/Three/Scene_item.h>
+#include <CGAL/Three/Scene_interface.h>
+#include <CGAL/gl.h>
+#include <CGAL/Polyhedron_incremental_builder_3.h>
+
+#include <QAction>
+#include <QMainWindow>
+#include <QApplication>
+
+#include "Scene_polyhedron_item.h"
+#include "Polyhedron_type.h"
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+
+
+const int cube[][3] = { { 0, 1, 3 },
+                        { 3, 1, 2 },
+                        { 0, 4, 1 },
+                        { 1, 4, 5 },
+                        { 3, 2, 7 },
+                        { 7, 2, 6 },
+                        { 4, 0, 3 },
+                        { 7, 4, 3 },
+                        { 6, 4, 7 },
+                        { 6, 5, 4 },
+                        { 1, 5, 6 },
+                        { 2, 1, 6 } };
+
+using namespace CGAL::Three;
+
+struct Build_bbox_mesh : 
+  public CGAL::Modifier_base<Polyhedron::HalfedgeDS>
+{
+  Scene_interface::Bbox bbox;
+  typedef Polyhedron::HalfedgeDS HDS;
+
+public:
+  Build_bbox_mesh(Scene_interface::Bbox b) : bbox(b) {}
+
+  void operator()( HDS& hds) {
+    CGAL::Polyhedron_incremental_builder_3<HDS> B( hds, true);
+    B.begin_surface( 8, 12, 24);
+    typedef HDS::Vertex   Vertex;
+    typedef Vertex::Point Point;
+    B.add_vertex( Point( bbox.xmin(), bbox.ymin(), bbox.zmin())); // -1 -1 -1
+    B.add_vertex( Point( bbox.xmin(), bbox.ymax(), bbox.zmin())); // -1 1 -1
+    B.add_vertex( Point( bbox.xmax(), bbox.ymax(), bbox.zmin())); // 1 1 -1
+    B.add_vertex( Point( bbox.xmax(), bbox.ymin(), bbox.zmin())); // 1 -1 -1
+    B.add_vertex( Point( bbox.xmin(), bbox.ymin(), bbox.zmax())); // -1 -1 1
+    B.add_vertex( Point( bbox.xmin(), bbox.ymax(), bbox.zmax())); // -1 1 1
+    B.add_vertex( Point( bbox.xmax(), bbox.ymax(), bbox.zmax())); // 1 1 1
+    B.add_vertex( Point( bbox.xmax(), bbox.ymin(), bbox.zmax())); // 1 -1 1
+    for(int i = 0; i < 12; ++i) {
+      B.begin_facet();
+      B.add_vertex_to_facet( cube[i][0]);
+      B.add_vertex_to_facet( cube[i][1]);
+      B.add_vertex_to_facet( cube[i][2]);
+      B.end_facet();
+    }
+    B.end_surface();
+  }
+};
+
+class Create_bbox_mesh_plugin : 
+  public QObject,
+  public CGAL::Three::Polyhedron_demo_plugin_interface
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+public:
+  void init(QMainWindow* mainWindow, Scene_interface* scene_interface, Messages_interface*);
+  QList<QAction*> actions() const;
+  bool applicable(QAction*) const {
+    if(scene->mainSelectionIndex() != -1)
+      return true;
+  return false;}
+
+protected:
+  void bbox(bool extended = false);
+
+public Q_SLOTS:
+  void createBbox() {
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    bbox();
+    QApplication::restoreOverrideCursor();
+  }
+  void createExtendedBbox() {
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    bbox(true);
+    QApplication::restoreOverrideCursor();
+  }
+
+private:
+  Scene_interface* scene;
+  QAction* actionBbox;
+  QAction* actionExtendedBbox;
+
+}; // end Create_bbox_mesh_plugin
+
+void Create_bbox_mesh_plugin::init(QMainWindow* mainWindow, Scene_interface* scene_interface, Messages_interface*)
+{
+  scene = scene_interface;
+  actionBbox = new QAction(tr("Create &Bbox Mesh"), mainWindow);
+  actionBbox->setObjectName("createBboxMeshAction");
+  connect(actionBbox, SIGNAL(triggered()),
+          this, SLOT(createBbox()));
+  actionExtendedBbox = new QAction(tr("Create &Extended Bbox Mesh"), mainWindow);
+  actionExtendedBbox->setObjectName("createExtendedBboxMeshAction");
+  connect(actionExtendedBbox, SIGNAL(triggered()),
+          this, SLOT(createExtendedBbox()));
+}
+
+QList<QAction*> Create_bbox_mesh_plugin::actions() const {
+  return QList<QAction*>() << actionBbox << actionExtendedBbox;
+}
+
+void Create_bbox_mesh_plugin::bbox(bool extended)
+{
+  Scene_interface::Bbox bbox;
+  bool initialized = false;
+
+  Q_FOREACH(int index, scene->selectionIndices()) {
+    Scene_item* item = scene->item(index);
+    if(item->isFinite() && ! item->isEmpty()) {
+      if(initialized) {
+        bbox = bbox + item->bbox();
+      } else {
+        bbox = item->bbox();
+        initialized = true;
+      }
+    }
+  }
+  std::cerr << "bbox dimensions: " << bbox.xmax() - bbox.xmin()
+            << "\n                 " << bbox.ymax() - bbox.ymin()
+            << "\n                 " << bbox.zmax() - bbox.zmin()
+            << std::endl;
+
+  if(extended) {
+    const double delta_x = ( bbox.xmax() - bbox.xmin() ) / 20.;
+    const double delta_y = ( bbox.ymax() - bbox.ymin() ) / 20.;
+    const double delta_z = ( bbox.zmax() - bbox.zmin() ) / 20.;
+bbox = Scene_interface::Bbox(
+    bbox.xmin() - delta_x,
+    bbox.ymin() - delta_y,
+    bbox.zmin() - delta_z,
+    bbox.xmax() + delta_x,
+    bbox.ymax() + delta_y,
+    bbox.zmax() + delta_z);
+  }
+
+  Polyhedron p;
+  
+  Build_bbox_mesh b(bbox);
+  p.delegate(b);
+
+  Scene_item* item = new Scene_polyhedron_item(p);
+  item->setName("Scene bbox mesh");
+  item->setRenderingMode(Wireframe);
+  scene->addItem(item);
+}
+
+#include "Create_bbox_mesh_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/PCA/Pca_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/PCA/Pca_plugin.cpp
new file mode 100644
index 0000000..7db6896
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/PCA/Pca_plugin.cpp
@@ -0,0 +1,210 @@
+#include <QApplication>
+#include <QAction>
+#include <QMainWindow>
+#include "Scene_polyhedron_item.h"
+#include "Scene_plane_item.h"
+#include "Polyhedron_type.h"
+
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+
+#include <CGAL/centroid.h>
+#include <CGAL/bounding_box.h>
+#include <CGAL/linear_least_squares_fitting_3.h>
+
+
+#include <CGAL/Make_quad_soup.h> // output for plane fitting
+#include <CGAL/Make_bar.h> // output for line fitting
+
+#include "Kernel_type.h"
+typedef Kernel::Plane_3 Plane;
+typedef Kernel::Iso_cuboid_3 Iso_cuboid;
+typedef Kernel::Triangle_3 Triangle;
+typedef Kernel::Line_3 Line;
+typedef Kernel::Vector_3 Vector;
+typedef Kernel::Point_3 Point;
+typedef Kernel::FT FT;
+
+using namespace CGAL::Three;
+class Polyhedron_demo_pca_plugin : 
+  public QObject,
+  public Polyhedron_demo_plugin_interface
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+public:
+
+  QList<QAction*> actions() const {
+    return _actions;
+  }
+
+  void init(QMainWindow* mw,
+            Scene_interface* scene_interface,
+            Messages_interface*)
+  {
+      scene = scene_interface;
+      QAction *actionFitPlane = new QAction("Fit Plane", mw);
+      QAction *actionFitLine = new QAction("Fit Line", mw);
+
+      connect(actionFitPlane, SIGNAL(triggered()),
+              this, SLOT(on_actionFitPlane_triggered()));
+      connect(actionFitLine, SIGNAL(triggered()),
+              this, SLOT(on_actionFitLine_triggered()));
+      _actions << actionFitPlane
+               << actionFitLine;
+      Q_FOREACH(QAction* action, _actions)
+        action->setProperty("subMenuName", "Principal Component Analysis");
+
+
+  }
+
+
+  bool applicable(QAction*) const { 
+    return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
+  }
+
+
+public Q_SLOTS:
+  void on_actionFitPlane_triggered();
+  void on_actionFitLine_triggered();
+
+private:
+  Scene_interface* scene;
+  QList<QAction*> _actions;
+}; // end Polyhedron_demo_pca_plugin
+
+void Polyhedron_demo_pca_plugin::on_actionFitPlane_triggered()
+{
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+  
+  Scene_polyhedron_item* item = 
+    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+
+  if(item)
+  {
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    Polyhedron* pMesh = item->polyhedron();
+
+    // get triangles from the mesh
+    std::list<Triangle> triangles;
+    Polyhedron::Facet_iterator f;
+    for(f = pMesh->facets_begin();
+      f != pMesh->facets_end();
+      ++f)
+    {
+      const Point& a = f->halfedge()->vertex()->point();
+      const Point& b = f->halfedge()->next()->vertex()->point();
+      const Point& c = f->halfedge()->prev()->vertex()->point();
+      triangles.push_back(Triangle(a,b,c));
+    }
+
+    // fit plane to triangles
+    Plane plane;
+    std::cout << "Fit plane...";
+    CGAL::linear_least_squares_fitting_3(triangles.begin(),triangles.end(),plane,CGAL::Dimension_tag<2>());
+    std::cout << "ok" << std::endl;
+
+    // compute centroid
+    Point center_of_mass = CGAL::centroid(triangles.begin(),triangles.end());
+    Scene_plane_item* new_item = new Scene_plane_item(this->scene);
+    new_item->setPosition(center_of_mass.x(),
+                          center_of_mass.y(),
+                          center_of_mass.z());
+    const Vector& normal = plane.orthogonal_vector();
+    new_item->setNormal(normal.x(), normal.y(), normal.z());
+    new_item->setName(tr("%1 (plane fit)").arg(item->name()));
+    new_item->setColor(Qt::magenta);
+    new_item->setRenderingMode(item->renderingMode());
+    scene->addItem(new_item);
+
+    QApplication::restoreOverrideCursor();
+  }
+}
+
+void Polyhedron_demo_pca_plugin::on_actionFitLine_triggered()
+{
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+  
+  Scene_polyhedron_item* item = 
+    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+
+  if(item)
+  {
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    Polyhedron* pMesh = item->polyhedron();
+
+    // get triangles from the mesh
+    std::list<Triangle> triangles;
+    Polyhedron::Facet_iterator f;
+    for(f = pMesh->facets_begin();
+      f != pMesh->facets_end();
+      ++f)
+    {
+      const Point& a = f->halfedge()->vertex()->point();
+      const Point& b = f->halfedge()->next()->vertex()->point();
+      const Point& c = f->halfedge()->prev()->vertex()->point();
+      triangles.push_back(Triangle(a,b,c));
+    }
+
+    // fit line to triangles
+    Line line;
+    std::cout << "Fit line...";
+    CGAL::linear_least_squares_fitting_3(triangles.begin(),triangles.end(),line,CGAL::Dimension_tag<2>());
+    std::cout << "ok" << std::endl;
+
+    // compute centroid
+    Point center_of_mass = CGAL::centroid(triangles.begin(),triangles.end());
+
+    // compute bounding box diagonal
+    Iso_cuboid bbox = CGAL::bounding_box(pMesh->points_begin(),pMesh->points_end());
+
+    // compute scale for rendering using diagonal of bbox
+    Point cmin = (bbox.min)();
+    Point cmax = (bbox.max)();
+    FT diag = std::sqrt(CGAL::squared_distance(cmin,cmax));
+
+    // construct a 3D bar
+    Vector u = line.to_vector();
+    u = u / std::sqrt(u*u);
+
+    Point a = center_of_mass + u * diag;
+    Point b = center_of_mass - u * diag;
+
+    Plane plane_a = line.perpendicular_plane(a);
+
+    Vector u1 = plane_a.base1();
+    u1 = u1 / std::sqrt(u1*u1);
+    u1 = u1 * 0.01 * diag;
+    Vector u2 = plane_a.base2();
+    u2 = u2 / std::sqrt(u2*u2);
+    u2 = u2 * 0.01 * diag;
+
+    Point points[8];
+
+    points[0] = a + u1;
+    points[1] = a + u2;
+    points[2] = a - u1;
+    points[3] = a - u2;
+
+    points[4] = b + u1;
+    points[5] = b + u2;
+    points[6] = b - u1;
+    points[7] = b - u2;
+
+    // add best fit line as new polyhedron bar
+    Polyhedron *pFit = new Polyhedron;
+    Make_bar<Polyhedron,Kernel> bar;
+    bar.run(points,*pFit);
+
+    Scene_polyhedron_item* new_item = new Scene_polyhedron_item(pFit);
+    new_item->setName(tr("%1 (line fit)").arg(item->name()));
+    new_item->setColor(Qt::magenta);
+    new_item->setRenderingMode(item->renderingMode());
+    scene->addItem(new_item);
+
+    QApplication::restoreOverrideCursor();
+  }
+}
+
+#include "Pca_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/PCA/Scene_polyhedron_transform_item.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/PCA/Scene_polyhedron_transform_item.cpp
new file mode 100644
index 0000000..550151a
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/PCA/Scene_polyhedron_transform_item.cpp
@@ -0,0 +1,170 @@
+#include <QApplication>
+#include "Scene_polyhedron_transform_item.h"
+#include "Kernel_type.h"
+#include "Polyhedron_type.h"
+#include <CGAL/Three/Viewer_interface.h>
+
+struct Scene_polyhedron_transform_item_priv
+{
+  Scene_polyhedron_transform_item_priv(const qglviewer::Vec& pos,const Scene_polyhedron_item* poly_item, Scene_polyhedron_transform_item *parent)
+    : poly_item(poly_item),
+      manipulable(false),
+      frame(new CGAL::Three::Scene_item::ManipulatedFrame()),
+      poly(poly_item->polyhedron()),
+      center_(pos)
+  {
+    item = parent;
+    frame->setPosition(pos);
+    nb_lines = 0;
+  }
+  ~Scene_polyhedron_transform_item_priv()
+{
+  delete frame;
+}
+  void initialize_buffers(CGAL::Three::Viewer_interface *viewer) const;
+  void compute_elements() const;
+  enum VAOs {
+      Edges=0,
+      NbOfVaos
+  };
+  enum VBOs {
+      Vertices = 0,
+      NbOfVbos
+  };
+
+  const Scene_polyhedron_item* poly_item;
+  bool manipulable;
+  qglviewer::ManipulatedFrame* frame;
+  const Polyhedron* poly;
+  qglviewer::Vec center_;
+  Scene_polyhedron_transform_item *item;
+
+
+  mutable QOpenGLShaderProgram *program;
+  mutable std::vector<float> positions_lines;
+  mutable std::size_t nb_lines;
+};
+
+Scene_polyhedron_transform_item::Scene_polyhedron_transform_item(const qglviewer::Vec& pos,const Scene_polyhedron_item* poly_item_,const CGAL::Three::Scene_interface*):
+    Scene_item(Scene_polyhedron_transform_item_priv::NbOfVbos,Scene_polyhedron_transform_item_priv::NbOfVaos)
+{
+  d = new Scene_polyhedron_transform_item_priv(pos,poly_item_, this);
+    invalidateOpenGLBuffers();
+}
+
+
+void Scene_polyhedron_transform_item_priv::initialize_buffers(CGAL::Three::Viewer_interface *viewer =0) const
+{
+    //vao for the edges
+    {
+        program = item->getShaderProgram(Scene_polyhedron_transform_item::PROGRAM_WITHOUT_LIGHT, viewer);
+        program->bind();
+
+        item->vaos[Edges]->bind();
+        item->buffers[Vertices].bind();
+        item->buffers[Vertices].allocate(positions_lines.data(),
+                            static_cast<int>(positions_lines.size()*sizeof(float)));
+        program->enableAttributeArray("vertex");
+        program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
+        item->buffers[Vertices].release();
+        item->vaos[Edges]->release();
+
+        program->release();
+    }
+    nb_lines = positions_lines.size();
+    positions_lines.resize(0);
+    std::vector<float>(positions_lines).swap(positions_lines);
+
+    item->are_buffers_filled = true;
+}
+
+
+void Scene_polyhedron_transform_item_priv::compute_elements() const
+{
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    positions_lines.resize(0);
+    typedef Kernel::Point_3		        Point;
+    typedef Polyhedron::Edge_const_iterator	Edge_iterator;
+
+    Edge_iterator he;
+    for(he = poly->edges_begin();
+        he != poly->edges_end();
+        he++)
+    {
+        const Point& a = he->vertex()->point();
+        const Point& b = he->opposite()->vertex()->point();
+        positions_lines.push_back(a.x()-center_.x);
+        positions_lines.push_back(a.y()-center_.y);
+        positions_lines.push_back(a.z()-center_.z);
+
+        positions_lines.push_back(b.x()-center_.x);
+        positions_lines.push_back(b.y()-center_.y);
+        positions_lines.push_back(b.z()-center_.z);
+
+    }
+    QApplication::restoreOverrideCursor();
+}
+
+void Scene_polyhedron_transform_item::drawEdges(CGAL::Three::Viewer_interface* viewer) const
+{
+    if(!are_buffers_filled)
+        d->initialize_buffers(viewer);
+    vaos[Scene_polyhedron_transform_item_priv::Edges]->bind();
+    d->program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
+    attribBuffers(viewer,PROGRAM_WITHOUT_LIGHT);
+    d->program->bind();
+    QMatrix4x4 f_matrix;
+    for (int i=0; i<16; ++i){
+        f_matrix.data()[i] = (float)d->frame->matrix()[i];
+    }
+    QColor color = this->color();
+    d->program->setAttributeValue("colors",color);
+    d->program->setUniformValue("f_matrix", f_matrix);
+    d->program->setUniformValue("is_selected", false);
+    viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(d->nb_lines/3));
+    vaos[Scene_polyhedron_transform_item_priv::Edges]->release();
+    d->program->release();
+
+}
+
+QString Scene_polyhedron_transform_item::toolTip() const {
+    return QObject::tr("<p>Affine transformation of <b>%1</b></p>"
+                       "<p>Keep <b>Ctrl</b> pressed and use the arcball to define an affine transformation.<br />"
+                       "Press <b>S</b> to apply the affine transformation to a copy of <b>%1</b>.</p>")
+            .arg(getBase()->name());
+}
+bool Scene_polyhedron_transform_item::keyPressEvent(QKeyEvent* e){
+    if (e->key()==Qt::Key_S){
+    Q_EMIT stop();
+        return true;
+    }
+    return false;
+}
+
+void
+Scene_polyhedron_transform_item::compute_bbox() const {
+    const Kernel::Point_3& p = *(d->poly->points_begin());
+    CGAL::Bbox_3 bbox(p.x(), p.y(), p.z(), p.x(), p.y(), p.z());
+    for(Polyhedron::Point_const_iterator it = d->poly->points_begin();
+        it != d->poly->points_end();
+        ++it) {
+        bbox = bbox + it->bbox();
+    }
+    _bbox = Bbox(bbox.xmin(),bbox.ymin(),bbox.zmin(),
+                bbox.xmax(),bbox.ymax(),bbox.zmax());
+}
+
+
+void Scene_polyhedron_transform_item::invalidateOpenGLBuffers()
+{
+    d->compute_elements();
+    are_buffers_filled = false;
+    compute_bbox();
+}
+
+bool Scene_polyhedron_transform_item::manipulatable() const { return d->manipulable; }
+CGAL::Three::Scene_item::ManipulatedFrame* Scene_polyhedron_transform_item::manipulatedFrame() { return d->frame; }
+void Scene_polyhedron_transform_item::setManipulatable(bool b = true) { d->manipulable = b;}
+const Scene_polyhedron_item* Scene_polyhedron_transform_item::getBase() const{ return d->poly_item;  };
+const qglviewer::Vec& Scene_polyhedron_transform_item::center() const { return d->center_; }
+Scene_polyhedron_transform_item::~Scene_polyhedron_transform_item() { delete d; Q_EMIT killed(); }
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/PCA/Scene_polyhedron_transform_item.h b/3rdparty/CGAL/demo/Polyhedron/Plugins/PCA/Scene_polyhedron_transform_item.h
new file mode 100644
index 0000000..f306320
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/PCA/Scene_polyhedron_transform_item.h
@@ -0,0 +1,42 @@
+#ifndef SCENE_POLYHEDRON_TRANSFORM_ITEM_H
+#define SCENE_POLYHEDRON_TRANSFORM_ITEM_H
+
+#include "Scene_polyhedron_item.h"
+#include "Scene_polyhedron_transform_item_config.h"
+#include <QGLViewer/manipulatedFrame.h>
+#include <QGLViewer/qglviewer.h>
+#include <QKeyEvent>
+struct Scene_polyhedron_transform_item_priv;
+// This class represents a polyhedron in the OpenGL scene
+class SCENE_POLYHEDRON_TRANSFORM_ITEM_EXPORT Scene_polyhedron_transform_item 
+        : public CGAL::Three::Scene_item {
+    Q_OBJECT
+    
+    typedef Scene_polyhedron_item Base;
+    
+public: 
+    Scene_polyhedron_transform_item(const qglviewer::Vec& pos,const Scene_polyhedron_item* poly_item,const CGAL::Three::Scene_interface* scene_interface);
+    Scene_item* clone() const{return NULL;}
+    QString toolTip() const;
+    void drawEdges(CGAL::Three::Viewer_interface*) const;
+    void compute_bbox() const;
+    ~Scene_polyhedron_transform_item();
+    bool manipulatable() const;
+    ManipulatedFrame* manipulatedFrame();
+    void setManipulatable(bool);
+    const Scene_polyhedron_item* getBase() const;
+    const qglviewer::Vec& center() const;
+    virtual bool supportsRenderingMode(RenderingMode m) const { return m==Wireframe ; }
+    virtual void invalidateOpenGLBuffers();
+    virtual bool keyPressEvent(QKeyEvent*);
+
+protected:
+    friend struct Scene_polyhedron_transform_item_priv;
+    Scene_polyhedron_transform_item_priv* d;
+
+Q_SIGNALS:
+    void stop();
+    void killed();
+}; // end class Scene_polyhedron_transform_item
+
+#endif // SCENE_POLYHEDRON_TRANSFORM_ITEM_H
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/PCA/Trivial_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/PCA/Trivial_plugin.cpp
new file mode 100644
index 0000000..a169632
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/PCA/Trivial_plugin.cpp
@@ -0,0 +1,205 @@
+#include <QtCore/qglobal.h>
+
+#include  <CGAL/Three/Scene_item.h>
+#include <CGAL/Three/Scene_interface.h>
+#include <CGAL/gl.h>
+
+#include <CGAL/Three/Viewer_interface.h>
+#include <QAction>
+#include <QMainWindow>
+#include <QApplication>
+
+class Q_DECL_EXPORT Scene_bbox_item : public CGAL::Three::Scene_item
+{
+    Q_OBJECT
+public:
+    Scene_bbox_item(const CGAL::Three::Scene_interface* scene_interface)
+        :  Scene_item(1,1), scene(scene_interface)
+
+    {
+        positions_lines.resize(0);
+        are_buffers_filled = false;
+    }
+    ~Scene_bbox_item()
+    {
+    }
+    bool isFinite() const { return true; }
+    bool isEmpty() const { return true; }
+    void compute_bbox() const { _bbox = scene->bbox(); }
+
+    Scene_bbox_item* clone() const {
+        return 0;
+    }
+
+    QString toolTip() const {
+        const Bbox& bb = scene->bbox();
+        return QString("<p><b>Scene bounding box</b></p>"
+                       "<p>x range: (%1, %2)<br />"
+                       "y range: (%3, %4)<br />"
+                       "z range: (%5, %6)</p>")
+                .arg(bb.xmin()).arg(bb.xmax())
+                .arg(bb.ymin()).arg(bb.ymax())
+                .arg(bb.zmin()).arg(bb.zmax());
+    }
+
+    // Indicate if rendering mode is supported
+    bool supportsRenderingMode(RenderingMode m) const {
+        return (m == Wireframe);
+    }
+
+    void drawEdges(CGAL::Three::Viewer_interface* viewer) const
+    {
+        if(!are_buffers_filled)
+        {
+            computeElements();
+            initializeBuffers(viewer);
+        }
+        vaos[0]->bind();
+        program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
+        attribBuffers(viewer, PROGRAM_WITHOUT_LIGHT);
+        program->bind();
+        program->setAttributeValue("colors", this->color());
+        viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(positions_lines.size()/3));
+        vaos[0]->release();
+        program->release();
+
+    }
+
+    void invalidateOpenGLBuffers()
+    {
+        compute_bbox();
+        are_buffers_filled = false;
+    }
+
+private:
+
+    mutable std::vector<float> positions_lines;
+    mutable QOpenGLShaderProgram *program;
+    using CGAL::Three::Scene_item::initializeBuffers;
+    void initializeBuffers(CGAL::Three::Viewer_interface *viewer)const
+    {
+
+        //vao containing the data for the lines
+        {
+            program = getShaderProgram(PROGRAM_WITHOUT_LIGHT, viewer);
+            program->bind();
+
+            vaos[0]->bind();
+            buffers[0].bind();
+            buffers[0].allocate(positions_lines.data(),
+                                static_cast<GLsizei>(positions_lines.size()*sizeof(float)));
+            program->enableAttributeArray("vertex");
+            program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
+            buffers[0].release();
+
+            vaos[0]->release();
+            program->release();
+
+        }
+        are_buffers_filled = true;
+    }
+
+    void computeElements() const
+    {
+        QApplication::setOverrideCursor(Qt::WaitCursor);
+        positions_lines.clear();
+        const Bbox& bb = scene->bbox();
+        positions_lines.push_back(bb.xmin()); positions_lines.push_back(bb.ymin()); positions_lines.push_back(bb.zmin());
+        positions_lines.push_back(bb.xmax()); positions_lines.push_back(bb.ymin()); positions_lines.push_back(bb.zmin());
+        positions_lines.push_back(bb.xmin()); positions_lines.push_back(bb.ymin()); positions_lines.push_back(bb.zmin());
+        positions_lines.push_back(bb.xmin()); positions_lines.push_back(bb.ymax()); positions_lines.push_back(bb.zmin());
+        positions_lines.push_back(bb.xmin()); positions_lines.push_back(bb.ymin()); positions_lines.push_back(bb.zmin());
+        positions_lines.push_back(bb.xmin()); positions_lines.push_back(bb.ymin()); positions_lines.push_back(bb.zmax());
+
+        positions_lines.push_back(bb.xmax()); positions_lines.push_back(bb.ymin()); positions_lines.push_back(bb.zmin());
+        positions_lines.push_back(bb.xmax()); positions_lines.push_back(bb.ymax()); positions_lines.push_back(bb.zmin());
+        positions_lines.push_back(bb.xmax()); positions_lines.push_back(bb.ymin()); positions_lines.push_back(bb.zmin());
+        positions_lines.push_back(bb.xmax()); positions_lines.push_back(bb.ymin()); positions_lines.push_back(bb.zmax());
+
+        positions_lines.push_back(bb.xmin()); positions_lines.push_back(bb.ymax()); positions_lines.push_back(bb.zmin());
+        positions_lines.push_back(bb.xmax()); positions_lines.push_back(bb.ymax()); positions_lines.push_back(bb.zmin());
+        positions_lines.push_back(bb.xmin()); positions_lines.push_back(bb.ymax()); positions_lines.push_back(bb.zmin());
+        positions_lines.push_back(bb.xmin()); positions_lines.push_back(bb.ymax()); positions_lines.push_back(bb.zmax());
+
+        positions_lines.push_back(bb.xmin()); positions_lines.push_back(bb.ymin()); positions_lines.push_back(bb.zmax());
+        positions_lines.push_back(bb.xmax()); positions_lines.push_back(bb.ymin()); positions_lines.push_back(bb.zmax());
+        positions_lines.push_back(bb.xmin()); positions_lines.push_back(bb.ymin()); positions_lines.push_back(bb.zmax());
+        positions_lines.push_back(bb.xmin()); positions_lines.push_back(bb.ymax()); positions_lines.push_back(bb.zmax());
+
+        positions_lines.push_back(bb.xmax()); positions_lines.push_back(bb.ymax()); positions_lines.push_back(bb.zmax());
+        positions_lines.push_back(bb.xmin()); positions_lines.push_back(bb.ymax()); positions_lines.push_back(bb.zmax());
+        positions_lines.push_back(bb.xmax()); positions_lines.push_back(bb.ymax()); positions_lines.push_back(bb.zmax());
+        positions_lines.push_back(bb.xmax()); positions_lines.push_back(bb.ymin()); positions_lines.push_back(bb.zmax());
+        positions_lines.push_back(bb.xmax()); positions_lines.push_back(bb.ymax()); positions_lines.push_back(bb.zmax());
+        positions_lines.push_back(bb.xmax()); positions_lines.push_back(bb.ymax()); positions_lines.push_back(bb.zmin());
+        QApplication::restoreOverrideCursor();
+    }
+
+    const CGAL::Three::Scene_interface* scene;
+};
+
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+using namespace CGAL::Three;
+class Polyhedron_demo_trivial_plugin : 
+        public QObject,
+        public Polyhedron_demo_plugin_interface
+{
+    Q_OBJECT
+    Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+    Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+public:
+    void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*);
+    QList<QAction*> actions() const {
+        return QList<QAction*>() << actionBbox;
+    }
+
+    bool applicable(QAction*) const {
+      if(scene->numberOfEntries() > 0)
+        return true;
+    return false;}
+public Q_SLOTS:
+
+    void bbox();
+    void enableAction();
+
+private:
+    CGAL::Three::Scene_interface* scene;
+    QAction* actionBbox;
+
+
+}; // end Polyhedron_demo_trivial_plugin
+
+void Polyhedron_demo_trivial_plugin::init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*)
+{
+    scene = scene_interface;
+    actionBbox = new QAction(tr("Create Bbox"), mainWindow);
+    connect(actionBbox, SIGNAL(triggered()),
+            this, SLOT(bbox()));
+}
+
+void Polyhedron_demo_trivial_plugin::bbox()
+{
+    for(int i = 0, end = scene->numberOfEntries();
+        i < end; ++i)
+    {
+        if(qobject_cast<Scene_bbox_item*>(scene->item(i)))
+            return;
+    }
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    Scene_item* item = new Scene_bbox_item(scene);
+    connect(item, SIGNAL(destroyed()),
+            this, SLOT(enableAction()));
+    item->setName("Scene bbox");
+    item->setColor(Qt::black);
+    item->setRenderingMode(Wireframe);
+    scene->addItem(item);
+    actionBbox->setEnabled(false);
+    QApplication::restoreOverrideCursor();
+}
+
+void Polyhedron_demo_trivial_plugin::enableAction() {
+    actionBbox->setEnabled(true);
+}
+
+#include "Trivial_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/CMakeLists.txt b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/CMakeLists.txt
new file mode 100644
index 0000000..663d099
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/CMakeLists.txt
@@ -0,0 +1,77 @@
+include( polyhedron_demo_macros )
+if(EIGEN3_FOUND)
+
+  polyhedron_demo_plugin(jet_fitting_plugin Jet_fitting_plugin)
+  target_link_libraries(jet_fitting_plugin scene_polyhedron_item scene_polylines_item)
+
+else(EIGEN3_FOUND)
+  message(STATUS "NOTICE: Eigen 3.1 (or greater) was not found. Jet fitting plugin will not be available.")
+endif(EIGEN3_FOUND)
+
+if(EIGEN3_FOUND)
+  if("${EIGEN3_VERSION}" VERSION_GREATER "3.1.90")
+
+    qt5_wrap_ui( hole_fillingUI_FILES Hole_filling_widget.ui)
+    polyhedron_demo_plugin(hole_filling_plugin Hole_filling_plugin ${hole_fillingUI_FILES})
+    target_link_libraries(hole_filling_plugin scene_polyhedron_item scene_polylines_item)
+
+    qt5_wrap_ui( fairingUI_FILES Fairing_widget.ui)
+    polyhedron_demo_plugin(fairing_plugin Fairing_plugin ${fairingUI_FILES})
+    target_link_libraries(fairing_plugin scene_polyhedron_selection_item)
+
+    polyhedron_demo_plugin(hole_filling_polyline_plugin Hole_filling_polyline_plugin)
+    target_link_libraries(hole_filling_polyline_plugin scene_polyhedron_item scene_polylines_item)
+  else()
+    message(STATUS "NOTICE: The hole filling and fairing plugins require Eigen 3.2 (or higher) and will not be available.")
+  endif()
+else()
+  message(STATUS "NOTICE: The hole filling and fairing plugins require Eigen 3.2 (or higher) and will not be available.")
+endif()
+
+
+polyhedron_demo_plugin(orient_soup_plugin Orient_soup_plugin)
+target_link_libraries(orient_soup_plugin scene_polygon_soup_item scene_polyhedron_item scene_surface_mesh_item)
+
+
+polyhedron_demo_plugin(inside_out_plugin Inside_out_plugin)
+target_link_libraries(inside_out_plugin scene_polyhedron_item scene_polygon_soup_item)
+
+polyhedron_demo_plugin(join_and_split_polyhedra_plugin Join_and_split_polyhedra_plugin)
+target_link_libraries(join_and_split_polyhedra_plugin scene_polyhedron_item scene_polyhedron_selection_item)
+
+qt5_wrap_ui( Mean_curvature_flow_skeleton_pluginUI_FILES  Mean_curvature_flow_skeleton_plugin.ui)
+polyhedron_demo_plugin(mean_curvature_flow_skeleton_plugin Mean_curvature_flow_skeleton_plugin ${Mean_curvature_flow_skeleton_pluginUI_FILES})
+target_link_libraries(mean_curvature_flow_skeleton_plugin 
+    scene_polyhedron_item 
+    scene_points_with_normal_item
+    scene_polylines_item
+    demo_framework)
+    
+qt5_wrap_ui( point_inside_polyhedronUI_FILES Point_inside_polyhedron_widget.ui)
+polyhedron_demo_plugin(point_inside_polyhedron_plugin Point_inside_polyhedron_plugin ${point_inside_polyhedronUI_FILES})
+target_link_libraries(point_inside_polyhedron_plugin scene_polyhedron_item scene_points_with_normal_item)
+
+
+qt5_wrap_ui( polyhedron_slicerUI_FILES Polyhedron_slicer_widget.ui)
+polyhedron_demo_plugin(polyhedron_slicer_plugin Polyhedron_slicer_plugin ${polyhedron_slicerUI_FILES})
+target_link_libraries(polyhedron_slicer_plugin scene_polyhedron_item scene_basic_objects scene_polylines_item)
+
+polyhedron_demo_plugin(polyhedron_stitching_plugin Polyhedron_stitching_plugin)
+target_link_libraries(polyhedron_stitching_plugin scene_polyhedron_item scene_polylines_item)
+
+qt5_wrap_ui( selectionUI_FILES Selection_widget.ui)
+polyhedron_demo_plugin(selection_plugin Selection_plugin ${selectionUI_FILES})
+target_link_libraries(selection_plugin scene_polyhedron_selection_item scene_points_with_normal_item scene_polylines_item)
+
+polyhedron_demo_plugin(self_intersection_plugin Self_intersection_plugin)
+target_link_libraries(self_intersection_plugin scene_polyhedron_item scene_polyhedron_selection_item)
+
+polyhedron_demo_plugin(triangulate_facets_plugin Triangulate_facets_plugin)
+target_link_libraries(triangulate_facets_plugin scene_polyhedron_item)
+
+polyhedron_demo_plugin(repair_polyhedron_plugin Repair_polyhedron_plugin)
+target_link_libraries(repair_polyhedron_plugin scene_polyhedron_item)
+
+qt5_wrap_ui( isotropicRemeshingUI_FILES Isotropic_remeshing_dialog.ui)
+polyhedron_demo_plugin(isotropic_remeshing_plugin Isotropic_remeshing_plugin  ${isotropicRemeshingUI_FILES})
+target_link_libraries(isotropic_remeshing_plugin  scene_polyhedron_item scene_polyhedron_selection_item)
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Fairing_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Fairing_plugin.cpp
new file mode 100644
index 0000000..83f0e7a
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Fairing_plugin.cpp
@@ -0,0 +1,135 @@
+#undef NDEBUG
+#include <QtCore/qglobal.h>
+
+#include "Messages_interface.h"
+#include "Scene_polyhedron_selection_item.h"
+#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
+#include "ui_Fairing_widget.h"
+#include "Polyhedron_type.h"
+
+#include <CGAL/iterator.h>
+#include <CGAL/Polygon_mesh_processing/fair.h>
+#include <CGAL/Polygon_mesh_processing/refine.h>
+
+#include <QTime>
+#include <QAction>
+#include <QMainWindow>
+#include <QApplication>
+#include <QDockWidget>
+#include <QEvent>
+#include <QKeyEvent>
+#include <QMouseEvent>
+#include <QFileDialog>
+
+#include <vector>
+#include <algorithm>
+#include <queue>
+
+using namespace CGAL::Three;
+class Polyhedron_demo_fairing_plugin :
+  public QObject,
+  public Polyhedron_demo_plugin_helper
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+public:
+  bool applicable(QAction*) const { 
+    return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()))
+    || qobject_cast<Scene_polyhedron_selection_item*>(scene->item(scene->mainSelectionIndex()));  
+  }
+  void print_message(QString message) { messages->information(message);}
+  QList<QAction*> actions() const { return QList<QAction*>() << actionFairing; }
+
+
+  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface* m) {
+    mw = mainWindow;
+    scene = scene_interface;
+    messages = m;
+    actionFairing = new QAction(tr("Refinement and Fairing"), mw);
+    actionFairing->setProperty("subMenuName", "Polygon Mesh Processing");
+
+    connect(actionFairing, SIGNAL(triggered()), this, SLOT(fairing_action()));
+
+    dock_widget = new QDockWidget("Refinement and Fairing", mw);
+    dock_widget->setVisible(false);
+
+    ui_widget.setupUi(dock_widget);
+    addDockWidget(dock_widget);
+
+    connect(ui_widget.Fair_button,  SIGNAL(clicked()), this, SLOT(on_Fair_button_clicked()));  
+    connect(ui_widget.Refine_button,  SIGNAL(clicked()), this, SLOT(on_Refine_button_clicked()));
+  }
+  virtual void closure()
+  {
+    dock_widget->hide();
+  }
+
+public Q_SLOTS:
+  void fairing_action() {
+    dock_widget->show();
+    dock_widget->raise();
+  }
+
+  void on_Fair_button_clicked() {
+    Scene_polyhedron_selection_item* selection_item = getSelectedItem<Scene_polyhedron_selection_item>();
+    if(!selection_item) { return; }
+
+    if(selection_item->selected_vertices.empty()) {
+      print_message("Error: please select a region of vertices!");
+    }
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    int weight_index = ui_widget.Weight_combo_box->currentIndex();
+    unsigned int continuity = ui_widget.Continuity_spin_box->value();
+
+    if(weight_index == 1)
+      CGAL::Polygon_mesh_processing::fair(*selection_item->polyhedron(),
+        selection_item->selected_vertices,
+        CGAL::Polygon_mesh_processing::parameters::weight_calculator(CGAL::internal::Uniform_weight_fairing<Polyhedron>(*selection_item->polyhedron())).
+        fairing_continuity(continuity));
+    if(weight_index == 0)
+      CGAL::Polygon_mesh_processing::fair(*selection_item->polyhedron(),
+        selection_item->selected_vertices,
+        CGAL::Polygon_mesh_processing::parameters::fairing_continuity(continuity));
+    selection_item->changed_with_poly_item();
+    selection_item->invalidateOpenGLBuffers();
+    QApplication::restoreOverrideCursor();
+  }
+
+  void on_Refine_button_clicked() {
+    Scene_polyhedron_selection_item* selection_item = getSelectedItem<Scene_polyhedron_selection_item>();
+    if(!selection_item) { return; }
+
+    if(selection_item->selected_facets.empty()) {
+      print_message("Error: please select a region of facets!");
+    }
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    double alpha = ui_widget.Density_control_factor_spin_box->value();
+    std::vector<Polyhedron::Facet_handle> new_facets;
+
+    CGAL::Polygon_mesh_processing::refine(*selection_item->polyhedron(),
+      selection_item->selected_facets,
+      std::back_inserter(new_facets),
+      CGAL::Emptyset_iterator(),
+      CGAL::Polygon_mesh_processing::parameters::density_control_factor(alpha));
+    // add new facets to selection
+    for(std::vector<Polyhedron::Facet_handle>::iterator it = new_facets.begin(); it != new_facets.end(); ++it) {
+      selection_item->selected_facets.insert(*it);
+    }
+    selection_item->changed_with_poly_item();
+    selection_item->invalidateOpenGLBuffers();
+    QApplication::restoreOverrideCursor();
+  }
+
+private:
+  Messages_interface* messages;
+  QAction* actionFairing;
+
+  QDockWidget* dock_widget;
+  Ui::Fairing ui_widget;
+
+}; // end Polyhedron_demo_fairing_plugin
+
+// Q_EXPORT_PLUGIN2(Polyhedron_demo_fairing_plugin, Polyhedron_demo_fairing_plugin)
+
+#include "Fairing_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Fairing_widget.ui b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Fairing_widget.ui
new file mode 100644
index 0000000..0b516bb
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Fairing_widget.ui
@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Fairing</class>
+ <widget class="QDockWidget" name="Fairing">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>342</width>
+    <height>274</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Fairing</string>
+  </property>
+  <widget class="QWidget" name="dockWidgetContents">
+   <layout class="QVBoxLayout" name="verticalLayout">
+    <item>
+     <widget class="QGroupBox" name="groupBox">
+      <property name="title">
+       <string>Fairing</string>
+      </property>
+      <layout class="QVBoxLayout" name="verticalLayout_2">
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout_4">
+         <item>
+          <widget class="QLabel" name="label_2">
+           <property name="text">
+            <string>Weight Type:</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QComboBox" name="Weight_combo_box">
+           <property name="currentIndex">
+            <number>0</number>
+           </property>
+           <item>
+            <property name="text">
+             <string>Cotangent Weight</string>
+            </property>
+           </item>
+           <item>
+            <property name="text">
+             <string>Uniform Weight</string>
+            </property>
+           </item>
+          </widget>
+         </item>
+        </layout>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout_2">
+         <item>
+          <widget class="QLabel" name="label_3">
+           <property name="text">
+            <string>Continuity:</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QSpinBox" name="Continuity_spin_box">
+           <property name="minimum">
+            <number>0</number>
+           </property>
+           <property name="maximum">
+            <number>2</number>
+           </property>
+           <property name="value">
+            <number>1</number>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+       <item>
+        <widget class="QPushButton" name="Fair_button">
+         <property name="text">
+          <string>Fair a region defined by a selection of vertices</string>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </widget>
+    </item>
+    <item>
+     <widget class="QGroupBox" name="groupBox_2">
+      <property name="title">
+       <string>Refinement</string>
+      </property>
+      <layout class="QVBoxLayout" name="verticalLayout_3">
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout">
+         <item>
+          <widget class="QLabel" name="label">
+           <property name="text">
+            <string>Density Control Factor:</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QDoubleSpinBox" name="Density_control_factor_spin_box">
+           <property name="maximum">
+            <double>96.989999999999995</double>
+           </property>
+           <property name="singleStep">
+            <double>0.200000000000000</double>
+           </property>
+           <property name="value">
+            <double>2.410000000000000</double>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+       <item>
+        <widget class="QPushButton" name="Refine_button">
+         <property name="text">
+          <string>Refine a region defined by a selection of faces</string>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </widget>
+    </item>
+    <item>
+     <spacer name="verticalSpacer">
+      <property name="orientation">
+       <enum>Qt::Vertical</enum>
+      </property>
+      <property name="sizeHint" stdset="0">
+       <size>
+        <width>20</width>
+        <height>40</height>
+       </size>
+      </property>
+     </spacer>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Hole_filling_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Hole_filling_plugin.cpp
new file mode 100644
index 0000000..151ec58
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Hole_filling_plugin.cpp
@@ -0,0 +1,703 @@
+#undef NDEBUG
+#define DEBUG_TRACE
+#include <QtCore/qglobal.h>
+
+#include "Messages_interface.h"
+#include "Scene_polyhedron_item.h"
+#include "Scene_polylines_item.h"
+#include "Scene.h"
+
+#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
+#include "ui_Hole_filling_widget.h"
+#include "Polyhedron_type.h"
+
+#include <CGAL/Polygon_mesh_processing/triangulate_hole.h>
+#include <CGAL/Timer.h>
+#include <CGAL/iterator.h>
+
+#include <QTime>
+#include <QAction>
+#include <QMainWindow>
+#include <QApplication>
+#include <QDockWidget>
+
+#include <QEvent>
+#include <QKeyEvent>
+#include <QMouseEvent>
+
+#include <vector>
+#include <algorithm>
+
+#include <QGLViewer/qglviewer.h>
+
+#include <CGAL/Polygon_mesh_processing/self_intersections.h>
+#include "Kernel_type.h"
+
+#include <boost/function_output_iterator.hpp>
+#include <QMap>
+
+// Class for visualizing holes in a polyhedron
+// provides mouse selection functionality
+class Q_DECL_EXPORT Scene_hole_visualizer : public CGAL::Three::Scene_item
+{
+  Q_OBJECT
+public:
+  // structs
+  struct Polyline_data {
+    Scene_polylines_item* polyline;
+    Polyhedron::Halfedge_handle halfedge;
+    qglviewer::Vec position;
+  };
+  struct Mouse_keyboard_state
+  {
+    bool ctrl_pressing, left_button_pressing;
+    Mouse_keyboard_state() : ctrl_pressing(false), left_button_pressing(false) { }
+  };
+public: typedef std::list<Polyline_data> Polyline_data_list;
+private:
+  struct List_iterator_comparator {
+    bool operator()(Polyline_data_list::const_iterator it_1, Polyline_data_list::const_iterator it_2) const 
+    { return (&*it_1) < (&*it_2); }
+  };
+public:
+  typedef std::set<Polyline_data_list::const_iterator, List_iterator_comparator> Selected_holes_set;
+
+  Scene_hole_visualizer(Scene_polyhedron_item* poly_item, QMainWindow* mainWindow)
+    : poly_item(poly_item), block_poly_item_changed(false)
+  {
+    get_holes();
+    active_hole = polyline_data_list.end();
+
+    QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
+    viewer->installEventFilter(this);
+    mainWindow->installEventFilter(this);
+
+    connect(poly_item, SIGNAL(item_is_about_to_be_changed()), this, SLOT(poly_item_changed())); 
+  }
+  ~Scene_hole_visualizer() {
+    clear();
+  }
+  bool isFinite() const { return true; }
+  bool isEmpty() const { return polyline_data_list.empty(); }
+  void compute_bbox() const {
+    if(polyline_data_list.empty()) { _bbox = Bbox(); return;}
+    Bbox bbox = polyline_data_list.begin()->polyline->bbox();
+    for(Polyline_data_list::const_iterator it = polyline_data_list.begin(); it != polyline_data_list.end(); ++it) {
+      bbox = bbox + it->polyline->bbox();
+    }
+    _bbox = bbox;
+  }
+  Scene_hole_visualizer* clone() const {
+    return 0;
+  }
+  QString toolTip() const {
+    return tr("%1 with %2 holes").arg(name()).arg(polyline_data_list.size());
+  }
+
+  bool supportsRenderingMode(RenderingMode m) const {
+    return (m == Wireframe);
+  }
+  void draw() const {}
+  void drawEdges(CGAL::Three::Viewer_interface* viewer) const {
+    
+    for(Polyline_data_list::const_iterator it = polyline_data_list.begin(); it != polyline_data_list.end(); ++it) {
+      if(it == active_hole) { viewer->glLineWidth(7.f); }
+      else                  { viewer->glLineWidth(3.f); }
+
+      if(selected_holes.find(it) != selected_holes.end()) 
+      { it->polyline->setRbgColor(255, 0, 0); }
+      else 
+      { it->polyline->setRbgColor(0, 0, 255); }
+
+      it->polyline->drawEdges(viewer);
+    }
+  }
+
+  void select_deselect_all(bool select) {
+    if(select) {
+      for(Polyline_data_list::iterator it = polyline_data_list.begin(); it != polyline_data_list.end(); ++it)
+      { selected_holes.insert(it); }
+    }
+    else {
+      selected_holes.clear();
+    }
+    Q_EMIT itemChanged();
+  }
+
+  // filter events for selecting / activating holes with mouse input
+  bool eventFilter(QObject* /*target*/, QEvent *event)
+  {
+    // This filter is both filtering events from 'viewer' and 'main window'
+    Mouse_keyboard_state old_state = state;
+    // key events
+    if(event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease)  {
+      QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
+      Qt::KeyboardModifiers modifiers = keyEvent->modifiers();
+
+      state.ctrl_pressing = modifiers.testFlag(Qt::ControlModifier);
+    }
+    // mouse events
+    if(event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonRelease) {
+      QMouseEvent* mouse_event = static_cast<QMouseEvent*>(event);
+      if(mouse_event->button() == Qt::LeftButton) {
+        state.left_button_pressing = event->type() == QEvent::MouseButtonPress;
+      }   
+    }
+
+    if(!visible()) { return false; } // if not visible just update event state but don't do any action
+
+    // activate closest hole
+    if(event->type() == QEvent::HoverMove) 
+    {
+      QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
+      const QPoint& p = viewer->mapFromGlobal(QCursor::pos());
+      bool need_repaint = activate_closest_hole(p.x(), p.y());
+      if(need_repaint) { Q_EMIT itemChanged(); }
+    }
+
+    // select closest hole
+    bool left_clicked_now = state.left_button_pressing && !old_state.left_button_pressing;
+    if(left_clicked_now && state.ctrl_pressing) {
+      Selected_holes_set::iterator active_it = selected_holes.find(active_hole);
+      if(active_it == selected_holes.end()) {
+        selected_holes.insert(active_hole);
+      }
+      else { selected_holes.erase(active_it); }
+      Q_EMIT itemChanged();
+    }
+    return false;
+  }
+
+private:
+  // find holes in polyhedron and construct a internal polyline for each
+  void get_holes() {
+    typedef Polyhedron::Halfedge_iterator Halfedge_iterator;
+    typedef Polyhedron::Halfedge_around_facet_circulator Halfedge_around_facet_circulator;
+    // save selected hole positions to keep selected holes selected
+    // we just use center position of holes for identification which might not work good for advanced cases...
+    std::vector<qglviewer::Vec> selected_hole_positions;
+    for(Selected_holes_set::const_iterator it = selected_holes.begin(); it != selected_holes.end(); ++it) {
+      selected_hole_positions.push_back((*it)->position);
+    }
+
+    clear();
+
+    Polyhedron& poly = *poly_item->polyhedron();
+    for(Halfedge_iterator it = poly.halfedges_begin(); it != poly.halfedges_end(); ++it)
+    { it->id() = 0; }
+
+    for(Halfedge_iterator it = poly.halfedges_begin(); it != poly.halfedges_end(); ++it){
+      if(it->is_border() && it->id() == 0){
+        polyline_data_list.push_back(Polyline_data());
+        Polyline_data& polyline_data = polyline_data_list.back();
+        polyline_data.polyline = new Scene_polylines_item();
+        polyline_data.polyline->polylines.push_back(Scene_polylines_item::Polyline());
+        polyline_data.halfedge = it;
+
+        qglviewer::Vec center;
+        int counter = 0;
+        Halfedge_around_facet_circulator hf_around_facet = it->facet_begin();
+        do {
+          CGAL_assertion(hf_around_facet->id() == 0);
+          hf_around_facet->id() = 1;
+          const Polyhedron::Traits::Point_3& p = hf_around_facet->vertex()->point();          
+          polyline_data.polyline->polylines.front().push_back(p);
+          center += qglviewer::Vec(p.x(), p.y(), p.z());
+          ++counter;
+        } while(++hf_around_facet != it->facet_begin());
+        polyline_data.polyline->polylines.front().push_back(hf_around_facet->vertex()->point());
+        polyline_data.position = center / counter;
+      }
+    }
+    //keep previous selected holes selected
+    for(Polyline_data_list::const_iterator it = polyline_data_list.begin(); it != polyline_data_list.end(); ++it) {
+      if(std::find(selected_hole_positions.begin(), selected_hole_positions.end(), it->position) != selected_hole_positions.end()) {
+        selected_holes.insert(it);
+      }
+    }
+  }
+  // finds closest polyline from polyline_data_list and makes it active_hole
+  bool activate_closest_hole(int x, int y) {
+    typedef Polyhedron::Halfedge_around_facet_circulator Halfedge_around_facet_circulator;
+    if(polyline_data_list.empty()) { return false; }
+
+    QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
+    qglviewer::Camera* camera = viewer->camera();
+
+    Polyline_data_list::const_iterator min_it;
+    double min_dist = (std::numeric_limits<double>::max)();
+    Kernel::Point_2 xy(x,y);
+    for(Polyline_data_list::const_iterator it = polyline_data_list.begin(); it != polyline_data_list.end(); ++it)
+    {
+#if 0
+      /* use center of polyline to measure distance - performance wise */
+      const qglviewer::Vec& pos_it = camera->projectedCoordinatesOf(it->position);
+      float dist = std::pow(pos_it.x - x, 2) + std::pow(pos_it.y - y, 2);
+      if(dist < min_dist) {
+        min_dist = dist;
+        min_it = it;
+      }
+#else
+      /* use polyline points to measure distance - might hurt performance for large holes */
+      Halfedge_around_facet_circulator hf_around_facet = it->halfedge->facet_begin();
+      do {
+        
+        const Polyhedron::Traits::Point_3& p_1 = hf_around_facet->vertex()->point();
+        const qglviewer::Vec& pos_it_1 = camera->projectedCoordinatesOf(qglviewer::Vec(p_1.x(), p_1.y(), p_1.z()));
+        const Polyhedron::Traits::Point_3& p_2 = hf_around_facet->opposite()->vertex()->point();
+        const qglviewer::Vec& pos_it_2 = camera->projectedCoordinatesOf(qglviewer::Vec(p_2.x(), p_2.y(), p_2.z()));
+        Kernel::Segment_2 s(Kernel::Point_2(pos_it_1.x, pos_it_1.y), Kernel::Point_2(pos_it_2.x, pos_it_2.y));
+
+        double dist = CGAL::squared_distance(s, xy);
+        if(dist < min_dist) {
+          min_dist = dist;
+          min_it = it;
+        }
+      } while(++hf_around_facet != it->halfedge->facet_begin());
+#endif
+    }
+
+    if(min_it == active_hole) { 
+      return false;
+    }
+    active_hole = min_it;
+    return true;
+  }
+  // clears internal data except poly_item
+  void clear() {
+    for(Polyline_data_list::const_iterator it = polyline_data_list.begin(); it != polyline_data_list.end(); ++it) {
+      delete it->polyline;
+    }
+    polyline_data_list.clear();
+    selected_holes.clear();
+    active_hole = polyline_data_list.end();
+  }
+  
+  Polyline_data_list::const_iterator active_hole;
+  Mouse_keyboard_state state;
+public:
+  Selected_holes_set selected_holes;
+  Scene_polyhedron_item* poly_item;
+  Polyline_data_list polyline_data_list;
+  bool block_poly_item_changed;
+
+public Q_SLOTS:
+  void poly_item_changed() {
+    if(block_poly_item_changed) { return; }
+    get_holes();
+    Q_EMIT itemChanged();
+  }
+
+}; // end class Scene_hole_visualizer
+///////////////////////////////////////////////////////////////////////////////////////////////////
+using namespace CGAL::Three;
+class Polyhedron_demo_hole_filling_plugin :
+  public QObject,
+  public Polyhedron_demo_plugin_helper
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+public:
+  bool applicable(QAction*) const { return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex())); }
+  void print_message(QString message) { messages->information(message); }
+  QList<QAction*> actions() const { return QList<QAction*>() << actionHoleFilling; }
+
+
+  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface* m);
+
+  virtual void closure()
+  {
+    dock_widget->hide();
+  }
+  Scene_hole_visualizer* get_hole_visualizer(Scene_polyhedron_item* poly_item) {
+      return visualizers[poly_item];
+  }
+
+public Q_SLOTS:
+  void hole_filling_action() { 
+    dock_widget->show();
+    dock_widget->raise();
+    if(scene->numberOfEntries() < 2) { on_Visualize_holes_button(); }
+  }
+  void on_Select_all_holes_button();
+  void on_Deselect_all_holes_button();
+  void on_Visualize_holes_button();
+  void on_Fill_selected_holes_button();
+  void on_Create_polyline_items_button();
+  void on_Accept_button();
+  void on_Reject_button();
+  void item_about_to_be_destroyed(CGAL::Three::Scene_item*);
+  void hole_visualizer_changed();
+  void dock_widget_closed();
+  void on_Select_small_holes_button();
+protected:
+  bool eventFilter(QObject *, QEvent *event) {
+    if(event->type() == QEvent::Close) {
+      dock_widget_closed();
+    }
+    return false;
+  }
+
+  void change_poly_item_by_blocking(Scene_polyhedron_item* poly_item, Scene_hole_visualizer* collection) {
+    if(collection) collection->block_poly_item_changed = true;
+    poly_item->invalidateOpenGLBuffers();
+    scene->itemChanged(poly_item);
+    if(collection) collection->block_poly_item_changed = false;
+  }
+private:
+  Messages_interface* messages;
+  QAction* actionHoleFilling;
+
+  QDockWidget* dock_widget;
+  Ui::HoleFilling ui_widget;
+
+  //Maintains a reference between all the visualizers and their poly_item
+  // to ease the management of the visualizers
+  QMap<Scene_polyhedron_item*, Scene_hole_visualizer*> visualizers;
+  // hold created facet for accept reject functionality
+  std::vector<Polyhedron::Facet_handle> new_facets; 
+  Scene_polyhedron_item* last_active_item; // always keep it NULL while not active-reject state
+ 
+  bool fill(Polyhedron& polyhedron, Polyhedron::Halfedge_handle halfedge);
+  bool self_intersecting(Polyhedron& polyhedron);
+  void accept_reject_toggle(bool activate_accept_reject) {
+    if(activate_accept_reject) {
+      ui_widget.Accept_button->setVisible(true);
+      ui_widget.Reject_button->setVisible(true);
+
+      Q_FOREACH( QWidget* w, ui_widget.dockWidgetContents->findChildren<QWidget*>() )
+      { w->setEnabled(false); }
+
+      ui_widget.Accept_button->setEnabled(true);
+      ui_widget.Reject_button->setEnabled(true);
+    }
+    else {
+      ui_widget.Accept_button->setVisible(false);
+      ui_widget.Reject_button->setVisible(false);
+
+      Q_FOREACH( QWidget* w, ui_widget.dockWidgetContents->findChildren<QWidget*>() )
+      { w->setEnabled(true); }
+    }
+  }
+
+  static QString no_selected_hole_visualizer_error_message() {
+    return "Error: please select a hole visualizer from Geometric Objects list."
+      "Use 'Visualize Holes' button to create one by selecting the polyhedron item!";
+  }
+
+}; // end Polyhedron_demo_hole_filling_plugin
+
+void Polyhedron_demo_hole_filling_plugin::init(QMainWindow* mainWindow,
+                                      CGAL::Three::Scene_interface* scene_interface,
+                                      Messages_interface* m)
+{
+  last_active_item = NULL;
+
+  mw = mainWindow;
+  scene = scene_interface;
+  messages = m;
+
+  actionHoleFilling = new QAction(tr("Hole Filling"), mw);
+  actionHoleFilling->setProperty("subMenuName", "Polygon Mesh Processing");
+  connect(actionHoleFilling, SIGNAL(triggered()), this, SLOT(hole_filling_action()));
+
+  dock_widget = new QDockWidget("Hole Filling", mw);
+  dock_widget->setVisible(false);
+  dock_widget->installEventFilter(this);
+
+  ui_widget.setupUi(dock_widget);
+  ui_widget.Accept_button->setVisible(false);
+  ui_widget.Reject_button->setVisible(false);
+
+  addDockWidget(dock_widget);
+  
+  connect(ui_widget.Visualize_holes_button,  SIGNAL(clicked()), this, SLOT(on_Visualize_holes_button()));  
+  connect(ui_widget.Fill_selected_holes_button,  SIGNAL(clicked()), this, SLOT(on_Fill_selected_holes_button())); 
+  connect(ui_widget.Select_all_holes_button,  SIGNAL(clicked()), this, SLOT(on_Select_all_holes_button()));
+  connect(ui_widget.Deselect_all_holes_button,  SIGNAL(clicked()), this, SLOT(on_Deselect_all_holes_button()));
+  connect(ui_widget.Create_polyline_items_button,  SIGNAL(clicked()), this, SLOT(on_Create_polyline_items_button()));
+  connect(ui_widget.Accept_button,  SIGNAL(clicked()), this, SLOT(on_Accept_button()));
+  connect(ui_widget.Reject_button,  SIGNAL(clicked()), this, SLOT(on_Reject_button()));
+  connect(ui_widget.Select_small_holes_button,  SIGNAL(clicked()), this, SLOT(on_Select_small_holes_button()));
+
+  if(Scene* scene_casted = dynamic_cast<Scene*>(scene_interface)) 
+  { connect(scene_casted, SIGNAL(itemAboutToBeDestroyed(CGAL::Three::Scene_item*)), this, SLOT(item_about_to_be_destroyed(CGAL::Three::Scene_item*))); }
+}
+
+void Polyhedron_demo_hole_filling_plugin::item_about_to_be_destroyed(CGAL::Three::Scene_item* scene_item) {
+  Scene_polyhedron_item* poly_item = qobject_cast<Scene_polyhedron_item*>(scene_item);
+  if(poly_item) {
+    // erase assoc polylines item
+    if(Scene_hole_visualizer* hole_visualizer = get_hole_visualizer(poly_item))
+      scene->erase( scene->item_id( hole_visualizer ) );
+    visualizers.remove(poly_item);
+    // close accept-reject dialog if it is open
+    if(last_active_item == poly_item) {
+      on_Accept_button();
+    }
+  }
+  else {
+    Scene_hole_visualizer* visu_item = qobject_cast<Scene_hole_visualizer*>(scene_item);
+    if(visu_item) {
+        visualizers.remove(visu_item->poly_item);
+    }
+  }
+}
+// removes Scene_hole_visualizer items
+void Polyhedron_demo_hole_filling_plugin::dock_widget_closed() {
+  // remove all Scene_hole_visualizer items
+  for(CGAL::Three::Scene_interface::Item_id i = 0, end = scene->numberOfEntries();
+    i < end; ++i)
+  {
+    Scene_hole_visualizer* hole_visualizer = qobject_cast<Scene_hole_visualizer*>(scene->item(i));
+    if(hole_visualizer) {
+      scene->erase( scene->item_id(hole_visualizer) );
+    }
+  }
+  on_Accept_button(); 
+}
+// creates a Scene_hole_visualizer and associate it with active Scene_polyhedron_item
+void Polyhedron_demo_hole_filling_plugin::on_Visualize_holes_button() {
+  Scene_polyhedron_item* poly_item = getSelectedItem<Scene_polyhedron_item>();
+  if(!poly_item) {
+    print_message("Error: please select a polyhedron item from Geometric Objects list!");
+    return;
+  }
+
+  if(get_hole_visualizer(poly_item)) {
+    print_message("Error: selected polyhedron item already has an associated hole visualizer!");
+    return;
+  }
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  Scene_hole_visualizer* hole_visualizer = new Scene_hole_visualizer(poly_item, mw);
+  visualizers[poly_item] = hole_visualizer;
+  connect(hole_visualizer, SIGNAL(itemChanged()), this, SLOT(hole_visualizer_changed()));
+  QApplication::restoreOverrideCursor();
+
+  if(hole_visualizer->polyline_data_list.empty()) {
+    print_message("There is no hole in selected polyhedron item!");
+    visualizers.remove(poly_item);
+    delete hole_visualizer;
+    return;
+  }
+  else {
+    int item_id = scene->addItem(hole_visualizer);
+    scene->setSelectedItem(item_id);
+    hole_visualizer->setName(tr("%1-hole visualizer").arg(poly_item->name()));
+  }
+}
+// fills selected holes on active Scene_hole_visualizer
+void Polyhedron_demo_hole_filling_plugin::on_Fill_selected_holes_button() {
+  // get active polylines item
+  Scene_hole_visualizer* hole_visualizer = getSelectedItem<Scene_hole_visualizer>();
+  if(!hole_visualizer) {
+    print_message(no_selected_hole_visualizer_error_message());
+    return;
+  }
+  if(hole_visualizer->selected_holes.empty()) {
+    print_message("Error: there is no selected holes in hole visualizer!");
+    return;
+  }
+
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  // fill selected holes  
+  int counter = 0;
+  int filled_counter = 0;
+  for(Scene_hole_visualizer::Selected_holes_set::iterator it = hole_visualizer->selected_holes.begin();
+    it != hole_visualizer->selected_holes.end(); ++it, ++counter) {
+      print_message(tr("Hole %1:").arg(counter));
+      if( fill(*(hole_visualizer->poly_item->polyhedron()), (*it)->halfedge) ) { ++filled_counter;}
+  }
+
+  if(filled_counter > 0) {
+    change_poly_item_by_blocking(hole_visualizer->poly_item, hole_visualizer);
+    last_active_item = hole_visualizer->poly_item;
+    accept_reject_toggle(true);
+  }
+  print_message(tr("%1 of %2 holes are filled!").arg(filled_counter).arg(counter));
+  QApplication::restoreOverrideCursor();
+}
+
+// fills all holes and removes associated Scene_hole_visualizer if any
+void Polyhedron_demo_hole_filling_plugin::on_Select_all_holes_button() {
+  Scene_hole_visualizer* hole_visualizer = getSelectedItem<Scene_hole_visualizer>();
+  if(!hole_visualizer) {
+    print_message(no_selected_hole_visualizer_error_message());
+    return;
+  }
+  hole_visualizer->select_deselect_all(true);
+}
+
+void Polyhedron_demo_hole_filling_plugin::on_Select_small_holes_button() {
+  Scene_hole_visualizer* hole_visualizer = getSelectedItem<Scene_hole_visualizer>();
+  if(!hole_visualizer) {
+    print_message(no_selected_hole_visualizer_error_message());
+    return;
+  }
+
+  std::size_t threshold = ui_widget.vertices_threshold_spin_box->value();
+  typedef Scene_hole_visualizer::Polyline_data_list::const_iterator const_iterator;
+  for(const_iterator it = hole_visualizer->polyline_data_list.begin();
+                     it != hole_visualizer->polyline_data_list.end(); ++it)
+  {
+    if(it->polyline->polylines.front().size() <= threshold+1)
+      hole_visualizer->selected_holes.insert(it);
+  }
+  scene->itemChanged(hole_visualizer);
+}
+
+void Polyhedron_demo_hole_filling_plugin::on_Deselect_all_holes_button() {
+  Scene_hole_visualizer* hole_visualizer = getSelectedItem<Scene_hole_visualizer>();
+  if(!hole_visualizer) {
+    print_message(no_selected_hole_visualizer_error_message());
+    return;
+  }
+  hole_visualizer->select_deselect_all(false);
+}
+
+// Simply create polyline items and put them into scene - nothing related with other parts of the plugin
+void Polyhedron_demo_hole_filling_plugin::on_Create_polyline_items_button(){
+  Scene_hole_visualizer* hole_visualizer = getSelectedItem<Scene_hole_visualizer>();
+  if(!hole_visualizer) {
+    print_message(no_selected_hole_visualizer_error_message());
+    return;
+  }
+  if(hole_visualizer->selected_holes.empty()) {
+    print_message("Error: there is no selected holes in hole visualizer!");
+    return;
+  }
+  int counter = 0;
+  for(Scene_hole_visualizer::Selected_holes_set::iterator it = hole_visualizer->selected_holes.begin();
+    it != hole_visualizer->selected_holes.end(); ++it) {
+      Scene_polylines_item* polyline_item = new Scene_polylines_item();
+      polyline_item->polylines = (*it)->polyline->polylines;
+      polyline_item->setName(QString("selected hole %1").arg(counter++));
+      scene->addItem(polyline_item);
+  }
+}
+void Polyhedron_demo_hole_filling_plugin::on_Accept_button() {
+  if(last_active_item == NULL) { return; }
+
+  accept_reject_toggle(false);
+  if(Scene_hole_visualizer* hole_visualizer = get_hole_visualizer(last_active_item)) 
+  { hole_visualizer->poly_item_changed();}
+
+  new_facets.clear();
+  last_active_item = NULL;
+}
+void Polyhedron_demo_hole_filling_plugin::on_Reject_button() {
+  if(last_active_item == NULL) { return; }
+
+  accept_reject_toggle(false);
+  for(std::vector<Polyhedron::Facet_handle>::iterator it = new_facets.begin(); it != new_facets.end(); ++it) {
+   last_active_item->polyhedron()->erase_facet((*it)->halfedge());
+  }
+  change_poly_item_by_blocking(last_active_item, get_hole_visualizer(last_active_item));
+
+  new_facets.clear();
+  last_active_item = NULL;
+}
+// To delete Scene_hole_visualizer when it becomes empty
+void Polyhedron_demo_hole_filling_plugin::hole_visualizer_changed() {
+  Scene_hole_visualizer* hole_visualizer = qobject_cast<Scene_hole_visualizer*>(this->sender());
+  if(hole_visualizer && hole_visualizer->polyline_data_list.empty()) {
+    scene->erase( scene->item_id(hole_visualizer));
+    visualizers.remove(hole_visualizer->poly_item);
+  }
+}
+// helper function for filling holes
+bool Polyhedron_demo_hole_filling_plugin::fill
+  (Polyhedron& poly, Polyhedron::Halfedge_handle it) {
+
+  int action_index = ui_widget.action_combo_box->currentIndex();
+  double alpha = ui_widget.Density_control_factor_spin_box->value();
+  bool use_DT = ui_widget.Use_delaunay_triangulation_check_box->isChecked();
+  unsigned int continuity = ui_widget.Continuity_spin_box->value();
+
+  CGAL::Timer timer; timer.start();
+  std::vector<Polyhedron::Facet_handle> patch;
+  if(action_index == 0) {
+    CGAL::Polygon_mesh_processing::triangulate_hole(poly,
+             it, std::back_inserter(patch),
+             CGAL::Polygon_mesh_processing::parameters::use_delaunay_triangulation(use_DT));
+  }
+  else if(action_index == 1) {
+    CGAL::Polygon_mesh_processing::triangulate_and_refine_hole(poly,
+             it, std::back_inserter(patch), CGAL::Emptyset_iterator(),
+             CGAL::Polygon_mesh_processing::parameters::density_control_factor(alpha).
+             use_delaunay_triangulation(use_DT));
+  }
+  else {
+    int weight_index = ui_widget.weight_combo_box->currentIndex();
+
+    bool success;
+    if(weight_index == 0) {
+      success = CGAL::cpp11::get<0>(CGAL::Polygon_mesh_processing::triangulate_refine_and_fair_hole(poly,
+              it, std::back_inserter(patch), CGAL::Emptyset_iterator(),
+              CGAL::Polygon_mesh_processing::parameters::weight_calculator
+                (CGAL::internal::Uniform_weight_fairing<Polyhedron>(poly)).
+              density_control_factor(alpha).
+              fairing_continuity(continuity).
+              use_delaunay_triangulation(use_DT)));
+    }
+    else {
+      success = CGAL::cpp11::get<0>(CGAL::Polygon_mesh_processing::triangulate_refine_and_fair_hole(poly,
+              it, std::back_inserter(patch), CGAL::Emptyset_iterator(),
+              CGAL::Polygon_mesh_processing::parameters::weight_calculator(CGAL::internal::Cotangent_weight_with_voronoi_area_fairing<Polyhedron>(poly)).
+              density_control_factor(alpha).
+              fairing_continuity(continuity).
+              use_delaunay_triangulation(use_DT)));
+    }
+
+    if(!success) { print_message("Error: fairing is not successful, only triangulation and refinement are applied!"); }
+  }
+  print_message(QString("Took %1 sec.").arg(timer.time()));
+
+  if(patch.empty()) {
+    print_message(tr("Warning: generating patch is not successful! %1")
+      .arg(use_DT ? "Please try without 'Use 3D Delaunay Triangulation'!" : ""));
+    return false;
+  }
+
+  // Self intersection test
+  if(ui_widget.Skip_self_intersection_check_box->checkState() == Qt::Checked) {
+    timer.reset();
+
+    typedef std::vector<std::pair<Polyhedron::Facet_const_handle, Polyhedron::Facet_const_handle> > Intersected_facets;
+    Intersected_facets intersected_facets;
+    CGAL::Polygon_mesh_processing::self_intersections(poly,
+      std::back_inserter(intersected_facets),
+      CGAL::Polygon_mesh_processing::parameters::vertex_point_map(get(CGAL::vertex_point, poly)));
+
+    print_message(QString("Self intersecting test: finding intersecting triangles in %1 sec.").arg(timer.time()));
+    timer.reset();
+    // this part might need speed-up
+    bool intersected = false;
+    for(Intersected_facets::iterator it = intersected_facets.begin(); 
+      it != intersected_facets.end() && !intersected; ++it) {
+      for(std::vector<Polyhedron::Facet_handle>::iterator it_patch = patch.begin(); 
+        it_patch != patch.end() && !intersected; ++it_patch) {
+        if(it->first == (*it_patch) || it->second == (*it_patch)) {
+          intersected = true;
+        }
+      }
+    }
+    print_message(QString("Self intersecting test: iterate on patch in %1 sec.").arg(timer.time()));
+    if(intersected) {
+      for(std::vector<Polyhedron::Facet_handle>::iterator it = patch.begin(); it != patch.end(); ++it) {
+        poly.erase_facet((*it)->halfedge());
+      }
+      print_message("Self intersecting patch is generated, and it is removed.");
+      return false;
+    }
+    else { print_message("No Self intersection found, patch is valid."); }
+  }
+  // save facets for accept-reject 
+  new_facets.insert(new_facets.end(), patch.begin(), patch.end());
+  return true;
+}
+
+// Q_EXPORT_PLUGIN2(Polyhedron_demo_hole_filling_plugin, Polyhedron_demo_hole_filling_plugin)
+
+#include "Hole_filling_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Hole_filling_polyline_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Hole_filling_polyline_plugin.cpp
new file mode 100644
index 0000000..0db5659
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Hole_filling_polyline_plugin.cpp
@@ -0,0 +1,171 @@
+#include <QtCore/qglobal.h>
+
+#include "Messages_interface.h"
+#include "Scene_polyhedron_item.h"
+#include "Scene_polylines_item.h"
+#include <CGAL/Three/Scene_interface.h>
+
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+#include "Polyhedron_type.h"
+
+#include <CGAL/Polygon_mesh_processing/triangulate_hole.h>
+#include <CGAL/Polygon_mesh_processing/refine.h>
+#include <CGAL/Polygon_mesh_processing/internal/named_function_params.h>
+#include <CGAL/Polyhedron_incremental_builder_3.h>
+#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
+#include <CGAL/Timer.h>
+
+#include <QAction>
+#include <QMainWindow>
+#include <QApplication>
+#include <QInputDialog>
+#include <QMessageBox>
+
+#include <vector>
+#include <algorithm>
+
+#include <boost/function_output_iterator.hpp>
+#include <boost/iterator/transform_iterator.hpp>
+
+namespace PMP = CGAL::Polygon_mesh_processing;
+
+template<class HDS>
+class Polyhedron_builder : public CGAL::Modifier_base<HDS> {
+public:
+  Polyhedron_builder(std::vector<CGAL::Triple<int, int, int> >* triangles, 
+    Scene_polylines_item::Polyline* polyline) 
+    : triangles(triangles), polyline(polyline) 
+  { }
+
+  void operator()(HDS& hds) {
+    CGAL::Polyhedron_incremental_builder_3<HDS> B(hds, true);
+    B.begin_surface(polyline->size() -1, triangles->size());
+
+    for(Scene_polylines_item::Polyline::iterator it = polyline->begin();
+      it != --polyline->end(); ++it) {
+      B.add_vertex(*it);
+    }
+
+    for(std::vector<CGAL::Triple<int, int, int> >::iterator it = triangles->begin();
+      it != triangles->end(); ++it) {
+      B.begin_facet();
+      B.add_vertex_to_facet(it->first);
+      B.add_vertex_to_facet(it->second);
+      B.add_vertex_to_facet(it->third);
+      B.end_facet();
+    }
+
+    B.end_surface();
+  }
+
+private:
+  std::vector<CGAL::Triple<int, int, int> >* triangles;
+  Scene_polylines_item::Polyline* polyline;
+};
+using namespace CGAL::Three;
+class Polyhedron_demo_hole_filling_polyline_plugin :
+  public QObject,
+  public Polyhedron_demo_plugin_interface
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+public:
+  bool applicable(QAction *) const { return qobject_cast<Scene_polylines_item*>(scene->item(scene->mainSelectionIndex())); }
+  void print_message(QString message) { messages->information(message); }
+  QList<QAction*> actions() const { return QList<QAction*>() << actionHoleFillingPolyline; }
+
+  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface* m){
+    mw = mainWindow;
+    scene = scene_interface;
+    messages = m;
+    actionHoleFillingPolyline = new QAction(tr("Polyline Hole Filling"), mw);
+    connect(actionHoleFillingPolyline, SIGNAL(triggered()),
+      this, SLOT(hole_filling_polyline_action()));
+  }
+private:
+  struct Nop_functor {
+    template<class T>
+    void operator()(const T & /*t*/) const {}
+  };
+  typedef boost::function_output_iterator<Nop_functor> Nop_out;
+
+  struct Get_handle {
+    typedef Polyhedron::Facet_handle result_type;
+    result_type operator()(Polyhedron::Facet& f) const
+    { return f.halfedge()->facet(); }
+  };
+  
+public Q_SLOTS:
+  void hole_filling_polyline_action() {
+    Scene_polylines_item* polylines_item = qobject_cast<Scene_polylines_item*>(scene->item(scene->mainSelectionIndex()));
+    if(!polylines_item) {
+      print_message("Error: there is no selected polyline item!");
+      return;
+    } 
+
+    bool also_refine;
+    const double density_control_factor = 
+      QInputDialog::getDouble(mw, tr("Density Control Factor"),
+      tr("Density Control Factor (Cancel for not Refine): "), 1.41, 0.0, 100.0, 2, &also_refine);
+
+    bool use_DT = 
+      QMessageBox::Yes == QMessageBox::question(
+      NULL, "Use Delaunay Triangulation", "Use Delaunay Triangulation ?", QMessageBox::Yes|QMessageBox::No);
+
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    std::size_t counter = 0;
+    for(Scene_polylines_item::Polylines_container::iterator it = polylines_item->polylines.begin();
+      it != polylines_item->polylines.end(); ++it, ++counter) 
+    {
+      if(it->front() != it->back()) { //not closed, skip it
+        print_message("Warning: skipping not closed polyline!");
+        continue; 
+      } 
+      if(it->size() < 4) { // no triangle, skip it (needs at least 3 + 1 repeat)
+        print_message("Warning: skipping polyline which has less than 4 points!");
+        continue; 
+      }
+
+      CGAL::Timer timer; timer.start();
+      std::vector<CGAL::Triple<int, int, int> > patch;
+      CGAL::Polygon_mesh_processing::triangulate_hole_polyline(*it,
+        std::back_inserter(patch),
+        PMP::parameters::use_delaunay_triangulation(use_DT));
+      print_message(QString("Triangulated in %1 sec.").arg(timer.time()));
+
+      if(patch.empty()) {
+        print_message("Warning: generating patch is not successful, please try it without 'Delaunay Triangulation'!");
+        continue;
+      }
+      Polyhedron* poly = new Polyhedron;
+      Polyhedron_builder<Polyhedron::HalfedgeDS> patch_builder(&patch, &(*it));
+      poly->delegate(patch_builder);
+
+      if(also_refine) {
+        timer.reset();
+        CGAL::Polygon_mesh_processing::refine(*poly, faces(*poly),
+          Nop_out(), Nop_out(),
+          CGAL::Polygon_mesh_processing::parameters::density_control_factor(density_control_factor));
+        print_message(QString("Refined in %1 sec.").arg(timer.time()));
+      }
+
+      Scene_polyhedron_item* poly_item = new Scene_polyhedron_item(poly);
+      poly_item->setName(tr("%1-filled-%2").arg(polylines_item->name()).arg(counter));
+      poly_item->setRenderingMode(FlatPlusEdges);
+      scene->setSelectedItem(scene->addItem(poly_item));
+    }
+    QApplication::restoreOverrideCursor();
+  }
+
+private:
+  QMainWindow* mw;
+  CGAL::Three::Scene_interface* scene;
+  Messages_interface* messages;
+  QAction* actionHoleFillingPolyline;
+
+}; // end Polyhedron_demo_hole_filling_polyline_plugin
+
+// Q_EXPORT_PLUGIN2(Polyhedron_demo_hole_filling_polyline_plugin, Polyhedron_demo_hole_filling_polyline_plugin)
+
+#include "Hole_filling_polyline_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Hole_filling_widget.ui b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Hole_filling_widget.ui
new file mode 100644
index 0000000..c880eab
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Hole_filling_widget.ui
@@ -0,0 +1,314 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>HoleFilling</class>
+ <widget class="QDockWidget" name="HoleFilling">
+  <property name="enabled">
+   <bool>true</bool>
+  </property>
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>477</width>
+    <height>596</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Hole Filling</string>
+  </property>
+  <widget class="QWidget" name="dockWidgetContents">
+   <property name="enabled">
+    <bool>true</bool>
+   </property>
+   <layout class="QVBoxLayout" name="verticalLayout_6">
+    <item>
+     <layout class="QHBoxLayout" name="horizontalLayout">
+      <item>
+       <widget class="QLabel" name="label_2">
+        <property name="text">
+         <string>Action:</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QComboBox" name="action_combo_box">
+        <property name="currentIndex">
+         <number>2</number>
+        </property>
+        <item>
+         <property name="text">
+          <string>Triangulate</string>
+         </property>
+        </item>
+        <item>
+         <property name="text">
+          <string>Triangulate + Refine</string>
+         </property>
+        </item>
+        <item>
+         <property name="text">
+          <string>Triangulate + Refine + Fair</string>
+         </property>
+        </item>
+       </widget>
+      </item>
+     </layout>
+    </item>
+    <item>
+     <widget class="QGroupBox" name="groupBox">
+      <property name="title">
+       <string>Hole Filling Parameters</string>
+      </property>
+      <layout class="QVBoxLayout" name="verticalLayout_4">
+       <item>
+        <widget class="QCheckBox" name="Use_delaunay_triangulation_check_box">
+         <property name="text">
+          <string>Use 3D Delaunay Triangulation Search Space</string>
+         </property>
+         <property name="checked">
+          <bool>true</bool>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QCheckBox" name="Skip_self_intersection_check_box">
+         <property name="text">
+          <string>Skip Hole Fillings Making the Surface Self Intersecting</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout_8">
+         <item>
+          <widget class="QLabel" name="label_4">
+           <property name="text">
+            <string>Small Hole #Vertices Threshold</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QDoubleSpinBox" name="vertices_threshold_spin_box">
+           <property name="decimals">
+            <number>0</number>
+           </property>
+           <property name="maximum">
+            <double>999999999.000000000000000</double>
+           </property>
+           <property name="singleStep">
+            <double>1.000000000000000</double>
+           </property>
+           <property name="value">
+            <double>10.000000000000000</double>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </widget>
+    </item>
+    <item>
+     <widget class="QGroupBox" name="groupBox_2">
+      <property name="title">
+       <string>Refinement Parameters</string>
+      </property>
+      <layout class="QVBoxLayout" name="verticalLayout_3">
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout_5">
+         <item>
+          <widget class="QLabel" name="label">
+           <property name="text">
+            <string>Density Factor</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QDoubleSpinBox" name="Density_control_factor_spin_box">
+           <property name="maximum">
+            <double>96.989999999999995</double>
+           </property>
+           <property name="singleStep">
+            <double>0.200000000000000</double>
+           </property>
+           <property name="value">
+            <double>1.410000000000000</double>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </widget>
+    </item>
+    <item>
+     <widget class="QGroupBox" name="groupBox_3">
+      <property name="title">
+       <string>Fairing Parameters</string>
+      </property>
+      <layout class="QVBoxLayout" name="verticalLayout">
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout_6">
+         <item>
+          <widget class="QLabel" name="label_5">
+           <property name="text">
+            <string>Continuity</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QSpinBox" name="Continuity_spin_box">
+           <property name="minimum">
+            <number>0</number>
+           </property>
+           <property name="maximum">
+            <number>2</number>
+           </property>
+           <property name="value">
+            <number>1</number>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout_7">
+         <item>
+          <widget class="QLabel" name="label_3">
+           <property name="text">
+            <string>Weight Type</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QComboBox" name="weight_combo_box">
+           <property name="currentIndex">
+            <number>1</number>
+           </property>
+           <item>
+            <property name="text">
+             <string>Uniform Weight</string>
+            </property>
+           </item>
+           <item>
+            <property name="text">
+             <string>Cotangent Weight</string>
+            </property>
+           </item>
+          </widget>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </widget>
+    </item>
+    <item>
+     <widget class="QGroupBox" name="groupBox_4">
+      <property name="title">
+       <string>Hole Display and Selection</string>
+      </property>
+      <layout class="QVBoxLayout" name="verticalLayout_2">
+       <item>
+        <widget class="QPushButton" name="Visualize_holes_button">
+         <property name="enabled">
+          <bool>true</bool>
+         </property>
+         <property name="font">
+          <font>
+           <weight>75</weight>
+           <bold>true</bold>
+          </font>
+         </property>
+         <property name="text">
+          <string>Detect and Display Holes</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout_3">
+         <item>
+          <widget class="QPushButton" name="Select_all_holes_button">
+           <property name="text">
+            <string>Select All Holes</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QPushButton" name="Select_small_holes_button">
+           <property name="text">
+            <string>Select Small Holes</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QPushButton" name="Deselect_all_holes_button">
+           <property name="text">
+            <string>Deselect All Holes</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+       <item>
+        <widget class="QLabel" name="label_6">
+         <property name="text">
+          <string>Note: Use CTRL+Left mouse click to manually select/deselect a hole</string>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </widget>
+    </item>
+    <item>
+     <widget class="QGroupBox" name="groupBox_5">
+      <property name="title">
+       <string>Actions</string>
+      </property>
+      <layout class="QVBoxLayout" name="verticalLayout_5">
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout_2">
+         <item>
+          <widget class="QPushButton" name="Fill_selected_holes_button">
+           <property name="enabled">
+            <bool>true</bool>
+           </property>
+           <property name="text">
+            <string>Fill Selected Holes</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QPushButton" name="Create_polyline_items_button">
+           <property name="text">
+            <string>Create Polyline Items for Selected Holes</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </widget>
+    </item>
+    <item>
+     <layout class="QHBoxLayout" name="horizontalLayout_4">
+      <item>
+       <widget class="QPushButton" name="Reject_button">
+        <property name="text">
+         <string>Reject</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="Accept_button">
+        <property name="text">
+         <string>Accept</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Inside_out_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Inside_out_plugin.cpp
new file mode 100644
index 0000000..ef2b83a
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Inside_out_plugin.cpp
@@ -0,0 +1,87 @@
+#include <QApplication>
+#include <QAction>
+#include <QStringList>
+#include <QMainWindow>
+#include "Scene_polyhedron_item.h"
+#include "Scene_polygon_soup_item.h"
+#include "Polyhedron_type.h"
+
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+#include <CGAL/Polygon_mesh_processing/orientation.h>
+using namespace CGAL::Three;
+class Polyhedron_demo_inside_out_plugin : 
+  public QObject,
+  public Polyhedron_demo_plugin_interface
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+public:
+
+  QList<QAction*> actions() const {
+    return _actions;
+  }
+
+  void init(QMainWindow* mw,
+            Scene_interface* scene_interface,
+            Messages_interface*)
+  {
+      scene = scene_interface;
+      QAction* actionInsideOut = new QAction(tr("Inside Out"), mw);
+
+      actionInsideOut->setProperty("subMenuName", "Polygon Mesh Processing");
+      connect(actionInsideOut, SIGNAL(triggered()), this, SLOT(on_actionInsideOut_triggered()));
+      _actions << actionInsideOut;
+
+  }
+  bool applicable(QAction*) const { 
+    const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+    return qobject_cast<Scene_polyhedron_item*>(scene->item(index)) 
+      || qobject_cast<Scene_polygon_soup_item*>(scene->item(index));
+  }
+
+public Q_SLOTS:
+  void on_actionInsideOut_triggered();
+
+private:
+  QList<QAction*> _actions;
+  Scene_interface *scene;
+}; // end Polyhedron_demo_inside_out_plugin
+
+void Polyhedron_demo_inside_out_plugin::on_actionInsideOut_triggered()
+{
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+  
+  Scene_polyhedron_item* poly_item = 
+    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+
+  Scene_polygon_soup_item* soup_item = 
+    qobject_cast<Scene_polygon_soup_item*>(scene->item(index));
+
+  if(poly_item || soup_item)
+  {
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+
+    if(poly_item) {
+      Polyhedron* pMesh = poly_item->polyhedron();
+      if(!pMesh) return;
+  
+      // inside out
+      CGAL::Polygon_mesh_processing::reverse_face_orientations(*pMesh);
+      poly_item->invalidateOpenGLBuffers();
+    }
+    else {
+      soup_item->inside_out();
+      soup_item->invalidateOpenGLBuffers();
+    }
+
+    // update scene
+    scene->itemChanged(index);
+
+    // default cursor
+    QApplication::restoreOverrideCursor();
+  }
+}
+
+#include "Inside_out_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_dialog.ui b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_dialog.ui
new file mode 100644
index 0000000..155c833
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_dialog.ui
@@ -0,0 +1,287 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Isotropic_remeshing_dialog</class>
+ <widget class="QDialog" name="Isotropic_remeshing_dialog">
+  <property name="enabled">
+   <bool>true</bool>
+  </property>
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>376</width>
+    <height>368</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Isotropic remeshing criteria</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <widget class="QLabel" name="objectName">
+     <property name="font">
+      <font>
+       <pointsize>15</pointsize>
+       <weight>75</weight>
+       <bold>true</bold>
+      </font>
+     </property>
+     <property name="text">
+      <string>NO OBJECT</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QLabel" name="objectNameSize">
+     <property name="text">
+      <string>No size</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="groupBox_2">
+     <property name="title">
+      <string>Remesh</string>
+     </property>
+     <layout class="QHBoxLayout" name="horizontalLayout">
+      <item>
+       <widget class="QCheckBox" name="splitEdgesOnly_checkbox">
+        <property name="text">
+         <string>Split only border/selected edges</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="groupBox">
+     <property name="title">
+      <string>Isotropic remeshing</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout_2" rowstretch="0,0,0,0,0,0,0" columnstretch="0,1">
+      <item row="6" column="0">
+       <widget class="QLabel" name="preserveDuplicates_label">
+        <property name="text">
+         <string>Preserve duplicated edges</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="1">
+       <widget class="QSpinBox" name="nbSmoothing_spinbox">
+        <property name="minimum">
+         <number>0</number>
+        </property>
+        <property name="maximum">
+         <number>100</number>
+        </property>
+        <property name="value">
+         <number>1</number>
+        </property>
+       </widget>
+      </item>
+      <item row="6" column="1">
+       <widget class="QCheckBox" name="preserveDuplicates_checkbox">
+        <property name="text">
+         <string/>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="0">
+       <widget class="QLabel" name="edgeLength_label">
+        <property name="text">
+         <string>Target edge length</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+        <property name="buddy">
+         <cstring>edgeLength_dspinbox</cstring>
+        </property>
+       </widget>
+      </item>
+      <item row="4" column="0">
+       <widget class="QLabel" name="protect_label">
+        <property name="text">
+         <string>Protect borders/selected edges</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="0">
+       <widget class="QLabel" name="nbSmoothing_label">
+        <property name="text">
+         <string>Number of Smoothing iterations</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="1">
+       <widget class="QSpinBox" name="nbIterations_spinbox">
+        <property name="minimumSize">
+         <size>
+          <width>110</width>
+          <height>0</height>
+         </size>
+        </property>
+        <property name="value">
+         <number>1</number>
+        </property>
+       </widget>
+      </item>
+      <item row="5" column="0">
+       <widget class="QLabel" name="smooth1D_label">
+        <property name="text">
+         <string>Allow 1D smoothing along borders</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="0">
+       <widget class="QLabel" name="nbIterations_label">
+        <property name="text">
+         <string>Number of Main iterations</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+        <property name="buddy">
+         <cstring>nbIterations_spinbox</cstring>
+        </property>
+       </widget>
+      </item>
+      <item row="5" column="1">
+       <widget class="QCheckBox" name="smooth1D_checkbox">
+        <property name="text">
+         <string/>
+        </property>
+       </widget>
+      </item>
+      <item row="4" column="1">
+       <widget class="QCheckBox" name="protect_checkbox">
+        <property name="text">
+         <string/>
+        </property>
+        <property name="checked">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <widget class="QDoubleSpinBox" name="edgeLength_dspinbox">
+        <property name="minimumSize">
+         <size>
+          <width>110</width>
+          <height>0</height>
+         </size>
+        </property>
+        <property name="maximum">
+         <double>1000.000000000000000</double>
+        </property>
+        <property name="singleStep">
+         <double>0.100000000000000</double>
+        </property>
+       </widget>
+      </item>
+      <item row="3" column="0">
+       <spacer name="verticalSpacer_3">
+        <property name="orientation">
+         <enum>Qt::Vertical</enum>
+        </property>
+        <property name="sizeType">
+         <enum>QSizePolicy::Maximum</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>20</width>
+          <height>40</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <spacer name="verticalSpacer_2">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeType">
+      <enum>QSizePolicy::MinimumExpanding</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>0</width>
+       <height>0</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item>
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <tabstops>
+  <tabstop>splitEdgesOnly_checkbox</tabstop>
+  <tabstop>edgeLength_dspinbox</tabstop>
+  <tabstop>nbIterations_spinbox</tabstop>
+  <tabstop>nbSmoothing_spinbox</tabstop>
+  <tabstop>protect_checkbox</tabstop>
+  <tabstop>smooth1D_checkbox</tabstop>
+  <tabstop>preserveDuplicates_checkbox</tabstop>
+  <tabstop>buttonBox</tabstop>
+ </tabstops>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>Isotropic_remeshing_dialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>397</x>
+     <y>333</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>195</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>Isotropic_remeshing_dialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>397</x>
+     <y>333</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>195</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp
new file mode 100644
index 0000000..66b0606
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp
@@ -0,0 +1,778 @@
+//#define CGAL_PMP_REMESHING_VERBOSE
+//#define CGAL_PMP_REMESHING_DEBUG
+//#define CGAL_PMP_REMESHING_VERY_VERBOSE
+
+#include <QtCore/qglobal.h>
+
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+
+#include "Scene_polyhedron_item.h"
+#include "Scene_polyhedron_selection_item.h"
+#include "Polyhedron_type.h"
+
+#include <CGAL/iterator.h>
+#include <CGAL/Polygon_mesh_processing/remesh.h>
+#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
+#include <CGAL/boost/graph/properties_Polyhedron_3.h>
+#include <CGAL/Polygon_mesh_processing/triangulate_faces.h>
+#include <CGAL/utility.h>
+
+#include <boost/graph/graph_traits.hpp>
+#include <boost/unordered_set.hpp>
+#include <CGAL/property_map.h>
+
+#include <QTime>
+#include <QAction>
+#include <QMainWindow>
+#include <QApplication>
+#include <QString>
+#include <QDialog>
+#include <QtPlugin>
+
+#include <vector>
+#include <algorithm>
+#include <queue>
+#include <sstream>
+
+#ifdef CGAL_LINKED_WITH_TBB
+#include "tbb/parallel_for.h"
+#include "tbb/blocked_range.h"
+#include "tbb/partitioner.h"
+#endif
+
+#include "ui_Isotropic_remeshing_dialog.h"
+
+// give a halfedge and a target edge length, put in `out` points
+// which the edge equally spaced such that splitting the edge
+// using the sequence of points make the edges shorter than
+// `target_length`
+template <class TriangleMesh, class PointPMap, class PointOutputIterator>
+PointOutputIterator
+sample_edge(
+  typename boost::graph_traits<TriangleMesh>::halfedge_descriptor hd,
+  TriangleMesh& triangle_mesh,
+  double target_length,
+  const PointPMap& pmap,
+  PointOutputIterator out)
+{
+  typedef typename boost::property_traits<PointPMap>::value_type Point_3;
+  typedef typename CGAL::Kernel_traits<Point_3>::Kernel::Vector_3 Vector_3;
+  typename boost::property_traits<PointPMap>::reference src=get(pmap, source(hd,triangle_mesh) );
+  typename boost::property_traits<PointPMap>::reference tgt=get(pmap, target(hd,triangle_mesh) );
+
+  double length = std::sqrt( CGAL::squared_distance(src, tgt) );
+  if ( length <= target_length ) return out;
+
+  double nb_points = std::floor( length / target_length );
+  Vector_3 unit = (tgt-src) / (nb_points+1);
+
+  for(double i=0; i<nb_points; ++i)
+    *out++=src+unit*(i+1);
+
+  return out;
+}
+
+// given a set of points that are expected to be on an edge, split
+// that edge and retriangulate the face incident to the edge
+// Points are sorted so that they are sorted from the source to the target
+// of the edge (the sequence does not contains edge endpoints)
+template <class TriangleMesh, class PointPMap, class PointRange, class EdgeOutputIterator>
+EdgeOutputIterator
+split_identical_edges(
+  typename boost::graph_traits<TriangleMesh>::halfedge_descriptor hd,
+  TriangleMesh& tm,
+  const PointPMap& pmap,
+  const PointRange& points,
+  EdgeOutputIterator out)
+{
+  typedef typename PointRange::value_type Point_3;
+  typedef boost::graph_traits<TriangleMesh> GT;
+  typedef typename GT::halfedge_descriptor halfedge_descriptor;
+
+  BOOST_FOREACH(const Point_3& p, points)
+  {
+    // split the edge
+    halfedge_descriptor new_hd=CGAL::Euler::split_edge(hd,tm);
+    // set the vertex point
+    put(pmap, target(new_hd, tm), p);
+    *out++=edge(new_hd, tm);
+  }
+  *out++=edge(hd, tm);
+  return out;
+}
+
+// HedgeRange is expected to be a range with value type being
+// std::pair<halfedge_descriptor, TriangleMesh*>
+// Given a set of halfedges representing different edges
+// but with identical endpoints, and a target edge length
+// we split all edges identically so that subedges are
+// or length <= length
+template <class HedgeRange, class Edges_to_protect>
+void split_long_duplicated_edge(const HedgeRange& hedge_range,
+                                double target_length,
+                                Edges_to_protect& edges_to_protect)
+{
+  typedef typename HedgeRange::value_type Pair;
+  typedef typename Pair::first_type halfedge_descriptor;
+  typedef typename boost::remove_pointer<
+    typename Pair::second_type>::type TriangleMesh;
+  typedef typename boost::property_map<TriangleMesh,
+    CGAL::vertex_point_t>::type PointPMap;
+  typedef typename boost::property_traits<PointPMap>::value_type Point_3;
+
+  if (hedge_range.empty()) return;
+
+  const Pair& p = *hedge_range.begin();
+  PointPMap pmap = get(boost::vertex_point, *p.second);
+
+  std::vector<Point_3> points;
+  halfedge_descriptor hd = p.first;
+
+  // collect points to be add inside the edges
+  sample_edge(hd, *p.second, target_length, pmap, std::back_inserter(points) );
+
+  CGAL_assertion_code(Point_3 src = get(pmap, source(hd, *p.second));)
+  CGAL_assertion_code(Point_3 tgt = get(pmap, target(hd, *p.second));)
+
+  // split the edges and collect faces to triangulate
+  BOOST_FOREACH(const Pair& h_and_p, hedge_range)
+  {
+    halfedge_descriptor hc=h_and_p.first;
+    TriangleMesh* polyc = h_and_p.second;
+
+    PointPMap pmap_2 = get(boost::vertex_point, *polyc);
+    //make sure halfedge are consistently oriented
+    CGAL_assertion( get(pmap_2, source(hc, *polyc)) == src );
+    CGAL_assertion( get(pmap_2, target(hc, *polyc)) == tgt );
+
+    typedef typename Edges_to_protect::value_type::second_type Edge_set;
+    Edge_set& edge_set = edges_to_protect[polyc];
+
+    // now split the halfedge and incident faces
+    split_identical_edges(hc,*polyc,pmap_2, points,
+                          std::inserter( edge_set, edge_set.begin()));
+  }
+}
+
+using namespace CGAL::Three;
+class Polyhedron_demo_isotropic_remeshing_plugin :
+  public QObject,
+  public Polyhedron_demo_plugin_interface
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+  typedef boost::graph_traits<Polyhedron>::edge_descriptor edge_descriptor;
+  typedef boost::graph_traits<Polyhedron>::halfedge_descriptor halfedge_descriptor;
+  typedef boost::graph_traits<Polyhedron>::face_descriptor face_descriptor;
+
+  typedef boost::unordered_set<edge_descriptor, CGAL::Handle_hash_function>    Edge_set;
+  typedef Scene_polyhedron_selection_item::Is_constrained_map<Edge_set> Edge_constrained_pmap;
+
+public:
+  void init(QMainWindow* mainWindow, Scene_interface* scene_interface, Messages_interface*)
+  {
+    this->scene = scene_interface;
+    this->mw = mainWindow;
+
+    actionIsotropicRemeshing_ = new QAction("Isotropic Remeshing", mw);
+    actionIsotropicRemeshing_->setProperty("subMenuName", "Polygon Mesh Processing");
+    if (actionIsotropicRemeshing_) {
+      connect(actionIsotropicRemeshing_, SIGNAL(triggered()),
+        this, SLOT(isotropic_remeshing()));
+    }
+  }
+
+  QList<QAction*> actions() const {
+    return QList<QAction*>() << actionIsotropicRemeshing_;
+  }
+
+  bool applicable(QAction*) const
+  {
+    if (scene->selectionIndices().size() == 1)
+    {
+    return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()))
+    || qobject_cast<Scene_polyhedron_selection_item*>(scene->item(scene->mainSelectionIndex()));
+    }
+
+    Q_FOREACH(int index, scene->selectionIndices())
+    {
+      //if one polyhedron is found in the selection, it's fine
+      if (qobject_cast<Scene_polyhedron_item*>(scene->item(index)))
+        return true;
+    }
+    return false;
+  }
+
+  template <typename FacetHandle>
+  struct Patch_id_pmap
+  {
+    typedef FacetHandle                        key_type;
+    typedef Patch_id                           value_type;
+    typedef Patch_id                           reference;
+    typedef boost::read_write_property_map_tag category;
+
+    friend value_type get(const Patch_id_pmap&, const key_type& f){
+      return f->patch_id();
+    }
+    friend void put(Patch_id_pmap&, const key_type& f, const value_type i){
+      f->set_patch_id(i);
+    }
+  };
+
+  void detect_and_split_duplicates(std::vector<Scene_polyhedron_item*>& selection,
+                                   std::map<Polyhedron*,Edge_set>& edges_to_protect,
+                                   double target_length)
+  {
+    typedef Polyhedron::Point_3 Point_3;
+    typedef std::pair<Point_3,Point_3> Segment_3;
+
+    typedef std::map< Segment_3,
+                      std::vector< std::pair<halfedge_descriptor, Polyhedron*> > > MapType;
+    MapType duplicated_edges;
+
+
+    BOOST_FOREACH(Scene_polyhedron_item* poly_item, selection){
+      Polyhedron& pmesh = *poly_item->polyhedron();
+      BOOST_FOREACH(edge_descriptor ed, edges(pmesh)){
+        halfedge_descriptor hd = halfedge(ed,pmesh);
+        Point_3 p = source(hd,pmesh)->point(), q = target(hd,pmesh)->point();
+        Segment_3 s = CGAL::make_sorted_pair(p,q);
+        if (s.first==q) hd=opposite(hd,pmesh); // make sure the halfedges are consistently oriented
+
+        duplicated_edges[s].push_back( std::make_pair(hd,&pmesh) );
+      }
+    }
+
+    // consistently split duplicate edges and triangulate incident faces
+    typedef std::pair<face_descriptor, Polyhedron*> Face_and_poly;
+    std::set< Face_and_poly > faces_to_triangulate;
+    BOOST_FOREACH(const MapType::value_type& p, duplicated_edges)
+      if (p.second.size()>1){
+        //collect faces to retriangulate
+        typedef std::pair<halfedge_descriptor, Polyhedron*> Pair_type;
+        BOOST_FOREACH(const Pair_type& h_and_p, p.second)
+        {
+          halfedge_descriptor hc=h_and_p.first;
+          Polyhedron* polyc = h_and_p.second;
+
+          if ( !is_border(hc, *polyc) )
+            faces_to_triangulate.insert( Face_and_poly(face(hc,*polyc), polyc) );
+          if ( !is_border(opposite(hc, *polyc), *polyc) )
+            faces_to_triangulate.insert(
+              Face_and_poly(face(opposite(hc, *polyc),*polyc), polyc) );
+        }
+        // split the edges
+        split_long_duplicated_edge(p.second, target_length, edges_to_protect);
+      }
+    // now retriangulate
+    namespace PMP=CGAL::Polygon_mesh_processing;
+    BOOST_FOREACH(Face_and_poly f_and_p, faces_to_triangulate)
+      PMP::triangulate_face(f_and_p.first, *f_and_p.second);
+  }
+
+
+public Q_SLOTS:
+  void isotropic_remeshing()
+  {
+    if (scene->selectionIndices().size() > 1)
+    {
+      isotropic_remeshing_of_several_polyhedra();
+      return;
+    }
+    const Scene_interface::Item_id index = scene->mainSelectionIndex();
+
+    Scene_polyhedron_item* poly_item =
+      qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+
+    Scene_polyhedron_selection_item* selection_item =
+      qobject_cast<Scene_polyhedron_selection_item*>(scene->item(index));
+
+    if (poly_item || selection_item)
+    {
+      // Create dialog box
+      QDialog dialog(mw);
+      Ui::Isotropic_remeshing_dialog ui
+        = remeshing_dialog(&dialog, poly_item, selection_item);
+
+      // Get values
+      int i = dialog.exec();
+      if (i == QDialog::Rejected)
+      {
+        std::cout << "Remeshing aborted" << std::endl;
+        return;
+      }
+      bool edges_only = ui.splitEdgesOnly_checkbox->isChecked();
+      bool preserve_duplicates = ui.preserveDuplicates_checkbox->isChecked();
+      double target_length = ui.edgeLength_dspinbox->value();
+      unsigned int nb_iter = ui.nbIterations_spinbox->value();
+      unsigned int nb_smooth = ui.nbSmoothing_spinbox->value();
+      bool protect = ui.protect_checkbox->isChecked();
+      bool smooth_features = ui.smooth1D_checkbox->isChecked();
+
+      // wait cursor
+      QApplication::setOverrideCursor(Qt::WaitCursor);
+
+      QTime time;
+      time.start();
+
+      typedef boost::graph_traits<Polyhedron>::edge_descriptor edge_descriptor;
+      typedef boost::graph_traits<Polyhedron>::halfedge_descriptor halfedge_descriptor;
+      typedef boost::graph_traits<Polyhedron>::face_descriptor face_descriptor;
+
+      const Polyhedron& pmesh = (poly_item != NULL)
+        ? *poly_item->polyhedron()
+        : *selection_item->polyhedron();
+
+      boost::property_map<Polyhedron, CGAL::face_index_t>::type fim
+        = get(CGAL::face_index, pmesh);
+      unsigned int id = 0;
+      BOOST_FOREACH(face_descriptor f, faces(pmesh))
+      {
+        put(fim, f, id++);
+      }
+
+      if (selection_item)
+      {
+        if (edges_only)
+        {
+          std::vector<edge_descriptor> edges;
+          BOOST_FOREACH(edge_descriptor e, selection_item->selected_edges)
+          {
+            if (selection_item->selected_facets.find(face(halfedge(e, pmesh), pmesh))
+                 != selection_item->selected_facets.end()
+             || selection_item->selected_facets.find(face(opposite(halfedge(e, pmesh), pmesh), pmesh))
+                 != selection_item->selected_facets.end())
+              edges.push_back(e);
+          }
+          BOOST_FOREACH(face_descriptor f, selection_item->selected_facets)
+          {
+            BOOST_FOREACH(halfedge_descriptor he, halfedges_around_face(halfedge(f, pmesh), pmesh))
+            {
+              if (selection_item->selected_facets.find(face(opposite(he, pmesh), pmesh))
+                  == selection_item->selected_facets.end())
+              edges.push_back(edge(he, pmesh));
+            }
+          }
+          if (!edges.empty())
+            CGAL::Polygon_mesh_processing::split_long_edges(
+              edges
+              , target_length
+              , *selection_item->polyhedron()
+              , PMP::parameters::geom_traits(Kernel())
+              .edge_is_constrained_map(selection_item->constrained_edges_pmap()));
+          else
+            std::cout << "No selected or boundary edges to be split" << std::endl;
+        }
+        else
+        {
+          selection_item->setItemIsMulticolor(true);
+
+          if (selection_item->selected_facets.empty() &&
+            (!selection_item->selected_edges.empty() || !selection_item->selected_vertices.empty()))
+            CGAL::Polygon_mesh_processing::isotropic_remeshing(
+              faces(*selection_item->polyhedron())
+              , target_length
+              , *selection_item->polyhedron()
+              , CGAL::Polygon_mesh_processing::parameters::number_of_iterations(nb_iter)
+              .protect_constraints(protect)
+              .edge_is_constrained_map(selection_item->constrained_edges_pmap())
+              .relax_constraints(smooth_features)
+              .number_of_relaxation_steps(nb_smooth)
+              .vertex_is_constrained_map(selection_item->constrained_vertices_pmap())
+              .face_patch_map(Patch_id_pmap<face_descriptor>()));
+          else
+            CGAL::Polygon_mesh_processing::isotropic_remeshing(
+              selection_item->selected_facets
+              , target_length
+              , *selection_item->polyhedron()
+              , CGAL::Polygon_mesh_processing::parameters::number_of_iterations(nb_iter)
+              .protect_constraints(protect)
+              .edge_is_constrained_map(selection_item->constrained_edges_pmap())
+              .relax_constraints(smooth_features)
+              .number_of_relaxation_steps(nb_smooth)
+              .vertex_is_constrained_map(selection_item->constrained_vertices_pmap())
+              .face_patch_map(Patch_id_pmap<face_descriptor>()));
+        }
+        selection_item->polyhedron_item()->setColor(
+              selection_item->polyhedron_item()->color());
+        selection_item->poly_item_changed();
+        selection_item->clear<face_descriptor>();
+        selection_item->changed_with_poly_item();
+      }
+      else if (poly_item)
+      {
+        if (edges_only)
+        {
+          std::vector<halfedge_descriptor> border;
+          CGAL::Polygon_mesh_processing::border_halfedges(
+            faces(*poly_item->polyhedron()),
+            pmesh,
+            std::back_inserter(border));
+          std::vector<edge_descriptor> border_edges;
+          BOOST_FOREACH(halfedge_descriptor h, border)
+            border_edges.push_back(edge(h, pmesh));
+
+          if (!border_edges.empty())
+            CGAL::Polygon_mesh_processing::split_long_edges(
+              border_edges
+              , target_length
+              , *poly_item->polyhedron()
+              , PMP::parameters::geom_traits(Kernel()));
+          else
+            std::cout << "No border to be split" << std::endl;
+        }
+        else
+        {
+          // tricks to use the function detect_and_split_duplicates
+          // that uses several poly items
+          std::map<Polyhedron*, Edge_set > edges_to_protect_map;
+          std::vector<Scene_polyhedron_item*> poly_items(1, poly_item);
+          Edge_set& edges_to_protect = edges_to_protect_map[poly_item->polyhedron()];
+          if (preserve_duplicates)
+          {
+            detect_and_split_duplicates(poly_items, edges_to_protect_map, target_length);
+            boost::property_map<Polyhedron, CGAL::face_index_t>::type fim = get(CGAL::face_index, pmesh);
+            unsigned int id = 0;
+            BOOST_FOREACH(face_descriptor f, faces(pmesh))
+              put(fim, f, id++);
+          }
+          Scene_polyhedron_selection_item::Is_constrained_map<Edge_set> ecm(&edges_to_protect);
+
+          CGAL::Polygon_mesh_processing::isotropic_remeshing(
+           faces(*poly_item->polyhedron())
+         , target_length
+         , *poly_item->polyhedron()
+         , CGAL::Polygon_mesh_processing::parameters::number_of_iterations(nb_iter)
+         .protect_constraints(protect)
+         .number_of_relaxation_steps(nb_smooth)
+         .face_patch_map(Patch_id_pmap<face_descriptor>())
+         .edge_is_constrained_map(ecm)
+         .relax_constraints(smooth_features));
+        }
+        poly_item->invalidateOpenGLBuffers();
+        Q_EMIT poly_item->itemChanged();
+      }
+      else{
+        std::cout << "Can't remesh that type of thing" << std::endl;
+      }
+      std::cout << "ok (" << time.elapsed() << " ms)" << std::endl;
+
+      // default cursor
+      QApplication::restoreOverrideCursor();
+    }
+  }
+
+  void isotropic_remeshing_of_several_polyhedra()
+  {
+    // Remeshing parameters
+    bool edges_only = false, preserve_duplicates = false;
+    double target_length = 0.;
+    unsigned int nb_iter = 1;
+    bool protect = false;
+    bool smooth_features = true;
+
+    std::vector<Scene_polyhedron_item*> selection;
+    BOOST_FOREACH(int index, scene->selectionIndices())
+    {
+      Scene_polyhedron_item* poly_item =
+        qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+
+      if (poly_item == NULL)
+      {
+        std::cout << scene->item(index)->name().data()
+          << " is not a Polyhedron, remeshing skipped\n";
+        continue;
+      }
+      else
+      {
+        selection.push_back(poly_item);
+
+        if (target_length == 0.)//parameters have not been set yet
+        {
+        QDialog dialog(mw);
+        Ui::Isotropic_remeshing_dialog ui = remeshing_dialog(&dialog, poly_item);
+        ui.objectName->setText(QString::number(scene->selectionIndices().size())
+          .append(QString(" items to be remeshed")));
+        int i = dialog.exec();
+        if (i == QDialog::Rejected)
+        {
+          std::cout << "Remeshing aborted" << std::endl;
+          return;
+        }
+
+        edges_only = ui.splitEdgesOnly_checkbox->isChecked();
+        preserve_duplicates = ui.preserveDuplicates_checkbox->isChecked();
+        target_length = ui.edgeLength_dspinbox->value();
+        nb_iter = ui.nbIterations_spinbox->value();
+        protect = ui.protect_checkbox->isChecked();
+        smooth_features = ui.smooth1D_checkbox->isChecked();
+        }
+      }
+    }
+
+    if(target_length == 0.)//parameters have not been set
+    {                      // i.e. no item is a polyhedron
+      std::cout << "Remeshing aborted" << std::endl;
+      return;
+    }
+
+    // wait cursor
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    int total_time = 0;
+
+
+    //     typedef boost::graph_traits<Polyhedron>::edge_descriptor edge_descriptor;
+    std::map<Polyhedron*,Edge_set > edges_to_protect;
+
+    if(preserve_duplicates)
+      detect_and_split_duplicates(selection, edges_to_protect, target_length);
+
+#ifdef CGAL_LINKED_WITH_TBB
+    QTime time;
+    time.start();
+
+      tbb::parallel_for(
+        tbb::blocked_range<std::size_t>(0, selection.size()),
+        Remesh_polyhedron_item_for_parallel_for<Remesh_polyhedron_item>(
+                                                                        selection, edges_to_protect, edges_only, target_length, nb_iter, protect, smooth_features));
+
+    total_time = time.elapsed();
+
+#else
+
+    Remesh_polyhedron_item remesher(edges_only,
+      target_length, nb_iter, protect, smooth_features);
+    BOOST_FOREACH(Scene_polyhedron_item* poly_item, selection)
+    {
+      QTime time;
+      time.start();
+
+      remesher(poly_item, edges_to_protect[poly_item->polyhedron()]);
+
+      total_time += time.elapsed();
+      std::cout << "Remeshing of " << poly_item->name().data()
+                << " done in " << time.elapsed() << " ms" << std::endl;
+    }
+#endif
+    std::cout << "Remeshing of all selected items done in "
+      << total_time << " ms" << std::endl;
+
+    BOOST_FOREACH(Scene_polyhedron_item* poly_item, selection)
+    {
+      poly_item->invalidateOpenGLBuffers();
+      Q_EMIT poly_item->itemChanged();
+    }
+
+    // default cursor
+    QApplication::restoreOverrideCursor();
+  }
+
+private:
+  Scene_interface *scene;
+  QMainWindow* mw;
+  struct Remesh_polyhedron_item
+  {
+    typedef boost::graph_traits<Polyhedron>::edge_descriptor     edge_descriptor;
+    typedef boost::graph_traits<Polyhedron>::halfedge_descriptor halfedge_descriptor;
+    typedef boost::graph_traits<Polyhedron>::face_descriptor     face_descriptor;
+
+    bool edges_only_;
+    double target_length_;
+    unsigned int nb_iter_;
+    bool protect_;
+    bool smooth_features_;
+
+  protected:
+    void remesh(Scene_polyhedron_item* poly_item,
+                Edge_set& edges_to_protect) const
+    {
+      //fill face_index property map
+      boost::property_map<Polyhedron, CGAL::face_index_t>::type fim
+        = get(CGAL::face_index, *poly_item->polyhedron());
+      unsigned int id = 0;
+      BOOST_FOREACH(face_descriptor f, faces(*poly_item->polyhedron()))
+      { put(fim, f, id++); }
+
+      if (edges_only_)
+      {
+        std::vector<halfedge_descriptor> border;
+        CGAL::Polygon_mesh_processing::border_halfedges(
+          faces(*poly_item->polyhedron())
+          , *poly_item->polyhedron()
+          , std::back_inserter(border));
+        std::vector<edge_descriptor> border_edges;
+        BOOST_FOREACH(halfedge_descriptor h, border)
+          border_edges.push_back(edge(h, *poly_item->polyhedron()));
+
+        CGAL::Polygon_mesh_processing::split_long_edges(
+            border_edges
+          , target_length_
+          , *poly_item->polyhedron());
+      }
+      else
+      {
+        std::cout << "Isotropic remeshing of "
+          << poly_item->name().toStdString() << " started..." << std::endl;
+        Scene_polyhedron_selection_item::Is_constrained_map<Edge_set> ecm(&edges_to_protect);
+        CGAL::Polygon_mesh_processing::isotropic_remeshing(
+            faces(*poly_item->polyhedron())
+          , target_length_
+          , *poly_item->polyhedron()
+          , CGAL::Polygon_mesh_processing::parameters::number_of_iterations(nb_iter_)
+          .protect_constraints(protect_)
+          .edge_is_constrained_map(ecm)
+          .face_patch_map(Patch_id_pmap<face_descriptor>())
+          .relax_constraints(smooth_features_));
+        std::cout << "Isotropic remeshing of "
+          << poly_item->name().toStdString() << " done." << std::endl;
+      }
+    }
+
+  public:
+    Remesh_polyhedron_item(
+      const bool edges_only,
+      const double target_length,
+      const unsigned int nb_iter,
+      const bool protect,
+      const bool smooth_features)
+      : edges_only_(edges_only)
+      , target_length_(target_length)
+      , nb_iter_(nb_iter)
+      , protect_(protect)
+      , smooth_features_(smooth_features)
+    {}
+
+    Remesh_polyhedron_item(const Remesh_polyhedron_item& remesh)
+      : edges_only_(remesh.edges_only_)
+      , target_length_(remesh.target_length_)
+      , nb_iter_(remesh.nb_iter_)
+      , protect_(remesh.protect_)
+      , smooth_features_(remesh.smooth_features_)
+    {}
+
+    void operator()(Scene_polyhedron_item* poly_item,
+                    Edge_set& edges_to_protect) const
+    {
+      remesh(poly_item, edges_to_protect);
+    }
+  };
+
+#ifdef CGAL_LINKED_WITH_TBB
+  template<typename RemeshFunctor>
+  struct Remesh_polyhedron_item_for_parallel_for
+    : RemeshFunctor
+  {
+    const std::vector<Scene_polyhedron_item*>& selection_;
+    std::map<Polyhedron*,Edge_set >& edges_to_protect_;
+
+  public:
+    // Constructor
+    Remesh_polyhedron_item_for_parallel_for(
+      const std::vector<Scene_polyhedron_item*>& selection,
+      std::map<Polyhedron*,Edge_set >& edges_to_protect,
+      const bool edges_only,
+      const double target_length,
+      const unsigned int nb_iter,
+      const bool protect,
+      const bool smooth_features)
+      : RemeshFunctor(edges_only, target_length, nb_iter, protect, smooth_features)
+      , selection_(selection), edges_to_protect_(edges_to_protect)
+    {}
+
+    // Constructor
+    Remesh_polyhedron_item_for_parallel_for(
+      const Remesh_polyhedron_item_for_parallel_for &remesh)
+      : RemeshFunctor(remesh)
+      , selection_(remesh.selection_)
+      , edges_to_protect_(remesh.edges_to_protect_)
+    {}
+
+    // operator()
+    void operator()(const tbb::blocked_range<size_t>& r) const
+    {
+      for (size_t i = r.begin(); i != r.end(); ++i)
+        RemeshFunctor::remesh(selection_[i], edges_to_protect_[selection_[i]->polyhedron()]);
+    }
+  };
+#endif
+
+  Ui::Isotropic_remeshing_dialog
+  remeshing_dialog(QDialog* dialog,
+                   Scene_polyhedron_item* poly_item,
+                   Scene_polyhedron_selection_item* selection_item = NULL)
+  {
+    Ui::Isotropic_remeshing_dialog ui;
+    ui.setupUi(dialog);
+    connect(ui.buttonBox, SIGNAL(accepted()), dialog, SLOT(accept()));
+    connect(ui.buttonBox, SIGNAL(rejected()), dialog, SLOT(reject()));
+
+    //connect checkbox to spinbox
+    connect(ui.splitEdgesOnly_checkbox, SIGNAL(toggled(bool)),
+            ui.nbIterations_spinbox, SLOT(setDisabled(bool)));
+    connect(ui.splitEdgesOnly_checkbox, SIGNAL(toggled(bool)),
+            ui.protect_checkbox, SLOT(setDisabled(bool)));
+    connect(ui.protect_checkbox, SIGNAL(toggled(bool)),
+            ui.smooth1D_checkbox, SLOT(setDisabled(bool)));
+    connect(ui.splitEdgesOnly_checkbox, SIGNAL(toggled(bool)),
+            ui.smooth1D_checkbox, SLOT(setDisabled(bool)));
+    connect(ui.preserveDuplicates_checkbox, SIGNAL(toggled(bool)),
+            ui.protect_checkbox, SLOT(setChecked(bool)));
+    connect(ui.preserveDuplicates_checkbox, SIGNAL(toggled(bool)),
+            ui.protect_checkbox, SLOT(setDisabled(bool)));
+
+    //Set default parameters
+    Scene_interface::Bbox bbox = poly_item != NULL ? poly_item->bbox()
+      : (selection_item != NULL ? selection_item->bbox()
+        : scene->bbox());
+    ui.objectName->setText(poly_item != NULL ? poly_item->name()
+      : (selection_item != NULL ? selection_item->name()
+        : QString("Remeshing parameters")));
+
+    ui.objectNameSize->setText(
+      tr("Object bbox size (w,h,d):  <b>%1</b>,  <b>%2</b>,  <b>%3</b>")
+      .arg(bbox.xmax()-bbox.xmin(), 0, 'g', 3)
+      .arg(bbox.xmax()-bbox.xmin(), 0, 'g', 3)
+      .arg(bbox.xmax()-bbox.xmin(), 0, 'g', 3));
+
+    double diago_length = CGAL::sqrt((bbox.xmax()-bbox.xmin())*(bbox.xmax()-bbox.xmin()) + (bbox.ymax()-bbox.ymin())*(bbox.ymax()-bbox.ymin()) + (bbox.zmax()-bbox.zmin())*(bbox.zmax()-bbox.zmin()));
+    ui.edgeLength_dspinbox->setDecimals(3);
+    ui.edgeLength_dspinbox->setSingleStep(0.001);
+    ui.edgeLength_dspinbox->setRange(1e-6 * diago_length, //min
+      2.   * diago_length);//max
+    ui.edgeLength_dspinbox->setValue(0.05 * diago_length);
+
+    std::ostringstream oss;
+    oss << "Diagonal length of the Bbox of the selection to remesh is ";
+    oss << diago_length << "." << std::endl;
+    oss << "Default is 5% of it" << std::endl;
+    ui.edgeLength_dspinbox->setToolTip(QString::fromStdString(oss.str()));
+
+    ui.nbIterations_spinbox->setSingleStep(1);
+    ui.nbIterations_spinbox->setRange(1/*min*/, 1000/*max*/);
+    ui.nbIterations_spinbox->setValue(1);
+
+    ui.protect_checkbox->setChecked(false);
+    ui.smooth1D_checkbox->setChecked(true);
+
+    if (NULL != selection_item)
+    {
+      //do not preserve duplicates in selection mode
+      ui.preserveDuplicates_checkbox->setDisabled(true);
+      ui.preserveDuplicates_checkbox->setChecked(false);
+    }
+
+    return ui;
+  }
+
+
+private:
+  QAction* actionIsotropicRemeshing_;
+
+}; // end Polyhedron_demo_isotropic_remeshing_plugin
+
+//Q_EXPORT_PLUGIN2(Polyhedron_demo_isotropic_remeshing_plugin,
+//                 Polyhedron_demo_isotropic_remeshing_plugin)
+
+#include "Isotropic_remeshing_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Jet_fitting_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Jet_fitting_plugin.cpp
new file mode 100644
index 0000000..4b207b7
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Jet_fitting_plugin.cpp
@@ -0,0 +1,146 @@
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+#include "Polyhedron_type.h"
+#include "Scene_polyhedron_item.h"
+#include "Scene_polylines_item.h"
+
+#include <limits>
+
+#include "Scene.h"
+#include <QApplication>
+#include <QMainWindow>
+
+#include <CGAL/Monge_via_jet_fitting.h>
+#include <CGAL/Polygon_mesh_processing/compute_normal.h>
+using namespace CGAL::Three;
+class Polyhedron_demo_jet_fitting_plugin :
+  public QObject,
+  public Polyhedron_demo_plugin_interface
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+public:
+
+  QList<QAction*> actions() const {
+    return _actions;
+  }
+  void init(QMainWindow* mw,
+            Scene_interface* scene_interface,
+            Messages_interface*)
+  {
+      scene = scene_interface;
+      QAction *actionEstimateCurvature = new QAction(tr("Curvature Estimation"), mw);
+      actionEstimateCurvature->setProperty("subMenuName",
+                                           "Estimation of Local Differential Properties");
+      connect(actionEstimateCurvature, SIGNAL(triggered()), this, SLOT(on_actionEstimateCurvature_triggered()));
+      _actions <<actionEstimateCurvature;
+
+  }
+
+  bool applicable(QAction*) const { 
+    return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
+  }
+
+public Q_SLOTS:
+  void on_actionEstimateCurvature_triggered();
+private :
+  Scene_interface *scene;
+  QList<QAction*> _actions;
+}; // end Polyhedron_demo_jet_fitting_plugin
+
+void Polyhedron_demo_jet_fitting_plugin::on_actionEstimateCurvature_triggered()
+{
+  // get active polyhedron
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+  Scene_polyhedron_item* poly_item = 
+    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+  if(!poly_item)
+    return;
+
+  // wait cursor
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+
+  Polyhedron* pMesh = poly_item->polyhedron();
+
+  // types
+  typedef CGAL::Monge_via_jet_fitting<Kernel> Fitting;
+  typedef Fitting::Monge_form Monge_form;
+
+  typedef Kernel::Point_3 Point;
+
+  Scene_polylines_item* max_curv = new Scene_polylines_item;
+  max_curv->setColor(Qt::red);
+  max_curv->setName(tr("%1 (max curvatures)").arg(poly_item->name()));
+  Scene_polylines_item* min_curv = new Scene_polylines_item;
+  min_curv->setColor(Qt::green);
+  min_curv->setName(tr("%1 (min curvatures)").arg(poly_item->name()));
+
+  Polyhedron::Vertex_iterator v;
+  for(v = pMesh->vertices_begin();
+      v != pMesh->vertices_end();
+      v++)
+  {
+    std::vector<Point> points;
+
+    // pick central point
+    const Point& central_point = v->point();
+    points.push_back(central_point);
+
+    // compute min edge len around central vertex
+    // to scale the ribbons used to display the directions
+
+    typedef Kernel::FT FT;
+
+    FT min_edge_len = std::numeric_limits<FT>::infinity();
+    Polyhedron::Halfedge_around_vertex_circulator he = v->vertex_begin();
+    Polyhedron::Halfedge_around_vertex_circulator end = he;
+    CGAL_For_all(he,end)
+    {
+      const Point& p = he->opposite()->vertex()->point();
+      points.push_back(p);
+      FT edge_len = std::sqrt(CGAL::squared_distance(central_point,p));
+      min_edge_len = edge_len < min_edge_len ? edge_len : min_edge_len; // avoids #undef min
+    }
+
+    if(points.size() > 5)
+    {
+      // estimate curvature by fitting
+      Fitting monge_fit;
+      const int dim_monge = 2;
+      const int dim_fitting = 2;
+      Monge_form monge_form = monge_fit(points.begin(),points.end(),dim_fitting,dim_monge);
+
+      // make monge form comply with vertex normal (to get correct
+      // orientation)
+      typedef Kernel::Vector_3 Vector;
+      Vector n = CGAL::Polygon_mesh_processing::compute_vertex_normal(v, *pMesh);
+      monge_form.comply_wrt_given_normal(n);
+
+      Vector umin = min_edge_len * monge_form.minimal_principal_direction();
+      Vector umax = min_edge_len * monge_form.maximal_principal_direction();
+
+      Scene_polylines_item::Polyline max_segment(2), min_segment(2);
+
+      const double du = 0.2;
+
+      max_segment[0] = central_point + du * umax;
+      max_segment[1] = central_point - du * umax;
+      min_segment[0] = central_point + du * umin;
+      min_segment[1] = central_point - du * umin;
+
+      max_curv->polylines.push_back(max_segment);
+      min_curv->polylines.push_back(min_segment);
+    }
+  }
+
+  scene->addItem(max_curv);
+  scene->addItem(min_curv);
+  max_curv->invalidateOpenGLBuffers();
+  min_curv->invalidateOpenGLBuffers();
+  
+  // default cursor
+  QApplication::restoreOverrideCursor();
+}
+
+#include "Jet_fitting_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Join_and_split_polyhedra_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Join_and_split_polyhedra_plugin.cpp
new file mode 100644
index 0000000..551c29e
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Join_and_split_polyhedra_plugin.cpp
@@ -0,0 +1,238 @@
+#include <QApplication>
+#include <QMessageBox>
+#include <QMainWindow>
+#include "Kernel_type.h"
+#include "Polyhedron_type.h"
+#include "Scene_polyhedron_item.h"
+#include "Scene_polyhedron_selection_item.h"
+#include "Scene_polylines_item.h"
+#include "Messages_interface.h"
+
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
+
+#include <CGAL/Polyhedron_copy_3.h>
+#include <CGAL/Polygon_mesh_processing/connected_components.h>
+
+#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
+#include <CGAL/property_map.h>
+
+#include <boost/foreach.hpp>
+#include <boost/function_output_iterator.hpp>
+#include <boost/unordered_map.hpp>
+
+using namespace CGAL::Three;
+class Polyhedron_demo_join_and_split_polyhedra_plugin:
+  public QObject,
+  public Polyhedron_demo_plugin_helper
+{
+  Q_OBJECT
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  QAction* actionJoinPolyhedra, *actionSplitPolyhedra, *actionColorConnectedComponents;
+  Messages_interface* msg_interface;
+public:
+  QList<QAction*> actions() const { return QList<QAction*>() << actionJoinPolyhedra << actionSplitPolyhedra << actionColorConnectedComponents; }
+
+  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface* m)
+  {
+    mw = mainWindow;
+    scene = scene_interface;
+    msg_interface = m;
+
+    actionJoinPolyhedra= new QAction(tr("Join Selected Polyhedra"), mainWindow);
+    actionJoinPolyhedra->setProperty("subMenuName", "Operations on Polyhedra");
+    actionJoinPolyhedra->setObjectName("actionJoinPolyhedra");
+
+    actionSplitPolyhedra= new QAction(tr("Split Selected Polyhedra"), mainWindow);
+    actionSplitPolyhedra->setProperty("subMenuName", "Operations on Polyhedra");
+    actionSplitPolyhedra->setObjectName("actionSplitPolyhedra");
+
+    actionColorConnectedComponents = new QAction(tr("Color Each Connected Component"), mainWindow);
+    actionColorConnectedComponents ->setProperty("subMenuName", "Polygon Mesh Processing");
+    actionColorConnectedComponents->setObjectName("actionColorConnectedComponents");
+
+    autoConnectActions();
+  }
+
+  bool applicable(QAction* a) const
+  {
+    Q_FOREACH(int index, scene->selectionIndices())
+    {
+      if (qobject_cast<Scene_polyhedron_item*>(scene->item(index)))
+        return true;
+      else if (a == actionColorConnectedComponents
+            && qobject_cast<Scene_polyhedron_selection_item*>(scene->item(index)))
+        return true;
+    }
+    return false;
+  }
+
+public Q_SLOTS:
+  void on_actionJoinPolyhedra_triggered();
+  void on_actionSplitPolyhedra_triggered();
+  void on_actionColorConnectedComponents_triggered();
+
+private :
+  CGAL::Three::Scene_interface* scene;
+}; // end Polyhedron_demo_polyhedron_stitching_plugin
+
+void Polyhedron_demo_join_and_split_polyhedra_plugin::on_actionJoinPolyhedra_triggered()
+{
+  CGAL::Three::Scene_interface::Item_id mainSelectionIndex
+    = scene->mainSelectionIndex();
+  Scene_polyhedron_item* mainSelectionItem
+    = qobject_cast<Scene_polyhedron_item*>(scene->item(mainSelectionIndex));
+
+  QList<int> indices_to_remove;
+  Q_FOREACH(int index, scene->selectionIndices()) {
+    if (index == mainSelectionIndex)
+      continue;
+
+    Scene_polyhedron_item* item =
+      qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+    if(item)
+    {
+      indices_to_remove.push_front(index);
+      CGAL::Polyhedron_copy_3<Polyhedron, Polyhedron::HalfedgeDS, false>
+        modifier( *(item->polyhedron()) );
+      mainSelectionItem->polyhedron()->delegate(modifier);
+    }
+  }
+
+  mainSelectionItem->invalidateOpenGLBuffers();
+  scene->itemChanged(mainSelectionIndex);
+
+  //remove the other items
+  Q_FOREACH(int index, indices_to_remove)
+  {
+    scene->erase(index);
+  }
+}
+
+struct Polyhedron_appender{
+  Polyhedron_appender(std::list<Polyhedron*>& new_polyhedra):
+    m_new_polyhedra(new_polyhedra) {}
+  void operator()(const Polyhedron& p){
+    m_new_polyhedra.push_back( new Polyhedron(p) );
+  }
+  std::list<Polyhedron*>& m_new_polyhedra;
+};
+
+void Polyhedron_demo_join_and_split_polyhedra_plugin::on_actionSplitPolyhedra_triggered()
+{
+  Q_FOREACH(int index, scene->selectionIndices()) {
+    Scene_polyhedron_item* item =
+      qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+    if(item)
+    {
+      QApplication::setOverrideCursor(Qt::WaitCursor);
+      std::list<Polyhedron*> new_polyhedra;
+      CGAL::internal::corefinement::extract_connected_components(
+        *item->polyhedron(),
+        boost::make_function_output_iterator(Polyhedron_appender(new_polyhedra))
+      );
+
+      if (new_polyhedra.size()==1)
+      {
+        delete new_polyhedra.front();
+        msg_interface->information( tr("%1 has only one connected component").arg(item->name()) );
+        continue;
+      }
+
+      int cc=0;
+      BOOST_FOREACH(Polyhedron* polyhedron_ptr, new_polyhedra)
+      {
+        Scene_polyhedron_item* new_item=new Scene_polyhedron_item(polyhedron_ptr);
+        new_item->setName(tr("%1 - CC %2").arg(item->name()).arg(cc));
+        ++cc;
+        scene->addItem(new_item);
+      }
+      item->setVisible(false);
+      QApplication::restoreOverrideCursor();
+    }
+  }
+}
+
+struct Polyhedron_cc_marker{
+  int cc_index;
+  Polyhedron_cc_marker() : cc_index(0) {}
+  void start_new_connected_component(){
+    ++cc_index;
+  }
+
+  template <class Facet_iterator>
+  void mark(Facet_iterator begin, Facet_iterator end)
+  {
+    for(;begin!=end; ++begin)
+      (*begin)->set_patch_id(cc_index-1);
+  }
+};
+
+void Polyhedron_demo_join_and_split_polyhedra_plugin::on_actionColorConnectedComponents_triggered()
+{
+  // wait cursor
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+
+  std::set<Scene_polyhedron_item*> to_skip;
+
+  Q_FOREACH(int index, scene->selectionIndices())
+  {
+    Scene_polyhedron_item* item =
+      qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+    if(item && to_skip.find(item) == to_skip.end())
+    {
+      item->setItemIsMulticolor(true);
+      Polyhedron_cc_marker marker;
+      CGAL::internal::corefinement::mark_connected_components(
+        *item->polyhedron(),
+        CGAL::internal::corefinement::Dummy_true(),
+        marker
+      );
+      item->invalidateOpenGLBuffers();
+      scene->itemChanged(item);
+    }
+    else
+    {
+      Scene_polyhedron_selection_item* selection_item =
+        qobject_cast<Scene_polyhedron_selection_item*>(scene->item(index));
+
+      if (selection_item)
+      {
+        namespace PMP = CGAL::Polygon_mesh_processing;
+        typedef boost::graph_traits<Polyhedron>::face_descriptor   face_descriptor;
+
+        selection_item->polyhedron_item()->setItemIsMulticolor(true);
+        selection_item->polyhedron_item()->set_color_vector_read_only(false);
+
+        const Polyhedron& pmesh = *(selection_item->polyhedron());
+
+        boost::property_map<Polyhedron, boost::face_external_index_t>::type fim
+          = get(boost::face_external_index, pmesh);
+        boost::vector_property_map<int,
+          boost::property_map<Polyhedron, boost::face_external_index_t>::type>
+          fccmap(fim);
+
+        std::cout << "color CC" << std::endl;
+
+        PMP::connected_components(pmesh
+          , fccmap
+          , PMP::parameters::edge_is_constrained_map(selection_item->constrained_edges_pmap())
+          .face_index_map(fim));
+
+        BOOST_FOREACH(face_descriptor f, faces(pmesh))
+          f->set_patch_id(fccmap[f]);
+
+        to_skip.insert(selection_item->polyhedron_item());
+
+        selection_item->changed_with_poly_item();
+      }
+    }
+
+    // default cursor
+    QApplication::restoreOverrideCursor();
+  }
+}
+
+
+#include "Join_and_split_polyhedra_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.cpp
new file mode 100644
index 0000000..b1139bf
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.cpp
@@ -0,0 +1,920 @@
+#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+#include "ui_Mean_curvature_flow_skeleton_plugin.h"
+#include "Scene_polyhedron_item.h"
+#include "Scene_points_with_normal_item.h"
+#include "Scene_polylines_item.h"
+#include "Scene.h"
+
+#include "Polyhedron_type.h"
+
+#include <QApplication>
+#include <QMainWindow>
+#include <QInputDialog>
+#include <QTime>
+#include <QMessageBox>
+
+#include <Eigen/Sparse>
+
+#include <boost/property_map/property_map.hpp>
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/adjacency_list.hpp>
+
+#include <CGAL/Simple_cartesian.h>
+#include <CGAL/Eigen_solver_traits.h>
+#include <CGAL/extract_mean_curvature_flow_skeleton.h>
+#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
+#include <CGAL/iterator.h>
+#include <CGAL/Polygon_mesh_processing/connected_components.h>
+#include <CGAL/boost/graph/split_graph_into_polylines.h>
+#include <CGAL/mesh_segmentation.h>
+#include <CGAL/Polyhedron_copy_3.h>
+#include <queue>
+
+
+typedef boost::graph_traits<Polyhedron>::vertex_descriptor          vertex_descriptor;
+typedef boost::graph_traits<Polyhedron>::vertex_iterator            vertex_iterator;
+typedef boost::graph_traits<Polyhedron>::halfedge_descriptor        halfedge_descriptor;
+typedef Polyhedron::Facet_iterator                                  Facet_iterator;
+
+typedef CGAL::Mean_curvature_flow_skeletonization<Polyhedron>      Mean_curvature_skeleton;
+typedef Mean_curvature_skeleton::Skeleton Skeleton;
+
+typedef Polyhedron::Traits         Kernel;
+typedef Kernel::Point_3            Point;
+
+struct Polyline_visitor
+{
+  typedef std::vector<Point> Polyline;
+  typedef std::vector<std::size_t> Polyline_of_ids;
+
+  std::list<Polyline>& polylines;
+  Skeleton& skeleton;
+
+  Polyline_visitor(std::list<Polyline>& lines, Skeleton& skeleton)
+    : polylines(lines),
+      skeleton(skeleton)
+  {}
+
+  void start_new_polyline()
+  {
+    Polyline V;
+    polylines.push_back(V);
+  }
+
+  void add_node(boost::graph_traits<Skeleton>::vertex_descriptor vd)
+  {
+    Polyline& polyline = polylines.back();
+    polyline.push_back(skeleton[vd].point);
+  }
+
+  void end_polyline(){}
+};
+
+template<class ValueType>
+struct Facet_with_id_pmap
+    : public boost::put_get_helper<ValueType&,
+             Facet_with_id_pmap<ValueType> >
+{
+    typedef Polyhedron::Face_handle key_type;
+    typedef ValueType value_type;
+    typedef value_type& reference;
+    typedef boost::lvalue_property_map_tag category;
+
+    Facet_with_id_pmap(
+      std::vector<ValueType>& internal_vector
+    ) : internal_vector(internal_vector) { }
+
+    reference operator[](key_type key) const
+    { return internal_vector[key->id()]; }
+private:
+    std::vector<ValueType>& internal_vector;
+};
+using namespace CGAL::Three;
+class Polyhedron_demo_mean_curvature_flow_skeleton_plugin :
+  public QObject,
+  public Polyhedron_demo_plugin_helper
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+  QAction* actionMCFSkeleton;
+  QAction* actionConvert_to_medial_skeleton;
+
+public:
+
+  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*) {
+
+    this->mw = mainWindow;
+    this->scene = scene_interface;
+    mcs = NULL;
+    dockWidget = NULL;
+    ui = NULL;
+
+    actionMCFSkeleton = new QAction(tr("Mean Curvature Skeleton (Advanced)"), mainWindow);
+    actionMCFSkeleton->setProperty("subMenuName", "Triangulated Surface Mesh Skeletonization");
+    actionMCFSkeleton->setObjectName("actionMCFSkeleton");
+
+    actionConvert_to_medial_skeleton = new QAction(tr("Extract Medial Skeleton"), mainWindow);
+    actionConvert_to_medial_skeleton->setProperty("subMenuName", "Triangulated Surface Mesh Skeletonization");
+    actionConvert_to_medial_skeleton->setObjectName("actionConvert_to_medial_skeleton");
+
+    dockWidget = new QDockWidget(mw);
+    dockWidget->setVisible(false);
+    ui = new Ui::Mean_curvature_flow_skeleton_plugin();
+    ui->setupUi(dockWidget);
+    dockWidget->setFeatures(QDockWidget::DockWidgetMovable
+                          | QDockWidget::DockWidgetFloatable
+                          | QDockWidget::DockWidgetClosable);
+    dockWidget->setWindowTitle("Mean Curvature Flow Skeleton");
+    addDockWidget(dockWidget);
+
+    connect(ui->pushButton_contract, SIGNAL(clicked()),
+            this, SLOT(on_actionContract()));
+    connect(ui->pushButton_collapse, SIGNAL(clicked()),
+            this, SLOT(on_actionCollapse()));
+    connect(ui->pushButton_split, SIGNAL(clicked()),
+            this, SLOT(on_actionSplit()));
+    connect(ui->pushButton_degeneracy, SIGNAL(clicked()),
+            this, SLOT(on_actionDegeneracy()));
+    connect(ui->pushButton_run, SIGNAL(clicked()),
+            this, SLOT(on_actionRun()));
+    connect(ui->pushButton_skeletonize, SIGNAL(clicked()),
+            this, SLOT(on_actionSkeletonize()));
+    connect(ui->pushButton_converge, SIGNAL(clicked()),
+            this, SLOT(on_actionConverge()));
+    connect(dynamic_cast<Scene*>(scene), SIGNAL(updated_bbox()),
+            this, SLOT(on_actionUpdateBBox()));
+    connect(ui->pushButton_segment, SIGNAL(clicked()),
+            this, SLOT(on_actionSegment()));
+
+    autoConnectActions();
+    QObject* scene_object = dynamic_cast<QObject*>(scene);
+    connect(scene_object, SIGNAL(itemAboutToBeDestroyed(CGAL::Three::Scene_item*)),
+            this, SLOT(on_actionItemAboutToBeDestroyed(CGAL::Three::Scene_item*)));
+  }
+
+  virtual void closure()
+  {
+    dockWidget->hide();
+  }
+
+  QList<QAction*> actions() const {
+    return QList<QAction*>() << actionMCFSkeleton << actionConvert_to_medial_skeleton;
+  }
+
+  bool applicable(QAction*) const {
+    return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
+  }
+
+  void init_ui(double diag) {
+    ui->omega_H->setValue(0.1);
+    ui->omega_H->setSingleStep(0.1);
+    ui->omega_H->setDecimals(3);
+    ui->omega_P->setValue(0.2);
+    ui->omega_P->setSingleStep(0.1);
+    ui->omega_P->setDecimals(3);
+    ui->min_edge_length->setDecimals(7);
+    ui->min_edge_length->setValue(0.002 * diag);
+    ui->min_edge_length->setSingleStep(0.0000001);
+    ui->delta_area->setDecimals(7);
+    ui->delta_area->setValue(1e-4);
+    ui->delta_area->setSingleStep(1e-5);
+    ui->is_medially_centered->setChecked(false);
+
+    ui->label_omega_H->setToolTip(QString("omega_H controls the velocity of movement and approximation quality"));
+    ui->label_omega_P->setToolTip(QString("omega_P controls the smoothness of the medial approximation"));
+    ui->pushButton_contract->setToolTip(QString("contract mesh based on mean curvature flow"));
+    ui->pushButton_collapse->setToolTip(QString("collapse short edges"));
+    ui->pushButton_split->setToolTip(QString("split obtuse triangles"));
+    ui->pushButton_degeneracy->setToolTip(QString("fix degenerate points"));
+    ui->pushButton_skeletonize->setToolTip(QString("Turn mesh to a skeleton curve"));
+    ui->pushButton_run->setToolTip(QString("run one iteration of contract, collapse, split, detect degeneracy"));
+    ui->pushButton_converge->setToolTip(QString("iteratively contract the mesh until convergence"));
+  }
+
+  bool check_item_index(int index) {
+    if (index < 0)
+    {
+      QMessageBox msgBox;
+      msgBox.setText("Please select an item first");
+      msgBox.exec();
+      return false;
+    }
+    return true;
+  }
+
+  /// \todo move this function into an include
+  bool is_mesh_valid(Polyhedron *pMesh) {
+    if (!pMesh->is_closed())
+    {
+      QMessageBox msgBox;
+      msgBox.setText("The mesh is not closed.");
+      msgBox.exec();
+      return false;
+    }
+    if (!pMesh->is_pure_triangle())
+    {
+      QMessageBox msgBox;
+      msgBox.setText("The mesh is not a pure triangle mesh.");
+      msgBox.exec();
+      return false;
+    }
+
+    // the algorithm is only applicable on a mesh
+    // that has only one connected component
+    std::size_t num_component;
+    CGAL::Counting_output_iterator output_it(&num_component);
+    CGAL::internal::corefinement::extract_connected_components(*pMesh, output_it);
+    ++output_it;
+    if (num_component != 1)
+    {
+      QMessageBox msgBox;
+      QString str = QString("The mesh is not a single closed mesh.\n It has %1 components.").arg(num_component);
+      msgBox.setText(str);
+      msgBox.exec();
+      return false;
+    }
+    return true;
+  }
+
+  /// \todo remove duplicated code
+  // check if the Mean_curvature_skeleton exists
+  // or has the same polyheron item
+  // check if the mesh is a watertight triangle mesh
+  bool check_mesh(Scene_polyhedron_item* item) {
+    double omega_H = ui->omega_H->value();
+    double omega_P = ui->omega_P->value();
+    double min_edge_length = ui->min_edge_length->value();
+    double delta_area = ui->delta_area->value();
+    bool is_medially_centered = ui->is_medially_centered->isChecked();
+
+    Polyhedron *pMesh = item->polyhedron();
+
+    if (mcs == NULL)
+    {
+      if (!is_mesh_valid(pMesh))
+      {
+        return false;
+      }
+
+      mcs = new Mean_curvature_skeleton(*pMesh);
+      meso_skeleton = new Polyhedron(*pMesh);
+      input_triangle_mesh = pMesh;
+      //set algorithm parameters
+      mcs->set_quality_speed_tradeoff(omega_H);
+      mcs->set_medially_centered_speed_tradeoff(omega_P);
+      mcs->set_min_edge_length(min_edge_length);
+      mcs->set_is_medially_centered(is_medially_centered);
+      mcs->set_area_variation_factor(delta_area);
+
+      Scene_polyhedron_item* contracted_item = new Scene_polyhedron_item( meso_skeleton );
+      contracted_item->setName(QString("contracted mesh of %1").arg(item->name()));
+
+      InputMeshItemIndex = scene->mainSelectionIndex();
+
+      contractedItemIndex = scene->addItem(contracted_item);
+
+      item->setVisible(false);
+
+      fixedPointsItemIndex = -1;
+      nonFixedPointsItemIndex = -1;
+      poleLinesItemIndex = -1;
+    }
+    else
+    {
+      if (input_triangle_mesh != pMesh)
+      {
+        if (!is_mesh_valid(pMesh))
+        {
+          return false;
+        }
+
+        delete mcs;
+
+        mcs = new Mean_curvature_skeleton(*pMesh);
+        meso_skeleton = new Polyhedron(*pMesh);
+        input_triangle_mesh = pMesh;
+        //set algorithm parameters
+        mcs->set_quality_speed_tradeoff(omega_H);
+        mcs->set_medially_centered_speed_tradeoff(omega_P);
+        mcs->set_min_edge_length(min_edge_length);
+        mcs->set_is_medially_centered(is_medially_centered);
+        mcs->set_area_variation_factor(delta_area);
+
+        Scene_polyhedron_item* contracted_item = new Scene_polyhedron_item(meso_skeleton);
+        contracted_item->setName(QString("contracted mesh of %1").arg(item->name()));
+
+        InputMeshItemIndex = scene->mainSelectionIndex();
+
+        contractedItemIndex = scene->addItem(contracted_item);
+
+        item->setVisible(false);
+
+        fixedPointsItemIndex = -1;
+        nonFixedPointsItemIndex = -1;
+        poleLinesItemIndex = -1;
+      }
+      else
+      {
+        mcs->set_quality_speed_tradeoff(omega_H);
+        mcs->set_medially_centered_speed_tradeoff(omega_P);
+        mcs->set_min_edge_length(min_edge_length);
+        mcs->set_area_variation_factor(delta_area);
+        mcs->set_is_medially_centered(is_medially_centered);
+      }
+    }
+    return true;
+  }
+
+  void update_meso_skeleton()
+  {
+    CGAL::Polyhedron_copy_3<Mean_curvature_skeleton::Meso_skeleton, Polyhedron::HalfedgeDS> modifier(mcs->meso_skeleton());
+    meso_skeleton->delegate(modifier);
+    scene->item(contractedItemIndex)->invalidateOpenGLBuffers();
+    scene->itemChanged(contractedItemIndex);
+  }
+
+  void update_parameters(Mean_curvature_skeleton* mcs)
+  {
+    double omega_H = ui->omega_H->value();
+    double omega_P = ui->omega_P->value();
+    double min_edge_length = ui->min_edge_length->value();
+    double delta_area = ui->delta_area->value();
+    bool is_medially_centered = ui->is_medially_centered->isChecked();
+
+    mcs->set_quality_speed_tradeoff(omega_H);
+    mcs->set_medially_centered_speed_tradeoff(omega_P);
+    mcs->set_min_edge_length(min_edge_length);
+    mcs->set_area_variation_factor(delta_area);
+    mcs->set_is_medially_centered(is_medially_centered);
+  }
+
+public Q_SLOTS:
+  void on_actionMCFSkeleton_triggered();
+  void on_actionConvert_to_medial_skeleton_triggered();
+  void on_actionContract();
+  void on_actionCollapse();
+  void on_actionSplit();
+  void on_actionDegeneracy();
+  void on_actionRun();
+  void on_actionSkeletonize();
+  void on_actionConverge();
+  void on_actionUpdateBBox();
+  void on_actionSegment();
+  void on_actionItemAboutToBeDestroyed(CGAL::Three::Scene_item*);
+
+private:
+  Mean_curvature_skeleton* mcs;
+  Polyhedron* meso_skeleton; // a copy of the meso_skeleton that is displayed
+  Polyhedron* input_triangle_mesh;
+  QDockWidget* dockWidget;
+  Ui::Mean_curvature_flow_skeleton_plugin* ui;
+
+  int fixedPointsItemIndex;
+  int nonFixedPointsItemIndex;
+  int poleLinesItemIndex;
+  int contractedItemIndex;
+  int InputMeshItemIndex;
+
+  Skeleton skeleton_curve;
+}; // end Polyhedron_demo_mean_curvature_flow_skeleton_plugin
+
+void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionMCFSkeleton_triggered()
+{
+  dockWidget->show();
+  dockWidget->raise();
+
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+
+  Scene_polyhedron_item* item =
+    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+
+  if(item)
+  {
+    Polyhedron* pMesh = item->polyhedron();
+
+    if(!pMesh) return;
+
+    double diag = scene->len_diagonal();
+    init_ui(diag);
+
+    fixedPointsItemIndex = -1;
+    nonFixedPointsItemIndex = -1;
+    poleLinesItemIndex = -1;
+    contractedItemIndex = -1;
+    InputMeshItemIndex = -1;
+  }
+}
+
+void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionUpdateBBox()
+{
+  double diag = scene->len_diagonal();
+  ui->min_edge_length->setValue(0.002 * diag);
+}
+
+void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionSegment()
+{
+  if (num_vertices(skeleton_curve)==0 ) on_actionSkeletonize();
+  if (num_vertices(skeleton_curve)==0 ) return;
+
+  QTime time;
+  time.start();
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+
+    // init the polyhedron simplex indices
+  CGAL::set_halfedgeds_items_id(*input_triangle_mesh);
+
+  //for each input vertex compute its distance to the skeleton
+  std::vector<double> distances(num_vertices(*input_triangle_mesh));
+  BOOST_FOREACH(boost::graph_traits<Skeleton>::vertex_descriptor v, vertices(skeleton_curve) )
+  {
+    const Point& skel_pt = skeleton_curve[v].point;
+    BOOST_FOREACH(vertex_descriptor mesh_v, skeleton_curve[v].vertices)
+    {
+      const Point& mesh_pt = mesh_v->point();
+      distances[mesh_v->id()] = std::sqrt(CGAL::squared_distance(skel_pt, mesh_pt));
+    }
+  }
+
+  // create a property-map for sdf values
+  std::vector<double> sdf_values( num_faces(*input_triangle_mesh) );
+  Facet_with_id_pmap<double> sdf_property_map(sdf_values);
+
+  // compute sdf values with skeleton
+  BOOST_FOREACH(Polyhedron::Face_handle f, faces(*input_triangle_mesh))
+  {
+    double dist = 0;
+    BOOST_FOREACH(Polyhedron::Halfedge_handle hd, halfedges_around_face(halfedge(f, *input_triangle_mesh), *input_triangle_mesh))
+      dist+=distances[target(hd, *input_triangle_mesh)->id()];
+    sdf_property_map[f] = dist / 3.;
+  }
+
+  // post-process the sdf values
+  CGAL::sdf_values_postprocessing(*input_triangle_mesh, sdf_property_map);
+
+  // create a property-map for segment-ids (it is an adaptor for this case)
+  std::vector<std::size_t> segment_ids( num_faces(*input_triangle_mesh) );
+  Facet_with_id_pmap<std::size_t> segment_property_map(segment_ids);
+
+  // segment the mesh using default parameters
+  std::cout << "Number of segments: "
+            << CGAL::segmentation_from_sdf_values(*input_triangle_mesh, sdf_property_map, segment_property_map) <<"\n";
+
+  Polyhedron* segmented_polyhedron = new Polyhedron(*input_triangle_mesh);
+
+  int i=0;
+  BOOST_FOREACH(Polyhedron::Face_handle fd, faces(*segmented_polyhedron))
+  {
+    fd->set_patch_id( static_cast<int>(segment_ids[i++] ));
+  }
+
+  scene->item(InputMeshItemIndex)->setVisible(false);
+  Scene_polyhedron_item* item_segmentation = new Scene_polyhedron_item(segmented_polyhedron);
+  item_segmentation->setItemIsMulticolor(true);
+  item_segmentation->invalidateOpenGLBuffers();
+  scene->addItem(item_segmentation);
+  item_segmentation->setName(QString("segmentation"));
+
+  QApplication::restoreOverrideCursor();
+}
+
+void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionConvert_to_medial_skeleton_triggered()
+{
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+
+  Scene_polyhedron_item* item =
+    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+
+  if(item)
+  {
+    Polyhedron* pMesh = item->polyhedron();
+
+    if ( !is_mesh_valid(pMesh) ) return;
+
+    QTime time;
+    time.start();
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+
+    Skeleton skeleton;
+    CGAL::extract_mean_curvature_flow_skeleton(*pMesh, skeleton);
+
+    std::cout << "ok (" << time.elapsed() << " ms, " << ")" << std::endl;
+
+    //create the polylines representing the skeleton
+    Scene_polylines_item* skeleton_item = new Scene_polylines_item();
+    skeleton_item->setColor(QColor(175, 0, 255));
+
+    Polyline_visitor polyline_visitor(skeleton_item->polylines, skeleton);
+    CGAL::split_graph_into_polylines( skeleton,
+                                      polyline_visitor,
+                                      CGAL::internal::IsTerminalDefault() );
+
+    skeleton_item->setName(QString("Medial skeleton curve of %1").arg(item->name()));
+    scene->setSelectedItem(-1);
+    scene->addItem(skeleton_item);
+    skeleton_item->invalidateOpenGLBuffers();
+
+    item->setPointsMode();
+
+    QApplication::restoreOverrideCursor();
+  }
+}
+
+void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionContract()
+{
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+  if (!check_item_index(index))
+  {
+    return;
+  }
+
+  Scene_polyhedron_item* item =
+    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+
+  if (!check_mesh(item))
+  {
+    return;
+  }
+
+  QTime time;
+  time.start();
+  std::cout << "Contract...\n";
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+
+  update_parameters(mcs);
+  mcs->contract_geometry();
+
+  std::cout << "ok (" << time.elapsed() << " ms, " << ")" << std::endl;
+
+  update_meso_skeleton();
+  QApplication::restoreOverrideCursor();
+}
+
+void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionCollapse()
+{
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+  if (!check_item_index(index))
+  {
+    return;
+  }
+
+  Scene_polyhedron_item* item =
+    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+
+  if (!check_mesh(item))
+  {
+    return;
+  }
+
+  QTime time;
+  time.start();
+  std::cout << "Collapse...\n";
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+
+  update_parameters(mcs);
+  std::size_t num_collapses = mcs->collapse_edges();
+  std::cout << "collapsed " << num_collapses << " edges.\n";
+
+  std::cout << "ok (" << time.elapsed() << " ms, " << ")" << std::endl;
+
+  update_meso_skeleton();
+  QApplication::restoreOverrideCursor();
+}
+
+void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionSplit()
+{
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+  if (!check_item_index(index))
+  {
+    return;
+  }
+
+  Scene_polyhedron_item* item =
+    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+
+  if (!check_mesh(item))
+  {
+    return;
+  }
+
+  QTime time;
+  time.start();
+  std::cout << "Split...\n";
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+
+  update_parameters(mcs);
+  std::size_t num_split = mcs->split_faces();
+  std::cout << "split " << num_split << " triangles.\n";
+
+  std::cout << "ok (" << time.elapsed() << " ms, " << ")" << std::endl;
+
+  update_meso_skeleton();
+  QApplication::restoreOverrideCursor();
+}
+
+void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionDegeneracy()
+{
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+  if (!check_item_index(index))
+  {
+    return;
+  }
+
+  Scene_polyhedron_item* item =
+    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+
+  if (!check_mesh(item))
+  {
+    return;
+  }
+
+  QTime time;
+  time.start();
+  std::cout << "Detect degeneracy...\n";
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+
+  update_parameters(mcs);
+  mcs->detect_degeneracies();
+
+  std::cout << "ok (" << time.elapsed() << " ms, " << ")" << std::endl;
+
+  Scene_points_with_normal_item* fixedPointsItem = new Scene_points_with_normal_item;
+  fixedPointsItem->setName(QString("fixed points of %1").arg(item->name()));
+
+  std::vector<Point> fixedPoints;
+  mcs->fixed_points(fixedPoints);
+
+  Point_set *ps = fixedPointsItem->point_set();
+  for (size_t i = 0; i < fixedPoints.size(); ++i)
+  {
+    UI_point_3<Kernel> point(fixedPoints[i].x(), fixedPoints[i].y(), fixedPoints[i].z());
+    ps->push_back(point);
+  }
+  ps->select_all ();
+
+  if (fixedPointsItemIndex == -1)
+  {
+    fixedPointsItemIndex = scene->addItem(fixedPointsItem);
+  }
+  else
+  {
+    Scene_item* temp = scene->replaceItem(fixedPointsItemIndex, fixedPointsItem, false);
+    delete temp;
+  }
+  // update scene
+  update_meso_skeleton();
+  scene->item(fixedPointsItemIndex)->invalidateOpenGLBuffers();
+  scene->itemChanged(fixedPointsItemIndex);
+  scene->setSelectedItem(index);
+  QApplication::restoreOverrideCursor();
+}
+
+void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionRun()
+{
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+  if (!check_item_index(index))
+  {
+    return;
+  }
+
+  Scene_polyhedron_item* item =
+    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+
+  if (!check_mesh(item))
+  {
+    return;
+  }
+
+  QTime time;
+  time.start();
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+
+  std::cout << "Run one iteration...\n";
+
+  update_parameters(mcs);
+  mcs->contract();
+
+  std::cout << "ok (" << time.elapsed() << " ms, " << ")" << std::endl;
+
+  CGAL::Three::Scene_interface::Item_id contracted_item_index = scene->mainSelectionIndex();
+  Scene_polyhedron_item* contracted_item =
+    qobject_cast<Scene_polyhedron_item*>(scene->item(contracted_item_index));
+
+  // update scene
+  Scene_points_with_normal_item* fixedPointsItem = new Scene_points_with_normal_item;
+  fixedPointsItem->setName(QString("fixed points of %1").arg(contracted_item->name()));
+
+  std::vector<Point> fixedPoints;
+  mcs->fixed_points(fixedPoints);
+
+  Point_set *ps = fixedPointsItem->point_set();
+  for (size_t i = 0; i < fixedPoints.size(); ++i)
+  {
+    UI_point_3<Kernel> point(fixedPoints[i].x(), fixedPoints[i].y(), fixedPoints[i].z());
+    ps->push_back(point);
+  }
+  ps->select_all();
+  
+  if (fixedPointsItemIndex == -1)
+  {
+    fixedPointsItemIndex = scene->addItem(fixedPointsItem);
+  }
+  else
+  {
+    Scene_item* temp = scene->replaceItem(fixedPointsItemIndex, fixedPointsItem, false);
+    delete temp;
+  }
+
+//#define DRAW_NON_FIXED_POINTS
+#ifdef DRAW_NON_FIXED_POINTS
+  // draw non-fixed points
+  Scene_points_with_normal_item* nonFixedPointsItem = new Scene_points_with_normal_item;
+  nonFixedPointsItem->setName("non-fixed points");
+  nonFixedPointsItem->setColor(QColor(0, 255, 0));
+  std::vector<Point> nonFixedPoints;
+  mcs->non_fixed_points(nonFixedPoints);
+  ps = nonFixedPointsItem->point_set();
+  for (size_t i = 0; i < nonFixedPoints.size(); ++i)
+  {
+    UI_point_3<Kernel> point(nonFixedPoints[i].x(), nonFixedPoints[i].y(), nonFixedPoints[i].z());
+    ps->push_back(point);
+  }
+  if (nonFixedPointsItemIndex == -1)
+  {
+    nonFixedPointsItemIndex = scene->addItem(nonFixedPointsItem);
+  }
+  else
+  {
+    scene->replaceItem(nonFixedPointsItemIndex, nonFixedPointsItem, false);
+  }
+  scene->itemChanged(nonFixedPointsItemIndex);
+#endif
+
+//#define DRAW_POLE_LINE
+#ifdef DRAW_POLE_LINE
+  // draw lines connecting surface points and their correspondent poles
+  Scene_polylines_item* poleLinesItem = new Scene_polylines_item();
+
+  Polyhedron* pMesh = item->polyhedron();
+  std::vector<Point> pole_points;
+  mcs->poles(pole_points);
+  vertex_iterator vb, ve;
+  int id = 0;
+  for (boost::tie(vb, ve) = vertices(*pMesh); vb != ve; ++vb)
+  {
+    std::vector<Point> line;
+    line.clear();
+
+    vertex_descriptor v = *vb;
+    Point s = v->point();
+    Point t = pole_points[id++];
+
+    line.push_back(s);
+    line.push_back(t);
+    poleLinesItem->polylines.push_back(line);
+  }
+
+  if (poleLinesItemIndex == -1)
+  {
+    poleLinesItemIndex = scene->addItem(poleLinesItem);
+  }
+  else
+  {
+    scene->replaceItem(poleLinesItemIndex, poleLinesItem, false);
+  }
+#endif
+
+  update_meso_skeleton();
+  scene->setSelectedItem(index);
+  QApplication::restoreOverrideCursor();
+}
+
+void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionSkeletonize()
+{
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+  if (!check_item_index(index))
+  {
+    return;
+  }
+
+  Scene_polyhedron_item* item =
+    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+
+  if (!check_mesh(item))
+  {
+    return;
+  }
+
+  QTime time;
+  time.start();
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+
+  update_parameters(mcs);
+
+  mcs->convert_to_skeleton(skeleton_curve);
+
+
+  std::cout << "ok (" << time.elapsed() << " ms, " << ")" << std::endl;
+
+  //create the polylines representing the skeleton
+  Scene_polylines_item* skeleton = new Scene_polylines_item();
+  skeleton->setColor(QColor(175, 0, 255));
+
+  Polyline_visitor polyline_visitor(skeleton->polylines, skeleton_curve);
+  CGAL::split_graph_into_polylines( skeleton_curve,
+                                    polyline_visitor,
+                                    CGAL::internal::IsTerminalDefault() );
+
+  skeleton->setName(QString("skeleton curve of %1").arg(item->name()));
+  scene->addItem(skeleton);
+  skeleton->invalidateOpenGLBuffers();
+
+  // set the fixed points and contracted mesh as invisible
+  if (fixedPointsItemIndex >= 0)
+  {
+    scene->item(fixedPointsItemIndex)->setVisible(false);
+    scene->itemChanged(fixedPointsItemIndex);
+  }
+  scene->item(contractedItemIndex)->setVisible(false);
+  scene->itemChanged(contractedItemIndex);
+  // display the original mesh in transparent mode
+  item->setVisible(false);
+  if (InputMeshItemIndex >= 0)
+  {
+    scene->item(InputMeshItemIndex)->setVisible(true);
+    scene->item(InputMeshItemIndex)->setPointsMode();
+    scene->itemChanged(InputMeshItemIndex);
+  }
+
+  // update scene
+  QApplication::restoreOverrideCursor();
+}
+
+void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionConverge()
+{
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+  if (!check_item_index(index))
+  {
+    return;
+  }
+
+  Scene_polyhedron_item* item =
+    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+
+  if (!check_mesh(item))
+  {
+    return;
+  }
+
+  QTime time;
+  time.start();
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+
+  mcs->contract_until_convergence();
+
+  std::cout << "ok (" << time.elapsed() << " ms, " << ")" << std::endl;
+
+  // update scene
+  Scene_points_with_normal_item* fixedPointsItem = new Scene_points_with_normal_item;
+  fixedPointsItem->setName(QString("fixed points of %1").arg(item->name()));
+
+  std::vector<Point> fixedPoints;
+  mcs->fixed_points(fixedPoints);
+
+  Point_set *ps = fixedPointsItem->point_set();
+  for (size_t i = 0; i < fixedPoints.size(); ++i)
+  {
+    UI_point_3<Kernel> point(fixedPoints[i].x(), fixedPoints[i].y(), fixedPoints[i].z());
+    ps->push_back(point);
+  }
+  ps->select_all();
+  
+  if (fixedPointsItemIndex == -1)
+  {
+    fixedPointsItemIndex = scene->addItem(fixedPointsItem);
+  }
+  else
+  {
+    Scene_item* temp = scene->replaceItem(fixedPointsItemIndex, fixedPointsItem, false);
+    delete temp;
+  }
+
+  scene->item(fixedPointsItemIndex)->invalidateOpenGLBuffers();
+  scene->itemChanged(fixedPointsItemIndex);
+  update_meso_skeleton();
+  scene->setSelectedItem(index);
+
+  QApplication::restoreOverrideCursor();
+}
+
+void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionItemAboutToBeDestroyed(CGAL::Three::Scene_item* /* item */)
+{
+  if (mcs != NULL)
+  {
+    delete mcs;
+    mcs = NULL;
+  }
+}
+
+#include "Mean_curvature_flow_skeleton_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.ui b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.ui
new file mode 100644
index 0000000..cc07157
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.ui
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Mean_curvature_flow_skeleton_plugin</class>
+ <widget class="QDockWidget" name="Mean_curvature_flow_skeleton_plugin">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>461</width>
+    <height>242</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>DockWidget</string>
+  </property>
+  <widget class="QWidget" name="dockWidgetContents">
+   <layout class="QVBoxLayout" name="verticalLayout_3">
+    <item>
+     <widget class="QCheckBox" name="is_medially_centered">
+      <property name="text">
+       <string>Is medially centered</string>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <layout class="QHBoxLayout" name="horizontalLayout_6">
+      <item>
+       <layout class="QVBoxLayout" name="verticalLayout_2">
+        <item>
+         <layout class="QHBoxLayout" name="horizontalLayout_2">
+          <item>
+           <widget class="QLabel" name="label_omega_H">
+            <property name="text">
+             <string>quality_speed_tradeoff</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QDoubleSpinBox" name="omega_H"/>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="horizontalLayout_3">
+          <item>
+           <widget class="QLabel" name="label_omega_P">
+            <property name="text">
+             <string>medially_centered_speed_tradeoff</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QDoubleSpinBox" name="omega_P"/>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="horizontalLayout_4">
+          <item>
+           <widget class="QLabel" name="label_min_edge_length">
+            <property name="text">
+             <string>min_edge_length</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QDoubleSpinBox" name="min_edge_length"/>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="horizontalLayout_5">
+          <item>
+           <widget class="QLabel" name="label_delta_area">
+            <property name="text">
+             <string>area_variation_factor </string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QDoubleSpinBox" name="delta_area"/>
+          </item>
+         </layout>
+        </item>
+       </layout>
+      </item>
+      <item>
+       <layout class="QVBoxLayout" name="verticalLayout">
+        <item>
+         <widget class="QPushButton" name="pushButton_run">
+          <property name="text">
+           <string>Run one iteration</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QPushButton" name="pushButton_converge">
+          <property name="text">
+           <string>Run to convergence</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QPushButton" name="pushButton_skeletonize">
+          <property name="text">
+           <string>Skeletonize</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QPushButton" name="pushButton_segment">
+          <property name="text">
+           <string>Segment</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+     </layout>
+    </item>
+    <item>
+     <widget class="QLabel" name="label">
+      <property name="font">
+       <font>
+        <weight>75</weight>
+        <bold>true</bold>
+       </font>
+      </property>
+      <property name="text">
+       <string>Steps of an iteration:</string>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <layout class="QHBoxLayout" name="horizontalLayout">
+      <item>
+       <widget class="QPushButton" name="pushButton_contract">
+        <property name="text">
+         <string> 1 - Contract</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="pushButton_collapse">
+        <property name="text">
+         <string>2 - Collapse</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="pushButton_split">
+        <property name="text">
+         <string>3 - Split</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="pushButton_degeneracy">
+        <property name="text">
+         <string>4 - Degeneracy</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+ <slots>
+  <slot>contract()</slot>
+ </slots>
+</ui>
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Orient_soup_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Orient_soup_plugin.cpp
new file mode 100644
index 0000000..84246a4
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Orient_soup_plugin.cpp
@@ -0,0 +1,256 @@
+#include <QApplication>
+#include <QAction>
+#include <QList>
+#include <QMainWindow>
+#include <QMessageBox>
+#include <QtDebug>
+
+#include "Scene_polygon_soup_item.h"
+#include "Scene_polyhedron_item.h"
+#include "Scene_surface_mesh_item.h"
+
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+#include "Messages_interface.h"
+using namespace CGAL::Three;
+class Polyhedron_demo_orient_soup_plugin : 
+  public QObject,
+  public Polyhedron_demo_plugin_interface
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+public:
+  void init(QMainWindow* mainWindow,
+            CGAL::Three::Scene_interface* scene_interface,
+            Messages_interface* m);
+            bool applicable(QAction* action) const {
+    Q_FOREACH(CGAL::Three::Scene_interface::Item_id index, scene->selectionIndices()) {
+      if(qobject_cast<Scene_polygon_soup_item*>(scene->item(index)))
+        return true;
+      else
+        if (action==actionShuffle && 
+            qobject_cast<Scene_polyhedron_item*>(scene->item(index)))
+            return true;
+    }
+    return false;
+  }
+
+  QList<QAction*> actions() const;
+
+public Q_SLOTS:
+  void orientPoly();
+  void orientSM();
+  void shuffle();
+  void displayNonManifoldEdges();
+
+private:
+  CGAL::Three::Scene_interface* scene;
+  Messages_interface* messages;
+  QMainWindow* mw;
+  QAction* actionOrientPoly;
+  QAction* actionOrientSM;
+  QAction* actionShuffle;
+  QAction* actionDisplayNonManifoldEdges;
+
+}; // end Polyhedron_demo_orient_soup_plugin
+
+void Polyhedron_demo_orient_soup_plugin::init(QMainWindow* mainWindow,
+                                              CGAL::Three::Scene_interface* scene_interface,
+                                              Messages_interface* m)
+{
+  scene = scene_interface;
+  mw = mainWindow;
+  messages = m;
+  actionOrientPoly = new QAction(tr("&Orient Polygon Soup (as a polyhedron)"), mainWindow);
+  actionOrientPoly->setObjectName("actionOrientPoly");
+  actionOrientPoly->setProperty("subMenuName", "Polygon Mesh Processing");
+  connect(actionOrientPoly, SIGNAL(triggered()),
+          this, SLOT(orientPoly()));
+  actionOrientSM = new QAction(tr("&Orient Polygon Soup (as a surface_mesh)"), mainWindow);
+  actionOrientSM->setObjectName("actionOrientSM");
+  actionOrientSM->setProperty("subMenuName", "Polygon Mesh Processing");
+  connect(actionOrientSM, SIGNAL(triggered()),
+          this, SLOT(orientSM()));
+
+  actionShuffle = new QAction(tr("&Shuffle Polygon Soup"), mainWindow);
+  actionShuffle->setProperty("subMenuName", "Polygon Mesh Processing");
+  connect(actionShuffle, SIGNAL(triggered()),
+          this, SLOT(shuffle()));
+
+  actionDisplayNonManifoldEdges = new QAction(tr("Display Non Manifold Edges"),
+                                              mainWindow);
+  actionDisplayNonManifoldEdges->setProperty("subMenuName", "View");
+  connect(actionDisplayNonManifoldEdges, SIGNAL(triggered()),
+          this, SLOT(displayNonManifoldEdges()));
+}
+
+QList<QAction*> Polyhedron_demo_orient_soup_plugin::actions() const {
+  return QList<QAction*>()
+      << actionOrientPoly
+      << actionOrientSM
+      << actionShuffle
+      << actionDisplayNonManifoldEdges;
+}
+
+void set_vcolors(Scene_surface_mesh_item::SMesh* smesh, std::vector<CGAL::Color> colors)
+{
+  typedef Scene_surface_mesh_item::SMesh SMesh;
+  typedef boost::graph_traits<SMesh>::vertex_descriptor vertex_descriptor;
+  SMesh::Property_map<vertex_descriptor, CGAL::Color> vcolors =
+    smesh->property_map<vertex_descriptor, CGAL::Color >("v:color").first;
+  bool created;
+  boost::tie(vcolors, created) = smesh->add_property_map<SMesh::Vertex_index,CGAL::Color>("v:color",CGAL::Color(0,0,0));
+  assert(colors.size()==smesh->number_of_vertices());
+  int color_id = 0;
+  BOOST_FOREACH(vertex_descriptor vd, vertices(*smesh))
+      vcolors[vd] = colors[color_id++];
+}
+
+void set_fcolors(Scene_surface_mesh_item::SMesh* smesh, std::vector<CGAL::Color> colors)
+{
+  typedef Scene_surface_mesh_item::SMesh SMesh;
+  typedef boost::graph_traits<SMesh>::face_descriptor face_descriptor;
+  SMesh::Property_map<face_descriptor, CGAL::Color> fcolors =
+    smesh->property_map<face_descriptor, CGAL::Color >("f:color").first;
+  bool created;
+   boost::tie(fcolors, created) = smesh->add_property_map<SMesh::Face_index,CGAL::Color>("f:color",CGAL::Color(0,0,0));
+  assert(colors.size()==smesh->number_of_faces());
+  int color_id = 0;
+  BOOST_FOREACH(face_descriptor fd, faces(*smesh))
+      fcolors[fd] = colors[color_id++];
+}
+
+void Polyhedron_demo_orient_soup_plugin::orientPoly()
+{
+  Q_FOREACH(CGAL::Three::Scene_interface::Item_id index, scene->selectionIndices())
+  {
+    Scene_polygon_soup_item* item = 
+      qobject_cast<Scene_polygon_soup_item*>(scene->item(index));
+
+    if(item)
+    {
+      if(!item->orient()) {
+         QMessageBox::information(mw, tr("Not orientable without self-intersections"),
+                                      tr("The polygon soup \"%1\" is not directly orientable."
+                                         " Some vertices have been duplicated and some self-intersections"
+                                         " have been created.")
+                                      .arg(item->name()));
+      }
+
+
+        Scene_polyhedron_item* poly_item = new Scene_polyhedron_item();
+        if(item->exportAsPolyhedron(poly_item->polyhedron())) {
+          poly_item->setName(item->name());
+          poly_item->setColor(item->color());
+          poly_item->setRenderingMode(item->renderingMode());
+          poly_item->setVisible(item->visible());
+          poly_item->invalidateOpenGLBuffers();
+          poly_item->setProperty("source filename", item->property("source filename"));
+          poly_item->setProperty("loader_name", item->property("loader_name"));
+          scene->replaceItem(index, poly_item);
+          item->deleteLater();
+        } else {
+          item->invalidateOpenGLBuffers();
+          scene->itemChanged(item);
+        }
+    }
+    else{
+      messages->warning(tr("This function is only applicable on polygon soups."));
+    }
+  }
+}
+
+void Polyhedron_demo_orient_soup_plugin::orientSM()
+{
+  Q_FOREACH(CGAL::Three::Scene_interface::Item_id index, scene->selectionIndices())
+  {
+    Scene_polygon_soup_item* item =
+      qobject_cast<Scene_polygon_soup_item*>(scene->item(index));
+
+    if(item)
+    {
+      //     qDebug()  << tr("I have the item %1\n").arg(item->name());
+      if(!item->orient()) {
+         QMessageBox::information(mw, tr("Not orientable without self-intersections"),
+                                      tr("The polygon soup \"%1\" is not directly orientable."
+                                         " Some vertices have been duplicated and some self-intersections"
+                                         " have been created.")
+                                      .arg(item->name()));
+      }
+      QApplication::setOverrideCursor(Qt::WaitCursor);
+        Scene_surface_mesh_item::SMesh* smesh = new Scene_surface_mesh_item::SMesh();
+        if(item->exportAsSurfaceMesh(smesh)) {
+          if(!item->getVColors().empty())
+            set_vcolors(smesh,item->getVColors());
+          if(!item->getFColors().empty())
+            set_fcolors(smesh,item->getFColors());
+          Scene_surface_mesh_item* sm_item = new Scene_surface_mesh_item(smesh);
+          sm_item->setName(item->name());
+          sm_item->setRenderingMode(item->renderingMode());
+          sm_item->setVisible(item->visible());
+          sm_item->setProperty("source filename", item->property("source filename"));
+          sm_item->setProperty("loader_name", item->property("loader_name"));
+          scene->replaceItem(index, sm_item);
+          item->deleteLater();
+        } else {
+          item->invalidateOpenGLBuffers();
+          scene->itemChanged(item);
+        }
+      QApplication::restoreOverrideCursor();
+    }
+    else{
+      messages->warning(tr("This function is only applicable on polygon soups."));
+    }
+  }
+}
+
+void Polyhedron_demo_orient_soup_plugin::shuffle()
+{
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+  
+  Scene_polygon_soup_item* item = 
+    qobject_cast<Scene_polygon_soup_item*>(scene->item(index));
+
+  if(item) {
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    item->shuffle_orientations();
+    QApplication::restoreOverrideCursor();
+  }
+  else {
+    Scene_polyhedron_item* poly_item = 
+      qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+    if(poly_item) {
+      QApplication::setOverrideCursor(Qt::WaitCursor);
+      item = new Scene_polygon_soup_item();
+      item->setName(poly_item->name());
+      item->setRenderingMode(poly_item->renderingMode());
+      item->setVisible(poly_item->visible());
+      item->setProperty("source filename", poly_item->property("source filename"));
+      item->load(poly_item);
+      item->shuffle_orientations();
+      item->setColor(poly_item->color());
+      scene->replaceItem(index, item);
+      delete poly_item;
+      QApplication::restoreOverrideCursor();
+    }
+  }
+}
+
+void Polyhedron_demo_orient_soup_plugin::displayNonManifoldEdges()
+{
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+  
+  Scene_polygon_soup_item* item = 
+    qobject_cast<Scene_polygon_soup_item*>(scene->item(index));
+
+  if(item)
+  {
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    item->setDisplayNonManifoldEdges(!item->displayNonManifoldEdges());
+    scene->itemChanged(item);
+    QApplication::restoreOverrideCursor();
+  }
+}
+
+#include "Orient_soup_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Point_inside_polyhedron_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Point_inside_polyhedron_plugin.cpp
new file mode 100644
index 0000000..adb6d98
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Point_inside_polyhedron_plugin.cpp
@@ -0,0 +1,282 @@
+#include <QtCore/qglobal.h>
+#include "opengl_tools.h"
+
+#include "Messages_interface.h"
+#include "Scene_polyhedron_item.h"
+#include "Scene_points_with_normal_item.h"
+#include <CGAL/Three/Scene_interface.h>
+
+#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
+#include "Polyhedron_type.h"
+
+#include <CGAL/Timer.h>
+#include <CGAL/Random.h>
+#include <CGAL/Side_of_triangle_mesh.h>
+#include "ui_Point_inside_polyhedron_widget.h"
+
+#include <QAction>
+#include <QMainWindow>
+#include <QApplication>
+#include <QDockWidget>
+#include <QInputDialog>
+
+#include <vector>
+#include <algorithm>
+
+#include <boost/iterator/transform_iterator.hpp>
+#include <boost/optional/optional.hpp>
+using namespace CGAL::Three;
+typedef CGAL::Exact_predicates_inexact_constructions_kernel Epic_kernel;
+
+class Polyhedron_demo_point_inside_polyhedron_plugin :
+  public QObject,
+  public Polyhedron_demo_plugin_helper
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+public:
+  bool applicable(QAction*) const 
+  {
+    bool poly_item_exists = false;
+    bool point_item_exists = false;
+
+    for(CGAL::Three::Scene_interface::Item_id i = 0, end = scene->numberOfEntries();
+      i < end && (!poly_item_exists || !point_item_exists); ++i)
+    {
+      poly_item_exists |= qobject_cast<Scene_polyhedron_item*>(scene->item(i)) != NULL;
+      point_item_exists |= qobject_cast<Scene_points_with_normal_item*>(scene->item(i)) != NULL;
+    }
+
+    //return poly_item_exists && point_item_exists;
+    return poly_item_exists || point_item_exists;
+  }
+  void print_message(QString message) { messages->information(message); }
+  QList<QAction*> actions() const { return QList<QAction*>() << actionPointInsidePolyhedron; }
+
+
+  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface* m)
+  {
+    mw = mainWindow;
+    scene = scene_interface;
+    messages = m;
+
+    actionPointInsidePolyhedron = new QAction(tr("Point Inside Polyhedron"), mw);
+    actionPointInsidePolyhedron->setProperty("subMenuName", "Polygon Mesh Processing");
+    connect(actionPointInsidePolyhedron, SIGNAL(triggered()), this, SLOT(point_inside_polyhedron_action()));
+
+    dock_widget = new QDockWidget("Point Inside Polyhedron", mw);
+    dock_widget->setVisible(false);
+    ui_widget.setupUi(dock_widget);
+
+    addDockWidget(dock_widget);
+
+    connect(ui_widget.Select_button,  SIGNAL(clicked()), this, SLOT(on_Select_button())); 
+    connect(ui_widget.Sample_random_points_from_bbox,  SIGNAL(clicked()), this, SLOT(on_Sample_random_points_from_bbox())); 
+    
+  }
+
+  virtual void closure()
+  {
+    dock_widget->hide();
+  }
+private:
+  // for transform iterator
+  struct Get_ref {
+    typedef const Polyhedron& result_type;
+    result_type operator()(const Polyhedron* poly_ptr) const
+    { return *poly_ptr; }
+  };
+
+
+public Q_SLOTS:
+  void point_inside_polyhedron_action() { 
+    dock_widget->show();
+    dock_widget->raise();
+  }
+
+  void on_Select_button() 
+  {
+    bool inside = ui_widget.Inside_check_box->isChecked();
+    bool on_boundary = ui_widget.On_boundary_check_box->isChecked();
+    bool outside = ui_widget.Outside_check_box->isChecked();
+
+    if(!(inside || on_boundary || outside)) {
+      print_message("Error: please check at least one parameter check box.");
+      return;
+    }
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    // place all selected polyhedron and point items to vectors below
+    std::vector<const Polyhedron*> polys;
+    typedef CGAL::Side_of_triangle_mesh<Polyhedron, Kernel> Point_inside;
+    std::vector<Point_inside*> inside_testers;// to put all polyhedra to query object
+        // it does not support copy-construction so let's use pointers
+    std::vector<Point_set*> point_sets;
+    Q_FOREACH(CGAL::Three::Scene_interface::Item_id id, scene->selectionIndices()) {
+      Scene_polyhedron_item* poly_item = qobject_cast<Scene_polyhedron_item*>(scene->item(id));
+      if (poly_item)
+        inside_testers.push_back(new Point_inside(*(poly_item->polyhedron())));
+      if(poly_item) { polys.push_back(poly_item->polyhedron()); }
+
+      Scene_points_with_normal_item* point_item = qobject_cast<Scene_points_with_normal_item*>(scene->item(id));
+      if(point_item) { point_sets.push_back(point_item->point_set()); }
+    }
+
+
+    // there should be at least one selected polyhedron and point item
+    if(inside_testers.empty()) { print_message("Error: there is no selected polyhedron item(s)."); }
+    if(point_sets.empty()) {
+    if(!generated_points.empty())
+      point_sets.push_back(generated_points.last()->point_set());
+    else
+      print_message("Error: there is no selected point set item(s).");
+    }
+    if(inside_testers.empty() || point_sets.empty()) { QApplication::restoreOverrideCursor(); return; }
+
+    // deselect all points
+    for(std::vector<Point_set*>::iterator point_set_it = point_sets.begin(); 
+      point_set_it != point_sets.end(); ++point_set_it) {
+      (*point_set_it)->unselect_all();
+    }
+
+    CGAL::Timer timer; timer.start();
+
+    print_message(
+      QString("Constructing with %1 items is done in %2 sec.").arg(inside_testers.size()).arg(timer.time()));
+    timer.reset();
+
+    std::size_t nb_query = 0, nb_selected = 0;// for print message
+    for(std::vector<Point_set*>::iterator point_set_it = point_sets.begin(); 
+      point_set_it != point_sets.end(); ++point_set_it) 
+    {
+      Point_set* point_set = *point_set_it;
+      for (std::size_t pt = 0;
+           pt < point_set->size() - point_set->nb_selected_points();
+           ++ pt, ++ nb_query)
+      {
+        Point_set::iterator point_it = point_set->begin() + pt;
+        for (std::size_t i = 0; i < inside_testers.size(); ++i)
+        {
+        CGAL::Bounded_side res = (*inside_testers[i])(point_it->position());
+
+        if( (inside      && res == CGAL::ON_BOUNDED_SIDE) ||
+            (on_boundary && res == CGAL::ON_BOUNDARY)     ||
+            (outside     && res == CGAL::ON_UNBOUNDED_SIDE) )
+        {
+          point_set->select(point_it); ++nb_selected;
+          -- pt; // Selection replaces current point with unselected one
+          break;//loop on i
+        }
+        }
+      } // loop on points in point_set
+    }// loop on selected point sets
+
+    print_message(QString("Querying with %1 points is done in %2 sec.").arg(nb_query).arg(timer.time()));
+    print_message(QString("%1 points are selected. All Done!").arg(nb_selected));
+
+    // delete testers
+    for (std::size_t i = 0; i < inside_testers.size(); ++i)
+      delete inside_testers[i];
+
+    bool found = false;
+    // for repaint
+    Q_FOREACH(CGAL::Three::Scene_interface::Item_id id, scene->selectionIndices()) {
+      Scene_points_with_normal_item* point_item = qobject_cast<Scene_points_with_normal_item*>(scene->item(id));
+      if(point_item) { 
+        found = true;
+        point_item->invalidateOpenGLBuffers();
+        scene->itemChanged(point_item);
+      }
+    }
+    if(!found && !generated_points.empty()) {
+      generated_points.last()->invalidateOpenGLBuffers();
+      scene->itemChanged(generated_points.last());
+    }
+    QApplication::restoreOverrideCursor();
+  }
+
+  void on_Sample_random_points_from_bbox() {
+    
+    // calculate bbox of selected polyhedron items
+    boost::optional<CGAL::Three::Scene_interface::Bbox> bbox
+      = boost::make_optional(false, CGAL::Three::Scene_interface::Bbox());
+    // Workaround a bug in g++-4.8.3:
+    //   http://stackoverflow.com/a/21755207/1728537
+    // Using boost::make_optional to copy-initialize 'bbox' hides the
+    //   warning about '*bbox' not being initialized.
+    // -- Laurent Rineau, 2014/10/30
+
+    Q_FOREACH(CGAL::Three::Scene_interface::Item_id id, scene->selectionIndices()) {
+      Scene_polyhedron_item* poly_item = qobject_cast<Scene_polyhedron_item*>(scene->item(id));
+      if(poly_item) {
+        if(!bbox) {
+          bbox = poly_item->bbox();
+        }
+        else {
+          *bbox = *bbox + poly_item->bbox();
+        }
+      }
+    }
+
+    if(!bbox) {
+      print_message("Error: there is no selected polyhedron item(s)."); 
+      return;
+    }
+
+    // take number of points param
+    bool ok;
+    const int nb_points = 
+      QInputDialog::getInt(mw, tr("Number of Points"),
+      tr("Number of Points:"),
+      100000, // default value
+      1, // min
+      (int)1.e9, // max
+      10, // step for the spinbox
+      &ok);
+
+    if(!ok) { return; }
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    // sample random points and constuct item
+    Scene_points_with_normal_item* point_item = new Scene_points_with_normal_item();
+    point_item->setName(QString("sample-%1").arg(nb_points));
+    CGAL::Random rg(1340818006);
+
+    double grid_dx = bbox->xmax() - bbox->xmin();
+    double grid_dy = bbox->ymax() - bbox->ymin();
+    double grid_dz = bbox->zmax() - bbox->zmin();
+
+    for(int i=0; i < nb_points; i++){
+      point_item->point_set()->push_back(
+      Epic_kernel::Point_3(bbox->xmin ()+ rg.get_double()* grid_dx,
+        bbox->ymin() + rg.get_double()* grid_dy,
+        bbox->zmin() + rg.get_double()* grid_dz)
+      );
+    }
+
+    scene->addItem(point_item);
+    scene->itemChanged(point_item);
+    generated_points.append(point_item);
+    connect(point_item, SIGNAL(destroyed(QObject*)),
+            this, SLOT(resetGeneratedPoints(QObject*)));
+    QApplication::restoreOverrideCursor();
+  }
+private Q_SLOTS:
+  void resetGeneratedPoints(QObject* o)
+  {
+    Q_FOREACH(Scene_points_with_normal_item* item , generated_points)
+    if(item == o)
+    {
+      generated_points.removeAll(item);
+    }
+  }
+private:
+  Messages_interface* messages;
+  QAction* actionPointInsidePolyhedron;
+  QList<Scene_points_with_normal_item*> generated_points;
+  QDockWidget* dock_widget;
+  Ui::Point_inside_polyhedron ui_widget;
+
+}; // end Polyhedron_demo_point_inside_polyhedron_plugin
+
+#include "Point_inside_polyhedron_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Point_inside_polyhedron_widget.ui b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Point_inside_polyhedron_widget.ui
new file mode 100644
index 0000000..a648383
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Point_inside_polyhedron_widget.ui
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Point_inside_polyhedron</class>
+ <widget class="QDockWidget" name="Point_inside_polyhedron">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>330</width>
+    <height>225</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Point Inside Polyhedron</string>
+  </property>
+  <widget class="QWidget" name="dockWidgetContents">
+   <layout class="QVBoxLayout" name="verticalLayout">
+    <item>
+     <widget class="QPushButton" name="Sample_random_points_from_bbox">
+      <property name="text">
+       <string>Sample Random Points from Bbox</string>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="QGroupBox" name="groupBox">
+      <property name="title">
+       <string>Point Location</string>
+      </property>
+      <layout class="QVBoxLayout" name="verticalLayout_2">
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout">
+         <item>
+          <widget class="QCheckBox" name="Inside_check_box">
+           <property name="text">
+            <string>Inside</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QCheckBox" name="On_boundary_check_box">
+           <property name="text">
+            <string>On Boundary</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QCheckBox" name="Outside_check_box">
+           <property name="text">
+            <string>Outside</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+       <item>
+        <widget class="QPushButton" name="Select_button">
+         <property name="text">
+          <string>Select</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QLabel" name="label">
+         <property name="font">
+          <font>
+           <weight>75</weight>
+           <bold>true</bold>
+          </font>
+         </property>
+         <property name="text">
+          <string>Note:</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout_2">
+         <item>
+          <widget class="QLabel" name="label_2">
+           <property name="text">
+            <string><html><head/><body><p>A selection is possible only if a point set item<br/>and a (closed) polyhedron item are selected</p></body></html></string>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </widget>
+    </item>
+    <item>
+     <spacer name="verticalSpacer">
+      <property name="orientation">
+       <enum>Qt::Vertical</enum>
+      </property>
+      <property name="sizeHint" stdset="0">
+       <size>
+        <width>0</width>
+        <height>0</height>
+       </size>
+      </property>
+     </spacer>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Polyhedron_slicer_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Polyhedron_slicer_plugin.cpp
new file mode 100644
index 0000000..99f74e9
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Polyhedron_slicer_plugin.cpp
@@ -0,0 +1,349 @@
+#include <QtCore/qglobal.h>
+#include <CGAL/AABB_intersections.h>
+
+#include "Messages_interface.h"
+#include "Scene_plane_item.h"
+#include "Scene_polyhedron_item.h"
+#include "Scene_polylines_item.h"
+#include "Scene.h"
+
+#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
+#include "ui_Polyhedron_slicer_widget.h"
+
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+#include <CGAL/bounding_box.h> 
+#include <CGAL/Polygon_mesh_slicer.h>
+
+#include "Polyhedron_type.h"
+
+#include <QTime>
+#include <QAction>
+#include <QMainWindow>
+#include <QApplication>
+#include <QDockWidget>
+
+#include <vector>
+#include <algorithm>
+
+typedef CGAL::Exact_predicates_inexact_constructions_kernel Epic_kernel;
+using namespace CGAL::Three;
+class Polyhedron_demo_polyhedron_slicer_plugin :
+  public QObject,
+  public Polyhedron_demo_plugin_helper
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+public:
+  bool applicable(QAction*) const { return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex())); }
+  void print_message(QString message) { messages->information(message);}
+
+  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface* m);
+  virtual void closure()
+  {
+    dock_widget->hide();
+  }
+  QList<QAction*> actions() const;
+  bool get_base_1_2(double bases[6]) {
+    bool oks[6];
+    bases[0] = ui_widget.Base_1_x->text().toDouble(&oks[0]);
+    bases[1] = ui_widget.Base_1_y->text().toDouble(&oks[1]);
+    bases[2] = ui_widget.Base_1_z->text().toDouble(&oks[2]);
+
+    bases[3] = ui_widget.Base_2_x->text().toDouble(&oks[3]);
+    bases[4] = ui_widget.Base_2_y->text().toDouble(&oks[4]);
+    bases[5] = ui_widget.Base_2_z->text().toDouble(&oks[5]);
+
+    bool total_ok = true;
+    for(int i = 0; i < 6; ++i && total_ok) { total_ok &= oks[i];}
+    return total_ok;
+  }
+public Q_SLOTS:
+  void slicer_widget_action();
+  void on_Generate_button_clicked();
+  bool on_Update_plane_button_clicked();
+  void plane_manipulated_frame_modified();
+  void item_about_to_be_destroyed(CGAL::Three::Scene_item* scene_item);
+  void dock_widget_closed();
+
+protected:
+  bool eventFilter(QObject *, QEvent *event) {
+    if(event->type() == QEvent::Close) {
+      dock_widget_closed();
+    }
+    return false;
+  }
+
+private:
+  Messages_interface* messages;
+  Scene_plane_item* plane_item;
+  QAction* actionSlicerWidget;
+
+  QDockWidget* dock_widget;
+  Ui::Polyhedron_slicer ui_widget;
+  
+  void intersection_of_plane_Polyhedra_3_using_AABB_wrapper(Polyhedron& mesh, 
+    const std::vector<Epic_kernel::Plane_3>& planes,
+    const std::vector<qglviewer::Vec>& plane_positions,
+    std::list<std::vector<Epic_kernel::Point_3> >& polylines);
+
+}; // end Polyhedron_demo_polyhedron_slicer_plugin
+
+void Polyhedron_demo_polyhedron_slicer_plugin::init(QMainWindow* mainWindow,
+                                      CGAL::Three::Scene_interface* scene_interface,
+                                      Messages_interface* m)
+{
+  mw = mainWindow;
+  scene = scene_interface;
+  messages = m;
+  plane_item = NULL;
+
+  actionSlicerWidget = new QAction(tr("Polyhedron Slicer"), mw);
+  actionSlicerWidget->setProperty("subMenuName", "Polygon Mesh Processing");
+  connect(actionSlicerWidget, SIGNAL(triggered()), this, SLOT(slicer_widget_action()));
+
+  dock_widget = new QDockWidget("Polyhedron Slicer", mw);
+  dock_widget->setVisible(false);
+  dock_widget->installEventFilter(this);
+  ui_widget.setupUi(dock_widget);
+
+  addDockWidget(dock_widget);
+
+  connect(ui_widget.Generate_button,  SIGNAL(clicked()), this, SLOT(on_Generate_button_clicked()));   
+  connect(ui_widget.Update_plane_button,  SIGNAL(clicked()), this, SLOT(on_Update_plane_button_clicked())); 
+}
+
+QList<QAction*> Polyhedron_demo_polyhedron_slicer_plugin::actions() const {
+  return QList<QAction*>() << actionSlicerWidget;
+}
+
+void Polyhedron_demo_polyhedron_slicer_plugin::slicer_widget_action(){
+  if(dock_widget->isVisible()) { return; }
+  dock_widget->show(); 
+  dock_widget->raise();
+  ///// from cut plugin /////
+  CGAL_assertion(plane_item == NULL);
+
+  plane_item = new Scene_plane_item(scene);
+  const CGAL::Three::Scene_interface::Bbox& bbox = scene->bbox();
+  plane_item->setPosition((bbox.xmin() + bbox.xmax())/2.f,
+    (bbox.ymin()+bbox.ymax())/2.f,
+    (bbox.zmin()+bbox.zmax())/2.f);
+  plane_item->setNormal(0., 0., 1.);
+  plane_item->setManipulatable(true);
+  plane_item->setClonable(false);
+  plane_item->setColor(Qt::green);
+  plane_item->setName(tr("Cutting plane"));
+  connect(plane_item->manipulatedFrame(), SIGNAL(modified()),
+    this, SLOT(plane_manipulated_frame_modified()));
+
+  if(Scene* scene_casted = dynamic_cast<Scene*>(scene)) 
+  { connect(scene_casted, SIGNAL(itemAboutToBeDestroyed(CGAL::Three::Scene_item*)), this, SLOT(item_about_to_be_destroyed(CGAL::Three::Scene_item*))); }
+  scene->addItem(plane_item);
+
+  // set distance_with_planes = bbox_diagona / 30
+  double diagonal = std::sqrt(
+    CGAL::squared_distanceC3( bbox.xmin(), bbox.ymin(), bbox.zmin(), bbox.xmax(), bbox.ymax(), bbox.zmax()) );
+  ui_widget.Distance_with_planes->setText(QString::number(diagonal / 30.0));
+
+  plane_manipulated_frame_modified(); // update text boxes
+}
+
+// when manipulated frame of plane is modified, update line-edits
+void Polyhedron_demo_polyhedron_slicer_plugin::plane_manipulated_frame_modified() {
+  qglviewer::ManipulatedFrame* mf = plane_item->manipulatedFrame();
+  const qglviewer::Vec& pos = mf->position();
+  ui_widget.Center_x->setText(QString::number(pos.x));
+  ui_widget.Center_y->setText(QString::number(pos.y));
+  ui_widget.Center_z->setText(QString::number(pos.z));
+
+  const qglviewer::Vec& base_1 = mf->inverseTransformOf(qglviewer::Vec(1., 0., 0.));
+  const qglviewer::Vec& base_2 = mf->inverseTransformOf(qglviewer::Vec(0., 1., 0.));
+
+  ui_widget.Base_1_x->setText(QString::number(base_1.x));
+  ui_widget.Base_1_y->setText(QString::number(base_1.y));
+  ui_widget.Base_1_z->setText(QString::number(base_1.z));
+
+  ui_widget.Base_2_x->setText(QString::number(base_2.x));
+  ui_widget.Base_2_y->setText(QString::number(base_2.y));
+  ui_widget.Base_2_z->setText(QString::number(base_2.z));
+}
+
+// when Update Plane button is clicked, update manipulated frame of plane with line-edits
+bool Polyhedron_demo_polyhedron_slicer_plugin::on_Update_plane_button_clicked() {
+  qglviewer::ManipulatedFrame* mf = plane_item->manipulatedFrame();
+  // get center
+  bool ok_1 = true, ok_2 = true, ok_3 = true;
+  double center_x = ui_widget.Center_x->text().toDouble(&ok_1);
+  double center_y = ui_widget.Center_y->text().toDouble(&ok_2);
+  double center_z = ui_widget.Center_z->text().toDouble(&ok_3);
+  if(!ok_1 || !ok_2 || !ok_3) 
+  { print_message("Error: center coordinates not convertible to double."); return false; }
+
+  // set center
+  bool oldState = mf->blockSignals(true); // dont let it signal, it will invoke plane_manipulated_frame_modified otherwise
+  mf->setPosition(center_x, center_y, center_z);
+  mf->blockSignals(oldState);
+
+  // get base 1 and base 2
+  double bases[6];
+  if(!get_base_1_2(bases)) 
+  { print_message("Error: Base-1, Base-2 coordinates not convertible to double."); return false; }
+
+  // compute other axis
+  qglviewer::Vec base_1(bases[0], bases[1], bases[2]);
+  qglviewer::Vec base_2(bases[3], bases[4], bases[5]);
+  qglviewer::Vec other = cross(base_1, base_2);
+  if(other.norm() == 0.0) { print_message("Error: collinear base vectors are not accepted!"); return false; }
+  
+  // set orientation
+  qglviewer::Quaternion orientation_from_bases;
+  orientation_from_bases.setFromRotatedBasis(base_1, base_2, other);
+
+  oldState = mf->blockSignals(true); // dont let it signal, it will invoke plane_manipulated_frame_modified otherwise
+  mf->setOrientation(orientation_from_bases);
+  mf->blockSignals(oldState);
+
+  scene->itemChanged(plane_item); // redraw
+  return true;
+}
+
+// generate multiple cuts, until any cut does not intersect with bbox
+void Polyhedron_demo_polyhedron_slicer_plugin::on_Generate_button_clicked()
+{
+  Scene_polyhedron_item* item = getSelectedItem<Scene_polyhedron_item>();
+  if(!item) { 
+    print_message("Error: There is no selected Scene_polyhedron_item!");
+    return; 
+  }
+
+  if(!on_Update_plane_button_clicked()) { return; }
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  // get plane position and normal
+  qglviewer::ManipulatedFrame* mf = plane_item->manipulatedFrame();
+  const qglviewer::Vec& pos = mf->position();
+  // WARNING: due to fp arithmetic (setting quaternion based orientation from base vectors then getting plane normal back from this orientation)
+  // for base vectors like: 1,0,0 - 0,1,0 we might not have exact corresponding normal vector.
+  // So not using below normal but construct plane directly from bases from text boxes
+  const qglviewer::Vec& n = mf->inverseTransformOf(qglviewer::Vec(0.f, 0.f, 1.f));
+
+  // get bases
+  double bases[6];
+  get_base_1_2(bases); // no need to check since we call on_Update_plane_button_clicked
+  Epic_kernel::Vector_3 base_1(bases[0], bases[1], bases[2]);
+  Epic_kernel::Vector_3 base_2(bases[3], bases[4], bases[5]);
+  const Epic_kernel::Vector_3 normal = CGAL::cross_product(base_1, base_2);
+
+  // get distance between planes
+  bool to_double_ok = true;
+  double distance_with_planes = ui_widget.Distance_with_planes->text().toDouble(&to_double_ok);
+  if(!to_double_ok) { 
+    print_message("Error: Set Distance_with_planes text box!");
+    QApplication::restoreOverrideCursor();
+    return; 
+  }
+
+  // construct a bbox for selected polyhedron
+  const CGAL::Three::Scene_interface::Bbox& bbox = item->bbox();
+  CGAL::Bbox_3 cgal_bbox(bbox.xmin(), bbox.ymin(), bbox.zmin(),
+    bbox.xmax(), bbox.ymax(), bbox.zmax());
+  Polyhedron* poly = item->polyhedron();
+
+  // continue generating planes while inside bbox
+  std::vector<Epic_kernel::Plane_3> planes;
+  std::vector<qglviewer::Vec> plane_positions;
+
+  for(int dir = 1, step = 0; /* */ ; ++step) 
+  {
+    double distance_norm = (dir * step) * distance_with_planes;
+    qglviewer::Vec new_pos = pos + (n*distance_norm);
+
+    //Epic_kernel::Plane_3 plane(n[0], n[1],  n[2], - n * new_pos);
+    Epic_kernel::Point_3 new_pos_cgal(new_pos[0], new_pos[1], new_pos[2]);
+    Epic_kernel::Plane_3 plane(new_pos_cgal, normal);
+
+    if(!CGAL::do_intersect(cgal_bbox, plane)) { 
+      if(dir == -1) { break; }
+      std::reverse(planes.begin(), planes.end());
+      std::reverse(plane_positions.begin(), plane_positions.end());
+      dir = -1; // reverse direction
+      step = 0; // we should skip the plane itself, and we will when continue cause ++step
+      continue;
+    }
+    planes.push_back(plane);
+    plane_positions.push_back(new_pos); 
+  }
+  print_message(QString("Created %1 cuts inside bbox...").arg(planes.size()));
+
+  bool new_polyline_item_for_polylines = ui_widget.newPolylineItemCheckBox->checkState() == Qt::Checked;
+  if(!new_polyline_item_for_polylines) 
+  {
+    Scene_polylines_item* new_polylines_item = new Scene_polylines_item();
+    QTime time; time.start();
+    // call algorithm and fill polylines in polylines_item
+    intersection_of_plane_Polyhedra_3_using_AABB_wrapper(*poly, planes, plane_positions, new_polylines_item->polylines);
+    // set names etc and print timing
+    print_message( QString("Done: processed %1 cuts - generated %2 polylines in %3 ms!").
+      arg(planes.size()).arg(new_polylines_item->polylines.size()).arg(time.elapsed()) );
+
+    new_polylines_item->setName(QString("%1 with %2 cuts").
+      arg(item->name()).arg(planes.size()) );
+    new_polylines_item->setColor(Qt::green);
+    new_polylines_item->setRenderingMode(Wireframe);
+    scene->addItem(new_polylines_item);
+  }
+  else {
+    QTime time; time.start();
+    std::list<std::vector<Epic_kernel::Point_3> > polylines;
+    // call algorithm and fill polylines in polylines_item
+    intersection_of_plane_Polyhedra_3_using_AABB_wrapper(*poly, planes, plane_positions, polylines);
+    // set names etc and print timing
+    print_message( QString("Done: processed %1 cuts - generated %2 polylines in %3 ms!").
+      arg(planes.size()).arg(polylines.size()).arg(time.elapsed()) );
+
+    int counter = 0;
+    for(std::list<std::vector<Epic_kernel::Point_3> >::iterator it = polylines.begin(); it != polylines.end(); ++it, ++counter) {
+      Scene_polylines_item* new_polylines_item = new Scene_polylines_item();
+      new_polylines_item->polylines.push_back(*it);
+      new_polylines_item->setName(QString("%1 with %2 cuts %3").
+        arg(item->name()).arg(planes.size()).arg(counter) );
+      new_polylines_item->setColor(Qt::green);
+      new_polylines_item->setRenderingMode(Wireframe);
+      scene->addItem(new_polylines_item);
+      new_polylines_item->invalidateOpenGLBuffers();
+    }
+  }
+  QApplication::restoreOverrideCursor();
+}
+
+void Polyhedron_demo_polyhedron_slicer_plugin::item_about_to_be_destroyed(CGAL::Three::Scene_item* scene_item) {
+  if(plane_item == NULL) { return; }// which means this plugin erased plane_item
+  Scene_plane_item* destroyed_plane = qobject_cast<Scene_plane_item*>(scene_item);
+  if(destroyed_plane && destroyed_plane == plane_item) {
+    plane_item = NULL;
+    dock_widget->hide();
+  }
+}
+
+void Polyhedron_demo_polyhedron_slicer_plugin::dock_widget_closed() {
+  CGAL_assertion(plane_item != NULL);
+  CGAL::Three::Scene_interface::Item_id id = scene->item_id(plane_item);
+  plane_item = NULL;
+  scene->erase(id);
+}
+// this function assumes 'planes' are parallel
+void Polyhedron_demo_polyhedron_slicer_plugin::intersection_of_plane_Polyhedra_3_using_AABB_wrapper(
+  Polyhedron& poly, 
+  const std::vector<Epic_kernel::Plane_3>& planes,
+  const std::vector<qglviewer::Vec>& plane_positions,
+  std::list<std::vector<Epic_kernel::Point_3> >& polylines) 
+{
+  CGAL::Polygon_mesh_slicer<Polyhedron, Epic_kernel> slicer(poly);
+  std::vector<qglviewer::Vec>::const_iterator plane_position_it = plane_positions.begin();
+  for(std::vector<Epic_kernel::Plane_3>::const_iterator plane_it = planes.begin(); plane_it != planes.end(); ++plane_it, ++plane_position_it) 
+    slicer(*plane_it, std::front_inserter(polylines));
+
+}
+
+#include "Polyhedron_slicer_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Polyhedron_slicer_widget.ui b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Polyhedron_slicer_widget.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/PMP/Polyhedron_slicer_widget.ui
rename to 3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Polyhedron_slicer_widget.ui
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Polyhedron_stitching_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Polyhedron_stitching_plugin.cpp
new file mode 100644
index 0000000..0975d50
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Polyhedron_stitching_plugin.cpp
@@ -0,0 +1,167 @@
+#include <QApplication>
+#include <QMessageBox>
+#include <QMainWindow>
+#include "Kernel_type.h"
+#include "Polyhedron_type.h"
+#include "Scene_polyhedron_item.h"
+#include "Scene_polylines_item.h"
+
+#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+
+#include <CGAL/Polygon_mesh_processing/stitch_borders.h>
+
+#include <CGAL/boost/graph/split_graph_into_polylines.h>
+#include <CGAL/boost/graph/helpers.h>
+#include <boost/graph/filtered_graph.hpp>
+
+template <typename G>
+struct Is_border {
+  const G& g;
+  Is_border(const G& g)
+    : g(g)
+  {}
+
+ template <typename Descriptor>
+  bool operator()(const Descriptor& d) const {
+   return is_border(d,g);
+  }
+
+  bool operator()(typename boost::graph_traits<G>::vertex_descriptor d) const {
+    return is_border(d,g) != boost::none;
+  }
+
+};
+
+
+using namespace CGAL::Three;
+class Polyhedron_demo_polyhedron_stitching_plugin :
+  public QObject,
+  public Polyhedron_demo_plugin_helper
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+  QAction* actionDetectBorders;
+  QAction* actionStitchBorders;
+public:
+  QList<QAction*> actions() const { return QList<QAction*>() << actionDetectBorders << actionStitchBorders; }
+  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface* /* m */)
+  {
+    scene = scene_interface;
+    actionDetectBorders= new QAction(tr("Detect Boundaries"), mainWindow);
+    actionStitchBorders= new QAction(tr("Stitch Duplicated Boundaries"), mainWindow);
+    actionDetectBorders->setObjectName("actionDetectBorders");
+    actionStitchBorders->setObjectName("actionStitchBorders");
+    actionStitchBorders->setProperty("subMenuName", "Polygon Mesh Processing");
+    actionDetectBorders->setProperty("subMenuName", "Polygon Mesh Processing");
+    autoConnectActions();
+  }
+
+  bool applicable(QAction*) const {
+    Q_FOREACH(int index, scene->selectionIndices())
+    {
+      if ( qobject_cast<Scene_polyhedron_item*>(scene->item(index)) )
+        return true;
+    }
+    return false;
+  }
+
+public Q_SLOTS:
+  void on_actionDetectBorders_triggered();
+  void on_actionStitchBorders_triggered();
+
+}; // end Polyhedron_demo_polyhedron_stitching_plugin
+
+
+
+struct Polyline_visitor
+{
+  Scene_polylines_item* new_item;
+
+  Polyline_visitor(Scene_polylines_item* new_item)
+    : new_item(new_item)
+  {}
+
+  void start_new_polyline()
+  {
+    new_item->polylines.push_back( Scene_polylines_item::Polyline() );
+  }
+
+  void add_node(boost::graph_traits<Polyhedron>::vertex_descriptor vd)
+  {
+    new_item->polylines.back().push_back(vd->point());
+  }
+  void end_polyline(){}
+};
+
+void Polyhedron_demo_polyhedron_stitching_plugin::on_actionDetectBorders_triggered()
+{
+  Q_FOREACH(int index, scene->selectionIndices())
+  {
+    Scene_polyhedron_item* item =
+      qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+
+    if(item)
+    {
+      Scene_polylines_item* new_item = new Scene_polylines_item();
+
+      Polyhedron* pMesh = item->polyhedron();
+      pMesh->normalize_border();
+
+#if 0
+      for (Polyhedron::Halfedge_iterator
+              it=pMesh->border_halfedges_begin(), it_end=pMesh->halfedges_end();
+              it!=it_end; ++it)
+      {
+        if (!it->is_border()) continue;
+        /// \todo build cycles and graph with nodes of valence 2.
+        new_item->polylines.push_back( Scene_polylines_item::Polyline() );
+        new_item->polylines.back().push_back( it->opposite()->vertex()->point() );
+        new_item->polylines.back().push_back( it->vertex()->point() );
+      }
+#else
+      typedef boost::filtered_graph<Polyhedron,Is_border<Polyhedron>, Is_border<Polyhedron> > BorderGraph;
+      
+      Is_border<Polyhedron> ib(*pMesh);
+      BorderGraph bg(*pMesh,ib,ib);
+      Polyline_visitor polyline_visitor(new_item); 
+      CGAL::split_graph_into_polylines( bg,
+                                        polyline_visitor,
+                                        CGAL::internal::IsTerminalDefault() );
+#endif
+      
+      if (new_item->polylines.empty())
+      {
+        delete new_item;
+      }
+      else
+      {
+        new_item->setName(tr("Boundary of %1").arg(item->name()));
+        new_item->setColor(Qt::red);
+        scene->addItem(new_item);
+        new_item->invalidateOpenGLBuffers();
+      }
+    }
+  }
+}
+
+void Polyhedron_demo_polyhedron_stitching_plugin::on_actionStitchBorders_triggered()
+{
+  Q_FOREACH(int index, scene->selectionIndices())
+  {
+    Scene_polyhedron_item* item =
+      qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+
+    if(item)
+    {
+      Polyhedron* pMesh = item->polyhedron();
+      CGAL::Polygon_mesh_processing::stitch_borders(*pMesh);
+      item->invalidateOpenGLBuffers();
+      scene->itemChanged(item);
+    }
+  }
+}
+
+#include "Polyhedron_stitching_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Repair_polyhedron_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Repair_polyhedron_plugin.cpp
new file mode 100644
index 0000000..56dc5bf
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Repair_polyhedron_plugin.cpp
@@ -0,0 +1,108 @@
+#include <QtCore/qglobal.h>
+
+#include "Scene_polyhedron_item.h"
+#include <CGAL/Three/Scene_interface.h>
+#include "Polyhedron_type.h"
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
+#include "Messages_interface.h"
+#include <CGAL/gl.h>
+
+#include <QAction>
+#include <QMainWindow>
+#include <QObject>
+
+#include <CGAL/Polygon_mesh_processing/repair.h>
+#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
+
+using namespace CGAL::Three;
+class Polyhedron_demo_repair_polyhedron_plugin :
+        public QObject,
+        public Polyhedron_demo_plugin_helper
+{
+    Q_OBJECT
+    Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+    Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+public:
+
+  void init(QMainWindow* mainWindow,
+            Scene_interface* scene_interface,
+            Messages_interface* m)
+  {
+    this->scene = scene_interface;
+    this->mw = mainWindow;
+    this->messages = m;
+
+    actionRemoveIsolatedVertices = new QAction(tr("Remove Isolated Vertices"), mw);
+    actionRemoveDegenerateFaces = new QAction(tr("Remove Degenerate Faces"), mw);
+    actionRemoveIsolatedVertices->setObjectName("actionRemoveIsolatedVertices");
+    actionRemoveDegenerateFaces->setObjectName("actionRemoveDegenerateFaces");
+    autoConnectActions();
+  }
+
+  QList<QAction*> actions() const
+  {
+    return QList<QAction*>() << actionRemoveIsolatedVertices
+                                //removed until the function is fully working;
+      //<< actionRemoveDegenerateFaces
+         ;
+  }
+
+  bool applicable(QAction*) const
+  {
+    int item_id = scene->mainSelectionIndex();
+    return qobject_cast<Scene_polyhedron_item*>(
+      scene->item(item_id));
+  }
+
+public Q_SLOTS:
+  void on_actionRemoveIsolatedVertices_triggered();
+  void on_actionRemoveDegenerateFaces_triggered();
+
+private:
+  QAction* actionRemoveIsolatedVertices;
+  QAction* actionRemoveDegenerateFaces;
+
+  Messages_interface* messages;
+}; // end Polyhedron_demo_repair_polyhedron_plugin
+
+
+void Polyhedron_demo_repair_polyhedron_plugin::on_actionRemoveIsolatedVertices_triggered()
+{
+  const Scene_interface::Item_id index = scene->mainSelectionIndex();
+
+  Scene_polyhedron_item* poly_item =
+    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+  if (poly_item)
+  {
+    std::size_t nbv =
+      CGAL::Polygon_mesh_processing::remove_isolated_vertices(
+        *poly_item->polyhedron());
+    messages->information(tr(" %1 isolated vertices have been removed.")
+      .arg(nbv));
+    poly_item->invalidateOpenGLBuffers();
+    Q_EMIT poly_item->itemChanged();
+  }
+}
+
+void Polyhedron_demo_repair_polyhedron_plugin::on_actionRemoveDegenerateFaces_triggered()
+{
+  const Scene_interface::Item_id index = scene->mainSelectionIndex();
+
+  Scene_polyhedron_item* poly_item =
+    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+  if (poly_item)
+  {
+    std::size_t nbv =
+      CGAL::Polygon_mesh_processing::remove_degenerate_faces(
+      *poly_item->polyhedron());
+    messages->information(tr(" %1 degenerate faces have been removed.")
+      .arg(nbv));
+    poly_item->invalidateOpenGLBuffers();
+    Q_EMIT poly_item->itemChanged();
+  }
+}
+
+
+#include "Repair_polyhedron_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Selection_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Selection_plugin.cpp
new file mode 100644
index 0000000..7ad8e9a
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Selection_plugin.cpp
@@ -0,0 +1,671 @@
+#include <QtCore/qglobal.h>
+#include "opengl_tools.h"
+
+#include "Messages_interface.h"
+#include "Scene_polyhedron_item.h"
+#include "Scene_polyhedron_selection_item.h"
+#include "Scene_points_with_normal_item.h"
+#include "Scene_polylines_item.h"
+
+#include <CGAL/Three/Scene_interface.h>
+#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
+#include "ui_Selection_widget.h"
+
+#include <QAction>
+#include <QMainWindow>
+#include <QApplication>
+
+#include <map>
+
+#include <boost/graph/adjacency_list.hpp>
+#include <CGAL/boost/graph/split_graph_into_polylines.h>
+#include <Scene.h>
+
+struct Is_terminal
+{
+  template <typename VertexDescriptor, typename Graph>
+  bool operator ()(VertexDescriptor , const Graph& )
+  {
+    return false; // degree(vd,g) != 2; is a bad test in case of parallel edges
+  }
+};
+
+
+template <typename Graph>
+struct Polyline_visitor
+{
+  Scene_polylines_item* item;
+  const Graph& points_pmap;
+
+  Polyline_visitor(Scene_polylines_item* item_,
+                   const Graph& points_property_map)
+    : item(item_),
+      points_pmap(points_property_map)
+  {}
+
+  void start_new_polyline()
+  {
+    item->polylines.push_back( Scene_polylines_item::Polyline() );
+  }
+
+  void add_node(typename boost::graph_traits<Graph>::vertex_descriptor vd)
+  {
+    item->polylines.back().push_back(points_pmap[vd]);
+  }
+  void end_polyline(){}
+};
+using namespace CGAL::Three;
+class Polyhedron_demo_selection_plugin :
+  public QObject,
+  public Polyhedron_demo_plugin_helper
+{
+  Q_OBJECT
+    Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+    Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+public:
+  bool applicable(QAction*) const { 
+    return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()))
+        || qobject_cast<Scene_polyhedron_selection_item*>(scene->item(scene->mainSelectionIndex())); 
+  }
+  void print_message(QString message) { messages->information(message); }
+  QList<QAction*> actions() const { return QList<QAction*>() << actionSelection; }
+
+  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface* m) {
+    mw = mainWindow;
+    scene = scene_interface;
+    messages = m;
+    actionSelection = new QAction(tr("Selection"), mw);
+    connect(actionSelection, SIGNAL(triggered()), this, SLOT(selection_action()));
+    last_mode = 0;
+    dock_widget = new QDockWidget("Selection", mw);
+    dock_widget->setVisible(false);
+
+    ui_widget.setupUi(dock_widget);
+    addDockWidget(dock_widget);
+    Scene* true_scene = static_cast<Scene*>(scene);
+    if(true_scene)
+      connect(true_scene, SIGNAL(selectionChanged(int)), this, SLOT(selectionChanged(int)));
+
+    connect(ui_widget.Select_all_button,  SIGNAL(clicked()), this, SLOT(on_Select_all_button_clicked()));
+    connect(ui_widget.Select_all_NTButton,  SIGNAL(clicked()), this, SLOT(on_Select_all_NTButton_clicked()));
+    connect(ui_widget.Add_to_selection_button,  SIGNAL(clicked()), this, SLOT(on_Add_to_selection_button_clicked()));
+    connect(ui_widget.Clear_button,  SIGNAL(clicked()), this, SLOT(on_Clear_button_clicked()));
+    connect(ui_widget.Clear_all_button,  SIGNAL(clicked()), this, SLOT(on_Clear_all_button_clicked()));
+    connect(ui_widget.Inverse_selection_button,  SIGNAL(clicked()), this, SLOT(on_Inverse_selection_button_clicked()));
+    connect(ui_widget.Select_isolated_components_button,  SIGNAL(clicked()), this, SLOT(on_Select_isolated_components_button_clicked()));
+    connect(ui_widget.Get_minimum_button,  SIGNAL(clicked()), this, SLOT(on_Get_minimum_button_clicked()));
+    connect(ui_widget.Create_selection_item_button,  SIGNAL(clicked()), this, SLOT(on_Create_selection_item_button_clicked()));    
+    connect(ui_widget.Selection_type_combo_box, SIGNAL(currentIndexChanged(int)), 
+            this, SLOT(on_Selection_type_combo_box_changed(int)));
+    connect(ui_widget.Insertion_radio_button, SIGNAL(toggled(bool)), this, SLOT(on_Insertion_radio_button_toggled(bool)));
+    connect(ui_widget.Brush_size_spin_box, SIGNAL(valueChanged(int)), this, SLOT(on_Brush_size_spin_box_changed(int)));
+    connect(ui_widget.validateButton, SIGNAL(clicked()), this, SLOT(on_validateButton_clicked()));
+    connect(ui_widget.Expand_reduce_button, SIGNAL(clicked()), this, SLOT(on_Expand_reduce_button_clicked()));
+    connect(ui_widget.Select_sharp_edges_button, SIGNAL(clicked()), this, SLOT(on_Select_sharp_edges_button_clicked()));
+    connect(ui_widget.modeBox, SIGNAL(currentIndexChanged(int)), this, SLOT(on_ModeBox_changed(int)));
+    connect(ui_widget.editionBox, SIGNAL(currentIndexChanged(int)), this, SLOT(on_editionBox_changed(int)));
+
+    ui_widget.Add_to_selection_button->hide();
+    ui_widget.Select_all_NTButton->hide();
+    QObject* scene = dynamic_cast<QObject*>(scene_interface);
+    if(scene) { 
+      connect(scene, SIGNAL(itemAboutToBeDestroyed(CGAL::Three::Scene_item*)), this, SLOT(item_about_to_be_destroyed(CGAL::Three::Scene_item*)));
+      connect(scene, SIGNAL(newItem(int)), this, SLOT(new_item_created(int)));
+    } 
+  }
+  virtual void closure()
+  {
+    dock_widget->hide();
+  }
+Q_SIGNALS:
+  void save_handleType();
+  void set_operation_mode(int);
+public Q_SLOTS:
+  //If the mainSelectedItem is a selection_item, disable the picking item selection. Else, enable it.
+  void selectionChanged(int i)
+  {
+    QGLViewer* v = *QGLViewer::QGLViewerPool().begin();
+    CGAL::Three::Viewer_interface* viewer = dynamic_cast<CGAL::Three::Viewer_interface*>(v);
+    if(!viewer)
+        return;
+    Scene_polyhedron_selection_item* current_item = qobject_cast<Scene_polyhedron_selection_item*>(scene->item(i));
+    if(!current_item)
+      viewer->setBindingSelect();
+    else
+      viewer->setNoBinding();
+  }
+
+  void connectItem(Scene_polyhedron_selection_item* new_item)
+  {
+    connect(this, SIGNAL(save_handleType()),new_item, SLOT(save_handleType()));
+    connect(new_item, SIGNAL(updateInstructions(QString)), this, SLOT(setInstructions(QString)));
+    connect(this, SIGNAL(set_operation_mode(int)),new_item, SLOT(set_operation_mode(int)));
+    int item_id = scene->addItem(new_item);
+    QObject* scene_ptr = dynamic_cast<QObject*>(scene);
+    if (scene_ptr)
+      connect(new_item,SIGNAL(simplicesSelected(CGAL::Three::Scene_item*)), scene_ptr, SLOT(setSelectedItem(CGAL::Three::Scene_item*)));
+    connect(new_item,SIGNAL(isCurrentlySelected(Scene_polyhedron_item_k_ring_selection*)), this, SLOT(isCurrentlySelected(Scene_polyhedron_item_k_ring_selection*)));
+    scene->setSelectedItem(item_id);
+    on_ModeBox_changed(ui_widget.modeBox->currentIndex());
+    if(last_mode == 0)
+      on_Selection_type_combo_box_changed(ui_widget.Selection_type_combo_box->currentIndex());
+  }
+  // If the selection_item or the polyhedron_item associated to the k-ring_selector is currently selected,
+  // set the k-ring_selector as currently selected. (A k-ring_selector tha tis not "currently selected" will
+  // not process selection events)
+  void isCurrentlySelected(Scene_polyhedron_item_k_ring_selection* item)
+  {
+    if(scene->item_id(selection_item_map.find(item->poly_item)->second) == scene->mainSelectionIndex() ||
+       scene->item_id(item->poly_item)== scene->mainSelectionIndex() )
+      item->setCurrentlySelected(true);
+    else
+      item->setCurrentlySelected(false);
+  }
+
+  void setInstructions(QString s)
+  {
+    ui_widget.instructionsLabel->setText(s);
+  }
+
+  void selection_action() {
+    dock_widget->show();
+    dock_widget->raise();
+    Scene_polyhedron_item* poly_item = getSelectedItem<Scene_polyhedron_item>();
+    if(!poly_item || selection_item_map.find(poly_item) != selection_item_map.end()) { return; }
+    Scene_polyhedron_selection_item* new_item = new Scene_polyhedron_selection_item(poly_item, mw);
+    connectItem(new_item);
+  }
+
+  Scene_polyhedron_selection_item* onTheFlyItem() {
+    Scene_polyhedron_item* poly_item = qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
+    if(!poly_item)
+      return NULL;
+    Scene_polyhedron_selection_item* new_item = new Scene_polyhedron_selection_item(poly_item, mw);
+    connectItem(new_item);
+    return new_item;
+
+  }
+  // Select all
+  void on_Select_all_button_clicked() {
+    Scene_polyhedron_selection_item* selection_item = getSelectedItem<Scene_polyhedron_selection_item>();
+    if(!selection_item)
+      selection_item = onTheFlyItem();
+    if(!selection_item)
+    {
+      print_message("Error: there is no selected polyhedron selection item!");
+      return;
+    }
+
+    selection_item->select_all();
+  }
+
+  void on_Select_all_NTButton_clicked()
+  {
+    Scene_polyhedron_selection_item* selection_item = getSelectedItem<Scene_polyhedron_selection_item>();
+    if(!selection_item)
+      selection_item = onTheFlyItem();
+    if(!selection_item) {
+      print_message("Error: there is no selected polyhedron selection item!");
+      return;
+    }
+
+    selection_item->select_all_NT();
+  }
+
+  void on_Add_to_selection_button_clicked()
+  {
+
+    Scene_polyhedron_selection_item* selection_item = getSelectedItem<Scene_polyhedron_selection_item>();
+    if(!selection_item) {
+      print_message("Error: there is no selected polyhedron selection item!");
+      return;
+    }
+
+    selection_item->add_to_selection();
+  }
+  // Clear selection
+  void on_Clear_button_clicked() {
+    Scene_polyhedron_selection_item* selection_item = getSelectedItem<Scene_polyhedron_selection_item>();
+    if(!selection_item) {
+      print_message("Error: there is no selected polyhedron selection item!");
+      return; 
+    }
+
+    selection_item->clear();
+  }
+  void on_Clear_all_button_clicked(){
+    Scene_polyhedron_selection_item* selection_item = getSelectedItem<Scene_polyhedron_selection_item>();
+    if(!selection_item) {
+      print_message("Error: there is no selected polyhedron selection item!");
+      return;
+    }
+
+    selection_item->clear_all();
+  }
+  void on_Inverse_selection_button_clicked()
+  {
+    Scene_polyhedron_selection_item* selection_item = getSelectedItem<Scene_polyhedron_selection_item>();
+    if(!selection_item) {
+      print_message("Error: there is no selected polyhedron selection item!");
+      return;
+    }
+    selection_item->inverse_selection();
+  }
+  // Isolated component related functions
+  void on_Select_isolated_components_button_clicked() {
+    Scene_polyhedron_selection_item* selection_item = getSelectedItem<Scene_polyhedron_selection_item>();
+    if(!selection_item)
+      selection_item = onTheFlyItem();
+    if(!selection_item) {
+      print_message("Error: there is no selected polyhedron selection item!");
+      return; 
+    }
+
+    boost::optional<std::size_t> minimum =
+      selection_item->select_isolated_components(ui_widget.Threshold_size_spin_box->value());
+    if(minimum) {
+      ui_widget.Threshold_size_spin_box->setValue((int) *minimum);
+    }
+  }
+  void on_Get_minimum_button_clicked() {
+    Scene_polyhedron_selection_item* selection_item = getSelectedItem<Scene_polyhedron_selection_item>();
+    if(!selection_item)
+      selection_item = onTheFlyItem();
+    if(!selection_item) {
+      print_message("Error: there is no selected polyhedron selection item!");
+      return; 
+    }
+    boost::optional<std::size_t> minimum = selection_item->get_minimum_isolated_component();
+    if(minimum) {
+      ui_widget.Threshold_size_spin_box->setValue((int) *minimum);
+    }
+  }
+  // Create selection item for selected polyhedron item
+  void on_Create_selection_item_button_clicked() {
+    Scene_polyhedron_item* poly_item = getSelectedItem<Scene_polyhedron_item>();
+    if(!poly_item) {
+      print_message("Error: there is no selected polyhedron item!");
+      return; 
+    }
+    // all other arrangements (putting inside selection_item_map), setting names etc,
+    // other params (e.g. k_ring) will be set inside new_item_created
+    Scene_polyhedron_selection_item* new_item = new Scene_polyhedron_selection_item(poly_item, mw);
+    ui_widget.modeBox->setCurrentIndex(last_mode);
+    connectItem(new_item);
+  }
+  void on_Selection_type_combo_box_changed(int index) {
+    typedef Scene_polyhedron_selection_item::Active_handle Active_handle;
+    for(Selection_item_map::iterator it = selection_item_map.begin(); it != selection_item_map.end(); ++it) {
+      it->second->set_active_handle_type(static_cast<Active_handle::Type>(index));
+      Q_EMIT save_handleType();
+      if(index == 1)
+      {
+        ui_widget.Select_all_NTButton->show();
+        ui_widget.Add_to_selection_button->hide();
+        Q_EMIT set_operation_mode(-1);
+      }
+      else if(index == 4)
+      {
+        it->second->setPathSelection(true);
+        ui_widget.Add_to_selection_button->show();
+        ui_widget.Select_all_NTButton->hide();
+        Q_EMIT set_operation_mode(-2);
+      }
+      else
+      {
+        ui_widget.Add_to_selection_button->hide();
+        ui_widget.Select_all_NTButton->hide();
+        it->second->setPathSelection(false);
+        Q_EMIT set_operation_mode(-1);
+      }
+    }
+  }
+  void on_Insertion_radio_button_toggled(bool toggle){
+    for(Selection_item_map::iterator it = selection_item_map.begin(); it != selection_item_map.end(); ++it) {
+      it->second->set_is_insert(toggle);
+    }
+  }
+  void on_Brush_size_spin_box_changed(int value) {
+    for(Selection_item_map::iterator it = selection_item_map.begin(); it != selection_item_map.end(); ++it) {
+      it->second->set_k_ring(value);
+    }
+  }
+
+  void on_validateButton_clicked() {
+    switch(ui_widget.operationsBox->currentIndex())
+    {
+    //Create Point Set Item from Selected Vertices
+    case 0:
+    {
+      Scene_polyhedron_selection_item* selection_item = getSelectedItem<Scene_polyhedron_selection_item>();
+      if(!selection_item) {
+        print_message("Error: there is no selected polyhedron selection item!");
+        return;
+      }
+      if(selection_item->selected_vertices.empty()) {
+        print_message("Error: there is no selected vertex in polyhedron selection item!");
+        return;
+      }
+      Scene_points_with_normal_item* point_item = new Scene_points_with_normal_item();
+      point_item->setName(QString("%1-points").arg(selection_item->name()));
+      for(Scene_polyhedron_selection_item::Selection_set_vertex::iterator begin = selection_item->selected_vertices.begin();
+         begin != selection_item->selected_vertices.end(); ++begin) {
+         point_item->point_set()->push_back((*begin)->point());
+      }
+      scene->setSelectedItem( scene->addItem(point_item) );
+      break;
+    }
+      //Create Polyline Item from Selected Edges
+    case 1:
+    {
+      Scene_polyhedron_selection_item* selection_item = getSelectedItem<Scene_polyhedron_selection_item>();
+      if(!selection_item) {
+        print_message("Error: there is no selected polyhedron selection item!");
+        return;
+      }
+      if(selection_item->selected_edges.empty()) {
+        print_message("Error: there is no selected edge in polyhedron selection item!");
+        return;
+      }
+      Scene_polylines_item* polyline_item = new Scene_polylines_item();
+      polyline_item->setName(QString("%1-edges").arg(selection_item->name()));
+
+      typedef boost::adjacency_list < boost::listS,
+          boost::vecS,
+          boost::undirectedS,
+          Kernel::Point_3 > Edge_graph;
+      typedef Polyhedron::Vertex_handle Vertex_handle;
+      Edge_graph edge_graph;
+      std::map<Vertex_handle, Edge_graph::vertex_descriptor> p2vd;
+      std::map<Vertex_handle, Edge_graph::vertex_descriptor>::iterator it_find;
+      bool insert_OK;
+
+      for(Scene_polyhedron_selection_item::Selection_set_edge::iterator begin = selection_item->selected_edges.begin();
+          begin != selection_item->selected_edges.end(); ++begin)
+      {
+        Vertex_handle source = begin->halfedge()->opposite()->vertex();
+        boost::tie(it_find, insert_OK)
+            = p2vd.insert(std::make_pair(source, Edge_graph::vertex_descriptor()));
+        if (insert_OK)
+        {
+          it_find->second = add_vertex(edge_graph);
+          edge_graph[it_find->second] = source->point();
+        }
+        Edge_graph::vertex_descriptor src=it_find->second;
+
+        Vertex_handle target = begin->halfedge()->vertex();
+        boost::tie(it_find, insert_OK)
+            = p2vd.insert(std::make_pair(target, Edge_graph::vertex_descriptor()));
+        if (insert_OK)
+        {
+          it_find->second = add_vertex(edge_graph);
+          edge_graph[it_find->second] = target->point();
+        }
+        Edge_graph::vertex_descriptor tgt=it_find->second;
+        boost::add_edge(src, tgt, edge_graph);
+      }
+
+
+      Polyline_visitor<Edge_graph> polyline_visitor(polyline_item, edge_graph);
+      CGAL::split_graph_into_polylines( edge_graph,
+                                        polyline_visitor,
+                                        Is_terminal() );
+      scene->setSelectedItem( scene->addItem(polyline_item) );
+      scene->itemChanged(polyline_item);
+      break;
+    }
+      //Create Polyhedron Item from Selected Facets
+    case 2:
+    {
+      Scene_polyhedron_selection_item* selection_item = getSelectedItem<Scene_polyhedron_selection_item>();
+      if(!selection_item) {
+        print_message("Error: there is no selected polyhedron selection item!");
+        return;
+      }
+
+      Scene_polyhedron_item* poly_item = new Scene_polyhedron_item();
+      if(selection_item->export_selected_facets_as_polyhedron(poly_item->polyhedron())) {
+        poly_item->setName(QString("%1-facets").arg(selection_item->name()));
+        poly_item->invalidateOpenGLBuffers(); // for init()
+        scene->setSelectedItem( scene->addItem(poly_item) );
+        scene->itemChanged(poly_item);
+      }
+      else {
+        delete poly_item;
+        print_message("Error: polyhedron item is not created!");
+      }
+      break;
+    }
+      //Erase Selected Facets from Polyhedron Item
+    case 3:
+    {
+      Scene_polyhedron_selection_item* selection_item = getSelectedItem<Scene_polyhedron_selection_item>();
+      if(!selection_item) {
+        print_message("Error: there is no selected polyhedron selection item!");
+        return;
+      }
+
+      selection_item->erase_selected_facets();
+      break;
+    }
+      //Keep connected components of Selected Facets
+    case 4:
+    {
+      Scene_polyhedron_selection_item* selection_item = getSelectedItem<Scene_polyhedron_selection_item>();
+      if (!selection_item) {
+        print_message("Error: there is no selected polyhedron selection item!");
+        return;
+      }
+      selection_item->keep_connected_components();
+      break;
+    }
+    default :
+      break;
+    }
+    return;
+  }
+
+  void on_ModeBox_changed(int index)
+  {
+    Scene_polyhedron_selection_item* selection_item = getSelectedItem<Scene_polyhedron_selection_item>();
+    if(selection_item)
+      selection_item->on_Ctrlz_pressed();
+    last_mode = index;
+    switch(index)
+    {
+    //Selection mode
+    case 0:
+      ui_widget.selection_groupBox->setVisible(true);
+      ui_widget.edition_groupBox->setVisible(false);
+      Q_EMIT set_operation_mode(-1);
+      on_Selection_type_combo_box_changed(ui_widget.Selection_type_combo_box->currentIndex());
+      break;
+      //Edition mode
+    case 1:
+      ui_widget.selection_groupBox->setVisible(false);
+      ui_widget.edition_groupBox->setVisible(true);
+      Q_EMIT save_handleType();
+      on_editionBox_changed(ui_widget.editionBox->currentIndex());
+      break;
+    }
+  }
+
+  void on_editionBox_changed(int mode )
+  {
+    Scene_polyhedron_selection_item* selection_item = getSelectedItem<Scene_polyhedron_selection_item>();
+    if(selection_item)
+      selection_item->on_Ctrlz_pressed();
+    if(ui_widget.modeBox->currentIndex() == 0)
+    {
+      Q_EMIT set_operation_mode(-1);
+    }
+    else
+    {
+      Q_EMIT set_operation_mode(mode);
+    }
+    switch(mode)
+    {
+    //Join vertex
+    case 0:
+    //Split vertex
+    case 1:
+    {
+      QPixmap pm(":/cgal/Polyhedron_3/resources/euler_vertex.png");
+      ui_widget.docImage_Label->setPixmap(pm);
+      break;
+    }
+    //Join face
+    case 3:
+    //Split face
+    case 4:
+    {
+      QPixmap pm(":/cgal/Polyhedron_3/resources/euler_facet.png");
+      ui_widget.docImage_Label->setPixmap(pm);
+      break;
+    }
+    //Collapse edge
+    case 5:
+    {
+      QPixmap pm(":/cgal/Polyhedron_3/resources/general_collapse.png");
+      ui_widget.docImage_Label->setPixmap(pm);
+      break;
+    }
+    //Add center vertex
+    case 7:
+    //Remove center vertex
+    case 8:
+    {
+      QPixmap pm(":/cgal/Polyhedron_3/resources/euler_center.png");
+      ui_widget.docImage_Label->setPixmap(pm);
+      break;
+    }
+    //Add vertex and face to border
+    case 9:
+    {
+      QPixmap pm(":/cgal/Polyhedron_3/resources/add_facet1.png");
+      ui_widget.docImage_Label->setPixmap(pm);
+      break;
+    }
+    //add facet to border
+    case 10:
+    {
+      QPixmap pm(":/cgal/Polyhedron_3/resources/add_facet2.png");
+      ui_widget.docImage_Label->setPixmap(pm);
+      break;
+    }
+    default:
+      ui_widget.docImage_Label->clear();
+      break;
+    }
+  }
+  void on_Select_sharp_edges_button_clicked() {
+    Scene_polyhedron_selection_item* selection_item = getSelectedItem<Scene_polyhedron_selection_item>();
+    if(!selection_item)
+      selection_item = onTheFlyItem();
+    if (!selection_item) {
+      print_message("Error: there is no selected polyhedron selection item!");
+      return;
+    }
+
+    double angle = ui_widget.Sharp_angle_spinbox->value();
+    selection_item->select_sharp_edges(angle);
+    scene->itemChanged(selection_item);
+  }
+
+  void on_Expand_reduce_button_clicked() {
+    Scene_polyhedron_selection_item* selection_item = getSelectedItem<Scene_polyhedron_selection_item>();
+    if(!selection_item) {
+      print_message("Error: there is no selected polyhedron selection item!");
+      return; 
+    }
+
+    int steps = ui_widget.Expand_reduce_spin_box->value();
+    selection_item->expand_or_reduce(steps);
+  }
+  // To handle empty selection items coming from loader
+  void new_item_created(int item_id) {
+    typedef Scene_polyhedron_selection_item::Active_handle Active_handle;
+    Scene_polyhedron_selection_item* selection_item = 
+      qobject_cast<Scene_polyhedron_selection_item*>(scene->item(item_id));
+    if(!selection_item) { return; }
+
+    Scene_polyhedron_item* poly_item = getSelectedItem<Scene_polyhedron_item>();
+    if(!poly_item) {
+      CGAL_assertion(selection_item->polyhedron_item() == NULL); // which means it is coming from selection_io loader
+      print_message("Error: please select corresponding polyhedron item from Geometric Objects list.");
+      scene->erase(item_id);
+      return;
+    }
+
+    if(selection_item->polyhedron_item() == NULL) { //coming from selection_io loader
+      if(!selection_item->actual_load(poly_item, mw)) {
+        print_message("Error: loading selection item is not successful!");
+        scene->erase(item_id);
+        return;
+      }
+      selection_item->invalidateOpenGLBuffers();
+      scene->itemChanged(selection_item);
+    }
+    // now set default params both for selection items coming from selection_io, or on_Create_selection_item_button_clicked
+    Active_handle::Type aht = static_cast<Active_handle::Type>(ui_widget.Selection_type_combo_box->currentIndex());
+    bool is_insert = ui_widget.Insertion_radio_button->isChecked();
+    int k_ring = ui_widget.Brush_size_spin_box->value();
+
+    selection_item->set_active_handle_type(aht);
+    selection_item->set_is_insert(is_insert);
+    selection_item->set_k_ring(k_ring);
+    selection_item->setRenderingMode(Flat);
+    if(selection_item->name() == "unamed") {
+      selection_item->setName(tr("%1 (selection)").arg(poly_item->name()));
+    }
+
+    selection_item_map.insert(std::make_pair(poly_item, selection_item));
+    connect(this, SIGNAL(save_handleType()),selection_item, SLOT(save_handleType()));
+    connect(selection_item, SIGNAL(updateInstructions(QString)), this, SLOT(setInstructions(QString)));
+    connect(this, SIGNAL(set_operation_mode(int)),selection_item, SLOT(set_operation_mode(int)));
+    QObject* scene_ptr = dynamic_cast<QObject*>(scene);
+    if (scene_ptr)
+      connect(selection_item,SIGNAL(simplicesSelected(CGAL::Three::Scene_item*)), scene_ptr, SLOT(setSelectedItem(CGAL::Three::Scene_item*)));
+    connect(selection_item,SIGNAL(isCurrentlySelected(Scene_polyhedron_item_k_ring_selection*)), this, SLOT(isCurrentlySelected(Scene_polyhedron_item_k_ring_selection*)));
+  }
+  void item_about_to_be_destroyed(CGAL::Three::Scene_item* scene_item) {
+    // if polyhedron item
+    Scene_polyhedron_item* poly_item = qobject_cast<Scene_polyhedron_item*>(scene_item);
+    if(poly_item) {
+      std::pair<Selection_item_map::iterator, Selection_item_map::iterator> res =
+        selection_item_map.equal_range(poly_item);
+
+      for(Selection_item_map::iterator begin = res.first; begin != res.second; ) {
+        Scene_polyhedron_selection_item* selection_item = begin->second;
+        selection_item_map.erase(begin++); // first erase from map, because scene->erase will cause a call to this function
+        scene->erase( scene->item_id(selection_item) );
+      }
+    }
+    // if polyhedron selection item
+    Scene_polyhedron_selection_item* selection_item = qobject_cast<Scene_polyhedron_selection_item*>(scene_item);
+    if(selection_item) {
+      Scene_polyhedron_item* poly_item = selection_item->polyhedron_item();
+      std::pair<Selection_item_map::iterator, Selection_item_map::iterator> res =
+        selection_item_map.equal_range(poly_item);
+      for(Selection_item_map::iterator begin = res.first; begin != res.second; ++begin) {
+        if(begin->second == selection_item) {
+          selection_item_map.erase(begin); break;
+        }
+      }
+    }
+  }
+
+private:
+  Messages_interface* messages;
+  QAction* actionSelection;
+
+  QDockWidget* dock_widget;
+  Ui::Selection ui_widget;
+typedef std::multimap<Scene_polyhedron_item*, Scene_polyhedron_selection_item*> Selection_item_map;
+  Selection_item_map selection_item_map;
+  int last_mode;
+}; // end Polyhedron_demo_selection_plugin
+
+//Q_EXPORT_PLUGIN2(Polyhedron_demo_selection_plugin, Polyhedron_demo_selection_plugin)
+
+#include "Selection_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Selection_widget.ui b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Selection_widget.ui
new file mode 100644
index 0000000..3971a89
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Selection_widget.ui
@@ -0,0 +1,567 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Selection</class>
+ <widget class="QDockWidget" name="Selection">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>479</width>
+    <height>713</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Selection</string>
+  </property>
+  <widget class="QWidget" name="dockWidgetContents">
+   <layout class="QVBoxLayout" name="verticalLayout">
+    <item>
+     <layout class="QHBoxLayout" name="horizontalLayout_10" stretch="1,1">
+      <item>
+       <widget class="QComboBox" name="modeBox">
+        <item>
+         <property name="text">
+          <string>Selection Mode</string>
+         </property>
+        </item>
+        <item>
+         <property name="text">
+          <string>Edition Mode</string>
+         </property>
+        </item>
+       </widget>
+      </item>
+      <item>
+       <spacer name="horizontalSpacer_2">
+        <property name="orientation">
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>40</width>
+          <height>20</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+     </layout>
+    </item>
+    <item>
+     <widget class="QGroupBox" name="selection_groupBox">
+      <property name="title">
+       <string>Selection Operations</string>
+      </property>
+      <layout class="QVBoxLayout" name="verticalLayout_6">
+       <item>
+        <layout class="QVBoxLayout" name="verticalLayout_3">
+         <item>
+          <widget class="QGroupBox" name="groupBox">
+           <property name="title">
+            <string>Selection by Type</string>
+           </property>
+           <layout class="QVBoxLayout" name="verticalLayout_5">
+            <item>
+             <layout class="QVBoxLayout" name="verticalLayout_11" stretch="0,0">
+              <item>
+               <layout class="QHBoxLayout" name="horizontalLayout_9" stretch="1,1">
+                <item>
+                 <widget class="QLabel" name="label_2">
+                  <property name="text">
+                   <string>Selection Type :</string>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <widget class="QComboBox" name="Selection_type_combo_box">
+                  <item>
+                   <property name="text">
+                    <string>Vertex</string>
+                   </property>
+                  </item>
+                  <item>
+                   <property name="text">
+                    <string>Facet</string>
+                   </property>
+                  </item>
+                  <item>
+                   <property name="text">
+                    <string>Edge</string>
+                   </property>
+                  </item>
+                  <item>
+                   <property name="text">
+                    <string>Connected Component (Facet)</string>
+                   </property>
+                  </item>
+                  <item>
+                   <property name="text">
+                    <string>Path Between Vertices</string>
+                   </property>
+                  </item>
+                 </widget>
+                </item>
+               </layout>
+              </item>
+              <item>
+               <layout class="QHBoxLayout" name="horizontalLayout_11" stretch="1,1,1">
+                <item>
+                 <spacer name="horizontalSpacer_3">
+                  <property name="orientation">
+                   <enum>Qt::Horizontal</enum>
+                  </property>
+                  <property name="sizeHint" stdset="0">
+                   <size>
+                    <width>40</width>
+                    <height>20</height>
+                   </size>
+                  </property>
+                 </spacer>
+                </item>
+                <item>
+                 <widget class="QPushButton" name="Select_all_NTButton">
+                  <property name="text">
+                   <string>Select All Non Triangle</string>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <widget class="QPushButton" name="Add_to_selection_button">
+                  <property name="sizePolicy">
+                   <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+                    <horstretch>0</horstretch>
+                    <verstretch>0</verstretch>
+                   </sizepolicy>
+                  </property>
+                  <property name="text">
+                   <string>Add to Selection</string>
+                  </property>
+                 </widget>
+                </item>
+               </layout>
+              </item>
+             </layout>
+            </item>
+            <item>
+             <layout class="QVBoxLayout" name="verticalLayout_2">
+              <item>
+               <layout class="QHBoxLayout" name="horizontalLayout_2">
+                <item>
+                 <layout class="QHBoxLayout" name="horizontalLayout">
+                  <item>
+                   <widget class="QRadioButton" name="Insertion_radio_button">
+                    <property name="text">
+                     <string>Insertion</string>
+                    </property>
+                    <property name="checked">
+                     <bool>true</bool>
+                    </property>
+                   </widget>
+                  </item>
+                  <item>
+                   <widget class="QRadioButton" name="Removal_radio_button">
+                    <property name="text">
+                     <string>Removal</string>
+                    </property>
+                   </widget>
+                  </item>
+                 </layout>
+                </item>
+                <item>
+                 <layout class="QVBoxLayout" name="verticalLayout_7">
+                  <item>
+                   <layout class="QHBoxLayout" name="horizontalLayout_6">
+                    <item>
+                     <widget class="QLabel" name="label">
+                      <property name="text">
+                       <string>Brush &size:</string>
+                      </property>
+                      <property name="buddy">
+                       <cstring>Brush_size_spin_box</cstring>
+                      </property>
+                     </widget>
+                    </item>
+                    <item>
+                     <widget class="QSpinBox" name="Brush_size_spin_box"/>
+                    </item>
+                   </layout>
+                  </item>
+                 </layout>
+                </item>
+               </layout>
+              </item>
+              <item>
+               <layout class="QHBoxLayout" name="horizontalLayout_3">
+                <item>
+                 <widget class="QPushButton" name="Select_all_button">
+                  <property name="toolTip">
+                   <string extracomment="Select all simplices of Selection Type"/>
+                  </property>
+                  <property name="text">
+                   <string>Select &All</string>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <widget class="QPushButton" name="Inverse_selection_button">
+                  <property name="toolTip">
+                   <string extracomment="Invert selection for Selection Type"/>
+                  </property>
+                  <property name="text">
+                   <string>Invert Selection</string>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <widget class="QPushButton" name="Clear_button">
+                  <property name="toolTip">
+                   <string extracomment="Clear selection for Selection Type"/>
+                  </property>
+                  <property name="text">
+                   <string>&Clear</string>
+                  </property>
+                 </widget>
+                </item>
+               </layout>
+              </item>
+             </layout>
+            </item>
+           </layout>
+          </widget>
+         </item>
+         <item>
+          <spacer name="verticalSpacer_3">
+           <property name="orientation">
+            <enum>Qt::Vertical</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>20</width>
+             <height>40</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <layout class="QVBoxLayout" name="verticalLayout_4">
+           <item>
+            <layout class="QHBoxLayout" name="horizontalLayout_5">
+             <item>
+              <widget class="QLabel" name="label_3">
+               <property name="text">
+                <string>Isolated &Component Size:</string>
+               </property>
+               <property name="buddy">
+                <cstring>Threshold_size_spin_box</cstring>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QSpinBox" name="Threshold_size_spin_box">
+               <property name="maximum">
+                <number>999999999</number>
+               </property>
+               <property name="value">
+                <number>8</number>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QPushButton" name="Get_minimum_button">
+               <property name="text">
+                <string>&Get Minimum</string>
+               </property>
+              </widget>
+             </item>
+            </layout>
+           </item>
+           <item>
+            <widget class="QPushButton" name="Select_isolated_components_button">
+             <property name="text">
+              <string>Select &Isolated Components Below Threshold</string>
+             </property>
+            </widget>
+           </item>
+          </layout>
+         </item>
+         <item>
+          <spacer name="verticalSpacer_1">
+           <property name="orientation">
+            <enum>Qt::Vertical</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>20</width>
+             <height>40</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <spacer name="verticalSpacer">
+           <property name="orientation">
+            <enum>Qt::Vertical</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>20</width>
+             <height>40</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <layout class="QHBoxLayout" name="horizontalLayout_7">
+           <item>
+            <widget class="QLabel" name="label_6">
+             <property name="text">
+              <string>Sharp edges angle:</string>
+             </property>
+             <property name="alignment">
+              <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+             </property>
+            </widget>
+           </item>
+           <item>
+            <widget class="QSpinBox" name="Sharp_angle_spinbox">
+             <property name="sizePolicy">
+              <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+             <property name="maximum">
+              <number>180</number>
+             </property>
+             <property name="value">
+              <number>60</number>
+             </property>
+            </widget>
+           </item>
+           <item>
+            <widget class="QPushButton" name="Select_sharp_edges_button">
+             <property name="text">
+              <string>Select</string>
+             </property>
+            </widget>
+           </item>
+          </layout>
+         </item>
+         <item>
+          <layout class="QHBoxLayout" name="horizontalLayout_8">
+           <item>
+            <widget class="QLabel" name="label_5">
+             <property name="text">
+              <string>Expand or reduce selection:</string>
+             </property>
+            </widget>
+           </item>
+           <item>
+            <widget class="QSpinBox" name="Expand_reduce_spin_box">
+             <property name="minimum">
+              <number>-50</number>
+             </property>
+             <property name="maximum">
+              <number>50</number>
+             </property>
+            </widget>
+           </item>
+           <item>
+            <widget class="QPushButton" name="Expand_reduce_button">
+             <property name="text">
+              <string>Apply</string>
+             </property>
+            </widget>
+           </item>
+          </layout>
+         </item>
+         <item>
+          <spacer name="verticalSpacer_2">
+           <property name="orientation">
+            <enum>Qt::Vertical</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>20</width>
+             <height>40</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <layout class="QHBoxLayout" name="horizontalLayout_13" stretch="1,0">
+           <item>
+            <widget class="QComboBox" name="operationsBox">
+             <item>
+              <property name="text">
+               <string>Create Point Set Item from Selected Vertices</string>
+              </property>
+             </item>
+             <item>
+              <property name="text">
+               <string>Create Polyline Item from Selected Edges</string>
+              </property>
+             </item>
+             <item>
+              <property name="text">
+               <string>Create Polyhedron Item from Selected Facets</string>
+              </property>
+             </item>
+             <item>
+              <property name="text">
+               <string>Erase Selected Facets from Polyhedron Item</string>
+              </property>
+             </item>
+             <item>
+              <property name="text">
+               <string>Keep Connected Components of Selected Facets</string>
+              </property>
+             </item>
+            </widget>
+           </item>
+           <item>
+            <widget class="QPushButton" name="validateButton">
+             <property name="text">
+              <string>Validate</string>
+             </property>
+            </widget>
+           </item>
+          </layout>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </widget>
+    </item>
+    <item>
+     <layout class="QHBoxLayout" name="horizontalLayout_4">
+      <item>
+       <widget class="QPushButton" name="Create_selection_item_button">
+        <property name="font">
+         <font>
+          <weight>75</weight>
+          <bold>true</bold>
+         </font>
+        </property>
+        <property name="text">
+         <string>Create Selection Item</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="Clear_all_button">
+        <property name="toolTip">
+         <string extracomment="Clear selection for All Types"/>
+        </property>
+        <property name="text">
+         <string>Clear Selection Item</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </item>
+    <item>
+     <widget class="QGroupBox" name="edition_groupBox">
+      <property name="title">
+       <string>Editions Operations</string>
+      </property>
+      <layout class="QVBoxLayout" name="verticalLayout_8">
+       <item>
+        <layout class="QVBoxLayout" name="verticalLayout_9" stretch="0,1,0,0">
+         <item>
+          <widget class="QComboBox" name="editionBox">
+           <item>
+            <property name="text">
+             <string>Join vertex</string>
+            </property>
+           </item>
+           <item>
+            <property name="text">
+             <string>Split vertex</string>
+            </property>
+           </item>
+           <item>
+            <property name="text">
+             <string>Split edges</string>
+            </property>
+           </item>
+           <item>
+            <property name="text">
+             <string>Join face</string>
+            </property>
+           </item>
+           <item>
+            <property name="text">
+             <string>Split face</string>
+            </property>
+           </item>
+           <item>
+            <property name="text">
+             <string>Collapse edge</string>
+            </property>
+           </item>
+           <item>
+            <property name="text">
+             <string>Flip edge</string>
+            </property>
+           </item>
+           <item>
+            <property name="text">
+             <string>Add center vertex</string>
+            </property>
+           </item>
+           <item>
+            <property name="text">
+             <string>Remove center vertex</string>
+            </property>
+           </item>
+           <item>
+            <property name="text">
+             <string>Add vertex and face to border (Advanced)</string>
+            </property>
+           </item>
+           <item>
+            <property name="text">
+             <string>Add face to border (Advanced)</string>
+            </property>
+           </item>
+           <item>
+            <property name="text">
+             <string>Move point</string>
+            </property>
+           </item>
+          </widget>
+         </item>
+         <item>
+          <widget class="QLabel" name="instructionsLabel">
+           <property name="text">
+            <string>Instructions 
+
+</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QLabel" name="docImage_Label">
+           <property name="text">
+            <string/>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QLabel" name="label_4">
+           <property name="text">
+            <string>Ctrl+Z to cancel the temporary selection.</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Self_intersection_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Self_intersection_plugin.cpp
new file mode 100644
index 0000000..262bf70
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Self_intersection_plugin.cpp
@@ -0,0 +1,118 @@
+#include <QApplication>
+#include <QAction>
+#include <QMessageBox>
+#include <QMainWindow>
+#include "opengl_tools.h"
+#include "Kernel_type.h"
+#include "Polyhedron_type.h"
+#include "Scene_polyhedron_item.h"
+#include "Scene_polyhedron_selection_item.h"
+
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+
+#include <CGAL/intersections.h>
+#include <CGAL/Bbox_3.h>
+#include <CGAL/box_intersection_d.h>
+
+#include <CGAL/Polygon_mesh_processing/self_intersections.h>
+#include <CGAL/Make_triangle_soup.h>
+
+typedef Kernel::Triangle_3 Triangle;
+using namespace CGAL::Three;
+class Polyhedron_demo_self_intersection_plugin : 
+  public QObject,
+  public Polyhedron_demo_plugin_interface
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+public:
+
+  QList<QAction*> actions() const {
+    return _actions;
+  }
+
+  void init(QMainWindow* mainWindow,
+            Scene_interface* scene_interface,
+            Messages_interface*)
+  {
+      mw = mainWindow;
+      scene = scene_interface;
+      QAction *actionSelfIntersection = new QAction(tr("Self-&intersection"), mw);
+      actionSelfIntersection->setProperty("subMenuName", "Polygon Mesh Processing");
+      connect(actionSelfIntersection, SIGNAL(triggered()), this, SLOT(on_actionSelfIntersection_triggered()));
+      _actions <<actionSelfIntersection;
+
+  }
+
+  bool applicable(QAction*) const { 
+    return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
+  }
+
+public Q_SLOTS:
+  void on_actionSelfIntersection_triggered();
+private:
+  QList<QAction*> _actions;
+  Scene_interface *scene;
+  QMainWindow *mw;
+
+}; // end Polyhedron_demo_self_intersection_plugin
+
+void Polyhedron_demo_self_intersection_plugin::on_actionSelfIntersection_triggered()
+{
+  CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+  
+  Scene_polyhedron_item* item = 
+    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+
+  if(item)
+  {
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    Polyhedron* pMesh = item->polyhedron();
+
+    // compute self-intersections
+
+    typedef Polyhedron::Facet_handle Facet_handle;
+    std::vector<std::pair<Facet_handle, Facet_handle> > facets;
+    CGAL::Polygon_mesh_processing::self_intersections
+      (*pMesh, std::back_inserter(facets),
+      CGAL::Polygon_mesh_processing::parameters::vertex_point_map(get(CGAL::vertex_point, *pMesh)));
+
+    std::cout << "ok (" << facets.size() << " triangle pair(s))" << std::endl;
+
+    // add intersecting triangles as a new polyhedron, i.e., a triangle soup.
+    if(!facets.empty())
+    {
+      Scene_polyhedron_selection_item* selection_item = new Scene_polyhedron_selection_item(item, mw);
+      for(std::vector<std::pair<Facet_handle, Facet_handle> >::iterator fb = facets.begin();
+        fb != facets.end(); ++fb) {
+        selection_item->selected_facets.insert(fb->first);
+        selection_item->selected_facets.insert(fb->second);
+
+        Polyhedron::Halfedge_around_facet_circulator hc = (fb->first)->facet_begin(), cend = hc;
+        CGAL_For_all(hc,cend) {
+          selection_item->selected_edges.insert(edge(hc, *selection_item->polyhedron()));
+        }
+        hc = (fb->second)->facet_begin();
+        cend = hc;
+        CGAL_For_all(hc,cend) {
+          selection_item->selected_edges.insert(edge(hc, *selection_item->polyhedron()));
+        }
+      }
+      selection_item->invalidateOpenGLBuffers();
+      selection_item->setName(tr("%1 (selection) (intersecting triangles)").arg(item->name()));
+      item->setRenderingMode(Wireframe);
+      scene->addItem(selection_item);
+      scene->itemChanged(item);
+      scene->itemChanged(selection_item);
+    }
+    else
+      QMessageBox::information(mw, tr("No self intersection"),
+                               tr("The polyhedron \"%1\" does not self-intersect.").
+                               arg(item->name()));
+  }
+  QApplication::restoreOverrideCursor();
+}
+
+#include "Self_intersection_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Triangulate_facets_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Triangulate_facets_plugin.cpp
new file mode 100644
index 0000000..74d9f62
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/PMP/Triangulate_facets_plugin.cpp
@@ -0,0 +1,86 @@
+#include <QApplication>
+#include <QMainWindow>
+#include <QAction>
+#include "Messages_interface.h"
+#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
+#include "Scene_polyhedron_item.h"
+#include "Polyhedron_type.h"
+
+#include <CGAL/Polygon_mesh_processing/triangulate_faces.h>
+using namespace CGAL::Three;
+class Polyhedron_demo_triangulate_facets_plugin : 
+  public QObject,
+  public Polyhedron_demo_plugin_helper
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+public:
+
+  void init(QMainWindow* mainWindow,
+            CGAL::Three::Scene_interface* scene_interface,
+            Messages_interface* m) {
+    this->scene = scene_interface;
+    this->mw = mainWindow;
+    this->messages = m;
+    actionTriangulateFacets = new QAction("Triangulate Facets", mw);
+    actionTriangulateFacets->setProperty("subMenuName","Polygon Mesh Processing");
+    if(actionTriangulateFacets) {
+      connect(actionTriangulateFacets, SIGNAL(triggered()),
+              this, SLOT(triangulate())); 
+    }
+  };
+
+  QList<QAction*> actions() const {
+    return QList<QAction*>() << actionTriangulateFacets;
+  }
+
+  bool applicable(QAction*) const {
+    Q_FOREACH(CGAL::Three::Scene_interface::Item_id index, scene->selectionIndices()){
+      if ( qobject_cast<Scene_polyhedron_item*>(scene->item(index)) )
+        return true;
+    }
+    return false;
+  }
+
+public Q_SLOTS:
+   void triangulate() {
+    Q_FOREACH(CGAL::Three::Scene_interface::Item_id index, scene->selectionIndices())  {
+
+    Scene_polyhedron_item* item = 
+      qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+
+    if(item)
+    {
+      Polyhedron* pMesh = item->polyhedron();
+      if(!pMesh) continue;
+      if(pMesh->is_pure_triangle()) {
+        messages->warning(tr("The polyhedron \"%1\" is already triangulated.")
+                          .arg(item->name()));
+        continue;
+      }
+
+      QApplication::setOverrideCursor(Qt::WaitCursor);
+
+      if(!CGAL::Polygon_mesh_processing::triangulate_faces(*pMesh))
+        messages->warning(tr("Some facets could not be triangulated."));
+
+      CGAL_assertion_code(pMesh->normalize_border());
+      CGAL_assertion(pMesh->is_valid(false, 3));
+
+      item->invalidateOpenGLBuffers();
+      scene->itemChanged(item);
+      // default cursor
+      QApplication::restoreOverrideCursor();
+    } // end of if(item)
+
+    } // end of the loop on the selected items
+  }
+  
+private:
+  QAction* actionTriangulateFacets;
+  Messages_interface* messages;
+};
+
+#include "Triangulate_facets_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/CMakeLists.txt b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/CMakeLists.txt
new file mode 100644
index 0000000..cd1cd97
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/CMakeLists.txt
@@ -0,0 +1,63 @@
+include( polyhedron_demo_macros )
+if(EIGEN3_FOUND)
+  qt5_wrap_ui( surface_reconstructionUI_FILES Surface_reconstruction_plugin.ui)
+  polyhedron_demo_plugin(surface_reconstruction_plugin Surface_reconstruction_plugin Surface_reconstruction_plugin_impl ${surface_reconstructionUI_FILES})
+  target_link_libraries(surface_reconstruction_plugin scene_polygon_soup_item scene_polyhedron_item scene_points_with_normal_item)
+
+  qt5_wrap_ui( point_set_normal_estimationUI_FILES Point_set_normal_estimation_plugin.ui)
+  polyhedron_demo_plugin(point_set_normal_estimation_plugin Point_set_normal_estimation_plugin ${point_set_normal_estimationUI_FILES})
+  target_link_libraries(point_set_normal_estimation_plugin scene_points_with_normal_item)
+
+  qt5_wrap_ui( features_detection_pluginUI_FILES Features_detection_plugin.ui)
+  polyhedron_demo_plugin(features_detection_plugin Features_detection_plugin ${features_detection_pluginUI_FILES})
+  target_link_libraries(features_detection_plugin scene_points_with_normal_item)
+
+  polyhedron_demo_plugin(point_set_smoothing_plugin Point_set_smoothing_plugin)
+  target_link_libraries(point_set_smoothing_plugin scene_points_with_normal_item)
+
+  polyhedron_demo_plugin(point_set_average_spacing_plugin Point_set_average_spacing_plugin)
+  target_link_libraries(point_set_average_spacing_plugin scene_points_with_normal_item)
+
+else(EIGEN3_FOUND)
+  message(STATUS "NOTICE: Eigen 3.1 (or greater) was not found. Surface reconstruction plugin will not be available.")
+  message(STATUS "NOTICE: Eigen 3.1 (or greater) was not found. Normal estimation plugins will not be available.")
+  message(STATUS "NOTICE: Eigen 3.1 (or greater) was not found. Smoothing plugin will not be available.")
+  message(STATUS "NOTICE: Eigen 3.1 (or greater) was not found. Average spacing plugin will not be available.")
+  message(STATUS "NOTICE: Eigen 3.1 (or greater) was not found. Feature detection plugin will not be available.")
+
+endif()
+
+  qt5_wrap_ui(point_set_bilateral_smoothingUI_FILES Point_set_bilateral_smoothing_plugin.ui)
+  polyhedron_demo_plugin(point_set_bilateral_smoothing_plugin Point_set_bilateral_smoothing_plugin ${point_set_bilateral_smoothingUI_FILES})
+  target_link_libraries(point_set_bilateral_smoothing_plugin scene_points_with_normal_item)
+
+  qt5_wrap_ui( ps_outliers_removal_UI_FILES Point_set_outliers_removal_plugin.ui)
+  polyhedron_demo_plugin(point_set_outliers_removal_plugin Point_set_outliers_removal_plugin ${ps_outliers_removal_UI_FILES})
+  target_link_libraries(point_set_outliers_removal_plugin scene_points_with_normal_item)
+
+  qt5_wrap_ui( point_set_selectionUI_FILES Point_set_selection_widget.ui)
+  polyhedron_demo_plugin(point_set_selection_plugin Point_set_selection_plugin ${point_set_selectionUI_FILES})
+  target_link_libraries(point_set_selection_plugin scene_points_with_normal_item scene_polylines_item)
+
+  qt5_wrap_ui(point_set_shape_detectionUI_FILES Point_set_shape_detection_plugin.ui)
+  polyhedron_demo_plugin(point_set_shape_detection_plugin Point_set_shape_detection_plugin ${point_set_shape_detectionUI_FILES})
+  target_link_libraries(point_set_shape_detection_plugin scene_polyhedron_item scene_points_with_normal_item scene_polygon_soup_item)
+
+  qt5_wrap_ui(point_set_simplificationUI_FILES Point_set_simplification_plugin.ui)
+  polyhedron_demo_plugin(point_set_simplification_plugin Point_set_simplification_plugin ${point_set_simplificationUI_FILES})
+  target_link_libraries(point_set_simplification_plugin scene_points_with_normal_item)
+
+
+  qt5_wrap_ui(point_set_upsamplingUI_FILES Point_set_upsampling_plugin.ui)
+  polyhedron_demo_plugin(point_set_upsampling_plugin Point_set_upsampling_plugin ${point_set_upsamplingUI_FILES})
+  target_link_libraries(point_set_upsampling_plugin scene_points_with_normal_item)
+
+  qt5_wrap_ui(point_set_wlopFILES Point_set_wlop_plugin.ui)
+  polyhedron_demo_plugin(point_set_wlop_plugin Point_set_wlop_plugin ${point_set_wlopFILES})
+  target_link_libraries(point_set_wlop_plugin scene_points_with_normal_item)
+
+  polyhedron_demo_plugin(merge_point_sets_plugin Merge_point_sets_plugin)
+  target_link_libraries(merge_point_sets_plugin scene_points_with_normal_item)
+
+  polyhedron_demo_plugin(point_set_interference_plugin Point_set_interference_plugin)
+  target_link_libraries(point_set_interference_plugin scene_points_with_normal_item)
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Features_detection_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Features_detection_plugin.cpp
new file mode 100644
index 0000000..a82ff7b
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Features_detection_plugin.cpp
@@ -0,0 +1,119 @@
+#include <QApplication>
+#include <QMessageBox>
+#include <QMainWindow>
+#include "config.h"
+#include "Scene_points_with_normal_item.h"
+#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+
+#include <CGAL/vcm_estimate_edges.h>
+
+#include <CGAL/Timer.h>
+
+#include "ui_Features_detection_plugin.h"
+using namespace CGAL::Three;
+class Polyhedron_demo_features_detection_plugin :
+  public QObject,
+  public Polyhedron_demo_plugin_helper
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+    Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0")
+  QAction* actionDetectFeatures;
+public:
+  QList<QAction*> actions() const { return QList<QAction*>() << actionDetectFeatures; }
+  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*)
+  {
+    scene = scene_interface;
+    actionDetectFeatures= new QAction(tr("VCM Features Estimation"), mainWindow);
+    actionDetectFeatures->setProperty("subMenuName","Point Set Processing");
+    actionDetectFeatures->setObjectName("actionDetectFeatures");
+    autoConnectActions();
+  }
+
+  bool applicable(QAction*) const {
+    return qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
+  }
+
+public Q_SLOTS:
+  void on_actionDetectFeatures_triggered();
+private:
+  Scene_interface* scene;
+}; // end Polyhedron_demo_features_detection_plugin
+
+class Polyhedron_demo_features_detection_dialog : public QDialog, private Ui::VCMFeaturesDetectionDialog
+{
+  Q_OBJECT
+  public:
+    Polyhedron_demo_features_detection_dialog(QWidget* /*parent*/ = 0)
+    {
+      setupUi(this);
+    }
+
+    float offsetRadius() const { return m_inputOffsetRadius->value(); }
+    float convolveRadius() const { return m_inputConvolveRadius->value(); }
+    float threshold() const { return m_inputFeaturesThreshold->value(); }
+};
+
+void Polyhedron_demo_features_detection_plugin::on_actionDetectFeatures_triggered()
+{
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+
+  Scene_points_with_normal_item* item =
+    qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
+
+  if(item)
+  {
+    // Gets point set
+    Point_set* points = item->point_set();
+    if(points == NULL)
+        return;
+
+    // Gets options
+    Polyhedron_demo_features_detection_dialog dialog;
+    if(!dialog.exec())
+      return;
+
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    typedef CGAL::cpp11::array<double,6> Covariance;
+    std::vector<Covariance> cov;
+
+    std::cerr << "Compute VCM (offset_radius="
+        << dialog.offsetRadius() << " and convolution radius=" << dialog.convolveRadius() << ")...\n";
+
+    CGAL::Timer task_timer; task_timer.start();
+    CGAL::compute_vcm(points->begin(), points->end(),
+                      CGAL::make_identity_property_map(Point_set::value_type()),
+                      cov, dialog.offsetRadius(), dialog.convolveRadius(),
+                      Kernel());
+    task_timer.stop();
+    std::cerr << "done: " << task_timer.time() << " seconds\n";
+
+    Scene_points_with_normal_item* new_item = new Scene_points_with_normal_item();
+    task_timer.reset(); task_timer.start();
+    std::size_t i=0;
+    std::cerr << "Select feature points (threshold=" << dialog.threshold() << ")...\n";
+    BOOST_FOREACH(const Point_set::value_type& p, *points)
+    {
+      if (CGAL::vcm_is_on_feature_edge(cov[i], dialog.threshold()))
+          new_item->point_set()->push_back(p);
+      ++i;
+    }
+    task_timer.stop();
+    std::cerr << "done: " << task_timer.time() << " seconds\n";
+
+    if ( !new_item->point_set()->empty() )
+    {
+      new_item->setName(tr("Features of %1").arg(item->name()));
+      new_item->setColor(Qt::red);
+      scene->addItem(new_item);
+      item->setVisible(false);
+    }
+    else
+      delete new_item;
+    QApplication::restoreOverrideCursor();
+  }
+
+}
+
+#include "Features_detection_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Features_detection_plugin.ui b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Features_detection_plugin.ui
new file mode 100644
index 0000000..98e2975
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Features_detection_plugin.ui
@@ -0,0 +1,146 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>VCMFeaturesDetectionDialog</class>
+ <widget class="QDialog" name="VCMFeaturesDetectionDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>254</width>
+    <height>153</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>VCM Features Estimation</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1">
+     <item>
+      <widget class="QLabel" name="label">
+       <property name="text">
+        <string>Offset Radius:</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QDoubleSpinBox" name="m_inputOffsetRadius">
+       <property name="decimals">
+        <number>3</number>
+       </property>
+       <property name="singleStep">
+        <double>0.050000000000000</double>
+       </property>
+       <property name="value">
+        <double>0.100000000000000</double>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout_3" stretch="0,1">
+     <item>
+      <widget class="QLabel" name="label_2">
+       <property name="text">
+        <string>Convolution Radius:</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QDoubleSpinBox" name="m_inputConvolveRadius">
+       <property name="decimals">
+        <number>3</number>
+       </property>
+       <property name="singleStep">
+        <double>0.050000000000000</double>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,1">
+     <item>
+      <widget class="QLabel" name="label_3">
+       <property name="text">
+        <string>Threshold:</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QDoubleSpinBox" name="m_inputFeaturesThreshold">
+       <property name="decimals">
+        <number>3</number>
+       </property>
+       <property name="singleStep">
+        <double>0.020000000000000</double>
+       </property>
+       <property name="value">
+        <double>0.160000000000000</double>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item>
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>VCMFeaturesDetectionDialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>248</x>
+     <y>254</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>VCMFeaturesDetectionDialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>316</x>
+     <y>260</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Merge_point_sets_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Merge_point_sets_plugin.cpp
new file mode 100644
index 0000000..eec70a7
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Merge_point_sets_plugin.cpp
@@ -0,0 +1,94 @@
+#include "config.h"
+#include "Scene_points_with_normal_item.h"
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+
+#include <QObject>
+#include <QAction>
+#include <QMainWindow>
+#include <QApplication>
+#include <QtPlugin>
+#include <QInputDialog>
+#include <QMessageBox>
+
+
+using namespace CGAL::Three;
+class Polyhedron_demo_merge_point_sets_plugin :
+  public QObject,
+  public Polyhedron_demo_plugin_interface
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+private:
+  QAction* actionMergePointSets;
+  
+public:
+  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*) {
+    scene = scene_interface;
+    actionMergePointSets = new QAction(tr("Merge"), mainWindow);
+    actionMergePointSets->setObjectName("actionMergePointSets");
+    connect(actionMergePointSets, SIGNAL(triggered()), this, SLOT(on_actionMergePointSets_triggered()));
+  }
+
+  QList<QAction*> actions() const {
+    return QList<QAction*>() << actionMergePointSets;
+  }
+  
+  bool applicable(QAction*) const {
+    if (scene->selectionIndices().size() < 2)
+      return false;
+    
+    Q_FOREACH(int index, scene->selectionIndices())
+      {
+        if ( qobject_cast<Scene_points_with_normal_item*>(scene->item(index)) )
+          return true;
+      }
+    return false;
+  }
+
+public Q_SLOTS:
+  void on_actionMergePointSets_triggered();
+private :
+  Scene_interface *scene;
+}; // end Polyhedron_demo_merge_point_sets_plugin
+
+void Polyhedron_demo_merge_point_sets_plugin::on_actionMergePointSets_triggered()
+{
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  CGAL::Three::Scene_interface::Item_id mainSelectionIndex
+    = scene->mainSelectionIndex();
+  Scene_points_with_normal_item* mainSelectionItem
+    = qobject_cast<Scene_points_with_normal_item*>(scene->item(mainSelectionIndex));
+
+  QList<int> indices_to_remove;
+  Q_FOREACH(int index, scene->selectionIndices())
+    {
+      if (index == mainSelectionIndex)
+        continue;
+
+      Scene_points_with_normal_item* item =
+        qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
+      if(item)
+        {
+          indices_to_remove.push_front(index);
+          std::copy (item->point_set()->begin(), item->point_set()->end(),
+                     std::back_inserter (*(mainSelectionItem->point_set())));
+          mainSelectionItem->setName(tr("%1 + %2").arg(mainSelectionItem->name()).arg(item->name()));
+        }
+    }
+  
+
+  mainSelectionItem->invalidateOpenGLBuffers();
+  scene->itemChanged(mainSelectionIndex);
+
+  //remove the other items
+  Q_FOREACH(int index, indices_to_remove)
+  {
+    scene->erase(index);
+  }
+  QApplication::restoreOverrideCursor();
+}
+
+
+#include "Merge_point_sets_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_average_spacing_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_average_spacing_plugin.cpp
new file mode 100644
index 0000000..08783fd
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_average_spacing_plugin.cpp
@@ -0,0 +1,119 @@
+#include "config.h"
+#include "Scene_points_with_normal_item.h"
+#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+
+#include <CGAL/compute_average_spacing.h>
+#include <CGAL/Timer.h>
+#include <CGAL/Memory_sizer.h>
+
+#include <QObject>
+#include <QAction>
+#include <QMainWindow>
+#include <QApplication>
+#include <QtPlugin>
+#include <QInputDialog>
+#include <QMessageBox>
+// Concurrency
+#ifdef CGAL_LINKED_WITH_TBB
+typedef CGAL::Parallel_tag Concurrency_tag;
+#else
+typedef CGAL::Sequential_tag Concurrency_tag;
+#endif
+
+using namespace CGAL::Three;
+class Polyhedron_demo_point_set_average_spacing_plugin :
+  public QObject,
+  public Polyhedron_demo_plugin_helper
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+private:
+  QAction* actionAverageSpacing;
+  
+public:
+  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*) {
+    scene = scene_interface;
+    mw = mainWindow;
+    actionAverageSpacing = new QAction(tr("Average Spacing"), mainWindow);
+    actionAverageSpacing->setProperty("subMenuName","Point Set Processing");
+    actionAverageSpacing->setObjectName("actionAverageSpacing");
+    autoConnectActions();
+  }
+
+  QList<QAction*> actions() const {
+    return QList<QAction*>() << actionAverageSpacing;
+  }
+  
+  //! Applicable if the currently selected item is a
+  //! points_with_normal_item.
+  bool applicable(QAction*) const {
+    return qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
+  }
+
+public Q_SLOTS:
+  void on_actionAverageSpacing_triggered();
+}; // end Polyhedron_demo_point_set_average_spacing_plugin
+
+void Polyhedron_demo_point_set_average_spacing_plugin::on_actionAverageSpacing_triggered()
+{
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+
+  Scene_points_with_normal_item* item =
+    qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
+
+  if(item)
+  {
+    // Gets point set
+    Point_set* points = item->point_set();
+    if(points == NULL)
+        return;
+
+    // Gets options
+    bool ok;
+
+    const int nb_neighbors =
+      QInputDialog::getInt((QWidget*)mw,
+                               tr("Average Spacing"), // dialog title
+                               tr("Number of neighbors:"), // field label
+                               6, // default value = 1 ring
+                               6, // min
+                               1000, // max
+                               1, // step
+                               &ok);
+    if(!ok) 
+      return;
+
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+
+    CGAL::Timer task_timer; task_timer.start();
+    std::cerr << "Average spacing (k=" << nb_neighbors <<")...\n";
+
+    // Computes average spacing
+    double average_spacing = CGAL::compute_average_spacing<Concurrency_tag>(
+                                      points->begin_or_selection_begin(), points->end(),
+                                      nb_neighbors);
+
+    // Print result
+    Kernel::Sphere_3 bsphere = points->bounding_sphere();
+    double radius = std::sqrt(bsphere.squared_radius());
+    std::size_t memory = CGAL::Memory_sizer().virtual_size();
+    std::cerr << "Average spacing = " << average_spacing 
+                                      << " = " << average_spacing/radius << " * point set radius (" 
+                                      << task_timer.time() << " seconds, "
+                                      << (memory>>20) << " Mb allocated)"
+                                      << std::endl;
+    QApplication::restoreOverrideCursor();
+
+    QMessageBox::information(NULL,
+                             tr("Average Spacing"),
+                             tr("Average Spacing = %1 = %2 * point set radius")
+                             .arg(average_spacing)
+                             .arg(average_spacing/radius));
+  }
+}
+
+
+#include "Point_set_average_spacing_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_bilateral_smoothing_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_bilateral_smoothing_plugin.cpp
new file mode 100644
index 0000000..413939c
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_bilateral_smoothing_plugin.cpp
@@ -0,0 +1,138 @@
+#include "config.h"
+#include "Scene_points_with_normal_item.h"
+#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+
+#include <CGAL/bilateral_smooth_point_set.h>
+#include <CGAL/Timer.h>
+#include <CGAL/Memory_sizer.h>
+
+#include <QObject>
+#include <QAction>
+#include <QMainWindow>
+#include <QApplication>
+#include <QtPlugin>
+#include <QMessageBox>
+
+#include "ui_Point_set_bilateral_smoothing_plugin.h"
+
+// Concurrency
+#ifdef CGAL_LINKED_WITH_TBB
+typedef CGAL::Parallel_tag Concurrency_tag;
+#else
+typedef CGAL::Sequential_tag Concurrency_tag;
+#endif
+
+
+using namespace CGAL::Three;
+class Polyhedron_demo_point_set_bilateral_smoothing_plugin :
+  public QObject,
+  public Polyhedron_demo_plugin_helper
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+  
+  QAction* actionBilateralSmoothing;
+
+public:
+  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*) {
+    scene = scene_interface;
+    mw = mainWindow;
+    actionBilateralSmoothing = new QAction(tr("Bilateral Smoothing"), mainWindow);
+    actionBilateralSmoothing->setProperty("subMenuName","Point Set Processing");
+    actionBilateralSmoothing->setObjectName("actionBilateralSmoothing");
+    autoConnectActions();
+  }
+
+  bool applicable(QAction*) const {
+    return qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
+  }
+
+  QList<QAction*> actions() const {
+    return QList<QAction*>() << actionBilateralSmoothing;
+  }
+
+public Q_SLOTS:
+  void on_actionBilateralSmoothing_triggered();
+
+}; // end Polyhedron_demo_point_set_bilateral_smoothing_plugin
+
+class Point_set_demo_point_set_bilateral_smoothing_dialog : public QDialog, private Ui::PointSetBilateralSmoothingDialog
+{
+  Q_OBJECT
+  public:
+    Point_set_demo_point_set_bilateral_smoothing_dialog(QWidget * /*parent*/ = 0)
+    {
+      setupUi(this);
+    }
+
+    unsigned int iterations() const { return m_iterations->value(); }
+    unsigned int neighborhood_size () const { return m_neighborhoodSize->value(); }
+    unsigned int sharpness_angle () const { return m_sharpnessAngle->value(); }
+};
+
+void Polyhedron_demo_point_set_bilateral_smoothing_plugin::on_actionBilateralSmoothing_triggered()
+{
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+
+  Scene_points_with_normal_item* item =
+    qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
+
+  if(item)
+  {
+    if(!item->has_normals())
+    {
+      QMessageBox::warning(mw,
+                           tr("Cannot smooth"),
+                           tr("%1 does not have normals.")
+                           .arg(item->name()));
+      return;
+    }
+    // Gets point set
+    Point_set* points = item->point_set();
+    if(points == NULL)
+        return;
+
+    // Gets options
+    Point_set_demo_point_set_bilateral_smoothing_dialog dialog;
+    if(!dialog.exec())
+      return;
+
+    std::cerr << "Bilateral smoothing using "
+	      << dialog.iterations () << " iteration(s), neighborhood size of "
+	      << dialog.neighborhood_size () << " and sharpness angle of "
+	      << dialog.sharpness_angle () << "... ";
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+
+    CGAL::Timer task_timer; task_timer.start();
+
+    for (unsigned int i = 0; i < dialog.iterations (); ++i)
+      {
+	/* double error = */
+	CGAL::bilateral_smooth_point_set<Concurrency_tag>
+	  (points->begin_or_selection_begin(),
+	   points->end(),
+	   CGAL::make_identity_property_map(Point_set::value_type()),
+	   CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()),
+	   dialog.neighborhood_size (),
+	   dialog.sharpness_angle ());
+      }
+
+
+    
+    std::size_t memory = CGAL::Memory_sizer().virtual_size();
+    std::cerr << task_timer.time() << " seconds, "
+	      << (memory>>20) << " Mb allocated)"
+	      << std::endl;
+
+    // Updates scene
+    item->invalidateOpenGLBuffers();
+    scene->itemChanged(index);
+
+    QApplication::restoreOverrideCursor();
+
+  }
+}
+
+#include "Point_set_bilateral_smoothing_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_bilateral_smoothing_plugin.ui b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_bilateral_smoothing_plugin.ui
new file mode 100644
index 0000000..1159d7d
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_bilateral_smoothing_plugin.ui
@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>PointSetBilateralSmoothingDialog</class>
+ <widget class="QDialog" name="PointSetBilateralSmoothingDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>255</width>
+    <height>137</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Bilateral Smoothing</string>
+  </property>
+  <layout class="QGridLayout" columnstretch="0,1">
+   <item row="0" column="0">
+    <widget class="QLabel" name="label_4">
+     <property name="text">
+      <string>Iterations</string>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="1">
+    <widget class="QSpinBox" name="m_iterations">
+     <property name="minimum">
+      <number>1</number>
+     </property>
+     <property name="maximum">
+      <number>2147483647</number>
+     </property>
+     <property name="value">
+      <number>1</number>
+     </property>
+    </widget>
+   </item>
+   <item row="4" column="0" colspan="2">
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="1">
+    <widget class="QSpinBox" name="m_neighborhoodSize">
+     <property name="suffix">
+      <string/>
+     </property>
+     <property name="prefix">
+      <string/>
+     </property>
+     <property name="minimum">
+      <number>1</number>
+     </property>
+     <property name="maximum">
+      <number>2147483647</number>
+     </property>
+     <property name="value">
+      <number>24</number>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="0">
+    <widget class="QLabel" name="label_5">
+     <property name="text">
+      <string>Neighborhood size</string>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="0">
+    <widget class="QLabel" name="label">
+     <property name="text">
+      <string>Sharpness Angle</string>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="1">
+    <widget class="QSpinBox" name="m_sharpnessAngle">
+     <property name="suffix">
+      <string>°</string>
+     </property>
+     <property name="maximum">
+      <number>90</number>
+     </property>
+     <property name="value">
+      <number>25</number>
+     </property>
+    </widget>
+   </item>
+   <item row="3" column="0">
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>PointSetBilateralSmoothingDialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>248</x>
+     <y>254</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>PointSetBilateralSmoothingDialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>316</x>
+     <y>260</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_interference_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_interference_plugin.cpp
new file mode 100644
index 0000000..eeb97b8
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_interference_plugin.cpp
@@ -0,0 +1,109 @@
+//local includes
+#include "Scene_points_with_normal_item.h"
+//CGAL includes
+#include <CGAL/compute_average_spacing.h>
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+#include <CGAL/point_generators_3.h>
+#include <CGAL/function_objects.h>
+#include <CGAL/Three/Scene_interface.h>
+
+//Qt includes
+#include <QList>
+#include <QAction>
+#include <QApplication>
+#include <QWidget>
+#include <QInputDialog>
+#include <QMainWindow>
+
+using namespace CGAL::Three;
+#ifdef CGAL_LINKED_WITH_TBB
+typedef CGAL::Parallel_tag Concurrency_tag;
+#else
+typedef CGAL::Sequential_tag Concurrency_tag;
+#endif
+
+class  Point_set_interference_plugin:
+    public QObject,
+    public Polyhedron_demo_plugin_interface
+{
+
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+public:
+  bool applicable(QAction *) const
+  {
+    return qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
+  }
+
+  QList<QAction*> actions() const
+  {
+    return actions_;
+  }
+
+  void init(QMainWindow *mainWindow, Scene_interface * si, Messages_interface *)
+  {
+    scene = si;
+    mw = mainWindow;
+
+    QAction *actionAddNoise = new QAction(QString("Add Noise"), mw);
+    if(actionAddNoise)
+    {
+      actionAddNoise->setProperty("subMenuName", "Point Set Processing");
+      connect(actionAddNoise, SIGNAL(triggered()),
+              this, SLOT(on_actionAddNoise_triggered()));
+      actions_ << actionAddNoise;
+    }
+  }
+private Q_SLOTS:
+  void on_actionAddNoise_triggered()
+  {
+    Scene_points_with_normal_item* item = qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
+    if(!item)
+      return;
+    bool ok = false;
+    Qt::WindowFlags flags = Qt::Dialog;
+    flags |= Qt::CustomizeWindowHint;
+    flags |= Qt::WindowCloseButtonHint;
+
+    Point_set* points = item->point_set();
+    if(points == NULL)
+      return;
+
+    double average_spacing = CGAL::compute_average_spacing<Concurrency_tag>(
+                                    points->begin_or_selection_begin(), points->end(),
+                                    6 /* knn = 1 ring */);
+
+    const double max_dist =
+        QInputDialog::getDouble((QWidget*)mw,
+                                tr("Add Noise"),
+                                tr("Please choose the maximum radius in which the points will be moved. (default = average spacing)"),
+                                average_spacing,
+                                0,
+                                100*average_spacing,
+                                4,
+                                &ok,
+                                flags);
+    if(!ok) return;
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+
+    CGAL::Random_points_in_sphere_3<Kernel::Point_3> generator(max_dist);
+
+    for(Point_set::iterator psit = points->begin_or_selection_begin(); psit != points->end(); ++psit)
+    {
+      *psit = *psit+(*generator - CGAL::ORIGIN);
+      ++generator;
+    }
+    item->invalidateOpenGLBuffers();
+    item->itemChanged();
+    QApplication::restoreOverrideCursor();
+  }
+private:
+  Scene_interface *scene;
+  QList<QAction*> actions_;
+  QMainWindow *mw;
+
+};
+
+#include "Point_set_interference_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.cpp
new file mode 100644
index 0000000..624e13a
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.cpp
@@ -0,0 +1,289 @@
+#include "config.h"
+#include "Scene_points_with_normal_item.h"
+#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+
+#include <CGAL/pca_estimate_normals.h>
+#include <CGAL/jet_estimate_normals.h>
+#include <CGAL/vcm_estimate_normals.h>
+#include <CGAL/mst_orient_normals.h>
+#include <CGAL/Timer.h>
+#include <CGAL/Memory_sizer.h>
+
+#include <QObject>
+#include <QAction>
+#include <QMainWindow>
+#include <QApplication>
+#include <QtPlugin>
+#include <QInputDialog>
+#include <QMessageBox>
+
+#include "ui_Point_set_normal_estimation_plugin.h"
+
+#if BOOST_VERSION == 105700
+#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS)
+#  define CGAL_DISABLE_NORMAL_ESTIMATION_PLUGIN 1
+#endif
+#endif
+
+// Concurrency
+#ifdef CGAL_LINKED_WITH_TBB
+typedef CGAL::Parallel_tag Concurrency_tag;
+#else
+typedef CGAL::Sequential_tag Concurrency_tag;
+#endif
+using namespace CGAL::Three;
+
+class Polyhedron_demo_point_set_normal_estimation_plugin :
+  public QObject,
+  public Polyhedron_demo_plugin_helper
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+  QAction* actionNormalEstimation;
+  QAction* actionNormalInversion;
+
+public:
+  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*) {
+
+    scene = scene_interface;
+    actionNormalEstimation = new QAction(tr("Normal Estimation"), mainWindow);
+    actionNormalEstimation->setObjectName("actionNormalEstimation");
+    actionNormalEstimation->setProperty("subMenuName","Point Set Processing");
+
+    actionNormalInversion = new QAction(tr("Inverse Normal Orientations"), mainWindow);
+    actionNormalInversion->setObjectName("actionNormalInversion");
+    actionNormalInversion->setProperty("subMenuName","Point Set Processing");
+    autoConnectActions();
+  }
+
+  QList<QAction*> actions() const {
+    return QList<QAction*>() << actionNormalEstimation << actionNormalInversion;
+  }
+
+  bool applicable(QAction* action) const {
+    Scene_points_with_normal_item* item = qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
+
+    if (action==actionNormalEstimation)
+#if CGAL_DISABLE_NORMAL_ESTIMATION_PLUGIN
+    return false;
+#else
+    return item;
+#endif
+    else
+      return item && item->has_normals();
+  }
+
+public Q_SLOTS:
+  void on_actionNormalEstimation_triggered();
+  void on_actionNormalInversion_triggered();
+
+}; // end PS_demo_smoothing_plugin
+
+class Point_set_demo_normal_estimation_dialog : public QDialog, private Ui::NormalEstimationDialog
+{
+  Q_OBJECT
+  public:
+    Point_set_demo_normal_estimation_dialog(QWidget* /*parent*/ = 0)
+    {
+      setupUi(this);
+    }
+
+  int pca_neighbors() const { return m_pca_neighbors->value(); }
+  int jet_neighbors() const { return m_jet_neighbors->value(); }
+  unsigned int convolution_neighbors() const { return m_convolution_neighbors->value(); }
+  double convolution_radius() const { return m_convolution_radius->value(); }
+  double offset_radius() const { return m_offset_radius->value(); }
+  int orient_neighbors() const { return m_orient_neighbors->value(); }
+
+  unsigned int method () const
+  {
+    if (buttonPCA->isChecked ())       return 0;
+    if (buttonJet->isChecked ())       return 1;
+    if (buttonVCM->isChecked ())       return 2;
+    return -1;
+  }
+  bool orient () const
+  {
+    return buttonOrient->isChecked();
+  }
+  bool use_convolution_radius () const
+  {
+    return buttonRadius->isChecked();
+  }
+};
+
+
+void Polyhedron_demo_point_set_normal_estimation_plugin::on_actionNormalInversion_triggered()
+{
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+
+  Scene_points_with_normal_item* item =
+    qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
+
+  if(item)
+  {
+    // Gets point set
+    Point_set* points = item->point_set();
+    if(points == NULL)
+        return;
+
+    for(Point_set::iterator it = points->begin_or_selection_begin(); it != points->end(); ++it){
+      it->normal() = -1 * it->normal();
+    }
+    item->invalidateOpenGLBuffers();
+    scene->itemChanged(item);
+  }
+}
+
+void Polyhedron_demo_point_set_normal_estimation_plugin::on_actionNormalEstimation_triggered()
+{
+#if !CGAL_DISABLE_NORMAL_ESTIMATION_PLUGIN
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+
+  Scene_points_with_normal_item* item =
+    qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
+
+  if(item)
+  {
+    // Gets point set
+    Point_set* points = item->point_set();
+    if(points == NULL)
+        return;
+
+    // Gets options
+    Point_set_demo_normal_estimation_dialog dialog;
+    if(!dialog.exec())
+      return;
+      
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+
+    // First point to delete
+    Point_set::iterator first_unoriented_point = points->end();
+
+    //***************************************
+    // normal estimation
+    //***************************************
+    if (dialog.method() == 0) // PCA
+    {
+      CGAL::Timer task_timer; task_timer.start();
+      std::cerr << "Estimates normal direction by PCA (k=" << dialog.pca_neighbors() <<")...\n";
+
+      // Estimates normals direction.
+      CGAL::pca_estimate_normals<Concurrency_tag>(points->begin_or_selection_begin(), points->end(),
+                                CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()),
+                                dialog.pca_neighbors());
+
+      std::size_t memory = CGAL::Memory_sizer().virtual_size();
+      std::cerr << "Estimates normal direction: " << task_timer.time() << " seconds, "
+                                                  << (memory>>20) << " Mb allocated"
+                                                  << std::endl;
+    }
+    else if (dialog.method() == 1) // Jet
+    {
+      CGAL::Timer task_timer; task_timer.start();
+      std::cerr << "Estimates normal direction by Jet Fitting (k=" << dialog.jet_neighbors() <<")...\n";
+
+      // Estimates normals direction.
+      CGAL::jet_estimate_normals<Concurrency_tag>(points->begin_or_selection_begin(), points->end(),
+                                CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()),
+                                dialog.jet_neighbors());
+
+      std::size_t memory = CGAL::Memory_sizer().virtual_size();
+      std::cerr << "Estimates normal direction: " << task_timer.time() << " seconds, "
+                                                  << (memory>>20) << " Mb allocated"
+                                                  << std::endl;
+    }
+    else if (dialog.method() == 2) // VCM
+    {
+      CGAL::Timer task_timer; task_timer.start();
+      // Estimates normals direction.
+      if (dialog.use_convolution_radius())
+        {
+          std::cerr << "Estimates Normals Direction using VCM (R="
+                    << dialog.offset_radius() << " and r=" << dialog.convolution_radius() << ")...\n";
+
+          CGAL::vcm_estimate_normals(points->begin_or_selection_begin(), points->end(),
+                                     CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()),
+                                     dialog.offset_radius(), dialog.convolution_radius());
+        }
+      else
+        {
+          std::cerr << "Estimates Normals Direction using VCM (R="
+                    << dialog.offset_radius() << " and k=" << dialog.convolution_neighbors() << ")...\n";
+
+          CGAL::vcm_estimate_normals(points->begin_or_selection_begin(), points->end(),
+                                     CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()),
+                                     dialog.offset_radius(), dialog.convolution_neighbors());
+        }
+
+      std::size_t memory = CGAL::Memory_sizer().virtual_size();
+      std::cerr << "Estimates normal direction: " << task_timer.time() << " seconds, "
+                                                  << (memory>>20) << " Mb allocated"
+                                                  << std::endl;
+    }
+
+    item->set_has_normals(true);
+    item->setRenderingMode(PointsPlusNormals);
+
+    //***************************************
+    // normal orientation
+    //***************************************
+
+    if (dialog.orient ())
+      {
+        CGAL::Timer task_timer; task_timer.start();
+        std::cerr << "Orient normals with a Minimum Spanning Tree (k=" << dialog.orient_neighbors() << ")...\n";
+
+        // Tries to orient normals
+        first_unoriented_point =
+          CGAL::mst_orient_normals(points->begin_or_selection_begin(), points->end(),
+                                   CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()),
+                                   dialog.orient_neighbors());
+
+        //indicates that the point set has normals
+        if (first_unoriented_point != points->begin_or_selection_begin()){
+          item->set_has_normals(true);
+          item->setRenderingMode(PointsPlusNormals);
+        }
+
+        std::size_t nb_unoriented_normals = std::distance(first_unoriented_point, points->end());
+        std::size_t memory = CGAL::Memory_sizer().virtual_size();
+        std::cerr << "Orient normals: " << nb_unoriented_normals << " point(s) with an unoriented normal are selected ("
+                  << task_timer.time() << " seconds, "
+                  << (memory>>20) << " Mb allocated)"
+                  << std::endl;
+
+        // Selects points with an unoriented normal
+        points->set_first_selected (first_unoriented_point);
+
+        // Updates scene
+        item->invalidateOpenGLBuffers();
+        scene->itemChanged(index);
+
+        QApplication::restoreOverrideCursor();
+
+        // Warns user
+        if (nb_unoriented_normals > 0)
+          {
+            QMessageBox::information(NULL,
+                                     tr("Points with an unoriented normal"),
+                                     tr("%1 point(s) with an unoriented normal are selected.\nPlease orient them or remove them before running Poisson reconstruction.")
+                                     .arg(nb_unoriented_normals));
+          }
+      }
+    else
+      {
+        // Updates scene
+        item->invalidateOpenGLBuffers();
+        scene->itemChanged(index);
+
+        QApplication::restoreOverrideCursor();
+      }
+  }
+#endif // !CGAL_DISABLE_NORMAL_ESTIMATION_PLUGIN
+}
+
+#include "Point_set_normal_estimation_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.ui b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.ui
new file mode 100644
index 0000000..9d0d992
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.ui
@@ -0,0 +1,415 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>NormalEstimationDialog</class>
+ <widget class="QDialog" name="NormalEstimationDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>473</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Normal Estimation</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <widget class="QRadioButton" name="buttonPCA">
+     <property name="text">
+      <string>PCA Estimate Normals</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QFrame" name="frame">
+     <property name="enabled">
+      <bool>false</bool>
+     </property>
+     <property name="frameShape">
+      <enum>QFrame::StyledPanel</enum>
+     </property>
+     <property name="frameShadow">
+      <enum>QFrame::Raised</enum>
+     </property>
+     <layout class="QFormLayout" name="formLayout_2">
+      <property name="fieldGrowthPolicy">
+       <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
+      </property>
+      <item row="0" column="0">
+       <widget class="QLabel" name="supportSizeLabel">
+        <property name="text">
+         <string>Support Size</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <widget class="QSpinBox" name="m_pca_neighbors">
+        <property name="suffix">
+         <string> Nearest Neighbors</string>
+        </property>
+        <property name="minimum">
+         <number>3</number>
+        </property>
+        <property name="maximum">
+         <number>10000000</number>
+        </property>
+        <property name="value">
+         <number>6</number>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QRadioButton" name="buttonJet">
+     <property name="text">
+      <string>Jet Estimate Normals</string>
+     </property>
+     <property name="checked">
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QFrame" name="frame_2">
+     <property name="frameShape">
+      <enum>QFrame::StyledPanel</enum>
+     </property>
+     <property name="frameShadow">
+      <enum>QFrame::Raised</enum>
+     </property>
+     <layout class="QFormLayout" name="formLayout_3">
+      <property name="fieldGrowthPolicy">
+       <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
+      </property>
+      <item row="0" column="0">
+       <widget class="QLabel" name="supportSizeLabel_2">
+        <property name="text">
+         <string>Support Size</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <widget class="QSpinBox" name="m_jet_neighbors">
+        <property name="suffix">
+         <string> Nearest Neighbors</string>
+        </property>
+        <property name="minimum">
+         <number>3</number>
+        </property>
+        <property name="maximum">
+         <number>100000000</number>
+        </property>
+        <property name="value">
+         <number>12</number>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QRadioButton" name="buttonVCM">
+     <property name="text">
+      <string>VCM Estimate Normals</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QFrame" name="frame_3">
+     <property name="enabled">
+      <bool>false</bool>
+     </property>
+     <property name="frameShape">
+      <enum>QFrame::StyledPanel</enum>
+     </property>
+     <property name="frameShadow">
+      <enum>QFrame::Raised</enum>
+     </property>
+     <layout class="QFormLayout" name="formLayout_4">
+      <property name="fieldGrowthPolicy">
+       <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
+      </property>
+      <item row="0" column="0">
+       <widget class="QLabel" name="offsetRadiusLabel">
+        <property name="text">
+         <string>Offset Radius</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <widget class="QDoubleSpinBox" name="m_offset_radius">
+        <property name="minimum">
+         <double>0.010000000000000</double>
+        </property>
+        <property name="singleStep">
+         <double>0.010000000000000</double>
+        </property>
+        <property name="value">
+         <double>0.100000000000000</double>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="1">
+       <widget class="QDoubleSpinBox" name="m_convolution_radius"/>
+      </item>
+      <item row="1" column="0">
+       <widget class="QRadioButton" name="buttonRadius">
+        <property name="text">
+         <string>Convolution Radius</string>
+        </property>
+        <property name="checked">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="0">
+       <widget class="QRadioButton" name="buttonNeighbors">
+        <property name="text">
+         <string>Convolution Neighbors</string>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="1">
+       <widget class="QSpinBox" name="m_convolution_neighbors">
+        <property name="enabled">
+         <bool>false</bool>
+        </property>
+        <property name="maximum">
+         <number>100000000</number>
+        </property>
+        <property name="value">
+         <number>40</number>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item>
+    <widget class="Line" name="line">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <spacer name="verticalSpacer_2">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item>
+    <widget class="QCheckBox" name="buttonOrient">
+     <property name="text">
+      <string>Orient Estimated Normals</string>
+     </property>
+     <property name="checked">
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QFrame" name="frame_4">
+     <property name="frameShape">
+      <enum>QFrame::StyledPanel</enum>
+     </property>
+     <property name="frameShadow">
+      <enum>QFrame::Raised</enum>
+     </property>
+     <layout class="QFormLayout" name="formLayout_5">
+      <property name="fieldGrowthPolicy">
+       <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
+      </property>
+      <item row="0" column="0">
+       <widget class="QLabel" name="neighborhoodSizeLabel">
+        <property name="text">
+         <string>Neighborhood Size</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <widget class="QSpinBox" name="m_orient_neighbors">
+        <property name="suffix">
+         <string> Nearest Neighbors</string>
+        </property>
+        <property name="minimum">
+         <number>6</number>
+        </property>
+        <property name="maximum">
+         <number>100000000</number>
+        </property>
+        <property name="value">
+         <number>18</number>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonJet</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>frame_2</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>199</x>
+     <y>96</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>199</x>
+     <y>135</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonPCA</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>frame</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>199</x>
+     <y>18</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>199</x>
+     <y>57</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonVCM</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>frame_3</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>199</x>
+     <y>174</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>199</x>
+     <y>245</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonOrient</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>frame_4</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>199</x>
+     <y>316</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>199</x>
+     <y>355</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonRadius</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>m_convolution_radius</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>90</x>
+     <y>242</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>285</x>
+     <y>245</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonNeighbors</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>m_convolution_neighbors</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>101</x>
+     <y>274</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>285</x>
+     <y>277</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>NormalEstimationDialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>199</x>
+     <y>428</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>199</x>
+     <y>225</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>NormalEstimationDialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>199</x>
+     <y>428</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>199</x>
+     <y>225</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_outliers_removal_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_outliers_removal_plugin.cpp
new file mode 100644
index 0000000..723fcc3
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_outliers_removal_plugin.cpp
@@ -0,0 +1,117 @@
+#include "config.h"
+#include "Scene_points_with_normal_item.h"
+#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+
+#include <CGAL/remove_outliers.h>
+#include <CGAL/Timer.h>
+#include <CGAL/Memory_sizer.h>
+
+#include <QObject>
+#include <QAction>
+#include <QMainWindow>
+#include <QApplication>
+#include <QtPlugin>
+#include <QInputDialog>
+#include <QMessageBox>
+
+#include "ui_Point_set_outliers_removal_plugin.h"
+using namespace CGAL::Three;
+class Polyhedron_demo_point_set_outliers_removal_plugin :
+  public QObject,
+  public Polyhedron_demo_plugin_helper
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+private:
+  QAction* actionOutlierRemoval;
+
+public:
+  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*) {
+    scene = scene_interface;
+    actionOutlierRemoval = new QAction(tr("Outliers Selection"), mainWindow);
+    actionOutlierRemoval->setProperty("subMenuName","Point Set Processing");
+    actionOutlierRemoval->setObjectName("actionOutlierRemoval");
+    autoConnectActions();
+  }
+  
+  //! Applicate for Point_sets with normals.
+  bool applicable(QAction*) const {
+    return qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
+  }
+
+  QList<QAction*> actions() const {
+    return QList<QAction*>() << actionOutlierRemoval;
+  }
+
+public Q_SLOTS:
+  void on_actionOutlierRemoval_triggered();
+
+}; // end Polyhedron_demo_point_set_outliers_removal_plugin
+
+class Point_set_demo_outlier_removal_dialog : public QDialog, private Ui::OutlierRemovalDialog
+{
+  Q_OBJECT
+  public:
+    Point_set_demo_outlier_removal_dialog(QWidget * /*parent*/ = 0)
+    {
+      setupUi(this);
+    }
+
+    double percentage() const { return m_inputPercentage->value(); }
+    int nbNeighbors() const { return m_inputNbNeighbors->value(); }
+};
+
+void Polyhedron_demo_point_set_outliers_removal_plugin::on_actionOutlierRemoval_triggered()
+{
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+
+  Scene_points_with_normal_item* item =
+    qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
+
+  if(item)
+  {
+    // Gets point set
+    Point_set* points = item->point_set();
+    if(points == NULL)
+        return;
+
+    // Gets options
+    Point_set_demo_outlier_removal_dialog dialog;
+    if(!dialog.exec())
+      return;
+    const double removed_percentage = dialog.percentage(); // percentage of points to remove
+    const int nb_neighbors = dialog.nbNeighbors();
+
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+
+    CGAL::Timer task_timer; task_timer.start();
+    std::cerr << "Select outliers (" << removed_percentage <<"%)...\n";
+
+    // Computes outliers
+    Point_set::iterator first_point_to_remove =
+      CGAL::remove_outliers(points->begin(), points->end(),
+                            nb_neighbors,
+                            removed_percentage);
+
+    std::size_t nb_points_to_remove = std::distance(first_point_to_remove, points->end());
+    std::size_t memory = CGAL::Memory_sizer().virtual_size();
+    std::cerr << "Simplification: " << nb_points_to_remove << " point(s) are selected ("
+                                    << task_timer.time() << " seconds, "
+                                    << (memory>>20) << " Mb allocated)"
+                                    << std::endl;
+
+    // Selects points to delete
+    points->set_first_selected (first_point_to_remove);
+
+    // Updates scene
+    item->invalidateOpenGLBuffers();
+    scene->itemChanged(index);
+
+    QApplication::restoreOverrideCursor();
+  }
+}
+
+#include "Point_set_outliers_removal_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_outliers_removal_plugin.ui b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_outliers_removal_plugin.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_outliers_removal_plugin.ui
rename to 3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_outliers_removal_plugin.ui
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_selection_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_selection_plugin.cpp
new file mode 100644
index 0000000..cbc6949
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_selection_plugin.cpp
@@ -0,0 +1,513 @@
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+#include <CGAL/Bbox_2.h>
+#include <CGAL/Polygon_2.h>
+#include <QtCore/qglobal.h>
+#include <QGLViewer/manipulatedCameraFrame.h>
+#include "opengl_tools.h"
+
+#include "Messages_interface.h"
+#include "Scene_points_with_normal_item.h"
+#include "Scene_polylines_item.h"
+
+#include <CGAL/Three/Scene_interface.h>
+#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
+#include "ui_Point_set_selection_widget.h"
+#include "Point_set_3.h"
+
+#include <QAction>
+#include <QMainWindow>
+#include <QApplication>
+
+#include <QEvent>
+#include <QKeyEvent>
+#include <QMouseEvent>
+
+#include <map>
+#include <fstream>
+
+
+// Class for visualizing selection 
+// provides mouse selection functionality
+class Q_DECL_EXPORT Scene_point_set_selection_visualizer : public CGAL::Three::Scene_item
+{
+  Q_OBJECT
+
+ private:
+  typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
+  typedef K::Point_2 Point_2;
+  typedef K::Point_3 Point_3;
+  typedef CGAL::Polygon_2<K> Polygon_2;
+  
+  bool rectangle;
+  std::vector<Point_2> contour_2d;
+  Scene_polylines_item* polyline;
+  Bbox point_set_bbox;
+  CGAL::Bbox_2 domain_rectangle;
+  Polygon_2 domain_freeform;
+  
+public:
+
+  Scene_point_set_selection_visualizer(bool rectangle, const Bbox& point_set_bbox)
+    : rectangle (rectangle), point_set_bbox (point_set_bbox)
+  {
+    polyline = new Scene_polylines_item();
+    polyline->setRenderingMode (Wireframe);
+    polyline->setVisible (true);
+    polyline->polylines.push_back (Scene_polylines_item::Polyline());
+  }
+  ~Scene_point_set_selection_visualizer() {
+  }
+  bool isFinite() const { return true; }
+  bool isEmpty() const { return poly().empty(); }
+  void compute_bbox() const {
+    _bbox = point_set_bbox;
+  }
+  Scene_point_set_selection_visualizer* clone() const {
+    return 0;
+  }
+  QString toolTip() const {
+    return tr("%1").arg(name());
+  }
+
+  bool supportsRenderingMode(RenderingMode m) const {
+    return (m == Wireframe);
+  }
+  
+  void drawEdges(CGAL::Three::Viewer_interface* viewer) const {
+    viewer->glLineWidth(3.f);
+    polyline->setRbgColor(0, 255, 0); 
+    polyline->drawEdges(viewer);
+  }
+
+  Scene_polylines_item::Polyline& poly() const
+  { return polyline->polylines.front(); }
+  
+  bool update_polyline () const
+  {
+    if (contour_2d.size() < 2 ||
+	(!(poly().empty()) && scene_point (contour_2d.back ()) == poly().back()))
+      return false;
+    
+    if (rectangle)
+      {
+	poly().clear();
+	
+	poly().push_back (scene_point (Point_2 (domain_rectangle.xmin(),
+						domain_rectangle.ymin())));
+	poly().push_back (scene_point (Point_2 (domain_rectangle.xmax(),
+						domain_rectangle.ymin())));
+	poly().push_back (scene_point (Point_2 (domain_rectangle.xmax(),
+						domain_rectangle.ymax())));
+	poly().push_back (scene_point (Point_2 (domain_rectangle.xmin(),
+						domain_rectangle.ymax())));
+	poly().push_back (scene_point (Point_2 (domain_rectangle.xmin(),
+						domain_rectangle.ymin())));
+
+      }
+    else
+      {
+	if (!(poly().empty()) && scene_point (contour_2d.back ()) == poly().back())
+	  return false;
+
+	poly().clear();
+
+	for (unsigned int i = 0; i < contour_2d.size (); ++ i)
+	  poly().push_back (scene_point (contour_2d[i]));
+      }
+    return true;
+  }
+
+  Point_3 scene_point (const Point_2& p) const
+  {
+    QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
+    qglviewer::Camera* camera = viewer->camera();
+    qglviewer::Vec vp (p.x(), p.y(), 0.1);
+    qglviewer::Vec vsp = camera->unprojectedCoordinatesOf (vp);
+    
+    return Point_3 (vsp.x, vsp.y, vsp.z);
+  }
+
+
+  
+  void sample_mouse_path()
+  {
+    QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
+    const QPoint& p = viewer->mapFromGlobal(QCursor::pos());
+    
+    if (rectangle && contour_2d.size () == 2)
+      {
+	contour_2d[1] = Point_2 (p.x (), p.y ());
+	domain_rectangle = CGAL::bbox_2 (contour_2d.begin (), contour_2d.end ());
+      }
+    else
+      contour_2d.push_back (Point_2 (p.x (), p.y ()));
+
+    if (update_polyline ())
+      {
+        polyline->invalidateOpenGLBuffers();
+	Q_EMIT itemChanged();
+      }
+  }
+
+  void apply_path()
+  {
+    update_polyline ();
+    domain_rectangle = CGAL::bbox_2 (contour_2d.begin (), contour_2d.end ());    
+    if (!rectangle)
+      domain_freeform = Polygon_2 (contour_2d.begin (), contour_2d.end ());
+  }
+
+  bool is_selected (qglviewer::Vec& p)
+  {
+    if (domain_rectangle.xmin () < p.x &&
+	p.x < domain_rectangle.xmax () &&
+	domain_rectangle.ymin () < p.y &&
+	p.y < domain_rectangle.ymax ())
+      {
+	if (rectangle)
+	  return true;
+	
+	if (domain_freeform.has_on_bounded_side (Point_2 (p.x, p.y)))
+	  return true;
+      }
+    return false;
+  }
+
+
+}; // end class Scene_point_set_selection_visualizer
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+using namespace CGAL::Three;
+class Polyhedron_demo_point_set_selection_plugin :
+  public QObject,
+  public Polyhedron_demo_plugin_helper
+{
+  Q_OBJECT
+    Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+    Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+public:
+  bool applicable(QAction*) const { 
+      return qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
+  }
+  void print_message(QString message) { messages->information(message); }
+  QList<QAction*> actions() const { return QList<QAction*>() << actionPointSetSelection; }
+
+  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface* m) {
+    mw = mainWindow;
+    scene = scene_interface;
+    messages = m;
+    actionPointSetSelection = new QAction(tr("Selection"), mw);
+    connect(actionPointSetSelection, SIGNAL(triggered()), this, SLOT(selection_action()));
+
+    dock_widget = new QDockWidget("Point Set Selection", mw);
+    dock_widget->setVisible(false);
+
+    ui_widget.setupUi(dock_widget);
+    addDockWidget(dock_widget);
+
+    connect(ui_widget.Selection_tool_combo_box, SIGNAL(currentIndexChanged(int)), 
+            this, SLOT(on_Selection_tool_combo_box_changed(int)));
+    connect(ui_widget.Selection_mode_combo_box, SIGNAL(currentIndexChanged(int)), 
+            this, SLOT(on_Selection_mode_combo_box_changed(int)));
+    connect(ui_widget.Select_all_button,  SIGNAL(clicked()), this, SLOT(on_Select_all_button_clicked()));
+    connect(ui_widget.Clear_button,  SIGNAL(clicked()), this, SLOT(on_Clear_button_clicked()));
+    connect(ui_widget.Invert_selection_button,  SIGNAL(clicked()), this, SLOT(on_Invert_selection_button_clicked()));
+    connect(ui_widget.Erase_selected_points_button,  SIGNAL(clicked()), this, SLOT(on_Erase_selected_points_button_clicked()));
+    connect(ui_widget.Create_point_set_item_button, SIGNAL(clicked()), this, SLOT(on_Create_point_set_item_button_clicked()));
+
+    rectangle = true;
+    selection_mode = 0;
+    visualizer = NULL;
+    shift_pressing = false;
+    
+    QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
+    viewer->installEventFilter(this);
+    mainWindow->installEventFilter(this);
+
+
+  }
+  virtual void closure()
+  {
+    dock_widget->hide();
+  }
+
+protected:
+
+  bool eventFilter(QObject *, QEvent *event) {
+    if (dock_widget->isHidden() || !(dock_widget->isActiveWindow()))
+      return false;
+    
+    Scene_points_with_normal_item* point_set_item
+      = qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
+    if(!point_set_item) {
+      return false; 
+    }
+    int item_id = scene->item_id (point_set_item);
+      
+    if(event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease)  {
+      QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
+      Qt::KeyboardModifiers modifiers = keyEvent->modifiers();
+
+      shift_pressing = modifiers.testFlag(Qt::ShiftModifier);
+    }
+
+    // mouse events
+    if(shift_pressing && event->type() == QEvent::MouseButtonPress)
+      {
+	QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
+	// Start selection
+	if (mouseEvent->button() == Qt::LeftButton && !visualizer)
+	  {
+	    QApplication::setOverrideCursor(Qt::CrossCursor);
+	    QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
+	    if (viewer->camera()->frame()->isSpinning())
+	      viewer->camera()->frame()->stopSpinning();
+	
+	    visualizer = new Scene_point_set_selection_visualizer(rectangle,
+								  point_set_item->bbox());
+	    visualizer->setName(tr("Point set selection visualizer"));
+	    visualizer->setRenderingMode (Wireframe);
+	    visualizer->setVisible (true);
+
+	    // Hack to prevent camera for "jumping" when creating new item
+	    scene->addItem(visualizer);
+	
+	    scene->setSelectedItem(item_id);
+	    visualizer->sample_mouse_path();
+	    return true;
+	  }
+	// Cancel selection
+	else if (mouseEvent->button() == Qt::RightButton && visualizer)
+	  {
+
+	    scene->erase( scene->item_id(visualizer) );
+	    scene->setSelectedItem(item_id);
+	    visualizer = NULL;
+	    QApplication::restoreOverrideCursor();
+	    return true;
+	  }
+
+      }
+    // End selection
+    else if (event->type() == QEvent::MouseButtonRelease && visualizer)
+      {
+	visualizer->apply_path();
+	select_points();
+	scene->erase( scene->item_id(visualizer) );
+	scene->setSelectedItem(item_id);
+	visualizer = NULL;
+	QApplication::restoreOverrideCursor();
+	return true;
+      }
+    // Update selection
+    else if (event->type() == QEvent::MouseMove && visualizer)
+      {
+	visualizer->sample_mouse_path();
+	return true;
+      }
+
+    return false;
+  }
+
+  void select_points()
+  {
+    Scene_points_with_normal_item* point_set_item = getSelectedItem<Scene_points_with_normal_item>();
+    if(!point_set_item)
+      {
+	print_message("Error: no point set selected!");
+	return; 
+      }
+
+    if (selection_mode == 0) // New selection
+      point_set_item->point_set()->unselect_all();
+    
+    QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
+    qglviewer::Camera* camera = viewer->camera();
+
+    std::vector<UI_point_3<Kernel> > unselected, selected;
+    
+    for(Point_set::iterator it = point_set_item->point_set()->begin ();
+	it != point_set_item->point_set()->end(); ++ it)
+      {
+	bool already_selected = point_set_item->point_set()->is_selected (it);
+	    
+	qglviewer::Vec vp (it->x (), it->y (), it->z ());
+	qglviewer::Vec vsp = camera->projectedCoordinatesOf (vp);
+	    
+	bool now_selected = visualizer->is_selected (vsp);
+
+	// NEW INTERSECTION
+	if (selection_mode == 0)
+	  {
+	    if (now_selected)
+	      selected.push_back (*it);
+	    else
+	      unselected.push_back (*it);
+	  }
+	// UNION
+	else if (selection_mode == 1)
+	  {
+	    if (already_selected || now_selected)
+	      selected.push_back (*it);
+	    else
+	      unselected.push_back (*it);
+	  }
+	// INTERSECTION
+	//  * Unselect point if it was selected and is not anymore
+	else if (selection_mode == 2)
+	  {
+	    if (already_selected && now_selected)
+	      selected.push_back (*it);
+	    else
+	      unselected.push_back (*it);
+	  }
+	// DIFFERENCE
+	//  * Unselect point if it was selected and is now selected
+	else if (selection_mode == 3)
+	  {
+	    if (already_selected && !now_selected)
+	      selected.push_back (*it);
+	    else
+	      unselected.push_back (*it);
+	  }
+
+      }
+
+    point_set_item->point_set()->clear();
+    
+    std::copy (unselected.begin (), unselected.end (),
+	       std::back_inserter (*(point_set_item->point_set())));
+    std::size_t size = unselected.size();
+
+    if (selected.empty ())
+      {
+	point_set_item->point_set()->unselect_all();
+      }
+    else
+      {
+	std::copy (selected.begin (), selected.end (),
+		   std::back_inserter (*(point_set_item->point_set())));
+	point_set_item->point_set()->set_first_selected
+	  (point_set_item->point_set()->begin() + size);
+      } 
+    point_set_item->invalidateOpenGLBuffers();
+  }
+
+  
+
+
+public Q_SLOTS:
+  void selection_action() { 
+    dock_widget->show();
+    dock_widget->raise();
+  }
+  
+  // Select all
+  void on_Select_all_button_clicked() {
+    Scene_points_with_normal_item* point_set_item = getSelectedItem<Scene_points_with_normal_item>();
+    if(!point_set_item)
+      {
+	print_message("Error: no point set selected!");
+	return; 
+      }
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    point_set_item->selectAll();
+    QApplication::restoreOverrideCursor();
+  }
+  
+  // Clear selection
+  void on_Clear_button_clicked() {
+    Scene_points_with_normal_item* point_set_item
+      = qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
+    if(!point_set_item) {
+      print_message("Error: no point set selected!");
+      return; 
+    }
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    point_set_item->resetSelection();
+    QApplication::restoreOverrideCursor();
+  }
+
+  void on_Erase_selected_points_button_clicked() {
+    Scene_points_with_normal_item* point_set_item
+      = qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
+    if(!point_set_item) {
+      print_message("Error: no point set selected!");
+      return; 
+    }
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    point_set_item->deleteSelection();
+    QApplication::restoreOverrideCursor();
+  }
+
+  void on_Invert_selection_button_clicked() {
+    Scene_points_with_normal_item* point_set_item
+      = qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
+    if(!point_set_item) {
+      print_message("Error: no point set selected!");
+      return; 
+    }
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    point_set_item->invertSelection();
+    QApplication::restoreOverrideCursor();
+  }
+
+  void on_Create_point_set_item_button_clicked() {
+    Scene_points_with_normal_item* point_set_item
+      = qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
+    if(!point_set_item) {
+      print_message("Error: no point set selected!");
+      return; 
+    }
+    if(point_set_item->isSelectionEmpty ()) {
+      print_message("Error: there is no selected point in point set item!");
+      return;
+    }
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    Scene_points_with_normal_item* new_item = new Scene_points_with_normal_item();
+    new_item->setName(QString("%1 (selected points)").arg(point_set_item->name()));
+    new_item->set_has_normals (point_set_item->has_normals());
+    new_item->setColor(point_set_item->color());
+    new_item->setRenderingMode(point_set_item->renderingMode());
+    new_item->setVisible(point_set_item->visible());
+
+    typedef Point_set_3<Kernel> Point_set;
+    for(Point_set::iterator it = point_set_item->point_set()->begin ();
+	it != point_set_item->point_set()->end(); ++ it) {
+      if (point_set_item->point_set()->is_selected (it))
+	new_item->point_set()->push_back(*it);
+    }
+    new_item->resetSelection();
+    new_item->invalidateOpenGLBuffers();
+
+    scene->addItem(new_item);
+    QApplication::restoreOverrideCursor();
+ }
+
+  void on_Selection_tool_combo_box_changed (int index)
+  {
+    rectangle = (index == 0);
+  }
+
+  void on_Selection_mode_combo_box_changed (int index)
+  {
+    selection_mode = index;
+  }
+
+
+private:
+  Messages_interface* messages;
+  QAction* actionPointSetSelection;
+
+  QDockWidget* dock_widget;
+  Ui::PointSetSelection ui_widget;
+  bool rectangle;
+  int selection_mode;
+  Scene_point_set_selection_visualizer* visualizer;
+  bool shift_pressing;
+
+}; // end Polyhedron_demo_point_set_selection_plugin
+
+//Q_EXPORT_PLUGIN2(Polyhedron_demo_point_set_selection_plugin, Polyhedron_demo_point_set_selection_plugin)
+
+#include "Point_set_selection_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_selection_widget.ui b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_selection_widget.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Point_set/Point_set_selection_widget.ui
rename to 3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_selection_widget.ui
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.cpp
new file mode 100644
index 0000000..e79231d
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.cpp
@@ -0,0 +1,398 @@
+#include "config.h"
+#include "Scene_points_with_normal_item.h"
+#include "Scene_polygon_soup_item.h"
+#include "Scene_polyhedron_item.h"
+#include <CGAL/Three/Scene_group_item.h>
+
+#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+
+#include <CGAL/Random.h>
+
+#include <CGAL/Shape_detection_3.h>
+#include <CGAL/regularize_planes.h>
+#include <CGAL/Delaunay_triangulation_2.h>
+#include <CGAL/Alpha_shape_2.h>
+
+#include <QObject>
+#include <QAction>
+#include <QMainWindow>
+#include <QApplication>
+#include <QtPlugin>
+#include <QMessageBox>
+
+#include <boost/foreach.hpp>
+
+#include "ui_Point_set_shape_detection_plugin.h"
+
+typedef CGAL::Exact_predicates_inexact_constructions_kernel Epic_kernel;
+typedef Epic_kernel::Point_3 Point;
+//typedef CGAL::Point_with_normal_3<Epic_kernel> Point_with_normal;
+//typedef std::vector<Point_with_normal> Point_list;
+//typedef CGAL::Identity_property_map<Point_with_normal> PointPMap;
+//typedef CGAL::Normal_of_point_with_normal_pmap<Epic_kernel> NormalPMap;
+using namespace CGAL::Three;
+class Polyhedron_demo_point_set_shape_detection_plugin :
+  public QObject,
+  public Polyhedron_demo_plugin_helper
+{
+  Q_OBJECT
+    Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+    Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+    QAction* actionDetect;
+
+  typedef CGAL::Identity_property_map<Point_set::Point_with_normal> PointPMap;
+  typedef CGAL::Normal_of_point_with_normal_pmap<Point_set::Geom_traits> NormalPMap;
+
+  typedef CGAL::Shape_detection_3::Efficient_RANSAC_traits<Epic_kernel, Point_set, PointPMap, NormalPMap> Traits;
+  typedef CGAL::Shape_detection_3::Efficient_RANSAC<Traits> Shape_detection;
+  
+public:
+  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*) {
+    scene = scene_interface;
+    actionDetect = new QAction(tr("Point Set Shape Detection"), mainWindow);
+    actionDetect->setObjectName("actionDetect");
+    autoConnectActions();
+  }
+
+  bool applicable(QAction*) const {
+    Scene_points_with_normal_item* item =
+      qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
+    if (item && item->has_normals())
+      return true;
+    return false;
+  }
+
+  QList<QAction*> actions() const {
+    return QList<QAction*>() << actionDetect;
+  }
+
+  public Q_SLOTS:
+    void on_actionDetect_triggered();
+
+private:
+
+  typedef Kernel::Plane_3 Plane_3;
+  
+  void build_alpha_shape (Point_set& points, boost::shared_ptr<CGAL::Shape_detection_3::Plane<Traits> > plane,
+                          Scene_polyhedron_item* item, double epsilon);
+
+}; // end Polyhedron_demo_point_set_shape_detection_plugin
+
+class Point_set_demo_point_set_shape_detection_dialog : public QDialog, private Ui::PointSetShapeDetectionDialog
+{
+  Q_OBJECT
+public:
+  Point_set_demo_point_set_shape_detection_dialog(QWidget * /*parent*/ = 0)
+  {
+    setupUi(this);
+  }
+
+  //QString shapeDetectionMethod() const { return m_shapeDetectionMethod->currentText(); }
+  double cluster_epsilon() const { return m_cluster_epsilon_field->value(); }
+  double epsilon() const { return m_epsilon_field->value(); }
+  unsigned int min_points() const { return m_min_pts_field->value(); }
+  double normal_tolerance() const { return m_normal_tolerance_field->value(); }
+  double search_probability() const { return m_probability_field->value(); }
+  double gridCellSize() const { return 1.0; }
+  bool detect_plane() const { return planeCB->isChecked(); } 
+  bool detect_sphere() const { return sphereCB->isChecked(); } 
+  bool detect_cylinder() const { return cylinderCB->isChecked(); } 
+  bool detect_torus() const { return torusCB->isChecked(); } 
+  bool detect_cone() const { return coneCB->isChecked(); }
+  bool generate_alpha() const { return m_generate_alpha->isChecked(); }
+  bool generate_subset() const { return !(m_do_not_generate_subset->isChecked()); }
+  bool regularize() const { return m_regularize->isChecked(); }
+};
+
+void Polyhedron_demo_point_set_shape_detection_plugin::on_actionDetect_triggered() {
+
+  CGAL::Random rand(time(0));
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+
+  Scene_points_with_normal_item* item =
+    qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
+
+  Scene_points_with_normal_item::Bbox bb = item->bbox();
+ 
+  double diam = CGAL::sqrt((bb.xmax()-bb.xmin())*(bb.xmax()-bb.xmin()) + (bb.ymax()-bb.ymin())*(bb.ymax()-bb.ymin()) + (bb.zmax()-bb.zmin())*(bb.zmax()-bb.zmin()));
+
+  if(item)
+  {
+    // Gets point set
+    Point_set* points = item->point_set();
+
+    if(points == NULL)
+      return;
+
+    //Epic_kernel::FT diag = sqrt(((points->bounding_box().max)() - (points->bounding_box().min)()).squared_length());
+
+    // Gets options
+    Point_set_demo_point_set_shape_detection_dialog dialog;
+    if(!dialog.exec())
+      return;
+
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+
+    
+    Shape_detection shape_detection;
+    shape_detection.set_input(*points);
+
+    std::vector<Scene_group_item *> groups;
+    groups.resize(5);
+    // Shapes to be searched for are registered by using the template Shape_factory
+    if(dialog.detect_plane()){
+      groups[0] = new Scene_group_item("Planes");
+      shape_detection.add_shape_factory<CGAL::Shape_detection_3::Plane<Traits> >();
+    }
+    if(dialog.detect_cylinder()){
+      groups[1] = new Scene_group_item("Cylinders");
+      shape_detection.add_shape_factory<CGAL::Shape_detection_3::Cylinder<Traits> >();
+    }
+    if(dialog.detect_torus()){
+      groups[2] = new Scene_group_item("Torus");
+      shape_detection.add_shape_factory< CGAL::Shape_detection_3::Torus<Traits> >();
+    }
+    if(dialog.detect_cone()){
+      groups[3] = new Scene_group_item("Cones");
+      shape_detection.add_shape_factory< CGAL::Shape_detection_3::Cone<Traits> >();
+    }
+    if(dialog.detect_sphere()){
+      groups[4] = new Scene_group_item("Spheres");
+      shape_detection.add_shape_factory< CGAL::Shape_detection_3::Sphere<Traits> >();
+    }
+
+    // Parameterization of the shape detection using the Parameters structure.
+    Shape_detection::Parameters op;
+    op.probability = dialog.search_probability();       // probability to miss the largest primitive on each iteration.
+    op.min_points = dialog.min_points();          // Only extract shapes with a minimum number of points.
+    op.epsilon = dialog.epsilon();          // maximum euclidean distance between point and shape.
+    op.cluster_epsilon = dialog.cluster_epsilon();    // maximum euclidean distance between points to be clustered.
+    op.normal_threshold = dialog.normal_tolerance();   // normal_threshold < dot(surface_normal, point_normal); maximum normal deviation.
+
+    // The actual shape detection.
+    shape_detection.detect(op);
+
+    std::cout << shape_detection.shapes().size() << " shapes found" << std::endl;
+
+    if (dialog.regularize ())
+      {
+        std::cerr << "Regularization of planes... " << std::endl;
+        CGAL::regularize_planes (shape_detection, true, true, true, true,
+                                 180 * std::acos (op.normal_threshold) / CGAL_PI, op.epsilon);
+    
+        std::cerr << "done" << std::endl;
+      }
+
+    std::map<Kernel::Point_3, QColor> color_map;
+    
+    //print_message(QString("%1 shapes found.").arg(shape_detection.number_of_shapes()));
+    int index = 0;
+    BOOST_FOREACH(boost::shared_ptr<Shape_detection::Shape> shape, shape_detection.shapes())
+    {
+      CGAL::Shape_detection_3::Cylinder<Traits> *cyl;
+      cyl = dynamic_cast<CGAL::Shape_detection_3::Cylinder<Traits> *>(shape.get());
+      if (cyl != NULL){
+        if(cyl->radius() > diam){
+          continue;
+        }
+      }
+        
+      Scene_points_with_normal_item *point_item = new Scene_points_with_normal_item;
+      BOOST_FOREACH(std::size_t i, shape->indices_of_assigned_points())
+        point_item->point_set()->push_back((*points)[i]);
+      
+      unsigned char r, g, b;
+
+      r = static_cast<unsigned char>(64 + rand.get_int(0, 192));
+      g = static_cast<unsigned char>(64 + rand.get_int(0, 192));
+      b = static_cast<unsigned char>(64 + rand.get_int(0, 192));
+
+      point_item->setRbgColor(r, g, b);
+
+      // Providing a useful name consisting of the order of detection, name of type and number of inliers
+      std::stringstream ss;
+      if (dynamic_cast<CGAL::Shape_detection_3::Cylinder<Traits> *>(shape.get())){
+        CGAL::Shape_detection_3::Cylinder<Traits> * cyl 
+          = dynamic_cast<CGAL::Shape_detection_3::Cylinder<Traits> *>(shape.get());
+        ss << item->name().toStdString() << "_cylinder_" << cyl->radius() << "_";
+      }
+      else if (dynamic_cast<CGAL::Shape_detection_3::Plane<Traits> *>(shape.get()))
+        {
+          ss << item->name().toStdString() << "_plane_";
+
+          boost::shared_ptr<CGAL::Shape_detection_3::Plane<Traits> > pshape
+            = boost::dynamic_pointer_cast<CGAL::Shape_detection_3::Plane<Traits> > (shape);
+          
+          Kernel::Point_3 ref = CGAL::ORIGIN + pshape->plane_normal ();
+
+          if (color_map.find (ref) == color_map.end ())
+            {
+              ref = CGAL::ORIGIN + (-1.) * pshape->plane_normal ();
+              if (color_map.find (ref) == color_map.end ())
+                color_map[ref] = point_item->color ();
+              else
+                point_item->setColor (color_map[ref]);
+            }
+          else
+            point_item->setColor (color_map[ref]);
+
+          ss << "(" << ref << ")_";
+      
+          if (dialog.generate_alpha ())
+            {
+              // If plane, build alpha shape
+              Scene_polyhedron_item* poly_item = new Scene_polyhedron_item;
+
+              build_alpha_shape (*(point_item->point_set()), pshape,
+                                 poly_item, dialog.cluster_epsilon());
+          
+              poly_item->setColor(point_item->color ());
+              poly_item->setName(QString("%1%2_alpha_shape").arg(QString::fromStdString(ss.str()))
+                                 .arg (QString::number (shape->indices_of_assigned_points().size())));
+              poly_item->setRenderingMode (Flat);
+              scene->addItem(poly_item);
+                if(scene->item_id(groups[0]) == -1)
+                   scene->addItem(groups[0]);
+                scene->changeGroup(poly_item, groups[0]);
+            }
+        }
+      else if (dynamic_cast<CGAL::Shape_detection_3::Cone<Traits> *>(shape.get()))
+        ss << item->name().toStdString() << "_cone_";
+      else if (dynamic_cast<CGAL::Shape_detection_3::Torus<Traits> *>(shape.get()))
+        ss << item->name().toStdString() << "_torus_";
+      else if (dynamic_cast<CGAL::Shape_detection_3::Sphere<Traits> *>(shape.get()))
+        ss << item->name().toStdString() << "_sphere_";
+
+
+      ss << shape->indices_of_assigned_points().size();
+
+      //names[i] = ss.str(		
+      point_item->setName(QString::fromStdString(ss.str()));
+      point_item->set_has_normals(true);
+      point_item->setRenderingMode(item->renderingMode());
+
+      if (dialog.generate_subset()){
+        scene->addItem(point_item);
+        if (dynamic_cast<CGAL::Shape_detection_3::Cylinder<Traits> *>(shape.get()))
+        {
+          if(scene->item_id(groups[1]) == -1)
+             scene->addItem(groups[1]);
+          scene->changeGroup(point_item, groups[1]);
+        }
+        else if (dynamic_cast<CGAL::Shape_detection_3::Plane<Traits> *>(shape.get()))
+        {
+          if(scene->item_id(groups[0]) == -1)
+             scene->addItem(groups[0]);
+          scene->changeGroup(point_item, groups[0]);
+        }
+        else if (dynamic_cast<CGAL::Shape_detection_3::Cone<Traits> *>(shape.get()))
+        {
+          if(scene->item_id(groups[3]) == -1)
+             scene->addItem(groups[3]);
+          scene->changeGroup(point_item, groups[3]);
+        }
+        else if (dynamic_cast<CGAL::Shape_detection_3::Torus<Traits> *>(shape.get()))
+        {
+          if(scene->item_id(groups[2]) == -1)
+             scene->addItem(groups[2]);
+          scene->changeGroup(point_item, groups[2]);
+        }
+        else if (dynamic_cast<CGAL::Shape_detection_3::Sphere<Traits> *>(shape.get()))
+        {
+          if(scene->item_id(groups[4]) == -1)
+             scene->addItem(groups[4]);
+          scene->changeGroup(point_item, groups[4]);
+        }
+      }
+      else
+        delete point_item;
+
+      ++index;
+    }
+    Q_FOREACH(Scene_group_item* group, groups)
+      if(group && group->getChildren().empty())
+        delete group;
+
+    // Updates scene
+    scene->itemChanged(index);
+
+    QApplication::restoreOverrideCursor();
+
+    //     Warn user, maybe choice of parameters is unsuitable
+    //         if (nb_points_to_remove > 0)
+    //         {
+    //           QMessageBox::information(NULL,
+    //                                    tr("Points selected for removal"),
+    //                                    tr("%1 point(s) are selected for removal.\nYou may delete or reset the selection using the item context menu.")
+    //                                    .arg(nb_points_to_remove));
+    //         }
+    item->setVisible(false);
+  }
+}
+
+void Polyhedron_demo_point_set_shape_detection_plugin::build_alpha_shape
+(Point_set& points,  boost::shared_ptr<CGAL::Shape_detection_3::Plane<Traits> > plane,
+ Scene_polyhedron_item* item, double epsilon)
+{
+  typedef Kernel::Point_2  Point_2;
+  typedef CGAL::Alpha_shape_vertex_base_2<Kernel> Vb;
+  typedef CGAL::Alpha_shape_face_base_2<Kernel>  Fb;
+  typedef CGAL::Triangulation_data_structure_2<Vb,Fb> Tds;
+  typedef CGAL::Delaunay_triangulation_2<Kernel,Tds> Triangulation_2;
+  typedef CGAL::Alpha_shape_2<Triangulation_2>  Alpha_shape_2;
+
+
+  std::vector<Point_2> projections;
+  projections.reserve (points.size ());
+
+  for (std::size_t i = 0; i < points.size (); ++ i)
+    projections.push_back (plane->to_2d (points[i]));
+
+  Alpha_shape_2 ashape (projections.begin (), projections.end (), epsilon);
+  
+  std::map<Alpha_shape_2::Vertex_handle, std::size_t> map_v2i;
+
+  Scene_polygon_soup_item *soup_item = new Scene_polygon_soup_item;
+  
+  soup_item->init_polygon_soup(points.size(), ashape.number_of_faces ());
+  std::size_t current_index = 0;
+
+  for (Alpha_shape_2::Finite_faces_iterator it = ashape.finite_faces_begin ();
+       it != ashape.finite_faces_end (); ++ it)
+    {
+      if (ashape.classify (it) != Alpha_shape_2::INTERIOR)
+        continue;
+
+      for (int i = 0; i < 3; ++ i)
+        {
+          if (map_v2i.find (it->vertex (i)) == map_v2i.end ())
+            {
+              map_v2i.insert (std::make_pair (it->vertex (i), current_index ++));
+              Point p = plane->to_3d (it->vertex (i)->point ());
+              soup_item->new_vertex (p.x (), p.y (), p.z ());
+            }
+        }
+      soup_item->new_triangle (map_v2i[it->vertex (0)],
+                               map_v2i[it->vertex (1)],
+                               map_v2i[it->vertex (2)]);
+    }
+
+  soup_item->orient();
+  soup_item->exportAsPolyhedron (item->polyhedron());
+
+  if (soup_item->isEmpty ())
+    {
+      std::cerr << "POLYGON SOUP EMPTY" << std::endl;
+      for (std::size_t i = 0; i < projections.size (); ++ i)
+        std::cerr << projections[i] << std::endl;
+      
+    }
+  
+  delete soup_item;
+}
+
+
+#include <QtPlugin>
+
+#include "Point_set_shape_detection_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.ui b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.ui
new file mode 100644
index 0000000..67cc7c5
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.ui
@@ -0,0 +1,284 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>PointSetShapeDetectionDialog</class>
+ <widget class="QDialog" name="PointSetShapeDetectionDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>369</width>
+    <height>317</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Shape Detection</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout_6">
+     <item>
+      <widget class="QCheckBox" name="planeCB">
+       <property name="text">
+        <string>Plane</string>
+       </property>
+       <property name="checked">
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QCheckBox" name="cylinderCB">
+       <property name="text">
+        <string>Cylinder</string>
+       </property>
+       <property name="checked">
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QCheckBox" name="torusCB">
+       <property name="text">
+        <string>Torus</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QCheckBox" name="coneCB">
+       <property name="text">
+        <string>Cone</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QCheckBox" name="sphereCB">
+       <property name="text">
+        <string>Sphere</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,1">
+     <item>
+      <widget class="QLabel" name="label_2">
+       <property name="text">
+        <string>Epsilon:</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QDoubleSpinBox" name="m_epsilon_field">
+       <property name="toolTip">
+        <string>Fitting tolerance in Euclidean distance</string>
+       </property>
+       <property name="decimals">
+        <number>3</number>
+       </property>
+       <property name="maximum">
+        <double>1.000000000000000</double>
+       </property>
+       <property name="singleStep">
+        <double>0.001000000000000</double>
+       </property>
+       <property name="value">
+        <double>0.002000000000000</double>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1">
+     <item>
+      <widget class="QLabel" name="label">
+       <property name="text">
+        <string>Normal Tolerance:</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QDoubleSpinBox" name="m_normal_tolerance_field">
+       <property name="toolTip">
+        <string>Normal angle deviation tolerance as cosine of the angle</string>
+       </property>
+       <property name="singleStep">
+        <double>0.001000000000000</double>
+       </property>
+       <property name="value">
+        <double>0.900000000000000</double>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout_3" stretch="0,1">
+     <item>
+      <widget class="QLabel" name="label_3">
+       <property name="text">
+        <string>Minimum Numbr of Points:</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QSpinBox" name="m_min_pts_field">
+       <property name="toolTip">
+        <string>Smallest allowed size for a primitive</string>
+       </property>
+       <property name="maximum">
+        <number>10000</number>
+       </property>
+       <property name="singleStep">
+        <number>50</number>
+       </property>
+       <property name="value">
+        <number>100</number>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout_4" stretch="0,1">
+     <item>
+      <widget class="QLabel" name="label_4">
+       <property name="text">
+        <string>Connectivity Epsilon:</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QDoubleSpinBox" name="m_cluster_epsilon_field">
+       <property name="toolTip">
+        <string>Maximum world distance between points on a shape to be considered as connected</string>
+       </property>
+       <property name="decimals">
+        <number>2</number>
+       </property>
+       <property name="maximum">
+        <double>1.000000000000000</double>
+       </property>
+       <property name="singleStep">
+        <double>0.010000000000000</double>
+       </property>
+       <property name="value">
+        <double>0.020000000000000</double>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout_5" stretch="0,1">
+     <item>
+      <widget class="QLabel" name="label_5">
+       <property name="text">
+        <string>Search Rigorosity (Probability):</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QDoubleSpinBox" name="m_probability_field">
+       <property name="toolTip">
+        <string>Probability to overlook the largest primitive in one extraction iteration</string>
+       </property>
+       <property name="maximum">
+        <double>1.000000000000000</double>
+       </property>
+       <property name="singleStep">
+        <double>0.010000000000000</double>
+       </property>
+       <property name="value">
+        <double>0.050000000000000</double>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <widget class="QCheckBox" name="m_generate_alpha">
+     <property name="text">
+      <string>Generate Alpha Shapes for Planes</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QCheckBox" name="m_do_not_generate_subset">
+     <property name="text">
+      <string>Do Not Generate Point Subsets</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QCheckBox" name="m_regularize">
+     <property name="text">
+      <string>Regularize planes</string>
+     </property>
+     <property name="checked">
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item>
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>PointSetShapeDetectionDialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>248</x>
+     <y>254</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>PointSetShapeDetectionDialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>316</x>
+     <y>260</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_simplification_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_simplification_plugin.cpp
new file mode 100644
index 0000000..2e3d950
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_simplification_plugin.cpp
@@ -0,0 +1,203 @@
+#include "config.h"
+#include "Scene_points_with_normal_item.h"
+#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+
+#include <CGAL/grid_simplify_point_set.h>
+#include <CGAL/random_simplify_point_set.h>
+#include <CGAL/hierarchy_simplify_point_set.h>
+#include <CGAL/compute_average_spacing.h>
+#include <CGAL/Timer.h>
+#include <CGAL/Memory_sizer.h>
+
+#include <QObject>
+#include <QAction>
+#include <QMainWindow>
+#include <QApplication>
+#include <QtPlugin>
+#include <QMessageBox>
+
+#include "ui_Point_set_simplification_plugin.h"
+
+// Concurrency
+#ifdef CGAL_LINKED_WITH_TBB
+typedef CGAL::Parallel_tag Concurrency_tag;
+#else
+typedef CGAL::Sequential_tag Concurrency_tag;
+#endif
+
+
+using namespace CGAL::Three;
+class Polyhedron_demo_point_set_simplification_plugin :
+  public QObject,
+  public Polyhedron_demo_plugin_helper
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+  QAction* actionSimplify;
+
+public:
+  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface,Messages_interface*) {
+    scene = scene_interface;
+    actionSimplify = new QAction(tr("Simplification Selection"), mainWindow);
+    actionSimplify->setProperty("subMenuName","Point Set Processing");
+
+    actionSimplify->setObjectName("actionSimplify");
+    autoConnectActions();
+  }
+
+  bool applicable(QAction*) const {
+    return qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
+  }
+
+  QList<QAction*> actions() const {
+    return QList<QAction*>() << actionSimplify;
+  }
+
+public Q_SLOTS:
+  void on_actionSimplify_triggered();
+
+
+}; // end Polyhedron_demo_point_set_simplification_plugin
+
+class Point_set_demo_point_set_simplification_dialog : public QDialog, private Ui::PointSetSimplificationDialog
+{
+  Q_OBJECT
+  public:
+    Point_set_demo_point_set_simplification_dialog(QWidget * /*parent*/ = 0)
+    {
+      setupUi(this);
+    }
+
+  unsigned int simplificationMethod() const
+  {
+    if (Random->isChecked())
+      return 0;
+    else if (Grid->isChecked())
+      return 1;
+    else
+      return 2;
+  }
+  double randomSimplificationPercentage() const { return m_randomSimplificationPercentage->value(); }
+  double gridCellSize() const { return m_gridCellSize->value(); }
+  unsigned int maximumClusterSize() const { return m_maximumClusterSize->value(); }
+  double maximumSurfaceVariation() const { return m_maximumSurfaceVariation->value(); }
+
+public Q_SLOTS:
+  
+  void on_Random_toggled (bool toggled)
+  {
+    m_randomSimplificationPercentage->setEnabled (toggled);
+    m_gridCellSize->setEnabled (!toggled);
+    m_maximumClusterSize->setEnabled (!toggled);
+    m_maximumSurfaceVariation->setEnabled (!toggled);
+  }
+  void on_Grid_toggled (bool toggled)
+  {
+    m_randomSimplificationPercentage->setEnabled (!toggled);
+    m_gridCellSize->setEnabled (toggled);
+    m_maximumClusterSize->setEnabled (!toggled);
+    m_maximumSurfaceVariation->setEnabled (!toggled);
+  }
+  void on_Hierarchy_toggled (bool toggled)
+  {
+    m_randomSimplificationPercentage->setEnabled (!toggled);
+    m_gridCellSize->setEnabled (!toggled);
+    m_maximumClusterSize->setEnabled (toggled);
+    m_maximumSurfaceVariation->setEnabled (toggled);
+  }
+
+};
+
+void Polyhedron_demo_point_set_simplification_plugin::on_actionSimplify_triggered()
+{
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+
+  Scene_points_with_normal_item* item =
+    qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
+
+  if(item)
+  {
+    // Gets point set
+    Point_set* points = item->point_set();
+    if(points == NULL)
+        return;
+
+    // Gets options
+    Point_set_demo_point_set_simplification_dialog dialog;
+    if(!dialog.exec())
+      return;
+
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+
+    CGAL::Timer task_timer; task_timer.start();
+
+    // First point to delete
+    Point_set::iterator first_point_to_remove = points->end();
+
+    unsigned int method = dialog.simplificationMethod ();
+    if (method == 0)
+    {
+      std::cerr << "Point set random simplification (" << dialog.randomSimplificationPercentage() <<"%)...\n";
+
+      // Computes points to remove by random simplification
+      first_point_to_remove =
+        CGAL::random_simplify_point_set(points->begin(), points->end(),
+                                        dialog.randomSimplificationPercentage());
+    }
+    else if (method == 1)
+    {
+      std::cerr << "Point set grid simplification (cell size = " << dialog.gridCellSize() <<" * average spacing)...\n";
+
+      // Computes average spacing
+      double average_spacing = CGAL::compute_average_spacing<Concurrency_tag>(
+                                      points->begin(), points->end(),
+                                      6 /* knn = 1 ring */);
+
+      // Computes points to remove by Grid Clustering
+      first_point_to_remove =
+        CGAL::grid_simplify_point_set(points->begin(), points->end(),
+                                      dialog.gridCellSize()*average_spacing);
+    }
+    else
+    {
+      std::cerr << "Point set hierarchy simplification (cluster size = " << dialog.maximumClusterSize()
+		<< ", maximum variation = " << dialog.maximumSurfaceVariation() << ")...\n";
+
+      // Computes points to remove by Grid Clustering
+      first_point_to_remove =
+        CGAL::hierarchy_simplify_point_set(points->begin(), points->end(),
+					   dialog.maximumClusterSize(),
+					   dialog.maximumSurfaceVariation());
+    }
+
+    std::size_t nb_points_to_remove = std::distance(first_point_to_remove, points->end());
+    std::size_t memory = CGAL::Memory_sizer().virtual_size();
+    std::cerr << "Simplification: " << nb_points_to_remove << " point(s) are selected for removal ("
+                                    << task_timer.time() << " seconds, "
+                                    << (memory>>20) << " Mb allocated)"
+                                    << std::endl;
+
+    // Selects points to delete
+    points->set_first_selected(first_point_to_remove);
+
+    // Updates scene
+    item->invalidateOpenGLBuffers();
+    scene->itemChanged(index);
+
+    QApplication::restoreOverrideCursor();
+
+    // Warns user
+    if (nb_points_to_remove > 0)
+    {
+      QMessageBox::information(NULL,
+                               tr("Points selected for removal"),
+                               tr("%1 point(s) are selected for removal.\nYou may delete or reset the selection using the item context menu.")
+                               .arg(nb_points_to_remove));
+    }
+  }
+}
+
+#include "Point_set_simplification_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_simplification_plugin.ui b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_simplification_plugin.ui
new file mode 100644
index 0000000..3293552
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_simplification_plugin.ui
@@ -0,0 +1,217 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>PointSetSimplificationDialog</class>
+ <widget class="QDialog" name="PointSetSimplificationDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>392</width>
+    <height>248</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Simplification</string>
+  </property>
+  <layout class="QGridLayout" columnstretch="0,1" columnminimumwidth="0,1">
+   <item row="7" column="0">
+    <widget class="QLabel" name="label_4">
+     <property name="text">
+      <string>Maximum Cluster Size</string>
+     </property>
+    </widget>
+   </item>
+   <item row="4" column="0">
+    <widget class="QRadioButton" name="Grid">
+     <property name="text">
+      <string>Grid</string>
+     </property>
+    </widget>
+   </item>
+   <item row="7" column="1">
+    <widget class="QSpinBox" name="m_maximumClusterSize">
+     <property name="enabled">
+      <bool>false</bool>
+     </property>
+     <property name="minimum">
+      <number>1</number>
+     </property>
+     <property name="maximum">
+      <number>2147483647</number>
+     </property>
+     <property name="value">
+      <number>10</number>
+     </property>
+    </widget>
+   </item>
+   <item row="8" column="0">
+    <widget class="QLabel" name="label_5">
+     <property name="text">
+      <string>Maximum Surface Variation</string>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="0">
+    <widget class="QRadioButton" name="Random">
+     <property name="text">
+      <string>Random</string>
+     </property>
+     <property name="checked">
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+   <item row="6" column="0">
+    <widget class="QRadioButton" name="Hierarchy">
+     <property name="text">
+      <string>Hierarchy</string>
+     </property>
+    </widget>
+   </item>
+   <item row="3" column="0">
+    <widget class="QLabel" name="label_2">
+     <property name="text">
+      <string>Points to Remove Randomly</string>
+     </property>
+    </widget>
+   </item>
+   <item row="5" column="0">
+    <widget class="QLabel" name="label_3">
+     <property name="text">
+      <string>Grid Cell Size</string>
+     </property>
+    </widget>
+   </item>
+   <item row="10" column="0" colspan="2">
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+   <item row="3" column="1">
+    <widget class="QDoubleSpinBox" name="m_randomSimplificationPercentage">
+     <property name="suffix">
+      <string> %</string>
+     </property>
+     <property name="decimals">
+      <number>2</number>
+     </property>
+     <property name="minimum">
+      <double>0.100000000000000</double>
+     </property>
+     <property name="maximum">
+      <double>100.000000000000000</double>
+     </property>
+     <property name="singleStep">
+      <double>0.100000000000000</double>
+     </property>
+     <property name="value">
+      <double>50.000000000000000</double>
+     </property>
+    </widget>
+   </item>
+   <item row="8" column="1">
+    <widget class="QDoubleSpinBox" name="m_maximumSurfaceVariation">
+     <property name="enabled">
+      <bool>false</bool>
+     </property>
+     <property name="suffix">
+      <string/>
+     </property>
+     <property name="decimals">
+      <number>5</number>
+     </property>
+     <property name="minimum">
+      <double>0.000010000000000</double>
+     </property>
+     <property name="maximum">
+      <double>0.333330000000000</double>
+     </property>
+     <property name="singleStep">
+      <double>0.012340000000000</double>
+     </property>
+     <property name="value">
+      <double>0.333330000000000</double>
+     </property>
+    </widget>
+   </item>
+   <item row="5" column="1">
+    <widget class="QDoubleSpinBox" name="m_gridCellSize">
+     <property name="enabled">
+      <bool>false</bool>
+     </property>
+     <property name="suffix">
+      <string> * average spacing</string>
+     </property>
+     <property name="decimals">
+      <number>2</number>
+     </property>
+     <property name="minimum">
+      <double>0.100000000000000</double>
+     </property>
+     <property name="maximum">
+      <double>10.000000000000000</double>
+     </property>
+     <property name="singleStep">
+      <double>0.100000000000000</double>
+     </property>
+     <property name="value">
+      <double>1.000000000000000</double>
+     </property>
+    </widget>
+   </item>
+   <item row="9" column="0">
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>PointSetSimplificationDialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>248</x>
+     <y>254</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>PointSetSimplificationDialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>316</x>
+     <y>260</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_smoothing_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_smoothing_plugin.cpp
new file mode 100644
index 0000000..c08d461
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_smoothing_plugin.cpp
@@ -0,0 +1,99 @@
+#include "config.h"
+#include "Scene_points_with_normal_item.h"
+#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+
+#include <QObject>
+#include <QAction>
+#include <QMainWindow>
+#include <QApplication>
+#include <QtPlugin>
+#include <QInputDialog>
+
+#include <CGAL/jet_smooth_point_set.h>
+
+// Concurrency
+#ifdef CGAL_LINKED_WITH_TBB
+typedef CGAL::Parallel_tag Concurrency_tag;
+#else
+typedef CGAL::Sequential_tag Concurrency_tag;
+#endif
+
+using namespace CGAL::Three;
+class Polyhedron_demo_point_set_smoothing_plugin :
+  public QObject,
+  public Polyhedron_demo_plugin_helper
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+  QAction* actionJetSmoothing;
+
+public:
+  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*) {
+    scene = scene_interface;
+    mw = mainWindow;
+    actionJetSmoothing = new QAction(tr("Jet Smoothing"), mainWindow);
+    actionJetSmoothing->setProperty("subMenuName","Point Set Processing");
+    actionJetSmoothing->setObjectName("actionJetSmoothing");
+    autoConnectActions();
+  }
+
+  QList<QAction*> actions() const {
+    return QList<QAction*>() << actionJetSmoothing;
+  }
+
+  bool applicable(QAction*) const { 
+    return qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
+  }
+
+public Q_SLOTS:
+  void on_actionJetSmoothing_triggered();
+
+}; // end Polyhedron_demo_point_set_smoothing_plugin
+
+void Polyhedron_demo_point_set_smoothing_plugin::on_actionJetSmoothing_triggered()
+{
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+
+  Scene_points_with_normal_item* item =
+    qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
+
+  if(item)
+  {
+    Point_set* points = item->point_set();
+    if(!points) return;
+
+    // Gets options
+    bool ok;
+
+    const unsigned int nb_neighbors =
+      QInputDialog::getInt((QWidget*)mw,
+                           tr("Jet Smoothing"), // dialog title
+                           tr("Number of neighbors:"), // field label
+                           24, // default value = fast
+                           6, // min
+                           1000, // max
+                           1, // step
+                           &ok);
+    if(!ok) return;
+
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+
+    CGAL::jet_smooth_point_set<Concurrency_tag>(points->begin_or_selection_begin(), points->end(), nb_neighbors);
+
+    points->invalidate_bounds();
+
+    // calling jet_smooth_point_set breaks the normals
+    item->set_has_normals(false);
+
+    // update scene
+    item->invalidateOpenGLBuffers();
+    scene->itemChanged(index);
+
+    QApplication::restoreOverrideCursor();
+  }
+}
+
+#include "Point_set_smoothing_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_upsampling_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_upsampling_plugin.cpp
new file mode 100644
index 0000000..810cefe
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_upsampling_plugin.cpp
@@ -0,0 +1,156 @@
+#include "config.h"
+#include "Scene_points_with_normal_item.h"
+#include "Messages_interface.h"
+#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+
+#include <CGAL/compute_average_spacing.h>
+#include <CGAL/edge_aware_upsample_point_set.h>
+#include <CGAL/Timer.h>
+#include <CGAL/Memory_sizer.h>
+
+#include <QObject>
+#include <QAction>
+#include <QMainWindow>
+#include <QApplication>
+#include <QtPlugin>
+#include <QMessageBox>
+
+#include "ui_Point_set_upsampling_plugin.h"
+// Concurrency
+#ifdef CGAL_LINKED_WITH_TBB
+typedef CGAL::Parallel_tag Concurrency_tag;
+#else
+typedef CGAL::Sequential_tag Concurrency_tag;
+#endif
+ 
+using namespace CGAL::Three;
+class Polyhedron_demo_point_set_upsampling_plugin :
+  public QObject,
+  public Polyhedron_demo_plugin_helper
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+  
+  QAction* actionEdgeAwareUpsampling;
+  Messages_interface* message_interface;
+public:
+  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface* mi) {
+    message_interface = mi;
+    scene = scene_interface;
+    actionEdgeAwareUpsampling = new QAction(tr("Edge Aware Upsampling"), mainWindow);
+    actionEdgeAwareUpsampling->setProperty("subMenuName","Point Set Processing");
+    actionEdgeAwareUpsampling->setObjectName("actionEdgeAwareUpsampling");
+    autoConnectActions();
+  }
+
+  bool applicable(QAction*) const {
+    return qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
+  }
+
+  QList<QAction*> actions() const {
+    return QList<QAction*>() << actionEdgeAwareUpsampling;
+  }
+
+public Q_SLOTS:
+  void on_actionEdgeAwareUpsampling_triggered();
+
+}; // end Polyhedron_demo_point_set_upsampling_plugin
+
+class Point_set_demo_point_set_upsampling_dialog : public QDialog, private Ui::PointSetUpsamplingDialog
+{
+  
+  Q_OBJECT
+public:
+  Point_set_demo_point_set_upsampling_dialog(QWidget * /*parent*/ = 0)
+  {
+    setupUi(this);
+  }
+
+  unsigned int sharpness_angle () const { return m_sharpnessAngle->value(); }
+  double edge_sensitivity() const { return m_edgeSensitivity->value(); }
+  double neighborhood_radius () const { return m_neighborhoodRadius->value(); }
+  double output_size () const { return m_outputSize->value(); }
+
+};
+
+void Polyhedron_demo_point_set_upsampling_plugin::on_actionEdgeAwareUpsampling_triggered()
+{
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+
+  Scene_points_with_normal_item* item =
+    qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
+
+  if(item)
+    {
+      if (!(item->has_normals ()))
+	{
+          message_interface->error("Error: upsampling algorithm requires point set with normals.");
+	  return;
+	}
+      
+      // Gets point set
+      Point_set* points = item->point_set();
+      if(points == NULL)
+        return;
+
+      // Gets options
+      Point_set_demo_point_set_upsampling_dialog dialog;
+      if(!dialog.exec())
+	return;
+
+      unsigned int output_size = static_cast<unsigned int>(dialog.output_size ()
+							   * points->size ());
+      std::cerr << "Edge aware upsampling (sharpness angle = "
+		<< dialog.sharpness_angle () << ", edge sensitivity = "
+		<< dialog.edge_sensitivity () << ", neighborhood radius = "
+		<< dialog.neighborhood_radius () << " * average spacing, output size = "
+		<< output_size << "...\n";
+
+      QApplication::setOverrideCursor(Qt::WaitCursor);
+
+      CGAL::Timer task_timer; task_timer.start();
+
+      // Computes average spacing
+      double average_spacing = CGAL::compute_average_spacing<Concurrency_tag>(
+                                      points->begin(), points->end(),
+                                      6 /* knn = 1 ring */);
+      
+      std::size_t nb_selected = points->nb_selected_points();
+      
+      std::vector<std::pair<Point_set::Point, Point_set::Vector> > new_points;
+      CGAL::edge_aware_upsample_point_set<Concurrency_tag>(points->begin_or_selection_begin(),
+					  points->end(), 
+					  std::back_inserter(new_points),
+					  CGAL::make_identity_property_map(Point_set::value_type()),
+					  CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()),
+					  dialog.sharpness_angle(), 
+					  dialog.edge_sensitivity(),
+					  dialog.neighborhood_radius() * average_spacing,
+					  output_size);
+      nb_selected += new_points.size();
+      
+      for (unsigned int i = 0; i < new_points.size (); ++ i)
+        {
+          points->push_back (Point_set::Point_with_normal (new_points[i].first,
+                                                           new_points[i].second));
+        }
+      if (nb_selected != new_points.size())
+        points->set_first_selected (points->end() - nb_selected);
+      
+      std::size_t memory = CGAL::Memory_sizer().virtual_size();
+      std::cerr << task_timer.time() << " seconds, "
+		<< (memory>>20) << " Mb allocated)"
+		<< std::endl;
+
+      // Updates scene
+      item->invalidateOpenGLBuffers();
+      scene->itemChanged(index);
+
+      QApplication::restoreOverrideCursor();
+
+    }
+}
+
+#include "Point_set_upsampling_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_upsampling_plugin.ui b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_upsampling_plugin.ui
new file mode 100644
index 0000000..1bd40c3
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_upsampling_plugin.ui
@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>PointSetUpsamplingDialog</class>
+ <widget class="QDialog" name="PointSetUpsamplingDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>348</width>
+    <height>167</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Edge Aware Upsampling</string>
+  </property>
+  <layout class="QGridLayout" columnstretch="0,1">
+   <item row="4" column="0">
+    <widget class="QLabel" name="label_2">
+     <property name="text">
+      <string>Output Size</string>
+     </property>
+    </widget>
+   </item>
+   <item row="3" column="1">
+    <widget class="QDoubleSpinBox" name="m_neighborhoodRadius">
+     <property name="suffix">
+      <string> * average spacing</string>
+     </property>
+     <property name="decimals">
+      <number>2</number>
+     </property>
+     <property name="minimum">
+      <double>0.100000000000000</double>
+     </property>
+     <property name="maximum">
+      <double>10.000000000000000</double>
+     </property>
+     <property name="singleStep">
+      <double>0.100000000000000</double>
+     </property>
+     <property name="value">
+      <double>3.000000000000000</double>
+     </property>
+    </widget>
+   </item>
+   <item row="6" column="0" colspan="2">
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="1">
+    <widget class="QDoubleSpinBox" name="m_edgeSensitivity">
+     <property name="maximum">
+      <double>1.000000000000000</double>
+     </property>
+     <property name="singleStep">
+      <double>0.010000000000000</double>
+     </property>
+    </widget>
+   </item>
+   <item row="4" column="1">
+    <widget class="QDoubleSpinBox" name="m_outputSize">
+     <property name="prefix">
+      <string/>
+     </property>
+     <property name="suffix">
+      <string> * input size</string>
+     </property>
+     <property name="minimum">
+      <double>1.000000000000000</double>
+     </property>
+     <property name="maximum">
+      <double>1000.000000000000000</double>
+     </property>
+     <property name="value">
+      <double>4.000000000000000</double>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="0">
+    <widget class="QLabel" name="label_5">
+     <property name="text">
+      <string>Edge Sensitivity</string>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="0">
+    <widget class="QLabel" name="label_4">
+     <property name="text">
+      <string>Sharpness Angle</string>
+     </property>
+    </widget>
+   </item>
+   <item row="3" column="0">
+    <widget class="QLabel" name="label">
+     <property name="text">
+      <string>Neighborhood Radius</string>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="1">
+    <widget class="QSpinBox" name="m_sharpnessAngle">
+     <property name="suffix">
+      <string>°</string>
+     </property>
+     <property name="maximum">
+      <number>90</number>
+     </property>
+     <property name="value">
+      <number>25</number>
+     </property>
+    </widget>
+   </item>
+   <item row="5" column="0">
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>PointSetUpsamplingDialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>248</x>
+     <y>254</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>PointSetUpsamplingDialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>316</x>
+     <y>260</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_wlop_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_wlop_plugin.cpp
new file mode 100644
index 0000000..dc74867
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_wlop_plugin.cpp
@@ -0,0 +1,131 @@
+#include "config.h"
+#include "Scene_points_with_normal_item.h"
+#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+
+#include <CGAL/wlop_simplify_and_regularize_point_set.h>
+#include <CGAL/compute_average_spacing.h>
+#include <CGAL/Timer.h>
+#include <CGAL/Memory_sizer.h>
+
+#include <QObject>
+#include <QAction>
+#include <QMainWindow>
+#include <QApplication>
+#include <QtPlugin>
+#include <QMessageBox>
+
+#include "ui_Point_set_wlop_plugin.h"
+
+// Concurrency
+#ifdef CGAL_LINKED_WITH_TBB
+typedef CGAL::Parallel_tag Concurrency_tag;
+#else
+typedef CGAL::Sequential_tag Concurrency_tag;
+#endif
+
+using namespace CGAL::Three;
+class Polyhedron_demo_point_set_wlop_plugin :
+  public QObject,
+  public Polyhedron_demo_plugin_helper
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+  
+  QAction* actionSimplifyAndRegularize;
+
+public:
+  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*) {
+    scene = scene_interface;
+    actionSimplifyAndRegularize = new QAction(tr("WLOP Simplification and Regularization Selection"), mainWindow);
+    actionSimplifyAndRegularize->setProperty("subMenuName","Point Set Processing");
+    actionSimplifyAndRegularize->setObjectName("actionSimplifyAndRegularize");
+    autoConnectActions();
+  }
+
+  bool applicable(QAction*) const {
+    return qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
+  }
+
+  QList<QAction*> actions() const {
+    return QList<QAction*>() << actionSimplifyAndRegularize;
+  }
+
+public Q_SLOTS:
+  void on_actionSimplifyAndRegularize_triggered();
+
+}; // end Polyhedron_demo_point_set_wlop_plugin
+
+class Point_set_demo_point_set_wlop_simplification_and_regularization_dialog : public QDialog, private Ui::WLOPRegularizationAndSimplificationDialog
+{
+  Q_OBJECT
+  public:
+    Point_set_demo_point_set_wlop_simplification_and_regularization_dialog(QWidget * /*parent*/ = 0)
+    {
+      setupUi(this);
+    }
+
+    double retainedPercentage() const { return m_retainedPercentage->value(); }
+    double neighborhoodRadius() const { return m_neighborhoodRadius->value(); }
+};
+
+void Polyhedron_demo_point_set_wlop_plugin::on_actionSimplifyAndRegularize_triggered()
+{
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+
+  Scene_points_with_normal_item* item =
+    qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
+
+  if(item)
+  {
+    // Gets point set
+    Point_set* points = item->point_set();
+    if(points == NULL)
+        return;
+
+    // Gets options
+    Point_set_demo_point_set_wlop_simplification_and_regularization_dialog dialog;
+    if(!dialog.exec())
+      return;
+
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+
+    CGAL::Timer task_timer; task_timer.start();
+
+    std::cerr << "Point cloud simplification and regularization by WLOP ("
+	      << dialog.retainedPercentage () << "% retained points, neighborhood radius = "
+	      << dialog.neighborhoodRadius() <<" * average spacing)...\n";
+
+    // Computes average spacing
+    double average_spacing = CGAL::compute_average_spacing<Concurrency_tag>(points->begin_or_selection_begin(),
+                                                           points->end(),
+							   6 /* knn = 1 ring */);
+
+    Scene_points_with_normal_item* new_item
+      = new Scene_points_with_normal_item();
+    new_item->setName (tr("%1 (WLOP processed)").arg(item->name()));
+    new_item->setVisible(true);
+    item->setVisible(false);
+    scene->addItem(new_item);
+    
+    CGAL::wlop_simplify_and_regularize_point_set<Concurrency_tag>
+      (points->begin_or_selection_begin(),
+       points->end(),
+       std::back_inserter(*(new_item->point_set ())),
+       dialog.retainedPercentage (),
+       dialog.neighborhoodRadius()*average_spacing
+       );
+
+    std::size_t memory = CGAL::Memory_sizer().virtual_size();
+    std::cerr << "Simplification and regularization: "
+	      << new_item->point_set ()->size () << " point(s) created ("
+	      << task_timer.time() << " seconds, "
+	      << (memory>>20) << " Mb allocated)"
+	      << std::endl;
+
+    QApplication::restoreOverrideCursor();
+  }
+}
+
+#include "Point_set_wlop_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_wlop_plugin.ui b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_wlop_plugin.ui
new file mode 100644
index 0000000..29f0278
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Point_set_wlop_plugin.ui
@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>WLOPRegularizationAndSimplificationDialog</class>
+ <widget class="QDialog" name="WLOPRegularizationAndSimplificationDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>539</width>
+    <height>480</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>WLOP Simplification and Regularization</string>
+  </property>
+  <layout class="QGridLayout" columnstretch="0,1">
+   <item row="3" column="0" colspan="2">
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="0">
+    <widget class="QLabel" name="label_3">
+     <property name="text">
+      <string>Neighborhood Radius</string>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="0">
+    <widget class="QLabel" name="label_2">
+     <property name="text">
+      <string>Retained Percentage</string>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="1">
+    <widget class="QDoubleSpinBox" name="m_retainedPercentage">
+     <property name="suffix">
+      <string> %</string>
+     </property>
+     <property name="decimals">
+      <number>2</number>
+     </property>
+     <property name="minimum">
+      <double>0.100000000000000</double>
+     </property>
+     <property name="maximum">
+      <double>100.000000000000000</double>
+     </property>
+     <property name="singleStep">
+      <double>0.100000000000000</double>
+     </property>
+     <property name="value">
+      <double>50.000000000000000</double>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="1">
+    <widget class="QDoubleSpinBox" name="m_neighborhoodRadius">
+     <property name="suffix">
+      <string> * average spacing</string>
+     </property>
+     <property name="decimals">
+      <number>2</number>
+     </property>
+     <property name="minimum">
+      <double>0.100000000000000</double>
+     </property>
+     <property name="maximum">
+      <double>10.000000000000000</double>
+     </property>
+     <property name="singleStep">
+      <double>0.100000000000000</double>
+     </property>
+     <property name="value">
+      <double>1.000000000000000</double>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="0">
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>WLOPRegularizationAndSimplificationDialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>248</x>
+     <y>254</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>WLOPRegularizationAndSimplificationDialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>316</x>
+     <y>260</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_plugin.cpp
new file mode 100644
index 0000000..f482815
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_plugin.cpp
@@ -0,0 +1,867 @@
+#include <QTime>
+#include <QApplication>
+#include <QAction>
+#include <QList>
+#include <QMainWindow>
+#include <QObject>
+
+#include <fstream>
+
+#include "Scene_polygon_soup_item.h"
+#include "Scene_polyhedron_item.h"
+#include "Scene_points_with_normal_item.h"
+#include "Polyhedron_type.h"
+#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+
+#include <CGAL/array.h>
+#include <CGAL/centroid.h>
+#include <CGAL/PCA_util.h>
+#include <CGAL/Search_traits_3.h>
+#include <CGAL/squared_distance_3.h>
+#include <CGAL/Orthogonal_k_neighbor_search.h>
+#include <CGAL/Default_diagonalize_traits.h>
+#include <CGAL/compute_average_spacing.h>
+#include <CGAL/grid_simplify_point_set.h>
+#include <CGAL/jet_smooth_point_set.h>
+#include <CGAL/jet_estimate_normals.h>
+#include <CGAL/mst_orient_normals.h>
+#include <CGAL/Scale_space_surface_reconstruction_3.h>
+#include <CGAL/Advancing_front_surface_reconstruction.h>
+
+#include "ui_Surface_reconstruction_plugin.h"
+
+// Concurrency
+#ifdef CGAL_LINKED_WITH_TBB
+typedef CGAL::Parallel_tag Concurrency_tag;
+#else
+typedef CGAL::Sequential_tag Concurrency_tag;
+#endif
+
+
+// Poisson reconstruction method:
+// Reconstructs a surface mesh from a point set and returns it as a polyhedron.
+Polyhedron* poisson_reconstruct(const Point_set& points,
+                                Kernel::FT sm_angle, // Min triangle angle (degrees). 
+                                Kernel::FT sm_radius, // Max triangle size w.r.t. point set average spacing. 
+                                Kernel::FT sm_distance, // Approximation error w.r.t. point set average spacing.
+                                const QString& solver, // solver name
+                                bool use_two_passes,
+				bool do_not_fill_holes);
+
+
+struct Radius {
+
+  double bound;
+
+  Radius(double bound)
+    : bound(bound)
+  {}
+
+  template <typename AdvancingFront, typename Cell_handle>
+  double operator() (const AdvancingFront& adv, Cell_handle& c,
+                     const int& index) const
+  {
+    // bound == 0 is better than bound < infinity
+    // as it avoids the distance computations
+    if(bound == 0){
+      return adv.smallest_radius_delaunay_sphere (c, index);
+    }
+
+    // If radius > bound, return infinity so that facet is not used
+    double d  = 0;
+    d = sqrt(squared_distance(c->vertex((index+1)%4)->point(),
+                              c->vertex((index+2)%4)->point()));
+    if(d>bound) return adv.infinity();
+    d = sqrt(squared_distance(c->vertex((index+2)%4)->point(),
+                               c->vertex((index+3)%4)->point()));
+    if(d>bound) return adv.infinity();
+    d = sqrt(squared_distance(c->vertex((index+1)%4)->point(),
+                               c->vertex((index+3)%4)->point()));
+    if(d>bound) return adv.infinity();
+
+    // Otherwise, return usual priority value: smallest radius of
+    // delaunay sphere
+    return adv.smallest_radius_delaunay_sphere (c, index);
+  }
+
+};
+
+
+namespace SurfaceReconstruction
+{
+  typedef Kernel::Point_3 Point;
+  typedef Kernel::Vector_3 Vector;
+  // types for K nearest neighbors search
+  typedef CGAL::Search_traits_3<Kernel> Tree_traits;
+  typedef CGAL::Orthogonal_k_neighbor_search<Tree_traits> Neighbor_search;
+  typedef Neighbor_search::Tree Tree;
+  typedef Neighbor_search::iterator Search_iterator;
+
+  typedef CGAL::Scale_space_surface_reconstruction_3<Kernel> ScaleSpace;
+  
+  template <typename OutputIterator>
+  void generate_scales (OutputIterator out,
+			const unsigned int scale_min = 6,
+			const double factor = 1.15,
+			unsigned int nb_scales = 30)
+  {
+    unsigned int prev = -1;
+    
+    for (unsigned int i = 0; i < nb_scales; ++ i)
+      {
+	unsigned int current = static_cast<unsigned int>(scale_min * std::pow (factor, i));
+	if (current != prev)
+	  {
+	    *(out ++) = current;
+	    prev = current;
+	  }
+	else
+	  ++ nb_scales;
+      }
+  }
+  
+  unsigned int scale_of_anisotropy (const Point_set& points, double& size)
+  {
+    Tree tree(points.begin_or_selection_begin(), points.end());
+    
+    double ratio_kept = (points.size() < 1000)
+      ? 1. : 1000. / (points.size());
+    
+    std::vector<Point> subset;
+    for (std::size_t i = 0; i < points.size (); ++ i)
+      if (rand() / (double)RAND_MAX < ratio_kept)
+    	subset.push_back (points[i]);
+    
+    std::vector<unsigned int> scales;
+    generate_scales (std::back_inserter (scales));
+
+    std::vector<unsigned int> chosen;
+
+    for (std::size_t i = 0; i < subset.size (); ++ i)
+      {
+    	Neighbor_search search(tree, subset[i],scales.back());
+	double current = 0.;
+    	unsigned int nb = 0;
+    	std::size_t index = 0;
+	double maximum = 0.;
+	unsigned int c = 0;
+	
+    	for (Search_iterator search_iterator = search.begin();
+    	     search_iterator != search.end (); ++ search_iterator, ++ nb)
+    	  {
+	    current += search_iterator->second;
+
+    	    if (nb + 1 == scales[index])
+    	      {
+		double score = std::sqrt (current / scales[index])
+		  / std::pow (scales[index], 0.75); // NB ^ (3/4)
+
+		if (score > maximum)
+		  {
+		    maximum = score;
+		    c = scales[index];
+		  }
+
+    		++ index;
+    		if (index == scales.size ())
+    		  break;
+    	      }
+    	  }
+	chosen.push_back (c);
+      }
+
+    double mean = 0.;
+    for (std::size_t i = 0; i < chosen.size(); ++ i)
+      mean += chosen[i];
+    mean /= chosen.size();
+    unsigned int aniso_scale = static_cast<unsigned int>(mean);
+
+    size = 0.;
+    for (std::size_t i = 0; i < subset.size (); ++ i)
+      {
+    	Neighbor_search search(tree, subset[i], aniso_scale);
+	size += std::sqrt ((-- search.end())->second);
+      }
+    size /= subset.size();
+    
+    return aniso_scale;
+  }
+
+  
+  unsigned int scale_of_noise (const Point_set& points, double& size)
+  {
+    Tree tree(points.begin_or_selection_begin(), points.end());
+    
+    double ratio_kept = (points.size() < 1000)
+      ? 1. : 1000. / (points.size());
+    
+    std::vector<Point> subset;
+    for (std::size_t i = 0; i < points.size (); ++ i)
+      if (rand() / (double)RAND_MAX < ratio_kept)
+    	subset.push_back (points[i]);
+    
+    std::vector<unsigned int> scales;
+    generate_scales (std::back_inserter (scales));
+
+    std::vector<unsigned int> chosen;
+    
+    for (std::size_t i = 0; i < subset.size (); ++ i)
+      {
+    	Neighbor_search search(tree, subset[i],scales.back());
+	double current = 0.;
+    	unsigned int nb = 0;
+    	std::size_t index = 0;
+	double minimum = (std::numeric_limits<double>::max)();
+	unsigned int c = 0;
+	
+    	for (Search_iterator search_iterator = search.begin();
+    	     search_iterator != search.end (); ++ search_iterator, ++ nb)
+    	  {
+	    current += search_iterator->second;
+
+    	    if (nb + 1 == scales[index])
+    	      {
+		double score = std::sqrt (current / scales[index])
+		  / std::pow (scales[index], 0.375); // NB ^ (5/12)
+
+		if (score < minimum)
+		  {
+		    minimum = score;
+		    c = scales[index];
+		  }
+
+    		++ index;
+    		if (index == scales.size ())
+    		  break;
+    	      }
+    	  }
+	chosen.push_back (c);
+      }
+
+    std::sort (chosen.begin (), chosen.end());
+
+    unsigned int noise_scale = chosen[chosen.size() / 2];
+    size = 0.;
+    for (std::size_t i = 0; i < subset.size (); ++ i)
+      {
+    	Neighbor_search search(tree, subset[i], noise_scale);
+	size += std::sqrt ((-- search.end())->second);
+      }
+    size /= subset.size();
+
+    
+    return noise_scale;
+  }
+
+  void simplify_point_set (Point_set& points, double size)
+  {
+    points.erase (CGAL::grid_simplify_point_set (points.begin (), points.end (), size),
+		  points.end ());
+  }
+
+  void smooth_point_set (Point_set& points, unsigned int scale)
+  {
+    CGAL::jet_smooth_point_set<Concurrency_tag>(points.begin(), points.end(),
+                                                scale);
+  }
+
+  template <typename ItemsInserter>
+  void scale_space (const Point_set& points, ItemsInserter items,
+		    unsigned int scale, bool generate_smooth = false,
+                    bool separate_shells = false, bool force_manifold = true,
+                    unsigned int samples = 300, unsigned int iterations = 4)
+  {
+    ScaleSpace reconstruct (scale, samples);
+    reconstruct.reconstruct_surface(points.begin_or_selection_begin(), points.end (), iterations,
+                                    separate_shells, force_manifold);
+
+    for( unsigned int sh = 0; sh < reconstruct.number_of_shells(); ++sh )
+      {
+        Scene_polygon_soup_item* new_item
+          = new Scene_polygon_soup_item ();
+        new_item->setColor(Qt::magenta);
+        new_item->setRenderingMode(FlatPlusEdges);
+        new_item->init_polygon_soup(points.size(), reconstruct.number_of_triangles ());
+
+        Scene_polygon_soup_item* smooth_item = NULL;
+        if (generate_smooth)
+          {
+            smooth_item = new Scene_polygon_soup_item ();
+            smooth_item->setColor(Qt::magenta);
+            smooth_item->setRenderingMode(FlatPlusEdges);
+            smooth_item->init_polygon_soup(points.size(), reconstruct.number_of_triangles ());
+          }
+
+        std::map<unsigned int, unsigned int> map_i2i;
+        unsigned int current_index = 0;
+    
+        for (ScaleSpace::Triple_iterator it = reconstruct.shell_begin (sh);
+             it != reconstruct.shell_end (sh); ++ it)
+          {
+            for (unsigned int ind = 0; ind < 3; ++ ind)
+              {
+                if (map_i2i.find ((*it)[ind]) == map_i2i.end ())
+                  {
+                    map_i2i.insert (std::make_pair ((*it)[ind], current_index ++));
+                    Point p = (points.begin_or_selection_begin() + (*it)[ind])->position();
+                    new_item->new_vertex (p.x (), p.y (), p.z ());
+                    
+                    if (generate_smooth)
+                      {
+                        p = *(reconstruct.points_begin() + (*it)[ind]);
+                        smooth_item->new_vertex (p.x (), p.y (), p.z ());
+                      }
+                  }
+              }
+            new_item->new_triangle( map_i2i[(*it)[0]],
+                                    map_i2i[(*it)[1]],
+                                    map_i2i[(*it)[2]] );
+            if (generate_smooth)
+              smooth_item->new_triangle( map_i2i[(*it)[0]],
+                                         map_i2i[(*it)[1]],
+                                         map_i2i[(*it)[2]] );
+              
+          }
+
+        *(items ++) = new_item;
+        if (generate_smooth)
+          *(items ++) = smooth_item;
+      }
+
+    if (force_manifold)
+      {
+        std::ptrdiff_t num = std::distance( reconstruct.garbage_begin(  ),
+                                            reconstruct.garbage_end(  ) );
+
+        Scene_polygon_soup_item* new_item
+          = new Scene_polygon_soup_item ();
+        new_item->setColor(Qt::blue);
+        new_item->setRenderingMode(FlatPlusEdges);
+        new_item->init_polygon_soup(points.size(), num);
+
+        Scene_polygon_soup_item* smooth_item = NULL;
+        if (generate_smooth)
+          {
+            smooth_item = new Scene_polygon_soup_item ();
+            smooth_item->setColor(Qt::blue);
+            smooth_item->setRenderingMode(FlatPlusEdges);
+            smooth_item->init_polygon_soup(points.size(), num);
+          }
+
+        std::map<unsigned int, unsigned int> map_i2i;
+
+        unsigned int current_index = 0;
+        for (ScaleSpace::Triple_iterator it=reconstruct.garbage_begin(),
+               end=reconstruct.garbage_end();it!=end;++it)
+          {
+            for (unsigned int ind = 0; ind < 3; ++ ind)
+              {
+                if (map_i2i.find ((*it)[ind]) == map_i2i.end ())
+                  {
+                    map_i2i.insert (std::make_pair ((*it)[ind], current_index ++));
+                    Point p = (points.begin_or_selection_begin() + (*it)[ind])->position();
+                    new_item->new_vertex (p.x (), p.y (), p.z ());
+                    
+                    if (generate_smooth)
+                      {
+                        p = *(reconstruct.points_begin() + (*it)[ind]);
+                        smooth_item->new_vertex (p.x (), p.y (), p.z ());
+                      }
+                  }
+
+              }
+            new_item->new_triangle( map_i2i[(*it)[0]],
+                                    map_i2i[(*it)[1]],
+                                    map_i2i[(*it)[2]] );
+            if (generate_smooth)
+              smooth_item->new_triangle( map_i2i[(*it)[0]],
+                                         map_i2i[(*it)[1]],
+                                         map_i2i[(*it)[2]] );
+          }
+
+        *(items ++) = new_item;
+        if (generate_smooth)
+          *(items ++) = smooth_item;
+
+      }
+  }
+  
+  void advancing_front (const Point_set& points, Scene_polyhedron_item* new_item, double size,
+                        double radius_ratio_bound = 5., double beta = 0.52)
+  {
+    Polyhedron& P = * const_cast<Polyhedron*>(new_item->polyhedron());
+    Radius filter (size);
+    CGAL::advancing_front_surface_reconstruction (points.begin_or_selection_begin(), points.end (), P, filter,
+                                                  radius_ratio_bound, beta);
+						  
+  }
+
+  void compute_normals (Point_set& points, unsigned int neighbors)
+  {
+    CGAL::jet_estimate_normals<Concurrency_tag>(points.begin_or_selection_begin(), points.end(),
+                                                CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()),
+                                                2 * neighbors);
+  }
+  
+}
+
+
+
+class Polyhedron_demo_surface_reconstruction_plugin_dialog : public QDialog, private Ui::SurfaceReconstructionDialog
+{
+  Q_OBJECT
+public:
+  Polyhedron_demo_surface_reconstruction_plugin_dialog(QWidget* /*parent*/ = 0)
+  {
+    setupUi(this);
+    
+#ifdef CGAL_EIGEN3_ENABLED
+    m_inputSolver->addItem("Eigen - built-in CG");
+    m_inputSolver->addItem("Eigen - built-in simplicial LDLt");
+#endif
+  }
+
+  unsigned int method () const
+  {
+    if (buttonAuto->isChecked ())       return 0;
+    if (buttonAdvancing->isChecked ())  return 1;
+    if (buttonScaleSpace->isChecked ()) return 2;
+    if (buttonPoisson->isChecked ())    return 3;
+    return -1;
+  }
+  bool boundaries () const { return m_boundaries->isChecked (); }
+  bool interpolate () const { return m_interpolate->isChecked (); }
+  double longest_edge () const { return m_longestEdge->value (); }
+  double radius_ratio_bound () const { return m_radiusRatioBound->value (); }
+  double beta_angle () const { return m_betaAngle->value (); }
+  unsigned int neighbors () const { return m_neighbors->value (); }
+  unsigned int samples () const { return m_samples->value (); }
+  unsigned int iterations () const { return m_iterations->value (); }
+  bool separate_shells () const { return m_genShells->isChecked (); }
+  bool force_manifold () const { return m_forceManifold->isChecked (); }
+  bool generate_smoothed () const { return m_genSmooth->isChecked (); }
+  double angle () const { return m_inputAngle->value (); }
+  double radius () const { return m_inputRadius->value (); }
+  double distance () const { return m_inputDistance->value (); }
+  bool two_passes () const { return m_inputTwoPasses->isChecked (); }
+  bool do_not_fill_holes () const { return m_doNotFillHoles->isChecked (); }
+  QString solver () const { return m_inputSolver->currentText (); }
+};
+
+#include <CGAL/Scale_space_surface_reconstruction_3.h>
+
+class Polyhedron_demo_surface_reconstruction_plugin :
+  public QObject,
+  public CGAL::Three::Polyhedron_demo_plugin_helper
+{
+  Q_OBJECT
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  QAction* actionSurfaceReconstruction;
+
+public:
+  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*) {
+    scene = scene_interface;
+    actionSurfaceReconstruction = new QAction(tr("Surface Reconstruction"), mainWindow);
+    actionSurfaceReconstruction->setObjectName("actionSurfaceReconstruction");
+    autoConnectActions();
+
+  }
+
+  void automatic_reconstruction (const Polyhedron_demo_surface_reconstruction_plugin_dialog& dialog);
+  void advancing_front_reconstruction (const Polyhedron_demo_surface_reconstruction_plugin_dialog& dialog);
+  void scale_space_reconstruction (const Polyhedron_demo_surface_reconstruction_plugin_dialog& dialog);
+  void poisson_reconstruction (const Polyhedron_demo_surface_reconstruction_plugin_dialog& dialog);
+  
+  //! Applicate for Point_sets with normals.
+  bool applicable(QAction*) const {
+    return qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
+  }
+
+  QList<QAction*> actions() const {
+    return QList<QAction*>() << actionSurfaceReconstruction;
+  }
+
+public Q_SLOTS:
+  void on_actionSurfaceReconstruction_triggered();
+}; // end class Polyhedron_surface_reconstruction_plugin
+
+
+void Polyhedron_demo_surface_reconstruction_plugin::on_actionSurfaceReconstruction_triggered()
+{
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+
+  Scene_points_with_normal_item* pts_item =
+    qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
+
+  if(pts_item)
+    {
+      //generate the dialog box to set the options
+      Polyhedron_demo_surface_reconstruction_plugin_dialog dialog;
+      dialog.setWindowFlags(Qt::Dialog|Qt::CustomizeWindowHint|Qt::WindowCloseButtonHint);
+      if(!dialog.exec())
+	return;
+
+      unsigned int method = dialog.method ();
+      switch (method)
+        {
+        case 0:
+          automatic_reconstruction (dialog);
+          break;
+        case 1:
+          advancing_front_reconstruction (dialog);
+          break;
+        case 2:
+          scale_space_reconstruction (dialog);
+          break;
+        case 3:
+          poisson_reconstruction (dialog);
+          break;
+        default:
+          std::cerr << "Error: unkown method." << std::endl;
+          return;
+        }
+      
+
+    }
+}
+
+void Polyhedron_demo_surface_reconstruction_plugin::automatic_reconstruction
+(const Polyhedron_demo_surface_reconstruction_plugin_dialog& dialog)
+{
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+
+  Scene_points_with_normal_item* pts_item =
+    qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
+
+  if(pts_item)
+    {
+      // Gets point set
+      Point_set* points = pts_item->point_set();
+      // wait cursor
+      QApplication::setOverrideCursor(Qt::WaitCursor);
+
+      QTime time;
+      std::cout << "Meta surface reconstruction with the following requirements:" << std::endl
+		<< (dialog.boundaries() ? " * Output shape has boundaries" : " * Output shape is closed") << std::endl
+		<< (dialog.interpolate() ? " * Output shape passes through input points"
+		    : " * Output shape approximates input points") << std::endl;
+
+      Scene_points_with_normal_item* new_item = NULL;
+      if (!(dialog.interpolate()))
+	{
+	  new_item = new Scene_points_with_normal_item();
+	  new_item->setName(QString("%1 (preprocessed)").arg(pts_item->name()));
+	  new_item->set_has_normals (pts_item->has_normals());
+	  new_item->setColor(pts_item->color());
+	  new_item->setRenderingMode(pts_item->renderingMode());
+	  new_item->setVisible(pts_item->visible());
+	  new_item->resetSelection();
+	  new_item->invalidateOpenGLBuffers();
+
+	  points = new_item->point_set();
+	  std::copy (points->begin_or_selection_begin(), pts_item->point_set()->end(),
+		     std::back_inserter (*points));
+	}
+
+      std::cerr << "Analysing isotropy of point set... ";
+      time.start();
+      double aniso_size;
+      unsigned int aniso_scale = SurfaceReconstruction::scale_of_anisotropy (*points, aniso_size);
+      std::cerr << "ok (" << time.elapsed() << " ms)" << std::endl;
+
+      std::cerr << " -> Scale / size = " << aniso_scale << " / " << aniso_size << std::endl;
+      
+      bool isotropic = (aniso_scale == 6);
+      std::cerr << (isotropic ? " -> Point set is isotropic" : " -> Point set is anisotropic") << std::endl;
+      if (!(dialog.interpolate()) && !isotropic)
+	{
+	  std::cerr << "Correcting anisotropy of point set... ";
+	  time.restart();
+	  std::size_t prev_size = points->size ();
+	  SurfaceReconstruction::simplify_point_set (*points, aniso_size);
+	  std::cerr << "ok (" << time.elapsed() << " ms)" << std::endl;
+	  std::cerr << " -> " << prev_size - points->size() << " point(s) removed ("
+		    << 100. * (prev_size - points->size()) / (double)(prev_size)
+		    << "%)" << std::endl;
+	}
+
+      std::cerr << "Analysing noise of point set... ";
+      time.restart();
+      double noise_size;
+      unsigned int noise_scale = SurfaceReconstruction::scale_of_noise (*points, noise_size);
+      std::cerr << "ok (" << time.elapsed() << " ms)" << std::endl;
+      
+      std::cerr << " -> Scale / size = " << noise_scale << " / " << noise_size << std::endl;
+      
+      bool noisy = (noise_scale > 6);
+      std::cerr << (noisy ? " -> Point set is noisy" : " -> Point set is noise-free") << std::endl;
+      
+      if (!(dialog.interpolate()) && noisy)
+	{
+	  std::cerr << "Denoising point set... ";
+	  time.restart();
+	  SurfaceReconstruction::smooth_point_set (*points, noise_scale);
+          new_item->set_has_normals (false);
+	  std::cerr << "ok (" << time.elapsed() << " ms)" << std::endl;
+	}
+
+      if (dialog.interpolate())
+	{
+	  if (noisy)
+	    { 
+	      std::cerr << "Scale space reconstruction... ";
+	      time.restart();
+
+              std::vector<Scene_polygon_soup_item*> reco_items;
+
+	      SurfaceReconstruction::scale_space (*points, std::back_inserter (reco_items),
+                                                  (std::max)(noise_scale, aniso_scale));
+	      
+              for (std::size_t i = 0; i < reco_items.size (); ++ i)
+                {
+                  reco_items[i]->setName(tr("%1 (scale space)").arg(scene->item(index)->name()));
+                  scene->addItem (reco_items[i]);
+                }
+
+	      std::cerr << "ok (" << time.elapsed() << " ms)" << std::endl;
+	    }
+	  else
+	    {
+	      std::cerr << "Advancing front reconstruction... ";
+	      time.restart();
+
+	      Scene_polyhedron_item* reco_item = new Scene_polyhedron_item(Polyhedron());
+	      SurfaceReconstruction::advancing_front (*points, reco_item, 10. * (std::max)(noise_size, aniso_size));
+	      
+	      reco_item->setName(tr("%1 (advancing front)").arg(scene->item(index)->name()));
+	      reco_item->setColor(Qt::magenta);
+	      reco_item->setRenderingMode(FlatPlusEdges);
+	      scene->addItem(reco_item);
+
+	      std::cerr << "ok (" << time.elapsed() << " ms)" << std::endl;
+	    }
+
+	}
+      else
+	{
+	  if (dialog.boundaries())
+	    {
+	      std::cerr << "Advancing front reconstruction... ";
+	      time.restart();
+
+	      Scene_polyhedron_item* reco_item = new Scene_polyhedron_item(Polyhedron());
+	      SurfaceReconstruction::advancing_front (*points, reco_item, 10. * (std::max)(noise_size, aniso_size));
+	      
+	      reco_item->setName(tr("%1 (advancing front)").arg(scene->item(index)->name()));
+	      reco_item->setColor(Qt::magenta);
+	      reco_item->setRenderingMode(FlatPlusEdges);
+	      scene->addItem(reco_item);
+
+	      std::cerr << "ok (" << time.elapsed() << " ms)" << std::endl;
+	    }
+	  else
+	    {
+	      if (!(new_item->has_normals()))
+		{
+		  std::cerr << "Estimation of normal vectors... ";
+		  time.restart();
+
+		  SurfaceReconstruction::compute_normals (*points, noise_scale);
+		  
+		  new_item->set_has_normals (true);
+		  new_item->setRenderingMode(PointsPlusNormals);
+		  
+		  std::cerr << "ok (" << time.elapsed() << " ms)" << std::endl;
+		}
+	      
+	      std::cerr << "Poisson reconstruction... ";
+	      time.restart();
+
+	      Polyhedron* pRemesh = poisson_reconstruct(*points, 20,
+							100 * (std::max)(noise_size, aniso_size),
+							(std::max)(noise_size, aniso_size),
+							QString ("Eigen - built-in CG"), false, false);
+	      if(pRemesh)
+
+		{
+		  // Add polyhedron to scene
+		  Scene_polyhedron_item* reco_item = new Scene_polyhedron_item(pRemesh);
+		  reco_item->setName(tr("%1 (poisson)").arg(pts_item->name()));
+		  reco_item->setColor(Qt::lightGray);
+		  scene->addItem(reco_item);
+		}
+
+	      std::cerr << "ok (" << time.elapsed() << " ms)" << std::endl;
+	    }
+	}
+
+      if (!(dialog.interpolate()))
+	{
+	  if (noisy || !isotropic)
+	    scene->addItem(new_item);
+	  else
+	    delete new_item;
+	}
+
+      // default cursor
+      QApplication::restoreOverrideCursor();
+    }
+}
+
+
+void Polyhedron_demo_surface_reconstruction_plugin::advancing_front_reconstruction
+(const Polyhedron_demo_surface_reconstruction_plugin_dialog& dialog)
+{
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+
+  Scene_points_with_normal_item* pts_item =
+    qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
+
+  if(pts_item)
+    {
+      // Gets point set
+      Point_set* points = pts_item->point_set();
+
+      // wait cursor
+      QApplication::setOverrideCursor(Qt::WaitCursor);
+
+      std::cerr << "Advancing front reconstruction... ";
+
+      Scene_polyhedron_item* reco_item = new Scene_polyhedron_item(Polyhedron());
+      SurfaceReconstruction::advancing_front (*points, reco_item,
+                                              dialog.longest_edge (),
+                                              dialog.radius_ratio_bound (),
+                                              CGAL_PI * dialog.beta_angle () / 180.);
+	      
+      reco_item->setName(tr("%1 (advancing front)").arg(scene->item(index)->name()));
+      reco_item->setColor(Qt::magenta);
+      reco_item->setRenderingMode(FlatPlusEdges);
+      scene->addItem(reco_item);
+
+      QApplication::restoreOverrideCursor();
+    }
+}
+
+
+void Polyhedron_demo_surface_reconstruction_plugin::scale_space_reconstruction
+(const Polyhedron_demo_surface_reconstruction_plugin_dialog& dialog)
+{
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+
+  Scene_points_with_normal_item* pts_item =
+    qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
+
+  if(pts_item)
+    {
+      // Gets point set
+      Point_set* points = pts_item->point_set();
+
+      // wait cursor
+      QApplication::setOverrideCursor(Qt::WaitCursor);
+
+      std::cout << "Scale scape surface reconstruction...";
+      
+      std::vector<Scene_polygon_soup_item*> reco_items;
+
+      SurfaceReconstruction::scale_space (*points, std::back_inserter (reco_items),
+                                          dialog.neighbors (),
+                                          dialog.generate_smoothed (),
+                                          dialog.separate_shells (),
+                                          dialog.force_manifold (),
+                                          dialog.samples (),
+                                          dialog.iterations ());
+
+      for (std::size_t i = 0; i < reco_items.size (); ++ i)
+        {
+          if (dialog.force_manifold () && i > reco_items.size () - 3)
+            {
+              if (dialog.generate_smoothed () && i % 2)
+                reco_items[i]->setName(tr("%1 (scale space smooth garbage)").arg(scene->item(index)->name()));
+              else
+                reco_items[i]->setName(tr("%1 (scale space garbage)").arg(scene->item(index)->name()));
+            }
+          else
+            {
+              if (dialog.generate_smoothed ())
+                {
+                  if (i % 2)
+                    reco_items[i]->setName(tr("%1 (scale space smooth shell %2)").arg(scene->item(index)->name()).arg((i+1)/2));
+                  else
+                    reco_items[i]->setName(tr("%1 (scale space shell %2)").arg(scene->item(index)->name()).arg(((i+1)/2)+1));
+                }
+              else
+                reco_items[i]->setName(tr("%1 (scale space shell %2)").arg(scene->item(index)->name()).arg(i+1));
+            }
+          scene->addItem (reco_items[i]);
+        }
+
+      QApplication::restoreOverrideCursor();
+    }
+}
+
+
+void Polyhedron_demo_surface_reconstruction_plugin::poisson_reconstruction
+(const Polyhedron_demo_surface_reconstruction_plugin_dialog& dialog)
+{
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+
+  Scene_points_with_normal_item* point_set_item =
+    qobject_cast<Scene_points_with_normal_item*>(scene->item(index));
+
+  if(point_set_item)
+    {
+      // Gets point set
+      Point_set* points = point_set_item->point_set();
+      if(!points) return;
+
+      const double sm_angle     = dialog.angle ();
+      const double sm_radius    = dialog.radius ();
+      const double sm_distance  = dialog.distance ();
+      const QString sm_solver   = dialog.solver();
+      bool use_two_passes = dialog.two_passes();
+      bool do_not_fill_holes = dialog.do_not_fill_holes();
+
+      QApplication::setOverrideCursor(Qt::WaitCursor);
+
+      if (!(point_set_item->has_normals()))
+        {
+          std::cerr << "Estimation of normal vectors... ";
+
+          SurfaceReconstruction::compute_normals (*points, 12);
+		  
+          point_set_item->set_has_normals (true);
+          point_set_item->setRenderingMode(PointsPlusNormals);
+
+        }
+
+
+      // Reconstruct point set as a polyhedron
+      Polyhedron* pRemesh = poisson_reconstruct(*points, sm_angle, sm_radius, sm_distance, sm_solver, use_two_passes,
+                                                do_not_fill_holes);
+      if(pRemesh)
+        {
+          // Add polyhedron to scene
+          Scene_polyhedron_item* new_item = new Scene_polyhedron_item(pRemesh);
+          new_item->setName(tr("%1 Poisson (%2 %3 %4)")
+                            .arg(point_set_item->name())
+                            .arg(sm_angle)
+                            .arg(sm_radius)
+                            .arg(sm_distance));
+          new_item->setColor(Qt::lightGray);
+          scene->addItem(new_item);
+
+
+          // Hide point set
+          point_set_item->setVisible(false);
+          scene->itemChanged(index);
+        }
+
+      QApplication::restoreOverrideCursor();
+    }
+}
+
+
+#include "Surface_reconstruction_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_plugin.ui b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_plugin.ui
new file mode 100644
index 0000000..59638ff
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_plugin.ui
@@ -0,0 +1,496 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>SurfaceReconstructionDialog</class>
+ <widget class="QDialog" name="SurfaceReconstructionDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>423</width>
+    <height>723</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Surface Reconstruction</string>
+  </property>
+  <layout class="QGridLayout" name="gridLayout_2">
+   <item row="5" column="0">
+    <widget class="QFrame" name="frameScaleSpace">
+     <property name="enabled">
+      <bool>false</bool>
+     </property>
+     <property name="frameShape">
+      <enum>QFrame::StyledPanel</enum>
+     </property>
+     <property name="frameShadow">
+      <enum>QFrame::Raised</enum>
+     </property>
+     <layout class="QFormLayout" name="formLayout_2">
+      <item row="0" column="0">
+       <widget class="QLabel" name="label_2">
+        <property name="text">
+         <string>Average Neighborhood Size</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <widget class="QSpinBox" name="m_neighbors">
+        <property name="minimum">
+         <number>0</number>
+        </property>
+        <property name="maximum">
+         <number>100000</number>
+        </property>
+        <property name="value">
+         <number>30</number>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="0">
+       <widget class="QLabel" name="label_4">
+        <property name="text">
+         <string>Size of Sample to Estimate Neighborhood</string>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="1">
+       <widget class="QSpinBox" name="m_samples">
+        <property name="maximum">
+         <number>1000000</number>
+        </property>
+        <property name="value">
+         <number>200</number>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="0">
+       <widget class="QLabel" name="label_3">
+        <property name="text">
+         <string>Iterations</string>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="1">
+       <widget class="QSpinBox" name="m_iterations">
+        <property name="minimum">
+         <number>1</number>
+        </property>
+        <property name="maximum">
+         <number>1000000</number>
+        </property>
+        <property name="value">
+         <number>4</number>
+        </property>
+       </widget>
+      </item>
+      <item row="3" column="0">
+       <widget class="QCheckBox" name="m_genShells">
+        <property name="text">
+         <string>Generate separate shells</string>
+        </property>
+        <property name="checked">
+         <bool>false</bool>
+        </property>
+       </widget>
+      </item>
+      <item row="4" column="0">
+       <widget class="QCheckBox" name="m_forceManifold">
+        <property name="text">
+         <string>Force manifold output</string>
+        </property>
+        <property name="checked">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item row="5" column="0">
+       <widget class="QCheckBox" name="m_genSmooth">
+        <property name="text">
+         <string>Smoothed version</string>
+        </property>
+        <property name="checked">
+         <bool>false</bool>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item row="1" column="0">
+    <widget class="QFrame" name="frameAuto">
+     <property name="frameShape">
+      <enum>QFrame::StyledPanel</enum>
+     </property>
+     <property name="frameShadow">
+      <enum>QFrame::Raised</enum>
+     </property>
+     <layout class="QVBoxLayout" name="verticalLayout">
+      <item>
+       <widget class="QCheckBox" name="m_boundaries">
+        <property name="text">
+         <string>Output surface has boundaries</string>
+        </property>
+        <property name="checked">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QCheckBox" name="m_interpolate">
+        <property name="text">
+         <string>Output surface must pass exactly through input points</string>
+        </property>
+        <property name="checked">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item row="9" column="0">
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+   <item row="4" column="0">
+    <widget class="QRadioButton" name="buttonScaleSpace">
+     <property name="text">
+      <string>Scale Space Reconstruction</string>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="0">
+    <widget class="QRadioButton" name="buttonAuto">
+     <property name="text">
+      <string>Select Method and Parameters Automatically</string>
+     </property>
+     <property name="checked">
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+   <item row="3" column="0">
+    <widget class="QFrame" name="frameAdvancing">
+     <property name="enabled">
+      <bool>false</bool>
+     </property>
+     <property name="frameShape">
+      <enum>QFrame::StyledPanel</enum>
+     </property>
+     <property name="frameShadow">
+      <enum>QFrame::Raised</enum>
+     </property>
+     <layout class="QFormLayout" name="formLayout">
+      <item row="0" column="0">
+       <widget class="QLabel" name="label">
+        <property name="text">
+         <string>Longest Edge</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <widget class="QDoubleSpinBox" name="m_longestEdge">
+        <property name="maximum">
+         <double>999999999.000000000000000</double>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="0">
+       <widget class="QLabel" name="label_9">
+        <property name="text">
+         <string>Radius Ratio Bound</string>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="0">
+       <widget class="QLabel" name="label_10">
+        <property name="text">
+         <string>Beta Angle</string>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="1">
+       <widget class="QDoubleSpinBox" name="m_radiusRatioBound">
+        <property name="minimum">
+         <double>0.010000000000000</double>
+        </property>
+        <property name="maximum">
+         <double>1000.000000000000000</double>
+        </property>
+        <property name="value">
+         <double>5.000000000000000</double>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="1">
+       <widget class="QDoubleSpinBox" name="m_betaAngle">
+        <property name="suffix">
+         <string>°</string>
+        </property>
+        <property name="maximum">
+         <double>150.000000000000000</double>
+        </property>
+        <property name="value">
+         <double>30.000000000000000</double>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item row="6" column="0">
+    <widget class="QRadioButton" name="buttonPoisson">
+     <property name="text">
+      <string>Poisson Reconstruction</string>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="0">
+    <widget class="QRadioButton" name="buttonAdvancing">
+     <property name="text">
+      <string>Advancing Front Reconstruction</string>
+     </property>
+    </widget>
+   </item>
+   <item row="7" column="0">
+    <widget class="QFrame" name="framePoisson">
+     <property name="enabled">
+      <bool>false</bool>
+     </property>
+     <property name="frameShape">
+      <enum>QFrame::StyledPanel</enum>
+     </property>
+     <property name="frameShadow">
+      <enum>QFrame::Raised</enum>
+     </property>
+     <layout class="QFormLayout" name="formLayout_3">
+      <item row="0" column="0">
+       <widget class="QLabel" name="label_5">
+        <property name="text">
+         <string>Min Triangle Angle:</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <widget class="QDoubleSpinBox" name="m_inputAngle">
+        <property name="suffix">
+         <string> °</string>
+        </property>
+        <property name="minimum">
+         <double>1.000000000000000</double>
+        </property>
+        <property name="maximum">
+         <double>30.000000000000000</double>
+        </property>
+        <property name="value">
+         <double>20.000000000000000</double>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="0">
+       <widget class="QLabel" name="label_7">
+        <property name="text">
+         <string>Max Triangle Size:</string>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="1">
+       <widget class="QDoubleSpinBox" name="m_inputRadius">
+        <property name="suffix">
+         <string> * average spacing</string>
+        </property>
+        <property name="decimals">
+         <number>0</number>
+        </property>
+        <property name="minimum">
+         <double>1.000000000000000</double>
+        </property>
+        <property name="maximum">
+         <double>1000.000000000000000</double>
+        </property>
+        <property name="singleStep">
+         <double>1.000000000000000</double>
+        </property>
+        <property name="value">
+         <double>100.000000000000000</double>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="0">
+       <widget class="QLabel" name="label_6">
+        <property name="text">
+         <string>Approximation Error:</string>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="1">
+       <widget class="QDoubleSpinBox" name="m_inputDistance">
+        <property name="suffix">
+         <string> * average spacing</string>
+        </property>
+        <property name="decimals">
+         <number>6</number>
+        </property>
+        <property name="minimum">
+         <double>0.010000000000000</double>
+        </property>
+        <property name="maximum">
+         <double>100.000000000000000</double>
+        </property>
+        <property name="singleStep">
+         <double>0.010000000000000</double>
+        </property>
+        <property name="value">
+         <double>0.250000000000000</double>
+        </property>
+       </widget>
+      </item>
+      <item row="3" column="0">
+       <widget class="QLabel" name="label_8">
+        <property name="text">
+         <string>Solver:</string>
+        </property>
+       </widget>
+      </item>
+      <item row="3" column="1">
+       <widget class="QComboBox" name="m_inputSolver">
+        <property name="toolTip">
+         <string extracomment="Name of the sparse solver"/>
+        </property>
+       </widget>
+      </item>
+      <item row="4" column="0">
+       <widget class="QCheckBox" name="m_inputTwoPasses">
+        <property name="text">
+         <string>Perform two passes</string>
+        </property>
+       </widget>
+      </item>
+      <item row="5" column="0">
+       <widget class="QCheckBox" name="m_doNotFillHoles">
+        <property name="text">
+         <string>Do not fill holes</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item row="8" column="0">
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>SurfaceReconstructionDialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>198</x>
+     <y>640</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>198</x>
+     <y>331</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>SurfaceReconstructionDialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>198</x>
+     <y>640</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>198</x>
+     <y>331</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonAdvancing</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>frameAdvancing</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>198</x>
+     <y>116</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>198</x>
+     <y>155</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonAuto</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>frameAuto</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>198</x>
+     <y>18</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>198</x>
+     <y>67</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonPoisson</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>framePoisson</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>198</x>
+     <y>414</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>198</x>
+     <y>525</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonScaleSpace</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>frameScaleSpace</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>198</x>
+     <y>194</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>198</x>
+     <y>304</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_plugin_impl.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_plugin_impl.cpp
new file mode 100644
index 0000000..4fbe361
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_plugin_impl.cpp
@@ -0,0 +1,238 @@
+//----------------------------------------------------------
+// Poisson reconstruction method:
+// Reconstructs a surface mesh from a point set and returns it as a polyhedron.
+//----------------------------------------------------------
+
+
+// CGAL
+#include <CGAL/AABB_tree.h> // must be included before kernel
+#include <CGAL/AABB_traits.h>
+#include <CGAL/AABB_face_graph_triangle_primitive.h>
+#include <CGAL/Timer.h>
+#include <CGAL/Surface_mesh_default_triangulation_3.h>
+#include <CGAL/make_surface_mesh.h>
+#include <CGAL/Implicit_surface_3.h>
+#include <CGAL/IO/output_surface_facets_to_polyhedron.h>
+#include <CGAL/Poisson_reconstruction_function.h>
+#include <CGAL/compute_average_spacing.h>
+
+#ifdef CGAL_EIGEN3_ENABLED
+#include <CGAL/Eigen_solver_traits.h>
+#endif
+
+#include <math.h>
+
+#include "Kernel_type.h"
+#include "Polyhedron_type.h"
+#include "Scene_points_with_normal_item.h"
+
+
+// Poisson implicit function
+typedef CGAL::Poisson_reconstruction_function<Kernel> Poisson_reconstruction_function;
+
+// Surface mesher
+typedef CGAL::Surface_mesh_default_triangulation_3 STr;
+typedef CGAL::Surface_mesh_complex_2_in_triangulation_3<STr> C2t3;
+typedef CGAL::Implicit_surface_3<Kernel, Poisson_reconstruction_function> Surface_3;
+
+// AABB tree
+typedef CGAL::AABB_face_graph_triangle_primitive<Polyhedron> Primitive;
+typedef CGAL::AABB_traits<Kernel, Primitive> AABB_traits;
+typedef CGAL::AABB_tree<AABB_traits> AABB_tree;
+
+// Concurrency
+#ifdef CGAL_LINKED_WITH_TBB
+typedef CGAL::Parallel_tag Concurrency_tag;
+#else
+typedef CGAL::Sequential_tag Concurrency_tag;
+#endif
+
+
+
+// Poisson reconstruction method:
+// Reconstructs a surface mesh from a point set and returns it as a polyhedron.
+Polyhedron* poisson_reconstruct(const Point_set& points,
+                                Kernel::FT sm_angle, // Min triangle angle (degrees).
+                                Kernel::FT sm_radius, // Max triangle size w.r.t. point set average spacing.
+                                Kernel::FT sm_distance, // Approximation error w.r.t. point set average spacing.
+                                const QString& solver_name, // solver name
+                                bool use_two_passes,
+				bool do_not_fill_holes)
+{
+    CGAL::Timer task_timer; task_timer.start();
+
+    //***************************************
+    // Checks requirements
+    //***************************************
+
+    if (points.size() == 0)
+    {
+      std::cerr << "Error: empty point set" << std::endl;
+      return NULL;
+    }
+
+    CGAL::Timer reconstruction_timer; reconstruction_timer.start();
+
+    //***************************************
+    // Computes implicit function
+    //***************************************
+
+ 
+    std::cerr << "Computes Poisson implicit function "
+              << "using " << solver_name.toLatin1().data() << " solver...\n";
+              
+    
+    // Creates implicit function from the point set.
+    // Note: this method requires an iterator over points
+    // + property maps to access each point's position and normal.
+    // The position property map can be omitted here as we use iterators over Point_3 elements.
+    Poisson_reconstruction_function function(
+                              points.begin_or_selection_begin(), points.end(),
+                              CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()));
+
+    bool ok = false;    
+    #ifdef CGAL_EIGEN3_ENABLED
+    if(solver_name=="Eigen - built-in simplicial LDLt")
+    {
+      CGAL::Eigen_solver_traits<Eigen::SimplicialCholesky<CGAL::Eigen_sparse_matrix<double>::EigenType> > solver;
+      ok = function.compute_implicit_function(solver, use_two_passes);
+    }
+    if(solver_name=="Eigen - built-in CG")
+    {
+      CGAL::Eigen_solver_traits<Eigen::ConjugateGradient<CGAL::Eigen_sparse_matrix<double>::EigenType> > solver;
+      solver.solver().setTolerance(1e-6);
+      solver.solver().setMaxIterations(1000);
+      ok = function.compute_implicit_function(solver, use_two_passes);
+    }
+    #endif
+
+    // Computes the Poisson indicator function f()
+    // at each vertex of the triangulation.
+    if ( ! ok )
+    {
+      std::cerr << "Error: cannot compute implicit function" << std::endl;
+      return NULL;
+    }
+
+    // Prints status
+    std::cerr << "Total implicit function (triangulation+refinement+solver): " << task_timer.time() << " seconds\n";
+    task_timer.reset();
+
+    //***************************************
+    // Surface mesh generation
+    //***************************************
+
+    std::cerr << "Surface meshing...\n";
+
+    // Computes average spacing
+    Kernel::FT average_spacing = CGAL::compute_average_spacing<Concurrency_tag>(points.begin_or_selection_begin(), points.end(),
+                                                       6 /* knn = 1 ring */);
+
+    // Gets one point inside the implicit surface
+    Kernel::Point_3 inner_point = function.get_inner_point();
+    Kernel::FT inner_point_value = function(inner_point);
+    if(inner_point_value >= 0.0)
+    {
+      std::cerr << "Error: unable to seed (" << inner_point_value << " at inner_point)" << std::endl;
+      return NULL;
+    }
+
+    // Gets implicit function's radius
+    Kernel::Sphere_3 bsphere = function.bounding_sphere();
+    Kernel::FT radius = std::sqrt(bsphere.squared_radius());
+
+    // Defines the implicit surface: requires defining a
+  	// conservative bounding sphere centered at inner point.
+    Kernel::FT sm_sphere_radius = 5.0 * radius;
+    Kernel::FT sm_dichotomy_error = sm_distance*average_spacing/1000.0; // Dichotomy error must be << sm_distance
+    Surface_3 surface(function,
+                      Kernel::Sphere_3(inner_point,sm_sphere_radius*sm_sphere_radius),
+                      sm_dichotomy_error/sm_sphere_radius);
+
+    // Defines surface mesh generation criteria
+    CGAL::Surface_mesh_default_criteria_3<STr> criteria(sm_angle,  // Min triangle angle (degrees)
+                                                        sm_radius*average_spacing,  // Max triangle size
+                                                        sm_distance*average_spacing); // Approximation error
+
+    CGAL_TRACE_STREAM << "  make_surface_mesh(sphere center=("<<inner_point << "),\n"
+                      << "                    sphere radius="<<sm_sphere_radius<<",\n"
+                      << "                    angle="<<sm_angle << " degrees,\n"
+                      << "                    triangle size="<<sm_radius<<" * average spacing="<<sm_radius*average_spacing<<",\n"
+                      << "                    distance="<<sm_distance<<" * average spacing="<<sm_distance*average_spacing<<",\n"
+                      << "                    dichotomy error=distance/"<<sm_distance*average_spacing/sm_dichotomy_error<<",\n"
+                      << "                    Manifold_with_boundary_tag)\n";
+
+    // Generates surface mesh with manifold option
+    STr tr; // 3D Delaunay triangulation for surface mesh generation
+    C2t3 c2t3(tr); // 2D complex in 3D Delaunay triangulation
+    CGAL::make_surface_mesh(c2t3,                                 // reconstructed mesh
+                            surface,                              // implicit surface
+                            criteria,                             // meshing criteria
+                            CGAL::Manifold_with_boundary_tag());  // require manifold mesh
+
+    // Prints status
+    std::cerr << "Surface meshing: " << task_timer.time() << " seconds, "
+                                     << tr.number_of_vertices() << " output vertices"
+                                     << std::endl;
+    task_timer.reset();
+
+    if(tr.number_of_vertices() == 0)
+      return NULL;
+
+    // Converts to polyhedron
+    Polyhedron* output_mesh = new Polyhedron;
+    CGAL::output_surface_facets_to_polyhedron(c2t3, *output_mesh);
+
+    // Prints total reconstruction duration
+    std::cerr << "Total reconstruction (implicit function + meshing): " << reconstruction_timer.time() << " seconds\n";
+
+    //***************************************
+    // Computes reconstruction error
+    //***************************************
+
+    // Constructs AABB tree and computes internal KD-tree
+    // data structure to accelerate distance queries
+    AABB_tree tree(faces(*output_mesh).first, faces(*output_mesh).second, *output_mesh);
+    tree.accelerate_distance_queries();
+
+    // Computes distance from each input point to reconstructed mesh
+    double max_distance = DBL_MIN;
+    double avg_distance = 0;
+
+    std::set<Polyhedron::Face_handle> faces_to_keep;
+    
+    for (Point_set::const_iterator p=points.begin_or_selection_begin(); p!=points.end(); p++)
+    {
+      AABB_traits::Point_and_primitive_id pap = tree.closest_point_and_primitive (*p);
+      double distance = std::sqrt(CGAL::squared_distance (pap.first, *p));
+      
+      max_distance = (std::max)(max_distance, distance);
+      avg_distance += distance;
+
+      Polyhedron::Face_handle f = pap.second;
+      faces_to_keep.insert (f);  
+    }
+    avg_distance /= double(points.size());
+
+    std::cerr << "Reconstruction error:\n"
+              << "  max = " << max_distance << " = " << max_distance/average_spacing << " * average spacing\n"
+              << "  avg = " << avg_distance << " = " << avg_distance/average_spacing << " * average spacing\n";
+
+    if (do_not_fill_holes)
+      {
+	Polyhedron::Facet_iterator it = output_mesh->facets_begin ();
+	while (it != output_mesh->facets_end ())
+	  {
+	    Polyhedron::Facet_iterator current = it ++;
+
+	    if (faces_to_keep.find (current) == faces_to_keep.end ())
+	      output_mesh->erase_facet (current->halfedge ());
+
+	  }
+
+      }
+    
+
+    return output_mesh;
+}
+
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Subdivision_methods/CMakeLists.txt b/3rdparty/CGAL/demo/Polyhedron/Plugins/Subdivision_methods/CMakeLists.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Subdivision_methods/CMakeLists.txt
rename to 3rdparty/CGAL/demo/Polyhedron/Plugins/Subdivision_methods/CMakeLists.txt
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Subdivision_methods/Subdivision_methods_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Subdivision_methods/Subdivision_methods_plugin.cpp
new file mode 100644
index 0000000..0dbc566
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Subdivision_methods/Subdivision_methods_plugin.cpp
@@ -0,0 +1,119 @@
+#include <QTime>
+#include <QApplication>
+#include <QMainWindow>
+#include <QAction>
+
+#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+
+#include "Scene_polyhedron_item.h"
+#include "Polyhedron_type.h"
+#include <CGAL/Subdivision_method_3.h>
+using namespace CGAL::Three;
+class Polyhedron_demo_subdivision_methods_plugin : 
+  public QObject,
+  public Polyhedron_demo_plugin_helper
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+public:
+  // used by Polyhedron_demo_plugin_helper
+  QList<QAction*> actions() const {
+    return _actions;
+  }
+
+  void init(QMainWindow* mw,
+            Scene_interface* scene_interface,
+            Messages_interface*)
+  {
+      scene = scene_interface;
+      QAction *actionLoop = new QAction("Loop", mw);
+      QAction *actionCatmullClark = new QAction("Catmull Clark", mw);
+      QAction *actionSqrt3 = new QAction("Sqrt3", mw);
+      actionLoop->setObjectName("actionLoop");
+      actionCatmullClark->setObjectName("actionCatmullClark");
+      actionSqrt3->setObjectName("actionSqrt3");
+      _actions << actionLoop
+               << actionCatmullClark
+               << actionSqrt3;
+      Q_FOREACH(QAction* action, _actions)
+        action->setProperty("subMenuName", "3D Surface Subdivision Methods");
+      autoConnectActions();
+
+  }
+
+  bool applicable(QAction*) const { 
+    return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
+  }
+public Q_SLOTS:
+  void on_actionLoop_triggered();
+  void on_actionCatmullClark_triggered();
+  void on_actionSqrt3_triggered();
+private :
+  QList<QAction*> _actions;
+}; // end Polyhedron_demo_subdivision_methods_plugin
+
+void Polyhedron_demo_subdivision_methods_plugin::on_actionLoop_triggered()
+{
+  CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+  
+  Scene_polyhedron_item* item = 
+    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+
+  if(!item) return;
+  Polyhedron* poly = item->polyhedron();
+  QTime time;
+  time.start();
+  std::cout << "Loop subdivision...";
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  CGAL::Subdivision_method_3::Loop_subdivision(*poly, 1);
+  std::cout << "ok (" << time.elapsed() << " ms)" << std::endl;
+  QApplication::restoreOverrideCursor();
+  item->invalidateOpenGLBuffers();
+  scene->itemChanged(item);
+}
+
+void Polyhedron_demo_subdivision_methods_plugin::on_actionCatmullClark_triggered()
+{
+  CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+  
+  Scene_polyhedron_item* item = 
+    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+
+  if(!item) return;
+  Polyhedron* poly = item->polyhedron();
+  if(!poly) return;
+  QTime time;
+  time.start();
+  std::cout << "Catmull-Clark subdivision...";
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  CGAL::Subdivision_method_3::CatmullClark_subdivision(*poly, 1);
+  std::cout << "ok (" << time.elapsed() << " ms)" << std::endl;
+  QApplication::restoreOverrideCursor();
+  item->invalidateOpenGLBuffers();
+  scene->itemChanged(item);
+}
+
+void Polyhedron_demo_subdivision_methods_plugin::on_actionSqrt3_triggered()
+{
+  CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+  
+  Scene_polyhedron_item* item = 
+    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+
+  if(!item) return;
+  Polyhedron* poly = item->polyhedron();
+  if(!poly) return;
+  QTime time;
+  time.start();
+  std::cout << "Sqrt3 subdivision...";
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  CGAL::Subdivision_method_3::Sqrt3_subdivision(*poly, 1);
+  std::cout << "ok (" << time.elapsed() << " ms)" << std::endl;
+  QApplication::restoreOverrideCursor();
+  item->invalidateOpenGLBuffers();
+  scene->itemChanged(item);
+}
+
+#include "Subdivision_methods_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh/CMakeLists.txt b/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh/CMakeLists.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh/CMakeLists.txt
rename to 3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh/CMakeLists.txt
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh/Mesh_segmentation_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh/Mesh_segmentation_plugin.cpp
new file mode 100644
index 0000000..1378993
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh/Mesh_segmentation_plugin.cpp
@@ -0,0 +1,349 @@
+#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+
+#include "ui_Mesh_segmentation_widget.h"
+#include "Scene_polyhedron_item.h"
+#include "Polyhedron_type.h"
+#include "Scene.h"
+#include "Color_map.h"
+
+#include <CGAL/mesh_segmentation.h>
+#include <QApplication>
+#include <QMainWindow>
+#include <QInputDialog>
+#include <QTime>
+#include <QAction>
+#include <QDebug>
+#include <QObject>
+#include <QDockWidget>
+//#include <QtConcurrentRun>
+#include <map>
+#include <algorithm>
+#include <vector>
+#include <CGAL/property_map.h>
+
+
+template<class PolyhedronWithId, class ValueType>
+struct Polyhedron_with_id_to_vector_property_map
+    : public boost::put_get_helper<ValueType&,
+             Polyhedron_with_id_to_vector_property_map<PolyhedronWithId, ValueType> >
+{
+public:
+    typedef typename PolyhedronWithId::Facet_const_handle key_type;
+    typedef ValueType value_type;
+    typedef value_type& reference;
+    typedef boost::lvalue_property_map_tag category;
+
+    Polyhedron_with_id_to_vector_property_map() : internal_vector(NULL) { }
+    Polyhedron_with_id_to_vector_property_map(std::vector<ValueType>* internal_vector)
+         : internal_vector(internal_vector) { }
+        
+    reference operator[](key_type key) const { return (*internal_vector)[key->id()]; }
+private:
+    std::vector<ValueType>* internal_vector;
+};
+using namespace CGAL::Three;
+class Polyhedron_demo_mesh_segmentation_plugin : 
+    public QObject,
+    public Polyhedron_demo_plugin_helper
+{
+    Q_OBJECT
+    Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+    Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+private:
+    typedef std::map<Scene_polyhedron_item*, std::vector<double> > Item_sdf_map;
+public:
+
+    QList<QAction*> actions() const {
+        return QList<QAction*>() << actionSegmentation;
+    }
+
+    bool applicable(QAction*) const {
+      return 
+        qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
+    }    
+    
+    void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*) {
+        this->scene = scene_interface;
+        this->mw = mainWindow;
+        actionSegmentation = new QAction("Mesh Segmentation", mw);
+        actionSegmentation->setProperty("subMenuName", "Triangulated Surface Mesh Segmentation");
+        actionSegmentation->setObjectName("actionSegmentation");
+
+        // adding slot for itemAboutToBeDestroyed signal, aim is removing item from item-functor map.
+        
+        if( Scene* scene = dynamic_cast<Scene*>(scene_interface) ) {
+            connect(scene, SIGNAL(itemAboutToBeDestroyed(CGAL::Three::Scene_item*)), this, SLOT(itemAboutToBeDestroyed(CGAL::Three::Scene_item*)));
+        }
+        init_color_map_sdf();
+        init_color_map_segmentation();
+        autoConnectActions();
+
+        dock_widget = new QDockWidget("Mesh segmentation parameters", mw);
+        dock_widget->setVisible(false); // do not show at the beginning
+        ui_widget.setupUi(dock_widget);
+        mw->addDockWidget(Qt::LeftDockWidgetArea, dock_widget);
+    
+        connect(ui_widget.Partition_button,  SIGNAL(clicked()), this, SLOT(on_Partition_button_clicked()));   
+        connect(ui_widget.SDF_button,  SIGNAL(clicked()), this, SLOT(on_SDF_button_clicked()));   
+    }
+    virtual void closure()
+    {
+      dock_widget->hide();
+    }
+    
+    template<class SDFPropertyMap>
+    void colorize_sdf(Scene_polyhedron_item* item, SDFPropertyMap sdf_values, std::vector<QColor>& color_vector);
+    template<class SegmentPropertyMap> 
+    void colorize_segmentation(Scene_polyhedron_item* item, SegmentPropertyMap segment_ids, std::vector<QColor>& color_vector);
+    void check_and_set_ids(Polyhedron* polyhedron);
+    void init_color_map_sdf();
+    void init_color_map_segmentation();
+    
+    public Q_SLOTS:
+        void on_actionSegmentation_triggered();
+        void on_Partition_button_clicked();
+        void on_SDF_button_clicked();
+        void itemAboutToBeDestroyed(CGAL::Three::Scene_item*);
+private:
+    QAction*                      actionSegmentation;
+    QDockWidget*                  dock_widget;
+    Ui::Mesh_segmentation         ui_widget;
+    
+    std::vector<QColor>  color_map_sdf;
+    std::vector<QColor>  color_map_segmentation;
+    Item_sdf_map         item_sdf_map;
+};
+
+void Polyhedron_demo_mesh_segmentation_plugin::init_color_map_sdf()
+{
+    color_map_sdf = std::vector<QColor>(256);
+    int r = 0, g = 0, b = 255;
+    for(int i = 0; i <= 255; ++i)
+    {
+        if(i > 128 && i <= 192) { r = static_cast<int>( ((i - 128) / (192.0 - 128)) * 255 ); }        
+        if(i > 0 && i <= 98)    { g = static_cast<int>( ((i) / (98.0)) * 255 ); }
+        if(i > 191 && i <=255)  { g = 255 - static_cast<int>( ((i - 191) / (255.0 - 191)) * 255 ); }
+        if(i > 64 && i <= 127)  { b = 255 - static_cast<int>( ((i - 64) / (127.0 - 64)) * 255 ); }
+        color_map_sdf[i] = QColor(r, g, b);        
+    }
+}
+
+void Polyhedron_demo_mesh_segmentation_plugin::init_color_map_segmentation()
+{
+
+    color_map_segmentation.push_back(QColor( 173, 35, 35)); 
+    color_map_segmentation.push_back(QColor( 87, 87, 87));    
+    color_map_segmentation.push_back(QColor( 42, 75, 215)); 
+    color_map_segmentation.push_back(QColor( 29, 105, 20)); 
+    color_map_segmentation.push_back(QColor( 129, 74, 25)); 
+    color_map_segmentation.push_back(QColor( 129, 38, 192)); 
+    color_map_segmentation.push_back(QColor( 160, 160, 160)); 
+    color_map_segmentation.push_back(QColor( 129, 197, 122)); 
+    color_map_segmentation.push_back(QColor( 157, 175, 255)); 
+    color_map_segmentation.push_back(QColor( 41, 208, 208)); 
+    color_map_segmentation.push_back(QColor( 255, 146, 51)); 
+    color_map_segmentation.push_back(QColor( 255, 238, 51)); 
+    color_map_segmentation.push_back(QColor( 233, 222, 187)); 
+    color_map_segmentation.push_back(QColor( 255, 205, 243)); 
+    
+}
+
+void Polyhedron_demo_mesh_segmentation_plugin::itemAboutToBeDestroyed(CGAL::Three::Scene_item* scene_item)
+{
+    if(Scene_polyhedron_item* item = qobject_cast<Scene_polyhedron_item*>(scene_item)) {
+      item_sdf_map.erase(item);
+    }
+}
+
+void Polyhedron_demo_mesh_segmentation_plugin::on_actionSegmentation_triggered()
+{ dock_widget->show(); }
+
+void Polyhedron_demo_mesh_segmentation_plugin::on_SDF_button_clicked()
+{
+    CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+    Scene_polyhedron_item* item = qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+    if(!item) { return; }
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    
+    std::size_t number_of_rays = ui_widget.Number_of_rays_spin_box->value();
+    double cone_angle = (ui_widget.Cone_angle_spin_box->value()  / 180.0) * CGAL_PI;
+    bool create_new_item = ui_widget.New_item_check_box->isChecked();
+    
+    Item_sdf_map::iterator pair;
+    Scene_polyhedron_item* active_item = item;
+
+    if(create_new_item) {
+        active_item = new Scene_polyhedron_item(*item->polyhedron()); 
+        active_item->setGouraudMode();
+    }
+    
+    pair = item_sdf_map.insert(
+            std::make_pair(active_item, std::vector<double>()) ).first; 
+    
+    check_and_set_ids(pair->first->polyhedron());
+    pair->second.resize(item->polyhedron()->size_of_facets(), 0.0);
+    Polyhedron_with_id_to_vector_property_map<Polyhedron, double>  sdf_pmap(&pair->second);
+    QTime time;
+    time.start();
+    std::pair<double, double> min_max_sdf = sdf_values(*(pair->first->polyhedron()), sdf_pmap, cone_angle, number_of_rays);
+    std::cout << "ok (" << time.elapsed() << " ms)" << std::endl;
+
+    std::cout << "SDF computation is completed. Min-SDF : " << min_max_sdf.first << " " "Max-SDF : " << min_max_sdf.second << std::endl;
+
+    pair->first->set_color_vector_read_only(true);
+    colorize_sdf(pair->first, sdf_pmap, pair->first->color_vector());
+       
+    pair->first->setName(tr("(SDF-%1-%2)").arg(number_of_rays).arg(ui_widget.Cone_angle_spin_box->value()));
+    
+    if(create_new_item) {
+        scene->addItem(pair->first);
+        item->setVisible(false);
+        scene->itemChanged(item);
+        scene->itemChanged(pair->first);
+        scene->setSelectedItem(index);
+    }
+    else {
+      item->invalidateOpenGLBuffers();
+      scene->itemChanged(index);
+    }
+
+    QApplication::restoreOverrideCursor();
+}
+
+void Polyhedron_demo_mesh_segmentation_plugin::on_Partition_button_clicked()
+{    
+    CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+    Scene_polyhedron_item* item = qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+    if(!item) { return; }
+    
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    
+    std::size_t number_of_clusters = ui_widget.Number_of_clusters_spin_box->value();
+    double smoothness = ui_widget.Smoothness_spin_box->value();
+    std::size_t number_of_rays = ui_widget.Number_of_rays_spin_box->value();
+    double cone_angle = (ui_widget.Cone_angle_spin_box->value()  / 180.0) * CGAL_PI;
+    bool create_new_item = ui_widget.New_item_check_box->isChecked();
+    bool extract_segments = ui_widget.Extract_segments_check_box->isChecked();
+
+    Item_sdf_map::iterator pair;
+    if(create_new_item)
+    {
+        // create new item
+        Scene_polyhedron_item* new_item = new Scene_polyhedron_item(*item->polyhedron()); 
+        new_item->setGouraudMode(); 
+        
+        // copy SDF values of existing poly to new poly
+        Item_sdf_map::iterator it = item_sdf_map.find(item);
+        const std::vector<double>& sdf_data = it == item_sdf_map.end() ?
+                                              std::vector<double>() : it->second;
+        pair = item_sdf_map.insert(std::make_pair(new_item, sdf_data) ).first;
+    }
+    else
+    {
+        std::pair<Item_sdf_map::iterator, bool> res = 
+          item_sdf_map.insert(std::make_pair(item, std::vector<double>()) );
+        pair = res.first;
+    }
+
+    check_and_set_ids(pair->first->polyhedron());
+    QTime time;
+    time.start();
+    if(pair->second.empty()) { // SDF values are empty, calculate
+      pair->second.resize(pair->first->polyhedron()->size_of_facets(), 0.0);
+      Polyhedron_with_id_to_vector_property_map<Polyhedron, double> sdf_pmap(&pair->second);
+      sdf_values(*(pair->first->polyhedron()), sdf_pmap, cone_angle, number_of_rays); 
+    }
+
+    std::vector<std::size_t> internal_segment_map(pair->first->polyhedron()->size_of_facets());
+    Polyhedron_with_id_to_vector_property_map<Polyhedron, std::size_t> segment_pmap(&internal_segment_map);
+    Polyhedron_with_id_to_vector_property_map<Polyhedron, double> sdf_pmap(&pair->second);
+
+    std::size_t nb_segments = segmentation_from_sdf_values(*(pair->first->polyhedron())
+        ,sdf_pmap, segment_pmap, number_of_clusters, smoothness, extract_segments); 
+    std::cout << "ok (" << time.elapsed() << " ms)" << std::endl;
+    std::cout << "Segmentation is completed. Number of segments : " << nb_segments << std::endl;  
+    pair->first->set_color_vector_read_only(true);  
+     
+    colorize_segmentation(pair->first, segment_pmap, pair->first->color_vector());
+    pair->first->setName(tr("(Segmentation-%1-%2)").arg(number_of_clusters).arg(smoothness));   
+
+    if(create_new_item) {
+        scene->addItem(pair->first);
+        item->setVisible(false);
+        scene->itemChanged(item);
+        scene->itemChanged(pair->first);
+        scene->setSelectedItem(index);
+    }
+    else {
+      item->invalidateOpenGLBuffers();
+      scene->itemChanged(index);
+    }
+
+    QApplication::restoreOverrideCursor();
+}
+
+void Polyhedron_demo_mesh_segmentation_plugin::check_and_set_ids(Polyhedron* polyhedron)
+{
+    Polyhedron::Facet_iterator a_facet = polyhedron->facets_begin();
+    Polyhedron::Facet_iterator another_facet = ++polyhedron->facets_begin();
+    if(a_facet->id() != another_facet->id()) { return; } // ids are OK
+    std::size_t facet_id = 0;
+    for(Polyhedron::Facet_iterator facet_it = polyhedron->facets_begin();
+        facet_it != polyhedron->facets_end(); ++facet_it, ++facet_id)
+    {
+        facet_it->id() = facet_id;
+    }
+}
+
+template<class SDFPropertyMap>
+void Polyhedron_demo_mesh_segmentation_plugin::colorize_sdf(
+     Scene_polyhedron_item* item,
+     SDFPropertyMap sdf_values,  
+     std::vector<QColor>& color_vector)
+{
+    item->setItemIsMulticolor(true);
+    Polyhedron* polyhedron = item->polyhedron();
+    color_vector.clear();
+    std::size_t patch_id = 0;
+    for(Polyhedron::Facet_iterator facet_it = polyhedron->facets_begin(); 
+        facet_it != polyhedron->facets_end(); ++facet_it, ++patch_id)   
+    {
+        double sdf_value = sdf_values[facet_it]; 
+        int gray_color = static_cast<int>(255 * sdf_value);
+        if(gray_color < 0 || gray_color >= 256) {
+          color_vector.push_back(QColor::fromRgb(0,0,0));
+        }
+        else {
+          color_vector.push_back(color_map_sdf[gray_color]);
+        }
+        facet_it->set_patch_id(static_cast<int>(patch_id));
+    }
+}
+
+template<class SegmentPropertyMap>
+void Polyhedron_demo_mesh_segmentation_plugin::colorize_segmentation(
+     Scene_polyhedron_item* item,
+     SegmentPropertyMap segment_ids,
+     std::vector<QColor>& color_vector)
+{
+    item->setItemIsMulticolor(true);
+    Polyhedron* polyhedron = item->polyhedron();
+    color_vector.clear();
+    std::size_t max_segment = 0;
+    for(Polyhedron::Facet_iterator facet_it = polyhedron->facets_begin(); 
+        facet_it != polyhedron->facets_end(); ++facet_it)   
+    {
+        std::size_t segment_id = segment_ids[facet_it];
+        facet_it->set_patch_id(static_cast<int>(segment_id));
+        max_segment = (std::max)(max_segment, segment_id);      
+    }
+    for(std::size_t i = 0; i <= max_segment; ++i)   
+    {
+        QColor aColor = color_map_segmentation[(max_segment - i) % color_map_segmentation.size()]; 
+        color_vector.push_back(aColor);     
+    }    
+}
+
+#include "Mesh_segmentation_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh/Mesh_segmentation_widget.ui b/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh/Mesh_segmentation_widget.ui
new file mode 100644
index 0000000..f020faa
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh/Mesh_segmentation_widget.ui
@@ -0,0 +1,199 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Mesh_segmentation</class>
+ <widget class="QDockWidget" name="Mesh_segmentation">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>340</width>
+    <height>293</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Mesh Segmentation</string>
+  </property>
+  <widget class="QWidget" name="dockWidgetContents">
+   <layout class="QVBoxLayout" name="verticalLayout">
+    <item>
+     <widget class="QGroupBox" name="groupBox_2">
+      <property name="title">
+       <string>SDF Calculation Parameters</string>
+      </property>
+      <layout class="QGridLayout" name="gridLayout_2" columnstretch="0,1">
+       <item row="0" column="0">
+        <widget class="QLabel" name="Number_of_rays_label">
+         <property name="text">
+          <string>Number of rays:</string>
+         </property>
+         <property name="alignment">
+          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="1">
+        <widget class="QSpinBox" name="Number_of_rays_spin_box">
+         <property name="value">
+          <number>25</number>
+         </property>
+        </widget>
+       </item>
+       <item row="1" column="0">
+        <widget class="QLabel" name="Cone_angle_label">
+         <property name="text">
+          <string>Cone angle:</string>
+         </property>
+         <property name="alignment">
+          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+         </property>
+        </widget>
+       </item>
+       <item row="1" column="1">
+        <widget class="QSpinBox" name="Cone_angle_spin_box">
+         <property name="maximum">
+          <number>180</number>
+         </property>
+         <property name="value">
+          <number>120</number>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </widget>
+    </item>
+    <item>
+     <widget class="QGroupBox" name="groupBox">
+      <property name="title">
+       <string>Segmentation Parameters</string>
+      </property>
+      <layout class="QGridLayout" name="gridLayout" columnstretch="0,1">
+       <item row="0" column="1">
+        <widget class="QSpinBox" name="Number_of_clusters_spin_box">
+         <property name="minimum">
+          <number>1</number>
+         </property>
+         <property name="value">
+          <number>5</number>
+         </property>
+        </widget>
+       </item>
+       <item row="1" column="0">
+        <widget class="QLabel" name="Smoothness_label">
+         <property name="layoutDirection">
+          <enum>Qt::LeftToRight</enum>
+         </property>
+         <property name="text">
+          <string>Smoothness:</string>
+         </property>
+         <property name="alignment">
+          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="0">
+        <widget class="QLabel" name="Number_of_clusters_label">
+         <property name="text">
+          <string>Number of clusters:</string>
+         </property>
+         <property name="alignment">
+          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+         </property>
+        </widget>
+       </item>
+       <item row="1" column="1">
+        <widget class="QDoubleSpinBox" name="Smoothness_spin_box">
+         <property name="maximum">
+          <double>10.000000000000000</double>
+         </property>
+         <property name="singleStep">
+          <double>0.010000000000000</double>
+         </property>
+         <property name="value">
+          <double>0.260000000000000</double>
+         </property>
+        </widget>
+       </item>
+       <item row="2" column="0">
+        <widget class="QLabel" name="label">
+         <property name="layoutDirection">
+          <enum>Qt::LeftToRight</enum>
+         </property>
+         <property name="text">
+          <string>Extract segments:</string>
+         </property>
+         <property name="alignment">
+          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+         </property>
+        </widget>
+       </item>
+       <item row="2" column="1">
+        <widget class="QCheckBox" name="Extract_segments_check_box">
+         <property name="text">
+          <string/>
+         </property>
+         <property name="checked">
+          <bool>true</bool>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </widget>
+    </item>
+    <item>
+     <layout class="QHBoxLayout">
+      <item>
+       <layout class="QGridLayout" name="gridLayout_3">
+        <item row="0" column="0">
+         <widget class="QLabel" name="New_item_label">
+          <property name="text">
+           <string>Create new item:</string>
+          </property>
+          <property name="alignment">
+           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="1">
+         <widget class="QCheckBox" name="New_item_check_box">
+          <property name="text">
+           <string/>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+      <item>
+       <widget class="QPushButton" name="SDF_button">
+        <property name="text">
+         <string>Calculate SDF</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="Partition_button">
+        <property name="text">
+         <string>Segment</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </item>
+    <item>
+     <spacer name="verticalSpacer">
+      <property name="orientation">
+       <enum>Qt::Vertical</enum>
+      </property>
+      <property name="sizeHint" stdset="0">
+       <size>
+        <width>20</width>
+        <height>40</height>
+       </size>
+      </property>
+     </spacer>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh/Mesh_simplification_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh/Mesh_simplification_plugin.cpp
new file mode 100644
index 0000000..696ff2f
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh/Mesh_simplification_plugin.cpp
@@ -0,0 +1,102 @@
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+
+#include "Scene_polyhedron_item.h"
+#include "Polyhedron_type.h"
+
+#include <QApplication>
+#include <QMainWindow>
+#include <QInputDialog>
+#include <QTime>
+#include <QAction>
+
+#include <CGAL/Surface_mesh_simplification/HalfedgeGraph_Polyhedron_3.h>
+#include <CGAL/Surface_mesh_simplification/edge_collapse.h>
+#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h>
+using namespace CGAL::Three;
+class Polyhedron_demo_mesh_simplification_plugin : 
+  public QObject,
+  public Polyhedron_demo_plugin_interface
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+public:
+
+  QList<QAction*> actions() const {
+    return _actions;
+  }
+
+  void init(QMainWindow* mainWindow,
+            Scene_interface* scene_interface,
+            Messages_interface*)
+  {
+      mw = mainWindow;
+      scene = scene_interface;
+     QAction *actionSimplify = new QAction("Simplification", mw);
+      actionSimplify->setProperty("subMenuName",
+                                  "Triangulated Surface Mesh Simplification");
+      connect(actionSimplify, SIGNAL(triggered()), this, SLOT(on_actionSimplify_triggered()));
+      _actions <<actionSimplify;
+
+  }
+  bool applicable(QAction*) const { 
+    return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
+  }
+public Q_SLOTS:
+  void on_actionSimplify_triggered();
+private :
+  Scene_interface *scene;
+  QMainWindow *mw;
+  QList<QAction*> _actions;
+
+}; // end Polyhedron_demo_mesh_simplification_plugin
+
+void Polyhedron_demo_mesh_simplification_plugin::on_actionSimplify_triggered()
+{
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+  
+  Scene_polyhedron_item* item = 
+    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+
+  if(item)
+  {
+    Polyhedron* pMesh = item->polyhedron();
+
+    // get option (#edges)
+    bool ok;
+  
+    const int nb_edges = 
+    QInputDialog::getInt(mw, tr("Stop condition"),
+      tr("Number of edges:"),
+      (int)(pMesh->size_of_halfedges () / 4), // default value: current #edges / 2 
+      3, // min = one triangle
+      (int)pMesh->size_of_halfedges(), // max #edges
+      1, // step for the spinbox
+      &ok);
+
+    // check user cancellation
+    if(!ok)
+      return;
+
+    // simplify
+    QTime time;
+    time.start();
+    std::cout << "Simplify...";
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    namespace SMS = CGAL::Surface_mesh_simplification;
+    SMS::Count_stop_predicate< Polyhedron > stop(nb_edges); // target #edges
+    SMS::edge_collapse( *pMesh, stop,
+                        CGAL::parameters::vertex_index_map(get(CGAL::vertex_external_index,*pMesh))
+                                         .halfedge_index_map(get(CGAL::halfedge_external_index,*pMesh)));
+    std::cout << "ok (" << time.elapsed() << " ms, " 
+      << pMesh->size_of_halfedges() / 2 << " edges)" << std::endl;
+
+    // update scene
+    item->invalidateOpenGLBuffers();
+    scene->itemChanged(index);
+    QApplication::restoreOverrideCursor();
+  }
+}
+
+#include "Mesh_simplification_plugin.moc"
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh/Mesher_base.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh/Mesher_base.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh/Mesher_base.cpp
rename to 3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh/Mesher_base.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh/Mesher_base.h b/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh/Mesher_base.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh/Mesher_base.h
rename to 3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh/Mesher_base.h
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh/Parameterization_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh/Parameterization_plugin.cpp
new file mode 100644
index 0000000..05d1e35
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh/Parameterization_plugin.cpp
@@ -0,0 +1,197 @@
+#include <QApplication>
+#include <QAction>
+#include <QMainWindow>
+#include <QStringList>
+
+#include "Scene_polyhedron_item.h"
+#include "Scene_textured_polyhedron_item.h"
+#include "Textured_polyhedron_type.h"
+#include "Polyhedron_type.h"
+#include "Messages_interface.h"
+
+#include <QTime>
+
+#include <CGAL/Parameterization_polyhedron_adaptor_3.h>
+#include <CGAL/parameterize.h>
+#include <CGAL/Discrete_conformal_map_parameterizer_3.h>
+#include <CGAL/LSCM_parameterizer_3.h>
+#include <CGAL/Two_vertices_parameterizer_3.h>
+
+#include <CGAL/Textured_polyhedron_builder.h>
+
+#include <iostream>
+
+#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+
+typedef Kernel::FT FT;
+using namespace CGAL::Three;
+class Polyhedron_demo_parameterization_plugin : 
+  public QObject,
+  public Polyhedron_demo_plugin_helper
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+public:
+  // used by Polyhedron_demo_plugin_helper
+  QList<QAction*> actions() const {
+    return _actions;
+  }
+
+  void init(QMainWindow* mainWindow,
+            Scene_interface* scene_interface,
+            Messages_interface* m_i)
+  {
+      mw = mainWindow;
+      scene = scene_interface;
+      message = m_i;
+      QAction* actionMVC = new QAction("Mean Value Coordinates", mw);
+      QAction* actionDCP = new QAction ("Discrete Conformal Map", mw);
+      QAction* actionLSC = new QAction("Least Square Conformal Map", mw);
+      actionMVC->setObjectName("actionMVC");
+      actionDCP->setObjectName("actionDCP");
+      actionLSC->setObjectName("actionLSC");
+
+      _actions << actionMVC
+               << actionDCP
+               << actionLSC;
+      autoConnectActions();
+      Q_FOREACH(QAction *action, _actions)
+        action->setProperty("subMenuName",
+                            "Triangulated Surface Mesh Parameterization");
+
+
+  }
+
+  bool applicable(QAction*) const { 
+    return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
+  }
+
+public Q_SLOTS:
+  void on_actionMVC_triggered();
+  void on_actionDCP_triggered();
+  void on_actionLSC_triggered();
+
+protected:
+  enum Parameterization_method { PARAM_MVC, PARAM_DCP, PARAM_LSC };
+  void parameterize(Parameterization_method method);
+private:
+  QList<QAction*> _actions;
+  Messages_interface* message;
+}; // end Polyhedron_demo_parameterization_plugin
+
+
+
+void Polyhedron_demo_parameterization_plugin::parameterize(const Parameterization_method method)
+{
+  // get active polyhedron
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+  Scene_polyhedron_item* poly_item = 
+    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+  if(!poly_item)
+    return;
+  poly_item->polyhedron()->normalize_border();
+  if(poly_item->polyhedron()->size_of_border_halfedges()==0)
+    message->warning("The polyhedorn has no border, therefore the Parameterization cannot apply.");
+  Polyhedron* pMesh = poly_item->polyhedron();
+  if(!pMesh)
+    return;
+
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+
+  // parameterize
+  QTime time;
+  time.start();
+  typedef CGAL::Parameterization_polyhedron_adaptor_3<Polyhedron> Adaptor;
+  Adaptor adaptor(*pMesh);  
+
+  bool success = false;
+  switch(method)
+  {
+  case PARAM_MVC:
+    {
+      std::cout << "Parameterize (MVC)...";
+      typedef CGAL::Mean_value_coordinates_parameterizer_3<Adaptor> Parameterizer;
+      Parameterizer::Error_code err = CGAL::parameterize(adaptor,Parameterizer());
+      success = err == Parameterizer::OK;
+      break;
+    }
+  case PARAM_DCP:
+    {
+      std::cout << "Parameterize (DCP)...";
+      typedef CGAL::Discrete_conformal_map_parameterizer_3<Adaptor> Parameterizer;
+      Parameterizer::Error_code err = CGAL::parameterize(adaptor,Parameterizer());
+      success = err == Parameterizer::OK;
+    }  
+  case PARAM_LSC:
+    {
+      std::cout << "Parameterize (LSC)...";
+      typedef CGAL::LSCM_parameterizer_3<Adaptor> Parameterizer;
+      Parameterizer::Error_code err = CGAL::parameterize(adaptor,Parameterizer());
+      success = err == Parameterizer::OK;
+    }
+  }
+
+  if(success)
+    std::cout << "ok (" << time.elapsed() << " ms)" << std::endl;
+  else
+  {
+    std::cout << "failure" << std::endl;
+    QApplication::restoreOverrideCursor();
+    return;
+  }
+
+  // add textured polyhedon to the scene
+  Textured_polyhedron *pTex_polyhedron = new Textured_polyhedron();
+  Textured_polyhedron_builder<Polyhedron,Textured_polyhedron,Kernel> builder;
+  builder.run(*pMesh,*pTex_polyhedron);
+  pTex_polyhedron->compute_normals();
+
+  Polyhedron::Vertex_iterator it1;
+  Textured_polyhedron::Vertex_iterator it2;
+  for(it1 = pMesh->vertices_begin(), 
+    it2 = pTex_polyhedron->vertices_begin();
+    it1 != pMesh->vertices_end() &&
+    it2 != pTex_polyhedron->vertices_end();
+  it1++, it2++)
+  {
+    // (u,v) pair is stored per halfedge
+    FT u = adaptor.info(it1->halfedge())->uv().x();
+    FT v = adaptor.info(it1->halfedge())->uv().y();
+    it2->u() = u;
+    it2->v() = v;
+  }
+
+  Scene_item* new_item = new Scene_textured_polyhedron_item(pTex_polyhedron);
+
+  new_item->setName(tr("%1 (parameterized)").arg(poly_item->name()));
+  new_item->setColor(Qt::white);
+  new_item->setRenderingMode(poly_item->renderingMode());
+
+  poly_item->setVisible(false);
+  scene->itemChanged(index);
+  scene->addItem(new_item);
+
+  QApplication::restoreOverrideCursor();
+}
+
+void Polyhedron_demo_parameterization_plugin::on_actionMVC_triggered()
+{
+  parameterize(PARAM_MVC);
+}
+
+void Polyhedron_demo_parameterization_plugin::on_actionDCP_triggered()
+{
+  std::cerr << "DCP...";
+  parameterize(PARAM_DCP);
+}
+
+void Polyhedron_demo_parameterization_plugin::on_actionLSC_triggered()
+{
+  std::cerr << "LSC...";
+  parameterize(PARAM_LSC);
+}
+
+#include "Parameterization_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh/Remeshing_dialog.ui b/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh/Remeshing_dialog.ui
new file mode 100644
index 0000000..3d5eaf7
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh/Remeshing_dialog.ui
@@ -0,0 +1,175 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Remeshing_dialog</class>
+ <widget class="QDialog" name="Remeshing_dialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>344</width>
+    <height>168</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Meshing criteria</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <layout class="QGridLayout" name="gridLayout" columnstretch="0,1">
+     <item row="0" column="0">
+      <widget class="QLabel" name="angleLabel">
+       <property name="text">
+        <string>&Angle:</string>
+       </property>
+       <property name="alignment">
+        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+       </property>
+       <property name="buddy">
+        <cstring>angle</cstring>
+       </property>
+      </widget>
+     </item>
+     <item row="0" column="1">
+      <widget class="QDoubleSpinBox" name="angle">
+       <property name="minimum">
+        <double>1.000000000000000</double>
+       </property>
+       <property name="maximum">
+        <double>30.000000000000000</double>
+       </property>
+       <property name="value">
+        <double>25.000000000000000</double>
+       </property>
+      </widget>
+     </item>
+     <item row="1" column="0">
+      <widget class="QLabel" name="sizingLabel">
+       <property name="text">
+        <string>&Size:</string>
+       </property>
+       <property name="alignment">
+        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+       </property>
+       <property name="buddy">
+        <cstring>sizing</cstring>
+       </property>
+      </widget>
+     </item>
+     <item row="1" column="1">
+      <widget class="QDoubleSpinBox" name="sizing">
+       <property name="decimals">
+        <number>4</number>
+       </property>
+      </widget>
+     </item>
+     <item row="2" column="0">
+      <widget class="QLabel" name="approxLabel">
+       <property name="text">
+        <string>Approximation &error:</string>
+       </property>
+       <property name="alignment">
+        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+       </property>
+       <property name="buddy">
+        <cstring>approx</cstring>
+       </property>
+      </widget>
+     </item>
+     <item row="2" column="1">
+      <widget class="QDoubleSpinBox" name="approx"/>
+     </item>
+     <item row="3" column="1">
+      <widget class="QComboBox" name="tags">
+       <item>
+        <property name="text">
+         <string>Non manifold</string>
+        </property>
+       </item>
+       <item>
+        <property name="text">
+         <string>Manifold</string>
+        </property>
+       </item>
+       <item>
+        <property name="text">
+         <string>Manifold with boundaries</string>
+        </property>
+       </item>
+      </widget>
+     </item>
+     <item row="3" column="0">
+      <widget class="QLabel" name="label">
+       <property name="text">
+        <string>&Topological criterion:</string>
+       </property>
+       <property name="alignment">
+        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+       </property>
+       <property name="buddy">
+        <cstring>tags</cstring>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>Remeshing_dialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>384</x>
+     <y>191</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>195</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>Remeshing_dialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>384</x>
+     <y>191</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>195</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh/Remeshing_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh/Remeshing_plugin.cpp
new file mode 100644
index 0000000..110d727
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh/Remeshing_plugin.cpp
@@ -0,0 +1,143 @@
+#include "config.h"
+#ifdef CGAL_POLYHEDRON_DEMO_USE_SURFACE_MESHER
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+#include "ui_Remeshing_dialog.h"
+
+#include <QObject>
+#include <QAction>
+#include <QMainWindow>
+#include <QMenu>
+#include <QApplication>
+#include <QtPlugin>
+#include "Scene_polyhedron_item.h"
+#include <QInputDialog>
+#include <QStringList>
+
+// declare the CGAL function
+CGAL::Three::Scene_item* cgal_code_remesh(QWidget* parent,
+                             Polyhedron*,
+                             const double angle,
+                             const double sizing,
+                             const double approx,
+                             int tag);
+using namespace CGAL::Three;
+class Polyhedron_demo_remeshing_plugin : 
+  public QObject,
+  protected Polyhedron_demo_plugin_interface
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+public:
+  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*) {
+    this->scene = scene_interface;
+    this->mw = mainWindow;
+    actionRemeshing = new QAction(tr("Remeshing"), mw);
+    actionRemeshing->setProperty("subMenuName", "3D Surface Mesh Generation");
+    if(actionRemeshing) {
+      connect(actionRemeshing, SIGNAL(triggered()),
+              this, SLOT(remesh()));
+    }
+  }
+
+  bool applicable(QAction*) const {
+    return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
+  }
+
+  QList<QAction*> actions() const {
+    return QList<QAction*>() << actionRemeshing;
+  }
+public Q_SLOTS:
+  void remesh();
+
+private:
+  QAction* actionRemeshing;
+  Scene_interface *scene;
+  QMainWindow *mw;
+}; // end class Polyhedron_demo_remeshing_plugin
+
+void Polyhedron_demo_remeshing_plugin::remesh()
+{
+  const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
+
+  Scene_polyhedron_item* item =
+    qobject_cast<Scene_polyhedron_item*>(scene->item(index));
+
+  if(item)
+  {
+    Polyhedron* pMesh = item->polyhedron();
+
+    if(!pMesh) return;
+
+    // TODO:
+    // sizing and approximation parameters should be expressed as ratio of
+    // scene bbox diagonal.
+
+    QDialog dialog(mw);
+    Ui::Remeshing_dialog ui;
+    ui.setupUi(&dialog);
+    connect(ui.buttonBox, SIGNAL(accepted()),
+            &dialog, SLOT(accept()));
+    connect(ui.buttonBox, SIGNAL(rejected()),
+            &dialog, SLOT(reject()));
+    double diag = scene->len_diagonal();
+
+    ui.sizing->setDecimals(4);
+    ui.sizing->setRange(diag * 10e-6, // min
+                       diag); // max
+    ui.sizing->setValue(diag * 0.05); // default value
+
+    ui.approx->setDecimals(6);
+    ui.approx->setRange(diag * 10e-7, // min
+                       diag); // max
+    ui.approx->setValue(diag * 0.005);
+
+
+    int i = dialog.exec();
+    if(i == QDialog::Rejected)
+      return;
+
+    const double angle = ui.angle->value();
+    const double approx = ui.approx->value();
+    const double sizing = ui.sizing->value();
+    const int tag_index = ui.tags->currentIndex();
+    if(tag_index < 0) return;
+
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+
+    std::cerr << "remesh with:"
+              << "\n  angle=" << angle
+              << "\n  sizing=" << sizing
+              << "\n  approx=" << approx
+              << "\n  tag=" << tag_index
+              << std::boolalpha
+              << std::endl;
+    CGAL::Three::Scene_item* new_item = cgal_code_remesh(mw,
+                                            pMesh,
+                                            angle,
+                                            sizing,
+                                            approx,
+                                            tag_index);
+
+    if(new_item)
+    {
+      new_item->setName(tr("%1 remeshed (%2 %3 %4)")
+                         .arg(item->name())
+                         .arg(angle)
+                         .arg(sizing)
+                         .arg(approx));
+      new_item->setColor(Qt::magenta);
+      new_item->setRenderingMode(item->renderingMode());
+      item->setVisible(false);
+      scene->itemChanged(index);
+      scene->addItem(new_item);
+    }
+
+    QApplication::restoreOverrideCursor();
+  }
+}
+
+#include "Remeshing_plugin.moc"
+
+#endif // CGAL_POLYHEDRON_DEMO_USE_SURFACE_MESHER
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh/Remeshing_plugin_cgal_code.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh/Remeshing_plugin_cgal_code.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh/Remeshing_plugin_cgal_code.cpp
rename to 3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh/Remeshing_plugin_cgal_code.cpp
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.cpp
new file mode 100644
index 0000000..2d72b17
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.cpp
@@ -0,0 +1,613 @@
+#include "Scene_polyhedron_shortest_path_item.h"
+
+#include "Scene_polylines_item.h"
+
+#include <vector>
+#include <Qt>
+#include <QApplication>
+#include <QKeySequence>
+#include <fstream>
+
+#include <CGAL/Surface_mesh_shortest_path/function_objects.h>
+#include <QString>
+struct Scene_polyhedron_shortest_path_item_priv
+{
+  typedef CGAL::Three::Scene_interface::Bbox Bbox;
+
+  typedef boost::property_map<Polyhedron, CGAL::vertex_point_t>::type VertexPointMap;
+
+  typedef boost::graph_traits<Polyhedron> GraphTraits;
+  typedef GraphTraits::face_descriptor face_descriptor;
+  typedef GraphTraits::face_iterator face_iterator;
+
+  typedef CGAL::Surface_mesh_shortest_path_traits<Kernel, Polyhedron> Surface_mesh_shortest_path_traits;
+  typedef CGAL::Surface_mesh_shortest_path<Surface_mesh_shortest_path_traits> Surface_mesh_shortest_path;
+  typedef Surface_mesh_shortest_path::Face_location Face_location;
+  typedef CGAL::AABB_face_graph_triangle_primitive<Polyhedron, VertexPointMap> AABB_face_graph_primitive;
+  typedef CGAL::AABB_traits<Kernel, AABB_face_graph_primitive> AABB_face_graph_traits;
+  typedef CGAL::AABB_tree<AABB_face_graph_traits> AABB_face_graph_tree;
+
+  typedef Surface_mesh_shortest_path_traits::Barycentric_coordinate Barycentric_coordinate;
+  typedef Surface_mesh_shortest_path_traits::Construct_barycentric_coordinate Construct_barycentric_coordinate;
+  typedef Surface_mesh_shortest_path_traits::Ray_3 Ray_3;
+  typedef Surface_mesh_shortest_path_traits::Point_3 Point_3;
+  typedef Surface_mesh_shortest_path_traits::FT FT;
+  Scene_polyhedron_shortest_path_item_priv(Scene_polyhedron_shortest_path_item *parent)
+    : m_shortestPaths(NULL)
+    , m_isTreeCached(false)
+    , m_shiftHeld(false)
+  {
+    item = parent;
+  }
+
+  bool get_mouse_ray(QMouseEvent* mouseEvent, Kernel::Ray_3&);
+  void recreate_shortest_path_object();
+  void ensure_aabb_object();
+  void ensure_shortest_paths_tree();
+
+  bool run_point_select(const Kernel::Ray_3&);
+  void remove_nearest_point(const Scene_polyhedron_shortest_path_item::Face_location& ray);
+  void get_as_edge_point(Scene_polyhedron_shortest_path_item::Face_location& inOutLocation);
+  void get_as_vertex_point(Scene_polyhedron_shortest_path_item::Face_location& inOutLocation);
+  void initialize_buffers(CGAL::Three::Viewer_interface *viewer = 0) const;
+  void compute_elements(void) const;
+  void deinitialize()
+  {
+    if (m_shortestPaths)
+    {
+      delete m_shortestPaths;
+      m_sceneInterface = NULL;
+    }
+  }
+
+  enum Selection_mode
+  {
+    INSERT_POINTS_MODE = 0,
+    REMOVE_POINTS_MODE = 1,
+    SHORTEST_PATH_MODE = 2
+  };
+
+  enum Primitives_mode
+  {
+    VERTEX_MODE = 0,
+    EDGE_MODE = 1,
+    FACE_MODE = 2
+  };
+
+  enum VAOs {
+      Selected_Edges=0,
+      NbOfVaos
+  };
+  enum VBOs {
+      Vertices = 0,
+      NbOfVbos
+  };
+
+  Scene_polyhedron_shortest_path_item* item;
+  Messages_interface* m_messages;
+  QMainWindow* m_mainWindow;
+  CGAL::Three::Scene_interface* m_sceneInterface;
+  Scene_polyhedron_shortest_path_item::Surface_mesh_shortest_path* m_shortestPaths;
+  Scene_polyhedron_shortest_path_item::AABB_face_graph_tree m_aabbTree;
+  std::string m_deferredLoadFilename;
+  Scene_polyhedron_shortest_path_item::Selection_mode m_selectionMode;
+  Scene_polyhedron_shortest_path_item::Primitives_mode m_primitivesMode;
+  bool m_isTreeCached;
+  bool m_shiftHeld;
+
+  mutable std::vector<float> vertices;
+  mutable QOpenGLShaderProgram *program;
+};
+Scene_polyhedron_shortest_path_item::Scene_polyhedron_shortest_path_item()
+   :Scene_polyhedron_item_decorator(NULL, false)
+{
+  d = new Scene_polyhedron_shortest_path_item_priv(this);
+}
+
+Scene_polyhedron_shortest_path_item::Scene_polyhedron_shortest_path_item(Scene_polyhedron_item* polyhedronItem, CGAL::Three::Scene_interface* sceneInterface, Messages_interface* messages, QMainWindow* mainWindow)
+  :Scene_polyhedron_item_decorator(polyhedronItem, false)
+{ d = new Scene_polyhedron_shortest_path_item_priv(this);
+  initialize(polyhedronItem, sceneInterface, messages, mainWindow);
+}
+  
+Scene_polyhedron_shortest_path_item::~Scene_polyhedron_shortest_path_item()
+{
+  deinitialize();
+  delete d;
+}
+
+void Scene_polyhedron_shortest_path_item_priv::compute_elements() const
+{
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    vertices.resize(0);
+
+    for(Scene_polyhedron_shortest_path_item::Surface_mesh_shortest_path::Source_point_iterator it = m_shortestPaths->source_points_begin(); it != m_shortestPaths->source_points_end(); ++it)
+    {
+      const Kernel::Point_3& p = m_shortestPaths->point(it->first, it->second);
+      vertices.push_back(p.x());
+      vertices.push_back(p.y());
+      vertices.push_back(p.z());
+    }
+    QApplication::restoreOverrideCursor();
+}
+
+void Scene_polyhedron_shortest_path_item_priv::initialize_buffers(CGAL::Three::Viewer_interface* viewer)const
+{
+    //vao containing the data for the selected lines
+    {
+        program = item->getShaderProgram(Scene_polyhedron_shortest_path_item::PROGRAM_NO_SELECTION, viewer);
+        item->vaos[Selected_Edges]->bind();
+        program->bind();
+        item->buffers[Vertices].bind();
+        item->buffers[Vertices].allocate(vertices.data(), vertices.size()*sizeof(float));
+        program->enableAttributeArray("vertex");
+        program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
+        item->buffers[Vertices].release();
+        item->vaos[Selected_Edges]->release();
+    }
+    item->are_buffers_filled = true;
+}
+bool Scene_polyhedron_shortest_path_item::supportsRenderingMode(RenderingMode m) const
+{
+  switch (m)
+  {
+  case Points:
+    return true;
+  case PointsPlusNormals:
+    return true;
+  case Wireframe:
+    return true;
+  case Flat:
+    return true;
+  case FlatPlusEdges:
+    return true;
+  case Gouraud:
+    return true;
+  default:
+    return true;
+  }
+}
+  
+void Scene_polyhedron_shortest_path_item::draw(CGAL::Three::Viewer_interface* viewer) const
+{
+    if (supportsRenderingMode(renderingMode()))
+    {
+      drawPoints(viewer);
+    }
+}
+
+
+void Scene_polyhedron_shortest_path_item::drawPoints(CGAL::Three::Viewer_interface* viewer) const
+{
+    if(!are_buffers_filled)
+    {
+        d->initialize_buffers(viewer);
+    }
+   glPointSize(4.0f);
+   d->program = getShaderProgram(PROGRAM_NO_SELECTION);
+   attribBuffers(viewer, PROGRAM_NO_SELECTION);
+   vaos[Scene_polyhedron_shortest_path_item_priv::Selected_Edges]->bind();
+   d->program->bind();
+   d->program->setAttributeValue("colors", QColor(Qt::green));
+   viewer->glDrawArrays(GL_POINTS, 0, d->vertices.size()/3);
+   d->program->release();
+   vaos[Scene_polyhedron_shortest_path_item_priv::Selected_Edges]->release();
+   glPointSize(1.0f);
+}
+  
+Scene_polyhedron_shortest_path_item* Scene_polyhedron_shortest_path_item::clone() const
+{
+  return 0;
+}
+
+void Scene_polyhedron_shortest_path_item::set_selection_mode(Selection_mode mode)
+{
+  d->m_selectionMode = mode;
+}
+
+Scene_polyhedron_shortest_path_item::Selection_mode Scene_polyhedron_shortest_path_item::get_selection_mode() const
+{
+  return d->m_selectionMode;
+}
+
+void Scene_polyhedron_shortest_path_item::set_primitives_mode(Primitives_mode mode)
+{
+  d->m_primitivesMode = mode;
+}
+
+Scene_polyhedron_shortest_path_item::Primitives_mode Scene_polyhedron_shortest_path_item::get_primitives_mode() const
+{
+  return d->m_primitivesMode;
+}
+
+void Scene_polyhedron_shortest_path_item_priv::recreate_shortest_path_object()
+{
+  if (m_shortestPaths)
+  {
+    delete m_shortestPaths;
+  }
+
+  m_shortestPaths = new Scene_polyhedron_shortest_path_item::Surface_mesh_shortest_path(*(item->polyhedron()),
+            CGAL::get(boost::vertex_index, *(item->polyhedron())),
+            CGAL::get(CGAL::halfedge_index, *(item->polyhedron())),
+            CGAL::get(CGAL::face_index, *(item->polyhedron())),
+            CGAL::get(CGAL::vertex_point, *(item->polyhedron())));
+            
+  //m_shortestPaths->m_debugOutput = true;
+
+  m_isTreeCached = false;
+}
+
+void Scene_polyhedron_shortest_path_item_priv::ensure_aabb_object()
+{
+  if (!m_isTreeCached)
+  {
+    m_shortestPaths->build_aabb_tree(m_aabbTree);
+    m_isTreeCached = true;
+  }
+}
+
+void Scene_polyhedron_shortest_path_item_priv::ensure_shortest_paths_tree()
+{
+  if (!m_shortestPaths->changed_since_last_build())
+  {
+    m_messages->information("Recomputing shortest paths tree...");
+    m_shortestPaths->build_sequence_tree();
+    m_messages->information("Done.");
+  }
+}
+  
+void Scene_polyhedron_shortest_path_item::poly_item_changed()
+{
+  d->recreate_shortest_path_object();
+  invalidateOpenGLBuffers();
+  Q_EMIT itemChanged();
+}
+  
+void Scene_polyhedron_shortest_path_item::invalidateOpenGLBuffers()
+{
+  d->compute_elements();
+  compute_bbox();
+  are_buffers_filled = false;
+
+}
+
+bool Scene_polyhedron_shortest_path_item_priv::get_mouse_ray(QMouseEvent* mouseEvent, Kernel::Ray_3& outRay)
+{
+  bool found = false;
+  
+  QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
+  qglviewer::Camera* camera = viewer->camera();
+  const qglviewer::Vec point = camera->pointUnderPixel(mouseEvent->pos(), found);
+  
+  if(found)
+  {
+    const qglviewer::Vec orig = camera->position();
+    outRay = Ray_3(Point_3(orig.x, orig.y, orig.z), Point_3(point.x, point.y, point.z));
+  }
+  
+  return found;
+}
+
+void Scene_polyhedron_shortest_path_item_priv::remove_nearest_point(const Scene_polyhedron_shortest_path_item::Face_location& faceLocation)
+{
+  Surface_mesh_shortest_path_traits::Compute_squared_distance_3 computeSquaredDistance3;
+  
+  const Point_3 pickLocation = m_shortestPaths->point(faceLocation.first, faceLocation.second);
+  
+  Surface_mesh_shortest_path::Source_point_iterator found = m_shortestPaths->source_points_end();
+  FT minDistance(0.0);
+  const FT thresholdDistance = FT(0.4);
+  
+  for (Surface_mesh_shortest_path::Source_point_iterator it = m_shortestPaths->source_points_begin(); it != m_shortestPaths->source_points_end(); ++it)
+  {
+    Point_3 sourceLocation = m_shortestPaths->point(it->first, it->second);
+    FT distance = computeSquaredDistance3(sourceLocation, pickLocation);
+    
+    if ((found == m_shortestPaths->source_points_end() && distance <= thresholdDistance) || distance < minDistance)
+    {
+      found = it;
+      minDistance = distance;
+    }
+  }
+  
+  if (found != m_shortestPaths->source_points_end())
+  {
+    m_shortestPaths->remove_source_point(found);
+  }
+}
+
+void Scene_polyhedron_shortest_path_item_priv::get_as_edge_point(Scene_polyhedron_shortest_path_item::Face_location& inOutLocation)
+{
+  size_t minIndex = 0;
+  FT minCoord(inOutLocation.second[0]);
+  
+  for (size_t i = 1; i < 3; ++i)
+  {
+    if (minCoord > inOutLocation.second[i])
+    {
+      minIndex = i;
+      minCoord = inOutLocation.second[i];
+    }
+  }
+  
+  // The nearest edge is that of the two non-minimal barycentric coordinates
+  size_t nearestEdge[2];
+  size_t current = 0;
+  
+  for (size_t i = 0; i < 3; ++i)
+  {
+    if (i != minIndex)
+    {
+      nearestEdge[current] = i;
+      ++current;
+    }
+  }
+
+  Construct_barycentric_coordinate construct_barycentric_coordinate;
+
+  Point_3 trianglePoints[3] = {
+    m_shortestPaths->point(inOutLocation.first, construct_barycentric_coordinate(FT(1.0), FT(0.0), FT(0.0))),
+    m_shortestPaths->point(inOutLocation.first, construct_barycentric_coordinate(FT(0.0), FT(1.0), FT(0.0))),
+    m_shortestPaths->point(inOutLocation.first, construct_barycentric_coordinate(FT(0.0), FT(0.0), FT(1.0))),
+  };
+  
+  CGAL::Surface_mesh_shortest_paths_3::Parametric_distance_along_segment_3<Surface_mesh_shortest_path_traits> parametricDistanceSegment3;
+  
+  Point_3 trianglePoint = m_shortestPaths->point(inOutLocation.first, inOutLocation.second);
+  
+  FT distanceAlongSegment = parametricDistanceSegment3(trianglePoints[nearestEdge[0]], trianglePoints[nearestEdge[1]], trianglePoint);
+  
+  FT coords[3] = { FT(0.0), FT(0.0), FT(0.0), };
+  
+  coords[nearestEdge[1]] = distanceAlongSegment;
+  coords[nearestEdge[0]] = FT(1.0) - distanceAlongSegment;
+
+  inOutLocation.second = construct_barycentric_coordinate(coords[0], coords[1], coords[2]);
+}
+
+void Scene_polyhedron_shortest_path_item_priv::get_as_vertex_point(Scene_polyhedron_shortest_path_item::Face_location& inOutLocation)
+{
+  size_t maxIndex = 0;
+  FT maxCoord(inOutLocation.second[0]);
+  
+  for (size_t i = 1; i < 3; ++i)
+  {
+    if (inOutLocation.second[i] > maxCoord)
+    {
+      maxIndex = i;
+      maxCoord = inOutLocation.second[i];
+    }
+  }
+  
+  FT coords[3] = { FT(0.0), FT(0.0), FT(0.0), };
+  coords[maxIndex] = FT(1.0);
+  
+  Construct_barycentric_coordinate construct_barycentric_coordinate;
+  inOutLocation.second = construct_barycentric_coordinate(coords[0], coords[1], coords[2]);
+}
+
+bool Scene_polyhedron_shortest_path_item_priv::run_point_select(const Ray_3& ray)
+{
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  ensure_aabb_object();
+  
+  Face_location faceLocation = m_shortestPaths->locate(ray, m_aabbTree);
+  
+  if (faceLocation.first == GraphTraits::null_face())
+  {
+    m_messages->information(QObject::tr("Shortest Paths: No face under cursor."));
+    QApplication::restoreOverrideCursor();
+    return false;
+  }
+  else
+  {
+    m_messages->information(QObject::tr("Shortest Paths: Selected Face: %1; Barycentric coordinates: %2 %3 %4")
+      .arg(faceLocation.first->id())
+      .arg(double(faceLocation.second[0]))
+      .arg(double(faceLocation.second[1]))
+      .arg(double(faceLocation.second[2])));
+    switch (m_selectionMode)
+    {
+    case INSERT_POINTS_MODE:
+      switch (m_primitivesMode)
+      {
+      case VERTEX_MODE:
+        get_as_vertex_point(faceLocation);
+        m_shortestPaths->add_source_point(faceLocation.first, faceLocation.second);
+        break;
+      case EDGE_MODE:
+        get_as_edge_point(faceLocation);
+        m_shortestPaths->add_source_point(faceLocation.first, faceLocation.second);
+        break;
+      case FACE_MODE:
+        m_shortestPaths->add_source_point(faceLocation.first, faceLocation.second);
+        break;
+      }
+      break;
+    case REMOVE_POINTS_MODE:
+      remove_nearest_point(faceLocation);
+      break;
+    case SHORTEST_PATH_MODE:
+      switch (m_primitivesMode)
+      {
+      case VERTEX_MODE:
+        get_as_vertex_point(faceLocation);
+        break;
+      case EDGE_MODE:
+        get_as_edge_point(faceLocation);
+        break;
+      case FACE_MODE:
+        break;
+      }
+      
+      if (m_shortestPaths->number_of_source_points() > 0)
+      {
+        ensure_shortest_paths_tree();
+        
+        Scene_polylines_item* polylines = new Scene_polylines_item();
+            
+        polylines->polylines.push_back(Scene_polylines_item::Polyline());
+            
+        m_messages->information(QObject::tr("Computing shortest path polyline..."));
+
+        QTime time;
+        time.start();
+        //~ m_shortestPaths->m_debugOutput=true;
+        m_shortestPaths->shortest_path_points_to_source_points(faceLocation.first, faceLocation.second, std::back_inserter(polylines->polylines.back()));
+        std::cout << "ok (" << time.elapsed() << " ms)" << std::endl;
+        
+        polylines->setName(QObject::tr("%1 (shortest path)").arg(item->polyhedron_item()->name()));
+        polylines->setColor(Qt::red);
+        this->m_sceneInterface->setSelectedItem(-1);
+        this->m_sceneInterface->addItem(polylines);
+        this->m_sceneInterface->changeGroup(polylines, item->parentGroup());
+      }
+      else
+      {
+        m_messages->warning(QObject::tr("No source points to compute shortest paths from."));
+      }
+      break;
+    }
+    item->invalidateOpenGLBuffers();
+    QApplication::restoreOverrideCursor();
+    return true;
+  }
+}
+
+
+
+bool Scene_polyhedron_shortest_path_item::eventFilter(QObject* /*target*/, QEvent* event)
+{
+  if(event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease)
+  {
+    QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
+    Qt::KeyboardModifiers modifiers = keyEvent->modifiers();
+    d->m_shiftHeld = modifiers.testFlag(Qt::ShiftModifier);
+  }
+  
+  if (event->type() == QEvent::MouseButtonPress && d->m_shiftHeld)
+  {
+    QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
+    if(mouseEvent->button() == Qt::LeftButton) 
+    {
+      Ray_3 mouseRay;
+      
+      if (d->get_mouse_ray(mouseEvent, mouseRay))
+      {
+        if (d->run_point_select(mouseRay))
+        {
+          return true;
+        }
+      }
+    }
+  }
+  
+  return false;
+}
+
+bool Scene_polyhedron_shortest_path_item::load(const std::string& file_name)
+{
+  d->m_deferredLoadFilename = file_name;
+  return true;
+}
+
+bool Scene_polyhedron_shortest_path_item::deferred_load(Scene_polyhedron_item* polyhedronItem, CGAL::Three::Scene_interface* sceneInterface, Messages_interface* messages, QMainWindow* mainWindow)
+{
+  initialize(polyhedronItem, sceneInterface, messages, mainWindow);
+  
+  std::ifstream inFile(d->m_deferredLoadFilename.c_str());
+  
+  if (!inFile) 
+  { 
+    return false;
+  }
+  
+  d->m_shortestPaths->clear();
+  
+  std::vector<face_descriptor> listOfFaces;
+  listOfFaces.reserve(CGAL::num_faces(*polyhedron()));
+  face_iterator current, end;
+  for (boost::tie(current, end) = CGAL::faces(*polyhedron()); current != end; ++current)
+  {
+    listOfFaces.push_back(*current);
+  }
+
+  std::string line;
+  std::size_t faceId;
+  Barycentric_coordinate location;
+  Construct_barycentric_coordinate construct_barycentric_coordinate;
+
+  while (std::getline(inFile, line))
+  {
+    std::istringstream lineStream(line);
+    FT coords[3];
+    lineStream >> faceId >> coords[0] >> coords[1] >> coords[2];
+    
+    location = construct_barycentric_coordinate(coords[0], coords[1], coords[2]);
+    
+    // std::cout << "Read in face: " << faceId << " , " << location << std::endl;
+    
+    d->m_shortestPaths->add_source_point(listOfFaces[faceId], location);
+  }
+
+  return true;
+}
+
+bool Scene_polyhedron_shortest_path_item::save(const std::string& file_name) const 
+{
+  std::ofstream out(file_name.c_str());
+  
+  if (!out)
+  { 
+    return false; 
+  }
+
+  for(Surface_mesh_shortest_path::Source_point_iterator it = d->m_shortestPaths->source_points_begin(); it != d->m_shortestPaths->source_points_end(); ++it)
+  { 
+    // std::cout << "Output face location: " << it->first->id() << " , " << it->second << std::endl;
+    out << it->first->id() << " " << it->second[0] << " " << it->second[1] << " " << it->second[3] << std::endl;
+  }
+
+  return true;
+}
+
+void Scene_polyhedron_shortest_path_item::initialize(Scene_polyhedron_item* polyhedronItem, CGAL::Three::Scene_interface* sceneInterface, Messages_interface* messages, QMainWindow* mainWindow)
+{
+  d->m_mainWindow = mainWindow;
+  d->m_messages = messages;
+  this->poly_item = polyhedronItem;
+  d->m_sceneInterface = sceneInterface;
+  connect(polyhedronItem, SIGNAL(item_is_about_to_be_changed()), this, SLOT(poly_item_changed()));
+  QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
+  viewer->installEventFilter(this);
+  d->m_mainWindow->installEventFilter(this);
+  d->recreate_shortest_path_object();
+}
+
+void Scene_polyhedron_shortest_path_item::deinitialize()
+{
+  d->deinitialize();
+  this->poly_item = NULL;
+}
+
+bool Scene_polyhedron_shortest_path_item::isFinite() const
+{
+  return true;
+}
+
+bool Scene_polyhedron_shortest_path_item::isEmpty() const 
+{
+  return false;
+}
+
+void Scene_polyhedron_shortest_path_item::compute_bbox() const
+{
+  _bbox = polyhedron_item()->bbox();
+}
+
+QString Scene_polyhedron_shortest_path_item::toolTip() const
+{
+  return QString();
+}
+
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.h b/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.h
new file mode 100644
index 0000000..9311782
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.h
@@ -0,0 +1,119 @@
+#ifndef SCENE_POLYHEDRON_SHORTEST_PATH_ITEM_H
+#define SCENE_POLYHEDRON_SHORTEST_PATH_ITEM_H
+
+#include "Scene_polyhedron_shortest_path_item_config.h"
+#include "Scene_polyhedron_item_decorator.h"
+#include <CGAL/Three/Scene_interface.h>
+#include "Messages_interface.h"
+
+#include "Polyhedron_type.h"
+#include "Kernel_type.h"
+
+#include "opengl_tools.h"
+
+#include <QGLViewer/qglviewer.h>
+#include <QKeyEvent>
+#include <QMouseEvent>
+#include <QMainWindow>
+#include <QObject>
+
+#include <string>
+#include <list>
+
+#ifndef Q_MOC_RUN
+#include <CGAL/Surface_mesh_shortest_path.h>
+#endif
+
+#include <CGAL/AABB_face_graph_triangle_primitive.h>
+#include <CGAL/AABB_traits.h>
+#include <CGAL/AABB_tree.h>
+
+#include <boost/current_function.hpp>
+
+struct Scene_polyhedron_shortest_path_item_priv;
+
+class SCENE_POLYHEDRON_SHORTEST_PATH_ITEM_EXPORT Scene_polyhedron_shortest_path_item : public Scene_polyhedron_item_decorator
+{
+  Q_OBJECT
+  
+  friend class Polyhedron_demo_shortest_path_plugin;
+  
+public:
+  typedef CGAL::Three::Scene_interface::Bbox Bbox;
+  
+  typedef boost::property_map<Polyhedron, CGAL::vertex_point_t>::type VertexPointMap;
+  
+  typedef boost::graph_traits<Polyhedron> GraphTraits;
+  typedef GraphTraits::face_descriptor face_descriptor;
+  typedef GraphTraits::face_iterator face_iterator;
+  
+  typedef CGAL::Surface_mesh_shortest_path_traits<Kernel, Polyhedron> Surface_mesh_shortest_path_traits;
+  typedef CGAL::Surface_mesh_shortest_path<Surface_mesh_shortest_path_traits> Surface_mesh_shortest_path;
+  typedef Surface_mesh_shortest_path::Face_location Face_location;
+  typedef CGAL::AABB_face_graph_triangle_primitive<Polyhedron, VertexPointMap> AABB_face_graph_primitive;
+  typedef CGAL::AABB_traits<Kernel, AABB_face_graph_primitive> AABB_face_graph_traits;
+  typedef CGAL::AABB_tree<AABB_face_graph_traits> AABB_face_graph_tree;
+  
+  typedef Surface_mesh_shortest_path_traits::Barycentric_coordinate Barycentric_coordinate;
+  typedef Surface_mesh_shortest_path_traits::Construct_barycentric_coordinate Construct_barycentric_coordinate;
+  typedef Surface_mesh_shortest_path_traits::Ray_3 Ray_3;
+  typedef Surface_mesh_shortest_path_traits::Point_3 Point_3;
+  typedef Surface_mesh_shortest_path_traits::FT FT;
+
+  enum Selection_mode
+  {
+    INSERT_POINTS_MODE = 0,
+    REMOVE_POINTS_MODE = 1,
+    SHORTEST_PATH_MODE = 2
+  };
+
+  enum Primitives_mode
+  {
+    VERTEX_MODE = 0,
+    EDGE_MODE = 1,
+    FACE_MODE = 2
+  };
+  
+public:
+
+  Scene_polyhedron_shortest_path_item();
+  Scene_polyhedron_shortest_path_item(Scene_polyhedron_item* polyhedronItem, CGAL::Three::Scene_interface* sceneInterface, Messages_interface* messages, QMainWindow* mainWindow);
+  ~Scene_polyhedron_shortest_path_item();
+  
+  void set_selection_mode(Selection_mode mode);
+  Selection_mode get_selection_mode() const;
+  void set_primitives_mode(Primitives_mode mode);
+  Primitives_mode get_primitives_mode() const;
+  
+  virtual bool supportsRenderingMode(RenderingMode m) const;
+  using Scene_polyhedron_item_decorator::draw;
+  virtual void draw(CGAL::Three::Viewer_interface*) const;
+  // Points OpenGL drawing
+  virtual void drawPoints(CGAL::Three::Viewer_interface*) const;
+  
+  virtual Scene_polyhedron_shortest_path_item* clone() const;
+  
+  bool deferred_load(Scene_polyhedron_item* polyhedronItem, CGAL::Three::Scene_interface* sceneInterface, Messages_interface* messages, QMainWindow* mainWindow);
+  virtual bool load(const std::string& file_name);
+  virtual bool save(const std::string& file_name) const;
+  
+protected:
+  void initialize(Scene_polyhedron_item* polyhedronItem, CGAL::Three::Scene_interface* sceneInterface, Messages_interface* messages, QMainWindow* mainWindow);
+  void deinitialize();
+  
+  virtual bool isFinite() const;
+  virtual bool isEmpty() const;
+  virtual void compute_bbox()const;
+  virtual QString toolTip() const;
+  friend struct Scene_polyhedron_shortest_path_item_priv;
+  Scene_polyhedron_shortest_path_item_priv* d;
+  
+protected:
+  bool eventFilter(QObject* /*target*/, QEvent * gen_event);
+  
+public Q_SLOTS:
+  virtual void poly_item_changed();
+  virtual void invalidateOpenGLBuffers();
+};
+
+#endif // SCENE_POLYHEDRON_SHORTEST_PATH_ITEM_H
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh/Shortest_path_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh/Shortest_path_plugin.cpp
new file mode 100644
index 0000000..3a65a49
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh/Shortest_path_plugin.cpp
@@ -0,0 +1,316 @@
+#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+#include <CGAL/Three/Scene_group_item.h>
+
+#include "Messages_interface.h"
+#include "Scene_polyhedron_item.h"
+#include "Scene_polylines_item.h"
+#include "Scene_polyhedron_selection_item.h"
+#include "Scene_polyhedron_shortest_path_item.h"
+#include "Polyhedron_type.h"
+#include "Scene.h"
+#include "ui_Shortest_path_widget.h"
+
+#include <QApplication>
+#include <QMainWindow>
+#include <QInputDialog>
+#include <QTime>
+#include <QAction>
+#include <QDebug>
+#include <QObject>
+#include <QDockWidget>
+//#include <QtConcurrentRun>
+#include <map>
+#include <algorithm>
+#include <vector>
+using namespace CGAL::Three;
+class Polyhedron_demo_shortest_path_plugin :
+    public QObject,
+    public Polyhedron_demo_plugin_helper
+{
+  Q_OBJECT
+    Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+    Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+private:
+
+  typedef boost::property_map<Polyhedron, boost::vertex_index_t>::type VertexIndexMap;
+  typedef boost::property_map<Polyhedron, CGAL::halfedge_index_t>::type HalfedgeIndexMap;
+  typedef boost::property_map<Polyhedron, CGAL::face_index_t>::type FaceIndexMap;
+  typedef boost::property_map<Polyhedron, CGAL::vertex_point_t>::type VertexPointMap;
+
+  typedef CGAL::Surface_mesh_shortest_path_traits<Kernel, Polyhedron> Surface_mesh_shortest_path_traits;
+  typedef CGAL::Surface_mesh_shortest_path<Surface_mesh_shortest_path_traits, VertexIndexMap, HalfedgeIndexMap, FaceIndexMap, VertexPointMap> Surface_mesh_shortest_path;
+
+  struct ShortestPathsPointsVisitor
+  {
+    typedef std::vector<Surface_mesh_shortest_path::Point_3> Container;
+    Container& m_container;
+
+    ShortestPathsPointsVisitor(Container& container)
+      : m_container(container)
+    {
+    }
+
+    void point(const Surface_mesh_shortest_path::Point_3& point)
+    {
+      std::cout << point << std::endl;
+      m_container.push_back(point);
+    }
+  };
+
+  typedef std::map<Scene_polyhedron_item*, Scene_polyhedron_shortest_path_item* > Shortest_paths_map;
+
+public:
+
+  QList<QAction*> actions() const
+  {
+      return QList<QAction*>() << actionMakeShortestPaths;
+  }
+
+  bool applicable(QAction*) const
+  {
+    return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
+  }
+
+  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface* messages)
+  {
+    this->scene = scene_interface;
+    this->mw = mainWindow;
+    this->m_messages = messages;
+
+    dock_widget = new QDockWidget("Shortest path", mw);
+
+    dock_widget->setVisible(false);
+
+    ui_widget.setupUi(dock_widget);
+    addDockWidget(dock_widget);
+
+    connect(ui_widget.Selection_type_combo_box, SIGNAL(currentIndexChanged(int)),  this, SLOT(on_Selection_type_combo_box_changed(int)));
+    connect(ui_widget.Primitives_type_combo_box, SIGNAL(currentIndexChanged(int)), this, SLOT(on_Primitives_type_combo_box_changed(int)));
+
+    actionMakeShortestPaths = new QAction("Make Shortest Path", this->mw);
+    actionMakeShortestPaths->setProperty("subMenuName", "Triangulated Surface Mesh Shortest Paths");
+    actionMakeShortestPaths->setObjectName("actionMakeShortestPaths");
+
+    Scene* trueScene = dynamic_cast<Scene*>(scene_interface);
+    // This is for later
+    if(trueScene) {
+        connect(trueScene, SIGNAL(itemAboutToBeDestroyed(CGAL::Three::Scene_item*)), this, SLOT(item_about_to_be_destroyed(CGAL::Three::Scene_item*)));
+        connect(trueScene, SIGNAL(newItem(int)), this, SLOT(new_item(int)));
+    }
+    autoConnectActions();
+  }
+
+  virtual void closure()
+  {
+    dock_widget->hide();
+  }
+private:
+
+  Scene_polyhedron_shortest_path_item::Selection_mode get_selection_mode() const;
+  Scene_polyhedron_shortest_path_item::Primitives_mode get_primitives_mode() const;
+
+  void check_and_set_ids(Polyhedron* polyhedron);
+
+public Q_SLOTS:
+  void on_actionMakeShortestPaths_triggered();
+  void on_Selection_type_combo_box_changed(int index);
+  void on_Primitives_type_combo_box_changed(int index);
+  void new_item(int index);
+  void item_about_to_be_destroyed(CGAL::Three::Scene_item* scene_item);
+
+private:
+  Shortest_paths_map m_shortestPathsMap;
+
+  Messages_interface* m_messages;
+  QAction* actionMakeShortestPaths;
+  QDockWidget* dock_widget;
+  Ui::Shortest_path ui_widget;
+};
+
+Scene_polyhedron_shortest_path_item::Selection_mode Polyhedron_demo_shortest_path_plugin::get_selection_mode() const
+{
+  return (Scene_polyhedron_shortest_path_item::Selection_mode) ui_widget.Selection_type_combo_box->currentIndex();
+}
+
+Scene_polyhedron_shortest_path_item::Primitives_mode Polyhedron_demo_shortest_path_plugin::get_primitives_mode() const
+{
+  return (Scene_polyhedron_shortest_path_item::Primitives_mode) ui_widget.Primitives_type_combo_box->currentIndex();
+}
+
+void Polyhedron_demo_shortest_path_plugin::item_about_to_be_destroyed(CGAL::Three::Scene_item* sceneItem)
+{
+    // if polyhedron item
+    Scene_polyhedron_item* polyhedronItem = qobject_cast<Scene_polyhedron_item*>(sceneItem);
+    if(polyhedronItem)
+    {
+      Shortest_paths_map::iterator found = m_shortestPathsMap.find(polyhedronItem);
+
+      if (found != m_shortestPathsMap.end())
+      {
+        Scene_polyhedron_shortest_path_item* shortestPathItem = found->second;
+        m_shortestPathsMap.erase(found);
+        scene->erase(scene->item_id(shortestPathItem));
+      }
+    }
+
+    // if polyhedron selection item
+    Scene_polyhedron_shortest_path_item* shortestPathItem = qobject_cast<Scene_polyhedron_shortest_path_item*>(sceneItem);
+    if(shortestPathItem)
+    {
+      Scene_polyhedron_item* polyhedronItem = shortestPathItem->polyhedron_item();
+      Shortest_paths_map::iterator found = m_shortestPathsMap.find(polyhedronItem);
+
+      if (found != m_shortestPathsMap.end())
+      {
+        m_shortestPathsMap.erase(found);
+      }
+    }
+  }
+
+void Polyhedron_demo_shortest_path_plugin::new_item(int itemIndex)
+{
+  Scene_polyhedron_shortest_path_item* item = qobject_cast<Scene_polyhedron_shortest_path_item*>(scene->item(itemIndex));
+
+  if (!item)
+  {
+    return;
+  }
+
+  if(item->polyhedron_item() == NULL)
+  {
+    Scene_polyhedron_item* polyhedronItem = getSelectedItem<Scene_polyhedron_item>();
+
+    if(!polyhedronItem)
+    {
+      CGAL_assertion(item->polyhedron_item() == NULL); // which means it is coming from selection_io loader
+      this->m_messages->information(tr("Error: please select corresponding polyhedron item from Geometric Objects list."));
+      scene->erase(itemIndex);
+      return;
+    }
+
+    if(!item->deferred_load(polyhedronItem, this->scene, this->m_messages, this->mw))
+    {
+      this->m_messages->information("Error: loading selection item is not successful!");
+      scene->erase(itemIndex);
+      return;
+    }
+  }
+
+  check_and_set_ids(item->polyhedron_item()->polyhedron());
+
+  Scene_polyhedron_shortest_path_item::Selection_mode selectionMode = get_selection_mode(); // Scene_polyhedron_shortest_path_item::INSERT_POINTS_MODE;
+
+  std::cout << "Selection mode: " << selectionMode << std::endl;
+
+  item->set_selection_mode(selectionMode);
+
+  Scene_polyhedron_shortest_path_item::Primitives_mode primitivesMode = get_primitives_mode(); // Scene_polyhedron_shortest_path_item::FACE_MODE;
+
+  std::cout << "Primitives mode: " << primitivesMode << std::endl;
+
+  item->set_primitives_mode(primitivesMode);
+
+  item->setRenderingMode(Flat);
+
+  if(item->name() == "unamed")
+  {
+    item->setName(tr("%1 (shortest path computation item)").arg(item->polyhedron_item()->name()));
+  }
+
+  m_shortestPathsMap.insert(std::make_pair(item->polyhedron_item(), item));
+}
+
+void Polyhedron_demo_shortest_path_plugin::on_actionMakeShortestPaths_triggered()
+{
+  Scene_polyhedron_item* polyhedronItem = getSelectedItem<Scene_polyhedron_item>();
+  if (polyhedronItem)
+  {
+    if (m_shortestPathsMap.find(polyhedronItem) == m_shortestPathsMap.end())
+    {
+      dock_widget->show();
+      dock_widget->raise();
+      // The other parts of initialization will be handled by the 'new_item' callback
+      Scene_group_item* group = new Scene_group_item(QString("%1 Shortest Path").arg(polyhedronItem->name()));
+      Scene_polyhedron_shortest_path_item* sp_item =new Scene_polyhedron_shortest_path_item(polyhedronItem, this->scene, this->m_messages, this->mw);
+      sp_item->setName(tr("Source Points for %1").arg(polyhedronItem->name()));
+      scene->addItem(sp_item);
+      scene->addItem(group);
+      scene->changeGroup(sp_item, group);
+    }
+    else
+    {
+      this->m_messages->warning(tr("A shortest path item for this polyhedron already exists (only one allowed per for now)"));
+    }
+  }
+  else
+  {
+    this->m_messages->warning("No polyhedron selected.");
+  }
+}
+
+void Polyhedron_demo_shortest_path_plugin::on_Selection_type_combo_box_changed(int index)
+{
+  std::cout << "Selection mode changed: " << index << std::endl;
+
+  for (Shortest_paths_map::iterator it = m_shortestPathsMap.begin(); it != m_shortestPathsMap.end(); ++it)
+  {
+    it->second->set_selection_mode(get_selection_mode());
+  }
+}
+
+void Polyhedron_demo_shortest_path_plugin::on_Primitives_type_combo_box_changed(int index)
+{
+  std::cout << "Primitives mode changed: " << index << std::endl;
+
+  for (Shortest_paths_map::iterator it = m_shortestPathsMap.begin(); it != m_shortestPathsMap.end(); ++it)
+  {
+    it->second->set_primitives_mode(get_primitives_mode());
+  }
+}
+
+void Polyhedron_demo_shortest_path_plugin::check_and_set_ids(Polyhedron* polyhedron)
+{
+  Polyhedron::Vertex_iterator testVertex1 = polyhedron->vertices_begin();
+  Polyhedron::Vertex_iterator testVertex2 = ++polyhedron->vertices_begin();
+
+  if(testVertex1->id() == testVertex2->id())
+  {
+    std::size_t vertexId = 0;
+    for(Polyhedron::Vertex_iterator currentVertex = polyhedron->vertices_begin();
+        currentVertex != polyhedron->vertices_end(); ++currentVertex, ++vertexId)
+    {
+        currentVertex->id() = vertexId;
+    }
+  }
+
+  Polyhedron::Halfedge_iterator testHalfedge1 = polyhedron->halfedges_begin();
+  Polyhedron::Halfedge_iterator testHalfedge2 = ++polyhedron->halfedges_begin();
+
+  if (testHalfedge1->id() == testHalfedge2->id())
+  {
+    std::size_t halfedgeId = 0;
+    for(Polyhedron::Halfedge_iterator currentHalfedge = polyhedron->halfedges_begin();
+        currentHalfedge != polyhedron->halfedges_end(); ++currentHalfedge, ++halfedgeId)
+    {
+        currentHalfedge->id() = halfedgeId;
+    }
+  }
+
+  Polyhedron::Facet_iterator testFacet1 = polyhedron->facets_begin();
+  Polyhedron::Facet_iterator testFacet2 = ++polyhedron->facets_begin();
+
+  if (testFacet1->id() == testFacet2->id())
+  {
+    std::size_t facetId = 0;
+    for(Polyhedron::Facet_iterator currentFacet = polyhedron->facets_begin();
+        currentFacet != polyhedron->facets_end(); ++currentFacet, ++facetId)
+    {
+        currentFacet->id() = facetId;
+    }
+  }
+}
+
+
+
+#include "Shortest_path_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh/Shortest_path_widget.ui b/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh/Shortest_path_widget.ui
new file mode 100644
index 0000000..754cb69
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh/Shortest_path_widget.ui
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Shortest_path</class>
+ <widget class="QDockWidget" name="Shortest_path">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>441</width>
+    <height>257</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Shortest Path</string>
+  </property>
+  <widget class="QWidget" name="dockWidgetContents">
+   <layout class="QGridLayout" name="gridLayout">
+    <item row="1" column="0">
+     <widget class="QGroupBox" name="groupBox">
+      <property name="title">
+       <string>Operation</string>
+      </property>
+      <layout class="QVBoxLayout" name="verticalLayout">
+       <item>
+        <widget class="QComboBox" name="Selection_type_combo_box">
+         <item>
+          <property name="text">
+           <string>Insert Source Point</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>Remove Source Point</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>Insert Target and Compute Path</string>
+          </property>
+         </item>
+        </widget>
+       </item>
+      </layout>
+     </widget>
+    </item>
+    <item row="1" column="1">
+     <widget class="QGroupBox" name="groupBox_2">
+      <property name="title">
+       <string>Source/Target on:</string>
+      </property>
+      <layout class="QVBoxLayout" name="verticalLayout_2">
+       <item>
+        <widget class="QComboBox" name="Primitives_type_combo_box">
+         <item>
+          <property name="text">
+           <string>Vertex</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>Edge</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>Face</string>
+          </property>
+         </item>
+        </widget>
+       </item>
+      </layout>
+     </widget>
+    </item>
+    <item row="0" column="0">
+     <spacer name="verticalSpacer">
+      <property name="orientation">
+       <enum>Qt::Vertical</enum>
+      </property>
+      <property name="sizeHint" stdset="0">
+       <size>
+        <width>20</width>
+        <height>40</height>
+       </size>
+      </property>
+     </spacer>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh_deformation/CMakeLists.txt b/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh_deformation/CMakeLists.txt
new file mode 100644
index 0000000..50c2451
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh_deformation/CMakeLists.txt
@@ -0,0 +1,7 @@
+include( polyhedron_demo_macros )
+if ( EIGEN3_FOUND AND "${EIGEN3_VERSION}" VERSION_GREATER "3.1.90" )
+  polyhedron_demo_plugin(edit_polyhedron_plugin Edit_polyhedron_plugin Deform_mesh.ui)
+  target_link_libraries(edit_polyhedron_plugin scene_polyhedron_item scene_edit_polyhedron_item scene_polyhedron_selection_item)
+else()
+  message(STATUS "NOTICE: The polyhedron edit plugin require Eigen 3.2 (or higher) and will not be available.")
+endif()
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh_deformation/Deform_mesh.ui b/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh_deformation/Deform_mesh.ui
new file mode 100644
index 0000000..f9027c5
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh_deformation/Deform_mesh.ui
@@ -0,0 +1,440 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DeformMesh</class>
+ <widget class="QDockWidget" name="DeformMesh">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>547</width>
+    <height>347</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Surface Mesh Deformation</string>
+  </property>
+  <widget class="QWidget" name="dockWidgetContents">
+   <layout class="QVBoxLayout" name="verticalLayout">
+    <item>
+     <widget class="QTabWidget" name="tabWidget">
+      <property name="currentIndex">
+       <number>0</number>
+      </property>
+      <widget class="QWidget" name="tab">
+       <attribute name="title">
+        <string>Selection</string>
+       </attribute>
+       <layout class="QVBoxLayout" name="verticalLayout_9">
+        <item>
+         <layout class="QHBoxLayout" name="horizontalLayout_13">
+          <item>
+           <widget class="QGroupBox" name="RCgroup">
+            <layout class="QVBoxLayout" name="verticalLayout_7">
+             <item>
+              <widget class="QRadioButton" name="ROIRadioButton">
+               <property name="toolTip">
+                <string>Use Shift + Left Click to paint ROI vertices</string>
+               </property>
+               <property name="text">
+                <string>ROI</string>
+               </property>
+               <property name="checked">
+                <bool>true</bool>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QRadioButton" name="CtrlVertRadioButton">
+               <property name="toolTip">
+                <string>Use Shift + Left Click to paint control vertices</string>
+               </property>
+               <property name="text">
+                <string>Control vertices</string>
+               </property>
+              </widget>
+             </item>
+            </layout>
+           </widget>
+          </item>
+          <item>
+           <layout class="QVBoxLayout" name="RingLayout">
+            <item>
+             <layout class="QHBoxLayout" name="horizontalLayout_4" stretch="0,1">
+              <item>
+               <layout class="QVBoxLayout" name="verticalLayout_5">
+                <item>
+                 <widget class="QLabel" name="label">
+                  <property name="text">
+                   <string>Brush Size ROI:</string>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <widget class="QLabel" name="label_2">
+                  <property name="text">
+                   <string>Control Vertices Brush Size:</string>
+                  </property>
+                 </widget>
+                </item>
+               </layout>
+              </item>
+              <item>
+               <layout class="QVBoxLayout" name="verticalLayout_2">
+                <item>
+                 <widget class="QSpinBox" name="BrushSpinBoxRoi"/>
+                </item>
+                <item>
+                 <widget class="QSpinBox" name="BrushSpinBoxCtrlVert"/>
+                </item>
+               </layout>
+              </item>
+             </layout>
+            </item>
+           </layout>
+          </item>
+          <item>
+           <widget class="QGroupBox" name="InsertEraseGroup">
+            <layout class="QVBoxLayout" name="verticalLayout_8">
+             <item>
+              <widget class="QRadioButton" name="InsertRadioButton">
+               <property name="text">
+                <string>Insertion</string>
+               </property>
+               <property name="checked">
+                <bool>true</bool>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QRadioButton" name="EraseRadioButton">
+               <property name="text">
+                <string>Removal</string>
+               </property>
+              </widget>
+             </item>
+            </layout>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="horizontalLayout_3">
+          <item>
+           <widget class="QPushButton" name="SelectAllVerticesPushButton">
+            <property name="text">
+             <string>Set All Vertices as ROI</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="ClearROIPushButton">
+            <property name="text">
+             <string>Clear ROI</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QVBoxLayout" name="verticalLayout_4">
+          <item>
+           <layout class="QHBoxLayout" name="horizontalLayout_8" stretch="0,1,0">
+            <item>
+             <widget class="QLabel" name="label_3">
+              <property name="text">
+               <string>Isolated Component Size:</string>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QSpinBox" name="Threshold_size_spin_box">
+              <property name="maximum">
+               <number>999999999</number>
+              </property>
+              <property name="value">
+               <number>8</number>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QPushButton" name="Get_minimum_button">
+              <property name="text">
+               <string>Get Minimum</string>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </item>
+          <item>
+           <widget class="QPushButton" name="Select_isolated_components_button">
+            <property name="text">
+             <string>Select Isolated Components Below Threshold</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="tab_2">
+       <attribute name="title">
+        <string>Remeshing</string>
+       </attribute>
+       <layout class="QHBoxLayout" name="horizontalLayout_6">
+        <item>
+         <layout class="QHBoxLayout" name="horizontalLayout_12">
+          <item>
+           <widget class="QCheckBox" name="RemeshingCheckBox">
+            <property name="toolTip">
+             <string>Warning : after remeshing all ROI and control vertices will be unselected. "Discard changes" will be unavailable.</string>
+            </property>
+            <property name="layoutDirection">
+             <enum>Qt::LeftToRight</enum>
+            </property>
+            <property name="text">
+             <string>Remesh after deformation</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <layout class="QVBoxLayout" name="verticalLayout_6">
+            <item>
+             <layout class="QHBoxLayout" name="horizontalLayout_7" stretch="0,1">
+              <item>
+               <widget class="QCheckBox" name="remeshingEdgeLengthInput_checkBox">
+                <property name="toolTip">
+                 <string>If unchecked, automatic value is used (the average edge length at ROI boundary)</string>
+                </property>
+                <property name="layoutDirection">
+                 <enum>Qt::RightToLeft</enum>
+                </property>
+                <property name="text">
+                 <string>Target edge length</string>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QDoubleSpinBox" name="remeshing_edge_length_spinbox"/>
+              </item>
+             </layout>
+            </item>
+            <item>
+             <layout class="QHBoxLayout" name="horizontalLayout_9" stretch="0,1">
+              <item>
+               <widget class="QLabel" name="label_4">
+                <property name="layoutDirection">
+                 <enum>Qt::RightToLeft</enum>
+                </property>
+                <property name="text">
+                 <string>Nb. iterations</string>
+                </property>
+                <property name="alignment">
+                 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QSpinBox" name="remeshing_iterations_spinbox"/>
+              </item>
+             </layout>
+            </item>
+           </layout>
+          </item>
+         </layout>
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="tab_3">
+       <attribute name="title">
+        <string>Groups</string>
+       </attribute>
+       <layout class="QHBoxLayout" name="horizontalLayout_10">
+        <item>
+         <layout class="QVBoxLayout" name="verticalLayout_3">
+          <item>
+           <layout class="QHBoxLayout" name="horizontalLayout">
+            <item>
+             <widget class="QPushButton" name="PrevCtrlVertPushButton">
+              <property name="sizePolicy">
+               <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+                <horstretch>0</horstretch>
+                <verstretch>0</verstretch>
+               </sizepolicy>
+              </property>
+              <property name="text">
+               <string><<</string>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QPushButton" name="NextCtrlVertPushButton">
+              <property name="text">
+               <string>>></string>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </item>
+          <item>
+           <layout class="QHBoxLayout" name="horizontalLayout_2">
+            <item>
+             <widget class="QPushButton" name="AddCtrlVertPushButton">
+              <property name="text">
+               <string>Create new</string>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QPushButton" name="DeleteCtrlVertPushButton">
+              <property name="text">
+               <string>Delete </string>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </item>
+         </layout>
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="tab_4">
+       <attribute name="title">
+        <string>Display and IO</string>
+       </attribute>
+       <layout class="QHBoxLayout" name="horizontalLayout_5">
+        <item>
+         <layout class="QGridLayout" name="gridLayout_2">
+          <property name="sizeConstraint">
+           <enum>QLayout::SetDefaultConstraint</enum>
+          </property>
+          <item row="0" column="0">
+           <widget class="QCheckBox" name="ShowROICheckBox">
+            <property name="text">
+             <string>Show Non Control Vertices</string>
+            </property>
+            <property name="checked">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item row="0" column="1">
+           <widget class="QPushButton" name="ReadROIPushButton">
+            <property name="text">
+             <string>Load ROI / Control Vertices</string>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="1">
+           <widget class="QPushButton" name="SaveROIPushButton">
+            <property name="text">
+             <string>Save ROI / Control Vertices</string>
+            </property>
+           </widget>
+          </item>
+          <item row="2" column="1">
+           <widget class="QPushButton" name="importSelectionPushButton">
+            <property name="text">
+             <string>Import Selection from Selection_item</string>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="0">
+           <widget class="QCheckBox" name="ShowAsSphereCheckBox">
+            <property name="text">
+             <string>Show As Sphere</string>
+            </property>
+            <property name="checked">
+             <bool>false</bool>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+       </layout>
+      </widget>
+     </widget>
+    </item>
+    <item>
+     <widget class="Line" name="line">
+      <property name="orientation">
+       <enum>Qt::Horizontal</enum>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <layout class="QHBoxLayout" name="horizontalLayout_11">
+      <item>
+       <widget class="QCheckBox" name="ActivatePivotingCheckBox">
+        <property name="text">
+         <string>Activate Pivoting </string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QCheckBox" name="ActivateFixedPlaneCheckBox">
+        <property name="text">
+         <string>Activate Fixed Plane Deformation</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </item>
+    <item>
+     <layout class="QHBoxLayout" name="horizontalLayout_14">
+      <item>
+       <widget class="QPushButton" name="DiscardChangesPushButton">
+        <property name="toolTip">
+         <string>Reset mesh to last version saved by "Overwrite Initial Geometry". Not available when Remeshing is ON.</string>
+        </property>
+        <property name="text">
+         <string>Discard changes</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="ApplyAndClosePushButton">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="text">
+         <string>Apply and Close</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="OverwritePushButton">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="text">
+         <string>Overwrite Initial Geometry</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </item>
+    <item>
+     <spacer name="verticalSpacer">
+      <property name="orientation">
+       <enum>Qt::Vertical</enum>
+      </property>
+      <property name="sizeHint" stdset="0">
+       <size>
+        <width>20</width>
+        <height>40</height>
+       </size>
+      </property>
+     </spacer>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh_deformation/Edit_polyhedron_plugin.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh_deformation/Edit_polyhedron_plugin.cpp
new file mode 100644
index 0000000..367fe63
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh_deformation/Edit_polyhedron_plugin.cpp
@@ -0,0 +1,550 @@
+#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
+#include <CGAL/Three/Viewer_interface.h>
+#include "Scene_polyhedron_item.h"
+#include "Scene_edit_polyhedron_item.h"
+#include "Scene_polyhedron_selection_item.h"
+
+#include <QAction>
+#include <QMainWindow>
+#include <QFileDialog>
+#include <QMessageBox>
+
+#include "ui_Deform_mesh.h"
+using namespace CGAL::Three;
+class Polyhedron_demo_edit_polyhedron_plugin : 
+  public QObject,
+  public Polyhedron_demo_plugin_helper
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+public:
+  Polyhedron_demo_edit_polyhedron_plugin() 
+    : Polyhedron_demo_plugin_helper(), dock_widget(NULL)
+  { }
+  ~Polyhedron_demo_edit_polyhedron_plugin()
+  { }
+
+  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*);
+  virtual void closure()
+  {
+    dock_widget->hide();
+  }
+  QList<QAction*> actions() const;
+  bool applicable(QAction*) const;
+
+public Q_SLOTS:
+  void on_actionDeformation_triggered();
+  /////// Dock window signal handlers //////
+  // what they do is simply transmiting required 'action' to selected scene_edit_polyhedron_item object
+  void on_AddCtrlVertPushButton_clicked();
+  void on_PrevCtrlVertPushButton_clicked();
+  void on_NextCtrlVertPushButton_clicked();
+  void on_SelectAllVerticesPushButton_clicked();
+  void on_DeleteCtrlVertPushButton_clicked();  
+  void on_ApplyAndClosePushButton_clicked();
+  void on_DiscardChangesPushButton_clicked();
+  void on_ClearROIPushButton_clicked();
+  void on_ShowROICheckBox_stateChanged(int state);
+  void on_ShowAsSphereCheckBox_stateChanged(int state);  
+  void on_ActivatePivotingCheckBox_stateChanged(int state);
+  void on_ActivateFixedPlaneCheckBox_stateChanged(int state);
+  void on_OverwritePushButton_clicked();
+  void on_SaveROIPushButton_clicked();
+  void on_ReadROIPushButton_clicked();
+  void dock_widget_visibility_changed(bool visible);
+  void on_Select_isolated_components_button_clicked();
+  void on_Get_minimum_button_clicked();
+
+  void on_BrushSpinBoxCtrlVert_changed(int);
+  void on_BrushSpinBoxRoi_changed(int);
+  void on_ROIRadioButton_toggled(bool);
+  void on_importSelectionPushButton_clicked();
+  void importSelection(Scene_polyhedron_selection_item*, Scene_edit_polyhedron_item*);
+private:
+  typedef CGAL::Three::Scene_interface::Item_id Item_id;
+  std::vector<QColor> saved_color;
+  bool is_color_vector_read_only;
+  Scene_edit_polyhedron_item* convert_to_edit_polyhedron(Item_id, Scene_polyhedron_item*);
+  Scene_polyhedron_item* convert_to_plain_polyhedron(Item_id, Scene_edit_polyhedron_item*);
+  void updateSelectionItems(Scene_polyhedron_item* target);
+
+  Ui::DeformMesh ui_widget;
+  QDockWidget* dock_widget;
+
+  QAction* actionDeformation;
+  RenderingMode last_RM;
+}; // end Polyhedron_demo_edit_polyhedron_plugin
+
+QList<QAction*> Polyhedron_demo_edit_polyhedron_plugin::actions() const {
+  return QList<QAction*>() << actionDeformation;
+}
+bool Polyhedron_demo_edit_polyhedron_plugin::applicable(QAction*) const { 
+  Q_FOREACH(CGAL::Three::Scene_interface::Item_id i, scene->selectionIndices())
+  {
+    if(qobject_cast<Scene_polyhedron_item*>(scene->item(i)) 
+        || qobject_cast<Scene_edit_polyhedron_item*>(scene->item(i)))
+      return true;
+  }
+  return false;
+}
+
+void Polyhedron_demo_edit_polyhedron_plugin::init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*)
+{
+  mw = mainWindow;
+  scene = scene_interface;
+  actionDeformation = new QAction("Surface Mesh Deformation", mw);
+  actionDeformation->setProperty("subMenuName", "Triangulated Surface Mesh Deformation");
+  actionDeformation->setObjectName("actionDeformation");
+  autoConnectActions();
+  actionDeformation->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_E));
+
+  // Connect Scene::newItem so that, if dock_widget is visible, convert
+  // automatically polyhedron items to "edit polyhedron" items.
+
+  ////////////////// Construct widget /////////////////////////////
+  // First time, construct docking window
+  dock_widget = new QDockWidget("Mesh Deformation", mw);
+  dock_widget->setVisible(false); // do not show at the beginning
+
+  ui_widget.setupUi(dock_widget); 
+  mw->addDockWidget(Qt::LeftDockWidgetArea, dock_widget);
+
+  connect(ui_widget.AddCtrlVertPushButton, SIGNAL(clicked()), this, SLOT(on_AddCtrlVertPushButton_clicked()));
+  connect(ui_widget.PrevCtrlVertPushButton, SIGNAL(clicked()), this, SLOT(on_PrevCtrlVertPushButton_clicked()));
+  connect(ui_widget.NextCtrlVertPushButton, SIGNAL(clicked()), this, SLOT(on_NextCtrlVertPushButton_clicked()));
+  connect(ui_widget.SelectAllVerticesPushButton, SIGNAL(clicked()), this, SLOT(on_SelectAllVerticesPushButton_clicked()));
+  connect(ui_widget.DeleteCtrlVertPushButton, SIGNAL(clicked()), this, SLOT(on_DeleteCtrlVertPushButton_clicked()));
+  connect(ui_widget.ApplyAndClosePushButton, SIGNAL(clicked()), this, SLOT(on_ApplyAndClosePushButton_clicked()));
+  connect(ui_widget.DiscardChangesPushButton, SIGNAL(clicked()), this, SLOT(on_DiscardChangesPushButton_clicked()));
+  connect(ui_widget.ClearROIPushButton, SIGNAL(clicked()), this, SLOT(on_ClearROIPushButton_clicked()));
+  connect(ui_widget.ShowROICheckBox, SIGNAL(stateChanged(int)), this, SLOT(on_ShowROICheckBox_stateChanged(int)));
+  connect(ui_widget.ShowAsSphereCheckBox, SIGNAL(stateChanged(int)), this, SLOT(on_ShowAsSphereCheckBox_stateChanged(int)));  
+  connect(ui_widget.ActivateFixedPlaneCheckBox, SIGNAL(stateChanged(int)), this, SLOT(on_ActivateFixedPlaneCheckBox_stateChanged(int)));
+  connect(ui_widget.ActivatePivotingCheckBox, SIGNAL(stateChanged(int)), this, SLOT(on_ActivatePivotingCheckBox_stateChanged(int)));
+  connect(ui_widget.OverwritePushButton, SIGNAL(clicked()), this, SLOT(on_OverwritePushButton_clicked()));
+  connect(ui_widget.Select_isolated_components_button,  SIGNAL(clicked()), this, SLOT(on_Select_isolated_components_button_clicked()));
+  connect(ui_widget.Get_minimum_button,  SIGNAL(clicked()), this, SLOT(on_Get_minimum_button_clicked()));
+
+  connect(ui_widget.SaveROIPushButton, SIGNAL(clicked()), this, SLOT(on_SaveROIPushButton_clicked()));
+  connect(ui_widget.ReadROIPushButton, SIGNAL(clicked()), this, SLOT(on_ReadROIPushButton_clicked()));
+  connect(dock_widget, SIGNAL(visibilityChanged(bool)), this, SLOT(dock_widget_visibility_changed(bool)) );
+
+  connect(ui_widget.BrushSpinBoxRoi, SIGNAL(valueChanged(int)), this, SLOT(on_BrushSpinBoxRoi_changed(int)));
+  connect(ui_widget.BrushSpinBoxCtrlVert, SIGNAL(valueChanged(int)), this, SLOT(on_BrushSpinBoxCtrlVert_changed(int)));
+  connect(ui_widget.ROIRadioButton, SIGNAL(toggled(bool)), this, SLOT(on_ROIRadioButton_toggled(bool)));
+  connect(ui_widget.importSelectionPushButton, SIGNAL(clicked()), this, SLOT(on_importSelectionPushButton_clicked()));
+  ///////////////////////////////////////////////////////////////////
+}
+
+void Polyhedron_demo_edit_polyhedron_plugin::on_actionDeformation_triggered()
+{  
+  // dock widget should be constructed in init()
+  if(dock_widget->isVisible()) { dock_widget->hide(); }
+  else                         { dock_widget->show(); }
+}
+
+/////// Dock window signal handlers //////
+// what they do is simply transmitting required 'action' to selected scene_edit_polyhedron_item object
+void Polyhedron_demo_edit_polyhedron_plugin::on_AddCtrlVertPushButton_clicked()
+{
+  int item_id = scene->mainSelectionIndex();
+  Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(item_id));
+  if(!edit_item) return;                             // the selected item is not of the right type
+
+  edit_item->create_ctrl_vertices_group();
+}
+void Polyhedron_demo_edit_polyhedron_plugin::on_PrevCtrlVertPushButton_clicked()
+{
+  int item_id = scene->mainSelectionIndex();
+  Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(item_id));
+  if(!edit_item) return;                             // the selected item is not of the right type
+
+  edit_item->prev_ctrl_vertices_group();
+  edit_item->invalidateOpenGLBuffers();
+  scene->itemChanged(edit_item); // for repaint
+}
+void Polyhedron_demo_edit_polyhedron_plugin::on_NextCtrlVertPushButton_clicked()
+{
+  int item_id = scene->mainSelectionIndex();
+  Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(item_id));
+  if(!edit_item) return;                             // the selected item is not of the right type
+
+  edit_item->next_ctrl_vertices_group();
+  scene->itemChanged(edit_item); // for repaint
+}
+void Polyhedron_demo_edit_polyhedron_plugin::on_SelectAllVerticesPushButton_clicked()
+{
+  int item_id = scene->mainSelectionIndex();
+  Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(item_id));
+  if(!edit_item) return;                             // the selected item is not of the right type
+
+  edit_item->set_all_vertices_as_roi();
+  edit_item->invalidateOpenGLBuffers();
+  scene->itemChanged(edit_item); // for repaint
+}
+void Polyhedron_demo_edit_polyhedron_plugin::on_DeleteCtrlVertPushButton_clicked()
+{
+  int item_id = scene->mainSelectionIndex();
+  Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(item_id));
+  if(!edit_item) return;                             // the selected item is not of the right type
+
+  edit_item->delete_ctrl_vertices_group();
+  edit_item->invalidateOpenGLBuffers();
+  scene->itemChanged(edit_item); // for repaint
+}
+void Polyhedron_demo_edit_polyhedron_plugin::on_ClearROIPushButton_clicked()
+{
+  int item_id = scene->mainSelectionIndex();
+  Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(item_id));
+  if(!edit_item) return;                             // the selected item is not of the right type
+
+  edit_item->clear_roi();
+  edit_item->invalidateOpenGLBuffers();
+  scene->itemChanged(edit_item); // for repaint
+}
+void Polyhedron_demo_edit_polyhedron_plugin::on_ApplyAndClosePushButton_clicked()
+{
+  dock_widget->setVisible(false);
+}
+void Polyhedron_demo_edit_polyhedron_plugin::on_DiscardChangesPushButton_clicked()
+{
+  int item_id = scene->mainSelectionIndex();
+  Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(item_id));
+  if (!edit_item) return;                             // the selected item is not of the right type
+
+  edit_item->reset_deform_object();
+  edit_item->invalidateOpenGLBuffers();
+  scene->itemChanged(edit_item); //for redraw
+}
+void Polyhedron_demo_edit_polyhedron_plugin::on_ShowROICheckBox_stateChanged(int /*state*/)
+{
+  for(CGAL::Three::Scene_interface::Item_id i = 0, end = scene->numberOfEntries(); i < end; ++i)
+  {
+    Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(i));
+    if(!edit_item) { continue; }
+    scene->itemChanged(edit_item);  // just for redraw   
+  }  
+}
+void Polyhedron_demo_edit_polyhedron_plugin::on_ShowAsSphereCheckBox_stateChanged(int state)
+{
+  for(CGAL::Three::Scene_interface::Item_id i = 0, end = scene->numberOfEntries(); i < end; ++i)
+  {
+    Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(i));
+    if(!edit_item) { continue; }
+    if(state == 0)
+      edit_item->ShowAsSphere(false);
+    else
+      edit_item->ShowAsSphere(true);
+    scene->itemChanged(edit_item);  // just for redraw   
+  }  
+}
+void Polyhedron_demo_edit_polyhedron_plugin::on_ActivatePivotingCheckBox_stateChanged(int state)
+{
+  for(CGAL::Three::Scene_interface::Item_id i = 0, end = scene->numberOfEntries(); i < end; ++i)
+  {
+    Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(i));
+    if(!edit_item) { continue; }
+    
+    if(state == Qt::Checked) {
+      edit_item->pivoting_begin();
+    }
+    else {
+      edit_item->pivoting_end();
+    }
+    scene->itemChanged(edit_item);     
+  }
+}
+void Polyhedron_demo_edit_polyhedron_plugin::on_ActivateFixedPlaneCheckBox_stateChanged(int)
+{
+    for(CGAL::Three::Scene_interface::Item_id i = 0, end = scene->numberOfEntries(); i < end; ++i)
+    {
+        Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(i));
+        if(!edit_item) { continue; }
+        edit_item->update_frame_plane();
+        edit_item->invalidateOpenGLBuffers();
+        scene->itemChanged(edit_item);
+    }
+}
+void Polyhedron_demo_edit_polyhedron_plugin::on_OverwritePushButton_clicked()
+{
+  int item_id = scene->mainSelectionIndex();
+  Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(item_id));
+  if(!edit_item) return;                             // the selected item is not of the right type
+
+  edit_item->overwrite_deform_object();
+}
+void Polyhedron_demo_edit_polyhedron_plugin::on_Select_isolated_components_button_clicked() {
+  int item_id = scene->mainSelectionIndex();
+  Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(item_id));
+  if(!edit_item) return;                             // the selected item is not of the right type
+
+  boost::optional<std::size_t> minimum = 
+    edit_item->select_isolated_components(ui_widget.Threshold_size_spin_box->value());
+  if(minimum) {
+    ui_widget.Threshold_size_spin_box->setValue((int) *minimum);
+  }
+}
+
+void Polyhedron_demo_edit_polyhedron_plugin::on_Get_minimum_button_clicked() {
+  int item_id = scene->mainSelectionIndex();
+  Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(item_id));
+  if(!edit_item) return;                             // the selected item is not of the right type
+
+  boost::optional<std::size_t> minimum = edit_item->get_minimum_isolated_component();
+  if(minimum) {
+    ui_widget.Threshold_size_spin_box->setValue((int) *minimum);
+  }
+}
+
+void Polyhedron_demo_edit_polyhedron_plugin::on_SaveROIPushButton_clicked()
+{
+  int item_id = scene->mainSelectionIndex();
+  Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(item_id));
+  if(!edit_item) return;  
+
+  QString fileName = QFileDialog::getSaveFileName(mw, "Save", 
+      "roi.txt", "Text (*.txt)");
+  if(fileName.isNull()) { return; }
+
+  edit_item->save_roi(fileName.toLocal8Bit().data());  
+}
+void Polyhedron_demo_edit_polyhedron_plugin::on_ReadROIPushButton_clicked()
+{
+  int item_id = scene->mainSelectionIndex();
+  Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(item_id));
+  if(!edit_item) return;  
+
+  QString fileName = QFileDialog::getOpenFileName(mw, "Read", 
+    "roi.txt", "Text (*.txt)");
+  if(fileName.isNull()) { return; }
+
+  edit_item->read_roi(fileName.toLocal8Bit().data());
+  edit_item->invalidateOpenGLBuffers();
+  scene->itemChanged(edit_item); 
+}
+
+void Polyhedron_demo_edit_polyhedron_plugin::dock_widget_visibility_changed(bool visible)
+{
+  if(!visible)
+  {
+    for(CGAL::Three::Scene_interface::Item_id i = 0, end = scene->numberOfEntries();
+        i < end; ++i)
+    {
+      Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(i));
+
+      if(edit_item) {
+        edit_item->ShowAsSphere(false);
+        Scene_polyhedron_item* item = convert_to_plain_polyhedron(i, edit_item);
+        item->setRenderingMode(last_RM);
+        updateSelectionItems(item);
+      }
+    }
+  }
+  else
+  {
+    ui_widget.ShowAsSphereCheckBox->setChecked(false);
+    Scene_polyhedron_selection_item* selection_item = NULL;
+    for(int i = 0; i<scene->numberOfEntries(); i++)
+    {
+      selection_item = qobject_cast<Scene_polyhedron_selection_item*>(scene->item(i));
+      if (selection_item)
+        break;
+      else
+        selection_item = NULL;
+    }
+    Q_FOREACH(CGAL::Three::Scene_interface::Item_id i , scene->selectionIndices())
+    {
+      Scene_polyhedron_item* poly_item = qobject_cast<Scene_polyhedron_item*>(scene->item(i));
+      if (poly_item &&
+          poly_item->polyhedron()->is_pure_triangle())
+      {
+        last_RM = poly_item->renderingMode();
+        poly_item->update_halfedge_indices();
+        if(!selection_item)
+          convert_to_edit_polyhedron(i, poly_item);
+        else
+          importSelection(selection_item, convert_to_edit_polyhedron(i, poly_item));
+      }
+      else if(poly_item &&
+              !(poly_item->polyhedron()->is_pure_triangle()) )
+      {
+        QMessageBox::warning(mw,
+                             tr("Cannot edit non-triangle polyhedron_items"),
+                             tr(" %1 is not pure-triangle, therefore it is not editable.").arg(poly_item->name()));
+      }
+    }
+  }
+}
+
+
+void Polyhedron_demo_edit_polyhedron_plugin::on_ROIRadioButton_toggled(bool value) {
+  int k_ring = value ? ui_widget.BrushSpinBoxRoi->value() : 
+                       ui_widget.BrushSpinBoxCtrlVert->value();
+  for(CGAL::Three::Scene_interface::Item_id i = 0, end = scene->numberOfEntries(); i < end; ++i)
+  {
+    Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(i));
+    if(!edit_item) { continue; }
+
+    edit_item->set_k_ring(k_ring);
+  }
+}
+
+void Polyhedron_demo_edit_polyhedron_plugin::on_BrushSpinBoxCtrlVert_changed(int value) {
+  if(ui_widget.ROIRadioButton->isChecked()) { return; }
+  for(CGAL::Three::Scene_interface::Item_id i = 0, end = scene->numberOfEntries(); i < end; ++i)
+  {
+    Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(i));
+    if(!edit_item) { continue; }
+
+    edit_item->set_k_ring(value);
+  }
+}
+
+void Polyhedron_demo_edit_polyhedron_plugin::on_BrushSpinBoxRoi_changed(int value) {
+  if(!ui_widget.ROIRadioButton->isChecked()) { return; }
+  for(CGAL::Three::Scene_interface::Item_id i = 0, end = scene->numberOfEntries(); i < end; ++i)
+  {
+    Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(i));
+    if(!edit_item) { continue; }
+
+    edit_item->set_k_ring(value);
+  }
+}
+
+
+Scene_edit_polyhedron_item* 
+Polyhedron_demo_edit_polyhedron_plugin::convert_to_edit_polyhedron(Item_id i,
+                           Scene_polyhedron_item* poly_item)
+{
+  QString poly_item_name = poly_item->name();
+  Scene_edit_polyhedron_item* edit_poly = new Scene_edit_polyhedron_item(poly_item, &ui_widget, mw);
+  if(poly_item->isItemMulticolor())
+    saved_color = poly_item->color_vector();
+  is_color_vector_read_only = poly_item->is_color_vector_read_only();
+  edit_poly->setColor(poly_item->color());
+  edit_poly->setName(QString("%1 (edit)").arg(poly_item->name()));
+  edit_poly->setRenderingMode(Gouraud);
+  poly_item->setName(poly_item_name); // Because it is changed when the
+                                      // name of edit_poly is changed.
+  int k_ring = ui_widget.ROIRadioButton->isChecked() ? ui_widget.BrushSpinBoxRoi->value() : 
+                                                       ui_widget.BrushSpinBoxCtrlVert->value();
+  edit_poly->set_k_ring(k_ring);
+  scene->setSelectedItem(-1);
+  scene->replaceItem(i, edit_poly);
+  scene->setSelectedItem(i);
+  return edit_poly;
+}
+
+Scene_polyhedron_item* 
+Polyhedron_demo_edit_polyhedron_plugin::convert_to_plain_polyhedron(Item_id i,
+                            Scene_edit_polyhedron_item* edit_item) 
+{
+  Scene_polyhedron_item* poly_item = edit_item->to_polyhedron_item();
+  scene->replaceItem(i, poly_item);
+  delete edit_item;
+  poly_item->set_color_vector_read_only(is_color_vector_read_only);
+  if(saved_color.size() >0)
+  {
+    poly_item->setItemIsMulticolor(true);
+    poly_item->invalidateOpenGLBuffers();
+    poly_item->color_vector() = saved_color;
+    saved_color.clear();
+  }
+  return poly_item;
+}
+
+
+
+void Polyhedron_demo_edit_polyhedron_plugin::on_importSelectionPushButton_clicked()
+{
+Scene_polyhedron_selection_item* selection_item = NULL;
+Scene_edit_polyhedron_item* edit_item = NULL;
+bool need_sel(true), need_edit(true);
+
+// find selection_item and edit_item in selection
+  Q_FOREACH(Item_id id, scene->selectionIndices())
+  {
+    if(need_sel)
+    {
+      Scene_polyhedron_selection_item* selection_test =
+          qobject_cast<Scene_polyhedron_selection_item*>(scene->item(id));
+      if(selection_test)
+      {
+        selection_item = selection_test;
+        need_sel = false;
+      }
+    }
+    if(need_edit)
+    {
+      Scene_edit_polyhedron_item* edit_test =
+          qobject_cast<Scene_edit_polyhedron_item*>(scene->item(id));
+      if(edit_test)
+      {
+        edit_item = edit_test;
+        need_edit = false;
+      }
+    }
+
+    if(!need_sel && !need_edit)
+      break;
+  }
+  if(!selection_item || !edit_item)
+    return;
+  importSelection(selection_item, edit_item);
+}
+
+void Polyhedron_demo_edit_polyhedron_plugin::importSelection(Scene_polyhedron_selection_item *selection_item, Scene_edit_polyhedron_item *edit_item)
+{
+//converts the selection in selected points
+QVector<Scene_polyhedron_selection_item::Vertex_handle> sel_to_import;
+Q_FOREACH(Scene_polyhedron_selection_item::Vertex_handle vh, selection_item->selected_vertices)
+  sel_to_import.push_back(vh);
+Q_FOREACH(Scene_polyhedron_selection_item::edge_descriptor ed, selection_item->selected_edges)
+{
+  Scene_polyhedron_selection_item::Vertex_handle vh = source(halfedge(ed, *selection_item->polyhedron()),*selection_item->polyhedron());
+  if(!sel_to_import.contains(vh))
+    sel_to_import.push_back(vh);
+
+  vh = target(halfedge(ed, *selection_item->polyhedron()),*selection_item->polyhedron());
+  if(!sel_to_import.contains(vh))
+    sel_to_import.push_back(vh);
+}
+Q_FOREACH(Scene_polyhedron_selection_item::Facet_handle fh, selection_item->selected_facets)
+{
+  Polyhedron::Halfedge_around_facet_circulator hafc = fh->facet_begin();
+  Polyhedron::Halfedge_around_facet_circulator end = hafc;
+  CGAL_For_all(hafc, end)
+  {
+     if(!sel_to_import.contains(hafc->vertex()))
+       sel_to_import.push_back(hafc->vertex());
+  }
+}
+
+//makes the selected points ROI
+Q_FOREACH(Scene_polyhedron_selection_item::Vertex_handle vh, sel_to_import)
+  edit_item->insert_roi_vertex(vh);
+edit_item->invalidateOpenGLBuffers();
+selection_item->setVisible(false);
+(*QGLViewer::QGLViewerPool().begin())->update();
+}
+
+void Polyhedron_demo_edit_polyhedron_plugin::updateSelectionItems(Scene_polyhedron_item* target)
+{
+  for(int i = 0; i<scene->numberOfEntries(); i++)
+  {
+    Scene_polyhedron_selection_item* sel_item = qobject_cast<Scene_polyhedron_selection_item*>(scene->item(i));
+    if(sel_item
+       && sel_item->polyhedron() == target->polyhedron())
+    {
+      sel_item->invalidateOpenGLBuffers();
+      if(!ui_widget.RemeshingCheckBox->isChecked())
+        sel_item->setVisible(true);
+      else
+        scene->erase(scene->item_id(sel_item));
+    }
+
+  }
+}
+#include "Edit_polyhedron_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp b/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp
new file mode 100644
index 0000000..b2bf719
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp
@@ -0,0 +1,1703 @@
+//#define CGAL_PMP_REMESHING_VERBOSE
+
+#include "opengl_tools.h"
+#include "Scene_edit_polyhedron_item.h"
+#include "Scene_spheres_item.h"
+#include <CGAL/Three/Viewer_interface.h>
+#include <boost/foreach.hpp>
+#include <algorithm>
+#include <QTime>
+
+#include <QApplication>
+
+#include <CGAL/Polygon_mesh_processing/border.h>
+#include <CGAL/Polygon_mesh_processing/remesh.h>
+
+struct Scene_edit_polyhedron_item_priv
+{
+  Scene_edit_polyhedron_item_priv(Scene_polyhedron_item* poly_item,  Ui::DeformMesh* ui_widget, QMainWindow* mw, Scene_edit_polyhedron_item* parent)
+    : ui_widget(ui_widget),
+      poly_item(poly_item),
+      is_rot_free(true),
+      own_poly_item(true),
+      k_ring_selector(poly_item, mw, Scene_polyhedron_item_k_ring_selection::Active_handle::VERTEX, true)
+  {
+    item = parent;
+    nb_ROI = 0;
+    nb_control = 0;
+    nb_axis = 0;
+    nb_bbox = 0;
+    spheres = NULL;
+    spheres_ctrl = NULL;
+    need_change = false;
+  }
+  ~Scene_edit_polyhedron_item_priv()
+  {
+    delete deform_mesh;
+    if (own_poly_item)
+      delete poly_item;
+  }
+  void remesh();
+  void expand_or_reduce(int);
+  void initializeBuffers(CGAL::Three::Viewer_interface *viewer) const;
+  void compute_normals_and_vertices(void);
+  void compute_bbox(const CGAL::Three::Scene_interface::Bbox&);
+  void reset_drawing_data();
+  enum Buffer
+  {
+      Facet_vertices =0,
+      Facet_normals,
+      Roi_vertices,
+      Control_vertices,
+      Control_color,
+      Bbox_vertices,
+      Axis_vertices,
+      Axis_colors,
+      Frame_vertices,
+      NumberOfBuffers
+  };
+  enum Vao
+  {
+      Facets=0,
+      Roi_points,
+      Edges,
+      BBox,
+      Control_points,
+      Axis,
+      Frame_plane,
+      NumberOfVaos
+  };
+
+  Ui::DeformMesh* ui_widget;
+  Scene_polyhedron_item* poly_item;
+  bool need_change;
+  // For drawing
+  mutable std::vector<GLdouble> positions;
+  mutable std::vector<unsigned int> tris;
+  mutable std::vector<unsigned int> edges;
+  mutable std::vector<GLdouble> color_lines;
+  mutable std::vector<GLdouble> color_bbox;
+  mutable std::vector<GLdouble> ROI_points;
+  mutable std::vector<GLdouble> control_points;
+  mutable std::vector<GLdouble> ROI_color;
+  mutable std::vector<GLdouble> control_color;
+  mutable std::vector<GLdouble> normals;
+  mutable std::vector<GLdouble> pos_bbox;
+  mutable std::vector<GLdouble> pos_axis;
+  mutable std::vector<GLdouble> pos_frame_plane;
+  mutable QOpenGLShaderProgram *program;
+  mutable QOpenGLShaderProgram bbox_program;
+  mutable std::size_t nb_ROI;
+  mutable std::size_t nb_control;
+  mutable std::size_t nb_axis;
+  mutable std::size_t nb_bbox;
+  mutable Scene_spheres_item* spheres;
+  mutable Scene_spheres_item* spheres_ctrl;
+  mutable QOpenGLBuffer *in_bu;
+
+  Deform_mesh* deform_mesh;
+  typedef std::list<Control_vertices_data> Ctrl_vertices_group_data_list;
+  Ctrl_vertices_group_data_list::iterator active_group;
+  Ctrl_vertices_group_data_list ctrl_vertex_frame_map; // keep list of group of control vertices with assoc data
+
+  double length_of_axis; // for drawing axis at a group of control vertices
+
+  // by interleaving 'viewer's events (check constructor), keep followings:
+  Mouse_keyboard_state_deformation state;
+
+  //For constraint rotation
+  qglviewer::LocalConstraint rot_constraint;
+  bool is_rot_free;
+
+  bool own_poly_item; //indicates if the poly_item should be deleted by the destructor
+  Scene_polyhedron_item_k_ring_selection k_ring_selector;
+  Scene_edit_polyhedron_item *item;
+
+}; //end Scene_edit_polyhedron_item_priv
+
+Scene_edit_polyhedron_item::Scene_edit_polyhedron_item
+(Scene_polyhedron_item* poly_item,
+ Ui::DeformMesh* ui_widget,
+ QMainWindow* mw)
+  : Scene_group_item("unnamed",Scene_edit_polyhedron_item_priv::NumberOfBuffers,Scene_edit_polyhedron_item_priv::NumberOfVaos)
+
+{
+  mw->installEventFilter(this);
+  d = new Scene_edit_polyhedron_item_priv(poly_item, ui_widget, mw, this);
+  // bind vertex picking
+  connect(&d->k_ring_selector, SIGNAL(selected(const std::set<Polyhedron::Vertex_handle>&)), this,
+          SLOT(selected(const std::set<Polyhedron::Vertex_handle>&)));
+
+  d->poly_item->set_color_vector_read_only(true); // to prevent recomputation of color vector in invalidateOpenGLBuffers()
+  d->poly_item->update_vertex_indices();
+
+  d->deform_mesh = new Deform_mesh(*(poly_item->polyhedron()),
+                                Deform_mesh::Vertex_index_map(),
+                                Deform_mesh::Hedge_index_map(),
+                                Array_based_vertex_point_map(&d->positions));
+
+  d->length_of_axis = (CGAL::sqrt((bbox().xmax()-bbox().xmin())*(bbox().xmax()-bbox().xmin()) + (bbox().ymax()-bbox().ymin())*(bbox().ymax()-bbox().ymin()) + (bbox().zmax()-bbox().zmin())*(bbox().zmax()-bbox().zmin()))) / 15.0;
+
+  // interleave events of viewer (there is only one viewer) 
+  QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
+  viewer->installEventFilter(this);
+    
+  // create an empty group of control vertices for starting
+  create_ctrl_vertices_group();
+
+  // Required for drawing functionality
+  d->reset_drawing_data();
+
+    //Generates an integer which will be used as ID for each buffer
+
+    const char vertex_shader_source_bbox[] =
+    {
+        "#version 120 \n"
+        "attribute highp vec3 vertex; \n"
+        "attribute highp vec3 colors; \n"
+
+        "uniform highp mat4 mvp_matrix; \n"
+        "uniform highp mat4 rotations; \n"
+        "uniform highp vec3 translation; \n"
+        "uniform highp vec3 translation_2; \n"
+        "varying highp vec3 fColors; \n"
+        " \n"
+
+        "void main(void) \n"
+        "{ \n"
+        "   fColors = colors; \n"
+        "   gl_Position = mvp_matrix * (rotations *(vec4(translation_2,0.0)+vec4(vertex,1.0) )+ vec4(translation,0.0)) ; \n"
+        "} \n"
+    };
+    const char fragment_shader_source[]=
+    {
+        "#version 120 \n"
+        "varying vec3 fColors; \n"
+        " \n"
+        "void main(void) \n"
+        "{ \n"
+        " gl_FragColor = vec4(fColors, 1.0); \n"
+        "} \n"
+    };
+    d->bbox_program.addShaderFromSourceCode(QOpenGLShader::Vertex,vertex_shader_source_bbox);
+    d->bbox_program.addShaderFromSourceCode(QOpenGLShader::Fragment,fragment_shader_source);
+    d->bbox_program.link();
+
+    d->ui_widget->remeshing_iterations_spinbox->setValue(1);
+
+    d->ui_widget->remeshing_edge_length_spinbox->setValue(d->length_of_axis);
+    d->ui_widget->remeshing_edge_length_spinbox->setDisabled(true);
+    d->ui_widget->remeshingEdgeLengthInput_checkBox->setChecked(false);
+    connect(ui_widget->remeshingEdgeLengthInput_checkBox, SIGNAL(toggled(bool)),
+            ui_widget->remeshing_edge_length_spinbox, SLOT(setEnabled(bool)));
+
+    invalidateOpenGLBuffers();
+}
+
+Scene_edit_polyhedron_item::~Scene_edit_polyhedron_item()
+{
+  while(is_there_any_ctrl_vertices_group())
+  {
+    delete_ctrl_vertices_group(false);
+  }
+
+  delete d;
+}
+/////////////////////////////
+/// For the Shader gestion///
+void Scene_edit_polyhedron_item_priv::initializeBuffers(CGAL::Three::Viewer_interface *viewer =0) const
+{
+    //vao for the facets
+    {
+        program = item->getShaderProgram(Scene_edit_polyhedron_item::PROGRAM_WITH_LIGHT, viewer);
+        program->bind();
+
+        item->vaos[Facets]->bind();
+        item->buffers[Facet_vertices].bind();
+        item->buffers[Facet_vertices].allocate(positions.data(),
+                            static_cast<int>(positions.size()*sizeof(double)));
+        program->enableAttributeArray("vertex");
+        program->setAttributeBuffer("vertex",GL_DOUBLE,0,3);
+        item->buffers[Facet_vertices].release();
+
+        item->buffers[Facet_normals].bind();
+        item->buffers[Facet_normals].allocate(normals.data(),
+                            static_cast<int>(normals.size()*sizeof(double)));
+        program->enableAttributeArray("normals");
+        program->setAttributeBuffer("normals",GL_DOUBLE,0,3);
+        item->buffers[Facet_normals].release();
+        item->vaos[Facets]->release();
+        program->release();
+    }
+    //vao for the ROI points
+    {   program = item->getShaderProgram(Scene_edit_polyhedron_item::PROGRAM_NO_SELECTION, viewer);
+        program->bind();
+        item->vaos[Roi_points]->bind();
+        item->buffers[Roi_vertices].bind();
+        item->buffers[Roi_vertices].allocate(ROI_points.data(),
+                            static_cast<int>(ROI_points.size()*sizeof(double)));
+        program->enableAttributeArray("vertex");
+        program->setAttributeBuffer("vertex",GL_DOUBLE,0,3);
+        item->buffers[Roi_vertices].release();
+        item->vaos[Roi_points]->release();
+        program->release();
+
+        nb_ROI = ROI_points.size();
+        ROI_points.clear();
+        ROI_points.swap(ROI_points);
+    }
+   //vao for the edges
+    {
+        program = item->getShaderProgram(Scene_edit_polyhedron_item::PROGRAM_NO_SELECTION, viewer);
+        program->bind();
+        item->vaos[Edges]->bind();
+        item->buffers[Facet_vertices].bind();
+        program->enableAttributeArray("vertex");
+        program->setAttributeBuffer("vertex",GL_DOUBLE,0,3);
+        item->buffers[Facet_vertices].release();
+        item->vaos[Edges]->release();
+        program->release();
+    }
+    //vao for the BBOX
+    {
+        bbox_program.bind();
+        item->vaos[BBox]->bind();
+        item->buffers[Bbox_vertices].bind();
+        item->buffers[Bbox_vertices].allocate(pos_bbox.data(),
+                             static_cast<int>(pos_bbox.size()*sizeof(double)));
+        bbox_program.enableAttributeArray("vertex");
+        bbox_program.setAttributeBuffer("vertex",GL_DOUBLE,0,3);
+        item->buffers[Bbox_vertices].release();
+
+        item->vaos[BBox]->release();
+        nb_bbox = pos_bbox.size();
+        pos_bbox.resize(0);
+        std::vector<double>(pos_bbox).swap(pos_bbox);
+        color_bbox.resize(0);
+        std::vector<double>(color_bbox).swap(color_bbox);
+        bbox_program.release();
+    }
+    //vao for the control points
+    {
+        program = item->getShaderProgram(Scene_edit_polyhedron_item::PROGRAM_NO_SELECTION, viewer);
+        program->bind();
+        item->vaos[Control_points]->bind();
+        item->buffers[Control_vertices].bind();
+        item->buffers[Control_vertices].allocate(control_points.data(),
+                             static_cast<int>(control_points.size()*sizeof(double)));
+        program->enableAttributeArray("vertex");
+        program->setAttributeBuffer("vertex",GL_DOUBLE,0,3);
+        item->buffers[Control_vertices].release();
+        item->buffers[Control_color].bind();
+        item->buffers[Control_color].allocate(control_color.data(),
+                                                 static_cast<int>(control_color.size()*sizeof(double)));
+        program->enableAttributeArray("colors");
+        program->setAttributeBuffer("colors",GL_DOUBLE,0,3);
+        item->buffers[Control_color].release();
+
+
+        item->vaos[Control_points]->release();
+        program->release();
+        nb_control = control_points.size();
+        control_points.clear();
+        control_points.swap(control_points);
+    }
+    //vao for the axis
+    {
+        program = item->getShaderProgram(Scene_edit_polyhedron_item::PROGRAM_NO_SELECTION, viewer);
+        program->bind();
+        item->vaos[Axis]->bind();
+        item->buffers[Axis_vertices].bind();
+        item->buffers[Axis_vertices].allocate(pos_axis.data(),
+                             static_cast<int>(pos_axis.size()*sizeof(double)));
+        program->enableAttributeArray("vertex");
+        program->setAttributeBuffer("vertex",GL_DOUBLE,0,3);
+        item->buffers[Axis_vertices].release();
+        item->buffers[Axis_colors].bind();
+        item->buffers[Axis_colors].allocate(color_lines.data(),
+                             static_cast<int>(color_lines.size()*sizeof(double)));
+        program->enableAttributeArray("colors");
+        program->setAttributeBuffer("colors",GL_DOUBLE,0,3);
+        item->buffers[Axis_colors].release();
+        item->vaos[Axis]->release();
+        program->release();
+        nb_axis = pos_axis.size();
+        pos_axis.resize(0);
+        std::vector<double>(pos_axis).swap(pos_axis);
+        color_lines.resize(0);
+        std::vector<double>(color_lines).swap(color_lines);
+    }
+    //vao for the frame plane
+    {
+        program = item->getShaderProgram(Scene_edit_polyhedron_item::PROGRAM_NO_SELECTION, viewer);
+        program->bind();
+        item->vaos[Frame_plane]->bind();
+        item->buffers[Frame_vertices].bind();
+        item->buffers[Frame_vertices].allocate(pos_frame_plane.data(),
+                             static_cast<int>(pos_frame_plane.size()*sizeof(double)));
+        program->enableAttributeArray("vertex");
+        program->setAttributeBuffer("vertex",GL_DOUBLE,0,3);
+        item->buffers[Frame_vertices].release();
+        program->disableAttributeArray("colors");
+        item->vaos[Frame_plane]->release();
+        program->release();
+    }
+    item->are_buffers_filled = true;
+}
+
+void Scene_edit_polyhedron_item_priv::reset_drawing_data()
+{
+  positions.clear();
+  positions.resize(num_vertices(*item->polyhedron()) * 3);
+
+  normals.clear();
+  normals.resize(positions.size());
+
+  std::size_t counter = 0;
+  BOOST_FOREACH(vertex_descriptor vb, vertices(*item->polyhedron()))
+  {
+    positions[counter * 3] = vb->point().x();
+    positions[counter * 3 + 1] = vb->point().y();
+    positions[counter * 3 + 2] = vb->point().z();
+
+    const Polyhedron::Traits::Vector_3& n =
+      CGAL::Polygon_mesh_processing::compute_vertex_normal(vb, deform_mesh->halfedge_graph());
+    normals[counter * 3] = n.x();
+    normals[counter * 3 + 1] = n.y();
+    normals[counter * 3 + 2] = n.z();
+
+    ++counter;
+  }
+
+  tris.clear();
+  tris.resize(item->polyhedron()->size_of_facets() * 3);
+  counter = 0;
+  BOOST_FOREACH(face_descriptor fb, faces(*item->polyhedron()))
+  {
+    tris[counter * 3] = static_cast<unsigned int>(fb->halfedge()->vertex()->id());
+    tris[counter * 3 + 1] = static_cast<unsigned int>(fb->halfedge()->next()->vertex()->id());
+    tris[counter * 3 + 2] = static_cast<unsigned int>(fb->halfedge()->prev()->vertex()->id());
+    ++counter;
+  }
+
+  edges.clear();
+  edges.resize(item->polyhedron()->size_of_halfedges());
+  counter = 0;
+  for (Polyhedron::Edge_iterator eb = item->polyhedron()->edges_begin();
+       eb != item->polyhedron()->edges_end(); ++eb, ++counter)
+  {
+    edges[counter * 2] = static_cast<unsigned int>(eb->vertex()->id());
+    edges[counter * 2 + 1] = static_cast<unsigned int>(eb->opposite()->vertex()->id());
+  }
+}
+
+void Scene_edit_polyhedron_item_priv::compute_normals_and_vertices(void)
+{
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    ROI_points.resize(0);
+    control_points.resize(0);
+    control_color.resize(0);
+    pos_frame_plane.resize(0);
+    BOOST_FOREACH(vertex_descriptor vd, deform_mesh->roi_vertices())
+    {
+        if(!deform_mesh->is_control_vertex(vd))
+        {
+            ROI_points.push_back(vd->point().x());
+            ROI_points.push_back(vd->point().y());
+            ROI_points.push_back(vd->point().z());
+
+            if(spheres)
+            {
+              CGAL::Color c(0,255,0);
+              Kernel::Sphere_3 *sphere = new Kernel::Sphere_3(vd->point(), length_of_axis/15.0);
+              spheres->add_sphere(sphere, c);
+            }
+        }
+
+    }
+    ROI_color.assign(ROI_points.size(),0);
+    for(std::size_t i=0; i<ROI_color.size()/3; i++)
+      ROI_color[3*i+1]=1.0;
+
+    QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
+    for(Ctrl_vertices_group_data_list::const_iterator hgb_data = ctrl_vertex_frame_map.begin(); hgb_data != ctrl_vertex_frame_map.end(); ++hgb_data)
+    {
+        if(hgb_data->frame == viewer->manipulatedFrame())
+        {
+            if(!ui_widget->ActivatePivotingCheckBox->isChecked())
+            {
+                // draw bbox
+                compute_bbox(hgb_data->bbox);
+            }
+        }
+
+        const double r=hgb_data == active_group?1:0;
+        const double b=hgb_data == active_group?0:1;
+
+        for(std::vector<vertex_descriptor>::const_iterator hb = hgb_data->ctrl_vertices_group.begin(); hb != hgb_data->ctrl_vertices_group.end(); ++hb)
+        {
+            control_points.push_back((*hb)->point().x());
+            control_points.push_back((*hb)->point().y());
+            control_points.push_back((*hb)->point().z());
+            control_color.push_back(r);
+            control_color.push_back(0);
+            control_color.push_back(b);
+
+            if(spheres_ctrl)
+            {
+              CGAL::Color c(255*r,0,255*b);
+              Kernel::Sphere_3 *sphere = new Kernel::Sphere_3((*hb)->point(), length_of_axis/15.0);
+              spheres_ctrl->add_sphere(sphere, c);
+            }
+        }
+    }
+
+    //The box color
+    color_bbox.resize(pos_bbox.size());
+    for(int i =0; i< (int)pos_bbox.size(); i++)
+        color_bbox[i]=0.0;
+
+    for(int i =0; i< (int)pos_bbox.size(); i+=3)
+        color_bbox[i]=1.0;
+
+    //The axis
+
+    pos_axis.resize(18);
+    for(int i =0; i< 18; i++)
+        pos_axis[i]=0.0;
+    pos_axis[3] = length_of_axis; pos_axis[10] = length_of_axis; pos_axis[17] = length_of_axis;
+    color_lines.resize(18);
+    for(int i =0; i< 18; i++)
+        color_lines[i]=0.0;
+
+    color_lines[2] = 1.0; color_lines[5] = 1.0;
+    color_lines[6] = 1.0; color_lines[9] = 1.0;
+    color_lines[13] = 1.0; color_lines[16] = 1.0;
+
+    if(ui_widget->ActivateFixedPlaneCheckBox->isChecked())
+      item->draw_frame_plane(viewer);
+    QApplication::restoreOverrideCursor();
+}
+
+/////////////////////////////////////////////////////////
+/////////// Most relevant functions lie here ///////////
+void Scene_edit_polyhedron_item::deform()
+{
+  if(!is_there_any_ctrl_vertices()) { return; }
+
+  for(Ctrl_vertices_group_data_list::iterator it = d->ctrl_vertex_frame_map.begin(); it != d->ctrl_vertex_frame_map.end(); ++it)
+  { it->set_target_positions(); }
+  d->deform_mesh->deform();
+
+  d->poly_item->invalidate_aabb_tree(); // invalidate the AABB-tree of the poly_item
+  Q_EMIT itemChanged();
+}
+
+struct ROI_faces_pmap
+{
+  typedef face_descriptor                    key_type;
+  typedef bool                               value_type;
+  typedef bool                               reference;
+  typedef boost::read_write_property_map_tag category;
+
+  friend bool get(const ROI_faces_pmap&, const key_type& f)
+  {
+    return f->patch_id() == 12345;/*magic number*/
+  }
+  friend void put(ROI_faces_pmap&, const key_type& f, const value_type b)
+  {
+    if (b)  f->set_patch_id(12345);
+    else    f->set_patch_id(patch_id_default_value(1));
+  }
+};
+
+struct ROI_border_pmap
+{
+  std::set<edge_descriptor>* m_set_ptr;
+
+  typedef edge_descriptor                    key_type;
+  typedef bool                               value_type;
+  typedef bool                               reference;
+  typedef boost::read_write_property_map_tag category;
+
+  ROI_border_pmap() : m_set_ptr(NULL) {}
+  ROI_border_pmap(std::set<edge_descriptor>* set_)
+    : m_set_ptr(set_)
+  {}
+  friend bool get(const ROI_border_pmap& map, const key_type& k)
+  {
+    CGAL_assertion(map.m_set_ptr != NULL);
+    return map.m_set_ptr->count(k);
+  }
+  friend void put(ROI_border_pmap& map, const key_type& k, const value_type b)
+  {
+    CGAL_assertion(map.m_set_ptr != NULL);
+    if (b)              map.m_set_ptr->insert(k);
+    else if(get(map,k)) map.m_set_ptr->erase(k);
+  }
+};
+
+struct halfedge2edge
+{
+  halfedge2edge(const Polyhedron& m, std::set<edge_descriptor>& edges)
+    : m_mesh(m), m_edges(edges)
+  {}
+  void operator()(const halfedge_descriptor& h) const
+  {
+    m_edges.insert(edge(h, m_mesh));
+  }
+  const Polyhedron& m_mesh;
+  std::set<edge_descriptor>& m_edges;
+};
+
+void Scene_edit_polyhedron_item::remesh()
+{
+  d->remesh();
+}
+
+struct Is_constrained_map
+{
+  boost::unordered_set<vertex_descriptor, CGAL::Handle_hash_function>* m_set_ptr;
+
+  typedef vertex_descriptor                  key_type;
+  typedef bool                               value_type;
+  typedef bool                               reference;
+  typedef boost::read_write_property_map_tag category;
+
+  Is_constrained_map()
+    : m_set_ptr(NULL)
+  {}
+  Is_constrained_map( boost::unordered_set<vertex_descriptor, CGAL::Handle_hash_function>* set_)
+    : m_set_ptr(set_)
+  {}
+  friend bool get(const Is_constrained_map& map, const key_type& k)
+  {
+    CGAL_assertion(map.m_set_ptr != NULL);
+    return map.m_set_ptr->count(k);
+  }
+  friend void put(Is_constrained_map& map, const key_type& k, const value_type b)
+  {
+    CGAL_assertion(map.m_set_ptr != NULL);
+    if (b)  map.m_set_ptr->insert(k);
+    else    map.m_set_ptr->erase(k);
+  }
+};
+
+void Scene_edit_polyhedron_item_priv::remesh()
+{
+  if(deform_mesh->roi_vertices().empty())
+    return;
+  boost::unordered_set<vertex_descriptor, CGAL::Handle_hash_function> constrained_set;
+  std::vector<std::vector<vertex_descriptor> > control_groups;
+  const Polyhedron& g = deform_mesh->halfedge_graph();
+  Array_based_vertex_point_map vpmap(&positions);
+
+  std::set<face_descriptor> roi_facets;
+  std::set<vertex_descriptor> roi_vertices(
+    deform_mesh->roi_vertices().begin(),deform_mesh->roi_vertices().end());
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  for(Ctrl_vertices_group_data_list::const_iterator hgb_data = ctrl_vertex_frame_map.begin(); hgb_data != ctrl_vertex_frame_map.end(); ++hgb_data)
+  {
+    std::vector<vertex_descriptor> group;
+    BOOST_FOREACH(vertex_descriptor vd, hgb_data->ctrl_vertices_group)
+        group.push_back(vd);
+    control_groups.push_back(group);
+  }
+
+  ROI_faces_pmap roi_faces_pmap;
+  BOOST_FOREACH(vertex_descriptor v, deform_mesh->roi_vertices())
+  {
+    if(deform_mesh->is_control_vertex(v))
+      constrained_set.insert(v);
+
+    BOOST_FOREACH(face_descriptor fv, CGAL::faces_around_target(halfedge(v, g), g))
+    {
+      if(fv == boost::graph_traits<Polyhedron>::null_face())
+        continue;
+      bool add_face=true;
+      BOOST_FOREACH(vertex_descriptor vfd, CGAL::vertices_around_face(halfedge(fv,g),g))
+        if (roi_vertices.count(vfd)==0)
+          add_face=false;
+      if(add_face)
+      {
+        roi_facets.insert(fv);
+        put(roi_faces_pmap, fv, true);
+      }
+    }
+  }
+
+  if (roi_facets.empty())
+  {
+    std::cout << "Remeshing canceled (there is no facet with "
+              << "its 3 vertices in the ROI)." << std::endl;
+    QApplication::restoreOverrideCursor();
+    return;
+  }
+  // set face_index map needed for border_halfedges and isotropic_remeshing
+  boost::property_map<Polyhedron, CGAL::face_index_t>::type fim
+    = get(CGAL::face_index, *item->polyhedron());
+  unsigned int id = 0;
+
+  // estimate the target_length using the perimeter of the region to remesh
+  bool automatic_target_length = !ui_widget->remeshingEdgeLengthInput_checkBox->isChecked();
+  double estimated_target_length = 0.;
+  
+    BOOST_FOREACH(face_descriptor f, faces(*item->polyhedron()))
+      put(fim, f, id++);
+
+    std::set<edge_descriptor> roi_border;
+    CGAL::Polygon_mesh_processing::border_halfedges(roi_facets, g,
+      boost::make_function_output_iterator(halfedge2edge(g, roi_border)));
+
+  if (automatic_target_length)
+  {
+    double sum_len = 0.;
+    BOOST_FOREACH(edge_descriptor e, roi_border)
+    {
+      halfedge_descriptor h = halfedge(e, g);
+      sum_len += CGAL::sqrt(CGAL::squared_distance(
+                    get(vpmap, source(h, g)), get(vpmap, target(h, g))));
+    }
+    if (sum_len==0) automatic_target_length = false;
+    else
+      estimated_target_length = sum_len / (0. + roi_border.size());
+  }
+
+  double target_length = automatic_target_length
+    ? estimated_target_length
+    : ui_widget->remeshing_edge_length_spinbox->value();
+
+  unsigned int nb_iter = ui_widget->remeshing_iterations_spinbox->value();
+
+  std::cout << "Remeshing (target edge length = " << target_length <<")...";
+
+  ROI_border_pmap border_pmap(&roi_border);
+  CGAL::Polygon_mesh_processing::isotropic_remeshing(
+      roi_facets
+    , target_length
+    , *item->polyhedron()
+    , CGAL::Polygon_mesh_processing::parameters::number_of_iterations(nb_iter)
+    .protect_constraints(false)
+    .vertex_point_map(vpmap)
+    .edge_is_constrained_map(border_pmap)
+    .face_patch_map(roi_faces_pmap)
+    .vertex_is_constrained_map(Is_constrained_map(&constrained_set))
+    );
+  std::cout << "done." << std::endl;
+  poly_item->update_vertex_indices();
+  poly_item->update_facet_indices();
+  poly_item->update_halfedge_indices();
+  //reset ROI from its outside border roi_border
+  item->clear_roi();
+  do{
+    item->delete_ctrl_vertices_group(false);
+  }
+  while(!ctrl_vertex_frame_map.empty());
+
+  poly_item->update_vertex_indices();
+  poly_item->update_halfedge_indices();
+  delete deform_mesh;
+  deform_mesh = new Deform_mesh(*(poly_item->polyhedron()),
+                                Deform_mesh::Vertex_index_map(),
+                                Deform_mesh::Hedge_index_map(),
+                                vpmap);
+
+  for(std::size_t i=0; i<control_groups.size() ; i++)
+  {
+    item->create_ctrl_vertices_group();
+    BOOST_FOREACH(vertex_descriptor vd, control_groups[i]){
+      item->insert_control_vertex(vd);
+    }
+  }
+
+  BOOST_FOREACH(face_descriptor f, faces(g))
+  {
+    if (!get(roi_faces_pmap, f))
+      continue;
+    BOOST_FOREACH(halfedge_descriptor h, halfedges_around_face(halfedge(f, g), g))
+    {
+      vertex_descriptor v = target(h, g);
+      item->insert_roi_vertex(v);
+    }
+    put(roi_faces_pmap, f, false); //reset ids
+  }
+
+  reset_drawing_data();
+  compute_normals_and_vertices();
+
+  poly_item->invalidate_aabb_tree(); // invalidate the AABB tree
+  QApplication::restoreOverrideCursor();
+  Q_EMIT item->itemChanged();
+}
+
+void Scene_edit_polyhedron_item::updateDeform()
+{
+  if(d->need_change)
+  {
+    // just handle deformation - paint like selection is handled in eventFilter()
+    invalidateOpenGLBuffers();
+    if(!d->ui_widget->ActivatePivotingCheckBox->isChecked()) {
+      deform();
+    }
+    else {
+      Q_EMIT itemChanged(); // for redraw while Pivoting (since we close signals of manipulatedFrames while pivoting,
+      // for now redraw with timer)
+    }
+    d->need_change = 0;
+  }
+}
+
+void Scene_edit_polyhedron_item::change()
+{
+  d->need_change = true;
+  QTimer::singleShot(0, this, SLOT(updateDeform()));
+}
+struct Is_selected_property_map{
+  std::vector<bool>* is_selected_ptr;
+  Is_selected_property_map()
+    : is_selected_ptr(NULL) {}
+  Is_selected_property_map(std::vector<bool>& is_selected)
+    : is_selected_ptr( &is_selected) {}
+
+  std::size_t id(vertex_descriptor v){ return v->id(); }
+
+  friend bool get(Is_selected_property_map map, vertex_descriptor v)
+  {
+    CGAL_assertion(map.is_selected_ptr!=NULL);
+    return (*map.is_selected_ptr)[map.id(v)];
+  }
+
+  friend void put(Is_selected_property_map map, vertex_descriptor v, bool b)
+  {
+    CGAL_assertion(map.is_selected_ptr!=NULL);
+    (*map.is_selected_ptr)[map.id(v)]=b;
+  }
+};
+
+void Scene_edit_polyhedron_item_priv::expand_or_reduce(int steps)
+{
+
+  std::vector<bool> mark(poly_item->polyhedron()->size_of_vertices(),false);
+
+
+
+  bool ctrl_active = ui_widget->CtrlVertRadioButton->isChecked();
+  if (ctrl_active && active_group == ctrl_vertex_frame_map.end() ) return;
+  std::size_t original_size;
+  if(ctrl_active)
+    original_size = active_group->ctrl_vertices_group.size();
+  else
+    original_size = deform_mesh->roi_vertices().size();
+  BOOST_FOREACH(vertex_descriptor v,deform_mesh->roi_vertices())
+  {
+    if(ctrl_active)
+    {
+      if(deform_mesh->is_control_vertex(v))
+        mark[v->id()]=true;
+    }
+    else
+    {
+      if(!deform_mesh->is_control_vertex(v))
+        mark[v->id()]=true;
+    }
+  }
+  std::vector<bool> mask = mark;
+  if(steps > 0)
+  {
+    if(ctrl_active)
+      expand_vertex_selection(active_group->ctrl_vertices_group, *poly_item->polyhedron(), steps, Is_selected_property_map(mark),
+                            CGAL::Emptyset_iterator());
+    else
+      expand_vertex_selection(deform_mesh->roi_vertices(), *poly_item->polyhedron(), steps, Is_selected_property_map(mark),
+                            CGAL::Emptyset_iterator());
+  }
+  else
+  {
+    if(ctrl_active)
+      reduce_vertex_selection(active_group->ctrl_vertices_group, *poly_item->polyhedron(), -steps, Is_selected_property_map(mark),
+                              CGAL::Emptyset_iterator());
+    else
+      reduce_vertex_selection(deform_mesh->roi_vertices(), *poly_item->polyhedron(), -steps, Is_selected_property_map(mark),
+                              CGAL::Emptyset_iterator());
+  }
+
+  for(Polyhedron::Vertex_iterator it = poly_item->polyhedron()->vertices_begin() ; it != poly_item->polyhedron()->vertices_end(); ++it)
+  {
+    if(ctrl_active)
+    {
+      if(mark[it->id()] && !mask[it->id()])
+        item->insert_control_vertex(it);
+      else if(!mark[it->id()] && mask[it->id()])
+        item->erase_control_vertex(it);
+    }
+    else
+    {
+      if(mark[it->id()] && !mask[it->id()])
+        item->insert_roi_vertex(it);
+      else if(!mark[it->id()] && mask[it->id()])
+        item->erase_roi_vertex(it);
+    }
+  }
+  if(active_group->ctrl_vertices_group.empty() && ctrl_vertex_frame_map.size()>1)
+    item->delete_ctrl_vertices_group(false);
+
+  if(
+     (!ctrl_active && deform_mesh->roi_vertices().size() != original_size)
+     || (ctrl_active && active_group->ctrl_vertices_group.size() != original_size)
+     )
+  { item->invalidateOpenGLBuffers(); Q_EMIT item->itemChanged(); }
+}
+
+bool Scene_edit_polyhedron_item::eventFilter(QObject* /*target*/, QEvent *event)
+{
+  // This filter is both filtering events from 'viewer' and 'main window'
+  Mouse_keyboard_state_deformation old_state = d->state;
+  ////////////////// TAKE EVENTS /////////////////////
+  // key events
+  if(event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease) 
+  {
+    QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
+    Qt::KeyboardModifiers modifiers = keyEvent->modifiers();
+
+    d->state.ctrl_pressing = modifiers.testFlag(Qt::ControlModifier);
+    d->state.shift_pressing = modifiers.testFlag(Qt::ShiftModifier);
+  }
+  // mouse events
+  if(event->type() == QEvent::Wheel
+     &&d->state.shift_pressing)
+  {
+    QWheelEvent *w_event = static_cast<QWheelEvent*>(event);
+    int steps = w_event->delta() / 120;
+    d->expand_or_reduce(steps);
+  }
+  if(event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonRelease)
+  {
+    QMouseEvent* mouse_event = static_cast<QMouseEvent*>(event);
+    if(mouse_event->button() == Qt::LeftButton) {
+      d->state.left_button_pressing = event->type() == QEvent::MouseButtonPress;
+    }
+    if(mouse_event->button() == Qt::RightButton) {
+      d->state.right_button_pressing = event->type() == QEvent::MouseButtonPress;
+    }    
+  }
+  ////////////////// //////////////// /////////////////////
+
+  if(!d->poly_item->visible()) { return false; } // if not visible just update event state but don't do any action
+
+  // check state changes between old and current state
+  bool ctrl_pressed_now = d->state.ctrl_pressing && !old_state.ctrl_pressing;
+  bool ctrl_released_now = !d->state.ctrl_pressing && old_state.ctrl_pressing;
+  if(ctrl_pressed_now || ctrl_released_now || event->type() == QEvent::HoverMove)
+  {// activate a handle manipulated frame
+    QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
+    const QPoint& p = viewer->mapFromGlobal(QCursor::pos());
+    bool need_repaint = activate_closest_manipulated_frame(p.x(), p.y());
+
+    if (!d->ui_widget->ActivatePivotingCheckBox->isChecked() &&
+        ctrl_released_now && d->ui_widget->RemeshingCheckBox->isChecked())
+    {
+      remesh();
+    }
+    if(need_repaint)
+     invalidateOpenGLBuffers();
+
+    need_repaint |= d->state.left_button_pressing || d->state.right_button_pressing;
+    if(need_repaint) { Q_EMIT itemChanged(); }
+  }
+
+  return false;
+}
+
+#include "opengl_tools.h"
+void Scene_edit_polyhedron_item::drawEdges(CGAL::Three::Viewer_interface* viewer) const {
+    if(!are_buffers_filled)
+    {
+      d->compute_normals_and_vertices();
+      d->initializeBuffers(viewer);
+    }
+    vaos[Scene_edit_polyhedron_item_priv::Edges]->bind();
+    d->program = getShaderProgram(PROGRAM_NO_SELECTION);
+    attribBuffers(viewer,PROGRAM_NO_SELECTION);
+    d->program->bind();
+    d->program->setAttributeValue("colors", QColor(0,0,0));
+    viewer->glDrawElements(GL_LINES, (GLsizei) d->edges.size(), GL_UNSIGNED_INT, d->edges.data());
+    d->program->release();
+    vaos[Scene_edit_polyhedron_item_priv::Edges]->release();
+
+
+    vaos[Scene_edit_polyhedron_item_priv::Frame_plane]->bind();
+    d->program = getShaderProgram(PROGRAM_NO_SELECTION);
+    attribBuffers(viewer,PROGRAM_NO_SELECTION);
+    d->program->bind();
+    d->program->setAttributeValue("colors", QColor(0,0,0));
+    viewer->glDrawArrays(GL_LINE_LOOP, 0, (GLsizei)d->pos_frame_plane.size()/3);
+    d->program->release();
+    vaos[Scene_edit_polyhedron_item_priv::Frame_plane]->release();
+
+
+  if(rendering_mode == Wireframe) {
+        draw_ROI_and_control_vertices(viewer);
+  }
+}
+void Scene_edit_polyhedron_item::draw(CGAL::Three::Viewer_interface* viewer) const {
+    if(!are_buffers_filled)
+    {
+      d->compute_normals_and_vertices();
+      d->initializeBuffers(viewer);
+    }
+    vaos[Scene_edit_polyhedron_item_priv::Facets]->bind();
+    d->program = getShaderProgram(PROGRAM_WITH_LIGHT);
+    attribBuffers(viewer,PROGRAM_WITH_LIGHT);
+    d->program->bind();
+    QColor color = this->color();
+    d->program->setAttributeValue("colors", color);
+    viewer->glDrawElements(GL_TRIANGLES, (GLsizei) d->tris.size(), GL_UNSIGNED_INT, d->tris.data());
+    d->program->release();
+    vaos[Scene_edit_polyhedron_item_priv::Facets]->release();
+    drawEdges(viewer);
+    draw_ROI_and_control_vertices(viewer);
+
+}
+
+void Scene_edit_polyhedron_item::draw_frame_plane(QGLViewer* ) const
+{
+    d->pos_frame_plane.resize(15);
+    for(Scene_edit_polyhedron_item_priv::Ctrl_vertices_group_data_list::const_iterator hgb_data = d->ctrl_vertex_frame_map.begin(); hgb_data != d->ctrl_vertex_frame_map.end(); ++hgb_data)
+    {
+          const double diag = scene_diag();
+          qglviewer::Vec base1(1,0,0);
+          qglviewer::Vec base2(0,1,0);
+
+          qglviewer::Quaternion orientation=hgb_data->frame->orientation();
+          base1=orientation.rotate(base1);
+          base2=orientation.rotate(base2);
+
+          qglviewer::Vec center = hgb_data->calculate_initial_center();
+          qglviewer::Vec p1 = center - diag*base1 - diag*base2;
+          qglviewer::Vec p2 = center + diag*base1 - diag*base2;
+          qglviewer::Vec p3 = center + diag*base1 + diag*base2;
+          qglviewer::Vec p4 = center - diag*base1 + diag*base2;
+
+          d->pos_frame_plane[0] = p1.x ; d->pos_frame_plane[1] = p1.y; d->pos_frame_plane[2] =p1.z ;
+          d->pos_frame_plane[3] = p2.x ; d->pos_frame_plane[4] = p2.y; d->pos_frame_plane[5] =p2.z ;
+          d->pos_frame_plane[6] = p3.x ; d->pos_frame_plane[7] = p3.y; d->pos_frame_plane[8] =p3.z ;
+          d->pos_frame_plane[9] = p4.x ; d->pos_frame_plane[10]= p4.y; d->pos_frame_plane[11] =p4.z ;
+          d->pos_frame_plane[12] = p1.x ; d->pos_frame_plane[13]= p1.y; d->pos_frame_plane[14] =p1.z ;
+    }
+}
+
+
+void Scene_edit_polyhedron_item::draw_ROI_and_control_vertices(CGAL::Three::Viewer_interface* viewer) const {
+
+  CGAL::GL::Point_size point_size; point_size.set_point_size(5);
+
+  //Draw the points
+  if(d->ui_widget->ShowROICheckBox->isChecked()) {
+
+        if(!d->ui_widget->ShowAsSphereCheckBox->isChecked() || !viewer->extension_is_found) {
+
+            vaos[Scene_edit_polyhedron_item_priv::Roi_points]->bind();
+            d->program = getShaderProgram(PROGRAM_NO_SELECTION);
+            attribBuffers(viewer,PROGRAM_NO_SELECTION);
+            d->program->bind();
+            d->program->setAttributeValue("colors", QColor(0,255,0));
+            viewer->glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(d->nb_ROI/3));
+            d->program->release();
+            vaos[Scene_edit_polyhedron_item_priv::Roi_points]->release();
+        }
+        else
+        {
+          d->spheres->setVisible(true);
+          Scene_group_item::draw(viewer);
+        }
+  }
+  else
+  {
+    if(d->ui_widget->ShowAsSphereCheckBox->isChecked() && viewer->extension_is_found) {
+      d->spheres->setVisible(false);
+      Scene_group_item::draw(viewer);
+    }
+  }
+
+    if(!d->ui_widget->ShowAsSphereCheckBox->isChecked() || !viewer->extension_is_found) {
+        vaos[Scene_edit_polyhedron_item_priv::Control_points]->bind();
+        d->program = getShaderProgram(PROGRAM_NO_SELECTION);
+        attribBuffers(viewer,PROGRAM_NO_SELECTION);
+        d->program->bind();
+        //d->program->setAttributeValue("colors", QColor(255,0,0));
+        viewer->glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(d->nb_control/3));
+        d->program->release();
+        vaos[Scene_edit_polyhedron_item_priv::Control_points]->release();
+    }
+    // Draw the axis
+    QGLViewer* viewerB = *QGLViewer::QGLViewerPool().begin();
+    for(Scene_edit_polyhedron_item_priv::Ctrl_vertices_group_data_list::const_iterator hgb_data = d->ctrl_vertex_frame_map.begin(); hgb_data != d->ctrl_vertex_frame_map.end(); ++hgb_data)
+    {
+         if(hgb_data->frame == viewerB->manipulatedFrame())
+         {
+              GLfloat f_matrix[16];
+              for(int i =0; i<16; i++)
+                  f_matrix[i] = hgb_data->frame->matrix()[i];
+              QMatrix4x4 f_mat;
+                  for(int i=0; i<16; i++)
+                      f_mat.data()[i] = (float)f_matrix[i];
+              vaos[Scene_edit_polyhedron_item_priv::Axis]->bind();
+              d->program = getShaderProgram(PROGRAM_NO_SELECTION);
+              attribBuffers(viewer, PROGRAM_NO_SELECTION);
+              d->program->bind();
+              d->program->setUniformValue("f_matrix", f_mat);
+              viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(d->nb_axis/3));
+              d->program->release();
+              vaos[Scene_edit_polyhedron_item_priv::Axis]->release();
+
+              //QGLViewer::drawAxis(length_of_axis);
+              // draw bbox
+              if(!d->ui_widget->ActivatePivotingCheckBox->isChecked())
+              {
+                   GLfloat f_matrix[16];
+                   GLfloat trans[3];
+                   GLfloat trans2[3];
+
+                   trans[0] = hgb_data->frame->position().x;
+                   trans[1] = hgb_data->frame->position().y;
+                   trans[2] = hgb_data->frame->position().z;
+
+                   trans2[0] = -hgb_data->frame_initial_center.x;
+                   trans2[1] = -hgb_data->frame_initial_center.y;
+                   trans2[2] = -hgb_data->frame_initial_center.z;
+
+                   for(int i =0; i<16; i++)
+                       f_matrix[i] = hgb_data->frame->orientation().matrix()[i];
+                   QMatrix4x4 f_mat;
+                   QMatrix4x4 mvp_mat;
+
+                   QVector3D vec(trans[0], trans[1], trans[2]);
+                   QVector3D vec2(trans2[0], trans2[1], trans2[2]);
+                   for(int i=0; i<16; i++)
+                       f_mat.data()[i] = (float)f_matrix[i];
+                   GLdouble temp_mat[16];
+                   viewer->camera()->getModelViewProjectionMatrix(temp_mat);
+                   for(int i=0; i<16; i++)
+                       mvp_mat.data()[i] = (float)temp_mat[i];
+                   vaos[Scene_edit_polyhedron_item_priv::BBox]->bind();
+                   d->bbox_program.bind();
+                   d->bbox_program.setUniformValue("rotations", f_mat);
+                   d->bbox_program.setUniformValue("translation", vec);
+                   d->bbox_program.setUniformValue("translation_2", vec2);
+                   d->bbox_program.setUniformValue("mvp_matrix", mvp_mat);
+                   d->program->setAttributeValue("colors", QColor(255,0,0));
+                   viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(d->nb_bbox/3));
+                   d->bbox_program.release();
+                   vaos[Scene_edit_polyhedron_item_priv::BBox]->release();
+              }
+         }
+    }
+
+}
+
+
+void Scene_edit_polyhedron_item_priv::compute_bbox(const CGAL::Three::Scene_interface::Bbox& bb){
+    pos_bbox.resize(24*3);
+
+    pos_bbox[0]=bb.xmin(); pos_bbox[1]=bb.ymin(); pos_bbox[2]=bb.zmin();
+    pos_bbox[3]=bb.xmax(); pos_bbox[4]=bb.ymin(); pos_bbox[5]=bb.zmin();
+    pos_bbox[6]=bb.xmin(); pos_bbox[7]=bb.ymin(); pos_bbox[8]=bb.zmin();
+    pos_bbox[9]=bb.xmin(); pos_bbox[10]=bb.ymax(); pos_bbox[11]=bb.zmin();
+    
+    pos_bbox[12]=bb.xmin(); pos_bbox[13]=bb.ymin(); pos_bbox[14]=bb.zmin();
+    pos_bbox[15]=bb.xmin(); pos_bbox[16]=bb.ymin(); pos_bbox[17]=bb.zmax();
+    pos_bbox[18]= bb.xmax(); pos_bbox[19]=bb.ymin(); pos_bbox[20]=bb.zmin();
+    pos_bbox[21]= bb.xmax(); pos_bbox[22]=bb.ymax(); pos_bbox[23]=bb.zmin();
+    
+    pos_bbox[24]= bb.xmax(); pos_bbox[25]=bb.ymin(); pos_bbox[26]=bb.zmin();
+    pos_bbox[27]= bb.xmax(); pos_bbox[28]=bb.ymin(); pos_bbox[29]=bb.zmax();
+    pos_bbox[30]=bb.xmin(); pos_bbox[31]=bb.ymax(); pos_bbox[32]=bb.zmin();
+    pos_bbox[33]=bb.xmax(); pos_bbox[34]=bb.ymax(); pos_bbox[35]=bb.zmin();
+    
+    pos_bbox[36]=bb.xmin(); pos_bbox[37]=bb.ymax(); pos_bbox[38]=bb.zmin();
+    pos_bbox[39]=bb.xmin(); pos_bbox[40]=bb.ymax(); pos_bbox[41]=bb.zmax();
+    pos_bbox[42]=bb.xmin(); pos_bbox[43]=bb.ymin(); pos_bbox[44]=bb.zmax();
+    pos_bbox[45]=bb.xmax(); pos_bbox[46]=bb.ymin(); pos_bbox[47]=bb.zmax();
+
+    pos_bbox[48]=bb.xmin(); pos_bbox[49]=bb.ymin(); pos_bbox[50]=bb.zmax();
+    pos_bbox[51]=bb.xmin(); pos_bbox[52]=bb.ymax(); pos_bbox[53]=bb.zmax();
+    pos_bbox[54]=bb.xmax(); pos_bbox[55]=bb.ymax(); pos_bbox[56]=bb.zmax();
+    pos_bbox[57]=bb.xmin(); pos_bbox[58]=bb.ymax(); pos_bbox[59]=bb.zmax();
+
+    pos_bbox[60]=bb.xmax(); pos_bbox[61]=bb.ymax(); pos_bbox[62]=bb.zmax();
+    pos_bbox[63]=bb.xmax(); pos_bbox[64]=bb.ymin(); pos_bbox[65]=bb.zmax();
+    pos_bbox[66]=bb.xmax(); pos_bbox[67]=bb.ymax(); pos_bbox[68]=bb.zmax();
+    pos_bbox[69]=bb.xmax(); pos_bbox[70]=bb.ymax(); pos_bbox[71]=bb.zmin();
+    
+}
+
+void Scene_edit_polyhedron_item::invalidateOpenGLBuffers()
+{
+    if(d->spheres)
+      d->spheres->clear_spheres();
+    if(d->spheres_ctrl)
+      d->spheres_ctrl->clear_spheres();
+    update_normals();
+    compute_bbox();
+    are_buffers_filled = false;
+    if(d->spheres)
+      d->spheres->invalidateOpenGLBuffers();
+    if(d->spheres_ctrl)
+      d->spheres_ctrl->invalidateOpenGLBuffers();
+}
+
+Scene_polyhedron_item* Scene_edit_polyhedron_item::to_polyhedron_item() {
+  Scene_polyhedron_item* poly_item_tmp = d->poly_item;
+  d->poly_item->set_color_vector_read_only(false);
+  d->own_poly_item=false;
+  poly_item_tmp->invalidateOpenGLBuffers();
+  return poly_item_tmp;
+}
+
+Polyhedron* Scene_edit_polyhedron_item::polyhedron()       
+{ return d->poly_item->polyhedron(); }
+const Polyhedron* Scene_edit_polyhedron_item::polyhedron() const 
+{ return d->poly_item->polyhedron(); }
+QString Scene_edit_polyhedron_item::toolTip() const
+{
+  if(!d->poly_item->polyhedron())
+    return QString();
+
+  return QObject::tr("<p>Polyhedron <b>%1</b> (mode: %5, color: %6)</p>"
+                     "<p>Number of vertices: %2<br />"
+                     "Number of edges: %3<br />"
+                     "Number of facets: %4</p>")
+    .arg(this->name())
+    .arg(d->poly_item->polyhedron()->size_of_vertices())
+    .arg(d->poly_item->polyhedron()->size_of_halfedges()/2)
+    .arg(d->poly_item->polyhedron()->size_of_facets())
+    .arg(this->renderingModeName())
+    .arg(this->color().name());
+}
+bool Scene_edit_polyhedron_item::isEmpty() const {
+  return d->poly_item->isEmpty();
+}
+void Scene_edit_polyhedron_item::compute_bbox() const {
+  _bbox = d->poly_item->bbox();
+}
+
+void Scene_edit_polyhedron_item::setVisible(bool b) {
+  d->poly_item->setVisible(b);
+  Scene_item::setVisible(b);
+  if(!b) {
+    (*QGLViewer::QGLViewerPool().begin())->setManipulatedFrame(NULL);
+  }
+}
+void Scene_edit_polyhedron_item::setColor(QColor c) {
+  d->poly_item->setColor(c);
+  Scene_item::setColor(c);
+}
+void Scene_edit_polyhedron_item::setName(QString n) {
+  Scene_item::setName(n);
+  n.replace(" (edit)", "");
+  d->poly_item->setName(n);
+}
+void Scene_edit_polyhedron_item::setRenderingMode(RenderingMode m) {
+  d->poly_item->setRenderingMode(m);
+  Scene_item::setRenderingMode(m);
+}
+Scene_edit_polyhedron_item* Scene_edit_polyhedron_item::clone() const {
+  return 0;
+}
+void Scene_edit_polyhedron_item::select(
+          double orig_x,
+          double orig_y,
+          double orig_z,
+          double dir_x,
+          double dir_y,
+          double dir_z)
+{
+  Scene_item::select(orig_x,
+                     orig_y,
+                     orig_z,
+                     dir_x,
+                     dir_y,
+                     dir_z);
+  d->poly_item->select(orig_x,
+                       orig_y,
+                       orig_z,
+                       dir_x,
+                       dir_y,
+                       dir_z);
+}
+
+bool Scene_edit_polyhedron_item::keyPressEvent(QKeyEvent* e)
+{
+  //setting/unsetting rotation constraints
+  if (e->key()==Qt::Key_R && !d->state.ctrl_pressing)
+  {
+    d->is_rot_free = !d->is_rot_free;
+    d->rot_constraint.setRotationConstraintType( d->is_rot_free?
+        qglviewer::AxisPlaneConstraint::FREE:
+        qglviewer::AxisPlaneConstraint::AXIS);
+    return true;
+  }
+
+  return false;
+}
+
+
+//#include "Scene_edit_polyhedron_item.moc"
+void Scene_edit_polyhedron_item::update_frame_plane()
+{
+  for(Ctrl_vertices_group_data_list::iterator hgb_data = d->ctrl_vertex_frame_map.begin(); hgb_data != d->ctrl_vertex_frame_map.end(); ++hgb_data)
+  {
+      hgb_data->refresh();
+  }
+}
+
+
+struct Reset_spheres_ctrl
+{
+  Scene_edit_polyhedron_item_priv* d;
+  Reset_spheres_ctrl(Scene_edit_polyhedron_item_priv* d) : d(d) {}
+  void operator()() const { d->spheres_ctrl = NULL; }
+};
+
+void Scene_edit_polyhedron_item::ShowAsSphere(bool b)
+{
+  if(b)
+  {
+    if(!d->spheres)
+    {
+      d->spheres = new Scene_spheres_item(this, false);
+      d->spheres->setName("ROI spheres");
+      d->spheres->setRenderingMode(Gouraud);
+      connect(d->spheres, SIGNAL(destroyed()), this, SLOT(reset_spheres()));
+      scene->setSelectedItem(scene->item_id(this));
+      scene->addItem(d->spheres);
+      scene->changeGroup(d->spheres, this);
+      lockChild(d->spheres);
+      invalidateOpenGLBuffers();
+    }
+    if(!d->spheres_ctrl)
+    {
+      d->spheres_ctrl = new Scene_spheres_item(this, false);
+      d->spheres_ctrl->setName("Control spheres");
+      d->spheres_ctrl->setRenderingMode(Gouraud);
+      connect(d->spheres_ctrl, &QObject::destroyed, this, Reset_spheres_ctrl(d) );
+      scene->setSelectedItem(scene->item_id(this));
+      scene->addItem(d->spheres_ctrl);
+      scene->changeGroup(d->spheres_ctrl, this);
+      lockChild(d->spheres_ctrl);
+      invalidateOpenGLBuffers();
+    }
+  }
+  else if(!b )
+  {
+    if(d->spheres!=0)
+    {
+      unlockChild(d->spheres);
+      removeChild(d->spheres);
+      scene->erase(scene->item_id(d->spheres));
+    }
+    if(d->spheres_ctrl!=0)
+    {
+      unlockChild(d->spheres_ctrl);
+      removeChild(d->spheres_ctrl);
+      scene->erase(scene->item_id(d->spheres_ctrl));
+    }
+  }
+}
+bool Scene_edit_polyhedron_item::is_there_any_ctrl_vertices_group(Ctrl_vertices_group_data_list::iterator& hgb, Ctrl_vertices_group_data_list::iterator& hge)
+{
+  hgb = d->ctrl_vertex_frame_map.begin(); hge = d->ctrl_vertex_frame_map.end();
+  return hgb != hge;
+}
+int Scene_edit_polyhedron_item::get_k_ring()       { return d->k_ring_selector.k_ring; }
+void Scene_edit_polyhedron_item::set_k_ring(int v) { d->k_ring_selector.k_ring = v; }
+
+void Scene_edit_polyhedron_item::reset_spheres()
+{
+  d->spheres = NULL;
+}
+
+void Scene_edit_polyhedron_item::selected(const std::set<Polyhedron::Vertex_handle>& m)
+{
+  bool any_changes = false;
+  for(std::set<vertex_descriptor>::const_iterator it = m.begin(); it != m.end(); ++it)
+  {
+    vertex_descriptor vh = *it;
+    bool changed = false;
+    if(d->ui_widget->ROIRadioButton->isChecked()) {
+      if(d->ui_widget->InsertRadioButton->isChecked()) { changed = insert_roi_vertex(vh);}
+      else          { changed = erase_roi_vertex(vh);  }
+    }
+    else {
+      if(d->ui_widget->InsertRadioButton->isChecked()) { changed = insert_control_vertex(vh); }
+      else          { changed = erase_control_vertex(vh);  }
+    }
+    any_changes |= changed;
+  }
+  if(any_changes) { invalidateOpenGLBuffers(); Q_EMIT itemChanged(); }
+}
+
+bool Scene_edit_polyhedron_item::insert_control_vertex(vertex_descriptor v)
+{
+  if(!is_there_any_ctrl_vertices_group()) {
+    std::cerr<<"There is no group of control vertices, create one!\n";
+    return false;
+  } // no group of control vertices to insert
+
+  bool inserted = d->deform_mesh->insert_control_vertex(v);
+  if(inserted) {
+    d->active_group->ctrl_vertices_group.push_back(v);
+    d->active_group->refresh();
+  }
+  return inserted;
+}
+
+bool Scene_edit_polyhedron_item::insert_roi_vertex(vertex_descriptor v)
+{
+  return d->deform_mesh->insert_roi_vertex(v);
+}
+
+bool Scene_edit_polyhedron_item::erase_control_vertex(vertex_descriptor v)
+{
+  if(d->deform_mesh->erase_control_vertex(v)) // API should be safe enough to do that (without checking empty group of control vertices etc.)
+  {
+    refresh_all_group_centers(); // since we don't know which group of control vertices v is erased from, refresh all
+    return true;
+  }
+
+  print_message("Selected vertex is not a control vertex!");
+  return false;
+}
+
+bool Scene_edit_polyhedron_item::erase_roi_vertex(vertex_descriptor v)
+{
+  erase_control_vertex(v); // erase control vertex
+  return d->deform_mesh->erase_roi_vertex(v);
+}
+
+void Scene_edit_polyhedron_item::clear_roi()
+{
+  for(Ctrl_vertices_group_data_list::iterator it = d->ctrl_vertex_frame_map.begin(); it != d->ctrl_vertex_frame_map.end(); ++it)
+  {
+    delete it->frame;
+  }
+  d->ctrl_vertex_frame_map.clear();
+  d->deform_mesh->clear_roi_vertices();
+
+  create_ctrl_vertices_group(); // create one new group of control vertices
+}
+
+void Scene_edit_polyhedron_item::create_ctrl_vertices_group()
+{
+  for(Ctrl_vertices_group_data_list::iterator it = d->ctrl_vertex_frame_map.begin(); it != d->ctrl_vertex_frame_map.end(); ++it) {
+    if(it->ctrl_vertices_group.empty()) {
+      d->active_group = it;
+      return;
+    }
+  }
+
+  // No empty group of control vertices
+  qglviewer::ManipulatedFrame* new_frame = new qglviewer::ManipulatedFrame();
+  new_frame->setRotationSensitivity(2.0f);
+  connect(new_frame, SIGNAL(manipulated()), this, SLOT(change()));
+
+  Control_vertices_data hgd(d->deform_mesh, new_frame);
+  d->ctrl_vertex_frame_map.push_back(hgd);
+  hgd.refresh();
+
+  d->active_group = --d->ctrl_vertex_frame_map.end();
+
+  invalidateOpenGLBuffers();
+  Q_EMIT itemChanged();
+
+  print_message("A new empty group of control vertices is created.");
+}
+
+void Scene_edit_polyhedron_item::delete_ctrl_vertices_group(bool create_new)
+{
+  if(!is_there_any_ctrl_vertices_group()) {
+    print_message("There is no group of control vertices to be deleted!");
+    return;
+  } // no group of control vertices
+
+  // delete group representative
+  for(Ctrl_vertices_group_data_list::iterator it = d->ctrl_vertex_frame_map.begin(); it != d->ctrl_vertex_frame_map.end(); ++it)
+  {
+    if(it == d->active_group)
+    {
+      delete it->frame;
+      for(std::vector<vertex_descriptor>::iterator v_it = it->ctrl_vertices_group.begin(); v_it != it->ctrl_vertices_group.end(); ++v_it) {
+        d->deform_mesh->erase_control_vertex(*v_it);
+      }
+      d->ctrl_vertex_frame_map.erase(it);
+      break;
+    }
+  }
+
+  // assign another ctrl_vertices_group to active_group
+  Ctrl_vertices_group_data_list::iterator hgb, hge;
+  if( is_there_any_ctrl_vertices_group(hgb, hge) )
+  {
+    d->active_group = hgb;
+  } // no group of control vertices
+  else if(create_new)
+  {
+    create_ctrl_vertices_group();
+  }
+}
+
+void Scene_edit_polyhedron_item::prev_ctrl_vertices_group()
+{
+  Ctrl_vertices_group_data_list::iterator hgb, hge;
+  if( !is_there_any_ctrl_vertices_group(hgb, hge) ) {
+    print_message("There is no group of control vertices to iterate on!");
+    return;
+  }
+  // shift
+  if(hgb == d->active_group) { d->active_group = --hge; }
+  else                    {--d->active_group; }
+}
+
+void Scene_edit_polyhedron_item::next_ctrl_vertices_group()
+{
+  Ctrl_vertices_group_data_list::iterator hgb, hge;
+  if( !is_there_any_ctrl_vertices_group(hgb, hge) ) {
+    print_message("There is no group of control vertices to iterate on!");
+    return;
+  }
+  // shift
+  if(--hge == d->active_group) { d->active_group = hgb; }
+  else                      {++d->active_group; }
+}
+
+void Scene_edit_polyhedron_item::pivoting_end()
+{
+  for(Ctrl_vertices_group_data_list::iterator it = d->ctrl_vertex_frame_map.begin(); it != d->ctrl_vertex_frame_map.end(); ++it)
+  {
+    //update constraint rotation vector, set only for the last group
+    it->rot_direction = it->frame->rotation().rotate( qglviewer::Vec(0.,0.,1.) );
+    //translate center of the frame
+    qglviewer::Vec vec= it->frame->position();
+    it->refresh();
+    it->frame_initial_center = vec;
+    it->frame->setPosition(vec);
+  }
+  for(Ctrl_vertices_group_data_list::iterator it = d->ctrl_vertex_frame_map.begin(); it != d->ctrl_vertex_frame_map.end(); ++it)
+  {
+    it->frame->blockSignals(false);
+  }
+}
+
+void Scene_edit_polyhedron_item::pivoting_begin()
+{
+  d->is_rot_free=true;
+  d->rot_constraint.setRotationConstraintType(qglviewer::AxisPlaneConstraint::FREE);
+  d->rot_constraint.setTranslationConstraintType(qglviewer::AxisPlaneConstraint::FREE);
+
+  // just block signals to prevent deformation
+  for(Ctrl_vertices_group_data_list::iterator it = d->ctrl_vertex_frame_map.begin(); it != d->ctrl_vertex_frame_map.end(); ++it)
+  {
+    it->frame->blockSignals(true);
+  }
+}
+
+void Scene_edit_polyhedron_item::save_roi(const char* file_name) const
+{
+  std::ofstream out(file_name);
+  // save roi
+  out << d->deform_mesh->roi_vertices().size() << std::endl;
+  BOOST_FOREACH(vertex_descriptor vd, d->deform_mesh->roi_vertices())
+  {
+    out << vd->id() << " ";
+  }
+  out << std::endl;
+  // save control vertices
+
+  out << d->ctrl_vertex_frame_map.size() << std::endl; // control vertices count
+  for(Ctrl_vertices_group_data_list::const_iterator hgb = d->ctrl_vertex_frame_map.begin(); hgb != d->ctrl_vertex_frame_map.end(); ++hgb) {
+
+    out << hgb->ctrl_vertices_group.size() << std::endl;
+    for(std::vector<vertex_descriptor>::const_iterator hb = hgb->ctrl_vertices_group.begin(); hb != hgb->ctrl_vertices_group.end(); ++hb)
+    {
+      out << (*hb)->id() << " ";
+    }
+    out << std::endl;
+  }
+}
+
+void Scene_edit_polyhedron_item::read_roi(const char* file_name)
+{
+  clear_roi();
+  delete_ctrl_vertices_group(false);
+
+  // put vertices to vector
+  std::vector<vertex_descriptor> all_vertices;
+  all_vertices.reserve(num_vertices(d->deform_mesh->halfedge_graph()));
+  vertex_iterator vb, ve;
+  for(boost::tie(vb, ve) = vertices(d->deform_mesh->halfedge_graph()); vb != ve; ++vb) {
+    all_vertices.push_back(*vb);
+  }
+  // read roi
+  std::ifstream in(file_name);
+  int roi_size;
+  in >> roi_size;
+  while(roi_size-- > 0)
+  {
+    std::size_t v_id;
+    in >> v_id;
+    insert_roi_vertex(all_vertices[v_id]);
+  }
+  // read control vertices
+  int ctrl_vertices_group_size;
+  in >> ctrl_vertices_group_size;
+  while(ctrl_vertices_group_size-- > 0)
+  {
+    create_ctrl_vertices_group();
+    int ctrl_size;
+    in >> ctrl_size;
+    while(ctrl_size-- > 0)
+    {
+      std::size_t v_id;
+      in >> v_id;
+      insert_control_vertex(all_vertices[v_id]);
+    }
+  }
+}
+
+void Scene_edit_polyhedron_item::overwrite_deform_object()
+{
+  d->deform_mesh->overwrite_initial_geometry();
+
+  refresh_all_group_centers();
+}
+
+void Scene_edit_polyhedron_item::reset_deform_object()
+{
+  d->deform_mesh->reset();
+  refresh_all_group_centers();
+}
+
+
+boost::optional<std::size_t> Scene_edit_polyhedron_item::get_minimum_isolated_component() {
+  Travel_isolated_components::Minimum_visitor visitor;
+  Travel_isolated_components().travel<Vertex_handle>
+    (vertices(*polyhedron()).first, vertices(*polyhedron()).second,
+     polyhedron()->size_of_vertices(), Is_selected(d->deform_mesh), visitor);
+  return visitor.minimum;
+}
+
+
+
+boost::optional<std::size_t> Scene_edit_polyhedron_item::select_isolated_components(std::size_t threshold) {
+  typedef boost::function_output_iterator<Select_roi_output> Output_iterator;
+  Output_iterator out(d->deform_mesh);
+
+  Travel_isolated_components::Selection_visitor<Output_iterator> visitor(threshold, out);
+  Travel_isolated_components().travel<Vertex_handle>
+    (vertices(*polyhedron()).first, vertices(*polyhedron()).second,
+    polyhedron()->size_of_vertices(), Is_selected(d->deform_mesh), visitor);
+
+  if(visitor.any_inserted) { invalidateOpenGLBuffers(); Q_EMIT itemChanged(); }
+  return visitor.minimum_visitor.minimum;
+}
+
+bool Scene_edit_polyhedron_item::is_there_any_ctrl_vertices_group()
+{
+  Ctrl_vertices_group_data_list::iterator hgb, hge;
+  return is_there_any_ctrl_vertices_group(hgb, hge);
+}
+
+bool Scene_edit_polyhedron_item::is_there_any_ctrl_vertices()
+{
+  Ctrl_vertices_group_data_list::iterator hgb, hge;
+  if(!is_there_any_ctrl_vertices_group(hgb, hge)) { return false; } // there isn't any group of control vertices
+
+  for(; hgb != hge; ++hgb) // check inside groups of control vertices
+  {
+    if(!hgb->ctrl_vertices_group.empty()) { return true; }
+  }
+  return false;
+}
+
+void Scene_edit_polyhedron_item::refresh_all_group_centers()
+{
+  for(Ctrl_vertices_group_data_list::iterator it = d->ctrl_vertex_frame_map.begin(); it != d->ctrl_vertex_frame_map.end(); ++it)
+  { it->refresh(); }
+}
+
+bool Scene_edit_polyhedron_item::activate_closest_manipulated_frame(int x, int y)
+{
+  if(d->state.ctrl_pressing && (d->state.left_button_pressing || d->state.right_button_pressing) )
+  { // user is deforming currently don't change the state
+    return false;
+  }
+  if(d->ctrl_vertex_frame_map.empty()) { return false; }
+
+  d->rot_constraint.setRotationConstraintType(qglviewer::AxisPlaneConstraint::FREE);
+  d->rot_constraint.setTranslationConstraintType(qglviewer::AxisPlaneConstraint::FREE);
+
+  QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
+  qglviewer::Camera* camera = viewer->camera();
+
+  if(!d->state.ctrl_pressing)
+  {
+    if(viewer->manipulatedFrame() == NULL)
+    { return false;}
+    viewer->setManipulatedFrame(NULL);
+    return true;
+  }
+
+  // now find closest frame and make it active manipulated frame
+  Ctrl_vertices_group_data_list::iterator min_it = d->ctrl_vertex_frame_map.begin();
+  const qglviewer::Vec& pos_it = camera->projectedCoordinatesOf(min_it->frame->position());
+  float min_dist = std::pow(pos_it.x - x, 2) + std::pow(pos_it.y - y, 2);
+
+  for(Ctrl_vertices_group_data_list::iterator it = d->ctrl_vertex_frame_map.begin(); it != d->ctrl_vertex_frame_map.end(); ++it)
+  {
+    const qglviewer::Vec& pos_it = camera->projectedCoordinatesOf(it->frame->position());
+    float dist = std::pow(pos_it.x - x, 2) + std::pow(pos_it.y - y, 2);
+    if(dist < min_dist) {
+      min_dist = dist;
+      min_it = it;
+    }
+  }
+
+  //set rotation constraint for the manipulated frame
+  if (!d->is_rot_free){
+    d->rot_constraint.setRotationConstraintDirection(min_it->rot_direction);
+    d->rot_constraint.setRotationConstraintType(qglviewer::AxisPlaneConstraint::AXIS);
+    min_it->frame->setConstraint(&d->rot_constraint);
+  }
+  else
+  {
+    if( d->ui_widget->ActivateFixedPlaneCheckBox->isChecked())
+    {
+      // the constraint is local to the frame
+      d->rot_constraint.setTranslationConstraint(qglviewer::AxisPlaneConstraint::PLANE,qglviewer::Vec(0,0,1));
+       if(!d->ui_widget->ActivatePivotingCheckBox->isChecked()){
+           d->rot_constraint.setRotationConstraintType(qglviewer::AxisPlaneConstraint::FORBIDDEN);
+       }
+       min_it->frame->setConstraint(&d->rot_constraint);
+    }
+  }
+
+  if(viewer->manipulatedFrame() == min_it->frame)
+  { return false; }
+  viewer->setManipulatedFrame(min_it->frame);
+  d->active_group = min_it;
+  return true;
+}
+
+void Scene_edit_polyhedron_item::update_normals() {
+  BOOST_FOREACH(vertex_descriptor vd, d->deform_mesh->roi_vertices())
+  {
+    std::size_t id = vd->id();
+    const Polyhedron::Traits::Vector_3& n =
+      CGAL::Polygon_mesh_processing::compute_vertex_normal(vd, d->deform_mesh->halfedge_graph());
+    d->normals[id*3] = n.x();
+    d->normals[id*3+1] = n.y();
+    d->normals[id*3+2] = n.z();
+
+  }
+}
+
diff --git a/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.h b/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.h
new file mode 100644
index 0000000..01aa2f8
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.h
@@ -0,0 +1,365 @@
+#ifndef SCENE_EDIT_POLYHEDRON_ITEM_H
+#define SCENE_EDIT_POLYHEDRON_ITEM_H
+//#define CGAL_PROFILE 
+#include "Scene_edit_polyhedron_item_config.h"
+#include "Scene_polyhedron_item.h"
+
+
+#include <CGAL/Three/Scene_group_item.h>
+
+#include "Scene_polyhedron_item_k_ring_selection.h"
+#include "Travel_isolated_components.h"
+
+#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
+#include <CGAL/boost/graph/properties_Polyhedron_3.h>
+#include <CGAL/boost/graph/iterator.h>
+
+#include <iostream>
+#include <fstream>
+
+#include <QGLViewer/manipulatedFrame.h>
+#include <QGLViewer/qglviewer.h>
+#include <QGLViewer/camera.h>
+
+#include "ui_Deform_mesh.h"
+
+#include <CGAL/Polygon_mesh_processing/compute_normal.h>
+#include <CGAL/Surface_mesh_deformation.h>
+
+#include <boost/function_output_iterator.hpp>
+#include <QGLBuffer>
+#include <QGLShader>
+#include <QGLShaderProgram>
+
+
+typedef Polyhedron::Vertex_handle                             Vertex_handle;
+typedef boost::graph_traits<Polyhedron>::vertex_descriptor    vertex_descriptor;
+typedef boost::graph_traits<Polyhedron>::vertex_iterator      vertex_iterator;
+typedef boost::graph_traits<Polyhedron>::face_descriptor      face_descriptor;
+typedef boost::graph_traits<Polyhedron>::halfedge_descriptor  halfedge_descriptor;
+typedef boost::graph_traits<Polyhedron>::edge_descriptor      edge_descriptor;
+class Scene_spheres_item;
+namespace PMP = CGAL::Polygon_mesh_processing;
+struct Array_based_vertex_point_map
+{
+public:
+  typedef vertex_descriptor            key_type;
+  typedef Polyhedron::Traits::Point_3  value_type;
+  typedef const value_type&                  reference;
+  typedef boost::read_write_property_map_tag category;
+  Array_based_vertex_point_map(std::vector<double>* positions) : positions(positions) {}
+  std::vector<double>* positions;
+};
+
+
+inline
+Array_based_vertex_point_map::reference
+get(Array_based_vertex_point_map,
+  Array_based_vertex_point_map::key_type key) {
+    return key->point();
+}
+
+inline
+void
+put(Array_based_vertex_point_map pmap,
+  Array_based_vertex_point_map::key_type key,
+  Array_based_vertex_point_map::value_type val)
+{
+  key->point() = val; // to make things easy (ray selection after deformation, save to polyhedron after close etc),
+  // I also change point() of vertex together with positions list
+  // So that we do not need to pmap everywhere other than draw
+  if (key->id() == std::size_t(-1))
+  {
+    key->id() = pmap.positions->size() / 3;
+    pmap.positions->push_back(val.x());
+    pmap.positions->push_back(val.y());
+    pmap.positions->push_back(val.z());
+  }
+  else
+  {
+  std::size_t pos = key->id() * 3;
+  (*pmap.positions)[pos] = val.x();
+  (*pmap.positions)[pos+1] = val.y();
+  (*pmap.positions)[pos+2] = val.z();
+  }
+}
+
+typedef CGAL::Surface_mesh_deformation<Polyhedron, CGAL::Default, CGAL::Default, CGAL::ORIGINAL_ARAP
+  ,CGAL::Default, CGAL::Default, CGAL::Default, 
+  Array_based_vertex_point_map> Deform_mesh;
+
+
+typedef Deform_mesh::Point  Point;
+
+/// For storing associated data with a group of control vertices
+class Control_vertices_data
+{
+public:
+  std::vector<vertex_descriptor> ctrl_vertices_group;
+  qglviewer::ManipulatedFrame* frame;  // manframe assoc with a group of control vertices
+  qglviewer::Vec frame_initial_center; // initial center of frame
+  CGAL::Three::Scene_interface::Bbox bbox;          // bbox of control vertices inside group
+  qglviewer::Vec rot_direction;        // vector for constraint rotation
+private:
+  std::vector<qglviewer::Vec> initial_positions;
+  Deform_mesh* deform_mesh;
+
+public:
+  Control_vertices_data(Deform_mesh* deform_mesh, qglviewer::ManipulatedFrame* frame = 0)
+    : frame(frame), bbox(0,0,0,0,0,0), rot_direction(0.,0.,1.), deform_mesh(deform_mesh)
+  { }
+  void refresh()
+  {
+    for(std::vector<vertex_descriptor>::iterator it = ctrl_vertices_group.begin(); it != ctrl_vertices_group.end(); ) {
+      if(!deform_mesh->is_control_vertex(*it)) {
+        it = ctrl_vertices_group.erase(it);
+      }
+      else { ++it; }
+    }
+
+    reset_initial_positions();
+    frame_initial_center = calculate_initial_center();
+    bbox = calculate_initial_bbox();
+
+    bool oldState = frame->blockSignals(true); // do not let it Q_EMIT modified, which will cause a deformation
+                                  // but we are just adjusting the center so it does not require a deformation
+    // frame->setOrientation(qglviewer::Quaternion());
+    frame->setPosition(frame_initial_center);
+    frame->blockSignals(oldState);
+  }
+  void set_target_positions()
+  {
+    std::vector<vertex_descriptor>::iterator hb = ctrl_vertices_group.begin();
+    for(std::vector<qglviewer::Vec>::iterator it = initial_positions.begin(); it != initial_positions.end(); ++it, ++hb)
+    {
+      qglviewer::Vec dif_from_initial_center = (*it) - frame_initial_center;
+      qglviewer::Vec rotated = frame->orientation() * dif_from_initial_center;
+      qglviewer::Vec rotated_and_translated = rotated + frame->position();
+
+      deform_mesh->set_target_position(*hb, Point(rotated_and_translated.x, rotated_and_translated.y, rotated_and_translated.z) );
+    }
+  }
+  qglviewer::Vec calculate_initial_center() const
+  {
+    qglviewer::Vec center_acc(0, 0, 0);
+    if (initial_positions.empty()) { return center_acc; }
+
+    for (std::vector<qglviewer::Vec>::const_iterator it = initial_positions.begin();
+         it != initial_positions.end(); ++it)
+    {
+      center_acc += (*it);
+    }
+    return center_acc / initial_positions.size();
+  }
+
+private:
+  void reset_initial_positions()
+  {
+    initial_positions.clear();
+    
+    for(std::vector<vertex_descriptor>::iterator hb = ctrl_vertices_group.begin(); hb != ctrl_vertices_group.end(); ++hb)
+    {
+      qglviewer::Vec point((*hb)->point().x(), (*hb)->point().y(), (*hb)->point().z() );
+      initial_positions.push_back(point);
+    }
+  }
+  CGAL::Three::Scene_interface::Bbox calculate_initial_bbox()
+  {    
+    if(initial_positions.empty()) {return CGAL::Three::Scene_interface::Bbox(0,0,0,0,0,0); }
+
+    const qglviewer::Vec& p_i = *(initial_positions.begin());
+    CGAL::Three::Scene_interface::Bbox bbox(p_i.x, p_i.y, p_i.z, p_i.x, p_i.y, p_i.z);
+
+    for(std::vector<qglviewer::Vec>::iterator it = initial_positions.begin(); it != initial_positions.end(); ++it)
+    {
+      const qglviewer::Vec& p_i = (*it);
+      CGAL::Three::Scene_interface::Bbox bbox_it(p_i.x, p_i.y, p_i.z, p_i.x, p_i.y, p_i.z);
+      bbox = bbox + bbox_it;
+    }
+    return bbox;
+  }
+};
+
+// To hold pressing states together
+struct Mouse_keyboard_state_deformation
+{
+  bool ctrl_pressing;
+  bool shift_pressing;
+  bool left_button_pressing;
+  bool right_button_pressing;
+
+  Mouse_keyboard_state_deformation() 
+    : ctrl_pressing(false), shift_pressing(false), left_button_pressing(false), right_button_pressing(false)
+  { }
+};
+
+typedef std::list<Control_vertices_data> Ctrl_vertices_group_data_list;
+struct Scene_edit_polyhedron_item_priv;
+// This class represents a polyhedron in the OpenGL scene
+class SCENE_EDIT_POLYHEDRON_ITEM_EXPORT Scene_edit_polyhedron_item 
+  : public CGAL::Three::Scene_group_item {
+  Q_OBJECT
+public:  
+  /// Create an Scene_edit_polyhedron_item from a Scene_polyhedron_item.
+  /// The ownership of the polyhedron is moved to the new edit_polyhedron
+  /// item.
+  Scene_edit_polyhedron_item(Scene_polyhedron_item* poly_item, Ui::DeformMesh* ui_widget, QMainWindow* mw);
+  ~Scene_edit_polyhedron_item();
+
+  /// Returns 0, so that one cannot clone an "edit polyhedron" item.
+  Scene_edit_polyhedron_item* clone() const;
+
+  // Function for displaying meta-data of the item
+  QString toolTip() const;
+
+  void setColor(QColor c);
+  void setName(QString n);
+  void setVisible(bool b);
+  void setRenderingMode(RenderingMode m);
+  
+  // Indicate if rendering mode is supported
+  bool supportsRenderingMode(RenderingMode m) const { 
+    return m == Gouraud; 
+  }
+  // Points/Wireframe/Flat/Gouraud OpenGL drawing in a display list
+  void draw() const{}
+  void draw(CGAL::Three::Viewer_interface*) const;
+  void drawEdges(CGAL::Three::Viewer_interface*) const;
+  void draw_bbox(const CGAL::Three::Scene_interface::Bbox&) const;
+  void draw_ROI_and_control_vertices(CGAL::Three::Viewer_interface *viewer) const;
+  void draw_frame_plane(QGLViewer *) const;
+
+  // Get wrapped polyhedron
+  Polyhedron*       polyhedron();
+  const Polyhedron* polyhedron() const;
+
+  /// Returns a Scene_polyhedron_item from the edit polyhedron item, and
+  /// transfer the ownership of the polyhedron to it.
+  /// The item 'this' must be destroy just after a call to this function.
+  Scene_polyhedron_item* to_polyhedron_item();
+
+  // Get dimensions
+  bool isFinite() const { return true; }
+  bool isEmpty() const;
+  void compute_bbox() const;
+  Bbox bbox() const{return Scene_item::bbox();}
+
+  int get_k_ring();
+  void set_k_ring(int v);
+
+  // take mouse events from viewer, main-window does not work
+  // take keyboard events from main-window, which is more stable
+  bool eventFilter(QObject *target, QEvent *event);
+  void update_frame_plane();
+  void ShowAsSphere(bool b);
+
+public Q_SLOTS:
+  void reset_spheres();
+  void updateDeform();
+  void change();
+
+  void invalidateOpenGLBuffers();
+  void selected(const std::set<Polyhedron::Vertex_handle>& m);
+
+  void select(double orig_x,
+              double orig_y,
+              double orig_z,
+              double dir_x,
+              double dir_y,
+              double dir_z);
+
+  void deform(); // deform the mesh
+  void remesh();
+
+protected:
+  friend struct Scene_edit_polyhedron_item_priv;
+  Scene_edit_polyhedron_item_priv* d;
+
+
+public:
+  // Deformation related functions //
+  bool insert_control_vertex(vertex_descriptor v);
+
+  bool insert_roi_vertex(vertex_descriptor v);
+  
+  bool erase_control_vertex(vertex_descriptor v);
+
+  bool erase_roi_vertex(vertex_descriptor v);
+
+  void set_all_vertices_as_roi()
+  {
+    vertex_iterator vb, ve;
+    for(boost::tie(vb, ve) = vertices(*polyhedron()); vb != ve; ++vb)
+    {
+      insert_roi_vertex(*vb);
+    }   
+  }
+
+  void clear_roi();
+
+  void create_ctrl_vertices_group();
+
+  void delete_ctrl_vertices_group(bool create_new = true);
+
+  void prev_ctrl_vertices_group();
+  void next_ctrl_vertices_group();
+  void pivoting_end();
+
+  void pivoting_begin();
+
+  void save_roi(const char* file_name) const;
+  void read_roi(const char* file_name);
+  void overwrite_deform_object();
+
+  void reset_deform_object();
+  struct Is_selected {
+    Deform_mesh* dm;
+    Is_selected(Deform_mesh* dm) : dm(dm) {}
+    bool count(Vertex_handle vh) const {
+      return dm->is_roi_vertex(vh);
+    }
+  };
+
+  boost::optional<std::size_t> get_minimum_isolated_component();
+  struct Select_roi_output {
+    Select_roi_output(Deform_mesh* dm) : dm(dm) { }
+    void operator()(Vertex_handle vh) {
+      dm->insert_roi_vertex(vh);
+    }
+    Deform_mesh* dm;
+  };
+
+  boost::optional<std::size_t> select_isolated_components(std::size_t threshold) ;
+
+protected:
+  // Deformation related functions //
+  void print_message(const QString& /*message*/)
+  {
+    // std::cout << message.toStdString() << std::endl;
+  }
+
+  bool is_there_any_ctrl_vertices_group(Ctrl_vertices_group_data_list::iterator& hgb, Ctrl_vertices_group_data_list::iterator& hge);
+
+  bool is_there_any_ctrl_vertices_group();
+
+  bool is_there_any_ctrl_vertices();
+  void refresh_all_group_centers();
+  bool activate_closest_manipulated_frame(int x, int y);
+
+  bool keyPressEvent(QKeyEvent* e);
+
+  void update_normals();
+
+  double scene_diag() const {
+    const double& xdelta = bbox().xmax() - bbox().xmin();
+    const double& ydelta = bbox().ymax() - bbox().ymin();
+    const double& zdelta = bbox().zmax() - bbox().zmin();
+    const double diag = std::sqrt(xdelta*xdelta +
+      ydelta*ydelta +
+      zdelta*zdelta);
+    return diag * 0.5;
+  }
+
+}; // end class Scene_edit_polyhedron_item
+
+#endif // SCENE_EDIT_POLYHEDRON_ITEM_H
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item_config.h b/3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item_config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item_config.h
rename to 3rdparty/CGAL/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item_config.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Point_dialog_config.h b/3rdparty/CGAL/demo/Polyhedron/Point_dialog_config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Point_dialog_config.h
rename to 3rdparty/CGAL/demo/Polyhedron/Point_dialog_config.h
diff --git a/3rdparty/CGAL/demo/Polyhedron/Polyhedron_3.cpp b/3rdparty/CGAL/demo/Polyhedron/Polyhedron_3.cpp
new file mode 100644
index 0000000..2775bf4
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Polyhedron_3.cpp
@@ -0,0 +1,16 @@
+#include "Polyhedron_demo.h"
+#include <clocale>
+
+/*!
+ * \brief Defines the entry point of the demo.
+ * Creates the application and sets a main window.
+ */
+int main(int argc, char **argv)
+{
+  Polyhedron_demo app(argc, argv,
+                      "Polyhedron_3 demo",
+                      "CGAL Polyhedron Demo");
+  //We set the locale to avoid any trouble with VTK
+  std::setlocale(LC_ALL, "C");
+  return app.try_exec();
+}
diff --git a/3rdparty/CGAL/demo/Polyhedron/Polyhedron_3.qrc b/3rdparty/CGAL/demo/Polyhedron/Polyhedron_3.qrc
new file mode 100644
index 0000000..c53ecca
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Polyhedron_3.qrc
@@ -0,0 +1,50 @@
+<RCC>
+    <qresource prefix="/cgal/icons">
+        <file>resources/cgal_logo.xpm</file>
+        <file>resources/boolean-union.png</file>
+        <file>resources/kernel.png</file>
+        <file>resources/boolean-diff.png</file>
+        <file>resources/boolean-intersection.png</file>
+        <file alias="convex-hull.png">resources/convex-hull.png</file>
+        <file alias="simplification.png">resources/simplification.png</file>
+        <file alias="duplicate">resources/editcopy.png</file>
+        <file alias="check-on.png">resources/check-on.png</file>
+        <file alias="plus">resources/plus.png</file>
+        <file alias="check-off.png">resources/check-off.png</file>
+        <file alias="minus">resources/minus.png</file>
+        <file>resources/back.png</file>
+        <file>resources/front.png</file>
+        <file>resources/top.png</file>
+        <file>resources/bot.png</file>
+        <file>resources/left.png</file>
+        <file>resources/right.png</file>
+        <file>resources/up.png</file>
+        <file>resources/down.png</file>
+    </qresource>
+    <qresource prefix="/cgal/Polyhedron_3">
+        <file alias="about.html">resources/about.html</file>
+        <file>resources/shader_with_light.v</file>
+        <file>resources/shader_with_light.f</file>
+        <file>resources/shader_without_light.f</file>
+        <file>resources/shader_without_light.v</file>
+        <file>resources/shader_with_texture.f</file>
+        <file>resources/shader_with_textured_edges.f</file>
+        <file>resources/shader_with_textured_edges.v</file>
+        <file>resources/shader_with_texture.v</file>
+        <file>resources/shader_instanced.v</file>
+        <file>resources/shader_no_light_no_selection.f</file>
+        <file>resources/shader_c3t3_spheres.v</file>
+        <file>resources/shader_c3t3_edges.v</file>
+        <file>resources/shader_c3t3_edges.f</file>
+        <file>resources/shader_c3t3.v</file>
+        <file>resources/shader_c3t3.f</file>
+        <file>resources/shader_plane_two_faces.f</file>
+        <file>resources/shader_spheres.v</file>
+        <file>resources/general_collapse.png</file>
+        <file>resources/add_facet1.png</file>
+        <file>resources/add_facet2.png</file>
+        <file>resources/euler_center.png</file>
+        <file>resources/euler_facet.png</file>
+        <file>resources/euler_vertex.png</file>
+    </qresource>
+</RCC>
diff --git a/3rdparty/CGAL/demo/Polyhedron/Polyhedron_demo.cpp b/3rdparty/CGAL/demo/Polyhedron/Polyhedron_demo.cpp
new file mode 100644
index 0000000..625dc68
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Polyhedron_demo.cpp
@@ -0,0 +1,126 @@
+#include "Polyhedron_demo.h"
+#include "MainWindow.h"
+#include <QMessageBox>
+#include <CGAL/Qt/resources.h>
+#include <stdexcept>
+
+#include <QCommandLineParser>
+#include <QCommandLineOption>
+
+struct Polyhedron_demo_impl {
+  bool catch_exceptions;
+  QScopedPointer<MainWindow> mainWindow;
+
+  Polyhedron_demo_impl() : catch_exceptions(true) {}
+}; // end struct Polyhedron_demo_impl
+
+Polyhedron_demo::Polyhedron_demo(int& argc, char **argv,
+                                 QString application_name,
+                                 QString main_window_title)
+  : QApplication(argc, argv)
+  , d_ptr_is_initialized(false)
+  , d_ptr(new Polyhedron_demo_impl)
+{
+  d_ptr_is_initialized = true;
+  std::cerr.precision(17);
+  std::cout.precision(17);
+  std::clog.precision(17);
+
+  //for windows
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 3, 0))
+  this->setAttribute(Qt::AA_UseDesktopOpenGL);
+#endif
+
+  // Import resources from libCGAL (Qt5).
+  CGAL_QT_INIT_RESOURCES;
+
+  this->setOrganizationDomain("geometryfactory.com");
+  this->setOrganizationName("GeometryFactory");
+  this->setApplicationName(application_name);
+
+  QCommandLineParser parser;
+  parser.addHelpOption();
+
+  QCommandLineOption use_meta("use-meta",
+                              tr("Use the [Meta] key to move frames, instead of [Tab]."));
+  parser.addOption(use_meta);
+  QCommandLineOption no_try_catch("no-try-catch",
+                                  tr("Do not catch uncaught exceptions."));
+  parser.addOption(no_try_catch);
+#ifdef QT_SCRIPT_LIB
+  QCommandLineOption debug_scripts("debug-scripts",
+                                   tr("Use the scripts debugger."));
+  parser.addOption(debug_scripts);
+#endif
+  QCommandLineOption no_autostart("no-autostart",
+                                  tr("Ignore the autostart.js file, if any."));
+  parser.addOption(no_autostart);
+  parser.addPositionalArgument("files", tr("Files to open"), "[files...]");
+  parser.process(*this);
+
+  d_ptr->mainWindow.reset(new MainWindow);
+  MainWindow& mainWindow = *d_ptr->mainWindow;
+
+  mainWindow.setWindowTitle(main_window_title);
+  mainWindow.show();
+
+  if(parser.isSet(use_meta)) {
+    mainWindow.setAddKeyFrameKeyboardModifiers(::Qt::MetaModifier);
+  }
+  if(parser.isSet(no_try_catch)) {
+    this->do_not_catch_exceptions();
+  }
+#ifdef QT_SCRIPT_LIB
+  if(parser.isSet(debug_scripts)) {
+    mainWindow.enableScriptDebugger();
+  }
+  QFileInfo autostart_js("autostart.js");
+  if(!parser.isSet(no_autostart) && autostart_js.exists()) {
+    mainWindow.loadScript(autostart_js);
+  }
+#endif
+  Q_FOREACH(QString filename, parser.positionalArguments()) {
+    mainWindow.open(filename);
+  }
+
+}
+
+Polyhedron_demo::~Polyhedron_demo() {}
+
+void Polyhedron_demo::do_not_catch_exceptions() {
+  d_ptr->catch_exceptions = false;
+}
+
+bool Polyhedron_demo::notify(QObject* receiver, QEvent* event)
+{
+  if(!d_ptr_is_initialized || !d_ptr->catch_exceptions)
+    return QApplication::notify(receiver, event);
+  else try {
+      return QApplication::notify(receiver, event);
+    } catch (std::exception &e) {
+      // find the mainwindow to spawn an error message
+      Q_FOREACH (QWidget *widget, QApplication::topLevelWidgets()) {
+        if(MainWindow* mw = qobject_cast<MainWindow*>(widget)) {
+          QMessageBox::critical(
+                                mw,
+                                tr("Unhandled exception"),
+                                e.what());
+          break;
+        }
+      }
+      QApplication::restoreOverrideCursor();
+    } catch (...) {
+      qFatal("Unknown exception encountered. Aborting.");
+    }
+  return false;
+}
+
+int Polyhedron_demo::try_exec()
+{
+  // A Qt Script may have closed the main window.
+  // The following loop launch app.exec() only if the main window is visible.
+  if(d_ptr->mainWindow->isVisible()) {
+    return this->exec();
+  }
+  return 0;
+}
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Polyhedron_demo.h b/3rdparty/CGAL/demo/Polyhedron/Polyhedron_demo.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Polyhedron_demo.h
rename to 3rdparty/CGAL/demo/Polyhedron/Polyhedron_demo.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Polyhedron_demo_config.h b/3rdparty/CGAL/demo/Polyhedron/Polyhedron_demo_config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Polyhedron_demo_config.h
rename to 3rdparty/CGAL/demo/Polyhedron/Polyhedron_demo_config.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Polyhedron_demo_detect_sharp_edges.h b/3rdparty/CGAL/demo/Polyhedron/Polyhedron_demo_detect_sharp_edges.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Polyhedron_demo_detect_sharp_edges.h
rename to 3rdparty/CGAL/demo/Polyhedron/Polyhedron_demo_detect_sharp_edges.h
diff --git a/3rdparty/CGAL/demo/Polyhedron/Polyhedron_demo_plugin_helper.cpp b/3rdparty/CGAL/demo/Polyhedron/Polyhedron_demo_plugin_helper.cpp
new file mode 100644
index 0000000..cf9cf1e
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Polyhedron_demo_plugin_helper.cpp
@@ -0,0 +1,96 @@
+#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
+#include <QMainWindow>
+#include <QMetaMethod>
+#include <QDockWidget>
+#include <QAction>
+
+
+void CGAL::Three::Polyhedron_demo_plugin_helper::addDockWidget(QDockWidget* dock_widget)
+{
+  mw->addDockWidget(::Qt::LeftDockWidgetArea, dock_widget);
+
+  QList<QDockWidget*> dockWidgets = mw->findChildren<QDockWidget*>();
+  int counter = 0;
+  Q_FOREACH(QDockWidget* dock, dockWidgets) {
+    if( mw->dockWidgetArea(dock) != ::Qt::LeftDockWidgetArea ||
+        dock == dock_widget )
+    { continue; }
+
+    if(++counter > 1) {
+      mw->tabifyDockWidget(dock, dock_widget);
+      return;
+    }
+  }
+}
+
+
+void CGAL::Three::Polyhedron_demo_plugin_helper::autoConnectActions()
+{
+  QObject* thisObject = dynamic_cast<QObject*>(this);
+  if(!thisObject)
+    return;
+
+  const QMetaObject* metaObject = thisObject->metaObject();
+  QVector<QMetaMethod> methods;
+  QVector<QString> methodsNames;
+  QSet<QString> connected;
+  for(int i = metaObject->methodOffset();
+      i < metaObject->methodCount();
+      ++i)
+  {
+    const int pos = QString(metaObject->method(i).methodSignature()).indexOf('(');
+    methodsNames << QString(metaObject->method(i).methodSignature()).left(pos);
+
+    methods << metaObject->method(i);
+  }
+
+  Q_FOREACH(QAction* action, actions())
+  {
+    bool success = false;
+//     qDebug("Autoconnecting action \"%s\"...",
+//            action->objectName().toUtf8().data());
+    const QMetaObject* action_metaObject = action->metaObject();
+    for(int i = action_metaObject->methodOffset();
+        i < action_metaObject->methodCount(); ++i)
+    {
+      QMetaMethod action_method = action_metaObject->method(i);
+
+      if(action_method.methodType() == QMetaMethod::Signal)
+      {
+        const int pos = QString(action_method.methodSignature()).indexOf('(');
+        QString methodName = QString(action_method.methodSignature()).left(pos);
+
+        QString slotName =
+          QString("on_%1_%2").arg(action->objectName()).arg(methodName);
+//         qDebug() << thisObject->tr("Slot %1 (%2)...").arg(slotName).arg(i);
+        int index = methodsNames.indexOf(slotName);
+        if(index>=0 && !connected.contains(slotName))
+        {
+            const bool ok = QObject::connect(action,
+                             qPrintable(QString("2%1").arg(QString(action_method.methodSignature()))),
+                             thisObject,
+                             qPrintable(QString("1%1").arg(QString(methods[index].methodSignature()))));
+
+          if(!ok)
+          {
+            qDebug() << thisObject->tr("Cannot connect method %1.%2 to slot %3!")
+              .arg(action->objectName())
+              .arg(QString(action_method.methodSignature()))
+              .arg(QString(methods[index].methodSignature()));
+          }
+          else {
+//             qDebug("  ->Connected!");
+            success = true;
+            connected << slotName;
+          }
+        }
+//         else {
+//           qDebug(" nothing found!\n");
+//         }
+      }
+    } // end for each method of action
+    if(!success)
+      qDebug("ERROR: Failed to autoconnect the action \"%s\"!",
+             action->objectName().toUtf8().data());
+  } // end foreach action of actions()
+}
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Polyhedron_type.h b/3rdparty/CGAL/demo/Polyhedron/Polyhedron_type.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Polyhedron_type.h
rename to 3rdparty/CGAL/demo/Polyhedron/Polyhedron_type.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Polyhedron_type_fwd.h b/3rdparty/CGAL/demo/Polyhedron/Polyhedron_type_fwd.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Polyhedron_type_fwd.h
rename to 3rdparty/CGAL/demo/Polyhedron/Polyhedron_type_fwd.h
diff --git a/3rdparty/CGAL/demo/Polyhedron/Preferences.ui b/3rdparty/CGAL/demo/Polyhedron/Preferences.ui
new file mode 100644
index 0000000..59ad7dc
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Preferences.ui
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>PreferencesDialog</class>
+ <widget class="QDialog" name="PreferencesDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>377</width>
+    <height>503</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Preferences</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <widget class="QLabel" name="label">
+     <property name="text">
+      <string>Tick plugins you don't want to load at start up</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QListView" name="listView">
+     <property name="selectionMode">
+      <enum>QAbstractItemView::NoSelection</enum>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>PreferencesDialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>248</x>
+     <y>254</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>PreferencesDialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>316</x>
+     <y>260</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/3rdparty/CGAL/demo/Polyhedron/Scene.cpp b/3rdparty/CGAL/demo/Polyhedron/Scene.cpp
new file mode 100644
index 0000000..332f5db
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Scene.cpp
@@ -0,0 +1,1274 @@
+#include "GlSplat/GlSplat.h"
+
+
+
+#include "config.h"
+#include "Scene.h"
+#include  <CGAL/Three/Scene_item.h>
+#include <CGAL/Three/Scene_print_interface_item.h>
+
+#include <QObject>
+#include <QMetaObject>
+#include <QString>
+#include <QGLWidget>
+#include <QEvent>
+#include <QMouseEvent>
+#include <QPainter>
+#include <QColorDialog>
+#include <QApplication>
+#include <QPointer>
+#include <QList>
+#include <QAbstractProxyModel>
+#include <QMimeData>
+
+GlSplat::SplatRenderer* Scene::ms_splatting = 0;
+int Scene::ms_splattingCounter = 0;
+GlSplat::SplatRenderer* Scene::splatting()
+{
+    assert(ms_splatting!=0 && "A Scene object must be created before requesting the splatting object");
+    return ms_splatting;
+}
+
+Scene::Scene(QObject* parent)
+    : QStandardItemModel(parent),
+      selected_item(-1),
+      item_A(-1),
+      item_B(-1)
+{
+
+    connect(this, SIGNAL(selectionRay(double, double, double,
+                                      double, double, double)),
+            this, SLOT(setSelectionRay(double, double, double,
+                                       double, double, double)));
+    connect(this, SIGNAL(itemAboutToBeDestroyed(CGAL::Three::Scene_item*)),
+            this, SLOT(s_itemAboutToBeDestroyed(CGAL::Three::Scene_item*)));
+    if(ms_splatting==0)
+        ms_splatting  = new GlSplat::SplatRenderer();
+    ms_splattingCounter++;
+    picked = false;
+    gl_init = false;
+
+}
+Scene::Item_id
+Scene::addItem(CGAL::Three::Scene_item* item)
+{
+    Bbox bbox_before = bbox();
+    m_entries.push_back(item);
+    connect(item, SIGNAL(itemChanged()),
+            this, SLOT(itemChanged()));
+    connect(item, SIGNAL(redraw()),
+            this, SLOT(callDraw()));
+    if(item->isFinite()
+            && !item->isEmpty()
+            && bbox_before + item->bbox() != bbox_before
+            )
+    {
+        Q_EMIT updated_bbox();
+    }
+    QList<QStandardItem*> list;
+    for(int i=0; i<5; i++)
+    {
+        list<<new QStandardItem();
+        list.at(i)->setEditable(false);
+    }
+    invisibleRootItem()->appendRow(list);
+    for(int i=0; i<5; i++){
+        index_map[list.at(i)->index()] = m_entries.size() -1;
+    }
+    Q_EMIT updated();
+    Item_id id = m_entries.size() - 1;
+    Q_EMIT newItem(id);
+    CGAL::Three::Scene_group_item* group =
+            qobject_cast<CGAL::Three::Scene_group_item*>(item);
+    if(group)
+        addGroup(group);
+    return id;
+}
+
+CGAL::Three::Scene_item*
+Scene::replaceItem(Scene::Item_id index, CGAL::Three::Scene_item* item, bool emit_item_about_to_be_destroyed)
+{
+    if(index < 0 || index >= m_entries.size())
+        return 0;
+
+    if(emit_item_about_to_be_destroyed) {
+    Q_EMIT itemAboutToBeDestroyed(m_entries[index]);
+    }
+
+    connect(item, SIGNAL(itemChanged()),
+            this, SLOT(itemChanged()));
+    CGAL::Three::Scene_group_item* group =
+            qobject_cast<CGAL::Three::Scene_group_item*>(m_entries[index]);
+    if(group)
+    {
+      QList<int> children;
+      Q_FOREACH(CGAL::Three::Scene_item* child, group->getChildren())
+      {
+        group->unlockChild(child);
+        children << item_id(child);
+      }
+      erase(children);
+    }
+    std::swap(m_entries[index], item);
+    if ( item->isFinite() && !item->isEmpty() &&
+         m_entries[index]->isFinite() && !m_entries[index]->isEmpty() &&
+         item->bbox()!=m_entries[index]->bbox() )
+    {
+    Q_EMIT updated_bbox();
+    }
+  Q_EMIT updated();
+    group =
+            qobject_cast<CGAL::Three::Scene_group_item*>(m_entries[index]);
+    if(group)
+    {
+        addGroup(group);
+    }
+    itemChanged(index);
+    Q_EMIT restoreCollapsedState();
+    redraw_model();
+    Q_EMIT selectionChanged(index);
+    return item;
+}
+
+Scene::Item_id
+Scene::erase(Scene::Item_id index)
+{
+  CGAL::Three::Scene_item* item = m_entries[index];
+  if(item->parentGroup()
+     && item->parentGroup()->isChildLocked(item))
+    return -1;
+  //clears the Scene_view
+    clear();
+    index_map.clear();
+    if(index < 0 || index >= m_entries.size())
+        return -1;
+  if(item->parentGroup())
+    item->parentGroup()->removeChild(item);
+
+  //removes the item from all groups that contain it
+  Q_EMIT itemAboutToBeDestroyed(item);
+    item->deleteLater();
+    m_entries.removeAll(item);
+    selected_item = -1;
+    //re-creates the Scene_view
+    Q_FOREACH(Scene_item* item, m_entries)
+    {
+        organize_items(item, invisibleRootItem(), 0);
+    }
+    QStandardItemModel::beginResetModel();
+    Q_EMIT updated();
+    QStandardItemModel::endResetModel();
+    Q_EMIT restoreCollapsedState();
+    if(--index >= 0)
+      return index;
+    if(!m_entries.isEmpty())
+      return 0;
+    return -1;
+
+}
+
+int
+Scene::erase(QList<int> indices)
+{
+  if(indices.empty())
+    return -1;
+  QList<CGAL::Three::Scene_item*> to_be_removed;
+  int max_index = -1;
+  Q_FOREACH(int index, indices) {
+    if(index < 0 || index >= m_entries.size())
+      continue;
+
+    max_index = (std::max)(max_index, index);
+    CGAL::Three::Scene_item* item = m_entries[index];
+    if(item->parentGroup()
+       && item->parentGroup()->isChildLocked(item))
+      if(!indices.contains(item_id(item->parentGroup())))
+        continue;
+    if(!to_be_removed.contains(item))
+      to_be_removed.push_back(item);
+  }
+
+  Q_FOREACH(Scene_item* item, to_be_removed) {
+      if(item->parentGroup())
+        item->parentGroup()->removeChild(item);
+    Q_EMIT itemAboutToBeDestroyed(item);
+    item->deleteLater();
+    m_entries.removeAll(item);
+  }
+  clear();
+  index_map.clear();
+  selected_item = -1;
+  Q_FOREACH(Scene_item* item, m_entries)
+  {
+    organize_items(item, invisibleRootItem(), 0);
+  }
+  QStandardItemModel::beginResetModel();
+  Q_EMIT updated();
+  QStandardItemModel::endResetModel();
+  Q_EMIT restoreCollapsedState();
+
+  int index = max_index + 1 - indices.size();
+  if(index >= m_entries.size()) {
+    index = m_entries.size() - 1;
+  }
+  if(index >= 0)
+    return index;
+  if(!m_entries.isEmpty())
+    return 0;
+  return -1;
+
+}
+
+void Scene::remove_item_from_groups(Scene_item* item)
+{
+    CGAL::Three::Scene_group_item* group = item->parentGroup();
+    if(group)
+    {
+        group->removeChild(item);
+    }
+}
+Scene::~Scene()
+{
+    Q_FOREACH(CGAL::Three::Scene_item* item_ptr, m_entries)
+    {
+         item_ptr->deleteLater();
+    }
+    m_entries.clear();
+
+    if((--ms_splattingCounter)==0)
+        delete ms_splatting;
+}
+
+CGAL::Three::Scene_item*
+Scene::item(Item_id index) const
+{
+    return m_entries.value(index); // QList::value checks bounds
+}
+
+Scene::Item_id 
+Scene::item_id(CGAL::Three::Scene_item* scene_item) const
+{
+    return m_entries.indexOf(scene_item);
+}
+
+int
+Scene::numberOfEntries() const
+{
+    return m_entries.size();
+}
+
+// Duplicate a scene item.
+// Return the ID of the new item (-1 on error).
+Scene::Item_id
+Scene::duplicate(Item_id index)
+{
+    if(index < 0 || index >= m_entries.size())
+        return -1;
+
+    const CGAL::Three::Scene_item* item = m_entries[index];
+    CGAL::Three::Scene_item* new_item = item->clone();
+    if(new_item) {
+        new_item->setName(tr("%1 (copy)").arg(item->name()));
+        new_item->setColor(item->color());
+        new_item->setVisible(item->visible());
+        addItem(new_item);
+        return m_entries.size() - 1;
+    }
+    else
+        return -1;
+}
+
+void Scene::initializeGL()
+{
+    ms_splatting->init();
+
+    //Setting the light options
+
+    // Create light components
+    GLfloat ambientLight[] = { 0.4f, 0.4f, 0.4f, 1.0f };
+    GLfloat diffuseLight[] = { 1.0f, 1.0f, 1.0, 1.0f };
+    GLfloat specularLight[] = { 0.0f, 0.0f, 0.0f, 1.0f };
+    GLfloat position[] = { 0.0f, 0.0f, 1.0f, 1.0f };
+
+    // Assign created components to GL_LIGHT0
+    glLightfv(GL_LIGHT0, GL_AMBIENT, ambientLight);
+    glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuseLight);
+    glLightfv(GL_LIGHT0, GL_SPECULAR, specularLight);
+    glLightfv(GL_LIGHT0, GL_POSITION, position);
+
+    gl_init = true;
+}
+
+void Scene::s_itemAboutToBeDestroyed(CGAL::Three::Scene_item *rmv_itm)
+{
+ Q_FOREACH(CGAL::Three::Scene_item* item, m_entries)
+ {
+   if(item == rmv_itm)
+     item->itemAboutToBeDestroyed(item);
+ }
+}
+bool
+Scene::keyPressEvent(QKeyEvent* e){
+    bool res=false;
+    for (QList<int>::iterator it=selected_items_list.begin(),endit=selected_items_list.end();
+         it!=endit;++it)
+    {
+        CGAL::Three::Scene_item* item=m_entries[*it];
+        res |= item->keyPressEvent(e);
+    }
+    return res;
+}
+
+void
+Scene::draw(CGAL::Three::Viewer_interface* viewer)
+{
+    draw_aux(false, viewer);
+}
+void
+Scene::drawWithNames(CGAL::Three::Viewer_interface* viewer)
+{
+    draw_aux(true, viewer);
+}
+
+bool item_should_be_skipped_in_draw(Scene_item* item) {
+  if(!item->visible()) return true;
+  if(item->has_group == 0) return false;
+  Scene_group_item* group = item->parentGroup();
+  while(group != 0) {
+    if(!group->visible()) return false;
+    group = group->parentGroup();
+  }
+  return true;
+}
+
+void 
+Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer)
+{
+    QMap<float, int> picked_item_IDs;
+    if(with_names)
+      glEnable(GL_DEPTH_TEST);
+    if(!ms_splatting->viewer_is_set)
+        ms_splatting->setViewer(viewer);
+    if(!gl_init)
+        initializeGL();
+    // Flat/Gouraud OpenGL drawing
+    for(int index = 0; index < m_entries.size(); ++index)
+    {
+        CGAL::Three::Scene_item& item = *m_entries[index];
+        if(index == selected_item || selected_items_list.contains(index))
+        {
+            item.selection_changed(true);
+        }
+        else
+
+        {
+            item.selection_changed(false);
+        }
+        if(!with_names && item_should_be_skipped_in_draw(&item)) continue;
+        if(item.visible())
+        {
+            if(item.renderingMode() == Flat || item.renderingMode() == FlatPlusEdges || item.renderingMode() == Gouraud)
+            {
+                if(with_names) {
+                    glClearDepth(1.0);
+                    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+                }
+                viewer->glEnable(GL_LIGHTING);
+                viewer->glPointSize(2.f);
+                viewer->glLineWidth(1.0f);
+                if(item.renderingMode() == Gouraud)
+                    viewer->glShadeModel(GL_SMOOTH);
+                else
+                    viewer->glShadeModel(GL_FLAT);
+                if(viewer)
+                    item.draw(viewer);
+                else
+                    item.draw();
+
+                if(with_names) {
+
+                    //    read depth buffer at pick location;
+                    float depth = 1.0;
+                    glReadPixels(picked_pixel.x(),viewer->camera()->screenHeight()-1-picked_pixel.y(),1,1,GL_DEPTH_COMPONENT, GL_FLOAT, &depth);
+                    if (depth != 1.0)
+                    {
+                        //add object to list of picked objects;
+                        picked_item_IDs[depth] = index;
+                    }
+                }
+            }
+        }
+    }
+    glDepthFunc(GL_LEQUAL);
+    // Wireframe OpenGL drawing
+    for(int index = 0; index < m_entries.size(); ++index)
+    {
+        CGAL::Three::Scene_item& item = *m_entries[index];
+        if(index == selected_item || selected_items_list.contains(index))
+        {
+            item.selection_changed(true);
+        }
+        else
+        {
+            item.selection_changed(false);
+        }
+
+        if(!with_names && item_should_be_skipped_in_draw(&item)) continue;
+        if(item.visible())
+        {
+            if((item.renderingMode() == Wireframe || item.renderingMode() == PointsPlusNormals )
+                    && with_names)
+            {
+                glClearDepth(1.0);
+                glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+            }
+            if((!with_names && item.renderingMode() == FlatPlusEdges )
+                    || item.renderingMode() == Wireframe)
+            {
+                viewer->glDisable(GL_LIGHTING);
+                viewer->glPointSize(2.f);
+                viewer->glLineWidth(1.0f);
+
+                if(viewer)
+                    item.drawEdges(viewer);
+                else
+                    item.drawEdges();
+            }
+            else{
+                if( item.renderingMode() == PointsPlusNormals ){
+                    viewer->glDisable(GL_LIGHTING);
+                    viewer->glPointSize(2.f);
+                    viewer->glLineWidth(1.0f);
+                    if(index == selected_item || selected_items_list.contains(index))
+                    {
+
+                        item.selection_changed(true);
+                    }
+                    else
+                    {
+
+                        item.selection_changed(false);
+                    }
+                    if(viewer)
+                        item.drawEdges(viewer);
+                    else
+                        item.drawEdges();
+                }
+            }
+            if((item.renderingMode() == Wireframe || item.renderingMode() == PointsPlusNormals )
+                    && with_names)
+            {
+
+                //    read depth buffer at pick location;
+                float depth = 1.0;
+                glReadPixels(picked_pixel.x(),viewer->camera()->screenHeight()-1-picked_pixel.y(),1,1,GL_DEPTH_COMPONENT, GL_FLOAT, &depth);
+                if (depth != 1.0)
+                {
+                    //add object to list of picked objects;
+                    picked_item_IDs[depth] = index;
+                }
+            }
+        }
+    }
+    // Points OpenGL drawing
+    for(int index = 0; index < m_entries.size(); ++index)
+    {
+        CGAL::Three::Scene_item& item = *m_entries[index];
+        if(!with_names && item_should_be_skipped_in_draw(&item)) continue;
+        if(item.visible())
+        {
+            if(item.renderingMode() == Points && with_names) {
+                glClearDepth(1.0);
+                glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+            }
+            if(item.renderingMode() == Points  ||
+                    (!with_names && item.renderingMode() == PointsPlusNormals))
+            {
+                viewer->glDisable(GL_LIGHTING);
+                viewer->glPointSize(2.0f);
+                viewer->glLineWidth(1.0f);
+
+                if(viewer)
+                    item.drawPoints(viewer);
+                else
+                    item.drawPoints();
+            }
+            if(item.renderingMode() == Points && with_names) {
+                //    read depth buffer at pick location;
+                float depth = 1.0;
+                glReadPixels(picked_pixel.x(),viewer->camera()->screenHeight()-1-picked_pixel.y(),1,1,GL_DEPTH_COMPONENT, GL_FLOAT, &depth);
+                if (depth != 1.0)
+                {
+                    //add object to list of picked objects;
+                    picked_item_IDs[depth] = index;
+                }
+            }
+
+            if(!with_names)
+            {
+                glDepthFunc(GL_LESS);
+                // Splatting
+                if(!with_names && ms_splatting->isSupported())
+                {
+                    ms_splatting->beginVisibilityPass();
+                    for(int index = 0; index < m_entries.size(); ++index)
+                    {
+                        CGAL::Three::Scene_item& item = *m_entries[index];
+                        if(!with_names && item_should_be_skipped_in_draw(&item)) continue;
+                        if(item.visible() && item.renderingMode() == Splatting)
+                        {
+
+                          if(viewer)
+                          {
+                             item.drawSplats(viewer);
+                          }
+                          else
+                              item.drawSplats();
+                        }
+
+                    }
+                    ms_splatting->beginAttributePass();
+                    for(int index = 0; index < m_entries.size(); ++index)
+                    {  CGAL::Three::Scene_item& item = *m_entries[index];
+                        if(item.visible() && item.renderingMode() == Splatting)
+                        {
+                            viewer->glColor4d(item.color().redF(), item.color().greenF(), item.color().blueF(), item.color().alphaF());
+                            if(viewer)
+                                item.drawSplats(viewer);
+                            else
+                                item.drawSplats();
+                        }
+                    }
+                    ms_splatting->finalize();
+                }
+                else
+                    item.drawSplats();
+            }
+        }
+    }
+    if(with_names)
+    {
+        QList<float> depths = picked_item_IDs.keys();
+        if(!depths.isEmpty())
+        {
+            qSort(depths);
+            int id = picked_item_IDs[depths.first()];
+            setSelectedItemIndex(id);
+            viewer->setSelectedName(id);
+
+        }
+    }
+    if(with_names)
+        picked = true;
+    else
+        picked = false;
+    //scrolls the sceneView to the selected item's line.
+    if(picked)
+    {
+        Q_EMIT(itemPicked(index_map.key(mainSelectionIndex())));
+    }
+    Q_EMIT drawFinished();
+}
+
+// workaround for Qt-4.2 (see above)
+#undef lighter
+QVariant
+Scene::data(const QModelIndex &index, int role) const
+{
+    if (!index.isValid())
+    {
+        return QVariant();
+    }
+
+    int id = index_map[index];
+    if(id < 0 || id >= m_entries.size())
+        return QVariant();
+    if(role == ::Qt::ToolTipRole)
+    {
+        return m_entries[id]->toolTip();
+    }
+    switch(index.column())
+    {
+    case ColorColumn:
+        if(role == ::Qt::DisplayRole || role == ::Qt::EditRole)
+            return m_entries.value(id)->color();
+        else if(role == ::Qt::DecorationRole)
+            return m_entries.value(id)->color();
+        break;
+    case NameColumn:
+        if(role == ::Qt::DisplayRole || role == ::Qt::EditRole)
+            return m_entries.value(id)->name();
+        if(role == ::Qt::FontRole)
+            return m_entries.value(id)->font();
+        break;
+    case RenderingModeColumn:
+        if(role == ::Qt::DisplayRole) {
+            return m_entries.value(id)->renderingModeName();
+        }
+        else if(role == ::Qt::EditRole) {
+            return static_cast<int>(m_entries.value(id)->renderingMode());
+        }
+        else if(role == ::Qt::TextAlignmentRole) {
+            return ::Qt::AlignCenter;
+        }
+        break;
+    case ABColumn:
+        if(role == ::Qt::DisplayRole) {
+            if(id == item_A)
+                return "A";
+            if(id == item_B)
+                return "B";
+        }
+        else if(role == ::Qt::TextAlignmentRole) {
+            return ::Qt::AlignCenter;
+        }
+        break;
+    case VisibleColumn:
+        if(role == ::Qt::DisplayRole || role == ::Qt::EditRole)
+            return m_entries.value(id)->visible();
+        break;
+    default:
+        return QVariant();
+    }
+    return QVariant();
+}
+
+QVariant
+Scene::headerData ( int section, ::Qt::Orientation orientation, int role ) const
+{
+    if(orientation == ::Qt::Horizontal)  {
+        if (role == ::Qt::DisplayRole)
+        {
+            switch(section)
+            {
+            case NameColumn:
+                return tr("Name");
+                break;
+            case ColorColumn:
+                return tr("Color");
+                break;
+            case RenderingModeColumn:
+                return tr("Mode");
+            case ABColumn:
+                return tr("A/B");
+                break;
+            case VisibleColumn:
+                return tr("View");
+                break;
+            default:
+                return QVariant();
+            }
+        }
+        else if(role == ::Qt::ToolTipRole) {
+            if(section == RenderingModeColumn) {
+                return tr("Rendering mode (points/wireframe/flat/flat+edges/Gouraud)");
+            }
+            else if(section == ABColumn) {
+                return tr("Selection A/Selection B");
+            }
+        }
+    }
+    return QStandardItemModel::headerData(section, orientation, role);
+}
+
+Qt::ItemFlags
+Scene::flags ( const QModelIndex & index ) const
+{
+    if (index.isValid() && index.column() == NameColumn) {
+        return QStandardItemModel::flags(index) | ::Qt::ItemIsEditable;
+    }
+    else {
+        return QStandardItemModel::flags(index);
+    }
+}
+
+bool
+Scene::setData(const QModelIndex &index,
+               const QVariant &value,
+               int role)
+{
+
+    if( role != ::Qt::EditRole || !index.isValid() )
+        return false;
+
+    int id = index_map[index];
+    if(id < 0 || id >= m_entries.size()){
+        return false;
+    }
+
+    CGAL::Three::Scene_item* item = m_entries[id];
+
+    if(!item) return false;
+    switch(index.column())
+    {
+    case NameColumn:
+        item->setName(value.toString());
+    Q_EMIT dataChanged(index, index);
+        return true;
+        break;
+    case ColorColumn:
+        item->setColor(value.value<QColor>());
+    Q_EMIT dataChanged(index, index);
+        return true;
+        break;
+    case RenderingModeColumn:
+    {
+        RenderingMode rendering_mode = static_cast<RenderingMode>(value.toInt());
+        // Find next supported rendering mode
+        while ( ! item->supportsRenderingMode(rendering_mode)
+      //          || (rendering_mode==Splatting && !Scene::splatting()->isSupported())
+                )
+        {
+            rendering_mode = static_cast<RenderingMode>( (rendering_mode+1) % NumberOfRenderingMode );
+        }
+        item->setRenderingMode(rendering_mode);
+        QModelIndex nindex = createIndex(m_entries.size()-1,RenderingModeColumn+1);
+    Q_EMIT dataChanged(index, nindex);
+        return true;
+        break;
+    }
+    case VisibleColumn:
+        item->setVisible(value.toBool());
+    Q_EMIT dataChanged(index, createIndex(m_entries.size()-1,VisibleColumn+1));
+        return true;
+    default:
+        return false;
+    }
+    return false;
+}
+
+bool Scene::dropMimeData(const QMimeData * /*data*/,
+                         Qt::DropAction /*action*/,
+                         int /*row*/,
+                         int /*column*/,
+                         const QModelIndex &parent)
+{
+    //gets the moving items
+    QList<Scene_item*> items;
+    QList<int> groups_children;
+
+    //get IDs of all children of selected groups
+    Q_FOREACH(int i, selected_items_list)
+    {
+      CGAL::Three::Scene_group_item* group =
+          qobject_cast<CGAL::Three::Scene_group_item*>(item(i));
+      if(group)
+        Q_FOREACH(Scene_item* child, group->getChildren())
+          groups_children << item_id(child);
+    }
+    // Insure that children of selected groups will not be added twice
+    Q_FOREACH(int i, selected_items_list)
+    {
+      if(!groups_children.contains(i))
+      {
+        items << item(i);
+      }
+    }
+    //Gets the group at the drop position
+    CGAL::Three::Scene_group_item* group = NULL;
+    if(parent.isValid())
+        group = qobject_cast<CGAL::Three::Scene_group_item*>(this->item(index_map[parent]));
+    bool one_contained = false;
+    if(group)
+    {
+      Q_FOREACH(int id, selected_items_list)
+        if(group->getChildren().contains(item(id)))
+        {
+          one_contained = true;
+          break;
+
+        }
+    }
+    //if the drop item is not a group_item or if it already contains the item, then the drop action must be ignored
+    if(!group ||one_contained)
+    {
+      //unless the drop zone is empty, which means the item should be removed from all groups.
+      if(!parent.isValid())
+      {
+        Q_FOREACH(Scene_item* item, items)
+        {
+          if(item->parentGroup())
+          {
+            item->parentGroup()->removeChild(item);
+          }
+        }
+        redraw_model();
+        return true;
+      }
+      return false;
+    }
+    Q_FOREACH(Scene_item* item, items)
+      changeGroup(item, group);
+    redraw_model();
+    return true;
+}
+
+void Scene::moveRowUp()
+{
+    Scene_item* selected_item = item(mainSelectionIndex());
+    if(index_map.key(mainSelectionIndex()).row() > 0)
+    {
+        if(item(mainSelectionIndex())->has_group >0)
+        {
+            Scene_group_item* group = selected_item->parentGroup();
+            if(group)
+            {
+                int id = group->getChildren().indexOf(selected_item);
+                group->moveUp(id);
+            }
+        }
+        else
+        {
+            //if not in group
+            QModelIndex baseId = index_map.key(mainSelectionIndex());
+            int newId = index_map.value(index(baseId.row()-1, baseId.column(),baseId.parent())) ;
+            m_entries.move(mainSelectionIndex(), newId);
+        }
+        redraw_model();
+        setSelectedItem(m_entries.indexOf(selected_item));
+    }
+}
+void Scene::moveRowDown()
+{
+    Scene_item* selected_item = item(mainSelectionIndex());
+    if(index_map.key(mainSelectionIndex()).row() < rowCount(index_map.key(mainSelectionIndex()).parent())-1)
+    {
+        if(item(mainSelectionIndex())->has_group >0)
+        {
+            Scene_group_item* group = selected_item->parentGroup();
+            if(group)
+            {
+                int id = group->getChildren().indexOf(selected_item);
+                group->moveDown(id);
+            }
+        }
+        else
+        {
+            //if not in group
+            QModelIndex baseId = index_map.key(mainSelectionIndex());
+            int newId = index_map.value(index(baseId.row()+1, baseId.column(),baseId.parent())) ;
+            m_entries.move(mainSelectionIndex(), newId);
+        }
+        redraw_model();
+        setSelectedItem(m_entries.indexOf(selected_item));
+    }
+}
+Scene::Item_id Scene::mainSelectionIndex() const {
+    return selected_item;
+}
+
+QList<int> Scene::selectionIndices() const {
+    return selected_items_list;
+}
+
+int Scene::selectionAindex() const {
+    return item_A;
+}
+
+int Scene::selectionBindex() const {
+    return item_B;
+}
+
+QItemSelection Scene::createSelection(int i)
+{
+
+    return QItemSelection(index_map.keys(i).at(0),
+                          index_map.keys(i).at(4));
+}
+
+QItemSelection Scene::createSelectionAll()
+{
+    return QItemSelection(index_map.keys(0).at(0),
+                          index_map.keys(m_entries.size() - 1).at(4));
+}
+
+void Scene::itemChanged()
+{
+    CGAL::Three::Scene_item* item = qobject_cast<CGAL::Three::Scene_item*>(sender());
+    if(item)
+        itemChanged(item);
+}
+
+void Scene::itemChanged(Item_id i)
+{
+    if(i < 0 || i >= m_entries.size())
+        return;
+
+  Q_EMIT dataChanged(this->createIndex(i, 0),
+                     this->createIndex(i, LastColumn));
+  //  Q_EMIT restoreCollapsedState();
+}
+
+void Scene::itemChanged(CGAL::Three::Scene_item* /* item */)
+{
+  Q_EMIT dataChanged(this->createIndex(0, 0),
+                     this->createIndex(m_entries.size() - 1, LastColumn));
+}
+
+bool SceneDelegate::editorEvent(QEvent *event, QAbstractItemModel *model,
+                                const QStyleOptionViewItem &option,
+                                const QModelIndex &index)
+{
+    QAbstractProxyModel* proxyModel = dynamic_cast<QAbstractProxyModel*>(model);
+    Q_ASSERT(proxyModel);
+    Scene *scene = dynamic_cast<Scene*>(proxyModel->sourceModel());
+    Q_ASSERT(scene);
+    int id = scene->index_map[proxyModel->mapToSource(index)];
+    switch(index.column()) {
+    case Scene::VisibleColumn:
+        if (event->type() == QEvent::MouseButtonPress) {
+            QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
+            if(mouseEvent->button() == ::Qt::LeftButton) {
+                int x = mouseEvent->pos().x() - option.rect.x();
+                if(x >= (option.rect.width() - size)/2 &&
+                        x <= (option.rect.width() + size)/2) {
+                    model->setData(index, !model->data(index).toBool());
+                }
+            }
+            return false; //so that the selection can change
+        }
+        return true;
+        break;
+    case Scene::ColorColumn:
+        if (event->type() == QEvent::MouseButtonPress) {
+            QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
+            if(mouseEvent->button() == ::Qt::LeftButton) {
+                QColor color =
+                        QColorDialog::getColor(model->data(index).value<QColor>(),
+                                               0/*,
+                                                                                                                                 tr("Select color"),
+                                                                                                                                 QColorDialog::ShowAlphaChannel*/);
+                if (color.isValid()) {
+                    model->setData(index, color );
+                }
+            }
+        }
+        else if(event->type() == QEvent::MouseButtonDblClick) {
+            return true; // block double-click
+        }
+        return false;
+        break;
+    case Scene::RenderingModeColumn:
+        if (event->type() == QEvent::MouseButtonPress) {
+            QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
+            if(mouseEvent->button() == ::Qt::LeftButton) {
+                // Switch rendering mode
+                /*RenderingMode*/int rendering_mode = model->data(index, ::Qt::EditRole).toInt();
+                rendering_mode = (rendering_mode+1) % NumberOfRenderingMode;
+                model->setData(index, rendering_mode);
+            }
+        }
+        else if(event->type() == QEvent::MouseButtonDblClick) {
+            return true; // block double-click
+        }
+        return false;
+        break;
+    case Scene::ABColumn:
+        if (event->type() == QEvent::MouseButtonPress) {
+            if(id == scene->item_B) {
+                scene->item_A = id;
+                scene->item_B = -1;
+            }
+            else if(id == scene->item_A) {
+                scene->item_B = id;
+                scene->item_A = -1;
+            }
+            else if(scene->item_A == -1) {
+                scene->item_A = id;
+            }
+            else {
+                scene->item_B = id;
+            }
+            scene->dataChanged(scene->createIndex(0, Scene::ABColumn),
+                               scene->createIndex(scene->rowCount() - 1, Scene::ABColumn));
+        }
+        return false;
+        break;
+    default:
+        return QItemDelegate::editorEvent(event, model, option, index);
+    }
+}
+
+void SceneDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
+                          const QModelIndex &index) const
+{
+    QModelIndex test = proxy->mapToSource(index);
+    if (index.column() != Scene::VisibleColumn) {
+        QItemDelegate::paint(painter, option, index);
+    } else {
+        const QAbstractItemModel *model = index.model();
+
+        QPalette::ColorGroup cg = (option.state & QStyle::State_Enabled) ?
+                    (option.state & QStyle::State_Active) ? QPalette::Normal : QPalette::Inactive : QPalette::Disabled;
+
+        if (option.state & QStyle::State_Selected)
+            painter->fillRect(option.rect, option.palette.color(cg, QPalette::Highlight));
+        bool checked = model->data(index, ::Qt::DisplayRole).toBool();
+        int width = option.rect.width();
+        int height = option.rect.height();
+        size = (std::min)(width, height);
+        int x = option.rect.x() + (option.rect.width() / 2) - (size / 2);;
+        int y = option.rect.y() + (option.rect.height() / 2) - (size / 2);
+        if(test.row()>=0 && test.row()<scene->m_entries.size()){
+
+            if(checked) {
+                painter->drawPixmap(x, y, checkOnPixmap.scaled(QSize(size, size),
+                                                               ::Qt::KeepAspectRatio,
+                                                               ::Qt::SmoothTransformation));
+            }
+            else {
+                painter->drawPixmap(x, y, checkOffPixmap.scaled(QSize(size, size),
+                                                                ::Qt::KeepAspectRatio,
+                                                                ::Qt::SmoothTransformation));
+            }
+        }
+        drawFocus(painter, option, option.rect); // since we draw the grid ourselves
+    }
+}
+
+void Scene::setItemVisible(int index, bool b)
+{
+    if( index < 0 || index >= m_entries.size() )
+        return;
+    m_entries[index]->setVisible(b);
+  Q_EMIT dataChanged(this->createIndex(index, VisibleColumn),
+                     this->createIndex(index, VisibleColumn));
+}
+
+void Scene::setSelectionRay(double orig_x,
+                            double orig_y,
+                            double orig_z,
+                            double dir_x,
+                            double dir_y,
+                            double dir_z)
+{
+    CGAL::Three::Scene_item* item = this->item(selected_item);
+    if(item) item->select(orig_x,
+                          orig_y,
+                          orig_z,
+                          dir_x,
+                          dir_y,
+                          dir_z);
+}
+
+void Scene::setItemA(int i)
+{
+    item_A = i;
+    if(item_A == item_B)
+    {
+        item_B = -1;
+    }
+  Q_EMIT dataChanged(this->createIndex(0, ABColumn),
+                     this->createIndex(m_entries.size()-1, ABColumn));
+}
+
+void Scene::setItemB(int i)
+{
+    item_B = i;
+    if(item_A == item_B)
+    {
+        item_A = -1;
+    }
+  Q_EMIT updated();
+  Q_EMIT dataChanged(this->createIndex(0, ABColumn),
+                     this->createIndex(m_entries.size()-1, ABColumn));
+}
+
+Scene::Bbox Scene::bbox() const
+{
+    if(m_entries.empty())
+        return Bbox(0,0,0,0,0,0);
+
+    bool bbox_initialized = false;
+    Bbox bbox = Bbox(0,0,0,0,0,0);
+    Q_FOREACH(CGAL::Three::Scene_item* item, m_entries)
+    {
+        if(item->isFinite() && !item->isEmpty()) {
+            if(bbox_initialized) {
+
+                bbox = bbox + item->bbox();
+            }
+            else {
+                bbox = item->bbox();
+                bbox_initialized = true;
+
+            }
+        }
+
+    }
+    return bbox;
+}
+
+QList<Scene_item*> Scene::item_entries() const
+{
+    return m_entries;
+}
+void Scene::redraw_model()
+{
+    //makes the hierarchy in the tree
+    //clears the model
+    clear();
+    index_map.clear();
+    //fills the model
+    Q_FOREACH(Scene_item* item, m_entries)
+    {
+        organize_items(item, invisibleRootItem(), 0);
+    }
+    Q_EMIT restoreCollapsedState();
+}
+void Scene::changeGroup(Scene_item *item, CGAL::Three::Scene_group_item *target_group)
+{
+    //remove item from the containing group if any
+    if(item->parentGroup())
+    {
+      if(item->parentGroup()->isChildLocked(item))
+        return;
+      item->parentGroup()->removeChild(item);
+    }
+    //add the item to the target group
+    target_group->addChild(item);
+    item->moveToGroup(target_group);
+    redraw_model();
+    Q_EMIT updated();
+}
+
+float Scene::get_bbox_length() const
+{
+    return bbox().ymax()-bbox().ymin();
+}
+
+void Scene::printPrimitiveId(QPoint point, CGAL::Three::Viewer_interface* viewer)
+{
+  Scene_item *it = item(mainSelectionIndex());
+  if(it)
+  {
+    //Only call printPrimitiveId if the item is a Scene_print_interface_item
+    Scene_print_interface_item* item= dynamic_cast<Scene_print_interface_item*>(it);
+    if(item)
+      item->printPrimitiveId(point, viewer);
+  }
+}
+void Scene::printPrimitiveIds(CGAL::Three::Viewer_interface* viewer)
+{
+  Scene_item *it = item(mainSelectionIndex());
+  if(it)
+  {
+    //Only call printPrimitiveIds if the item is a Scene_print_interface_item
+    Scene_print_interface_item* item= dynamic_cast<Scene_print_interface_item*>(it);
+    if(item)
+      item->printPrimitiveIds(viewer);
+  }
+}
+bool Scene::testDisplayId(double x, double y, double z, CGAL::Three::Viewer_interface* viewer)
+{
+    CGAL::Three::Scene_item *i = item(mainSelectionIndex());
+    if(i && i->visible())
+    {
+        bool res = i->testDisplayId(x,y,z, viewer);
+        return res;
+    }
+    else
+      return false;
+}
+#include "Scene_find_items.h"
+
+void Scene::organize_items(Scene_item* item, QStandardItem* root, int loop)
+{
+    if(item->has_group <= loop)
+    {
+        QList<QStandardItem*> list;
+        for(int i=0; i<5; i++)
+        {
+            list<<new QStandardItem();
+            list.at(i)->setEditable(false);
+
+        }
+        root->appendRow(list);
+        for(int i=0; i<5; i++){
+            index_map[list.at(i)->index()] = m_entries.indexOf(item);
+        }
+        CGAL::Three::Scene_group_item* group =
+                qobject_cast<CGAL::Three::Scene_group_item*>(item);
+        if(group)
+        {
+            Q_FOREACH(Scene_item*child, group->getChildren())
+            {
+                organize_items(child, list.first(), loop+1);
+            }
+        }
+    }
+}
+
+void Scene::setExpanded(QModelIndex id)
+{
+    CGAL::Three::Scene_group_item* group =
+            qobject_cast<CGAL::Three::Scene_group_item*>(item(getIdFromModelIndex(id)));
+    if(group)
+    {
+        group->setExpanded(true);
+    }
+}
+void Scene::setCollapsed(QModelIndex id)
+{
+    CGAL::Three::Scene_group_item* group =
+            qobject_cast<CGAL::Three::Scene_group_item*>(item(getIdFromModelIndex(id)));
+    if(group)
+    {
+        group->setExpanded(false);
+    }
+}
+
+int Scene::getIdFromModelIndex(QModelIndex modelId)const
+{
+    return index_map.value(modelId);
+}
+
+QList<QModelIndex> Scene::getModelIndexFromId(int id) const
+{
+    return index_map.keys(id);
+}
+
+void Scene::addGroup(Scene_group_item* group)
+{
+    connect(this, SIGNAL(drawFinished()), group, SLOT(resetDraw()));
+    group->setScene(this);
+}
+
+namespace scene { namespace details {
+
+Q_DECL_EXPORT
+CGAL::Three::Scene_item*
+findItem(const CGAL::Three::Scene_interface* scene_interface,
+         const QMetaObject& metaobj,
+         QString name, Scene_item_name_fn_ptr fn) {
+    const Scene* scene = dynamic_cast<const Scene*>(scene_interface);
+    if(!scene) return 0;
+    Q_FOREACH(CGAL::Three::Scene_item* item, scene->entries()) {
+       CGAL::Three::Scene_item* ptr = qobject_cast<CGAL::Three::Scene_item*>(metaobj.cast(item));
+        if(ptr && ((ptr->*fn)() == name)) return ptr;
+    }
+    return 0;
+}
+
+Q_DECL_EXPORT
+QList<CGAL::Three::Scene_item*>
+findItems(const CGAL::Three::Scene_interface* scene_interface,
+
+          const QMetaObject&,
+          QString name, Scene_item_name_fn_ptr fn)
+{
+    const Scene* scene = dynamic_cast<const Scene*>(scene_interface);
+    QList<CGAL::Three::Scene_item*> list;
+    if(!scene) return list;
+
+    Q_FOREACH(CGAL::Three::Scene_item* item, scene->entries()) {
+        CGAL::Three::Scene_item* ptr = qobject_cast<CGAL::Three::Scene_item*>(item);
+        if(ptr && ((ptr->*fn)() == name)) {
+            list << ptr;
+        }
+    }
+    return list;
+}
+
+} // end namespace details
+                } // end namespace scene
diff --git a/3rdparty/CGAL/demo/Polyhedron/Scene.h b/3rdparty/CGAL/demo/Polyhedron/Scene.h
new file mode 100644
index 0000000..c302f3b
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Scene.h
@@ -0,0 +1,331 @@
+//! \file Scene.h
+#ifndef SCENE_H
+#define SCENE_H
+#include "config.h"
+#include "Scene_config.h"
+#include <CGAL/Three/Scene_interface.h>
+#include <CGAL/Three/Scene_draw_interface.h>
+#include <CGAL/Three/Viewer_config.h>
+
+#include <QtOpenGL/qgl.h>
+#include <QStandardItemModel>
+#include <QString>
+#include <QColor>
+#include <QList>
+#include <QMap>
+#include <QItemDelegate>
+#include <QPixmap>
+#include <QItemSelection>
+#include <QGLViewer/qglviewer.h>
+#include <QDebug>
+#include <iostream>
+#include <cmath>
+#include <boost/variant.hpp>
+#include <CGAL/Three/Scene_group_item.h>
+class QEvent;
+class QMouseEvent;
+namespace GlSplat { class SplatRenderer; }
+namespace CGAL { namespace Three{ class Viewer_interface;}}
+
+
+class SCENE_EXPORT Scene  :
+  public QStandardItemModel, public CGAL::Three::Scene_interface, public CGAL::Three::Scene_draw_interface
+
+{
+  Q_OBJECT
+  Q_PROPERTY(int numberOfEntries READ numberOfEntries)
+
+  friend class SceneDelegate;
+
+public:
+  QList<QModelIndex> getModelIndexFromId(int id) const;
+  int getIdFromModelIndex(QModelIndex modelId) const;
+  enum Columns { NameColumn = 0, 
+                 ColorColumn, 
+                 RenderingModeColumn, 
+                 VisibleColumn,
+                 ABColumn,
+                 LastColumn = ABColumn,
+                 NumberOfColumns = LastColumn + 1};
+  Scene(QObject*  parent);
+  ~Scene();
+
+  //!Adds item to the items list, gives it an ID and
+  //!updates the bounding box if needed.
+  int addItem(CGAL::Three::Scene_item* item);
+
+  void changeGroup(CGAL::Three::Scene_item* item, CGAL::Three::Scene_group_item* target_group);
+  //!Sets item as the item at index and calls @ref Scene_item#changed().
+  //!If emit_item_about_to_be_destroyed is set to true, emits
+  //!an itemAboutToBeDestroyed signal.
+  CGAL::Three::Scene_item* replaceItem(Scene::Item_id index, CGAL::Three::Scene_item* item, bool emit_item_about_to_be_destroyed = false);
+  /*! Deletes the item with the target index.
+   * @returns  the index of the polyhedra just before the
+   * one that is erased, or just after. -1 if
+   * the list is empty.
+   */
+  Q_INVOKABLE Item_id erase(Item_id);
+
+  /*! Deletes the items with the target indexes.
+   * @returns the index of the polyhedra just before the
+   * one that is erased, or just after. Returns -1 if
+   * the list is empty.
+   */
+  int erase(QList<int>);
+
+  /*! Duplicate a scene item.
+   * @returns the ID of the new item (-1 on error).
+   */
+  int duplicate(int index); 
+
+  // Accessors (getters)
+  //! @returns the number of items.
+  int numberOfEntries() const;
+  //! @returns the list of items.
+  const QList<CGAL::Three::Scene_item*>& entries() const { return m_entries; }
+  //! @returns the item at the target index.
+  Q_INVOKABLE CGAL::Three::Scene_item* item(int) const ;
+  //! @returns the id of the target item.
+  Item_id item_id(CGAL::Three::Scene_item*) const;
+  
+  //! \todo Replace Index based selection functionality with those
+  //! functions.
+  ///@{
+  CGAL::Three::Scene_item* selectedItem() const;
+  QList<CGAL::Three::Scene_item*> selectedItems() const;
+  QList<CGAL::Three::Scene_item*> selectionA() const;
+  QList<CGAL::Three::Scene_item*> selectionB() const;
+  ///@}
+
+  //!@returns the currently selected item's index.
+  int mainSelectionIndex() const;
+  //!@returns the list of currently selected items indices.
+  QList<int> selectionIndices() const;
+  //!@returns the index of the Item_A
+  int selectionAindex() const;
+  //!@returns the index of the Item_B
+  int selectionBindex() const;
+
+  /*! Is called by Viewer::initializeGL(). Allows all the initialization
+   * of OpenGL code that needs a context.
+   */
+  void initializeGL();
+  /*! Sets the screen coordinates of the currently picked point.*/
+  void setPickedPixel(const QPoint &p) {picked_pixel = p;}
+  /*! Is called by Viewer::draw(Viewer_interface*). Calls draw_aux(false, viewer).
+   * @see draw_aux(bool with_names, Viewer_interface).*/
+  void draw(CGAL::Three::Viewer_interface*);
+  /*! Is called by Viewer::drawWithNames(Viewer_interface*). Calls draw_aux(true, viewer).
+   * @see draw_aux(bool with_names, Viewer_interface).*/
+  void drawWithNames(CGAL::Three::Viewer_interface*);
+  /*! Manages the key events.
+   * @returns true if the keyEvent executed well.
+   */
+  bool keyPressEvent(QKeyEvent* e);
+
+  void printPrimitiveId(QPoint point, CGAL::Three::Viewer_interface*);
+  void printPrimitiveIds(CGAL::Three::Viewer_interface*);
+  bool testDisplayId(double x, double y, double z, CGAL::Three::Viewer_interface* viewer);
+  //!@returns the scene bounding box
+  Bbox bbox() const;
+  float get_bbox_length() const;
+  //!@returns the length of the bounding box's diagonal.
+  double len_diagonal() const
+  {
+    Bbox box = bbox();
+    double dx = box.xmax() - box.xmin();
+    double dy = box.ymax() - box.ymin();
+    double dz = box.zmax() - box.zmin();
+    return std::sqrt(dx*dx + dy*dy + dz*dz);
+  }
+
+
+  // QStandardItemModel functions
+  void moveRowUp();
+  void moveRowDown();
+  bool dropMimeData(const QMimeData *, Qt::DropAction, int, int, const QModelIndex &parent);
+  QVariant data ( const QModelIndex & index, int role = ::Qt::DisplayRole ) const;
+  //!@returns the type of data correspondind to the role.
+  QVariant headerData ( int section, ::Qt::Orientation orientation, int role = ::Qt::DisplayRole ) const;
+  //!@returns the flags for the item at the target index.
+  ::Qt::ItemFlags flags ( const QModelIndex & index ) const;
+  /*! Sets the column data for the target index. Returns false if index is not valid and
+   * if role is not EditRole.*/
+  bool setData(const QModelIndex &index, const QVariant &value, int role);
+  QList<CGAL::Three::Scene_item*> item_entries() const ;
+  // auxiliary public function for QMainWindow
+  //!Selects the row at index i in the sceneView.
+  QItemSelection createSelection(int i);
+  //!Selects all the rows in the sceneView.
+  QItemSelection createSelectionAll();
+
+public Q_SLOTS:
+  //!Specifies a group as Expanded for the view
+  void setExpanded(QModelIndex);
+  //!Specifies a group as Collapsed for the view
+  void setCollapsed(QModelIndex);
+  /*!
+   *Calls itemChanged() on the sender if it's an item.
+
+*/
+  void itemChanged();
+  /*! Notifies the scene that the item at index i was modified.
+   * Called by the items. Calls @ref Scene_item#changed().
+   * This function is called by the items.*/
+  void itemChanged(int i); 
+  /*! Notifies the scene that the item was modified.
+   *  Calls @ref Scene_item#changed().
+   * This function is called by the items.*/
+  void itemChanged(CGAL::Three::Scene_item*);
+  //!Removes item from all the groups of the scene.
+  void remove_item_from_groups(CGAL::Three::Scene_item* item);
+
+  void addGroup(Scene_group_item* group);
+  //!Re-organizes the sceneView.
+  void redraw_model();
+  //! Sets the selected item to the target index. Emits a signal to notify
+  //! that a new item is now selected.
+  void setSelectedItemIndex(int i)
+  {
+    selected_item = i;
+    Q_EMIT itemIndexSelected(i);
+  }
+  //! Clears the current selection then sets the selected item to the target index.
+  //! Used to update the selection in the QTreeView.
+  void setSelectedItem(int i )
+  {
+    selected_item = i;
+    Q_EMIT selectionChanged(i);
+  }
+
+  //! Sets the target item as selected and emits setSelectedItem for its index.
+  void setSelectedItem(CGAL::Three::Scene_item* item_to_select)
+  {
+    int i=0;
+    Q_FOREACH(CGAL::Three::Scene_item* item, m_entries)
+    {
+      if (item==item_to_select)
+      {
+        Q_EMIT setSelectedItem(i);
+        break;
+      }
+      ++i;
+    }
+  }
+  //! Sets the target list of indices as the selected indices.
+  QList<int> setSelectedItemsList(QList<int> l )
+  {
+    Q_FOREACH(int i,l)
+    {
+       CGAL::Three::Scene_group_item* group =
+               qobject_cast<CGAL::Three::Scene_group_item*>(item(i));
+       if(group)
+       {
+         QList<int> list;
+         Q_FOREACH(CGAL::Three::Scene_item* child, group->getChildren())
+           list<<m_entries.indexOf(child);
+         l << setSelectedItemsList(list);
+       }
+
+    }
+    selected_items_list = l;
+    return l;
+  }
+
+  // Accessors (setters)
+  //!Sets the item at index i to visible or not visible.
+  void setItemVisible(int, bool b);
+  //!Sets the item_A as the item at index i .
+  void setItemA(int i);
+  //!Sets the item_B as the item at index i .
+  void setItemB(int i);
+
+Q_SIGNALS:
+  //generated automatically by moc
+  void itemPicked(const QModelIndex &);
+  void newItem(int);
+  void updated_bbox();
+  void updated();
+  void itemAboutToBeDestroyed(CGAL::Three::Scene_item*);
+  void selectionRay(double, double, double, double, double, double);
+  //! Used to update the selected item in the QTreeView.
+  void selectionChanged(int i);
+  //! Used when you don't want to update the sleectedItem in the QTreeView.
+  void itemIndexSelected(int i);
+  void restoreCollapsedState();
+  void drawFinished();
+private Q_SLOTS:
+  //! Casts a selection ray and calls the item function select.
+  void setSelectionRay(double, double, double, double, double, double);
+  void callDraw(){  QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin(); viewer->update();}
+  void s_itemAboutToBeDestroyed(CGAL::Three::Scene_item *);
+private:
+  /*! Calls the drawing functions of each visible item according
+   * to its current renderingMode. If with_names is true, uses
+   * the OpenGL mode GL_WITH_NAMES, essentially used for the picking.*/
+  void draw_aux(bool with_names, CGAL::Three::Viewer_interface*);
+  //! Re-draw the hierarchy of the view.
+  void organize_items(CGAL::Three::Scene_item* item, QStandardItem *root, int loop);
+  //! List of Scene_items.
+  typedef QList<CGAL::Three::Scene_item*> Entries;
+  //!List containing all the scene_items.
+  Entries m_entries;
+  //! Index of the currently selected item.
+  int selected_item;
+  //!List of indices of the currently selected items.
+  QList<int> selected_items_list;
+  //!Index of the item_A.
+  int item_A;
+  //!Index of the item_B.
+  int item_B;
+  bool picked;
+  QPoint picked_pixel;
+  bool gl_init;
+  static GlSplat::SplatRenderer* ms_splatting;
+  static int ms_splattingCounter;
+  QMap<QModelIndex, int> index_map;
+
+public:
+  static GlSplat::SplatRenderer* splatting();
+
+}; // end class Scene
+
+class QAbstractProxyModel;
+/*!
+ * \brief The SceneDelegate class
+ * Handles the columns of the sceneView
+ */
+class SCENE_EXPORT SceneDelegate : public QItemDelegate
+{
+public:
+  SceneDelegate(QObject * parent = 0)
+    : QItemDelegate(parent),
+      checkOnPixmap(":/cgal/icons/check-on.png"),
+      checkOffPixmap(":/cgal/icons/check-off.png")
+  {
+  }
+//! Handles the clicks on the sceneView
+  bool editorEvent(QEvent *event, QAbstractItemModel *model,
+                   const QStyleOptionViewItem &option,
+                   const QModelIndex &index);
+  //! Draws the content of the sceneView
+  void paint(QPainter *painter, const QStyleOptionViewItem &option,
+             const QModelIndex &index) const;
+  void setProxy(QAbstractProxyModel* p_proxy){
+      proxy = p_proxy;
+  }
+  void setScene(Scene* p_scene){
+      scene = p_scene;
+  }
+
+private:
+  QPixmap checkOnPixmap;
+  QPixmap checkOffPixmap;
+  QAbstractProxyModel *proxy;
+  Scene *scene;
+  mutable int size;
+}; // end class SceneDelegate
+
+#endif // SCENE_H
+
+
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_basic_objects_config.h b/3rdparty/CGAL/demo/Polyhedron/Scene_basic_objects_config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Scene_basic_objects_config.h
rename to 3rdparty/CGAL/demo/Polyhedron/Scene_basic_objects_config.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_c2t3_item.cpp b/3rdparty/CGAL/demo/Polyhedron/Scene_c2t3_item.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Scene_c2t3_item.cpp
rename to 3rdparty/CGAL/demo/Polyhedron/Scene_c2t3_item.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_c2t3_item.h b/3rdparty/CGAL/demo/Polyhedron/Scene_c2t3_item.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Scene_c2t3_item.h
rename to 3rdparty/CGAL/demo/Polyhedron/Scene_c2t3_item.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_c2t3_item_config.h b/3rdparty/CGAL/demo/Polyhedron/Scene_c2t3_item_config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Scene_c2t3_item_config.h
rename to 3rdparty/CGAL/demo/Polyhedron/Scene_c2t3_item_config.h
diff --git a/3rdparty/CGAL/demo/Polyhedron/Scene_c3t3_item.cpp b/3rdparty/CGAL/demo/Polyhedron/Scene_c3t3_item.cpp
new file mode 100644
index 0000000..6795edc
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Scene_c3t3_item.cpp
@@ -0,0 +1,1544 @@
+#include "config.h"
+#include "Scene_spheres_item.h"
+#include "Scene_c3t3_item.h"
+
+#include <QVector>
+#include <QColor>
+#include <QPixmap>
+#include <QApplication>
+#include <QPainter>
+#include <QtCore/qglobal.h>
+#include <QGuiApplication>
+
+#include <map>
+#include <vector>
+#include <CGAL/gl.h>
+#include <CGAL/Mesh_3/dihedral_angle_3.h>
+#include <CGAL/Three/Scene_interface.h>
+#include <CGAL/Real_timer.h>
+
+#include <QGLViewer/manipulatedFrame.h>
+#include <QGLViewer/qglviewer.h>
+
+#include <boost/function_output_iterator.hpp>
+#include <boost/foreach.hpp>
+
+#include <CGAL/AABB_tree.h>
+#include <CGAL/AABB_traits.h>
+#include <CGAL/AABB_C3T3_triangle_primitive.h>
+#include <CGAL/Polygon_mesh_processing/orient_polygon_soup.h>
+#include <CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h>
+
+
+typedef CGAL::AABB_C3T3_triangle_primitive<Kernel,C3t3> Primitive;
+typedef CGAL::AABB_traits<Kernel, Primitive> Traits;
+typedef CGAL::AABB_tree<Traits> Tree;
+typedef Tree::Point_and_primitive_id Point_and_primitive_id;
+
+// The special Scene_item only for triangles
+class Scene_intersection_item : public CGAL::Three::Scene_item
+{
+  Q_OBJECT
+public :
+  Scene_intersection_item(Scene_c3t3_item* parent)
+  :CGAL::Three::Scene_item(NumberOfBuffers,NumberOfVaos)
+  {
+    setParent(parent);
+  }
+  void init_vectors(
+      std::vector<float> *p_vertices,
+      std::vector<float> *p_normals,
+      std::vector<float> *p_edges,
+      std::vector<float> *p_colors)
+  {
+    vertices = p_vertices;
+    normals = p_normals;
+    edges = p_edges;
+    colors = p_colors;
+  }
+  void setColor(QColor c)
+  {
+    qobject_cast<Scene_c3t3_item*>(this->parent())->setColor(c);
+    Scene_item::setColor(c);
+  }
+  // Indicates if rendering mode is supported
+  bool supportsRenderingMode(RenderingMode m) const {
+    return (m != Gouraud && m != PointsPlusNormals && m != Splatting && m != Points);
+  }
+  void initialize_buffers(CGAL::Three::Viewer_interface *viewer)
+  {
+   //vao containing the data for the facets
+    {
+      program = getShaderProgram(PROGRAM_WITH_LIGHT, viewer);
+      program->bind();
+
+      vaos[Facets]->bind();
+      buffers[Vertices].bind();
+      buffers[Vertices].allocate(vertices->data(),
+        static_cast<int>(vertices->size()*sizeof(float)));
+      program->enableAttributeArray("vertex");
+      program->setAttributeBuffer("vertex", GL_FLOAT, 0, 3);
+      buffers[Vertices].release();
+
+      buffers[Normals].bind();
+      buffers[Normals].allocate(normals->data(),
+        static_cast<int>(normals->size()*sizeof(float)));
+      program->enableAttributeArray("normals");
+      program->setAttributeBuffer("normals", GL_FLOAT, 0, 3);
+      buffers[Normals].release();
+
+      buffers[Colors].bind();
+      buffers[Colors].allocate(colors->data(),
+        static_cast<int>(colors->size()*sizeof(float)));
+      program->enableAttributeArray("colors");
+      program->setAttributeBuffer("colors", GL_FLOAT, 0, 3);
+      buffers[Colors].release();
+
+      vaos[Facets]->release();
+      program->release();
+
+    }
+      //vao containing the data for the lines
+      {
+          program = getShaderProgram(PROGRAM_NO_SELECTION, viewer);
+          program->bind();
+
+          vaos[Lines]->bind();
+          buffers[Edges].bind();
+          buffers[Edges].allocate(edges->data(),
+                                           static_cast<int>(edges->size()*sizeof(float)));
+          program->enableAttributeArray("vertex");
+          program->setAttributeBuffer("vertex", GL_FLOAT, 0, 3);
+          buffers[Edges].release();
+
+          vaos[Lines]->release();
+          program->release();
+      }
+  }
+  //Displays the item
+  void draw(CGAL::Three::Viewer_interface* viewer) const
+  {
+    vaos[Facets]->bind();
+    program = getShaderProgram(PROGRAM_WITH_LIGHT);
+    attribBuffers(viewer, PROGRAM_WITH_LIGHT);
+    program->bind();
+
+    // positions_poly is also used for the faces in the cut plane
+    // and changes when the cut plane is moved
+    viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(vertices->size() / 3));
+    program->release();
+    vaos[Facets]->release();
+  }
+  void drawEdges(CGAL::Three::Viewer_interface* viewer) const
+  {
+    vaos[Lines]->bind();
+    program = getShaderProgram(PROGRAM_NO_SELECTION);
+    attribBuffers(viewer, PROGRAM_NO_SELECTION);
+    program->bind();
+    program->setAttributeValue("colors", QColor(Qt::black));
+    viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(edges->size() / 3));
+    program->release();
+    vaos[Lines]->release();
+  }
+  void addTriangle(Kernel::Point_3 pa, Kernel::Point_3 pb, Kernel::Point_3 pc, CGAL::Color color)
+  {
+    Kernel::Vector_3 n = cross_product(pb - pa, pc - pa);
+    n = n / CGAL::sqrt(n*n);
+
+
+    for (int i = 0; i<3; i++)
+    {
+      normals->push_back(n.x());
+      normals->push_back(n.y());
+      normals->push_back(n.z());
+    }
+    vertices->push_back(pa.x());
+    vertices->push_back(pa.y());
+    vertices->push_back(pa.z());
+
+    vertices->push_back(pb.x());
+    vertices->push_back(pb.y());
+    vertices->push_back(pb.z());
+
+    vertices->push_back(pc.x());
+    vertices->push_back(pc.y());
+    vertices->push_back(pc.z());
+
+    edges->push_back(pa.x());
+    edges->push_back(pa.y());
+    edges->push_back(pa.z());
+
+    edges->push_back(pb.x());
+    edges->push_back(pb.y());
+    edges->push_back(pb.z());
+
+    edges->push_back(pb.x());
+    edges->push_back(pb.y());
+    edges->push_back(pb.z());
+
+    edges->push_back(pc.x());
+    edges->push_back(pc.y());
+    edges->push_back(pc.z());
+
+    edges->push_back(pc.x());
+    edges->push_back(pc.y());
+    edges->push_back(pc.z());
+
+    edges->push_back(pa.x());
+    edges->push_back(pa.y());
+    edges->push_back(pa.z());
+
+    for(int i=0; i<3; i++)
+    {
+      colors->push_back((float)color.red()/255);
+      colors->push_back((float)color.green()/255);
+      colors->push_back((float)color.blue()/255);
+    }
+  }
+
+  Scene_item* clone() const {return 0;}
+  QString toolTip() const {return QString();}
+private:
+  enum Buffer
+  {
+      Vertices =0,
+      Normals,
+      Colors,
+      Edges,
+      NumberOfBuffers
+  };
+  enum Vao
+  {
+      Facets=0,
+      Lines,
+      NumberOfVaos
+  };
+  //contains the data
+  mutable std::vector<float> *vertices;
+  mutable std::vector<float> *normals;
+  mutable std::vector<float> *edges;
+  mutable std::vector<float> *colors;
+  mutable QOpenGLShaderProgram *program;
+}; //end of class Scene_triangle_item
+
+
+struct Scene_c3t3_item_priv {
+  typedef qglviewer::ManipulatedFrame ManipulatedFrame;
+  Scene_c3t3_item_priv(Scene_c3t3_item* item)
+    : item(item), c3t3()
+    , frame(new ManipulatedFrame())
+    , data_item_(NULL)
+    , histogram_()
+    , indices_()
+  {
+    init_default_values();
+  }
+  Scene_c3t3_item_priv(const C3t3& c3t3_, Scene_c3t3_item* item)
+    : item(item), c3t3(c3t3_)
+    , frame(new ManipulatedFrame())
+    , data_item_(NULL)
+    , histogram_()
+    , indices_()
+  {
+    init_default_values();
+  }
+  ~Scene_c3t3_item_priv()
+  {
+     delete frame;
+  }
+
+  void init_default_values() {
+    positions_lines.resize(0);
+    positions_poly.resize(0);
+    normals.resize(0);
+    s_vertex.resize(0);
+    s_normals.resize(0);
+    ws_vertex.resize(0);
+    need_changed = false;
+    spheres = NULL;
+    intersection = NULL;
+    spheres_are_shown = false;
+    cnc_are_shown = false;
+    show_tetrahedra = false;
+    is_aabb_tree_built = false;
+    are_intersection_buffers_filled = false;
+  }
+  void computeIntersection(const Primitive& facet);
+  void fill_aabb_tree() {
+    if(item->isEmpty()) return;
+    QGuiApplication::setOverrideCursor(Qt::WaitCursor);
+    CGAL::Real_timer timer;
+    timer.start();
+    tree.clear();
+    for (Tr::Finite_facets_iterator
+           fit = c3t3.triangulation().finite_facets_begin(),
+           end = c3t3.triangulation().finite_facets_end();
+         fit != end; ++fit)
+    {
+      Tr::Cell_handle ch = fit->first, nh =ch->neighbor(fit->second);
+
+      if( (!c3t3.is_in_complex(ch)) &&  (!c3t3.is_in_complex(nh)) )
+        continue;
+
+      if(c3t3.is_in_complex(ch)){
+        tree.insert(Primitive(fit));
+      } else{
+        int ni = nh->index(ch);
+        tree.insert(Primitive(Tr::Facet(nh,ni)));
+      }
+    }
+    tree.build();
+    std::cerr << "C3t3 facets AABB tree built in " << timer.time()
+              << " wall-clock seconds\n";
+
+    is_aabb_tree_built = true;
+    QGuiApplication::restoreOverrideCursor();
+  }
+  void reset_cut_plane();
+  void draw_triangle(const Kernel::Point_3& pa,
+    const Kernel::Point_3& pb,
+    const Kernel::Point_3& pc) const;
+  void draw_triangle_edges(const Kernel::Point_3& pa,
+    const Kernel::Point_3& pb,
+    const Kernel::Point_3& pc)const;
+  void draw_triangle_edges_cnc(const Kernel::Point_3& pa,
+                           const Kernel::Point_3& pb,
+                           const Kernel::Point_3& pc)const;
+  double complex_diag() const;
+  void compute_color_map(const QColor& c);
+  void initializeBuffers(CGAL::Three::Viewer_interface *viewer);
+  void initialize_intersection_buffers(CGAL::Three::Viewer_interface *viewer);
+  void computeSpheres();
+  void computeElements();
+  void computeIntersections();
+
+  enum Buffer
+  {
+      Facet_vertices =0,
+      Facet_normals,
+      Facet_colors,
+      Edges_vertices,
+      Edges_CNC,
+      Grid_vertices,
+      iEdges_vertices,
+      iFacet_vertices,
+      iFacet_normals,
+      iFacet_colors,
+      NumberOfBuffers
+  };
+  enum Vao
+  {
+      Facets=0,
+      Edges,
+      Grid,
+      CNC,
+      iEdges,
+      iFacets,
+      NumberOfVaos
+  };
+  Scene_c3t3_item* item;
+  C3t3 c3t3;
+  qglviewer::ManipulatedFrame* frame;
+  bool need_changed;
+  mutable bool are_intersection_buffers_filled;
+  Scene_spheres_item *spheres;
+  Scene_intersection_item *intersection;
+  bool spheres_are_shown;
+  const Scene_item* data_item_;
+  QPixmap histogram_;
+  typedef std::set<int> Indices;
+  Indices indices_;
+
+  //!Allows OpenGL 2.1 context to get access to glDrawArraysInstanced.
+  typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDARBPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+  //!Allows OpenGL 2.1 context to get access to glVertexAttribDivisor.
+  typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORARBPROC) (GLuint index, GLuint divisor);
+  //!Allows OpenGL 2.1 context to get access to gkFrameBufferTexture2D.
+  PFNGLDRAWARRAYSINSTANCEDARBPROC glDrawArraysInstanced;
+  //!Allows OpenGL 2.1 context to get access to glVertexAttribDivisor.
+  PFNGLVERTEXATTRIBDIVISORARBPROC glVertexAttribDivisor;
+
+  mutable std::size_t positions_poly_size;
+  mutable std::size_t positions_lines_size;
+  mutable std::size_t positions_lines_not_in_complex_size;
+  mutable std::vector<float> positions_lines;
+  mutable std::vector<float> positions_lines_not_in_complex;
+  mutable std::vector<float> positions_grid;
+  mutable std::vector<float> positions_poly;
+
+  mutable std::vector<float> normals;
+  mutable std::vector<float> f_colors;
+  mutable std::vector<float> s_normals;
+  mutable std::vector<float> s_colors;
+  mutable std::vector<float> s_vertex;
+  mutable std::vector<float> ws_vertex;
+  mutable std::vector<float> s_radius;
+  mutable std::vector<float> s_center;
+  mutable QOpenGLShaderProgram *program;
+
+
+  Tree tree;
+  QVector<QColor> colors;
+  bool show_tetrahedra;
+  bool is_aabb_tree_built;
+  bool cnc_are_shown;
+};
+
+struct Set_show_tetrahedra {
+  Scene_c3t3_item_priv* priv;
+  Set_show_tetrahedra(Scene_c3t3_item_priv* priv) : priv(priv) {}
+  void operator()(bool b) {
+    priv->show_tetrahedra = b;
+    priv->item->show_intersection(b);
+  }
+};
+
+
+double complex_diag(const Scene_item* item) {
+  const Scene_item::Bbox& bbox = item->bbox();
+  const double& xdelta = bbox.xmax()-bbox.xmin();
+  const double& ydelta = bbox.ymax()-bbox.ymin();
+  const double& zdelta = bbox.zmax()-bbox.zmin();
+  const double diag = std::sqrt(xdelta*xdelta +
+                                ydelta*ydelta +
+                                zdelta*zdelta);
+  return diag * 0.7;
+}
+
+Scene_c3t3_item::Scene_c3t3_item()
+  : Scene_group_item("unnamed", Scene_c3t3_item_priv::NumberOfBuffers, Scene_c3t3_item_priv::NumberOfVaos)
+  , d(new Scene_c3t3_item_priv(this))
+
+{
+
+  compute_bbox();
+  connect(d->frame, SIGNAL(modified()), this, SLOT(changed()));
+  c3t3_changed();
+  setRenderingMode(FlatPlusEdges);
+  create_flat_and_wire_sphere(1.0f,d->s_vertex,d->s_normals, d->ws_vertex);
+}
+
+Scene_c3t3_item::Scene_c3t3_item(const C3t3& c3t3)
+  : Scene_group_item("unnamed", Scene_c3t3_item_priv::NumberOfBuffers, Scene_c3t3_item_priv::NumberOfVaos)
+  , d(new Scene_c3t3_item_priv(c3t3, this))
+{
+
+  compute_bbox();
+  connect(d->frame, SIGNAL(modified()), this, SLOT(changed()));
+  d->reset_cut_plane();
+  c3t3_changed();
+  setRenderingMode(FlatPlusEdges);
+  create_flat_and_wire_sphere(1.0f,d->s_vertex,d->s_normals, d->ws_vertex);
+}
+
+Scene_c3t3_item::~Scene_c3t3_item()
+{
+  delete d;
+}
+
+
+
+const Scene_item*
+Scene_c3t3_item::data_item() const
+{
+  return d->data_item_;
+}
+
+void
+Scene_c3t3_item::set_data_item(const Scene_item* data_item)
+{
+  d->data_item_ = data_item;
+  if (NULL != data_item)
+  {
+    connect(d->data_item_, SIGNAL(aboutToBeDestroyed()),
+      this, SLOT(data_item_destroyed()));
+  }
+}
+
+void
+Scene_c3t3_item::data_item_destroyed()
+{
+  set_data_item(NULL);
+}
+
+const C3t3&
+Scene_c3t3_item::c3t3() const {
+  return d->c3t3;
+}
+
+C3t3&
+Scene_c3t3_item::c3t3()
+{
+  return d->c3t3;
+}
+
+void
+Scene_c3t3_item::changed()
+{
+  d->need_changed = true;
+  QTimer::singleShot(0,this, SLOT(updateCutPlane()));
+}
+
+void Scene_c3t3_item::updateCutPlane()
+{ // just handle deformation - paint like selection is handled in eventFilter()
+  if(d->need_changed) {
+    d->are_intersection_buffers_filled = false;
+    d->need_changed = false;
+  }
+}
+
+void
+Scene_c3t3_item::c3t3_changed()
+{
+  // Update colors
+  // Fill indices map and get max subdomain value
+  d->indices_.clear();
+
+  int max = 0;
+  for (C3t3::Cells_in_complex_iterator cit = this->c3t3().cells_in_complex_begin(),
+    end = this->c3t3().cells_in_complex_end(); cit != end; ++cit)
+  {
+    max = (std::max)(max, cit->subdomain_index());
+    d->indices_.insert(cit->subdomain_index());
+  }
+  for (C3t3::Facets_in_complex_iterator fit = this->c3t3().facets_in_complex_begin(),
+    end = this->c3t3().facets_in_complex_end(); fit != end; ++fit)
+  {
+    max = (std::max)(max, fit->first->surface_patch_index(fit->second));
+    d->indices_.insert(fit->first->surface_patch_index(fit->second));
+  }
+
+  d->colors.resize(max + 1);
+  d->compute_color_map(color_);
+
+  // Rebuild histogram
+  build_histogram();
+
+  d->tree.clear();
+  d->is_aabb_tree_built = false;
+}
+
+QPixmap
+Scene_c3t3_item::graphicalToolTip() const
+{
+  if (!d->histogram_.isNull())
+  {
+    return d->histogram_;
+  }
+  const_cast<Scene_c3t3_item&>(*this).build_histogram();
+  return d->histogram_;
+}
+
+template<typename C3t3>
+std::vector<int>
+create_histogram(const C3t3& c3t3, double& min_value, double& max_value)
+{
+  typedef typename C3t3::Triangulation::Point Point_3;
+
+  std::vector<int> histo(181, 0);
+
+  min_value = 180.;
+  max_value = 0.;
+
+  for (typename C3t3::Cells_in_complex_iterator cit = c3t3.cells_in_complex_begin();
+    cit != c3t3.cells_in_complex_end();
+    ++cit)
+  {
+    if (!c3t3.is_in_complex(cit))
+      continue;
+
+#ifdef CGAL_MESH_3_DEMO_DONT_COUNT_TETS_ADJACENT_TO_SHARP_FEATURES_FOR_HISTOGRAM
+    if (c3t3.in_dimension(cit->vertex(0)) <= 1
+      || c3t3.in_dimension(cit->vertex(1)) <= 1
+      || c3t3.in_dimension(cit->vertex(2)) <= 1
+      || c3t3.in_dimension(cit->vertex(3)) <= 1)
+      continue;
+#endif //CGAL_MESH_3_DEMO_DONT_COUNT_TETS_ADJACENT_TO_SHARP_FEATURES_FOR_HISTOGRAM
+
+    const Point_3& p0 = cit->vertex(0)->point();
+    const Point_3& p1 = cit->vertex(1)->point();
+    const Point_3& p2 = cit->vertex(2)->point();
+    const Point_3& p3 = cit->vertex(3)->point();
+
+    double a = CGAL::to_double(CGAL::abs(CGAL::Mesh_3::dihedral_angle(p0, p1, p2, p3)));
+    histo[static_cast<int>(std::floor(a))] += 1;
+    min_value = (std::min)(min_value, a);
+    max_value = (std::max)(max_value, a);
+
+    a = CGAL::to_double(CGAL::abs(CGAL::Mesh_3::dihedral_angle(p0, p2, p1, p3)));
+    histo[static_cast<int>(std::floor(a))] += 1;
+    min_value = (std::min)(min_value, a);
+    max_value = (std::max)(max_value, a);
+
+    a = CGAL::to_double(CGAL::abs(CGAL::Mesh_3::dihedral_angle(p0, p3, p1, p2)));
+    histo[static_cast<int>(std::floor(a))] += 1;
+    min_value = (std::min)(min_value, a);
+    max_value = (std::max)(max_value, a);
+
+    a = CGAL::to_double(CGAL::abs(CGAL::Mesh_3::dihedral_angle(p1, p2, p0, p3)));
+    histo[static_cast<int>(std::floor(a))] += 1;
+    min_value = (std::min)(min_value, a);
+    max_value = (std::max)(max_value, a);
+
+    a = CGAL::to_double(CGAL::abs(CGAL::Mesh_3::dihedral_angle(p1, p3, p0, p2)));
+    histo[static_cast<int>(std::floor(a))] += 1;
+    min_value = (std::min)(min_value, a);
+    max_value = (std::max)(max_value, a);
+
+    a = CGAL::to_double(CGAL::abs(CGAL::Mesh_3::dihedral_angle(p2, p3, p0, p1)));
+    histo[static_cast<int>(std::floor(a))] += 1;
+    min_value = (std::min)(min_value, a);
+    max_value = (std::max)(max_value, a);
+
+  }
+
+  return histo;
+}
+
+void
+Scene_c3t3_item::build_histogram()
+{
+#ifdef CGAL_MESH_3_DEMO_BIGGER_HISTOGRAM_WITH_WHITE_BACKGROUNG
+  // Create an histogram_ and display it
+  const int height = 280;
+  const int top_margin = 5;
+  const int left_margin = 20;
+  const int drawing_height = height - top_margin * 2;
+  const int width = 804;
+  const int cell_width = 4;
+  const int text_margin = 3;
+  const int text_height = 34;
+
+  histogram_ = QPixmap(width, height + text_height);
+  histogram_.fill(QColor(255, 255, 255));
+#else
+  // Create an histogram_ and display it
+  const int height = 140;
+  const int top_margin = 5;
+  const int left_margin = 20;
+  const int drawing_height = height - top_margin * 2;
+  const int width = 402;
+  const int cell_width = 2;
+  const int text_margin = 3;
+  const int text_height = 20;
+
+  d->histogram_ = QPixmap(width, height + text_height);
+  d->histogram_.fill(QColor(192, 192, 192));
+#endif  
+
+  QPainter painter(&d->histogram_);
+  painter.setPen(Qt::black);
+  painter.setBrush(QColor(128, 128, 128));
+  //painter.setFont(QFont("Arial", 30));
+
+  // Build histogram_ data
+  double min_value, max_value;
+  std::vector<int> histo_data = create_histogram(c3t3(), min_value, max_value);
+
+  // Get maximum value (to normalize)
+  int max_size = 0;
+  for (std::vector<int>::iterator it = histo_data.begin(), end = histo_data.end();
+    it != end; ++it)
+  {
+    max_size = (std::max)(max_size, *it);
+  }
+
+  // colored histogram
+  int j = 0;
+
+  // draw
+  int i = left_margin;
+  for (std::vector<int>::iterator it = histo_data.begin(), end = histo_data.end();
+    it != end; ++it, i += cell_width)
+  {
+    int line_height = static_cast<int>(std::ceil(static_cast<double>(drawing_height)*
+      static_cast<double>(*it) / static_cast<double>(max_size)) + .5);
+
+    painter.fillRect(i,
+      drawing_height + top_margin - line_height,
+      cell_width,
+      line_height,
+      get_histogram_color(j++));
+  }
+
+  // draw bottom horizontal line
+  painter.setPen(Qt::blue);
+
+  painter.drawLine(QPoint(left_margin, drawing_height + top_margin),
+    QPoint(left_margin + static_cast<int>(histo_data.size())*cell_width,
+    drawing_height + top_margin));
+
+
+  // draw min value and max value
+  const int min_tr_width = static_cast<int>(2 * (std::floor(min_value)*cell_width + left_margin));
+  const int max_tr_width = static_cast<int>(
+    2 * ((histo_data.size() - std::floor(max_value))*cell_width + left_margin));
+  const int tr_y = drawing_height + top_margin + text_margin;
+
+  painter.setPen(get_histogram_color(min_value));
+  QRect min_text_rect(0, tr_y, min_tr_width, text_height);
+  painter.drawText(min_text_rect, Qt::AlignCenter, tr("%1").arg(min_value, 0, 'f', 1));
+
+  painter.setPen(get_histogram_color(max_value));
+  QRect max_text_rect(width - max_tr_width, tr_y, max_tr_width, text_height);
+  painter.drawText(max_text_rect, Qt::AlignCenter, tr("%1").arg(max_value, 0, 'f', 1));
+}
+
+QColor
+Scene_c3t3_item::get_histogram_color(const double v) const
+{
+  if (v < 5)            { return Qt::red; }
+  else if (v < 10)      { return QColor(215, 108, 0); }
+  else if (v < 15)      { return QColor(138, 139, 0); }
+  else if (v < 165)     { return QColor(60, 136, 64); }
+  else if (v < 170)     { return QColor(138, 139, 1); }
+  else if (v < 175)     { return QColor(215, 108, 0); }
+  else /* 175<v<=180 */   { return Qt::red; }
+}
+
+void
+Scene_c3t3_item::update_histogram()
+{
+  build_histogram();
+}
+
+void
+Scene_c3t3_item_priv::compute_color_map(const QColor& c)
+{
+  typedef Indices::size_type size_type;
+
+  size_type nb_domains = indices_.size();
+  size_type i = 0;
+  for (Indices::iterator it = indices_.begin(), end = indices_.end();
+    it != end; ++it, ++i)
+  {
+    double hue = c.hueF() + 1. / nb_domains * i;
+    if (hue > 1) { hue -= 1.; }
+    colors[*it] = QColor::fromHsvF(hue, c.saturationF(), c.valueF());
+  }
+}
+
+Kernel::Plane_3 Scene_c3t3_item::plane() const {
+  const qglviewer::Vec& pos = d->frame->position();
+  const qglviewer::Vec& n =
+    d->frame->inverseTransformOf(qglviewer::Vec(0.f, 0.f, 1.f));
+  return Kernel::Plane_3(n[0], n[1], n[2], -n * pos);
+}
+
+void Scene_c3t3_item::compute_bbox() const {
+  if (isEmpty())
+    _bbox = Bbox();
+  else {
+    CGAL::Bbox_3 result;
+    for (Tr::Finite_vertices_iterator
+           vit = ++c3t3().triangulation().finite_vertices_begin(),
+           end = c3t3().triangulation().finite_vertices_end();
+         vit != end; ++vit)
+    {
+      if(vit->in_dimension() == -1) continue;
+      result = result + vit->point().bbox();
+    }
+    _bbox = Bbox(result.xmin(), result.ymin(), result.zmin(),
+                 result.xmax(), result.ymax(), result.zmax());
+  }
+}
+
+QString Scene_c3t3_item::toolTip() const {
+  return tr("<p><b>3D complex in a 3D triangulation</b></p>"
+    "<p>Number of vertices: %1<br />"
+    "Number of surface facets: %2<br />"
+    "Number of volume tetrahedra: %3</p>%4")
+    .arg(c3t3().triangulation().number_of_vertices())
+    .arg(c3t3().number_of_facets_in_complex())
+    .arg(c3t3().number_of_cells_in_complex())
+    .arg(property("toolTip").toString());
+}
+
+void Scene_c3t3_item::draw(CGAL::Three::Viewer_interface* viewer) const {
+  Scene_c3t3_item* ncthis = const_cast<Scene_c3t3_item*>(this);
+
+  if (!are_buffers_filled)
+  {
+    ncthis->d->computeElements();
+    ncthis->d->initializeBuffers(viewer);
+  }
+
+  vaos[Scene_c3t3_item_priv::Grid]->bind();
+  d->program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
+  attribBuffers(viewer, PROGRAM_WITHOUT_LIGHT);
+  d->program->bind();
+  d->program->setAttributeValue("colors", QColor(Qt::black));
+  QMatrix4x4 f_mat;
+  for (int i = 0; i<16; i++)
+    f_mat.data()[i] = d->frame->matrix()[i];
+  d->program->setUniformValue("f_matrix", f_mat);
+  viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(d->positions_grid.size() / 3));
+  d->program->release();
+  vaos[Scene_c3t3_item_priv::Grid]->release();
+
+  vaos[Scene_c3t3_item_priv::Facets]->bind();
+  d->program = getShaderProgram(PROGRAM_C3T3);
+  attribBuffers(viewer, PROGRAM_C3T3);
+  d->program->bind();
+  QVector4D cp(this->plane().a(),this->plane().b(),this->plane().c(),this->plane().d());
+  d->program->setUniformValue("cutplane", cp);
+  // positions_poly_size is the number of total facets in the C3T3
+  // it is only computed once and positions_poly is emptied at the end
+  viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(d->positions_poly_size / 3));
+  d->program->release();
+  vaos[Scene_c3t3_item_priv::Facets]->release();
+
+  if(d->show_tetrahedra){
+    if(!d->frame->isManipulated() && !d->are_intersection_buffers_filled)
+    {
+      if(!d->intersection->visible())
+        d->intersection->setVisible(true);
+      ncthis->d->computeIntersections();
+      d->intersection->initialize_buffers(viewer);
+      d->are_intersection_buffers_filled = true;
+    }
+    else if(d->frame->isManipulated() && d->intersection->visible())
+      d->intersection->setVisible(false);
+  }
+
+  if(d->spheres_are_shown)
+  {
+    d->spheres->setPlane(this->plane());
+  }
+  Scene_group_item::draw(viewer);
+}
+
+void Scene_c3t3_item::drawEdges(CGAL::Three::Viewer_interface* viewer) const {
+  if(renderingMode() == FlatPlusEdges)
+  {
+    GLint renderMode;
+    glGetIntegerv(GL_RENDER_MODE, &renderMode);
+    if(renderMode == GL_SELECT) return;
+  }
+  Scene_c3t3_item* ncthis = const_cast<Scene_c3t3_item*>(this);
+  if (!are_buffers_filled)
+  {
+    ncthis->d->computeElements();
+    ncthis->d->initializeBuffers(viewer);
+  }
+
+  if(renderingMode() == Wireframe)
+  {
+    vaos[Scene_c3t3_item_priv::Grid]->bind();
+
+    d->program = getShaderProgram(PROGRAM_NO_SELECTION);
+    attribBuffers(viewer, PROGRAM_NO_SELECTION);
+    d->program->bind();
+    d->program->setAttributeValue("colors", QColor(Qt::black));
+    QMatrix4x4 f_mat;
+    for (int i = 0; i<16; i++)
+        f_mat.data()[i] = d->frame->matrix()[i];
+    d->program->setUniformValue("f_matrix", f_mat);
+    viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(d->positions_grid.size() / 3));
+    d->program->release();
+    vaos[Scene_c3t3_item_priv::Grid]->release();
+  }
+  vaos[Scene_c3t3_item_priv::Edges]->bind();
+  d->program = getShaderProgram(PROGRAM_C3T3_EDGES);
+  attribBuffers(viewer, PROGRAM_C3T3_EDGES);
+  d->program->bind();
+  QVector4D cp(this->plane().a(),this->plane().b(),this->plane().c(),this->plane().d());
+  d->program->setUniformValue("cutplane", cp);
+  d->program->setAttributeValue("colors", QColor(Qt::black));
+  viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(d->positions_lines_size / 3));
+  d->program->release();
+  vaos[Scene_c3t3_item_priv::Edges]->release();
+
+  if(d->show_tetrahedra){
+    if(!d->frame->isManipulated() && !d->are_intersection_buffers_filled)
+    {
+      if(!d->intersection->visible())
+        d->intersection->setVisible(true);
+      ncthis->d->computeIntersections();
+      d->intersection->initialize_buffers(viewer);
+      d->are_intersection_buffers_filled = true;
+    }
+    else if(d->frame->isManipulated() && d->intersection->visible())
+      d->intersection->setVisible(false);
+  }
+  if(d->spheres_are_shown)
+  {
+      d->spheres->setPlane(this->plane());
+  }
+  Scene_group_item::drawEdges(viewer);
+  if(d->cnc_are_shown)
+  {
+    vaos[Scene_c3t3_item_priv::CNC]->bind();
+    d->program = getShaderProgram(PROGRAM_NO_SELECTION);
+    attribBuffers(viewer, PROGRAM_NO_SELECTION);
+    d->program->bind();
+    d->program->setAttributeValue("colors", QColor(Qt::black));
+    viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(d->positions_lines_not_in_complex_size / 3));
+    d->program->release();
+    vaos[Scene_c3t3_item_priv::CNC]->release();
+  }
+}
+
+void Scene_c3t3_item::drawPoints(CGAL::Three::Viewer_interface * viewer) const
+{
+  Scene_c3t3_item* ncthis = const_cast<Scene_c3t3_item*>(this);
+  if (!are_buffers_filled)
+  {
+    ncthis->d->computeElements();
+    ncthis->d->initializeBuffers(viewer);
+  }
+  vaos[Scene_c3t3_item_priv::Edges]->bind();
+  d->program = getShaderProgram(PROGRAM_C3T3_EDGES);
+  attribBuffers(viewer, PROGRAM_C3T3_EDGES);
+  d->program->bind();
+  QVector4D cp(this->plane().a(),this->plane().b(),this->plane().c(),this->plane().d());
+  d->program->setUniformValue("cutplane", cp);
+  d->program->setAttributeValue("colors", this->color());
+  viewer->glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(d->positions_lines.size() / 3));
+  vaos[Scene_c3t3_item_priv::Edges]->release();
+  d->program->release();
+
+  vaos[Scene_c3t3_item_priv::Grid]->bind();
+  d->program = getShaderProgram(PROGRAM_NO_SELECTION);
+  attribBuffers(viewer, PROGRAM_NO_SELECTION);
+  d->program->bind();
+  d->program->setAttributeValue("colors", this->color());
+  QMatrix4x4 f_mat;
+  for (int i = 0; i<16; i++)
+    f_mat.data()[i] = d->frame->matrix()[i];
+  d->program->setUniformValue("f_matrix", f_mat);
+  viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(d->positions_grid.size() / 3));
+  d->program->release();
+  vaos[Scene_c3t3_item_priv::Grid]->release();
+  if(d->spheres_are_shown)
+  {
+    d->spheres->setPlane(this->plane());
+  }
+  Scene_group_item::drawEdges(viewer);
+
+}
+
+void Scene_c3t3_item_priv::draw_triangle(const Kernel::Point_3& pa,
+  const Kernel::Point_3& pb,
+  const Kernel::Point_3& pc) const
+{
+
+  #undef darker
+  Kernel::Vector_3 n = cross_product(pb - pa, pc - pa);
+  n = n / CGAL::sqrt(n*n);
+
+
+  for (int i = 0; i<3; i++)
+  {
+    normals.push_back(n.x());
+    normals.push_back(n.y());
+    normals.push_back(n.z());
+  }
+  positions_poly.push_back(pa.x());
+  positions_poly.push_back(pa.y());
+  positions_poly.push_back(pa.z());
+
+  positions_poly.push_back(pb.x());
+  positions_poly.push_back(pb.y());
+  positions_poly.push_back(pb.z());
+
+  positions_poly.push_back(pc.x());
+  positions_poly.push_back(pc.y());
+  positions_poly.push_back(pc.z());
+
+
+
+}
+
+void Scene_c3t3_item_priv::draw_triangle_edges(const Kernel::Point_3& pa,
+  const Kernel::Point_3& pb,
+  const Kernel::Point_3& pc)const {
+
+#undef darker
+  positions_lines.push_back(pa.x());
+  positions_lines.push_back(pa.y());
+  positions_lines.push_back(pa.z());
+
+  positions_lines.push_back(pb.x());
+  positions_lines.push_back(pb.y());
+  positions_lines.push_back(pb.z());
+
+  positions_lines.push_back(pb.x());
+  positions_lines.push_back(pb.y());
+  positions_lines.push_back(pb.z());
+
+  positions_lines.push_back(pc.x());
+  positions_lines.push_back(pc.y());
+  positions_lines.push_back(pc.z());
+
+  positions_lines.push_back(pc.x());
+  positions_lines.push_back(pc.y());
+  positions_lines.push_back(pc.z());
+
+  positions_lines.push_back(pa.x());
+  positions_lines.push_back(pa.y());
+  positions_lines.push_back(pa.z());
+
+}
+void Scene_c3t3_item_priv::draw_triangle_edges_cnc(const Kernel::Point_3& pa,
+                                          const Kernel::Point_3& pb,
+                                          const Kernel::Point_3& pc)const {
+
+#undef darker
+  positions_lines_not_in_complex.push_back(pa.x());
+  positions_lines_not_in_complex.push_back(pa.y());
+  positions_lines_not_in_complex.push_back(pa.z());
+
+  positions_lines_not_in_complex.push_back(pb.x());
+  positions_lines_not_in_complex.push_back(pb.y());
+  positions_lines_not_in_complex.push_back(pb.z());
+
+  positions_lines_not_in_complex.push_back(pb.x());
+  positions_lines_not_in_complex.push_back(pb.y());
+  positions_lines_not_in_complex.push_back(pb.z());
+
+  positions_lines_not_in_complex.push_back(pc.x());
+  positions_lines_not_in_complex.push_back(pc.y());
+  positions_lines_not_in_complex.push_back(pc.z());
+
+  positions_lines_not_in_complex.push_back(pc.x());
+  positions_lines_not_in_complex.push_back(pc.y());
+  positions_lines_not_in_complex.push_back(pc.z());
+
+  positions_lines_not_in_complex.push_back(pa.x());
+  positions_lines_not_in_complex.push_back(pa.y());
+  positions_lines_not_in_complex.push_back(pa.z());
+
+}
+
+double Scene_c3t3_item_priv::complex_diag() const {
+  const CGAL::Three::Scene_item::Bbox& bbox = item->bbox();
+  const double& xdelta = bbox.xmax() - bbox.xmin();
+  const double& ydelta = bbox.ymax() - bbox.ymin();
+  const double& zdelta = bbox.zmax() - bbox.zmin();
+  const double diag = std::sqrt(xdelta*xdelta +
+    ydelta*ydelta +
+    zdelta*zdelta);
+  return diag * 0.7;
+}
+
+void Scene_c3t3_item::export_facets_in_complex()
+{
+  std::set<C3t3::Vertex_handle> vertex_set;
+  for (C3t3::Facets_in_complex_iterator fit = c3t3().facets_in_complex_begin();
+       fit != c3t3().facets_in_complex_end();
+       ++fit)
+  {
+    vertex_set.insert(fit->first->vertex((fit->second + 1) % 4));
+    vertex_set.insert(fit->first->vertex((fit->second + 2) % 4));
+    vertex_set.insert(fit->first->vertex((fit->second + 3) % 4));
+  }
+
+  std::map<C3t3::Vertex_handle, std::size_t> indices;
+  std::vector<Kernel::Point_3> points(vertex_set.size());
+  std::vector<std::vector<std::size_t> > polygons(c3t3().number_of_facets_in_complex());
+
+  std::size_t index = 0;
+  BOOST_FOREACH(C3t3::Vertex_handle v, vertex_set)
+  {
+    points[index] = v->point();
+    indices.insert(std::make_pair(v, index));
+    index++;
+  }
+  index = 0;
+  for (C3t3::Facets_in_complex_iterator fit = c3t3().facets_in_complex_begin();
+       fit != c3t3().facets_in_complex_end();
+       ++fit, ++index)
+  {
+    std::vector<std::size_t> facet(3);
+    facet[0] = indices.at(fit->first->vertex((fit->second + 1) % 4));
+    facet[1] = indices.at(fit->first->vertex((fit->second + 2) % 4));
+    facet[2] = indices.at(fit->first->vertex((fit->second + 3) % 4));
+    polygons[index] = facet;
+  }
+
+  namespace PMP = CGAL::Polygon_mesh_processing;
+  Polyhedron outmesh;
+
+  if (PMP::is_polygon_soup_a_polygon_mesh(polygons))
+  {
+    CGAL_assertion_code(bool orientable = )
+    PMP::orient_polygon_soup(points, polygons);
+    CGAL_assertion(orientable);
+
+    PMP::polygon_soup_to_polygon_mesh(points, polygons, outmesh);
+    Scene_polyhedron_item* item = new Scene_polyhedron_item(outmesh);
+    item->setName(QString("%1_%2").arg(this->name()).arg("facets"));
+    scene->addItem(item);
+  }
+  else
+  {
+    Scene_polygon_soup_item* soup_item = new Scene_polygon_soup_item;
+    soup_item->load(points, polygons);
+    soup_item->setName(QString("%1_%2").arg(this->name()).arg("facets"));
+    scene->addItem(soup_item);
+  }
+  this->setVisible(false);
+}
+
+QMenu* Scene_c3t3_item::contextMenu()
+{
+  const char* prop_name = "Menu modified by Scene_c3t3_item.";
+
+  QMenu* menu = Scene_item::contextMenu();
+
+  // Use dynamic properties:
+  // http://doc.qt.io/qt-5/qobject.html#property
+  bool menuChanged = menu->property(prop_name).toBool();
+
+  if (!menuChanged) {
+    QAction* actionExportFacetsInComplex =
+      menu->addAction(tr("Export facets in complex"));
+    actionExportFacetsInComplex->setObjectName("actionExportFacetsInComplex");
+    connect(actionExportFacetsInComplex,
+      SIGNAL(triggered()), this,
+      SLOT(export_facets_in_complex()));
+
+    QAction* actionShowSpheres =
+      menu->addAction(tr("Show protecting &spheres"));
+    actionShowSpheres->setCheckable(true);
+    actionShowSpheres->setObjectName("actionShowSpheres");
+    connect(actionShowSpheres, SIGNAL(toggled(bool)),
+            this, SLOT(show_spheres(bool)));
+
+    QAction* actionShowCNC =
+      menu->addAction(tr("Show cells not in complex"));
+    actionShowCNC->setCheckable(true);
+    actionShowCNC->setObjectName("actionShowCNC");
+    connect(actionShowCNC, SIGNAL(toggled(bool)),
+            this, SLOT(show_cnc(bool)));
+
+    QAction* actionShowTets =
+      menu->addAction(tr("Show &tetrahedra"));
+    actionShowTets->setCheckable(true);
+    actionShowTets->setObjectName("actionShowTets");
+    connect(actionShowTets, &QAction::toggled, Set_show_tetrahedra(this->d));
+
+    menu->setProperty(prop_name, true);
+  }
+  return menu;
+}
+
+
+void Scene_c3t3_item_priv::initializeBuffers(CGAL::Three::Viewer_interface *viewer)
+{
+  //vao containing the data for the facets
+  {
+    program = item->getShaderProgram(Scene_c3t3_item::PROGRAM_C3T3, viewer);
+    program->bind();
+
+    item->vaos[Facets]->bind();
+    item->buffers[Facet_vertices].bind();
+    item->buffers[Facet_vertices].allocate(positions_poly.data(),
+      static_cast<int>(positions_poly.size()*sizeof(float)));
+    program->enableAttributeArray("vertex");
+    program->setAttributeBuffer("vertex", GL_FLOAT, 0, 3);
+    item->buffers[Facet_vertices].release();
+
+    item->buffers[Facet_normals].bind();
+    item->buffers[Facet_normals].allocate(normals.data(),
+      static_cast<int>(normals.size()*sizeof(float)));
+    program->enableAttributeArray("normals");
+    program->setAttributeBuffer("normals", GL_FLOAT, 0, 3);
+    item->buffers[Facet_normals].release();
+
+    item->buffers[Facet_colors].bind();
+    item->buffers[Facet_colors].allocate(f_colors.data(),
+      static_cast<int>(f_colors.size()*sizeof(float)));
+    program->enableAttributeArray("colors");
+    program->setAttributeBuffer("colors", GL_FLOAT, 0, 3);
+    item->buffers[Facet_colors].release();
+
+    item->vaos[Facets]->release();
+    program->release();
+    
+    positions_poly_size = positions_poly.size();
+    positions_poly.clear();
+    positions_poly.swap(positions_poly);
+    normals.clear();
+    normals.swap(normals);
+    f_colors.clear();
+    f_colors.swap(f_colors);
+  }
+
+  //vao containing the data for the lines
+  {
+    program = item->getShaderProgram(Scene_c3t3_item::PROGRAM_C3T3_EDGES, viewer);
+    program->bind();
+
+    item->vaos[Edges]->bind();
+    item->buffers[Edges_vertices].bind();
+    item->buffers[Edges_vertices].allocate(positions_lines.data(),
+                                     static_cast<int>(positions_lines.size()*sizeof(float)));
+    program->enableAttributeArray("vertex");
+    program->setAttributeBuffer("vertex", GL_FLOAT, 0, 3);
+    item->buffers[Edges_vertices].release();
+
+    item->vaos[Edges]->release();
+    program->release();
+
+    positions_lines_size = positions_lines.size();
+    positions_lines.clear();
+    positions_lines.swap(positions_lines);
+    
+  }
+
+  // vao containing the data for the cnc
+  {
+    program = item->getShaderProgram(Scene_c3t3_item::PROGRAM_NO_SELECTION, viewer);
+    program->bind();
+
+    item->vaos[CNC]->bind();
+    item->buffers[Edges_CNC].bind();
+    item->buffers[Edges_CNC].allocate(positions_lines_not_in_complex.data(),
+                                     static_cast<int>(positions_lines_not_in_complex.size()*sizeof(float)));
+    program->enableAttributeArray("vertex");
+    program->setAttributeBuffer("vertex", GL_FLOAT, 0, 3);
+    item->buffers[Edges_CNC].release();
+
+    item->vaos[CNC]->release();
+    program->release();
+
+    positions_lines_not_in_complex_size = positions_lines_not_in_complex.size();
+    positions_lines_not_in_complex.clear();
+    positions_lines_not_in_complex.swap(positions_lines_not_in_complex);
+
+  }
+
+  //vao containing the data for the grid
+  {
+    program = item->getShaderProgram(Scene_c3t3_item::PROGRAM_NO_SELECTION, viewer);
+    program->bind();
+
+    item->vaos[Grid]->bind();
+    item->buffers[Grid_vertices].bind();
+    item->buffers[Grid_vertices].allocate(positions_grid.data(),
+                                    static_cast<int>(positions_grid.size()*sizeof(float)));
+    program->enableAttributeArray("vertex");
+    program->setAttributeBuffer("vertex", GL_FLOAT, 0, 3);
+    item->buffers[Grid_vertices].release();
+    item->vaos[Grid]->release();
+    program->release();
+  }
+
+    program->release();
+    item->are_buffers_filled = true;
+}
+
+
+
+void Scene_c3t3_item_priv::computeIntersection(const Primitive& facet)
+{
+  const Kernel::Point_3& pa = facet.id().first->vertex(0)->point();
+  const Kernel::Point_3& pb = facet.id().first->vertex(1)->point();
+  const Kernel::Point_3& pc = facet.id().first->vertex(2)->point();
+  const Kernel::Point_3& pd = facet.id().first->vertex(3)->point();
+
+  QColor c = this->colors[facet.id().first->subdomain_index()].darker(150);
+
+  CGAL::Color color(c.red(), c.green(), c.blue());
+
+  intersection->addTriangle(pb, pa, pc, color);
+  intersection->addTriangle(pa, pb, pd, color);
+  intersection->addTriangle(pa, pd, pc, color);
+  intersection->addTriangle(pb, pc, pd, color);
+
+  {
+    Tr::Cell_handle nh = facet.id().first->neighbor(facet.id().second);
+    if(c3t3.is_in_complex(nh)){
+      const Kernel::Point_3& pa = nh->vertex(0)->point();
+      const Kernel::Point_3& pb = nh->vertex(1)->point();
+      const Kernel::Point_3& pc = nh->vertex(2)->point();
+      const Kernel::Point_3& pd = nh->vertex(3)->point();
+
+      intersection->addTriangle(pb, pa, pc, color);
+      intersection->addTriangle(pa, pb, pd, color);
+      intersection->addTriangle(pa, pd, pc, color);
+      intersection->addTriangle(pb, pc, pd, color);
+    }
+  }
+
+}
+
+struct ComputeIntersection {
+  Scene_c3t3_item_priv& item_priv;
+
+  ComputeIntersection(Scene_c3t3_item_priv& item_priv)
+    : item_priv(item_priv)
+  {}
+
+  void operator()(const Primitive& facet) const
+  {
+    item_priv.computeIntersection(facet);
+  }
+};
+
+void Scene_c3t3_item_priv::computeIntersections()
+{
+  if(!is_aabb_tree_built) fill_aabb_tree();
+
+  positions_poly.clear();
+  normals.clear();
+  f_colors.clear();
+  positions_lines.clear();
+  const Kernel::Plane_3& plane = item->plane();
+  tree.all_intersected_primitives(plane,
+        boost::make_function_output_iterator(ComputeIntersection(*this)));
+}
+
+void Scene_c3t3_item_priv::computeSpheres()
+{
+  if(!spheres)
+    return;
+  for(Tr::Finite_vertices_iterator
+      vit = c3t3.triangulation().finite_vertices_begin(),
+      end =  c3t3.triangulation().finite_vertices_end();
+      vit != end; ++vit)
+  {
+    if(vit->point().weight()==0) continue;
+
+    typedef Tr::Vertex_handle Vertex_handle;
+    std::vector<Vertex_handle> incident_vertices;
+    c3t3.triangulation().incident_vertices(vit, std::back_inserter(incident_vertices));
+    bool red = vit->is_special();
+    for(std::vector<Vertex_handle>::const_iterator
+        vvit = incident_vertices.begin(), end = incident_vertices.end();
+        vvit != end; ++vvit)
+    {
+      if(Kernel::Sphere_3(vit->point().point(),
+                          vit->point().weight()).bounded_side((*vvit)->point().point())
+         == CGAL::ON_BOUNDED_SIDE)
+        red = true;
+    }
+    QColor c;
+    if(red)
+      c = QColor(Qt::red);
+    else
+      c = spheres->color().darker(250);
+    Kernel::Point_3 center(vit->point().point().x(),
+    vit->point().point().y(),
+    vit->point().point().z());
+    float radius = CGAL::sqrt(vit->point().weight());
+    Kernel::Sphere_3* sphere = new Kernel::Sphere_3(center, radius);
+    spheres->add_sphere(sphere, CGAL::Color(c.red(), c.green(), c.blue()));
+  }
+  spheres->invalidateOpenGLBuffers();
+}
+
+void Scene_c3t3_item_priv::computeElements()
+{
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  positions_poly.clear();
+  normals.clear();
+  f_colors.clear();
+  positions_lines.clear();
+  positions_lines_not_in_complex.clear();
+  s_colors.resize(0);
+  s_center.resize(0);
+  s_radius.resize(0);
+
+
+  //The grid
+  {
+    float x = (2 * (float)complex_diag()) / 10.0;
+    float y = (2 * (float)complex_diag()) / 10.0;
+    for (int u = 0; u < 11; u++)
+    {
+
+      positions_grid.push_back(-(float)complex_diag() + x* u);
+      positions_grid.push_back(-(float)complex_diag());
+      positions_grid.push_back(0.0);
+
+      positions_grid.push_back(-(float)complex_diag() + x* u);
+      positions_grid.push_back((float)complex_diag());
+      positions_grid.push_back(0.0);
+    }
+    for (int v = 0; v<11; v++)
+    {
+
+      positions_grid.push_back(-(float)complex_diag());
+      positions_grid.push_back(-(float)complex_diag() + v * y);
+      positions_grid.push_back(0.0);
+
+      positions_grid.push_back((float)complex_diag());
+      positions_grid.push_back(-(float)complex_diag() + v * y);
+      positions_grid.push_back(0.0);
+    }
+  }
+
+
+  if (item->isEmpty()){
+    return;
+  }
+  //The facets
+  {  
+    for (C3t3::Facet_iterator
+      fit = c3t3.facets_begin(),
+      end = c3t3.facets_end();
+    fit != end; ++fit)
+    {
+      const Tr::Cell_handle& cell = fit->first;
+      const int& index = fit->second;
+      const Kernel::Point_3& pa = cell->vertex((index + 1) & 3)->point();
+      const Kernel::Point_3& pb = cell->vertex((index + 2) & 3)->point();
+      const Kernel::Point_3& pc = cell->vertex((index + 3) & 3)->point();
+
+      QColor color = colors[cell->surface_patch_index(index)];
+      f_colors.push_back(color.redF());f_colors.push_back(color.greenF());f_colors.push_back(color.blueF());
+      f_colors.push_back(color.redF());f_colors.push_back(color.greenF());f_colors.push_back(color.blueF());
+      f_colors.push_back(color.redF());f_colors.push_back(color.greenF());f_colors.push_back(color.blueF());
+      if ((index % 2 == 1) == c3t3.is_in_complex(cell))
+        draw_triangle(pb, pa, pc);
+      else draw_triangle(pa, pb, pc);
+      draw_triangle_edges(pa, pb, pc);
+    }
+    //Kernel::Point_3 p0(10, 10, 10);
+    //c3t3().add_far_point(p0);
+    //the cells not in the complex
+    for(C3t3::Triangulation::Cell_iterator
+        cit = c3t3.triangulation().finite_cells_begin(),
+        end = c3t3.triangulation().finite_cells_end();
+        cit != end; ++cit)
+    {
+      if(!c3t3.is_in_complex(cit))
+      {
+
+        bool has_far_point = false;
+        for(int i=0; i<4; i++)
+          if(c3t3.in_dimension(cit->vertex(i)) == -1)
+          {
+            has_far_point = true;
+            break;
+          }
+        if(!has_far_point)
+        {
+          const Kernel::Point_3& p1 = cit->vertex(0)->point();
+          const Kernel::Point_3& p2 = cit->vertex(1)->point();
+          const Kernel::Point_3& p3 = cit->vertex(2)->point();
+          const Kernel::Point_3& p4 = cit->vertex(3)->point();
+          draw_triangle_edges_cnc(p1, p2, p4);
+          draw_triangle_edges_cnc(p1, p3, p4);
+          draw_triangle_edges_cnc(p2, p3, p4);
+          draw_triangle_edges_cnc(p1, p2, p3);
+        }
+      }
+    }
+
+  }
+  QApplication::restoreOverrideCursor();
+}
+
+bool Scene_c3t3_item::load_binary(std::istream& is)
+{
+  if(!CGAL::Mesh_3::load_binary_file(is, c3t3())) return false;
+  if(is && d->frame == 0) {
+    d->frame = new qglviewer::ManipulatedFrame();
+  }
+  d->reset_cut_plane();
+  if(is.good()) {
+    c3t3_changed();
+    changed();
+    return true;
+  }
+  else
+    return false;
+}
+
+void
+Scene_c3t3_item_priv::reset_cut_plane() {
+  const CGAL::Three::Scene_item::Bbox& bbox = item->bbox();
+  const float xcenter = static_cast<float>((bbox.xmax()+bbox.xmin())/2.);
+  const float ycenter = static_cast<float>((bbox.ymax()+bbox.ymin())/2.);
+  const float zcenter = static_cast<float>((bbox.zmax()+bbox.zmin())/2.);
+
+  frame->setPosition(qglviewer::Vec(xcenter, ycenter, zcenter));
+}
+
+void
+Scene_c3t3_item::setColor(QColor c)
+{
+  color_ = c;
+  d->compute_color_map(c);
+  invalidateOpenGLBuffers();
+  d->are_intersection_buffers_filled = false;
+}
+void Scene_c3t3_item::show_spheres(bool b)
+{
+  d->spheres_are_shown = b;
+  if(b && !d->spheres)
+  {
+    d->spheres = new Scene_spheres_item(this, true);
+    d->spheres->setName("Protecting spheres");
+    d->spheres->setRenderingMode(Gouraud);
+    connect(d->spheres, SIGNAL(destroyed()), this, SLOT(reset_spheres()));
+    scene->addItem(d->spheres);
+    scene->changeGroup(d->spheres, this);
+    lockChild(d->spheres);
+    d->computeSpheres();
+  }
+  else if (!b && d->spheres!=NULL)
+  {
+    unlockChild(d->spheres);
+    scene->erase(scene->item_id(d->spheres));
+  }
+  Q_EMIT redraw();
+
+}
+void Scene_c3t3_item::show_intersection(bool b)
+{
+  if(b && !d->intersection)
+  {
+    d->intersection = new Scene_intersection_item(this);
+    d->intersection->init_vectors(&d->positions_poly,
+                               &d->normals,
+                               &d->positions_lines,
+                               &d->f_colors);
+    d->intersection->setName("Intersection tetrahedra");
+    d->intersection->setRenderingMode(renderingMode());
+    connect(d->intersection, SIGNAL(destroyed()), this, SLOT(reset_intersection_item()));
+    scene->addItem(d->intersection);
+    scene->changeGroup(d->intersection, this);
+    lockChild(d->intersection);
+    d->are_intersection_buffers_filled = false;
+  }
+  else if (!b && d->intersection!=NULL)
+  {
+    unlockChild(d->intersection);
+    scene->erase(scene->item_id(d->intersection));
+  }
+  Q_EMIT redraw();
+
+}
+void Scene_c3t3_item::show_cnc(bool b)
+{
+  d->cnc_are_shown = b;
+  Q_EMIT redraw();
+
+}
+
+void Scene_c3t3_item::reset_intersection_item()
+{
+  d->intersection = NULL;
+}
+
+void Scene_c3t3_item::reset_spheres()
+{
+  d->spheres = NULL;
+}
+CGAL::Three::Scene_item::ManipulatedFrame* Scene_c3t3_item::manipulatedFrame() {
+  return d->frame;
+}
+
+void Scene_c3t3_item::setPosition(float x, float y, float z) {
+  d->frame->setPosition(x, y, z);
+}
+
+void Scene_c3t3_item::setNormal(float x, float y, float z) {
+  d->frame->setOrientation(x, y, z, 0.f);
+}
+#include "Scene_c3t3_item.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Scene_c3t3_item.h b/3rdparty/CGAL/demo/Polyhedron/Scene_c3t3_item.h
new file mode 100644
index 0000000..762700d
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Scene_c3t3_item.h
@@ -0,0 +1,142 @@
+#ifndef SCENE_C3T3_ITEM_H
+#define SCENE_C3T3_ITEM_H
+
+#include "Scene_c3t3_item_config.h"
+#include "C3t3_type.h"
+
+#include <QVector>
+#include <QColor>
+#include <QPixmap>
+#include <QMenu>
+#include <set>
+
+#include <QtCore/qglobal.h>
+#include <CGAL/gl.h>
+#include <QGLViewer/manipulatedFrame.h>
+#include <QGLViewer/qglviewer.h>
+#include <QOpenGLVertexArrayObject>
+#include <QOpenGLBuffer>
+#include <QOpenGLShaderProgram>
+
+#include <CGAL/Three/Viewer_interface.h>
+#include <CGAL/Three/Scene_group_item.h>
+#include <Scene_polyhedron_item.h>
+#include <Scene_polygon_soup_item.h>
+#include <CGAL/IO/File_binary_mesh_3.h>
+
+struct Scene_c3t3_item_priv;
+class Scene_spheres_item;
+class Scene_intersection_item;
+using namespace CGAL::Three;
+  class SCENE_C3T3_ITEM_EXPORT Scene_c3t3_item
+  : public Scene_group_item
+{
+  Q_OBJECT
+public:
+  typedef qglviewer::ManipulatedFrame ManipulatedFrame;
+
+  Scene_c3t3_item();
+  Scene_c3t3_item(const C3t3& c3t3);
+  ~Scene_c3t3_item();
+  void setColor(QColor c);
+  bool save_binary(std::ostream& os) const
+  {
+    return CGAL::Mesh_3::save_binary_file(os, c3t3());
+  }
+  bool save_ascii(std::ostream& os) const
+  {
+      os << "ascii CGAL c3t3 " << CGAL::Get_io_signature<C3t3>()() << "\n";
+      CGAL::set_ascii_mode(os);
+      return !!(os << c3t3());
+  }
+
+  void invalidateOpenGLBuffers()
+  {
+    are_buffers_filled = false;
+    compute_bbox();
+  }
+
+  void c3t3_changed();
+
+  const C3t3& c3t3() const;
+  C3t3& c3t3();
+
+  bool manipulatable() const {
+    return true;
+  }
+  ManipulatedFrame* manipulatedFrame();
+
+  void setPosition(float x, float y, float z) ;
+
+  void setNormal(float x, float y, float z) ;
+
+  Kernel::Plane_3 plane() const;
+
+  bool isFinite() const { return true; }
+  bool isEmpty() const {
+    return c3t3().triangulation().number_of_vertices() == 0
+      || (    c3t3().number_of_vertices_in_complex() == 0
+           && c3t3().number_of_facets_in_complex()   == 0
+           && c3t3().number_of_cells_in_complex()    == 0  );
+  }
+
+
+  void compute_bbox() const;
+  Scene_item::Bbox bbox() const
+  {
+      return Scene_item::bbox();
+  }
+  Scene_c3t3_item* clone() const {
+    return 0;
+  }
+
+  bool load_binary(std::istream& is);
+
+  // data item
+  const Scene_item* data_item() const;
+  void set_data_item(const Scene_item* data_item);
+
+  QString toolTip() const;
+
+  // Indicate if rendering mode is supported
+  bool supportsRenderingMode(RenderingMode m) const {
+    return (m != Gouraud && m != PointsPlusNormals && m != Splatting && m != Points);
+  }
+
+  void draw(CGAL::Three::Viewer_interface* viewer) const;
+  void drawEdges(CGAL::Three::Viewer_interface* viewer) const;
+  void drawPoints(CGAL::Three::Viewer_interface * viewer) const;
+  public:
+    QMenu* contextMenu();
+  public Q_SLOTS:
+  void export_facets_in_complex();
+
+  void data_item_destroyed();
+
+  void reset_spheres();
+
+  void reset_intersection_item();
+  void show_spheres(bool b);
+  void show_intersection(bool b);
+
+  void show_cnc(bool b);
+
+  virtual QPixmap graphicalToolTip() const;
+
+  void update_histogram();
+
+  void changed();
+
+  void updateCutPlane();
+
+  void build_histogram();
+
+  QColor get_histogram_color(const double v) const;
+
+  protected:
+    friend struct Scene_c3t3_item_priv;
+    Scene_c3t3_item_priv* d;
+
+};
+
+#endif // SCENE_C3T3_ITEM_H
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_c3t3_item_config.h b/3rdparty/CGAL/demo/Polyhedron/Scene_c3t3_item_config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Scene_c3t3_item_config.h
rename to 3rdparty/CGAL/demo/Polyhedron/Scene_c3t3_item_config.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_config.h b/3rdparty/CGAL/demo/Polyhedron/Scene_config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Scene_config.h
rename to 3rdparty/CGAL/demo/Polyhedron/Scene_config.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_find_items.h b/3rdparty/CGAL/demo/Polyhedron/Scene_find_items.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Scene_find_items.h
rename to 3rdparty/CGAL/demo/Polyhedron/Scene_find_items.h
diff --git a/3rdparty/CGAL/demo/Polyhedron/Scene_group_item.cpp b/3rdparty/CGAL/demo/Polyhedron/Scene_group_item.cpp
new file mode 100644
index 0000000..ec67467
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Scene_group_item.cpp
@@ -0,0 +1,236 @@
+#include <CGAL/Three/Scene_group_item.h>
+#include <CGAL/Three/Viewer_interface.h>
+#include <QDebug>
+
+using namespace CGAL::Three;
+Scene_group_item::Scene_group_item(QString name, int nb_vbos, int nb_vaos )
+    :  Scene_item(nb_vbos, nb_vaos)
+    , scene(NULL)
+{
+    this->name_ = name;
+    expanded = true;
+    already_drawn = false;
+}
+
+bool Scene_group_item::isFinite() const
+{
+    Q_FOREACH(Scene_item *item, children)
+        if(!item->isFinite()){
+            return false;
+        }
+    return true;
+}
+
+bool Scene_group_item::isEmpty() const {
+    Q_FOREACH(Scene_item *item, children)
+        if(!item->isEmpty()){
+            return true;
+        }
+    return true;
+}
+
+Scene_group_item::Bbox Scene_group_item::bbox() const
+{
+    return Bbox(0, 0, 0, 0, 0,0);
+}
+
+
+bool Scene_group_item::supportsRenderingMode(RenderingMode m) const {
+    Q_FOREACH(Scene_item* item, children)
+        if(!item->supportsRenderingMode(m))
+            return false;
+    return !children.isEmpty();
+
+}
+
+QString Scene_group_item::toolTip() const {
+    QString str =
+            QObject::tr( "<p>Number of children: %1<br />").arg(children.size());
+    str+="</p>";
+    return str;
+}
+
+void Scene_group_item::addChild(Scene_item* new_item)
+{  
+    if(!children.contains(new_item))
+    {
+        children.append(new_item);
+        update_group_number(new_item, has_group+1);
+    }
+
+}
+
+void Scene_group_item::update_group_number(Scene_item * new_item, int n)
+{
+
+    Scene_group_item* group =
+            qobject_cast<Scene_group_item*>(new_item);
+    if(group)
+      Q_FOREACH(Scene_item* child, group->getChildren())
+          update_group_number(child,n+1);
+    new_item->has_group = n;
+}
+void Scene_group_item::setColor(QColor c)
+{
+  Scene_item::setColor(c);
+  Q_FOREACH(Scene_item* child, children)
+  {
+    child->setColor(c);
+  }
+}
+
+void Scene_group_item::setRenderingMode(RenderingMode m)
+{
+  Scene_item::setRenderingMode(m);
+  Q_FOREACH(Scene_item* child, children)
+  {
+    if(child->supportsRenderingMode(m))
+      child->setRenderingMode(m);
+  }
+}
+
+void Scene_group_item::setVisible(bool b)
+{
+  Scene_item::setVisible(b);
+  Q_FOREACH(Scene_item* child, children)
+  {
+    child->setVisible(b);
+    child->itemChanged();
+  }
+    Q_EMIT itemChanged();
+}
+
+bool Scene_group_item::isExpanded() const
+{
+  return expanded;
+}
+
+void Scene_group_item::setExpanded(bool b)
+{
+    expanded = b;
+}
+
+void Scene_group_item::moveDown(int i)
+{
+    children.move(i, i+1);
+}
+
+void Scene_group_item::moveUp(int i)
+{
+    children.move(i, i-1);
+}
+
+void Scene_group_item::draw(CGAL::Three::Viewer_interface* viewer) const {
+  if(viewer->inDrawWithNames() || already_drawn ) return;
+  Q_FOREACH(Scene_item* child, children) {
+    if(!child->visible()) continue;
+    switch(child->renderingMode()) {
+    case Flat:
+    case FlatPlusEdges:
+    case Gouraud:
+      child->draw(viewer); break;
+    default: break;
+    }
+    switch(child->renderingMode()) {
+    case FlatPlusEdges:
+    case Wireframe:
+    case PointsPlusNormals:
+      child->drawEdges(viewer); break;
+    default: break;
+    }
+    switch(child->renderingMode()) {
+    case Points:
+    case PointsPlusNormals:
+      child->drawPoints(viewer); break;
+    default: break;
+    }
+  }
+  already_drawn = true;
+}
+
+void Scene_group_item::drawEdges(CGAL::Three::Viewer_interface* viewer) const
+{
+  if(viewer->inDrawWithNames() || already_drawn ) return;
+  Q_FOREACH(Scene_item* child, children) {
+    if(!child->visible()) continue;
+    switch(child->renderingMode()) {
+    case FlatPlusEdges:
+    case Wireframe:
+    case PointsPlusNormals:
+      child->drawEdges(viewer); break;
+    default: break;
+    }
+    switch(child->renderingMode()) {
+    case Flat:
+    case FlatPlusEdges:
+    case Gouraud:
+      child->draw(viewer); break;
+    default: break;
+    }
+    switch(child->renderingMode()) {
+    case Points:
+    case PointsPlusNormals:
+      child->drawPoints(viewer); break;
+    default: break;
+    }
+  }
+  already_drawn = true;
+}
+
+void Scene_group_item::drawPoints(CGAL::Three::Viewer_interface* viewer) const
+{
+  if(viewer->inDrawWithNames() || already_drawn ) return;
+  Q_FOREACH(Scene_item* child, children) {
+    if(!child->visible()) continue;
+    switch(child->renderingMode()) {
+    case Points:
+    case PointsPlusNormals:
+      child->drawPoints(viewer); break;
+    default: break;
+    }
+    switch(child->renderingMode()) {
+    case Flat:
+    case FlatPlusEdges:
+    case Gouraud:
+      child->draw(viewer); break;
+    default: break;
+    }
+    switch(child->renderingMode()) {
+    case FlatPlusEdges:
+    case Wireframe:
+    case PointsPlusNormals:
+      child->drawEdges(viewer); break;
+    default: break;
+    }
+  }
+  already_drawn = true;
+}
+
+void Scene_group_item::drawSplats(CGAL::Three::Viewer_interface* viewer) const
+{
+  if(viewer->inDrawWithNames()) return;
+  Q_FOREACH(Scene_item* child, children) {
+    if(child->visible() && child->renderingMode() == Splatting)
+      child->drawSplats(viewer);
+  }
+}
+
+void Scene_group_item::lockChild(Scene_item *child)
+{
+  if(!children.contains(child))
+    return;
+  child->setProperty("lock", true);
+}
+void Scene_group_item::unlockChild(Scene_item *child)
+{
+  if(!children.contains(child))
+    return;
+  child->setProperty("lock", false);
+}
+bool Scene_group_item::isChildLocked(Scene_item *child)
+{
+  if(!children.contains(child)
+     || (!child->property("lock").toBool()) )
+    return false;
+  return true;
+}
diff --git a/3rdparty/CGAL/demo/Polyhedron/Scene_image_item.cpp b/3rdparty/CGAL/demo/Polyhedron/Scene_image_item.cpp
new file mode 100644
index 0000000..9600b13
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Scene_image_item.cpp
@@ -0,0 +1,941 @@
+#include "config.h"
+
+#include "Scene_image_item.h"
+#include "Image_type.h"
+#include <QColor>
+#include <map>
+#include <CGAL/gl.h>
+#include <CGAL/ImageIO.h>
+#include <CGAL/use.h>
+
+
+
+// -----------------------------------
+// Internal classes
+// -----------------------------------
+namespace internal {
+
+class Image_accessor
+{
+public:
+  Image_accessor(const Image& im, int dx=1, int dy=1, int dz=1);
+  
+  bool is_vertex_active(std::size_t i, std::size_t j, std::size_t k) const;
+  const QColor& vertex_color(std::size_t i, std::size_t j, std::size_t k) const;
+  void normal(std::size_t i, std::size_t j, std::size_t k,
+              float& x, float& y, float& z) const;
+  
+  int dx() const { return dx_; }
+  int dy() const { return dy_; }
+  int dz() const { return dz_; }
+  std::size_t xdim() const { return im_.xdim(); }
+  std::size_t ydim() const { return im_.ydim(); }
+  std::size_t zdim() const { return im_.zdim(); }
+  double vx() const { return im_.vx(); }
+  double vy() const { return im_.vy(); }
+  double vz() const { return im_.vz(); }
+  
+private:
+  unsigned char non_null_neighbor_data(std::size_t i,
+                                       std::size_t j,
+                                       std::size_t k) const;
+  
+  unsigned char image_data(std::size_t i, std::size_t j, std::size_t k) const;
+  
+  void add_to_normal(unsigned char v,
+                     float& x, float& y, float& z,
+                     int dx, int dy, int dz) const;
+  
+private:
+  const Image& im_;
+  int dx_, dy_, dz_;
+  const QColor default_color_;
+  std::map<unsigned char, QColor> colors_;
+};
+
+
+Image_accessor::Image_accessor(const Image& im, int dx, int dy, int dz)
+: im_(im)
+, dx_(dx)
+, dy_(dy)
+, dz_(dz)
+, default_color_()
+, colors_()
+{
+  const std::size_t xdim = im_.xdim();
+  const std::size_t ydim = im_.ydim();
+  const std::size_t zdim = im_.zdim();  
+  
+  for(std::size_t i=0 ; i<xdim ; i+=dx_)
+  { 
+    for(std::size_t j=0 ; j<ydim ; j+=dy_)
+    { 
+      for(std::size_t k=0 ; k<zdim ; k+=dz_)
+      {
+        unsigned char c = image_data(i,j,k);
+        if ( 0 != c ) { colors_.insert(std::make_pair(c,QColor())); }
+      }
+    }
+  }
+  
+  int i=0;
+  const double starting_hue = 45./360.; // magenta
+  for ( std::map<unsigned char, QColor>::iterator it = colors_.begin(),
+       end = colors_.end() ; it != end ; ++it, ++i )
+  {
+    double hue =  starting_hue + 1./colors_.size() * i;
+    if ( hue > 1. ) { hue -= 1.; }
+    it->second = QColor::fromHsvF(hue, .75, .75);
+  }
+}
+
+bool 
+Image_accessor::
+is_vertex_active(std::size_t i, std::size_t j, std::size_t k) const
+{
+  unsigned char v1 = image_data(i-dx_, j-dy_, k-dz_);
+  unsigned char v2 = image_data(i-dx_, j-dy_, k  );
+  unsigned char v3 = image_data(i-dx_, j    , k-dz_);
+  unsigned char v4 = image_data(i-dx_, j    , k  );
+  unsigned char v5 = image_data(i    , j-dy_, k-dz_);
+  unsigned char v6 = image_data(i    , j-dy_, k  );
+  unsigned char v7 = image_data(i    , j    , k-dz_);
+  unsigned char v8 = image_data(i    , j    , k  );
+  
+  // don't draw interior vertices
+  if ( v1 != 0 && v2 != 0 && v3 != 0 && v4 != 0 && 
+       v5 != 0 && v6 != 0 && v7 != 0 && v8 != 0 )
+  {
+    return false;
+  }
+  
+  return ( v1 != 0 || v2 != 0 || v3 != 0 || v4 != 0 || 
+           v5 != 0 || v6 != 0 || v7 != 0 || v8 != 0 ); 
+}
+
+const QColor&
+Image_accessor::vertex_color(std::size_t i, std::size_t j, std::size_t k) const
+{
+  unsigned char c = non_null_neighbor_data(i,j,k);
+  if ( 0 == c ) { return default_color_; }
+  
+  std::map<unsigned char, QColor>::const_iterator color = colors_.find(c);
+  if ( colors_.end() == color ) { return default_color_; }
+  
+  return color->second;
+}
+
+unsigned char
+Image_accessor::image_data(std::size_t i, std::size_t j, std::size_t k) const
+{
+  if ( i<im_.xdim() && j<im_.ydim() && k<im_.zdim() )
+    return CGAL::IMAGEIO::static_evaluate<unsigned char>(im_.image(),i,j,k);
+  else
+    return 0;
+}
+
+unsigned char
+Image_accessor::
+non_null_neighbor_data(std::size_t i, std::size_t j, std::size_t k) const
+{
+  unsigned char v = image_data(i-dx_, j-dy_, k-dz_);
+  if ( v != 0 ) { return v; }
+  
+  v = image_data(i-dx_, j-dy_, k  );
+  if ( v != 0 ) { return v; }
+
+  v = image_data(i-dx_, j    , k-dz_);
+  if ( v != 0 ) { return v; }
+
+  v = image_data(i-dx_, j    , k  );
+  if ( v != 0 ) { return v; }
+
+  v = image_data(i    , j-dy_, k-dz_);
+  if ( v != 0 ) { return v; }
+  
+  v = image_data(i    , j-dy_, k  );
+  if ( v != 0 ) { return v; }
+  
+  v = image_data(i    , j    , k-dz_);
+  if ( v != 0 ) { return v; }
+
+  v = image_data(i    , j    , k  );
+  if ( v != 0 ) { return v; }
+  
+  return 0;
+}
+
+void
+Image_accessor::
+normal(std::size_t i, std::size_t j, std::size_t k,
+       float& x, float& y, float& z) const
+{
+  unsigned char v = image_data(i-dx_, j-dy_, k-dz_);
+  add_to_normal(v,x,y,z,       1    , 1    , 1);
+  
+  v = image_data(        i-dx_, j-dy_, k);
+  add_to_normal(v,x,y,z, 1    , 1    , -1);
+  
+  v = image_data(        i-dx_, j    , k-dz_);
+  add_to_normal(v,x,y,z, 1    , -1   , 1);
+  
+  v = image_data(        i-dx_, j    , k  );
+  add_to_normal(v,x,y,z, 1    , -1   , -1);
+  
+  v = image_data(        i    , j-dy_, k-dz_);
+  add_to_normal(v,x,y,z, -1   , 1    , 1);
+  
+  v = image_data(        i    , j-dy_, k  );
+  add_to_normal(v,x,y,z, -1   , 1    , -1);
+  
+  v = image_data(        i    , j    , k-dz_);
+  add_to_normal(v,x,y,z, -1   , -1   , 1);
+  
+  v = image_data(        i    , j    , k);
+  add_to_normal(v,x,y,z, -1   , -1   , -1);
+}
+
+void
+Image_accessor::
+add_to_normal(unsigned char v,
+              float& x, float& y, float& z,
+              int dx, int dy, int dz) const
+{
+  if ( 0 != v )
+  {
+    x += dx;
+    y += dy;
+    z += dz;    
+  }
+}
+
+
+
+class Vertex_buffer_helper
+{
+public:
+  Vertex_buffer_helper(const Image_accessor& data);
+  
+  void fill_buffer_data();
+
+  const GLfloat* colors() const { return colors_.data(); }
+  const GLfloat* normals() const { return normals_.data(); }
+  const GLfloat* vertices() const { return vertices_.data(); }
+  const GLuint* quads() const { return quads_.data(); }
+  
+  std::size_t color_size() const { return colors_.size()*sizeof(GLfloat); }
+  std::size_t normal_size() const { return normals_.size()*sizeof(GLfloat); }
+  std::size_t vertex_size() const { return vertices_.size()*sizeof(GLfloat); }
+  std::size_t quad_size() const { return quads_.size()*sizeof(GLuint); }
+  
+private:
+  void treat_vertex(std::size_t i, std::size_t j, std::size_t k);
+  
+  void push_color(std::size_t i, std::size_t j, std::size_t k);
+  void push_normal(std::size_t i, std::size_t j, std::size_t k);
+  void push_vertex(std::size_t i, std::size_t j, std::size_t k);
+  void push_quads(std::size_t i, std::size_t j, std::size_t k);
+  void push_quad(int pos1, int pos2, int pos3, int pos4);
+  
+  int compute_position(std::size_t i, std::size_t j, std::size_t k) const;
+  int vertex_index(std::size_t i, std::size_t j, std::size_t k) const;
+  
+  int dx() const { return data_.dx(); }
+  int dy() const { return data_.dy(); }
+  int dz() const { return data_.dz(); }
+  
+private:
+  static int vertex_not_found_;
+  
+  const Image_accessor& data_;
+  typedef std::map<int, std::size_t> Indices;
+  Indices indices_;
+  std::vector<GLfloat> colors_, normals_, vertices_;
+  std::vector<GLuint> quads_;
+};
+
+int Vertex_buffer_helper::vertex_not_found_ = -1;
+
+Vertex_buffer_helper::
+Vertex_buffer_helper(const Image_accessor& data)
+  : data_(data)
+{}
+
+
+void
+Vertex_buffer_helper::
+fill_buffer_data()
+{
+  std::size_t i,j,k;
+  for ( i = 0 ; i <= data_.xdim() ; i+=dx() )
+  {
+    for ( j = 0 ; j <= data_.ydim() ; j+=dy() )
+    {
+      for ( k = 0 ; k <= data_.zdim() ; k+=dz() )
+      {
+        treat_vertex(i,j,k);
+      }
+    }
+  }
+}
+
+void
+Vertex_buffer_helper::treat_vertex(std::size_t i, std::size_t j, std::size_t k)
+{
+  if ( data_.is_vertex_active(i,j,k) )
+  {
+    push_vertex(i,j,k);
+    push_color(i,j,k);
+    push_normal(i,j,k);
+    push_quads(i,j,k);    
+  }
+}
+
+void
+Vertex_buffer_helper::push_color(std::size_t i, std::size_t j, std::size_t k)
+{
+  const QColor& color = data_.vertex_color(i,j,k);
+  if ( ! color.isValid() ) { return; }
+  
+  colors_.push_back(color.red()/255.f);
+  colors_.push_back(color.green()/255.f);
+  colors_.push_back(color.blue()/255.f);
+}
+
+void
+Vertex_buffer_helper::push_normal(std::size_t i, std::size_t j, std::size_t k)
+{
+  float x=0.f, y=0.f, z=0.f;
+  data_.normal(i,j,k,x,y,z);
+  
+  float norm = std::sqrt(x*x+y*y+z*z);
+  x = x / norm;
+  y = y / norm;
+  z = z / norm;
+  
+  normals_.push_back(x);
+  normals_.push_back(y);
+  normals_.push_back(z);
+}
+
+void
+Vertex_buffer_helper::push_vertex(std::size_t i, std::size_t j, std::size_t k)
+{
+  indices_.insert(std::make_pair(compute_position(i,j,k),
+                                 vertices_.size()/3)); 
+  //resize the "border vertices"
+  double di(i),dj(j),dk(k);
+  if (di == 0)
+    di = 0.5;
+  if (dj == 0)
+    dj = 0.5;
+  if (dk == 0)
+    dk = 0.5;
+  if (di == data_.xdim())
+    di = data_.xdim()-0.5;
+  if (dj == data_.xdim())
+    dj = data_.ydim()-0.5;
+  if (dk == data_.zdim())
+    dk = data_.zdim()-0.5;
+
+  vertices_.push_back( (di - 0.5) * data_.vx());
+  vertices_.push_back( (dj - 0.5) * data_.vy());
+  vertices_.push_back( (dk - 0.5) * data_.vz());
+}
+
+void
+Vertex_buffer_helper::push_quads(std::size_t i, std::size_t j, std::size_t k)
+{
+  int pos1 = vertex_index(i-dx(), j     , k);
+  int pos2 = vertex_index(i-dx(), j-dy(), k);
+  int pos3 = vertex_index(i     , j-dy(), k) ;
+  int pos4 = vertex_index(i     ,j      , k);
+  push_quad(pos1, pos2, pos3, pos4);
+  
+  pos1 = vertex_index(i-dx(), j, k);
+  pos2 = vertex_index(i-dx(), j, k-dz());
+  pos3 = vertex_index(i     , j, k-dz());
+  push_quad(pos1, pos2, pos3, pos4);
+
+  pos1 = vertex_index(i, j-dy(), k);
+  pos2 = vertex_index(i, j-dy(), k-dz());
+  pos3 = vertex_index(i, j     , k-dz());
+  push_quad(pos1, pos2, pos3, pos4);
+}
+
+void
+Vertex_buffer_helper::push_quad(int pos1, int pos2, int pos3, int pos4)
+{
+  if (   pos1 != vertex_not_found_
+      && pos2 != vertex_not_found_
+      && pos3 != vertex_not_found_ )
+  {
+    quads_.push_back(pos1);
+    quads_.push_back(pos2);
+    quads_.push_back(pos3);
+    quads_.push_back(pos1);
+    quads_.push_back(pos3);
+    quads_.push_back(pos4);
+  }
+}
+
+int
+Vertex_buffer_helper::
+compute_position(std::size_t i, std::size_t j, std::size_t k) const
+{
+  return  static_cast<int>(
+    i/dx() * (data_.ydim()/dy()+1) * (data_.zdim()/dz()+1)
+         + j/dy() * (data_.zdim()/dz()+1)
+         + k/dz());
+}
+
+int
+Vertex_buffer_helper::
+vertex_index(std::size_t i, std::size_t j, std::size_t k) const
+{
+  if ( i > data_.xdim() || j > data_.ydim() || k > data_.zdim() )
+  {
+    return vertex_not_found_;
+  }
+  
+  int vertex_key = compute_position(i,j,k);
+  Indices::const_iterator it = indices_.find(vertex_key);
+  if ( it != indices_.end() )
+  {
+    return static_cast<int>(it->second);
+  }
+  
+  return vertex_not_found_;
+}
+
+
+} // namespace internal
+
+struct Scene_image_item_priv
+{
+
+  Scene_image_item_priv(int display_scale, bool hidden, Scene_image_item* parent)
+    : m_initialized(false)
+    , m_voxel_scale(display_scale)
+  {
+    item = parent;
+    v_box = new std::vector<float>();
+    is_hidden = hidden;
+    compile_shaders();
+    initializeBuffers();
+  }
+
+  ~Scene_image_item_priv()
+  {
+    for(int i=0; i<vboSize; i++)
+        m_vbo[i].destroy();
+    for(int i=0; i<vaoSize; i++)
+        vao[i].destroy();
+  }
+  void draw_gl(CGAL::Three::Viewer_interface* viewer) const;
+
+  void initializeBuffers();
+  GLint ibo_size() const;
+  void draw_bbox();
+  void attribBuffers(CGAL::Three::Viewer_interface*) const;
+  void compile_shaders();
+  void draw_Bbox(Scene_item::Bbox bbox, std::vector<float> *vertices);
+
+  bool m_initialized;
+//#ifdef SCENE_SEGMENTED_IMAGE_GL_BUFFERS_AVAILABLE
+  int m_voxel_scale;
+  std::vector<float> *v_box;
+  std::vector<float> color;
+  static const int vaoSize = 2;
+  static const int vboSize = 6;
+
+  mutable int poly_vertexLocation[1];
+  mutable int normalsLocation[1];
+  mutable int mvpLocation[1];
+  mutable int mvLocation[1];
+  mutable int colorLocation[1];
+  mutable int lightLocation[5];
+  mutable int twosideLocation;
+  mutable QOpenGLBuffer m_vbo[vboSize];
+  mutable QOpenGLBuffer *m_ibo;
+  mutable QOpenGLVertexArrayObject vao[vaoSize];
+  mutable QOpenGLShaderProgram rendering_program;
+  bool is_hidden;
+  Scene_image_item* item;
+
+//#endif // SCENE_SEGMENTED_IMAGE_GL_BUFFERS_AVAILABLE
+};
+// -----------------------------------
+// Scene_image_item
+// -----------------------------------
+Scene_image_item::Scene_image_item(Image* im, int display_scale, bool hidden = false)
+  : m_image(im)
+{
+  CGAL_USE(display_scale);
+  d = new Scene_image_item_priv(display_scale, hidden, this);
+  setRenderingMode(Flat);
+}
+
+
+Scene_image_item::~Scene_image_item()
+{
+   delete d;
+}
+
+/**************************************************
+****************SHADER FUNCTIONS******************/
+
+void Scene_image_item_priv::compile_shaders()
+{
+
+    for(int i=0; i< vboSize; i++)
+        m_vbo[i].create();
+    for(int i=0; i< vaoSize; i++)
+        vao[i].create();
+    m_ibo = new QOpenGLBuffer(QOpenGLBuffer::IndexBuffer);
+    m_ibo->create();
+    //Vertex source code
+    const char vertex_source[] =
+    {
+        "#version 120 \n"
+        "attribute highp vec4 vertex;\n"
+        "attribute highp vec3 normal;\n"
+        "attribute highp vec4 inColor;\n"
+
+        "uniform highp mat4 mvp_matrix;\n"
+        "uniform highp mat4 mv_matrix; \n"
+        "varying highp vec4 fP; \n"
+        "varying highp vec3 fN; \n"
+        "varying highp vec4 color; \n"
+        "void main(void)\n"
+        "{\n"
+        "   color=inColor; \n"
+        "   fP = mv_matrix * vertex; \n"
+        "   fN = mat3(mv_matrix)* normal; \n"
+        "   gl_Position = mvp_matrix * vertex; \n"
+        "}"
+    };
+    //Fragment source code
+    const char fragment_source[] =
+    {
+        "#version 120 \n"
+        "varying highp vec4 fP; \n"
+        "varying highp vec3 fN; \n"
+        "varying highp vec4 color; \n"
+        "uniform bool is_two_side; \n"
+        "uniform highp vec4 light_pos;  \n"
+        "uniform highp vec4 light_diff; \n"
+        "uniform highp vec4 light_spec; \n"
+        "uniform highp vec4 light_amb;  \n"
+        "uniform float spec_power ; \n"
+
+        "void main(void) { \n"
+
+        "   vec3 L = light_pos.xyz - fP.xyz; \n"
+        "   vec3 V = -fP.xyz; \n"
+
+        "   vec3 N; \n"
+        "   if(fN == vec3(0.0,0.0,0.0)) \n"
+        "       N = vec3(0.0,0.0,0.0); \n"
+        "   else \n"
+        "       N = normalize(fN); \n"
+        "   L = normalize(L); \n"
+        "   V = normalize(V); \n"
+
+        "   vec3 R = reflect(-L, N); \n"
+        "   vec4 diffuse; \n"
+        "   if(!is_two_side) \n"
+        "       diffuse = max(dot(N,L),0) * light_diff*color; \n"
+        "   else \n"
+        "       diffuse = max(abs(dot(N,L)),0) * light_diff*color; \n"
+        "   vec4 specular = pow(max(dot(R,V), 0.0), spec_power) * light_spec; \n"
+
+         "gl_FragColor = color*light_amb + diffuse + specular; \n"
+        "} \n"
+        "\n"
+    };
+    QOpenGLShader *vertex_shader = new QOpenGLShader(QOpenGLShader::Vertex);
+    if(!vertex_shader->compileSourceCode(vertex_source))
+    {
+        std::cerr<<"Compiling vertex source FAILED"<<std::endl;
+    }
+
+    QOpenGLShader *fragment_shader= new QOpenGLShader(QOpenGLShader::Fragment);
+    if(!fragment_shader->compileSourceCode(fragment_source))
+    {
+        std::cerr<<"Compiling fragmentsource FAILED"<<std::endl;
+    }
+
+    if(!rendering_program.addShader(vertex_shader))
+    {
+        std::cerr<<"adding vertex shader FAILED"<<std::endl;
+    }
+    if(!rendering_program.addShader(fragment_shader))
+    {
+        std::cerr<<"adding fragment shader FAILED"<<std::endl;
+    }
+    if(!rendering_program.link())
+    {
+        std::cerr<<"linking Program FAILED"<<std::endl;
+    }
+}
+
+void Scene_image_item_priv::attribBuffers(Viewer_interface* viewer) const
+{
+    QMatrix4x4 mvpMatrix;
+    QMatrix4x4 mvMatrix;
+    double mat[16];
+    viewer->camera()->getModelViewProjectionMatrix(mat);
+    for(int i=0; i < 16; i++)
+    {
+        mvpMatrix.data()[i] = (float)mat[i];
+    }
+    viewer->camera()->getModelViewMatrix(mat);
+    for(int i=0; i < 16; i++)
+    {
+        mvMatrix.data()[i] = (float)mat[i];
+    }
+    QVector4D	position(0.0f,0.0f,1.0f,1.0f );
+    GLboolean isTwoSide;
+    viewer->glGetBooleanv(GL_LIGHT_MODEL_TWO_SIDE,&isTwoSide);
+    // define material
+     QVector4D	ambient;
+     QVector4D	diffuse;
+     QVector4D	specular;
+     GLfloat      shininess ;
+    // Ambient
+    ambient[0] = 0.29225f;
+    ambient[1] = 0.29225f;
+    ambient[2] = 0.29225f;
+    ambient[3] = 1.0f;
+    // Diffuse
+    diffuse[0] = 0.50754f;
+    diffuse[1] = 0.50754f;
+    diffuse[2] = 0.50754f;
+    diffuse[3] = 1.0f;
+    // Specular
+    specular[0] = 0.0f;
+    specular[1] = 0.0f;
+    specular[2] = 0.0f;
+    specular[3] = 0.0f;
+    // Shininess
+    shininess = 51.2f;
+
+
+    rendering_program.bind();
+    colorLocation[0] = rendering_program.uniformLocation("color");
+    twosideLocation = rendering_program.uniformLocation("is_two_side");
+    mvpLocation[0] = rendering_program.uniformLocation("mvp_matrix");
+    mvLocation[0] = rendering_program.uniformLocation("mv_matrix");
+    lightLocation[0] = rendering_program.uniformLocation("light_pos");
+    lightLocation[1] = rendering_program.uniformLocation("light_diff");
+    lightLocation[2] = rendering_program.uniformLocation("light_spec");
+    lightLocation[3] = rendering_program.uniformLocation("light_amb");
+    lightLocation[4] = rendering_program.uniformLocation("spec_power");
+
+    rendering_program.setUniformValue(lightLocation[0], position);
+    rendering_program.setUniformValue(twosideLocation, isTwoSide);
+    rendering_program.setUniformValue(mvpLocation[0], mvpMatrix);
+    rendering_program.setUniformValue(mvLocation[0], mvMatrix);
+    rendering_program.setUniformValue(lightLocation[1], diffuse);
+    rendering_program.setUniformValue(lightLocation[2], specular);
+    rendering_program.setUniformValue(lightLocation[3], ambient);
+    rendering_program.setUniformValue(lightLocation[4], shininess);
+
+    rendering_program.release();
+}
+
+void
+Scene_image_item::compute_bbox() const
+{
+  if(!m_image)
+    _bbox = Bbox();
+  else
+   _bbox = Bbox(0,
+                0,
+                0,
+              (m_image->xdim()-1) * m_image->vx(),
+              (m_image->ydim()-1) * m_image->vy(),
+              (m_image->zdim()-1) * m_image->vz());
+}
+
+void
+Scene_image_item::draw(Viewer_interface* viewer) const
+{
+  if(m_image)
+  {
+    d->draw_gl(viewer);
+  }
+}
+
+template <typename T> const char* whatType(T) { return "unknown"; }    // default
+template <> const char* whatType(float) { return "float"; }
+template <> const char* whatType(double) { return "double"; }
+template <> const char* whatType(char) { return "int8_t (char)"; }
+template <> const char* whatType(boost::uint8_t) { return "uint8_t (unsigned char)"; }
+template <> const char* whatType(boost::int16_t) { return "int16_t (short)"; }
+template <> const char* whatType(boost::uint16_t) { return "uint16_t (unsigned short)"; }
+template <> const char* whatType(boost::int32_t) { return "int32_t (int)"; }
+template <> const char* whatType(boost::uint32_t) { return "uint32_t (unsigned int)"; }
+
+template<typename Word>
+QString explicitWordType()
+{
+  return QString(whatType(Word(0)));
+}
+
+QString
+Scene_image_item::toolTip() const
+{
+  QString w_type;
+  CGAL_IMAGE_IO_CASE(image()->image(), w_type = explicitWordType<Word>())
+  return tr("<p>Image <b>%1</b></p>"
+            "<p>Word type: %2</p>"
+            "<p>Dimensions: %3 x %4 x %5</p>"
+            "<p>Spacings: ( %6 , %7 , %8 )</p>")
+    .arg(this->name())
+    .arg(w_type)
+    .arg(m_image->xdim()) 
+    .arg(m_image->ydim())
+    .arg(m_image->zdim())
+    .arg(m_image->vx())
+    .arg(m_image->vy())
+    .arg(m_image->vz());
+}
+
+bool
+Scene_image_item::supportsRenderingMode(RenderingMode m) const
+{ 
+  switch ( m )
+  {
+    case Gouraud:
+      return false;
+      
+    case Points:
+    case Wireframe:
+    case Flat:
+    case FlatPlusEdges:
+      return true;
+      
+    default:
+      return false;
+  }
+  
+  return false;
+}
+
+void
+Scene_image_item_priv::initializeBuffers()
+{
+  draw_Bbox(item->bbox(), v_box);
+  std::vector<float> nul_vec(0);
+  for(std::size_t i=0; i<v_box->size(); i++)
+    nul_vec.push_back(0.0);
+  if(!is_hidden)
+  {
+    internal::Image_accessor image_data_accessor (*item->m_image,
+                                                  m_voxel_scale,
+                                                  m_voxel_scale,
+                                                  m_voxel_scale);
+    internal::Vertex_buffer_helper helper (image_data_accessor);
+    helper.fill_buffer_data();
+    rendering_program.bind();
+    vao[0].bind();
+    m_vbo[0].bind();
+    m_vbo[0].allocate(helper.vertices(), static_cast<int>(helper.vertex_size()));
+    poly_vertexLocation[0] = rendering_program.attributeLocation("vertex");
+    rendering_program.enableAttributeArray(poly_vertexLocation[0]);
+    rendering_program.setAttributeBuffer(poly_vertexLocation[0],GL_FLOAT,0,3);
+    m_vbo[0].release();
+
+    m_vbo[1].bind();
+    m_vbo[1].allocate(helper.normals(), static_cast<int>(helper.normal_size()));
+    normalsLocation[0] = rendering_program.attributeLocation("normal");
+    rendering_program.enableAttributeArray(normalsLocation[0]);
+    rendering_program.setAttributeBuffer(normalsLocation[0],GL_FLOAT,0,3);
+    m_vbo[1].release();
+
+    m_vbo[2].bind();
+    m_vbo[2].allocate(helper.colors(), static_cast<int>(helper.color_size()));
+    colorLocation[0] = rendering_program.attributeLocation("inColor");
+    rendering_program.enableAttributeArray(colorLocation[0]);
+    rendering_program.setAttributeBuffer(colorLocation[0],GL_FLOAT,0,3);
+    m_vbo[2].release();
+
+    m_ibo->bind();
+    m_ibo->allocate(helper.quads(), static_cast<int>(helper.quad_size()));
+    vao[0].release();
+
+    color.resize(0);
+    for(std::size_t i=0; i<helper.color_size()/sizeof(GLuint); i++)
+      color.push_back(0.0);
+    rendering_program.release();
+  }
+  rendering_program.bind();
+  vao[1].bind();
+  m_vbo[3].bind();
+  m_vbo[3].allocate(v_box->data(), static_cast<int>(v_box->size()*sizeof(float)));
+  poly_vertexLocation[0] = rendering_program.attributeLocation("vertex");
+  rendering_program.enableAttributeArray(poly_vertexLocation[0]);
+  rendering_program.setAttributeBuffer(poly_vertexLocation[0],GL_FLOAT,0,3);
+  m_vbo[3].release();
+
+  m_vbo[4].bind();
+  m_vbo[3].allocate(nul_vec.data(), static_cast<int>(nul_vec.size()*sizeof(float)));
+  normalsLocation[0] = rendering_program.attributeLocation("normal");
+  rendering_program.enableAttributeArray(normalsLocation[0]);
+  rendering_program.setAttributeBuffer(normalsLocation[0],GL_FLOAT,0,3);
+  m_vbo[4].release();
+
+  m_vbo[5].bind();
+  m_vbo[5].allocate(nul_vec.data(), static_cast<int>(nul_vec.size()*sizeof(float)));
+  colorLocation[0] = rendering_program.attributeLocation("inColor");
+  rendering_program.enableAttributeArray(colorLocation[0]);
+  rendering_program.setAttributeBuffer(colorLocation[0],GL_FLOAT,0,3);
+  m_vbo[5].release();
+
+  vao[1].release();
+  rendering_program.release();
+  m_initialized = true;
+}
+
+
+void
+Scene_image_item_priv::draw_gl(Viewer_interface* viewer) const
+{
+  attribBuffers(viewer);
+  rendering_program.bind();
+  if(!is_hidden)
+  {
+    vao[0].bind();
+    viewer->glDrawElements(GL_TRIANGLES, m_ibo->size()/sizeof(GLuint), GL_UNSIGNED_INT, 0);
+    vao[0].release();
+  }
+  vao[1].bind();
+  viewer->glLineWidth(3);
+  viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(v_box->size()/3));
+  vao[1].release();
+  rendering_program.release();
+}
+
+GLint
+Scene_image_item_priv::ibo_size() const
+{
+      m_ibo->bind();
+    GLint nb_elts = m_ibo->size();
+    m_ibo->release();
+
+    return nb_elts/sizeof(GLuint);
+
+  return 0;
+}
+
+void Scene_image_item::changed()
+{
+    d->initializeBuffers();
+}
+
+void Scene_image_item_priv::draw_Bbox(Scene_item::Bbox bbox, std::vector<float> *vertices)
+{
+    vertices->push_back(bbox.xmin());
+    vertices->push_back(bbox.ymin());
+    vertices->push_back(bbox.zmin());
+
+    vertices->push_back(bbox.xmin());
+    vertices->push_back(bbox.ymin());
+    vertices->push_back(bbox.zmax());
+
+    vertices->push_back(bbox.xmin());
+    vertices->push_back(bbox.ymin());
+    vertices->push_back(bbox.zmin());
+
+    vertices->push_back(bbox.xmin());
+    vertices->push_back(bbox.ymax());
+    vertices->push_back(bbox.zmin());
+
+    vertices->push_back(bbox.xmin());
+    vertices->push_back(bbox.ymin());
+    vertices->push_back(bbox.zmin());
+
+    vertices->push_back(bbox.xmax());
+    vertices->push_back(bbox.ymin());
+    vertices->push_back(bbox.zmin());
+
+    vertices->push_back(bbox.xmax());
+    vertices->push_back(bbox.ymin());
+    vertices->push_back(bbox.zmin());
+
+    vertices->push_back(bbox.xmax());
+    vertices->push_back(bbox.ymax());
+    vertices->push_back(bbox.zmin());
+
+    vertices->push_back(bbox.xmax());
+    vertices->push_back(bbox.ymin());
+    vertices->push_back(bbox.zmin());
+
+    vertices->push_back(bbox.xmax());
+    vertices->push_back(bbox.ymin());
+    vertices->push_back(bbox.zmax());
+
+    vertices->push_back(bbox.xmin());
+    vertices->push_back(bbox.ymax());
+    vertices->push_back(bbox.zmin());
+
+    vertices->push_back(bbox.xmin());
+    vertices->push_back(bbox.ymax());
+    vertices->push_back(bbox.zmax());
+
+    vertices->push_back(bbox.xmin());
+    vertices->push_back(bbox.ymax());
+    vertices->push_back(bbox.zmin());
+
+    vertices->push_back(bbox.xmax());
+    vertices->push_back(bbox.ymax());
+    vertices->push_back(bbox.zmin());
+
+    vertices->push_back(bbox.xmax());
+    vertices->push_back(bbox.ymax());
+    vertices->push_back(bbox.zmin());
+
+    vertices->push_back(bbox.xmax());
+    vertices->push_back(bbox.ymax());
+    vertices->push_back(bbox.zmax());
+
+    vertices->push_back(bbox.xmin());
+    vertices->push_back(bbox.ymin());
+    vertices->push_back(bbox.zmax());
+
+    vertices->push_back(bbox.xmin());
+    vertices->push_back(bbox.ymax());
+    vertices->push_back(bbox.zmax());
+
+    vertices->push_back(bbox.xmin());
+    vertices->push_back(bbox.ymin());
+    vertices->push_back(bbox.zmax());
+
+    vertices->push_back(bbox.xmax());
+    vertices->push_back(bbox.ymin());
+    vertices->push_back(bbox.zmax());
+
+    vertices->push_back(bbox.xmax());
+    vertices->push_back(bbox.ymax());
+    vertices->push_back(bbox.zmax());
+
+    vertices->push_back(bbox.xmin());
+    vertices->push_back(bbox.ymax());
+    vertices->push_back(bbox.zmax());
+
+    vertices->push_back(bbox.xmax());
+    vertices->push_back(bbox.ymax());
+    vertices->push_back(bbox.zmax());
+
+    vertices->push_back(bbox.xmax());
+    vertices->push_back(bbox.ymin());
+    vertices->push_back(bbox.zmax());
+
+}
+
+void Scene_image_item::drawEdges(CGAL::Three::Viewer_interface* viewer) const
+{ d->draw_gl(viewer); }
+
+bool Scene_image_item::isGray() { return d->is_hidden;}
diff --git a/3rdparty/CGAL/demo/Polyhedron/Scene_image_item.h b/3rdparty/CGAL/demo/Polyhedron/Scene_image_item.h
new file mode 100644
index 0000000..0639642
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Scene_image_item.h
@@ -0,0 +1,55 @@
+#ifndef SCENE_IMAGE_ITEM_H
+#define SCENE_IMAGE_ITEM_H
+
+#include <CGAL/Three/Scene_item.h>
+#include "Image_type_fwd.h"
+#include "Scene_image_item_config.h"
+#include <CGAL/gl.h>
+
+#include <QOpenGLVertexArrayObject>
+#include <QOpenGLBuffer>
+#include <QOpenGLShaderProgram>
+
+#include <CGAL/Three/Scene_interface.h>
+#include <CGAL/Three/Viewer_interface.h>
+
+typedef CGAL::Image_3 Image;
+using namespace CGAL::Three;
+struct Scene_image_item_priv;
+class SCENE_IMAGE_ITEM_EXPORT Scene_image_item
+  : public Scene_item
+{
+  Q_OBJECT
+public:
+
+  Scene_image_item(Image* im, int drawing_scale, bool hidden);
+  ~Scene_image_item();
+
+  bool isFinite() const { return true; }
+  bool isEmpty() const { return false; }
+  void compute_bbox() const;
+
+  Scene_image_item* clone() const { return NULL; }
+
+  // rendering mode
+  virtual bool supportsRenderingMode(RenderingMode m) const;
+
+  // draw
+  virtual void direct_draw(CGAL::Three::Viewer_interface* viewer) const
+  { draw(viewer); }
+  virtual void direct_draw_edges(CGAL::Three::Viewer_interface* viewer) const
+  { drawEdges(viewer); }
+  virtual void draw(CGAL::Three::Viewer_interface*) const;
+  virtual void drawEdges(CGAL::Three::Viewer_interface* viewer) const;
+  virtual QString toolTip() const;
+  const Image* image() const { return m_image; }
+  bool isGray();
+  Image* m_image;
+protected :
+  friend struct Scene_image_item_priv;
+  Scene_image_item_priv* d;
+public Q_SLOTS:
+    void changed();
+};
+
+#endif // SCENE_IMAGE_ITEM_H
diff --git a/3rdparty/CGAL/demo/Polyhedron/Scene_image_item_config.h b/3rdparty/CGAL/demo/Polyhedron/Scene_image_item_config.h
new file mode 100644
index 0000000..939d320
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Scene_image_item_config.h
@@ -0,0 +1,10 @@
+#ifndef SCENE_IMAGE_ITEM_CONFIG_H
+#define SCENE_IMAGE_ITEM_CONFIG_H
+
+#ifdef scene_image_item_EXPORTS
+#  define SCENE_IMAGE_ITEM_EXPORT Q_DECL_EXPORT
+#else
+#  define SCENE_IMAGE_ITEM_EXPORT Q_DECL_IMPORT
+#endif
+
+#endif // SCENE_IMAGE_ITEM_CONFIG_H
diff --git a/3rdparty/CGAL/demo/Polyhedron/Scene_implicit_function_item.cpp b/3rdparty/CGAL/demo/Polyhedron/Scene_implicit_function_item.cpp
new file mode 100644
index 0000000..9d259c9
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Scene_implicit_function_item.cpp
@@ -0,0 +1,647 @@
+#include "Scene_implicit_function_item.h"
+#include <QColor>
+#include <QApplication>
+#include <map>
+#include <CGAL/gl.h>
+#include <CGAL/Simple_cartesian.h>
+#include <QGLViewer/manipulatedFrame.h>
+
+#include "Color_ramp.h"
+#include <CGAL/Three/Viewer_interface.h>
+
+#include <CGAL/double.h>
+
+inline
+bool is_nan(double d)
+{
+    return !CGAL::Is_valid<double>()( d );
+}
+
+struct Scene_implicit_function_item_priv
+{
+  Scene_implicit_function_item_priv(Implicit_function_interface* f, Scene_implicit_function_item* parent)
+    : function_(f)
+    , frame_(new ManipulatedFrame())
+    , need_update_(true)
+    , grid_size_(SCENE_IMPLICIT_GRID_SIZE)
+    , max_value_(0.)
+    , min_value_(0.)
+    , blue_color_ramp_()
+    , red_color_ramp_()
+    , textureId(-1)
+  {
+    item = parent;
+    texture = new Texture(grid_size_-1,grid_size_-1);
+    blue_color_ramp_.build_blue();
+    red_color_ramp_.build_red();
+  }
+  ~Scene_implicit_function_item_priv()
+  {
+    delete frame_;
+  }
+  typedef qglviewer::Vec                  Point;
+  typedef std::pair <Point,double>        Point_value;
+  typedef qglviewer::ManipulatedFrame ManipulatedFrame;
+  void compute_min_max();
+  void initialize_buffers(CGAL::Three::Viewer_interface *viewer) const;
+  void compute_vertices_and_texmap(void);
+  void compute_texture(int, int);
+  enum VAOs {
+      Plane = 0,
+      BBox,
+      Grid,
+      NbOfVaos
+  };
+  enum VBOs {
+      Quad_vertices = 0,
+      TexMap,
+      Cube_vertices,
+      Grid_vertices,
+      NbOfVbos
+  };
+  Implicit_function_interface* function_;
+  ManipulatedFrame* frame_;
+  mutable bool need_update_;
+  int grid_size_;
+  double max_value_;
+  double min_value_;
+  mutable Point_value implicit_grid_[SCENE_IMPLICIT_GRID_SIZE][SCENE_IMPLICIT_GRID_SIZE];
+  Color_ramp blue_color_ramp_;
+  Color_ramp red_color_ramp_;
+  std::vector<float> positions_cube;
+  std::vector<float> positions_grid;
+  std::vector<float> positions_tex_quad;
+  std::vector<float> texture_map;
+  Texture *texture;
+  GLuint vao;
+  GLuint buffer[4];
+  mutable QOpenGLShaderProgram *program;
+  mutable GLuint textureId;
+  Scene_implicit_function_item* item;
+};
+
+void Scene_implicit_function_item_priv::initialize_buffers(CGAL::Three::Viewer_interface *viewer = 0) const
+{
+    if(GLuint(-1) == textureId) {
+        viewer->glGenTextures(1, &textureId);
+    }
+
+    //vao fot the cutting plane
+    {
+        program = item->getShaderProgram(Scene_implicit_function_item::PROGRAM_WITH_TEXTURE, viewer);
+        program->bind();
+        item->vaos[Plane]->bind();
+
+
+        item->buffers[Quad_vertices].bind();
+        item->buffers[Quad_vertices].allocate(positions_tex_quad.data(),
+                            static_cast<int>(positions_tex_quad.size()*sizeof(float)));
+        program->enableAttributeArray("vertex");
+        program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
+        item->buffers[Quad_vertices].release();
+
+        item->buffers[TexMap].bind();
+        item->buffers[TexMap].allocate(texture_map.data(),
+                            static_cast<int>(texture_map.size()*sizeof(float)));
+        program->enableAttributeArray("v_texCoord");
+        program->setAttributeBuffer("v_texCoord",GL_FLOAT,0,2);
+        item->buffers[TexMap].release();
+        program->setAttributeValue("normal", QVector3D(0.f,0.f,0.f));
+
+        program->release();
+        item->vaos[Plane]->release();
+    }
+    //vao fot the bbox
+    {
+        program = item->getShaderProgram(Scene_implicit_function_item::PROGRAM_WITHOUT_LIGHT, viewer);
+        program->bind();
+        item->vaos[BBox]->bind();
+
+
+        item->buffers[Cube_vertices].bind();
+        item->buffers[Cube_vertices].allocate(positions_cube.data(),
+                            static_cast<int>(positions_cube.size()*sizeof(float)));
+        program->enableAttributeArray("vertex");
+        program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
+        item->buffers[Cube_vertices].release();
+
+        program->release();
+        item->vaos[BBox]->release();
+    }
+    //vao fot the grid
+    {
+        program = item->getShaderProgram(Scene_implicit_function_item::PROGRAM_WITHOUT_LIGHT, viewer);
+        program->bind();
+        item->vaos[Grid]->bind();
+
+
+        item->buffers[Grid_vertices].bind();
+        item->buffers[Grid_vertices].allocate(positions_grid.data(),
+                            static_cast<int>(positions_grid.size()*sizeof(float)));
+        program->enableAttributeArray("vertex");
+        program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
+        item->buffers[Grid_vertices].release();
+        program->release();
+        item->vaos[Grid]->release();
+    }
+
+
+
+    viewer->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+    viewer->glBindTexture(GL_TEXTURE_2D, textureId);
+    viewer->glTexImage2D(GL_TEXTURE_2D,
+                 0,
+                 GL_RGB,
+                 texture->getWidth(),
+                 texture->getHeight(),
+                 0,
+                 GL_RGB,
+                 GL_UNSIGNED_BYTE,
+                 texture->getData());
+       viewer->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+       viewer->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+       viewer->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE );
+       viewer->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE );
+
+       item->are_buffers_filled = true;
+}
+
+void Scene_implicit_function_item_priv::compute_vertices_and_texmap(void)
+{
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    positions_tex_quad.resize(0);
+    positions_cube.resize(0);
+    positions_grid.resize(0);
+    texture_map.resize(0);
+
+    const CGAL::Three::Scene_item::Bbox& b = item->bbox();
+    float x,y,z;
+    z = (b.zmax()+b.zmin())/2.0;
+    x = (b.xmax()+b.xmin())/2.0;
+    y = (b.ymax()+b.ymin())/2.0;
+    // The Quad
+    {
+
+
+        //A
+        positions_tex_quad.push_back(b.xmin()-x);
+        positions_tex_quad.push_back(b.ymin()-z);
+        positions_tex_quad.push_back(0);
+
+
+        //B
+        positions_tex_quad.push_back(b.xmin()-x);
+        positions_tex_quad.push_back(b.ymax()-y);
+        positions_tex_quad.push_back(0);
+
+
+        //C
+        positions_tex_quad.push_back(b.xmax()-x);
+        positions_tex_quad.push_back(b.ymax()-y);
+        positions_tex_quad.push_back(0);
+
+
+
+        //A
+        positions_tex_quad.push_back(b.xmin()-x);
+        positions_tex_quad.push_back(b.ymin()-y);
+        positions_tex_quad.push_back(0);
+
+
+        //C
+        positions_tex_quad.push_back(b.xmax()-x);
+        positions_tex_quad.push_back(b.ymax()-y);
+        positions_tex_quad.push_back(0);
+
+
+        //D
+        positions_tex_quad.push_back(b.xmax()-x);
+        positions_tex_quad.push_back(b.ymin()-y);
+        positions_tex_quad.push_back(0);
+
+
+
+        texture_map.push_back(0.0);
+        texture_map.push_back(0.0);
+
+        texture_map.push_back(0.0);
+        texture_map.push_back(1.0);
+
+        texture_map.push_back(1.0);
+        texture_map.push_back(1.0);
+
+        texture_map.push_back(0.0);
+        texture_map.push_back(0.0);
+
+        texture_map.push_back(1.0);
+        texture_map.push_back(1.0);
+
+        texture_map.push_back(1.0);
+        texture_map.push_back(0.0);
+
+
+
+    }
+    //The grid
+    {
+      double dx((b.xmax()-b.xmin())/10.0), dy((b.ymax()-b.ymin())/10.0);
+        for(int u = 0; u < 11; u++)
+        {
+
+            positions_grid.push_back(b.xmin()-x + dx* u);
+            positions_grid.push_back(b.ymin()-y);
+            positions_grid.push_back(0);
+
+            positions_grid.push_back(b.xmin()-x + dx* u);
+            positions_grid.push_back(b.ymax()-y);
+            positions_grid.push_back(0);
+        }
+        for(int v=0; v<11; v++)
+        {
+
+            positions_grid.push_back(b.xmin()-x);
+            positions_grid.push_back(b.ymin()-y + v * dy);
+            positions_grid.push_back(0);
+
+            positions_grid.push_back(b.xmax()-x);
+            positions_grid.push_back(b.ymin()-y + v * dy);
+            positions_grid.push_back(0);
+        }
+
+    }
+    //the Box
+    {
+
+        positions_cube.push_back(b.xmin());
+        positions_cube.push_back(b.ymin());
+        positions_cube.push_back(b.zmin());
+
+        positions_cube.push_back(b.xmin());
+        positions_cube.push_back(b.ymin());
+        positions_cube.push_back(b.zmax());
+
+
+        positions_cube.push_back(b.xmin());
+        positions_cube.push_back(b.ymin());
+        positions_cube.push_back(b.zmin());
+
+
+        positions_cube.push_back(b.xmin());
+        positions_cube.push_back(b.ymax());
+        positions_cube.push_back(b.zmin());
+
+
+        positions_cube.push_back(b.xmin());
+        positions_cube.push_back(b.ymin());
+        positions_cube.push_back(b.zmin());
+
+
+        positions_cube.push_back(b.xmax());
+        positions_cube.push_back(b.ymin());
+        positions_cube.push_back(b.zmin());
+
+
+        positions_cube.push_back(b.xmax());
+        positions_cube.push_back(b.ymin());
+        positions_cube.push_back(b.zmin());
+
+
+        positions_cube.push_back(b.xmax());
+        positions_cube.push_back(b.ymax());
+        positions_cube.push_back(b.zmin());
+
+
+        positions_cube.push_back(b.xmax());
+        positions_cube.push_back(b.ymin());
+        positions_cube.push_back(b.zmin());
+
+
+        positions_cube.push_back(b.xmax());
+        positions_cube.push_back(b.ymin());
+        positions_cube.push_back(b.zmax());
+
+
+        positions_cube.push_back(b.xmin());
+        positions_cube.push_back(b.ymax());
+        positions_cube.push_back(b.zmin());
+
+
+        positions_cube.push_back(b.xmin());
+        positions_cube.push_back(b.ymax());
+        positions_cube.push_back(b.zmax());
+
+
+        positions_cube.push_back(b.xmin());
+        positions_cube.push_back(b.ymax());
+        positions_cube.push_back(b.zmin());
+
+
+        positions_cube.push_back(b.xmax());
+        positions_cube.push_back(b.ymax());
+        positions_cube.push_back(b.zmin());
+
+
+        positions_cube.push_back(b.xmax());
+        positions_cube.push_back(b.ymax());
+        positions_cube.push_back(b.zmin());
+
+
+        positions_cube.push_back(b.xmax());
+        positions_cube.push_back(b.ymax());
+        positions_cube.push_back(b.zmax());
+
+
+        positions_cube.push_back(b.xmin());
+        positions_cube.push_back(b.ymin());
+        positions_cube.push_back(b.zmax());
+
+
+        positions_cube.push_back(b.xmin());
+        positions_cube.push_back(b.ymax());
+        positions_cube.push_back(b.zmax());
+
+
+        positions_cube.push_back(b.xmin());
+        positions_cube.push_back(b.ymin());
+        positions_cube.push_back(b.zmax());
+
+
+        positions_cube.push_back(b.xmax());
+        positions_cube.push_back(b.ymin());
+        positions_cube.push_back(b.zmax());
+
+
+        positions_cube.push_back(b.xmax());
+        positions_cube.push_back(b.ymax());
+        positions_cube.push_back(b.zmax());
+
+
+        positions_cube.push_back(b.xmin());
+        positions_cube.push_back(b.ymax());
+        positions_cube.push_back(b.zmax());
+
+
+        positions_cube.push_back(b.xmax());
+        positions_cube.push_back(b.ymax());
+        positions_cube.push_back(b.zmax());
+
+
+        positions_cube.push_back(b.xmax());
+        positions_cube.push_back(b.ymin());
+        positions_cube.push_back(b.zmax());
+
+    }
+
+    //The texture
+    for( int i=0 ; i < texture->getWidth() ; i++ )
+    {
+        for( int j=0 ; j < texture->getHeight() ; j++)
+        {
+            compute_texture(i,j);
+        }
+    }
+    QApplication::restoreOverrideCursor();
+}
+
+Scene_implicit_function_item::
+Scene_implicit_function_item(Implicit_function_interface* f)
+    :CGAL::Three::Scene_item(4,3)
+{
+  d = new Scene_implicit_function_item_priv(f, this);
+  //Generates an integer which will be used as ID for each buffer
+  d->compute_min_max();
+  compute_function_grid();
+  double offset_x = (bbox().xmin() + bbox().xmax()) / 2;
+  double offset_y = (bbox().ymin() + bbox().ymax()) / 2;
+  double offset_z = (bbox().zmin() + bbox().zmax()) / 2;
+  d->frame_->setPosition(offset_x, offset_y, offset_z);
+  d->frame_->setOrientation(1., 0, 0, 0);
+  connect(d->frame_, SIGNAL(modified()), this, SLOT(plane_was_moved()));
+  plane_was_moved();
+  invalidateOpenGLBuffers();
+}
+
+
+Scene_implicit_function_item::~Scene_implicit_function_item()
+{
+  delete d;
+}
+
+
+void
+Scene_implicit_function_item::compute_bbox() const
+{
+    _bbox = d->function_->bbox();
+}
+
+void
+Scene_implicit_function_item::draw(CGAL::Three::Viewer_interface* viewer) const
+{
+    if(!are_buffers_filled)
+        d->initialize_buffers(viewer);
+    if(d->frame_->isManipulated()) {
+        if(d->need_update_) {
+            compute_function_grid();
+            d->need_update_ = false;
+        }
+    }
+    vaos[Scene_implicit_function_item_priv::Plane]->bind();
+    viewer->glActiveTexture(GL_TEXTURE0);
+    viewer->glBindTexture(GL_TEXTURE_2D, d->textureId);
+    attribBuffers(viewer, PROGRAM_WITH_TEXTURE);
+    QMatrix4x4 f_mat;
+    GLdouble d_mat[16];
+    d->frame_->getMatrix(d_mat);
+    //Convert the GLdoubles matrices in GLfloats
+    for (int i=0; i<16; ++i){
+        f_mat.data()[i] = GLfloat(d_mat[i]);
+    }
+    d->program = getShaderProgram(PROGRAM_WITH_TEXTURE);
+    d->program->bind();
+    d->program->setUniformValue("f_matrix", f_mat);
+    d->program->setUniformValue("light_amb", QVector4D(1.f,1.f,1.f,1.f));
+    d->program->setUniformValue("light_diff", QVector4D(0.f,0.f,0.f,1.f));
+    d->program->setAttributeValue("color_facets", QVector3D(1.f,1.f,1.f));
+    viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(d->positions_tex_quad.size()/3));
+    vaos[Scene_implicit_function_item_priv::Plane]->release();
+    d->program->release();
+}
+
+void
+Scene_implicit_function_item::drawEdges(CGAL::Three::Viewer_interface* viewer) const
+{
+    if(!are_buffers_filled)
+        d->initialize_buffers(viewer);
+    vaos[Scene_implicit_function_item_priv::BBox]->bind();
+    attribBuffers(viewer, PROGRAM_WITHOUT_LIGHT);
+    d->program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
+    d->program->bind();
+    d->program->setAttributeValue("colors", QVector3D(0.f,0.f,0.f));
+    viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(d->positions_cube.size()/3));
+    vaos[Scene_implicit_function_item_priv::BBox]->release();
+    vaos[Scene_implicit_function_item_priv::Grid]->bind();
+    QMatrix4x4 f_mat;
+    GLdouble d_mat[16];
+    d->frame_->getMatrix(d_mat);
+    //Convert the GLdoubles matrices in GLfloats
+    for (int i=0; i<16; ++i){
+        f_mat.data()[i] = double(d_mat[i]);
+    }
+    d->program->setUniformValue("f_matrix", f_mat);
+    d->program->setAttributeValue("colors", QVector3D(0.6f, 0.6f, 0.6f));
+    viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(d->positions_grid.size()/3));
+    vaos[Scene_implicit_function_item_priv::Grid]->release();
+    d->program->release();
+}
+
+QString
+Scene_implicit_function_item::toolTip() const
+{
+    return tr("<p>Function <b>%1</b>")
+            .arg(this->name());
+}
+
+bool
+Scene_implicit_function_item::supportsRenderingMode(RenderingMode m) const
+{
+    switch ( m )
+    {
+    case Splatting:
+    case Gouraud:
+        return false;
+
+    case Points:
+    case Wireframe:
+    case Flat:
+    case FlatPlusEdges:
+        return true;
+
+    default:
+        return false;
+    }
+
+    return false;
+}
+
+void Scene_implicit_function_item_priv::compute_texture(int i, int j)
+{
+    double v = (implicit_grid_[i][j]).second;
+
+    if(is_nan(v)) {
+        texture->setData(i,j,51,51,51);
+    } else
+        // determines grey level
+        if ( v > 0 )
+        {
+            v = v/max_value_;
+            GLdouble r = red_color_ramp_.r(v), g = red_color_ramp_.g(v), b = red_color_ramp_.b(v);
+            texture->setData(i,j,255*r,255*g,255*b);
+        }
+        else
+        {
+            v = v/min_value_;
+            GLdouble r = blue_color_ramp_.r(v), g = blue_color_ramp_.g(v), b = blue_color_ramp_.b(v);
+            texture->setData(i,j,255*r,255*g,255*b);
+        }
+}
+
+
+void
+Scene_implicit_function_item::
+compute_function_grid() const
+{
+    typedef CGAL::Simple_cartesian<double>  K;
+    typedef K::Aff_transformation_3         Aff_transformation;
+    typedef K::Point_3                      Point_3;
+
+    // Get transformation
+    const GLdouble* m = d->frame_->matrix();
+
+    // OpenGL matrices are row-major matrices
+    Aff_transformation t (m[0], m[4], m[8], m[12],
+            m[1], m[5], m[9], m[13],
+            m[2], m[6], m[10], m[14]);
+
+    double diag = (CGAL::sqrt((bbox().xmax()-bbox().xmin())*(bbox().xmax()-bbox().xmin()) + (bbox().ymax()-bbox().ymin())*(bbox().ymax()-bbox().ymin())  + (bbox().zmax()-bbox().zmin())*(bbox().zmax()-bbox().zmin()) )) * .6;
+
+    const double dx = diag;
+    const double dy = diag;
+    const double z (0);
+
+    int nb_quad = d->grid_size_ - 1;
+
+    for(int i=0 ; i<d->grid_size_ ; ++i)
+    {
+        double x = -diag/2. + double(i)/double(nb_quad) * dx;
+
+        for(int j=0 ; j<d->grid_size_ ; ++j)
+        {
+            double y = -diag/2. + double(j)/double(nb_quad) * dy;
+
+            Point_3 query = t( Point_3(x, y, z) );
+            double v = d->function_->operator()(query.x(), query.y(), query.z());
+
+            d->implicit_grid_[i][j] = Scene_implicit_function_item_priv::Point_value(Scene_implicit_function_item_priv::Point(query.x(),query.y(),query.z()),v);
+        }
+    }
+
+    // Update
+    const_cast<Scene_implicit_function_item*>(this)->invalidateOpenGLBuffers();
+
+}
+
+void
+Scene_implicit_function_item_priv::
+compute_min_max()
+{
+    if(function_->get_min_max(min_value_, max_value_))
+        return;
+
+    double probes_nb = double(grid_size_) / 2;
+
+    // Probe bounding box
+    const CGAL::Three::Scene_item::Bbox& b = item->bbox();
+
+    for ( int i = 0 ; i <= probes_nb ; ++i )
+    {
+        double x = b.xmin() + double(i) * (b.xmax() - b.xmin()) / probes_nb;
+
+        for ( int j = 0 ; j <= probes_nb ; ++j )
+        {
+            double y = b.ymin() + double(j) * (b.ymax() - b.ymin()) / probes_nb;
+
+            for ( int k = 0 ; k <= probes_nb ; ++k )
+            {
+                double z = b.zmin() + double(k) * (b.zmax() - b.zmin()) / probes_nb;
+
+                double v = (*function_)(x,y,z);
+                if(is_nan(v)) continue;
+                max_value_ = (std::max)(v,max_value_);
+                min_value_ = (std::min)(v,min_value_);
+            }
+        }
+    }
+}
+
+void
+Scene_implicit_function_item::invalidateOpenGLBuffers()
+{
+    Scene_item::invalidateOpenGLBuffers();
+    compute_bbox();
+    d->compute_vertices_and_texmap();
+    are_buffers_filled = false;
+}
+
+
+void Scene_implicit_function_item::updateCutPlane()
+{ // just handle deformation - paint like selection is handled in eventFilter()
+  if(d->need_update_) {
+    compute_function_grid();
+    d->compute_vertices_and_texmap();
+    d->need_update_= false;
+  }
+}
+
+Implicit_function_interface* Scene_implicit_function_item::function() const { return d->function_; }
+Scene_implicit_function_item::ManipulatedFrame* Scene_implicit_function_item::manipulatedFrame() { return d->frame_; }
+void Scene_implicit_function_item::plane_was_moved() { d->need_update_ = true; QTimer::singleShot(0, this, SLOT(updateCutPlane()));}
diff --git a/3rdparty/CGAL/demo/Polyhedron/Scene_implicit_function_item.h b/3rdparty/CGAL/demo/Polyhedron/Scene_implicit_function_item.h
new file mode 100644
index 0000000..7bd9dd0
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Scene_implicit_function_item.h
@@ -0,0 +1,83 @@
+#ifndef SCENE_IMPLICIT_FUNCTION_ITEM_H
+#define SCENE_IMPLICIT_FUNCTION_ITEM_H
+
+#include <CGAL/Three/Scene_item.h>
+#include <CGAL/Three/Scene_interface.h>
+#include "Scene_implicit_function_item_config.h"
+#include "implicit_functions/Implicit_function_interface.h"
+#include "Color_ramp.h"
+#include <QGLViewer/manipulatedFrame.h>
+#include <Viewer.h>
+
+#define SCENE_IMPLICIT_GRID_SIZE 120
+
+class Viewer_interface;
+struct Scene_implicit_function_item_priv;
+class Texture{
+private:
+     int Width;
+     int Height;
+     int size;
+    GLubyte *data;
+public:
+    Texture(int w, int h)
+    {
+        Width = w;
+        Height = h;
+        size = 3*Height*Width;
+        data = new GLubyte[size];
+    }
+    int getWidth() const {return Width;}
+    int getHeight() const {return Height;}
+    int getSize() const {return size;}
+    void setData(int i, int j, int r, int g, int b){
+        data[j*Width*3 +i*3] = r;
+        data[j*Width*3 +i*3+1] = g;
+        data[j*Width*3 +i*3+2] = b;}
+    GLubyte* getData(){return data; }
+
+};
+class SCENE_IMPLICIT_FUNCTION_ITEM_EXPORT Scene_implicit_function_item 
+  : public CGAL::Three::Scene_item
+{
+  Q_OBJECT
+  
+  typedef qglviewer::ManipulatedFrame ManipulatedFrame;
+  
+public:
+  Scene_implicit_function_item(Implicit_function_interface*);
+  virtual ~Scene_implicit_function_item();
+  
+  Implicit_function_interface* function() const ;
+
+  bool isFinite() const { return true; }
+  bool isEmpty() const { return false; }
+  void compute_bbox() const;
+
+  Scene_implicit_function_item* clone() const { return NULL; }
+
+  // rendering mode
+  virtual bool supportsRenderingMode(RenderingMode m) const;
+  virtual bool manipulatable() const { return true; }
+  virtual ManipulatedFrame* manipulatedFrame();
+  
+
+
+  // actually draw() is also overloaded to detect when the cut plane is moved
+  virtual void draw()const {}
+  virtual void draw(CGAL::Three::Viewer_interface*) const;
+  virtual void drawEdges(CGAL::Three::Viewer_interface*) const;
+
+  virtual QString toolTip() const;
+  virtual void invalidateOpenGLBuffers();
+public Q_SLOTS:
+  void plane_was_moved();
+  void compute_function_grid() const;
+  void updateCutPlane();
+
+protected:
+  friend struct Scene_implicit_function_item_priv;
+  Scene_implicit_function_item_priv* d;
+};
+
+#endif // SCENE_IMPLICIT_FUNCTION_ITEM
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_implicit_function_item_config.h b/3rdparty/CGAL/demo/Polyhedron/Scene_implicit_function_item_config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Scene_implicit_function_item_config.h
rename to 3rdparty/CGAL/demo/Polyhedron/Scene_implicit_function_item_config.h
diff --git a/3rdparty/CGAL/demo/Polyhedron/Scene_item.cpp b/3rdparty/CGAL/demo/Polyhedron/Scene_item.cpp
new file mode 100644
index 0000000..1384305
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Scene_item.cpp
@@ -0,0 +1,241 @@
+#include <CGAL/Three/Scene_item.h>
+#include <CGAL/Three/Scene_group_item.h>
+#include <CGAL/Three/Scene_interface.h>
+#include <QMenu>
+#include <iostream>
+#include <QDebug>
+#include <CGAL/Three/Viewer_interface.h>
+const QColor CGAL::Three::Scene_item::defaultColor = QColor(100, 100, 255);
+
+CGAL::Three::Scene_item::Scene_item(int buffers_size, int vaos_size)
+  : name_("unamed"),
+    color_(defaultColor),
+    visible_(true),
+    are_buffers_filled(false),
+    rendering_mode(FlatPlusEdges),
+    defaultContextMenu(0),
+    buffersSize(buffers_size),
+    vaosSize(vaos_size),
+    vaos(vaos_size)
+{
+  is_bbox_computed = false;
+  is_diag_bbox_computed = false;
+  for(int i=0; i<vaosSize; i++)
+  {
+    addVaos(i);
+    vaos[i]->create();
+  }
+
+  buffers.reserve(buffersSize);
+  for(int i=0; i<buffersSize; i++)
+  {
+    QOpenGLBuffer n_buf;
+    buffers.push_back(n_buf);
+    buffers[i].create();
+  }
+  nb_isolated_vertices = 0;
+  has_group = 0;
+  parent_group = 0;
+  is_selected = false;
+}
+
+CGAL::Three::Scene_item::~Scene_item() {
+  if(defaultContextMenu)
+    defaultContextMenu->deleteLater();
+  for(int i=0; i<buffersSize; i++)
+  {
+    buffers[i].destroy();
+  }
+  for(int i=0; i<vaosSize; i++)
+  {
+    delete vaos[i];
+  }
+}
+
+void CGAL::Three::Scene_item::itemAboutToBeDestroyed(CGAL::Three::Scene_item* item) {
+    if(this == item)
+    {
+      Q_EMIT aboutToBeDestroyed();
+    }
+}
+
+
+QString modeName(RenderingMode mode) {
+    switch(mode)
+    {
+    case Points:
+        return QObject::tr("points");
+    case Wireframe:
+        return QObject::tr("wire");
+    case Flat:
+        return QObject::tr("flat");
+    case FlatPlusEdges:
+        return QObject::tr("flat+edges");
+    case Gouraud:
+        return QObject::tr("Gouraud");
+    case PointsPlusNormals:
+        return QObject::tr("pts+normals");
+    case Splatting:
+        return QObject::tr("splats");
+    default:
+        Q_ASSERT(false);
+        return QObject::tr("unknown");
+    }
+}
+
+const char* slotName(RenderingMode mode) {
+    switch(mode)
+    {
+    case Points:
+        return SLOT(setPointsMode());
+    case Wireframe:
+        return SLOT(setWireframeMode());
+    case Flat:
+        return SLOT(setFlatMode());
+    case FlatPlusEdges:
+        return SLOT(setFlatPlusEdgesMode());
+    case Gouraud:
+        return SLOT(setGouraudMode());
+    case PointsPlusNormals:
+        return SLOT(setPointsPlusNormalsMode());
+    case Splatting:
+        return SLOT(setSplattingMode());
+    default:
+        Q_ASSERT(false);
+        return "";
+    }
+}
+
+// Rendering mode as a human readable string
+QString CGAL::Three::Scene_item::renderingModeName() const
+{
+    return modeName(renderingMode());
+} 
+QMenu* CGAL::Three::Scene_item::contextMenu()
+{
+    if(defaultContextMenu) {
+        defaultContextMenu->setTitle(name());
+        return defaultContextMenu;
+    }
+
+    defaultContextMenu = new QMenu(name());
+    // defaultContextMenu->addAction(name());
+    // defaultContextMenu->addSeparator();
+    // QMenu* modeMenu = new QMenu(QObject::tr("Rendering mode"),
+    //                             defaultContextMenu);
+    for(unsigned int mode = 0; mode < NumberOfRenderingMode;
+        ++mode)
+    {
+        if(!supportsRenderingMode(RenderingMode(mode))) continue;
+        QString mName = modeName(RenderingMode(mode));
+        defaultContextMenu->addAction(tr("Set %1 Mode")
+                                      .arg(mName),
+                                      this,
+                                      slotName(RenderingMode(mode)));
+    }
+    // defaultContextMenu->addAction(modeMenu->menuAction());
+    return defaultContextMenu;
+}
+
+CGAL::Three::Scene_group_item* CGAL::Three::Scene_item::parentGroup() const {
+  return parent_group;
+}
+
+void CGAL::Three::Scene_item::
+moveToGroup(CGAL::Three::Scene_group_item* group) {
+  parent_group = group;
+  if(group)
+    has_group = group->has_group + 1;
+  else
+    has_group = 0;
+}
+
+void CGAL::Three::Scene_item::invalidateOpenGLBuffers() {}
+
+void CGAL::Three::Scene_item::selection_changed(bool) {}
+void CGAL::Three::Scene_item::setVisible(bool b)
+{
+  visible_ = b;
+}
+
+
+void CGAL::Three::Scene_item::select(double /*orig_x*/,
+                        double /*orig_y*/,
+                        double /*orig_z*/,
+                        double /*dir_x*/,
+                        double /*dir_y*/,
+                        double /*dir_z*/)
+{
+}
+
+// set-up the uniform attributes of the shader programs.
+void CGAL::Three::Scene_item::attribBuffers(CGAL::Three::Viewer_interface* viewer,
+                                             int program_name) const
+{
+    viewer->attribBuffers(program_name);
+    viewer->getShaderProgram(program_name)->bind();
+    if(is_selected)
+        viewer->getShaderProgram(program_name)->setUniformValue("is_selected", true);
+    else
+        viewer->getShaderProgram(program_name)->setUniformValue("is_selected", false);
+    QColor c = this->color();
+    if(program_name == Scene_item::PROGRAM_WITH_TEXTURE)
+    {
+       if(is_selected) c = c.lighter(120);
+       viewer->getShaderProgram(program_name)->setAttributeValue
+         ("color_facets",
+          c.redF(),
+          c.greenF(),
+          c.blueF());
+    }
+    else if(program_name == PROGRAM_WITH_TEXTURED_EDGES)
+    {
+        if(is_selected) c = c.lighter(50);
+        viewer->getShaderProgram(program_name)->setUniformValue
+          ("color_lines",
+           QVector3D(c.redF(), c.greenF(), c.blueF()));
+    }
+    viewer->getShaderProgram(program_name)->release();
+}
+
+
+QOpenGLShaderProgram* CGAL::Three::Scene_item::getShaderProgram(int name, CGAL::Three::Viewer_interface * viewer) const
+{
+    if(viewer == 0)
+        viewer = dynamic_cast<CGAL::Three::Viewer_interface*>(*QGLViewer::QGLViewerPool().begin());
+    return viewer->getShaderProgram(name);
+}
+
+CGAL::Three::Scene_item::Header_data CGAL::Three::Scene_item::header() const
+{
+  CGAL::Three::Scene_item::Header_data data;
+  return data;
+}
+
+QString CGAL::Three::Scene_item::computeStats(int )
+{
+  return QString();
+}
+
+void CGAL::Three::Scene_item::printPrimitiveId(QPoint, CGAL::Three::Viewer_interface*)
+{
+}
+
+void CGAL::Three::Scene_item::printPrimitiveIds(CGAL::Three::Viewer_interface*)const
+{
+}
+bool CGAL::Three::Scene_item::testDisplayId(double, double, double, CGAL::Three::Viewer_interface*)
+{
+    return false;
+}
+
+void CGAL::Three::Scene_item::compute_diag_bbox()const
+{
+ const Bbox& b_box = bbox();
+  _diag_bbox = CGAL::sqrt(
+        CGAL::square(b_box.xmax() - b_box.xmin())
+        + CGAL::square(b_box.ymax() - b_box.ymin())
+        + CGAL::square(b_box.zmax() - b_box.zmin())
+        );
+
+}
diff --git a/3rdparty/CGAL/demo/Polyhedron/Scene_nef_polyhedron_item.cpp b/3rdparty/CGAL/demo/Polyhedron/Scene_nef_polyhedron_item.cpp
new file mode 100644
index 0000000..e7fd3ef
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Scene_nef_polyhedron_item.cpp
@@ -0,0 +1,744 @@
+#include "Scene_nef_polyhedron_item.h"
+#include <CGAL/Three/Viewer_interface.h>
+#include "Scene_polyhedron_item.h"
+#include "Nef_type.h"
+#include "Polyhedron_type.h"
+#include <CGAL/Polyhedron_incremental_builder_3.h>
+// #include <CGAL/OFF_to_nef_3.h>
+#include <CGAL/IO/Polyhedron_iostream.h>
+#include <CGAL/IO/Nef_polyhedron_iostream_3.h>
+#include <CGAL/Inverse_index.h>
+
+#include <QObject>
+#include <QApplication>
+
+#include <CGAL/minkowski_sum_3.h>
+#include <CGAL/convex_decomposition_3.h>
+
+#include <CGAL/Triangulation_2_projection_traits_3.h>
+#include <CGAL/Triangulation_vertex_base_with_info_2.h>
+#include <CGAL/Triangulation_face_base_with_info_2.h>
+
+typedef Nef_polyhedron::Traits Traits;
+typedef Nef_polyhedron::Halffacet Facet;
+typedef CGAL::Triangulation_2_projection_traits_3<Traits>   P_traits;
+typedef Nef_polyhedron::Halfedge_const_handle Halfedge_handle;
+struct Face_info {
+    Nef_polyhedron::Halfedge_const_handle e[3];
+    bool is_external;
+};
+typedef CGAL::Triangulation_vertex_base_with_info_2<Halfedge_handle,
+P_traits>        Vb;
+typedef CGAL::Triangulation_face_base_with_info_2<Face_info,
+P_traits>          Fb1;
+typedef CGAL::Constrained_triangulation_face_base_2<P_traits, Fb1>   Fb;
+typedef CGAL::Triangulation_data_structure_2<Vb,Fb>                  TDS;
+typedef CGAL::Exact_predicates_tag                                    Itag;
+typedef CGAL::Constrained_Delaunay_triangulation_2<P_traits,
+TDS,
+Itag>             CDTbase;
+typedef CGAL::Constrained_triangulation_plus_2<CDTbase>              CDT;
+
+
+struct DPoint {
+    DPoint(GLdouble x, GLdouble y, GLdouble z)
+    {
+        coords[0] = x;
+        coords[1] = y;
+        coords[2] = z;
+    }
+    GLdouble coords[3];
+};
+
+
+
+struct Scene_nef_polyhedron_item_priv
+{
+  typedef CGAL::Three::Scene_item Base;
+  typedef std::vector<QColor> Color_vector;
+
+  Scene_nef_polyhedron_item_priv(Scene_nef_polyhedron_item* parent)
+    :nef_poly(new Nef_polyhedron)
+  {
+    item = parent;
+    nb_points = 0;
+    nb_lines = 0;
+    nb_facets = 0;
+  }
+  Scene_nef_polyhedron_item_priv(Nef_polyhedron* const p, Scene_nef_polyhedron_item *parent)
+    :nef_poly(p)
+  {
+    item = parent;
+    nb_points = 0;
+    nb_lines = 0;
+    nb_facets = 0;
+  }
+  Scene_nef_polyhedron_item_priv(const Nef_polyhedron& p, Scene_nef_polyhedron_item* parent)
+    :nef_poly(new Nef_polyhedron(p))
+  {
+    item = parent;
+    nb_points = 0;
+    nb_lines = 0;
+    nb_facets = 0;
+  }
+
+~Scene_nef_polyhedron_item_priv()
+  {
+      delete nef_poly;
+  }
+
+  void initializeBuffers(CGAL::Three::Viewer_interface *viewer) const;
+  void compute_normals_and_vertices(void) const;
+  Nef_polyhedron* nef_poly;
+
+  enum VAOs {
+      Facets = 0,
+      Edges,
+      Points,
+      NbOfVaos
+  };
+  enum VBOs {
+      Facets_vertices = 0,
+      Facets_normals,
+      Edges_vertices,
+      Points_vertices,
+      NbOfVbos
+  };
+
+  mutable std::vector<double> positions_lines;
+  mutable std::vector<double> positions_facets;
+  mutable std::vector<double> positions_points;
+  mutable std::vector<double> normals;
+  mutable std::vector<double> color_lines;
+  mutable std::vector<double> color_facets;
+  mutable std::vector<double> color_points;
+  mutable std::size_t nb_points;
+  mutable std::size_t nb_lines;
+  mutable std::size_t nb_facets;
+  mutable QOpenGLShaderProgram *program;
+  Scene_nef_polyhedron_item *item;
+
+};
+Scene_nef_polyhedron_item::Scene_nef_polyhedron_item()
+    : Scene_item(Scene_nef_polyhedron_item_priv::NbOfVbos,Scene_nef_polyhedron_item_priv::NbOfVaos)
+{
+  is_selected = true;
+  d = new Scene_nef_polyhedron_item_priv(this);
+}
+
+Scene_nef_polyhedron_item::Scene_nef_polyhedron_item(Nef_polyhedron* const p)
+    : Scene_item(Scene_nef_polyhedron_item_priv::NbOfVbos,Scene_nef_polyhedron_item_priv::NbOfVaos)
+{
+    is_selected = true;
+    d = new Scene_nef_polyhedron_item_priv(p, this);
+
+}
+
+Scene_nef_polyhedron_item::Scene_nef_polyhedron_item(const Nef_polyhedron& p)
+    : Scene_item(Scene_nef_polyhedron_item_priv::NbOfVbos,Scene_nef_polyhedron_item_priv::NbOfVaos)
+{
+     is_selected = true;
+     d = new Scene_nef_polyhedron_item_priv(p, this);
+}
+
+Scene_nef_polyhedron_item::~Scene_nef_polyhedron_item()
+{
+  delete d;
+}
+
+void Scene_nef_polyhedron_item_priv::initializeBuffers(CGAL::Three::Viewer_interface *viewer) const
+{
+    //vao for the facets
+    {
+        program = item->getShaderProgram(Scene_nef_polyhedron_item::PROGRAM_WITH_LIGHT, viewer);
+        program->bind();
+
+        item->vaos[Facets]->bind();
+        item->buffers[Facets_vertices].bind();
+        item->buffers[Facets_vertices].allocate(positions_facets.data(),
+                            static_cast<int>(positions_facets.size()*sizeof(double)));
+        program->enableAttributeArray("vertex");
+        program->setAttributeBuffer("vertex",GL_DOUBLE,0,3);
+        item->buffers[Facets_vertices].release();
+
+
+
+        item->buffers[Facets_normals].bind();
+        item->buffers[Facets_normals].allocate(normals.data(),
+                            static_cast<int>(normals.size()*sizeof(double)));
+        program->enableAttributeArray("normals");
+        program->setAttributeBuffer("normals",GL_DOUBLE,0,3);
+        item->buffers[Facets_normals].release();
+
+        nb_facets = positions_facets.size();
+        positions_facets.resize(0);
+        std::vector<double>(positions_facets).swap(positions_facets);
+
+        normals.resize(0);
+        std::vector<double>(normals).swap(normals);
+
+        program->release();
+
+    }
+    //vao for the edges
+    {
+        program = item->getShaderProgram(Scene_nef_polyhedron_item::PROGRAM_WITHOUT_LIGHT, viewer);
+        program->bind();
+
+        item->vaos[Edges]->bind();
+        item->buffers[Edges_vertices].bind();
+        item->buffers[Edges_vertices].allocate(positions_lines.data(),
+                            static_cast<int>(positions_lines.size()*sizeof(double)));
+        program->enableAttributeArray("vertex");
+        program->setAttributeBuffer("vertex",GL_DOUBLE,0,3);
+        item->buffers[Edges_vertices].release();
+
+
+        nb_lines = positions_lines.size();
+        positions_lines.resize(0);
+        std::vector<double>(positions_lines).swap(positions_lines);
+        item->vaos[Edges]->release();
+        program->release();
+    }
+    //vao for the points
+    {
+        program = item->getShaderProgram(Scene_nef_polyhedron_item::PROGRAM_WITHOUT_LIGHT, viewer);
+        program->bind();
+
+        item->vaos[Points]->bind();
+        item->buffers[Points_vertices].bind();
+        item->buffers[Points_vertices].allocate(positions_points.data(),
+                            static_cast<int>(positions_points.size()*sizeof(double)));
+        program->enableAttributeArray("vertex");
+        program->setAttributeBuffer("vertex",GL_DOUBLE,0,3);
+        item->buffers[Points_vertices].release();
+
+        item->vaos[Points]->release();
+
+        nb_points = positions_points.size();
+        positions_points.resize(0);
+        std::vector<double>(positions_points).swap(positions_points);
+        program->release();
+    }
+    item->are_buffers_filled = true;
+}
+void Scene_nef_polyhedron_item_priv::compute_normals_and_vertices(void) const
+{
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    int count = 0;
+    positions_facets.resize(0);
+    positions_points.resize(0);
+    normals.resize(0);
+    positions_lines.resize(0);
+    //The Facets
+    {
+        for(Nef_polyhedron::Halffacet_const_iterator
+            f = nef_poly->halffacets_begin (),
+            end = nef_poly->halffacets_end();
+            f != end; ++f)
+        {
+            if(f->is_twin()) continue;
+            count++;
+            Nef_polyhedron::Vector_3 v = f->plane().orthogonal_vector();
+            P_traits cdt_traits(v);
+            CDT cdt(cdt_traits);
+
+            for(Nef_polyhedron::Halffacet_cycle_const_iterator
+                fc = f->facet_cycles_begin(),
+                end = f->facet_cycles_end();
+                fc != end; ++fc)
+            {
+                if ( fc.is_shalfedge() )
+                {
+
+                    Nef_polyhedron::SHalfedge_const_handle h = fc;
+                    Nef_polyhedron::SHalfedge_around_facet_const_circulator hc(h), he(hc);
+
+                    CDT::Vertex_handle previous, first;
+
+                    do {
+                        Nef_polyhedron::SVertex_const_handle v = hc->source();
+                        const Nef_polyhedron::Point_3& point = v->source()->point();
+                        CDT::Vertex_handle vh = cdt.insert(point);
+                        if(first == 0) {
+                            first = vh;
+                        }
+                        vh->info() = hc->source();
+                        if(previous != 0 && previous != vh) {
+                            cdt.insert_constraint(previous, vh);
+                        }
+                        previous = vh;
+                    } while( ++hc != he );
+
+                    cdt.insert_constraint(previous, first);
+
+                    // sets mark is_external
+                    for(CDT::All_faces_iterator
+                        fit = cdt.all_faces_begin(),
+                        end = cdt.all_faces_end();
+                        fit != end; ++fit)
+                    {
+                        fit->info().is_external = false;
+
+                    }
+                    //check if the facet is external or internal
+                    std::queue<CDT::Face_handle> face_queue;
+                    face_queue.push(cdt.infinite_vertex()->face());
+
+                    while(! face_queue.empty() ) {
+                        CDT::Face_handle fh = face_queue.front();
+                        face_queue.pop();
+                        if(fh->info().is_external) continue;
+                        fh->info().is_external = true;
+                        for(int i = 0; i <3; ++i) {
+                            if(!cdt.is_constrained(std::make_pair(fh, i)))
+                            {
+                                face_queue.push(fh->neighbor(i));
+                            }
+                        }
+
+                    }
+                    //iterates on the internal faces to add the vertices to the positions
+                    //and the normals to the appropriate vectors
+
+                    for(CDT::Finite_faces_iterator
+                        ffit = cdt.finite_faces_begin(),
+                        end = cdt.finite_faces_end();
+                        ffit != end; ++ffit)
+                    {
+
+
+                        if(ffit->info().is_external){ continue;}
+                        for(int i = 0; i<3; i++)
+                        {
+                            positions_facets.push_back(CGAL::to_double(ffit->vertex(i)->point().x()));
+                            positions_facets.push_back(CGAL::to_double(ffit->vertex(i)->point().y()));
+                            positions_facets.push_back(CGAL::to_double(ffit->vertex(i)->point().z()));
+
+                        }
+
+
+
+                        Nef_polyhedron::Vector_3 v = f->plane().orthogonal_vector();
+                        GLdouble normal[3];
+                        normal[0] = CGAL::to_double(v.x());
+                        normal[1] = CGAL::to_double(v.y());
+                        normal[2] = CGAL::to_double(v.z());
+                        GLdouble norm = normal[0]*normal[0]
+                                + normal[1]*normal[1]
+                                + normal[2]*normal[2];
+                        norm = CGAL::sqrt(norm);
+                        normal[0] /= norm;
+                        normal[1] /= norm;
+                        normal[2] /= norm;
+
+                        normals.push_back(normal[0]);
+                        normals.push_back(normal[1]);
+                        normals.push_back(normal[2]);
+
+                        normals.push_back(normal[0]);
+                        normals.push_back(normal[1]);
+                        normals.push_back(normal[2]);
+
+                        normals.push_back(normal[0]);
+                        normals.push_back(normal[1]);
+                        normals.push_back(normal[2]);
+
+                    }
+                }
+            }
+        }
+
+    } // end facets
+
+    //The Lines
+    {
+       for(Nef_polyhedron::Halfedge_const_iterator
+            e = nef_poly->halfedges_begin(),
+            end = nef_poly->halfedges_end();
+            e != end; ++e)
+        {
+            if (e->is_twin()) continue;
+            const Nef_polyhedron::Vertex_const_handle& s = e->source();
+            const Nef_polyhedron::Vertex_const_handle& t = e->twin()->source();
+            const Nef_polyhedron::Point_3& a = s->point();
+            const Nef_polyhedron::Point_3& b = t->point();
+
+            positions_lines.push_back(CGAL::to_double(a.x()));
+            positions_lines.push_back(CGAL::to_double(a.y()));
+            positions_lines.push_back(CGAL::to_double(a.z()));
+
+            positions_lines.push_back(CGAL::to_double(b.x()));
+            positions_lines.push_back(CGAL::to_double(b.y()));
+            positions_lines.push_back(CGAL::to_double(b.z()));
+
+
+        }
+    }
+    //The points
+    {
+        for(Nef_polyhedron::Vertex_const_iterator
+            v = nef_poly->vertices_begin(),
+            end = nef_poly->vertices_end();
+            v != end; ++v)
+        {
+            const Nef_polyhedron::Point_3& p = v->point();
+            positions_points.push_back(CGAL::to_double(p.x()));
+            positions_points.push_back(CGAL::to_double(p.y()));
+            positions_points.push_back(CGAL::to_double(p.z()));
+
+                color_points.push_back(item->color().lighter(50).redF());
+                color_points.push_back(item->color().lighter(50).greenF());
+                color_points.push_back(item->color().lighter(50).blueF());
+
+                color_points.push_back(item->color().lighter(50).redF());
+                color_points.push_back(item->color().lighter(50).greenF());
+                color_points.push_back(item->color().lighter(50).blueF());
+
+        }
+
+    } //end points
+    QApplication::restoreOverrideCursor();
+}
+Scene_nef_polyhedron_item* 
+Scene_nef_polyhedron_item::clone() const {
+    return new Scene_nef_polyhedron_item(*d->nef_poly);
+}
+
+bool
+Scene_nef_polyhedron_item::load_from_off(std::istream& in)
+{
+    //   const std::size_t discarded = CGAL::OFF_to_nef_3(in, *nef_poly);
+    //   return discarded != 0;
+
+    Exact_polyhedron exact_poly;
+    in >> exact_poly;
+    *d->nef_poly = Nef_polyhedron(exact_poly);
+
+    //   Polyhedron poly;
+    //   in >> poly;
+    //   *nef_poly = Nef_polyhedron(poly);
+    invalidateOpenGLBuffers();
+    return (bool) in;
+}
+
+QFont 
+Scene_nef_polyhedron_item::font() const {
+    QFont font;
+    font.setItalic(!font.italic());
+    return font;
+}
+
+bool
+Scene_nef_polyhedron_item::load(std::istream& in)
+{
+    in >> *d->nef_poly;
+    invalidateOpenGLBuffers();
+    return (bool) in;
+}
+
+bool
+Scene_nef_polyhedron_item::save(std::ostream& in) const
+{
+    in << *d->nef_poly;
+    return (bool) in;
+}
+
+QString 
+Scene_nef_polyhedron_item::toolTip() const
+{
+    if(!d->nef_poly)
+        return QString();
+
+    return QObject::tr("<p><b>%1</b> (mode: %5, color: %6)<br />"
+                       "<i>Nef_3 polyhedron</i></p>"
+                       "<p>Number of vertices: %2<br />"
+                       "Number of edges: %3<br />"
+                       "Number of facets: %4<br />"
+                       "number of volumes: %7</p>")
+            .arg(this->name())
+            .arg(d->nef_poly->number_of_vertices())
+            .arg(d->nef_poly->number_of_edges())
+            .arg(d->nef_poly->number_of_facets())
+            .arg(this->renderingModeName())
+            .arg(this->color().name())
+            .arg(d->nef_poly->number_of_volumes());
+}
+
+void Scene_nef_polyhedron_item::draw(CGAL::Three::Viewer_interface* viewer) const
+{
+    if(!are_buffers_filled)
+    {
+        d->compute_normals_and_vertices();
+        d->initializeBuffers(viewer);
+    }
+    vaos[Scene_nef_polyhedron_item_priv::Facets]->bind();
+
+    // tells the GPU to use the program just created
+    d->program=getShaderProgram(PROGRAM_WITH_LIGHT);
+    attribBuffers(viewer,PROGRAM_WITH_LIGHT);
+    d->program->bind();
+    d->program->setUniformValue("is_two_side", 1);
+    viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(d->nb_facets/3));
+    vaos[Scene_nef_polyhedron_item_priv::Facets]->release();
+    d->program->release();
+    GLfloat point_size;
+    viewer->glGetFloatv(GL_POINT_SIZE, &point_size);
+    viewer->glPointSize(10.f);
+
+    drawPoints(viewer);
+    viewer->glPointSize(point_size);
+
+}
+void Scene_nef_polyhedron_item::drawEdges(CGAL::Three::Viewer_interface* viewer) const
+{
+    if(!are_buffers_filled)
+    {
+        d->compute_normals_and_vertices();
+        d->initializeBuffers(viewer);
+    }
+
+    vaos[Scene_nef_polyhedron_item_priv::Edges]->bind();
+    d->program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
+    attribBuffers(viewer ,PROGRAM_WITHOUT_LIGHT);
+    d->program->bind();
+    viewer->glDrawArrays(GL_LINES,0,static_cast<GLsizei>(d->nb_lines/3));
+    vaos[Scene_nef_polyhedron_item_priv::Edges]->release();
+    d->program->release();
+    if(renderingMode() == PointsPlusNormals)
+    {
+        GLfloat point_size;
+        viewer->glGetFloatv(GL_POINT_SIZE, &point_size);
+        viewer->glPointSize(10.f);
+
+        drawPoints(viewer);
+        viewer->glPointSize(point_size);
+    }
+}
+void Scene_nef_polyhedron_item::drawPoints(CGAL::Three::Viewer_interface* viewer) const
+{
+    if(!are_buffers_filled)
+    {
+        d->compute_normals_and_vertices();
+        d->initializeBuffers(viewer);
+    }
+    vaos[Scene_nef_polyhedron_item_priv::Points]->bind();
+    d->program=getShaderProgram(PROGRAM_WITHOUT_LIGHT);
+    attribBuffers(viewer ,PROGRAM_WITHOUT_LIGHT);
+    d->program->bind();
+    d->program->setAttributeValue("colors", this->color());
+    viewer->glDrawArrays(GL_POINTS,0,static_cast<GLsizei>(d->nb_points/3));
+    vaos[Scene_nef_polyhedron_item_priv::Points]->release();
+    d->program->release();
+
+}
+
+Nef_polyhedron*
+Scene_nef_polyhedron_item::nef_polyhedron() {
+    return d->nef_poly;
+}
+
+bool
+Scene_nef_polyhedron_item::isEmpty() const {
+    return (d->nef_poly == 0) || d->nef_poly->is_empty();
+}
+
+void
+Scene_nef_polyhedron_item::compute_bbox() const {
+    if(isEmpty())
+    {
+        _bbox = Bbox();
+        return;
+    }
+    CGAL::Bbox_3 bbox(d->nef_poly->vertices_begin()->point().bbox());
+    for(Nef_polyhedron::Vertex_const_iterator it = d->nef_poly->vertices_begin();
+        it != d->nef_poly->vertices_end();
+        ++it) {
+        bbox = bbox + it->point().bbox();
+    }
+    _bbox = Bbox(bbox.xmin(),bbox.ymin(),bbox.zmin(),
+                bbox.xmax(),bbox.ymax(),bbox.zmax());
+}
+
+// quick hacks to convert polyhedra from exact to inexact and vice-versa
+template <class Polyhedron_input,
+          class Polyhedron_output>
+struct Copy_polyhedron_to 
+        : public CGAL::Modifier_base<typename Polyhedron_output::HalfedgeDS>
+{
+    Copy_polyhedron_to(const Polyhedron_input& in_poly)
+        : in_poly(in_poly) {}
+
+    void operator()(typename Polyhedron_output::HalfedgeDS& out_hds)
+    {
+        typedef typename Polyhedron_output::HalfedgeDS Output_HDS;
+
+        CGAL::Polyhedron_incremental_builder_3<Output_HDS> builder(out_hds);
+
+        typedef typename Polyhedron_input::Vertex_const_iterator Vertex_const_iterator;
+        typedef typename Polyhedron_input::Facet_const_iterator  Facet_const_iterator;
+        typedef typename Polyhedron_input::Halfedge_around_facet_const_circulator HFCC;
+
+        builder.begin_surface(in_poly.size_of_vertices(),
+                              in_poly.size_of_facets(),
+                              in_poly.size_of_halfedges());
+
+        for(Vertex_const_iterator
+            vi = in_poly.vertices_begin(), end = in_poly.vertices_end();
+            vi != end ; ++vi)
+        {
+            typename Polyhedron_output::Point_3 p(::CGAL::to_double( vi->point().x()),
+                                                  ::CGAL::to_double( vi->point().y()),
+                                                  ::CGAL::to_double( vi->point().z()));
+            builder.add_vertex(p);
+        }
+
+        typedef CGAL::Inverse_index<Vertex_const_iterator> Index;
+        Index index( in_poly.vertices_begin(), in_poly.vertices_end());
+
+        for(Facet_const_iterator
+            fi = in_poly.facets_begin(), end = in_poly.facets_end();
+            fi != end; ++fi)
+        {
+            HFCC hc = fi->facet_begin();
+            HFCC hc_end = hc;
+            //     std::size_t n = circulator_size( hc);
+            //     CGAL_assertion( n >= 3);
+            builder.begin_facet ();
+            do {
+                builder.add_vertex_to_facet(index[hc->vertex()]);
+                ++hc;
+            } while( hc != hc_end);
+            builder.end_facet();
+        }
+        builder.end_surface();
+    } // end operator()(..)
+private:
+    const Polyhedron_input& in_poly;
+}; // end Copy_polyhedron_to<>
+
+template <class Poly_A, class Poly_B>
+void copy_to(const Poly_A& poly_a, Poly_B& poly_b)
+{
+    Copy_polyhedron_to<Poly_A, Poly_B> modifier(poly_a);
+    poly_b.delegate(modifier);
+}
+
+void from_exact(Exact_polyhedron& in,
+                Polyhedron& out)
+{
+    copy_to(in, out);
+    CGAL_assertion(out.is_valid());
+}
+
+void to_exact(Polyhedron& in,
+              Exact_polyhedron& out)
+{
+    copy_to(in, out);
+    CGAL_assertion(out.is_valid());
+}
+
+bool Scene_nef_polyhedron_item::is_simple() const
+{
+    return d->nef_poly->is_simple();
+}
+
+// [static]
+Scene_nef_polyhedron_item* 
+Scene_nef_polyhedron_item::from_polyhedron(Scene_polyhedron_item* item)
+{
+    Polyhedron* poly = item->polyhedron();
+    if(!poly) return 0;
+
+    Exact_polyhedron exact_poly;
+    to_exact(*poly, exact_poly);
+    Nef_polyhedron* nef_poly = new Nef_polyhedron(exact_poly);
+    exact_poly.clear();
+
+    return new Scene_nef_polyhedron_item(nef_poly);
+}
+
+Scene_polyhedron_item*
+Scene_nef_polyhedron_item::convert_to_polyhedron() const {
+    Exact_polyhedron exact_poly;
+    d->nef_poly->convert_to_Polyhedron(exact_poly);
+    Polyhedron* poly = new Polyhedron;
+    from_exact(exact_poly, *poly);
+    exact_poly.clear();
+    return new Scene_polyhedron_item(poly);
+}
+
+Scene_nef_polyhedron_item&
+Scene_nef_polyhedron_item::
+operator+=(const Scene_nef_polyhedron_item& other)
+{
+    (*d->nef_poly) += (*other.d->nef_poly);
+    return *this;
+}
+
+Scene_nef_polyhedron_item&
+Scene_nef_polyhedron_item::
+operator*=(const Scene_nef_polyhedron_item& other)
+{
+    (*d->nef_poly) *= (*other.d->nef_poly);
+    return *this;
+}
+
+Scene_nef_polyhedron_item&
+Scene_nef_polyhedron_item::
+operator-=(const Scene_nef_polyhedron_item& other)
+{
+    (*d->nef_poly) -= (*other.d->nef_poly);
+    return *this;
+}
+
+Scene_nef_polyhedron_item*
+Scene_nef_polyhedron_item::
+sum(const Scene_nef_polyhedron_item& a, 
+    const Scene_nef_polyhedron_item& b)
+{
+    return new Scene_nef_polyhedron_item(CGAL::minkowski_sum_3(*a.d->nef_poly,
+                                                               *b.d->nef_poly));
+}
+
+void
+Scene_nef_polyhedron_item::
+convex_decomposition(std::list< Scene_polyhedron_item*>& convex_parts)
+{
+    // copy the Nef polyhedron, as markers are added
+    Nef_polyhedron N(*d->nef_poly);
+    CGAL::convex_decomposition_3(N);
+
+    typedef Nef_polyhedron::Volume_const_iterator Volume_const_iterator;
+
+    Volume_const_iterator ci = ++N.volumes_begin();
+    for( ; ci != N.volumes_end(); ++ci) {
+        if(ci->mark()) {
+            Exact_polyhedron P;
+            N.convert_inner_shell_to_polyhedron(ci->shells_begin(), P);
+            Polyhedron* poly = new Polyhedron;
+            from_exact(P, *poly);
+            Scene_polyhedron_item *spoly = new Scene_polyhedron_item(poly);
+            convex_parts.push_back(spoly);
+            spoly->invalidateOpenGLBuffers();
+        }
+    }
+}
+
+void
+Scene_nef_polyhedron_item::
+invalidateOpenGLBuffers()
+{
+    compute_bbox();
+    CGAL::Three::Scene_item::invalidateOpenGLBuffers();
+    are_buffers_filled = false;
+}
+
+void
+Scene_nef_polyhedron_item::selection_changed(bool p_is_selected)
+{
+
+    if(p_is_selected != is_selected)
+        is_selected = p_is_selected;
+
+}
diff --git a/3rdparty/CGAL/demo/Polyhedron/Scene_nef_polyhedron_item.h b/3rdparty/CGAL/demo/Polyhedron/Scene_nef_polyhedron_item.h
new file mode 100644
index 0000000..818c27a
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Scene_nef_polyhedron_item.h
@@ -0,0 +1,74 @@
+#ifndef SCENE_NEF_POLYHEDRON_ITEM_H
+#define SCENE_NEF_POLYHEDRON_ITEM_H
+#include  <CGAL/Three/Scene_item.h>
+#include "Scene_nef_polyhedron_item_config.h"
+#include "Nef_type_fwd.h"
+#include <iostream>
+#include <queue>
+class Scene_polyhedron_item;
+struct Scene_nef_polyhedron_item_priv;
+class SCENE_NEF_POLYHEDRON_ITEM_EXPORT Scene_nef_polyhedron_item
+ : public CGAL::Three::Scene_item
+{
+  Q_OBJECT
+public:
+  Scene_nef_polyhedron_item();
+//   Scene_nef_polyhedron_item(const Scene_nef_polyhedron_item&);
+  Scene_nef_polyhedron_item(const Nef_polyhedron& p);
+  Scene_nef_polyhedron_item(Nef_polyhedron* const p);
+  ~Scene_nef_polyhedron_item();
+
+  Scene_nef_polyhedron_item* clone() const;
+  bool load_from_off(std::istream& in);
+  bool load(std::istream& in);
+  bool save(std::ostream& in) const;
+
+  QFont font() const;
+  QString toolTip() const;
+
+  virtual void invalidateOpenGLBuffers();
+  virtual void selection_changed(bool);
+  // Indicate if rendering mode is supported
+  virtual bool supportsRenderingMode(RenderingMode m) const { return m != Gouraud && m!=Splatting; } // CHECK THIS!
+  // OpenGL drawing in a display list
+  void direct_draw() const;
+
+  virtual void draw(CGAL::Three::Viewer_interface*) const;
+  virtual void drawEdges() const {}
+  virtual void drawEdges(CGAL::Three::Viewer_interface* viewer) const;
+  virtual void drawPoints(CGAL::Three::Viewer_interface*) const;
+  // Wireframe OpenGL drawing
+
+  bool isFinite() const { return true; }
+  bool isEmpty() const;
+  void compute_bbox() const;
+
+  Nef_polyhedron* nef_polyhedron();
+
+  bool is_simple() const;
+  bool is_Triangle;
+  // conversion operations
+  static Scene_nef_polyhedron_item* from_polyhedron(Scene_polyhedron_item*);
+  Scene_polyhedron_item* convert_to_polyhedron() const;
+
+  // Nef boolean operations
+  Scene_nef_polyhedron_item&
+  operator+=(const Scene_nef_polyhedron_item&); // union
+
+  Scene_nef_polyhedron_item&
+  operator*=(const Scene_nef_polyhedron_item&); // intersection
+
+  Scene_nef_polyhedron_item&
+  operator-=(const Scene_nef_polyhedron_item&); // difference
+
+  static Scene_nef_polyhedron_item*
+  sum(const Scene_nef_polyhedron_item&, 
+      const Scene_nef_polyhedron_item&);
+
+  void convex_decomposition(std::list< Scene_polyhedron_item*>&);
+protected:
+  friend struct Scene_nef_polyhedron_item_priv;
+  Scene_nef_polyhedron_item_priv* d;
+}; // end class Scene_nef_polyhedron_item
+
+#endif // SCENE_NEF_POLYHEDRON_ITEM_H
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_nef_polyhedron_item_config.h b/3rdparty/CGAL/demo/Polyhedron/Scene_nef_polyhedron_item_config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Scene_nef_polyhedron_item_config.h
rename to 3rdparty/CGAL/demo/Polyhedron/Scene_nef_polyhedron_item_config.h
diff --git a/3rdparty/CGAL/demo/Polyhedron/Scene_plane_item.cpp b/3rdparty/CGAL/demo/Polyhedron/Scene_plane_item.cpp
new file mode 100644
index 0000000..e393662
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Scene_plane_item.cpp
@@ -0,0 +1,267 @@
+#include "Scene_plane_item.h"
+#include <QApplication>
+using namespace CGAL::Three;
+
+
+
+Scene_plane_item::Scene_plane_item(const CGAL::Three::Scene_interface* scene_interface)
+      :CGAL::Three::Scene_item(NbOfVbos,NbOfVaos),
+      scene(scene_interface),
+      manipulable(false),
+      can_clone(true),
+      frame(new ManipulatedFrame())
+  {
+    setNormal(0., 0., 1.);
+    //Generates an integer which will be used as ID for each buffer
+    invalidateOpenGLBuffers();
+  }
+Scene_plane_item::~Scene_plane_item() {
+  delete frame;
+}
+
+void Scene_plane_item::initializeBuffers(Viewer_interface *viewer) const
+{
+    program = getShaderProgram(PROGRAM_WITHOUT_LIGHT, viewer);
+    program->bind();
+    vaos[Facets]->bind();
+
+    buffers[Facets_vertices].bind();
+    buffers[Facets_vertices].allocate(positions_quad.data(),
+                        static_cast<int>(positions_quad.size()*sizeof(float)));
+    program->enableAttributeArray("vertex");
+    program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
+    buffers[Facets_vertices].release();
+    vaos[Facets]->release();
+
+
+    vaos[Edges]->bind();
+    buffers[Edges_vertices].bind();
+    buffers[Edges_vertices].allocate(positions_lines.data(),
+                        static_cast<int>(positions_lines.size()*sizeof(float)));
+    program->enableAttributeArray("vertex");
+    program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
+    buffers[Edges_vertices].release();
+    vaos[Edges]->release();
+
+    program->release();
+    are_buffers_filled = true;
+
+}
+
+void Scene_plane_item::compute_normals_and_vertices(void) const
+{
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    positions_quad.resize(0);
+    positions_lines.resize(0);
+
+    const double diag = scene_diag();
+    //The quad
+    {
+
+    positions_quad.push_back(-diag);
+    positions_quad.push_back(-diag);
+    positions_quad.push_back(0.0);
+    positions_quad.push_back(-diag);
+    positions_quad.push_back(diag);
+    positions_quad.push_back(0.0);
+    positions_quad.push_back(diag);
+    positions_quad.push_back(-diag);
+    positions_quad.push_back(0.0);
+
+    positions_quad.push_back(diag);
+    positions_quad.push_back(-diag);
+    positions_quad.push_back(0.0);
+    positions_quad.push_back(-diag);
+    positions_quad.push_back(diag);
+    positions_quad.push_back(0.0);
+    positions_quad.push_back(diag);
+    positions_quad.push_back(diag);
+    positions_quad.push_back(0.0);
+
+}
+    //The grid
+    float x = (2*diag)/10.0;
+    float y = (2*diag)/10.0;
+    {
+        for(int u = 0; u < 11; u++)
+        {
+
+            positions_lines.push_back(-diag + x* u);
+            positions_lines.push_back(-diag);
+            positions_lines.push_back(0.0);
+
+            positions_lines.push_back(-diag + x* u);
+            positions_lines.push_back(diag);
+            positions_lines.push_back(0.0);
+        }
+        for(int v=0; v<11; v++)
+        {
+
+            positions_lines.push_back(-diag);
+            positions_lines.push_back(-diag + v * y);
+            positions_lines.push_back(0.0);
+
+            positions_lines.push_back(diag);
+            positions_lines.push_back(-diag + v * y);
+            positions_lines.push_back(0.0);
+        }
+
+    }
+    QApplication::restoreOverrideCursor();
+}
+
+void Scene_plane_item::draw(Viewer_interface* viewer)const
+{
+    if(!are_buffers_filled)
+        initializeBuffers(viewer);
+    vaos[Facets]->bind();
+    program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
+    attribBuffers(viewer, PROGRAM_WITHOUT_LIGHT);
+    QMatrix4x4 f_matrix;
+    for(int i=0; i<16; i++)
+        f_matrix.data()[i] = (float)frame->matrix()[i];
+    program->bind();
+    program->setUniformValue("f_matrix", f_matrix);
+    program->setAttributeValue("colors",this->color());
+    program->setUniformValue("is_selected", false);
+    viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(positions_quad.size()/3));
+    program->release();
+    vaos[Facets]->release();
+
+}
+
+void Scene_plane_item::drawEdges(CGAL::Three::Viewer_interface* viewer)const
+{
+    if(!are_buffers_filled)
+        initializeBuffers(viewer);
+    vaos[Edges]->bind();
+    program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
+    attribBuffers(viewer, PROGRAM_WITHOUT_LIGHT);
+    QMatrix4x4 f_matrix;
+    for(int i=0; i<16; i++)
+        f_matrix.data()[i] = (float)frame->matrix()[i];
+    program->bind();
+    program->setUniformValue("f_matrix", f_matrix);
+    program->setAttributeValue("colors",QVector3D(0,0,0));
+    viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(positions_lines.size()/3));
+    program->release();
+    vaos[Edges]->release();
+}
+
+void Scene_plane_item::flipPlane()
+{
+  qglviewer::Quaternion q;
+  qglviewer::Vec axis(0,1,0);
+  if(frame->orientation().axis() == axis)
+    q.setAxisAngle(qglviewer::Vec(1,0,0), M_PI);
+  else
+    q.setAxisAngle(axis, M_PI);
+  frame->rotate(q.normalized());
+  invalidateOpenGLBuffers();
+  Q_EMIT itemChanged();
+
+}
+
+bool Scene_plane_item::manipulatable() const {
+  return manipulable;
+}
+Scene_item::ManipulatedFrame* Scene_plane_item::manipulatedFrame() {
+  return frame;
+}
+
+Scene_plane_item* Scene_plane_item::clone() const {
+  if(can_clone)
+  {
+    Scene_plane_item* item = new Scene_plane_item(scene);
+    item->manipulable = manipulable;
+    item->can_clone = true;
+    item->frame = new ManipulatedFrame;
+    item->frame->setPosition(frame->position());
+    item->frame->setOrientation(frame->orientation());
+    return item;
+  }
+  else
+    return 0;
+}
+
+QString Scene_plane_item::toolTip() const {
+  const qglviewer::Vec& pos = frame->position();
+  const qglviewer::Vec& n = frame->inverseTransformOf(qglviewer::Vec(0.f, 0.f, 1.f));
+  return
+    tr("<p><b>%1</b> (mode: %2, color: %3)<br />")
+    .arg(this->name())
+    .arg(this->renderingModeName())
+    .arg(this->color().name())
+
+    +
+    tr("<i>Plane</i></p>"
+       "<p>Equation: %1*x + %2*y + %3*z + %4 = 0<br />"
+       "Normal vector: (%1, %2, %3)<br />"
+       "Point: (%5, %6, %7)</p>")
+    .arg(n[0]).arg(n[1]).arg(n[2])
+    .arg( - pos * n)
+    .arg(pos[0]).arg(pos[1]).arg(pos[2])
+    +
+    tr("<p>Can clone: %1<br />"
+       "Manipulatable: %2</p>")
+    .arg(can_clone?tr("true"):tr("false"))
+    .arg(manipulable?tr("true"):tr("false"));
+}
+
+Plane_3 Scene_plane_item::plane() const {
+  const qglviewer::Vec& pos = frame->position();
+  const qglviewer::Vec& n =
+    frame->inverseTransformOf(qglviewer::Vec(0.f, 0.f, 1.f));
+  return Plane_3(n[0], n[1],  n[2], - n * pos);
+}
+
+void Scene_plane_item::invalidateOpenGLBuffers()
+{
+    compute_normals_and_vertices();
+    are_buffers_filled = false;
+    compute_bbox();
+}
+
+void Scene_plane_item::setPosition(float x, float y, float z) {
+  frame->setPosition(x, y, z);
+}
+
+void Scene_plane_item::setPosition(double x, double y, double z) {
+  frame->setPosition((float)x, (float)y, (float)z);
+}
+
+void Scene_plane_item::setNormal(float x, float y, float z) {
+  QVector3D normal(x,y,z);
+  if(normal == QVector3D(0,0,0))
+    return;
+  QVector3D origin(0,0,1);
+  qglviewer::Quaternion q;
+  if(origin == normal)
+  {
+    return;
+  }
+   if(origin == -normal)
+  {
+    q.setAxisAngle(qglviewer::Vec(0,1,0),M_PI);
+    frame->setOrientation(q);
+    return;
+  }
+
+  QVector3D cp = QVector3D::crossProduct(origin, normal);
+  cp.normalize();
+  q.setAxisAngle(qglviewer::Vec(cp.x(),cp.y(), cp.z()),acos(QVector3D::dotProduct(origin, normal)/(normal.length()*origin.length())));
+
+  frame->setOrientation(q.normalized());
+}
+
+void Scene_plane_item::setNormal(double x, double y, double z) {
+  setNormal((float)x, (float)y, (float)z);
+}
+
+void Scene_plane_item::setClonable(bool b) {
+  can_clone = b;
+}
+
+void Scene_plane_item::setManipulatable(bool b) {
+  manipulable = b;
+}
diff --git a/3rdparty/CGAL/demo/Polyhedron/Scene_plane_item.h b/3rdparty/CGAL/demo/Polyhedron/Scene_plane_item.h
new file mode 100644
index 0000000..3f05a64
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Scene_plane_item.h
@@ -0,0 +1,100 @@
+#ifndef SCENE_PLANE_ITEM_H
+#define SCENE_PLANE_ITEM_H
+
+
+#include  <CGAL/Three/Scene_item.h>
+#include <CGAL/Three/Scene_interface.h>
+
+#include "Scene_basic_objects_config.h"
+
+#include <QGLViewer/manipulatedFrame.h>
+#include <QGLViewer/qglviewer.h>
+#include <CGAL/Three/Viewer_interface.h>
+
+#include <cmath>
+
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel_epic;
+typedef Kernel_epic::Plane_3 Plane_3;
+
+class SCENE_BASIC_OBJECTS_EXPORT Scene_plane_item 
+  : public CGAL::Three::Scene_item
+{
+  Q_OBJECT
+public:
+  typedef qglviewer::ManipulatedFrame ManipulatedFrame;
+
+  Scene_plane_item(const CGAL::Three::Scene_interface* scene_interface);
+  ~Scene_plane_item();
+
+  double scene_diag() const {
+    const Scene_item::Bbox& bbox = scene->bbox();
+    const double& xdelta = bbox.xmax()-bbox.xmin();
+    const double& ydelta = bbox.ymax()-bbox.ymin();
+    const double& zdelta = bbox.zmax()-bbox.zmin();
+    const double diag = std::sqrt(xdelta*xdelta +
+                            ydelta*ydelta +
+                            zdelta*zdelta);
+    return diag * 0.7;
+  }
+  bool isFinite() const { return false; }
+  bool isEmpty() const { return false; }
+  void compute_bbox() const { _bbox = Bbox(); }
+  bool manipulatable() const;
+  ManipulatedFrame* manipulatedFrame();
+
+  Scene_plane_item* clone() const;
+
+  QString toolTip() const;
+
+  // Indicate if rendering mode is supported
+  bool supportsRenderingMode(RenderingMode m) const {
+    return (m == Wireframe || m == Flat || m == FlatPlusEdges);
+  }
+  virtual void draw(CGAL::Three::Viewer_interface*) const;
+ virtual void drawEdges(CGAL::Three::Viewer_interface* viewer)const;
+  Plane_3 plane() const;
+
+public Q_SLOTS:
+  virtual void invalidateOpenGLBuffers();
+
+  void setPosition(float x, float y, float z);
+  
+  void setPosition(double x, double y, double z);
+  
+  void setNormal(float x, float y, float z);
+
+  void setNormal(double x, double y, double z);
+  void flipPlane();
+  void setClonable(bool b = true);
+
+  void setManipulatable(bool b = true);
+protected:
+
+  const CGAL::Three::Scene_interface* scene;
+  bool manipulable;
+  bool can_clone;
+  qglviewer::ManipulatedFrame* frame;
+
+  enum VAOs {
+      Facets = 0,
+      Edges,
+      NbOfVaos
+  };
+  enum VBOs {
+      Facets_vertices = 0,
+      Edges_vertices,
+      NbOfVbos
+  };
+
+  mutable std::vector<float> positions_lines;
+  mutable std::vector<float> positions_quad;
+  mutable GLint sampler_location;
+  mutable bool smooth_shading;
+  mutable QOpenGLShaderProgram *program;
+
+  void initializeBuffers(CGAL::Three::Viewer_interface*)const;
+  void compute_normals_and_vertices(void) const;
+};
+
+#endif // SCENE_PLANE_ITEM_H
diff --git a/3rdparty/CGAL/demo/Polyhedron/Scene_points_with_normal_item.cpp b/3rdparty/CGAL/demo/Polyhedron/Scene_points_with_normal_item.cpp
new file mode 100644
index 0000000..6668158
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Scene_points_with_normal_item.cpp
@@ -0,0 +1,787 @@
+#include "Scene_points_with_normal_item.h"
+#include "Polyhedron_type.h"
+#include <CGAL/Polygon_mesh_processing/compute_normal.h>
+
+#include <CGAL/IO/read_ply_points.h>
+#include <CGAL/IO/write_ply_points.h>
+#include <CGAL/IO/read_off_points.h>
+#include <CGAL/IO/write_off_points.h>
+#include <CGAL/IO/read_xyz_points.h>
+#include <CGAL/IO/write_xyz_points.h>
+#include <CGAL/Timer.h>
+#include <CGAL/Memory_sizer.h>
+#include <CGAL/compute_average_spacing.h>
+
+#include <CGAL/Three/Viewer_interface.h>
+#include <CGAL/Orthogonal_k_neighbor_search.h>
+#include <CGAL/Search_traits_3.h>
+
+#include <QObject>
+#include <QApplication>
+#include <QMenu>
+#include <QSlider>
+#include <QWidgetAction>
+#include <QGLViewer/manipulatedCameraFrame.h>
+
+#include <set>
+#include <stack>
+#include <algorithm>
+#include <boost/array.hpp>
+
+struct Scene_points_with_normal_item_priv
+{
+  Scene_points_with_normal_item_priv(Scene_points_with_normal_item* parent)
+    :m_points(new Point_set),
+      m_has_normals(false)
+  {
+    item = parent;
+    nb_points = 0;
+    nb_selected_points = 0;
+    nb_lines = 0;
+    normal_Slider = new QSlider(Qt::Horizontal);
+    normal_Slider->setValue(20);
+    point_Slider = new QSlider(Qt::Horizontal);
+    point_Slider->setValue(5);
+    point_Slider->setMinimum(1);
+    point_Slider->setMaximum(25);
+  }
+  Scene_points_with_normal_item_priv(const Scene_points_with_normal_item& toCopy, Scene_points_with_normal_item* parent)
+    : m_points(new Point_set(*toCopy.d->m_points)),
+      m_has_normals(toCopy.d->m_has_normals)
+  {
+    item = parent;
+    normal_Slider = new QSlider(Qt::Horizontal);
+    normal_Slider->setValue(20);
+    point_Slider = new QSlider(Qt::Horizontal);
+    point_Slider->setValue(5);
+    point_Slider->setMinimum(1);
+    point_Slider->setMaximum(25);
+  }
+  Scene_points_with_normal_item_priv(const Polyhedron& input_mesh, Scene_points_with_normal_item* parent)
+    : m_points(new Point_set),
+      m_has_normals(true)
+  {
+    item = parent;
+    nb_points = 0;
+    nb_selected_points = 0;
+    nb_lines = 0;
+    Polyhedron::Vertex_iterator v;
+    for (v = const_cast<Polyhedron&>(input_mesh).vertices_begin();
+         v != const_cast<Polyhedron&>(input_mesh).vertices_end(); v++)
+    {
+      const Kernel::Point_3& p = v->point();
+      Kernel::Vector_3 n =
+        CGAL::Polygon_mesh_processing::compute_vertex_normal(v, input_mesh);
+      m_points->push_back(UI_point(p,n));
+    }
+    normal_Slider = new QSlider(Qt::Horizontal);
+    normal_Slider->setValue(20);
+    point_Slider = new QSlider(Qt::Horizontal);
+    point_Slider->setValue(5);
+    point_Slider->setMinimum(1);
+    point_Slider->setMaximum(25);
+  }
+  ~Scene_points_with_normal_item_priv()
+  {
+    Q_ASSERT(m_points != NULL);
+    delete m_points; m_points = NULL;
+    delete normal_Slider;
+    delete point_Slider;
+  }
+  void initializeBuffers(CGAL::Three::Viewer_interface *viewer) const;
+  void compute_normals_and_vertices() const;
+  enum VAOs {
+      Edges=0,
+      ThePoints,
+      Selected_points,
+      NbOfVaos
+  };
+  enum VBOs {
+      Edges_vertices = 0,
+      Points_vertices,
+      Points_normals,
+      Selected_points_vertices,
+      Selected_points_normals,
+      NbOfVbos
+  };
+  Point_set* m_points;
+  bool m_has_normals;
+  QAction* actionDeleteSelection;
+  QAction* actionResetSelection;
+  QAction* actionSelectDuplicatedPoints;
+  QSlider* normal_Slider;
+  QSlider* point_Slider;
+  mutable std::vector<double> positions_lines;
+  mutable std::vector<double> positions_points;
+  mutable std::vector<double> positions_selected_points;
+  mutable std::vector<double> normals;
+  mutable std::vector<double> positions_normals;
+  mutable std::vector<double> positions_selected_normals;
+  mutable std::size_t nb_points;
+  mutable std::size_t nb_selected_points;
+  mutable std::size_t nb_lines;
+  mutable QOpenGLShaderProgram *program;
+
+  Scene_points_with_normal_item* item;
+};
+
+
+Scene_points_with_normal_item::Scene_points_with_normal_item()
+    : Scene_item(Scene_points_with_normal_item_priv::NbOfVbos,Scene_points_with_normal_item_priv::NbOfVaos)
+{
+    setRenderingMode(Points);
+    is_selected = true;
+    d = new Scene_points_with_normal_item_priv(this);
+}
+
+// Copy constructor
+Scene_points_with_normal_item::Scene_points_with_normal_item(const Scene_points_with_normal_item& toCopy)
+    :Scene_item(Scene_points_with_normal_item_priv::NbOfVbos,Scene_points_with_normal_item_priv::NbOfVaos)
+{
+
+  d = new Scene_points_with_normal_item_priv(toCopy, this);
+  if (d->m_has_normals)
+    {
+        setRenderingMode(PointsPlusNormals);
+        is_selected = true;
+    }
+  else
+    {
+        setRenderingMode(Points);
+        is_selected = true;
+    }
+
+    invalidateOpenGLBuffers();
+}
+
+// Converts polyhedron to point set
+Scene_points_with_normal_item::Scene_points_with_normal_item(const Polyhedron& input_mesh)
+    : Scene_item(Scene_points_with_normal_item_priv::NbOfVbos,Scene_points_with_normal_item_priv::NbOfVaos)
+{
+  // Converts Polyhedron vertices to point set.
+  // Computes vertices normal from connectivity.
+  d = new Scene_points_with_normal_item_priv(input_mesh, this);
+  setRenderingMode(PointsPlusNormals);
+  is_selected = true;
+  invalidateOpenGLBuffers();
+}
+
+Scene_points_with_normal_item::~Scene_points_with_normal_item()
+{
+  delete d;
+}
+
+
+
+void Scene_points_with_normal_item_priv::initializeBuffers(CGAL::Three::Viewer_interface *viewer) const
+{
+    compute_normals_and_vertices();
+    //vao for the edges
+    {
+        program = item->getShaderProgram(Scene_points_with_normal_item::PROGRAM_NO_SELECTION, viewer);
+        program->bind();
+
+        item->vaos[Edges]->bind();
+        item->buffers[Edges_vertices].bind();
+        item->buffers[Edges_vertices].allocate(positions_lines.data(),
+                            static_cast<int>(positions_lines.size()*sizeof(double)));
+        program->enableAttributeArray("vertex");
+        program->setAttributeBuffer("vertex",GL_DOUBLE,0,3);
+        item->buffers[Edges_vertices].release();
+
+        item->vaos[Edges]->release();
+        nb_lines = positions_lines.size();
+        positions_lines.resize(0);
+        std::vector<double>(positions_lines).swap(positions_lines);
+        program->release();
+    }
+    //vao for the points
+    {
+        if(item->has_normals())
+          program = item->getShaderProgram(Scene_points_with_normal_item::PROGRAM_WITH_LIGHT, viewer);
+        else
+          program = item->getShaderProgram(Scene_points_with_normal_item::PROGRAM_NO_SELECTION, viewer);
+        program->bind();
+
+        item->vaos[ThePoints]->bind();
+        item->buffers[Points_vertices].bind();
+        item->buffers[Points_vertices].allocate(positions_points.data(),
+                            static_cast<int>(positions_points.size()*sizeof(double)));
+        program->enableAttributeArray("vertex");
+        program->setAttributeBuffer("vertex",GL_DOUBLE,0,3);
+        item->buffers[Points_vertices].release();
+
+        if(item->has_normals())
+        {
+          item->buffers[Points_normals].bind();
+          item->buffers[Points_normals].allocate(positions_normals.data(),
+                                          static_cast<int>(positions_normals.size()*sizeof(double)));
+          program->enableAttributeArray("normals");
+          program->setAttributeBuffer("normals",GL_DOUBLE,0,3);
+          item->buffers[Points_normals].release();
+          positions_normals.resize(0);
+          std::vector<double>(positions_normals).swap(positions_normals);
+        }
+        item->vaos[ThePoints]->release();
+        nb_points = positions_points.size();
+        positions_points.resize(0);
+        std::vector<double>(positions_points).swap(positions_points);
+        program->release();
+    }
+    //vao for the selected points
+    {
+        if(item->has_normals())
+          program = item->getShaderProgram(Scene_points_with_normal_item::PROGRAM_WITH_LIGHT, viewer);
+        else
+          program = item->getShaderProgram(Scene_points_with_normal_item::PROGRAM_NO_SELECTION, viewer);
+
+        program->bind();
+
+        item->vaos[Selected_points]->bind();
+        item->buffers[Selected_points_vertices].bind();
+        item->buffers[Selected_points_vertices].allocate(positions_selected_points.data(),
+                            static_cast<int>(positions_selected_points.size()*sizeof(double)));
+        program->enableAttributeArray("vertex");
+        program->setAttributeBuffer("vertex",GL_DOUBLE,0,3);
+        item->buffers[Selected_points_vertices].release();
+
+        if(item->has_normals())
+        {
+          item->buffers[Selected_points_normals].bind();
+          item->buffers[Selected_points_normals].allocate(positions_selected_normals.data(),
+                                          static_cast<int>(positions_selected_normals.size()*sizeof(double)));
+          program->enableAttributeArray("normals");
+          program->setAttributeBuffer("normals",GL_DOUBLE,0,3);
+          item->buffers[Selected_points_normals].release();
+          positions_selected_normals.resize(0);
+          std::vector<double>(positions_selected_normals).swap(positions_selected_normals);
+        }
+        item->vaos[Selected_points]->release();
+        nb_selected_points = positions_selected_points.size();
+        positions_selected_points.resize(0);
+        std::vector<double>(positions_selected_points).swap(positions_selected_points);
+        program->release();
+    }
+    item->are_buffers_filled = true;
+}
+
+void Scene_points_with_normal_item_priv::compute_normals_and_vertices() const
+{
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    positions_points.resize(0);
+    positions_lines.resize(0);
+    positions_selected_points.resize(0);
+    normals.resize(0);
+    positions_normals.resize(0);
+    positions_selected_normals.resize(0);
+    normals.resize(0);
+
+    positions_points.reserve(m_points->size() * 3);
+    positions_lines.reserve(m_points->size() * 3 * 2);
+    if(item->has_normals())
+    {
+      positions_normals.reserve((m_points->size() - m_points->nb_selected_points()) * 3);
+      positions_selected_normals.reserve(m_points->nb_selected_points() * 3);
+    }
+    //Shuffle container to allow quick display random points
+    Point_set_3<Kernel> points = *m_points;
+    std::random_shuffle (points.begin(), points.end() - m_points->nb_selected_points());
+    std::random_shuffle (points.end() - m_points->nb_selected_points(), points.end());
+    
+    //The points
+    {
+        // The *non-selected* points
+      for (Point_set_3<Kernel>::const_iterator it = points.begin(); it != points.first_selected(); it++)
+	{
+	  const UI_point& p = *it;
+	  positions_points.push_back(p.x());
+	  positions_points.push_back(p.y());
+	  positions_points.push_back(p.z());
+	}
+
+        // Draw *selected* points
+      for (Point_set_3<Kernel>::const_iterator it = points.first_selected(); it != points.end(); it++)
+	{
+	  const UI_point& p = *it;
+	  positions_selected_points.push_back(p.x());
+	  positions_selected_points.push_back(p.y());
+	  positions_selected_points.push_back(p.z());
+	}
+    }
+
+    //The lines
+    {
+        // Stock normals
+        Kernel::Sphere_3 region_of_interest = points.region_of_interest();
+
+#ifdef LINK_WITH_TBB
+       typedef CGAL::Parallel_tag Concurrency_tag;
+#else
+        typedef CGAL::Sequential_tag Concurrency_tag;
+#endif
+
+        double average_spacing = CGAL::compute_average_spacing<Concurrency_tag>(
+              points.begin(), points.end(),
+              6);
+
+        double normal_length = (std::min)(average_spacing, std::sqrt(region_of_interest.squared_radius() / 1000.));
+        double length_factor = 5.0/100*normal_Slider->value();
+        for (Point_set_3<Kernel>::const_iterator it = points.begin(); it != points.first_selected(); it++)
+	  {
+	    const UI_point& p = *it;
+	    const Point_set_3<Kernel>::Vector& n = p.normal();
+            Point_set_3<Kernel>::Point q = p + normal_length * length_factor* n;
+	    positions_lines.push_back(p.x());
+	    positions_lines.push_back(p.y());
+	    positions_lines.push_back(p.z());
+
+	    positions_lines.push_back(q.x());
+	    positions_lines.push_back(q.y());
+	    positions_lines.push_back(q.z());
+
+
+            positions_normals.push_back(n.x());
+            positions_normals.push_back(n.y());
+            positions_normals.push_back(n.z());
+	  }
+        for (Point_set_3<Kernel>::const_iterator it = points.first_selected(); it != points.end(); it++)
+          {
+            const UI_point& p = *it;
+            const Point_set_3<Kernel>::Vector& n = p.normal();
+            Point_set_3<Kernel>::Point q = p + normal_length * length_factor* n;
+            positions_lines.push_back(p.x());
+            positions_lines.push_back(p.y());
+            positions_lines.push_back(p.z());
+
+            positions_lines.push_back(q.x());
+            positions_lines.push_back(q.y());
+            positions_lines.push_back(q.z());
+
+
+            positions_selected_normals.push_back(n.x());
+            positions_selected_normals.push_back(n.y());
+            positions_selected_normals.push_back(n.z());
+          }
+    }
+    QApplication::restoreOverrideCursor();
+}
+
+// Duplicates scene item
+Scene_points_with_normal_item*
+Scene_points_with_normal_item::clone() const
+{
+  return new Scene_points_with_normal_item(*this);
+}
+
+// Is selection empty?
+bool Scene_points_with_normal_item::isSelectionEmpty() const
+{
+  return (d->m_points->nb_selected_points() == 0);
+}
+
+// Delete selection
+void Scene_points_with_normal_item::deleteSelection()
+{
+  CGAL::Timer task_timer; task_timer.start();
+  std::cerr << "Delete " << d->m_points->nb_selected_points() << " points...";
+
+  // Delete selected points
+  d->m_points->delete_selection();
+
+  std::size_t memory = CGAL::Memory_sizer().virtual_size();
+  std::cerr << "done: " << task_timer.time() << " seconds, "
+                        << (memory>>20) << " Mb allocated"
+                        << std::endl;
+  invalidateOpenGLBuffers();
+  Q_EMIT itemChanged();
+}
+
+// Invert selection
+void Scene_points_with_normal_item::invertSelection()
+{
+  d->m_points->invert_selection();
+  invalidateOpenGLBuffers();
+  Q_EMIT itemChanged();
+}
+
+// Select everything
+void Scene_points_with_normal_item::selectAll()
+{
+  d->m_points->select_all();
+  invalidateOpenGLBuffers();
+  Q_EMIT itemChanged();
+}
+// Reset selection mark
+void Scene_points_with_normal_item::resetSelection()
+{
+  // Un-select all points
+  d->m_points->unselect_all();
+  invalidateOpenGLBuffers();
+  Q_EMIT itemChanged();
+}
+  //Select duplicated points
+void Scene_points_with_normal_item::selectDuplicates()
+{
+  std::set<Kernel::Point_3> unique_points;
+  for (Point_set::iterator ptit=d->m_points->begin(); ptit!=d->m_points->end();++ptit )
+    if ( !unique_points.insert(*ptit).second )
+      d->m_points->select(ptit);
+  invalidateOpenGLBuffers();
+  Q_EMIT itemChanged();
+}
+
+// Loads point set from .PLY file
+bool Scene_points_with_normal_item::read_ply_point_set(std::istream& stream)
+{
+  Q_ASSERT(d->m_points != NULL);
+
+  d->m_points->clear();
+  bool ok = stream &&
+            CGAL::read_ply_points_and_normals(stream,
+                                              std::back_inserter(*d->m_points),
+                                              CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type())) &&
+            !isEmpty();
+  if (ok)
+    {
+      for (Point_set::iterator it=d->m_points->begin(),
+             end=d->m_points->end();it!=end; ++it)
+        {
+          if (it->normal() != CGAL::NULL_VECTOR)
+            {
+              d->m_has_normals=true;
+              setRenderingMode(PointsPlusNormals);
+              break;
+            }
+        }
+    }
+  invalidateOpenGLBuffers();
+  return ok;
+}
+
+// Write point set to .PLY file
+bool Scene_points_with_normal_item::write_ply_point_set(std::ostream& stream) const
+{
+  Q_ASSERT(d->m_points != NULL);
+
+  return stream &&
+         CGAL::write_ply_points_and_normals(stream,
+                                            d->m_points->begin(), d->m_points->end(),
+                                            CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()));
+}
+
+// Loads point set from .OFF file
+bool Scene_points_with_normal_item::read_off_point_set(std::istream& stream)
+{
+  Q_ASSERT(d->m_points != NULL);
+
+  d->m_points->clear();
+  bool ok = stream &&
+            CGAL::read_off_points_and_normals(stream,
+                                              std::back_inserter(*d->m_points),
+                                              CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type())) &&
+            !isEmpty();
+  invalidateOpenGLBuffers();
+  return ok;
+}
+
+// Write point set to .OFF file
+bool Scene_points_with_normal_item::write_off_point_set(std::ostream& stream) const
+{
+  Q_ASSERT(d->m_points != NULL);
+
+  return stream &&
+         CGAL::write_off_points_and_normals(stream,
+                                            d->m_points->begin(), d->m_points->end(),
+                                            CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()));
+}
+
+// Loads point set from .XYZ file
+bool Scene_points_with_normal_item::read_xyz_point_set(std::istream& stream)
+{
+  Q_ASSERT(d->m_points != NULL);
+
+  d->m_points->clear();
+  bool ok = stream &&
+            CGAL::read_xyz_points_and_normals(stream,
+                                              std::back_inserter(*d->m_points),
+                                              CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type())) &&
+            !isEmpty();
+
+  if (ok)
+  {
+    for (Point_set::iterator it=d->m_points->begin(),
+                             end=d->m_points->end();it!=end; ++it)
+    {
+      if (it->normal() != CGAL::NULL_VECTOR)
+      {
+        d->m_has_normals=true;
+        setRenderingMode(PointsPlusNormals);
+        break;
+      }
+    }
+  }
+  invalidateOpenGLBuffers();
+  return ok;
+}
+
+// Write point set to .XYZ file
+bool Scene_points_with_normal_item::write_xyz_point_set(std::ostream& stream) const
+{
+  Q_ASSERT(d->m_points != NULL);
+
+  return stream &&
+         CGAL::write_xyz_points_and_normals(stream,
+                                            d->m_points->begin(), d->m_points->end(),
+                                            CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()));
+}
+
+QString
+Scene_points_with_normal_item::toolTip() const
+{
+  Q_ASSERT(d->m_points != NULL);
+
+  return QObject::tr("<p><b>%1</b> (color: %4)<br />"
+                     "<i>Point set</i></p>"
+                     "<p>Number of points: %2</p>")
+    .arg(name())
+    .arg(d->m_points->size())
+    .arg(color().name());
+}
+
+bool Scene_points_with_normal_item::supportsRenderingMode(RenderingMode m) const 
+{
+    return m==Points ||
+            ( has_normals() &&
+              ( m==PointsPlusNormals || m==Splatting ) );
+}
+
+void Scene_points_with_normal_item::drawSplats(CGAL::Three::Viewer_interface* viewer) const
+{
+   // TODO add support for selection
+   viewer->glBegin(GL_POINTS);
+   for ( Point_set_3<Kernel>::const_iterator it = d->m_points->begin(); it != d->m_points->end(); it++)
+   {
+     const UI_point& p = *it;
+     viewer->glNormal3dv(&p.normal().x());
+     viewer->glMultiTexCoord1d(GL_TEXTURE2, p.radius());
+     viewer->glVertex3dv(&p.x());
+
+   }
+   viewer->glEnd();
+
+}
+
+void Scene_points_with_normal_item::drawEdges(CGAL::Three::Viewer_interface* viewer) const
+{
+    double ratio_displayed = 1.0;
+    if (viewer->inFastDrawing () &&
+        (d->nb_lines/6 > 300000)) // arbitrary large value
+      ratio_displayed = 6 * 300000. / (double)(d->nb_lines);
+
+    if(!are_buffers_filled)
+        d->initializeBuffers(viewer);
+    vaos[Scene_points_with_normal_item_priv::Edges]->bind();
+    d->program=getShaderProgram(PROGRAM_NO_SELECTION);
+    attribBuffers(viewer,PROGRAM_NO_SELECTION);
+    d->program->bind();
+    d->program->setAttributeValue("colors", this->color());
+    viewer->glDrawArrays(GL_LINES, 0,
+                         static_cast<GLsizei>(((std::size_t)(ratio_displayed * d->nb_lines)/3)));
+    vaos[Scene_points_with_normal_item_priv::Edges]->release();
+    d->program->release();
+}
+void Scene_points_with_normal_item::drawPoints(CGAL::Three::Viewer_interface* viewer) const
+{
+    if(!are_buffers_filled)
+        d->initializeBuffers(viewer);
+
+    GLfloat point_size;
+    viewer->glGetFloatv(GL_POINT_SIZE, &point_size);
+    viewer->glPointSize(d->point_Slider->value());
+    double ratio_displayed = 1.0;
+    if (viewer->inFastDrawing () &&
+        ((d->nb_points + d->nb_selected_points)/3 > 300000)) // arbitrary large value
+      ratio_displayed = 3 * 300000. / (double)(d->nb_points + d->nb_selected_points);
+
+    vaos[Scene_points_with_normal_item_priv::ThePoints]->bind();
+    if(has_normals())
+    {
+      d->program=getShaderProgram(PROGRAM_WITH_LIGHT);
+      attribBuffers(viewer,PROGRAM_WITH_LIGHT);
+    }
+    else
+    {
+      d->program=getShaderProgram(PROGRAM_NO_SELECTION);
+      attribBuffers(viewer,PROGRAM_NO_SELECTION);
+    }
+    d->program->bind();
+    d->program->setAttributeValue("colors", this->color());
+    viewer->glDrawArrays(GL_POINTS, 0,
+                         static_cast<GLsizei>(((std::size_t)(ratio_displayed * d->nb_points)/3)));
+    vaos[Scene_points_with_normal_item_priv::ThePoints]->release();
+    d->program->release();
+
+    vaos[Scene_points_with_normal_item_priv::Selected_points]->bind();
+    if(has_normals())
+    {
+      d->program=getShaderProgram(PROGRAM_WITH_LIGHT);
+      attribBuffers(viewer,PROGRAM_WITH_LIGHT);
+    }
+    else
+    {
+      d->program=getShaderProgram(PROGRAM_NO_SELECTION);
+      attribBuffers(viewer,PROGRAM_NO_SELECTION);
+    }
+    d->program->bind();
+    d->program->setAttributeValue("colors", QColor(255,0,0));
+    viewer->glDrawArrays(GL_POINTS, 0,
+                         static_cast<GLsizei>(((std::size_t)(ratio_displayed * d->nb_selected_points)/3)));
+    vaos[Scene_points_with_normal_item_priv::Selected_points]->release();
+    d->program->release();
+    viewer->glPointSize(point_size);
+}
+// Gets wrapped point set
+Point_set* Scene_points_with_normal_item::point_set()
+{
+  Q_ASSERT(d->m_points != NULL);
+  return d->m_points;
+}
+const Point_set* Scene_points_with_normal_item::point_set() const
+{
+  Q_ASSERT(d->m_points != NULL);
+  return d->m_points;
+}
+
+bool
+Scene_points_with_normal_item::isEmpty() const
+{
+  Q_ASSERT(d->m_points != NULL);
+  return d->m_points->empty();
+}
+
+void
+Scene_points_with_normal_item::compute_bbox() const
+{
+  Q_ASSERT(d->m_points != NULL);
+
+  Kernel::Iso_cuboid_3 bbox = d->m_points->bounding_box();
+  _bbox = Bbox(bbox.xmin(),bbox.ymin(),bbox.zmin(),
+              bbox.xmax(),bbox.ymax(),bbox.zmax());
+}
+
+void Scene_points_with_normal_item::computes_local_spacing(int k)
+{
+  typedef Kernel Geom_traits;
+  typedef CGAL::Search_traits_3<Geom_traits> TreeTraits;
+  typedef CGAL::Orthogonal_k_neighbor_search<TreeTraits> Neighbor_search;
+  typedef Neighbor_search::Tree Tree;
+
+  Point_set::iterator end(d->m_points->end());
+
+  // build kdtree
+  Tree tree(d->m_points->begin(), end);
+
+  // Compute the radius of each point = (distance max to k nearest neighbors)/2.
+  {
+    int i=0;
+    for (Point_set::iterator it=d->m_points->begin(); it!=end; ++it, ++i)
+    {
+      Neighbor_search search(tree, *it, k+1);
+      double maxdist2 = (--search.end())->second; // squared distance to furthest neighbor
+      it->radius() = sqrt(maxdist2)/2.;
+    }
+  }
+
+  d->m_points->set_radii_uptodate(true);
+}
+
+QMenu* Scene_points_with_normal_item::contextMenu()
+{
+    const char* prop_name = "Menu modified by Scene_points_with_normal_item.";
+
+    QMenu* menu = Scene_item::contextMenu();
+
+    //add a slider to modify the normals length
+    // Use dynamic properties:
+    // http://doc.qt.io/qt-5/qobject.html#property
+    bool menuChanged = menu->property(prop_name).toBool();
+
+    if(!menuChanged) {
+      if(has_normals())
+      {
+        QMenu *container = new QMenu(tr("Normals Length"));
+        QWidgetAction *sliderAction = new QWidgetAction(0);
+        connect(d->normal_Slider, &QSlider::valueChanged, this, &Scene_points_with_normal_item::invalidateOpenGLBuffers);
+        connect(d->normal_Slider, &QSlider::valueChanged, this, &Scene_points_with_normal_item::itemChanged);
+
+        sliderAction->setDefaultWidget(d->normal_Slider);
+
+        container->addAction(sliderAction);
+        menu->addMenu(container);
+      }
+        QMenu *container = new QMenu(tr("Points Size"));
+        QWidgetAction *sliderAction = new QWidgetAction(0);
+        connect(d->point_Slider, &QSlider::valueChanged, this, &Scene_points_with_normal_item::invalidateOpenGLBuffers);
+        connect(d->point_Slider, &QSlider::valueChanged, this, &Scene_points_with_normal_item::itemChanged);
+
+        sliderAction->setDefaultWidget(d->point_Slider);
+
+        container->addAction(sliderAction);
+        menu->addMenu(container);
+
+        d->actionDeleteSelection = menu->addAction(tr("Delete Selection"));
+        d->actionDeleteSelection->setObjectName("actionDeleteSelection");
+        connect(d->actionDeleteSelection, SIGNAL(triggered()),this, SLOT(deleteSelection()));
+
+        d->actionResetSelection = menu->addAction(tr("Reset Selection"));
+        d->actionResetSelection->setObjectName("actionResetSelection");
+        connect(d->actionResetSelection, SIGNAL(triggered()),this, SLOT(resetSelection()));
+
+        d->actionSelectDuplicatedPoints = menu->addAction(tr("Select duplicated points"));
+        d->actionSelectDuplicatedPoints->setObjectName("actionSelectDuplicatedPoints");
+        connect(d->actionSelectDuplicatedPoints, SIGNAL(triggered()),this, SLOT(selectDuplicates()));
+
+        menu->setProperty(prop_name, true);
+    }
+
+    if (isSelectionEmpty())
+    {
+        d->actionDeleteSelection->setDisabled(true);
+        d->actionResetSelection->setDisabled(true);
+    }
+    else
+    {
+        d->actionDeleteSelection->setDisabled(false);
+        d->actionResetSelection->setDisabled(false);
+    }
+
+    return menu;
+}
+
+void Scene_points_with_normal_item::setRenderingMode(RenderingMode m)
+{
+    Scene_item::setRenderingMode(m);
+    if (rendering_mode==Splatting && (!d->m_points->are_radii_uptodate()))
+    {
+        computes_local_spacing(6); // default value = small
+    }
+}
+
+bool Scene_points_with_normal_item::has_normals() const { return d->m_has_normals; }
+
+void Scene_points_with_normal_item::set_has_normals(bool b) {
+  if (b!=d->m_has_normals){
+    d->m_has_normals=b;
+    //reset the context menu
+    if (defaultContextMenu)
+      defaultContextMenu->deleteLater();
+    this->defaultContextMenu = 0;
+  }
+}
+
+void Scene_points_with_normal_item::invalidateOpenGLBuffers()
+{
+    are_buffers_filled = false;
+    compute_bbox();
+}
+
diff --git a/3rdparty/CGAL/demo/Polyhedron/Scene_points_with_normal_item.h b/3rdparty/CGAL/demo/Polyhedron/Scene_points_with_normal_item.h
new file mode 100644
index 0000000..de28c1c
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Scene_points_with_normal_item.h
@@ -0,0 +1,96 @@
+#ifndef POINT_SET_ITEM_H
+#define POINT_SET_ITEM_H
+#include  <CGAL/Three/Scene_item.h>
+#include "Scene_points_with_normal_item_config.h"
+#include "Polyhedron_type_fwd.h"
+#include "Kernel_type.h"
+#include "Point_set_3.h"
+
+#include <iostream>
+
+struct Scene_points_with_normal_item_priv;
+// point set
+typedef Point_set_3<Kernel> Point_set;
+typedef Point_set::UI_point UI_point; // type of points in Point_set_3
+
+class QMenu;
+class QAction;
+
+// This class represents a point set in the OpenGL scene
+class SCENE_POINTS_WITH_NORMAL_ITEM_EXPORT Scene_points_with_normal_item
+  : public CGAL::Three::Scene_item
+{
+  Q_OBJECT
+
+public:
+  Scene_points_with_normal_item();
+  Scene_points_with_normal_item(const Scene_points_with_normal_item& toCopy);
+  Scene_points_with_normal_item(const Polyhedron& p);
+  ~Scene_points_with_normal_item();
+  Scene_points_with_normal_item* clone() const;
+
+  // Is selection empty?
+  virtual bool isSelectionEmpty() const;
+
+  // Function to override the context menu
+  QMenu* contextMenu();
+
+  // IO
+  bool read_ply_point_set(std::istream& in);
+  bool write_ply_point_set(std::ostream& out) const;
+  bool read_off_point_set(std::istream& in);
+  bool write_off_point_set(std::ostream& out) const;
+  bool read_xyz_point_set(std::istream& in);
+  bool write_xyz_point_set(std::ostream& out) const;
+
+  // Function for displaying meta-data of the item
+  virtual QString toolTip() const;
+
+  virtual void invalidateOpenGLBuffers();
+
+  // Indicate if rendering mode is supported
+  virtual bool supportsRenderingMode(RenderingMode m) const;
+
+  virtual void drawEdges(CGAL::Three::Viewer_interface* viewer) const;
+  virtual void drawPoints(CGAL::Three::Viewer_interface*) const;
+
+  virtual void drawSplats(CGAL::Three::Viewer_interface*) const;
+  
+  // Gets wrapped point set
+  Point_set*       point_set();
+  const Point_set* point_set() const;
+
+  // Gets dimensions
+  virtual bool isFinite() const { return true; }
+  virtual bool isEmpty() const;
+  virtual void compute_bbox() const;
+
+  virtual void setRenderingMode(RenderingMode m);
+
+  // computes the local point spacing (aka radius) of each point
+  void computes_local_spacing(int k);
+
+  bool has_normals() const;
+  void set_has_normals(bool b);
+
+public Q_SLOTS:
+  // Delete selection
+  virtual void deleteSelection();
+  // Invert selection
+  void invertSelection();
+  // Select all points
+  void selectAll();
+  // Reset selection mark
+  void resetSelection();
+  //Select duplicated points
+  void selectDuplicates();
+
+// Data
+protected:
+  friend struct Scene_points_with_normal_item_priv;
+  Scene_points_with_normal_item_priv* d;
+
+}; // end class Scene_points_with_normal_item
+
+
+#endif // POINT_SET_ITEM_H
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_points_with_normal_item_config.h b/3rdparty/CGAL/demo/Polyhedron/Scene_points_with_normal_item_config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Scene_points_with_normal_item_config.h
rename to 3rdparty/CGAL/demo/Polyhedron/Scene_points_with_normal_item_config.h
diff --git a/3rdparty/CGAL/demo/Polyhedron/Scene_polygon_soup_item.cpp b/3rdparty/CGAL/demo/Polyhedron/Scene_polygon_soup_item.cpp
new file mode 100644
index 0000000..0398db4
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Scene_polygon_soup_item.cpp
@@ -0,0 +1,885 @@
+#include <vector>
+#include <queue>
+
+#include "Scene_polygon_soup_item.h"
+#include "Scene_polyhedron_item.h"
+#include <CGAL/Three/Viewer_interface.h>
+#include <CGAL/IO/Polyhedron_iostream.h>
+#include <CGAL/Polyhedron_incremental_builder_3.h>
+
+#include <QObject>
+#include <QApplication>
+#include <QtDebug>
+
+#include <set>
+#include <stack>
+#include <algorithm>
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+
+#include <CGAL/IO/OFF_reader.h>
+#include <CGAL/IO/File_writer_OFF.h>
+#include <CGAL/version.h> 
+
+#include <CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h>
+#include <CGAL/Polygon_mesh_processing/orient_polygon_soup.h>
+#include <CGAL/Polygon_mesh_processing/orientation.h>
+#include <CGAL/Polygon_mesh_processing/repair.h>
+
+#include <CGAL/Polygon_mesh_processing/compute_normal.h>
+#include "triangulate_primitive.h"
+#include <CGAL/array.h>
+struct Scene_polygon_soup_item_priv{
+
+  typedef Polygon_soup::Polygons::const_iterator Polygons_iterator;
+  typedef Kernel::Point_3 Point_3;
+
+  Scene_polygon_soup_item_priv(Scene_polygon_soup_item* parent)
+    : soup(0),
+      oriented(false)
+  {
+    item = parent;
+    nb_polys = 0;
+    nb_lines = 0;
+    nb_nm_edges = 0;
+  }
+  ~Scene_polygon_soup_item_priv()
+  {
+    delete soup;
+  }
+  void initializeBuffers(CGAL::Three::Viewer_interface *viewer) const;
+  void compute_normals_and_vertices(void) const;
+  void triangulate_polygon(Polygons_iterator, int ) const;
+  mutable QOpenGLShaderProgram *program;
+
+
+  enum VAOs {
+      Flat_Facets=0,
+      Smooth_Facets,
+      Edges,
+      NM_Edges,
+      NbOfVaos
+  };
+  enum VBOs {
+      Facets_vertices = 0,
+      Facets_normals,
+      Edges_vertices,
+      NM_Edges_vertices,
+      F_Colors,
+      V_Colors,
+      NbOfVbos
+  };
+  Polygon_soup* soup;
+  bool oriented;
+  mutable std::vector<float> positions_poly;
+  mutable std::vector<float> positions_lines;
+  mutable std::vector<float> f_colors;
+  mutable std::vector<float> v_colors;
+  mutable std::vector<float> normals;
+  mutable std::vector<float> positions_nm_lines;
+  mutable std::size_t nb_nm_edges;
+  mutable std::size_t nb_polys;
+  mutable std::size_t nb_lines;
+  Scene_polygon_soup_item* item;
+
+};
+
+
+struct Polyhedron_to_polygon_soup_writer {
+  typedef Kernel::Point_3 Point_3;
+
+  Polygon_soup* soup;
+  Polygon_soup::Polygon_3 polygon;
+
+  Polyhedron_to_polygon_soup_writer(Polygon_soup* soup) : soup(soup), polygon() {
+  }
+
+  void write_header( std::ostream&,
+                     std::size_t /* vertices */,
+                     std::size_t /* halfedges */,
+                     std::size_t /* facets */,
+                     bool /* normals */ = false ) {
+    soup->clear();
+  }
+
+  void write_footer() {
+  }
+
+  void write_vertex( const double& x, const double& y, const double& z) {
+    soup->points.push_back(Point_3(x, y, z));
+  }
+
+  void write_normal( const double& /* x */, const double& /* y */, const double& /* z */) {
+  }
+
+  void write_facet_header() {
+  }
+
+  void write_facet_begin( std::size_t no) {
+    polygon.clear();
+    polygon.reserve(no);
+  }
+  void write_facet_vertex_index( std::size_t index) {
+    polygon.push_back(index);
+  }
+  void write_facet_end() {
+    soup->polygons.push_back(polygon);
+    polygon.clear();
+  }
+}; // end struct Polyhedron_to_soup_writer
+
+void
+Scene_polygon_soup_item_priv::initializeBuffers(CGAL::Three::Viewer_interface* viewer) const
+{
+    //vao containing the data for the facets
+    {
+        program = item->getShaderProgram(Scene_polygon_soup_item::PROGRAM_WITH_LIGHT, viewer);
+        program->bind();
+        item->vaos[Flat_Facets]->bind();
+        item->buffers[Facets_vertices].bind();
+        item->buffers[Facets_vertices].allocate(positions_poly.data(),
+                            static_cast<int>(positions_poly.size()*sizeof(float)));
+        program->enableAttributeArray("vertex");
+        program->setAttributeBuffer("vertex",GL_FLOAT,0,4);
+        item->buffers[Facets_vertices].release();
+
+
+
+        item->buffers[Facets_normals].bind();
+        item->buffers[Facets_normals].allocate(normals.data(),
+                            static_cast<int>(normals.size()*sizeof(float)));
+        program->enableAttributeArray("normals");
+        program->setAttributeBuffer("normals",GL_FLOAT,0,3);
+
+        item->buffers[Facets_normals].release();
+        if(!f_colors.empty())
+        {
+          item->buffers[F_Colors].bind();
+          item->buffers[F_Colors].allocate(f_colors.data(),
+                                     static_cast<int>(f_colors.size()*sizeof(float)));
+          program->enableAttributeArray("colors");
+          program->setAttributeBuffer("colors",GL_FLOAT,0,3);
+          item->buffers[F_Colors].release();
+        }
+        item->vaos[Flat_Facets]->release();
+
+
+
+        item->vaos[Smooth_Facets]->bind();
+        item->buffers[Facets_vertices].bind();
+        program->enableAttributeArray("vertex");
+        program->setAttributeBuffer("vertex",GL_FLOAT,0,4);
+        item->buffers[Facets_vertices].release();
+
+        item->buffers[Facets_normals].release();
+        item->buffers[Facets_normals].bind();
+        program->enableAttributeArray("normals");
+        program->setAttributeBuffer("normals",GL_FLOAT,0,3);
+        item->buffers[Facets_normals].release();
+        if(!v_colors.empty())
+        {
+          item->buffers[V_Colors].bind();
+          item->buffers[V_Colors].allocate(v_colors.data(),
+                                     static_cast<int>(v_colors.size()*sizeof(float)));
+          program->enableAttributeArray("colors");
+          program->setAttributeBuffer("colors",GL_FLOAT,0,3);
+          item->buffers[V_Colors].release();
+        }
+        item->vaos[Smooth_Facets]->release();
+        program->release();
+        nb_polys = positions_poly.size();
+        positions_poly.resize(0);
+        std::vector<float>(positions_poly).swap(positions_poly);
+
+        normals.resize(0);
+        std::vector<float>(normals).swap(normals);
+        v_colors.resize(0);
+        std::vector<float>(v_colors).swap(v_colors);
+
+    }
+    //vao containing the data for the edges
+    {
+        program = item->getShaderProgram(Scene_polygon_soup_item::PROGRAM_WITHOUT_LIGHT, viewer);
+        program->bind();
+        item->vaos[Edges]->bind();
+
+        item->buffers[Edges_vertices].bind();
+        item->buffers[Edges_vertices].allocate(positions_lines.data(),
+                            static_cast<int>(positions_lines.size()*sizeof(float)));
+        program->enableAttributeArray("vertex");
+        program->setAttributeBuffer("vertex",GL_FLOAT,0,4);
+        item->buffers[Edges_vertices].release();
+        program->release();
+        item->vaos[Edges]->release();
+
+        nb_lines = positions_lines.size();
+        positions_lines.resize(0);
+        std::vector<float>(positions_lines).swap(positions_lines);
+
+    }
+    //vao containing the data for the non manifold edges
+    {
+        program = item->getShaderProgram(Scene_polygon_soup_item::PROGRAM_WITHOUT_LIGHT, viewer);
+        program->bind();
+        item->vaos[NM_Edges]->bind();
+        item->buffers[NM_Edges_vertices].bind();
+        item->buffers[NM_Edges_vertices].allocate(positions_nm_lines.data(),
+                            static_cast<int>(positions_nm_lines.size()*sizeof(float)));
+        program->enableAttributeArray("vertex");
+        program->setAttributeBuffer("vertex",GL_FLOAT,0,4);
+        item->buffers[NM_Edges_vertices].release();
+        item->vaos[NM_Edges]->release();
+        nb_nm_edges = positions_nm_lines.size();
+        positions_nm_lines.resize(0);
+        std::vector<float> (positions_nm_lines).swap(positions_nm_lines);
+    }
+    item->are_buffers_filled = true;
+}
+
+typedef Polyhedron::Traits Traits;
+typedef Polygon_soup::Polygon_3 Facet;
+
+void
+Scene_polygon_soup_item_priv::triangulate_polygon(Polygons_iterator pit, int polygon_id) const
+{
+    //Computes the normal of the facet
+    const Point_3& pa = soup->points[pit->at(0)];
+    const Point_3& pb = soup->points[pit->at(1)];
+    const Point_3& pc = soup->points[pit->at(2)];
+    Traits::Vector_3 normal = CGAL::cross_product(pb-pa, pc -pa);
+    normal = normal / std::sqrt(normal * normal);
+    typedef FacetTriangulator<Polyhedron, Kernel, std::size_t> FT;
+
+    double diagonal;
+    if(item->diagonalBbox() != std::numeric_limits<double>::infinity())
+      diagonal = item->diagonalBbox();
+    else
+      diagonal = 0.0;
+    std::size_t it = 0;
+    std::size_t it_end =pit->size();
+    std::vector<FT::PointAndId> pointIds;
+    do {
+      FT::PointAndId pointId;
+
+      pointId.point = soup->points[pit->at(it)];
+      pointId.id = pit->at(it);
+      pointIds.push_back(pointId);
+    } while( ++it != it_end );
+
+    FT triangulation(pointIds,normal,diagonal);
+  /*  P_traits cdt_traits(normal);
+
+    CDT cdt(cdt_traits);
+    //A map used to associate the vertices in the triangulation to the points
+    //in the soup. This is needed to retrieve the colors of the points.
+    QMap<CDT::Vertex_handle, std::size_t> p2p;
+
+    std::size_t it = 0;
+    std::size_t it_end =pit->size();
+
+    // Iterates the vector of facet handles
+    CDT::Vertex_handle previous, first;
+    do {
+
+        CDT::Vertex_handle vh = cdt.insert(soup->points[pit->at(it)]);
+        p2p[vh]=pit->at(it);
+        if(first == 0) {
+            first = vh;
+        }
+        if(previous != 0 && previous != vh) {
+            cdt.insert_constraint(previous, vh);
+        }
+        previous = vh;
+    } while( ++it != it_end );
+
+    cdt.insert_constraint(previous, first);
+
+    // sets mark is_external
+    for(CDT::All_faces_iterator
+        pitt = cdt.all_faces_begin(),
+        end = cdt.all_faces_end();
+        pitt != end; ++pitt)
+    {
+        pitt->info().is_external = false;
+    }
+
+    //check if the facet is external or internal
+    std::queue<CDT::Face_handle> face_queue;
+    face_queue.push(cdt.infinite_vertex()->face());
+    while(! face_queue.empty() ) {
+        CDT::Face_handle fh = face_queue.front();
+        face_queue.pop();
+        if(fh->info().is_external) continue;
+        fh->info().is_external = true;
+        for(int i = 0; i <3; ++i) {
+            if(!cdt.is_constrained(std::make_pair(fh, i)))
+            {
+                face_queue.push(fh->neighbor(i));
+            }
+        }
+    }
+*/
+    //iterates on the internal faces to add the vertices to the positions
+    //and the normals to the appropriate vectors
+    for(FT::CDT::Finite_faces_iterator
+        ffit = triangulation.cdt->finite_faces_begin(),
+        end = triangulation.cdt->finite_faces_end();
+        ffit != end; ++ffit)
+    {
+        if(ffit->info().is_external)
+            continue;
+
+        positions_poly.push_back(ffit->vertex(0)->point().x());
+        positions_poly.push_back(ffit->vertex(0)->point().y());
+        positions_poly.push_back(ffit->vertex(0)->point().z());
+        positions_poly.push_back(1.0);
+
+
+        positions_poly.push_back(ffit->vertex(1)->point().x());
+        positions_poly.push_back(ffit->vertex(1)->point().y());
+        positions_poly.push_back(ffit->vertex(1)->point().z());
+        positions_poly.push_back(1.0);
+
+        positions_poly.push_back(ffit->vertex(2)->point().x());
+        positions_poly.push_back(ffit->vertex(2)->point().y());
+        positions_poly.push_back(ffit->vertex(2)->point().z());
+        positions_poly.push_back(1.0);
+
+
+        const Point_3& pa = soup->points[pit->at(0)];
+        const Point_3& pb = soup->points[pit->at(1)];
+        const Point_3& pc = soup->points[pit->at(2)];
+
+        Kernel::Vector_3 n = CGAL::cross_product(pb-pa, pc -pa);
+        n = n / std::sqrt(n * n);
+        CGAL::Color color;
+        if(!soup->fcolors.empty())
+          color = soup->fcolors[polygon_id];
+        for(int i=0; i<3; i++)
+        {
+          normals.push_back(n.x());
+          normals.push_back(n.y());
+          normals.push_back(n.z());
+          if(!soup->fcolors.empty())
+          {
+            f_colors.push_back((float)color.red()/255);
+            f_colors.push_back((float)color.green()/255);
+            f_colors.push_back((float)color.blue()/255);
+          }
+          if(!soup->vcolors.empty())
+          {
+            CGAL::Color vcolor = soup->vcolors[triangulation.v2v[ffit->vertex(i)]];
+            v_colors.push_back((float)vcolor.red()/255);
+            v_colors.push_back((float)vcolor.green()/255);
+            v_colors.push_back((float)vcolor.blue()/255);
+          }
+        }
+    }
+}
+void
+Scene_polygon_soup_item_priv::compute_normals_and_vertices() const{
+
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    //get the vertices and normals
+    typedef Polygon_soup::Polygons::size_type size_type;
+    positions_poly.resize(0);
+    positions_lines.resize(0);
+    normals.resize(0);
+    positions_nm_lines.resize(0);
+    f_colors.resize(0);
+    v_colors.resize(0);
+    soup->fill_edges();
+    int nb = 0;
+    for(Polygons_iterator it = soup->polygons.begin();
+        it != soup->polygons.end(); ++it)
+    {
+        if(it->size()!=3)
+        {
+            triangulate_polygon(it, nb);
+        }
+        else{
+            const Point_3& pa = soup->points[it->at(0)];
+            const Point_3& pb = soup->points[it->at(1)];
+            const Point_3& pc = soup->points[it->at(2)];
+
+            Kernel::Vector_3 n = CGAL::cross_product(pb-pa, pc -pa);
+            n = n / std::sqrt(n * n);
+
+            normals.push_back(n.x());
+            normals.push_back(n.y());
+            normals.push_back(n.z());
+
+            normals.push_back(n.x());
+            normals.push_back(n.y());
+            normals.push_back(n.z());
+
+
+            normals.push_back(n.x());
+            normals.push_back(n.y());
+            normals.push_back(n.z());
+
+
+            for(size_type i = 0; i < it->size(); ++i)
+            {
+                const Point_3& p = soup->points[it->at(i)];
+                positions_poly.push_back(p.x());
+                positions_poly.push_back(p.y());
+                positions_poly.push_back(p.z());
+                positions_poly.push_back(1.0);
+                if(!soup->fcolors.empty())
+                {
+                  const CGAL::Color color = soup->fcolors[nb];
+                    f_colors.push_back((float)color.red()/255);
+                    f_colors.push_back((float)color.green()/255);
+                    f_colors.push_back((float)color.blue()/255);
+                }
+
+                if(!soup->vcolors.empty())
+                {
+                  const CGAL::Color color = soup->vcolors[it->at(i)];
+                  v_colors.push_back((float)color.red()/255);
+                  v_colors.push_back((float)color.green()/255);
+                  v_colors.push_back((float)color.blue()/255);
+                }
+            }
+        }
+        nb++;
+
+        //Lines
+        for(size_type i = 0; i < it->size(); ++i)
+        {
+
+            const Point_3& pa = soup->points[it->at(i)];
+            const Point_3& pb = soup->points[it->at((i+1)%it->size())];
+            positions_lines.push_back(pa.x());
+            positions_lines.push_back(pa.y());
+            positions_lines.push_back(pa.z());
+            positions_lines.push_back(1.0);
+
+            positions_lines.push_back(pb.x());
+            positions_lines.push_back(pb.y());
+            positions_lines.push_back(pb.z());
+            positions_lines.push_back(1.0);
+        }
+    }
+
+    //Non manifold edges
+    BOOST_FOREACH(const Polygon_soup::Edge& edge,
+                    soup->non_manifold_edges)
+    {
+
+        const Point_3& a = soup->points[edge[0]];
+        const Point_3& b = soup->points[edge[1]];
+        positions_nm_lines.push_back(a.x());
+        positions_nm_lines.push_back(a.y());
+        positions_nm_lines.push_back(a.z());
+        positions_nm_lines.push_back(1.0);
+
+        positions_nm_lines.push_back(b.x());
+        positions_nm_lines.push_back(b.y());
+        positions_nm_lines.push_back(b.z());
+        positions_nm_lines.push_back(1.0);
+    }
+    QApplication::restoreOverrideCursor();
+}
+
+
+Scene_polygon_soup_item::Scene_polygon_soup_item()
+    : Scene_item(Scene_polygon_soup_item_priv::NbOfVbos,Scene_polygon_soup_item_priv::NbOfVaos)
+{
+  d = new Scene_polygon_soup_item_priv(this);
+}
+
+Scene_polygon_soup_item::~Scene_polygon_soup_item()
+{
+  delete d;
+}
+
+Scene_polygon_soup_item* 
+Scene_polygon_soup_item::clone() const {
+  Scene_polygon_soup_item* new_soup = new Scene_polygon_soup_item();
+  new_soup->d->soup = d->soup->clone();
+  new_soup->d->oriented = d->oriented;
+  return new_soup;
+}
+
+
+bool
+Scene_polygon_soup_item::load(std::istream& in)
+{
+  if (!d->soup) d->soup=new Polygon_soup();
+  else d->soup->clear();
+
+  bool result = CGAL::read_OFF(in, d->soup->points, d->soup->polygons,
+                               d->soup->fcolors, d->soup->vcolors);
+  invalidateOpenGLBuffers();
+  return result;
+}
+
+void Scene_polygon_soup_item::init_polygon_soup(std::size_t nb_pts, std::size_t nb_polygons){
+  if(!d->soup)
+    d->soup = new Polygon_soup;
+  d->soup->clear();
+  d->soup->points.reserve(nb_pts);
+  d->soup->polygons.reserve(nb_polygons);
+  d->soup->vcolors.resize(0);
+  d->soup->fcolors.resize(0);
+  d->oriented = false;
+}
+
+
+
+#include <CGAL/IO/generic_print_polyhedron.h>
+#include <iostream>
+
+void Scene_polygon_soup_item::load(Scene_polyhedron_item* poly_item) {
+  if(!poly_item) return;
+  if(!poly_item->polyhedron()) return;
+
+  if(!d->soup)
+    d->soup = new Polygon_soup;
+
+  Polyhedron_to_polygon_soup_writer writer(d->soup);
+  CGAL::generic_print_polyhedron(std::cerr,
+                                 *poly_item->polyhedron(),
+                                 writer);
+  invalidateOpenGLBuffers();
+}
+
+void
+Scene_polygon_soup_item::setDisplayNonManifoldEdges(const bool b)
+{
+
+  d->soup->display_non_manifold_edges = b;
+}
+
+bool
+Scene_polygon_soup_item::displayNonManifoldEdges() const {
+
+  return d->soup->display_non_manifold_edges;
+}
+
+void Scene_polygon_soup_item::shuffle_orientations()
+{
+  for(Polygon_soup::size_type i = 0, end = d->soup->polygons.size();
+      i < end; ++i)
+  {
+    if(std::rand() % 2 == 0) d->soup->inverse_orientation(i);
+  }
+  invalidateOpenGLBuffers();
+}
+
+void Scene_polygon_soup_item::inside_out()
+{
+  for(Polygon_soup::size_type i = 0, end = d->soup->polygons.size();
+      i < end; ++i)
+  {
+    d->soup->inverse_orientation(i);
+  }
+  invalidateOpenGLBuffers();
+}
+
+bool 
+Scene_polygon_soup_item::orient()
+{
+
+  if(isEmpty() || d->oriented)
+    return true; // nothing to do
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  d->oriented=true;
+
+  //first skip degenerate polygons
+  Polygon_soup::Polygons valid_polygons;
+  valid_polygons.reserve(d->soup->polygons.size());
+  BOOST_FOREACH(Polygon_soup::Polygon_3& polygon, d->soup->polygons)
+  {
+    std::set<std::size_t> vids;
+    bool to_remove=false;
+    BOOST_FOREACH(std::size_t id, polygon)
+    {
+      if (!vids.insert(id).second){
+        to_remove=true;
+        break;
+      }
+    }
+    if (!to_remove) valid_polygons.push_back(polygon);
+  }
+  QApplication::restoreOverrideCursor();
+  if (valid_polygons.size()!=d->soup->polygons.size())
+    d->soup->polygons.swap(valid_polygons);
+
+  bool res;
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  res =  CGAL::Polygon_mesh_processing::
+    orient_polygon_soup(d->soup->points, d->soup->polygons);
+  QApplication::restoreOverrideCursor();
+  return res;
+}
+
+
+bool 
+Scene_polygon_soup_item::save(std::ostream& out) const
+{
+
+  typedef Polygon_soup::size_type size_type;
+  CGAL::File_writer_OFF writer;
+  writer.write_header(out,
+                      d->soup->points.size(),
+                      0,
+                      d->soup->polygons.size());
+  for(size_type i = 0, end = d->soup->points.size();
+      i < end; ++i)
+  {
+    const Point_3& p = d->soup->points[i];
+    writer.write_vertex( p.x(), p.y(), p.z() );
+  }
+  writer.write_facet_header();
+  for(size_type i = 0, end = d->soup->polygons.size();
+      i < end; ++i)
+  {
+    const Polygon_soup::Polygon_3& polygon = d->soup->polygons[i];
+    const size_type size = polygon.size();
+    writer.write_facet_begin(size);
+    for(size_type j = 0; j < size; ++j) {
+      writer.write_facet_vertex_index(polygon[j]);
+    }
+    writer.write_facet_end();
+  }
+  writer.write_footer();
+
+  return (bool) out;
+}
+
+bool 
+Scene_polygon_soup_item::exportAsPolyhedron(Polyhedron* out_polyhedron)
+{
+  if (!orient())
+    return false;
+
+  CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh<Polyhedron>(
+    d->soup->points, d->soup->polygons, *out_polyhedron);
+  std::size_t rv = CGAL::Polygon_mesh_processing::remove_isolated_vertices(*out_polyhedron);
+  if(rv > 0)
+    std::cerr << "Ignore isolated vertices: " << rv << std::endl;
+  if(out_polyhedron->size_of_vertices() > 0) {
+    // Also check whether the consistent orientation is fine
+    if(out_polyhedron->is_closed() &&
+       !CGAL::Polygon_mesh_processing::is_outward_oriented(*out_polyhedron)) {
+      out_polyhedron->inside_out();
+    }
+    return true;
+  }
+  return false;
+}
+
+bool
+Scene_polygon_soup_item::exportAsSurfaceMesh(CGAL::Surface_mesh<Point_3> *out_surface_mesh)
+{
+  orient();
+  CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh< CGAL::Surface_mesh<Point_3> >(
+    d->soup->points, d->soup->polygons, *out_surface_mesh);
+  std::size_t rv = CGAL::Polygon_mesh_processing::remove_isolated_vertices(*out_surface_mesh);
+  if(rv > 0)
+    std::cerr << "Ignore isolated vertices: " << rv << std::endl;
+  if(out_surface_mesh->vertices().size() > 0) {
+    return true;
+  }
+  return false;
+}
+QString 
+Scene_polygon_soup_item::toolTip() const
+{
+
+  if(!d->soup)
+    return QString();
+
+  QString str = QObject::tr("<p><b>%1</b> (mode: %5, color: %6)<br />"
+                     "<i>Polygons soup</i></p>"
+                     "<p>Number of vertices: %2<br />"
+                     "Number of polygons: %3</p>")
+    .arg(this->name())
+    .arg(d->soup->points.size())
+    .arg(d->soup->polygons.size())
+    .arg(this->renderingModeName())
+    .arg(this->color().name());
+    str += QString("<br />Number of isolated vertices : %1<br />").arg(getNbIsolatedvertices());
+    return str;
+}
+
+void
+Scene_polygon_soup_item::draw(CGAL::Three::Viewer_interface* viewer) const {
+    if(!are_buffers_filled)
+    {
+     d->compute_normals_and_vertices();
+     d->initializeBuffers(viewer);
+    }
+    if(d->soup == 0) return;
+    attribBuffers(viewer,PROGRAM_WITH_LIGHT);
+    d->program = getShaderProgram(PROGRAM_WITH_LIGHT);
+    d->program->bind();
+
+    if(renderingMode() == Flat || renderingMode() == FlatPlusEdges)
+    {
+      vaos[Scene_polygon_soup_item_priv::Flat_Facets]->bind();
+      if(d->soup->fcolors.empty())
+      {
+        d->program->setAttributeValue("colors", this->color());
+      }
+    }
+    else if(renderingMode() == Gouraud)
+    {
+     vaos[Scene_polygon_soup_item_priv::Smooth_Facets]->bind();
+      if(d->soup->vcolors.empty())
+        d->program->setAttributeValue("colors", this->color());
+    }
+    //draw the polygons
+    // the third argument is the number of vec4 that will be entered
+    viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(d->nb_polys/4));
+    // Clean-up
+    d->program->release();
+    vaos[Scene_polygon_soup_item_priv::Smooth_Facets]->release();
+    vaos[Scene_polygon_soup_item_priv::Flat_Facets]->release();
+  }
+
+void
+Scene_polygon_soup_item::drawPoints(CGAL::Three::Viewer_interface* viewer) const {
+    if(!are_buffers_filled)
+    {
+      d->compute_normals_and_vertices();
+      d->initializeBuffers(viewer);
+    }
+    if(d->soup == 0) return;
+    vaos[Scene_polygon_soup_item_priv::Edges]->bind();
+    attribBuffers(viewer,PROGRAM_WITHOUT_LIGHT);
+    d->program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
+    d->program->bind();
+    QColor color = this->color();
+    d->program->setAttributeValue("colors", color);
+    //draw the points
+    viewer->glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(d->nb_lines/4));
+    // Clean-up
+    d->program->release();
+    vaos[Scene_polygon_soup_item_priv::Edges]->release();
+}
+
+void
+Scene_polygon_soup_item::drawEdges(CGAL::Three::Viewer_interface* viewer) const {
+    if(!are_buffers_filled)
+  {
+     d->compute_normals_and_vertices();
+     d->initializeBuffers(viewer);
+  }
+    if(d->soup == 0) return;
+    vaos[Scene_polygon_soup_item_priv::Edges]->bind();
+    attribBuffers(viewer,PROGRAM_WITHOUT_LIGHT);
+    d->program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
+    d->program->bind();
+    d->program->setAttributeValue("colors", QColor(Qt::black));
+    //draw the edges
+    viewer->glDrawArrays(GL_LINES, 0,static_cast<GLsizei>( d->nb_lines/4));
+    // Clean-up
+    d->program->release();
+    vaos[Scene_polygon_soup_item_priv::Edges]->release();
+    if(displayNonManifoldEdges())
+    {
+        vaos[Scene_polygon_soup_item_priv::NM_Edges]->bind();
+        attribBuffers(viewer,PROGRAM_WITHOUT_LIGHT);
+        d->program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
+        d->program->bind();
+        QColor c = QColor(Qt::red);
+        d->program->setAttributeValue("colors", c);
+        //draw the edges
+        viewer->glDrawArrays(GL_LINES, 0,static_cast<GLsizei>( d->nb_nm_edges/4));
+        // Clean-up
+        d->program->release();
+        vaos[Scene_polygon_soup_item_priv::NM_Edges]->release();
+    }
+
+}
+
+bool
+Scene_polygon_soup_item::isEmpty() const {
+
+  return (d->soup == 0 || d->soup->points.empty());
+}
+void
+Scene_polygon_soup_item::invalidateOpenGLBuffers()
+{
+    are_buffers_filled = false;
+    compute_bbox();
+}
+
+void Scene_polygon_soup_item::compute_bbox() const {
+
+  if (isEmpty())
+    return;
+  const Point_3& p = *(d->soup->points.begin());
+  CGAL::Bbox_3 bbox(p.x(), p.y(), p.z(), p.x(), p.y(), p.z());
+  for(Polygon_soup::Points::const_iterator it = d->soup->points.begin();
+      it != d->soup->points.end();
+      ++it) {
+    bbox = bbox + it->bbox();
+  }
+  _bbox = Bbox(bbox.xmin(),bbox.ymin(),bbox.zmin(),
+              bbox.xmax(),bbox.ymax(),bbox.zmax());
+}
+
+void 
+Scene_polygon_soup_item::new_vertex(const double& x,
+                                    const double& y,
+                                    const double& z)
+{
+
+    d->soup->points.push_back(Point_3(x, y, z));
+}
+                               
+void 
+Scene_polygon_soup_item::new_triangle(const std::size_t i,
+                                      const std::size_t j,
+                                      const std::size_t k)
+{
+
+  Polygon_soup::Polygon_3 new_polygon(3);
+  new_polygon[0] = i;
+  new_polygon[1] = j;
+  new_polygon[2] = k;
+  d->soup->polygons.push_back(new_polygon);
+}
+
+template <class Point, class Polygon>
+void Scene_polygon_soup_item::load(const std::vector<Point>& points, const std::vector<Polygon>& polygons)
+{
+    if(!d->soup)
+        d->soup = new Polygon_soup;
+    d->soup->clear();
+
+    /// add points
+    d->soup->points.reserve(points.size());
+    BOOST_FOREACH(const Point& p, points)
+            d->soup->points.push_back( Point_3(p[0], p[1], p[2]) );
+
+    /// add polygons
+    std::size_t nb_polygons=polygons.size();
+    d->soup->polygons.resize(nb_polygons);
+    for(std::size_t i=0; i<nb_polygons; ++i)
+        d->soup->polygons[i].assign(polygons[i].begin(), polygons[i].end());
+
+    /// fill non-manifold edges container
+    //soup->fill_edges();
+    d->oriented = false;
+    invalidateOpenGLBuffers();
+}
+// Force the instanciation of the template function for the types used in the STL_io_plugin. This is needed
+// because the d-pointer forbid the definition in the .h for this function.
+template SCENE_POLYGON_SOUP_ITEM_EXPORT void Scene_polygon_soup_item::load<CGAL::cpp11::array<double, 3>, CGAL::cpp11::array<int, 3> >
+(const std::vector<CGAL::cpp11::array<double, 3> >& points, const std::vector<CGAL::cpp11::array<int, 3> >& polygons);
+template SCENE_POLYGON_SOUP_ITEM_EXPORT void Scene_polygon_soup_item::load<CGAL::Epick::Point_3, std::vector<std::size_t> >
+(const std::vector<CGAL::Epick::Point_3>& points, const std::vector<std::vector<std::size_t> >& polygons);
+
+// Local Variables:
+// c-basic-offset: 4
+// End:
+
+const Scene_polygon_soup_item::Points& Scene_polygon_soup_item::points() const { return d->soup->points; }
+bool Scene_polygon_soup_item::isDataColored() { return d->soup->fcolors.size()>0 || d->soup->vcolors.size()>0;}
+std::vector<CGAL::Color> Scene_polygon_soup_item::getVColors() const{return d->soup->vcolors;}
+std::vector<CGAL::Color> Scene_polygon_soup_item::getFColors() const{return d->soup->fcolors;}
diff --git a/3rdparty/CGAL/demo/Polyhedron/Scene_polygon_soup_item.h b/3rdparty/CGAL/demo/Polyhedron/Scene_polygon_soup_item.h
new file mode 100644
index 0000000..96374c1
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Scene_polygon_soup_item.h
@@ -0,0 +1,161 @@
+#ifndef SCENE_POLYGON_SOUP_ITEM_H
+#define SCENE_POLYGON_SOUP_ITEM_H
+#include "Scene_polygon_soup_item_config.h"
+#include  <CGAL/Three/Scene_item.h>
+#include "Polyhedron_type.h"
+#include "CGAL/Surface_mesh/Surface_mesh.h"
+
+#include <boost/foreach.hpp>
+#include <boost/array.hpp>
+
+#include <iostream>
+
+struct Scene_polygon_soup_item_priv;
+struct Polygon_soup
+{
+    typedef Kernel::Point_3 Point_3;
+    typedef std::vector<Point_3> Points;
+    //vector containing 3 indices of points in Points
+    typedef std::vector<std::size_t> Polygon_3;
+    //vector containing a pair of indices of points in Points and a set of indices of Polygons
+    //containing the edge.
+    typedef std::map<std::pair<std::size_t, std::size_t>, std::set<std::size_t> > Edges_map;
+    typedef boost::array<std::size_t, 2> Edge;
+    typedef std::vector<Polygon_3> Polygons;
+    typedef std::vector<CGAL::Color> Colors;
+    typedef std::set<Edge> Edges;
+    typedef Polygons::size_type size_type;
+    Points points;
+    Polygons polygons;
+    Edges_map edges;
+    Colors fcolors;
+    Colors vcolors;
+    Edges non_manifold_edges;
+    bool display_non_manifold_edges;
+
+    Polygon_soup():
+        display_non_manifold_edges(false){}
+
+    Polygon_soup* clone() const {
+        Polygon_soup* result = new Polygon_soup();
+        result->points = points;
+        result->polygons = polygons;
+        result->edges = edges;
+        result->non_manifold_edges = non_manifold_edges;
+        result->display_non_manifold_edges = display_non_manifold_edges;
+        return result;
+    }
+
+    void clear() {
+        points.clear();
+        polygons.clear();
+        edges.clear();
+        non_manifold_edges.clear();
+    }
+
+    void fill_edges() {
+        // Fill edges
+        edges.clear();
+        for(size_type i = 0; i < polygons.size(); ++i)
+        {
+            const size_type size = polygons[i].size();
+            for(size_type j = 0; j < size; ++j) {
+                const std::size_t& i0 = polygons[i][j];
+                const std::size_t& i1 = polygons[i][ j+1 < size ? j+1: 0];
+                edges[std::make_pair(i0, i1)].insert(i);
+                //         qDebug() << tr("edges[std::make_pair(%1, %2)].insert(%3). Size=%4")
+                //           .arg(i0).arg(i1).arg(i).arg(edges[std::make_pair(i0, i1)].size());
+            }
+        }
+
+        // Fill non-manifold edges
+        non_manifold_edges.clear();
+        for(size_type i = 0; i < polygons.size(); ++i)
+        {
+            const size_type size = polygons[i].size();
+            for(size_type j = 0; j < size; ++j) {
+                const std::size_t& i0 = polygons[i][j];
+                const std::size_t& i1 = polygons[i][ j+1 < size ? j+1: 0];
+
+                if(edges[std::make_pair(i0, i1)].size() +
+                         edges[std::make_pair(i1, i0)].size() > 2)
+                {
+                    Edge edge;
+                    edge[0] = i0;
+                    edge[1] = i1;
+                    if(i0 > i1) std::swap(edge[0], edge[1]);
+                    non_manifold_edges.insert(edge);
+
+                }
+            }
+        }
+    }
+
+    void inverse_orientation(const std::size_t index) {
+        std::reverse(polygons[index].begin(), polygons[index].end());
+    }
+};
+
+
+class Scene_polyhedron_item;
+
+class SCENE_POLYGON_SOUP_ITEM_EXPORT Scene_polygon_soup_item 
+        : public CGAL::Three::Scene_item
+{
+    typedef Kernel::Point_3 Point_3;
+    typedef Polygon_soup::Points Points;
+
+    Q_OBJECT
+public:  
+    Scene_polygon_soup_item();
+    ~Scene_polygon_soup_item();
+
+    Scene_polygon_soup_item* clone() const;
+
+    template <class Point, class Polygon>
+    void load(const std::vector<Point>& points, const std::vector<Polygon>& polygons);
+
+    bool load(std::istream& in);
+    void load(Scene_polyhedron_item*);
+    bool isDataColored();
+
+    bool save(std::ostream& out) const;
+    std::vector<CGAL::Color> getVColors() const;
+    std::vector<CGAL::Color> getFColors() const;
+    QString toolTip() const;
+
+    // Indicate if rendering mode is supported
+    virtual bool supportsRenderingMode(RenderingMode m) const { return ( m!=PointsPlusNormals && m!=Splatting); }
+    // OpenGL drawing in a display list
+    virtual void draw() const {}
+    virtual void draw(CGAL::Three::Viewer_interface*) const;
+    virtual void drawPoints(CGAL::Three::Viewer_interface*) const;
+    virtual void drawEdges(CGAL::Three::Viewer_interface* viewer) const;
+    void invalidateOpenGLBuffers();
+    bool isFinite() const { return true; }
+    bool isEmpty() const;
+    void compute_bbox() const;
+
+    void new_vertex(const double&, const double&, const double&);
+    void new_triangle(const std::size_t, const std::size_t, const std::size_t);
+
+    void init_polygon_soup(std::size_t nb_pts, std::size_t nb_polygons);
+
+    const Points& points() const;
+public Q_SLOTS:
+    void shuffle_orientations();
+    bool orient();
+    bool exportAsPolyhedron(Polyhedron*);
+    bool exportAsSurfaceMesh(CGAL::Surface_mesh<Point_3>*);
+    void inside_out();
+
+    void setDisplayNonManifoldEdges(const bool);
+    bool displayNonManifoldEdges() const;
+
+protected:
+    friend struct Scene_polygon_soup_item_priv;
+    Scene_polygon_soup_item_priv* d;
+
+}; // end class Scene_polygon_soup_item
+
+#endif // SCENE_POLYGON_SOUP_ITEM_H
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polygon_soup_item_config.h b/3rdparty/CGAL/demo/Polyhedron/Scene_polygon_soup_item_config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polygon_soup_item_config.h
rename to 3rdparty/CGAL/demo/Polyhedron/Scene_polygon_soup_item_config.h
diff --git a/3rdparty/CGAL/demo/Polyhedron/Scene_polyhedron_item.cpp b/3rdparty/CGAL/demo/Polyhedron/Scene_polyhedron_item.cpp
new file mode 100644
index 0000000..ddcfb89
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Scene_polyhedron_item.cpp
@@ -0,0 +1,1764 @@
+#include "Scene_polyhedron_item.h"
+#include <CGAL/Three/Viewer_interface.h>
+#include <CGAL/AABB_intersections.h>
+#include "Kernel_type.h"
+#include <CGAL/IO/Polyhedron_iostream.h>
+#include <CGAL/IO/File_writer_wavefront.h>
+#include <CGAL/IO/generic_copy_OFF.h>
+#include <CGAL/IO/OBJ_reader.h>
+
+#include <CGAL/AABB_tree.h>
+#include <CGAL/AABB_traits.h>
+#include <CGAL/Polyhedron_items_with_id_3.h>
+#include <CGAL/Polygon_mesh_processing/compute_normal.h>
+#include <CGAL/Polygon_mesh_processing/connected_components.h>
+#include <CGAL/Polygon_mesh_processing/measure.h>
+#include <CGAL/Polygon_mesh_processing/self_intersections.h>
+#include <CGAL/Polygon_mesh_processing/repair.h>
+#include <CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h>
+#include <CGAL/Polygon_mesh_processing/orient_polygon_soup.h>
+#include <CGAL/property_map.h>
+#include <CGAL/statistics_helpers.h>
+
+#include <list>
+#include <queue>
+#include <iostream>
+#include <limits>
+
+#include <QVariant>
+#include <QDebug>
+#include <QDialog>
+#include <QApplication>
+
+#include <boost/foreach.hpp>
+#include "triangulate_primitive.h"
+
+namespace PMP = CGAL::Polygon_mesh_processing;
+typedef Polyhedron::Traits Traits;
+typedef Polyhedron::Facet Facet;
+typedef Polyhedron::Traits	                           Kernel;
+typedef Kernel::Point_3	                                   Point;
+typedef Kernel::Vector_3	                           Vector;
+typedef Polyhedron::Halfedge_around_facet_circulator       HF_circulator;
+typedef boost::graph_traits<Polyhedron>::face_descriptor   face_descriptor;
+//Used to triangulate the AABB_Tree
+class Primitive
+{
+public:
+  // types
+  typedef Polyhedron::Facet_iterator Id; // Id type
+  typedef Kernel::Point_3 Point; // point type
+  typedef Kernel::Triangle_3 Datum; // datum type
+
+private:
+  // member data
+  Id m_it; // iterator
+  Datum m_datum; // 3D triangle
+
+  // constructor
+public:
+  Primitive() {}
+  Primitive(Datum triangle, Id it)
+    : m_it(it), m_datum(triangle)
+  {
+  }
+public:
+  Id& id() { return m_it; }
+  const Id& id() const { return m_it; }
+  Datum& datum() { return m_datum; }
+  const Datum& datum() const { return m_datum; }
+
+  /// Returns a point on the primitive
+  Point reference_point() const { return m_datum.vertex(0); }
+};
+
+typedef CGAL::AABB_traits<Kernel, Primitive> AABB_traits;
+typedef CGAL::AABB_tree<AABB_traits> Input_facets_AABB_tree;
+
+struct Scene_polyhedron_item_priv{
+  typedef Polyhedron::Facet_iterator Facet_iterator;
+  typedef std::vector<QColor> Color_vector;
+  Scene_polyhedron_item_priv(Scene_polyhedron_item* item)
+    : item(item), poly(new Polyhedron)
+  {
+    init_default_values();
+  }
+  Scene_polyhedron_item_priv(const Polyhedron& poly_, Scene_polyhedron_item* item)
+    : item(item), poly(new Polyhedron(poly_))
+  {
+    init_default_values();
+  }
+
+  Scene_polyhedron_item_priv(Polyhedron* const poly_, Scene_polyhedron_item* item)
+    : item(item), poly(poly_)
+  {
+    init_default_values();
+  }
+
+  void init_default_values() {
+    show_only_feature_edges_m = false;
+    show_feature_edges_m = false;
+    facet_picking_m = false;
+    erase_next_picked_facet_m = false;
+    plugin_has_set_color_vector_m = false;
+    nb_facets = 0;
+    nb_lines = 0;
+    nb_f_lines = 0;
+    is_multicolor = false;
+    targeted_id = NULL;
+    all_ids_displayed = false;
+    invalidate_stats();
+  }
+
+
+  void compute_normals_and_vertices(const bool colors_only = false) const;
+  bool isFacetConvex(Facet_iterator, const Polyhedron::Traits::Vector_3&)const;
+  template<typename VertexNormalPmap>
+  void triangulate_convex_facet(Facet_iterator,
+                                const Polyhedron::Traits::Vector_3&,
+                                const VertexNormalPmap&,
+                                const bool)const;
+  template<typename VertexNormalPmap>
+  void triangulate_facet(Scene_polyhedron_item::Facet_iterator,
+                         const Traits::Vector_3& normal,
+                         const VertexNormalPmap&,
+                         const bool colors_only) const;
+  void init();
+  void invalidate_stats();
+  void destroy()
+  {
+    delete poly;
+    delete targeted_id;
+  }
+  void* get_aabb_tree();
+  QList<Kernel::Triangle_3> triangulate_primitive(Polyhedron::Facet_iterator fit,
+                                                  Traits::Vector_3 normal);
+  Color_vector colors_;
+  bool show_only_feature_edges_m;
+  bool show_feature_edges_m;
+  bool facet_picking_m;
+  bool erase_next_picked_facet_m;
+  //the following variable is used to indicate if the color vector must not be automatically updated.
+  // If this boolean is true, the item's color will be independant of the color's wheel, if it is false
+  // changing the color in the wheel will change the color of the item, even if it is multicolor.
+  bool plugin_has_set_color_vector_m;
+  bool is_multicolor;
+
+  Scene_polyhedron_item* item;
+  Polyhedron *poly;
+  double volume, area;
+  QVector<QColor> colors;
+  mutable std::vector<float> positions_lines;
+  mutable std::vector<float> positions_feature_lines;
+  mutable std::vector<float> positions_facets;
+  mutable std::vector<float> normals_flat;
+  mutable std::vector<float> normals_gouraud;
+  mutable std::vector<float> color_lines;
+  mutable std::vector<float> color_facets;
+  mutable std::size_t nb_facets;
+  mutable std::size_t nb_lines;
+  mutable std::size_t nb_f_lines;
+  mutable QOpenGLShaderProgram *program;
+  unsigned int number_of_null_length_edges;
+  unsigned int number_of_degenerated_faces;
+  bool self_intersect;
+  int m_min_patch_id; // the min value of the patch ids initialized in init()
+  mutable bool all_ids_displayed;
+  mutable QList<double> text_ids;
+  mutable TextItem* targeted_id;
+  void initialize_buffers(CGAL::Three::Viewer_interface *viewer = 0) const;
+  enum VAOs {
+    Facets=0,
+    Edges,
+    Feature_edges,
+    Gouraud_Facets,
+    NbOfVaos
+  };
+  enum VBOs {
+    Facets_vertices = 0,
+    Facets_normals_flat,
+    Facets_color,
+    Edges_vertices,
+    Feature_edges_vertices,
+    Edges_color,
+    Facets_normals_gouraud,
+    NbOfVbos
+  };
+  // Initialization
+};
+
+
+
+const char* aabb_property_name = "Scene_polyhedron_item aabb tree";
+
+
+QList<Kernel::Triangle_3> Scene_polyhedron_item_priv::triangulate_primitive(Polyhedron::Facet_iterator fit,
+                                                Traits::Vector_3 normal)
+{
+  typedef FacetTriangulator<Polyhedron, Polyhedron::Traits, boost::graph_traits<Polyhedron>::vertex_descriptor> FT;
+  //The output list
+  QList<Kernel::Triangle_3> res;
+  //check if normal contains NaN values
+  if (normal.x() != normal.x() || normal.y() != normal.y() || normal.z() != normal.z())
+  {
+    qDebug()<<"Warning in triangulation of the selection item: normal contains NaN values and is not valid.";
+    return QList<Kernel::Triangle_3>();
+  }
+  double diagonal;
+  if(item->diagonalBbox() != std::numeric_limits<double>::infinity())
+    diagonal = item->diagonalBbox();
+  else
+    diagonal = 0.0;
+  FT triangulation(fit,normal,poly,diagonal);
+  //iterates on the internal faces to add the vertices to the positions
+  //and the normals to the appropriate vectors
+  for( FT::CDT::Finite_faces_iterator
+      ffit = triangulation.cdt->finite_faces_begin(),
+      end = triangulation.cdt->finite_faces_end();
+      ffit != end; ++ffit)
+  {
+    if(ffit->info().is_external)
+      continue;
+
+
+    res << Kernel::Triangle_3(ffit->vertex(0)->point(),
+                              ffit->vertex(1)->point(),
+                              ffit->vertex(2)->point());
+
+  }
+  return res;
+}
+
+
+
+void* Scene_polyhedron_item_priv::get_aabb_tree()
+{
+  QVariant aabb_tree_property = item->property(aabb_property_name);
+  if(aabb_tree_property.isValid()) {
+    void* ptr = aabb_tree_property.value<void*>();
+    return static_cast<Input_facets_AABB_tree*>(ptr);
+  }
+  else {
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    Polyhedron* poly = item->polyhedron();
+    if(poly) {
+
+      Input_facets_AABB_tree* tree =
+          new Input_facets_AABB_tree();
+      typedef Polyhedron::Traits	    Kernel;
+      int index =0;
+      BOOST_FOREACH( Polyhedron::Facet_iterator f, faces(*poly))
+      {
+        if(!f->is_triangle())
+        {
+          Traits::Vector_3 normal = f->plane().orthogonal_vector(); //initialized in compute_normals_and_vertices
+          index +=3;
+          Q_FOREACH(Kernel::Triangle_3 triangle, triangulate_primitive(f,normal))
+          {
+            Primitive primitive(triangle, f);
+            tree->insert(primitive);
+          }
+        }
+        else
+        {
+          Kernel::Triangle_3 triangle(
+                f->halfedge()->vertex()->point(),
+                f->halfedge()->next()->vertex()->point(),
+                f->halfedge()->next()->next()->vertex()->point()
+                );
+          Primitive primitive(triangle, f);
+          tree->insert(primitive);
+        }
+      }
+      item->setProperty(aabb_property_name,
+                        QVariant::fromValue<void*>(tree));
+      QApplication::restoreOverrideCursor();
+      return tree;
+    }
+    else return 0;
+  }
+}
+
+void delete_aabb_tree(Scene_polyhedron_item* item)
+{
+    QVariant aabb_tree_property = item->property(aabb_property_name);
+    if(aabb_tree_property.isValid()) {
+        void* ptr = aabb_tree_property.value<void*>();
+        Input_facets_AABB_tree* tree = static_cast<Input_facets_AABB_tree*>(ptr);
+        if(tree) {
+            delete tree;
+            tree = 0;
+        }
+        item->setProperty(aabb_property_name, QVariant());
+    }
+}
+
+template<typename TypeWithXYZ, typename ContainerWithPushBack>
+void push_back_xyz(const TypeWithXYZ& t,
+                   ContainerWithPushBack& vector)
+{
+  vector.push_back(t.x());
+  vector.push_back(t.y());
+  vector.push_back(t.z());
+}
+
+
+template<typename TypeWithRGB, typename ContainerWithPushBack>
+void push_back_rgb(const TypeWithRGB& t,
+                   ContainerWithPushBack& vector)
+{
+  vector.push_back(t.redF());
+  vector.push_back(t.greenF());
+  vector.push_back(t.blueF());
+}
+
+bool Scene_polyhedron_item_priv::isFacetConvex(Facet_iterator f, const Polyhedron::Traits::Vector_3& N) const
+{
+  typedef Polyhedron::Traits::Vector_3 Vector;
+  typedef Polyhedron::Traits::Orientation Orientation;
+  Orientation orientation;
+  Vector normal = N;
+  Facet::Halfedge_around_facet_circulator
+          he = f->facet_begin(),
+          he_end(he);
+  bool normal_is_ok;
+  do{
+    normal_is_ok = true;
+
+    //Initializes the facet orientation
+
+    Polyhedron::Traits::Point_3 S,T;
+    S = source(he, *poly)->point();
+    T = target(he, *poly)->point();
+    Vector V1 = Vector((T-S).x(), (T-S).y(), (T-S).z());
+    S = source(he->next(), *poly)->point();
+    T = target(he->next(), *poly)->point();
+    Vector V2 = Vector((T-S).x(), (T-S).y(), (T-S).z());
+
+    if(normal == Vector(0,0,0))
+      normal_is_ok = false;
+    if(normal_is_ok)
+    {
+      orientation = Polyhedron::Traits::Orientation_3()(V1, V2, normal);
+      if( orientation == CGAL::COPLANAR )
+        normal_is_ok = false;
+    }
+    //Checks if the normal is good : if the normal is null
+    // or if it is coplanar to the facet, we need another one.
+    if(!normal_is_ok)
+    {
+      normal = CGAL::cross_product(V1,V2);
+    }
+
+  }while( ++he != he_end && !normal_is_ok);
+  //if no good normal can be found, stop here.
+  if (!normal_is_ok)
+    return false;
+
+  //computes convexness
+
+  //re-initializes he_end;
+  he = f->facet_begin(),
+  he_end = he;
+  do
+  {
+    Polyhedron::Traits::Point_3 S,T;
+    S = source(he, *poly)->point();
+    T = target(he, *poly)->point();
+    Vector V1 = Vector((T-S).x(), (T-S).y(), (T-S).z());
+    S = source(he->next(), *poly)->point();
+    T = target(he->next(), *poly)->point();
+    Vector V2 = Vector((T-S).x(), (T-S).y(), (T-S).z());
+    Orientation res = Polyhedron::Traits::Orientation_3()(V1, V2, normal) ;
+
+    if(res!= orientation && res != CGAL::ZERO)
+      return false;
+  }while( ++he != he_end);
+  return true;
+}
+
+template<typename VertexNormalPmap>
+void Scene_polyhedron_item_priv::triangulate_convex_facet(Facet_iterator f,
+                                                     const Traits::Vector_3& normal,
+                                                     const VertexNormalPmap& vnmap,
+                                                     const bool colors_only)const
+{
+  Polyhedron::Traits::Point_3 p0,p1,p2;
+  Facet::Halfedge_around_facet_circulator
+      he = f->facet_begin(),
+      he_end(he);
+  const int this_patch_id = f->patch_id();
+  while( next(he, *poly) != prev(he_end, *poly))
+  {
+    ++he;
+    if (is_multicolor)
+    {
+      for (int i = 0; i<3; ++i)
+      {
+        color_facets.push_back(colors_[this_patch_id-m_min_patch_id].redF());
+        color_facets.push_back(colors_[this_patch_id-m_min_patch_id].greenF());
+        color_facets.push_back(colors_[this_patch_id-m_min_patch_id].blueF());
+
+        color_facets.push_back(colors_[this_patch_id-m_min_patch_id].redF());
+        color_facets.push_back(colors_[this_patch_id-m_min_patch_id].greenF());
+        color_facets.push_back(colors_[this_patch_id-m_min_patch_id].blueF());
+      }
+    }
+    if (colors_only)
+      continue;
+
+
+    p0 = he_end->vertex()->point();
+    p1 = he->vertex()->point();
+    p2 = next(he, *poly)->vertex()->point();
+    push_back_xyz(p0, positions_facets);
+    positions_facets.push_back(1.0);
+    push_back_xyz(p1, positions_facets);
+    positions_facets.push_back(1.0);
+    push_back_xyz(p2, positions_facets);
+    positions_facets.push_back(1.0);
+
+    push_back_xyz(normal, normals_flat);
+    push_back_xyz(normal, normals_flat);
+    push_back_xyz(normal, normals_flat);
+
+    Traits::Vector_3 ng = get(vnmap, he_end->vertex());
+    push_back_xyz(ng, normals_gouraud);
+
+    ng = get(vnmap, he->vertex());
+    push_back_xyz(ng, normals_gouraud);
+
+    ng = get(vnmap, next(he, *poly)->vertex());
+    push_back_xyz(ng, normals_gouraud);
+  }
+
+
+}
+//Make sure all the facets are triangles
+template<typename VertexNormalPmap>
+void
+Scene_polyhedron_item_priv::triangulate_facet(Scene_polyhedron_item::Facet_iterator fit,
+                                         const Traits::Vector_3& normal,
+                                         const VertexNormalPmap& vnmap,
+                                         const bool colors_only) const
+{
+  typedef FacetTriangulator<Polyhedron, Polyhedron::Traits, boost::graph_traits<Polyhedron>::vertex_descriptor> FT;
+  double diagonal;
+  if(item->diagonalBbox() != std::numeric_limits<double>::infinity())
+    diagonal = item->diagonalBbox();
+  else
+    diagonal = 0.0;
+  FT triangulation(fit,normal,poly,diagonal);
+
+  if(triangulation.cdt->dimension() != 2 )
+  {
+    qDebug()<<"Warning : cdt not right. Facet not displayed";
+    return;
+  }
+
+  //iterates on the internal faces to add the vertices to the positions
+  //and the normals to the appropriate vectors
+  const int this_patch_id = fit->patch_id();
+
+  for(FT::CDT::Finite_faces_iterator
+      ffit = triangulation.cdt->finite_faces_begin(),
+      end = triangulation.cdt->finite_faces_end();
+      ffit != end; ++ffit)
+  {
+    if(ffit->info().is_external)
+      continue;
+
+    if (is_multicolor)
+    {
+     for (int i = 0; i<3; ++i)
+     {
+      push_back_rgb(colors_[this_patch_id-m_min_patch_id], color_facets);
+     }
+    }
+    if (colors_only)
+     continue;
+
+    push_back_xyz(ffit->vertex(0)->point(), positions_facets);
+    positions_facets.push_back(1.0);
+
+    push_back_xyz(ffit->vertex(1)->point(), positions_facets);
+    positions_facets.push_back(1.0);
+
+    push_back_xyz(ffit->vertex(2)->point(), positions_facets);
+    positions_facets.push_back(1.0);
+
+    push_back_xyz(normal, normals_flat);
+    push_back_xyz(normal, normals_flat);
+    push_back_xyz(normal, normals_flat);
+
+    Traits::Vector_3 ng = get(vnmap, triangulation.v2v[ffit->vertex(0)]);
+    push_back_xyz(ng, normals_gouraud);
+
+    ng = get(vnmap, triangulation.v2v[ffit->vertex(1)]);
+    push_back_xyz(ng, normals_gouraud);
+
+    ng = get(vnmap, triangulation.v2v[ffit->vertex(2)]);
+    push_back_xyz(ng, normals_gouraud);
+  }
+}
+
+
+#include <QObject>
+#include <QMenu>
+#include <QAction>
+
+
+void
+Scene_polyhedron_item_priv::initialize_buffers(CGAL::Three::Viewer_interface* viewer) const
+{
+    //vao containing the data for the facets
+    {
+        program = item->getShaderProgram(Scene_polyhedron_item::PROGRAM_WITH_LIGHT, viewer);
+        program->bind();
+        //flat
+        item->vaos[Facets]->bind();
+        item->buffers[Facets_vertices].bind();
+        item->buffers[Facets_vertices].allocate(positions_facets.data(),
+                            static_cast<int>(positions_facets.size()*sizeof(float)));
+        program->enableAttributeArray("vertex");
+        program->setAttributeBuffer("vertex",GL_FLOAT,0,4);
+        item->buffers[Facets_vertices].release();
+
+
+
+        item->buffers[Facets_normals_flat].bind();
+        item->buffers[Facets_normals_flat].allocate(normals_flat.data(),
+                            static_cast<int>(normals_flat.size()*sizeof(float)));
+        program->enableAttributeArray("normals");
+        program->setAttributeBuffer("normals",GL_FLOAT,0,3);
+        item->buffers[Facets_normals_flat].release();
+
+        if(is_multicolor)
+        {
+            item->buffers[Facets_color].bind();
+            item->buffers[Facets_color].allocate(color_facets.data(),
+                                static_cast<int>(color_facets.size()*sizeof(float)));
+            program->enableAttributeArray("colors");
+            program->setAttributeBuffer("colors",GL_FLOAT,0,3);
+            item->buffers[Facets_color].release();
+        }
+        else
+        {
+          program->disableAttributeArray("colors");
+        }
+        item->vaos[Facets]->release();
+        //gouraud
+        item->vaos[Gouraud_Facets]->bind();
+        item->buffers[Facets_vertices].bind();
+        program->enableAttributeArray("vertex");
+        program->setAttributeBuffer("vertex",GL_FLOAT,0,4);
+        item->buffers[Facets_vertices].release();
+
+        item->buffers[Facets_normals_gouraud].bind();
+        item->buffers[Facets_normals_gouraud].allocate(normals_gouraud.data(),
+                            static_cast<int>(normals_gouraud.size()*sizeof(float)));
+        program->enableAttributeArray("normals");
+        program->setAttributeBuffer("normals",GL_FLOAT,0,3);
+        item->buffers[Facets_normals_gouraud].release();
+        if(is_multicolor)
+        {
+            item->buffers[Facets_color].bind();
+            program->enableAttributeArray("colors");
+            program->setAttributeBuffer("colors",GL_FLOAT,0,3);
+            item->buffers[Facets_color].release();
+        }
+        else
+        {
+            program->disableAttributeArray("colors");
+        }
+        item->vaos[Gouraud_Facets]->release();
+
+        program->release();
+
+    }
+    //vao containing the data for the lines
+    {
+        program = item->getShaderProgram(Scene_polyhedron_item::PROGRAM_WITHOUT_LIGHT, viewer);
+        program->bind();
+        item->vaos[Edges]->bind();
+
+        item->buffers[Edges_vertices].bind();
+        item->buffers[Edges_vertices].allocate(positions_lines.data(),
+                            static_cast<int>(positions_lines.size()*sizeof(float)));
+        program->enableAttributeArray("vertex");
+        program->setAttributeBuffer("vertex",GL_FLOAT,0,4);
+        item->buffers[Edges_vertices].release();
+
+       if(is_multicolor)
+       {
+         item->buffers[Edges_color].bind();
+         item->buffers[Edges_color].allocate(color_lines.data(),
+                            static_cast<int>(color_lines.size()*sizeof(float)));
+         program->enableAttributeArray("colors");
+         program->setAttributeBuffer("colors",GL_FLOAT,0,3);
+         item->buffers[Edges_color].release();
+       }
+       else
+       {
+           program->disableAttributeArray("colors");
+       }
+        program->release();
+
+        item->vaos[Edges]->release();
+
+    }
+  //vao containing the data for the feature_edges
+  {
+      program = item->getShaderProgram(Scene_polyhedron_item::PROGRAM_NO_SELECTION, viewer);
+      program->bind();
+      item->vaos[Feature_edges]->bind();
+
+      item->buffers[Feature_edges_vertices].bind();
+      item->buffers[Feature_edges_vertices].allocate(positions_feature_lines.data(),
+                          static_cast<int>(positions_feature_lines.size()*sizeof(float)));
+      program->enableAttributeArray("vertex");
+      program->setAttributeBuffer("vertex",GL_FLOAT,0,4);
+      item->buffers[Feature_edges_vertices].release();
+      program->disableAttributeArray("colors");
+      program->release();
+
+      item->vaos[Feature_edges]->release();
+
+  }
+    nb_f_lines = positions_feature_lines.size();
+    positions_feature_lines.resize(0);
+    std::vector<float>(positions_feature_lines).swap(positions_feature_lines);
+    nb_lines = positions_lines.size();
+    positions_lines.resize(0);
+    std::vector<float>(positions_lines).swap(positions_lines);
+    nb_facets = positions_facets.size();
+    positions_facets.resize(0);
+    std::vector<float>(positions_facets).swap(positions_facets);
+
+
+    color_lines.resize(0);
+    std::vector<float>(color_lines).swap(color_lines);
+    color_facets.resize(0);
+    std::vector<float>(color_facets).swap(color_facets);
+    normals_flat.resize(0);
+    std::vector<float>(normals_flat).swap(normals_flat);
+    normals_gouraud.resize(0);
+    std::vector<float>(normals_gouraud).swap(normals_gouraud);
+
+    CGAL::set_halfedgeds_items_id(*poly);
+    if (viewer->hasText())
+        item->printPrimitiveIds(viewer);
+    item->are_buffers_filled = true;
+
+}
+
+void
+Scene_polyhedron_item_priv::compute_normals_and_vertices(const bool colors_only) const
+{
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    positions_facets.resize(0);
+    positions_lines.resize(0);
+    positions_feature_lines.resize(0);
+    normals_flat.resize(0);
+    normals_gouraud.resize(0);
+    color_lines.resize(0);
+    color_facets.resize(0);
+
+    //Facets
+    typedef Polyhedron::Traits	    Kernel;
+    typedef Kernel::Point_3	    Point;
+    typedef Kernel::Vector_3	    Vector;
+    typedef Polyhedron::Facet_iterator Facet_iterator;
+    typedef Polyhedron::Halfedge_around_facet_circulator HF_circulator;
+    typedef boost::graph_traits<Polyhedron>::face_descriptor   face_descriptor;
+    typedef boost::graph_traits<Polyhedron>::vertex_descriptor vertex_descriptor;
+
+    CGAL::Unique_hash_map<face_descriptor, Vector> face_normals_map;
+    boost::associative_property_map<CGAL::Unique_hash_map<face_descriptor, Vector> >
+      nf_pmap(face_normals_map);
+    CGAL::Unique_hash_map<vertex_descriptor, Vector> vertex_normals_map;
+    boost::associative_property_map< CGAL::Unique_hash_map<vertex_descriptor, Vector> >
+      nv_pmap(vertex_normals_map);
+
+    PMP::compute_normals(*poly, nv_pmap, nf_pmap);
+
+    Facet_iterator f = poly->facets_begin();
+    for(f = poly->facets_begin();
+        f != poly->facets_end();
+        f++)
+    {
+      if (f == boost::graph_traits<Polyhedron>::null_face())
+        continue;
+      Vector nf = get(nf_pmap, f);
+      f->plane() = Kernel::Plane_3(f->halfedge()->vertex()->point(), nf);
+      if(is_triangle(f->halfedge(),*poly))
+      {
+          const int this_patch_id = f->patch_id();
+          HF_circulator he = f->facet_begin();
+          HF_circulator end = he;
+          CGAL_For_all(he,end)
+          {
+            if (item->isItemMulticolor())
+            {
+              color_facets.push_back(colors_[this_patch_id-m_min_patch_id].redF());
+              color_facets.push_back(colors_[this_patch_id-m_min_patch_id].greenF());
+              color_facets.push_back(colors_[this_patch_id-m_min_patch_id].blueF());
+            }
+            if (colors_only)
+              continue;
+
+            // If Flat shading:1 normal per polygon added once per vertex
+            push_back_xyz(nf, normals_flat);
+
+            //// If Gouraud shading: 1 normal per vertex
+            Vector nv = get(nv_pmap, he->vertex());
+            push_back_xyz(nv, normals_gouraud);
+
+            //position
+            const Point& p = he->vertex()->point();
+            push_back_xyz(p, positions_facets);
+            positions_facets.push_back(1.0);
+         }
+      }
+      else if (is_quad(f->halfedge(), *poly))
+      {
+        if (item->isItemMulticolor())
+        {
+          const int this_patch_id = f->patch_id();
+          for (unsigned int i = 0; i < 6; ++i)
+          { //6 "halfedges" for the quad, because it is 2 triangles
+            color_facets.push_back(colors_[this_patch_id-m_min_patch_id].redF());
+            color_facets.push_back(colors_[this_patch_id-m_min_patch_id].greenF());
+            color_facets.push_back(colors_[this_patch_id-m_min_patch_id].blueF());
+          }
+        }
+        if (colors_only)
+          continue;
+
+        //1st half-quad
+        Point p0 = f->halfedge()->vertex()->point();
+        Point p1 = f->halfedge()->next()->vertex()->point();
+        Point p2 = f->halfedge()->next()->next()->vertex()->point();
+
+        push_back_xyz(p0, positions_facets);
+        positions_facets.push_back(1.0);
+
+        push_back_xyz(p1, positions_facets);
+        positions_facets.push_back(1.0);
+
+        push_back_xyz(p2, positions_facets);
+        positions_facets.push_back(1.0);
+
+        push_back_xyz(nf, normals_flat);
+        push_back_xyz(nf, normals_flat);
+        push_back_xyz(nf, normals_flat);
+
+        Vector nv = get(nv_pmap, f->halfedge()->vertex());
+        push_back_xyz(nv, normals_gouraud);
+
+        nv = get(nv_pmap, f->halfedge()->next()->vertex());
+        push_back_xyz(nv, normals_gouraud);
+
+        nv = get(nv_pmap, f->halfedge()->next()->next()->vertex());
+        push_back_xyz(nv, normals_gouraud);
+
+        //2nd half-quad
+        p0 = f->halfedge()->next()->next()->vertex()->point();
+        p1 = f->halfedge()->prev()->vertex()->point();
+        p2 = f->halfedge()->vertex()->point();
+
+        push_back_xyz(p0, positions_facets);
+        positions_facets.push_back(1.0);
+
+        push_back_xyz(p1, positions_facets);
+        positions_facets.push_back(1.0);
+
+        push_back_xyz(p2, positions_facets);
+        positions_facets.push_back(1.0);
+
+        push_back_xyz(nf, normals_flat);
+        push_back_xyz(nf, normals_flat);
+        push_back_xyz(nf, normals_flat);
+
+        nv = get(nv_pmap, f->halfedge()->next()->next()->vertex());
+        push_back_xyz(nv, normals_gouraud);
+
+        nv = get(nv_pmap, f->halfedge()->prev()->vertex());
+        push_back_xyz(nv, normals_gouraud);
+
+        nv = get(nv_pmap, f->halfedge()->vertex());
+        push_back_xyz(nv, normals_gouraud);
+      }
+      else
+      {
+        if(isFacetConvex(f, nf))
+        {
+          triangulate_convex_facet(f, nf, nv_pmap, colors_only);
+        }
+        else
+        {
+          this->triangulate_facet(f, nf, nv_pmap, colors_only);
+        }
+      }
+
+    }
+    //Lines
+    typedef Kernel::Point_3		Point;
+    typedef Polyhedron::Edge_iterator	Edge_iterator;
+    Edge_iterator he;
+    for(he = poly->edges_begin();
+        he != poly->edges_end();
+        he++)
+    {
+        const Point& a = he->vertex()->point();
+        const Point& b = he->opposite()->vertex()->point();
+        if ( he->is_feature_edge())
+        {
+          if (colors_only)
+            continue;
+
+          push_back_xyz(a, positions_feature_lines);
+          positions_feature_lines.push_back(1.0);
+
+          push_back_xyz(b, positions_feature_lines);
+          positions_feature_lines.push_back(1.0);
+        }
+        else
+        {
+          if (item->isItemMulticolor())
+          {
+            color_lines.push_back(item->color().lighter(50).redF());
+            color_lines.push_back(item->color().lighter(50).greenF());
+            color_lines.push_back(item->color().lighter(50).blueF());
+
+            color_lines.push_back(item->color().lighter(50).redF());
+            color_lines.push_back(item->color().lighter(50).greenF());
+            color_lines.push_back(item->color().lighter(50).blueF());
+          }
+          if (colors_only)
+            continue;
+
+          push_back_xyz(a, positions_lines);
+          positions_lines.push_back(1.0);
+
+          push_back_xyz(b, positions_lines);
+          positions_lines.push_back(1.0);
+        }
+    }
+    QApplication::restoreOverrideCursor();
+}
+
+Scene_polyhedron_item::Scene_polyhedron_item()
+    : Scene_item(Scene_polyhedron_item_priv::NbOfVbos,Scene_polyhedron_item_priv::NbOfVaos),
+      d(new Scene_polyhedron_item_priv(this))
+{
+    cur_shading=FlatPlusEdges;
+    is_selected = true;
+    textItems = new TextListItem(this);
+
+}
+
+Scene_polyhedron_item::Scene_polyhedron_item(Polyhedron* const p)
+    : Scene_item(Scene_polyhedron_item_priv::NbOfVbos,Scene_polyhedron_item_priv::NbOfVaos),
+      d(new Scene_polyhedron_item_priv(p,this))
+{
+    cur_shading=FlatPlusEdges;
+    is_selected = true;
+    textItems = new TextListItem(this);
+}
+
+Scene_polyhedron_item::Scene_polyhedron_item(const Polyhedron& p)
+    : Scene_item(Scene_polyhedron_item_priv::NbOfVbos,Scene_polyhedron_item_priv::NbOfVaos),
+      d(new Scene_polyhedron_item_priv(p,this))
+{
+    cur_shading=FlatPlusEdges;
+    is_selected=true;
+    textItems = new TextListItem(this);
+}
+
+Scene_polyhedron_item::~Scene_polyhedron_item()
+{
+    delete_aabb_tree(this);
+    QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
+    if(viewer)
+    {
+      CGAL::Three::Viewer_interface* v = qobject_cast<CGAL::Three::Viewer_interface*>(viewer);
+
+      //Clears the targeted Id
+      v->textRenderer->removeText(d->targeted_id);
+      //Remove textitems
+      v->textRenderer->removeTextList(textItems);
+      delete textItems;
+    }
+
+    d->destroy();
+    delete d;
+}
+
+#include "Color_map.h"
+
+void
+Scene_polyhedron_item_priv::
+init()
+{
+  typedef Polyhedron::Facet_iterator Facet_iterator;
+
+  if ( !plugin_has_set_color_vector_m )
+  {
+    // Fill indices map and get max subdomain value
+    int max = 0;
+    int min = (std::numeric_limits<int>::max)();
+    for(Facet_iterator fit = poly->facets_begin(), end = poly->facets_end() ;
+        fit != end; ++fit)
+    {
+      max = (std::max)(max, fit->patch_id());
+      min = (std::min)(min, fit->patch_id());
+    }
+    
+    colors_.clear();
+    compute_color_map(item->color(), (std::max)(0, max + 1 - min),
+                      std::back_inserter(colors_));
+    m_min_patch_id=min;
+  }
+  else
+    m_min_patch_id=0;
+  invalidate_stats();
+}
+
+void
+Scene_polyhedron_item_priv::
+invalidate_stats()
+{
+  number_of_degenerated_faces = (unsigned int)(-1);
+  number_of_null_length_edges = (unsigned int)(-1);
+  volume = -std::numeric_limits<double>::infinity();
+  area = -std::numeric_limits<double>::infinity();
+  self_intersect = false;
+
+}
+
+Scene_polyhedron_item*
+Scene_polyhedron_item::clone() const {
+    return new Scene_polyhedron_item(*(d->poly));}
+
+// Load polyhedron from .OFF file
+bool
+Scene_polyhedron_item::load(std::istream& in)
+{
+
+
+    in >> *(d->poly);
+
+    if ( in && !isEmpty() )
+    {
+        invalidateOpenGLBuffers();
+        return true;
+    }
+    return false;
+}
+// Load polyhedron from .obj file
+bool
+Scene_polyhedron_item::load_obj(std::istream& in)
+{
+  typedef Polyhedron::Vertex::Point Point;
+  std::vector<Point> points;
+  std::vector<std::vector<std::size_t> > faces;
+  bool failed = !CGAL::read_OBJ(in,points,faces);
+
+  if(CGAL::Polygon_mesh_processing::orient_polygon_soup(points,faces)){
+    CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh( points,faces,*(d->poly));
+  }else{
+    std::cerr << "not orientable"<< std::endl;
+    return false;
+  }
+    if ( (! failed) && !isEmpty() )
+    {
+        invalidateOpenGLBuffers();
+        return true;
+    }
+    return false;
+}
+
+// Write polyhedron to .OFF file
+bool
+Scene_polyhedron_item::save(std::ostream& out) const
+{
+  out.precision(17);
+    out << *(d->poly);
+    return (bool) out;
+}
+
+bool
+Scene_polyhedron_item::save_obj(std::ostream& out) const
+{
+  CGAL::File_writer_wavefront  writer;
+  CGAL::generic_print_polyhedron(out, *(d->poly), writer);
+  return out.good();
+}
+
+
+QString
+Scene_polyhedron_item::toolTip() const
+{
+    if(!d->poly)
+        return QString();
+
+  QString str =
+         QObject::tr("<p>Polyhedron <b>%1</b> (mode: %5, color: %6)</p>"
+                       "<p>Number of vertices: %2<br />"
+                       "Number of edges: %3<br />"
+                     "Number of facets: %4")
+            .arg(this->name())
+            .arg(d->poly->size_of_vertices())
+            .arg(d->poly->size_of_halfedges()/2)
+            .arg(d->poly->size_of_facets())
+            .arg(this->renderingModeName())
+            .arg(this->color().name());
+  str += QString("<br />Number of isolated vertices : %1<br />").arg(getNbIsolatedvertices());
+  return str;
+}
+
+QMenu* Scene_polyhedron_item::contextMenu()
+{
+  const char* prop_name = "Menu modified by Scene_polyhedron_item.";
+
+  QMenu* menu = Scene_item::contextMenu();
+
+  // Use dynamic properties:
+  // http://doc.qt.io/qt-5/qobject.html#property
+  bool menuChanged = menu->property(prop_name).toBool();
+
+  if(!menuChanged) {
+
+    QAction* actionShowOnlyFeatureEdges =
+        menu->addAction(tr("Show Only &Feature Edges"));
+    actionShowOnlyFeatureEdges->setCheckable(true);
+    actionShowOnlyFeatureEdges->setChecked(d->show_only_feature_edges_m);
+    actionShowOnlyFeatureEdges->setObjectName("actionShowOnlyFeatureEdges");
+    connect(actionShowOnlyFeatureEdges, SIGNAL(toggled(bool)),
+            this, SLOT(show_only_feature_edges(bool)));
+
+    QAction* actionShowFeatureEdges =
+        menu->addAction(tr("Show Feature Edges"));
+    actionShowFeatureEdges->setCheckable(true);
+    actionShowFeatureEdges->setChecked(d->show_feature_edges_m);
+    actionShowFeatureEdges->setObjectName("actionShowFeatureEdges");
+    connect(actionShowFeatureEdges, SIGNAL(toggled(bool)),
+            this, SLOT(show_feature_edges(bool)));
+
+    QAction* actionPickFacets =
+        menu->addAction(tr("Facets Picking"));
+    actionPickFacets->setCheckable(true);
+    actionPickFacets->setObjectName("actionPickFacets");
+    connect(actionPickFacets, SIGNAL(toggled(bool)),
+            this, SLOT(enable_facets_picking(bool)));
+
+    QAction* actionEraseNextFacet =
+        menu->addAction(tr("Erase Next Picked Facet"));
+    actionEraseNextFacet->setCheckable(true);
+    actionEraseNextFacet->setObjectName("actionEraseNextFacet");
+    connect(actionEraseNextFacet, SIGNAL(toggled(bool)),
+            this, SLOT(set_erase_next_picked_facet(bool)));
+    menu->setProperty(prop_name, true);
+  }
+
+  QAction* action = menu->findChild<QAction*>("actionShowOnlyFeatureEdges");
+  if(action) action->setChecked(d->show_only_feature_edges_m);
+  action = menu->findChild<QAction*>("actionShowFeatureEdges");
+  if(action) action->setChecked(d->show_feature_edges_m);
+  action = menu->findChild<QAction*>("actionPickFacets");
+  if(action) action->setChecked(d->facet_picking_m);
+  action = menu->findChild<QAction*>("actionEraseNextFacet");
+  if(action) action->setChecked(d->erase_next_picked_facet_m);
+  return menu;
+}
+
+void Scene_polyhedron_item::show_only_feature_edges(bool b)
+{
+    d->show_only_feature_edges_m = b;
+    invalidateOpenGLBuffers();
+    Q_EMIT itemChanged();
+}
+
+void Scene_polyhedron_item::show_feature_edges(bool b)
+{
+  d->show_feature_edges_m = b;
+  invalidateOpenGLBuffers();
+  Q_EMIT itemChanged();
+}
+
+void Scene_polyhedron_item::enable_facets_picking(bool b)
+{
+    d->facet_picking_m = b;
+}
+
+void Scene_polyhedron_item::set_erase_next_picked_facet(bool b)
+{
+    if(b) { d->facet_picking_m = true; } // automatically activate facet_picking
+    d->erase_next_picked_facet_m = b;
+}
+
+void Scene_polyhedron_item::draw(CGAL::Three::Viewer_interface* viewer) const {
+    if(!are_buffers_filled)
+    {
+        d->compute_normals_and_vertices();
+        d->initialize_buffers(viewer);
+        compute_bbox();
+    }
+
+    if(renderingMode() == Flat || renderingMode() == FlatPlusEdges)
+        vaos[Scene_polyhedron_item_priv::Facets]->bind();
+    else
+    {
+        vaos[Scene_polyhedron_item_priv::Gouraud_Facets]->bind();
+    }
+    attribBuffers(viewer, PROGRAM_WITH_LIGHT);
+    d->program = getShaderProgram(PROGRAM_WITH_LIGHT);
+    d->program->bind();
+    if(!d->is_multicolor)
+    {
+            d->program->setAttributeValue("colors", this->color());
+    }
+    if(is_selected)
+            d->program->setUniformValue("is_selected", true);
+    else
+            d->program->setUniformValue("is_selected", false);
+    viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(d->nb_facets/4));
+    d->program->release();
+    if(renderingMode() == Flat || renderingMode() == FlatPlusEdges)
+        vaos[Scene_polyhedron_item_priv::Facets]->release();
+    else
+        vaos[Scene_polyhedron_item_priv::Gouraud_Facets]->release();
+}
+
+// Points/Wireframe/Flat/Gouraud OpenGL drawing in a display list
+void Scene_polyhedron_item::drawEdges(CGAL::Three::Viewer_interface* viewer) const
+{
+    if (!are_buffers_filled)
+    {
+        d->compute_normals_and_vertices();
+        d->initialize_buffers(viewer);
+        compute_bbox();
+    }
+
+    if(!d->show_only_feature_edges_m)
+    {
+        vaos[Scene_polyhedron_item_priv::Edges]->bind();
+
+        attribBuffers(viewer, PROGRAM_WITHOUT_LIGHT);
+        d->program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
+        d->program->bind();
+        //draw the edges
+        if(!d->is_multicolor)
+        {
+            d->program->setAttributeValue("colors", this->color().lighter(50));
+            if(is_selected)
+                d->program->setUniformValue("is_selected", true);
+            else
+                d->program->setUniformValue("is_selected", false);
+        }
+        viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(d->nb_lines/4));
+        d->program->release();
+        vaos[Scene_polyhedron_item_priv::Edges]->release();
+    }
+
+    //draw the feature edges
+    vaos[Scene_polyhedron_item_priv::Feature_edges]->bind();
+    attribBuffers(viewer, PROGRAM_NO_SELECTION);
+    d->program = getShaderProgram(PROGRAM_NO_SELECTION);
+    d->program->bind();
+    if(d->show_feature_edges_m || d->show_only_feature_edges_m)
+        d->program->setAttributeValue("colors", Qt::red);
+    else
+    {
+        if(!is_selected)
+            d->program->setAttributeValue("colors", this->color().lighter(50));
+        else
+            d->program->setAttributeValue("colors",QColor(0,0,0));
+    }
+    viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(d->nb_f_lines/4));
+    d->program->release();
+    vaos[Scene_polyhedron_item_priv::Feature_edges]->release();
+    }
+
+void
+Scene_polyhedron_item::drawPoints(CGAL::Three::Viewer_interface* viewer) const {
+    if(!are_buffers_filled)
+    {
+        d->compute_normals_and_vertices();
+        d->initialize_buffers(viewer);
+        compute_bbox();
+    }
+
+    vaos[Scene_polyhedron_item_priv::Edges]->bind();
+    attribBuffers(viewer, PROGRAM_WITHOUT_LIGHT);
+    d->program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
+    d->program->bind();
+    //draw the points
+    d->program->setAttributeValue("colors", this->color());
+    viewer->glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(d->nb_lines/4));
+    // Clean-up
+    d->program->release();
+    vaos[Scene_polyhedron_item_priv::Edges]->release();
+}
+
+Polyhedron*
+Scene_polyhedron_item::polyhedron()       { return d->poly; }
+const Polyhedron*
+Scene_polyhedron_item::polyhedron() const { return d->poly; }
+
+bool
+Scene_polyhedron_item::isEmpty() const {
+    return (d->poly == 0) || d->poly->empty();
+}
+
+void Scene_polyhedron_item::compute_bbox() const {
+    const Kernel::Point_3& p = *(d->poly->points_begin());
+    CGAL::Bbox_3 bbox(p.x(), p.y(), p.z(), p.x(), p.y(), p.z());
+    for(Polyhedron::Point_iterator it = d->poly->points_begin();
+        it != d->poly->points_end();
+        ++it) {
+        bbox = bbox + it->bbox();
+    }
+    _bbox = Bbox(bbox.xmin(),bbox.ymin(),bbox.zmin(),
+                bbox.xmax(),bbox.ymax(),bbox.zmax());
+}
+
+
+void
+Scene_polyhedron_item::
+invalidateOpenGLBuffers()
+{
+  Q_EMIT item_is_about_to_be_changed();
+    delete_aabb_tree(this);
+    d->init();
+    Base::invalidateOpenGLBuffers();
+    are_buffers_filled = false;
+
+    d->invalidate_stats();
+}
+
+void
+Scene_polyhedron_item::selection_changed(bool p_is_selected)
+{
+    if(p_is_selected != is_selected)
+    {
+        is_selected = p_is_selected;
+    }
+
+}
+
+void
+Scene_polyhedron_item::setColor(QColor c)
+{
+  // reset patch ids
+  if (d->colors_.size()>2 || d->plugin_has_set_color_vector_m)
+  {
+    d->colors_.clear();
+    d->is_multicolor = false;
+  }
+  Scene_item::setColor(c);
+  if(d->is_multicolor)
+    invalidateOpenGLBuffers();
+}
+
+void
+Scene_polyhedron_item::select(double orig_x,
+                              double orig_y,
+                              double orig_z,
+                              double dir_x,
+                              double dir_y,
+                              double dir_z)
+{
+
+    void* vertex_to_emit = 0;
+    if(d->facet_picking_m)
+    {
+        typedef Input_facets_AABB_tree Tree;
+        typedef Tree::Object_and_primitive_id Object_and_primitive_id;
+
+        Tree* aabb_tree = static_cast<Tree*>(d->get_aabb_tree());
+        if(aabb_tree)
+        {
+            const Kernel::Point_3 ray_origin(orig_x, orig_y, orig_z);
+            const Kernel::Vector_3 ray_dir(dir_x, dir_y, dir_z);
+            const Kernel::Ray_3 ray(ray_origin, ray_dir);
+            typedef std::list<Object_and_primitive_id> Intersections;
+            Intersections intersections;
+            aabb_tree->all_intersections(ray, std::back_inserter(intersections));
+            Intersections::iterator closest = intersections.begin();
+            if(closest != intersections.end())
+            {
+                const Kernel::Point_3* closest_point =
+                        CGAL::object_cast<Kernel::Point_3>(&closest->first);
+                for(Intersections::iterator
+                    it = boost::next(intersections.begin()),
+                    end = intersections.end();
+                    it != end; ++it)
+                {
+                    if(! closest_point) {
+                        closest = it;
+                    }
+                    else {
+                        const Kernel::Point_3* it_point =
+                                CGAL::object_cast<Kernel::Point_3>(&it->first);
+                        if(it_point &&
+                                (ray_dir * (*it_point - *closest_point)) < 0)
+                        {
+                            closest = it;
+                            closest_point = it_point;
+                        }
+                    }
+                }
+                if(closest_point) {
+                    Polyhedron::Facet_handle selected_fh = closest->second;
+
+                    // The computation of the nearest vertex may be costly.  Only
+                    // do it if some objects are connected to the signal
+                    // 'selected_vertex'.
+                    if(QObject::receivers(SIGNAL(selected_vertex(void*))) > 0)
+                    {
+                        Polyhedron::Halfedge_around_facet_circulator
+                                he_it = selected_fh->facet_begin(),
+                                around_end = he_it;
+
+                        Polyhedron::Vertex_handle v = he_it->vertex(), nearest_v = v;
+
+                        Kernel::FT sq_dist = CGAL::squared_distance(*closest_point,
+                                                                    v->point());
+                        while(++he_it != around_end) {
+                            v = he_it->vertex();
+                            Kernel::FT new_sq_dist = CGAL::squared_distance(*closest_point,
+                                                                            v->point());
+                            if(new_sq_dist < sq_dist) {
+                                sq_dist = new_sq_dist;
+                                nearest_v = v;
+                            }
+                        }
+                        //bottleneck
+                        vertex_to_emit = (void*)(&*nearest_v);
+                    }
+
+                    if(QObject::receivers(SIGNAL(selected_edge(void*))) > 0
+                            || QObject::receivers(SIGNAL(selected_halfedge(void*))) > 0)
+                    {
+                        Polyhedron::Halfedge_around_facet_circulator
+                                he_it = selected_fh->facet_begin(),
+                                around_end = he_it;
+
+                        Polyhedron::Halfedge_handle nearest_h = he_it;
+                        Kernel::FT sq_dist =
+                                CGAL::squared_distance(*closest_point,
+                                                       Kernel::Segment_3(he_it->vertex()->point(),
+                                                                         he_it->opposite()->
+                                                                         vertex()->
+                                                                         point()));
+
+                        while(++he_it != around_end)
+                        {
+                            Kernel::FT new_sq_dist =
+                                    CGAL::squared_distance(*closest_point,
+                                                           Kernel::Segment_3(he_it->vertex()->point(),
+                                                                             he_it->opposite()->
+                                                                             vertex()->
+                                                                             point()));
+                            if(new_sq_dist < sq_dist) {
+                                sq_dist = new_sq_dist;
+                                nearest_h = he_it;
+                            }
+                        }
+
+                        Q_EMIT selected_halfedge((void*)(&*nearest_h));
+                        Q_EMIT selected_edge((void*)(std::min)(&*nearest_h, &*nearest_h->opposite()));
+                    }
+                    Q_EMIT selected_vertex(vertex_to_emit);
+                    Q_EMIT selected_facet((void*)(&*selected_fh));
+                    if(d->erase_next_picked_facet_m) {
+                        polyhedron()->erase_facet(selected_fh->halfedge());
+                        polyhedron()->normalize_border();
+                        //set_erase_next_picked_facet(false);
+                        invalidateOpenGLBuffers();
+
+                        Q_EMIT itemChanged();
+                    }
+                }
+            }
+        }
+    }
+    Base::select(orig_x, orig_y, orig_z, dir_x, dir_y, dir_z);
+    Q_EMIT selection_done();
+}
+
+void Scene_polyhedron_item::update_vertex_indices()
+{
+    std::size_t id=0;
+    for (Polyhedron::Vertex_iterator vit = polyhedron()->vertices_begin(),
+         vit_end = polyhedron()->vertices_end(); vit != vit_end; ++vit)
+    {
+        vit->id()=id++;
+    }
+}
+void Scene_polyhedron_item::update_facet_indices()
+{
+    std::size_t id=0;
+    for (Polyhedron::Facet_iterator  fit = polyhedron()->facets_begin(),
+         fit_end = polyhedron()->facets_end(); fit != fit_end; ++fit)
+    {
+        fit->id()=id++;
+    }
+}
+void Scene_polyhedron_item::update_halfedge_indices()
+{
+    std::size_t id=0;
+    for (Polyhedron::Halfedge_iterator hit = polyhedron()->halfedges_begin(),
+         hit_end = polyhedron()->halfedges_end(); hit != hit_end; ++hit)
+    {
+        hit->id()=id++;
+    }
+}
+void Scene_polyhedron_item::invalidate_aabb_tree()
+{
+  delete_aabb_tree(this);
+}
+QString Scene_polyhedron_item::computeStats(int type)
+{
+  double minl, maxl, meanl, midl;
+  switch (type)
+  {
+  case MIN_LENGTH:
+  case MAX_LENGTH:
+  case MID_LENGTH:
+  case MEAN_LENGTH:
+  case NB_NULL_LENGTH:
+    d->poly->normalize_border();
+    edges_length(d->poly, minl, maxl, meanl, midl, d->number_of_null_length_edges);
+  }
+
+  double mini, maxi, ave;
+  switch (type)
+  {
+  case MIN_ANGLE:
+  case MAX_ANGLE:
+  case MEAN_ANGLE:
+    angles(d->poly, mini, maxi, ave);
+  }
+
+  switch(type)
+  {
+  case NB_VERTICES:
+    return QString::number(d->poly->size_of_vertices());
+
+  case NB_FACETS:
+    return QString::number(d->poly->size_of_facets());
+  
+  case NB_CONNECTED_COMPOS:
+  {
+    typedef boost::graph_traits<Polyhedron>::face_descriptor face_descriptor;
+    int i = 0;
+    BOOST_FOREACH(face_descriptor f, faces(*(d->poly))){
+      f->id() = i++;
+    }
+    boost::vector_property_map<int,
+      boost::property_map<Polyhedron, boost::face_index_t>::type>
+      fccmap(get(boost::face_index, *(d->poly)));
+    return QString::number(PMP::connected_components(*(d->poly), fccmap));
+  }
+  case NB_BORDER_EDGES:
+    d->poly->normalize_border();
+    return QString::number(d->poly->size_of_border_halfedges());
+
+  case NB_EDGES:
+    return QString::number(d->poly->size_of_halfedges() / 2);
+
+  case NB_DEGENERATED_FACES:
+  {
+    if (d->poly->is_pure_triangle())
+    {
+      if (d->number_of_degenerated_faces == (unsigned int)(-1))
+        d->number_of_degenerated_faces = nb_degenerate_faces(d->poly, get(CGAL::vertex_point, *(d->poly)));
+      return QString::number(d->number_of_degenerated_faces);
+    }
+    else
+      return QString("n/a");
+  }
+  case AREA:
+  {
+    if (d->poly->is_pure_triangle())
+    {
+      if(d->area == -std::numeric_limits<double>::infinity())
+        d->area = CGAL::Polygon_mesh_processing::area(*(d->poly));
+      return QString::number(d->area);
+    }
+    else
+      return QString("n/a");
+  }
+  case VOLUME:
+  {
+    if (d->poly->is_pure_triangle() && d->poly->is_closed())
+    {
+      if (d->volume == -std::numeric_limits<double>::infinity())
+        d->volume = CGAL::Polygon_mesh_processing::volume(*(d->poly));
+      return QString::number(d->volume);
+    }
+    else
+      return QString("n/a");
+  }
+  case SELFINTER:
+  {
+    //todo : add a test about cache validity
+    if (d->poly->is_pure_triangle())
+      d->self_intersect = CGAL::Polygon_mesh_processing::does_self_intersect(*(d->poly));
+    if (d->self_intersect)
+      return QString("Yes");
+    else if (d->poly->is_pure_triangle())
+      return QString("No");
+    else
+      return QString("n/a");
+  }
+  case MIN_LENGTH:
+    return QString::number(minl);
+  case MAX_LENGTH:
+    return QString::number(maxl);
+  case MID_LENGTH:
+    return QString::number(midl);
+  case MEAN_LENGTH:
+    return QString::number(meanl);
+  case NB_NULL_LENGTH:
+    return QString::number(d->number_of_null_length_edges);
+
+  case MIN_ANGLE:
+    return QString::number(mini);
+  case MAX_ANGLE:
+    return QString::number(maxi);
+  case MEAN_ANGLE:
+    return QString::number(ave);
+
+  case HOLES:
+    return QString::number(nb_holes(d->poly));
+  }
+  return QString();
+}
+
+CGAL::Three::Scene_item::Header_data Scene_polyhedron_item::header() const
+{
+  CGAL::Three::Scene_item::Header_data data;
+  //categories
+  data.categories.append(std::pair<QString,int>(QString("Properties"),9));
+  data.categories.append(std::pair<QString,int>(QString("Edges"),6));
+  data.categories.append(std::pair<QString,int>(QString("Angles"),3));
+
+
+  //titles
+  data.titles.append(QString("#Vertices"));
+  data.titles.append(QString("#Facets"));
+  data.titles.append(QString("#Connected Components"));
+  data.titles.append(QString("#Border Edges"));
+  data.titles.append(QString("#Degenerated Faces"));
+  data.titles.append(QString("Connected Components of the Boundary"));
+  data.titles.append(QString("Area"));
+  data.titles.append(QString("Volume"));
+  data.titles.append(QString("Self-Intersecting"));
+  data.titles.append(QString("#Edges"));
+  data.titles.append(QString("Minimum Length"));
+  data.titles.append(QString("Maximum Length"));
+  data.titles.append(QString("Median Length"));
+  data.titles.append(QString("Mean Length"));
+  data.titles.append(QString("#Null Length"));
+  data.titles.append(QString("Minimum"));
+  data.titles.append(QString("Maximum"));
+  data.titles.append(QString("Average"));
+  return data;
+}
+
+
+void Scene_polyhedron_item::printPrimitiveId(QPoint point, CGAL::Three::Viewer_interface *viewer)
+{
+  TextRenderer *renderer = viewer->textRenderer;
+  renderer->getLocalTextItems().removeAll(d->targeted_id);
+  renderer->removeTextList(textItems);
+  textItems->clear();
+  QFont font;
+  font.setBold(true);
+
+  typedef Input_facets_AABB_tree Tree;
+  typedef Tree::Intersection_and_primitive_id<Kernel::Ray_3>::Type Intersection_and_primitive_id;
+
+  Tree* aabb_tree = static_cast<Input_facets_AABB_tree*>(d->get_aabb_tree());
+  if(aabb_tree) {
+    //find clicked facet
+    bool found = false;
+    const Kernel::Point_3 ray_origin(viewer->camera()->position().x, viewer->camera()->position().y, viewer->camera()->position().z);
+    qglviewer::Vec point_under = viewer->camera()->pointUnderPixel(point,found);
+    qglviewer::Vec dir = point_under - viewer->camera()->position();
+    const Kernel::Vector_3 ray_dir(dir.x, dir.y, dir.z);
+    const Kernel::Ray_3 ray(ray_origin, ray_dir);
+    typedef std::list<Intersection_and_primitive_id> Intersections;
+    Intersections intersections;
+    aabb_tree->all_intersections(ray, std::back_inserter(intersections));
+
+    if(!intersections.empty()) {
+      Intersections::iterator closest = intersections.begin();
+      const Kernel::Point_3* closest_point =
+          boost::get<Kernel::Point_3>(&closest->first);
+      for(Intersections::iterator
+          it = boost::next(intersections.begin()),
+          end = intersections.end();
+          it != end; ++it)
+      {
+        if(! closest_point) {
+          closest = it;
+        }
+        else {
+          const Kernel::Point_3* it_point =
+              boost::get<Kernel::Point_3>(&it->first);
+          if(it_point &&
+             (ray_dir * (*it_point - *closest_point)) < 0)
+          {
+            closest = it;
+            closest_point = it_point;
+          }
+        }
+      }
+      if(closest_point) {
+        Polyhedron::Facet_handle selected_fh = closest->second;
+        //Test spots around facet to find the closest to point
+
+        double min_dist = (std::numeric_limits<double>::max)();
+        TextItem text_item;
+        Kernel::Point_3 pt_under(point_under.x, point_under.y, point_under.z);
+
+        // test the vertices of the closest face
+        BOOST_FOREACH(Polyhedron::Vertex_handle vh, vertices_around_face(selected_fh->halfedge(), *d->poly))
+        {
+          Kernel::Point_3 test=vh->point();
+          double dist = CGAL::squared_distance(test, pt_under);
+          if( dist < min_dist){
+            min_dist = dist;
+            text_item = TextItem(test.x(), test.y(), test.z(), QString("%1").arg(vh->id()), true, font, Qt::red);
+          }
+        }
+        // test the midpoint of edges of the closest face
+        BOOST_FOREACH(boost::graph_traits<Polyhedron>::halfedge_descriptor e, halfedges_around_face(selected_fh->halfedge(), *d->poly))
+        {
+          Kernel::Point_3 test=CGAL::midpoint(source(e, *d->poly)->point(),target(e, *d->poly)->point());
+          double dist = CGAL::squared_distance(test, pt_under);
+          if(dist < min_dist){
+            min_dist = dist;
+            text_item = TextItem(test.x(), test.y(), test.z(), QString("%1").arg(e->id()/2), true, font, Qt::green);
+          }
+        }
+
+        // test the centroid of the closest face
+        double x(0), y(0), z(0);
+        int total(0);
+        BOOST_FOREACH(Polyhedron::Vertex_handle vh, vertices_around_face(selected_fh->halfedge(), *d->poly))
+        {
+          x+=vh->point().x();
+          y+=vh->point().y();
+          z+=vh->point().z();
+          ++total;
+        }
+
+        Kernel::Point_3 test(x/total, y/total, z/total);
+        double dist = CGAL::squared_distance(test, pt_under);
+        if(dist < min_dist){
+          min_dist = dist;
+          text_item = TextItem(test.x(), test.y(), test.z(), QString("%1").arg(selected_fh->id()), true, font, Qt::blue);
+        }
+
+        TextItem* former_targeted_id=d->targeted_id;
+        if (d->targeted_id == NULL || d->targeted_id->position() != text_item.position() )
+        {
+          d->targeted_id = new TextItem(text_item);
+          textItems->append(d->targeted_id);
+          renderer->addTextList(textItems);
+        }
+        else
+          d->targeted_id=NULL;
+        if(former_targeted_id != NULL) renderer->removeText(former_targeted_id);
+      }
+    }
+  }
+}
+
+void Scene_polyhedron_item::printPrimitiveIds(CGAL::Three::Viewer_interface *viewer) const 
+{
+  TextRenderer *renderer = viewer->textRenderer;
+
+
+  if(!d->all_ids_displayed)
+  {
+    QFont font;
+    font.setBold(true);
+
+    //fills textItems
+    BOOST_FOREACH(Polyhedron::Vertex_const_handle vh, vertices(*d->poly))
+    {
+      const Point& p = vh->point();
+      textItems->append(new TextItem((float)p.x(), (float)p.y(), (float)p.z(), QString("%1").arg(vh->id()), true, font, Qt::red));
+
+    }
+
+    BOOST_FOREACH(boost::graph_traits<Polyhedron>::edge_descriptor e, edges(*d->poly))
+    {
+      const Point& p1 = source(e, *d->poly)->point();
+      const Point& p2 = target(e, *d->poly)->point();
+      textItems->append(new TextItem((float)(p1.x() + p2.x()) / 2, (float)(p1.y() + p2.y()) / 2, (float)(p1.z() + p2.z()) / 2, QString("%1").arg(e.halfedge()->id() / 2), true, font, Qt::green));
+    }
+
+    BOOST_FOREACH(Polyhedron::Facet_handle fh, faces(*d->poly))
+    {
+      double x(0), y(0), z(0);
+      int total(0);
+      BOOST_FOREACH(Polyhedron::Vertex_handle vh, vertices_around_face(fh->halfedge(), *d->poly))
+      {
+        x += vh->point().x();
+        y += vh->point().y();
+        z += vh->point().z();
+        ++total;
+      }
+
+      textItems->append(new TextItem((float)x / total, (float)y / total, (float)z / total, QString("%1").arg(fh->id()), true, font, Qt::blue));
+    }
+    //add the QList to the render's pool
+    renderer->addTextList(textItems);
+    if(textItems->size() > static_cast<std::size_t>(renderer->getMax_textItems()))
+      d->all_ids_displayed = !d->all_ids_displayed;
+  }
+  if(d->all_ids_displayed)
+  {
+    //clears TextItems
+    textItems->clear();
+    renderer->removeTextList(textItems);
+    if(d->targeted_id)
+    {
+      textItems->append(d->targeted_id);
+      renderer->addTextList(textItems);
+    }
+  }
+  d->all_ids_displayed = !d->all_ids_displayed;
+}
+
+bool Scene_polyhedron_item::testDisplayId(double x, double y, double z, CGAL::Three::Viewer_interface* viewer)
+{
+  Kernel::Point_3 src(x,y,z);
+  Kernel::Point_3 dest(viewer->camera()->position().x, viewer->camera()->position().y,viewer->camera()->position().z);
+  Kernel::Vector_3 v(src,dest);
+  v = 0.01*v;
+  Kernel::Point_3 point = src;
+  point = point + v;
+  Kernel::Segment_3 query(point, dest);
+  return !static_cast<Input_facets_AABB_tree*>(d->get_aabb_tree())->do_intersect(query);
+
+}
+
+std::vector<QColor>& Scene_polyhedron_item::color_vector() {return d->colors_;}
+void Scene_polyhedron_item::set_color_vector_read_only(bool on_off) {d->plugin_has_set_color_vector_m=on_off;}
+bool Scene_polyhedron_item::is_color_vector_read_only() { return d->plugin_has_set_color_vector_m;}
+int Scene_polyhedron_item::getNumberOfNullLengthEdges(){return d->number_of_null_length_edges;}
+int Scene_polyhedron_item::getNumberOfDegeneratedFaces(){return d->number_of_degenerated_faces;}
+bool Scene_polyhedron_item::triangulated(){return d->poly->is_pure_triangle();}
+bool Scene_polyhedron_item::self_intersected(){return !(d->self_intersect);}
+void Scene_polyhedron_item::setItemIsMulticolor(bool b){ d->is_multicolor = b;}
+bool Scene_polyhedron_item::isItemMulticolor(){ return d->is_multicolor;}
+
diff --git a/3rdparty/CGAL/demo/Polyhedron/Scene_polyhedron_item.h b/3rdparty/CGAL/demo/Polyhedron/Scene_polyhedron_item.h
new file mode 100644
index 0000000..bda2600
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Scene_polyhedron_item.h
@@ -0,0 +1,143 @@
+#ifndef SCENE_POLYHEDRON_ITEM_H
+#define SCENE_POLYHEDRON_ITEM_H
+
+#include "Scene_polyhedron_item_config.h"
+#include  <CGAL/Three/Scene_item.h>
+#include  <CGAL/Three/TextRenderer.h>
+#include "Polyhedron_type_fwd.h"
+#include "Polyhedron_type.h"
+#include <iostream>
+#include <QOpenGLVertexArrayObject>
+#include <QOpenGLBuffer>
+#include <QOpenGLShaderProgram>
+#include <QOpenGLTexture>
+#include <set>
+#include <vector>
+
+#include <QColor>
+
+class QMenu;
+struct Scene_polyhedron_item_priv;
+
+// This class represents a polyhedron in the OpenGL scene
+class SCENE_POLYHEDRON_ITEM_EXPORT Scene_polyhedron_item
+        : public CGAL::Three::Scene_item{
+    Q_OBJECT
+public:
+    enum STATS {
+      NB_VERTICES = 0,
+      NB_FACETS,
+      NB_CONNECTED_COMPOS,
+      NB_BORDER_EDGES,
+      NB_DEGENERATED_FACES,
+      HOLES,
+      AREA,
+      VOLUME,
+      SELFINTER,
+      NB_EDGES,
+      MIN_LENGTH,
+      MAX_LENGTH,
+      MID_LENGTH,
+      MEAN_LENGTH,
+      NB_NULL_LENGTH,
+      MIN_ANGLE,
+      MAX_ANGLE,
+      MEAN_ANGLE
+    };
+
+    bool has_stats()const {return true;}
+    QString computeStats(int type);
+    CGAL::Three::Scene_item::Header_data header() const;
+    TextListItem* textItems;
+    Scene_polyhedron_item();
+    //   Scene_polyhedron_item(const Scene_polyhedron_item&);
+    Scene_polyhedron_item(const Polyhedron& p);
+    Scene_polyhedron_item(Polyhedron* const p);
+    ~Scene_polyhedron_item();
+
+    Scene_polyhedron_item* clone() const;
+
+    // IO
+    bool load(std::istream& in);
+    bool load_obj(std::istream& in);
+    bool save(std::ostream& out) const;
+    bool save_obj(std::ostream& out) const;
+
+    // Function for displaying meta-data of the item
+    virtual QString toolTip() const;
+
+    // Function to override the context menu
+    QMenu* contextMenu();
+
+    // Indicate if rendering mode is supported
+    virtual bool supportsRenderingMode(RenderingMode m) const { return (m!=PointsPlusNormals && m!=Splatting); }
+    // Points/Wireframe/Flat/Gouraud OpenGL drawing in a display list
+    void draw() const {}
+    virtual void draw(CGAL::Three::Viewer_interface*) const;
+    virtual void drawEdges() const {}
+    virtual void drawEdges(CGAL::Three::Viewer_interface* viewer) const;
+    virtual void drawPoints(CGAL::Three::Viewer_interface*) const;
+
+    // Get wrapped polyhedron
+    Polyhedron*       polyhedron();
+    const Polyhedron* polyhedron() const;
+
+    // Get dimensions
+    bool isFinite() const { return true; }
+    bool isEmpty() const;
+    void compute_bbox() const;
+    std::vector<QColor>& color_vector();
+    void set_color_vector_read_only(bool on_off);
+    bool is_color_vector_read_only();
+    int getNumberOfNullLengthEdges();
+    int getNumberOfDegeneratedFaces();
+    bool triangulated();
+    bool self_intersected();
+    //! If b is true, the item will use buffers to render the color.
+    //! If b is false, it will use a uniform value. For example, when
+    //! using the mesh segmentation plugin, the item must be multicolor.
+    void setItemIsMulticolor(bool b);
+    //! @returns `true` if the item has multiple colors at the same time.
+    bool isItemMulticolor();
+
+    void printPrimitiveId(QPoint point, CGAL::Three::Viewer_interface*viewer);
+    void printPrimitiveIds(CGAL::Three::Viewer_interface*viewer) const;
+    bool testDisplayId(double x, double y, double z, CGAL::Three::Viewer_interface*);
+
+public Q_SLOTS:
+    virtual void invalidateOpenGLBuffers();
+    virtual void selection_changed(bool);
+    virtual void setColor(QColor c);
+    virtual void show_feature_edges(bool);
+    void show_only_feature_edges(bool);
+    void enable_facets_picking(bool);
+    void set_erase_next_picked_facet(bool);
+
+    void select(double orig_x,
+                double orig_y,
+                double orig_z,
+                double dir_x,
+                double dir_y,
+                double dir_z);
+    void update_vertex_indices();
+    void update_facet_indices();
+    void update_halfedge_indices();
+    void invalidate_aabb_tree();
+
+Q_SIGNALS:
+    void selection_done();
+    void selected_vertex(void*);
+    void selected_facet(void*);
+    void selected_edge(void*);
+    void selected_halfedge(void*);
+    void item_is_about_to_be_changed(); // emitted in invalidateOpenGLBuffers()
+public:
+    typedef Scene_item Base;
+    typedef Polyhedron::Facet_iterator Facet_iterator;
+protected:
+    friend struct Scene_polyhedron_item_priv;
+    Scene_polyhedron_item_priv* d;
+
+}; // end class Scene_polyhedron_item
+
+#endif // SCENE_POLYHEDRON_ITEM_H
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polyhedron_item_config.h b/3rdparty/CGAL/demo/Polyhedron/Scene_polyhedron_item_config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polyhedron_item_config.h
rename to 3rdparty/CGAL/demo/Polyhedron/Scene_polyhedron_item_config.h
diff --git a/3rdparty/CGAL/demo/Polyhedron/Scene_polyhedron_item_decorator.cpp b/3rdparty/CGAL/demo/Polyhedron/Scene_polyhedron_item_decorator.cpp
new file mode 100644
index 0000000..04cce7d
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Scene_polyhedron_item_decorator.cpp
@@ -0,0 +1,102 @@
+#include "Scene_polyhedron_item_decorator.h"
+#include "Polyhedron_type.h"
+
+Scene_polyhedron_item_decorator::Scene_polyhedron_item_decorator
+  (Scene_polyhedron_item* poly_item, bool delete_item)
+  :CGAL::Three::Scene_item(), poly_item(poly_item), delete_poly_item(delete_item)
+{ }
+
+Scene_polyhedron_item_decorator::~Scene_polyhedron_item_decorator()
+{ 
+  if(delete_poly_item) { delete poly_item; }
+}
+
+Scene_polyhedron_item_decorator* 
+Scene_polyhedron_item_decorator::clone() const {
+  return 0;
+}
+
+QString 
+Scene_polyhedron_item_decorator::toolTip() const
+{
+  if(!poly_item->polyhedron())
+    return QString();
+
+  return QObject::tr("<p>Polyhedron <b>%1</b> (mode: %5, color: %6)</p>"
+                     "<p>Number of vertices: %2<br />"
+                     "Number of edges: %3<br />"
+                     "Number of facets: %4</p>")
+    .arg(this->name())
+    .arg(poly_item->polyhedron()->size_of_vertices())
+    .arg(poly_item->polyhedron()->size_of_halfedges()/2)
+    .arg(poly_item->polyhedron()->size_of_facets())
+    .arg(this->renderingModeName())
+    .arg(this->color().name());
+}
+
+void Scene_polyhedron_item_decorator::draw() const {
+  poly_item->draw();
+}
+
+void Scene_polyhedron_item_decorator::drawEdges() const {
+  poly_item->drawEdges();
+}
+
+Polyhedron* 
+Scene_polyhedron_item_decorator::polyhedron()       
+{ return poly_item->polyhedron(); }
+
+const Polyhedron* 
+Scene_polyhedron_item_decorator::polyhedron() const 
+{ return poly_item->polyhedron(); }
+
+bool
+Scene_polyhedron_item_decorator::isEmpty() const {
+  return poly_item->isEmpty();
+}
+
+void
+Scene_polyhedron_item_decorator::compute_bbox() const {
+  _bbox = poly_item->bbox();
+}
+
+
+void
+Scene_polyhedron_item_decorator::
+invalidateOpenGLBuffers()
+{
+  poly_item->invalidateOpenGLBuffers();
+  Scene_item::invalidateOpenGLBuffers();
+  compute_bbox();
+}
+
+void 
+Scene_polyhedron_item_decorator::select(double orig_x,
+                                   double orig_y,
+                                   double orig_z,
+                                   double dir_x,
+                                   double dir_y,
+                                   double dir_z)
+{
+  Scene_item::select(orig_x,
+                     orig_y,
+                     orig_z,
+                     dir_x,
+                     dir_y,
+                     dir_z);
+  poly_item->select(orig_x,
+                       orig_y,
+                       orig_z,
+                       dir_x,
+                       dir_y,
+                       dir_z);
+}
+
+Scene_polyhedron_item* Scene_polyhedron_item_decorator::polyhedron_item() const {
+  return poly_item;
+}
+
+void Scene_polyhedron_item_decorator::set_polyhedron_item(Scene_polyhedron_item* poly_item) {
+  this->poly_item = poly_item;
+}
+
diff --git a/3rdparty/CGAL/demo/Polyhedron/Scene_polyhedron_item_decorator.h b/3rdparty/CGAL/demo/Polyhedron/Scene_polyhedron_item_decorator.h
new file mode 100644
index 0000000..93fda64
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Scene_polyhedron_item_decorator.h
@@ -0,0 +1,65 @@
+#ifndef SCENE_POLYHEDRON_ITEM_DECORATOR_H
+#define SCENE_POLYHEDRON_ITEM_DECORATOR_H
+#include "Scene_polyhedron_item_decorator_config.h"
+#include "Scene_polyhedron_item.h"
+
+// This class is a decorator for Scene_polyhedron_item yet it does not inherit it but Scene_item
+class SCENE_POLYHEDRON_ITEM_DECORATOR_EXPORT Scene_polyhedron_item_decorator 
+  : public CGAL::Three::Scene_item {
+  Q_OBJECT
+public:  
+  /// Create an Scene_polyhedron_item_decorator from a Scene_polyhedron_item.
+
+  Scene_polyhedron_item_decorator(Scene_polyhedron_item* poly_item, bool delete_item = true);
+  ~Scene_polyhedron_item_decorator();
+
+  /// Returns 0, so that one cannot clone decorator
+  Scene_polyhedron_item_decorator* clone() const;
+  
+  // // IO
+  // bool load(std::istream& in);
+  // bool save(std::ostream& out) const;
+
+  // Function for displaying meta-data of the item
+  QString toolTip() const;
+
+  // // Function to override the context menu
+  // QMenu* contextMenu();
+  
+  // Indicate if rendering mode is supported
+  bool supportsRenderingMode(RenderingMode m) const { return (m!=PointsPlusNormals && m!=Splatting); }
+  // Points/Wireframe/Flat/Gouraud OpenGL drawing in a display list
+  // dispatch to poly_item direct_draw and direct_drawEdges
+  void draw() const;
+  void drawEdges() const;
+
+  // Get wrapped polyhedron
+  Polyhedron*       polyhedron();
+  const Polyhedron* polyhedron() const;
+
+  Scene_polyhedron_item* polyhedron_item() const;
+  void                   set_polyhedron_item(Scene_polyhedron_item* poly_item);
+
+  // Get dimensions
+  bool isFinite() const { return true; }
+  bool isEmpty() const;
+  void compute_bbox() const;
+
+  bool delete_item() { return delete_poly_item; }
+  void set_delete_item(bool delete_item) { delete_poly_item = delete_item; }
+
+public Q_SLOTS:
+  void invalidateOpenGLBuffers();
+  void select(double orig_x,
+              double orig_y,
+              double orig_z,
+              double dir_x,
+              double dir_y,
+              double dir_z);
+
+protected:
+  Scene_polyhedron_item* poly_item;
+  bool delete_poly_item;
+}; // end class Scene_polyhedron_item_decorator
+
+#endif // SCENE_POLYHEDRON_ITEM_DECORATOR_H
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polyhedron_item_decorator_config.h b/3rdparty/CGAL/demo/Polyhedron/Scene_polyhedron_item_decorator_config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polyhedron_item_decorator_config.h
rename to 3rdparty/CGAL/demo/Polyhedron/Scene_polyhedron_item_decorator_config.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polyhedron_item_k_ring_selection.cpp b/3rdparty/CGAL/demo/Polyhedron/Scene_polyhedron_item_k_ring_selection.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polyhedron_item_k_ring_selection.cpp
rename to 3rdparty/CGAL/demo/Polyhedron/Scene_polyhedron_item_k_ring_selection.cpp
diff --git a/3rdparty/CGAL/demo/Polyhedron/Scene_polyhedron_item_k_ring_selection.h b/3rdparty/CGAL/demo/Polyhedron/Scene_polyhedron_item_k_ring_selection.h
new file mode 100644
index 0000000..06768f5
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Scene_polyhedron_item_k_ring_selection.h
@@ -0,0 +1,350 @@
+#ifndef SCENE_POLYHEDRON_ITEM_K_RING_SELECTION_H
+#define SCENE_POLYHEDRON_ITEM_K_RING_SELECTION_H
+#include "Scene_polyhedron_item_k_ring_selection_config.h"
+#include "Polyhedron_type.h"
+#include "Scene_polyhedron_item.h"
+
+#include <QGLViewer/qglviewer.h>
+#include <QKeyEvent>
+#include <QMouseEvent>
+#include <QMainWindow>
+#include <QObject>
+
+#include <map>
+#include <queue>
+
+#include <CGAL/boost/graph/selection.h>
+
+class SCENE_POLYHEDRON_ITEM_K_RING_SELECTION_EXPORT Scene_polyhedron_item_k_ring_selection 
+  : public QObject
+{
+  Q_OBJECT
+public:
+  struct Active_handle {
+    enum Type{ VERTEX = 0, FACET = 1, EDGE = 2 , CONNECTED_COMPONENT = 3, PATH = 4};
+  };
+
+  typedef boost::graph_traits<Polyhedron>::edge_descriptor edge_descriptor;
+
+  // Hold mouse keyboard state together
+  struct Mouse_keyboard_state
+  {
+    Mouse_keyboard_state() : shift_pressing(false), left_button_pressing(false) { }
+    bool shift_pressing, left_button_pressing;
+  };
+
+  Mouse_keyboard_state  state;
+  QMainWindow* mainwindow;
+  Active_handle::Type    active_handle_type;
+  int                    k_ring;
+  Scene_polyhedron_item* poly_item;
+  bool is_active;
+  bool is_current_selection;
+  bool is_highlighting;
+
+  Scene_polyhedron_item_k_ring_selection() {}
+
+  Scene_polyhedron_item_k_ring_selection
+    (Scene_polyhedron_item* poly_item, QMainWindow* mw, Active_handle::Type aht, int k_ring)
+      :is_active(false),is_current_selection(true), is_edit_mode(false)
+  {
+    init(poly_item, mw, aht, k_ring);
+  }
+
+  void setEditMode(bool b)
+  {
+    is_edit_mode = b;
+    QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
+    //for highlighting
+    viewer->setMouseTracking(b);
+  }
+
+  void init(Scene_polyhedron_item* poly_item, QMainWindow* mw, Active_handle::Type aht, int k_ring) {
+    this->poly_item = poly_item;
+    this->active_handle_type = aht;
+    this->k_ring = k_ring;
+    mainwindow = mw;
+    is_highlighting = false;
+    is_ready_to_highlight = true;
+    is_ready_to_paint_select = true;
+    poly_item->enable_facets_picking(true);
+    poly_item->set_color_vector_read_only(true);
+
+    QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
+    viewer->installEventFilter(this);
+    mw->installEventFilter(this);
+#if QGLVIEWER_VERSION >= 0x020501
+    viewer->setMouseBindingDescription(Qt::Key_D, Qt::ShiftModifier, Qt::LeftButton, "(When in selection plugin) Removes the clicked primitive from the selection. ");
+#else
+    viewer->setMouseBindingDescription(Qt::SHIFT + Qt::LeftButton,  "(When in selection plugin) When D is pressed too, removes the clicked primitive from the selection. ");
+#endif
+    connect(poly_item, SIGNAL(selected_vertex(void*)), this, SLOT(vertex_has_been_selected(void*)));
+    connect(poly_item, SIGNAL(selected_facet(void*)), this, SLOT(facet_has_been_selected(void*)));
+    connect(poly_item, SIGNAL(selected_edge(void*)), this, SLOT(edge_has_been_selected(void*)));
+  }
+  void setCurrentlySelected(bool b)
+  {
+    is_current_selection = b;
+  }
+public Q_SLOTS:
+  // slots are called by signals of polyhedron_item
+  void vertex_has_been_selected(void* void_ptr) 
+  {
+    is_active=true;
+    if(active_handle_type == Active_handle::VERTEX || active_handle_type == Active_handle::PATH)
+      process_selection( static_cast<Polyhedron::Vertex*>(void_ptr)->halfedge()->vertex() );
+    updateIsTreated();
+  }
+  void facet_has_been_selected(void* void_ptr)
+  {
+    is_active=true;
+    if (active_handle_type == Active_handle::FACET
+      || active_handle_type == Active_handle::CONNECTED_COMPONENT)
+      process_selection(static_cast<Polyhedron::Facet*>(void_ptr)->halfedge()->facet());
+    updateIsTreated();
+  }
+  void edge_has_been_selected(void* void_ptr) 
+  {
+    is_active=true;
+    if(active_handle_type == Active_handle::EDGE)
+      process_selection( edge(static_cast<Polyhedron::Halfedge*>(void_ptr)->opposite()->opposite(), *poly_item->polyhedron()) );
+    updateIsTreated();
+  }
+
+  void paint_selection()
+  {
+    if(is_ready_to_paint_select)
+    {
+      // paint with mouse move event
+      QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
+      qglviewer::Camera* camera = viewer->camera();
+
+      bool found = false;
+      const qglviewer::Vec& point = camera->pointUnderPixel(paint_pos, found);
+      if(found)
+      {
+        const qglviewer::Vec& orig = camera->position();
+        const qglviewer::Vec& dir = point - orig;
+        poly_item->select(orig.x, orig.y, orig.z, dir.x, dir.y, dir.z);
+      }
+      is_ready_to_paint_select = false;
+    }
+  }
+
+  void highlight()
+  {
+    if(is_ready_to_highlight)
+    {
+      // highlight with mouse move event
+      QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
+      qglviewer::Camera* camera = viewer->camera();
+
+      bool found = false;
+      const qglviewer::Vec& point = camera->pointUnderPixel(hl_pos, found);
+      if(found)
+      {
+        const qglviewer::Vec& orig = camera->position();
+        const qglviewer::Vec& dir = point - orig;
+        is_highlighting = true;
+        poly_item->select(orig.x, orig.y, orig.z, dir.x, dir.y, dir.z);
+        is_highlighting = false;
+      }
+      else
+      {
+        Q_EMIT clearHL();
+      }
+      is_ready_to_highlight = false;
+    }
+  }
+
+Q_SIGNALS:
+  void selected(const std::set<Polyhedron::Vertex_handle>&);
+  void selected(const std::set<Polyhedron::Facet_handle>&);
+  void selected(const std::set<edge_descriptor>&);
+  void selected_HL(const std::set<Polyhedron::Vertex_handle>&);
+  void selected_HL(const std::set<Polyhedron::Facet_handle>&);
+  void selected_HL(const std::set<edge_descriptor>&);
+  void toogle_insert(const bool);
+  void endSelection();
+  void resetIsTreated(); 
+  void isCurrentlySelected(Scene_polyhedron_item_k_ring_selection*);
+  void clearHL();
+
+protected:
+
+  void updateIsTreated()
+  {
+    static ushort i = 0;
+    i++;
+    if(i==3)
+    {
+      i = 0;
+      Q_EMIT resetIsTreated();
+    }
+  }
+  template<class HandleType>
+  void process_selection(HandleType clicked) {
+    const std::set<HandleType>& selection = extract_k_ring(clicked, k_ring);
+    if(is_highlighting)
+    {
+      Q_EMIT selected_HL(selection);
+    }
+    else
+      Q_EMIT selected(selection);
+  }
+
+  template <class Handle>
+  struct Is_selected_from_set{
+    std::set<Handle>& selection;
+    Is_selected_from_set(std::set<Handle>& selection)
+      :selection(selection) {}
+    friend bool get(Is_selected_from_set<Handle> map, Handle k)
+    {
+      return map.selection.count(k);
+    }
+    friend void put(Is_selected_from_set<Handle> map, Handle k, bool b)
+    {
+      if (b)
+        map.selection.insert(k);
+      else
+        map.selection.erase(k);
+    }
+  };
+
+  std::set<Polyhedron::Vertex_handle>
+  extract_k_ring(Polyhedron::Vertex_handle clicked, unsigned int k)
+  {
+    std::set<Polyhedron::Vertex_handle> selection;
+    selection.insert(clicked);
+    if (k>0)
+      CGAL::expand_vertex_selection(CGAL::make_array(clicked),
+                                    *poly_item->polyhedron(),
+                                    k,
+                                    Is_selected_from_set<Polyhedron::Vertex_handle>(selection),
+                                    CGAL::Emptyset_iterator());
+
+    return selection;
+  }
+
+  std::set<Polyhedron::Facet_handle>
+  extract_k_ring(Polyhedron::Facet_handle clicked, unsigned int k)
+  {
+    std::set<Polyhedron::Facet_handle> selection;
+    selection.insert(clicked);
+    if (k>0)
+      CGAL::expand_face_selection(CGAL::make_array(clicked),
+                                  *poly_item->polyhedron(),
+                                  k,
+                                  Is_selected_from_set<Polyhedron::Facet_handle>(selection),
+                                  CGAL::Emptyset_iterator());
+
+    return selection;
+  }
+
+  std::set<edge_descriptor>
+  extract_k_ring(edge_descriptor clicked, unsigned int k)
+  {
+    std::set<edge_descriptor> selection;
+    selection.insert(clicked);
+
+    if (k>0)
+      CGAL::expand_edge_selection(CGAL::make_array(clicked),
+                                  *poly_item->polyhedron(),
+                                  k,
+                                  Is_selected_from_set<edge_descriptor>(selection),
+                                  CGAL::Emptyset_iterator());
+    return selection;
+  }
+
+
+  bool eventFilter(QObject* target, QEvent *event)
+  {
+    // This filter is both filtering events from 'viewer' and 'main window'
+
+    // key events
+      if(event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease)  {
+      QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
+      Qt::KeyboardModifiers modifiers = keyEvent->modifiers();
+
+      state.shift_pressing = modifiers.testFlag(Qt::ShiftModifier);
+    }
+
+    if(event->type() == QEvent::KeyPress
+            && state.shift_pressing
+            && static_cast<QKeyEvent*>(event)->key()==Qt::Key_D)
+    {
+     Q_EMIT toogle_insert(false);
+    }
+    else if(event->type() == QEvent::KeyRelease
+            && static_cast<QKeyEvent*>(event)->key()==Qt::Key_D)
+    {
+     Q_EMIT toogle_insert(true);
+    }
+    // mouse events
+    if(event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonRelease) {
+      QMouseEvent* mouse_event = static_cast<QMouseEvent*>(event);
+      if(mouse_event->button() == Qt::LeftButton) {
+        state.left_button_pressing = event->type() == QEvent::MouseButtonPress;
+        if(is_edit_mode)
+          Q_EMIT clearHL();
+        if (!state.left_button_pressing)
+          if (is_active)
+          {
+            Q_EMIT endSelection();
+            is_active=false;
+          }
+      }
+      //to avoid the contextual menu to mess up the states.
+      else if(mouse_event->button() == Qt::RightButton) {
+        state.left_button_pressing = false;
+        state.shift_pressing = false;
+      }
+    }
+    // use mouse move event for paint-like selection
+    if( (event->type() == QEvent::MouseMove
+         || (event->type() == QEvent::MouseButtonPress
+             && static_cast<QMouseEvent*>(event)->button() == Qt::LeftButton))
+        && (state.shift_pressing && state.left_button_pressing) )
+    {
+      Q_EMIT isCurrentlySelected(this);
+      if(!is_current_selection)
+        return false;
+      if(target == mainwindow)
+      {
+        QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
+        viewer->setFocus();
+        return false;
+      }
+      is_ready_to_paint_select = true;
+      QMouseEvent* mouse_event = static_cast<QMouseEvent*>(event);
+      paint_pos = mouse_event->pos();
+      if(!is_edit_mode || event->type() == QEvent::MouseButtonPress)
+        QTimer::singleShot(0,this,SLOT(paint_selection()));
+    }
+    //if in edit_mode and the mouse is moving without left button pressed :
+    // highlight the primitive under cursor
+    else if(is_edit_mode && event->type() == QEvent::MouseMove && !state.left_button_pressing)
+    {
+      if(target == mainwindow)
+      {
+        QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
+        viewer->setFocus();
+        return false;
+      }
+
+      is_ready_to_highlight = true;
+      QMouseEvent* mouse_event = static_cast<QMouseEvent*>(event);
+      hl_pos = mouse_event->pos();
+      QTimer::singleShot(0, this, SLOT(highlight()));
+    }//end MouseMove
+    return false;
+  }
+  bool is_edit_mode;
+  bool is_ready_to_highlight;
+  bool is_ready_to_paint_select;
+  QPoint hl_pos;
+  QPoint paint_pos;
+
+};
+
+#endif
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polyhedron_item_k_ring_selection_config.h b/3rdparty/CGAL/demo/Polyhedron/Scene_polyhedron_item_k_ring_selection_config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polyhedron_item_k_ring_selection_config.h
rename to 3rdparty/CGAL/demo/Polyhedron/Scene_polyhedron_item_k_ring_selection_config.h
diff --git a/3rdparty/CGAL/demo/Polyhedron/Scene_polyhedron_selection_item.cpp b/3rdparty/CGAL/demo/Polyhedron/Scene_polyhedron_selection_item.cpp
new file mode 100644
index 0000000..b337b6d
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Scene_polyhedron_selection_item.cpp
@@ -0,0 +1,2126 @@
+#include <QApplication>
+#include "Scene_polyhedron_selection_item.h"
+#include <CGAL/Polygon_mesh_processing/compute_normal.h>
+#include <CGAL/Polygon_mesh_processing/repair.h>
+#include <CGAL/boost/graph/dijkstra_shortest_paths.h>
+#include <CGAL/property_map.h>
+#include <functional>
+#include "triangulate_primitive.h"
+struct Scene_polyhedron_selection_item_priv{
+
+  typedef Polyhedron::Vertex_handle   Vertex_handle;
+  typedef Polyhedron::Facet_handle    Facet_handle;
+  typedef boost::graph_traits<Polyhedron>::edge_descriptor edge_descriptor;
+  typedef Scene_polyhedron_item_k_ring_selection::Active_handle Active_handle;
+  typedef boost::unordered_set<Vertex_handle, CGAL::Handle_hash_function>    Selection_set_vertex;
+  typedef boost::unordered_set<Facet_handle, CGAL::Handle_hash_function>      Selection_set_facet;
+  typedef boost::unordered_set<edge_descriptor, CGAL::Handle_hash_function>    Selection_set_edge;
+  struct vertex_on_path
+  {
+    Vertex_handle vertex;
+    bool is_constrained;
+  };
+
+  Scene_polyhedron_selection_item_priv(Scene_polyhedron_selection_item* parent):
+    item(parent)
+  {
+  }
+
+  void initializeBuffers(CGAL::Three::Viewer_interface *viewer) const;
+  void initialize_temp_buffers(CGAL::Three::Viewer_interface *viewer) const;
+  void initialize_HL_buffers(CGAL::Three::Viewer_interface *viewer) const;
+  void computeElements() const;
+  void compute_any_elements(std::vector<float> &p_facets, std::vector<float> &p_lines, std::vector<float> &p_points, std::vector<float> &p_normals,
+                            const Selection_set_vertex& p_sel_vertex, const Selection_set_facet &p_sel_facet, const Selection_set_edge &p_sel_edges) const;
+  void compute_temp_elements() const;
+  void compute_HL_elements() const;
+  void triangulate_facet(Facet_handle, Kernel::Vector_3 normal,
+                         std::vector<float> &p_facets,std::vector<float> &p_normals) const;
+  void tempInstructions(QString s1, QString s2);
+
+  void computeAndDisplayPath();
+  void addVertexToPath(Vertex_handle, vertex_on_path &);
+
+  enum VAOs{
+    Facets = 0,
+    TempFacets,
+    Edges,
+    TempEdges,
+    Points,
+    TempPoints,
+    FixedPoints,
+    HLPoints,
+    HLEdges,
+    HLFacets,
+    NumberOfVaos
+  };
+  enum VBOs{
+    VertexFacets = 0,
+    NormalFacets,
+    VertexEdges,
+    VertexPoints,
+    VertexTempFacets,
+    NormalTempFacets,
+    VertexTempEdges,
+    VertexTempPoints,
+    VertexFixedPoints,
+    ColorFixedPoints,
+    VertexHLPoints,
+    VertexHLEdges,
+    VertexHLFacets,
+    NormalHLFacets,
+    NumberOfVbos
+  };
+
+  QList<vertex_on_path> path;
+  QList<Vertex_handle> constrained_vertices;
+  bool is_path_selecting;
+  bool poly_need_update;
+  mutable bool are_temp_buffers_filled;
+  //Specifies Selection/edition mode
+  bool first_selected;
+  int operation_mode;
+  QString m_temp_instructs;
+  bool is_treated;
+  Vertex_handle to_split_vh;
+  Facet_handle to_split_fh;
+  edge_descriptor to_join_ed;
+  Active_handle::Type original_sel_mode;
+  //Only needed for the triangulation
+  Polyhedron* poly;
+  CGAL::Unique_hash_map<boost::graph_traits<Polyhedron>::face_descriptor, Kernel::Vector_3>  face_normals_map;
+  CGAL::Unique_hash_map<boost::graph_traits<Polyhedron>::vertex_descriptor, Kernel::Vector_3>  vertex_normals_map;
+  boost::associative_property_map< CGAL::Unique_hash_map<boost::graph_traits<Polyhedron>::face_descriptor, Kernel::Vector_3> >
+    nf_pmap;
+  boost::associative_property_map< CGAL::Unique_hash_map<boost::graph_traits<Polyhedron>::vertex_descriptor, Kernel::Vector_3> >
+    nv_pmap;
+  Scene_polyhedron_item::ManipulatedFrame *manipulated_frame;
+  bool ready_to_move;
+
+  bool canAddFace(Scene_polyhedron_selection_item::Halfedge_handle hc, Scene_polyhedron_selection_item::Halfedge_handle t);
+  bool canAddFaceAndVertex(Scene_polyhedron_selection_item::Halfedge_handle hc, Scene_polyhedron_selection_item::Halfedge_handle t);
+
+  mutable std::vector<float> positions_facets;
+  mutable std::vector<float> normals;
+  mutable std::vector<float> positions_lines;
+  mutable std::vector<float> positions_points;
+  mutable std::size_t nb_facets;
+  mutable std::size_t nb_points;
+  mutable std::size_t nb_lines;
+
+  mutable std::vector<float> positions_temp_facets;
+  mutable std::vector<float> positions_fixed_points;
+  mutable std::vector<float> color_fixed_points;
+  mutable std::vector<float> temp_normals;
+  mutable std::vector<float> positions_temp_lines;
+  mutable std::vector<float> positions_temp_points;
+  mutable std::vector<float> positions_HL_facets;
+  mutable std::vector<float> HL_normals;
+  mutable std::vector<float> positions_HL_lines;
+  mutable std::vector<float> positions_HL_points;
+
+  mutable std::size_t nb_temp_facets;
+  mutable std::size_t nb_temp_points;
+  mutable std::size_t nb_temp_lines;
+  mutable std::size_t nb_fixed_points;
+
+  mutable QOpenGLShaderProgram *program;
+  mutable bool are_HL_buffers_filled;
+  Scene_polyhedron_selection_item* item;
+};
+
+
+void Scene_polyhedron_selection_item_priv::initializeBuffers(CGAL::Three::Viewer_interface *viewer)const
+{
+  //vao containing the data for the facets
+  {
+    program = item->getShaderProgram(Scene_polyhedron_selection_item::PROGRAM_WITH_LIGHT, viewer);
+    program->bind();
+
+    item->vaos[Facets]->bind();
+    item->buffers[VertexFacets].bind();
+    item->buffers[VertexFacets].allocate(positions_facets.data(),
+                        static_cast<int>(positions_facets.size()*sizeof(float)));
+    program->enableAttributeArray("vertex");
+    program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
+    item->buffers[VertexFacets].release();
+
+
+
+    item->buffers[NormalFacets].bind();
+    item->buffers[NormalFacets].allocate(normals.data(),
+                        static_cast<int>(normals.size()*sizeof(float)));
+    program->enableAttributeArray("normals");
+    program->setAttributeBuffer("normals",GL_FLOAT,0,3);
+    item->buffers[NormalFacets].release();
+
+    item->vaos[Facets]->release();
+    program->release();
+
+  }
+  //vao containing the data for the  lines
+  {
+    program = item->getShaderProgram(Scene_polyhedron_selection_item::PROGRAM_NO_SELECTION, viewer);
+    program->bind();
+    item->vaos[Edges]->bind();
+
+    item->buffers[VertexEdges].bind();
+    item->buffers[VertexEdges].allocate(positions_lines.data(),
+                        static_cast<int>(positions_lines.size()*sizeof(float)));
+    program->enableAttributeArray("vertex");
+    program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
+    item->buffers[VertexEdges].release();
+
+    program->release();
+
+    item->vaos[Edges]->release();
+
+  }
+  //vao containing the data for the points
+  {
+    program = item->getShaderProgram(Scene_polyhedron_selection_item::PROGRAM_NO_SELECTION, viewer);
+    program->bind();
+    item->vaos[Points]->bind();
+
+    item->buffers[VertexPoints].bind();
+    item->buffers[VertexPoints].allocate(positions_points.data(),
+                        static_cast<int>(positions_points.size()*sizeof(float)));
+    program->enableAttributeArray("vertex");
+    program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
+    item->buffers[VertexPoints].release();
+    program->release();
+
+    item->vaos[Points]->release();
+  }
+
+  nb_facets = positions_facets.size();
+  positions_facets.resize(0);
+  std::vector<float>(positions_facets).swap(positions_facets);
+
+  normals.resize(0);
+  std::vector<float>(normals).swap(normals);
+
+  nb_lines = positions_lines.size();
+  positions_lines.resize(0);
+  std::vector<float>(positions_lines).swap(positions_lines);
+
+  nb_points = positions_points.size();
+  positions_points.resize(0);
+  std::vector<float>(positions_points).swap(positions_points);
+  item->are_buffers_filled = true;
+}
+
+void Scene_polyhedron_selection_item_priv::initialize_temp_buffers(CGAL::Three::Viewer_interface *viewer)const
+{
+  //vao containing the data for the temp facets
+  {
+    program = item->getShaderProgram(Scene_polyhedron_selection_item::PROGRAM_WITH_LIGHT, viewer);
+    program->bind();
+
+    item->vaos[TempFacets]->bind();
+    item->buffers[VertexTempFacets].bind();
+    item->buffers[VertexTempFacets].allocate(positions_temp_facets.data(),
+                        static_cast<int>(positions_temp_facets.size()*sizeof(float)));
+    program->enableAttributeArray("vertex");
+    program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
+    item->buffers[VertexTempFacets].release();
+
+
+
+    item->buffers[NormalTempFacets].bind();
+    item->buffers[NormalTempFacets].allocate(temp_normals.data(),
+                        static_cast<int>(temp_normals.size()*sizeof(float)));
+    program->enableAttributeArray("normals");
+    program->setAttributeBuffer("normals",GL_FLOAT,0,3);
+    item->buffers[NormalTempFacets].release();
+
+    item->vaos[TempFacets]->release();
+    program->release();
+  }
+  //vao containing the data for the temp lines
+  {
+    program = item->getShaderProgram(Scene_polyhedron_selection_item::PROGRAM_NO_SELECTION, viewer);
+    program->bind();
+    item->vaos[TempEdges]->bind();
+
+    item->buffers[VertexTempEdges].bind();
+    item->buffers[VertexTempEdges].allocate(positions_temp_lines.data(),
+                        static_cast<int>(positions_temp_lines.size()*sizeof(float)));
+    program->enableAttributeArray("vertex");
+    program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
+    item->buffers[VertexTempEdges].release();
+
+    program->release();
+
+    item->vaos[TempEdges]->release();
+
+  }
+  //vaos containing the data for the temp points
+  {
+    program = item->getShaderProgram(Scene_polyhedron_selection_item::PROGRAM_NO_SELECTION, viewer);
+    program->bind();
+    item->vaos[TempPoints]->bind();
+
+    item->buffers[VertexTempPoints].bind();
+    item->buffers[VertexTempPoints].allocate(positions_temp_points.data(),
+                        static_cast<int>(positions_temp_points.size()*sizeof(float)));
+    program->enableAttributeArray("vertex");
+    program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
+    item->buffers[VertexTempPoints].release();
+    item->vaos[TempPoints]->release();
+
+    item->vaos[FixedPoints]->bind();
+
+    item->buffers[VertexFixedPoints].bind();
+    item->buffers[VertexFixedPoints].allocate(positions_fixed_points.data(),
+                        static_cast<int>(positions_fixed_points.size()*sizeof(float)));
+    program->enableAttributeArray("vertex");
+    program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
+    item->buffers[VertexFixedPoints].release();
+    item->buffers[ColorFixedPoints].bind();
+    item->buffers[ColorFixedPoints].allocate(color_fixed_points.data(),
+                        static_cast<int>(color_fixed_points.size()*sizeof(float)));
+    program->enableAttributeArray("colors");
+    program->setAttributeBuffer("colors",GL_FLOAT,0,3);
+    item->buffers[ColorFixedPoints].release();
+    item->vaos[FixedPoints]->release();
+
+    program->release();
+  }
+  nb_temp_facets = positions_temp_facets.size();
+  positions_temp_facets.resize(0);
+  std::vector<float>(positions_temp_facets).swap(positions_temp_facets);
+
+  temp_normals.resize(0);
+  std::vector<float>(temp_normals).swap(temp_normals);
+
+  nb_temp_lines = positions_temp_lines.size();
+  positions_temp_lines.resize(0);
+  std::vector<float>(positions_temp_lines).swap(positions_temp_lines);
+
+  nb_temp_points = positions_temp_points.size();
+  positions_temp_points.resize(0);
+  std::vector<float>(positions_temp_points).swap(positions_temp_points);
+
+  nb_fixed_points = positions_fixed_points.size();
+  positions_fixed_points.resize(0);
+  std::vector<float>(positions_fixed_points).swap(positions_fixed_points);
+  are_temp_buffers_filled = true;
+}
+void Scene_polyhedron_selection_item_priv::initialize_HL_buffers(CGAL::Three::Viewer_interface *viewer)const
+{
+  //vao containing the data for the temp facets
+  {
+    program = item->getShaderProgram(Scene_polyhedron_selection_item::PROGRAM_WITH_LIGHT, viewer);
+    program->bind();
+
+    item->vaos[HLFacets]->bind();
+    item->buffers[VertexHLFacets].bind();
+    item->buffers[VertexHLFacets].allocate(positions_HL_facets.data(),
+                        static_cast<int>(positions_HL_facets.size()*sizeof(float)));
+    program->enableAttributeArray("vertex");
+    program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
+    item->buffers[VertexHLFacets].release();
+
+
+    item->buffers[NormalHLFacets].bind();
+    item->buffers[NormalHLFacets].allocate(HL_normals.data(),
+                        static_cast<int>(HL_normals.size()*sizeof(float)));
+    program->enableAttributeArray("normals");
+    program->setAttributeBuffer("normals",GL_FLOAT,0,3);
+    item->buffers[NormalHLFacets].release();
+
+    item->vaos[HLFacets]->release();
+    program->release();
+
+  }
+  //vao containing the data for the temp lines
+  {
+    program = item->getShaderProgram(Scene_polyhedron_selection_item::PROGRAM_NO_SELECTION, viewer);
+    program->bind();
+    item->vaos[HLEdges]->bind();
+
+    item->buffers[VertexHLEdges].bind();
+    item->buffers[VertexHLEdges].allocate(positions_HL_lines.data(),
+                        static_cast<int>(positions_HL_lines.size()*sizeof(float)));
+    program->enableAttributeArray("vertex");
+    program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
+    item->buffers[VertexHLEdges].release();
+
+    program->release();
+
+    item->vaos[HLEdges]->release();
+
+  }
+  //vao containing the data for the temp points
+  {
+    program = item->getShaderProgram(Scene_polyhedron_selection_item::PROGRAM_NO_SELECTION, viewer);
+    program->bind();
+    item->vaos[HLPoints]->bind();
+
+    item->buffers[VertexHLPoints].bind();
+    item->buffers[VertexHLPoints].allocate(positions_HL_points.data(),
+                        static_cast<int>(positions_HL_points.size()*sizeof(float)));
+    program->enableAttributeArray("vertex");
+    program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
+    item->buffers[VertexHLPoints].release();
+
+    program->release();
+
+    item->vaos[HLPoints]->release();
+  }
+  are_HL_buffers_filled = true;
+}
+template<typename TypeWithXYZ, typename ContainerWithPushBack>
+void push_back_xyz(const TypeWithXYZ& t,
+                   ContainerWithPushBack& vector)
+{
+  vector.push_back(t.x());
+  vector.push_back(t.y());
+  vector.push_back(t.z());
+}
+
+typedef Polyhedron::Traits Traits;
+typedef Polyhedron::Facet Facet;
+//Make sure all the facets are triangles
+typedef Traits::Point_3	            Point;
+typedef Traits::Vector_3	    Vector;
+typedef Polyhedron::Halfedge_handle Halfedge_handle;
+typedef boost::graph_traits<Polyhedron>::face_descriptor   face_descriptor;
+typedef boost::graph_traits<Polyhedron>::vertex_descriptor vertex_descriptor;
+
+
+void
+Scene_polyhedron_selection_item_priv::triangulate_facet(Facet_handle fit,const Vector normal,
+                                                   std::vector<float> &p_facets,std::vector<float> &p_normals ) const
+{
+  typedef FacetTriangulator<Polyhedron, Polyhedron::Traits, boost::graph_traits<Polyhedron>::vertex_descriptor> FT;
+  double diagonal;
+  if(item->poly_item->diagonalBbox() != std::numeric_limits<double>::infinity())
+    diagonal = item->poly_item->diagonalBbox();
+  else
+    diagonal = 0.0;
+  FT triangulation(fit,normal,poly,diagonal);
+    //iterates on the internal faces to add the vertices to the positions
+    //and the normals to the appropriate vectors
+    for(FT::CDT::Finite_faces_iterator
+        ffit = triangulation.cdt->finite_faces_begin(),
+        end = triangulation.cdt->finite_faces_end();
+        ffit != end; ++ffit)
+    {
+        if(ffit->info().is_external)
+            continue;
+
+        push_back_xyz(ffit->vertex(0)->point(), p_facets);
+        push_back_xyz(ffit->vertex(1)->point(), p_facets);
+        push_back_xyz(ffit->vertex(2)->point(), p_facets);
+
+        push_back_xyz(normal, p_normals);
+        push_back_xyz(normal, p_normals);
+        push_back_xyz(normal, p_normals);
+    }
+}
+
+
+void Scene_polyhedron_selection_item_priv::compute_any_elements(std::vector<float>& p_facets, std::vector<float>& p_lines, std::vector<float>& p_points, std::vector<float>& p_normals,
+                                                           const Selection_set_vertex& p_sel_vertices, const Selection_set_facet& p_sel_facets, const Selection_set_edge& p_sel_edges)const
+{
+    p_facets.clear();
+    p_lines.clear();
+    p_points.clear();
+    p_normals.clear();
+    //The facet
+
+    if(!poly)
+      return;
+    for(Selection_set_facet::iterator
+        it = p_sel_facets.begin(),
+        end = p_sel_facets.end();
+        it != end; it++)
+    {
+      Facet_handle f = (*it);
+      if (f == boost::graph_traits<Polyhedron>::null_face())
+        continue;
+      Vector nf = get(nf_pmap, f);
+      if(is_triangle(f->halfedge(),*poly))
+      {
+        p_normals.push_back(nf.x());
+        p_normals.push_back(nf.y());
+        p_normals.push_back(nf.z());
+
+        p_normals.push_back(nf.x());
+        p_normals.push_back(nf.y());
+        p_normals.push_back(nf.z());
+
+        p_normals.push_back(nf.x());
+        p_normals.push_back(nf.y());
+        p_normals.push_back(nf.z());
+
+
+        Polyhedron::Halfedge_around_facet_circulator
+            he = f->facet_begin(),
+            cend = he;
+        CGAL_For_all(he,cend)
+        {
+          const Point& p = he->vertex()->point();
+          p_facets.push_back(p.x());
+          p_facets.push_back(p.y());
+          p_facets.push_back(p.z());
+        }
+      }
+      else if (is_quad(f->halfedge(), *poly))
+      {
+        Vector nf = get(nf_pmap, f);
+        //1st half-quad
+        Point p0 = f->halfedge()->vertex()->point();
+        Point p1 = f->halfedge()->next()->vertex()->point();
+        Point p2 = f->halfedge()->next()->next()->vertex()->point();
+
+        push_back_xyz(p0, p_facets);
+        push_back_xyz(p1, p_facets);
+        push_back_xyz(p2, p_facets);
+
+        push_back_xyz(nf, p_normals);
+        push_back_xyz(nf, p_normals);
+        push_back_xyz(nf, p_normals);
+
+        //2nd half-quad
+        p0 = f->halfedge()->next()->next()->vertex()->point();
+        p1 = f->halfedge()->prev()->vertex()->point();
+        p2 = f->halfedge()->vertex()->point();
+
+        push_back_xyz(p0, p_facets);
+        push_back_xyz(p1, p_facets);
+        push_back_xyz(p2, p_facets);
+
+        push_back_xyz(nf, p_normals);
+        push_back_xyz(nf, p_normals);
+        push_back_xyz(nf, p_normals);
+      }
+      else
+      {
+        triangulate_facet(f, nf, p_facets, p_normals);
+      }
+    }
+
+    //The Lines
+    {
+
+        for(Selection_set_edge::iterator it = p_sel_edges.begin(); it != p_sel_edges.end(); ++it) {
+            const Point& a = (it->halfedge())->vertex()->point();
+            const Point& b = (it->halfedge())->opposite()->vertex()->point();
+            p_lines.push_back(a.x());
+            p_lines.push_back(a.y());
+            p_lines.push_back(a.z());
+
+            p_lines.push_back(b.x());
+            p_lines.push_back(b.y());
+            p_lines.push_back(b.z());
+        }
+
+    }
+    //The points
+    {
+        for(Selection_set_vertex::iterator
+            it = p_sel_vertices.begin(),
+            end = p_sel_vertices.end();
+            it != end; ++it)
+        {
+            const Point& p = (*it)->point();
+            p_points.push_back(p.x());
+            p_points.push_back(p.y());
+            p_points.push_back(p.z());
+        }
+    }
+}
+void Scene_polyhedron_selection_item_priv::computeElements()const
+{
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  compute_any_elements(positions_facets, positions_lines, positions_points, normals,
+                       item->selected_vertices, item->selected_facets, item->selected_edges);
+  QApplication::restoreOverrideCursor();
+}
+void Scene_polyhedron_selection_item_priv::compute_temp_elements()const
+{
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  compute_any_elements(positions_temp_facets, positions_temp_lines, positions_temp_points, temp_normals,
+                       item->temp_selected_vertices, item->temp_selected_facets, item->temp_selected_edges);
+  //The fixed points
+  {
+    color_fixed_points.clear();
+    positions_fixed_points.clear();
+    int i=0;
+    for(Scene_polyhedron_selection_item::Selection_set_vertex::iterator
+        it = item->fixed_vertices.begin(),
+        end = item->fixed_vertices.end();
+        it != end; ++it)
+    {
+      const Point& p = (*it)->point();
+      positions_fixed_points.push_back(p.x());
+      positions_fixed_points.push_back(p.y());
+      positions_fixed_points.push_back(p.z());
+
+      if(*it == constrained_vertices.first()|| *it == constrained_vertices.last())
+      {
+        color_fixed_points.push_back(0.0);
+        color_fixed_points.push_back(0.0);
+        color_fixed_points.push_back(1.0);
+      }
+      else
+      {
+        color_fixed_points.push_back(1.0);
+        color_fixed_points.push_back(0.0);
+        color_fixed_points.push_back(0.0);
+      }
+      i++;
+    }
+  }
+  QApplication::restoreOverrideCursor();
+}
+
+void Scene_polyhedron_selection_item_priv::compute_HL_elements()const
+{
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  compute_any_elements(positions_HL_facets, positions_HL_lines, positions_HL_points, HL_normals,
+                       item->HL_selected_vertices, item->HL_selected_facets, item->HL_selected_edges);
+  QApplication::restoreOverrideCursor();
+}
+
+void Scene_polyhedron_selection_item::draw(CGAL::Three::Viewer_interface* viewer) const
+{
+  GLfloat offset_factor;
+  GLfloat offset_units;
+  if(!d->are_HL_buffers_filled)
+  {
+    d->compute_HL_elements();
+    d->initialize_HL_buffers(viewer);
+  }
+
+  viewer->glGetFloatv(GL_POLYGON_OFFSET_FACTOR, &offset_factor);
+  viewer->glGetFloatv(GL_POLYGON_OFFSET_UNITS, &offset_units);
+  glPolygonOffset(0.5f, 0.9f);
+  vaos[Scene_polyhedron_selection_item_priv::HLFacets]->bind();
+  d->program = getShaderProgram(PROGRAM_WITH_LIGHT);
+  attribBuffers(viewer,PROGRAM_WITH_LIGHT);
+  d->program->bind();
+  d->program->setAttributeValue("colors",QColor(255,153,51));
+  viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(d->positions_HL_facets.size())/3);
+  d->program->release();
+  vaos[Scene_polyhedron_selection_item_priv::HLFacets]->release();
+
+  if(!d->are_temp_buffers_filled)
+  {
+    d->compute_temp_elements();
+    d->initialize_temp_buffers(viewer);
+  }
+  vaos[Scene_polyhedron_selection_item_priv::TempFacets]->bind();
+  d->program = getShaderProgram(PROGRAM_WITH_LIGHT);
+  attribBuffers(viewer,PROGRAM_WITH_LIGHT);
+  d->program->bind();
+  d->program->setAttributeValue("colors",QColor(0,255,0));
+  viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(d->nb_temp_facets/3));
+  d->program->release();
+  vaos[Scene_polyhedron_selection_item_priv::TempFacets]->release();
+  if(!are_buffers_filled)
+  {
+    d->computeElements();
+    d->initializeBuffers(viewer);
+  }
+
+  vaos[Scene_polyhedron_selection_item_priv::TempFacets]->bind();
+  d->program = getShaderProgram(PROGRAM_WITH_LIGHT);
+  attribBuffers(viewer,PROGRAM_WITH_LIGHT);
+
+  d->program->bind();
+  d->program->setAttributeValue("colors",QColor(0,255,0));
+  viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(d->nb_temp_facets/3));
+  d->program->release();
+  vaos[Scene_polyhedron_selection_item_priv::TempFacets]->release();
+
+  if(!are_buffers_filled)
+  {
+    d->computeElements();
+    d->initializeBuffers(viewer);
+  }
+  vaos[Scene_polyhedron_selection_item_priv::Facets]->bind();
+  d->program = getShaderProgram(PROGRAM_WITH_LIGHT);
+  attribBuffers(viewer,PROGRAM_WITH_LIGHT);
+  d->program->bind();
+  d->program->setAttributeValue("colors",this->color());
+  viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(d->nb_facets/3));
+  d->program->release();
+  vaos[Scene_polyhedron_selection_item_priv::Facets]->release();
+
+  glEnable(GL_POLYGON_OFFSET_LINE);
+  viewer->glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
+  glPolygonOffset(0.0f, 1.5f);
+  drawEdges(viewer);
+  glDisable(GL_POLYGON_OFFSET_LINE);
+  viewer->glPolygonMode(GL_FRONT_AND_BACK,GL_POINT);
+  glPolygonOffset(offset_factor, offset_units);
+  drawPoints(viewer);
+  viewer->glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
+}
+
+void Scene_polyhedron_selection_item::drawEdges(CGAL::Three::Viewer_interface* viewer) const
+{
+
+  viewer->glLineWidth(3.f);
+
+  if(!d->are_HL_buffers_filled)
+  {
+    d->compute_HL_elements();
+    d->initialize_HL_buffers(viewer);
+  }
+
+  vaos[Scene_polyhedron_selection_item_priv::HLEdges]->bind();
+  d->program = getShaderProgram(PROGRAM_NO_SELECTION);
+  attribBuffers(viewer,PROGRAM_NO_SELECTION);
+  d->program->bind();
+
+  d->program->setAttributeValue("colors",QColor(255,153,51));
+  viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(d->positions_HL_lines.size()/3));
+  d->program->release();
+  vaos[Scene_polyhedron_selection_item_priv::HLEdges]->release();
+
+  if(!d->are_temp_buffers_filled)
+  {
+    d->compute_temp_elements();
+    d->initialize_temp_buffers(viewer);
+  }
+
+  vaos[Scene_polyhedron_selection_item_priv::TempEdges]->bind();
+  d->program = getShaderProgram(PROGRAM_NO_SELECTION);
+  attribBuffers(viewer,PROGRAM_NO_SELECTION);
+  d->program->bind();
+
+  d->program->setAttributeValue("colors",QColor(0,200,0));
+  viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(d->nb_temp_lines/3));
+  d->program->release();
+  vaos[Scene_polyhedron_selection_item_priv::TempEdges]->release();
+  viewer->glLineWidth(3.0f);
+  if(!are_buffers_filled)
+  {
+    d->computeElements();
+    d->initializeBuffers(viewer);
+  }
+
+  vaos[Scene_polyhedron_selection_item_priv::Edges]->bind();
+  d->program = getShaderProgram(PROGRAM_NO_SELECTION);
+  attribBuffers(viewer,PROGRAM_NO_SELECTION);
+  d->program->bind();
+
+  d->program->setAttributeValue("colors",edge_color);
+  viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(d->nb_lines/3));
+  d->program->release();
+  vaos[Scene_polyhedron_selection_item_priv::Edges]->release();
+
+
+  viewer->glLineWidth(1.f);
+}
+
+void Scene_polyhedron_selection_item::drawPoints(CGAL::Three::Viewer_interface* viewer) const
+{
+  viewer->glPointSize(5.5f);
+
+  if(!d->are_HL_buffers_filled)
+  {
+    d->compute_HL_elements();
+    d->initialize_HL_buffers(viewer);
+  }
+  vaos[Scene_polyhedron_selection_item_priv::HLPoints]->bind();
+  d->program = getShaderProgram(PROGRAM_NO_SELECTION);
+  attribBuffers(viewer,PROGRAM_NO_SELECTION);
+  d->program->bind();
+  d->program->setAttributeValue("colors",QColor(255,153,51));
+  viewer->glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(d->positions_HL_points.size()/3));
+  d->program->release();
+  vaos[Scene_polyhedron_selection_item_priv::HLPoints]->release();
+
+  if(!d->are_temp_buffers_filled)
+  {
+    d->compute_temp_elements();
+    d->initialize_temp_buffers(viewer);
+  }
+  viewer->glPointSize(5.5f);
+
+  vaos[Scene_polyhedron_selection_item_priv::TempPoints]->bind();
+  d->program = getShaderProgram(PROGRAM_NO_SELECTION);
+  attribBuffers(viewer,PROGRAM_NO_SELECTION);
+  d->program->bind();
+  d->program->setAttributeValue("colors",QColor(0,50,0));
+  viewer->glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(d->nb_temp_points/3));
+  vaos[Scene_polyhedron_selection_item_priv::TempPoints]->release();
+  vaos[Scene_polyhedron_selection_item_priv::FixedPoints]->bind();
+  viewer->glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(d->nb_fixed_points/3));
+  d->program->release();
+  vaos[Scene_polyhedron_selection_item_priv::FixedPoints]->release();
+  if(!are_buffers_filled)
+  {
+    d->computeElements();
+    d->initializeBuffers(viewer);
+  }
+  vaos[Scene_polyhedron_selection_item_priv::Points]->bind();
+  d->program = getShaderProgram(PROGRAM_NO_SELECTION);
+  attribBuffers(viewer,PROGRAM_NO_SELECTION);
+  d->program->bind();
+  d->program->setAttributeValue("colors",vertex_color);
+  viewer->glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(d->nb_points/3));
+  d->program->release();
+  vaos[Points]->release();
+
+  viewer->glPointSize(1.f);
+}
+
+
+void Scene_polyhedron_selection_item::inverse_selection()
+{
+  switch(k_ring_selector.active_handle_type)
+  {
+  case Active_handle::VERTEX:
+  {
+    Selection_set_vertex temp_select = selected_vertices;
+    select_all();
+    Q_FOREACH(Vertex_handle vh, temp_select)
+    {
+      selected_vertices.erase(vh);
+    }
+    break;
+  }
+  case Active_handle::EDGE:
+  {
+    Selection_set_edge temp_select = selected_edges;
+    select_all();
+    Q_FOREACH(edge_descriptor ed , temp_select)
+      selected_edges.erase(ed);
+    break;
+  }
+  default:
+  {
+    Selection_set_facet temp_select = selected_facets;
+    select_all();
+    Q_FOREACH(Facet_handle fh, temp_select)
+      selected_facets.erase(fh);
+    break;
+  }
+  }
+  invalidateOpenGLBuffers();
+  QGLViewer* v = *QGLViewer::QGLViewerPool().begin();
+  v->update();
+}
+
+void Scene_polyhedron_selection_item::set_operation_mode(int mode)
+{
+  k_ring_selector.setEditMode(true);
+  Q_EMIT updateInstructions(QString("SHIFT + left click to apply operation."));
+  switch(mode)
+  {
+  case -2:
+    set_active_handle_type(d->original_sel_mode);
+    Q_EMIT updateInstructions("Select two vertices to create the path between them. (1/2)");
+    break;
+  case -1:
+    //restore original selection_type
+    set_active_handle_type(d->original_sel_mode);
+    clearHL();
+    k_ring_selector.setEditMode(false);
+    break;
+    //Join vertex
+  case 0:
+    Q_EMIT updateInstructions("Select the edge with extremities you want to join.");
+    //set the selection type to Edge
+    set_active_handle_type(static_cast<Active_handle::Type>(2));
+    break;
+    //Split vertex
+  case 1:
+    Q_EMIT updateInstructions("Select the vertex you want to split. (1/3)");
+    //set the selection type to Vertex
+    set_active_handle_type(static_cast<Active_handle::Type>(0));
+    break;
+    //Split edge
+  case 2:
+    Q_EMIT updateInstructions("Select the edge you want to split.");
+    //set the selection type to Edge
+    set_active_handle_type(static_cast<Active_handle::Type>(2));
+    break;
+    //Join face
+  case 3:
+    Q_EMIT updateInstructions("Select the edge separating the faces you want to join.");
+    //set the selection type to Edge
+    set_active_handle_type(static_cast<Active_handle::Type>(2));
+    break;
+    //Split face
+  case 4:
+    Q_EMIT updateInstructions("Select the facet you want to split (degree >= 4). (1/3)");
+    //set the selection type to Facet
+    set_active_handle_type(static_cast<Active_handle::Type>(1));
+    break;
+    //Collapse edge
+  case 5:
+    Q_EMIT updateInstructions("Select the edge you want to collapse.");
+    //set the selection type to Edge
+    set_active_handle_type(static_cast<Active_handle::Type>(2));
+    break;
+    //Flip edge
+  case 6:
+    Q_EMIT updateInstructions("Select the edge you want to flip.");
+    //set the selection type to Edge
+    set_active_handle_type(static_cast<Active_handle::Type>(2));
+    break;
+    //Add center vertex
+  case 7:
+    Q_EMIT updateInstructions("Select a facet.");
+    //set the selection type to Facet
+    set_active_handle_type(static_cast<Active_handle::Type>(1));
+    break;
+    //Remove center vertex
+  case 8:
+    Q_EMIT updateInstructions("Select the vertex you want to remove.");
+    //set the selection type to vertex
+    set_active_handle_type(static_cast<Active_handle::Type>(0));
+    break;
+    //Add vertex and face to border
+  case 9:
+    Q_EMIT updateInstructions("Select a border edge. (1/2)");
+    //set the selection type to Edge
+    set_active_handle_type(static_cast<Active_handle::Type>(2));
+    break;
+    //Add face to border
+  case 10:
+    Q_EMIT updateInstructions("Select a border edge. (1/2)");
+    //set the selection type to Edge
+    set_active_handle_type(static_cast<Active_handle::Type>(2));
+    break;
+  case 11:
+    Q_EMIT updateInstructions("Select a vertex. (1/2)");
+    //set the selection type to Edge
+    set_active_handle_type(static_cast<Active_handle::Type>(0));
+    break;
+  default:
+    break;
+  }
+  d->operation_mode = mode;
+}
+template<typename HandleRange>
+bool Scene_polyhedron_selection_item::treat_classic_selection(const HandleRange& selection)
+{
+  typedef typename HandleRange::value_type HandleType;
+  Selection_traits<HandleType, Scene_polyhedron_selection_item> tr(this);
+  bool any_change = false;
+  if(is_insert) {
+    BOOST_FOREACH(HandleType h, selection)
+        any_change |= tr.container().insert(h).second;
+  }
+  else{
+    BOOST_FOREACH(HandleType h, selection)
+        any_change |= (tr.container().erase(h)!=0);
+  }
+  if(any_change) { invalidateOpenGLBuffers(); Q_EMIT itemChanged(); }
+  return any_change;
+}
+
+bool Scene_polyhedron_selection_item::treat_selection(const std::set<Polyhedron::Vertex_handle>& selection)
+{
+  if(!d->is_treated)
+  {
+    Vertex_handle vh = *selection.begin();
+    Selection_traits<Vertex_handle, Scene_polyhedron_selection_item> tr(this);
+    switch(d->operation_mode)
+    {
+    //classic selection
+    case -2:
+    case -1:
+    {
+      if(!d->is_path_selecting)
+      {
+        return treat_classic_selection(selection);
+      }
+      else
+      {
+        if(is_insert)
+        {
+          selectPath(*selection.begin());
+          invalidateOpenGLBuffers();
+          Q_EMIT itemChanged();
+        }
+      }
+      return false;
+      break;
+    }
+      //Split vertex
+    case 1:
+    {
+      //save VH
+      d->to_split_vh = vh;
+      temp_selected_vertices.insert(d->to_split_vh);
+      //set to select facet
+      set_active_handle_type(static_cast<Active_handle::Type>(1));
+      invalidateOpenGLBuffers();
+      Q_EMIT updateInstructions("Select first facet. (2/3)");
+      break;
+    }
+      //Split face
+    case 4:
+    {
+      static Vertex_handle s;
+      static Polyhedron::Halfedge_handle h1,h2;
+      static bool found_h1(false), found_h2(false);
+      if(!d->first_selected)
+      {
+          //Is the vertex on the face ?
+          Polyhedron::Halfedge_around_facet_circulator hafc = d->to_split_fh->facet_begin();
+          Polyhedron::Halfedge_around_facet_circulator end = hafc;
+          CGAL_For_all(hafc, end)
+          {
+            if(hafc->vertex()==vh)
+            {
+              h1 = hafc;
+              s = vh;
+              found_h1 = true;
+                break;
+            }
+          }
+          if(!found_h1)
+          {
+            d->tempInstructions("Vertex not selected : The vertex is not on the face.",
+                             "Select the first vertex. (2/3)");
+          }
+          else
+          {
+            d->first_selected = true;
+            temp_selected_vertices.insert(s);
+            invalidateOpenGLBuffers();
+            Q_EMIT updateInstructions("Select the second vertex (3/3)");
+          }
+      }
+      else
+      {
+        bool is_same(false), are_next(false);
+        Polyhedron::Halfedge_around_facet_circulator hafc = d->to_split_fh->facet_begin();
+        Polyhedron::Halfedge_around_facet_circulator end = hafc;
+        for(int i=0; i<1; i++) //seems useless but allow the use of break.
+        {
+          //Is the vertex on the face ?
+          CGAL_For_all(hafc, end)
+
+              if(hafc->vertex()==vh)
+          {
+            h2 = hafc;
+            found_h2 = true;
+            break;
+          }
+          if(!found_h2)
+          {
+            break;
+          }
+          //Are they different ?
+          if(h1 == h2)
+          {
+            is_same = true;
+            break;
+          }
+          is_same = false;
+          //Are they directly following each other?
+          if(next(h1, *polyhedron()) == h2 ||
+             next(h2, *polyhedron()) == h1)
+          {
+            are_next = true;
+            break;
+          }
+          are_next = false;
+        }
+        if(!found_h2)
+          d->tempInstructions("Vertex not selected : The vertex is not on the face.",
+                           "Select the second vertex (3/3).");
+        else if(is_same)
+          d->tempInstructions("Vertex not selected : The vertices must be different.",
+                           "Select the second vertex (3/3).");
+        else if(are_next)
+          d->tempInstructions("Vertex not selected : The vertices must not directly follow each other.",
+                           "Select the second vertex (3/3).");
+        else
+        {
+          CGAL::Euler::split_face(h1,h2, *polyhedron());
+          d->first_selected = false;
+          temp_selected_vertices.clear();
+          temp_selected_facets.clear();
+          compute_normal_maps();
+          invalidateOpenGLBuffers();
+          //reset selection type to Facet
+          set_active_handle_type(static_cast<Active_handle::Type>(1));
+          d->tempInstructions("Face split.",
+                           "Select a facet (1/3).");
+          polyhedron_item()->invalidateOpenGLBuffers();
+        }
+      }
+      break;
+    }
+      //Remove center vertex
+    case 8:
+    {
+      bool has_hole = false;
+      Polyhedron::Halfedge_around_vertex_circulator hc = vh->vertex_begin();
+      Polyhedron::Halfedge_around_vertex_circulator end(hc);
+      CGAL_For_all(hc, end)
+      {
+        if(hc->is_border())
+        {
+          has_hole = true;
+          break;
+        }
+      }
+      if(!has_hole)
+      {
+        CGAL::Euler::remove_center_vertex(vh->halfedge(),*polyhedron());
+        compute_normal_maps();
+        polyhedron_item()->invalidateOpenGLBuffers();
+      }
+      else
+      {
+        d->tempInstructions("Vertex not selected : There must be no hole incident to the selection.",
+                         "Select the vertex you want to remove.");
+      }
+      break;
+    }
+    case 11:
+      QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
+      if(viewer->manipulatedFrame() != d->manipulated_frame)
+      {
+        temp_selected_vertices.insert(vh);
+        k_ring_selector.setEditMode(false);
+        d->manipulated_frame->setPosition(vh->point().x(), vh->point().y(), vh->point().z());
+        viewer->setManipulatedFrame(d->manipulated_frame);
+        connect(d->manipulated_frame, SIGNAL(modified()), this, SLOT(updateTick()));
+        invalidateOpenGLBuffers();
+        Q_EMIT updateInstructions("Ctrl+Right-click to move the point. \nHit Ctrl+Z to leave the selection. (2/2)");
+      }
+      else
+      {
+        temp_selected_vertices.clear();
+        temp_selected_vertices.insert(vh);
+        d->manipulated_frame->setPosition(vh->point().x(), vh->point().y(), vh->point().z());
+        invalidateOpenGLBuffers();
+      }
+      break;
+    }
+  }
+  d->is_treated = true;
+  //Keeps the item from trying to draw primitive that has just been deleted.
+  clearHL();
+  return false;
+}
+
+//returns true if halfedge's facet's degree >= degree
+
+std::size_t facet_degree(Halfedge_handle h)
+{
+  if(h->is_border())
+  {
+    Halfedge_handle it = h;
+    int deg =0;
+    do
+    {
+      deg ++;
+      it=it->next();
+    }
+    while(it != h);
+    return deg;
+  }
+  else
+    return h->facet()->facet_degree();
+}
+
+bool Scene_polyhedron_selection_item:: treat_selection(const std::set<edge_descriptor>& selection)
+{
+
+  edge_descriptor ed =  *selection.begin();
+  if(!d->is_treated)
+  {
+    Selection_traits<edge_descriptor, Scene_polyhedron_selection_item> tr(this);
+    switch(d->operation_mode)
+    {
+    //classic selection
+    case -1:
+    {
+      return treat_classic_selection(selection);
+      break;
+    }
+      //Join vertex
+    case 0:
+        if(facet_degree(halfedge(ed, *polyhedron())) < 4
+           ||
+           facet_degree(halfedge(ed, *polyhedron())->opposite())< 4)
+        {
+          d->tempInstructions("Edge not selected: the incident facets must have a degree of at least 4.",
+                           "Select the edge with extremities you want to join.");
+        }
+        else
+        {
+          Halfedge_handle targt = halfedge(ed, *polyhedron());
+          Point S,T;
+          S = source(targt, *polyhedron())->point();
+          T = target(targt, *polyhedron())->point();
+          polyhedron()->join_vertex(targt)->vertex()->point() = Point(0.5*(S.x()+T.x()), 0.5*(S.y()+T.y()), 0.5*(S.z()+T.z()));
+          d->tempInstructions("Vertices joined.",
+                           "Select the edge with extremities you want to join.");
+          compute_normal_maps();
+          invalidateOpenGLBuffers();
+          polyhedron_item()->invalidateOpenGLBuffers();
+        }
+      break;
+      //Split edge
+    case 2:
+    {
+        Polyhedron::Point_3 a(halfedge(ed, *polyhedron())->vertex()->point()),b(halfedge(ed, *polyhedron())->opposite()->vertex()->point());
+        Polyhedron::Halfedge_handle hhandle = polyhedron()->split_edge(halfedge(ed, *polyhedron()));
+        Polyhedron::Point_3 p((b.x()+a.x())/2.0, (b.y()+a.y())/2.0,(b.z()+a.z())/2.0);
+
+        hhandle->vertex()->point() = p;
+        invalidateOpenGLBuffers();
+        poly_item->invalidateOpenGLBuffers();
+        compute_normal_maps();
+        d->tempInstructions("Edge splitted.",
+                            "Select the edge you want to split.");
+        break;
+    }
+      //Join face
+    case 3:
+        if(out_degree(source(halfedge(ed,*polyhedron()),*polyhedron()),*polyhedron())<3 ||
+           out_degree(target(halfedge(ed,*polyhedron()),*polyhedron()),*polyhedron())<3)
+          d->tempInstructions("Faces not joined : the two ends of the edge must have a degree of at least 3.",
+                           "Select the edge separating the faces you want to join.");
+        else
+        {
+          polyhedron()->join_facet(halfedge(ed, *polyhedron()));
+          compute_normal_maps();
+          poly_item->invalidateOpenGLBuffers();
+        }
+      break;
+      //Collapse edge
+    case 5:
+        if(!is_triangle_mesh(*polyhedron()))
+        {
+          d->tempInstructions("Edge not collapsed : the graph must be triangulated.",
+                           "Select the edge you want to collapse.");
+        }
+        else if(!CGAL::Euler::does_satisfy_link_condition(ed, *polyhedron()))
+        {
+          d->tempInstructions("Edge not collapsed : link condition not satidfied.",
+                           "Select the edge you want to collapse.");
+        }
+        else
+        {
+          Halfedge_handle targt = halfedge(ed, *polyhedron());
+          Point S,T;
+          S = source(targt, *polyhedron())->point();
+          T = target(targt, *polyhedron())->point();
+
+          CGAL::Euler::collapse_edge(ed, *polyhedron())->point() = Point(0.5*(S.x()+T.x()), 0.5*(S.y()+T.y()), 0.5*(S.z()+T.z()));
+          compute_normal_maps();
+          polyhedron_item()->invalidateOpenGLBuffers();
+
+          d->tempInstructions("Edge collapsed.",
+                           "Select the edge you want to collapse.");
+        }
+      break;
+      //Flip edge
+    case 6:
+
+        //check preconditions
+        if(facet_degree(halfedge(ed, *polyhedron())) == 3 && facet_degree(halfedge(ed, *polyhedron())->opposite()) == 3)
+        {
+          CGAL::Euler::flip_edge(halfedge(ed, *polyhedron()), *polyhedron());
+          polyhedron_item()->invalidateOpenGLBuffers();
+          compute_normal_maps();
+        }
+        else
+        {
+          d->tempInstructions("Edge not selected : incident facets must be triangles.",
+                           "Select the edge you want to flip.");
+        }
+
+      break;
+      //Add vertex and face to border
+    case 9:
+    {
+      static Halfedge_handle t;
+      if(!d->first_selected)
+      {
+          bool found = false;
+          Halfedge_handle hc = halfedge(ed, *polyhedron());
+          if(hc->is_border())
+          {
+            t = hc;
+            found = true;
+          }
+          else if(hc->opposite()->is_border())
+          {
+            t = hc->opposite();
+            found = true;
+          }
+          if(found)
+          {
+            d->first_selected = true;
+            temp_selected_edges.insert(edge(t, *polyhedron()));
+            temp_selected_vertices.insert(t->vertex());
+            invalidateOpenGLBuffers();
+            Q_EMIT updateInstructions("Select second edge. (2/2)");
+          }
+          else
+          {
+            d->tempInstructions("Edge not selected : no border found.",
+                             "Select a border edge. (1/2)");
+          }
+      }
+      else
+      {
+        Halfedge_handle hc = halfedge(ed, *polyhedron());
+        if(d->canAddFaceAndVertex(hc, t))
+        {
+          d->first_selected = false;
+
+
+          temp_selected_edges.clear();
+          temp_selected_vertices.clear();
+          compute_normal_maps();
+          invalidateOpenGLBuffers();
+          polyhedron_item()->invalidateOpenGLBuffers();
+          d->tempInstructions("Face and vertex added.",
+                           "Select a border edge. (1/2)");
+        }
+      }
+      break;
+    }
+      //Add face to border
+    case 10:
+    {
+      static Halfedge_handle t;
+      if(!d->first_selected)
+      {
+          bool found = false;
+          Halfedge_handle hc = halfedge(ed, *polyhedron());
+          if(hc->is_border())
+          {
+            t = hc;
+            found = true;
+          }
+          else if(hc->opposite()->is_border())
+          {
+            t = hc->opposite();
+            found = true;
+          }
+          if(found)
+          {
+            d->first_selected = true;
+            temp_selected_edges.insert(edge(t, *polyhedron()));
+            temp_selected_vertices.insert(t->vertex());
+            invalidateOpenGLBuffers();
+            Q_EMIT updateInstructions("Select second edge. (2/2)");
+            set_active_handle_type(static_cast<Active_handle::Type>(2));
+          }
+          else
+          {
+            d->tempInstructions("Edge not selected : no border found.",
+                             "Select a border edge. (1/2)");
+          }
+      }
+      else
+      {
+        Halfedge_handle hc = halfedge(ed, *polyhedron());
+        if(d->canAddFace(hc, t))
+        {
+          d->first_selected = false;
+          temp_selected_vertices.clear();
+          temp_selected_edges.clear();
+          compute_normal_maps();
+          invalidateOpenGLBuffers();
+          polyhedron_item()->invalidateOpenGLBuffers();
+          d->tempInstructions("Face added.",
+                           "Select a border edge. (1/2)");
+        }
+      }
+      break;
+    }
+    }
+  }
+  d->is_treated = true;
+  //Keeps the item from trying to draw primitive that has just been deleted.
+  clearHL();
+  return false;
+}
+
+bool Scene_polyhedron_selection_item::treat_selection(const std::vector<Polyhedron::Facet_handle>& selection)
+{
+  return treat_classic_selection(selection);
+}
+
+bool Scene_polyhedron_selection_item::treat_selection(const std::set<Polyhedron::Facet_handle>& selection)
+{
+  if(!d->is_treated)
+  {
+    Facet_handle fh = *selection.begin();
+    Selection_traits<Facet_handle, Scene_polyhedron_selection_item> tr(this);
+    switch(d->operation_mode)
+    {
+    //classic selection
+    case -1:
+    {
+      return treat_classic_selection(selection);
+      break;
+    }
+    //Split vertex
+    case 1:
+    {
+      static Polyhedron::Halfedge_handle h1;
+      //stores first fh and emit change label
+      if(!d->first_selected)
+      {
+          bool found = false;
+          //test preco
+          Polyhedron::Halfedge_around_facet_circulator hafc = fh->facet_begin();
+          Polyhedron::Halfedge_around_facet_circulator end = hafc;
+          CGAL_For_all(hafc, end)
+          {
+            if(hafc->vertex()==d->to_split_vh)
+            {
+              h1 = hafc;
+              found = true;
+              break;
+            }
+          }
+          if(found)
+          {
+            d->first_selected = true;
+            temp_selected_facets.insert(fh);
+            invalidateOpenGLBuffers();
+            Q_EMIT updateInstructions("Select the second facet. (3/3)");
+          }
+          else
+            d->tempInstructions("Facet not selected : no valid halfedge",
+                             "Select first facet. (2/3)");
+      }
+      //call the function with point and facets.
+      else
+      {
+          //get the right halfedges
+          Polyhedron::Halfedge_handle h2;
+          bool found = false;
+          Polyhedron::Halfedge_around_facet_circulator hafc = fh->facet_begin();
+          Polyhedron::Halfedge_around_facet_circulator end = hafc;
+          CGAL_For_all(hafc, end)
+          {
+            if(hafc->vertex()==d->to_split_vh)
+            {
+              h2 = hafc;
+              found = true;
+              break;
+            }
+          }
+
+          if(found &&(h1 != h2))
+          {
+            Polyhedron::Halfedge_handle hhandle = CGAL::Euler::split_vertex(h1,h2,*polyhedron());
+
+            temp_selected_facets.clear();
+            Polyhedron::Point_3 p1t = h1->vertex()->point();
+            Polyhedron::Point_3 p1s = h1->opposite()->vertex()->point();
+            double x =  p1t.x() + 0.01 * (p1s.x() - p1t.x());
+            double y =  p1t.y() + 0.01 * (p1s.y() - p1t.y());
+            double z =  p1t.z() + 0.01 * (p1s.z() - p1t.z());
+            hhandle->opposite()->vertex()->point() = Polyhedron::Point_3(x,y,z);;
+            d->first_selected = false;
+            temp_selected_vertices.clear();
+            compute_normal_maps();
+            invalidateOpenGLBuffers();
+            //reset selection mode
+            set_active_handle_type(static_cast<Active_handle::Type>(0));
+            poly_item->invalidateOpenGLBuffers();
+            d->tempInstructions("Vertex splitted.", "Select the vertex you want splitted. (1/3)");
+          }
+          else if(h1 == h2)
+          {
+             d->tempInstructions("Facet not selected : same as the first.", "Select the second facet. (3/3)");
+          }
+          else
+          {
+            d->tempInstructions("Facet not selected : no valid halfedge.", "Select the second facet. (3/3)");
+          }
+      }
+      break;
+    }
+      //Split face
+    case 4:
+      if(is_triangle(fh->halfedge(), *d->poly))
+      {
+        d->tempInstructions("Facet not selected : Facet must not be a triangle.",
+                         "Select the facet you want to split (degree >= 4). (1/3)");
+      }
+      else
+      {
+        d->to_split_fh = fh;
+        temp_selected_facets.insert(d->to_split_fh);
+        compute_normal_maps();
+        invalidateOpenGLBuffers();
+        //set to select vertex
+        set_active_handle_type(static_cast<Active_handle::Type>(0));
+        Q_EMIT updateInstructions("Select first vertex. (2/3)");
+      }
+      break;
+      //Add center vertex
+    case 7:
+        if(fh->halfedge()->is_border())
+        {
+          d->tempInstructions("Facet not selected : Facet must not be null.",
+                           "Select a Facet. (1/3)");
+        }
+        else
+        {
+          Polyhedron::Halfedge_around_facet_circulator hafc = fh->facet_begin();
+          Polyhedron::Halfedge_around_facet_circulator end = hafc;
+
+          double x(0), y(0), z(0);
+          int total(0);
+          CGAL_For_all(hafc, end)
+          {
+            x+=hafc->vertex()->point().x(); y+=hafc->vertex()->point().y(); z+=hafc->vertex()->point().z();
+            total++;
+          }
+          Polyhedron::Halfedge_handle hhandle = CGAL::Euler::add_center_vertex(fh->facet_begin(), *polyhedron());
+          if(total !=0)
+            hhandle->vertex()->point() = Polyhedron::Point_3(x/(double)total, y/(double)total, z/(double)total);
+          compute_normal_maps();
+          poly_item->invalidateOpenGLBuffers();
+
+        }
+      break;
+    }
+  }
+  d->is_treated = true;
+  //Keeps the item from trying to draw primitive that has just been deleted.
+  clearHL();
+  return false;
+}
+
+void Scene_polyhedron_selection_item_priv::tempInstructions(QString s1, QString s2)
+{
+  m_temp_instructs = s2;
+  Q_EMIT item->updateInstructions(QString("<font color='red'>%1</font>").arg(s1));
+  QTimer timer;
+  timer.singleShot(5500, item, SLOT(emitTempInstruct()));
+}
+void Scene_polyhedron_selection_item::emitTempInstruct()
+{
+  Q_EMIT updateInstructions(QString("<font color='black'>%1</font>").arg(d->m_temp_instructs));
+}
+
+
+typedef boost::graph_traits<Polyhedron>::edge_descriptor Polyhedron_edge_descriptor;
+
+struct Edge_length
+{
+  typedef double value_type;
+  typedef double reference;
+  typedef Polyhedron_edge_descriptor key_type;
+  typedef boost::readable_property_map_tag category;
+  Polyhedron& p;
+
+  Edge_length(Polyhedron& p)
+    : p(p)
+  {}
+
+  friend
+  double get (const Edge_length el, Polyhedron_edge_descriptor e)
+  {
+    return sqrt(squared_distance(source(e,el.p)->point(),
+                                 target(e,el.p)->point()));
+  }
+};
+
+void Scene_polyhedron_selection_item_priv::computeAndDisplayPath()
+{
+  item->temp_selected_edges.clear();
+  path.clear();
+  Edge_length el(*item->polyhedron());
+  std::map<vertex_descriptor,vertex_descriptor> pred;
+  boost::associative_property_map< std::map<vertex_descriptor,vertex_descriptor> >
+      pred_map(pred);
+
+  vertex_on_path vop;
+  QList<Vertex_handle>::iterator it;
+  for(it = constrained_vertices.begin(); it!=constrained_vertices.end()-1; ++it)
+  {
+    Vertex_handle t(*it), s(*(it+1));
+    boost::dijkstra_shortest_paths(*item->polyhedron(), s, boost::predecessor_map(pred_map).weight_map(el));
+    do
+    {
+      vop.vertex = t;
+      if(constrained_vertices.contains(t))
+      {
+        vop.is_constrained = true;
+      }
+      else
+        vop.is_constrained = false;
+      path.append(vop);
+      t = pred[t];
+    }
+    while(t != s);
+  }
+    //add the last vertex
+    vop.vertex = constrained_vertices.last();
+    vop.is_constrained = true;
+    path.append(vop);
+  //display path
+  QList<vertex_on_path>::iterator path_it;
+  for(path_it = path.begin(); path_it!=path.end()-1; ++path_it)
+  {
+    std::pair<Halfedge_handle, bool> h = halfedge((path_it+1)->vertex,path_it->vertex,*item->polyhedron());
+    if(h.second)
+      item->temp_selected_edges.insert(edge(h.first, *item->polyhedron()));
+  }
+}
+
+void Scene_polyhedron_selection_item_priv::addVertexToPath(Vertex_handle vh, vertex_on_path &first)
+{
+  vertex_on_path source;
+  source.vertex = vh;
+  source.is_constrained = true;
+  path.append(source);
+  first = source;
+}
+void Scene_polyhedron_selection_item::selectPath(Vertex_handle vh)
+{
+
+  bool replace = !temp_selected_edges.empty();
+  static Scene_polyhedron_selection_item_priv::vertex_on_path first;
+  if(!d->first_selected)
+  {
+    //if the path doesnt exist, add the vertex as the source of the path.
+    if(!replace)
+    {
+      d->addVertexToPath(vh, first);
+    }
+    //if the path exists, get the vertex_on_path corresponding to the selected vertex.
+    else
+    {
+      //The first vertex of the path can not be moved, but you can close your path on it to make a loop.
+      bool alone = true;
+      QList<Scene_polyhedron_selection_item_priv::vertex_on_path>::iterator it;
+      for(it = d->path.begin(); it!=d->path.end(); ++it)
+      {
+        if(it->vertex == vh&& it!=d->path.begin())
+          alone = false;
+      }
+      if(d->path.begin()->vertex == vh )
+        if(alone)
+        {
+          d->constrained_vertices.append(vh); //if the path loops, the indexOf may be invalid, hence the check.
+          //Display the new path
+          d->computeAndDisplayPath();
+          d->first_selected = false;
+          d->constrained_vertices.clear();
+          fixed_vertices.clear();
+          for(it = d->path.begin(); it!=d->path.end(); ++it)
+          {
+            if(it->is_constrained )
+            {
+              d->constrained_vertices.append(it->vertex);
+              fixed_vertices.insert(it->vertex);
+            }
+          }
+
+          return;
+        }
+      bool found = false;
+      Q_FOREACH(Scene_polyhedron_selection_item_priv::vertex_on_path vop, d->path)
+      {
+        if(vop.vertex == vh)
+        {
+          first = vop;
+          found = true;
+          break;
+        }
+      }
+      if(!found)//add new end_point;
+      {
+        d->constrained_vertices.append(vh);
+        //Display the new path
+        d->computeAndDisplayPath();
+        d->first_selected = false;
+        d->constrained_vertices.clear();
+        fixed_vertices.clear();
+        for(it = d->path.begin(); it!=d->path.end(); ++it)
+        {
+          if(it->is_constrained )
+          {
+            d->constrained_vertices.append(it->vertex);
+            fixed_vertices.insert(it->vertex);
+          }
+        }
+
+        return;
+      }
+    }
+    temp_selected_vertices.insert(vh);
+    d->first_selected = true;
+  }
+  else
+  {
+    if(!replace)
+    {
+      d->constrained_vertices.append(vh);
+      temp_selected_vertices.erase(first.vertex);
+
+      updateInstructions("You can select a vertex on the green path to move it. "
+                         "If you do so, it will become a red fixed point. "
+                         "The path will be recomputed to go through that point. "
+                         "Click on 'Add to selection' to validate the selection.   (2/2)");
+    }
+    else
+    {
+      bool is_same(false), alone(true);
+      if( (vh == d->constrained_vertices.first() && first.vertex == d->constrained_vertices.last())
+          || (vh == d->constrained_vertices.last() && first.vertex == d->constrained_vertices.first()))
+
+      {
+        is_same = true;
+      }
+      if(first.vertex == d->path.begin()->vertex)
+        alone =false;
+      bool is_last = true;
+      //find the previous constrained vertex on path
+      Scene_polyhedron_selection_item_priv::vertex_on_path closest = d->path.last();
+      QList<Scene_polyhedron_selection_item_priv::vertex_on_path>::iterator it;
+      int index = 0;
+      int closest_index = 0;
+      //get first's index
+      for(it = d->path.begin(); it!=d->path.end(); ++it)
+      {
+        bool end_of_path_is_prio = true;//makes the end of the path prioritary over the other points when there is a conflict
+        if(first.vertex == (d->path.end()-1)->vertex)
+          if(it != d->path.end()-1)
+            end_of_path_is_prio = false;
+        //makes the end of the path prioritary over the other points when there is a conflict
+        if(it->vertex == first.vertex &&
+           !(it == d->path.begin())&&// makes the begining of the path impossible to move
+           end_of_path_is_prio)
+        {
+          if(it!=d->path.end()-1 &&! is_same )
+          {
+            d->constrained_vertices.removeAll(it->vertex);
+            if(!alone)
+              d->constrained_vertices.prepend(it->vertex);
+          }
+          d->path.erase(it);
+          break;
+        }
+        if(it->is_constrained)
+          closest_index++;
+        index++;
+      }
+      //get first constrained vertex following first in path
+      for(it = d->path.begin() + index; it!=d->path.end(); ++it)
+      {
+        if(it->is_constrained )
+        {
+          is_last = false;
+          closest = *it;
+          break;
+        }
+      }
+      //mark the new vertex as constrained before closest.
+      temp_selected_vertices.erase(first.vertex);
+      //check if the vertex is contained several times in the path
+      if(!is_last)
+      {
+        d->constrained_vertices.insert(closest_index, vh);//cannot really use indexOf in case a fixed_point is used several times
+      }
+      else
+        d->constrained_vertices.replace(d->constrained_vertices.size()-1, vh);
+
+
+    }
+    //Display the new path
+    d->computeAndDisplayPath();
+    d->first_selected = false;
+  }
+  //update constrained_vertices
+  d->constrained_vertices.clear();
+  fixed_vertices.clear();
+  QList<Scene_polyhedron_selection_item_priv::vertex_on_path>::iterator it;
+  for(it = d->path.begin(); it!=d->path.end(); ++it)
+  {
+    if(it->is_constrained )
+    {
+      d->constrained_vertices.append(it->vertex);
+      fixed_vertices.insert(it->vertex);
+    }
+  }
+}
+
+
+void Scene_polyhedron_selection_item::on_Ctrlz_pressed()
+{
+  d->path.clear();
+  d->constrained_vertices.clear();
+  fixed_vertices.clear();
+  validateMoveVertex();
+  d->first_selected = false;
+  temp_selected_vertices.clear();
+  temp_selected_edges.clear();
+  temp_selected_facets.clear();
+  d->are_temp_buffers_filled = false;
+  set_operation_mode(d->operation_mode);
+  Q_EMIT itemChanged();
+}
+
+Scene_polyhedron_selection_item::Scene_polyhedron_selection_item()
+  : Scene_polyhedron_item_decorator(NULL, false)
+{
+  d = new Scene_polyhedron_selection_item_priv(this);
+  d->original_sel_mode = static_cast<Active_handle::Type>(0);
+  d->operation_mode = -1;
+  for(int i=0; i<Scene_polyhedron_selection_item_priv::NumberOfVaos; i++)
+  {
+    addVaos(i);
+    vaos[i]->create();
+  }
+
+  for(int i=0; i<Scene_polyhedron_selection_item_priv::NumberOfVbos; i++)
+  {
+    buffers[i].create();
+  }
+  d->nb_facets = 0;
+  d->nb_points = 0;
+  d->nb_lines = 0;
+  this->setColor(facet_color);
+  d->first_selected = false;
+  d->is_treated = false;
+  d->poly_need_update = false;
+  are_buffers_filled = false;
+  d->are_temp_buffers_filled = false;
+  d->poly = NULL;
+  d->ready_to_move = false;
+}
+
+Scene_polyhedron_selection_item::Scene_polyhedron_selection_item(Scene_polyhedron_item* poly_item, QMainWindow* mw)
+  : Scene_polyhedron_item_decorator(NULL, false)
+{
+  d = new Scene_polyhedron_selection_item_priv(this);
+  d->original_sel_mode = static_cast<Active_handle::Type>(0);
+  d->operation_mode = -1;
+  d->nb_facets = 0;
+  d->nb_points = 0;
+  d->nb_lines = 0;
+
+  for(int i=0; i<Scene_polyhedron_selection_item_priv::NumberOfVaos; i++)
+  {
+    addVaos(i);
+    vaos[i]->create();
+  }
+
+  for(int i=0; i<Scene_polyhedron_selection_item_priv::NumberOfVbos; i++)
+  {
+    buffers[i].create();
+  }
+  d->poly = NULL;
+  init(poly_item, mw);
+  this->setColor(facet_color);
+  invalidateOpenGLBuffers();
+  compute_normal_maps();
+  d->first_selected = false;
+  d->is_treated = false;
+  d->poly_need_update = false;
+  d->ready_to_move = false;
+
+}
+
+Scene_polyhedron_selection_item::~Scene_polyhedron_selection_item()
+{
+  delete d;
+  QGLViewer* v = *QGLViewer::QGLViewerPool().begin();
+  CGAL::Three::Viewer_interface* viewer = dynamic_cast<CGAL::Three::Viewer_interface*>(v);
+  viewer->setBindingSelect();
+}
+
+void Scene_polyhedron_selection_item::setPathSelection(bool b) {
+  k_ring_selector.setEditMode(b);
+  d->is_path_selecting = b;
+  if(d->is_path_selecting){
+    int ind = 0;
+    BOOST_FOREACH(Vertex_handle vd, vertices(*polyhedron())){
+      vd->id() = ind++;
+    }
+  }
+}
+
+void Scene_polyhedron_selection_item::update_poly()
+{
+  if(d->poly_need_update)
+    poly_item->invalidateOpenGLBuffers();
+}
+
+void Scene_polyhedron_selection_item::resetIsTreated() { d->is_treated = false;}
+
+void Scene_polyhedron_selection_item::invalidateOpenGLBuffers() {
+
+  // do not use decorator function, which calls changed on poly_item which cause deletion of AABB
+    //  poly_item->invalidateOpenGLBuffers();
+      are_buffers_filled = false;
+      d->are_temp_buffers_filled = false;
+      d->poly = polyhedron();
+      compute_bbox();
+}
+
+void Scene_polyhedron_selection_item::add_to_selection()
+{
+  Q_FOREACH(edge_descriptor ed, temp_selected_edges)
+  {
+    selected_edges.insert(ed);
+    temp_selected_edges.erase(ed);
+  }
+  on_Ctrlz_pressed();
+  invalidateOpenGLBuffers();
+  QGLViewer* v = *QGLViewer::QGLViewerPool().begin();
+  v->update();
+  d->tempInstructions("Path added to selection.",
+                   "Select two vertices to create the path between them. (1/2)");
+}
+
+void Scene_polyhedron_selection_item::save_handleType()
+{
+  d->original_sel_mode = get_active_handle_type();
+}
+void Scene_polyhedron_selection_item::compute_normal_maps()
+{
+
+  d->face_normals_map.clear();
+  d->vertex_normals_map.clear();
+  d->nf_pmap = boost::associative_property_map< CGAL::Unique_hash_map<boost::graph_traits<Polyhedron>::face_descriptor, Kernel::Vector_3> >(d->face_normals_map);
+  d->nv_pmap = boost::associative_property_map< CGAL::Unique_hash_map<boost::graph_traits<Polyhedron>::vertex_descriptor, Kernel::Vector_3> >(d->vertex_normals_map);
+  PMP::compute_normals(*d->poly, d->nv_pmap, d->nf_pmap);
+}
+
+void Scene_polyhedron_selection_item::updateTick()
+{
+    d->ready_to_move = true;
+    QTimer::singleShot(0,this,SLOT(moveVertex()));
+}
+
+
+void Scene_polyhedron_selection_item::moveVertex()
+{
+  if(d->ready_to_move)
+  {
+    Vertex_handle vh = *temp_selected_vertices.begin();
+    vh->point() = Kernel::Point_3(d->manipulated_frame->position().x,
+                                  d->manipulated_frame->position().y,
+                                  d->manipulated_frame->position().z);
+    invalidateOpenGLBuffers();
+    poly_item->invalidateOpenGLBuffers();
+    d->ready_to_move = false;
+  }
+}
+
+void Scene_polyhedron_selection_item::validateMoveVertex()
+{
+  temp_selected_vertices.clear();
+  QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
+  k_ring_selector.setEditMode(true);
+  viewer->setManipulatedFrame(NULL);
+  invalidateOpenGLBuffers();
+  Q_EMIT updateInstructions("Select a vertex. (1/2)");
+}
+
+
+bool Scene_polyhedron_selection_item_priv::canAddFace(Halfedge_handle hc, Halfedge_handle t)
+{
+  bool found(false),  is_border(false);
+
+  //if the selected halfedge is not a border, stop and signal it.
+  if(hc->is_border())
+    is_border = true;
+  else if(hc->opposite()->is_border())
+  {
+    hc = hc->opposite();
+    is_border = true;
+  }
+  if(!is_border)
+  {
+    tempInstructions("Edge not selected : no shared border found.",
+                     "Select the second edge. (2/2)");
+    return false;
+  }
+  //if the halfedges are the same, stop and signal it.
+  if(hc == t)
+  {
+    tempInstructions("Edge not selected : halfedges must be different.",
+                     "Select the second edge. (2/2)");
+    return false;
+  }
+  //if the halfedges are adjacent, stop and signal it.
+  if(next(t, *item->polyhedron()) == hc || next(hc, *item->polyhedron()) == t)
+  {
+    tempInstructions("Edge not selected : halfedges must not be adjacent.",
+                     "Select the second edge. (2/2)");
+    return false;
+  }
+
+  //if the halfedges are not on the same border, stop and signal it.
+  boost::graph_traits<Polyhedron>::halfedge_descriptor iterator = next(t, *item->polyhedron());
+  while(iterator != t)
+  {
+    if(iterator == hc)
+    {
+      found = true;
+      boost::graph_traits<Polyhedron>::halfedge_descriptor res =
+          CGAL::Euler::add_face_to_border(t,hc, *item->polyhedron());
+
+      if(PMP::is_degenerated(res, *item->polyhedron(), get(CGAL::vertex_point, *item->polyhedron()), Kernel()))
+      {
+        CGAL::Euler::remove_face(res, *item->polyhedron());
+        tempInstructions("Edge not selected : resulting facet is degenerated.",
+                         "Select the second edge. (2/2)");
+        return false;
+      }
+      break;
+    }
+    iterator = next(iterator, *item->polyhedron());
+  }
+  if(!found)
+  {
+    tempInstructions("Edge not selected : no shared border found.",
+                     "Select the second edge. (2/2)");
+    return false;
+  }
+  return true;
+}
+
+bool Scene_polyhedron_selection_item_priv::canAddFaceAndVertex(Halfedge_handle hc, Halfedge_handle t)
+{
+  bool found(false),  is_border(false);
+
+  //if the selected halfedge is not a border, stop and signal it.
+  if(hc->is_border())
+    is_border = true;
+  else if(hc->opposite()->is_border())
+  {
+    hc = hc->opposite();
+    is_border = true;
+  }
+  if(!is_border)
+  {
+    tempInstructions("Edge not selected : no shared border found.",
+                     "Select the second edge. (2/2)");
+    return false;
+  }
+  //if the halfedges are the same, stop and signal it.
+  if(hc == t)
+  {
+    tempInstructions("Edge not selected : halfedges must be different.",
+                     "Select the second edge. (2/2)");
+    return false;
+  }
+
+  //if the halfedges are not on the same border, stop and signal it.
+  boost::graph_traits<Polyhedron>::halfedge_descriptor iterator = next(t, *item->polyhedron());
+  while(iterator != t)
+  {
+    if(iterator == hc)
+    {
+      found = true;
+      CGAL::Euler::add_vertex_and_face_to_border(hc,t, *item->polyhedron());
+      break;
+    }
+    iterator = next(iterator, *item->polyhedron());
+  }
+  if(!found)
+  {
+    tempInstructions("Edge not selected : no shared border found.",
+                     "Select the second edge. (2/2)");
+    return false;
+  }
+  return true;
+}
+
+void Scene_polyhedron_selection_item::clearHL()
+{
+  HL_selected_edges.clear();
+  HL_selected_facets.clear();
+  HL_selected_vertices.clear();
+  d->are_HL_buffers_filled = false;
+  Q_EMIT itemChanged();
+}
+void Scene_polyhedron_selection_item::selected_HL(const std::set<Polyhedron::Vertex_handle>& m)
+{
+  HL_selected_edges.clear();
+  HL_selected_facets.clear();
+  HL_selected_vertices.clear();
+  HL_selected_vertices.insert(*m.begin());
+
+  d->are_HL_buffers_filled = false;
+  Q_EMIT itemChanged();
+}
+
+void Scene_polyhedron_selection_item::selected_HL(const std::set<Polyhedron::Facet_handle>& m)
+{
+  HL_selected_edges.clear();
+  HL_selected_facets.clear();
+  HL_selected_vertices.clear();
+  HL_selected_facets.insert(*m.begin());
+  d->are_HL_buffers_filled = false;
+  Q_EMIT itemChanged();
+}
+
+void Scene_polyhedron_selection_item::selected_HL(const std::set<edge_descriptor>& m)
+{
+  HL_selected_edges.clear();
+  HL_selected_facets.clear();
+  HL_selected_vertices.clear();
+  HL_selected_edges.insert(*m.begin());
+  d->are_HL_buffers_filled = false;
+  Q_EMIT itemChanged();
+}
+
+void Scene_polyhedron_selection_item::init(Scene_polyhedron_item* poly_item, QMainWindow* mw)
+{
+  this->poly_item = poly_item;
+  connect(poly_item, SIGNAL(item_is_about_to_be_changed()), this, SLOT(poly_item_changed()));
+  connect(&k_ring_selector, SIGNAL(selected(const std::set<Polyhedron::Vertex_handle>&)), this,
+    SLOT(selected(const std::set<Polyhedron::Vertex_handle>&)));
+  connect(&k_ring_selector, SIGNAL(selected(const std::set<Polyhedron::Facet_handle>&)), this,
+    SLOT(selected(const std::set<Polyhedron::Facet_handle>&)));
+  connect(&k_ring_selector, SIGNAL(selected(const std::set<edge_descriptor>&)), this,
+    SLOT(selected(const std::set<edge_descriptor>&)));
+  connect(&k_ring_selector, SIGNAL(selected_HL(const std::set<Polyhedron::Vertex_handle>&)), this,
+          SLOT(selected_HL(const std::set<Polyhedron::Vertex_handle>&)));
+  connect(&k_ring_selector, SIGNAL(selected_HL(const std::set<Polyhedron::Facet_handle>&)), this,
+          SLOT(selected_HL(const std::set<Polyhedron::Facet_handle>&)));
+  connect(&k_ring_selector, SIGNAL(selected_HL(const std::set<edge_descriptor>&)), this,
+          SLOT(selected_HL(const std::set<edge_descriptor>&)));
+  connect(&k_ring_selector, SIGNAL(clearHL()), this,
+          SLOT(clearHL()));
+
+  connect(poly_item, SIGNAL(selection_done()), this, SLOT(update_poly()));
+  connect(&k_ring_selector, SIGNAL(endSelection()), this,SLOT(endSelection()));
+  connect(&k_ring_selector, SIGNAL(toogle_insert(bool)), this,SLOT(toggle_insert(bool)));
+  connect(&k_ring_selector,SIGNAL(isCurrentlySelected(Scene_polyhedron_item_k_ring_selection*)), this, SIGNAL(isCurrentlySelected(Scene_polyhedron_item_k_ring_selection*)));
+  k_ring_selector.init(poly_item, mw, Active_handle::VERTEX, -1);
+  connect(&k_ring_selector, SIGNAL(resetIsTreated()), this, SLOT(resetIsTreated()));
+  QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
+  d->manipulated_frame = new ManipulatedFrame();
+  viewer->installEventFilter(this);
+  mw->installEventFilter(this);
+  facet_color = QColor(87,87,87);
+  edge_color = QColor(173,35,35);
+  vertex_color = QColor(255,205,243);
+}
+
+void Scene_polyhedron_selection_item::select_all_NT()
+{
+  for(Facet_iterator fit = polyhedron()->facets_begin() ; fit != polyhedron()->facets_end(); ++fit) {
+    if(!fit->is_triangle())
+    selected_facets.insert(fit);
+  }
+  invalidateOpenGLBuffers();
+  Q_EMIT itemChanged();
+}
diff --git a/3rdparty/CGAL/demo/Polyhedron/Scene_polyhedron_selection_item.h b/3rdparty/CGAL/demo/Polyhedron/Scene_polyhedron_selection_item.h
new file mode 100644
index 0000000..8647862
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Scene_polyhedron_selection_item.h
@@ -0,0 +1,941 @@
+#ifndef SCENE_POLYHEDRON_SELECTION_ITEM_H
+#define SCENE_POLYHEDRON_SELECTION_ITEM_H
+#include "opengl_tools.h"
+#include "Scene_polyhedron_selection_item_config.h"
+#include "Scene_polyhedron_item_k_ring_selection.h"
+#include "Travel_isolated_components.h"
+
+#include "Scene_polyhedron_item_decorator.h"
+#include "Polyhedron_type.h"
+
+#include <CGAL/property_map.h>
+#include <CGAL/Polygon_mesh_processing/orient_polygon_soup.h>
+#include <CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h>
+#include <CGAL/Polygon_mesh_processing/connected_components.h>
+#include "Polyhedron_demo_detect_sharp_edges.h"
+
+// Laurent Rineau, 2016/04/07: that header should not be included here, but
+// only in the .cpp file. But that header file does contain the body of a
+// few member functions.
+#include <CGAL/Three/Viewer_interface.h>
+
+#include <fstream>
+#include <boost/foreach.hpp>
+#include <boost/unordered_set.hpp>
+#include <boost/property_map/vector_property_map.hpp>
+
+#include <CGAL/boost/graph/selection.h>
+#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
+#include <CGAL/boost/graph/Euler_operations.h>
+
+#include <QGLViewer/manipulatedFrame.h>
+
+namespace PMP = CGAL::Polygon_mesh_processing;
+
+
+template<class HandleType, class SelectionItem>
+struct Selection_traits {};
+
+template<class SelectionItem>
+struct Selection_traits<typename SelectionItem::Vertex_handle, SelectionItem> 
+{
+  typedef typename SelectionItem::Selection_set_vertex Container;
+  typedef boost::graph_traits<Polyhedron>::vertex_iterator Iterator;
+  typedef boost::graph_traits<Polyhedron>::edge_descriptor edge_descriptor;
+
+  Selection_traits(SelectionItem* item) : item(item) { }
+
+  Container& container() { return item->selected_vertices; }
+  Iterator iterator_begin() { return vertices(*item->polyhedron()).first; }
+  Iterator iterator_end() { return vertices(*item->polyhedron()).second; }
+  std::size_t size() { return item->polyhedron()->size_of_vertices(); }
+  void update_indices() { item->polyhedron_item()->update_vertex_indices(); }
+  std::size_t id(typename SelectionItem::Vertex_handle  vh) {return vh->id();}
+
+  template <class VertexRange, class HalfedgeGraph, class IsVertexSelectedPMap, class OutputIterator>
+  static
+  OutputIterator
+  reduce_selection(
+    const VertexRange& selection,
+    HalfedgeGraph& graph,
+    unsigned int k,
+    IsVertexSelectedPMap is_selected,
+    OutputIterator out)
+  {
+    return reduce_vertex_selection(selection, graph, k, is_selected, out);
+  }
+  template <class VertexRange, class HalfedgeGraph, class IsVertexSelectedPMap, class OutputIterator>
+  static
+  OutputIterator
+  expand_selection(
+    const VertexRange& selection,
+    HalfedgeGraph& graph,
+    unsigned int k,
+    IsVertexSelectedPMap is_selected,
+    OutputIterator out)
+  {
+    return expand_vertex_selection(selection, graph, k, is_selected, out);
+  }
+
+  SelectionItem* item;
+};
+
+template<class SelectionItem>
+struct Selection_traits<typename SelectionItem::Facet_handle, SelectionItem>
+{
+  typedef typename SelectionItem::Selection_set_facet Container;
+  typedef boost::graph_traits<Polyhedron>::face_iterator Iterator;
+  Selection_traits(SelectionItem* item) : item(item) { }
+
+  Container& container() { return item->selected_facets; }
+  Iterator iterator_begin() { return faces(*item->polyhedron()).first; }
+  Iterator iterator_end() { return faces(*item->polyhedron()).second; }
+  std::size_t size() { return item->polyhedron()->size_of_facets(); }
+  void update_indices() { item->polyhedron_item()->update_facet_indices(); }
+  std::size_t id(typename SelectionItem::Facet_handle fh) {return fh->id();}
+
+  template <class FaceRange, class HalfedgeGraph, class IsFaceSelectedPMap, class OutputIterator>
+  static
+  OutputIterator
+  reduce_selection(
+    const FaceRange& selection,
+    HalfedgeGraph& graph,
+    unsigned int k,
+    IsFaceSelectedPMap is_selected,
+    OutputIterator out)
+  {
+    return reduce_face_selection(selection, graph, k, is_selected, out);
+  }
+  template <class FaceRange, class HalfedgeGraph, class IsFaceSelectedPMap, class OutputIterator>
+  static
+  OutputIterator
+  expand_selection(
+    const FaceRange& selection,
+    HalfedgeGraph& graph,
+    unsigned int k,
+    IsFaceSelectedPMap is_selected,
+    OutputIterator out)
+  {
+    return expand_face_selection(selection, graph, k, is_selected, out);
+  }
+
+  SelectionItem* item;
+};
+
+template<class SelectionItem>
+struct Selection_traits<typename SelectionItem::edge_descriptor, SelectionItem> 
+{
+  typedef typename SelectionItem::Selection_set_edge Container;
+  typedef boost::graph_traits<Polyhedron>::edge_iterator Iterator;
+  Selection_traits(SelectionItem* item) : item(item) { }
+
+  Container& container() { return item->selected_edges; }
+  Iterator iterator_begin() { return edges(*item->polyhedron()).first; }
+  Iterator iterator_end() { return edges(*item->polyhedron()).second; }
+  std::size_t size() { return item->polyhedron()->size_of_halfedges()/2; }
+  void update_indices() { item->polyhedron_item()->update_halfedge_indices(); }
+  std::size_t id(boost::graph_traits<Polyhedron>::edge_descriptor ed) {return ed.halfedge()->id()/2;}
+
+  template <class EdgeRange, class HalfedgeGraph, class IsEdgeSelectedPMap, class OutputIterator>
+  static
+  OutputIterator
+  reduce_selection(
+    const EdgeRange& selection,
+    HalfedgeGraph& graph,
+    unsigned int k,
+    IsEdgeSelectedPMap is_selected,
+    OutputIterator out)
+  {
+    return reduce_edge_selection(selection, graph, k, is_selected, out);
+  }
+  template <class EdgeRange, class HalfedgeGraph, class IsEdgeSelectedPMap, class OutputIterator>
+  static
+  OutputIterator
+  expand_selection(
+    const EdgeRange& selection,
+    HalfedgeGraph& graph,
+    unsigned int k,
+    IsEdgeSelectedPMap is_selected,
+    OutputIterator out)
+  {
+    return expand_edge_selection(selection, graph, k, is_selected, out);
+  }
+
+  SelectionItem* item;
+};
+
+//////////////////////////////////////////////////////////////////////////
+struct Scene_polyhedron_selection_item_priv;
+class SCENE_POLYHEDRON_SELECTION_ITEM_EXPORT Scene_polyhedron_selection_item 
+  : public Scene_polyhedron_item_decorator
+{
+  Q_OBJECT
+
+friend class Polyhedron_demo_selection_plugin;
+
+public:
+  typedef Polyhedron::Vertex_handle   Vertex_handle;
+  typedef Polyhedron::Facet_handle    Facet_handle;
+  typedef boost::graph_traits<Polyhedron>::edge_descriptor edge_descriptor;
+  typedef boost::graph_traits<Polyhedron>::halfedge_descriptor halfedge_descriptor;
+  typedef boost::graph_traits<Polyhedron>::vertex_descriptor vertex_descriptor;
+  typedef Polyhedron::Halfedge_handle Halfedge_handle;
+
+  typedef Polyhedron::Vertex_iterator Vertex_iterator;
+  typedef Polyhedron::Facet_iterator  Facet_iterator;
+  typedef Scene_polyhedron_item_k_ring_selection::Active_handle Active_handle;
+
+  Scene_polyhedron_selection_item() ;
+  Scene_polyhedron_selection_item(Scene_polyhedron_item* poly_item, QMainWindow* mw);
+  ~Scene_polyhedron_selection_item();
+  void inverse_selection();
+  void setPathSelection(bool b);
+
+protected: 
+  void init(Scene_polyhedron_item* poly_item, QMainWindow* mw);
+
+  Active_handle::Type get_active_handle_type() 
+  { return k_ring_selector.active_handle_type; }
+  void set_active_handle_type(Active_handle::Type aht) 
+  { k_ring_selector.active_handle_type = aht; }
+
+  int get_k_ring() { return k_ring_selector.k_ring; }
+  void set_k_ring(int k) { k_ring_selector.k_ring = k; }
+
+  bool get_is_insert() { return is_insert; }
+  void set_is_insert(bool i) { is_insert = i; }
+  
+public:
+  typedef boost::unordered_set<Vertex_handle, CGAL::Handle_hash_function>    Selection_set_vertex;
+  typedef boost::unordered_set<Facet_handle, CGAL::Handle_hash_function>      Selection_set_facet;
+  typedef boost::unordered_set<edge_descriptor, CGAL::Handle_hash_function>    Selection_set_edge;
+
+  Polyhedron* polyhedron()
+  {
+    return this->poly_item->polyhedron();
+  }
+
+  const Polyhedron* polyhedron() const
+  {
+    return this->poly_item->polyhedron();
+  }
+
+    using Scene_polyhedron_item_decorator::draw;
+    virtual void draw(CGAL::Three::Viewer_interface*) const;
+    virtual void drawEdges() const { }
+    virtual void drawEdges(CGAL::Three::Viewer_interface*) const;
+    virtual void drawPoints(CGAL::Three::Viewer_interface*) const;
+
+  bool supportsRenderingMode(RenderingMode m) const { return (m==Flat); }
+
+  bool isEmpty() const {
+    return selected_vertices.empty() && selected_edges.empty() && selected_facets.empty();
+  }
+
+  void compute_bbox() const
+  {
+    // Workaround a bug in g++-4.8.3:
+    //   http://stackoverflow.com/a/21755207/1728537
+    // Using boost::make_optional to copy-initialize 'item_bbox' hides the
+    //   warning about '*item_bbox' not being initialized.
+    // -- Laurent Rineau, 2014/10/30
+    boost::optional<CGAL::Bbox_3> item_bbox
+      = boost::make_optional(false, CGAL::Bbox_3());
+
+    for(Selection_set_vertex::const_iterator v_it = selected_vertices.begin(); 
+        v_it != selected_vertices.end(); ++v_it) {
+
+      if(item_bbox) { *item_bbox = *item_bbox + (*v_it)->point().bbox(); }
+      else          {  item_bbox = (*v_it)->point().bbox(); }
+    }
+
+    for(Selection_set_edge::const_iterator e_it = selected_edges.begin(); 
+        e_it != selected_edges.end(); ++e_it) {
+        CGAL::Bbox_3 e_bbox = e_it->halfedge()->vertex()->point().bbox();
+        e_bbox = e_bbox + e_it->halfedge()->opposite()->vertex()->point().bbox();
+        if(item_bbox) { *item_bbox = *item_bbox + e_bbox; }
+        else          {  item_bbox = e_bbox; }
+    }
+
+    for(Selection_set_facet::const_iterator f_it = selected_facets.begin(); 
+        f_it != selected_facets.end(); ++f_it) {
+
+        Polyhedron::Halfedge_around_facet_circulator he = (*f_it)->facet_begin(), cend = he;
+        CGAL_For_all(he,cend) {
+          if(item_bbox) { *item_bbox = *item_bbox + he->vertex()->point().bbox(); }
+          else          {  item_bbox = he->vertex()->point().bbox(); }
+        }
+    }
+
+    if(!item_bbox) { _bbox = this->poly_item->bbox(); return;}
+    _bbox = Bbox(item_bbox->xmin(),item_bbox->ymin(),item_bbox->zmin(),
+                item_bbox->xmax(),item_bbox->ymax(),item_bbox->zmax());
+  }
+
+  bool save(const std::string& file_name) const {
+    // update id fields before using
+    if(selected_vertices.size() > 0) { poly_item->update_vertex_indices(); }
+    if(selected_facets.size() > 0)   { poly_item->update_facet_indices();  }
+    if( (selected_edges.size() > 0) &&
+        selected_vertices.empty() )   { poly_item->update_vertex_indices(); }
+
+    std::ofstream out(file_name.c_str());
+    if(!out) { return false; }
+
+    for(Selection_set_vertex::const_iterator it = selected_vertices.begin(); it != selected_vertices.end(); ++it) 
+    { out << (*it)->id() << " "; }
+    out << std::endl;
+
+    for(Selection_set_facet::const_iterator it = selected_facets.begin(); it != selected_facets.end(); ++it) 
+    { out << (*it)->id() << " "; }
+    out << std::endl;
+
+    for(Selection_set_edge::const_iterator it = selected_edges.begin(); it != selected_edges.end(); ++it) 
+    {
+      edge_descriptor ed = *it;
+      out << source(ed,*polyhedron())->id() << " " << target(ed,*polyhedron())->id() << " ";
+    }
+
+    out << std::endl;
+    return true;
+  }
+
+
+  bool load(const std::string& file_name) {
+    file_name_holder = file_name;
+    return true;
+  }
+
+
+  // this function is called by selection_plugin, since at the time of the call of load(...) 
+  // we do not have access to selected polyhedron item
+  bool actual_load(Scene_polyhedron_item* poly_item, QMainWindow* mw) 
+  {
+    init(poly_item, mw);
+
+    std::vector<Vertex_handle> all_vertices;
+    all_vertices.reserve(polyhedron()->size_of_vertices());
+    Polyhedron::Vertex_iterator vb(polyhedron()->vertices_begin()), ve(polyhedron()->vertices_end());
+    for(;vb != ve; ++vb) { all_vertices.push_back(vb); }
+    
+    std::vector<Facet_handle> all_facets;
+    all_facets.reserve(polyhedron()->size_of_facets());
+    Polyhedron::Facet_iterator fb(polyhedron()->facets_begin()), fe(polyhedron()->facets_end());
+    for(;fb != fe; ++fb) { all_facets.push_back(fb); }
+
+    std::vector<edge_descriptor> all_edges(edges(*polyhedron()).first, edges(*polyhedron()).second);
+
+    std::ifstream in(file_name_holder.c_str());
+    if(!in) { return false; }
+
+    std::string line;
+    std::size_t id, id2;
+
+    if(!std::getline(in, line)) { return true; }
+    std::istringstream vertex_line(line);
+    while(vertex_line >> id) {
+      if(id >= all_vertices.size()) { return false; }
+      selected_vertices.insert(all_vertices[id]);
+    }
+
+    if(!std::getline(in, line)) { return true; }
+    std::istringstream facet_line(line);
+    while(facet_line >> id) {
+      if(id >= all_facets.size()) { return false; }
+      selected_facets.insert(all_facets[id]);
+    }
+
+    if(!std::getline(in, line)) { return true; }
+    std::istringstream edge_line(line);
+    while(edge_line >> id >> id2) {
+      if(id >= all_edges.size() || id2 >= all_edges.size()) { return false; }
+      vertex_descriptor s = all_vertices[id];
+      vertex_descriptor t = all_vertices[id2];
+      halfedge_descriptor hd;
+      bool exists;
+      boost::tie(hd,exists) = halfedge(s,t,*polyhedron());
+      if(! exists) { return false; }
+      selected_edges.insert(edge(hd,*polyhedron()));
+    }
+    return true;
+  }
+
+  //adds the content of temp_selection to the current selection
+  void add_to_selection();
+  // select all of `active_handle_type`(vertex, facet or edge)
+  void select_all() {
+    switch(get_active_handle_type()) {
+    case Active_handle::VERTEX:
+      select_all<Vertex_handle>(); break;
+    case Active_handle::FACET:
+    case Active_handle::CONNECTED_COMPONENT:
+      select_all<Facet_handle>(); break;
+    case Active_handle::EDGE:
+    case Active_handle::PATH:
+      selected_edges.insert(edges(*polyhedron()).first, edges(*polyhedron()).second);
+      invalidateOpenGLBuffers();
+      QGLViewer* v = *QGLViewer::QGLViewerPool().begin();
+      v->update();
+      break;
+    }
+  }
+  void select_all_NT();
+  // select all of vertex, facet or edge (use Vertex_handle, Facet_handle, edge_descriptor as template argument)
+  template<class HandleType>
+  void select_all() {
+    typedef Selection_traits<HandleType, Scene_polyhedron_selection_item> Tr;
+    Tr tr(this);
+    for(typename Tr::Iterator it = tr.iterator_begin() ; it != tr.iterator_end(); ++it) {
+      tr.container().insert(*it);
+    }
+    invalidateOpenGLBuffers();
+    Q_EMIT itemChanged();
+  }
+
+  // clear all of `active_handle_type`(vertex, facet or edge)
+  void clear() {
+    switch(get_active_handle_type()) {
+    case Active_handle::VERTEX:
+      clear<Vertex_handle>(); break;
+    case Active_handle::FACET:
+    case Active_handle::CONNECTED_COMPONENT:
+      clear<Facet_handle>(); break;
+    case Active_handle::EDGE:
+    case Active_handle::PATH:
+      clear<edge_descriptor>(); break;
+    }
+  }
+  // select all of vertex, facet or edge (use Vertex_handle, Facet_handle, edge_descriptor as template argument)
+  template<class HandleType>
+  void clear() {
+
+    Selection_traits<HandleType, Scene_polyhedron_selection_item> tr(this);
+    tr.container().clear();
+    invalidateOpenGLBuffers();
+    Q_EMIT itemChanged();
+  }
+
+  void clear_all(){
+    clear<Vertex_handle>();
+    clear<Facet_handle>();
+    clear<edge_descriptor>();
+  }
+
+  boost::optional<std::size_t> get_minimum_isolated_component() {
+    switch(get_active_handle_type()) {
+    case Active_handle::VERTEX:
+      return get_minimum_isolated_component<Vertex_handle>();
+    case Active_handle::FACET:
+      return get_minimum_isolated_component<Facet_handle>();
+    default:
+      return get_minimum_isolated_component<edge_descriptor>();
+    }
+  }
+  template<class HandleType> // use Vertex_handle, Facet_handle, edge_descriptor
+  boost::optional<std::size_t> get_minimum_isolated_component() {
+    Selection_traits<HandleType, Scene_polyhedron_selection_item> tr(this);
+    tr.update_indices();
+    Travel_isolated_components::Minimum_visitor visitor;
+    Travel_isolated_components().travel<HandleType>
+      (tr.iterator_begin(), tr.iterator_end(), tr.size(), tr.container(), visitor);
+    return visitor.minimum;
+  }
+
+  boost::optional<std::size_t> select_isolated_components(std::size_t threshold) {
+    switch(get_active_handle_type()) {
+    case Active_handle::VERTEX:
+      return select_isolated_components<Vertex_handle>(threshold);
+    case Active_handle::FACET:
+      return select_isolated_components<Facet_handle>(threshold);
+    default:
+      return select_isolated_components<edge_descriptor>(threshold);
+    }
+  }
+  template<class HandleType> // use Vertex_handle, Facet_handle, edge_descriptor
+  boost::optional<std::size_t> select_isolated_components(std::size_t threshold) {
+    typedef Selection_traits<HandleType, Scene_polyhedron_selection_item> Tr;
+    Tr tr(this);
+    tr.update_indices();
+    typedef std::insert_iterator<typename Tr::Container> Output_iterator;
+    Output_iterator out(tr.container(), tr.container().begin());
+
+    Travel_isolated_components::Selection_visitor<Output_iterator> visitor(threshold , out);
+    Travel_isolated_components().travel<HandleType>
+      (tr.iterator_begin(), tr.iterator_end(), tr.size(), tr.container(), visitor);
+
+    if(visitor.any_inserted) { invalidateOpenGLBuffers(); Q_EMIT itemChanged(); }
+    return visitor.minimum_visitor.minimum;
+  }
+
+  void expand_or_reduce(int steps) {
+    if (steps>0)
+    {
+      switch(get_active_handle_type()) {
+        case Active_handle::VERTEX:
+          expand_selection<Vertex_handle>(steps);
+        break;
+        case Active_handle::FACET:
+        case Active_handle::CONNECTED_COMPONENT:
+          expand_selection<Facet_handle>(steps);
+        break;
+        case Active_handle::EDGE:
+          expand_selection<edge_descriptor>(steps);
+        break;
+        case Active_handle::PATH:
+        break;
+      }
+    }
+    else
+    {
+      switch(get_active_handle_type()) {
+        case Active_handle::VERTEX:
+          reduce_selection<Vertex_handle>(-steps);
+        break;
+        case Active_handle::FACET:
+        case Active_handle::CONNECTED_COMPONENT:
+          reduce_selection<Facet_handle>(-steps);
+        break;
+        case Active_handle::EDGE:
+          reduce_selection<edge_descriptor>(-steps);
+        break;
+        case Active_handle::PATH:
+        break;
+      }
+    }
+  }
+
+  template <class Handle>
+  struct Is_selected_property_map{
+    std::vector<bool>* is_selected_ptr;
+    Is_selected_property_map()
+      : is_selected_ptr(NULL) {}
+    Is_selected_property_map(std::vector<bool>& is_selected)
+      : is_selected_ptr( &is_selected) {}
+
+    template<class H>
+    std::size_t id(H h){ return h->id(); }
+    std::size_t id(edge_descriptor ed) { return ed.halfedge()->id()/2; }
+
+    friend bool get(Is_selected_property_map map, Handle h)
+    {
+      CGAL_assertion(map.is_selected_ptr!=NULL);
+      return (*map.is_selected_ptr)[map.id(h)];
+    }
+
+    friend void put(Is_selected_property_map map, Handle h, bool b)
+    {
+      CGAL_assertion(map.is_selected_ptr!=NULL);
+      (*map.is_selected_ptr)[map.id(h)]=b;
+    }
+  };
+
+  template <typename SelectionSet>
+  struct Is_constrained_map
+  {
+    SelectionSet* m_set_ptr;
+
+    typedef typename SelectionSet::key_type    key_type;
+    typedef bool                               value_type;
+    typedef bool                               reference;
+    typedef boost::read_write_property_map_tag category;
+
+    Is_constrained_map()
+      : m_set_ptr(NULL)
+    {}
+    Is_constrained_map(SelectionSet* set_)
+      : m_set_ptr(set_)
+    {}
+    friend bool get(const Is_constrained_map& map, const key_type& k)
+    {
+      CGAL_assertion(map.m_set_ptr != NULL);
+      return map.m_set_ptr->count(k);
+    }
+    friend void put(Is_constrained_map& map, const key_type& k, const value_type b)
+    {
+      CGAL_assertion(map.m_set_ptr != NULL);
+      if (b)  map.m_set_ptr->insert(k);
+      else    map.m_set_ptr->erase(k);
+    }
+  };
+
+  template <class Handle>
+  struct Index_map
+  {
+    typedef Handle                             key_type;
+    typedef std::size_t                        value_type;
+    typedef value_type&                        reference;
+    typedef boost::read_write_property_map_tag category;
+
+    friend value_type get(Index_map, Handle h)
+    {
+      return h->id();
+    }
+    friend void put(Index_map, Handle h, value_type i)
+    {
+      h->id() = i;
+    }
+  };
+
+  template <class Handle>
+  void expand_selection(unsigned int steps)
+  {
+    typedef Selection_traits<Handle, Scene_polyhedron_selection_item> Tr;
+    Tr tr(this);
+
+    tr.update_indices();
+    std::vector<bool> mark(tr.size(),false);
+
+    BOOST_FOREACH(Handle h,tr.container())
+      mark[tr.id(h)]=true;
+
+    Tr::expand_selection(
+      tr.container(),
+      *this->poly_item->polyhedron(),
+      steps,
+      Is_selected_property_map<Handle>(mark),
+      CGAL::Emptyset_iterator()
+    );
+
+    bool any_change = false;
+    for(typename Tr::Iterator it = tr.iterator_begin() ; it != tr.iterator_end(); ++it) {
+      if(mark[tr.id(*it)]) {
+        any_change |= tr.container().insert(*it).second;
+      }
+    }
+    if(any_change) { invalidateOpenGLBuffers(); Q_EMIT itemChanged(); }
+  }
+
+  template <class Handle>
+  void reduce_selection(unsigned int steps) {
+
+    typedef Selection_traits<Handle, Scene_polyhedron_selection_item> Tr;
+    Tr tr(this);
+
+    tr.update_indices();
+    std::vector<bool> mark(tr.size(),false);
+
+    BOOST_FOREACH(Handle h,tr.container())
+      mark[tr.id(h)]=true;
+
+    Tr::reduce_selection(
+      tr.container(),
+      *this->poly_item->polyhedron(),
+      steps,
+      Is_selected_property_map<Handle>(mark),
+      CGAL::Emptyset_iterator()
+    );
+
+    bool any_change = false;
+    for(typename Tr::Iterator it = tr.iterator_begin() ; it != tr.iterator_end(); ++it) {
+      if(!mark[tr.id(*it)]) {
+        any_change |= (tr.container().erase(*it)!=0);
+      }
+    }
+    if(any_change) { invalidateOpenGLBuffers(); Q_EMIT itemChanged(); }
+  }
+
+  void erase_selected_facets() {
+    if(selected_facets.empty()) {return;}
+    // no-longer-valid vertices and edges will be handled when item_about_to_be_changed() 
+
+    for (Selection_set_edge::iterator eit = selected_edges.begin(); eit != selected_edges.end();)
+    {
+      if(//both incident faces will be erased
+        (selected_facets.find(eit->halfedge()->face()) != selected_facets.end()
+         && selected_facets.find(eit->halfedge()->opposite()->face()) != selected_facets.end())
+         //OR eit is a boundary edge and its incident face will be erased
+         || (eit->halfedge()->is_border_edge()
+             && (selected_facets.find(eit->halfedge()->face()) != selected_facets.end()
+              || selected_facets.find(eit->halfedge()->opposite()->face()) != selected_facets.end())))
+      {
+        edge_descriptor tmp = *eit;
+        ++eit;
+        selected_edges.erase(tmp);
+      }
+      else
+        ++eit;
+    }
+
+    // erase facets from poly
+    for(Selection_set_facet::iterator fb = selected_facets.begin(); fb != selected_facets.end(); ++fb) {
+      polyhedron()->erase_facet((*fb)->halfedge());
+    }
+    selected_facets.clear();
+    invalidateOpenGLBuffers();
+    changed_with_poly_item();
+  }
+
+  void keep_connected_components() {
+    if (selected_facets.empty()) { return; }
+
+    Selection_traits<Polyhedron::Face_handle, Scene_polyhedron_selection_item> trf(this);
+    trf.update_indices();
+    Selection_traits<Polyhedron::Vertex_handle, Scene_polyhedron_selection_item> trv(this);
+    trv.update_indices();
+
+    PMP::keep_connected_components(*polyhedron()
+      , trf.container()
+      , PMP::parameters::face_index_map(Index_map<Polyhedron::Face_handle>())
+      .vertex_index_map(Index_map<Polyhedron::Vertex_handle>()));
+    changed_with_poly_item();
+  }
+
+  bool export_selected_facets_as_polyhedron(Polyhedron* out) {
+    // Note: might be a more performance wise solution
+    // assign sequential id to vertices neighbor to selected facets
+    for(Selection_set_facet::iterator fb = selected_facets.begin(); fb != selected_facets.end(); ++fb) {
+      Polyhedron::Halfedge_around_facet_circulator hb((*fb)->facet_begin()), hend(hb);
+      do {
+        hb->vertex()->id() = 0;
+      } while(++hb != hend);
+    }
+    // construct point vector
+    std::vector<Polyhedron::Point_3> points;
+    points.reserve(selected_facets.size());
+    std::size_t counter = 1;
+    for(Selection_set_facet::iterator fb = selected_facets.begin(); fb != selected_facets.end(); ++fb) {
+      Polyhedron::Halfedge_around_facet_circulator hb((*fb)->facet_begin()), hend(hb);
+      do {
+        if(hb->vertex()->id() == 0) {
+          hb->vertex()->id() = counter++; 
+          points.push_back(hb->vertex()->point());
+        }
+      } while(++hb != hend);
+    }
+    // construct polygon vector
+    std::vector<std::vector<std::size_t> > polygons(selected_facets.size());
+    counter = 0;
+    for(Selection_set_facet::iterator fb = selected_facets.begin(); fb != selected_facets.end(); ++fb, ++counter) {
+      Polyhedron::Halfedge_around_facet_circulator hb((*fb)->facet_begin()), hend(hb);
+      do {
+        polygons[counter].push_back(hb->vertex()->id() -1);
+      } while(++hb != hend);
+    }
+    CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh<Polyhedron>(
+      points, polygons, *out);
+
+    return out->size_of_vertices() > 0;
+  }
+
+  void select_sharp_edges(const double angle)
+  {
+    CGAL::detect_sharp_edges(polyhedron(), angle);
+
+    BOOST_FOREACH(edge_descriptor e, edges(*polyhedron()))
+    {
+      Polyhedron::Halfedge_handle h = halfedge(e, *polyhedron());
+      if (h->is_feature_edge())
+        selected_edges.insert(e);
+    }
+    invalidateOpenGLBuffers();
+  }
+
+  void changed_with_poly_item() {
+    // no need to update indices
+    poly_item->invalidateOpenGLBuffers();
+    Q_EMIT poly_item->itemChanged();
+    Q_EMIT itemChanged();
+  }
+
+  void setItemIsMulticolor(bool b) {
+    poly_item->setItemIsMulticolor(b);
+  }
+
+Q_SIGNALS:
+  void updateInstructions(QString);
+  void simplicesSelected(CGAL::Three::Scene_item*);
+  void isCurrentlySelected(Scene_polyhedron_item_k_ring_selection*);
+
+public Q_SLOTS:
+
+  void update_poly();
+  void on_Ctrlz_pressed();
+  void emitTempInstruct();
+  void resetIsTreated();
+  void save_handleType();
+  void set_operation_mode(int mode);
+  void invalidateOpenGLBuffers();
+  void validateMoveVertex();
+  void compute_normal_maps();
+  void clearHL();
+
+  // slots are called by signals of polyhedron_k_ring_selector
+  void selected(const std::set<Polyhedron::Vertex_handle>& m)
+  { has_been_selected(m); }
+  void selected(const std::set<Polyhedron::Facet_handle>& m)
+  { has_been_selected(m); }
+  void selected(const std::set<edge_descriptor>& m)
+  { has_been_selected(m); }
+  void selected_HL(const std::set<Polyhedron::Vertex_handle>& m);
+  void selected_HL(const std::set<Polyhedron::Facet_handle>& m);
+  void selected_HL(const std::set<edge_descriptor>& m);
+  void poly_item_changed() {
+    remove_erased_handles<Vertex_handle>();
+    remove_erased_handles<edge_descriptor>();
+    remove_erased_handles<Facet_handle>();
+  }
+  void endSelection(){
+    Q_EMIT simplicesSelected(this);
+  }
+  void toggle_insert(bool b)
+  {
+   is_insert = b;
+  }
+
+  void updateTick();
+  void moveVertex();
+protected:
+  bool eventFilter(QObject* /*target*/, QEvent * gen_event)
+  {
+    if(gen_event->type() == QEvent::KeyPress
+            && static_cast<QKeyEvent*>(gen_event)->key()==Qt::Key_Z)
+    {
+      QKeyEvent *keyEvent = static_cast<QKeyEvent*>(gen_event);
+      if(keyEvent->modifiers().testFlag(Qt::ControlModifier))
+        on_Ctrlz_pressed();
+    }
+
+    if(!visible() || !k_ring_selector.state.shift_pressing) { return false; }
+    if(gen_event->type() == QEvent::Wheel)
+    {
+      QWheelEvent *event = static_cast<QWheelEvent*>(gen_event);
+      int steps = event->delta() / 120;
+      expand_or_reduce(steps);
+      return true;
+    }
+    return false;
+  }
+
+  template<class HandleType>
+  void remove_erased_handles() {
+    typedef Selection_traits<HandleType, Scene_polyhedron_selection_item> Tr;
+    Tr tr(this);
+    if(tr.container().empty()) { return;}
+
+    std::vector<HandleType> exists;
+    for(typename Tr::Iterator it = tr.iterator_begin() ; it != tr.iterator_end(); ++it) {
+      if(tr.container().count(*it)) {
+        exists.push_back(*it);
+      }
+    }
+    tr.container().clear();
+    for(typename std::vector<HandleType>::iterator it = exists.begin(); it != exists.end(); ++it) {
+      tr.container().insert(*it);
+    }
+  }
+  void join_vertex(Scene_polyhedron_selection_item::edge_descriptor ed)
+  {
+    polyhedron()->join_vertex(halfedge(ed, *polyhedron()));
+  }
+
+
+  void selectPath(Vertex_handle vh);
+
+//Generic class
+  template<typename HandleRange>
+  bool treat_selection(const HandleRange&)
+  {
+    qDebug()<<"ERROR : unknown HandleRange";
+    return false;
+  }
+
+template<typename HandleRange>
+  bool treat_classic_selection(const HandleRange& selection);
+//Specialization for set<Vertex_handle>
+  bool treat_selection(const std::set<Polyhedron::Vertex_handle>& selection);
+  bool treat_selection(const std::set<edge_descriptor>& selection);
+  bool treat_selection(const std::set<Polyhedron::Facet_handle>& selection);
+  bool treat_selection(const std::vector<Polyhedron::Facet_handle>& selection);
+
+  Facet_handle face(Facet_handle fh)
+  { return fh; }
+  Facet_handle face(Vertex_handle)
+  { return boost::graph_traits<Polyhedron>::null_face(); }
+  Facet_handle face(edge_descriptor)
+  { return boost::graph_traits<Polyhedron>::null_face(); }
+
+  template<class HandleType>
+  void has_been_selected(const std::set<HandleType>& selection)
+  {
+    if(!visible()) { return; }
+
+
+    if (get_active_handle_type() == Active_handle::CONNECTED_COMPONENT)
+    {
+      Selection_traits<edge_descriptor,
+                       Scene_polyhedron_selection_item> tr(this);
+      tr.update_indices();
+      std::vector<bool> mark(tr.size(), false);
+      BOOST_FOREACH(edge_descriptor e, selected_edges)
+        mark[tr.id(e)] = true;
+      std::vector<Facet_handle> selected_cc;
+      CGAL::Polygon_mesh_processing::connected_component(
+        face(*selection.begin()),
+        *polyhedron(),
+        std::back_inserter(selected_cc),
+        CGAL::Polygon_mesh_processing::parameters::edge_is_constrained_map(
+          Is_selected_property_map<edge_descriptor>(mark)));
+       treat_selection(selected_cc);
+    }
+    else
+    {
+      treat_selection(selection);
+    }
+  }
+
+
+public:
+  Is_selected_property_map<edge_descriptor>
+    selected_edges_pmap(std::vector<bool>& mark)
+  {
+    Selection_traits<edge_descriptor,
+      Scene_polyhedron_selection_item> tr(this);
+    tr.update_indices();
+
+    for (unsigned int i = 0; i < mark.size(); ++i)
+      mark[i] = false;
+
+    BOOST_FOREACH(edge_descriptor e, selected_edges)
+      mark[tr.id(e)] = true;
+
+    return Is_selected_property_map<edge_descriptor>(mark);
+  }
+
+  Is_constrained_map<Selection_set_edge> constrained_edges_pmap()
+  {
+    return Is_constrained_map<Selection_set_edge>(&selected_edges);
+  }
+
+  Is_constrained_map<Selection_set_vertex> constrained_vertices_pmap()
+  {
+    return Is_constrained_map<Selection_set_vertex>(&selected_vertices);
+  }
+
+protected:
+  // members
+  std::string file_name_holder;
+  Scene_polyhedron_item_k_ring_selection k_ring_selector;
+  // action state
+  bool is_insert;
+
+public:
+// selection
+  Selection_set_vertex selected_vertices;
+  Selection_set_facet  selected_facets;
+  Selection_set_edge   selected_edges; // stores one halfedge for each pair (halfedge with minimum address)
+
+  Selection_set_vertex fixed_vertices;
+  Selection_set_vertex temp_selected_vertices;
+  Selection_set_facet  temp_selected_facets;
+  Selection_set_edge   temp_selected_edges; // stores one halfedge for each pair (halfedge with minimum address)
+  Selection_set_vertex HL_selected_vertices;
+  Selection_set_facet  HL_selected_facets;
+  Selection_set_edge   HL_selected_edges; // stores one halfedge for each pair (halfedge with minimum address)
+  QColor vertex_color, facet_color, edge_color;
+
+protected :
+  friend struct Scene_polyhedron_selection_item_priv;
+  Scene_polyhedron_selection_item_priv *d;
+};
+
+#endif
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polyhedron_selection_item_config.h b/3rdparty/CGAL/demo/Polyhedron/Scene_polyhedron_selection_item_config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polyhedron_selection_item_config.h
rename to 3rdparty/CGAL/demo/Polyhedron/Scene_polyhedron_selection_item_config.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polyhedron_shortest_path_item_config.h b/3rdparty/CGAL/demo/Polyhedron/Scene_polyhedron_shortest_path_item_config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polyhedron_shortest_path_item_config.h
rename to 3rdparty/CGAL/demo/Polyhedron/Scene_polyhedron_shortest_path_item_config.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polyhedron_transform_item_config.h b/3rdparty/CGAL/demo/Polyhedron/Scene_polyhedron_transform_item_config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polyhedron_transform_item_config.h
rename to 3rdparty/CGAL/demo/Polyhedron/Scene_polyhedron_transform_item_config.h
diff --git a/3rdparty/CGAL/demo/Polyhedron/Scene_polylines_item.cpp b/3rdparty/CGAL/demo/Polyhedron/Scene_polylines_item.cpp
new file mode 100644
index 0000000..6af15f2
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Scene_polylines_item.cpp
@@ -0,0 +1,585 @@
+#include "Scene_polylines_item.h"
+#include "Scene_spheres_item.h"
+
+#include <CGAL/bounding_box.h>
+#include <CGAL/gl.h>
+#include <QMenu>
+#include <QAction>
+#include <QInputDialog>
+#include <QApplication>
+
+struct Scene_polylines_item_private {
+    typedef Scene_polylines_item::K K;
+    typedef K::Point_3 Point_3;
+
+    Scene_polylines_item_private(Scene_polylines_item *parent) :
+        draw_extremities(false),
+        spheres_drawn_radius(0)
+    {
+      item = parent;
+    }
+
+    enum VAOs {
+        Edges=0,
+        NbOfVaos
+    };
+    enum VBOs {
+        Edges_Vertices = 0,
+        NbOfVbos
+    };
+
+    mutable Scene_spheres_item *spheres;
+    mutable std::vector<float> positions_lines;
+    mutable std::size_t nb_lines;
+    typedef std::map<Point_3, int> Point_to_int_map;
+    typedef Point_to_int_map::iterator iterator;
+    void computeSpheres();
+    void initializeBuffers(CGAL::Three::Viewer_interface *viewer) const;
+    void computeElements() const;
+    bool draw_extremities;
+    double spheres_drawn_radius;
+    Scene_polylines_item *item;
+};
+
+
+void
+Scene_polylines_item_private::initializeBuffers(CGAL::Three::Viewer_interface *viewer = 0) const
+{
+    QOpenGLShaderProgram *program;
+   //vao for the lines
+    {
+        program = item->getShaderProgram(Scene_polylines_item::PROGRAM_NO_SELECTION, viewer);
+        program->bind();
+
+        item->vaos[Edges]->bind();
+        item->buffers[Edges_Vertices].bind();
+        item->buffers[Edges_Vertices].allocate(positions_lines.data(),
+                            static_cast<int>(positions_lines.size()*sizeof(float)));
+        program->enableAttributeArray("vertex");
+        program->setAttributeBuffer("vertex",GL_FLOAT,0,4);
+        item->buffers[Edges_Vertices].release();
+        item->vaos[Edges]->release();
+        program->release();
+
+        nb_lines = positions_lines.size();
+        positions_lines.clear();
+        positions_lines.swap(positions_lines);
+    }
+    item->are_buffers_filled = true;
+}
+void
+Scene_polylines_item_private::computeElements() const
+{
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    positions_lines.resize(0);
+    //Fills the VBO with the lines
+    for(std::list<std::vector<Point_3> >::const_iterator it = item->polylines.begin();
+        it != item->polylines.end();
+        ++it){
+        if(it->empty()) continue;
+        for(size_t i = 0, end = it->size()-1;
+            i < end; ++i)
+        {
+            const Point_3& a = (*it)[i];
+            const Point_3& b = (*it)[i+1];
+            positions_lines.push_back(a.x());
+            positions_lines.push_back(a.y());
+            positions_lines.push_back(a.z());
+            positions_lines.push_back(1.0);
+
+            positions_lines.push_back(b.x());
+            positions_lines.push_back(b.y());
+            positions_lines.push_back(b.z());
+            positions_lines.push_back(1.0);
+        }
+
+    }
+    QApplication::restoreOverrideCursor();
+}
+
+void
+Scene_polylines_item_private::computeSpheres()
+{
+      QApplication::setOverrideCursor(Qt::WaitCursor);
+      // FIRST, count the number of incident cycles and polylines
+      // for all extremities.
+      typedef std::map<Point_3, int> Point_to_int_map;
+      typedef Point_to_int_map::iterator iterator;
+      Point_to_int_map corner_polyline_nb;
+
+      { // scope to fill corner_polyline_nb'
+          Point_to_int_map corner_cycles_nb;
+
+          for(std::list<std::vector<Point_3> >::const_iterator
+              it = item->polylines.begin(),
+              end = item->polylines.end();
+              it != end; ++it)
+          {
+              const K::Point_3& a = *it->begin();
+              const K::Point_3& b = *it->rbegin();
+              if(a == b) {
+                  if ( it->size()>1 )
+                      ++corner_cycles_nb[a];
+                  else
+                      ++corner_polyline_nb[a];
+              }
+              else {
+                  ++corner_polyline_nb[a];
+                  ++corner_polyline_nb[b];
+              }
+          }
+          // THEN, ignore points that are incident to one cycle only.
+          for(iterator
+              c_it = corner_cycles_nb.begin(),
+              end = corner_cycles_nb.end();
+              c_it != end; ++c_it)
+          {
+              const Point_3& a = c_it->first;
+
+              iterator p_it = corner_polyline_nb.find(a);
+
+              // If the point 'a'=c_it->first has only incident cycles...
+              if(p_it == corner_polyline_nb.end()) {
+                  // ...then count it as a corner only if it has two incident cycles
+                  // or more.
+                  if(c_it->second > 1) {
+                      corner_polyline_nb[a] = c_it->second;
+                  }
+              } else {
+                  // else add the number of cycles.
+                  p_it->second += c_it->second;
+              }
+          }
+      }
+      // At this point, 'corner_polyline_nb' gives the multiplicity of all
+      // corners.
+      //Finds the centers of the spheres and their color
+      for(iterator
+          p_it = corner_polyline_nb.begin(),
+          end = corner_polyline_nb.end();
+          p_it != end; ++p_it)
+      {
+          const K::Point_3& center = p_it->first;
+          int colors[3];
+          switch(p_it->second) {
+          case 1:
+              colors[0] = 0; // black
+              colors[1] = 0;
+              colors[2] = 0;
+              break;
+          case 2:
+              colors[0] = 0; // green
+              colors[1] = 200;
+              colors[2] = 0;
+              break;
+          case 3:
+              colors[0] = 0; // blue
+              colors[1] = 0;
+              colors[2] = 200;
+              break;
+          case 4:
+              colors[0] = 200; //red
+              colors[1] = 0;
+              colors[2] = 0;
+              break;
+          default:
+              colors[0] = 200; //fuschia
+              colors[1] = 0;
+              colors[2] = 200;
+          }
+
+          CGAL::Color c(colors[0], colors[1], colors[2]);
+
+          K::Sphere_3 *sphere = new K::Sphere_3(center, spheres_drawn_radius);
+          spheres->add_sphere(sphere, c);
+      }
+      QApplication::restoreOverrideCursor();
+}
+
+Scene_polylines_item::Scene_polylines_item() 
+    :CGAL::Three::Scene_group_item("unnamed",Scene_polylines_item_private::NbOfVbos,Scene_polylines_item_private::NbOfVaos)
+    ,d(new Scene_polylines_item_private(this))
+{
+    setRenderingMode(FlatPlusEdges);
+    d->nb_lines = 0;
+    d->spheres = NULL;
+    invalidateOpenGLBuffers();
+
+}
+
+Scene_polylines_item::~Scene_polylines_item()
+{
+    delete d;
+
+}
+
+bool
+Scene_polylines_item::isEmpty() const {
+    return polylines.empty();
+}
+
+void
+Scene_polylines_item::compute_bbox() const {
+    typedef K::Iso_cuboid_3 Iso_cuboid_3;
+
+    if(isEmpty())
+    {
+        _bbox =Bbox();
+        return;
+    }
+    std::list<Point_3> boxes;
+    for(std::list<std::vector<Point_3> >::const_iterator it = polylines.begin();
+        it != polylines.end();
+        ++it){
+        if(it->begin() != it->end()) {
+            Iso_cuboid_3 cub = CGAL::bounding_box(it->begin(), it->end());
+            boxes.push_back((cub.min)());
+            boxes.push_back((cub.max)());
+        }
+    }
+    Iso_cuboid_3 bbox =
+            boxes.begin() != boxes.end() ?
+                CGAL::bounding_box(boxes.begin(), boxes.end()) :
+                Iso_cuboid_3();
+
+    _bbox = Bbox(bbox.xmin(),
+                bbox.ymin(),
+                bbox.zmin(),
+                bbox.xmax(),
+                bbox.ymax(),
+                bbox.zmax());
+}
+
+Scene_item::Bbox Scene_polylines_item::bbox() const
+{
+  if(!is_bbox_computed)
+      compute_bbox();
+  is_bbox_computed = true;
+  return _bbox;
+}
+Scene_polylines_item* 
+Scene_polylines_item::clone() const {
+    Scene_polylines_item* item = new Scene_polylines_item;
+    item->polylines = polylines;
+    QVariant metadata_variant = property("polylines metadata");
+    if(metadata_variant.type() == QVariant::StringList)
+    {
+        item->setProperty("polylines metadata", metadata_variant);
+    }
+    return item;
+}
+
+QString
+Scene_polylines_item::toolTip() const {
+    QString s =
+            tr("<p><b>%1</b> (mode: %2, color: %3)<br />"
+               "<i>Polylines</i></p>"
+               "<p>Number of polylines: %4</p>")
+            .arg(this->name())
+            .arg(this->renderingModeName())
+            .arg(this->color().name())
+            .arg(polylines.size());
+    if(d->draw_extremities) {
+        s += tr("<p>Legende of endpoints colors: <ul>"
+                "<li>black: one incident polyline</li>"
+                "<li>green: two incident polylines</li>"
+                "<li>blue: three incident polylines</li>"
+                "<li>red: four incident polylines</li>"
+                "<li>fuchsia: five or more incident polylines</li>"
+                "</ul></p>");
+    }
+    return s;
+}
+
+bool
+Scene_polylines_item::supportsRenderingMode(RenderingMode m) const {
+    return (m == Wireframe ||
+            m == FlatPlusEdges ||
+            m == Points);
+}
+
+// Shaded OpenGL drawing: only draw spheres
+void
+Scene_polylines_item::draw(CGAL::Three::Viewer_interface* viewer) const {
+
+    if(!are_buffers_filled)
+    {
+        d->computeElements();
+        d->initializeBuffers(viewer);
+    }
+    if(d->draw_extremities)
+    {
+      Scene_group_item::draw(viewer);
+    }
+}
+
+// Wireframe OpenGL drawing
+void 
+Scene_polylines_item::drawEdges(CGAL::Three::Viewer_interface* viewer) const {
+    if(!are_buffers_filled)
+    {
+        d->computeElements();
+        d->initializeBuffers(viewer);
+    }
+
+    vaos[Scene_polylines_item_private::Edges]->bind();
+    attribBuffers(viewer, PROGRAM_NO_SELECTION);
+    QOpenGLShaderProgram *program = getShaderProgram(PROGRAM_NO_SELECTION);
+    program->bind();
+    program->setAttributeValue("colors", this->color());
+    viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(d->nb_lines/4));
+    program->release();
+    vaos[Scene_polylines_item_private::Edges]->release();
+    if(d->draw_extremities)
+    {
+       Scene_group_item::drawEdges(viewer);
+    }
+
+}
+
+void 
+Scene_polylines_item::drawPoints(CGAL::Three::Viewer_interface* viewer) const {
+    if(!are_buffers_filled)
+    {
+        d->computeElements();
+        d->initializeBuffers(viewer);
+    }
+
+    vaos[Scene_polylines_item_private::Edges]->bind();
+    attribBuffers(viewer, PROGRAM_NO_SELECTION);
+    QOpenGLShaderProgram *program = getShaderProgram(PROGRAM_NO_SELECTION);
+    program->bind();
+    QColor temp = this->color();
+    program->setAttributeValue("colors", temp);
+    viewer->glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(d->nb_lines/4));
+    // Clean-up
+   vaos[Scene_polylines_item_private::Edges]->release();
+   program->release();
+   if(d->draw_extremities)
+   {
+      Scene_group_item::drawPoints(viewer);
+   }
+}
+
+QMenu* Scene_polylines_item::contextMenu() 
+{
+    const char* prop_name = "Menu modified by Scene_polylines_item.";
+
+    QMenu* menu = Scene_item::contextMenu();
+
+    // Use dynamic properties:
+    // http://doc.qt.io/qt-5/qobject.html#property
+    bool menuChanged = menu->property(prop_name).toBool();
+
+    if(!menuChanged) {
+        menu->addSeparator();
+        // TODO: add actions to display corners
+        QAction* action = menu->addAction(tr("Display corners with radius..."));
+        connect(action, SIGNAL(triggered()),
+                this, SLOT(change_corner_radii()));
+
+        QAction* actionSmoothPolylines =
+                menu->addAction(tr("Smooth polylines"));
+        actionSmoothPolylines->setObjectName("actionSmoothPolylines");
+        connect(actionSmoothPolylines, SIGNAL(triggered()),this, SLOT(smooth()));
+        menu->setProperty(prop_name, true);
+    }
+    return menu;
+}
+
+void Scene_polylines_item::invalidateOpenGLBuffers()
+{
+    are_buffers_filled = false;
+    compute_bbox();
+
+
+}
+
+void Scene_polylines_item::change_corner_radii() {
+    bool ok = true;
+    double proposed_radius = d->spheres_drawn_radius;
+    if(proposed_radius == 0) {
+        CGAL::Three::Scene_interface::Bbox b = bbox();
+        proposed_radius = (std::max)(b.xmax() - b.xmin(),
+                                     proposed_radius);
+        proposed_radius = (std::max)(b.ymax() - b.ymin(),
+                                     proposed_radius);
+        proposed_radius = (std::max)(b.zmax() - b.zmin(),
+                                     proposed_radius);
+        proposed_radius /= 100;
+    }
+    double r = QInputDialog::getDouble(NULL,
+                                       tr("Display corners with new radius..."),
+                                       tr("Radius:"),
+                                       proposed_radius, // value
+                                       0.,          // min
+                                       2147483647., // max
+                                       10,          // decimals
+                                       &ok);
+    if(ok) {
+        change_corner_radii(r);
+    }
+}
+
+void Scene_polylines_item::change_corner_radii(double r) {
+    if(r >= 0) {
+        d->spheres_drawn_radius = r;
+        d->draw_extremities = (r > 0);
+        if(r>0 && !d->spheres)
+        {
+          d->spheres = new Scene_spheres_item(this, false);
+          d->spheres->setName("Corner spheres");
+          d->spheres->setRenderingMode(Gouraud);
+          connect(d->spheres, SIGNAL(destroyed()), this, SLOT(reset_spheres()));
+          scene->addItem(d->spheres);
+          scene->changeGroup(d->spheres, this);
+          lockChild(d->spheres);
+          d->computeSpheres();
+          d->spheres->invalidateOpenGLBuffers();
+        }
+        else if(r>0 && d->spheres)
+        {
+          d->computeSpheres();
+          d->spheres->invalidateOpenGLBuffers();
+        }
+        else if (r<=0 && d->spheres!=NULL)
+        {
+          unlockChild(d->spheres);
+          scene->erase(scene->item_id(d->spheres));
+        }
+    Q_EMIT itemChanged();
+    }
+}
+
+void Scene_polylines_item::split_at_sharp_angles()
+{
+    typedef Polylines_container Bare_polyline_container;
+    typedef Polyline Bare_polyline;
+    Polylines_container& bare_polylines = polylines;
+
+    int counter = 0;
+    for(Bare_polyline_container::iterator
+        bare_polyline_it = bare_polylines.begin();
+        bare_polyline_it != bare_polylines.end(); // the end changes
+        // during the loop
+        ++counter /* bare_polyline_it is incremented in the loop */)
+    {
+        Bare_polyline_container::iterator current_polyline_it =
+                bare_polyline_it;
+        Bare_polyline& bare_polyline = *bare_polyline_it;
+        Bare_polyline::iterator it = boost::next(bare_polyline.begin());
+
+        if(boost::next(bare_polyline.begin()) == bare_polyline.end())
+        {
+            std::cerr << "WARNING: Isolated point in polylines\n";
+            bare_polyline_it = bare_polylines.erase(bare_polyline_it);
+            continue;
+        }
+        else
+            ++bare_polyline_it;
+        if(it != bare_polyline.end()) {
+            for(; it != boost::prior(bare_polyline.end()); ++it) {
+                const Point_3 pv = *it;
+                const Point_3 pa = *boost::prior(it);
+                const Point_3 pb = *boost::next(it);
+                const K::Vector_3 av = pv - pa;
+                const K::Vector_3 bv = pv - pb;
+                const K::FT sc_prod = av * bv;
+                if( sc_prod >= 0 ||
+                        (sc_prod < 0 &&
+                         CGAL::square(sc_prod) < (av * av) * (bv * bv) / 4 ) )
+                {
+#ifdef PROTECTION_DEBUG
+                    std::cerr << "Split polyline (small angle) "
+                              <<  std::acos(sqrt(CGAL::square(sc_prod) /
+                                                 ((av*av) * (bv*bv)))) * 180 /CGAL_PI
+                               << " degres\n";
+#endif
+                    Bare_polyline new_polyline;
+                    std::copy(it, bare_polyline.end(),
+                              std::back_inserter(new_polyline));
+
+                    if(*bare_polyline.begin() == *bare_polyline.rbegin()) {
+                        // if the polyline is a cycle, test if its beginning is a sharp
+                        // angle...
+                        const Point_3 pv = *bare_polyline.begin();
+                        const Point_3 pa = *boost::prior(boost::prior(bare_polyline.end()));
+                        const Point_3 pb = *boost::next(bare_polyline.begin());
+                        const K::Vector_3 av = pv - pa;
+                        const K::Vector_3 bv = pv - pb;
+                        const K::FT sc_prod = av * bv;
+                        if( sc_prod >= 0 ||
+                                (sc_prod < 0 &&
+                                 CGAL::square(sc_prod) < (av * av) * (bv * bv) / 4 ) )
+                        {
+                            // if its beginning is a sharp angle, then split
+                            bare_polyline.erase(boost::next(it), bare_polyline.end());
+                        }
+                        else {
+                            // ...if not, modifies its beginning
+                            std::copy(boost::next(bare_polyline.begin()),
+                                      boost::next(it),
+                                      std::back_inserter(new_polyline));
+                            bare_polylines.erase(current_polyline_it);
+                        }
+                    }
+                    else {
+                        bare_polyline.erase(boost::next(it), bare_polyline.end());
+                    }
+                    bare_polylines.push_back(new_polyline);
+                    break;
+                }
+            }
+        }
+    }
+  Q_EMIT itemChanged();
+}
+
+void
+Scene_polylines_item::merge(Scene_polylines_item* other_item) {
+    if(other_item == 0) return;
+    std::copy(other_item->polylines.begin(),
+              other_item->polylines.end(),
+              std::back_inserter(polylines));
+    QVariant other_metadata_variant = other_item->property("polylines metadata");
+    if(other_metadata_variant.type() == QVariant::StringList)
+    {
+        QStringList metadata = property("polylines metadata").toStringList();
+        metadata.append(other_metadata_variant.toStringList());
+        setProperty("polylines metadata", metadata);
+    }
+    invalidateOpenGLBuffers();
+}
+
+void Scene_polylines_item::reset_spheres()
+{
+  d->spheres = NULL;
+}
+
+void Scene_polylines_item::smooth(){
+    for (Polylines_container::iterator pit=polylines.begin(),pit_end=polylines.end();pit!=pit_end;++pit)
+        smooth(*pit);
+  invalidateOpenGLBuffers();
+  Q_EMIT itemChanged();
+}
+
+void Scene_polylines_item::smooth(std::vector<Point_3>& polyline){
+    bool is_closed = polyline.front()==polyline.back();
+    typedef K::Vector_3 Vector_3;
+
+    std::size_t start = is_closed ? 0:1;
+    std::size_t end   = polyline.size()-1;
+
+    Vector_3 prev = (is_closed ? polyline[end-1] : polyline[0]) - CGAL::ORIGIN;
+
+    for (std::size_t i=start; i!=end; ++i)
+    {
+        Vector_3 curr = polyline[i] - CGAL::ORIGIN;
+        Vector_3 next = polyline[i+1] - CGAL::ORIGIN;
+
+        polyline[i] = CGAL::ORIGIN+(prev+2*curr+next)/4;
+        prev=curr;
+    }
+
+    if (is_closed) polyline[end]=polyline[0];
+}
diff --git a/3rdparty/CGAL/demo/Polyhedron/Scene_polylines_item.h b/3rdparty/CGAL/demo/Polyhedron/Scene_polylines_item.h
new file mode 100644
index 0000000..8227051
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Scene_polylines_item.h
@@ -0,0 +1,76 @@
+#ifndef SCENE_POLYLINES_ITEM_H
+#define SCENE_POLYLINES_ITEM_H
+#include "Scene_polylines_item_config.h"
+#include <CGAL/Three/Viewer_interface.h>
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+#include <CGAL/Three/Scene_group_item.h>
+
+#include <QString>
+#include <QMenu>
+
+#include <list>
+#include <vector>
+
+struct Scene_polylines_item_private;
+class Scene_spheres_item;
+
+class SCENE_POLYLINES_ITEM_EXPORT Scene_polylines_item : public CGAL::Three::Scene_group_item
+{
+    Q_OBJECT
+public:
+    typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
+    typedef K::Point_3 Point_3;
+    typedef std::vector<Point_3> Polyline;
+    typedef std::list<Polyline> Polylines_container;
+
+    Scene_polylines_item();
+    virtual ~Scene_polylines_item();
+
+    bool isFinite() const { return true; }
+    bool isEmpty() const;
+    void compute_bbox() const;
+    Bbox bbox() const;
+
+    Scene_polylines_item* clone() const;
+
+    QString toolTip() const;
+
+    // Indicate if rendering mode is supported
+    bool supportsRenderingMode(RenderingMode m) const;
+
+    QMenu* contextMenu();
+
+    // Flat/Gouraud OpenGL drawing
+    void draw() const {}
+    void draw(CGAL::Three::Viewer_interface*) const;
+
+    // Wireframe OpenGL drawing
+    void drawEdges() const{}
+    void drawEdges(CGAL::Three::Viewer_interface*) const;
+
+    void drawPoints() const{}
+    void drawPoints(CGAL::Three::Viewer_interface*) const;
+
+
+    void smooth(std::vector<Point_3>& polyline);
+
+public Q_SLOTS:
+    virtual void invalidateOpenGLBuffers();
+    void change_corner_radii(double);
+    void change_corner_radii();
+    void split_at_sharp_angles();
+    void reset_spheres();
+
+    void merge(Scene_polylines_item*);
+
+    void smooth();
+public:
+    Polylines_container polylines;
+protected:
+    // http://en.wikipedia.org/wiki/D-pointer
+    friend struct Scene_polylines_item_private;
+    Scene_polylines_item_private* d;
+
+}; // end class Scene_polylines_item
+
+#endif
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polylines_item_config.h b/3rdparty/CGAL/demo/Polyhedron/Scene_polylines_item_config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Scene_polylines_item_config.h
rename to 3rdparty/CGAL/demo/Polyhedron/Scene_polylines_item_config.h
diff --git a/3rdparty/CGAL/demo/Polyhedron/Scene_spheres_item.cpp b/3rdparty/CGAL/demo/Polyhedron/Scene_spheres_item.cpp
new file mode 100644
index 0000000..f88071c
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Scene_spheres_item.cpp
@@ -0,0 +1,283 @@
+#include "Scene_spheres_item.h"
+#include <QApplication>
+
+struct Scene_spheres_item_priv
+{
+  typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
+  typedef std::pair<CGAL::Sphere_3<Kernel>*, CGAL::Color> Sphere_pair ;
+
+  Scene_spheres_item_priv(bool planed, Scene_spheres_item* parent)
+    :precision(36)
+    ,has_plane(planed)
+
+  {
+    item = parent;
+    create_flat_and_wire_sphere(1.0f,vertices,normals, edges);
+  }
+
+  ~Scene_spheres_item_priv() {
+    Q_FOREACH(Sphere_pair sphere, spheres)
+      delete sphere.first;
+  }
+  void initializeBuffers(CGAL::Three::Viewer_interface *viewer)const;
+  enum Vbos
+  {
+    Vertices = 0,
+    Edge_vertices,
+    Normals,
+    Center,
+    Radius,
+    Color,
+    Edge_color,
+    NbOfVbos
+  };
+  enum Vaos
+  {
+    Facets = 0,
+    Edges,
+    NbOfVaos
+  };
+
+
+  int precision;
+  mutable CGAL::Plane_3<Kernel> plane;
+  bool has_plane;
+
+  QList<Sphere_pair> spheres;
+  mutable std::vector<float> vertices;
+  mutable std::vector<float> normals;
+  mutable std::vector<float> edges;
+  mutable std::vector<float> colors;
+  mutable std::vector<float> edges_colors;
+  mutable std::vector<float> centers;
+  mutable std::vector<float> radius;
+  mutable QOpenGLShaderProgram *program;
+  mutable int nb_centers;
+  Scene_spheres_item* item;
+
+};
+Scene_spheres_item::Scene_spheres_item(Scene_group_item* parent, bool planed)
+  :CGAL::Three::Scene_item(Scene_spheres_item_priv::NbOfVbos,Scene_spheres_item_priv::NbOfVaos)
+
+{
+  setParent(parent);
+  d = new Scene_spheres_item_priv(planed, this);
+}
+
+Scene_spheres_item::~Scene_spheres_item()
+{
+  delete d;
+}
+void Scene_spheres_item::computeElements() const
+{
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  d->colors.clear();
+  d->edges_colors.clear();
+  d->centers.clear();
+  d->radius.clear();
+  Q_FOREACH(Sphere_pair sp, d->spheres)
+  {
+    d->colors.push_back((float)sp.second.red()/255);
+    d->colors.push_back((float)sp.second.green()/255);
+    d->colors.push_back((float)sp.second.blue()/255);
+
+    d->edges_colors.push_back((float)sp.second.red()/255);
+    d->edges_colors.push_back((float)sp.second.green()/255);
+    d->edges_colors.push_back((float)sp.second.blue()/255);
+
+    d->centers.push_back(sp.first->center().x());
+    d->centers.push_back(sp.first->center().y());
+    d->centers.push_back(sp.first->center().z());
+
+    d->radius.push_back(sp.first->squared_radius());
+
+  }
+  QApplication::restoreOverrideCursor();
+}
+
+void Scene_spheres_item_priv::initializeBuffers(CGAL::Three::Viewer_interface *viewer) const
+{
+  if(has_plane)
+  {
+    program = item->getShaderProgram(Scene_spheres_item::PROGRAM_CUTPLANE_SPHERES, viewer);
+    item->attribBuffers(viewer, Scene_spheres_item::PROGRAM_CUTPLANE_SPHERES);
+  }
+  else
+  {
+    program = item->getShaderProgram(Scene_spheres_item::PROGRAM_SPHERES, viewer);
+    item->attribBuffers(viewer, Scene_spheres_item::PROGRAM_SPHERES);
+  }
+
+  program->bind();
+  item->vaos[Facets]->bind();
+  item->buffers[Vertices].bind();
+  item->buffers[Vertices].allocate(vertices.data(),
+                             static_cast<int>(vertices.size()*sizeof(float)));
+  program->enableAttributeArray("vertex");
+  program->setAttributeBuffer("vertex", GL_FLOAT, 0, 3);
+  item->buffers[Vertices].release();
+
+  item->buffers[Normals].bind();
+  item->buffers[Normals].allocate(normals.data(),
+                            static_cast<int>(normals.size()*sizeof(float)));
+  program->enableAttributeArray("normals");
+  program->setAttributeBuffer("normals", GL_FLOAT, 0, 3);
+  item->buffers[Normals].release();
+
+  item->buffers[Color].bind();
+  item->buffers[Color].allocate(colors.data(),
+                          static_cast<int>(colors.size()*sizeof(float)));
+  program->enableAttributeArray("colors");
+  program->setAttributeBuffer("colors", GL_FLOAT, 0, 3);
+  item->buffers[Color].release();
+
+  item->buffers[Radius].bind();
+  item->buffers[Radius].allocate(radius.data(),
+                           static_cast<int>(radius.size()*sizeof(float)));
+  program->enableAttributeArray("radius");
+  program->setAttributeBuffer("radius", GL_FLOAT, 0, 1);
+  item->buffers[Radius].release();
+
+  item->buffers[Center].bind();
+  item->buffers[Center].allocate(centers.data(),
+                           static_cast<int>(centers.size()*sizeof(float)));
+  program->enableAttributeArray("center");
+  program->setAttributeBuffer("center", GL_FLOAT, 0, 3);
+  item->buffers[Center].release();
+
+  viewer->glVertexAttribDivisor(program->attributeLocation("center"), 1);
+  viewer->glVertexAttribDivisor(program->attributeLocation("radius"), 1);
+  viewer->glVertexAttribDivisor(program->attributeLocation("colors"), 1);
+  item->vaos[Facets]->release();
+
+
+  item->vaos[Edges]->bind();
+  item->buffers[Edge_vertices].bind();
+  item->buffers[Edge_vertices].allocate(edges.data(),
+                                  static_cast<int>(edges.size()*sizeof(float)));
+  program->enableAttributeArray("vertex");
+  program->setAttributeBuffer("vertex", GL_FLOAT, 0, 3);
+  item->buffers[Edge_vertices].release();
+
+  item->buffers[Normals].bind();
+  program->enableAttributeArray("normals");
+  program->setAttributeBuffer("normals", GL_FLOAT, 0, 3);
+  item->buffers[Normals].release();
+
+  item->buffers[Edge_color].bind();
+  item->buffers[Edge_color].allocate(edges_colors.data(),
+                               static_cast<int>(edges_colors.size()*sizeof(float)));
+  program->enableAttributeArray("colors");
+  program->setAttributeBuffer("colors", GL_FLOAT, 0, 3);
+  item->buffers[Edge_color].release();
+
+  item->buffers[Radius].bind();
+  program->enableAttributeArray("radius");
+  program->setAttributeBuffer("radius", GL_FLOAT, 0, 1);
+  item->buffers[Radius].release();
+
+  item->buffers[Center].bind();
+  program->enableAttributeArray("center");
+  program->setAttributeBuffer("center", GL_FLOAT, 0, 3);
+  item->buffers[Center].release();
+
+  viewer->glVertexAttribDivisor(program->attributeLocation("center"), 1);
+  viewer->glVertexAttribDivisor(program->attributeLocation("radius"), 1);
+  viewer->glVertexAttribDivisor(program->attributeLocation("colors"), 1);
+  item->vaos[Edges]->release();
+
+  program->release();
+
+  nb_centers = static_cast<int>(centers.size());
+  centers.clear();
+  centers.swap(centers);
+  colors.clear();
+  colors.swap(colors);
+  radius.clear();
+  radius.swap(radius);
+  edges_colors.clear();
+  edges_colors.swap(edges_colors);
+
+  item->are_buffers_filled = true;
+}
+
+void Scene_spheres_item::draw(Viewer_interface *viewer) const
+{
+  if (!are_buffers_filled)
+  {
+    computeElements();
+    d->initializeBuffers(viewer);
+  }
+  vaos[Scene_spheres_item_priv::Facets]->bind();
+  if(d->has_plane)
+  {
+    d->program = getShaderProgram(PROGRAM_CUTPLANE_SPHERES, viewer);
+    attribBuffers(viewer, PROGRAM_CUTPLANE_SPHERES);
+    d->program->bind();
+    QVector4D cp(d->plane.a(),d->plane.b(),d->plane.c(),d->plane.d());
+    d->program->setUniformValue("cutplane", cp);
+
+  }
+  else
+  {
+    d->program = getShaderProgram(PROGRAM_SPHERES, viewer);
+    attribBuffers(viewer, PROGRAM_SPHERES);
+    d->program->bind();
+  }
+  viewer->glDrawArraysInstanced(GL_TRIANGLES, 0,
+                                static_cast<GLsizei>(d->vertices.size()/3),
+                                static_cast<GLsizei>(d->nb_centers));
+  d->program->release();
+  vaos[Scene_spheres_item_priv::Facets]->release();
+}
+void Scene_spheres_item::drawEdges(Viewer_interface *viewer) const
+{
+  if (!are_buffers_filled)
+  {
+    computeElements();
+    d->initializeBuffers(viewer);
+  }
+  vaos[Scene_spheres_item_priv::Edges]->bind();
+  if(d->has_plane)
+  {
+    d->program = getShaderProgram(PROGRAM_CUTPLANE_SPHERES, viewer);
+    attribBuffers(viewer, PROGRAM_CUTPLANE_SPHERES);
+    d->program->bind();
+    QVector4D cp(d->plane.a(),d->plane.b(),d->plane.c(),d->plane.d());
+    d->program->setUniformValue("cutplane", cp);
+  }
+  else
+  {
+    d->program = getShaderProgram(PROGRAM_SPHERES, viewer);
+    attribBuffers(viewer, PROGRAM_SPHERES);
+    d->program->bind();
+  }
+  viewer->glDrawArraysInstanced(GL_LINES, 0,
+                                static_cast<GLsizei>(d->edges.size()/3),
+                                static_cast<GLsizei>(d->nb_centers));
+  d->program->release();
+  vaos[Scene_spheres_item_priv::Edges]->release();
+}
+void Scene_spheres_item::add_sphere(CGAL::Sphere_3<Kernel> *sphere, CGAL::Color color)
+{
+  Scene_spheres_item::Sphere_pair pair_(sphere, color);
+  d->spheres.append(pair_);
+}
+
+void Scene_spheres_item::remove_sphere(CGAL::Sphere_3<Kernel> *sphere)
+{
+  Q_FOREACH(Sphere_pair pair_, d->spheres)
+    if(pair_.first == sphere)
+    {
+      d->spheres.removeAll(pair_);
+      break;
+    }
+}
+
+void Scene_spheres_item::clear_spheres()
+{
+  d->spheres.clear();
+}
+void Scene_spheres_item::setPrecision(int prec) { d->precision = prec; }
+void Scene_spheres_item::setPlane(Kernel::Plane_3 p_plane) { d->plane = p_plane; }
+void Scene_spheres_item::invalidateOpenGLBuffers(){are_buffers_filled = false;}
diff --git a/3rdparty/CGAL/demo/Polyhedron/Scene_spheres_item.h b/3rdparty/CGAL/demo/Polyhedron/Scene_spheres_item.h
new file mode 100644
index 0000000..d4a1a99
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Scene_spheres_item.h
@@ -0,0 +1,54 @@
+#ifndef SCENE_SPHERES_ITEM_H
+#define SCENE_SPHERES_ITEM_H
+#include "Scene_basic_objects_config.h"
+#include "create_sphere.h"
+
+#include <CGAL/Three/Scene_group_item.h>
+#include <CGAL/Three/Scene_item.h>
+#include <CGAL/Three/Scene_interface.h>
+#include <CGAL/Three/Viewer_interface.h>
+#include <CGAL/Sphere_3.h>
+#include <CGAL/Plane_3.h>
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+#include <QOpenGLShaderProgram>
+
+#include <QList>
+#include <vector>
+struct Scene_spheres_item_priv;
+class SCENE_BASIC_OBJECTS_EXPORT Scene_spheres_item
+    : public CGAL::Three::Scene_item
+{
+  Q_OBJECT
+public:
+  typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
+  typedef std::pair<CGAL::Sphere_3<Kernel>*, CGAL::Color> Sphere_pair ;
+
+  Scene_spheres_item(Scene_group_item* parent, bool planed = false);
+
+  ~Scene_spheres_item();
+
+  bool isFinite() const { return false; }
+  bool isEmpty() const { return false; }
+  Scene_item* clone() const {return 0;}
+  QString toolTip() const {return QString();}
+  bool supportsRenderingMode(RenderingMode m) const {
+    return (m == Gouraud || m == Wireframe);
+  }
+  void compute_bbox() const { _bbox = Bbox(); }
+  void add_sphere(CGAL::Sphere_3<Kernel>* sphere, CGAL::Color = CGAL::Color(120,120,120));
+  void remove_sphere(CGAL::Sphere_3<Kernel>* sphere);
+  void clear_spheres();
+  void setPrecision(int prec);
+
+  void draw(CGAL::Three::Viewer_interface* viewer) const;
+  void drawEdges(CGAL::Three::Viewer_interface* viewer) const;
+  void invalidateOpenGLBuffers();
+  void computeElements() const;
+  void setPlane(Kernel::Plane_3 p_plane);
+
+protected:
+  friend struct Scene_spheres_item_priv;
+  Scene_spheres_item_priv* d;
+};
+
+#endif // SCENE_SPHERES_ITEM_H
diff --git a/3rdparty/CGAL/demo/Polyhedron/Scene_surface_mesh_item.cpp b/3rdparty/CGAL/demo/Polyhedron/Scene_surface_mesh_item.cpp
new file mode 100644
index 0000000..256528b
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Scene_surface_mesh_item.cpp
@@ -0,0 +1,606 @@
+#include "Scene_surface_mesh_item.h"
+
+#include <queue>
+#include <boost/graph/properties.hpp>
+#include <boost/graph/graph_traits.hpp>
+#include <QOpenGLShaderProgram>
+#include <QOpenGLBuffer>
+#include <QApplication>
+
+#include <CGAL/boost/graph/properties_Surface_mesh.h>
+#include <CGAL/Surface_mesh/Surface_mesh.h>
+
+#include <CGAL/Polygon_mesh_processing/compute_normal.h>
+#include "triangulate_primitive.h"
+
+typedef boost::graph_traits<Scene_surface_mesh_item::SMesh>::face_descriptor face_descriptor;
+typedef boost::graph_traits<Scene_surface_mesh_item::SMesh>::halfedge_descriptor halfedge_descriptor;
+typedef boost::graph_traits<Scene_surface_mesh_item::SMesh>::vertex_descriptor vertex_descriptor;
+
+
+struct Scene_surface_mesh_item_priv{
+
+  typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
+  typedef Kernel::Point_3 Point;
+  typedef CGAL::Surface_mesh<Point> SMesh;
+  typedef boost::graph_traits<SMesh>::face_descriptor face_descriptor;
+
+
+  Scene_surface_mesh_item_priv(const Scene_surface_mesh_item& other, Scene_surface_mesh_item* parent):
+    smesh_(new SMesh(*other.d->smesh_)),
+    idx_data_(other.d->idx_data_),
+    idx_edge_data_(other.d->idx_edge_data_)
+  {
+    item = parent;
+  }
+
+  Scene_surface_mesh_item_priv(SMesh* sm, Scene_surface_mesh_item *parent):
+    smesh_(sm)
+  {
+    item = parent;
+  }
+
+  ~Scene_surface_mesh_item_priv()
+  {
+    delete smesh_;
+  }
+
+  void initializeBuffers(CGAL::Three::Viewer_interface *) const;
+  void addFlatData(Point, Kernel::Vector_3, CGAL::Color *) const;
+
+  //! \brief triangulate_facet Triangulates a facet.
+  //! \param fd a face_descriptor of the facet that needs to be triangulated.
+  //! \param fnormals a property_map containing the normals of the mesh.
+  //! \param fcolors a property_map containing the colors of the mesh
+  //! \param im a property_map containing the indices of the vertices of the mesh
+  //! \param index if true, the function will fill the index vector. If false, the function will
+  //! fill the flat data vectors.
+  void
+  triangulate_facet(face_descriptor fd,
+                    SMesh::Property_map<face_descriptor, Kernel::Vector_3 > *fnormals,
+                    SMesh::Property_map<face_descriptor, CGAL::Color> *fcolors,
+                    boost::property_map< SMesh, boost::vertex_index_t >::type* im,
+                    bool index) const;
+  void compute_elements();
+  void checkFloat() const;
+
+  enum VAOs {
+   Flat_facets = 0,
+   Smooth_facets,
+   Edges,
+   NbOfVaos
+  };
+  enum VBOs {
+    Flat_vertices = 0,
+    Smooth_vertices,
+    Flat_normals,
+    Smooth_normals,
+    VColors,
+    FColors,
+    NbOfVbos
+  };
+
+  mutable bool floated;
+  mutable bool has_vcolors;
+  mutable bool has_fcolors;
+  SMesh* smesh_;
+  mutable bool is_filled;
+  mutable bool isinit;
+  mutable std::vector<unsigned int> idx_data_;
+  std::vector<unsigned int> idx_edge_data_;
+  mutable std::vector<cgal_gl_data> smooth_vertices;
+  mutable std::vector<cgal_gl_data> smooth_normals;
+  mutable std::vector<cgal_gl_data> flat_vertices;
+  mutable std::vector<cgal_gl_data> flat_normals;
+  mutable std::vector<cgal_gl_data> f_colors;
+  mutable std::vector<cgal_gl_data> v_colors;
+  mutable QOpenGLShaderProgram *program;
+  Scene_surface_mesh_item *item;
+
+};
+Scene_surface_mesh_item::Scene_surface_mesh_item(const Scene_surface_mesh_item& other)
+  : CGAL::Three::Scene_item(Scene_surface_mesh_item_priv::NbOfVbos,Scene_surface_mesh_item_priv::NbOfVaos)
+{
+  d = new Scene_surface_mesh_item_priv(other, this);
+  are_buffers_filled = false;
+}
+
+Scene_surface_mesh_item::Scene_surface_mesh_item(SMesh* sm)
+  : CGAL::Three::Scene_item(Scene_surface_mesh_item_priv::NbOfVbos,Scene_surface_mesh_item_priv::NbOfVaos)
+{
+  d = new Scene_surface_mesh_item_priv(sm, this);
+  d->floated = false;
+
+  d->has_vcolors = false;
+  d->has_fcolors = false;
+  d->checkFloat();
+  SMesh::Property_map<vertex_descriptor, Kernel::Vector_3 > vnormals =
+    d->smesh_->add_property_map<vertex_descriptor, Kernel::Vector_3 >("v:normal").first;
+
+  SMesh::Property_map<face_descriptor, Kernel::Vector_3 > fnormals =
+      d->smesh_->add_property_map<face_descriptor, Kernel::Vector_3 >("v:normal").first;
+  CGAL::Polygon_mesh_processing::compute_face_normals(*d->smesh_,fnormals);
+
+  typedef boost::graph_traits<SMesh>::face_descriptor face_descriptor;
+  CGAL::Polygon_mesh_processing::compute_vertex_normals(*d->smesh_,vnormals);
+
+
+  boost::property_map< SMesh, boost::vertex_index_t >::type
+    im = get(boost::vertex_index, *d->smesh_);
+
+  d->idx_data_.reserve(num_faces(*d->smesh_) * 3);
+
+  typedef boost::graph_traits<SMesh>::face_descriptor face_descriptor;
+  typedef boost::graph_traits<SMesh>::halfedge_descriptor halfedge_descriptor;
+  typedef boost::graph_traits<SMesh>::edge_descriptor edge_descriptor;
+
+
+
+  BOOST_FOREACH(face_descriptor fd, faces(*d->smesh_))
+  {
+    if(is_triangle(halfedge(fd,*d->smesh_),*d->smesh_))
+    {
+      BOOST_FOREACH(halfedge_descriptor hd, halfedges_around_face(halfedge(fd, *d->smesh_),*d->smesh_))
+      {
+        d->idx_data_.push_back(im[source(hd, *d->smesh_)]);
+      }
+    }
+    else if(is_quad(halfedge(fd,*d->smesh_),*d->smesh_))
+    {
+      halfedge_descriptor hd = halfedge(fd,*d->smesh_);
+      //1st half
+        d->idx_data_.push_back(im[source(hd, *d->smesh_)]);
+        d->idx_data_.push_back(im[source(next(hd, *d->smesh_), *d->smesh_)]);
+        d->idx_data_.push_back(im[source(next(next(hd, *d->smesh_), *d->smesh_), *d->smesh_)]);
+
+        //2nd half
+        d->idx_data_.push_back(im[source(hd, *d->smesh_)]);
+        d->idx_data_.push_back(im[source(next(next(hd, *d->smesh_), *d->smesh_), *d->smesh_)]);
+        d->idx_data_.push_back(im[source(prev(hd, *d->smesh_), *d->smesh_)]);
+    }
+    else
+    {
+      d->triangulate_facet(fd, &fnormals, 0, &im, true);
+    }
+  }
+
+  d->idx_edge_data_.reserve(num_edges(*d->smesh_) * 2);
+  BOOST_FOREACH(edge_descriptor ed, edges(*d->smesh_))
+  {
+    d->idx_edge_data_.push_back(im[source(ed, *d->smesh_)]);
+    d->idx_edge_data_.push_back(im[target(ed, *d->smesh_)]);
+  }
+
+  d->compute_elements();
+  are_buffers_filled = false;
+}
+
+Scene_surface_mesh_item*
+Scene_surface_mesh_item::clone() const
+{ return new Scene_surface_mesh_item(*this); }
+
+void Scene_surface_mesh_item_priv::addFlatData(Point p, Kernel::Vector_3 n, CGAL::Color *c) const
+{
+
+  flat_vertices.push_back((cgal_gl_data)p.x());
+  flat_vertices.push_back((cgal_gl_data)p.y());
+  flat_vertices.push_back((cgal_gl_data)p.z());
+
+  flat_normals.push_back((cgal_gl_data)n.x());
+  flat_normals.push_back((cgal_gl_data)n.y());
+  flat_normals.push_back((cgal_gl_data)n.z());
+
+  if(c != NULL)
+  {
+    f_colors.push_back((float)c->red()/255);
+    f_colors.push_back((float)c->green()/255);
+    f_colors.push_back((float)c->blue()/255);
+  }
+}
+
+void Scene_surface_mesh_item_priv::compute_elements()
+{
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  SMesh::Property_map<vertex_descriptor, SMesh::Point> positions =
+    smesh_->points();
+  SMesh::Property_map<vertex_descriptor, Kernel::Vector_3 > vnormals =
+    smesh_->property_map<vertex_descriptor, Kernel::Vector_3 >("v:normal").first;
+
+  SMesh::Property_map<face_descriptor, Kernel::Vector_3 > fnormals =
+      smesh_->add_property_map<face_descriptor, Kernel::Vector_3 >("v:normal").first;
+
+  SMesh::Property_map<vertex_descriptor, CGAL::Color> vcolors =
+    smesh_->property_map<vertex_descriptor, CGAL::Color >("v:color").first;
+
+  SMesh::Property_map<face_descriptor, CGAL::Color> fcolors =
+      smesh_->property_map<face_descriptor, CGAL::Color >("f:color").first;
+
+  assert(positions.data() != NULL);
+  assert(vnormals.data() != NULL);
+
+  if(smesh_->property_map<vertex_descriptor, CGAL::Color >("v:color").second)
+    has_vcolors = true;
+  if(smesh_->property_map<face_descriptor, CGAL::Color >("f:color").second)
+    has_fcolors = true;
+
+//compute the Flat data
+  flat_vertices.clear();
+  flat_normals.clear();
+
+  BOOST_FOREACH(face_descriptor fd, faces(*smesh_))
+  {
+    if(is_triangle(halfedge(fd,*smesh_),*smesh_))
+    {
+      BOOST_FOREACH(halfedge_descriptor hd, halfedges_around_face(halfedge(fd, *smesh_),*smesh_))
+      {
+        Point p = positions[source(hd, *smesh_)];
+        flat_vertices.push_back((cgal_gl_data)p.x());
+        flat_vertices.push_back((cgal_gl_data)p.y());
+        flat_vertices.push_back((cgal_gl_data)p.z());
+
+        Kernel::Vector_3 n = fnormals[fd];
+        flat_normals.push_back((cgal_gl_data)n.x());
+        flat_normals.push_back((cgal_gl_data)n.y());
+        flat_normals.push_back((cgal_gl_data)n.z());
+
+        if(has_fcolors)
+        {
+          CGAL::Color c = fcolors[fd];
+          f_colors.push_back((float)c.red()/255);
+          f_colors.push_back((float)c.green()/255);
+          f_colors.push_back((float)c.blue()/255);
+        }
+      }
+    }
+    else if(is_quad(halfedge(fd, *smesh_), *smesh_))
+    {
+      //1st half
+      halfedge_descriptor hd = halfedge(fd, *smesh_);
+      Point p = positions[source(hd, *smesh_)];
+      Kernel::Vector_3 n = fnormals[fd];
+      CGAL::Color *c;
+      if(has_fcolors)
+       c= &fcolors[fd];
+      else
+        c = 0;
+      addFlatData(p,n,c);
+
+      hd = next(halfedge(fd, *smesh_),*smesh_);
+      addFlatData(positions[source(hd, *smesh_)]
+          ,fnormals[fd]
+          ,c);
+
+      hd = next(next(halfedge(fd, *smesh_),*smesh_), *smesh_);
+      addFlatData(positions[source(hd, *smesh_)]
+          ,fnormals[fd]
+          ,c);
+      //2nd half
+      hd = halfedge(fd, *smesh_);
+      addFlatData(positions[source(hd, *smesh_)]
+          ,fnormals[fd]
+          ,c);
+
+      hd = next(next(halfedge(fd, *smesh_),*smesh_), *smesh_);
+      addFlatData(positions[source(hd, *smesh_)]
+          ,fnormals[fd]
+          ,c);
+
+      hd = prev(halfedge(fd, *smesh_), *smesh_);
+      addFlatData(positions[source(hd, *smesh_)]
+          ,fnormals[fd]
+          , c);
+    }
+    else
+    {
+      triangulate_facet(fd, &fnormals, &fcolors, 0, false);
+    }
+  }
+
+  if(has_vcolors)
+  {
+    BOOST_FOREACH(vertex_descriptor vd, vertices(*smesh_))
+    {
+      CGAL::Color c = vcolors[vd];
+      v_colors.push_back((float)c.red()/255);
+      v_colors.push_back((float)c.green()/255);
+      v_colors.push_back((float)c.blue()/255);
+    }
+  }
+
+  if(floated)
+  {
+    BOOST_FOREACH(vertex_descriptor vd, vertices(*smesh_))
+    {
+      Point p = positions[vd];
+      smooth_vertices.push_back((cgal_gl_data)p.x());
+      smooth_vertices.push_back((cgal_gl_data)p.y());
+      smooth_vertices.push_back((cgal_gl_data)p.z());
+
+      Kernel::Vector_3 n = vnormals[vd];
+      smooth_normals.push_back((cgal_gl_data)n.x());
+      smooth_normals.push_back((cgal_gl_data)n.y());
+      smooth_normals.push_back((cgal_gl_data)n.z());
+
+    }
+  }
+  QApplication::restoreOverrideCursor();
+}
+void Scene_surface_mesh_item_priv::initializeBuffers(CGAL::Three::Viewer_interface* viewer)const
+{
+  SMesh::Property_map<vertex_descriptor, SMesh::Point> positions =
+    smesh_->points();
+  SMesh::Property_map<vertex_descriptor, Kernel::Vector_3 > vnormals =
+    smesh_->property_map<vertex_descriptor, Kernel::Vector_3 >("v:normal").first;
+  //vao containing the data for the flat facets
+
+  program = item->getShaderProgram(Scene_surface_mesh_item::PROGRAM_WITH_LIGHT, viewer);
+  program->bind();
+
+  item->vaos[Scene_surface_mesh_item_priv::Flat_facets]->bind();
+  item->buffers[Scene_surface_mesh_item_priv::Flat_vertices].bind();
+  item->buffers[Scene_surface_mesh_item_priv::Flat_vertices].allocate(flat_vertices.data(),
+                             static_cast<int>(flat_vertices.size()*sizeof(cgal_gl_data)));
+  program->enableAttributeArray("vertex");
+  program->setAttributeBuffer("vertex",CGAL_GL_DATA,0,3);
+  item->buffers[Scene_surface_mesh_item_priv::Flat_vertices].release();
+
+  item->buffers[Scene_surface_mesh_item_priv::Flat_normals].bind();
+  item->buffers[Scene_surface_mesh_item_priv::Flat_normals].allocate(flat_normals.data(),
+                            static_cast<int>(flat_normals.size()*sizeof(cgal_gl_data)));
+  program->enableAttributeArray("normals");
+  program->setAttributeBuffer("normals",CGAL_GL_DATA,0,3);
+  item->buffers[Scene_surface_mesh_item_priv::Flat_normals].release();
+  if(has_fcolors)
+  {
+    item->buffers[Scene_surface_mesh_item_priv::FColors].bind();
+    item->buffers[Scene_surface_mesh_item_priv::FColors].allocate(f_colors.data(),
+                             static_cast<int>(f_colors.size()*sizeof(cgal_gl_data)));
+    program->enableAttributeArray("colors");
+    program->setAttributeBuffer("colors",CGAL_GL_DATA,0,3);
+    item->buffers[Scene_surface_mesh_item_priv::FColors].release();
+  }
+  item->vaos[Scene_surface_mesh_item_priv::Flat_facets]->release();
+
+  //vao containing the data for the smooth facets
+  item->vaos[Scene_surface_mesh_item_priv::Smooth_facets]->bind();
+  item->buffers[Scene_surface_mesh_item_priv::Smooth_vertices].bind();
+  if(!floated)
+    item->buffers[Scene_surface_mesh_item_priv::Smooth_vertices].allocate(positions.data(),
+                             static_cast<int>(num_vertices(*smesh_)*3*sizeof(cgal_gl_data)));
+  else
+    item->buffers[Scene_surface_mesh_item_priv::Smooth_vertices].allocate(smooth_vertices.data(),
+                               static_cast<int>(num_vertices(*smesh_)*3*sizeof(cgal_gl_data)));
+  program->enableAttributeArray("vertex");
+  program->setAttributeBuffer("vertex",CGAL_GL_DATA,0,3);
+  item->buffers[Scene_surface_mesh_item_priv::Smooth_vertices].release();
+
+
+  item->buffers[Scene_surface_mesh_item_priv::Smooth_normals].bind();
+  if(!floated)
+    item->buffers[Scene_surface_mesh_item_priv::Smooth_normals].allocate(vnormals.data(),
+                                     static_cast<int>(num_vertices(*smesh_)*3*sizeof(cgal_gl_data)));
+  else
+    item->buffers[Scene_surface_mesh_item_priv::Smooth_normals].allocate(smooth_normals.data(),
+                              static_cast<int>(num_vertices(*smesh_)*3*sizeof(cgal_gl_data)));
+  program->enableAttributeArray("normals");
+  program->setAttributeBuffer("normals",CGAL_GL_DATA,0,3);
+  item->buffers[Scene_surface_mesh_item_priv::Smooth_normals].release();
+  if(has_vcolors)
+  {
+    item->buffers[VColors].bind();
+    item->buffers[VColors].allocate(v_colors.data(),
+                             static_cast<int>(v_colors.size()*sizeof(cgal_gl_data)));
+    program->enableAttributeArray("colors");
+    program->setAttributeBuffer("colors",CGAL_GL_DATA,0,3);
+    item->buffers[VColors].release();
+  }
+  item->vaos[Scene_surface_mesh_item_priv::Smooth_facets]->release();
+  program->release();
+
+  //vao for the edges
+  program = item->getShaderProgram(Scene_surface_mesh_item::PROGRAM_WITHOUT_LIGHT, viewer);
+  item->vaos[Scene_surface_mesh_item_priv::Edges]->bind();
+  item->buffers[Scene_surface_mesh_item_priv::Smooth_vertices].bind();
+  program->enableAttributeArray("vertex");
+  program->setAttributeBuffer("vertex",CGAL_GL_DATA,0,3);
+  item->buffers[Scene_surface_mesh_item_priv::Smooth_vertices].release();
+  program->release();
+  item->are_buffers_filled = true;
+}
+
+void Scene_surface_mesh_item::draw(CGAL::Three::Viewer_interface *viewer) const
+{
+  glShadeModel(GL_SMOOTH);
+  if(!are_buffers_filled)
+    d->initializeBuffers(viewer);
+  attribBuffers(viewer, PROGRAM_WITH_LIGHT);
+  d->program = getShaderProgram(PROGRAM_WITH_LIGHT, viewer);
+  d->program->bind();
+
+  if(renderingMode() == Gouraud)
+  {
+    vaos[Scene_surface_mesh_item_priv::Smooth_facets]->bind();
+    if(is_selected)
+      d->program->setAttributeValue("is_selected", true);
+    else
+      d->program->setAttributeValue("is_selected", false);
+      if(!d->has_vcolors)
+        d->program->setAttributeValue("colors", this->color());
+    glDrawElements(GL_TRIANGLES, static_cast<GLuint>(d->idx_data_.size()),
+                   GL_UNSIGNED_INT, d->idx_data_.data());
+    vaos[Scene_surface_mesh_item_priv::Smooth_facets]->release();
+  }
+  else
+  {
+    vaos[Scene_surface_mesh_item_priv::Flat_facets]->bind();
+    d->program->setAttributeValue("colors", this->color());
+    if(is_selected)
+      d->program->setAttributeValue("is_selected", true);
+    else
+      d->program->setAttributeValue("is_selected", false);
+    if(!d->has_fcolors)
+      d->program->setAttributeValue("colors", this->color());
+    glDrawArrays(GL_TRIANGLES,0,static_cast<GLsizei>(d->flat_vertices.size()/3));
+    vaos[Scene_surface_mesh_item_priv::Flat_facets]->release();
+  }
+
+  d->program->release();
+}
+
+void Scene_surface_mesh_item::drawEdges(CGAL::Three::Viewer_interface *viewer) const
+{
+ if(!are_buffers_filled)
+   d->initializeBuffers(viewer);
+ attribBuffers(viewer, PROGRAM_WITHOUT_LIGHT);
+ d->program = getShaderProgram(PROGRAM_WITHOUT_LIGHT, viewer);
+ d->program->bind();
+ vaos[Scene_surface_mesh_item_priv::Edges]->bind();
+ d->program->setAttributeValue("colors", QColor(0,0,0));
+ if(is_selected)
+   d->program->setAttributeValue("is_selected", true);
+ else
+   d->program->setAttributeValue("is_selected", false);
+ glDrawElements(GL_LINES, static_cast<GLuint>(d->idx_edge_data_.size()),
+                GL_UNSIGNED_INT, d->idx_edge_data_.data());
+ vaos[Scene_surface_mesh_item_priv::Edges]->release();
+ d->program->release();
+}
+
+void Scene_surface_mesh_item::drawPoints(CGAL::Three::Viewer_interface *) const
+{
+
+}
+
+void
+Scene_surface_mesh_item::selection_changed(bool p_is_selected)
+{
+  if(p_is_selected != is_selected)
+  {
+    is_selected = p_is_selected;
+  }
+}
+
+bool
+Scene_surface_mesh_item::supportsRenderingMode(RenderingMode m) const
+{ return (m == FlatPlusEdges || m == Wireframe || m == Flat || m == Gouraud); }
+
+CGAL::Three::Scene_item::Bbox Scene_surface_mesh_item::bbox() const
+{
+ if(!is_bbox_computed)
+   compute_bbox();
+ return _bbox;
+}
+
+bool
+Scene_surface_mesh_item::isEmpty() const
+{
+
+  return num_vertices(*d->smesh_)==0;
+}
+
+QString Scene_surface_mesh_item::toolTip() const
+{
+  return QObject::tr("<p>Surface_mesh <b>%1</b> (mode: %5, color: %6)</p>"
+                     "<p>Number of vertices: %2<br />"
+                     "Number of edges: %3<br />"
+                     "Number of faces: %4</p>")
+    .arg(this->name())
+    .arg(num_vertices(*d->smesh_))
+    .arg(num_edges(*d->smesh_))
+    .arg(num_faces(*d->smesh_))
+    .arg(this->renderingModeName())
+    .arg(this->color().name());
+}
+
+void Scene_surface_mesh_item_priv::checkFloat()const
+{
+#if CGAL_IS_FLOAT == 1
+  floated = true;
+#endif
+}
+
+void
+Scene_surface_mesh_item_priv::triangulate_facet(face_descriptor fd,
+                                           SMesh::Property_map<face_descriptor, Kernel::Vector_3> *fnormals,
+                                           SMesh::Property_map<face_descriptor, CGAL::Color> *fcolors,
+                                           boost::property_map< SMesh, boost::vertex_index_t >::type *im,
+                                           bool index) const
+{
+  //Computes the normal of the facet
+  Kernel::Vector_3 normal = get(*fnormals, fd);
+
+  //check if normal contains NaN values
+  if (normal.x() != normal.x() || normal.y() != normal.y() || normal.z() != normal.z())
+  {
+    qDebug()<<"Warning : normal is not valid. Facet not displayed";
+    return;
+  }
+
+  typedef FacetTriangulator<SMesh, Kernel, boost::graph_traits<SMesh>::vertex_descriptor> FT;
+  double diagonal;
+  if(item->diagonalBbox() != std::numeric_limits<double>::infinity())
+    diagonal = item->diagonalBbox();
+  else
+    diagonal = 0.0;
+  FT triangulation(fd,normal,smesh_,diagonal);
+  //iterates on the internal faces
+  for(FT::CDT::Finite_faces_iterator
+       ffit = triangulation.cdt->finite_faces_begin(),
+       end = triangulation.cdt->finite_faces_end();
+       ffit != end; ++ffit)
+  {
+    if(ffit->info().is_external)
+      continue;
+    //add the vertices to the positions
+      //adds the vertices, normals and colors to the appropriate vectors
+    if(!index)
+    {
+      CGAL::Color* color;
+      if(has_fcolors)
+        color = &(*fcolors)[fd];
+      else
+        color = 0;
+
+      addFlatData(ffit->vertex(0)->point(),
+                  (*fnormals)[fd],
+                  color);
+      addFlatData(ffit->vertex(1)->point(),
+                  (*fnormals)[fd],
+                  color);
+
+      addFlatData(ffit->vertex(2)->point(),
+                  (*fnormals)[fd],
+                  color);
+    }
+    //adds the indices to the appropriate vector
+    else
+    {
+      idx_data_.push_back((*im)[triangulation.v2v[ffit->vertex(0)]]);
+      idx_data_.push_back((*im)[triangulation.v2v[ffit->vertex(1)]]);
+      idx_data_.push_back((*im)[triangulation.v2v[ffit->vertex(2)]]);
+    }
+
+  }
+}
+
+Scene_surface_mesh_item::~Scene_surface_mesh_item()
+{
+  delete d;
+}
+Scene_surface_mesh_item::SMesh* Scene_surface_mesh_item::polyhedron() { return d->smesh_; }
+const Scene_surface_mesh_item::SMesh* Scene_surface_mesh_item::polyhedron() const { return d->smesh_; }
+
+void Scene_surface_mesh_item::compute_bbox()const
+{
+  SMesh::Property_map<vertex_descriptor, Point> pprop = d->smesh_->points();
+  CGAL::Bbox_3 bbox;
+
+  BOOST_FOREACH(vertex_descriptor vd,vertices(*d->smesh_))
+  {
+    bbox = bbox + pprop[vd].bbox();
+  }
+  _bbox = Bbox(bbox.xmin(),bbox.ymin(),bbox.zmin(),
+               bbox.xmax(),bbox.ymax(),bbox.zmax());
+
+}
+
diff --git a/3rdparty/CGAL/demo/Polyhedron/Scene_surface_mesh_item.h b/3rdparty/CGAL/demo/Polyhedron/Scene_surface_mesh_item.h
new file mode 100644
index 0000000..2a8f1aa
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Scene_surface_mesh_item.h
@@ -0,0 +1,63 @@
+#ifndef CGAL_SCENE_SURFACE_MESH_ITEM_H
+#define CGAL_SCENE_SURFACE_MESH_ITEM_H
+//Defines the precision of the positions (for performance/precision sake)
+#define CGAL_GL_DATA GL_FLOAT
+#define cgal_gl_data float
+#define CGAL_IS_FLOAT 1
+
+#include "Scene_surface_mesh_item_config.h"
+#include <CGAL/Three/Scene_item.h>
+#include <CGAL/Three/Viewer_interface.h>
+#include <vector>
+
+#include <boost/scoped_ptr.hpp>
+#include <boost/array.hpp>
+
+#include <CGAL/Surface_mesh/Surface_mesh_fwd.h>
+#include <CGAL/boost/graph/graph_traits_Surface_mesh.h>
+
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+
+
+struct Scene_surface_mesh_item_priv;
+
+class SCENE_SURFACE_MESH_ITEM_EXPORT Scene_surface_mesh_item
+  : public CGAL::Three::Scene_item
+{
+  Q_OBJECT
+public:
+  typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
+  typedef Kernel::Point_3 Point;
+  typedef CGAL::Surface_mesh<Point> SMesh;
+  typedef boost::graph_traits<SMesh>::face_descriptor face_descriptor;
+
+  // Takes ownership of the argument.
+  Scene_surface_mesh_item(SMesh*);
+
+  Scene_surface_mesh_item(const Scene_surface_mesh_item& other);
+
+  ~Scene_surface_mesh_item();
+
+  Scene_surface_mesh_item* clone() const;
+  void draw(CGAL::Three::Viewer_interface *) const;
+  void drawEdges(CGAL::Three::Viewer_interface *) const;
+  void drawPoints(CGAL::Three::Viewer_interface *) const;
+
+  bool supportsRenderingMode(RenderingMode m) const;
+  bool isFinite() const { return true; }
+  bool isEmpty() const;
+  Bbox bbox() const;
+  QString toolTip() const;
+
+  SMesh* polyhedron();
+  const SMesh* polyhedron() const;
+  void compute_bbox()const;
+public Q_SLOTS:
+  virtual void selection_changed(bool);
+protected:
+  friend struct Scene_surface_mesh_item_priv;
+  Scene_surface_mesh_item_priv* d;
+};
+
+
+#endif /* CGAL_SCENE_SURFACE_MESH_ITEM_H */
diff --git a/3rdparty/CGAL/demo/Polyhedron/Scene_surface_mesh_item_config.h b/3rdparty/CGAL/demo/Polyhedron/Scene_surface_mesh_item_config.h
new file mode 100644
index 0000000..13a714f
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Scene_surface_mesh_item_config.h
@@ -0,0 +1,10 @@
+#ifndef CGAL_SCENE_SURFACE_MESH_ITEM_CONFIG_H
+#define CGAL_SCENE_SURFACE_MESH_ITEM_CONFIG_H
+
+#ifdef scene_surface_mesh_item_EXPORTS
+#  define SCENE_SURFACE_MESH_ITEM_EXPORT Q_DECL_EXPORT
+#else
+#  define SCENE_SURFACE_MESH_ITEM_EXPORT Q_DECL_IMPORT
+#endif
+
+#endif /* CGAL_SCENE_SURFACE_MESH_ITEM_CONFIG_H */
diff --git a/3rdparty/CGAL/demo/Polyhedron/Scene_textured_polyhedron_item.cpp b/3rdparty/CGAL/demo/Polyhedron/Scene_textured_polyhedron_item.cpp
new file mode 100644
index 0000000..4b09461
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Scene_textured_polyhedron_item.cpp
@@ -0,0 +1,424 @@
+#include "Scene_textured_polyhedron_item.h"
+#include "Textured_polyhedron_type.h"
+#include <CGAL/IO/Polyhedron_iostream.h>
+#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
+#include <CGAL/Polygon_mesh_processing/compute_normal.h>
+#include <QApplication>
+
+#include <QObject>
+
+typedef EPIC_kernel::Point_3 Point;
+
+struct Scene_textured_polyhedron_item_priv
+{
+  Scene_textured_polyhedron_item_priv(Scene_textured_polyhedron_item* parent)
+    :poly(new Textured_polyhedron), textureId(-1)
+  {
+    item = parent;
+    texture.GenerateCheckerBoard(2048,2048,128,0,0,0,250,250,255);
+    nb_facets = 0;
+    nb_lines = 0;
+  }
+  Scene_textured_polyhedron_item_priv(const Textured_polyhedron& p, Scene_textured_polyhedron_item* parent)
+    : poly(new Textured_polyhedron(p)),textureId(-1),smooth_shading(true)
+
+  {
+    item = parent;
+    texture.GenerateCheckerBoard(2048,2048,128,0,0,0,250,250,255);
+    nb_facets = 0;
+    nb_lines = 0;
+  }
+  Scene_textured_polyhedron_item_priv(Textured_polyhedron* const p,Scene_textured_polyhedron_item* parent)
+    :poly(p),textureId(-1),smooth_shading(true)
+  {
+    item = parent;
+    texture.GenerateCheckerBoard(2048,2048,128,0,0,0,250,250,255);
+    nb_facets = 0;
+    nb_lines = 0;
+
+  }
+  ~Scene_textured_polyhedron_item_priv()
+  {
+    delete poly;
+  }
+  void initializeBuffers(CGAL::Three::Viewer_interface *viewer) const;
+  void compute_normals_and_vertices(void) const;
+
+  enum VAOs {
+      Facets=0,
+      Edges,
+      NbOfVaos
+  };
+  enum VBOs {
+      Facets_Vertices=0,
+      Facets_Normals,
+      Facets_Texmap,
+      Edges_Vertices,
+      Edges_Texmap,
+      NbOfVbos
+  };
+
+  Textured_polyhedron* poly;
+  Texture texture;
+  mutable std::vector<float> positions_lines;
+  mutable std::vector<float> positions_facets;
+  mutable std::vector<float> normals;
+  mutable std::vector<float> textures_map_facets;
+  mutable std::vector<float> textures_map_lines;
+  mutable std::size_t nb_facets;
+  mutable std::size_t nb_lines;
+
+  mutable GLuint textureId;
+  mutable QOpenGLShaderProgram* program;
+  bool smooth_shading;
+
+  Scene_textured_polyhedron_item* item;
+};
+void Scene_textured_polyhedron_item_priv::initializeBuffers(CGAL::Three::Viewer_interface *viewer = 0) const
+{
+    if(GLuint(-1) == textureId) {
+        viewer->glGenTextures(1, &textureId);
+    }
+    //vao for the facets
+    {
+        program = item->getShaderProgram(Scene_textured_polyhedron_item::PROGRAM_WITH_TEXTURE, viewer);
+        program->bind();
+        item->vaos[Facets]->bind();
+        item->buffers[Facets_Vertices].bind();
+        item->buffers[Facets_Vertices].allocate(positions_facets.data(),
+                            static_cast<int>(positions_facets.size()*sizeof(float)));
+        program->enableAttributeArray("vertex");
+        program->setAttributeBuffer("vertex",GL_FLOAT,0,4);
+        item->buffers[Facets_Vertices].release();
+
+        item->buffers[Facets_Normals].bind();
+        item->buffers[Facets_Normals].allocate(normals.data(),
+                            static_cast<int>(normals.size()*sizeof(float)));
+        program->enableAttributeArray("normal");
+        program->setAttributeBuffer("normal",GL_FLOAT,0,3);
+        item->buffers[Facets_Normals].release();
+
+
+        item->buffers[Facets_Texmap].bind();
+        item->buffers[Facets_Texmap].allocate(textures_map_facets.data(),
+                            static_cast<int>(textures_map_facets.size()*sizeof(float)));
+        program->enableAttributeArray("v_texCoord");
+        program->setAttributeBuffer("v_texCoord",GL_FLOAT,0,2);
+        item->buffers[Facets_Texmap].release();
+        item->vaos[Facets]->release();
+        program->release();
+    }
+
+    //vao for the lines
+    {
+        program = item->getShaderProgram(Scene_textured_polyhedron_item::PROGRAM_WITH_TEXTURED_EDGES, viewer);
+        program->bind();
+        item->vaos[Edges]->bind();
+        item->buffers[Edges_Vertices].bind();
+        item->buffers[Edges_Vertices].allocate(positions_lines.data(),
+                            static_cast<int>(positions_lines.size()*sizeof(float)));
+        program->enableAttributeArray("vertex");
+        program->setAttributeBuffer("vertex",GL_FLOAT,0,4);
+        item->buffers[Edges_Vertices].release();
+
+
+        item->buffers[Edges_Texmap].bind();
+        item->buffers[Edges_Texmap].allocate(textures_map_lines.data(),
+                            static_cast<int>(textures_map_lines.size()*sizeof(float)));
+        program->enableAttributeArray("v_texCoord");
+        program->setAttributeBuffer("v_texCoord",GL_FLOAT,0,2);
+        item->buffers[Edges_Texmap].release();
+        item->vaos[Edges]->release();
+        program->release();
+    }
+
+    viewer->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+
+    viewer->glActiveTexture(GL_TEXTURE0);
+    viewer->glBindTexture(GL_TEXTURE_2D, textureId);
+    viewer->glTexImage2D(GL_TEXTURE_2D,
+                 0,
+                 GL_RGB,
+                 texture.GetWidth(),
+                 texture.GetHeight(),
+                 0,
+                 GL_RGB,
+                 GL_UNSIGNED_BYTE,
+                 texture.GetData());
+    viewer->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+    viewer->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+    viewer->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+    viewer->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+    glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+
+    nb_facets = positions_facets.size();
+    positions_facets.resize(0);
+    std::vector<float>(positions_facets).swap(positions_facets);
+    normals.resize(0);
+    std::vector<float>(normals).swap(normals);
+    textures_map_facets.resize(0);
+    std::vector<float>(textures_map_facets).swap(textures_map_facets);
+    nb_lines = positions_lines.size();
+    positions_lines.resize(0);
+    std::vector<float>(positions_lines).swap(positions_lines);
+    textures_map_lines.resize(0);
+    std::vector<float>(textures_map_lines).swap(textures_map_lines);
+
+    item->are_buffers_filled = true;
+}
+
+void
+Scene_textured_polyhedron_item_priv::compute_normals_and_vertices(void) const
+{
+    QApplication::setOverrideCursor(Qt::WaitCursor);
+    positions_facets.resize(0);
+    positions_lines.resize(0);
+    textures_map_facets.resize(0);
+    textures_map_lines.resize(0);
+    normals.resize(0);
+
+    typedef ::EPIC_kernel Kernel;
+    typedef CGAL::Textured_items Items;
+    typedef Kernel::Point_3 Point;
+    typedef Kernel::Vector_3 Vector;
+    typedef CGAL::Polyhedron_3<Kernel,Items> Base;
+
+    typedef Base::Halfedge_around_facet_circulator Halfedge_around_facet_circulator;
+    typedef Base::Edge_iterator Edge_iterator;
+    typedef Base::Facet Facet;
+    typedef Base::Facet_iterator Facet_iterator;
+
+    //Facets
+    Facet_iterator f = poly->facets_begin();
+
+    for(f = poly->facets_begin();
+        f != poly->facets_end();
+        f++)
+    {
+
+        Halfedge_around_facet_circulator he = f->facet_begin();
+        Halfedge_around_facet_circulator end = he;
+        CGAL_For_all(he,end)
+        {
+
+            // If Flat shading:1 normal per polygon added once per vertex
+            if (item->cur_shading == Flat || item->cur_shading == FlatPlusEdges)
+            {
+
+                Vector n = CGAL::Polygon_mesh_processing::
+                  compute_face_normal(f, static_cast<Base&>(*poly));
+                normals.push_back(n[0]);
+                normals.push_back(n[1]);
+                normals.push_back(n[2]);
+            }
+
+            // If Gouraud shading: 1 normal per vertex
+            else if(item->cur_shading == Gouraud)
+            {
+
+                const Facet::Normal_3& n = he->vertex()->normal();
+                normals.push_back(n[0]);
+                normals.push_back(n[1]);
+                normals.push_back(n[2]);
+            }
+
+            //position
+            const Point& p = he->vertex()->point();
+            positions_facets.push_back(p.x());
+            positions_facets.push_back(p.y());
+            positions_facets.push_back(p.z());
+            positions_facets.push_back(1.0);
+
+            const double u = he->vertex()->u();
+            const double v = he->vertex()->v();
+            textures_map_facets.push_back(u);
+            textures_map_facets.push_back(v);
+        }
+
+
+    }
+    //Lines
+    typedef Kernel::Point_3		Point;
+    typedef Base::Edge_iterator	Edge_iterator;
+
+    Edge_iterator he;
+
+    for(he = poly->edges_begin();
+        he != poly->edges_end();
+        he++)
+    {
+
+        const Point& a = he->vertex()->point();
+        const Point& b = he->opposite()->vertex()->point();
+        positions_lines.push_back(a.x());
+        positions_lines.push_back(a.y());
+        positions_lines.push_back(a.z());
+        positions_lines.push_back(1.0);
+
+        const double u = he->vertex()->u();
+        const double v = he->vertex()->v();
+        textures_map_lines.push_back(u);
+        textures_map_lines.push_back(v);
+
+        positions_lines.push_back(b.x());
+        positions_lines.push_back(b.y());
+        positions_lines.push_back(b.z());
+        positions_lines.push_back(1.0);
+
+        const double ou = he->opposite()->vertex()->u();
+        const double ov = he->opposite()->vertex()->v();
+        textures_map_lines.push_back(ou);
+        textures_map_lines.push_back(ov);
+
+    }
+    QApplication::restoreOverrideCursor();
+}
+
+Scene_textured_polyhedron_item::Scene_textured_polyhedron_item()
+    : Scene_item(Scene_textured_polyhedron_item_priv::NbOfVbos,Scene_textured_polyhedron_item_priv::NbOfVaos)
+{
+    cur_shading=FlatPlusEdges;
+    is_selected=false;
+    d = new Scene_textured_polyhedron_item_priv(this);
+    invalidateOpenGLBuffers();
+}
+
+Scene_textured_polyhedron_item::Scene_textured_polyhedron_item(Textured_polyhedron* const p)
+    : Scene_item(Scene_textured_polyhedron_item_priv::NbOfVbos,Scene_textured_polyhedron_item_priv::NbOfVaos)
+{
+    cur_shading=FlatPlusEdges;
+    is_selected=false;
+    d = new Scene_textured_polyhedron_item_priv(p,this);
+    invalidateOpenGLBuffers();
+}
+
+Scene_textured_polyhedron_item::Scene_textured_polyhedron_item(const Textured_polyhedron& p)
+    : Scene_item(Scene_textured_polyhedron_item_priv::NbOfVbos,Scene_textured_polyhedron_item_priv::NbOfVaos)
+{
+    cur_shading=FlatPlusEdges;
+    is_selected=false;
+    d = new Scene_textured_polyhedron_item_priv(p,this);
+    invalidateOpenGLBuffers();
+}
+
+Scene_textured_polyhedron_item::~Scene_textured_polyhedron_item()
+{
+    delete d;
+}
+
+Scene_textured_polyhedron_item* 
+Scene_textured_polyhedron_item::clone() const {
+    return new Scene_textured_polyhedron_item(*d->poly);
+}
+
+// Load textured_polyhedron from .OFF file
+bool
+Scene_textured_polyhedron_item::load(std::istream& in)
+{
+    std::cout<<"LOAD"<<std::endl;
+    in >> *d->poly;
+    invalidateOpenGLBuffers();
+    return in && !isEmpty();
+}
+
+// Write textured_polyhedron to .OFF file
+bool 
+Scene_textured_polyhedron_item::save(std::ostream& out) const
+{
+    out << *d->poly;
+    return (bool) out;
+}
+
+QString 
+Scene_textured_polyhedron_item::toolTip() const
+{
+    if(!d->poly)
+        return QString();
+
+    return QObject::tr("<p>Textured polyhedron <b>%1</b> (mode: %5, color: %6)</p>"
+                       "<p>Number of vertices: %2<br />"
+                       "Number of edges: %3<br />"
+                       "Number of facets: %4</p>")
+            .arg(this->name())
+            .arg(d->poly->size_of_vertices())
+            .arg(d->poly->size_of_halfedges()/2)
+            .arg(d->poly->size_of_facets())
+            .arg(this->renderingModeName())
+            .arg(this->color().name());
+}
+
+// Points/Wireframe/Flat/Gouraud OpenGL drawing in a display list
+void Scene_textured_polyhedron_item::draw(CGAL::Three::Viewer_interface* viewer) const {
+
+    if(!are_buffers_filled)
+    {
+        d->compute_normals_and_vertices();
+        d->initializeBuffers(viewer);
+    }
+
+    vaos[Scene_textured_polyhedron_item_priv::Facets]->bind();
+    viewer->glActiveTexture(GL_TEXTURE0);
+    viewer->glBindTexture(GL_TEXTURE_2D, d->textureId);
+    attribBuffers(viewer, PROGRAM_WITH_TEXTURE);
+    d->program=getShaderProgram(PROGRAM_WITH_TEXTURE);
+    d->program->bind();
+    viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(d->nb_facets/4));
+    //Clean-up
+    d->program->release();
+    vaos[Scene_textured_polyhedron_item_priv::Facets]->release();
+}
+void Scene_textured_polyhedron_item::drawEdges(CGAL::Three::Viewer_interface* viewer) const {
+    if(!are_buffers_filled)
+        d->initializeBuffers(viewer);
+
+    vaos[Scene_textured_polyhedron_item_priv::Edges]->bind();
+    viewer->glActiveTexture(GL_TEXTURE0);
+    viewer->glBindTexture(GL_TEXTURE_2D, d->textureId);
+    attribBuffers(viewer, PROGRAM_WITH_TEXTURED_EDGES);
+
+    d->program=getShaderProgram(PROGRAM_WITH_TEXTURED_EDGES);
+    d->program->bind();
+    viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(d->nb_lines/4));
+    //Clean-up
+    d->program->release();
+    vaos[Scene_textured_polyhedron_item_priv::Edges]->release();
+}
+
+Textured_polyhedron* 
+Scene_textured_polyhedron_item::textured_polyhedron()       { return d->poly; }
+const Textured_polyhedron* 
+Scene_textured_polyhedron_item::textured_polyhedron() const { return d->poly; }
+
+bool
+Scene_textured_polyhedron_item::isEmpty() const {
+    return (d->poly == 0) || d->poly->empty();
+}
+
+void
+Scene_textured_polyhedron_item::compute_bbox() const {
+    const Point& p = *(d->poly->points_begin());
+    CGAL::Bbox_3 bbox(p.x(), p.y(), p.z(), p.x(), p.y(), p.z());
+    for(Textured_polyhedron::Point_iterator it = d->poly->points_begin();
+        it != d->poly->points_end();
+        ++it) {
+        bbox = bbox + it->bbox();
+    }
+    _bbox = Bbox(bbox.xmin(),bbox.ymin(),bbox.zmin(),
+                bbox.xmax(),bbox.ymax(),bbox.zmax());
+}
+void
+Scene_textured_polyhedron_item::invalidateOpenGLBuffers()
+{
+    are_buffers_filled = false;
+    compute_bbox();
+}
+void
+Scene_textured_polyhedron_item::selection_changed(bool p_is_selected)
+{
+    if(p_is_selected != is_selected)
+    {
+        is_selected = p_is_selected;
+    }
+    else
+        is_selected = p_is_selected;
+}
diff --git a/3rdparty/CGAL/demo/Polyhedron/Scene_textured_polyhedron_item.h b/3rdparty/CGAL/demo/Polyhedron/Scene_textured_polyhedron_item.h
new file mode 100644
index 0000000..963439b
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Scene_textured_polyhedron_item.h
@@ -0,0 +1,56 @@
+#ifndef SCENE_TEXTURED_POLYHEDRON_ITEM_H
+#define SCENE_TEXTURED_POLYHEDRON_ITEM_H
+#include "Scene_textured_polyhedron_item_config.h"
+#include  <CGAL/Three/Scene_item.h>
+#include <CGAL/Three/Viewer_interface.h>
+#include "Textured_polyhedron_type_fwd.h"
+#include <iostream>
+#include "texture.h"
+
+struct Scene_textured_polyhedron_item_priv;
+// This class represents a textured polyhedron in the OpenGL scene
+class SCENE_TEXTURED_POLYHEDRON_ITEM_EXPORT Scene_textured_polyhedron_item 
+  : public CGAL::Three::Scene_item {
+  Q_OBJECT
+public:  
+  Scene_textured_polyhedron_item();
+//   Scene_textured_polyhedron_item(const Scene_textured_polyhedron_item&);
+  Scene_textured_polyhedron_item(const Textured_polyhedron& p);
+  Scene_textured_polyhedron_item(Textured_polyhedron* const p);
+  ~Scene_textured_polyhedron_item();
+
+  Scene_textured_polyhedron_item* clone() const;
+  
+  // IO
+  bool load(std::istream& in);
+  bool save(std::ostream& out) const;
+
+  // Function for displaying meta-data of the item
+  virtual QString toolTip() const;
+
+  // Indicate if rendering mode is supported
+  virtual bool supportsRenderingMode(RenderingMode m) const { return (m != Splatting && m != PointsPlusNormals && m != Points && m != Gouraud ); }
+  // Points/Wireframe/Flat/Gouraud OpenGL drawing in a display list
+   void draw() const {}
+  virtual void draw(CGAL::Three::Viewer_interface*) const;
+   virtual void drawEdges() const {}
+   virtual void drawEdges(CGAL::Three::Viewer_interface* viewer) const;
+
+  // Get wrapped textured_polyhedron
+  Textured_polyhedron*       textured_polyhedron();
+  const Textured_polyhedron* textured_polyhedron() const;
+
+  // Get dimensions
+  bool isFinite() const { return true; }
+  bool isEmpty() const;
+  void compute_bbox() const;
+
+  virtual void invalidateOpenGLBuffers();
+  virtual void selection_changed(bool);
+
+protected:
+  friend struct Scene_textured_polyhedron_item_priv;
+  Scene_textured_polyhedron_item_priv* d;
+}; // end class Scene_textured_polyhedron_item
+
+#endif // SCENE_TEXTURED_POLYHEDRON_ITEM_H
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Scene_textured_polyhedron_item_config.h b/3rdparty/CGAL/demo/Polyhedron/Scene_textured_polyhedron_item_config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Scene_textured_polyhedron_item_config.h
rename to 3rdparty/CGAL/demo/Polyhedron/Scene_textured_polyhedron_item_config.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Show_point_dialog.cpp b/3rdparty/CGAL/demo/Polyhedron/Show_point_dialog.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Show_point_dialog.cpp
rename to 3rdparty/CGAL/demo/Polyhedron/Show_point_dialog.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Show_point_dialog.h b/3rdparty/CGAL/demo/Polyhedron/Show_point_dialog.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Show_point_dialog.h
rename to 3rdparty/CGAL/demo/Polyhedron/Show_point_dialog.h
diff --git a/3rdparty/CGAL/demo/Polyhedron/Show_point_dialog.ui b/3rdparty/CGAL/demo/Polyhedron/Show_point_dialog.ui
new file mode 100644
index 0000000..1d94c9f
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Show_point_dialog.ui
@@ -0,0 +1,161 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Show_point_dialog</class>
+ <widget class="QDialog" name="Show_point_dialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>575</width>
+    <height>151</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Show Point</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout_2">
+   <item>
+    <layout class="QVBoxLayout" name="verticalLayout">
+     <item>
+      <layout class="QFormLayout" name="formLayout">
+       <property name="fieldGrowthPolicy">
+        <enum>QFormLayout::ExpandingFieldsGrow</enum>
+       </property>
+       <item row="1" column="0">
+        <widget class="QLabel" name="label_7">
+         <property name="text">
+          <string>Point &coordinates</string>
+         </property>
+         <property name="alignment">
+          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+         </property>
+         <property name="buddy">
+          <cstring>lineEdit</cstring>
+         </property>
+        </widget>
+       </item>
+       <item row="1" column="1">
+        <widget class="QLineEdit" name="lineEdit">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+           <horstretch>1</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="toolTip">
+          <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'DejaVu LGC Sans'; font-size:11pt; font-weight:400; font-style:normal;">
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Paste here the coordinates of a point. It can be for example:</p>
+<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&quot;(10., -2e-2, .4)&quot;</p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">or:</p>
+<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&quot;-2 3 5&quot;</p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">or even something with garbage around:</p>
+<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&quot;point  (-2, 5, 0) and...&quot;</p></body></html></string>
+         </property>
+        </widget>
+       </item>
+       <item row="2" column="0">
+        <widget class="QLabel" name="label_x">
+         <property name="text">
+          <string>x</string>
+         </property>
+         <property name="alignment">
+          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+         </property>
+        </widget>
+       </item>
+       <item row="2" column="1">
+        <widget class="QLabel" name="coord_x">
+         <property name="text">
+          <string/>
+         </property>
+        </widget>
+       </item>
+       <item row="3" column="0">
+        <widget class="QLabel" name="label_y">
+         <property name="text">
+          <string>y</string>
+         </property>
+         <property name="alignment">
+          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+         </property>
+        </widget>
+       </item>
+       <item row="3" column="1">
+        <widget class="QLabel" name="coord_y">
+         <property name="text">
+          <string/>
+         </property>
+        </widget>
+       </item>
+       <item row="4" column="0">
+        <widget class="QLabel" name="label_z">
+         <property name="text">
+          <string>z</string>
+         </property>
+         <property name="alignment">
+          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+         </property>
+        </widget>
+       </item>
+       <item row="4" column="1">
+        <widget class="QLabel" name="coord_z">
+         <property name="text">
+          <string/>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+     <item>
+      <widget class="QDialogButtonBox" name="buttonBox">
+       <property name="standardButtons">
+        <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <tabstops>
+  <tabstop>lineEdit</tabstop>
+ </tabstops>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>Show_point_dialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>423</x>
+     <y>120</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>387</x>
+     <y>139</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>Show_point_dialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>520</x>
+     <y>120</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>512</x>
+     <y>138</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Statistics_on_item_dialog.ui b/3rdparty/CGAL/demo/Polyhedron/Statistics_on_item_dialog.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Statistics_on_item_dialog.ui
rename to 3rdparty/CGAL/demo/Polyhedron/Statistics_on_item_dialog.ui
diff --git a/3rdparty/CGAL/demo/Polyhedron/TextRenderer.cpp b/3rdparty/CGAL/demo/Polyhedron/TextRenderer.cpp
new file mode 100644
index 0000000..965764c
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/TextRenderer.cpp
@@ -0,0 +1,92 @@
+#include <CGAL/Three/TextRenderer.h>
+#include <CGAL/Three/Scene_item.h>
+void TextRenderer::draw(CGAL::Three::Viewer_interface *viewer)
+{
+    QPainter *painter = viewer->getPainter();
+    if (!painter->isActive())
+      painter->begin(viewer);
+    QRect rect;
+    qglviewer::Camera* camera = viewer->camera();
+    //Display the items textItems
+    Q_FOREACH(TextListItem* list, textItems)
+      if(list->item() == scene->item(scene->mainSelectionIndex()))
+        Q_FOREACH(TextItem* item, list->textList())
+        {
+          qglviewer::Vec src(item->position().x(), item->position().y(),item->position().z());
+          if(viewer->testDisplayId(src.x, src.y, src.z))
+          {
+            if(item->is_3D())
+              rect = QRect(camera->projectedCoordinatesOf(src).x-item->width()/2,
+                           camera->projectedCoordinatesOf(src).y-item->height()/2,
+                           item->width(),
+                           item->height());
+            else
+              rect = QRect(src.x-item->width()/2,
+                           src.y-item->height()/2,
+                           item->width(),
+                           item->height());
+
+            painter->setFont(item->font());
+            painter->setPen(QPen(item->color()));
+            painter->drawText(rect, item->text());
+          }
+        }
+
+    //Display the local TextItems
+    Q_FOREACH(TextItem* item, local_textItems)
+    {
+      qglviewer::Vec src(item->position().x(), item->position().y(),item->position().z());
+      if(item->is_3D())
+      {
+        if(item->is_always_visible() || viewer->testDisplayId(src.x, src.y, src.z))
+        {
+            rect = QRect(camera->projectedCoordinatesOf(src).x-item->width()/2,
+                       camera->projectedCoordinatesOf(src).y-item->height()/2,
+                       item->width(),
+                       item->height());
+        }
+      }
+      else
+      {
+          rect = QRect(src.x-item->width()/2,
+                     src.y-item->height()/2,
+                     item->width(),
+                     item->height());
+      }
+      painter->setFont(item->font());
+      painter->setPen(QPen(item->color()));
+      painter->drawText(rect, item->text());
+    }
+}
+
+ void TextRenderer::addTextList(TextListItem *tl)
+ {
+   if(tl->textList().size() > max_textItems)
+   {
+     Q_EMIT sendMessage("There are too many textItems to display.",5000);
+     return;
+   }
+     textItems.append(tl);
+ }
+
+ void TextRenderer::addText(TextItem *ti)
+ {
+     local_textItems.append(ti);
+ }
+
+ void TextRenderer::addText(float p_x, float p_y, float p_z, QString p_text, bool p_3D, QFont p_font , QColor p_color )
+ {
+     local_textItems.append(new TextItem(p_x, p_y, p_z, p_text, p_3D, p_font, p_color));
+ }
+
+ void TextRenderer::removeText(TextItem *item)
+ {
+     local_textItems.removeAll(item);
+ }
+
+ void TextRenderer::removeTextList(TextListItem *p_list)
+ {
+     Q_FOREACH(TextListItem *list, textItems)
+         if(list == p_list)
+             textItems.removeAll(list);
+ }
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Textured_polyhedron_type.h b/3rdparty/CGAL/demo/Polyhedron/Textured_polyhedron_type.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Textured_polyhedron_type.h
rename to 3rdparty/CGAL/demo/Polyhedron/Textured_polyhedron_type.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Textured_polyhedron_type_fwd.h b/3rdparty/CGAL/demo/Polyhedron/Textured_polyhedron_type_fwd.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Textured_polyhedron_type_fwd.h
rename to 3rdparty/CGAL/demo/Polyhedron/Textured_polyhedron_type_fwd.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/Travel_isolated_components.h b/3rdparty/CGAL/demo/Polyhedron/Travel_isolated_components.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/Travel_isolated_components.h
rename to 3rdparty/CGAL/demo/Polyhedron/Travel_isolated_components.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/UseCGAL_polyhedron_demo.cmake b/3rdparty/CGAL/demo/Polyhedron/UseCGAL_polyhedron_demo.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/UseCGAL_polyhedron_demo.cmake
rename to 3rdparty/CGAL/demo/Polyhedron/UseCGAL_polyhedron_demo.cmake
diff --git a/3rdparty/CGAL/demo/Polyhedron/Viewer.cpp b/3rdparty/CGAL/demo/Polyhedron/Viewer.cpp
new file mode 100644
index 0000000..1ba9873
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Viewer.cpp
@@ -0,0 +1,1688 @@
+#include "Viewer.h"
+#include <CGAL/gl.h>
+#include <CGAL/Three/Scene_draw_interface.h>
+#include <QMouseEvent>
+#include <QKeyEvent>
+#include <QGLViewer/manipulatedCameraFrame.h>
+#include <QDebug>
+#include <QOpenGLShader>
+#include <QFileDialog>
+#include <QOpenGLShaderProgram>
+#include <QOpenGLFramebufferObject>
+#include <QMessageBox>
+#include <QColorDialog>
+#include <QInputDialog>
+#include <cmath>
+#include <QApplication>
+
+
+class Viewer_impl {
+public:
+  CGAL::Three::Scene_draw_interface* scene;
+  bool antialiasing;
+  bool twosides;
+  bool macro_mode;
+  bool inFastDrawing;
+  bool inDrawWithNames;
+  QPainter *painter;
+  void draw_aux(bool with_names, Viewer*);
+  //! Contains all the programs for the item rendering.
+  mutable std::vector<QOpenGLShaderProgram*> shader_programs;
+  QMatrix4x4 projectionMatrix;
+  void setFrustum(double l, double r, double t, double b, double n, double f);
+  QImage* takeSnapshot(Viewer* viewer, int quality, int background_color, QSize size, double oversampling, bool expand);
+  void sendSnapshotToClipboard(Viewer*);
+};
+Viewer::Viewer(QWidget* parent, bool antialiasing)
+  : CGAL::Three::Viewer_interface(parent)
+{
+  d = new Viewer_impl;
+  d->scene = 0;
+  d->antialiasing = antialiasing;
+  d->twosides = false;
+  d->macro_mode = false;
+  d->inFastDrawing = true;
+  d->inDrawWithNames = false;
+  d->shader_programs.resize(NB_OF_PROGRAMS);
+  textRenderer = new TextRenderer();
+  connect( textRenderer, SIGNAL(sendMessage(QString,int)),
+           this, SLOT(printMessage(QString,int)) );
+  connect(&messageTimer, SIGNAL(timeout()), SLOT(hideMessage()));
+  setShortcut(EXIT_VIEWER, 0);
+  setShortcut(DRAW_AXIS, 0);
+  setKeyDescription(Qt::Key_T,
+                    tr("Turn the camera by 180 degrees"));
+  setKeyDescription(Qt::Key_M,
+                    tr("Toggle macro mode: useful to view details very near from the camera, "
+                       "but decrease the z-buffer precision"));
+  setKeyDescription(Qt::Key_A,
+                      tr("Toggle the axis system visibility."));
+  setKeyDescription(Qt::Key_I + Qt::CTRL,
+                      tr("Toggle the primitive IDs visibility of the selected Item."));
+  setKeyDescription(Qt::Key_D,
+                      tr("Disable the distance between two points  visibility."));
+#if QGLVIEWER_VERSION >= 0x020501
+  //modify mouse bindings that have been updated
+  setMouseBinding(Qt::Key(0), Qt::NoModifier, Qt::LeftButton, RAP_FROM_PIXEL, true, Qt::RightButton);
+  setMouseBindingDescription(Qt::ShiftModifier, Qt::RightButton,
+                             tr("Select and pop context menu"));
+  setMouseBinding(Qt::Key_R, Qt::NoModifier, Qt::LeftButton, RAP_FROM_PIXEL);
+  //use the new API for these
+  setMouseBinding(Qt::ShiftModifier, Qt::LeftButton, SELECT);
+
+  setMouseBindingDescription(Qt::Key(0), Qt::ShiftModifier, Qt::LeftButton,
+                             tr("Selects and display context "
+                                "menu of the selected item"));
+  setMouseBindingDescription(Qt::Key_I, Qt::NoModifier, Qt::LeftButton,
+                             tr("Show/hide the primitive ID."));
+  setMouseBindingDescription(Qt::Key_D, Qt::NoModifier, Qt::LeftButton,
+                             tr("Selects a point. When the second point is selected,  "
+                                "displays the two points and the distance between them."));
+#else
+  setMouseBinding(Qt::SHIFT + Qt::LeftButton, SELECT);
+  setMouseBindingDescription(Qt::SHIFT + Qt::RightButton,
+                             tr("Selects and display context "
+                                "menu of the selected item"));
+
+#endif // QGLVIEWER_VERSION >= 2.5.0
+  prev_radius = sceneRadius();
+  axis_are_displayed = true;
+  has_text = false;
+  i_is_pressed = false;
+  fpsTime.start();
+  fpsCounter=0;
+  f_p_s=0.0;
+  fpsString=tr("%1Hz", "Frames per seconds, in Hertz").arg("?");
+  distance_is_displayed = false;
+  is_d_pressed = false;
+}
+
+Viewer::~Viewer()
+{
+  delete d;
+}
+
+void Viewer::setScene(CGAL::Three::Scene_draw_interface* scene)
+{
+  d->scene = scene;
+}
+
+bool Viewer::antiAliasing() const
+{
+  return d->antialiasing; 
+}
+
+void Viewer::setAntiAliasing(bool b)
+{
+  d->antialiasing = b;
+  update();
+}
+
+void Viewer::setTwoSides(bool b)
+{
+  d->twosides = b;
+  update();
+}
+
+
+void Viewer::setFastDrawing(bool b)
+{
+  d->inFastDrawing = b;
+  update();
+}
+
+bool Viewer::inFastDrawing() const
+{
+  return (d->inFastDrawing
+          && (camera()->frame()->isSpinning()
+              || camera()->frame()->isManipulated()));
+}
+
+void Viewer::draw()
+{ 
+  makeCurrent();
+  glEnable(GL_DEPTH_TEST);
+  d->draw_aux(false, this);
+}
+
+void Viewer::fastDraw()
+{
+  d->draw_aux(false, this);
+}
+
+void Viewer::initializeGL()
+{
+  QGLViewer::initializeGL();
+  initializeOpenGLFunctions();
+  glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDARBPROC)this->context()->getProcAddress("glDrawArraysInstancedARB");
+  if(!glDrawArraysInstanced)
+  {
+      qDebug()<<"glDrawArraysInstancedARB : extension not found. Spheres will be displayed as points.";
+      extension_is_found = false;
+  }
+  else
+      extension_is_found = true;
+
+  glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISORARBPROC)this->context()->getProcAddress("glVertexAttribDivisorARB");
+  if(!glDrawArraysInstanced)
+  {
+      qDebug()<<"glVertexAttribDivisorARB : extension not found. Spheres will be displayed as points.";
+      extension_is_found = false;
+  }
+  else
+      extension_is_found = true;
+
+
+  setBackgroundColor(::Qt::white);
+  vao[0].create();
+  for(int i=0; i<3; i++)
+    buffers[i].create();
+
+  //Vertex source code
+  const char vertex_source[] =
+  {
+      "#version 120 \n"
+      "attribute highp vec4 vertex;\n"
+      "attribute highp vec3 normal;\n"
+      "attribute highp vec4 colors;\n"
+      "uniform highp mat4 mvp_matrix;\n"
+      "uniform highp mat4 ortho_mat;\n"
+      "uniform highp mat4 mv_matrix; \n"
+      "uniform highp float width; \n"
+      "uniform highp float height; \n"
+      "varying highp vec4 fP; \n"
+      "varying highp vec3 fN; \n"
+      "varying highp vec4 color; \n"
+      "void main(void)\n"
+      "{\n"
+      "   color = colors; \n"
+      "   fP = mv_matrix * vertex; \n"
+      "   fN = mat3(mv_matrix)* normal; \n"
+      "   vec4 temp = vec4(mvp_matrix * vertex); \n"
+      "   vec4 ort = ortho_mat * vec4(width-150, height-150, 0,0); \n"
+      "   float ratio = width/height; \n"
+      "   gl_Position =  ort +vec4(temp.x, temp.y, temp.z, 1.0); \n"
+      "} \n"
+      "\n"
+  };
+  //Fragment source code
+  const char fragment_source[] =
+  {
+      "#version 120 \n"
+      "varying highp vec4 color; \n"
+      "varying highp vec4 fP; \n"
+      "varying highp vec3 fN; \n"
+      "uniform highp vec4 light_pos;  \n"
+      "uniform highp vec4 light_diff; \n"
+      "uniform highp vec4 light_spec; \n"
+      "uniform highp vec4 light_amb;  \n"
+      "uniform highp float spec_power ; \n"
+
+      "void main(void) { \n"
+
+      "   vec3 L = light_pos.xyz - fP.xyz; \n"
+      "   vec3 V = -fP.xyz; \n"
+      "   vec3 N; \n"
+      "   if(fN == vec3(0.0,0.0,0.0)) \n"
+      "       N = vec3(0.0,0.0,0.0); \n"
+      "   else \n"
+      "       N = normalize(fN); \n"
+      "   L = normalize(L); \n"
+      "   V = normalize(V); \n"
+      "   vec3 R = reflect(-L, N); \n"
+      "   vec4 diffuse = max(abs(dot(N,L)),0.0) * light_diff*color; \n"
+      "   vec4 specular = pow(max(dot(R,V), 0.0), spec_power) * light_spec; \n"
+
+      "gl_FragColor = color*light_amb + diffuse + specular; \n"
+      "} \n"
+      "\n"
+      };
+
+      QOpenGLShader *vertex_shader = new QOpenGLShader(QOpenGLShader::Vertex);
+      if(!vertex_shader->compileSourceCode(vertex_source))
+      {
+          std::cerr<<"Compiling vertex source FAILED"<<std::endl;
+      }
+
+      QOpenGLShader *fragment_shader= new QOpenGLShader(QOpenGLShader::Fragment);
+      if(!fragment_shader->compileSourceCode(fragment_source))
+      {
+          std::cerr<<"Compiling fragmentsource FAILED"<<std::endl;
+      }
+
+      if(!rendering_program.addShader(vertex_shader))
+      {
+          std::cerr<<"adding vertex shader FAILED"<<std::endl;
+      }
+      if(!rendering_program.addShader(fragment_shader))
+      {
+          std::cerr<<"adding fragment shader FAILED"<<std::endl;
+      }
+      if(!rendering_program.link())
+      {
+          //std::cerr<<"linking Program FAILED"<<std::endl;
+          qDebug() << rendering_program.log();
+      }
+  //setting the program used for the distance
+     {
+         vao[1].create();
+         buffers[3].create();
+         //Vertex source code
+         const char vertex_source_dist[] =
+         {
+             "#version 120 \n"
+             "attribute highp vec4 vertex;\n"
+             "uniform highp mat4 mvp_matrix;\n"
+             "void main(void)\n"
+             "{\n"
+             "   gl_Position = mvp_matrix * vertex; \n"
+             "} \n"
+             "\n"
+         };
+         //Fragment source code
+         const char fragment_source_dist[] =
+         {
+             "#version 120 \n"
+             "void main(void) { \n"
+             "gl_FragColor = vec4(0.0,0.0,0.0,1.0); \n"
+             "} \n"
+             "\n"
+         };
+         vertex_shader = new QOpenGLShader(QOpenGLShader::Vertex);
+         if(!vertex_shader->compileSourceCode(vertex_source_dist))
+         {
+             std::cerr<<"Compiling vertex source FAILED"<<std::endl;
+         }
+
+         fragment_shader= new QOpenGLShader(QOpenGLShader::Fragment);
+         if(!fragment_shader->compileSourceCode(fragment_source_dist))
+         {
+             std::cerr<<"Compiling fragmentsource FAILED"<<std::endl;
+         }
+
+         if(!rendering_program_dist.addShader(vertex_shader))
+         {
+             std::cerr<<"adding vertex shader FAILED"<<std::endl;
+         }
+         if(!rendering_program_dist.addShader(fragment_shader))
+         {
+             std::cerr<<"adding fragment shader FAILED"<<std::endl;
+         }
+         if(!rendering_program_dist.link())
+         {
+             qDebug() << rendering_program_dist.log();
+         }
+     }
+
+  d->painter = new QPainter(this);
+}
+
+#include <QMouseEvent>
+
+void Viewer::mousePressEvent(QMouseEvent* event)
+{
+  if(event->button() == Qt::RightButton &&
+     event->modifiers().testFlag(Qt::ShiftModifier)) 
+  {
+    select(event->pos());
+    requestContextMenu(event->globalPos());
+    event->accept();
+  }
+  else if(!event->modifiers()
+          && event->button() == Qt::LeftButton
+          && i_is_pressed)
+  {
+      d->scene->printPrimitiveId(event->pos(), this);
+  }
+  else if(!event->modifiers()
+          && event->button() == Qt::LeftButton
+          && is_d_pressed)
+  {
+      showDistance(event->pos());
+      event->accept();
+  }
+  else {
+    QGLViewer::mousePressEvent(event);
+  }
+}
+
+#include <QContextMenuEvent>
+void Viewer::contextMenuEvent(QContextMenuEvent* event)
+{
+  if(event->reason() != QContextMenuEvent::Mouse) {
+    requestContextMenu(event->globalPos());
+    event->accept();
+  }
+  else {
+    QGLViewer::contextMenuEvent(event);
+  }
+}
+
+void Viewer::keyPressEvent(QKeyEvent* e)
+{
+  if(!e->modifiers()) {
+    if(e->key() == Qt::Key_T) {
+      turnCameraBy180Degres();
+      return;
+    }
+    else if(e->key() == Qt::Key_M) {
+      d->macro_mode = ! d->macro_mode;
+
+      if(d->macro_mode) {
+          camera()->setZNearCoefficient(0.0005f);
+      } else {
+        camera()->setZNearCoefficient(0.005f);
+      }
+      this->displayMessage(tr("Macro mode: %1").
+                           arg(d->macro_mode ? tr("on") : tr("off")));
+
+
+
+      return;
+    }
+    else if(e->key() == Qt::Key_A) {
+          axis_are_displayed = !axis_are_displayed;
+          update();
+        }
+    else if(e->key() == Qt::Key_I) {
+          i_is_pressed = true;
+        }
+    else if(e->key() == Qt::Key_D) {
+        if(e->isAutoRepeat())
+        {
+            return;
+        }
+        if(!is_d_pressed)
+        {
+            clearDistancedisplay();
+        }
+        is_d_pressed = true;
+        update();
+        return;
+    }
+  }
+  else if(e->key() == Qt::Key_I && e->modifiers() & Qt::ControlModifier){
+    d->scene->printPrimitiveIds(this);
+    update();
+    return;
+  }
+
+  else if(e->key() == Qt::Key_C && e->modifiers() & Qt::ControlModifier){
+    d->sendSnapshotToClipboard(this);
+    return;
+  }
+
+  else if(e->key() == Qt::Key_S && e->modifiers() & Qt::ControlModifier){
+    this->saveSnapshot(true,true);
+    return;
+  }
+
+  //forward the event to the scene (item handling of the event)
+  if (! d->scene->keyPressEvent(e) )
+    QGLViewer::keyPressEvent(e);
+}
+
+void Viewer::keyReleaseEvent(QKeyEvent *e)
+{
+  if(e->key() == Qt::Key_I) {
+    i_is_pressed = false;
+  }
+  else if(!e->modifiers() && e->key() == Qt::Key_D)
+  {
+    if(e->isAutoRepeat())
+    {
+      return;
+    }
+    is_d_pressed = false;
+  }
+  QGLViewer::keyReleaseEvent(e);
+}
+
+void Viewer::turnCameraBy180Degres() {
+  qglviewer::Camera* camera = this->camera();
+  using qglviewer::ManipulatedCameraFrame;
+
+  ManipulatedCameraFrame frame_from(*camera->frame());
+  camera->setViewDirection(-camera->viewDirection());
+  ManipulatedCameraFrame frame_to(*camera->frame());
+
+  camera->setOrientation(frame_from.orientation());
+  camera->interpolateTo(frame_to, 0.5f);
+}
+
+void Viewer_impl::draw_aux(bool with_names, Viewer* viewer)
+{
+  if(scene == 0)
+    return;
+  viewer->glLineWidth(1.0f);
+  viewer->glPointSize(2.f);
+  viewer->glEnable(GL_POLYGON_OFFSET_FILL);
+  viewer->glPolygonOffset(1.0f,1.0f);
+  viewer->glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
+
+  viewer->glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);
+
+  if(twosides)
+    viewer->glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
+  else
+    viewer->glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
+
+  if(!with_names && antialiasing)
+  {
+    viewer->glEnable(GL_BLEND);
+    viewer->glEnable(GL_LINE_SMOOTH);
+    viewer->glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
+    viewer->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+  }
+  else
+  {
+    viewer->glDisable(GL_BLEND);
+    viewer->glDisable(GL_LINE_SMOOTH);
+    viewer->glHint(GL_LINE_SMOOTH_HINT, GL_FASTEST);
+    viewer->glBlendFunc(GL_ONE, GL_ZERO);
+  }
+  inDrawWithNames = with_names;
+  if(with_names)
+    scene->drawWithNames(viewer);
+  else
+    scene->draw(viewer);
+  viewer->glDisable(GL_POLYGON_OFFSET_FILL);
+  viewer->glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
+}
+
+bool Viewer::inDrawWithNames() const {
+  return d->inDrawWithNames;
+}
+
+void Viewer::drawWithNames()
+{
+  QGLViewer::draw();
+  d->draw_aux(true, this);
+}
+
+void Viewer::postSelection(const QPoint& pixel)
+{
+  Q_EMIT selected(this->selectedName());
+  bool found = false;
+  qglviewer::Vec point = camera()->pointUnderPixel(pixel, found);
+  if(found) {
+    Q_EMIT selectedPoint(point.x,
+                       point.y,
+                       point.z);
+    const qglviewer::Vec orig = camera()->position();
+    const qglviewer::Vec dir = point - orig;
+    Q_EMIT selectionRay(orig.x, orig.y, orig.z,
+                      dir.x, dir.y, dir.z);
+  }
+}
+bool CGAL::Three::Viewer_interface::readFrame(QString s, qglviewer::Frame& frame)
+{
+  QStringList list = s.split(" ", QString::SkipEmptyParts);
+  if(list.size() != 7)
+    return false;
+  float vec[3];
+  for(int i = 0; i < 3; ++i)
+  {
+    bool ok;
+    vec[i] = list[i].toFloat(&ok);
+    if(!ok) return false;
+  }
+  double orient[4];
+  for(int i = 0; i < 4; ++i)
+  {
+    bool ok;
+    orient[i] = list[i + 3].toDouble(&ok);
+    if(!ok) return false;
+  }
+  frame.setPosition(qglviewer::Vec(vec[0],
+                                   vec[1],
+                                   vec[2]));
+  frame.setOrientation(orient[0],
+                       orient[1],
+                       orient[2],
+                       orient[3]);
+  return true;
+}
+
+QString CGAL::Three::Viewer_interface::dumpFrame(const qglviewer::Frame& frame) {
+  const qglviewer::Vec pos = frame.position();
+  const qglviewer::Quaternion q = frame.orientation();
+
+  return QString("%1 %2 %3 %4 %5 %6 %7")
+    .arg(pos[0])
+    .arg(pos[1])
+    .arg(pos[2])
+    .arg(q[0])
+    .arg(q[1])
+    .arg(q[2])
+    .arg(q[3]);
+}
+
+bool Viewer::moveCameraToCoordinates(QString s, float animation_duration) {
+  qglviewer::Frame new_frame;
+  if(readFrame(s, new_frame)) {
+    camera()->interpolateTo(new_frame, animation_duration); 
+    return true;
+  }
+  else
+    return false;
+}
+
+QString Viewer::dumpCameraCoordinates()
+{
+  if(camera()->frame()) {
+    return dumpFrame(*camera()->frame());
+  } else {
+    return QString();
+  }
+}
+
+void Viewer::attribBuffers(int program_name) const {
+    GLint is_both_sides = 0;
+    //ModelViewMatrix used for the transformation of the camera.
+    QMatrix4x4 mvp_mat;
+    // ModelView Matrix used for the lighting system
+    QMatrix4x4 mv_mat;
+    // transformation of the manipulated frame
+    QMatrix4x4 f_mat;
+
+    f_mat.setToIdentity();
+    //fills the MVP and MV matrices.
+    GLdouble d_mat[16];
+
+    this->camera()->getModelViewMatrix(d_mat);
+    for (int i=0; i<16; ++i)
+        mv_mat.data()[i] = GLfloat(d_mat[i]);
+    mvp_mat = d->projectionMatrix*mv_mat;
+
+    const_cast<Viewer*>(this)->glGetIntegerv(GL_LIGHT_MODEL_TWO_SIDE,
+                                             &is_both_sides);
+
+    QVector4D position(0.0f,0.0f,1.0f, 1.0f );
+    QVector4D ambient(0.4f, 0.4f, 0.4f, 0.4f);
+    // Diffuse
+    QVector4D diffuse(1.0f, 1.0f, 1.0f, 1.0f);
+    // Specular
+    QVector4D specular(0.0f, 0.0f, 0.0f, 1.0f);
+    QOpenGLShaderProgram* program = getShaderProgram(program_name);
+    program->bind();
+    program->setUniformValue("mvp_matrix", mvp_mat);
+    switch(program_name)
+    {
+    case PROGRAM_WITH_LIGHT:
+    case PROGRAM_C3T3:
+    case PROGRAM_PLANE_TWO_FACES:
+    case PROGRAM_INSTANCED:
+    case PROGRAM_WITH_TEXTURE:
+    case PROGRAM_CUTPLANE_SPHERES:
+    case PROGRAM_SPHERES:
+        program->setUniformValue("light_pos", position);
+        program->setUniformValue("light_diff",diffuse);
+        program->setUniformValue("light_spec", specular);
+        program->setUniformValue("light_amb", ambient);
+        program->setUniformValue("spec_power", 51.8f);
+        program->setUniformValue("is_two_side", is_both_sides);
+        break;
+    }
+    switch(program_name)
+    {
+    case PROGRAM_WITH_LIGHT:
+    case PROGRAM_C3T3:
+    case PROGRAM_PLANE_TWO_FACES:
+    case PROGRAM_INSTANCED:
+    case PROGRAM_CUTPLANE_SPHERES:
+    case PROGRAM_SPHERES:
+      program->setUniformValue("mv_matrix", mv_mat);
+      break;
+    case PROGRAM_WITHOUT_LIGHT:
+      program->setUniformValue("f_matrix",f_mat);
+      break;
+    case PROGRAM_WITH_TEXTURE:
+      program->setUniformValue("mv_matrix", mv_mat);
+      program->setUniformValue("s_texture",0);
+      program->setUniformValue("f_matrix",f_mat);
+      break;
+    case PROGRAM_WITH_TEXTURED_EDGES:
+        program->setUniformValue("s_texture",0);
+        break;
+    case PROGRAM_NO_SELECTION:
+        program->setUniformValue("f_matrix",f_mat);
+        break;
+    }
+    program->release();
+}
+
+void Viewer::beginSelection(const QPoint &point)
+{
+    makeCurrent();
+    glEnable(GL_SCISSOR_TEST);
+    glScissor(point.x(), camera()->screenHeight()-1-point.y(), 1, 1);
+    d->scene->setPickedPixel(point);
+}
+void Viewer::endSelection(const QPoint&)
+{
+    glDisable(GL_SCISSOR_TEST);
+    //redraw thetrue scene for the glReadPixel in postSelection();
+    update();
+}
+
+void Viewer::makeArrow(double R, int prec, qglviewer::Vec from, qglviewer::Vec to, qglviewer::Vec color, AxisData &data)
+{
+    qglviewer::Vec temp = to-from;
+    QVector3D dir = QVector3D(temp.x, temp.y, temp.z);
+    QMatrix4x4 mat;
+    mat.setToIdentity();
+    mat.translate(from.x, from.y, from.z);
+    mat.scale(dir.length());
+    dir.normalize();
+    float angle = 0.0;
+    if(std::sqrt((dir.x()*dir.x()+dir.y()*dir.y())) > 1)
+        angle = 90.0f;
+    else
+        angle =acos(dir.y()/std::sqrt(dir.x()*dir.x()+dir.y()*dir.y()+dir.z()*dir.z()))*180.0/M_PI;
+
+    QVector3D axis;
+    axis = QVector3D(dir.z(), 0, -dir.x());
+    mat.rotate(angle, axis);
+
+    //Head
+    const float Rf = static_cast<float>(R);
+    for(int d = 0; d<360; d+= 360/prec)
+    {
+        float D = (float) (d * M_PI / 180.);
+        float a = (float) std::atan(Rf / 0.33);
+        QVector4D p(0., 1., 0, 1.);
+        QVector4D n(Rf*2.*sin(D), sin(a), Rf*2.*cos(D), 1.);
+        QVector4D pR = mat*p;
+        QVector4D nR = mat*n;
+
+        //point A1
+        data.vertices->push_back(pR.x());
+        data.vertices->push_back(pR.y());
+        data.vertices->push_back(pR.z());
+        data.normals->push_back(nR.x());
+        data.normals->push_back(nR.y());
+        data.normals->push_back(nR.z());
+        data.colors->push_back((float)color.x);
+        data.colors->push_back((float)color.y);
+        data.colors->push_back((float)color.z);
+
+        //point B1
+        p = QVector4D(Rf*2.*sin(D), 0.66f, Rf*2.* cos(D), 1.f);
+        n = QVector4D(sin(D), sin(a), cos(D), 1.);
+        pR = mat*p;
+        nR = mat*n;
+        data.vertices->push_back(pR.x());
+        data.vertices->push_back(pR.y());
+        data.vertices->push_back(pR.z());
+        data.normals->push_back(nR.x());
+        data.normals->push_back(nR.y());
+        data.normals->push_back(nR.z());
+        data.colors->push_back((float)color.x);
+        data.colors->push_back((float)color.y);
+        data.colors->push_back((float)color.z);
+        //point C1
+        D = (d+360/prec)*M_PI/180.0;
+        p = QVector4D(Rf*2.* sin(D), 0.66f, Rf *2.* cos(D), 1.f);
+        n = QVector4D(sin(D), sin(a), cos(D), 1.0);
+        pR = mat*p;
+        nR = mat*n;
+
+        data.vertices->push_back(pR.x());
+        data.vertices->push_back(pR.y());
+        data.vertices->push_back(pR.z());
+        data.normals->push_back(nR.x());
+        data.normals->push_back(nR.y());
+        data.normals->push_back(nR.z());
+        data.colors->push_back((float)color.x);
+        data.colors->push_back((float)color.y);
+        data.colors->push_back((float)color.z);
+
+    }
+
+    //cylinder
+    //body of the cylinder
+    for(int d = 0; d<360; d+= 360/prec)
+    {
+        //point A1
+        double D = d*M_PI/180.0;
+        QVector4D p(Rf*sin(D), 0.66f, Rf*cos(D), 1.f);
+        QVector4D n(sin(D), 0.f, cos(D), 1.f);
+        QVector4D pR = mat*p;
+        QVector4D nR = mat*n;
+
+        data.vertices->push_back(pR.x());
+        data.vertices->push_back(pR.y());
+        data.vertices->push_back(pR.z());
+        data.normals->push_back(nR.x());
+        data.normals->push_back(nR.y());
+        data.normals->push_back(nR.z());
+        data.colors->push_back(color.x);
+        data.colors->push_back(color.y);
+        data.colors->push_back(color.z);
+        //point B1
+        p = QVector4D(Rf * sin(D),0,Rf*cos(D), 1.0);
+        n = QVector4D(sin(D), 0, cos(D), 1.0);
+        pR = mat*p;
+        nR = mat*n;
+
+
+        data.vertices->push_back(pR.x());
+        data.vertices->push_back(pR.y());
+        data.vertices->push_back(pR.z());
+        data.normals->push_back(nR.x());
+        data.normals->push_back(nR.y());
+        data.normals->push_back(nR.z());
+        data.colors->push_back(color.x);
+        data.colors->push_back(color.y);
+        data.colors->push_back(color.z);
+          //point C1
+        D = (d+360/prec)*M_PI/180.0;
+        p = QVector4D(Rf * sin(D),0,Rf*cos(D), 1.0);
+        n = QVector4D(sin(D), 0, cos(D), 1.0);
+        pR = mat*p;
+        nR = mat*n;
+        data.vertices->push_back(pR.x());
+        data.vertices->push_back(pR.y());
+        data.vertices->push_back(pR.z());
+        data.normals->push_back(nR.x());
+        data.normals->push_back(nR.y());
+        data.normals->push_back(nR.z());
+        data.colors->push_back(color.x);
+        data.colors->push_back(color.y);
+        data.colors->push_back(color.z);
+        //point A2
+        D = (d+360/prec)*M_PI/180.0;
+
+        p = QVector4D(Rf * sin(D),0,Rf*cos(D), 1.0);
+        n = QVector4D(sin(D), 0, cos(D), 1.0);
+        pR = mat*p;
+        nR = mat*n;
+        data.vertices->push_back(pR.x());
+        data.vertices->push_back(pR.y());
+        data.vertices->push_back(pR.z());
+        data.normals->push_back(nR.x());
+        data.normals->push_back(nR.y());
+        data.normals->push_back(nR.z());
+        data.colors->push_back((float)color.x);
+        data.colors->push_back((float)color.y);
+        data.colors->push_back((float)color.z);
+        //point B2
+        p = QVector4D(Rf * sin(D), 0.66f, Rf*cos(D), 1.f);
+        n = QVector4D(sin(D), 0, cos(D), 1.0);
+        pR = mat*p;
+        nR = mat*n;
+        data.vertices->push_back(pR.x());
+        data.vertices->push_back(pR.y());
+        data.vertices->push_back(pR.z());
+        data.normals->push_back(nR.x());
+        data.normals->push_back(nR.y());
+        data.normals->push_back(nR.z());
+        data.colors->push_back((float)color.x);
+        data.colors->push_back((float)color.y);
+        data.colors->push_back((float)color.z);
+        //point C2
+        D = d*M_PI/180.0;
+        p = QVector4D(Rf * sin(D), 0.66f, Rf*cos(D), 1.f);
+        n = QVector4D(sin(D), 0.f, cos(D), 1.f);
+        pR = mat*p;
+        nR = mat*n;
+        data.vertices->push_back(pR.x());
+        data.vertices->push_back(pR.y());
+        data.vertices->push_back(pR.z());
+        data.normals->push_back(nR.x());
+        data.normals->push_back(nR.y());
+        data.normals->push_back(nR.z());
+        data.colors->push_back(color.x);
+        data.colors->push_back(color.y);
+        data.colors->push_back(color.z);
+
+    }
+}
+
+void Viewer::drawVisualHints()
+{
+
+    QGLViewer::drawVisualHints();
+    if(axis_are_displayed)
+    {
+        QMatrix4x4 mvpMatrix;
+        double mat[16];
+        QMatrix4x4 mvMatrix;
+        camera()->getModelViewProjectionMatrix(mat);
+        //nullifies the translation
+        mat[12]=0;
+        mat[13]=0;
+        mat[14]=0;
+        for(int i=0; i < 16; i++)
+        {
+            mvpMatrix.data()[i] = (float)mat[i];
+        }
+        camera()->getModelViewMatrix(mat);
+        for(int i=0; i < 16; i++)
+        {
+            mvMatrix.data()[i] = (float)mat[i];
+        }
+
+        QVector4D	position(0.0f,0.0f,1.0f,1.0f );
+        // define material
+        QVector4D	ambient;
+        QVector4D	diffuse;
+        QVector4D	specular;
+        GLfloat      shininess ;
+        // Ambient
+        ambient[0] = 0.29225f;
+        ambient[1] = 0.29225f;
+        ambient[2] = 0.29225f;
+        ambient[3] = 1.0f;
+        // Diffuse
+        diffuse[0] = 0.50754f;
+        diffuse[1] = 0.50754f;
+        diffuse[2] = 0.50754f;
+        diffuse[3] = 1.0f;
+        // Specular
+        specular[0] = 0.0f;
+        specular[1] = 0.0f;
+        specular[2] = 0.0f;
+        specular[3] = 0.0f;
+        // Shininess
+        shininess = 51.2f;
+
+        rendering_program.bind();
+        rendering_program.setUniformValue("light_pos", position);
+        rendering_program.setUniformValue("mvp_matrix", mvpMatrix);
+        rendering_program.setUniformValue("mv_matrix", mvMatrix);
+        rendering_program.setUniformValue("light_diff", diffuse);
+        rendering_program.setUniformValue("light_spec", specular);
+        rendering_program.setUniformValue("light_amb", ambient);
+        rendering_program.setUniformValue("spec_power", shininess);
+        rendering_program.release();
+
+        vao[0].bind();
+        rendering_program.bind();
+        glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(v_Axis.size() / 3));
+        rendering_program.release();
+        vao[0].release();
+    }
+
+    if(distance_is_displayed)
+    {
+        glDisable(GL_DEPTH_TEST);
+
+        glLineWidth(3.0f);
+        glPointSize(6.0f);
+        //draws the distance
+        QMatrix4x4 mvpMatrix;
+        double mat[16];
+        //camera()->frame()->rotation().getMatrix(mat);
+        camera()->getModelViewProjectionMatrix(mat);
+        //nullifies the translation
+        for(int i=0; i < 16; i++)
+        {
+            mvpMatrix.data()[i] = (float)mat[i];
+        }
+        rendering_program_dist.bind();
+        rendering_program_dist.setUniformValue("mvp_matrix", mvpMatrix);
+        vao[1].bind();
+        glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(2));
+        glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(2));
+        vao[1].release();
+        rendering_program_dist.release();
+        glEnable(GL_DEPTH_TEST);
+        glPointSize(1.0f);
+        glLineWidth(1.0f);
+
+    }
+    if (!d->painter->isActive())
+      d->painter->begin(this);
+    //So that the text is drawn in front of everything
+    d->painter->beginNativePainting();
+    glDisable(GL_DEPTH_TEST);
+    d->painter->endNativePainting();
+    //prints FPS
+    TextItem *fps_text = new TextItem(20, int(1.5*((QApplication::font().pixelSize()>0)?QApplication::font().pixelSize():QApplication::font().pointSize())),0,fpsString,false, QFont(), Qt::gray);
+    if(FPSIsDisplayed())
+    {
+      textRenderer->addText(fps_text);
+    }
+    //Prints the displayMessage
+    QFont font = QFont();
+    QFontMetrics fm(font);
+    TextItem *message_text = new TextItem(10 + fm.width(message)/2, height()-20, 0, message, false, QFont(), Qt::gray );
+    if (_displayMessage)
+    {
+      textRenderer->addText(message_text);
+    }
+    textRenderer->draw(this);
+    if(FPSIsDisplayed())
+      textRenderer->removeText(fps_text);
+    if (_displayMessage)
+      textRenderer->removeText(message_text);
+}
+
+void Viewer::resizeGL(int w, int h)
+{
+    QGLViewer::resizeGL(w,h);
+    qglviewer::Vec dim = qglviewer::Vec(w,h, 0) ;
+    GLdouble ortho[16];
+    QMatrix4x4 orthoMatrix;
+    ortho[0]  = 1.0/width(); ortho[1]  = 0; ortho[2]  = 0; ortho[3]  = -0.0;
+    ortho[4]  = 0; ortho[5]  = 1.0/height(); ortho[6]  = 0; ortho[7]  = -0.0;
+    ortho[8]  = 0; ortho[9]  = 0; ortho[10] = 2.0/(camera()->zNear()-camera()->zFar()); ortho[11] = -(camera()->zNear()+camera()->zFar())/(-camera()->zNear()+camera()->zFar());
+    ortho[12] = 0; ortho[13] = 0; ortho[14] = 0; ortho[15] = 1;
+    for(int i=0; i < 16; i++)
+    {
+        orthoMatrix.data()[i] = (float)ortho[i];
+    }
+
+    QVector4D length(60,60,60, 1.0);
+    length = orthoMatrix * length;
+    AxisData data;
+    v_Axis.resize(0);
+    n_Axis.resize(0);
+    c_Axis.resize(0);
+    data.vertices = &v_Axis;
+    data.normals = &n_Axis;
+    data.colors = &c_Axis;
+    double l = length.x()*w/h;
+    makeArrow(0.06,10, qglviewer::Vec(0,0,0),qglviewer::Vec(l,0,0),qglviewer::Vec(1,0,0), data);
+    makeArrow(0.06,10, qglviewer::Vec(0,0,0),qglviewer::Vec(0,l,0),qglviewer::Vec(0,1,0), data);
+    makeArrow(0.06,10, qglviewer::Vec(0,0,0),qglviewer::Vec(0,0,l),qglviewer::Vec(0,0,1), data);
+
+
+    vao[0].bind();
+    buffers[0].bind();
+    buffers[0].allocate(v_Axis.data(), static_cast<int>(v_Axis.size()) * sizeof(float));
+    rendering_program.enableAttributeArray("vertex");
+    rendering_program.setAttributeBuffer("vertex",GL_FLOAT,0,3);
+    buffers[0].release();
+
+    buffers[1].bind();
+    buffers[1].allocate(n_Axis.data(), static_cast<int>(n_Axis.size() * sizeof(float)));
+    rendering_program.enableAttributeArray("normal");
+    rendering_program.setAttributeBuffer("normal",GL_FLOAT,0,3);
+    buffers[1].release();
+
+    buffers[2].bind();
+    buffers[2].allocate(c_Axis.data(), static_cast<int>(c_Axis.size() * sizeof(float)));
+    rendering_program.enableAttributeArray("colors");
+    rendering_program.setAttributeBuffer("colors",GL_FLOAT,0,3);
+    buffers[2].release();
+
+    rendering_program.release();
+    vao[0].release();
+
+
+
+    rendering_program.bind();
+    rendering_program.setUniformValue("width", (float)dim.x);
+    rendering_program.setUniformValue("height", (float)dim.y);
+    rendering_program.setUniformValue("ortho_mat", orthoMatrix);
+    rendering_program.release();
+
+}
+
+QOpenGLShaderProgram* Viewer::getShaderProgram(int name) const
+{
+    // workaround constness issues in Qt
+    Viewer* viewer = const_cast<Viewer*>(this);
+
+    switch(name)
+    {
+    /// @TODO: factorize this code   
+    case PROGRAM_C3T3:
+        if(d->shader_programs[PROGRAM_C3T3])
+        {
+            return d->shader_programs[PROGRAM_C3T3];
+        }
+
+        else
+        {
+
+            QOpenGLShaderProgram *program = new QOpenGLShaderProgram(viewer);
+            if(!program->addShaderFromSourceFile(QOpenGLShader::Vertex,":/cgal/Polyhedron_3/resources/shader_c3t3.v"))
+            {
+                std::cerr<<"adding vertex shader FAILED"<<std::endl;
+            }
+            if(!program->addShaderFromSourceFile(QOpenGLShader::Fragment,":/cgal/Polyhedron_3/resources/shader_c3t3.f"))
+            {
+                std::cerr<<"adding fragment shader FAILED"<<std::endl;
+            }
+            program->bindAttributeLocation("colors", 1);
+            program->link();
+            d->shader_programs[PROGRAM_C3T3] = program;
+            return program;
+        }
+        break;
+    case PROGRAM_C3T3_EDGES:
+        if(d->shader_programs[PROGRAM_C3T3_EDGES])
+        {
+            return d->shader_programs[PROGRAM_C3T3_EDGES];
+        }
+
+        else
+        {
+
+            QOpenGLShaderProgram *program = new QOpenGLShaderProgram(viewer);
+            if(!program->addShaderFromSourceFile(QOpenGLShader::Vertex,":/cgal/Polyhedron_3/resources/shader_c3t3_edges.v"))
+            {
+                std::cerr<<"adding vertex shader FAILED"<<std::endl;
+            }
+            if(!program->addShaderFromSourceFile(QOpenGLShader::Fragment,":/cgal/Polyhedron_3/resources/shader_c3t3_edges.f"))
+            {
+                std::cerr<<"adding fragment shader FAILED"<<std::endl;
+            }
+            program->bindAttributeLocation("colors", 1);
+            program->link();
+            d->shader_programs[PROGRAM_C3T3_EDGES] = program;
+            return program;
+        }
+        break;
+    case PROGRAM_WITH_LIGHT:
+        if(d->shader_programs[PROGRAM_WITH_LIGHT])
+        {
+            return d->shader_programs[PROGRAM_WITH_LIGHT];
+        }
+
+        else
+        {
+
+            QOpenGLShaderProgram *program = new QOpenGLShaderProgram(viewer);
+            if(!program->addShaderFromSourceFile(QOpenGLShader::Vertex,":/cgal/Polyhedron_3/resources/shader_with_light.v"))
+            {
+                std::cerr<<"adding vertex shader FAILED"<<std::endl;
+            }
+            if(!program->addShaderFromSourceFile(QOpenGLShader::Fragment,":/cgal/Polyhedron_3/resources/shader_with_light.f"))
+            {
+                std::cerr<<"adding fragment shader FAILED"<<std::endl;
+            }
+            program->bindAttributeLocation("colors", 1);
+            program->link();
+            d->shader_programs[PROGRAM_WITH_LIGHT] = program;
+            return program;
+        }
+        break;
+    case PROGRAM_WITHOUT_LIGHT:
+        if( d->shader_programs[PROGRAM_WITHOUT_LIGHT])
+        {
+            return d->shader_programs[PROGRAM_WITHOUT_LIGHT];
+        }
+        else
+        {
+            QOpenGLShaderProgram *program = new QOpenGLShaderProgram(viewer);
+            if(!program->addShaderFromSourceFile(QOpenGLShader::Vertex,":/cgal/Polyhedron_3/resources/shader_without_light.v"))
+            {
+                std::cerr<<"adding vertex shader FAILED"<<std::endl;
+            }
+            if(!program->addShaderFromSourceFile(QOpenGLShader::Fragment,":/cgal/Polyhedron_3/resources/shader_without_light.f"))
+            {
+                std::cerr<<"adding fragment shader FAILED"<<std::endl;
+            }
+            program->bindAttributeLocation("colors", 1);
+            program->link();
+            d->shader_programs[PROGRAM_WITHOUT_LIGHT] = program;
+            return program;
+        }
+        break;
+    case PROGRAM_NO_SELECTION:
+        if( d->shader_programs[PROGRAM_NO_SELECTION])
+        {
+            return d->shader_programs[PROGRAM_NO_SELECTION];
+        }
+        else
+        {
+            QOpenGLShaderProgram *program = new QOpenGLShaderProgram(viewer);
+            if(!program->addShaderFromSourceFile(QOpenGLShader::Vertex,":/cgal/Polyhedron_3/resources/shader_without_light.v"))
+            {
+                std::cerr<<"adding vertex shader FAILED"<<std::endl;
+            }
+            if(!program->addShaderFromSourceFile(QOpenGLShader::Fragment,":/cgal/Polyhedron_3/resources/shader_no_light_no_selection.f"))
+            {
+                std::cerr<<"adding fragment shader FAILED"<<std::endl;
+            }
+            program->bindAttributeLocation("colors", 1);
+            program->link();
+            d->shader_programs[PROGRAM_NO_SELECTION] = program;
+            return program;
+        }
+        break;
+    case PROGRAM_WITH_TEXTURE:
+        if( d->shader_programs[PROGRAM_WITH_TEXTURE])
+        {
+            return d->shader_programs[PROGRAM_WITH_TEXTURE];
+        }
+        else
+        {
+            QOpenGLShaderProgram *program = new QOpenGLShaderProgram(viewer);
+            if(!program->addShaderFromSourceFile(QOpenGLShader::Vertex,":/cgal/Polyhedron_3/resources/shader_with_texture.v"))
+            {
+                std::cerr<<"adding vertex shader FAILED"<<std::endl;
+            }
+            if(!program->addShaderFromSourceFile(QOpenGLShader::Fragment,":/cgal/Polyhedron_3/resources/shader_with_texture.f"))
+            {
+                std::cerr<<"adding fragment shader FAILED"<<std::endl;
+            }
+            program->bindAttributeLocation("color_facets", 1);
+            program->link();
+            d->shader_programs[PROGRAM_WITH_TEXTURE] = program;
+            return program;
+        }
+        break;
+    case PROGRAM_PLANE_TWO_FACES:
+        if(d->shader_programs[PROGRAM_PLANE_TWO_FACES])
+        {
+            return d->shader_programs[PROGRAM_PLANE_TWO_FACES];
+        }
+
+        else
+        {
+
+            QOpenGLShaderProgram *program = new QOpenGLShaderProgram(viewer);
+            if(!program->addShaderFromSourceFile(QOpenGLShader::Vertex,":/cgal/Polyhedron_3/resources/shader_without_light.v"))
+            {
+                std::cerr<<"adding vertex shader FAILED"<<std::endl;
+            }
+            if(!program->addShaderFromSourceFile(QOpenGLShader::Fragment,":/cgal/Polyhedron_3/resources/shader_plane_two_faces.f"))
+            {
+                std::cerr<<"adding fragment shader FAILED"<<std::endl;
+            }
+            program->link();
+            d->shader_programs[PROGRAM_PLANE_TWO_FACES] = program;
+            return program;
+        }
+        break;
+
+    case PROGRAM_WITH_TEXTURED_EDGES:
+        if( d->shader_programs[PROGRAM_WITH_TEXTURED_EDGES])
+        {
+            return d->shader_programs[PROGRAM_WITH_TEXTURED_EDGES];
+        }
+        else
+        {
+            QOpenGLShaderProgram *program = new QOpenGLShaderProgram(viewer);
+            if(!program->addShaderFromSourceFile(QOpenGLShader::Vertex,":/cgal/Polyhedron_3/resources/shader_with_textured_edges.v" ))
+            {
+                std::cerr<<"adding vertex shader FAILED"<<std::endl;
+            }
+            if(!program->addShaderFromSourceFile(QOpenGLShader::Fragment,":/cgal/Polyhedron_3/resources/shader_with_textured_edges.f" ))
+            {
+                std::cerr<<"adding fragment shader FAILED"<<std::endl;
+            }
+            program->bindAttributeLocation("color_lines", 1);
+            program->link();
+            d->shader_programs[PROGRAM_WITH_TEXTURED_EDGES] = program;
+            return program;
+
+        }
+        break;
+    case PROGRAM_INSTANCED:
+        if( d->shader_programs[PROGRAM_INSTANCED])
+        {
+            return d->shader_programs[PROGRAM_INSTANCED];
+        }
+        else
+        {
+            QOpenGLShaderProgram *program = new QOpenGLShaderProgram(viewer);
+            if(!program->addShaderFromSourceFile(QOpenGLShader::Vertex,":/cgal/Polyhedron_3/resources/shader_instanced.v" ))
+            {
+                std::cerr<<"adding vertex shader FAILED"<<std::endl;
+            }
+            if(!program->addShaderFromSourceFile(QOpenGLShader::Fragment,":/cgal/Polyhedron_3/resources/shader_with_light.f" ))
+            {
+                std::cerr<<"adding fragment shader FAILED"<<std::endl;
+            }
+            program->bindAttributeLocation("colors", 1);
+            program->link();
+            d->shader_programs[PROGRAM_INSTANCED] = program;
+            return program;
+
+        }
+        break;
+    case PROGRAM_INSTANCED_WIRE:
+        if( d->shader_programs[PROGRAM_INSTANCED_WIRE])
+        {
+            return d->shader_programs[PROGRAM_INSTANCED_WIRE];
+        }
+        else
+        {
+            QOpenGLShaderProgram *program = new QOpenGLShaderProgram(viewer);
+            if(!program->addShaderFromSourceFile(QOpenGLShader::Vertex,":/cgal/Polyhedron_3/resources/shader_instanced.v" ))
+            {
+                std::cerr<<"adding vertex shader FAILED"<<std::endl;
+            }
+            if(!program->addShaderFromSourceFile(QOpenGLShader::Fragment,":/cgal/Polyhedron_3/resources/shader_without_light.f" ))
+            {
+                std::cerr<<"adding fragment shader FAILED"<<std::endl;
+            }
+            program->bindAttributeLocation("colors", 1);
+            program->link();
+            d->shader_programs[PROGRAM_INSTANCED_WIRE] = program;
+            return program;
+
+        }
+        break;
+    case PROGRAM_CUTPLANE_SPHERES:
+      if( d->shader_programs[PROGRAM_CUTPLANE_SPHERES])
+      {
+          return d->shader_programs[PROGRAM_CUTPLANE_SPHERES];
+      }
+      else
+      {
+        QOpenGLShaderProgram *program = new QOpenGLShaderProgram(viewer);
+        if(!program->addShaderFromSourceFile(QOpenGLShader::Vertex,":/cgal/Polyhedron_3/resources/shader_c3t3_spheres.v"))
+        {
+            std::cerr<<"adding vertex shader FAILED"<<std::endl;
+        }
+        if(!program->addShaderFromSourceFile(QOpenGLShader::Fragment,":/cgal/Polyhedron_3/resources/shader_c3t3.f" ))
+        {
+            std::cerr<<"adding fragment shader FAILED"<<std::endl;
+        }
+        program->bindAttributeLocation("colors", 1);
+        program->link();
+        d->shader_programs[PROGRAM_CUTPLANE_SPHERES] = program;
+        return program;
+      }
+    case PROGRAM_SPHERES:
+        if( d->shader_programs[PROGRAM_SPHERES])
+        {
+            return d->shader_programs[PROGRAM_SPHERES];
+        }
+        else
+        {
+            QOpenGLShaderProgram *program = new QOpenGLShaderProgram(viewer);
+            if(!program->addShaderFromSourceFile(QOpenGLShader::Vertex,":/cgal/Polyhedron_3/resources/shader_spheres.v" ))
+            {
+                std::cerr<<"adding vertex shader FAILED"<<std::endl;
+            }
+            if(!program->addShaderFromSourceFile(QOpenGLShader::Fragment,":/cgal/Polyhedron_3/resources/shader_with_light.f" ))
+            {
+                std::cerr<<"adding fragment shader FAILED"<<std::endl;
+            }
+            program->bindAttributeLocation("colors", 1);
+            program->link();
+            d->shader_programs[PROGRAM_SPHERES] = program;
+            return program;
+
+        }
+      break;
+
+    default:
+        std::cerr<<"ERROR : Program not found."<<std::endl;
+        return 0;
+    }
+}
+void Viewer::wheelEvent(QWheelEvent* e)
+{
+    if(e->modifiers().testFlag(Qt::ShiftModifier))
+    {
+        double delta = e->delta();
+        if(delta>0)
+        {
+            camera()->setZNearCoefficient(camera()->zNearCoefficient() * 1.01);
+        }
+        else
+            camera()->setZNearCoefficient(camera()->zNearCoefficient() / 1.01);
+        update();
+    }
+    else
+        QGLViewer::wheelEvent(e);
+}
+
+bool Viewer::testDisplayId(double x, double y, double z)
+{
+    return d->scene->testDisplayId(x,y,z,this);
+}
+
+QPainter* Viewer::getPainter(){return d->painter;}
+
+void Viewer::paintEvent(QPaintEvent *)
+{
+    paintGL();
+}
+
+void Viewer::paintGL()
+{
+  if (!d->painter->isActive())
+    d->painter->begin(this);
+  d->painter->beginNativePainting();
+  glClearColor(backgroundColor().redF(), backgroundColor().greenF(), backgroundColor().blueF(), 1.0);
+
+  //set the default frustum
+  GLdouble d_mat[16];
+  this->camera()->getProjectionMatrix(d_mat);
+  //Convert the GLdoubles matrices in GLfloats
+  for (int i=0; i<16; ++i)
+      d->projectionMatrix.data()[i] = GLfloat(d_mat[i]);
+
+  preDraw();
+  draw();
+  postDraw();
+  d->painter->endNativePainting();
+  d->painter->end();
+}
+
+void Viewer::postDraw()
+{
+
+#ifdef GL_RESCALE_NORMAL  // OpenGL 1.2 Only...
+  glEnable(GL_RESCALE_NORMAL);
+#endif
+
+  if (cameraIsEdited())
+    camera()->drawAllPaths();
+
+  // Pivot point, line when camera rolls, zoom region
+  drawVisualHints();
+
+  if (gridIsDrawn()) { glLineWidth(1.0); drawGrid(camera()->sceneRadius()); }
+  if (axisIsDrawn()) { glLineWidth(2.0); drawAxis(camera()->sceneRadius()); }
+
+  // FPS computation
+  const unsigned int maxCounter = 20;
+  if (++fpsCounter == maxCounter)
+  {
+    f_p_s = 1000.0 * maxCounter / fpsTime.restart();
+    fpsString = tr("%1Hz", "Frames per seconds, in Hertz").arg(f_p_s, 0, 'f', ((f_p_s < 10.0)?1:0));
+    fpsCounter = 0;
+  }
+
+}
+void Viewer::displayMessage(const QString &_message, int delay)
+{
+          message = _message;
+          _displayMessage = true;
+          // Was set to single shot in defaultConstructor.
+          messageTimer.start(delay);
+          if (textIsEnabled())
+                  update();
+}
+void Viewer::hideMessage()
+{
+        _displayMessage = false;
+        if (textIsEnabled())
+                update();
+}
+void Viewer::printMessage(QString _message, int ms_delay)
+{
+  displayMessage(_message, ms_delay);
+}
+
+void Viewer::showDistance(QPoint pixel)
+{
+    static bool isAset = false;
+    bool found;
+    qglviewer::Vec point;
+    point = camera()->pointUnderPixel(pixel, found);
+    if(!isAset && found)
+    {
+        //set APoint
+        APoint = point;
+        isAset = true;
+        clearDistancedisplay();
+    }
+    else if (found)
+    {
+        //set BPoint
+        BPoint = point;
+        isAset = false;
+
+        // fills the buffers
+        std::vector<float> v;
+        v.resize(6);
+        v[0] = APoint.x; v[1] = APoint.y; v[2] = APoint.z;
+        v[3] = BPoint.x; v[4] = BPoint.y; v[5] = BPoint.z;
+        rendering_program_dist.bind();
+        vao[1].bind();
+        buffers[3].bind();
+        buffers[3].allocate(v.data(),6*sizeof(float));
+        rendering_program_dist.enableAttributeArray("vertex");
+        rendering_program_dist.setAttributeBuffer("vertex",GL_FLOAT,0,3);
+        buffers[3].release();
+        vao[1].release();
+        rendering_program_dist.release();
+        distance_is_displayed = true;
+        double dist = std::sqrt((BPoint.x-APoint.x)*(BPoint.x-APoint.x) + (BPoint.y-APoint.y)*(BPoint.y-APoint.y) + (BPoint.z-APoint.z)*(BPoint.z-APoint.z));
+        QFont font;
+        font.setBold(true);
+        TextItem *ACoord = new TextItem(APoint.x, APoint.y, APoint.z,QString("A(%1,%2,%3)").arg(APoint.x).arg(APoint.y).arg(APoint.z), true, font, Qt::red, true);
+        distance_text.append(ACoord);
+        TextItem *BCoord = new TextItem(BPoint.x, BPoint.y, BPoint.z,QString("B(%1,%2,%3)").arg(BPoint.x).arg(BPoint.y).arg(BPoint.z), true, font, Qt::red, true);
+        distance_text.append(BCoord);
+        qglviewer::Vec centerPoint = 0.5*(BPoint+APoint);
+        TextItem *centerCoord = new TextItem(centerPoint.x, centerPoint.y, centerPoint.z,QString(" distance: %1").arg(dist), true, font, Qt::red, true);
+
+        distance_text.append(centerCoord);
+        Q_FOREACH(TextItem* ti, distance_text)
+          textRenderer->addText(ti);
+        Q_EMIT(sendMessage(QString("First point : A(%1,%2,%3), second point : B(%4,%5,%6), distance between them : %7")
+                  .arg(APoint.x)
+                  .arg(APoint.y)
+                  .arg(APoint.z)
+                  .arg(BPoint.x)
+                  .arg(BPoint.y)
+                  .arg(BPoint.z)
+                  .arg(dist)));
+    }
+
+}
+
+void Viewer::clearDistancedisplay()
+{
+  distance_is_displayed = false;
+  Q_FOREACH(TextItem* ti, distance_text)
+  {
+    textRenderer->removeText(ti);
+    delete ti;
+  }
+  distance_text.clear();
+}
+
+void Viewer_impl::setFrustum(double l, double r, double t, double b, double n, double f)
+{
+  double A = 2*n/(r-l);
+  double B = (r+l)/(r-l);
+  double C = 2*n/(t-b);
+  double D = (t+b)/(t-b);
+  float E = -(f+n)/(f-n);
+  float F = -2*(f*n)/(f-n);
+  projectionMatrix.setRow(0, QVector4D(A,0,B,0));
+  projectionMatrix.setRow(1, QVector4D(0,C,D,0));
+  projectionMatrix.setRow(2, QVector4D(0,0,E,F));
+  projectionMatrix.setRow(3, QVector4D(0,0,-1,0));
+
+}
+
+#include "ui_ImageInterface.h"
+class ImageInterface: public QDialog, public Ui::ImageInterface
+{
+  Q_OBJECT
+  qreal ratio;
+  QWidget *currentlyFocused;
+public:
+  ImageInterface(QWidget *parent, qreal ratio)
+    : QDialog(parent), ratio(ratio)
+  {
+    currentlyFocused = NULL;
+    setupUi(this);
+    connect(imgHeight, SIGNAL(valueChanged(int)),
+            this, SLOT(imgHeightValueChanged(int)));
+
+    connect(imgWidth, SIGNAL(valueChanged(int)),
+            this, SLOT(imgWidthValueChanged(int)));
+
+    connect(qApp, SIGNAL(focusChanged(QWidget*, QWidget*)),
+            this, SLOT(onFocusChanged(QWidget*, QWidget*)));
+  }
+private Q_SLOTS:
+  void imgHeightValueChanged(int i)
+  {
+    if(currentlyFocused == imgHeight
+       && ratioCheckBox->isChecked())
+    {imgWidth->setValue(i*ratio);}
+  }
+
+  void imgWidthValueChanged(int i)
+  {
+    if(currentlyFocused == imgWidth
+       && ratioCheckBox->isChecked())
+    {imgHeight->setValue(i/ratio);}
+  }
+
+  void onFocusChanged(QWidget*, QWidget* now)
+  {
+    currentlyFocused = now;
+  }
+};
+
+void Viewer::saveSnapshot(bool, bool)
+{
+  qreal aspectRatio = width() / static_cast<qreal>(height());
+  static ImageInterface* imageInterface = NULL;
+
+  if (!imageInterface)
+    imageInterface = new ImageInterface(this, aspectRatio);
+
+  imageInterface->imgWidth->setValue(width());
+  imageInterface->imgHeight->setValue(height());
+  imageInterface->imgQuality->setValue(snapshotQuality());
+
+  if (imageInterface->exec() == QDialog::Rejected)
+    return;
+  QSize finalSize(imageInterface->imgWidth->value(), imageInterface->imgHeight->value());
+  bool expand = imageInterface->expandFrustum->isChecked();
+  QString fileName = QFileDialog::getSaveFileName(this,
+                                                  tr("Save Snapshot"), "", tr("Image Files (*.png *.jpg *.bmp)"));
+  if(fileName.isEmpty())
+  {
+    return;
+  }
+  QImage* image= d->takeSnapshot(this, imageInterface->imgQuality->value(), imageInterface->color_comboBox->currentIndex(),
+        finalSize, imageInterface->oversampling->value(), expand);
+  if(image)
+  {
+    image->save(fileName);
+    delete image;
+  }
+
+}
+//copy a snapshot with transparent background with arbitrary quality values.
+QImage* Viewer_impl::takeSnapshot(Viewer *viewer, int quality, int background_color, QSize finalSize, double oversampling, bool expand)
+{
+  qreal aspectRatio = viewer->width() / static_cast<qreal>(viewer->height());
+  viewer->setSnapshotQuality(quality);
+  GLfloat alpha = 1.0f;
+  QColor previousBGColor = viewer->backgroundColor();
+  switch(background_color)
+  {
+  case 0:
+    break;
+  case 1:
+    viewer->setBackgroundColor(QColor(Qt::transparent));
+    alpha = 0.0f;
+    break;
+  case 2:
+    QColor c =  QColorDialog::getColor();
+    if(c.isValid()) {
+      viewer->setBackgroundColor(c);
+    }
+    else
+      return NULL;
+    break;
+  }
+
+
+  QSize subSize(int(viewer->width()/oversampling), int(viewer->height()/oversampling));
+  QSize size=QSize(viewer->width(), viewer->height());
+
+
+  qreal newAspectRatio = finalSize.width() / static_cast<qreal>(finalSize.height());
+
+  qreal zNear = viewer->camera()->zNear();
+  qreal zFar = viewer->camera()->zFar();
+
+  qreal xMin, yMin;
+
+  if ((expand && (newAspectRatio>aspectRatio)) || (!expand && (newAspectRatio<aspectRatio)))
+  {
+    yMin = zNear * tan(viewer->camera()->fieldOfView() / 2.0);
+    xMin = newAspectRatio * yMin;
+  }
+  else
+  {
+    xMin = zNear * tan(viewer->camera()->fieldOfView() / 2.0) * aspectRatio;
+    yMin = xMin / newAspectRatio;
+  }
+
+  QImage *image = new QImage(finalSize.width(), finalSize.height(), QImage::Format_ARGB32);
+
+  if (image->isNull())
+  {
+    QMessageBox::warning(viewer, "Image saving error",
+                         "Unable to create resulting image",
+                         QMessageBox::Ok, QMessageBox::NoButton);
+    viewer->setBackgroundColor(previousBGColor);
+    return NULL;
+  }
+
+  qreal scaleX = subSize.width() / static_cast<qreal>(finalSize.width());
+  qreal scaleY = subSize.height() / static_cast<qreal>(finalSize.height());
+
+  qreal deltaX = 2.0 * xMin * scaleX;
+  qreal deltaY = 2.0 * yMin * scaleY;
+
+  int nbX = finalSize.width() / subSize.width();
+  int nbY = finalSize.height() / subSize.height();
+
+  // Extra subimage on the right/bottom border(s) if needed
+  if (nbX * subSize.width() < finalSize.width())
+    nbX++;
+  if (nbY * subSize.height() < finalSize.height())
+    nbY++;
+
+  QOpenGLFramebufferObject* fbo = new QOpenGLFramebufferObject(size, QOpenGLFramebufferObject::CombinedDepthStencil);
+  viewer->makeCurrent();
+  int count=0;
+  for (int i=0; i<nbX; i++)
+    for (int j=0; j<nbY; j++)
+    {
+      setFrustum(-xMin + i*deltaX, -xMin + (i+1)*deltaX, yMin - j*deltaY, yMin - (j+1)*deltaY, zNear, zFar);
+      fbo->bind();
+      viewer->glClearColor(viewer->backgroundColor().redF(), viewer->backgroundColor().greenF(), viewer->backgroundColor().blueF(), alpha);
+      viewer->preDraw();
+      viewer->draw();
+      viewer->postDraw();
+      fbo->release();
+
+      QImage snapshot = fbo->toImage();
+      QImage subImage = snapshot.scaled(subSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
+      // Copy subImage in image
+      for (int ii=0; ii<subSize.width(); ii++)
+      {
+        int fi = i*subSize.width() + ii;
+        if (fi == image->width())
+          break;
+        for (int jj=0; jj<subSize.height(); jj++)
+        {
+          int fj = j*subSize.height() + jj;
+          if (fj == image->height())
+            break;
+          image->setPixel(fi, fj, subImage.pixel(ii,jj));
+        }
+      }
+      count++;
+    }
+  if(background_color !=0)
+    viewer->setBackgroundColor(previousBGColor);
+  return image;
+}
+void Viewer_impl::sendSnapshotToClipboard(Viewer *viewer)
+{
+  QImage * snap = takeSnapshot(viewer, 95, 1, 2*viewer->size(), 1, true);
+  if(snap)
+  {
+    QApplication::clipboard()->setImage(*snap);
+    delete snap;
+  }
+
+}
+ #include "Viewer.moc"
diff --git a/3rdparty/CGAL/demo/Polyhedron/Viewer.h b/3rdparty/CGAL/demo/Polyhedron/Viewer.h
new file mode 100644
index 0000000..eb6a9a4
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/Viewer.h
@@ -0,0 +1,181 @@
+//! \file Viewer.h
+
+#ifndef VIEWER_H
+#define VIEWER_H
+
+#include <CGAL/Three/Viewer_config.h>
+#include <CGAL/Three/Scene_interface.h>
+#include <QOpenGLBuffer>
+#include <QOpenGLVertexArrayObject>
+#include <QOpenGLShaderProgram>
+#include <CGAL/Three/Viewer_interface.h>
+
+#include <QGLViewer/qglviewer.h>
+#include <QPoint>
+#include <QFont>
+#include <QOpenGLFramebufferObject>
+#include <CGAL/Three/TextRenderer.h>
+// forward declarations
+class QWidget;
+namespace CGAL{
+namespace Three{
+class Scene_draw_interface;
+}
+}
+class QMouseEvent;
+class QKeyEvent;
+class QContextMenuEvent;
+
+class Viewer_impl;
+//!The viewer class. Deals with all the openGL rendering and the mouse/keyboard events.
+class VIEWER_EXPORT Viewer : public CGAL::Three::Viewer_interface {
+
+  Q_OBJECT
+
+public:
+  Viewer(QWidget * parent, bool antialiasing = false);
+  ~Viewer();
+  bool testDisplayId(double, double, double);
+  // overload several QGLViewer virtual functions
+  //! Draws the scene.
+  void draw();
+  //!This step happens after draw(). It is here that all the useful information is displayed, like the axis system or the informative text.
+  void drawVisualHints();
+  //! Deprecated. Does the same as draw().
+  void fastDraw();
+  //! Initializes the OpenGL functions and sets the backGround color.
+  void initializeGL();
+  //! Draws the scene "with names" to allow picking.
+  void drawWithNames();
+  /*! Uses the parameter pixel's coordinates to get the corresponding point
+   * in the World frame. If this point is found, emits selectedPoint, selected,
+   * and selectionRay signals.
+   */
+  void postSelection(const QPoint&);
+  //! Sets the picking matrix to allow the picking.
+  void beginSelection(const QPoint &point);
+  //! Sets the pick matrix to Identity once the picking is done.
+  void endSelection(const QPoint &point);
+  //! Sets the scene for the viewer.
+  void setScene(CGAL::Three::Scene_draw_interface* scene);
+  //! @returns the antialiasing state.
+  bool antiAliasing() const;
+  //! @returns the fastDrawing state.
+  bool inFastDrawing() const;
+  //! Implementation of `Viewer_interface::inDrawWithNames()`
+  bool inDrawWithNames() const;
+  //! Implementation of `Viewer_interface::attribBuffers()`
+  void attribBuffers(int program_name) const;
+  //! Implementation of `Viewer_interface::getShaderProgram()`
+  QOpenGLShaderProgram* getShaderProgram(int name) const;
+  QPainter* getPainter();
+  void saveSnapshot(bool , bool overwrite = false);
+
+Q_SIGNALS:
+  void sendMessage(QString);
+public Q_SLOTS:
+  //! Sets the antialiasing to true or false.
+  void setAntiAliasing(bool b);
+  //! If b is true, facets will be ligted from both internal and external sides.
+  //! If b is false, only the side that is exposed to the light source will be lighted.
+  void setTwoSides(bool b);
+  //! If b is true, some items are displayed in a simplified version when moving the camera.
+  //! If b is false, items display is never altered, even when moving.
+  void setFastDrawing(bool b);
+  //! Makes the camera turn around.
+  void turnCameraBy180Degres();
+  //! @returns a QString containing the position and orientation of the camera.
+  QString dumpCameraCoordinates();
+  //!Moves the camera to the new coordinates (position and orientation) through an animation.
+  bool moveCameraToCoordinates(QString, 
+                               float animation_duration = 0.5f);
+  //!Makes the Viewer display a message
+  void printMessage(QString message, int ms_delay );
+  void displayMessage(const QString &_message, int delay);
+  void displayMessage(const QString &_message){displayMessage(_message, 2000);}
+  void hideMessage();
+
+protected:
+  void postDraw();
+  void paintEvent(QPaintEvent *);
+  void paintGL();
+  //! Holds useful data to draw the axis system
+  struct AxisData
+  {
+      std::vector<float> *vertices;
+      std::vector<float> *normals;
+      std::vector<float> *colors;
+  };
+
+  //! The buffers used to draw the axis system
+  QOpenGLBuffer buffers[4];
+  //! The VAO used to draw the axis system
+  QOpenGLVertexArrayObject vao[2];
+  //! The rendering program used to draw the axis system
+  QOpenGLShaderProgram rendering_program;
+  //! The rendering program used to draw the distance
+  QOpenGLShaderProgram rendering_program_dist;
+  QList<TextItem*>  distance_text;
+  //! Holds the vertices data for the axis system
+  std::vector<float> v_Axis;
+  //! Holds the normals data for the axis system
+  std::vector<float> n_Axis;
+  //! Holds the color data for the axis system
+  std::vector<float> c_Axis;
+  //! Decides if the axis system must be drawn or not
+  bool axis_are_displayed;
+  //! Decides if the text is displayed in the drawVisualHints function.
+  bool has_text;
+  //! Decides if the distance between APoint and BPoint must be drawn;
+  bool distance_is_displayed;
+  //!Defines the behaviour for the mouse press events
+  void mousePressEvent(QMouseEvent*);
+  void wheelEvent(QWheelEvent *);
+  //!Defines the behaviour for the key press events
+  void keyPressEvent(QKeyEvent*);
+  //!Deal with context menu events
+  void contextMenuEvent(QContextMenuEvent*);
+  //!Defines the behaviour for the key release events
+  void keyReleaseEvent(QKeyEvent *);
+  //!Clears the distance display
+  void clearDistancedisplay();
+  /*!
+   * \brief makeArrow creates an arrow and stores it in a struct of vectors.
+   * \param R the radius of the arrow.
+   * \param prec the precision of the quadric. The lower this value is, the higher precision you get.
+   * It can be any int between 1 and 360.
+   * \param from the starting point of the arrow.
+   * \param to the destination point of the arrow (the pointed extremity).
+   * \param color the RGB color of the arrow.
+   * \param data the struct of std::vector that will contain the results.
+   */
+
+  void makeArrow(double R, int prec, qglviewer::Vec from, qglviewer::Vec to, qglviewer::Vec color, AxisData &data);
+  void resizeGL(int w, int h);
+  bool i_is_pressed;
+
+  //!Draws the distance between two selected points.
+  void showDistance(QPoint);
+  qglviewer::Vec APoint;
+  qglviewer::Vec BPoint;
+  bool is_d_pressed;
+
+protected:
+  friend class Viewer_impl;
+  Viewer_impl* d;
+  double prev_radius;
+
+private:
+  // F P S    d i s p l a y
+  QTime fpsTime;
+  unsigned int fpsCounter;
+  QString fpsString;
+  float f_p_s;
+  // M e s s a g e s
+  QString message;
+  bool _displayMessage;
+  QTimer messageTimer;
+}; // end class Viewer
+
+
+#endif // VIEWER_H
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/concurrent_mesher_config.cfg b/3rdparty/CGAL/demo/Polyhedron/concurrent_mesher_config.cfg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/concurrent_mesher_config.cfg
rename to 3rdparty/CGAL/demo/Polyhedron/concurrent_mesher_config.cfg
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/config.h b/3rdparty/CGAL/demo/Polyhedron/config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/config.h
rename to 3rdparty/CGAL/demo/Polyhedron/config.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/create_sphere.h b/3rdparty/CGAL/demo/Polyhedron/create_sphere.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/create_sphere.h
rename to 3rdparty/CGAL/demo/Polyhedron/create_sphere.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/data/anchor.off b/3rdparty/CGAL/demo/Polyhedron/data/anchor.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/data/anchor.off
rename to 3rdparty/CGAL/demo/Polyhedron/data/anchor.off
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/data/bones.off b/3rdparty/CGAL/demo/Polyhedron/data/bones.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/data/bones.off
rename to 3rdparty/CGAL/demo/Polyhedron/data/bones.off
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/data/couplingdown.off b/3rdparty/CGAL/demo/Polyhedron/data/couplingdown.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/data/couplingdown.off
rename to 3rdparty/CGAL/demo/Polyhedron/data/couplingdown.off
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/data/cow.off b/3rdparty/CGAL/demo/Polyhedron/data/cow.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/data/cow.off
rename to 3rdparty/CGAL/demo/Polyhedron/data/cow.off
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/data/cross.off b/3rdparty/CGAL/demo/Polyhedron/data/cross.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/data/cross.off
rename to 3rdparty/CGAL/demo/Polyhedron/data/cross.off
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/data/cube-ouvert.off b/3rdparty/CGAL/demo/Polyhedron/data/cube-ouvert.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/data/cube-ouvert.off
rename to 3rdparty/CGAL/demo/Polyhedron/data/cube-ouvert.off
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/data/cube-shuffled.off b/3rdparty/CGAL/demo/Polyhedron/data/cube-shuffled.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/data/cube-shuffled.off
rename to 3rdparty/CGAL/demo/Polyhedron/data/cube-shuffled.off
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/data/cube.off b/3rdparty/CGAL/demo/Polyhedron/data/cube.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/data/cube.off
rename to 3rdparty/CGAL/demo/Polyhedron/data/cube.off
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/data/cube4-shuffled.off b/3rdparty/CGAL/demo/Polyhedron/data/cube4-shuffled.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/data/cube4-shuffled.off
rename to 3rdparty/CGAL/demo/Polyhedron/data/cube4-shuffled.off
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/data/dragknob.off b/3rdparty/CGAL/demo/Polyhedron/data/dragknob.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/data/dragknob.off
rename to 3rdparty/CGAL/demo/Polyhedron/data/dragknob.off
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/data/elephant.off b/3rdparty/CGAL/demo/Polyhedron/data/elephant.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/data/elephant.off
rename to 3rdparty/CGAL/demo/Polyhedron/data/elephant.off
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/data/ellipsoid.off b/3rdparty/CGAL/demo/Polyhedron/data/ellipsoid.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/data/ellipsoid.off
rename to 3rdparty/CGAL/demo/Polyhedron/data/ellipsoid.off
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/data/handle.off b/3rdparty/CGAL/demo/Polyhedron/data/handle.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/data/handle.off
rename to 3rdparty/CGAL/demo/Polyhedron/data/handle.off
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/data/icosahedron.off b/3rdparty/CGAL/demo/Polyhedron/data/icosahedron.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/data/icosahedron.off
rename to 3rdparty/CGAL/demo/Polyhedron/data/icosahedron.off
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/data/joint.off b/3rdparty/CGAL/demo/Polyhedron/data/joint.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/data/joint.off
rename to 3rdparty/CGAL/demo/Polyhedron/data/joint.off
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/data/knot1.off b/3rdparty/CGAL/demo/Polyhedron/data/knot1.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/data/knot1.off
rename to 3rdparty/CGAL/demo/Polyhedron/data/knot1.off
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/data/knot2.off b/3rdparty/CGAL/demo/Polyhedron/data/knot2.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/data/knot2.off
rename to 3rdparty/CGAL/demo/Polyhedron/data/knot2.off
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/data/man.off b/3rdparty/CGAL/demo/Polyhedron/data/man.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/data/man.off
rename to 3rdparty/CGAL/demo/Polyhedron/data/man.off
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/data/mushroom.off b/3rdparty/CGAL/demo/Polyhedron/data/mushroom.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/data/mushroom.off
rename to 3rdparty/CGAL/demo/Polyhedron/data/mushroom.off
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/data/negative.off b/3rdparty/CGAL/demo/Polyhedron/data/negative.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/data/negative.off
rename to 3rdparty/CGAL/demo/Polyhedron/data/negative.off
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/data/oblong-shuffled.off b/3rdparty/CGAL/demo/Polyhedron/data/oblong-shuffled.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/data/oblong-shuffled.off
rename to 3rdparty/CGAL/demo/Polyhedron/data/oblong-shuffled.off
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/data/oblong.off b/3rdparty/CGAL/demo/Polyhedron/data/oblong.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/data/oblong.off
rename to 3rdparty/CGAL/demo/Polyhedron/data/oblong.off
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/data/pinion.off b/3rdparty/CGAL/demo/Polyhedron/data/pinion.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/data/pinion.off
rename to 3rdparty/CGAL/demo/Polyhedron/data/pinion.off
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/data/pipe.off b/3rdparty/CGAL/demo/Polyhedron/data/pipe.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/data/pipe.off
rename to 3rdparty/CGAL/demo/Polyhedron/data/pipe.off
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/data/pyramid.off b/3rdparty/CGAL/demo/Polyhedron/data/pyramid.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/data/pyramid.off
rename to 3rdparty/CGAL/demo/Polyhedron/data/pyramid.off
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/data/rotor.off b/3rdparty/CGAL/demo/Polyhedron/data/rotor.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/data/rotor.off
rename to 3rdparty/CGAL/demo/Polyhedron/data/rotor.off
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/data/sphere.off b/3rdparty/CGAL/demo/Polyhedron/data/sphere.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/data/sphere.off
rename to 3rdparty/CGAL/demo/Polyhedron/data/sphere.off
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/data/spool.off b/3rdparty/CGAL/demo/Polyhedron/data/spool.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/data/spool.off
rename to 3rdparty/CGAL/demo/Polyhedron/data/spool.off
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/data/star.off b/3rdparty/CGAL/demo/Polyhedron/data/star.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/data/star.off
rename to 3rdparty/CGAL/demo/Polyhedron/data/star.off
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/data/translated-cube.off b/3rdparty/CGAL/demo/Polyhedron/data/translated-cube.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/data/translated-cube.off
rename to 3rdparty/CGAL/demo/Polyhedron/data/translated-cube.off
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/data/tripod.off b/3rdparty/CGAL/demo/Polyhedron/data/tripod.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/data/tripod.off
rename to 3rdparty/CGAL/demo/Polyhedron/data/tripod.off
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/implicit_functions/CMakeLists.txt b/3rdparty/CGAL/demo/Polyhedron/implicit_functions/CMakeLists.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/implicit_functions/CMakeLists.txt
rename to 3rdparty/CGAL/demo/Polyhedron/implicit_functions/CMakeLists.txt
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/implicit_functions/Implicit_function_interface.h b/3rdparty/CGAL/demo/Polyhedron/implicit_functions/Implicit_function_interface.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/implicit_functions/Implicit_function_interface.h
rename to 3rdparty/CGAL/demo/Polyhedron/implicit_functions/Implicit_function_interface.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/implicit_functions/Klein_implicit_function.cpp b/3rdparty/CGAL/demo/Polyhedron/implicit_functions/Klein_implicit_function.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/implicit_functions/Klein_implicit_function.cpp
rename to 3rdparty/CGAL/demo/Polyhedron/implicit_functions/Klein_implicit_function.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/implicit_functions/Sphere_implicit_function.cpp b/3rdparty/CGAL/demo/Polyhedron/implicit_functions/Sphere_implicit_function.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/implicit_functions/Sphere_implicit_function.cpp
rename to 3rdparty/CGAL/demo/Polyhedron/implicit_functions/Sphere_implicit_function.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/implicit_functions/Tanglecube_implicit_function.cpp b/3rdparty/CGAL/demo/Polyhedron/implicit_functions/Tanglecube_implicit_function.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/implicit_functions/Tanglecube_implicit_function.cpp
rename to 3rdparty/CGAL/demo/Polyhedron/implicit_functions/Tanglecube_implicit_function.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/include/CGAL/Dualizer.h b/3rdparty/CGAL/demo/Polyhedron/include/CGAL/Dualizer.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/include/CGAL/Dualizer.h
rename to 3rdparty/CGAL/demo/Polyhedron/include/CGAL/Dualizer.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/include/CGAL/Make_bar.h b/3rdparty/CGAL/demo/Polyhedron/include/CGAL/Make_bar.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/include/CGAL/Make_bar.h
rename to 3rdparty/CGAL/demo/Polyhedron/include/CGAL/Make_bar.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/include/CGAL/Make_quad_soup.h b/3rdparty/CGAL/demo/Polyhedron/include/CGAL/Make_quad_soup.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/include/CGAL/Make_quad_soup.h
rename to 3rdparty/CGAL/demo/Polyhedron/include/CGAL/Make_quad_soup.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/include/CGAL/Make_triangle_soup.h b/3rdparty/CGAL/demo/Polyhedron/include/CGAL/Make_triangle_soup.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/include/CGAL/Make_triangle_soup.h
rename to 3rdparty/CGAL/demo/Polyhedron/include/CGAL/Make_triangle_soup.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/include/CGAL/Polyhedron_kernel.h b/3rdparty/CGAL/demo/Polyhedron/include/CGAL/Polyhedron_kernel.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/include/CGAL/Polyhedron_kernel.h
rename to 3rdparty/CGAL/demo/Polyhedron/include/CGAL/Polyhedron_kernel.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/include/CGAL/Textured_polyhedron_builder.h b/3rdparty/CGAL/demo/Polyhedron/include/CGAL/Textured_polyhedron_builder.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/include/CGAL/Textured_polyhedron_builder.h
rename to 3rdparty/CGAL/demo/Polyhedron/include/CGAL/Textured_polyhedron_builder.h
diff --git a/3rdparty/CGAL/demo/Polyhedron/include/CGAL/Triangulation_file_input.h b/3rdparty/CGAL/demo/Polyhedron/include/CGAL/Triangulation_file_input.h
new file mode 100644
index 0000000..a7dd3dc
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/include/CGAL/Triangulation_file_input.h
@@ -0,0 +1,103 @@
+// Copyright (c) 1997-2010  INRIA Sophia-Antipolis (France).
+// Copyright (c) 2011       GeometryFactory Sarl (France)
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you may redistribute it under
+// the terms of the Q Public License version 1.0.
+// See the file LICENSE.QPL distributed with CGAL.
+//
+// Licensees holding a valid commercial license may use this file in
+// accordance with the commercial license agreement provided with the software.
+//
+// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+// Author(s)     : Laurent Rineau
+//
+
+// Adapted from operator>>(std::istream&, Triangulation_3&) from
+// <CGAL/Triangulation_3.h>
+
+#ifndef CGAL_TRIANGULATION_FILE_INPUT_3_H
+#define CGAL_TRIANGULATION_FILE_INPUT_3_H
+
+#include <CGAL/basic.h>
+
+namespace CGAL {
+
+template <typename Tr1, 
+          typename Tr2,
+          typename Update_vertex,
+          typename Update_cell>
+std::istream& file_input(std::istream& is, Tr2 &tr,
+                         Update_vertex update_vertex = Update_vertex(),
+                         Update_cell update_cell = Update_cell())
+  // reads
+  // the dimension
+  // the number of finite vertices
+  // the non combinatorial information on vertices (point, etc)
+  // the number of cells
+  // the cells by the indices of their vertices in the preceding list
+  // of vertices, plus the non combinatorial information on each cell
+  // the neighbors of each cell by their index in the preceding list of cells
+  // when dimension < 3 : the same with faces of maximal dimension
+{
+  typedef Tr2 Triangulation;
+  typedef typename Triangulation::Vertex_handle  Vertex_handle;
+  typedef typename Triangulation::Cell_handle    Cell_handle;
+
+  typedef typename Tr1::Vertex Vertex1;
+  typedef typename Tr1::Cell Cell1;
+
+  tr.clear();
+  tr.tds().cells().clear();
+
+  std::size_t n;
+  int d;
+  if(is_ascii(is))
+     is >> d >> n;
+  else {
+    read(is, d);
+    read(is, n);
+  }
+  if(!is) return is;
+  tr.tds().set_dimension(d);
+
+  std::vector< Vertex_handle > V(n+1);
+  V[0] = tr.infinite_vertex();
+  // the infinite vertex is numbered 0
+
+  for (std::size_t i=1; i <= n; i++) {
+    V[i] = tr.tds().create_vertex();
+    Vertex1 v;
+    if(!(is >> v)) return is;
+    if(!update_vertex(v, *V[i])) { 
+      is.setstate(std::ios_base::failbit);
+      return is;
+    }
+  }
+
+  std::vector< Cell_handle > C;
+
+  std::size_t m;
+  tr.tds().read_cells(is, V, m, C);
+
+  for (std::size_t j=0 ; j < m; j++) {
+    Cell1 c;
+    if(!(is >> c)) return is;
+    if(!update_cell(c, *(C[j]))) {
+      is.setstate(std::ios_base::failbit);
+      return is;
+    }
+  }
+
+  CGAL_triangulation_assertion( tr.is_valid(false) );
+  return is;
+}
+
+} // end namespace CGAL
+
+#endif // CGAL_TRIANGULATION_FILE_INPUT_3_H
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/include/CGAL/gocad_io.h b/3rdparty/CGAL/demo/Polyhedron/include/CGAL/gocad_io.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/include/CGAL/gocad_io.h
rename to 3rdparty/CGAL/demo/Polyhedron/include/CGAL/gocad_io.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/include/CGAL/statistics_helpers.h b/3rdparty/CGAL/demo/Polyhedron/include/CGAL/statistics_helpers.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/include/CGAL/statistics_helpers.h
rename to 3rdparty/CGAL/demo/Polyhedron/include/CGAL/statistics_helpers.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/include/CGAL/textured_polyhedron.h b/3rdparty/CGAL/demo/Polyhedron/include/CGAL/textured_polyhedron.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/include/CGAL/textured_polyhedron.h
rename to 3rdparty/CGAL/demo/Polyhedron/include/CGAL/textured_polyhedron.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/include/CGAL/translate.h b/3rdparty/CGAL/demo/Polyhedron/include/CGAL/translate.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/include/CGAL/translate.h
rename to 3rdparty/CGAL/demo/Polyhedron/include/CGAL/translate.h
diff --git a/3rdparty/CGAL/demo/Polyhedron/include/Point_set_3.h b/3rdparty/CGAL/demo/Polyhedron/include/Point_set_3.h
new file mode 100644
index 0000000..7090444
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/include/Point_set_3.h
@@ -0,0 +1,332 @@
+// Author: Laurent Saboret, Nader Salman, Gael Guennebaud
+
+#ifndef POINT_SET_3_H
+#define POINT_SET_3_H
+
+#include <CGAL/property_map.h>
+#include <CGAL/Min_sphere_of_spheres_d.h>
+#include <CGAL/Min_sphere_of_points_d_traits_3.h>
+#include <CGAL/Min_sphere_of_spheres_d_traits_3.h>
+#include <UI_point_3.h>
+#include <algorithm>
+#include <vector>
+# include <CGAL/gl.h>
+
+/// The Point_set_3 class is array of points + normals of type
+/// Point_with_normal_3<Gt> (in fact
+/// UI_point_3 to support a selection flag and an optional radius).
+/// It provides:
+/// - accessors: points and normals iterators, property maps
+/// - OpenGL rendering
+/// - bounding box
+///
+/// CAUTION:
+/// - User is responsible to call invalidate_bounds() after adding, moving or removing points.
+/// - Selecting points changes the order of the points in the
+///   container. If selection is *not* empty, it becomes invalid after
+///   adding, moving or removing points, user is reponsible to call
+///   unselect_all() in those cases.
+///
+/// @heading Parameters:
+/// @param Gt       Geometric traits class.
+
+template <class Gt>
+class Point_set_3 : public std::vector<UI_point_3<Gt> >
+{
+// Private types
+private:
+
+  // Base class
+  typedef std::vector<UI_point_3<Gt> > Base;
+
+// Public types
+public:
+
+  // Repeat base class' types
+  /// @cond SKIP_IN_MANUAL
+  typedef typename Base::iterator iterator;
+  typedef typename Base::const_iterator const_iterator;
+
+  using Base::erase;
+
+  /// @endcond
+
+  // Classic CGAL geometric types
+  typedef Gt  Geom_traits; ///< Geometric traits class.
+  typedef typename Geom_traits::FT FT;
+  typedef typename Geom_traits::Point_3 Point;  ///< typedef to Geom_traits::Point_3
+  typedef typename Geom_traits::Vector_3 Vector; ///< typedef to Geom_traits::Vector_3
+  typedef typename Geom_traits::Iso_cuboid_3 Iso_cuboid;
+  typedef typename Geom_traits::Sphere_3 Sphere;
+
+  /// Type of points in Point_set_3
+  typedef UI_point_3<Gt> UI_point; ///< Position + normal + selection flag
+  // Its superclass:
+  typedef typename UI_point::Point_with_normal Point_with_normal; ///< Position + normal
+
+// Data members
+private:
+
+  // Indicate if m_barycenter, m_bounding_box, m_bounding_sphere and
+  // m_diameter_standard_deviation below are valid.
+  mutable bool m_bounding_box_is_valid;
+
+  mutable Iso_cuboid m_bounding_box; // point set's bounding box
+  mutable Sphere m_bounding_sphere; // point set's bounding sphere
+  mutable Point m_barycenter; // point set's barycenter
+  mutable FT m_diameter_standard_deviation; // point set's standard deviation
+
+  std::size_t m_nb_selected; // handle selection
+
+  bool m_radii_are_uptodate;
+
+  // Assignment operator not implemented and declared private to make
+  // sure nobody uses the default one without knowing it
+  Point_set_3& operator= (const Point_set_3&)
+  {
+    return *this;
+  }
+
+  
+// Public methods
+public:
+
+  /// Default constructor.
+  Point_set_3()
+  {
+    m_nb_selected = 0;
+    m_bounding_box_is_valid = false;
+    m_radii_are_uptodate = false;
+  }
+
+  // copy constructor 
+  Point_set_3 (const Point_set_3& p) : Base (p)
+  {
+    m_bounding_box_is_valid = p.m_bounding_box_is_valid;
+    m_bounding_box = p.m_bounding_box;
+    m_barycenter = p.m_barycenter;
+    m_diameter_standard_deviation = p.m_diameter_standard_deviation;
+
+    m_nb_selected = p.nb_selected_points ();
+    
+    m_radii_are_uptodate = p.m_radii_are_uptodate;
+  }
+
+  // Repeat base class' public methods used below
+  /// @cond SKIP_IN_MANUAL
+  using Base::begin;
+  using Base::end;
+  using Base::size;
+  /// @endcond
+
+  iterator first_selected() { return end() - m_nb_selected; }
+  const_iterator first_selected() const { return end () - m_nb_selected; }
+  void set_first_selected(iterator it)
+  {
+    m_nb_selected = static_cast<std::size_t>(std::distance (it, end()));
+  }
+
+  const_iterator begin_or_selection_begin() const
+  {
+    return (m_nb_selected == 0 ? begin() : first_selected());
+  }
+  iterator begin_or_selection_begin()
+  {
+    return (m_nb_selected == 0 ? begin() : first_selected());
+  }
+
+  // Test if point is selected
+  bool is_selected(const_iterator it) const
+  {
+    return static_cast<std::size_t>(std::distance (it, end())) <= m_nb_selected;
+  }
+
+  /// Gets the number of selected points.
+  std::size_t nb_selected_points() const
+  {
+    return m_nb_selected;
+  }
+
+  /// Mark a point as selected/not selected.
+  void select(iterator it, bool selected = true)
+  {
+    bool currently = is_selected (it);
+    iterator first = first_selected();
+    if (currently && !selected)
+      {
+        std::swap (*it, *first);
+        -- m_nb_selected;
+      }
+    else if (!currently && selected)
+      {
+        std::swap (*it, *(-- first));
+        ++ m_nb_selected;
+      }
+  }
+
+  void select_all()
+  {
+    m_nb_selected = size ();
+  }
+  void unselect_all()
+  {
+    m_nb_selected = 0;
+  }
+
+
+  // Invert selection
+  void invert_selection()
+  {
+    iterator sel = end() - 1;
+    iterator unsel = begin();
+
+    iterator first = first_selected();
+
+    while (sel != first - 1 && unsel != first)
+      std::swap (*(sel --), *(unsel ++));
+    
+    m_nb_selected = size() - m_nb_selected;
+  }
+
+  /// Deletes selected points.
+  void delete_selection()
+  {
+    // Deletes selected points using erase-remove idiom
+    erase (first_selected(), end ());
+
+    // after erase(), use Scott Meyer's "swap trick" to trim excess capacity
+    Point_set_3(*this).swap(*this);
+    m_nb_selected = 0;
+    invalidate_bounds();
+  }
+
+  /// Gets the bounding box.
+  Iso_cuboid bounding_box() const
+  {
+    if (!m_bounding_box_is_valid)
+      update_bounds();
+
+    return m_bounding_box;
+  }
+
+  /// Gets bounding sphere.
+  Sphere bounding_sphere() const
+  {
+    if (!m_bounding_box_is_valid)
+      update_bounds();
+
+    return m_bounding_sphere;
+  }
+
+  /// Gets points barycenter.
+  Point barycenter() const
+  {
+    if (!m_bounding_box_is_valid)
+      update_bounds();
+
+    return m_barycenter;
+  }
+
+  /// Gets the standard deviation of the distance to barycenter.
+  FT diameter_standard_deviation() const
+  {
+    if (!m_bounding_box_is_valid)
+      update_bounds();
+
+    return m_diameter_standard_deviation;
+  }
+
+  // Gets the region of interest, ignoring the outliers.
+  // This method is used to define the OpenGL arcball sphere.
+  Sphere region_of_interest() const
+  {
+    if (!m_bounding_box_is_valid)
+      update_bounds();
+
+    // A good candidate is a sphere containing the dense region of the point cloud:
+    // - center point is barycenter
+    // - Radius is 2 * standard deviation
+    float radius = 2.f * (float)m_diameter_standard_deviation;
+    return Sphere(m_barycenter, radius*radius);
+  }
+
+  /// Update barycenter, bounding box, bounding sphere and standard deviation.
+  /// User is responsible to call invalidate_bounds() after adding, moving or removing points.
+  void invalidate_bounds()
+  {
+    m_bounding_box_is_valid = false;
+  }
+
+
+
+
+  
+  bool are_radii_uptodate() const { return m_radii_are_uptodate; }
+  void set_radii_uptodate(bool /*on*/) { m_radii_are_uptodate = false; }
+
+// Private methods:
+private:
+
+  /// Recompute barycenter, bounding box, bounding sphere and standard deviation.
+  void update_bounds() const
+  {
+    if (begin() == end())
+      return;
+
+    // Update bounding box and barycenter.
+    // TODO: we should use the functions in PCA component instead.
+    FT xmin,xmax,ymin,ymax,zmin,zmax;
+    xmin = ymin = zmin =  1e38;
+    xmax = ymax = zmax = -1e38;
+    Vector v = CGAL::NULL_VECTOR;
+    FT norm = 0;
+    for (const_iterator it = begin(); it != end(); it++)
+    {
+      const Point& p = *it;
+
+      // update bbox
+      xmin = (std::min)(p.x(),xmin);
+      ymin = (std::min)(p.y(),ymin);
+      zmin = (std::min)(p.z(),zmin);
+      xmax = (std::max)(p.x(),xmax);
+      ymax = (std::max)(p.y(),ymax);
+      zmax = (std::max)(p.z(),zmax);
+
+      // update barycenter
+      v = v + (p - CGAL::ORIGIN);
+      norm += 1;
+    }
+    //
+    Point p(xmin,ymin,zmin);
+    Point q(xmax,ymax,zmax);
+    m_bounding_box = Iso_cuboid(p,q);
+    //
+    m_barycenter = CGAL::ORIGIN + v / norm;
+
+    // Computes bounding sphere
+    typedef CGAL::Min_sphere_of_points_d_traits_3<Gt,FT> Traits;
+    typedef CGAL::Min_sphere_of_spheres_d<Traits> Min_sphere;
+
+    Min_sphere ms(begin(),end());
+
+    typename Min_sphere::Cartesian_const_iterator coord = ms.center_cartesian_begin();
+    FT cx = *coord++;
+    FT cy = *coord++;
+    FT cz = *coord++;
+    m_bounding_sphere = Sphere(Point(cx,cy,cz), ms.radius()*ms.radius());
+
+    // Computes standard deviation of the distance to barycenter
+    typename Geom_traits::Compute_squared_distance_3 sqd;
+    FT sq_radius = 0;
+    for (const_iterator it = begin(); it != end(); it++)
+        sq_radius += sqd(*it, m_barycenter);
+    sq_radius /= FT(size());
+    m_diameter_standard_deviation = CGAL::sqrt(sq_radius);
+
+    m_bounding_box_is_valid = true;
+  }
+
+}; // end of class Point_set_3
+
+
+#endif // POINT_SET_3_H
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/include/UI_point_3.h b/3rdparty/CGAL/demo/Polyhedron/include/UI_point_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/include/UI_point_3.h
rename to 3rdparty/CGAL/demo/Polyhedron/include/UI_point_3.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/opengl_tools.h b/3rdparty/CGAL/demo/Polyhedron/opengl_tools.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/opengl_tools.h
rename to 3rdparty/CGAL/demo/Polyhedron/opengl_tools.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/polyhedron_demo_macros.cmake b/3rdparty/CGAL/demo/Polyhedron/polyhedron_demo_macros.cmake
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/polyhedron_demo_macros.cmake
rename to 3rdparty/CGAL/demo/Polyhedron/polyhedron_demo_macros.cmake
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/about.html b/3rdparty/CGAL/demo/Polyhedron/resources/about.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/resources/about.html
rename to 3rdparty/CGAL/demo/Polyhedron/resources/about.html
diff --git a/3rdparty/CGAL/demo/Polyhedron/resources/add_facet1.png b/3rdparty/CGAL/demo/Polyhedron/resources/add_facet1.png
new file mode 100644
index 0000000..b3d89e4
Binary files /dev/null and b/3rdparty/CGAL/demo/Polyhedron/resources/add_facet1.png differ
diff --git a/3rdparty/CGAL/demo/Polyhedron/resources/add_facet2.png b/3rdparty/CGAL/demo/Polyhedron/resources/add_facet2.png
new file mode 100644
index 0000000..6fb2f1d
Binary files /dev/null and b/3rdparty/CGAL/demo/Polyhedron/resources/add_facet2.png differ
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/back.png b/3rdparty/CGAL/demo/Polyhedron/resources/back.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/resources/back.png
rename to 3rdparty/CGAL/demo/Polyhedron/resources/back.png
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/boolean-diff.png b/3rdparty/CGAL/demo/Polyhedron/resources/boolean-diff.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/resources/boolean-diff.png
rename to 3rdparty/CGAL/demo/Polyhedron/resources/boolean-diff.png
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/boolean-intersection.png b/3rdparty/CGAL/demo/Polyhedron/resources/boolean-intersection.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/resources/boolean-intersection.png
rename to 3rdparty/CGAL/demo/Polyhedron/resources/boolean-intersection.png
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/boolean-union.png b/3rdparty/CGAL/demo/Polyhedron/resources/boolean-union.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/resources/boolean-union.png
rename to 3rdparty/CGAL/demo/Polyhedron/resources/boolean-union.png
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/bot.png b/3rdparty/CGAL/demo/Polyhedron/resources/bot.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/resources/bot.png
rename to 3rdparty/CGAL/demo/Polyhedron/resources/bot.png
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/cgal_logo.xpm b/3rdparty/CGAL/demo/Polyhedron/resources/cgal_logo.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/resources/cgal_logo.xpm
rename to 3rdparty/CGAL/demo/Polyhedron/resources/cgal_logo.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/check-off.png b/3rdparty/CGAL/demo/Polyhedron/resources/check-off.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/resources/check-off.png
rename to 3rdparty/CGAL/demo/Polyhedron/resources/check-off.png
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/check-off.svg b/3rdparty/CGAL/demo/Polyhedron/resources/check-off.svg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/resources/check-off.svg
rename to 3rdparty/CGAL/demo/Polyhedron/resources/check-off.svg
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/check-on.png b/3rdparty/CGAL/demo/Polyhedron/resources/check-on.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/resources/check-on.png
rename to 3rdparty/CGAL/demo/Polyhedron/resources/check-on.png
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/check.svg b/3rdparty/CGAL/demo/Polyhedron/resources/check.svg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/resources/check.svg
rename to 3rdparty/CGAL/demo/Polyhedron/resources/check.svg
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/convex-hull.png b/3rdparty/CGAL/demo/Polyhedron/resources/convex-hull.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/resources/convex-hull.png
rename to 3rdparty/CGAL/demo/Polyhedron/resources/convex-hull.png
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/down.png b/3rdparty/CGAL/demo/Polyhedron/resources/down.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/resources/down.png
rename to 3rdparty/CGAL/demo/Polyhedron/resources/down.png
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/editcopy.png b/3rdparty/CGAL/demo/Polyhedron/resources/editcopy.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/resources/editcopy.png
rename to 3rdparty/CGAL/demo/Polyhedron/resources/editcopy.png
diff --git a/3rdparty/CGAL/demo/Polyhedron/resources/euler_center.png b/3rdparty/CGAL/demo/Polyhedron/resources/euler_center.png
new file mode 100644
index 0000000..3036c85
Binary files /dev/null and b/3rdparty/CGAL/demo/Polyhedron/resources/euler_center.png differ
diff --git a/3rdparty/CGAL/demo/Polyhedron/resources/euler_facet.png b/3rdparty/CGAL/demo/Polyhedron/resources/euler_facet.png
new file mode 100644
index 0000000..958227a
Binary files /dev/null and b/3rdparty/CGAL/demo/Polyhedron/resources/euler_facet.png differ
diff --git a/3rdparty/CGAL/demo/Polyhedron/resources/euler_vertex.png b/3rdparty/CGAL/demo/Polyhedron/resources/euler_vertex.png
new file mode 100644
index 0000000..8ec3a0d
Binary files /dev/null and b/3rdparty/CGAL/demo/Polyhedron/resources/euler_vertex.png differ
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/front.png b/3rdparty/CGAL/demo/Polyhedron/resources/front.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/resources/front.png
rename to 3rdparty/CGAL/demo/Polyhedron/resources/front.png
diff --git a/3rdparty/CGAL/demo/Polyhedron/resources/general_collapse.png b/3rdparty/CGAL/demo/Polyhedron/resources/general_collapse.png
new file mode 100644
index 0000000..41e3c64
Binary files /dev/null and b/3rdparty/CGAL/demo/Polyhedron/resources/general_collapse.png differ
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/kernel.png b/3rdparty/CGAL/demo/Polyhedron/resources/kernel.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/resources/kernel.png
rename to 3rdparty/CGAL/demo/Polyhedron/resources/kernel.png
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/left.png b/3rdparty/CGAL/demo/Polyhedron/resources/left.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/resources/left.png
rename to 3rdparty/CGAL/demo/Polyhedron/resources/left.png
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/minus.png b/3rdparty/CGAL/demo/Polyhedron/resources/minus.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/resources/minus.png
rename to 3rdparty/CGAL/demo/Polyhedron/resources/minus.png
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/plus.png b/3rdparty/CGAL/demo/Polyhedron/resources/plus.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/resources/plus.png
rename to 3rdparty/CGAL/demo/Polyhedron/resources/plus.png
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/right.png b/3rdparty/CGAL/demo/Polyhedron/resources/right.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/resources/right.png
rename to 3rdparty/CGAL/demo/Polyhedron/resources/right.png
diff --git a/3rdparty/CGAL/demo/Polyhedron/resources/shader_c3t3.f b/3rdparty/CGAL/demo/Polyhedron/resources/shader_c3t3.f
new file mode 100644
index 0000000..4e6a356
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/resources/shader_c3t3.f
@@ -0,0 +1,42 @@
+#version 120
+varying highp vec4 color;
+varying highp vec4 fP; 
+varying highp vec3 fN; 
+uniform highp vec4 light_pos;  
+uniform highp vec4 light_diff; 
+uniform highp vec4 light_spec; 
+uniform highp vec4 light_amb;  
+uniform highp float spec_power ; 
+uniform int is_two_side; 
+uniform bool is_selected;
+void main(void) {
+ if(color.w<0)
+ {
+    vec4 my_color = vec4(color.xzy, 1.);
+    highp vec3 L = light_pos.xyz - fP.xyz; 
+    highp vec3 V = -fP.xyz; 
+    highp vec3 N; 
+    if(fN == highp vec3(0.0,0.0,0.0))
+        N = highp vec3(0.0,0.0,0.0); 
+    else 
+        N = normalize(fN); 
+    L = normalize(L); 
+    V = normalize(V); 
+    highp vec3 R = reflect(-L, N); 
+    vec4 diffuse; 
+    if(is_two_side == 1) 
+        diffuse = abs(dot(N,L)) * light_diff * my_color; 
+    else 
+        diffuse = max(dot(N,L), 0.0) * light_diff * my_color; 
+    highp vec4 specular = pow(max(dot(R,V), 0.0), spec_power) * light_spec; 
+    vec4 ret_color = vec4((my_color*light_amb).xyz + diffuse.xyz + specular.xyz,1); 
+    if(is_selected)
+        gl_FragColor = vec4(ret_color.r+70.0/255.0, ret_color.g+70.0/255.0, ret_color.b+70.0/255.0, 1.0);
+    else
+        gl_FragColor = ret_color;
+ }
+ else
+   discard;
+}
+
+
diff --git a/3rdparty/CGAL/demo/Polyhedron/resources/shader_c3t3.v b/3rdparty/CGAL/demo/Polyhedron/resources/shader_c3t3.v
new file mode 100644
index 0000000..2c2706e
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/resources/shader_c3t3.v
@@ -0,0 +1,17 @@
+#version 120
+attribute highp vec4 vertex;
+attribute highp vec3 normals;
+attribute highp vec3 colors;
+uniform highp mat4 mvp_matrix;
+uniform highp mat4 mv_matrix; 
+uniform highp vec4 cutplane;
+varying highp vec4 fP; 
+varying highp vec3 fN; 
+varying highp vec4 color; 
+void main(void)
+{
+  color = vec4(colors, vertex.x * cutplane.x  + vertex.y * cutplane.y  + vertex.z * cutplane.z  +  cutplane.w);
+  fP = mv_matrix * vertex; 
+  fN = mat3(mv_matrix)* normals; 
+  gl_Position = mvp_matrix * vertex; 
+}
diff --git a/3rdparty/CGAL/demo/Polyhedron/resources/shader_c3t3_edges.f b/3rdparty/CGAL/demo/Polyhedron/resources/shader_c3t3_edges.f
new file mode 100644
index 0000000..40c1e0e
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/resources/shader_c3t3_edges.f
@@ -0,0 +1,9 @@
+#version 120
+varying highp vec4 color;
+void main(void) 
+{ 
+  if(color.w<0)
+    gl_FragColor = vec4(0,0,0,1.0); 
+  else
+    discard;
+}  
diff --git a/3rdparty/CGAL/demo/Polyhedron/resources/shader_c3t3_edges.v b/3rdparty/CGAL/demo/Polyhedron/resources/shader_c3t3_edges.v
new file mode 100644
index 0000000..842bed2
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/resources/shader_c3t3_edges.v
@@ -0,0 +1,11 @@
+#version 120
+attribute highp vec4 vertex;
+attribute highp vec3 colors;
+uniform highp mat4 mvp_matrix;
+uniform highp vec4 cutplane;
+varying highp vec4 color; 
+void main(void)
+{
+  color = vec4(colors, vertex.x * cutplane.x  + vertex.y * cutplane.y  + vertex.z * cutplane.z  +  cutplane.w);
+  gl_Position = mvp_matrix * vertex;
+}
diff --git a/3rdparty/CGAL/demo/Polyhedron/resources/shader_c3t3_spheres.v b/3rdparty/CGAL/demo/Polyhedron/resources/shader_c3t3_spheres.v
new file mode 100644
index 0000000..72b3150
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/resources/shader_c3t3_spheres.v
@@ -0,0 +1,22 @@
+#version 120
+attribute highp vec4 vertex;
+attribute highp vec3 normals;
+attribute highp vec3 colors;
+attribute highp vec3 center;
+attribute highp float radius;
+uniform highp vec4 cutplane;
+uniform highp mat4 mvp_matrix;
+uniform highp mat4 mv_matrix;
+varying highp vec4 fP;
+varying highp vec3 fN;
+varying highp vec4 color;
+
+
+void main(void)
+{
+  color = vec4(colors, center.x * cutplane.x  + center.y * cutplane.y  + center.z * cutplane.z  +  cutplane.w);
+  fP = mv_matrix * vertex;
+  fN = mat3(mv_matrix)* normals;
+  gl_Position =  mvp_matrix *
+  vec4(radius*vertex.x + center.x, radius* vertex.y + center.y, radius*vertex.z + center.z, 1.0) ;
+}
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/shader_instanced.v b/3rdparty/CGAL/demo/Polyhedron/resources/shader_instanced.v
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/resources/shader_instanced.v
rename to 3rdparty/CGAL/demo/Polyhedron/resources/shader_instanced.v
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/shader_no_light_no_selection.f b/3rdparty/CGAL/demo/Polyhedron/resources/shader_no_light_no_selection.f
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/resources/shader_no_light_no_selection.f
rename to 3rdparty/CGAL/demo/Polyhedron/resources/shader_no_light_no_selection.f
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/shader_plane_two_faces.f b/3rdparty/CGAL/demo/Polyhedron/resources/shader_plane_two_faces.f
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/resources/shader_plane_two_faces.f
rename to 3rdparty/CGAL/demo/Polyhedron/resources/shader_plane_two_faces.f
diff --git a/3rdparty/CGAL/demo/Polyhedron/resources/shader_spheres.v b/3rdparty/CGAL/demo/Polyhedron/resources/shader_spheres.v
new file mode 100644
index 0000000..fa6a2a7
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/resources/shader_spheres.v
@@ -0,0 +1,21 @@
+#version 120
+attribute highp vec4 vertex;
+attribute highp vec3 normals;
+attribute highp vec3 colors;
+attribute highp vec3 center;
+attribute highp float radius;
+uniform highp mat4 mvp_matrix;
+uniform highp mat4 mv_matrix;
+varying highp vec4 fP;
+varying highp vec3 fN;
+varying highp vec4 color;
+
+
+void main(void)
+{
+  color = vec4(colors, 1.0);
+  fP = mv_matrix * vertex;
+  fN = mat3(mv_matrix)* normals;
+  gl_Position =  mvp_matrix *
+  vec4(radius*vertex.x + center.x, radius* vertex.y + center.y, radius*vertex.z + center.z, 1.0) ;
+}
diff --git a/3rdparty/CGAL/demo/Polyhedron/resources/shader_with_light.f b/3rdparty/CGAL/demo/Polyhedron/resources/shader_with_light.f
new file mode 100644
index 0000000..62cec34
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/resources/shader_with_light.f
@@ -0,0 +1,36 @@
+#version 120
+varying highp vec4 color;
+varying highp vec4 fP; 
+varying highp vec3 fN; 
+uniform highp vec4 light_pos;  
+uniform highp vec4 light_diff; 
+uniform highp vec4 light_spec; 
+uniform highp vec4 light_amb;  
+uniform highp float spec_power ; 
+uniform int is_two_side; 
+uniform bool is_selected;
+void main(void) {
+   highp vec3 L = light_pos.xyz - fP.xyz;
+   highp vec3 V = -fP.xyz;
+   highp vec3 N;
+   if(fN == highp vec3(0.0,0.0,0.0))
+       N = highp vec3(0.0,0.0,0.0);
+   else
+       N = normalize(fN);
+   L = normalize(L);
+   V = normalize(V);
+   highp vec3 R = reflect(-L, N);
+  vec4 diffuse;
+   if(is_two_side == 1)
+       diffuse = abs(dot(N,L)) * light_diff * color;
+   else
+       diffuse = max(dot(N,L), 0.0) * light_diff * color;
+   highp vec4 specular = pow(max(dot(R,V), 0.0), spec_power) * light_spec;
+   vec4 ret_color = vec4((color*light_amb).xyz + diffuse.xyz + specular.xyz,1);
+   if(is_selected)
+       gl_FragColor = vec4(ret_color.r+70.0/255.0, ret_color.g+70.0/255.0, ret_color.b+70.0/255.0, 1.0);
+   else
+       gl_FragColor = ret_color;
+}
+
+
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/shader_with_light.v b/3rdparty/CGAL/demo/Polyhedron/resources/shader_with_light.v
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/resources/shader_with_light.v
rename to 3rdparty/CGAL/demo/Polyhedron/resources/shader_with_light.v
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/shader_with_texture.f b/3rdparty/CGAL/demo/Polyhedron/resources/shader_with_texture.f
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/resources/shader_with_texture.f
rename to 3rdparty/CGAL/demo/Polyhedron/resources/shader_with_texture.f
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/shader_with_texture.v b/3rdparty/CGAL/demo/Polyhedron/resources/shader_with_texture.v
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/resources/shader_with_texture.v
rename to 3rdparty/CGAL/demo/Polyhedron/resources/shader_with_texture.v
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/shader_with_textured_edges.f b/3rdparty/CGAL/demo/Polyhedron/resources/shader_with_textured_edges.f
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/resources/shader_with_textured_edges.f
rename to 3rdparty/CGAL/demo/Polyhedron/resources/shader_with_textured_edges.f
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/shader_with_textured_edges.v b/3rdparty/CGAL/demo/Polyhedron/resources/shader_with_textured_edges.v
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/resources/shader_with_textured_edges.v
rename to 3rdparty/CGAL/demo/Polyhedron/resources/shader_with_textured_edges.v
diff --git a/3rdparty/CGAL/demo/Polyhedron/resources/shader_without_light.f b/3rdparty/CGAL/demo/Polyhedron/resources/shader_without_light.f
new file mode 100644
index 0000000..64db6fb
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/resources/shader_without_light.f
@@ -0,0 +1,10 @@
+#version 120
+varying highp vec4 color;
+uniform bool is_selected;
+void main(void) 
+{ 
+if(is_selected)
+  gl_FragColor = vec4(0,0,0,1.0);
+else
+  gl_FragColor = color; 
+}  
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/shader_without_light.v b/3rdparty/CGAL/demo/Polyhedron/resources/shader_without_light.v
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/resources/shader_without_light.v
rename to 3rdparty/CGAL/demo/Polyhedron/resources/shader_without_light.v
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/simplification.png b/3rdparty/CGAL/demo/Polyhedron/resources/simplification.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/resources/simplification.png
rename to 3rdparty/CGAL/demo/Polyhedron/resources/simplification.png
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/top.png b/3rdparty/CGAL/demo/Polyhedron/resources/top.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/resources/top.png
rename to 3rdparty/CGAL/demo/Polyhedron/resources/top.png
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/resources/up.png b/3rdparty/CGAL/demo/Polyhedron/resources/up.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/resources/up.png
rename to 3rdparty/CGAL/demo/Polyhedron/resources/up.png
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/texture.cpp b/3rdparty/CGAL/demo/Polyhedron/texture.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/texture.cpp
rename to 3rdparty/CGAL/demo/Polyhedron/texture.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron/texture.h b/3rdparty/CGAL/demo/Polyhedron/texture.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron/texture.h
rename to 3rdparty/CGAL/demo/Polyhedron/texture.h
diff --git a/3rdparty/CGAL/demo/Polyhedron/triangulate_primitive.h b/3rdparty/CGAL/demo/Polyhedron/triangulate_primitive.h
new file mode 100644
index 0000000..3b45a18
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron/triangulate_primitive.h
@@ -0,0 +1,156 @@
+#ifndef TRIANGULATE_PRIMITIVE
+#define TRIANGULATE_PRIMITIVE
+#include <CGAL/Triangulation_vertex_base_with_info_2.h>
+#include <CGAL/Triangulation_face_base_with_info_2.h>
+#include <CGAL/Constrained_Delaunay_triangulation_2.h>
+#include <CGAL/Triangulation_2_projection_traits_3.h>
+#include <CGAL/Three/Scene_item.h>
+#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
+#include <CGAL/boost/graph/graph_traits_Surface_mesh.h>
+
+
+#include <QColor>
+
+//Make sure all the facets are triangles
+template<class Mesh, typename Kernel, typename Index_type>
+class FacetTriangulator
+{
+ typedef Kernel Traits;
+
+ typedef typename boost::graph_traits<Mesh>::halfedge_descriptor halfedge_descriptor;
+
+ typedef typename Kernel::Vector_3 Vector;
+
+
+ typedef CGAL::Triangulation_2_projection_traits_3<Traits>   P_traits;
+
+ typedef CGAL::Triangulation_vertex_base_with_info_2<halfedge_descriptor,
+                                                     P_traits>        Vb;
+
+ struct Face_info {
+   typename boost::graph_traits<Mesh>::halfedge_descriptor e[3];
+   bool is_external;
+ };
+
+ typedef CGAL::Triangulation_face_base_with_info_2<Face_info,
+                                                   P_traits>          Fb1;
+ typedef CGAL::Constrained_triangulation_face_base_2<P_traits, Fb1>   Fb;
+ typedef CGAL::Triangulation_data_structure_2<Vb,Fb>                  TDS;
+ typedef CGAL::Exact_predicates_tag                                   Itag;
+
+public:
+ struct PointAndId {
+  typename Kernel::Point_3 point;
+  Index_type id;
+ };
+
+ typedef CGAL::Constrained_Delaunay_triangulation_2<P_traits,
+                                                     TDS,
+                                                     Itag>             CDT;
+  CDT *cdt;
+  CGAL::Unique_hash_map<typename CDT::Vertex_handle, Index_type> v2v;
+
+  //Constructor
+  FacetTriangulator(typename boost::graph_traits<Mesh>::face_descriptor fd,
+                  const Vector& normal,
+                    Mesh *poly,
+                  const double item_diag)
+  {
+    std::vector<PointAndId> idPoints;
+    BOOST_FOREACH(halfedge_descriptor he_circ, halfedges_around_face( halfedge(fd, *poly), *poly))
+    {
+      PointAndId idPoint;
+      idPoint.point = get(boost::vertex_point,*poly,source(he_circ, *poly));
+      idPoint.id = source(he_circ, *poly);
+      idPoints.push_back(idPoint);
+
+    }
+    triangulate(idPoints, normal, item_diag);
+  }
+
+  FacetTriangulator(std::vector<PointAndId > &idPoints,
+                  const Vector& normal,
+                  const double item_diag)
+  {
+    triangulate(idPoints, normal, item_diag);
+  }
+
+private:
+  void triangulate( std::vector<PointAndId > &idPoints,
+              const Vector& normal,
+              const double item_diag )
+  {
+    P_traits cdt_traits(normal);
+    cdt = new CDT(cdt_traits);
+    typename CDT::Vertex_handle previous, first, last_inserted;
+    //Compute a reasonable precision level used to decide
+    //if two consecutive points in a facet can be estimated
+    //equal.
+
+    double min_sq_dist = CGAL::square(0.0001*item_diag);
+    // Iterate the points of the facet and decide if they must be inserted in the CDT
+    BOOST_FOREACH(PointAndId idPoint, idPoints)
+    {
+     typename CDT::Vertex_handle vh;
+     //Always insert the first point, then only insert
+     // if the distance with the precedent is reasonable.
+     if(first == 0 || CGAL::squared_distance(idPoint.point, previous->point()) > min_sq_dist)
+     {
+       vh = cdt->insert(idPoint.point);
+       v2v[vh] = idPoint.id;
+       if(first == 0) {
+         first = vh;
+       }
+       if(previous != 0 && previous != vh) {
+         double sq_dist = CGAL::squared_distance(previous->point(), vh->point());
+         if(sq_dist > min_sq_dist)
+         {
+           cdt->insert_constraint(previous, vh);
+           sq_dist = CGAL::squared_distance(previous->point(), first->point());
+           if(sq_dist > min_sq_dist)
+           {
+             last_inserted = previous;
+           }
+         }
+       }
+     previous = vh;
+     }
+    }
+    double sq_dist = CGAL::squared_distance(previous->point(), first->point());
+
+    if(sq_dist > min_sq_dist)
+    {
+      cdt->insert_constraint(previous, first);
+    }
+    else
+    {
+      cdt->insert_constraint(last_inserted, first);
+    }
+    // sets mark is_external
+    for(typename CDT::All_faces_iterator
+        fit2 = cdt->all_faces_begin(),
+        end = cdt->all_faces_end();
+        fit2 != end; ++fit2)
+    {
+      fit2->info().is_external = false;
+    }
+    //check if the facet is external or internal
+    std::queue<typename CDT::Face_handle> face_queue;
+    face_queue.push(cdt->infinite_vertex()->face());
+    while(! face_queue.empty() ) {
+      typename CDT::Face_handle fh = face_queue.front();
+      face_queue.pop();
+      if(fh->info().is_external) continue;
+      fh->info().is_external = true;
+      for(int i = 0; i <3; ++i) {
+        if(!cdt->is_constrained(std::make_pair(fh, i)))
+        {
+          face_queue.push(fh->neighbor(i));
+        }
+      }
+    }
+  }
+};
+
+#endif // TRIANGULATE_PRIMITIVE
+
diff --git a/3rdparty/CGAL/demo/Polyhedron_IO/CMakeLists.txt b/3rdparty/CGAL/demo/Polyhedron_IO/CMakeLists.txt
new file mode 100644
index 0000000..eaf9249
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyhedron_IO/CMakeLists.txt
@@ -0,0 +1,28 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Polyhedron_IO_Demo )
+
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  create_single_source_cgal_program( "geomview_demo.cpp" )
+  create_single_source_cgal_program( "viewpoint2off.cpp" )
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron_IO/README b/3rdparty/CGAL/demo/Polyhedron_IO/README
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron_IO/README
rename to 3rdparty/CGAL/demo/Polyhedron_IO/README
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron_IO/geomview_demo.cpp b/3rdparty/CGAL/demo/Polyhedron_IO/geomview_demo.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron_IO/geomview_demo.cpp
rename to 3rdparty/CGAL/demo/Polyhedron_IO/geomview_demo.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Polyhedron_IO/viewpoint2off.cpp b/3rdparty/CGAL/demo/Polyhedron_IO/viewpoint2off.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyhedron_IO/viewpoint2off.cpp
rename to 3rdparty/CGAL/demo/Polyhedron_IO/viewpoint2off.cpp
diff --git a/3rdparty/CGAL/demo/Polyline_simplification_2/CMakeLists.txt b/3rdparty/CGAL/demo/Polyline_simplification_2/CMakeLists.txt
new file mode 100644
index 0000000..f174369
--- /dev/null
+++ b/3rdparty/CGAL/demo/Polyline_simplification_2/CMakeLists.txt
@@ -0,0 +1,51 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+project (Polyline_simplification_2)
+
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+find_package(CGAL COMPONENTS Qt5)
+
+include(${CGAL_USE_FILE})
+
+find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Widgets Svg)
+
+include_directories (BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/include)
+include_directories (BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../../include )
+include_directories (BEFORE ${CMAKE_CURRENT_BINARY_DIR})
+
+if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
+
+add_definitions(-DQT_NO_KEYWORDS)
+
+
+# UI files (Qt Designer files)
+qt5_wrap_ui( CDT_UI_FILES Polyline_simplification_2.ui )
+
+# qrc files (resources files, that contain icons, at least)
+qt5_add_resources ( CGAL_Qt5_RESOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/Polyline_simplification_2.qrc )
+
+# use the Qt MOC preprocessor on classes that derives from QObject
+qt5_generate_moc( ${CMAKE_CURRENT_SOURCE_DIR}/Polyline_simplification_2.cpp Polyline_simplification_2.moc )
+
+# The executable itself.
+add_executable  ( Polyline_simplification_2 ${CMAKE_CURRENT_SOURCE_DIR}/Polyline_simplification_2.cpp Polyline_simplification_2.moc ${CDT_UI_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES})
+
+qt5_use_modules(Polyline_simplification_2 Xml Script OpenGL Widgets Svg)
+# Link with Qt libraries
+target_link_libraries( Polyline_simplification_2 ${QT_LIBRARIES} )
+
+# Link with CGAL
+target_link_libraries( Polyline_simplification_2 ${CGAL_LIBRARIES}  ${CGAL_3RD_PARTY_LIBRARIES})
+
+add_to_cached_list( CGAL_EXECUTABLE_TARGETS Polyline_simplification_2 )
+
+else()
+
+  message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
+
+endif()
diff --git a/3rdparty/CGAL-4.8/demo/Polyline_simplification_2/Polyline_simplification_2.cpp b/3rdparty/CGAL/demo/Polyline_simplification_2/Polyline_simplification_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyline_simplification_2/Polyline_simplification_2.cpp
rename to 3rdparty/CGAL/demo/Polyline_simplification_2/Polyline_simplification_2.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Polyline_simplification_2/Polyline_simplification_2.qrc b/3rdparty/CGAL/demo/Polyline_simplification_2/Polyline_simplification_2.qrc
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyline_simplification_2/Polyline_simplification_2.qrc
rename to 3rdparty/CGAL/demo/Polyline_simplification_2/Polyline_simplification_2.qrc
diff --git a/3rdparty/CGAL-4.8/demo/Polyline_simplification_2/Polyline_simplification_2.ui b/3rdparty/CGAL/demo/Polyline_simplification_2/Polyline_simplification_2.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyline_simplification_2/Polyline_simplification_2.ui
rename to 3rdparty/CGAL/demo/Polyline_simplification_2/Polyline_simplification_2.ui
diff --git a/3rdparty/CGAL-4.8/demo/Polyline_simplification_2/about_Polyline_simplification_2.html b/3rdparty/CGAL/demo/Polyline_simplification_2/about_Polyline_simplification_2.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyline_simplification_2/about_Polyline_simplification_2.html
rename to 3rdparty/CGAL/demo/Polyline_simplification_2/about_Polyline_simplification_2.html
diff --git a/3rdparty/CGAL-4.8/demo/Polyline_simplification_2/data/all_crossed.poly b/3rdparty/CGAL/demo/Polyline_simplification_2/data/all_crossed.poly
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyline_simplification_2/data/all_crossed.poly
rename to 3rdparty/CGAL/demo/Polyline_simplification_2/data/all_crossed.poly
diff --git a/3rdparty/CGAL-4.8/demo/Polyline_simplification_2/data/bee.poly b/3rdparty/CGAL/demo/Polyline_simplification_2/data/bee.poly
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyline_simplification_2/data/bee.poly
rename to 3rdparty/CGAL/demo/Polyline_simplification_2/data/bee.poly
diff --git a/3rdparty/CGAL-4.8/demo/Polyline_simplification_2/data/letter_G.poly b/3rdparty/CGAL/demo/Polyline_simplification_2/data/letter_G.poly
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyline_simplification_2/data/letter_G.poly
rename to 3rdparty/CGAL/demo/Polyline_simplification_2/data/letter_G.poly
diff --git a/3rdparty/CGAL-4.8/demo/Polyline_simplification_2/data/letter_P.poly b/3rdparty/CGAL/demo/Polyline_simplification_2/data/letter_P.poly
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyline_simplification_2/data/letter_P.poly
rename to 3rdparty/CGAL/demo/Polyline_simplification_2/data/letter_P.poly
diff --git a/3rdparty/CGAL-4.8/demo/Polyline_simplification_2/data/letter_T.poly b/3rdparty/CGAL/demo/Polyline_simplification_2/data/letter_T.poly
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyline_simplification_2/data/letter_T.poly
rename to 3rdparty/CGAL/demo/Polyline_simplification_2/data/letter_T.poly
diff --git a/3rdparty/CGAL-4.8/demo/Polyline_simplification_2/data/letter_c.poly b/3rdparty/CGAL/demo/Polyline_simplification_2/data/letter_c.poly
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyline_simplification_2/data/letter_c.poly
rename to 3rdparty/CGAL/demo/Polyline_simplification_2/data/letter_c.poly
diff --git a/3rdparty/CGAL-4.8/demo/Polyline_simplification_2/data/letter_d.poly b/3rdparty/CGAL/demo/Polyline_simplification_2/data/letter_d.poly
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyline_simplification_2/data/letter_d.poly
rename to 3rdparty/CGAL/demo/Polyline_simplification_2/data/letter_d.poly
diff --git a/3rdparty/CGAL-4.8/demo/Polyline_simplification_2/data/letter_q.poly b/3rdparty/CGAL/demo/Polyline_simplification_2/data/letter_q.poly
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyline_simplification_2/data/letter_q.poly
rename to 3rdparty/CGAL/demo/Polyline_simplification_2/data/letter_q.poly
diff --git a/3rdparty/CGAL-4.8/demo/Polyline_simplification_2/data/letter_u.poly b/3rdparty/CGAL/demo/Polyline_simplification_2/data/letter_u.poly
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyline_simplification_2/data/letter_u.poly
rename to 3rdparty/CGAL/demo/Polyline_simplification_2/data/letter_u.poly
diff --git a/3rdparty/CGAL-4.8/demo/Polyline_simplification_2/data/letters_cd.poly b/3rdparty/CGAL/demo/Polyline_simplification_2/data/letters_cd.poly
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyline_simplification_2/data/letters_cd.poly
rename to 3rdparty/CGAL/demo/Polyline_simplification_2/data/letters_cd.poly
diff --git a/3rdparty/CGAL-4.8/demo/Polyline_simplification_2/data/map_1.poly b/3rdparty/CGAL/demo/Polyline_simplification_2/data/map_1.poly
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyline_simplification_2/data/map_1.poly
rename to 3rdparty/CGAL/demo/Polyline_simplification_2/data/map_1.poly
diff --git a/3rdparty/CGAL-4.8/demo/Polyline_simplification_2/data/map_2.poly b/3rdparty/CGAL/demo/Polyline_simplification_2/data/map_2.poly
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyline_simplification_2/data/map_2.poly
rename to 3rdparty/CGAL/demo/Polyline_simplification_2/data/map_2.poly
diff --git a/3rdparty/CGAL-4.8/demo/Polyline_simplification_2/data/map_3.poly b/3rdparty/CGAL/demo/Polyline_simplification_2/data/map_3.poly
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyline_simplification_2/data/map_3.poly
rename to 3rdparty/CGAL/demo/Polyline_simplification_2/data/map_3.poly
diff --git a/3rdparty/CGAL-4.8/demo/Polyline_simplification_2/data/maps.poly b/3rdparty/CGAL/demo/Polyline_simplification_2/data/maps.poly
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyline_simplification_2/data/maps.poly
rename to 3rdparty/CGAL/demo/Polyline_simplification_2/data/maps.poly
diff --git a/3rdparty/CGAL-4.8/demo/Polyline_simplification_2/data/norway.poly b/3rdparty/CGAL/demo/Polyline_simplification_2/data/norway.poly
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyline_simplification_2/data/norway.poly
rename to 3rdparty/CGAL/demo/Polyline_simplification_2/data/norway.poly
diff --git a/3rdparty/CGAL-4.8/demo/Polyline_simplification_2/icons/triangulation.pdf b/3rdparty/CGAL/demo/Polyline_simplification_2/icons/triangulation.pdf
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyline_simplification_2/icons/triangulation.pdf
rename to 3rdparty/CGAL/demo/Polyline_simplification_2/icons/triangulation.pdf
diff --git a/3rdparty/CGAL-4.8/demo/Polyline_simplification_2/icons/triangulation.png b/3rdparty/CGAL/demo/Polyline_simplification_2/icons/triangulation.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyline_simplification_2/icons/triangulation.png
rename to 3rdparty/CGAL/demo/Polyline_simplification_2/icons/triangulation.png
diff --git a/3rdparty/CGAL-4.8/demo/Polyline_simplification_2/include/CGAL/Qt/Polyline_simplification_2_graphics_item.h b/3rdparty/CGAL/demo/Polyline_simplification_2/include/CGAL/Qt/Polyline_simplification_2_graphics_item.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyline_simplification_2/include/CGAL/Qt/Polyline_simplification_2_graphics_item.h
rename to 3rdparty/CGAL/demo/Polyline_simplification_2/include/CGAL/Qt/Polyline_simplification_2_graphics_item.h
diff --git a/3rdparty/CGAL-4.8/demo/Polyline_simplification_2/include/CGAL/Qt/TriangulationArrangementGraphicsItem.h b/3rdparty/CGAL/demo/Polyline_simplification_2/include/CGAL/Qt/TriangulationArrangementGraphicsItem.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Polyline_simplification_2/include/CGAL/Qt/TriangulationArrangementGraphicsItem.h
rename to 3rdparty/CGAL/demo/Polyline_simplification_2/include/CGAL/Qt/TriangulationArrangementGraphicsItem.h
diff --git a/3rdparty/CGAL/demo/Principal_component_analysis/CMakeLists.txt b/3rdparty/CGAL/demo/Principal_component_analysis/CMakeLists.txt
new file mode 100644
index 0000000..e92d6c8
--- /dev/null
+++ b/3rdparty/CGAL/demo/Principal_component_analysis/CMakeLists.txt
@@ -0,0 +1,87 @@
+# This is the CMake script for compiling the PCA demo.
+
+project( PCA_demo )
+
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+foreach(INCDIR ../../include ../../../STL_Extension/include ../../../GraphicsView/include ../../../filtered_kernel/include )
+  if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${INCDIR}")
+    include_directories (BEFORE "${CMAKE_CURRENT_SOURCE_DIR}/${INCDIR}")
+  endif()
+endforeach()
+
+include_directories( ./ )
+
+# Find CGAL and CGAL Qt5
+find_package(CGAL COMPONENTS Qt5)
+include( ${CGAL_USE_FILE} )
+
+# Find Qt5 itself
+find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL)
+
+# Find OpenGL
+find_package(OpenGL)
+
+# Find QGLViewer
+if(Qt5_FOUND)
+  find_package(QGLViewer )
+endif(Qt5_FOUND)
+
+if(CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
+
+  include_directories ( ${QGLVIEWER_INCLUDE_DIR} )
+
+  qt5_wrap_ui( UI_FILES MainWindow.ui )
+
+  include(AddFileDependencies)
+
+  qt5_generate_moc( "MainWindow.h" "${CMAKE_CURRENT_BINARY_DIR}/MainWindow_moc.cpp" )
+  add_file_dependencies( MainWindow_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/MainWindow.h" )
+
+  qt5_generate_moc( "Viewer.h" "${CMAKE_CURRENT_BINARY_DIR}/Viewer_moc.cpp" )
+  add_file_dependencies( Viewer_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/Viewer.h" )
+
+  qt5_add_resources ( CGAL_Qt5_RESOURCE_FILES PCA_demo.qrc )
+
+    add_file_dependencies( PCA_demo.cpp "${CMAKE_CURRENT_BINARY_DIR}/MainWindow_moc.cpp"
+                                         "${CMAKE_CURRENT_BINARY_DIR}/Viewer_moc.cpp" )
+    add_executable  ( PCA_demo PCA_demo.cpp ${UI_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES})
+    qt5_use_modules( PCA_demo Xml Script OpenGL)
+  # Link with Qt libraries
+  target_link_libraries( PCA_demo ${QT_LIBRARIES} )
+
+  # Link with CGAL
+  target_link_libraries( PCA_demo ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} )
+
+  # Link with libQGLViewer, OpenGL
+  target_link_libraries( PCA_demo ${QGLVIEWER_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
+
+  add_to_cached_list( CGAL_EXECUTABLE_TARGETS PCA_demo )
+
+
+else (CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
+
+  set(PCA_MISSING_DEPS "")
+
+  if(NOT CGAL_Qt5_FOUND)
+    set(PCA_MISSING_DEPS "the CGAL Qt5 library, ${PCA_MISSING_DEPS}")
+  endif()
+
+  if(NOT Qt5_FOUND)
+    set(PCA_MISSING_DEPS "Qt5, ${PCA_MISSING_DEPS}")
+  endif()
+
+  if(NOT OPENGL_FOUND)
+    set(PCA_MISSING_DEPS "OpenGL, ${PCA_MISSING_DEPS}")
+  endif()
+
+  if(NOT QGLVIEWER_FOUND)
+    set(PCA_MISSING_DEPS "QGLViewer, ${PCA_MISSING_DEPS}")
+  endif()
+
+  message(STATUS "NOTICE: This demo requires ${PCA_MISSING_DEPS} and will not be compiled.")
+
+endif (CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
diff --git a/3rdparty/CGAL-4.8/demo/Principal_component_analysis/MainWindow.cpp b/3rdparty/CGAL/demo/Principal_component_analysis/MainWindow.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Principal_component_analysis/MainWindow.cpp
rename to 3rdparty/CGAL/demo/Principal_component_analysis/MainWindow.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Principal_component_analysis/MainWindow.h b/3rdparty/CGAL/demo/Principal_component_analysis/MainWindow.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Principal_component_analysis/MainWindow.h
rename to 3rdparty/CGAL/demo/Principal_component_analysis/MainWindow.h
diff --git a/3rdparty/CGAL-4.8/demo/Principal_component_analysis/MainWindow.ui b/3rdparty/CGAL/demo/Principal_component_analysis/MainWindow.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Principal_component_analysis/MainWindow.ui
rename to 3rdparty/CGAL/demo/Principal_component_analysis/MainWindow.ui
diff --git a/3rdparty/CGAL-4.8/demo/Principal_component_analysis/PCA_demo.cpp b/3rdparty/CGAL/demo/Principal_component_analysis/PCA_demo.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Principal_component_analysis/PCA_demo.cpp
rename to 3rdparty/CGAL/demo/Principal_component_analysis/PCA_demo.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Principal_component_analysis/PCA_demo.qrc b/3rdparty/CGAL/demo/Principal_component_analysis/PCA_demo.qrc
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Principal_component_analysis/PCA_demo.qrc
rename to 3rdparty/CGAL/demo/Principal_component_analysis/PCA_demo.qrc
diff --git a/3rdparty/CGAL-4.8/demo/Principal_component_analysis/Scene.cpp b/3rdparty/CGAL/demo/Principal_component_analysis/Scene.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Principal_component_analysis/Scene.cpp
rename to 3rdparty/CGAL/demo/Principal_component_analysis/Scene.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Principal_component_analysis/Scene.h b/3rdparty/CGAL/demo/Principal_component_analysis/Scene.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Principal_component_analysis/Scene.h
rename to 3rdparty/CGAL/demo/Principal_component_analysis/Scene.h
diff --git a/3rdparty/CGAL-4.8/demo/Principal_component_analysis/Viewer.cpp b/3rdparty/CGAL/demo/Principal_component_analysis/Viewer.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Principal_component_analysis/Viewer.cpp
rename to 3rdparty/CGAL/demo/Principal_component_analysis/Viewer.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Principal_component_analysis/Viewer.h b/3rdparty/CGAL/demo/Principal_component_analysis/Viewer.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Principal_component_analysis/Viewer.h
rename to 3rdparty/CGAL/demo/Principal_component_analysis/Viewer.h
diff --git a/3rdparty/CGAL-4.8/demo/Principal_component_analysis/data/cylinder.off b/3rdparty/CGAL/demo/Principal_component_analysis/data/cylinder.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Principal_component_analysis/data/cylinder.off
rename to 3rdparty/CGAL/demo/Principal_component_analysis/data/cylinder.off
diff --git a/3rdparty/CGAL-4.8/demo/Principal_component_analysis/data/cylinder_locally_refined.off b/3rdparty/CGAL/demo/Principal_component_analysis/data/cylinder_locally_refined.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Principal_component_analysis/data/cylinder_locally_refined.off
rename to 3rdparty/CGAL/demo/Principal_component_analysis/data/cylinder_locally_refined.off
diff --git a/3rdparty/CGAL-4.8/demo/Principal_component_analysis/data/ellipsoid.off b/3rdparty/CGAL/demo/Principal_component_analysis/data/ellipsoid.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Principal_component_analysis/data/ellipsoid.off
rename to 3rdparty/CGAL/demo/Principal_component_analysis/data/ellipsoid.off
diff --git a/3rdparty/CGAL-4.8/demo/Principal_component_analysis/render_edges.h b/3rdparty/CGAL/demo/Principal_component_analysis/render_edges.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Principal_component_analysis/render_edges.h
rename to 3rdparty/CGAL/demo/Principal_component_analysis/render_edges.h
diff --git a/3rdparty/CGAL-4.8/demo/Principal_component_analysis/resources/about.html b/3rdparty/CGAL/demo/Principal_component_analysis/resources/about.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Principal_component_analysis/resources/about.html
rename to 3rdparty/CGAL/demo/Principal_component_analysis/resources/about.html
diff --git a/3rdparty/CGAL-4.8/demo/Principal_component_analysis/resources/cgal_logo.xpm b/3rdparty/CGAL/demo/Principal_component_analysis/resources/cgal_logo.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Principal_component_analysis/resources/cgal_logo.xpm
rename to 3rdparty/CGAL/demo/Principal_component_analysis/resources/cgal_logo.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Principal_component_analysis/types.h b/3rdparty/CGAL/demo/Principal_component_analysis/types.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Principal_component_analysis/types.h
rename to 3rdparty/CGAL/demo/Principal_component_analysis/types.h
diff --git a/3rdparty/CGAL/demo/Segment_Delaunay_graph_2/CMakeLists.txt b/3rdparty/CGAL/demo/Segment_Delaunay_graph_2/CMakeLists.txt
new file mode 100644
index 0000000..fbabb7a
--- /dev/null
+++ b/3rdparty/CGAL/demo/Segment_Delaunay_graph_2/CMakeLists.txt
@@ -0,0 +1,59 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+project (Segment_voronoi_2)
+
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+find_package(CGAL COMPONENTS Qt5 Core)
+
+include(${CGAL_USE_FILE})
+
+set( QT_USE_QTXML    TRUE )
+set( QT_USE_QTMAIN   TRUE )
+set( QT_USE_QTSCRIPT  TRUE )
+set( QT_USE_QTOPENGL  TRUE )
+
+
+find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
+include_directories (BEFORE ../../include)
+include_directories (BEFORE ./include)
+
+
+if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
+
+add_definitions(-DQT_NO_KEYWORDS)
+
+#--------------------------------
+# The "Segment Voronoi" demo: Segment_voronoi_2
+#--------------------------------
+# UI files (Qt Designer files)
+qt5_wrap_ui( CDT_UI_FILES Segment_voronoi_2.ui )
+
+# qrc files (resources files, that contain icons, at least)
+qt5_add_resources ( CGAL_Qt5_RESOURCE_FILES ./Segment_voronoi_2.qrc )
+
+# use the Qt MOC preprocessor on classes that derives from QObject
+qt5_generate_moc( "Segment_voronoi_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Segment_voronoi_2.moc" )
+
+# The executable itself.
+add_executable  ( Segment_voronoi_2 Segment_voronoi_2.cpp Segment_voronoi_2.moc ${CDT_UI_FILES} ${CGAL_Qt5_RESOURCE_FILES}  ${CGAL_Qt5_MOC_FILES})
+
+qt5_use_modules(Segment_voronoi_2 Xml Script OpenGL Svg)
+
+add_to_cached_list( CGAL_EXECUTABLE_TARGETS Segment_voronoi_2 )
+
+# Link with Qt libraries
+target_link_libraries( Segment_voronoi_2 ${QT_LIBRARIES} )
+# Link with CGAL
+target_link_libraries( Segment_voronoi_2 ${CGAL_LIBRARIES}  ${CGAL_3RD_PARTY_LIBRARIES})
+
+
+else()
+
+  message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
+
+endif()
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/Segment_voronoi_2.cpp b/3rdparty/CGAL/demo/Segment_Delaunay_graph_2/Segment_voronoi_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/Segment_voronoi_2.cpp
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_2/Segment_voronoi_2.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/Segment_voronoi_2.qrc b/3rdparty/CGAL/demo/Segment_Delaunay_graph_2/Segment_voronoi_2.qrc
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/Segment_voronoi_2.qrc
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_2/Segment_voronoi_2.qrc
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/Segment_voronoi_2.ui b/3rdparty/CGAL/demo/Segment_Delaunay_graph_2/Segment_voronoi_2.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/Segment_voronoi_2.ui
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_2/Segment_voronoi_2.ui
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/about_Segment_voronoi_2.html b/3rdparty/CGAL/demo/Segment_Delaunay_graph_2/about_Segment_voronoi_2.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/about_Segment_voronoi_2.html
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_2/about_Segment_voronoi_2.html
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/icons/circumcenter.pdf b/3rdparty/CGAL/demo/Segment_Delaunay_graph_2/icons/circumcenter.pdf
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/icons/circumcenter.pdf
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_2/icons/circumcenter.pdf
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/icons/circumcenter.png b/3rdparty/CGAL/demo/Segment_Delaunay_graph_2/icons/circumcenter.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/icons/circumcenter.png
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_2/icons/circumcenter.png
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/icons/conflict_zone.pdf b/3rdparty/CGAL/demo/Segment_Delaunay_graph_2/icons/conflict_zone.pdf
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/icons/conflict_zone.pdf
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_2/icons/conflict_zone.pdf
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/icons/conflict_zone.png b/3rdparty/CGAL/demo/Segment_Delaunay_graph_2/icons/conflict_zone.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/icons/conflict_zone.png
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_2/icons/conflict_zone.png
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/icons/constrained_triangulation.pdf b/3rdparty/CGAL/demo/Segment_Delaunay_graph_2/icons/constrained_triangulation.pdf
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/icons/constrained_triangulation.pdf
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_2/icons/constrained_triangulation.pdf
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/icons/constrained_triangulation.png b/3rdparty/CGAL/demo/Segment_Delaunay_graph_2/icons/constrained_triangulation.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/icons/constrained_triangulation.png
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_2/icons/constrained_triangulation.png
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/icons/constrained_triangulation_show_constraints.pdf b/3rdparty/CGAL/demo/Segment_Delaunay_graph_2/icons/constrained_triangulation_show_constraints.pdf
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/icons/constrained_triangulation_show_constraints.pdf
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_2/icons/constrained_triangulation_show_constraints.pdf
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/icons/constrained_triangulation_show_constraints.png b/3rdparty/CGAL/demo/Segment_Delaunay_graph_2/icons/constrained_triangulation_show_constraints.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/icons/constrained_triangulation_show_constraints.png
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_2/icons/constrained_triangulation_show_constraints.png
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/icons/constrained_triangulation_show_in_domain.pdf b/3rdparty/CGAL/demo/Segment_Delaunay_graph_2/icons/constrained_triangulation_show_in_domain.pdf
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/icons/constrained_triangulation_show_in_domain.pdf
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_2/icons/constrained_triangulation_show_in_domain.pdf
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/icons/constrained_triangulation_show_in_domain.png b/3rdparty/CGAL/demo/Segment_Delaunay_graph_2/icons/constrained_triangulation_show_in_domain.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/icons/constrained_triangulation_show_in_domain.png
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_2/icons/constrained_triangulation_show_in_domain.png
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/icons/moving_point.pdf b/3rdparty/CGAL/demo/Segment_Delaunay_graph_2/icons/moving_point.pdf
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/icons/moving_point.pdf
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_2/icons/moving_point.pdf
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/icons/moving_point.png b/3rdparty/CGAL/demo/Segment_Delaunay_graph_2/icons/moving_point.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/icons/moving_point.png
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_2/icons/moving_point.png
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/icons/triangulation.pdf b/3rdparty/CGAL/demo/Segment_Delaunay_graph_2/icons/triangulation.pdf
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/icons/triangulation.pdf
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_2/icons/triangulation.pdf
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/icons/triangulation.png b/3rdparty/CGAL/demo/Segment_Delaunay_graph_2/icons/triangulation.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/icons/triangulation.png
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_2/icons/triangulation.png
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/include/CGAL/Constraints_loader.h b/3rdparty/CGAL/demo/Segment_Delaunay_graph_2/include/CGAL/Constraints_loader.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/include/CGAL/Constraints_loader.h
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_2/include/CGAL/Constraints_loader.h
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/svd-typedefs.h b/3rdparty/CGAL/demo/Segment_Delaunay_graph_2/svd-typedefs.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_2/svd-typedefs.h
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_2/svd-typedefs.h
diff --git a/3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/CMakeLists.txt b/3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/CMakeLists.txt
new file mode 100644
index 0000000..d1a4e2d
--- /dev/null
+++ b/3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/CMakeLists.txt
@@ -0,0 +1,59 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+project (Segment_voronoi_linf_2)
+
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+find_package(CGAL COMPONENTS Qt5 Core)
+
+include(${CGAL_USE_FILE})
+
+set( QT_USE_QTXML    TRUE )
+set( QT_USE_QTMAIN   TRUE )
+set( QT_USE_QTSCRIPT  TRUE )
+set( QT_USE_QTOPENGL  TRUE )
+
+
+find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
+include_directories (BEFORE ../../include)
+include_directories (BEFORE ./include)
+
+
+if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
+
+add_definitions(-DQT_NO_KEYWORDS)
+
+#--------------------------------
+# The "Segment Voronoi Linf" demo: Segment_voronoi_linf_2
+#--------------------------------
+# UI files (Qt Designer files)
+qt5_wrap_ui( CDT_UI_FILES Segment_voronoi_2.ui )
+
+# qrc files (resources files, that contain icons, at least)
+qt5_add_resources ( CGAL_Qt5_RESOURCE_FILES ./Segment_voronoi_2.qrc )
+
+# use the Qt MOC preprocessor on classes that derives from QObject
+qt5_generate_moc( "Segment_voronoi_linf_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Segment_voronoi_linf_2.moc" )
+
+# The executable itself.
+add_executable  ( Segment_voronoi_linf_2 Segment_voronoi_linf_2.cpp Segment_voronoi_linf_2.moc ${CDT_UI_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES})
+
+qt5_use_modules(Segment_voronoi_linf_2 Xml Script OpenGL Svg)
+
+add_to_cached_list( CGAL_EXECUTABLE_TARGETS Segment_voronoi_linf_2 )
+
+# Link with Qt libraries
+target_link_libraries( Segment_voronoi_linf_2 ${QT_LIBRARIES} )
+# Link with CGAL
+target_link_libraries( Segment_voronoi_linf_2 ${CGAL_LIBRARIES}  ${CGAL_3RD_PARTY_LIBRARIES})
+
+
+else()
+
+  message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
+
+endif()
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/Segment_voronoi_2.qrc b/3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/Segment_voronoi_2.qrc
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/Segment_voronoi_2.qrc
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/Segment_voronoi_2.qrc
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/Segment_voronoi_2.ui b/3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/Segment_voronoi_2.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/Segment_voronoi_2.ui
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/Segment_voronoi_2.ui
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/Segment_voronoi_linf_2.cpp b/3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/Segment_voronoi_linf_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/Segment_voronoi_linf_2.cpp
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/Segment_voronoi_linf_2.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/about_Segment_voronoi_2.html b/3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/about_Segment_voronoi_2.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/about_Segment_voronoi_2.html
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/about_Segment_voronoi_2.html
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/icons/circumcenter.pdf b/3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/icons/circumcenter.pdf
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/icons/circumcenter.pdf
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/icons/circumcenter.pdf
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/icons/circumcenter.png b/3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/icons/circumcenter.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/icons/circumcenter.png
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/icons/circumcenter.png
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/icons/conflict_zone.pdf b/3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/icons/conflict_zone.pdf
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/icons/conflict_zone.pdf
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/icons/conflict_zone.pdf
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/icons/conflict_zone.png b/3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/icons/conflict_zone.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/icons/conflict_zone.png
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/icons/conflict_zone.png
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/icons/constrained_triangulation.pdf b/3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/icons/constrained_triangulation.pdf
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/icons/constrained_triangulation.pdf
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/icons/constrained_triangulation.pdf
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/icons/constrained_triangulation.png b/3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/icons/constrained_triangulation.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/icons/constrained_triangulation.png
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/icons/constrained_triangulation.png
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/icons/constrained_triangulation_show_constraints.pdf b/3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/icons/constrained_triangulation_show_constraints.pdf
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/icons/constrained_triangulation_show_constraints.pdf
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/icons/constrained_triangulation_show_constraints.pdf
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/icons/constrained_triangulation_show_constraints.png b/3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/icons/constrained_triangulation_show_constraints.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/icons/constrained_triangulation_show_constraints.png
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/icons/constrained_triangulation_show_constraints.png
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/icons/constrained_triangulation_show_in_domain.pdf b/3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/icons/constrained_triangulation_show_in_domain.pdf
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/icons/constrained_triangulation_show_in_domain.pdf
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/icons/constrained_triangulation_show_in_domain.pdf
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/icons/constrained_triangulation_show_in_domain.png b/3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/icons/constrained_triangulation_show_in_domain.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/icons/constrained_triangulation_show_in_domain.png
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/icons/constrained_triangulation_show_in_domain.png
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/icons/moving_point.pdf b/3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/icons/moving_point.pdf
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/icons/moving_point.pdf
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/icons/moving_point.pdf
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/icons/moving_point.png b/3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/icons/moving_point.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/icons/moving_point.png
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/icons/moving_point.png
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/icons/triangulation.pdf b/3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/icons/triangulation.pdf
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/icons/triangulation.pdf
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/icons/triangulation.pdf
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/icons/triangulation.png b/3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/icons/triangulation.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/icons/triangulation.png
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/icons/triangulation.png
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/include/CGAL/Constraints_loader.h b/3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/include/CGAL/Constraints_loader.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/include/CGAL/Constraints_loader.h
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/include/CGAL/Constraints_loader.h
diff --git a/3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/svd-typedefs.h b/3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/svd-typedefs.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Segment_Delaunay_graph_Linf_2/svd-typedefs.h
rename to 3rdparty/CGAL/demo/Segment_Delaunay_graph_Linf_2/svd-typedefs.h
diff --git a/3rdparty/CGAL/demo/Snap_rounding_2/CMakeLists.txt b/3rdparty/CGAL/demo/Snap_rounding_2/CMakeLists.txt
new file mode 100644
index 0000000..6d02100
--- /dev/null
+++ b/3rdparty/CGAL/demo/Snap_rounding_2/CMakeLists.txt
@@ -0,0 +1,50 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+project (Snap_rounding_2_demo)
+
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+find_package(CGAL COMPONENTS Qt5)
+
+include(${CGAL_USE_FILE})
+
+find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
+include_directories (BEFORE ../../include)
+include_directories (BEFORE ../../../Snap_rounding_2/include)
+
+
+if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
+
+add_definitions(-DQT_NO_KEYWORDS)
+
+#--------------------------------
+# UI files (Qt Designer files)
+qt5_wrap_ui( DT_UI_FILES Snap_rounding_2.ui )
+
+# qrc files (resources files, that contain icons, at least)
+qt5_add_resources ( CGAL_Qt5_RESOURCE_FILES ./Snap_rounding_2.qrc )
+
+# use the Qt MOC preprocessor on classes that derives from QObject
+qt5_generate_moc( Snap_rounding_2.cpp Snap_rounding_2.moc )
+
+# The executable itself.
+add_executable  ( Snap_rounding_2 Snap_rounding_2.cpp Snap_rounding_2.moc ${DT_UI_FILES}  ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES} )
+
+qt5_use_modules(Snap_rounding_2 Xml Script OpenGL Svg)
+
+add_to_cached_list( CGAL_EXECUTABLE_TARGETS Snap_rounding_2 )
+
+# Link with Qt libraries
+target_link_libraries( Snap_rounding_2 ${QT_LIBRARIES} )
+# Link with CGAL
+target_link_libraries( Snap_rounding_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES})
+
+else()
+
+  message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
+
+endif()
diff --git a/3rdparty/CGAL-4.8/demo/Snap_rounding_2/Snap_rounding_2.cpp b/3rdparty/CGAL/demo/Snap_rounding_2/Snap_rounding_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Snap_rounding_2/Snap_rounding_2.cpp
rename to 3rdparty/CGAL/demo/Snap_rounding_2/Snap_rounding_2.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Snap_rounding_2/Snap_rounding_2.qrc b/3rdparty/CGAL/demo/Snap_rounding_2/Snap_rounding_2.qrc
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Snap_rounding_2/Snap_rounding_2.qrc
rename to 3rdparty/CGAL/demo/Snap_rounding_2/Snap_rounding_2.qrc
diff --git a/3rdparty/CGAL-4.8/demo/Snap_rounding_2/Snap_rounding_2.ui b/3rdparty/CGAL/demo/Snap_rounding_2/Snap_rounding_2.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Snap_rounding_2/Snap_rounding_2.ui
rename to 3rdparty/CGAL/demo/Snap_rounding_2/Snap_rounding_2.ui
diff --git a/3rdparty/CGAL-4.8/demo/Snap_rounding_2/about_Snap_rounding_2.html b/3rdparty/CGAL/demo/Snap_rounding_2/about_Snap_rounding_2.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Snap_rounding_2/about_Snap_rounding_2.html
rename to 3rdparty/CGAL/demo/Snap_rounding_2/about_Snap_rounding_2.html
diff --git a/3rdparty/CGAL-4.8/demo/Snap_rounding_2/icons/grid.png b/3rdparty/CGAL/demo/Snap_rounding_2/icons/grid.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Snap_rounding_2/icons/grid.png
rename to 3rdparty/CGAL/demo/Snap_rounding_2/icons/grid.png
diff --git a/3rdparty/CGAL-4.8/demo/Snap_rounding_2/icons/snapped.png b/3rdparty/CGAL/demo/Snap_rounding_2/icons/snapped.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Snap_rounding_2/icons/snapped.png
rename to 3rdparty/CGAL/demo/Snap_rounding_2/icons/snapped.png
diff --git a/3rdparty/CGAL-4.8/demo/Snap_rounding_2/icons/unsnapped.png b/3rdparty/CGAL/demo/Snap_rounding_2/icons/unsnapped.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Snap_rounding_2/icons/unsnapped.png
rename to 3rdparty/CGAL/demo/Snap_rounding_2/icons/unsnapped.png
diff --git a/3rdparty/CGAL/demo/Spatial_searching_2/CMakeLists.txt b/3rdparty/CGAL/demo/Spatial_searching_2/CMakeLists.txt
new file mode 100644
index 0000000..e8b7e66
--- /dev/null
+++ b/3rdparty/CGAL/demo/Spatial_searching_2/CMakeLists.txt
@@ -0,0 +1,52 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+project (Spatial_searchingDemo)
+
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+find_package(CGAL COMPONENTS Qt5)
+
+include(${CGAL_USE_FILE})
+
+find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
+
+include_directories (BEFORE ../../include)
+include_directories (BEFORE ../../../Spatial_searching/include)
+
+if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
+
+  add_definitions(-DQT_NO_KEYWORDS)
+
+  #--------------------------------
+  # Demo: Spatial_searching_2
+  #--------------------------------
+  # UI files (Qt Designer files)
+  qt5_wrap_ui( DT_UI_FILES Spatial_searching_2.ui )
+
+  # qrc files (resources files, that contain icons, at least)
+  qt5_add_resources ( CGAL_Qt5_RESOURCE_FILES ./Spatial_searching_2.qrc )
+
+  # use the Qt MOC preprocessor on classes that derives from QObject
+  qt5_generate_moc( Spatial_searching_2.cpp Spatial_searching_2.moc )
+
+  # The executable itself.
+  add_executable  ( Spatial_searching_2 Spatial_searching_2.cpp Spatial_searching_2.moc ${DT_UI_FILES}  ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES} )
+
+  qt5_use_modules(Spatial_searching_2 Xml Script OpenGL Svg)
+
+  add_to_cached_list( CGAL_EXECUTABLE_TARGETS Spatial_searching_2 )
+
+  # Link with Qt libraries
+  target_link_libraries( Spatial_searching_2 ${QT_LIBRARIES} )
+  # And with CGAL libraries
+  target_link_libraries( Spatial_searching_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} )
+
+else()
+
+  message(STATUS "NOTICE: This demo requires CGAL, and Qt5, and will not be compiled.")
+
+endif()
diff --git a/3rdparty/CGAL-4.8/demo/Spatial_searching_2/NearestNeighbor.h b/3rdparty/CGAL/demo/Spatial_searching_2/NearestNeighbor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Spatial_searching_2/NearestNeighbor.h
rename to 3rdparty/CGAL/demo/Spatial_searching_2/NearestNeighbor.h
diff --git a/3rdparty/CGAL-4.8/demo/Spatial_searching_2/Spatial_searching_2.cpp b/3rdparty/CGAL/demo/Spatial_searching_2/Spatial_searching_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Spatial_searching_2/Spatial_searching_2.cpp
rename to 3rdparty/CGAL/demo/Spatial_searching_2/Spatial_searching_2.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Spatial_searching_2/Spatial_searching_2.qrc b/3rdparty/CGAL/demo/Spatial_searching_2/Spatial_searching_2.qrc
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Spatial_searching_2/Spatial_searching_2.qrc
rename to 3rdparty/CGAL/demo/Spatial_searching_2/Spatial_searching_2.qrc
diff --git a/3rdparty/CGAL-4.8/demo/Spatial_searching_2/Spatial_searching_2.ui b/3rdparty/CGAL/demo/Spatial_searching_2/Spatial_searching_2.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Spatial_searching_2/Spatial_searching_2.ui
rename to 3rdparty/CGAL/demo/Spatial_searching_2/Spatial_searching_2.ui
diff --git a/3rdparty/CGAL-4.8/demo/Spatial_searching_2/about_Spatial_searching_2.html b/3rdparty/CGAL/demo/Spatial_searching_2/about_Spatial_searching_2.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Spatial_searching_2/about_Spatial_searching_2.html
rename to 3rdparty/CGAL/demo/Spatial_searching_2/about_Spatial_searching_2.html
diff --git a/3rdparty/CGAL/demo/Stream_lines_2/CMakeLists.txt b/3rdparty/CGAL/demo/Stream_lines_2/CMakeLists.txt
new file mode 100644
index 0000000..5c0970e
--- /dev/null
+++ b/3rdparty/CGAL/demo/Stream_lines_2/CMakeLists.txt
@@ -0,0 +1,51 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+project (Stream_lines_2_demo)
+
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+find_package(CGAL COMPONENTS Qt5)
+
+include(${CGAL_USE_FILE})
+
+
+find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
+include_directories (BEFORE ../../include)
+
+
+if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
+
+add_definitions(-DQT_NO_KEYWORDS)
+
+
+#--------------------------------
+# UI files (Qt Designer files)
+qt5_wrap_ui( DT_UI_FILES Stream_lines_2.ui )
+
+# qrc files (resources files, that contain icons, at least)
+qt5_add_resources ( CGAL_Qt5_RESOURCE_FILES ./Stream_lines_2.qrc )
+
+# use the Qt MOC preprocessor on classes that derives from QObject
+qt5_generate_moc( Stream_lines_2.cpp Stream_lines_2.moc )
+
+# The executable itself.
+add_executable  ( Stream_lines_2 Stream_lines_2.cpp Stream_lines_2.moc ${DT_UI_FILES}  ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES} )
+
+qt5_use_modules(Stream_lines_2 Xml Script OpenGL Svg)
+
+add_to_cached_list( CGAL_EXECUTABLE_TARGETS Stream_lines_2 )
+
+# Link with Qt libraries
+target_link_libraries( Stream_lines_2 ${QT_LIBRARIES} )
+# Link with CGAL
+target_link_libraries( Stream_lines_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES})
+
+else()
+
+  message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
+
+endif()
diff --git a/3rdparty/CGAL-4.8/demo/Stream_lines_2/Stream_lines_2.cpp b/3rdparty/CGAL/demo/Stream_lines_2/Stream_lines_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Stream_lines_2/Stream_lines_2.cpp
rename to 3rdparty/CGAL/demo/Stream_lines_2/Stream_lines_2.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Stream_lines_2/Stream_lines_2.qrc b/3rdparty/CGAL/demo/Stream_lines_2/Stream_lines_2.qrc
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Stream_lines_2/Stream_lines_2.qrc
rename to 3rdparty/CGAL/demo/Stream_lines_2/Stream_lines_2.qrc
diff --git a/3rdparty/CGAL-4.8/demo/Stream_lines_2/Stream_lines_2.ui b/3rdparty/CGAL/demo/Stream_lines_2/Stream_lines_2.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Stream_lines_2/Stream_lines_2.ui
rename to 3rdparty/CGAL/demo/Stream_lines_2/Stream_lines_2.ui
diff --git a/3rdparty/CGAL-4.8/demo/Stream_lines_2/about_Stream_lines_2.html b/3rdparty/CGAL/demo/Stream_lines_2/about_Stream_lines_2.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Stream_lines_2/about_Stream_lines_2.html
rename to 3rdparty/CGAL/demo/Stream_lines_2/about_Stream_lines_2.html
diff --git a/3rdparty/CGAL-4.8/demo/Stream_lines_2/data/vnoise.vec.cin b/3rdparty/CGAL/demo/Stream_lines_2/data/vnoise.vec.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Stream_lines_2/data/vnoise.vec.cin
rename to 3rdparty/CGAL/demo/Stream_lines_2/data/vnoise.vec.cin
diff --git a/3rdparty/CGAL/demo/Surface_mesh_deformation/CMakeLists.txt b/3rdparty/CGAL/demo/Surface_mesh_deformation/CMakeLists.txt
new file mode 100644
index 0000000..ee6d343
--- /dev/null
+++ b/3rdparty/CGAL/demo/Surface_mesh_deformation/CMakeLists.txt
@@ -0,0 +1,34 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Surface_mesh_deformation_demo )
+
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  find_package(Eigen3 3.1.91) #(requires 3.2.0 or greater)
+  if (EIGEN3_FOUND)
+    include( ${EIGEN3_USE_FILE} )
+    include( CGAL_CreateSingleSourceCGALProgram )
+
+    include_directories (BEFORE "../../include")
+    create_single_source_cgal_program( "deform_mesh_for_botsch08_format.cpp" )
+
+  else()
+    message(STATUS "NOTICE: This program requires the Eigen library, version 3.2 or later and will not be compiled.")
+  endif()
+else()
+  
+    message(STATUS "NOTICE: This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesh_deformation/deform_mesh_for_botsch08_format.cpp b/3rdparty/CGAL/demo/Surface_mesh_deformation/deform_mesh_for_botsch08_format.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesh_deformation/deform_mesh_for_botsch08_format.cpp
rename to 3rdparty/CGAL/demo/Surface_mesh_deformation/deform_mesh_for_botsch08_format.cpp
diff --git a/3rdparty/CGAL/demo/Surface_mesher/CMakeLists.txt b/3rdparty/CGAL/demo/Surface_mesher/CMakeLists.txt
new file mode 100644
index 0000000..c45bdc8
--- /dev/null
+++ b/3rdparty/CGAL/demo/Surface_mesher/CMakeLists.txt
@@ -0,0 +1,128 @@
+set ( prj Surface_mesher )
+
+project ( ${prj} )
+
+# Find includes in corresponding build directories
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+# Instruct CMake to run moc automatically when needed.
+set(CMAKE_AUTOMOC ON)
+
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+set(PACKAGE_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../..)
+
+# Add several CGAL packages to the include and link paths,
+# if they lie in ${PACKAGE_ROOT}/.
+foreach(INC_DIR ${PACKAGE_ROOT}/include ${PACKAGE_ROOT}/../Mesh_2/include ${PACKAGE_ROOT}/../Data_structure_for_queries_3/include ${PACKAGE_ROOT}/../Marching_cube/include ${PACKAGE_ROOT}/../CGAL_ImageIO/include ${PACKAGE_ROOT}/../GraphicsView/include)
+  if (EXISTS ${INC_DIR})
+    include_directories (BEFORE ${INC_DIR})
+  endif()
+endforeach()
+foreach(LIB_DIR ${PACKAGE_ROOT}/../CGAL_ImageIO/src/CGAL_ImageIO ${PACKAGE_ROOT}/../GraphicsView/src/CGALQt5)
+  if (EXISTS ${LIB_DIR})
+    link_directories (${LIB_DIR})
+  endif()
+endforeach()
+
+include_directories( ./ )
+
+# QGLViwer needs Qt5 configured with QtOpenGL and QtXml support
+
+set( QT_USE_QTOPENGL TRUE )
+set( QT_USE_QTXML    TRUE )
+set( QT_USE_QTMAIN   TRUE )
+
+find_package(CGAL COMPONENTS ImageIO Qt5)
+if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND CGAL_ImageIO_FOUND)
+
+  add_definitions(-DQT_NO_KEYWORDS)
+  include( ${CGAL_USE_FILE} )
+
+  find_package(Qt5 QUIET COMPONENTS OpenGL Xml Svg)
+  find_package(QGLViewer )
+  find_package(OpenGL    )
+
+  if ( QGLVIEWER_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND OPENGL_GLU_FOUND )
+
+
+    include_directories( ${QGLVIEWER_INCLUDE_DIR} )
+    add_definitions(${QGLVIEWER_DEFINITIONS})
+
+    set( sources Raw_image_dialog.cpp colorlisteditor.cpp values_list.cpp mainwindow.cpp Surface_mesher.cpp viewer.cpp volume.cpp )
+
+    if(EXISTS ${PACKAGE_ROOT}/../Marching_cube)
+      option(SURFACE_MESH_DEMO_USE_MARCHING_CUBE "Embed a marching cube implementation in the Surface Mesh demo." ON)
+      mark_as_advanced(SURFACE_MESH_DEMO_USE_MARCHING_CUBE)
+    endif()
+
+    if(EXISTS ${PACKAGE_ROOT}/include/CGAL/Polyhedral_surface_3.h)
+      option(SURFACE_MESH_DEMO_WITH_POLYHEDRAL_SURFACE "Compile the support for polyhedral surfaces." OFF)
+      mark_as_advanced(SURFACE_MESH_DEMO_WITH_POLYHEDRAL_SURFACE)
+    endif()
+
+    option(SURFACE_MESH_DEMO_VERBOSE "Set this option if you want the Surface Mesh demo to display messages on standard output." OFF)
+    mark_as_advanced(SURFACE_MESH_DEMO_VERBOSE)
+
+    if(SURFACE_MESH_DEMO_VERBOSE)
+      add_definitions(-DCGAL_SURFACE_MESHER_VERBOSE)
+    endif()
+
+    if(SURFACE_MESH_DEMO_WITH_POLYHEDRAL_SURFACE)
+      set(sources ${sources} polyhedral_surface.cpp)
+    else(SURFACE_MESH_DEMO_WITH_POLYHEDRAL_SURFACE)
+      add_definitions(-DCGAL_DO_NOT_USE_POLYHEDRAL_SURFACE)
+    endif(SURFACE_MESH_DEMO_WITH_POLYHEDRAL_SURFACE)
+
+    if(SURFACE_MESH_DEMO_USE_MARCHING_CUBE)
+      set(sources ${sources} ${PACKAGE_ROOT}/../Marching_cube/src/mc/ply.c)
+      add_definitions(-DCGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE)
+    endif()
+
+
+    qt5_generate_moc( "surface.h" "${CMAKE_CURRENT_BINARY_DIR}/moc_surface.cpp" )
+
+    set( sources ${sources} moc_surface.cpp)
+
+    qt5_wrap_ui( uis ui/values_list.ui ui/mainwindow.ui ui/optionsdialog.ui ui/raw_image.ui )
+
+    qt5_add_resources( CGAL_Qt5_RESOURCE_FILES values_list.qrc surface_mesher.qrc  )
+
+    add_executable  ( ${prj}  ${sources} ${uis} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES})
+
+    qt5_use_modules(${prj} OpenGL Xml Svg)
+
+    add_to_cached_list( CGAL_EXECUTABLE_TARGETS ${prj} )
+
+    set(VTK_LIBS "")
+    find_package(VTK QUIET COMPONENTS vtkImagingGeneral  vtkIOImage NO_MODULE)
+    if(VTK_FOUND)
+      include(${VTK_USE_FILE})
+      if ("${VTK_VERSION_MAJOR}" GREATER "5")
+        message(STATUS "VTK found")
+        add_definitions(-DCGAL_USE_VTK)
+        set(VTK_LIBS vtkImagingGeneral vtkIOImage)
+      else()
+        message(STATUS "Vtk must be at least Rel 6")
+      endif()
+    else()
+      message(STATUS "For reading Dicom files install VTK first")
+    endif()
+
+    # Link the executable to CGAL and third-party libraries
+    target_link_libraries( ${prj} ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES})
+
+    target_link_libraries( ${prj} ${QT_LIBRARIES} ${QGLVIEWER_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${VTK_LIBS})
+
+  else( QGLVIEWER_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND OPENGL_GLU_FOUND )
+    message(STATUS "NOTICE: This demo needs libQGLViewer, and will not be compiled.")
+  endif( QGLVIEWER_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND OPENGL_GLU_FOUND )
+else(CGAL_FOUND AND CGAL_Qt5_FOUND AND CGAL_ImageIO_FOUND)
+  if(RUNNING_CGAL_AUTO_TEST)
+    # Just to avoid a warning from CMake if that variable is set on the command line...
+  endif()
+
+  message(STATUS "NOTICE: This demo needs Qt5, and will not be compiled.")
+endif(CGAL_FOUND AND CGAL_Qt5_FOUND AND CGAL_ImageIO_FOUND)
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/File_XT.h b/3rdparty/CGAL/demo/Surface_mesher/File_XT.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/File_XT.h
rename to 3rdparty/CGAL/demo/Surface_mesher/File_XT.h
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/Raw_image_dialog.cpp b/3rdparty/CGAL/demo/Surface_mesher/Raw_image_dialog.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/Raw_image_dialog.cpp
rename to 3rdparty/CGAL/demo/Surface_mesher/Raw_image_dialog.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/Raw_image_dialog.h b/3rdparty/CGAL/demo/Surface_mesher/Raw_image_dialog.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/Raw_image_dialog.h
rename to 3rdparty/CGAL/demo/Surface_mesher/Raw_image_dialog.h
diff --git a/3rdparty/CGAL/demo/Surface_mesher/Surface_mesher.cpp b/3rdparty/CGAL/demo/Surface_mesher/Surface_mesher.cpp
new file mode 100644
index 0000000..b6c1869
--- /dev/null
+++ b/3rdparty/CGAL/demo/Surface_mesher/Surface_mesher.cpp
@@ -0,0 +1,23 @@
+#include "mainwindow.h"
+#include <QApplication>
+#include <iostream>
+#include <clocale>
+
+int main(int argc, char** argv)
+{
+  QApplication application(argc,argv);
+
+  application.setOrganizationDomain("geometryfactory.com");
+  application.setOrganizationName("GeometryFactory");
+  application.setApplicationName("Surface mesher Qt5 demo");
+
+  MainWindow w;
+
+  if(argc>1)
+    w.surface_open(argv[1]);
+
+  w.show();
+  std::setlocale(LC_ALL, "C");
+  return application.exec();
+  std::cerr << "Exit\n";
+}
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/binary_image.h b/3rdparty/CGAL/demo/Surface_mesher/binary_image.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/binary_image.h
rename to 3rdparty/CGAL/demo/Surface_mesher/binary_image.h
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/colorlisteditor.cpp b/3rdparty/CGAL/demo/Surface_mesher/colorlisteditor.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/colorlisteditor.cpp
rename to 3rdparty/CGAL/demo/Surface_mesher/colorlisteditor.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/colorlisteditor.h b/3rdparty/CGAL/demo/Surface_mesher/colorlisteditor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/colorlisteditor.h
rename to 3rdparty/CGAL/demo/Surface_mesher/colorlisteditor.h
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/get_polyhedral_surface.h b/3rdparty/CGAL/demo/Surface_mesher/get_polyhedral_surface.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/get_polyhedral_surface.h
rename to 3rdparty/CGAL/demo/Surface_mesher/get_polyhedral_surface.h
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/icons/bbox-red.png b/3rdparty/CGAL/demo/Surface_mesher/icons/bbox-red.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/icons/bbox-red.png
rename to 3rdparty/CGAL/demo/Surface_mesher/icons/bbox-red.png
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/icons/bbox-red.svg b/3rdparty/CGAL/demo/Surface_mesher/icons/bbox-red.svg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/icons/bbox-red.svg
rename to 3rdparty/CGAL/demo/Surface_mesher/icons/bbox-red.svg
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/icons/bbox.png b/3rdparty/CGAL/demo/Surface_mesher/icons/bbox.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/icons/bbox.png
rename to 3rdparty/CGAL/demo/Surface_mesher/icons/bbox.png
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/icons/bbox.svg b/3rdparty/CGAL/demo/Surface_mesher/icons/bbox.svg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/icons/bbox.svg
rename to 3rdparty/CGAL/demo/Surface_mesher/icons/bbox.svg
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/icons/cgal_logo.xpm b/3rdparty/CGAL/demo/Surface_mesher/icons/cgal_logo.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/icons/cgal_logo.xpm
rename to 3rdparty/CGAL/demo/Surface_mesher/icons/cgal_logo.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/icons/fileopen.png b/3rdparty/CGAL/demo/Surface_mesher/icons/fileopen.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/icons/fileopen.png
rename to 3rdparty/CGAL/demo/Surface_mesher/icons/fileopen.png
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/icons/filesave.png b/3rdparty/CGAL/demo/Surface_mesher/icons/filesave.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/icons/filesave.png
rename to 3rdparty/CGAL/demo/Surface_mesher/icons/filesave.png
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/icons/flip.png b/3rdparty/CGAL/demo/Surface_mesher/icons/flip.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/icons/flip.png
rename to 3rdparty/CGAL/demo/Surface_mesher/icons/flip.png
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/icons/flip.svg b/3rdparty/CGAL/demo/Surface_mesher/icons/flip.svg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/icons/flip.svg
rename to 3rdparty/CGAL/demo/Surface_mesher/icons/flip.svg
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/icons/minus.png b/3rdparty/CGAL/demo/Surface_mesher/icons/minus.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/icons/minus.png
rename to 3rdparty/CGAL/demo/Surface_mesher/icons/minus.png
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/icons/plus.png b/3rdparty/CGAL/demo/Surface_mesher/icons/plus.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/icons/plus.png
rename to 3rdparty/CGAL/demo/Surface_mesher/icons/plus.png
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/icons/resize.png b/3rdparty/CGAL/demo/Surface_mesher/icons/resize.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/icons/resize.png
rename to 3rdparty/CGAL/demo/Surface_mesher/icons/resize.png
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/icons/resize.svg b/3rdparty/CGAL/demo/Surface_mesher/icons/resize.svg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/icons/resize.svg
rename to 3rdparty/CGAL/demo/Surface_mesher/icons/resize.svg
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/icons/surface.png b/3rdparty/CGAL/demo/Surface_mesher/icons/surface.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/icons/surface.png
rename to 3rdparty/CGAL/demo/Surface_mesher/icons/surface.png
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/icons/surface.svg b/3rdparty/CGAL/demo/Surface_mesher/icons/surface.svg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/icons/surface.svg
rename to 3rdparty/CGAL/demo/Surface_mesher/icons/surface.svg
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/icons/twosides.png b/3rdparty/CGAL/demo/Surface_mesher/icons/twosides.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/icons/twosides.png
rename to 3rdparty/CGAL/demo/Surface_mesher/icons/twosides.png
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/icons/twosides.svg b/3rdparty/CGAL/demo/Surface_mesher/icons/twosides.svg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/icons/twosides.svg
rename to 3rdparty/CGAL/demo/Surface_mesher/icons/twosides.svg
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/mainwindow.cpp b/3rdparty/CGAL/demo/Surface_mesher/mainwindow.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/mainwindow.cpp
rename to 3rdparty/CGAL/demo/Surface_mesher/mainwindow.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/mainwindow.h b/3rdparty/CGAL/demo/Surface_mesher/mainwindow.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/mainwindow.h
rename to 3rdparty/CGAL/demo/Surface_mesher/mainwindow.h
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/polyhedral_surface.cpp b/3rdparty/CGAL/demo/Surface_mesher/polyhedral_surface.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/polyhedral_surface.cpp
rename to 3rdparty/CGAL/demo/Surface_mesher/polyhedral_surface.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/polyhedral_surface.h b/3rdparty/CGAL/demo/Surface_mesher/polyhedral_surface.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/polyhedral_surface.h
rename to 3rdparty/CGAL/demo/Surface_mesher/polyhedral_surface.h
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/surface.h b/3rdparty/CGAL/demo/Surface_mesher/surface.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/surface.h
rename to 3rdparty/CGAL/demo/Surface_mesher/surface.h
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/surface_mesher.qrc b/3rdparty/CGAL/demo/Surface_mesher/surface_mesher.qrc
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/surface_mesher.qrc
rename to 3rdparty/CGAL/demo/Surface_mesher/surface_mesher.qrc
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/ui/mainwindow.ui b/3rdparty/CGAL/demo/Surface_mesher/ui/mainwindow.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/ui/mainwindow.ui
rename to 3rdparty/CGAL/demo/Surface_mesher/ui/mainwindow.ui
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/ui/optionsdialog.ui b/3rdparty/CGAL/demo/Surface_mesher/ui/optionsdialog.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/ui/optionsdialog.ui
rename to 3rdparty/CGAL/demo/Surface_mesher/ui/optionsdialog.ui
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/ui/raw_image.ui b/3rdparty/CGAL/demo/Surface_mesher/ui/raw_image.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/ui/raw_image.ui
rename to 3rdparty/CGAL/demo/Surface_mesher/ui/raw_image.ui
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/ui/values_list.ui b/3rdparty/CGAL/demo/Surface_mesher/ui/values_list.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/ui/values_list.ui
rename to 3rdparty/CGAL/demo/Surface_mesher/ui/values_list.ui
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/values_list.cpp b/3rdparty/CGAL/demo/Surface_mesher/values_list.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/values_list.cpp
rename to 3rdparty/CGAL/demo/Surface_mesher/values_list.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/values_list.h b/3rdparty/CGAL/demo/Surface_mesher/values_list.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/values_list.h
rename to 3rdparty/CGAL/demo/Surface_mesher/values_list.h
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/values_list.qrc b/3rdparty/CGAL/demo/Surface_mesher/values_list.qrc
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/values_list.qrc
rename to 3rdparty/CGAL/demo/Surface_mesher/values_list.qrc
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/viewer.cpp b/3rdparty/CGAL/demo/Surface_mesher/viewer.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/viewer.cpp
rename to 3rdparty/CGAL/demo/Surface_mesher/viewer.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Surface_mesher/viewer.h b/3rdparty/CGAL/demo/Surface_mesher/viewer.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Surface_mesher/viewer.h
rename to 3rdparty/CGAL/demo/Surface_mesher/viewer.h
diff --git a/3rdparty/CGAL/demo/Surface_mesher/volume.cpp b/3rdparty/CGAL/demo/Surface_mesher/volume.cpp
new file mode 100644
index 0000000..0ff4f3c
--- /dev/null
+++ b/3rdparty/CGAL/demo/Surface_mesher/volume.cpp
@@ -0,0 +1,1606 @@
+#include <CGAL/basic.h>
+
+#include "volume.h"
+
+#include  <algorithm> // std::sort
+#include <boost/shared_ptr.hpp>
+#include <fstream>
+#include <boost/foreach.hpp>
+
+#include <CGAL/Bbox_3.h>
+
+#include "viewer.h"
+#include "mainwindow.h"
+#include "values_list.h"
+
+#include "File_XT.h" // format XT from Total/ELF
+
+#include <QApplication>
+#include <QFileDialog>
+#include <QAction>
+#include <QStatusBar>
+#include <QDoubleSpinBox>
+#include <QMessageBox>
+#include <QTreeWidgetItem>
+#include <QTime>
+#include <QColor>
+#include <QColorDialog>
+#include <QSettings>
+#include <QUrl>
+#include "Raw_image_dialog.h"
+#include <CGAL/Surface_mesher/Standard_criteria.h>
+// #include <CGAL/Surface_mesher/Image_surface_oracle_3.h>
+#include <CGAL/Surface_mesher/Implicit_surface_oracle_3.h>
+#include <CGAL/Surface_mesher/Vertices_on_the_same_psc_element_criterion.h>
+#include <CGAL/IO/Complex_2_in_triangulation_3_file_writer.h>
+#include <CGAL/make_surface_mesh.h>
+#include <CGAL/Qt/debug.h>
+
+struct Threshold : public std::unary_function<FT, unsigned char> {
+  double isovalue;
+  bool is_identity;
+
+  Threshold(double isovalue) : isovalue(isovalue), is_identity(false) {}
+
+  result_type operator()(FT value)
+  {
+    if(is_identity)
+      return static_cast<unsigned char>(value);
+    else if(value >=  isovalue)
+      return 1;
+    else
+      return 0;
+  }
+};
+
+class Classify_from_isovalue_list :
+  public std::unary_function<FT, unsigned char> 
+{
+  typedef std::pair<FT, result_type> Isovalue;
+  typedef std::vector<Isovalue> Isovalues;
+  boost::shared_ptr<Isovalues> isovalues;
+  bool is_identity;
+
+  struct Sort_isovalues : std::binary_function<Isovalue, Isovalue, bool> 
+  {
+    bool operator()(const Isovalue& isoval1, const Isovalue& isoval2)
+    {
+      return isoval1.first < isoval2.first;
+    }
+  };
+public:
+  Classify_from_isovalue_list(Values_list * list)
+    : is_identity(false)
+  {
+    isovalues = boost::shared_ptr<Isovalues>(new Isovalues(list->numberOfValues()));
+    for(int i = 0, nbs = list->numberOfValues(); i < nbs; ++i )
+      (*isovalues)[i] = std::make_pair(list->value(i), i);
+    std::sort(isovalues->begin(), isovalues->end(), Sort_isovalues());
+  }
+
+  void set_identity(bool b) {
+    is_identity = b;
+  }
+
+  result_type operator()(FT value)
+  {
+    if(is_identity) {
+      return static_cast<unsigned char>(value);
+    }
+    result_type result = 0;
+//     std::cerr << "isovalues: ";
+    for(int i = 1, end = static_cast<int>(isovalues->size()); i <= end; ++i)
+    {
+//       std::cerr << (*isovalues)[i-1] << ", ";
+      if(value >= (*isovalues)[i-1].first &&
+         i >= result)
+      {
+        result = i;
+      }
+    }
+//     if(result>1)
+//       std::cerr << "result = "  << (int)result << "/" << list->numberOfValues() << std::endl;
+//     else
+//       std::cerr << std::endl;
+    if(result>0)
+      return (*isovalues)[result-1].second + 1;
+    else
+      return 0;
+  }
+};
+
+class Generate_surface_identifiers :
+  public std::binary_function<Classify_from_isovalue_list::result_type,
+                              Classify_from_isovalue_list::result_type,
+                              const QTreeWidgetItem*>
+{
+  Values_list* list;
+  bool labellized;
+
+public:
+  Generate_surface_identifiers(Values_list* list)
+    : list(list), labellized(false) {};
+
+  void set_labellized_image(bool b)
+  {
+    labellized = b;
+  }
+
+  result_type operator()(const Classify_from_isovalue_list::result_type& a,
+                         const Classify_from_isovalue_list::result_type& b)
+  {
+    if(labellized)
+      return list->search((std::max)(a, b));
+    else
+      return list->item((std::min)(a, b));
+  }
+};
+
+// class Classify_from_isovalue_list :
+//   public std::unary_function<FT, const QTreeWidgetItem*> 
+// {
+//   typedef std::pair<FT, result_type> Isovalue;
+//   typedef std::vector<Isovalue> Isovalues;
+//   boost::shared_ptr<Isovalues> isovalues;
+
+//   struct Sort_isovalues : std::binary_function<Isovalue, Isovalue, bool> 
+//   {
+//     bool operator()(const Isovalue& isoval1, const Isovalue& isoval2)
+//     {
+//       return isoval1.first < isoval2.first;
+//     }
+//   };
+// public:
+//   Classify_from_isovalue_list(Isovalues_list * list)
+//   {
+//     isovalues = boost::shared_ptr<Isovalues>(new Isovalues(list->numberOfIsoValues()));
+//     for(int i = 0, nbs = list->numberOfIsoValues(); i < nbs; ++i )
+//       (*isovalues)[i] = std::make_pair(list->isovalue(i), list->item(i));
+//     std::sort(isovalues->begin(), isovalues->end(), Sort_isovalues());
+//   }
+
+//   result_type operator()(FT value)
+//   {
+//     int result = 0;
+// //     std::cerr << "isovalues: ";
+//     for(int i = 1, end = isovalues->size(); i <= end; ++i)
+//     {
+// //       std::cerr << (*isovalues)[i-1] << ", ";
+//       if(value >= (*isovalues)[i-1].first &&
+//          i >= result)
+//       {
+//         result = i;
+//       }
+//     }
+//     if(result>1)
+//       std::cerr << boost::format("result = %1%/%2%\n") % result % isovalues->size();
+//     if(result>0)
+//       return (*isovalues)[result-1].second;
+//     else
+//       return 0;
+//   }
+// };
+Volume::Volume(MainWindow* mw) : 
+  Surface(mw),
+  m_sm_angle(30),
+  m_sm_radius(0),
+  m_sm_distance(0),
+  m_relative_precision(0.000000001),
+  m_view_surface(false),
+  m_triangulation_color(QColor(Qt::green)),
+  m_inverse_normals(false),
+  two_sides(false),
+  del(),
+  c2t3(del),
+  mw(mw),
+  lists_draw_surface(),
+  lists_draw_surface_is_valid(false),
+#ifdef CGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE
+  list_draw_marching_cube(0),
+  list_draw_marching_cube_is_valid(false),
+  lists_draw_surface_mc(),
+#endif // CGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE
+  m_view_mc(false)
+{
+  spinBox_radius_bound = mw->findChild<QDoubleSpinBox*>("spinBox_radius_bound");
+  spinBox_distance_bound = mw->findChild<QDoubleSpinBox*>("spinBox_distance_bound");
+  Q_ASSERT_X(spinBox_radius_bound && spinBox_distance_bound,
+             "Volume::Volume()", "Cannot find spinboxes!");
+
+  values_list = mw->values;
+
+  connect(spinBox_radius_bound, SIGNAL(valueChanged(double)),
+          this, SLOT(set_radius_bound(double)));
+  connect(spinBox_distance_bound, SIGNAL(valueChanged(double)),
+          this, SLOT(set_distance_bound(double)));
+
+  connect(mw->actionSurface_mesher, SIGNAL(triggered()),
+          this, SLOT(display_surface_mesher_result()));
+
+  connect(mw->actionInverse_normals, SIGNAL(toggled(bool)),
+          this, SLOT(set_inverse_normals(bool)));
+  m_inverse_normals = mw->actionInverse_normals->isChecked();
+
+  connect(mw->actionDisplay_front_and_back, SIGNAL(toggled(bool)),
+          this, SLOT(set_two_sides(bool)));
+  two_sides = mw->actionDisplay_front_and_back->isChecked();
+
+  connect(mw->actionDraw_triangles_edges, SIGNAL(toggled(bool)),
+          this, SLOT(set_draw_triangles_edges(bool)));
+  draw_triangles_edges = mw->actionDraw_triangles_edges->isChecked();
+
+  connect(mw->actionUse_Gouraud_shading, SIGNAL(toggled(bool)),
+          this, SLOT(set_use_gouraud(bool)));
+  use_gouraud = mw->actionUse_Gouraud_shading->isChecked();
+
+  connect(mw->actionShow_the_image_bounding_box, SIGNAL(toggled(bool)),
+          this, SLOT(set_show_bbox(bool)));
+  show_bbox = mw->actionShow_the_image_bounding_box->isChecked();
+
+  connect(mw->actionShow_triangulation, SIGNAL(toggled(bool)),
+          this, SLOT(set_draw_triangulation(bool)));
+  m_draw_triangulation = mw->actionShow_triangulation->isChecked();
+
+  connect(mw->actionTriangulation_edges_color, SIGNAL(triggered()),
+          this, SLOT(set_triangulation_edges_color()));
+
+  connect(this, SIGNAL(new_bounding_box(double, double, double, double, double, double)),
+          mw->viewer, SLOT(interpolateToFitBoundingBox(double, double, double, double, double, double)));
+
+  connect(values_list, SIGNAL(values_changed()),
+          this, SLOT(changed_parameters()));
+  connect(values_list, SIGNAL(changed()),
+          mw->viewer, SLOT(updateGL()));
+  connect(this, SIGNAL(changed()),
+          this, SLOT(check_can_export_off()));
+
+  connect(mw->labellizedRadioButton, SIGNAL(toggled(bool)),
+	  this, SLOT(labellizedToogled(bool)));
+
+  mw->actionExport_surface_mesh_to_OFF->setEnabled(false);
+  connect(mw->actionExport_surface_mesh_to_OFF, SIGNAL(triggered()),
+          this, SLOT(export_off()));
+
+  connect(mw->actionSave, SIGNAL(triggered()),
+          this, SLOT(save_image_to_inr()));
+
+#ifdef CGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE
+  connect(mw->actionMarching_cubes, SIGNAL(triggered()),
+          this, SLOT(display_marchin_cube()));
+#endif
+}
+
+void Volume::set_inverse_normals(const bool b) {
+  m_inverse_normals = b;
+
+  list_draw_marching_cube = 0; // Invalidate the display list for the
+                               // marching cube. See gl_draw_marchingcube()
+                               // for an explanation.
+
+  Q_EMIT changed();
+}
+
+void Volume::set_two_sides(const bool b) {
+  two_sides = b;
+  Q_EMIT changed();
+}
+
+void Volume::set_draw_triangles_edges(const bool b) {
+  draw_triangles_edges = b;
+  Q_EMIT changed();
+}
+
+void Volume::set_draw_triangulation(const bool b) {
+  m_draw_triangulation = b;
+  Q_EMIT changed();
+}
+
+void Volume::set_triangulation_edges_color() {
+  const QColor color = QColorDialog::getColor(m_triangulation_color, mw);
+  if (color.isValid()) {
+    m_triangulation_color = color;
+    Q_EMIT changed();
+  }
+}
+
+void Volume::set_use_gouraud(const bool b) {
+  use_gouraud = b;
+  Q_EMIT changed();
+}
+
+void Volume::set_show_bbox(const bool b) {
+  show_bbox = b;
+  Q_EMIT changed();
+}
+
+void Volume::only_in()
+{
+  mw->show_only("volume");
+#ifndef CGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE
+  mw->actionMarching_cubes->setVisible(false);
+#endif
+}
+
+#ifdef CGAL_USE_VTK
+
+#include <CGAL/read_vtk_image_data.h>
+
+#include <vtkImageData.h>
+#include <vtkDICOMImageReader.h>
+#include <vtkImageReader.h>
+#include <vtkImageGaussianSmooth.h>
+#include <vtkDemandDrivenPipeline.h>
+
+Volume::~Volume()
+{
+  if(vtk_reader) vtk_reader->Delete();
+  if(vtk_image) vtk_image->Delete();
+  if(dicom_reader) dicom_reader->Delete();
+  if(executive) executive->Delete();
+  if(smoother) smoother->Delete();
+}
+
+bool Volume::opendir(const QString& dirname) 
+{
+  bool result = true;
+  if(!fileinfo.isReadable())
+  {
+    QMessageBox::warning(mw, mw->windowTitle(),
+                         tr("Cannot read directory <tt>%1</tt>!").arg(dirname));
+    status_message(tr("Opening of directory %1 failed!").arg(dirname));
+    result = false;
+  }
+  else
+  {
+    dicom_reader = vtkDICOMImageReader::New();
+    dicom_reader->SetDirectoryName(dirname.toUtf8());
+
+    executive =
+      vtkDemandDrivenPipeline::SafeDownCast(dicom_reader->GetExecutive());
+    if (executive)
+    {
+      executive->SetReleaseDataFlag(0, 0); // where 0 is the port index
+    }
+
+    smoother = vtkImageGaussianSmooth::New();
+    smoother->SetStandardDeviations(1., 1., 1.);
+    smoother->SetInputConnection(dicom_reader->GetOutputPort());
+    smoother->Update();
+    vtk_image = smoother->GetOutput();
+    vtk_image->Print(std::cerr);
+    m_image = CGAL::read_vtk_image_data(vtk_image);
+    if(m_image.image() == 0)
+    {
+      QMessageBox::warning(mw, mw->windowTitle(),
+                           tr("Error with file <tt>%1/</tt>:\nunknown file format!").arg(dirname));
+      status_message(tr("Opening of file %1/ failed!").arg(dirname));
+      result = false;
+    }
+    else
+    {
+      status_message(tr("File %1/ successfully opened.").arg(dirname));
+      finish_open();
+      result = true;
+    }
+    // if(executive) executive->Delete();
+    // dicom_reader->Delete();
+    // smoother->Delete();
+  }
+  return result;
+}
+
+bool Volume::open_vtk(const QString& filename)
+{
+  only_in();
+
+  fileinfo.setFile(filename);
+
+  if(fileinfo.isDir())
+  {
+    return opendir(filename);
+  }
+
+  if(!fileinfo.isReadable())
+  {
+    QMessageBox::warning(mw, mw->windowTitle(),
+                         tr("Cannot read file <tt>%1</tt>!").arg(filename));
+    status_message(tr("Opening of file %1 failed!").arg(filename));
+    return false;
+  }
+  else
+  {
+    vtk_reader = vtkImageReader::New();
+    vtk_reader->SetFileName(filename.toUtf8());
+    vtk_reader->SetDataScalarTypeToUnsignedChar();
+    vtk_reader->SetDataExtent(0, 249, 0, 249, 0,  124);
+    vtk_reader->SetDataSpacing(1., 1., 1.);
+    vtk_reader->SetFileDimensionality(3);
+    vtk_reader->Update();
+    vtk_reader->Print(std::cerr);
+    vtk_image = vtk_reader->GetOutput();
+    vtk_image->Print(std::cerr);
+    m_image = CGAL::read_vtk_image_data(vtk_image);
+    if(m_image.image() == NULL)
+    {
+      QMessageBox::warning(mw, mw->windowTitle(),
+                           tr("Error with file <tt>%1</tt>:\nunknown file format!").arg(filename));
+      status_message(tr("Opening of file %1 failed!").arg(filename));
+      return false;
+    }
+    else
+    {
+      status_message(tr("File %1 successfully opened.").arg(filename));
+      finish_open();
+      return true;
+    }
+  }
+}
+
+// Total 3D images (XT format, that is the old Inrimage format, 1994.
+bool Volume::open_xt(const QString& filename)
+{
+  only_in();
+
+  fileinfo.setFile(filename);
+
+  if(fileinfo.isDir())
+  {
+    return false;
+  }
+
+  if(!fileinfo.isReadable())
+  {
+    QMessageBox::warning(mw, mw->windowTitle(),
+                         tr("Cannot read file <tt>%1</tt>!").arg(filename));
+    status_message(tr("Opening of file %1 failed!").arg(filename));
+    return false;
+  }
+  else
+  {
+    long dimx, dimy, dimz;
+    long word_dim;
+    long header_size;
+    const char* filename_stl = qPrintable(filename);
+    CGAL::Total::lire_longueur_entete(filename_stl, &header_size);
+    CGAL::Total::lire_nb_octet(filename_stl, &word_dim);
+    CGAL::Total::lire_longueur_trace(filename_stl, &dimx);
+    CGAL::Total::lire_nb_trace(filename_stl, &dimy);
+    CGAL::Total::lire_nb_plan(filename_stl, &dimz);
+
+    vtkImageReader* vtk_reader = vtkImageReader::New();
+    vtk_reader->SetFileName(filename_stl);
+    switch(word_dim) {
+    case 8:
+      vtk_reader->SetDataScalarTypeToUnsignedChar();
+      break;
+    case 16:
+      vtk_reader->SetDataScalarTypeToUnsignedShort();
+      break;
+    default:
+      return false;
+    }
+    vtk_reader->SetHeaderSize(header_size);
+    vtk_reader->SetDataExtent(1, dimx, 1, dimy, 1,  dimz);
+    vtk_reader->SetDataSpacing(1., 1., 1.);
+    vtk_reader->SetFileDimensionality(3);
+    vtk_reader->Update();
+    vtk_reader->Print(std::cerr);
+    vtkImageData* vtk_image = vtk_reader->GetOutput();
+    vtk_image->Print(std::cerr);
+    m_image = CGAL::read_vtk_image_data(vtk_image);
+    if(m_image.image() != NULL)
+    {
+      QMessageBox::warning(mw, mw->windowTitle(),
+                           tr("Error with file <tt>%1</tt>:\nunknown file format!").arg(filename));
+      status_message(tr("Opening of file %1 failed!").arg(filename));
+      return false;
+    }
+    else
+    {
+      status_message(tr("File %1 successfully opened.").arg(filename));
+      finish_open();
+    }
+    return true;
+  }
+}
+
+#else // CGAL_USE_VTK
+Volume::~Volume()
+{
+}
+
+bool Volume::opendir(const QString&)
+{
+  return false;
+}
+
+bool Volume::open_xt(const QString&)
+{
+  return false;
+}
+#endif // CGAL_USE_VTK
+
+bool Volume::open(const QString& filename)
+{
+  only_in();
+
+  fileinfo.setFile(filename);
+
+  if(fileinfo.isDir())
+  {
+    return opendir(filename);
+  }
+
+  if(!fileinfo.isReadable())
+  {
+    QMessageBox::warning(mw, mw->windowTitle(),
+                         tr("Cannot read file <tt>%1</tt>!").arg(filename));
+  }
+  else
+  {
+    if(m_image.read(filename.toStdString().c_str()))
+    {
+      status_message(tr("File %1 successfully opened.").arg(filename));
+      finish_open();
+      return true;
+    }
+    else if(open_xt(filename)) {
+      return true;
+    }
+    else 
+    {
+      QSettings settings;
+      settings.beginGroup(QUrl::toPercentEncoding(fileinfo.absoluteFilePath()));
+      if( settings.value("is_raw").toBool() &&
+	  m_image.read_raw(filename.toStdString().c_str(),
+			   settings.value("dim_x").toInt(),
+			   settings.value("dim_y").toInt(),
+			   settings.value("dim_z").toInt(),
+			   settings.value("spacing_x").toDouble(),
+			   settings.value("spacing_y").toDouble(),
+			   settings.value("spacing_z").toDouble(),
+			   settings.value("offset").toInt()) )
+      {
+	status_message(tr("File %1 successfully opened.").arg(filename));
+	finish_open();
+	return true;
+      }
+      else if(QMessageBox::warning(mw, mw->windowTitle(),
+				   tr("Error with file <tt>%1</tt>:\n"
+				      "unknown file format!\n"
+				      "\n"
+				      "Open it as a raw image?").arg(filename),
+				   QMessageBox::Yes|QMessageBox::No) == QMessageBox::Yes) 
+      {
+	Raw_image_dialog raw_dialog;
+	raw_dialog.label_file_size->setText(QString("%1 B").arg(fileinfo.size()));
+	if( raw_dialog.exec() && 
+	    m_image.read_raw(filename.toStdString().c_str(),
+			     raw_dialog.dim_x->value(),
+			     raw_dialog.dim_y->value(),
+			     raw_dialog.dim_z->value(),
+			     raw_dialog.spacing_x->value(),
+			     raw_dialog.spacing_y->value(),
+			     raw_dialog.spacing_z->value(),
+			     raw_dialog.offset->value()) )
+	{
+	  status_message(tr("File %1 successfully opened.").arg(filename));
+	  QSettings settings;
+	  settings.beginGroup(QUrl::toPercentEncoding(fileinfo.absoluteFilePath()));
+	  settings.setValue("is_raw", true);
+	  settings.setValue("dim_x", raw_dialog.dim_x->value());
+	  settings.setValue("dim_y", raw_dialog.dim_y->value());
+	  settings.setValue("dim_z", raw_dialog.dim_z->value());
+	  settings.setValue("spacing_x", raw_dialog.spacing_x->value());
+	  settings.setValue("spacing_y", raw_dialog.spacing_y->value());
+	  settings.setValue("spacing_z", raw_dialog.spacing_z->value());
+	  settings.setValue("offset", raw_dialog.offset->value());
+	  settings.endGroup();
+	  finish_open();
+	  return true;
+	}
+      }
+    }
+  }
+  status_message(tr("Opening of file %1 failed!").arg(filename));
+  return false;
+}
+
+void Volume::finish_open()
+{
+  m_image.finish_open();
+  mw->viewer->camera()->setSceneBoundingBox(qglviewer::Vec(0, 0, 0),
+                                            qglviewer::Vec(m_image.xmax(),
+                                                           m_image.ymax(),
+                                                           m_image.zmax()));
+
+  mw->viewer->showEntireScene();
+  values_list->load_values(fileinfo.absoluteFilePath());
+  load_image_settings(fileinfo.absoluteFilePath());
+  changed_parameters();
+  Q_EMIT changed();
+}
+
+void Volume::export_off()
+{
+  QFileDialog filedialog(mw, tr("Export surface to file"));
+  filedialog.setFileMode(QFileDialog::AnyFile);
+  
+  filedialog.setNameFilter(tr("OFF files (*.off);;"
+                              "All files (*)"));
+  
+  filedialog.setAcceptMode(QFileDialog::AcceptSave);
+  filedialog.setDefaultSuffix("off");
+  if(filedialog.exec())
+  {
+    const QString filename = filedialog.selectedFiles().front();
+    std::cerr << "Saving to file \"" << filename.toLocal8Bit().data() << "\"...";
+    std::ofstream out(filename.toUtf8());
+    CGAL::output_surface_facets_to_off(out, c2t3);
+    if(!out)
+    {
+      QMessageBox::warning(mw, mw->windowTitle(),
+                           tr("Export to the OFF file <tt>%1</tt> failed!").arg(filename));
+      status_message(tr("Export to the OFF file %1 failed!").arg(filename));
+      std::cerr << " failed!\n";
+    }
+    else
+    {
+      std::cerr << " done.\n";
+      status_message(tr("Successfull export to the OFF file %1.").arg(filename));
+    }
+  }
+}
+
+void Volume::save_image_to_inr()
+{
+  QFileDialog filedialog(mw, tr("Export image to Inrimage format"));
+  filedialog.setFileMode(QFileDialog::AnyFile);
+  
+  filedialog.setNameFilter(tr("Inrimage files (*.inr);;"
+                              "Compressed Inrimage files (*.inr.gz)"));
+
+
+  filedialog.setAcceptMode(QFileDialog::AcceptSave);
+  filedialog.setDefaultSuffix("inr.gz");
+  if(filedialog.exec())
+  {
+    const QString filename = filedialog.selectedFiles().front();
+    std::cerr << "Saving image to file \"" << filename.toLocal8Bit().data() << "\"...";
+    const int result = ::_writeImage(m_image.image(), filename.toUtf8());
+    if(result != ImageIO_NO_ERROR)
+    {
+      QMessageBox::warning(mw, mw->windowTitle(),
+                           tr("Export to the Inrimage file <tt>%1</tt> failed!").arg(filename));
+      status_message(tr("Export to the Inrimage file %1 failed!").arg(filename));
+      std::cerr << " failed!\n";
+    }
+    else
+    {
+      std::cerr << " done.\n";
+      status_message(tr("Successfull export to the Inrimage file %1.").arg(filename));
+    }
+  }
+}
+
+void Volume::check_can_export_off()
+{
+  mw->actionExport_surface_mesh_to_OFF->setEnabled(m_view_surface);// || m_view_mc);
+}
+
+void Volume::status_message(QString string)
+{
+  std::cerr << qPrintable(string) << std::endl;
+  mw->statusBar()->showMessage(string);
+}
+
+void Volume::busy() const 
+{
+  QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
+}
+
+void Volume::not_busy() const 
+{
+  QApplication::restoreOverrideCursor();
+}
+
+void Volume::display_marchin_cube()
+{
+#ifdef CGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE
+  if(m_surface_mc.empty())
+  {
+    QTime total_time;
+    total_time.start();
+
+    values_list->save_values(fileinfo.absoluteFilePath());
+
+    unsigned int nx = m_image.xdim();
+    unsigned int ny = m_image.ydim();
+    unsigned int nz = m_image.zdim();
+    if(nx * ny * nz == 0)
+    {
+      status_message("No volume loaded.");
+      return;
+    }
+
+    mc_timer.reset();
+    busy();
+    status_message("Marching cubes...");
+
+    mc_timer.start();
+    m_surface_mc.clear();
+
+    if(mc.ntrigs()!=0)
+      mc.clean_all();
+    mc.set_resolution(nx,ny,nz);
+    mc.init_all();
+    mc.set_ext_data(static_cast<unsigned char*>(m_image.image()->data));
+
+    nbs_of_mc_triangles.resize(values_list->numberOfValues());
+
+    for(int value_id = 0; 
+        value_id < values_list->numberOfValues();
+        ++value_id)
+    {
+      status_message(tr("Marching cubes, isovalue #%1...").arg(value_id));
+
+      // set data
+//       for(unsigned int i=0;i<nx;i++)
+//         for(unsigned int j=0;j<ny;j++)
+//           for(unsigned int k=0;k<nz;k++)
+//           {
+//             const float& value = m_image.value(i,j,k);
+//             mc.set_data(value,i,j,k);
+//           }
+      // compute scaling ratio
+      if(value_id > 0)
+        mc.init_temps();
+      mc.run(values_list->value(value_id),
+             m_image.vx(),
+             m_image.vy(),
+             m_image.vz());
+      mc.clean_temps();
+
+      std::vector<double> facets;
+      mc.get_facets(facets);
+
+      mc_timer.stop();
+      const unsigned int begin = value_id == 0 ? 0 : nbs_of_mc_triangles[value_id-1];
+      const unsigned int nbt = facets.size() / 9;
+      for(unsigned int i=begin;i<nbt;i++)
+      {
+        const Point a(facets[9*i],   facets[9*i+1], facets[9*i+2]);
+        const Point b(facets[9*i+3], facets[9*i+4], facets[9*i+5]);
+        const Point c(facets[9*i+6], facets[9*i+7], facets[9*i+8]);
+        const Triangle_3 t(a,b,c);
+        const Vector u = t[1] - t[0];
+        const Vector v = t[2] - t[0];
+        Vector n = CGAL::cross_product(u,v);
+        n = n / std::sqrt(n*n);
+        m_surface_mc.push_back(Facet(t,n,values_list->item(value_id)));
+      }
+      nbs_of_mc_triangles[value_id]=m_surface_mc.size();
+      mc_timer.start();
+    }
+    mc_timer.stop();
+    not_busy();
+    mc_total_time = total_time.elapsed();
+
+    // invalidate the display list
+    lists_draw_surface_mc_is_valid = false;
+    list_draw_marching_cube_is_valid = false;
+  }
+  CGAL::Bbox_3 bbox(0,0,0,0,0,0);
+  for(std::vector<Facet>::const_iterator
+        it = m_surface_mc.begin(), end = m_surface_mc.end();
+      it != end; ++it)
+  {
+    bbox = bbox + it->get<0>().bbox();
+  }
+
+  m_view_mc = true;
+  m_view_surface = false;
+  Q_EMIT changed();
+  if(!m_surface_mc.empty())
+  {
+    Q_EMIT new_bounding_box(bbox.xmin(),
+                          bbox.ymin(),
+                          bbox.zmin(),
+                          bbox.xmax(),
+                          bbox.ymax(),
+                          bbox.zmax());
+  }
+  status_message(tr("Marching cubes done. %2 facets in %1s (CPU time), total time is %3s.")
+                 .arg(mc_timer.time())
+                 .arg(m_surface_mc.size())
+                 .arg(mc_total_time/1000.));
+
+  save_image_settings(fileinfo.absoluteFilePath());
+#endif // CGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE
+}
+
+void Volume::display_surface_mesher_result()
+{
+  if(m_surface.empty() || // Either the surface is not computed.
+     m_view_surface) // Or it is computed and displayed, and one want
+                     // to recompute it.
+  {
+    QTime total_time;
+    total_time.start();
+
+    values_list->save_values(fileinfo.absoluteFilePath());
+
+    std::size_t nx = m_image.xdim();
+    std::size_t ny = m_image.ydim();
+    std::size_t nz = m_image.zdim();
+    if(nx * ny * nz == 0)
+    {
+      status_message("No volume loaded.");
+      return;
+    }
+
+    m_surface.clear();
+    sm_timer.reset();
+    busy();
+
+    status_message("Surface meshing...");
+
+    sm_timer.start();
+
+    c2t3.clear();
+    del.clear();
+    Sphere bounding_sphere(m_image.center(),m_image.radius()*m_image.radius());
+
+    Classify_from_isovalue_list classify(values_list);
+    Generate_surface_identifiers generate_ids(values_list);
+
+    m_image.set_interpolation(mw->interpolationCheckBox->isChecked());
+    if(mw->labellizedRadioButton->isChecked()) {
+      std::cerr << "Labellized image\n";
+    }
+    m_image.set_labellized(mw->labellizedRadioButton->isChecked());
+    classify.set_identity(mw->labellizedRadioButton->isChecked());
+    generate_ids.set_labellized_image(mw->labellizedRadioButton->isChecked());
+
+    // definition of the surface
+    Surface_3 surface(m_image, bounding_sphere, m_relative_precision);
+//     Threshold threshold(m_image.isovalue());
+
+    // surface mesh traits class
+    typedef CGAL::Surface_mesher::Implicit_surface_oracle_3<Kernel,
+      //     typedef CGAL::Surface_mesher::Image_surface_oracle_3<Kernel,
+      Surface_3, 
+      Classify_from_isovalue_list,
+      Generate_surface_identifiers> Oracle;
+    Oracle oracle(classify, generate_ids);
+
+    if(mw->searchSeedsCheckBox->isChecked())
+    {
+      typedef std::vector<std::pair<Point, double> > Seeds;
+      Seeds seeds;
+      {
+	std::cerr << "Search seeds...\n";
+	std::set<unsigned char> domains;
+	search_for_connected_components(std::back_inserter(seeds),
+					CGAL::inserter(domains),
+					classify);
+	std::cerr << "Found " << seeds.size() << " seed(s).\n";
+
+	if(mw->labellizedRadioButton->isChecked() && 
+	   values_list->numberOfValues() == 0) 
+	{
+	  Q_FOREACH(unsigned char label, domains) {
+	    if(label != 0) {
+	      values_list->addValue(label);
+	    }
+	  }
+	}
+      }
+      std::ofstream seeds_out("seeds.off");
+      std::ofstream segments_out("segments.txt");
+      seeds_out.precision(18);
+      seeds_out << "OFF\n" << seeds.size() << " 0 0\n";
+      segments_out.precision(18);
+      for(Seeds::const_iterator it = seeds.begin(), end = seeds.end();
+	  it != end; ++it)
+      {
+        seeds_out << it->first << std::endl;
+	CGAL::Random_points_on_sphere_3<Point> random_points_on_sphere_3(it->second);
+	Oracle::Intersect_3 intersect = oracle.intersect_3_object();
+	for(int i = 0; i < 20; ++i)
+	{
+	  const Point test = it->first + (*random_points_on_sphere_3++ - CGAL::ORIGIN);
+	  CGAL::Object o = intersect(surface, Segment_3(it->first, test));
+	  if (const Point* intersection = CGAL::object_cast<Point>(&o)) {
+            segments_out << "2 " << it->first << " " << *intersection << std::endl;
+	    del.insert(*intersection);
+          }
+	  else 
+	  {
+	    std::cerr << 
+	      boost::format("Error. Segment (%1%, %2%) does not intersect the surface! values=(%3%, %4%)\n")
+	      % it->first % test
+	      % surface(it->first) % surface(test);
+	  }
+	}
+      }
+    }
+    else {
+      oracle.construct_initial_points_object()(surface, 
+					       CGAL::inserter(c2t3.triangulation()),
+					       20);
+    }
+
+    std::ofstream points_out("initial-points.off");
+    points_out.precision(18);
+    points_out << "OFF\n" << c2t3.triangulation().number_of_vertices() << " 0 0\n";
+    BOOST_FOREACH(const Tr::Vertex& v,
+                  std::make_pair(c2t3.triangulation().vertices_begin(),
+                                 c2t3.triangulation().vertices_end()))
+    {
+      points_out << v.point() << std::endl;
+    }
+
+    std::cerr << boost::format("Number of initial points: %1%\n") % del.number_of_vertices();
+
+    // defining meshing criteria
+    typedef CGAL::Surface_mesher::Refine_criterion<Tr> Criterion;
+    CGAL::Surface_mesher::Curvature_size_criterion<Tr>
+      curvature_size_criterion (m_sm_distance);
+    CGAL::Surface_mesher::Uniform_size_criterion<Tr>
+      uniform_size_criterion (m_sm_radius);
+    CGAL::Surface_mesher::Aspect_ratio_criterion<Tr>
+      aspect_ratio_criterion (m_sm_angle);
+    CGAL::Surface_mesher::Vertices_on_the_same_psc_element_criterion<Tr, Surface_3>
+      vertices_on_the_same_psc_element_criterion(surface);
+    
+    std::vector<Criterion*> criterion_vector;
+    criterion_vector.push_back(&aspect_ratio_criterion);
+    criterion_vector.push_back(&uniform_size_criterion);
+    criterion_vector.push_back(&curvature_size_criterion);
+    if(mw->sameIndexCheckBox->isChecked()) {
+      criterion_vector.push_back(&vertices_on_the_same_psc_element_criterion);
+      std::cerr << "vertices_on_the_same_psc_element_criterion is activated.\n";
+    }
+
+    typedef CGAL::Surface_mesher::Standard_criteria<Criterion> Criteria;
+    Criteria criteria(criterion_vector);
+    std::cerr << "Surface_mesher... angle=" << m_sm_angle << ", radius= " << m_sm_radius
+              << ", distance=" << m_sm_distance << "\n";
+
+    typedef CGAL::Surface_mesher_generator<C2t3,
+      Oracle,
+      Criteria,
+      CGAL::Manifold_tag,
+      CGAL_SURFACE_MESHER_VERBOSITY
+      >::type Surface_mesher_manifold;
+      
+    typedef CGAL::Surface_mesher_generator<C2t3,
+      Oracle,
+      Criteria,
+      CGAL::Non_manifold_tag,
+      CGAL_SURFACE_MESHER_VERBOSITY
+      >::type Surface_mesher_non_manifold; 
+
+    if(mw->manifoldCheckBox->isChecked()) {
+      // meshing surface
+      std::cerr << "manifold criteria is activated.\n";
+//       make_surface_mesh(c2t3, surface, oracle, criteria,
+// 			CGAL::Manifold_tag(), 0);
+      Surface_mesher_manifold manifold_mesher(c2t3, surface, oracle, criteria);
+      manifold_mesher.refine_mesh();
+    }
+    else {
+//       m_view_surface = true;
+      Surface_mesher_non_manifold non_manifold_mesher(c2t3, surface, oracle, criteria);
+#if 0
+      int nb_steps = 0;
+//       direct_draw = true;
+      non_manifold_mesher.init();
+      while(!non_manifold_mesher.is_algorithm_done()) {
+	CGAL::Null_mesh_visitor null_visitor;
+	non_manifold_mesher.one_step(null_visitor);
+	if(++nb_steps % 1000 == 0) {
+	  CGAL::Timer timer;
+	  std::cerr << "(process events...";
+	  timer.start();
+	  list_draw_marching_cube_is_valid = false;
+	  lists_draw_surface_is_valid = false;
+	  for(Tr::Finite_cells_iterator 
+		cit = del.finite_cells_begin(),
+		end = del.finite_cells_end();
+	      cit != end; ++cit)
+	  {
+	    cit->info() = classify(surface(cit->circumcenter()));
+	  }
+// 	  Q_EMIT changed();
+	  qApp->processEvents();
+	  timer.stop();
+	  std::cerr << timer.time() << " secondes)\n";
+	}
+      }
+#else
+      non_manifold_mesher.refine_mesh();
+#endif
+    }
+    sm_timer.stop();
+    not_busy();
+    direct_draw = false;
+
+    for(Tr::Finite_cells_iterator 
+	  cit = del.finite_cells_begin(),
+	  end = del.finite_cells_end();
+	cit != end; ++cit)
+    {
+      cit->info() = classify(surface(cit->circumcenter()));
+    }
+    // get output surface
+    for(C2t3::Facet_iterator
+          fit = c2t3.facets_begin(), end = c2t3.facets_end();
+        fit != end; ++fit)
+    {
+      const Tr::Cell_handle& cell = fit->first;
+      const int index = fit->second;
+
+      // here "left" means nothing
+      const Point left_circumcenter = cell->circumcenter();
+      const Point right_circumcenter = cell->neighbor(index)->circumcenter();
+
+      const Triangle_3 t = 
+        Triangle_3(cell->vertex(del.vertex_triple_index(index, 0))->point(),
+                   cell->vertex(del.vertex_triple_index(index, 1))->point(),
+                   cell->vertex(del.vertex_triple_index(index, 2))->point());
+      const Vector u = t[1] - t[0];
+      const Vector v = t[2] - t[0];
+      Vector n = CGAL::cross_product(u,v);
+      n = n / std::sqrt(n*n);
+      if(mw->labellizedRadioButton->isChecked()) 
+      {
+	m_surface.push_back(Facet(t,
+				  n,
+				  values_list->search((std::max)(surface(left_circumcenter), 
+								 surface(right_circumcenter)))));
+      }
+      else {
+	m_surface.push_back(Facet(t,n,cell->vertex(del.vertex_triple_index(index, 0))->point().element_index()));
+      }
+    }
+
+    // invalidate the display list
+    lists_draw_surface_is_valid = false;
+    sm_total_time = total_time.elapsed();
+  }
+
+  CGAL::Bbox_3 bbox(0,0,0,0,0,0);
+  for(std::vector<Facet>::const_iterator
+        it = m_surface.begin(), end = m_surface.end();
+      it != end; ++it)
+  {
+    bbox = bbox + it->get<0>().bbox();
+  }
+
+  // toggle visualization
+  m_view_mc = false;
+  m_view_surface = true;
+  Q_EMIT changed();
+  if(!m_surface.empty())
+  {
+    Q_EMIT new_bounding_box(bbox.xmin(),
+                          bbox.ymin(),
+                          bbox.zmin(),
+                          bbox.xmax(),
+                          bbox.ymax(),
+                          bbox.zmax());
+  }
+  status_message(tr("Surface meshing done. %1 facets in %2s (CPU time), total time is %3s.")
+                 .arg(m_surface.size())
+                 .arg(sm_timer.time())
+                 .arg(sm_total_time/1000.));
+  save_image_settings(fileinfo.absoluteFilePath());
+}
+
+void Volume::gl_draw_image_bbox(const float line_width,
+                               const unsigned char red,
+                               const unsigned char green,
+                               const unsigned char blue)
+{
+  const _image* image_ptr = m_image.image();
+  if(image_ptr == NULL)
+    return;
+
+  glLineWidth(line_width);
+  glColor3ub(red,green,blue);
+  glBegin(GL_LINES);
+
+  const double xmax = (image_ptr->xdim - 1.0)*(image_ptr->vx);
+  const double ymax = (image_ptr->ydim - 1.0)*(image_ptr->vy);
+  const double zmax = (image_ptr->zdim - 1.0)*(image_ptr->vz);
+
+  glVertex3d(0.0,0.0,0.0);
+  glVertex3d(0.0,ymax,0.0);
+
+  glVertex3d(0.0,ymax,0.0);
+  glVertex3d(0.0,ymax,zmax);
+
+  glVertex3d(0.0,ymax,zmax);
+  glVertex3d(0.0,0.0,zmax);
+
+  glVertex3d(0.0,0.0,zmax);
+  glVertex3d(0.0,0.0,0.0);
+
+  glVertex3d(xmax,0.0,0.0);
+  glVertex3d(xmax,ymax,0.0);
+
+  glVertex3d(xmax,ymax,0.0);
+  glVertex3d(xmax,ymax,zmax);
+
+  glVertex3d(xmax,ymax,zmax);
+  glVertex3d(xmax,0.0,zmax);
+
+  glVertex3d(xmax,0.0,zmax);
+  glVertex3d(xmax,0.0,0.0);
+
+  glVertex3d(0.0,0.0,0.0);
+  glVertex3d(xmax,0.0,0.0);
+
+  glVertex3d(0.0,0.0,zmax);
+  glVertex3d(xmax,0.0,zmax);
+
+  glVertex3d(0.0,ymax,zmax);
+  glVertex3d(xmax,ymax,zmax);
+
+  glVertex3d(0.0,ymax,0.0);
+  glVertex3d(xmax,ymax,0.0);
+
+  glEnd();
+}
+
+void Volume::draw()
+{
+  float	ambient[]  =   { 0.25f,
+                         0.20725f,
+                         0.20725f,
+                         0.922f };
+  float	diffuse[]  =   { 1.0f,
+                         0.829f,
+                         0.829f,
+                         0.922f };
+
+  float	specular[]  = {  0.296648f,
+                         0.296648f,
+                         0.296648f,
+                         0.522f };
+
+  float	emission[]  = {  0.3f,
+                         0.3f,
+                         0.3f,
+                         1.0f };
+  float shininess[] = {  11.264f };
+
+  // apply
+  ::glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT,   ambient);
+  ::glMaterialfv( GL_FRONT_AND_BACK, GL_DIFFUSE,   diffuse);
+  ::glMaterialfv( GL_FRONT_AND_BACK, GL_SPECULAR,  specular);
+  ::glMaterialfv( GL_FRONT_AND_BACK, GL_SHININESS, shininess);
+  ::glMaterialfv( GL_FRONT_AND_BACK, GL_EMISSION,  emission);
+
+  ::glEnable(GL_LINE_SMOOTH);
+
+  if(two_sides)
+    ::glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
+  else
+    ::glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE); // default
+
+  // draw surface mesh
+  if(m_view_surface)
+  {
+    ::glEnable(GL_LIGHTING);
+    ::glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
+    ::glColor3f(0.2f, 0.2f, 1.f);
+    ::glEnable(GL_POLYGON_OFFSET_FILL);
+    ::glPolygonOffset(3.0f,-3.0f);
+    gl_draw_surface();
+
+    if(draw_triangles_edges)
+    {
+      ::glDisable(GL_LIGHTING);
+      ::glLineWidth(1.);
+      ::glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
+      ::glColor3ub(0,0,0);
+      ::glDisable(GL_POLYGON_OFFSET_FILL);
+      gl_draw_surface();
+    }
+  }
+
+#ifdef CGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE
+  // draw MC surface mesh
+  if(m_view_mc)
+  {
+    ::glEnable(GL_LIGHTING);
+    ::glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
+    ::glColor3f(0.2f, 0.2f, 1.f);
+    ::glEnable(GL_POLYGON_OFFSET_FILL);
+    ::glPolygonOffset(3.0f,-3.0f);
+    gl_draw_surface_mc();
+
+    if(draw_triangles_edges)
+    {
+      ::glDisable(GL_LIGHTING);
+      ::glLineWidth(1.);
+      ::glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
+      ::glColor3ub(0,0,0);
+      ::glDisable(GL_POLYGON_OFFSET_FILL);
+      gl_draw_surface_mc();
+    }
+  }
+#endif // CGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE
+
+  if(show_bbox) {
+    ::glDisable(GL_LIGHTING);
+    gl_draw_image_bbox(3.0f,0,0,0);
+  }
+
+  if(!m_view_mc && m_draw_triangulation)
+  {
+    // draw the triangualtion
+    mw->viewer->qglColor(m_triangulation_color);
+    ::glLineWidth(1.0);
+    ::glBegin(GL_LINES);
+    for(Tr::Finite_edges_iterator 
+          eit = del.finite_edges_begin(), 
+          end = del.finite_edges_end();
+        eit != end; ++eit) 
+    {
+      const Point p1 = eit->first->vertex(eit->second)->point();
+      const Point p2 = eit->first->vertex(eit->third)->point();
+      ::glVertex3d(p1.x(),p1.y(),p1.z());
+      ::glVertex3d(p2.x(),p2.y(),p2.z());
+    }
+    ::glEnd();
+  }
+}
+
+void Volume::set_radius_bound(double d)
+{ 
+  m_sm_radius = FT(d);
+  changed_parameters();
+}
+
+void Volume::set_distance_bound(double d)
+{ 
+  m_sm_distance = FT(d);
+  changed_parameters();
+}
+
+#ifdef CGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE
+void Volume::gl_draw_surface_mc()
+{
+  if(use_gouraud)
+  {
+    gl_draw_marchingcube();
+    return;
+  }
+  
+  if(lists_draw_surface_mc_is_valid)
+  {
+    for(int i = 0, nbs = values_list->numberOfValues(); i < nbs; ++i )
+    {
+      if(values_list->enabled(i))
+      {
+        mw->viewer->qglColor(values_list->color(i));
+        ::glCallList(lists_draw_surface_mc[i]);
+      }
+    }
+  }
+  else
+  {
+    lists_draw_surface_mc.resize(values_list->numberOfValues(), 0);
+    for(int i = 0, nbs = values_list->numberOfValues(); i < nbs; ++i )
+    {
+      if(!lists_draw_surface_mc[i])
+      {
+        lists_draw_surface_mc[i] = ::glGenLists(1);
+      }
+
+      std::cerr << boost::format("(Re-)Generating list #%1% for marching cube surface #%2%"
+                                 " in gl_draw_surface(), ()\n")
+        % lists_draw_surface_mc[i]
+        % i;
+
+      mw->viewer->qglColor(values_list->color(i));
+
+      if(lists_draw_surface_mc[i])             // If
+        ::glNewList(lists_draw_surface_mc[i],  // lists_draw_surface[i]==0 then something
+                    values_list->enabled(i) // got wrong in the list generation.
+                    ? GL_COMPILE_AND_EXECUTE
+                    : GL_COMPILE);
+
+
+      gl_draw_surface(m_surface_mc.begin(),
+                      m_surface_mc.end(),
+                      values_list->item(i));
+        
+      if(lists_draw_surface_mc[i]) // If lists_draw_surface[i]==0 then
+      {                            // something got wrong in the list
+        ::glEndList();             // generation.
+      }
+    }
+    lists_draw_surface_mc_is_valid = (::glGetError() == GL_NO_ERROR);
+  }
+}
+#endif // CGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE
+
+void Volume::gl_draw_surface()
+{
+//   if(mw->labellizedRadioButton->isChecked()) {
+//     mw->viewer->qglColor(::Qt::blue);
+//     gl_draw_surface(m_surface.begin(),
+// 		    m_surface.end(),
+// 		    0);
+//   }
+//   else
+  if(direct_draw) {
+    ::glBegin(GL_TRIANGLES);
+    unsigned int counter = 0;
+    for(Tr::Finite_cells_iterator
+	  cit = del.finite_cells_begin(), end = del.finite_cells_end();
+	cit != end; ++cit)
+    {
+      for(int facet_index = 0; facet_index < 4; ++facet_index)
+      {
+	const Tr::Cell_handle& facet_cell = cit;
+	if(c2t3.face_status(facet_cell, facet_index) == C2t3::NOT_IN_COMPLEX) {
+	  continue;
+	}
+	const Point& a = facet_cell->vertex(del.vertex_triple_index(facet_index, 0))->point();
+	const Point& b = facet_cell->vertex(del.vertex_triple_index(facet_index, 1))->point();
+	const Point& c = facet_cell->vertex(del.vertex_triple_index(facet_index, 2))->point();
+	Vector n = CGAL::cross_product(b-a,c-a);
+	n = n / std::sqrt(n*n); // unit normal
+	if(m_inverse_normals) {
+	  ::glNormal3d(-n.x(),-n.y(),-n.z());
+	} else {
+	  ::glNormal3d(n.x(),n.y(),n.z());
+	}
+	mw->viewer->qglColor(values_list->color(values_list->search(facet_cell->info())));
+	::glVertex3d(a.x(),a.y(),a.z());
+	::glVertex3d(b.x(),b.y(),b.z());
+	::glVertex3d(c.x(),c.y(),c.z());
+	++counter;
+      }
+      ::glEnd();
+    }
+    return;
+  }
+  if(!direct_draw && lists_draw_surface_is_valid)
+  {
+    for(int i = 0, nbs = values_list->numberOfValues(); i < nbs; ++i )
+    {
+      if(values_list->enabled(i))
+      {
+        mw->viewer->qglColor(values_list->color(i));
+        ::glCallList(lists_draw_surface[i]);
+      }
+    }
+  }
+  else
+  {
+    lists_draw_surface.resize(values_list->numberOfValues(), 0);
+    for(int i = 0, nbs = values_list->numberOfValues(); i < nbs; ++i )
+    {
+      if(!lists_draw_surface[i])
+      {
+        lists_draw_surface[i] = ::glGenLists(1);
+      }
+
+      std::cerr << boost::format("(Re-)Generating list #%1% for surface #%2%"
+                                 " in gl_draw_surface(), ()\n")
+        % lists_draw_surface[i]
+        % i;
+        
+      mw->viewer->qglColor(values_list->color(i));
+
+      if(!direct_draw && lists_draw_surface[i]) // If
+        ::glNewList(lists_draw_surface[i],      // lists_draw_surface[i]==0
+                    values_list->enabled(i)     // then something got wrong
+                    ? GL_COMPILE_AND_EXECUTE    // in the list generation.
+                    : GL_COMPILE);
+
+      if(!mw->labellizedRadioButton->isChecked()) 
+      {
+	gl_draw_surface(m_surface.begin(),
+			m_surface.end(),
+			values_list->item(i));
+      }
+      else 
+      {
+	const unsigned char volume_index = values_list->value(i);
+
+	::glBegin(GL_TRIANGLES);
+	unsigned int counter = 0;
+	for(C2t3::Facet_iterator
+	      fit = c2t3.facets_begin(), end = c2t3.facets_end();
+	    fit != end; ++fit)
+	{
+	  Tr::Cell_handle facet_cell = fit->first;
+	  int facet_index = fit->second;
+	  Tr::Cell_handle opposite_cell = facet_cell->neighbor(facet_index);
+	  int opposite_index = opposite_cell->index(facet_cell);
+
+	  if( facet_cell->info() != volume_index ) {
+	    if( opposite_cell->info() == volume_index ) {
+	      std::swap(facet_cell, opposite_cell);
+	      std::swap(facet_index, opposite_index);
+	    }
+	    else 
+	      continue; // go to next facet
+	  }
+	  const Point& a = opposite_cell->vertex(del.vertex_triple_index(opposite_index, 0))->point();
+	  const Point& b = opposite_cell->vertex(del.vertex_triple_index(opposite_index, 1))->point();
+	  const Point& c = opposite_cell->vertex(del.vertex_triple_index(opposite_index, 2))->point();
+	  Vector n = CGAL::cross_product(b-a,c-a);
+	  n = n / std::sqrt(n*n); // unit normal
+	  if(m_inverse_normals) {
+	    ::glNormal3d(-n.x(),-n.y(),-n.z());
+	  } else {
+	    ::glNormal3d(n.x(),n.y(),n.z());
+	  }
+	  ::glVertex3d(a.x(),a.y(),a.z());
+	  ::glVertex3d(b.x(),b.y(),b.z());
+	  ::glVertex3d(c.x(),c.y(),c.z());
+	  ++counter;
+	}
+	::glEnd();
+	std::cerr << boost::format("(c2t3) number of facets: %1%\n")
+	  % counter;
+      }
+
+      if(!direct_draw && lists_draw_surface[i])
+	                        // If lists_draw_surface[i]==0 then
+      {                         // something got wrong in the list
+        ::glEndList();          // generation.
+      }
+    }
+    lists_draw_surface_is_valid = (::glGetError() == GL_NO_ERROR);
+  }
+}
+
+template <typename Iterator>
+void Volume::gl_draw_surface(Iterator begin, Iterator end, const QTreeWidgetItem* i)
+{
+  ::glBegin(GL_TRIANGLES);
+  unsigned int counter = 0;
+  for(Iterator it = begin; it != end; ++it)
+  {
+    const Facet& f = *it;
+
+    if(f.get<2>() != i) continue;
+
+    const Vector& n = f.get<1>();
+
+    if(m_inverse_normals)
+      ::glNormal3d(-n.x(),-n.y(),-n.z());
+    else
+      ::glNormal3d(n.x(),n.y(),n.z());
+
+    const Triangle_3& t = f.get<0>();
+    const Point& a = t[0];
+    const Point& b = t[1];
+    const Point& c = t[2];
+
+    ::glVertex3d(a.x(),a.y(),a.z());
+    ::glVertex3d(b.x(),b.y(),b.z());
+    ::glVertex3d(c.x(),c.y(),c.z());
+    ++counter;
+  }
+  ::glEnd();
+  std::cerr << boost::format("number of facets: %1%\n")
+    % counter;
+}
+
+void Volume::changed_parameters()
+{
+  m_surface.clear();
+#ifdef CGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE
+  m_surface_mc.clear();
+#endif
+  list_draw_marching_cube_is_valid = false;
+  lists_draw_surface_is_valid = false;
+  c2t3.clear();
+  del.clear();
+  m_view_mc = m_view_surface = false;
+  Q_EMIT changed();
+}
+
+#ifdef CGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE
+void Volume::gl_draw_one_marching_cube_vertex(int i)
+{
+  if(!m_inverse_normals)
+    glArrayElement(i);
+  else
+  {
+    const Vertex* const vertex = mc.vert(i);
+    ::glNormal3d(-vertex->nx, -vertex->ny, -vertex->nz);
+    ::glVertex3d(vertex->x, vertex->y, vertex->z);
+  }
+}
+
+void Volume::gl_draw_marchingcube()
+{
+  if(list_draw_marching_cube_is_valid)
+    ::glCallList(list_draw_marching_cube);
+  else
+  {
+    if(!list_draw_marching_cube)
+      list_draw_marching_cube = ::glGenLists(1);
+    std::cerr << boost::format("(Re-)Generating list #%1% for"
+                               " gl_draw_marchingcube()\n")
+      % list_draw_marching_cube;
+
+    if(list_draw_marching_cube)          // If list_draw_marching_cube==0 then
+    ::glNewList(list_draw_marching_cube, // something got wrong in the list
+                GL_COMPILE_AND_EXECUTE); // generation.
+
+    ::glVertexPointer(3, GL_DOUBLE, sizeof(Vertex), mc.vertices());
+    ::glNormalPointer(GL_DOUBLE, sizeof(Vertex), &(mc.vertices()->nx));
+    ::glEnableClientState(GL_VERTEX_ARRAY);
+
+    // because of that conditionnal, the display list has to be
+    // reconstructed each time m_inverse_normals is toggled.
+    if(!m_inverse_normals)
+      ::glEnableClientState(GL_NORMAL_ARRAY);
+
+    for(int i = 0, nbs = values_list->numberOfValues(); i < nbs; ++i)
+    {
+      const int begin = i == 0 ? 0 : nbs_of_mc_triangles[i-1];
+      const int end = nbs_of_mc_triangles[i];
+      mw->viewer->qglColor(values_list->color(i));
+      ::glBegin(GL_TRIANGLES);
+      for(int i = begin; i < end; ++i)
+      {
+        const MC_Triangle* const trig = mc.trig(i);
+        gl_draw_one_marching_cube_vertex(trig->v1);
+        gl_draw_one_marching_cube_vertex(trig->v2);
+        gl_draw_one_marching_cube_vertex(trig->v3);
+      }
+      ::glEnd();
+    }
+    if(list_draw_marching_cube > 0) // If list_draw_marching_cube==0 then
+    {                               // something got wrong in the list
+      ::glEndList();                // generation.
+      list_draw_marching_cube_is_valid = (::glGetError() == GL_NO_ERROR);
+    }
+    if(!list_draw_marching_cube_is_valid)
+    {
+     CGAL::Qt::opengl_check_errors();
+    }
+  }
+}
+#endif // CGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE
+
+void Volume::save_image_settings(QString filename)
+{
+  QSettings settings;
+  settings.beginGroup(QUrl::toPercentEncoding(filename));
+  settings.setValue("labellized", mw->labellizedRadioButton->isChecked());
+  settings.endGroup();
+}
+
+void Volume::load_image_settings(QString filename)
+{
+  QSettings settings;
+  settings.beginGroup(QUrl::toPercentEncoding(filename));
+  mw->labellizedRadioButton->setChecked(settings.value("labellized").toBool());
+  settings.endGroup();
+}
+
+void Volume::labellizedToogled(bool toggled)
+{
+  if(toggled) {
+    values_list->setHeaderTitle(tr("Label"));
+  }
+  else {
+    values_list->setHeaderTitle(tr("Iso-Value"));
+  }
+}
+
diff --git a/3rdparty/CGAL/demo/Surface_mesher/volume.h b/3rdparty/CGAL/demo/Surface_mesher/volume.h
new file mode 100644
index 0000000..408cb6d
--- /dev/null
+++ b/3rdparty/CGAL/demo/Surface_mesher/volume.h
@@ -0,0 +1,388 @@
+#ifndef _VOLUME_H
+#define _VOLUME_H
+
+#include <CGAL/basic.h>
+#include <CGAL/Object.h>
+#include <CGAL/Timer.h>
+
+
+#include "surface.h"
+#include "binary_image.h"
+
+#include <boost/multi_array.hpp>
+#include <boost/tuple/tuple.hpp>
+#include <boost/tuple/tuple_comparison.hpp>
+#include <boost/format.hpp>
+
+#include <queue>
+#include <vector>
+#include <iterator> // std::back_inserter
+
+#include <QString>
+#include <QFileInfo>
+
+#ifdef CGAL_USE_VTK
+class vtkImageReader;
+class vtkImageData;
+class vtkDICOMImageReader;
+class vtkDemandDrivenPipeline;
+class vtkImageGaussianSmooth;
+#endif // CGAL_USE_VTK
+
+class QTreeWidgetItem;
+
+// kernel
+// #include <CGAL/Simple_cartesian.h>
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel1;
+
+#include <CGAL/Point_with_psc_localisation.h>
+struct Kernel : public Kernel1 {
+  typedef CGAL::Point_with_psc_localisation<Kernel::Point_3,
+                                            const QTreeWidgetItem*> Point_3;
+};
+
+typedef Kernel::FT FT;
+typedef Kernel::Point_3 Point;
+typedef Kernel::Sphere_3 Sphere;
+typedef Kernel::Vector_3 Vector;
+typedef Kernel::Triangle_3 Triangle_3;
+typedef Kernel::Segment_3 Segment_3;
+
+// typedef CGAL::Triple<Triangle_3,Vector,const QTreeWidgetItem*> Facet;
+
+typedef boost::tuple<Triangle_3,Vector,const QTreeWidgetItem*> Facet;
+
+typedef CBinary_image_3<FT,Point> Binary_image;
+
+class QTreeWidgetItem;
+
+// surface mesher
+// #define CGAL_MESHES_NO_OUTPUT
+#include <CGAL/Surface_mesh_vertex_base_3.h>
+#include <CGAL/Triangulation_cell_base_with_info_3.h>
+#include <CGAL/Surface_mesh_cell_base_3.h>
+#include <CGAL/Delaunay_triangulation_cell_base_with_circumcenter_3.h>
+#include <CGAL/Delaunay_triangulation_3.h>
+#include <CGAL/Surface_mesh_complex_2_in_triangulation_3.h>
+#include <CGAL/Surface_mesh_default_criteria_3.h>
+#include <CGAL/Implicit_surface_3.h>
+#include <CGAL/Surface_mesh_traits_generator_3.h>
+typedef CGAL::Surface_mesh_vertex_base_3<Kernel> Vb;
+typedef CGAL::Triangulation_cell_base_with_info_3<unsigned char, Kernel> Cb1;
+typedef CGAL::Surface_mesh_cell_base_3<Kernel, Cb1> Cb2;
+typedef CGAL::Delaunay_triangulation_cell_base_with_circumcenter_3<Kernel, Cb2> Cb;
+typedef CGAL::Triangulation_data_structure_3<Vb, Cb> Tds;
+typedef CGAL::Delaunay_triangulation_3<Kernel, Tds> Tr;
+typedef CGAL::Surface_mesh_complex_2_in_triangulation_3<Tr> C2t3;
+typedef CGAL::Implicit_surface_3<Kernel, Binary_image> Surface_3;
+
+#ifdef CGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE
+#include <mc/MarchingCubes.h>
+#endif
+
+class MainWindow;
+class QDoubleSpinBox;
+class Viewer;
+class Values_list;
+
+class Volume : public Surface
+{
+  Q_OBJECT
+public:
+  Volume(MainWindow* mw);
+  ~Volume();
+
+private:
+  Binary_image m_image;
+
+  // options
+  FT m_sm_angle;
+  FT m_sm_radius;
+  FT m_sm_distance;
+  double m_relative_precision;
+
+  // visualization
+  bool m_view_surface;
+  bool m_draw_triangulation;
+  QColor m_triangulation_color;
+  bool m_inverse_normals;
+  bool two_sides;
+  bool draw_triangles_edges;
+  bool use_gouraud;
+  bool show_bbox;
+
+  std::vector<Facet> m_surface;
+  Tr del;            // 3D-Delaunay triangulation
+  C2t3 c2t3;         // 2D complex in 3D triangulation
+
+  MainWindow* mw;
+  QFileInfo fileinfo;
+  Values_list* values_list;
+  QDoubleSpinBox* spinBox_radius_bound;
+  QDoubleSpinBox* spinBox_distance_bound;
+
+  bool direct_draw; // do not use display lists
+  std::vector<GLint> lists_draw_surface;
+  bool lists_draw_surface_is_valid;
+  GLint list_draw_marching_cube;
+  bool list_draw_marching_cube_is_valid;
+
+  CGAL::Timer sm_timer;
+  int sm_total_time;
+
+#ifdef CGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE
+  std::vector<Facet> m_surface_mc;
+  MarchingCubes<unsigned char> mc ;
+  std::vector<int> nbs_of_mc_triangles;
+  std::vector<GLint> lists_draw_surface_mc;
+  bool lists_draw_surface_mc_is_valid;
+  CGAL::Timer mc_timer;
+  int mc_total_time;
+public:
+  void gl_draw_surface_mc();
+  void gl_draw_marchingcube();
+private:
+  void gl_draw_one_marching_cube_vertex(int);
+
+#endif // CGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE
+
+  bool m_view_mc; // that boolean is here even with if
+		  // CGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE
+                  // is not defined.
+
+#ifdef CGAL_USE_VTK
+  vtkImageReader* vtk_reader;
+  vtkImageData* vtk_image;
+  vtkDICOMImageReader* dicom_reader;
+  vtkDemandDrivenPipeline* executive;
+  vtkImageGaussianSmooth* smoother;
+#endif // CGAL_USE_VTK
+
+public Q_SLOTS:
+void display_marchin_cube();
+
+private:
+  template <typename Iterator>
+  void gl_draw_surface(Iterator begin, Iterator end, const QTreeWidgetItem* = 0);
+  void gl_draw_image_bbox(const float line_width,
+                          const unsigned char red,
+                          const unsigned char green,
+                          const unsigned char blue);
+
+  template <typename PointsOutputIterator,
+	    typename DomainsOutputIterator,
+	    typename TransformOperator>
+  void search_for_connected_components(PointsOutputIterator,
+				       DomainsOutputIterator, 
+				       TransformOperator);
+
+public:
+  void gl_draw_surface();
+
+Q_SIGNALS:
+
+  void new_bounding_box(double, double, double, double, double, double);
+
+public Q_SLOTS:
+  void only_in();
+  void set_inverse_normals(const bool);
+  void set_two_sides(const bool);
+  void set_draw_triangles_edges(const bool);
+  void set_triangulation_edges_color();
+  void set_draw_triangulation(const bool);
+  void set_use_gouraud(const bool);
+  void set_show_bbox(const bool);
+  bool open(const QString& filename);
+#ifdef CGAL_USE_VTK
+  bool open_vtk(const QString& filename);
+#endif
+  bool open_xt(const QString& filename);
+  bool opendir(const QString& dirname);
+  void finish_open();
+  void export_off();
+  void save_image_to_inr();
+  void check_can_export_off();
+  void draw();
+  void get_bbox(float& /*xmin*/, float& /*ymin*/, float& /*zmin*/,
+		float& /*xmax*/, float& /*ymax*/, float& /*zmax*/) {}
+  void close() {}
+  void display_surface_mesher_result();
+  void set_radius_bound(double);
+  void set_distance_bound(double);
+  void changed_parameters();
+
+  void labellizedToogled(bool);
+
+  void save_image_settings(QString);
+  void load_image_settings(QString);
+private:
+  void status_message(QString);
+  void busy() const;
+  void not_busy() const;
+};
+
+template <typename PointsOutputIterator,
+	  typename DomainsOutputIterator,
+	  typename TransformOperator>
+void Volume::search_for_connected_components(PointsOutputIterator it,
+					     DomainsOutputIterator dom_it,
+					     TransformOperator transform)
+{
+  const std::size_t nx = m_image.xdim();
+  const std::size_t ny = m_image.ydim();
+  const std::size_t nz = m_image.zdim();
+
+  const double max_v = (std::max)((std::max)(m_image.vx(),
+                                             m_image.vy()),
+                                  m_image.vz());
+
+  typedef unsigned char Marker;
+  typedef typename TransformOperator::result_type Label;
+
+  boost::multi_array<Marker, 3> visited(boost::extents[nx][ny][nz]);
+  typedef boost::tuple<std::size_t, std::size_t, std::size_t, std::size_t>
+                                Indices;
+  typedef std::queue<Indices>   Indices_queue;
+  typedef std::vector<Indices>  Border_vector;
+
+  int number_of_connected_components = 0;
+  for(std::size_t i=0; i<nx; i++)
+    for(std::size_t j=0; j<ny; j++)
+      for(std::size_t k=0; k<nz; k++)
+      {
+        if(visited[i][j][k]>0)
+          continue;
+        const Label current_label = transform(m_image.value(i, j, k));
+	*dom_it++ = current_label;
+        if(current_label == Label()) {
+          visited[i][j][k] = 3;
+          continue;
+        }
+
+        // if we reach here, (i, j, k) is a new connected component
+        ++number_of_connected_components;
+        std::cerr << boost::format("Found new connected component (#%5%) "
+                                   "at voxel (%1%, %2%, %3%), value=%4%, volume id=%6%\n")
+          % i % j % k
+          % m_image.value(i, j, k) 
+          % number_of_connected_components
+          % (int)current_label;
+
+        int nb_voxels = 0;
+
+        Indices_queue queue;
+        Indices indices(i, j ,k, 0);
+        queue.push(indices);
+
+        Border_vector border;
+
+        /*
+         * First pass is a BFS to retrieve all the connected component, and
+         * its border.
+         * Second pass is a BFS initialized with all voxel of the border.
+         * The last voxel of that BFS is used as the seed.
+         */
+        int pass = 1; // pass will be equal to 2 in second pass
+
+        Indices bbox_min = indices;
+        Indices bbox_max = indices;
+
+        while(!queue.empty()) // walk through the connected component
+        {
+          Indices indices = queue.front();
+          queue.pop();
+
+          // warning: those indices i, j and k are local to the while loop
+          const std::size_t i = boost::get<0>(indices);
+          const std::size_t j = boost::get<1>(indices);
+          const std::size_t k = boost::get<2>(indices);
+          const std::size_t depth = boost::get<3>(indices);
+
+          if(visited[i][j][k] < pass)
+          {
+            visited[i][j][k] = pass;
+            if(pass == 1 )
+            {
+              ++nb_voxels;
+              boost::get<0>(bbox_min) = (std::min)(i, boost::get<0>(bbox_min));
+              boost::get<0>(bbox_max) = (std::max)(i, boost::get<0>(bbox_max));
+              boost::get<1>(bbox_min) = (std::min)(j, boost::get<1>(bbox_min));
+              boost::get<1>(bbox_max) = (std::max)(j, boost::get<1>(bbox_max));
+              boost::get<2>(bbox_min) = (std::min)(k, boost::get<2>(bbox_min));
+              boost::get<2>(bbox_max) = (std::max)(k, boost::get<2>(bbox_max));
+            }
+
+            static const int neighbors_offset[6][3] = { { +1,  0,  0 },
+                                                        { -1,  0,  0 },
+                                                        {  0, +1,  0 },
+                                                        {  0, -1,  0 },
+                                                        {  0,  0, +1 },
+                                                        {  0,  0, -1 } };
+            bool voxel_is_on_border = false;
+
+            // Visit neighbors.
+            // (i_n, j_n, k_n) are indices of neighbors.
+            for(int n = 0; n < 6; ++n)
+            {
+              const ptrdiff_t i_n = i + neighbors_offset[n][0];
+              const ptrdiff_t j_n = j + neighbors_offset[n][1];
+              const ptrdiff_t k_n = k + neighbors_offset[n][2];
+              if(i_n < 0 || i_n >= static_cast<ptrdiff_t>(nx) ||
+                 j_n < 0 || j_n >= static_cast<ptrdiff_t>(ny) ||
+                 k_n < 0 || k_n >= static_cast<ptrdiff_t>(nz))
+              {
+                voxel_is_on_border = true;
+                continue;
+              }
+              else
+              {
+                if(transform(m_image.value(i_n, j_n, k_n)) == current_label)
+                {
+                  if(visited[i_n][j_n][k_n] < pass) {
+                    Indices indices(i_n, j_n, k_n, depth+1);
+                    queue.push(indices);
+                  }
+                }
+                else
+                  voxel_is_on_border = true;
+              }
+            } // end for neighbors
+
+            if(pass == 1 && voxel_is_on_border)
+              border.push_back(indices);
+          } // end if voxel not already visited
+
+          if(queue.empty()) {
+            if(pass == 1)
+            { // End of first pass. Begin second pass with the voxels of
+              // the border.
+              for(typename Border_vector::const_iterator
+                    border_it = border.begin(), border_end = border.end();
+                  border_it != border_end; ++border_it)
+                queue.push(*border_it);
+              pass = 2;
+            }
+            else // end of second pass, return the last visited voxel
+            {
+// 	      if(nb_voxels >= 100)
+	      {
+		*it++ = std::make_pair(m_image.point(i, j, k), (depth+1)*max_v);
+		std::cerr << boost::format("Found seed %5%, which is voxel (%1%, %2%, %3%), value=%4%\n")
+		  % i % j % k %  m_image.value(i, j, k) % m_image.point(i, j, k);
+	      }
+            }
+          } // end if queue.empty()
+        } // end while !queue.empty() (with local indices i, j, k)
+
+        std::cerr << boost::format("There was %1% voxel(s) in that component.\n"
+                                   "The bounding box is (%2% %3% %4%, %5% %6% %7%).\n"
+                                   "%8% voxel(s) on border\n")
+          % nb_voxels
+          % boost::get<0>(bbox_min) % boost::get<1>(bbox_min) % boost::get<2>(bbox_min)
+          % boost::get<0>(bbox_max) % boost::get<1>(bbox_max) % boost::get<2>(bbox_max)
+          % border.size();
+      } // end for i,j,k
+} // end function Volume::search_for_connected_components()
+
+#endif // _VOLUME_H
diff --git a/3rdparty/CGAL-4.8/demo/Three/CMakeLists.txt b/3rdparty/CGAL/demo/Three/CMakeLists.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Three/CMakeLists.txt
rename to 3rdparty/CGAL/demo/Three/CMakeLists.txt
diff --git a/3rdparty/CGAL/demo/Three/Example_plugin/Basic_dialog_plugin.ui b/3rdparty/CGAL/demo/Three/Example_plugin/Basic_dialog_plugin.ui
new file mode 100644
index 0000000..8033909
--- /dev/null
+++ b/3rdparty/CGAL/demo/Three/Example_plugin/Basic_dialog_plugin.ui
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>BasicDialog</class>
+ <widget class="QDialog" name="BasicDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Dialog</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout_2">
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout">
+     <item>
+      <widget class="QLabel" name="label">
+       <property name="text">
+        <string>Number to display :</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer name="horizontalSpacer">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QLineEdit" name="lineEdit"/>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>BasicDialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>248</x>
+     <y>254</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>BasicDialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>316</x>
+     <y>260</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/3rdparty/CGAL/demo/Three/Example_plugin/Basic_dock_widget.ui b/3rdparty/CGAL/demo/Three/Example_plugin/Basic_dock_widget.ui
new file mode 100644
index 0000000..2f78fe3
--- /dev/null
+++ b/3rdparty/CGAL/demo/Three/Example_plugin/Basic_dock_widget.ui
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>BasicDockWidget</class>
+ <widget class="QDockWidget" name="BasicDockWidget">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>392</width>
+    <height>302</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>DockWidget</string>
+  </property>
+  <widget class="QWidget" name="dockWidgetContents">
+   <layout class="QHBoxLayout" name="horizontalLayout_2">
+    <item>
+     <layout class="QVBoxLayout" name="verticalLayout">
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout">
+        <item>
+         <widget class="QLabel" name="label">
+          <property name="text">
+           <string>Number to display :</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <spacer name="horizontalSpacer">
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
+          </property>
+          <property name="sizeHint" stdset="0">
+           <size>
+            <width>40</width>
+            <height>20</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+        <item>
+         <widget class="QSpinBox" name="spinBox"/>
+        </item>
+       </layout>
+      </item>
+      <item>
+       <widget class="QPushButton" name="pushButton">
+        <property name="text">
+         <string>Print</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/3rdparty/CGAL/demo/Three/Example_plugin/Basic_item_plugin.cpp b/3rdparty/CGAL/demo/Three/Example_plugin/Basic_item_plugin.cpp
new file mode 100644
index 0000000..542a74f
--- /dev/null
+++ b/3rdparty/CGAL/demo/Three/Example_plugin/Basic_item_plugin.cpp
@@ -0,0 +1,91 @@
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+#include <QApplication>
+#include <QObject>
+#include <QAction>
+#include <QMainWindow>
+#include <QInputDialog>
+#include "Messages_interface.h"
+#include "CGAL/Three/Scene_group_item.h"
+#include "Scene_plane_item.h"
+
+//This plugin crates an action in Operations that displays "Hello World" in the 'console' dockwidet.
+class BasicItemPlugin :
+    public QObject,
+    public CGAL::Three::Polyhedron_demo_plugin_interface
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+public:
+  //! [applicable]
+  //This plugin is only applicable if there is exactly one selected item.
+  bool applicable(QAction*) const
+  {
+    return scene->selectionIndices().size() ==1;
+  }
+  //! [applicable]
+  //the list of the actions of the plugin.
+  QList<QAction*> actions() const
+  {
+    return _actions;
+  }
+  //this acts like a constructor for the plugin. It gets the references to the mainwindow and the scene, and connects the action.
+  void init(QMainWindow* mw, CGAL::Three::Scene_interface* sc, Messages_interface* mi)
+  {
+    //gets the reference to the message interface, to display text in the console widget
+    this->messageInterface = mi;
+    //get the references
+    this->scene = sc;
+    this->mw = mainWindow;
+
+    //creates the action
+    QAction *actionHelloWorld= new QAction(QString("Hello World"), mw);
+    //specifies the subMenu
+    actionHelloWorld->setProperty("submenuName", "Basic");
+    //links the action
+    if(actionHelloWorld) {
+      connect(actionHelloWorld, SIGNAL(triggered()),
+              this, SLOT(helloWorld()));
+      _actions << actionHelloWorld;
+    }
+  }
+private Q_SLOTS:
+
+
+  void helloWorld()
+  { //! [use]
+    //get a reference to the selected item.
+    CGAL::Three::Scene_item *item = scene->item(scene->mainSelectionIndex());
+    messageInterface->information(QString("The selected item's name is  : %1").arg(item->name()));
+    //! [use]
+    //! [additem]
+    //creates a plane item
+    Scene_plane_item *new_item = new Scene_plane_item(scene);
+    new_item->setName("Trivial Plane");
+    new_item->setColor(Qt::blue);
+    new_item->setNormal(0.0,0.0,1.0);
+    scene->addItem(new_item);
+    //! [additem]
+    //! [group]
+    //clears the selection to avoid adding unwanted items to the group.
+    scene->setSelectedItem(-1);
+    //Creates a new group
+    Scene_group_item *group = new Scene_group_item("New group");
+    //Then gives it its children
+    scene->changeGroup(item, group);
+    scene->changeGroup(new_item,group);
+    //adds it to the scene
+    scene->addGroup(group);
+    //! [group]
+  }
+
+private:
+  QList<QAction*> _actions;
+  Messages_interface* messageInterface;
+  //The reference to the scene
+  CGAL::Three::Scene_interface* scene;
+  //The reference to the main window
+  QMainWindow* mw;
+};
+
+#include "Basic_item_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Three/Example_plugin/Basic_plugin.cpp b/3rdparty/CGAL/demo/Three/Example_plugin/Basic_plugin.cpp
new file mode 100644
index 0000000..e649152
--- /dev/null
+++ b/3rdparty/CGAL/demo/Three/Example_plugin/Basic_plugin.cpp
@@ -0,0 +1,141 @@
+/*
+Change the value of EXAMPLE_COMPLEXITY in the first line to change the behavior :
+  - 0 : prints "Hello World!" in the Info and console widgets
+  - 1 : pops-up a simple dialog asking to enter an integer , then prints it in the Info and console widgets
+  - 2 : pops-up a little more elaborated dialog asking to enter an integer , then prints it in the Info and console widgets if it was indeed an integer, else pops-up an error message box.
+  */
+#define EXAMPLE_COMPLEXITY 2
+#include "ui_Basic_dialog_plugin.h"
+//! [headers_plugin]
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+#include <QApplication>
+#include <QObject>
+#include <QAction>
+#include <QMainWindow>
+#include <QInputDialog>
+#include <QMessageBox>
+#include "Messages_interface.h"
+//! [headers_plugin]
+//! [dialog_plugin]
+class ComplexDialog :
+    public QDialog,
+    public Ui::BasicDialog
+{
+  Q_OBJECT
+public:
+  ComplexDialog(QWidget* =0)
+  {
+    setupUi(this);
+
+  }
+
+};
+//! [dialog_plugin]
+//! [opening_plugin]
+
+//This plugin crates an action in Operations that displays "Hello World" in the 'console' dockwidet.
+class BasicPlugin :
+    public QObject,
+    public CGAL::Three::Polyhedron_demo_plugin_interface
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+public:
+  //decides if the plugin's actions will be displayed or not.
+  bool applicable(QAction*) const
+  {
+    return true;
+  }
+  //the list of the actions of the plugin.
+  QList<QAction*> actions() const
+  {
+    return _actions;
+  }
+  //this acts like a constructor for the plugin. It gets the references to the mainwindow and the scene, and connects the action.
+  void init(QMainWindow* mw, CGAL::Three::Scene_interface* sc, Messages_interface* mi)
+  {
+    //gets the reference to the message interface, to display text in the console widget
+    this->messageInterface = mi;
+    //get the references
+    this->scene = sc;
+    this->mw = mainWindow;
+
+    //creates the action
+    QAction *actionHelloWorld= new QAction(QString("Hello World"), mw);
+    //specifies the subMenu
+    actionHelloWorld->setProperty("submenuName", "Basic");
+    //links the action
+    if(actionHelloWorld) {
+      connect(actionHelloWorld, SIGNAL(triggered()),
+              this, SLOT(helloWorld()));
+      _actions << actionHelloWorld;
+    }
+  }
+private Q_SLOTS:
+
+  //! [opening_plugin]
+#if EXAMPLE_COMPLEXITY == 0
+  //! [basic_plugin]
+  void helloWorld()
+  {
+    messageInterface->information(QString("Hello World!"));
+  }
+  //! [basic_plugin]
+#elif EXAMPLE_COMPLEXITY == 1
+  //! [basic_dialog_plugin]
+  void helloWorld()
+  {
+    bool ok = false;
+    const unsigned int parameter =
+        QInputDialog::getInt((QWidget*)mw,
+                             tr("Hello World"), // dialog title
+                             tr("Hello dear user! What integer would you want me to display for you ? "), // field label
+                             10, // default value = fast
+                             0, // min
+                             100, // max
+                             1, // step
+                             &ok);
+    if(!ok) return;
+    messageInterface->information(QString("You asked me to display %1, so here it is : %1").arg(parameter));
+  }
+  //! [basic_dialog_plugin]
+#elif EXAMPLE_COMPLEXITY == 2
+  //! [complex_dialog_plugin]
+  void helloWorld()
+  {
+    //creates a new dialog
+    ComplexDialog *dialog = new ComplexDialog();
+    //opens the dialog
+    if(!dialog->exec())
+      return;
+    //! [warningbox]
+    QString result = dialog->lineEdit->text();
+    bool ok = false;
+    int int_res = result.toInt(&ok);
+    if(!ok)
+    {
+      QMessageBox::warning(mw,
+                           "ERROR",
+                           tr("This is not an integer !")
+                           );
+      return;
+    }
+    //! [warningbox]
+    messageInterface->information(QString("You asked me to display %1, so here it is : %1").arg(int_res));
+  }
+  //! [complex_dialog_plugin]
+#endif
+  //! [ending_plugin]
+private:
+  QList<QAction*> _actions;
+  Messages_interface* messageInterface;
+  //The reference to the scene
+  CGAL::Three::Scene_interface* scene;
+  //The reference to the main window
+  QMainWindow* mw;
+};
+
+#include "Basic_plugin.moc"
+//! [ending_plugin]
+
diff --git a/3rdparty/CGAL/demo/Three/Example_plugin/CMakeLists.txt b/3rdparty/CGAL/demo/Three/Example_plugin/CMakeLists.txt
new file mode 100644
index 0000000..23a0c6a
--- /dev/null
+++ b/3rdparty/CGAL/demo/Three/Example_plugin/CMakeLists.txt
@@ -0,0 +1,48 @@
+project( Example_plugin )
+# Find includes in corresponding build directories
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+# Instruct CMake to run moc automatically when needed.
+set(CMAKE_AUTOMOC ON)
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+# Compatibility with CMake 3.0
+if(POLICY CMP0042)
+  # Do not enable the use of MACOSX_RPATH
+  # http://www.cmake.org/cmake/help/v3.0/policy/CMP0042.html
+  cmake_policy(SET CMP0042 OLD)
+endif()
+#Find CGAL
+find_package(CGAL COMPONENTS Qt5)
+include( ${CGAL_USE_FILE} )
+# Find Qt5 itself
+find_package(Qt5
+             QUIET
+             COMPONENTS            OpenGL Script Svg Xml
+             OPTIONAL_COMPONENTS   ScriptTools)
+             
+if(Qt5_FOUND AND CGAL_FOUND)  
+  find_package(CGAL_polyhedron_demo)
+
+include( ${CGAL_POLYHEDRON_DEMO_USE_FILE} )
+
+# Let plugins be compiled in the same directory as the executable.
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
+           
+
+  polyhedron_demo_plugin(example_plugin Example_plugin)
+  
+  qt5_wrap_ui( basicUI_FILES Basic_dialog_plugin.ui  )
+  polyhedron_demo_plugin(basic_plugin Basic_plugin ${basicUI_FILES})
+
+  qt5_wrap_ui( dockUI_FILES Basic_dock_widget.ui )
+  polyhedron_demo_plugin(dock_widget_plugin Dock_widget_plugin ${dockUI_FILES})
+
+  polyhedron_demo_plugin(basic_item_plugin Basic_item_plugin)
+
+#  links the library containing the scene_plane_item with the plugin
+  target_link_libraries(basic_item_plugin Polyhedron_scene_basic_objects)
+
+endif()
diff --git a/3rdparty/CGAL/demo/Three/Example_plugin/Dock_widget_plugin.cpp b/3rdparty/CGAL/demo/Three/Example_plugin/Dock_widget_plugin.cpp
new file mode 100644
index 0000000..43af4a4
--- /dev/null
+++ b/3rdparty/CGAL/demo/Three/Example_plugin/Dock_widget_plugin.cpp
@@ -0,0 +1,102 @@
+#include "ui_Basic_dock_widget.h"
+#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
+#include <QApplication>
+#include <QObject>
+#include <QAction>
+#include <QMainWindow>
+#include "Messages_interface.h"
+
+//! [dock]
+class DockWidget :
+    public QDockWidget,
+    public Ui::BasicDockWidget
+{
+public:
+  DockWidget(QString name, QWidget *parent)
+    :QDockWidget(name,parent)
+  {
+   setupUi(this);
+  }
+};
+//! [dock]
+//This plugin crates an action in Operations that displays "Hello World" in the 'console' dockwidet.
+class BasicPlugin :
+    public QObject,
+    public CGAL::Three::Polyhedron_demo_plugin_helper
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+public:
+  //decides if the plugin's actions will be displayed or not.
+  bool applicable(QAction*) const
+  {
+    return true;
+  }
+  //the list of the actions of the plugin.
+  QList<QAction*> actions() const
+  {
+    return _actions;
+  }
+  //! [init]
+  //this acts like a constructor for the plugin. It gets the references to the mainwindow and the scene, and connects the action.
+  void init(QMainWindow* mw, CGAL::Three::Scene_interface* sc, Messages_interface* mi)
+  {
+    //gets the reference to the message interface, to display text in the console widget
+    this->messageInterface = mi;
+    //get the references
+    this->scene = sc;
+    this->mw = mainWindow;
+
+    //creates the action
+    QAction *actionHelloWorld= new QAction(QString("Hello World"), mw);
+    //specifies the subMenu
+    actionHelloWorld->setProperty("submenuName", "Basic");
+    //links the action
+    if(actionHelloWorld) {
+      connect(actionHelloWorld, SIGNAL(triggered()),
+              this, SLOT(helloWorld()));
+      _actions << actionHelloWorld;
+    }
+
+    dock_widget = new DockWidget("Print a number", mw);
+    dock_widget->setVisible(false); // do not show at the beginning
+
+    addDockWidget(dock_widget);
+
+    connect(dock_widget->pushButton, SIGNAL(clicked(bool)),
+            this, SLOT(on_dock_button_clicked()));
+  }
+  //! [init]
+
+private Q_SLOTS:
+//! [action]
+  void helloWorld()
+  {
+    // dock widget should be instancied in init()
+    if(dock_widget->isVisible()) { dock_widget->hide(); }
+    else                         { dock_widget->show(); }
+  }
+
+  void on_dock_button_clicked()
+  {
+      messageInterface->information(QString("Here is your number :%1").arg(dock_widget->spinBox->value()));
+
+  }
+  //! [action]
+  //! [closure]
+  void closure()
+  {
+    dock_widget->hide();
+  }
+  //! [closure]
+private:
+  QList<QAction*> _actions;
+  Messages_interface* messageInterface;
+  DockWidget* dock_widget;
+};
+
+#include "Dock_widget_plugin.moc"
+
+
+
diff --git a/3rdparty/CGAL/demo/Three/Example_plugin/Example_plugin.cpp b/3rdparty/CGAL/demo/Three/Example_plugin/Example_plugin.cpp
new file mode 100644
index 0000000..5586f48
--- /dev/null
+++ b/3rdparty/CGAL/demo/Three/Example_plugin/Example_plugin.cpp
@@ -0,0 +1,203 @@
+//! \file Polyhedron_demo_example_plugin.cpp
+
+#include <QApplication>
+#include <QMainWindow>
+#include <QAction>
+#include <QVector>
+#include <CGAL/Three/Scene_item.h>
+#include <CGAL/Three/Viewer_interface.h>
+#include <CGAL/Three/Scene_group_item.h>
+
+//! [itemdeclaration]
+// The special Scene_item only for triangles
+class Scene_triangle_item : public CGAL::Three::Scene_item
+{
+
+  Q_OBJECT
+public :
+  Scene_triangle_item(double ax,double ay, double az,
+                      double bx,double by, double bz,
+                      double cx,double cy, double cz);
+
+  // Indicates if rendering mode is supported
+  bool supportsRenderingMode(RenderingMode m) const {
+    return (m == Flat);
+  }
+
+  //Displays the item
+  void draw(CGAL::Three::Viewer_interface* viewer) const;
+
+  //Specifies that the buffers need to be initialized again.
+  //Is mostly called after a change of geometry in the data.
+  void invalidateOpenGLBuffers();
+
+  //fills the std::vector
+  void computeElements(double ax,double ay, double az,
+                        double bx,double by, double bz,
+                        double cx,double cy, double cz) const;
+
+  Scene_item* clone() const {return 0;}
+  QString toolTip() const {return QString();}
+
+
+private:
+  //contains the data
+  mutable std::vector<float> vertices;
+  mutable int nb_pos;
+  mutable QOpenGLShaderProgram *program;
+  using CGAL::Three::Scene_item::initializeBuffers;
+  //Fills the buffers with data. The buffers allow us to give data to the shaders.
+  void initializeBuffers(CGAL::Three::Viewer_interface *viewer)const;
+}; //end of class Scene_triangle_item
+//! [itemdeclaration]
+Scene_triangle_item::Scene_triangle_item(double ax,double ay, double az,
+                                         double bx,double by, double bz,
+                                         double cx,double cy, double cz)
+  :  CGAL::Three::Scene_item(1,1)
+{
+
+  //Color is uniform, no need for a buffer. Changing the color will not re-compute the data
+  is_monochrome = true;
+  nb_pos = 0;
+  are_buffers_filled = false;
+  computeElements(ax, ay, az,
+                   bx, by, bz,
+                   cx, cy, cz);
+  invalidateOpenGLBuffers();
+}
+
+//! [computeelements]
+//Fills the position vector with data.
+void Scene_triangle_item::computeElements(double ax, double ay, double az,
+                                           double bx, double by, double bz,
+                                           double cx, double cy, double cz)const
+{
+  vertices.resize(9);
+  vertices[0] = ax; vertices[1] = ay; vertices[2] = az;
+  vertices[3] = bx; vertices[4] = by; vertices[5] = bz;
+  vertices[6] = cx; vertices[7] = cy; vertices[8] = cz;
+}
+
+//! [computeelements]
+//! [draw]
+
+void Scene_triangle_item::draw(CGAL::Three::Viewer_interface* viewer) const
+{
+  //The filling of the buffers should be performed in this function, because it needs a valid openGL context, and we are certain to have one in this function.
+  if(!are_buffers_filled)
+  {
+    computeElements(0, 0, 0,
+                     1, 0, 0,
+                     0.5, 0.5, 0);
+    initializeBuffers(viewer);
+  }
+  //Binds the vao corresponding to the type of data we are drawing.
+  vaos[0]->bind();
+  //Gets the program corresponding to the type of data we are drawing.
+  //Here we want triangles with light effects.
+  program = getShaderProgram(PROGRAM_WITH_LIGHT);
+  //Gives most of the uniform values to the shaders.
+  attribBuffers(viewer, PROGRAM_WITH_LIGHT);
+  //Binds the program chosen before to use the right shaders.
+  program->bind();
+  //Gives the wanted color to the fragment shader as uniform value.
+  program->setAttributeValue("colors", this->color());
+  //Draws the items
+  viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(nb_pos/3));
+  //clean up
+  vaos[0]->release();
+  program->release();
+
+}
+//! [draw]
+//Specifies that the buffers need to be initialized again.
+//Is mostly called after a change of geometry in the data.
+void Scene_triangle_item::invalidateOpenGLBuffers()
+{
+  are_buffers_filled = false;
+}
+
+
+//! [fillbuffers]
+void Scene_triangle_item::initializeBuffers(CGAL::Three::Viewer_interface *viewer)const
+{
+
+  //vao containing the data for the facets
+  {
+    program = getShaderProgram(PROGRAM_WITH_LIGHT, viewer);
+    program->bind();
+
+    vaos[0]->bind();
+    buffers[0].bind();
+    buffers[0].allocate(vertices.data(),
+                        static_cast<GLsizei>(vertices.size()*sizeof(float)));
+    program->enableAttributeArray("vertex");
+    program->setAttributeBuffer("vertex",GL_FLOAT,0,3);
+    buffers[0].release();
+
+    vaos[0]->release();
+    program->release();
+
+  }
+
+//once the buffers are fill, we can empty the vectors to optimize memory consumption
+  nb_pos = vertices.size();
+  vertices.resize(0);
+  //"Swap trick" insures that the memory is indeed freed and not kept available
+  std::vector<float>(vertices).swap(vertices);
+  are_buffers_filled = true;
+}
+//! [fillbuffers]
+#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
+//The actual plugin
+using namespace CGAL::Three;
+class Q_DECL_EXPORT Polyhedron_demo_example_plugin :
+    public QObject,
+    public Polyhedron_demo_plugin_helper
+{
+  //Configures CMake to use MOC correctly
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+
+public :
+  // Adds an action to the menu and configures the widget
+  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*) {
+    //get the references
+    this->scene = scene_interface;
+    this->mw = mainWindow;
+
+    //creates and link the actions
+    QAction* actionDrawTriangle= new QAction("Draw Triangle", mw);
+    if(actionDrawTriangle) {
+      connect(actionDrawTriangle, SIGNAL(triggered()),
+              this, SLOT(draw_triangle()));
+      _actions << actionDrawTriangle;
+    }
+  }
+  bool applicable(QAction*) const
+  {
+    return true;
+  }
+  QList<QAction*> actions() const {
+    return _actions;
+  }
+
+public Q_SLOTS:
+
+
+  void draw_triangle() {
+
+    triangle = new Scene_triangle_item(0, 0, 0,
+                                       1, 0, 0,
+                                       0.5, 0.5, 0);
+    scene->addItem(triangle);
+  }
+private:
+  CGAL::Three::Scene_item* triangle;
+  QList<QAction*> _actions;
+
+}; //end of class Polyhedron_demo_example_plugin
+#include "Example_plugin.moc"
+
diff --git a/3rdparty/CGAL-4.8/demo/Three/Example_plugin/Polyhedron_demo_example_plugin.ui b/3rdparty/CGAL/demo/Three/Example_plugin/Example_plugin.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Three/Example_plugin/Polyhedron_demo_example_plugin.ui
rename to 3rdparty/CGAL/demo/Three/Example_plugin/Example_plugin.ui
diff --git a/3rdparty/CGAL/demo/Three/Example_plugin/Group_item_plugin.cpp b/3rdparty/CGAL/demo/Three/Example_plugin/Group_item_plugin.cpp
new file mode 100644
index 0000000..73730d4
--- /dev/null
+++ b/3rdparty/CGAL/demo/Three/Example_plugin/Group_item_plugin.cpp
@@ -0,0 +1,86 @@
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+#include <QApplication>
+#include <QObject>
+#include <QAction>
+#include <QMainWindow>
+#include <QInputDialog>
+#include "Messages_interface.h"
+#include "Scene_plane_item.h"
+#include <CGAL/Three/Scene_group_item.h>
+
+//This plugin crates an action in Operations that displays "Hello World" in the 'console' dockwidet.
+class GroupItemPlugin :
+    public QObject,
+    public CGAL::Three::Polyhedron_demo_plugin_interface
+{
+  Q_OBJECT
+  Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
+  Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+public:
+  //This plugin is only applicable if there is at exactly one selected item.
+  bool applicable(QAction*) const
+  {
+    return true;
+  }
+  //the list of the actions of the plugin.
+  QList<QAction*> actions() const
+  {
+    return _actions;
+  }
+  //this acts like a constructor for the plugin. It gets the references to the mainwindow and the scene, and connects the action.
+  void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* sc  )
+  {
+    //get the references
+    this->scene = sc;
+    this->mw = mainWindow;
+
+    //creates the action
+    QAction *actionHelloWorld= new QAction(QString("Hello World"), mw);
+    //specifies the subMenu
+    actionHelloWorld->setProperty("submenuName", "Basic");
+    //links the action
+    if(actionHelloWorld) {
+      connect(actionHelloWorld, SIGNAL(triggered()),
+              this, SLOT(helloWorld()));
+      _actions << actionHelloWorld;
+    }
+  }
+
+  void init(QMainWindow* mw, CGAL::Three::Scene_interface* sc, Messages_interface* mi)
+  {
+    //gets the reference to the message interface, to display text in the console widget
+    this->messageInterface = mi;
+    init(mw, sc);
+  }
+private Q_SLOTS:
+
+
+  void helloWorld()
+  {
+    //creates an item
+    Scene_plane_item *child = new Scene_plane_item(scene);
+    child->setName("Trivial Plane");
+    child->setColor(Qt::blue);
+    child->setNormal(0.0,0.0,1.0);
+    scene->addItem(child);
+    //clears the selection to avoid adding unwanted items to the group.
+    scene->setSelectedItem(-1);
+    //Creates a new group
+    Scene_group_item *group = new Scene_group_item("New group");
+    //Then gives it its children
+    scene->changeGroup(child, group);
+    //adds it to the scene
+    scene->addGroup(group);
+
+  }
+
+private:
+  QList<QAction*> _actions;
+  Messages_interface* messageInterface;
+  //The reference to the scene
+  CGAL::Three::Scene_interface* scene;
+  //The reference to the main window
+  QMainWindow* mw;
+};
+
+#include "Group_item_plugin.moc"
diff --git a/3rdparty/CGAL/demo/Triangulation_2/CMakeLists.txt b/3rdparty/CGAL/demo/Triangulation_2/CMakeLists.txt
new file mode 100644
index 0000000..fa35689
--- /dev/null
+++ b/3rdparty/CGAL/demo/Triangulation_2/CMakeLists.txt
@@ -0,0 +1,106 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+project (Triangulation_2)
+
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+find_package(CGAL COMPONENTS Qt5)
+
+include(${CGAL_USE_FILE})
+
+
+find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
+
+include_directories (BEFORE ../../include)
+include_directories (BEFORE ./include)
+include_directories (BEFORE ../../../Number_types/include)
+
+include_directories (BEFORE ../../../Triangulation_2/include)
+
+if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
+
+add_definitions(-DQT_NO_KEYWORDS)
+
+
+
+#--------------------------------
+# The "constrained Delaunay" demo: Constrained_Delaunay_triangulation_2
+#--------------------------------
+# UI files (Qt Designer files)
+qt5_wrap_ui( CDT_UI_FILES Constrained_Delaunay_triangulation_2.ui )
+
+# qrc files (resources files, that contain icons, at least)
+qt5_add_resources ( CDT_RESOURCE_FILES ./Constrained_Delaunay_triangulation_2.qrc )
+
+# use the Qt MOC preprocessor on classes that derives from QObject
+qt5_generate_moc( "Constrained_Delaunay_triangulation_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Constrained_Delaunay_triangulation_2.moc" )
+
+# The executable itself.
+add_executable  ( Constrained_Delaunay_triangulation_2 Constrained_Delaunay_triangulation_2.cpp Constrained_Delaunay_triangulation_2.moc ${CDT_UI_FILES} ${CDT_RESOURCE_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES})
+
+qt5_use_modules(Constrained_Delaunay_triangulation_2 Xml Script OpenGL Svg)
+
+add_to_cached_list( CGAL_EXECUTABLE_TARGETS Constrained_Delaunay_triangulation_2 )
+
+# Link with Qt libraries
+target_link_libraries( Constrained_Delaunay_triangulation_2 ${QT_LIBRARIES} )
+# Link with CGAL
+target_link_libraries( Constrained_Delaunay_triangulation_2 ${CGAL_LIBRARIES}  ${CGAL_3RD_PARTY_LIBRARIES})
+
+#--------------------------------
+# The "Delaunay" demo: Delaunay_triangulation_2
+#--------------------------------
+# UI files (Qt Designer files)
+qt5_wrap_ui( DT_UI_FILES Delaunay_triangulation_2.ui )
+
+# qrc files (resources files, that contain icons, at least)
+qt5_add_resources ( DT_RESOURCE_FILES ./Delaunay_triangulation_2.qrc )
+
+# use the Qt MOC preprocessor on classes that derives from QObject
+qt5_generate_moc( "Delaunay_triangulation_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Delaunay_triangulation_2.moc" )
+
+# The executable itself.
+add_executable  ( Delaunay_triangulation_2 Delaunay_triangulation_2.cpp Delaunay_triangulation_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES})
+
+qt5_use_modules(Delaunay_triangulation_2 Xml Script OpenGL Svg)
+
+add_to_cached_list( CGAL_EXECUTABLE_TARGETS Delaunay_triangulation_2 )
+
+# Link with Qt libraries
+target_link_libraries( Delaunay_triangulation_2 ${QT_LIBRARIES} )
+# Link with CGAL
+target_link_libraries( Delaunay_triangulation_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES})
+
+#--------------------------------
+# The "Regular" demo: Regular_triangulation_2
+#--------------------------------
+# UI files (Qt Designer files)
+qt5_wrap_ui( DT_UI_FILES Regular_triangulation_2.ui )
+
+# qrc files (resources files, that contain icons, at least)
+qt5_add_resources ( DT_RESOURCE_FILES ./Regular_triangulation_2.qrc )
+
+# use the Qt MOC preprocessor on classes that derives from QObject
+qt5_generate_moc( "Regular_triangulation_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Regular_triangulation_2.moc" )
+
+# The executable itself.
+add_executable  ( Regular_triangulation_2 Regular_triangulation_2.cpp Regular_triangulation_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES})
+
+qt5_use_modules(Regular_triangulation_2 Xml Script OpenGL Svg)
+
+add_to_cached_list( CGAL_EXECUTABLE_TARGETS Regular_triangulation_2 )
+
+# Link with Qt libraries
+target_link_libraries( Regular_triangulation_2 ${QT_LIBRARIES} )
+# Link with CGAL
+target_link_libraries( Regular_triangulation_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES})
+
+else()
+
+  message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
+
+endif()
diff --git a/3rdparty/CGAL/demo/Triangulation_2/Constrained_Delaunay_triangulation_2.cpp b/3rdparty/CGAL/demo/Triangulation_2/Constrained_Delaunay_triangulation_2.cpp
new file mode 100644
index 0000000..860c0ea
--- /dev/null
+++ b/3rdparty/CGAL/demo/Triangulation_2/Constrained_Delaunay_triangulation_2.cpp
@@ -0,0 +1,889 @@
+//#define CGAL_USE_BOOST_BIMAP
+#define CGAL_MESH_2_OPTIMIZER_VERBOSE
+#define CGAL_MESH_2_OPTIMIZERS_DEBUG
+
+#include <fstream>
+#include <vector>
+#include <list>
+
+// CGAL headers
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+#include <CGAL/Constrained_Delaunay_triangulation_2.h>
+#include <CGAL/Delaunay_mesher_2.h>
+#include <CGAL/Delaunay_mesh_face_base_2.h>
+#include <CGAL/Delaunay_mesh_vertex_base_2.h>
+#include <CGAL/Delaunay_mesh_size_criteria_2.h>
+#include <CGAL/Mesh_2/Lipschitz_sizing_field_2.h>
+#include <CGAL/Lipschitz_sizing_field_criteria_2.h>
+#include <CGAL/Constrained_voronoi_diagram_2.h>
+#include <CGAL/Triangulation_conformer_2.h>
+#include <CGAL/lloyd_optimize_mesh_2.h>
+#include <CGAL/IO/File_poly.h>
+#include <CGAL/Random.h>
+#include <CGAL/point_generators_2.h>
+#include <CGAL/Timer.h>
+
+// Qt headers
+#include <QtGui>
+#include <QString>
+#include <QActionGroup>
+#include <QFileDialog>
+#include <QInputDialog>
+#include <QDragEnterEvent>
+#include <QDropEvent>
+#include <QMessageBox>
+
+// GraphicsView items and event filters (input classes)
+#include "TriangulationCircumcircle.h"
+#include "DelaunayMeshInsertSeeds.h"
+#include <CGAL/Qt/GraphicsViewPolylineInput.h>
+#include <CGAL/Qt/DelaunayMeshTriangulationGraphicsItem.h>
+#include <CGAL/Qt/Converter.h>
+
+// the two base classes
+#include "ui_Constrained_Delaunay_triangulation_2.h"
+#include <CGAL/Qt/DemosMainWindow.h>
+
+// for viewportsBbox(QGraphicsScene*)
+#include <CGAL/Qt/utility.h>
+
+typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
+typedef K::Point_2 Point_2;
+typedef K::Segment_2 Segment_2;
+typedef K::Iso_rectangle_2 Iso_rectangle_2;
+typedef CGAL::Delaunay_mesh_vertex_base_2<K>  Vertex_base;
+typedef CGAL::Delaunay_mesh_face_base_2<K> Face_base;
+
+typedef Face_base Fb;
+typedef CGAL::Triangulation_data_structure_2<Vertex_base, Fb>  TDS;
+typedef CGAL::Exact_predicates_tag              Itag;
+typedef CGAL::Constrained_Delaunay_triangulation_2<K, TDS, Itag> CDT;
+typedef CGAL::Constrained_voronoi_diagram_2<CDT> CVD;
+typedef CGAL::Delaunay_mesh_size_criteria_2<CDT> Criteria;
+
+typedef CGAL::Lipschitz_sizing_field_2<CDT> Lipschitz_sizing_field;
+typedef CGAL::Lipschitz_sizing_field_criteria_2<CDT, Lipschitz_sizing_field> Lipschitz_criteria;
+typedef CGAL::Delaunay_mesher_2<CDT, Lipschitz_criteria> Lipschitz_mesher;
+
+typedef CDT::Vertex_handle Vertex_handle;
+typedef CDT::Face_handle Face_handle;
+typedef CDT::All_faces_iterator All_faces_iterator;
+
+using namespace CGAL::parameters;
+
+void
+discoverInfiniteComponent(const CDT & ct)
+{
+  //when this function is called, all faces are set "in_domain"
+  Face_handle start = ct.infinite_face();
+  std::list<Face_handle> queue;
+  queue.push_back(start);
+
+  while(! queue.empty())
+  {
+    Face_handle fh = queue.front();
+    queue.pop_front();
+    fh->set_in_domain(false);
+	
+    for(int i = 0; i < 3; i++)
+    {
+      Face_handle fi = fh->neighbor(i);
+      if(fi->is_in_domain()
+        && !ct.is_constrained(CDT::Edge(fh,i)))
+        queue.push_back(fi);
+    }
+  }
+}
+
+template<typename SeedList>
+void 
+discoverComponents(const CDT & ct,
+                   const SeedList& seeds)
+{
+  if (ct.dimension() != 2)
+    return;
+
+  // tag all faces inside
+  for(typename CDT::All_faces_iterator fit = ct.all_faces_begin();
+      fit != ct.all_faces_end();
+      ++fit)
+      fit->set_in_domain(true);
+
+  // mark "outside" infinite component of the object
+  discoverInfiniteComponent(ct);
+
+  // mark "outside" components with a seed
+  for(typename SeedList::const_iterator sit = seeds.begin();
+      sit != seeds.end();
+      ++sit)
+  {
+    typename CDT::Face_handle fh_loc = ct.locate(*sit);
+
+    if(fh_loc == NULL || !fh_loc->is_in_domain())
+      continue;
+
+    std::list<typename CDT::Face_handle> queue;
+    queue.push_back(fh_loc);
+    while(!queue.empty())
+    {
+      typename CDT::Face_handle f = queue.front();
+      queue.pop_front();
+      f->set_in_domain(false);
+
+      for(int i = 0; i < 3; ++i)
+      {
+        typename CDT::Face_handle ni = f->neighbor(i);
+        if(ni->is_in_domain()
+          && !ct.is_constrained(typename CDT::Edge(f,i))) //same component
+        {
+          queue.push_back(ni);
+        }
+      }
+    }
+  }
+} 
+
+
+
+class MainWindow :
+  public CGAL::Qt::DemosMainWindow,
+  public Ui::Constrained_Delaunay_triangulation_2
+{
+  Q_OBJECT
+  
+private:  
+  CDT cdt; 
+  QGraphicsScene scene;
+  std::list<Point_2> m_seeds;
+
+  CGAL::Qt::DelaunayMeshTriangulationGraphicsItem<CDT> * dgi;
+
+  CGAL::Qt::GraphicsViewPolylineInput<K> * pi;
+  CGAL::Qt::TriangulationCircumcircle<CDT> *tcc;
+  CGAL::Qt::DelaunayMeshInsertSeeds<CDT> *dms;
+
+public:
+  MainWindow();
+
+  void clear();
+
+private:
+  template <typename Iterator> 
+  void insert_polyline(Iterator b, Iterator e)
+  {
+    Point_2 p, q;
+    typename CDT::Vertex_handle vh, wh;
+    Iterator it = b;
+    vh = cdt.insert(*it);
+    p = *it;
+    ++it;
+    for(; it != e; ++it){
+      q = *it;
+      if(p != q){
+        wh = cdt.insert(*it);
+        cdt.insert_constraint(vh,wh);
+        vh = wh;
+        p = q;
+      } else {
+        std::cout << "duplicate point: " << p << std::endl; 
+      }
+    }
+    Q_EMIT( changed());
+  }
+
+public Q_SLOTS:
+  void open(QString);
+
+  void processInput(CGAL::Object o);
+
+  void on_actionShowVertices_toggled(bool checked);
+
+  void on_actionShowDelaunay_toggled(bool checked);
+
+  void on_actionShowTriangulationInDomain_toggled(bool checked);
+
+  void on_actionShow_constrained_edges_toggled(bool checked);
+
+  void on_actionShow_voronoi_edges_toggled(bool checked);
+
+  void on_actionShow_faces_in_domain_toggled(bool checked);
+
+  void on_actionShow_blind_faces_toggled(bool checked);
+
+  void on_actionShow_seeds_toggled(bool checked);
+
+  void on_actionInsertPolyline_toggled(bool checked);
+  
+  void on_actionInsertSeeds_OnOff_toggled(bool checked);
+  
+  void on_actionCircumcenter_toggled(bool checked);
+
+  void on_actionClear_triggered();
+
+  void on_actionRecenter_triggered();
+
+  void on_actionLoadConstraints_triggered();
+
+  void loadFile(QString);
+
+  void loadPolyConstraints(QString);
+
+  void loadPolygonConstraints(QString);
+
+  void loadEdgConstraints(QString);
+
+  void on_actionSaveConstraints_triggered();
+
+  void saveConstraints(QString);
+
+  void on_actionMakeGabrielConform_triggered();
+
+  void on_actionMakeDelaunayConform_triggered();
+
+  void on_actionMakeDelaunayMesh_triggered();
+
+  void on_actionMakeLipschitzDelaunayMesh_triggered();
+
+  void on_actionInsertRandomPoints_triggered();
+
+  void on_actionTagBlindFaces_triggered();
+
+  void on_actionLloyd_optimization_triggered();
+
+Q_SIGNALS:
+  void changed();
+};
+
+
+MainWindow::MainWindow()
+  : DemosMainWindow()
+{
+  setupUi(this);
+
+  this->graphicsView->setAcceptDrops(false);
+
+  // Add a GraphicItem for the CDT triangulation
+  dgi = new CGAL::Qt::DelaunayMeshTriangulationGraphicsItem<CDT>(&cdt);
+  QColor facesColor(::Qt::blue);
+  facesColor.setAlpha(150);
+  dgi->setFacesInDomainBrush(facesColor);
+    
+  QObject::connect(this, SIGNAL(changed()),
+		   dgi, SLOT(modelChanged()));
+  dgi->setVerticesPen(
+    QPen(Qt::red, 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
+  dgi->setVoronoiPen(
+    QPen(Qt::darkGreen, 0, Qt::DashLine, Qt::RoundCap, Qt::RoundJoin));
+  dgi->setSeedsPen(
+    QPen(Qt::darkBlue, 0, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
+
+  dgi->setZValue(-1);
+  scene.addItem(dgi);
+
+  // Setup input handlers. They get events before the scene gets them
+  // and the input they generate is passed to the triangulation with 
+  // the signal/slot mechanism    
+  pi = new CGAL::Qt::GraphicsViewPolylineInput<K>(this, &scene, 0, true); // inputs polylines which are not closed
+  QObject::connect(pi, SIGNAL(generate(CGAL::Object)),
+		   this, SLOT(processInput(CGAL::Object)));
+    
+  tcc = new CGAL::Qt::TriangulationCircumcircle<CDT>(&scene, &cdt, this);
+  tcc->setPen(QPen(Qt::red, 0, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
+  
+  dms = new CGAL::Qt::DelaunayMeshInsertSeeds<CDT>(&scene, &cdt, this);//input seeds
+  QObject::connect(dms, SIGNAL(generate(CGAL::Object)),
+                   this, SLOT(processInput(CGAL::Object)));
+
+  // 
+  // Manual handling of actions
+  //
+  QObject::connect(this->actionQuit, SIGNAL(triggered()), 
+		   this, SLOT(close()));
+
+  // We put mutually exclusive actions in an QActionGroup
+  QActionGroup* ag = new QActionGroup(this);
+  ag->addAction(this->actionInsertPolyline);
+
+  // Check two actions 
+  this->actionInsertPolyline->setChecked(true);
+  this->actionShowDelaunay->setChecked(true);
+  this->actionShowVertices->setChecked(true);
+  this->actionShowTriangulationInDomain->setChecked(false);
+  this->actionShow_faces_in_domain->setChecked(true);
+  this->actionShow_constrained_edges->setChecked(true);
+  this->actionShow_voronoi_edges->setChecked(false);
+  this->actionShow_seeds->setChecked(false);
+  this->actionInsertSeeds_OnOff->setChecked(false);
+
+  //
+  // Setup the scene and the view
+  //
+  scene.setItemIndexMethod(QGraphicsScene::NoIndex);
+  scene.setSceneRect(-100, -100, 100, 100);
+  this->graphicsView->setScene(&scene);
+  this->graphicsView->setMouseTracking(true);
+
+  // Turn the vertical axis upside down
+  this->graphicsView->scale(1, -1);
+                                                      
+  // The navigation adds zooming and translation functionality to the
+  // QGraphicsView
+  this->addNavigation(this->graphicsView);
+
+  this->setupStatusBar();
+  this->setupOptionsMenu();
+  this->addAboutDemo(":/cgal/help/about_Constrained_Delaunay_triangulation_2.html");
+  this->addAboutCGAL();
+  this->setupExportSVG(this->actionExport_SVG, this->graphicsView);
+
+  this->addRecentFiles(this->menuFile, this->actionQuit);
+  connect(this, SIGNAL(openRecentFile(QString)),
+	  this, SLOT(open(QString)));
+}
+
+
+void
+MainWindow::processInput(CGAL::Object o)
+{
+  // Polygon
+  std::list<Point_2> points;
+  if(CGAL::assign(points, o))
+  {
+    if(points.size() == 1)
+      cdt.insert(points.front());
+    else
+      insert_polyline(points.begin(), points.end());
+    }
+  else
+  {
+    // Seed (from Shift + left clic)
+    Point_2 p;
+    if(CGAL::assign(p, o))
+    {
+      m_seeds.push_back(p);
+      if(actionShow_seeds->isChecked())
+        dgi->setVisibleSeeds(true, m_seeds.begin(), m_seeds.end());
+    }
+  }
+
+  discoverComponents(cdt, m_seeds);
+  Q_EMIT( changed());
+}
+
+
+/* 
+ *  Qt Automatic Connections
+ *  http://doc.qt.io/qt-5/designer-using-a-ui-file.html#automatic-connections
+ * 
+ *  setupUi(this) generates connections to the slots named
+ *  "on_<action_name>_<signal_name>"
+ */
+void
+MainWindow::on_actionInsertPolyline_toggled(bool checked)
+{
+  if(checked){
+    scene.installEventFilter(pi);
+  } else {
+    scene.removeEventFilter(pi);
+  }
+}
+
+void
+MainWindow::on_actionInsertSeeds_OnOff_toggled(bool checked)
+{
+  if(checked){
+    std::cout << "Insert seeds with Shift + Left click" << std::endl;
+    scene.installEventFilter(dms);
+  } else {
+    scene.removeEventFilter(dms);
+  }
+}
+
+void
+MainWindow::on_actionShowDelaunay_toggled(bool checked)
+{
+  dgi->setVisibleEdges(checked);
+  if(checked)
+  {
+    dgi->setVisibleInsideEdges(false);
+    actionShowTriangulationInDomain->setChecked(false);
+  }
+  update();
+}
+
+void
+MainWindow::on_actionShowVertices_toggled(bool checked)
+{
+  dgi->setVisibleVertices(checked);
+  update();
+}
+
+void
+MainWindow::on_actionShowTriangulationInDomain_toggled(bool checked)
+{
+  dgi->setVisibleInsideEdges(checked);
+  if(checked)
+  {
+    dgi->setVisibleEdges(false);
+    actionShowDelaunay->setChecked(false);
+  }
+  update();
+}
+
+void
+MainWindow::on_actionShow_constrained_edges_toggled(bool checked)
+{
+  dgi->setVisibleConstraints(checked);
+  update();
+}
+
+void
+MainWindow::on_actionShow_voronoi_edges_toggled(bool checked)
+{
+  dgi->setVisibleVoronoiEdges(checked);
+  update();
+}
+
+void
+MainWindow::on_actionShow_faces_in_domain_toggled(bool checked)
+{
+  dgi->setVisibleFacesInDomain(checked);
+  update();
+}
+
+void
+MainWindow::on_actionShow_blind_faces_toggled(bool checked)
+{
+  dgi->setVisibleBlindFaces(checked);
+  update();
+}
+
+void
+MainWindow::on_actionShow_seeds_toggled(bool checked)
+{
+  dgi->setVisibleSeeds(checked, m_seeds.begin(), m_seeds.end());
+  update();
+}
+
+void
+MainWindow::on_actionCircumcenter_toggled(bool checked)
+{
+  if(checked){
+    scene.installEventFilter(tcc);
+    tcc->show();
+  } else {  
+    scene.removeEventFilter(tcc);
+    tcc->hide();
+  }
+}
+
+
+void
+MainWindow::on_actionClear_triggered()
+{
+  clear();
+  Q_EMIT( changed());
+}
+
+void
+MainWindow::clear()
+{
+  cdt.clear();
+  m_seeds.clear();
+
+  if(actionShow_seeds->isChecked())
+    dgi->setVisibleSeeds(true, m_seeds.end(), m_seeds.end());
+}
+
+void 
+MainWindow::open(QString fileName)
+{
+  if(! fileName.isEmpty()){
+    if(cdt.number_of_vertices() > 0)
+    {
+      QMessageBox msgBox(QMessageBox::Warning,
+        "Open new polygon",
+        "Do you really want to clear the current mesh?",
+        (QMessageBox::Yes | QMessageBox::No),
+        this);
+      int ret = msgBox.exec();
+      if(ret == QMessageBox::Yes)
+        clear();
+      else
+        return;
+    }
+    if(fileName.endsWith(".cgal")){
+      loadFile(fileName);
+      this->addToRecentFiles(fileName);
+    } else if(fileName.endsWith(".plg")){
+      loadPolygonConstraints(fileName);
+      this->addToRecentFiles(fileName);
+    } else if(fileName.endsWith(".edg")){
+      loadEdgConstraints(fileName);
+      this->addToRecentFiles(fileName);
+    } else if(fileName.endsWith(".poly")){
+      loadPolyConstraints(fileName);
+      this->addToRecentFiles(fileName);
+    }
+  }
+  Q_EMIT(changed());
+  actionRecenter->trigger();
+}
+
+void
+MainWindow::on_actionLoadConstraints_triggered()
+{
+  QString fileName = QFileDialog::getOpenFileName(this,
+						  tr("Open Constraint File"),
+						  ".",
+						  tr("Edge files (*.edg);;"
+                                                     "Plg files (*.plg);;"
+						     "Poly files (*.poly)"));
+  open(fileName);
+}
+
+void
+MainWindow::loadFile(QString fileName)
+{
+  std::ifstream ifs(qPrintable(fileName));
+  ifs >> cdt;
+  if(!ifs) abort();
+  discoverComponents(cdt, m_seeds);
+  Q_EMIT( changed());
+  actionRecenter->trigger();
+}
+
+void
+MainWindow::loadPolyConstraints(QString fileName)
+{
+  std::ifstream ifs(qPrintable(fileName));
+  read_triangle_poly_file(cdt,ifs);
+  discoverComponents(cdt, m_seeds);
+  Q_EMIT( changed());
+  actionRecenter->trigger();
+}
+
+
+void
+MainWindow::loadPolygonConstraints(QString fileName)
+{
+  K::Point_2 p,q, first;
+  CDT::Vertex_handle vp, vq, vfirst;
+  std::ifstream ifs(qPrintable(fileName));
+  int n;
+  // int counter = 0;
+  while(ifs >> n){
+    int poly_size = n;
+    ifs >> first;
+    p = first;
+    vfirst = vp = cdt.insert(p);
+    n--;
+    while(n--){
+      ifs >> q;
+      vq = cdt.insert(q, vp->face());
+      if(vp != vq) {
+        cdt.insert_constraint(vp,vq);
+        // std::cerr << "inserted constraint #" << counter++ << std::endl;
+      }
+      p = q;
+      vp = vq;
+    }
+    if(poly_size != 2 && vp != vfirst) {
+      cdt.insert_constraint(vp, vfirst);
+    }
+  }
+  
+  discoverComponents(cdt, m_seeds);
+  Q_EMIT( changed());
+  actionRecenter->trigger();
+}
+
+
+void
+MainWindow::loadEdgConstraints(QString fileName)
+{
+  // wait cursor
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  CGAL::Timer tim;
+  tim.start();
+  std::ifstream ifs(qPrintable(fileName));
+  bool first=true;
+  int n;
+  ifs >> n;
+  
+  K::Point_2 p,q, qold;
+
+  CDT::Vertex_handle vp, vq, vqold;
+  while(ifs >> p) {
+    ifs >> q;
+    if(p == q){
+      continue;
+    }
+    if((!first) && (p == qold)){
+      vp = vqold;
+    } else {
+      vp = cdt.insert(p);
+    }
+    vq = cdt.insert(q, vp->face());
+    if(vp != vq) {
+      cdt.insert_constraint(vp,vq);
+    }
+    qold = q;
+    vqold = vq;
+    first = false;
+  }
+
+
+  tim.stop();
+  statusBar()->showMessage(QString("Insertion took %1 seconds").arg(tim.time()), 2000);
+  discoverComponents(cdt, m_seeds);
+  // default cursor
+  QApplication::restoreOverrideCursor();
+  Q_EMIT( changed());
+  actionRecenter->trigger();
+}
+
+void
+MainWindow::on_actionRecenter_triggered()
+{
+  this->graphicsView->setSceneRect(dgi->boundingRect());
+  this->graphicsView->fitInView(dgi->boundingRect(), Qt::KeepAspectRatio);  
+}
+
+
+void
+MainWindow::on_actionSaveConstraints_triggered()
+{
+  QString fileName = QFileDialog::getSaveFileName(this,
+						  tr("Save Constraints"),
+						  ".",
+						  tr("Poly files (*.poly)\n"
+						     "Edge files (*.edg)"));
+  if(! fileName.isEmpty()){
+    saveConstraints(fileName);
+  }
+}
+
+
+void
+MainWindow::saveConstraints(QString fileName)
+{
+  std::ofstream output(qPrintable(fileName));
+  if (output) output << cdt;
+}
+
+
+void
+MainWindow::on_actionMakeGabrielConform_triggered()
+{
+  // wait cursor
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  std::size_t nv = cdt.number_of_vertices();
+  CGAL::make_conforming_Gabriel_2(cdt);
+  nv = cdt.number_of_vertices() - nv;
+  discoverComponents(cdt, m_seeds);
+  statusBar()->showMessage(QString("Added %1 vertices").arg(nv), 2000);
+  // default cursor
+  QApplication::restoreOverrideCursor();
+  Q_EMIT( changed());
+}
+
+
+void
+MainWindow::on_actionMakeDelaunayConform_triggered()
+{
+  // wait cursor
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  std::size_t nv = cdt.number_of_vertices();
+  CGAL::make_conforming_Delaunay_2(cdt);
+  discoverComponents(cdt, m_seeds);
+  nv = cdt.number_of_vertices() - nv;
+  statusBar()->showMessage(QString("Added %1 vertices").arg(nv), 2000);
+   // default cursor
+  QApplication::restoreOverrideCursor();
+  Q_EMIT( changed());
+}
+
+
+void
+MainWindow::on_actionMakeDelaunayMesh_triggered()
+{
+  // wait cursor
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  CGAL::Timer timer;
+  timer.start();
+  discoverComponents(cdt, m_seeds);
+  timer.stop();
+  QApplication::restoreOverrideCursor();
+
+  bool ok;
+  double shape = QInputDialog::getDouble(this, tr("Shape criterion"),
+    tr("B = "), 0.125, 0.005, 100, 4, &ok);
+  if(!ok) return;
+
+  double edge_len = QInputDialog::getDouble(this, tr("Size criterion"),
+    tr("S = "), 0., 0., (std::numeric_limits<double>::max)(), 5, &ok);
+  if(!ok) return;
+
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  std::size_t nv = cdt.number_of_vertices();
+  timer.start();
+
+  CGAL::refine_Delaunay_mesh_2(cdt,
+      m_seeds.begin(), m_seeds.end(),
+      Criteria(shape, edge_len),
+      false);//mesh the subdomains including NO seed
+
+  timer.stop();
+  nv = cdt.number_of_vertices() - nv;
+  statusBar()->showMessage(QString("Added %1 vertices in %2 seconds").arg(nv).arg(timer.time()), 2000);
+  // default cursor
+  QApplication::restoreOverrideCursor();
+  Q_EMIT( changed());
+}
+
+void
+MainWindow::on_actionMakeLipschitzDelaunayMesh_triggered()
+{
+  // wait cursor
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  std::set<Point_2> points;
+  for(CDT::Finite_edges_iterator it = cdt.finite_edges_begin();
+      it != cdt.finite_edges_end();
+      ++it){
+    if(cdt.is_constrained(*it)){
+      Segment_2 s = cdt.segment(*it);
+      points.insert(s.source());
+      points.insert(s.target());
+    }
+  }
+
+  discoverComponents(cdt, m_seeds);
+
+  bool ok;
+  double shape = QInputDialog::getDouble(this, tr("Shape criterion"),
+    tr("B = "), 0.125, 0.005, 100, 4, &ok);
+  if(!ok) return;
+  double klip = QInputDialog::getDouble(this, tr("k-Lipschitz sizing field"),
+    tr("k = "), 1., 0.01, 500, 5, &ok);
+  if(!ok) return;
+
+  Lipschitz_sizing_field field(points.begin(), points.end(), klip);
+  Lipschitz_criteria criteria(shape, &field);
+  Lipschitz_mesher mesher(cdt);
+  mesher.set_criteria(criteria);
+
+  std::size_t nv = cdt.number_of_vertices();
+  mesher.init(true);
+  mesher.set_seeds(m_seeds.begin(), m_seeds.end(),
+                   false);//mesh the subdomains including NO seed
+
+  mesher.refine_mesh();
+  nv = cdt.number_of_vertices() - nv;
+  statusBar()->showMessage(QString("Added %1 vertices").arg(nv), 2000);
+  // default cursor
+  QApplication::restoreOverrideCursor();
+  Q_EMIT( changed());
+}
+
+void
+MainWindow::on_actionInsertRandomPoints_triggered()
+{
+  QRectF rect = CGAL::Qt::viewportsBbox(&scene);
+  CGAL::Qt::Converter<K> convert;
+  Iso_rectangle_2 isor = convert(rect);
+  CGAL::Random_points_in_iso_rectangle_2<Point_2> pg((isor.min)(), (isor.max)());
+  bool ok = false;
+
+  const int number_of_points = 
+    QInputDialog::getInt(this, 
+                             tr("Number of random points"),
+                             tr("Enter number of random points"),
+			     100,
+			     0,
+			     (std::numeric_limits<int>::max)(),
+			     1,
+			     &ok);
+
+  if(!ok) {
+    return;
+  }
+
+  // wait cursor
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+  std::vector<Point_2> points;
+  points.reserve(number_of_points);
+  for(int i = 0; i < number_of_points; ++i){
+    points.push_back(*pg++);
+  }
+  cdt.insert(points.begin(), points.end());
+  // default cursor
+  QApplication::restoreOverrideCursor();
+  Q_EMIT( changed());
+}
+
+void
+MainWindow::on_actionTagBlindFaces_triggered()
+{
+  // wait cursor
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+
+  CVD voronoi(cdt);
+  voronoi.tag_faces_blind();
+
+  // default cursor
+  QApplication::restoreOverrideCursor();
+  Q_EMIT(changed());
+}
+
+void
+MainWindow::on_actionLloyd_optimization_triggered()
+{
+  // wait cursor
+  QApplication::setOverrideCursor(Qt::WaitCursor);
+
+  bool ok;
+  int nb = QInputDialog::getInt(this, tr("QInputDialog::getInteger()"),
+    tr("Number of iterations :"),
+    1/*val*/, 0/*min*/, 1000/*max*/, 1/*step*/, &ok);
+  if(!ok)
+  {
+    QApplication::restoreOverrideCursor();
+    return;
+  }
+
+  CGAL::lloyd_optimize_mesh_2(cdt,
+      max_iteration_number = nb,
+      seeds_begin = m_seeds.begin(),
+      seeds_end = m_seeds.end());
+
+  // default cursor
+  QApplication::restoreOverrideCursor();
+  Q_EMIT(changed());
+}
+
+#include "Constrained_Delaunay_triangulation_2.moc"
+#include <CGAL/Qt/resources.h>
+
+int main(int argc, char **argv)
+{
+  QApplication app(argc, argv);
+
+  app.setOrganizationDomain("geometryfactory.com");
+  app.setOrganizationName("GeometryFactory");
+  app.setApplicationName("Constrained_Delaunay_triangulation_2 demo");
+
+  // Import resources from libCGAL (Qt5).
+  CGAL_QT_INIT_RESOURCES;
+
+  MainWindow mainWindow;
+  mainWindow.show();
+
+  QStringList args = app.arguments();
+  args.removeAt(0);
+  Q_FOREACH(QString filename, args) {
+    mainWindow.open(filename);
+  }
+
+  return app.exec();
+}
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/Constrained_Delaunay_triangulation_2.qrc b/3rdparty/CGAL/demo/Triangulation_2/Constrained_Delaunay_triangulation_2.qrc
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/Constrained_Delaunay_triangulation_2.qrc
rename to 3rdparty/CGAL/demo/Triangulation_2/Constrained_Delaunay_triangulation_2.qrc
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/Constrained_Delaunay_triangulation_2.ui b/3rdparty/CGAL/demo/Triangulation_2/Constrained_Delaunay_triangulation_2.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/Constrained_Delaunay_triangulation_2.ui
rename to 3rdparty/CGAL/demo/Triangulation_2/Constrained_Delaunay_triangulation_2.ui
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/DelaunayMeshInsertSeeds.h b/3rdparty/CGAL/demo/Triangulation_2/DelaunayMeshInsertSeeds.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/DelaunayMeshInsertSeeds.h
rename to 3rdparty/CGAL/demo/Triangulation_2/DelaunayMeshInsertSeeds.h
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/Delaunay_triangulation_2.cpp b/3rdparty/CGAL/demo/Triangulation_2/Delaunay_triangulation_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/Delaunay_triangulation_2.cpp
rename to 3rdparty/CGAL/demo/Triangulation_2/Delaunay_triangulation_2.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/Delaunay_triangulation_2.qrc b/3rdparty/CGAL/demo/Triangulation_2/Delaunay_triangulation_2.qrc
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/Delaunay_triangulation_2.qrc
rename to 3rdparty/CGAL/demo/Triangulation_2/Delaunay_triangulation_2.qrc
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/Delaunay_triangulation_2.ui b/3rdparty/CGAL/demo/Triangulation_2/Delaunay_triangulation_2.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/Delaunay_triangulation_2.ui
rename to 3rdparty/CGAL/demo/Triangulation_2/Delaunay_triangulation_2.ui
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/RegularTriangulationRemoveVertex.h b/3rdparty/CGAL/demo/Triangulation_2/RegularTriangulationRemoveVertex.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/RegularTriangulationRemoveVertex.h
rename to 3rdparty/CGAL/demo/Triangulation_2/RegularTriangulationRemoveVertex.h
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/Regular_triangulation_2.cpp b/3rdparty/CGAL/demo/Triangulation_2/Regular_triangulation_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/Regular_triangulation_2.cpp
rename to 3rdparty/CGAL/demo/Triangulation_2/Regular_triangulation_2.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/Regular_triangulation_2.qrc b/3rdparty/CGAL/demo/Triangulation_2/Regular_triangulation_2.qrc
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/Regular_triangulation_2.qrc
rename to 3rdparty/CGAL/demo/Triangulation_2/Regular_triangulation_2.qrc
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/Regular_triangulation_2.ui b/3rdparty/CGAL/demo/Triangulation_2/Regular_triangulation_2.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/Regular_triangulation_2.ui
rename to 3rdparty/CGAL/demo/Triangulation_2/Regular_triangulation_2.ui
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/TriangulationCircumcircle.h b/3rdparty/CGAL/demo/Triangulation_2/TriangulationCircumcircle.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/TriangulationCircumcircle.h
rename to 3rdparty/CGAL/demo/Triangulation_2/TriangulationCircumcircle.h
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/TriangulationConflictZone.h b/3rdparty/CGAL/demo/Triangulation_2/TriangulationConflictZone.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/TriangulationConflictZone.h
rename to 3rdparty/CGAL/demo/Triangulation_2/TriangulationConflictZone.h
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/TriangulationMovingPoint.h b/3rdparty/CGAL/demo/Triangulation_2/TriangulationMovingPoint.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/TriangulationMovingPoint.h
rename to 3rdparty/CGAL/demo/Triangulation_2/TriangulationMovingPoint.h
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/TriangulationPointInputAndConflictZone.h b/3rdparty/CGAL/demo/Triangulation_2/TriangulationPointInputAndConflictZone.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/TriangulationPointInputAndConflictZone.h
rename to 3rdparty/CGAL/demo/Triangulation_2/TriangulationPointInputAndConflictZone.h
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/TriangulationRemoveVertex.h b/3rdparty/CGAL/demo/Triangulation_2/TriangulationRemoveVertex.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/TriangulationRemoveVertex.h
rename to 3rdparty/CGAL/demo/Triangulation_2/TriangulationRemoveVertex.h
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/about_Constrained_Delaunay_triangulation_2.html b/3rdparty/CGAL/demo/Triangulation_2/about_Constrained_Delaunay_triangulation_2.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/about_Constrained_Delaunay_triangulation_2.html
rename to 3rdparty/CGAL/demo/Triangulation_2/about_Constrained_Delaunay_triangulation_2.html
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/about_Delaunay_triangulation_2.html b/3rdparty/CGAL/demo/Triangulation_2/about_Delaunay_triangulation_2.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/about_Delaunay_triangulation_2.html
rename to 3rdparty/CGAL/demo/Triangulation_2/about_Delaunay_triangulation_2.html
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/about_Regular_triangulation_2.html b/3rdparty/CGAL/demo/Triangulation_2/about_Regular_triangulation_2.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/about_Regular_triangulation_2.html
rename to 3rdparty/CGAL/demo/Triangulation_2/about_Regular_triangulation_2.html
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/data/butterfly b/3rdparty/CGAL/demo/Triangulation_2/data/butterfly
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/data/butterfly
rename to 3rdparty/CGAL/demo/Triangulation_2/data/butterfly
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/data/butterfly.edg b/3rdparty/CGAL/demo/Triangulation_2/data/butterfly.edg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/data/butterfly.edg
rename to 3rdparty/CGAL/demo/Triangulation_2/data/butterfly.edg
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/data/clusters.edg b/3rdparty/CGAL/demo/Triangulation_2/data/clusters.edg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/data/clusters.edg
rename to 3rdparty/CGAL/demo/Triangulation_2/data/clusters.edg
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/data/clusters.poly b/3rdparty/CGAL/demo/Triangulation_2/data/clusters.poly
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/data/clusters.poly
rename to 3rdparty/CGAL/demo/Triangulation_2/data/clusters.poly
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/data/clusters2.edg b/3rdparty/CGAL/demo/Triangulation_2/data/clusters2.edg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/data/clusters2.edg
rename to 3rdparty/CGAL/demo/Triangulation_2/data/clusters2.edg
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/data/fish b/3rdparty/CGAL/demo/Triangulation_2/data/fish
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/data/fish
rename to 3rdparty/CGAL/demo/Triangulation_2/data/fish
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/data/fish.edg b/3rdparty/CGAL/demo/Triangulation_2/data/fish.edg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/data/fish.edg
rename to 3rdparty/CGAL/demo/Triangulation_2/data/fish.edg
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/data/fish.poly b/3rdparty/CGAL/demo/Triangulation_2/data/fish.poly
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/data/fish.poly
rename to 3rdparty/CGAL/demo/Triangulation_2/data/fish.poly
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/data/img1.edg b/3rdparty/CGAL/demo/Triangulation_2/data/img1.edg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/data/img1.edg
rename to 3rdparty/CGAL/demo/Triangulation_2/data/img1.edg
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/data/img2.edg b/3rdparty/CGAL/demo/Triangulation_2/data/img2.edg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/data/img2.edg
rename to 3rdparty/CGAL/demo/Triangulation_2/data/img2.edg
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/data/img3.edg b/3rdparty/CGAL/demo/Triangulation_2/data/img3.edg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/data/img3.edg
rename to 3rdparty/CGAL/demo/Triangulation_2/data/img3.edg
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/data/img4.edg b/3rdparty/CGAL/demo/Triangulation_2/data/img4.edg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/data/img4.edg
rename to 3rdparty/CGAL/demo/Triangulation_2/data/img4.edg
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/data/img5.edg b/3rdparty/CGAL/demo/Triangulation_2/data/img5.edg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/data/img5.edg
rename to 3rdparty/CGAL/demo/Triangulation_2/data/img5.edg
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/data/img6.edg b/3rdparty/CGAL/demo/Triangulation_2/data/img6.edg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/data/img6.edg
rename to 3rdparty/CGAL/demo/Triangulation_2/data/img6.edg
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/data/img7.edg b/3rdparty/CGAL/demo/Triangulation_2/data/img7.edg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/data/img7.edg
rename to 3rdparty/CGAL/demo/Triangulation_2/data/img7.edg
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/data/img8.edg b/3rdparty/CGAL/demo/Triangulation_2/data/img8.edg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/data/img8.edg
rename to 3rdparty/CGAL/demo/Triangulation_2/data/img8.edg
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/data/lettre_A.edg b/3rdparty/CGAL/demo/Triangulation_2/data/lettre_A.edg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/data/lettre_A.edg
rename to 3rdparty/CGAL/demo/Triangulation_2/data/lettre_A.edg
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/data/lettre_A_2.edg b/3rdparty/CGAL/demo/Triangulation_2/data/lettre_A_2.edg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/data/lettre_A_2.edg
rename to 3rdparty/CGAL/demo/Triangulation_2/data/lettre_A_2.edg
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/data/norway.edg b/3rdparty/CGAL/demo/Triangulation_2/data/norway.edg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/data/norway.edg
rename to 3rdparty/CGAL/demo/Triangulation_2/data/norway.edg
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/data/poisson b/3rdparty/CGAL/demo/Triangulation_2/data/poisson
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/data/poisson
rename to 3rdparty/CGAL/demo/Triangulation_2/data/poisson
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/data/tr b/3rdparty/CGAL/demo/Triangulation_2/data/tr
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/data/tr
rename to 3rdparty/CGAL/demo/Triangulation_2/data/tr
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/data/triangulation.cgal b/3rdparty/CGAL/demo/Triangulation_2/data/triangulation.cgal
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/data/triangulation.cgal
rename to 3rdparty/CGAL/demo/Triangulation_2/data/triangulation.cgal
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/data/trivial.poly b/3rdparty/CGAL/demo/Triangulation_2/data/trivial.poly
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/data/trivial.poly
rename to 3rdparty/CGAL/demo/Triangulation_2/data/trivial.poly
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/icons/circumcenter.pdf b/3rdparty/CGAL/demo/Triangulation_2/icons/circumcenter.pdf
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/icons/circumcenter.pdf
rename to 3rdparty/CGAL/demo/Triangulation_2/icons/circumcenter.pdf
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/icons/circumcenter.png b/3rdparty/CGAL/demo/Triangulation_2/icons/circumcenter.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/icons/circumcenter.png
rename to 3rdparty/CGAL/demo/Triangulation_2/icons/circumcenter.png
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/icons/conflict_zone.pdf b/3rdparty/CGAL/demo/Triangulation_2/icons/conflict_zone.pdf
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/icons/conflict_zone.pdf
rename to 3rdparty/CGAL/demo/Triangulation_2/icons/conflict_zone.pdf
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/icons/conflict_zone.png b/3rdparty/CGAL/demo/Triangulation_2/icons/conflict_zone.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/icons/conflict_zone.png
rename to 3rdparty/CGAL/demo/Triangulation_2/icons/conflict_zone.png
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/icons/constrained_triangulation.pdf b/3rdparty/CGAL/demo/Triangulation_2/icons/constrained_triangulation.pdf
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/icons/constrained_triangulation.pdf
rename to 3rdparty/CGAL/demo/Triangulation_2/icons/constrained_triangulation.pdf
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/icons/constrained_triangulation.png b/3rdparty/CGAL/demo/Triangulation_2/icons/constrained_triangulation.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/icons/constrained_triangulation.png
rename to 3rdparty/CGAL/demo/Triangulation_2/icons/constrained_triangulation.png
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/icons/constrained_triangulation_show_constraints.pdf b/3rdparty/CGAL/demo/Triangulation_2/icons/constrained_triangulation_show_constraints.pdf
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/icons/constrained_triangulation_show_constraints.pdf
rename to 3rdparty/CGAL/demo/Triangulation_2/icons/constrained_triangulation_show_constraints.pdf
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/icons/constrained_triangulation_show_constraints.png b/3rdparty/CGAL/demo/Triangulation_2/icons/constrained_triangulation_show_constraints.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/icons/constrained_triangulation_show_constraints.png
rename to 3rdparty/CGAL/demo/Triangulation_2/icons/constrained_triangulation_show_constraints.png
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/icons/constrained_triangulation_show_in_domain.pdf b/3rdparty/CGAL/demo/Triangulation_2/icons/constrained_triangulation_show_in_domain.pdf
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/icons/constrained_triangulation_show_in_domain.pdf
rename to 3rdparty/CGAL/demo/Triangulation_2/icons/constrained_triangulation_show_in_domain.pdf
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/icons/constrained_triangulation_show_in_domain.png b/3rdparty/CGAL/demo/Triangulation_2/icons/constrained_triangulation_show_in_domain.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/icons/constrained_triangulation_show_in_domain.png
rename to 3rdparty/CGAL/demo/Triangulation_2/icons/constrained_triangulation_show_in_domain.png
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/icons/moving_point.pdf b/3rdparty/CGAL/demo/Triangulation_2/icons/moving_point.pdf
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/icons/moving_point.pdf
rename to 3rdparty/CGAL/demo/Triangulation_2/icons/moving_point.pdf
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/icons/moving_point.png b/3rdparty/CGAL/demo/Triangulation_2/icons/moving_point.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/icons/moving_point.png
rename to 3rdparty/CGAL/demo/Triangulation_2/icons/moving_point.png
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/icons/triangulation.pdf b/3rdparty/CGAL/demo/Triangulation_2/icons/triangulation.pdf
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/icons/triangulation.pdf
rename to 3rdparty/CGAL/demo/Triangulation_2/icons/triangulation.pdf
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/icons/triangulation.png b/3rdparty/CGAL/demo/Triangulation_2/icons/triangulation.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/icons/triangulation.png
rename to 3rdparty/CGAL/demo/Triangulation_2/icons/triangulation.png
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_2/include/CGAL/Lipschitz_sizing_field_criteria_2.h b/3rdparty/CGAL/demo/Triangulation_2/include/CGAL/Lipschitz_sizing_field_criteria_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_2/include/CGAL/Lipschitz_sizing_field_criteria_2.h
rename to 3rdparty/CGAL/demo/Triangulation_2/include/CGAL/Lipschitz_sizing_field_criteria_2.h
diff --git a/3rdparty/CGAL/demo/Triangulation_3/CMakeLists.txt b/3rdparty/CGAL/demo/Triangulation_3/CMakeLists.txt
new file mode 100644
index 0000000..9c375c3
--- /dev/null
+++ b/3rdparty/CGAL/demo/Triangulation_3/CMakeLists.txt
@@ -0,0 +1,99 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+project (Triangulation_demo_3)
+
+# Find includes in corresponding build directories
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+# Instruct CMake to run moc automatically when needed.
+set(CMAKE_AUTOMOC ON)
+
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+find_package(CGAL  COMPONENTS Qt5)
+include(${CGAL_USE_FILE})
+
+
+find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL)
+
+find_package(OpenGL)
+
+if(Qt5_FOUND)
+  add_definitions(-DQT_NO_KEYWORDS)
+  find_package(QGLViewer)
+endif(Qt5_FOUND)
+
+# Activate concurrency ? (turned OFF by default)
+option(ACTIVATE_CONCURRENT_TRIANGULATION_3
+  "Activate parallelism in Triangulation_3"
+  OFF)
+  
+# And add -DCGAL_CONCURRENT_TRIANGULATION_3 if that option is ON
+if( ACTIVATE_CONCURRENT_TRIANGULATION_3 )
+  add_definitions( -DCGAL_CONCURRENT_TRIANGULATION_3 )
+  find_package( TBB REQUIRED )
+else( ACTIVATE_CONCURRENT_TRIANGULATION_3 )
+  option( LINK_WITH_TBB
+    "Link with TBB anyway so we can use TBB timers for profiling"
+    ON)
+  if( LINK_WITH_TBB )
+    find_package( TBB )
+  endif( LINK_WITH_TBB )
+endif()
+
+if( TBB_FOUND )
+  include(${TBB_USE_FILE})
+endif()
+
+if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND )
+
+  include_directories (${QGLVIEWER_INCLUDE_DIR})
+  include_directories (BEFORE ../../include ./ )
+
+  # ui files, created with Qt Designer
+  qt5_wrap_ui( uis MainWindow.ui )
+
+  # qrc files (resources files, that contain icons, at least)
+  qt5_add_resources ( CGAL_Qt5_RESOURCE_FILES ./T3_demo.qrc )
+
+
+  # cpp files
+  add_executable  ( T3_demo T3_demo.cpp
+                    MainWindow.cpp Viewer.cpp
+                    PreferenceDlg.cpp
+                    Scene.cpp ${uis} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES})
+
+  qt5_use_modules(T3_demo Xml Script OpenGL)
+  add_to_cached_list( CGAL_EXECUTABLE_TARGETS T3_demo )
+
+  target_link_libraries( T3_demo ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES})
+  target_link_libraries( T3_demo ${QT_LIBRARIES} ${QGLVIEWER_LIBRARIES} ${TBB_LIBRARIES})
+  target_link_libraries( T3_demo ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
+
+else( CGAL_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND )
+
+  set(TRIANGULATION_3_MISSING_DEPS "")
+
+  if(NOT CGAL_Qt5_FOUND)
+    set(TRIANGULATION_3_MISSING_DEPS "the CGAL Qt5 library, ${TRIANGULATION_3_MISSING_DEPS}")
+  endif()      	   
+
+  if(NOT Qt5_FOUND)
+    set(TRIANGULATION_3_MISSING_DEPS "Qt5, ${TRIANGULATION_3_MISSING_DEPS}")
+  endif()      	   
+
+  if(NOT OPENGL_FOUND)
+    set(TRIANGULATION_3_MISSING_DEPS "OpenGL, ${TRIANGULATION_3_MISSING_DEPS}")
+  endif()      	   
+
+  if(NOT QGLVIEWER_FOUND)
+    set(TRIANGULATION_3_MISSING_DEPS "QGLViewer, ${TRIANGULATION_3_MISSING_DEPS}")
+  endif()      	   
+
+
+  message(STATUS "NOTICE: This demo requires ${TRIANGULATION_3_MISSING_DEPS}and will not be compiled.")
+
+endif( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND )
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/MainWindow.cpp b/3rdparty/CGAL/demo/Triangulation_3/MainWindow.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/MainWindow.cpp
rename to 3rdparty/CGAL/demo/Triangulation_3/MainWindow.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/MainWindow.h b/3rdparty/CGAL/demo/Triangulation_3/MainWindow.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/MainWindow.h
rename to 3rdparty/CGAL/demo/Triangulation_3/MainWindow.h
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/MainWindow.ui b/3rdparty/CGAL/demo/Triangulation_3/MainWindow.ui
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/MainWindow.ui
rename to 3rdparty/CGAL/demo/Triangulation_3/MainWindow.ui
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/PreferenceDlg.cpp b/3rdparty/CGAL/demo/Triangulation_3/PreferenceDlg.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/PreferenceDlg.cpp
rename to 3rdparty/CGAL/demo/Triangulation_3/PreferenceDlg.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/PreferenceDlg.h b/3rdparty/CGAL/demo/Triangulation_3/PreferenceDlg.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/PreferenceDlg.h
rename to 3rdparty/CGAL/demo/Triangulation_3/PreferenceDlg.h
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/Scene.cpp b/3rdparty/CGAL/demo/Triangulation_3/Scene.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/Scene.cpp
rename to 3rdparty/CGAL/demo/Triangulation_3/Scene.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/Scene.h b/3rdparty/CGAL/demo/Triangulation_3/Scene.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/Scene.h
rename to 3rdparty/CGAL/demo/Triangulation_3/Scene.h
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/T3_demo.cpp b/3rdparty/CGAL/demo/Triangulation_3/T3_demo.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/T3_demo.cpp
rename to 3rdparty/CGAL/demo/Triangulation_3/T3_demo.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/T3_demo.qrc b/3rdparty/CGAL/demo/Triangulation_3/T3_demo.qrc
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/T3_demo.qrc
rename to 3rdparty/CGAL/demo/Triangulation_3/T3_demo.qrc
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/Viewer.cpp b/3rdparty/CGAL/demo/Triangulation_3/Viewer.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/Viewer.cpp
rename to 3rdparty/CGAL/demo/Triangulation_3/Viewer.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/Viewer.h b/3rdparty/CGAL/demo/Triangulation_3/Viewer.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/Viewer.h
rename to 3rdparty/CGAL/demo/Triangulation_3/Viewer.h
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/documentation/about.html b/3rdparty/CGAL/demo/Triangulation_3/documentation/about.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/documentation/about.html
rename to 3rdparty/CGAL/demo/Triangulation_3/documentation/about.html
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/documentation/about_CGAL.html b/3rdparty/CGAL/demo/Triangulation_3/documentation/about_CGAL.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/documentation/about_CGAL.html
rename to 3rdparty/CGAL/demo/Triangulation_3/documentation/about_CGAL.html
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/icons/about_CGAL.html b/3rdparty/CGAL/demo/Triangulation_3/icons/about_CGAL.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/icons/about_CGAL.html
rename to 3rdparty/CGAL/demo/Triangulation_3/icons/about_CGAL.html
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/icons/cgal_logo.xpm b/3rdparty/CGAL/demo/Triangulation_3/icons/cgal_logo.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/icons/cgal_logo.xpm
rename to 3rdparty/CGAL/demo/Triangulation_3/icons/cgal_logo.xpm
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/icons/clear.jpeg b/3rdparty/CGAL/demo/Triangulation_3/icons/clear.jpeg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/icons/clear.jpeg
rename to 3rdparty/CGAL/demo/Triangulation_3/icons/clear.jpeg
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/icons/coordinates.jpeg b/3rdparty/CGAL/demo/Triangulation_3/icons/coordinates.jpeg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/icons/coordinates.jpeg
rename to 3rdparty/CGAL/demo/Triangulation_3/icons/coordinates.jpeg
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/icons/empty_sphere.jpeg b/3rdparty/CGAL/demo/Triangulation_3/icons/empty_sphere.jpeg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/icons/empty_sphere.jpeg
rename to 3rdparty/CGAL/demo/Triangulation_3/icons/empty_sphere.jpeg
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/icons/fileOpen.png b/3rdparty/CGAL/demo/Triangulation_3/icons/fileOpen.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/icons/fileOpen.png
rename to 3rdparty/CGAL/demo/Triangulation_3/icons/fileOpen.png
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/icons/fileSave.png b/3rdparty/CGAL/demo/Triangulation_3/icons/fileSave.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/icons/fileSave.png
rename to 3rdparty/CGAL/demo/Triangulation_3/icons/fileSave.png
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/icons/flat.png b/3rdparty/CGAL/demo/Triangulation_3/icons/flat.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/icons/flat.png
rename to 3rdparty/CGAL/demo/Triangulation_3/icons/flat.png
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/icons/grid.jpeg b/3rdparty/CGAL/demo/Triangulation_3/icons/grid.jpeg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/icons/grid.jpeg
rename to 3rdparty/CGAL/demo/Triangulation_3/icons/grid.jpeg
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/icons/insert.jpeg b/3rdparty/CGAL/demo/Triangulation_3/icons/insert.jpeg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/icons/insert.jpeg
rename to 3rdparty/CGAL/demo/Triangulation_3/icons/insert.jpeg
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/icons/insert_point.jpg b/3rdparty/CGAL/demo/Triangulation_3/icons/insert_point.jpg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/icons/insert_point.jpg
rename to 3rdparty/CGAL/demo/Triangulation_3/icons/insert_point.jpg
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/icons/move_1.jpeg b/3rdparty/CGAL/demo/Triangulation_3/icons/move_1.jpeg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/icons/move_1.jpeg
rename to 3rdparty/CGAL/demo/Triangulation_3/icons/move_1.jpeg
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/icons/nearest_nb.png b/3rdparty/CGAL/demo/Triangulation_3/icons/nearest_nb.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/icons/nearest_nb.png
rename to 3rdparty/CGAL/demo/Triangulation_3/icons/nearest_nb.png
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/icons/normal_view.jpeg b/3rdparty/CGAL/demo/Triangulation_3/icons/normal_view.jpeg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/icons/normal_view.jpeg
rename to 3rdparty/CGAL/demo/Triangulation_3/icons/normal_view.jpeg
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/icons/pause.jpeg b/3rdparty/CGAL/demo/Triangulation_3/icons/pause.jpeg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/icons/pause.jpeg
rename to 3rdparty/CGAL/demo/Triangulation_3/icons/pause.jpeg
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/icons/play.jpeg b/3rdparty/CGAL/demo/Triangulation_3/icons/play.jpeg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/icons/play.jpeg
rename to 3rdparty/CGAL/demo/Triangulation_3/icons/play.jpeg
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/icons/pointRandom.png b/3rdparty/CGAL/demo/Triangulation_3/icons/pointRandom.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/icons/pointRandom.png
rename to 3rdparty/CGAL/demo/Triangulation_3/icons/pointRandom.png
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/icons/preferences.jpeg b/3rdparty/CGAL/demo/Triangulation_3/icons/preferences.jpeg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/icons/preferences.jpeg
rename to 3rdparty/CGAL/demo/Triangulation_3/icons/preferences.jpeg
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/icons/quit.jpeg b/3rdparty/CGAL/demo/Triangulation_3/icons/quit.jpeg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/icons/quit.jpeg
rename to 3rdparty/CGAL/demo/Triangulation_3/icons/quit.jpeg
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/icons/select_hand.jpeg b/3rdparty/CGAL/demo/Triangulation_3/icons/select_hand.jpeg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/icons/select_hand.jpeg
rename to 3rdparty/CGAL/demo/Triangulation_3/icons/select_hand.jpeg
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/icons/show_delaunay.jpeg b/3rdparty/CGAL/demo/Triangulation_3/icons/show_delaunay.jpeg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/icons/show_delaunay.jpeg
rename to 3rdparty/CGAL/demo/Triangulation_3/icons/show_delaunay.jpeg
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/icons/show_facet.jpeg b/3rdparty/CGAL/demo/Triangulation_3/icons/show_facet.jpeg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/icons/show_facet.jpeg
rename to 3rdparty/CGAL/demo/Triangulation_3/icons/show_facet.jpeg
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/icons/show_point.jpeg b/3rdparty/CGAL/demo/Triangulation_3/icons/show_point.jpeg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/icons/show_point.jpeg
rename to 3rdparty/CGAL/demo/Triangulation_3/icons/show_point.jpeg
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/icons/show_voronoi.jpeg b/3rdparty/CGAL/demo/Triangulation_3/icons/show_voronoi.jpeg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/icons/show_voronoi.jpeg
rename to 3rdparty/CGAL/demo/Triangulation_3/icons/show_voronoi.jpeg
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/icons/stereo.png b/3rdparty/CGAL/demo/Triangulation_3/icons/stereo.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/icons/stereo.png
rename to 3rdparty/CGAL/demo/Triangulation_3/icons/stereo.png
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/icons/stop.jpeg b/3rdparty/CGAL/demo/Triangulation_3/icons/stop.jpeg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/icons/stop.jpeg
rename to 3rdparty/CGAL/demo/Triangulation_3/icons/stop.jpeg
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3/typedefs.h b/3rdparty/CGAL/demo/Triangulation_3/typedefs.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3/typedefs.h
rename to 3rdparty/CGAL/demo/Triangulation_3/typedefs.h
diff --git a/3rdparty/CGAL/demo/Triangulation_3_Geomview_demos/CMakeLists.txt b/3rdparty/CGAL/demo/Triangulation_3_Geomview_demos/CMakeLists.txt
new file mode 100644
index 0000000..db8dc6f
--- /dev/null
+++ b/3rdparty/CGAL/demo/Triangulation_3_Geomview_demos/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Triangulation_3_Demo )
+
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  create_single_source_cgal_program( "Triangulation_3_demo.cpp" )
+  create_single_source_cgal_program( "Triangulation_3_color_demo.cpp" )
+  create_single_source_cgal_program( "Triangulation_3_remove_demo.cpp" )
+  create_single_source_cgal_program( "Triangulation_3_voronoi_demo.cpp" )
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3_Geomview_demos/README b/3rdparty/CGAL/demo/Triangulation_3_Geomview_demos/README
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3_Geomview_demos/README
rename to 3rdparty/CGAL/demo/Triangulation_3_Geomview_demos/README
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3_Geomview_demos/Triangulation_3_color_demo.cpp b/3rdparty/CGAL/demo/Triangulation_3_Geomview_demos/Triangulation_3_color_demo.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3_Geomview_demos/Triangulation_3_color_demo.cpp
rename to 3rdparty/CGAL/demo/Triangulation_3_Geomview_demos/Triangulation_3_color_demo.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3_Geomview_demos/Triangulation_3_demo.cpp b/3rdparty/CGAL/demo/Triangulation_3_Geomview_demos/Triangulation_3_demo.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3_Geomview_demos/Triangulation_3_demo.cpp
rename to 3rdparty/CGAL/demo/Triangulation_3_Geomview_demos/Triangulation_3_demo.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3_Geomview_demos/Triangulation_3_remove_demo.cpp b/3rdparty/CGAL/demo/Triangulation_3_Geomview_demos/Triangulation_3_remove_demo.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3_Geomview_demos/Triangulation_3_remove_demo.cpp
rename to 3rdparty/CGAL/demo/Triangulation_3_Geomview_demos/Triangulation_3_remove_demo.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3_Geomview_demos/Triangulation_3_voronoi_demo.cpp b/3rdparty/CGAL/demo/Triangulation_3_Geomview_demos/Triangulation_3_voronoi_demo.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3_Geomview_demos/Triangulation_3_voronoi_demo.cpp
rename to 3rdparty/CGAL/demo/Triangulation_3_Geomview_demos/Triangulation_3_voronoi_demo.cpp
diff --git a/3rdparty/CGAL-4.8/demo/Triangulation_3_Geomview_demos/data/points b/3rdparty/CGAL/demo/Triangulation_3_Geomview_demos/data/points
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Triangulation_3_Geomview_demos/data/points
rename to 3rdparty/CGAL/demo/Triangulation_3_Geomview_demos/data/points
diff --git a/3rdparty/CGAL-4.8/demo/icons/Delaunay_triangulation_2.png b/3rdparty/CGAL/demo/icons/Delaunay_triangulation_2.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/icons/Delaunay_triangulation_2.png
rename to 3rdparty/CGAL/demo/icons/Delaunay_triangulation_2.png
diff --git a/3rdparty/CGAL-4.8/demo/icons/File.qrc b/3rdparty/CGAL/demo/icons/File.qrc
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/icons/File.qrc
rename to 3rdparty/CGAL/demo/icons/File.qrc
diff --git a/3rdparty/CGAL-4.8/demo/icons/Input.qrc b/3rdparty/CGAL/demo/icons/Input.qrc
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/icons/Input.qrc
rename to 3rdparty/CGAL/demo/icons/Input.qrc
diff --git a/3rdparty/CGAL-4.8/demo/icons/Triangulation_2.qrc b/3rdparty/CGAL/demo/icons/Triangulation_2.qrc
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/icons/Triangulation_2.qrc
rename to 3rdparty/CGAL/demo/icons/Triangulation_2.qrc
diff --git a/3rdparty/CGAL-4.8/demo/icons/Voronoi_diagram_2.png b/3rdparty/CGAL/demo/icons/Voronoi_diagram_2.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/icons/Voronoi_diagram_2.png
rename to 3rdparty/CGAL/demo/icons/Voronoi_diagram_2.png
diff --git a/3rdparty/CGAL-4.8/demo/icons/fileNew.png b/3rdparty/CGAL/demo/icons/fileNew.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/icons/fileNew.png
rename to 3rdparty/CGAL/demo/icons/fileNew.png
diff --git a/3rdparty/CGAL-4.8/demo/icons/fileOpen.png b/3rdparty/CGAL/demo/icons/fileOpen.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/icons/fileOpen.png
rename to 3rdparty/CGAL/demo/icons/fileOpen.png
diff --git a/3rdparty/CGAL-4.8/demo/icons/fileSave.png b/3rdparty/CGAL/demo/icons/fileSave.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/icons/fileSave.png
rename to 3rdparty/CGAL/demo/icons/fileSave.png
diff --git a/3rdparty/CGAL-4.8/demo/icons/fit-page-32.png b/3rdparty/CGAL/demo/icons/fit-page-32.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/icons/fit-page-32.png
rename to 3rdparty/CGAL/demo/icons/fit-page-32.png
diff --git a/3rdparty/CGAL-4.8/demo/icons/inputPoint.png b/3rdparty/CGAL/demo/icons/inputPoint.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/icons/inputPoint.png
rename to 3rdparty/CGAL/demo/icons/inputPoint.png
diff --git a/3rdparty/CGAL-4.8/demo/icons/inputPoint.svg b/3rdparty/CGAL/demo/icons/inputPoint.svg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/icons/inputPoint.svg
rename to 3rdparty/CGAL/demo/icons/inputPoint.svg
diff --git a/3rdparty/CGAL-4.8/demo/icons/inputPolyline.png b/3rdparty/CGAL/demo/icons/inputPolyline.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/icons/inputPolyline.png
rename to 3rdparty/CGAL/demo/icons/inputPolyline.png
diff --git a/3rdparty/CGAL-4.8/demo/icons/license.txt b/3rdparty/CGAL/demo/icons/license.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/icons/license.txt
rename to 3rdparty/CGAL/demo/icons/license.txt
diff --git a/3rdparty/CGAL-4.8/demo/icons/zoom-best-fit.png b/3rdparty/CGAL/demo/icons/zoom-best-fit.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/icons/zoom-best-fit.png
rename to 3rdparty/CGAL/demo/icons/zoom-best-fit.png
diff --git a/3rdparty/CGAL-4.8/demo/icons/zoom-best-fit.svg b/3rdparty/CGAL/demo/icons/zoom-best-fit.svg
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/icons/zoom-best-fit.svg
rename to 3rdparty/CGAL/demo/icons/zoom-best-fit.svg
diff --git a/3rdparty/CGAL-4.8/demo/resources/CGAL.qrc b/3rdparty/CGAL/demo/resources/CGAL.qrc
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/resources/CGAL.qrc
rename to 3rdparty/CGAL/demo/resources/CGAL.qrc
diff --git a/3rdparty/CGAL-4.8/demo/resources/about_CGAL.html b/3rdparty/CGAL/demo/resources/about_CGAL.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/resources/about_CGAL.html
rename to 3rdparty/CGAL/demo/resources/about_CGAL.html
diff --git a/3rdparty/CGAL-4.8/demo/resources/cgal_logo.xpm b/3rdparty/CGAL/demo/resources/cgal_logo.xpm
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/resources/cgal_logo.xpm
rename to 3rdparty/CGAL/demo/resources/cgal_logo.xpm
diff --git a/3rdparty/CGAL-4.8/demo/resources/cgal_logo_ipe_2013.png b/3rdparty/CGAL/demo/resources/cgal_logo_ipe_2013.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/resources/cgal_logo_ipe_2013.png
rename to 3rdparty/CGAL/demo/resources/cgal_logo_ipe_2013.png
diff --git a/3rdparty/CGAL-4.8/doc_html/Manual/index.html b/3rdparty/CGAL/doc_html/Manual/index.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/doc_html/Manual/index.html
rename to 3rdparty/CGAL/doc_html/Manual/index.html
diff --git a/3rdparty/CGAL-4.8/doc_html/Manual/packages.html b/3rdparty/CGAL/doc_html/Manual/packages.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/doc_html/Manual/packages.html
rename to 3rdparty/CGAL/doc_html/Manual/packages.html
diff --git a/3rdparty/CGAL-4.8/doc_html/cgal.ico b/3rdparty/CGAL/doc_html/cgal.ico
similarity index 100%
rename from 3rdparty/CGAL-4.8/doc_html/cgal.ico
rename to 3rdparty/CGAL/doc_html/cgal.ico
diff --git a/3rdparty/CGAL-4.8/doc_html/images/cgal_2013_grey.png b/3rdparty/CGAL/doc_html/images/cgal_2013_grey.png
similarity index 100%
rename from 3rdparty/CGAL-4.8/doc_html/images/cgal_2013_grey.png
rename to 3rdparty/CGAL/doc_html/images/cgal_2013_grey.png
diff --git a/3rdparty/CGAL-4.8/doc_html/index.html b/3rdparty/CGAL/doc_html/index.html
similarity index 100%
rename from 3rdparty/CGAL-4.8/doc_html/index.html
rename to 3rdparty/CGAL/doc_html/index.html
diff --git a/3rdparty/CGAL-4.8/examples/AABB_tree/AABB_custom_example.cpp b/3rdparty/CGAL/examples/AABB_tree/AABB_custom_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/AABB_tree/AABB_custom_example.cpp
rename to 3rdparty/CGAL/examples/AABB_tree/AABB_custom_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/AABB_tree/AABB_custom_indexed_triangle_set_array_example.cpp b/3rdparty/CGAL/examples/AABB_tree/AABB_custom_indexed_triangle_set_array_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/AABB_tree/AABB_custom_indexed_triangle_set_array_example.cpp
rename to 3rdparty/CGAL/examples/AABB_tree/AABB_custom_indexed_triangle_set_array_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/AABB_tree/AABB_custom_indexed_triangle_set_example.cpp b/3rdparty/CGAL/examples/AABB_tree/AABB_custom_indexed_triangle_set_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/AABB_tree/AABB_custom_indexed_triangle_set_example.cpp
rename to 3rdparty/CGAL/examples/AABB_tree/AABB_custom_indexed_triangle_set_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/AABB_tree/AABB_custom_triangle_soup_example.cpp b/3rdparty/CGAL/examples/AABB_tree/AABB_custom_triangle_soup_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/AABB_tree/AABB_custom_triangle_soup_example.cpp
rename to 3rdparty/CGAL/examples/AABB_tree/AABB_custom_triangle_soup_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/AABB_tree/AABB_face_graph_triangle_example.cpp b/3rdparty/CGAL/examples/AABB_tree/AABB_face_graph_triangle_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/AABB_tree/AABB_face_graph_triangle_example.cpp
rename to 3rdparty/CGAL/examples/AABB_tree/AABB_face_graph_triangle_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/AABB_tree/AABB_halfedge_graph_edge_example.cpp b/3rdparty/CGAL/examples/AABB_tree/AABB_halfedge_graph_edge_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/AABB_tree/AABB_halfedge_graph_edge_example.cpp
rename to 3rdparty/CGAL/examples/AABB_tree/AABB_halfedge_graph_edge_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/AABB_tree/AABB_insertion_example.cpp b/3rdparty/CGAL/examples/AABB_tree/AABB_insertion_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/AABB_tree/AABB_insertion_example.cpp
rename to 3rdparty/CGAL/examples/AABB_tree/AABB_insertion_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/AABB_tree/AABB_polyhedron_edge_example.cpp b/3rdparty/CGAL/examples/AABB_tree/AABB_polyhedron_edge_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/AABB_tree/AABB_polyhedron_edge_example.cpp
rename to 3rdparty/CGAL/examples/AABB_tree/AABB_polyhedron_edge_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/AABB_tree/AABB_polyhedron_facet_distance_example.cpp b/3rdparty/CGAL/examples/AABB_tree/AABB_polyhedron_facet_distance_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/AABB_tree/AABB_polyhedron_facet_distance_example.cpp
rename to 3rdparty/CGAL/examples/AABB_tree/AABB_polyhedron_facet_distance_example.cpp
diff --git a/3rdparty/CGAL/examples/AABB_tree/AABB_polyhedron_facet_intersection_example.cpp b/3rdparty/CGAL/examples/AABB_tree/AABB_polyhedron_facet_intersection_example.cpp
new file mode 100644
index 0000000..426df44
--- /dev/null
+++ b/3rdparty/CGAL/examples/AABB_tree/AABB_polyhedron_facet_intersection_example.cpp
@@ -0,0 +1,90 @@
+// Author(s) : Camille Wormser, Pierre Alliez
+
+#include <iostream>
+#include <list>
+
+#include <CGAL/Simple_cartesian.h>
+#include <CGAL/AABB_tree.h>
+#include <CGAL/AABB_traits.h>
+#include <CGAL/Polyhedron_3.h>
+#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
+#include <CGAL/AABB_face_graph_triangle_primitive.h>
+
+typedef CGAL::Simple_cartesian<double> K;
+typedef K::Point_3 Point;
+typedef K::Plane_3 Plane;
+typedef K::Vector_3 Vector;
+typedef K::Segment_3 Segment;
+typedef K::Ray_3 Ray;
+typedef CGAL::Polyhedron_3<K> Polyhedron;
+typedef CGAL::AABB_face_graph_triangle_primitive<Polyhedron> Primitive;
+typedef CGAL::AABB_traits<K, Primitive> Traits;
+typedef CGAL::AABB_tree<Traits> Tree;
+typedef boost::optional< Tree::Intersection_and_primitive_id<Segment>::Type > Segment_intersection;
+typedef boost::optional< Tree::Intersection_and_primitive_id<Plane>::Type > Plane_intersection;
+typedef Tree::Primitive_id Primitive_id;
+
+int main()
+{
+    Point p(1.0, 0.0, 0.0);
+    Point q(0.0, 1.0, 0.0);
+    Point r(0.0, 0.0, 1.0);
+    Point s(0.0, 0.0, 0.0);
+    Polyhedron polyhedron;
+    polyhedron.make_tetrahedron(p, q, r, s);
+
+    // constructs AABB tree
+    Tree tree(faces(polyhedron).first, faces(polyhedron).second, polyhedron);
+
+    // constructs segment query
+    Point a(-0.2, 0.2, -0.2);
+    Point b(1.3, 0.2, 1.3);
+    Segment segment_query(a,b);
+
+    // tests intersections with segment query
+    if(tree.do_intersect(segment_query))
+        std::cout << "intersection(s)" << std::endl;
+    else
+        std::cout << "no intersection" << std::endl;
+
+    // computes #intersections with segment query
+    std::cout << tree.number_of_intersected_primitives(segment_query)
+        << " intersection(s)" << std::endl;
+
+    // computes first encountered intersection with segment query
+    // (generally a point)
+    Segment_intersection intersection =
+        tree.any_intersection(segment_query);
+    if(intersection)
+    {
+        // gets intersection object
+      const Point* p = boost::get<Point>(&(intersection->first));
+      if(p)
+        std::cout << "intersection object is a point " << *p << std::endl;
+
+    }
+
+    // computes all intersections with segment query (as pairs object - primitive_id)
+    std::list<Segment_intersection> intersections;
+    tree.all_intersections(segment_query, std::back_inserter(intersections));
+
+    // computes all intersected primitives with segment query as primitive ids
+    std::list<Primitive_id> primitives;
+    tree.all_intersected_primitives(segment_query, std::back_inserter(primitives));
+
+    // constructs plane query
+    Vector vec(0.0,0.0,1.0);
+    Plane plane_query(a,vec);
+
+    // computes first encountered intersection with plane query
+    // (generally a segment)
+    Plane_intersection plane_intersection = tree.any_intersection(plane_query);
+    if(plane_intersection)
+    {
+      
+      if(boost::get<Segment>(&(plane_intersection->first)))
+            std::cout << "intersection object is a segment" << std::endl;
+    }
+    
+    return EXIT_SUCCESS;
+}
diff --git a/3rdparty/CGAL/examples/AABB_tree/AABB_ray_shooting_example.cpp b/3rdparty/CGAL/examples/AABB_tree/AABB_ray_shooting_example.cpp
new file mode 100644
index 0000000..0804ae9
--- /dev/null
+++ b/3rdparty/CGAL/examples/AABB_tree/AABB_ray_shooting_example.cpp
@@ -0,0 +1,72 @@
+#include <iostream>
+#include <fstream>
+
+#include <CGAL/Simple_cartesian.h>
+#include <CGAL/AABB_tree.h>
+#include <CGAL/AABB_traits.h>
+#include <CGAL/Surface_mesh.h>
+#include <CGAL/AABB_face_graph_triangle_primitive.h>
+#include <CGAL/Polygon_mesh_processing/compute_normal.h>
+#include <CGAL/Polygon_mesh_processing/orientation.h>
+
+typedef CGAL::Simple_cartesian<double> K;
+typedef K::FT FT;
+typedef K::Point_3 Point;
+typedef K::Vector_3 Vector;
+typedef K::Ray_3 Ray;
+
+typedef CGAL::Surface_mesh<Point> Mesh;
+typedef boost::graph_traits<Mesh>::face_descriptor face_descriptor;
+typedef boost::graph_traits<Mesh>::halfedge_descriptor halfedge_descriptor;
+
+typedef CGAL::AABB_face_graph_triangle_primitive<Mesh> Primitive;
+typedef CGAL::AABB_traits<K, Primitive> Traits;
+typedef CGAL::AABB_tree<Traits> Tree;
+typedef boost::optional<Tree::Intersection_and_primitive_id<Ray>::Type> Ray_intersection;
+
+
+struct Skip {
+  face_descriptor fd;
+
+  Skip(const face_descriptor fd)
+    : fd(fd)
+  {}
+
+  bool operator()(const face_descriptor& t) const
+  { if(t == fd){
+      std::cerr << "ignore" << t  <<std::endl;
+    };
+    return(t == fd);
+  }
+  
+};
+
+int main(int argc, char* argv[])
+{
+  const char* filename = (argc > 1) ? argv[1] : "data/tetrahedron.off";
+  std::ifstream input(filename);
+  Mesh mesh;
+  input >> mesh;
+  Tree tree(faces(mesh).first, faces(mesh).second, mesh);
+  
+  double d = CGAL::Polygon_mesh_processing::is_outward_oriented(mesh)?-1:1;
+
+  BOOST_FOREACH(face_descriptor fd, faces(mesh)){
+    halfedge_descriptor hd = halfedge(fd,mesh);
+    Point p = CGAL::centroid(mesh.point(source(hd,mesh)),
+                             mesh.point(target(hd,mesh)),
+                             mesh.point(target(next(hd,mesh),mesh)));
+    Vector v = CGAL::Polygon_mesh_processing::compute_face_normal(fd,mesh);	
+    
+    Ray ray(p,d * v);
+    Ray_intersection intersection = tree.first_intersection(ray);
+    if(intersection){
+      if(boost::get<Point>(&(intersection->first))){
+        const Point* p =  boost::get<Point>(&(intersection->first) );
+        std::cout <<  *p << std::endl;
+      }
+    }
+  }
+  std::cerr << "done" << std::endl;
+  return 0;
+}
diff --git a/3rdparty/CGAL-4.8/examples/AABB_tree/AABB_segment_3_example.cpp b/3rdparty/CGAL/examples/AABB_tree/AABB_segment_3_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/AABB_tree/AABB_segment_3_example.cpp
rename to 3rdparty/CGAL/examples/AABB_tree/AABB_segment_3_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/AABB_tree/AABB_triangle_3_example.cpp b/3rdparty/CGAL/examples/AABB_tree/AABB_triangle_3_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/AABB_tree/AABB_triangle_3_example.cpp
rename to 3rdparty/CGAL/examples/AABB_tree/AABB_triangle_3_example.cpp
diff --git a/3rdparty/CGAL/examples/AABB_tree/CMakeLists.txt b/3rdparty/CGAL/examples/AABB_tree/CMakeLists.txt
new file mode 100644
index 0000000..cf2e674
--- /dev/null
+++ b/3rdparty/CGAL/examples/AABB_tree/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( AABB_tree_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL/examples/AABB_tree/data/tetrahedron.off b/3rdparty/CGAL/examples/AABB_tree/data/tetrahedron.off
new file mode 100644
index 0000000..5c641a7
--- /dev/null
+++ b/3rdparty/CGAL/examples/AABB_tree/data/tetrahedron.off
@@ -0,0 +1,11 @@
+OFF
+4 4 0
+0.0 0.0 0.0
+1.0 0.0 0.0
+0.0 1.0 0.0
+0.0 0.0 1.0
+3 0 1 2
+3 0 3 1
+3 0 2 3
+3 1 3 2
+
diff --git a/3rdparty/CGAL/examples/Advancing_front_surface_reconstruction/CMakeLists.txt b/3rdparty/CGAL/examples/Advancing_front_surface_reconstruction/CMakeLists.txt
new file mode 100644
index 0000000..3336b19
--- /dev/null
+++ b/3rdparty/CGAL/examples/Advancing_front_surface_reconstruction/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Advancing_front_surface_reconstruction_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Advancing_front_surface_reconstruction/boundaries.cpp b/3rdparty/CGAL/examples/Advancing_front_surface_reconstruction/boundaries.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Advancing_front_surface_reconstruction/boundaries.cpp
rename to 3rdparty/CGAL/examples/Advancing_front_surface_reconstruction/boundaries.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Advancing_front_surface_reconstruction/data/half.xyz b/3rdparty/CGAL/examples/Advancing_front_surface_reconstruction/data/half.xyz
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Advancing_front_surface_reconstruction/data/half.xyz
rename to 3rdparty/CGAL/examples/Advancing_front_surface_reconstruction/data/half.xyz
diff --git a/3rdparty/CGAL-4.8/examples/Advancing_front_surface_reconstruction/reconstruction_class.cpp b/3rdparty/CGAL/examples/Advancing_front_surface_reconstruction/reconstruction_class.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Advancing_front_surface_reconstruction/reconstruction_class.cpp
rename to 3rdparty/CGAL/examples/Advancing_front_surface_reconstruction/reconstruction_class.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Advancing_front_surface_reconstruction/reconstruction_fct.cpp b/3rdparty/CGAL/examples/Advancing_front_surface_reconstruction/reconstruction_fct.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Advancing_front_surface_reconstruction/reconstruction_fct.cpp
rename to 3rdparty/CGAL/examples/Advancing_front_surface_reconstruction/reconstruction_fct.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Advancing_front_surface_reconstruction/reconstruction_surface_mesh.cpp b/3rdparty/CGAL/examples/Advancing_front_surface_reconstruction/reconstruction_surface_mesh.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Advancing_front_surface_reconstruction/reconstruction_surface_mesh.cpp
rename to 3rdparty/CGAL/examples/Advancing_front_surface_reconstruction/reconstruction_surface_mesh.cpp
diff --git a/3rdparty/CGAL/examples/Algebraic_foundations/CMakeLists.txt b/3rdparty/CGAL/examples/Algebraic_foundations/CMakeLists.txt
new file mode 100644
index 0000000..dc98893
--- /dev/null
+++ b/3rdparty/CGAL/examples/Algebraic_foundations/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Algebraic_foundations_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Algebraic_foundations/algebraic_structure_dispatch.cpp b/3rdparty/CGAL/examples/Algebraic_foundations/algebraic_structure_dispatch.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Algebraic_foundations/algebraic_structure_dispatch.cpp
rename to 3rdparty/CGAL/examples/Algebraic_foundations/algebraic_structure_dispatch.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Algebraic_foundations/fraction_traits.cpp b/3rdparty/CGAL/examples/Algebraic_foundations/fraction_traits.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Algebraic_foundations/fraction_traits.cpp
rename to 3rdparty/CGAL/examples/Algebraic_foundations/fraction_traits.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Algebraic_foundations/implicit_interoperable_dispatch.cpp b/3rdparty/CGAL/examples/Algebraic_foundations/implicit_interoperable_dispatch.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Algebraic_foundations/implicit_interoperable_dispatch.cpp
rename to 3rdparty/CGAL/examples/Algebraic_foundations/implicit_interoperable_dispatch.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Algebraic_foundations/integralize.cpp b/3rdparty/CGAL/examples/Algebraic_foundations/integralize.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Algebraic_foundations/integralize.cpp
rename to 3rdparty/CGAL/examples/Algebraic_foundations/integralize.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Algebraic_foundations/interoperable.cpp b/3rdparty/CGAL/examples/Algebraic_foundations/interoperable.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Algebraic_foundations/interoperable.cpp
rename to 3rdparty/CGAL/examples/Algebraic_foundations/interoperable.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Algebraic_kernel_d/CMakeLists.txt b/3rdparty/CGAL/examples/Algebraic_kernel_d/CMakeLists.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Algebraic_kernel_d/CMakeLists.txt
rename to 3rdparty/CGAL/examples/Algebraic_kernel_d/CMakeLists.txt
diff --git a/3rdparty/CGAL-4.8/examples/Algebraic_kernel_d/Compare_1.cpp b/3rdparty/CGAL/examples/Algebraic_kernel_d/Compare_1.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Algebraic_kernel_d/Compare_1.cpp
rename to 3rdparty/CGAL/examples/Algebraic_kernel_d/Compare_1.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Algebraic_kernel_d/Construct_algebraic_real_1.cpp b/3rdparty/CGAL/examples/Algebraic_kernel_d/Construct_algebraic_real_1.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Algebraic_kernel_d/Construct_algebraic_real_1.cpp
rename to 3rdparty/CGAL/examples/Algebraic_kernel_d/Construct_algebraic_real_1.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Algebraic_kernel_d/Isolate_1.cpp b/3rdparty/CGAL/examples/Algebraic_kernel_d/Isolate_1.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Algebraic_kernel_d/Isolate_1.cpp
rename to 3rdparty/CGAL/examples/Algebraic_kernel_d/Isolate_1.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Algebraic_kernel_d/Sign_at_1.cpp b/3rdparty/CGAL/examples/Algebraic_kernel_d/Sign_at_1.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Algebraic_kernel_d/Sign_at_1.cpp
rename to 3rdparty/CGAL/examples/Algebraic_kernel_d/Sign_at_1.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Algebraic_kernel_d/Solve_1.cpp b/3rdparty/CGAL/examples/Algebraic_kernel_d/Solve_1.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Algebraic_kernel_d/Solve_1.cpp
rename to 3rdparty/CGAL/examples/Algebraic_kernel_d/Solve_1.cpp
diff --git a/3rdparty/CGAL/examples/Alpha_shapes_2/CMakeLists.txt b/3rdparty/CGAL/examples/Alpha_shapes_2/CMakeLists.txt
new file mode 100644
index 0000000..836e471
--- /dev/null
+++ b/3rdparty/CGAL/examples/Alpha_shapes_2/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Alpha_shapes_2_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Alpha_shapes_2/README b/3rdparty/CGAL/examples/Alpha_shapes_2/README
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Alpha_shapes_2/README
rename to 3rdparty/CGAL/examples/Alpha_shapes_2/README
diff --git a/3rdparty/CGAL-4.8/examples/Alpha_shapes_2/data/fin b/3rdparty/CGAL/examples/Alpha_shapes_2/data/fin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Alpha_shapes_2/data/fin
rename to 3rdparty/CGAL/examples/Alpha_shapes_2/data/fin
diff --git a/3rdparty/CGAL-4.8/examples/Alpha_shapes_2/ex_alpha_shapes_2.cpp b/3rdparty/CGAL/examples/Alpha_shapes_2/ex_alpha_shapes_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Alpha_shapes_2/ex_alpha_shapes_2.cpp
rename to 3rdparty/CGAL/examples/Alpha_shapes_2/ex_alpha_shapes_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Alpha_shapes_2/ex_weighted_alpha_shapes_2.cpp b/3rdparty/CGAL/examples/Alpha_shapes_2/ex_weighted_alpha_shapes_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Alpha_shapes_2/ex_weighted_alpha_shapes_2.cpp
rename to 3rdparty/CGAL/examples/Alpha_shapes_2/ex_weighted_alpha_shapes_2.cpp
diff --git a/3rdparty/CGAL/examples/Alpha_shapes_3/CMakeLists.txt b/3rdparty/CGAL/examples/Alpha_shapes_3/CMakeLists.txt
new file mode 100644
index 0000000..e2fd4e3
--- /dev/null
+++ b/3rdparty/CGAL/examples/Alpha_shapes_3/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Alpha_shapes_3_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Alpha_shapes_3/README b/3rdparty/CGAL/examples/Alpha_shapes_3/README
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Alpha_shapes_3/README
rename to 3rdparty/CGAL/examples/Alpha_shapes_3/README
diff --git a/3rdparty/CGAL-4.8/examples/Alpha_shapes_3/data/bunny_1000 b/3rdparty/CGAL/examples/Alpha_shapes_3/data/bunny_1000
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Alpha_shapes_3/data/bunny_1000
rename to 3rdparty/CGAL/examples/Alpha_shapes_3/data/bunny_1000
diff --git a/3rdparty/CGAL-4.8/examples/Alpha_shapes_3/data/bunny_5000 b/3rdparty/CGAL/examples/Alpha_shapes_3/data/bunny_5000
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Alpha_shapes_3/data/bunny_5000
rename to 3rdparty/CGAL/examples/Alpha_shapes_3/data/bunny_5000
diff --git a/3rdparty/CGAL-4.8/examples/Alpha_shapes_3/data/fin b/3rdparty/CGAL/examples/Alpha_shapes_3/data/fin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Alpha_shapes_3/data/fin
rename to 3rdparty/CGAL/examples/Alpha_shapes_3/data/fin
diff --git a/3rdparty/CGAL-4.8/examples/Alpha_shapes_3/ex_alpha_shapes_3.cpp b/3rdparty/CGAL/examples/Alpha_shapes_3/ex_alpha_shapes_3.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Alpha_shapes_3/ex_alpha_shapes_3.cpp
rename to 3rdparty/CGAL/examples/Alpha_shapes_3/ex_alpha_shapes_3.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Alpha_shapes_3/ex_alpha_shapes_exact_alpha.cpp b/3rdparty/CGAL/examples/Alpha_shapes_3/ex_alpha_shapes_exact_alpha.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Alpha_shapes_3/ex_alpha_shapes_exact_alpha.cpp
rename to 3rdparty/CGAL/examples/Alpha_shapes_3/ex_alpha_shapes_exact_alpha.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Alpha_shapes_3/ex_alpha_shapes_with_fast_location_3.cpp b/3rdparty/CGAL/examples/Alpha_shapes_3/ex_alpha_shapes_with_fast_location_3.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Alpha_shapes_3/ex_alpha_shapes_with_fast_location_3.cpp
rename to 3rdparty/CGAL/examples/Alpha_shapes_3/ex_alpha_shapes_with_fast_location_3.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Alpha_shapes_3/ex_fixed_weighted_alpha_shapes_3.cpp b/3rdparty/CGAL/examples/Alpha_shapes_3/ex_fixed_weighted_alpha_shapes_3.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Alpha_shapes_3/ex_fixed_weighted_alpha_shapes_3.cpp
rename to 3rdparty/CGAL/examples/Alpha_shapes_3/ex_fixed_weighted_alpha_shapes_3.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Alpha_shapes_3/ex_periodic_alpha_shapes_3.cpp b/3rdparty/CGAL/examples/Alpha_shapes_3/ex_periodic_alpha_shapes_3.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Alpha_shapes_3/ex_periodic_alpha_shapes_3.cpp
rename to 3rdparty/CGAL/examples/Alpha_shapes_3/ex_periodic_alpha_shapes_3.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Alpha_shapes_3/ex_weighted_alpha_shapes_3.cpp b/3rdparty/CGAL/examples/Alpha_shapes_3/ex_weighted_alpha_shapes_3.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Alpha_shapes_3/ex_weighted_alpha_shapes_3.cpp
rename to 3rdparty/CGAL/examples/Alpha_shapes_3/ex_weighted_alpha_shapes_3.cpp
diff --git a/3rdparty/CGAL/examples/Apollonius_graph_2/CMakeLists.txt b/3rdparty/CGAL/examples/Apollonius_graph_2/CMakeLists.txt
new file mode 100644
index 0000000..e0cdb3a
--- /dev/null
+++ b/3rdparty/CGAL/examples/Apollonius_graph_2/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Apollonius_graph_2_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET COMPONENTS Core )
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Apollonius_graph_2/README b/3rdparty/CGAL/examples/Apollonius_graph_2/README
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Apollonius_graph_2/README
rename to 3rdparty/CGAL/examples/Apollonius_graph_2/README
diff --git a/3rdparty/CGAL-4.8/examples/Apollonius_graph_2/ag2_exact_traits.cpp b/3rdparty/CGAL/examples/Apollonius_graph_2/ag2_exact_traits.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Apollonius_graph_2/ag2_exact_traits.cpp
rename to 3rdparty/CGAL/examples/Apollonius_graph_2/ag2_exact_traits.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Apollonius_graph_2/ag2_exact_traits_sqrt.cpp b/3rdparty/CGAL/examples/Apollonius_graph_2/ag2_exact_traits_sqrt.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Apollonius_graph_2/ag2_exact_traits_sqrt.cpp
rename to 3rdparty/CGAL/examples/Apollonius_graph_2/ag2_exact_traits_sqrt.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Apollonius_graph_2/ag2_filtered_traits_no_hidden.cpp b/3rdparty/CGAL/examples/Apollonius_graph_2/ag2_filtered_traits_no_hidden.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Apollonius_graph_2/ag2_filtered_traits_no_hidden.cpp
rename to 3rdparty/CGAL/examples/Apollonius_graph_2/ag2_filtered_traits_no_hidden.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Apollonius_graph_2/ag2_hierarchy.cpp b/3rdparty/CGAL/examples/Apollonius_graph_2/ag2_hierarchy.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Apollonius_graph_2/ag2_hierarchy.cpp
rename to 3rdparty/CGAL/examples/Apollonius_graph_2/ag2_hierarchy.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Apollonius_graph_2/data/hierarchy.cin b/3rdparty/CGAL/examples/Apollonius_graph_2/data/hierarchy.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Apollonius_graph_2/data/hierarchy.cin
rename to 3rdparty/CGAL/examples/Apollonius_graph_2/data/hierarchy.cin
diff --git a/3rdparty/CGAL-4.8/examples/Apollonius_graph_2/data/sites.cin b/3rdparty/CGAL/examples/Apollonius_graph_2/data/sites.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Apollonius_graph_2/data/sites.cin
rename to 3rdparty/CGAL/examples/Apollonius_graph_2/data/sites.cin
diff --git a/3rdparty/CGAL-4.8/examples/Approximate_min_ellipsoid_d/CMakeLists.txt b/3rdparty/CGAL/examples/Approximate_min_ellipsoid_d/CMakeLists.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Approximate_min_ellipsoid_d/CMakeLists.txt
rename to 3rdparty/CGAL/examples/Approximate_min_ellipsoid_d/CMakeLists.txt
diff --git a/3rdparty/CGAL-4.8/examples/Approximate_min_ellipsoid_d/ellipsoid.cpp b/3rdparty/CGAL/examples/Approximate_min_ellipsoid_d/ellipsoid.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Approximate_min_ellipsoid_d/ellipsoid.cpp
rename to 3rdparty/CGAL/examples/Approximate_min_ellipsoid_d/ellipsoid.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Approximate_min_ellipsoid_d/ellipsoid_for_maple.cpp b/3rdparty/CGAL/examples/Approximate_min_ellipsoid_d/ellipsoid_for_maple.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Approximate_min_ellipsoid_d/ellipsoid_for_maple.cpp
rename to 3rdparty/CGAL/examples/Approximate_min_ellipsoid_d/ellipsoid_for_maple.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/Bezier.dat b/3rdparty/CGAL/examples/Arrangement_on_surface_2/Bezier.dat
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/Bezier.dat
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/Bezier.dat
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/Bezier_curves.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/Bezier_curves.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/Bezier_curves.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/Bezier_curves.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/Bezier_polycurve.dat b/3rdparty/CGAL/examples/Arrangement_on_surface_2/Bezier_polycurve.dat
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/Bezier_polycurve.dat
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/Bezier_polycurve.dat
diff --git a/3rdparty/CGAL/examples/Arrangement_on_surface_2/CMakeLists.txt b/3rdparty/CGAL/examples/Arrangement_on_surface_2/CMakeLists.txt
new file mode 100644
index 0000000..1825ea2
--- /dev/null
+++ b/3rdparty/CGAL/examples/Arrangement_on_surface_2/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Arrangement_on_surface_2_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET COMPONENTS Core)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/Europe.dat b/3rdparty/CGAL/examples/Arrangement_on_surface_2/Europe.dat
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/Europe.dat
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/Europe.dat
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/aggregated_insertion.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/aggregated_insertion.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/aggregated_insertion.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/aggregated_insertion.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/algebraic_curves.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/algebraic_curves.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/algebraic_curves.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/algebraic_curves.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/algebraic_segments.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/algebraic_segments.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/algebraic_segments.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/algebraic_segments.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/arr_inexact_construction_segments.h b/3rdparty/CGAL/examples/Arrangement_on_surface_2/arr_inexact_construction_segments.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/arr_inexact_construction_segments.h
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/arr_inexact_construction_segments.h
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/arr_print.h b/3rdparty/CGAL/examples/Arrangement_on_surface_2/arr_print.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/arr_print.h
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/arr_print.h
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/batched_point_location.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/batched_point_location.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/batched_point_location.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/batched_point_location.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/bgl_dual_adapter.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/bgl_dual_adapter.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/bgl_dual_adapter.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/bgl_dual_adapter.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/bgl_primal_adapter.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/bgl_primal_adapter.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/bgl_primal_adapter.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/bgl_primal_adapter.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/bounded_planar_vertical_decomposition.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/bounded_planar_vertical_decomposition.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/bounded_planar_vertical_decomposition.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/bounded_planar_vertical_decomposition.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/circles.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/circles.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/circles.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/circles.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/circular_arcs.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/circular_arcs.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/circular_arcs.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/circular_arcs.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/circular_line_arcs.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/circular_line_arcs.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/circular_line_arcs.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/circular_line_arcs.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/coll_points.dat b/3rdparty/CGAL/examples/Arrangement_on_surface_2/coll_points.dat
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/coll_points.dat
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/coll_points.dat
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/conic_multiplicities.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/conic_multiplicities.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/conic_multiplicities.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/conic_multiplicities.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/conics.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/conics.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/conics.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/conics.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/consolidated_curve_data.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/consolidated_curve_data.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/consolidated_curve_data.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/consolidated_curve_data.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/curve_history.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/curve_history.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/curve_history.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/curve_history.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/dcel_extension.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/dcel_extension.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/dcel_extension.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/dcel_extension.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/dcel_extension_io.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/dcel_extension_io.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/dcel_extension_io.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/dcel_extension_io.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/dual_lines.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/dual_lines.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/dual_lines.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/dual_lines.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/dual_with_data.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/dual_with_data.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/dual_with_data.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/dual_with_data.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/edge_insertion.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/edge_insertion.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/edge_insertion.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/edge_insertion.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/edge_manipulation.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/edge_manipulation.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/edge_manipulation.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/edge_manipulation.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/edge_manipulation_curve_history.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/edge_manipulation_curve_history.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/edge_manipulation_curve_history.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/edge_manipulation_curve_history.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/face_extension.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/face_extension.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/face_extension.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/face_extension.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/face_extension_overlay.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/face_extension_overlay.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/face_extension_overlay.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/face_extension_overlay.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/fan_grids.dat b/3rdparty/CGAL/examples/Arrangement_on_surface_2/fan_grids.dat
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/fan_grids.dat
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/fan_grids.dat
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/generic_curve_data.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/generic_curve_data.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/generic_curve_data.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/generic_curve_data.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/global_insertion.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/global_insertion.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/global_insertion.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/global_insertion.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/global_removal.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/global_removal.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/global_removal.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/global_removal.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/incremental_insertion.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/incremental_insertion.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/incremental_insertion.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/incremental_insertion.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/io.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/io.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/io.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/io.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/io_curve_history.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/io_curve_history.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/io_curve_history.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/io_curve_history.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/io_unbounded.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/io_unbounded.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/io_unbounded.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/io_unbounded.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/isolated_vertices.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/isolated_vertices.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/isolated_vertices.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/isolated_vertices.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/observer.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/observer.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/observer.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/observer.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/overlay.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/overlay.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/overlay.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/overlay.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/overlay_unbounded.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/overlay_unbounded.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/overlay_unbounded.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/overlay_unbounded.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/point_location_example.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/point_location_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/point_location_example.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/point_location_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/point_location_utils.h b/3rdparty/CGAL/examples/Arrangement_on_surface_2/point_location_utils.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/point_location_utils.h
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/point_location_utils.h
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/points.dat b/3rdparty/CGAL/examples/Arrangement_on_surface_2/points.dat
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/points.dat
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/points.dat
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/polycurve_bezier.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/polycurve_bezier.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/polycurve_bezier.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/polycurve_bezier.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/polycurve_circular_arc.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/polycurve_circular_arc.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/polycurve_circular_arc.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/polycurve_circular_arc.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/polycurve_conic.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/polycurve_conic.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/polycurve_conic.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/polycurve_conic.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/polycurve_geodesic.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/polycurve_geodesic.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/polycurve_geodesic.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/polycurve_geodesic.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/polycurves_basic.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/polycurves_basic.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/polycurves_basic.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/polycurves_basic.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/polylines.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/polylines.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/polylines.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/polylines.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/predefined_kernel.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/predefined_kernel.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/predefined_kernel.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/predefined_kernel.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/predefined_kernel_non_intersecting.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/predefined_kernel_non_intersecting.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/predefined_kernel_non_intersecting.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/predefined_kernel_non_intersecting.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/rational_functions.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/rational_functions.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/rational_functions.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/rational_functions.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/rational_functions_rational_coefficients.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/rational_functions_rational_coefficients.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/rational_functions_rational_coefficients.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/rational_functions_rational_coefficients.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/special_edge_insertion.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/special_edge_insertion.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/special_edge_insertion.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/special_edge_insertion.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/spherical_insert.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/spherical_insert.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/spherical_insert.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/spherical_insert.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/tracing_counting.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/tracing_counting.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/tracing_counting.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/tracing_counting.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/unb_planar_vertical_decomposition.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/unb_planar_vertical_decomposition.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/unb_planar_vertical_decomposition.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/unb_planar_vertical_decomposition.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/unbounded_non_intersecting.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/unbounded_non_intersecting.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/unbounded_non_intersecting.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/unbounded_non_intersecting.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/unbounded_rational_functions.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/unbounded_rational_functions.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/unbounded_rational_functions.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/unbounded_rational_functions.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/vertical_ray_shooting.cpp b/3rdparty/CGAL/examples/Arrangement_on_surface_2/vertical_ray_shooting.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Arrangement_on_surface_2/vertical_ray_shooting.cpp
rename to 3rdparty/CGAL/examples/Arrangement_on_surface_2/vertical_ray_shooting.cpp
diff --git a/3rdparty/CGAL-4.8/examples/BGL_OpenMesh/CMakeLists.txt b/3rdparty/CGAL/examples/BGL_OpenMesh/CMakeLists.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/BGL_OpenMesh/CMakeLists.txt
rename to 3rdparty/CGAL/examples/BGL_OpenMesh/CMakeLists.txt
diff --git a/3rdparty/CGAL-4.8/examples/BGL_OpenMesh/TriMesh.cpp b/3rdparty/CGAL/examples/BGL_OpenMesh/TriMesh.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/BGL_OpenMesh/TriMesh.cpp
rename to 3rdparty/CGAL/examples/BGL_OpenMesh/TriMesh.cpp
diff --git a/3rdparty/CGAL-4.8/examples/BGL_arrangement_2/CMakeLists.txt b/3rdparty/CGAL/examples/BGL_arrangement_2/CMakeLists.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/BGL_arrangement_2/CMakeLists.txt
rename to 3rdparty/CGAL/examples/BGL_arrangement_2/CMakeLists.txt
diff --git a/3rdparty/CGAL-4.8/examples/BGL_arrangement_2/arr_print.h b/3rdparty/CGAL/examples/BGL_arrangement_2/arr_print.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/BGL_arrangement_2/arr_print.h
rename to 3rdparty/CGAL/examples/BGL_arrangement_2/arr_print.h
diff --git a/3rdparty/CGAL-4.8/examples/BGL_arrangement_2/arr_rational_nt.h b/3rdparty/CGAL/examples/BGL_arrangement_2/arr_rational_nt.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/BGL_arrangement_2/arr_rational_nt.h
rename to 3rdparty/CGAL/examples/BGL_arrangement_2/arr_rational_nt.h
diff --git a/3rdparty/CGAL-4.8/examples/BGL_arrangement_2/arrangement_dual.cpp b/3rdparty/CGAL/examples/BGL_arrangement_2/arrangement_dual.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/BGL_arrangement_2/arrangement_dual.cpp
rename to 3rdparty/CGAL/examples/BGL_arrangement_2/arrangement_dual.cpp
diff --git a/3rdparty/CGAL-4.8/examples/BGL_arrangement_2/primal.cpp b/3rdparty/CGAL/examples/BGL_arrangement_2/primal.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/BGL_arrangement_2/primal.cpp
rename to 3rdparty/CGAL/examples/BGL_arrangement_2/primal.cpp
diff --git a/3rdparty/CGAL/examples/BGL_polyhedron_3/CMakeLists.txt b/3rdparty/CGAL/examples/BGL_polyhedron_3/CMakeLists.txt
new file mode 100644
index 0000000..1ffa079
--- /dev/null
+++ b/3rdparty/CGAL/examples/BGL_polyhedron_3/CMakeLists.txt
@@ -0,0 +1,73 @@
+# Created by the script cgal_create_CMakeLists
+# This is the CMake script for compiling a set of CGAL applications.
+
+project( BGL_polyhedron_3 )
+
+
+cmake_minimum_required(VERSION 2.8.11)
+
+# CGAL and its components
+find_package( CGAL QUIET COMPONENTS  )
+
+if ( NOT CGAL_FOUND )
+
+  message(STATUS "This project requires the CGAL library, and will not be compiled.")
+  return()  
+
+endif()
+
+# include helper file
+include( ${CGAL_USE_FILE} )
+
+
+# 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()
+
+find_package( OpenMesh QUIET )
+
+if ( OpenMesh_FOUND )
+  include( UseOpenMesh )
+  add_definitions( -DCGAL_USE_OPENMESH )
+else()
+  message(STATUS "Examples that use OpenMesh will not be compiled.")
+endif()
+
+# include for local directory
+
+# include for local package
+include_directories( BEFORE ../../include )
+
+
+# Creating entries for all C++ files with "main" routine
+# ##########################################################
+
+include( CGAL_CreateSingleSourceCGALProgram )
+
+create_single_source_cgal_program( "distance.cpp" )
+
+create_single_source_cgal_program( "incident_vertices.cpp" )
+
+create_single_source_cgal_program( "kruskal.cpp" )
+
+create_single_source_cgal_program( "kruskal_with_stored_id.cpp" )
+
+create_single_source_cgal_program( "normals.cpp" )
+
+create_single_source_cgal_program( "range.cpp" )
+
+create_single_source_cgal_program( "transform_iterator.cpp" )
+
+create_single_source_cgal_program( "copy_polyhedron.cpp" )
+
+if(OpenMesh_FOUND)
+  target_link_libraries( copy_polyhedron ${OPENMESH_LIBRARIES} )
+endif()
+
diff --git a/3rdparty/CGAL/examples/BGL_polyhedron_3/copy_polyhedron.cpp b/3rdparty/CGAL/examples/BGL_polyhedron_3/copy_polyhedron.cpp
new file mode 100644
index 0000000..ec36c66
--- /dev/null
+++ b/3rdparty/CGAL/examples/BGL_polyhedron_3/copy_polyhedron.cpp
@@ -0,0 +1,86 @@
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
+
+#include <CGAL/Polyhedron_3.h>
+#include <CGAL/IO/Polyhedron_iostream.h>
+#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
+
+#include <CGAL/Surface_mesh.h>
+#include <CGAL/boost/graph/graph_traits_Surface_mesh.h>
+
+#if defined(CGAL_USE_OPENMESH)
+#include <OpenMesh/Core/IO/MeshIO.hh>
+#include <OpenMesh/Core/Mesh/PolyMesh_ArrayKernelT.hh>
+#include <CGAL/boost/graph/graph_traits_PolyMesh_ArrayKernelT.h>
+#endif
+
+#include <CGAL/boost/graph/copy_face_graph.h>
+
+#include <iostream>
+#include <fstream>
+#include <iterator>
+#include <boost/unordered_map.hpp>
+
+typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
+
+typedef CGAL::Polyhedron_3<Kernel>                       Source;
+typedef boost::graph_traits<Source>::vertex_descriptor   sm_vertex_descriptor;
+typedef boost::graph_traits<Source>::halfedge_descriptor sm_halfedge_descriptor;
+typedef boost::graph_traits<Source>::face_descriptor     sm_face_descriptor;
+
+typedef CGAL::Exact_predicates_exact_constructions_kernel Other_kernel;
+typedef Other_kernel::Point_3                             Point;
+
+int main(int argc, char* argv[])
+{
+  Source S;
+
+  std::ifstream in((argc>1)?argv[1]:"cube.off");
+  in >> S;
+
+  // Note that the vertex_point property of the Source and Target1
+  // come from different kernels.
+  typedef CGAL::Surface_mesh<Point> Target1;
+  Target1 T1;
+  {
+    CGAL::copy_face_graph(S, T1);
+    std::ofstream out("sm.off");
+    out << T1;
+  }
+
+#if defined(CGAL_USE_OPENMESH)
+  typedef OpenMesh::PolyMesh_ArrayKernelT</* MyTraits*/> Target2;
+  Target2 T2;
+  {
+    typedef boost::graph_traits<Target2>::vertex_descriptor   tm_vertex_descriptor;
+    typedef boost::graph_traits<Target2>::halfedge_descriptor tm_halfedge_descriptor;
+    typedef boost::graph_traits<Target2>::face_descriptor     tm_face_descriptor;
+
+    // Use an unordered_map to keep track of elements.
+    boost::unordered_map<sm_vertex_descriptor, tm_vertex_descriptor>     v2v;
+    boost::unordered_map<sm_halfedge_descriptor, tm_halfedge_descriptor> h2h;
+    boost::unordered_map<sm_face_descriptor, tm_face_descriptor>         f2f;
+    
+    CGAL::copy_face_graph(S, T2, std::inserter(v2v, v2v.end()),
+                                 std::inserter(h2h, h2h.end()),
+                                 std::inserter(f2f, f2f.end()));
+    OpenMesh::IO::write_mesh(T2, "om.off");
+  }
+#endif
+  S.clear();
+  {
+    typedef boost::graph_traits<Target1>::vertex_descriptor   source_vertex_descriptor;
+    typedef boost::graph_traits<Target1>::halfedge_descriptor source_halfedge_descriptor;
+
+    typedef boost::graph_traits<Source>::vertex_descriptor   tm_vertex_descriptor;
+    typedef boost::graph_traits<Source>::halfedge_descriptor tm_halfedge_descriptor;
+
+    boost::unordered_map<source_vertex_descriptor, tm_vertex_descriptor> v2v;
+    boost::unordered_map<source_halfedge_descriptor, tm_halfedge_descriptor> h2h;
+    
+    CGAL::copy_face_graph(T1, S, std::inserter(v2v, v2v.end()), std::inserter(h2h, h2h.end()));
+    std::ofstream out("reverse.off");
+    out << T1;
+  }
+  return 0;
+}
diff --git a/3rdparty/CGAL-4.8/examples/BGL_polyhedron_3/cube.off b/3rdparty/CGAL/examples/BGL_polyhedron_3/cube.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/BGL_polyhedron_3/cube.off
rename to 3rdparty/CGAL/examples/BGL_polyhedron_3/cube.off
diff --git a/3rdparty/CGAL-4.8/examples/BGL_polyhedron_3/distance.cmd b/3rdparty/CGAL/examples/BGL_polyhedron_3/distance.cmd
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/BGL_polyhedron_3/distance.cmd
rename to 3rdparty/CGAL/examples/BGL_polyhedron_3/distance.cmd
diff --git a/3rdparty/CGAL-4.8/examples/BGL_polyhedron_3/distance.cpp b/3rdparty/CGAL/examples/BGL_polyhedron_3/distance.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/BGL_polyhedron_3/distance.cpp
rename to 3rdparty/CGAL/examples/BGL_polyhedron_3/distance.cpp
diff --git a/3rdparty/CGAL-4.8/examples/BGL_polyhedron_3/incident_vertices.cmd b/3rdparty/CGAL/examples/BGL_polyhedron_3/incident_vertices.cmd
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/BGL_polyhedron_3/incident_vertices.cmd
rename to 3rdparty/CGAL/examples/BGL_polyhedron_3/incident_vertices.cmd
diff --git a/3rdparty/CGAL-4.8/examples/BGL_polyhedron_3/incident_vertices.cpp b/3rdparty/CGAL/examples/BGL_polyhedron_3/incident_vertices.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/BGL_polyhedron_3/incident_vertices.cpp
rename to 3rdparty/CGAL/examples/BGL_polyhedron_3/incident_vertices.cpp
diff --git a/3rdparty/CGAL/examples/BGL_polyhedron_3/kruskal.cpp b/3rdparty/CGAL/examples/BGL_polyhedron_3/kruskal.cpp
new file mode 100644
index 0000000..1080b25
--- /dev/null
+++ b/3rdparty/CGAL/examples/BGL_polyhedron_3/kruskal.cpp
@@ -0,0 +1,99 @@
+#include <CGAL/Simple_cartesian.h>
+#include <CGAL/Polyhedron_3.h>
+#include <CGAL/IO/Polyhedron_iostream.h>
+#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
+
+#include <iostream>
+#include <list>
+
+#include <boost/graph/kruskal_min_spanning_tree.hpp>
+
+
+typedef CGAL::Simple_cartesian<double>                       Kernel;
+typedef Kernel::Vector_3                                     Vector;
+typedef Kernel::Point_3                                      Point;
+typedef CGAL::Polyhedron_3<Kernel>                           Polyhedron;
+
+typedef boost::graph_traits<Polyhedron>::vertex_descriptor vertex_descriptor;
+typedef boost::graph_traits<Polyhedron>::vertex_iterator   vertex_iterator;
+typedef boost::graph_traits<Polyhedron>::edge_descriptor   edge_descriptor;
+
+// The BGL makes heavy use of indices associated to the vertices
+// We use a std::map to store the index
+
+typedef std::map<vertex_descriptor,int> Vertex_index_map;
+Vertex_index_map vertex_index_map;
+
+// A std::map is not a property map, because it is not lightweight
+typedef boost::associative_property_map<Vertex_index_map> Vertex_index_pmap;
+Vertex_index_pmap vertex_index_pmap(vertex_index_map);
+
+void
+kruskal(const Polyhedron& P)
+{
+  // associate indices to the vertices
+  vertex_iterator vb, ve;
+  int index = 0;
+  
+  // boost::tie assigns the first and second element of the std::pair
+  // returned by boost::vertices to the variables vb and ve
+  for(boost::tie(vb, ve)=vertices(P); vb!=ve; ++vb){
+    vertex_index_pmap[*vb]= index++;
+  }
+
+  
+  // We use the default edge weight which is the length of the edge
+  // This property map is defined in graph_traits_Polyhedron_3.h
+
+  // In the function call you can see a named parameter: vertex_index_map
+  std::list<edge_descriptor> mst;
+
+  boost::kruskal_minimum_spanning_tree(P, 
+                                       std::back_inserter(mst), 
+                                       boost::vertex_index_map(vertex_index_pmap));
+
+  std::cout << "#VRML V2.0 utf8\n"
+    "Shape {\n"
+    "  appearance Appearance {\n"
+    "    material Material { emissiveColor 1 0 0}}\n"
+    "    geometry\n"
+    "    IndexedLineSet {\n"
+    "      coord Coordinate {\n"
+    "        point [ \n";
+
+  for(boost::tie(vb, ve) = vertices(P); vb!=ve; ++vb){
+    std::cout <<  "        " << (*vb)->point() << "\n";
+  }
+
+  std::cout << "        ]\n"
+               "     }\n"
+    "      coordIndex [\n";
+
+  for(std::list<edge_descriptor>::iterator it = mst.begin(); it != mst.end(); ++it)
+  {
+    edge_descriptor e = *it ;
+    vertex_descriptor s = source(e,P);
+    vertex_descriptor t = target(e,P);
+    std::cout << "      " << vertex_index_pmap[s] << ", " << vertex_index_pmap[t] <<  ", -1\n";
+  }
+
+  std::cout << "]\n"
+    "  }#IndexedLineSet\n"
+    "}# Shape\n";
+}
+
+
+int main() {
+
+  Polyhedron P;
+  Point a(1,0,0);
+  Point b(0,1,0);
+  Point c(0,0,1);
+  Point d(0,0,0);
+
+  P.make_tetrahedron(a,b,c,d);
+
+  kruskal(P);
+
+  return 0;
+}
diff --git a/3rdparty/CGAL/examples/BGL_polyhedron_3/kruskal_with_stored_id.cpp b/3rdparty/CGAL/examples/BGL_polyhedron_3/kruskal_with_stored_id.cpp
new file mode 100644
index 0000000..5d81188
--- /dev/null
+++ b/3rdparty/CGAL/examples/BGL_polyhedron_3/kruskal_with_stored_id.cpp
@@ -0,0 +1,89 @@
+#include <CGAL/Simple_cartesian.h>
+#include <CGAL/Polyhedron_3.h>
+#include <CGAL/Polyhedron_items_with_id_3.h>
+#include <CGAL/IO/Polyhedron_iostream.h>
+#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
+
+#include <iostream>
+#include <list>
+
+#include <boost/graph/kruskal_min_spanning_tree.hpp>
+
+typedef CGAL::Simple_cartesian<double>                               Kernel;
+typedef Kernel::Point_3                                              Point;
+typedef CGAL::Polyhedron_3<Kernel,CGAL::Polyhedron_items_with_id_3>  Polyhedron;
+
+typedef boost::graph_traits<Polyhedron>::vertex_descriptor vertex_descriptor;
+typedef boost::graph_traits<Polyhedron>::vertex_iterator   vertex_iterator;
+typedef boost::graph_traits<Polyhedron>::edge_descriptor   edge_descriptor;
+
+
+
+void
+kruskal( const Polyhedron& P)
+{
+
+  // We use the default edge weight which is the length of the edge
+  // This property map is defined in graph_traits_Polyhedron_3.h
+  
+  // This function call requires a vertex_index_map named parameter which
+  // when  ommitted defaults to "get(vertex_index,graph)".
+  // That default works here because the vertex type has an "id()" method
+  // field which is used by the vertex_index internal property.
+  std::list<edge_descriptor> mst;
+  boost::kruskal_minimum_spanning_tree(P,std::back_inserter(mst));
+  
+  std::cout << "#VRML V2.0 utf8\n"
+    "Shape {\n"
+    "appearance Appearance {\n"
+    "material Material { emissiveColor 1 0 0}}\n"
+    "geometry\n"
+    "IndexedLineSet {\n"
+    "coord Coordinate {\n"
+    "point [ \n";
+  
+  vertex_iterator vb, ve;
+  for(boost::tie(vb,ve) = vertices(P); vb!=ve; ++vb){
+    std::cout << (*vb)->point() << "\n";
+  }
+  
+  std::cout << "]\n"
+    "}\n"
+    "coordIndex [\n";
+  
+  for(std::list<edge_descriptor>::iterator it = mst.begin(); it != mst.end(); ++it){
+    std::cout << source(*it,P)->id()
+	      << ", " << target(*it,P)->id() <<  ", -1\n";
+  }
+  
+  std::cout << "]\n"
+    "}#IndexedLineSet\n"
+    "}# Shape\n";
+}
+
+
+int main() {
+  
+  Polyhedron P;
+  
+  Point a(1,0,0);
+  Point b(0,1,0);
+  Point c(0,0,1);
+  Point d(0,0,0);
+  
+  P.make_tetrahedron(a,b,c,d);
+
+  // associate indices to the vertices using the "id()" field of the vertex.
+  vertex_iterator vb, ve;
+  int index = 0;
+  
+  // boost::tie assigns the first and second element of the std::pair
+  // returned by boost::vertices to the variables vit and ve
+  for(boost::tie(vb,ve)=vertices(P); vb!=ve; ++vb ){
+    vertex_descriptor  vd = *vb;
+    vd->id() = index++;
+  }
+  
+  kruskal(P);
+  return 0;
+}
diff --git a/3rdparty/CGAL-4.8/examples/BGL_polyhedron_3/normals.cmd b/3rdparty/CGAL/examples/BGL_polyhedron_3/normals.cmd
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/BGL_polyhedron_3/normals.cmd
rename to 3rdparty/CGAL/examples/BGL_polyhedron_3/normals.cmd
diff --git a/3rdparty/CGAL-4.8/examples/BGL_polyhedron_3/normals.cpp b/3rdparty/CGAL/examples/BGL_polyhedron_3/normals.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/BGL_polyhedron_3/normals.cpp
rename to 3rdparty/CGAL/examples/BGL_polyhedron_3/normals.cpp
diff --git a/3rdparty/CGAL-4.8/examples/BGL_polyhedron_3/range.cmd b/3rdparty/CGAL/examples/BGL_polyhedron_3/range.cmd
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/BGL_polyhedron_3/range.cmd
rename to 3rdparty/CGAL/examples/BGL_polyhedron_3/range.cmd
diff --git a/3rdparty/CGAL-4.8/examples/BGL_polyhedron_3/range.cpp b/3rdparty/CGAL/examples/BGL_polyhedron_3/range.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/BGL_polyhedron_3/range.cpp
rename to 3rdparty/CGAL/examples/BGL_polyhedron_3/range.cpp
diff --git a/3rdparty/CGAL-4.8/examples/BGL_polyhedron_3/transform_iterator.cmd b/3rdparty/CGAL/examples/BGL_polyhedron_3/transform_iterator.cmd
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/BGL_polyhedron_3/transform_iterator.cmd
rename to 3rdparty/CGAL/examples/BGL_polyhedron_3/transform_iterator.cmd
diff --git a/3rdparty/CGAL-4.8/examples/BGL_polyhedron_3/transform_iterator.cpp b/3rdparty/CGAL/examples/BGL_polyhedron_3/transform_iterator.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/BGL_polyhedron_3/transform_iterator.cpp
rename to 3rdparty/CGAL/examples/BGL_polyhedron_3/transform_iterator.cpp
diff --git a/3rdparty/CGAL/examples/BGL_surface_mesh/CMakeLists.txt b/3rdparty/CGAL/examples/BGL_surface_mesh/CMakeLists.txt
new file mode 100644
index 0000000..acb60c2
--- /dev/null
+++ b/3rdparty/CGAL/examples/BGL_surface_mesh/CMakeLists.txt
@@ -0,0 +1,28 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( BGL_surface_mesh_example )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET COMPONENTS Core )
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  create_single_source_cgal_program( "connected_components.cpp" )
+  create_single_source_cgal_program( "prim.cpp" )
+  create_single_source_cgal_program( "surface_mesh_dual.cpp" )
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/BGL_surface_mesh/connected_components.cpp b/3rdparty/CGAL/examples/BGL_surface_mesh/connected_components.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/BGL_surface_mesh/connected_components.cpp
rename to 3rdparty/CGAL/examples/BGL_surface_mesh/connected_components.cpp
diff --git a/3rdparty/CGAL-4.8/examples/BGL_surface_mesh/data/prim.off b/3rdparty/CGAL/examples/BGL_surface_mesh/data/prim.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/BGL_surface_mesh/data/prim.off
rename to 3rdparty/CGAL/examples/BGL_surface_mesh/data/prim.off
diff --git a/3rdparty/CGAL-4.8/examples/BGL_surface_mesh/prim.cmd b/3rdparty/CGAL/examples/BGL_surface_mesh/prim.cmd
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/BGL_surface_mesh/prim.cmd
rename to 3rdparty/CGAL/examples/BGL_surface_mesh/prim.cmd
diff --git a/3rdparty/CGAL-4.8/examples/BGL_surface_mesh/prim.cpp b/3rdparty/CGAL/examples/BGL_surface_mesh/prim.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/BGL_surface_mesh/prim.cpp
rename to 3rdparty/CGAL/examples/BGL_surface_mesh/prim.cpp
diff --git a/3rdparty/CGAL/examples/BGL_surface_mesh/surface_mesh_dual.cpp b/3rdparty/CGAL/examples/BGL_surface_mesh/surface_mesh_dual.cpp
new file mode 100644
index 0000000..b694011
--- /dev/null
+++ b/3rdparty/CGAL/examples/BGL_surface_mesh/surface_mesh_dual.cpp
@@ -0,0 +1,89 @@
+#include <CGAL/Simple_cartesian.h>
+#include <CGAL/Surface_mesh.h>
+#include <CGAL/boost/graph/Dual.h>
+#include <CGAL/boost/graph/helpers.h>
+#include <iostream>
+#include <fstream>
+
+#include <boost/graph/filtered_graph.hpp>
+#include <boost/graph/connected_components.hpp>
+#include <boost/foreach.hpp>
+
+typedef CGAL::Simple_cartesian<double>             Kernel;
+typedef Kernel::Point_3                            Point;
+typedef CGAL::Surface_mesh<Point>                  Mesh;
+typedef CGAL::Dual<Mesh>                           Dual;
+typedef boost::graph_traits<Dual>::edge_descriptor edge_descriptor;
+
+template <typename G>
+struct noborder {
+  noborder() : g(NULL) {} // default-constructor required by filtered_graph
+  noborder(G& g) : g(&g) {}
+
+  bool operator()(const edge_descriptor& e) const
+  { return !is_border(e,*g); }
+
+  G* g;
+};
+
+
+// A dual border edge has a null_face as the source or target "vertex"
+// BGL algorithms won't like that, so we remove border edges through a
+// boost::filtered_graph.
+typedef boost::filtered_graph<Dual, noborder<Mesh> >   FiniteDual;
+typedef boost::graph_traits<Mesh>::vertex_descriptor   vertex_descriptor;
+typedef boost::graph_traits<Mesh>::face_descriptor     face_descriptor;
+typedef boost::graph_traits<Mesh>::edge_descriptor     edge_descriptor;
+
+int main(int argc, char* argv[])
+{
+  Mesh primal;
+  const char* filename = (argc > 1) ? argv[1] : "data/prim.off";
+  std::ifstream in(filename);
+  if(!(in >> primal)) {
+    std::cerr << "Error reading polyhedron from file " << filename << std::endl;
+    return EXIT_FAILURE;
+  }
+
+  Dual dual(primal);
+  FiniteDual finite_dual(dual,noborder<Mesh>(primal));
+
+  std::cout << "dual has " << num_vertices(dual) << " vertices" << std::endl;
+
+  std::cout << "The vertices of dual are faces in primal"<< std::endl;
+  BOOST_FOREACH(boost::graph_traits<Dual>::vertex_descriptor dvd , vertices(dual)) {
+    std::cout << dvd << std::endl;
+  }
+
+  std::cout << "The edges in primal and dual with source and target" << std::endl;
+  BOOST_FOREACH(edge_descriptor e , edges(dual)) {
+   std::cout << e << " in primal:  " << source(e,primal)      << " -- " << target(e,primal)       << "   "
+             <<      " in dual  :  " << source(e,finite_dual) << " -- " << target(e,finite_dual)  << std::endl;
+  }
+
+
+ std::cout << "edges of the finite dual graph" << std::endl;
+ BOOST_FOREACH(boost::graph_traits<FiniteDual>::edge_descriptor e , edges(finite_dual)) {
+   std::cout << e << "  " << source(e,primal) << " " << source(e,finite_dual)  << std::endl;
+ }
+
+ // the storage of a property map is in primal
+ Mesh::Property_map<face_descriptor,int> fccmap;
+ fccmap = primal.add_property_map<face_descriptor,int>("f:CC").first;
+ int num = connected_components(finite_dual, fccmap);
+
+ std::cout << "The graph has " << num << " connected components (face connectivity)" << std::endl;
+ BOOST_FOREACH(face_descriptor f , faces(primal)) {
+   std::cout << f << " in connected component " << fccmap[f] << std::endl;
+ }
+
+ Mesh::Property_map<vertex_descriptor,int> vccmap;
+ vccmap = primal.add_property_map<vertex_descriptor,int>("v:CC").first;
+ num = connected_components(primal, vccmap);
+
+ std::cout << "The graph has " << num << " connected components (edge connectvity)" << std::endl;
+ BOOST_FOREACH(vertex_descriptor v , vertices(primal)) {
+   std::cout << v << " in connected component " << vccmap[v] << std::endl;
+ }
+  return 0;
+}
diff --git a/3rdparty/CGAL-4.8/examples/BGL_triangulation_2/CMakeLists.txt b/3rdparty/CGAL/examples/BGL_triangulation_2/CMakeLists.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/BGL_triangulation_2/CMakeLists.txt
rename to 3rdparty/CGAL/examples/BGL_triangulation_2/CMakeLists.txt
diff --git a/3rdparty/CGAL/examples/BGL_triangulation_2/data/points.xy b/3rdparty/CGAL/examples/BGL_triangulation_2/data/points.xy
new file mode 100644
index 0000000..c755edb
--- /dev/null
+++ b/3rdparty/CGAL/examples/BGL_triangulation_2/data/points.xy
@@ -0,0 +1,5 @@
+0 0
+1 0
+0.2 0.2
+0 1 
+0 2
diff --git a/3rdparty/CGAL/examples/BGL_triangulation_2/dijkstra.cpp b/3rdparty/CGAL/examples/BGL_triangulation_2/dijkstra.cpp
new file mode 100644
index 0000000..82e0393
--- /dev/null
+++ b/3rdparty/CGAL/examples/BGL_triangulation_2/dijkstra.cpp
@@ -0,0 +1,103 @@
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+#include <CGAL/Triangulation_2.h>
+#include <CGAL/boost/graph/graph_traits_Triangulation_2.h>
+
+#include <CGAL/boost/graph/dijkstra_shortest_paths.h>
+#include <boost/graph/filtered_graph.hpp>
+#include <fstream>
+
+typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
+typedef K::Point_2 Point;
+
+typedef CGAL::Triangulation_2<K> Triangulation;
+
+// As we want to run Dijskra's shortest path algorithm we only
+// consider finite vertices and edges.
+
+template <typename T>
+struct Is_finite {
+
+  const T* t_;
+
+  Is_finite()
+    : t_(NULL)
+  {}
+
+  Is_finite(const T& t)
+    : t_(&t)
+  { }
+
+  template <typename VertexOrEdge>
+  bool operator()(const VertexOrEdge& voe) const {
+    return ! t_->is_infinite(voe);
+  }
+};
+
+typedef Is_finite<Triangulation> Filter;
+typedef boost::filtered_graph<Triangulation,Filter,Filter> Finite_triangulation;
+typedef boost::graph_traits<Finite_triangulation>::vertex_descriptor vertex_descriptor;
+typedef boost::graph_traits<Finite_triangulation>::vertex_iterator vertex_iterator;
+
+typedef std::map<vertex_descriptor,int> VertexIndexMap;
+VertexIndexMap vertex_id_map;
+
+typedef boost::associative_property_map<VertexIndexMap> VertexIdPropertyMap;
+VertexIdPropertyMap vertex_index_pmap(vertex_id_map);
+
+int
+main(int argc,char* argv[])
+{
+  const char* filename = (argc > 1) ? argv[1] : "data/points.xy";
+  std::ifstream input(filename);
+  Triangulation t;
+  Filter is_finite(t);
+  Finite_triangulation ft(t, is_finite, is_finite);
+
+  Point p ;
+  while(input >> p){
+    t.insert(p);
+  }
+
+  vertex_iterator vit, ve;
+  // Associate indices to the vertices
+  int index = 0;
+  // boost::tie assigns the first and second element of the std::pair
+  // returned by boost::vertices to the variables vit and ve
+  for(boost::tie(vit,ve)=boost::vertices(ft); vit!=ve; ++vit ){
+    vertex_descriptor  vd = *vit;
+    vertex_id_map[vd]= index++;
+    }
+
+  // Dijkstra's shortest path needs property maps for the predecessor and distance
+  // We first declare a vector
+  std::vector<vertex_descriptor> predecessor(boost::num_vertices(ft));
+  // and then turn it into a property map
+  boost::iterator_property_map<std::vector<vertex_descriptor>::iterator,
+                               VertexIdPropertyMap>
+    predecessor_pmap(predecessor.begin(), vertex_index_pmap);
+
+  std::vector<double> distance(boost::num_vertices(ft));
+  boost::iterator_property_map<std::vector<double>::iterator,
+                               VertexIdPropertyMap>
+    distance_pmap(distance.begin(), vertex_index_pmap);
+
+  // start at an arbitrary vertex
+  vertex_descriptor source = *boost::vertices(ft).first;
+  std::cout << "\nStart dijkstra_shortest_paths at " << source->point() <<"\n";
+
+  boost::dijkstra_shortest_paths(ft, source,
+				 distance_map(distance_pmap)
+				 .predecessor_map(predecessor_pmap)
+				 .vertex_index_map(vertex_index_pmap));
+
+  for(boost::tie(vit,ve)=boost::vertices(ft); vit!=ve; ++vit ){
+    vertex_descriptor vd = *vit;
+    std::cout << vd->point() << " [" <<  vertex_id_map[vd] << "] ";
+    std::cout << " has distance = "  << boost::get(distance_pmap,vd)
+	      << " and predecessor ";
+    vd =  boost::get(predecessor_pmap,vd);
+    std::cout << vd->point() << " [" <<  vertex_id_map[vd] << "]\n ";
+  }
+
+  return 0;
+}
diff --git a/3rdparty/CGAL/examples/BGL_triangulation_2/dijkstra_with_internal_properties.cpp b/3rdparty/CGAL/examples/BGL_triangulation_2/dijkstra_with_internal_properties.cpp
new file mode 100644
index 0000000..9b26686
--- /dev/null
+++ b/3rdparty/CGAL/examples/BGL_triangulation_2/dijkstra_with_internal_properties.cpp
@@ -0,0 +1,94 @@
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+#include <CGAL/Delaunay_triangulation_2.h>
+#include <CGAL/Triangulation_vertex_base_with_id_2.h>
+#include <CGAL/boost/graph/graph_traits_Delaunay_triangulation_2.h>
+
+#include <CGAL/boost/graph/dijkstra_shortest_paths.h>
+#include <boost/graph/filtered_graph.hpp>
+#include <fstream>
+
+typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
+typedef K::Point_2 Point;
+
+typedef CGAL::Triangulation_vertex_base_with_id_2<K> Tvb;
+typedef CGAL::Triangulation_face_base_2<K> Tfb;
+typedef CGAL::Triangulation_data_structure_2<Tvb,Tfb> Tds;
+typedef CGAL::Delaunay_triangulation_2<K, Tds> Triangulation;
+
+// consider finite vertices and edges.
+
+template <typename T>
+struct Is_finite {
+
+  const T* t_;
+
+  Is_finite()
+    : t_(NULL)
+  {}
+
+  Is_finite(const T& t)
+    : t_(&t)
+  { }
+
+  template <typename VertexOrEdge>
+  bool operator()(const VertexOrEdge& voe) const {
+    return ! t_->is_infinite(voe);
+  }
+};
+
+typedef Is_finite<Triangulation> Filter;
+typedef boost::filtered_graph<Triangulation,Filter,Filter> Finite_triangulation;
+typedef boost::graph_traits<Finite_triangulation>::vertex_descriptor vertex_descriptor;
+typedef boost::graph_traits<Finite_triangulation>::vertex_iterator vertex_iterator;
+
+
+int
+main(int argc,char* argv[])
+{
+  const char* filename = (argc > 1) ? argv[1] : "data/points.xy";
+  std::ifstream input(filename);
+  Triangulation t;
+  Filter is_finite(t);
+  Finite_triangulation ft(t, is_finite, is_finite);
+
+  Point p ;
+  while(input >> p){
+    t.insert(p);
+  }
+
+  vertex_iterator vit, ve;
+  // associate indices to the vertices
+  int index = 0;
+  for(boost::tie(vit,ve)=boost::vertices(ft); vit!=ve; ++vit ){
+    vertex_descriptor  vd = *vit;
+    vd->id()= index++;
+  }
+
+  typedef boost::property_map<Triangulation, boost::vertex_index_t>::type VertexIdPropertyMap;
+  VertexIdPropertyMap vertex_index_pmap = get(boost::vertex_index, ft);
+
+  // Dijkstra's shortest path needs property maps for the predecessor and distance
+  std::vector<vertex_descriptor> predecessor(boost::num_vertices(ft));
+  boost::iterator_property_map<std::vector<vertex_descriptor>::iterator, VertexIdPropertyMap>
+    predecessor_pmap(predecessor.begin(), vertex_index_pmap);
+
+  std::vector<double> distance(boost::num_vertices(ft));
+  boost::iterator_property_map<std::vector<double>::iterator, VertexIdPropertyMap>
+    distance_pmap(distance.begin(), vertex_index_pmap);
+
+  vertex_descriptor source =  *boost::vertices(ft).first;
+  std::cout << "\nStart dijkstra_shortest_paths at " << source->point() << std::endl;
+
+  boost::dijkstra_shortest_paths(ft, source ,
+				 distance_map(distance_pmap)
+				 .predecessor_map(predecessor_pmap));
+
+  for(boost::tie(vit,ve)=boost::vertices(ft); vit!=ve; ++vit ){
+    vertex_descriptor vd = *vit;
+    std::cout << vd->point() << " [" << vd->id() << "] ";
+    std::cout << " has distance = "  << get(distance_pmap,vd) << " and predecessor ";
+    vd = get(predecessor_pmap,vd);
+    std::cout << vd->point() << " [" << vd->id() << "]\n";
+  }
+  return 0;
+}
diff --git a/3rdparty/CGAL/examples/BGL_triangulation_2/emst.cpp b/3rdparty/CGAL/examples/BGL_triangulation_2/emst.cpp
new file mode 100644
index 0000000..ca8282d
--- /dev/null
+++ b/3rdparty/CGAL/examples/BGL_triangulation_2/emst.cpp
@@ -0,0 +1,98 @@
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+#include <CGAL/Delaunay_triangulation_2.h>
+#include <CGAL/boost/graph/graph_traits_Delaunay_triangulation_2.h>
+
+#include <boost/graph/kruskal_min_spanning_tree.hpp>
+#include <boost/graph/filtered_graph.hpp>
+#include <fstream>
+
+typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
+typedef K::Point_2 Point;
+
+typedef CGAL::Delaunay_triangulation_2<K> Triangulation;
+
+// As we only consider finite vertices and edges
+// we need the following filter
+
+template <typename T>
+struct Is_finite {
+
+  const T* t_;
+
+  Is_finite()
+    : t_(NULL)
+  {}
+
+  Is_finite(const T& t)
+    : t_(&t)
+  { }
+
+  template <typename VertexOrEdge>
+  bool operator()(const VertexOrEdge& voe) const {
+    return ! t_->is_infinite(voe);
+  }
+};
+
+typedef Is_finite<Triangulation> Filter;
+typedef boost::filtered_graph<Triangulation,Filter,Filter> Finite_triangulation;
+typedef boost::graph_traits<Finite_triangulation>::vertex_descriptor vertex_descriptor;
+typedef boost::graph_traits<Finite_triangulation>::vertex_iterator vertex_iterator;
+typedef boost::graph_traits<Finite_triangulation>::edge_descriptor edge_descriptor;
+
+// The BGL makes use of indices associated to the vertices
+// We use a std::map to store the index
+typedef std::map<vertex_descriptor,int> VertexIndexMap;
+VertexIndexMap vertex_id_map;
+
+// A std::map is not a property map, because it is not lightweight
+typedef boost::associative_property_map<VertexIndexMap> VertexIdPropertyMap;
+VertexIdPropertyMap vertex_index_pmap(vertex_id_map);
+
+int
+main(int argc,char* argv[])
+{
+  const char* filename = (argc > 1) ? argv[1] : "data/points.xy";
+  std::ifstream input(filename);
+  Triangulation t;
+  Filter is_finite(t);
+  Finite_triangulation ft(t, is_finite, is_finite);
+
+  Point p ;
+  while(input >> p){
+    t.insert(p);
+  }
+
+  vertex_iterator vit, ve;
+  // Associate indices to the vertices
+  int index = 0;
+  // boost::tie assigns the first and second element of the std::pair
+  // returned by boost::vertices to the variables vit and ve
+  for(boost::tie(vit,ve)=boost::vertices(ft); vit!=ve; ++vit ){
+    vertex_descriptor  vd = *vit;
+    vertex_id_map[vd]= index++;
+    }
+
+
+  // We use the default edge weight which is the squared length of the edge
+  // This property map is defined in graph_traits_Triangulation_2.h
+
+  // In the function call you can see a named parameter: vertex_index_map
+   std::list<edge_descriptor> mst;
+   boost::kruskal_minimum_spanning_tree(ft,
+					std::back_inserter(mst),
+					vertex_index_map(vertex_index_pmap));
+
+
+   std::cout << "The edges of the Euclidean mimimum spanning tree:" << std::endl;
+
+   for(std::list<edge_descriptor>::iterator it = mst.begin(); it != mst.end(); ++it){
+     edge_descriptor ed = *it;
+     vertex_descriptor svd = source(ed,t);
+     vertex_descriptor tvd = target(ed,t);
+     Triangulation::Vertex_handle sv = svd;
+     Triangulation::Vertex_handle tv = tvd;
+     std::cout << "[ " << sv->point() << "  |  " << tv->point() << " ] " << std::endl;
+   }
+
+   return 0;
+}
diff --git a/3rdparty/CGAL-4.8/examples/BGL_triangulation_2/face_graph.cpp b/3rdparty/CGAL/examples/BGL_triangulation_2/face_graph.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/BGL_triangulation_2/face_graph.cpp
rename to 3rdparty/CGAL/examples/BGL_triangulation_2/face_graph.cpp
diff --git a/3rdparty/CGAL/examples/Barycentric_coordinates_2/CMakeLists.txt b/3rdparty/CGAL/examples/Barycentric_coordinates_2/CMakeLists.txt
new file mode 100644
index 0000000..5f00c10
--- /dev/null
+++ b/3rdparty/CGAL/examples/Barycentric_coordinates_2/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Barycentric_coordinates_2_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Barycentric_coordinates_2/Discrete_harmonic_coordinates_example.cpp b/3rdparty/CGAL/examples/Barycentric_coordinates_2/Discrete_harmonic_coordinates_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Barycentric_coordinates_2/Discrete_harmonic_coordinates_example.cpp
rename to 3rdparty/CGAL/examples/Barycentric_coordinates_2/Discrete_harmonic_coordinates_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Barycentric_coordinates_2/Mean_value_coordinates_example.cpp b/3rdparty/CGAL/examples/Barycentric_coordinates_2/Mean_value_coordinates_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Barycentric_coordinates_2/Mean_value_coordinates_example.cpp
rename to 3rdparty/CGAL/examples/Barycentric_coordinates_2/Mean_value_coordinates_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Barycentric_coordinates_2/Segment_coordinates_example.cpp b/3rdparty/CGAL/examples/Barycentric_coordinates_2/Segment_coordinates_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Barycentric_coordinates_2/Segment_coordinates_example.cpp
rename to 3rdparty/CGAL/examples/Barycentric_coordinates_2/Segment_coordinates_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Barycentric_coordinates_2/Terrain_height_modeling.cpp b/3rdparty/CGAL/examples/Barycentric_coordinates_2/Terrain_height_modeling.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Barycentric_coordinates_2/Terrain_height_modeling.cpp
rename to 3rdparty/CGAL/examples/Barycentric_coordinates_2/Terrain_height_modeling.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Barycentric_coordinates_2/Triangle_coordinates_example.cpp b/3rdparty/CGAL/examples/Barycentric_coordinates_2/Triangle_coordinates_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Barycentric_coordinates_2/Triangle_coordinates_example.cpp
rename to 3rdparty/CGAL/examples/Barycentric_coordinates_2/Triangle_coordinates_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Barycentric_coordinates_2/Triangle_coordinates_speed_test.cpp b/3rdparty/CGAL/examples/Barycentric_coordinates_2/Triangle_coordinates_speed_test.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Barycentric_coordinates_2/Triangle_coordinates_speed_test.cpp
rename to 3rdparty/CGAL/examples/Barycentric_coordinates_2/Triangle_coordinates_speed_test.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Barycentric_coordinates_2/Wachspress_coordinates_example.cpp b/3rdparty/CGAL/examples/Barycentric_coordinates_2/Wachspress_coordinates_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Barycentric_coordinates_2/Wachspress_coordinates_example.cpp
rename to 3rdparty/CGAL/examples/Barycentric_coordinates_2/Wachspress_coordinates_example.cpp
diff --git a/3rdparty/CGAL/examples/Boolean_set_operations_2/CMakeLists.txt b/3rdparty/CGAL/examples/Boolean_set_operations_2/CMakeLists.txt
new file mode 100644
index 0000000..985056d
--- /dev/null
+++ b/3rdparty/CGAL/examples/Boolean_set_operations_2/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Boolean_set_operations_2_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET COMPONENTS Core )
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/README b/3rdparty/CGAL/examples/Boolean_set_operations_2/README
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/README
rename to 3rdparty/CGAL/examples/Boolean_set_operations_2/README
diff --git a/3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/amer_a.bps b/3rdparty/CGAL/examples/Boolean_set_operations_2/amer_a.bps
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/amer_a.bps
rename to 3rdparty/CGAL/examples/Boolean_set_operations_2/amer_a.bps
diff --git a/3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/amer_b.bps b/3rdparty/CGAL/examples/Boolean_set_operations_2/amer_b.bps
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/amer_b.bps
rename to 3rdparty/CGAL/examples/Boolean_set_operations_2/amer_b.bps
diff --git a/3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/amer_c.bps b/3rdparty/CGAL/examples/Boolean_set_operations_2/amer_c.bps
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/amer_c.bps
rename to 3rdparty/CGAL/examples/Boolean_set_operations_2/amer_c.bps
diff --git a/3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/amer_d.bps b/3rdparty/CGAL/examples/Boolean_set_operations_2/amer_d.bps
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/amer_d.bps
rename to 3rdparty/CGAL/examples/Boolean_set_operations_2/amer_d.bps
diff --git a/3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/amer_e.bps b/3rdparty/CGAL/examples/Boolean_set_operations_2/amer_e.bps
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/amer_e.bps
rename to 3rdparty/CGAL/examples/Boolean_set_operations_2/amer_e.bps
diff --git a/3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/amer_f.bps b/3rdparty/CGAL/examples/Boolean_set_operations_2/amer_f.bps
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/amer_f.bps
rename to 3rdparty/CGAL/examples/Boolean_set_operations_2/amer_f.bps
diff --git a/3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/amer_g.bps b/3rdparty/CGAL/examples/Boolean_set_operations_2/amer_g.bps
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/amer_g.bps
rename to 3rdparty/CGAL/examples/Boolean_set_operations_2/amer_g.bps
diff --git a/3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/amer_h.bps b/3rdparty/CGAL/examples/Boolean_set_operations_2/amer_h.bps
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/amer_h.bps
rename to 3rdparty/CGAL/examples/Boolean_set_operations_2/amer_h.bps
diff --git a/3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/amer_i.bps b/3rdparty/CGAL/examples/Boolean_set_operations_2/amer_i.bps
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/amer_i.bps
rename to 3rdparty/CGAL/examples/Boolean_set_operations_2/amer_i.bps
diff --git a/3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/amer_j.bps b/3rdparty/CGAL/examples/Boolean_set_operations_2/amer_j.bps
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/amer_j.bps
rename to 3rdparty/CGAL/examples/Boolean_set_operations_2/amer_j.bps
diff --git a/3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/amer_k.bps b/3rdparty/CGAL/examples/Boolean_set_operations_2/amer_k.bps
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/amer_k.bps
rename to 3rdparty/CGAL/examples/Boolean_set_operations_2/amer_k.bps
diff --git a/3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/bezier_traits_adapter.cpp b/3rdparty/CGAL/examples/Boolean_set_operations_2/bezier_traits_adapter.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/bezier_traits_adapter.cpp
rename to 3rdparty/CGAL/examples/Boolean_set_operations_2/bezier_traits_adapter.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/bezier_traits_adapter2.cpp b/3rdparty/CGAL/examples/Boolean_set_operations_2/bezier_traits_adapter2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/bezier_traits_adapter2.cpp
rename to 3rdparty/CGAL/examples/Boolean_set_operations_2/bezier_traits_adapter2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/bso_rational_nt.h b/3rdparty/CGAL/examples/Boolean_set_operations_2/bso_rational_nt.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/bso_rational_nt.h
rename to 3rdparty/CGAL/examples/Boolean_set_operations_2/bso_rational_nt.h
diff --git a/3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/char_g.bps b/3rdparty/CGAL/examples/Boolean_set_operations_2/char_g.bps
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/char_g.bps
rename to 3rdparty/CGAL/examples/Boolean_set_operations_2/char_g.bps
diff --git a/3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/char_g.dat b/3rdparty/CGAL/examples/Boolean_set_operations_2/char_g.dat
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/char_g.dat
rename to 3rdparty/CGAL/examples/Boolean_set_operations_2/char_g.dat
diff --git a/3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/char_m.bps b/3rdparty/CGAL/examples/Boolean_set_operations_2/char_m.bps
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/char_m.bps
rename to 3rdparty/CGAL/examples/Boolean_set_operations_2/char_m.bps
diff --git a/3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/char_m.dat b/3rdparty/CGAL/examples/Boolean_set_operations_2/char_m.dat
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/char_m.dat
rename to 3rdparty/CGAL/examples/Boolean_set_operations_2/char_m.dat
diff --git a/3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/circle_segment.cpp b/3rdparty/CGAL/examples/Boolean_set_operations_2/circle_segment.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/circle_segment.cpp
rename to 3rdparty/CGAL/examples/Boolean_set_operations_2/circle_segment.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/conic_traits_adapter.cpp b/3rdparty/CGAL/examples/Boolean_set_operations_2/conic_traits_adapter.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/conic_traits_adapter.cpp
rename to 3rdparty/CGAL/examples/Boolean_set_operations_2/conic_traits_adapter.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/connect_polygon.cpp b/3rdparty/CGAL/examples/Boolean_set_operations_2/connect_polygon.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/connect_polygon.cpp
rename to 3rdparty/CGAL/examples/Boolean_set_operations_2/connect_polygon.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/do_intersect.cpp b/3rdparty/CGAL/examples/Boolean_set_operations_2/do_intersect.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/do_intersect.cpp
rename to 3rdparty/CGAL/examples/Boolean_set_operations_2/do_intersect.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/dxf_union.cpp b/3rdparty/CGAL/examples/Boolean_set_operations_2/dxf_union.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/dxf_union.cpp
rename to 3rdparty/CGAL/examples/Boolean_set_operations_2/dxf_union.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/input_0.bps b/3rdparty/CGAL/examples/Boolean_set_operations_2/input_0.bps
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/input_0.bps
rename to 3rdparty/CGAL/examples/Boolean_set_operations_2/input_0.bps
diff --git a/3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/input_1.bps b/3rdparty/CGAL/examples/Boolean_set_operations_2/input_1.bps
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/input_1.bps
rename to 3rdparty/CGAL/examples/Boolean_set_operations_2/input_1.bps
diff --git a/3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/pgn_holes.dat b/3rdparty/CGAL/examples/Boolean_set_operations_2/pgn_holes.dat
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/pgn_holes.dat
rename to 3rdparty/CGAL/examples/Boolean_set_operations_2/pgn_holes.dat
diff --git a/3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/print_utils.h b/3rdparty/CGAL/examples/Boolean_set_operations_2/print_utils.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/print_utils.h
rename to 3rdparty/CGAL/examples/Boolean_set_operations_2/print_utils.h
diff --git a/3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/sequence.cpp b/3rdparty/CGAL/examples/Boolean_set_operations_2/sequence.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/sequence.cpp
rename to 3rdparty/CGAL/examples/Boolean_set_operations_2/sequence.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/set_union.cpp b/3rdparty/CGAL/examples/Boolean_set_operations_2/set_union.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/set_union.cpp
rename to 3rdparty/CGAL/examples/Boolean_set_operations_2/set_union.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/simple_join_intersect.cpp b/3rdparty/CGAL/examples/Boolean_set_operations_2/simple_join_intersect.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/simple_join_intersect.cpp
rename to 3rdparty/CGAL/examples/Boolean_set_operations_2/simple_join_intersect.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/symmetric_difference.cpp b/3rdparty/CGAL/examples/Boolean_set_operations_2/symmetric_difference.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/symmetric_difference.cpp
rename to 3rdparty/CGAL/examples/Boolean_set_operations_2/symmetric_difference.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/test.dxf b/3rdparty/CGAL/examples/Boolean_set_operations_2/test.dxf
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Boolean_set_operations_2/test.dxf
rename to 3rdparty/CGAL/examples/Boolean_set_operations_2/test.dxf
diff --git a/3rdparty/CGAL/examples/Box_intersection_d/CMakeLists.txt b/3rdparty/CGAL/examples/Box_intersection_d/CMakeLists.txt
new file mode 100644
index 0000000..f62a9c3
--- /dev/null
+++ b/3rdparty/CGAL/examples/Box_intersection_d/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Box_intersection_d_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Box_intersection_d/box_grid.cpp b/3rdparty/CGAL/examples/Box_intersection_d/box_grid.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Box_intersection_d/box_grid.cpp
rename to 3rdparty/CGAL/examples/Box_intersection_d/box_grid.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Box_intersection_d/custom_box_grid.cpp b/3rdparty/CGAL/examples/Box_intersection_d/custom_box_grid.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Box_intersection_d/custom_box_grid.cpp
rename to 3rdparty/CGAL/examples/Box_intersection_d/custom_box_grid.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Box_intersection_d/data/points.xyz b/3rdparty/CGAL/examples/Box_intersection_d/data/points.xyz
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Box_intersection_d/data/points.xyz
rename to 3rdparty/CGAL/examples/Box_intersection_d/data/points.xyz
diff --git a/3rdparty/CGAL-4.8/examples/Box_intersection_d/data/triangles.xyz b/3rdparty/CGAL/examples/Box_intersection_d/data/triangles.xyz
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Box_intersection_d/data/triangles.xyz
rename to 3rdparty/CGAL/examples/Box_intersection_d/data/triangles.xyz
diff --git a/3rdparty/CGAL-4.8/examples/Box_intersection_d/minimal.cpp b/3rdparty/CGAL/examples/Box_intersection_d/minimal.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Box_intersection_d/minimal.cpp
rename to 3rdparty/CGAL/examples/Box_intersection_d/minimal.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Box_intersection_d/minimal_self.cpp b/3rdparty/CGAL/examples/Box_intersection_d/minimal_self.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Box_intersection_d/minimal_self.cpp
rename to 3rdparty/CGAL/examples/Box_intersection_d/minimal_self.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Box_intersection_d/proximity_custom_box_traits.cpp b/3rdparty/CGAL/examples/Box_intersection_d/proximity_custom_box_traits.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Box_intersection_d/proximity_custom_box_traits.cpp
rename to 3rdparty/CGAL/examples/Box_intersection_d/proximity_custom_box_traits.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Box_intersection_d/triangle_self_intersect.cpp b/3rdparty/CGAL/examples/Box_intersection_d/triangle_self_intersect.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Box_intersection_d/triangle_self_intersect.cpp
rename to 3rdparty/CGAL/examples/Box_intersection_d/triangle_self_intersect.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Box_intersection_d/triangle_self_intersect_pointers.cpp b/3rdparty/CGAL/examples/Box_intersection_d/triangle_self_intersect_pointers.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Box_intersection_d/triangle_self_intersect_pointers.cpp
rename to 3rdparty/CGAL/examples/Box_intersection_d/triangle_self_intersect_pointers.cpp
diff --git a/3rdparty/CGAL/examples/CGAL_ipelets/CMakeLists.txt b/3rdparty/CGAL/examples/CGAL_ipelets/CMakeLists.txt
new file mode 100644
index 0000000..91588da
--- /dev/null
+++ b/3rdparty/CGAL/examples/CGAL_ipelets/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( CGAL_ipelets_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/CGAL_ipelets/test_grabbers.cpp b/3rdparty/CGAL/examples/CGAL_ipelets/test_grabbers.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/CGAL_ipelets/test_grabbers.cpp
rename to 3rdparty/CGAL/examples/CGAL_ipelets/test_grabbers.cpp
diff --git a/3rdparty/CGAL-4.8/examples/CGALimageIO/CMakeLists.txt b/3rdparty/CGAL/examples/CGALimageIO/CMakeLists.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/CGALimageIO/CMakeLists.txt
rename to 3rdparty/CGAL/examples/CGALimageIO/CMakeLists.txt
diff --git a/3rdparty/CGAL-4.8/examples/CGALimageIO/convert_raw_image_to_inr.cpp b/3rdparty/CGAL/examples/CGALimageIO/convert_raw_image_to_inr.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/CGALimageIO/convert_raw_image_to_inr.cpp
rename to 3rdparty/CGAL/examples/CGALimageIO/convert_raw_image_to_inr.cpp
diff --git a/3rdparty/CGAL/examples/CGALimageIO/test_imageio.cpp b/3rdparty/CGAL/examples/CGALimageIO/test_imageio.cpp
new file mode 100644
index 0000000..4e67efb
--- /dev/null
+++ b/3rdparty/CGAL/examples/CGALimageIO/test_imageio.cpp
@@ -0,0 +1,68 @@
+#include <CGAL/ImageIO.h>
+#include <iostream>
+
+#define SHOW(attribut) "\n  "#attribut": " << image->attribut
+#define SHOWENUM(enumitem) #enumitem"=" << enumitem
+
+int main(int argc, char** argv)
+{
+  if(argc > 1)
+  {
+    _image* image = ::_readImage(argv[1]);
+    if(image)
+    {
+      std::cerr 
+	<< "Image infos:"
+	<< "\ndimensions"
+	<< SHOW(xdim)
+	<< SHOW(ydim)
+	<< SHOW(zdim)
+	<< SHOW(vdim)
+	<< "\nvoxel size"
+	<< SHOW(vx)
+	<< SHOW(vy)
+	<< SHOW(vz)
+	<<"\nimage offset"
+	<< SHOW(tx)
+	<< SHOW(ty)
+	<< SHOW(tz)
+	<<"\nrotation vector"
+	<< SHOW(rx)
+	<< SHOW(ry)
+	<< SHOW(rz)
+	<<"\nimage center"
+	<< SHOW(cx)
+	<< SHOW(cy)
+	<< SHOW(cz)
+	<< "\nword size (in bytes)"
+	<< SHOW(wdim)
+	<< "\nimage format"
+	<< "\n  " << image->imageFormat->realName 
+	<< " (extension list: " << image->imageFormat->fileExtension << ")" 
+	<< "\nvectors interlaced or not ("
+        << SHOWENUM(VM_INTERLACED) << ", "
+        << SHOWENUM(VM_NON_INTERLACED) << ", "
+        << SHOWENUM(VM_SCALAR) << ")"
+	<< SHOW(vectMode)
+	<< "\nword kind ("
+	<< SHOWENUM(WK_FIXED) << ", "
+	<< SHOWENUM(WK_FLOAT) << ", "
+	<< SHOWENUM(WK_UNKNOWN)
+	<< ")"
+	<< SHOW(wordKind)
+	<< "\nword sign ("
+	<< SHOWENUM(SGN_SIGNED) << ", "
+	<< SHOWENUM(SGN_UNSIGNED) << ", "
+	<< SHOWENUM(SGN_UNKNOWN)
+	<< ")"
+	<< SHOW(sign)
+	<< "\n";
+      
+      ::_freeImage(image);
+    }
+    else
+      std::cerr << "\"" << argv[1] << "\" is not a supported file.\n";
+  }
+  else
+    ::printSupportedFileFormat();
+}
diff --git a/3rdparty/CGAL-4.8/examples/CMakeLists.txt b/3rdparty/CGAL/examples/CMakeLists.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/CMakeLists.txt
rename to 3rdparty/CGAL/examples/CMakeLists.txt
diff --git a/3rdparty/CGAL/examples/Circular_kernel_2/CMakeLists.txt b/3rdparty/CGAL/examples/Circular_kernel_2/CMakeLists.txt
new file mode 100644
index 0000000..8d9ad7c
--- /dev/null
+++ b/3rdparty/CGAL/examples/Circular_kernel_2/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Circular_kernel_2_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Circular_kernel_2/functor_has_on_2.cpp b/3rdparty/CGAL/examples/Circular_kernel_2/functor_has_on_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Circular_kernel_2/functor_has_on_2.cpp
rename to 3rdparty/CGAL/examples/Circular_kernel_2/functor_has_on_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Circular_kernel_2/intersecting_arcs.cpp b/3rdparty/CGAL/examples/Circular_kernel_2/intersecting_arcs.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Circular_kernel_2/intersecting_arcs.cpp
rename to 3rdparty/CGAL/examples/Circular_kernel_2/intersecting_arcs.cpp
diff --git a/3rdparty/CGAL/examples/Circular_kernel_3/CMakeLists.txt b/3rdparty/CGAL/examples/Circular_kernel_3/CMakeLists.txt
new file mode 100644
index 0000000..9994ade
--- /dev/null
+++ b/3rdparty/CGAL/examples/Circular_kernel_3/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Circular_kernel_3_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Circular_kernel_3/functor_compare_theta_3.cpp b/3rdparty/CGAL/examples/Circular_kernel_3/functor_compare_theta_3.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Circular_kernel_3/functor_compare_theta_3.cpp
rename to 3rdparty/CGAL/examples/Circular_kernel_3/functor_compare_theta_3.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Circular_kernel_3/functor_has_on_3.cpp b/3rdparty/CGAL/examples/Circular_kernel_3/functor_has_on_3.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Circular_kernel_3/functor_has_on_3.cpp
rename to 3rdparty/CGAL/examples/Circular_kernel_3/functor_has_on_3.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Circular_kernel_3/intersecting_spheres.cpp b/3rdparty/CGAL/examples/Circular_kernel_3/intersecting_spheres.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Circular_kernel_3/intersecting_spheres.cpp
rename to 3rdparty/CGAL/examples/Circular_kernel_3/intersecting_spheres.cpp
diff --git a/3rdparty/CGAL/examples/Circulator/CMakeLists.txt b/3rdparty/CGAL/examples/Circulator/CMakeLists.txt
new file mode 100644
index 0000000..1d96bee
--- /dev/null
+++ b/3rdparty/CGAL/examples/Circulator/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Circulator_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Circulator/circulator_prog1.cpp b/3rdparty/CGAL/examples/Circulator/circulator_prog1.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Circulator/circulator_prog1.cpp
rename to 3rdparty/CGAL/examples/Circulator/circulator_prog1.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Circulator/circulator_prog2.cpp b/3rdparty/CGAL/examples/Circulator/circulator_prog2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Circulator/circulator_prog2.cpp
rename to 3rdparty/CGAL/examples/Circulator/circulator_prog2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Circulator/circulator_prog3.cpp b/3rdparty/CGAL/examples/Circulator/circulator_prog3.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Circulator/circulator_prog3.cpp
rename to 3rdparty/CGAL/examples/Circulator/circulator_prog3.cpp
diff --git a/3rdparty/CGAL/examples/Combinatorial_map/CMakeLists.txt b/3rdparty/CGAL/examples/Combinatorial_map/CMakeLists.txt
new file mode 100644
index 0000000..4a7b4f5
--- /dev/null
+++ b/3rdparty/CGAL/examples/Combinatorial_map/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Combinatorial_map_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL/examples/Combinatorial_map/map_3_dynamic_onmerge.cpp b/3rdparty/CGAL/examples/Combinatorial_map/map_3_dynamic_onmerge.cpp
new file mode 100644
index 0000000..f446f3e
--- /dev/null
+++ b/3rdparty/CGAL/examples/Combinatorial_map/map_3_dynamic_onmerge.cpp
@@ -0,0 +1,134 @@
+#include <CGAL/Combinatorial_map.h>
+#include <CGAL/Combinatorial_map_constructors.h>
+#include <CGAL/Cell_attribute.h>
+#include <iostream>
+#include <cstdlib>
+
+// My item class: no functor is associated with Face_attribute.
+struct Myitem
+{
+  template<class CMap>
+  struct Dart_wrapper
+  {
+    typedef CGAL::Dart<3, CMap> Dart;
+    typedef CGAL::Cell_attribute<CMap, int> Face_attribute;
+    typedef CGAL::cpp11::tuple<void,void,Face_attribute> Attributes;
+  };
+};
+
+// Definition of my combinatorial map.
+typedef CGAL::Combinatorial_map<3,Myitem> CMap_3;
+typedef CMap_3::Dart_handle               Dart_handle;
+typedef CMap_3::Attribute_type<2>::type   Face_attribute;
+
+// Functor called when two faces are merged.
+struct Merge_functor
+{
+  // operator() automatically called before a merge.
+  void operator()(Face_attribute& ca1, Face_attribute& ca2)
+  {
+    ca1.info()=ca1.info()+ca2.info();
+    std::cout<<"After on merge faces: info of face1="<<ca1.info()
+             <<", info of face2="<<ca2.info()<<std::endl;
+  }
+};
+
+// Functor called when one face is split in two.
+struct Split_functor
+{
+  Split_functor(CMap_3& amap) : mmap(amap)
+  {}
+
+  // operator() automatically called after a split.
+  void operator()(Face_attribute& ca1, Face_attribute& ca2)
+  {
+    set_color_of_face(ca1.dart());
+    set_color_of_face(ca2.dart());
+    std::cout<<"After on split faces: info of face1="<<ca1.info()
+             <<", info of face2="<<ca2.info()<<std::endl;
+  }
+
+private:
+
+  // The info of a face is the mean of the info of all its neighboors faces.
+  void set_color_of_face(CMap_3::Dart_handle dh)
+  {
+    int nb=0;
+    int sum=0;
+    for (CMap_3::Dart_of_orbit_range<1>::iterator
+           it=mmap.darts_of_orbit<1>(dh).begin(),
+           itend=mmap.darts_of_orbit<1>(dh).end();
+         it!=itend; ++it, ++nb)
+    { sum+=mmap.info<2>(mmap.beta<2>(it)); }
+
+    mmap.info<2>(dh)=(sum/nb);
+  }
+
+  CMap_3& mmap;
+};
+
+// Function allowing to display all the 2-attributes, and the characteristics
+// of a given combinatorial map.
+void display_map_and_2attributes(CMap_3& cm)
+{
+  for (CMap_3::Attribute_range<2>::type::iterator
+       it=cm.attributes<2>().begin(), itend=cm.attributes<2>().end();
+       it!=itend; ++it)
+  {
+    std::cout<<cm.info_of_attribute<2>(it)<<"; ";
+  }
+  std::cout<<std::endl;
+  cm.display_characteristics(std::cout);
+  std::cout<<", valid="<<cm.is_valid()<<std::endl;
+}
+
+int main()
+{
+  CMap_3 cm;
+
+  // 0) Create 2 hexahedra.
+  Dart_handle dh1 = cm.make_combinatorial_hexahedron();
+  Dart_handle dh2 = cm.make_combinatorial_hexahedron();
+
+  // 1) Create 2-attributes of the first hexahedron, info()==7.
+  for (CMap_3::One_dart_per_incident_cell_range<2, 3>::iterator
+       it=cm.one_dart_per_incident_cell<2,3>(dh1).begin(),
+       itend=cm.one_dart_per_incident_cell<2,3>(dh1).end(); it!=itend; ++it)
+  { cm.set_attribute<2>(it, cm.create_attribute<2>(7)); }
+
+  // 2) Create 2-attributes of the second hexahedron, info()==13.
+  for (CMap_3::One_dart_per_incident_cell_range<2, 3>::iterator it=
+       cm.one_dart_per_incident_cell<2,3>(dh2).begin(),
+       itend=cm.one_dart_per_incident_cell<2,3>(dh2).end(); it!=itend; ++it)
+  { cm.set_attribute<2>(it, cm.create_attribute<2>(13)); }
+
+  // 3) Set the onsplit and onmerge functors.
+  cm.onsplit_functor<2>()=Split_functor(cm);
+  cm.onmerge_functor<2>()=Merge_functor();
+
+  // 4) 3-Sew the two hexahedra along one face. This calls 1 onmerge.
+  cm.sew<3>(dh1, dh2);
+
+  // 5) Display all the values of 2-attributes.
+  display_map_and_2attributes(cm);
+
+  // 6) Insert a vertex in the face between the two hexahedra.
+  //    This calls 4 onsplit.
+  Dart_handle resdart=cm.insert_cell_0_in_cell_2(dh2);
+
+  // 7) Display all the values of 2-attributes.
+  display_map_and_2attributes(cm);
+
+  // 8) "Remove" the dynamic onmerge functor.
+  cm.onmerge_functor<2>()=boost::function<void(Face_attribute&,
+                                               Face_attribute&)>();
+
+  // 9) Remove one edge: this merges two faces, however no dynamic
+  //    functor is called (because it was removed).
+  cm.remove_cell<1>(resdart);
+
+  // 10) Display all the values of 2-attributes.
+  display_map_and_2attributes(cm);
+
+  return EXIT_SUCCESS;
+}
diff --git a/3rdparty/CGAL/examples/Combinatorial_map/map_3_foreach.cpp b/3rdparty/CGAL/examples/Combinatorial_map/map_3_foreach.cpp
new file mode 100644
index 0000000..cbad09c
--- /dev/null
+++ b/3rdparty/CGAL/examples/Combinatorial_map/map_3_foreach.cpp
@@ -0,0 +1,114 @@
+#include <CGAL/Combinatorial_map.h>
+#include <CGAL/Combinatorial_map_constructors.h>
+#include <iostream>
+#include <algorithm>
+
+typedef CGAL::Combinatorial_map<3> CMap_3;
+typedef CMap_3::Dart_handle        Dart_handle;
+
+// Functor used to display all the vertices of a given volume
+template<class CMap, unsigned int i>
+struct Display_vertices_of_cell : public std::unary_function<CMap, void>
+{
+  Display_vertices_of_cell(const CMap& acmap) :
+    cmap(acmap),
+    nb_cell(0)
+  {}
+
+  void operator() (const typename CMap::Dart& d)
+  {
+    std::cout<<i<<"-cell "<<++nb_cell<<" : ";
+    for (typename CMap::template One_dart_per_incident_cell_range<0,i>::
+           const_iterator it=cmap.template one_dart_per_incident_cell<0,i>
+           (cmap.dart_handle(d)).begin(),
+           itend=cmap.template one_dart_per_incident_cell<0,i>
+           (cmap.dart_handle(d)).end();
+         it!=itend; ++it)
+    {
+      std::cout << &*it << "; ";
+    }
+    std::cout<<std::endl;
+  }
+
+  void operator() (const typename CMap::Dart* ptr)
+  { operator() (*ptr); }
+
+private:
+  const CMap& cmap;
+  unsigned int nb_cell;
+};
+
+// Functor used to remove a face
+template<class CMap>
+struct Remove_face : public std::unary_function<CMap, void>
+{
+  Remove_face(CMap& acmap) : cmap(acmap)
+  {}
+
+  void operator() (typename CMap::Dart* d)
+  {
+    cmap.template remove_cell<2>(cmap.dart_handle(*d));
+    std::cout<<"CMap characteristics: ";
+    cmap.display_characteristics(std::cout) << ", valid=" << cmap.is_valid()
+                                            << std::endl;
+  }
+
+private:
+  CMap& cmap;
+};
+
+
+// Functor allowing to transform a variable into its address.
+template<typename T>
+struct Take_adress : public std::unary_function<T, T*>
+{
+  T* operator() (T& t) const
+  { return &t; }
+};
+
+int main()
+{
+  CMap_3 cmap;
+
+  // Create two tetrahedra.
+  Dart_handle d1 = cmap.make_combinatorial_tetrahedron();
+  Dart_handle d2 = cmap.make_combinatorial_tetrahedron();
+
+  // Display the vertices of each volume by iterating on darts.
+  std::cout<<"********Volumes********"<<std::endl;
+  std::for_each(cmap.one_dart_per_cell<3>().begin(),
+                cmap.one_dart_per_cell<3>().end(),
+                Display_vertices_of_cell<CMap_3,3>(cmap));
+
+  // 3-Sew the 2 tetrahedra along one facet
+  cmap.sew<3>(d1, d2);
+
+  // Display the vertices of each face by iterating on darts.
+  std::cout<<"********Faces********"<<std::endl;
+  std::for_each(cmap.one_dart_per_cell<2>().begin(),
+                cmap.one_dart_per_cell<2>().end(),
+                Display_vertices_of_cell<CMap_3,2>(cmap));
+
+    // We display the map characteristics.
+  std::cout<<"CMap characteristics: ";
+  cmap.display_characteristics(std::cout) << ", valid=" << cmap.is_valid()
+                                          << std::endl << std::endl;
+
+  std::vector<CMap_3::Dart*> toremove;
+
+  // Copy in vector toremove one dart per face
+  std::copy(boost::transform_iterator<Take_adress<CMap_3::Dart>,
+                                      CMap_3::One_dart_per_cell_range<2>::iterator>
+            (cmap.one_dart_per_cell<2>().begin(),
+             Take_adress<CMap_3::Dart>()),
+            boost::transform_iterator<Take_adress<CMap_3::Dart>,
+                                      CMap_3::One_dart_per_cell_range<2>::iterator>
+            (cmap.one_dart_per_cell<2>().end(),
+             Take_adress<CMap_3::Dart>()),
+            back_inserter(toremove));
+
+  // Remove each face sequentially.
+  std::for_each(toremove.begin(), toremove.end(), Remove_face<CMap_3>(cmap));
+
+  return EXIT_SUCCESS;
+}
diff --git a/3rdparty/CGAL/examples/Combinatorial_map/map_3_marks.cpp b/3rdparty/CGAL/examples/Combinatorial_map/map_3_marks.cpp
new file mode 100644
index 0000000..fd2718f
--- /dev/null
+++ b/3rdparty/CGAL/examples/Combinatorial_map/map_3_marks.cpp
@@ -0,0 +1,57 @@
+#include <CGAL/Combinatorial_map.h>
+#include <CGAL/Combinatorial_map_constructors.h>
+#include <iostream>
+#include <cstdlib>
+
+typedef CGAL::Combinatorial_map<3> CMap_3;
+typedef CMap_3::Dart_handle Dart_handle;
+typedef CMap_3::size_type size_type;
+
+int main()
+{
+  CMap_3 cm;
+
+  // 1) Reserve a mark.
+  size_type amark;
+  try
+  {
+    amark = cm.get_new_mark();
+  }
+  catch (CMap_3::Exception_no_more_available_mark)
+  {
+    std::cerr<<"No more free mark, exit."<<std::endl;
+    exit(-1);
+  }
+
+  // 2) Create two tetrahedra.
+  Dart_handle dh1 = cm.make_combinatorial_tetrahedron();
+  Dart_handle dh2 = cm.make_combinatorial_tetrahedron();
+
+  // 3) 3-sew them.
+  cm.sew<3>(dh1, dh2);
+
+  // 4) Mark the darts belonging to the first tetrahedron.
+  for  (CMap_3::Dart_of_cell_range<3>::iterator
+          it(cm.darts_of_cell<3>(dh1).begin()),
+          itend(cm.darts_of_cell<3>(dh1).end()); it!=itend; ++it)
+    cm.mark(it, amark);
+
+  // 4) Remove the common 2-cell between the two cubes:
+  //    the two tetrahedra are merged.
+  cm.remove_cell<2>(dh1);
+
+  // 5) Thanks to the mark, we know which darts come from the first tetrahedron.
+  unsigned int res=0;
+  for (CMap_3::Dart_range::iterator it(cm.darts().begin()),
+	 itend(cm.darts().end()); it!=itend; ++it)
+  {
+    if ( cm.is_marked(it, amark) )
+      ++res;
+  }
+
+  std::cout<<"Number of darts from the first tetrahedron: "<<res<<std::endl;
+  cm.free_mark(amark);
+
+  return EXIT_SUCCESS;
+}
+
diff --git a/3rdparty/CGAL/examples/Combinatorial_map/map_3_operations.cpp b/3rdparty/CGAL/examples/Combinatorial_map/map_3_operations.cpp
new file mode 100644
index 0000000..1156a30
--- /dev/null
+++ b/3rdparty/CGAL/examples/Combinatorial_map/map_3_operations.cpp
@@ -0,0 +1,68 @@
+#include <CGAL/Combinatorial_map.h>
+#include <CGAL/Combinatorial_map_constructors.h>
+#include <iostream>
+#include <cstdlib>
+
+typedef CGAL::Combinatorial_map<3> CMap_3;
+typedef CMap_3::Dart_handle        Dart_handle;
+
+int main()
+{
+  CMap_3 cm;
+
+  // Create one combinatorial hexahedron.
+  Dart_handle dh1 = cm.make_combinatorial_hexahedron();
+
+  // Add two edges along two opposite facets.
+  CGAL_assertion( cm.is_insertable_cell_1_in_cell_2
+                        (cm.beta(dh1,1),cm.beta(dh1,0)) );
+
+  cm.insert_cell_1_in_cell_2(cm.beta(dh1,1), cm.beta(dh1,0));
+  CGAL_assertion( cm.is_valid() );
+
+  Dart_handle dh2=cm.beta(dh1,2,1,1,2);
+
+  CGAL_assertion( cm.is_insertable_cell_1_in_cell_2
+                              (dh2,cm.beta(dh2,1,1)) );
+
+  cm.insert_cell_1_in_cell_2(dh2, cm.beta(dh2,1,1));
+  CGAL_assertion( cm.is_valid() );
+
+  // Insert a facet along these two new edges plus two initial edges
+  // of the hexahedron.
+  std::vector<Dart_handle> path;
+  path.push_back(cm.beta(dh1,1));
+  path.push_back(cm.beta(dh1,0,2,1));
+  path.push_back(cm.beta(dh2,0));
+  path.push_back(cm.beta(dh2,2,1));
+
+  CGAL_assertion( (cm.is_insertable_cell_2_in_cell_3
+		               (path.begin(),path.end())) );
+
+  Dart_handle dh3=cm.insert_cell_2_in_cell_3(path.begin(),path.end());
+  CGAL_assertion( cm.is_valid() );
+
+  // Display the combinatorial map characteristics.
+  cm.display_characteristics(std::cout) << ", valid=" <<
+    cm.is_valid() << std::endl;
+
+  // We use the removal operations to get back to the initial hexahedron.
+  CGAL_assertion( (cm.is_removable<2>(dh3)) );
+  cm.remove_cell<2>(dh3);
+  CGAL_assertion( cm.is_valid() );
+
+  CGAL_assertion( (cm.is_removable<1>(cm.beta(dh1,1))) );
+  cm.remove_cell<1>(cm.beta(dh1,1));
+  CGAL_assertion( cm.is_valid() );
+
+  CGAL_assertion( (cm.is_removable<1>(cm.beta(dh2,0))) );
+  cm.remove_cell<1>(cm.beta(dh2,0));
+  CGAL_assertion( cm.is_valid() );
+
+  // Display the combinatorial map characteristics.
+  cm.display_characteristics(std::cout) << ", valid="
+					<< cm.is_valid() << std::endl;
+
+  return EXIT_SUCCESS;
+}
+
diff --git a/3rdparty/CGAL/examples/Combinatorial_map/map_3_simple_example.cpp b/3rdparty/CGAL/examples/Combinatorial_map/map_3_simple_example.cpp
new file mode 100644
index 0000000..32268a1
--- /dev/null
+++ b/3rdparty/CGAL/examples/Combinatorial_map/map_3_simple_example.cpp
@@ -0,0 +1,45 @@
+#include <CGAL/Combinatorial_map.h>
+#include <CGAL/Combinatorial_map_constructors.h>
+#include <iostream>
+#include <cstdlib>
+
+typedef CGAL::Combinatorial_map<3> CMap_3;
+typedef CMap_3::Dart_const_handle Dart_const_handle;
+
+  int main()
+  {
+    CMap_3 cm;
+
+    // Create two tetrahedra.
+    Dart_const_handle dh1 = cm.make_combinatorial_tetrahedron();
+    Dart_const_handle dh2 = cm.make_combinatorial_tetrahedron();
+
+    // Display the combinatorial map characteristics.
+    cm.display_characteristics(std::cout);
+    std::cout<<", valid="<<cm.is_valid()<<std::endl;
+
+    unsigned int res = 0;
+    // Iterate over all the darts of the first tetrahedron.
+    // Note that CMap_3::Dart_of_orbit_range<1,2> in 3D is equivalent to
+    // CMap_3::Dart_of_cell_range<3>.
+    for  (CMap_3::Dart_of_orbit_range<1,2>::const_iterator
+          it(cm.darts_of_orbit<1,2>(dh1).begin()),
+          itend(cm.darts_of_orbit<1,2>(dh1).end()); it!=itend; ++it)
+       ++res;
+
+    std::cout<<"Number of darts of the first tetrahedron: "
+             <<res<<std::endl;
+
+    res = 0;
+    // Iterate over all the darts of the facet containing dh2.
+    for (CMap_3::Dart_of_orbit_range<1>::const_iterator
+         it(cm.darts_of_orbit<1>(dh2).begin()),
+         itend(cm.darts_of_orbit<1>(dh2).end()); it!=itend; ++it)
+       ++res;
+
+    std::cout<<"Number of darts of the facet containing dh2: "
+             <<res<<std::endl;
+
+    return EXIT_SUCCESS;
+}
+
diff --git a/3rdparty/CGAL/examples/Combinatorial_map/map_3_with_colored_facets.cpp b/3rdparty/CGAL/examples/Combinatorial_map/map_3_with_colored_facets.cpp
new file mode 100644
index 0000000..f834a55
--- /dev/null
+++ b/3rdparty/CGAL/examples/Combinatorial_map/map_3_with_colored_facets.cpp
@@ -0,0 +1,95 @@
+#include <CGAL/Combinatorial_map.h>
+#include <CGAL/Combinatorial_map_constructors.h>
+#include <CGAL/Cell_attribute.h>
+#include <iostream>
+#include <algorithm>
+#include <cstdlib>
+
+struct Sum_functor
+{
+  template<class Cell_attribute>
+  void operator()(Cell_attribute& ca1,Cell_attribute& ca2)
+  { ca1.info()=ca1.info()+ca2.info(); }
+};
+struct Divide_by_two_functor
+{
+  template<class Cell_attribute>
+  void operator()(Cell_attribute& ca1,Cell_attribute& ca2)
+  {
+    ca1.info()=(ca1.info()/2);
+    ca2.info()=(ca1.info());
+  }
+};
+
+struct Myitem
+{
+  template<class CMap>
+  struct Dart_wrapper
+  {
+    typedef CGAL::Dart<3, CMap> Dart;
+    typedef CGAL::Cell_attribute<CMap, int, CGAL::Tag_true,
+     Sum_functor, Divide_by_two_functor> Facet_attribute;
+    typedef CGAL::cpp11::tuple<void,void,Facet_attribute> Attributes;
+  };
+};
+
+typedef CGAL::Combinatorial_map<3,Myitem> CMap_3;
+typedef CMap_3::Dart_handle               Dart_handle;
+
+int main()
+{
+  CMap_3 cm;
+
+  // Create 2 hexahedra.
+  Dart_handle dh1 = cm.make_combinatorial_hexahedron();
+  Dart_handle dh2 = cm.make_combinatorial_hexahedron();
+
+  // 1) Create all 2-attributes and associated them to darts.
+  for (CMap_3::Dart_range::iterator
+       it=cm.darts().begin(), itend=cm.darts().end();
+       it!=itend; ++it)
+  {
+    if ( cm.attribute<2>(it)==NULL )
+      cm.set_attribute<2>(it, cm.create_attribute<2>());
+  }
+
+  // 2) Set the color of all facets of the first hexahedron to 7.
+  for (CMap_3::One_dart_per_incident_cell_range<2, 3>::iterator
+       it=cm.one_dart_per_incident_cell<2,3>(dh1).begin(),
+       itend=cm.one_dart_per_incident_cell<2,3>(dh1).end(); it!=itend; ++it)
+  { cm.info<2>(it)=7; }
+
+  // 3) Set the color of all facets of the second hexahedron to 13.
+  for (CMap_3::One_dart_per_incident_cell_range<2, 3>::iterator it=
+       cm.one_dart_per_incident_cell<2,3>(dh2).begin(),
+       itend=cm.one_dart_per_incident_cell<2,3>(dh2).end(); it!=itend; ++it)
+  { cm.info<2>(it)=13; }
+
+  // 4) 3-Sew the two hexahedra along one facet.
+  cm.sew<3>(dh1, dh2);
+
+  // 5) Display all the values of 2-attributes.
+  for (CMap_3::Attribute_range<2>::type::iterator
+       it=cm.attributes<2>().begin(), itend=cm.attributes<2>().end();
+       it!=itend; ++it)
+  {
+    std::cout<<cm.info_of_attribute<2>(it)<<"; ";
+  }
+  std::cout<<std::endl;
+
+  // 6) Insert a vertex in the facet between the two hexahedra.
+  cm.insert_cell_0_in_cell_2(dh2);
+
+  // 7) Display all the values of 2-attributes.
+  for (CMap_3::Attribute_range<2>::type::iterator
+       it=cm.attributes<2>().begin(), itend=cm.attributes<2>().end();
+       it!=itend; ++it)
+  {
+    std::cout<<cm.info_of_attribute<2>(it)<<"; ";
+  }
+  std::cout<<std::endl;
+  cm.display_characteristics(std::cout);
+  std::cout<<", valid="<<cm.is_valid()<<std::endl;
+
+  return EXIT_SUCCESS;
+}
diff --git a/3rdparty/CGAL/examples/Combinatorial_map/map_4_simple_example.cpp b/3rdparty/CGAL/examples/Combinatorial_map/map_4_simple_example.cpp
new file mode 100644
index 0000000..16bc8b3
--- /dev/null
+++ b/3rdparty/CGAL/examples/Combinatorial_map/map_4_simple_example.cpp
@@ -0,0 +1,48 @@
+#include <CGAL/Combinatorial_map.h>
+#include <CGAL/Combinatorial_map_constructors.h>
+#include <iostream>
+#include <cstdlib>
+
+typedef CGAL::Combinatorial_map<4> CMap_4;
+typedef CMap_4::Dart_handle Dart_handle;
+
+Dart_handle make_triangle(CMap_4& amap)
+{
+ Dart_handle d1 = amap.create_dart();
+ Dart_handle d2 = amap.create_dart();
+ Dart_handle d3 = amap.create_dart();
+ amap.link_beta<1>(d1,d2);
+ amap.link_beta<1>(d2,d3);
+ amap.link_beta<1>(d3,d1);
+ return d1;
+}
+
+Dart_handle make_tetrahedral(CMap_4& amap)
+{
+  Dart_handle d1 = make_triangle(amap);
+  Dart_handle d2 = make_triangle(amap);
+  Dart_handle d3 = make_triangle(amap);
+  Dart_handle d4 = make_triangle(amap);
+  amap.link_beta<2>(d1, d2);
+  amap.link_beta<2>(d3, amap.beta(d2,0));
+  amap.link_beta<2>(amap.beta(d1,1), amap.beta(d3,0));
+  amap.link_beta<2>(d4, amap.beta(d2,1));
+  amap.link_beta<2>(amap.beta(d4,0), amap.beta(d3,1));
+  amap.link_beta<2>(amap.beta(d4,1), amap.beta(d1,0));
+  return d1;
+}
+
+int main()
+{
+  CMap_4 cm;
+  Dart_handle d1 = make_tetrahedral(cm);
+  Dart_handle d2 = make_tetrahedral(cm);
+
+  cm.sew<4>(d1,d2);
+
+  cm.display_characteristics(std::cout);
+  std::cout<<", valid="<<cm.is_valid()<<std::endl;
+
+  return EXIT_SUCCESS;
+}
+
diff --git a/3rdparty/CGAL/examples/Cone_spanners_2/CMakeLists.txt b/3rdparty/CGAL/examples/Cone_spanners_2/CMakeLists.txt
new file mode 100644
index 0000000..dfa27f6
--- /dev/null
+++ b/3rdparty/CGAL/examples/Cone_spanners_2/CMakeLists.txt
@@ -0,0 +1,35 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Cone_spanners_2_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET COMPONENTS Core)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  if (MSVC)
+    # Turn off a boost related warning that appears with VC2015
+    SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4172")
+  endif()
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+
+  message(STATUS "This program requires the CGAL library, and will not be compiled.")
+
+endif()
+
diff --git a/3rdparty/CGAL/examples/Cone_spanners_2/README b/3rdparty/CGAL/examples/Cone_spanners_2/README
new file mode 100644
index 0000000..90de91b
--- /dev/null
+++ b/3rdparty/CGAL/examples/Cone_spanners_2/README
@@ -0,0 +1,9 @@
+[Examples description]
+compute_cones.cpp: this example computes the cone boundaries given the number of cones
+   and the initial direction.
+
+theta_io.cpp: this example constructs a Theta graph exactly with an input file containing a vertex list,
+   and then generates the Gnuplot files for plotting the constructed Theta graph.
+
+dijkstra_theta.cpp: this example constructs Theta graph first and then calculates
+   the shortest paths on this graph by calling the Dijkstra's algorithm from BGL.
diff --git a/3rdparty/CGAL/examples/Cone_spanners_2/compute_cones.cmd b/3rdparty/CGAL/examples/Cone_spanners_2/compute_cones.cmd
new file mode 100644
index 0000000..1e8b314
--- /dev/null
+++ b/3rdparty/CGAL/examples/Cone_spanners_2/compute_cones.cmd
@@ -0,0 +1 @@
+6
diff --git a/3rdparty/CGAL/examples/Cone_spanners_2/compute_cones.cpp b/3rdparty/CGAL/examples/Cone_spanners_2/compute_cones.cpp
new file mode 100644
index 0000000..99da524
--- /dev/null
+++ b/3rdparty/CGAL/examples/Cone_spanners_2/compute_cones.cpp
@@ -0,0 +1,48 @@
+#include <cstdlib>
+#include <iostream>
+#include <iterator>
+#include <vector>
+#include <CGAL/Exact_predicates_exact_constructions_kernel_with_root_of.h>
+#include <CGAL/Compute_cone_boundaries_2.h>
+
+// select the kernel type
+typedef CGAL::Exact_predicates_exact_constructions_kernel_with_root_of   Kernel;
+typedef Kernel::Point_2                   Point_2;
+typedef Kernel::Direction_2               Direction_2;
+
+int main(int argc, char ** argv) {
+
+  if (argc < 2) {
+    std::cout << "Usage: " << argv[0] << " <no. of cones> [<direction-x> <direction-y>]" << std::endl;
+    return 1;
+  }
+
+  unsigned int k = atoi(argv[1]);
+  if (k<2) {
+    std::cout << "The number of cones should be larger than 1!" << std::endl;
+    return 1;
+  }
+
+  Direction_2 initial_direction;
+  if (argc == 2)
+    initial_direction = Direction_2(1, 0);  // default initial_direction
+  else if (argc == 4)
+    initial_direction = Direction_2(atof(argv[2]), atof(argv[3]));
+  else {
+    std::cout << "Usage: " << argv[0] << " <no. of cones> [<direction-x> <direction-y>]" << std::endl;
+    return 1;
+  }
+
+  // construct the functor
+  CGAL::Compute_cone_boundaries_2<Kernel> cones;
+  // create the vector rays to store the results
+  std::vector<Direction_2> rays(k);
+  // compute the cone boundaries and store them in rays
+  cones(k, initial_direction, rays.begin());
+
+  // display the computed rays, starting from the initial direction, ccw order
+  for (unsigned int i=0; i<k; i++)
+    std::cout << "Ray " << i << ": " << rays[i] << std::endl;
+
+  return 0;
+}
diff --git a/3rdparty/CGAL/examples/Cone_spanners_2/data/n20.cin b/3rdparty/CGAL/examples/Cone_spanners_2/data/n20.cin
new file mode 100644
index 0000000..ea2cb1f
--- /dev/null
+++ b/3rdparty/CGAL/examples/Cone_spanners_2/data/n20.cin
@@ -0,0 +1,20 @@
+97.6188    489.679
+673.018    672.436
+67.6374    539.91
+40.0488    138.312
+110.286    659.128
+399.326    677.844
+585.28    614.301
+880.102    831.773
+752.166    840.363
+437.925    993.181
+120.746    215.884
+32.6144    584.674
+845.06    328.004
+656.569    774.867
+843.833    334.36
+368.169    941.452
+824.039    41.1866
+613.888    891.676
+581.096    653.936
+29.9877    691.382
diff --git a/3rdparty/CGAL/examples/Cone_spanners_2/data/n9.cin b/3rdparty/CGAL/examples/Cone_spanners_2/data/n9.cin
new file mode 100644
index 0000000..cd500d4
--- /dev/null
+++ b/3rdparty/CGAL/examples/Cone_spanners_2/data/n9.cin
@@ -0,0 +1,9 @@
+0.000000  0.000000
+0.000000  1.000000
+0.000000  2.000000
+1.000000  0.000000
+1.000000  1.000000
+1.000000  2.000000
+2.000000  0.000000
+2.000000  1.000000
+2.000000  2.000000
diff --git a/3rdparty/CGAL/examples/Cone_spanners_2/dijkstra_theta.cmd b/3rdparty/CGAL/examples/Cone_spanners_2/dijkstra_theta.cmd
new file mode 100644
index 0000000..5ab8232
--- /dev/null
+++ b/3rdparty/CGAL/examples/Cone_spanners_2/dijkstra_theta.cmd
@@ -0,0 +1 @@
+6 data/n20.cin
diff --git a/3rdparty/CGAL/examples/Cone_spanners_2/dijkstra_theta.cpp b/3rdparty/CGAL/examples/Cone_spanners_2/dijkstra_theta.cpp
new file mode 100644
index 0000000..8594f37
--- /dev/null
+++ b/3rdparty/CGAL/examples/Cone_spanners_2/dijkstra_theta.cpp
@@ -0,0 +1,102 @@
+#include <cstdlib>
+#include <iostream>
+#include <fstream>
+#include <iterator>
+#include <vector>
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+#include <CGAL/Construct_theta_graph_2.h>
+#include <CGAL/property_map.h>
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/adjacency_list.hpp>
+#include <boost/property_map/property_map.hpp>
+#include <boost/graph/dijkstra_shortest_paths.hpp>
+
+// select the kernel type
+typedef CGAL::Exact_predicates_inexact_constructions_kernel   Kernel;
+typedef Kernel::Point_2                   Point_2;
+typedef Kernel::Direction_2               Direction_2;
+
+/* define the struct for edge property */
+struct Edge_property {
+  /* record the Euclidean length of the edge */
+  double euclidean_length;
+};
+
+// define the Graph (e.g., to be undirected,
+// and to use Edge_property as the edge property, etc.)
+typedef boost::adjacency_list<boost::listS,
+                              boost::vecS,
+                              boost::undirectedS,
+                              Point_2,
+                              Edge_property>  Graph;
+
+int main(int argc, char ** argv)
+{
+
+  if (argc != 3) {
+    std::cout << "Usage: " << argv[0] << " <no. of cones> <input filename>" << std::endl;
+    return 1;
+  }
+  unsigned int k = atoi(argv[1]);
+  if (k<2) {
+    std::cout << "The number of cones should be larger than 1!" << std::endl;
+    return 1;
+  }
+  // open the file containing the vertex list
+  std::ifstream inf(argv[2]);
+  if (!inf) {
+    std::cout << "Cannot open file " << argv[1] << "!" << std::endl;
+    return 1;
+  }
+
+  // iterators for reading the vertex list file
+  std::istream_iterator< Point_2 > input_begin( inf );
+  std::istream_iterator< Point_2 > input_end;
+
+  // initialize the functor
+  // If the initial direction is omitted, the x-axis will be used
+  CGAL::Construct_theta_graph_2<Kernel, Graph> theta(k);
+  // create an adjacency_list object
+  Graph g;
+  // construct the theta graph on the vertex list
+  theta(input_begin, input_end, g);
+
+  // select a source vertex for dijkstra's algorithm
+  boost::graph_traits<Graph>::vertex_descriptor v0;
+  v0 = vertex(0, g);
+  std::cout << "The source vertex is: " << g[v0] << std::endl;
+
+  std::cout << "The index of source vertex is: " << v0 << std::endl;
+
+  // calculating edge length in Euclidean distance and store them in the edge property
+  boost::graph_traits<Graph>::edge_iterator ei, ei_end;
+  for (boost::tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) {
+    boost::graph_traits<Graph>::edge_descriptor e = *ei;
+    boost::graph_traits<Graph>::vertex_descriptor  u = source(e, g);
+    boost::graph_traits<Graph>::vertex_descriptor  v = target(e, g);
+    const Point_2& pu = g[u];
+    const Point_2& pv = g[v];
+
+    double dist = CGAL::sqrt( CGAL::to_double(CGAL::squared_distance(pu,pv)) );
+    g[e].euclidean_length = dist;
+    std::cout << "Edge (" << g[u] << ", " << g[v] << "): " << dist << std::endl;
+  }
+
+  // calculating the distances from v0 to other vertices
+  unsigned int n = num_vertices(g);
+  // vector for storing the results
+  std::vector<double> distances(n);
+  // Calling the Dijkstra's algorithm implementation from boost.
+  boost::dijkstra_shortest_paths(g,
+                                 v0,
+                                 boost::weight_map(get(&Edge_property::euclidean_length, g)).
+                                 distance_map(CGAL::make_property_map(distances)) );
+
+  std::cout << "distances are:" << std::endl;
+  for (unsigned int i=0; i < n; ++i) {
+    std::cout << "distances[" << i << "] = " << distances[i] << ", (x,y)=" << g[vertex(i, g)];
+    std::cout << " at Vertex " << i << std::endl;
+  }
+
+  return 0;
+}
diff --git a/3rdparty/CGAL/examples/Cone_spanners_2/theta_io.cmd b/3rdparty/CGAL/examples/Cone_spanners_2/theta_io.cmd
new file mode 100644
index 0000000..ddce444
--- /dev/null
+++ b/3rdparty/CGAL/examples/Cone_spanners_2/theta_io.cmd
@@ -0,0 +1 @@
+4 data/n9.cin
diff --git a/3rdparty/CGAL/examples/Cone_spanners_2/theta_io.cpp b/3rdparty/CGAL/examples/Cone_spanners_2/theta_io.cpp
new file mode 100644
index 0000000..a2e1041
--- /dev/null
+++ b/3rdparty/CGAL/examples/Cone_spanners_2/theta_io.cpp
@@ -0,0 +1,79 @@
+#include <cstdlib>
+#include <iostream>
+#include <fstream>
+#include <iterator>
+#include <string>
+#include <vector>
+#include <boost/lexical_cast.hpp>
+#include <CGAL/Exact_predicates_exact_constructions_kernel_with_root_of.h>
+#include <CGAL/Construct_theta_graph_2.h>
+#include <CGAL/gnuplot_output_2.h>
+
+// select the kernel type
+typedef CGAL::Exact_predicates_exact_constructions_kernel_with_root_of   Kernel;
+typedef Kernel::Point_2                   Point_2;
+typedef Kernel::Direction_2               Direction_2;
+/* Note: due to a bug in the boost library, using a directed graph
+ * will cause a compilation error with g++ and clang++ when using c++11 standard.
+ * See http://lists.boost.org/Archives/boost/2016/05/229458.php.
+ */
+// define the graph type
+typedef boost::adjacency_list<boost::listS,
+                              boost::vecS,
+                              #ifdef CGAL_CXX11
+                              boost::undirectedS,
+                              #else
+                              boost::directedS,
+                              #endif
+                              Point_2
+                             > Graph;
+
+int main(int argc, char ** argv)
+{
+  if (argc < 3) {
+    std::cout << "Usage: " << argv[0] << " <no. of cones> <input filename> [<direction-x> <direction-y>]" << std::endl;
+    return 1;
+  }
+
+  unsigned int k = atoi(argv[1]);
+  if (k<2) {
+    std::cout << "The number of cones should be larger than 1!" << std::endl;
+    return 1;
+  }
+
+  // open the file containing the vertex list
+  std::ifstream inf(argv[2]);
+  if (!inf) {
+    std::cout << "Cannot open file " << argv[2] << "!" << std::endl;
+    return 1;
+  }
+
+  Direction_2 initial_direction;
+  if (argc == 3)
+    initial_direction = Direction_2(1, 0);  // default initial_direction
+  else if (argc == 5)
+    initial_direction = Direction_2(atof(argv[3]), atof(argv[4]));
+  else {
+    std::cout << "Usage: " << argv[0] << " <no. of cones> <input filename> [<direction-x> <direction-y>]" << std::endl;
+    return 1;
+  }
+
+  // iterators for reading the vertex list file
+  std::istream_iterator<Point_2> input_begin( inf );
+  std::istream_iterator<Point_2> input_end;
+
+  // initialize the functor
+  CGAL::Construct_theta_graph_2<Kernel, Graph> theta(k, initial_direction);
+  // create an adjacency_list object
+  Graph g;
+  // construct the theta graph on the vertex list
+  theta(input_begin, input_end, g);
+
+  // obtain the number of vertices in the constructed graph
+  unsigned int n = boost::num_vertices(g);
+  // generate gnuplot files for plotting this graph
+  std::string file_prefix = "t" + boost::lexical_cast<std::string>(k) + "n" + boost::lexical_cast<std::string>(n);
+  CGAL::gnuplot_output_2(g, file_prefix);
+
+  return 0;
+}
diff --git a/3rdparty/CGAL/examples/Convex_decomposition_3/CMakeLists.txt b/3rdparty/CGAL/examples/Convex_decomposition_3/CMakeLists.txt
new file mode 100644
index 0000000..664a37c
--- /dev/null
+++ b/3rdparty/CGAL/examples/Convex_decomposition_3/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Convex_decomposition_3_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Convex_decomposition_3/list_of_convex_parts.cin b/3rdparty/CGAL/examples/Convex_decomposition_3/list_of_convex_parts.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Convex_decomposition_3/list_of_convex_parts.cin
rename to 3rdparty/CGAL/examples/Convex_decomposition_3/list_of_convex_parts.cin
diff --git a/3rdparty/CGAL-4.8/examples/Convex_decomposition_3/list_of_convex_parts.cpp b/3rdparty/CGAL/examples/Convex_decomposition_3/list_of_convex_parts.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Convex_decomposition_3/list_of_convex_parts.cpp
rename to 3rdparty/CGAL/examples/Convex_decomposition_3/list_of_convex_parts.cpp
diff --git a/3rdparty/CGAL/examples/Convex_hull_2/CMakeLists.txt b/3rdparty/CGAL/examples/Convex_hull_2/CMakeLists.txt
new file mode 100644
index 0000000..4409baa
--- /dev/null
+++ b/3rdparty/CGAL/examples/Convex_hull_2/CMakeLists.txt
@@ -0,0 +1,32 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Convex_hull_2_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+    include_directories (BEFORE "include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Convex_hull_2/array_convex_hull_2.cpp b/3rdparty/CGAL/examples/Convex_hull_2/array_convex_hull_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Convex_hull_2/array_convex_hull_2.cpp
rename to 3rdparty/CGAL/examples/Convex_hull_2/array_convex_hull_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Convex_hull_2/ch_from_cin_to_cout.cin b/3rdparty/CGAL/examples/Convex_hull_2/ch_from_cin_to_cout.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Convex_hull_2/ch_from_cin_to_cout.cin
rename to 3rdparty/CGAL/examples/Convex_hull_2/ch_from_cin_to_cout.cin
diff --git a/3rdparty/CGAL-4.8/examples/Convex_hull_2/ch_from_cin_to_cout.cpp b/3rdparty/CGAL/examples/Convex_hull_2/ch_from_cin_to_cout.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Convex_hull_2/ch_from_cin_to_cout.cpp
rename to 3rdparty/CGAL/examples/Convex_hull_2/ch_from_cin_to_cout.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Convex_hull_2/ch_graham_anderson.cin b/3rdparty/CGAL/examples/Convex_hull_2/ch_graham_anderson.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Convex_hull_2/ch_graham_anderson.cin
rename to 3rdparty/CGAL/examples/Convex_hull_2/ch_graham_anderson.cin
diff --git a/3rdparty/CGAL-4.8/examples/Convex_hull_2/ch_graham_anderson.cpp b/3rdparty/CGAL/examples/Convex_hull_2/ch_graham_anderson.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Convex_hull_2/ch_graham_anderson.cpp
rename to 3rdparty/CGAL/examples/Convex_hull_2/ch_graham_anderson.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Convex_hull_2/ch_timing.cpp b/3rdparty/CGAL/examples/Convex_hull_2/ch_timing.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Convex_hull_2/ch_timing.cpp
rename to 3rdparty/CGAL/examples/Convex_hull_2/ch_timing.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Convex_hull_2/convex_hull_yz.cin b/3rdparty/CGAL/examples/Convex_hull_2/convex_hull_yz.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Convex_hull_2/convex_hull_yz.cin
rename to 3rdparty/CGAL/examples/Convex_hull_2/convex_hull_yz.cin
diff --git a/3rdparty/CGAL-4.8/examples/Convex_hull_2/convex_hull_yz.cpp b/3rdparty/CGAL/examples/Convex_hull_2/convex_hull_yz.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Convex_hull_2/convex_hull_yz.cpp
rename to 3rdparty/CGAL/examples/Convex_hull_2/convex_hull_yz.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Convex_hull_2/files/CD500 b/3rdparty/CGAL/examples/Convex_hull_2/files/CD500
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Convex_hull_2/files/CD500
rename to 3rdparty/CGAL/examples/Convex_hull_2/files/CD500
diff --git a/3rdparty/CGAL-4.8/examples/Convex_hull_2/include/CGAL/ch_timing_2.h b/3rdparty/CGAL/examples/Convex_hull_2/include/CGAL/ch_timing_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Convex_hull_2/include/CGAL/ch_timing_2.h
rename to 3rdparty/CGAL/examples/Convex_hull_2/include/CGAL/ch_timing_2.h
diff --git a/3rdparty/CGAL-4.8/examples/Convex_hull_2/include/CGAL/ch_timing_2_impl.h b/3rdparty/CGAL/examples/Convex_hull_2/include/CGAL/ch_timing_2_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Convex_hull_2/include/CGAL/ch_timing_2_impl.h
rename to 3rdparty/CGAL/examples/Convex_hull_2/include/CGAL/ch_timing_2_impl.h
diff --git a/3rdparty/CGAL-4.8/examples/Convex_hull_2/iostream_convex_hull_2.cin b/3rdparty/CGAL/examples/Convex_hull_2/iostream_convex_hull_2.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Convex_hull_2/iostream_convex_hull_2.cin
rename to 3rdparty/CGAL/examples/Convex_hull_2/iostream_convex_hull_2.cin
diff --git a/3rdparty/CGAL-4.8/examples/Convex_hull_2/iostream_convex_hull_2.cpp b/3rdparty/CGAL/examples/Convex_hull_2/iostream_convex_hull_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Convex_hull_2/iostream_convex_hull_2.cpp
rename to 3rdparty/CGAL/examples/Convex_hull_2/iostream_convex_hull_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Convex_hull_2/vector_convex_hull_2.cpp b/3rdparty/CGAL/examples/Convex_hull_2/vector_convex_hull_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Convex_hull_2/vector_convex_hull_2.cpp
rename to 3rdparty/CGAL/examples/Convex_hull_2/vector_convex_hull_2.cpp
diff --git a/3rdparty/CGAL/examples/Convex_hull_3/CMakeLists.txt b/3rdparty/CGAL/examples/Convex_hull_3/CMakeLists.txt
new file mode 100644
index 0000000..ab6ae4a
--- /dev/null
+++ b/3rdparty/CGAL/examples/Convex_hull_3/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Convex_hull_3_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Convex_hull_3/dynamic_hull_3.cpp b/3rdparty/CGAL/examples/Convex_hull_3/dynamic_hull_3.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Convex_hull_3/dynamic_hull_3.cpp
rename to 3rdparty/CGAL/examples/Convex_hull_3/dynamic_hull_3.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Convex_hull_3/halfspace_intersection_3.cpp b/3rdparty/CGAL/examples/Convex_hull_3/halfspace_intersection_3.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Convex_hull_3/halfspace_intersection_3.cpp
rename to 3rdparty/CGAL/examples/Convex_hull_3/halfspace_intersection_3.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Convex_hull_3/lloyd_algorithm.cpp b/3rdparty/CGAL/examples/Convex_hull_3/lloyd_algorithm.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Convex_hull_3/lloyd_algorithm.cpp
rename to 3rdparty/CGAL/examples/Convex_hull_3/lloyd_algorithm.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Convex_hull_3/quickhull_3.cpp b/3rdparty/CGAL/examples/Convex_hull_3/quickhull_3.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Convex_hull_3/quickhull_3.cpp
rename to 3rdparty/CGAL/examples/Convex_hull_3/quickhull_3.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Core/CMakeLists.txt b/3rdparty/CGAL/examples/Core/CMakeLists.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Core/CMakeLists.txt
rename to 3rdparty/CGAL/examples/Core/CMakeLists.txt
diff --git a/3rdparty/CGAL-4.8/examples/Core/delaunay.cpp b/3rdparty/CGAL/examples/Core/delaunay.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Core/delaunay.cpp
rename to 3rdparty/CGAL/examples/Core/delaunay.cpp
diff --git a/3rdparty/CGAL/examples/Envelope_2/CMakeLists.txt b/3rdparty/CGAL/examples/Envelope_2/CMakeLists.txt
new file mode 100644
index 0000000..b549555
--- /dev/null
+++ b/3rdparty/CGAL/examples/Envelope_2/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Envelope_2_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Envelope_2/ch_points.dat b/3rdparty/CGAL/examples/Envelope_2/ch_points.dat
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Envelope_2/ch_points.dat
rename to 3rdparty/CGAL/examples/Envelope_2/ch_points.dat
diff --git a/3rdparty/CGAL-4.8/examples/Envelope_2/convex_hull.cpp b/3rdparty/CGAL/examples/Envelope_2/convex_hull.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Envelope_2/convex_hull.cpp
rename to 3rdparty/CGAL/examples/Envelope_2/convex_hull.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Envelope_2/envelope_circles.cpp b/3rdparty/CGAL/examples/Envelope_2/envelope_circles.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Envelope_2/envelope_circles.cpp
rename to 3rdparty/CGAL/examples/Envelope_2/envelope_circles.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Envelope_2/envelope_segments.cpp b/3rdparty/CGAL/examples/Envelope_2/envelope_segments.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Envelope_2/envelope_segments.cpp
rename to 3rdparty/CGAL/examples/Envelope_2/envelope_segments.cpp
diff --git a/3rdparty/CGAL/examples/Envelope_3/CMakeLists.txt b/3rdparty/CGAL/examples/Envelope_3/CMakeLists.txt
new file mode 100644
index 0000000..6bb19d0
--- /dev/null
+++ b/3rdparty/CGAL/examples/Envelope_3/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Envelope_3_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET COMPONENTS Core )
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Envelope_3/envelope_planes.cpp b/3rdparty/CGAL/examples/Envelope_3/envelope_planes.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Envelope_3/envelope_planes.cpp
rename to 3rdparty/CGAL/examples/Envelope_3/envelope_planes.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Envelope_3/envelope_spheres.cpp b/3rdparty/CGAL/examples/Envelope_3/envelope_spheres.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Envelope_3/envelope_spheres.cpp
rename to 3rdparty/CGAL/examples/Envelope_3/envelope_spheres.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Envelope_3/envelope_triangles.cpp b/3rdparty/CGAL/examples/Envelope_3/envelope_triangles.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Envelope_3/envelope_triangles.cpp
rename to 3rdparty/CGAL/examples/Envelope_3/envelope_triangles.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Envelope_3/spheres.dat b/3rdparty/CGAL/examples/Envelope_3/spheres.dat
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Envelope_3/spheres.dat
rename to 3rdparty/CGAL/examples/Envelope_3/spheres.dat
diff --git a/3rdparty/CGAL/examples/Filtered_kernel/CMakeLists.txt b/3rdparty/CGAL/examples/Filtered_kernel/CMakeLists.txt
new file mode 100644
index 0000000..2e9e118
--- /dev/null
+++ b/3rdparty/CGAL/examples/Filtered_kernel/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Filtered_kernel_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Filtered_kernel/Cartesian_I.h b/3rdparty/CGAL/examples/Filtered_kernel/Cartesian_I.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Filtered_kernel/Cartesian_I.h
rename to 3rdparty/CGAL/examples/Filtered_kernel/Cartesian_I.h
diff --git a/3rdparty/CGAL-4.8/examples/Filtered_kernel/Filtered_predicate.cpp b/3rdparty/CGAL/examples/Filtered_kernel/Filtered_predicate.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Filtered_kernel/Filtered_predicate.cpp
rename to 3rdparty/CGAL/examples/Filtered_kernel/Filtered_predicate.cpp
diff --git a/3rdparty/CGAL/examples/Generator/CMakeLists.txt b/3rdparty/CGAL/examples/Generator/CMakeLists.txt
new file mode 100644
index 0000000..cddf876
--- /dev/null
+++ b/3rdparty/CGAL/examples/Generator/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Generator_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Generator/README b/3rdparty/CGAL/examples/Generator/README
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Generator/README
rename to 3rdparty/CGAL/examples/Generator/README
diff --git a/3rdparty/CGAL-4.8/examples/Generator/ball_d.cpp b/3rdparty/CGAL/examples/Generator/ball_d.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Generator/ball_d.cpp
rename to 3rdparty/CGAL/examples/Generator/ball_d.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Generator/combination_enumerator.cpp b/3rdparty/CGAL/examples/Generator/combination_enumerator.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Generator/combination_enumerator.cpp
rename to 3rdparty/CGAL/examples/Generator/combination_enumerator.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Generator/cube_d.cpp b/3rdparty/CGAL/examples/Generator/cube_d.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Generator/cube_d.cpp
rename to 3rdparty/CGAL/examples/Generator/cube_d.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Generator/grid_d.cpp b/3rdparty/CGAL/examples/Generator/grid_d.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Generator/grid_d.cpp
rename to 3rdparty/CGAL/examples/Generator/grid_d.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Generator/name_pairs.cpp b/3rdparty/CGAL/examples/Generator/name_pairs.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Generator/name_pairs.cpp
rename to 3rdparty/CGAL/examples/Generator/name_pairs.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Generator/random_convex_hull_2.cpp b/3rdparty/CGAL/examples/Generator/random_convex_hull_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Generator/random_convex_hull_2.cpp
rename to 3rdparty/CGAL/examples/Generator/random_convex_hull_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Generator/random_convex_set.cpp b/3rdparty/CGAL/examples/Generator/random_convex_set.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Generator/random_convex_set.cpp
rename to 3rdparty/CGAL/examples/Generator/random_convex_set.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Generator/random_degenerate_point_set.cpp b/3rdparty/CGAL/examples/Generator/random_degenerate_point_set.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Generator/random_degenerate_point_set.cpp
rename to 3rdparty/CGAL/examples/Generator/random_degenerate_point_set.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Generator/random_grid.cpp b/3rdparty/CGAL/examples/Generator/random_grid.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Generator/random_grid.cpp
rename to 3rdparty/CGAL/examples/Generator/random_grid.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Generator/random_points_tetrahedron_and_triangle_3.cpp b/3rdparty/CGAL/examples/Generator/random_points_tetrahedron_and_triangle_3.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Generator/random_points_tetrahedron_and_triangle_3.cpp
rename to 3rdparty/CGAL/examples/Generator/random_points_tetrahedron_and_triangle_3.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Generator/random_points_triangle_2.cpp b/3rdparty/CGAL/examples/Generator/random_points_triangle_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Generator/random_points_triangle_2.cpp
rename to 3rdparty/CGAL/examples/Generator/random_points_triangle_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Generator/random_polygon.cpp b/3rdparty/CGAL/examples/Generator/random_polygon.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Generator/random_polygon.cpp
rename to 3rdparty/CGAL/examples/Generator/random_polygon.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Generator/random_polygon2.cpp b/3rdparty/CGAL/examples/Generator/random_polygon2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Generator/random_polygon2.cpp
rename to 3rdparty/CGAL/examples/Generator/random_polygon2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Generator/random_segments1.cpp b/3rdparty/CGAL/examples/Generator/random_segments1.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Generator/random_segments1.cpp
rename to 3rdparty/CGAL/examples/Generator/random_segments1.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Generator/random_segments2.cpp b/3rdparty/CGAL/examples/Generator/random_segments2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Generator/random_segments2.cpp
rename to 3rdparty/CGAL/examples/Generator/random_segments2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Generator/sphere_d.cpp b/3rdparty/CGAL/examples/Generator/sphere_d.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Generator/sphere_d.cpp
rename to 3rdparty/CGAL/examples/Generator/sphere_d.cpp
diff --git a/3rdparty/CGAL/examples/HalfedgeDS/CMakeLists.txt b/3rdparty/CGAL/examples/HalfedgeDS/CMakeLists.txt
new file mode 100644
index 0000000..7c1f1c1
--- /dev/null
+++ b/3rdparty/CGAL/examples/HalfedgeDS/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( HalfedgeDS_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/HalfedgeDS/hds_prog_color.cpp b/3rdparty/CGAL/examples/HalfedgeDS/hds_prog_color.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/HalfedgeDS/hds_prog_color.cpp
rename to 3rdparty/CGAL/examples/HalfedgeDS/hds_prog_color.cpp
diff --git a/3rdparty/CGAL-4.8/examples/HalfedgeDS/hds_prog_compact.cpp b/3rdparty/CGAL/examples/HalfedgeDS/hds_prog_compact.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/HalfedgeDS/hds_prog_compact.cpp
rename to 3rdparty/CGAL/examples/HalfedgeDS/hds_prog_compact.cpp
diff --git a/3rdparty/CGAL-4.8/examples/HalfedgeDS/hds_prog_compact2.cpp b/3rdparty/CGAL/examples/HalfedgeDS/hds_prog_compact2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/HalfedgeDS/hds_prog_compact2.cpp
rename to 3rdparty/CGAL/examples/HalfedgeDS/hds_prog_compact2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/HalfedgeDS/hds_prog_default.cpp b/3rdparty/CGAL/examples/HalfedgeDS/hds_prog_default.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/HalfedgeDS/hds_prog_default.cpp
rename to 3rdparty/CGAL/examples/HalfedgeDS/hds_prog_default.cpp
diff --git a/3rdparty/CGAL-4.8/examples/HalfedgeDS/hds_prog_edge_iterator.cpp b/3rdparty/CGAL/examples/HalfedgeDS/hds_prog_edge_iterator.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/HalfedgeDS/hds_prog_edge_iterator.cpp
rename to 3rdparty/CGAL/examples/HalfedgeDS/hds_prog_edge_iterator.cpp
diff --git a/3rdparty/CGAL-4.8/examples/HalfedgeDS/hds_prog_graph.cpp b/3rdparty/CGAL/examples/HalfedgeDS/hds_prog_graph.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/HalfedgeDS/hds_prog_graph.cpp
rename to 3rdparty/CGAL/examples/HalfedgeDS/hds_prog_graph.cpp
diff --git a/3rdparty/CGAL-4.8/examples/HalfedgeDS/hds_prog_graph2.cpp b/3rdparty/CGAL/examples/HalfedgeDS/hds_prog_graph2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/HalfedgeDS/hds_prog_graph2.cpp
rename to 3rdparty/CGAL/examples/HalfedgeDS/hds_prog_graph2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/HalfedgeDS/hds_prog_halfedge_iterator.cpp b/3rdparty/CGAL/examples/HalfedgeDS/hds_prog_halfedge_iterator.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/HalfedgeDS/hds_prog_halfedge_iterator.cpp
rename to 3rdparty/CGAL/examples/HalfedgeDS/hds_prog_halfedge_iterator.cpp
diff --git a/3rdparty/CGAL-4.8/examples/HalfedgeDS/hds_prog_vector.cpp b/3rdparty/CGAL/examples/HalfedgeDS/hds_prog_vector.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/HalfedgeDS/hds_prog_vector.cpp
rename to 3rdparty/CGAL/examples/HalfedgeDS/hds_prog_vector.cpp
diff --git a/3rdparty/CGAL/examples/Inscribed_areas/CMakeLists.txt b/3rdparty/CGAL/examples/Inscribed_areas/CMakeLists.txt
new file mode 100644
index 0000000..f48586d
--- /dev/null
+++ b/3rdparty/CGAL/examples/Inscribed_areas/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Inscribed_areas_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Inscribed_areas/extremal_polygon_2_area.cpp b/3rdparty/CGAL/examples/Inscribed_areas/extremal_polygon_2_area.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Inscribed_areas/extremal_polygon_2_area.cpp
rename to 3rdparty/CGAL/examples/Inscribed_areas/extremal_polygon_2_area.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Inscribed_areas/extremal_polygon_2_perimeter.cpp b/3rdparty/CGAL/examples/Inscribed_areas/extremal_polygon_2_perimeter.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Inscribed_areas/extremal_polygon_2_perimeter.cpp
rename to 3rdparty/CGAL/examples/Inscribed_areas/extremal_polygon_2_perimeter.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Inscribed_areas/largest_empty_rectangle.cpp b/3rdparty/CGAL/examples/Inscribed_areas/largest_empty_rectangle.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Inscribed_areas/largest_empty_rectangle.cpp
rename to 3rdparty/CGAL/examples/Inscribed_areas/largest_empty_rectangle.cpp
diff --git a/3rdparty/CGAL/examples/Interpolation/CMakeLists.txt b/3rdparty/CGAL/examples/Interpolation/CMakeLists.txt
new file mode 100644
index 0000000..f4d9a40
--- /dev/null
+++ b/3rdparty/CGAL/examples/Interpolation/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Interpolation_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Interpolation/README b/3rdparty/CGAL/examples/Interpolation/README
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Interpolation/README
rename to 3rdparty/CGAL/examples/Interpolation/README
diff --git a/3rdparty/CGAL-4.8/examples/Interpolation/data/points3 b/3rdparty/CGAL/examples/Interpolation/data/points3
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Interpolation/data/points3
rename to 3rdparty/CGAL/examples/Interpolation/data/points3
diff --git a/3rdparty/CGAL-4.8/examples/Interpolation/interpolation_2.cpp b/3rdparty/CGAL/examples/Interpolation/interpolation_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Interpolation/interpolation_2.cpp
rename to 3rdparty/CGAL/examples/Interpolation/interpolation_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Interpolation/linear_interpolation_2.cpp b/3rdparty/CGAL/examples/Interpolation/linear_interpolation_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Interpolation/linear_interpolation_2.cpp
rename to 3rdparty/CGAL/examples/Interpolation/linear_interpolation_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Interpolation/nn_coordinates_2.cpp b/3rdparty/CGAL/examples/Interpolation/nn_coordinates_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Interpolation/nn_coordinates_2.cpp
rename to 3rdparty/CGAL/examples/Interpolation/nn_coordinates_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Interpolation/nn_coordinates_3.cpp b/3rdparty/CGAL/examples/Interpolation/nn_coordinates_3.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Interpolation/nn_coordinates_3.cpp
rename to 3rdparty/CGAL/examples/Interpolation/nn_coordinates_3.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Interpolation/rn_coordinates_2.cpp b/3rdparty/CGAL/examples/Interpolation/rn_coordinates_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Interpolation/rn_coordinates_2.cpp
rename to 3rdparty/CGAL/examples/Interpolation/rn_coordinates_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Interpolation/sibson_interpolation_2.cpp b/3rdparty/CGAL/examples/Interpolation/sibson_interpolation_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Interpolation/sibson_interpolation_2.cpp
rename to 3rdparty/CGAL/examples/Interpolation/sibson_interpolation_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Interpolation/surface_neighbor_coordinates_3.cpp b/3rdparty/CGAL/examples/Interpolation/surface_neighbor_coordinates_3.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Interpolation/surface_neighbor_coordinates_3.cpp
rename to 3rdparty/CGAL/examples/Interpolation/surface_neighbor_coordinates_3.cpp
diff --git a/3rdparty/CGAL/examples/Interval_skip_list/CMakeLists.txt b/3rdparty/CGAL/examples/Interval_skip_list/CMakeLists.txt
new file mode 100644
index 0000000..0623103
--- /dev/null
+++ b/3rdparty/CGAL/examples/Interval_skip_list/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Interval_skip_list_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Interval_skip_list/intervals.cpp b/3rdparty/CGAL/examples/Interval_skip_list/intervals.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Interval_skip_list/intervals.cpp
rename to 3rdparty/CGAL/examples/Interval_skip_list/intervals.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Interval_skip_list/isl_terrain.cpp b/3rdparty/CGAL/examples/Interval_skip_list/isl_terrain.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Interval_skip_list/isl_terrain.cpp
rename to 3rdparty/CGAL/examples/Interval_skip_list/isl_terrain.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Interval_skip_list/terrain.pts b/3rdparty/CGAL/examples/Interval_skip_list/terrain.pts
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Interval_skip_list/terrain.pts
rename to 3rdparty/CGAL/examples/Interval_skip_list/terrain.pts
diff --git a/3rdparty/CGAL/examples/Jet_fitting_3/CMakeLists.txt b/3rdparty/CGAL/examples/Jet_fitting_3/CMakeLists.txt
new file mode 100644
index 0000000..044c8aa
--- /dev/null
+++ b/3rdparty/CGAL/examples/Jet_fitting_3/CMakeLists.txt
@@ -0,0 +1,56 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Jet_fitting_3_example )
+
+cmake_minimum_required(VERSION 2.8.11)
+
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  # use either Eigen or BLAS/LAPACK
+  find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater)
+  if (NOT EIGEN3_FOUND)
+    find_package(LAPACK)
+    if(LAPACK_FOUND)
+      include( ${LAPACK_USE_FILE} )
+    endif(LAPACK_FOUND)
+  else()
+    include( ${EIGEN3_USE_FILE} )
+  endif()
+    
+  if(EIGEN3_FOUND OR LAPACK_FOUND)
+    # Link with Boost.ProgramOptions (optional)
+    find_package(Boost QUIET COMPONENTS program_options)
+    if(Boost_PROGRAM_OPTIONS_FOUND)
+      if( CGAL_AUTO_LINK_ENABLED )
+        message( STATUS "Boost.ProgramOptions library: found" )
+      else()
+        message( STATUS "Boost.ProgramOptions library: ${Boost_PROGRAM_OPTIONS_LIBRARY}" )
+      endif()
+      add_definitions( "-DCGAL_USE_BOOST_PROGRAM_OPTIONS" )
+      list(APPEND CGAL_3RD_PARTY_LIBRARIES ${Boost_LIBRARIES})
+   endif()
+
+    create_single_source_cgal_program( "Mesh_estimation.cpp" )
+    create_single_source_cgal_program( "Single_estimation.cpp" )
+
+  else(EIGEN3_FOUND OR LAPACK_FOUND)
+
+    message(STATUS "NOTICE: This program requires either Eigen 3.1 (or greater) or LAPACK, and will not be compiled.")
+
+  endif(EIGEN3_FOUND OR LAPACK_FOUND)
+
+else()
+
+    message(STATUS "NOTICE: This program requires the CGAL library, and will not be compiled.")
+
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Jet_fitting_3/Mesh_estimation.cpp b/3rdparty/CGAL/examples/Jet_fitting_3/Mesh_estimation.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Jet_fitting_3/Mesh_estimation.cpp
rename to 3rdparty/CGAL/examples/Jet_fitting_3/Mesh_estimation.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Jet_fitting_3/PolyhedralSurf.h b/3rdparty/CGAL/examples/Jet_fitting_3/PolyhedralSurf.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Jet_fitting_3/PolyhedralSurf.h
rename to 3rdparty/CGAL/examples/Jet_fitting_3/PolyhedralSurf.h
diff --git a/3rdparty/CGAL-4.8/examples/Jet_fitting_3/PolyhedralSurf_operations.h b/3rdparty/CGAL/examples/Jet_fitting_3/PolyhedralSurf_operations.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Jet_fitting_3/PolyhedralSurf_operations.h
rename to 3rdparty/CGAL/examples/Jet_fitting_3/PolyhedralSurf_operations.h
diff --git a/3rdparty/CGAL-4.8/examples/Jet_fitting_3/PolyhedralSurf_rings.h b/3rdparty/CGAL/examples/Jet_fitting_3/PolyhedralSurf_rings.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Jet_fitting_3/PolyhedralSurf_rings.h
rename to 3rdparty/CGAL/examples/Jet_fitting_3/PolyhedralSurf_rings.h
diff --git a/3rdparty/CGAL-4.8/examples/Jet_fitting_3/README b/3rdparty/CGAL/examples/Jet_fitting_3/README
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Jet_fitting_3/README
rename to 3rdparty/CGAL/examples/Jet_fitting_3/README
diff --git a/3rdparty/CGAL-4.8/examples/Jet_fitting_3/Single_estimation.cpp b/3rdparty/CGAL/examples/Jet_fitting_3/Single_estimation.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Jet_fitting_3/Single_estimation.cpp
rename to 3rdparty/CGAL/examples/Jet_fitting_3/Single_estimation.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Jet_fitting_3/data/ellipe0.003.off b/3rdparty/CGAL/examples/Jet_fitting_3/data/ellipe0.003.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Jet_fitting_3/data/ellipe0.003.off
rename to 3rdparty/CGAL/examples/Jet_fitting_3/data/ellipe0.003.off
diff --git a/3rdparty/CGAL-4.8/examples/Jet_fitting_3/data/in_points_d4.txt b/3rdparty/CGAL/examples/Jet_fitting_3/data/in_points_d4.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Jet_fitting_3/data/in_points_d4.txt
rename to 3rdparty/CGAL/examples/Jet_fitting_3/data/in_points_d4.txt
diff --git a/3rdparty/CGAL-4.8/examples/Jet_fitting_3/data/in_points_file.txt b/3rdparty/CGAL/examples/Jet_fitting_3/data/in_points_file.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Jet_fitting_3/data/in_points_file.txt
rename to 3rdparty/CGAL/examples/Jet_fitting_3/data/in_points_file.txt
diff --git a/3rdparty/CGAL-4.8/examples/Jet_fitting_3/data/poly2x^2+y^2-0.062500-off b/3rdparty/CGAL/examples/Jet_fitting_3/data/poly2x^2+y^2-0.062500-off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Jet_fitting_3/data/poly2x^2+y^2-0.062500-off
rename to 3rdparty/CGAL/examples/Jet_fitting_3/data/poly2x^2+y^2-0.062500-off
diff --git a/3rdparty/CGAL/examples/Kernel_23/CMakeLists.txt b/3rdparty/CGAL/examples/Kernel_23/CMakeLists.txt
new file mode 100644
index 0000000..e67c245
--- /dev/null
+++ b/3rdparty/CGAL/examples/Kernel_23/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Kernel_23_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Kernel_23/MyConstruct_bbox_2.h b/3rdparty/CGAL/examples/Kernel_23/MyConstruct_bbox_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Kernel_23/MyConstruct_bbox_2.h
rename to 3rdparty/CGAL/examples/Kernel_23/MyConstruct_bbox_2.h
diff --git a/3rdparty/CGAL-4.8/examples/Kernel_23/MyConstruct_coord_iterator.h b/3rdparty/CGAL/examples/Kernel_23/MyConstruct_coord_iterator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Kernel_23/MyConstruct_coord_iterator.h
rename to 3rdparty/CGAL/examples/Kernel_23/MyConstruct_coord_iterator.h
diff --git a/3rdparty/CGAL-4.8/examples/Kernel_23/MyConstruct_point_2.h b/3rdparty/CGAL/examples/Kernel_23/MyConstruct_point_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Kernel_23/MyConstruct_point_2.h
rename to 3rdparty/CGAL/examples/Kernel_23/MyConstruct_point_2.h
diff --git a/3rdparty/CGAL-4.8/examples/Kernel_23/MyKernel.cpp b/3rdparty/CGAL/examples/Kernel_23/MyKernel.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Kernel_23/MyKernel.cpp
rename to 3rdparty/CGAL/examples/Kernel_23/MyKernel.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Kernel_23/MyKernel.h b/3rdparty/CGAL/examples/Kernel_23/MyKernel.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Kernel_23/MyKernel.h
rename to 3rdparty/CGAL/examples/Kernel_23/MyKernel.h
diff --git a/3rdparty/CGAL-4.8/examples/Kernel_23/MyPointC2.h b/3rdparty/CGAL/examples/Kernel_23/MyPointC2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Kernel_23/MyPointC2.h
rename to 3rdparty/CGAL/examples/Kernel_23/MyPointC2.h
diff --git a/3rdparty/CGAL/examples/Kernel_23/MyPointC2_iostream.h b/3rdparty/CGAL/examples/Kernel_23/MyPointC2_iostream.h
new file mode 100644
index 0000000..b9ca97e
--- /dev/null
+++ b/3rdparty/CGAL/examples/Kernel_23/MyPointC2_iostream.h
@@ -0,0 +1,46 @@
+#ifndef MYPOINTC2_IOSTREAM_H
+#define MYPOINTC2_IOSTREAM_H
+
+std::ostream &
+operator<<(std::ostream &os, const MyPointC2 &p)
+{
+    switch(CGAL::get_mode(os)) {
+    case CGAL::IO::ASCII :
+        return os << p.x() << ' ' << p.y() << ' ' << p.color();
+    case CGAL::IO::BINARY :
+        CGAL::write(os, p.x());
+        CGAL::write(os, p.y());
+        CGAL::write(os, p.color());
+        return os;
+    default:
+        return os << "MyPointC2(" << p.x() << ", " << p.y() << ", " << p.color() << ')';
+    }
+}
+
+
+
+std::istream &
+operator>>(std::istream &is, MyPointC2 &p)
+{
+    double x, y;
+    int c;
+    switch(CGAL::get_mode(is)) {
+    case CGAL::IO::ASCII :
+      is >> x >> y >> c;
+        break;
+    case CGAL::IO::BINARY :
+        CGAL::read(is, x);
+        CGAL::read(is, y);
+	CGAL::read(is, c);
+        break;
+    default:
+        std::cerr << "" << std::endl;
+        std::cerr << "Stream must be in ascii or binary mode" << std::endl;
+        break;
+    }
+    if (is) {
+      p = MyPointC2(x, y, c);
+    }
+    return is;
+}
+#endif //MYPOINTC2_IOSTREAM_H
diff --git a/3rdparty/CGAL/examples/Kernel_23/MySegmentC2.h b/3rdparty/CGAL/examples/Kernel_23/MySegmentC2.h
new file mode 100644
index 0000000..34af4fe
--- /dev/null
+++ b/3rdparty/CGAL/examples/Kernel_23/MySegmentC2.h
@@ -0,0 +1,254 @@
+#ifndef MY_SEGMENT_2_H
+#define MY_SEGMENT_2_H
+
+#include <boost/config.hpp>
+
+template < class R_ >
+class MySegmentC2
+{
+  typedef typename R_::FT                   FT;
+  typedef typename R_::Point_2              Point_2;
+  typedef typename R_::Vector_2             Vector_2;
+  typedef typename R_::Direction_2          Direction_2;
+  typedef typename R_::Line_2               Line_2;
+  typedef typename R_::Segment_2            Segment_2;
+  typedef typename R_::Aff_transformation_2 Aff_transformation_2;
+
+  Point_2 sp_, tp_;
+public:
+  typedef R_                                     R;
+
+  MySegmentC2() {}
+
+  MySegmentC2(const Point_2 &sp, const Point_2 &tp)
+    : sp_(sp), tp_(tp) {}
+
+  bool        is_horizontal() const;
+  bool        is_vertical() const;
+  bool        has_on(const Point_2 &p) const;
+  bool        collinear_has_on(const Point_2 &p) const;
+
+  bool        operator==(const MySegmentC2 &s) const;
+  bool        operator!=(const MySegmentC2 &s) const;
+
+  const Point_2 &   source() const
+  {
+      return sp_;
+  }
+
+  const Point_2 &   target() const
+  {
+      return tp_;
+  }
+  const Point_2 &    start() const;
+  const Point_2 &    end() const;
+
+  const Point_2 &   min BOOST_PREVENT_MACRO_SUBSTITUTION () const;
+  const Point_2 &   max BOOST_PREVENT_MACRO_SUBSTITUTION () const;
+  const Point_2 &   vertex(int i) const;
+  const Point_2 &   point(int i) const;
+  const Point_2 &   operator[](int i) const;
+
+  FT          squared_length() const;
+
+  Direction_2 direction() const;
+  Vector_2    to_vector() const;
+  Line_2      supporting_line() const;
+  Segment_2   opposite() const;
+
+  Segment_2   transform(const Aff_transformation_2 &t) const
+  {
+    return Segment_2(t.transform(source()), t.transform(target()));
+  }
+
+  bool        is_degenerate() const;
+  CGAL::Bbox_2      bbox() const;
+};
+
+template < class R >
+inline
+bool
+MySegmentC2<R>::operator==(const MySegmentC2<R> &s) const
+{
+  return source() == s.source() && target() == s.target();
+}
+
+template < class R >
+inline
+bool
+MySegmentC2<R>::operator!=(const MySegmentC2<R> &s) const
+{
+  return !(*this == s);
+}
+
+
+
+template < class R >
+CGAL_KERNEL_INLINE
+const typename MySegmentC2<R>::Point_2 &
+MySegmentC2<R>::min BOOST_PREVENT_MACRO_SUBSTITUTION () const
+{
+  typename R::Less_xy_2 less_xy;
+  return less_xy(source(),target()) ? source() : target();
+}
+
+template < class R >
+CGAL_KERNEL_INLINE
+const typename MySegmentC2<R>::Point_2 &
+MySegmentC2<R>::max BOOST_PREVENT_MACRO_SUBSTITUTION() const
+{
+  typename R::Less_xy_2 less_xy;
+  return less_xy(source(),target()) ? target() : source();
+}
+
+template < class R >
+CGAL_KERNEL_INLINE
+const typename MySegmentC2<R>::Point_2 &
+MySegmentC2<R>::vertex(int i) const
+{
+  return (i%2 == 0) ? source() : target();
+}
+
+template < class R >
+CGAL_KERNEL_INLINE
+const typename MySegmentC2<R>::Point_2 &
+MySegmentC2<R>::point(int i) const
+{
+  return (i%2 == 0) ? source() : target();
+}
+
+template < class R >
+inline
+const typename MySegmentC2<R>::Point_2 &
+MySegmentC2<R>::operator[](int i) const
+{
+  return vertex(i);
+}
+
+template < class R >
+CGAL_KERNEL_INLINE
+typename MySegmentC2<R>::FT
+MySegmentC2<R>::squared_length() const
+{
+  typename R::Compute_squared_distance_2 squared_distance;
+  return squared_distance(source(), target());
+}
+
+template < class R >
+CGAL_KERNEL_INLINE
+typename MySegmentC2<R>::Direction_2
+MySegmentC2<R>::direction() const
+{
+  typename R::Construct_vector_2 construct_vector;
+  return Direction_2( construct_vector( source(), target()));
+}
+
+template < class R >
+CGAL_KERNEL_INLINE
+typename MySegmentC2<R>::Vector_2
+MySegmentC2<R>::to_vector() const
+{
+  typename R::Construct_vector_2 construct_vector;
+  return construct_vector( source(), target());
+}
+
+template < class R >
+inline
+typename MySegmentC2<R>::Line_2
+MySegmentC2<R>::supporting_line() const
+{
+  typename R::Construct_line_2 construct_line;
+
+  return construct_line(*this);
+}
+
+template < class R >
+inline
+typename MySegmentC2<R>::Segment_2
+MySegmentC2<R>::opposite() const
+{
+  return MySegmentC2<R>(target(), source());
+}
+
+template < class R >
+CGAL_KERNEL_INLINE
+CGAL::Bbox_2
+MySegmentC2<R>::bbox() const
+{
+  return source().bbox() + target().bbox();
+}
+
+template < class R >
+inline
+bool
+MySegmentC2<R>::is_degenerate() const
+{
+  return R().equal_y_2_object()(source(), target());
+}
+
+template < class R >
+CGAL_KERNEL_INLINE
+bool
+MySegmentC2<R>::is_horizontal() const
+{
+  return R().equal_y_2_object()(source(), target());
+}
+
+template < class R >
+CGAL_KERNEL_INLINE
+bool
+MySegmentC2<R>::is_vertical() const
+{
+  return R().equal_x_2_object()(source(), target());
+}
+
+template < class R >
+CGAL_KERNEL_INLINE
+bool
+MySegmentC2<R>::
+has_on(const typename MySegmentC2<R>::Point_2 &p) const
+{
+  return R().collinear_are_ordered_along_line_2_object()(source(), p, target());
+}
+
+template < class R >
+inline
+bool
+MySegmentC2<R>::
+collinear_has_on(const typename MySegmentC2<R>::Point_2 &p) const
+{
+  return R().collinear_has_on_2_object()(*this, p);
+}
+
+template < class R >
+std::ostream &
+operator<<(std::ostream &os, const MySegmentC2<R> &s)
+{
+    switch(CGAL::get_mode(os)) {
+    case CGAL::IO::ASCII :
+        return os << s.source() << ' ' << s.target();
+    case CGAL::IO::BINARY :
+        return os << s.source() << s.target();
+    default:
+        return os << "MySegmentC2(" << s.source() <<  ", " << s.target() << ")";
+    }
+}
+
+
+
+template < class R >
+std::istream &
+operator>>(std::istream &is, MySegmentC2<R> &s)
+{
+    typename R::Point_2 p, q;
+
+    is >> p >> q;
+
+    if (is)
+	s = MySegmentC2<R>(p, q);
+    return is;
+}
+
+
+
+#endif // CARTESIAN_SEGMENT_2_H
diff --git a/3rdparty/CGAL-4.8/examples/Kernel_23/cartesian_converter.cpp b/3rdparty/CGAL/examples/Kernel_23/cartesian_converter.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Kernel_23/cartesian_converter.cpp
rename to 3rdparty/CGAL/examples/Kernel_23/cartesian_converter.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Kernel_23/exact.cpp b/3rdparty/CGAL/examples/Kernel_23/exact.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Kernel_23/exact.cpp
rename to 3rdparty/CGAL/examples/Kernel_23/exact.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Kernel_23/intersection_get.cpp b/3rdparty/CGAL/examples/Kernel_23/intersection_get.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Kernel_23/intersection_get.cpp
rename to 3rdparty/CGAL/examples/Kernel_23/intersection_get.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Kernel_23/intersection_visitor.cpp b/3rdparty/CGAL/examples/Kernel_23/intersection_visitor.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Kernel_23/intersection_visitor.cpp
rename to 3rdparty/CGAL/examples/Kernel_23/intersection_visitor.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Kernel_23/intersections.cpp b/3rdparty/CGAL/examples/Kernel_23/intersections.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Kernel_23/intersections.cpp
rename to 3rdparty/CGAL/examples/Kernel_23/intersections.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Kernel_23/points_and_segment.cpp b/3rdparty/CGAL/examples/Kernel_23/points_and_segment.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Kernel_23/points_and_segment.cpp
rename to 3rdparty/CGAL/examples/Kernel_23/points_and_segment.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Kernel_23/surprising.cpp b/3rdparty/CGAL/examples/Kernel_23/surprising.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Kernel_23/surprising.cpp
rename to 3rdparty/CGAL/examples/Kernel_23/surprising.cpp
diff --git a/3rdparty/CGAL/examples/Kinetic_data_structures/CMakeLists.txt b/3rdparty/CGAL/examples/Kinetic_data_structures/CMakeLists.txt
new file mode 100644
index 0000000..16dfb03
--- /dev/null
+++ b/3rdparty/CGAL/examples/Kinetic_data_structures/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Kinetic_data_structures_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Kinetic_data_structures/Kinetic_Delaunay_triangulation_2.cpp b/3rdparty/CGAL/examples/Kinetic_data_structures/Kinetic_Delaunay_triangulation_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Kinetic_data_structures/Kinetic_Delaunay_triangulation_2.cpp
rename to 3rdparty/CGAL/examples/Kinetic_data_structures/Kinetic_Delaunay_triangulation_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Kinetic_data_structures/Kinetic_Delaunay_triangulation_3.cpp b/3rdparty/CGAL/examples/Kinetic_data_structures/Kinetic_Delaunay_triangulation_3.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Kinetic_data_structures/Kinetic_Delaunay_triangulation_3.cpp
rename to 3rdparty/CGAL/examples/Kinetic_data_structures/Kinetic_Delaunay_triangulation_3.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Kinetic_data_structures/Kinetic_insert_event.cpp b/3rdparty/CGAL/examples/Kinetic_data_structures/Kinetic_insert_event.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Kinetic_data_structures/Kinetic_insert_event.cpp
rename to 3rdparty/CGAL/examples/Kinetic_data_structures/Kinetic_insert_event.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Kinetic_data_structures/Kinetic_regular_triangulation_3.cpp b/3rdparty/CGAL/examples/Kinetic_data_structures/Kinetic_regular_triangulation_3.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Kinetic_data_structures/Kinetic_regular_triangulation_3.cpp
rename to 3rdparty/CGAL/examples/Kinetic_data_structures/Kinetic_regular_triangulation_3.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Kinetic_data_structures/Kinetic_sort.cpp b/3rdparty/CGAL/examples/Kinetic_data_structures/Kinetic_sort.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Kinetic_data_structures/Kinetic_sort.cpp
rename to 3rdparty/CGAL/examples/Kinetic_data_structures/Kinetic_sort.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Kinetic_data_structures/Kinetic_sweepline.cpp b/3rdparty/CGAL/examples/Kinetic_data_structures/Kinetic_sweepline.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Kinetic_data_structures/Kinetic_sweepline.cpp
rename to 3rdparty/CGAL/examples/Kinetic_data_structures/Kinetic_sweepline.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Kinetic_data_structures/data/points_1 b/3rdparty/CGAL/examples/Kinetic_data_structures/data/points_1
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Kinetic_data_structures/data/points_1
rename to 3rdparty/CGAL/examples/Kinetic_data_structures/data/points_1
diff --git a/3rdparty/CGAL-4.8/examples/Kinetic_data_structures/data/points_2 b/3rdparty/CGAL/examples/Kinetic_data_structures/data/points_2
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Kinetic_data_structures/data/points_2
rename to 3rdparty/CGAL/examples/Kinetic_data_structures/data/points_2
diff --git a/3rdparty/CGAL-4.8/examples/Kinetic_data_structures/data/points_3 b/3rdparty/CGAL/examples/Kinetic_data_structures/data/points_3
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Kinetic_data_structures/data/points_3
rename to 3rdparty/CGAL/examples/Kinetic_data_structures/data/points_3
diff --git a/3rdparty/CGAL-4.8/examples/Kinetic_data_structures/data/sweepline.input b/3rdparty/CGAL/examples/Kinetic_data_structures/data/sweepline.input
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Kinetic_data_structures/data/sweepline.input
rename to 3rdparty/CGAL/examples/Kinetic_data_structures/data/sweepline.input
diff --git a/3rdparty/CGAL-4.8/examples/Kinetic_data_structures/data/weighted_points_3 b/3rdparty/CGAL/examples/Kinetic_data_structures/data/weighted_points_3
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Kinetic_data_structures/data/weighted_points_3
rename to 3rdparty/CGAL/examples/Kinetic_data_structures/data/weighted_points_3
diff --git a/3rdparty/CGAL-4.8/examples/Kinetic_data_structures/defining_a_simulation_traits.cpp b/3rdparty/CGAL/examples/Kinetic_data_structures/defining_a_simulation_traits.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Kinetic_data_structures/defining_a_simulation_traits.cpp
rename to 3rdparty/CGAL/examples/Kinetic_data_structures/defining_a_simulation_traits.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Kinetic_data_structures/trivial_kds.cpp b/3rdparty/CGAL/examples/Kinetic_data_structures/trivial_kds.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Kinetic_data_structures/trivial_kds.cpp
rename to 3rdparty/CGAL/examples/Kinetic_data_structures/trivial_kds.cpp
diff --git a/3rdparty/CGAL/examples/Kinetic_framework/CMakeLists.txt b/3rdparty/CGAL/examples/Kinetic_framework/CMakeLists.txt
new file mode 100644
index 0000000..7d01b97
--- /dev/null
+++ b/3rdparty/CGAL/examples/Kinetic_framework/CMakeLists.txt
@@ -0,0 +1,28 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Kinetic_framework_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Kinetic_framework/adding_a_certificate.cpp b/3rdparty/CGAL/examples/Kinetic_framework/adding_a_certificate.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Kinetic_framework/adding_a_certificate.cpp
rename to 3rdparty/CGAL/examples/Kinetic_framework/adding_a_certificate.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Kinetic_framework/data/points_2 b/3rdparty/CGAL/examples/Kinetic_framework/data/points_2
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Kinetic_framework/data/points_2
rename to 3rdparty/CGAL/examples/Kinetic_framework/data/points_2
diff --git a/3rdparty/CGAL-4.8/examples/Kinetic_framework/data/points_with_color_2 b/3rdparty/CGAL/examples/Kinetic_framework/data/points_with_color_2
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Kinetic_framework/data/points_with_color_2
rename to 3rdparty/CGAL/examples/Kinetic_framework/data/points_with_color_2
diff --git a/3rdparty/CGAL-4.8/examples/Kinetic_framework/listener.cpp b/3rdparty/CGAL/examples/Kinetic_framework/listener.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Kinetic_framework/listener.cpp
rename to 3rdparty/CGAL/examples/Kinetic_framework/listener.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Kinetic_framework/pointer_queue.cpp b/3rdparty/CGAL/examples/Kinetic_framework/pointer_queue.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Kinetic_framework/pointer_queue.cpp
rename to 3rdparty/CGAL/examples/Kinetic_framework/pointer_queue.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Kinetic_framework/ref_counted.cpp b/3rdparty/CGAL/examples/Kinetic_framework/ref_counted.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Kinetic_framework/ref_counted.cpp
rename to 3rdparty/CGAL/examples/Kinetic_framework/ref_counted.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Linear_cell_complex/CMakeLCCViewerQt.inc b/3rdparty/CGAL/examples/Linear_cell_complex/CMakeLCCViewerQt.inc
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Linear_cell_complex/CMakeLCCViewerQt.inc
rename to 3rdparty/CGAL/examples/Linear_cell_complex/CMakeLCCViewerQt.inc
diff --git a/3rdparty/CGAL/examples/Linear_cell_complex/CMakeLists.txt b/3rdparty/CGAL/examples/Linear_cell_complex/CMakeLists.txt
new file mode 100644
index 0000000..28e8ee5
--- /dev/null
+++ b/3rdparty/CGAL/examples/Linear_cell_complex/CMakeLists.txt
@@ -0,0 +1,59 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+project( Linear_cell_complex_examples )
+
+cmake_minimum_required(VERSION 2.8.11)
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+# If you want to visualize a linear cell complex, you can use the following viewer
+# based on qt. Just uncomment the following two lines, plus the lines qt5_use_modules below
+
+# find_package(CGAL COMPONENTS Qt5)
+# include("CMakeLCCViewerQt.inc")
+
+# If you don't want to visualize, use the following line (otherwise comment it)
+find_package(CGAL QUIET)
+
+# For Gprof.
+# ADD_DEFINITIONS("-pg")
+# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
+
+# To use valgrind, we must disable rounding math ckeck.
+# add_definition(-DCGAL_DISABLE_ROUNDING_MATH_CHECK)
+
+if ( CGAL_FOUND )
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+  include_directories(BEFORE ../../include)
+
+  create_single_source_cgal_program( "linear_cell_complex_3.cpp" )
+  create_single_source_cgal_program( "linear_cell_complex_4.cpp" )
+  create_single_source_cgal_program(
+                  "linear_cell_complex_3_with_colored_vertices.cpp" )
+  create_single_source_cgal_program(
+                  "linear_cell_complex_3_with_mypoint.cpp" )
+
+  create_single_source_cgal_program("plane_graph_to_lcc_2.cpp")
+  create_single_source_cgal_program("linear_cell_complex_3_attributes_management.cpp")
+
+  add_executable(voronoi_2 voronoi_2.cpp)
+  target_link_libraries(voronoi_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES}
+                                  ${MAP_VIEWER_LIBRARIES})
+  # qt5_use_modules(voronoi_2 ${MAP_VIEWER_MODULES})
+
+  add_executable(voronoi_3 voronoi_3.cpp)
+  target_link_libraries(voronoi_3 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES}
+                                  ${MAP_VIEWER_LIBRARIES})
+  # qt5_use_modules(voronoi_3 ${MAP_VIEWER_MODULES})
+
+else()
+
+  message(STATUS "This program requires the CGAL library, "
+                  "and will not be compiled.")
+
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Linear_cell_complex/README.txt b/3rdparty/CGAL/examples/Linear_cell_complex/README.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Linear_cell_complex/README.txt
rename to 3rdparty/CGAL/examples/Linear_cell_complex/README.txt
diff --git a/3rdparty/CGAL-4.8/examples/Linear_cell_complex/data/armadillo.off b/3rdparty/CGAL/examples/Linear_cell_complex/data/armadillo.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Linear_cell_complex/data/armadillo.off
rename to 3rdparty/CGAL/examples/Linear_cell_complex/data/armadillo.off
diff --git a/3rdparty/CGAL-4.8/examples/Linear_cell_complex/data/graph.txt b/3rdparty/CGAL/examples/Linear_cell_complex/data/graph.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Linear_cell_complex/data/graph.txt
rename to 3rdparty/CGAL/examples/Linear_cell_complex/data/graph.txt
diff --git a/3rdparty/CGAL-4.8/examples/Linear_cell_complex/data/points_2 b/3rdparty/CGAL/examples/Linear_cell_complex/data/points_2
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Linear_cell_complex/data/points_2
rename to 3rdparty/CGAL/examples/Linear_cell_complex/data/points_2
diff --git a/3rdparty/CGAL-4.8/examples/Linear_cell_complex/data/points_3 b/3rdparty/CGAL/examples/Linear_cell_complex/data/points_3
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Linear_cell_complex/data/points_3
rename to 3rdparty/CGAL/examples/Linear_cell_complex/data/points_3
diff --git a/3rdparty/CGAL-4.8/examples/Linear_cell_complex/data/small_points_2 b/3rdparty/CGAL/examples/Linear_cell_complex/data/small_points_2
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Linear_cell_complex/data/small_points_2
rename to 3rdparty/CGAL/examples/Linear_cell_complex/data/small_points_2
diff --git a/3rdparty/CGAL-4.8/examples/Linear_cell_complex/data/small_points_3 b/3rdparty/CGAL/examples/Linear_cell_complex/data/small_points_3
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Linear_cell_complex/data/small_points_3
rename to 3rdparty/CGAL/examples/Linear_cell_complex/data/small_points_3
diff --git a/3rdparty/CGAL-4.8/examples/Linear_cell_complex/linear_cell_complex_3.cpp b/3rdparty/CGAL/examples/Linear_cell_complex/linear_cell_complex_3.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Linear_cell_complex/linear_cell_complex_3.cpp
rename to 3rdparty/CGAL/examples/Linear_cell_complex/linear_cell_complex_3.cpp
diff --git a/3rdparty/CGAL/examples/Linear_cell_complex/linear_cell_complex_3_attributes_management.cpp b/3rdparty/CGAL/examples/Linear_cell_complex/linear_cell_complex_3_attributes_management.cpp
new file mode 100644
index 0000000..4f7d1bb
--- /dev/null
+++ b/3rdparty/CGAL/examples/Linear_cell_complex/linear_cell_complex_3_attributes_management.cpp
@@ -0,0 +1,72 @@
+#include <CGAL/Linear_cell_complex.h>
+#include <CGAL/Linear_cell_complex_operations.h>
+#include <CGAL/Linear_cell_complex_constructors.h>
+#include <CGAL/Timer.h>
+#include <iostream>
+#include <fstream>
+
+typedef CGAL::Linear_cell_complex<2,3> LCC_3;
+typedef LCC_3::Dart_handle             Dart_handle;
+typedef LCC_3::Point                   Point;
+typedef LCC_3::FT                      FT;
+
+void load_and_simplify_off(LCC_3& lcc, const std::string& filename,
+                           bool updateattribs, int percent)
+{
+  std::ifstream ifile(filename.c_str());
+  if (ifile)
+  {
+    CGAL::load_off(lcc, ifile);
+    CGAL::Timer timer;
+    Dart_handle dh;
+    std::size_t nb=(lcc.number_of_darts()*percent)/200;
+    timer.start();
+
+    if (!updateattribs) lcc.set_automatic_attributes_management(false);
+    for (LCC_3::Dart_range::iterator it=lcc.darts().begin(),
+           itend=lcc.darts().end(); it!=itend && nb>0; )
+    {
+      dh=it++;
+      if ( it!=itend && it==lcc.beta<2>(dh) ) ++it;
+      lcc.remove_cell<1>(dh);
+      --nb;
+    }
+    if ( !updateattribs ) lcc.set_automatic_attributes_management(true);
+
+    timer.stop();
+    lcc.display_characteristics(std::cout);
+    std::cout<<", valid="<< lcc.is_valid()
+             <<" time: "<<timer.time()<<" seconds." << std::endl;
+  }
+}
+
+int main(int narg, char** argv)
+{
+  if (narg>1 && (!strcmp(argv[1],"-h") || !strcmp(argv[1],"-?")) )
+  {
+    std::cout<<"Usage: a.out file.off [percentage]"<<std::endl;
+    return EXIT_FAILURE;
+  }
+
+  std::string filename;
+  if ( narg==1 )
+  {
+    filename=std::string("data/armadillo.off");
+    std::cout<<"No filename given: use data/armadillo.off by default."<<std::endl;
+  }
+  else filename=std::string(argv[1]);
+
+  int percent = 30; // remove 30 percent of edges
+  if ( narg>2 ) { percent = atoi(argv[2]); }
+  std::cout<<percent<<"% edges to remove."<<std::endl;
+
+  LCC_3 lcc;
+  std::cout<<"Update attribute DURING operations: ";
+  load_and_simplify_off(lcc, filename, true, percent);
+
+  LCC_3 lcc2;
+  std::cout<<"Update attribute AFTER operations: ";
+  load_and_simplify_off(lcc2, filename, false, percent);
+
+  return EXIT_SUCCESS;
+}
diff --git a/3rdparty/CGAL/examples/Linear_cell_complex/linear_cell_complex_3_viewer_qt.h b/3rdparty/CGAL/examples/Linear_cell_complex/linear_cell_complex_3_viewer_qt.h
new file mode 100644
index 0000000..cfd406a
--- /dev/null
+++ b/3rdparty/CGAL/examples/Linear_cell_complex/linear_cell_complex_3_viewer_qt.h
@@ -0,0 +1,932 @@
+// Copyright (c) 2011 CNRS and LIRIS' Establishments (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Guillaume Damiand <guillaume.damiand at liris.cnrs.fr>
+
+#ifndef CGAL_LCC_3_VIEWER_QT_H
+#define CGAL_LCC_3_VIEWER_QT_H
+
+#include <QApplication>
+#include <QKeyEvent>
+
+#include <QGLViewer/qglviewer.h>
+#include <QKeyEvent>
+#include <QOpenGLFunctions_2_1>
+#include <QOpenGLVertexArrayObject>
+#include <QGLBuffer>
+#include <QOpenGLShaderProgram>
+
+#include <CGAL/Linear_cell_complex.h>
+#include <CGAL/Cartesian_converter.h>
+#include <CGAL/Triangulation_2_projection_traits_3.h>
+#include <CGAL/Triangulation_vertex_base_with_info_2.h>
+#include <CGAL/Triangulation_face_base_with_info_2.h>
+#include <CGAL/Constrained_Delaunay_triangulation_2.h>
+#include <CGAL/Constrained_triangulation_plus_2.h>
+#include <CGAL/Qt/CreateOpenGLContext.h>
+
+#include <vector>
+
+typedef CGAL::Exact_predicates_inexact_constructions_kernel Local_kernel;
+typedef Local_kernel::Point_3  Local_point;
+typedef Local_kernel::Vector_3 Local_vector;
+
+template<class LCC, int dim=LCC::ambient_dimension>
+struct Geom_utils;
+
+template<class LCC>
+struct Geom_utils<LCC,3>
+{
+  Local_point get_point(LCC& lcc, typename LCC::Vertex_attribute_const_handle vh)
+  { return converter(lcc.point_of_vertex_attribute(vh)); }
+
+  Local_point get_point(LCC& lcc, typename LCC::Dart_const_handle dh)
+  { return converter(lcc.point(dh)); }
+
+  Local_vector get_facet_normal(LCC& lcc, typename LCC::Dart_const_handle dh)
+  {
+    Local_vector n = converter(CGAL::compute_normal_of_cell_2<LCC>(lcc,dh));
+    n = n/(CGAL::sqrt(n*n));
+    return n;
+  }
+
+  Local_vector get_vertex_normal(LCC& lcc, typename LCC::Dart_const_handle dh)
+  {
+    Local_vector n = converter(CGAL::compute_normal_of_cell_0<LCC>(lcc,dh));
+    n = n/(CGAL::sqrt(n*n));
+    return n;
+  }
+protected:
+  CGAL::Cartesian_converter<typename LCC::Traits, Local_kernel> converter;
+};
+
+template<class LCC>
+struct Geom_utils<LCC,2>
+{
+  Local_point get_point(LCC& lcc, typename LCC::Vertex_attribute_const_handle vh)
+  {
+    Local_point p(converter(lcc.point_of_vertex_attribute(vh).x()),0,
+                  converter(lcc.point_of_vertex_attribute(vh).y()));
+    return p;
+  }
+
+  Local_point get_point(LCC& lcc, typename LCC::Dart_const_handle dh)
+  { return get_point(lcc, lcc.vertex_attribute(dh)); }
+
+  Local_vector get_facet_normal(LCC&, typename LCC::Dart_const_handle)
+  {
+    Local_vector n(0,1,0);
+    return n;
+  }
+
+  Local_vector get_vertex_normal(LCC&, typename LCC::Dart_const_handle)
+  {
+    Local_vector n(0,1,0);
+    return n;
+  }
+protected:
+  CGAL::Cartesian_converter<typename LCC::Traits, Local_kernel> converter;
+};
+
+template<class LCC>
+CGAL::Bbox_3 bbox(LCC& lcc)
+{
+  CGAL::Bbox_3 bb;
+  Geom_utils<LCC> geomutils;
+
+  typename LCC::Vertex_attribute_range::const_iterator
+    it=lcc.vertex_attributes().begin(), itend=lcc.vertex_attributes().end();
+  if ( it!=itend )
+  {
+    bb = geomutils.get_point(lcc, it).bbox();
+    for( ++it; it!=itend; ++it)
+    {
+      bb = bb + geomutils.get_point(lcc, it).bbox();
+    }
+  }
+
+  return bb;
+}
+
+template<class LCC>
+class SimpleLCCViewerQt : public QGLViewer, public QOpenGLFunctions_2_1
+{
+  typedef typename LCC::Dart_handle Dart_handle;
+
+  struct Vertex_info
+  {
+    Dart_handle dh;
+    Local_vector v;
+  };
+
+  struct Face_info
+  {
+    bool exist_edge[3];
+    bool is_external;
+    bool is_process;
+  };
+
+  typedef CGAL::Triangulation_2_projection_traits_3<CGAL::Exact_predicates_inexact_constructions_kernel> P_traits;
+  typedef CGAL::Triangulation_vertex_base_with_info_2<Vertex_info, P_traits> Vb;
+
+  typedef CGAL::Triangulation_face_base_with_info_2<Face_info, P_traits> Fb1;
+
+  typedef CGAL::Constrained_triangulation_face_base_2<P_traits, Fb1>    Fb;
+  typedef CGAL::Triangulation_data_structure_2<Vb,Fb>                   TDS;
+  typedef CGAL::No_intersection_tag                                     Itag;
+  typedef CGAL::Constrained_Delaunay_triangulation_2<P_traits, TDS,
+                                                     Itag>              CDT;
+
+public:
+  // Constructor/Destructor
+  SimpleLCCViewerQt(LCC& alcc) :
+    QGLViewer(CGAL::Qt::createOpenGLContext()),
+    lcc(alcc),
+    wireframe(false),
+    flatShading(true),
+    edges(true),
+    vertices(true),
+    are_buffers_initialized(false)
+  {
+    setWindowTitle("3D lcc viewer");
+    resize(500, 450);
+
+    QGLFormat newFormat = this->format();
+    newFormat.setSampleBuffers(true);
+    newFormat.setSamples(16);
+    this->setFormat(newFormat);
+  }
+
+  ~SimpleLCCViewerQt()
+  {
+    buffers[0].destroy();
+    buffers[1].destroy();
+    buffers[2].destroy();
+    buffers[3].destroy();
+    buffers[4].destroy();
+    buffers[5].destroy();
+    vao[0].destroy();
+    vao[1].destroy();
+    vao[2].destroy();
+    vao[3].destroy();
+  }
+
+protected:
+  void compile_shaders()
+  {
+    if(!buffers[0].create() || !buffers[1].create() || !buffers[2].create() ||
+       !buffers[3].create() || !buffers[4].create() || !buffers[5].create())
+    {
+      std::cerr<<"VBO Creation FAILED"<<std::endl;
+    }
+
+    if(!vao[0].create() || !vao[1].create() || !vao[2].create() || !vao[3].create())
+    {
+      std::cerr<<"VAO Creation FAILED"<<std::endl;
+    }
+
+    //The Facets
+
+    //Vertex source code
+// "attribute highp vec3 color;\n"
+//        "uniform highp vec4 color;\n"
+        //        "varying highp vec4 fColor; \n"
+        //        "   fColor = vec4(color, 1.0); \n"
+    const char vertex_source[] =
+      {
+        "#version 120 \n"
+        "attribute highp vec4 vertex;\n"
+        "attribute highp vec3 normal;\n"
+
+        "uniform highp mat4 mvp_matrix;\n"
+        "uniform highp mat4 mv_matrix; \n"
+
+        "varying highp vec4 fP; \n"
+        "varying highp vec3 fN; \n"
+        "void main(void)\n"
+        "{\n"
+        "   fP = mv_matrix * vertex; \n"
+        "   fN = mat3(mv_matrix)* normal; \n"
+        "   gl_Position = mvp_matrix * vertex;\n"
+        "}"
+      };
+    //Vertex source code
+// "varying highp vec4 fColor; \n"
+    const char fragment_source[] =
+      {
+        "#version 120 \n"
+        "varying highp vec4 fP; \n"
+        "varying highp vec3 fN; \n"
+        "uniform highp vec4 color; \n"
+        "uniform vec4 light_pos;  \n"
+        "uniform vec4 light_diff; \n"
+        "uniform vec4 light_spec; \n"
+        "uniform vec4 light_amb;  \n"
+        "uniform float spec_power ; \n"
+
+        "void main(void) { \n"
+
+        "   vec3 L = light_pos.xyz - fP.xyz; \n"
+        "   vec3 V = -fP.xyz; \n"
+
+        "   vec3 N = normalize(fN); \n"
+        "   L = normalize(L); \n"
+        "   V = normalize(V); \n"
+
+        "   vec3 R = reflect(-L, N); \n"
+        "   vec4 diffuse = max(dot(N,L), 0.0) * light_diff * color; \n"
+        "   vec4 specular = pow(max(dot(R,V), 0.0), spec_power) * light_spec; \n"
+
+        "gl_FragColor = light_amb*color + diffuse  ; \n"
+        "} \n"
+        "\n"
+      };
+
+    QOpenGLShader *vertex_shader = new QOpenGLShader(QOpenGLShader::Vertex);
+    if(!vertex_shader->compileSourceCode(vertex_source))
+    {
+      std::cerr<<"Compiling vertex source FAILED"<<std::endl;
+    }
+
+    QOpenGLShader *fragment_shader= new QOpenGLShader(QOpenGLShader::Fragment);
+    if(!fragment_shader->compileSourceCode(fragment_source))
+    {
+      std::cerr<<"Compiling fragmentsource FAILED"<<std::endl;
+    }
+
+    if(!rendering_program.addShader(vertex_shader))
+    {
+      std::cerr<<"adding vertex shader FAILED"<<std::endl;
+    }
+    if(!rendering_program.addShader(fragment_shader))
+    {
+      std::cerr<<"adding fragment shader FAILED"<<std::endl;
+    }
+    if(!rendering_program.link())
+    {
+      std::cerr<<"linking Program FAILED"<<std::endl;
+    }
+    rendering_program.bind();
+
+    //Vertex source code
+    const char vertex_source_p_l[] =
+      {
+        "#version 120 \n"
+        "attribute highp vec4 vertex;\n"
+        "uniform highp mat4 mvp_matrix;\n"
+        "void main(void)\n"
+        "{\n"
+        "   gl_Position = mvp_matrix * vertex;\n"
+        "}"
+      };
+    //Vertex source code
+    const char fragment_source_p_l[] =
+      {
+        "#version 120 \n"
+        "uniform highp vec4 color; \n"
+        "void main(void) { \n"
+        "gl_FragColor = color; \n"
+        "} \n"
+        "\n"
+      };
+
+    vertex_shader = new QOpenGLShader(QOpenGLShader::Vertex);
+    if(!vertex_shader->compileSourceCode(vertex_source_p_l))
+    {
+      std::cerr<<"Compiling vertex source FAILED"<<std::endl;
+    }
+
+    fragment_shader= new QOpenGLShader(QOpenGLShader::Fragment);
+    if(!fragment_shader->compileSourceCode(fragment_source_p_l))
+    {
+      std::cerr<<"Compiling fragmentsource FAILED"<<std::endl;
+    }
+
+    if(!rendering_program_p_l.addShader(vertex_shader))
+    {
+      std::cerr<<"adding vertex shader FAILED"<<std::endl;
+    }
+    if(!rendering_program_p_l.addShader(fragment_shader))
+    {
+      std::cerr<<"adding fragment shader FAILED"<<std::endl;
+    }
+    if(!rendering_program_p_l.link())
+    {
+      std::cerr<<"linking Program FAILED"<<std::endl;
+    }
+    rendering_program_p_l.bind();
+  }
+
+  void initialize_buffers()
+  {
+    //points of the facets
+    vao[0].bind();
+    buffers[0].bind();
+    buffers[0].allocate(pos_facets.data(),
+                        static_cast<int>(pos_facets.size()*sizeof(float)));
+    vertexLocation[0] = rendering_program.attributeLocation("vertex");
+    rendering_program.bind();
+    rendering_program.enableAttributeArray(vertexLocation[0]);
+    rendering_program.setAttributeBuffer(vertexLocation[0],GL_FLOAT,0,3);
+    rendering_program.release();
+    buffers[0].release();
+
+    //normals of the facets
+    buffers[1].bind();
+    buffers[1].allocate(flat_normals.data(),
+                        static_cast<int>(flat_normals.size()*sizeof(float)));
+    normalsLocation = rendering_program.attributeLocation("normal");
+    rendering_program.bind();
+    rendering_program.enableAttributeArray(normalsLocation);
+    rendering_program.setAttributeBuffer(normalsLocation,GL_FLOAT,0,3);
+    rendering_program.release();
+    buffers[1].release();
+
+    vao[0].release();
+
+    vao[1].bind();
+
+    //points of the facets
+    buffers[2].bind();
+    buffers[2].allocate(pos_facets.data(),
+                        static_cast<int>(pos_facets.size()*sizeof(float)));
+    vertexLocation[1] = rendering_program.attributeLocation("vertex");
+    rendering_program.bind();
+    rendering_program.enableAttributeArray(vertexLocation[1]);
+    rendering_program.setAttributeBuffer(vertexLocation[1],GL_FLOAT,0,3);
+    rendering_program.release();
+    buffers[2].release();
+
+    //normals of the facets
+    buffers[3].bind();
+    buffers[3].allocate(smooth_normals.data(),
+                        static_cast<int>(smooth_normals.size()*sizeof(float)));
+    normalsLocation = rendering_program.attributeLocation("normal");
+    rendering_program.bind();
+    rendering_program.enableAttributeArray(normalsLocation);
+    rendering_program.setAttributeBuffer(normalsLocation,GL_FLOAT,0,3);
+    rendering_program.release();
+    buffers[3].release();
+
+    vao[1].release();
+
+    //The lines
+    vao[2].bind();
+
+    buffers[4].bind();
+    buffers[4].allocate(pos_lines.data(), static_cast<int>(pos_lines.size()*sizeof(float)));
+    vertexLocation[2] = rendering_program_p_l.attributeLocation("vertex");
+    rendering_program_p_l.bind();
+    rendering_program_p_l.enableAttributeArray(vertexLocation[2]);
+    rendering_program_p_l.setAttributeBuffer(vertexLocation[2],GL_FLOAT,0,3);
+    buffers[4].release();
+    rendering_program_p_l.release();
+
+    vao[2].release();
+
+    //The points
+    vao[3].bind();
+    buffers[5].bind();
+    buffers[5].allocate(pos_points.data(), static_cast<int>(pos_points.size()*sizeof(float)));
+    vertexLocation[3] = rendering_program_p_l.attributeLocation("vertex");
+    rendering_program_p_l.bind();
+    rendering_program_p_l.enableAttributeArray(vertexLocation[3]);
+    rendering_program_p_l.setAttributeBuffer(vertexLocation[3],GL_FLOAT,0,3);
+    buffers[5].release();
+    rendering_program_p_l.release();
+    vao[3].release();
+
+    are_buffers_initialized = true;
+  }
+
+  void compute_face(Dart_handle dh)
+  {
+    //compute flat normals
+    Local_vector normal = geomutils.get_facet_normal(lcc, dh);
+    normal = normal/(CGAL::sqrt(normal*normal));
+
+    if (lcc.template beta<1,1,1>(dh)!=dh)
+    {
+      P_traits cdt_traits(normal);
+      CDT cdt(cdt_traits);
+
+      // Iterates on the vector of facet handles
+      typename CDT::Vertex_handle previous = NULL, first = NULL;
+      for (typename LCC::template Dart_of_orbit_range<1>::const_iterator
+             he_circ = lcc.template darts_of_orbit<1>(dh).begin(),
+             he_circ_end = lcc.template darts_of_orbit<1>(dh).end();
+           he_circ!=he_circ_end; ++he_circ)
+      {
+        typename CDT::Vertex_handle vh = cdt.insert(geomutils.get_point(lcc, he_circ));
+        if(first == NULL)
+        { first = vh; }
+        vh->info().v = geomutils.get_vertex_normal(lcc, he_circ);
+        if(previous!=NULL && previous != vh)
+        { cdt.insert_constraint(previous, vh); }
+        previous = vh;
+      }
+      if (previous!=NULL)
+        cdt.insert_constraint(previous, first);
+
+      // sets mark is_external
+      for(typename CDT::All_faces_iterator fit = cdt.all_faces_begin(),
+            fitend = cdt.all_faces_end(); fit!=fitend; ++fit)
+      {
+        fit->info().is_external = true;
+        fit->info().is_process = false;
+      }
+      //check if the facet is external or internal
+      std::queue<typename CDT::Face_handle> face_queue;
+      typename CDT::Face_handle face_internal = NULL;
+      face_queue.push(cdt.infinite_vertex()->face());
+      while(! face_queue.empty() )
+      {
+        typename CDT::Face_handle fh = face_queue.front();
+        face_queue.pop();
+        if(!fh->info().is_process)
+        {
+          fh->info().is_process = true;
+          for(int i = 0; i <3; ++i)
+          {
+            if(!cdt.is_constrained(std::make_pair(fh, i)))
+            {
+              face_queue.push(fh->neighbor(i));
+            }
+            else if (face_internal==NULL)
+            {
+              face_internal = fh->neighbor(i);
+            }
+          }
+        }
+      }
+
+      if ( face_internal!=NULL )
+        face_queue.push(face_internal);
+
+      while(! face_queue.empty() )
+      {
+        typename CDT::Face_handle fh = face_queue.front();
+        face_queue.pop();
+        if(!fh->info().is_process)
+        {
+          fh->info().is_process = true;
+          fh->info().is_external = false;
+          for(int i = 0; i <3; ++i)
+          {
+            if(!cdt.is_constrained(std::make_pair(fh, i)))
+            {
+              face_queue.push(fh->neighbor(i));
+            }
+          }
+        }
+      }
+
+      //iterates on the internal faces to add the vertices to the positions
+      //and the normals to the appropriate vectors
+      for(typename CDT::Finite_faces_iterator ffit = cdt.finite_faces_begin(),
+            ffitend = cdt.finite_faces_end(); ffit != ffitend; ++ffit)
+      {
+        if(!ffit->info().is_external)
+        {
+          flat_normals.push_back(normal.x());
+          flat_normals.push_back(normal.y());
+          flat_normals.push_back(normal.z());
+
+          flat_normals.push_back(normal.x());
+          flat_normals.push_back(normal.y());
+          flat_normals.push_back(normal.z());
+
+          flat_normals.push_back(normal.x());
+          flat_normals.push_back(normal.y());
+          flat_normals.push_back(normal.z());
+
+          smooth_normals.push_back(ffit->vertex(0)->info().v.x());
+          smooth_normals.push_back(ffit->vertex(0)->info().v.y());
+          smooth_normals.push_back(ffit->vertex(0)->info().v.z());
+
+          smooth_normals.push_back(ffit->vertex(1)->info().v.x());
+          smooth_normals.push_back(ffit->vertex(1)->info().v.y());
+          smooth_normals.push_back(ffit->vertex(1)->info().v.z());
+
+          smooth_normals.push_back(ffit->vertex(2)->info().v.x());
+          smooth_normals.push_back(ffit->vertex(2)->info().v.y());
+          smooth_normals.push_back(ffit->vertex(2)->info().v.z());
+
+          pos_facets.push_back(ffit->vertex(0)->point().x());
+          pos_facets.push_back(ffit->vertex(0)->point().y());
+          pos_facets.push_back(ffit->vertex(0)->point().z());
+
+          pos_facets.push_back(ffit->vertex(1)->point().x());
+          pos_facets.push_back(ffit->vertex(1)->point().y());
+          pos_facets.push_back(ffit->vertex(1)->point().z());
+
+          pos_facets.push_back(ffit->vertex(2)->point().x());
+          pos_facets.push_back(ffit->vertex(2)->point().y());
+          pos_facets.push_back(ffit->vertex(2)->point().z());
+        }
+      }
+    }
+    else
+    {
+      flat_normals.push_back(normal.x());
+      flat_normals.push_back(normal.y());
+      flat_normals.push_back(normal.z());
+
+      flat_normals.push_back(normal.x());
+      flat_normals.push_back(normal.y());
+      flat_normals.push_back(normal.z());
+
+      flat_normals.push_back(normal.x());
+      flat_normals.push_back(normal.y());
+      flat_normals.push_back(normal.z());
+
+      for (typename LCC::template Dart_of_orbit_range<1>::const_iterator
+             orbitIter = lcc.template darts_of_orbit<1>(dh).begin();
+           orbitIter.cont(); ++orbitIter)
+      {
+        //compute Smooth normals
+        Local_vector normal = geomutils.get_vertex_normal(lcc, orbitIter);
+        normal = normal/(CGAL::sqrt(normal*normal));
+
+        smooth_normals.push_back(normal.x());
+        smooth_normals.push_back(normal.y());
+        smooth_normals.push_back(normal.z());
+
+        Local_point p = geomutils.get_point(lcc, orbitIter);
+        pos_facets.push_back(p.x());
+        pos_facets.push_back(p.y());
+        pos_facets.push_back(p.z());
+      }
+    }
+  }
+
+  void compute_edge(Dart_handle dh)
+  {
+    Local_point p =  geomutils.get_point(lcc, dh);
+    Dart_handle d2 = lcc.other_extremity(dh);
+    if ( d2!=NULL )
+    {
+      Local_point p2 = geomutils.get_point(lcc, d2);
+      pos_lines.push_back(p.x());
+      pos_lines.push_back(p.y());
+      pos_lines.push_back(p.z());
+
+      pos_lines.push_back(p2.x());
+      pos_lines.push_back(p2.y());
+      pos_lines.push_back(p2.z());
+    }
+  }
+
+  void compute_vertex(Dart_handle dh, bool empty)
+  {
+    Local_point p =  geomutils.get_point(lcc, dh);
+    pos_points.push_back(p.x());
+    pos_points.push_back(p.y());
+    pos_points.push_back(p.z());
+
+    if ( empty )
+    {
+      bb = p.bbox();
+      empty = false;
+    }
+    else
+      bb = bb + p.bbox();
+  }
+
+  void compute_elements()
+  {
+    pos_facets.clear();
+    flat_normals.clear();
+    smooth_normals.clear();
+    pos_lines.clear();
+    pos_points.clear();
+
+    if ( lcc.is_empty() )
+    {
+      bb = Local_point(CGAL::ORIGIN).bbox();
+      bb = bb + Local_point(1,1,1).bbox(); // To avoid a warning from Qglviewer
+      return;
+    }
+
+    unsigned int markfaces    = lcc.get_new_mark();
+    unsigned int markedges    = lcc.get_new_mark();
+    unsigned int markvertices = lcc.get_new_mark();
+
+    bool empty = true;
+    for (typename LCC::Dart_range::iterator it=lcc.darts().begin(),
+           itend=lcc.darts().end(); it!=itend; ++it )
+    {
+      if ( !lcc.is_marked(it, markfaces) )
+      {
+        compute_face(it);
+        CGAL::mark_cell<LCC, 2>(lcc, it, markfaces);
+      }
+
+      if ( !lcc.is_marked(it, markedges) )
+      {
+        compute_edge(it);
+        CGAL::mark_cell<LCC, 1>(lcc, it, markedges);
+      }
+
+      if ( !lcc.is_marked(it, markvertices) )
+      {
+        compute_vertex(it, empty);
+        empty = false;
+        CGAL::mark_cell<LCC, 0>(lcc, it, markvertices);
+      }
+    }
+
+    lcc.free_mark(markfaces);
+    lcc.free_mark(markedges);
+    lcc.free_mark(markvertices);
+
+  }
+
+  void attrib_buffers(QGLViewer* viewer)
+  {
+    QMatrix4x4 mvpMatrix;
+    QMatrix4x4 mvMatrix;
+    double mat[16];
+    viewer->camera()->getModelViewProjectionMatrix(mat);
+    for(int i=0; i < 16; i++)
+    {
+      mvpMatrix.data()[i] = (float)mat[i];
+    }
+    viewer->camera()->getModelViewMatrix(mat);
+    for(int i=0; i < 16; i++)
+    {
+      mvMatrix.data()[i] = (float)mat[i];
+    }
+    // define material
+    QVector4D ambient(0.4f, 0.4f, 0.4f, 0.4f);
+    QVector4D diffuse( 0.9f,
+                       0.9f,
+                       0.9f,
+                       0.9f );
+
+    QVector4D specular( 0.0f,
+                        0.0f,
+                        0.0f,
+                        1.0f );
+
+    QVector4D position((bb.xmax()-bb.xmin())/2, (bb.ymax()-bb.ymin())/2,bb.zmax(), 0.0 );
+    GLfloat shininess =  1.0f;
+
+    rendering_program.bind();
+    mvpLocation[0] = rendering_program.uniformLocation("mvp_matrix");
+    mvLocation = rendering_program.uniformLocation("mv_matrix");
+    lightLocation[0] = rendering_program.uniformLocation("light_pos");
+    lightLocation[1] = rendering_program.uniformLocation("light_diff");
+    lightLocation[2] = rendering_program.uniformLocation("light_spec");
+    lightLocation[3] = rendering_program.uniformLocation("light_amb");
+    lightLocation[4] = rendering_program.uniformLocation("spec_power");
+
+    rendering_program.setUniformValue(lightLocation[0], position);
+    rendering_program.setUniformValue(lightLocation[1], diffuse);
+    rendering_program.setUniformValue(lightLocation[2], specular);
+    rendering_program.setUniformValue(lightLocation[3], ambient);
+    rendering_program.setUniformValue(lightLocation[4], shininess);
+    rendering_program.setUniformValue(mvpLocation[0], mvpMatrix);
+    rendering_program.setUniformValue(mvLocation, mvMatrix);
+
+    colorLocation2 = rendering_program.uniformLocation("color");
+    rendering_program.release();
+
+    rendering_program_p_l.bind();
+    mvpLocation[1] = rendering_program_p_l.uniformLocation("mvp_matrix");
+    colorLocation = rendering_program_p_l.uniformLocation("color");
+    rendering_program.setUniformValue(mvpLocation[1], mvpMatrix);
+    rendering_program_p_l.release();
+  }
+
+  virtual void draw()
+  {
+    glEnable(GL_DEPTH_TEST);
+    if(!are_buffers_initialized)
+      initialize_buffers();
+
+    QColor color;
+    if ( !wireframe )
+    {
+      if(flatShading)
+      {
+        vao[0].bind();
+        attrib_buffers(this);
+        color.setRgbF(0.1f, 0.7f, 0.1f);
+        rendering_program.bind();
+        rendering_program.setUniformValue(colorLocation2,color);
+        glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(pos_facets.size()/3));
+        rendering_program.release();
+        vao[0].release();
+      }
+      else
+      {
+        vao[1].bind();
+        attrib_buffers(this);
+        color.setRgbF(0.1f, 0.7f, 0.1f);
+        rendering_program.bind();
+        rendering_program.setUniformValue(colorLocation2,color);
+        glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(pos_facets.size()/3));
+        rendering_program.release();
+        vao[1].release();
+      }
+    }
+    if(edges)
+    {
+      vao[2].bind();
+      attrib_buffers(this);
+      color.setRgbF(0.2f, 0.2f, 0.7f);
+      rendering_program_p_l.bind();
+      rendering_program_p_l.setAttributeValue(colorLocation,color);
+      glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(pos_lines.size()/3));
+      rendering_program_p_l.release();
+      vao[2].release();
+    }
+    if(vertices)
+    {
+      ::glPointSize(7.f);
+      vao[3].bind();
+      attrib_buffers(this);
+      color.setRgbF(.2f,.2f,.6f);
+      rendering_program_p_l.bind();
+      rendering_program_p_l.setAttributeValue(colorLocation,color);
+      glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(pos_points.size()/3));
+      rendering_program_p_l.release();
+      vao[3].release();
+    }
+  }
+
+  virtual void init()
+  {
+    // Restore previous viewer state.
+    restoreStateFromFile();
+
+    // Define 'Control+Q' as the new exit shortcut (default was 'Escape')
+    setShortcut(EXIT_VIEWER, Qt::CTRL+Qt::Key_Q);
+
+    // Add custom key description (see keyPressEvent).
+    setKeyDescription(Qt::Key_W, "Toggles wire frame display");
+    setKeyDescription(Qt::Key_F, "Toggles flat shading display");
+    setKeyDescription(Qt::Key_E, "Toggles edges display");
+    setKeyDescription(Qt::Key_V, "Toggles vertices display");
+
+    // Light default parameters
+    ::glLineWidth(2.4f);
+    ::glPointSize(7.f);
+    ::glEnable(GL_POLYGON_OFFSET_FILL);
+    ::glPolygonOffset(1.f,1.f);
+    ::glClearColor(1.0f,1.0f,1.0f,0.0f);
+    ::glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
+
+    ::glEnable(GL_LIGHTING);
+
+    ::glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
+
+    ::glShadeModel(GL_FLAT);
+    ::glDisable(GL_BLEND);
+    ::glDisable(GL_LINE_SMOOTH);
+    ::glDisable(GL_POLYGON_SMOOTH_HINT);
+    ::glBlendFunc(GL_ONE, GL_ZERO);
+    ::glHint(GL_LINE_SMOOTH_HINT, GL_FASTEST);
+
+    initializeOpenGLFunctions();
+    compile_shaders();
+    compute_elements();
+
+    this->camera()->setSceneBoundingBox(qglviewer::Vec(bb.xmin(),
+                                                       bb.ymin(),
+                                                       bb.zmin()),
+                                        qglviewer::Vec(bb.xmax(),
+                                                       bb.ymax(),
+                                                       bb.zmax()));
+
+    this->showEntireScene();
+  }
+
+  void keyPressEvent(QKeyEvent *e)
+  {
+    const Qt::KeyboardModifiers modifiers = e->modifiers();
+
+    if ((e->key()==Qt::Key_W) && (modifiers==Qt::NoButton))
+    {
+      wireframe = !wireframe;
+      if (wireframe)
+        glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+      else
+        glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+      updateGL();
+    }
+    else if ((e->key()==Qt::Key_F) && (modifiers==Qt::NoButton))
+    {
+      flatShading = !flatShading;
+      updateGL();
+    }
+    else if ((e->key()==Qt::Key_E) && (modifiers==Qt::NoButton))
+    {
+      edges = !edges;
+      updateGL();
+    }
+    else if ((e->key()==Qt::Key_V) && (modifiers==Qt::NoButton))
+    {
+      vertices = !vertices;
+      updateGL();
+    }
+    else
+      QGLViewer::keyPressEvent(e);
+  }
+
+
+  virtual QString helpString() const
+  {
+    QString text("<h2>L C C   V i e w e r</h2>");
+    text += "Use the mouse to move the camera around the object. ";
+    text += "You can respectively revolve around, zoom and translate with "
+      "the three mouse buttons. ";
+    text += "Left and middle buttons pressed together rotate around the "
+      "camera view direction axis<br><br>";
+    text += "Pressing <b>Alt</b> and one of the function keys "
+      "(<b>F1</b>..<b>F12</b>) defines a camera keyFrame. ";
+    text += "Simply press the function key again to restore it. "
+      "Several keyFrames define a ";
+    text += "camera path. Paths are saved when you quit the application "
+      "and restored at next start.<br><br>";
+    text += "Press <b>F</b> to display the frame rate, <b>A</b> for the "
+      "world axis, ";
+    text += "<b>Alt+Return</b> for full screen mode and <b>Control+S</b> "
+      "to save a snapshot. ";
+    text += "See the <b>Keyboard</b> tab in this window for a complete "
+      "shortcut list.<br><br>";
+    text += "Double clicks automates single click actions: A left button "
+      "double click aligns the closer axis with the camera (if close enough). ";
+    text += "A middle button double click fits the zoom of the camera and "
+      "the right button re-centers the scene.<br><br>";
+    text += "A left button double click while holding right button pressed "
+      "defines the camera <i>Revolve Around Point</i>. ";
+    text += "See the <b>Mouse</b> tab and the documentation web pages for "
+      "details.<br><br>";
+    text += "Press <b>Escape</b> to exit the viewer.";
+    return text;
+  }
+
+private:
+  LCC& lcc;
+  bool wireframe;
+  bool flatShading;
+  bool edges;
+  bool vertices;
+  Geom_utils<LCC> geomutils;
+
+  CGAL::Bbox_3 bb;
+  bool are_buffers_initialized;
+
+  //Shaders elements
+  int vertexLocation[4];
+  int normalsLocation;
+  int mvpLocation[2];
+  int mvLocation;
+  int colorLocation;
+  int colorLocation2;
+  int lightLocation[5];
+
+  std::vector<float> pos_points;
+  std::vector<float> pos_lines;
+  std::vector<float> pos_facets;
+  std::vector<float> smooth_normals;
+  std::vector<float> flat_normals;
+
+  QGLBuffer buffers[6];
+  QOpenGLVertexArrayObject vao[4];
+
+  QOpenGLShaderProgram rendering_program;
+  QOpenGLShaderProgram rendering_program_p_l;
+};
+
+template<class LCC>
+void display_lcc(LCC& alcc)
+{
+  int argc=1;
+
+  const char* argv[2]={"lccviewer","\0"};
+  QApplication app(argc,const_cast<char**>(argv));
+
+  SimpleLCCViewerQt<LCC> mainwindow(alcc,&app);
+  mainwindow.show();
+
+  app.exec();
+}
+
+#endif // CGAL_LCC_3_VIEWER_QT_H
diff --git a/3rdparty/CGAL-4.8/examples/Linear_cell_complex/linear_cell_complex_3_with_colored_vertices.cpp b/3rdparty/CGAL/examples/Linear_cell_complex/linear_cell_complex_3_with_colored_vertices.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Linear_cell_complex/linear_cell_complex_3_with_colored_vertices.cpp
rename to 3rdparty/CGAL/examples/Linear_cell_complex/linear_cell_complex_3_with_colored_vertices.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Linear_cell_complex/linear_cell_complex_3_with_mypoint.cpp b/3rdparty/CGAL/examples/Linear_cell_complex/linear_cell_complex_3_with_mypoint.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Linear_cell_complex/linear_cell_complex_3_with_mypoint.cpp
rename to 3rdparty/CGAL/examples/Linear_cell_complex/linear_cell_complex_3_with_mypoint.cpp
diff --git a/3rdparty/CGAL/examples/Linear_cell_complex/linear_cell_complex_4.cpp b/3rdparty/CGAL/examples/Linear_cell_complex/linear_cell_complex_4.cpp
new file mode 100644
index 0000000..2f318d3
--- /dev/null
+++ b/3rdparty/CGAL/examples/Linear_cell_complex/linear_cell_complex_4.cpp
@@ -0,0 +1,72 @@
+#include <CGAL/Linear_cell_complex.h>
+#include <CGAL/Linear_cell_complex_constructors.h>
+#include <iostream>
+#include <vector>
+
+typedef CGAL::Linear_cell_complex<4,5> LCC_4;
+typedef LCC_4::Dart_handle             Dart_handle;
+typedef LCC_4::Point                   Point;
+typedef LCC_4::Vector                  Vector;
+typedef LCC_4::FT                      FT;
+
+int main()
+{
+  LCC_4 lcc;
+  
+  // Create two tetrahedra.
+  FT p1[5]={ 0, 0, 0, 0, 0}; std::vector<FT> v1(p1,p1+5);
+  FT p2[5]={ 0, 2, 0, 0, 0}; std::vector<FT> v2(p2,p2+5);
+  FT p3[5]={ 0, 1, 2, 0, 0}; std::vector<FT> v3(p3,p3+5);
+  FT p4[5]={ 2, 1, 0, 0, 0}; std::vector<FT> v4(p4,p4+5);
+  FT p5[5]={-1, 0, 0, 0, 0}; std::vector<FT> v5(p5,p5+5);
+  FT p6[5]={-1, 2, 0, 0, 0}; std::vector<FT> v6(p6,p6+5);
+  FT p7[5]={-1, 1, 2, 0, 0}; std::vector<FT> v7(p7,p7+5);
+  FT p8[5]={-3, 1, 2, 0, 0}; std::vector<FT> v8(p8,p8+5);
+  
+  Dart_handle d1 = lcc.make_tetrahedron(Point(5, v1.begin(), v1.end()),
+                                        Point(5, v2.begin(), v2.end()),
+                                        Point(5, v3.begin(), v3.end()),
+                                        Point(5, v4.begin(), v4.end()));  
+  
+  Dart_handle d2 = lcc.make_tetrahedron(Point(5, v5.begin(), v5.end()),
+                                        Point(5, v6.begin(), v6.end()),
+                                        Point(5, v7.begin(), v7.end()),
+                                        Point(5, v8.begin(), v8.end()));
+
+  lcc.display_characteristics(std::cout);
+  std::cout<<", valid="<<lcc.is_valid()<<std::endl;
+
+  lcc.sew<4>(d1,d2);
+  
+  lcc.display_characteristics(std::cout);
+  std::cout<<", valid="<<lcc.is_valid()<<std::endl;
+
+  // Add one vertex on the middle of the edge containing dart d1.
+  Dart_handle d3 = lcc.insert_barycenter_in_cell<1>(d1);
+  CGAL_assertion( lcc.is_valid() );
+
+  lcc.display_characteristics(std::cout);
+  std::cout<<", valid="<<lcc.is_valid()<<std::endl;
+
+  // Add one edge to cut the face containing dart d3 in two.
+  Dart_handle d4 = lcc.insert_cell_1_in_cell_2(d3,lcc.beta(d1, 0));
+  CGAL_assertion( lcc.is_valid() );
+  
+  lcc.display_characteristics(std::cout);
+  std::cout<<", valid="<<lcc.is_valid()<<std::endl;
+
+  // We use removal operations to get back to the initial configuration.
+  lcc.remove_cell<1>(d4);
+  CGAL_assertion( lcc.is_valid() );
+
+  lcc.remove_cell<0>(d3);
+  CGAL_assertion( lcc.is_valid() );
+
+  lcc.unsew<4>(d1);
+
+  lcc.display_characteristics(std::cout);
+  std::cout<<", valid="<<lcc.is_valid()<<std::endl;
+
+  return EXIT_SUCCESS;
+}
+
diff --git a/3rdparty/CGAL-4.8/examples/Linear_cell_complex/plane_graph_to_lcc_2.cpp b/3rdparty/CGAL/examples/Linear_cell_complex/plane_graph_to_lcc_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Linear_cell_complex/plane_graph_to_lcc_2.cpp
rename to 3rdparty/CGAL/examples/Linear_cell_complex/plane_graph_to_lcc_2.cpp
diff --git a/3rdparty/CGAL/examples/Linear_cell_complex/voronoi_2.cpp b/3rdparty/CGAL/examples/Linear_cell_complex/voronoi_2.cpp
new file mode 100644
index 0000000..8668f5e
--- /dev/null
+++ b/3rdparty/CGAL/examples/Linear_cell_complex/voronoi_2.cpp
@@ -0,0 +1,174 @@
+#include <CGAL/Linear_cell_complex.h>
+#include <CGAL/Linear_cell_complex_constructors.h>
+#include <CGAL/Linear_cell_complex_operations.h>
+#include <CGAL/Delaunay_triangulation_2.h>
+#include <iostream>
+#include <fstream>
+
+/* If you want to use a viewer, you can use qglviewer. */
+#ifdef CGAL_LCC_USE_QT
+#include "linear_cell_complex_3_viewer_qt.h"
+#endif
+
+/* // If you want to use exact constructions.
+#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
+typedef CGAL::Linear_cell_complex<2,2,
+  CGAL::Linear_cell_complex_traits<2, CGAL::Exact_predicates_exact_constructions_kernel> > LCC_2;
+*/
+
+typedef CGAL::Linear_cell_complex<2> LCC_2;
+typedef LCC_2::Dart_handle           Dart_handle;
+typedef LCC_2::Point                 Point;
+
+typedef CGAL::Delaunay_triangulation_2<LCC_2::Traits> Triangulation;
+
+// Function used to display the voronoi diagram.
+void display_voronoi(LCC_2& alcc, Dart_handle adart)
+{
+  // We remove the infinite face plus all the faces adjacent to it.
+  // Indeed, we cannot view these faces since they do not have
+  // a "correct geometry". 
+  std::stack<Dart_handle> toremove;
+  LCC_2::size_type mark_toremove=alcc.get_new_mark();
+
+  // adart belongs to the infinite face.
+  toremove.push(adart);
+  CGAL::mark_cell<LCC_2,2>(alcc, adart, mark_toremove);
+
+  // Now we get all the faces adjacent to the infinite face.
+  for (LCC_2::Dart_of_cell_range<2>::iterator
+         it=alcc.darts_of_cell<2>(adart).begin(),
+         itend=alcc.darts_of_cell<2>(adart).end(); it!=itend; ++it)
+  {
+    if ( !alcc.is_marked(alcc.beta(it,2), mark_toremove) )
+    {
+      CGAL::mark_cell<LCC_2,2>(alcc, alcc.beta(it,2), mark_toremove);
+      toremove.push(alcc.beta(it,2));
+    }    
+  }
+  
+  while( !toremove.empty() )
+  {
+    alcc.remove_cell<2>(toremove.top());
+    toremove.pop();
+  }
+
+  CGAL_assertion(alcc.is_without_boundary(1));
+    
+  std::cout<<"Voronoi subdvision, only finite faces:"<<std::endl<<"  ";
+  alcc.display_characteristics(std::cout) << ", valid=" 
+                                          << alcc.is_valid()
+                                          << std::endl;
+  
+#ifdef CGAL_LCC_USE_VIEWER
+  display_lcc(alcc);
+#endif // CGAL_LCC_USE_VIEWER
+}
+
+template<typename LCC, typename TR>
+void transform_dart_to_their_dual(LCC& alcc, LCC& adual,
+                                  std::map<typename TR::Face_handle,
+                                           typename LCC::Dart_handle>& assoc)
+{
+  typename LCC::Dart_range::iterator it1=alcc.darts().begin();
+  typename LCC::Dart_range::iterator it2=adual.darts().begin();
+
+  std::map<typename LCC::Dart_handle, typename LCC::Dart_handle> dual;
+  
+  for ( ; it1!=alcc.darts().end(); ++it1, ++it2 )
+  {
+    dual[it1]=it2;
+  }
+
+  for ( typename std::map<typename TR::Face_handle, typename LCC::Dart_handle>
+          ::iterator it=assoc.begin(), itend=assoc.end(); it!=itend; ++it)
+  {
+    assoc[it->first]=dual[it->second];
+  } 
+}
+
+template<typename LCC, typename TR>
+void set_geometry_of_dual(LCC& alcc, TR& tr,
+                          std::map<typename TR::Face_handle,
+                                   typename LCC::Dart_handle>& assoc)
+{
+  for ( typename std::map<typename TR::Face_handle, typename LCC::Dart_handle>
+          ::iterator it=assoc.begin(), itend=assoc.end(); it!=itend; ++it)
+  {
+    if ( !tr.is_infinite(it->first) )
+      alcc.set_vertex_attribute
+        (it->second,alcc.create_vertex_attribute(tr.circumcenter(it->first)));
+    else
+      alcc.set_vertex_attribute(it->second,alcc.create_vertex_attribute());
+  }
+}
+
+int main(int narg, char** argv)
+{
+  if (narg>1 && (!strcmp(argv[1],"-h") || !strcmp(argv[1],"-?")) )
+  {
+    std::cout<<"Usage : voronoi_2 filename"<<std::endl   
+             <<"   filename being a fine containing 2D points used to "
+             <<" compute the Delaunay_triangulation_2."<<std::endl;
+    return EXIT_FAILURE;
+  }
+
+  std::string filename;
+  if ( narg==1 )
+  {
+    filename=std::string("data/points_2");
+    std::cout<<"No filename given: use data/points_2 by default."<<std::endl;
+  }
+  else
+    filename=std::string(argv[1]);
+  
+  // 1) Compute the Delaunay_triangulation_2.
+  Triangulation T;
+
+  std::ifstream iFile(filename.c_str());
+  if (!iFile)
+  {
+    std::cout << "Problem reading file " << filename << std::endl;
+    return EXIT_FAILURE;
+  }
+  
+  std::istream_iterator<Point> begin(iFile), end;
+  T.insert(begin, end);
+  CGAL_assertion(T.is_valid(false));
+ 
+  // 2) Convert the triangulation into a 2D lcc.
+  LCC_2 lcc;
+  std::map<Triangulation::Face_handle,
+           LCC_2::Dart_handle > face_to_dart;
+  
+  Dart_handle dh=CGAL::import_from_triangulation_2<LCC_2, Triangulation>
+    (lcc, T, &face_to_dart);
+  CGAL_assertion(lcc.is_without_boundary());
+
+  std::cout<<"Delaunay triangulation :"<<std::endl<<"  ";
+  lcc.display_characteristics(std::cout) << ", valid=" 
+                                         << lcc.is_valid() << std::endl;
+
+  // 3) Compute the dual lcc.
+  LCC_2 dual_lcc;
+  Dart_handle ddh=lcc.dual(dual_lcc, dh);
+  // Here, dual_lcc is the 2D Voronoi diagram.
+  CGAL_assertion(dual_lcc.is_without_boundary());
+
+  // 4) We update the geometry of dual_lcc by using the std::map
+  //    face_to_dart.
+  transform_dart_to_their_dual<LCC_2,Triangulation>
+    (lcc, dual_lcc, face_to_dart);
+  set_geometry_of_dual<LCC_2,Triangulation>(dual_lcc, T, face_to_dart);
+  
+  // 5) Display the dual_lcc characteristics.
+  std::cout<<"Voronoi subdvision :"<<std::endl<<"  ";
+  dual_lcc.display_characteristics(std::cout) << ", valid=" 
+                                              << dual_lcc.is_valid()
+                                              << std::endl;
+
+  display_voronoi(dual_lcc, ddh);
+
+  return EXIT_SUCCESS;
+}
+
diff --git a/3rdparty/CGAL/examples/Linear_cell_complex/voronoi_3.cpp b/3rdparty/CGAL/examples/Linear_cell_complex/voronoi_3.cpp
new file mode 100644
index 0000000..df4780d
--- /dev/null
+++ b/3rdparty/CGAL/examples/Linear_cell_complex/voronoi_3.cpp
@@ -0,0 +1,173 @@
+#include <CGAL/Linear_cell_complex.h>
+#include <CGAL/Linear_cell_complex_constructors.h>
+#include <CGAL/Linear_cell_complex_operations.h>
+#include <CGAL/Delaunay_triangulation_3.h>
+#include <iostream>
+#include <fstream>
+
+/* If you want to use a viewer, you can use one qglviewer. */
+#ifdef CGAL_LCC_USE_QT
+#include "linear_cell_complex_3_viewer_qt.h"
+#endif
+
+/* // If you want to use exact constructions.
+#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
+typedef CGAL::Linear_cell_complex<3,3,
+  CGAL::Linear_cell_complex_traits<3, CGAL::Exact_predicates_exact_constructions_kernel> > LCC_3;
+*/
+
+typedef CGAL::Linear_cell_complex<3> LCC_3;
+typedef LCC_3::Dart_handle           Dart_handle;
+typedef LCC_3::Point                 Point;
+
+typedef CGAL::Delaunay_triangulation_3<LCC_3::Traits> Triangulation;
+
+// Function used to display the voronoi diagram.
+void display_voronoi(LCC_3& alcc, Dart_handle adart)
+{
+  // We remove the infinite volume plus all the volumes adjacent to it.
+  // Indeed, we cannot view these volumes since they do not have
+  // a "correct geometry". 
+  std::stack<Dart_handle> toremove;
+  LCC_3::size_type mark_toremove=alcc.get_new_mark();
+
+  // adart belongs to the infinite volume.
+  toremove.push(adart);
+  CGAL::mark_cell<LCC_3,3>(alcc, adart, mark_toremove);
+ 
+  // Now we get all the volumes adjacent to the infinite volume.
+  for (LCC_3::Dart_of_cell_range<3>::iterator
+         it=alcc.darts_of_cell<3>(adart).begin(),
+         itend=alcc.darts_of_cell<3>(adart).end(); it!=itend; ++it)
+  {
+    if ( !alcc.is_marked(alcc.beta(it,3), mark_toremove) )
+    {
+      CGAL::mark_cell<LCC_3,3>(alcc, alcc.beta(it,3), mark_toremove);
+      toremove.push(alcc.beta(it,3));
+    }
+  }
+  
+  while( !toremove.empty() )
+  {
+    alcc.remove_cell<3>(toremove.top());
+    toremove.pop();
+  }
+
+  CGAL_assertion(alcc.is_without_boundary(1) && alcc.is_without_boundary(2));
+  
+  std::cout<<"Voronoi subdvision, only finite volumes:"<<std::endl<<"  ";
+  alcc.display_characteristics(std::cout) << ", valid=" 
+                                          << alcc.is_valid()
+                                          << std::endl;
+
+#ifdef CGAL_LCC_USE_VIEWER
+  display_lcc(alcc);
+#endif // CGAL_LCC_USE_VIEWER
+}
+
+template<typename LCC, typename TR>
+void transform_dart_to_their_dual(LCC& alcc, LCC& adual,
+                                  std::map<typename TR::Cell_handle,
+                                           typename LCC::Dart_handle>& assoc)
+{
+  typename LCC::Dart_range::iterator it1=alcc.darts().begin();
+  typename LCC::Dart_range::iterator it2=adual.darts().begin();
+
+  std::map<typename LCC::Dart_handle, typename LCC::Dart_handle> dual;
+  
+  for ( ; it1!=alcc.darts().end(); ++it1, ++it2 )
+  {
+    dual[it1]=it2;
+  }
+
+  for ( typename std::map<typename TR::Cell_handle, typename LCC::Dart_handle>
+          ::iterator it=assoc.begin(), itend=assoc.end(); it!=itend; ++it)
+  {
+    assoc[it->first]=dual[it->second];
+  }
+}
+
+template<typename LCC, typename TR>
+void set_geometry_of_dual(LCC& alcc, TR& tr,
+                          std::map<typename TR::Cell_handle,
+                                   typename LCC::Dart_handle>& assoc)
+{
+  for ( typename std::map<typename TR::Cell_handle, typename LCC::Dart_handle>
+          ::iterator it=assoc.begin(), itend=assoc.end(); it!=itend; ++it)
+  {
+    if ( !tr.is_infinite(it->first) )
+      alcc.set_vertex_attribute
+        (it->second,alcc.create_vertex_attribute(tr.dual(it->first)));
+    else
+      alcc.set_vertex_attribute(it->second,alcc.create_vertex_attribute());
+  }
+}
+
+
+int main(int narg, char** argv)
+{
+  if (narg>1 && (!strcmp(argv[1],"-h") || !strcmp(argv[1],"-?")) )
+  {
+    std::cout<<"Usage : voronoi_3 filename"<<std::endl   
+             <<"   filename being a fine containing 3D points used to "
+             <<" compute the Delaunay_triangulation_3."<<std::endl;
+    return EXIT_FAILURE;
+  }
+
+  std::string filename;
+  if ( narg==1 )
+  {
+    filename=std::string("data/points_3");
+    std::cout<<"No filename given: use data/points_3 by default."<<std::endl;
+  }
+  else
+    filename=std::string(argv[1]);
+  
+  // 1) Compute the Delaunay_triangulation_3.
+  Triangulation T;
+
+  std::ifstream iFile(filename.c_str());
+  if (!iFile)
+  {
+    std::cout << "Problem reading file " << filename << std::endl;
+    return EXIT_FAILURE;
+  }
+  
+  std::istream_iterator<Point> begin(iFile), end;
+  T.insert(begin, end);
+  CGAL_assertion(T.is_valid(false));
+ 
+  // 2) Convert the triangulation into a 3D lcc.
+  LCC_3 lcc;
+  std::map<Triangulation::Cell_handle,
+           LCC_3::Dart_handle > vol_to_dart;
+
+  Dart_handle dh=CGAL::import_from_triangulation_3<LCC_3, Triangulation>
+    (lcc, T, &vol_to_dart);
+
+  std::cout<<"Delaunay triangulation :"<<std::endl<<"  ";
+  lcc.display_characteristics(std::cout) << ", valid=" 
+                                         << lcc.is_valid() << std::endl;
+
+  // 3) Compute the dual lcc.
+  LCC_3 dual_lcc;
+  Dart_handle ddh=lcc.dual(dual_lcc, dh);
+  // Here, dual_lcc is the 3D Voronoi diagram.
+  CGAL_assertion(dual_lcc.is_without_boundary());
+
+  // 4) We update the geometry of dual_lcc by using the std::map
+  //    face_to_dart.
+  transform_dart_to_their_dual<LCC_3,Triangulation>
+    (lcc, dual_lcc, vol_to_dart);
+  set_geometry_of_dual<LCC_3,Triangulation>(dual_lcc, T, vol_to_dart);
+  
+  // 5) Display the dual_lcc characteristics.
+  std::cout<<"Voronoi subdvision :"<<std::endl<<"  ";
+  dual_lcc.display_characteristics(std::cout) << ", valid=" 
+                                              << dual_lcc.is_valid()
+                                              << std::endl;
+  display_voronoi(dual_lcc, ddh);
+
+  return EXIT_SUCCESS;
+}
+
diff --git a/3rdparty/CGAL/examples/Matrix_search/CMakeLists.txt b/3rdparty/CGAL/examples/Matrix_search/CMakeLists.txt
new file mode 100644
index 0000000..9051ffc
--- /dev/null
+++ b/3rdparty/CGAL/examples/Matrix_search/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Matrix_search_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL/examples/Matrix_search/sorted_matrix_search.cpp b/3rdparty/CGAL/examples/Matrix_search/sorted_matrix_search.cpp
new file mode 100644
index 0000000..4c1c587
--- /dev/null
+++ b/3rdparty/CGAL/examples/Matrix_search/sorted_matrix_search.cpp
@@ -0,0 +1,46 @@
+#include <CGAL/Random.h>
+#include <CGAL/Cartesian_matrix.h>
+#include <CGAL/sorted_matrix_search.h>
+#include <vector>
+#include <algorithm>
+#include <iterator>
+#include <functional>
+
+typedef int                                     Value;
+typedef std::vector<Value>                      Vector;
+typedef Vector::iterator                        Value_iterator;
+typedef std::vector<Vector>                     Vector_cont;
+typedef CGAL::Cartesian_matrix<std::plus<int>,
+                               Value_iterator,
+                               Value_iterator>  Matrix;
+
+int main()
+{
+  // set of vectors the matrices are build from:
+  Vector_cont vectors;
+
+  // generate a random vector and sort it:
+  Vector a;
+  const int n = 5;
+  for (int i = 0; i < n; ++i)
+    a.push_back(CGAL::get_default_random()(100));
+  std::sort(a.begin(), a.end());
+  std::cout << "a = ( ";
+  std::copy(a.begin(), a.end(), std::ostream_iterator<int>(std::cout," "));
+  std::cout << ")\n";
+
+  // build a Cartesian matrix from a:
+  Matrix M(a.begin(), a.end(), a.begin(), a.end());
+
+  // search for an upper bound for max(a):
+  Value bound = a[n-1];
+  Value upper_bound =
+  CGAL::sorted_matrix_search(
+    &M, &M + 1,
+    CGAL::sorted_matrix_search_traits_adaptor(
+      std::bind2nd(std::greater_equal<Value>(), bound), M));
+  std::cout << "Upper bound for " << bound << " is "
+            << upper_bound << "." << std::endl;
+
+  return 0;
+}
diff --git a/3rdparty/CGAL/examples/Mesh_2/CMakeLists.txt b/3rdparty/CGAL/examples/Mesh_2/CMakeLists.txt
new file mode 100644
index 0000000..177f587
--- /dev/null
+++ b/3rdparty/CGAL/examples/Mesh_2/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Mesh_2_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Mesh_2/conforming.cpp b/3rdparty/CGAL/examples/Mesh_2/conforming.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Mesh_2/conforming.cpp
rename to 3rdparty/CGAL/examples/Mesh_2/conforming.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Mesh_2/mesh_class.cpp b/3rdparty/CGAL/examples/Mesh_2/mesh_class.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Mesh_2/mesh_class.cpp
rename to 3rdparty/CGAL/examples/Mesh_2/mesh_class.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Mesh_2/mesh_global.cpp b/3rdparty/CGAL/examples/Mesh_2/mesh_global.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Mesh_2/mesh_global.cpp
rename to 3rdparty/CGAL/examples/Mesh_2/mesh_global.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Mesh_2/mesh_optimization.cpp b/3rdparty/CGAL/examples/Mesh_2/mesh_optimization.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Mesh_2/mesh_optimization.cpp
rename to 3rdparty/CGAL/examples/Mesh_2/mesh_optimization.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Mesh_2/mesh_with_seeds.cpp b/3rdparty/CGAL/examples/Mesh_2/mesh_with_seeds.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Mesh_2/mesh_with_seeds.cpp
rename to 3rdparty/CGAL/examples/Mesh_2/mesh_with_seeds.cpp
diff --git a/3rdparty/CGAL/examples/Mesh_3/CMakeLists.txt b/3rdparty/CGAL/examples/Mesh_3/CMakeLists.txt
new file mode 100644
index 0000000..286627a
--- /dev/null
+++ b/3rdparty/CGAL/examples/Mesh_3/CMakeLists.txt
@@ -0,0 +1,111 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Mesh_3_example )
+
+cmake_minimum_required(VERSION 2.8.11)
+
+
+include_directories(../../include)
+add_definitions(-DCGAL_MESH_3_NO_DEPRECATED_SURFACE_INDEX
+                -DCGAL_MESH_3_NO_DEPRECATED_C3T3_ITERATORS)
+
+if ( MESH_3_VERBOSE )
+  add_definitions(-DCGAL_MESH_3_VERBOSE)
+endif()
+
+find_package(CGAL COMPONENTS ImageIO)
+
+if ( CGAL_FOUND )
+  include( ${CGAL_USE_FILE} )
+  find_package(Boost)
+
+  # Activate concurrency ? (turned OFF by default)
+  option(ACTIVATE_CONCURRENT_MESH_3
+    "Activate parallelism in Mesh_3"
+    OFF)
+    
+  # And add -DCGAL_CONCURRENT_MESH_3 if that option is ON
+  if( ACTIVATE_CONCURRENT_MESH_3 OR ENV{ACTIVATE_CONCURRENT_MESH_3} )
+    add_definitions( -DCGAL_CONCURRENT_MESH_3 )
+    find_package( TBB REQUIRED )
+  else( ACTIVATE_CONCURRENT_MESH_3 OR ENV{ACTIVATE_CONCURRENT_MESH_3} )
+    option( LINK_WITH_TBB
+      "Link with TBB anyway so we can use TBB timers for profiling"
+      ON)
+    if( LINK_WITH_TBB )
+      find_package( TBB )
+    endif( LINK_WITH_TBB )
+  endif()
+  
+  if( TBB_FOUND )
+    include(${TBB_USE_FILE})
+    list(APPEND CGAL_3RD_PARTY_LIBRARIES ${TBB_LIBRARIES})
+  endif()
+
+
+ set(VTK_LIBS "")
+      find_package(VTK QUIET COMPONENTS vtkImagingGeneral  vtkIOImage NO_MODULE)
+      if(VTK_FOUND)
+          include(${VTK_USE_FILE})
+          if ("${VTK_VERSION_MAJOR}" GREATER "5")
+            message(STATUS "VTK found")
+            set( VTK_LIBS vtkImagingGeneral vtkIOImage )
+          else()
+            message(STATUS "VTK version 6.0 or greater is required")
+          endif()
+      else()
+        message(STATUS "VTK was not found")
+      endif()
+
+
+  if ( Boost_FOUND AND Boost_VERSION GREATER 103400 )
+    include( CGAL_CreateSingleSourceCGALProgram )
+
+    # Compilable examples
+    create_single_source_cgal_program( "mesh_implicit_sphere.cpp" )
+    create_single_source_cgal_program( "mesh_implicit_sphere_variable_size.cpp" )
+    create_single_source_cgal_program( "mesh_two_implicit_spheres_with_balls.cpp" )
+    create_single_source_cgal_program( "mesh_implicit_domains_2.cpp" "implicit_functions.cpp" )
+    create_single_source_cgal_program( "mesh_cubes_intersection.cpp" )
+    create_single_source_cgal_program( "mesh_cubes_intersection_with_features.cpp" )
+    create_single_source_cgal_program( "mesh_implicit_domains.cpp" "implicit_functions.cpp" )
+    create_single_source_cgal_program( "mesh_polyhedral_domain.cpp" )
+    create_single_source_cgal_program( "remesh_polyhedral_surface.cpp" )
+    create_single_source_cgal_program( "mesh_polyhedral_domain_with_features.cpp" )
+    if( WITH_CGAL_ImageIO )
+      if( VTK_FOUND AND "${VTK_VERSION_MAJOR}" GREATER "5" )
+        add_executable ( mesh_3D_gray_vtk_image mesh_3D_gray_vtk_image.cpp )
+        target_link_libraries(  mesh_3D_gray_vtk_image ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ${VTK_LIBS}) 
+      endif()
+ 
+      create_single_source_cgal_program( "mesh_3D_gray_image.cpp" )
+      create_single_source_cgal_program( "mesh_3D_image_with_features.cpp" )
+      if( CGAL_ImageIO_USE_ZLIB )
+        create_single_source_cgal_program( "mesh_optimization_example.cpp" )
+
+        create_single_source_cgal_program( "mesh_optimization_lloyd_example.cpp" )
+
+        create_single_source_cgal_program( "mesh_3D_image.cpp" )
+        create_single_source_cgal_program( "mesh_3D_image_with_custom_initialization.cpp" )
+
+        create_single_source_cgal_program( "mesh_3D_image_variable_size.cpp" )
+      else()
+        message( STATUS "NOTICE: The examples mesh_3D_image.cpp, mesh_3D_image_variable_size.cpp, mesh_optimization_example.cpp and mesh_optimization_lloyd_example.cpp need CGAL_ImageIO to be configured with ZLIB support, and will not be compiled." )
+      endif()
+    else()
+      message( STATUS "NOTICE: Some examples need the CGAL_ImageIO library, and will not be compiled." )
+    endif()
+#    create_single_source_cgal_program( "mesh_polyhedral_implicit_function.cpp" )
+#    create_single_source_cgal_program( "mesh_polyhedral_surface_tolerance_region.cpp" )
+#    create_single_source_cgal_program( "mesh_polyhedral_edge_tolerance_region.cpp" )
+
+  else()
+    message(STATUS "NOTICE: This program requires Boost >= 1.34.1, and will not be compiled.")
+  endif()
+
+else()
+  message(STATUS "This program requires the CGAL library, and will not be compiled.")
+endif()
+
diff --git a/3rdparty/CGAL/examples/Mesh_3/data/40420.inr b/3rdparty/CGAL/examples/Mesh_3/data/40420.inr
new file mode 100644
index 0000000..213f4c3
Binary files /dev/null and b/3rdparty/CGAL/examples/Mesh_3/data/40420.inr differ
diff --git a/3rdparty/CGAL/examples/Mesh_3/data/420.inr b/3rdparty/CGAL/examples/Mesh_3/data/420.inr
new file mode 100644
index 0000000..a93a585
Binary files /dev/null and b/3rdparty/CGAL/examples/Mesh_3/data/420.inr differ
diff --git a/3rdparty/CGAL/examples/Mesh_3/data/420.polylines.txt b/3rdparty/CGAL/examples/Mesh_3/data/420.polylines.txt
new file mode 100644
index 0000000..dba3284
--- /dev/null
+++ b/3rdparty/CGAL/examples/Mesh_3/data/420.polylines.txt
@@ -0,0 +1,2 @@
+2    0 50 66.66  100 50 66.66
+2   10 50 83.33   90 50 83.33
diff --git a/3rdparty/CGAL-4.8/examples/Mesh_3/data/cheese.off b/3rdparty/CGAL/examples/Mesh_3/data/cheese.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Mesh_3/data/cheese.off
rename to 3rdparty/CGAL/examples/Mesh_3/data/cheese.off
diff --git a/3rdparty/CGAL-4.8/examples/Mesh_3/data/elephant.off b/3rdparty/CGAL/examples/Mesh_3/data/elephant.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Mesh_3/data/elephant.off
rename to 3rdparty/CGAL/examples/Mesh_3/data/elephant.off
diff --git a/3rdparty/CGAL-4.8/examples/Mesh_3/data/fandisk.off b/3rdparty/CGAL/examples/Mesh_3/data/fandisk.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Mesh_3/data/fandisk.off
rename to 3rdparty/CGAL/examples/Mesh_3/data/fandisk.off
diff --git a/3rdparty/CGAL/examples/Mesh_3/data/lion-head.off b/3rdparty/CGAL/examples/Mesh_3/data/lion-head.off
new file mode 100644
index 0000000..cfc9720
--- /dev/null
+++ b/3rdparty/CGAL/examples/Mesh_3/data/lion-head.off
@@ -0,0 +1,25034 @@
+OFF
+8356 16674 0
+
+-0.129196 -0.0867173 -0.355149
+-0.123586 -0.0127199 -0.385597
+-0.138255 -0.0985078 -0.384018
+-0.13078 -0.00785323 -0.424428
+0.0829628 0.304391 -0.447733
+0.00415408 0.25548 -0.452543
+-0.0835553 0.142304 -0.441354
+-0.13802 -0.194313 -0.342651
+-0.112552 0.0476781 -0.406977
+0.0942435 0.286566 -0.5
+-0.00409265 0.241643 -0.494408
+-0.0263135 -0.445533 -0.234542
+-0.102793 -0.353023 -0.283116
+-0.0968905 0.12463 -0.474207
+0.0239682 -0.436553 -0.180089
+0.0180463 -0.388639 -0.158817
+0.0160266 -0.358517 -0.14373
+0.00328791 -0.435762 -0.194202
+-0.0105681 -0.38599 -0.181451
+0.0179439 -0.460717 -0.19959
+0.0616607 -0.463409 -0.178507
+0.0640995 -0.47353 -0.201658
+0.135362 0.320559 -0.429273
+0.324656 -0.0802425 -0.207708
+0.336193 -0.00556118 -0.235131
+0.348999 -0.0967885 -0.229872
+0.365465 -0.00601372 -0.267279
+0.190993 0.307907 -0.410233
+0.260886 0.262686 -0.365392
+0.331929 0.15014 -0.304442
+0.325186 -0.193527 -0.197888
+0.338281 0.0557576 -0.258792
+0.220134 0.284699 -0.465099
+0.299227 0.243122 -0.39963
+0.16358 -0.451491 -0.187265
+0.25907 -0.356582 -0.17833
+0.365231 0.126726 -0.32759
+0.101458 -0.438525 -0.160995
+0.105917 -0.388384 -0.133202
+0.0995122 -0.356011 -0.115142
+0.125027 -0.439286 -0.164627
+0.138284 -0.386232 -0.138575
+0.109357 -0.464379 -0.179055
+0.0596785 -0.387427 -0.135358
+0.156798 0.293446 -0.486162
+0.00979273 -0.312487 -0.094606
+0.00792729 -0.23533 -0.0744635
+0.00242719 -0.153589 -0.0438178
+-0.121854 -0.0293198 -0.277581
+-0.123295 -0.0773948 -0.255776
+-0.130989 0.0217762 -0.316089
+0.0203731 0.400135 -0.268696
+0.0489405 0.373677 -0.327912
+0.0590199 0.335762 -0.386218
+-0.00560043 0.283052 -0.397245
+-0.0809233 0.173779 -0.385899
+-0.166668 0.0984389 -0.23239
+-0.158929 0.12374 -0.24799
+-0.106369 0.240866 -0.280368
+-0.0241423 -0.216311 -0.0855252
+-0.0259149 -0.207835 -0.0815588
+-0.0279899 -0.315753 -0.1183
+-0.0298075 -0.309642 -0.113587
+-0.0509574 -0.196355 -0.096524
+-0.0493261 -0.205332 -0.100203
+-0.0852098 -0.181561 -0.120752
+-0.0600273 -0.155223 -0.0853238
+-0.0581585 -0.17888 -0.0942169
+-0.0923931 -0.156245 -0.117072
+-0.0914635 -0.126752 -0.105141
+-0.0456328 -0.302464 -0.141061
+-0.0255163 -0.322782 -0.163191
+-0.0603829 -0.280433 -0.181621
+-0.113469 -0.144848 -0.23609
+-0.14054 -0.00781501 -0.214287
+-0.144729 -0.0352329 -0.195986
+-0.157026 -0.0151341 -0.158598
+-0.155441 0.0102859 -0.17642
+-0.154165 0.151262 -0.250044
+-0.0847102 0.269523 -0.287809
+-0.0564971 0.313532 -0.292005
+-0.117126 0.0837959 -0.350539
+-0.112072 -0.164109 -0.16295
+-0.0943193 -0.205944 -0.205269
+-0.0707804 -0.103684 -0.0671431
+-0.0663383 -0.12252 -0.0714309
+-0.0938831 -0.100201 -0.0893386
+-0.0382481 -0.136451 -0.0565469
+-0.0994385 0.176093 -0.334379
+-0.121343 0.134635 -0.313217
+-0.0361281 0.284231 -0.3513
+-0.0726971 0.227396 -0.343625
+0.0251176 0.354449 -0.340521
+-0.00379846 0.327425 -0.348683
+-0.136515 0.097899 -0.295281
+-0.146186 0.0678792 -0.274979
+-0.0214885 -0.325642 -0.126316
+0.00440799 -0.342623 -0.136691
+-0.0286226 0.354436 -0.288281
+-0.00248658 0.381845 -0.279804
+-0.148995 0.0419595 -0.251814
+-0.140909 0.0159723 -0.233521
+-0.120289 -0.128183 -0.149877
+-0.131777 -0.0969243 -0.195605
+-0.140712 -0.0630562 -0.1643
+-0.119933 -0.0951974 -0.129962
+-0.120591 -0.0762276 -0.112177
+-0.146318 -0.0435349 -0.137329
+-0.158711 0.0338302 -0.19431
+-0.168784 0.0554211 -0.208802
+-0.175084 0.0799612 -0.216183
+-0.1388 0.173053 -0.265438
+-0.120279 0.204729 -0.281127
+-0.0286554 -0.19392 -0.0770798
+-0.0316074 -0.173664 -0.0706248
+-0.0592867 -0.13866 -0.0723694
+-0.0573667 -0.14535 -0.076615
+-0.0855497 -0.11456 -0.0927528
+-0.0360612 -0.153888 -0.0598116
+-0.0337418 -0.161048 -0.0645261
+-0.0521635 -0.295137 -0.13244
+-0.0787671 -0.255686 -0.155815
+-0.0555388 -0.28771 -0.127245
+-0.0907693 -0.198929 -0.133895
+-0.056321 -0.224329 -0.111203
+-0.0601304 -0.261133 -0.122781
+-0.0883667 -0.227003 -0.150154
+-0.0255886 -0.241626 -0.0939398
+-0.0292021 -0.283824 -0.105675
+0.00604 -0.209613 -0.0637814
+0.0446649 0.412548 -0.248378
+0.0492326 -0.363275 -0.117673
+0.0158088 -0.33285 -0.106809
+0.00458205 -0.176344 -0.0543662
+0.104222 0.352879 -0.368106
+0.262734 -0.0106954 -0.142712
+0.253116 -0.0599205 -0.125179
+0.292123 0.0417493 -0.168302
+0.0787248 0.406047 -0.245692
+0.108216 0.379069 -0.304057
+0.152573 0.342704 -0.34901
+0.217786 0.297336 -0.311981
+0.28532 0.191803 -0.25495
+0.237875 0.122132 -0.100729
+0.239537 0.148745 -0.113645
+0.206079 0.266394 -0.161261
+0.0428302 -0.214613 -0.068975
+0.0429435 -0.206018 -0.0646599
+0.0547655 -0.314754 -0.0971779
+0.0546235 -0.308482 -0.0920819
+0.0729503 -0.192911 -0.0658516
+0.0726404 -0.202102 -0.0698433
+0.114955 -0.176021 -0.0701061
+0.0771221 -0.150783 -0.0521362
+0.0785316 -0.174862 -0.0606396
+0.120203 -0.149618 -0.0635384
+0.113937 -0.119637 -0.054616
+0.0995471 -0.29991 -0.101387
+0.135856 -0.317874 -0.108627
+0.166203 -0.273174 -0.105293
+0.237408 -0.1305 -0.115058
+0.215829 0.00800271 -0.10069
+0.209394 -0.0202718 -0.0874807
+0.19229 0.000428991 -0.0599406
+0.199356 0.0275165 -0.0713101
+0.233561 0.177369 -0.117199
+0.19147 0.293213 -0.180126
+0.166273 0.334272 -0.204174
+0.299176 0.10311 -0.203976
+0.168007 -0.15627 -0.0835314
+0.204144 -0.194245 -0.104052
+0.081311 -0.0974785 -0.0316375
+0.0776545 -0.117177 -0.0374331
+0.111921 -0.091588 -0.0403197
+0.0452669 -0.133541 -0.0369458
+0.256431 0.199958 -0.200422
+0.262082 0.158398 -0.173405
+0.201235 0.304178 -0.256724
+0.234008 0.250468 -0.22485
+0.137502 0.364559 -0.295348
+0.168792 0.342462 -0.279409
+0.264357 0.119779 -0.155051
+0.259478 0.088724 -0.137203
+0.0638872 -0.324241 -0.103115
+0.0928354 -0.33939 -0.106214
+0.13618 0.370621 -0.223118
+0.106648 0.392736 -0.236684
+0.246553 0.0616549 -0.121471
+0.228379 0.0335565 -0.1126
+0.162028 -0.119591 -0.0732254
+0.205452 -0.0852259 -0.0933958
+0.18539 -0.0504131 -0.071577
+0.150907 -0.0848934 -0.0600621
+0.144834 -0.0647346 -0.0471883
+0.175599 -0.0293601 -0.0524359
+0.211463 0.0532396 -0.0804988
+0.228172 0.0766413 -0.0850835
+0.236069 0.103089 -0.0869838
+0.229247 0.199185 -0.134347
+0.222071 0.231517 -0.153711
+0.0449318 -0.191771 -0.0591816
+0.0450423 -0.17128 -0.0521819
+0.0714623 -0.13405 -0.0412323
+0.0714978 -0.140932 -0.0457918
+0.104698 -0.107246 -0.0469494
+0.0433243 -0.151381 -0.0410022
+0.0441045 -0.158558 -0.0459925
+0.0886301 -0.293621 -0.0971956
+0.135363 -0.252382 -0.0984727
+0.0886179 -0.285819 -0.091215
+0.126673 -0.193603 -0.0775323
+0.0824905 -0.221123 -0.0761925
+0.0899912 -0.258488 -0.0846426
+0.138199 -0.22238 -0.0895612
+0.0473228 -0.239967 -0.0756915
+0.0525382 -0.28239 -0.0849027
+0.0733005 0.38763 -0.307184
+0.00545982 -0.10681 -0.00186818
+-0.011065 -0.168376 0.0547095
+-0.0106207 -0.27103 0.0743284
+-0.0402234 -0.2743 0.223556
+-0.0404528 -0.264041 0.222446
+-0.0443659 -0.231584 0.234952
+-0.0455495 -0.218929 0.238109
+-0.0416527 -0.092762 0.190798
+-0.0565865 -0.035209 0.253042
+-0.0713715 -0.192085 0.361731
+-0.0720527 -0.204327 0.367876
+-0.0793957 -0.195685 0.40281
+-0.0904574 -0.162209 0.450956
+-0.0825758 0.299848 0.309759
+-0.00901598 0.447257 -0.122169
+-0.0980905 -0.119111 0.130953
+-0.101359 -0.115158 0.137666
+-0.0943705 -0.154414 0.148235
+-0.0904935 -0.156457 0.140829
+-0.0938633 -0.1885 0.160607
+-0.0902069 -0.190335 0.154889
+-0.0935323 -0.209687 0.170223
+-0.0898615 -0.211938 0.166025
+-0.0965192 -0.221443 0.179892
+-0.0920634 -0.223757 0.176256
+-0.0966892 -0.231763 0.190518
+-0.0910921 -0.233896 0.187953
+-0.0874957 -0.23803 0.201731
+-0.0807889 -0.238204 0.19928
+-0.0930211 -0.235583 0.195475
+-0.0812987 -0.238314 0.206372
+-0.0607276 -0.236941 0.212391
+-0.0585339 -0.236638 0.205793
+-0.107932 -0.102001 0.127186
+-0.118729 -0.0809912 0.130419
+-0.106459 -0.105742 0.154798
+-0.090742 -0.219383 0.221499
+-0.10097 -0.218378 0.20609
+-0.0931364 -0.20893 0.201413
+-0.0968612 -0.209512 0.178263
+-0.101479 -0.209253 0.189731
+-0.100957 -0.221336 0.188779
+-0.0644299 -0.23613 0.221001
+-0.067057 -0.232819 0.228891
+-0.0851443 -0.236857 0.213227
+-0.0881633 -0.232524 0.219785
+-0.092718 -0.236474 0.205186
+-0.0969219 -0.232863 0.208161
+-0.101088 -0.23 0.197674
+-0.0976318 -0.188797 0.17279
+-0.100662 -0.14981 0.168676
+-0.102797 -0.188023 0.187354
+-0.0964776 -0.186386 0.197184
+-0.0717572 -0.186967 0.206536
+-0.0672366 -0.209394 0.212574
+-0.100268 -0.226517 0.210341
+-0.0907236 -0.226074 0.224197
+-0.10666 -0.0603594 0.157978
+-0.102481 -0.0935743 0.183332
+-0.110362 -0.097041 0.175105
+-0.117721 -0.0653107 0.149733
+-0.100002 -0.142411 0.199091
+-0.106467 -0.144471 0.189926
+-0.06793 -0.227217 0.235661
+-0.0682549 -0.219834 0.232329
+-0.0728657 -0.142687 0.206763
+-0.0759194 -0.0918467 0.189436
+-0.0833191 -0.0576401 0.164225
+-0.145724 -0.128848 0.478073
+-0.124095 -0.135039 0.490334
+-0.121074 -0.143067 0.486307
+-0.141923 -0.136418 0.475472
+-0.109988 -0.151099 0.47343
+-0.124422 -0.145871 0.463957
+-0.103619 -0.156869 0.46169
+-0.112424 -0.152482 0.458459
+-0.0999846 -0.161513 0.449131
+-0.113729 -0.157492 0.446274
+-0.110652 -0.176933 0.430583
+-0.164185 -0.130603 0.437198
+-0.164311 -0.126141 0.453386
+-0.15968 -0.131287 0.457755
+-0.160715 -0.134585 0.440732
+-0.161178 -0.124646 0.46142
+-0.14673 -0.134692 0.444822
+-0.143971 -0.138344 0.437635
+-0.156775 -0.133124 0.434127
+-0.157702 -0.131906 0.436999
+-0.161821 -0.128087 0.431819
+-0.16101 -0.137303 0.431312
+-0.145395 -0.146886 0.434899
+-0.116585 -0.148253 0.447589
+-0.114279 -0.146229 0.456079
+-0.122594 -0.14189 0.458344
+-0.150551 -0.137424 0.449215
+-0.160488 -0.118998 0.169891
+-0.156793 -0.112451 0.177928
+-0.154192 -0.105403 0.164651
+-0.149743 -0.101543 0.145744
+-0.135096 -0.0853323 0.114748
+-0.137955 -0.0838013 0.13436
+-0.12751 -0.0716408 0.126141
+-0.139438 -0.0808124 0.158999
+-0.143251 -0.104949 0.11558
+-0.145745 -0.101626 0.12995
+-0.150128 -0.106101 0.112824
+-0.153101 -0.101679 0.12645
+-0.144096 -0.115382 0.0982024
+-0.138637 -0.112999 0.104922
+-0.128308 -0.0892345 0.101956
+-0.137958 -0.218812 0.321727
+-0.138554 -0.1972 0.298556
+-0.150904 -0.213118 0.294282
+-0.152893 -0.219198 0.293972
+-0.140387 -0.224897 0.32173
+-0.159183 -0.220689 0.29755
+-0.145548 -0.226418 0.324382
+-0.176545 -0.170375 0.230169
+-0.174442 -0.192092 0.251893
+-0.167185 -0.192043 0.248213
+-0.169366 -0.171552 0.226937
+-0.163294 -0.185337 0.2514
+-0.164793 -0.164601 0.231416
+-0.143873 -0.164065 0.264957
+-0.143587 -0.136887 0.237771
+-0.161828 -0.139357 0.203796
+-0.16577 -0.145223 0.198451
+-0.173241 -0.14341 0.20212
+-0.114871 -0.215118 0.344733
+-0.0937453 -0.209124 0.361106
+-0.0936545 -0.203909 0.376371
+-0.117118 -0.213124 0.359797
+-0.119093 -0.182155 0.331485
+-0.11373 -0.204313 0.337794
+-0.0952257 -0.198055 0.354281
+-0.0998371 -0.171675 0.353017
+-0.127617 -0.119702 0.113292
+-0.10717 -0.118741 0.125509
+-0.121462 -0.138555 0.1183
+-0.096438 -0.158521 0.137786
+-0.0957609 -0.191234 0.15121
+-0.0953274 -0.21305 0.162781
+-0.0968072 -0.22583 0.17368
+-0.0971076 -0.235354 0.183229
+-0.0879728 -0.244767 0.19985
+-0.0945766 -0.240891 0.191269
+-0.0786517 -0.245186 0.203836
+-0.0594403 -0.242756 0.208351
+-0.0726568 -0.264266 0.213081
+-0.0997791 -0.258381 0.198142
+-0.109772 -0.239168 0.17155
+-0.113432 -0.16594 0.126635
+-0.112308 -0.192701 0.136973
+-0.111276 -0.215924 0.151261
+-0.120651 -0.0585752 0.149806
+-0.108997 -0.0535324 0.158703
+-0.0860623 -0.0488671 0.16561
+-0.15978 -0.203289 0.271267
+-0.123387 -0.143412 0.299206
+-0.10487 -0.126264 0.319516
+-0.140061 -0.104465 0.204902
+-0.123736 -0.107195 0.266126
+-0.122382 -0.0782753 0.229019
+-0.105438 -0.0822813 0.281286
+-0.101425 -0.0495196 0.243008
+-0.121857 -0.0635988 0.19836
+-0.140298 -0.0843215 0.18018
+-0.0966339 -0.0406599 0.209415
+-0.119272 -0.0575541 0.178838
+-0.0938203 -0.207321 0.378418
+-0.119214 -0.217272 0.359735
+-0.163068 -0.209893 0.269118
+-0.0922211 -0.0427595 0.190077
+-0.117268 -0.167021 0.117932
+-0.125746 -0.138681 0.109414
+-0.1164 -0.194953 0.128339
+-0.115063 -0.220733 0.144495
+-0.113955 -0.246316 0.165587
+-0.104317 -0.267971 0.195948
+-0.074125 -0.275387 0.213444
+-0.12388 -0.219698 0.360051
+-0.170103 -0.211084 0.273235
+-0.167957 -0.116198 0.173672
+-0.160286 -0.0947244 0.146512
+-0.126749 -0.143346 0.103184
+-0.1181 -0.170851 0.111678
+-0.116765 -0.198865 0.12353
+-0.11549 -0.225301 0.140102
+-0.11456 -0.251612 0.161322
+-0.104751 -0.274293 0.191335
+-0.0745734 -0.281825 0.209284
+-0.0981457 -0.20928 0.382087
+-0.278671 0.243501 0.0915276
+-0.286347 0.19225 0.110526
+-0.295997 0.191896 0.0622511
+-0.288379 0.223249 0.0641193
+-0.282011 0.128819 0.133754
+-0.261744 0.0578517 0.136085
+-0.251098 0.0330576 0.10206
+-0.279093 0.084602 0.0846829
+-0.248429 0.0214274 0.0829348
+-0.248841 0.00197977 0.0490149
+-0.281246 0.0445663 0.0266828
+-0.245098 -0.014128 0.0256221
+-0.275055 0.0185545 -0.00692051
+-0.2355 -0.0250989 -0.000853204
+-0.229105 -0.027954 -0.0338838
+-0.256811 0.0124715 -0.0513786
+-0.101836 -0.245241 0.113867
+-0.107753 -0.230944 0.123409
+-0.108368 -0.260513 0.144114
+-0.0999136 -0.270405 0.122074
+-0.0950408 -0.289436 0.170108
+-0.0819649 -0.303885 0.138326
+-0.0670796 -0.298447 0.189457
+-0.0561784 -0.31368 0.157086
+-0.0370407 -0.30387 0.0992535
+-0.0392822 -0.313027 0.123159
+-0.0420732 -0.270334 0.0685607
+-0.040762 -0.289264 0.0779364
+-0.046103 -0.188053 0.0600342
+-0.0455201 -0.206272 0.0661854
+-0.0462075 -0.156436 0.0366741
+-0.0467897 -0.172572 0.0513144
+-0.100062 0.424234 0.143069
+-0.0953657 0.430062 0.118231
+-0.0903195 0.436039 0.0875681
+-0.0863162 0.4382 0.0604928
+-0.110299 0.38936 0.222963
+-0.108433 0.406897 0.197145
+-0.0766293 0.441397 0.0102173
+-0.0588799 0.441992 -0.0752253
+-0.0394883 0.437419 -0.133764
+-0.0156191 0.42773 -0.190087
+-0.213779 -0.0373529 0.0719108
+-0.216174 -0.0269807 0.0916375
+-0.306037 0.113682 0.012336
+-0.299569 0.150875 0.064722
+-0.102379 -0.185543 0.07039
+-0.111671 -0.177463 0.0867722
+-0.106642 -0.193428 0.0963342
+-0.0973076 -0.195732 0.0818803
+-0.167693 -0.0864572 0.00656762
+-0.193604 -0.0645415 0.0205315
+-0.14841 -0.101994 0.0537867
+-0.143314 -0.104879 0.0259333
+-0.130155 -0.120673 0.0384187
+-0.133639 -0.132258 0.0692235
+-0.125299 -0.13671 0.043381
+-0.120759 -0.151879 0.0508803
+-0.118477 -0.15939 0.0795882
+-0.112394 -0.167032 0.0579626
+-0.10713 -0.176975 0.0646824
+-0.170981 -0.0778576 0.0987095
+-0.176063 -0.0700047 0.113074
+-0.209361 -0.048035 0.0516898
+-0.164365 -0.0867466 0.0823417
+-0.200986 0.112602 0.252292
+-0.20967 0.107947 0.283821
+-0.231181 0.112313 0.26859
+-0.221305 0.116702 0.236358
+-0.185689 0.1199 0.270401
+-0.195378 0.115501 0.296899
+-0.184103 0.124314 0.275061
+-0.194707 0.119539 0.301569
+-0.18548 0.129077 0.277624
+-0.197455 0.123097 0.304745
+-0.187824 0.134609 0.279749
+-0.200976 0.127557 0.307244
+-0.194862 0.144084 0.28045
+-0.208041 0.135983 0.308324
+-0.20626 0.153156 0.275805
+-0.217609 0.144074 0.305011
+-0.220317 0.157621 0.265023
+-0.230157 0.146876 0.295199
+-0.236001 0.152265 0.246155
+-0.246301 0.143003 0.273857
+-0.239182 0.135984 0.231448
+-0.248282 0.132124 0.257952
+-0.23526 0.1261 0.228662
+-0.244788 0.123821 0.258451
+-0.129624 0.259492 0.332046
+-0.134503 0.2008 0.357036
+-0.148738 0.23007 0.342002
+-0.169624 0.244933 0.319551
+-0.155238 0.274243 0.30737
+-0.196595 0.25286 0.289228
+-0.185453 0.283358 0.274174
+-0.242969 0.236646 0.23743
+-0.238631 0.265262 0.218951
+-0.277183 0.17966 0.198304
+-0.277104 0.193938 0.183545
+-0.282402 0.127094 0.167842
+-0.163755 0.0291062 0.372754
+-0.158495 0.0294031 0.39599
+-0.164893 0.0111862 0.381739
+-0.174371 -0.0047073 0.347476
+-0.175817 0.0174712 0.334336
+-0.196393 -0.0298802 0.283908
+-0.199622 -0.00165624 0.267203
+-0.166255 0.204465 0.345581
+-0.16241 0.175567 0.35266
+-0.179143 0.1882 0.342804
+-0.194148 0.200721 0.326657
+-0.183071 0.217241 0.326822
+-0.215536 0.208288 0.302161
+-0.206516 0.224873 0.29918
+-0.250511 0.191807 0.257707
+-0.247473 0.207478 0.249571
+-0.271584 0.149926 0.22617
+-0.275325 0.161826 0.210333
+-0.271511 0.114134 0.216678
+-0.276435 0.116644 0.194862
+-0.262205 0.0859405 0.21859
+-0.263617 0.0754986 0.195702
+-0.23662 0.0501797 0.23883
+-0.233094 0.0372724 0.218076
+-0.214721 0.0329286 0.262291
+-0.212593 0.0166788 0.241585
+-0.199179 0.0225591 0.284462
+-0.275063 0.217702 0.158677
+-0.266509 0.0681618 0.167347
+-0.234106 0.0221311 0.187586
+-0.229596 0.00730718 0.152792
+-0.211556 -0.00334081 0.211085
+-0.20325 -0.024159 0.175793
+-0.200949 -0.0240075 0.226616
+-0.19014 -0.0485845 0.188626
+-0.201598 -0.0555562 0.242555
+-0.193973 -0.0831857 0.206084
+-0.207678 -0.0884496 0.267401
+-0.198711 -0.114785 0.22902
+-0.211232 -0.1213 0.293337
+-0.200684 -0.14536 0.252954
+-0.208718 -0.151526 0.315539
+-0.199167 -0.174701 0.276221
+-0.201422 -0.179398 0.336252
+-0.193537 -0.200973 0.299245
+-0.185208 -0.19566 0.351426
+-0.177882 -0.213069 0.320203
+-0.164122 -0.207235 0.365118
+-0.157357 -0.219853 0.341355
+-0.134804 -0.212856 0.381577
+-0.129332 -0.218014 0.368723
+-0.103512 -0.201397 0.398703
+-0.104187 0.419123 0.161707
+-0.127038 0.417015 0.132911
+-0.130314 0.412215 0.151177
+-0.154066 0.402772 0.138583
+-0.150899 0.407866 0.11814
+-0.174631 0.400414 0.107743
+-0.177338 0.397245 0.131782
+-0.200628 0.396063 0.131145
+-0.199678 0.398257 0.110475
+-0.223698 0.397138 0.112206
+-0.223741 0.395908 0.131523
+-0.247521 0.397058 0.132724
+-0.248303 0.398247 0.115088
+-0.278099 0.409908 0.124779
+-0.274843 0.406747 0.139883
+-0.303926 0.423519 0.152078
+-0.310918 0.430444 0.140221
+-0.329698 0.441075 0.149141
+-0.320588 0.432162 0.159007
+-0.323949 0.430233 0.158922
+-0.333176 0.438955 0.149645
+-0.327195 0.428634 0.144139
+-0.319335 0.421588 0.152886
+-0.308541 0.405009 0.134583
+-0.303442 0.158169 -0.01211
+-0.300935 0.172666 0.0235102
+-0.309237 0.10199 -0.0192162
+-0.298066 0.0638964 -0.0288601
+-0.197201 -0.0611566 -0.0151406
+-0.135122 -0.10259 -0.0403443
+-0.146484 -0.0993795 -0.0239539
+-0.119634 -0.11571 -0.014699
+-0.110446 -0.118106 -0.0276418
+-0.091372 -0.126545 -0.0168777
+-0.0995436 -0.125423 -0.00643247
+-0.079176 -0.129642 -0.00273776
+-0.0421537 -0.125287 0.00338961
+-0.192699 0.342467 0.0110507
+-0.216347 0.346138 0.0195636
+-0.234565 0.314772 -0.00040203
+-0.216401 0.306405 -0.00792319
+-0.237705 0.272272 -0.022414
+-0.251683 0.281777 -0.0168347
+-0.264259 0.240566 -0.0344858
+-0.255619 0.378516 0.0635391
+-0.229651 0.374033 0.0549586
+-0.225509 0.390016 0.0863954
+-0.250927 0.392106 0.0917761
+-0.246631 0.393707 0.149402
+-0.224085 0.392023 0.149647
+-0.224421 0.386101 0.167186
+-0.2459 0.388132 0.165301
+-0.246403 0.37777 0.178077
+-0.227002 0.373832 0.181298
+-0.231398 0.356876 0.191248
+-0.248914 0.36461 0.186752
+-0.115174 0.427891 0.0855777
+-0.119921 0.423003 0.113641
+-0.140635 0.41471 0.098801
+-0.269288 0.254716 0.119438
+-0.260786 0.269176 0.149244
+-0.23342 0.297447 0.207501
+-0.199638 0.310339 0.242251
+-0.16659 0.314629 0.264837
+-0.143649 0.309431 0.287818
+-0.122347 0.304079 0.302412
+-0.0998938 0.301844 0.306996
+-0.106738 0.255693 0.336933
+-0.204491 0.160708 0.330262
+-0.219821 0.148276 0.317509
+-0.216102 0.169172 0.321368
+-0.204216 0.185564 0.324242
+-0.189801 0.173461 0.337653
+-0.184143 0.130645 0.331629
+-0.195339 0.146644 0.331827
+-0.179344 0.155527 0.342473
+-0.168887 0.134074 0.345842
+-0.155762 0.145061 0.359483
+-0.111756 0.204524 0.360432
+-0.176681 -0.121942 0.405053
+-0.176302 -0.0983625 0.397827
+-0.168014 -0.109421 0.416613
+-0.183831 -0.171209 0.381893
+-0.16579 -0.18709 0.388699
+-0.170891 -0.138486 0.412396
+-0.163125 -0.15641 0.418705
+-0.165406 -0.12349 0.423997
+-0.163684 -0.117563 0.42596
+-0.165107 -0.117709 0.431213
+-0.164509 -0.112807 0.447663
+-0.162258 -0.110111 0.456619
+-0.157902 -0.110412 0.46389
+-0.147424 -0.114313 0.475761
+-0.126327 -0.120364 0.489291
+-0.094333 0.336152 0.2827
+-0.116967 0.337289 0.277852
+-0.13683 0.155567 0.370119
+-0.115886 0.155282 0.377111
+-0.116166 0.109066 0.390941
+-0.137689 0.111655 0.382779
+-0.11728 0.0738619 0.40701
+-0.138777 0.0755137 0.397602
+-0.121702 0.0390832 0.422515
+-0.146458 0.0379051 0.412104
+-0.123955 0.0019122 0.440252
+-0.148427 -0.00107811 0.430303
+-0.126493 -0.0354104 0.457523
+-0.151064 -0.0381672 0.446478
+-0.127254 -0.0706729 0.473723
+-0.150792 -0.0692409 0.459239
+-0.128032 -0.100605 0.484524
+-0.151761 -0.0954977 0.46761
+-0.161053 -0.0949278 0.454313
+-0.161345 -0.0725384 0.446224
+-0.161755 -0.044382 0.433953
+-0.159717 -0.00719251 0.41625
+-0.152935 0.0698682 0.383284
+-0.152401 0.108182 0.368491
+-0.162928 0.101934 0.348797
+-0.166835 -0.0541092 0.417617
+-0.167525 -0.0820656 0.421695
+-0.169262 -0.0879343 0.408611
+-0.174735 -0.0690914 0.387206
+-0.165985 -0.0780562 0.433308
+-0.204647 -0.125919 0.357028
+-0.207488 -0.0968799 0.337583
+-0.202954 -0.0624535 0.310168
+-0.175378 -0.031343 0.364552
+-0.165757 -0.0159375 0.398413
+-0.159694 0.0631661 0.363665
+-0.172323 0.0601232 0.333345
+-0.253465 0.114906 0.262744
+-0.23883 0.0858115 0.267312
+-0.25884 0.109758 0.25163
+-0.262698 0.1342 0.252671
+-0.256932 0.13178 0.263777
+-0.253976 0.162762 0.273919
+-0.252888 0.147233 0.281028
+-0.231245 0.172642 0.306451
+-0.235507 0.151239 0.305702
+-0.209212 0.137079 0.320024
+-0.197103 0.125736 0.318354
+-0.179887 0.113743 0.324474
+-0.194086 0.105984 0.308392
+-0.18138 0.0969188 0.318126
+-0.195322 0.08157 0.305502
+-0.215147 0.0783852 0.287182
+-0.213616 0.09737 0.291231
+-0.235976 0.101451 0.274931
+-0.264328 0.297286 0.108006
+-0.272362 0.287529 0.0870712
+-0.076303 -0.13574 0.00891837
+-0.104299 -0.142544 0.0264097
+-0.0813424 -0.140773 0.0113428
+-0.067199 -0.160554 0.0318388
+-0.0637384 -0.159304 0.0342886
+-0.065337 -0.143706 0.0152123
+-0.0703129 -0.146439 0.0148068
+-0.0906164 -0.176412 0.053143
+-0.0710924 -0.171178 0.0477221
+-0.0730827 -0.170489 0.0442717
+-0.166448 -0.0326487 -0.106176
+-0.185719 -0.0411555 -0.0949643
+-0.167023 -0.0392279 -0.105418
+-0.136246 -0.0662499 -0.090469
+-0.129319 -0.0678464 -0.0885912
+-0.148731 -0.0435281 -0.103838
+-0.151522 -0.0473183 -0.102836
+-0.132781 -0.0907376 -0.066354
+-0.121399 -0.0852293 -0.074183
+-0.130755 -0.0804145 -0.0790258
+-0.188085 0.152358 -0.185972
+-0.192377 0.133095 -0.179866
+-0.141602 0.27007 -0.203651
+-0.128463 0.290891 -0.205143
+-0.16976 0.0179142 -0.141827
+-0.165528 -0.00893782 -0.132303
+-0.173194 -0.0167921 -0.108437
+-0.179378 0.00835218 -0.112584
+-0.198389 -0.00305549 -0.0954353
+-0.192499 -0.0265971 -0.0944108
+-0.178057 0.193783 -0.181291
+-0.18677 0.173251 -0.179388
+-0.202913 0.18154 -0.141539
+-0.193784 0.203422 -0.140975
+-0.211373 0.206902 -0.110109
+-0.221453 0.183858 -0.114361
+-0.231168 0.204377 -0.088596
+-0.258771 0.189741 -0.0768784
+-0.241347 0.182978 -0.0937576
+-0.142565 0.383423 -0.014869
+-0.155994 0.362039 -0.0204783
+-0.146985 0.35078 -0.0837013
+-0.126888 0.376871 -0.0907188
+-0.140976 0.340773 -0.125079
+-0.131472 0.334536 -0.152824
+-0.113914 0.366354 -0.146123
+-0.0873585 0.352868 -0.209497
+-0.110558 0.315226 -0.209964
+-0.206933 -0.0434967 -0.0821478
+-0.222487 -0.0330316 -0.0716446
+-0.212631 -0.0478241 -0.0784463
+-0.186453 -0.0708272 -0.0464675
+-0.196407 -0.0568265 -0.072166
+-0.202167 -0.0584537 -0.0708835
+-0.190927 -0.0678533 -0.0364407
+-0.208184 -0.0538123 -0.0669267
+-0.22052 -0.0364376 -0.0581032
+-0.206612 0.169507 -0.142929
+-0.226258 0.169218 -0.12013
+-0.210086 0.166824 -0.142251
+-0.207019 0.145838 -0.148881
+-0.203179 0.144665 -0.15213
+-0.200768 0.159777 -0.153382
+-0.205026 0.159524 -0.149378
+-0.23151 0.108625 -0.127355
+-0.212667 0.128164 -0.142966
+-0.21526 0.130354 -0.142563
+-0.230826 0.150443 -0.12033
+-0.233269 0.122511 -0.124076
+-0.217144 0.137899 -0.140438
+-0.214688 0.156343 -0.140103
+-0.248257 0.173206 -0.0974134
+-0.268778 0.178489 -0.0790729
+-0.256522 0.170092 -0.099102
+-0.267049 0.121911 -0.0937603
+-0.248516 0.154898 -0.101331
+-0.255931 0.15417 -0.102552
+-0.247783 0.137632 -0.103006
+-0.267854 0.104338 -0.0937357
+-0.249629 0.103768 -0.109719
+-0.251228 0.0830225 -0.111308
+-0.269611 0.0823523 -0.0958871
+-0.25682 0.0724189 -0.107957
+-0.23665 0.0300051 -0.0967854
+-0.227239 0.0283881 -0.0959581
+-0.240504 0.0612624 -0.107104
+-0.246525 0.0569398 -0.106036
+-0.23284 -0.0081167 -0.0716452
+-0.22108 0.00414828 -0.0856337
+-0.232901 0.00983062 -0.0868848
+-0.264099 0.0555808 -0.0872322
+-0.247908 0.0178466 -0.0778177
+-0.242936 0.025761 -0.0914027
+-0.253782 0.0543986 -0.100795
+-0.197494 -0.152558 0.373112
+-0.0528788 -0.313434 0.117761
+-0.0654141 -0.310639 0.111815
+-0.0609351 -0.304431 0.0950394
+-0.0496107 -0.306141 0.0983567
+-0.0540201 -0.294304 0.0809131
+-0.076043 -0.301183 0.105277
+-0.0849975 -0.284385 0.0979519
+-0.138857 -0.199157 0.396307
+-0.111199 -0.135544 0.0269121
+-0.0920641 -0.132927 0.00975383
+-0.105663 -0.125661 0.00537723
+-0.118423 -0.124414 0.0231833
+-0.108564 -0.204954 0.110709
+-0.10165 -0.209441 0.101137
+-0.101169 -0.22691 0.10748
+-0.0924211 -0.228665 0.0918129
+-0.0934299 -0.210341 0.0889578
+-0.0807752 -0.229094 0.079722
+-0.0655697 -0.227056 0.0718193
+-0.0660769 -0.208577 0.0679184
+-0.0816373 -0.210207 0.0774081
+-0.0458409 -0.227102 0.0694044
+-0.183542 -0.0580394 0.131929
+-0.219794 -0.0160269 0.112314
+-0.143916 -0.169941 0.42352
+-0.165958 -0.103452 0.42515
+-0.166986 -0.102581 0.417755
+-0.165053 -0.108361 0.42117
+-0.164692 -0.0982573 0.440648
+-0.221615 0.141654 0.313703
+-0.212059 0.133719 0.316118
+-0.251956 0.129249 0.264497
+-0.203691 0.125471 0.314019
+-0.234443 0.144164 0.304321
+-0.249314 0.141893 0.283974
+-0.247671 0.120654 0.265557
+-0.233861 0.109174 0.275576
+-0.212166 0.104923 0.290564
+-0.197679 0.112573 0.303415
+-0.197182 0.117003 0.307994
+-0.199618 0.120879 0.311199
+-0.191916 0.118964 0.313872
+-0.189354 0.113855 0.311009
+-0.182138 0.113762 0.31701
+-0.180494 0.108417 0.314407
+-0.215762 0.050996 0.279369
+-0.239272 0.0645578 0.256536
+-0.26242 0.104371 0.238549
+-0.266709 0.139517 0.241274
+-0.256006 0.299794 0.128817
+-0.252755 0.177882 0.264837
+-0.223996 0.19253 0.303407
+-0.194294 0.0466597 0.302702
+-0.350918 0.340884 0.00590622
+-0.345974 0.308985 -0.0147372
+-0.315465 0.323981 4.77794e-006
+-0.279326 0.0600522 -0.0629999
+-0.270771 0.356711 0.134173
+-0.267026 0.356096 0.159441
+-0.267897 0.349938 0.133638
+-0.215014 0.32579 0.217902
+-0.227171 0.319349 0.208295
+-0.213115 0.347942 0.19864
+-0.190016 0.36371 0.193613
+-0.206916 0.345939 0.204503
+-0.30219 0.371247 0.0431865
+-0.343426 0.391618 0.0526106
+-0.346385 0.365481 0.0270998
+-0.30791 0.348563 0.0209014
+-0.366806 0.401949 0.0588247
+-0.369143 0.399934 0.0614006
+-0.370302 0.371934 0.0352858
+-0.368006 0.374211 0.0322955
+-0.356476 0.390135 0.0607945
+-0.332699 0.373704 0.0570875
+-0.336877 0.345282 0.0320108
+-0.359013 0.362209 0.0352831
+-0.235786 0.323175 0.180818
+-0.242337 0.319953 0.149157
+-0.240349 0.327169 0.145553
+-0.236011 0.330013 0.176807
+-0.269873 0.203906 -0.0555306
+-0.243791 0.2484 -0.0349076
+-0.269227 0.217782 -0.0447557
+-0.333311 0.298375 0.000950128
+-0.333152 0.261402 -0.0209608
+-0.347734 0.28242 -0.0158498
+-0.292751 0.21492 -0.0430349
+-0.311172 0.22969 -0.0391723
+-0.3157 0.229879 -0.035025
+-0.297895 0.212835 -0.0363949
+-0.33003 0.249149 -0.035397
+-0.347793 0.275734 -0.0299468
+-0.350444 0.273791 -0.0253142
+-0.333696 0.24864 -0.0314477
+-0.252371 0.356414 0.1896
+-0.236308 0.345572 0.195597
+-0.240459 0.34132 0.192106
+-0.255769 0.352614 0.185623
+-0.35977 0.306269 -0.0156198
+-0.36618 0.342461 0.0071949
+-0.368233 0.340098 0.0106644
+-0.361927 0.304313 -0.0113981
+-0.366618 0.420005 0.0819417
+-0.364567 0.42194 0.0797998
+-0.359594 0.434177 0.0955479
+-0.361664 0.432271 0.0973983
+-0.284992 0.388979 0.176574
+-0.268788 0.370876 0.183319
+-0.271698 0.36761 0.178443
+-0.287808 0.387169 0.173615
+-0.350893 0.440998 0.113072
+-0.339734 0.444232 0.133619
+-0.342699 0.441785 0.13464
+-0.353447 0.438938 0.114624
+-0.310198 0.42048 0.165972
+-0.298515 0.406056 0.170779
+-0.301584 0.404542 0.169068
+-0.313593 0.418921 0.165059
+-0.284115 0.186735 -0.0575066
+-0.283077 0.203057 -0.0486272
+-0.289384 0.195364 -0.0448403
+-0.231352 0.333391 0.19754
+-0.225594 0.338314 0.201288
+-0.220617 0.334338 0.207084
+-0.22862 0.327964 0.202144
+-0.182712 0.306339 -0.0634285
+-0.163206 0.328124 -0.0799978
+-0.170536 0.3405 -0.0233587
+-0.176209 0.296847 -0.10175
+-0.163617 0.28991 -0.140181
+-0.148043 0.312629 -0.14611
+-0.158639 0.318632 -0.114684
+-0.191991 0.269703 -0.0937835
+-0.201928 0.235137 -0.103788
+-0.184568 0.23056 -0.140119
+-0.175559 0.262328 -0.138485
+-0.260005 0.341666 0.138192
+-0.257441 0.347875 0.16769
+-0.24356 0.338128 0.172572
+-0.247155 0.331246 0.141027
+-0.21337 0.357109 0.192542
+-0.208447 0.374099 0.182508
+-0.188407 0.373784 0.185305
+-0.31201 0.359177 0.058009
+-0.295277 0.331134 0.0590199
+-0.305073 0.308103 0.0327139
+-0.319552 0.326566 0.028325
+-0.361055 0.336601 0.0141011
+-0.34321 0.320588 0.0105511
+-0.356151 0.304816 -0.00559565
+-0.336674 0.285606 -0.0252576
+-0.319961 0.262326 -0.0299884
+-0.308953 0.297517 -0.0130301
+-0.341751 0.423499 0.0874397
+-0.346327 0.412174 0.0726288
+-0.303857 0.392296 0.0643916
+-0.102622 0.426901 0.0033507
+-0.124743 0.405609 -0.0079423
+-0.104866 0.40293 -0.0913549
+-0.0824243 0.42642 -0.0844999
+-0.131927 -0.111699 0.0150758
+-0.123308 -0.115383 -0.000950128
+-0.156057 -0.0947797 -0.00827335
+-0.0987867 -0.115601 -0.0391293
+-0.086104 -0.107933 -0.0491616
+-0.108332 -0.0953653 -0.0635391
+-0.120754 -0.102241 -0.0533648
+-0.0722602 -0.0959824 -0.0605256
+-0.100108 -0.0897792 -0.0698364
+-0.0740874 -0.10225 -0.0541313
+-0.102097 -0.0892591 -0.0818967
+-0.0403565 -0.109896 -0.0531887
+-0.271239 0.401238 0.153509
+-0.266918 0.39409 0.166085
+-0.287107 0.402536 0.169286
+-0.295974 0.413995 0.161552
+-0.290105 0.397326 0.07998
+-0.28306 0.406387 0.104267
+-0.319131 0.431281 0.122829
+-0.329335 0.4264 0.101223
+-0.27747 0.32977 0.0110145
+-0.254298 0.321669 0.00557791
+-0.239417 0.351068 0.0276295
+-0.265906 0.359492 0.0377171
+-0.301627 0.251399 -0.0310928
+-0.282867 0.239643 -0.0346387
+-0.26924 0.283985 -0.0151529
+-0.287771 0.292919 -0.0113858
+-0.292173 0.239199 0.0254296
+-0.29371 0.210413 0.0338319
+-0.297592 0.200506 -0.0076215
+-0.237469 0.312627 0.185747
+-0.247578 0.305412 0.151501
+-0.13739 0.33784 0.268493
+-0.152025 0.33789 0.256204
+-0.0615228 -0.285501 0.0749509
+-0.0761037 -0.283521 0.0840918
+-0.0687989 -0.297807 0.0906314
+-0.0897966 -0.266557 0.0939057
+-0.0916164 -0.247776 0.0933105
+-0.0643957 -0.247785 0.0719592
+-0.0796387 -0.248984 0.0798107
+-0.0781821 -0.267753 0.0802428
+-0.0626989 -0.268689 0.0706972
+-0.0897994 -0.184478 0.0601324
+-0.0848508 -0.195232 0.0705361
+-0.0679341 -0.192325 0.0620989
+-0.0706883 -0.178671 0.0546644
+-0.0833539 -0.150218 0.0203834
+-0.105777 -0.153339 0.0358789
+-0.0986454 -0.168199 0.0464907
+-0.0792155 -0.163743 0.035952
+-0.170583 -0.0815837 -0.0379061
+-0.15717 -0.0856634 -0.0552255
+-0.181954 -0.0649756 -0.0684624
+-0.224148 -0.0207823 -0.0731162
+-0.209078 -0.0306461 -0.0833266
+-0.214504 -0.00992481 -0.0830536
+-0.276444 0.123703 -0.0857565
+-0.263841 0.155513 -0.0965629
+-0.278265 0.161405 -0.0767631
+-0.0446874 -0.248343 0.069472
+-0.0460641 -0.140224 0.0166689
+-0.058669 -0.111299 -0.0343418
+-0.0771064 -0.122092 -0.0248057
+-0.0570302 -0.121811 -0.00922006
+-0.0284526 -0.107014 -0.017531
+-0.175039 -0.0576066 -0.0852303
+-0.151417 -0.0793333 -0.0719783
+-0.144323 -0.0699835 -0.0853791
+-0.160864 -0.0516663 -0.0973867
+-0.230018 0.0622194 -0.116153
+-0.214445 0.0311962 -0.104871
+-0.20161 0.0365823 -0.1217
+-0.217447 0.0594106 -0.130926
+-0.232285 0.0951073 -0.126987
+-0.216411 0.0901574 -0.14248
+-0.213028 0.11569 -0.144055
+-0.302372 0.108066 -0.0437775
+-0.286932 0.106186 -0.0710057
+-0.289663 0.152892 -0.061099
+-0.298275 0.158291 -0.0403217
+-0.0630866 0.386226 -0.205593
+-0.0393102 0.41166 -0.198106
+-0.168945 0.335858 0.244546
+-0.194432 0.332011 0.229134
+-0.187416 0.350844 0.213491
+-0.170194 0.372924 0.197212
+-0.148585 0.38035 0.208107
+-0.160929 0.356672 0.228135
+-0.146632 0.409284 0.0783965
+-0.139728 0.405896 0.0453024
+-0.118141 0.424507 0.0608703
+-0.161127 0.38837 0.178974
+-0.156358 0.397014 0.158609
+-0.133262 0.406831 0.169191
+-0.136148 0.398739 0.189474
+-0.1318 0.360301 0.249076
+-0.144087 0.358428 0.240635
+-0.131944 0.382281 0.220888
+-0.112713 0.363815 0.252894
+-0.106876 0.414042 0.178682
+-0.278912 0.389803 0.176
+-0.263051 0.384194 0.175544
+-0.264206 0.374147 0.182573
+-0.178978 0.391734 0.152356
+-0.181816 0.385126 0.171127
+-0.202929 0.385126 0.16927
+-0.201581 0.391462 0.150653
+-0.181906 0.371522 0.0419162
+-0.178639 0.390643 0.0765754
+-0.201067 0.390252 0.0821499
+-0.204944 0.371934 0.0476238
+-0.318746 0.251008 -0.0205138
+-0.320157 0.288783 0.00263811
+-0.307155 0.274776 0.00726725
+-0.304219 0.237056 -0.0184367
+-0.288575 0.385573 0.160376
+-0.275605 0.368696 0.161573
+-0.277262 0.36689 0.136523
+-0.289201 0.382631 0.136657
+-0.300503 0.400491 0.160305
+-0.300771 0.398099 0.142273
+-0.311674 0.413068 0.157282
+-0.34241 0.424472 0.108055
+-0.332668 0.427264 0.128603
+-0.313152 0.402696 0.116726
+-0.320751 0.398573 0.0942743
+-0.35236 0.422213 0.0940258
+-0.331859 0.395931 0.0779726
+-0.356959 0.410879 0.0797131
+-0.279803 0.274904 0.0677123
+-0.286418 0.258119 0.0492722
+-0.287435 0.349894 0.084917
+-0.302605 0.373755 0.0840044
+-0.295024 0.380603 0.111953
+-0.279854 0.360026 0.111755
+-0.223647 0.229852 -0.0776866
+-0.209267 0.266194 -0.0628982
+-0.226913 0.259652 -0.0422377
+-0.250422 0.216335 -0.0616402
+-0.151953 0.391101 0.0367089
+-0.161372 0.395426 0.0715353
+-0.165587 0.370548 0.026837
+-0.19515 0.298976 -0.0434492
+-0.184899 0.329051 -0.010607
+-0.206655 0.29725 -0.0228051
+-0.0441134 -0.0977297 -0.0489091
+-0.0433182 -0.102732 -0.0408596
+-0.151795 -0.0373946 -0.118132
+-0.128959 -0.066897 -0.0989717
+-0.193516 0.0659742 -0.16603
+-0.178418 0.0430148 -0.154265
+-0.203084 0.0899287 -0.167431
+-0.19984 0.117046 -0.169891
+-0.152055 0.243593 -0.203358
+-0.165194 0.2124 -0.194931
+-0.188588 0.0251862 -0.118442
+-0.201159 0.0134175 -0.10041
+-0.182548 0.0233228 -0.116735
+-0.208288 0.0586366 -0.139005
+-0.191595 0.039015 -0.130448
+-0.185469 0.0402907 -0.131931
+-0.20325 0.0616317 -0.141932
+-0.222806 0.072049 -0.1381
+-0.21899 0.0763048 -0.139562
+-0.234827 0.0804759 -0.125771
+-0.0628757 0.42164 -0.143164
+-0.0870152 0.397064 -0.149133
+0.00373499 -0.100244 -0.0365437
+0.0102439 -0.0952507 -0.021253
+-0.0128499 -0.204229 0.0708514
+-0.0120438 -0.29042 0.0857231
+-0.0202981 -0.311183 0.13169
+-0.0350872 -0.298183 0.203045
+-0.0394631 -0.236134 0.211362
+-0.0407804 -0.236291 0.21802
+-0.0459836 -0.226164 0.241857
+-0.0409326 -0.0427247 0.176191
+-0.0499281 -0.027208 0.217888
+-0.0868002 -0.173603 0.435105
+-0.100722 -0.137813 0.497064
+-0.10152 -0.104867 0.493839
+-0.100964 -0.0723684 0.4839
+-0.0990208 -0.0340241 0.465675
+-0.0949275 0.0401275 0.428882
+-0.0865545 0.25276 0.340047
+-0.0755918 0.365046 0.26036
+-0.0573865 0.436398 0.123452
+-0.0282165 0.450798 -0.0594847
+-0.00152416 -0.129515 0.0191097
+-0.0121599 -0.183426 0.0628067
+-0.0121742 -0.23858 0.075011
+-0.0286786 -0.313106 0.174168
+-0.0413838 -0.210497 0.215375
+-0.0410166 -0.190108 0.209047
+-0.0424295 -0.145285 0.206281
+-0.0630681 -0.0685454 0.292896
+-0.075112 -0.197813 0.381804
+-0.0932449 -0.157954 0.464007
+-0.096468 -0.151847 0.478835
+-0.101453 -0.124277 0.497731
+-0.0916252 0.106648 0.397683
+-0.089368 0.20284 0.365145
+-0.0711053 0.392945 0.231272
+-0.0676229 0.411281 0.206456
+-0.0606867 0.43041 0.14878
+-0.0499759 0.446662 0.0690604
+-0.0411415 0.450025 0.0117415
+0.0353909 -0.113253 0.157583
+0.0354912 -0.109153 0.164963
+0.0283264 -0.149029 0.172715
+0.027768 -0.151271 0.164426
+0.0259961 -0.183239 0.184517
+0.024975 -0.185284 0.177868
+0.0237962 -0.204538 0.19363
+0.0222202 -0.207021 0.188381
+0.023831 -0.216167 0.203909
+0.0213226 -0.218775 0.198878
+0.020795 -0.226609 0.213959
+0.0168054 -0.229161 0.209475
+0.00856821 -0.233812 0.220892
+0.00335616 -0.234513 0.216063
+0.0158341 -0.230804 0.217185
+0.0011119 -0.2347 0.222811
+-0.0202223 -0.23517 0.220471
+-0.0197493 -0.234939 0.213531
+0.0444424 -0.09531 0.157596
+0.0513752 -0.0735281 0.164358
+0.0328361 -0.0996293 0.182586
+0.0024231 -0.215294 0.240079
+0.0176456 -0.213183 0.229762
+0.0114316 -0.204349 0.222277
+0.0237675 -0.204212 0.202329
+0.0236051 -0.203774 0.214686
+0.0245027 -0.215828 0.213809
+-0.0201854 -0.234182 0.229823
+-0.0210584 -0.230806 0.238063
+0.00191254 -0.233034 0.230593
+0.0018163 -0.228583 0.237735
+0.0119182 -0.231878 0.226058
+0.0143441 -0.227981 0.230355
+0.0219519 -0.224601 0.222219
+0.0248235 -0.183425 0.197221
+0.0258964 -0.144254 0.193927
+0.0239354 -0.182469 0.212638
+0.0142246 -0.181529 0.219275
+-0.0120466 -0.184344 0.21845
+-0.0166313 -0.207179 0.222674
+0.0160552 -0.221409 0.233549
+0.00193302 -0.222008 0.242676
+0.0279878 -0.0544545 0.184829
+0.0172306 -0.0883145 0.207208
+0.0279175 -0.0909737 0.202683
+0.0417353 -0.0583213 0.181534
+0.0130342 -0.137445 0.221643
+0.0226577 -0.138812 0.215687
+-0.0233184 -0.225258 0.244554
+-0.0223731 -0.217821 0.241481
+-0.0148355 -0.140136 0.218344
+-0.00968762 -0.0889363 0.202654
+0.00388651 -0.053817 0.181625
+-0.0528004 -0.124775 0.496612
+-0.0768866 -0.132964 0.499754
+-0.0774443 -0.141156 0.495009
+-0.0546685 -0.132597 0.492883
+-0.0820352 -0.149877 0.479
+-0.0655711 -0.143297 0.475702
+-0.0829123 -0.155969 0.465821
+-0.0739441 -0.1508 0.466136
+-0.0810639 -0.160679 0.452905
+-0.0676652 -0.155473 0.455464
+-0.0628504 -0.17484 0.440117
+-0.0200394 -0.124276 0.465957
+-0.0264896 -0.120093 0.480882
+-0.0319822 -0.125689 0.483238
+-0.0242419 -0.128599 0.467955
+-0.0325712 -0.119011 0.487082
+-0.0386617 -0.129962 0.466388
+-0.0381491 -0.13371 0.458746
+-0.0254664 -0.127363 0.460323
+-0.0258173 -0.126123 0.463307
+-0.0203711 -0.121879 0.460046
+-0.0201383 -0.131113 0.459414
+-0.0350735 -0.142051 0.456901
+-0.0663219 -0.146044 0.457619
+-0.0718514 -0.144373 0.464544
+-0.065436 -0.139395 0.469758
+-0.0365997 -0.132429 0.471959
+0.0779146 -0.108836 0.217357
+0.0708876 -0.102745 0.223258
+0.0729653 -0.0956254 0.209917
+0.0757775 -0.0917252 0.190719
+0.0727954 -0.0762092 0.156222
+0.0677833 -0.0747765 0.175417
+0.0602976 -0.0634023 0.163605
+0.0594663 -0.0721247 0.198685
+0.0816298 -0.0950855 0.160442
+0.0781494 -0.0918235 0.174615
+0.08911 -0.0956083 0.160548
+0.0862562 -0.0911853 0.1742
+0.0899379 -0.105112 0.144897
+0.0821342 -0.103312 0.148967
+0.0717708 -0.0804561 0.141878
+0.00746929 -0.212623 0.350665
+0.015086 -0.190831 0.329068
+0.0294355 -0.205624 0.330088
+0.0318948 -0.211499 0.330666
+0.0102152 -0.218472 0.351704
+0.0364386 -0.21249 0.336409
+0.0140847 -0.219584 0.356163
+0.0740117 -0.160194 0.279832
+0.065582 -0.182338 0.299466
+0.0603085 -0.182849 0.293275
+0.0687368 -0.161921 0.274115
+0.0549497 -0.176528 0.294631
+0.0622265 -0.155413 0.276403
+0.0300778 -0.15699 0.299455
+0.0379212 -0.12944 0.273807
+0.0679164 -0.129855 0.249421
+0.0740888 -0.135305 0.246075
+0.0794094 -0.132944 0.252288
+-0.0228898 -0.211132 0.363064
+-0.049105 -0.207157 0.370009
+-0.0554671 -0.202236 0.383996
+-0.0267585 -0.209184 0.377812
+-0.0167214 -0.177771 0.351866
+-0.0222038 -0.200366 0.35603
+-0.0460675 -0.195893 0.364087
+-0.0435605 -0.169215 0.364237
+0.0693546 -0.111056 0.152597
+0.0457938 -0.112028 0.156033
+0.0633671 -0.13044 0.155177
+0.03458 -0.152774 0.163926
+0.031561 -0.185648 0.176619
+0.0285823 -0.207608 0.187511
+0.0268459 -0.220401 0.198349
+0.0242665 -0.230028 0.207437
+0.0102985 -0.240449 0.21945
+0.0193261 -0.235887 0.213996
+0.000226611 -0.241727 0.219574
+-0.0193773 -0.240996 0.216347
+-0.00722357 -0.261397 0.226142
+0.0229601 -0.25299 0.222627
+0.0407156 -0.232561 0.201572
+0.0550985 -0.158544 0.160258
+0.0523519 -0.185478 0.169826
+0.0479002 -0.208931 0.183016
+0.0438287 -0.0513653 0.182616
+0.0292813 -0.0474583 0.186293
+0.00514994 -0.0448632 0.183809
+0.0456102 -0.194906 0.311983
+-0.00365308 -0.138381 0.323022
+-0.0299229 -0.123019 0.334457
+0.0444936 -0.0966308 0.241654
+0.00627275 -0.101696 0.292017
+0.0167808 -0.0722612 0.256778
+-0.0184865 -0.0785033 0.298649
+-0.0102883 -0.045528 0.261202
+0.0267899 -0.0571015 0.228027
+0.0524632 -0.0759648 0.218618
+-0.00257668 -0.036542 0.228188
+0.0313692 -0.05094 0.208902
+-0.0558166 -0.20566 0.386
+-0.0244713 -0.21313 0.378633
+0.05001 -0.201178 0.311357
+0.000937842 -0.0386744 0.208662
+0.0620491 -0.15916 0.1537
+0.0707279 -0.130062 0.148607
+0.0596171 -0.187229 0.163449
+0.0543798 -0.213292 0.178298
+0.047447 -0.239231 0.197783
+0.0287803 -0.262131 0.222496
+-0.00507281 -0.272357 0.227223
+-0.0200851 -0.215164 0.380751
+0.0550091 -0.201816 0.317889
+0.0831062 -0.105493 0.223659
+0.0846092 -0.0840505 0.195348
+0.0744226 -0.134519 0.143318
+0.0655295 -0.162796 0.148313
+0.0621296 -0.191017 0.159226
+0.0568357 -0.217742 0.174481
+0.050081 -0.244391 0.194161
+0.0314764 -0.268312 0.218504
+-0.00251798 -0.278668 0.22366
+-0.0530788 -0.207306 0.391079
+0.187632 0.264763 0.186755
+0.19003 0.214108 0.205877
+0.217199 0.22022 0.166459
+0.208032 0.251025 0.164472
+0.18264 0.1492 0.226463
+0.169078 0.0767559 0.222045
+0.174401 0.051725 0.186961
+0.202725 0.106473 0.18105
+0.180405 0.0404722 0.168571
+0.196375 0.0230955 0.138343
+0.232396 0.0719596 0.130681
+0.204546 0.0085904 0.116268
+0.244626 0.0498513 0.0994413
+0.209694 0.000166887 0.0897632
+0.221572 0.00228147 0.0593072
+0.250753 0.0496793 0.0547272
+0.0560084 -0.23832 0.145348
+0.0565831 -0.223742 0.156189
+0.0517192 -0.253493 0.176041
+0.0532051 -0.263689 0.152619
+0.0319412 -0.283859 0.195432
+0.0332893 -0.298831 0.161321
+-0.000433428 -0.295518 0.202749
+0.003206 -0.31107 0.168935
+0.00690208 -0.301933 0.108022
+0.00059929 -0.311272 0.131111
+0.0204591 -0.267586 0.0810353
+0.0172572 -0.28671 0.0895134
+0.0205117 -0.185135 0.0733155
+0.0191561 -0.203436 0.0790831
+0.0291884 -0.152897 0.0517943
+0.0234126 -0.169475 0.0653302
+-0.0211868 0.429111 0.159255
+-0.019337 0.435272 0.133991
+-0.0167194 0.441834 0.103066
+-0.0128336 0.444518 0.076129
+-0.031561 0.39284 0.238681
+-0.0260623 0.410769 0.21366
+-0.00638606 0.44816 0.0258057
+0.00661745 0.448973 -0.0571865
+0.0226522 0.443567 -0.111643
+0.0445564 0.433604 -0.167203
+0.157672 -0.020882 0.146069
+0.151334 -0.0108435 0.164971
+0.254656 0.147648 0.127129
+0.223728 0.17783 0.170377
+0.0681055 -0.178063 0.104402
+0.0697081 -0.169503 0.122966
+0.0627699 -0.18599 0.130134
+0.059897 -0.188827 0.113247
+0.14938 -0.069619 0.070749
+0.164212 -0.0463948 0.0926825
+0.110237 -0.0903676 0.105468
+0.118243 -0.0923791 0.0784313
+0.101156 -0.110272 0.0846433
+0.0928306 -0.122318 0.114409
+0.0957834 -0.126907 0.0875189
+0.0896806 -0.142627 0.0928729
+0.0771904 -0.150803 0.118626
+0.0805151 -0.158571 0.0964448
+0.0739455 -0.169034 0.100812
+0.11131 -0.0654704 0.155022
+0.109835 -0.0574585 0.17011
+0.162726 -0.0311436 0.1261
+0.11229 -0.0745745 0.137547
+0.0641063 0.124231 0.305184
+0.0604137 0.119796 0.337712
+0.0856651 0.126221 0.331808
+0.0885475 0.130304 0.29818
+0.0424834 0.129919 0.31593
+0.0416268 0.125905 0.344194
+0.0388754 0.134097 0.319554
+0.0388952 0.12979 0.348186
+0.0387607 0.138913 0.322364
+0.0398972 0.133497 0.352111
+0.0396364 0.144588 0.325142
+0.0418015 0.138201 0.355699
+0.0450444 0.154607 0.328327
+0.0471781 0.147166 0.359273
+0.0565456 0.164687 0.328264
+0.0565654 0.156095 0.359752
+0.0732315 0.170498 0.323615
+0.0716309 0.16011 0.355454
+0.0953213 0.166796 0.312264
+0.0949752 0.157963 0.341968
+0.105258 0.151099 0.300179
+0.103808 0.147571 0.328207
+0.103542 0.140965 0.296263
+0.101091 0.138995 0.32747
+-0.0444342 0.263235 0.349048
+-0.0445645 0.204747 0.374984
+-0.0281837 0.235362 0.366057
+-0.00163337 0.252301 0.353075
+-0.0126643 0.2805 0.335816
+0.0341193 0.26298 0.335263
+0.0270725 0.292677 0.316576
+0.0979765 0.251607 0.305462
+0.0986529 0.280058 0.28624
+0.149219 0.198376 0.283386
+0.153597 0.212832 0.269481
+0.170105 0.146951 0.258128
+-0.00920982 0.0358827 0.403585
+-0.0229723 0.0353523 0.42303
+-0.0100985 0.0179825 0.412627
+0.0130731 0.003521 0.384878
+0.0175678 0.0259521 0.372918
+0.0597871 -0.0186439 0.335007
+0.0667642 0.0100272 0.320348
+-0.0112759 0.211269 0.376502
+-0.0150922 0.182035 0.382051
+0.00301352 0.196186 0.379152
+0.0219403 0.210195 0.369781
+0.0102876 0.225718 0.365409
+0.0503486 0.219941 0.355235
+0.0417988 0.235764 0.348727
+0.100929 0.207224 0.327833
+0.0999197 0.222719 0.318884
+0.135914 0.167813 0.307475
+0.144404 0.18025 0.294078
+0.142491 0.132303 0.299273
+0.155157 0.135586 0.280965
+0.135561 0.103398 0.297949
+0.146501 0.093504 0.27752
+0.107292 0.0652718 0.30745
+0.11308 0.0524533 0.287139
+0.0796264 0.0458433 0.321022
+0.0869606 0.0298174 0.301341
+0.0577182 0.0338295 0.335717
+0.159221 0.236777 0.24533
+0.160641 0.0869097 0.252562
+0.126956 0.0379693 0.259621
+0.137367 0.0234082 0.226009
+0.0993593 0.0103057 0.273115
+0.106979 -0.0105439 0.237686
+0.0854037 -0.0114462 0.283745
+0.092075 -0.0362322 0.244921
+0.0825635 -0.0431759 0.299216
+0.0918546 -0.0708668 0.263026
+0.0814387 -0.0760003 0.324986
+0.0901229 -0.102588 0.286457
+0.0775658 -0.108955 0.350821
+0.0853661 -0.133454 0.309766
+0.0692863 -0.139637 0.370875
+0.0775351 -0.163186 0.331157
+0.056977 -0.168271 0.387709
+0.0657424 -0.190058 0.350766
+0.0376229 -0.18599 0.395827
+0.0443154 -0.203598 0.364402
+0.0139509 -0.199457 0.40063
+0.0178913 -0.212281 0.376273
+-0.0188469 -0.207775 0.404706
+-0.0185391 -0.213172 0.390823
+-0.0551682 -0.199279 0.40835
+-0.0213813 0.423768 0.178545
+0.00823035 0.425449 0.160692
+0.00710616 0.420005 0.179143
+0.0339015 0.413808 0.17695
+0.0358789 0.419955 0.156633
+0.0622061 0.415925 0.156599
+0.0583216 0.411124 0.179905
+0.0802285 0.412433 0.18845
+0.0852794 0.41619 0.169036
+0.107153 0.417552 0.180058
+0.102012 0.414298 0.197801
+0.123706 0.417577 0.208117
+0.129432 0.420605 0.192264
+0.153003 0.434121 0.212456
+0.146087 0.428967 0.225037
+0.167861 0.447036 0.247084
+0.176572 0.456236 0.238861
+0.190742 0.467245 0.254017
+0.181071 0.455874 0.259631
+0.184535 0.454103 0.260863
+0.194133 0.465279 0.255846
+0.191548 0.454748 0.248682
+0.182991 0.445575 0.253709
+0.179394 0.430608 0.233247
+0.257014 0.197731 0.104618
+0.238884 0.206307 0.134328
+0.272261 0.141722 0.101413
+0.270957 0.10337 0.0895495
+0.185587 -0.0382758 0.0631385
+0.150667 -0.0823523 0.0190954
+0.149294 -0.0807592 0.0368243
+0.122298 -0.100776 0.0349172
+0.123409 -0.102209 0.0207827
+0.100656 -0.114109 0.0226925
+0.100219 -0.113585 0.0343848
+0.0803943 -0.120258 0.0298546
+0.0436595 -0.120317 0.0208919
+0.118671 0.369122 0.0772402
+0.136849 0.375258 0.0943036
+0.165857 0.348323 0.0845088
+0.153317 0.338287 0.0707627
+0.183744 0.308642 0.0675253
+0.192671 0.319775 0.0778634
+0.216985 0.281975 0.0692269
+0.154033 0.407583 0.148746
+0.133348 0.400911 0.130826
+0.117277 0.413298 0.157378
+0.139258 0.41744 0.172196
+0.118913 0.412148 0.223083
+0.0974959 0.40883 0.21465
+0.0937767 0.401128 0.231007
+0.114306 0.404927 0.23747
+0.111833 0.393604 0.249583
+0.0930579 0.388002 0.245189
+0.094877 0.371195 0.256346
+0.112073 0.380453 0.258771
+0.00864876 0.437334 0.111543
+0.00594171 0.431613 0.139727
+0.0306805 0.426842 0.134426
+0.169098 0.27373 0.206691
+0.146028 0.290737 0.23057
+0.0940756 0.311825 0.274741
+0.050066 0.321294 0.292065
+0.0106541 0.322412 0.300205
+-0.0188067 0.314905 0.312729
+-0.0435462 0.307535 0.318135
+-0.0657602 0.303342 0.313803
+-0.0670413 0.257443 0.344854
+0.0334401 0.171132 0.377766
+0.0534754 0.160248 0.372074
+0.046815 0.180693 0.37387
+0.0334005 0.195974 0.371684
+0.0160307 0.182484 0.378739
+0.0167262 0.139453 0.371718
+0.0256091 0.156329 0.375931
+0.00607822 0.163659 0.379474
+-0.00303058 0.141354 0.378931
+-0.0212482 0.150966 0.386314
+-0.0671096 0.206486 0.369348
+0.00304014 -0.114058 0.440911
+0.00347083 -0.0904802 0.433692
+-0.0104111 -0.102505 0.448051
+0.0226276 -0.162155 0.423074
+0.00476361 -0.179605 0.422723
+-0.00371451 -0.131146 0.445741
+-0.0117592 -0.149757 0.448891
+-0.0144567 -0.116859 0.454107
+-0.0172961 -0.111138 0.45517
+-0.0179883 -0.111251 0.460565
+-0.0252432 -0.1067 0.475445
+-0.0309686 -0.104355 0.482816
+-0.0377341 -0.105142 0.487872
+-0.0515827 -0.110103 0.494884
+-0.075671 -0.11814 0.499397
+-0.0644708 0.33746 0.288657
+-0.0418841 0.340582 0.292831
+-0.0436206 0.159655 0.388711
+-0.0655404 0.157486 0.387155
+-0.0666844 0.111237 0.40082
+-0.0439823 0.115767 0.40148
+-0.0688467 0.0759908 0.41668
+-0.0456095 0.0796063 0.416204
+-0.0677833 0.0414504 0.433277
+-0.0409354 0.0425343 0.433157
+-0.0693743 0.00430868 0.451137
+-0.0427994 0.00355786 0.45137
+-0.070506 -0.0329518 0.468692
+-0.0434458 -0.0334391 0.467951
+-0.0730302 -0.0682894 0.484534
+-0.0459556 -0.0646357 0.480144
+-0.0739346 -0.0982239 0.495314
+-0.0460655 -0.0908556 0.488691
+-0.0324709 -0.0892871 0.479967
+-0.0309904 -0.0668199 0.472233
+-0.0282875 -0.038529 0.460579
+-0.0265217 -0.00135045 0.442827
+-0.0266254 0.0754195 0.408485
+-0.0246876 0.113795 0.393972
+-0.0069403 0.108788 0.379923
+-0.0165378 -0.0475177 0.447598
+-0.0151099 -0.0753758 0.452107
+-0.00801261 -0.0808588 0.440782
+0.00363328 -0.0612652 0.422786
+-0.0213185 -0.0717118 0.462177
+0.0474784 -0.114913 0.407309
+0.0550972 -0.0854163 0.389945
+0.0585073 -0.0510178 0.362311
+0.00970263 -0.0232184 0.40148
+-0.0133953 -0.00924975 0.428812
+-0.0123435 0.0696423 0.393061
+0.0111394 0.0681802 0.369953
+0.108192 0.130784 0.334897
+0.095436 0.100487 0.334002
+0.117831 0.126287 0.326775
+0.118921 0.150942 0.328807
+0.109568 0.147862 0.336891
+0.100344 0.178301 0.344632
+0.0979389 0.162627 0.351032
+0.0661595 0.185675 0.365834
+0.072164 0.164731 0.367127
+0.0437011 0.148164 0.370505
+0.0341507 0.135881 0.364491
+0.0169822 0.122387 0.363754
+0.0368434 0.11611 0.354465
+0.0221922 0.105847 0.358746
+0.041147 0.0919471 0.352681
+0.0666646 0.090756 0.343404
+0.0621064 0.109466 0.34624
+0.0885694 0.115696 0.339687
+0.0702678 -0.127939 0.0385948
+0.0856781 -0.133553 0.0645152
+0.0742656 -0.132519 0.042839
+0.0505083 -0.155033 0.0554385
+0.0453788 -0.154324 0.0561231
+0.0574466 -0.137307 0.0400235
+0.0623569 -0.139537 0.0416179
+0.0631146 -0.169662 0.0838078
+0.0468573 -0.165988 0.0712582
+0.0501172 -0.165037 0.0688686
+0.206624 0.00282752 -0.0226652
+0.21861 -0.00501923 -0.00700651
+0.208352 -0.0032903 -0.0216045
+0.178669 -0.0371386 -0.0224768
+0.168452 -0.0419309 -0.023644
+0.189931 -0.0125452 -0.0277312
+0.195406 -0.0138393 -0.0256692
+0.163739 -0.0665618 -0.00369403
+0.157562 -0.0615464 -0.0146355
+0.169331 -0.0539522 -0.0149836
+0.221051 0.181093 -0.0636927
+0.223804 0.161914 -0.0576186
+0.176453 0.296993 -0.0993771
+0.163288 0.316509 -0.107447
+0.198498 0.0396832 -0.0445809
+0.192697 0.0111555 -0.0405265
+0.208502 0.0179149 -0.0218475
+0.210932 0.0437315 -0.0229846
+0.22366 0.0347169 -0.0034995
+0.221959 0.0104347 -0.00426261
+0.205153 0.22214 -0.0669171
+0.214255 0.202569 -0.0609522
+0.21194 0.22208 -0.0349841
+0.199763 0.242312 -0.0391389
+0.202648 0.247943 -0.0109415
+0.217564 0.227138 -0.00917843
+0.212801 0.246516 0.0132526
+0.235671 0.23463 0.0341834
+0.227691 0.227402 0.0141338
+0.073138 0.404442 0.0328088
+0.0917576 0.385834 0.0340381
+0.106112 0.377464 -0.0211021
+0.0853231 0.399669 -0.0358523
+0.118491 0.368666 -0.0537969
+0.125462 0.361465 -0.0764211
+0.101181 0.389129 -0.080739
+0.12378 0.372682 -0.133001
+0.148256 0.338541 -0.119875
+0.230353 -0.00725803 0.0105893
+0.236355 0.00272923 0.0248009
+0.233934 -0.0115357 0.0158703
+0.194768 -0.0441083 0.0327173
+0.217097 -0.0239597 0.0149741
+0.221656 -0.0250866 0.0182982
+0.19221 -0.0425725 0.0426479
+0.223678 -0.0208049 0.0236372
+0.227577 -0.0034036 0.0354878
+0.218306 0.212773 -0.03418
+0.226632 0.213527 -0.0108002
+0.22156 0.21106 -0.0321364
+0.225444 0.190143 -0.0368755
+0.223079 0.186622 -0.0400897
+0.218615 0.201015 -0.0421442
+0.22121 0.203206 -0.0384563
+0.245463 0.154559 -0.0131134
+0.231275 0.172505 -0.0305372
+0.233048 0.175465 -0.0292478
+0.234301 0.195158 -0.00927672
+0.243109 0.168281 -0.0103156
+0.232435 0.183158 -0.0272582
+0.226709 0.200894 -0.028796
+0.236804 0.218802 0.014598
+0.247381 0.224768 0.0368236
+0.245027 0.216592 0.0170962
+0.261145 0.168301 0.0247702
+0.241724 0.199944 0.0115319
+0.248675 0.200651 0.0142157
+0.245042 0.18284 0.00988147
+0.264902 0.150763 0.0253047
+0.25549 0.150228 0.00607481
+0.261242 0.130044 0.0058598
+0.271121 0.129343 0.0246125
+0.266712 0.11974 0.0103948
+0.251802 0.0730066 0.0104821
+0.243704 0.0701357 0.00718944
+0.254039 0.105949 0.00402234
+0.259622 0.10224 0.00713278
+0.241851 0.0288612 0.0282424
+0.237292 0.0427773 0.0122042
+0.24735 0.0506759 0.0165801
+0.267344 0.100559 0.0286731
+0.254768 0.0584489 0.0290417
+0.255453 0.0684055 0.0168634
+0.264234 0.0998354 0.0138117
+0.0369813 -0.142301 0.419879
+0.0152068 -0.310448 0.13134
+0.0287775 -0.306507 0.130608
+0.0305584 -0.300418 0.113297
+0.0190107 -0.303131 0.112047
+0.0287502 -0.290672 0.0974243
+0.0402542 -0.296085 0.128477
+0.0498844 -0.278472 0.124865
+-0.0219151 -0.194022 0.419631
+0.091316 -0.12591 0.0675601
+0.0835293 -0.123701 0.0452696
+0.0974946 -0.114773 0.046529
+0.0993942 -0.113687 0.0670086
+0.0599973 -0.197557 0.144342
+0.0576861 -0.202456 0.132912
+0.056293 -0.220009 0.138882
+0.0543805 -0.222228 0.121101
+0.0548576 -0.203837 0.118537
+0.0483248 -0.223434 0.105481
+0.0371881 -0.222538 0.0923214
+0.0375922 -0.204029 0.0886056
+0.0484176 -0.2045 0.103364
+0.0199711 -0.22421 0.0825314
+0.108484 -0.0452338 0.190189
+0.145808 1.67228e-005 0.185261
+-0.0301358 -0.164942 0.446213
+-0.0160791 -0.0968717 0.455058
+-0.0123735 -0.0957953 0.448605
+-0.0149768 -0.101772 0.451104
+-0.023616 -0.0920754 0.468801
+0.0571346 0.153864 0.369353
+0.0480934 0.145125 0.368052
+0.104926 0.144917 0.3357
+0.0418923 0.136232 0.36302
+0.0723073 0.157618 0.365564
+0.0939712 0.15695 0.352482
+0.101289 0.135972 0.335184
+0.0857238 0.1232 0.33934
+0.0603939 0.116878 0.344948
+0.0414985 0.12306 0.351138
+0.0389245 0.127362 0.35511
+0.0396146 0.131366 0.358934
+0.0316696 0.128782 0.358473
+0.0308286 0.12352 0.35494
+0.0219164 0.122721 0.357716
+0.0218359 0.117299 0.35477
+0.0725271 0.0636391 0.336891
+0.101746 0.0795183 0.324581
+0.126578 0.121443 0.316154
+0.126527 0.156773 0.319727
+0.101426 0.193416 0.335514
+0.0589789 0.204927 0.359906
+0.044211 0.0571288 0.350285
+0.263785 0.389637 0.137803
+0.271072 0.359377 0.119263
+0.236987 0.368384 0.118106
+0.269827 0.103391 0.0541307
+0.25523 0.230163 0.0675587
+0.249013 0.245828 0.0766307
+0.24883 0.243718 0.0825949
+0.25464 0.230737 0.0806284
+0.186082 0.369649 0.173364
+0.14953 0.372319 0.21862
+0.138345 0.373018 0.242426
+0.221084 0.341169 0.143421
+0.201258 0.360827 0.160985
+0.176028 0.369431 0.18221
+0.161582 0.372822 0.199935
+0.235139 0.31044 0.121238
+0.242698 0.27286 0.0953056
+0.0722193 0.338389 0.275207
+0.0876254 0.333156 0.271106
+0.075987 0.360636 0.256316
+0.0553074 0.374488 0.242561
+0.0682126 0.358017 0.259399
+0.204144 0.408729 0.149003
+0.236075 0.432972 0.173299
+0.249798 0.411199 0.152923
+0.220087 0.389388 0.13202
+0.254596 0.444688 0.187824
+0.256195 0.442741 0.191074
+0.268292 0.419222 0.169573
+0.266604 0.421295 0.166285
+0.246216 0.431403 0.185738
+0.228199 0.412187 0.173348
+0.243676 0.388146 0.153451
+0.259612 0.40806 0.165132
+0.104485 0.338737 0.252537
+0.106132 0.344979 0.249303
+0.245044 0.244612 0.0970878
+0.239912 0.259076 0.098515
+0.235738 0.247694 0.0549361
+0.197624 0.28686 0.0600567
+0.22906 0.260625 0.0630716
+0.257414 0.344106 0.126609
+0.27031 0.309541 0.109037
+0.278125 0.332282 0.119021
+0.24961 0.260995 0.0747345
+0.262221 0.277173 0.0852071
+0.264742 0.277636 0.0906089
+0.252672 0.26094 0.0805752
+0.274055 0.298677 0.0964339
+0.28304 0.32693 0.108672
+0.284591 0.325468 0.113043
+0.276028 0.298528 0.101267
+0.114836 0.372521 0.262854
+0.0986775 0.360266 0.262422
+0.104195 0.356441 0.260859
+0.119806 0.369093 0.260546
+0.284138 0.358484 0.124487
+0.277307 0.392226 0.145119
+0.278417 0.389773 0.148976
+0.28531 0.355762 0.128799
+0.245009 0.459756 0.208022
+0.243561 0.461686 0.205224
+0.232962 0.471117 0.217196
+0.234548 0.46923 0.219727
+0.147091 0.407935 0.262779
+0.131127 0.38842 0.263109
+0.135949 0.385507 0.259771
+0.150969 0.406421 0.261159
+0.219262 0.474627 0.229519
+0.20371 0.473417 0.243708
+0.206483 0.471081 0.245829
+0.221417 0.472638 0.231968
+0.171314 0.441949 0.262145
+0.160298 0.426201 0.262323
+0.1639 0.424991 0.26195
+0.174939 0.440682 0.262628
+0.251563 0.234477 0.0597802
+0.245108 0.248136 0.0661561
+0.248804 0.246563 0.0713572
+0.0944074 0.347684 0.262533
+0.0872616 0.35205 0.263703
+0.0807984 0.347562 0.267228
+0.0905823 0.341969 0.265837
+0.141134 0.338857 0.0101961
+0.124117 0.357849 -0.0107558
+0.110233 0.367221 0.0379437
+0.149769 0.330605 -0.0205984
+0.156166 0.322864 -0.0522857
+0.140663 0.342779 -0.0640115
+0.134371 0.349555 -0.0379908
+0.166805 0.306188 -0.00777098
+0.186304 0.274338 -0.0105811
+0.186213 0.267476 -0.0426397
+0.171508 0.297481 -0.0455993
+0.126552 0.363435 0.248047
+0.113731 0.353139 0.248048
+0.0777876 0.369889 0.250625
+0.0754751 0.386678 0.239194
+0.0559784 0.38461 0.234091
+0.211125 0.394818 0.166355
+0.203364 0.375011 0.159548
+0.222544 0.353794 0.141583
+0.232028 0.367374 0.143752
+0.271629 0.385339 0.148625
+0.2597 0.367166 0.138179
+0.278483 0.355026 0.130782
+0.270279 0.335383 0.107029
+0.260988 0.310118 0.0964161
+0.239629 0.342837 0.104994
+0.219758 0.460003 0.203184
+0.229713 0.451299 0.191904
+0.195827 0.427514 0.168252
+0.0219389 0.439036 0.0310314
+0.0502066 0.422663 0.0308955
+0.06126 0.420564 -0.046772
+0.0338865 0.438834 -0.0526734
+0.114538 -0.0991959 0.06478
+0.116466 -0.101985 0.0477801
+0.147813 -0.0773143 0.0536454
+0.120666 -0.0994491 0.00670345
+0.114243 -0.0925341 -0.00700446
+0.138773 -0.0760372 -0.0107401
+0.146711 -0.0816124 0.00278964
+0.0829109 -0.0888052 -0.0249743
+0.115848 -0.0783668 -0.020741
+0.101238 -0.0896448 -0.0164211
+0.117043 -0.0794329 -0.0306054
+0.0480094 -0.106363 -0.0326859
+0.139721 0.421486 0.236187
+0.133598 0.412055 0.246113
+0.150504 0.421901 0.256652
+0.159329 0.435329 0.252819
+0.177972 0.428779 0.176785
+0.163451 0.433858 0.195822
+0.188828 0.460014 0.226193
+0.204326 0.459425 0.210713
+0.198488 0.36794 0.111583
+0.180427 0.357567 0.0976557
+0.154529 0.382461 0.110656
+0.174333 0.393075 0.130029
+0.247138 0.296954 0.0876452
+0.233757 0.283754 0.0769412
+0.207452 0.324055 0.086577
+0.221193 0.335235 0.0973396
+0.226311 0.24327 0.137678
+0.244907 0.233192 0.106708
+0.107562 0.326815 0.254991
+-0.0195575 0.343004 0.292
+-0.00139857 0.344507 0.286257
+0.0371888 -0.281167 0.0946442
+0.0469412 -0.278128 0.108642
+0.0389177 -0.293081 0.11212
+0.0543586 -0.260228 0.122656
+0.0546842 -0.241353 0.122493
+0.037801 -0.243298 0.0923501
+0.0489234 -0.243346 0.105463
+0.0490005 -0.262177 0.105614
+0.0384747 -0.26425 0.0908826
+0.0603672 -0.177882 0.0900847
+0.0527355 -0.189191 0.0979942
+0.0401593 -0.187582 0.0836618
+0.0444192 -0.173613 0.0776252
+0.0705702 -0.142671 0.0513438
+0.0824516 -0.144898 0.0734882
+0.0724227 -0.160674 0.0806196
+0.05894 -0.157517 0.0635664
+0.176548 -0.0584264 0.0338374
+0.176465 -0.0607478 0.0145563
+0.20349 -0.0345141 0.0127093
+0.236772 0.015313 0.0238146
+0.230913 0.00599939 0.0101238
+0.232401 0.0273274 0.0118718
+0.266435 0.171107 0.0347411
+0.253184 0.202318 0.0219751
+0.257835 0.208742 0.0434779
+0.0206653 -0.245471 0.0825157
+0.0394221 -0.135727 0.0339609
+0.0821547 -0.10087 -0.00491036
+0.092774 -0.110438 0.010407
+0.0646749 -0.114164 0.0157938
+0.0449782 -0.101881 -0.00228454
+0.206732 -0.0246204 -0.00362782
+0.18182 -0.0516676 -0.00138492
+0.182936 -0.040692 -0.0151884
+0.201177 -0.0177811 -0.0180715
+0.248486 0.107256 -0.00564753
+0.236041 0.07261 -0.00430288
+0.230707 0.0783101 -0.0203383
+0.243833 0.104405 -0.0198858
+0.248454 0.141324 -0.0120547
+0.240049 0.132915 -0.0270964
+0.23338 0.158202 -0.0300068
+0.275381 0.152258 0.0787965
+0.272747 0.152574 0.0508059
+0.26378 0.200746 0.0600874
+0.263508 0.201366 0.0807943
+0.0974045 0.401583 -0.145373
+0.0701054 0.422299 -0.156641
+0.0187903 0.344102 0.282006
+0.0484606 0.342672 0.2776
+0.046417 0.361113 0.260149
+0.0348073 0.381984 0.238134
+0.0101231 0.387364 0.239787
+0.0159542 0.36444 0.263424
+0.0432295 0.423553 0.118131
+0.0473344 0.421639 0.0849928
+0.0188695 0.435904 0.0898936
+0.030974 0.397386 0.217486
+0.0312266 0.406931 0.196554
+0.00521546 0.414088 0.197186
+0.00306266 0.405286 0.217392
+-0.0191561 0.36524 0.271543
+-0.00446806 0.364556 0.268483
+-0.0102105 0.387657 0.245193
+-0.0384747 0.367074 0.2677
+-0.0226734 0.418319 0.19566
+0.141648 0.408263 0.259914
+0.127684 0.40136 0.253506
+0.126927 0.39131 0.260603
+0.0548863 0.404102 0.199672
+0.0531212 0.396268 0.218255
+0.0733011 0.398183 0.224672
+0.0762962 0.406148 0.206874
+0.0937616 0.393531 0.100011
+0.0763638 0.409409 0.129816
+0.0956448 0.411228 0.143847
+0.113133 0.396467 0.114402
+0.259229 0.297255 0.103301
+0.246803 0.332713 0.122551
+0.237931 0.321729 0.120092
+0.247943 0.282719 0.0966625
+0.156558 0.405441 0.249293
+0.145559 0.387562 0.245717
+0.154954 0.387857 0.22252
+0.164115 0.40537 0.227997
+0.166178 0.421413 0.253554
+0.171424 0.421426 0.237292
+0.175629 0.435775 0.254919
+0.215342 0.457365 0.221975
+0.200935 0.455914 0.236705
+0.188933 0.430994 0.218871
+0.202651 0.430814 0.201602
+0.228467 0.458336 0.213237
+0.217967 0.431599 0.191286
+0.238169 0.449615 0.202405
+0.184193 0.385565 0.178433
+0.191972 0.405519 0.185826
+0.176017 0.407796 0.207984
+0.167799 0.38804 0.199849
+0.197547 0.270206 0.0178832
+0.172719 0.303273 0.022612
+0.182932 0.297326 0.0467692
+0.218207 0.258977 0.0420473
+0.0642224 0.409325 0.0825901
+0.0615501 0.41212 0.118169
+0.0838099 0.39162 0.0797732
+0.147213 0.332114 0.0317269
+0.121341 0.356775 0.0550992
+0.151247 0.329508 0.054001
+0.0539785 -0.0930119 -0.0265886
+0.0695163 -0.094248 -0.0168552
+0.1774 -0.0195619 -0.0377717
+0.151232 -0.0522219 -0.033064
+0.224924 0.0918297 -0.047806
+0.208948 0.0666458 -0.0477849
+0.231827 0.118221 -0.0448294
+0.227116 0.145804 -0.048307
+0.18894 0.270962 -0.09349
+0.199236 0.240303 -0.0813881
+0.220361 0.0648104 -0.0233771
+0.22577 0.0524703 -0.00623794
+0.214568 0.0614563 -0.0248528
+0.23915 0.103071 -0.0283011
+0.225451 0.0806759 -0.0295925
+0.218589 0.0787422 -0.0325821
+0.23368 0.102934 -0.0316566
+0.24878 0.118556 -0.0217915
+0.244827 0.121624 -0.0242016
+0.252879 0.127208 -0.00969103
+0.0486101 0.432886 -0.104565
+0.0753406 0.413792 -0.0959145
+-0.00815663 -0.152769 0.0429837
+-0.0155085 -0.30195 0.105618
+-0.03933 -0.281278 0.220619
+-0.0397047 -0.24223 0.213913
+-0.0425878 -0.234869 0.226757
+-0.0399074 -0.0544156 0.173603
+-0.0459058 -0.0301806 0.198382
+-0.0689491 -0.117029 0.333072
+-0.072895 -0.164033 0.363213
+-0.0753795 -0.200657 0.383754
+-0.0761816 -0.20258 0.38822
+-0.0994331 -0.145336 0.492272
+-0.0969833 0.00347459 0.447241
+-0.0932627 0.0730544 0.41328
+-0.090957 0.153527 0.383965
+-0.0795507 0.332546 0.287354
+-0.0642408 0.421537 0.180081
+-0.0540133 0.442118 0.09764
+0.0158245 0.434863 -0.183569
+-0.268045 0.331387 0.116828
+0.129492 0.341991 0.235976
+0.153886 0.336223 0.214811
+0.2241 0.285672 0.136437
+0.184276 0.320951 0.181639
+-0.0105825 -0.330255 -0.148202
+-0.00405442 -0.341885 -0.154078
+0.0120356 -0.349759 -0.14071
+0.0235614 -0.454351 -0.19032
+0.0129291 -0.436292 -0.186957
+0.00782081 -0.45135 -0.199893
+0.0338708 -0.365198 -0.130484
+0.0240979 -0.356013 -0.127457
+0.00473289 -0.459483 -0.210535
+-0.00771569 -0.441567 -0.20746
+0.034649 -0.467895 -0.192908
+0.0385 -0.450965 -0.179008
+0.0366461 -0.371386 -0.135925
+0.0168607 -0.369086 -0.149775
+0.0358571 -0.388545 -0.147234
+0.0221533 -0.413997 -0.169207
+0.00325037 -0.384642 -0.167951
+-0.00317324 -0.417535 -0.189764
+-0.0202093 -0.352028 -0.175529
+-0.0751782 -0.310113 -0.222321
+-0.0792558 -0.24876 -0.200323
+-0.0975478 -0.261068 -0.242713
+-0.0448874 -0.305221 -0.175267
+-0.0680509 -0.409112 -0.256887
+-0.0225246 -0.408619 -0.205273
+0.0627596 -0.475512 -0.192706
+0.0176511 -0.466211 -0.215784
+0.0564097 -0.371642 -0.123731
+0.0608853 -0.42574 -0.15553
+-0.12601 -0.0168242 -0.405724
+-0.119212 0.0146946 -0.397278
+-0.119196 0.0236826 -0.419821
+-0.0894069 0.132379 -0.459627
+-0.119901 0.0557214 -0.450686
+-0.104047 0.0878087 -0.424826
+-0.0434008 0.202754 -0.449788
+0.00146546 0.247487 -0.474511
+-0.0553299 0.189606 -0.487411
+-0.140563 -0.140186 -0.365022
+-0.134203 -0.130246 -0.347604
+-0.134859 -0.0972574 -0.377609
+-0.104969 -0.178299 -0.225098
+-0.121706 -0.166999 -0.286771
+-0.125773 -0.273342 -0.313526
+0.0896205 0.294469 -0.474508
+0.0479494 0.271736 -0.499308
+0.0468477 0.286805 -0.452034
+0.146909 0.306616 -0.45808
+0.128239 0.292819 -0.494375
+0.110783 0.315899 -0.439113
+-0.126366 0.0488036 -0.336222
+-0.112981 0.0634555 -0.382132
+-0.124792 0.00267599 -0.355658
+-0.102922 0.123023 -0.372224
+-0.0809684 0.15658 -0.415696
+-0.123461 -0.0892618 -0.307009
+-0.118812 -0.111337 -0.253793
+-0.0449966 0.229617 -0.39744
+0.00110507 0.267771 -0.426435
+0.0303782 0.314349 -0.396623
+0.0722343 0.318351 -0.418398
+0.0837573 0.347392 -0.378263
+0.120496 0.336048 -0.399017
+-0.126853 -0.0477183 -0.375513
+-0.135946 -0.0568299 -0.403013
+-0.122431 -0.0575711 -0.319504
+-0.1262 -0.00837403 -0.300488
+-0.12139 -0.0556948 -0.272491
+0.120339 -0.337896 -0.111101
+0.114421 -0.325799 -0.105088
+0.100264 -0.346411 -0.109269
+0.113797 -0.43917 -0.162566
+0.102283 -0.457258 -0.172418
+0.120317 -0.455579 -0.174157
+0.0773057 -0.363684 -0.115208
+0.0743714 -0.354087 -0.109797
+0.125353 -0.464244 -0.182869
+0.138719 -0.446336 -0.172282
+0.0905632 -0.470164 -0.180447
+0.0853689 -0.452333 -0.167758
+0.103443 -0.367513 -0.122124
+0.0800694 -0.370325 -0.121511
+0.0857122 -0.388193 -0.132358
+0.103002 -0.414982 -0.147621
+0.13226 -0.420123 -0.154679
+0.122412 -0.384348 -0.13316
+0.143471 -0.34941 -0.1234
+0.193285 -0.239291 -0.107593
+0.206518 -0.30586 -0.131677
+0.235274 -0.254033 -0.13326
+0.153785 -0.29937 -0.108519
+0.154515 -0.41146 -0.157708
+0.213348 -0.414649 -0.180668
+0.113287 -0.469871 -0.193206
+0.338984 0.0219816 -0.247231
+0.35084 -0.013137 -0.252858
+0.352845 0.0280557 -0.268052
+0.349614 0.13694 -0.318172
+0.34091 0.0956452 -0.27876
+0.371179 0.0576954 -0.294963
+0.301038 0.210549 -0.334921
+0.337978 0.191723 -0.362962
+0.280404 0.251691 -0.384069
+0.325104 -0.125702 -0.20006
+0.340297 -0.138615 -0.213188
+0.342913 -0.09462 -0.225952
+0.29723 -0.274529 -0.18517
+0.279402 -0.157487 -0.152377
+0.226408 -0.165009 -0.110729
+0.206287 0.295429 -0.438122
+0.22412 0.292371 -0.391044
+0.25878 0.271361 -0.436145
+0.161752 0.317598 -0.421311
+0.186785 0.2914 -0.479087
+0.300411 0.0683932 -0.18678
+0.317218 0.0163477 -0.205563
+0.320967 0.0770003 -0.234672
+0.310108 0.169312 -0.28209
+0.299591 0.141544 -0.230116
+0.290754 -0.0762461 -0.165814
+0.252378 -0.0952943 -0.124446
+0.257292 0.245959 -0.286788
+0.239975 0.278538 -0.340479
+0.185319 0.324986 -0.336175
+0.172804 0.323879 -0.380522
+0.127013 0.350656 -0.360903
+0.35773 -0.0550484 -0.246742
+0.333913 -0.0415411 -0.225866
+0.29586 -0.0440277 -0.176799
+0.28097 0.0107978 -0.157889
+0.262261 -0.0377945 -0.138154
+-0.0398767 -0.234418 -0.10192
+-0.0232911 -0.225817 -0.0883305
+-0.0360455 -0.211471 -0.0924149
+-0.0528693 -0.212045 -0.105225
+-0.0587052 -0.276622 -0.12592
+-0.043067 -0.300029 -0.119746
+-0.0288328 -0.301339 -0.109832
+-0.0443816 -0.273812 -0.113294
+-0.0550412 -0.188967 -0.0962237
+-0.0379287 -0.202747 -0.0887318
+-0.0261394 -0.20275 -0.078963
+-0.0425988 -0.187362 -0.0850665
+-0.0591257 -0.148313 -0.0807336
+-0.0454976 -0.165811 -0.0773501
+-0.0316259 -0.166477 -0.066941
+-0.0459775 -0.154238 -0.0701846
+-0.0901707 -0.188136 -0.128016
+-0.103266 -0.171494 -0.138588
+-0.103066 -0.183066 -0.147256
+-0.026106 -0.320037 -0.121085
+-0.0406746 -0.306778 -0.12457
+-0.050823 -0.297432 -0.136314
+-0.0354564 -0.315191 -0.132787
+-0.0861763 -0.238684 -0.156783
+-0.0936108 -0.209831 -0.173084
+-0.0852883 -0.227358 -0.178683
+-0.1217 -0.116435 -0.212951
+-0.127732 -0.0874749 -0.223
+-0.0908703 -0.105192 -0.0921276
+-0.106779 -0.0884557 -0.0993211
+-0.103234 -0.0953954 -0.103182
+-0.153512 -0.0289478 -0.148448
+-0.151967 -0.0230669 -0.175015
+-0.144573 -0.0488493 -0.181234
+-0.143516 -0.0515182 -0.149663
+-0.149479 0.0261923 -0.214134
+-0.138752 0.00333739 -0.225255
+-0.148295 0.00262753 -0.194856
+-0.156108 0.0222833 -0.185323
+-0.107481 0.188887 -0.31122
+-0.111917 0.221867 -0.284839
+-0.0888199 0.228468 -0.316296
+-0.0870814 0.198004 -0.343122
+-0.145129 0.159676 -0.261688
+-0.128402 0.153993 -0.292703
+-0.136599 0.139177 -0.285251
+-0.0186695 0.307765 -0.353147
+-0.0446615 0.296837 -0.325575
+-0.0423373 0.335567 -0.290842
+-0.0143837 0.339538 -0.322396
+-0.160685 0.061203 -0.237062
+-0.158384 0.0490186 -0.229599
+-0.171479 0.0651988 -0.215852
+0.0362591 0.386231 -0.301662
+0.0388563 0.363706 -0.337845
+0.0130834 0.367242 -0.313826
+0.00919686 0.391714 -0.275302
+-0.059099 -0.0977318 -0.0548276
+-0.0723933 -0.0977843 -0.0640783
+-0.0556152 -0.10797 -0.0599065
+-0.041293 -0.100665 -0.0509301
+-0.0361124 -0.147831 -0.0575148
+-0.0524229 -0.130594 -0.0635357
+-0.0630054 -0.131474 -0.0722438
+-0.0482367 -0.147409 -0.0657964
+-0.010521 -0.241035 -0.0841075
+-0.0105046 -0.222542 -0.0785494
+-0.0126097 -0.300004 -0.0994843
+-0.0131018 -0.317804 -0.105387
+-0.0238153 -0.211858 -0.0827342
+-0.0501097 -0.200234 -0.0983082
+-0.0134417 -0.20283 -0.0695218
+-0.0123639 -0.211838 -0.072708
+-0.0597625 -0.166523 -0.0902007
+-0.0290301 -0.184248 -0.0733673
+-0.0668953 -0.189143 -0.106862
+-0.0752997 -0.16838 -0.10473
+-0.090258 -0.16922 -0.120493
+-0.00591646 -0.331951 -0.117135
+-0.0114609 -0.32467 -0.112196
+-0.0662079 -0.195379 -0.109398
+-0.0748082 -0.211581 -0.121748
+-0.0590383 -0.242198 -0.117465
+-0.02625 -0.263318 -0.0992208
+-0.0278827 -0.314327 -0.115419
+-0.0548992 -0.291766 -0.130284
+-0.0693191 -0.272455 -0.139188
+-0.076346 -0.245032 -0.134977
+-0.038014 -0.305597 -0.151904
+-0.00769658 -0.334754 -0.131602
+-0.0517431 -0.287965 -0.156347
+-0.0655472 -0.27827 -0.143182
+-0.0707845 -0.25702 -0.168359
+-0.104171 -0.175802 -0.185657
+-0.0913283 -0.211157 -0.143498
+-0.112447 -0.152111 -0.194942
+-0.117605 -0.145626 -0.157564
+-0.128559 -0.112186 -0.172805
+-0.0926279 -0.140831 -0.111516
+-0.106324 -0.111193 -0.116533
+-0.120509 -0.11073 -0.140087
+-0.107812 -0.142857 -0.13171
+-0.131947 -0.0788289 -0.146546
+-0.120223 -0.0835154 -0.121269
+-0.135595 -0.0588653 -0.125302
+-0.133498 -0.0529433 -0.223335
+-0.137353 -0.078478 -0.181393
+-0.142377 -0.0212308 -0.207193
+-0.156708 -0.00212175 -0.167717
+-0.161721 -0.0101248 -0.14491
+-0.149672 -0.0387761 -0.127142
+-0.160071 -0.0230041 -0.125851
+-0.125278 0.25531 -0.241742
+-0.136143 0.224819 -0.243097
+-0.146056 0.257681 -0.205396
+-0.167222 0.175328 -0.213639
+-0.171719 0.201554 -0.188473
+-0.151998 0.192496 -0.231467
+-0.174239 0.139223 -0.21622
+-0.187374 0.162785 -0.183817
+-0.172341 0.163407 -0.211661
+-0.15548 0.136204 -0.252813
+-0.0712384 0.288827 -0.291728
+-0.0530932 0.25539 -0.35156
+-0.0762621 0.248388 -0.319139
+-0.117438 0.268054 -0.242574
+-0.120058 0.300676 -0.208935
+-0.0973274 0.291756 -0.250464
+-0.0943398 0.251872 -0.288969
+-0.072895 0.205326 -0.367366
+-0.0922975 0.169898 -0.358692
+-0.109369 0.153562 -0.327615
+-0.129537 0.18668 -0.274708
+-0.127198 0.0881377 -0.319617
+-0.128931 0.113004 -0.306975
+-0.116831 0.112962 -0.33362
+-0.162787 0.110738 -0.240508
+-0.146049 0.110367 -0.274087
+-0.141387 0.0813748 -0.286821
+-0.155246 0.0821366 -0.255003
+-0.130068 -0.00280499 -0.253159
+-0.129316 -0.0192391 -0.240929
+-0.139431 0.0294263 -0.279961
+-0.147952 0.0531003 -0.266387
+-0.139054 0.0481245 -0.294159
+-0.0716248 0.334353 -0.250729
+-0.0752219 0.370466 -0.208009
+-0.0460095 0.371594 -0.24636
+0.00193097 0.415171 -0.228936
+-0.0213014 0.398055 -0.238251
+-0.0280588 0.420862 -0.193851
+0.040031 0.344914 -0.363865
+0.0570479 0.35753 -0.355946
+6.82563e-006 0.311197 -0.373335
+-0.0236256 0.28159 -0.374548
+0.0119749 0.34136 -0.347008
+-0.0152164 0.369641 -0.284366
+-0.020137 -0.158609 -0.0521628
+-0.0208735 -0.145664 -0.0495152
+-0.017574 -0.168581 -0.0591045
+-0.0160327 -0.177573 -0.0628443
+-0.0584506 -0.141769 -0.0744328
+-0.0338265 -0.158256 -0.0615099
+-0.0756901 -0.141816 -0.0946626
+-0.0703832 -0.131904 -0.0840624
+-0.0894008 -0.117786 -0.0992583
+-0.068846 -0.112593 -0.0696624
+-0.037844 -0.123178 -0.0543464
+-0.0874036 -0.0925136 -0.0660216
+-0.103352 -0.0876087 -0.0762007
+-0.0866685 -0.0973195 -0.0745236
+-0.0987737 -0.0937456 -0.0867333
+-0.116021 -0.0793387 -0.0897789
+-0.126299 -0.0688409 -0.106048
+-0.0804674 -0.11191 -0.0804735
+-0.0713565 -0.127474 -0.0813397
+-0.143519 0.0264701 -0.245033
+-0.163251 0.0448871 -0.203268
+-0.163012 0.0158672 -0.158691
+-0.173177 0.0306938 -0.147534
+-0.169334 0.039933 -0.173465
+-0.181551 0.0622637 -0.187634
+-0.19956 0.0777798 -0.16806
+-0.19076 0.0870312 -0.189781
+-0.180192 0.117198 -0.205392
+-0.170185 0.0880851 -0.225658
+-0.18912 0.101796 -0.192055
+-0.195954 0.125152 -0.174841
+0.00880984 -0.275017 -0.0840515
+0.00321965 -0.167335 -0.0485214
+0.00532126 -0.193675 -0.0588888
+-0.158537 0.227456 -0.199882
+-0.201959 0.103873 -0.169575
+-0.185772 0.0546033 -0.16105
+-0.141155 -0.0523543 -0.108943
+-0.0510509 0.400036 -0.202157
+0.0325419 -0.348899 -0.112247
+-0.000310566 0.432354 -0.187513
+0.0300498 0.424393 -0.216193
+0.0315801 0.407997 -0.257825
+0.00251183 -0.126194 -0.0401252
+-0.0222434 -0.105932 -0.0456532
+0.0599734 0.381778 -0.318079
+0.0884499 0.370846 -0.337337
+-0.0993976 0.333539 -0.21015
+-0.182465 0.183102 -0.180829
+-0.167956 0.00474552 -0.137291
+0.0105449 -0.327451 -0.10101
+0.0066427 -0.219416 -0.0678126
+-0.134513 0.279376 -0.207098
+-0.189679 0.142315 -0.184254
+0.0588929 0.400912 -0.278119
+0.0636606 -0.232059 -0.0759358
+0.0774962 -0.208763 -0.0725742
+0.0569667 -0.209065 -0.0693696
+0.0433523 -0.224183 -0.0717783
+0.090626 -0.274361 -0.0882663
+0.0702023 -0.271762 -0.0841566
+0.0526461 -0.300093 -0.0890745
+0.0713865 -0.298437 -0.090899
+0.0765283 -0.185225 -0.0637432
+0.0608512 -0.184364 -0.0598034
+0.042723 -0.200841 -0.0621385
+0.0574145 -0.200169 -0.0652496
+0.0746745 -0.14382 -0.0485739
+0.0580479 -0.150808 -0.0453768
+0.0434363 -0.164097 -0.0489882
+0.0606191 -0.162456 -0.0517717
+0.14042 -0.165356 -0.0750894
+0.122412 -0.182639 -0.0736445
+0.147462 -0.176708 -0.0798524
+0.0546344 -0.319082 -0.100446
+0.0802865 -0.313532 -0.102335
+0.0927624 -0.295635 -0.0995778
+0.0710487 -0.305549 -0.0965868
+0.168444 -0.201614 -0.0937036
+0.141857 -0.234506 -0.095279
+0.170262 -0.219096 -0.0984952
+0.21874 -0.102602 -0.101516
+0.228358 -0.0721084 -0.105656
+0.127835 -0.0783565 -0.0431032
+0.110022 -0.0970158 -0.0440096
+0.125496 -0.0859965 -0.047847
+0.185495 -0.0140243 -0.0557245
+0.178878 -0.0380983 -0.0612478
+0.199367 -0.0349442 -0.0793159
+0.197971 -0.00829621 -0.0726336
+0.217867 0.044268 -0.0973949
+0.204445 0.0406012 -0.0762805
+0.205329 0.018637 -0.0861975
+0.221641 0.0199162 -0.108115
+0.239638 0.214547 -0.179509
+0.250334 0.2215 -0.214713
+0.223046 0.253226 -0.194548
+0.21618 0.248184 -0.160636
+0.245762 0.179261 -0.156149
+0.233379 0.18565 -0.128723
+0.248466 0.16421 -0.147377
+0.185893 0.325372 -0.271027
+0.153865 0.355349 -0.255054
+0.151244 0.354183 -0.214358
+0.185272 0.317518 -0.233701
+0.23496 0.0692122 -0.103364
+0.241023 0.0823427 -0.107052
+0.234303 0.0872387 -0.0883749
+0.0946722 0.3919 -0.278359
+0.0931446 0.400152 -0.242169
+0.123381 0.377808 -0.269756
+0.124363 0.371451 -0.30342
+0.0692194 -0.0916945 -0.0255436
+0.0483111 -0.0969639 -0.0302171
+0.0646046 -0.103132 -0.0319364
+0.0815376 -0.0913969 -0.0283189
+0.0427011 -0.145267 -0.0389184
+0.0576657 -0.14389 -0.0406494
+0.0747905 -0.126516 -0.0395409
+0.0612136 -0.126567 -0.036799
+0.0290308 -0.240119 -0.0742472
+0.0270827 -0.221607 -0.0692651
+0.0332934 -0.299239 -0.0878049
+0.034692 -0.317135 -0.0931419
+0.0412644 -0.210183 -0.0667151
+0.072893 -0.196868 -0.0677847
+0.0270063 -0.20166 -0.0596997
+0.0264637 -0.210813 -0.0632135
+0.0785685 -0.162256 -0.0564644
+0.0438902 -0.18204 -0.0557292
+0.09206 -0.184631 -0.0672639
+0.119765 -0.163075 -0.0673485
+0.0988672 -0.163055 -0.0616443
+0.0422759 -0.331163 -0.104004
+0.0357329 -0.32407 -0.0999894
+0.0922266 -0.191037 -0.0697648
+0.104587 -0.207299 -0.0762211
+0.0869674 -0.23922 -0.0804162
+0.0487241 -0.261807 -0.0802967
+0.0532017 -0.313293 -0.0947166
+0.089396 -0.290182 -0.094464
+0.109603 -0.270559 -0.0947329
+0.113258 -0.241925 -0.0869203
+0.119827 -0.301123 -0.10227
+0.0784961 -0.332344 -0.104679
+0.129419 -0.282769 -0.0998385
+0.1523 -0.250526 -0.0989273
+0.111054 -0.276235 -0.0979908
+0.189013 -0.164748 -0.0920627
+0.135089 -0.205964 -0.0834911
+0.200553 -0.140025 -0.0942087
+0.184763 -0.102411 -0.0831471
+0.166034 -0.137649 -0.079062
+0.117772 -0.133915 -0.0590888
+0.140882 -0.135228 -0.0670441
+0.156345 -0.101293 -0.0666891
+0.132554 -0.102448 -0.0567585
+0.168878 -0.0673058 -0.0650803
+0.162483 -0.0457785 -0.0496612
+0.147639 -0.0725322 -0.0539518
+0.228519 -0.0361455 -0.104188
+0.195842 -0.0666806 -0.083872
+0.214052 -0.00576595 -0.0952544
+0.196108 0.0142011 -0.0654994
+0.190394 0.00655226 -0.0496967
+0.186663 -0.00382679 -0.0390993
+0.174842 -0.0238211 -0.0446935
+0.190727 0.281078 -0.128882
+0.183133 0.284762 -0.0979014
+0.204381 0.251457 -0.1236
+0.217279 0.20169 -0.0898396
+0.213597 0.218896 -0.108159
+0.202609 0.229482 -0.0742403
+0.228773 0.165274 -0.0873223
+0.238574 0.161846 -0.118143
+0.221807 0.190078 -0.0858091
+0.21826 0.191809 -0.0629644
+0.181193 0.311293 -0.192576
+0.212752 0.272157 -0.205218
+0.21991 0.276906 -0.244493
+0.183336 0.293155 -0.133816
+0.202093 0.276543 -0.173869
+0.170124 0.315052 -0.150445
+0.157424 0.325251 -0.114074
+0.258474 0.226372 -0.243447
+0.273 0.191587 -0.224019
+0.262224 0.177303 -0.189709
+0.226913 0.213198 -0.144797
+0.266197 0.135693 -0.165937
+0.280506 0.109435 -0.175374
+0.280425 0.134894 -0.190392
+0.238953 0.135052 -0.107377
+0.247569 0.104009 -0.120567
+0.263592 0.102585 -0.147191
+0.251484 0.133711 -0.136465
+0.242216 0.0156495 -0.126082
+0.234058 -0.00169173 -0.118126
+0.256182 0.0734858 -0.130905
+0.266648 0.0499803 -0.140878
+0.274985 0.0691897 -0.150874
+0.144176 0.354447 -0.168261
+0.115991 0.387341 -0.183495
+0.110736 0.388129 -0.13932
+0.0610314 0.421095 -0.20603
+0.0573749 0.429199 -0.16141
+0.0876513 0.408845 -0.195945
+0.146609 0.353902 -0.320869
+0.126552 0.363496 -0.327733
+0.188528 0.326138 -0.298191
+0.211756 0.299514 -0.281949
+0.154009 0.353834 -0.289966
+0.121154 0.383182 -0.230448
+0.0256193 -0.157199 -0.0413476
+0.0261647 -0.144078 -0.0384768
+0.026863 -0.167188 -0.0485234
+0.0271476 -0.176239 -0.052483
+0.0716773 -0.137221 -0.0433748
+0.042323 -0.155856 -0.0434288
+0.0951773 -0.13613 -0.0530795
+0.11016 -0.110459 -0.0507349
+0.086837 -0.126236 -0.0463351
+0.079922 -0.106785 -0.034737
+0.0451952 -0.120061 -0.0349786
+0.099358 -0.0837502 -0.0231587
+0.0988959 -0.0895608 -0.0310771
+0.117438 -0.0770092 -0.0251784
+0.115331 -0.0845945 -0.0360639
+0.147931 -0.0564135 -0.0400139
+0.134967 -0.0669141 -0.0311385
+0.0952619 -0.104934 -0.0387962
+0.0868923 -0.121596 -0.0434997
+0.238806 0.0450768 -0.11898
+0.220497 0.0652131 -0.0840515
+0.196973 0.0343449 -0.0573551
+0.208406 0.0603881 -0.0630477
+0.202868 0.0534614 -0.0463467
+0.225201 0.0846163 -0.0660059
+0.232301 0.111437 -0.0634531
+0.230115 0.104908 -0.0464723
+0.229424 0.142574 -0.077903
+0.225251 0.153828 -0.0529983
+0.230723 0.126627 -0.0658332
+0.237356 0.111354 -0.095092
+0.194494 0.255136 -0.087895
+0.230053 0.13188 -0.0468136
+0.217012 0.0791947 -0.0483425
+0.165344 -0.0360438 -0.0356434
+0.0836543 0.413033 -0.151221
+0.0614723 0.411038 -0.246048
+0.0307433 0.435386 -0.175694
+0.0285714 -0.103887 -0.0338954
+0.0917283 0.384646 -0.305285
+0.136664 0.355252 -0.126352
+0.21002 0.211568 -0.0640367
+0.195794 0.0255842 -0.0425687
+0.171289 0.305611 -0.105166
+0.222619 0.170991 -0.0616416
+-0.0574077 -0.144429 0.206111
+-0.0725578 -0.166918 0.207533
+-0.0564937 -0.18906 0.207697
+-0.0417913 -0.170021 0.208521
+-0.0632026 -0.0558913 0.168731
+-0.0797227 -0.071651 0.175539
+-0.0590021 -0.092504 0.189617
+-0.0406705 -0.0705214 0.180975
+-0.0857798 -0.186202 0.202437
+-0.0880793 -0.142148 0.203658
+-0.0983833 -0.166343 0.199031
+-0.0910102 -0.092388 0.186879
+-0.0971997 -0.0590311 0.160873
+-0.104578 -0.0739615 0.169507
+-0.100722 -0.188599 0.180328
+-0.104543 -0.168183 0.189445
+-0.104262 -0.146945 0.180282
+-0.0989102 -0.171072 0.171208
+-0.109143 -0.100961 0.165777
+-0.114114 -0.0783224 0.161376
+-0.11922 -0.0721179 0.140914
+-0.112082 -0.0910577 0.1433
+-0.102916 -0.126679 0.163232
+-0.10811 -0.119924 0.184884
+-0.101161 -0.117273 0.193526
+-0.0738103 -0.116594 0.200287
+-0.0423114 -0.118608 0.199803
+-0.0462314 -0.222643 0.242332
+-0.0566964 -0.219487 0.235733
+-0.0682891 -0.223749 0.236078
+-0.0567462 -0.226824 0.239322
+-0.0807022 -0.219622 0.227158
+-0.0912075 -0.222745 0.224328
+-0.0801261 -0.22671 0.230492
+-0.10219 -0.219988 0.197461
+-0.101598 -0.226344 0.193679
+-0.101671 -0.228414 0.203591
+-0.101002 -0.222792 0.208995
+-0.101517 -0.214524 0.197091
+-0.101472 -0.216 0.189605
+-0.0918457 -0.215188 0.212304
+-0.0673901 -0.215442 0.222637
+-0.0811499 -0.208879 0.207625
+-0.0434629 -0.215371 0.22687
+-0.0539976 -0.210252 0.214179
+-0.0676161 -0.230268 0.232855
+-0.0896076 -0.229438 0.22249
+-0.0785412 -0.232737 0.224741
+-0.0452819 -0.229146 0.238998
+-0.0557183 -0.232268 0.232296
+-0.101766 -0.187139 0.192565
+-0.105589 -0.143072 0.195355
+-0.108536 -0.094852 0.180182
+-0.113517 -0.0619225 0.154842
+-0.0996815 -0.2086 0.195102
+-0.0985478 -0.214031 0.203845
+-0.0971117 -0.22608 0.217159
+-0.097468 -0.218435 0.213996
+-0.0991321 -0.230097 0.20931
+-0.0939186 -0.232684 0.213964
+-0.0996993 -0.232032 0.202807
+-0.0407244 -0.202838 0.210382
+-0.0693382 -0.200514 0.207712
+-0.0944551 -0.199857 0.197388
+-0.10169 -0.20095 0.187567
+-0.096797 -0.201316 0.17538
+-0.0996624 -0.209983 0.183663
+-0.0416691 -0.23585 0.222374
+-0.053459 -0.23548 0.224203
+-0.0625562 -0.236823 0.216706
+-0.0504796 -0.236585 0.215536
+-0.0757597 -0.236601 0.217241
+-0.0834665 -0.237962 0.209589
+-0.0722752 -0.237689 0.208982
+-0.0902813 -0.236855 0.20926
+-0.090112 -0.237611 0.203419
+-0.0856685 -0.238548 0.203952
+-0.0901816 -0.236973 0.198506
+-0.0935446 -0.236103 0.199971
+-0.10389 -0.110511 0.144773
+-0.0975014 -0.132748 0.142221
+-0.0973581 -0.152377 0.157362
+-0.0936565 -0.173052 0.154584
+-0.0956175 -0.188544 0.16604
+-0.0934948 -0.200598 0.165643
+-0.0951903 -0.209773 0.174077
+-0.0949568 -0.216109 0.174877
+-0.0989484 -0.221594 0.183486
+-0.0987955 -0.216034 0.182644
+-0.0969697 -0.227271 0.185551
+-0.0991839 -0.231391 0.193952
+-0.0951425 -0.234911 0.206211
+-0.0952039 -0.234393 0.193306
+-0.0866923 -0.23502 0.216661
+-0.0659629 -0.234784 0.225001
+-0.0434772 -0.233469 0.23091
+-0.114317 -0.092145 0.125751
+-0.10436 -0.105583 0.132617
+-0.0803138 -0.238203 0.202783
+-0.0850446 -0.237971 0.199891
+-0.0917692 -0.235059 0.191876
+-0.0938026 -0.23258 0.188307
+-0.0994256 -0.115901 0.13244
+-0.102209 -0.108789 0.129245
+-0.0593318 -0.23656 0.208329
+-0.0487084 -0.236345 0.208873
+-0.0399798 -0.236071 0.213948
+-0.0697477 -0.237493 0.202781
+-0.0869824 -0.236734 0.193804
+-0.0937057 -0.222457 0.177631
+-0.0922341 -0.228955 0.181732
+-0.0912307 -0.210703 0.167645
+-0.0909235 -0.218537 0.171103
+-0.0915529 -0.189325 0.157024
+-0.0899243 -0.202601 0.160773
+-0.0917153 -0.155688 0.143189
+-0.0898055 -0.174946 0.147916
+-0.0940442 -0.134893 0.134606
+-0.144731 -0.135809 0.441244
+-0.128914 -0.143722 0.442955
+-0.115045 -0.147168 0.451868
+-0.118181 -0.143881 0.457372
+-0.133507 -0.138486 0.452294
+-0.155452 -0.135148 0.45295
+-0.161318 -0.133328 0.447813
+-0.157792 -0.135543 0.444127
+-0.139128 -0.140855 0.456706
+-0.134047 -0.141378 0.470127
+-0.151844 -0.133334 0.466788
+-0.106127 -0.154308 0.46746
+-0.0984433 -0.15781 0.462952
+-0.0948401 -0.155079 0.471381
+-0.103318 -0.151877 0.476668
+-0.0945937 -0.162612 0.44906
+-0.0952681 -0.166482 0.442676
+-0.0889639 -0.165926 0.444278
+-0.115806 -0.147147 0.480361
+-0.0980884 -0.148602 0.486252
+-0.110317 -0.144946 0.489743
+-0.163049 -0.129235 0.433117
+-0.160077 -0.130297 0.434256
+-0.159239 -0.133516 0.437937
+-0.162849 -0.133456 0.439124
+-0.148819 -0.136166 0.446623
+-0.154183 -0.132801 0.439966
+-0.123001 -0.144046 0.460069
+-0.113411 -0.149133 0.457292
+-0.115542 -0.150017 0.46213
+-0.11577 -0.151548 0.447439
+-0.110682 -0.154911 0.453468
+-0.144651 -0.141386 0.436225
+-0.129587 -0.152765 0.439779
+-0.152773 -0.135027 0.435015
+-0.158727 -0.134616 0.433398
+-0.155243 -0.142597 0.432781
+-0.15986 -0.130858 0.433086
+-0.161816 -0.130736 0.431649
+-0.157161 -0.131518 0.435176
+-0.10186 -0.158875 0.45536
+-0.0917187 -0.160123 0.456831
+-0.163872 -0.125433 0.457694
+-0.163543 -0.129118 0.455365
+-0.161089 -0.128767 0.461166
+-0.123284 -0.139472 0.489321
+-0.10023 -0.14204 0.495537
+-0.112509 -0.137217 0.494267
+-0.144957 -0.132953 0.477823
+-0.154665 -0.126763 0.46935
+-0.16449 -0.128876 0.445693
+-0.105076 -0.160861 0.448077
+-0.112991 -0.16631 0.439845
+-0.0980133 -0.17644 0.431866
+-0.108719 -0.155077 0.460058
+-0.11658 -0.149247 0.469601
+-0.131638 -0.139944 0.481765
+-0.135351 -0.131928 0.485001
+-0.0948142 -0.208719 0.379511
+-0.111263 -0.214912 0.372693
+-0.120831 -0.2188 0.359907
+-0.10622 -0.212204 0.371567
+-0.0755788 -0.202305 0.385125
+-0.0856569 -0.204594 0.38633
+-0.0840024 -0.202924 0.381949
+-0.074927 -0.277958 0.212612
+-0.0572077 -0.282042 0.215814
+-0.0400364 -0.277135 0.223246
+-0.0572855 -0.275281 0.219273
+-0.105449 -0.270553 0.194872
+-0.0913911 -0.2797 0.201685
+-0.0908758 -0.273297 0.206216
+-0.114821 -0.248771 0.164314
+-0.111744 -0.264229 0.176552
+-0.111228 -0.258368 0.181
+-0.115942 -0.223005 0.143102
+-0.115386 -0.238542 0.149631
+-0.114846 -0.233642 0.153923
+-0.117357 -0.196758 0.12662
+-0.116138 -0.212167 0.131361
+-0.115767 -0.207981 0.135793
+-0.11826 -0.168368 0.116041
+-0.11695 -0.184994 0.116976
+-0.116402 -0.181215 0.122657
+-0.127008 -0.139685 0.107356
+-0.121317 -0.15699 0.107131
+-0.12049 -0.152621 0.11335
+-0.141736 -0.115768 0.104081
+-0.134691 -0.129728 0.0999266
+-0.132714 -0.125868 0.106632
+-0.152211 -0.104368 0.14347
+-0.154566 -0.0995726 0.133197
+-0.148576 -0.10535 0.128525
+-0.14699 -0.0999733 0.137129
+-0.162133 -0.120399 0.168962
+-0.163153 -0.105028 0.160389
+-0.155551 -0.109696 0.156701
+-0.167578 -0.146868 0.198271
+-0.171046 -0.129342 0.187688
+-0.163519 -0.131411 0.183715
+-0.164776 -0.211508 0.269375
+-0.172835 -0.202389 0.262301
+-0.168942 -0.193706 0.248381
+-0.165628 -0.201699 0.258323
+-0.154624 -0.220803 0.294183
+-0.165208 -0.216681 0.285158
+-0.158485 -0.215253 0.281219
+-0.135345 -0.224056 0.343225
+-0.142135 -0.226488 0.321861
+-0.130813 -0.22222 0.341262
+-0.0706739 -0.0348636 0.193948
+-0.0889578 -0.0456973 0.177042
+-0.0652373 -0.0452782 0.170791
+-0.043269 -0.0362055 0.186482
+-0.0530529 -0.028868 0.23392
+-0.0810708 -0.0397078 0.248171
+-0.0989798 -0.042722 0.224718
+-0.0750478 -0.031689 0.213485
+-0.133427 -0.116299 0.107829
+-0.124674 -0.139236 0.113406
+-0.124723 -0.128543 0.116991
+-0.0736417 -0.271779 0.214127
+-0.0404234 -0.270563 0.223732
+-0.0561947 -0.264986 0.218664
+-0.10278 -0.264569 0.197382
+-0.0883278 -0.263945 0.207223
+-0.113125 -0.243391 0.167945
+-0.10724 -0.250736 0.184974
+-0.114316 -0.218239 0.147098
+-0.111286 -0.227619 0.159968
+-0.11554 -0.193664 0.131681
+-0.111781 -0.204505 0.143582
+-0.116559 -0.166856 0.121584
+-0.112363 -0.179852 0.131477
+-0.117002 -0.150942 0.121993
+-0.13564 -0.10052 0.101458
+-0.128211 -0.106123 0.106537
+-0.141837 -0.0924815 0.133165
+-0.138478 -0.0815796 0.143693
+-0.145805 -0.092874 0.151026
+-0.100267 -0.0515687 0.161903
+-0.107433 -0.0498902 0.186299
+-0.113157 -0.0537228 0.168328
+-0.124123 -0.0643374 0.139957
+-0.121091 -0.0580312 0.162366
+-0.129905 -0.0677809 0.169751
+-0.132338 -0.0730735 0.143355
+-0.0945807 -0.0408763 0.199368
+-0.0478354 -0.0274134 0.207446
+-0.121034 -0.0599574 0.189286
+-0.111209 -0.0518512 0.204783
+-0.140722 -0.0817659 0.171732
+-0.131666 -0.074238 0.188918
+-0.156413 -0.108056 0.169429
+-0.148895 -0.095723 0.16243
+-0.149014 -0.0976205 0.176642
+-0.164752 -0.142508 0.199532
+-0.160436 -0.117828 0.173664
+-0.159555 -0.126207 0.190604
+-0.162302 -0.207274 0.269272
+-0.166261 -0.1893 0.248612
+-0.161657 -0.194598 0.261293
+-0.152117 -0.21658 0.294107
+-0.155348 -0.208753 0.283138
+-0.118601 -0.214761 0.360195
+-0.139597 -0.222279 0.321935
+-0.127862 -0.217658 0.342744
+-0.0935739 -0.204881 0.378403
+-0.105532 -0.208553 0.370004
+-0.0754553 -0.198329 0.38363
+-0.0839027 -0.199873 0.379878
+-0.0401299 -0.25285 0.218374
+-0.0499459 -0.242669 0.211326
+-0.0647152 -0.252745 0.211302
+-0.0773972 -0.25351 0.207773
+-0.0703177 -0.244289 0.205865
+-0.0916641 -0.243129 0.195924
+-0.0982563 -0.248181 0.193975
+-0.0928279 -0.251685 0.20078
+-0.116073 -0.0551822 0.156362
+-0.113803 -0.0631204 0.23717
+-0.122143 -0.0693651 0.2121
+-0.140742 -0.0928364 0.189952
+-0.149281 -0.109267 0.189737
+-0.131339 -0.0927518 0.216919
+-0.14368 -0.150279 0.252924
+-0.15541 -0.164094 0.245578
+-0.15514 -0.153294 0.234539
+-0.132742 -0.123049 0.253475
+-0.12393 -0.124424 0.282727
+-0.132728 -0.153458 0.282404
+-0.116252 -0.0936248 0.274779
+-0.105803 -0.103412 0.300363
+-0.115284 -0.13419 0.310855
+-0.0864425 -0.0731069 0.2875
+-0.0661137 -0.0918733 0.313309
+-0.0885946 -0.120104 0.327355
+-0.0599086 -0.0490459 0.272754
+-0.103778 -0.0635115 0.262016
+-0.123067 -0.0913484 0.247626
+-0.141613 -0.119841 0.220342
+-0.154904 -0.139909 0.217971
+-0.155824 -0.176464 0.255438
+-0.141922 -0.179698 0.280747
+-0.151964 -0.199439 0.279856
+-0.114681 -0.21053 0.338011
+-0.126908 -0.209719 0.322684
+-0.124451 -0.202728 0.32245
+-0.105319 -0.202368 0.347032
+-0.0941664 -0.205774 0.356105
+-0.104087 -0.212811 0.355154
+-0.0837232 -0.194185 0.358861
+-0.0712767 -0.200623 0.363147
+-0.083057 -0.205997 0.36519
+-0.0714801 -0.142011 0.351267
+-0.0871053 -0.166637 0.359268
+-0.10263 -0.150198 0.339015
+-0.110205 -0.177644 0.344262
+-0.121852 -0.164531 0.317342
+-0.128298 -0.189072 0.314815
+-0.147415 -0.207306 0.294306
+-0.152165 -0.103676 0.15699
+-0.0848078 -0.0514472 0.161127
+-0.0399033 -0.0469723 0.171954
+-0.107935 -0.0546928 0.154671
+-0.119532 -0.0595492 0.146211
+-0.123956 -0.0733513 0.122745
+-0.103473 -0.230841 0.171729
+-0.102906 -0.237949 0.17924
+-0.0974734 -0.231327 0.178781
+-0.0962223 -0.220476 0.168401
+-0.103516 -0.214191 0.157338
+-0.0954414 -0.203403 0.157181
+-0.104231 -0.191872 0.144541
+-0.0954824 -0.17624 0.144479
+-0.105186 -0.162334 0.132724
+-0.100458 -0.138176 0.131924
+-0.114856 -0.130612 0.123072
+-0.119453 -0.117105 0.117697
+-0.117578 -0.102361 0.11252
+-0.0963219 -0.238417 0.187226
+-0.0842808 -0.245385 0.202221
+-0.128165 -0.0774535 0.109074
+-0.123297 -0.0824246 0.112869
+-0.132918 -0.0843378 0.10524
+-0.131094 -0.0773457 0.116169
+-0.116951 -0.0941422 0.11422
+-0.0846795 -0.240443 0.198759
+-0.0790906 -0.24046 0.201226
+-0.0933712 -0.233902 0.18527
+-0.0919058 -0.236709 0.189488
+-0.0585018 -0.23813 0.206058
+-0.0394269 -0.237423 0.211464
+-0.0931494 -0.224465 0.175318
+-0.091002 -0.21251 0.16504
+-0.0913481 -0.190847 0.153805
+-0.0918041 -0.156982 0.139758
+-0.100304 -0.117279 0.129486
+-0.107482 -0.105869 0.123644
+-0.0723851 -0.180306 0.364227
+-0.0972427 -0.187158 0.355678
+-0.117418 -0.196211 0.334965
+-0.116448 -0.215074 0.353298
+-0.12766 -0.216242 0.332603
+-0.0936436 -0.206913 0.369234
+-0.0736547 -0.201601 0.375324
+-0.138396 -0.210947 0.310501
+-0.168044 -0.158899 0.213278
+-0.171171 -0.173257 0.226976
+-0.175356 -0.157352 0.216653
+-0.163532 -0.152256 0.218371
+-0.168291 -0.168705 0.227631
+-0.164264 -0.175189 0.242087
+-0.168755 -0.182297 0.238167
+-0.175959 -0.181688 0.24155
+-0.147303 -0.223151 0.306721
+-0.153062 -0.224615 0.30989
+-0.145502 -0.215626 0.305461
+-0.139007 -0.0948834 0.114948
+-0.141995 -0.106676 0.108347
+-0.146118 -0.10909 0.115192
+-0.14864 -0.108343 0.105985
+-0.1445 -0.103275 0.122774
+-0.151618 -0.103867 0.119653
+-0.135706 -0.0829113 0.124499
+-0.133165 -0.0765744 0.130836
+-0.157613 -0.112069 0.165077
+-0.0777378 0.348633 0.274719
+-0.0875797 0.351135 0.270928
+-0.0854787 0.336123 0.283631
+-0.124702 -0.123044 0.0309604
+-0.135209 -0.112731 0.034008
+-0.137802 -0.108448 0.0200489
+-0.124102 -0.118131 0.0196974
+-0.100481 -0.177715 0.0583011
+-0.109518 -0.172384 0.0617549
+-0.106678 -0.168714 0.0519444
+-0.0947643 -0.173051 0.0503008
+-0.1146 -0.153636 0.0434936
+-0.12425 -0.143999 0.0480811
+-0.116558 -0.14162 0.0357656
+-0.106423 -0.147293 0.0311317
+-0.12069 0.410905 0.174234
+-0.104328 0.416919 0.170697
+-0.117795 0.416114 0.156835
+-0.131791 0.409619 0.160201
+-0.124021 0.419836 0.123642
+-0.114643 0.420776 0.138765
+-0.0978768 0.427033 0.131493
+-0.10894 0.426626 0.116138
+-0.167673 0.393659 0.154833
+-0.155221 0.399992 0.148612
+-0.165715 0.399391 0.134299
+-0.178173 0.394611 0.142086
+-0.166691 0.399429 0.0911897
+-0.169855 0.392439 0.0753352
+-0.177159 0.396724 0.092275
+-0.212859 0.391712 0.150136
+-0.201146 0.393909 0.140912
+-0.212186 0.39595 0.131327
+-0.223936 0.394153 0.140611
+-0.224361 0.39473 0.100214
+-0.211681 0.397619 0.111327
+-0.200099 0.395647 0.0973779
+-0.213281 0.390052 0.0842583
+-0.258665 0.396613 0.150822
+-0.247104 0.395573 0.141098
+-0.260672 0.400692 0.135456
+-0.273141 0.404181 0.146791
+-0.280351 0.409054 0.115271
+-0.26246 0.402583 0.118963
+-0.249372 0.39618 0.104227
+-0.266065 0.397484 0.0969915
+-0.304592 0.418296 0.164389
+-0.300112 0.419011 0.157049
+-0.31407 0.429213 0.156434
+-0.315572 0.426636 0.162811
+-0.334528 0.443478 0.142164
+-0.322385 0.437426 0.145772
+-0.314812 0.431726 0.132297
+-0.331752 0.439739 0.129494
+-0.313346 0.416588 0.162199
+-0.318956 0.424895 0.16232
+-0.322611 0.426819 0.156814
+-0.315437 0.417164 0.15493
+-0.32951 0.428374 0.137336
+-0.331386 0.434985 0.147714
+-0.33779 0.441152 0.142924
+-0.339246 0.436064 0.132466
+-0.300044 0.179035 -0.0094692
+-0.298494 0.178581 -0.0255531
+-0.302116 0.156701 -0.0264213
+-0.291344 0.217057 0.0493111
+-0.296945 0.194097 0.0296819
+-0.298851 0.182705 0.0428902
+-0.292089 0.207508 0.0646879
+-0.174507 -0.0812608 -0.0209711
+-0.186568 -0.0719015 -0.0406733
+-0.179325 -0.0756952 -0.0405122
+-0.165079 -0.0877097 -0.0231034
+-0.113881 -0.121004 0.00239443
+-0.122018 -0.115295 -0.00799077
+-0.108457 -0.121572 -0.0103429
+-0.101712 -0.125593 -0.00111053
+-0.0848665 -0.125406 -0.020509
+-0.100081 -0.12342 -0.0220229
+-0.104806 -0.11764 -0.0335364
+-0.087781 -0.119879 -0.0320962
+-0.0847238 -0.131707 0.00331111
+-0.0754915 -0.13203 0.00302171
+-0.0856542 -0.134898 0.00959957
+-0.186989 0.336088 0.000843648
+-0.177525 0.356714 0.0187452
+-0.168047 0.355334 0.00252412
+-0.177536 0.336001 -0.0135223
+-0.217297 0.372941 0.0512816
+-0.209614 0.359869 0.0325071
+-0.227885 0.348584 0.0235901
+-0.233774 0.363355 0.0405668
+-0.261867 0.304045 -0.00481002
+-0.244433 0.318201 0.00258623
+-0.243465 0.298557 -0.00891223
+-0.260401 0.281988 -0.0163515
+-0.235135 0.255476 -0.0363519
+-0.238527 0.261875 -0.0279271
+-0.227107 0.289021 -0.0156498
+-0.210676 0.301402 -0.0143645
+-0.216237 0.279617 -0.0322463
+-0.205112 0.380286 0.176683
+-0.213688 0.385582 0.168233
+-0.22541 0.380807 0.174735
+-0.217559 0.373469 0.182225
+-0.255084 0.380725 0.176654
+-0.245928 0.383533 0.172145
+-0.25641 0.390603 0.165307
+-0.264884 0.389386 0.171239
+-0.101989 0.432413 0.059697
+-0.0824768 0.439804 0.0400084
+-0.0905529 0.434945 0.00772115
+-0.110848 0.425868 0.0358939
+-0.0823615 -0.144219 0.013882
+-0.0745284 -0.141969 0.0101019
+-0.0751884 -0.147639 0.015473
+-0.068586 -0.166652 0.0392651
+-0.0753475 -0.168421 0.0413265
+-0.0714432 -0.162409 0.0335098
+-0.0599318 -0.17542 0.0523505
+-0.0711456 -0.173895 0.050853
+-0.0660093 -0.166123 0.0422943
+-0.057695 -0.15819 0.0353704
+-0.0467365 -0.164721 0.0449857
+-0.128643 -0.0960445 -0.0600792
+-0.128088 -0.103035 -0.0475146
+-0.146527 -0.0943217 -0.0476566
+-0.154201 -0.0833406 -0.0638149
+-0.141076 -0.0870251 -0.0676386
+-0.201398 -0.050581 -0.0795814
+-0.196887 -0.0436113 -0.0877141
+-0.182442 -0.0490275 -0.0906157
+-0.180176 -0.0609621 -0.0775904
+-0.190225 -0.0595895 -0.0706118
+-0.165384 -0.0438031 -0.102922
+-0.159659 -0.0411391 -0.106163
+-0.155937 -0.0484391 -0.101744
+-0.131844 -0.0744768 -0.0844713
+-0.136315 -0.0765491 -0.0816025
+-0.139639 -0.0679174 -0.0888219
+-0.105351 -0.0911819 -0.0682065
+-0.11603 -0.0896154 -0.0697081
+-0.123046 -0.0780501 -0.0807643
+-0.128933 -0.0673284 -0.0922894
+-0.15059 -0.0398115 -0.109562
+-0.157915 -0.0356008 -0.107053
+-0.169451 -0.0264852 -0.106955
+-0.168345 -0.0119834 -0.119464
+-0.181448 0.0309252 -0.124676
+-0.183029 0.0421575 -0.139979
+-0.174272 0.0146174 -0.126005
+-0.181221 0.0178453 -0.114847
+-0.211831 0.0082655 -0.091832
+-0.199852 0.00561101 -0.0971205
+-0.207247 -0.00693723 -0.0887605
+-0.217633 -0.00344728 -0.0832147
+-0.153407 0.282136 -0.170242
+-0.164996 0.255486 -0.168139
+-0.170062 0.276821 -0.138773
+-0.175666 0.2242 -0.164752
+-0.186434 0.200812 -0.158689
+-0.189069 0.216308 -0.140696
+-0.195517 0.179177 -0.157753
+-0.196411 0.158307 -0.165009
+-0.202424 0.165609 -0.149742
+-0.205383 0.173885 -0.142312
+-0.286404 0.208653 -0.0455959
+-0.288306 0.224097 -0.0405374
+-0.273788 0.237353 -0.0355356
+-0.266736 0.227716 -0.0400808
+-0.277682 0.207831 -0.0480524
+-0.211995 0.23373 -0.0895495
+-0.206504 0.220431 -0.107291
+-0.220812 0.206498 -0.0980338
+-0.228252 0.215612 -0.0836153
+-0.238553 0.163537 -0.108487
+-0.246081 0.166437 -0.101814
+-0.237775 0.171586 -0.106805
+-0.134191 0.394486 -0.0120233
+-0.148213 0.387213 0.0147782
+-0.146875 0.398597 0.0422268
+-0.133016 0.405985 0.0235082
+-0.161501 0.322461 -0.0987874
+-0.155493 0.33887 -0.0817158
+-0.143274 0.345605 -0.108601
+-0.149682 0.329589 -0.120845
+-0.0998051 0.382889 -0.14875
+-0.120371 0.372844 -0.119717
+-0.116004 0.390037 -0.092088
+-0.0960387 0.400298 -0.122896
+-0.122253 0.328915 -0.176322
+-0.13914 0.304079 -0.173161
+-0.139957 0.323589 -0.149215
+-0.252044 0.0154679 -0.0676072
+-0.241283 0.00424725 -0.0737735
+-0.242974 -0.00135523 -0.0625685
+-0.211969 -0.0501571 -0.0749611
+-0.207843 -0.0533843 -0.0777125
+-0.204785 -0.0575076 -0.0698003
+-0.211984 0.16348 -0.141607
+-0.206385 0.164418 -0.147329
+-0.208662 0.158982 -0.146462
+-0.212846 0.123144 -0.143213
+-0.206939 0.136703 -0.148445
+-0.199556 0.141176 -0.162075
+-0.206954 0.119764 -0.154538
+-0.210226 0.138317 -0.146801
+-0.216245 0.132723 -0.141962
+-0.210982 0.142688 -0.146138
+-0.2415 0.102592 -0.118178
+-0.233206 0.101633 -0.125837
+-0.242733 0.0896031 -0.118886
+-0.252304 0.0924685 -0.109918
+-0.272493 0.1888 -0.06687
+-0.273995 0.172506 -0.0779699
+-0.282245 0.174692 -0.0664332
+-0.27886 0.193324 -0.0578711
+-0.259418 0.165688 -0.0992433
+-0.253962 0.16477 -0.103369
+-0.25899 0.15472 -0.101602
+-0.278609 0.0909826 -0.083829
+-0.268988 0.071176 -0.0915699
+-0.270956 0.0577438 -0.0767583
+-0.285363 0.0823175 -0.0669533
+-0.307475 0.102665 -0.0317146
+-0.302739 0.0853276 -0.037326
+-0.306007 0.078463 -0.0221205
+-0.256352 0.0656834 -0.105586
+-0.251851 0.0667612 -0.108779
+-0.250191 0.0563548 -0.104906
+-0.233988 0.0184152 -0.0919276
+-0.237466 0.0155846 -0.0887236
+-0.239846 0.0278912 -0.0950551
+-0.0373888 -0.309345 0.110418
+-0.0467542 -0.313882 0.121332
+-0.0505117 -0.310639 0.10704
+-0.0441775 -0.305063 0.0981505
+-0.0648647 -0.301617 0.092473
+-0.0627071 -0.308448 0.102667
+-0.0713169 -0.307323 0.109469
+-0.0722425 -0.30023 0.0971137
+-0.0491275 -0.291787 0.0782163
+-0.0569701 -0.290357 0.0766628
+-0.0521929 -0.285824 0.0733489
+-0.10432 -0.227925 0.114396
+-0.101731 -0.235621 0.111227
+-0.104917 -0.239639 0.119702
+-0.10397 -0.201119 0.0992658
+-0.10501 -0.206925 0.105543
+-0.108216 -0.197109 0.103778
+-0.087981 -0.210473 0.0830147
+-0.0950128 -0.202514 0.0860937
+-0.0915119 -0.195916 0.0757843
+-0.0828959 -0.202172 0.0745857
+-0.0858685 -0.248646 0.0855217
+-0.0920498 -0.238158 0.0926511
+-0.0869654 -0.229157 0.0851436
+-0.0802715 -0.239059 0.0798872
+-0.0773228 -0.276086 0.0815397
+-0.0805295 -0.284538 0.0899618
+-0.0885557 -0.275352 0.0960612
+-0.0842938 -0.267406 0.0861722
+-0.0552535 -0.247884 0.0698242
+-0.0650865 -0.237219 0.0723012
+-0.0564364 -0.226699 0.069719
+-0.0444328 -0.237676 0.0699409
+-0.0457993 -0.196693 0.0634142
+-0.056992 -0.207452 0.0660817
+-0.0667956 -0.200173 0.0652148
+-0.0582042 -0.19037 0.0603727
+-0.283596 0.364113 0.039788
+-0.300553 0.380979 0.052928
+-0.282043 0.375142 0.0514045
+-0.236494 0.318517 0.183078
+-0.232399 0.315696 0.199792
+-0.22779 0.324249 0.204928
+-0.232172 0.325412 0.193769
+-0.220489 0.342414 0.200538
+-0.213265 0.351813 0.195759
+-0.222552 0.355416 0.192607
+-0.233753 0.350246 0.194227
+-0.229987 0.341534 0.198468
+-0.17447 0.380851 0.18228
+-0.187727 0.369004 0.189526
+-0.180525 0.368457 0.194384
+-0.164129 0.381637 0.188752
+-0.297845 0.296315 -0.0112364
+-0.310153 0.310793 -0.00685157
+-0.295457 0.32617 0.00530352
+-0.281796 0.311702 -0.000892793
+-0.348859 0.353135 0.015843
+-0.360631 0.342407 0.00627412
+-0.367584 0.358938 0.0195036
+-0.359857 0.371324 0.0299829
+-0.357935 0.418763 0.0769085
+-0.34441 0.402911 0.0635712
+-0.358006 0.398389 0.0561483
+-0.365892 0.412979 0.070132
+-0.325647 0.397093 0.0852426
+-0.320106 0.378366 0.0686713
+-0.306841 0.367904 0.0713265
+-0.310938 0.385552 0.0883271
+-0.363382 0.416397 0.0814134
+-0.36809 0.411019 0.0724821
+-0.36463 0.395918 0.0614655
+-0.356492 0.401717 0.0713435
+-0.360363 0.349181 0.024016
+-0.366298 0.368029 0.035726
+-0.369747 0.356558 0.0227061
+-0.365938 0.338653 0.012508
+-0.326789 0.313489 0.0144505
+-0.326008 0.294556 0.00262036
+-0.320075 0.307329 0.0147604
+-0.268547 0.361052 0.171563
+-0.262873 0.352211 0.164327
+-0.256737 0.350405 0.178552
+-0.263541 0.359432 0.182282
+-0.26058 0.363151 0.186517
+-0.250578 0.359791 0.18891
+-0.256845 0.36909 0.184663
+-0.266612 0.372259 0.183475
+-0.242086 0.339724 0.184549
+-0.238761 0.333804 0.174734
+-0.233706 0.331574 0.189527
+-0.235 0.336929 0.194973
+-0.214525 0.339294 0.206801
+-0.217801 0.331039 0.211701
+-0.205937 0.328621 0.223353
+-0.192906 0.340807 0.221157
+-0.198781 0.347945 0.208106
+-0.354549 0.290329 -0.0240098
+-0.354693 0.307326 -0.0161515
+-0.341245 0.297134 -0.0207649
+-0.343663 0.27955 -0.0289755
+-0.35689 0.288301 -0.0194647
+-0.349926 0.27664 -0.021298
+-0.352209 0.293269 -0.0112418
+-0.360145 0.303914 -0.00888151
+-0.317316 0.237752 -0.0290738
+-0.326212 0.256223 -0.0207151
+-0.333889 0.253017 -0.0271251
+-0.324801 0.238562 -0.0334005
+-0.310917 0.256725 -0.0303126
+-0.307095 0.237648 -0.0367533
+-0.320659 0.238635 -0.0373198
+-0.325878 0.253733 -0.0340811
+-0.335546 0.424824 0.0932565
+-0.35307 0.430754 0.0924347
+-0.355675 0.438096 0.103853
+-0.342694 0.435946 0.108547
+-0.349535 0.433276 0.112384
+-0.357965 0.436153 0.105575
+-0.358522 0.428429 0.0964735
+-0.347612 0.423491 0.100114
+-0.295121 0.390592 0.138656
+-0.303574 0.400305 0.137556
+-0.300859 0.392435 0.123564
+-0.291069 0.381148 0.124545
+-0.292069 0.397796 0.173506
+-0.28256 0.389656 0.176585
+-0.283101 0.396303 0.172769
+-0.294009 0.405022 0.170347
+-0.29488 0.393543 0.160081
+-0.288368 0.386447 0.168472
+-0.294942 0.396161 0.1712
+-0.301452 0.402836 0.16581
+-0.18922 0.302814 -0.0512352
+-0.189009 0.28809 -0.0770757
+-0.200921 0.268026 -0.0764532
+-0.202058 0.283325 -0.0539416
+-0.0516386 0.430398 -0.138784
+-0.0726595 0.424438 -0.11696
+-0.0711831 0.435132 -0.080608
+-0.04938 0.440197 -0.10733
+0.00847266 -0.0987638 -0.0115169
+-0.0124261 -0.104972 -0.010676
+-0.0113681 -0.100224 -0.0194203
+-0.0495862 -0.106712 -0.0376945
+-0.0730868 -0.110954 -0.0419838
+-0.0796797 -0.104906 -0.0522509
+-0.0602894 -0.104058 -0.0479603
+-0.16556 0.345609 0.237131
+-0.159621 0.336317 0.251328
+-0.148021 0.348062 0.249051
+-0.150911 0.358299 0.234702
+-0.193595 0.0286612 -0.119708
+-0.195328 0.0373086 -0.127361
+-0.187627 0.0307887 -0.124866
+-0.212887 0.0594427 -0.13669
+-0.221756 0.0677789 -0.13579
+-0.216562 0.0667311 -0.140344
+-0.199989 0.0648206 -0.150666
+-0.21164 0.0702477 -0.142451
+-0.218025 0.0816328 -0.140562
+-0.210571 0.0911225 -0.152566
+-0.123058 0.403628 0.193004
+-0.132549 0.392686 0.204739
+-0.122652 0.386657 0.2209
+-0.109422 0.39941 0.209204
+-0.136403 -0.114108 0.0464662
+-0.145791 -0.102855 0.0375219
+-0.110119 -0.176607 0.0743216
+-0.104995 -0.181354 0.0672707
+-0.107263 -0.182553 0.0768095
+-0.126962 -0.144812 0.0592001
+-0.130995 -0.134143 0.0550084
+-0.112389 -0.170886 0.0717667
+-0.115666 -0.164424 0.0670932
+-0.101733 0.421639 0.15344
+-0.128933 0.414578 0.142085
+-0.15291 0.405351 0.128517
+-0.162341 0.403937 0.112336
+-0.176458 0.399649 0.121448
+-0.199996 0.397954 0.121364
+-0.223577 0.397217 0.122349
+-0.247803 0.398244 0.12432
+-0.276379 0.408897 0.132765
+-0.307409 0.42752 0.146642
+-0.325174 0.43714 0.154603
+-0.328625 0.435117 0.154837
+-0.323082 0.425343 0.149024
+-0.302602 0.165146 0.00448444
+-0.295507 0.205024 0.015443
+-0.196779 -0.0620399 -6.27958e-005
+-0.1824 -0.074569 -0.00366536
+-0.178094 -0.078149 0.0127202
+-0.155009 -0.0958875 0.0173685
+-0.162119 -0.0907703 -0.00015972
+-0.14159 -0.104852 0.00639698
+-0.133593 -0.107598 -0.0189152
+-0.136847 -0.10734 -0.00264425
+-0.151088 -0.0975529 -0.0160682
+-0.128268 -0.128093 0.0424438
+-0.114703 -0.130644 0.0260132
+-0.119178 -0.136324 0.034808
+-0.111655 -0.125277 0.0140649
+-0.127729 -0.113522 0.00702903
+-0.115583 -0.117054 -0.0213062
+-0.095395 -0.126543 -0.0115114
+-0.0897277 -0.128436 -0.00435885
+-0.0978632 -0.12976 0.00773958
+-0.187772 0.398974 0.109613
+-0.188886 0.390601 0.0800619
+-0.204807 0.343709 0.0155413
+-0.192588 0.371015 0.043983
+-0.185687 0.359016 0.0263271
+-0.224712 0.31098 -0.00355138
+-0.243857 0.277094 -0.0194435
+-0.235644 0.39689 0.113147
+-0.237733 0.390159 0.0885728
+-0.227084 0.383019 0.0707729
+-0.202389 0.382206 0.0648687
+-0.235365 0.39587 0.131701
+-0.235224 0.392432 0.149206
+-0.235198 0.386791 0.166068
+-0.23683 0.375369 0.17977
+-0.139163 0.41245 0.125592
+-0.130916 0.419108 0.106506
+-0.147044 0.41075 0.10789
+-0.0927173 0.433344 0.102799
+-0.10366 0.432352 0.0852945
+-0.117578 0.425841 0.0994713
+-0.291243 0.223604 0.0309174
+-0.285395 0.238959 0.058153
+-0.289293 0.248877 0.0380672
+-0.276013 0.281855 0.0770184
+-0.277207 0.258414 0.0787275
+-0.272465 0.266261 0.0911126
+-0.261872 0.27638 0.124623
+-0.260019 0.294528 0.119365
+-0.264039 0.275389 0.114387
+-0.0914833 -0.13899 0.0165453
+-0.108818 -0.139304 0.0277428
+-0.101043 -0.134694 0.0182026
+-0.091187 -0.141493 0.0169938
+-0.0941125 -0.151751 0.0269974
+-0.117056 -0.15959 0.0550323
+-0.10275 -0.160968 0.0413415
+-0.0803875 -0.1734 0.0483548
+-0.0884213 -0.16635 0.0409538
+-0.0277489 -0.135159 0.0170689
+-0.0435359 -0.132678 0.00987601
+-0.0217731 -0.124756 0.00868971
+-0.0656967 -0.160136 0.0329562
+-0.0719196 -0.171051 0.0462505
+-0.0680925 -0.153348 0.0228795
+-0.0811213 -0.156989 0.0278199
+-0.0803622 -0.138686 0.0105517
+-0.0688181 -0.138673 0.0103217
+-0.068427 -0.144835 0.0144464
+-0.0636422 -0.151182 0.0242003
+-0.0579127 -0.142169 0.0155447
+-0.0456628 -0.147758 0.0260876
+-0.142042 -0.100756 -0.0321979
+-0.158703 -0.0910345 -0.0288417
+-0.164444 -0.0836205 -0.0471631
+-0.170365 -0.0750222 -0.0617911
+-0.163705 -0.0685522 -0.0785541
+-0.175064 -0.0398518 -0.101791
+-0.167942 -0.0540962 -0.092359
+-0.131773 -0.0857494 -0.0730513
+-0.147736 -0.074569 -0.0794101
+-0.132155 -0.0672123 -0.0890431
+-0.126119 -0.0830696 -0.0766457
+-0.143608 -0.0565186 -0.0971014
+-0.152643 -0.0607034 -0.0916102
+-0.167036 -0.0361386 -0.106163
+-0.149503 -0.0455089 -0.102903
+-0.138618 -0.0553596 -0.0969035
+-0.176628 -0.0042336 -0.11024
+-0.175991 -0.0350882 -0.10228
+-0.189776 -0.0346732 -0.0948094
+-0.182242 -0.0218744 -0.100602
+-0.195655 -0.0149246 -0.0945759
+-0.201402 -0.0298359 -0.0886492
+-0.21204 -0.0204445 -0.0826195
+-0.198762 0.191677 -0.141043
+-0.251038 0.255077 -0.0289277
+-0.257129 0.232099 -0.0396173
+-0.216773 0.194346 -0.112213
+-0.231349 0.183555 -0.103004
+-0.237208 0.192242 -0.0909686
+-0.128587 0.421431 0.091559
+-0.116975 0.426888 0.075744
+-0.134784 0.416319 0.0726165
+-0.144995 0.412081 0.0892997
+-0.143908 0.407802 0.0643056
+-0.156297 0.39305 0.0547054
+-0.154739 0.402788 0.0775153
+-0.178846 0.382206 0.058925
+-0.162879 0.385072 0.0516236
+-0.173401 0.371004 0.037072
+-0.149967 0.372444 -0.0167617
+-0.160131 0.366487 0.00533833
+-0.157536 0.382854 0.0343363
+-0.137332 0.363617 -0.0873128
+-0.129746 0.353044 -0.132928
+-0.123274 0.349022 -0.151737
+-0.101012 0.362641 -0.176055
+-0.212758 -0.0459259 -0.0241163
+-0.224159 -0.0322822 -0.0467201
+-0.207122 -0.0523222 -0.0479139
+-0.193439 -0.0648281 -0.0253545
+-0.191076 -0.0645374 -0.0594328
+-0.177804 -0.0727315 -0.0543771
+-0.194913 -0.0643913 -0.0593871
+-0.201677 -0.0593137 -0.0549511
+-0.216976 -0.0374853 -0.0773631
+-0.224369 -0.0268148 -0.0713592
+-0.217469 -0.0261882 -0.0774907
+-0.208584 -0.0371243 -0.0829389
+-0.211621 -0.045801 -0.0801431
+-0.199846 -0.0577315 -0.0716063
+-0.21793 -0.0408429 -0.0757823
+-0.212747 -0.0478071 -0.0628054
+-0.222991 -0.0335306 -0.0669328
+-0.211751 0.183183 -0.127183
+-0.214211 0.171175 -0.133324
+-0.224161 0.176534 -0.117312
+-0.208522 0.16823 -0.142425
+-0.203031 0.160242 -0.149995
+-0.201125 0.15257 -0.153843
+-0.205146 0.146045 -0.149332
+-0.214136 0.129294 -0.142497
+-0.216057 0.168056 -0.134039
+-0.221977 0.154292 -0.131161
+-0.228564 0.160832 -0.120403
+-0.205524 0.153026 -0.149687
+-0.215778 0.147275 -0.140559
+-0.22231 0.120589 -0.136031
+-0.233901 0.112732 -0.124962
+-0.224945 0.129902 -0.132706
+-0.251747 0.184739 -0.0848371
+-0.245577 0.17754 -0.0950851
+-0.258683 0.176029 -0.0890288
+-0.265375 0.183873 -0.0767535
+-0.253767 0.172075 -0.0975396
+-0.253173 0.154292 -0.1014
+-0.260953 0.13872 -0.0987682
+-0.272504 0.118617 -0.0902731
+-0.269732 0.140066 -0.0921098
+-0.262136 0.173276 -0.0912341
+-0.270394 0.156939 -0.0885366
+-0.307563 0.130437 -0.01726
+-0.301451 0.130853 -0.0434595
+-0.277813 0.140385 -0.0819594
+-0.282277 0.11657 -0.0788033
+-0.290175 0.13221 -0.0647691
+-0.284692 0.156642 -0.0687375
+-0.289515 0.0610966 -0.044843
+-0.296341 0.10749 -0.0552979
+-0.258256 0.13697 -0.0975157
+-0.248024 0.14671 -0.101574
+-0.257567 0.120708 -0.0981874
+-0.268797 0.11293 -0.0919761
+-0.232811 0.135392 -0.121682
+-0.241337 0.113313 -0.11643
+-0.249697 0.120702 -0.105137
+-0.239408 0.145447 -0.11048
+-0.258964 0.103153 -0.101327
+-0.261764 0.0839071 -0.104474
+-0.270877 0.0931306 -0.0938374
+-0.256068 0.0773006 -0.108883
+-0.246504 0.0728271 -0.110373
+-0.244044 0.0596045 -0.10642
+-0.256184 0.0355571 -0.0818543
+-0.27017 0.0370021 -0.0571285
+-0.26257 0.0765423 -0.104023
+-0.258456 0.0549706 -0.0955356
+-0.241498 0.0436728 -0.101732
+-0.248508 0.0401364 -0.0962803
+-0.226995 -0.00364796 -0.0788968
+-0.220356 -0.0154597 -0.0773521
+-0.227567 -0.0159307 -0.0718439
+-0.232588 0.00175794 -0.0808462
+-0.244546 0.0203005 -0.0852828
+-0.232353 0.0287636 -0.0959499
+-0.223184 0.0154194 -0.0908642
+-0.228205 0.00602533 -0.0852214
+-0.0457263 -0.315367 0.13967
+-0.0551204 -0.315059 0.13463
+-0.0595147 -0.312721 0.115796
+-0.0554712 -0.305562 0.0963342
+-0.0514072 -0.29988 0.0883025
+-0.0378795 -0.297305 0.0881039
+-0.0577919 -0.298935 0.0867169
+-0.0658523 -0.292232 0.082296
+-0.107985 -0.216112 0.116399
+-0.101299 -0.218034 0.104655
+-0.10266 -0.194367 0.0892294
+-0.09807 -0.20982 0.0953404
+-0.0973287 -0.227972 0.10006
+-0.0973048 -0.246739 0.104064
+-0.0696528 -0.284426 0.078862
+-0.0709565 -0.268147 0.0748403
+-0.0619276 -0.277532 0.0719169
+-0.0911283 -0.257591 0.0938661
+-0.078948 -0.258634 0.0797978
+-0.063561 -0.258524 0.0710678
+-0.042994 -0.259062 0.0684768
+-0.0534877 -0.26948 0.0685464
+-0.0309665 -0.245506 0.0714432
+-0.0316668 -0.23155 0.0713524
+-0.10015 -0.189982 0.0760662
+-0.0971001 -0.185726 0.0645937
+-0.0874984 -0.18939 0.0652524
+-0.0794039 -0.17479 0.050883
+-0.0807991 -0.181948 0.0570923
+-0.0907167 -0.180323 0.0565715
+-0.0694856 -0.185045 0.0585414
+-0.04646 -0.180163 0.056149
+-0.0736629 -0.228124 0.0752171
+-0.0725025 -0.248424 0.0752888
+-0.0927235 -0.219225 0.0907229
+-0.0810803 -0.21933 0.079008
+-0.0743141 -0.209535 0.072035
+-0.0769044 -0.19399 0.0657301
+-0.0657841 -0.217523 0.0702392
+-0.0452389 -0.216978 0.0682413
+-0.24201 0.375209 0.0586595
+-0.250936 0.353609 0.0316894
+-0.259477 0.369811 0.0504134
+-0.225095 0.330868 0.00884192
+-0.246536 0.337258 0.0161788
+-0.269853 0.21165 -0.048522
+-0.283095 0.196802 -0.0522086
+-0.253194 0.290666 0.150049
+-0.251859 0.300993 0.13885
+-0.259197 0.281414 0.134683
+-0.237157 0.305745 0.194429
+-0.228537 0.311369 0.210728
+-0.229123 0.365303 0.186857
+-0.210494 0.365639 0.188059
+-0.188994 0.396316 0.131013
+-0.190284 0.391235 0.151177
+-0.224113 0.38959 0.158664
+-0.201964 0.388693 0.160349
+-0.198947 0.373394 0.18401
+-0.183308 0.380877 0.178658
+-0.192075 0.384623 0.170355
+-0.202157 0.355439 0.195967
+-0.201677 0.364408 0.189767
+-0.302909 0.359287 0.0317515
+-0.269404 0.344895 0.0236972
+-0.291279 0.339811 0.016501
+-0.335203 0.333222 0.00270432
+-0.327245 0.356624 0.0235805
+-0.310269 0.336977 0.0104521
+-0.344329 0.378725 0.039904
+-0.367628 0.388788 0.0458075
+-0.304248 0.347938 0.0556453
+-0.291707 0.343209 0.0718514
+-0.295768 0.36377 0.0817206
+-0.36999 0.386649 0.048593
+-0.357517 0.376413 0.0481582
+-0.333874 0.359881 0.0451024
+-0.327513 0.336779 0.0305631
+-0.315137 0.343387 0.0431564
+-0.322088 0.366681 0.0567278
+-0.266385 0.35146 0.145775
+-0.264982 0.346394 0.135678
+-0.258217 0.345209 0.153036
+-0.240303 0.360292 0.189095
+-0.244077 0.350509 0.192648
+-0.247729 0.346562 0.188944
+-0.250395 0.343001 0.170331
+-0.238588 0.342939 0.195326
+-0.228895 0.335432 0.200898
+-0.221544 0.322042 0.214219
+-0.225093 0.330781 0.205983
+-0.210678 0.346525 0.201114
+-0.222985 0.336238 0.203908
+-0.239505 0.321303 0.163247
+-0.244515 0.314629 0.149266
+-0.242928 0.308264 0.168692
+-0.235322 0.326738 0.178782
+-0.229517 0.330708 0.199806
+-0.238322 0.328743 0.159328
+-0.244973 0.33651 0.156096
+-0.242801 0.328353 0.14297
+-0.312193 0.320666 0.03003
+-0.314303 0.28502 0.00417933
+-0.306935 0.292602 0.0202762
+-0.34866 0.324848 -0.00514107
+-0.363612 0.324276 -0.00486531
+-0.371179 0.374205 0.0341022
+-0.368514 0.34153 0.0087764
+-0.348291 0.354193 0.0338142
+-0.352467 0.328894 0.0124554
+-0.339804 0.332111 0.020453
+-0.365667 0.322131 -0.00102931
+-0.358977 0.320427 0.00364147
+-0.333685 0.277654 -0.0115456
+-0.320038 0.269889 -0.00921801
+-0.341493 0.288791 -0.00885899
+-0.337852 0.310726 0.006412
+-0.350099 0.311703 0.00166682
+-0.264148 0.325574 0.00873886
+-0.2783 0.288219 -0.013095
+-0.258033 0.26068 -0.0260528
+-0.276418 0.26109 -0.025618
+-0.332979 0.316058 -0.00850337
+-0.323369 0.291646 -0.0193213
+-0.314096 0.279298 -0.0220632
+-0.294784 0.27132 -0.0220447
+-0.339347 0.261761 -0.0333412
+-0.328423 0.27369 -0.0279448
+-0.340741 0.271671 -0.0186879
+-0.342478 0.260477 -0.0290301
+-0.349893 0.273652 -0.0284615
+-0.361992 0.305181 -0.0138396
+-0.301507 0.22178 -0.0410159
+-0.292192 0.245112 -0.0328101
+-0.295715 0.212253 -0.0420807
+-0.286236 0.200552 -0.0476982
+-0.292183 0.202865 -0.0402303
+-0.306298 0.222227 -0.036455
+-0.301429 0.222278 -0.0277039
+-0.310677 0.244756 -0.0208045
+-0.313845 0.227146 -0.0384931
+-0.332523 0.247401 -0.0343623
+-0.322702 0.381734 0.0483029
+-0.327581 0.403629 0.0688945
+-0.252889 0.386083 0.0777699
+-0.271721 0.386 0.0707497
+-0.28615 0.40196 0.0917979
+-0.324944 0.41021 0.077632
+-0.310557 0.41216 0.0909195
+-0.295411 0.39404 0.0709333
+-0.295204 0.420233 0.132545
+-0.301824 0.418908 0.113649
+-0.345384 0.443225 0.123458
+-0.323917 0.429029 0.111775
+-0.332954 0.441285 0.150277
+-0.343122 0.444711 0.13518
+-0.348139 0.440931 0.12476
+-0.337198 0.425847 0.118197
+-0.316051 0.400219 0.105629
+-0.298328 0.377166 0.0971362
+-0.303839 0.391255 0.113032
+-0.31891 0.41815 0.140089
+-0.322869 0.415105 0.122994
+-0.30982 0.403173 0.125572
+-0.332029 0.412225 0.101434
+-0.343288 0.411462 0.0875257
+-0.344503 0.382556 0.0594396
+-0.331038 0.384698 0.0672802
+-0.345978 0.404934 0.0790258
+-0.370193 0.402204 0.0605481
+-0.367237 0.422103 0.0814407
+-0.364511 0.426989 0.089884
+-0.354923 0.41747 0.087063
+-0.36224 0.434435 0.0971465
+-0.354189 0.441753 0.114975
+-0.362513 0.428899 0.0879012
+-0.344247 0.41859 0.0801213
+-0.246182 0.391375 0.157595
+-0.269101 0.397958 0.160058
+-0.290056 0.415193 0.145993
+-0.284266 0.407671 0.157506
+-0.277614 0.398481 0.167639
+-0.271545 0.387089 0.175829
+-0.247461 0.371033 0.183043
+-0.263595 0.378974 0.179593
+-0.282806 0.374165 0.135981
+-0.287593 0.370167 0.108749
+-0.278701 0.364856 0.123063
+-0.268696 0.355771 0.145142
+-0.270927 0.362184 0.161904
+-0.275839 0.367404 0.149707
+-0.273165 0.360636 0.133942
+-0.288612 0.384204 0.149186
+-0.30048 0.399116 0.151345
+-0.3147 0.414697 0.145352
+-0.30671 0.406078 0.149911
+-0.304534 0.413619 0.168448
+-0.291519 0.408469 0.16559
+-0.323577 0.432258 0.159744
+-0.312871 0.420454 0.166256
+-0.307801 0.412133 0.167165
+-0.306289 0.407003 0.158651
+-0.277078 0.379746 0.179924
+-0.271868 0.381785 0.179423
+-0.286711 0.388082 0.17595
+-0.300822 0.405755 0.170538
+-0.280108 0.37774 0.176373
+-0.281562 0.376649 0.161614
+-0.274378 0.368531 0.170983
+-0.254208 0.35432 0.188905
+-0.27062 0.369579 0.182362
+-0.151893 0.356178 -0.0513178
+-0.166999 0.333363 -0.053272
+-0.162665 0.352535 -0.0200319
+-0.176728 0.323421 -0.0441263
+-0.188859 0.315183 -0.0266582
+-0.205088 0.324126 0.000587687
+-0.194955 0.314796 -0.0152689
+-0.245922 0.196713 -0.0814134
+-0.257351 0.200281 -0.0697784
+-0.237276 0.223437 -0.0683778
+-0.256565 0.227037 -0.044327
+-0.23924 0.237366 -0.0522618
+-0.260626 0.210396 -0.0574889
+-0.218157 0.263167 -0.0513793
+-0.200253 0.298423 -0.032062
+-0.19741 0.251225 -0.0996303
+-0.216891 0.247541 -0.0707968
+-0.18023 0.246404 -0.139158
+-0.20223 0.205665 -0.124602
+-0.193054 0.234143 -0.120221
+-0.171542 0.293637 -0.118089
+-0.184338 0.265947 -0.115444
+-0.183911 0.28489 -0.0966025
+-0.172577 0.318492 -0.0704658
+-0.168174 0.307756 -0.106868
+-0.18044 0.299809 -0.0839471
+-0.136672 0.339125 -0.137934
+-0.154348 0.316417 -0.128538
+-0.156104 0.301624 -0.142863
+-0.114119 0.416768 -0.00234392
+-0.131077 0.414749 0.0534181
+-0.0927801 0.427163 -0.0405886
+-0.0683635 0.442259 -0.0321187
+-0.134872 0.380187 -0.0529021
+-0.114897 0.404646 -0.0496333
+-0.093662 0.415372 -0.088454
+-0.0746867 0.410255 -0.146943
+-0.019122 -0.115522 0.000298963
+-0.0486654 -0.122391 -0.00287291
+-0.0423114 -0.114306 -0.0133475
+-0.0842583 -0.128304 -0.0100473
+-0.0666837 -0.122224 -0.0168559
+-0.0689143 -0.126937 -0.00583523
+-0.0925126 -0.111931 -0.0445632
+-0.0681082 -0.116908 -0.0297311
+-0.12264 -0.110844 -0.0336715
+-0.110204 -0.109271 -0.0463099
+-0.125591 -0.0896659 -0.0692986
+-0.113626 -0.0995781 -0.0584397
+-0.0980905 -0.102148 -0.0564056
+-0.0886192 -0.0959107 -0.0620825
+-0.0424814 -0.109054 -0.0257053
+-0.020494 -0.0987379 -0.0319255
+-0.0735469 -0.0978778 -0.0576629
+-0.042323 -0.0989426 -0.0449072
+-0.0236924 -0.0960015 -0.0427093
+-0.196379 0.322083 0.236634
+-0.209122 0.318949 0.228152
+-0.168922 0.325921 0.253494
+-0.158013 0.326876 0.261278
+-0.188231 0.00219273 -0.102888
+-0.189284 0.0172364 -0.108596
+-0.233547 0.0450591 -0.101835
+-0.235724 0.0621709 -0.110428
+-0.222628 0.0466467 -0.11022
+-0.221178 0.0293212 -0.0989914
+-0.207309 0.0336493 -0.113419
+-0.192893 0.0202199 -0.110529
+-0.20758 0.0206056 -0.101683
+-0.223701 0.0612979 -0.124035
+-0.234508 0.0731766 -0.121091
+-0.228681 0.0763655 -0.133122
+-0.209541 0.0479716 -0.126564
+-0.199567 0.0487818 -0.13533
+-0.206036 0.0598755 -0.139626
+-0.221907 0.0743301 -0.138939
+-0.184943 0.024144 -0.117257
+-0.188043 0.0392054 -0.130239
+-0.193681 0.0510451 -0.137921
+-0.223716 0.0928719 -0.134181
+-0.227285 0.080179 -0.133952
+-0.235498 0.0869418 -0.125441
+-0.221334 0.117878 -0.135773
+-0.221903 0.105667 -0.134879
+-0.215263 0.102826 -0.142525
+-0.157463 0.393841 0.168579
+-0.179765 0.388602 0.162583
+-0.171512 0.386387 0.174013
+-0.142335 0.407407 0.144651
+-0.145019 0.401803 0.163689
+-0.0888322 0.417729 0.18067
+-0.0872049 0.421129 0.169446
+-0.134623 0.403892 0.178183
+-0.107065 0.411512 0.18715
+-0.10468 0.337516 0.280235
+-0.0960414 0.36617 0.254674
+-0.114642 0.350925 0.265869
+-0.145515 0.337617 0.262401
+-0.134532 0.34967 0.258949
+-0.13773 0.360191 0.244669
+-0.13105 0.371466 0.236157
+-0.124199 0.362204 0.250801
+-0.11133 0.377061 0.23806
+-0.198346 0.354739 0.19916
+-0.178825 0.362121 0.205519
+-0.181498 0.333394 0.237557
+-0.173899 0.354026 0.220602
+-0.154273 0.369254 0.218136
+-0.138383 0.370144 0.231648
+-0.139724 0.382997 0.213139
+-0.158479 0.377662 0.201933
+-0.142551 0.39023 0.198923
+-0.148419 0.394276 0.182718
+-0.0811963 -0.29325 0.102234
+-0.072553 -0.291213 0.0868002
+-0.0796135 -0.303285 0.118945
+-0.071863 -0.310554 0.124174
+-0.0957267 -0.267441 0.105991
+-0.0921918 -0.2795 0.109202
+-0.0763931 0.393544 -0.174942
+-0.0524638 0.418452 -0.168312
+-0.0288301 0.434205 -0.159856
+-0.0885578 0.437301 0.0749058
+-0.127872 0.337564 0.27379
+-0.24283 0.0820704 -0.118105
+-0.0607003 -0.131271 0.00531717
+-0.229049 -0.0216765 -0.0634388
+-0.278184 0.102244 -0.0844372
+-0.0411429 -0.280235 0.0717415
+-0.243868 -0.00883134 -0.0421476
+-0.14013 0.324597 0.278037
+-0.133037 0.306627 0.296365
+-0.119533 0.321803 0.289708
+-0.183859 0.0314754 0.317927
+-0.17307 0.0370321 0.336741
+-0.182177 0.0503871 0.319341
+0.00738397 -0.0926965 -0.0296929
+-0.28472 0.357619 0.0971123
+-0.284296 0.231243 0.0785733
+-0.28289 0.267424 0.0594908
+-0.305829 0.254203 -0.00648571
+-0.0595686 0.446749 0.0102896
+-0.0353172 0.450815 -0.0238085
+-0.0444581 0.447487 -0.0668011
+-0.0892301 0.409578 0.201813
+-0.0660564 0.416809 0.19468
+-0.0731025 0.381142 0.244324
+-0.0921801 0.391528 0.2268
+-0.182146 0.311229 0.256012
+-0.294119 0.154179 -0.0525171
+-0.202301 -0.0560592 0.0374413
+-0.228915 -0.0300918 0.0373847
+-0.242139 -0.0191442 0.0126554
+-0.217104 -0.0432196 0.00850678
+-0.157247 -0.0937674 0.0691989
+-0.185622 -0.0678027 0.0678447
+-0.169396 -0.083572 0.0393716
+-0.139594 -0.123148 0.0845395
+-0.126106 -0.146346 0.0758997
+-0.123257 -0.150769 0.0928532
+-0.112244 -0.227867 0.132679
+-0.109066 -0.245742 0.133403
+-0.112008 -0.255691 0.153808
+-0.1008 -0.281164 0.182513
+-0.103725 -0.276332 0.157148
+-0.0715879 -0.289321 0.201118
+-0.0514257 -0.298848 0.197532
+-0.0375744 -0.288942 0.213494
+-0.0285919 -0.15432 0.0392563
+-0.00511172 -0.141791 0.0317269
+-0.0300225 -0.185298 0.0605645
+-0.0297748 -0.170034 0.0520932
+-0.0117148 -0.175566 0.0588328
+-0.011179 -0.257161 0.0740909
+-0.0272056 -0.271061 0.0709142
+-0.102623 -0.255398 0.118178
+-0.0136151 -0.296751 0.0949862
+-0.0270773 -0.302751 0.102378
+-0.026693 -0.290202 0.0819124
+-0.0907406 0.300471 0.308329
+-0.0809151 0.318476 0.297312
+-0.0970844 0.320623 0.294065
+-0.103784 0.153961 0.380762
+-0.0903154 0.178113 0.375334
+-0.100696 0.203514 0.3627
+-0.114144 0.179635 0.369417
+-0.104096 0.107271 0.394594
+-0.0912744 0.128962 0.390989
+-0.116286 0.131188 0.383989
+-0.10836 0.0396313 0.425974
+-0.0940777 0.0569691 0.42091
+-0.105322 0.0731875 0.410481
+-0.119434 0.0567439 0.414668
+-0.112878 -0.0346452 0.462139
+-0.097999 -0.0151471 0.456411
+-0.110536 0.00280431 0.444113
+-0.125305 -0.0168692 0.448974
+-0.114938 -0.103691 0.490215
+-0.10138 -0.0899526 0.489866
+-0.114265 -0.0719732 0.479791
+-0.127792 -0.0866995 0.47991
+-0.114041 -0.123268 0.494364
+-0.10156 -0.115812 0.496424
+-0.127413 -0.111455 0.487513
+-0.154895 0.311513 0.277246
+-0.181382 0.250416 0.306515
+-0.201772 0.238001 0.294917
+-0.193032 0.222872 0.315164
+-0.176595 0.230257 0.323969
+-0.148628 0.18672 0.356413
+-0.158402 0.160689 0.356142
+-0.146851 0.151196 0.365277
+-0.135466 0.176775 0.364392
+-0.219862 0.200745 0.302651
+-0.212954 0.190626 0.315709
+-0.199022 0.19328 0.325516
+-0.20334 0.206272 0.316453
+-0.146853 0.0732127 0.391732
+-0.15079 0.0541412 0.398035
+-0.142514 0.0580455 0.404334
+-0.16297 -0.0111295 0.408454
+-0.158881 0.0117152 0.406561
+-0.161948 0.0194548 0.390374
+-0.165126 0.000112964 0.389451
+-0.161052 -0.0845399 0.450915
+-0.164264 -0.0750106 0.43922
+-0.165397 -0.0885479 0.436913
+-0.163253 -0.0963134 0.447834
+-0.163574 -0.111352 0.453134
+-0.161533 -0.103175 0.455958
+-0.164479 -0.105909 0.444184
+-0.189446 -0.0461914 0.337856
+-0.17488 -0.0165907 0.355185
+-0.18565 -0.0167047 0.31601
+-0.199176 -0.0456181 0.296044
+-0.167308 -0.104911 0.416859
+-0.168204 -0.0967305 0.413866
+-0.170579 -0.0900755 0.404111
+-0.170506 -0.102803 0.409934
+-0.209442 -0.139353 0.336083
+-0.20596 -0.1664 0.326336
+-0.201529 -0.166883 0.35484
+-0.201742 -0.139896 0.365726
+-0.201044 -0.0427636 0.260918
+-0.204477 -0.0720162 0.254223
+-0.207965 -0.0760686 0.287485
+-0.202126 -0.0134209 0.244899
+-0.200155 -0.0388723 0.233824
+-0.196369 -0.0156556 0.275553
+-0.263691 0.209775 0.215145
+-0.277035 0.16953 0.203192
+-0.264392 0.186434 0.227349
+-0.245523 0.221014 0.243934
+-0.262644 0.0942958 0.228674
+-0.268302 0.110784 0.226747
+-0.268735 0.100708 0.216347
+-0.238334 0.0567384 0.248252
+-0.251642 0.0825918 0.246642
+-0.250733 0.0683693 0.227328
+-0.251735 0.184936 0.261131
+-0.238668 0.18855 0.28449
+-0.232852 0.203646 0.280639
+-0.218864 0.249638 0.264161
+-0.226421 0.220016 0.275415
+-0.249297 0.282358 0.177707
+-0.294765 0.221995 0.0114964
+-0.233682 -0.0020569 0.0864541
+-0.217388 -0.0225522 0.100406
+-0.236473 0.00833853 0.105687
+-0.250077 0.0289581 0.0923201
+-0.195529 -0.0495408 0.101851
+-0.178604 -0.0660916 0.12024
+-0.201195 -0.0379235 0.121975
+-0.190872 -0.0652964 0.196491
+-0.175808 -0.0720114 0.166552
+-0.180922 -0.101446 0.187621
+-0.185822 -0.130817 0.21313
+-0.196627 -0.0994034 0.21715
+-0.181726 -0.207592 0.28389
+-0.197306 -0.189034 0.287876
+-0.186596 -0.185007 0.261528
+-0.16844 -0.218145 0.306887
+-0.186652 -0.208318 0.309972
+-0.196175 0.0314139 0.295711
+-0.188706 0.0185913 0.304876
+-0.205344 0.0483306 0.28973
+-0.215455 0.0410121 0.271619
+-0.206428 0.0269002 0.272827
+-0.170737 -0.112769 0.412791
+-0.173883 -0.12972 0.409207
+-0.167239 -0.129023 0.420305
+-0.166777 -0.116533 0.420329
+-0.201239 0.122865 0.312643
+-0.196588 0.120237 0.312439
+-0.194266 0.12161 0.315661
+-0.201895 0.125737 0.315511
+-0.301477 0.321695 0.0447529
+-0.253468 0.336204 0.139654
+-0.286975 0.190523 -0.0509622
+-0.241485 0.323287 0.146042
+-0.215992 0.304111 0.229679
+-0.269666 0.35329 0.132278
+-0.267788 0.0157559 -0.0299645
+-0.290351 0.0436318 -0.0182708
+-0.153692 0.127121 0.363442
+-0.145953 0.110494 0.376257
+-0.13741 0.133294 0.376183
+-0.269146 0.144304 0.234062
+-0.262048 0.159725 0.25033
+-0.263733 0.172226 0.239184
+-0.20432 0.0794998 0.297151
+-0.215625 0.064521 0.284146
+-0.19472 0.0655926 0.304364
+-0.177463 0.07945 0.324024
+-0.187411 0.0884482 0.313015
+-0.222709 0.171482 0.315761
+-0.210442 0.17741 0.323091
+-0.22786 0.183149 0.305066
+-0.242993 0.170125 0.290799
+-0.25354 0.170609 0.269384
+-0.260218 0.149388 0.260923
+-0.26472 0.136418 0.247272
+-0.262401 0.121395 0.250019
+-0.2669 0.122697 0.237974
+-0.260169 0.10672 0.246676
+-0.226683 0.0797551 0.27709
+-0.239071 0.074627 0.262678
+-0.227191 0.0552149 0.267875
+-0.166513 0.0809107 0.341658
+-0.171542 0.108117 0.335353
+-0.178409 0.104076 0.322288
+-0.16503 0.120447 0.347513
+-0.17641 0.131556 0.338426
+-0.181623 0.122377 0.328568
+-0.250768 0.0969694 0.257808
+-0.2671 0.258 0.13147
+-0.282974 0.175162 0.145252
+-0.281515 0.203375 0.135725
+-0.285026 0.158852 0.123596
+-0.283398 0.153235 0.182528
+-0.279688 0.11946 0.181731
+-0.278417 0.138602 0.200105
+-0.273132 0.129931 0.219768
+-0.276788 0.0951496 0.164167
+-0.265381 0.0715282 0.182004
+-0.272148 0.0958356 0.1928
+-0.250747 0.0430851 0.175949
+-0.233589 0.029713 0.203721
+-0.248906 0.0549542 0.205347
+-0.280663 0.109338 0.111048
+-0.287189 0.139393 0.101193
+-0.221187 0.007514 0.199869
+-0.212348 0.00679389 0.227216
+-0.22126 0.0255248 0.230229
+-0.2247 0.0395276 0.250721
+-0.203437 0.131653 0.319609
+-0.211754 0.134613 0.317472
+-0.207524 0.1293 0.315388
+-0.212847 0.102195 0.291266
+-0.203159 0.100895 0.300392
+-0.196527 0.110501 0.305731
+-0.203333 0.108206 0.297777
+-0.235404 0.106258 0.275413
+-0.225382 0.0977809 0.282309
+-0.223075 0.105547 0.282882
+-0.250496 0.118622 0.264932
+-0.245427 0.106363 0.268376
+-0.242324 0.114896 0.269492
+-0.250994 0.124969 0.263781
+-0.253948 0.123619 0.263073
+-0.254147 0.138003 0.273519
+-0.252081 0.142543 0.281828
+-0.256739 0.139894 0.270672
+-0.23549 0.146082 0.305246
+-0.245136 0.150241 0.293642
+-0.242853 0.143618 0.293994
+-0.22746 0.143593 0.310421
+-0.221753 0.143201 0.315038
+-0.227549 0.150411 0.312724
+-0.190145 0.11115 0.310771
+-0.187205 0.10247 0.313324
+-0.18092 0.105807 0.315756
+-0.184164 0.110801 0.31283
+-0.182135 0.113972 0.318837
+-0.188206 0.121067 0.320807
+-0.186342 0.116356 0.315642
+-0.180889 0.110928 0.315726
+-0.194067 0.115753 0.309404
+-0.196306 0.115198 0.306372
+-0.190111 0.11642 0.312182
+-0.198276 0.118911 0.309626
+-0.252612 0.136622 0.27053
+-0.248677 0.141459 0.28091
+-0.200259 0.121597 0.310007
+-0.203937 0.125838 0.312644
+-0.198943 0.124982 0.306101
+-0.197579 0.118117 0.306752
+-0.195967 0.121269 0.303207
+-0.197733 0.114082 0.302006
+-0.193902 0.117949 0.299918
+-0.211616 0.106621 0.289883
+-0.20096 0.1112 0.291161
+-0.233031 0.110954 0.275098
+-0.220527 0.108643 0.275994
+-0.246673 0.12266 0.264807
+-0.239281 0.117982 0.262513
+-0.250297 0.131289 0.264953
+-0.247658 0.128 0.257089
+-0.248253 0.137785 0.264271
+-0.250954 0.135387 0.268722
+-0.232922 0.144071 0.302239
+-0.238365 0.146545 0.285395
+-0.220616 0.141657 0.311599
+-0.223363 0.146136 0.301356
+-0.211369 0.133908 0.3143
+-0.204101 0.131457 0.308144
+-0.254206 0.129807 0.264455
+-0.257072 0.123406 0.260489
+-0.197337 0.167022 0.334241
+-0.20042 0.154204 0.331419
+-0.18731 0.150611 0.33731
+-0.184367 0.165067 0.340747
+-0.214266 0.14243 0.319463
+-0.216619 0.138101 0.315579
+-0.212523 0.14044 0.307306
+-0.155807 0.0491039 0.390143
+-0.156482 0.0679945 0.373327
+-0.161632 0.0446714 0.368683
+-0.16097 0.0319293 0.384451
+-0.149641 -0.105564 0.472431
+-0.156121 -0.103565 0.465302
+-0.154264 -0.111378 0.468899
+-0.165094 -0.115508 0.439168
+-0.16558 -0.100869 0.432603
+-0.165402 -0.111034 0.428189
+-0.167003 -0.0790275 0.427461
+-0.166863 -0.0928583 0.423783
+-0.168687 -0.0219666 0.384258
+-0.168111 0.00463972 0.368556
+-0.167457 0.0231522 0.358947
+-0.164383 0.0602789 0.349934
+-0.106383 -0.189365 0.415377
+-0.127463 -0.174532 0.42726
+-0.140774 -0.185948 0.409673
+-0.121668 -0.202032 0.398191
+-0.145303 -0.156662 0.431297
+-0.162004 -0.145384 0.42711
+-0.155487 -0.163868 0.42099
+-0.165316 -0.107162 0.422205
+-0.166354 -0.102648 0.420483
+-0.165849 -0.106029 0.419981
+-0.165919 -0.108853 0.419692
+-0.164133 -0.119587 0.42536
+-0.164393 -0.112023 0.423071
+-0.164322 -0.117665 0.427361
+-0.187058 -0.135357 0.391203
+-0.176806 -0.110481 0.402026
+-0.190892 -0.110237 0.378865
+-0.168332 -0.0840826 0.414531
+-0.08951 -0.197525 0.401327
+-0.0828263 -0.185993 0.417892
+-0.143537 -0.22002 0.355729
+-0.15133 -0.22405 0.331341
+-0.125405 -0.219083 0.364462
+-0.152966 -0.194796 0.392268
+-0.16468 -0.171677 0.404365
+-0.0987341 -0.206742 0.389071
+-0.0773173 -0.200795 0.393517
+-0.162092 -0.0886407 0.121287
+-0.169704 -0.0770644 0.139435
+-0.204779 -0.0130052 0.219519
+-0.206282 0.00770511 0.251921
+-0.246026 0.0301894 0.143037
+-0.256599 0.0458529 0.117133
+-0.224566 -0.0046288 0.131495
+-0.193272 -0.0416981 0.152674
+-0.215128 -0.0102825 0.164761
+-0.194593 -0.0358991 0.182737
+-0.0127332 -0.21943 0.0736097
+-0.0301236 -0.205152 0.067887
+-0.113006 -0.201421 0.116752
+-0.115519 -0.173971 0.100537
+-0.114471 -0.16874 0.0836065
+-0.109381 -0.185852 0.0927255
+-0.139658 -0.116811 0.0645834
+-0.152259 -0.102215 0.0916751
+-0.19417 -0.188652 0.344396
+-0.185923 -0.184656 0.366563
+-0.191309 -0.162646 0.378161
+-0.113694 -0.21435 0.377046
+-0.165578 -0.198555 0.37631
+-0.149922 -0.211428 0.373813
+-0.135475 -0.208364 0.387938
+-0.118756 -0.209667 0.389229
+-0.0933152 -0.288069 0.131217
+-0.0309051 -0.312171 0.128167
+-0.0243627 -0.313852 0.152676
+-0.0427387 -0.31376 0.168399
+-0.0702876 -0.311047 0.149709
+-0.0822216 -0.296059 0.180597
+-0.177621 -0.154184 0.398381
+-0.294167 0.167625 0.0884438
+-0.292439 0.124972 0.0752144
+-0.274358 0.246335 0.107074
+-0.268561 0.291826 0.0969301
+-0.23751 0.0947101 0.272109
+-0.247861 0.100979 0.264185
+-0.21443 0.089384 0.289707
+-0.19432 0.0956008 0.307854
+-0.191185 0.127984 0.324499
+-0.189519 0.138445 0.331937
+-0.203189 0.141612 0.325437
+-0.212371 0.154477 0.324231
+-0.233944 0.161049 0.306383
+-0.218944 0.158894 0.319788
+-0.253953 0.153989 0.277594
+-0.260159 0.132051 0.25808
+-0.256326 0.11123 0.25748
+-0.159825 0.0813114 0.356466
+-0.152098 0.0895601 0.375101
+-0.157078 0.105536 0.360198
+-0.13815 0.0923491 0.3901
+-0.0923665 0.0888134 0.405326
+-0.116344 0.0906297 0.398858
+-0.166358 -0.0345114 0.408103
+-0.164619 -0.04799 0.426698
+-0.160877 -0.0264271 0.425592
+-0.17538 -0.0496711 0.375504
+-0.168589 -0.0585445 0.403577
+-0.205965 -0.0799715 0.324488
+-0.191701 -0.0818752 0.362528
+-0.21009 -0.105057 0.280663
+-0.212564 -0.109653 0.314877
+-0.210625 -0.136641 0.304751
+-0.206806 -0.111888 0.348038
+-0.176244 -0.0856647 0.39109
+-0.166501 -0.0668963 0.427705
+-0.167618 -0.069873 0.420113
+-0.161746 -0.0594523 0.440701
+-0.100093 -0.0534116 0.475338
+-0.126983 -0.0534607 0.466017
+-0.169884 -0.0785784 0.401619
+-0.0959274 0.0220976 0.437862
+-0.122981 0.0206847 0.431238
+-0.188325 -0.15946 0.238937
+-0.200103 -0.130167 0.241018
+-0.200333 -0.160173 0.264634
+-0.162556 0.138965 0.352933
+-0.171682 0.163407 0.3479
+-0.17173 0.182057 0.348261
+-0.183718 0.180718 0.340798
+-0.15402 0.0344268 0.404511
+-0.15539 -0.00377901 0.42367
+-0.147559 0.0179231 0.421518
+-0.157788 -0.0409589 0.440465
+-0.149887 -0.0200738 0.43871
+-0.157366 -0.0704272 0.452678
+-0.151081 -0.0544627 0.453347
+-0.157882 -0.0939927 0.46024
+-0.151052 -0.0827816 0.464073
+-0.16056 -0.110182 0.460049
+-0.140689 -0.097241 0.476551
+-0.138201 -0.116802 0.482477
+-0.140093 -0.0695426 0.466563
+-0.139927 -0.0364513 0.452234
+-0.137266 0.000718398 0.435739
+-0.134942 0.0382375 0.418393
+-0.129125 0.0742864 0.402959
+-0.127562 0.110853 0.387339
+-0.126705 0.156373 0.373813
+-0.12225 0.203861 0.358892
+-0.110865 0.302766 0.305489
+-0.125164 -0.128447 0.490278
+-0.101152 -0.131751 0.497869
+-0.146802 -0.121968 0.477118
+-0.159665 -0.117661 0.462669
+-0.162703 -0.117601 0.45817
+-0.164534 -0.120257 0.451225
+-0.164819 -0.124793 0.434389
+-0.162975 -0.123357 0.428993
+-0.164021 -0.130875 0.427836
+-0.167782 -0.147667 0.415701
+-0.175702 -0.179292 0.385323
+-0.175538 -0.201916 0.357994
+-0.168461 -0.217225 0.330089
+-0.140712 0.218691 0.349735
+-0.157181 0.215799 0.345159
+-0.162937 0.192229 0.350697
+-0.109416 0.230225 0.349674
+-0.117179 0.257408 0.335592
+-0.129445 0.230925 0.347229
+-0.0881325 0.227821 0.353449
+-0.0965322 0.253648 0.338342
+-0.173921 0.145482 0.344166
+-0.157719 0.239039 0.331868
+-0.173732 0.211209 0.337608
+-0.185842 0.194753 0.335913
+-0.196458 0.180068 0.331854
+-0.210455 0.164964 0.32638
+-0.103338 0.279883 0.321996
+-0.0845791 0.277356 0.324744
+-0.125412 0.283728 0.316941
+-0.148847 0.291832 0.298074
+-0.142355 0.268796 0.320112
+-0.173516 0.299435 0.272291
+-0.167902 0.279223 0.293754
+-0.192335 0.297931 0.257175
+-0.234225 0.283767 0.213966
+-0.210996 0.279537 0.249279
+-0.267689 0.246475 0.154567
+-0.25982 0.245492 0.187114
+-0.277686 0.227854 0.118873
+-0.282862 0.220799 0.101277
+-0.299384 0.175919 0.0655267
+-0.292774 0.194387 0.0848071
+-0.305729 0.145612 0.0162464
+-0.303215 0.133394 0.0399777
+-0.0774586 0.43378 0.120324
+-0.0557012 0.439329 0.110514
+-0.0731994 0.439601 0.0924825
+0.00210707 -0.116753 0.00790476
+-0.23316 -0.0257753 -0.0173071
+-0.280966 0.0310829 0.00874636
+-0.296411 0.0777033 0.0168149
+-0.308372 0.102527 -0.00650005
+-0.0623767 0.426557 0.163393
+-0.0813793 0.427892 0.145736
+-0.131027 -0.215869 0.375807
+-0.161501 -0.214291 0.35304
+-0.183 -0.205351 0.335511
+-0.19943 -0.191168 0.31721
+-0.205917 -0.163425 0.294905
+-0.207796 -0.132921 0.271892
+-0.205295 -0.101009 0.247511
+-0.200054 -0.0684601 0.224336
+-0.197736 -0.0341558 0.208253
+-0.208934 -0.0125158 0.194604
+-0.232775 0.0154454 0.171049
+-0.265172 0.0644459 0.152431
+-0.28249 0.128726 0.15122
+-0.274073 0.089784 0.132524
+-0.283829 0.161434 0.172545
+-0.275921 0.204296 0.174056
+-0.262848 0.228932 0.197895
+-0.198339 0.0122189 0.2795
+-0.188019 0.00539805 0.301863
+-0.213575 0.0251043 0.252778
+-0.234488 0.0438932 0.229276
+-0.263043 0.0810295 0.207743
+-0.273798 0.114686 0.206499
+-0.273576 0.15553 0.218127
+-0.249112 0.198532 0.254008
+-0.211096 0.215649 0.301299
+-0.188876 0.208052 0.327405
+-0.172934 0.194696 0.345449
+-0.174335 0.00501513 0.3415
+-0.164363 0.0199025 0.377868
+-0.278181 0.185331 0.190712
+-0.239517 0.251883 0.230392
+-0.190709 0.267279 0.282829
+-0.162334 0.259102 0.314274
+-0.139315 0.242805 0.339135
+-0.185189 0.123017 0.27144
+-0.185478 0.127232 0.274453
+-0.18711 0.132059 0.276697
+-0.191455 0.139235 0.278162
+-0.20032 0.148332 0.276379
+-0.212448 0.155003 0.26916
+-0.227075 0.154804 0.25481
+-0.236287 0.143939 0.238251
+-0.235796 0.131138 0.22979
+-0.227371 0.12211 0.23221
+-0.210672 0.115265 0.243594
+-0.193124 0.117095 0.260474
+-0.226576 0.113966 0.250659
+-0.240932 0.124778 0.241446
+-0.244938 0.134377 0.243365
+-0.241476 0.149322 0.258955
+-0.225376 0.153653 0.279402
+-0.211448 0.14977 0.290224
+-0.200437 0.140753 0.294499
+-0.193153 0.131348 0.293675
+-0.190149 0.126085 0.291297
+-0.188018 0.121713 0.288334
+-0.189298 0.117303 0.283488
+-0.204798 0.109557 0.26698
+-0.157805 -0.0947722 0.10752
+-0.168436 -0.0817864 0.0915181
+-0.191491 -0.0581124 0.0858234
+-0.212547 -0.0422333 0.0625139
+-0.232291 -0.0173955 0.0600205
+-0.248226 -0.00658435 0.0354346
+-0.173523 -0.0739281 0.105896
+-0.21498 -0.0320917 0.0818789
+-0.280768 0.0632412 0.0535873
+-0.249251 0.0136066 0.0672297
+-0.0249388 0.443591 -0.128068
+0.00276302 0.442376 -0.152507
+-0.0193964 0.449839 -0.0917167
+-0.068715 0.443395 0.0643514
+-0.0461331 0.448566 0.0435946
+-0.0692924 0.403159 0.218652
+-0.0523533 0.444538 0.0854494
+-0.0590356 0.433558 0.135837
+-0.0100105 -0.161203 0.0500353
+-0.0125987 -0.192603 0.0670318
+-0.0109777 -0.281981 0.0785214
+-0.0175412 -0.306988 0.116929
+-0.0621549 -0.307205 0.175645
+-0.0321876 -0.307062 0.190447
+-0.0889209 -0.297381 0.155821
+-0.104844 -0.265579 0.134582
+-0.255507 -0.00545607 -0.0048421
+-0.260934 0.00063103 0.011321
+-0.265249 0.0209933 0.037758
+-0.263593 0.0468945 0.0817014
+-0.265026 0.0574646 0.0964564
+-0.0286588 -0.143166 0.21185
+-0.0263531 -0.187736 0.213711
+-0.0133762 -0.164316 0.219342
+-0.01649 -0.0538436 0.178053
+-0.025263 -0.0910215 0.196352
+-0.00257326 -0.0682655 0.190934
+0.00235757 -0.182333 0.220024
+0.0135837 -0.161427 0.221374
+0.000298963 -0.138264 0.221294
+0.00522024 -0.0881588 0.206077
+0.0228024 -0.0683713 0.194909
+0.0180599 -0.0539767 0.183863
+0.0247634 -0.183099 0.205363
+0.0251088 -0.16563 0.195953
+0.0245252 -0.141298 0.205976
+0.0230693 -0.162592 0.214904
+0.030699 -0.0948261 0.19367
+0.0411756 -0.0843331 0.173875
+0.0470634 -0.0648261 0.174084
+0.0350537 -0.07178 0.191124
+0.0240296 -0.114128 0.211242
+0.0281079 -0.120929 0.189371
+0.014112 -0.112207 0.216521
+-0.0136909 -0.113951 0.212287
+-0.0350489 -0.225871 0.243646
+-0.0234433 -0.221779 0.24502
+-0.0343391 -0.218507 0.240194
+-0.0101654 -0.22364 0.244441
+0.00204974 -0.218651 0.242925
+-0.00896001 -0.216473 0.241466
+0.0222038 -0.214534 0.222283
+0.0169344 -0.217619 0.232527
+0.0200892 -0.223069 0.227882
+0.0236419 -0.220848 0.218665
+0.0212673 -0.209149 0.221592
+0.0242126 -0.210487 0.214681
+0.00660448 -0.210872 0.231944
+-0.0019808 -0.20541 0.223423
+-0.0198319 -0.213359 0.232127
+-0.0293475 -0.209174 0.219099
+-0.0222748 -0.228282 0.241894
+-0.00891223 -0.229689 0.238629
+0.00184633 -0.22543 0.240732
+-0.0328449 -0.231267 0.236856
+0.0209199 -0.18176 0.217044
+0.0196571 -0.137577 0.220342
+0.0241122 -0.0890277 0.206636
+0.0356284 -0.0553835 0.184584
+0.0198401 -0.203367 0.218951
+0.0159105 -0.20902 0.226684
+0.0105033 -0.221356 0.238626
+0.0114036 -0.213662 0.235716
+0.0157044 -0.225055 0.232218
+0.0093477 -0.228157 0.234564
+0.018879 -0.226828 0.226461
+-0.0135844 -0.198069 0.218838
+0.0134199 -0.195127 0.218914
+0.0239266 -0.195447 0.212628
+0.024317 -0.204542 0.208397
+0.0241204 -0.196007 0.199504
+-0.0308826 -0.235729 0.219445
+-0.0202046 -0.234964 0.225152
+-0.031559 -0.234515 0.228569
+-0.00823717 -0.234885 0.221755
+0.00184838 -0.234216 0.226608
+-0.00828086 -0.233636 0.2307
+0.00607891 -0.234522 0.222254
+0.0102924 -0.233201 0.223447
+0.0081539 -0.232532 0.228895
+0.0121803 -0.232477 0.218922
+0.0146396 -0.231352 0.221549
+0.0347097 -0.10443 0.172421
+0.0274076 -0.146899 0.182255
+0.0316818 -0.127079 0.167991
+0.0255333 -0.183227 0.190209
+0.0268097 -0.167764 0.178618
+0.0238535 -0.204543 0.197829
+0.0247491 -0.195408 0.189231
+0.0244173 -0.21062 0.207226
+0.0247026 -0.216169 0.208159
+0.0238645 -0.210897 0.198586
+0.021743 -0.226086 0.218079
+0.0225737 -0.222029 0.209406
+0.0136253 -0.230137 0.227906
+0.0185766 -0.229399 0.216003
+0.00187022 -0.231137 0.234329
+-0.0204161 -0.232784 0.234083
+0.0393784 -0.0992737 0.161294
+0.0500387 -0.084931 0.158549
+0.00157331 -0.234612 0.219116
+0.00701538 -0.233931 0.218254
+0.0160204 -0.230329 0.213374
+0.0190537 -0.227627 0.210822
+0.0357765 -0.109967 0.15941
+0.0389621 -0.102591 0.157413
+-0.0299891 -0.235525 0.212607
+-0.0199875 -0.23484 0.216177
+-0.00820577 -0.234795 0.215057
+0.0110261 -0.232434 0.213351
+0.019821 -0.224034 0.204086
+0.0221949 -0.217371 0.200758
+0.0218086 -0.213587 0.193592
+0.0227532 -0.205702 0.190382
+0.0234993 -0.197628 0.183397
+0.0253122 -0.184198 0.180336
+0.025979 -0.169869 0.171018
+0.0279237 -0.150439 0.16706
+0.0316006 -0.129382 0.159673
+-0.069461 -0.145169 0.460964
+-0.053586 -0.14042 0.457984
+-0.0390412 -0.131183 0.462332
+-0.0533669 -0.134982 0.468292
+-0.0689546 -0.141731 0.467199
+-0.0264998 -0.127415 0.474711
+-0.0337091 -0.12981 0.477246
+-0.0281489 -0.129858 0.469995
+-0.0424752 -0.128542 0.488613
+-0.0594547 -0.138113 0.485012
+-0.0496879 -0.136937 0.47456
+-0.0830297 -0.153303 0.472064
+-0.0893386 -0.151267 0.479452
+-0.0880732 -0.157359 0.465021
+-0.0825103 -0.165919 0.445221
+-0.0858965 -0.162228 0.450795
+-0.0796701 -0.145566 0.487565
+-0.0884909 -0.14399 0.494096
+-0.0196414 -0.122941 0.461732
+-0.0217622 -0.127266 0.467268
+-0.0246235 -0.127613 0.464789
+-0.0227225 -0.124271 0.46166
+-0.0373062 -0.13128 0.468879
+-0.0301099 -0.127365 0.464719
+-0.0655424 -0.141536 0.471541
+-0.0728704 -0.14736 0.46538
+-0.0726909 -0.148145 0.470681
+-0.0667349 -0.149396 0.457222
+-0.0734342 -0.153281 0.4609
+-0.0367294 -0.136659 0.457751
+-0.0509895 -0.149321 0.455455
+-0.0255627 -0.136905 0.458648
+-0.0232645 -0.128668 0.460424
+-0.0293256 -0.129616 0.459641
+-0.0200837 -0.124511 0.459931
+-0.0224242 -0.124825 0.460509
+-0.02565 -0.12575 0.461411
+-0.0819424 -0.158003 0.459334
+-0.0276984 -0.12316 0.482469
+-0.0286014 -0.119502 0.484683
+-0.0322054 -0.123119 0.486884
+-0.0768696 -0.137435 0.498581
+-0.0888636 -0.136177 0.498985
+-0.0414145 -0.121801 0.491947
+-0.0530659 -0.128928 0.496157
+-0.0231519 -0.122673 0.473889
+-0.0750075 -0.175433 0.436453
+-0.065139 -0.164214 0.449389
+-0.0760328 -0.159586 0.453872
+-0.0777467 -0.153727 0.466238
+-0.0746635 -0.147415 0.477961
+-0.0662475 -0.137081 0.49481
+-0.0647452 -0.12883 0.499089
+-0.055203 -0.206986 0.387413
+-0.0413797 -0.20936 0.384506
+-0.022915 -0.214519 0.379439
+-0.0369396 -0.211651 0.387522
+-0.0665676 -0.202164 0.385427
+-0.0665779 -0.203759 0.390137
+-0.00379437 -0.274839 0.226805
+-0.0228051 -0.273768 0.226154
+-0.0209779 -0.280456 0.223043
+0.0304498 -0.26459 0.221978
+0.0129305 -0.268743 0.226924
+0.0156819 -0.275002 0.223043
+0.048937 -0.241586 0.196979
+0.0400528 -0.251729 0.211175
+0.042723 -0.257452 0.20736
+0.0559115 -0.215462 0.177387
+0.0516625 -0.226329 0.187139
+0.0542112 -0.231105 0.183461
+0.0613126 -0.188919 0.162264
+0.0572814 -0.200384 0.170312
+0.0596738 -0.204454 0.166439
+0.0637978 -0.160386 0.152358
+0.0606375 -0.173451 0.15797
+0.0636388 -0.177072 0.153007
+0.0727599 -0.13092 0.147207
+0.0655588 -0.144463 0.150461
+0.0690611 -0.148637 0.145112
+0.085545 -0.105795 0.149426
+0.0771194 -0.116661 0.148493
+0.0818318 -0.120225 0.143127
+0.0791582 -0.0942992 0.189606
+0.0764082 -0.0902065 0.181694
+0.0816113 -0.0952677 0.174444
+0.0848467 -0.0890967 0.180952
+0.0799036 -0.11009 0.217149
+0.0776231 -0.0996416 0.20317
+0.0828161 -0.0944132 0.209406
+0.0759631 -0.136805 0.246621
+0.0764751 -0.121331 0.231434
+0.0817103 -0.118719 0.237946
+0.0516202 -0.202642 0.31228
+0.0558146 -0.192705 0.302198
+0.0620013 -0.184363 0.294134
+0.0609822 -0.192835 0.308659
+0.0335439 -0.21295 0.331551
+0.0416022 -0.206999 0.320913
+0.0464013 -0.207896 0.327159
+-0.00630552 -0.21684 0.366072
+0.0119121 -0.219909 0.352525
+-0.00272206 -0.218317 0.369656
+-0.0210291 -0.0326876 0.20385
+-0.0162928 -0.0431301 0.180556
+0.00317187 -0.0416538 0.195423
+-0.0247532 -0.0294871 0.223522
+-0.00610553 -0.0386532 0.243257
+-0.031819 -0.0375454 0.258005
+0.0765037 -0.107086 0.149715
+0.0660223 -0.120169 0.155052
+0.0682563 -0.130768 0.151895
+-0.00608505 -0.268815 0.22761
+-0.0244446 -0.263595 0.225004
+0.0265319 -0.258894 0.223177
+0.00941323 -0.259656 0.226725
+0.0455365 -0.236425 0.199597
+0.034223 -0.244524 0.213194
+0.0524864 -0.210911 0.180372
+0.0455665 -0.220728 0.19126
+0.057435 -0.186075 0.166187
+0.0503356 -0.197388 0.175926
+0.059985 -0.159113 0.156802
+0.0534283 -0.17258 0.164554
+0.058897 -0.143221 0.157086
+0.0796531 -0.0910734 0.144414
+0.0713456 -0.0973652 0.146359
+0.0725476 -0.0830867 0.175942
+0.0693948 -0.0834901 0.193954
+0.0645029 -0.0726838 0.1842
+0.0198619 -0.0462918 0.185872
+0.0294417 -0.0474569 0.196784
+0.0169781 -0.0444277 0.211125
+0.0512776 -0.0566476 0.174945
+0.0582677 -0.0647182 0.181386
+0.045486 -0.0600952 0.204753
+0.0393818 -0.0509892 0.194385
+-0.000603386 -0.0367598 0.218121
+0.029196 -0.053372 0.219271
+0.0135468 -0.0463901 0.229684
+0.0558637 -0.07321 0.210944
+0.0403258 -0.0667475 0.223232
+0.073411 -0.0981973 0.215211
+0.0629624 -0.0884967 0.218884
+0.0681184 -0.0863234 0.205699
+0.0725073 -0.132694 0.246645
+0.0697518 -0.11658 0.236202
+0.0763242 -0.107748 0.220797
+0.0490292 -0.198643 0.311161
+0.0504312 -0.185999 0.303317
+0.0590792 -0.180204 0.293244
+0.0309099 -0.208965 0.330449
+0.0374365 -0.200817 0.321382
+-0.0254166 -0.210695 0.378778
+-0.00996474 -0.21257 0.366231
+0.00918866 -0.215937 0.351545
+-0.0562398 -0.203249 0.385854
+-0.0417114 -0.205758 0.382736
+-0.0661172 -0.199094 0.383431
+-0.0148164 -0.250557 0.221264
+-0.0292567 -0.24176 0.215455
+-0.00173508 -0.250192 0.222873
+-0.00829314 -0.241568 0.218243
+0.0222925 -0.242884 0.218026
+0.0150567 -0.238438 0.217215
+0.0149905 -0.246947 0.222286
+0.0368236 -0.0484732 0.186865
+0.0222816 -0.0630801 0.24092
+0.00448512 -0.0579663 0.260778
+0.0498551 -0.0846423 0.22794
+0.0591871 -0.100403 0.231244
+0.0308785 -0.0858142 0.249247
+0.0481268 -0.155866 0.285914
+0.0333439 -0.143078 0.288039
+0.0511868 -0.144915 0.27545
+0.0122343 -0.14748 0.311191
+0.0015542 -0.119151 0.307696
+0.0207526 -0.116675 0.283988
+-0.0163522 -0.129961 0.330559
+-0.0236638 -0.0998532 0.316752
+-0.00508168 -0.0888469 0.296953
+-0.0484238 -0.118354 0.335367
+-0.0391156 -0.0710401 0.296955
+-0.0142212 -0.0596031 0.279899
+0.0113961 -0.0855999 0.274427
+0.0413231 -0.112203 0.25672
+0.0561702 -0.131229 0.259875
+0.034795 -0.191787 0.316898
+0.0235436 -0.172923 0.313576
+0.0457761 -0.168315 0.295386
+-0.0038244 -0.204508 0.347171
+-0.0208823 -0.20649 0.356698
+-0.00659015 -0.19774 0.345898
+-0.0369997 -0.20987 0.368533
+-0.0470887 -0.2037 0.365495
+-0.0336435 -0.199241 0.361325
+-0.0607625 -0.205012 0.369636
+-0.0587318 -0.193081 0.363848
+-0.0374345 -0.147365 0.35201
+-0.0580909 -0.165364 0.365054
+-0.0102412 -0.159803 0.339549
+-0.0301713 -0.17417 0.360211
+-0.00127639 -0.183731 0.340069
+0.0257238 -0.200128 0.328681
+0.073884 -0.0938999 0.202051
+0.00592465 -0.0474665 0.17923
+0.0299468 -0.0486425 0.182174
+0.0442615 -0.0523707 0.178879
+0.0584752 -0.0653483 0.159139
+0.0313494 -0.232057 0.206021
+0.0341486 -0.224799 0.199185
+0.0259667 -0.22591 0.203402
+0.0382911 -0.207962 0.185635
+0.0278793 -0.215026 0.193166
+0.0419565 -0.185459 0.173712
+0.0300116 -0.197897 0.182218
+0.0448826 -0.155749 0.162664
+0.0326245 -0.170621 0.170041
+0.0547948 -0.123163 0.156924
+0.0388064 -0.132066 0.159711
+0.059942 -0.109231 0.153498
+0.0589605 -0.0946138 0.14775
+0.0222693 -0.23321 0.210885
+0.0060441 -0.241421 0.220238
+0.0624136 -0.0742755 0.149926
+0.067926 -0.0688491 0.148193
+0.0743461 -0.0752434 0.14659
+0.0678946 -0.0686123 0.155865
+0.0570425 -0.086505 0.148943
+0.0073239 -0.236404 0.217109
+0.00123544 -0.236938 0.21725
+0.0199261 -0.228931 0.207868
+0.0171999 -0.231918 0.211255
+-0.0197541 -0.236428 0.21379
+0.0227389 -0.219373 0.198439
+0.0236945 -0.207476 0.187925
+0.0264794 -0.185679 0.177316
+0.0294308 -0.151665 0.163947
+0.0378338 -0.111216 0.157049
+0.0457106 -0.0991447 0.154216
+-0.0456648 -0.184894 0.365965
+-0.0184128 -0.191958 0.354682
+-0.0247211 -0.211081 0.371583
+-0.0063847 -0.211047 0.35675
+-0.0524932 -0.205104 0.377444
+0.0115162 -0.204646 0.340303
+0.0769842 -0.14702 0.266705
+0.0705313 -0.163478 0.274867
+0.0716739 -0.149116 0.260817
+0.0672413 -0.159175 0.2743
+0.065008 -0.142927 0.2637
+0.0585523 -0.166203 0.286224
+0.0647821 -0.172877 0.284424
+0.0700678 -0.171711 0.290305
+0.0264029 -0.217014 0.345579
+0.0221908 -0.216008 0.340417
+0.0203827 -0.208663 0.338428
+0.0771208 -0.0854013 0.158065
+0.0833826 -0.0967885 0.153309
+0.0847655 -0.0989652 0.161249
+0.0905475 -0.0978505 0.153703
+0.0876786 -0.0933709 0.16739
+0.0798879 -0.0934405 0.167538
+0.0694167 -0.0739083 0.165427
+0.0641159 -0.0679174 0.170201
+0.0765181 -0.102025 0.211718
+-0.0674393 0.352018 0.274946
+-0.0729735 0.336669 0.286125
+0.100447 -0.112504 0.0760874
+0.105722 -0.106681 0.0659793
+0.116615 -0.0959694 0.0712193
+0.107285 -0.101628 0.082526
+0.0703299 -0.17022 0.0923767
+0.0677355 -0.165917 0.082715
+0.0777023 -0.160623 0.0887236
+0.076873 -0.164211 0.0989396
+0.0870766 -0.14474 0.083745
+0.0852078 -0.138483 0.069487
+0.0917426 -0.132183 0.0774143
+0.0933965 -0.134409 0.091516
+-0.00827266 0.416714 0.196934
+0.00615808 0.417142 0.188179
+-0.00676761 0.422344 0.179411
+-0.0232467 0.421235 0.187109
+0.00747953 0.428427 0.150772
+-0.00553286 0.433698 0.137569
+-0.0203274 0.432061 0.147479
+-0.00566254 0.427514 0.16113
+0.0433762 0.404822 0.197528
+0.0565893 0.407738 0.189806
+0.0464552 0.4119 0.177625
+0.0325576 0.41047 0.186766
+0.0685198 0.410069 0.125129
+0.0598232 0.415304 0.138235
+0.0694385 0.413909 0.143463
+0.0868643 0.407511 0.210764
+0.0997341 0.411753 0.206253
+0.0911167 0.413348 0.193122
+0.0782197 0.409471 0.197686
+0.111476 0.416481 0.169418
+0.106461 0.412214 0.15061
+0.0896315 0.414966 0.15726
+0.0962196 0.416818 0.174541
+0.129374 0.41598 0.228968
+0.142882 0.425468 0.230737
+0.134801 0.422112 0.215633
+0.121291 0.415059 0.215639
+0.157695 0.434747 0.204699
+0.151001 0.423932 0.182754
+0.133735 0.419891 0.182825
+0.141032 0.425873 0.20122
+0.166446 0.439755 0.258616
+0.176305 0.449148 0.26124
+0.175744 0.452903 0.254847
+0.163644 0.441434 0.250222
+0.19678 0.470997 0.249477
+0.197846 0.468761 0.236964
+0.182212 0.458834 0.233121
+0.185069 0.463503 0.248207
+0.175577 0.438776 0.259975
+0.179298 0.440532 0.254151
+0.184353 0.450687 0.258466
+0.179851 0.447631 0.262106
+0.195556 0.455561 0.243392
+0.204744 0.465081 0.242608
+0.199902 0.468809 0.251467
+0.193619 0.461194 0.25345
+0.254671 0.219515 0.09332
+0.250098 0.218751 0.105443
+0.261465 0.198935 0.092387
+0.21731 0.247909 0.151709
+0.210973 0.235582 0.166941
+0.228272 0.213611 0.150493
+0.230265 0.227105 0.137961
+0.170115 -0.0601956 0.0496442
+0.163558 -0.0674191 0.0443031
+0.185309 -0.0509837 0.034967
+0.191385 -0.0463498 0.0375355
+0.106378 -0.108952 0.0470825
+0.0982181 -0.114322 0.0395614
+0.110298 -0.108314 0.0344442
+0.119819 -0.1011 0.0413736
+0.097182 -0.113289 0.0171098
+0.106874 -0.106004 0.00841532
+0.122476 -0.101517 0.0137414
+0.111376 -0.109377 0.0216584
+0.0731762 -0.123714 0.0332531
+0.0810981 -0.122507 0.0370045
+0.0780224 -0.126275 0.0427128
+0.118068 0.362903 0.0659144
+0.114294 0.362956 0.0493275
+0.0967513 0.379174 0.0591871
+0.0997696 0.380348 0.077662
+0.123235 0.398679 0.122616
+0.143295 0.392426 0.119733
+0.14568 0.378871 0.102483
+0.124204 0.386638 0.102909
+0.193848 0.342039 0.092015
+0.200277 0.321078 0.0819069
+0.179681 0.334413 0.0809677
+0.173132 0.352944 0.0910846
+0.168877 0.323211 0.0686713
+0.188186 0.298895 0.063421
+0.189088 0.293286 0.0551381
+0.16635 0.314508 0.0502373
+0.151258 0.333204 0.0628852
+0.0736684 0.392933 0.232433
+0.084046 0.386818 0.242435
+0.093032 0.395262 0.238419
+0.0835403 0.399634 0.227851
+0.12017 0.397257 0.251541
+0.13052 0.406805 0.250148
+0.124142 0.408001 0.241444
+0.112744 0.399737 0.243846
+0.00280056 0.441322 0.0819588
+0.0194176 0.437641 0.0637828
+0.00816482 0.444518 0.0296478
+-0.010233 0.446352 0.0554835
+0.0688645 -0.134273 0.0391552
+0.0736015 -0.136155 0.0453843
+0.0661875 -0.140395 0.0440089
+0.0531915 -0.162728 0.0669895
+0.0481692 -0.161393 0.0626061
+0.0533218 -0.156668 0.0584875
+0.0440219 -0.161258 0.064262
+0.0459222 -0.168747 0.0742083
+0.0352339 -0.171232 0.0713408
+0.0258514 -0.16145 0.0595018
+0.03973 -0.153704 0.0548788
+0.163803 -0.0718326 0.0170416
+0.149328 -0.0824301 0.0104842
+0.156818 -0.0734728 2.52548e-005
+0.171224 -0.0615054 -0.00162723
+0.179304 -0.0570142 0.00638401
+0.214685 -0.0141533 -0.00500319
+0.224636 -0.00752492 0.00259169
+0.225023 -0.0155737 0.010693
+0.211199 -0.0277479 0.0139803
+0.207019 -0.0288967 0.00447488
+0.202994 -0.00596116 -0.0249299
+0.206586 -0.00840269 -0.0203909
+0.198832 -0.0144516 -0.0231409
+0.175012 -0.0489517 -0.0151195
+0.172791 -0.0469368 -0.019249
+0.18079 -0.0386505 -0.0198599
+0.159096 -0.0471149 -0.0271974
+0.160618 -0.0537829 -0.0196291
+0.149006 -0.068159 -0.0129974
+0.129077 -0.075629 -0.0164941
+0.207232 0.00842795 -0.022143
+0.199117 -0.00212721 -0.026566
+0.183631 -0.0152126 -0.0317037
+0.199721 0.0156508 -0.0311413
+0.213263 0.0733342 -0.0378174
+0.214601 0.0688437 -0.0300498
+0.212596 0.0544621 -0.024018
+0.203959 0.0434571 -0.0333077
+0.231801 0.0470972 0.00398753
+0.234211 0.0341633 0.0127359
+0.228637 0.030672 0.00479501
+0.224391 0.0439158 -0.00434724
+0.164555 0.311954 -0.0747959
+0.163883 0.310951 -0.0482995
+0.178127 0.286632 -0.0676939
+0.190561 0.256555 -0.0603079
+0.193109 0.254221 -0.0410678
+0.200505 0.234238 -0.0515301
+0.218347 0.193441 -0.0492824
+0.21127 0.214008 -0.0461631
+0.215979 0.215772 -0.0342899
+0.21779 0.207705 -0.0397259
+0.226369 0.280319 0.0724336
+0.243229 0.269491 0.0747372
+0.245961 0.254074 0.0700542
+0.239361 0.252181 0.0642019
+0.223417 0.269899 0.065795
+0.190496 0.273389 0.00405033
+0.206365 0.256976 0.0155699
+0.206621 0.247953 0.00182176
+0.194615 0.260552 -0.0110998
+0.237664 0.211701 0.0103804
+0.234067 0.208166 0.00235689
+0.231307 0.216425 0.00339234
+0.0623644 0.413679 0.0315426
+0.0477781 0.422346 0.0622272
+0.0563592 0.415631 0.0853293
+0.0682741 0.406809 0.0611467
+0.130193 0.35303 -0.025461
+0.126602 0.359063 -0.0466259
+0.112925 0.373063 -0.0412295
+0.115486 0.367161 -0.0155788
+0.0880022 0.40253 -0.089327
+0.0678038 0.417642 -0.0740322
+0.0737632 0.410341 -0.0420083
+0.0920505 0.395832 -0.0601427
+0.133232 0.353889 -0.0945978
+0.132944 0.352217 -0.0700201
+0.149987 0.331855 -0.0841232
+0.248873 0.0429534 0.0296505
+0.254 0.0548463 0.0390303
+0.245602 0.0355735 0.0397559
+0.23006 -0.0178692 0.0147536
+0.231462 -0.0148672 0.0184626
+0.223004 -0.0242047 0.0200974
+0.220715 0.208347 -0.0368215
+0.223579 0.207816 -0.0309583
+0.223382 0.20312 -0.0352469
+0.22241 0.176863 -0.0457085
+0.226554 0.179717 -0.0362291
+0.232076 0.166647 -0.0301365
+0.228633 0.155575 -0.0374318
+0.233207 0.177985 -0.0284199
+0.228829 0.183057 -0.0340353
+0.228382 0.187485 -0.0333855
+0.25183 0.148954 -0.00303331
+0.25995 0.139382 0.00716486
+0.255521 0.136421 -0.00259852
+0.247648 0.147741 -0.0112657
+0.244614 0.234176 0.0474627
+0.246413 0.238439 0.0568916
+0.254969 0.222886 0.052457
+0.252568 0.218985 0.0399231
+0.245265 0.211267 0.0129243
+0.248355 0.212329 0.0182708
+0.250878 0.20149 0.016275
+0.272816 0.137586 0.0374877
+0.273498 0.127467 0.0534153
+0.268653 0.102166 0.0397279
+0.270812 0.117519 0.0275312
+0.276179 0.127661 0.084274
+0.275807 0.144887 0.090501
+0.273415 0.117881 0.0980277
+0.263714 0.113362 0.00747611
+0.266535 0.112386 0.0115961
+0.262478 0.101942 0.00933746
+0.251232 0.0573118 0.0169924
+0.249346 0.060444 0.0132281
+0.254125 0.0709487 0.0130438
+0.00341828 -0.307547 0.118556
+0.013996 -0.302506 0.109758
+0.0168968 -0.307684 0.120485
+0.00824604 -0.311468 0.1323
+0.0349158 -0.29724 0.112381
+0.039805 -0.295316 0.119466
+0.0348237 -0.302669 0.130643
+0.0296055 -0.304398 0.121086
+0.0327569 -0.286417 0.0945623
+0.0250644 -0.288526 0.0930177
+0.0292431 -0.282245 0.0895966
+0.0561128 -0.228701 0.142707
+0.0566268 -0.220872 0.146496
+0.0561333 -0.232581 0.151824
+0.0588738 -0.199736 0.138233
+0.0598369 -0.193931 0.13194
+0.061675 -0.189651 0.137674
+0.0521301 -0.204326 0.110971
+0.0499752 -0.19634 0.101105
+0.0569114 -0.189398 0.105403
+0.0567476 -0.195852 0.11637
+0.0524454 -0.242576 0.113116
+0.0486374 -0.233406 0.105608
+0.0519519 -0.223067 0.112861
+0.0545218 -0.231727 0.121891
+0.0484156 -0.270574 0.106625
+0.052328 -0.261411 0.113422
+0.0531266 -0.269135 0.124324
+0.0488483 -0.278867 0.115777
+0.030213 -0.244129 0.0868794
+0.0193575 -0.234871 0.08267
+0.0295611 -0.222918 0.0868746
+0.0374161 -0.232715 0.0927528
+0.0196667 -0.193824 0.0764675
+0.0317064 -0.186429 0.078303
+0.0385798 -0.195551 0.0862398
+0.0298444 -0.203643 0.0834051
+0.198 0.417168 0.156885
+0.189196 0.399697 0.138772
+0.182354 0.409205 0.148351
+0.249009 0.246433 0.073811
+0.249435 0.25336 0.0758887
+0.251077 0.268933 0.0872916
+0.244784 0.277482 0.095081
+0.246009 0.25746 0.0845696
+0.178673 0.379849 0.179955
+0.181377 0.369224 0.17689
+0.185307 0.378703 0.173877
+0.155248 0.372406 0.209269
+0.164208 0.381471 0.198848
+0.160983 0.388068 0.210889
+0.152164 0.381229 0.219731
+0.229308 0.326385 0.133077
+0.236105 0.317446 0.120423
+0.230863 0.339114 0.131307
+0.221471 0.349413 0.142368
+0.106196 0.334808 0.253064
+0.0972721 0.339866 0.259506
+0.0890677 0.338149 0.268152
+0.0960045 0.330107 0.265318
+0.086347 0.368975 0.254234
+0.0769044 0.364553 0.253645
+0.0825082 0.355719 0.260987
+0.0921078 0.35567 0.262722
+0.0964585 0.364734 0.260104
+0.0432977 0.390706 0.225819
+0.0313167 0.390454 0.227825
+0.0458273 0.378429 0.239557
+0.0542638 0.379658 0.237814
+0.229433 0.340015 0.101731
+0.209242 0.352005 0.103419
+0.217157 0.367262 0.114108
+0.236522 0.355494 0.110387
+0.257085 0.400567 0.144839
+0.260222 0.418073 0.16095
+0.272261 0.407475 0.155648
+0.272332 0.392023 0.142112
+0.238483 0.458402 0.200127
+0.248931 0.454084 0.197229
+0.247624 0.440723 0.182057
+0.23203 0.442932 0.183204
+0.209964 0.431082 0.195385
+0.196908 0.417605 0.192704
+0.20078 0.401476 0.176139
+0.212518 0.413673 0.178675
+0.242717 0.455785 0.206351
+0.241507 0.441477 0.194888
+0.2526 0.438181 0.189438
+0.250434 0.452147 0.200279
+0.266066 0.396715 0.156377
+0.276048 0.388047 0.149474
+0.273665 0.405239 0.159178
+0.265123 0.414834 0.168375
+0.251021 0.339152 0.124987
+0.24492 0.356889 0.13502
+0.23981 0.349873 0.132572
+0.136236 0.378825 0.252322
+0.127661 0.376602 0.260325
+0.123594 0.367094 0.254427
+0.132473 0.366748 0.245795
+0.123002 0.379978 0.263043
+0.128951 0.389614 0.262393
+0.119788 0.385618 0.259801
+0.113175 0.375751 0.261478
+0.108721 0.355115 0.254533
+0.0984481 0.351559 0.261494
+0.0997935 0.346206 0.256069
+0.110349 0.348202 0.247056
+0.0615433 0.340356 0.276719
+0.0767153 0.343958 0.270464
+0.0748901 0.351995 0.264549
+0.0591803 0.359271 0.259577
+0.0493732 0.351443 0.2695
+0.28467 0.342332 0.11598
+0.278557 0.330268 0.107384
+0.270868 0.34733 0.112463
+0.279544 0.359063 0.121871
+0.286016 0.340118 0.120322
+0.283099 0.354903 0.129963
+0.278757 0.343416 0.12457
+0.282611 0.327672 0.115746
+0.262917 0.284917 0.0959656
+0.270636 0.287397 0.0958701
+0.274197 0.302219 0.104618
+0.265002 0.303426 0.106289
+0.254104 0.303325 0.0922818
+0.269117 0.302555 0.0956967
+0.268383 0.28712 0.0907413
+0.256341 0.284352 0.085431
+0.212307 0.459755 0.205975
+0.213501 0.469361 0.222342
+0.226503 0.473516 0.223097
+0.228035 0.467626 0.211934
+0.219351 0.466626 0.228512
+0.22231 0.458166 0.21685
+0.232496 0.465066 0.217737
+0.228343 0.471617 0.225595
+0.168117 0.413716 0.231953
+0.169071 0.405949 0.2178
+0.176687 0.418766 0.220532
+0.174761 0.424793 0.234082
+0.154039 0.417364 0.26251
+0.156332 0.42486 0.260224
+0.146193 0.415141 0.258427
+0.144791 0.408409 0.261852
+0.161787 0.413924 0.251302
+0.165096 0.423399 0.258925
+0.157703 0.416023 0.261512
+0.153517 0.405835 0.256636
+0.143722 0.335665 0.022698
+0.159939 0.318567 0.0263244
+0.169297 0.304828 0.00877094
+0.154809 0.322819 0.00283332
+0.0359711 0.439146 -0.107919
+0.0142212 0.446799 -0.0871046
+0.0208004 0.444956 -0.0553231
+0.040848 0.43634 -0.0816031
+0.026549 -0.102338 -0.00261353
+0.0308368 -0.0971318 -0.0106139
+0.076445 -0.0970212 -0.0112377
+0.0883708 -0.0928501 -0.016318
+0.109029 -0.0905355 -0.0122343
+0.0992802 -0.0979099 -0.00587482
+0.0176982 0.353657 0.273695
+0.00408855 0.365104 0.265621
+-0.00319849 0.354421 0.27794
+0.00758259 0.343663 0.28469
+0.227583 0.07899 -0.0263162
+0.22447 0.0690744 -0.0221908
+0.221239 0.0711842 -0.0277899
+0.247841 0.113911 -0.0209806
+0.242095 0.104355 -0.0251606
+0.245231 0.112496 -0.0257333
+0.242818 0.125714 -0.025235
+0.240035 0.11361 -0.0287202
+0.228735 0.0986082 -0.0369799
+0.235043 0.126852 -0.0340838
+-0.0107811 0.408923 0.215523
+-0.0284397 0.403085 0.225401
+-0.019178 0.391237 0.241561
+-0.00480388 0.398465 0.230289
+0.102784 -0.103512 0.0942101
+0.114876 -0.0908106 0.0897072
+0.0713572 -0.173619 0.102458
+0.0729742 -0.168574 0.110858
+0.0698931 -0.174781 0.112159
+0.0915761 -0.135219 0.102804
+0.0959964 -0.124184 0.100294
+0.0755556 -0.162641 0.109266
+0.0798114 -0.155848 0.10609
+-0.0219765 0.426335 0.16973
+0.00795118 0.422707 0.170065
+0.0352441 0.416952 0.167106
+0.0600942 0.414256 0.169969
+0.0488394 0.417713 0.155886
+0.0823635 0.415009 0.179166
+0.104242 0.416528 0.189294
+0.126254 0.419629 0.20051
+0.149297 0.432023 0.219089
+0.171979 0.452137 0.243406
+0.185695 0.462055 0.257313
+0.189153 0.460182 0.258877
+0.186943 0.450305 0.251585
+0.248829 0.201849 0.118419
+0.235474 0.240192 0.122038
+0.167189 -0.055004 0.0674113
+0.177294 -0.0412811 0.0759317
+0.155012 -0.0608877 0.0800094
+0.132794 -0.0814499 0.0753543
+0.127444 -0.0905628 0.0608519
+0.148319 -0.0737199 0.0628545
+0.136076 -0.0908338 0.0364284
+0.148223 -0.0796398 0.0451434
+0.128758 -0.0924562 0.0513526
+0.0981649 -0.118041 0.0876534
+0.0943179 -0.126579 0.0775242
+0.0948428 -0.120531 0.068115
+0.0981485 -0.114502 0.0564173
+0.115523 -0.100586 0.0562671
+0.123422 -0.101553 0.0279475
+0.100439 -0.114384 0.0286779
+0.0906348 -0.1178 0.0324839
+0.0895434 -0.119829 0.0456689
+0.0742335 0.415738 0.163543
+0.0848051 0.410349 0.137089
+0.128024 0.371642 0.0861197
+0.10438 0.383068 0.0877394
+0.10304 0.394271 0.106182
+0.158611 0.343499 0.077847
+0.187384 0.314175 0.0724827
+0.118182 0.418323 0.185588
+0.128112 0.414468 0.164156
+0.124621 0.407987 0.143944
+0.103546 0.404862 0.128805
+0.112826 0.415341 0.202486
+0.108233 0.410071 0.218533
+0.104108 0.402764 0.234102
+0.102559 0.390391 0.247519
+0.0222243 0.422711 0.158798
+0.0347049 0.423095 0.145526
+0.0187555 0.429532 0.137579
+-0.0181548 0.438832 0.118378
+0.00732322 0.434869 0.125508
+-0.0028968 0.440184 0.106475
+0.0795166 -0.130402 0.0510032
+0.08685 -0.125336 0.0560473
+0.0888021 -0.130007 0.0673703
+0.0795753 -0.132861 0.0514202
+0.076546 -0.143759 0.0612027
+0.0852965 -0.150708 0.0954039
+0.077759 -0.152982 0.0773713
+0.0552794 -0.167439 0.0754219
+0.065182 -0.159545 0.0716152
+0.0409258 -0.128014 0.0270302
+0.0228488 -0.132448 0.0273203
+0.0224502 -0.12222 0.0177016
+0.0481876 -0.154864 0.0557681
+0.0482354 -0.165751 0.070233
+0.0559845 -0.147202 0.0478579
+0.0646073 -0.15015 0.0570343
+0.073452 -0.130528 0.0416848
+0.0607884 -0.138075 0.0405681
+0.0630838 -0.131637 0.037029
+0.050769 -0.145573 0.0472115
+0.0340565 -0.143786 0.0421449
+0.0505929 -0.136489 0.0374802
+0.150982 -0.0812213 0.0283619
+0.177223 -0.0595041 0.0238638
+0.161775 -0.0705999 0.0370966
+0.190578 -0.0473197 0.0139373
+0.194773 -0.0381631 -0.00234529
+0.213133 -0.00367526 -0.0159747
+0.204525 -0.0204138 -0.0117107
+0.166861 -0.0603587 -0.00961527
+0.18279 -0.0459375 -0.00894499
+0.17464 -0.03883 -0.0228556
+0.164145 -0.0577151 -0.0147795
+0.187054 -0.0252006 -0.0246064
+0.192288 -0.0290536 -0.0168655
+0.208298 -5.22161e-005 -0.0222632
+0.193565 -0.0122305 -0.026534
+0.179246 -0.0269172 -0.0264609
+0.209761 0.0306856 -0.0220953
+0.213525 0.00136752 -0.016129
+0.215868 0.0151703 -0.0127789
+0.221063 0.00203916 -0.00543525
+0.222836 0.0224423 -0.00354455
+0.23159 0.0164126 0.0115326
+0.227021 0.00705531 0.00328654
+0.206269 0.231382 -0.0367765
+0.200853 0.294011 0.0679683
+0.214038 0.272712 0.061976
+0.210639 0.236549 -0.00991969
+0.221275 0.235612 0.0142526
+0.222129 0.227402 0.00313638
+0.0204974 0.432386 0.122686
+0.0379621 0.425383 0.127448
+0.0324695 0.429381 0.107776
+0.0131387 0.43718 0.103141
+0.0451249 0.422732 0.1041
+0.0522953 0.418165 0.120785
+0.0624088 0.410371 0.100764
+0.0835717 0.402403 0.11399
+0.0875892 0.392252 0.0922081
+0.070891 0.403564 0.100843
+0.0828522 0.394909 0.0344776
+0.0717299 0.402059 0.0829533
+0.0864767 0.388762 0.0581284
+0.0960817 0.388505 -0.0283721
+0.109712 0.378891 -0.0646524
+0.114949 0.374175 -0.0798729
+0.109882 0.383612 -0.105428
+0.20323 -0.0195803 0.0614136
+0.188002 -0.0409732 0.0529771
+0.21161 -0.0229816 0.0390617
+0.224333 -0.000590076 0.0465221
+0.205841 -0.0347687 0.0236283
+0.19203 -0.0456324 0.0228181
+0.209202 -0.0341592 0.0251518
+0.211479 -0.029498 0.0311365
+0.235518 -0.00109654 0.0180954
+0.231256 -0.000592123 0.0104139
+0.23427 0.0101357 0.0178074
+0.236863 0.00897946 0.0255395
+0.233766 -0.00927706 0.0140301
+0.219959 -0.0245016 0.0167904
+0.235987 -0.00457624 0.0198988
+0.234223 0.00136683 0.0289386
+0.224599 -0.0150133 0.028712
+0.214092 0.225917 -0.0222959
+0.222397 0.220476 -0.00986235
+0.220913 0.2152 -0.0248282
+0.220065 0.212343 -0.033006
+0.219578 0.203617 -0.0396753
+0.220439 0.193955 -0.0420889
+0.224027 0.190125 -0.0380754
+0.232299 0.174261 -0.0297714
+0.223324 0.212376 -0.0243477
+0.230334 0.205264 -0.0101934
+0.230001 0.198949 -0.020081
+0.223038 0.19694 -0.0382153
+0.229536 0.192186 -0.0282786
+0.238513 0.166078 -0.0223239
+0.237754 0.175476 -0.0191882
+0.245848 0.158732 -0.0105947
+0.233267 0.229567 0.0251852
+0.242577 0.229619 0.0371062
+0.24246 0.22222 0.0251791
+0.232886 0.222707 0.0150928
+0.241784 0.218273 0.016948
+0.245862 0.200138 0.0136676
+0.254556 0.185135 0.0187998
+0.259761 0.187247 0.0274295
+0.265418 0.165677 0.0296417
+0.246665 0.219848 0.0251504
+0.255841 0.20375 0.0306177
+0.266396 0.170437 0.102107
+0.271108 0.175568 0.0786074
+0.263183 0.187597 0.0383955
+0.261708 0.203403 0.0519082
+0.269084 0.178985 0.0569633
+0.270126 0.163753 0.042568
+0.270765 0.102481 0.0730322
+0.274685 0.152857 0.0671355
+0.252058 0.182626 0.0183316
+0.26357 0.159228 0.026852
+0.254766 0.166511 0.0175385
+0.242963 0.191653 0.0110234
+0.239386 0.180679 -0.00915795
+0.239074 0.190347 0.0010648
+0.250674 0.166527 0.00922621
+0.249015 0.159397 -0.00197943
+0.260396 0.149609 0.0159529
+0.269546 0.139966 0.0266288
+0.267504 0.131259 0.0150444
+0.265562 0.124703 0.00949582
+0.257137 0.104612 0.00583933
+0.25856 0.118928 0.00431516
+0.261205 0.0782931 0.0293796
+0.262228 0.0775627 0.0552269
+0.269331 0.123969 0.0157276
+0.265998 0.100322 0.0198169
+0.255748 0.0878059 0.00845764
+0.26007 0.0841686 0.0151522
+0.239969 0.0341155 0.0198715
+0.238299 0.0202377 0.0260261
+0.235137 0.0211769 0.0187391
+0.245117 0.0409521 0.0208987
+0.254898 0.061887 0.0219751
+0.247996 0.0711473 0.00933473
+0.243022 0.0457334 0.0156751
+0.239992 0.0556354 0.00924873
+0.000403395 -0.313338 0.148871
+0.0109476 -0.312158 0.147809
+0.0220038 -0.309146 0.132058
+0.0251313 -0.302029 0.112417
+0.0239866 -0.296573 0.103343
+0.0113879 -0.295134 0.0979362
+0.0303898 -0.295068 0.10431
+0.0389293 -0.287634 0.103199
+0.0582267 -0.208822 0.149559
+0.0567428 -0.211108 0.136171
+0.061901 -0.18714 0.122061
+0.0566418 -0.203037 0.126194
+0.0556862 -0.221263 0.130581
+0.0557176 -0.240025 0.134585
+0.0430834 -0.279483 0.101354
+0.0380461 -0.273144 0.0918628
+0.0444471 -0.263087 0.0978645
+0.0548487 -0.251181 0.122979
+0.049107 -0.253018 0.105345
+0.0382734 -0.254055 0.0913863
+0.0308908 -0.265775 0.0853798
+0.0203895 -0.256276 0.0811247
+0.00705565 -0.243834 0.0790326
+0.00656489 -0.22987 0.0789787
+0.0642538 -0.182765 0.108867
+0.0567019 -0.183058 0.0940224
+0.065481 -0.17859 0.097025
+0.0535252 -0.168951 0.0774006
+0.0622238 -0.173606 0.0870766
+0.0530379 -0.176067 0.0837867
+0.042336 -0.180136 0.0808455
+0.0216611 -0.17718 0.0697361
+0.0434233 -0.222984 0.0985785
+0.0440397 -0.243312 0.098543
+0.0542808 -0.21278 0.120049
+0.0480593 -0.213664 0.104778
+0.0436772 -0.204358 0.0955834
+0.0471603 -0.188545 0.090486
+0.0371874 -0.213 0.0907857
+0.0190114 -0.214157 0.0810551
+0.143469 0.403167 0.139035
+0.162876 0.400988 0.138646
+0.163406 0.38601 0.118823
+0.151157 0.362212 0.0885619
+0.167113 0.370941 0.103583
+0.232006 0.254738 0.0603161
+0.247564 0.242042 0.0631726
+0.251942 0.238135 0.0714343
+0.254322 0.231382 0.0629542
+0.250109 0.240464 0.0659916
+0.255855 0.229113 0.0734144
+0.258542 0.218977 0.0801165
+0.265056 0.199168 0.0692126
+0.259169 0.217752 0.0636975
+0.251247 0.238751 0.0815308
+0.245039 0.249934 0.0883127
+0.241888 0.251155 0.0986331
+0.25003 0.237543 0.0893107
+0.104578 0.318292 0.262391
+0.0886281 0.325283 0.27401
+0.0937589 0.379476 0.251276
+0.0761365 0.378217 0.245243
+0.0694378 0.411497 0.183778
+0.0657479 0.404778 0.202982
+0.0953875 0.40547 0.222993
+0.0744171 0.402487 0.216011
+0.0662496 0.385124 0.236948
+0.0629596 0.396677 0.221503
+0.0527389 0.39162 0.225868
+0.0662974 0.367224 0.249525
+0.0674755 0.37622 0.24346
+0.210393 0.398176 0.139323
+0.207782 0.378927 0.121657
+0.18447 0.380546 0.119191
+0.252064 0.38016 0.128604
+0.227194 0.379342 0.124333
+0.235235 0.400012 0.142112
+0.242395 0.422197 0.162808
+0.260601 0.43373 0.17726
+0.169103 0.370765 0.190142
+0.175533 0.387812 0.189153
+0.206336 0.382882 0.161443
+0.187757 0.394957 0.181307
+0.193919 0.381898 0.168718
+0.21127 0.351343 0.15277
+0.213141 0.365702 0.15075
+0.202214 0.369733 0.159267
+0.262308 0.431744 0.180521
+0.252623 0.419943 0.17537
+0.234867 0.400339 0.163462
+0.219699 0.403743 0.168984
+0.220903 0.381499 0.154676
+0.237004 0.378419 0.148624
+0.103611 0.375385 0.257711
+0.106536 0.365888 0.26259
+0.111649 0.362329 0.260633
+0.120818 0.357362 0.246935
+0.101103 0.35784 0.263087
+0.0906901 0.349458 0.264656
+0.079952 0.335264 0.274372
+0.0856323 0.344413 0.267984
+0.0729189 0.358976 0.257696
+0.0840338 0.349715 0.265165
+0.106416 0.341717 0.249288
+0.0920744 0.344818 0.263972
+0.239131 0.291749 0.108665
+0.243587 0.301707 0.10811
+0.22567 0.360336 0.142425
+0.241741 0.327997 0.121433
+0.267761 0.374573 0.128053
+0.281475 0.375506 0.134466
+0.269039 0.421527 0.169017
+0.279086 0.391321 0.147466
+0.251838 0.398595 0.159556
+0.251839 0.376983 0.14491
+0.265882 0.376692 0.14359
+0.282538 0.372797 0.1386
+0.27557 0.370073 0.139342
+0.265124 0.324718 0.116714
+0.253617 0.315066 0.112867
+0.269369 0.336793 0.122012
+0.269866 0.360327 0.133927
+0.257786 0.356756 0.132739
+0.187733 0.362396 0.104304
+0.214145 0.329345 0.0920047
+0.205097 0.300497 0.0732056
+0.221317 0.303318 0.0812544
+0.256418 0.363924 0.118698
+0.255514 0.339344 0.106039
+0.250234 0.325928 0.100109
+0.234624 0.3154 0.0918484
+0.279222 0.312162 0.102283
+0.265873 0.322508 0.101516
+0.274625 0.320665 0.113923
+0.280971 0.311411 0.106842
+0.284894 0.325275 0.110622
+0.285858 0.357169 0.126884
+0.255583 0.268514 0.0798339
+0.240471 0.289957 0.0822912
+0.252488 0.258335 0.0766102
+0.248112 0.245676 0.0680939
+0.258291 0.268861 0.0854398
+0.253151 0.289905 0.0998078
+0.264766 0.274994 0.0869777
+0.27617 0.297341 0.0984147
+0.21978 0.421164 0.161469
+0.214653 0.441142 0.181382
+0.146092 0.413202 0.160383
+0.170348 0.431409 0.185824
+0.165475 0.416291 0.161453
+0.208784 0.446217 0.188061
+0.185906 0.427346 0.17078
+0.191703 0.444527 0.194366
+0.165366 0.445342 0.225974
+0.176711 0.447132 0.21139
+0.211434 0.47461 0.236722
+0.19635 0.459862 0.218088
+0.193468 0.467567 0.256298
+0.206363 0.474025 0.246429
+0.213892 0.472408 0.239021
+0.207873 0.456565 0.229079
+0.194965 0.430355 0.210004
+0.182526 0.419272 0.212169
+0.183645 0.40679 0.195952
+0.186106 0.443991 0.241999
+0.183239 0.43007 0.225601
+0.194839 0.443467 0.228059
+0.209285 0.444748 0.212182
+0.223489 0.447314 0.204044
+0.236884 0.422355 0.179939
+0.229235 0.442301 0.197588
+0.222027 0.421571 0.181573
+0.257156 0.445136 0.190683
+0.245514 0.46193 0.207751
+0.239909 0.465363 0.214187
+0.233338 0.454914 0.208072
+0.234918 0.471449 0.21967
+0.221644 0.475512 0.232516
+0.238443 0.467269 0.211559
+0.224707 0.456477 0.197686
+0.116473 0.408918 0.230454
+0.136646 0.416982 0.241386
+0.157541 0.438166 0.236334
+0.150064 0.428588 0.244741
+0.142656 0.41716 0.251565
+0.135165 0.404941 0.256978
+0.111617 0.38679 0.254682
+0.127098 0.39612 0.257538
+0.159333 0.396327 0.225064
+0.171684 0.396594 0.202353
+0.143348 0.371804 0.230514
+0.149585 0.387367 0.234989
+0.141741 0.380619 0.244335
+0.160017 0.405244 0.23912
+0.168752 0.421122 0.245403
+0.181316 0.439327 0.245207
+0.173856 0.429146 0.246405
+0.166017 0.434348 0.262354
+0.154915 0.428724 0.254872
+0.183721 0.456053 0.261444
+0.173831 0.441999 0.263417
+0.169633 0.433173 0.262448
+0.171108 0.428853 0.25418
+0.139305 0.398013 0.263
+0.134533 0.399623 0.260506
+0.148988 0.407196 0.262878
+0.162561 0.426084 0.262991
+0.143624 0.396337 0.260912
+0.141194 0.386775 0.253892
+0.150397 0.395933 0.247898
+0.116966 0.370602 0.262949
+0.133288 0.387305 0.262947
+0.0989013 0.381559 0.00676147
+0.0996324 0.377515 0.0373772
+0.117905 0.361902 0.0118589
+0.126002 0.353194 0.0231259
+0.132884 0.345413 0.0430813
+0.136826 0.353578 0.0733298
+0.13478 0.344483 0.0554112
+0.224662 0.240269 0.0251101
+0.207593 0.264958 0.0310116
+0.230018 0.244414 0.038902
+0.215985 0.268028 0.0580233
+0.22696 0.253592 0.0496025
+0.201317 0.277734 0.0443216
+0.177471 0.300584 0.0355465
+0.148236 0.330981 0.0434424
+0.177478 0.28926 -0.00956953
+0.185794 0.286396 0.0200141
+0.178982 0.282443 -0.0439311
+0.20042 0.246471 -0.0251019
+0.184835 0.272886 -0.0261039
+0.152403 0.327637 -0.0342319
+0.157335 0.319935 -0.0134472
+0.168651 0.302528 -0.0265913
+0.131625 0.34946 0.000498271
+0.146924 0.333266 -0.00608164
+0.142194 0.340154 -0.0279646
+0.120584 0.366839 -0.0647275
+0.136659 0.347408 -0.0497377
+0.148415 0.333234 -0.057811
+0.0363424 0.431433 0.0310867
+0.0350141 0.42862 0.0886213
+0.0271728 0.439584 -0.0114582
+-0.000509875 0.449231 -0.0156505
+0.07892 0.4023 -0.00219649
+0.0550473 0.422153 -0.00861668
+0.0476702 0.430383 -0.0500749
+0.0619713 0.424172 -0.100778
+0.0255108 -0.112816 0.00943917
+0.054459 -0.107917 0.00663383
+0.0532584 -0.116248 0.0179937
+0.0899093 -0.117481 0.025704
+0.0731824 -0.118309 0.0232761
+0.078277 -0.112693 0.0130663
+0.118023 -0.0959796 -0.000451857
+0.0876814 -0.105819 0.00268589
+0.136856 -0.0928453 0.02018
+0.134243 -0.0908311 0.00488306
+0.159506 -0.0658663 -0.00888151
+0.14365 -0.0790179 -0.00420118
+0.127383 -0.0846832 -0.00858801
+0.109423 -0.0838607 -0.01815
+0.0625282 -0.101469 -0.00382167
+0.0434929 -0.093947 -0.018333
+0.0921399 -0.088094 -0.0208462
+0.0603324 -0.0925197 -0.0223219
+0.0322061 -0.0933866 -0.029957
+0.048221 0.332816 0.285434
+0.0634558 0.330906 0.282529
+0.0161849 0.334052 0.290431
+0.00309406 0.333953 0.293426
+0.21758 0.0398388 -0.0129161
+0.218518 0.0558715 -0.0167262
+0.248737 0.088296 0.0052141
+0.23969 0.0707821 0.00249818
+0.242539 0.0898966 -0.00469194
+0.251118 0.10696 0.000126274
+0.232849 0.075143 -0.0127776
+0.230636 0.0606836 -0.00471105
+0.221749 0.0595007 -0.0164607
+0.246252 0.106445 -0.0130963
+0.251137 0.123164 -0.0164539
+0.252235 0.1194 -0.00693689
+0.2374 0.0913621 -0.0203185
+0.232256 0.091857 -0.0294833
+0.237151 0.103959 -0.0295468
+0.247852 0.120743 -0.0226249
+0.217104 0.0632159 -0.0242003
+0.222316 0.0803851 -0.0307918
+0.225829 0.0907853 -0.0329425
+0.244159 0.138696 -0.0198012
+0.252139 0.133581 -0.00946442
+0.249493 0.126754 -0.0176176
+0.238121 0.163274 -0.0225922
+0.240513 0.151256 -0.0212789
+0.237056 0.145764 -0.0279387
+0.0299242 0.403191 0.206314
+0.0425025 0.396491 0.216932
+0.053201 0.400226 0.209497
+0.020724 0.416835 0.17789
+0.0184442 0.410423 0.196749
+-0.0406555 0.420183 0.190386
+-0.0397115 0.423753 0.179089
+0.00438683 0.410811 0.206175
+-0.0246671 0.415529 0.203713
+-0.0541204 0.339732 0.290323
+-0.0405811 0.354176 0.280642
+-0.0546945 0.367986 0.26292
+-0.00973335 0.343575 0.28949
+-0.0120063 0.365705 0.269745
+-0.0195268 0.354711 0.281887
+-0.0158457 0.37652 0.259141
+-0.0351868 0.380399 0.253247
+-0.0269694 0.366469 0.270193
+0.0616307 0.366151 0.25103
+0.0406166 0.371758 0.249304
+0.0332203 0.34282 0.280402
+0.0309911 0.363025 0.261483
+0.0125974 0.376579 0.251427
+-0.000197943 0.389173 0.240997
+-0.00726588 0.375898 0.257807
+0.0218004 0.385637 0.237922
+0.0172265 0.402098 0.215945
+0.00683314 0.396977 0.228792
+0.0454921 -0.287697 0.127511
+0.0432827 -0.286134 0.10991
+0.0384891 -0.298108 0.142508
+0.0299734 -0.306088 0.144492
+0.0552603 -0.260813 0.136107
+0.0517881 -0.273185 0.137927
+0.0845307 0.409419 -0.117937
+0.0577271 0.429259 -0.12788
+0.0322641 0.440131 -0.137042
+-0.0149707 0.443371 0.0904867
+-0.0303188 0.34184 0.293252
+0.256662 0.128906 -0.00185725
+0.0586636 -0.124634 0.0295748
+0.236075 0.0133103 0.0339248
+0.270811 0.14894 0.0367383
+0.0192189 -0.27758 0.0837839
+0.237094 0.0248368 0.0577414
+0.244478 0.240937 0.10198
+0.19178 0.365884 0.168948
+-0.0427612 0.325169 0.305025
+-0.0316081 0.311074 0.316603
+-0.0195773 0.329881 0.30209
+0.0124725 0.0451751 0.373761
+0.0300655 0.0408627 0.360606
+0.0263838 0.0595437 0.360954
+-0.0104569 0.451107 -0.0574268
+-0.0231177 0.450246 0.0183753
+-0.0457884 0.411617 0.210521
+-0.0498844 0.393396 0.235242
+0.0286308 0.320481 0.298064
+0.163389 -0.0386962 0.11081
+0.189783 -0.0213236 0.0909502
+0.208419 0.00480627 0.103855
+0.185538 -0.0103214 0.120567
+0.11151 -0.0818383 0.122858
+0.134661 -0.0691918 0.100352
+0.135948 -0.053559 0.132041
+0.075787 -0.142033 0.132565
+0.0845259 -0.137101 0.117925
+0.0916812 -0.112998 0.130686
+0.050952 -0.248545 0.186309
+0.0552153 -0.238541 0.166169
+0.0569053 -0.22045 0.166423
+0.0317958 -0.275339 0.208956
+0.0437898 -0.269858 0.186566
+-0.0178913 -0.297375 0.20422
+-0.00151119 -0.286246 0.215096
+0.0121291 -0.152391 0.0474293
+0.00528713 -0.183752 0.0676031
+0.00728841 -0.168398 0.0594956
+0.00594444 -0.269605 0.0775262
+0.0559326 -0.248443 0.149804
+0.00287086 -0.288899 0.0878117
+-0.00355752 -0.301712 0.107071
+-0.0745714 0.301181 0.311553
+-0.0649793 0.32203 0.300468
+-0.0779651 0.155092 0.385914
+-0.0662523 0.181735 0.378977
+-0.0780675 0.204509 0.367219
+-0.0790278 0.108372 0.399599
+-0.0657745 0.133401 0.394069
+-0.0814202 0.0408149 0.431352
+-0.0683539 0.0589881 0.424865
+-0.0811131 0.0742523 0.415314
+-0.0848651 -0.0334152 0.467726
+-0.0698897 -0.0144359 0.460027
+-0.0832659 0.00400153 0.449552
+-0.0878923 -0.102499 0.49561
+-0.0735564 -0.0843126 0.490725
+-0.0871892 -0.0707828 0.485188
+-0.0886704 -0.122155 0.499425
+-0.0747379 -0.109139 0.49802
+-0.00458819 0.318109 0.307239
+0.013712 0.258972 0.345445
+0.00432335 0.23819 0.360074
+0.0234419 0.232363 0.358362
+0.0379587 0.248516 0.34275
+-0.0301461 0.191921 0.380052
+-0.0444697 0.180767 0.382545
+-0.0321801 0.156228 0.38815
+-0.0188572 0.166815 0.383979
+0.0547743 0.212779 0.35748
+0.0338312 0.216668 0.363793
+0.0274875 0.203206 0.37073
+0.0442758 0.201894 0.367071
+-0.0329248 0.0593158 0.421552
+-0.0357376 0.0780944 0.413909
+-0.043282 0.0624016 0.424141
+-0.02021 -0.00486565 0.436939
+-0.0119005 0.00684099 0.420025
+-0.0168088 0.0258265 0.419333
+-0.0251757 0.0175825 0.43324
+-0.032045 -0.0788794 0.476655
+-0.027852 -0.0903778 0.474852
+-0.022356 -0.0822779 0.46546
+-0.02542 -0.0689222 0.466927
+-0.0283189 -0.105422 0.480118
+-0.0245211 -0.0997747 0.472108
+-0.0319651 -0.0974922 0.48181
+0.0341097 -0.0363851 0.382453
+0.0590233 -0.0343073 0.347541
+0.0365062 -0.00695156 0.360331
+0.0115879 -0.00840406 0.392391
+-0.0115367 -0.0980751 0.447935
+-0.0061185 -0.0955919 0.44273
+-0.00489739 -0.0828075 0.437165
+-0.0102569 -0.089799 0.445382
+0.0610471 -0.127646 0.389983
+0.04265 -0.129218 0.414469
+0.0488968 -0.155999 0.404757
+0.0638599 -0.154827 0.380054
+0.0739475 -0.0307341 0.315762
+0.0729571 -0.0638644 0.343477
+0.082141 -0.0596018 0.311342
+0.0785958 -0.00110609 0.300904
+0.0617604 -0.00433189 0.327048
+0.0831683 -0.0264756 0.290338
+0.127827 0.226958 0.293268
+0.0991471 0.236137 0.312707
+0.12576 0.203555 0.305194
+0.148062 0.188189 0.288011
+0.135966 0.128527 0.307399
+0.131406 0.111589 0.307289
+0.141189 0.118698 0.298128
+0.104711 0.0717903 0.316702
+0.123143 0.0847781 0.301924
+0.115395 0.0986976 0.319872
+0.101319 0.200422 0.331581
+0.0749079 0.217141 0.34206
+0.0800469 0.20252 0.348107
+0.0644742 0.262069 0.320698
+0.0696119 0.233002 0.334481
+0.167373 0.0156153 0.166502
+0.177534 0.0477149 0.17764
+0.161638 0.0258067 0.185122
+0.148705 -0.00649288 0.173451
+0.130317 -0.0352465 0.166861
+0.126841 -0.0235297 0.187424
+0.109097 -0.0534717 0.177638
+0.0911549 -0.0530321 0.25272
+0.0884547 -0.0899048 0.241267
+0.0893107 -0.0604365 0.219426
+0.085706 -0.11947 0.267082
+0.0914396 -0.0871145 0.274487
+0.0613235 -0.19748 0.33214
+0.0724732 -0.174364 0.312915
+0.0725633 -0.177747 0.341475
+0.0559108 -0.198044 0.358193
+0.0411613 -0.209292 0.348547
+0.0499036 0.0422121 0.344806
+0.040605 0.0286496 0.350626
+0.0592021 0.0599362 0.342511
+0.068474 0.038961 0.327678
+0.0760512 0.0537986 0.329786
+-0.00615945 -0.105548 0.445624
+-0.0123749 -0.109753 0.451127
+-0.0108951 -0.122155 0.451489
+-0.000474381 -0.12211 0.443801
+0.0403845 0.133453 0.360852
+0.039648 0.136327 0.363702
+0.0329227 0.131582 0.360981
+0.0364093 0.130459 0.358923
+0.0704473 0.316676 0.286823
+0.248996 0.244538 0.0797575
+0.261381 0.0794753 0.0955363
+0.24968 0.0503919 0.0771003
+-0.0435346 0.137412 0.394911
+-0.0337862 0.115419 0.398639
+-0.0231607 0.132854 0.389482
+0.131126 0.161872 0.313923
+0.121832 0.189146 0.316114
+0.117064 0.176358 0.325971
+0.0527949 0.0907853 0.348447
+0.0423728 0.075999 0.351667
+0.0694337 0.077029 0.34102
+0.0304116 0.0980014 0.356477
+0.017806 0.0880189 0.36299
+0.0548439 0.183644 0.371185
+0.06269 0.195878 0.363081
+0.0402542 0.188394 0.37315
+0.0831635 0.184422 0.355908
+0.101017 0.186157 0.340141
+0.112192 0.165724 0.335232
+0.122662 0.153415 0.324558
+0.120744 0.138206 0.326456
+0.121204 0.123455 0.32276
+0.129382 0.140089 0.317031
+0.0810277 0.0932651 0.338481
+0.0870828 0.0689993 0.330584
+0.0983703 0.0894359 0.330005
+0.000860712 0.0882646 0.375058
+0.0172695 0.112663 0.361332
+0.00561203 0.115898 0.370703
+-0.00607345 0.127428 0.379229
+0.0162791 0.131062 0.368059
+0.00693621 0.139599 0.375012
+0.109118 0.112766 0.329606
+0.175122 0.223489 0.226859
+0.175224 0.195261 0.236671
+0.186775 0.179544 0.217731
+0.153123 0.157543 0.286202
+0.162937 0.138886 0.270041
+0.163199 0.172836 0.271638
+0.141471 0.148128 0.302487
+0.15375 0.114532 0.277767
+0.153707 0.0899253 0.26561
+0.169041 0.114717 0.253114
+0.131006 0.0716251 0.281141
+0.119668 0.0452051 0.274197
+0.144958 0.0604474 0.254892
+0.191736 0.130059 0.205305
+0.198994 0.161115 0.198324
+0.0985341 0.039548 0.294026
+0.0930634 0.020194 0.288143
+0.111598 0.022114 0.266263
+0.0926764 0.0534539 0.314048
+0.0445727 0.14035 0.365701
+0.0472238 0.145965 0.369167
+0.0390003 0.142283 0.367989
+0.0609816 0.114205 0.345899
+0.0492278 0.119281 0.348171
+0.0397265 0.120858 0.352868
+0.0486818 0.11194 0.350635
+0.0874527 0.120427 0.339832
+0.0733155 0.118552 0.342019
+0.0763099 0.111021 0.342503
+0.104303 0.1342 0.33572
+0.0953507 0.129718 0.336867
+0.0993607 0.121499 0.337168
+0.104668 0.140584 0.334743
+0.107777 0.139501 0.335239
+0.0972864 0.157872 0.351541
+0.10275 0.153658 0.344728
+0.106066 0.155813 0.343054
+0.0727544 0.159601 0.366784
+0.0840447 0.157958 0.359246
+0.0857224 0.164755 0.359678
+0.0635999 0.156349 0.368532
+0.06223 0.16311 0.370583
+0.0566241 0.155395 0.370614
+0.0318723 0.120889 0.355069
+0.0256139 0.120011 0.354681
+0.021928 0.114707 0.356228
+0.0289195 0.111946 0.356447
+0.0211943 0.122899 0.359401
+0.0260869 0.125685 0.358017
+0.0254214 0.130444 0.363428
+0.0214898 0.119814 0.356099
+0.0388863 0.125513 0.353304
+0.0356209 0.125832 0.355237
+0.0308669 0.126123 0.356267
+0.0391477 0.129324 0.357004
+0.0945937 0.15651 0.349418
+0.102597 0.1522 0.341404
+0.0405941 0.13215 0.35807
+0.0405859 0.13548 0.353904
+0.0426076 0.136643 0.361844
+0.0396733 0.128527 0.354099
+0.0392781 0.131583 0.350151
+0.0419599 0.124597 0.349836
+0.038915 0.128169 0.346378
+0.0600007 0.118536 0.344079
+0.0493179 0.122182 0.341103
+0.0849921 0.124912 0.338551
+0.0733394 0.121539 0.334629
+0.100488 0.137894 0.334079
+0.0949636 0.13265 0.329207
+0.103052 0.146795 0.335457
+0.103907 0.143424 0.32724
+0.100884 0.153097 0.333941
+0.101868 0.150865 0.339123
+0.0717142 0.15743 0.363063
+0.0829615 0.160632 0.349539
+0.0570159 0.153823 0.367029
+0.0630852 0.158698 0.358551
+0.0440028 0.142331 0.357667
+0.0481309 0.14528 0.366106
+0.11166 0.13959 0.334048
+0.106967 0.145658 0.33651
+0.0248064 0.176757 0.378588
+0.0105558 0.173614 0.379649
+0.0157931 0.159515 0.377848
+0.0298021 0.164292 0.377378
+0.0481132 0.153925 0.371843
+0.0521232 0.149876 0.369231
+0.0513137 0.152003 0.35998
+-0.024863 0.0548545 0.416267
+-0.0164887 0.0382676 0.413276
+-0.0109203 0.0512868 0.398749
+-0.0193984 0.0740209 0.400674
+-0.040491 -0.0984908 0.488373
+-0.0490101 -0.101143 0.492507
+-0.0429134 -0.10649 0.49112
+-0.0212284 -0.109195 0.467868
+-0.0171187 -0.104523 0.457775
+-0.0194988 -0.0944616 0.461754
+-0.0156116 -0.0862183 0.453965
+-0.0180572 -0.0724926 0.457183
+-0.00477862 -0.0147703 0.416962
+-0.00154259 0.0119527 0.401795
+-1.91118e-005 0.0304932 0.392352
+-0.00253026 0.0673912 0.382228
+-0.0599174 -0.187329 0.424646
+-0.0382112 -0.198371 0.414838
+-0.0263804 -0.180922 0.432488
+-0.0463174 -0.170971 0.443444
+-0.0329548 -0.151731 0.453703
+-0.0190333 -0.15787 0.448203
+-0.0169358 -0.139007 0.456043
+-0.0139939 -0.0959585 0.450885
+-0.0152321 -0.100572 0.452146
+-0.013983 -0.0993624 0.450277
+-0.01357 -0.102165 0.450079
+-0.0160041 -0.10551 0.452672
+-0.0164791 -0.113104 0.454818
+-0.0172388 -0.111209 0.456708
+0.0190128 -0.12632 0.432317
+0.0251463 -0.100772 0.421963
+0.00335002 -0.102581 0.437971
+-0.0114561 -0.0771969 0.445831
+-0.0693737 -0.196643 0.405346
+-0.000320805 -0.213793 0.384284
+-0.0204284 -0.214494 0.3854
+0.0165392 -0.216834 0.364774
+-0.00775323 -0.188421 0.421234
+-0.00355411 -0.164598 0.436504
+-0.0554269 -0.204845 0.397714
+0.0954066 -0.0773436 0.172656
+0.0944865 -0.0654977 0.192135
+0.0779528 0.0201721 0.308624
+0.090714 -3.31043e-005 0.278473
+0.154288 0.0477545 0.222909
+0.141896 0.0114531 0.204613
+0.172611 0.0646848 0.202774
+0.120958 0.00446499 0.231815
+0.108121 -0.0284769 0.212803
+0.0973512 -0.0230901 0.240982
+0.00425032 -0.203644 0.0747413
+0.0614771 -0.193764 0.151569
+0.0676836 -0.165931 0.137091
+0.0727578 -0.160523 0.120965
+0.0660318 -0.178151 0.127728
+0.0988426 -0.106342 0.112165
+0.0988372 -0.0911976 0.141773
+0.0302116 -0.152944 0.422346
+0.0315549 -0.175158 0.409926
+0.0479671 -0.178185 0.392629
+-0.0364222 -0.210963 0.392464
+0.0102753 -0.19085 0.411389
+-0.0210434 -0.203345 0.410762
+-0.00208591 -0.204958 0.403301
+-0.0368154 -0.206074 0.405576
+0.0451202 -0.281998 0.158837
+-0.0134813 -0.312473 0.174237
+-0.00910266 -0.311211 0.132514
+0.0187903 -0.307137 0.167483
+0.0166887 -0.291712 0.200323
+0.00916546 -0.145982 0.435641
+0.215316 0.149381 0.17719
+0.20787 0.191609 0.189225
+0.0916341 0.109161 0.33778
+0.103662 0.116413 0.334317
+0.0641111 0.101609 0.345276
+0.0381403 0.105796 0.354233
+0.0261599 0.137516 0.36787
+0.0209001 0.14767 0.373936
+0.0357042 0.152082 0.373122
+0.0435236 0.165686 0.375323
+0.0508994 0.170718 0.37367
+0.0696419 0.174357 0.366996
+0.0996597 0.169502 0.348159
+0.114694 0.148498 0.332861
+0.113154 0.127446 0.331191
+-0.0109968 0.0878551 0.386161
+-0.0169897 0.111694 0.38815
+-0.0259237 0.095106 0.400275
+-0.0447331 0.0964513 0.40875
+-0.067999 0.0927538 0.408511
+-0.027409 -0.0205735 0.452221
+-0.0225703 -0.0417623 0.455034
+-0.014985 -0.0278708 0.438301
+-0.00917433 -0.0515496 0.435377
+0.00706316 -0.041664 0.4119
+0.0297604 -0.0721684 0.406703
+0.057278 -0.068471 0.376981
+0.0695484 -0.0974478 0.371088
+0.0799916 -0.0926228 0.338417
+0.0517294 -0.100605 0.399594
+0.0739264 -0.124487 0.361385
+0.00492947 -0.077719 0.427232
+-0.015445 -0.0631961 0.450473
+-0.0196346 -0.0604556 0.457007
+-0.0296096 -0.0536573 0.467062
+-0.0717831 -0.0510356 0.477025
+-0.00554856 -0.0713671 0.434402
+-0.0683976 0.0230805 0.442128
+0.0881162 -0.1181 0.298292
+0.0805629 -0.148413 0.292283
+0.0818216 -0.148452 0.320654
+-0.0119783 0.145576 0.38297
+-0.00371314 0.170778 0.381414
+0.00862077 0.189149 0.379183
+-0.0053786 0.189355 0.381452
+-0.0307768 0.0398354 0.429098
+-0.0418391 0.0225611 0.442605
+-0.0336292 0.00156273 0.447961
+-0.0430766 -0.0153833 0.460018
+-0.0347213 -0.0355578 0.465019
+-0.0446833 -0.0497885 0.474571
+-0.037298 -0.0651565 0.476628
+-0.04643 -0.0781859 0.484935
+-0.0377382 -0.0887192 0.484207
+-0.0338387 -0.104626 0.485337
+-0.0624327 -0.113474 0.497594
+-0.0595256 -0.0936726 0.492737
+-0.0585762 -0.0659598 0.482816
+-0.0560364 -0.0327654 0.468971
+-0.0552999 0.00431687 0.452086
+-0.0539614 0.0417903 0.434553
+-0.0564377 0.0774801 0.417473
+-0.0549757 0.114038 0.401828
+-0.0544167 0.159541 0.388233
+-0.0568077 0.206734 0.371957
+-0.0551743 0.305209 0.316599
+-0.0764368 -0.126307 0.5
+-0.0520256 -0.117809 0.49603
+-0.0350326 -0.112198 0.487542
+-0.0305208 -0.111808 0.484545
+-0.0259551 -0.114177 0.478871
+-0.0188715 -0.118386 0.463507
+-0.0186237 -0.117022 0.4578
+-0.0165801 -0.124395 0.457249
+-0.00706453 -0.140606 0.447754
+0.0145181 -0.170946 0.423268
+0.026736 -0.193107 0.398316
+0.0322061 -0.208613 0.370037
+-0.0152567 0.198714 0.38016
+-0.0204196 0.221805 0.372445
+-0.0375662 0.223219 0.370317
+-0.0480033 0.234502 0.363485
+-0.0570664 0.260053 0.34759
+-0.067311 0.232079 0.358081
+-0.0767972 0.254519 0.342279
+0.00128458 0.153169 0.379124
+-0.0168006 0.245223 0.359988
+-0.00191937 0.218745 0.371892
+0.0112623 0.203394 0.375245
+0.0238153 0.18972 0.375828
+0.0400542 0.17594 0.3764
+-0.0664857 0.281506 0.329346
+-0.0445721 0.287277 0.333073
+-0.0289366 0.273775 0.342744
+-0.0164662 0.29764 0.324487
+0.00378003 0.286753 0.328007
+0.015458 0.307726 0.309996
+0.0386829 0.308064 0.303263
+0.0604219 0.29144 0.303429
+0.0949479 0.298209 0.279638
+0.121254 0.298981 0.25392
+0.131989 0.262683 0.265284
+0.151562 0.264957 0.238243
+0.161353 0.27892 0.215831
+0.175674 0.248753 0.20965
+0.18747 0.24392 0.195904
+0.177627 0.269546 0.197093
+0.220781 0.203512 0.170799
+0.20543 0.219595 0.185259
+0.24933 0.179954 0.130112
+0.238748 0.163556 0.150101
+-0.0344722 0.442671 0.100645
+-0.0373171 0.436534 0.128646
+0.21623 0.0020296 0.074884
+0.241343 0.0606577 0.115036
+0.265957 0.139644 0.111813
+0.24748 0.108933 0.12763
+-0.0400753 0.430446 0.154212
+-0.0198667 -0.211004 0.397981
+0.016759 -0.206544 0.388575
+0.0425059 -0.19565 0.380407
+0.0634429 -0.179972 0.369501
+0.0756273 -0.151547 0.350872
+0.0836031 -0.120629 0.32983
+0.0879305 -0.0885035 0.305869
+0.0892117 -0.0559221 0.28199
+0.0903345 -0.0215284 0.265722
+0.104029 0.00122145 0.257043
+0.132622 0.0314754 0.243951
+0.165426 0.083342 0.238341
+0.179094 0.109664 0.222942
+0.176406 0.148858 0.24278
+0.166728 0.181202 0.262446
+0.155265 0.223211 0.260085
+0.132046 0.246255 0.276682
+0.0422343 0.0154952 0.3478
+0.059712 0.0235365 0.330984
+0.0828727 0.0381085 0.31192
+0.109519 0.0589847 0.297909
+0.140897 0.0987604 0.288331
+0.148442 0.133217 0.290737
+0.140348 0.173698 0.300713
+0.100488 0.213869 0.323764
+0.0459761 0.22692 0.352603
+0.0161836 0.217042 0.368326
+-0.00425783 0.202096 0.379102
+0.0145106 0.0132994 0.379179
+-0.00983505 0.0266811 0.408699
+0.152567 0.204231 0.276661
+0.0962148 0.266612 0.29738
+0.0299447 0.276956 0.326856
+-0.00750751 0.265896 0.345167
+-0.0368277 0.247305 0.359587
+0.0512666 0.159369 0.326591
+0.043194 0.149529 0.324989
+0.0403634 0.142038 0.322087
+0.0401279 0.137129 0.319468
+0.0413667 0.132962 0.316646
+0.0533621 0.127912 0.309655
+0.0761201 0.127851 0.300815
+0.0952612 0.13627 0.296583
+0.103184 0.146012 0.297429
+0.0993157 0.158662 0.305215
+0.0835887 0.16843 0.316806
+0.0646278 0.167159 0.324465
+0.103976 0.139909 0.310269
+0.0881523 0.127783 0.313455
+0.106126 0.149781 0.313417
+0.095707 0.164104 0.326242
+0.0727134 0.166728 0.33891
+0.0560807 0.161504 0.343633
+0.0450737 0.151516 0.343502
+0.0394808 0.141552 0.340104
+0.038072 0.13609 0.336837
+0.0376195 0.131614 0.33336
+0.0410139 0.127416 0.329446
+0.0622443 0.121272 0.320263
+0.0972448 -0.0835829 0.158397
+0.112054 -0.0694805 0.147475
+0.133451 -0.0438523 0.150646
+0.160626 -0.0256006 0.137042
+0.202352 0.0155157 0.126063
+0.177978 0.00128629 0.142088
+0.15445 -0.0158017 0.155611
+0.110572 -0.0614604 0.162569
+0.218899 0.0878517 0.154122
+0.188222 0.0335968 0.154768
+0.00725223 0.44676 -0.116544
+-0.0308873 0.446668 0.0724077
+0.00105593 -0.304426 0.188255
+0.032447 -0.292055 0.180031
+0.0525499 -0.258676 0.165976
+0.228092 0.0227713 0.093836
+0.224547 0.0270114 0.10977
+0.214866 0.0449908 0.134469
+0.19275 0.0672908 0.172873
+0.187306 0.0773088 0.186712
+0.197429 0.258684 0.176238
+-0.25103 0.318615 0.133147
+-0.274762 0.324197 0.0956182
+-0.281088 0.309377 0.0741618
+-0.294729 0.28421 0.03996
+-0.28572 0.300965 0.0619917
+-0.298514 0.256612 0.0155884
+-0.299354 0.221192 -0.0139379
+-0.293235 0.180766 -0.0428411
+-0.287409 0.171458 -0.059684
+-0.297292 0.20542 -0.0255326
+-0.272315 0.352752 0.122091
+-0.274076 0.35804 0.122955
+-0.276861 0.339545 0.101361
+-0.275211 0.347536 0.111055
+-0.263744 0.33651 0.12676
+-0.260368 0.314422 0.122692
+-0.265998 0.315927 0.111749
+0.240701 0.266635 0.0968455
+0.18535 0.353243 0.175912
+0.177723 0.351688 0.1832
+0.124337 0.311887 0.244295
+0.135932 0.360284 0.236636
+0.141663 0.357216 0.226335
+0.128728 0.355446 0.241511
+0.120656 0.34886 0.241713
+0.115687 0.343266 0.242509
+0.114647 0.338601 0.244719
+0.120599 0.32866 0.243171
+0.137751 0.317645 0.231529
+0.143261 0.336327 0.225154
+0.149253 0.35657 0.217299
+0.151294 0.312732 0.220353
+0.225237 0.260208 0.136228
+0.213644 0.267036 0.153498
+0.232381 0.301119 0.125479
+0.234742 0.269968 0.113936
+0.222911 0.31895 0.140682
+0.185806 0.287729 0.183401
+0.1726 0.294898 0.197493
+0.195771 0.343974 0.167607
+0.205724 0.303112 0.159445
+0.16621 0.327923 0.201553
+0.157766 0.357538 0.206565
+0.00849859 -0.412038 -0.177435
+-0.00213847 -0.358958 -0.160734
+-0.0462129 -0.356447 -0.207
+0.0285284 -0.46957 -0.20337
+0.0401374 -0.420919 -0.16185
+-0.110792 0.0714265 -0.440178
+-0.0482804 0.194974 -0.469983
+-0.112458 -0.219134 -0.267357
+0.0487057 0.278192 -0.476477
+0.120389 0.303701 -0.467229
+-0.120739 0.0315061 -0.368542
+-0.102032 0.105546 -0.399784
+-0.124848 -0.124333 -0.302066
+-0.0428629 0.215354 -0.424061
+0.0397593 0.299734 -0.424369
+0.0976632 0.330732 -0.409061
+-0.130936 -0.0548948 -0.393591
+-0.124624 -0.030057 -0.340117
+0.118425 -0.413556 -0.148277
+0.123421 -0.356572 -0.120369
+0.17599 -0.355378 -0.139189
+0.0990235 -0.472409 -0.187248
+0.0828304 -0.421402 -0.150413
+0.357045 0.0758427 -0.289771
+0.320186 0.199644 -0.350768
+0.260878 -0.21127 -0.144028
+0.241917 0.280815 -0.414583
+0.17508 0.303944 -0.450499
+0.320497 0.0452666 -0.218614
+0.32077 0.11876 -0.256111
+0.290222 -0.113384 -0.16208
+0.279183 0.227418 -0.311769
+0.204458 0.308129 -0.363552
+0.14518 0.333475 -0.390924
+0.348424 -0.0518588 -0.24076
+0.308992 -0.0169675 -0.193144
+-0.0374604 -0.220508 -0.0965554
+-0.0442328 -0.289496 -0.11703
+-0.0402241 -0.196245 -0.0872643
+-0.045785 -0.158778 -0.0735039
+-0.039702 -0.310325 -0.127649
+-0.149668 -0.0368867 -0.163033
+-0.147915 0.0146618 -0.204485
+-0.0969745 0.209248 -0.316462
+-0.029213 0.320027 -0.324801
+0.0251757 0.377237 -0.309101
+-0.0576288 -0.100682 -0.0576029
+-0.0503008 -0.140315 -0.0646292
+-0.036369 -0.206687 -0.0901277
+-0.044396 -0.176278 -0.081483
+-0.0724616 -0.179765 -0.107145
+-0.0715374 -0.200743 -0.115507
+-0.0425564 -0.253819 -0.107878
+-0.0418384 -0.304568 -0.122098
+-0.0740854 -0.259638 -0.138631
+-0.0244719 -0.32136 -0.141437
+-0.0609386 -0.280516 -0.150356
+-0.099915 -0.193525 -0.163215
+-0.121769 -0.132153 -0.184681
+-0.107521 -0.126272 -0.124444
+-0.133346 -0.0670983 -0.135187
+-0.137018 -0.0657523 -0.20394
+-0.150578 -0.00992208 -0.185327
+-0.157316 -0.024118 -0.13659
+-0.129245 0.23989 -0.24588
+-0.159161 0.181445 -0.224477
+-0.172322 0.150424 -0.217354
+-0.0607085 0.270364 -0.324585
+-0.107458 0.276428 -0.249166
+-0.117784 0.16906 -0.303665
+-0.151095 0.0958527 -0.264655
+-0.0586922 0.354228 -0.249118
+-0.00989785 0.407615 -0.233926
+-0.000193848 0.354976 -0.318498
+-0.0467952 -0.151249 -0.0676318
+-0.0738506 -0.13416 -0.089482
+-0.0540372 -0.118878 -0.0619228
+-0.0885257 -0.0929805 -0.070678
+-0.112904 -0.0820369 -0.0960858
+-0.0764805 -0.119499 -0.0817369
+-0.153035 0.0372294 -0.22372
+-0.165218 0.0281438 -0.165911
+-0.186288 0.0735574 -0.191434
+-0.183797 0.108592 -0.199768
+-0.158112 0.070004 -0.246316
+-0.1405 0.124896 -0.282117
+-0.106203 -0.157911 -0.136734
+-0.105217 -0.100658 -0.109573
+-0.00931289 -0.271469 -0.090684
+-0.0764989 -0.227679 -0.128794
+-0.016531 -0.164621 -0.0545716
+-0.0125223 -0.190934 -0.0652182
+-0.144026 0.207988 -0.237982
+-0.175339 0.051181 -0.181175
+-0.138944 -0.0540525 -0.116681
+-0.131152 -0.0941347 -0.159589
+-0.133537 0.0108688 -0.269707
+-0.0334422 0.386126 -0.242566
+0.0113722 -0.344934 -0.12113
+-0.133197 0.0655592 -0.309829
+0.0216407 0.328021 -0.371943
+0.0153474 0.421083 -0.222623
+-0.0481316 0.242385 -0.374558
+-0.104891 0.138622 -0.349318
+-0.0186142 -0.125745 -0.0465686
+-0.0839232 -0.104073 -0.0779289
+0.0717906 0.365077 -0.34791
+-0.0849429 0.312296 -0.251082
+-0.162733 0.00315788 -0.151984
+-0.130141 -0.0370349 -0.235688
+-0.0762744 -0.154477 -0.100157
+-0.00997429 -0.3233 -0.107786
+-0.00940435 -0.217037 -0.0743277
+-0.176934 0.127778 -0.211554
+0.0465126 0.39549 -0.288846
+0.0597837 -0.218115 -0.0723258
+0.0713313 -0.287671 -0.087738
+0.0592383 -0.193472 -0.0628572
+0.0593434 -0.155363 -0.0483166
+0.0725476 -0.309166 -0.0997402
+0.190143 -0.0227099 -0.0665069
+0.210588 0.0316501 -0.092159
+0.232563 0.234541 -0.189461
+0.169472 0.338423 -0.24522
+0.109589 0.385383 -0.275402
+0.065651 -0.0956001 -0.029039
+0.0591755 -0.136598 -0.0387375
+0.0564173 -0.204225 -0.0672154
+0.0612164 -0.173074 -0.0558548
+0.0972953 -0.174774 -0.0649452
+0.0991675 -0.196274 -0.072465
+0.0673895 -0.251583 -0.080051
+0.070977 -0.303184 -0.0937439
+0.113699 -0.257191 -0.0914887
+0.0990768 -0.318142 -0.1035
+0.120725 -0.276995 -0.0992324
+0.162326 -0.185728 -0.0869674
+0.192925 -0.121636 -0.0896731
+0.137071 -0.118025 -0.0618894
+0.164462 -0.0547228 -0.0570425
+0.214502 -0.0513605 -0.0941609
+0.202078 0.00540419 -0.0794428
+0.184089 -0.00825526 -0.046961
+0.198874 0.266184 -0.128932
+0.216485 0.207724 -0.100291
+0.226739 0.176885 -0.0889687
+0.201398 0.292794 -0.220602
+0.179137 0.300797 -0.143267
+0.244465 0.194511 -0.168775
+0.249987 0.118392 -0.128381
+0.130174 0.372265 -0.176295
+0.0745591 0.416036 -0.201166
+0.138321 0.368137 -0.263103
+0.0573892 -0.147805 -0.0428424
+0.0918061 -0.12838 -0.0494804
+0.0630743 -0.114433 -0.0345275
+0.0989089 -0.0850586 -0.0270322
+0.132157 -0.0711889 -0.0378038
+0.0919406 -0.113025 -0.0415872
+0.227175 0.0563152 -0.101973
+0.201762 0.0476084 -0.060544
+0.230623 0.0969537 -0.0662864
+0.230015 0.133575 -0.0729196
+0.244819 0.0914078 -0.113993
+0.251472 0.149121 -0.143846
+0.142162 -0.151081 -0.071837
+0.129154 -0.0914768 -0.0520379
+0.0286765 -0.270707 -0.0811097
+0.109752 -0.223905 -0.0814352
+0.0235518 -0.16339 -0.0450642
+0.0246917 -0.189809 -0.056233
+0.209425 0.234583 -0.116303
+0.217007 0.0725759 -0.0648974
+0.162474 -0.040249 -0.0423442
+0.176196 -0.0837515 -0.0743659
+0.257156 0.0306918 -0.135393
+0.101638 0.399408 -0.19005
+0.0556173 -0.34365 -0.107179
+0.280922 0.0867091 -0.164814
+0.169089 0.339835 -0.312985
+0.0457365 0.424139 -0.210851
+0.238037 0.261874 -0.265459
+0.280338 0.160353 -0.209069
+0.0243948 -0.12414 -0.0365533
+0.0976297 -0.0966492 -0.0351459
+0.108904 0.368222 -0.332814
+0.157982 0.334155 -0.159211
+0.193936 0.0207059 -0.0534508
+0.234239 -0.0193913 -0.112907
+0.0978461 -0.148931 -0.0574117
+0.032331 -0.322749 -0.0968953
+0.0241027 -0.216189 -0.0660946
+0.229339 0.153489 -0.0831689
+0.0763604 0.398395 -0.276945
+-0.0571258 -0.168985 0.207765
+-0.0611304 -0.0711166 0.177903
+-0.0871558 -0.166168 0.203943
+-0.0941678 -0.0726496 0.17265
+-0.102328 -0.16964 0.180963
+-0.114212 -0.0838662 0.152577
+-0.10618 -0.12302 0.175116
+-0.0891721 -0.116555 0.197592
+-0.0578971 -0.117938 0.199541
+-0.0570493 -0.223306 0.239782
+-0.0805418 -0.223383 0.230817
+-0.102171 -0.224532 0.200825
+-0.0805895 -0.215131 0.217531
+-0.0551286 -0.21559 0.225127
+-0.0794736 -0.229901 0.228168
+-0.0563456 -0.229819 0.2364
+-0.103703 -0.167049 0.194834
+-0.106956 -0.118202 0.190155
+-0.111065 -0.0754365 0.166384
+-0.0976877 -0.222372 0.216941
+-0.0957097 -0.2296 0.215974
+-0.0549518 -0.202113 0.209102
+-0.0833287 -0.199838 0.203129
+-0.100245 -0.200346 0.192524
+-0.0997805 -0.201318 0.181547
+-0.0519437 -0.236304 0.219869
+-0.0740185 -0.237468 0.213111
+-0.088037 -0.238024 0.206653
+-0.100068 -0.130089 0.151613
+-0.0961356 -0.172131 0.162002
+-0.0950203 -0.20081 0.169981
+-0.0969745 -0.21628 0.178578
+-0.0996897 -0.22698 0.188804
+-0.0969997 -0.234129 0.199133
+-0.0921754 -0.235088 0.211711
+-0.0772846 -0.234997 0.221108
+-0.0547361 -0.234145 0.228288
+-0.10845 -0.0988867 0.136857
+-0.0493527 -0.236285 0.211457
+-0.0707422 -0.237358 0.205121
+-0.0880704 -0.236549 0.195539
+-0.0939616 -0.228052 0.183272
+-0.0924197 -0.217185 0.172529
+-0.0912655 -0.201476 0.162658
+-0.0911215 -0.17407 0.150196
+-0.0950776 -0.134151 0.137016
+-0.127675 -0.14118 0.449123
+-0.14562 -0.137728 0.46182
+-0.100542 -0.155071 0.469766
+-0.107027 -0.148447 0.483829
+-0.161584 -0.132096 0.435407
+-0.155798 -0.134452 0.441446
+-0.135859 -0.139917 0.454153
+-0.116323 -0.146891 0.460403
+-0.111845 -0.151455 0.452874
+-0.129327 -0.147106 0.441274
+-0.153878 -0.137647 0.434133
+-0.153025 -0.133203 0.437391
+-0.0967636 -0.159875 0.456054
+-0.111831 -0.141541 0.492905
+-0.154308 -0.130468 0.468904
+-0.163394 -0.131742 0.447323
+-0.101989 -0.16738 0.441465
+-0.106926 -0.157302 0.454397
+-0.111635 -0.152557 0.464699
+-0.124461 -0.144654 0.476051
+-0.13447 -0.136282 0.484461
+-0.107573 -0.213636 0.372182
+-0.084603 -0.204464 0.383246
+-0.0576479 -0.278011 0.218727
+-0.0919358 -0.275855 0.205232
+-0.112243 -0.260903 0.179819
+-0.115686 -0.236027 0.152601
+-0.116688 -0.210044 0.134242
+-0.117382 -0.182763 0.120832
+-0.121487 -0.153883 0.111407
+-0.134768 -0.126152 0.104309
+-0.149792 -0.103542 0.135152
+-0.157043 -0.110419 0.155192
+-0.165324 -0.133011 0.18342
+-0.167355 -0.203334 0.258547
+-0.1602 -0.21686 0.281464
+-0.132541 -0.223794 0.341333
+-0.0677731 -0.0399091 0.181562
+-0.0779316 -0.0332848 0.229308
+-0.129907 -0.12814 0.111291
+-0.0571933 -0.271583 0.219634
+-0.0897564 -0.269768 0.207244
+-0.109953 -0.255198 0.182942
+-0.114144 -0.230883 0.156413
+-0.114949 -0.206026 0.138749
+-0.115591 -0.180574 0.126206
+-0.119906 -0.152609 0.117077
+-0.14325 -0.0912904 0.142264
+-0.103737 -0.0504076 0.173338
+-0.127138 -0.0653694 0.153788
+-0.0728643 -0.0321689 0.203143
+-0.109719 -0.050168 0.195259
+-0.131281 -0.070159 0.179924
+-0.14962 -0.0957728 0.169272
+-0.162546 -0.128796 0.184991
+-0.164797 -0.199028 0.258581
+-0.157728 -0.212645 0.281345
+-0.130084 -0.219652 0.34164
+-0.105782 -0.209728 0.371819
+-0.0839232 -0.200551 0.381842
+-0.053113 -0.253556 0.215218
+-0.112516 -0.0555514 0.219437
+-0.131463 -0.0817543 0.201347
+-0.133068 -0.137786 0.268198
+-0.116314 -0.112971 0.292764
+-0.0879797 -0.0957298 0.307577
+-0.0840235 -0.0537071 0.267633
+-0.115232 -0.0764099 0.255932
+-0.131966 -0.107277 0.235338
+-0.151694 -0.124686 0.203909
+-0.153001 -0.187687 0.268433
+-0.104235 -0.209575 0.349661
+-0.0830509 -0.202438 0.360371
+-0.0882479 -0.144759 0.346324
+-0.113028 -0.15702 0.330021
+-0.131511 -0.172035 0.298984
+-0.0641425 -0.0489422 0.166437
+-0.0986604 -0.0532239 0.157519
+-0.114867 -0.0562743 0.151637
+-0.122004 -0.066097 0.136187
+-0.103976 -0.223718 0.164483
+-0.103813 -0.203746 0.150761
+-0.104135 -0.17806 0.138466
+-0.109048 -0.144716 0.127499
+-0.101907 -0.244322 0.186423
+-0.0863415 -0.254499 0.205064
+-0.048692 -0.237703 0.209019
+-0.0696167 -0.239111 0.203211
+-0.0882383 -0.238498 0.194163
+-0.0933535 -0.229614 0.180695
+-0.0920313 -0.219192 0.170167
+-0.0910642 -0.203133 0.159732
+-0.0909829 -0.175435 0.14682
+-0.0956476 -0.135568 0.133601
+-0.0853361 -0.182682 0.36097
+-0.107472 -0.192242 0.347583
+-0.104743 -0.211026 0.363192
+-0.0834775 -0.203415 0.37301
+-0.169855 -0.160584 0.213215
+-0.166982 -0.156096 0.21416
+-0.167738 -0.179482 0.238705
+-0.17054 -0.183989 0.238278
+-0.14905 -0.224753 0.306897
+-0.146507 -0.220524 0.306864
+-0.137584 -0.0961462 0.105798
+-0.144884 -0.111013 0.108485
+-0.14735 -0.107201 0.121872
+-0.140424 -0.0936705 0.124065
+-0.129877 -0.115902 0.0264944
+-0.103153 -0.173773 0.0553552
+-0.11641 -0.146781 0.0394644
+-0.119231 0.413608 0.165555
+-0.112008 0.42354 0.128486
+-0.166704 0.396634 0.144583
+-0.212558 0.393999 0.140751
+-0.212223 0.395101 0.0987805
+-0.259729 0.398837 0.143194
+-0.264025 0.400982 0.108738
+-0.309506 0.424043 0.160699
+-0.326867 0.439427 0.138414
+-0.318179 0.422003 0.159828
+-0.335197 0.436294 0.140901
+-0.294868 0.201061 0.0472327
+-0.175483 -0.0801735 -0.0295802
+-0.111007 -0.121286 -0.00442096
+-0.0943446 -0.122488 -0.0271373
+-0.176574 0.347708 0.00400392
+-0.221696 0.361584 0.0365287
+-0.252655 0.301257 -0.0068543
+-0.224498 0.278494 -0.0243655
+-0.215297 0.38044 0.17574
+-0.255476 0.386119 0.171375
+-0.0976113 0.433541 0.0387457
+-0.0607884 -0.167613 0.0453727
+-0.139756 -0.093592 -0.0571633
+-0.191517 -0.052 -0.0821567
+-0.115984 -0.0819489 -0.0795848
+-0.161274 -0.0268271 -0.113821
+-0.178076 0.0279718 -0.129832
+-0.209387 0.00108835 -0.0898499
+-0.159443 0.269608 -0.169192
+-0.181087 0.211785 -0.161587
+-0.197923 0.168555 -0.158488
+-0.279048 0.218806 -0.0429025
+-0.216379 0.219429 -0.0942708
+-0.141282 0.396542 0.0186306
+-0.15258 0.3336 -0.10419
+-0.108191 0.386749 -0.122562
+-0.131132 0.315562 -0.174987
+-0.20451 0.131274 -0.155527
+-0.24299 0.095493 -0.11771
+-0.277727 0.182388 -0.0669233
+-0.276794 0.0769771 -0.0804298
+-0.0444485 -0.310301 0.1085
+-0.0677109 -0.305273 0.100108
+-0.0893782 -0.202611 0.0801022
+-0.0864664 -0.238919 0.0854194
+-0.0828884 -0.276105 0.0875783
+-0.0559381 -0.2371 0.0701893
+-0.0574902 -0.198635 0.0634599
+-0.232118 0.321281 0.196165
+-0.224403 0.347174 0.196841
+-0.175674 0.375906 0.188013
+-0.294975 0.312919 -0.00244767
+-0.360795 0.357475 0.0179023
+-0.358123 0.409588 0.0673342
+-0.31546 0.381868 0.0773917
+-0.364177 0.407228 0.0722527
+-0.366633 0.353854 0.0238365
+-0.263349 0.356063 0.175092
+-0.258613 0.365481 0.186304
+-0.236931 0.335295 0.187161
+-0.207168 0.337434 0.213819
+-0.349953 0.292803 -0.0237894
+-0.355718 0.289499 -0.0161651
+-0.325674 0.244703 -0.028325
+-0.316517 0.244862 -0.035438
+-0.34828 0.433794 0.0999934
+-0.354412 0.431405 0.103964
+-0.297297 0.390656 0.129889
+-0.288667 0.397673 0.173359
+-0.295108 0.394967 0.167065
+-0.195225 0.285441 -0.06564
+-0.0614559 0.433192 -0.112897
+-0.0656469 -0.107441 -0.0451741
+-0.155678 0.347045 0.243552
+-0.208774 0.0770842 -0.150132
+-0.122933 0.396384 0.206069
+-0.116419 0.418402 0.14806
+-0.164702 0.401935 0.123983
+-0.211782 0.397529 0.121847
+-0.261463 0.402213 0.127624
+-0.318242 0.433848 0.151618
+-0.327103 0.431487 0.152898
+-0.29881 0.187267 0.0100378
+-0.148748 -0.100356 0.0109626
+-0.136459 -0.106846 -0.0111217
+-0.122003 -0.130194 0.0341097
+-0.118507 -0.119893 0.0110486
+-0.1048 -0.122699 -0.016318
+-0.0924197 -0.128992 0.001245
+-0.18806 0.396303 0.0959745
+-0.197524 0.358212 0.028497
+-0.23423 0.294729 -0.0115142
+-0.236447 0.394593 0.101708
+-0.214732 0.382548 0.0678079
+-0.235312 0.394344 0.140482
+-0.235763 0.3818 0.173401
+-0.136056 0.415351 0.116421
+-0.105868 0.429964 0.100636
+-0.288436 0.231829 0.0456423
+-0.0964428 -0.137561 0.0183664
+-0.0940381 -0.145889 0.0215369
+-0.110925 -0.161474 0.0478217
+-0.0846842 -0.171144 0.0456949
+-0.0672796 -0.16635 0.0405941
+-0.0731469 -0.154984 0.0242528
+-0.0727776 -0.140266 0.00990877
+-0.0573558 -0.149865 0.0249572
+-0.1537 -0.0924678 -0.0387518
+-0.167685 -0.0719691 -0.0709988
+-0.173711 -0.0459867 -0.0976714
+-0.139039 -0.0816868 -0.0751898
+-0.127301 -0.0761266 -0.082599
+-0.147747 -0.058066 -0.0954442
+-0.158168 -0.0387788 -0.106311
+-0.139993 -0.0534682 -0.101704
+-0.17168 0.00147195 -0.122802
+-0.179228 -0.0302393 -0.100823
+-0.204296 -0.0184568 -0.08848
+-0.191527 0.189778 -0.157448
+-0.252813 0.243744 -0.034092
+-0.226274 0.193979 -0.100694
+-0.131769 0.419542 0.0820325
+-0.151354 0.400618 0.0611174
+-0.169893 0.383146 0.0556589
+-0.154467 0.377322 0.0113224
+-0.132301 0.358908 -0.11442
+-0.112176 0.34532 -0.176438
+-0.209583 -0.0490425 -0.0367499
+-0.185115 -0.0679509 -0.0557402
+-0.196671 -0.064134 -0.0557736
+-0.217606 -0.0323224 -0.0767317
+-0.205814 -0.0517345 -0.0787869
+-0.21763 -0.0425192 -0.0706542
+-0.214114 0.175763 -0.129574
+-0.204464 0.165073 -0.147759
+-0.197164 0.14969 -0.165068
+-0.208477 0.13834 -0.146984
+-0.219516 0.163028 -0.131772
+-0.209664 0.150956 -0.14649
+-0.224608 0.122674 -0.134009
+-0.257132 0.179079 -0.0857074
+-0.250959 0.165706 -0.10146
+-0.265567 0.136396 -0.0964646
+-0.266735 0.168082 -0.0896444
+-0.305416 0.129718 -0.031002
+-0.284313 0.13503 -0.0735373
+-0.294458 0.0841611 -0.0514202
+-0.258732 0.128861 -0.096455
+-0.241127 0.128636 -0.112787
+-0.26153 0.0912877 -0.10249
+-0.249839 0.070406 -0.109262
+-0.262157 0.0357735 -0.0714063
+-0.262181 0.0679488 -0.100094
+-0.245054 0.0422155 -0.100047
+-0.22411 -0.00903611 -0.0770819
+-0.238268 0.00834945 -0.0820919
+-0.22911 0.0161798 -0.0907126
+-0.0567858 -0.310129 0.105036
+-0.0456457 -0.298189 0.0871626
+-0.0616423 -0.295603 0.0835942
+-0.104537 -0.217262 0.110338
+-0.100049 -0.201725 0.0928327
+-0.0973144 -0.237166 0.102115
+-0.0702637 -0.276593 0.0759351
+-0.085216 -0.258197 0.0856296
+-0.0544153 -0.258925 0.0687757
+-0.094378 -0.190393 0.0700637
+-0.0810687 -0.17771 0.0537075
+-0.0591284 -0.182663 0.0568022
+-0.0731708 -0.238182 0.0755242
+-0.0873237 -0.219498 0.0845191
+-0.0753161 -0.201356 0.0692733
+-0.0567142 -0.216812 0.068259
+-0.245854 0.365181 0.0446232
+-0.23582 0.33405 0.0125052
+-0.278321 0.200913 -0.0521813
+-0.220149 0.364443 0.187899
+-0.189669 0.393908 0.14111
+-0.213056 0.389123 0.159497
+-0.194535 0.379932 0.177837
+-0.200886 0.359966 0.192706
+-0.284628 0.351148 0.0276581
+-0.330689 0.344999 0.0127871
+-0.358755 0.385298 0.0432144
+-0.299999 0.357265 0.0685798
+-0.365484 0.382451 0.0487801
+-0.323557 0.351498 0.0439141
+-0.263138 0.348731 0.150254
+-0.242185 0.354558 0.191621
+-0.249168 0.34486 0.181691
+-0.232893 0.3387 0.198234
+-0.223487 0.32734 0.209398
+-0.218027 0.340415 0.20332
+-0.240945 0.316037 0.165637
+-0.23241 0.328561 0.191643
+-0.240561 0.332465 0.157624
+-0.314078 0.303853 0.0171596
+-0.358424 0.324776 -0.00560384
+-0.370316 0.358443 0.0211833
+-0.350326 0.341387 0.022687
+-0.363663 0.321152 0.0011392
+-0.326733 0.274383 -0.00999136
+-0.345407 0.300582 -0.00351179
+-0.271171 0.308135 -0.00225178
+-0.267588 0.259162 -0.0264432
+-0.326777 0.304331 -0.0140383
+-0.303926 0.275729 -0.0213854
+-0.335283 0.265911 -0.0321665
+-0.342312 0.264072 -0.0248671
+-0.356681 0.288703 -0.0223239
+-0.297507 0.23044 -0.0385457
+-0.28972 0.206259 -0.044413
+-0.308466 0.230787 -0.0299775
+-0.323275 0.236538 -0.0365199
+-0.323533 0.392835 0.0589953
+-0.268488 0.392161 0.0837628
+-0.316559 0.410278 0.0828522
+-0.298293 0.420452 0.123853
+-0.337106 0.438254 0.118959
+-0.337868 0.4438 0.143506
+-0.344253 0.434944 0.122423
+-0.306503 0.388051 0.100645
+-0.320153 0.416538 0.132131
+-0.337194 0.411511 0.0933453
+-0.34433 0.394383 0.0699771
+-0.368938 0.413196 0.0718111
+-0.361505 0.423445 0.0892219
+-0.358645 0.438632 0.105625
+-0.35627 0.425781 0.0850078
+-0.257516 0.393985 0.158324
+-0.287297 0.411648 0.151911
+-0.274633 0.393161 0.171883
+-0.255605 0.37461 0.181265
+-0.284696 0.372336 0.122364
+-0.271406 0.360905 0.148438
+-0.2946 0.39182 0.149666
+-0.310095 0.409536 0.146705
+-0.299371 0.411926 0.167481
+-0.318405 0.426679 0.163333
+-0.307651 0.41012 0.164191
+-0.274902 0.380751 0.180096
+-0.294045 0.397199 0.173067
+-0.280984 0.377213 0.170547
+-0.26242 0.361464 0.185633
+-0.159414 0.344979 -0.0515922
+-0.182537 0.320352 -0.0328989
+-0.198587 0.320107 -0.0057622
+-0.243272 0.208312 -0.0753188
+-0.248502 0.232375 -0.0469085
+-0.209119 0.281212 -0.0424015
+-0.206677 0.250358 -0.0840167
+-0.170353 0.239558 -0.166797
+-0.197471 0.21929 -0.122682
+-0.178567 0.28047 -0.115642
+-0.171321 0.311756 -0.0899939
+-0.145807 0.327259 -0.133511
+-0.146602 0.293282 -0.171572
+-0.122761 0.416222 0.0300382
+-0.0813124 0.435596 -0.0362325
+-0.125218 0.392467 -0.0520857
+-0.0841907 0.413167 -0.120661
+-0.0301522 -0.113843 -0.00649459
+-0.0761447 -0.126411 -0.0130752
+-0.08058 -0.115568 -0.0373342
+-0.116477 -0.110845 -0.0402801
+-0.120892 -0.0942207 -0.0641452
+-0.0936169 -0.0985795 -0.0600505
+-0.029568 -0.103254 -0.028684
+-0.0590465 -0.0998395 -0.0513956
+-0.189506 0.0111609 -0.105157
+-0.228483 0.0458269 -0.104712
+-0.199779 0.02449 -0.110747
+-0.228081 0.0709999 -0.128899
+-0.204013 0.0483463 -0.132251
+-0.21433 0.0680451 -0.140906
+-0.184027 0.0309607 -0.124296
+-0.191025 0.053643 -0.1465
+-0.226547 0.085047 -0.132941
+-0.222572 0.11216 -0.134268
+-0.209344 0.105853 -0.153459
+-0.168629 0.390461 0.165044
+-0.143686 0.4047 0.154186
+-0.122138 0.408023 0.182888
+-0.100207 0.352345 0.267748
+-0.141449 0.34895 0.254262
+-0.123105 0.374813 0.236309
+-0.189262 0.358487 0.201409
+-0.178806 0.343467 0.229154
+-0.144922 0.370891 0.224552
+-0.152493 0.387164 0.192329
+-0.0767481 -0.292949 0.0934361
+-0.0888704 0.378741 -0.175892
+-0.0642189 0.406979 -0.172195
+-0.0412398 0.427372 -0.163952
+-0.103186 0.432593 0.0734308
+-0.156465 0.405521 0.0962626
+-0.12584 0.35018 0.262878
+-0.332083 0.322991 0.0179166
+-0.177317 -0.078833 -0.0127114
+-0.215695 0.0172385 -0.0947882
+-0.241021 0.0737683 -0.114617
+-0.234617 0.176909 -0.105717
+-0.0588642 -0.135913 0.00971219
+-0.199435 -0.0374376 -0.0889066
+-0.238018 0.15638 -0.109947
+-0.226749 -0.0243815 -0.0678952
+-0.276875 0.109019 -0.0855211
+-0.266396 0.194271 -0.0673922
+-0.098799 -0.1816 0.0610266
+-0.0639077 -0.128418 0.000215007
+-0.0525328 -0.278806 0.0706385
+-0.235576 -0.0153532 -0.0550883
+-0.27619 0.379991 0.0596519
+-0.130136 0.323173 0.284794
+-0.196326 0.0495531 -0.135709
+-0.0193377 -0.0957346 -0.0370038
+-0.228224 0.242815 -0.0602178
+-0.291459 0.367692 0.0951561
+-0.281568 0.247725 0.069575
+-0.327041 0.413545 0.112039
+-0.281966 0.375618 0.149578
+-0.312896 0.264077 -0.00894704
+-0.190052 0.381992 0.0619515
+-0.190871 0.388266 0.161198
+-0.0526673 0.447584 -0.0280042
+-0.0876636 0.414738 0.190819
+-0.0936599 0.379458 0.240722
+-0.146262 0.398741 0.173186
+-0.166369 0.36602 0.211443
+-0.182379 0.322862 0.246268
+-0.296129 0.131251 -0.0547293
+-0.223022 -0.0373946 0.0238563
+-0.178135 -0.0754611 0.0540105
+-0.131109 -0.137331 0.0890875
+-0.112665 -0.241693 0.142198
+-0.108478 -0.269773 0.168353
+-0.0548897 -0.289645 0.208349
+-0.21603 0.0473832 -0.118362
+-0.158327 -0.0644978 -0.0857026
+-0.0551579 -0.115908 -0.0214141
+-0.0270104 -0.144357 0.028224
+-0.0299413 -0.177404 0.0565626
+-0.0279919 -0.258206 0.0706821
+-0.0919023 -0.159228 0.0340947
+-0.0790715 -0.187447 0.0613849
+-0.071734 -0.258585 0.074843
+-0.0972762 -0.257133 0.106033
+-0.0266889 -0.297029 0.0914157
+-0.0884254 0.319218 0.295728
+-0.102506 0.178624 0.372446
+-0.104091 0.129508 0.387762
+-0.106792 0.0567561 0.418093
+-0.111744 -0.0158754 0.453118
+-0.114748 -0.0890728 0.485941
+-0.114647 -0.114633 0.492933
+-0.14985 0.325343 0.269789
+-0.187427 0.235823 0.3116
+-0.147331 0.169672 0.360792
+-0.208122 0.19872 0.316045
+-0.162178 0.00648128 0.399011
+-0.163686 -0.086419 0.443984
+-0.163294 -0.104193 0.450694
+-0.187284 -0.0304454 0.326007
+-0.16919 -0.0989863 0.411254
+-0.206269 -0.153898 0.346051
+-0.204095 -0.0591724 0.273285
+-0.200426 -0.02715 0.25221
+-0.264341 0.197413 0.221368
+-0.25152 0.0754829 0.237607
+-0.235887 0.196369 0.282376
+-0.222903 0.233803 0.270406
+-0.245763 0.296761 0.172759
+-0.234431 0.00259272 0.0952797
+-0.197552 -0.0452543 0.109863
+-0.176876 -0.086735 0.176141
+-0.183769 -0.116152 0.200097
+-0.184928 -0.197323 0.272633
+-0.175847 -0.213933 0.295379
+-0.205962 0.0366212 0.282087
+-0.285549 0.265792 -0.0238037
+-0.257219 0.340569 0.0198899
+-0.305779 0.41559 0.101929
+-0.280931 0.4033 0.162797
+-0.169108 -0.121023 0.416815
+-0.198736 0.122673 0.314023
+-0.103847 -0.106041 -0.0517553
+-0.104029 0.416529 -0.045428
+-0.308614 0.335549 0.0428267
+-0.25151 0.340947 0.154775
+-0.188922 0.2501 -0.11739
+-0.163198 0.305415 -0.122893
+-0.226595 0.333135 0.203315
+-0.307054 0.413493 0.168463
+-0.348788 0.443905 0.125248
+-0.27881 0.378663 0.179091
+-0.365054 0.429053 0.0894847
+-0.365838 0.323283 -0.00318552
+-0.245978 0.348144 0.192176
+-0.341618 0.259828 -0.032075
+-0.304208 0.219133 -0.0402269
+-0.238301 0.325281 0.161173
+-0.346087 0.368538 0.0467249
+-0.371039 0.389 0.0476013
+-0.324261 0.369266 0.0359581
+-0.219028 0.314117 0.221104
+-0.280548 0.0381304 -0.037315
+-0.146286 0.13094 0.370352
+-0.262947 0.165793 0.244831
+-0.204842 0.0637825 0.294339
+-0.185147 0.070535 0.314727
+-0.218118 0.181603 0.315906
+-0.24104 0.179826 0.287691
+-0.261237 0.154475 0.255745
+-0.264576 0.121437 0.244461
+-0.22718 0.067226 0.27328
+-0.173002 0.093175 0.330849
+-0.172863 0.12068 0.337688
+-0.250868 0.0894536 0.253279
+-0.281286 0.143891 0.189896
+-0.269954 0.125834 0.229413
+-0.274839 0.0952008 0.178952
+-0.249958 0.0488541 0.191333
+-0.221294 0.0166405 0.21595
+-0.226279 0.0464829 0.259965
+-0.206547 0.1299 0.316831
+-0.203209 0.105761 0.29943
+-0.224215 0.102663 0.28303
+-0.244508 0.11207 0.269103
+-0.244398 0.145389 0.294271
+-0.227999 0.145403 0.311656
+-0.185057 0.107572 0.313305
+-0.18783 0.118468 0.317678
+-0.179889 0.108846 0.317898
+-0.194032 0.113549 0.308381
+-0.184856 0.113765 0.313817
+-0.194976 0.117955 0.310828
+-0.201777 0.123391 0.311393
+-0.198836 0.119824 0.308443
+-0.196556 0.116523 0.304981
+-0.203075 0.109833 0.296701
+-0.222395 0.107294 0.28237
+-0.241145 0.116701 0.269003
+-0.249546 0.126955 0.263237
+-0.241055 0.143732 0.292279
+-0.226227 0.143497 0.308247
+-0.207284 0.129565 0.313798
+-0.192251 0.159385 0.336428
+-0.216581 0.139326 0.316925
+-0.215738 0.1382 0.313591
+-0.158495 0.048461 0.379992
+-0.165238 -0.108652 0.435708
+-0.166315 -0.0907389 0.430099
+-0.168428 -0.00699115 0.375587
+-0.166177 0.0398163 0.35378
+-0.123455 -0.18898 0.412771
+-0.129236 -0.162183 0.435685
+-0.155774 -0.151412 0.428994
+-0.165128 -0.11359 0.42204
+-0.164803 -0.111664 0.424549
+-0.189549 -0.123379 0.385583
+-0.167461 -0.0947715 0.418207
+-0.0935016 -0.187625 0.416584
+-0.139308 -0.222688 0.348311
+-0.154394 -0.179741 0.406986
+-0.0870937 -0.20273 0.391799
+-0.164223 -0.0856436 0.128122
+-0.20603 -0.00266643 0.236717
+-0.241036 0.0189961 0.123231
+-0.20807 -0.0245064 0.142283
+-0.181896 -0.057266 0.159746
+-0.0299031 -0.218617 0.0703334
+-0.0739032 -0.218517 0.0740349
+-0.0973717 -0.218713 0.0977758
+-0.112545 -0.214302 0.124409
+-0.118402 -0.162538 0.0964011
+-0.112936 -0.188197 0.106363
+-0.105973 -0.130405 0.0166088
+-0.146353 -0.109145 0.0786422
+-0.194483 -0.176729 0.361371
+-0.15167 -0.204795 0.382119
+-0.0870889 -0.291604 0.115918
+-0.0364837 -0.314674 0.147983
+-0.0643486 -0.313381 0.131819
+-0.0876971 -0.287087 0.19297
+-0.182863 -0.145286 0.395215
+-0.251927 0.0374642 -0.0901809
+-0.237774 0.0444809 -0.101585
+-0.223927 0.141846 -0.131615
+-0.203295 0.153623 -0.150427
+-0.143738 0.368002 -0.0522004
+-0.20739 0.193389 -0.125814
+-0.185526 -0.00994119 -0.101331
+-0.140194 -0.0559965 -0.0964789
+-0.0660728 -0.152211 0.0231853
+-0.268647 0.268923 0.103509
+-0.226145 0.0900427 0.280215
+-0.203644 0.0920064 0.299401
+-0.197274 0.134843 0.325202
+-0.208319 0.147971 0.325029
+-0.225819 0.160094 0.314396
+-0.244513 0.159375 0.292634
+-0.258689 0.143813 0.265712
+-0.259796 0.121911 0.255789
+-0.156076 0.0870927 0.366358
+-0.146171 0.0914461 0.383235
+-0.104465 0.0892618 0.402408
+-0.163921 -0.0300618 0.417997
+-0.168682 -0.040417 0.394294
+-0.190943 -0.0641674 0.350663
+-0.211039 -0.0931477 0.301691
+-0.211786 -0.12483 0.326016
+-0.191647 -0.0968171 0.371555
+-0.164653 -0.0625873 0.433615
+-0.11368 -0.0535877 0.471443
+-0.16859 -0.0725534 0.409989
+-0.109508 0.0214772 0.434856
+-0.18749 -0.145406 0.22628
+-0.187878 -0.172524 0.250492
+-0.15929 0.123109 0.355964
+-0.177326 0.172805 0.345064
+-0.154538 0.0154133 0.41439
+-0.156737 -0.0229645 0.432504
+-0.157753 -0.0565814 0.447127
+-0.157364 -0.0830956 0.457309
+-0.15905 -0.102526 0.460694
+-0.139725 -0.107789 0.479958
+-0.140544 -0.0842928 0.472114
+-0.140136 -0.0535877 0.459814
+-0.138714 -0.0181552 0.444185
+-0.136353 0.0195899 0.426963
+-0.132004 0.0564401 0.410569
+-0.12789 0.0918672 0.395032
+-0.127402 0.132913 0.380429
+-0.124767 0.179557 0.367
+-0.107985 0.321219 0.292428
+-0.113287 -0.130961 0.494781
+-0.136669 -0.125141 0.484249
+-0.154567 -0.119854 0.469307
+-0.163859 -0.119083 0.455719
+-0.164951 -0.122858 0.442735
+-0.163849 -0.123974 0.430325
+-0.163131 -0.125903 0.428836
+-0.165348 -0.137532 0.423975
+-0.171991 -0.163069 0.401465
+-0.176642 -0.191887 0.371333
+-0.160654 -0.222027 0.318204
+-0.151651 0.202686 0.351659
+-0.119814 0.230675 0.348392
+-0.0987942 0.228654 0.35141
+-0.166723 0.152262 0.350384
+-0.181628 0.141434 0.338138
+-0.166004 0.224286 0.335542
+-0.190919 0.187411 0.334025
+-0.203458 0.17279 0.329498
+-0.0936456 0.2781 0.323257
+-0.114062 0.281467 0.320585
+-0.13698 0.287544 0.30898
+-0.161095 0.29551 0.285594
+-0.212486 0.292569 0.239572
+-0.253378 0.265883 0.183405
+-0.274902 0.233103 0.134127
+-0.303139 0.160855 0.0397661
+-0.0753161 0.43683 0.10634
+-0.23843 0.367715 0.185073
+-0.235101 0.390125 0.157869
+-0.239445 0.383616 0.0737666
+-0.214387 0.327636 0.00516291
+-0.128667 -0.109346 -0.026491
+-0.214473 -0.0450243 -0.00825765
+-0.298305 0.0639497 -0.00528031
+-0.307436 0.135604 -0.00213642
+-0.328309 0.437282 0.155541
+-0.292575 0.418268 0.139731
+-0.235379 0.397017 0.122868
+-0.188222 0.398491 0.120904
+-0.141041 0.409896 0.135061
+-0.0831089 0.424561 0.158678
+-0.114135 -0.211888 0.383848
+-0.147144 -0.216385 0.364623
+-0.173116 -0.210441 0.343799
+-0.192159 -0.199536 0.326787
+-0.203644 -0.17842 0.306361
+-0.207361 -0.148318 0.283505
+-0.207041 -0.117057 0.259792
+-0.202758 -0.0850586 0.235352
+-0.197801 -0.050465 0.215485
+-0.201594 -0.0226143 0.202094
+-0.219316 -0.000534788 0.183381
+-0.24935 0.0375413 0.16023
+-0.276372 0.0948514 0.149162
+-0.283067 0.166041 0.159406
+-0.206475 0.0174112 0.263365
+-0.222711 0.0328473 0.241314
+-0.249513 0.0614931 0.21696
+-0.270337 0.0978833 0.204996
+-0.275826 0.134068 0.210031
+-0.264202 0.178572 0.233323
+-0.229718 0.210747 0.278572
+-0.198323 0.213673 0.316471
+-0.180229 0.202025 0.33742
+-0.185741 -0.00474484 0.308761
+-0.167944 0.0130578 0.363441
+-0.262085 0.221782 0.208454
+-0.214009 0.265055 0.257298
+-0.174769 0.264537 0.300647
+-0.149552 0.253252 0.327233
+-0.205908 0.135119 0.253871
+-0.235039 0.119239 0.244902
+-0.243976 0.129211 0.240754
+-0.244589 0.142118 0.24982
+-0.234148 0.152875 0.269606
+-0.217931 0.15253 0.285971
+-0.20556 0.145638 0.293069
+-0.196245 0.135734 0.294506
+-0.191331 0.128362 0.29259
+-0.188979 0.123822 0.289842
+-0.187461 0.119895 0.286887
+-0.195517 0.112869 0.276121
+-0.215824 0.110331 0.258256
+-0.155659 -0.0978519 0.100621
+-0.189467 -0.0623955 0.077804
+-0.231467 -0.0238552 0.0486845
+-0.19351 -0.0538273 0.0938381
+-0.15995 -0.0916925 0.114414
+-0.121769 -0.154157 0.0644701
+-0.133891 -0.123379 0.0525594
+-0.161789 -0.0903369 0.0269981
+-0.105255 -0.187687 0.0835075
+-0.294562 0.0982089 0.0456382
+-0.232999 -0.00942449 0.0736554
+-0.0135182 0.439413 -0.156764
+-0.0352332 0.44622 -0.0991177
+-0.0648708 0.445223 0.0410971
+-0.0907195 0.401704 0.213819
+-0.0712453 0.441655 0.0799827
+-0.0794879 0.430883 0.133204
+-0.0294192 -0.162609 0.0467685
+-0.0301236 -0.194296 0.0644851
+-0.0268186 -0.281637 0.0748676
+-0.0281264 -0.307997 0.113796
+-0.0475473 -0.307686 0.184565
+-0.0763317 -0.304659 0.166072
+-0.0987655 -0.282704 0.144865
+-0.106136 -0.250955 0.126349
+-0.251462 -0.00553047 -0.0239191
+-0.264825 0.0102559 0.0218823
+-0.265419 0.0364342 0.0606621
+-0.270376 0.0754249 0.112843
+-0.28812 0.212786 0.084044
+-0.0274841 -0.167682 0.21368
+-0.0206257 -0.0693399 0.185987
+0.0013624 -0.162279 0.221607
+0.0119087 -0.0679939 0.193809
+0.0243996 -0.164084 0.206247
+0.0389784 -0.077147 0.183133
+0.0262534 -0.117211 0.201534
+0.00146751 -0.112569 0.215678
+-0.0279298 -0.116621 0.205524
+-0.0352435 -0.222348 0.24413
+-0.0101893 -0.220293 0.244844
+0.0212816 -0.219115 0.225457
+-0.00575947 -0.21185 0.232459
+-0.0320484 -0.21458 0.229734
+-0.00960503 -0.226841 0.242101
+-0.0340456 -0.228843 0.240845
+0.0201418 -0.161618 0.219543
+0.0208073 -0.112593 0.21564
+0.0300894 -0.0692436 0.194532
+0.010807 -0.217612 0.238585
+0.00996406 -0.224963 0.237053
+-0.0272111 -0.200896 0.214637
+0.000984256 -0.19614 0.219955
+0.0206496 -0.195048 0.216646
+0.0245047 -0.195867 0.206342
+-0.0312198 -0.235395 0.224002
+-0.00823103 -0.23458 0.226232
+0.00718125 -0.233842 0.225648
+0.0302232 -0.124371 0.177606
+0.0261715 -0.166762 0.186405
+0.0245095 -0.195561 0.193827
+0.0243184 -0.210954 0.202779
+0.0238058 -0.221562 0.213445
+0.0179767 -0.229083 0.222068
+0.00880984 -0.230658 0.231856
+-0.00848972 -0.23198 0.23483
+-0.0320579 -0.233148 0.232809
+0.0409565 -0.0923293 0.166667
+-0.030387 -0.235457 0.215241
+-0.00819758 -0.234618 0.217597
+0.0113435 -0.232186 0.215366
+0.0207451 -0.223018 0.206161
+0.0225219 -0.212142 0.195462
+0.0239156 -0.196423 0.185633
+0.0262432 -0.168922 0.173612
+0.0315644 -0.128595 0.16228
+-0.0572937 -0.138099 0.463169
+-0.0459331 -0.13336 0.481716
+-0.0889803 -0.154568 0.47207
+-0.0889564 -0.147656 0.48743
+-0.0216222 -0.125956 0.463329
+-0.0290506 -0.128896 0.466735
+-0.0517956 -0.136239 0.470935
+-0.0715708 -0.144936 0.469335
+-0.0724281 -0.149726 0.460739
+-0.0522796 -0.14373 0.456644
+-0.0277523 -0.132115 0.459292
+-0.030157 -0.127818 0.461902
+-0.0868063 -0.159439 0.458041
+-0.0885974 -0.140521 0.49754
+-0.0412589 -0.125515 0.491462
+-0.0245388 -0.125649 0.475024
+-0.0757904 -0.16623 0.446691
+-0.0770457 -0.155995 0.460359
+-0.0770552 -0.151048 0.471596
+-0.0702685 -0.142283 0.486861
+-0.0649807 -0.133236 0.498325
+-0.040248 -0.210681 0.385616
+-0.0663793 -0.20367 0.386881
+-0.022029 -0.276449 0.225836
+0.0144997 -0.271186 0.226464
+0.0416514 -0.25415 0.210514
+0.053141 -0.228617 0.186279
+0.0588977 -0.202338 0.169272
+0.0623699 -0.17488 0.156691
+0.0673226 -0.145602 0.149071
+0.0799234 -0.116732 0.147141
+0.0800428 -0.0934931 0.180997
+0.079636 -0.100213 0.202358
+0.0783862 -0.122785 0.231875
+0.0574561 -0.194191 0.303099
+0.0432219 -0.208454 0.321824
+-0.00460525 -0.218263 0.366827
+-0.018533 -0.0377488 0.191385
+-0.0280254 -0.0310966 0.23927
+0.0729407 -0.119236 0.151762
+-0.0233416 -0.270099 0.226391
+0.0112097 -0.265339 0.227387
+0.037872 -0.248709 0.212431
+0.0498319 -0.22368 0.189125
+0.0552296 -0.198555 0.172697
+0.0584765 -0.172941 0.160929
+0.0635917 -0.144558 0.153683
+0.070263 -0.0819455 0.184867
+0.0185807 -0.0450338 0.197745
+0.0488449 -0.0576537 0.188899
+-0.0227621 -0.0299758 0.213139
+0.0156785 -0.0446693 0.220285
+0.0430636 -0.062534 0.214715
+0.0661772 -0.0864531 0.212286
+0.0748703 -0.11882 0.2322
+0.0547313 -0.190125 0.302073
+0.0406405 -0.204474 0.320695
+-0.00733482 -0.214355 0.366094
+-0.0420827 -0.206936 0.384529
+-0.0667963 -0.199804 0.385262
+-0.0269189 -0.252407 0.220447
+0.00945145 -0.0502206 0.243782
+0.0360189 -0.074513 0.234748
+0.0166648 -0.131612 0.29794
+-0.0102712 -0.108436 0.313898
+-0.0434759 -0.09379 0.316462
+-0.0353725 -0.0515762 0.277351
+-0.000261422 -0.0714333 0.278874
+0.0256398 -0.100639 0.266709
+0.0572978 -0.115946 0.245463
+0.0391416 -0.179876 0.306523
+-0.0350373 -0.206548 0.363461
+-0.0592287 -0.201384 0.365122
+-0.0539266 -0.14326 0.353167
+-0.0238494 -0.153184 0.347784
+0.00631985 -0.166307 0.326366
+-0.015329 -0.046801 0.176178
+0.0201991 -0.0480077 0.181231
+0.0376188 -0.0495886 0.182051
+0.0509233 -0.0585158 0.17068
+0.0367854 -0.217535 0.192569
+0.0401955 -0.197424 0.179498
+0.0430356 -0.171604 0.167831
+0.0489507 -0.137781 0.159023
+0.0282172 -0.238608 0.212383
+0.0076174 -0.250376 0.22381
+-0.0299461 -0.236879 0.21276
+-0.00835525 -0.236425 0.215433
+0.0121913 -0.234087 0.214197
+0.0213007 -0.22458 0.203564
+0.0232406 -0.214129 0.193167
+0.0249886 -0.198042 0.182889
+0.0275223 -0.170239 0.170465
+0.0335186 -0.129902 0.159372
+-0.0590226 -0.181523 0.366219
+-0.0327289 -0.188985 0.362483
+-0.0396207 -0.208171 0.376181
+-0.0635821 -0.202539 0.37698
+0.0735107 -0.150655 0.261474
+0.0701197 -0.146416 0.261182
+0.0634053 -0.170163 0.284487
+0.0665274 -0.17442 0.285239
+0.0238679 -0.217453 0.341275
+0.0211813 -0.213464 0.340197
+0.0794162 -0.0866251 0.14909
+0.0863558 -0.100869 0.154617
+0.0831853 -0.0970949 0.16786
+0.0748321 -0.0842307 0.167012
+0.106749 -0.104643 0.0739776
+0.0735824 -0.166019 0.0906109
+0.0901011 -0.137565 0.080711
+-0.00750751 0.419622 0.18819
+-0.00567346 0.430433 0.150407
+0.0449079 0.408469 0.187592
+0.0889564 0.410619 0.20197
+0.100557 0.415667 0.163334
+0.132062 0.419264 0.222372
+0.145453 0.425706 0.192554
+0.171181 0.446573 0.257053
+0.190991 0.46682 0.243192
+0.180062 0.444987 0.259582
+0.198788 0.463758 0.248696
+0.220843 0.231485 0.152568
+0.175856 -0.0577397 0.0427121
+0.108282 -0.108651 0.0402685
+0.109699 -0.108421 0.0151768
+0.105408 0.372691 0.0642169
+0.133742 0.389536 0.111324
+0.186747 0.338193 0.0864964
+0.171362 0.313399 0.0603584
+0.0833812 0.393995 0.235471
+0.121846 0.402946 0.246737
+0.00503117 0.442827 0.0607242
+0.0383532 -0.163215 0.0651704
+0.164112 -0.0701392 0.00663588
+0.218103 -0.017704 0.00500728
+0.142055 -0.0645667 -0.0220031
+0.195408 0.0012508 -0.0302505
+0.208562 0.0594059 -0.0341432
+0.229823 0.0391836 0.00459706
+0.17145 0.300141 -0.0710944
+0.195608 0.24467 -0.0558405
+0.215731 0.205158 -0.0455577
+0.236785 0.263099 0.0689327
+0.198855 0.259996 0.0025521
+0.0588165 0.414674 0.0614955
+0.121874 0.362719 -0.0335842
+0.08035 0.406974 -0.0679526
+0.14222 0.342059 -0.0893045
+0.226011 0.168674 -0.0398023
+0.254254 0.142095 -0.00195896
+0.250385 0.228236 0.0496374
+0.272248 0.122893 0.0393354
+0.0107306 -0.307878 0.119505
+0.0349172 -0.30077 0.120583
+0.0538645 -0.196323 0.108686
+0.052212 -0.232837 0.113088
+0.0512257 -0.270224 0.114333
+0.0297973 -0.23333 0.0872964
+0.0305638 -0.194775 0.0810223
+0.247893 0.259715 0.0826993
+0.157833 0.381542 0.208943
+0.229541 0.334873 0.132059
+0.0966578 0.335707 0.261766
+0.087121 0.360849 0.258989
+0.0429394 0.385641 0.231674
+0.221274 0.355147 0.107609
+0.26663 0.405809 0.151509
+0.24285 0.450429 0.191778
+0.204976 0.415686 0.184661
+0.247443 0.447895 0.198618
+0.270941 0.402175 0.158831
+0.130524 0.373352 0.253672
+0.121083 0.38214 0.262054
+0.103354 0.350224 0.255051
+0.0655882 0.349404 0.268243
+0.28017 0.344314 0.113997
+0.28391 0.34075 0.122259
+0.268799 0.292905 0.10016
+0.262927 0.292568 0.0905242
+0.221155 0.469069 0.216827
+0.226274 0.46653 0.222837
+0.172159 0.415499 0.224883
+0.150975 0.41696 0.261076
+0.159538 0.414914 0.257776
+0.15722 0.320505 0.0141953
+0.0280254 0.442531 -0.0846535
+0.0948237 -0.0949537 -0.0114473
+0.00603249 0.354147 0.275814
+0.23551 0.113986 -0.0334347
+-0.0145529 0.401309 0.227751
+-0.00608983 0.424896 0.170594
+0.048021 0.415116 0.167629
+0.093305 0.41573 0.184225
+0.137636 0.424495 0.208747
+0.180181 0.458705 0.251995
+0.18884 0.456462 0.256565
+0.240398 0.223581 0.121584
+0.130859 -0.0859159 0.0674297
+0.133541 -0.0909164 0.0440185
+0.0968973 -0.120118 0.077933
+0.105561 -0.108206 0.0563333
+0.111452 -0.108949 0.0281605
+0.0889182 -0.118863 0.0381095
+0.078621 0.414432 0.151197
+0.11468 0.38373 0.0944852
+0.172906 0.329515 0.0750157
+0.122473 0.417352 0.175514
+0.114082 0.406394 0.136374
+0.110514 0.412894 0.210537
+0.10298 0.397176 0.241142
+0.0213629 0.42583 0.148955
+-0.00465303 0.437353 0.12176
+0.0827062 -0.128686 0.0544317
+0.0795213 -0.137431 0.0564289
+0.0825724 -0.152978 0.0864255
+0.0600615 -0.164784 0.0745714
+0.0461529 -0.161282 0.0632579
+0.0595639 -0.148547 0.0509254
+0.067169 -0.132752 0.0382631
+0.0448697 -0.144827 0.0455276
+0.163911 -0.0708777 0.0270172
+0.193806 -0.0426728 0.00533014
+0.2109 -0.010679 -0.0134922
+0.173825 -0.0549576 -0.00869312
+0.168001 -0.0495264 -0.0194073
+0.189899 -0.0264265 -0.0217349
+0.201517 -0.00374352 -0.0257292
+0.172 -0.031072 -0.030112
+0.201915 0.0294994 -0.0321282
+0.214808 0.00646217 -0.0139236
+0.227702 0.0187476 0.00419981
+0.206 0.223831 -0.0481296
+0.206221 0.283326 0.0645848
+0.214822 0.236662 0.00241764
+0.0264207 0.431525 0.115171
+0.0544392 0.416786 0.104414
+0.0763126 0.402347 0.107403
+0.0771549 0.398165 0.0608874
+0.102946 0.384315 -0.0506585
+0.122138 0.368453 -0.099846
+0.207423 -0.0211584 0.0494503
+0.198726 -0.03966 0.024431
+0.208333 -0.0345933 0.028712
+0.234871 0.00388549 0.0186688
+0.228683 -0.0162494 0.0130411
+0.232912 -0.00744574 0.0240283
+0.218501 0.219252 -0.0226215
+0.219119 0.208759 -0.0379334
+0.220264 0.184845 -0.0486804
+0.227457 0.182857 -0.0350401
+0.226408 0.207455 -0.0214905
+0.225795 0.195381 -0.0345083
+0.239321 0.168331 -0.0200633
+0.239383 0.22478 0.0269107
+0.241864 0.211651 0.0128349
+0.258277 0.183364 0.0224475
+0.250988 0.214735 0.0283332
+0.269973 0.172306 0.0900942
+0.266764 0.182182 0.0475774
+0.274834 0.12796 0.0695709
+0.253588 0.174446 0.019238
+0.244603 0.174165 0.000286677
+0.265188 0.138234 0.0162887
+0.261487 0.116811 0.00635057
+0.261798 0.0776958 0.0402453
+0.26892 0.114622 0.018204
+0.258349 0.0864654 0.0110391
+0.237261 0.0279049 0.0201964
+0.249709 0.0485278 0.0221226
+0.244924 0.057264 0.0119633
+0.0233942 -0.306614 0.121033
+0.0189732 -0.295349 0.100056
+0.0348455 -0.291369 0.102843
+0.0574759 -0.210159 0.142652
+0.05874 -0.194756 0.124506
+0.0556651 -0.230457 0.132629
+0.0441038 -0.271579 0.0987525
+0.0526099 -0.252148 0.113122
+0.0307693 -0.255185 0.0857729
+0.0612737 -0.183559 0.101118
+0.0542235 -0.171767 0.0806919
+0.033275 -0.178611 0.0752321
+0.0437011 -0.233053 0.0988433
+0.0517089 -0.213401 0.112259
+0.0449659 -0.196078 0.0932784
+0.0295434 -0.213023 0.0854671
+0.152862 0.395312 0.12814
+0.159127 0.366589 0.0960749
+0.24263 0.245541 0.0611037
+0.251284 0.239056 0.0681
+0.260097 0.216417 0.0712091
+0.247123 0.244492 0.088867
+0.0851777 0.377845 0.248815
+0.0675621 0.408291 0.193402
+0.0848801 0.403994 0.219503
+0.0635343 0.391638 0.229442
+0.0659957 0.37168 0.245947
+0.196236 0.388186 0.128596
+0.243248 0.390163 0.134731
+0.253651 0.429825 0.171457
+0.171904 0.381015 0.18843
+0.196814 0.390321 0.171222
+0.212044 0.36097 0.151173
+0.258751 0.426999 0.178967
+0.227151 0.390652 0.158483
+0.104853 0.369784 0.260855
+0.115897 0.360876 0.25452
+0.0951104 0.353093 0.263667
+0.0831369 0.340789 0.270579
+0.0793486 0.35347 0.262652
+0.098042 0.343059 0.25758
+0.241016 0.297228 0.107633
+0.234225 0.345372 0.132203
+0.276783 0.375704 0.131737
+0.274356 0.407146 0.158161
+0.258924 0.387625 0.151078
+0.28029 0.371479 0.139443
+0.259029 0.32043 0.115051
+0.269188 0.348845 0.127854
+0.200723 0.347139 0.0979389
+0.214028 0.300348 0.0769126
+0.254685 0.351972 0.111632
+0.241657 0.320942 0.0963192
+0.2746 0.315736 0.101301
+0.279087 0.314318 0.10984
+0.286444 0.340789 0.118158
+0.249666 0.276486 0.0800647
+0.249029 0.251672 0.0722288
+0.256572 0.276797 0.0915338
+0.270725 0.285433 0.0926272
+0.215546 0.431056 0.171121
+0.157781 0.420489 0.171822
+0.199654 0.444514 0.189475
+0.17053 0.446967 0.219256
+0.205541 0.469434 0.229534
+0.199492 0.471441 0.251981
+0.211887 0.46609 0.235491
+0.188893 0.418014 0.202062
+0.189616 0.443489 0.235276
+0.216308 0.445796 0.206907
+0.231906 0.432697 0.189024
+0.251194 0.454433 0.19994
+0.237855 0.461496 0.212483
+0.228659 0.474155 0.225851
+0.233679 0.464102 0.206607
+0.126693 0.412286 0.235424
+0.15381 0.433628 0.240735
+0.139006 0.411313 0.254414
+0.119484 0.391069 0.256096
+0.165036 0.396505 0.213489
+0.146583 0.380527 0.232229
+0.164653 0.413358 0.241726
+0.177336 0.433469 0.244745
+0.161492 0.432487 0.259539
+0.178897 0.449259 0.262792
+0.170516 0.431467 0.259706
+0.137152 0.398832 0.262308
+0.156076 0.416945 0.262873
+0.146707 0.395982 0.255875
+0.125174 0.378471 0.262959
+0.108095 0.371857 0.00996679
+0.128239 0.350215 0.0349486
+0.133853 0.349256 0.0651268
+0.218056 0.251064 0.0284622
+0.208678 0.273009 0.0525635
+0.162953 0.316325 0.0387464
+0.180516 0.288727 0.00575605
+0.184616 0.271323 -0.0641787
+0.192739 0.259071 -0.0258971
+0.160497 0.315821 -0.0293024
+0.138278 0.343743 -0.0145987
+0.129015 0.356724 -0.0572827
+0.157417 0.322173 -0.0792128
+0.0341561 0.430408 0.0636367
+0.0138007 0.445423 -0.0131284
+0.0675574 0.412405 -0.00590144
+0.0543716 0.427737 -0.0783221
+0.0394672 -0.109438 0.00782081
+0.0845068 -0.116166 0.0199861
+0.103349 -0.102047 0.00107231
+0.135931 -0.0925252 0.0123564
+0.152751 -0.0719022 -0.0063178
+0.119987 -0.083488 -0.0138083
+0.0529683 -0.0970178 -0.0113947
+0.0783146 -0.0912706 -0.0211601
+0.218209 0.0493087 -0.0142253
+0.245476 0.0889793 0.00126342
+0.226926 0.0646589 -0.0138949
+0.250077 0.117299 -0.0142492
+0.234881 0.0916617 -0.0259545
+0.243214 0.113463 -0.0269367
+0.218013 0.0708709 -0.0288902
+0.220819 0.0858613 -0.0382201
+0.247568 0.131257 -0.0175972
+0.23968 0.157689 -0.0209356
+0.232117 0.141439 -0.0354039
+0.0418575 0.400964 0.20743
+0.0195766 0.413726 0.187334
+-0.00902553 0.413602 0.205648
+-0.0547027 0.354342 0.276825
+-0.0113108 0.354659 0.280219
+-0.0234945 0.379182 0.256182
+0.0520973 0.369083 0.249567
+0.0331166 0.352772 0.27144
+0.00140062 0.377314 0.253744
+0.0186906 0.394924 0.226564
+0.0447454 -0.287624 0.117675
+0.0974052 0.397232 -0.111723
+0.0710821 0.42028 -0.123271
+0.0451331 0.435802 -0.131916
+-0.000126957 0.440974 0.0952087
+0.0478095 0.419766 0.138671
+-0.0290697 0.354425 0.282179
+0.247137 0.366868 0.139852
+0.167833 -0.0586161 0.0577407
+0.235111 0.0572257 0.00334661
+0.25527 0.119867 -0.00043138
+0.227208 0.22145 0.00277189
+0.054573 -0.129783 0.0327071
+0.2266 -0.000760034 0.00252821
+0.235532 0.200961 0.000928286
+0.236653 0.010993 0.0292724
+0.269073 0.155883 0.0351438
+0.238349 0.239177 0.0445598
+0.257678 0.21965 0.057295
+0.0680645 -0.174276 0.0943132
+0.0647172 -0.12097 0.0264521
+0.0299986 -0.27518 0.0871046
+0.236969 0.0193128 0.0435503
+0.252582 0.228763 0.0907072
+0.192935 0.375885 0.167433
+0.173768 0.412252 0.153348
+-0.0312395 0.327507 0.304526
+0.229439 0.0921737 -0.0309215
+0.0353144 -0.0923102 -0.0249825
+0.193208 0.282463 0.0331705
+0.179319 0.396563 0.191654
+0.201762 0.443929 0.219796
+0.154529 0.396092 0.237081
+0.248129 0.308239 0.110205
+0.0930129 0.403387 0.121234
+0.0639555 0.400982 0.212516
+-0.0174074 0.451196 -0.0194503
+-0.0443673 0.416835 0.199517
+-0.0526673 0.381255 0.248897
+0.0174026 0.406906 0.206146
+0.0265599 0.374492 0.249935
+0.0315883 0.332254 0.28896
+0.270672 0.177287 0.0674352
+0.187101 -0.0168289 0.106484
+0.135586 -0.0611553 0.116766
+0.0833239 -0.127919 0.131872
+0.0548173 -0.23435 0.175604
+0.043323 -0.263111 0.198627
+-0.0196155 -0.288097 0.215386
+0.2399 0.0907328 -0.0125585
+0.194089 -0.0332951 -0.0100733
+0.0709579 -0.107244 0.00473153
+0.0163201 -0.142187 0.0369553
+0.00607549 -0.175829 0.0637466
+0.00567756 -0.256727 0.0774013
+0.0712214 -0.151833 0.0667117
+0.0502674 -0.181767 0.0871865
+0.044357 -0.253493 0.0980058
+0.0558091 -0.250414 0.136565
+-0.000198626 -0.295861 0.0967028
+-0.0734629 0.319873 0.298711
+-0.0780368 0.179696 0.37733
+-0.0782954 0.130637 0.39291
+-0.0812885 0.0578769 0.423184
+-0.0840331 -0.0146591 0.458645
+-0.0876588 -0.0878797 0.491343
+-0.0882861 -0.113474 0.498191
+-0.00754096 0.331589 0.298185
+0.0185568 0.244856 0.352703
+-0.0315795 0.174754 0.383882
+0.0390215 0.209549 0.365385
+-0.0188108 0.0127752 0.427619
+-0.0268138 -0.0804179 0.471298
+-0.0282458 -0.098273 0.47764
+0.0353336 -0.0206745 0.370418
+-0.00815868 -0.0919218 0.443381
+0.0555306 -0.142547 0.398226
+0.0734049 -0.0470733 0.328612
+0.0753925 -0.0150611 0.307232
+0.12708 0.214592 0.299468
+0.119336 0.0917573 0.3116
+0.0776436 0.210114 0.344954
+0.0671308 0.246528 0.328277
+0.164227 0.0200786 0.174824
+0.128747 -0.0309382 0.174967
+0.0878739 -0.0752693 0.228911
+0.0875531 -0.104672 0.25407
+0.0677198 -0.186887 0.322764
+0.0520393 -0.204383 0.340643
+0.0636825 0.0484514 0.335889
+0.228013 0.30893 0.0865299
+0.175162 0.375196 0.111071
+0.183912 0.44586 0.202383
+0.146344 0.423009 0.248346
+-0.00850815 -0.113973 0.448851
+0.0375703 0.133037 0.361166
+0.131764 -0.0876742 -0.00222789
+0.0412534 0.431519 -0.0102118
+0.216164 0.372863 0.152007
+0.176785 0.287794 -0.0259306
+0.144457 0.337939 -0.041549
+0.0878404 0.346934 0.266053
+0.168432 0.434355 0.263327
+0.213979 0.475425 0.239658
+0.14131 0.397098 0.262911
+0.240312 0.467488 0.213983
+0.283163 0.374338 0.136847
+0.108665 0.363701 0.26292
+0.281181 0.310706 0.104227
+0.25821 0.266036 0.0815827
+0.244009 0.41058 0.169646
+0.263206 0.434179 0.180116
+0.226878 0.410581 0.151412
+0.0756751 0.327043 0.279899
+0.252391 0.237332 0.0758157
+0.262123 0.076302 0.0758116
+-0.0329391 0.135915 0.392963
+0.119489 0.182574 0.321136
+0.0556746 0.0752147 0.346315
+0.0291844 0.0799421 0.357493
+0.0497118 0.193336 0.369389
+0.0817383 0.193973 0.352124
+0.114685 0.170965 0.330753
+0.124867 0.138526 0.322155
+0.0839949 0.0808807 0.335366
+0.00993539 0.101207 0.367354
+0.00487282 0.128483 0.373154
+0.111572 0.105359 0.325589
+0.159222 0.163225 0.277787
+0.135203 0.143617 0.310244
+0.161583 0.114358 0.266019
+0.137857 0.0658704 0.268701
+0.104776 0.0309409 0.281
+0.0900055 0.060358 0.323076
+0.0430738 0.140844 0.366646
+0.0486865 0.116806 0.349686
+0.0745495 0.115772 0.342641
+0.0977499 0.127094 0.337392
+0.0852105 0.159849 0.36006
+0.0634715 0.158178 0.36985
+0.026521 0.116854 0.355519
+0.0264971 0.127879 0.360434
+0.0199117 0.117616 0.357761
+0.0361622 0.123645 0.354312
+0.0256302 0.123008 0.355807
+0.0357315 0.128081 0.35686
+0.0413067 0.134042 0.359901
+0.0400371 0.130297 0.356113
+0.0395388 0.126883 0.352095
+0.0492619 0.120901 0.347052
+0.0727346 0.120245 0.341256
+0.0943016 0.131423 0.335935
+0.103378 0.142444 0.333656
+0.0830365 0.157943 0.356976
+0.0633043 0.156189 0.366056
+0.0449318 0.140619 0.364141
+0.0199356 0.168686 0.378783
+0.0514741 0.15107 0.370438
+0.0520584 0.149934 0.367057
+-0.018451 0.0546102 0.40793
+-0.0203479 -0.102296 0.464617
+-0.0187145 -0.0842641 0.459555
+-0.00296232 0.000274732 0.408605
+-0.000625228 0.0470815 0.386809
+-0.0432465 -0.18546 0.42877
+-0.0489507 -0.158663 0.451696
+-0.0228816 -0.145573 0.455498
+-0.0147973 -0.10699 0.452026
+-0.0162245 -0.105141 0.454191
+0.0224454 -0.114088 0.427878
+-0.012766 -0.0879807 0.449075
+-0.0723708 -0.1867 0.420799
+-0.00114261 -0.216696 0.375851
+-0.0133414 -0.173543 0.43512
+-0.0675096 -0.201873 0.395708
+0.0944974 -0.0743069 0.179732
+0.0844112 0.0100784 0.29466
+0.158222 0.0365161 0.202895
+0.124264 -0.00992276 0.208589
+0.0962653 -0.0450768 0.215237
+0.00424554 -0.217118 0.0771433
+0.0432888 -0.213373 0.0974209
+0.055818 -0.211998 0.128328
+0.0592048 -0.206768 0.158678
+0.0709531 -0.154228 0.134181
+0.0642777 -0.180418 0.141724
+0.0919542 -0.12041 0.0565155
+0.0989757 -0.0983782 0.127589
+0.0407463 -0.16648 0.408266
+-0.00421687 -0.198329 0.411532
+0.0455399 -0.285789 0.14238
+-0.0113442 -0.313568 0.152998
+0.0203718 -0.309664 0.148722
+0.0162382 -0.282523 0.2137
+0.0144519 -0.136627 0.434579
+0.260826 0.0809475 0.0211403
+0.252353 0.0881602 0.00706385
+0.234215 0.186985 -0.0192537
+0.221307 0.197226 -0.0396713
+0.0892724 0.391863 0.00236576
+0.207802 0.235205 -0.0235123
+0.216796 0.0273779 -0.0124383
+0.183883 -0.0251623 -0.0254036
+0.0537634 -0.146287 0.0473044
+0.0784675 0.103415 0.340989
+0.0502578 0.103147 0.350055
+0.0309181 0.144847 0.370745
+0.0400419 0.158853 0.37461
+0.059185 0.172584 0.371305
+0.0847655 0.173814 0.35836
+0.109426 0.159963 0.339157
+0.116093 0.138406 0.330776
+-0.0187145 0.093132 0.393762
+-0.034649 0.0963455 0.405492
+-0.0801629 0.0903301 0.407259
+-0.0213922 -0.0238116 0.446432
+-0.00706658 -0.0333231 0.426536
+0.0321057 -0.054387 0.395156
+0.0717961 -0.0808923 0.358053
+0.0658428 -0.112823 0.381335
+0.0275128 -0.0872142 0.415272
+-0.0239593 -0.0564183 0.461686
+-0.0860876 -0.0523755 0.476945
+-0.010448 -0.0656138 0.441536
+-0.0822373 0.0226744 0.440298
+0.0834488 -0.134198 0.280066
+0.0768293 -0.161671 0.302993
+-0.0148116 0.129455 0.384787
+0.00177398 0.18066 0.380803
+-0.0324798 0.0207687 0.438741
+-0.0341561 -0.0175852 0.45696
+-0.0359854 -0.0512363 0.471418
+-0.0380065 -0.0778555 0.481116
+-0.0361199 -0.0971332 0.485222
+-0.060828 -0.104322 0.495696
+-0.0590465 -0.08071 0.488363
+-0.0572984 -0.0499476 0.476337
+-0.0556125 -0.0145055 0.460763
+-0.0543723 0.023187 0.443315
+-0.0552009 0.059812 0.425901
+-0.05602 0.095024 0.409382
+-0.0543341 0.136116 0.395008
+-0.0555456 0.182593 0.380813
+-0.0543771 0.323569 0.303122
+-0.0888752 -0.129888 0.499652
+-0.0638169 -0.121942 0.498785
+-0.0420732 -0.114921 0.491755
+-0.0283946 -0.113144 0.482745
+-0.0221055 -0.116588 0.471232
+-0.018279 -0.117584 0.459374
+-0.0182026 -0.119538 0.457754
+-0.0133216 -0.13085 0.454296
+0.00355615 -0.155359 0.43648
+0.021799 -0.183204 0.41091
+0.0299843 -0.213904 0.356132
+-0.0268903 0.208166 0.37655
+-0.0572889 0.233424 0.360875
+-0.0776149 0.229587 0.355639
+-0.00828836 0.159217 0.38199
+0.0110179 0.149882 0.376584
+-0.00934224 0.231159 0.366804
+0.0172729 0.196536 0.375578
+0.0317658 0.183097 0.376464
+-0.0757331 0.278889 0.32683
+-0.0562159 0.284009 0.332127
+-0.0312006 0.292185 0.330087
+-0.000730343 0.302546 0.317591
+0.0644108 0.304715 0.294812
+0.125763 0.282521 0.25905
+0.167053 0.252821 0.222411
+0.23591 0.191886 0.149622
+-0.035909 0.439743 0.114577
+0.102807 0.382692 0.253154
+0.105978 0.406879 0.226476
+0.135165 0.409645 0.151519
+0.143159 0.357886 0.0810612
+0.137042 -0.0918788 0.0283434
+0.196254 -0.020938 0.075587
+0.260345 0.0987249 0.109387
+0.259503 0.172895 0.11486
+0.188394 0.462296 0.259366
+0.161215 0.44224 0.23154
+0.115174 0.417401 0.194374
+0.0714173 0.414369 0.174114
+0.0218086 0.419771 0.16841
+-0.0413688 0.427019 0.167203
+-0.0388256 -0.208588 0.398874
+-0.000711231 -0.209996 0.393826
+0.0306641 -0.201629 0.384395
+0.0537873 -0.189009 0.375731
+0.0704071 -0.16681 0.360854
+0.080053 -0.13621 0.340639
+0.0861975 -0.104633 0.318119
+0.0888943 -0.0725199 0.293439
+0.0890042 -0.0379502 0.272682
+0.095264 -0.00958216 0.261321
+0.116864 0.0142168 0.250454
+0.150151 0.0550702 0.239935
+0.174419 0.114631 0.239102
+0.170664 0.185946 0.249936
+0.0729353 0.0296673 0.31911
+0.0950101 0.0467846 0.304703
+0.126568 0.0779975 0.291993
+0.147244 0.116212 0.288304
+0.147325 0.15264 0.294454
+0.123967 0.195607 0.310772
+0.0722172 0.223989 0.338823
+0.0285857 0.22362 0.361755
+0.00490695 0.210144 0.374361
+0.038356 0.00508817 0.353469
+-0.000442983 0.0204042 0.396862
+0.127904 0.238893 0.286268
+0.0613406 0.277133 0.312236
+0.00869039 0.272583 0.337252
+-0.0237341 0.258774 0.35234
+0.0661349 0.147057 0.308155
+0.0976966 0.133842 0.311293
+0.106672 0.144595 0.310723
+0.102678 0.157349 0.319115
+0.0845935 0.166852 0.333225
+0.0634436 0.164873 0.342146
+0.0499227 0.15684 0.344068
+0.041637 0.146164 0.341985
+0.0384713 0.138439 0.33845
+0.0377478 0.133765 0.335083
+0.0378099 0.129786 0.33184
+0.0499274 0.123641 0.325097
+0.0756608 0.123123 0.316413
+0.098171 -0.0867159 0.151259
+0.135021 -0.0481565 0.142538
+0.182418 -0.00466839 0.13158
+0.131884 -0.0395501 0.158755
+0.0963226 -0.0804472 0.165537
+0.0855654 -0.145057 0.105836
+0.0986932 -0.113173 0.0989587
+0.133896 -0.0759157 0.0864384
+0.0659144 -0.180172 0.117661
+0.231772 0.125868 0.152078
+0.17246 0.00869893 0.154659
+0.0180825 0.442468 -0.144919
+-0.00224905 0.449633 -0.0885858
+-0.0276042 0.448604 0.0490817
+-0.0476095 0.40366 0.222439
+-0.0329876 0.444834 0.0880916
+-0.0387157 0.433527 0.141609
+0.00921255 -0.160857 0.0544993
+0.0046387 -0.192773 0.0714145
+0.00496428 -0.280238 0.0812079
+-0.00651643 -0.307045 0.118107
+-0.0157549 -0.306288 0.190907
+0.0175507 -0.300536 0.184801
+0.0444628 -0.276421 0.173435
+0.0556603 -0.243862 0.15862
+0.234211 0.0257207 0.0760894
+0.222385 0.035826 0.120402
+0.204042 0.0585376 0.154803
+0.184439 0.0953776 0.203594
+0.199497 0.238257 0.182616
+-0.246139 0.317269 0.13913
+-0.278738 0.318992 0.0838392
+-0.291214 0.295534 0.0507622
+-0.297066 0.271706 0.0284288
+-0.299361 0.237519 0.000861395
+-0.290611 0.175012 -0.0514632
+-0.29531 0.191603 -0.033191
+-0.269237 0.345975 0.123406
+-0.257225 0.326274 0.129598
+0.244958 0.254191 0.0865824
+0.236648 0.282218 0.111099
+0.235677 0.254265 0.11509
+0.209213 0.329491 0.155029
+0.162567 0.303817 0.208697
+0.20065 0.279907 0.167515
+0.167797 0.351653 0.194941
+3  97 2109 2111
+3  71 2110 2109
+3  16 2111 2110
+3  2111 2109 2110
+3  19 2112 2114
+3  14 2113 2112
+3  17 2114 2113
+3  2114 2112 2113
+3  97 2111 2116
+3  16 2115 2111
+3  131 2116 2115
+3  2116 2111 2115
+3  11 2117 2118
+3  19 2114 2117
+3  17 2118 2114
+3  2118 2117 2114
+3  14 2112 2120
+3  19 2119 2112
+3  20 2120 2119
+3  2120 2112 2119
+3  43 2121 2123
+3  16 2122 2121
+3  15 2123 2122
+3  2123 2121 2122
+3  2124 6528 2113
+3  2113 14 2124
+3  2125 6528 2124
+3  2124 15 2125
+3  2126 6528 2125
+3  2125 18 2126
+3  17 2113 6528
+3  6528 2126 17
+3  2110 6529 2122
+3  2122 16 2110
+3  71 2127 6529
+3  6529 2110 71
+3  18 2125 6529
+3  6529 2127 18
+3  15 2122 6529
+3  6529 2125 15
+3  12 2128 2130
+3  72 2129 2128
+3  83 2130 2129
+3  2130 2128 2129
+3  18 2127 6530
+3  6530 2133 18
+3  2131 6530 2127
+3  2127 71 2131
+3  72 2128 6530
+3  6530 2131 72
+3  2132 6530 2128
+3  2128 12 2132
+3  2133 6530 2132
+3  2132 11 2133
+3  21 2134 6531
+3  6531 2135 21
+3  20 2119 6531
+3  6531 2134 20
+3  2117 6531 2119
+3  2119 19 2117
+3  11 2135 6531
+3  6531 2117 11
+3  11 2118 2133
+3  17 2126 2118
+3  18 2133 2126
+3  2133 2118 2126
+3  43 2136 2121
+3  131 2115 2136
+3  16 2121 2115
+3  2121 2136 2115
+3  15 2124 6532
+3  6532 2123 15
+3  14 2120 6532
+3  6532 2124 14
+3  2137 6532 2120
+3  2120 20 2137
+3  2123 6532 2137
+3  2137 43 2123
+3  3 2138 2140
+3  1 2139 2138
+3  8 2140 2139
+3  2140 2138 2139
+3  6 2141 6533
+3  6533 2143 6
+3  13 2142 6533
+3  6533 2141 13
+3  3 2140 6533
+3  6533 2142 3
+3  2143 6533 2140
+3  2140 8 2143
+3  6 2144 6534
+3  6534 2141 6
+3  5 2145 6534
+3  6534 2144 5
+3  10 2146 6534
+3  6534 2145 10
+3  13 2141 6534
+3  6534 2146 13
+3  2 2147 2149
+3  7 2148 2147
+3  0 2149 2148
+3  2149 2147 2148
+3  12 2130 6535
+3  6535 2152 12
+3  2150 6535 2130
+3  2130 83 2150
+3  73 2151 6535
+3  6535 2150 73
+3  7 2152 6535
+3  6535 2151 7
+3  4 2153 6536
+3  6536 2155 4
+3  9 2154 6536
+3  6536 2153 9
+3  10 2145 6536
+3  6536 2154 10
+3  2155 6536 2145
+3  2145 5 2155
+3  22 2156 6537
+3  6537 2158 22
+3  44 2157 6537
+3  6537 2156 44
+3  9 2153 6537
+3  6537 2157 9
+3  2158 6537 2153
+3  2153 4 2158
+3  50 2159 6538
+3  6538 2161 50
+3  81 2160 6538
+3  6538 2159 81
+3  2139 6538 2160
+3  2160 8 2139
+3  1 2161 6538
+3  6538 2139 1
+3  2160 6539 2143
+3  2143 8 2160
+3  81 2162 6539
+3  6539 2160 81
+3  55 2163 6539
+3  6539 2162 55
+3  6 2143 6539
+3  6539 2163 6
+3  2164 6540 2165
+3  2165 49 2164
+3  0 2148 6540
+3  6540 2164 0
+3  7 2151 6540
+3  6540 2148 7
+3  73 2165 6540
+3  6540 2151 73
+3  55 2166 6541
+3  6541 2163 55
+3  54 2167 6541
+3  6541 2166 54
+3  5 2144 6541
+3  6541 2167 5
+3  2163 6541 2144
+3  2144 6 2163
+3  54 2168 6542
+3  6542 2167 54
+3  53 2169 6542
+3  6542 2168 53
+3  4 2155 6542
+3  6542 2169 4
+3  2167 6542 2155
+3  2155 5 2167
+3  53 2170 6543
+3  6543 2169 53
+3  134 2171 6543
+3  6543 2170 134
+3  22 2158 6543
+3  6543 2171 22
+3  2169 6543 2158
+3  2158 4 2169
+3  2149 6544 2173
+3  2173 2 2149
+3  0 2172 6544
+3  6544 2149 0
+3  1 2138 6544
+3  6544 2172 1
+3  3 2173 6544
+3  6544 2138 3
+3  2174 6545 2172
+3  2172 0 2174
+3  48 2175 6545
+3  6545 2174 48
+3  50 2161 6545
+3  6545 2175 50
+3  2172 6545 2161
+3  2161 1 2172
+3  49 2176 2164
+3  48 2174 2176
+3  0 2164 2174
+3  2164 2176 2174
+3  39 2177 2179
+3  158 2178 2177
+3  184 2179 2178
+3  2179 2177 2178
+3  40 2180 2182
+3  37 2181 2180
+3  42 2182 2181
+3  2182 2180 2181
+3  131 2183 2184
+3  39 2179 2183
+3  184 2184 2179
+3  2184 2183 2179
+3  40 2182 2186
+3  42 2185 2182
+3  34 2186 2185
+3  2186 2182 2185
+3  20 2187 2188
+3  42 2181 2187
+3  37 2188 2181
+3  2188 2187 2181
+3  38 2189 2191
+3  39 2190 2189
+3  43 2191 2190
+3  2191 2189 2190
+3  38 2192 6546
+3  6546 2194 38
+3  37 2180 6546
+3  6546 2192 37
+3  2193 6546 2180
+3  2180 40 2193
+3  41 2194 6546
+3  6546 2193 41
+3  158 2177 6547
+3  6547 2195 158
+3  39 2189 6547
+3  6547 2177 39
+3  38 2194 6547
+3  6547 2189 38
+3  2195 6547 2194
+3  2194 41 2195
+3  170 2196 2198
+3  159 2197 2196
+3  35 2198 2197
+3  2198 2196 2197
+3  35 2197 6548
+3  6548 2201 35
+3  2199 6548 2197
+3  2197 159 2199
+3  2195 6548 2199
+3  2199 158 2195
+3  41 2200 6548
+3  6548 2195 41
+3  34 2201 6548
+3  6548 2200 34
+3  2134 6549 2187
+3  2187 20 2134
+3  21 2202 6549
+3  6549 2134 21
+3  34 2185 6549
+3  6549 2202 34
+3  2187 6549 2185
+3  2185 42 2187
+3  41 2193 2200
+3  40 2186 2193
+3  34 2200 2186
+3  2200 2193 2186
+3  39 2183 2190
+3  131 2136 2183
+3  43 2190 2136
+3  2190 2183 2136
+3  37 2192 6550
+3  6550 2188 37
+3  38 2191 6550
+3  6550 2192 38
+3  2137 6550 2191
+3  2191 43 2137
+3  2188 6550 2137
+3  2137 20 2188
+3  31 2203 2205
+3  24 2204 2203
+3  26 2205 2204
+3  2205 2203 2204
+3  36 2206 6551
+3  6551 2208 36
+3  29 2207 6551
+3  6551 2206 29
+3  2205 6551 2207
+3  2207 31 2205
+3  26 2208 6551
+3  6551 2205 26
+3  28 2209 6552
+3  6552 2211 28
+3  29 2206 6552
+3  6552 2209 29
+3  36 2210 6552
+3  6552 2206 36
+3  2211 6552 2210
+3  2210 33 2211
+3  23 2212 2214
+3  30 2213 2212
+3  25 2214 2213
+3  2214 2212 2213
+3  2198 6553 2217
+3  2217 170 2198
+3  35 2215 6553
+3  6553 2198 35
+3  30 2216 6553
+3  6553 2215 30
+3  160 2217 6553
+3  6553 2216 160
+3  32 2218 6554
+3  6554 2220 32
+3  27 2219 6554
+3  6554 2218 27
+3  28 2211 6554
+3  6554 2219 28
+3  2220 6554 2211
+3  2211 33 2220
+3  44 2156 6555
+3  6555 2222 44
+3  22 2221 6555
+3  6555 2156 22
+3  27 2218 6555
+3  6555 2221 27
+3  32 2222 6555
+3  6555 2218 32
+3  168 2223 6556
+3  6556 2225 168
+3  137 2224 6556
+3  6556 2223 137
+3  2203 6556 2224
+3  2224 24 2203
+3  31 2225 6556
+3  6556 2203 31
+3  168 2225 6557
+3  6557 2227 168
+3  31 2207 6557
+3  6557 2225 31
+3  2226 6557 2207
+3  2207 29 2226
+3  142 2227 6557
+3  6557 2226 142
+3  2228 6558 2212
+3  2212 23 2228
+3  136 2229 6558
+3  6558 2228 136
+3  160 2216 6558
+3  6558 2229 160
+3  30 2212 6558
+3  6558 2216 30
+3  141 2230 6559
+3  6559 2231 141
+3  142 2226 6559
+3  6559 2230 142
+3  2209 6559 2226
+3  2226 29 2209
+3  2231 6559 2209
+3  2209 28 2231
+3  140 2232 6560
+3  6560 2233 140
+3  141 2231 6560
+3  6560 2232 141
+3  2219 6560 2231
+3  2231 28 2219
+3  2233 6560 2219
+3  2219 27 2233
+3  134 2234 6561
+3  6561 2171 134
+3  140 2233 6561
+3  6561 2234 140
+3  2221 6561 2233
+3  2233 27 2221
+3  2171 6561 2221
+3  2221 22 2171
+3  23 2214 6562
+3  6562 2236 23
+3  25 2235 6562
+3  6562 2214 25
+3  26 2204 6562
+3  6562 2235 26
+3  2236 6562 2204
+3  2204 24 2236
+3  135 2237 6563
+3  6563 2238 135
+3  2236 6563 2237
+3  2237 23 2236
+3  24 2224 6563
+3  6563 2236 24
+3  2238 6563 2224
+3  2224 137 2238
+3  23 2237 2228
+3  135 2239 2237
+3  136 2228 2239
+3  2228 2237 2239
+3  124 2240 6564
+3  6564 2243 124
+3  127 2241 6564
+3  6564 2240 127
+3  2242 6564 2241
+3  2241 59 2242
+3  2243 6564 2242
+3  2242 64 2243
+3  125 2244 6565
+3  6565 2247 125
+3  122 2245 6565
+3  6565 2244 122
+3  2246 6565 2245
+3  2245 62 2246
+3  128 2247 6565
+3  6565 2246 128
+3  67 2248 6566
+3  6566 2251 67
+3  63 2249 6566
+3  6566 2248 63
+3  2250 6566 2249
+3  2249 60 2250
+3  113 2251 6566
+3  6566 2250 113
+3  116 2252 6567
+3  6567 2255 116
+3  66 2253 6567
+3  6567 2252 66
+3  2254 6567 2253
+3  2253 114 2254
+3  119 2255 6567
+3  6567 2254 119
+3  123 2256 2258
+3  65 2257 2256
+3  82 2258 2257
+3  2258 2256 2257
+3  2259 6568 2262
+3  2262 96 2259
+3  61 2260 6568
+3  6568 2259 61
+3  120 2261 6568
+3  6568 2260 120
+3  2262 6568 2261
+3  2261 70 2262
+3  121 2263 2265
+3  126 2264 2263
+3  83 2265 2264
+3  2265 2263 2264
+3  49 2165 2267
+3  73 2266 2165
+3  103 2267 2266
+3  2267 2165 2266
+3  117 2268 2270
+3  86 2269 2268
+3  106 2270 2269
+3  2270 2268 2269
+3  107 2271 6569
+3  6569 2274 107
+3  76 2272 6569
+3  6569 2271 76
+3  75 2273 6569
+3  6569 2272 75
+3  2274 6569 2273
+3  2273 104 2274
+3  108 2275 6570
+3  6570 2278 108
+3  101 2276 6570
+3  6570 2275 101
+3  2277 6570 2276
+3  2276 74 2277
+3  2278 6570 2277
+3  2277 77 2278
+3  2279 6571 2282
+3  2282 88 2279
+3  2280 6571 2279
+3  2279 112 2280
+3  2281 6571 2280
+3  2280 58 2281
+3  91 2282 6571
+3  6571 2281 91
+3  78 2283 2285
+3  111 2284 2283
+3  89 2285 2284
+3  2285 2283 2284
+3  2286 6572 2289
+3  2289 93 2286
+3  90 2287 6572
+3  6572 2286 90
+3  80 2288 6572
+3  6572 2287 80
+3  2289 6572 2288
+3  2288 98 2289
+3  110 2290 2292
+3  100 2291 2290
+3  109 2292 2291
+3  2292 2290 2291
+3  51 2293 6573
+3  6573 2296 51
+3  52 2294 6573
+3  6573 2293 52
+3  2295 6573 2294
+3  2294 92 2295
+3  2296 6573 2295
+3  2295 99 2296
+3  2297 6574 2300
+3  2300 1116 2297
+3  2298 6574 2297
+3  2297 976 2298
+3  2299 6574 2298
+3  2298 84 2299
+3  2300 6574 2299
+3  2299 980 2300
+3  2301 6575 2304
+3  2304 118 2301
+3  87 2302 6575
+3  6575 2301 87
+3  85 2303 6575
+3  6575 2302 85
+3  2304 6575 2303
+3  2303 115 2304
+3  59 2241 2306
+3  127 2305 2241
+3  46 2306 2305
+3  2306 2241 2305
+3  45 2307 2308
+3  128 2246 2307
+3  62 2308 2246
+3  2308 2307 2246
+3  59 2309 6576
+3  6576 2242 59
+3  60 2249 6576
+3  6576 2309 60
+3  2310 6576 2249
+3  2249 63 2310
+3  64 2242 6576
+3  6576 2310 64
+3  129 2311 2312
+3  113 2250 2311
+3  60 2312 2250
+3  2312 2311 2250
+3  66 2313 6577
+3  6577 2253 66
+3  67 2251 6577
+3  6577 2313 67
+3  113 2314 6577
+3  6577 2251 113
+3  2253 6577 2314
+3  2314 114 2253
+3  65 2315 6578
+3  6578 2317 65
+3  63 2248 6578
+3  6578 2315 63
+3  67 2316 6578
+3  6578 2248 67
+3  2317 6578 2316
+3  2316 68 2317
+3  61 2259 2319
+3  96 2318 2259
+3  132 2319 2318
+3  2319 2259 2318
+3  2320 6579 2243
+3  2243 64 2320
+3  2256 6579 2320
+3  2320 65 2256
+3  123 2321 6579
+3  6579 2256 123
+3  124 2243 6579
+3  6579 2321 124
+3  124 2322 6580
+3  6580 2240 124
+3  125 2247 6580
+3  6580 2322 125
+3  128 2323 6580
+3  6580 2247 128
+3  2240 6580 2323
+3  2323 127 2240
+3  61 2324 6581
+3  6581 2260 61
+3  62 2245 6581
+3  6581 2324 62
+3  2325 6581 2245
+3  2245 122 2325
+3  120 2260 6581
+3  6581 2325 120
+3  2326 6582 2263
+3  2263 121 2326
+3  122 2244 6582
+3  6582 2326 122
+3  125 2327 6582
+3  6582 2244 125
+3  126 2263 6582
+3  6582 2327 126
+3  2328 6583 2262
+3  2262 70 2328
+3  2109 6583 2328
+3  2328 71 2109
+3  97 2329 6583
+3  6583 2109 97
+3  96 2262 6583
+3  6583 2329 96
+3  2330 6584 2332
+3  2332 72 2330
+3  2261 6584 2330
+3  2330 70 2261
+3  2331 6584 2261
+3  2261 120 2331
+3  121 2332 6584
+3  6584 2331 121
+3  2333 6585 2258
+3  2258 82 2333
+3  2264 6585 2333
+3  2333 83 2264
+3  126 2334 6585
+3  6585 2264 126
+3  123 2258 6585
+3  6585 2334 123
+3  2335 6586 2266
+3  2266 73 2335
+3  82 2336 6586
+3  6586 2335 82
+3  102 2337 6586
+3  6586 2336 102
+3  103 2266 6586
+3  6586 2337 103
+3  68 2338 6587
+3  6587 2341 68
+3  69 2339 6587
+3  6587 2338 69
+3  105 2340 6587
+3  6587 2339 105
+3  2341 6587 2340
+3  2340 102 2341
+3  2342 6588 2274
+3  2274 104 2342
+3  105 2343 6588
+3  6588 2342 105
+3  106 2344 6588
+3  6588 2343 106
+3  107 2274 6588
+3  6588 2344 107
+3  75 2345 6589
+3  6589 2273 75
+3  49 2267 6589
+3  6589 2345 49
+3  103 2346 6589
+3  6589 2267 103
+3  2273 6589 2346
+3  2346 104 2273
+3  74 2347 6590
+3  6590 2277 74
+3  75 2272 6590
+3  6590 2347 75
+3  76 2348 6590
+3  6590 2272 76
+3  2277 6590 2348
+3  2348 77 2277
+3  738 2349 6591
+3  6591 2351 738
+3  76 2271 6591
+3  6591 2349 76
+3  107 2350 6591
+3  6591 2271 107
+3  2351 6591 2350
+3  2350 1118 2351
+3  2352 6592 2354
+3  2354 735 2352
+3  58 2280 6592
+3  6592 2352 58
+3  112 2353 6592
+3  6592 2280 112
+3  2354 6592 2353
+3  2353 1124 2354
+3  2355 6593 2283
+3  2283 78 2355
+3  743 2356 6593
+3  6593 2355 743
+3  1125 2357 6593
+3  6593 2356 1125
+3  111 2283 6593
+3  6593 2357 111
+3  57 2358 6594
+3  6594 2361 57
+3  733 2359 6594
+3  6594 2358 733
+3  2360 6594 2359
+3  2359 744 2360
+3  78 2361 6594
+3  6594 2360 78
+3  2362 6595 2364
+3  2364 79 2362
+3  80 2287 6595
+3  6595 2362 80
+3  90 2363 6595
+3  6595 2287 90
+3  91 2364 6595
+3  6595 2363 91
+3  2365 6596 2368
+3  2368 58 2365
+3  736 2366 6596
+3  6596 2365 736
+3  760 2367 6596
+3  6596 2366 760
+3  79 2368 6596
+3  6596 2367 79
+3  88 2282 2370
+3  91 2369 2282
+3  55 2370 2369
+3  2370 2282 2369
+3  88 2371 6597
+3  6597 2279 88
+3  89 2284 6597
+3  6597 2371 89
+3  111 2372 6597
+3  6597 2284 111
+3  2279 6597 2372
+3  2372 112 2279
+3  81 2373 2375
+3  94 2374 2373
+3  89 2375 2374
+3  2375 2373 2374
+3  56 2376 6598
+3  6598 2379 56
+3  57 2377 6598
+3  6598 2376 57
+3  94 2378 6598
+3  6598 2377 94
+3  2379 6598 2378
+3  2378 95 2379
+3  74 2276 2381
+3  101 2380 2276
+3  48 2381 2380
+3  2381 2276 2380
+3  50 2382 2384
+3  100 2383 2382
+3  95 2384 2383
+3  2384 2382 2383
+3  2385 6599 2288
+3  2288 80 2385
+3  2386 6599 2385
+3  2385 759 2386
+3  2387 6599 2386
+3  2386 1051 2387
+3  2288 6599 2387
+3  2387 98 2288
+3  450 2388 6600
+3  6600 2390 450
+3  51 2296 6600
+3  6600 2388 51
+3  2389 6600 2296
+3  2296 99 2389
+3  2390 6600 2389
+3  2389 1052 2390
+3  53 2391 2392
+3  92 2294 2391
+3  52 2392 2294
+3  2392 2391 2294
+3  90 2286 2394
+3  93 2393 2286
+3  54 2394 2393
+3  2394 2286 2393
+3  92 2395 6601
+3  6601 2295 92
+3  93 2289 6601
+3  6601 2395 93
+3  98 2396 6601
+3  6601 2289 98
+3  2295 6601 2396
+3  2396 99 2295
+3  87 2301 2398
+3  118 2397 2301
+3  47 2398 2397
+3  2398 2301 2397
+3  133 2399 2400
+3  119 2254 2399
+3  114 2400 2254
+3  2400 2399 2254
+3  2401 6602 2304
+3  2304 115 2401
+3  116 2255 6602
+3  6602 2401 116
+3  119 2402 6602
+3  6602 2255 119
+3  118 2304 6602
+3  6602 2402 118
+3  69 2403 6603
+3  6603 2405 69
+3  66 2252 6603
+3  6603 2403 66
+3  2404 6603 2252
+3  2252 116 2404
+3  117 2405 6603
+3  6603 2404 117
+3  84 2406 6604
+3  6604 2299 84
+3  85 2302 6604
+3  6604 2406 85
+3  87 2407 6604
+3  6604 2302 87
+3  2299 6604 2407
+3  2407 980 2299
+3  2408 6605 2298
+3  2298 976 2408
+3  977 2409 6605
+3  6605 2408 977
+3  979 2410 6605
+3  6605 2409 979
+3  84 2298 6605
+3  6605 2410 84
+3  2411 6606 2269
+3  2269 86 2411
+3  979 2412 6606
+3  6606 2411 979
+3  1119 2413 6606
+3  6606 2412 1119
+3  106 2269 6606
+3  6606 2413 106
+3  2414 6607 2303
+3  2303 85 2414
+3  2268 6607 2414
+3  2414 86 2268
+3  2415 6607 2268
+3  2268 117 2415
+3  115 2303 6607
+3  6607 2415 115
+3  100 2416 6608
+3  6608 2291 100
+3  101 2275 6608
+3  6608 2416 101
+3  108 2417 6608
+3  6608 2275 108
+3  2291 6608 2417
+3  2417 109 2291
+3  2418 6609 2278
+3  2278 77 2418
+3  2419 6609 2418
+3  2418 737 2419
+3  2420 6609 2419
+3  2419 1121 2420
+3  2278 6609 2420
+3  2420 108 2278
+3  2421 6610 2292
+3  2292 109 2421
+3  2422 6610 2421
+3  2421 1120 2422
+3  2423 6610 2422
+3  2422 1122 2423
+3  110 2292 6610
+3  6610 2423 110
+3  734 2424 6611
+3  6611 2427 734
+3  56 2425 6611
+3  6611 2424 56
+3  2426 6611 2425
+3  2425 110 2426
+3  1123 2427 6611
+3  6611 2426 1123
+3  2290 6612 2383
+3  2383 100 2290
+3  2425 6612 2290
+3  2290 110 2425
+3  2379 6612 2425
+3  2425 56 2379
+3  95 2383 6612
+3  6612 2379 95
+3  2285 6613 2361
+3  2361 78 2285
+3  2374 6613 2285
+3  2285 89 2374
+3  94 2377 6613
+3  6613 2374 94
+3  57 2361 6613
+3  6613 2377 57
+3  58 2368 2281
+3  79 2364 2368
+3  91 2281 2364
+3  2281 2368 2364
+3  83 2129 2265
+3  72 2332 2129
+3  121 2265 2332
+3  2265 2129 2332
+3  2257 6614 2336
+3  2336 82 2257
+3  2317 6614 2257
+3  2257 65 2317
+3  68 2341 6614
+3  6614 2317 68
+3  102 2336 6614
+3  6614 2341 102
+3  2270 6615 2405
+3  2405 117 2270
+3  2343 6615 2270
+3  2270 106 2343
+3  2339 6615 2343
+3  2343 105 2339
+3  2405 6615 2339
+3  2339 69 2405
+3  2428 6616 2307
+3  2307 45 2428
+3  2305 6616 2428
+3  2428 46 2305
+3  127 2323 6616
+3  6616 2305 127
+3  128 2307 6616
+3  6616 2323 128
+3  2322 6617 2327
+3  2327 125 2322
+3  2321 6617 2322
+3  2322 124 2321
+3  2334 6617 2321
+3  2321 123 2334
+3  2327 6617 2334
+3  2334 126 2327
+3  121 2331 2326
+3  120 2325 2331
+3  122 2326 2325
+3  2326 2331 2325
+3  2429 6618 2399
+3  2399 133 2429
+3  2397 6618 2429
+3  2429 47 2397
+3  118 2402 6618
+3  6618 2397 118
+3  119 2399 6618
+3  6618 2402 119
+3  116 2401 2404
+3  115 2415 2401
+3  117 2404 2415
+3  2404 2401 2415
+3  2314 6619 2400
+3  2400 114 2314
+3  2311 6619 2314
+3  2314 113 2311
+3  129 2430 6619
+3  6619 2311 129
+3  133 2400 6619
+3  6619 2430 133
+3  2357 6620 2372
+3  2372 111 2357
+3  1125 2431 6620
+3  6620 2357 1125
+3  1124 2353 6620
+3  6620 2431 1124
+3  112 2372 6620
+3  6620 2353 112
+3  110 2423 2426
+3  1122 2432 2423
+3  1123 2426 2432
+3  2426 2423 2432
+3  2420 6621 2417
+3  2417 108 2420
+3  1121 2433 6621
+3  6621 2420 1121
+3  1120 2421 6621
+3  6621 2433 1120
+3  109 2417 6621
+3  6621 2421 109
+3  2413 6622 2344
+3  2344 106 2413
+3  1119 2434 6622
+3  6622 2413 1119
+3  1118 2350 6622
+3  6622 2434 1118
+3  2344 6622 2350
+3  2350 107 2344
+3  2346 6623 2342
+3  2342 104 2346
+3  103 2337 6623
+3  6623 2346 103
+3  102 2340 6623
+3  6623 2337 102
+3  2342 6623 2340
+3  2340 105 2342
+3  2382 6624 2416
+3  2416 100 2382
+3  2175 6624 2382
+3  2382 50 2175
+3  2380 6624 2175
+3  2175 48 2380
+3  2416 6624 2380
+3  2380 101 2416
+3  2396 6625 2389
+3  2389 99 2396
+3  98 2387 6625
+3  6625 2396 98
+3  1051 2435 6625
+3  6625 2387 1051
+3  1052 2389 6625
+3  6625 2435 1052
+3  2436 6626 2116
+3  2116 131 2436
+3  2318 6626 2436
+3  2436 132 2318
+3  96 2329 6626
+3  6626 2318 96
+3  97 2116 6626
+3  6626 2329 97
+3  2378 6627 2384
+3  2384 95 2378
+3  2373 6627 2378
+3  2378 94 2373
+3  2159 6627 2373
+3  2373 81 2159
+3  2384 6627 2159
+3  2159 50 2384
+3  93 2395 6628
+3  6628 2393 93
+3  92 2391 6628
+3  6628 2395 92
+3  2168 6628 2391
+3  2391 53 2168
+3  2393 6628 2168
+3  2168 54 2393
+3  51 2388 6629
+3  6629 2439 51
+3  450 2437 6629
+3  6629 2388 450
+3  2103 2438 6629
+3  6629 2437 2103
+3  2439 6629 2438
+3  2438 130 2439
+3  2394 6630 2363
+3  2363 90 2394
+3  2166 6630 2394
+3  2394 54 2166
+3  2369 6630 2166
+3  2166 55 2369
+3  2363 6630 2369
+3  2369 91 2363
+3  2371 6631 2375
+3  2375 89 2371
+3  2370 6631 2371
+3  2371 88 2370
+3  2162 6631 2370
+3  2370 55 2162
+3  2375 6631 2162
+3  2162 81 2375
+3  2398 6632 2407
+3  2407 87 2398
+3  47 2440 6632
+3  6632 2398 47
+3  1138 2441 6632
+3  6632 2440 1138
+3  2407 6632 2441
+3  2441 980 2407
+3  2414 6633 2411
+3  2411 86 2414
+3  85 2406 6633
+3  6633 2414 85
+3  84 2410 6633
+3  6633 2406 84
+3  979 2411 6633
+3  6633 2410 979
+3  134 2170 6634
+3  6634 2443 134
+3  2392 6634 2170
+3  2170 53 2392
+3  52 2442 6634
+3  6634 2392 52
+3  216 2443 6634
+3  6634 2442 216
+3  83 2333 2150
+3  82 2335 2333
+3  73 2150 2335
+3  2150 2333 2335
+3  79 2367 6635
+3  6635 2362 79
+3  760 2444 6635
+3  6635 2367 760
+3  759 2385 6635
+3  6635 2444 759
+3  2362 6635 2385
+3  2385 80 2362
+3  743 2355 2445
+3  78 2360 2355
+3  744 2445 2360
+3  2445 2355 2360
+3  737 2418 6636
+3  6636 2446 737
+3  77 2348 6636
+3  6636 2418 77
+3  2349 6636 2348
+3  2348 76 2349
+3  738 2446 6636
+3  6636 2349 738
+3  74 2381 6637
+3  6637 2347 74
+3  2176 6637 2381
+3  2381 48 2176
+3  49 2345 6637
+3  6637 2176 49
+3  2347 6637 2345
+3  2345 75 2347
+3  71 2328 2131
+3  70 2330 2328
+3  72 2131 2330
+3  2131 2328 2330
+3  2316 6638 2338
+3  2338 68 2316
+3  2313 6638 2316
+3  2316 67 2313
+3  2403 6638 2313
+3  2313 66 2403
+3  2338 6638 2403
+3  2403 69 2338
+3  64 2310 2320
+3  63 2315 2310
+3  65 2320 2315
+3  2320 2310 2315
+3  2308 6639 2447
+3  2447 45 2308
+3  62 2324 6639
+3  6639 2308 62
+3  61 2319 6639
+3  6639 2324 61
+3  2447 6639 2319
+3  2319 132 2447
+3  59 2306 6640
+3  6640 2309 59
+3  46 2448 6640
+3  6640 2306 46
+3  2312 6640 2448
+3  2448 129 2312
+3  60 2309 6640
+3  6640 2312 60
+3  58 2352 2365
+3  735 2449 2352
+3  736 2365 2449
+3  2365 2352 2449
+3  56 2424 6641
+3  6641 2376 56
+3  734 2450 6641
+3  6641 2424 734
+3  733 2358 6641
+3  6641 2450 733
+3  2376 6641 2358
+3  2358 57 2376
+3  2439 6642 2293
+3  2293 51 2439
+3  130 2451 6642
+3  6642 2439 130
+3  216 2442 6642
+3  6642 2451 216
+3  2293 6642 2442
+3  2442 52 2293
+3  2452 6643 2455
+3  2455 214 2452
+3  2453 6643 2452
+3  2452 211 2453
+3  2454 6643 2453
+3  2453 151 2454
+3  2455 6643 2454
+3  2454 146 2455
+3  209 2456 6644
+3  6644 2459 209
+3  212 2457 6644
+3  6644 2456 212
+3  2458 6644 2457
+3  2457 215 2458
+3  149 2459 6644
+3  6644 2458 149
+3  150 2460 6645
+3  6645 2463 150
+3  154 2461 6645
+3  6645 2460 154
+3  2462 6645 2461
+3  2461 200 2462
+3  147 2463 6645
+3  6645 2462 147
+3  153 2464 6646
+3  6646 2467 153
+3  203 2465 6646
+3  6646 2464 203
+3  2466 6646 2465
+3  2465 206 2466
+3  201 2467 6646
+3  6646 2466 201
+3  169 2468 2470
+3  152 2469 2468
+3  210 2470 2469
+3  2470 2468 2469
+3  2471 6647 2474
+3  2474 148 2471
+3  183 2472 6647
+3  6647 2471 183
+3  157 2473 6647
+3  6647 2472 157
+3  2474 6647 2473
+3  2473 207 2474
+3  170 2475 2477
+3  213 2476 2475
+3  208 2477 2476
+3  2477 2475 2476
+3  190 2478 2479
+3  160 2229 2478
+3  136 2479 2229
+3  2479 2478 2229
+3  193 2480 2482
+3  173 2481 2480
+3  204 2482 2481
+3  2482 2480 2481
+3  163 2483 6648
+3  6648 2486 163
+3  194 2484 6648
+3  6648 2483 194
+3  191 2485 6648
+3  6648 2484 191
+3  2486 6648 2485
+3  2485 162 2486
+3  2487 6649 2490
+3  2490 188 2487
+3  2488 6649 2487
+3  2487 195 2488
+3  2489 6649 2488
+3  2488 164 2489
+3  2490 6649 2489
+3  2489 161 2490
+3  199 2491 6650
+3  6650 2494 199
+3  175 2492 6650
+3  6650 2491 175
+3  2493 6650 2492
+3  2492 178 2493
+3  145 2494 6650
+3  6650 2493 145
+3  176 2495 2497
+3  198 2496 2495
+3  165 2497 2496
+3  2497 2495 2496
+3  2498 6651 2501
+3  2501 177 2498
+3  180 2499 6651
+3  6651 2498 180
+3  185 2500 6651
+3  6651 2499 185
+3  2501 6651 2500
+3  2500 167 2501
+3  196 2502 2504
+3  187 2503 2502
+3  197 2504 2503
+3  2504 2502 2503
+3  2505 6652 2508
+3  2508 139 2505
+3  2506 6652 2505
+3  2505 138 2506
+3  2507 6652 2506
+3  2506 186 2507
+3  2508 6652 2507
+3  2507 179 2508
+3  1927 2509 6653
+3  6653 2512 1927
+3  2063 2510 6653
+3  6653 2509 2063
+3  2511 6653 2510
+3  2510 1931 2511
+3  2512 6653 2511
+3  2511 171 2512
+3  2513 6654 2516
+3  2516 174 2513
+3  205 2514 6654
+3  6654 2513 205
+3  202 2515 6654
+3  6654 2514 202
+3  2516 6654 2515
+3  2515 172 2516
+3  46 2517 2518
+3  214 2455 2517
+3  146 2518 2455
+3  2518 2517 2455
+3  149 2458 2520
+3  215 2519 2458
+3  45 2520 2519
+3  2520 2458 2519
+3  147 2521 6655
+3  6655 2463 147
+3  146 2454 6655
+3  6655 2521 146
+3  2522 6655 2454
+3  2454 151 2522
+3  150 2463 6655
+3  6655 2522 150
+3  147 2462 2524
+3  200 2523 2462
+3  129 2524 2523
+3  2524 2462 2523
+3  154 2525 6656
+3  6656 2461 154
+3  153 2467 6656
+3  6656 2525 153
+3  201 2526 6656
+3  6656 2467 201
+3  2461 6656 2526
+3  2526 200 2461
+3  2527 6657 2460
+3  2460 150 2527
+3  152 2528 6657
+3  6657 2527 152
+3  155 2529 6657
+3  6657 2528 155
+3  2460 6657 2529
+3  2529 154 2460
+3  132 2530 2531
+3  183 2471 2530
+3  148 2531 2471
+3  2531 2530 2471
+3  2532 6658 2469
+3  2469 152 2532
+3  151 2453 6658
+3  6658 2532 151
+3  211 2533 6658
+3  6658 2453 211
+3  210 2469 6658
+3  6658 2533 210
+3  212 2534 6659
+3  6659 2457 212
+3  211 2452 6659
+3  6659 2534 211
+3  214 2535 6659
+3  6659 2452 214
+3  2457 6659 2535
+3  2535 215 2457
+3  149 2536 6660
+3  6660 2459 149
+3  148 2474 6660
+3  6660 2536 148
+3  2537 6660 2474
+3  2474 207 2537
+3  209 2459 6660
+3  6660 2537 209
+3  2538 6661 2456
+3  2456 209 2538
+3  208 2476 6661
+3  6661 2538 208
+3  213 2539 6661
+3  6661 2476 213
+3  2456 6661 2539
+3  2539 212 2456
+3  2540 6662 2178
+3  2178 158 2540
+3  157 2472 6662
+3  6662 2540 157
+3  183 2541 6662
+3  6662 2472 183
+3  184 2178 6662
+3  6662 2541 184
+3  2542 6663 2473
+3  2473 157 2542
+3  159 2543 6663
+3  6663 2542 159
+3  2544 6663 2543
+3  2543 208 2544
+3  207 2473 6663
+3  6663 2544 207
+3  2545 6664 2475
+3  2475 170 2545
+3  169 2470 6664
+3  6664 2545 169
+3  210 2546 6664
+3  6664 2470 210
+3  213 2475 6664
+3  6664 2546 213
+3  2547 6665 2549
+3  2549 169 2547
+3  2478 6665 2547
+3  2547 160 2478
+3  190 2548 6665
+3  6665 2478 190
+3  189 2549 6665
+3  6665 2548 189
+3  156 2550 6666
+3  6666 2553 156
+3  155 2551 6666
+3  6666 2550 155
+3  189 2552 6666
+3  6666 2551 189
+3  2553 6666 2552
+3  2552 192 2553
+3  192 2554 6667
+3  6667 2556 192
+3  191 2484 6667
+3  6667 2554 191
+3  194 2555 6667
+3  6667 2484 194
+3  2556 6667 2555
+3  2555 193 2556
+3  2557 6668 2479
+3  2479 136 2557
+3  2485 6668 2557
+3  2557 162 2485
+3  191 2558 6668
+3  6668 2485 191
+3  190 2479 6668
+3  6668 2558 190
+3  2559 6669 2486
+3  2486 162 2559
+3  2489 6669 2559
+3  2559 161 2489
+3  164 2560 6669
+3  6669 2489 164
+3  163 2486 6669
+3  6669 2560 163
+3  163 2561 6670
+3  6670 2483 163
+3  1682 2562 6670
+3  6670 2561 1682
+3  2065 2563 6670
+3  6670 2562 2065
+3  2483 6670 2563
+3  2563 194 2483
+3  2564 6671 2494
+3  2494 145 2564
+3  1679 2565 6671
+3  6671 2564 1679
+3  2071 2566 6671
+3  6671 2565 2071
+3  199 2494 6671
+3  6671 2566 199
+3  2567 6672 2569
+3  2569 1687 2567
+3  165 2496 6672
+3  6672 2567 165
+3  198 2568 6672
+3  6672 2496 198
+3  2569 6672 2568
+3  2568 2072 2569
+3  1677 2570 6673
+3  6673 2573 1677
+3  144 2571 6673
+3  6673 2570 144
+3  2572 6673 2571
+3  2571 165 2572
+3  1688 2573 6673
+3  6673 2572 1688
+3  167 2574 6674
+3  6674 2501 167
+3  166 2575 6674
+3  6674 2574 166
+3  178 2576 6674
+3  6674 2575 178
+3  2501 6674 2576
+3  2576 177 2501
+3  2577 6675 2580
+3  2580 1680 2577
+3  2578 6675 2577
+3  2577 145 2578
+3  166 2579 6675
+3  6675 2578 166
+3  1704 2580 6675
+3  6675 2579 1704
+3  142 2581 2582
+3  178 2492 2581
+3  175 2582 2492
+3  2582 2581 2492
+3  176 2583 6676
+3  6676 2495 176
+3  175 2491 6676
+3  6676 2583 175
+3  199 2584 6676
+3  6676 2491 199
+3  2495 6676 2584
+3  2584 198 2495
+3  176 2585 2587
+3  181 2586 2585
+3  168 2587 2586
+3  2587 2585 2586
+3  144 2588 6677
+3  6677 2591 144
+3  143 2589 6677
+3  6677 2588 143
+3  182 2590 6677
+3  6677 2589 182
+3  2591 6677 2590
+3  2590 181 2591
+3  135 2592 2593
+3  188 2490 2592
+3  161 2593 2490
+3  2593 2592 2490
+3  182 2594 2596
+3  187 2595 2594
+3  137 2596 2595
+3  2596 2594 2595
+3  1703 2597 6678
+3  6678 2599 1703
+3  167 2500 6678
+3  6678 2597 167
+3  185 2598 6678
+3  6678 2500 185
+3  2599 6678 2598
+3  2598 2000 2599
+3  138 2600 6679
+3  6679 2506 138
+3  1396 2601 6679
+3  6679 2600 1396
+3  2001 2602 6679
+3  6679 2601 2001
+3  2506 6679 2602
+3  2602 186 2506
+3  139 2508 2604
+3  179 2603 2508
+3  140 2604 2603
+3  2604 2508 2603
+3  141 2605 2606
+3  180 2498 2605
+3  177 2606 2498
+3  2606 2605 2498
+3  180 2607 6680
+3  6680 2499 180
+3  179 2507 6680
+3  6680 2607 179
+3  186 2608 6680
+3  6680 2507 186
+3  2499 6680 2608
+3  2608 185 2499
+3  47 2609 2610
+3  205 2513 2609
+3  174 2610 2513
+3  2610 2609 2513
+3  201 2466 2612
+3  206 2611 2466
+3  133 2612 2611
+3  2612 2466 2611
+3  2613 6681 2465
+3  2465 203 2613
+3  202 2514 6681
+3  6681 2613 202
+3  205 2614 6681
+3  6681 2514 205
+3  206 2465 6681
+3  6681 2614 206
+3  153 2615 6682
+3  6682 2464 153
+3  156 2616 6682
+3  6682 2615 156
+3  204 2617 6682
+3  6682 2616 204
+3  2464 6682 2617
+3  2617 203 2464
+3  172 2618 6683
+3  6683 2516 172
+3  171 2511 6683
+3  6683 2618 171
+3  1931 2619 6683
+3  6683 2511 1931
+3  2516 6683 2619
+3  2619 174 2516
+3  2620 6684 2622
+3  2622 1928 2620
+3  1927 2512 6684
+3  6684 2620 1927
+3  171 2621 6684
+3  6684 2512 171
+3  2622 6684 2621
+3  2621 1930 2622
+3  1930 2623 6685
+3  6685 2625 1930
+3  173 2480 6685
+3  6685 2623 173
+3  193 2624 6685
+3  6685 2480 193
+3  2625 6685 2624
+3  2624 2066 2625
+3  173 2626 6686
+3  6686 2481 173
+3  172 2515 6686
+3  6686 2626 172
+3  2627 6686 2515
+3  2515 202 2627
+3  2481 6686 2627
+3  2627 204 2481
+3  188 2628 6687
+3  6687 2487 188
+3  187 2502 6687
+3  6687 2628 187
+3  2629 6687 2502
+3  2502 196 2629
+3  2487 6687 2629
+3  2629 195 2487
+3  1681 2630 6688
+3  6688 2632 1681
+3  164 2488 6688
+3  6688 2630 164
+3  195 2631 6688
+3  6688 2488 195
+3  2632 6688 2631
+3  2631 2068 2632
+3  2067 2633 6689
+3  6689 2635 2067
+3  196 2504 6689
+3  6689 2633 196
+3  2634 6689 2504
+3  2504 197 2634
+3  2069 2635 6689
+3  6689 2634 2069
+3  143 2636 6690
+3  6690 2639 143
+3  1678 2637 6690
+3  6690 2636 1678
+3  2638 6690 2637
+3  2637 2070 2638
+3  197 2639 6690
+3  6690 2638 197
+3  2503 6691 2639
+3  2639 197 2503
+3  2594 6691 2503
+3  2503 187 2594
+3  182 2589 6691
+3  6691 2594 182
+3  143 2639 6691
+3  6691 2589 143
+3  2497 6692 2585
+3  2585 176 2497
+3  2571 6692 2497
+3  2497 165 2571
+3  2591 6692 2571
+3  2571 144 2591
+3  181 2585 6692
+3  6692 2591 181
+3  178 2575 2493
+3  166 2578 2575
+3  145 2493 2578
+3  2493 2575 2578
+3  208 2543 2477
+3  159 2196 2543
+3  170 2477 2196
+3  2477 2543 2196
+3  2468 6693 2528
+3  2528 152 2468
+3  2549 6693 2468
+3  2468 169 2549
+3  189 2551 6693
+3  6693 2549 189
+3  155 2528 6693
+3  6693 2551 155
+3  2482 6694 2556
+3  2556 193 2482
+3  204 2616 6694
+3  6694 2482 204
+3  156 2553 6694
+3  6694 2616 156
+3  192 2556 6694
+3  6694 2553 192
+3  2428 6695 2517
+3  2517 46 2428
+3  45 2519 6695
+3  6695 2428 45
+3  2535 6695 2519
+3  2519 215 2535
+3  214 2517 6695
+3  6695 2535 214
+3  211 2534 6696
+3  6696 2533 211
+3  212 2539 6696
+3  6696 2534 212
+3  2546 6696 2539
+3  2539 213 2546
+3  2533 6696 2546
+3  2546 210 2533
+3  209 2537 2538
+3  207 2544 2537
+3  208 2538 2544
+3  2538 2537 2544
+3  2429 6697 2609
+3  2609 47 2429
+3  2611 6697 2429
+3  2429 133 2611
+3  206 2614 6697
+3  6697 2611 206
+3  205 2609 6697
+3  6697 2614 205
+3  204 2627 2617
+3  202 2613 2627
+3  203 2617 2613
+3  2617 2627 2613
+3  2526 6698 2523
+3  2523 200 2526
+3  2612 6698 2526
+3  2526 201 2612
+3  2430 6698 2612
+3  2612 133 2430
+3  2523 6698 2430
+3  2430 129 2523
+3  2568 6699 2640
+3  2640 2072 2568
+3  198 2584 6699
+3  6699 2568 198
+3  2566 6699 2584
+3  2584 199 2566
+3  2071 2640 6699
+3  6699 2566 2071
+3  2070 2641 2638
+3  2069 2634 2641
+3  197 2638 2634
+3  2638 2641 2634
+3  2631 6700 2642
+3  2642 2068 2631
+3  195 2629 6700
+3  6700 2631 195
+3  196 2633 6700
+3  6700 2629 196
+3  2067 2642 6700
+3  6700 2633 2067
+3  2624 6701 2643
+3  2643 2066 2624
+3  2555 6701 2624
+3  2624 193 2555
+3  2563 6701 2555
+3  2555 194 2563
+3  2065 2643 6701
+3  6701 2563 2065
+3  190 2558 6702
+3  6702 2548 190
+3  2554 6702 2558
+3  2558 191 2554
+3  2552 6702 2554
+3  2554 192 2552
+3  2548 6702 2552
+3  2552 189 2548
+3  2595 6703 2238
+3  2238 137 2595
+3  187 2628 6703
+3  6703 2595 187
+3  188 2592 6703
+3  6703 2628 188
+3  2238 6703 2592
+3  2592 135 2238
+3  2608 6704 2598
+3  2598 185 2608
+3  186 2602 6704
+3  6704 2608 186
+3  2001 2644 6704
+3  6704 2602 2001
+3  2000 2598 6704
+3  6704 2644 2000
+3  2436 6705 2530
+3  2530 132 2436
+3  131 2184 6705
+3  6705 2436 131
+3  184 2541 6705
+3  6705 2184 184
+3  183 2530 6705
+3  6705 2541 183
+3  2590 6706 2586
+3  2586 181 2590
+3  2596 6706 2590
+3  2590 182 2596
+3  137 2223 6706
+3  6706 2596 137
+3  2586 6706 2223
+3  2223 168 2586
+3  179 2607 6707
+3  6707 2603 179
+3  180 2605 6707
+3  6707 2607 180
+3  2232 6707 2605
+3  2605 141 2232
+3  2603 6707 2232
+3  2232 140 2603
+3  1396 2600 6708
+3  6708 2646 1396
+3  138 2645 6708
+3  6708 2600 138
+3  130 2438 6708
+3  6708 2645 130
+3  2646 6708 2438
+3  2438 2103 2646
+3  2606 6709 2230
+3  2230 141 2606
+3  2576 6709 2606
+3  2606 177 2576
+3  2581 6709 2576
+3  2576 178 2581
+3  2230 6709 2581
+3  2581 142 2230
+3  2583 6710 2582
+3  2582 175 2583
+3  2587 6710 2583
+3  2583 176 2587
+3  2227 6710 2587
+3  2587 168 2227
+3  2582 6710 2227
+3  2227 142 2582
+3  2610 6711 2440
+3  2440 47 2610
+3  2619 6711 2610
+3  2610 174 2619
+3  1931 2647 6711
+3  6711 2619 1931
+3  2440 6711 2647
+3  2647 1138 2440
+3  172 2626 6712
+3  6712 2618 172
+3  173 2623 6712
+3  6712 2626 173
+3  1930 2621 6712
+3  6712 2623 1930
+3  2618 6712 2621
+3  2621 171 2618
+3  2234 6713 2604
+3  2604 140 2234
+3  2443 6713 2234
+3  2234 134 2443
+3  2648 6713 2443
+3  2443 216 2648
+3  2604 6713 2648
+3  2648 139 2604
+3  160 2547 2217
+3  169 2545 2547
+3  170 2217 2545
+3  2217 2547 2545
+3  1704 2579 6714
+3  6714 2649 1704
+3  166 2574 6714
+3  6714 2579 166
+3  167 2597 6714
+3  6714 2574 167
+3  2649 6714 2597
+3  2597 1703 2649
+3  1688 2572 2650
+3  165 2567 2572
+3  1687 2650 2567
+3  2650 2572 2567
+3  164 2630 6715
+3  6715 2560 164
+3  1681 2651 6715
+3  6715 2630 1681
+3  1682 2561 6715
+3  6715 2651 1682
+3  2560 6715 2561
+3  2561 163 2560
+3  2593 6716 2239
+3  2239 135 2593
+3  161 2559 6716
+3  6716 2593 161
+3  162 2557 6716
+3  6716 2559 162
+3  136 2239 6716
+3  6716 2557 136
+3  159 2542 2199
+3  157 2540 2542
+3  158 2199 2540
+3  2199 2542 2540
+3  2529 6717 2525
+3  2525 154 2529
+3  2550 6717 2529
+3  2529 155 2550
+3  2615 6717 2550
+3  2550 156 2615
+3  2525 6717 2615
+3  2615 153 2525
+3  152 2527 2532
+3  150 2522 2527
+3  151 2532 2522
+3  2532 2527 2522
+3  2520 6718 2536
+3  2536 149 2520
+3  2447 6718 2520
+3  2520 45 2447
+3  132 2531 6718
+3  6718 2447 132
+3  148 2536 6718
+3  6718 2531 148
+3  2518 6719 2448
+3  2448 46 2518
+3  146 2521 6719
+3  6719 2518 146
+3  147 2524 6719
+3  6719 2521 147
+3  2448 6719 2524
+3  2524 129 2448
+3  1680 2652 2577
+3  1679 2564 2652
+3  145 2577 2564
+3  2577 2652 2564
+3  1678 2636 6720
+3  6720 2653 1678
+3  2588 6720 2636
+3  2636 143 2588
+3  144 2570 6720
+3  6720 2588 144
+3  1677 2653 6720
+3  6720 2570 1677
+3  130 2645 6721
+3  6721 2451 130
+3  138 2505 6721
+3  6721 2645 138
+3  139 2648 6721
+3  6721 2505 139
+3  2451 6721 2648
+3  2648 216 2451
+3  1165 2654 6722
+3  6722 2657 1165
+3  282 2655 6722
+3  6722 2654 282
+3  270 2656 6722
+3  6722 2655 270
+3  2657 6722 2656
+3  2656 1164 2657
+3  2090 2658 6723
+3  6723 2661 2090
+3  284 2659 6723
+3  6723 2658 284
+3  283 2660 6723
+3  6723 2659 283
+3  2661 6723 2660
+3  2660 224 2661
+3  269 2662 6724
+3  6724 2664 269
+3  270 2655 6724
+3  6724 2662 270
+3  282 2663 6724
+3  6724 2655 282
+3  2664 6724 2663
+3  2663 278 2664
+3  275 2665 6725
+3  6725 2667 275
+3  283 2659 6725
+3  6725 2665 283
+3  284 2666 6725
+3  6725 2659 284
+3  2667 6725 2666
+3  2666 274 2667
+3  266 2668 6726
+3  6726 2671 266
+3  268 2669 6726
+3  6726 2668 268
+3  279 2670 6726
+3  6726 2669 279
+3  2671 6726 2670
+3  2670 267 2671
+3  252 2672 6727
+3  6727 2675 252
+3  276 2673 6727
+3  6727 2672 276
+3  277 2674 6727
+3  6727 2673 277
+3  2675 6727 2674
+3  2674 251 2675
+3  276 2672 6728
+3  6728 2677 276
+3  252 2676 6728
+3  6728 2672 252
+3  2670 6728 2676
+3  2676 267 2670
+3  279 2677 6728
+3  6728 2670 279
+3  275 2678 6729
+3  6729 2665 275
+3  278 2663 6729
+3  6729 2678 278
+3  2679 6729 2663
+3  2663 282 2679
+3  2665 6729 2679
+3  2679 283 2665
+3  2679 6730 2660
+3  2660 283 2679
+3  282 2654 6730
+3  6730 2679 282
+3  1165 2680 6730
+3  6730 2654 1165
+3  224 2660 6730
+3  6730 2680 224
+3  1146 2681 6731
+3  6731 2684 1146
+3  223 2682 6731
+3  6731 2681 223
+3  281 2683 6731
+3  6731 2682 281
+3  2684 6731 2683
+3  2683 280 2684
+3  2683 6732 2687
+3  2687 280 2683
+3  281 2685 6732
+3  6732 2683 281
+3  253 2686 6732
+3  6732 2685 253
+3  2687 6732 2686
+3  2686 273 2687
+3  254 2688 6733
+3  6733 2691 254
+3  258 2689 6733
+3  6733 2688 258
+3  2690 6733 2689
+3  2689 265 2690
+3  272 2691 6733
+3  6733 2690 272
+3  258 2688 2693
+3  254 2692 2688
+3  257 2693 2692
+3  2693 2688 2692
+3  255 2694 6734
+3  6734 2696 255
+3  253 2685 6734
+3  6734 2694 253
+3  281 2695 6734
+3  6734 2685 281
+3  2696 6734 2695
+3  2695 271 2696
+3  2695 6735 2698
+3  2698 271 2695
+3  2682 6735 2695
+3  2695 281 2682
+3  223 2697 6735
+3  6735 2682 223
+3  1163 2698 6735
+3  6735 2697 1163
+3  260 2699 6736
+3  6736 2701 260
+3  280 2687 6736
+3  6736 2699 280
+3  273 2700 6736
+3  6736 2687 273
+3  2701 6736 2700
+3  2700 262 2701
+3  222 2702 6737
+3  6737 2703 222
+3  1146 2684 6737
+3  6737 2702 1146
+3  280 2699 6737
+3  6737 2684 280
+3  2703 6737 2699
+3  2699 260 2703
+3  268 2704 6738
+3  6738 2669 268
+3  269 2664 6738
+3  6738 2704 269
+3  278 2705 6738
+3  6738 2664 278
+3  2669 6738 2705
+3  2705 279 2669
+3  2705 6739 2677
+3  2677 279 2705
+3  278 2678 6739
+3  6739 2705 278
+3  275 2706 6739
+3  6739 2678 275
+3  2677 6739 2706
+3  2706 276 2677
+3  2706 6740 2673
+3  2673 276 2706
+3  2667 6740 2706
+3  2706 275 2667
+3  274 2707 6740
+3  6740 2667 274
+3  277 2673 6740
+3  6740 2707 277
+3  255 2708 2709
+3  257 2692 2708
+3  254 2709 2692
+3  2709 2708 2692
+3  272 2710 6741
+3  6741 2691 272
+3  273 2686 6741
+3  6741 2710 273
+3  2711 6741 2686
+3  2686 253 2711
+3  254 2691 6741
+3  6741 2711 254
+3  2712 6742 2710
+3  2710 272 2712
+3  264 2713 6742
+3  6742 2712 264
+3  262 2700 6742
+3  6742 2713 262
+3  2710 6742 2700
+3  2700 273 2710
+3  264 2712 2714
+3  272 2690 2712
+3  265 2714 2690
+3  2714 2712 2690
+3  1163 2715 6743
+3  6743 2698 1163
+3  1164 2656 6743
+3  6743 2715 1164
+3  2716 6743 2656
+3  2656 270 2716
+3  2698 6743 2716
+3  2716 271 2698
+3  2716 6744 2696
+3  2696 271 2716
+3  270 2662 6744
+3  6744 2716 270
+3  269 2717 6744
+3  6744 2662 269
+3  255 2696 6744
+3  6744 2717 255
+3  2717 6745 2708
+3  2708 255 2717
+3  2704 6745 2717
+3  2717 269 2704
+3  2718 6745 2704
+3  2704 268 2718
+3  257 2708 6745
+3  6745 2718 257
+3  2668 6746 2718
+3  2718 268 2668
+3  266 2719 6746
+3  6746 2668 266
+3  256 2720 6746
+3  6746 2719 256
+3  2718 6746 2720
+3  2720 257 2718
+3  1145 2721 6747
+3  6747 2724 1145
+3  2089 2722 6747
+3  6747 2721 2089
+3  259 2723 6747
+3  6747 2722 259
+3  2724 6747 2723
+3  2723 248 2724
+3  2723 6748 2727
+3  2727 248 2723
+3  259 2725 6748
+3  6748 2723 259
+3  261 2726 6748
+3  6748 2725 261
+3  2727 6748 2726
+3  2726 247 2727
+3  2726 6749 2730
+3  2730 247 2726
+3  261 2728 6749
+3  6749 2726 261
+3  263 2729 6749
+3  6749 2728 263
+3  2730 6749 2729
+3  2729 244 2730
+3  246 2731 2732
+3  244 2729 2731
+3  263 2732 2729
+3  2732 2731 2729
+3  2733 6750 2676
+3  2676 252 2733
+3  2734 6750 2733
+3  2733 233 2734
+3  2735 6750 2734
+3  2734 234 2735
+3  2676 6750 2735
+3  2735 267 2676
+3  2735 6751 2671
+3  2671 267 2735
+3  234 2736 6751
+3  6751 2735 234
+3  236 2737 6751
+3  6751 2736 236
+3  266 2671 6751
+3  6751 2737 266
+3  2737 6752 2719
+3  2719 266 2737
+3  236 2738 6752
+3  6752 2737 236
+3  238 2739 6752
+3  6752 2738 238
+3  256 2719 6752
+3  6752 2739 256
+3  2739 6753 2742
+3  2742 256 2739
+3  238 2740 6753
+3  6753 2739 238
+3  240 2741 6753
+3  6753 2740 240
+3  258 2742 6753
+3  6753 2741 258
+3  2741 6754 2689
+3  2689 258 2741
+3  240 2743 6754
+3  6754 2741 240
+3  242 2744 6754
+3  6754 2743 242
+3  265 2689 6754
+3  6754 2744 265
+3  2732 6755 2746
+3  2746 246 2732
+3  263 2745 6755
+3  6755 2732 263
+3  264 2714 6755
+3  6755 2745 264
+3  2744 6755 2714
+3  2714 265 2744
+3  2746 6755 2744
+3  2744 242 2746
+3  264 2745 6756
+3  6756 2713 264
+3  263 2728 6756
+3  6756 2745 263
+3  261 2747 6756
+3  6756 2728 261
+3  2713 6756 2747
+3  2747 262 2713
+3  2747 6757 2701
+3  2701 262 2747
+3  2725 6757 2747
+3  2747 261 2725
+3  2748 6757 2725
+3  2725 259 2748
+3  260 2701 6757
+3  6757 2748 260
+3  2748 6758 2703
+3  2703 260 2748
+3  259 2722 6758
+3  6758 2748 259
+3  2089 2749 6758
+3  6758 2722 2089
+3  222 2703 6758
+3  6758 2749 222
+3  257 2720 2693
+3  256 2742 2720
+3  258 2693 2742
+3  2693 2720 2742
+3  254 2711 2709
+3  253 2694 2711
+3  255 2709 2694
+3  2709 2711 2694
+3  2733 6759 2751
+3  2751 233 2733
+3  252 2675 6759
+3  6759 2733 252
+3  251 2750 6759
+3  6759 2675 251
+3  250 2751 6759
+3  6759 2750 250
+3  245 2752 2753
+3  247 2730 2752
+3  244 2753 2730
+3  2753 2752 2730
+3  243 2754 2755
+3  246 2746 2754
+3  242 2755 2746
+3  2755 2754 2746
+3  232 2756 2757
+3  233 2751 2756
+3  250 2757 2751
+3  2757 2756 2751
+3  1145 2724 6760
+3  6760 2760 1145
+3  248 2758 6760
+3  6760 2724 248
+3  249 2759 6760
+3  6760 2758 249
+3  2760 6760 2759
+3  2759 1144 2760
+3  248 2727 6761
+3  6761 2758 248
+3  247 2752 6761
+3  6761 2727 247
+3  2761 6761 2752
+3  2752 245 2761
+3  249 2758 6761
+3  6761 2761 249
+3  2762 6762 2754
+3  2754 243 2762
+3  2753 6762 2762
+3  2762 245 2753
+3  2731 6762 2753
+3  2753 244 2731
+3  246 2754 6762
+3  6762 2731 246
+3  242 2743 6763
+3  6763 2755 242
+3  240 2763 6763
+3  6763 2743 240
+3  241 2764 6763
+3  6763 2763 241
+3  2755 6763 2764
+3  2764 243 2755
+3  2740 6764 2763
+3  2763 240 2740
+3  2765 6764 2740
+3  2740 238 2765
+3  2766 6764 2765
+3  2765 239 2766
+3  2763 6764 2766
+3  2766 241 2763
+3  238 2738 6765
+3  6765 2765 238
+3  236 2767 6765
+3  6765 2738 236
+3  237 2768 6765
+3  6765 2767 237
+3  2765 6765 2768
+3  2768 239 2765
+3  2736 6766 2767
+3  2767 236 2736
+3  234 2769 6766
+3  6766 2736 234
+3  235 2770 6766
+3  6766 2769 235
+3  237 2767 6766
+3  6766 2770 237
+3  234 2734 6767
+3  6767 2769 234
+3  233 2756 6767
+3  6767 2734 233
+3  2771 6767 2756
+3  2756 232 2771
+3  235 2769 6767
+3  6767 2771 235
+3  301 2772 6768
+3  6768 2776 301
+3  302 2773 6768
+3  6768 2772 302
+3  2774 6768 2773
+3  2773 308 2774
+3  2775 6768 2774
+3  2774 309 2775
+3  2776 6768 2775
+3  2775 310 2776
+3  311 2777 2779
+3  298 2778 2777
+3  299 2779 2778
+3  2779 2777 2778
+3  298 2777 6769
+3  6769 2782 298
+3  311 2780 6769
+3  6769 2777 311
+3  290 2781 6769
+3  6769 2780 290
+3  2782 6769 2781
+3  2781 288 2782
+3  289 2783 6770
+3  6770 2786 289
+3  291 2784 6770
+3  6770 2783 291
+3  1168 2785 6770
+3  6770 2784 1168
+3  2786 6770 2785
+3  2785 1169 2786
+3  229 2787 2789
+3  293 2788 2787
+3  1149 2789 2788
+3  2789 2787 2788
+3  287 2790 6771
+3  6771 2792 287
+3  289 2786 6771
+3  6771 2790 289
+3  2791 6771 2786
+3  2786 1169 2791
+3  2792 6771 2791
+3  2791 2096 2792
+3  296 2793 6772
+3  6772 2796 296
+3  305 2794 6772
+3  6772 2793 305
+3  2795 6772 2794
+3  2794 304 2795
+3  2796 6772 2795
+3  2795 299 2796
+3  301 2797 6773
+3  6773 2798 301
+3  311 2779 6773
+3  6773 2797 311
+3  2795 6773 2779
+3  2779 299 2795
+3  304 2798 6773
+3  6773 2795 304
+3  2799 6774 2776
+3  2776 310 2799
+3  2780 6774 2799
+3  2799 290 2780
+3  2797 6774 2780
+3  2780 311 2797
+3  2776 6774 2797
+3  2797 301 2776
+3  2800 6775 2775
+3  2775 309 2800
+3  2801 6775 2800
+3  2800 292 2801
+3  2799 6775 2801
+3  2801 290 2799
+3  310 2775 6775
+3  6775 2799 310
+3  2802 6776 2774
+3  2774 308 2802
+3  294 2803 6776
+3  6776 2802 294
+3  292 2800 6776
+3  6776 2803 292
+3  309 2774 6776
+3  6776 2800 309
+3  302 2804 6777
+3  6777 2773 302
+3  307 2805 6777
+3  6777 2804 307
+3  2802 6777 2805
+3  2805 294 2802
+3  2773 6777 2802
+3  2802 308 2773
+3  307 2804 6778
+3  6778 2808 307
+3  302 2806 6778
+3  6778 2804 302
+3  2807 6778 2806
+3  2806 303 2807
+3  306 2808 6778
+3  6778 2807 306
+3  303 2809 2807
+3  305 2810 2809
+3  306 2807 2810
+3  2807 2809 2810
+3  305 2809 2794
+3  303 2811 2809
+3  304 2794 2811
+3  2794 2809 2811
+3  2806 6779 2811
+3  2811 303 2806
+3  2772 6779 2806
+3  2806 302 2772
+3  2798 6779 2772
+3  2772 301 2798
+3  304 2811 6779
+3  6779 2798 304
+3  291 2812 6780
+3  6780 2784 291
+3  293 2787 6780
+3  6780 2812 293
+3  2813 6780 2787
+3  2787 229 2813
+3  1168 2784 6780
+3  6780 2813 1168
+3  300 2814 2816
+3  297 2815 2814
+3  298 2816 2815
+3  2816 2814 2815
+3  286 2817 6781
+3  6781 2819 286
+3  287 2792 6781
+3  6781 2817 287
+3  2818 6781 2792
+3  2792 2096 2818
+3  2819 6781 2818
+3  2818 1150 2819
+3  300 2816 6782
+3  6782 2821 300
+3  2782 6782 2816
+3  2816 298 2782
+3  288 2820 6782
+3  6782 2782 288
+3  285 2821 6782
+3  6782 2820 285
+3  2815 6783 2778
+3  2778 298 2815
+3  297 2822 6783
+3  6783 2815 297
+3  296 2796 6783
+3  6783 2822 296
+3  2778 6783 2796
+3  2796 299 2778
+3  2788 6784 2825
+3  2825 1149 2788
+3  293 2823 6784
+3  6784 2788 293
+3  294 2824 6784
+3  6784 2823 294
+3  2825 6784 2824
+3  2824 295 2825
+3  293 2812 6785
+3  6785 2823 293
+3  291 2826 6785
+3  6785 2812 291
+3  292 2803 6785
+3  6785 2826 292
+3  2823 6785 2803
+3  2803 294 2823
+3  2783 6786 2826
+3  2826 291 2783
+3  2827 6786 2783
+3  2783 289 2827
+3  2801 6786 2827
+3  2827 290 2801
+3  292 2826 6786
+3  6786 2801 292
+3  289 2790 6787
+3  6787 2827 289
+3  287 2828 6787
+3  6787 2790 287
+3  288 2781 6787
+3  6787 2828 288
+3  2827 6787 2781
+3  2781 290 2827
+3  2817 6788 2828
+3  2828 287 2817
+3  286 2829 6788
+3  6788 2817 286
+3  285 2820 6788
+3  6788 2829 285
+3  2828 6788 2820
+3  2820 288 2828
+3  386 2830 6789
+3  6789 2833 386
+3  408 2831 6789
+3  6789 2830 408
+3  2832 6789 2831
+3  2831 397 2832
+3  2833 6789 2832
+3  2832 387 2833
+3  2094 2834 6790
+3  6790 2836 2094
+3  2095 2835 6790
+3  6790 2834 2095
+3  408 2830 6790
+3  6790 2835 408
+3  2836 6790 2830
+3  2830 386 2836
+3  396 2837 6791
+3  6791 2840 396
+3  407 2838 6791
+3  6791 2837 407
+3  2087 2839 6791
+3  6791 2838 2087
+3  2840 6791 2839
+3  2839 220 2840
+3  395 2841 6792
+3  6792 2843 395
+3  406 2842 6792
+3  6792 2841 406
+3  407 2837 6792
+3  6792 2842 407
+3  2843 6792 2837
+3  2837 396 2843
+3  394 2844 6793
+3  6793 2846 394
+3  405 2845 6793
+3  6793 2844 405
+3  406 2841 6793
+3  6793 2845 406
+3  2846 6793 2841
+3  2841 395 2846
+3  393 2847 6794
+3  6794 2849 393
+3  404 2848 6794
+3  6794 2847 404
+3  405 2844 6794
+3  6794 2848 405
+3  2849 6794 2844
+3  2844 394 2849
+3  392 2850 6795
+3  6795 2852 392
+3  403 2851 6795
+3  6795 2850 403
+3  404 2847 6795
+3  6795 2851 404
+3  2852 6795 2847
+3  2847 393 2852
+3  390 2853 6796
+3  6796 2855 390
+3  402 2854 6796
+3  6796 2853 402
+3  403 2850 6796
+3  6796 2854 403
+3  2855 6796 2850
+3  2850 392 2855
+3  391 2856 6797
+3  6797 2858 391
+3  401 2857 6797
+3  6797 2856 401
+3  402 2853 6797
+3  6797 2857 402
+3  2858 6797 2853
+3  2853 390 2858
+3  325 2859 6798
+3  6798 2861 325
+3  324 2860 6798
+3  6798 2859 324
+3  401 2856 6798
+3  6798 2860 401
+3  2861 6798 2856
+3  2856 391 2861
+3  315 2862 6799
+3  6799 2865 315
+3  400 2863 6799
+3  6799 2862 400
+3  323 2864 6799
+3  6799 2863 323
+3  2865 6799 2864
+3  2864 321 2865
+3  312 2866 6800
+3  6800 2868 312
+3  399 2867 6800
+3  6800 2866 399
+3  400 2862 6800
+3  6800 2867 400
+3  2868 6800 2862
+3  2862 315 2868
+3  343 2869 6801
+3  6801 2871 343
+3  344 2870 6801
+3  6801 2869 344
+3  399 2866 6801
+3  6801 2870 399
+3  2871 6801 2866
+3  2866 312 2871
+3  388 2872 6802
+3  6802 2875 388
+3  398 2873 6802
+3  6802 2872 398
+3  335 2874 6802
+3  6802 2873 335
+3  2875 6802 2874
+3  2874 336 2875
+3  330 2876 6803
+3  6803 2878 330
+3  332 2877 6803
+3  6803 2876 332
+3  398 2872 6803
+3  6803 2877 398
+3  2878 6803 2872
+3  2872 388 2878
+3  387 2832 6804
+3  6804 2881 387
+3  397 2879 6804
+3  6804 2832 397
+3  333 2880 6804
+3  6804 2879 333
+3  2881 6804 2880
+3  2880 331 2881
+3  2091 2882 6805
+3  6805 2885 2091
+3  389 2883 6805
+3  6805 2882 389
+3  373 2884 6805
+3  6805 2883 373
+3  2885 6805 2884
+3  2884 1147 2885
+3  1148 2886 6806
+3  6806 2889 1148
+3  225 2887 6806
+3  6806 2886 225
+3  381 2888 6806
+3  6806 2887 381
+3  2889 6806 2888
+3  2888 384 2889
+3  2890 6807 2892
+3  2892 353 2890
+3  2861 6807 2890
+3  2890 325 2861
+3  391 2891 6807
+3  6807 2861 391
+3  355 2892 6807
+3  6807 2891 355
+3  365 2893 6808
+3  6808 2895 365
+3  396 2840 6808
+3  6808 2893 396
+3  2894 6808 2840
+3  2840 220 2894
+3  2895 6808 2894
+3  2894 221 2895
+3  366 2896 6809
+3  6809 2897 366
+3  395 2843 6809
+3  6809 2896 395
+3  2893 6809 2843
+3  2843 396 2893
+3  2897 6809 2893
+3  2893 365 2897
+3  367 2898 6810
+3  6810 2899 367
+3  394 2846 6810
+3  6810 2898 394
+3  2896 6810 2846
+3  2846 395 2896
+3  2899 6810 2896
+3  2896 366 2899
+3  370 2900 6811
+3  6811 2901 370
+3  393 2849 6811
+3  6811 2900 393
+3  2898 6811 2849
+3  2849 394 2898
+3  2901 6811 2898
+3  2898 367 2901
+3  369 2902 6812
+3  6812 2903 369
+3  392 2852 6812
+3  6812 2902 392
+3  2900 6812 2852
+3  2852 393 2900
+3  370 2903 6812
+3  6812 2900 370
+3  368 2904 6813
+3  6813 2905 368
+3  390 2855 6813
+3  6813 2904 390
+3  2902 6813 2855
+3  2855 392 2902
+3  369 2905 6813
+3  6813 2902 369
+3  355 2891 6814
+3  6814 2906 355
+3  391 2858 6814
+3  6814 2891 391
+3  2904 6814 2858
+3  2858 390 2904
+3  368 2906 6814
+3  6814 2904 368
+3  326 2907 2908
+3  325 2890 2907
+3  353 2908 2890
+3  2908 2907 2890
+3  2909 6815 2865
+3  2865 321 2909
+3  2910 6815 2909
+3  2909 317 2910
+3  2911 6815 2910
+3  2910 319 2911
+3  315 2865 6815
+3  6815 2911 315
+3  2912 6816 2914
+3  2914 372 2912
+3  373 2883 6816
+3  6816 2912 373
+3  389 2913 6816
+3  6816 2883 389
+3  385 2914 6816
+3  6816 2913 385
+3  2915 6817 2918
+3  2918 318 2915
+3  2916 6817 2915
+3  2915 371 2916
+3  385 2917 6817
+3  6817 2916 385
+3  319 2918 6817
+3  6817 2917 319
+3  2919 6818 2889
+3  2889 384 2919
+3  2882 6818 2919
+3  2919 389 2882
+3  2091 2920 6818
+3  6818 2882 2091
+3  1148 2889 6818
+3  6818 2920 1148
+3  382 2921 6819
+3  6819 2922 382
+3  2913 6819 2921
+3  2921 385 2913
+3  389 2919 6819
+3  6819 2913 389
+3  384 2922 6819
+3  6819 2919 384
+3  383 2923 6820
+3  6820 2924 383
+3  2917 6820 2923
+3  2923 319 2917
+3  2921 6820 2917
+3  2917 385 2921
+3  382 2924 6820
+3  6820 2921 382
+3  2925 6821 2927
+3  2927 313 2925
+3  2926 6821 2925
+3  2925 314 2926
+3  2923 6821 2926
+3  2926 319 2923
+3  383 2927 6821
+3  6821 2923 383
+3  342 2928 6822
+3  6822 2930 342
+3  343 2871 6822
+3  6822 2928 343
+3  2929 6822 2871
+3  2871 312 2929
+3  313 2930 6822
+3  6822 2929 313
+3  374 2931 6823
+3  6823 2933 374
+3  388 2875 6823
+3  6823 2931 388
+3  2932 6823 2875
+3  2875 336 2932
+3  2933 6823 2932
+3  2932 338 2933
+3  2934 6824 2935
+3  2935 329 2934
+3  2878 6824 2934
+3  2934 330 2878
+3  388 2931 6824
+3  6824 2878 388
+3  374 2935 6824
+3  6824 2931 374
+3  2936 6825 2938
+3  2938 348 2936
+3  2881 6825 2936
+3  2936 387 2881
+3  331 2937 6825
+3  6825 2881 331
+3  327 2938 6825
+3  6825 2937 327
+3  347 2939 6826
+3  6826 2940 347
+3  386 2833 6826
+3  6826 2939 386
+3  387 2936 6826
+3  6826 2833 387
+3  2940 6826 2936
+3  2936 348 2940
+3  1167 2941 6827
+3  6827 2942 1167
+3  2094 2836 6827
+3  6827 2941 2094
+3  2939 6827 2836
+3  2836 386 2939
+3  347 2942 6827
+3  6827 2939 347
+3  2943 6828 2895
+3  2895 221 2943
+3  2944 6828 2943
+3  2943 2088 2944
+3  2945 6828 2944
+3  2944 364 2945
+3  365 2895 6828
+3  6828 2945 365
+3  363 2946 2947
+3  365 2945 2946
+3  364 2947 2945
+3  2947 2946 2945
+3  361 2948 2950
+3  362 2949 2948
+3  366 2950 2949
+3  2950 2948 2949
+3  385 2916 2914
+3  371 2951 2916
+3  372 2914 2951
+3  2914 2916 2951
+3  384 2888 6829
+3  6829 2922 384
+3  381 2952 6829
+3  6829 2888 381
+3  379 2953 6829
+3  6829 2952 379
+3  2922 6829 2953
+3  2953 382 2922
+3  313 2927 2955
+3  383 2954 2927
+3  377 2955 2954
+3  2955 2927 2954
+3  2953 6830 2924
+3  2924 382 2953
+3  379 2956 6830
+3  6830 2953 379
+3  377 2954 6830
+3  6830 2956 377
+3  2924 6830 2954
+3  2954 383 2924
+3  341 2957 2959
+3  340 2958 2957
+3  339 2959 2958
+3  2959 2957 2958
+3  340 2957 6831
+3  6831 2962 340
+3  341 2960 6831
+3  6831 2957 341
+3  378 2961 6831
+3  6831 2960 378
+3  2962 6831 2961
+3  2961 375 2962
+3  2961 6832 2965
+3  2965 375 2961
+3  378 2963 6832
+3  6832 2961 378
+3  380 2964 6832
+3  6832 2963 380
+3  2965 6832 2964
+3  2964 376 2965
+3  2964 6833 2968
+3  2968 376 2964
+3  380 2966 6833
+3  6833 2964 380
+3  1166 2967 6833
+3  6833 2966 1166
+3  2968 6833 2967
+3  2967 2092 2968
+3  225 2969 6834
+3  6834 2887 225
+3  1166 2966 6834
+3  6834 2969 1166
+3  380 2970 6834
+3  6834 2966 380
+3  2887 6834 2970
+3  2970 381 2887
+3  2970 6835 2952
+3  2952 381 2970
+3  2963 6835 2970
+3  2970 380 2963
+3  2971 6835 2963
+3  2963 378 2971
+3  2952 6835 2971
+3  2971 379 2952
+3  379 2971 6836
+3  6836 2956 379
+3  378 2960 6836
+3  6836 2971 378
+3  341 2972 6836
+3  6836 2960 341
+3  2956 6836 2972
+3  2972 377 2956
+3  2972 6837 2955
+3  2955 377 2972
+3  2973 6837 2972
+3  2972 341 2973
+3  342 2930 6837
+3  6837 2973 342
+3  313 2955 6837
+3  6837 2930 313
+3  2933 6838 2976
+3  2976 374 2933
+3  2974 6838 2933
+3  2933 338 2974
+3  340 2975 6838
+3  6838 2974 340
+3  2976 6838 2975
+3  2975 328 2976
+3  350 2977 2979
+3  345 2978 2977
+3  328 2979 2978
+3  2979 2977 2978
+3  345 2977 6839
+3  6839 2982 345
+3  350 2980 6839
+3  6839 2977 350
+3  351 2981 6839
+3  6839 2980 351
+3  2982 6839 2981
+3  2981 346 2982
+3  2981 6840 2985
+3  2985 346 2981
+3  351 2983 6840
+3  6840 2981 351
+3  226 2984 6840
+3  6840 2983 226
+3  2985 6840 2984
+3  2984 227 2985
+3  2092 2986 6841
+3  6841 2968 2092
+3  2093 2987 6841
+3  6841 2986 2093
+3  352 2988 6841
+3  6841 2987 352
+3  2968 6841 2988
+3  2988 376 2968
+3  2988 6842 2965
+3  2965 376 2988
+3  352 2989 6842
+3  6842 2988 352
+3  349 2990 6842
+3  6842 2989 349
+3  375 2965 6842
+3  6842 2990 375
+3  375 2990 6843
+3  6843 2962 375
+3  349 2991 6843
+3  6843 2990 349
+3  2975 6843 2991
+3  2991 328 2975
+3  2962 6843 2975
+3  2975 340 2962
+3  328 2992 2976
+3  329 2935 2992
+3  374 2976 2935
+3  2976 2992 2935
+3  319 2926 2911
+3  314 2993 2926
+3  315 2911 2993
+3  2911 2926 2993
+3  2994 6844 2884
+3  2884 373 2994
+3  2658 6844 2994
+3  2994 284 2658
+3  2090 2995 6844
+3  6844 2658 2090
+3  1147 2884 6844
+3  6844 2995 1147
+3  2996 6845 2912
+3  2912 372 2996
+3  2666 6845 2996
+3  2996 274 2666
+3  284 2994 6845
+3  6845 2666 284
+3  373 2912 6845
+3  6845 2994 373
+3  2997 6846 2951
+3  2951 371 2997
+3  2707 6846 2997
+3  2997 277 2707
+3  274 2996 6846
+3  6846 2707 274
+3  372 2951 6846
+3  6846 2996 372
+3  2997 6847 2674
+3  2674 277 2997
+3  371 2915 6847
+3  6847 2997 371
+3  318 2998 6847
+3  6847 2915 318
+3  2674 6847 2998
+3  2998 251 2674
+3  359 2999 3001
+3  367 3000 2999
+3  360 3001 3000
+3  3001 2999 3000
+3  2999 6848 2901
+3  2901 367 2999
+3  359 3002 6848
+3  6848 2999 359
+3  358 3003 6848
+3  6848 3002 358
+3  370 2901 6848
+3  6848 3003 370
+3  3003 6849 2903
+3  2903 370 3003
+3  358 3004 6849
+3  6849 3003 358
+3  357 3005 6849
+3  6849 3004 357
+3  2903 6849 3005
+3  3005 369 2903
+3  3005 6850 2905
+3  2905 369 3005
+3  357 3006 6850
+3  6850 3005 357
+3  356 3007 6850
+3  6850 3006 356
+3  2905 6850 3007
+3  3007 368 2905
+3  3007 6851 2906
+3  2906 368 3007
+3  356 3008 6851
+3  6851 3007 356
+3  354 3009 6851
+3  6851 3008 354
+3  2906 6851 3009
+3  3009 355 2906
+3  326 2908 3011
+3  353 3010 2908
+3  354 3011 3010
+3  3011 2908 3010
+3  2899 6852 3000
+3  3000 367 2899
+3  2949 6852 2899
+3  2899 366 2949
+3  3012 6852 2949
+3  2949 362 3012
+3  360 3000 6852
+3  6852 3012 360
+3  2897 6853 2950
+3  2950 366 2897
+3  2946 6853 2897
+3  2897 365 2946
+3  3013 6853 2946
+3  2946 363 3013
+3  361 2950 6853
+3  6853 3013 361
+3  318 3014 2998
+3  326 3015 3014
+3  251 2998 3015
+3  2998 3014 3015
+3  316 3016 3017
+3  326 3014 3016
+3  318 3017 3014
+3  3017 3016 3014
+3  251 3015 2750
+3  326 3018 3015
+3  250 2750 3018
+3  2750 3015 3018
+3  245 3019 3020
+3  361 3013 3019
+3  363 3020 3013
+3  3020 3019 3013
+3  243 3021 3022
+3  360 3012 3021
+3  362 3022 3012
+3  3022 3021 3012
+3  2759 6854 3024
+3  3024 1144 2759
+3  249 3023 6854
+3  6854 2759 249
+3  364 2944 6854
+3  6854 3023 364
+3  3024 6854 2944
+3  2944 2088 3024
+3  2761 6855 3023
+3  3023 249 2761
+3  3020 6855 2761
+3  2761 245 3020
+3  2947 6855 3020
+3  3020 363 2947
+3  364 3023 6855
+3  6855 2947 364
+3  2948 6856 3022
+3  3022 362 2948
+3  361 3019 6856
+3  6856 2948 361
+3  245 2762 6856
+3  6856 3019 245
+3  243 3022 6856
+3  6856 2762 243
+3  2764 6857 3021
+3  3021 243 2764
+3  241 3025 6857
+3  6857 2764 241
+3  359 3001 6857
+3  6857 3025 359
+3  360 3021 6857
+3  6857 3001 360
+3  241 2766 6858
+3  6858 3025 241
+3  239 3026 6858
+3  6858 2766 239
+3  358 3002 6858
+3  6858 3026 358
+3  3025 6858 3002
+3  3002 359 3025
+3  239 2768 6859
+3  6859 3026 239
+3  237 3027 6859
+3  6859 2768 237
+3  357 3004 6859
+3  6859 3027 357
+3  3026 6859 3004
+3  3004 358 3026
+3  2770 6860 3027
+3  3027 237 2770
+3  3028 6860 2770
+3  2770 235 3028
+3  3006 6860 3028
+3  3028 356 3006
+3  3027 6860 3006
+3  3006 357 3027
+3  2771 6861 3028
+3  3028 235 2771
+3  3029 6861 2771
+3  2771 232 3029
+3  3008 6861 3029
+3  3029 354 3008
+3  356 3028 6861
+3  6861 3008 356
+3  250 3030 2757
+3  354 3029 3030
+3  232 2757 3029
+3  2757 3030 3029
+3  250 3018 3030
+3  326 3011 3018
+3  354 3030 3011
+3  3030 3018 3011
+3  354 3010 3009
+3  353 2892 3010
+3  355 3009 2892
+3  3009 3010 2892
+3  2093 3031 6862
+3  6862 2987 2093
+3  226 2983 6862
+3  6862 3031 226
+3  351 3032 6862
+3  6862 2983 351
+3  2987 6862 3032
+3  3032 352 2987
+3  3032 6863 2989
+3  2989 352 3032
+3  2980 6863 3032
+3  3032 351 2980
+3  3033 6863 2980
+3  2980 350 3033
+3  2989 6863 3033
+3  3033 349 2989
+3  328 2991 2979
+3  349 3033 2991
+3  350 2979 3033
+3  2979 2991 3033
+3  345 3034 3035
+3  348 2938 3034
+3  327 3035 2938
+3  3035 3034 2938
+3  3034 6864 2940
+3  2940 348 3034
+3  2982 6864 3034
+3  3034 345 2982
+3  346 3036 6864
+3  6864 2982 346
+3  347 2940 6864
+3  6864 3036 347
+3  1167 2942 6865
+3  6865 3037 1167
+3  3036 6865 2942
+3  2942 347 3036
+3  346 2985 6865
+3  6865 3036 346
+3  227 3037 6865
+3  6865 2985 227
+3  327 3038 3035
+3  328 2978 3038
+3  345 3035 2978
+3  3035 3038 2978
+3  344 2869 6866
+3  6866 3041 344
+3  343 3039 6866
+3  6866 2869 343
+3  337 3040 6866
+3  6866 3039 337
+3  3041 6866 3040
+3  3040 334 3041
+3  2928 6867 3039
+3  3039 343 2928
+3  3042 6867 2928
+3  2928 342 3042
+3  339 3043 6867
+3  6867 3042 339
+3  337 3039 6867
+3  6867 3043 337
+3  341 2959 2973
+3  339 3042 2959
+3  342 2973 3042
+3  2973 2959 3042
+3  338 3044 2974
+3  339 2958 3044
+3  340 2974 2958
+3  2974 3044 2958
+3  2932 6868 3044
+3  3044 338 2932
+3  336 3045 6868
+3  6868 2932 336
+3  337 3043 6868
+3  6868 3045 337
+3  339 3044 6868
+3  6868 3043 339
+3  336 2874 6869
+3  6869 3045 336
+3  335 3046 6869
+3  6869 2874 335
+3  3040 6869 3046
+3  3046 334 3040
+3  3045 6869 3040
+3  3040 337 3045
+3  332 2876 6870
+3  6870 3048 332
+3  330 3047 6870
+3  6870 2876 330
+3  331 2880 6870
+3  6870 3047 331
+3  3048 6870 2880
+3  2880 333 3048
+3  330 2934 6871
+3  6871 3047 330
+3  329 3049 6871
+3  6871 2934 329
+3  2937 6871 3049
+3  3049 327 2937
+3  3047 6871 2937
+3  2937 331 3047
+3  328 3038 2992
+3  327 3049 3038
+3  329 2992 3049
+3  2992 3038 3049
+3  3050 6872 3016
+3  3016 316 3050
+3  3051 6872 3050
+3  3050 320 3051
+3  2907 6872 3051
+3  3051 325 2907
+3  3016 6872 2907
+3  2907 326 3016
+3  320 3052 6873
+3  6873 3051 320
+3  322 3053 6873
+3  6873 3052 322
+3  324 2859 6873
+3  6873 3053 324
+3  3051 6873 2859
+3  2859 325 3051
+3  322 3052 6874
+3  6874 3055 322
+3  320 3054 6874
+3  6874 3052 320
+3  2864 6874 3054
+3  3054 321 2864
+3  323 3055 6874
+3  6874 2864 323
+3  3050 6875 3054
+3  3054 320 3050
+3  316 3056 6875
+3  6875 3050 316
+3  317 2909 6875
+3  6875 3056 317
+3  321 3054 6875
+3  6875 2909 321
+3  318 2918 3057
+3  319 2910 2918
+3  317 3057 2910
+3  3057 2918 2910
+3  317 3056 3057
+3  316 3017 3056
+3  318 3057 3017
+3  3057 3056 3017
+3  314 3058 2993
+3  312 2868 3058
+3  315 2993 2868
+3  2993 3058 2868
+3  313 2929 2925
+3  312 3058 2929
+3  314 2925 3058
+3  2925 2929 3058
+3  2100 3059 3061
+3  1156 3060 3059
+3  656 3061 3060
+3  3061 3059 3060
+3  819 3062 6876
+3  6876 3065 819
+3  463 3063 6876
+3  6876 3062 463
+3  3064 6876 3063
+3  3063 462 3064
+3  3065 6876 3064
+3  3064 969 3065
+3  720 3066 6877
+3  6877 3069 720
+3  469 3067 6877
+3  6877 3066 469
+3  3068 6877 3067
+3  3067 468 3068
+3  3069 6877 3068
+3  3068 1019 3069
+3  1018 3070 6878
+3  6878 3073 1018
+3  466 3071 6878
+3  6878 3070 466
+3  3072 6878 3071
+3  3071 465 3072
+3  714 3073 6878
+3  6878 3072 714
+3  1064 3074 6879
+3  6879 3077 1064
+3  1070 3075 6879
+3  6879 3074 1070
+3  3076 6879 3075
+3  3075 562 3076
+3  3077 6879 3076
+3  3076 564 3077
+3  619 3078 6880
+3  6880 3081 619
+3  563 3079 6880
+3  6880 3078 563
+3  441 3080 6880
+3  6880 3079 441
+3  3081 6880 3080
+3  3080 442 3081
+3  1074 3082 6881
+3  6881 3085 1074
+3  1063 3083 6881
+3  6881 3082 1063
+3  565 3084 6881
+3  6881 3083 565
+3  3085 6881 3084
+3  3084 568 3085
+3  567 3086 3088
+3  1111 3087 3086
+3  1079 3088 3087
+3  3088 3086 3087
+3  611 3089 6882
+3  6882 3092 611
+3  1077 3090 6882
+3  6882 3089 1077
+3  569 3091 6882
+3  6882 3090 569
+3  3092 6882 3091
+3  3091 572 3092
+3  608 3093 6883
+3  6883 3096 608
+3  571 3094 6883
+3  6883 3093 571
+3  570 3095 6883
+3  6883 3094 570
+3  3096 6883 3095
+3  3095 1080 3096
+3  981 3097 6884
+3  6884 3100 981
+3  610 3098 6884
+3  6884 3097 610
+3  573 3099 6884
+3  6884 3098 573
+3  3100 6884 3099
+3  3099 576 3100
+3  986 3101 6885
+3  6885 3104 986
+3  575 3102 6885
+3  6885 3101 575
+3  574 3103 6885
+3  6885 3102 574
+3  3104 6885 3103
+3  3103 609 3104
+3  923 3105 6886
+3  6886 3108 923
+3  984 3106 6886
+3  6886 3105 984
+3  577 3107 6886
+3  6886 3106 577
+3  3108 6886 3107
+3  3107 580 3108
+3  920 3109 6887
+3  6887 3112 920
+3  579 3110 6887
+3  6887 3109 579
+3  578 3111 6887
+3  6887 3110 578
+3  3112 6887 3111
+3  3111 987 3112
+3  1092 3113 6888
+3  6888 3116 1092
+3  926 3114 6888
+3  6888 3113 926
+3  581 3115 6888
+3  6888 3114 581
+3  3116 6888 3115
+3  3115 584 3116
+3  1094 3117 6889
+3  6889 3120 1094
+3  583 3118 6889
+3  6889 3117 583
+3  582 3119 6889
+3  6889 3118 582
+3  3120 6889 3119
+3  3119 921 3120
+3  586 3121 3123
+3  999 3122 3121
+3  1050 3123 3122
+3  3123 3121 3122
+3  412 3124 6890
+3  6890 3127 412
+3  998 3125 6890
+3  6890 3124 998
+3  587 3126 6890
+3  6890 3125 587
+3  3127 6890 3126
+3  3126 411 3127
+3  3128 6891 3131
+3  3131 971 3128
+3  767 3129 6891
+3  6891 3128 767
+3  764 3130 6891
+3  6891 3129 764
+3  1021 3131 6891
+3  6891 3130 1021
+3  818 3132 6892
+3  6892 3135 818
+3  970 3133 6892
+3  6892 3132 970
+3  593 3134 6892
+3  6892 3133 593
+3  3135 6892 3134
+3  3134 596 3135
+3  1033 3136 6893
+3  6893 3139 1033
+3  595 3137 6893
+3  6893 3136 595
+3  594 3138 6893
+3  6893 3137 594
+3  3139 6893 3138
+3  3138 972 3139
+3  817 3140 3142
+3  597 3141 3140
+3  713 3142 3141
+3  3142 3140 3141
+3  1114 3143 6894
+3  6894 3146 1114
+3  599 3144 6894
+3  6894 3143 599
+3  3145 6894 3144
+3  3144 1112 3145
+3  936 3146 6894
+3  6894 3145 936
+3  607 3147 6895
+3  6895 3150 607
+3  1081 3148 6895
+3  6895 3147 1081
+3  600 3149 6895
+3  6895 3148 600
+3  3150 6895 3149
+3  3149 991 3150
+3  995 3151 6896
+3  6896 3154 995
+3  990 3152 6896
+3  6896 3151 990
+3  601 3153 6896
+3  6896 3152 601
+3  3154 6896 3153
+3  3153 604 3154
+3  1108 3155 6897
+3  6897 3159 1108
+3  890 3156 6897
+3  6897 3155 890
+3  3157 6897 3156
+3  3156 603 3157
+3  3158 6897 3157
+3  3157 602 3158
+3  3159 6897 3158
+3  3158 1115 3159
+3  950 3160 6898
+3  6898 3163 950
+3  1076 3161 6898
+3  6898 3160 1076
+3  612 3162 6898
+3  6898 3161 612
+3  3163 6898 3162
+3  3162 615 3163
+3  1072 3164 6899
+3  6899 3167 1072
+3  614 3165 6899
+3  6899 3164 614
+3  613 3166 6899
+3  6899 3165 613
+3  3167 6899 3166
+3  3166 982 3167
+3  1061 3168 6900
+3  6900 3171 1061
+3  444 3169 6900
+3  6900 3168 444
+3  447 3170 6900
+3  6900 3169 447
+3  3171 6900 3170
+3  3170 965 3171
+3  1017 3172 3174
+3  715 3173 3172
+3  719 3174 3173
+3  3174 3172 3173
+3  716 3175 3177
+3  722 3176 3175
+3  1020 3177 3176
+3  3177 3175 3176
+3  440 3178 6901
+3  6901 3182 440
+3  1016 3179 6901
+3  6901 3178 1016
+3  3180 6901 3179
+3  3179 721 3180
+3  3181 6901 3180
+3  3180 717 3181
+3  3182 6901 3181
+3  3181 439 3182
+3  730 3183 6902
+3  6902 3187 730
+3  975 3184 6902
+3  6902 3183 975
+3  3185 6902 3184
+3  3184 591 3185
+3  3186 6902 3185
+3  3185 1022 3186
+3  3187 6902 3186
+3  3186 1037 3187
+3  765 3188 6903
+3  6903 3192 765
+3  761 3189 6903
+3  6903 3188 761
+3  3190 6903 3189
+3  3189 724 3190
+3  3191 6903 3190
+3  3190 1036 3191
+3  3192 6903 3191
+3  3191 1023 3192
+3  1039 3193 3195
+3  725 3194 3193
+3  729 3195 3194
+3  3195 3193 3194
+3  726 3196 3198
+3  732 3197 3196
+3  1038 3198 3197
+3  3198 3196 3197
+3  2409 6904 2412
+3  2412 979 2409
+3  977 3199 6904
+3  6904 2409 977
+3  3200 6904 3199
+3  3199 974 3200
+3  3201 6904 3200
+3  3200 731 3201
+3  3202 6904 3201
+3  3201 727 3202
+3  2412 6904 3202
+3  3202 1119 2412
+3  1118 3203 6905
+3  6905 2351 1118
+3  728 3204 6905
+3  6905 3203 728
+3  3205 6905 3204
+3  3204 723 3205
+3  3206 6905 3205
+3  3205 739 3206
+3  2351 6905 3206
+3  3206 738 2351
+3  1128 3207 6906
+3  6906 3210 1128
+3  1131 3208 6906
+3  6906 3207 1131
+3  2419 6906 3208
+3  3208 1121 2419
+3  737 3209 6906
+3  6906 2419 737
+3  3210 6906 3209
+3  3209 740 3210
+3  801 3211 6907
+3  6907 3214 801
+3  1127 3212 6907
+3  6907 3211 1127
+3  741 3213 6907
+3  6907 3212 741
+3  3214 6907 3213
+3  3213 1026 3214
+3  938 3215 6908
+3  6908 3217 938
+3  735 2354 6908
+3  6908 3215 735
+3  1124 3216 6908
+3  6908 2354 1124
+3  3217 6908 3216
+3  3216 944 3217
+3  943 3218 6909
+3  6909 3220 943
+3  1125 2356 6909
+3  6909 3218 1125
+3  743 3219 6909
+3  6909 2356 743
+3  3220 6909 3219
+3  3219 746 3220
+3  745 3221 6910
+3  6910 3224 745
+3  2359 6910 3221
+3  3221 744 2359
+3  733 3222 6910
+3  6910 2359 733
+3  3223 6910 3222
+3  3222 775 3223
+3  3224 6910 3223
+3  3223 770 3224
+3  928 3225 6911
+3  6911 3229 928
+3  895 3226 6911
+3  6911 3225 895
+3  3227 6911 3226
+3  3226 994 3227
+3  3228 6911 3227
+3  3227 605 3228
+3  3229 6911 3228
+3  3228 891 3229
+3  1106 3230 6912
+3  6912 3233 1106
+3  942 3231 6912
+3  6912 3230 942
+3  747 3232 6912
+3  6912 3231 747
+3  3233 6912 3232
+3  3232 749 3233
+3  771 3234 3236
+3  788 3235 3234
+3  784 3236 3235
+3  3236 3234 3235
+3  966 3237 6913
+3  6913 3240 966
+3  752 3238 6913
+3  6913 3237 752
+3  1110 3239 6913
+3  6913 3238 1110
+3  3240 6913 3239
+3  3239 1060 3240
+3  940 3241 6914
+3  6914 3244 940
+3  935 3242 6914
+3  6914 3241 935
+3  754 3243 6914
+3  6914 3242 754
+3  3244 6914 3243
+3  3243 756 3244
+3  1137 3245 6915
+3  6915 3248 1137
+3  758 3246 6915
+3  6915 3245 758
+3  755 3247 6915
+3  6915 3246 755
+3  3248 6915 3247
+3  3247 967 3248
+3  757 3249 6916
+3  6916 3251 757
+3  760 2366 6916
+3  6916 3249 760
+3  736 3250 6916
+3  6916 2366 736
+3  3251 6916 3250
+3  3250 939 3251
+3  424 3252 3254
+3  804 3253 3252
+3  800 3254 3253
+3  3254 3252 3253
+3  768 3255 3257
+3  763 3256 3255
+3  766 3257 3256
+3  3257 3255 3256
+3  783 3258 3260
+3  772 3259 3258
+3  776 3260 3259
+3  3260 3258 3259
+3  1046 3261 6917
+3  6917 3264 1046
+3  778 3262 6917
+3  6917 3261 778
+3  3263 6917 3262
+3  3262 774 3263
+3  2427 6917 3263
+3  3263 734 2427
+3  3264 6917 2427
+3  2427 1123 3264
+3  773 3265 3267
+3  779 3266 3265
+3  782 3267 3266
+3  3267 3265 3266
+3  792 3268 6918
+3  6918 3271 792
+3  777 3269 6918
+3  6918 3268 777
+3  1044 3270 6918
+3  6918 3269 1044
+3  3271 6918 3270
+3  3270 793 3271
+3  889 3272 6919
+3  6919 3275 889
+3  785 3273 6919
+3  6919 3272 785
+3  1029 3274 6919
+3  6919 3273 1029
+3  3275 6919 3274
+3  3274 927 3275
+3  1028 3276 3278
+3  786 3277 3276
+3  789 3278 3277
+3  3278 3276 3277
+3  3279 6920 3282
+3  3282 1048 3279
+3  794 3280 6920
+3  6920 3279 794
+3  803 3281 6920
+3  6920 3280 803
+3  3282 6920 3281
+3  3281 864 3282
+3  588 3283 3285
+3  1047 3284 3283
+3  589 3285 3284
+3  3285 3283 3284
+3  806 3286 3288
+3  795 3287 3286
+3  799 3288 3287
+3  3288 3286 3287
+3  796 3289 3291
+3  802 3290 3289
+3  805 3291 3290
+3  3291 3289 3290
+3  433 3292 6921
+3  6921 3295 433
+3  434 3293 6921
+3  6921 3292 434
+3  3294 6921 3293
+3  3293 808 3294
+3  3295 6921 3294
+3  3294 811 3295
+3  1006 3296 6922
+3  6922 3299 1006
+3  810 3297 6922
+3  6922 3296 810
+3  3298 6922 3297
+3  3297 809 3298
+3  813 3299 6922
+3  6922 3298 813
+3  436 3300 3302
+3  812 3301 3300
+3  1004 3302 3301
+3  3302 3300 3301
+3  426 3303 3305
+3  822 3304 3303
+3  425 3305 3304
+3  3305 3303 3304
+3  457 3306 3308
+3  821 3307 3306
+3  820 3308 3307
+3  3308 3306 3307
+3  828 3309 6923
+3  6923 3312 828
+3  824 3310 6923
+3  6923 3309 824
+3  458 3311 6923
+3  6923 3310 458
+3  3312 6923 3311
+3  3311 1014 3312
+3  1010 3313 6924
+3  6924 3316 1010
+3  1008 3314 6924
+3  6924 3313 1008
+3  823 3315 6924
+3  6924 3314 823
+3  3316 6924 3315
+3  3315 825 3316
+3  1011 3317 6925
+3  6925 3320 1011
+3  1005 3318 6925
+3  6925 3317 1005
+3  3319 6925 3318
+3  3318 814 3319
+3  1007 3320 6925
+3  6925 3319 1007
+3  3321 6926 3324
+3  3324 1030 3321
+3  3322 6926 3321
+3  3321 1009 3322
+3  3323 6926 3322
+3  3322 826 3323
+3  3324 6926 3323
+3  3323 829 3324
+3  437 3325 6927
+3  6927 3328 437
+3  438 3326 6927
+3  6927 3325 438
+3  827 3327 6927
+3  6927 3326 827
+3  3328 6927 3327
+3  3327 1015 3328
+3  992 3329 3331
+3  873 3330 3329
+3  964 3331 3330
+3  3331 3329 3330
+3  885 3332 6928
+3  6928 3335 885
+3  1000 3333 6928
+3  6928 3332 1000
+3  3334 6928 3333
+3  3333 869 3334
+3  3335 6928 3334
+3  3334 933 3335
+3  931 3336 6929
+3  6929 3340 931
+3  870 3337 6929
+3  6929 3336 870
+3  3338 6929 3337
+3  3337 949 3338
+3  3339 6929 3338
+3  3338 616 3339
+3  3340 6929 3339
+3  3339 904 3340
+3  1062 3341 6930
+3  6930 3344 1062
+3  951 3342 6930
+3  6930 3341 951
+3  871 3343 6930
+3  6930 3342 871
+3  3344 6930 3343
+3  3343 1056 3344
+3  996 3345 6931
+3  6931 3348 996
+3  961 3346 6931
+3  6931 3345 961
+3  863 3347 6931
+3  6931 3346 863
+3  3348 6931 3347
+3  3347 989 3348
+3  875 3349 6932
+3  6932 3352 875
+3  861 3350 6932
+3  6932 3349 861
+3  908 3351 6932
+3  6932 3350 908
+3  3352 6932 3351
+3  3351 880 3352
+3  912 3353 6933
+3  6933 3356 912
+3  963 3354 6933
+3  6933 3353 963
+3  874 3355 6933
+3  6933 3354 874
+3  3356 6933 3355
+3  3355 877 3356
+3  1096 3357 6934
+3  6934 3360 1096
+3  1098 3358 6934
+3  6934 3357 1098
+3  952 3359 6934
+3  6934 3358 952
+3  3360 6934 3359
+3  3359 1103 3360
+3  1099 3361 6935
+3  6935 3364 1099
+3  911 3362 6935
+3  6935 3361 911
+3  878 3363 6935
+3  6935 3362 878
+3  3364 6935 3363
+3  3363 881 3364
+3  956 3365 6936
+3  6936 3368 956
+3  884 3366 6936
+3  6936 3365 884
+3  879 3367 6936
+3  6936 3366 879
+3  3368 6936 3367
+3  3367 909 3368
+3  955 3369 3371
+3  892 3370 3369
+3  1083 3371 3370
+3  3371 3369 3370
+3  917 3372 6937
+3  6937 3375 917
+3  866 3373 6937
+3  6937 3372 866
+3  946 3374 6937
+3  6937 3373 946
+3  3375 6937 3374
+3  3374 906 3375
+3  916 3376 6938
+3  6938 3379 916
+3  903 3377 6938
+3  6938 3376 903
+3  617 3378 6938
+3  6938 3377 617
+3  3379 6938 3378
+3  3378 1073 3379
+3  905 3380 6939
+3  6939 3383 905
+3  947 3381 6939
+3  6939 3380 947
+3  888 3382 6939
+3  6939 3381 888
+3  3383 6939 3382
+3  3382 930 3383
+3  872 3384 6940
+3  6940 3388 872
+3  932 3385 6940
+3  6940 3384 932
+3  3386 6940 3385
+3  3385 868 3386
+3  3387 6940 3386
+3  3386 1054 3387
+3  3388 6940 3387
+3  3387 1055 3388
+3  900 3389 6941
+3  6941 3392 900
+3  907 3390 6941
+3  6941 3389 907
+3  862 3391 6941
+3  6941 3390 862
+3  3392 6941 3391
+3  3391 959 3392
+3  910 3393 6942
+3  6942 3396 910
+3  901 3394 6942
+3  6942 3393 901
+3  894 3395 6942
+3  6942 3394 894
+3  3396 6942 3395
+3  3395 958 3396
+3  897 3397 6943
+3  6943 3400 897
+3  1082 3398 6943
+3  6943 3397 1082
+3  893 3399 6943
+3  6943 3398 893
+3  3400 6943 3399
+3  3399 902 3400
+3  960 3401 6944
+3  6944 3404 960
+3  993 3402 6944
+3  6944 3401 993
+3  896 3403 6944
+3  6944 3402 896
+3  3404 6944 3403
+3  3403 899 3404
+3  988 3405 6945
+3  6945 3408 988
+3  962 3406 6945
+3  6945 3405 962
+3  913 3407 6945
+3  6945 3406 913
+3  3408 6945 3407
+3  3407 919 3408
+3  1093 3409 6946
+3  6946 3412 1093
+3  922 3410 6946
+3  6946 3409 922
+3  914 3411 6946
+3  6946 3410 914
+3  3412 6946 3411
+3  3411 1097 3412
+3  1089 3413 6947
+3  6947 3416 1089
+3  1091 3414 6947
+3  6947 3413 1091
+3  585 3415 6947
+3  6947 3414 585
+3  3416 6947 3415
+3  3415 1104 3416
+3  924 3417 6948
+3  6948 3420 924
+3  915 3418 6948
+3  6948 3417 915
+3  1071 3419 6948
+3  6948 3418 1071
+3  3420 6948 3419
+3  3419 983 3420
+3  1090 3421 6949
+3  6949 3424 1090
+3  1086 3422 6949
+3  6949 3421 1086
+3  918 3423 6949
+3  6949 3422 918
+3  3424 6949 3423
+3  3423 925 3424
+3  1113 3425 6950
+3  6950 3428 1113
+3  934 3426 6950
+3  6950 3425 934
+3  941 3427 6950
+3  6950 3426 941
+3  3428 6950 3427
+3  3427 1107 3428
+3  449 3429 6951
+3  6951 3432 449
+3  1136 3430 6951
+3  6951 3429 1136
+3  968 3431 6951
+3  6951 3430 968
+3  3432 6951 3431
+3  3431 448 3432
+3  1139 3433 3435
+3  217 3434 3433
+3  1035 3435 3434
+3  3435 3433 3434
+3  1117 3436 6952
+3  6952 3439 1117
+3  1032 3437 6952
+3  6952 3436 1032
+3  973 3438 6952
+3  6952 3437 973
+3  3439 6952 3438
+3  3438 978 3439
+3  1058 3440 6953
+3  6953 3443 1058
+3  1053 3441 6953
+3  6953 3440 1053
+3  3442 6953 3441
+3  3441 1003 3442
+3  3443 6953 3442
+3  3442 1067 3443
+3  1126 3444 3446
+3  1042 3445 3444
+3  1130 3446 3445
+3  3446 3444 3445
+3  1129 3447 3449
+3  1043 3448 3447
+3  1133 3449 3448
+3  3449 3447 3448
+3  1120 3450 6954
+3  6954 2422 1120
+3  1132 3451 6954
+3  6954 3450 1132
+3  3452 6954 3451
+3  3451 1134 3452
+3  3453 6954 3452
+3  3452 1045 3453
+3  2422 6954 3453
+3  3453 1122 2422
+3  446 3454 6955
+3  6955 3457 446
+3  1065 3455 6955
+3  6955 3454 1065
+3  1068 3456 6955
+3  6955 3455 1068
+3  3457 6955 3456
+3  3456 445 3457
+3  462 3063 3459
+3  463 3458 3063
+3  461 3459 3458
+3  3459 3063 3458
+3  456 3460 3462
+3  469 3461 3460
+3  455 3462 3461
+3  3462 3460 3461
+3  465 3071 3464
+3  466 3463 3071
+3  464 3464 3463
+3  3464 3071 3463
+3  468 3067 3466
+3  469 3465 3067
+3  467 3466 3465
+3  3466 3067 3465
+3  562 3467 6956
+3  6956 3076 562
+3  441 3079 6956
+3  6956 3467 441
+3  563 3468 6956
+3  6956 3079 563
+3  3076 6956 3468
+3  3468 564 3076
+3  565 3469 6957
+3  6957 3084 565
+3  566 3470 6957
+3  6957 3469 566
+3  567 3471 6957
+3  6957 3470 567
+3  3084 6957 3471
+3  3471 568 3084
+3  569 3472 6958
+3  6958 3091 569
+3  570 3094 6958
+3  6958 3472 570
+3  571 3473 6958
+3  6958 3094 571
+3  3091 6958 3473
+3  3473 572 3091
+3  573 3474 6959
+3  6959 3099 573
+3  574 3102 6959
+3  6959 3474 574
+3  575 3475 6959
+3  6959 3102 575
+3  3099 6959 3475
+3  3475 576 3099
+3  577 3476 6960
+3  6960 3107 577
+3  578 3110 6960
+3  6960 3476 578
+3  579 3477 6960
+3  6960 3110 579
+3  3107 6960 3477
+3  3477 580 3107
+3  581 3478 6961
+3  6961 3115 581
+3  582 3118 6961
+3  6961 3478 582
+3  583 3479 6961
+3  6961 3118 583
+3  3115 6961 3479
+3  3479 584 3115
+3  3480 6962 3121
+3  3121 586 3480
+3  587 3125 6962
+3  6962 3480 587
+3  998 3481 6962
+3  6962 3125 998
+3  3121 6962 3481
+3  3481 999 3121
+3  460 3482 3484
+3  590 3483 3482
+3  459 3484 3483
+3  3484 3482 3483
+3  462 3485 6963
+3  6963 3064 462
+3  459 3486 6963
+3  6963 3485 459
+3  3487 6963 3486
+3  3486 971 3487
+3  969 3064 6963
+3  6963 3487 969
+3  3488 6964 3490
+3  3490 592 3488
+3  593 3133 6964
+3  6964 3488 593
+3  970 3489 6964
+3  6964 3133 970
+3  3490 6964 3489
+3  3489 971 3490
+3  465 3491 6965
+3  6965 3493 465
+3  463 3062 6965
+3  6965 3491 463
+3  819 3492 6965
+3  6965 3062 819
+3  3493 6965 3492
+3  3492 816 3493
+3  818 3494 6966
+3  6966 3132 818
+3  819 3065 6966
+3  6966 3494 819
+3  3495 6966 3065
+3  3065 969 3495
+3  970 3132 6966
+3  6966 3495 970
+3  3496 6967 3134
+3  3134 593 3496
+3  594 3137 6967
+3  6967 3496 594
+3  595 3497 6967
+3  6967 3137 595
+3  3134 6967 3497
+3  3497 596 3134
+3  3498 6968 3135
+3  3135 596 3498
+3  597 3140 6968
+3  6968 3498 597
+3  817 3499 6968
+3  6968 3140 817
+3  818 3135 6968
+3  6968 3499 818
+3  3500 6969 3095
+3  3095 570 3500
+3  3088 6969 3500
+3  3500 567 3088
+3  1079 3501 6969
+3  6969 3088 1079
+3  1080 3095 6969
+3  6969 3501 1080
+3  3502 6970 3504
+3  3504 599 3502
+3  600 3148 6970
+3  6970 3502 600
+3  1081 3503 6970
+3  6970 3148 1081
+3  1078 3504 6970
+3  6970 3503 1078
+3  601 3505 6971
+3  6971 3153 601
+3  602 3157 6971
+3  6971 3505 602
+3  3506 6971 3157
+3  3157 603 3506
+3  3153 6971 3506
+3  3506 604 3153
+3  3507 6972 3103
+3  3103 574 3507
+3  3093 6972 3507
+3  3507 571 3093
+3  608 3508 6972
+3  6972 3093 608
+3  609 3103 6972
+3  6972 3508 609
+3  607 3509 6973
+3  6973 3147 607
+3  608 3096 6973
+3  6973 3509 608
+3  1080 3510 6973
+3  6973 3096 1080
+3  3147 6973 3510
+3  3510 1081 3147
+3  3511 6974 3092
+3  3092 572 3511
+3  3098 6974 3511
+3  3511 573 3098
+3  610 3512 6974
+3  6974 3098 610
+3  611 3092 6974
+3  6974 3512 611
+3  612 3513 6975
+3  6975 3162 612
+3  613 3165 6975
+3  6975 3513 613
+3  614 3514 6975
+3  6975 3165 614
+3  3162 6975 3514
+3  3514 615 3162
+3  566 3515 6976
+3  6976 3517 566
+3  563 3078 6976
+3  6976 3515 563
+3  619 3516 6976
+3  6976 3078 619
+3  3517 6976 3516
+3  3516 620 3517
+3  3518 6977 3081
+3  3081 442 3518
+3  3519 6977 3518
+3  3518 443 3519
+3  3520 6977 3519
+3  3519 618 3520
+3  619 3081 6977
+3  6977 3520 619
+3  3521 6978 3523
+3  3523 997 3521
+3  998 3124 6978
+3  6978 3521 998
+3  412 3522 6978
+3  6978 3124 412
+3  3523 6978 3522
+3  3522 1101 3523
+3  712 3524 3526
+3  1100 3525 3524
+3  409 3526 3525
+3  3526 3524 3525
+3  621 3527 3529
+3  857 3528 3527
+3  711 3529 3528
+3  3529 3527 3528
+3  3530 6979 3142
+3  3142 713 3530
+3  3531 6979 3530
+3  3530 714 3531
+3  816 3532 6979
+3  6979 3531 816
+3  817 3142 6979
+3  6979 3532 817
+3  3533 6980 3073
+3  3073 714 3533
+3  3172 6980 3533
+3  3533 715 3172
+3  1017 3534 6980
+3  6980 3172 1017
+3  1018 3073 6980
+3  6980 3534 1018
+3  468 3535 6981
+3  6981 3068 468
+3  466 3070 6981
+3  6981 3535 466
+3  1018 3536 6981
+3  6981 3070 1018
+3  3068 6981 3536
+3  3536 1019 3068
+3  3537 6982 3176
+3  3176 722 3537
+3  3069 6982 3537
+3  3537 720 3069
+3  1019 3538 6982
+3  6982 3069 1019
+3  1020 3176 6982
+3  6982 3538 1020
+3  1159 3539 3541
+3  1031 3540 3539
+3  598 3541 3540
+3  3541 3539 3540
+3  3542 6983 3175
+3  3175 716 3542
+3  3180 6983 3542
+3  3542 717 3180
+3  721 3543 6983
+3  6983 3180 721
+3  722 3175 6983
+3  6983 3543 722
+3  3544 6984 3174
+3  3174 719 3544
+3  3177 6984 3544
+3  3544 716 3177
+3  1020 3545 6984
+3  6984 3177 1020
+3  1017 3174 6984
+3  6984 3545 1017
+3  3546 6985 3173
+3  3173 715 3546
+3  713 3547 6985
+3  6985 3546 713
+3  718 3548 6985
+3  6985 3547 718
+3  719 3173 6985
+3  6985 3548 719
+3  717 3549 6986
+3  6986 3181 717
+3  718 3550 6986
+3  6986 3549 718
+3  1031 3551 6986
+3  6986 3550 1031
+3  3181 6986 3551
+3  3551 439 3181
+3  591 3552 6987
+3  6987 3185 591
+3  592 3553 6987
+3  6987 3552 592
+3  3554 6987 3553
+3  3553 1021 3554
+3  1022 3185 6987
+3  6987 3554 1022
+3  1022 3555 6988
+3  6988 3186 1022
+3  1023 3191 6988
+3  6988 3555 1023
+3  1036 3556 6988
+3  6988 3191 1036
+3  3186 6988 3556
+3  3556 1037 3186
+3  724 3557 6989
+3  6989 3190 724
+3  3193 6989 3557
+3  3557 725 3193
+3  1039 3558 6989
+3  6989 3193 1039
+3  1036 3190 6989
+3  6989 3558 1036
+3  3559 6990 3197
+3  3197 732 3559
+3  730 3187 6990
+3  6990 3559 730
+3  1037 3560 6990
+3  6990 3187 1037
+3  1038 3197 6990
+3  6990 3560 1038
+3  3561 6991 3196
+3  3196 726 3561
+3  3201 6991 3561
+3  3561 727 3201
+3  731 3562 6991
+3  6991 3201 731
+3  732 3196 6991
+3  6991 3562 732
+3  3563 6992 3195
+3  3195 729 3563
+3  3198 6992 3563
+3  3563 726 3198
+3  1038 3564 6992
+3  6992 3198 1038
+3  1039 3195 6992
+3  6992 3564 1039
+3  3565 6993 3194
+3  3194 725 3565
+3  3204 6993 3565
+3  3565 723 3204
+3  728 3566 6993
+3  6993 3204 728
+3  729 3194 6993
+3  6993 3566 729
+3  727 3567 6994
+3  6994 3202 727
+3  728 3203 6994
+3  6994 3567 728
+3  1118 2434 6994
+3  6994 3203 1118
+3  3202 6994 2434
+3  2434 1119 3202
+3  2446 6995 3209
+3  3209 737 2446
+3  3206 6995 2446
+3  2446 738 3206
+3  739 3568 6995
+3  6995 3206 739
+3  740 3209 6995
+3  6995 3568 740
+3  3569 6996 3205
+3  3205 723 3569
+3  724 3570 6996
+3  6996 3569 724
+3  742 3571 6996
+3  6996 3570 742
+3  739 3205 6996
+3  6996 3571 739
+3  741 3572 6997
+3  6997 3213 741
+3  742 3573 6997
+3  6997 3572 742
+3  3574 6997 3573
+3  3573 1025 3574
+3  3213 6997 3574
+3  3574 1026 3213
+3  2445 6998 3219
+3  3219 743 2445
+3  3221 6998 2445
+3  2445 744 3221
+3  745 3575 6998
+3  6998 3221 745
+3  746 3219 6998
+3  6998 3575 746
+3  3576 6999 3228
+3  3228 605 3576
+3  3156 6999 3576
+3  3576 603 3156
+3  890 3577 6999
+3  6999 3156 890
+3  891 3228 6999
+3  6999 3577 891
+3  747 3578 7000
+3  7000 3232 747
+3  748 3579 7000
+3  7000 3578 748
+3  3580 7000 3579
+3  3579 751 3580
+3  3232 7000 3580
+3  3580 749 3232
+3  3581 7001 3584
+3  3584 620 3581
+3  618 3582 7001
+3  7001 3581 618
+3  1061 3583 7001
+3  7001 3582 1061
+3  3584 7001 3583
+3  3583 1059 3584
+3  3585 7002 3587
+3  3587 1059 3585
+3  3239 7002 3585
+3  3585 1060 3239
+3  1110 3586 7002
+3  7002 3239 1110
+3  1111 3587 7002
+3  7002 3586 1111
+3  1078 3588 7003
+3  7003 3590 1078
+3  1079 3087 7003
+3  7003 3588 1079
+3  3589 7003 3087
+3  3087 1111 3589
+3  3590 7003 3589
+3  3589 1112 3590
+3  752 3591 7004
+3  7004 3238 752
+3  753 3592 7004
+3  7004 3591 753
+3  3593 7004 3592
+3  3592 1112 3593
+3  1110 3238 7004
+3  7004 3593 1110
+3  754 3594 7005
+3  7005 3243 754
+3  755 3246 7005
+3  7005 3594 755
+3  3595 7005 3246
+3  3246 758 3595
+3  3243 7005 3595
+3  3595 756 3243
+3  757 3596 7006
+3  7006 3249 757
+3  758 3597 7006
+3  7006 3596 758
+3  759 2444 7006
+3  7006 3597 759
+3  3249 7006 2444
+3  2444 760 3249
+3  590 3598 7007
+3  7007 3601 590
+3  423 3599 7007
+3  7007 3598 423
+3  769 3600 7007
+3  7007 3599 769
+3  3601 7007 3600
+3  3600 767 3601
+3  764 3602 7008
+3  7008 3130 764
+3  765 3192 7008
+3  7008 3602 765
+3  3603 7008 3192
+3  3192 1023 3603
+3  1021 3130 7008
+3  7008 3603 1021
+3  3604 7009 3257
+3  3257 766 3604
+3  764 3129 7009
+3  7009 3604 764
+3  767 3605 7009
+3  7009 3129 767
+3  3257 7009 3605
+3  3605 768 3257
+3  3606 7010 3609
+3  3609 761 3606
+3  762 3607 7010
+3  7010 3606 762
+3  1024 3608 7010
+3  7010 3607 1024
+3  3609 7010 3608
+3  3608 1025 3609
+3  3610 7011 3256
+3  3256 763 3610
+3  761 3188 7011
+3  7011 3610 761
+3  765 3611 7011
+3  7011 3188 765
+3  3256 7011 3611
+3  3611 766 3256
+3  762 3612 7012
+3  7012 3614 762
+3  3255 7012 3612
+3  3612 763 3255
+3  768 3613 7012
+3  7012 3255 768
+3  3614 7012 3613
+3  3613 769 3614
+3  748 3615 7013
+3  7013 3617 748
+3  745 3224 7013
+3  7013 3615 745
+3  3616 7013 3224
+3  3224 770 3616
+3  771 3617 7013
+3  7013 3616 771
+3  3618 7014 3259
+3  3259 772 3618
+3  770 3223 7014
+3  7014 3618 770
+3  775 3619 7014
+3  7014 3223 775
+3  776 3259 7014
+3  7014 3619 776
+3  2450 7015 3222
+3  3222 733 2450
+3  3263 7015 2450
+3  2450 734 3263
+3  774 3620 7015
+3  7015 3263 774
+3  775 3222 7015
+3  7015 3620 775
+3  3621 7016 3265
+3  3265 773 3621
+3  3262 7016 3621
+3  3621 774 3262
+3  778 3622 7016
+3  7016 3262 778
+3  779 3265 7016
+3  7016 3622 779
+3  3623 7017 3625
+3  3625 771 3623
+3  3258 7017 3623
+3  3623 772 3258
+3  783 3624 7017
+3  7017 3258 783
+3  780 3625 7017
+3  7017 3624 780
+3  776 3626 7018
+3  7018 3260 776
+3  773 3267 7018
+3  7018 3626 773
+3  3627 7018 3267
+3  3267 782 3627
+3  3260 7018 3627
+3  3627 783 3260
+3  3628 7019 3266
+3  3266 779 3628
+3  3629 7019 3628
+3  3628 777 3629
+3  781 3630 7019
+3  7019 3629 781
+3  782 3266 7019
+3  7019 3630 782
+3  3631 7020 3634
+3  3634 750 3631
+3  751 3632 7020
+3  7020 3631 751
+3  784 3633 7020
+3  7020 3632 784
+3  3634 7020 3633
+3  3633 785 3634
+3  3635 7021 3277
+3  3277 786 3635
+3  3235 7021 3635
+3  3635 784 3235
+3  788 3636 7021
+3  7021 3235 788
+3  789 3277 7021
+3  7021 3636 789
+3  3637 7022 3278
+3  3278 789 3637
+3  787 3638 7022
+3  7022 3637 787
+3  1027 3639 7022
+3  7022 3638 1027
+3  3278 7022 3639
+3  3639 1028 3278
+3  3640 7023 3273
+3  3273 785 3640
+3  3276 7023 3640
+3  3640 786 3276
+3  3641 7023 3276
+3  3276 1028 3641
+3  3273 7023 3641
+3  3641 1029 3273
+3  3642 7024 3283
+3  3283 588 3642
+3  3123 7024 3642
+3  3642 586 3123
+3  1050 3643 7024
+3  7024 3123 1050
+3  1047 3283 7024
+3  7024 3643 1047
+3  3644 7025 3647
+3  3647 1029 3644
+3  1027 3645 7025
+3  7025 3644 1027
+3  1048 3646 7025
+3  7025 3645 1048
+3  1049 3647 7025
+3  7025 3646 1049
+3  864 3648 7026
+3  7026 3282 864
+3  589 3284 7026
+3  7026 3648 589
+3  1047 3649 7026
+3  7026 3284 1047
+3  3282 7026 3649
+3  3649 1048 3282
+3  787 3650 7027
+3  7027 3653 787
+3  788 3651 7027
+3  7027 3650 788
+3  3652 7027 3651
+3  3651 790 3652
+3  791 3653 7027
+3  7027 3652 791
+3  780 3654 7028
+3  7028 3657 780
+3  781 3655 7028
+3  7028 3654 781
+3  3656 7028 3655
+3  3655 792 3656
+3  790 3657 7028
+3  7028 3656 790
+3  3658 7029 3660
+3  3660 791 3658
+3  3271 7029 3658
+3  3658 792 3271
+3  3659 7029 3271
+3  3271 793 3659
+3  794 3660 7029
+3  7029 3659 794
+3  3661 7030 3287
+3  3287 795 3661
+3  793 3662 7030
+3  7030 3661 793
+3  798 3663 7030
+3  7030 3662 798
+3  799 3287 7030
+3  7030 3663 799
+3  803 3664 7031
+3  7031 3281 803
+3  804 3252 7031
+3  7031 3664 804
+3  424 3665 7031
+3  7031 3252 424
+3  3281 7031 3665
+3  3665 864 3281
+3  3666 7032 3280
+3  3280 794 3666
+3  3286 7032 3666
+3  3666 795 3286
+3  806 3667 7032
+3  7032 3286 806
+3  803 3280 7032
+3  7032 3667 803
+3  799 3668 7033
+3  7033 3288 799
+3  796 3291 7033
+3  7033 3668 796
+3  3669 7033 3291
+3  3291 805 3669
+3  3288 7033 3669
+3  3669 806 3288
+3  3670 7034 3672
+3  3672 800 3670
+3  3214 7034 3670
+3  3670 801 3214
+3  3671 7034 3214
+3  3214 1026 3671
+3  1024 3672 7034
+3  7034 3671 1024
+3  3673 7035 3290
+3  3290 802 3673
+3  3253 7035 3673
+3  3673 800 3253
+3  804 3674 7035
+3  7035 3253 804
+3  805 3290 7035
+3  7035 3674 805
+3  796 3675 7036
+3  7036 3289 796
+3  797 3676 7036
+3  7036 3675 797
+3  3677 7036 3676
+3  3676 801 3677
+3  3289 7036 3677
+3  3677 802 3289
+3  808 3293 3679
+3  434 3678 3293
+3  432 3679 3678
+3  3679 3293 3678
+3  808 3680 7037
+3  7037 3294 808
+3  809 3297 7037
+3  7037 3680 809
+3  3681 7037 3297
+3  3297 810 3681
+3  811 3294 7037
+3  7037 3681 811
+3  3682 7038 3295
+3  3295 811 3682
+3  3300 7038 3682
+3  3682 812 3300
+3  436 3683 7038
+3  7038 3300 436
+3  433 3295 7038
+3  7038 3683 433
+3  3684 7039 3301
+3  3301 812 3684
+3  810 3296 7039
+3  7039 3684 810
+3  1006 3685 7039
+3  7039 3296 1006
+3  1004 3301 7039
+3  7039 3685 1004
+3  426 3686 7040
+3  7040 3303 426
+3  820 3307 7040
+3  7040 3686 820
+3  3687 7040 3307
+3  3307 821 3687
+3  3303 7040 3687
+3  3687 822 3303
+3  3688 7041 3306
+3  3306 457 3688
+3  458 3310 7041
+3  7041 3688 458
+3  824 3689 7041
+3  7041 3310 824
+3  821 3306 7041
+3  7041 3689 821
+3  3690 7042 3304
+3  3304 822 3690
+3  823 3314 7042
+3  7042 3690 823
+3  1008 3691 7042
+3  7042 3314 1008
+3  425 3304 7042
+3  7042 3691 425
+3  3692 7043 3694
+3  3694 1004 3692
+3  1005 3317 7043
+3  7043 3692 1005
+3  1011 3693 7043
+3  7043 3317 1011
+3  3694 7043 3693
+3  3693 1012 3694
+3  1007 3695 7044
+3  7044 3320 1007
+3  1008 3313 7044
+3  7044 3695 1008
+3  1010 3696 7044
+3  7044 3313 1010
+3  3320 7044 3696
+3  3696 1011 3320
+3  1012 3697 7045
+3  7045 3699 1012
+3  1009 3321 7045
+3  7045 3697 1009
+3  1030 3698 7045
+3  7045 3321 1030
+3  3699 7045 3698
+3  3698 435 3699
+3  1161 3700 3701
+3  1030 3324 3700
+3  829 3701 3324
+3  3701 3700 3324
+3  3702 7046 3311
+3  3311 458 3702
+3  3703 7046 3702
+3  3702 455 3703
+3  3704 7046 3703
+3  3703 1013 3704
+3  3311 7046 3704
+3  3704 1014 3311
+3  3705 7047 3707
+3  3707 720 3705
+3  721 3179 7047
+3  7047 3705 721
+3  1016 3706 7047
+3  7047 3179 1016
+3  3707 7047 3706
+3  3706 1013 3707
+3  3708 7048 3328
+3  3328 1015 3708
+3  3178 7048 3708
+3  3708 1016 3178
+3  440 3709 7048
+3  7048 3178 440
+3  437 3328 7048
+3  7048 3709 437
+3  3710 7049 3316
+3  3316 825 3710
+3  3322 7049 3710
+3  3710 826 3322
+3  1009 3711 7049
+3  7049 3322 1009
+3  1010 3316 7049
+3  7049 3711 1010
+3  3712 7050 3315
+3  3315 823 3712
+3  3309 7050 3712
+3  3712 824 3309
+3  828 3713 7050
+3  7050 3309 828
+3  825 3315 7050
+3  7050 3713 825
+3  827 3714 7051
+3  7051 3327 827
+3  828 3312 7051
+3  7051 3714 828
+3  3715 7051 3312
+3  3312 1014 3715
+3  3327 7051 3715
+3  3715 1015 3327
+3  826 3716 7052
+3  7052 3323 826
+3  827 3326 7052
+3  7052 3716 827
+3  438 3717 7052
+3  7052 3326 438
+3  3323 7052 3717
+3  3717 829 3323
+3  606 3718 7053
+3  7053 3720 606
+3  607 3150 7053
+3  7053 3718 607
+3  3719 7053 3150
+3  3150 991 3719
+3  992 3720 7053
+3  7053 3719 992
+3  3721 7054 3149
+3  3149 600 3721
+3  3152 7054 3721
+3  3721 601 3152
+3  990 3722 7054
+3  7054 3152 990
+3  991 3149 7054
+3  7054 3722 991
+3  3723 7055 3229
+3  3229 891 3723
+3  3275 7055 3723
+3  3723 889 3275
+3  927 3724 7055
+3  7055 3275 927
+3  928 3229 7055
+3  7055 3724 928
+3  622 3725 3727
+3  1001 3726 3725
+3  857 3727 3726
+3  3727 3725 3726
+3  869 3333 3729
+3  1000 3728 3333
+3  623 3729 3728
+3  3729 3333 3728
+3  3730 7056 3163
+3  3163 615 3730
+3  3338 7056 3730
+3  3730 616 3338
+3  949 3731 7056
+3  7056 3338 949
+3  950 3163 7056
+3  7056 3731 950
+3  3732 7057 3085
+3  3085 568 3732
+3  3090 7057 3732
+3  3732 569 3090
+3  1077 3733 7057
+3  7057 3090 1077
+3  1074 3085 7057
+3  7057 3733 1074
+3  611 3734 7058
+3  7058 3089 611
+3  612 3161 7058
+3  7058 3734 612
+3  1076 3735 7058
+3  7058 3161 1076
+3  3089 7058 3735
+3  3735 1077 3089
+3  3736 7059 3160
+3  3160 950 3736
+3  3737 7059 3736
+3  3736 951 3737
+3  1075 3738 7059
+3  7059 3737 1075
+3  1076 3160 7059
+3  7059 3738 1076
+3  3739 7060 3337
+3  3337 870 3739
+3  871 3342 7060
+3  7060 3739 871
+3  951 3740 7060
+3  7060 3342 951
+3  949 3337 7060
+3  7060 3740 949
+3  3741 7061 3743
+3  3743 876 3741
+3  3329 7061 3741
+3  3741 873 3329
+3  992 3742 7061
+3  7061 3329 992
+3  989 3743 7061
+3  7061 3742 989
+3  3744 7062 3746
+3  3746 863 3744
+3  861 3349 7062
+3  7062 3744 861
+3  875 3745 7062
+3  7062 3349 875
+3  876 3746 7062
+3  7062 3745 876
+3  874 3747 7063
+3  7063 3355 874
+3  875 3352 7063
+3  7063 3747 875
+3  3748 7063 3352
+3  3352 880 3748
+3  3355 7063 3748
+3  3748 877 3355
+3  3749 7064 3359
+3  3359 952 3749
+3  953 3750 7064
+3  7064 3749 953
+3  1102 3751 7064
+3  7064 3750 1102
+3  1103 3359 7064
+3  7064 3751 1103
+3  878 3752 7065
+3  7065 3363 878
+3  879 3366 7065
+3  7065 3752 879
+3  884 3753 7065
+3  7065 3366 884
+3  3363 7065 3753
+3  3753 881 3363
+3  3754 7066 3757
+3  3757 882 3754
+3  3755 7066 3754
+3  3754 883 3755
+3  955 3756 7066
+3  7066 3755 955
+3  952 3757 7066
+3  7066 3756 952
+3  3758 7067 3373
+3  3373 866 3758
+3  867 3759 7067
+3  7067 3758 867
+3  945 3760 7067
+3  7067 3759 945
+3  946 3373 7067
+3  7067 3760 946
+3  616 3761 7068
+3  7068 3339 616
+3  617 3377 7068
+3  7068 3761 617
+3  903 3762 7068
+3  7068 3377 903
+3  3339 7068 3762
+3  3762 904 3339
+3  905 3763 7069
+3  7069 3380 905
+3  906 3374 7069
+3  7069 3763 906
+3  3764 7069 3374
+3  3374 946 3764
+3  947 3380 7069
+3  7069 3764 947
+3  3765 7070 3340
+3  3340 904 3765
+3  3383 7070 3765
+3  3765 905 3383
+3  930 3766 7070
+3  7070 3383 930
+3  931 3340 7070
+3  7070 3766 931
+3  869 3767 7071
+3  7071 3334 869
+3  868 3385 7071
+3  7071 3767 868
+3  932 3768 7071
+3  7071 3385 932
+3  3334 7071 3768
+3  3768 933 3334
+3  872 3769 7072
+3  7072 3384 872
+3  870 3336 7072
+3  7072 3769 870
+3  931 3770 7072
+3  7072 3336 931
+3  3384 7072 3770
+3  3770 932 3384
+3  885 3771 7073
+3  7073 3332 885
+3  3772 7073 3771
+3  3771 886 3772
+3  1001 3773 7073
+3  7073 3772 1001
+3  1000 3332 7073
+3  7073 3773 1000
+3  888 3774 7074
+3  7074 3382 888
+3  885 3335 7074
+3  7074 3774 885
+3  3775 7074 3335
+3  3335 933 3775
+3  3382 7074 3775
+3  3775 930 3382
+3  3776 7075 3778
+3  3778 887 3776
+3  3381 7075 3776
+3  3776 888 3381
+3  3777 7075 3381
+3  3381 947 3777
+3  3778 7075 3777
+3  3777 948 3778
+3  954 3779 7076
+3  7076 3781 954
+3  955 3371 7076
+3  7076 3779 955
+3  3780 7076 3371
+3  3371 1083 3780
+3  3781 7076 3780
+3  3780 1084 3781
+3  3782 7077 3350
+3  3350 861 3782
+3  862 3390 7077
+3  7077 3782 862
+3  907 3783 7077
+3  7077 3390 907
+3  908 3350 7077
+3  7077 3783 908
+3  3784 7078 3367
+3  3367 879 3784
+3  3351 7078 3784
+3  3784 880 3351
+3  908 3785 7078
+3  7078 3351 908
+3  909 3367 7078
+3  7078 3785 909
+3  883 3786 7079
+3  7079 3788 883
+3  884 3365 7079
+3  7079 3786 884
+3  956 3787 7079
+3  7079 3365 956
+3  3788 7079 3787
+3  3787 957 3788
+3  909 3789 7080
+3  7080 3368 909
+3  910 3396 7080
+3  7080 3789 910
+3  3790 7080 3396
+3  3396 958 3790
+3  3368 7080 3790
+3  3790 956 3368
+3  3791 7081 3370
+3  3370 892 3791
+3  893 3398 7081
+3  7081 3791 893
+3  1082 3792 7081
+3  7081 3398 1082
+3  1083 3370 7081
+3  7081 3792 1083
+3  3793 7082 3395
+3  3395 894 3793
+3  892 3794 7082
+3  7082 3793 892
+3  957 3795 7082
+3  7082 3794 957
+3  3395 7082 3795
+3  3795 958 3395
+3  3796 7083 3348
+3  3348 989 3796
+3  3151 7083 3796
+3  3796 990 3151
+3  995 3797 7083
+3  7083 3151 995
+3  996 3348 7083
+3  7083 3797 996
+3  3798 7084 3154
+3  3154 604 3798
+3  605 3227 7084
+3  7084 3798 605
+3  994 3799 7084
+3  7084 3227 994
+3  995 3154 7084
+3  7084 3799 995
+3  3800 7085 3391
+3  3391 862 3800
+3  863 3346 7085
+3  7085 3800 863
+3  961 3801 7085
+3  7085 3346 961
+3  3391 7085 3801
+3  3801 959 3391
+3  960 3802 7086
+3  7086 3401 960
+3  961 3345 7086
+3  7086 3802 961
+3  996 3803 7086
+3  7086 3345 996
+3  3401 7086 3803
+3  3803 993 3401
+3  3804 7087 3404
+3  3404 899 3804
+3  3392 7087 3804
+3  3804 900 3392
+3  3805 7087 3392
+3  3392 959 3805
+3  960 3404 7087
+3  7087 3805 960
+3  3806 7088 3399
+3  3399 893 3806
+3  894 3394 7088
+3  7088 3806 894
+3  901 3807 7088
+3  7088 3394 901
+3  902 3399 7088
+3  7088 3807 902
+3  900 3808 7089
+3  7089 3389 900
+3  901 3393 7089
+3  7089 3808 901
+3  910 3809 7089
+3  7089 3393 910
+3  3389 7089 3809
+3  3809 907 3389
+3  895 3810 7090
+3  7090 3226 895
+3  896 3402 7090
+3  7090 3810 896
+3  993 3811 7090
+3  7090 3402 993
+3  3226 7090 3811
+3  3811 994 3226
+3  898 3812 7091
+3  7091 3814 898
+3  895 3225 7091
+3  7091 3812 895
+3  3813 7091 3225
+3  3225 928 3813
+3  929 3814 7091
+3  7091 3813 929
+3  897 3815 7092
+3  7092 3397 897
+3  898 3816 7092
+3  7092 3815 898
+3  3817 7092 3816
+3  3816 1085 3817
+3  3397 7092 3817
+3  3817 1082 3397
+3  3818 7093 3403
+3  3403 896 3818
+3  3400 7093 3818
+3  3818 897 3400
+3  902 3819 7093
+3  7093 3400 902
+3  899 3403 7093
+3  7093 3819 899
+3  3820 7094 3330
+3  3330 873 3820
+3  3354 7094 3820
+3  3820 874 3354
+3  3821 7094 3354
+3  3354 963 3821
+3  964 3330 7094
+3  7094 3821 964
+3  609 3822 7095
+3  7095 3104 609
+3  606 3823 7095
+3  7095 3822 606
+3  985 3824 7095
+3  7095 3823 985
+3  3104 7095 3824
+3  3824 986 3104
+3  3825 7096 3827
+3  3827 964 3825
+3  962 3405 7096
+3  7096 3825 962
+3  988 3826 7096
+3  7096 3405 988
+3  985 3827 7096
+3  7096 3826 985
+3  3828 7097 3111
+3  3111 578 3828
+3  3101 7097 3828
+3  3828 575 3101
+3  986 3829 7097
+3  7097 3101 986
+3  987 3111 7097
+3  7097 3829 987
+3  3830 7098 3408
+3  3408 919 3830
+3  3112 7098 3830
+3  3830 920 3112
+3  987 3831 7098
+3  7098 3112 987
+3  988 3408 7098
+3  7098 3831 988
+3  3832 7099 3119
+3  3119 582 3832
+3  3109 7099 3832
+3  3832 579 3109
+3  920 3833 7099
+3  7099 3109 920
+3  921 3119 7099
+3  7099 3833 921
+3  921 3834 7100
+3  7100 3120 921
+3  922 3409 7100
+3  7100 3834 922
+3  1093 3835 7100
+3  7100 3409 1093
+3  3120 7100 3835
+3  3835 1094 3120
+3  3836 7101 3838
+3  3838 1095 3836
+3  3360 7101 3836
+3  3836 1096 3360
+3  1103 3837 7101
+3  7101 3360 1103
+3  1104 3838 7101
+3  7101 3837 1104
+3  3839 7102 3841
+3  3841 585 3839
+3  583 3117 7102
+3  7102 3839 583
+3  1094 3840 7102
+3  7102 3117 1094
+3  1095 3841 7102
+3  7102 3840 1095
+3  1096 3842 7103
+3  7103 3357 1096
+3  1093 3412 7103
+3  7103 3842 1093
+3  3843 7103 3412
+3  3412 1097 3843
+3  1098 3357 7103
+3  7103 3843 1098
+3  3844 7104 3364
+3  3364 881 3844
+3  3845 7104 3844
+3  3844 882 3845
+3  3846 7104 3845
+3  3845 1098 3846
+3  1099 3364 7104
+3  7104 3846 1099
+3  3847 7105 3356
+3  3356 877 3847
+3  3362 7105 3847
+3  3847 878 3362
+3  911 3848 7105
+3  7105 3362 911
+3  912 3356 7105
+3  7105 3848 912
+3  914 3849 7106
+3  7106 3411 914
+3  911 3361 7106
+3  7106 3849 911
+3  3850 7106 3361
+3  3361 1099 3850
+3  3411 7106 3850
+3  3850 1097 3411
+3  913 3851 7107
+3  7107 3407 913
+3  914 3410 7107
+3  7107 3851 914
+3  922 3852 7107
+3  7107 3410 922
+3  3407 7107 3852
+3  3852 919 3407
+3  912 3853 7108
+3  7108 3353 912
+3  913 3406 7108
+3  7108 3853 913
+3  3854 7108 3406
+3  3406 962 3854
+3  963 3353 7108
+3  7108 3854 963
+3  3855 7109 3166
+3  3166 613 3855
+3  3097 7109 3855
+3  3855 610 3097
+3  981 3856 7109
+3  7109 3097 981
+3  982 3166 7109
+3  7109 3856 982
+3  3857 7110 3100
+3  3100 576 3857
+3  3106 7110 3857
+3  3857 577 3106
+3  984 3858 7110
+3  7110 3106 984
+3  981 3100 7110
+3  7110 3858 981
+3  982 3859 7111
+3  7111 3167 982
+3  983 3419 7111
+3  7111 3859 983
+3  3860 7111 3419
+3  3419 1071 3860
+3  1072 3167 7111
+3  7111 3860 1072
+3  3861 7112 3378
+3  3378 617 3861
+3  3164 7112 3861
+3  3861 614 3164
+3  3862 7112 3164
+3  3164 1072 3862
+3  1073 3378 7112
+3  7112 3862 1073
+3  3863 7113 3865
+3  3865 1088 3863
+3  3416 7113 3863
+3  3863 1089 3416
+3  1104 3864 7113
+3  7113 3416 1104
+3  1105 3865 7113
+3  7113 3864 1105
+3  3866 7114 3869
+3  3869 865 3866
+3  3867 7114 3866
+3  3866 866 3867
+3  1087 3868 7114
+3  7114 3867 1087
+3  1088 3869 7114
+3  7114 3868 1088
+3  1089 3870 7115
+3  7115 3413 1089
+3  1086 3421 7115
+3  7115 3870 1086
+3  1090 3871 7115
+3  7115 3421 1090
+3  3413 7115 3871
+3  3871 1091 3413
+3  3872 7116 3116
+3  3116 584 3872
+3  585 3414 7116
+3  7116 3872 585
+3  1091 3873 7116
+3  7116 3414 1091
+3  1092 3116 7116
+3  7116 3873 1092
+3  923 3874 7117
+3  7117 3105 923
+3  924 3420 7117
+3  7117 3874 924
+3  983 3875 7117
+3  7117 3420 983
+3  3105 7117 3875
+3  3875 984 3105
+3  3876 7118 3108
+3  3108 580 3876
+3  3114 7118 3876
+3  3876 581 3114
+3  926 3877 7118
+3  7118 3114 926
+3  923 3108 7118
+3  7118 3877 923
+3  3878 7119 3424
+3  3424 925 3878
+3  3113 7119 3878
+3  3878 926 3113
+3  3879 7119 3113
+3  3113 1092 3879
+3  1090 3424 7119
+3  7119 3879 1090
+3  915 3880 7120
+3  7120 3418 915
+3  916 3379 7120
+3  7120 3880 916
+3  3881 7120 3379
+3  3379 1073 3881
+3  1071 3418 7120
+3  7120 3881 1071
+3  918 3882 7121
+3  7121 3423 918
+3  915 3417 7121
+3  7121 3882 915
+3  924 3883 7121
+3  7121 3417 924
+3  3423 7121 3883
+3  3883 925 3423
+3  3884 7122 3886
+3  3886 917 3884
+3  3422 7122 3884
+3  3884 918 3422
+3  3885 7122 3422
+3  3422 1086 3885
+3  1087 3886 7122
+3  7122 3885 1087
+3  906 3887 7123
+3  7123 3375 906
+3  903 3376 7123
+3  7123 3887 903
+3  916 3888 7123
+3  7123 3376 916
+3  3375 7123 3888
+3  3888 917 3375
+3  753 3889 7124
+3  7124 3891 753
+3  754 3242 7124
+3  7124 3889 754
+3  935 3890 7124
+3  7124 3242 935
+3  3891 7124 3890
+3  3890 936 3891
+3  3892 7125 3146
+3  3146 936 3892
+3  934 3425 7125
+3  7125 3892 934
+3  1113 3893 7125
+3  7125 3425 1113
+3  3146 7125 3893
+3  3893 1114 3146
+3  602 3894 7126
+3  7126 3158 602
+3  599 3143 7126
+3  7126 3894 599
+3  1114 3895 7126
+3  7126 3143 1114
+3  3158 7126 3895
+3  3895 1115 3158
+3  3896 7127 3233
+3  3233 749 3896
+3  750 3897 7127
+3  7127 3896 750
+3  1109 3898 7127
+3  7127 3897 1109
+3  1106 3233 7127
+3  7127 3898 1106
+3  3899 7128 3901
+3  3901 889 3899
+3  890 3155 7128
+3  7128 3899 890
+3  1108 3900 7128
+3  7128 3155 1108
+3  1109 3901 7128
+3  7128 3900 1109
+3  3902 7129 3428
+3  3428 1107 3902
+3  3159 7129 3902
+3  3902 1108 3159
+3  3903 7129 3159
+3  3159 1115 3903
+3  1113 3428 7129
+3  7129 3903 1113
+3  3904 7130 3427
+3  3427 941 3904
+3  942 3230 7130
+3  7130 3904 942
+3  1106 3905 7130
+3  7130 3230 1106
+3  1107 3427 7130
+3  7130 3905 1107
+3  943 3906 7131
+3  7131 3218 943
+3  944 3216 7131
+3  7131 3906 944
+3  2431 7131 3216
+3  3216 1124 2431
+3  3218 7131 2431
+3  2431 1125 3218
+3  746 3907 7132
+3  7132 3220 746
+3  747 3231 7132
+3  7132 3907 747
+3  942 3908 7132
+3  7132 3231 942
+3  3220 7132 3908
+3  3908 943 3220
+3  3909 7133 3911
+3  3911 937 3909
+3  3217 7133 3909
+3  3909 938 3217
+3  944 3910 7133
+3  7133 3217 944
+3  941 3911 7133
+3  7133 3910 941
+3  3912 7134 3914
+3  3914 934 3912
+3  935 3241 7134
+3  7134 3912 935
+3  940 3913 7134
+3  7134 3241 940
+3  937 3914 7134
+3  7134 3913 937
+3  3915 7135 3244
+3  3244 756 3915
+3  3251 7135 3915
+3  3915 757 3251
+3  939 3916 7135
+3  7135 3251 939
+3  940 3244 7135
+3  7135 3916 940
+3  2449 7136 3250
+3  3250 736 2449
+3  735 3215 7136
+3  7136 2449 735
+3  938 3917 7136
+3  7136 3215 938
+3  939 3250 7136
+3  7136 3917 939
+3  3918 7137 3171
+3  3171 965 3918
+3  3240 7137 3918
+3  3918 966 3240
+3  3919 7137 3240
+3  3240 1060 3919
+3  3171 7137 3919
+3  3919 1061 3171
+3  968 3920 7138
+3  7138 3431 968
+3  965 3170 7138
+3  7138 3920 965
+3  447 3921 7138
+3  7138 3170 447
+3  3431 7138 3921
+3  3921 448 3431
+3  3922 7139 3247
+3  3247 755 3922
+3  3237 7139 3922
+3  3922 752 3237
+3  966 3923 7139
+3  7139 3237 966
+3  967 3247 7139
+3  7139 3923 967
+3  967 3924 7140
+3  7140 3248 967
+3  968 3430 7140
+3  7140 3924 968
+3  1136 3925 7140
+3  7140 3430 1136
+3  3248 7140 3925
+3  3925 1137 3248
+3  3926 7141 3434
+3  3434 217 3926
+3  598 3927 7141
+3  7141 3926 598
+3  1034 3928 7141
+3  7141 3927 1034
+3  1035 3434 7141
+3  7141 3928 1035
+3  3929 7142 3931
+3  3931 597 3929
+3  595 3136 7142
+3  7142 3929 595
+3  1033 3930 7142
+3  7142 3136 1033
+3  1034 3931 7142
+3  7142 3930 1034
+3  3932 7143 3139
+3  3139 972 3932
+3  973 3437 7143
+3  7143 3932 973
+3  1032 3933 7143
+3  7143 3437 1032
+3  1033 3139 7143
+3  7143 3933 1033
+3  3934 7144 3138
+3  3138 594 3934
+3  3184 7144 3934
+3  3934 591 3184
+3  975 3935 7144
+3  7144 3184 975
+3  972 3138 7144
+3  7144 3935 972
+3  3936 7145 3183
+3  3183 730 3936
+3  731 3200 7145
+3  7145 3936 731
+3  974 3937 7145
+3  7145 3200 974
+3  3183 7145 3937
+3  3937 975 3183
+3  3938 7146 3438
+3  3438 973 3938
+3  3199 7146 3938
+3  3938 974 3199
+3  3939 7146 3199
+3  3199 977 3939
+3  978 3438 7146
+3  7146 3939 978
+3  1035 3940 7147
+3  7147 3435 1035
+3  1032 3436 7147
+3  7147 3940 1032
+3  1117 3941 7147
+3  7147 3436 1117
+3  3435 7147 3941
+3  3941 1139 3435
+3  3942 7148 3439
+3  3439 978 3942
+3  976 2297 7148
+3  7148 3942 976
+3  1116 3943 7148
+3  7148 2297 1116
+3  1117 3439 7148
+3  7148 3943 1117
+3  1138 3944 2441
+3  1116 2300 3944
+3  980 2441 2300
+3  2441 3944 2300
+3  624 3945 3946
+3  1054 3386 3945
+3  868 3946 3386
+3  3946 3945 3386
+3  1003 3441 3948
+3  1053 3947 3441
+3  625 3948 3947
+3  3948 3441 3947
+3  740 3949 7149
+3  7149 3210 740
+3  741 3212 7149
+3  7149 3949 741
+3  3950 7149 3212
+3  3212 1127 3950
+3  1128 3210 7149
+3  7149 3950 1128
+3  797 3951 7150
+3  7150 3954 797
+3  798 3952 7150
+3  7150 3951 798
+3  1040 3953 7150
+3  7150 3952 1040
+3  3954 7150 3953
+3  3953 1041 3954
+3  1041 3955 7151
+3  7151 3957 1041
+3  1042 3444 7151
+3  7151 3955 1042
+3  3956 7151 3444
+3  3444 1126 3956
+3  1127 3957 7151
+3  7151 3956 1127
+3  3958 7152 3448
+3  3448 1043 3958
+3  1040 3959 7152
+3  7152 3958 1040
+3  1135 3960 7152
+3  7152 3959 1135
+3  3448 7152 3960
+3  3960 1133 3448
+3  1042 3961 7153
+3  7153 3445 1042
+3  1043 3447 7153
+3  7153 3961 1043
+3  3962 7153 3447
+3  3447 1129 3962
+3  3445 7153 3962
+3  3962 1130 3445
+3  1132 3963 7154
+3  7154 3451 1132
+3  1129 3449 7154
+3  7154 3963 1129
+3  3964 7154 3449
+3  3449 1133 3964
+3  3451 7154 3964
+3  3964 1134 3451
+3  3965 7155 3207
+3  3207 1128 3965
+3  3446 7155 3965
+3  3965 1126 3446
+3  1130 3966 7155
+3  7155 3446 1130
+3  1131 3207 7155
+3  7155 3966 1131
+3  1120 2433 7156
+3  7156 3450 1120
+3  1121 3208 7156
+3  7156 2433 1121
+3  3967 7156 3208
+3  3208 1131 3967
+3  3450 7156 3967
+3  3967 1132 3450
+3  3968 7157 3970
+3  3970 1044 3968
+3  1045 3452 7157
+3  7157 3968 1045
+3  1134 3969 7157
+3  7157 3452 1134
+3  3970 7157 3969
+3  3969 1135 3970
+3  3971 7158 3269
+3  3269 777 3971
+3  778 3261 7158
+3  7158 3971 778
+3  1046 3972 7158
+3  7158 3261 1046
+3  3269 7158 3972
+3  3972 1044 3269
+3  1045 3973 7159
+3  7159 3453 1045
+3  3264 7159 3973
+3  3973 1046 3264
+3  1123 2432 7159
+3  7159 3264 1123
+3  3453 7159 2432
+3  2432 1122 3453
+3  3974 7160 3976
+3  3976 1062 3974
+3  1063 3082 7160
+3  7160 3974 1063
+3  1074 3975 7160
+3  7160 3082 1074
+3  1075 3976 7160
+3  7160 3975 1075
+3  3977 7161 3077
+3  3077 564 3977
+3  3083 7161 3977
+3  3977 565 3083
+3  3978 7161 3083
+3  3083 1063 3978
+3  1064 3077 7161
+3  7161 3978 1064
+3  562 3075 3980
+3  1070 3979 3075
+3  2101 3980 3979
+3  3980 3075 3979
+3  1064 3981 7162
+3  7162 3074 1064
+3  1065 3454 7162
+3  7162 3981 1065
+3  446 3982 7162
+3  7162 3454 446
+3  3074 7162 3982
+3  3982 1070 3074
+3  657 3983 7163
+3  7163 3985 657
+3  656 3060 7163
+3  7163 3983 656
+3  3984 7163 3060
+3  3060 1156 3984
+3  3985 7163 3984
+3  3984 1069 3985
+3  1003 3986 7164
+3  7164 3442 1003
+3  1002 3987 7164
+3  7164 3986 1002
+3  3988 7164 3987
+3  3987 1066 3988
+3  1067 3442 7164
+3  7164 3988 1067
+3  3989 7165 3456
+3  3456 1068 3989
+3  1066 3990 7165
+3  7165 3989 1066
+3  1069 3991 7165
+3  7165 3990 1069
+3  445 3456 7165
+3  7165 3991 445
+3  3992 7166 3343
+3  3343 871 3992
+3  3388 7166 3992
+3  3992 872 3388
+3  1055 3993 7166
+3  7166 3388 1055
+3  1056 3343 7166
+3  7166 3993 1056
+3  1054 3994 7167
+3  7167 3387 1054
+3  1053 3440 7167
+3  7167 3994 1053
+3  1058 3995 7167
+3  7167 3440 1058
+3  3387 7167 3995
+3  3995 1055 3387
+3  3996 7168 3998
+3  3998 1057 3996
+3  3443 7168 3996
+3  3996 1058 3443
+3  1067 3997 7168
+3  7168 3443 1067
+3  1068 3998 7168
+3  7168 3997 1068
+3  1056 3999 7169
+3  7169 3344 1056
+3  1057 4000 7169
+3  7169 3999 1057
+3  4001 7169 4000
+3  4000 1065 4001
+3  3344 7169 4001
+3  4001 1062 3344
+3  813 4002 7170
+3  7170 3299 813
+3  814 3318 7170
+3  7170 4002 814
+3  4003 7170 3318
+3  3318 1005 4003
+3  1006 3299 7170
+3  7170 4003 1006
+3  430 4004 4005
+3  813 3298 4004
+3  809 4005 3298
+3  4005 4004 3298
+3  428 4006 4007
+3  1007 3319 4006
+3  814 4007 3319
+3  4007 4006 3319
+3  3245 7171 3597
+3  3597 758 3245
+3  1137 4008 7171
+3  7171 3245 1137
+3  1051 2386 7171
+3  7171 4008 1051
+3  3597 7171 2386
+3  2386 759 3597
+3  3925 7172 4008
+3  4008 1137 3925
+3  1136 4009 7172
+3  7172 3925 1136
+3  1052 2435 7172
+3  7172 4009 1052
+3  4008 7172 2435
+3  2435 1051 4008
+3  3429 7173 4009
+3  4009 1136 3429
+3  449 4010 7173
+3  7173 3429 449
+3  450 2390 7173
+3  7173 4010 450
+3  4009 7173 2390
+3  2390 1052 4009
+3  444 3168 7174
+3  7174 4011 444
+3  3582 7174 3168
+3  3168 1061 3582
+3  618 3519 7174
+3  7174 3582 618
+3  443 4011 7174
+3  7174 3519 443
+3  934 3914 3426
+3  937 3911 3914
+3  941 3426 3911
+3  3426 3914 3911
+3  1112 3592 3145
+3  753 3891 3592
+3  936 3145 3891
+3  3145 3592 3891
+3  599 3504 3144
+3  1078 3590 3504
+3  1112 3144 3590
+3  3144 3504 3590
+3  1059 3587 7175
+3  7175 3584 1059
+3  3086 7175 3587
+3  3587 1111 3086
+3  567 3470 7175
+3  7175 3086 567
+3  3517 7175 3470
+3  3470 566 3517
+3  3584 7175 3517
+3  3517 620 3584
+3  1066 3987 7176
+3  7176 3990 1066
+3  1002 4012 7176
+3  7176 3987 1002
+3  657 3985 7176
+3  7176 4012 657
+3  3990 7176 3985
+3  3985 1069 3990
+3  1065 4000 3455
+3  1057 3998 4000
+3  1068 3455 3998
+3  3455 4000 3998
+3  3369 7177 3794
+3  3794 892 3369
+3  3755 7177 3369
+3  3369 955 3755
+3  883 3788 7177
+3  7177 3755 883
+3  957 3794 7177
+3  7177 3788 957
+3  1098 3845 3358
+3  882 3757 3845
+3  952 3358 3757
+3  3358 3845 3757
+3  585 3841 3415
+3  1095 3838 3841
+3  1104 3415 3838
+3  3415 3841 3838
+3  917 3886 3372
+3  1087 3867 3886
+3  866 3372 3867
+3  3372 3886 3867
+3  1062 3976 3341
+3  1075 3737 3976
+3  951 3341 3737
+3  3341 3976 3737
+3  3128 7178 3601
+3  3601 767 3128
+3  3486 7178 3128
+3  3128 971 3486
+3  459 3483 7178
+3  7178 3486 459
+3  590 3601 7178
+3  7178 3483 590
+3  1021 3553 3131
+3  592 3490 3553
+3  971 3131 3490
+3  3131 3553 3490
+3  3211 7179 3957
+3  3957 1127 3211
+3  3676 7179 3211
+3  3211 801 3676
+3  3954 7179 3676
+3  3676 797 3954
+3  1041 3957 7179
+3  7179 3954 1041
+3  4013 7180 3662
+3  3662 793 4013
+3  1135 3959 7180
+3  7180 4013 1135
+3  1040 3952 7180
+3  7180 3959 1040
+3  3662 7180 3952
+3  3952 798 3662
+3  3236 7181 3617
+3  3617 771 3236
+3  784 3632 7181
+3  7181 3236 784
+3  751 3579 7181
+3  7181 3632 751
+3  3617 7181 3579
+3  3579 748 3617
+3  4014 7182 3547
+3  3547 713 4014
+3  3540 7182 4014
+3  4014 598 3540
+3  1031 3550 7182
+3  7182 3540 1031
+3  718 3547 7182
+3  7182 3550 718
+3  3189 7183 3570
+3  3570 724 3189
+3  3609 7183 3189
+3  3189 761 3609
+3  1025 3573 7183
+3  7183 3609 1025
+3  3570 7183 3573
+3  3573 742 3570
+3  1044 3970 3270
+3  1135 4013 3970
+3  793 3270 4013
+3  3270 3970 4013
+3  792 3655 3268
+3  781 3629 3655
+3  777 3268 3629
+3  3268 3655 3629
+3  3234 7184 3651
+3  3651 788 3234
+3  3625 7184 3234
+3  3234 771 3625
+3  780 3657 7184
+3  7184 3625 780
+3  790 3651 7184
+3  7184 3657 790
+3  4015 7185 3614
+3  3614 769 4015
+3  3672 7185 4015
+3  4015 800 3672
+3  1024 3607 7185
+3  7185 3672 1024
+3  762 3614 7185
+3  7185 3607 762
+3  4016 7186 3653
+3  3653 791 4016
+3  3645 7186 4016
+3  4016 1048 3645
+3  3638 7186 3645
+3  3645 1027 3638
+3  3653 7186 3638
+3  3638 787 3653
+3  785 3272 7187
+3  7187 3634 785
+3  889 3901 7187
+3  7187 3272 889
+3  3897 7187 3901
+3  3901 1109 3897
+3  750 3634 7187
+3  7187 3897 750
+3  465 3493 3072
+3  816 3531 3493
+3  714 3072 3531
+3  3072 3493 3531
+3  3066 7188 3461
+3  3461 469 3066
+3  3707 7188 3066
+3  3066 720 3707
+3  1013 3703 7188
+3  7188 3707 1013
+3  455 3461 7188
+3  7188 3703 455
+3  598 4014 7189
+3  7189 3927 598
+3  3141 7189 4014
+3  4014 713 3141
+3  597 3931 7189
+3  7189 3141 597
+3  3927 7189 3931
+3  3931 1034 3927
+3  3302 7190 4017
+3  4017 436 3302
+3  1004 3694 7190
+3  7190 3302 1004
+3  1012 3699 7190
+3  7190 3694 1012
+3  4017 7190 3699
+3  3699 435 4017
+3  1048 4016 3279
+3  791 3660 4016
+3  794 3279 3660
+3  3279 4016 3660
+3  3254 7191 4018
+3  4018 424 3254
+3  800 4015 7191
+3  7191 3254 800
+3  769 3599 7191
+3  7191 4015 769
+3  423 4018 7191
+3  7191 3599 423
+3  3331 7192 3720
+3  3720 992 3331
+3  3827 7192 3331
+3  3331 964 3827
+3  985 3823 7192
+3  7192 3827 985
+3  606 3720 7192
+3  7192 3823 606
+3  863 3746 3347
+3  876 3743 3746
+3  989 3347 3743
+3  3347 3746 3743
+3  657 4012 7193
+3  7193 4021 657
+3  1002 4019 7193
+3  7193 4012 1002
+3  626 4020 7193
+3  7193 4019 626
+3  4021 7193 4020
+3  4020 627 4021
+3  860 4022 4024
+3  514 4023 4022
+3  692 4024 4023
+3  4024 4022 4023
+3  1134 3964 3969
+3  1133 3960 3964
+3  1135 3969 3960
+3  3969 3964 3960
+3  1131 3966 7194
+3  7194 3967 1131
+3  1130 3962 7194
+3  7194 3966 1130
+3  1129 3963 7194
+3  7194 3962 1129
+3  3967 7194 3963
+3  3963 1132 3967
+3  1127 3956 3950
+3  1126 3965 3956
+3  1128 3950 3965
+3  3950 3956 3965
+3  1116 3944 7195
+3  7195 3943 1116
+3  4025 7195 3944
+3  3944 1138 4025
+3  3941 7195 4025
+3  4025 1139 3941
+3  3943 7195 3941
+3  3941 1117 3943
+3  1114 3893 3895
+3  1113 3903 3893
+3  1115 3895 3903
+3  3895 3893 3903
+3  1111 3586 3589
+3  1110 3593 3586
+3  1112 3589 3593
+3  3589 3586 3593
+3  1108 3902 7196
+3  7196 3900 1108
+3  1107 3905 7196
+3  7196 3902 1107
+3  3898 7196 3905
+3  3905 1106 3898
+3  3900 7196 3898
+3  3898 1109 3900
+3  3837 7197 3864
+3  3864 1104 3837
+3  3751 7197 3837
+3  3837 1103 3751
+3  4026 7197 3751
+3  3751 1102 4026
+3  3864 7197 4026
+3  4026 1105 3864
+3  4027 7198 3522
+3  3522 412 4027
+3  3525 7198 4027
+3  4027 409 3525
+3  1100 4028 7198
+3  7198 3525 1100
+3  1101 3522 7198
+3  7198 4028 1101
+3  1098 3843 3846
+3  1097 3850 3843
+3  1099 3846 3850
+3  3846 3843 3850
+3  1095 3840 7199
+3  7199 3836 1095
+3  1094 3835 7199
+3  7199 3840 1094
+3  3842 7199 3835
+3  3835 1093 3842
+3  3836 7199 3842
+3  3842 1096 3836
+3  1091 3871 3873
+3  1090 3879 3871
+3  1092 3873 3879
+3  3873 3871 3879
+3  1088 3868 7200
+3  7200 3863 1088
+3  1087 3885 7200
+3  7200 3868 1087
+3  3870 7200 3885
+3  3885 1086 3870
+3  3863 7200 3870
+3  3870 1089 3863
+3  1084 3780 7201
+3  7201 4029 1084
+3  1083 3792 7201
+3  7201 3780 1083
+3  1082 3817 7201
+3  7201 3792 1082
+3  4029 7201 3817
+3  3817 1085 4029
+3  3501 7202 3510
+3  3510 1080 3501
+3  3588 7202 3501
+3  3501 1079 3588
+3  3503 7202 3588
+3  3588 1078 3503
+3  3510 7202 3503
+3  3503 1081 3510
+3  3738 7203 3735
+3  3735 1076 3738
+3  3975 7203 3738
+3  3738 1075 3975
+3  3733 7203 3975
+3  3975 1074 3733
+3  3735 7203 3733
+3  3733 1077 3735
+3  1072 3860 3862
+3  1071 3881 3860
+3  1073 3862 3881
+3  3862 3860 3881
+3  3921 7204 4032
+3  4032 448 3921
+3  447 4030 7204
+3  7204 3921 447
+3  1177 4031 7204
+3  7204 4030 1177
+3  4032 7204 4031
+3  4031 1158 4032
+3  4033 7205 3982
+3  3982 446 4033
+3  4034 7205 4033
+3  4033 1174 4034
+3  3979 7205 4034
+3  4034 2101 3979
+3  1070 3982 7205
+3  7205 3979 1070
+3  1069 3984 7206
+3  7206 3991 1069
+3  1156 4035 7206
+3  7206 3984 1156
+3  1173 4036 7206
+3  7206 4035 1173
+3  3991 7206 4036
+3  4036 445 3991
+3  1067 3988 3997
+3  1066 3989 3988
+3  1068 3997 3989
+3  3997 3988 3989
+3  3978 7207 3981
+3  3981 1064 3978
+3  3974 7207 3978
+3  3978 1063 3974
+3  1062 4001 7207
+3  7207 3974 1062
+3  3981 7207 4001
+3  4001 1065 3981
+3  1060 3585 3919
+3  1059 3583 3585
+3  1061 3919 3583
+3  3919 3585 3583
+3  1057 3999 7208
+3  7208 3996 1057
+3  1056 3993 7208
+3  7208 3999 1056
+3  1055 3995 7208
+3  7208 3993 1055
+3  3996 7208 3995
+3  3995 1058 3996
+3  4037 7209 3945
+3  3945 624 4037
+3  625 3947 7209
+3  7209 4037 625
+3  1053 3994 7209
+3  7209 3947 1053
+3  1054 3945 7209
+3  7209 3994 1054
+3  1049 3646 7210
+3  7210 4038 1049
+3  3649 7210 3646
+3  3646 1048 3649
+3  1047 3643 7210
+3  7210 3649 1047
+3  1050 4038 7210
+3  7210 3643 1050
+3  460 4039 7211
+3  7211 4042 460
+3  472 4040 7211
+3  7211 4039 472
+3  4041 7211 4040
+3  4040 420 4041
+3  422 4042 7211
+3  7211 4041 422
+3  461 4043 7212
+3  7212 4045 461
+3  473 4044 7212
+3  7212 4043 473
+3  472 4039 7212
+3  7212 4044 472
+3  4045 7212 4039
+3  4039 460 4045
+3  401 2860 7213
+3  7213 4048 401
+3  4046 7213 2860
+3  2860 324 4046
+3  464 4047 7213
+3  7213 4046 464
+3  467 4048 7213
+3  7213 4047 467
+3  405 2848 7214
+3  7214 4051 405
+3  404 4049 7214
+3  7214 2848 404
+3  426 4050 7214
+3  7214 4049 426
+3  4051 7214 4050
+3  4050 427 4051
+3  429 4052 7215
+3  7215 4053 429
+3  406 2845 7215
+3  7215 4052 406
+3  4051 7215 2845
+3  2845 405 4051
+3  427 4053 7215
+3  7215 4051 427
+3  2087 2838 7216
+3  7216 4056 2087
+3  407 4054 7216
+3  7216 2838 407
+3  431 4055 7216
+3  7216 4054 431
+3  4056 7216 4055
+3  4055 1143 4056
+3  1045 3968 3973
+3  1044 3972 3968
+3  1046 3973 3972
+3  3973 3968 3972
+3  1042 3955 7217
+3  7217 3961 1042
+3  1041 3953 7217
+3  7217 3955 1041
+3  3958 7217 3953
+3  3953 1040 3958
+3  1043 3961 7217
+3  7217 3958 1043
+3  1038 3560 7218
+3  7218 3564 1038
+3  1037 3556 7218
+3  7218 3560 1037
+3  3558 7218 3556
+3  3556 1036 3558
+3  3564 7218 3558
+3  3558 1039 3564
+3  1034 3930 7219
+3  7219 3928 1034
+3  3933 7219 3930
+3  3930 1033 3933
+3  3940 7219 3933
+3  3933 1032 3940
+3  1035 3928 7219
+3  7219 3940 1035
+3  2085 4057 7220
+3  7220 4058 2085
+3  439 3551 7220
+3  7220 4057 439
+3  3539 7220 3551
+3  3551 1031 3539
+3  1159 4058 7220
+3  7220 3539 1159
+3  1160 4059 7221
+3  7221 4061 1160
+3  437 3709 7221
+3  7221 4059 437
+3  440 4060 7221
+3  7221 3709 440
+3  4061 7221 4060
+3  4060 218 4061
+3  3698 7222 4063
+3  4063 435 3698
+3  1030 3700 7222
+3  7222 3698 1030
+3  1161 4062 7222
+3  7222 3700 1161
+3  4063 7222 4062
+3  4062 219 4063
+3  1028 3639 3641
+3  1027 3644 3639
+3  1029 3641 3644
+3  3641 3639 3644
+3  1025 3608 3574
+3  1024 3671 3608
+3  1026 3574 3671
+3  3574 3608 3671
+3  1022 3554 3555
+3  1021 3603 3554
+3  1023 3555 3603
+3  3555 3554 3603
+3  1019 3536 7223
+3  7223 3538 1019
+3  3534 7223 3536
+3  3536 1018 3534
+3  1017 3545 7223
+3  7223 3534 1017
+3  1020 3538 7223
+3  7223 3545 1020
+3  1015 3715 7224
+3  7224 3708 1015
+3  1014 3704 7224
+3  7224 3715 1014
+3  1013 3706 7224
+3  7224 3704 1013
+3  3708 7224 3706
+3  3706 1016 3708
+3  3696 7225 3693
+3  3693 1011 3696
+3  3711 7225 3696
+3  3696 1010 3711
+3  3697 7225 3711
+3  3711 1009 3697
+3  3693 7225 3697
+3  3697 1012 3693
+3  3695 7226 3691
+3  3691 1008 3695
+3  4006 7226 3695
+3  3695 1007 4006
+3  428 4064 7226
+3  7226 4006 428
+3  425 3691 7226
+3  7226 4064 425
+3  1005 3692 4003
+3  1004 3685 3692
+3  1006 4003 3685
+3  4003 3692 3685
+3  1141 4065 7227
+3  7227 4067 1141
+3  2086 4066 7227
+3  7227 4065 2086
+3  433 3683 7227
+3  7227 4066 433
+3  4067 7227 3683
+3  3683 436 4067
+3  628 4068 7228
+3  7228 4070 628
+3  230 4069 7228
+3  7228 4068 230
+3  3061 7228 4069
+3  4069 2100 3061
+3  656 4070 7228
+3  7228 3061 656
+3  659 4071 7229
+3  7229 4074 659
+3  2099 4072 7229
+3  7229 4071 2099
+3  1172 4073 7229
+3  7229 4072 1172
+3  4074 7229 4073
+3  4073 640 4074
+3  660 4075 7230
+3  7230 4077 660
+3  1171 4076 7230
+3  7230 4075 1171
+3  2099 4071 7230
+3  7230 4076 2099
+3  4077 7230 4071
+3  4071 659 4077
+3  664 4078 7231
+3  7231 4081 664
+3  1154 4079 7231
+3  7231 4078 1154
+3  2098 4080 7231
+3  7231 4079 2098
+3  4081 7231 4080
+3  4080 662 4081
+3  668 4082 7232
+3  7232 4085 668
+3  1153 4083 7232
+3  7232 4082 1153
+3  2097 4084 7232
+3  7232 4083 2097
+3  4085 7232 4084
+3  4084 666 4085
+3  672 4086 7233
+3  7233 4089 672
+3  1151 4087 7233
+3  7233 4086 1151
+3  1152 4088 7233
+3  7233 4087 1152
+3  4089 7233 4088
+3  4088 670 4089
+3  655 4090 7234
+3  7234 4092 655
+3  1170 4091 7234
+3  7234 4090 1170
+3  1151 4086 7234
+3  7234 4091 1151
+3  4092 7234 4086
+3  4086 672 4092
+3  4093 7235 3948
+3  3948 625 4093
+3  626 4019 7235
+3  7235 4093 626
+3  3986 7235 4019
+3  4019 1002 3986
+3  1003 3948 7235
+3  7235 3986 1003
+3  501 4094 7236
+3  7236 4097 501
+3  503 4095 7236
+3  7236 4094 503
+3  523 4096 7236
+3  7236 4095 523
+3  4097 7236 4096
+3  4096 521 4097
+3  499 4098 7237
+3  7237 4101 499
+3  518 4099 7237
+3  7237 4098 518
+3  639 4100 7237
+3  7237 4099 639
+3  4101 7237 4100
+3  4100 658 4101
+3  522 4102 7238
+3  7238 4105 522
+3  859 4103 7238
+3  7238 4102 859
+3  633 4104 7238
+3  7238 4103 633
+3  4105 7238 4104
+3  4104 520 4105
+3  663 4106 4108
+3  678 4107 4106
+3  665 4108 4107
+3  4108 4106 4107
+3  690 4109 7239
+3  7239 4112 690
+3  677 4110 7239
+3  7239 4109 677
+3  511 4111 7239
+3  7239 4110 511
+3  4112 7239 4111
+3  4111 512 4112
+3  674 4113 7240
+3  7240 4116 674
+3  675 4114 7240
+3  7240 4113 675
+3  685 4115 7240
+3  7240 4114 685
+3  4116 7240 4115
+3  4115 836 4116
+3  651 4117 7241
+3  7241 4119 651
+3  652 4118 7241
+3  7241 4117 652
+3  674 4116 7241
+3  7241 4118 674
+3  4119 7241 4116
+3  4116 836 4119
+3  688 4120 7242
+3  7242 4123 688
+3  689 4121 7242
+3  7242 4120 689
+3  513 4122 7242
+3  7242 4121 513
+3  4123 7242 4122
+3  4122 515 4123
+3  4124 7243 4127
+3  4127 643 4124
+3  834 4125 7243
+3  7243 4124 834
+3  683 4126 7243
+3  7243 4125 683
+3  642 4127 7243
+3  7243 4126 642
+3  686 4128 7244
+3  7244 4131 686
+3  551 4129 7244
+3  7244 4128 551
+3  553 4130 7244
+3  7244 4129 553
+3  4131 7244 4130
+3  4130 807 4131
+3  4132 7245 4123
+3  4123 515 4132
+3  4133 7245 4132
+3  4132 545 4133
+3  4134 7245 4133
+3  4133 547 4134
+3  688 4123 7245
+3  7245 4134 688
+3  516 4135 7246
+3  7246 4137 516
+3  543 4136 7246
+3  7246 4135 543
+3  545 4132 7246
+3  7246 4136 545
+3  4137 7246 4132
+3  4132 515 4137
+3  505 4138 7247
+3  7247 4141 505
+3  507 4139 7247
+3  7247 4138 507
+3  527 4140 7247
+3  7247 4139 527
+3  4141 7247 4140
+3  4140 525 4141
+3  530 4142 4144
+3  855 4143 4142
+3  528 4144 4143
+3  4144 4142 4143
+3  532 4145 7248
+3  7248 4147 532
+3  854 4146 7248
+3  7248 4145 854
+3  855 4142 7248
+3  7248 4146 855
+3  4147 7248 4142
+3  4142 530 4147
+3  524 4148 7249
+3  7249 4150 524
+3  858 4149 7249
+3  7249 4148 858
+3  859 4102 7249
+3  7249 4149 859
+3  4150 7249 4102
+3  4102 522 4150
+3  503 4151 7250
+3  7250 4095 503
+3  505 4141 7250
+3  7250 4151 505
+3  4152 7250 4141
+3  4141 525 4152
+3  523 4095 7250
+3  7250 4152 523
+3  622 4153 7251
+3  7251 3725 622
+3  623 3728 7251
+3  7251 4153 623
+3  3773 7251 3728
+3  3728 1000 3773
+3  3725 7251 3773
+3  3773 1001 3725
+3  998 3521 3481
+3  997 4154 3521
+3  999 3481 4154
+3  3481 3521 4154
+3  4155 7252 4158
+3  4158 417 4155
+3  4156 7252 4155
+3  4155 452 4156
+3  4157 7252 4156
+3  4156 831 4157
+3  4158 7252 4157
+3  4157 415 4158
+3  452 4159 7253
+3  7253 4156 452
+3  471 4160 7253
+3  7253 4159 471
+3  830 4161 7253
+3  7253 4160 830
+3  4156 7253 4161
+3  4161 831 4156
+3  546 4162 7254
+3  7254 4164 546
+3  544 4163 7254
+3  7254 4162 544
+3  2867 7254 4163
+3  4163 400 2867
+3  4164 7254 2867
+3  2867 399 4164
+3  344 4165 7255
+3  7255 2870 344
+3  548 4166 7255
+3  7255 4165 548
+3  546 4164 7255
+3  7255 4166 546
+3  2870 7255 4164
+3  4164 399 2870
+3  398 4167 7256
+3  7256 2873 398
+3  554 4168 7256
+3  7256 4167 554
+3  552 4169 7256
+3  7256 4168 552
+3  2873 7256 4169
+3  4169 335 2873
+3  554 4167 7257
+3  7257 4171 554
+3  2877 7257 4167
+3  4167 398 2877
+3  332 4170 7257
+3  7257 2877 332
+3  556 4171 7257
+3  7257 4170 556
+3  514 4022 4173
+3  860 4172 4022
+3  536 4173 4172
+3  4173 4022 4172
+3  860 4174 7258
+3  7258 4172 860
+3  853 4175 7258
+3  7258 4174 853
+3  534 4176 7258
+3  7258 4175 534
+3  4172 7258 4176
+3  4176 536 4172
+3  3799 7259 3797
+3  3797 995 3799
+3  3811 7259 3799
+3  3799 994 3811
+3  3803 7259 3811
+3  3811 993 3803
+3  3797 7259 3803
+3  3803 996 3797
+3  991 3722 7260
+3  7260 3719 991
+3  990 3796 7260
+3  7260 3722 990
+3  989 3742 7260
+3  7260 3796 989
+3  3719 7260 3742
+3  3742 992 3719
+3  987 3829 7261
+3  7261 3831 987
+3  986 3824 7261
+3  7261 3829 986
+3  3826 7261 3824
+3  3824 985 3826
+3  3831 7261 3826
+3  3826 988 3831
+3  3859 7262 3875
+3  3875 983 3859
+3  3856 7262 3859
+3  3859 982 3856
+3  3858 7262 3856
+3  3856 981 3858
+3  3875 7262 3858
+3  3858 984 3875
+3  643 4177 7263
+3  7263 4180 643
+3  641 4178 7263
+3  7263 4177 641
+3  646 4179 7263
+3  7263 4178 646
+3  4180 7263 4179
+3  4179 648 4180
+3  840 4181 7264
+3  7264 4184 840
+3  848 4182 7264
+3  7264 4181 848
+3  849 4183 7264
+3  7264 4182 849
+3  4184 7264 4183
+3  4183 703 4184
+3  977 2408 3939
+3  976 3942 2408
+3  978 3939 3942
+3  3939 2408 3942
+3  974 3938 7265
+3  7265 3937 974
+3  973 3932 7265
+3  7265 3938 973
+3  972 3935 7265
+3  7265 3932 972
+3  3937 7265 3935
+3  3935 975 3937
+3  970 3495 3489
+3  969 3487 3495
+3  971 3489 3487
+3  3489 3495 3487
+3  967 3923 7266
+3  7266 3924 967
+3  966 3918 7266
+3  7266 3923 966
+3  965 3920 7266
+3  7266 3918 965
+3  3924 7266 3920
+3  3920 968 3924
+3  963 3854 3821
+3  962 3825 3854
+3  964 3821 3825
+3  3821 3854 3825
+3  960 3805 3802
+3  959 3801 3805
+3  961 3802 3801
+3  3802 3805 3801
+3  957 3787 3795
+3  956 3790 3787
+3  958 3795 3790
+3  3795 3787 3790
+3  954 4185 7267
+3  7267 3779 954
+3  953 3749 7267
+3  7267 4185 953
+3  3756 7267 3749
+3  3749 952 3756
+3  3779 7267 3756
+3  3756 955 3779
+3  950 3731 3736
+3  949 3740 3731
+3  951 3736 3740
+3  3736 3731 3740
+3  3764 7268 3777
+3  3777 947 3764
+3  946 3760 7268
+3  7268 3764 946
+3  945 4186 7268
+3  7268 3760 945
+3  948 3777 7268
+3  7268 4186 948
+3  3908 7269 3906
+3  3906 943 3908
+3  3904 7269 3908
+3  3908 942 3904
+3  3910 7269 3904
+3  3904 941 3910
+3  3906 7269 3910
+3  3910 944 3906
+3  939 3917 7270
+3  7270 3916 939
+3  938 3909 7270
+3  7270 3917 938
+3  937 3913 7270
+3  7270 3909 937
+3  3916 7270 3913
+3  3913 940 3916
+3  935 3912 3890
+3  934 3892 3912
+3  936 3890 3892
+3  3890 3912 3892
+3  3770 7271 3768
+3  3768 932 3770
+3  3766 7271 3770
+3  3770 931 3766
+3  930 3775 7271
+3  7271 3766 930
+3  933 3768 7271
+3  7271 3775 933
+3  928 3724 3813
+3  927 4187 3724
+3  929 3813 4187
+3  3813 3724 4187
+3  3883 7272 3878
+3  3878 925 3883
+3  3874 7272 3883
+3  3883 924 3874
+3  3877 7272 3874
+3  3874 923 3877
+3  926 3878 7272
+3  7272 3877 926
+3  921 3833 7273
+3  7273 3834 921
+3  920 3830 7273
+3  7273 3833 920
+3  3852 7273 3830
+3  3830 919 3852
+3  3834 7273 3852
+3  3852 922 3834
+3  3888 7274 3884
+3  3884 917 3888
+3  3880 7274 3888
+3  3888 916 3880
+3  3882 7274 3880
+3  3880 915 3882
+3  918 3884 7274
+3  7274 3882 918
+3  3853 7275 3851
+3  3851 913 3853
+3  3848 7275 3853
+3  3853 912 3848
+3  3849 7275 3848
+3  3848 911 3849
+3  3851 7275 3849
+3  3849 914 3851
+3  909 3785 7276
+3  7276 3789 909
+3  3783 7276 3785
+3  3785 908 3783
+3  3809 7276 3783
+3  3783 907 3809
+3  3789 7276 3809
+3  3809 910 3789
+3  905 3765 7277
+3  7277 3763 905
+3  904 3762 7277
+3  7277 3765 904
+3  3887 7277 3762
+3  3762 903 3887
+3  3763 7277 3887
+3  3887 906 3763
+3  3808 7278 3807
+3  3807 901 3808
+3  3804 7278 3808
+3  3808 900 3804
+3  899 3819 7278
+3  7278 3804 899
+3  902 3807 7278
+3  7278 3819 902
+3  897 3818 7279
+3  7279 3815 897
+3  896 3810 7279
+3  7279 3818 896
+3  3812 7279 3810
+3  3810 895 3812
+3  3815 7279 3812
+3  3812 898 3815
+3  893 3791 3806
+3  892 3793 3791
+3  894 3806 3793
+3  3806 3791 3793
+3  890 3899 3577
+3  889 3723 3899
+3  891 3577 3723
+3  3577 3899 3723
+3  4188 7280 3776
+3  3776 887 4188
+3  3771 7280 4188
+3  4188 886 3771
+3  3774 7280 3771
+3  3771 885 3774
+3  888 3776 7280
+3  7280 3774 888
+3  883 3754 7281
+3  7281 3786 883
+3  882 3844 7281
+3  7281 3754 882
+3  3753 7281 3844
+3  3844 881 3753
+3  3786 7281 3753
+3  3753 884 3786
+3  879 3752 7282
+3  7282 3784 879
+3  878 3847 7282
+3  7282 3752 878
+3  877 3748 7282
+3  7282 3847 877
+3  3784 7282 3748
+3  3748 880 3784
+3  3747 7283 3745
+3  3745 875 3747
+3  3820 7283 3747
+3  3747 874 3820
+3  873 3741 7283
+3  7283 3820 873
+3  876 3745 7283
+3  7283 3741 876
+3  871 3739 3992
+3  870 3769 3739
+3  872 3992 3769
+3  3992 3739 3769
+3  4189 7284 3729
+3  3729 623 4189
+3  3946 7284 4189
+3  4189 624 3946
+3  868 3767 7284
+3  7284 3946 868
+3  869 3729 7284
+3  7284 3767 869
+3  866 3866 3758
+3  865 4190 3866
+3  867 3758 4190
+3  3758 3866 4190
+3  589 3648 7285
+3  7285 4192 589
+3  864 3665 7285
+3  7285 3648 864
+3  4191 7285 3665
+3  3665 424 4191
+3  421 4192 7285
+3  7285 4191 421
+3  862 3782 3800
+3  861 3744 3782
+3  863 3800 3744
+3  3800 3782 3744
+3  4100 7286 4195
+3  4195 658 4100
+3  639 4193 7286
+3  7286 4100 639
+3  679 4194 7286
+3  7286 4193 679
+3  4195 7286 4194
+3  4194 661 4195
+3  526 4196 7287
+3  7287 4198 526
+3  856 4197 7287
+3  7287 4196 856
+3  858 4148 7287
+3  7287 4197 858
+3  4198 7287 4148
+3  4148 524 4198
+3  707 4199 7288
+3  7288 4201 707
+3  708 4200 7288
+3  7288 4199 708
+3  853 4174 7288
+3  7288 4200 853
+3  4201 7288 4174
+3  4174 860 4201
+3  4201 7289 4203
+3  4203 707 4201
+3  4024 7289 4201
+3  4201 860 4024
+3  692 4202 7289
+3  7289 4024 692
+3  706 4203 7289
+3  7289 4202 706
+3  700 4204 7290
+3  7290 4206 700
+3  632 4205 7290
+3  7290 4204 632
+3  633 4103 7290
+3  7290 4205 633
+3  4206 7290 4103
+3  4103 859 4206
+3  698 4207 7291
+3  7291 4208 698
+3  700 4206 7291
+3  7291 4207 700
+3  4149 7291 4206
+3  4206 859 4149
+3  4208 7291 4149
+3  4149 858 4208
+3  696 4209 7292
+3  7292 4210 696
+3  698 4208 7292
+3  7292 4209 698
+3  4197 7292 4208
+3  4208 858 4197
+3  856 4210 7292
+3  7292 4197 856
+3  695 4211 7293
+3  7293 4213 695
+3  696 4210 7293
+3  7293 4211 696
+3  856 4212 7293
+3  7293 4210 856
+3  4213 7293 4212
+3  4212 855 4213
+3  708 4214 7294
+3  7294 4200 708
+3  694 4215 7294
+3  7294 4214 694
+3  854 4216 7294
+3  7294 4215 854
+3  4200 7294 4216
+3  4216 853 4200
+3  4217 7295 4202
+3  4202 692 4217
+3  680 4218 7295
+3  7295 4217 680
+3  704 4219 7295
+3  7295 4218 704
+3  4202 7295 4219
+3  4219 706 4202
+3  680 4220 7296
+3  7296 4218 680
+3  638 4221 7296
+3  7296 4220 638
+3  4222 7296 4221
+3  4221 635 4222
+3  704 4218 7296
+3  7296 4222 704
+3  4146 7297 4213
+3  4213 855 4146
+3  4215 7297 4146
+3  4146 854 4215
+3  4223 7297 4215
+3  4215 694 4223
+3  695 4213 7297
+3  7297 4223 695
+3  622 3727 4224
+3  857 3527 3727
+3  621 4224 3527
+3  4224 3727 3527
+3  413 4225 4227
+3  537 4226 4225
+3  410 4227 4226
+3  4227 4225 4226
+3  527 4139 7298
+3  7298 4230 527
+3  507 4228 7298
+3  7298 4139 507
+3  509 4229 7298
+3  7298 4228 509
+3  4230 7298 4229
+3  4229 529 4230
+3  526 4231 7299
+3  7299 4196 526
+3  528 4143 7299
+3  7299 4231 528
+3  4212 7299 4143
+3  4143 855 4212
+3  4196 7299 4212
+3  4212 856 4196
+3  4229 7300 4234
+3  4234 529 4229
+3  509 4232 7300
+3  7300 4229 509
+3  538 4233 7300
+3  7300 4232 538
+3  4234 7300 4233
+3  4233 531 4234
+3  4233 7301 4237
+3  4237 531 4233
+3  538 4235 7301
+3  7301 4233 538
+3  539 4236 7301
+3  7301 4235 539
+3  4237 7301 4236
+3  4236 533 4237
+3  416 4238 4239
+3  413 4227 4238
+3  410 4239 4227
+3  4239 4238 4227
+3  4236 7302 4242
+3  4242 533 4236
+3  539 4240 7302
+3  7302 4236 539
+3  541 4241 7302
+3  7302 4240 541
+3  4242 7302 4241
+3  4241 535 4242
+3  532 4243 7303
+3  7303 4145 532
+3  534 4175 7303
+3  7303 4243 534
+3  4216 7303 4175
+3  4175 853 4216
+3  854 4145 7303
+3  7303 4216 854
+3  840 4184 7304
+3  7304 4246 840
+3  703 4244 7304
+3  7304 4184 703
+3  702 4245 7304
+3  7304 4244 702
+3  4246 7304 4245
+3  4245 838 4246
+3  845 4247 7305
+3  7305 4250 845
+3  709 4248 7305
+3  7305 4247 709
+3  705 4249 7305
+3  7305 4248 705
+3  4250 7305 4249
+3  4249 846 4250
+3  844 4251 7306
+3  7306 4253 844
+3  710 4252 7306
+3  7306 4251 710
+3  709 4247 7306
+3  7306 4252 709
+3  4253 7306 4247
+3  4247 845 4253
+3  4254 7307 4256
+3  4256 843 4254
+3  4255 7307 4254
+3  4254 693 4255
+3  710 4251 7307
+3  7307 4255 710
+3  844 4256 7307
+3  7307 4251 844
+3  693 4254 4258
+3  843 4257 4254
+3  839 4258 4257
+3  4258 4254 4257
+3  697 4259 4261
+3  842 4260 4259
+3  699 4261 4260
+3  4261 4259 4260
+3  841 4262 7308
+3  7308 4264 841
+3  701 4263 7308
+3  7308 4262 701
+3  4260 7308 4263
+3  4263 699 4260
+3  842 4264 7308
+3  7308 4260 842
+3  841 4265 7309
+3  7309 4262 841
+3  837 4266 7309
+3  7309 4265 837
+3  631 4267 7309
+3  7309 4266 631
+3  4262 7309 4267
+3  4267 701 4262
+3  850 4268 7310
+3  7310 4271 850
+3  705 4269 7310
+3  7310 4268 705
+3  4270 7310 4269
+3  4269 706 4270
+3  4271 7310 4270
+3  4270 852 4271
+3  4272 7311 4274
+3  4274 851 4272
+3  4273 7311 4272
+3  4272 704 4273
+3  4183 7311 4273
+3  4273 703 4183
+3  849 4274 7311
+3  7311 4183 849
+3  4270 7312 4275
+3  4275 852 4270
+3  706 4219 7312
+3  7312 4270 706
+3  4272 7312 4219
+3  4219 704 4272
+3  851 4275 7312
+3  7312 4272 851
+3  4268 7313 4249
+3  4249 705 4268
+3  850 4276 7313
+3  7313 4268 850
+3  847 4277 7313
+3  7313 4276 847
+3  846 4249 7313
+3  7313 4277 846
+3  4274 7314 4275
+3  4275 851 4274
+3  849 4278 7314
+3  7314 4274 849
+3  850 4271 7314
+3  7314 4278 850
+3  4275 7314 4271
+3  4271 852 4275
+3  847 4276 7315
+3  7315 4279 847
+3  4278 7315 4276
+3  4276 850 4278
+3  4182 7315 4278
+3  4278 849 4182
+3  848 4279 7315
+3  7315 4182 848
+3  697 4280 4259
+3  493 4281 4280
+3  842 4259 4281
+3  4259 4280 4281
+3  483 4282 7316
+3  7316 4284 483
+3  848 4181 7316
+3  7316 4282 848
+3  840 4283 7316
+3  7316 4181 840
+3  4284 7316 4283
+3  4283 485 4284
+3  481 4285 7317
+3  7317 4286 481
+3  847 4279 7317
+3  7317 4285 847
+3  4282 7317 4279
+3  4279 848 4282
+3  483 4286 7317
+3  7317 4282 483
+3  479 4287 7318
+3  7318 4288 479
+3  846 4277 7318
+3  7318 4287 846
+3  4285 7318 4277
+3  4277 847 4285
+3  481 4288 7318
+3  7318 4285 481
+3  475 4289 7319
+3  7319 4290 475
+3  845 4250 7319
+3  7319 4289 845
+3  4287 7319 4250
+3  4250 846 4287
+3  479 4290 7319
+3  7319 4287 479
+3  476 4291 7320
+3  7320 4292 476
+3  844 4253 7320
+3  7320 4291 844
+3  4289 7320 4253
+3  4253 845 4289
+3  475 4292 7320
+3  7320 4289 475
+3  497 4293 7321
+3  7321 4294 497
+3  843 4256 7321
+3  7321 4293 843
+3  4291 7321 4256
+3  4256 844 4291
+3  476 4294 7321
+3  7321 4291 476
+3  4295 7322 4296
+3  4296 495 4295
+3  839 4257 7322
+3  7322 4295 839
+3  843 4293 7322
+3  7322 4257 843
+3  497 4296 7322
+3  7322 4293 497
+3  839 4295 4298
+3  495 4297 4295
+3  493 4298 4297
+3  4298 4295 4297
+3  491 4299 7323
+3  7323 4300 491
+3  841 4264 7323
+3  7323 4299 841
+3  842 4281 7323
+3  7323 4264 842
+3  4300 7323 4281
+3  4281 493 4300
+3  489 4301 7324
+3  7324 4302 489
+3  837 4265 7324
+3  7324 4301 837
+3  4299 7324 4265
+3  4265 841 4299
+3  491 4302 7324
+3  7324 4299 491
+3  4283 7325 4304
+3  4304 485 4283
+3  4246 7325 4283
+3  4283 840 4246
+3  838 4303 7325
+3  7325 4246 838
+3  487 4304 7325
+3  7325 4303 487
+3  839 4305 4258
+3  697 4306 4305
+3  693 4258 4306
+3  4258 4305 4306
+3  697 4305 4280
+3  839 4298 4305
+3  493 4280 4298
+3  4280 4305 4298
+3  634 4307 7326
+3  7326 4310 634
+3  630 4308 7326
+3  7326 4307 630
+3  636 4309 7326
+3  7326 4308 636
+3  4310 7326 4309
+3  4309 637 4310
+3  702 4311 7327
+3  7327 4245 702
+3  631 4266 7327
+3  7327 4311 631
+3  837 4312 7327
+3  7327 4266 837
+3  4245 7327 4312
+3  4312 838 4245
+3  838 4312 7328
+3  7328 4303 838
+3  4301 7328 4312
+3  4312 837 4301
+3  489 4313 7328
+3  7328 4301 489
+3  487 4303 7328
+3  7328 4313 487
+3  4314 7329 4317
+3  4317 511 4314
+3  678 4315 7329
+3  7329 4314 678
+3  691 4316 7329
+3  7329 4315 691
+3  510 4317 7329
+3  7329 4316 510
+3  654 4318 4320
+3  673 4319 4318
+3  653 4320 4319
+3  4320 4318 4319
+3  650 4321 7330
+3  7330 4323 650
+3  651 4119 7330
+3  7330 4321 651
+3  4322 7330 4119
+3  4119 836 4322
+3  833 4323 7330
+3  7330 4322 833
+3  4115 7331 4322
+3  4322 836 4115
+3  685 4324 7331
+3  7331 4115 685
+3  682 4325 7331
+3  7331 4324 682
+3  833 4322 7331
+3  7331 4325 833
+3  689 4326 7332
+3  7332 4121 689
+3  690 4112 7332
+3  7332 4326 690
+3  4327 7332 4112
+3  4112 512 4327
+3  513 4121 7332
+3  7332 4327 513
+3  4328 7333 4023
+3  4023 514 4328
+3  510 4316 7333
+3  7333 4328 510
+3  691 4329 7333
+3  7333 4316 691
+3  4023 7333 4329
+3  4329 692 4023
+3  561 4330 7334
+3  7334 4333 561
+3  295 4331 7334
+3  7334 4330 295
+3  832 4332 7334
+3  7334 4331 832
+3  4333 7334 4332
+3  4332 815 4333
+3  295 2824 7335
+3  7335 4331 295
+3  2805 7335 2824
+3  2824 294 2805
+3  307 4334 7335
+3  7335 2805 307
+3  832 4331 7335
+3  7335 4334 832
+3  832 4334 7336
+3  7336 4336 832
+3  2808 7336 4334
+3  4334 307 2808
+3  306 4335 7336
+3  7336 2808 306
+3  647 4336 7336
+3  7336 4335 647
+3  835 4337 4339
+3  833 4338 4337
+3  834 4339 4338
+3  4339 4337 4338
+3  835 4339 4340
+3  834 4124 4339
+3  643 4340 4124
+3  4340 4339 4124
+3  4340 7337 4342
+3  4342 835 4340
+3  4180 7337 4340
+3  4340 643 4180
+3  648 4341 7337
+3  7337 4180 648
+3  649 4342 7337
+3  7337 4341 649
+3  4337 7338 4323
+3  4323 833 4337
+3  4342 7338 4337
+3  4337 835 4342
+3  649 4343 7338
+3  7338 4342 649
+3  650 4323 7338
+3  7338 4343 650
+3  4344 7339 4131
+3  4131 807 4344
+3  4345 7339 4344
+3  4344 641 4345
+3  642 4346 7339
+3  7339 4345 642
+3  686 4131 7339
+3  7339 4346 686
+3  834 4338 7340
+3  7340 4125 834
+3  4325 7340 4338
+3  4338 833 4325
+3  682 4347 7340
+3  7340 4325 682
+3  683 4125 7340
+3  7340 4347 683
+3  1149 2825 7341
+3  7341 4349 1149
+3  295 4330 7341
+3  7341 2825 295
+3  561 4348 7341
+3  7341 4330 561
+3  4349 7341 4348
+3  4348 228 4349
+3  4350 7342 4352
+3  4352 560 4350
+3  4351 7342 4350
+3  4350 558 4351
+3  333 2879 7342
+3  7342 4351 333
+3  397 4352 7342
+3  7342 2879 397
+3  645 4353 7343
+3  7343 4354 645
+3  815 4332 7343
+3  7343 4353 815
+3  4336 7343 4332
+3  4332 832 4336
+3  647 4354 7343
+3  7343 4336 647
+3  4355 7344 4348
+3  4348 561 4355
+3  2835 7344 4355
+3  4355 408 2835
+3  2095 4356 7344
+3  7344 2835 2095
+3  228 4348 7344
+3  7344 4356 228
+3  471 4357 7345
+3  7345 4160 471
+3  323 2863 7345
+3  7345 4357 323
+3  4358 7345 2863
+3  2863 400 4358
+3  830 4160 7345
+3  7345 4358 830
+3  4241 7346 4360
+3  4360 535 4241
+3  541 4359 7346
+3  7346 4241 541
+3  543 4135 7346
+3  7346 4359 543
+3  4360 7346 4135
+3  4135 516 4360
+3  540 4361 7347
+3  7347 4363 540
+3  414 4362 7347
+3  7347 4361 414
+3  415 4157 7347
+3  7347 4362 415
+3  4363 7347 4157
+3  4157 831 4363
+3  540 4363 7348
+3  7348 4365 540
+3  4161 7348 4363
+3  4363 831 4161
+3  830 4364 7348
+3  7348 4161 830
+3  542 4365 7348
+3  7348 4364 542
+3  542 4364 7349
+3  7349 4366 542
+3  4358 7349 4364
+3  4364 830 4358
+3  4163 7349 4358
+3  4358 400 4163
+3  544 4366 7349
+3  7349 4163 544
+3  1140 4367 7350
+3  7350 4368 1140
+3  3701 7350 4367
+3  4367 1161 3701
+3  829 3717 7350
+3  7350 3701 829
+3  4368 7350 3717
+3  3717 438 4368
+3  3716 7351 3714
+3  3714 827 3716
+3  826 3710 7351
+3  7351 3716 826
+3  825 3713 7351
+3  7351 3710 825
+3  3714 7351 3713
+3  3713 828 3714
+3  3690 7352 3712
+3  3712 823 3690
+3  822 3687 7352
+3  7352 3690 822
+3  821 3689 7352
+3  7352 3687 821
+3  824 3712 7352
+3  7352 3689 824
+3  820 3686 7353
+3  7353 4369 820
+3  4049 7353 3686
+3  3686 426 4049
+3  2851 7353 4049
+3  4049 404 2851
+3  403 4369 7353
+3  7353 2851 403
+3  456 4370 7354
+3  7354 4371 456
+3  402 2857 7354
+3  7354 4370 402
+3  4048 7354 2857
+3  2857 401 4048
+3  4371 7354 4048
+3  4048 467 4371
+3  4370 7355 2854
+3  2854 402 4370
+3  456 4372 7355
+3  7355 4370 456
+3  3308 7355 4372
+3  4372 457 3308
+3  820 4369 7355
+3  7355 3308 820
+3  2854 7355 4369
+3  4369 403 2854
+3  3499 7356 3494
+3  3494 818 3499
+3  3532 7356 3499
+3  3499 817 3532
+3  3492 7356 3532
+3  3532 816 3492
+3  3494 7356 3492
+3  3492 819 3494
+3  461 4373 7357
+3  7357 4043 461
+3  464 4046 7357
+3  7357 4373 464
+3  4374 7357 4046
+3  4046 324 4374
+3  473 4043 7357
+3  7357 4374 473
+3  4130 7358 4377
+3  4377 807 4130
+3  553 4375 7358
+3  7358 4130 553
+3  555 4376 7358
+3  7358 4375 555
+3  4377 7358 4376
+3  4376 644 4377
+3  397 2831 4352
+3  408 4378 2831
+3  560 4352 4378
+3  4352 2831 4378
+3  645 4379 7359
+3  7359 4353 645
+3  557 4380 7359
+3  7359 4379 557
+3  4381 7359 4380
+3  4380 559 4381
+3  815 4353 7359
+3  7359 4381 815
+3  559 4382 4381
+3  561 4333 4382
+3  815 4381 4333
+3  4381 4382 4333
+3  4007 7360 4383
+3  4383 428 4007
+3  814 4002 7360
+3  7360 4007 814
+3  813 4004 7360
+3  7360 4002 813
+3  4383 7360 4004
+3  4004 430 4383
+3  432 3678 7361
+3  7361 4386 432
+3  434 4384 7361
+3  7361 3678 434
+3  1142 4385 7361
+3  7361 4384 1142
+3  4386 7361 4385
+3  4385 1162 4386
+3  811 3681 3682
+3  810 3684 3681
+3  812 3682 3684
+3  3682 3681 3684
+3  809 3680 7362
+3  7362 4005 809
+3  808 3679 7362
+3  7362 3680 808
+3  4387 7362 3679
+3  3679 432 4387
+3  4005 7362 4387
+3  4387 430 4005
+3  429 4388 7363
+3  7363 4052 429
+3  431 4054 7363
+3  7363 4388 431
+3  2842 7363 4054
+3  4054 407 2842
+3  4052 7363 2842
+3  2842 406 4052
+3  644 4389 7364
+3  7364 4377 644
+3  646 4178 7364
+3  7364 4389 646
+3  641 4344 7364
+3  7364 4178 641
+3  4377 7364 4344
+3  4344 807 4377
+3  805 3674 7365
+3  7365 3669 805
+3  804 3664 7365
+3  7365 3674 804
+3  3667 7365 3664
+3  3664 803 3667
+3  806 3669 7365
+3  7365 3667 806
+3  801 3670 3677
+3  800 3673 3670
+3  802 3677 3673
+3  3677 3670 3673
+3  798 3951 7366
+3  7366 3663 798
+3  797 3675 7366
+3  7366 3951 797
+3  796 3668 7366
+3  7366 3675 796
+3  3663 7366 3668
+3  3668 799 3663
+3  794 3659 3666
+3  793 3661 3659
+3  795 3666 3661
+3  3666 3659 3661
+3  791 3652 3658
+3  790 3656 3652
+3  792 3658 3656
+3  3658 3652 3656
+3  788 3650 3636
+3  787 3637 3650
+3  789 3636 3637
+3  3636 3650 3637
+3  785 3633 3640
+3  784 3635 3633
+3  786 3640 3635
+3  3640 3633 3635
+3  782 3630 7367
+3  7367 3627 782
+3  781 3654 7367
+3  7367 3630 781
+3  3624 7367 3654
+3  3654 780 3624
+3  783 3627 7367
+3  7367 3624 783
+3  778 3971 3622
+3  777 3628 3971
+3  779 3622 3628
+3  3622 3971 3628
+3  775 3620 7368
+3  7368 3619 775
+3  774 3621 7368
+3  7368 3620 774
+3  773 3626 7368
+3  7368 3621 773
+3  3619 7368 3626
+3  3626 776 3619
+3  771 3616 3623
+3  770 3618 3616
+3  772 3623 3618
+3  3623 3616 3618
+3  768 3605 3613
+3  767 3600 3605
+3  769 3613 3600
+3  3613 3605 3600
+3  765 3602 3611
+3  764 3604 3602
+3  766 3611 3604
+3  3611 3602 3604
+3  762 3606 3612
+3  761 3610 3606
+3  763 3612 3610
+3  3612 3606 3610
+3  757 3915 3596
+3  756 3595 3915
+3  758 3596 3595
+3  3596 3915 3595
+3  3889 7369 3594
+3  3594 754 3889
+3  3591 7369 3889
+3  3889 753 3591
+3  3922 7369 3591
+3  3591 752 3922
+3  755 3594 7369
+3  7369 3922 755
+3  750 3896 3631
+3  749 3580 3896
+3  751 3631 3580
+3  3631 3896 3580
+3  3907 7370 3578
+3  3578 747 3907
+3  3575 7370 3907
+3  3907 746 3575
+3  3615 7370 3575
+3  3575 745 3615
+3  3578 7370 3615
+3  3615 748 3578
+3  3949 7371 3572
+3  3572 741 3949
+3  3568 7371 3949
+3  3949 740 3568
+3  3571 7371 3568
+3  3568 739 3571
+3  3572 7371 3571
+3  3571 742 3572
+3  731 3936 3562
+3  730 3559 3936
+3  732 3562 3559
+3  3562 3936 3559
+3  3567 7372 3566
+3  3566 728 3567
+3  727 3561 7372
+3  7372 3567 727
+3  726 3563 7372
+3  7372 3561 726
+3  729 3566 7372
+3  7372 3563 729
+3  724 3569 3557
+3  723 3565 3569
+3  725 3557 3565
+3  3557 3569 3565
+3  721 3705 3543
+3  720 3537 3705
+3  722 3543 3537
+3  3543 3705 3537
+3  3549 7373 3548
+3  3548 718 3549
+3  717 3542 7373
+3  7373 3549 717
+3  716 3544 7373
+3  7373 3542 716
+3  719 3548 7373
+3  7373 3544 719
+3  714 3530 3533
+3  713 3546 3530
+3  715 3533 3546
+3  3533 3530 3546
+3  410 4390 4239
+3  454 4391 4390
+3  416 4239 4391
+3  4239 4390 4391
+3  4392 7374 3526
+3  3526 409 4392
+3  621 3529 7374
+3  7374 4392 621
+3  711 4393 7374
+3  7374 3529 711
+3  712 3526 7374
+3  7374 4393 712
+3  694 4394 4395
+3  710 4255 4394
+3  693 4395 4255
+3  4395 4394 4255
+3  4214 7375 4394
+3  4394 694 4214
+3  4396 7375 4214
+3  4214 708 4396
+3  4252 7375 4396
+3  4396 709 4252
+3  4394 7375 4252
+3  4252 710 4394
+3  708 4199 7376
+3  7376 4396 708
+3  707 4397 7376
+3  7376 4199 707
+3  4248 7376 4397
+3  4397 705 4248
+3  4396 7376 4248
+3  4248 709 4396
+3  706 4269 4203
+3  705 4397 4269
+3  707 4203 4397
+3  4203 4269 4397
+3  635 4398 4222
+3  703 4273 4398
+3  704 4222 4273
+3  4222 4398 4273
+3  4399 7377 4398
+3  4398 635 4399
+3  636 4400 7377
+3  7377 4399 636
+3  702 4244 7377
+3  7377 4400 702
+3  703 4398 7377
+3  7377 4244 703
+3  636 4308 7378
+3  7378 4400 636
+3  630 4401 7378
+3  7378 4308 630
+3  4311 7378 4401
+3  4401 631 4311
+3  4400 7378 4311
+3  4311 702 4400
+3  632 4204 7379
+3  7379 4403 632
+3  700 4402 7379
+3  7379 4204 700
+3  701 4267 7379
+3  7379 4402 701
+3  4403 7379 4267
+3  4267 631 4403
+3  4207 7380 4402
+3  4402 700 4207
+3  4404 7380 4207
+3  4207 698 4404
+3  4263 7380 4404
+3  4404 699 4263
+3  4402 7380 4263
+3  4263 701 4402
+3  698 4209 7381
+3  7381 4404 698
+3  696 4405 7381
+3  7381 4209 696
+3  4261 7381 4405
+3  4405 697 4261
+3  699 4404 7381
+3  7381 4261 699
+3  4211 7382 4405
+3  4405 696 4211
+3  4406 7382 4211
+3  4211 695 4406
+3  4306 7382 4406
+3  4406 693 4306
+3  697 4405 7382
+3  7382 4306 697
+3  694 4395 4223
+3  693 4406 4395
+3  695 4223 4406
+3  4223 4395 4406
+3  691 4407 4329
+3  680 4217 4407
+3  692 4329 4217
+3  4329 4407 4217
+3  4315 7383 4407
+3  4407 691 4315
+3  4408 7383 4315
+3  4315 678 4408
+3  679 4409 7383
+3  7383 4408 679
+3  4407 7383 4409
+3  4409 680 4407
+3  4106 7384 4408
+3  4408 678 4106
+3  663 4410 7384
+3  7384 4106 663
+3  661 4194 7384
+3  7384 4410 661
+3  4408 7384 4194
+3  4194 679 4408
+3  4080 7385 4412
+3  4412 662 4080
+3  2098 4411 7385
+3  7385 4080 2098
+3  1171 4075 7385
+3  7385 4411 1171
+3  660 4412 7385
+3  7385 4075 660
+3  677 4109 7386
+3  7386 4415 677
+3  690 4413 7386
+3  7386 4109 690
+3  681 4414 7386
+3  7386 4413 681
+3  4415 7386 4414
+3  4414 676 4415
+3  4326 7387 4413
+3  4413 690 4326
+3  4416 7387 4326
+3  4326 689 4416
+3  684 4417 7387
+3  7387 4416 684
+3  681 4413 7387
+3  7387 4417 681
+3  4120 7388 4416
+3  4416 689 4120
+3  4418 7388 4120
+3  4120 688 4418
+3  4419 7388 4418
+3  4418 687 4419
+3  4416 7388 4419
+3  4419 684 4416
+3  4134 7389 4418
+3  4418 688 4134
+3  547 4420 7389
+3  7389 4134 547
+3  549 4421 7389
+3  7389 4420 549
+3  687 4418 7389
+3  7389 4421 687
+3  687 4421 7390
+3  7390 4423 687
+3  549 4422 7390
+3  7390 4421 549
+3  551 4128 7390
+3  7390 4422 551
+3  4423 7390 4128
+3  4128 686 4423
+3  4346 7391 4423
+3  4423 686 4346
+3  4424 7391 4346
+3  4346 642 4424
+3  684 4419 7391
+3  7391 4424 684
+3  687 4423 7391
+3  7391 4419 687
+3  685 4425 4324
+3  681 4426 4425
+3  682 4324 4426
+3  4324 4425 4426
+3  675 4427 7392
+3  7392 4114 675
+3  676 4414 7392
+3  7392 4427 676
+3  4425 7392 4414
+3  4414 681 4425
+3  685 4114 7392
+3  7392 4425 685
+3  4088 7393 4429
+3  4429 670 4088
+3  1152 4428 7393
+3  7393 4088 1152
+3  1153 4082 7393
+3  7393 4428 1153
+3  668 4429 7393
+3  7393 4082 668
+3  683 4430 4126
+3  684 4424 4430
+3  642 4126 4424
+3  4126 4430 4424
+3  4347 7394 4430
+3  4430 683 4347
+3  4426 7394 4347
+3  4347 682 4426
+3  4417 7394 4426
+3  4426 681 4417
+3  4430 7394 4417
+3  4417 684 4430
+3  4084 7395 4432
+3  4432 666 4084
+3  2097 4431 7395
+3  7395 4084 2097
+3  1154 4078 7395
+3  7395 4431 1154
+3  664 4432 7395
+3  7395 4078 664
+3  548 4165 7396
+3  7396 4434 548
+3  3041 7396 4165
+3  4165 344 3041
+3  334 4433 7396
+3  7396 3041 334
+3  550 4434 7396
+3  7396 4433 550
+3  4169 7397 3046
+3  3046 335 4169
+3  552 4435 7397
+3  7397 4169 552
+3  550 4433 7397
+3  7397 4435 550
+3  334 3046 7397
+3  7397 4433 334
+3  4193 7398 4409
+3  4409 679 4193
+3  4436 7398 4193
+3  4193 639 4436
+3  638 4220 7398
+3  7398 4436 638
+3  4409 7398 4220
+3  4220 680 4409
+3  4437 7399 4310
+3  4310 637 4437
+3  4438 7399 4437
+3  4437 518 4438
+3  519 4439 7399
+3  7399 4438 519
+3  634 4310 7399
+3  7399 4439 634
+3  511 4440 4314
+3  665 4107 4440
+3  678 4314 4107
+3  4314 4440 4107
+3  4110 7400 4440
+3  4440 511 4110
+3  4441 7400 4110
+3  4110 677 4441
+3  4442 7400 4441
+3  4441 667 4442
+3  665 4440 7400
+3  7400 4442 665
+3  4415 7401 4441
+3  4441 677 4415
+3  676 4443 7401
+3  7401 4415 676
+3  669 4444 7401
+3  7401 4443 669
+3  667 4441 7401
+3  7401 4444 667
+3  676 4427 7402
+3  7402 4443 676
+3  675 4445 7402
+3  7402 4427 675
+3  671 4446 7402
+3  7402 4445 671
+3  4443 7402 4446
+3  4446 669 4443
+3  4113 7403 4445
+3  4445 675 4113
+3  4447 7403 4113
+3  4113 674 4447
+3  673 4448 7403
+3  7403 4447 673
+3  671 4445 7403
+3  7403 4448 671
+3  652 4449 7404
+3  7404 4118 652
+3  4319 7404 4449
+3  4449 653 4319
+3  673 4447 7404
+3  7404 4319 673
+3  4118 7404 4447
+3  4447 674 4118
+3  655 4092 7405
+3  7405 4451 655
+3  672 4450 7405
+3  7405 4092 672
+3  4318 7405 4450
+3  4450 673 4318
+3  654 4451 7405
+3  7405 4318 654
+3  4089 7406 4450
+3  4450 672 4089
+3  670 4452 7406
+3  7406 4089 670
+3  671 4448 7406
+3  7406 4452 671
+3  4450 7406 4448
+3  4448 673 4450
+3  670 4429 7407
+3  7407 4452 670
+3  668 4453 7407
+3  7407 4429 668
+3  669 4446 7407
+3  7407 4453 669
+3  4452 7407 4446
+3  4446 671 4452
+3  4085 7408 4453
+3  4453 668 4085
+3  666 4454 7408
+3  7408 4085 666
+3  667 4444 7408
+3  7408 4454 667
+3  4453 7408 4444
+3  4444 669 4453
+3  666 4432 7409
+3  7409 4454 666
+3  664 4455 7409
+3  7409 4432 664
+3  4442 7409 4455
+3  4455 665 4442
+3  667 4454 7409
+3  7409 4442 667
+3  4081 7410 4455
+3  4455 664 4081
+3  662 4456 7410
+3  7410 4081 662
+3  663 4108 7410
+3  7410 4456 663
+3  4455 7410 4108
+3  4108 665 4455
+3  662 4412 7411
+3  7411 4456 662
+3  660 4457 7411
+3  7411 4412 660
+3  661 4410 7411
+3  7411 4457 661
+3  4456 7411 4410
+3  4410 663 4456
+3  4077 7412 4457
+3  4457 660 4077
+3  659 4458 7412
+3  7412 4077 659
+3  658 4195 7412
+3  7412 4458 658
+3  4457 7412 4195
+3  4195 661 4457
+3  4459 7413 4074
+3  4074 640 4459
+3  4101 7413 4459
+3  4459 499 4101
+3  658 4458 7413
+3  7413 4101 658
+3  659 4074 7413
+3  7413 4458 659
+3  4460 7414 4021
+3  4021 627 4460
+3  628 4070 7414
+3  7414 4460 628
+3  656 3983 7414
+3  7414 4070 656
+3  4021 7414 3983
+3  3983 657 4021
+3  1170 4090 7415
+3  7415 4462 1170
+3  655 4461 7415
+3  7415 4090 655
+3  2819 7415 4461
+3  4461 286 2819
+3  1150 4462 7415
+3  7415 2819 1150
+3  4451 7416 4461
+3  4461 655 4451
+3  654 4463 7416
+3  7416 4451 654
+3  285 2829 7416
+3  7416 4463 285
+3  286 4461 7416
+3  7416 2829 286
+3  4320 7417 4463
+3  4463 654 4320
+3  4464 7417 4320
+3  4320 653 4464
+3  300 2821 7417
+3  7417 4464 300
+3  4463 7417 2821
+3  2821 285 4463
+3  652 4465 4449
+3  300 4464 4465
+3  653 4449 4464
+3  4449 4465 4464
+3  4117 7418 4465
+3  4465 652 4117
+3  4466 7418 4117
+3  4117 651 4466
+3  2814 7418 4466
+3  4466 297 2814
+3  4465 7418 2814
+3  2814 300 4465
+3  651 4321 7419
+3  7419 4466 651
+3  650 4467 7419
+3  7419 4321 650
+3  296 2822 7419
+3  7419 4467 296
+3  4466 7419 2822
+3  2822 297 4466
+3  4343 7420 4467
+3  4467 650 4343
+3  4468 7420 4343
+3  4343 649 4468
+3  2793 7420 4468
+3  4468 305 2793
+3  4467 7420 2793
+3  2793 296 4467
+3  649 4341 7421
+3  7421 4468 649
+3  648 4469 7421
+3  7421 4341 648
+3  2810 7421 4469
+3  4469 306 2810
+3  305 4468 7421
+3  7421 2810 305
+3  4179 7422 4469
+3  4469 648 4179
+3  646 4470 7422
+3  7422 4179 646
+3  647 4335 7422
+3  7422 4470 647
+3  4469 7422 4335
+3  4335 306 4469
+3  4389 7423 4470
+3  4470 646 4389
+3  644 4471 7423
+3  7423 4389 644
+3  645 4354 7423
+3  7423 4471 645
+3  4470 7423 4354
+3  4354 647 4470
+3  4376 7424 4471
+3  4471 644 4376
+3  555 4472 7424
+3  7424 4376 555
+3  557 4379 7424
+3  7424 4472 557
+3  4471 7424 4379
+3  4379 645 4471
+3  556 4170 7425
+3  7425 4473 556
+3  3048 7425 4170
+3  4170 332 3048
+3  333 4351 7425
+3  7425 3048 333
+3  4473 7425 4351
+3  4351 558 4473
+3  642 4345 4127
+3  641 4177 4345
+3  643 4127 4177
+3  4127 4345 4177
+3  4098 7426 4476
+3  4476 518 4098
+3  4474 7426 4098
+3  4098 499 4474
+3  500 4475 7426
+3  7426 4474 500
+3  517 4476 7426
+3  7426 4475 517
+3  4459 7427 4479
+3  4479 499 4459
+3  640 4477 7427
+3  7427 4459 640
+3  629 4478 7427
+3  7427 4477 629
+3  498 4479 7427
+3  7427 4478 498
+3  640 4073 7428
+3  7428 4477 640
+3  1172 4480 7428
+3  7428 4073 1172
+3  1155 4481 7428
+3  7428 4480 1155
+3  4477 7428 4481
+3  4481 629 4477
+3  518 4437 7429
+3  7429 4099 518
+3  637 4482 7429
+3  7429 4437 637
+3  4436 7429 4482
+3  4482 638 4436
+3  639 4099 7429
+3  7429 4436 639
+3  4309 7430 4482
+3  4482 637 4309
+3  4399 7430 4309
+3  4309 636 4399
+3  4221 7430 4399
+3  4399 635 4221
+3  638 4482 7430
+3  7430 4221 638
+3  500 4483 7431
+3  7431 4475 500
+3  501 4097 7431
+3  7431 4483 501
+3  4484 7431 4097
+3  4097 521 4484
+3  517 4475 7431
+3  7431 4484 517
+3  519 4485 7432
+3  7432 4439 519
+3  520 4104 7432
+3  7432 4485 520
+3  4486 7432 4104
+3  4104 633 4486
+3  4439 7432 4486
+3  4486 634 4439
+3  633 4205 7433
+3  7433 4486 633
+3  632 4487 7433
+3  7433 4205 632
+3  4307 7433 4487
+3  4487 630 4307
+3  4486 7433 4307
+3  4307 634 4486
+3  631 4401 4403
+3  630 4487 4401
+3  632 4403 4487
+3  4403 4401 4487
+3  230 4068 7434
+3  7434 4489 230
+3  628 4488 7434
+3  7434 4068 628
+3  629 4481 7434
+3  7434 4488 629
+3  4489 7434 4481
+3  4481 1155 4489
+3  4460 7435 4488
+3  4488 628 4460
+3  627 4490 7435
+3  7435 4460 627
+3  498 4478 7435
+3  7435 4490 498
+3  4488 7435 4478
+3  4478 629 4488
+3  627 4020 7436
+3  7436 4490 627
+3  626 4491 7436
+3  7436 4020 626
+3  502 4492 7436
+3  7436 4491 502
+3  4490 7436 4492
+3  4492 498 4490
+3  4093 7437 4491
+3  4491 626 4093
+3  4493 7437 4093
+3  4093 625 4493
+3  504 4494 7437
+3  7437 4493 504
+3  502 4491 7437
+3  7437 4494 502
+3  624 4495 4037
+3  504 4493 4495
+3  625 4037 4493
+3  4037 4495 4493
+3  624 4189 7438
+3  7438 4495 624
+3  623 4496 7438
+3  7438 4189 623
+3  506 4497 7438
+3  7438 4496 506
+3  4495 7438 4497
+3  4497 504 4495
+3  4153 7439 4496
+3  4496 623 4153
+3  4498 7439 4153
+3  4153 622 4498
+3  4499 7439 4498
+3  4498 537 4499
+3  4496 7439 4499
+3  4499 506 4496
+3  4224 7440 4498
+3  4498 622 4224
+3  4500 7440 4224
+3  4224 621 4500
+3  4226 7440 4500
+3  4500 410 4226
+3  537 4498 7440
+3  7440 4226 537
+3  409 4501 4392
+3  410 4500 4501
+3  621 4392 4500
+3  4392 4501 4500
+3  411 4502 4503
+3  454 4390 4502
+3  410 4503 4390
+3  4503 4502 4390
+3  4504 7441 3126
+3  3126 587 4504
+3  4505 7441 4504
+3  4504 453 4505
+3  4502 7441 4505
+3  4505 454 4502
+3  411 3126 7441
+3  7441 4502 411
+3  619 3520 3516
+3  618 3581 3520
+3  620 3516 3581
+3  3516 3520 3581
+3  443 3518 7442
+3  7442 4508 443
+3  442 4506 7442
+3  7442 3518 442
+3  1157 4507 7442
+3  7442 4506 1157
+3  4508 7442 4507
+3  4507 2102 4508
+3  616 3730 7443
+3  7443 3761 616
+3  615 3514 7443
+3  7443 3730 615
+3  3861 7443 3514
+3  3514 614 3861
+3  617 3761 7443
+3  7443 3861 617
+3  3734 7444 3513
+3  3513 612 3734
+3  3512 7444 3734
+3  3734 611 3512
+3  3855 7444 3512
+3  3512 610 3855
+3  613 3513 7444
+3  7444 3855 613
+3  3509 7445 3508
+3  3508 608 3509
+3  3718 7445 3509
+3  3509 607 3718
+3  3822 7445 3718
+3  3718 606 3822
+3  3508 7445 3822
+3  3822 609 3508
+3  604 3506 3798
+3  603 3576 3506
+3  605 3798 3576
+3  3798 3506 3576
+3  601 3721 7446
+3  7446 3505 601
+3  600 3502 7446
+3  7446 3721 600
+3  3894 7446 3502
+3  3502 599 3894
+3  3505 7446 3894
+3  3894 602 3505
+3  598 3926 3541
+3  217 4509 3926
+3  1159 3541 4509
+3  3541 3926 4509
+3  596 3497 3498
+3  595 3929 3497
+3  597 3498 3929
+3  3498 3497 3929
+3  3488 7447 3496
+3  3496 593 3488
+3  592 3552 7447
+3  7447 3488 592
+3  591 3934 7447
+3  7447 3552 591
+3  594 3496 7447
+3  7447 3934 594
+3  423 3598 7448
+3  7448 4510 423
+3  590 3482 7448
+3  7448 3598 590
+3  4042 7448 3482
+3  3482 460 4042
+3  422 4510 7448
+3  7448 4042 422
+3  588 3285 7449
+3  7449 4513 588
+3  4192 7449 3285
+3  3285 589 4192
+3  4511 7449 4192
+3  4192 421 4511
+3  4512 7449 4511
+3  4511 419 4512
+3  4513 7449 4512
+3  4512 453 4513
+3  4504 7450 4513
+3  4513 453 4504
+3  587 3480 7450
+3  7450 4504 587
+3  586 3642 7450
+3  7450 3480 586
+3  588 4513 7450
+3  7450 3642 588
+3  584 3479 3872
+3  583 3839 3479
+3  585 3872 3839
+3  3872 3479 3839
+3  581 3876 7451
+3  7451 3478 581
+3  580 3477 7451
+3  7451 3876 580
+3  3832 7451 3477
+3  3477 579 3832
+3  582 3478 7451
+3  7451 3832 582
+3  577 3857 7452
+3  7452 3476 577
+3  576 3475 7452
+3  7452 3857 576
+3  3828 7452 3475
+3  3475 575 3828
+3  578 3476 7452
+3  7452 3828 578
+3  573 3511 7453
+3  7453 3474 573
+3  572 3473 7453
+3  7453 3511 572
+3  3507 7453 3473
+3  3473 571 3507
+3  574 3474 7453
+3  7453 3507 574
+3  569 3732 7454
+3  7454 3472 569
+3  568 3471 7454
+3  7454 3732 568
+3  3500 7454 3471
+3  3471 567 3500
+3  570 3472 7454
+3  7454 3500 570
+3  565 3977 7455
+3  7455 3469 565
+3  564 3468 7455
+3  7455 3977 564
+3  3515 7455 3468
+3  3468 563 3515
+3  3469 7455 3515
+3  3515 566 3469
+3  562 3980 7456
+3  7456 3467 562
+3  2101 4514 7456
+3  7456 3980 2101
+3  1175 4515 7456
+3  7456 4514 1175
+3  3467 7456 4515
+3  4515 441 3467
+3  4382 7457 4355
+3  4355 561 4382
+3  559 4516 7457
+3  7457 4382 559
+3  560 4378 7457
+3  7457 4516 560
+3  4355 7457 4378
+3  4378 408 4355
+3  559 4380 7458
+3  7458 4516 559
+3  557 4517 7458
+3  7458 4380 557
+3  558 4350 7458
+3  7458 4517 558
+3  4516 7458 4350
+3  4350 560 4516
+3  4472 7459 4517
+3  4517 557 4472
+3  4518 7459 4472
+3  4472 555 4518
+3  4473 7459 4518
+3  4518 556 4473
+3  558 4517 7459
+3  7459 4473 558
+3  555 4375 7460
+3  7460 4518 555
+3  553 4519 7460
+3  7460 4375 553
+3  554 4171 7460
+3  7460 4519 554
+3  4518 7460 4171
+3  4171 556 4518
+3  4129 7461 4519
+3  4519 553 4129
+3  4520 7461 4129
+3  4129 551 4520
+3  4168 7461 4520
+3  4520 552 4168
+3  4519 7461 4168
+3  4168 554 4519
+3  551 4422 7462
+3  7462 4520 551
+3  549 4521 7462
+3  7462 4422 549
+3  550 4435 7462
+3  7462 4521 550
+3  4520 7462 4435
+3  4435 552 4520
+3  4420 7463 4521
+3  4521 549 4420
+3  547 4522 7463
+3  7463 4420 547
+3  548 4434 7463
+3  7463 4522 548
+3  4521 7463 4434
+3  4434 550 4521
+3  547 4133 7464
+3  7464 4522 547
+3  545 4523 7464
+3  7464 4133 545
+3  546 4166 7464
+3  7464 4523 546
+3  4522 7464 4166
+3  4166 548 4522
+3  545 4136 7465
+3  7465 4523 545
+3  543 4524 7465
+3  7465 4136 543
+3  544 4162 7465
+3  7465 4524 544
+3  4523 7465 4162
+3  4162 546 4523
+3  4359 7466 4524
+3  4524 543 4359
+3  4525 7466 4359
+3  4359 541 4525
+3  4366 7466 4525
+3  4525 542 4366
+3  4524 7466 4366
+3  4366 544 4524
+3  541 4240 7467
+3  7467 4525 541
+3  539 4526 7467
+3  7467 4240 539
+3  540 4365 7467
+3  7467 4526 540
+3  4525 7467 4365
+3  4365 542 4525
+3  4235 7468 4526
+3  4526 539 4235
+3  4527 7468 4235
+3  4235 538 4527
+3  414 4361 7468
+3  7468 4527 414
+3  4526 7468 4361
+3  4361 540 4526
+3  4232 7469 4527
+3  4527 538 4232
+3  4528 7469 4232
+3  4232 509 4528
+3  413 4529 7469
+3  7469 4528 413
+3  414 4527 7469
+3  7469 4529 414
+3  4530 7470 4528
+3  4528 509 4530
+3  4531 7470 4530
+3  4530 508 4531
+3  4225 7470 4531
+3  4531 537 4225
+3  413 4528 7470
+3  7470 4225 413
+3  506 4499 4532
+3  537 4531 4499
+3  508 4532 4531
+3  4532 4499 4531
+3  536 4533 4173
+3  516 4534 4533
+3  514 4173 4534
+3  4173 4533 4534
+3  4176 7471 4533
+3  4533 536 4176
+3  534 4535 7471
+3  7471 4176 534
+3  535 4360 7471
+3  7471 4535 535
+3  516 4533 7471
+3  7471 4360 516
+3  4243 7472 4535
+3  4535 534 4243
+3  4536 7472 4243
+3  4243 532 4536
+3  4242 7472 4536
+3  4536 533 4242
+3  535 4535 7472
+3  7472 4242 535
+3  4147 7473 4536
+3  4536 532 4147
+3  530 4537 7473
+3  7473 4147 530
+3  531 4237 7473
+3  7473 4537 531
+3  533 4536 7473
+3  7473 4237 533
+3  530 4144 7474
+3  7474 4537 530
+3  528 4538 7474
+3  7474 4144 528
+3  529 4234 7474
+3  7474 4538 529
+3  4537 7474 4234
+3  4234 531 4537
+3  528 4231 7475
+3  7475 4538 528
+3  526 4539 7475
+3  7475 4231 526
+3  4230 7475 4539
+3  4539 527 4230
+3  529 4538 7475
+3  7475 4230 529
+3  4198 7476 4539
+3  4539 526 4198
+3  524 4540 7476
+3  7476 4198 524
+3  525 4140 7476
+3  7476 4540 525
+3  4539 7476 4140
+3  4140 527 4539
+3  4150 7477 4540
+3  4540 524 4150
+3  522 4541 7477
+3  7477 4150 522
+3  523 4152 7477
+3  7477 4541 523
+3  4540 7477 4152
+3  4152 525 4540
+3  4105 7478 4541
+3  4541 522 4105
+3  520 4542 7478
+3  7478 4105 520
+3  521 4096 7478
+3  7478 4542 521
+3  4541 7478 4096
+3  4096 523 4541
+3  520 4485 7479
+3  7479 4542 520
+3  519 4543 7479
+3  7479 4485 519
+3  4484 7479 4543
+3  4543 517 4484
+3  521 4542 7479
+3  7479 4484 521
+3  518 4476 4438
+3  517 4543 4476
+3  519 4438 4543
+3  4438 4476 4543
+3  4122 7480 4137
+3  4137 515 4122
+3  513 4544 7480
+3  7480 4122 513
+3  514 4534 7480
+3  7480 4544 514
+3  4137 7480 4534
+3  4534 516 4137
+3  4327 7481 4544
+3  4544 513 4327
+3  4545 7481 4327
+3  4327 512 4545
+3  4328 7481 4545
+3  4545 510 4328
+3  4544 7481 4328
+3  4328 514 4544
+3  511 4317 4111
+3  510 4545 4317
+3  512 4111 4545
+3  4111 4317 4545
+3  507 4546 4228
+3  508 4530 4546
+3  509 4228 4530
+3  4228 4546 4530
+3  4138 7482 4546
+3  4546 507 4138
+3  4547 7482 4138
+3  4138 505 4547
+3  4532 7482 4547
+3  4547 506 4532
+3  508 4546 7482
+3  7482 4532 508
+3  505 4151 7483
+3  7483 4547 505
+3  503 4548 7483
+3  7483 4151 503
+3  4497 7483 4548
+3  4548 504 4497
+3  506 4547 7483
+3  7483 4497 506
+3  4094 7484 4548
+3  4548 503 4094
+3  4549 7484 4094
+3  4094 501 4549
+3  4494 7484 4549
+3  4549 502 4494
+3  4548 7484 4494
+3  4494 504 4548
+3  501 4483 7485
+3  7485 4549 501
+3  500 4550 7485
+3  7485 4483 500
+3  4492 7485 4550
+3  4550 498 4492
+3  502 4549 7485
+3  7485 4492 502
+3  499 4479 4474
+3  498 4550 4479
+3  500 4474 4550
+3  4474 4479 4550
+3  4551 7486 4562
+3  4562 478 4551
+3  4552 7486 4551
+3  4551 480 4552
+3  4553 7486 4552
+3  4552 482 4553
+3  4554 7486 4553
+3  4553 484 4554
+3  4555 7486 4554
+3  4554 486 4555
+3  4556 7486 4555
+3  4555 488 4556
+3  4557 7486 4556
+3  4556 490 4557
+3  4558 7486 4557
+3  4557 492 4558
+3  4559 7486 4558
+3  4558 494 4559
+3  4560 7486 4559
+3  4559 496 4560
+3  4561 7486 4560
+3  4560 477 4561
+3  4562 7486 4561
+3  4561 474 4562
+3  497 4294 7487
+3  7487 4564 497
+3  476 4563 7487
+3  7487 4294 476
+3  4560 7487 4563
+3  4563 477 4560
+3  496 4564 7487
+3  7487 4560 496
+3  4296 7488 4565
+3  4565 495 4296
+3  4564 7488 4296
+3  4296 497 4564
+3  4559 7488 4564
+3  4564 496 4559
+3  4565 7488 4559
+3  4559 494 4565
+3  4297 7489 4566
+3  4566 493 4297
+3  495 4565 7489
+3  7489 4297 495
+3  4558 7489 4565
+3  4565 494 4558
+3  492 4566 7489
+3  7489 4558 492
+3  4300 7490 4567
+3  4567 491 4300
+3  4566 7490 4300
+3  4300 493 4566
+3  492 4557 7490
+3  7490 4566 492
+3  4567 7490 4557
+3  4557 490 4567
+3  489 4302 7491
+3  7491 4568 489
+3  491 4567 7491
+3  7491 4302 491
+3  4556 7491 4567
+3  4567 490 4556
+3  488 4568 7491
+3  7491 4556 488
+3  487 4313 7492
+3  7492 4569 487
+3  4568 7492 4313
+3  4313 489 4568
+3  488 4555 7492
+3  7492 4568 488
+3  4569 7492 4555
+3  4555 486 4569
+3  4304 7493 4570
+3  4570 485 4304
+3  4569 7493 4304
+3  4304 487 4569
+3  4554 7493 4569
+3  4569 486 4554
+3  4570 7493 4554
+3  4554 484 4570
+3  4284 7494 4571
+3  4571 483 4284
+3  485 4570 7494
+3  7494 4284 485
+3  4553 7494 4570
+3  4570 484 4553
+3  482 4571 7494
+3  7494 4553 482
+3  481 4286 7495
+3  7495 4572 481
+3  483 4571 7495
+3  7495 4286 483
+3  4552 7495 4571
+3  4571 482 4552
+3  480 4572 7495
+3  7495 4552 480
+3  479 4288 7496
+3  7496 4573 479
+3  4572 7496 4288
+3  4288 481 4572
+3  480 4551 7496
+3  7496 4572 480
+3  4573 7496 4551
+3  4551 478 4573
+3  475 4290 7497
+3  7497 4574 475
+3  4573 7497 4290
+3  4290 479 4573
+3  4562 7497 4573
+3  4573 478 4562
+3  474 4574 7497
+3  7497 4562 474
+3  4292 7498 4563
+3  4563 476 4292
+3  4574 7498 4292
+3  4292 475 4574
+3  4561 7498 4574
+3  4574 474 4561
+3  477 4563 7498
+3  7498 4561 477
+3  322 4575 7499
+3  7499 3053 322
+3  470 4576 7499
+3  7499 4575 470
+3  4374 7499 4576
+3  4576 473 4374
+3  3053 7499 4374
+3  4374 324 3053
+3  470 4577 7500
+3  7500 4576 470
+3  451 4578 7500
+3  7500 4577 451
+3  472 4044 7500
+3  7500 4578 472
+3  4576 7500 4044
+3  4044 473 4576
+3  4578 7501 4040
+3  4040 472 4578
+3  451 4579 7501
+3  7501 4578 451
+3  418 4580 7501
+3  7501 4579 418
+3  420 4040 7501
+3  7501 4580 420
+3  451 4577 7502
+3  7502 4582 451
+3  470 4581 7502
+3  7502 4577 470
+3  471 4159 7502
+3  7502 4581 471
+3  4582 7502 4159
+3  4159 452 4582
+3  4575 7503 4581
+3  4581 470 4575
+3  3055 7503 4575
+3  4575 322 3055
+3  4357 7503 3055
+3  3055 323 4357
+3  4581 7503 4357
+3  4357 471 4581
+3  467 3465 4371
+3  469 3460 3465
+3  456 4371 3460
+3  4371 3465 3460
+3  4047 7504 3466
+3  3466 467 4047
+3  3463 7504 4047
+3  4047 464 3463
+3  466 3535 7504
+3  7504 3463 466
+3  468 3466 7504
+3  7504 3535 468
+3  4373 7505 3464
+3  3464 464 4373
+3  3458 7505 4373
+3  4373 461 3458
+3  463 3491 7505
+3  7505 3458 463
+3  465 3464 7505
+3  7505 3491 465
+3  4045 7506 3459
+3  3459 461 4045
+3  3484 7506 4045
+3  4045 460 3484
+3  459 3485 7506
+3  7506 3484 459
+3  462 3459 7506
+3  7506 3485 462
+3  4372 7507 3688
+3  3688 457 4372
+3  3462 7507 4372
+3  4372 456 3462
+3  455 3702 7507
+3  7507 3462 455
+3  458 3688 7507
+3  7507 3702 458
+3  453 4512 7508
+3  7508 4505 453
+3  419 4583 7508
+3  7508 4512 419
+3  4391 7508 4583
+3  4583 416 4391
+3  454 4505 7508
+3  7508 4391 454
+3  417 4584 7509
+3  7509 4155 417
+3  418 4579 7509
+3  7509 4584 418
+3  4582 7509 4579
+3  4579 451 4582
+3  452 4155 7509
+3  7509 4582 452
+3  2103 2437 7510
+3  7510 4586 2103
+3  4010 7510 2437
+3  2437 450 4010
+3  449 4585 7510
+3  7510 4010 449
+3  231 4586 7510
+3  7510 4585 231
+3  4032 7511 3432
+3  3432 448 4032
+3  1158 4587 7511
+3  7511 4032 1158
+3  231 4585 7511
+3  7511 4587 231
+3  3432 7511 4585
+3  4585 449 3432
+3  1177 4030 7512
+3  7512 4589 1177
+3  3169 7512 4030
+3  4030 447 3169
+3  444 4588 7512
+3  7512 3169 444
+3  1176 4589 7512
+3  7512 4588 1176
+3  4036 7513 3457
+3  3457 445 4036
+3  1173 4590 7513
+3  7513 4036 1173
+3  1174 4033 7513
+3  7513 4590 1174
+3  446 3457 7513
+3  7513 4033 446
+3  4508 7514 4011
+3  4011 443 4508
+3  2102 4591 7514
+3  7514 4508 2102
+3  1176 4588 7514
+3  7514 4591 1176
+3  4011 7514 4588
+3  4588 444 4011
+3  1157 4506 7515
+3  7515 4592 1157
+3  442 3080 7515
+3  7515 4506 442
+3  4515 7515 3080
+3  3080 441 4515
+3  1175 4592 7515
+3  7515 4515 1175
+3  4060 7516 4593
+3  4593 218 4060
+3  3182 7516 4060
+3  4060 440 3182
+3  439 4057 7516
+3  7516 3182 439
+3  2085 4593 7516
+3  7516 4057 2085
+3  4059 7517 3325
+3  3325 437 4059
+3  1160 4594 7517
+3  7517 4059 1160
+3  1140 4368 7517
+3  7517 4594 1140
+3  3325 7517 4368
+3  4368 438 3325
+3  1141 4067 7518
+3  7518 4595 1141
+3  436 4017 7518
+3  7518 4067 436
+3  435 4063 7518
+3  7518 4017 435
+3  4595 7518 4063
+3  4063 219 4595
+3  4066 7519 3292
+3  3292 433 4066
+3  2086 4596 7519
+3  7519 4066 2086
+3  1142 4384 7519
+3  7519 4596 1142
+3  3292 7519 4384
+3  4384 434 3292
+3  4055 7520 4598
+3  4598 1143 4055
+3  431 4597 7520
+3  7520 4055 431
+3  432 4386 7520
+3  7520 4597 432
+3  4598 7520 4386
+3  4386 1162 4598
+3  4388 7521 4597
+3  4597 431 4388
+3  4599 7521 4388
+3  4388 429 4599
+3  430 4387 7521
+3  7521 4599 430
+3  4597 7521 4387
+3  4387 432 4597
+3  4053 7522 4599
+3  4599 429 4053
+3  427 4600 7522
+3  7522 4053 427
+3  428 4383 7522
+3  7522 4600 428
+3  430 4599 7522
+3  7522 4383 430
+3  4050 7523 4600
+3  4600 427 4050
+3  3305 7523 4050
+3  4050 426 3305
+3  425 4064 7523
+3  7523 3305 425
+3  4600 7523 4064
+3  4064 428 4600
+3  4510 7524 4018
+3  4018 423 4510
+3  4601 7524 4510
+3  4510 422 4601
+3  4191 7524 4601
+3  4601 421 4191
+3  424 4018 7524
+3  7524 4191 424
+3  420 4602 4041
+3  421 4601 4602
+3  422 4041 4601
+3  4041 4602 4601
+3  420 4580 7525
+3  7525 4602 420
+3  418 4603 7525
+3  7525 4580 418
+3  419 4511 7525
+3  7525 4603 419
+3  4602 7525 4511
+3  4511 421 4602
+3  4584 7526 4603
+3  4603 418 4584
+3  4604 7526 4584
+3  4584 417 4604
+3  4583 7526 4604
+3  4604 416 4583
+3  4603 7526 4583
+3  4583 419 4603
+3  415 4605 4158
+3  416 4604 4605
+3  417 4158 4604
+3  4158 4605 4604
+3  415 4362 7527
+3  7527 4605 415
+3  4529 7527 4362
+3  4362 414 4529
+3  4238 7527 4529
+3  4529 413 4238
+3  416 4605 7527
+3  7527 4238 416
+3  4503 7528 3127
+3  3127 411 4503
+3  4501 7528 4503
+3  4503 410 4501
+3  409 4027 7528
+3  7528 4501 409
+3  412 3127 7528
+3  7528 4027 412
+3  1228 4606 7529
+3  7529 4608 1228
+3  1165 2657 7529
+3  7529 4606 1165
+3  1164 4607 7529
+3  7529 2657 1164
+3  4608 7529 4607
+3  4607 1216 4608
+3  1230 4609 7530
+3  7530 4611 1230
+3  2090 2661 7530
+3  7530 4609 2090
+3  224 4610 7530
+3  7530 2661 224
+3  4611 7530 4610
+3  4610 1229 4611
+3  4612 7531 4608
+3  4608 1216 4612
+3  4613 7531 4612
+3  4612 1215 4613
+3  4614 7531 4613
+3  4613 1224 4614
+3  1228 4608 7531
+3  7531 4614 1228
+3  4615 7532 4611
+3  4611 1229 4615
+3  4616 7532 4615
+3  4615 1221 4616
+3  4617 7532 4616
+3  4616 1220 4617
+3  1230 4611 7532
+3  7532 4617 1230
+3  1214 4618 7533
+3  7533 4621 1214
+3  1212 4619 7533
+3  7533 4618 1212
+3  1213 4620 7533
+3  7533 4619 1213
+3  4621 7533 4620
+3  4620 1225 4621
+3  1222 4622 7534
+3  7534 4625 1222
+3  1198 4623 7534
+3  7534 4622 1198
+3  1197 4624 7534
+3  7534 4623 1197
+3  4625 7534 4624
+3  4624 1223 4625
+3  1198 4622 7535
+3  7535 4627 1198
+3  1222 4626 7535
+3  7535 4622 1222
+3  4620 7535 4626
+3  4626 1225 4620
+3  1213 4627 7535
+3  7535 4620 1213
+3  4628 7536 4614
+3  4614 1224 4628
+3  4615 7536 4628
+3  4628 1221 4615
+3  1229 4629 7536
+3  7536 4615 1229
+3  1228 4614 7536
+3  7536 4629 1228
+3  4629 7537 4606
+3  4606 1228 4629
+3  4610 7537 4629
+3  4629 1229 4610
+3  224 2680 7537
+3  7537 4610 224
+3  4606 7537 2680
+3  2680 1165 4606
+3  223 2681 7538
+3  7538 4632 223
+3  1146 4630 7538
+3  7538 2681 1146
+3  1226 4631 7538
+3  7538 4630 1226
+3  4632 7538 4631
+3  4631 1227 4632
+3  4631 7539 4635
+3  4635 1227 4631
+3  1226 4633 7539
+3  7539 4631 1226
+3  1219 4634 7539
+3  7539 4633 1219
+3  4635 7539 4634
+3  4634 1199 4635
+3  1204 4636 7540
+3  7540 4639 1204
+3  1200 4637 7540
+3  7540 4636 1200
+3  4638 7540 4637
+3  4637 1218 4638
+3  1211 4639 7540
+3  7540 4638 1211
+3  1203 4640 4641
+3  1200 4636 4640
+3  1204 4641 4636
+3  4641 4640 4636
+3  4642 7541 4635
+3  4635 1199 4642
+3  1201 4643 7541
+3  7541 4642 1201
+3  1217 4644 7541
+3  7541 4643 1217
+3  1227 4635 7541
+3  7541 4644 1227
+3  1227 4644 7542
+3  7542 4632 1227
+3  1217 4645 7542
+3  7542 4644 1217
+3  1163 2697 7542
+3  7542 4645 1163
+3  4632 7542 2697
+3  2697 223 4632
+3  1226 4646 7543
+3  7543 4633 1226
+3  1206 4647 7543
+3  7543 4646 1206
+3  1208 4648 7543
+3  7543 4647 1208
+3  4633 7543 4648
+3  4648 1219 4633
+3  2702 7544 4630
+3  4630 1146 2702
+3  4649 7544 2702
+3  2702 222 4649
+3  1206 4646 7544
+3  7544 4649 1206
+3  4630 7544 4646
+3  4646 1226 4630
+3  1215 4650 7545
+3  7545 4613 1215
+3  1214 4621 7545
+3  7545 4650 1214
+3  4651 7545 4621
+3  4621 1225 4651
+3  4613 7545 4651
+3  4651 1224 4613
+3  1224 4651 7546
+3  7546 4628 1224
+3  1225 4626 7546
+3  7546 4651 1225
+3  4652 7546 4626
+3  4626 1222 4652
+3  4628 7546 4652
+3  4652 1221 4628
+3  1221 4652 7547
+3  7547 4616 1221
+3  1222 4625 7547
+3  7547 4652 1222
+3  4653 7547 4625
+3  4625 1223 4653
+3  4616 7547 4653
+3  4653 1220 4616
+3  1200 4640 4655
+3  1203 4654 4640
+3  1201 4655 4654
+3  4655 4640 4654
+3  1219 4656 7548
+3  7548 4634 1219
+3  1218 4637 7548
+3  7548 4656 1218
+3  4657 7548 4637
+3  4637 1200 4657
+3  4634 7548 4657
+3  4657 1199 4634
+3  4658 7549 4659
+3  4659 1210 4658
+3  1218 4656 7549
+3  7549 4658 1218
+3  1219 4648 7549
+3  7549 4656 1219
+3  4659 7549 4648
+3  4648 1208 4659
+3  1211 4638 4660
+3  1218 4658 4638
+3  1210 4660 4658
+3  4660 4638 4658
+3  2715 7550 4607
+3  4607 1164 2715
+3  4645 7550 2715
+3  2715 1163 4645
+3  4661 7550 4645
+3  4645 1217 4661
+3  4607 7550 4661
+3  4661 1216 4607
+3  1216 4661 7551
+3  7551 4612 1216
+3  1217 4643 7551
+3  7551 4661 1217
+3  1201 4662 7551
+3  7551 4643 1201
+3  4612 7551 4662
+3  4662 1215 4612
+3  1215 4662 7552
+3  7552 4650 1215
+3  4654 7552 4662
+3  4662 1201 4654
+3  1203 4663 7552
+3  7552 4654 1203
+3  1214 4650 7552
+3  7552 4663 1214
+3  1212 4618 7553
+3  7553 4665 1212
+3  4663 7553 4618
+3  4618 1214 4663
+3  4664 7553 4663
+3  4663 1203 4664
+3  1202 4665 7553
+3  7553 4664 1202
+3  2089 2721 7554
+3  7554 4668 2089
+3  1145 4666 7554
+3  7554 2721 1145
+3  1194 4667 7554
+3  7554 4666 1194
+3  4668 7554 4667
+3  4667 1205 4668
+3  4667 7555 4671
+3  4671 1205 4667
+3  1194 4669 7555
+3  7555 4667 1194
+3  1193 4670 7555
+3  7555 4669 1193
+3  4671 7555 4670
+3  4670 1207 4671
+3  4670 7556 4674
+3  4674 1207 4670
+3  1193 4672 7556
+3  7556 4670 1193
+3  4673 7556 4672
+3  4672 1190 4673
+3  1209 4674 7556
+3  7556 4673 1209
+3  1209 4673 4676
+3  1190 4675 4673
+3  1192 4676 4675
+3  4676 4673 4675
+3  1179 4677 7557
+3  7557 4679 1179
+3  1198 4627 7557
+3  7557 4677 1198
+3  1213 4678 7557
+3  7557 4627 1213
+3  4679 7557 4678
+3  4678 1180 4679
+3  4678 7558 4681
+3  4681 1180 4678
+3  4619 7558 4678
+3  4678 1213 4619
+3  4680 7558 4619
+3  4619 1212 4680
+3  4681 7558 4680
+3  4680 1182 4681
+3  1182 4680 7559
+3  7559 4683 1182
+3  1212 4665 7559
+3  7559 4680 1212
+3  1202 4682 7559
+3  7559 4665 1202
+3  4683 7559 4682
+3  4682 1184 4683
+3  4682 7560 4686
+3  4686 1184 4682
+3  4684 7560 4682
+3  4682 1202 4684
+3  1204 4685 7560
+3  7560 4684 1204
+3  1186 4686 7560
+3  7560 4685 1186
+3  1186 4685 7561
+3  7561 4688 1186
+3  4639 7561 4685
+3  4685 1204 4639
+3  1211 4687 7561
+3  7561 4639 1211
+3  1188 4688 7561
+3  7561 4687 1188
+3  1211 4660 7562
+3  7562 4687 1211
+3  4689 7562 4660
+3  4660 1210 4689
+3  4676 7562 4689
+3  4689 1209 4676
+3  4690 7562 4676
+3  4676 1192 4690
+3  1188 4687 7562
+3  7562 4690 1188
+3  1209 4689 7563
+3  7563 4674 1209
+3  1210 4659 7563
+3  7563 4689 1210
+3  1208 4691 7563
+3  7563 4659 1208
+3  4674 7563 4691
+3  4691 1207 4674
+3  4691 7564 4671
+3  4671 1207 4691
+3  1208 4647 7564
+3  7564 4691 1208
+3  1206 4692 7564
+3  7564 4647 1206
+3  1205 4671 7564
+3  7564 4692 1205
+3  1205 4692 7565
+3  7565 4668 1205
+3  4649 7565 4692
+3  4692 1206 4649
+3  222 2749 7565
+3  7565 4649 222
+3  4668 7565 2749
+3  2749 2089 4668
+3  1204 4684 4641
+3  1202 4664 4684
+3  1203 4641 4664
+3  4641 4684 4664
+3  1201 4642 4655
+3  1199 4657 4642
+3  1200 4655 4657
+3  4655 4642 4657
+3  4677 7566 4623
+3  4623 1198 4677
+3  4693 7566 4677
+3  4677 1179 4693
+3  1196 4694 7566
+3  7566 4693 1196
+3  4623 7566 4694
+3  4694 1197 4623
+3  1190 4672 4696
+3  1193 4695 4672
+3  1191 4696 4695
+3  4696 4672 4695
+3  1188 4690 4698
+3  1192 4697 4690
+3  1189 4698 4697
+3  4698 4690 4697
+3  1196 4693 4700
+3  1179 4699 4693
+3  1178 4700 4699
+3  4700 4693 4699
+3  1194 4666 7567
+3  7567 4702 1194
+3  2760 7567 4666
+3  4666 1145 2760
+3  1144 4701 7567
+3  7567 2760 1144
+3  1195 4702 7567
+3  7567 4701 1195
+3  4669 7568 4695
+3  4695 1193 4669
+3  4702 7568 4669
+3  4669 1194 4702
+3  1195 4703 7568
+3  7568 4702 1195
+3  1191 4695 7568
+3  7568 4703 1191
+3  4704 7569 4696
+3  4696 1191 4704
+3  4697 7569 4704
+3  4704 1189 4697
+3  4675 7569 4697
+3  4697 1192 4675
+3  1190 4696 7569
+3  7569 4675 1190
+3  1186 4688 7570
+3  7570 4706 1186
+3  1188 4698 7570
+3  7570 4688 1188
+3  4705 7570 4698
+3  4698 1189 4705
+3  4706 7570 4705
+3  4705 1187 4706
+3  4686 7571 4708
+3  4708 1184 4686
+3  4706 7571 4686
+3  4686 1186 4706
+3  1187 4707 7571
+3  7571 4706 1187
+3  1185 4708 7571
+3  7571 4707 1185
+3  1182 4683 7572
+3  7572 4710 1182
+3  4708 7572 4683
+3  4683 1184 4708
+3  1185 4709 7572
+3  7572 4708 1185
+3  1183 4710 7572
+3  7572 4709 1183
+3  1180 4681 7573
+3  7573 4712 1180
+3  1182 4710 7573
+3  7573 4681 1182
+3  1183 4711 7573
+3  7573 4710 1183
+3  4712 7573 4711
+3  4711 1181 4712
+3  4679 7574 4699
+3  4699 1179 4679
+3  1180 4712 7574
+3  7574 4679 1180
+3  1181 4713 7574
+3  7574 4712 1181
+3  1178 4699 7574
+3  7574 4713 1178
+3  4714 7575 4718
+3  4718 1255 4714
+3  4715 7575 4714
+3  4714 1254 4715
+3  1248 4716 7575
+3  7575 4715 1248
+3  1247 4717 7575
+3  7575 4716 1247
+3  4718 7575 4717
+3  4717 1256 4718
+3  1245 4719 4721
+3  1244 4720 4719
+3  1257 4721 4720
+3  4721 4719 4720
+3  4720 7576 4724
+3  4724 1257 4720
+3  1244 4722 7576
+3  7576 4720 1244
+3  1234 4723 7576
+3  7576 4722 1234
+3  1236 4724 7576
+3  7576 4723 1236
+3  1237 4725 7577
+3  7577 4727 1237
+3  1235 4726 7577
+3  7577 4725 1235
+3  2785 7577 4726
+3  4726 1169 2785
+3  1168 4727 7577
+3  7577 2785 1168
+3  1149 4728 2789
+3  1239 4729 4728
+3  229 2789 4729
+3  2789 4728 4729
+3  1235 4730 7578
+3  7578 4726 1235
+3  1233 4731 7578
+3  7578 4730 1233
+3  2096 2791 7578
+3  7578 4731 2096
+3  4726 7578 2791
+3  2791 1169 4726
+3  1251 4732 7579
+3  7579 4735 1251
+3  1242 4733 7579
+3  7579 4732 1242
+3  1245 4734 7579
+3  7579 4733 1245
+3  4735 7579 4734
+3  4734 1250 4735
+3  4736 7580 4721
+3  4721 1257 4736
+3  1247 4737 7580
+3  7580 4736 1247
+3  1250 4734 7580
+3  7580 4737 1250
+3  1245 4721 7580
+3  7580 4734 1245
+3  4738 7581 4724
+3  4724 1236 4738
+3  4717 7581 4738
+3  4738 1256 4717
+3  4736 7581 4717
+3  4717 1247 4736
+3  1257 4724 7581
+3  7581 4736 1257
+3  1238 4739 7582
+3  7582 4740 1238
+3  4718 7582 4739
+3  4739 1255 4718
+3  1256 4738 7582
+3  7582 4718 1256
+3  1236 4740 7582
+3  7582 4738 1236
+3  1240 4741 7583
+3  7583 4742 1240
+3  4714 7583 4741
+3  4741 1254 4714
+3  1255 4739 7583
+3  7583 4714 1255
+3  1238 4742 7583
+3  7583 4739 1238
+3  1253 4743 7584
+3  7584 4744 1253
+3  1248 4715 7584
+3  7584 4743 1248
+3  4741 7584 4715
+3  4715 1254 4741
+3  1240 4744 7584
+3  7584 4741 1240
+3  1248 4743 7585
+3  7585 4747 1248
+3  1253 4745 7585
+3  7585 4743 1253
+3  1252 4746 7585
+3  7585 4745 1252
+3  4747 7585 4746
+3  4746 1249 4747
+3  1252 4748 4746
+3  1251 4749 4748
+3  1249 4746 4749
+3  4746 4748 4749
+3  1250 4750 4735
+3  1249 4749 4750
+3  1251 4735 4749
+3  4735 4750 4749
+3  4747 7586 4716
+3  4716 1248 4747
+3  4750 7586 4747
+3  4747 1249 4750
+3  1250 4737 7586
+3  7586 4750 1250
+3  1247 4716 7586
+3  7586 4737 1247
+3  4751 7587 4729
+3  4729 1239 4751
+3  1237 4727 7587
+3  7587 4751 1237
+3  2813 7587 4727
+3  4727 1168 2813
+3  229 4729 7587
+3  7587 2813 229
+3  1244 4752 4754
+3  1243 4753 4752
+3  1246 4754 4753
+3  4754 4752 4753
+3  1233 4755 7588
+3  7588 4731 1233
+3  1232 4756 7588
+3  7588 4755 1232
+3  1150 2818 7588
+3  7588 4756 1150
+3  4731 7588 2818
+3  2818 2096 4731
+3  4754 7589 4722
+3  4722 1244 4754
+3  1246 4757 7589
+3  7589 4754 1246
+3  1231 4758 7589
+3  7589 4757 1231
+3  1234 4722 7589
+3  7589 4758 1234
+3  4752 7590 4759
+3  4759 1243 4752
+3  4719 7590 4752
+3  4752 1244 4719
+3  1245 4733 7590
+3  7590 4719 1245
+3  1242 4759 7590
+3  7590 4733 1242
+3  4728 7591 4762
+3  4762 1239 4728
+3  4760 7591 4728
+3  4728 1149 4760
+3  4761 7591 4760
+3  4760 1241 4761
+3  4762 7591 4761
+3  4761 1240 4762
+3  4751 7592 4763
+3  4763 1237 4751
+3  1239 4762 7592
+3  7592 4751 1239
+3  4742 7592 4762
+3  4762 1240 4742
+3  4763 7592 4742
+3  4742 1238 4763
+3  1235 4725 7593
+3  7593 4764 1235
+3  1237 4763 7593
+3  7593 4725 1237
+3  1238 4740 7593
+3  7593 4763 1238
+3  4764 7593 4740
+3  4740 1236 4764
+3  1233 4730 7594
+3  7594 4765 1233
+3  4764 7594 4730
+3  4730 1235 4764
+3  4723 7594 4764
+3  4764 1236 4723
+3  1234 4765 7594
+3  7594 4723 1234
+3  1232 4755 7595
+3  7595 4766 1232
+3  4765 7595 4755
+3  4755 1233 4765
+3  4758 7595 4765
+3  4765 1234 4758
+3  1231 4766 7595
+3  7595 4758 1231
+3  1354 4767 7596
+3  7596 4770 1354
+3  1332 4768 7596
+3  7596 4767 1332
+3  1333 4769 7596
+3  7596 4768 1333
+3  4770 7596 4769
+3  4769 1343 4770
+3  2095 2834 7597
+3  7597 4772 2095
+3  2094 4771 7597
+3  7597 2834 2094
+3  1332 4767 7597
+3  7597 4771 1332
+3  4772 7597 4767
+3  4767 1354 4772
+3  1353 4773 7598
+3  7598 4775 1353
+3  1342 4774 7598
+3  7598 4773 1342
+3  2839 7598 4774
+3  4774 220 2839
+3  2087 4775 7598
+3  7598 2839 2087
+3  1352 4776 7599
+3  7599 4778 1352
+3  1341 4777 7599
+3  7599 4776 1341
+3  1342 4773 7599
+3  7599 4777 1342
+3  4778 7599 4773
+3  4773 1353 4778
+3  1351 4779 7600
+3  7600 4781 1351
+3  1340 4780 7600
+3  7600 4779 1340
+3  1341 4776 7600
+3  7600 4780 1341
+3  4781 7600 4776
+3  4776 1352 4781
+3  1350 4782 7601
+3  7601 4784 1350
+3  1339 4783 7601
+3  7601 4782 1339
+3  1340 4779 7601
+3  7601 4783 1340
+3  4784 7601 4779
+3  4779 1351 4784
+3  1349 4785 7602
+3  7602 4787 1349
+3  1338 4786 7602
+3  7602 4785 1338
+3  1339 4782 7602
+3  7602 4786 1339
+3  4787 7602 4782
+3  4782 1350 4787
+3  1348 4788 7603
+3  7603 4790 1348
+3  1336 4789 7603
+3  7603 4788 1336
+3  1338 4785 7603
+3  7603 4789 1338
+3  4790 7603 4785
+3  4785 1349 4790
+3  1347 4791 7604
+3  7604 4793 1347
+3  1337 4792 7604
+3  7604 4791 1337
+3  1336 4788 7604
+3  7604 4792 1336
+3  4793 7604 4788
+3  4788 1348 4793
+3  1270 4794 7605
+3  7605 4796 1270
+3  1271 4795 7605
+3  7605 4794 1271
+3  1337 4791 7605
+3  7605 4795 1337
+3  4796 7605 4791
+3  4791 1347 4796
+3  1346 4797 7606
+3  7606 4800 1346
+3  1261 4798 7606
+3  7606 4797 1261
+3  1267 4799 7606
+3  7606 4798 1267
+3  4800 7606 4799
+3  4799 1269 4800
+3  1345 4801 7607
+3  7607 4803 1345
+3  1258 4802 7607
+3  7607 4801 1258
+3  4797 7607 4802
+3  4802 1261 4797
+3  4803 7607 4797
+3  4797 1346 4803
+3  1290 4804 7608
+3  7608 4806 1290
+3  1289 4805 7608
+3  7608 4804 1289
+3  1258 4801 7608
+3  7608 4805 1258
+3  4806 7608 4801
+3  4801 1345 4806
+3  1344 4807 7609
+3  7609 4810 1344
+3  1334 4808 7609
+3  7609 4807 1334
+3  1282 4809 7609
+3  7609 4808 1282
+3  4810 7609 4809
+3  4809 1281 4810
+3  1278 4811 7610
+3  7610 4813 1278
+3  1276 4812 7610
+3  7610 4811 1276
+3  1334 4807 7610
+3  7610 4812 1334
+3  4813 7610 4807
+3  4807 1344 4813
+3  4769 7611 4816
+3  4816 1343 4769
+3  1333 4814 7611
+3  7611 4769 1333
+3  1277 4815 7611
+3  7611 4814 1277
+3  4816 7611 4815
+3  4815 1279 4816
+3  1335 4817 7612
+3  7612 4819 1335
+3  2091 2885 7612
+3  7612 4817 2091
+3  1147 4818 7612
+3  7612 2885 1147
+3  4819 7612 4818
+3  4818 1319 4819
+3  225 2886 7613
+3  7613 4822 225
+3  1148 4820 7613
+3  7613 2886 1148
+3  1330 4821 7613
+3  7613 4820 1330
+3  4822 7613 4821
+3  4821 1327 4822
+3  4823 7614 4795
+3  4795 1271 4823
+3  4824 7614 4823
+3  4823 1299 4824
+3  1301 4825 7614
+3  7614 4824 1301
+3  1337 4795 7614
+3  7614 4825 1337
+3  4826 7615 4774
+3  4774 1342 4826
+3  1311 4827 7615
+3  7615 4826 1311
+3  221 2894 7615
+3  7615 4827 221
+3  220 4774 7615
+3  7615 2894 220
+3  1341 4828 7616
+3  7616 4777 1341
+3  1312 4829 7616
+3  7616 4828 1312
+3  4826 7616 4829
+3  4829 1311 4826
+3  1342 4777 7616
+3  7616 4826 1342
+3  1340 4830 7617
+3  7617 4780 1340
+3  1313 4831 7617
+3  7617 4830 1313
+3  1312 4828 7617
+3  7617 4831 1312
+3  4780 7617 4828
+3  4828 1341 4780
+3  1339 4832 7618
+3  7618 4783 1339
+3  1316 4833 7618
+3  7618 4832 1316
+3  1313 4830 7618
+3  7618 4833 1313
+3  4783 7618 4830
+3  4830 1340 4783
+3  1338 4834 7619
+3  7619 4786 1338
+3  1315 4835 7619
+3  7619 4834 1315
+3  1316 4832 7619
+3  7619 4835 1316
+3  4786 7619 4832
+3  4832 1339 4786
+3  1336 4836 7620
+3  7620 4789 1336
+3  1314 4837 7620
+3  7620 4836 1314
+3  1315 4834 7620
+3  7620 4837 1315
+3  4789 7620 4834
+3  4834 1338 4789
+3  4825 7621 4792
+3  4792 1337 4825
+3  1301 4838 7621
+3  7621 4825 1301
+3  1314 4836 7621
+3  7621 4838 1314
+3  4792 7621 4836
+3  4836 1336 4792
+3  1299 4823 4840
+3  1271 4839 4823
+3  1272 4840 4839
+3  4840 4823 4839
+3  4841 7622 4843
+3  4843 1263 4841
+3  1267 4798 7622
+3  7622 4841 1267
+3  1261 4842 7622
+3  7622 4798 1261
+3  4843 7622 4842
+3  4842 1265 4843
+3  4844 7623 4819
+3  4819 1319 4844
+3  4845 7623 4844
+3  4844 1318 4845
+3  1331 4846 7623
+3  7623 4845 1331
+3  1335 4819 7623
+3  7623 4846 1335
+3  4847 7624 4850
+3  4850 1317 4847
+3  4848 7624 4847
+3  4847 1264 4848
+3  1265 4849 7624
+3  7624 4848 1265
+3  1331 4850 7624
+3  7624 4849 1331
+3  1335 4851 7625
+3  7625 4817 1335
+3  1330 4820 7625
+3  7625 4851 1330
+3  2920 7625 4820
+3  4820 1148 2920
+3  4817 7625 2920
+3  2920 2091 4817
+3  4852 7626 4846
+3  4846 1331 4852
+3  4853 7626 4852
+3  4852 1328 4853
+3  4851 7626 4853
+3  4853 1330 4851
+3  4846 7626 4851
+3  4851 1335 4846
+3  4854 7627 4849
+3  4849 1265 4854
+3  4855 7627 4854
+3  4854 1329 4855
+3  4852 7627 4855
+3  4855 1328 4852
+3  4849 7627 4852
+3  4852 1331 4849
+3  4856 7628 4858
+3  4858 1260 4856
+3  1259 4857 7628
+3  7628 4856 1259
+3  1329 4854 7628
+3  7628 4857 1329
+3  4858 7628 4854
+3  4854 1265 4858
+3  1289 4859 7629
+3  7629 4805 1289
+3  1288 4860 7629
+3  7629 4859 1288
+3  4861 7629 4860
+3  4860 1259 4861
+3  4805 7629 4861
+3  4861 1258 4805
+3  1334 4862 7630
+3  7630 4808 1334
+3  1320 4863 7630
+3  7630 4862 1320
+3  1284 4864 7630
+3  7630 4863 1284
+3  4808 7630 4864
+3  4864 1282 4808
+3  1276 4865 7631
+3  7631 4812 1276
+3  1275 4866 7631
+3  7631 4865 1275
+3  1320 4862 7631
+3  7631 4866 1320
+3  4812 7631 4862
+3  4862 1334 4812
+3  1333 4867 7632
+3  7632 4814 1333
+3  1294 4868 7632
+3  7632 4867 1294
+3  1273 4869 7632
+3  7632 4868 1273
+3  4814 7632 4869
+3  4869 1277 4814
+3  1332 4870 7633
+3  7633 4768 1332
+3  1293 4871 7633
+3  7633 4870 1293
+3  1294 4867 7633
+3  7633 4871 1294
+3  4768 7633 4867
+3  4867 1333 4768
+3  2941 7634 4771
+3  4771 2094 2941
+3  4872 7634 2941
+3  2941 1167 4872
+3  1293 4870 7634
+3  7634 4872 1293
+3  4771 7634 4870
+3  4870 1332 4771
+3  2088 2943 7635
+3  7635 4874 2088
+3  221 4827 7635
+3  7635 2943 221
+3  4873 7635 4827
+3  4827 1311 4873
+3  1310 4874 7635
+3  7635 4873 1310
+3  1310 4873 4876
+3  1311 4875 4873
+3  1309 4876 4875
+3  4876 4873 4875
+3  1312 4877 4879
+3  1308 4878 4877
+3  1307 4879 4878
+3  4879 4877 4878
+3  1318 4880 4845
+3  1317 4850 4880
+3  1331 4845 4850
+3  4845 4880 4850
+3  4821 7636 4882
+3  4882 1327 4821
+3  1330 4853 7636
+3  7636 4821 1330
+3  1328 4881 7636
+3  7636 4853 1328
+3  4882 7636 4881
+3  4881 1325 4882
+3  1323 4883 4884
+3  1329 4857 4883
+3  1259 4884 4857
+3  4884 4883 4857
+3  4881 7637 4885
+3  4885 1325 4881
+3  1328 4855 7637
+3  7637 4881 1328
+3  1329 4883 7637
+3  7637 4855 1329
+3  4885 7637 4883
+3  4883 1323 4885
+3  1285 4886 4888
+3  1286 4887 4886
+3  1287 4888 4887
+3  4888 4886 4887
+3  1287 4887 7638
+3  7638 4891 1287
+3  1286 4889 7638
+3  7638 4887 1286
+3  1321 4890 7638
+3  7638 4889 1321
+3  4891 7638 4890
+3  4890 1324 4891
+3  4890 7639 4894
+3  4894 1324 4890
+3  1321 4892 7639
+3  7639 4890 1321
+3  1322 4893 7639
+3  7639 4892 1322
+3  4894 7639 4893
+3  4893 1326 4894
+3  4893 7640 4896
+3  4896 1326 4893
+3  1322 4895 7640
+3  7640 4893 1322
+3  2092 2967 7640
+3  7640 4895 2092
+3  4896 7640 2967
+3  2967 1166 4896
+3  1166 2969 7641
+3  7641 4896 1166
+3  4822 7641 2969
+3  2969 225 4822
+3  1327 4897 7641
+3  7641 4822 1327
+3  1326 4896 7641
+3  7641 4897 1326
+3  1326 4897 7642
+3  7642 4894 1326
+3  1327 4882 7642
+3  7642 4897 1327
+3  1325 4898 7642
+3  7642 4882 1325
+3  4894 7642 4898
+3  4898 1324 4894
+3  4898 7643 4891
+3  4891 1324 4898
+3  1325 4885 7643
+3  7643 4898 1325
+3  1323 4899 7643
+3  7643 4885 1323
+3  1287 4891 7643
+3  7643 4899 1287
+3  4899 7644 4900
+3  4900 1287 4899
+3  4884 7644 4899
+3  4899 1323 4884
+3  4860 7644 4884
+3  4884 1259 4860
+3  1288 4900 7644
+3  7644 4860 1288
+3  1284 4863 7645
+3  7645 4903 1284
+3  1320 4901 7645
+3  7645 4863 1320
+3  4902 7645 4901
+3  4901 1274 4902
+3  4903 7645 4902
+3  4902 1286 4903
+3  1274 4904 4906
+3  1291 4905 4904
+3  1296 4906 4905
+3  4906 4904 4905
+3  4905 7646 4909
+3  4909 1296 4905
+3  1291 4907 7646
+3  7646 4905 1291
+3  1292 4908 7646
+3  7646 4907 1292
+3  4909 7646 4908
+3  4908 1297 4909
+3  4908 7647 4911
+3  4911 1297 4908
+3  1292 4910 7647
+3  7647 4908 1292
+3  227 2984 7647
+3  7647 4910 227
+3  4911 7647 2984
+3  2984 226 4911
+3  2093 2986 7648
+3  7648 4913 2093
+3  2092 4895 7648
+3  7648 2986 2092
+3  1322 4912 7648
+3  7648 4895 1322
+3  4913 7648 4912
+3  4912 1298 4913
+3  4912 7649 4915
+3  4915 1298 4912
+3  4892 7649 4912
+3  4912 1322 4892
+3  4914 7649 4892
+3  4892 1321 4914
+3  4915 7649 4914
+3  4914 1295 4915
+3  4914 7650 4916
+3  4916 1295 4914
+3  1321 4889 7650
+3  7650 4914 1321
+3  1286 4902 7650
+3  7650 4889 1286
+3  4916 7650 4902
+3  4902 1274 4916
+3  1320 4866 4901
+3  1275 4917 4866
+3  1274 4901 4917
+3  4901 4866 4917
+3  1261 4918 4842
+3  1260 4858 4918
+3  1265 4842 4858
+3  4842 4918 4858
+3  1230 4919 7651
+3  7651 4609 1230
+3  1319 4818 7651
+3  7651 4919 1319
+3  2995 7651 4818
+3  4818 1147 2995
+3  4609 7651 2995
+3  2995 2090 4609
+3  4920 7652 4617
+3  4617 1220 4920
+3  4844 7652 4920
+3  4920 1318 4844
+3  1319 4919 7652
+3  7652 4844 1319
+3  4617 7652 4919
+3  4919 1230 4617
+3  1223 4921 7653
+3  7653 4653 1223
+3  1317 4880 7653
+3  7653 4921 1317
+3  4920 7653 4880
+3  4880 1318 4920
+3  1220 4653 7653
+3  7653 4920 1220
+3  1317 4921 7654
+3  7654 4847 1317
+3  1223 4624 7654
+3  7654 4921 1223
+3  4922 7654 4624
+3  4624 1197 4922
+3  1264 4847 7654
+3  7654 4922 1264
+3  1306 4923 4925
+3  1313 4924 4923
+3  1305 4925 4924
+3  4925 4923 4924
+3  4924 7655 4927
+3  4927 1305 4924
+3  4833 7655 4924
+3  4924 1313 4833
+3  4926 7655 4833
+3  4833 1316 4926
+3  4927 7655 4926
+3  4926 1304 4927
+3  1304 4926 7656
+3  7656 4929 1304
+3  1316 4835 7656
+3  7656 4926 1316
+3  1315 4928 7656
+3  7656 4835 1315
+3  4929 7656 4928
+3  4928 1303 4929
+3  4928 7657 4931
+3  4931 1303 4928
+3  4837 7657 4928
+3  4928 1315 4837
+3  4930 7657 4837
+3  4837 1314 4930
+3  4931 7657 4930
+3  4930 1302 4931
+3  1302 4930 7658
+3  7658 4933 1302
+3  1314 4838 7658
+3  7658 4930 1314
+3  4932 7658 4838
+3  4838 1301 4932
+3  1300 4933 7658
+3  7658 4932 1300
+3  1300 4934 4935
+3  1299 4840 4934
+3  1272 4935 4840
+3  4935 4934 4840
+3  4831 7659 4877
+3  4877 1312 4831
+3  4923 7659 4831
+3  4831 1313 4923
+3  4936 7659 4923
+3  4923 1306 4936
+3  1308 4877 7659
+3  7659 4936 1308
+3  4829 7660 4875
+3  4875 1311 4829
+3  4879 7660 4829
+3  4829 1312 4879
+3  4937 7660 4879
+3  4879 1307 4937
+3  1309 4875 7660
+3  7660 4937 1309
+3  1197 4938 4922
+3  1272 4939 4938
+3  1264 4922 4939
+3  4922 4938 4939
+3  1264 4939 4941
+3  1272 4940 4939
+3  1262 4941 4940
+3  4941 4939 4940
+3  1196 4942 4694
+3  1272 4938 4942
+3  1197 4694 4938
+3  4694 4942 4938
+3  1309 4937 4944
+3  1307 4943 4937
+3  1191 4944 4943
+3  4944 4937 4943
+3  1308 4936 4946
+3  1306 4945 4936
+3  1189 4946 4945
+3  4946 4936 4945
+3  1195 4701 7661
+3  7661 4947 1195
+3  1144 3024 7661
+3  7661 4701 1144
+3  2088 4874 7661
+3  7661 3024 2088
+3  4947 7661 4874
+3  4874 1310 4947
+3  4703 7662 4944
+3  4944 1191 4703
+3  4947 7662 4703
+3  4703 1195 4947
+3  1310 4876 7662
+3  7662 4947 1310
+3  1309 4944 7662
+3  7662 4876 1309
+3  4878 7663 4943
+3  4943 1307 4878
+3  1308 4946 7663
+3  7663 4878 1308
+3  1189 4704 7663
+3  7663 4946 1189
+3  4943 7663 4704
+3  4704 1191 4943
+3  1187 4705 7664
+3  7664 4948 1187
+3  4945 7664 4705
+3  4705 1189 4945
+3  1306 4925 7664
+3  7664 4945 1306
+3  4948 7664 4925
+3  4925 1305 4948
+3  1185 4707 7665
+3  7665 4949 1185
+3  1187 4948 7665
+3  7665 4707 1187
+3  4927 7665 4948
+3  4948 1305 4927
+3  1304 4949 7665
+3  7665 4927 1304
+3  1183 4709 7666
+3  7666 4950 1183
+3  4949 7666 4709
+3  4709 1185 4949
+3  4929 7666 4949
+3  4949 1304 4929
+3  1303 4950 7666
+3  7666 4929 1303
+3  1181 4711 7667
+3  7667 4951 1181
+3  4950 7667 4711
+3  4711 1183 4950
+3  1303 4931 7667
+3  7667 4950 1303
+3  1302 4951 7667
+3  7667 4931 1302
+3  1178 4713 7668
+3  7668 4952 1178
+3  1181 4951 7668
+3  7668 4713 1181
+3  1302 4933 7668
+3  7668 4951 1302
+3  4952 7668 4933
+3  4933 1300 4952
+3  1178 4952 4700
+3  1300 4953 4952
+3  1196 4700 4953
+3  4700 4952 4953
+3  1300 4935 4953
+3  1272 4942 4935
+3  1196 4953 4942
+3  4953 4935 4942
+3  1301 4824 4932
+3  1299 4934 4824
+3  1300 4932 4934
+3  4932 4824 4934
+3  226 3031 7669
+3  7669 4911 226
+3  4913 7669 3031
+3  3031 2093 4913
+3  1298 4954 7669
+3  7669 4913 1298
+3  1297 4911 7669
+3  7669 4954 1297
+3  1297 4954 7670
+3  7670 4909 1297
+3  1298 4915 7670
+3  7670 4954 1298
+3  4955 7670 4915
+3  4915 1295 4955
+3  1296 4909 7670
+3  7670 4955 1296
+3  1296 4955 4906
+3  1295 4916 4955
+3  1274 4906 4916
+3  4906 4955 4916
+3  1273 4868 4957
+3  1294 4956 4868
+3  1291 4957 4956
+3  4957 4868 4956
+3  4956 7671 4907
+3  4907 1291 4956
+3  1294 4871 7671
+3  7671 4956 1294
+3  1293 4958 7671
+3  7671 4871 1293
+3  4907 7671 4958
+3  4958 1292 4907
+3  4872 7672 4958
+3  4958 1293 4872
+3  1167 3037 7672
+3  7672 4872 1167
+3  227 4910 7672
+3  7672 3037 227
+3  1292 4958 7672
+3  7672 4910 1292
+3  1291 4904 4957
+3  1274 4959 4904
+3  1273 4957 4959
+3  4957 4904 4959
+3  1289 4804 7673
+3  7673 4962 1289
+3  1290 4960 7673
+3  7673 4804 1290
+3  1280 4961 7673
+3  7673 4960 1280
+3  4962 7673 4961
+3  4961 1283 4962
+3  4859 7674 4964
+3  4964 1288 4859
+3  4962 7674 4859
+3  4859 1289 4962
+3  1283 4963 7674
+3  7674 4962 1283
+3  1285 4964 7674
+3  7674 4963 1285
+3  1288 4964 4900
+3  1285 4888 4964
+3  1287 4900 4888
+3  4900 4964 4888
+3  1286 4886 4903
+3  1285 4965 4886
+3  1284 4903 4965
+3  4903 4886 4965
+3  1282 4864 7675
+3  7675 4966 1282
+3  4965 7675 4864
+3  4864 1284 4965
+3  1285 4963 7675
+3  7675 4965 1285
+3  1283 4966 7675
+3  7675 4963 1283
+3  4809 7676 4967
+3  4967 1281 4809
+3  1282 4966 7676
+3  7676 4809 1282
+3  1283 4961 7676
+3  7676 4966 1283
+3  4967 7676 4961
+3  4961 1280 4967
+3  1276 4811 7677
+3  7677 4969 1276
+3  1278 4968 7677
+3  7677 4811 1278
+3  4815 7677 4968
+3  4968 1279 4815
+3  1277 4969 7677
+3  7677 4815 1277
+3  1275 4865 7678
+3  7678 4970 1275
+3  4969 7678 4865
+3  4865 1276 4969
+3  4869 7678 4969
+3  4969 1277 4869
+3  1273 4970 7678
+3  7678 4869 1273
+3  1275 4970 4917
+3  1273 4959 4970
+3  1274 4917 4959
+3  4917 4970 4959
+3  1266 4971 7679
+3  7679 4972 1266
+3  1262 4940 7679
+3  7679 4971 1262
+3  4839 7679 4940
+3  4940 1272 4839
+3  1271 4972 7679
+3  7679 4839 1271
+3  1268 4973 7680
+3  7680 4974 1268
+3  1266 4972 7680
+3  7680 4973 1266
+3  4794 7680 4972
+3  4972 1271 4794
+3  4974 7680 4794
+3  4794 1270 4974
+3  1266 4973 7681
+3  7681 4976 1266
+3  1268 4975 7681
+3  7681 4973 1268
+3  4799 7681 4975
+3  4975 1269 4799
+3  1267 4976 7681
+3  7681 4799 1267
+3  1262 4971 7682
+3  7682 4977 1262
+3  4976 7682 4971
+3  4971 1266 4976
+3  4841 7682 4976
+3  4976 1267 4841
+3  1263 4977 7682
+3  7682 4841 1263
+3  1263 4843 4978
+3  1265 4848 4843
+3  1264 4978 4848
+3  4978 4843 4848
+3  1264 4941 4978
+3  1262 4977 4941
+3  1263 4978 4977
+3  4978 4941 4977
+3  1261 4802 4918
+3  1258 4979 4802
+3  1260 4918 4979
+3  4918 4802 4979
+3  1260 4979 4856
+3  1258 4861 4979
+3  1259 4856 4861
+3  4856 4979 4861
+3  1602 4980 4981
+3  1156 3059 4980
+3  2100 4981 3059
+3  4981 4980 3059
+3  4982 7683 4985
+3  4985 1409 4982
+3  4983 7683 4982
+3  4982 1763 4983
+3  4984 7683 4983
+3  4983 1920 4984
+3  4985 7683 4984
+3  4984 1408 4985
+3  1415 4986 7684
+3  7684 4989 1415
+3  1664 4987 7684
+3  7684 4986 1664
+3  1968 4988 7684
+3  7684 4987 1968
+3  4989 7684 4988
+3  4988 1414 4989
+3  4990 7685 4993
+3  4993 1412 4990
+3  4991 7685 4990
+3  4990 1967 4991
+3  4992 7685 4991
+3  4991 1658 4992
+3  1411 4993 7685
+3  7685 4992 1411
+3  4994 7686 4997
+3  4997 2019 4994
+3  4995 7686 4994
+3  4994 2013 4995
+3  4996 7686 4995
+3  4995 1510 4996
+3  4997 7686 4996
+3  4996 1508 4997
+3  1509 4998 7687
+3  7687 5001 1509
+3  1565 4999 7687
+3  7687 4998 1565
+3  1388 5000 7687
+3  7687 4999 1388
+3  5001 7687 5000
+3  5000 1387 5001
+3  2012 5002 7688
+3  7688 5005 2012
+3  2023 5003 7688
+3  7688 5002 2023
+3  1514 5004 7688
+3  7688 5003 1514
+3  5005 7688 5004
+3  5004 1511 5005
+3  2028 5006 5008
+3  2058 5007 5006
+3  1513 5008 5007
+3  5008 5006 5007
+3  2026 5009 7689
+3  7689 5012 2026
+3  1557 5010 7689
+3  7689 5009 1557
+3  1518 5011 7689
+3  7689 5010 1518
+3  5012 7689 5011
+3  5011 1515 5012
+3  1517 5013 7690
+3  7690 5016 1517
+3  1554 5014 7690
+3  7690 5013 1554
+3  2029 5015 7690
+3  7690 5014 2029
+3  5016 7690 5015
+3  5015 1516 5016
+3  1556 5017 7691
+3  7691 5020 1556
+3  1932 5018 7691
+3  7691 5017 1932
+3  1522 5019 7691
+3  7691 5018 1522
+3  5020 7691 5019
+3  5019 1519 5020
+3  1521 5021 7692
+3  7692 5024 1521
+3  1937 5022 7692
+3  7692 5021 1937
+3  1555 5023 7692
+3  7692 5022 1555
+3  5024 7692 5023
+3  5023 1520 5024
+3  1935 5025 7693
+3  7693 5028 1935
+3  1876 5026 7693
+3  7693 5025 1876
+3  1526 5027 7693
+3  7693 5026 1526
+3  5028 7693 5027
+3  5027 1523 5028
+3  1525 5029 7694
+3  7694 5032 1525
+3  1873 5030 7694
+3  7694 5029 1873
+3  1938 5031 7694
+3  7694 5030 1938
+3  5032 7694 5031
+3  5031 1524 5032
+3  1879 5033 7695
+3  7695 5036 1879
+3  2041 5034 7695
+3  7695 5033 2041
+3  1530 5035 7695
+3  7695 5034 1530
+3  5036 7695 5035
+3  5035 1527 5036
+3  1529 5037 7696
+3  7696 5040 1529
+3  2043 5038 7696
+3  7696 5037 2043
+3  1874 5039 7696
+3  7696 5038 1874
+3  5040 7696 5039
+3  5039 1528 5040
+3  1999 5041 5043
+3  1949 5042 5041
+3  1532 5043 5042
+3  5043 5041 5042
+3  5044 7697 5047
+3  5047 1948 5044
+3  1358 5045 7697
+3  7697 5044 1358
+3  1357 5046 7697
+3  7697 5045 1357
+3  5047 7697 5046
+3  5046 1533 5047
+3  1711 5048 7698
+3  7698 5051 1711
+3  1922 5049 7698
+3  7698 5048 1922
+3  1970 5050 7698
+3  7698 5049 1970
+3  5051 7698 5050
+3  5050 1708 5051
+3  1921 5052 7699
+3  7699 5055 1921
+3  1762 5053 7699
+3  7699 5052 1762
+3  1542 5054 7699
+3  7699 5053 1542
+3  5055 7699 5054
+3  5054 1539 5055
+3  1541 5056 7700
+3  7700 5059 1541
+3  1982 5057 7700
+3  7700 5056 1982
+3  1923 5058 7700
+3  7700 5057 1923
+3  5059 7700 5058
+3  5058 1540 5059
+3  1657 5060 5062
+3  1543 5061 5060
+3  1761 5062 5061
+3  5062 5060 5061
+3  1545 5063 7701
+3  7701 5066 1545
+3  2061 5064 7701
+3  7701 5063 2061
+3  1889 5065 7701
+3  7701 5064 1889
+3  5066 7701 5065
+3  5065 2059 5066
+3  2030 5067 7702
+3  7702 5070 2030
+3  1553 5068 7702
+3  7702 5067 1553
+3  1942 5069 7702
+3  7702 5068 1942
+3  5070 7702 5069
+3  5069 1546 5070
+3  1941 5071 7703
+3  7703 5074 1941
+3  1946 5072 7703
+3  7703 5071 1946
+3  1550 5073 7703
+3  7703 5072 1550
+3  5074 7703 5073
+3  5073 1547 5074
+3  1548 5075 7704
+3  7704 5079 1548
+3  1549 5076 7704
+3  7704 5075 1549
+3  5077 7704 5076
+3  5076 1843 5077
+3  5078 7704 5077
+3  5077 2055 5078
+3  5079 7704 5078
+3  5078 2062 5079
+3  2025 5080 7705
+3  7705 5083 2025
+3  1901 5081 7705
+3  7705 5080 1901
+3  1561 5082 7705
+3  7705 5081 1561
+3  5083 7705 5082
+3  5082 1558 5083
+3  1560 5084 7706
+3  7706 5087 1560
+3  2021 5085 7706
+3  7706 5084 2021
+3  1933 5086 7706
+3  7706 5085 1933
+3  5087 7706 5086
+3  5086 1559 5087
+3  1390 5088 7707
+3  7707 5091 1390
+3  2010 5089 7707
+3  7707 5088 2010
+3  1916 5090 7707
+3  7707 5089 1916
+3  5091 7707 5090
+3  5090 1393 5091
+3  1663 5092 5094
+3  1659 5093 5092
+3  1966 5094 5093
+3  5094 5092 5093
+3  1969 5095 5097
+3  1666 5096 5095
+3  1660 5097 5096
+3  5097 5095 5096
+3  1661 5098 7708
+3  7708 5102 1661
+3  1665 5099 7708
+3  7708 5098 1665
+3  5100 7708 5099
+3  5099 1965 5100
+3  5101 7708 5100
+3  5100 1386 5101
+3  5102 7708 5101
+3  5101 1385 5102
+3  1971 5103 7709
+3  7709 5107 1971
+3  1537 5104 7709
+3  7709 5103 1537
+3  5105 7709 5104
+3  5104 1926 5105
+3  5106 7709 5105
+3  5105 1674 5106
+3  5107 7709 5106
+3  5106 1986 5107
+3  1985 5108 7710
+3  7710 5112 1985
+3  1668 5109 7710
+3  7710 5108 1668
+3  5110 7710 5109
+3  5109 1705 5110
+3  5111 7710 5110
+3  5110 1709 5111
+3  5112 7710 5111
+3  5111 1972 5112
+3  1673 5113 5115
+3  1669 5114 5113
+3  1988 5115 5114
+3  5115 5113 5114
+3  1987 5116 5118
+3  1676 5117 5116
+3  1670 5118 5117
+3  5118 5116 5117
+3  5119 7711 2625
+3  2625 2066 5119
+3  5120 7711 5119
+3  5119 1671 5120
+3  5121 7711 5120
+3  5120 1675 5121
+3  5122 7711 5121
+3  5121 1925 5122
+3  2622 7711 5122
+3  5122 1928 2622
+3  1930 2625 7711
+3  7711 2622 1930
+3  1683 5123 7712
+3  7712 5126 1683
+3  1667 5124 7712
+3  7712 5123 1667
+3  5125 7712 5124
+3  5124 1672 5125
+3  2562 7712 5125
+3  5125 2065 2562
+3  5126 7712 2562
+3  2562 1682 5126
+3  1681 2632 7713
+3  7713 5130 1681
+3  5127 7713 2632
+3  2632 2068 5127
+3  5128 7713 5127
+3  5127 2078 5128
+3  5129 7713 5128
+3  5128 2075 5129
+3  5130 7713 5129
+3  5129 1684 5130
+3  2074 5131 7714
+3  7714 5134 2074
+3  1745 5132 7714
+3  7714 5131 1745
+3  1975 5133 7714
+3  7714 5132 1975
+3  5134 7714 5133
+3  5133 1685 5134
+3  1679 5135 7715
+3  7715 2565 1679
+3  1891 5136 7715
+3  7715 5135 1891
+3  1897 5137 7715
+3  7715 5136 1897
+3  2565 7715 5137
+3  5137 2071 2565
+3  2072 5138 7716
+3  7716 2569 2072
+3  1896 5139 7716
+3  7716 5138 1896
+3  1690 5140 7716
+3  7716 5139 1690
+3  2569 7716 5140
+3  5140 1687 2569
+3  1719 5141 7717
+3  7717 5144 1719
+3  1677 2573 7717
+3  7717 5141 1677
+3  5142 7717 2573
+3  2573 1688 5142
+3  5143 7717 5142
+3  5142 1689 5143
+3  5144 7717 5143
+3  5143 1714 5144
+3  1551 5145 7718
+3  7718 5149 1551
+3  1945 5146 7718
+3  7718 5145 1945
+3  5147 7718 5146
+3  5146 1848 5147
+3  5148 7718 5147
+3  5147 1881 5148
+3  5149 7718 5148
+3  5148 1844 5149
+3  1895 5150 7719
+3  7719 5153 1895
+3  2053 5151 7719
+3  7719 5150 2053
+3  1693 5152 7719
+3  7719 5151 1693
+3  5153 7719 5152
+3  5152 1691 5153
+3  1728 5154 5156
+3  1732 5155 5154
+3  1715 5156 5155
+3  5156 5154 5155
+3  1696 5157 7720
+3  7720 5160 1696
+3  1917 5158 7720
+3  7720 5157 1917
+3  2009 5159 7720
+3  7720 5158 2009
+3  5160 7720 5159
+3  5159 2057 5160
+3  1888 5161 7721
+3  7721 5164 1888
+3  1893 5162 7721
+3  7721 5161 1893
+3  1700 5163 7721
+3  7721 5162 1700
+3  5164 7721 5163
+3  5163 1698 5164
+3  1702 5165 7722
+3  7722 5168 1702
+3  2084 5166 7722
+3  7722 5165 2084
+3  1918 5167 7722
+3  7722 5166 1918
+3  5168 7722 5167
+3  5167 1699 5168
+3  5169 7723 2580
+3  2580 1704 5169
+3  5170 7723 5169
+3  5169 1701 5170
+3  5171 7723 5170
+3  5170 1892 5171
+3  2580 7723 5171
+3  5171 1680 2580
+3  1744 5172 5174
+3  1748 5173 5172
+3  1370 5174 5173
+3  5174 5172 5173
+3  1710 5175 5177
+3  1707 5176 5175
+3  1712 5177 5176
+3  5177 5175 5176
+3  1720 5178 5180
+3  1716 5179 5178
+3  1727 5180 5179
+3  5180 5178 5179
+3  1678 5181 7724
+3  7724 2637 1678
+3  1718 5182 7724
+3  7724 5181 1718
+3  5183 7724 5182
+3  5182 1722 5183
+3  5184 7724 5183
+3  5183 1995 5184
+3  2637 7724 5184
+3  5184 2070 2637
+3  1726 5185 5187
+3  1723 5186 5185
+3  1717 5187 5186
+3  5187 5185 5186
+3  1721 5188 7725
+3  7725 5191 1721
+3  1736 5189 7725
+3  7725 5188 1736
+3  5190 7725 5189
+3  5189 1737 5190
+3  1993 5191 7725
+3  7725 5190 1993
+3  1729 5192 7726
+3  7726 5195 1729
+3  1842 5193 7726
+3  7726 5192 1842
+3  1880 5194 7726
+3  7726 5193 1880
+3  5195 7726 5194
+3  5194 1978 5195
+3  1733 5196 5198
+3  1730 5197 5196
+3  1977 5198 5197
+3  5198 5196 5197
+3  1738 5199 7727
+3  7727 5202 1738
+3  1997 5200 7727
+3  7727 5199 1997
+3  1807 5201 7727
+3  7727 5200 1807
+3  5202 7727 5201
+3  5201 1747 5202
+3  1535 5203 5205
+3  1996 5204 5203
+3  1534 5205 5204
+3  5205 5203 5204
+3  1743 5206 5208
+3  1739 5207 5206
+3  1750 5208 5207
+3  5208 5206 5207
+3  1749 5209 5211
+3  1746 5210 5209
+3  1740 5211 5210
+3  5211 5209 5210
+3  5212 7728 5215
+3  5215 1380 5212
+3  5213 7728 5212
+3  5212 1379 5213
+3  5214 7728 5213
+3  5213 1755 5214
+3  5215 7728 5214
+3  5214 1752 5215
+3  1754 5216 7729
+3  7729 5219 1754
+3  1955 5217 7729
+3  7729 5216 1955
+3  5218 7729 5217
+3  5217 1757 5218
+3  1753 5219 7729
+3  7729 5218 1753
+3  1953 5220 5222
+3  1756 5221 5220
+3  1382 5222 5221
+3  5222 5220 5221
+3  1371 5223 5225
+3  1766 5224 5223
+3  1372 5225 5224
+3  5225 5223 5224
+3  1764 5226 5228
+3  1765 5227 5226
+3  1403 5228 5227
+3  5228 5226 5227
+3  1768 5229 7730
+3  7730 5232 1768
+3  1772 5230 7730
+3  7730 5229 1772
+3  1963 5231 7730
+3  7730 5230 1963
+3  5232 7730 5231
+3  5231 1404 5232
+3  1957 5233 7731
+3  7731 5236 1957
+3  1959 5234 7731
+3  7731 5233 1959
+3  1769 5235 7731
+3  7731 5234 1769
+3  5236 7731 5235
+3  5235 1767 5236
+3  1954 5237 7732
+3  7732 5240 1954
+3  1960 5238 7732
+3  7732 5237 1960
+3  5239 7732 5238
+3  5238 1956 5239
+3  1758 5240 7732
+3  7732 5239 1758
+3  1958 5241 7733
+3  7733 5244 1958
+3  1979 5242 7733
+3  7733 5241 1979
+3  5243 7733 5242
+3  5242 1773 5243
+3  5244 7733 5243
+3  5243 1770 5244
+3  1384 5245 7734
+3  7734 5248 1384
+3  1383 5246 7734
+3  7734 5245 1383
+3  1964 5247 7734
+3  7734 5246 1964
+3  5248 7734 5247
+3  5247 1771 5248
+3  1915 5249 5251
+3  1826 5250 5249
+3  1943 5251 5250
+3  5251 5249 5250
+3  1809 5252 7735
+3  7735 5256 1809
+3  1882 5253 7735
+3  7735 5252 1882
+3  5254 7735 5253
+3  5253 1851 5254
+3  5255 7735 5254
+3  5254 2034 5255
+3  5256 7735 5255
+3  5255 1820 5256
+3  2049 5257 5259
+3  1817 5258 5257
+3  1812 5259 5258
+3  5259 5257 5258
+3  1813 5260 7736
+3  7736 5263 1813
+3  1818 5261 7736
+3  7736 5260 1818
+3  2052 5262 7736
+3  7736 5261 2052
+3  5263 7736 5262
+3  5262 2037 5263
+3  5264 7737 5267
+3  5267 1815 5264
+3  1819 5265 7737
+3  7737 5264 1819
+3  2033 5266 7737
+3  7737 5265 2033
+3  5267 7737 5266
+3  5266 1905 5267
+3  5268 7738 5271
+3  5271 1950 5268
+3  1838 5269 7738
+3  7738 5268 1838
+3  1886 5270 7738
+3  7738 5269 1886
+3  1822 5271 7738
+3  7738 5270 1822
+3  1562 5272 7739
+3  7739 5276 1562
+3  1900 5273 7739
+3  7739 5272 1900
+3  5274 7739 5273
+3  5273 1823 5274
+3  5275 7739 5274
+3  5274 1884 5275
+3  5276 7739 5275
+3  5275 1857 5276
+3  1902 5277 7740
+3  7740 5280 1902
+3  2011 5278 7740
+3  7740 5277 2011
+3  2005 5279 7740
+3  7740 5278 2005
+3  5280 7740 5279
+3  5279 1824 5280
+3  1912 5281 7741
+3  7741 5284 1912
+3  1947 5282 7741
+3  7741 5281 1947
+3  1940 5283 7741
+3  7741 5282 1940
+3  5284 7741 5283
+3  5283 1806 5284
+3  1804 5285 7742
+3  7742 5288 1804
+3  1828 5286 7742
+3  7742 5285 1828
+3  1833 5287 7742
+3  7742 5286 1833
+3  5288 7742 5287
+3  5287 1861 5288
+3  1914 5289 7743
+3  7743 5292 1914
+3  1865 5290 7743
+3  7743 5289 1865
+3  1830 5291 7743
+3  7743 5290 1830
+3  5292 7743 5291
+3  5291 1827 5292
+3  2047 5293 7744
+3  7744 5296 2047
+3  2045 5294 7744
+3  7744 5293 2045
+3  2050 5295 7744
+3  7744 5294 2050
+3  5296 7744 5295
+3  5295 1903 5296
+3  1864 5297 7745
+3  7745 5300 1864
+3  2048 5298 7745
+3  7745 5297 2048
+3  1834 5299 7745
+3  7745 5298 1834
+3  5300 7745 5299
+3  5299 1831 5300
+3  1837 5301 7746
+3  7746 5304 1837
+3  1907 5302 7746
+3  7746 5301 1907
+3  1862 5303 7746
+3  7746 5302 1862
+3  5304 7746 5303
+3  5303 1832 5304
+3  2032 5305 5307
+3  1845 5306 5305
+3  1906 5307 5306
+3  5307 5305 5306
+3  5308 7747 5311
+3  5311 1814 5308
+3  1870 5309 7747
+3  7747 5308 1870
+3  1859 5310 7747
+3  7747 5309 1859
+3  1898 5311 7747
+3  7747 5310 1898
+3  1856 5312 7748
+3  7748 5315 1856
+3  1869 5313 7748
+3  7748 5312 1869
+3  2022 5314 7748
+3  7748 5313 2022
+3  5315 7748 5314
+3  5314 1563 5315
+3  5316 7749 5319
+3  5319 1899 5316
+3  5317 7749 5316
+3  5316 1858 5317
+3  5318 7749 5317
+3  5317 1883 5318
+3  5319 7749 5318
+3  5318 1839 5319
+3  2003 5320 7750
+3  7750 5324 2003
+3  5321 7750 5320
+3  5320 1821 5321
+3  5322 7750 5321
+3  5321 1885 5322
+3  5323 7750 5322
+3  5322 1825 5323
+3  5324 7750 5323
+3  5323 2004 5324
+3  1860 5325 7751
+3  7751 5328 1860
+3  1853 5326 7751
+3  7751 5325 1853
+3  1910 5327 7751
+3  7751 5326 1910
+3  5328 7751 5327
+3  5327 1805 5328
+3  1854 5329 7752
+3  7752 5332 1854
+3  1863 5330 7752
+3  7752 5329 1863
+3  1909 5331 7752
+3  7752 5330 1909
+3  5332 7752 5331
+3  5331 1847 5332
+3  2031 5333 7753
+3  7753 5336 2031
+3  1850 5334 7753
+3  7753 5333 1850
+3  1855 5335 7753
+3  7753 5334 1855
+3  5336 7753 5335
+3  5335 1846 5336
+3  1944 5337 7754
+3  7754 5340 1944
+3  1911 5338 7754
+3  7754 5337 1911
+3  1852 5339 7754
+3  7754 5338 1852
+3  5340 7754 5339
+3  5339 1849 5340
+3  1913 5341 7755
+3  7755 5344 1913
+3  1939 5342 7755
+3  7755 5341 1939
+3  1872 5343 7755
+3  7755 5342 1872
+3  5344 7755 5343
+3  5343 1866 5344
+3  1875 5345 7756
+3  7756 5348 1875
+3  2042 5346 7756
+3  7756 5345 2042
+3  2046 5347 7756
+3  7756 5346 2046
+3  5348 7756 5347
+3  5347 1867 5348
+3  2040 5349 7757
+3  7757 5352 2040
+3  2038 5350 7757
+3  7757 5349 2038
+3  2051 5351 7757
+3  7757 5350 2051
+3  5352 7757 5351
+3  5351 1531 5352
+3  1868 5353 7758
+3  7758 5356 1868
+3  1877 5354 7758
+3  7758 5353 1877
+3  1934 5355 7758
+3  7758 5354 1934
+3  5356 7758 5355
+3  5355 2020 5356
+3  2035 5357 7759
+3  7759 5360 2035
+3  2039 5358 7759
+3  7759 5357 2039
+3  1878 5359 7759
+3  7759 5358 1878
+3  5360 7759 5359
+3  5359 1871 5360
+3  1887 5361 7760
+3  7760 5364 1887
+3  2060 5362 7760
+3  7760 5361 2060
+3  2054 5363 7760
+3  7760 5362 2054
+3  5364 7760 5363
+3  5363 1894 5364
+3  2083 5365 7761
+3  7761 5368 2083
+3  1395 5366 7761
+3  7761 5365 1395
+3  1394 5367 7761
+3  7761 5366 1394
+3  5368 7761 5367
+3  5367 1919 5368
+3  1984 5369 5370
+3  217 3433 5369
+3  1139 5370 3433
+3  5370 5369 3433
+3  1981 5371 7762
+3  7762 5374 1981
+3  2064 5372 7762
+3  7762 5371 2064
+3  1929 5373 7762
+3  7762 5372 1929
+3  5374 7762 5373
+3  5373 1924 5374
+3  5375 7763 5378
+3  5378 2002 5375
+3  5376 7763 5375
+3  5375 2007 5376
+3  5377 7763 5376
+3  5376 2016 5377
+3  5378 7763 5377
+3  5377 1952 5378
+3  2077 5379 5381
+3  1991 5380 5379
+3  2073 5381 5380
+3  5381 5379 5380
+3  2080 5382 5384
+3  1992 5383 5382
+3  2076 5384 5383
+3  5384 5382 5383
+3  1994 5385 7764
+3  7764 5388 1994
+3  2081 5386 7764
+3  7764 5385 2081
+3  5387 7764 5386
+3  5386 2079 5387
+3  2635 7764 5387
+3  5387 2067 2635
+3  5388 7764 2635
+3  2635 2069 5388
+3  2014 5389 7765
+3  7765 5392 2014
+3  1392 5390 7765
+3  7765 5389 1392
+3  1391 5391 7765
+3  7765 5390 1391
+3  5392 7765 5391
+3  5391 2017 5392
+3  1407 5393 5394
+3  1409 4985 5393
+3  1408 5394 4985
+3  5394 5393 4985
+3  1401 5395 5397
+3  1415 5396 5395
+3  1402 5397 5396
+3  5397 5395 5396
+3  1410 5398 5399
+3  1412 4993 5398
+3  1411 5399 4993
+3  5399 5398 4993
+3  1413 5400 5401
+3  1415 4989 5400
+3  1414 5401 4989
+3  5401 5400 4989
+3  5402 7766 5001
+3  5001 1387 5402
+3  4996 7766 5402
+3  5402 1508 4996
+3  1510 5403 7766
+3  7766 4996 1510
+3  1509 5001 7766
+3  7766 5403 1509
+3  1512 5404 7767
+3  7767 5406 1512
+3  1511 5004 7767
+3  7767 5404 1511
+3  1514 5405 7767
+3  7767 5004 1514
+3  5406 7767 5405
+3  5405 1513 5406
+3  5407 7768 5016
+3  5016 1516 5407
+3  5011 7768 5407
+3  5407 1515 5011
+3  1518 5408 7768
+3  7768 5011 1518
+3  1517 5016 7768
+3  7768 5408 1517
+3  5409 7769 5024
+3  5024 1520 5409
+3  5019 7769 5409
+3  5409 1519 5019
+3  1522 5410 7769
+3  7769 5019 1522
+3  1521 5024 7769
+3  7769 5410 1521
+3  5411 7770 5032
+3  5032 1524 5411
+3  5027 7770 5411
+3  5411 1523 5027
+3  1526 5412 7770
+3  7770 5027 1526
+3  1525 5032 7770
+3  7770 5412 1525
+3  5413 7771 5040
+3  5040 1528 5413
+3  5035 7771 5413
+3  5413 1527 5035
+3  1530 5414 7771
+3  7771 5035 1530
+3  1529 5040 7771
+3  7771 5414 1529
+3  1533 5415 7772
+3  7772 5047 1533
+3  1532 5042 7772
+3  7772 5415 1532
+3  5416 7772 5042
+3  5042 1949 5416
+3  5047 7772 5416
+3  5416 1948 5047
+3  1405 5417 5419
+3  1536 5418 5417
+3  1406 5419 5418
+3  5419 5417 5418
+3  1405 5420 7773
+3  7773 5422 1405
+3  1408 4984 7773
+3  7773 5420 1408
+3  5421 7773 4984
+3  4984 1920 5421
+3  5422 7773 5421
+3  5421 1922 5422
+3  5423 7774 5055
+3  5055 1539 5423
+3  5424 7774 5423
+3  5423 1538 5424
+3  5425 7774 5424
+3  5424 1922 5425
+3  1921 5055 7774
+3  7774 5425 1921
+3  1409 5426 7775
+3  7775 4982 1409
+3  1411 5427 7775
+3  7775 5426 1411
+3  5428 7775 5427
+3  5427 1760 5428
+3  4982 7775 5428
+3  5428 1763 4982
+3  1763 5429 7776
+3  7776 4983 1763
+3  1762 5052 7776
+3  7776 5429 1762
+3  5430 7776 5052
+3  5052 1921 5430
+3  1920 4983 7776
+3  7776 5430 1920
+3  5431 7777 5059
+3  5059 1540 5431
+3  5054 7777 5431
+3  5431 1539 5054
+3  1542 5432 7777
+3  7777 5054 1542
+3  1541 5059 7777
+3  7777 5432 1541
+3  5433 7778 5061
+3  5061 1543 5433
+3  1542 5053 7778
+3  7778 5433 1542
+3  1762 5434 7778
+3  7778 5053 1762
+3  1761 5061 7778
+3  7778 5434 1761
+3  1513 5435 7779
+3  7779 5008 1513
+3  1516 5015 7779
+3  7779 5435 1516
+3  2029 5436 7779
+3  7779 5015 2029
+3  5008 7779 5436
+3  5436 2028 5008
+3  5437 7780 5070
+3  5070 1546 5437
+3  5438 7780 5437
+3  5437 1545 5438
+3  2027 5439 7780
+3  7780 5438 2027
+3  2030 5070 7780
+3  7780 5439 2030
+3  1548 5440 7781
+3  7781 5075 1548
+3  1547 5073 7781
+3  7781 5440 1547
+3  5441 7781 5073
+3  5073 1550 5441
+3  1549 5075 7781
+3  7781 5441 1549
+3  1517 5442 7782
+3  7782 5013 1517
+3  1520 5023 7782
+3  7782 5442 1520
+3  1555 5443 7782
+3  7782 5023 1555
+3  5013 7782 5443
+3  5443 1554 5013
+3  1554 5444 7783
+3  7783 5014 1554
+3  1553 5067 7783
+3  7783 5444 1553
+3  2030 5445 7783
+3  7783 5067 2030
+3  5014 7783 5445
+3  5445 2029 5014
+3  5446 7784 5020
+3  5020 1519 5446
+3  5010 7784 5446
+3  5446 1518 5010
+3  1557 5447 7784
+3  7784 5010 1557
+3  1556 5020 7784
+3  7784 5447 1556
+3  5448 7785 5087
+3  5087 1559 5448
+3  5082 7785 5448
+3  5448 1558 5082
+3  1561 5449 7785
+3  7785 5082 1561
+3  1560 5087 7785
+3  7785 5449 1560
+3  1509 5450 7786
+3  7786 4998 1509
+3  1512 5451 7786
+3  7786 5450 1512
+3  5452 7786 5451
+3  5451 1566 5452
+3  1565 4998 7786
+3  7786 5452 1565
+3  1389 5453 7787
+3  7787 5455 1389
+3  1388 4999 7787
+3  7787 5453 1388
+3  5454 7787 4999
+3  4999 1565 5454
+3  1564 5455 7787
+3  7787 5454 1564
+3  5456 7788 5458
+3  5458 1658 5456
+3  5062 7788 5456
+3  5456 1657 5062
+3  1761 5457 7788
+3  7788 5062 1761
+3  1760 5458 7788
+3  7788 5457 1760
+3  5459 7789 5093
+3  5093 1659 5459
+3  1658 4991 7789
+3  7789 5459 1658
+3  1967 5460 7789
+3  7789 4991 1967
+3  1966 5093 7789
+3  7789 5460 1966
+3  1412 5461 7790
+3  7790 4990 1412
+3  1414 4988 7790
+3  7790 5461 1414
+3  1968 5462 7790
+3  7790 4988 1968
+3  4990 7790 5462
+3  5462 1967 4990
+3  5463 7791 4987
+3  4987 1664 5463
+3  5095 7791 5463
+3  5463 1666 5095
+3  1969 5464 7791
+3  7791 5095 1969
+3  1968 4987 7791
+3  7791 5464 1968
+3  1544 5465 5467
+3  1980 5466 5465
+3  1159 5467 5466
+3  5467 5465 5466
+3  1661 5468 7792
+3  7792 5098 1661
+3  1660 5096 7792
+3  7792 5468 1660
+3  5469 7792 5096
+3  5096 1666 5469
+3  1665 5098 7792
+3  7792 5469 1665
+3  1660 5470 7793
+3  7793 5097 1660
+3  1663 5094 7793
+3  7793 5470 1663
+3  1966 5471 7793
+3  7793 5094 1966
+3  5097 7793 5471
+3  5471 1969 5097
+3  5472 7794 5474
+3  5474 1657 5472
+3  5092 7794 5472
+3  5472 1659 5092
+3  1663 5473 7794
+3  7794 5092 1663
+3  1662 5474 7794
+3  7794 5473 1662
+3  1662 5475 7795
+3  7795 5477 1662
+3  1661 5102 7795
+3  7795 5475 1661
+3  5476 7795 5102
+3  5102 1385 5476
+3  5477 7795 5476
+3  5476 1980 5477
+3  5478 7796 5480
+3  5480 1538 5478
+3  1537 5103 7796
+3  7796 5478 1537
+3  1971 5479 7796
+3  7796 5103 1971
+3  5480 7796 5479
+3  5479 1970 5480
+3  5481 7797 5112
+3  5112 1972 5481
+3  5107 7797 5481
+3  5481 1971 5107
+3  1986 5482 7797
+3  7797 5107 1986
+3  1985 5112 7797
+3  7797 5482 1985
+3  5483 7798 5114
+3  5114 1669 5483
+3  1668 5108 7798
+3  7798 5483 1668
+3  1985 5484 7798
+3  7798 5108 1985
+3  1988 5114 7798
+3  7798 5484 1988
+3  5485 7799 5106
+3  5106 1674 5485
+3  5116 7799 5485
+3  5485 1676 5116
+3  1987 5486 7799
+3  7799 5116 1987
+3  1986 5106 7799
+3  7799 5486 1986
+3  1671 5487 7800
+3  7800 5120 1671
+3  1670 5117 7800
+3  7800 5487 1670
+3  5488 7800 5117
+3  5117 1676 5488
+3  1675 5120 7800
+3  7800 5488 1675
+3  1670 5489 7801
+3  7801 5118 1670
+3  1673 5115 7801
+3  7801 5489 1673
+3  1988 5490 7801
+3  7801 5115 1988
+3  5118 7801 5490
+3  5490 1987 5118
+3  5491 7802 5124
+3  5124 1667 5491
+3  5113 7802 5491
+3  5491 1669 5113
+3  1673 5492 7802
+3  7802 5113 1673
+3  1672 5124 7802
+3  7802 5492 1672
+3  1672 5493 7803
+3  7803 5125 1672
+3  1671 5119 7803
+3  7803 5493 1671
+3  2643 7803 5119
+3  5119 2066 2643
+3  2065 5125 7803
+3  7803 2643 2065
+3  2651 7804 5126
+3  5126 1682 2651
+3  5130 7804 2651
+3  2651 1681 5130
+3  1684 5494 7804
+3  7804 5130 1684
+3  1683 5126 7804
+3  7804 5494 1683
+3  5495 7805 5497
+3  5497 1668 5495
+3  1667 5123 7805
+3  7805 5495 1667
+3  1683 5496 7805
+3  7805 5123 1683
+3  5497 7805 5496
+3  5496 1686 5497
+3  1686 5498 7806
+3  7806 5500 1686
+3  1685 5133 7806
+3  7806 5498 1685
+3  5499 7806 5133
+3  5133 1975 5499
+3  1974 5500 7806
+3  7806 5499 1974
+3  1688 2650 7807
+3  7807 5142 1688
+3  5140 7807 2650
+3  2650 1687 5140
+3  1690 5501 7807
+3  7807 5140 1690
+3  1689 5142 7807
+3  7807 5501 1689
+3  5502 7808 5076
+3  5076 1549 5502
+3  1551 5149 7808
+3  7808 5502 1551
+3  5503 7808 5149
+3  5149 1844 5503
+3  1843 5076 7808
+3  7808 5503 1843
+3  1692 5504 7809
+3  7809 5506 1692
+3  1691 5152 7809
+3  7809 5504 1691
+3  5505 7809 5152
+3  5152 1693 5505
+3  1695 5506 7809
+3  7809 5505 1695
+3  1564 5507 7810
+3  7810 5510 1564
+3  1566 5508 7810
+3  7810 5507 1566
+3  5509 7810 5508
+3  5508 2008 5509
+3  2010 5510 7810
+3  7810 5509 2010
+3  5511 7811 5159
+3  5159 2009 5511
+3  2008 5512 7811
+3  7811 5511 2008
+3  2058 5513 7811
+3  7811 5512 2058
+3  5159 7811 5513
+3  5513 2057 5159
+3  5514 7812 5006
+3  5006 2028 5514
+3  5515 7812 5514
+3  5514 2027 5515
+3  5516 7812 5515
+3  5515 2059 5516
+3  2058 5006 7812
+3  7812 5516 2058
+3  5517 7813 5519
+3  5519 1697 5517
+3  5160 7813 5517
+3  5517 1696 5160
+3  5518 7813 5160
+3  5160 2057 5518
+3  2059 5519 7813
+3  7813 5518 2059
+3  5520 7814 5168
+3  5168 1699 5520
+3  5163 7814 5520
+3  5520 1698 5163
+3  1700 5521 7814
+3  7814 5163 1700
+3  1702 5168 7814
+3  7814 5521 1702
+3  5522 7815 5523
+3  5523 1702 5522
+3  1701 5169 7815
+3  7815 5522 1701
+3  1704 2649 7815
+3  7815 5169 1704
+3  5523 7815 2649
+3  2649 1703 5523
+3  1369 5524 7816
+3  7816 5527 1369
+3  1536 5525 7816
+3  7816 5524 1536
+3  5526 7816 5525
+3  5525 1711 5526
+3  1713 5527 7816
+3  7816 5526 1713
+3  5528 7817 5111
+3  5111 1709 5528
+3  5050 7817 5528
+3  5528 1708 5050
+3  5529 7817 5050
+3  5050 1970 5529
+3  1972 5111 7817
+3  7817 5529 1972
+3  5530 7818 5051
+3  5051 1708 5530
+3  5177 7818 5530
+3  5530 1710 5177
+3  5531 7818 5177
+3  5177 1712 5531
+3  1711 5051 7818
+3  7818 5531 1711
+3  5532 7819 5535
+3  5535 1706 5532
+3  1705 5533 7819
+3  7819 5532 1705
+3  1974 5534 7819
+3  7819 5533 1974
+3  5535 7819 5534
+3  5534 1973 5535
+3  5536 7820 5110
+3  5110 1705 5536
+3  5175 7820 5536
+3  5536 1707 5175
+3  5537 7820 5175
+3  5175 1710 5537
+3  1709 5110 7820
+3  7820 5537 1709
+3  5538 7821 5176
+3  5176 1707 5538
+3  1706 5539 7821
+3  7821 5538 1706
+3  1713 5540 7821
+3  7821 5539 1713
+3  5176 7821 5540
+3  5540 1712 5176
+3  1689 5541 7822
+3  7822 5143 1689
+3  1692 5542 7822
+3  7822 5541 1692
+3  5543 7822 5542
+3  5542 1715 5543
+3  1714 5143 7822
+3  7822 5543 1714
+3  5544 7823 5144
+3  5144 1714 5544
+3  5178 7823 5544
+3  5544 1716 5178
+3  1720 5545 7823
+3  7823 5178 1720
+3  1719 5144 7823
+3  7823 5545 1719
+3  2653 7824 5181
+3  5181 1678 2653
+3  5141 7824 2653
+3  2653 1677 5141
+3  5546 7824 5141
+3  5141 1719 5546
+3  5181 7824 5546
+3  5546 1718 5181
+3  1718 5547 7825
+3  7825 5182 1718
+3  1717 5186 7825
+3  7825 5547 1717
+3  5548 7825 5186
+3  5186 1723 5548
+3  5182 7825 5548
+3  5548 1722 5182
+3  5549 7826 5179
+3  5179 1716 5549
+3  1715 5550 7826
+3  7826 5549 1715
+3  1724 5551 7826
+3  7826 5550 1724
+3  1727 5179 7826
+3  7826 5551 1727
+3  1717 5552 7827
+3  7827 5187 1717
+3  1720 5180 7827
+3  7827 5552 1720
+3  1727 5553 7827
+3  7827 5180 1727
+3  5187 7827 5553
+3  5553 1726 5187
+3  5554 7828 5556
+3  5556 1721 5554
+3  5185 7828 5554
+3  5554 1723 5185
+3  1726 5555 7828
+3  7828 5185 1726
+3  1725 5556 7828
+3  7828 5555 1725
+3  1695 5557 7829
+3  7829 5560 1695
+3  1694 5558 7829
+3  7829 5557 1694
+3  5559 7829 5558
+3  5558 1729 5559
+3  1728 5560 7829
+3  7829 5559 1728
+3  5561 7830 5154
+3  5154 1728 5561
+3  5196 7830 5561
+3  5561 1730 5196
+3  5562 7830 5196
+3  5196 1733 5562
+3  1732 5154 7830
+3  7830 5562 1732
+3  5563 7831 5565
+3  5565 1731 5563
+3  5198 7831 5563
+3  5563 1733 5198
+3  5564 7831 5198
+3  5198 1977 5564
+3  5565 7831 5564
+3  5564 1976 5565
+3  5566 7832 5197
+3  5197 1730 5566
+3  5195 7832 5566
+3  5566 1729 5195
+3  1978 5567 7832
+3  7832 5195 1978
+3  1977 5197 7832
+3  7832 5567 1977
+3  1532 5568 7833
+3  7833 5043 1532
+3  1534 5204 7833
+3  7833 5568 1534
+3  5569 7833 5204
+3  5204 1996 5569
+3  5043 7833 5569
+3  5569 1999 5043
+3  5570 7834 5573
+3  5573 1976 5570
+3  1978 5571 7834
+3  7834 5570 1978
+3  1998 5572 7834
+3  7834 5571 1998
+3  5573 7834 5572
+3  5572 1997 5573
+3  5574 7835 5203
+3  5203 1535 5574
+3  1807 5200 7835
+3  7835 5574 1807
+3  5575 7835 5200
+3  5200 1997 5575
+3  1996 5203 7835
+3  7835 5575 1996
+3  5576 7836 5579
+3  5579 1732 5576
+3  1731 5577 7836
+3  7836 5576 1731
+3  1735 5578 7836
+3  7836 5577 1735
+3  5579 7836 5578
+3  5578 1734 5579
+3  1725 5580 7837
+3  7837 5583 1725
+3  1724 5581 7837
+3  7837 5580 1724
+3  5582 7837 5581
+3  5581 1734 5582
+3  5583 7837 5582
+3  5582 1736 5583
+3  5584 7838 5189
+3  5189 1736 5584
+3  5585 7838 5584
+3  5584 1735 5585
+3  5586 7838 5585
+3  5585 1738 5586
+3  1737 5189 7838
+3  7838 5586 1737
+3  5587 7839 5589
+3  5589 1737 5587
+3  5206 7839 5587
+3  5587 1739 5206
+3  1743 5588 7839
+3  7839 5206 1743
+3  1742 5589 7839
+3  7839 5588 1742
+3  5590 7840 5173
+3  5173 1748 5590
+3  5201 7840 5590
+3  5590 1747 5201
+3  1807 5591 7840
+3  7840 5201 1807
+3  1370 5173 7840
+3  7840 5591 1370
+3  5592 7841 5207
+3  5207 1739 5592
+3  5202 7841 5592
+3  5592 1738 5202
+3  1747 5593 7841
+3  7841 5202 1747
+3  1750 5207 7841
+3  7841 5593 1750
+3  5594 7842 5211
+3  5211 1740 5594
+3  5208 7842 5594
+3  5594 1743 5208
+3  1750 5595 7842
+3  7842 5208 1750
+3  1749 5211 7842
+3  7842 5595 1749
+3  5596 7843 5132
+3  5132 1745 5596
+3  1744 5597 7843
+3  7843 5596 1744
+3  1973 5598 7843
+3  7843 5597 1973
+3  5132 7843 5598
+3  5598 1975 5132
+3  5599 7844 5172
+3  5172 1744 5599
+3  5209 7844 5599
+3  5599 1746 5209
+3  1749 5600 7844
+3  7844 5209 1749
+3  1748 5172 7844
+3  7844 5600 1748
+3  1741 5601 7845
+3  7845 5603 1741
+3  1740 5210 7845
+3  7845 5601 1740
+3  5602 7845 5210
+3  5210 1746 5602
+3  1745 5603 7845
+3  7845 5602 1745
+3  1378 5604 5605
+3  1380 5215 5604
+3  1752 5605 5215
+3  5605 5604 5215
+3  1753 5606 7846
+3  7846 5219 1753
+3  1752 5214 7846
+3  7846 5606 1752
+3  5607 7846 5214
+3  5214 1755 5607
+3  1754 5219 7846
+3  7846 5607 1754
+3  5608 7847 5221
+3  5221 1756 5608
+3  1755 5213 7847
+3  7847 5608 1755
+3  1379 5609 7847
+3  7847 5213 1379
+3  1382 5221 7847
+3  7847 5609 1382
+3  5610 7848 5216
+3  5216 1754 5610
+3  5220 7848 5610
+3  5610 1756 5220
+3  1953 5611 7848
+3  7848 5220 1953
+3  1955 5216 7848
+3  7848 5611 1955
+3  5612 7849 5226
+3  5226 1764 5612
+3  5224 7849 5612
+3  5612 1372 5224
+3  1766 5613 7849
+3  7849 5224 1766
+3  1765 5226 7849
+3  7849 5613 1765
+3  5614 7850 5232
+3  5232 1404 5614
+3  5227 7850 5614
+3  5614 1403 5227
+3  1765 5615 7850
+3  7850 5227 1765
+3  1768 5232 7850
+3  7850 5615 1768
+3  5616 7851 5236
+3  5236 1767 5616
+3  5223 7851 5616
+3  5616 1766 5223
+3  1371 5617 7851
+3  7851 5223 1371
+3  1957 5236 7851
+3  7851 5617 1957
+3  1954 5618 7852
+3  7852 5237 1954
+3  1953 5619 7852
+3  7852 5618 1953
+3  1961 5620 7852
+3  7852 5619 1961
+3  5237 7852 5620
+3  5620 1960 5237
+3  1957 5621 7853
+3  7853 5233 1957
+3  1956 5238 7853
+3  7853 5621 1956
+3  1960 5622 7853
+3  7853 5238 1960
+3  5233 7853 5622
+3  5622 1959 5233
+3  1958 5623 7854
+3  7854 5241 1958
+3  1961 5624 7854
+3  7854 5623 1961
+3  1381 5625 7854
+3  7854 5624 1381
+3  5241 7854 5625
+3  5625 1979 5241
+3  1773 5242 5627
+3  1979 5626 5242
+3  1161 5627 5626
+3  5627 5242 5626
+3  1401 5628 7855
+3  7855 5630 1401
+3  1404 5231 7855
+3  7855 5628 1404
+3  1963 5629 7855
+3  7855 5231 1963
+3  5630 7855 5629
+3  5629 1962 5630
+3  5631 7856 5099
+3  5099 1665 5631
+3  1664 5632 7856
+3  7856 5631 1664
+3  1962 5633 7856
+3  7856 5632 1962
+3  1965 5099 7856
+3  7856 5633 1965
+3  1965 5634 7857
+3  7857 5100 1965
+3  1964 5246 7857
+3  7857 5634 1964
+3  1383 5635 7857
+3  7857 5246 1383
+3  5100 7857 5635
+3  5635 1386 5100
+3  5636 7858 5244
+3  5244 1770 5636
+3  1769 5234 7858
+3  7858 5636 1769
+3  1959 5637 7858
+3  7858 5234 1959
+3  1958 5244 7858
+3  7858 5637 1958
+3  1768 5638 7859
+3  7859 5229 1768
+3  1767 5235 7859
+3  7859 5638 1767
+3  5639 7859 5235
+3  5235 1769 5639
+3  1772 5229 7859
+3  7859 5639 1772
+3  1772 5640 7860
+3  7860 5230 1772
+3  1771 5247 7860
+3  7860 5640 1771
+3  5641 7860 5247
+3  5247 1964 5641
+3  5230 7860 5641
+3  5641 1963 5230
+3  1771 5642 7861
+3  7861 5248 1771
+3  1770 5243 7861
+3  7861 5642 1770
+3  1773 5643 7861
+3  7861 5243 1773
+3  5248 7861 5643
+3  5643 1384 5248
+3  1553 5644 7862
+3  7862 5068 1553
+3  1552 5645 7862
+3  7862 5644 1552
+3  1943 5646 7862
+3  7862 5645 1943
+3  5068 7862 5646
+3  5646 1942 5068
+3  1547 5647 7863
+3  7863 5074 1547
+3  1546 5069 7863
+3  7863 5647 1546
+3  1942 5648 7863
+3  7863 5069 1942
+3  5074 7863 5648
+3  5648 1941 5074
+3  5649 7864 5193
+3  5193 1842 5649
+3  1844 5148 7864
+3  7864 5649 1844
+3  1881 5650 7864
+3  7864 5148 1881
+3  5193 7864 5650
+3  5650 1880 5193
+3  1809 5651 7865
+3  7865 5252 1809
+3  1808 5652 7865
+3  7865 5651 1808
+3  5653 7865 5652
+3  5652 1880 5653
+3  1882 5252 7865
+3  7865 5653 1882
+3  1808 5654 7866
+3  7866 5657 1808
+3  1811 5655 7866
+3  7866 5654 1811
+3  1999 5656 7866
+3  7866 5655 1999
+3  5657 7866 5656
+3  5656 1998 5657
+3  1811 5658 7867
+3  7867 5661 1811
+3  5659 7867 5658
+3  5658 1810 5659
+3  1841 5660 7867
+3  7867 5659 1841
+3  5661 7867 5660
+3  5660 1840 5661
+3  1569 5662 5663
+3  1950 5271 5662
+3  1822 5663 5271
+3  5663 5662 5271
+3  1562 5664 7868
+3  7868 5272 1562
+3  1561 5081 7868
+3  7868 5664 1561
+3  1901 5665 7868
+3  7868 5081 1901
+3  5272 7868 5665
+3  5665 1900 5272
+3  5666 7869 5012
+3  5012 1515 5666
+3  5003 7869 5666
+3  5666 1514 5003
+3  2023 5667 7869
+3  7869 5003 2023
+3  2026 5012 7869
+3  7869 5667 2026
+3  5668 7870 5083
+3  5083 1558 5668
+3  5009 7870 5668
+3  5668 1557 5009
+3  5669 7870 5009
+3  5009 2026 5669
+3  2025 5083 7870
+3  7870 5669 2025
+3  5670 7871 5672
+3  5672 1902 5670
+3  1901 5080 7871
+3  7871 5670 1901
+3  2025 5671 7871
+3  7871 5080 2025
+3  2024 5672 7871
+3  7871 5671 2024
+3  5673 7872 5280
+3  5280 1824 5673
+3  5273 7872 5673
+3  5673 1823 5273
+3  1900 5674 7872
+3  7872 5273 1900
+3  1902 5280 7872
+3  7872 5674 1902
+3  5675 7873 5250
+3  5250 1826 5675
+3  5676 7873 5675
+3  5675 1829 5676
+3  1940 5677 7873
+3  7873 5676 1940
+3  1943 5250 7873
+3  7873 5677 1943
+3  1804 5678 7874
+3  7874 5285 1804
+3  1806 5679 7874
+3  7874 5678 1806
+3  5680 7874 5679
+3  5679 1829 5680
+3  1828 5285 7874
+3  7874 5680 1828
+3  1828 5681 7875
+3  7875 5286 1828
+3  1827 5291 7875
+3  7875 5681 1827
+3  1830 5682 7875
+3  7875 5291 1830
+3  5286 7875 5682
+3  5682 1833 5286
+3  1818 5683 7876
+3  7876 5261 1818
+3  1817 5257 7876
+3  7876 5683 1817
+3  2049 5684 7876
+3  7876 5257 2049
+3  5261 7876 5684
+3  5684 2052 5261
+3  1904 5685 7877
+3  7877 5687 1904
+3  1903 5295 7877
+3  7877 5685 1903
+3  2050 5686 7877
+3  7877 5295 2050
+3  5687 7877 5686
+3  5686 2049 5687
+3  1816 5688 7878
+3  7878 5690 1816
+3  1815 5267 7878
+3  7878 5688 1815
+3  1905 5689 7878
+3  7878 5267 1905
+3  5690 7878 5689
+3  5689 1904 5690
+3  5691 7879 5304
+3  5304 1832 5691
+3  5299 7879 5691
+3  5691 1831 5299
+3  1834 5692 7879
+3  7879 5299 1834
+3  1837 5304 7879
+3  7879 5692 1837
+3  1836 5693 7880
+3  7880 5696 1836
+3  1835 5694 7880
+3  7880 5693 1835
+3  5695 7880 5694
+3  5694 1903 5695
+3  1906 5696 7880
+3  7880 5695 1906
+3  5697 7881 5315
+3  5315 1563 5697
+3  5276 7881 5697
+3  5697 1562 5276
+3  1857 5698 7881
+3  7881 5276 1857
+3  1856 5315 7881
+3  7881 5698 1856
+3  1859 5699 7882
+3  7882 5310 1859
+3  1858 5316 7882
+3  7882 5699 1858
+3  5700 7882 5316
+3  5316 1899 5700
+3  1898 5310 7882
+3  7882 5700 1898
+3  1858 5701 7883
+3  7883 5317 1858
+3  1857 5275 7883
+3  7883 5701 1857
+3  1884 5702 7883
+3  7883 5275 1884
+3  5317 7883 5702
+3  5702 1883 5317
+3  1821 5703 7884
+3  7884 5321 1821
+3  1822 5270 7884
+3  7884 5703 1822
+3  1886 5704 7884
+3  7884 5270 1886
+3  5321 7884 5704
+3  5704 1885 5321
+3  5705 7885 5274
+3  5274 1823 5705
+3  1825 5322 7885
+3  7885 5705 1825
+3  1885 5706 7885
+3  7885 5322 1885
+3  1884 5274 7885
+3  7885 5706 1884
+3  1838 5707 7886
+3  7886 5269 1838
+3  1839 5318 7886
+3  7886 5707 1839
+3  1883 5708 7886
+3  7886 5318 1883
+3  5269 7886 5708
+3  5708 1886 5269
+3  1819 5709 7887
+3  7887 5265 1819
+3  1820 5255 7887
+3  7887 5709 1820
+3  2034 5710 7887
+3  7887 5255 2034
+3  5265 7887 5710
+3  5710 2033 5265
+3  5711 7888 5307
+3  5307 1906 5711
+3  5266 7888 5711
+3  5711 1905 5266
+3  2033 5712 7888
+3  7888 5266 2033
+3  2032 5307 7888
+3  7888 5712 2032
+3  5713 7889 5328
+3  5328 1805 5713
+3  5288 7889 5713
+3  5713 1804 5288
+3  1861 5714 7889
+3  7889 5288 1861
+3  1860 5328 7889
+3  7889 5714 1860
+3  1833 5715 7890
+3  7890 5287 1833
+3  1832 5303 7890
+3  7890 5715 1832
+3  1862 5716 7890
+3  7890 5303 1862
+3  5287 7890 5716
+3  5716 1861 5287
+3  1837 5717 7891
+3  7891 5301 1837
+3  1836 5718 7891
+3  7891 5717 1836
+3  5719 7891 5718
+3  5718 1908 5719
+3  1907 5301 7891
+3  7891 5719 1907
+3  1863 5720 7892
+3  7892 5330 1863
+3  1862 5302 7892
+3  7892 5720 1862
+3  5721 7892 5302
+3  5302 1907 5721
+3  1909 5330 7892
+3  7892 5721 1909
+3  5722 7893 5336
+3  5336 1846 5722
+3  1845 5305 7893
+3  7893 5722 1845
+3  2032 5723 7893
+3  7893 5305 2032
+3  2031 5336 7893
+3  7893 5723 2031
+3  5724 7894 5726
+3  5726 1845 5724
+3  5331 7894 5724
+3  5724 1847 5331
+3  5725 7894 5331
+3  5331 1909 5725
+3  5726 7894 5725
+3  5725 1908 5726
+3  1941 5727 7895
+3  7895 5071 1941
+3  5282 7895 5727
+3  5727 1940 5282
+3  1947 5728 7895
+3  7895 5282 1947
+3  1946 5071 7895
+3  7895 5728 1946
+3  5729 7896 5145
+3  5145 1551 5729
+3  1550 5072 7896
+3  7896 5729 1550
+3  1946 5730 7896
+3  7896 5072 1946
+3  1945 5145 7896
+3  7896 5730 1945
+3  5731 7897 5284
+3  5284 1806 5731
+3  5327 7897 5731
+3  5731 1805 5327
+3  1910 5732 7897
+3  7897 5327 1910
+3  1912 5284 7897
+3  7897 5732 1912
+3  5733 7898 5281
+3  5281 1912 5733
+3  1911 5337 7898
+3  7898 5733 1911
+3  1944 5734 7898
+3  7898 5337 1944
+3  5281 7898 5734
+3  5734 1947 5281
+3  1853 5735 7899
+3  7899 5326 1853
+3  1852 5338 7899
+3  7899 5735 1852
+3  5736 7899 5338
+3  5338 1911 5736
+3  1910 5326 7899
+3  7899 5736 1910
+3  5737 7900 5332
+3  5332 1847 5737
+3  5335 7900 5737
+3  5737 1846 5335
+3  1855 5738 7900
+3  7900 5335 1855
+3  1854 5332 7900
+3  7900 5738 1854
+3  1854 5739 7901
+3  7901 5329 1854
+3  1853 5325 7901
+3  7901 5739 1853
+3  1860 5740 7901
+3  7901 5325 1860
+3  5329 7901 5740
+3  5740 1863 5329
+3  5741 7902 5340
+3  5340 1849 5741
+3  5146 7902 5741
+3  5741 1848 5146
+3  1945 5742 7902
+3  7902 5146 1945
+3  1944 5340 7902
+3  7902 5742 1944
+3  1848 5743 7903
+3  7903 5147 1848
+3  1851 5253 7903
+3  7903 5743 1851
+3  5744 7903 5253
+3  5253 1882 5744
+3  1881 5147 7903
+3  7903 5744 1881
+3  1851 5745 7904
+3  7904 5254 1851
+3  1850 5333 7904
+3  7904 5745 1850
+3  2031 5746 7904
+3  7904 5333 2031
+3  5254 7904 5746
+3  5746 2034 5254
+3  1850 5747 7905
+3  7905 5334 1850
+3  1849 5339 7905
+3  7905 5747 1849
+3  5748 7905 5339
+3  5339 1852 5748
+3  5334 7905 5748
+3  5748 1855 5334
+3  1827 5749 7906
+3  7906 5292 1827
+3  1826 5249 7906
+3  7906 5749 1826
+3  5750 7906 5249
+3  5249 1915 5750
+3  1914 5292 7906
+3  7906 5750 1914
+3  1552 5751 7907
+3  7907 5753 1552
+3  1555 5022 7907
+3  7907 5751 1555
+3  1937 5752 7907
+3  7907 5022 1937
+3  5753 7907 5752
+3  5752 1936 5753
+3  1913 5754 7908
+3  7908 5341 1913
+3  1915 5755 7908
+3  7908 5754 1915
+3  1936 5756 7908
+3  7908 5755 1936
+3  5341 7908 5756
+3  5756 1939 5341
+3  1521 5757 7909
+3  7909 5021 1521
+3  1524 5031 7909
+3  7909 5757 1524
+3  1938 5758 7909
+3  7909 5031 1938
+3  5021 7909 5758
+3  5758 1937 5021
+3  1873 5759 7910
+3  7910 5030 1873
+3  1872 5342 7910
+3  7910 5759 1872
+3  1939 5760 7910
+3  7910 5342 1939
+3  5030 7910 5760
+3  5760 1938 5030
+3  1525 5761 7911
+3  7911 5029 1525
+3  1528 5039 7911
+3  7911 5761 1528
+3  1874 5762 7911
+3  7911 5039 1874
+3  5029 7911 5762
+3  5762 1873 5029
+3  1875 5763 7912
+3  7912 5345 1875
+3  1874 5038 7912
+3  7912 5763 1874
+3  2043 5764 7912
+3  7912 5038 2043
+3  5345 7912 5764
+3  5764 2042 5345
+3  2045 5765 7913
+3  7913 5294 2045
+3  2044 5766 7913
+3  7913 5765 2044
+3  5767 7913 5766
+3  5766 2051 5767
+3  5294 7913 5767
+3  5767 2050 5294
+3  5768 7914 5037
+3  5037 1529 5768
+3  1531 5769 7914
+3  7914 5768 1531
+3  2044 5770 7914
+3  7914 5769 2044
+3  5037 7914 5770
+3  5770 2043 5037
+3  2042 5771 7915
+3  7915 5346 2042
+3  2045 5293 7915
+3  7915 5771 2045
+3  5772 7915 5293
+3  5293 2047 5772
+3  2046 5346 7915
+3  7915 5772 2046
+3  1835 5773 7916
+3  7916 5775 1835
+3  1834 5298 7916
+3  7916 5773 1834
+3  2048 5774 7916
+3  7916 5298 2048
+3  5775 7916 5774
+3  5774 2047 5775
+3  5776 7917 5300
+3  5300 1831 5776
+3  5290 7917 5776
+3  5776 1830 5290
+3  1865 5777 7917
+3  7917 5290 1865
+3  1864 5300 7917
+3  7917 5777 1864
+3  1864 5778 7918
+3  7918 5297 1864
+3  1867 5347 7918
+3  7918 5778 1867
+3  5779 7918 5347
+3  5347 2046 5779
+3  2048 5297 7918
+3  7918 5779 2048
+3  1867 5780 7919
+3  7919 5348 1867
+3  1866 5343 7919
+3  7919 5780 1866
+3  5781 7919 5343
+3  5343 1872 5781
+3  5348 7919 5781
+3  5781 1875 5348
+3  1866 5782 7920
+3  7920 5344 1866
+3  1865 5289 7920
+3  7920 5782 1865
+3  5783 7920 5289
+3  5289 1914 5783
+3  5344 7920 5783
+3  5783 1913 5344
+3  1556 5784 7921
+3  7921 5017 1556
+3  1559 5086 7921
+3  7921 5784 1559
+3  1933 5785 7921
+3  7921 5086 1933
+3  5017 7921 5785
+3  5785 1932 5017
+3  5786 7922 5028
+3  5028 1523 5786
+3  5018 7922 5786
+3  5786 1522 5018
+3  1932 5787 7922
+3  7922 5018 1932
+3  1935 5028 7922
+3  7922 5787 1935
+3  1934 5788 7923
+3  7923 5355 1934
+3  1933 5085 7923
+3  7923 5788 1933
+3  2021 5789 7923
+3  7923 5085 2021
+3  5355 7923 5789
+3  5789 2020 5355
+3  1560 5790 7924
+3  7924 5084 1560
+3  1563 5314 7924
+3  7924 5790 1563
+3  5791 7924 5314
+3  5314 2022 5791
+3  2021 5084 7924
+3  7924 5791 2021
+3  2038 5792 7925
+3  7925 5350 2038
+3  2037 5262 7925
+3  7925 5792 2037
+3  2052 5793 7925
+3  7925 5262 2052
+3  5350 7925 5793
+3  5793 2051 5350
+3  5794 7926 5796
+3  5796 1814 5794
+3  5263 7926 5794
+3  5794 1813 5263
+3  2037 5795 7926
+3  7926 5263 2037
+3  2036 5796 7926
+3  7926 5795 2036
+3  2035 5797 7927
+3  7927 5357 2035
+3  2038 5349 7927
+3  7927 5797 2038
+3  2040 5798 7927
+3  7927 5349 2040
+3  5357 7927 5798
+3  5798 2039 5357
+3  5799 7928 5352
+3  5352 1531 5799
+3  1530 5034 7928
+3  7928 5799 1530
+3  2041 5800 7928
+3  7928 5034 2041
+3  5352 7928 5800
+3  5800 2040 5352
+3  1877 5801 7929
+3  7929 5354 1877
+3  1876 5025 7929
+3  7929 5801 1876
+3  1935 5802 7929
+3  7929 5025 1935
+3  5354 7929 5802
+3  5802 1934 5354
+3  5803 7930 5036
+3  5036 1527 5803
+3  5026 7930 5803
+3  5803 1526 5026
+3  5804 7930 5026
+3  5026 1876 5804
+3  1879 5036 7930
+3  7930 5804 1879
+3  1879 5805 7931
+3  7931 5033 1879
+3  1878 5358 7931
+3  7931 5805 1878
+3  2039 5806 7931
+3  7931 5358 2039
+3  5033 7931 5806
+3  5806 2041 5033
+3  1869 5807 7932
+3  7932 5313 1869
+3  1868 5356 7932
+3  7932 5807 1868
+3  5808 7932 5356
+3  5356 2020 5808
+3  2022 5313 7932
+3  7932 5808 2022
+3  1868 5809 7933
+3  7933 5353 1868
+3  1871 5359 7933
+3  7933 5809 1871
+3  5810 7933 5359
+3  5359 1878 5810
+3  5353 7933 5810
+3  5810 1877 5353
+3  1871 5811 7934
+3  7934 5360 1871
+3  1870 5812 7934
+3  7934 5811 1870
+3  2036 5813 7934
+3  7934 5812 2036
+3  5360 7934 5813
+3  5813 2035 5360
+3  1856 5814 7935
+3  7935 5312 1856
+3  1859 5309 7935
+3  7935 5814 1859
+3  5815 7935 5309
+3  5309 1870 5815
+3  5312 7935 5815
+3  5815 1869 5312
+3  5816 7936 5164
+3  5164 1698 5816
+3  5817 7936 5816
+3  5816 1697 5817
+3  5818 7936 5817
+3  5817 1889 5818
+3  1888 5164 7936
+3  7936 5818 1888
+3  5819 7937 5361
+3  5361 1887 5819
+3  1889 5064 7937
+3  7937 5819 1889
+3  2061 5820 7937
+3  7937 5064 2061
+3  5361 7937 5820
+3  5820 2060 5361
+3  1545 5821 7938
+3  7938 5063 1545
+3  1548 5079 7938
+3  7938 5821 1548
+3  5822 7938 5079
+3  5079 2062 5822
+3  2061 5063 7938
+3  7938 5822 2061
+3  1694 5823 7939
+3  7939 5825 1694
+3  1693 5151 7939
+3  7939 5823 1693
+3  2053 5824 7939
+3  7939 5151 2053
+3  5825 7939 5824
+3  5824 2056 5825
+3  1843 5826 7940
+3  7940 5077 1843
+3  1842 5827 7940
+3  7940 5826 1842
+3  2056 5828 7940
+3  7940 5827 2056
+3  5077 7940 5828
+3  5828 2055 5077
+3  2055 5829 7941
+3  7941 5078 2055
+3  2054 5362 7941
+3  7941 5829 2054
+3  2060 5830 7941
+3  7941 5362 2060
+3  5078 7941 5830
+3  5830 2062 5078
+3  1895 5831 7942
+3  7942 5150 1895
+3  1894 5363 7942
+3  7942 5831 1894
+3  5832 7942 5363
+3  5363 2054 5832
+3  5150 7942 5832
+3  5832 2053 5150
+3  1897 5833 7943
+3  7943 5137 1897
+3  1896 5138 7943
+3  7943 5833 1896
+3  2072 2640 7943
+3  7943 5138 2072
+3  5137 7943 2640
+3  2640 2071 5137
+3  1691 5834 7944
+3  7944 5153 1691
+3  1690 5139 7944
+3  7944 5834 1690
+3  1896 5835 7944
+3  7944 5139 1896
+3  5153 7944 5835
+3  5835 1895 5153
+3  1891 5836 7945
+3  7945 5136 1891
+3  1890 5837 7945
+3  7945 5836 1890
+3  5838 7945 5837
+3  5837 1894 5838
+3  5136 7945 5838
+3  5838 1897 5136
+3  5839 7946 5161
+3  5161 1888 5839
+3  5840 7946 5839
+3  5839 1887 5840
+3  1890 5841 7946
+3  7946 5840 1890
+3  1893 5161 7946
+3  7946 5841 1893
+3  1701 5842 7947
+3  7947 5170 1701
+3  1700 5162 7947
+3  7947 5842 1700
+3  1893 5843 7947
+3  7947 5162 1893
+3  5170 7947 5843
+3  5843 1892 5170
+3  2652 7948 5135
+3  5135 1679 2652
+3  1680 5171 7948
+3  7948 2652 1680
+3  1892 5844 7948
+3  7948 5171 1892
+3  5135 7948 5844
+3  5844 1891 5135
+3  1917 5845 7949
+3  7949 5158 1917
+3  1916 5089 7949
+3  7949 5845 1916
+3  5846 7949 5089
+3  5089 2010 5846
+3  2009 5158 7949
+3  7949 5846 2009
+3  5847 7950 5090
+3  5090 1916 5847
+3  5367 7950 5847
+3  5847 1919 5367
+3  1394 5848 7950
+3  7950 5367 1394
+3  1393 5090 7950
+3  7950 5848 1393
+3  1696 5849 7951
+3  7951 5157 1696
+3  1699 5167 7951
+3  7951 5849 1699
+3  1918 5850 7951
+3  7951 5167 1918
+3  5157 7951 5850
+3  5850 1917 5157
+3  5851 7952 5368
+3  5368 1919 5851
+3  5166 7952 5851
+3  5851 1918 5166
+3  2084 5852 7952
+3  7952 5166 2084
+3  2083 5368 7952
+3  7952 5852 2083
+3  1544 5853 7953
+3  7953 5855 1544
+3  5369 7953 5853
+3  5853 217 5369
+3  1984 5854 7953
+3  7953 5369 1984
+3  1983 5855 7953
+3  7953 5854 1983
+3  5856 7954 5056
+3  5056 1541 5856
+3  1543 5857 7954
+3  7954 5856 1543
+3  1983 5858 7954
+3  7954 5857 1983
+3  1982 5056 7954
+3  7954 5858 1982
+3  5859 7955 5374
+3  5374 1924 5859
+3  1923 5057 7955
+3  7955 5859 1923
+3  1982 5860 7955
+3  7955 5057 1982
+3  1981 5374 7955
+3  7955 5860 1981
+3  5861 7956 5104
+3  5104 1537 5861
+3  5058 7956 5861
+3  5861 1540 5058
+3  1923 5862 7956
+3  7956 5058 1923
+3  1926 5104 7956
+3  7956 5862 1926
+3  1675 5863 7957
+3  7957 5121 1675
+3  1674 5105 7957
+3  7957 5863 1674
+3  1926 5864 7957
+3  7957 5105 1926
+3  5121 7957 5864
+3  5864 1925 5121
+3  1925 5865 7958
+3  7958 5122 1925
+3  1924 5373 7958
+3  7958 5865 1924
+3  5866 7958 5373
+3  5373 1929 5866
+3  1928 5122 7958
+3  7958 5866 1928
+3  1981 5867 7959
+3  7959 5371 1981
+3  1984 5370 7959
+3  7959 5867 1984
+3  5868 7959 5370
+3  5370 1139 5868
+3  2064 5371 7959
+3  7959 5868 2064
+3  5869 7960 2509
+3  2509 1927 5869
+3  1929 5372 7960
+3  7960 5869 1929
+3  2064 5870 7960
+3  7960 5372 2064
+3  2063 2509 7960
+3  7960 5870 2063
+3  1931 2510 2647
+3  2063 5871 2510
+3  1138 2647 5871
+3  2647 2510 5871
+3  1821 5320 5873
+3  2003 5872 5320
+3  1570 5873 5872
+3  5873 5320 5872
+3  1571 5874 5875
+3  2002 5378 5874
+3  1952 5875 5378
+3  5875 5874 5378
+3  1685 5876 7961
+3  7961 5134 1685
+3  1684 5129 7961
+3  7961 5876 1684
+3  5877 7961 5129
+3  5129 2075 5877
+3  5134 7961 5877
+3  5877 2074 5134
+3  1742 5878 7962
+3  7962 5881 1742
+3  1741 5879 7962
+3  7962 5878 1741
+3  1990 5880 7962
+3  7962 5879 1990
+3  5881 7962 5880
+3  5880 1989 5881
+3  5882 7963 5380
+3  5380 1991 5882
+3  1990 5883 7963
+3  7963 5882 1990
+3  2074 5884 7963
+3  7963 5883 2074
+3  5380 7963 5884
+3  5884 2073 5380
+3  1989 5885 7964
+3  7964 5887 1989
+3  1992 5382 7964
+3  7964 5885 1992
+3  5886 7964 5382
+3  5382 2080 5886
+3  2082 5887 7964
+3  7964 5886 2082
+3  1992 5888 7965
+3  7965 5383 1992
+3  1991 5379 7965
+3  7965 5888 1991
+3  5889 7965 5379
+3  5379 2077 5889
+3  5383 7965 5889
+3  5889 2076 5383
+3  5890 7966 5384
+3  5384 2076 5890
+3  5386 7966 5890
+3  5890 2079 5386
+3  2081 5891 7966
+3  7966 5386 2081
+3  2080 5384 7966
+3  7966 5891 2080
+3  5892 7967 5381
+3  5381 2073 5892
+3  2075 5128 7967
+3  7967 5892 2075
+3  2078 5893 7967
+3  7967 5128 2078
+3  2077 5381 7967
+3  7967 5893 2077
+3  2642 7968 5127
+3  5127 2068 2642
+3  2067 5387 7968
+3  7968 2642 2067
+3  2079 5894 7968
+3  7968 5387 2079
+3  2078 5127 7968
+3  7968 5894 2078
+3  1994 5895 7969
+3  7969 5385 1994
+3  5896 7969 5895
+3  5895 1993 5896
+3  2082 5897 7969
+3  7969 5896 2082
+3  5385 7969 5897
+3  5897 2081 5385
+3  5898 7970 5183
+3  5183 1722 5898
+3  1721 5191 7970
+3  7970 5898 1721
+3  1993 5899 7970
+3  7970 5191 1993
+3  1995 5183 7970
+3  7970 5899 1995
+3  1995 5900 7971
+3  7971 5184 1995
+3  5388 7971 5900
+3  5900 1994 5388
+3  2069 2641 7971
+3  7971 5388 2069
+3  5184 7971 2641
+3  2641 2070 5184
+3  2012 5901 7972
+3  7972 5002 2012
+3  2011 5902 7972
+3  7972 5901 2011
+3  2024 5903 7972
+3  7972 5902 2024
+3  5002 7972 5903
+3  5903 2023 5002
+3  1511 5904 7973
+3  7973 5005 1511
+3  1510 4995 7973
+3  7973 5904 1510
+3  2013 5905 7973
+3  7973 4995 2013
+3  5005 7973 5905
+3  5905 2012 5005
+3  2101 5906 5907
+3  2019 4997 5906
+3  1508 5907 4997
+3  5907 5906 4997
+3  2014 5908 7974
+3  7974 5389 2014
+3  2013 4994 7974
+3  7974 5908 2013
+3  2019 5909 7974
+3  7974 4994 2019
+3  5389 7974 5909
+3  5909 1392 5389
+3  5910 7975 4980
+3  4980 1602 5910
+3  5911 7975 5910
+3  5910 1603 5911
+3  5912 7975 5911
+3  5911 2018 5912
+3  4980 7975 5912
+3  5912 1156 4980
+3  1951 5913 7976
+3  7976 5915 1951
+3  1952 5377 7976
+3  7976 5913 1952
+3  5914 7976 5377
+3  5377 2016 5914
+3  2015 5915 7976
+3  7976 5914 2015
+3  2015 5916 7977
+3  7977 5918 2015
+3  2017 5391 7977
+3  7977 5916 2017
+3  1391 5917 7977
+3  7977 5391 1391
+3  5918 7977 5917
+3  5917 2018 5918
+3  1825 5919 7978
+3  7978 5323 1825
+3  5279 7978 5919
+3  5919 1824 5279
+3  2005 5920 7978
+3  7978 5279 2005
+3  2004 5323 7978
+3  7978 5920 2004
+3  2002 5921 7979
+3  7979 5375 2002
+3  2003 5324 7979
+3  7979 5921 2003
+3  2004 5922 7979
+3  7979 5324 2004
+3  5375 7979 5922
+3  5922 2007 5375
+3  2007 5923 7980
+3  7980 5376 2007
+3  2006 5924 7980
+3  7980 5923 2006
+3  5925 7980 5924
+3  5924 2017 5925
+3  2016 5376 7980
+3  7980 5925 2016
+3  2006 5926 7981
+3  7981 5928 2006
+3  2005 5278 7981
+3  7981 5926 2005
+3  5927 7981 5278
+3  5278 2011 5927
+3  5928 7981 5927
+3  5927 2014 5928
+3  1758 5929 7982
+3  7982 5240 1758
+3  1757 5217 7982
+3  7982 5929 1757
+3  5930 7982 5217
+3  5217 1955 5930
+3  1954 5240 7982
+3  7982 5930 1954
+3  1753 5218 5932
+3  1757 5931 5218
+3  1376 5932 5931
+3  5932 5218 5931
+3  1758 5239 5934
+3  1956 5933 5239
+3  1374 5934 5933
+3  5934 5239 5933
+3  2084 5165 7983
+3  7983 5935 2084
+3  5523 7983 5165
+3  5165 1702 5523
+3  1703 2599 7983
+3  7983 5523 1703
+3  2000 5935 7983
+3  7983 2599 2000
+3  2083 5852 7984
+3  7984 5936 2083
+3  5935 7984 5852
+3  5852 2084 5935
+3  2000 2644 7984
+3  7984 5935 2000
+3  2001 5936 7984
+3  7984 2644 2001
+3  1395 5365 7985
+3  7985 5937 1395
+3  5936 7985 5365
+3  5365 2083 5936
+3  2601 7985 5936
+3  5936 2001 2601
+3  1396 5937 7985
+3  7985 2601 1396
+3  5088 7986 5510
+3  5510 2010 5088
+3  1390 5938 7986
+3  7986 5088 1390
+3  1389 5455 7986
+3  7986 5938 1389
+3  5510 7986 5455
+3  5455 1564 5510
+3  1894 5837 5364
+3  1890 5840 5837
+3  1887 5364 5840
+3  5364 5837 5840
+3  1889 5817 5065
+3  1697 5519 5817
+3  2059 5065 5519
+3  5065 5817 5519
+3  2059 5515 5066
+3  2027 5438 5515
+3  1545 5066 5438
+3  5066 5515 5438
+3  5406 7987 5451
+3  5451 1512 5406
+3  1513 5007 7987
+3  7987 5406 1513
+3  5512 7987 5007
+3  5007 2058 5512
+3  5508 7987 5512
+3  5512 2008 5508
+3  1566 5451 7987
+3  7987 5508 1566
+3  1951 5915 7988
+3  7988 5939 1951
+3  2015 5918 7988
+3  7988 5915 2015
+3  5911 7988 5918
+3  5918 2018 5911
+3  1603 5939 7988
+3  7988 5911 1603
+3  2017 5924 5392
+3  2006 5928 5924
+3  2014 5392 5928
+3  5392 5924 5928
+3  5306 7989 5696
+3  5696 1906 5306
+3  1845 5726 7989
+3  7989 5306 1845
+3  1908 5718 7989
+3  7989 5726 1908
+3  5696 7989 5718
+3  5718 1836 5696
+3  1903 5694 5296
+3  1835 5775 5694
+3  2047 5296 5775
+3  5296 5694 5775
+3  2051 5766 5351
+3  2044 5769 5766
+3  1531 5351 5769
+3  5351 5766 5769
+3  1814 5796 5308
+3  2036 5812 5796
+3  1870 5308 5812
+3  5308 5796 5812
+3  1902 5672 5277
+3  2024 5902 5672
+3  2011 5277 5902
+3  5277 5672 5902
+3  5048 7990 5422
+3  5422 1922 5048
+3  5525 7990 5048
+3  5048 1711 5525
+3  1536 5417 7990
+3  7990 5525 1536
+3  1405 5422 7990
+3  7990 5417 1405
+3  1922 5424 5049
+3  1538 5480 5424
+3  1970 5049 5480
+3  5049 5424 5480
+3  5131 7991 5603
+3  5603 1745 5131
+3  5883 7991 5131
+3  5131 2074 5883
+3  5879 7991 5883
+3  5883 1990 5879
+3  5603 7991 5879
+3  5879 1741 5603
+3  5940 7992 5887
+3  5887 2082 5940
+3  5589 7992 5940
+3  5940 1737 5589
+3  5881 7992 5589
+3  5589 1742 5881
+3  1989 5887 7992
+3  7992 5881 1989
+3  5156 7993 5560
+3  5560 1728 5156
+3  5542 7993 5156
+3  5156 1715 5542
+3  1692 5506 7993
+3  7993 5542 1692
+3  1695 5560 7993
+3  7993 5506 1695
+3  5941 7994 5465
+3  5465 1544 5941
+3  5474 7994 5941
+3  5941 1657 5474
+3  5477 7994 5474
+3  5474 1662 5477
+3  1980 5465 7994
+3  7994 5477 1980
+3  5109 7995 5533
+3  5533 1705 5109
+3  5497 7995 5109
+3  5109 1668 5497
+3  1686 5500 7995
+3  7995 5497 1686
+3  1974 5533 7995
+3  7995 5500 1974
+3  1737 5940 5190
+3  2082 5896 5940
+3  1993 5190 5896
+3  5190 5940 5896
+3  1721 5556 5188
+3  1725 5583 5556
+3  1736 5188 5583
+3  5188 5556 5583
+3  5155 7996 5550
+3  5550 1715 5155
+3  1732 5579 7996
+3  7996 5155 1732
+3  1734 5581 7996
+3  7996 5579 1734
+3  5550 7996 5581
+3  5581 1724 5550
+3  5942 7997 5597
+3  5597 1744 5942
+3  5539 7997 5942
+3  5942 1713 5539
+3  1706 5535 7997
+3  7997 5539 1706
+3  1973 5597 7997
+3  7997 5535 1973
+3  5943 7998 5573
+3  5573 1997 5943
+3  1735 5577 7998
+3  7998 5943 1735
+3  1731 5565 7998
+3  7998 5577 1731
+3  1976 5573 7998
+3  7998 5565 1976
+3  5192 7999 5827
+3  5827 1842 5192
+3  5558 7999 5192
+3  5192 1729 5558
+3  5825 7999 5558
+3  5558 1694 5825
+3  2056 5827 7999
+3  7999 5825 2056
+3  5194 8000 5571
+3  5571 1978 5194
+3  5652 8000 5194
+3  5194 1880 5652
+3  5657 8000 5652
+3  5652 1808 5657
+3  1998 5571 8000
+3  8000 5657 1998
+3  1658 5458 4992
+3  1760 5427 5458
+3  1411 4992 5427
+3  4992 5458 5427
+3  4986 8001 5632
+3  5632 1664 4986
+3  5395 8001 4986
+3  4986 1415 5395
+3  1401 5630 8001
+3  8001 5395 1401
+3  1962 5632 8001
+3  8001 5630 1962
+3  5941 8002 5060
+3  5060 1657 5941
+3  1544 5855 8002
+3  8002 5941 1544
+3  1983 5857 8002
+3  8002 5855 1983
+3  1543 5060 8002
+3  8002 5857 1543
+3  5222 8003 5619
+3  5619 1953 5222
+3  1382 5944 8003
+3  8003 5222 1382
+3  1381 5624 8003
+3  8003 5944 1381
+3  5619 8003 5624
+3  5624 1961 5619
+3  1738 5585 5199
+3  1735 5943 5585
+3  1997 5199 5943
+3  5199 5585 5943
+3  5174 8004 5942
+3  5942 1744 5174
+3  1370 5945 8004
+3  8004 5174 1370
+3  1369 5527 8004
+3  8004 5945 1369
+3  1713 5942 8004
+3  8004 5527 1713
+3  5041 8005 5946
+3  5946 1949 5041
+3  1999 5655 8005
+3  8005 5041 1999
+3  1811 5661 8005
+3  8005 5655 1811
+3  5946 8005 5661
+3  5661 1840 5946
+3  5259 8006 5687
+3  5687 2049 5259
+3  5947 8006 5259
+3  5259 1812 5947
+3  1816 5690 8006
+3  8006 5947 1816
+3  1904 5687 8006
+3  8006 5690 1904
+3  5251 8007 5755
+3  5755 1915 5251
+3  5645 8007 5251
+3  5251 1943 5645
+3  5753 8007 5645
+3  5645 1552 5753
+3  1936 5755 8007
+3  8007 5753 1936
+3  1940 5676 5283
+3  1829 5679 5676
+3  1806 5283 5679
+3  5283 5676 5679
+3  1951 5939 8008
+3  8008 5950 1951
+3  1603 5948 8008
+3  8008 5939 1603
+3  1573 5949 8008
+3  8008 5948 1573
+3  5950 8008 5949
+3  5949 1572 5950
+3  1638 5951 5953
+3  1460 5952 5951
+3  1803 5953 5952
+3  5953 5951 5952
+3  2082 5886 5897
+3  2080 5891 5886
+3  2081 5897 5891
+3  5897 5886 5891
+3  2077 5893 8009
+3  8009 5889 2077
+3  2078 5894 8009
+3  8009 5893 2078
+3  2079 5890 8009
+3  8009 5894 2079
+3  5889 8009 5890
+3  5890 2076 5889
+3  2075 5892 5877
+3  2073 5884 5892
+3  2074 5877 5884
+3  5877 5892 5884
+3  5871 8010 4025
+3  4025 1138 5871
+3  2063 5870 8010
+3  8010 5871 2063
+3  5868 8010 5870
+3  5870 2064 5868
+3  1139 4025 8010
+3  8010 5868 1139
+3  2062 5830 5822
+3  2060 5820 5830
+3  2061 5822 5820
+3  5822 5830 5820
+3  2059 5518 5516
+3  2057 5513 5518
+3  2058 5516 5513
+3  5516 5518 5513
+3  2054 5829 8011
+3  8011 5832 2054
+3  2055 5828 8011
+3  8011 5829 2055
+3  5824 8011 5828
+3  5828 2056 5824
+3  2053 5832 8011
+3  8011 5824 2053
+3  5767 8012 5686
+3  5686 2050 5767
+3  2051 5793 8012
+3  8012 5767 2051
+3  5684 8012 5793
+3  5793 2052 5684
+3  2049 5686 8012
+3  8012 5684 2049
+3  2048 5779 5774
+3  2046 5772 5779
+3  2047 5774 5772
+3  5774 5779 5772
+3  5770 8013 5764
+3  5764 2043 5770
+3  2044 5765 8013
+3  8013 5770 2044
+3  5771 8013 5765
+3  5765 2045 5771
+3  2042 5764 8013
+3  8013 5771 2042
+3  2041 5806 5800
+3  2039 5798 5806
+3  2040 5800 5798
+3  5800 5806 5798
+3  5795 8014 5813
+3  5813 2036 5795
+3  5792 8014 5795
+3  5795 2037 5792
+3  5797 8014 5792
+3  5792 2038 5797
+3  5813 8014 5797
+3  5797 2035 5813
+3  2032 5712 8015
+3  8015 5723 2032
+3  2033 5710 8015
+3  8015 5712 2033
+3  5746 8015 5710
+3  5710 2034 5746
+3  5723 8015 5746
+3  5746 2031 5723
+3  5436 8016 5514
+3  5514 2028 5436
+3  5445 8016 5436
+3  5436 2029 5445
+3  5439 8016 5445
+3  5445 2030 5439
+3  2027 5514 8016
+3  8016 5439 2027
+3  5671 8017 5903
+3  5903 2024 5671
+3  5669 8017 5671
+3  5671 2025 5669
+3  2026 5667 8017
+3  8017 5669 2026
+3  2023 5903 8017
+3  8017 5667 2023
+3  2022 5808 5791
+3  2020 5789 5808
+3  2021 5791 5789
+3  5791 5808 5789
+3  1393 5848 8018
+3  8018 5955 1393
+3  1394 5954 8018
+3  8018 5848 1394
+3  1158 4031 8018
+3  8018 5954 1158
+3  5955 8018 4031
+3  4031 1177 5955
+3  1174 5956 8019
+3  8019 4034 1174
+3  1392 5909 8019
+3  8019 5956 1392
+3  5906 8019 5909
+3  5909 2019 5906
+3  4034 8019 5906
+3  5906 2101 4034
+3  5912 8020 4035
+3  4035 1156 5912
+3  2018 5917 8020
+3  8020 5912 2018
+3  1391 5957 8020
+3  8020 5917 1391
+3  4035 8020 5957
+3  5957 1173 4035
+3  2017 5916 5925
+3  2015 5914 5916
+3  2016 5925 5914
+3  5925 5916 5914
+3  5905 8021 5901
+3  5901 2012 5905
+3  2013 5908 8021
+3  8021 5905 2013
+3  5927 8021 5908
+3  5908 2014 5927
+3  2011 5901 8021
+3  8021 5927 2011
+3  2010 5509 5846
+3  2008 5511 5509
+3  2009 5846 5511
+3  5846 5509 5511
+3  5926 8022 5920
+3  5920 2005 5926
+3  5923 8022 5926
+3  5926 2006 5923
+3  5922 8022 5923
+3  5923 2007 5922
+3  5920 8022 5922
+3  5922 2004 5920
+3  5958 8023 5874
+3  5874 1571 5958
+3  1570 5872 8023
+3  8023 5958 1570
+3  2003 5921 8023
+3  8023 5872 2003
+3  2002 5874 8023
+3  8023 5921 2002
+3  5572 8024 5575
+3  5575 1997 5572
+3  5656 8024 5572
+3  5572 1998 5656
+3  5569 8024 5656
+3  5656 1999 5569
+3  1996 5575 8024
+3  8024 5569 1996
+3  1418 5959 8025
+3  8025 5962 1418
+3  1406 5960 8025
+3  8025 5959 1406
+3  5961 8025 5960
+3  5960 1368 5961
+3  1366 5962 8025
+3  8025 5961 1366
+3  1419 5963 8026
+3  8026 5965 1419
+3  1407 5964 8026
+3  8026 5963 1407
+3  1406 5959 8026
+3  8026 5964 1406
+3  5965 8026 5959
+3  5959 1418 5965
+3  4796 8027 5968
+3  5968 1270 4796
+3  1347 5966 8027
+3  8027 4796 1347
+3  1413 5967 8027
+3  8027 5966 1413
+3  1410 5968 8027
+3  8027 5967 1410
+3  1350 4784 8028
+3  8028 5971 1350
+3  1351 5969 8028
+3  8028 4784 1351
+3  1373 5970 8028
+3  8028 5969 1373
+3  5971 8028 5970
+3  5970 1372 5971
+3  1352 5972 8029
+3  8029 4781 1352
+3  1375 5973 8029
+3  8029 5972 1375
+3  1373 5969 8029
+3  8029 5973 1373
+3  4781 8029 5969
+3  5969 1351 4781
+3  1353 4775 8030
+3  8030 5975 1353
+3  4056 8030 4775
+3  4775 2087 4056
+3  1143 5974 8030
+3  8030 4056 1143
+3  1377 5975 8030
+3  8030 5974 1377
+3  1995 5899 5900
+3  1993 5895 5899
+3  1994 5900 5895
+3  5900 5899 5895
+3  5882 8031 5880
+3  5880 1990 5882
+3  1991 5888 8031
+3  8031 5882 1991
+3  1992 5885 8031
+3  8031 5888 1992
+3  1989 5880 8031
+3  8031 5885 1989
+3  1986 5486 8032
+3  8032 5482 1986
+3  1987 5490 8032
+3  8032 5486 1987
+3  5484 8032 5490
+3  5490 1988 5484
+3  5482 8032 5484
+3  5484 1985 5482
+3  5858 8033 5860
+3  5860 1982 5858
+3  5854 8033 5858
+3  5858 1983 5854
+3  5867 8033 5854
+3  5854 1984 5867
+3  5860 8033 5867
+3  5867 1981 5860
+3  1385 5976 8034
+3  8034 5476 1385
+3  2085 4058 8034
+3  8034 5976 2085
+3  5466 8034 4058
+3  4058 1159 5466
+3  1980 5476 8034
+3  8034 5466 1980
+3  5977 8035 5635
+3  5635 1383 5977
+3  4061 8035 5977
+3  5977 1160 4061
+3  218 5978 8035
+3  8035 4061 218
+3  1386 5635 8035
+3  8035 5978 1386
+3  5625 8036 5626
+3  5626 1979 5625
+3  1381 5979 8036
+3  8036 5625 1381
+3  219 4062 8036
+3  8036 5979 219
+3  5626 8036 4062
+3  4062 1161 5626
+3  1978 5570 5567
+3  1976 5564 5570
+3  1977 5567 5564
+3  5567 5570 5564
+3  1975 5598 5499
+3  1973 5534 5598
+3  1974 5499 5534
+3  5499 5598 5534
+3  1972 5529 5481
+3  1970 5479 5529
+3  1971 5481 5479
+3  5481 5529 5479
+3  1967 5462 8037
+3  8037 5460 1967
+3  5464 8037 5462
+3  5462 1968 5464
+3  1969 5471 8037
+3  8037 5464 1969
+3  5460 8037 5471
+3  5471 1966 5460
+3  5641 8038 5629
+3  5629 1963 5641
+3  1964 5634 8038
+3  8038 5641 1964
+3  1965 5633 8038
+3  8038 5634 1965
+3  1962 5629 8038
+3  8038 5633 1962
+3  5622 8039 5637
+3  5637 1959 5622
+3  5620 8039 5622
+3  5622 1960 5620
+3  1961 5623 8039
+3  8039 5620 1961
+3  5637 8039 5623
+3  5623 1958 5637
+3  1956 5621 8040
+3  8040 5933 1956
+3  5617 8040 5621
+3  5621 1957 5617
+3  1371 5980 8040
+3  8040 5617 1371
+3  1374 5933 8040
+3  8040 5980 1374
+3  1955 5611 5930
+3  1953 5618 5611
+3  1954 5930 5618
+3  5930 5611 5618
+3  2086 4065 8041
+3  8041 5982 2086
+3  1141 5981 8041
+3  8041 4065 1141
+3  5609 8041 5981
+3  5981 1382 5609
+3  1379 5982 8041
+3  8041 5609 1379
+3  5983 8042 4069
+3  4069 230 5983
+3  5984 8042 5983
+3  5983 1574 5984
+3  4981 8042 5984
+3  5984 1602 4981
+3  2100 4069 8042
+3  8042 4981 2100
+3  2099 5985 8043
+3  8043 4072 2099
+3  1605 5986 8043
+3  8043 5985 1605
+3  1586 5987 8043
+3  8043 5986 1586
+3  4072 8043 5987
+3  5987 1172 4072
+3  1171 5988 8044
+3  8044 4076 1171
+3  1606 5989 8044
+3  8044 5988 1606
+3  1605 5985 8044
+3  8044 5989 1605
+3  4076 8044 5985
+3  5985 2099 4076
+3  1154 5990 8045
+3  8045 4079 1154
+3  1610 5991 8045
+3  8045 5990 1610
+3  1608 5992 8045
+3  8045 5991 1608
+3  4079 8045 5992
+3  5992 2098 4079
+3  1153 5993 8046
+3  8046 4083 1153
+3  1614 5994 8046
+3  8046 5993 1614
+3  1612 5995 8046
+3  8046 5994 1612
+3  4083 8046 5995
+3  5995 2097 4083
+3  1151 5996 8047
+3  8047 4087 1151
+3  1618 5997 8047
+3  8047 5996 1618
+3  1616 5998 8047
+3  8047 5997 1616
+3  4087 8047 5998
+3  5998 1152 4087
+3  1170 5999 8048
+3  8048 4091 1170
+3  1601 6000 8048
+3  8048 5999 1601
+3  1618 5996 8048
+3  8048 6000 1618
+3  4091 8048 5996
+3  5996 1151 4091
+3  6001 8049 5950
+3  5950 1572 6001
+3  5875 8049 6001
+3  6001 1571 5875
+3  1952 5913 8049
+3  8049 5875 1952
+3  5950 8049 5913
+3  5913 1951 5950
+3  1449 6002 8050
+3  8050 6005 1449
+3  1447 6003 8050
+3  8050 6002 1447
+3  1467 6004 8050
+3  8050 6003 1467
+3  6005 8050 6004
+3  6004 1469 6005
+3  1464 6006 8051
+3  8051 6009 1464
+3  1445 6007 8051
+3  8051 6006 1445
+3  1604 6008 8051
+3  8051 6007 1604
+3  6009 8051 6008
+3  6008 1585 6009
+3  1802 6010 8052
+3  8052 6013 1802
+3  1468 6011 8052
+3  8052 6010 1468
+3  1466 6012 8052
+3  8052 6011 1466
+3  6013 8052 6012
+3  6012 1579 6013
+3  1611 6014 6016
+3  1624 6015 6014
+3  1609 6016 6015
+3  6016 6014 6015
+3  1623 6017 8053
+3  8053 6020 1623
+3  1636 6018 8053
+3  8053 6017 1636
+3  6019 8053 6018
+3  6018 1458 6019
+3  1457 6020 8053
+3  8053 6019 1457
+3  1621 6021 8054
+3  8054 6024 1621
+3  1620 6022 8054
+3  8054 6021 1620
+3  1780 6023 8054
+3  8054 6022 1780
+3  6024 8054 6023
+3  6023 1631 6024
+3  1598 6025 8055
+3  8055 6027 1598
+3  1597 6026 8055
+3  8055 6025 1597
+3  1780 6022 8055
+3  8055 6026 1780
+3  6027 8055 6022
+3  6022 1620 6027
+3  1635 6028 8056
+3  8056 6031 1635
+3  1634 6029 8056
+3  8056 6028 1634
+3  1461 6030 8056
+3  8056 6029 1461
+3  6031 8056 6030
+3  6030 1459 6031
+3  6032 8057 6035
+3  6035 1778 6032
+3  1589 6033 8057
+3  8057 6032 1589
+3  1588 6034 8057
+3  8057 6033 1588
+3  6035 8057 6034
+3  6034 1629 6035
+3  1497 6036 8058
+3  8058 6039 1497
+3  1632 6037 8058
+3  8058 6036 1632
+3  1751 6038 8058
+3  8058 6037 1751
+3  6039 8058 6038
+3  6038 1499 6039
+3  1491 6040 8059
+3  8059 6042 1491
+3  1461 6029 8059
+3  8059 6040 1461
+3  1634 6041 8059
+3  8059 6029 1634
+3  6042 8059 6041
+3  6041 1493 6042
+3  1489 6043 8060
+3  8060 6045 1489
+3  1462 6044 8060
+3  8060 6043 1462
+3  1461 6040 8060
+3  8060 6044 1461
+3  6045 8060 6040
+3  6040 1491 6045
+3  1453 6046 8061
+3  8061 6049 1453
+3  1451 6047 8061
+3  8061 6046 1451
+3  1471 6048 8061
+3  8061 6047 1471
+3  6049 8061 6048
+3  6048 1473 6049
+3  1474 6050 6052
+3  1799 6051 6050
+3  1476 6052 6051
+3  6052 6050 6051
+3  1798 6053 8062
+3  8062 6055 1798
+3  1478 6054 8062
+3  8062 6053 1478
+3  6051 8062 6054
+3  6054 1476 6051
+3  1799 6055 8062
+3  8062 6051 1799
+3  1801 6056 8063
+3  8063 6058 1801
+3  1470 6057 8063
+3  8063 6056 1470
+3  1468 6010 8063
+3  8063 6057 1468
+3  6058 8063 6010
+3  6010 1802 6058
+3  1451 6059 8064
+3  8064 6047 1451
+3  1449 6005 8064
+3  8064 6059 1449
+3  6060 8064 6005
+3  6005 1469 6060
+3  1471 6047 8064
+3  8064 6060 1471
+3  1398 6061 8065
+3  8065 6064 1398
+3  1363 6062 8065
+3  8065 6061 1363
+3  6063 8065 6062
+3  6062 1361 6063
+3  6064 8065 6063
+3  6063 1775 6064
+3  1417 6065 8066
+3  8066 6067 1417
+3  1398 6064 8066
+3  8066 6065 1398
+3  6066 8066 6064
+3  6064 1775 6066
+3  6067 8066 6066
+3  6066 1774 6067
+3  1490 6068 8067
+3  8067 6070 1490
+3  1492 6069 8067
+3  8067 6068 1492
+3  1345 4803 8067
+3  8067 6069 1345
+3  6070 8067 4803
+3  4803 1346 6070
+3  1494 6071 8068
+3  8068 6072 1494
+3  1290 4806 8068
+3  8068 6071 1290
+3  6069 8068 4806
+3  4806 1345 6069
+3  1492 6072 8068
+3  8068 6069 1492
+3  1500 6073 8069
+3  8069 6075 1500
+3  1344 4810 8069
+3  8069 6073 1344
+3  6074 8069 4810
+3  4810 1281 6074
+3  6075 8069 6074
+3  6074 1498 6075
+3  6073 8070 4813
+3  4813 1344 6073
+3  1500 6076 8070
+3  8070 6073 1500
+3  1502 6077 8070
+3  8070 6076 1502
+3  1278 4813 8070
+3  8070 6077 1278
+3  1482 6078 6079
+3  1803 5952 6078
+3  1460 6079 5952
+3  6079 6078 5952
+3  1797 6080 8071
+3  8071 6082 1797
+3  1803 6078 8071
+3  8071 6080 1803
+3  6081 8071 6078
+3  6078 1482 6081
+3  6082 8071 6081
+3  6081 1480 6082
+3  5730 8072 5742
+3  5742 1945 5730
+3  5728 8072 5730
+3  5730 1946 5728
+3  5734 8072 5728
+3  5728 1947 5734
+3  5742 8072 5734
+3  5734 1944 5742
+3  5648 8073 5727
+3  5727 1941 5648
+3  5646 8073 5648
+3  5648 1942 5646
+3  5677 8073 5646
+3  5646 1943 5677
+3  5727 8073 5677
+3  5677 1940 5727
+3  5758 8074 5752
+3  5752 1937 5758
+3  5760 8074 5758
+3  5758 1938 5760
+3  5756 8074 5760
+3  5760 1939 5756
+3  1936 5752 8074
+3  8074 5756 1936
+3  5788 8075 5785
+3  5785 1933 5788
+3  5802 8075 5788
+3  5788 1934 5802
+3  5787 8075 5802
+3  5802 1935 5787
+3  5785 8075 5787
+3  5787 1932 5785
+3  6083 8076 6086
+3  6086 1587 6083
+3  1589 6084 8076
+3  8076 6083 1589
+3  1594 6085 8076
+3  8076 6084 1594
+3  6086 8076 6085
+3  6085 1592 6086
+3  1792 6087 8077
+3  8077 6090 1792
+3  1784 6088 8077
+3  8077 6087 1784
+3  1649 6089 8077
+3  8077 6088 1649
+3  6090 8077 6089
+3  6089 1793 6090
+3  1929 5869 5866
+3  1927 2620 5869
+3  1928 5866 2620
+3  5866 5869 2620
+3  1924 5865 8078
+3  8078 5859 1924
+3  1925 5864 8078
+3  8078 5865 1925
+3  5862 8078 5864
+3  5864 1926 5862
+3  5859 8078 5862
+3  5862 1923 5859
+3  1922 5421 5425
+3  1920 5430 5421
+3  1921 5425 5430
+3  5425 5421 5430
+3  5850 8079 5845
+3  5845 1917 5850
+3  1918 5851 8079
+3  8079 5850 1918
+3  1919 5847 8079
+3  8079 5851 1919
+3  5845 8079 5847
+3  5847 1916 5845
+3  1915 5754 5750
+3  1913 5783 5754
+3  1914 5750 5783
+3  5750 5754 5783
+3  1912 5732 5733
+3  1910 5736 5732
+3  1911 5733 5736
+3  5733 5732 5736
+3  1909 5721 5725
+3  1907 5719 5721
+3  1908 5725 5719
+3  5725 5721 5719
+3  5689 8080 5685
+3  5685 1904 5689
+3  1905 5711 8080
+3  8080 5689 1905
+3  1906 5695 8080
+3  8080 5711 1906
+3  5685 8080 5695
+3  5695 1903 5685
+3  1902 5674 5670
+3  1900 5665 5674
+3  1901 5670 5665
+3  5670 5674 5665
+3  5835 8081 5831
+3  5831 1895 5835
+3  5833 8081 5835
+3  5835 1896 5833
+3  5838 8081 5833
+3  5833 1897 5838
+3  1894 5831 8081
+3  8081 5838 1894
+3  5844 8082 5836
+3  5836 1891 5844
+3  1892 5843 8082
+3  8082 5844 1892
+3  5841 8082 5843
+3  5843 1893 5841
+3  5836 8082 5841
+3  5841 1890 5836
+3  1889 5819 5818
+3  1887 5839 5819
+3  1888 5818 5839
+3  5818 5819 5839
+3  5706 8083 5702
+3  5702 1884 5706
+3  5704 8083 5706
+3  5706 1885 5704
+3  5708 8083 5704
+3  5704 1886 5708
+3  1883 5702 8083
+3  8083 5708 1883
+3  1882 5653 5744
+3  1880 5650 5653
+3  1881 5744 5650
+3  5744 5653 5650
+3  1877 5810 8084
+3  8084 5801 1877
+3  1878 5805 8084
+3  8084 5810 1878
+3  5804 8084 5805
+3  5805 1879 5804
+3  1876 5801 8084
+3  8084 5804 1876
+3  5762 8085 5759
+3  5759 1873 5762
+3  5763 8085 5762
+3  5762 1874 5763
+3  5781 8085 5763
+3  5763 1875 5781
+3  1872 5759 8085
+3  8085 5781 1872
+3  1869 5815 8086
+3  8086 5807 1869
+3  5811 8086 5815
+3  5815 1870 5811
+3  1871 5809 8086
+3  8086 5811 1871
+3  5807 8086 5809
+3  5809 1868 5807
+3  5782 8087 5777
+3  5777 1865 5782
+3  5780 8087 5782
+3  5782 1866 5780
+3  5778 8087 5780
+3  5780 1867 5778
+3  5777 8087 5778
+3  5778 1864 5777
+3  1861 5716 8088
+3  8088 5714 1861
+3  5720 8088 5716
+3  5716 1862 5720
+3  5740 8088 5720
+3  5720 1863 5740
+3  5714 8088 5740
+3  5740 1860 5714
+3  1857 5701 8089
+3  8089 5698 1857
+3  1858 5699 8089
+3  8089 5701 1858
+3  5814 8089 5699
+3  5699 1859 5814
+3  5698 8089 5814
+3  5814 1856 5698
+3  5739 8090 5735
+3  5735 1853 5739
+3  5738 8090 5739
+3  5739 1854 5738
+3  5748 8090 5738
+3  5738 1855 5748
+3  1852 5735 8090
+3  8090 5748 1852
+3  1849 5747 8091
+3  8091 5741 1849
+3  5745 8091 5747
+3  5747 1850 5745
+3  1851 5743 8091
+3  8091 5745 1851
+3  1848 5741 8091
+3  8091 5743 1848
+3  1847 5724 5737
+3  1845 5722 5724
+3  1846 5737 5722
+3  5737 5724 5722
+3  1844 5649 5503
+3  1842 5826 5649
+3  1843 5503 5826
+3  5503 5649 5826
+3  1835 5693 8092
+3  8092 5773 1835
+3  1836 5717 8092
+3  8092 5693 1836
+3  5692 8092 5717
+3  5717 1837 5692
+3  5773 8092 5692
+3  5692 1834 5773
+3  1831 5691 8093
+3  8093 5776 1831
+3  1832 5715 8093
+3  8093 5691 1832
+3  5682 8093 5715
+3  5715 1833 5682
+3  1830 5776 8093
+3  8093 5682 1830
+3  1827 5681 8094
+3  8094 5749 1827
+3  5680 8094 5681
+3  5681 1828 5680
+3  1829 5675 8094
+3  8094 5680 1829
+3  1826 5749 8094
+3  8094 5675 1826
+3  1825 5705 5919
+3  1823 5673 5705
+3  1824 5919 5673
+3  5919 5705 5673
+3  6091 8095 5873
+3  5873 1570 6091
+3  5663 8095 6091
+3  6091 1569 5663
+3  1822 5703 8095
+3  8095 5663 1822
+3  1821 5873 8095
+3  8095 5703 1821
+3  1809 6092 8096
+3  8096 5651 1809
+3  5658 8096 6092
+3  6092 1810 5658
+3  5654 8096 5658
+3  5658 1811 5654
+3  1808 5651 8096
+3  8096 5654 1808
+3  5574 8097 5591
+3  5591 1807 5574
+3  1535 6093 8097
+3  8097 5574 1535
+3  1367 6094 8097
+3  8097 6093 1367
+3  5591 8097 6094
+3  6094 1370 5591
+3  1806 5678 5731
+3  1804 5713 5678
+3  1805 5731 5713
+3  5731 5678 5713
+3  6008 8098 6097
+3  6097 1585 6008
+3  1604 6095 8098
+3  8098 6008 1604
+3  1607 6096 8098
+3  8098 6095 1607
+3  6097 8098 6096
+3  6096 1625 6097
+3  1800 6098 8099
+3  8099 6100 1800
+3  1472 6099 8099
+3  8099 6098 1472
+3  1470 6056 8099
+3  8099 6099 1470
+3  6100 8099 6056
+3  6056 1801 6100
+3  1654 6101 8100
+3  8100 6103 1654
+3  1653 6102 8100
+3  8100 6101 1653
+3  1803 6080 8100
+3  8100 6102 1803
+3  6103 8100 6080
+3  6080 1797 6103
+3  6102 8101 5953
+3  5953 1803 6102
+3  6104 8101 6102
+3  6102 1653 6104
+3  1652 6105 8101
+3  8101 6104 1652
+3  1638 5953 8101
+3  8101 6105 1638
+3  1578 6106 8102
+3  8102 6108 1578
+3  1646 6107 8102
+3  8102 6106 1646
+3  1802 6013 8102
+3  8102 6107 1802
+3  6108 8102 6013
+3  6013 1579 6108
+3  1646 6109 8103
+3  8103 6107 1646
+3  1644 6110 8103
+3  8103 6109 1644
+3  1801 6058 8103
+3  8103 6110 1801
+3  6107 8103 6058
+3  6058 1802 6107
+3  1644 6111 8104
+3  8104 6110 1644
+3  1642 6112 8104
+3  8104 6111 1642
+3  1800 6100 8104
+3  8104 6112 1800
+3  6110 8104 6100
+3  6100 1801 6110
+3  1642 6113 8105
+3  8105 6112 1642
+3  1641 6114 8105
+3  8105 6113 1641
+3  1799 6115 8105
+3  8105 6114 1799
+3  6112 8105 6115
+3  6115 1800 6112
+3  1640 6116 8106
+3  8106 6118 1640
+3  1654 6103 8106
+3  8106 6116 1654
+3  1797 6117 8106
+3  8106 6103 1797
+3  6118 8106 6117
+3  6117 1798 6118
+3  1626 6119 8107
+3  8107 6121 1626
+3  1638 6105 8107
+3  8107 6119 1638
+3  1652 6120 8107
+3  8107 6105 1652
+3  6121 8107 6120
+3  6120 1650 6121
+3  1584 6122 8108
+3  8108 6124 1584
+3  1626 6121 8108
+3  8108 6122 1626
+3  6123 8108 6121
+3  6121 1650 6123
+3  1581 6124 8108
+3  8108 6123 1581
+3  1798 6055 8109
+3  8109 6118 1798
+3  6114 8109 6055
+3  6055 1799 6114
+3  1641 6125 8109
+3  8109 6114 1641
+3  6118 8109 6125
+3  6125 1640 6118
+3  1356 6126 6128
+3  1483 6127 6126
+3  1359 6128 6127
+3  6128 6126 6127
+3  6049 8110 6131
+3  6131 1453 6049
+3  1473 6129 8110
+3  8110 6049 1473
+3  1475 6130 8110
+3  8110 6129 1475
+3  1455 6131 8110
+3  8110 6130 1455
+3  6132 8111 6050
+3  6050 1474 6132
+3  1472 6098 8111
+3  8111 6132 1472
+3  1800 6115 8111
+3  8111 6098 1800
+3  6050 8111 6115
+3  6115 1799 6050
+3  1455 6130 8112
+3  8112 6135 1455
+3  1475 6133 8112
+3  8112 6130 1475
+3  1477 6134 8112
+3  8112 6133 1477
+3  6135 8112 6134
+3  6134 1484 6135
+3  6134 8113 6138
+3  6138 1484 6134
+3  1477 6136 8113
+3  8113 6134 1477
+3  1479 6137 8113
+3  8113 6136 1479
+3  6138 8113 6137
+3  6137 1485 6138
+3  1356 6128 6140
+3  1359 6139 6128
+3  1362 6140 6139
+3  6140 6128 6139
+3  6137 8114 6143
+3  6143 1485 6137
+3  1479 6141 8114
+3  8114 6137 1479
+3  1481 6142 8114
+3  8114 6141 1481
+3  6143 8114 6142
+3  6142 1487 6143
+3  6144 8115 6082
+3  6082 1480 6144
+3  1478 6053 8115
+3  8115 6144 1478
+3  1798 6117 8115
+3  8115 6053 1798
+3  6082 8115 6117
+3  6117 1797 6082
+3  1649 6088 8116
+3  8116 6147 1649
+3  1784 6145 8116
+3  8116 6088 1784
+3  1782 6146 8116
+3  8116 6145 1782
+3  6147 8116 6146
+3  6146 1648 6147
+3  1655 6148 8117
+3  8117 6151 1655
+3  1789 6149 8117
+3  8117 6148 1789
+3  1790 6150 8117
+3  8117 6149 1790
+3  6151 8117 6150
+3  6150 1651 6151
+3  1656 6152 8118
+3  8118 6154 1656
+3  1788 6153 8118
+3  8118 6152 1788
+3  1789 6148 8118
+3  8118 6153 1789
+3  6154 8118 6148
+3  6148 1655 6154
+3  6155 8119 6157
+3  6157 1639 6155
+3  1787 6156 8119
+3  8119 6155 1787
+3  1788 6152 8119
+3  8119 6156 1788
+3  1656 6157 8119
+3  8119 6152 1656
+3  1783 6158 6159
+3  1787 6155 6158
+3  1639 6159 6155
+3  6159 6158 6155
+3  1645 6160 6162
+3  1786 6161 6160
+3  1643 6162 6161
+3  6162 6160 6161
+3  1647 6163 8120
+3  8120 6165 1647
+3  1785 6164 8120
+3  8120 6163 1785
+3  6160 8120 6164
+3  6164 1786 6160
+3  1645 6165 8120
+3  8120 6160 1645
+3  1781 6166 8121
+3  8121 6168 1781
+3  1785 6163 8121
+3  8121 6166 1785
+3  1647 6167 8121
+3  8121 6163 1647
+3  6168 8121 6167
+3  6167 1577 6168
+3  1651 6169 8122
+3  8122 6172 1651
+3  1794 6170 8122
+3  8122 6169 1794
+3  6171 8122 6170
+3  6170 1796 6171
+3  6172 8122 6171
+3  6171 1652 6172
+3  1650 6173 8123
+3  8123 6175 1650
+3  6174 8123 6173
+3  6173 1795 6174
+3  6089 8123 6174
+3  6174 1793 6089
+3  6175 8123 6089
+3  6089 1649 6175
+3  6171 8124 6120
+3  6120 1652 6171
+3  1796 6176 8124
+3  8124 6171 1796
+3  6173 8124 6176
+3  6176 1795 6173
+3  1650 6120 8124
+3  8124 6173 1650
+3  1794 6169 8125
+3  8125 6178 1794
+3  1651 6150 8125
+3  8125 6169 1651
+3  1790 6177 8125
+3  8125 6150 1790
+3  6178 8125 6177
+3  6177 1791 6178
+3  1793 6174 8126
+3  8126 6179 1793
+3  6176 8126 6174
+3  6174 1795 6176
+3  1796 6170 8126
+3  8126 6176 1796
+3  6179 8126 6170
+3  6170 1794 6179
+3  6178 8127 6179
+3  6179 1794 6178
+3  1791 6180 8127
+3  8127 6178 1791
+3  1792 6090 8127
+3  8127 6180 1792
+3  1793 6179 8127
+3  8127 6090 1793
+3  1786 6181 6161
+3  1439 6182 6181
+3  1643 6161 6182
+3  6161 6181 6182
+3  1792 6183 8128
+3  8128 6087 1792
+3  1429 6184 8128
+3  8128 6183 1429
+3  1431 6185 8128
+3  8128 6184 1431
+3  6087 8128 6185
+3  6185 1784 6087
+3  1791 6186 8129
+3  8129 6180 1791
+3  1427 6187 8129
+3  8129 6186 1427
+3  1429 6183 8129
+3  8129 6187 1429
+3  6180 8129 6183
+3  6183 1792 6180
+3  6188 8130 6177
+3  6177 1790 6188
+3  6189 8130 6188
+3  6188 1425 6189
+3  1427 6186 8130
+3  8130 6189 1427
+3  1791 6177 8130
+3  8130 6186 1791
+3  1789 6190 8131
+3  8131 6149 1789
+3  1421 6191 8131
+3  8131 6190 1421
+3  1425 6188 8131
+3  8131 6191 1425
+3  6149 8131 6188
+3  6188 1790 6149
+3  1788 6192 8132
+3  8132 6153 1788
+3  1422 6193 8132
+3  8132 6192 1422
+3  1421 6190 8132
+3  8132 6193 1421
+3  6153 8132 6190
+3  6190 1789 6153
+3  1787 6194 8133
+3  8133 6156 1787
+3  1443 6195 8133
+3  8133 6194 1443
+3  1422 6192 8133
+3  8133 6195 1422
+3  6156 8133 6192
+3  6192 1788 6156
+3  6196 8134 6158
+3  6158 1783 6196
+3  1441 6197 8134
+3  8134 6196 1441
+3  1443 6194 8134
+3  8134 6197 1443
+3  1787 6158 8134
+3  8134 6194 1787
+3  1439 6198 6199
+3  1441 6196 6198
+3  1783 6199 6196
+3  6199 6198 6196
+3  6200 8135 6164
+3  6164 1785 6200
+3  6201 8135 6200
+3  6200 1437 6201
+3  6181 8135 6201
+3  6201 1439 6181
+3  1786 6164 8135
+3  8135 6181 1786
+3  1781 6202 8136
+3  8136 6166 1781
+3  1435 6203 8136
+3  8136 6202 1435
+3  1437 6200 8136
+3  8136 6203 1437
+3  6166 8136 6200
+3  6200 1785 6166
+3  6185 8137 6145
+3  6145 1784 6185
+3  1431 6204 8137
+3  8137 6185 1431
+3  1433 6205 8137
+3  8137 6204 1433
+3  1782 6145 8137
+3  8137 6205 1782
+3  1639 6206 6159
+3  1643 6207 6206
+3  1783 6159 6207
+3  6159 6206 6207
+3  1439 6199 6182
+3  1783 6207 6199
+3  1643 6182 6207
+3  6182 6199 6207
+3  1576 6208 8138
+3  8138 6211 1576
+3  1580 6209 8138
+3  8138 6208 1580
+3  1583 6210 8138
+3  8138 6209 1583
+3  6211 8138 6210
+3  6210 1582 6211
+3  1577 6212 8139
+3  8139 6168 1577
+3  1648 6146 8139
+3  8139 6212 1648
+3  6213 8139 6146
+3  6146 1782 6213
+3  6168 8139 6213
+3  6213 1781 6168
+3  1781 6213 8140
+3  8140 6202 1781
+3  1782 6205 8140
+3  8140 6213 1782
+3  1433 6214 8140
+3  8140 6205 1433
+3  6202 8140 6214
+3  6214 1435 6202
+3  1624 6215 8141
+3  8141 6218 1624
+3  6216 8141 6215
+3  6215 1457 6216
+3  1456 6217 8141
+3  8141 6216 1456
+3  1637 6218 8141
+3  8141 6217 1637
+3  1599 6219 6221
+3  1619 6220 6219
+3  1600 6221 6220
+3  6221 6219 6220
+3  1597 6222 8142
+3  8142 6026 1597
+3  1596 6223 8142
+3  8142 6222 1596
+3  1777 6224 8142
+3  8142 6223 1777
+3  6026 8142 6224
+3  6224 1780 6026
+3  6023 8143 6226
+3  6226 1631 6023
+3  6224 8143 6023
+3  6023 1780 6224
+3  1777 6225 8143
+3  8143 6224 1777
+3  1628 6226 8143
+3  8143 6225 1628
+3  1636 6227 8144
+3  8144 6018 1636
+3  1635 6031 8144
+3  8144 6227 1635
+3  6228 8144 6031
+3  6031 1459 6228
+3  6018 8144 6228
+3  6228 1458 6018
+3  1456 6229 8145
+3  8145 6217 1456
+3  1460 5951 8145
+3  8145 6229 1460
+3  6230 8145 5951
+3  5951 1638 6230
+3  1637 6217 8145
+3  8145 6230 1637
+3  1241 6231 8146
+3  8146 6234 1241
+3  1507 6232 8146
+3  8146 6231 1507
+3  6233 8146 6232
+3  6232 1759 6233
+3  6234 8146 6233
+3  6233 1776 6234
+3  4761 8147 4744
+3  4744 1240 4761
+3  1241 6234 8147
+3  8147 4761 1241
+3  1776 6235 8147
+3  8147 6234 1776
+3  4744 8147 6235
+3  6235 1253 4744
+3  6235 8148 4745
+3  4745 1253 6235
+3  1776 6236 8148
+3  8148 6235 1776
+3  1593 6237 8148
+3  8148 6236 1593
+3  4745 8148 6237
+3  6237 1252 4745
+3  1778 6238 6240
+3  1777 6239 6238
+3  1779 6240 6239
+3  6240 6238 6239
+3  1589 6032 6241
+3  1778 6240 6032
+3  1779 6241 6240
+3  6241 6032 6240
+3  6241 8149 6084
+3  6084 1589 6241
+3  1779 6242 8149
+3  8149 6241 1779
+3  1595 6243 8149
+3  8149 6242 1595
+3  1594 6084 8149
+3  8149 6243 1594
+3  1779 6239 8150
+3  8150 6242 1779
+3  6223 8150 6239
+3  6239 1777 6223
+3  1596 6244 8150
+3  8150 6223 1596
+3  1595 6242 8150
+3  8150 6244 1595
+3  6245 8151 6247
+3  6247 1587 6245
+3  1751 6037 8151
+3  8151 6245 1751
+3  1632 6246 8151
+3  8151 6037 1632
+3  1588 6247 8151
+3  8151 6246 1588
+3  6238 8152 6225
+3  6225 1777 6238
+3  1778 6035 8152
+3  8152 6238 1778
+3  1629 6248 8152
+3  8152 6035 1629
+3  1628 6225 8152
+3  8152 6248 1628
+3  1241 4760 8153
+3  8153 6231 1241
+3  4349 8153 4760
+3  4760 1149 4349
+3  228 6249 8153
+3  8153 4349 228
+3  1507 6231 8153
+3  8153 6249 1507
+3  1504 6250 8154
+3  8154 6252 1504
+3  1506 6251 8154
+3  8154 6250 1506
+3  4816 8154 6251
+3  6251 1343 4816
+3  1279 6252 8154
+3  8154 4816 1279
+3  1759 6253 8155
+3  8155 6233 1759
+3  1591 6254 8155
+3  8155 6253 1591
+3  1593 6236 8155
+3  8155 6254 1593
+3  6233 8155 6236
+3  6236 1776 6233
+3  6255 8156 4772
+3  4772 1354 6255
+3  6249 8156 6255
+3  6255 1507 6249
+3  4356 8156 6249
+3  6249 228 4356
+3  4772 8156 4356
+3  4356 2095 4772
+3  6256 8157 4800
+3  4800 1269 6256
+3  6067 8157 6256
+3  6256 1417 6067
+3  1774 6257 8157
+3  8157 6067 1774
+3  1346 4800 8157
+3  8157 6257 1346
+3  6142 8158 6259
+3  6259 1487 6142
+3  1481 6258 8158
+3  8158 6142 1481
+3  1462 6043 8158
+3  8158 6258 1462
+3  1489 6259 8158
+3  8158 6043 1489
+3  1360 6260 8159
+3  8159 6262 1360
+3  1486 6261 8159
+3  8159 6260 1486
+3  1775 6063 8159
+3  8159 6261 1775
+3  6262 8159 6063
+3  6063 1361 6262
+3  1775 6261 8160
+3  8160 6066 1775
+3  1486 6263 8160
+3  8160 6261 1486
+3  1488 6264 8160
+3  8160 6263 1488
+3  6066 8160 6264
+3  6264 1774 6066
+3  1774 6264 8161
+3  8161 6257 1774
+3  1488 6265 8161
+3  8161 6264 1488
+3  1490 6070 8161
+3  8161 6265 1490
+3  6257 8161 6070
+3  6070 1346 6257
+3  4367 8162 5627
+3  5627 1161 4367
+3  1140 6266 8162
+3  8162 4367 1140
+3  1384 5643 8162
+3  8162 6266 1384
+3  1773 5627 8162
+3  8162 5643 1773
+3  1770 5642 8163
+3  8163 5636 1770
+3  1771 5640 8163
+3  8163 5642 1771
+3  5639 8163 5640
+3  5640 1772 5639
+3  5636 8163 5639
+3  5639 1769 5636
+3  1766 5616 8164
+3  8164 5613 1766
+3  1767 5638 8164
+3  8164 5616 1767
+3  5615 8164 5638
+3  5638 1768 5615
+3  5613 8164 5615
+3  5615 1765 5613
+3  1372 5612 8165
+3  8165 5971 1372
+3  1764 6267 8165
+3  8165 5612 1764
+3  1349 4787 8165
+3  8165 6267 1349
+3  5971 8165 4787
+3  4787 1350 5971
+3  1348 6268 8166
+3  8166 4793 1348
+3  1402 6269 8166
+3  8166 6268 1402
+3  5966 8166 6269
+3  6269 1413 5966
+3  4793 8166 5966
+3  5966 1347 4793
+3  1764 5228 8167
+3  8167 6267 1764
+3  6270 8167 5228
+3  5228 1403 6270
+3  6268 8167 6270
+3  6270 1402 6268
+3  4790 8167 6268
+3  6268 1348 4790
+3  1349 6267 8167
+3  8167 4790 1349
+3  1761 5434 8168
+3  8168 5457 1761
+3  5429 8168 5434
+3  5434 1762 5429
+3  1763 5428 8168
+3  8168 5429 1763
+3  1760 5457 8168
+3  8168 5428 1760
+3  6271 8169 5968
+3  5968 1410 6271
+3  5963 8169 6271
+3  6271 1407 5963
+3  1419 6272 8169
+3  8169 5963 1419
+3  1270 5968 8169
+3  8169 6272 1270
+3  6038 8170 6275
+3  6275 1499 6038
+3  1751 6273 8170
+3  8170 6038 1751
+3  1590 6274 8170
+3  8170 6273 1590
+3  6275 8170 6274
+3  6274 1501 6275
+3  1506 6276 6251
+3  1354 4770 6276
+3  1343 6251 4770
+3  6251 6276 4770
+3  1503 6277 8171
+3  8171 6279 1503
+3  1591 6253 8171
+3  8171 6277 1591
+3  1759 6278 8171
+3  8171 6253 1759
+3  6279 8171 6278
+3  6278 1505 6279
+3  1759 6232 6278
+3  1507 6280 6232
+3  1505 6278 6280
+3  6278 6232 6280
+3  5934 8172 5929
+3  5929 1758 5934
+3  1374 6281 8172
+3  8172 5934 1374
+3  1376 5931 8172
+3  8172 6281 1376
+3  5929 8172 5931
+3  5931 1757 5929
+3  5604 8173 6283
+3  6283 1380 5604
+3  1378 6282 8173
+3  8173 5604 1378
+3  1162 4385 8173
+3  8173 6282 1162
+3  6283 8173 4385
+3  4385 1142 6283
+3  1756 5610 5608
+3  1754 5607 5610
+3  1755 5608 5607
+3  5608 5610 5607
+3  1752 5606 8174
+3  8174 5605 1752
+3  1753 5932 8174
+3  8174 5606 1753
+3  6284 8174 5932
+3  5932 1376 6284
+3  5605 8174 6284
+3  6284 1378 5605
+3  1377 6285 8175
+3  8175 5975 1377
+3  1375 5972 8175
+3  8175 6285 1375
+3  4778 8175 5972
+3  5972 1352 4778
+3  1353 5975 8175
+3  8175 4778 1353
+3  1592 6286 8176
+3  8176 6086 1592
+3  1590 6273 8176
+3  8176 6286 1590
+3  6245 8176 6273
+3  6273 1751 6245
+3  1587 6086 8176
+3  8176 6245 1587
+3  1748 5600 8177
+3  8177 5590 1748
+3  1749 5595 8177
+3  8177 5600 1749
+3  1750 5593 8177
+3  8177 5595 1750
+3  5590 8177 5593
+3  5593 1747 5590
+3  1746 5599 5602
+3  1744 5596 5599
+3  1745 5602 5596
+3  5602 5599 5596
+3  1741 5878 8178
+3  8178 5601 1741
+3  1742 5588 8178
+3  8178 5878 1742
+3  1743 5594 8178
+3  8178 5588 1743
+3  5601 8178 5594
+3  5594 1740 5601
+3  1739 5587 5592
+3  1737 5586 5587
+3  1738 5592 5586
+3  5592 5587 5586
+3  1736 5582 5584
+3  1734 5578 5582
+3  1735 5584 5578
+3  5584 5582 5578
+3  1733 5563 5562
+3  1731 5576 5563
+3  1732 5562 5576
+3  5562 5563 5576
+3  1730 5561 5566
+3  1728 5559 5561
+3  1729 5566 5559
+3  5566 5561 5559
+3  1725 5555 8179
+3  8179 5580 1725
+3  1726 5553 8179
+3  8179 5555 1726
+3  5551 8179 5553
+3  5553 1727 5551
+3  5580 8179 5551
+3  5551 1724 5580
+3  1723 5554 5548
+3  1721 5898 5554
+3  1722 5548 5898
+3  5548 5554 5898
+3  1718 5546 8180
+3  8180 5547 1718
+3  1719 5545 8180
+3  8180 5546 1719
+3  1720 5552 8180
+3  8180 5545 1720
+3  5547 8180 5552
+3  5552 1717 5547
+3  1716 5544 5549
+3  1714 5543 5544
+3  1715 5549 5543
+3  5549 5544 5543
+3  1713 5526 5540
+3  1711 5531 5526
+3  1712 5540 5531
+3  5540 5526 5531
+3  1710 5530 5537
+3  1708 5528 5530
+3  1709 5537 5528
+3  5537 5530 5528
+3  1707 5536 5538
+3  1705 5532 5536
+3  1706 5538 5532
+3  5538 5536 5532
+3  1702 5521 5522
+3  1700 5842 5521
+3  1701 5522 5842
+3  5522 5521 5842
+3  1697 5816 8181
+3  8181 5517 1697
+3  1698 5520 8181
+3  8181 5816 1698
+3  1699 5849 8181
+3  8181 5520 1699
+3  5517 8181 5849
+3  5849 1696 5517
+3  1695 5505 5557
+3  1693 5823 5505
+3  1694 5557 5823
+3  5557 5505 5823
+3  5834 8182 5501
+3  5501 1690 5834
+3  5504 8182 5834
+3  5834 1691 5504
+3  5541 8182 5504
+3  5504 1692 5541
+3  5501 8182 5541
+3  5541 1689 5501
+3  1684 5876 8183
+3  8183 5494 1684
+3  1685 5498 8183
+3  8183 5876 1685
+3  5496 8183 5498
+3  5498 1686 5496
+3  5494 8183 5496
+3  5496 1683 5494
+3  1676 5485 5488
+3  1674 5863 5485
+3  1675 5488 5863
+3  5488 5485 5863
+3  1671 5493 8184
+3  8184 5487 1671
+3  1672 5492 8184
+3  8184 5493 1672
+3  1673 5489 8184
+3  8184 5492 1673
+3  5487 8184 5489
+3  5489 1670 5487
+3  1669 5491 5483
+3  1667 5495 5491
+3  1668 5483 5495
+3  5483 5491 5495
+3  1666 5463 5469
+3  1664 5631 5463
+3  1665 5469 5631
+3  5469 5463 5631
+3  5475 8185 5468
+3  5468 1661 5475
+3  5473 8185 5475
+3  5475 1662 5473
+3  5470 8185 5473
+3  5473 1663 5470
+3  5468 8185 5470
+3  5470 1660 5468
+3  1659 5472 5459
+3  1657 5456 5472
+3  1658 5459 5456
+3  5459 5472 5456
+3  1362 6287 6140
+3  1400 6288 6287
+3  1356 6140 6288
+3  6140 6287 6288
+3  1639 6157 6290
+3  1656 6289 6157
+3  1640 6290 6289
+3  6290 6157 6289
+3  1654 6116 8186
+3  8186 6291 1654
+3  1640 6289 8186
+3  8186 6116 1640
+3  6154 8186 6289
+3  6289 1656 6154
+3  1655 6291 8186
+3  8186 6154 1655
+3  1653 6101 8187
+3  8187 6292 1653
+3  6291 8187 6101
+3  6101 1654 6291
+3  6151 8187 6291
+3  6291 1655 6151
+3  6292 8187 6151
+3  6151 1651 6292
+3  1653 6292 6104
+3  1651 6172 6292
+3  1652 6104 6172
+3  6104 6292 6172
+3  1650 6175 6123
+3  1649 6293 6175
+3  1581 6123 6293
+3  6123 6175 6293
+3  1582 6294 8188
+3  8188 6295 1582
+3  1581 6293 8188
+3  8188 6294 1581
+3  6147 8188 6293
+3  6293 1649 6147
+3  1648 6295 8188
+3  8188 6147 1648
+3  6211 8189 6296
+3  6296 1576 6211
+3  1582 6295 8189
+3  8189 6211 1582
+3  1648 6212 8189
+3  8189 6295 1648
+3  1577 6296 8189
+3  8189 6212 1577
+3  1646 6106 8190
+3  8190 6298 1646
+3  1578 6297 8190
+3  8190 6106 1578
+3  6167 8190 6297
+3  6297 1577 6167
+3  1647 6298 8190
+3  8190 6167 1647
+3  1644 6109 8191
+3  8191 6299 1644
+3  6298 8191 6109
+3  6109 1646 6298
+3  6165 8191 6298
+3  6298 1647 6165
+3  1645 6299 8191
+3  8191 6165 1645
+3  1642 6111 8192
+3  8192 6300 1642
+3  6299 8192 6111
+3  6111 1644 6299
+3  6162 8192 6299
+3  6299 1645 6162
+3  1643 6300 8192
+3  8192 6162 1643
+3  6113 8193 6301
+3  6301 1641 6113
+3  6300 8193 6113
+3  6113 1642 6300
+3  6206 8193 6300
+3  6300 1643 6206
+3  1639 6301 8193
+3  8193 6206 1639
+3  1641 6301 6125
+3  1639 6290 6301
+3  1640 6125 6290
+3  6125 6301 6290
+3  1638 6119 6230
+3  1626 6302 6119
+3  1637 6230 6302
+3  6230 6119 6302
+3  1624 6218 8194
+3  8194 6304 1624
+3  1637 6302 8194
+3  8194 6218 1637
+3  6303 8194 6302
+3  6302 1626 6303
+3  6304 8194 6303
+3  6303 1625 6304
+3  6015 8195 6305
+3  6305 1609 6015
+3  6304 8195 6015
+3  6015 1624 6304
+3  6096 8195 6304
+3  6304 1625 6096
+3  1607 6305 8195
+3  8195 6096 1607
+3  5992 8196 4411
+3  4411 2098 5992
+3  1608 6306 8196
+3  8196 5992 1608
+3  1606 5988 8196
+3  8196 6306 1606
+3  4411 8196 5988
+3  5988 1171 4411
+3  1636 6017 8197
+3  8197 6309 1636
+3  1623 6307 8197
+3  8197 6017 1623
+3  1622 6308 8197
+3  8197 6307 1622
+3  6309 8197 6308
+3  6308 1627 6309
+3  1635 6227 8198
+3  8198 6311 1635
+3  6309 8198 6227
+3  6227 1636 6309
+3  1627 6310 8198
+3  8198 6309 1627
+3  1630 6311 8198
+3  8198 6310 1630
+3  1634 6028 8199
+3  8199 6313 1634
+3  6311 8199 6028
+3  6028 1635 6311
+3  1630 6312 8199
+3  8199 6311 1630
+3  1633 6313 8199
+3  8199 6312 1633
+3  6041 8200 6315
+3  6315 1493 6041
+3  6313 8200 6041
+3  6041 1634 6313
+3  1633 6314 8200
+3  8200 6313 1633
+3  1495 6315 8200
+3  8200 6314 1495
+3  1495 6314 8201
+3  8201 6317 1495
+3  1633 6316 8201
+3  8201 6314 1633
+3  1632 6036 8201
+3  8201 6316 1632
+3  6317 8201 6036
+3  6036 1497 6317
+3  6246 8202 6318
+3  6318 1588 6246
+3  6316 8202 6246
+3  6246 1632 6316
+3  6312 8202 6316
+3  6316 1633 6312
+3  6318 8202 6312
+3  6312 1630 6318
+3  1628 6319 6226
+3  1627 6320 6319
+3  1631 6226 6320
+3  6226 6319 6320
+3  1622 6321 8203
+3  8203 6308 1622
+3  1621 6024 8203
+3  8203 6321 1621
+3  6320 8203 6024
+3  6024 1631 6320
+3  6308 8203 6320
+3  6320 1627 6308
+3  5998 8204 4428
+3  4428 1152 5998
+3  1616 6322 8204
+3  8204 5998 1616
+3  1614 5993 8204
+3  8204 6322 1614
+3  4428 8204 5993
+3  5993 1153 4428
+3  1588 6318 6034
+3  1630 6323 6318
+3  1629 6034 6323
+3  6034 6318 6323
+3  6248 8205 6319
+3  6319 1628 6248
+3  6323 8205 6248
+3  6248 1629 6323
+3  6310 8205 6323
+3  6323 1630 6310
+3  6319 8205 6310
+3  6310 1627 6319
+3  5995 8206 4431
+3  4431 2097 5995
+3  1612 6324 8206
+3  8206 5995 1612
+3  1610 5990 8206
+3  8206 6324 1610
+3  4431 8206 5990
+3  5990 1154 4431
+3  6071 8207 4960
+3  4960 1290 6071
+3  1494 6325 8207
+3  8207 6071 1494
+3  1496 6326 8207
+3  8207 6325 1496
+3  1280 4960 8207
+3  8207 6326 1280
+3  1498 6074 8208
+3  8208 6327 1498
+3  1281 4967 8208
+3  8208 6074 1281
+3  1280 6326 8208
+3  8208 4967 1280
+3  6327 8208 6326
+3  6326 1496 6327
+3  1585 6097 8209
+3  8209 6328 1585
+3  1625 6303 8209
+3  8209 6097 1625
+3  6122 8209 6303
+3  6303 1626 6122
+3  1584 6328 8209
+3  8209 6122 1584
+3  6329 8210 6331
+3  6331 1464 6329
+3  1583 6209 8210
+3  8210 6329 1583
+3  1580 6330 8210
+3  8210 6209 1580
+3  1465 6331 8210
+3  8210 6330 1465
+3  1624 6014 6215
+3  1611 6332 6014
+3  1457 6215 6332
+3  6215 6014 6332
+3  1623 6020 8211
+3  8211 6334 1623
+3  1457 6332 8211
+3  8211 6020 1457
+3  1611 6333 8211
+3  8211 6332 1611
+3  6334 8211 6333
+3  6333 1613 6334
+3  1622 6307 8212
+3  8212 6336 1622
+3  6334 8212 6307
+3  6307 1623 6334
+3  1613 6335 8212
+3  8212 6334 1613
+3  1615 6336 8212
+3  8212 6335 1615
+3  1621 6321 8213
+3  8213 6338 1621
+3  6336 8213 6321
+3  6321 1622 6336
+3  1615 6337 8213
+3  8213 6336 1615
+3  1617 6338 8213
+3  8213 6337 1617
+3  1620 6021 8214
+3  8214 6340 1620
+3  6338 8214 6021
+3  6021 1621 6338
+3  1617 6339 8214
+3  8214 6338 1617
+3  1619 6340 8214
+3  8214 6339 1619
+3  6341 8215 6219
+3  6219 1599 6341
+3  1598 6027 8215
+3  8215 6341 1598
+3  1620 6340 8215
+3  8215 6027 1620
+3  1619 6219 8215
+3  8215 6340 1619
+3  1618 6000 8216
+3  8216 6343 1618
+3  1601 6342 8216
+3  8216 6000 1601
+3  6220 8216 6342
+3  6342 1600 6220
+3  6343 8216 6220
+3  6220 1619 6343
+3  1616 5997 8217
+3  8217 6344 1616
+3  6343 8217 5997
+3  5997 1618 6343
+3  6339 8217 6343
+3  6343 1619 6339
+3  1617 6344 8217
+3  8217 6339 1617
+3  1614 6322 8218
+3  8218 6345 1614
+3  6344 8218 6322
+3  6322 1616 6344
+3  6337 8218 6344
+3  6344 1617 6337
+3  1615 6345 8218
+3  8218 6337 1615
+3  1612 5994 8219
+3  8219 6346 1612
+3  6345 8219 5994
+3  5994 1614 6345
+3  6335 8219 6345
+3  6345 1615 6335
+3  1613 6346 8219
+3  8219 6335 1613
+3  1610 6324 8220
+3  8220 6347 1610
+3  6346 8220 6324
+3  6324 1612 6346
+3  6333 8220 6346
+3  6346 1613 6333
+3  1611 6347 8220
+3  8220 6333 1611
+3  1608 5991 8221
+3  8221 6348 1608
+3  6347 8221 5991
+3  5991 1610 6347
+3  6016 8221 6347
+3  6347 1611 6016
+3  1609 6348 8221
+3  8221 6016 1609
+3  1606 6306 8222
+3  8222 6349 1606
+3  6348 8222 6306
+3  6306 1608 6348
+3  1609 6305 8222
+3  8222 6348 1609
+3  6349 8222 6305
+3  6305 1607 6349
+3  1605 5989 8223
+3  8223 6350 1605
+3  6349 8223 5989
+3  5989 1606 6349
+3  1607 6095 8223
+3  8223 6349 1607
+3  1604 6350 8223
+3  8223 6095 1604
+3  1445 6351 8224
+3  8224 6007 1445
+3  1586 5986 8224
+3  8224 6351 1586
+3  6350 8224 5986
+3  5986 1605 6350
+3  6007 8224 6350
+3  6350 1604 6007
+3  1574 6352 8225
+3  8225 5984 1574
+3  1573 5948 8225
+3  8225 6352 1573
+3  1603 5910 8225
+3  8225 5948 1603
+3  5984 8225 5910
+3  5910 1602 5984
+3  1601 5999 8226
+3  8226 6353 1601
+3  4462 8226 5999
+3  5999 1170 4462
+3  1150 4756 8226
+3  8226 4462 1150
+3  1232 6353 8226
+3  8226 4756 1232
+3  6342 8227 6354
+3  6354 1600 6342
+3  6353 8227 6342
+3  6342 1601 6353
+3  4766 8227 6353
+3  6353 1232 4766
+3  6354 8227 4766
+3  4766 1231 6354
+3  6221 8228 6355
+3  6355 1599 6221
+3  1600 6354 8228
+3  8228 6221 1600
+3  1231 4757 8228
+3  8228 6354 1231
+3  1246 6355 8228
+3  8228 4757 1246
+3  1599 6355 6341
+3  1246 6356 6355
+3  1598 6341 6356
+3  6341 6355 6356
+3  1597 6025 8229
+3  8229 6357 1597
+3  1598 6356 8229
+3  8229 6025 1598
+3  4753 8229 6356
+3  6356 1246 4753
+3  1243 6357 8229
+3  8229 4753 1243
+3  1596 6222 8230
+3  8230 6358 1596
+3  6357 8230 6222
+3  6222 1597 6357
+3  1243 4759 8230
+3  8230 6357 1243
+3  6358 8230 4759
+3  4759 1242 6358
+3  1595 6244 8231
+3  8231 6359 1595
+3  6358 8231 6244
+3  6244 1596 6358
+3  1242 4732 8231
+3  8231 6358 1242
+3  1251 6359 8231
+3  8231 4732 1251
+3  1594 6243 8232
+3  8232 6360 1594
+3  6359 8232 6243
+3  6243 1595 6359
+3  4748 8232 6359
+3  6359 1251 4748
+3  1252 6360 8232
+3  8232 4748 1252
+3  1592 6085 8233
+3  8233 6361 1592
+3  6360 8233 6085
+3  6085 1594 6360
+3  6237 8233 6360
+3  6360 1252 6237
+3  1593 6361 8233
+3  8233 6237 1593
+3  1590 6286 8234
+3  8234 6362 1590
+3  1592 6361 8234
+3  8234 6286 1592
+3  6254 8234 6361
+3  6361 1593 6254
+3  6362 8234 6254
+3  6254 1591 6362
+3  6274 8235 6363
+3  6363 1501 6274
+3  6362 8235 6274
+3  6274 1590 6362
+3  1591 6277 8235
+3  8235 6362 1591
+3  1503 6363 8235
+3  8235 6277 1503
+3  6077 8236 4968
+3  4968 1278 6077
+3  1502 6364 8236
+3  8236 6077 1502
+3  1504 6252 8236
+3  8236 6364 1504
+3  1279 4968 8236
+3  8236 6252 1279
+3  1589 6083 6033
+3  1587 6247 6083
+3  1588 6033 6247
+3  6033 6083 6247
+3  6006 8237 6367
+3  6367 1445 6006
+3  6365 8237 6006
+3  6006 1464 6365
+3  1463 6366 8237
+3  8237 6365 1463
+3  1446 6367 8237
+3  8237 6366 1446
+3  1586 6351 8238
+3  8238 6370 1586
+3  6368 8238 6351
+3  6351 1445 6368
+3  1444 6369 8238
+3  8238 6368 1444
+3  1575 6370 8238
+3  8238 6369 1575
+3  5987 8239 4480
+3  4480 1172 5987
+3  6370 8239 5987
+3  5987 1586 6370
+3  1575 6371 8239
+3  8239 6370 1575
+3  1155 4480 8239
+3  8239 6371 1155
+3  6329 8240 6372
+3  6372 1583 6329
+3  6009 8240 6329
+3  6329 1464 6009
+3  1585 6328 8240
+3  8240 6009 1585
+3  1584 6372 8240
+3  8240 6328 1584
+3  6210 8241 6294
+3  6294 1582 6210
+3  6372 8241 6210
+3  6210 1583 6372
+3  6124 8241 6372
+3  6372 1584 6124
+3  6294 8241 6124
+3  6124 1581 6294
+3  1447 6373 8242
+3  8242 6003 1447
+3  1446 6366 8242
+3  8242 6373 1446
+3  1463 6374 8242
+3  8242 6366 1463
+3  6003 8242 6374
+3  6374 1467 6003
+3  1466 6375 8243
+3  8243 6012 1466
+3  1465 6330 8243
+3  8243 6375 1465
+3  1580 6376 8243
+3  8243 6330 1580
+3  6012 8243 6376
+3  6376 1579 6012
+3  6108 8244 6377
+3  6377 1578 6108
+3  6376 8244 6108
+3  6108 1579 6376
+3  6208 8244 6376
+3  6376 1580 6208
+3  1576 6377 8244
+3  8244 6208 1576
+3  1578 6377 6297
+3  1576 6296 6377
+3  1577 6297 6296
+3  6297 6377 6296
+3  1574 5983 8245
+3  8245 6378 1574
+3  230 4489 8245
+3  8245 5983 230
+3  6371 8245 4489
+3  4489 1155 6371
+3  6378 8245 6371
+3  6371 1575 6378
+3  1573 6352 8246
+3  8246 6379 1573
+3  1574 6378 8246
+3  8246 6352 1574
+3  6369 8246 6378
+3  6378 1575 6369
+3  6379 8246 6369
+3  6369 1444 6379
+3  5949 8247 6381
+3  6381 1572 5949
+3  6379 8247 5949
+3  5949 1573 6379
+3  1444 6380 8247
+3  8247 6379 1444
+3  1448 6381 8247
+3  8247 6380 1448
+3  1571 6001 8248
+3  8248 6383 1571
+3  1572 6381 8248
+3  8248 6001 1572
+3  1448 6382 8248
+3  8248 6381 1448
+3  6383 8248 6382
+3  6382 1450 6383
+3  1571 6383 5958
+3  1450 6384 6383
+3  1570 5958 6384
+3  5958 6383 6384
+3  1569 6091 8249
+3  8249 6386 1569
+3  1570 6384 8249
+3  8249 6091 1570
+3  1450 6385 8249
+3  8249 6384 1450
+3  6386 8249 6385
+3  6385 1452 6386
+3  6387 8250 6389
+3  6389 1568 6387
+3  6386 8250 6387
+3  6387 1569 6386
+3  1452 6388 8250
+3  8250 6386 1452
+3  1483 6389 8250
+3  8250 6388 1483
+3  6390 8251 6391
+3  6391 1567 6390
+3  6389 8251 6390
+3  6390 1568 6389
+3  6126 8251 6389
+3  6389 1483 6126
+3  6391 8251 6126
+3  6126 1356 6391
+3  1567 6391 6393
+3  1356 6392 6391
+3  1355 6393 6392
+3  6393 6391 6392
+3  1356 6288 6395
+3  1400 6394 6288
+3  1357 6395 6394
+3  6395 6288 6394
+3  1399 6396 8252
+3  8252 6397 1399
+3  1533 5046 8252
+3  8252 6396 1533
+3  6394 8252 5046
+3  5046 1357 6394
+3  1400 6397 8252
+3  8252 6394 1400
+3  1566 5507 5452
+3  1564 5454 5507
+3  1565 5452 5454
+3  5452 5507 5454
+3  1388 5453 8253
+3  8253 6399 1388
+3  1389 6398 8253
+3  8253 5453 1389
+3  2102 4507 8253
+3  8253 6398 2102
+3  6399 8253 4507
+3  4507 1157 6399
+3  5664 8254 5449
+3  5449 1561 5664
+3  5697 8254 5664
+3  5664 1562 5697
+3  1563 5790 8254
+3  8254 5697 1563
+3  5449 8254 5790
+3  5790 1560 5449
+3  1557 5668 8255
+3  8255 5447 1557
+3  1558 5448 8255
+3  8255 5668 1558
+3  1559 5784 8255
+3  8255 5448 1559
+3  5447 8255 5784
+3  5784 1556 5447
+3  5444 8256 5644
+3  5644 1553 5444
+3  5443 8256 5444
+3  5444 1554 5443
+3  5751 8256 5443
+3  5443 1555 5751
+3  5644 8256 5751
+3  5751 1552 5644
+3  1551 5502 5729
+3  1549 5441 5502
+3  1550 5729 5441
+3  5729 5502 5441
+3  1546 5647 8257
+3  8257 5437 1546
+3  1547 5440 8257
+3  8257 5647 1547
+3  5821 8257 5440
+3  5440 1548 5821
+3  5437 8257 5821
+3  5821 1545 5437
+3  1159 4509 5467
+3  217 5853 4509
+3  1544 5467 5853
+3  5467 4509 5853
+3  1543 5856 5433
+3  1541 5432 5856
+3  1542 5433 5432
+3  5433 5856 5432
+3  5423 8258 5478
+3  5478 1538 5423
+3  1539 5431 8258
+3  8258 5423 1539
+3  1540 5861 8258
+3  8258 5431 1540
+3  1537 5478 8258
+3  8258 5861 1537
+3  5524 8259 5418
+3  5418 1536 5524
+3  6400 8259 5524
+3  5524 1369 6400
+3  5960 8259 6400
+3  6400 1368 5960
+3  5418 8259 5960
+3  5960 1406 5418
+3  1365 6401 8260
+3  8260 6403 1365
+3  1367 6093 8260
+3  8260 6401 1367
+3  5205 8260 6093
+3  6093 1535 5205
+3  6402 8260 5205
+3  5205 1534 6402
+3  6403 8260 6402
+3  6402 1399 6403
+3  1533 6396 8261
+3  8261 5415 1533
+3  1399 6402 8261
+3  8261 6396 1399
+3  1534 5568 8261
+3  8261 6402 1534
+3  5415 8261 5568
+3  5568 1532 5415
+3  1531 5768 5799
+3  1529 5414 5768
+3  1530 5799 5414
+3  5799 5768 5414
+3  1526 5803 8262
+3  8262 5412 1526
+3  1527 5413 8262
+3  8262 5803 1527
+3  1528 5761 8262
+3  8262 5413 1528
+3  5412 8262 5761
+3  5761 1525 5412
+3  1522 5786 8263
+3  8263 5410 1522
+3  1523 5411 8263
+3  8263 5786 1523
+3  1524 5757 8263
+3  8263 5411 1524
+3  5410 8263 5757
+3  5757 1521 5410
+3  1518 5446 8264
+3  8264 5408 1518
+3  1519 5409 8264
+3  8264 5446 1519
+3  1520 5442 8264
+3  8264 5409 1520
+3  5408 8264 5442
+3  5442 1517 5408
+3  5666 8265 5405
+3  5405 1514 5666
+3  1515 5407 8265
+3  8265 5666 1515
+3  1516 5435 8265
+3  8265 5407 1516
+3  5405 8265 5435
+3  5435 1513 5405
+3  1510 5904 8266
+3  8266 5403 1510
+3  1511 5404 8266
+3  8266 5904 1511
+3  1512 5450 8266
+3  8266 5404 1512
+3  5403 8266 5450
+3  5450 1509 5403
+3  5907 8267 4514
+3  4514 2101 5907
+3  1508 5402 8267
+3  8267 5907 1508
+3  1387 6404 8267
+3  8267 5402 1387
+3  4514 8267 6404
+3  6404 1175 4514
+3  6280 8268 6405
+3  6405 1505 6280
+3  6255 8268 6280
+3  6280 1507 6255
+3  1354 6276 8268
+3  8268 6255 1354
+3  1506 6405 8268
+3  8268 6276 1506
+3  6279 8269 6406
+3  6406 1503 6279
+3  6405 8269 6279
+3  6279 1505 6405
+3  1506 6250 8269
+3  8269 6405 1506
+3  1504 6406 8269
+3  8269 6250 1504
+3  6363 8270 6407
+3  6407 1501 6363
+3  6406 8270 6363
+3  6363 1503 6406
+3  6364 8270 6406
+3  6406 1504 6364
+3  6407 8270 6364
+3  6364 1502 6407
+3  1499 6275 8271
+3  8271 6408 1499
+3  1501 6407 8271
+3  8271 6275 1501
+3  1502 6076 8271
+3  8271 6407 1502
+3  6408 8271 6076
+3  6076 1500 6408
+3  1497 6039 8272
+3  8272 6409 1497
+3  1499 6408 8272
+3  8272 6039 1499
+3  6075 8272 6408
+3  6408 1500 6075
+3  1498 6409 8272
+3  8272 6075 1498
+3  6317 8273 6410
+3  6410 1495 6317
+3  1497 6409 8273
+3  8273 6317 1497
+3  1498 6327 8273
+3  8273 6409 1498
+3  6410 8273 6327
+3  6327 1496 6410
+3  6315 8274 6411
+3  6411 1493 6315
+3  1495 6410 8274
+3  8274 6315 1495
+3  1496 6325 8274
+3  8274 6410 1496
+3  6411 8274 6325
+3  6325 1494 6411
+3  1491 6042 8275
+3  8275 6412 1491
+3  1493 6411 8275
+3  8275 6042 1493
+3  1494 6072 8275
+3  8275 6411 1494
+3  6412 8275 6072
+3  6072 1492 6412
+3  6045 8276 6413
+3  6413 1489 6045
+3  6412 8276 6045
+3  6045 1491 6412
+3  1492 6068 8276
+3  8276 6412 1492
+3  1490 6413 8276
+3  8276 6068 1490
+3  6259 8277 6414
+3  6414 1487 6259
+3  6413 8277 6259
+3  6259 1489 6413
+3  6265 8277 6413
+3  6413 1490 6265
+3  6414 8277 6265
+3  6265 1488 6414
+3  1485 6143 8278
+3  8278 6415 1485
+3  1487 6414 8278
+3  8278 6143 1487
+3  1488 6263 8278
+3  8278 6414 1488
+3  6415 8278 6263
+3  6263 1486 6415
+3  1484 6138 8279
+3  8279 6416 1484
+3  1485 6415 8279
+3  8279 6138 1485
+3  6260 8279 6415
+3  6415 1486 6260
+3  1360 6416 8279
+3  8279 6260 1360
+3  6135 8280 6418
+3  6418 1455 6135
+3  1484 6416 8280
+3  8280 6135 1484
+3  1360 6417 8280
+3  8280 6416 1360
+3  1359 6418 8280
+3  8280 6417 1359
+3  6419 8281 6420
+3  6420 1454 6419
+3  6418 8281 6419
+3  6419 1455 6418
+3  6127 8281 6418
+3  6418 1359 6127
+3  1483 6420 8281
+3  8281 6127 1483
+3  1454 6420 6421
+3  1483 6388 6420
+3  1452 6421 6388
+3  6421 6420 6388
+3  1460 6422 6079
+3  1462 6423 6422
+3  1482 6079 6423
+3  6079 6422 6423
+3  1480 6081 8282
+3  8282 6424 1480
+3  1482 6423 8282
+3  8282 6081 1482
+3  6258 8282 6423
+3  6423 1462 6258
+3  6424 8282 6258
+3  6258 1481 6424
+3  6144 8283 6425
+3  6425 1478 6144
+3  1480 6424 8283
+3  8283 6144 1480
+3  1481 6141 8283
+3  8283 6424 1481
+3  6425 8283 6141
+3  6141 1479 6425
+3  6054 8284 6426
+3  6426 1476 6054
+3  1478 6425 8284
+3  8284 6054 1478
+3  1479 6136 8284
+3  8284 6425 1479
+3  6426 8284 6136
+3  6136 1477 6426
+3  6052 8285 6427
+3  6427 1474 6052
+3  1476 6426 8285
+3  8285 6052 1476
+3  1477 6133 8285
+3  8285 6426 1477
+3  6427 8285 6133
+3  6133 1475 6427
+3  6132 8286 6428
+3  6428 1472 6132
+3  1474 6427 8286
+3  8286 6132 1474
+3  1475 6129 8286
+3  8286 6427 1475
+3  1473 6428 8286
+3  8286 6129 1473
+3  1470 6099 8287
+3  8287 6429 1470
+3  1472 6428 8287
+3  8287 6099 1472
+3  6048 8287 6428
+3  6428 1473 6048
+3  1471 6429 8287
+3  8287 6048 1471
+3  1468 6057 8288
+3  8288 6430 1468
+3  6429 8288 6057
+3  6057 1470 6429
+3  6060 8288 6429
+3  6429 1471 6060
+3  1469 6430 8288
+3  8288 6060 1469
+3  1466 6011 8289
+3  8289 6431 1466
+3  6430 8289 6011
+3  6011 1468 6430
+3  1469 6004 8289
+3  8289 6430 1469
+3  1467 6431 8289
+3  8289 6004 1467
+3  6375 8290 6432
+3  6432 1465 6375
+3  6431 8290 6375
+3  6375 1466 6431
+3  6374 8290 6431
+3  6431 1467 6374
+3  1463 6432 8290
+3  8290 6374 1463
+3  1465 6432 6331
+3  1463 6365 6432
+3  1464 6331 6365
+3  6331 6432 6365
+3  6030 8291 6433
+3  6433 1459 6030
+3  6044 8291 6030
+3  6030 1461 6044
+3  6422 8291 6044
+3  6044 1462 6422
+3  6433 8291 6422
+3  6422 1460 6433
+3  6228 8292 6434
+3  6434 1458 6228
+3  1459 6433 8292
+3  8292 6228 1459
+3  6229 8292 6433
+3  6433 1460 6229
+3  1456 6434 8292
+3  8292 6229 1456
+3  1458 6434 6019
+3  1456 6216 6434
+3  1457 6019 6216
+3  6019 6434 6216
+3  1455 6419 6131
+3  1454 6435 6419
+3  1453 6131 6435
+3  6131 6419 6435
+3  1451 6046 8293
+3  8293 6436 1451
+3  1453 6435 8293
+3  8293 6046 1453
+3  6421 8293 6435
+3  6435 1454 6421
+3  1452 6436 8293
+3  8293 6421 1452
+3  1449 6059 8294
+3  8294 6437 1449
+3  6436 8294 6059
+3  6059 1451 6436
+3  6385 8294 6436
+3  6436 1452 6385
+3  1450 6437 8294
+3  8294 6385 1450
+3  1447 6002 8295
+3  8295 6438 1447
+3  6437 8295 6002
+3  6002 1449 6437
+3  6382 8295 6437
+3  6437 1450 6382
+3  1448 6438 8295
+3  8295 6382 1448
+3  6373 8296 6439
+3  6439 1446 6373
+3  6438 8296 6373
+3  6373 1447 6438
+3  6380 8296 6438
+3  6438 1448 6380
+3  6439 8296 6380
+3  6380 1444 6439
+3  1446 6439 6367
+3  1444 6368 6439
+3  1445 6367 6368
+3  6367 6439 6368
+3  6440 8297 6451
+3  6451 1434 6440
+3  6441 8297 6440
+3  6440 1432 6441
+3  6442 8297 6441
+3  6441 1430 6442
+3  6443 8297 6442
+3  6442 1428 6443
+3  6444 8297 6443
+3  6443 1426 6444
+3  6445 8297 6444
+3  6444 1424 6445
+3  6446 8297 6445
+3  6445 1420 6446
+3  6447 8297 6446
+3  6446 1423 6447
+3  6448 8297 6447
+3  6447 1442 6448
+3  6449 8297 6448
+3  6448 1440 6449
+3  6450 8297 6449
+3  6449 1438 6450
+3  6451 8297 6450
+3  6450 1436 6451
+3  1422 6195 8298
+3  8298 6453 1422
+3  1443 6452 8298
+3  8298 6195 1443
+3  6447 8298 6452
+3  6452 1442 6447
+3  1423 6453 8298
+3  8298 6447 1423
+3  6197 8299 6452
+3  6452 1443 6197
+3  1441 6454 8299
+3  8299 6197 1441
+3  6448 8299 6454
+3  6454 1440 6448
+3  1442 6452 8299
+3  8299 6448 1442
+3  6198 8300 6454
+3  6454 1441 6198
+3  1439 6455 8300
+3  8300 6198 1439
+3  6449 8300 6455
+3  6455 1438 6449
+3  1440 6454 8300
+3  8300 6449 1440
+3  6201 8301 6455
+3  6455 1439 6201
+3  1437 6456 8301
+3  8301 6201 1437
+3  6450 8301 6456
+3  6456 1436 6450
+3  1438 6455 8301
+3  8301 6450 1438
+3  6203 8302 6456
+3  6456 1437 6203
+3  1435 6457 8302
+3  8302 6203 1435
+3  6451 8302 6457
+3  6457 1434 6451
+3  1436 6456 8302
+3  8302 6451 1436
+3  6214 8303 6457
+3  6457 1435 6214
+3  1433 6458 8303
+3  8303 6214 1433
+3  6440 8303 6458
+3  6458 1432 6440
+3  1434 6457 8303
+3  8303 6440 1434
+3  6204 8304 6458
+3  6458 1433 6204
+3  6459 8304 6204
+3  6204 1431 6459
+3  6441 8304 6459
+3  6459 1430 6441
+3  1432 6458 8304
+3  8304 6441 1432
+3  1431 6184 8305
+3  8305 6459 1431
+3  1429 6460 8305
+3  8305 6184 1429
+3  6442 8305 6460
+3  6460 1428 6442
+3  1430 6459 8305
+3  8305 6442 1430
+3  6187 8306 6460
+3  6460 1429 6187
+3  6461 8306 6187
+3  6187 1427 6461
+3  6443 8306 6461
+3  6461 1426 6443
+3  1428 6460 8306
+3  8306 6443 1428
+3  6189 8307 6461
+3  6461 1427 6189
+3  1425 6462 8307
+3  8307 6189 1425
+3  6444 8307 6462
+3  6462 1424 6444
+3  1426 6461 8307
+3  8307 6444 1426
+3  6191 8308 6462
+3  6462 1425 6191
+3  6463 8308 6191
+3  6191 1421 6463
+3  6445 8308 6463
+3  6463 1420 6445
+3  1424 6462 8308
+3  8308 6445 1424
+3  1421 6193 8309
+3  8309 6463 1421
+3  6453 8309 6193
+3  6193 1422 6453
+3  1423 6446 8309
+3  8309 6453 1423
+3  6463 8309 6446
+3  6446 1420 6463
+3  1416 6464 8310
+3  8310 6465 1416
+3  1268 4974 8310
+3  8310 6464 1268
+3  6272 8310 4974
+3  4974 1270 6272
+3  6465 8310 6272
+3  6272 1419 6465
+3  1397 6466 8311
+3  8311 6467 1397
+3  1416 6465 8311
+3  8311 6466 1416
+3  5965 8311 6465
+3  6465 1419 5965
+3  1418 6467 8311
+3  8311 5965 1418
+3  1397 6467 8312
+3  8312 6469 1397
+3  1418 5962 8312
+3  8312 6467 1418
+3  1366 6468 8312
+3  8312 5962 1366
+3  6469 8312 6468
+3  6468 1364 6469
+3  1416 6466 8313
+3  8313 6471 1416
+3  1397 6470 8313
+3  8313 6466 1397
+3  1398 6065 8313
+3  8313 6470 1398
+3  6471 8313 6065
+3  6065 1417 6471
+3  6464 8314 4975
+3  4975 1268 6464
+3  6471 8314 6464
+3  6464 1416 6471
+3  1417 6256 8314
+3  8314 6471 1417
+3  1269 4975 8314
+3  8314 6256 1269
+3  1402 5396 6269
+3  1415 5400 5396
+3  1413 6269 5400
+3  6269 5396 5400
+3  5967 8315 5398
+3  5398 1410 5967
+3  5401 8315 5967
+3  5967 1413 5401
+3  1414 5461 8315
+3  8315 5401 1414
+3  1412 5398 8315
+3  8315 5461 1412
+3  6271 8316 5393
+3  5393 1407 6271
+3  1410 5399 8316
+3  8316 6271 1410
+3  5426 8316 5399
+3  5399 1411 5426
+3  1409 5393 8316
+3  8316 5426 1409
+3  5964 8317 5419
+3  5419 1406 5964
+3  5394 8317 5964
+3  5964 1407 5394
+3  1408 5420 8317
+3  8317 5394 1408
+3  1405 5419 8317
+3  8317 5420 1405
+3  6270 8318 5397
+3  5397 1402 6270
+3  1403 5614 8318
+3  8318 6270 1403
+3  1404 5628 8318
+3  8318 5614 1404
+3  1401 5397 8318
+3  8318 5628 1401
+3  1365 6403 8319
+3  8319 6472 1365
+3  1399 6397 8319
+3  8319 6403 1399
+3  1400 6287 8319
+3  8319 6397 1400
+3  6472 8319 6287
+3  6287 1362 6472
+3  6473 8320 6469
+3  6469 1364 6473
+3  1363 6061 8320
+3  8320 6473 1363
+3  6470 8320 6061
+3  6061 1398 6470
+3  6469 8320 6470
+3  6470 1397 6469
+3  2646 8321 5937
+3  5937 1396 2646
+3  2103 4586 8321
+3  8321 2646 2103
+3  231 6474 8321
+3  8321 4586 231
+3  5937 8321 6474
+3  6474 1395 5937
+3  1158 5954 8322
+3  8322 4587 1158
+3  5366 8322 5954
+3  5954 1394 5366
+3  6474 8322 5366
+3  5366 1395 6474
+3  4587 8322 6474
+3  6474 231 4587
+3  5955 8323 5091
+3  5091 1393 5955
+3  1177 4589 8323
+3  8323 5955 1177
+3  1176 6475 8323
+3  8323 4589 1176
+3  1390 5091 8323
+3  8323 6475 1390
+3  5957 8324 4590
+3  4590 1173 5957
+3  5390 8324 5957
+3  5957 1391 5390
+3  5956 8324 5390
+3  5390 1392 5956
+3  4590 8324 5956
+3  5956 1174 4590
+3  2102 6398 8325
+3  8325 4591 2102
+3  5938 8325 6398
+3  6398 1389 5938
+3  6475 8325 5938
+3  5938 1390 6475
+3  4591 8325 6475
+3  6475 1176 4591
+3  6399 8326 5000
+3  5000 1388 6399
+3  1157 4592 8326
+3  8326 6399 1157
+3  1175 6404 8326
+3  8326 4592 1175
+3  1387 5000 8326
+3  8326 6404 1387
+3  1386 5978 8327
+3  8327 5101 1386
+3  218 4593 8327
+3  8327 5978 218
+3  5976 8327 4593
+3  4593 2085 5976
+3  1385 5101 8327
+3  8327 5976 1385
+3  1160 5977 8328
+3  8328 4594 1160
+3  1383 5245 8328
+3  8328 5977 1383
+3  1384 6266 8328
+3  8328 5245 1384
+3  4594 8328 6266
+3  6266 1140 4594
+3  5981 8329 5944
+3  5944 1382 5981
+3  4595 8329 5981
+3  5981 1141 4595
+3  219 5979 8329
+3  8329 4595 219
+3  5944 8329 5979
+3  5979 1381 5944
+3  5982 8330 4596
+3  4596 2086 5982
+3  5212 8330 5982
+3  5982 1379 5212
+3  1380 6283 8330
+3  8330 5212 1380
+3  1142 4596 8330
+3  8330 6283 1142
+3  1377 5974 8331
+3  8331 6476 1377
+3  1143 4598 8331
+3  8331 5974 1143
+3  1162 6282 8331
+3  8331 4598 1162
+3  6476 8331 6282
+3  6282 1378 6476
+3  1375 6285 8332
+3  8332 6477 1375
+3  6476 8332 6285
+3  6285 1377 6476
+3  1378 6284 8332
+3  8332 6476 1378
+3  1376 6477 8332
+3  8332 6284 1376
+3  1373 5973 8333
+3  8333 6478 1373
+3  6477 8333 5973
+3  5973 1375 6477
+3  6281 8333 6477
+3  6477 1376 6281
+3  6478 8333 6281
+3  6281 1374 6478
+3  5970 8334 5225
+3  5225 1372 5970
+3  6478 8334 5970
+3  5970 1373 6478
+3  5980 8334 6478
+3  6478 1374 5980
+3  5225 8334 5980
+3  5980 1371 5225
+3  6400 8335 6479
+3  6479 1368 6400
+3  1369 5945 8335
+3  8335 6400 1369
+3  6094 8335 5945
+3  5945 1370 6094
+3  6479 8335 6094
+3  6094 1367 6479
+3  1368 6479 5961
+3  1367 6480 6479
+3  1366 5961 6480
+3  5961 6479 6480
+3  6468 8336 6481
+3  6481 1364 6468
+3  6480 8336 6468
+3  6468 1366 6480
+3  6401 8336 6480
+3  6480 1367 6401
+3  6481 8336 6401
+3  6401 1365 6481
+3  6473 8337 6482
+3  6482 1363 6473
+3  1364 6481 8337
+3  8337 6473 1364
+3  1365 6472 8337
+3  8337 6481 1365
+3  6482 8337 6472
+3  6472 1362 6482
+3  1363 6482 6062
+3  1362 6483 6482
+3  1361 6062 6483
+3  6062 6482 6483
+3  6262 8338 6417
+3  6417 1360 6262
+3  6483 8338 6262
+3  6262 1361 6483
+3  6139 8338 6483
+3  6483 1362 6139
+3  6417 8338 6139
+3  6139 1359 6417
+3  6395 8339 6392
+3  6392 1356 6395
+3  1357 5045 8339
+3  8339 6395 1357
+3  1358 6484 8339
+3  8339 5045 1358
+3  1355 6392 8339
+3  8339 6484 1355
+3  857 3726 8340
+3  8340 6485 857
+3  3772 8340 3726
+3  3726 1001 3772
+3  4188 8340 3772
+3  3772 886 4188
+3  887 3778 8340
+3  8340 4188 887
+3  6485 8340 3778
+3  3778 948 6485
+3  712 4393 8341
+3  8341 6487 712
+3  711 6486 8341
+3  8341 4393 711
+3  3750 8341 6486
+3  6486 1102 3750
+3  6487 8341 3750
+3  3750 953 6487
+3  4185 8342 6489
+3  6489 953 4185
+3  6488 8342 4185
+3  4185 954 6488
+3  1101 4028 8342
+3  8342 6488 1101
+3  1100 6489 8342
+3  8342 4028 1100
+3  997 3523 8343
+3  8343 6490 997
+3  1101 6488 8343
+3  8343 3523 1101
+3  3781 8343 6488
+3  6488 954 3781
+3  1084 6490 8343
+3  8343 3781 1084
+3  4154 8344 6491
+3  6491 999 4154
+3  997 6490 8344
+3  8344 4154 997
+3  1084 4029 8344
+3  8344 6490 1084
+3  6491 8344 4029
+3  4029 1085 6491
+3  4038 8345 6493
+3  6493 1049 4038
+3  6492 8345 4038
+3  4038 1050 6492
+3  4187 8345 6492
+3  6492 929 4187
+3  927 6493 8345
+3  8345 4187 927
+3  999 6491 6494
+3  1085 3816 6491
+3  898 6494 3816
+3  6494 6491 3816
+3  927 3274 6493
+3  1029 3647 3274
+3  1049 6493 3647
+3  6493 3274 3647
+3  3814 8346 6494
+3  6494 898 3814
+3  929 6492 8346
+3  8346 3814 929
+3  3122 8346 6492
+3  6492 1050 3122
+3  999 6494 8346
+3  8346 3122 999
+3  1100 3524 6489
+3  712 6487 3524
+3  953 6489 6487
+3  6489 3524 6487
+3  1105 6495 6496
+3  867 4190 6495
+3  865 6496 4190
+3  6496 6495 4190
+3  865 3869 6496
+3  1088 3865 3869
+3  1105 6496 3865
+3  6496 3869 3865
+3  1102 6497 4026
+3  2104 6498 6497
+3  1105 4026 6498
+3  4026 6497 6498
+3  945 3759 8347
+3  8347 6499 945
+3  867 6495 8347
+3  8347 3759 867
+3  6498 8347 6495
+3  6495 1105 6498
+3  2104 6499 8347
+3  8347 6498 2104
+3  6485 8348 6500
+3  6500 857 6485
+3  948 4186 8348
+3  8348 6485 948
+3  6499 8348 4186
+3  4186 945 6499
+3  2104 6500 8348
+3  8348 6499 2104
+3  2104 6497 6501
+3  1102 6486 6497
+3  711 6501 6486
+3  6501 6497 6486
+3  2104 6501 6500
+3  711 3528 6501
+3  857 6500 3528
+3  6500 6501 3528
+3  1841 5659 8349
+3  8349 6502 1841
+3  6092 8349 5659
+3  5659 1810 6092
+3  5256 8349 6092
+3  6092 1809 5256
+3  1820 6502 8349
+3  8349 5256 1820
+3  2108 6503 6504
+3  1812 5258 6503
+3  1817 6504 5258
+3  6504 6503 5258
+3  1950 5662 6505
+3  1569 6387 5662
+3  1568 6505 6387
+3  6505 5662 6387
+3  1814 6506 5794
+3  2105 6507 6506
+3  1813 5794 6507
+3  5794 6506 6507
+3  1898 6508 5311
+3  2105 6506 6508
+3  1814 5311 6506
+3  5311 6508 6506
+3  1899 6509 5700
+3  2105 6508 6509
+3  1898 5700 6508
+3  5700 6509 6508
+3  1839 6510 5319
+3  2105 6509 6510
+3  1899 5319 6509
+3  5319 6510 6509
+3  1838 6511 5707
+3  2105 6510 6511
+3  1839 5707 6510
+3  5707 6511 6510
+3  1950 6512 5268
+3  2105 6511 6512
+3  1838 5268 6511
+3  5268 6512 6511
+3  1568 6513 6505
+3  2105 6512 6513
+3  1950 6505 6512
+3  6505 6513 6512
+3  2105 6514 6507
+3  2106 6515 6514
+3  1813 6507 6515
+3  6507 6514 6515
+3  1568 6516 6513
+3  2106 6514 6516
+3  2105 6513 6514
+3  6513 6516 6514
+3  1948 6517 5044
+3  2107 6518 6517
+3  1358 5044 6518
+3  5044 6517 6518
+3  1841 6502 8350
+3  8350 6520 1841
+3  1820 5709 8350
+3  8350 6502 1820
+3  6519 8350 5709
+3  5709 1819 6519
+3  2107 6520 8350
+3  8350 6519 2107
+3  1815 6521 5264
+3  2107 6519 6521
+3  1819 5264 6519
+3  5264 6521 6519
+3  6517 8351 6520
+3  6520 2107 6517
+3  1948 5416 8351
+3  8351 6517 1948
+3  1949 5946 8351
+3  8351 5416 1949
+3  5660 8351 5946
+3  5946 1840 5660
+3  6520 8351 5660
+3  5660 1841 6520
+3  1355 6522 6393
+3  2108 6523 6522
+3  1567 6393 6523
+3  6393 6522 6523
+3  6521 8352 6525
+3  6525 2107 6521
+3  1815 5688 8352
+3  8352 6521 1815
+3  1816 6524 8352
+3  8352 5688 1816
+3  6525 8352 6524
+3  6524 2108 6525
+3  1812 6503 5947
+3  2108 6524 6503
+3  1816 5947 6524
+3  5947 6503 6524
+3  2106 6516 8353
+3  8353 6526 2106
+3  1568 6390 8353
+3  8353 6516 1568
+3  6523 8353 6390
+3  6390 1567 6523
+3  6526 8353 6523
+3  6523 2108 6526
+3  6522 8354 6525
+3  6525 2108 6522
+3  1355 6484 8354
+3  8354 6522 1355
+3  1358 6518 8354
+3  8354 6484 1358
+3  6525 8354 6518
+3  6518 2107 6525
+3  1818 5260 6527
+3  1813 6515 5260
+3  2106 6527 6515
+3  6527 5260 6515
+3  1817 5683 8355
+3  8355 6504 1817
+3  1818 6527 8355
+3  8355 5683 1818
+3  6526 8355 6527
+3  6527 2106 6526
+3  6504 8355 6526
+3  6526 2108 6504
+
diff --git a/3rdparty/CGAL-4.8/examples/Mesh_3/data/liver.inr.gz b/3rdparty/CGAL/examples/Mesh_3/data/liver.inr.gz
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Mesh_3/data/liver.inr.gz
rename to 3rdparty/CGAL/examples/Mesh_3/data/liver.inr.gz
diff --git a/3rdparty/CGAL-4.8/examples/Mesh_3/data/skull_2.9.inr b/3rdparty/CGAL/examples/Mesh_3/data/skull_2.9.inr
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Mesh_3/data/skull_2.9.inr
rename to 3rdparty/CGAL/examples/Mesh_3/data/skull_2.9.inr
diff --git a/3rdparty/CGAL-4.8/examples/Mesh_3/debug.h b/3rdparty/CGAL/examples/Mesh_3/debug.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Mesh_3/debug.h
rename to 3rdparty/CGAL/examples/Mesh_3/debug.h
diff --git a/3rdparty/CGAL-4.8/examples/Mesh_3/implicit_functions.cpp b/3rdparty/CGAL/examples/Mesh_3/implicit_functions.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Mesh_3/implicit_functions.cpp
rename to 3rdparty/CGAL/examples/Mesh_3/implicit_functions.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Mesh_3/implicit_functions.h b/3rdparty/CGAL/examples/Mesh_3/implicit_functions.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Mesh_3/implicit_functions.h
rename to 3rdparty/CGAL/examples/Mesh_3/implicit_functions.h
diff --git a/3rdparty/CGAL-4.8/examples/Mesh_3/mesh_3D_gray_image.cpp b/3rdparty/CGAL/examples/Mesh_3/mesh_3D_gray_image.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Mesh_3/mesh_3D_gray_image.cpp
rename to 3rdparty/CGAL/examples/Mesh_3/mesh_3D_gray_image.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Mesh_3/mesh_3D_gray_vtk_image.cpp b/3rdparty/CGAL/examples/Mesh_3/mesh_3D_gray_vtk_image.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Mesh_3/mesh_3D_gray_vtk_image.cpp
rename to 3rdparty/CGAL/examples/Mesh_3/mesh_3D_gray_vtk_image.cpp
diff --git a/3rdparty/CGAL/examples/Mesh_3/mesh_3D_image.cpp b/3rdparty/CGAL/examples/Mesh_3/mesh_3D_image.cpp
new file mode 100644
index 0000000..8fa9d54
--- /dev/null
+++ b/3rdparty/CGAL/examples/Mesh_3/mesh_3D_image.cpp
@@ -0,0 +1,59 @@
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+
+#include <CGAL/Mesh_triangulation_3.h>
+#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
+#include <CGAL/Mesh_criteria_3.h>
+
+#include <CGAL/Labeled_image_mesh_domain_3.h>
+#include <CGAL/make_mesh_3.h>
+#include <CGAL/Image_3.h>
+
+// Domain
+typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
+typedef CGAL::Labeled_image_mesh_domain_3<CGAL::Image_3,K> Mesh_domain;
+
+#ifdef CGAL_CONCURRENT_MESH_3
+typedef CGAL::Parallel_tag Concurrency_tag;
+#else
+typedef CGAL::Sequential_tag Concurrency_tag;
+#endif
+
+// Triangulation
+typedef CGAL::Mesh_triangulation_3<Mesh_domain,CGAL::Default,Concurrency_tag>::type Tr;
+
+typedef CGAL::Mesh_complex_3_in_triangulation_3<Tr> C3t3;
+
+// Criteria
+typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;
+
+// To avoid verbose function and named parameters call
+using namespace CGAL::parameters;
+
+int main(int argc, char* argv[])
+{
+  /// [Loads image]
+  const char* fname = (argc>1)?argv[1]:"data/liver.inr.gz";
+  CGAL::Image_3 image;
+  if(!image.read(fname)){
+    std::cerr << "Error: Cannot read file " <<  fname << std::endl;
+    return EXIT_FAILURE;
+  }
+  /// [Loads image]
+
+  // Domain
+  Mesh_domain domain(image);
+
+  // Mesh criteria
+  Mesh_criteria criteria(facet_angle=30, facet_size=6, facet_distance=4,
+                         cell_radius_edge_ratio=3, cell_size=8);
+
+  /// [Meshing]
+  C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria);
+  /// [Meshing]
+
+  // Output
+  std::ofstream medit_file("out.mesh");
+  c3t3.output_to_medit(medit_file);
+
+  return 0;
+}
diff --git a/3rdparty/CGAL/examples/Mesh_3/mesh_3D_image_variable_size.cpp b/3rdparty/CGAL/examples/Mesh_3/mesh_3D_image_variable_size.cpp
new file mode 100644
index 0000000..b5b975e
--- /dev/null
+++ b/3rdparty/CGAL/examples/Mesh_3/mesh_3D_image_variable_size.cpp
@@ -0,0 +1,69 @@
+#define CGAL_MESH_3_VERBOSE
+
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+
+#include <CGAL/Mesh_triangulation_3.h>
+#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
+#include <CGAL/Mesh_criteria_3.h>
+#include <CGAL/Mesh_constant_domain_field_3.h>
+
+#include <CGAL/Labeled_image_mesh_domain_3.h>
+#include <CGAL/make_mesh_3.h>
+#include <CGAL/Image_3.h>
+
+// Domain
+typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
+typedef CGAL::Labeled_image_mesh_domain_3<CGAL::Image_3,K> Mesh_domain;
+
+#ifdef CGAL_CONCURRENT_MESH_3
+typedef CGAL::Parallel_tag Concurrency_tag;
+#else
+typedef CGAL::Sequential_tag Concurrency_tag;
+#endif
+
+// Triangulation
+typedef CGAL::Mesh_triangulation_3<Mesh_domain,CGAL::Default,Concurrency_tag>::type Tr;
+
+typedef CGAL::Mesh_complex_3_in_triangulation_3<Tr> C3t3;
+
+// Criteria
+typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;
+typedef CGAL::Mesh_constant_domain_field_3<Mesh_domain::R,
+                                           Mesh_domain::Index> Sizing_field;
+
+// To avoid verbose function and named parameters call
+using namespace CGAL::parameters;
+
+int main(int argc, char* argv[])
+{
+  const char* fname = (argc>1)?argv[1]:"data/liver.inr.gz";
+  // Loads image
+  CGAL::Image_3 image;
+  if(!image.read(fname)){
+    std::cerr << "Error: Cannot read file " <<  fname << std::endl;
+    return EXIT_FAILURE;
+  }
+
+  // Domain
+  Mesh_domain domain(image);
+
+  // Sizing field: set global size to 8 and kidney size (label 127) to 3
+  double kidney_size = 3.;
+  int volume_dimension = 3;
+  Sizing_field size(8);
+  size.set_size(kidney_size, volume_dimension, 
+                domain.index_from_subdomain_index(127));
+  
+  // Mesh criteria
+  Mesh_criteria criteria(facet_angle=30, facet_size=6, facet_distance=2,
+                         cell_radius_edge_ratio=3, cell_size=size);
+
+  // Meshing
+  C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria);
+
+  // Output
+  std::ofstream medit_file("out.mesh");
+  c3t3.output_to_medit(medit_file);
+
+  return 0;
+}
diff --git a/3rdparty/CGAL/examples/Mesh_3/mesh_3D_image_with_custom_initialization.cpp b/3rdparty/CGAL/examples/Mesh_3/mesh_3D_image_with_custom_initialization.cpp
new file mode 100644
index 0000000..9197c42
--- /dev/null
+++ b/3rdparty/CGAL/examples/Mesh_3/mesh_3D_image_with_custom_initialization.cpp
@@ -0,0 +1,64 @@
+#include "random_labeled_image.h"
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+
+#include <CGAL/Mesh_triangulation_3.h>
+#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
+#include <CGAL/Mesh_criteria_3.h>
+
+#include <CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h>
+
+#include <CGAL/Labeled_image_mesh_domain_3.h>
+#include <CGAL/make_mesh_3.h>
+#include <CGAL/Image_3.h>
+
+#include <CGAL/Mesh_3/Dump_c3t3.h>
+
+// Domain
+typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
+typedef CGAL::Labeled_image_mesh_domain_3<CGAL::Image_3,K> Mesh_domain;
+
+#ifdef CGAL_CONCURRENT_MESH_3
+typedef CGAL::Parallel_tag Concurrency_tag;
+#else
+typedef CGAL::Sequential_tag Concurrency_tag;
+#endif
+
+// Triangulation
+typedef CGAL::Mesh_triangulation_3<Mesh_domain,CGAL::Default,Concurrency_tag>::type Tr;
+
+typedef CGAL::Mesh_complex_3_in_triangulation_3<Tr> C3t3;
+
+// Criteria
+typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;
+
+// To avoid verbose function and named parameters call
+using namespace CGAL::parameters;
+
+int main()
+{
+  /// [Create the image]
+  CGAL::Image_3 image = random_labeled_image();
+  /// [Create the image]
+
+  // Domain
+  Mesh_domain domain(image);
+
+  // Mesh criteria
+  Mesh_criteria criteria(facet_angle=30, facet_size=3, facet_distance=1,
+                         cell_radius_edge_ratio=3, cell_size=3);
+
+  /// [Meshing]
+  C3t3 c3t3;
+  initialize_triangulation_from_labeled_image(c3t3,
+                                              domain,
+                                              image,
+                                              criteria,
+                                              (unsigned char)0);
+  CGAL::refine_mesh_3<C3t3>(c3t3, domain, criteria);
+  /// [Meshing]
+
+  // Output
+  CGAL::dump_c3t3(c3t3, "out");
+
+  return 0;
+}
diff --git a/3rdparty/CGAL/examples/Mesh_3/mesh_3D_image_with_features.cpp b/3rdparty/CGAL/examples/Mesh_3/mesh_3D_image_with_features.cpp
new file mode 100644
index 0000000..4292d2a
--- /dev/null
+++ b/3rdparty/CGAL/examples/Mesh_3/mesh_3D_image_with_features.cpp
@@ -0,0 +1,108 @@
+#include <vector>
+#include <iostream>
+
+#include <CGAL/Mesh_triangulation_3.h>
+#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
+#include <CGAL/Mesh_criteria_3.h>
+
+#include <CGAL/make_mesh_3.h>
+#include <CGAL/Image_3.h>
+
+/// [Domain definition]
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+#include <CGAL/Mesh_domain_with_polyline_features_3.h>
+#include <CGAL/Labeled_image_mesh_domain_3.h>
+
+typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
+typedef CGAL::Labeled_image_mesh_domain_3<CGAL::Image_3,K> Image_domain;
+typedef CGAL::Mesh_domain_with_polyline_features_3<Image_domain> Mesh_domain;
+/// [Domain definition]
+
+#ifdef CGAL_CONCURRENT_MESH_3
+typedef CGAL::Parallel_tag Concurrency_tag;
+#else
+typedef CGAL::Sequential_tag Concurrency_tag;
+#endif
+
+// Triangulation
+typedef CGAL::Mesh_triangulation_3<Mesh_domain,CGAL::Default,Concurrency_tag>::type Tr;
+
+typedef CGAL::Mesh_complex_3_in_triangulation_3<Tr> C3t3;
+
+// Criteria
+typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;
+
+// To avoid verbose function and named parameters call
+using namespace CGAL::parameters;
+
+/// [Add 1D features]
+#include "read_polylines.h"
+#include <CGAL/Mesh_3/polylines_to_protect.h> // undocumented header
+
+// Protect the intersection of the object with the box of the image,
+// by declaring 1D-features. Note that `CGAL::polylines_to_protect` is
+// not documented.
+bool add_1D_features(const CGAL::Image_3& image,
+                     Mesh_domain& domain,
+                     const char* lines_fname)
+{
+  typedef K::Point_3 Point_3;
+  typedef Mesh_domain::Image_word_type Word_type; // that is `unsigned char`
+
+  std::vector<std::vector<Point_3> > features_inside;
+  if(!read_polylines(lines_fname, features_inside)) // see file "read_polylines.h"
+  {
+    std::cerr << "Error: Cannot read file " <<  lines_fname << std::endl;
+    return false;
+  }
+
+  std::vector<std::vector<Point_3> > polylines_on_bbox;
+  CGAL::polylines_to_protect<Point_3, Word_type>(image, polylines_on_bbox,
+                                                 features_inside.begin(),
+                                                 features_inside.end());
+
+  domain.add_features(polylines_on_bbox.begin(), polylines_on_bbox.end());
+
+  // It is very important that the polylines from the file `lines_fname`
+  // contain only polylines in the inside of the box of the image.
+  domain.add_features(features_inside.begin(), features_inside.end());
+  return true;
+}
+/// [Add 1D features]
+
+int main(int argc, char* argv[])
+{
+  const char* fname = (argc>1)?argv[1]:"data/420.inr";
+  // Loads image
+  CGAL::Image_3 image;
+  if(!image.read(fname)){
+    std::cerr << "Error: Cannot read file " <<  fname << std::endl;
+    return EXIT_FAILURE;
+  }
+
+  // Domain
+  Mesh_domain domain(image);
+
+  /// Declare 1D-features, see above [Call add_1D_features]
+  const char* lines_fname = (argc>2)?argv[2]:"data/420.polylines.txt";
+
+  if(!add_1D_features(image, domain, lines_fname)) {
+    return EXIT_FAILURE;
+  }
+  /// [Call add_1D_features]
+
+  /// Note that `edge_size` is needed with 1D-features [Mesh criteria]
+  Mesh_criteria criteria(edge_size=6,
+                         facet_angle=30, facet_size=6, facet_distance=4,
+                         cell_radius_edge_ratio=3, cell_size=8);
+  /// [Mesh criteria]
+
+  // Meshing
+  C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria);
+
+  // Output
+  std::ofstream medit_file("out.mesh");
+  c3t3.output_to_medit(medit_file);
+
+  return 0;
+}
diff --git a/3rdparty/CGAL-4.8/examples/Mesh_3/mesh_cubes_intersection.cpp b/3rdparty/CGAL/examples/Mesh_3/mesh_cubes_intersection.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Mesh_3/mesh_cubes_intersection.cpp
rename to 3rdparty/CGAL/examples/Mesh_3/mesh_cubes_intersection.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Mesh_3/mesh_cubes_intersection_with_features.cpp b/3rdparty/CGAL/examples/Mesh_3/mesh_cubes_intersection_with_features.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Mesh_3/mesh_cubes_intersection_with_features.cpp
rename to 3rdparty/CGAL/examples/Mesh_3/mesh_cubes_intersection_with_features.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Mesh_3/mesh_implicit_domains.cpp b/3rdparty/CGAL/examples/Mesh_3/mesh_implicit_domains.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Mesh_3/mesh_implicit_domains.cpp
rename to 3rdparty/CGAL/examples/Mesh_3/mesh_implicit_domains.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Mesh_3/mesh_implicit_domains_2.cpp b/3rdparty/CGAL/examples/Mesh_3/mesh_implicit_domains_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Mesh_3/mesh_implicit_domains_2.cpp
rename to 3rdparty/CGAL/examples/Mesh_3/mesh_implicit_domains_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Mesh_3/mesh_implicit_ellipsoid.cpp b/3rdparty/CGAL/examples/Mesh_3/mesh_implicit_ellipsoid.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Mesh_3/mesh_implicit_ellipsoid.cpp
rename to 3rdparty/CGAL/examples/Mesh_3/mesh_implicit_ellipsoid.cpp
diff --git a/3rdparty/CGAL/examples/Mesh_3/mesh_implicit_sphere.cpp b/3rdparty/CGAL/examples/Mesh_3/mesh_implicit_sphere.cpp
new file mode 100644
index 0000000..8e3f123
--- /dev/null
+++ b/3rdparty/CGAL/examples/Mesh_3/mesh_implicit_sphere.cpp
@@ -0,0 +1,57 @@
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+
+#include <CGAL/Mesh_triangulation_3.h>
+#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
+#include <CGAL/Mesh_criteria_3.h>
+
+#include <CGAL/Implicit_mesh_domain_3.h>
+#include <CGAL/make_mesh_3.h>
+
+// Domain
+typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
+typedef K::FT FT;
+typedef K::Point_3 Point;
+typedef FT (Function)(const Point&);
+typedef CGAL::Implicit_mesh_domain_3<Function,K> Mesh_domain;
+
+#ifdef CGAL_CONCURRENT_MESH_3
+typedef CGAL::Parallel_tag Concurrency_tag;
+#else
+typedef CGAL::Sequential_tag Concurrency_tag;
+#endif
+
+// Triangulation
+typedef CGAL::Mesh_triangulation_3<Mesh_domain,CGAL::Default,Concurrency_tag>::type Tr;
+
+typedef CGAL::Mesh_complex_3_in_triangulation_3<Tr> C3t3;
+
+// Criteria
+typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;
+
+// To avoid verbose function and named parameters call
+using namespace CGAL::parameters;
+
+// Function
+FT sphere_function (const Point& p)
+{ return CGAL::squared_distance(p, Point(CGAL::ORIGIN))-1; }
+
+int main()
+{
+  // Domain (Warning: Sphere_3 constructor uses squared radius !)
+  Mesh_domain domain(sphere_function,
+                     K::Sphere_3(CGAL::ORIGIN, 2.));
+
+  // Mesh criteria
+  Mesh_criteria criteria(facet_angle=30, facet_size=0.1, facet_distance=0.025,
+                         cell_radius_edge_ratio=2, cell_size=0.1);
+  
+  // Mesh generation
+  C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria);
+
+  // Output
+  std::ofstream medit_file("out.mesh");
+  c3t3.output_to_medit(medit_file);
+
+  return 0;
+}
+
diff --git a/3rdparty/CGAL/examples/Mesh_3/mesh_implicit_sphere_variable_size.cpp b/3rdparty/CGAL/examples/Mesh_3/mesh_implicit_sphere_variable_size.cpp
new file mode 100644
index 0000000..42547d8
--- /dev/null
+++ b/3rdparty/CGAL/examples/Mesh_3/mesh_implicit_sphere_variable_size.cpp
@@ -0,0 +1,72 @@
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+
+#include <CGAL/Mesh_triangulation_3.h>
+#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
+#include <CGAL/Mesh_criteria_3.h>
+
+#include <CGAL/Implicit_mesh_domain_3.h>
+#include <CGAL/make_mesh_3.h>
+
+// Domain
+typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
+typedef K::FT FT;
+typedef K::Point_3 Point;
+typedef FT (Function)(const Point&);
+typedef CGAL::Implicit_mesh_domain_3<Function,K> Mesh_domain;
+
+#ifdef CGAL_CONCURRENT_MESH_3
+typedef CGAL::Parallel_tag Concurrency_tag;
+#else
+typedef CGAL::Sequential_tag Concurrency_tag;
+#endif
+
+// Triangulation
+typedef CGAL::Mesh_triangulation_3<Mesh_domain,CGAL::Default,Concurrency_tag>::type Tr;
+
+typedef CGAL::Mesh_complex_3_in_triangulation_3<Tr> C3t3;
+
+// Criteria
+typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;
+
+// Sizing field
+struct Spherical_sizing_field
+{
+  typedef ::FT FT;
+  typedef Point Point_3;
+  typedef Mesh_domain::Index Index;
+  
+  FT operator()(const Point_3& p, const int, const Index&) const
+  {
+    FT sq_d_to_origin = CGAL::squared_distance(p, Point(CGAL::ORIGIN));
+    return CGAL::abs( CGAL::sqrt(sq_d_to_origin)-0.5 ) / 5. + 0.025; 
+  }
+};
+
+// To avoid verbose function and named parameters call
+using namespace CGAL::parameters;
+
+// Function
+FT sphere_function (const Point& p)
+{ return CGAL::squared_distance(p, Point(CGAL::ORIGIN))-1; }
+
+int main()
+{
+  // Domain (Warning: Sphere_3 constructor uses squared radius !)
+  Mesh_domain domain(sphere_function,
+                     K::Sphere_3(CGAL::ORIGIN, 2.));
+
+  // Mesh criteria
+  Spherical_sizing_field size;
+  Mesh_criteria criteria(facet_angle=30, facet_size=0.1, facet_distance=0.025,
+                         cell_radius_edge_ratio=2, cell_size=size);
+  
+  // Mesh generation
+  C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria, no_exude(), no_perturb());
+
+  // Output
+  std::ofstream medit_file("out.mesh");
+  c3t3.output_to_medit(medit_file);
+
+  return 0;
+}
+
diff --git a/3rdparty/CGAL/examples/Mesh_3/mesh_optimization_example.cpp b/3rdparty/CGAL/examples/Mesh_3/mesh_optimization_example.cpp
new file mode 100644
index 0000000..ad6a215
--- /dev/null
+++ b/3rdparty/CGAL/examples/Mesh_3/mesh_optimization_example.cpp
@@ -0,0 +1,68 @@
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+
+#include <CGAL/Mesh_triangulation_3.h>
+#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
+#include <CGAL/Mesh_criteria_3.h>
+
+#include <CGAL/Labeled_image_mesh_domain_3.h>
+#include <CGAL/make_mesh_3.h>
+#include <CGAL/Image_3.h>
+
+// Domain
+typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
+typedef CGAL::Labeled_image_mesh_domain_3<CGAL::Image_3,K> Mesh_domain;
+
+#ifdef CGAL_CONCURRENT_MESH_3
+typedef CGAL::Parallel_tag Concurrency_tag;
+#else
+typedef CGAL::Sequential_tag Concurrency_tag;
+#endif
+
+// Triangulation
+typedef CGAL::Mesh_triangulation_3<Mesh_domain,CGAL::Default,Concurrency_tag>::type Tr;
+
+typedef CGAL::Mesh_complex_3_in_triangulation_3<Tr> C3t3;
+
+// Mesh Criteria
+typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;
+
+// To avoid verbose function and named parameters call
+using namespace CGAL::parameters;
+
+int main(int argc, char* argv[])
+{
+  const char* fname = (argc>1)?argv[1]:"data/liver.inr.gz";
+  // Domain
+  CGAL::Image_3 image;
+  if(!image.read(fname)){
+    std::cerr << "Error: Cannot read file " <<  fname << std::endl;
+    return EXIT_FAILURE;
+  }
+
+  Mesh_domain domain(image);
+
+  // Mesh criteria
+  Mesh_criteria criteria(facet_angle=30, facet_size=5, facet_distance=1.5,
+                         cell_radius_edge_ratio=2, cell_size=7);
+
+  // Mesh generation and optimization in one call (sliver_bound is the
+  // targeted dihedral angle in degree)
+  C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria,
+                                      no_exude(),
+                                      perturb(sliver_bound=10, time_limit=15));
+  
+  // Mesh generation and optimization in several call
+  C3t3 c3t3_bis = CGAL::make_mesh_3<C3t3>(domain, criteria,
+                                          no_perturb(), no_exude());
+  
+  CGAL::perturb_mesh_3(c3t3_bis, domain, time_limit=15);
+
+  // Output
+  std::ofstream medit_file("out.mesh");
+  c3t3.output_to_medit(medit_file);
+  
+  std::ofstream medit_file_bis("out_bis.mesh");
+  c3t3_bis.output_to_medit(medit_file_bis);
+
+  return 0;
+}
diff --git a/3rdparty/CGAL/examples/Mesh_3/mesh_optimization_lloyd_example.cpp b/3rdparty/CGAL/examples/Mesh_3/mesh_optimization_lloyd_example.cpp
new file mode 100644
index 0000000..2f00593
--- /dev/null
+++ b/3rdparty/CGAL/examples/Mesh_3/mesh_optimization_lloyd_example.cpp
@@ -0,0 +1,68 @@
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+
+#include <CGAL/Mesh_triangulation_3.h>
+#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
+#include <CGAL/Mesh_criteria_3.h>
+
+#include <CGAL/Labeled_image_mesh_domain_3.h>
+#include <CGAL/make_mesh_3.h>
+#include <CGAL/Image_3.h>
+
+// Domain
+typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
+typedef CGAL::Labeled_image_mesh_domain_3<CGAL::Image_3,K> Mesh_domain;
+
+#ifdef CGAL_CONCURRENT_MESH_3
+typedef CGAL::Parallel_tag Concurrency_tag;
+#else
+typedef CGAL::Sequential_tag Concurrency_tag;
+#endif
+
+// Triangulation
+typedef CGAL::Mesh_triangulation_3<Mesh_domain,CGAL::Default,Concurrency_tag>::type Tr;
+
+typedef CGAL::Mesh_complex_3_in_triangulation_3<Tr> C3t3;
+
+// Mesh Criteria
+typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;
+
+// To avoid verbose function and named parameters call
+using namespace CGAL::parameters;
+
+int main(int argc, char*argv[])
+{
+  const char* fname = (argc>1)?argv[1]:"data/liver.inr.gz";
+  // Domain
+  CGAL::Image_3 image;
+  if(!image.read(fname)){
+    std::cerr << "Error: Cannot read file " <<  fname << std::endl;
+    return EXIT_FAILURE;
+  }
+  Mesh_domain domain(image);
+
+  // Mesh criteria
+  Mesh_criteria criteria(facet_angle=30, facet_distance=1.2,
+                         cell_radius_edge_ratio=2);
+
+  // Mesh generation and optimization in one call
+  C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria,
+                                      lloyd(time_limit=30),
+                                      no_perturb(),
+                                      exude(time_limit=10, sliver_bound=10));
+  
+  // Mesh generation and optimization in several call
+  C3t3 c3t3_bis = CGAL::make_mesh_3<C3t3>(domain, criteria,
+                                          no_perturb(), no_exude());
+  
+  CGAL::lloyd_optimize_mesh_3(c3t3_bis, domain, time_limit=30);
+  CGAL::exude_mesh_3(c3t3_bis, sliver_bound=10, time_limit=10);
+  
+  // Output
+  std::ofstream medit_file("out.mesh");
+  c3t3.output_to_medit(medit_file);
+  
+  std::ofstream medit_file_bis("out_bis.mesh");
+  c3t3_bis.output_to_medit(medit_file_bis);
+
+  return 0;
+}
diff --git a/3rdparty/CGAL/examples/Mesh_3/mesh_polyhedral_domain.cpp b/3rdparty/CGAL/examples/Mesh_3/mesh_polyhedral_domain.cpp
new file mode 100644
index 0000000..f0afd58
--- /dev/null
+++ b/3rdparty/CGAL/examples/Mesh_3/mesh_polyhedral_domain.cpp
@@ -0,0 +1,75 @@
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+
+#include <CGAL/Mesh_triangulation_3.h>
+#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
+#include <CGAL/Mesh_criteria_3.h>
+
+#include <CGAL/Polyhedral_mesh_domain_3.h>
+#include <CGAL/make_mesh_3.h>
+#include <CGAL/refine_mesh_3.h>
+
+// IO
+#include <CGAL/IO/Polyhedron_iostream.h>
+
+// Domain
+typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
+typedef CGAL::Polyhedron_3<K> Polyhedron;
+typedef CGAL::Polyhedral_mesh_domain_3<Polyhedron, K> Mesh_domain;
+
+#ifdef CGAL_CONCURRENT_MESH_3
+typedef CGAL::Parallel_tag Concurrency_tag;
+#else
+typedef CGAL::Sequential_tag Concurrency_tag;
+#endif
+
+// Triangulation
+typedef CGAL::Mesh_triangulation_3<Mesh_domain,CGAL::Default,Concurrency_tag>::type Tr;
+
+typedef CGAL::Mesh_complex_3_in_triangulation_3<Tr> C3t3;
+
+// Criteria
+typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;
+
+// To avoid verbose function and named parameters call
+using namespace CGAL::parameters;
+
+int main(int argc, char*argv[])
+{
+  const char* fname = (argc>1)?argv[1]:"data/elephant.off";
+  // Create input polyhedron
+  Polyhedron polyhedron;
+  std::ifstream input(fname);
+  input >> polyhedron;
+  if(input.bad()){
+    std::cerr << "Error: Cannot read file " <<  fname << std::endl;
+    return EXIT_FAILURE;
+  }
+  input.close();
+   
+  // Create domain
+  Mesh_domain domain(polyhedron);
+  
+  // Mesh criteria (no cell_size set)
+  Mesh_criteria criteria(facet_angle=25, facet_size=0.15, facet_distance=0.008,
+                         cell_radius_edge_ratio=3);
+  
+  // Mesh generation
+  C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria, no_perturb(), no_exude());
+
+  // Output
+  std::ofstream medit_file("out_1.mesh");
+  c3t3.output_to_medit(medit_file);
+  medit_file.close();
+
+  // Set tetrahedron size (keep cell_radius_edge_ratio), ignore facets
+  Mesh_criteria new_criteria(cell_radius_edge_ratio=3, cell_size=0.03);
+
+  // Mesh refinement
+  CGAL::refine_mesh_3(c3t3, domain, new_criteria);
+
+  // Output
+  medit_file.open("out_2.mesh");
+  c3t3.output_to_medit(medit_file);
+
+  return 0;
+}
diff --git a/3rdparty/CGAL/examples/Mesh_3/mesh_polyhedral_domain_with_features.cpp b/3rdparty/CGAL/examples/Mesh_3/mesh_polyhedral_domain_with_features.cpp
new file mode 100644
index 0000000..916a4d6
--- /dev/null
+++ b/3rdparty/CGAL/examples/Mesh_3/mesh_polyhedral_domain_with_features.cpp
@@ -0,0 +1,52 @@
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+
+#include <CGAL/Mesh_triangulation_3.h>
+#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
+#include <CGAL/Mesh_criteria_3.h>
+
+#include <CGAL/Polyhedral_mesh_domain_with_features_3.h>
+#include <CGAL/make_mesh_3.h>
+
+// Domain 
+typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
+typedef CGAL::Polyhedral_mesh_domain_with_features_3<K> Mesh_domain;
+
+#ifdef CGAL_CONCURRENT_MESH_3
+typedef CGAL::Parallel_tag Concurrency_tag;
+#else
+typedef CGAL::Sequential_tag Concurrency_tag;
+#endif
+
+// Triangulation
+typedef CGAL::Mesh_triangulation_3<Mesh_domain,CGAL::Default,Concurrency_tag>::type Tr;
+
+typedef CGAL::Mesh_complex_3_in_triangulation_3<
+  Tr,Mesh_domain::Corner_index,Mesh_domain::Curve_segment_index> C3t3;
+
+// Criteria
+typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;
+
+// To avoid verbose function and named parameters call
+using namespace CGAL::parameters;
+
+int main(int argc, char*argv[])
+{
+  const char* fname = (argc>1)?argv[1]:"data/fandisk.off";
+  // Create domain
+  Mesh_domain domain(fname);
+  
+  // Get sharp features
+  domain.detect_features();
+
+  // Mesh criteria
+  Mesh_criteria criteria(edge_size = 0.025,
+                         facet_angle = 25, facet_size = 0.05, facet_distance = 0.005,
+                         cell_radius_edge_ratio = 3, cell_size = 0.05);
+  
+  // Mesh generation
+  C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria);
+
+  // Output
+  std::ofstream medit_file("out.mesh");
+  c3t3.output_to_medit(medit_file);
+}
diff --git a/3rdparty/CGAL/examples/Mesh_3/mesh_two_implicit_spheres_with_balls.cpp b/3rdparty/CGAL/examples/Mesh_3/mesh_two_implicit_spheres_with_balls.cpp
new file mode 100644
index 0000000..36d914f
--- /dev/null
+++ b/3rdparty/CGAL/examples/Mesh_3/mesh_two_implicit_spheres_with_balls.cpp
@@ -0,0 +1,103 @@
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+
+#include <CGAL/Mesh_triangulation_3.h>
+#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
+#include <CGAL/Mesh_criteria_3.h>
+
+#include <CGAL/Implicit_mesh_domain_3.h>
+#include <CGAL/Mesh_domain_with_polyline_features_3.h>
+#include <CGAL/make_mesh_3.h>
+
+// Kernel
+typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
+
+// Domain
+typedef K::FT FT;
+typedef K::Point_3 Point;
+typedef FT (Function)(const Point&);
+typedef CGAL::Mesh_domain_with_polyline_features_3<
+  CGAL::Implicit_mesh_domain_3<Function,K> >              Mesh_domain;
+
+// Polyline
+typedef std::vector<Point>        Polyline_3;
+typedef std::list<Polyline_3>       Polylines;
+
+#ifdef CGAL_CONCURRENT_MESH_3
+typedef CGAL::Parallel_tag Concurrency_tag;
+#else
+typedef CGAL::Sequential_tag Concurrency_tag;
+#endif
+
+// Triangulation
+typedef CGAL::Mesh_triangulation_3<Mesh_domain,CGAL::Default,Concurrency_tag>::type Tr;
+
+typedef CGAL::Mesh_complex_3_in_triangulation_3<
+  Tr,Mesh_domain::Corner_index,Mesh_domain::Curve_segment_index> C3t3;
+
+// Criteria
+typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;
+
+// To avoid verbose function and named parameters call
+using namespace CGAL::parameters;
+
+// Function
+FT sphere_function1 (const Point& p)
+{ return CGAL::squared_distance(p, Point(CGAL::ORIGIN))-2; }
+
+FT sphere_function2 (const Point& p)
+{ return CGAL::squared_distance(p, Point(2, 0, 0))-2; }
+
+FT sphere_function (const Point& p)
+{
+  if(sphere_function1(p) < 0 || sphere_function2(p) < 0)
+    return -1;
+  else 
+    return 1;
+}
+
+#include <cmath>
+
+int main()
+{
+  // Domain (Warning: Sphere_3 constructor uses squared radius !)
+  Mesh_domain domain(sphere_function,
+                     K::Sphere_3(Point(1, 0, 0), 6.));
+
+  // Mesh criteria
+  Mesh_criteria criteria(edge_size = 0.15,
+                         facet_angle = 25, facet_size = 0.15,
+                         cell_radius_edge_ratio = 2, cell_size = 0.15);
+  
+  // Create edge that we want to preserve
+  Polylines polylines (1);
+  Polyline_3& polyline = polylines.front();
+  
+  for(int i = 0; i < 360; ++i)
+  {
+    Point p (1, std::cos(i*CGAL_PI/180), std::sin(i*CGAL_PI/180));
+    polyline.push_back(p);
+  }
+  polyline.push_back(polyline.front()); // close the line
+
+  // Insert edge in domain
+  domain.add_features(polylines.begin(), polylines.end());
+  
+  // Mesh generation without feature preservation
+  C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria,
+                                      CGAL::parameters::no_features());
+
+  std::ofstream medit_file("out-no-protection.mesh");
+  c3t3.output_to_medit(medit_file);
+  medit_file.close();
+  c3t3.clear();
+
+  // Mesh generation with feature preservation
+  c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria);
+  
+  // Output
+  medit_file.open("out-with-protection.mesh");
+  c3t3.output_to_medit(medit_file);
+  medit_file.close();
+
+  return 0;
+}
diff --git a/3rdparty/CGAL/examples/Mesh_3/random_labeled_image.h b/3rdparty/CGAL/examples/Mesh_3/random_labeled_image.h
new file mode 100644
index 0000000..8d03d46
--- /dev/null
+++ b/3rdparty/CGAL/examples/Mesh_3/random_labeled_image.h
@@ -0,0 +1,53 @@
+#include <CGAL/Image_3.h>
+#include <CGAL/Random.h>
+#include <algorithm>
+
+CGAL::Image_3 random_labeled_image()
+{
+  const int dim = 400;
+  const unsigned char number_of_spheres = 50;
+  const int max_radius_of_spheres = 10;
+  const int radius_of_big_sphere = 80;
+  _image* image = _createImage(dim, dim, dim, 1,
+                               1.f, 1.f, 1.f, 1,
+                               WK_FIXED, SGN_UNSIGNED);
+  unsigned char* ptr = (unsigned char*)(image->data);
+  std::fill(ptr, ptr+dim*dim*dim, '\0');
+
+  std::ptrdiff_t center = dim / 2;
+  CGAL::Random rand(0);
+  for(unsigned char n = number_of_spheres; n > 0 ; --n) {
+    std::size_t i, j, k;
+    do {
+      i = rand.uniform_smallint(1 + max_radius_of_spheres,
+                                dim-2 - max_radius_of_spheres);
+      j = rand.uniform_smallint(1 + max_radius_of_spheres,
+                                dim-2 - max_radius_of_spheres);
+      k = rand.uniform_smallint(1 + max_radius_of_spheres,
+                                dim-2 - max_radius_of_spheres);
+    } while ( ( CGAL::square(double(center) - double(i)) +
+                CGAL::square(double(center) - double(j)) +
+                CGAL::square(double(center) - double(k)) )
+              <
+              CGAL::square(double(radius_of_big_sphere) + 4 * max_radius_of_spheres) );
+    std::ptrdiff_t radius = max_radius_of_spheres;
+    if(n==1) {
+      i = j = k = center;
+      radius = radius_of_big_sphere;
+    }
+    for(std::ptrdiff_t ii = - radius; ii <= radius; ++ii)
+    {
+      for(std::ptrdiff_t jj = - radius; jj <= radius; ++jj)
+      {
+        for(std::ptrdiff_t kk = - radius; kk <= radius; ++kk)
+        {
+          if(ii*ii + jj*jj + kk*kk > radius * radius) continue;
+          using CGAL::IMAGEIO::static_evaluate;
+          static_evaluate<unsigned char>(image, i+ii, j+jj, k+kk) = n;
+        }
+      }
+    }
+  }
+  _writeImage(image, "random-image.inr");
+  return CGAL::Image_3(image);
+}
diff --git a/3rdparty/CGAL/examples/Mesh_3/read_polylines.h b/3rdparty/CGAL/examples/Mesh_3/read_polylines.h
new file mode 100644
index 0000000..54d1203
--- /dev/null
+++ b/3rdparty/CGAL/examples/Mesh_3/read_polylines.h
@@ -0,0 +1,29 @@
+#ifndef READ_POLYLINES_H
+#define READ_POLYLINES_H
+
+#include <cstddef>
+#include <vector>
+#include <fstream>
+
+template <typename Point_3>
+bool read_polylines(const char* fname,
+                    std::vector<std::vector<Point_3> >& polylines)
+{
+  std::ifstream ifs(fname);
+  if(ifs.bad()) return false;
+  std::size_t n;
+  while(ifs >> n) {
+    polylines.resize(polylines.size()+1);
+    std::vector<Point_3>& polyline = polylines.back();
+    while(n-- != 0) {
+      Point_3 p;
+      ifs >> p;
+      if(ifs.fail()) return false;
+      polyline.push_back(p);
+    }
+  }
+  if(ifs.bad()) return false;
+  else return ifs.eof();
+}
+
+#endif // READ_POLYLINES_H
diff --git a/3rdparty/CGAL/examples/Mesh_3/remesh_polyhedral_surface.cpp b/3rdparty/CGAL/examples/Mesh_3/remesh_polyhedral_surface.cpp
new file mode 100644
index 0000000..4f78665
--- /dev/null
+++ b/3rdparty/CGAL/examples/Mesh_3/remesh_polyhedral_surface.cpp
@@ -0,0 +1,60 @@
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+
+#include <CGAL/Mesh_triangulation_3.h>
+#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
+#include <CGAL/Mesh_criteria_3.h>
+
+#include <CGAL/Polyhedral_mesh_domain_with_features_3.h>
+#include <CGAL/make_mesh_3.h>
+
+// Domain 
+typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
+typedef CGAL::Polyhedral_mesh_domain_with_features_3<K> Mesh_domain;
+
+// Polyhedron type
+typedef CGAL::Mesh_polyhedron_3<K>::type Polyhedron;
+
+// Triangulation
+typedef CGAL::Mesh_triangulation_3<Mesh_domain>::type Tr;
+typedef CGAL::Mesh_complex_3_in_triangulation_3<
+  Tr,Mesh_domain::Corner_index,Mesh_domain::Curve_segment_index> C3t3;
+
+// Criteria
+typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;
+
+// To avoid verbose function and named parameters call
+using namespace CGAL::parameters;
+
+int main()
+{
+  // Load a polyhedron
+  Polyhedron poly;
+  std::ifstream input("data/lion-head.off");
+  input >> poly;
+  // Create a vector with only one element: the pointer to the polyhedron.
+  std::vector<Polyhedron*> poly_ptrs_vector(1, &poly);
+
+  // Create a polyhedral domain, with only one polyhedron,
+  // and no "bounding polyhedron", so the volumetric part of the domain will be
+  // empty.
+  Mesh_domain domain(poly_ptrs_vector.begin(), poly_ptrs_vector.end());
+  
+  // Get sharp features
+  domain.detect_features(); //includes detection of borders
+
+  // Mesh criteria
+  Mesh_criteria criteria(edge_size = 0.025,
+                         facet_angle = 25,
+                         facet_size = 0.1,
+                         facet_distance = 0.001);
+  
+  // Mesh generation
+  C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria, no_perturb(), no_exude());
+
+  // Output the facets of the c3t3 to an OFF file. The facets will not be
+  // oriented.
+  std::ofstream off_file("out.off");
+  c3t3.output_boundary_to_off(off_file);
+
+  return off_file.bad() ? EXIT_FAILURE : EXIT_SUCCESS;
+}
diff --git a/3rdparty/CGAL-4.8/examples/Min_annulus_d/CMakeLists.txt b/3rdparty/CGAL/examples/Min_annulus_d/CMakeLists.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Min_annulus_d/CMakeLists.txt
rename to 3rdparty/CGAL/examples/Min_annulus_d/CMakeLists.txt
diff --git a/3rdparty/CGAL/examples/Min_annulus_d/min_annulus_d.cpp b/3rdparty/CGAL/examples/Min_annulus_d/min_annulus_d.cpp
new file mode 100644
index 0000000..d02136e
--- /dev/null
+++ b/3rdparty/CGAL/examples/Min_annulus_d/min_annulus_d.cpp
@@ -0,0 +1,56 @@
+// computes the smallest enclosing annulus of two point
+// sets on nested squares in R^2, using double
+// as input type and some internal EXACT floating point type
+#include <CGAL/Min_annulus_d.h>
+#include <CGAL/Min_sphere_annulus_d_traits_2.h>
+#include <CGAL/Homogeneous.h>
+#include <iostream>
+#include <cassert>
+
+#ifdef CGAL_USE_GMP
+#include <CGAL/Gmpzf.h>
+typedef CGAL::Gmpzf ET;
+#else
+#include <CGAL/MP_Float.h>
+typedef CGAL::MP_Float ET;
+#endif
+
+// use an EXACT kernel...
+typedef CGAL::Homogeneous<ET>                  K;
+typedef K::Point_2                             Point;
+// ...and the traits class based on the exact kernel
+typedef CGAL::Min_sphere_annulus_d_traits_2<K> Traits;
+typedef CGAL::Min_annulus_d<Traits>            Min_annulus;
+
+int main()
+{
+  // points on the squares [-1,1]^2 and [-2,2]^2
+  Point P[8] = { Point(-1,-1), Point(-1,1), Point(1,-1), Point(1,1),
+                 Point(-2,-2), Point(-2,2), Point(2,-2), Point(2,2)};
+
+  Min_annulus ma(P, P+8);
+  assert (ma.is_valid());
+
+  // get center of annulus
+  Min_annulus::Coordinate_iterator coord_it;
+
+  std::cout << "center:"; // homogeneous point, (0,0,1)
+  for (coord_it = ma.center_coordinates_begin();
+       coord_it != ma.center_coordinates_end();
+       ++coord_it)
+    std::cout << " " << *coord_it;
+  std::cout << std::endl;
+
+  // get inner squared radius, 1^2+1^2 = 2
+  std::cout << "Inner squared radius: " <<
+    CGAL::to_double(ma.squared_inner_radius_numerator()) /
+    CGAL::to_double(ma.squared_radii_denominator()) << std::endl;
+
+  // get outer squared radius, 2^2+2^2 = 8
+  std::cout << "Outer squared radius: " <<
+    CGAL::to_double(ma.squared_outer_radius_numerator()) /
+    CGAL::to_double(ma.squared_radii_denominator()) << std::endl;
+
+  return 0;
+
+}
diff --git a/3rdparty/CGAL/examples/Min_annulus_d/min_annulus_d_fast_exact.cpp b/3rdparty/CGAL/examples/Min_annulus_d/min_annulus_d_fast_exact.cpp
new file mode 100644
index 0000000..07bb660
--- /dev/null
+++ b/3rdparty/CGAL/examples/Min_annulus_d/min_annulus_d_fast_exact.cpp
@@ -0,0 +1,55 @@
+// computes the smallest enclosing annulus of two point
+// sets on nested squares in R^2,  using double
+// as input type and some internal EXACT floating point type;
+// the fast type double is also safely used for many of the
+// internal computations
+#include <CGAL/Min_annulus_d.h>
+#include <CGAL/Min_sphere_annulus_d_traits_2.h>
+#include <CGAL/Homogeneous.h>
+#include <CGAL/Exact_integer.h>
+typedef CGAL::Exact_integer ET;
+
+#include <iostream>
+#include <cassert>
+
+// use an inexact kernel...
+typedef CGAL::Homogeneous<double>                          K;
+typedef K::Point_2                                         Point;
+// ... and the EXACT traits class based on the inexcat kernel
+typedef CGAL::Min_sphere_annulus_d_traits_2<K, ET, double> Traits;
+typedef CGAL::Min_annulus_d<Traits>                        Min_annulus;
+
+
+
+int main()
+{
+  // points on the squares [-1,1]^2 and [-2,2]^2
+  Point P[8] = { Point(-1,-1), Point(-1,1), Point(1,-1), Point(1,1),
+                 Point(-2,-2), Point(-2,2), Point(2,-2), Point(2,2)};
+
+  Min_annulus ma(P, P+8);
+  assert (ma.is_valid());
+
+  // get center of annulus
+  Min_annulus::Coordinate_iterator coord_it;
+
+  std::cout << "center:"; // homogeneous point, (0,0,1)
+  for (coord_it = ma.center_coordinates_begin();
+       coord_it != ma.center_coordinates_end();
+       ++coord_it)
+    std::cout << " " << CGAL::to_double(*coord_it);
+  std::cout << std::endl;
+
+  // get inner squared radius, 1^2+1^2 = 2
+  std::cout << "Inner squared radius: " <<
+    CGAL::to_double(ma.squared_inner_radius_numerator()) /
+    CGAL::to_double(ma.squared_radii_denominator()) << std::endl;
+
+  // get outer squared radius, 2^2+2^2 = 8
+  std::cout << "Outer squared radius: " <<
+    CGAL::to_double(ma.squared_outer_radius_numerator()) /
+    CGAL::to_double(ma.squared_radii_denominator()) << std::endl;
+
+  return 0;
+
+}
diff --git a/3rdparty/CGAL-4.8/examples/Min_circle_2/CMakeLists.txt b/3rdparty/CGAL/examples/Min_circle_2/CMakeLists.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Min_circle_2/CMakeLists.txt
rename to 3rdparty/CGAL/examples/Min_circle_2/CMakeLists.txt
diff --git a/3rdparty/CGAL-4.8/examples/Min_circle_2/min_circle_2.cpp b/3rdparty/CGAL/examples/Min_circle_2/min_circle_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Min_circle_2/min_circle_2.cpp
rename to 3rdparty/CGAL/examples/Min_circle_2/min_circle_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Min_ellipse_2/CMakeLists.txt b/3rdparty/CGAL/examples/Min_ellipse_2/CMakeLists.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Min_ellipse_2/CMakeLists.txt
rename to 3rdparty/CGAL/examples/Min_ellipse_2/CMakeLists.txt
diff --git a/3rdparty/CGAL-4.8/examples/Min_ellipse_2/min_ellipse_2.cpp b/3rdparty/CGAL/examples/Min_ellipse_2/min_ellipse_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Min_ellipse_2/min_ellipse_2.cpp
rename to 3rdparty/CGAL/examples/Min_ellipse_2/min_ellipse_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Min_quadrilateral_2/CMakeLists.txt b/3rdparty/CGAL/examples/Min_quadrilateral_2/CMakeLists.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Min_quadrilateral_2/CMakeLists.txt
rename to 3rdparty/CGAL/examples/Min_quadrilateral_2/CMakeLists.txt
diff --git a/3rdparty/CGAL-4.8/examples/Min_quadrilateral_2/minimum_enclosing_parallelogram_2.cpp b/3rdparty/CGAL/examples/Min_quadrilateral_2/minimum_enclosing_parallelogram_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Min_quadrilateral_2/minimum_enclosing_parallelogram_2.cpp
rename to 3rdparty/CGAL/examples/Min_quadrilateral_2/minimum_enclosing_parallelogram_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Min_quadrilateral_2/minimum_enclosing_rectangle_2.cpp b/3rdparty/CGAL/examples/Min_quadrilateral_2/minimum_enclosing_rectangle_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Min_quadrilateral_2/minimum_enclosing_rectangle_2.cpp
rename to 3rdparty/CGAL/examples/Min_quadrilateral_2/minimum_enclosing_rectangle_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Min_quadrilateral_2/minimum_enclosing_strip_2.cpp b/3rdparty/CGAL/examples/Min_quadrilateral_2/minimum_enclosing_strip_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Min_quadrilateral_2/minimum_enclosing_strip_2.cpp
rename to 3rdparty/CGAL/examples/Min_quadrilateral_2/minimum_enclosing_strip_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Min_sphere_d/CMakeLists.txt b/3rdparty/CGAL/examples/Min_sphere_d/CMakeLists.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Min_sphere_d/CMakeLists.txt
rename to 3rdparty/CGAL/examples/Min_sphere_d/CMakeLists.txt
diff --git a/3rdparty/CGAL-4.8/examples/Min_sphere_d/min_sphere_d.cpp b/3rdparty/CGAL/examples/Min_sphere_d/min_sphere_d.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Min_sphere_d/min_sphere_d.cpp
rename to 3rdparty/CGAL/examples/Min_sphere_d/min_sphere_d.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Min_sphere_of_spheres_d/CMakeLists.txt b/3rdparty/CGAL/examples/Min_sphere_of_spheres_d/CMakeLists.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Min_sphere_of_spheres_d/CMakeLists.txt
rename to 3rdparty/CGAL/examples/Min_sphere_of_spheres_d/CMakeLists.txt
diff --git a/3rdparty/CGAL-4.8/examples/Min_sphere_of_spheres_d/benchmark.cpp b/3rdparty/CGAL/examples/Min_sphere_of_spheres_d/benchmark.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Min_sphere_of_spheres_d/benchmark.cpp
rename to 3rdparty/CGAL/examples/Min_sphere_of_spheres_d/benchmark.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Min_sphere_of_spheres_d/min_sphere_of_spheres_d_2.cpp b/3rdparty/CGAL/examples/Min_sphere_of_spheres_d/min_sphere_of_spheres_d_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Min_sphere_of_spheres_d/min_sphere_of_spheres_d_2.cpp
rename to 3rdparty/CGAL/examples/Min_sphere_of_spheres_d/min_sphere_of_spheres_d_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Min_sphere_of_spheres_d/min_sphere_of_spheres_d_3.cpp b/3rdparty/CGAL/examples/Min_sphere_of_spheres_d/min_sphere_of_spheres_d_3.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Min_sphere_of_spheres_d/min_sphere_of_spheres_d_3.cpp
rename to 3rdparty/CGAL/examples/Min_sphere_of_spheres_d/min_sphere_of_spheres_d_3.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Min_sphere_of_spheres_d/min_sphere_of_spheres_d_d.cpp b/3rdparty/CGAL/examples/Min_sphere_of_spheres_d/min_sphere_of_spheres_d_d.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Min_sphere_of_spheres_d/min_sphere_of_spheres_d_d.cpp
rename to 3rdparty/CGAL/examples/Min_sphere_of_spheres_d/min_sphere_of_spheres_d_d.cpp
diff --git a/3rdparty/CGAL/examples/Minkowski_sum_2/CMakeLists.txt b/3rdparty/CGAL/examples/Minkowski_sum_2/CMakeLists.txt
new file mode 100644
index 0000000..3e4284c
--- /dev/null
+++ b/3rdparty/CGAL/examples/Minkowski_sum_2/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Minkowski_sum_2_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET COMPONENTS Core )
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Minkowski_sum_2/approx_inset.cpp b/3rdparty/CGAL/examples/Minkowski_sum_2/approx_inset.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Minkowski_sum_2/approx_inset.cpp
rename to 3rdparty/CGAL/examples/Minkowski_sum_2/approx_inset.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Minkowski_sum_2/approx_offset.cpp b/3rdparty/CGAL/examples/Minkowski_sum_2/approx_offset.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Minkowski_sum_2/approx_offset.cpp
rename to 3rdparty/CGAL/examples/Minkowski_sum_2/approx_offset.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Minkowski_sum_2/arr_conics.h b/3rdparty/CGAL/examples/Minkowski_sum_2/arr_conics.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Minkowski_sum_2/arr_conics.h
rename to 3rdparty/CGAL/examples/Minkowski_sum_2/arr_conics.h
diff --git a/3rdparty/CGAL-4.8/examples/Minkowski_sum_2/bops_circular.h b/3rdparty/CGAL/examples/Minkowski_sum_2/bops_circular.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Minkowski_sum_2/bops_circular.h
rename to 3rdparty/CGAL/examples/Minkowski_sum_2/bops_circular.h
diff --git a/3rdparty/CGAL-4.8/examples/Minkowski_sum_2/bops_linear.h b/3rdparty/CGAL/examples/Minkowski_sum_2/bops_linear.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Minkowski_sum_2/bops_linear.h
rename to 3rdparty/CGAL/examples/Minkowski_sum_2/bops_linear.h
diff --git a/3rdparty/CGAL-4.8/examples/Minkowski_sum_2/exact_inset.cpp b/3rdparty/CGAL/examples/Minkowski_sum_2/exact_inset.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Minkowski_sum_2/exact_inset.cpp
rename to 3rdparty/CGAL/examples/Minkowski_sum_2/exact_inset.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Minkowski_sum_2/exact_offset.cpp b/3rdparty/CGAL/examples/Minkowski_sum_2/exact_offset.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Minkowski_sum_2/exact_offset.cpp
rename to 3rdparty/CGAL/examples/Minkowski_sum_2/exact_offset.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Minkowski_sum_2/holes.dat b/3rdparty/CGAL/examples/Minkowski_sum_2/holes.dat
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Minkowski_sum_2/holes.dat
rename to 3rdparty/CGAL/examples/Minkowski_sum_2/holes.dat
diff --git a/3rdparty/CGAL-4.8/examples/Minkowski_sum_2/ms_rational_nt.h b/3rdparty/CGAL/examples/Minkowski_sum_2/ms_rational_nt.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Minkowski_sum_2/ms_rational_nt.h
rename to 3rdparty/CGAL/examples/Minkowski_sum_2/ms_rational_nt.h
diff --git a/3rdparty/CGAL-4.8/examples/Minkowski_sum_2/pgn_print.h b/3rdparty/CGAL/examples/Minkowski_sum_2/pgn_print.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Minkowski_sum_2/pgn_print.h
rename to 3rdparty/CGAL/examples/Minkowski_sum_2/pgn_print.h
diff --git a/3rdparty/CGAL-4.8/examples/Minkowski_sum_2/print_utils.h b/3rdparty/CGAL/examples/Minkowski_sum_2/print_utils.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Minkowski_sum_2/print_utils.h
rename to 3rdparty/CGAL/examples/Minkowski_sum_2/print_utils.h
diff --git a/3rdparty/CGAL-4.8/examples/Minkowski_sum_2/rooms_star.dat b/3rdparty/CGAL/examples/Minkowski_sum_2/rooms_star.dat
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Minkowski_sum_2/rooms_star.dat
rename to 3rdparty/CGAL/examples/Minkowski_sum_2/rooms_star.dat
diff --git a/3rdparty/CGAL-4.8/examples/Minkowski_sum_2/spiked.dat b/3rdparty/CGAL/examples/Minkowski_sum_2/spiked.dat
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Minkowski_sum_2/spiked.dat
rename to 3rdparty/CGAL/examples/Minkowski_sum_2/spiked.dat
diff --git a/3rdparty/CGAL-4.8/examples/Minkowski_sum_2/sum_by_decomposition.cpp b/3rdparty/CGAL/examples/Minkowski_sum_2/sum_by_decomposition.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Minkowski_sum_2/sum_by_decomposition.cpp
rename to 3rdparty/CGAL/examples/Minkowski_sum_2/sum_by_decomposition.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Minkowski_sum_2/sum_of_holes.cpp b/3rdparty/CGAL/examples/Minkowski_sum_2/sum_of_holes.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Minkowski_sum_2/sum_of_holes.cpp
rename to 3rdparty/CGAL/examples/Minkowski_sum_2/sum_of_holes.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Minkowski_sum_2/sum_triangle_square.cpp b/3rdparty/CGAL/examples/Minkowski_sum_2/sum_triangle_square.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Minkowski_sum_2/sum_triangle_square.cpp
rename to 3rdparty/CGAL/examples/Minkowski_sum_2/sum_triangle_square.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Minkowski_sum_2/sum_with_holes.cpp b/3rdparty/CGAL/examples/Minkowski_sum_2/sum_with_holes.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Minkowski_sum_2/sum_with_holes.cpp
rename to 3rdparty/CGAL/examples/Minkowski_sum_2/sum_with_holes.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Minkowski_sum_2/tight.dat b/3rdparty/CGAL/examples/Minkowski_sum_2/tight.dat
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Minkowski_sum_2/tight.dat
rename to 3rdparty/CGAL/examples/Minkowski_sum_2/tight.dat
diff --git a/3rdparty/CGAL/examples/Minkowski_sum_3/CMakeLists.txt b/3rdparty/CGAL/examples/Minkowski_sum_3/CMakeLists.txt
new file mode 100644
index 0000000..d1065db
--- /dev/null
+++ b/3rdparty/CGAL/examples/Minkowski_sum_3/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Minkowski_sum_3_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Minkowski_sum_3/cube.nef3 b/3rdparty/CGAL/examples/Minkowski_sum_3/cube.nef3
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Minkowski_sum_3/cube.nef3
rename to 3rdparty/CGAL/examples/Minkowski_sum_3/cube.nef3
diff --git a/3rdparty/CGAL-4.8/examples/Minkowski_sum_3/cube_offset.cin b/3rdparty/CGAL/examples/Minkowski_sum_3/cube_offset.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Minkowski_sum_3/cube_offset.cin
rename to 3rdparty/CGAL/examples/Minkowski_sum_3/cube_offset.cin
diff --git a/3rdparty/CGAL-4.8/examples/Minkowski_sum_3/cube_offset.cpp b/3rdparty/CGAL/examples/Minkowski_sum_3/cube_offset.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Minkowski_sum_3/cube_offset.cpp
rename to 3rdparty/CGAL/examples/Minkowski_sum_3/cube_offset.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Minkowski_sum_3/glide.cin b/3rdparty/CGAL/examples/Minkowski_sum_3/glide.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Minkowski_sum_3/glide.cin
rename to 3rdparty/CGAL/examples/Minkowski_sum_3/glide.cin
diff --git a/3rdparty/CGAL-4.8/examples/Minkowski_sum_3/glide.cpp b/3rdparty/CGAL/examples/Minkowski_sum_3/glide.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Minkowski_sum_3/glide.cpp
rename to 3rdparty/CGAL/examples/Minkowski_sum_3/glide.cpp
diff --git a/3rdparty/CGAL/examples/Modular_arithmetic/CMakeLists.txt b/3rdparty/CGAL/examples/Modular_arithmetic/CMakeLists.txt
new file mode 100644
index 0000000..e5f305c
--- /dev/null
+++ b/3rdparty/CGAL/examples/Modular_arithmetic/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Modular_arithmetic_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Modular_arithmetic/modular_filter.cpp b/3rdparty/CGAL/examples/Modular_arithmetic/modular_filter.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Modular_arithmetic/modular_filter.cpp
rename to 3rdparty/CGAL/examples/Modular_arithmetic/modular_filter.cpp
diff --git a/3rdparty/CGAL/examples/Nef_2/CMakeLists.txt b/3rdparty/CGAL/examples/Nef_2/CMakeLists.txt
new file mode 100644
index 0000000..1bc859e
--- /dev/null
+++ b/3rdparty/CGAL/examples/Nef_2/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Nef_2_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Nef_2/nef_2_construction.cpp b/3rdparty/CGAL/examples/Nef_2/nef_2_construction.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Nef_2/nef_2_construction.cpp
rename to 3rdparty/CGAL/examples/Nef_2/nef_2_construction.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Nef_2/nef_2_intersection.cpp b/3rdparty/CGAL/examples/Nef_2/nef_2_intersection.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Nef_2/nef_2_intersection.cpp
rename to 3rdparty/CGAL/examples/Nef_2/nef_2_intersection.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Nef_2/nef_2_polylines.cpp b/3rdparty/CGAL/examples/Nef_2/nef_2_polylines.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Nef_2/nef_2_polylines.cpp
rename to 3rdparty/CGAL/examples/Nef_2/nef_2_polylines.cpp
diff --git a/3rdparty/CGAL/examples/Nef_3/CMakeLists.txt b/3rdparty/CGAL/examples/Nef_3/CMakeLists.txt
new file mode 100644
index 0000000..628845b
--- /dev/null
+++ b/3rdparty/CGAL/examples/Nef_3/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Nef_3_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Nef_3/comparison.cpp b/3rdparty/CGAL/examples/Nef_3/comparison.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Nef_3/comparison.cpp
rename to 3rdparty/CGAL/examples/Nef_3/comparison.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Nef_3/complex_construction.cin b/3rdparty/CGAL/examples/Nef_3/complex_construction.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Nef_3/complex_construction.cin
rename to 3rdparty/CGAL/examples/Nef_3/complex_construction.cin
diff --git a/3rdparty/CGAL-4.8/examples/Nef_3/complex_construction.cpp b/3rdparty/CGAL/examples/Nef_3/complex_construction.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Nef_3/complex_construction.cpp
rename to 3rdparty/CGAL/examples/Nef_3/complex_construction.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Nef_3/exploration_SM.cin b/3rdparty/CGAL/examples/Nef_3/exploration_SM.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Nef_3/exploration_SM.cin
rename to 3rdparty/CGAL/examples/Nef_3/exploration_SM.cin
diff --git a/3rdparty/CGAL-4.8/examples/Nef_3/exploration_SM.cpp b/3rdparty/CGAL/examples/Nef_3/exploration_SM.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Nef_3/exploration_SM.cpp
rename to 3rdparty/CGAL/examples/Nef_3/exploration_SM.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Nef_3/extended_kernel.cin b/3rdparty/CGAL/examples/Nef_3/extended_kernel.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Nef_3/extended_kernel.cin
rename to 3rdparty/CGAL/examples/Nef_3/extended_kernel.cin
diff --git a/3rdparty/CGAL-4.8/examples/Nef_3/extended_kernel.cpp b/3rdparty/CGAL/examples/Nef_3/extended_kernel.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Nef_3/extended_kernel.cpp
rename to 3rdparty/CGAL/examples/Nef_3/extended_kernel.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Nef_3/handling_double_coordinates.cin b/3rdparty/CGAL/examples/Nef_3/handling_double_coordinates.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Nef_3/handling_double_coordinates.cin
rename to 3rdparty/CGAL/examples/Nef_3/handling_double_coordinates.cin
diff --git a/3rdparty/CGAL-4.8/examples/Nef_3/handling_double_coordinates.cpp b/3rdparty/CGAL/examples/Nef_3/handling_double_coordinates.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Nef_3/handling_double_coordinates.cpp
rename to 3rdparty/CGAL/examples/Nef_3/handling_double_coordinates.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Nef_3/interface_polyhedron.cin b/3rdparty/CGAL/examples/Nef_3/interface_polyhedron.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Nef_3/interface_polyhedron.cin
rename to 3rdparty/CGAL/examples/Nef_3/interface_polyhedron.cin
diff --git a/3rdparty/CGAL-4.8/examples/Nef_3/interface_polyhedron.cpp b/3rdparty/CGAL/examples/Nef_3/interface_polyhedron.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Nef_3/interface_polyhedron.cpp
rename to 3rdparty/CGAL/examples/Nef_3/interface_polyhedron.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Nef_3/nefIO.cin b/3rdparty/CGAL/examples/Nef_3/nefIO.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Nef_3/nefIO.cin
rename to 3rdparty/CGAL/examples/Nef_3/nefIO.cin
diff --git a/3rdparty/CGAL-4.8/examples/Nef_3/nefIO.cpp b/3rdparty/CGAL/examples/Nef_3/nefIO.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Nef_3/nefIO.cpp
rename to 3rdparty/CGAL/examples/Nef_3/nefIO.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Nef_3/nef_3_construction.cpp b/3rdparty/CGAL/examples/Nef_3/nef_3_construction.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Nef_3/nef_3_construction.cpp
rename to 3rdparty/CGAL/examples/Nef_3/nef_3_construction.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Nef_3/nef_3_point_location.cin b/3rdparty/CGAL/examples/Nef_3/nef_3_point_location.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Nef_3/nef_3_point_location.cin
rename to 3rdparty/CGAL/examples/Nef_3/nef_3_point_location.cin
diff --git a/3rdparty/CGAL-4.8/examples/Nef_3/nef_3_point_location.cpp b/3rdparty/CGAL/examples/Nef_3/nef_3_point_location.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Nef_3/nef_3_point_location.cpp
rename to 3rdparty/CGAL/examples/Nef_3/nef_3_point_location.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Nef_3/nef_3_simple.cpp b/3rdparty/CGAL/examples/Nef_3/nef_3_simple.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Nef_3/nef_3_simple.cpp
rename to 3rdparty/CGAL/examples/Nef_3/nef_3_simple.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Nef_3/offIO.cin b/3rdparty/CGAL/examples/Nef_3/offIO.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Nef_3/offIO.cin
rename to 3rdparty/CGAL/examples/Nef_3/offIO.cin
diff --git a/3rdparty/CGAL-4.8/examples/Nef_3/offIO.cpp b/3rdparty/CGAL/examples/Nef_3/offIO.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Nef_3/offIO.cpp
rename to 3rdparty/CGAL/examples/Nef_3/offIO.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Nef_3/point_set_operations.cpp b/3rdparty/CGAL/examples/Nef_3/point_set_operations.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Nef_3/point_set_operations.cpp
rename to 3rdparty/CGAL/examples/Nef_3/point_set_operations.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Nef_3/polyline_construction.cpp b/3rdparty/CGAL/examples/Nef_3/polyline_construction.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Nef_3/polyline_construction.cpp
rename to 3rdparty/CGAL/examples/Nef_3/polyline_construction.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Nef_3/set_operations.cpp b/3rdparty/CGAL/examples/Nef_3/set_operations.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Nef_3/set_operations.cpp
rename to 3rdparty/CGAL/examples/Nef_3/set_operations.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Nef_3/shell_exploration.cin b/3rdparty/CGAL/examples/Nef_3/shell_exploration.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Nef_3/shell_exploration.cin
rename to 3rdparty/CGAL/examples/Nef_3/shell_exploration.cin
diff --git a/3rdparty/CGAL-4.8/examples/Nef_3/shell_exploration.cpp b/3rdparty/CGAL/examples/Nef_3/shell_exploration.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Nef_3/shell_exploration.cpp
rename to 3rdparty/CGAL/examples/Nef_3/shell_exploration.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Nef_3/topological_operations.cin b/3rdparty/CGAL/examples/Nef_3/topological_operations.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Nef_3/topological_operations.cin
rename to 3rdparty/CGAL/examples/Nef_3/topological_operations.cin
diff --git a/3rdparty/CGAL-4.8/examples/Nef_3/topological_operations.cpp b/3rdparty/CGAL/examples/Nef_3/topological_operations.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Nef_3/topological_operations.cpp
rename to 3rdparty/CGAL/examples/Nef_3/topological_operations.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Nef_3/transformation.cpp b/3rdparty/CGAL/examples/Nef_3/transformation.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Nef_3/transformation.cpp
rename to 3rdparty/CGAL/examples/Nef_3/transformation.cpp
diff --git a/3rdparty/CGAL/examples/Nef_S2/CMakeLists.txt b/3rdparty/CGAL/examples/Nef_S2/CMakeLists.txt
new file mode 100644
index 0000000..fc96565
--- /dev/null
+++ b/3rdparty/CGAL/examples/Nef_S2/CMakeLists.txt
@@ -0,0 +1,32 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Nef_S2_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+    include_directories (BEFORE "include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Nef_S2/include/CGAL/Nef_S2/create_random_Nef_S2.h b/3rdparty/CGAL/examples/Nef_S2/include/CGAL/Nef_S2/create_random_Nef_S2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Nef_S2/include/CGAL/Nef_S2/create_random_Nef_S2.h
rename to 3rdparty/CGAL/examples/Nef_S2/include/CGAL/Nef_S2/create_random_Nef_S2.h
diff --git a/3rdparty/CGAL-4.8/examples/Nef_S2/nef_s2_construction.cpp b/3rdparty/CGAL/examples/Nef_S2/nef_s2_construction.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Nef_S2/nef_s2_construction.cpp
rename to 3rdparty/CGAL/examples/Nef_S2/nef_s2_construction.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Nef_S2/nef_s2_exploration.cpp b/3rdparty/CGAL/examples/Nef_S2/nef_s2_exploration.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Nef_S2/nef_s2_exploration.cpp
rename to 3rdparty/CGAL/examples/Nef_S2/nef_s2_exploration.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Nef_S2/nef_s2_point_location.cpp b/3rdparty/CGAL/examples/Nef_S2/nef_s2_point_location.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Nef_S2/nef_s2_point_location.cpp
rename to 3rdparty/CGAL/examples/Nef_S2/nef_s2_point_location.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Nef_S2/nef_s2_simple.cpp b/3rdparty/CGAL/examples/Nef_S2/nef_s2_simple.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Nef_S2/nef_s2_simple.cpp
rename to 3rdparty/CGAL/examples/Nef_S2/nef_s2_simple.cpp
diff --git a/3rdparty/CGAL/examples/Optimal_transportation_reconstruction_2/CMakeLists.txt b/3rdparty/CGAL/examples/Optimal_transportation_reconstruction_2/CMakeLists.txt
new file mode 100644
index 0000000..34b9f6e
--- /dev/null
+++ b/3rdparty/CGAL/examples/Optimal_transportation_reconstruction_2/CMakeLists.txt
@@ -0,0 +1,34 @@
+project( Optimal_transportation_reconstruction_2_example )
+
+cmake_minimum_required(VERSION 2.6.2)
+if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_GREATER 2.6)
+  if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
+    cmake_policy(VERSION 2.8.4)
+  else()
+    cmake_policy(VERSION 2.6)
+  endif()
+endif()
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  include_directories (BEFORE "include")
+
+  create_single_source_cgal_program( "otr2_simplest_example.cpp" )
+  create_single_source_cgal_program( "otr2_list_output_example.cpp" )
+  create_single_source_cgal_program( "otr2_indexed_output_example.cpp" )
+  create_single_source_cgal_program( "otr2_mass_example.cpp" )
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/data/stair-noise00.xy b/3rdparty/CGAL/examples/Optimal_transportation_reconstruction_2/data/stair-noise00.xy
similarity index 100%
rename from 3rdparty/CGAL-4.8/demo/Optimal_transportation_reconstruction_2/data/stair-noise00.xy
rename to 3rdparty/CGAL/examples/Optimal_transportation_reconstruction_2/data/stair-noise00.xy
diff --git a/3rdparty/CGAL-4.8/examples/Optimal_transportation_reconstruction_2/data/stair.xy b/3rdparty/CGAL/examples/Optimal_transportation_reconstruction_2/data/stair.xy
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Optimal_transportation_reconstruction_2/data/stair.xy
rename to 3rdparty/CGAL/examples/Optimal_transportation_reconstruction_2/data/stair.xy
diff --git a/3rdparty/CGAL-4.8/examples/Optimal_transportation_reconstruction_2/data/stair.xym b/3rdparty/CGAL/examples/Optimal_transportation_reconstruction_2/data/stair.xym
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Optimal_transportation_reconstruction_2/data/stair.xym
rename to 3rdparty/CGAL/examples/Optimal_transportation_reconstruction_2/data/stair.xym
diff --git a/3rdparty/CGAL-4.8/examples/Optimal_transportation_reconstruction_2/otr2_indexed_output_example.cpp b/3rdparty/CGAL/examples/Optimal_transportation_reconstruction_2/otr2_indexed_output_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Optimal_transportation_reconstruction_2/otr2_indexed_output_example.cpp
rename to 3rdparty/CGAL/examples/Optimal_transportation_reconstruction_2/otr2_indexed_output_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Optimal_transportation_reconstruction_2/otr2_list_output_example.cpp b/3rdparty/CGAL/examples/Optimal_transportation_reconstruction_2/otr2_list_output_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Optimal_transportation_reconstruction_2/otr2_list_output_example.cpp
rename to 3rdparty/CGAL/examples/Optimal_transportation_reconstruction_2/otr2_list_output_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Optimal_transportation_reconstruction_2/otr2_mass_example.cpp b/3rdparty/CGAL/examples/Optimal_transportation_reconstruction_2/otr2_mass_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Optimal_transportation_reconstruction_2/otr2_mass_example.cpp
rename to 3rdparty/CGAL/examples/Optimal_transportation_reconstruction_2/otr2_mass_example.cpp
diff --git a/3rdparty/CGAL/examples/Optimal_transportation_reconstruction_2/otr2_simplest_example.cpp b/3rdparty/CGAL/examples/Optimal_transportation_reconstruction_2/otr2_simplest_example.cpp
new file mode 100644
index 0000000..a7c23be
--- /dev/null
+++ b/3rdparty/CGAL/examples/Optimal_transportation_reconstruction_2/otr2_simplest_example.cpp
@@ -0,0 +1,32 @@
+// Simplest example for Optimal_transportation_reconstruction_2, with no mass
+// attributes for the input points
+
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+#include <CGAL/point_generators_2.h>
+#include <CGAL/Optimal_transportation_reconstruction_2.h>
+
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
+typedef K::Point_2                                          Point;
+
+typedef CGAL::Optimal_transportation_reconstruction_2<K>    Otr;
+
+int main ()
+{
+  // Generate a set of random points on the boundary of a square.
+  std::vector<Point> points;
+  CGAL::Random_points_on_square_2<Point> point_generator(1.);
+  CGAL::cpp11::copy_n(point_generator, 100, std::back_inserter(points));
+
+  Otr otr(points);
+
+  if (otr.run(100)) //100 steps
+    std::cerr << "All done." << std::endl;
+  else
+    std::cerr << "Premature ending." << std::endl;
+
+  return 0;
+}
diff --git a/3rdparty/CGAL/examples/Partition_2/CMakeLists.txt b/3rdparty/CGAL/examples/Partition_2/CMakeLists.txt
new file mode 100644
index 0000000..0fd410e
--- /dev/null
+++ b/3rdparty/CGAL/examples/Partition_2/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Partition_2_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Partition_2/README b/3rdparty/CGAL/examples/Partition_2/README
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Partition_2/README
rename to 3rdparty/CGAL/examples/Partition_2/README
diff --git a/3rdparty/CGAL-4.8/examples/Partition_2/approx_convex_partition_2.cpp b/3rdparty/CGAL/examples/Partition_2/approx_convex_partition_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Partition_2/approx_convex_partition_2.cpp
rename to 3rdparty/CGAL/examples/Partition_2/approx_convex_partition_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Partition_2/greene_approx_convex_partition_2.cpp b/3rdparty/CGAL/examples/Partition_2/greene_approx_convex_partition_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Partition_2/greene_approx_convex_partition_2.cpp
rename to 3rdparty/CGAL/examples/Partition_2/greene_approx_convex_partition_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Partition_2/optimal_convex_partition_2.cpp b/3rdparty/CGAL/examples/Partition_2/optimal_convex_partition_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Partition_2/optimal_convex_partition_2.cpp
rename to 3rdparty/CGAL/examples/Partition_2/optimal_convex_partition_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Partition_2/y_monotone_partition_2.cpp b/3rdparty/CGAL/examples/Partition_2/y_monotone_partition_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Partition_2/y_monotone_partition_2.cpp
rename to 3rdparty/CGAL/examples/Partition_2/y_monotone_partition_2.cpp
diff --git a/3rdparty/CGAL/examples/Periodic_2_triangulation_2/CMakeLists.txt b/3rdparty/CGAL/examples/Periodic_2_triangulation_2/CMakeLists.txt
new file mode 100644
index 0000000..368230b
--- /dev/null
+++ b/3rdparty/CGAL/examples/Periodic_2_triangulation_2/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Periodic_2_triangulation_2_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Periodic_2_triangulation_2/data/triangulation_prog1.cin b/3rdparty/CGAL/examples/Periodic_2_triangulation_2/data/triangulation_prog1.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Periodic_2_triangulation_2/data/triangulation_prog1.cin
rename to 3rdparty/CGAL/examples/Periodic_2_triangulation_2/data/triangulation_prog1.cin
diff --git a/3rdparty/CGAL-4.8/examples/Periodic_2_triangulation_2/p2t2_adding_handles.cpp b/3rdparty/CGAL/examples/Periodic_2_triangulation_2/p2t2_adding_handles.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Periodic_2_triangulation_2/p2t2_adding_handles.cpp
rename to 3rdparty/CGAL/examples/Periodic_2_triangulation_2/p2t2_adding_handles.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Periodic_2_triangulation_2/p2t2_colored_vertices.cpp b/3rdparty/CGAL/examples/Periodic_2_triangulation_2/p2t2_colored_vertices.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Periodic_2_triangulation_2/p2t2_colored_vertices.cpp
rename to 3rdparty/CGAL/examples/Periodic_2_triangulation_2/p2t2_colored_vertices.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Periodic_2_triangulation_2/p2t2_covering.cpp b/3rdparty/CGAL/examples/Periodic_2_triangulation_2/p2t2_covering.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Periodic_2_triangulation_2/p2t2_covering.cpp
rename to 3rdparty/CGAL/examples/Periodic_2_triangulation_2/p2t2_covering.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Periodic_2_triangulation_2/p2t2_find_conflicts.cpp b/3rdparty/CGAL/examples/Periodic_2_triangulation_2/p2t2_find_conflicts.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Periodic_2_triangulation_2/p2t2_find_conflicts.cpp
rename to 3rdparty/CGAL/examples/Periodic_2_triangulation_2/p2t2_find_conflicts.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Periodic_2_triangulation_2/p2t2_geometric_access.cpp b/3rdparty/CGAL/examples/Periodic_2_triangulation_2/p2t2_geometric_access.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Periodic_2_triangulation_2/p2t2_geometric_access.cpp
rename to 3rdparty/CGAL/examples/Periodic_2_triangulation_2/p2t2_geometric_access.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Periodic_2_triangulation_2/p2t2_hierarchy.cpp b/3rdparty/CGAL/examples/Periodic_2_triangulation_2/p2t2_hierarchy.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Periodic_2_triangulation_2/p2t2_hierarchy.cpp
rename to 3rdparty/CGAL/examples/Periodic_2_triangulation_2/p2t2_hierarchy.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Periodic_2_triangulation_2/p2t2_info_insert_with_pair_iterator_2.cpp b/3rdparty/CGAL/examples/Periodic_2_triangulation_2/p2t2_info_insert_with_pair_iterator_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Periodic_2_triangulation_2/p2t2_info_insert_with_pair_iterator_2.cpp
rename to 3rdparty/CGAL/examples/Periodic_2_triangulation_2/p2t2_info_insert_with_pair_iterator_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Periodic_2_triangulation_2/p2t2_info_insert_with_transform_iterator_2.cpp b/3rdparty/CGAL/examples/Periodic_2_triangulation_2/p2t2_info_insert_with_transform_iterator_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Periodic_2_triangulation_2/p2t2_info_insert_with_transform_iterator_2.cpp
rename to 3rdparty/CGAL/examples/Periodic_2_triangulation_2/p2t2_info_insert_with_transform_iterator_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Periodic_2_triangulation_2/p2t2_info_insert_with_zip_iterator_2.cpp b/3rdparty/CGAL/examples/Periodic_2_triangulation_2/p2t2_info_insert_with_zip_iterator_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Periodic_2_triangulation_2/p2t2_info_insert_with_zip_iterator_2.cpp
rename to 3rdparty/CGAL/examples/Periodic_2_triangulation_2/p2t2_info_insert_with_zip_iterator_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Periodic_2_triangulation_2/p2t2_large_point_set.cpp b/3rdparty/CGAL/examples/Periodic_2_triangulation_2/p2t2_large_point_set.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Periodic_2_triangulation_2/p2t2_large_point_set.cpp
rename to 3rdparty/CGAL/examples/Periodic_2_triangulation_2/p2t2_large_point_set.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Periodic_2_triangulation_2/p2t2_simple_example.cpp b/3rdparty/CGAL/examples/Periodic_2_triangulation_2/p2t2_simple_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Periodic_2_triangulation_2/p2t2_simple_example.cpp
rename to 3rdparty/CGAL/examples/Periodic_2_triangulation_2/p2t2_simple_example.cpp
diff --git a/3rdparty/CGAL/examples/Periodic_3_triangulation_3/CMakeLists.txt b/3rdparty/CGAL/examples/Periodic_3_triangulation_3/CMakeLists.txt
new file mode 100644
index 0000000..9cb9e03
--- /dev/null
+++ b/3rdparty/CGAL/examples/Periodic_3_triangulation_3/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Periodic_3_triangulation_3_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Periodic_3_triangulation_3/README b/3rdparty/CGAL/examples/Periodic_3_triangulation_3/README
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Periodic_3_triangulation_3/README
rename to 3rdparty/CGAL/examples/Periodic_3_triangulation_3/README
diff --git a/3rdparty/CGAL/examples/Periodic_3_triangulation_3/colored_vertices.cpp b/3rdparty/CGAL/examples/Periodic_3_triangulation_3/colored_vertices.cpp
new file mode 100644
index 0000000..f5ff888
--- /dev/null
+++ b/3rdparty/CGAL/examples/Periodic_3_triangulation_3/colored_vertices.cpp
@@ -0,0 +1,40 @@
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+#include <CGAL/Periodic_3_Delaunay_triangulation_traits_3.h>
+#include <CGAL/Periodic_3_Delaunay_triangulation_3.h>
+#include <CGAL/Triangulation_vertex_base_with_info_3.h>
+#include <CGAL/IO/Color.h>
+
+typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
+typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3<K> GT;
+
+typedef CGAL::Periodic_3_triangulation_ds_vertex_base_3<> VbDS;
+typedef CGAL::Triangulation_vertex_base_3<GT,VbDS> Vb;
+
+typedef CGAL::Periodic_3_triangulation_ds_cell_base_3<> CbDS;
+typedef CGAL::Triangulation_cell_base_3<GT,CbDS> Cb;
+
+typedef CGAL::Triangulation_vertex_base_with_info_3<CGAL::Color, GT, Vb> VbInfo;
+typedef CGAL::Triangulation_data_structure_3<VbInfo, Cb>    TDS;
+typedef CGAL::Periodic_3_Delaunay_triangulation_3<GT, TDS>  PDT;
+
+typedef PDT::Point   Point;
+
+int main()
+{
+  PDT T;
+
+  T.insert(Point(0,0,0));
+  T.insert(Point(.1,0,0));
+  T.insert(Point(0,.1,0));
+  T.insert(Point(0,0,.1));
+  T.insert(Point(.2,.2,.2));
+  T.insert(Point(.9,0,.1));
+
+  // Set the color of finite vertices of degree 6 to red.
+  PDT::Vertex_iterator vit;
+  for (vit = T.vertices_begin(); vit != T.vertices_end(); ++vit)
+    if (T.degree(vit) == 6)
+      vit->info() = CGAL::RED;
+
+  return 0;
+}
diff --git a/3rdparty/CGAL-4.8/examples/Periodic_3_triangulation_3/covering.cpp b/3rdparty/CGAL/examples/Periodic_3_triangulation_3/covering.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Periodic_3_triangulation_3/covering.cpp
rename to 3rdparty/CGAL/examples/Periodic_3_triangulation_3/covering.cpp
diff --git a/3rdparty/CGAL/examples/Periodic_3_triangulation_3/find_conflicts.cpp b/3rdparty/CGAL/examples/Periodic_3_triangulation_3/find_conflicts.cpp
new file mode 100644
index 0000000..c48ec80
--- /dev/null
+++ b/3rdparty/CGAL/examples/Periodic_3_triangulation_3/find_conflicts.cpp
@@ -0,0 +1,55 @@
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+#include <CGAL/Periodic_3_Delaunay_triangulation_traits_3.h>
+#include <CGAL/Periodic_3_Delaunay_triangulation_3.h>
+#include <CGAL/point_generators_3.h>
+
+#include <vector>
+#include <cassert>
+
+typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
+typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3<K> GT;
+
+typedef CGAL::Periodic_3_Delaunay_triangulation_3<GT> Delaunay;
+typedef Delaunay::Point                               Point;
+typedef Delaunay::Cell_handle                         Cell_handle;
+typedef Delaunay::Facet                               Facet;
+
+int main()
+{
+  Delaunay T;
+  CGAL::Random_points_in_cube_3<Point> rnd(0.5);
+  GT::Vector_3 v(0.5,0.5,0.5);
+
+  // First, make sure the triangulation is 3D.
+  T.insert(Point(0,0,0));
+  T.insert(Point(.1,0,0));
+  T.insert(Point(0,.1,0));
+  T.insert(Point(0,0,.1));
+
+  // Gets the conflict region of 100 random points
+  // in the Delaunay tetrahedralization
+  for (int i = 0; i != 100; ++i) {
+    Point p = (*rnd++)+v;
+
+    // Locate the point
+    Delaunay::Locate_type lt;
+    int li, lj;
+    Cell_handle c = T.locate(p, lt, li, lj);
+    if (lt == Delaunay::VERTEX)
+      continue; // Point already exists
+
+    // Get the cells that conflict with p in a vector V,
+    // and a facet on the boundary of this hole in f.
+    std::vector<Cell_handle> V;
+    Facet f;
+
+    T.find_conflicts(p, c,
+		     CGAL::Oneset_iterator<Facet>(f), // Get one boundary facet
+		     std::back_inserter(V));          // Conflict cells in V
+    }
+
+  std::cout << "Final triangulation has " << T.number_of_vertices()
+            << " vertices." << std::endl;
+
+  return 0;
+}
diff --git a/3rdparty/CGAL-4.8/examples/Periodic_3_triangulation_3/geometric_access.cpp b/3rdparty/CGAL/examples/Periodic_3_triangulation_3/geometric_access.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Periodic_3_triangulation_3/geometric_access.cpp
rename to 3rdparty/CGAL/examples/Periodic_3_triangulation_3/geometric_access.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Periodic_3_triangulation_3/large_point_set.cpp b/3rdparty/CGAL/examples/Periodic_3_triangulation_3/large_point_set.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Periodic_3_triangulation_3/large_point_set.cpp
rename to 3rdparty/CGAL/examples/Periodic_3_triangulation_3/large_point_set.cpp
diff --git a/3rdparty/CGAL/examples/Periodic_3_triangulation_3/periodic_adding_handles.cpp b/3rdparty/CGAL/examples/Periodic_3_triangulation_3/periodic_adding_handles.cpp
new file mode 100644
index 0000000..ddcce2c
--- /dev/null
+++ b/3rdparty/CGAL/examples/Periodic_3_triangulation_3/periodic_adding_handles.cpp
@@ -0,0 +1,69 @@
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+#include <CGAL/Periodic_3_Delaunay_triangulation_traits_3.h>
+#include <CGAL/Periodic_3_Delaunay_triangulation_3.h>
+#include <CGAL/Periodic_3_triangulation_ds_vertex_base_3.h>
+#include <CGAL/Triangulation_vertex_base_3.h>
+
+template < class GT, class VbDS,
+	   class Vb = CGAL::Triangulation_vertex_base_3<GT,VbDS> >
+class My_vertex_base
+  : public Vb
+{
+public:
+  typedef typename Vb::Vertex_handle  Vertex_handle;
+  typedef typename Vb::Cell_handle    Cell_handle;
+  typedef typename Vb::Point          Point;
+
+  template < class TDS2 >
+  struct Rebind_TDS {
+    typedef typename Vb::template Rebind_TDS<TDS2>::Other  Vb2;
+    typedef My_vertex_base<GT, Vb2>                        Other;
+  };
+
+  My_vertex_base() {}
+
+  My_vertex_base(const Point& p)
+    : Vb(p) {}
+
+  My_vertex_base(const Point& p, Cell_handle c)
+    : Vb(p, c) {}
+
+  Vertex_handle   vh;
+  Cell_handle     ch;
+};
+
+
+typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
+typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3<K> GT;
+
+typedef CGAL::Periodic_3_triangulation_ds_vertex_base_3<> VbDS;
+typedef CGAL::Periodic_3_triangulation_ds_cell_base_3<> CbDS;
+typedef CGAL::Triangulation_cell_base_3<GT,CbDS> Cb;
+
+typedef CGAL::Triangulation_data_structure_3<My_vertex_base<GT,VbDS>, Cb> TDS;
+typedef CGAL::Periodic_3_Delaunay_triangulation_3<GT,TDS> PDT;
+
+typedef PDT::Vertex_handle    Vertex_handle;
+typedef PDT::Point            Point;
+
+int main()
+{
+  PDT T;
+
+  Vertex_handle v0 = T.insert(Point(0,0,0));
+  Vertex_handle v1 = T.insert(Point(.1,0,0));
+  Vertex_handle v2 = T.insert(Point(0,.1,0));
+  Vertex_handle v3 = T.insert(Point(0,0,.1));
+  Vertex_handle v4 = T.insert(Point(.2,.2,.2));
+  Vertex_handle v5 = T.insert(Point(.9,0,.1));
+
+  // Now we can link the vertices as we like.
+  v0->vh = v1;
+  v1->vh = v2;
+  v2->vh = v3;
+  v3->vh = v4;
+  v4->vh = v5;
+  v5->vh = v0;
+
+  return 0;
+}
diff --git a/3rdparty/CGAL-4.8/examples/Periodic_3_triangulation_3/simple_example.cpp b/3rdparty/CGAL/examples/Periodic_3_triangulation_3/simple_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Periodic_3_triangulation_3/simple_example.cpp
rename to 3rdparty/CGAL/examples/Periodic_3_triangulation_3/simple_example.cpp
diff --git a/3rdparty/CGAL/examples/Point_set_2/CMakeLists.txt b/3rdparty/CGAL/examples/Point_set_2/CMakeLists.txt
new file mode 100644
index 0000000..b20f270
--- /dev/null
+++ b/3rdparty/CGAL/examples/Point_set_2/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Point_set_2_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Point_set_2/nearest_neighbor.cpp b/3rdparty/CGAL/examples/Point_set_2/nearest_neighbor.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Point_set_2/nearest_neighbor.cpp
rename to 3rdparty/CGAL/examples/Point_set_2/nearest_neighbor.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Point_set_2/range_search.cpp b/3rdparty/CGAL/examples/Point_set_2/range_search.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Point_set_2/range_search.cpp
rename to 3rdparty/CGAL/examples/Point_set_2/range_search.cpp
diff --git a/3rdparty/CGAL/examples/Point_set_processing_3/CMakeLists.txt b/3rdparty/CGAL/examples/Point_set_processing_3/CMakeLists.txt
new file mode 100644
index 0000000..3a432c0
--- /dev/null
+++ b/3rdparty/CGAL/examples/Point_set_processing_3/CMakeLists.txt
@@ -0,0 +1,82 @@
+# This is the CMake script for compiling this folder.
+
+project( Point_set_processing_3_example )
+
+cmake_minimum_required(VERSION 2.8.11)
+
+
+# Find CGAL
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  find_package(Boost QUIET)
+
+  # VisualC++ optimization for applications dealing with large data
+  if (MSVC)
+  
+    # Allow Windows 32bit applications to use up to 3GB of RAM
+    SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
+
+    # Prints new compilation options
+    message( STATUS "USING DEBUG CXXFLAGS   = '${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}'" )
+    message( STATUS "USING DEBUG EXEFLAGS   = '${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_DEBUG}'" )
+    message( STATUS "USING RELEASE CXXFLAGS = '${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}'" )
+    message( STATUS "USING RELEASE EXEFLAGS = '${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_RELEASE}'" )
+  endif()
+
+  # Activate concurrency?
+  option(ACTIVATE_CONCURRENT_PSP3
+         "Enable concurrency"
+         OFF)
+     
+  if( ACTIVATE_CONCURRENT_PSP3 OR ENV{ACTIVATE_CONCURRENT_PSP3} )
+    find_package( TBB REQUIRED )
+    if( TBB_FOUND )
+      include(${TBB_USE_FILE})
+      list(APPEND CGAL_3RD_PARTY_LIBRARIES ${TBB_LIBRARIES})
+    endif()
+  endif()
+
+  # Executables that do *not* require EIGEN or LAPACK
+  create_single_source_cgal_program( "average_spacing_example.cpp" )
+  create_single_source_cgal_program( "bilateral_smooth_point_set_example.cpp" )
+  create_single_source_cgal_program( "grid_simplification_example.cpp" )
+  create_single_source_cgal_program( "grid_simplify_indices.cpp" )
+  create_single_source_cgal_program( "hierarchy_simplification_example.cpp" )
+  create_single_source_cgal_program( "normals_example.cpp" )
+  create_single_source_cgal_program( "property_map.cpp" )
+  create_single_source_cgal_program( "random_simplification_example.cpp" )
+  create_single_source_cgal_program( "read_write_xyz_point_set_example.cpp" )
+  create_single_source_cgal_program( "read_ply_points_with_colors_example.cpp" )
+  create_single_source_cgal_program( "remove_outliers_example.cpp" )
+  create_single_source_cgal_program( "wlop_simplify_and_regularize_point_set_example.cpp" )
+  create_single_source_cgal_program( "edge_aware_upsample_point_set_example.cpp" )
+  
+  # Use Eigen or BLAS and LAPACK (optional)
+  find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater)
+  if (NOT EIGEN3_FOUND)
+    find_package(LAPACK)
+    if(LAPACK_FOUND)
+      include( ${LAPACK_USE_FILE} )
+    endif(LAPACK_FOUND)
+  else()
+    include( ${EIGEN3_USE_FILE} )
+  endif()
+
+  if(EIGEN3_FOUND OR LAPACK_FOUND)
+    # Executables that require Eigen or BLAS and LAPACK
+    create_single_source_cgal_program( "jet_smoothing_example.cpp" )
+    create_single_source_cgal_program( "normal_estimation.cpp" )
+    create_single_source_cgal_program( "edges_example.cpp" )
+  else(EIGEN3_FOUND OR LAPACK_FOUND)
+
+    message(STATUS "NOTICE: Some of the executables in this directory need either Eigen 3.1 (or greater) or LAPACK, and will not be compiled.")
+
+  endif(EIGEN3_FOUND OR LAPACK_FOUND)
+else()
+    message(STATUS "NOTICE: This program requires the CGAL library, and will not be compiled.")
+endif()
diff --git a/3rdparty/CGAL-4.8/examples/Point_set_processing_3/average_spacing_example.cpp b/3rdparty/CGAL/examples/Point_set_processing_3/average_spacing_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Point_set_processing_3/average_spacing_example.cpp
rename to 3rdparty/CGAL/examples/Point_set_processing_3/average_spacing_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Point_set_processing_3/bilateral_smooth_point_set_example.cpp b/3rdparty/CGAL/examples/Point_set_processing_3/bilateral_smooth_point_set_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Point_set_processing_3/bilateral_smooth_point_set_example.cpp
rename to 3rdparty/CGAL/examples/Point_set_processing_3/bilateral_smooth_point_set_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Point_set_processing_3/data/ChineseDragon-10kv.off b/3rdparty/CGAL/examples/Point_set_processing_3/data/ChineseDragon-10kv.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Point_set_processing_3/data/ChineseDragon-10kv.off
rename to 3rdparty/CGAL/examples/Point_set_processing_3/data/ChineseDragon-10kv.off
diff --git a/3rdparty/CGAL-4.8/examples/Point_set_processing_3/data/before_upsample.xyz b/3rdparty/CGAL/examples/Point_set_processing_3/data/before_upsample.xyz
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Point_set_processing_3/data/before_upsample.xyz
rename to 3rdparty/CGAL/examples/Point_set_processing_3/data/before_upsample.xyz
diff --git a/3rdparty/CGAL-4.8/examples/Point_set_processing_3/data/camel.off b/3rdparty/CGAL/examples/Point_set_processing_3/data/camel.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Point_set_processing_3/data/camel.off
rename to 3rdparty/CGAL/examples/Point_set_processing_3/data/camel.off
diff --git a/3rdparty/CGAL/examples/Point_set_processing_3/data/colors.ply b/3rdparty/CGAL/examples/Point_set_processing_3/data/colors.ply
new file mode 100644
index 0000000..b277477
--- /dev/null
+++ b/3rdparty/CGAL/examples/Point_set_processing_3/data/colors.ply
@@ -0,0 +1,17 @@
+ply
+format ascii 1.0
+comment Example for CGAL PLY reader
+element vertex 3
+property double x
+property double y
+property double z
+property double nx
+property double ny
+property double nz
+property uchar red
+property uchar green
+property uchar blue
+end_header
+0.0 0.0 0.0 0.0 0.0 1.0 255 0 0
+0.0 0.0 1.0 0.0 0.0 1.0 0 255 0
+0.0 1.0 0.0 0.0 0.0 1.0 0 0 255
diff --git a/3rdparty/CGAL-4.8/examples/Point_set_processing_3/data/fandisk.off b/3rdparty/CGAL/examples/Point_set_processing_3/data/fandisk.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Point_set_processing_3/data/fandisk.off
rename to 3rdparty/CGAL/examples/Point_set_processing_3/data/fandisk.off
diff --git a/3rdparty/CGAL-4.8/examples/Point_set_processing_3/data/fin90_with_PCA_normals.xyz b/3rdparty/CGAL/examples/Point_set_processing_3/data/fin90_with_PCA_normals.xyz
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Point_set_processing_3/data/fin90_with_PCA_normals.xyz
rename to 3rdparty/CGAL/examples/Point_set_processing_3/data/fin90_with_PCA_normals.xyz
diff --git a/3rdparty/CGAL-4.8/examples/Point_set_processing_3/data/oni.xyz b/3rdparty/CGAL/examples/Point_set_processing_3/data/oni.xyz
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Point_set_processing_3/data/oni.xyz
rename to 3rdparty/CGAL/examples/Point_set_processing_3/data/oni.xyz
diff --git a/3rdparty/CGAL-4.8/examples/Point_set_processing_3/data/sphere_1k.xyz b/3rdparty/CGAL/examples/Point_set_processing_3/data/sphere_1k.xyz
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Point_set_processing_3/data/sphere_1k.xyz
rename to 3rdparty/CGAL/examples/Point_set_processing_3/data/sphere_1k.xyz
diff --git a/3rdparty/CGAL-4.8/examples/Point_set_processing_3/data/sphere_20k.xyz b/3rdparty/CGAL/examples/Point_set_processing_3/data/sphere_20k.xyz
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Point_set_processing_3/data/sphere_20k.xyz
rename to 3rdparty/CGAL/examples/Point_set_processing_3/data/sphere_20k.xyz
diff --git a/3rdparty/CGAL-4.8/examples/Point_set_processing_3/data/sphere_20k_normal.xyz b/3rdparty/CGAL/examples/Point_set_processing_3/data/sphere_20k_normal.xyz
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Point_set_processing_3/data/sphere_20k_normal.xyz
rename to 3rdparty/CGAL/examples/Point_set_processing_3/data/sphere_20k_normal.xyz
diff --git a/3rdparty/CGAL-4.8/examples/Point_set_processing_3/edge_aware_upsample_point_set_example.cpp b/3rdparty/CGAL/examples/Point_set_processing_3/edge_aware_upsample_point_set_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Point_set_processing_3/edge_aware_upsample_point_set_example.cpp
rename to 3rdparty/CGAL/examples/Point_set_processing_3/edge_aware_upsample_point_set_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Point_set_processing_3/edges_example.cpp b/3rdparty/CGAL/examples/Point_set_processing_3/edges_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Point_set_processing_3/edges_example.cpp
rename to 3rdparty/CGAL/examples/Point_set_processing_3/edges_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Point_set_processing_3/grid_simplification_example.cpp b/3rdparty/CGAL/examples/Point_set_processing_3/grid_simplification_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Point_set_processing_3/grid_simplification_example.cpp
rename to 3rdparty/CGAL/examples/Point_set_processing_3/grid_simplification_example.cpp
diff --git a/3rdparty/CGAL/examples/Point_set_processing_3/grid_simplify_indices.cpp b/3rdparty/CGAL/examples/Point_set_processing_3/grid_simplify_indices.cpp
new file mode 100644
index 0000000..c376956
--- /dev/null
+++ b/3rdparty/CGAL/examples/Point_set_processing_3/grid_simplify_indices.cpp
@@ -0,0 +1,60 @@
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+#include <CGAL/grid_simplify_point_set.h>
+#include <CGAL/IO/read_xyz_points.h>
+#include <CGAL/property_map.h>
+
+#include <vector>
+#include <fstream>
+
+// types
+typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
+typedef Kernel::Point_3 Point;
+typedef Kernel::Vector_3 Vector;
+
+int main(int argc, char*argv[])
+{
+  // Reads a .xyz point set file in points[].
+  std::vector<Point> points;
+  std::vector<Vector> normals;
+  const char* fname = (argc>1)?argv[1]:"data/fin90_with_PCA_normals.xyz";
+  std::ifstream stream(fname);
+  Point p;
+  Vector v;
+  while(stream >> p >> v){
+    points.push_back(p);
+    normals.push_back(v);
+  } 
+
+  std::cout << points.size() << " input points" << std::endl;
+  std::vector<std::size_t> indices(points.size());
+  for(std::size_t i = 0; i < points.size(); ++i){
+    indices[i] = i;
+  }
+  // simplification by clustering using erase-remove idiom
+  double cell_size = 0.05;
+  std::vector<std::size_t>::iterator end;
+  end = CGAL::grid_simplify_point_set(indices.begin(),
+                                      indices.end(),
+                                      CGAL::make_property_map(points),
+                                      cell_size);
+
+  std::size_t k = end - indices.begin();
+
+  std::cerr << "Keep " << k << " of " << indices.size() <<  "indices" << std::endl;
+
+  {
+    std::vector<Point> tmp_points(k);
+    std::vector<Vector> tmp_normals(k);
+    for(std::size_t i=0; i<k; ++i){
+      tmp_points[i] = points[indices[i]];
+      tmp_normals[i] = normals[indices[i]];
+    }
+    points.swap(tmp_points);
+    normals.swap(tmp_normals);
+  }
+
+  std::cout << points.size() << " points after the simplification" << std::endl;
+
+  return EXIT_SUCCESS;
+}
+
diff --git a/3rdparty/CGAL-4.8/examples/Point_set_processing_3/hierarchy_simplification_example.cpp b/3rdparty/CGAL/examples/Point_set_processing_3/hierarchy_simplification_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Point_set_processing_3/hierarchy_simplification_example.cpp
rename to 3rdparty/CGAL/examples/Point_set_processing_3/hierarchy_simplification_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Point_set_processing_3/jet_smoothing_example.cpp b/3rdparty/CGAL/examples/Point_set_processing_3/jet_smoothing_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Point_set_processing_3/jet_smoothing_example.cpp
rename to 3rdparty/CGAL/examples/Point_set_processing_3/jet_smoothing_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Point_set_processing_3/normal_estimation.cmd b/3rdparty/CGAL/examples/Point_set_processing_3/normal_estimation.cmd
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Point_set_processing_3/normal_estimation.cmd
rename to 3rdparty/CGAL/examples/Point_set_processing_3/normal_estimation.cmd
diff --git a/3rdparty/CGAL-4.8/examples/Point_set_processing_3/normal_estimation.cpp b/3rdparty/CGAL/examples/Point_set_processing_3/normal_estimation.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Point_set_processing_3/normal_estimation.cpp
rename to 3rdparty/CGAL/examples/Point_set_processing_3/normal_estimation.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Point_set_processing_3/normals_example.cpp b/3rdparty/CGAL/examples/Point_set_processing_3/normals_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Point_set_processing_3/normals_example.cpp
rename to 3rdparty/CGAL/examples/Point_set_processing_3/normals_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Point_set_processing_3/property_map.cpp b/3rdparty/CGAL/examples/Point_set_processing_3/property_map.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Point_set_processing_3/property_map.cpp
rename to 3rdparty/CGAL/examples/Point_set_processing_3/property_map.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Point_set_processing_3/random_simplification_example.cpp b/3rdparty/CGAL/examples/Point_set_processing_3/random_simplification_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Point_set_processing_3/random_simplification_example.cpp
rename to 3rdparty/CGAL/examples/Point_set_processing_3/random_simplification_example.cpp
diff --git a/3rdparty/CGAL/examples/Point_set_processing_3/read_ply_points_with_colors_example.cpp b/3rdparty/CGAL/examples/Point_set_processing_3/read_ply_points_with_colors_example.cpp
new file mode 100644
index 0000000..028f6d8
--- /dev/null
+++ b/3rdparty/CGAL/examples/Point_set_processing_3/read_ply_points_with_colors_example.cpp
@@ -0,0 +1,101 @@
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+#include <CGAL/property_map.h>
+#include <CGAL/IO/read_ply_points.h>
+
+#include <utility>
+#include <vector>
+#include <fstream>
+
+// types
+typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
+typedef Kernel::FT FT;
+typedef Kernel::Point_3 Point;
+typedef Kernel::Vector_3 Vector;
+
+// Point with normal vector stored as a std::pair.
+typedef std::pair<Point, Vector> Pwn;
+
+// Color is red/green/blue array
+typedef CGAL::cpp11::array<unsigned char, 3> Color;
+
+// Custom interpreter that reads points, normals and colors and stores
+// them in the appropriate container
+class My_ply_interpreter
+{
+  std::vector<Pwn>& points;
+  std::vector<Color>& colors;
+    
+public:
+  My_ply_interpreter (std::vector<Pwn>& points,
+                      std::vector<Color>& colors)
+    : points (points), colors (colors)
+  { }
+
+  // Init and test if input file contains the right properties
+  bool is_applicable (CGAL::Ply_reader& reader)
+  {
+    return reader.does_tag_exist<FT> ("x")
+      && reader.does_tag_exist<FT> ("y")
+      && reader.does_tag_exist<FT> ("z")
+      && reader.does_tag_exist<FT> ("nx")
+      && reader.does_tag_exist<FT> ("ny")
+      && reader.does_tag_exist<FT> ("nz")
+      && reader.does_tag_exist<unsigned char> ("red")
+      && reader.does_tag_exist<unsigned char> ("green")
+      && reader.does_tag_exist<unsigned char> ("blue");
+  }
+
+  // Describes how to process one line (= one point object)
+  void process_line (CGAL::Ply_reader& reader)
+  {
+    FT x = (FT)0., y = (FT)0., z = (FT)0.,
+      nx = (FT)0., ny = (FT)0., nz = (FT)0.;
+    Color c = {{ 0, 0, 0 }};
+
+    reader.assign (x, "x");
+    reader.assign (y, "y");
+    reader.assign (z, "z");
+    reader.assign (nx, "nx");
+    reader.assign (ny, "ny");
+    reader.assign (nz, "nz");
+    reader.assign (c[0], "red");
+    reader.assign (c[1], "green");
+    reader.assign (c[2], "blue");
+
+    points.push_back (std::make_pair (Point (x, y, z), Vector (nx, ny, nz)));
+    colors.push_back (c);
+  }
+
+};
+
+
+
+int main(int argc, char*argv[])
+{
+  const char* fname = (argc>1) ? argv[1] : "data/colors.ply";
+    // Reads a .ply point set file with normal vectors and colors
+
+  std::vector<Pwn> points; // store points with normals
+  std::vector<Color> colors; // store colors in separate container
+
+  My_ply_interpreter interpreter(points, colors); // init interpreter
+  
+  std::ifstream in(fname);
+  if (!in ||
+      !CGAL::read_ply_custom_points (in, interpreter, Kernel()))
+    {
+      std::cerr << "Error: cannot read file " << fname << std::endl;
+      return EXIT_FAILURE;
+    }
+
+  // Display points with pure r/g/b colors
+  for (std::size_t i = 0; i < points.size (); ++ i)
+    if (colors[i][0] == 255 && colors[i][1] == 0 && colors[i][2] == 0)
+      std::cerr << "Point " << points[i].first << " is red." << std::endl;
+    else if (colors[i][0] == 0 && colors[i][1] == 255 && colors[i][2] == 0)
+      std::cerr << "Point " << points[i].first << " is green." << std::endl;
+    else if (colors[i][0] == 0 && colors[i][1] == 0 && colors[i][2] == 255)
+      std::cerr << "Point " << points[i].first << " is blue." << std::endl;
+  
+  return EXIT_SUCCESS;
+}
diff --git a/3rdparty/CGAL-4.8/examples/Point_set_processing_3/read_write_xyz_point_set_example.cpp b/3rdparty/CGAL/examples/Point_set_processing_3/read_write_xyz_point_set_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Point_set_processing_3/read_write_xyz_point_set_example.cpp
rename to 3rdparty/CGAL/examples/Point_set_processing_3/read_write_xyz_point_set_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Point_set_processing_3/remove_outliers_example.cpp b/3rdparty/CGAL/examples/Point_set_processing_3/remove_outliers_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Point_set_processing_3/remove_outliers_example.cpp
rename to 3rdparty/CGAL/examples/Point_set_processing_3/remove_outliers_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Point_set_processing_3/wlop_simplify_and_regularize_point_set_example.cpp b/3rdparty/CGAL/examples/Point_set_processing_3/wlop_simplify_and_regularize_point_set_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Point_set_processing_3/wlop_simplify_and_regularize_point_set_example.cpp
rename to 3rdparty/CGAL/examples/Point_set_processing_3/wlop_simplify_and_regularize_point_set_example.cpp
diff --git a/3rdparty/CGAL/examples/Point_set_shape_detection_3/CMakeLists.txt b/3rdparty/CGAL/examples/Point_set_shape_detection_3/CMakeLists.txt
new file mode 100644
index 0000000..99fce47
--- /dev/null
+++ b/3rdparty/CGAL/examples/Point_set_shape_detection_3/CMakeLists.txt
@@ -0,0 +1,37 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Point_set_shape_detection_3_example )
+
+cmake_minimum_required(VERSION 2.6.2)
+if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_GREATER 2.6)
+  if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
+    cmake_policy(VERSION 2.8.4)
+  else()
+    cmake_policy(VERSION 2.6)
+  endif()
+endif()
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  create_single_source_cgal_program( "efficient_RANSAC_basic.cpp" )
+  create_single_source_cgal_program( "efficient_RANSAC_custom_shape.cpp" )
+  create_single_source_cgal_program( "efficient_RANSAC_parameters.cpp" )
+  create_single_source_cgal_program( "efficient_RANSAC_point_access.cpp" )
+  create_single_source_cgal_program( "plane_regularization.cpp" )
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Point_set_shape_detection_3/data/cube.pwn b/3rdparty/CGAL/examples/Point_set_shape_detection_3/data/cube.pwn
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Point_set_shape_detection_3/data/cube.pwn
rename to 3rdparty/CGAL/examples/Point_set_shape_detection_3/data/cube.pwn
diff --git a/3rdparty/CGAL-4.8/examples/Point_set_shape_detection_3/efficient_RANSAC_basic.cpp b/3rdparty/CGAL/examples/Point_set_shape_detection_3/efficient_RANSAC_basic.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Point_set_shape_detection_3/efficient_RANSAC_basic.cpp
rename to 3rdparty/CGAL/examples/Point_set_shape_detection_3/efficient_RANSAC_basic.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Point_set_shape_detection_3/efficient_RANSAC_custom_shape.cpp b/3rdparty/CGAL/examples/Point_set_shape_detection_3/efficient_RANSAC_custom_shape.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Point_set_shape_detection_3/efficient_RANSAC_custom_shape.cpp
rename to 3rdparty/CGAL/examples/Point_set_shape_detection_3/efficient_RANSAC_custom_shape.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Point_set_shape_detection_3/efficient_RANSAC_custom_shape.h b/3rdparty/CGAL/examples/Point_set_shape_detection_3/efficient_RANSAC_custom_shape.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Point_set_shape_detection_3/efficient_RANSAC_custom_shape.h
rename to 3rdparty/CGAL/examples/Point_set_shape_detection_3/efficient_RANSAC_custom_shape.h
diff --git a/3rdparty/CGAL/examples/Point_set_shape_detection_3/efficient_RANSAC_parameters.cpp b/3rdparty/CGAL/examples/Point_set_shape_detection_3/efficient_RANSAC_parameters.cpp
new file mode 100644
index 0000000..9bea670
--- /dev/null
+++ b/3rdparty/CGAL/examples/Point_set_shape_detection_3/efficient_RANSAC_parameters.cpp
@@ -0,0 +1,131 @@
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+#include <CGAL/IO/read_xyz_points.h>
+#include <CGAL/Point_with_normal_3.h>
+#include <CGAL/property_map.h>
+
+#include <CGAL/Shape_detection_3.h>
+
+#include <iostream>
+#include <fstream>
+
+
+// Type declarations
+typedef CGAL::Exact_predicates_inexact_constructions_kernel  Kernel;
+typedef Kernel::FT                                           FT;
+typedef std::pair<Kernel::Point_3, Kernel::Vector_3>         Point_with_normal;
+typedef std::vector<Point_with_normal>                       Pwn_vector;
+typedef CGAL::First_of_pair_property_map<Point_with_normal>  Point_map;
+typedef CGAL::Second_of_pair_property_map<Point_with_normal> Normal_map;
+
+// In Efficient_RANSAC_traits the basic types, i.e., Point and Vector types
+// as well as iterator type and property maps, are defined.
+typedef CGAL::Shape_detection_3::Efficient_RANSAC_traits<Kernel,
+  Pwn_vector, Point_map, Normal_map>            Traits;
+typedef CGAL::Shape_detection_3::Efficient_RANSAC<Traits> Efficient_ransac;
+typedef CGAL::Shape_detection_3::Cone<Traits>             Cone;
+typedef CGAL::Shape_detection_3::Cylinder<Traits>         Cylinder;
+typedef CGAL::Shape_detection_3::Plane<Traits>            Plane;
+typedef CGAL::Shape_detection_3::Sphere<Traits>           Sphere;
+typedef CGAL::Shape_detection_3::Torus<Traits>            Torus;
+
+
+int main() 
+{
+  // Points with normals.
+  Pwn_vector points;
+
+  // Loads point set from a file. 
+  // read_xyz_points_and_normals takes an OutputIterator for storing the points
+  // and a property map to store the normal vector with each point.
+  std::ifstream stream("data/cube.pwn");
+
+  if (!stream ||
+    !CGAL::read_xyz_points_and_normals(stream,
+      std::back_inserter(points),
+      Point_map(),
+      Normal_map()))
+  {
+    std::cerr << "Error: cannot read file cube.pwn" << std::endl;
+    return EXIT_FAILURE;
+  }
+
+  std::cout << points.size() << " points" << std::endl;
+
+  // Instantiates shape detection engine.
+  Efficient_ransac ransac;
+
+  // Provides the input data.
+  ransac.set_input(points);
+    
+  // Register shapes for detection
+  ransac.add_shape_factory<Plane>();
+  ransac.add_shape_factory<Sphere>();
+  ransac.add_shape_factory<Cylinder>();
+  ransac.add_shape_factory<Cone>();
+  ransac.add_shape_factory<Torus>();
+
+  // Sets parameters for shape detection.
+  Efficient_ransac::Parameters parameters;
+
+  // Sets probability to miss the largest primitive at each iteration.
+  parameters.probability = 0.05;
+ 
+  // Detect shapes with at least 500 points.
+  parameters.min_points = 200;
+
+  // Sets maximum Euclidean distance between a point and a shape.
+  parameters.epsilon = 0.002;
+ 
+  // Sets maximum Euclidean distance between points to be clustered.
+  parameters.cluster_epsilon = 0.01;
+ 
+  // Sets maximum normal deviation.
+  // 0.9 < dot(surface_normal, point_normal); 
+  parameters.normal_threshold = 0.9;   
+  
+  // Detects shapes
+  ransac.detect(parameters);
+
+  // Prints number of detected shapes and unassigned points.
+   std::cout << ransac.shapes().end() - ransac.shapes().begin() << " detected shapes, "
+     << ransac.number_of_unassigned_points()
+     << " unassigned points." << std::endl;
+  
+  // Efficient_ransac::shapes() provides
+  // an iterator range to the detected shapes.
+  Efficient_ransac::Shape_range shapes = ransac.shapes();
+  Efficient_ransac::Shape_range::iterator it = shapes.begin();
+
+  while (it != shapes.end()) {
+    
+    // Get specific parameters depending on detected shape.
+    if (Plane* plane = dynamic_cast<Plane*>(it->get()))
+      {
+        Kernel::Vector_3 normal = plane->plane_normal();
+        std::cout << "Plane with normal " << normal
+                << std::endl;
+        
+        // Plane shape can also be converted to Kernel::Plane_3
+        std::cout << "Kernel::Plane_3: " << static_cast<Kernel::Plane_3>(*plane) << std::endl;
+      }
+    else if (Cylinder* cyl = dynamic_cast<Cylinder*>(it->get()))
+      {
+        Kernel::Line_3 axis = cyl->axis();
+        FT radius = cyl->radius();
+        std::cout << "Cylinder with axis " << axis
+                  << " and radius " << radius
+                  << std::endl;
+      }
+    else
+      {
+        // Prints the parameters of the detected shape.
+        // This function is available for any type of shape.
+        std::cout << (*it)->info() << std::endl;
+      }
+    
+    // Proceeds with next detected shape.
+    it++;
+  }
+
+  return EXIT_SUCCESS;
+}
diff --git a/3rdparty/CGAL-4.8/examples/Point_set_shape_detection_3/efficient_RANSAC_point_access.cpp b/3rdparty/CGAL/examples/Point_set_shape_detection_3/efficient_RANSAC_point_access.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Point_set_shape_detection_3/efficient_RANSAC_point_access.cpp
rename to 3rdparty/CGAL/examples/Point_set_shape_detection_3/efficient_RANSAC_point_access.cpp
diff --git a/3rdparty/CGAL/examples/Point_set_shape_detection_3/plane_regularization.cpp b/3rdparty/CGAL/examples/Point_set_shape_detection_3/plane_regularization.cpp
new file mode 100644
index 0000000..239b6e8
--- /dev/null
+++ b/3rdparty/CGAL/examples/Point_set_shape_detection_3/plane_regularization.cpp
@@ -0,0 +1,53 @@
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+#include <CGAL/IO/read_xyz_points.h>
+#include <CGAL/Point_with_normal_3.h>
+#include <CGAL/property_map.h>
+
+#include <CGAL/Shape_detection_3.h>
+#include <CGAL/regularize_planes.h>
+
+#include <iostream>
+#include <fstream>
+
+typedef CGAL::Exact_predicates_inexact_constructions_kernel  Kernel;
+typedef std::pair<Kernel::Point_3, Kernel::Vector_3>         Point_with_normal;
+typedef std::vector<Point_with_normal>                       Pwn_vector;
+typedef CGAL::First_of_pair_property_map<Point_with_normal>  Point_map;
+typedef CGAL::Second_of_pair_property_map<Point_with_normal> Normal_map;
+
+typedef CGAL::Shape_detection_3::Efficient_RANSAC_traits
+  <Kernel, Pwn_vector, Point_map, Normal_map>                Traits;
+typedef CGAL::Shape_detection_3::Efficient_RANSAC<Traits>    Efficient_ransac;
+typedef CGAL::Shape_detection_3::Plane<Traits>               Plane;
+
+int main() 
+{
+  Pwn_vector points;
+  std::ifstream stream("data/cube.pwn");
+
+  if (!stream || 
+    !CGAL::read_xyz_points_and_normals(stream,
+      std::back_inserter(points),
+      Point_map(),
+      Normal_map()))
+  {
+      std::cerr << "Error: cannot read file cube.pwn" << std::endl;
+      return EXIT_FAILURE;
+  }
+
+  // Call RANSAC shape detection with planes
+  Efficient_ransac ransac;
+  ransac.set_input(points);
+  ransac.add_shape_factory<Plane>();
+  ransac.detect();
+
+  // Regularize detected planes
+  CGAL::regularize_planes (ransac,
+                           true, // Regularize parallelism
+                           true, // Regularize orthogonality
+                           false, // Do not regularize coplanarity
+                           true, // Regularize Z-symmetry (default)
+                           10); // 10 degrees of tolerance for parallelism/orthogonality
+  
+  return EXIT_SUCCESS;
+}
diff --git a/3rdparty/CGAL-4.8/examples/Poisson_surface_reconstruction_3/CMakeLists.txt b/3rdparty/CGAL/examples/Poisson_surface_reconstruction_3/CMakeLists.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Poisson_surface_reconstruction_3/CMakeLists.txt
rename to 3rdparty/CGAL/examples/Poisson_surface_reconstruction_3/CMakeLists.txt
diff --git a/3rdparty/CGAL-4.8/examples/Poisson_surface_reconstruction_3/data/kitten.xyz b/3rdparty/CGAL/examples/Poisson_surface_reconstruction_3/data/kitten.xyz
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Poisson_surface_reconstruction_3/data/kitten.xyz
rename to 3rdparty/CGAL/examples/Poisson_surface_reconstruction_3/data/kitten.xyz
diff --git a/3rdparty/CGAL-4.8/examples/Poisson_surface_reconstruction_3/data/sphere926.pwn b/3rdparty/CGAL/examples/Poisson_surface_reconstruction_3/data/sphere926.pwn
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Poisson_surface_reconstruction_3/data/sphere926.pwn
rename to 3rdparty/CGAL/examples/Poisson_surface_reconstruction_3/data/sphere926.pwn
diff --git a/3rdparty/CGAL-4.8/examples/Poisson_surface_reconstruction_3/poisson_reconstruction.cmd b/3rdparty/CGAL/examples/Poisson_surface_reconstruction_3/poisson_reconstruction.cmd
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Poisson_surface_reconstruction_3/poisson_reconstruction.cmd
rename to 3rdparty/CGAL/examples/Poisson_surface_reconstruction_3/poisson_reconstruction.cmd
diff --git a/3rdparty/CGAL-4.8/examples/Poisson_surface_reconstruction_3/poisson_reconstruction.cpp b/3rdparty/CGAL/examples/Poisson_surface_reconstruction_3/poisson_reconstruction.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Poisson_surface_reconstruction_3/poisson_reconstruction.cpp
rename to 3rdparty/CGAL/examples/Poisson_surface_reconstruction_3/poisson_reconstruction.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Poisson_surface_reconstruction_3/poisson_reconstruction_example.cpp b/3rdparty/CGAL/examples/Poisson_surface_reconstruction_3/poisson_reconstruction_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Poisson_surface_reconstruction_3/poisson_reconstruction_example.cpp
rename to 3rdparty/CGAL/examples/Poisson_surface_reconstruction_3/poisson_reconstruction_example.cpp
diff --git a/3rdparty/CGAL/examples/Polygon/CMakeLists.txt b/3rdparty/CGAL/examples/Polygon/CMakeLists.txt
new file mode 100644
index 0000000..4a7306d
--- /dev/null
+++ b/3rdparty/CGAL/examples/Polygon/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Polygon_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Polygon/Example.cpp b/3rdparty/CGAL/examples/Polygon/Example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polygon/Example.cpp
rename to 3rdparty/CGAL/examples/Polygon/Example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polygon/Polygon.cpp b/3rdparty/CGAL/examples/Polygon/Polygon.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polygon/Polygon.cpp
rename to 3rdparty/CGAL/examples/Polygon/Polygon.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polygon/polygon_algorithms.cpp b/3rdparty/CGAL/examples/Polygon/polygon_algorithms.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polygon/polygon_algorithms.cpp
rename to 3rdparty/CGAL/examples/Polygon/polygon_algorithms.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polygon/projected_polygon.cpp b/3rdparty/CGAL/examples/Polygon/projected_polygon.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polygon/projected_polygon.cpp
rename to 3rdparty/CGAL/examples/Polygon/projected_polygon.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/CMakeLists.txt b/3rdparty/CGAL/examples/Polygon_mesh_processing/CMakeLists.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/CMakeLists.txt
rename to 3rdparty/CGAL/examples/Polygon_mesh_processing/CMakeLists.txt
diff --git a/3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/compute_normals_example.cpp b/3rdparty/CGAL/examples/Polygon_mesh_processing/compute_normals_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/compute_normals_example.cpp
rename to 3rdparty/CGAL/examples/Polygon_mesh_processing/compute_normals_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/compute_normals_example_OM.cpp b/3rdparty/CGAL/examples/Polygon_mesh_processing/compute_normals_example_OM.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/compute_normals_example_OM.cpp
rename to 3rdparty/CGAL/examples/Polygon_mesh_processing/compute_normals_example_OM.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/connected_components_example.cpp b/3rdparty/CGAL/examples/Polygon_mesh_processing/connected_components_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/connected_components_example.cpp
rename to 3rdparty/CGAL/examples/Polygon_mesh_processing/connected_components_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/data/P.off b/3rdparty/CGAL/examples/Polygon_mesh_processing/data/P.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/data/P.off
rename to 3rdparty/CGAL/examples/Polygon_mesh_processing/data/P.off
diff --git a/3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/data/blobby.off b/3rdparty/CGAL/examples/Polygon_mesh_processing/data/blobby.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/data/blobby.off
rename to 3rdparty/CGAL/examples/Polygon_mesh_processing/data/blobby.off
diff --git a/3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/data/blobby_3cc.off b/3rdparty/CGAL/examples/Polygon_mesh_processing/data/blobby_3cc.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/data/blobby_3cc.off
rename to 3rdparty/CGAL/examples/Polygon_mesh_processing/data/blobby_3cc.off
diff --git a/3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/data/cube_quad.off b/3rdparty/CGAL/examples/Polygon_mesh_processing/data/cube_quad.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/data/cube_quad.off
rename to 3rdparty/CGAL/examples/Polygon_mesh_processing/data/cube_quad.off
diff --git a/3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/data/degtri_sliding.off b/3rdparty/CGAL/examples/Polygon_mesh_processing/data/degtri_sliding.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/data/degtri_sliding.off
rename to 3rdparty/CGAL/examples/Polygon_mesh_processing/data/degtri_sliding.off
diff --git a/3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/data/eight.off b/3rdparty/CGAL/examples/Polygon_mesh_processing/data/eight.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/data/eight.off
rename to 3rdparty/CGAL/examples/Polygon_mesh_processing/data/eight.off
diff --git a/3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/data/full_border_quads.off b/3rdparty/CGAL/examples/Polygon_mesh_processing/data/full_border_quads.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/data/full_border_quads.off
rename to 3rdparty/CGAL/examples/Polygon_mesh_processing/data/full_border_quads.off
diff --git a/3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/data/mech-holes-shark.off b/3rdparty/CGAL/examples/Polygon_mesh_processing/data/mech-holes-shark.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/data/mech-holes-shark.off
rename to 3rdparty/CGAL/examples/Polygon_mesh_processing/data/mech-holes-shark.off
diff --git a/3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/data/pig.off b/3rdparty/CGAL/examples/Polygon_mesh_processing/data/pig.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/data/pig.off
rename to 3rdparty/CGAL/examples/Polygon_mesh_processing/data/pig.off
diff --git a/3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/data/tet-shuffled.off b/3rdparty/CGAL/examples/Polygon_mesh_processing/data/tet-shuffled.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/data/tet-shuffled.off
rename to 3rdparty/CGAL/examples/Polygon_mesh_processing/data/tet-shuffled.off
diff --git a/3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/hole_filling_example.cpp b/3rdparty/CGAL/examples/Polygon_mesh_processing/hole_filling_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/hole_filling_example.cpp
rename to 3rdparty/CGAL/examples/Polygon_mesh_processing/hole_filling_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/hole_filling_example_OM.cpp b/3rdparty/CGAL/examples/Polygon_mesh_processing/hole_filling_example_OM.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/hole_filling_example_OM.cpp
rename to 3rdparty/CGAL/examples/Polygon_mesh_processing/hole_filling_example_OM.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/hole_filling_example_SM.cpp b/3rdparty/CGAL/examples/Polygon_mesh_processing/hole_filling_example_SM.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/hole_filling_example_SM.cpp
rename to 3rdparty/CGAL/examples/Polygon_mesh_processing/hole_filling_example_SM.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/isotropic_remeshing_example.cpp b/3rdparty/CGAL/examples/Polygon_mesh_processing/isotropic_remeshing_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/isotropic_remeshing_example.cpp
rename to 3rdparty/CGAL/examples/Polygon_mesh_processing/isotropic_remeshing_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/mesh_slicer_example.cpp b/3rdparty/CGAL/examples/Polygon_mesh_processing/mesh_slicer_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/mesh_slicer_example.cpp
rename to 3rdparty/CGAL/examples/Polygon_mesh_processing/mesh_slicer_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/point_inside_example.cpp b/3rdparty/CGAL/examples/Polygon_mesh_processing/point_inside_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/point_inside_example.cpp
rename to 3rdparty/CGAL/examples/Polygon_mesh_processing/point_inside_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/point_inside_example_OM.cpp b/3rdparty/CGAL/examples/Polygon_mesh_processing/point_inside_example_OM.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/point_inside_example_OM.cpp
rename to 3rdparty/CGAL/examples/Polygon_mesh_processing/point_inside_example_OM.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/polygon_soup_example.cpp b/3rdparty/CGAL/examples/Polygon_mesh_processing/polygon_soup_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/polygon_soup_example.cpp
rename to 3rdparty/CGAL/examples/Polygon_mesh_processing/polygon_soup_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/refine_fair_example.cpp b/3rdparty/CGAL/examples/Polygon_mesh_processing/refine_fair_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/refine_fair_example.cpp
rename to 3rdparty/CGAL/examples/Polygon_mesh_processing/refine_fair_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/self_intersections_example.cpp b/3rdparty/CGAL/examples/Polygon_mesh_processing/self_intersections_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/self_intersections_example.cpp
rename to 3rdparty/CGAL/examples/Polygon_mesh_processing/self_intersections_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/stitch_borders_example.cpp b/3rdparty/CGAL/examples/Polygon_mesh_processing/stitch_borders_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/stitch_borders_example.cpp
rename to 3rdparty/CGAL/examples/Polygon_mesh_processing/stitch_borders_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/stitch_borders_example_OM.cpp b/3rdparty/CGAL/examples/Polygon_mesh_processing/stitch_borders_example_OM.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/stitch_borders_example_OM.cpp
rename to 3rdparty/CGAL/examples/Polygon_mesh_processing/stitch_borders_example_OM.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/triangulate_faces_example.cpp b/3rdparty/CGAL/examples/Polygon_mesh_processing/triangulate_faces_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/triangulate_faces_example.cpp
rename to 3rdparty/CGAL/examples/Polygon_mesh_processing/triangulate_faces_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/triangulate_faces_example_OM.cpp b/3rdparty/CGAL/examples/Polygon_mesh_processing/triangulate_faces_example_OM.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/triangulate_faces_example_OM.cpp
rename to 3rdparty/CGAL/examples/Polygon_mesh_processing/triangulate_faces_example_OM.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/triangulate_polyline_example.cpp b/3rdparty/CGAL/examples/Polygon_mesh_processing/triangulate_polyline_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polygon_mesh_processing/triangulate_polyline_example.cpp
rename to 3rdparty/CGAL/examples/Polygon_mesh_processing/triangulate_polyline_example.cpp
diff --git a/3rdparty/CGAL/examples/Polyhedron/CMakeLists.txt b/3rdparty/CGAL/examples/Polyhedron/CMakeLists.txt
new file mode 100644
index 0000000..0cb4a25
--- /dev/null
+++ b/3rdparty/CGAL/examples/Polyhedron/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Polyhedron_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron/corner.off b/3rdparty/CGAL/examples/Polyhedron/corner.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron/corner.off
rename to 3rdparty/CGAL/examples/Polyhedron/corner.off
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron/corner_with_hole.off b/3rdparty/CGAL/examples/Polyhedron/corner_with_hole.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron/corner_with_hole.off
rename to 3rdparty/CGAL/examples/Polyhedron/corner_with_hole.off
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron/corner_with_sharp_edge.off b/3rdparty/CGAL/examples/Polyhedron/corner_with_sharp_edge.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron/corner_with_sharp_edge.off
rename to 3rdparty/CGAL/examples/Polyhedron/corner_with_sharp_edge.off
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron/cross.off b/3rdparty/CGAL/examples/Polyhedron/cross.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron/cross.off
rename to 3rdparty/CGAL/examples/Polyhedron/cross.off
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron/polyhedron_prog_color.cpp b/3rdparty/CGAL/examples/Polyhedron/polyhedron_prog_color.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron/polyhedron_prog_color.cpp
rename to 3rdparty/CGAL/examples/Polyhedron/polyhedron_prog_color.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron/polyhedron_prog_cube.cpp b/3rdparty/CGAL/examples/Polyhedron/polyhedron_prog_cube.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron/polyhedron_prog_cube.cpp
rename to 3rdparty/CGAL/examples/Polyhedron/polyhedron_prog_cube.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron/polyhedron_prog_cut_cube.cpp b/3rdparty/CGAL/examples/Polyhedron/polyhedron_prog_cut_cube.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron/polyhedron_prog_cut_cube.cpp
rename to 3rdparty/CGAL/examples/Polyhedron/polyhedron_prog_cut_cube.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron/polyhedron_prog_incr_builder.cpp b/3rdparty/CGAL/examples/Polyhedron/polyhedron_prog_incr_builder.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron/polyhedron_prog_incr_builder.cpp
rename to 3rdparty/CGAL/examples/Polyhedron/polyhedron_prog_incr_builder.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron/polyhedron_prog_normals.cpp b/3rdparty/CGAL/examples/Polyhedron/polyhedron_prog_normals.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron/polyhedron_prog_normals.cpp
rename to 3rdparty/CGAL/examples/Polyhedron/polyhedron_prog_normals.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron/polyhedron_prog_off.cpp b/3rdparty/CGAL/examples/Polyhedron/polyhedron_prog_off.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron/polyhedron_prog_off.cpp
rename to 3rdparty/CGAL/examples/Polyhedron/polyhedron_prog_off.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron/polyhedron_prog_planes.cpp b/3rdparty/CGAL/examples/Polyhedron/polyhedron_prog_planes.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron/polyhedron_prog_planes.cpp
rename to 3rdparty/CGAL/examples/Polyhedron/polyhedron_prog_planes.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron/polyhedron_prog_simple.cpp b/3rdparty/CGAL/examples/Polyhedron/polyhedron_prog_simple.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron/polyhedron_prog_simple.cpp
rename to 3rdparty/CGAL/examples/Polyhedron/polyhedron_prog_simple.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron/polyhedron_prog_subdiv.cin b/3rdparty/CGAL/examples/Polyhedron/polyhedron_prog_subdiv.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron/polyhedron_prog_subdiv.cin
rename to 3rdparty/CGAL/examples/Polyhedron/polyhedron_prog_subdiv.cin
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron/polyhedron_prog_subdiv.cpp b/3rdparty/CGAL/examples/Polyhedron/polyhedron_prog_subdiv.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron/polyhedron_prog_subdiv.cpp
rename to 3rdparty/CGAL/examples/Polyhedron/polyhedron_prog_subdiv.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron/polyhedron_prog_subdiv_with_boundary.cin b/3rdparty/CGAL/examples/Polyhedron/polyhedron_prog_subdiv_with_boundary.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron/polyhedron_prog_subdiv_with_boundary.cin
rename to 3rdparty/CGAL/examples/Polyhedron/polyhedron_prog_subdiv_with_boundary.cin
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron/polyhedron_prog_subdiv_with_boundary.cpp b/3rdparty/CGAL/examples/Polyhedron/polyhedron_prog_subdiv_with_boundary.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron/polyhedron_prog_subdiv_with_boundary.cpp
rename to 3rdparty/CGAL/examples/Polyhedron/polyhedron_prog_subdiv_with_boundary.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron/polyhedron_prog_tetra.cpp b/3rdparty/CGAL/examples/Polyhedron/polyhedron_prog_tetra.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron/polyhedron_prog_tetra.cpp
rename to 3rdparty/CGAL/examples/Polyhedron/polyhedron_prog_tetra.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron/polyhedron_prog_traits.cpp b/3rdparty/CGAL/examples/Polyhedron/polyhedron_prog_traits.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron/polyhedron_prog_traits.cpp
rename to 3rdparty/CGAL/examples/Polyhedron/polyhedron_prog_traits.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron/polyhedron_prog_vector.cpp b/3rdparty/CGAL/examples/Polyhedron/polyhedron_prog_vector.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron/polyhedron_prog_vector.cpp
rename to 3rdparty/CGAL/examples/Polyhedron/polyhedron_prog_vector.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron/polyhedron_prog_vertex_color.cpp b/3rdparty/CGAL/examples/Polyhedron/polyhedron_prog_vertex_color.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron/polyhedron_prog_vertex_color.cpp
rename to 3rdparty/CGAL/examples/Polyhedron/polyhedron_prog_vertex_color.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron/polyhedron_prog_vertex_normal.cpp b/3rdparty/CGAL/examples/Polyhedron/polyhedron_prog_vertex_normal.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron/polyhedron_prog_vertex_normal.cpp
rename to 3rdparty/CGAL/examples/Polyhedron/polyhedron_prog_vertex_normal.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron/polyhedron_self_intersection.cin b/3rdparty/CGAL/examples/Polyhedron/polyhedron_self_intersection.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron/polyhedron_self_intersection.cin
rename to 3rdparty/CGAL/examples/Polyhedron/polyhedron_self_intersection.cin
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron/polyhedron_self_intersection.cpp b/3rdparty/CGAL/examples/Polyhedron/polyhedron_self_intersection.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron/polyhedron_self_intersection.cpp
rename to 3rdparty/CGAL/examples/Polyhedron/polyhedron_self_intersection.cpp
diff --git a/3rdparty/CGAL/examples/Polyhedron_IO/CMakeLists.txt b/3rdparty/CGAL/examples/Polyhedron_IO/CMakeLists.txt
new file mode 100644
index 0000000..eb36221
--- /dev/null
+++ b/3rdparty/CGAL/examples/Polyhedron_IO/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Polyhedron_IO_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron_IO/iv2off.cin b/3rdparty/CGAL/examples/Polyhedron_IO/iv2off.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron_IO/iv2off.cin
rename to 3rdparty/CGAL/examples/Polyhedron_IO/iv2off.cin
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron_IO/iv2off.cpp b/3rdparty/CGAL/examples/Polyhedron_IO/iv2off.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron_IO/iv2off.cpp
rename to 3rdparty/CGAL/examples/Polyhedron_IO/iv2off.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron_IO/off2iv.cin b/3rdparty/CGAL/examples/Polyhedron_IO/off2iv.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron_IO/off2iv.cin
rename to 3rdparty/CGAL/examples/Polyhedron_IO/off2iv.cin
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron_IO/off2iv.cpp b/3rdparty/CGAL/examples/Polyhedron_IO/off2iv.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron_IO/off2iv.cpp
rename to 3rdparty/CGAL/examples/Polyhedron_IO/off2iv.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron_IO/off2off.cin b/3rdparty/CGAL/examples/Polyhedron_IO/off2off.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron_IO/off2off.cin
rename to 3rdparty/CGAL/examples/Polyhedron_IO/off2off.cin
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron_IO/off2off.cpp b/3rdparty/CGAL/examples/Polyhedron_IO/off2off.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron_IO/off2off.cpp
rename to 3rdparty/CGAL/examples/Polyhedron_IO/off2off.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron_IO/off2stl.cin b/3rdparty/CGAL/examples/Polyhedron_IO/off2stl.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron_IO/off2stl.cin
rename to 3rdparty/CGAL/examples/Polyhedron_IO/off2stl.cin
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron_IO/off2stl.cpp b/3rdparty/CGAL/examples/Polyhedron_IO/off2stl.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron_IO/off2stl.cpp
rename to 3rdparty/CGAL/examples/Polyhedron_IO/off2stl.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron_IO/off2vrml.cin b/3rdparty/CGAL/examples/Polyhedron_IO/off2vrml.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron_IO/off2vrml.cin
rename to 3rdparty/CGAL/examples/Polyhedron_IO/off2vrml.cin
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron_IO/off2vrml.cpp b/3rdparty/CGAL/examples/Polyhedron_IO/off2vrml.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron_IO/off2vrml.cpp
rename to 3rdparty/CGAL/examples/Polyhedron_IO/off2vrml.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron_IO/off2wav.cin b/3rdparty/CGAL/examples/Polyhedron_IO/off2wav.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron_IO/off2wav.cin
rename to 3rdparty/CGAL/examples/Polyhedron_IO/off2wav.cin
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron_IO/off2wav.cpp b/3rdparty/CGAL/examples/Polyhedron_IO/off2wav.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron_IO/off2wav.cpp
rename to 3rdparty/CGAL/examples/Polyhedron_IO/off2wav.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron_IO/off_bbox.cin b/3rdparty/CGAL/examples/Polyhedron_IO/off_bbox.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron_IO/off_bbox.cin
rename to 3rdparty/CGAL/examples/Polyhedron_IO/off_bbox.cin
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron_IO/off_bbox.cpp b/3rdparty/CGAL/examples/Polyhedron_IO/off_bbox.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron_IO/off_bbox.cpp
rename to 3rdparty/CGAL/examples/Polyhedron_IO/off_bbox.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron_IO/off_glue.cin b/3rdparty/CGAL/examples/Polyhedron_IO/off_glue.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron_IO/off_glue.cin
rename to 3rdparty/CGAL/examples/Polyhedron_IO/off_glue.cin
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron_IO/off_glue.cpp b/3rdparty/CGAL/examples/Polyhedron_IO/off_glue.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron_IO/off_glue.cpp
rename to 3rdparty/CGAL/examples/Polyhedron_IO/off_glue.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron_IO/off_transform.cin b/3rdparty/CGAL/examples/Polyhedron_IO/off_transform.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron_IO/off_transform.cin
rename to 3rdparty/CGAL/examples/Polyhedron_IO/off_transform.cin
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron_IO/off_transform.cpp b/3rdparty/CGAL/examples/Polyhedron_IO/off_transform.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron_IO/off_transform.cpp
rename to 3rdparty/CGAL/examples/Polyhedron_IO/off_transform.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron_IO/polyhedron2vrml.cin b/3rdparty/CGAL/examples/Polyhedron_IO/polyhedron2vrml.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron_IO/polyhedron2vrml.cin
rename to 3rdparty/CGAL/examples/Polyhedron_IO/polyhedron2vrml.cin
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron_IO/polyhedron2vrml.cpp b/3rdparty/CGAL/examples/Polyhedron_IO/polyhedron2vrml.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron_IO/polyhedron2vrml.cpp
rename to 3rdparty/CGAL/examples/Polyhedron_IO/polyhedron2vrml.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron_IO/polyhedron_copy.cin b/3rdparty/CGAL/examples/Polyhedron_IO/polyhedron_copy.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron_IO/polyhedron_copy.cin
rename to 3rdparty/CGAL/examples/Polyhedron_IO/polyhedron_copy.cin
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron_IO/polyhedron_copy.cpp b/3rdparty/CGAL/examples/Polyhedron_IO/polyhedron_copy.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron_IO/polyhedron_copy.cpp
rename to 3rdparty/CGAL/examples/Polyhedron_IO/polyhedron_copy.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron_IO/terr_trian.cin b/3rdparty/CGAL/examples/Polyhedron_IO/terr_trian.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron_IO/terr_trian.cin
rename to 3rdparty/CGAL/examples/Polyhedron_IO/terr_trian.cin
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron_IO/terr_trian.cpp b/3rdparty/CGAL/examples/Polyhedron_IO/terr_trian.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron_IO/terr_trian.cpp
rename to 3rdparty/CGAL/examples/Polyhedron_IO/terr_trian.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polyhedron_IO/triangulation_print_OFF.h b/3rdparty/CGAL/examples/Polyhedron_IO/triangulation_print_OFF.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyhedron_IO/triangulation_print_OFF.h
rename to 3rdparty/CGAL/examples/Polyhedron_IO/triangulation_print_OFF.h
diff --git a/3rdparty/CGAL/examples/Polyline_simplification_2/CMakeLists.txt b/3rdparty/CGAL/examples/Polyline_simplification_2/CMakeLists.txt
new file mode 100644
index 0000000..240da3e
--- /dev/null
+++ b/3rdparty/CGAL/examples/Polyline_simplification_2/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Polyline_simplification_2_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Polyline_simplification_2/points_and_vertices.cin b/3rdparty/CGAL/examples/Polyline_simplification_2/points_and_vertices.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyline_simplification_2/points_and_vertices.cin
rename to 3rdparty/CGAL/examples/Polyline_simplification_2/points_and_vertices.cin
diff --git a/3rdparty/CGAL-4.8/examples/Polyline_simplification_2/points_and_vertices.cpp b/3rdparty/CGAL/examples/Polyline_simplification_2/points_and_vertices.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyline_simplification_2/points_and_vertices.cpp
rename to 3rdparty/CGAL/examples/Polyline_simplification_2/points_and_vertices.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polyline_simplification_2/simplify.cin b/3rdparty/CGAL/examples/Polyline_simplification_2/simplify.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyline_simplification_2/simplify.cin
rename to 3rdparty/CGAL/examples/Polyline_simplification_2/simplify.cin
diff --git a/3rdparty/CGAL-4.8/examples/Polyline_simplification_2/simplify.cpp b/3rdparty/CGAL/examples/Polyline_simplification_2/simplify.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyline_simplification_2/simplify.cpp
rename to 3rdparty/CGAL/examples/Polyline_simplification_2/simplify.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polyline_simplification_2/simplify_polygon.cin b/3rdparty/CGAL/examples/Polyline_simplification_2/simplify_polygon.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyline_simplification_2/simplify_polygon.cin
rename to 3rdparty/CGAL/examples/Polyline_simplification_2/simplify_polygon.cin
diff --git a/3rdparty/CGAL-4.8/examples/Polyline_simplification_2/simplify_polygon.cpp b/3rdparty/CGAL/examples/Polyline_simplification_2/simplify_polygon.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyline_simplification_2/simplify_polygon.cpp
rename to 3rdparty/CGAL/examples/Polyline_simplification_2/simplify_polygon.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polyline_simplification_2/simplify_polyline.cin b/3rdparty/CGAL/examples/Polyline_simplification_2/simplify_polyline.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyline_simplification_2/simplify_polyline.cin
rename to 3rdparty/CGAL/examples/Polyline_simplification_2/simplify_polyline.cin
diff --git a/3rdparty/CGAL-4.8/examples/Polyline_simplification_2/simplify_polyline.cpp b/3rdparty/CGAL/examples/Polyline_simplification_2/simplify_polyline.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polyline_simplification_2/simplify_polyline.cpp
rename to 3rdparty/CGAL/examples/Polyline_simplification_2/simplify_polyline.cpp
diff --git a/3rdparty/CGAL/examples/Polynomial/CMakeLists.txt b/3rdparty/CGAL/examples/Polynomial/CMakeLists.txt
new file mode 100644
index 0000000..8aa52c1
--- /dev/null
+++ b/3rdparty/CGAL/examples/Polynomial/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Polynomial_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Polynomial/coefficient_access.cpp b/3rdparty/CGAL/examples/Polynomial/coefficient_access.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polynomial/coefficient_access.cpp
rename to 3rdparty/CGAL/examples/Polynomial/coefficient_access.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polynomial/construction.cpp b/3rdparty/CGAL/examples/Polynomial/construction.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polynomial/construction.cpp
rename to 3rdparty/CGAL/examples/Polynomial/construction.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polynomial/degree.cpp b/3rdparty/CGAL/examples/Polynomial/degree.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polynomial/degree.cpp
rename to 3rdparty/CGAL/examples/Polynomial/degree.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polynomial/gcd_up_to_constant_factor.cpp b/3rdparty/CGAL/examples/Polynomial/gcd_up_to_constant_factor.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polynomial/gcd_up_to_constant_factor.cpp
rename to 3rdparty/CGAL/examples/Polynomial/gcd_up_to_constant_factor.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polynomial/subresultants.cpp b/3rdparty/CGAL/examples/Polynomial/subresultants.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polynomial/subresultants.cpp
rename to 3rdparty/CGAL/examples/Polynomial/subresultants.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polynomial/substitute.cpp b/3rdparty/CGAL/examples/Polynomial/substitute.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polynomial/substitute.cpp
rename to 3rdparty/CGAL/examples/Polynomial/substitute.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Polynomial/swap_move.cpp b/3rdparty/CGAL/examples/Polynomial/swap_move.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polynomial/swap_move.cpp
rename to 3rdparty/CGAL/examples/Polynomial/swap_move.cpp
diff --git a/3rdparty/CGAL/examples/Polytope_distance_d/CMakeLists.txt b/3rdparty/CGAL/examples/Polytope_distance_d/CMakeLists.txt
new file mode 100644
index 0000000..cb1ad7b
--- /dev/null
+++ b/3rdparty/CGAL/examples/Polytope_distance_d/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Polytope_distance_d_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Polytope_distance_d/all_furthest_neighbors_2.cpp b/3rdparty/CGAL/examples/Polytope_distance_d/all_furthest_neighbors_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polytope_distance_d/all_furthest_neighbors_2.cpp
rename to 3rdparty/CGAL/examples/Polytope_distance_d/all_furthest_neighbors_2.cpp
diff --git a/3rdparty/CGAL/examples/Polytope_distance_d/polytope_distance_d.cpp b/3rdparty/CGAL/examples/Polytope_distance_d/polytope_distance_d.cpp
new file mode 100644
index 0000000..aded09d
--- /dev/null
+++ b/3rdparty/CGAL/examples/Polytope_distance_d/polytope_distance_d.cpp
@@ -0,0 +1,62 @@
+// computes the distance between two cubes in R^3 using double
+// as input type and some internal EXACT floating point type
+#include <CGAL/Polytope_distance_d.h>
+#include <CGAL/Polytope_distance_d_traits_3.h>
+#include <CGAL/Homogeneous.h>
+#include <iostream>
+#include <cassert>
+
+#ifdef CGAL_USE_GMP
+#include <CGAL/Gmpzf.h>
+typedef CGAL::Gmpzf ET;
+#else
+#include <CGAL/MP_Float.h>
+typedef CGAL::MP_Float ET;
+#endif
+
+// use an EXACT kernel...
+typedef CGAL::Homogeneous<ET>                 K;
+typedef K::Point_3                            Point;
+// ...and the traits class based on the exact kernel
+typedef CGAL::Polytope_distance_d_traits_3<K> Traits;
+typedef CGAL::Polytope_distance_d<Traits>     Polytope_distance;
+
+
+int main()
+{
+  // the cube [0,1]^3
+  Point P[8] = { Point(0,0,0), Point(0,0,1), Point(0,1,0), Point(0,1,1),
+                 Point(1,0,0), Point(1,0,1), Point(1,1,0), Point(1,1,1)};
+
+  // the cube [2,3]^3
+  Point Q[8] = { Point(2,2,2), Point(2,2,3), Point(2,3,2), Point(2,3,3),
+                 Point(3,2,2), Point(3,2,3), Point(3,3,2), Point(3,3,3)};
+
+  Polytope_distance pd(P, P+8, Q, Q+8);
+  assert (pd.is_valid());
+
+  // get squared distance (2,2,2)-(1,1,1))^2 = 3
+  std::cout << "Squared distance: " <<
+    CGAL::to_double (pd.squared_distance_numerator()) /
+    CGAL::to_double (pd.squared_distance_denominator()) << std::endl;
+
+  // get points that realize the distance
+  Polytope_distance::Coordinate_iterator  coord_it;
+
+  std::cout << "p:"; // homogeneous point from first cube, (1,1,1,1)
+  for (coord_it = pd.realizing_point_p_coordinates_begin();
+       coord_it != pd.realizing_point_p_coordinates_end();
+       ++coord_it)
+    std::cout << " " << *coord_it;
+  std::cout << std::endl;
+
+  std::cout << "q:"; // homogeneous point from second cube, (2,2,2,1)
+  for (coord_it = pd.realizing_point_q_coordinates_begin();
+       coord_it != pd.realizing_point_q_coordinates_end();
+       ++coord_it)
+    std::cout << " " << *coord_it;
+  std::cout << std::endl;
+
+  return 0;
+
+}
diff --git a/3rdparty/CGAL/examples/Polytope_distance_d/polytope_distance_d_fast_exact.cpp b/3rdparty/CGAL/examples/Polytope_distance_d/polytope_distance_d_fast_exact.cpp
new file mode 100644
index 0000000..3b2489d
--- /dev/null
+++ b/3rdparty/CGAL/examples/Polytope_distance_d/polytope_distance_d_fast_exact.cpp
@@ -0,0 +1,64 @@
+// computes the distance between two cubes in R^3 using double
+// as input type and some internal EXACT floating point type;
+// the fast type double is also safely used for many of the
+// internal computations
+#include <CGAL/Polytope_distance_d.h>
+#include <CGAL/Polytope_distance_d_traits_3.h>
+#include <CGAL/Homogeneous.h>
+#include <iostream>
+#include <cassert>
+
+#ifdef CGAL_USE_GMP
+#include <CGAL/Gmpzf.h>
+typedef CGAL::Gmpzf ET;
+#else
+#include <CGAL/MP_Float.h>
+typedef CGAL::MP_Float ET;
+#endif
+
+// use an inexact kernel...
+typedef CGAL::Homogeneous<double>                         K;
+typedef K::Point_3                                        Point;
+// ... and the EXACT traits class based on the inexcat kernel
+typedef CGAL::Polytope_distance_d_traits_3<K, ET, double> Traits;
+typedef CGAL::Polytope_distance_d<Traits>                 Polytope_distance;
+
+
+int main()
+{
+  // the cube [0,1]^3
+  Point P[8] = { Point(0,0,0), Point(0,0,1), Point(0,1,0), Point(0,1,1),
+                 Point(1,0,0), Point(1,0,1), Point(1,1,0), Point(1,1,1)};
+
+  // the cube [2,3]^3
+  Point Q[8] = { Point(2,2,2), Point(2,2,3), Point(2,3,2), Point(2,3,3),
+                 Point(3,2,2), Point(3,2,3), Point(3,3,2), Point(3,3,3)};
+
+  Polytope_distance pd(P, P+8, Q, Q+8);
+  assert (pd.is_valid());
+
+  // get squared distance (2,2,2)-(1,1,1))^2 = 3
+  std::cout << "Squared distance: " <<
+    CGAL::to_double (pd.squared_distance_numerator()) /
+    CGAL::to_double (pd.squared_distance_denominator()) << std::endl;
+
+  // get points that realize the distance
+  Polytope_distance::Coordinate_iterator  coord_it;
+
+  std::cout << "p:"; // homogeneous point from first cube, (1,1,1,1)
+  for (coord_it = pd.realizing_point_p_coordinates_begin();
+       coord_it != pd.realizing_point_p_coordinates_end();
+       ++coord_it)
+    std::cout << " " << *coord_it;
+  std::cout << std::endl;
+
+  std::cout << "q:"; // homogeneous point from second cube, (2,2,2,1)
+  for (coord_it = pd.realizing_point_q_coordinates_begin();
+       coord_it != pd.realizing_point_q_coordinates_end();
+       ++coord_it)
+    std::cout << " " << *coord_it;
+  std::cout << std::endl;
+
+  return 0;
+
+}
diff --git a/3rdparty/CGAL-4.8/examples/Polytope_distance_d/width_simplex.cpp b/3rdparty/CGAL/examples/Polytope_distance_d/width_simplex.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Polytope_distance_d/width_simplex.cpp
rename to 3rdparty/CGAL/examples/Polytope_distance_d/width_simplex.cpp
diff --git a/3rdparty/CGAL/examples/Principal_component_analysis/CMakeLists.txt b/3rdparty/CGAL/examples/Principal_component_analysis/CMakeLists.txt
new file mode 100644
index 0000000..b50d141
--- /dev/null
+++ b/3rdparty/CGAL/examples/Principal_component_analysis/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Principal_component_analysis_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Principal_component_analysis/barycenter.cpp b/3rdparty/CGAL/examples/Principal_component_analysis/barycenter.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Principal_component_analysis/barycenter.cpp
rename to 3rdparty/CGAL/examples/Principal_component_analysis/barycenter.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Principal_component_analysis/bounding_box.cpp b/3rdparty/CGAL/examples/Principal_component_analysis/bounding_box.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Principal_component_analysis/bounding_box.cpp
rename to 3rdparty/CGAL/examples/Principal_component_analysis/bounding_box.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Principal_component_analysis/centroid.cpp b/3rdparty/CGAL/examples/Principal_component_analysis/centroid.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Principal_component_analysis/centroid.cpp
rename to 3rdparty/CGAL/examples/Principal_component_analysis/centroid.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Principal_component_analysis/linear_least_squares_fitting_points_2.cpp b/3rdparty/CGAL/examples/Principal_component_analysis/linear_least_squares_fitting_points_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Principal_component_analysis/linear_least_squares_fitting_points_2.cpp
rename to 3rdparty/CGAL/examples/Principal_component_analysis/linear_least_squares_fitting_points_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Principal_component_analysis/linear_least_squares_fitting_triangles_3.cpp b/3rdparty/CGAL/examples/Principal_component_analysis/linear_least_squares_fitting_triangles_3.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Principal_component_analysis/linear_least_squares_fitting_triangles_3.cpp
rename to 3rdparty/CGAL/examples/Principal_component_analysis/linear_least_squares_fitting_triangles_3.cpp
diff --git a/3rdparty/CGAL/examples/Profiling_tools/CMakeLists.txt b/3rdparty/CGAL/examples/Profiling_tools/CMakeLists.txt
new file mode 100644
index 0000000..b2d56d1
--- /dev/null
+++ b/3rdparty/CGAL/examples/Profiling_tools/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Profiling_tools_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Profiling_tools/Profile_counter.cpp b/3rdparty/CGAL/examples/Profiling_tools/Profile_counter.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Profiling_tools/Profile_counter.cpp
rename to 3rdparty/CGAL/examples/Profiling_tools/Profile_counter.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Profiling_tools/Profile_histogram_counter.cpp b/3rdparty/CGAL/examples/Profiling_tools/Profile_histogram_counter.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Profiling_tools/Profile_histogram_counter.cpp
rename to 3rdparty/CGAL/examples/Profiling_tools/Profile_histogram_counter.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Profiling_tools/Profile_timer.cpp b/3rdparty/CGAL/examples/Profiling_tools/Profile_timer.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Profiling_tools/Profile_timer.cpp
rename to 3rdparty/CGAL/examples/Profiling_tools/Profile_timer.cpp
diff --git a/3rdparty/CGAL/examples/QP_solver/CMakeLists.txt b/3rdparty/CGAL/examples/QP_solver/CMakeLists.txt
new file mode 100644
index 0000000..ceecf06
--- /dev/null
+++ b/3rdparty/CGAL/examples/QP_solver/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( QP_solver_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/convex_hull_containment.cpp b/3rdparty/CGAL/examples/QP_solver/convex_hull_containment.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/convex_hull_containment.cpp
rename to 3rdparty/CGAL/examples/QP_solver/convex_hull_containment.cpp
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/convex_hull_containment2.cpp b/3rdparty/CGAL/examples/QP_solver/convex_hull_containment2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/convex_hull_containment2.cpp
rename to 3rdparty/CGAL/examples/QP_solver/convex_hull_containment2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/convex_hull_containment_benchmarks.cpp b/3rdparty/CGAL/examples/QP_solver/convex_hull_containment_benchmarks.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/convex_hull_containment_benchmarks.cpp
rename to 3rdparty/CGAL/examples/QP_solver/convex_hull_containment_benchmarks.cpp
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/cycling.cpp b/3rdparty/CGAL/examples/QP_solver/cycling.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/cycling.cpp
rename to 3rdparty/CGAL/examples/QP_solver/cycling.cpp
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/cycling.mps b/3rdparty/CGAL/examples/QP_solver/cycling.mps
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/cycling.mps
rename to 3rdparty/CGAL/examples/QP_solver/cycling.mps
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/double_qp_solver.cin b/3rdparty/CGAL/examples/QP_solver/double_qp_solver.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/double_qp_solver.cin
rename to 3rdparty/CGAL/examples/QP_solver/double_qp_solver.cin
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/double_qp_solver.data b/3rdparty/CGAL/examples/QP_solver/double_qp_solver.data
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/double_qp_solver.data
rename to 3rdparty/CGAL/examples/QP_solver/double_qp_solver.data
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/first_lp.cpp b/3rdparty/CGAL/examples/QP_solver/first_lp.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/first_lp.cpp
rename to 3rdparty/CGAL/examples/QP_solver/first_lp.cpp
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/first_lp.mps b/3rdparty/CGAL/examples/QP_solver/first_lp.mps
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/first_lp.mps
rename to 3rdparty/CGAL/examples/QP_solver/first_lp.mps
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/first_lp_from_iterators.cpp b/3rdparty/CGAL/examples/QP_solver/first_lp_from_iterators.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/first_lp_from_iterators.cpp
rename to 3rdparty/CGAL/examples/QP_solver/first_lp_from_iterators.cpp
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/first_lp_from_mps.cpp b/3rdparty/CGAL/examples/QP_solver/first_lp_from_mps.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/first_lp_from_mps.cpp
rename to 3rdparty/CGAL/examples/QP_solver/first_lp_from_mps.cpp
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/first_nonnegative_lp.cpp b/3rdparty/CGAL/examples/QP_solver/first_nonnegative_lp.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/first_nonnegative_lp.cpp
rename to 3rdparty/CGAL/examples/QP_solver/first_nonnegative_lp.cpp
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/first_nonnegative_lp.mps b/3rdparty/CGAL/examples/QP_solver/first_nonnegative_lp.mps
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/first_nonnegative_lp.mps
rename to 3rdparty/CGAL/examples/QP_solver/first_nonnegative_lp.mps
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/first_nonnegative_lp_from_iterators.cpp b/3rdparty/CGAL/examples/QP_solver/first_nonnegative_lp_from_iterators.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/first_nonnegative_lp_from_iterators.cpp
rename to 3rdparty/CGAL/examples/QP_solver/first_nonnegative_lp_from_iterators.cpp
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/first_nonnegative_lp_from_mps.cpp b/3rdparty/CGAL/examples/QP_solver/first_nonnegative_lp_from_mps.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/first_nonnegative_lp_from_mps.cpp
rename to 3rdparty/CGAL/examples/QP_solver/first_nonnegative_lp_from_mps.cpp
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/first_nonnegative_qp.cpp b/3rdparty/CGAL/examples/QP_solver/first_nonnegative_qp.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/first_nonnegative_qp.cpp
rename to 3rdparty/CGAL/examples/QP_solver/first_nonnegative_qp.cpp
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/first_nonnegative_qp.mps b/3rdparty/CGAL/examples/QP_solver/first_nonnegative_qp.mps
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/first_nonnegative_qp.mps
rename to 3rdparty/CGAL/examples/QP_solver/first_nonnegative_qp.mps
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/first_nonnegative_qp_from_iterators.cpp b/3rdparty/CGAL/examples/QP_solver/first_nonnegative_qp_from_iterators.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/first_nonnegative_qp_from_iterators.cpp
rename to 3rdparty/CGAL/examples/QP_solver/first_nonnegative_qp_from_iterators.cpp
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/first_nonnegative_qp_from_mps.cpp b/3rdparty/CGAL/examples/QP_solver/first_nonnegative_qp_from_mps.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/first_nonnegative_qp_from_mps.cpp
rename to 3rdparty/CGAL/examples/QP_solver/first_nonnegative_qp_from_mps.cpp
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/first_qp.cpp b/3rdparty/CGAL/examples/QP_solver/first_qp.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/first_qp.cpp
rename to 3rdparty/CGAL/examples/QP_solver/first_qp.cpp
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/first_qp.mps b/3rdparty/CGAL/examples/QP_solver/first_qp.mps
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/first_qp.mps
rename to 3rdparty/CGAL/examples/QP_solver/first_qp.mps
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/first_qp_basic_constraints.cpp b/3rdparty/CGAL/examples/QP_solver/first_qp_basic_constraints.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/first_qp_basic_constraints.cpp
rename to 3rdparty/CGAL/examples/QP_solver/first_qp_basic_constraints.cpp
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/first_qp_from_iterators.cpp b/3rdparty/CGAL/examples/QP_solver/first_qp_from_iterators.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/first_qp_from_iterators.cpp
rename to 3rdparty/CGAL/examples/QP_solver/first_qp_from_iterators.cpp
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/first_qp_from_mps.cpp b/3rdparty/CGAL/examples/QP_solver/first_qp_from_mps.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/first_qp_from_mps.cpp
rename to 3rdparty/CGAL/examples/QP_solver/first_qp_from_mps.cpp
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/important_variables.cpp b/3rdparty/CGAL/examples/QP_solver/important_variables.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/important_variables.cpp
rename to 3rdparty/CGAL/examples/QP_solver/important_variables.cpp
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/infeasibility_certificate.cpp b/3rdparty/CGAL/examples/QP_solver/infeasibility_certificate.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/infeasibility_certificate.cpp
rename to 3rdparty/CGAL/examples/QP_solver/infeasibility_certificate.cpp
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/integer_qp_solver.cin b/3rdparty/CGAL/examples/QP_solver/integer_qp_solver.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/integer_qp_solver.cin
rename to 3rdparty/CGAL/examples/QP_solver/integer_qp_solver.cin
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/integer_qp_solver.data b/3rdparty/CGAL/examples/QP_solver/integer_qp_solver.data
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/integer_qp_solver.data
rename to 3rdparty/CGAL/examples/QP_solver/integer_qp_solver.data
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/invert_matrix.cpp b/3rdparty/CGAL/examples/QP_solver/invert_matrix.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/invert_matrix.cpp
rename to 3rdparty/CGAL/examples/QP_solver/invert_matrix.cpp
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/optimality_certificate.cpp b/3rdparty/CGAL/examples/QP_solver/optimality_certificate.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/optimality_certificate.cpp
rename to 3rdparty/CGAL/examples/QP_solver/optimality_certificate.cpp
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/print_first_lp.cpp b/3rdparty/CGAL/examples/QP_solver/print_first_lp.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/print_first_lp.cpp
rename to 3rdparty/CGAL/examples/QP_solver/print_first_lp.cpp
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/print_first_nonnegative_lp.cpp b/3rdparty/CGAL/examples/QP_solver/print_first_nonnegative_lp.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/print_first_nonnegative_lp.cpp
rename to 3rdparty/CGAL/examples/QP_solver/print_first_nonnegative_lp.cpp
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/print_first_nonnegative_qp.cpp b/3rdparty/CGAL/examples/QP_solver/print_first_nonnegative_qp.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/print_first_nonnegative_qp.cpp
rename to 3rdparty/CGAL/examples/QP_solver/print_first_nonnegative_qp.cpp
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/print_first_qp.cpp b/3rdparty/CGAL/examples/QP_solver/print_first_qp.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/print_first_qp.cpp
rename to 3rdparty/CGAL/examples/QP_solver/print_first_qp.cpp
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/rational_qp_solver.cin b/3rdparty/CGAL/examples/QP_solver/rational_qp_solver.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/rational_qp_solver.cin
rename to 3rdparty/CGAL/examples/QP_solver/rational_qp_solver.cin
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/rational_qp_solver.data b/3rdparty/CGAL/examples/QP_solver/rational_qp_solver.data
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/rational_qp_solver.data
rename to 3rdparty/CGAL/examples/QP_solver/rational_qp_solver.data
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/solve_convex_hull_containment_lp.h b/3rdparty/CGAL/examples/QP_solver/solve_convex_hull_containment_lp.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/solve_convex_hull_containment_lp.h
rename to 3rdparty/CGAL/examples/QP_solver/solve_convex_hull_containment_lp.h
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/solve_convex_hull_containment_lp2.h b/3rdparty/CGAL/examples/QP_solver/solve_convex_hull_containment_lp2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/solve_convex_hull_containment_lp2.h
rename to 3rdparty/CGAL/examples/QP_solver/solve_convex_hull_containment_lp2.h
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/solve_convex_hull_containment_lp3.h b/3rdparty/CGAL/examples/QP_solver/solve_convex_hull_containment_lp3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/solve_convex_hull_containment_lp3.h
rename to 3rdparty/CGAL/examples/QP_solver/solve_convex_hull_containment_lp3.h
diff --git a/3rdparty/CGAL-4.8/examples/QP_solver/unboundedness_certificate.cpp b/3rdparty/CGAL/examples/QP_solver/unboundedness_certificate.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/QP_solver/unboundedness_certificate.cpp
rename to 3rdparty/CGAL/examples/QP_solver/unboundedness_certificate.cpp
diff --git a/3rdparty/CGAL-4.8/examples/RangeSegmentTrees/CMakeLists.txt b/3rdparty/CGAL/examples/RangeSegmentTrees/CMakeLists.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/RangeSegmentTrees/CMakeLists.txt
rename to 3rdparty/CGAL/examples/RangeSegmentTrees/CMakeLists.txt
diff --git a/3rdparty/CGAL-4.8/examples/RangeSegmentTrees/include/Tree_Traits.h b/3rdparty/CGAL/examples/RangeSegmentTrees/include/Tree_Traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/RangeSegmentTrees/include/Tree_Traits.h
rename to 3rdparty/CGAL/examples/RangeSegmentTrees/include/Tree_Traits.h
diff --git a/3rdparty/CGAL-4.8/examples/RangeSegmentTrees/range_tree_1.cpp b/3rdparty/CGAL/examples/RangeSegmentTrees/range_tree_1.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/RangeSegmentTrees/range_tree_1.cpp
rename to 3rdparty/CGAL/examples/RangeSegmentTrees/range_tree_1.cpp
diff --git a/3rdparty/CGAL-4.8/examples/RangeSegmentTrees/range_tree_2.cpp b/3rdparty/CGAL/examples/RangeSegmentTrees/range_tree_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/RangeSegmentTrees/range_tree_2.cpp
rename to 3rdparty/CGAL/examples/RangeSegmentTrees/range_tree_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/RangeSegmentTrees/range_tree_3.cpp b/3rdparty/CGAL/examples/RangeSegmentTrees/range_tree_3.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/RangeSegmentTrees/range_tree_3.cpp
rename to 3rdparty/CGAL/examples/RangeSegmentTrees/range_tree_3.cpp
diff --git a/3rdparty/CGAL-4.8/examples/RangeSegmentTrees/range_tree_4.cpp b/3rdparty/CGAL/examples/RangeSegmentTrees/range_tree_4.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/RangeSegmentTrees/range_tree_4.cpp
rename to 3rdparty/CGAL/examples/RangeSegmentTrees/range_tree_4.cpp
diff --git a/3rdparty/CGAL-4.8/examples/RangeSegmentTrees/range_tree_map_2.cpp b/3rdparty/CGAL/examples/RangeSegmentTrees/range_tree_map_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/RangeSegmentTrees/range_tree_map_2.cpp
rename to 3rdparty/CGAL/examples/RangeSegmentTrees/range_tree_map_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/RangeSegmentTrees/range_tree_set_2.cpp b/3rdparty/CGAL/examples/RangeSegmentTrees/range_tree_set_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/RangeSegmentTrees/range_tree_set_2.cpp
rename to 3rdparty/CGAL/examples/RangeSegmentTrees/range_tree_set_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/RangeSegmentTrees/segment_tree_1.cpp b/3rdparty/CGAL/examples/RangeSegmentTrees/segment_tree_1.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/RangeSegmentTrees/segment_tree_1.cpp
rename to 3rdparty/CGAL/examples/RangeSegmentTrees/segment_tree_1.cpp
diff --git a/3rdparty/CGAL-4.8/examples/RangeSegmentTrees/segment_tree_2.cpp b/3rdparty/CGAL/examples/RangeSegmentTrees/segment_tree_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/RangeSegmentTrees/segment_tree_2.cpp
rename to 3rdparty/CGAL/examples/RangeSegmentTrees/segment_tree_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/RangeSegmentTrees/segment_tree_3.cpp b/3rdparty/CGAL/examples/RangeSegmentTrees/segment_tree_3.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/RangeSegmentTrees/segment_tree_3.cpp
rename to 3rdparty/CGAL/examples/RangeSegmentTrees/segment_tree_3.cpp
diff --git a/3rdparty/CGAL-4.8/examples/RangeSegmentTrees/segment_tree_4.cpp b/3rdparty/CGAL/examples/RangeSegmentTrees/segment_tree_4.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/RangeSegmentTrees/segment_tree_4.cpp
rename to 3rdparty/CGAL/examples/RangeSegmentTrees/segment_tree_4.cpp
diff --git a/3rdparty/CGAL-4.8/examples/RangeSegmentTrees/segment_tree_map_2.cpp b/3rdparty/CGAL/examples/RangeSegmentTrees/segment_tree_map_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/RangeSegmentTrees/segment_tree_map_2.cpp
rename to 3rdparty/CGAL/examples/RangeSegmentTrees/segment_tree_map_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/RangeSegmentTrees/segment_tree_set_2.cpp b/3rdparty/CGAL/examples/RangeSegmentTrees/segment_tree_set_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/RangeSegmentTrees/segment_tree_set_2.cpp
rename to 3rdparty/CGAL/examples/RangeSegmentTrees/segment_tree_set_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/RangeSegmentTrees/segment_tree_set_3.cpp b/3rdparty/CGAL/examples/RangeSegmentTrees/segment_tree_set_3.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/RangeSegmentTrees/segment_tree_set_3.cpp
rename to 3rdparty/CGAL/examples/RangeSegmentTrees/segment_tree_set_3.cpp
diff --git a/3rdparty/CGAL-4.8/examples/RangeSegmentTrees/software_design_rgs.cpp b/3rdparty/CGAL/examples/RangeSegmentTrees/software_design_rgs.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/RangeSegmentTrees/software_design_rgs.cpp
rename to 3rdparty/CGAL/examples/RangeSegmentTrees/software_design_rgs.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Rectangular_p_center_2/CMakeLists.txt b/3rdparty/CGAL/examples/Rectangular_p_center_2/CMakeLists.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Rectangular_p_center_2/CMakeLists.txt
rename to 3rdparty/CGAL/examples/Rectangular_p_center_2/CMakeLists.txt
diff --git a/3rdparty/CGAL-4.8/examples/Rectangular_p_center_2/rectangular_p_center_2.cpp b/3rdparty/CGAL/examples/Rectangular_p_center_2/rectangular_p_center_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Rectangular_p_center_2/rectangular_p_center_2.cpp
rename to 3rdparty/CGAL/examples/Rectangular_p_center_2/rectangular_p_center_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Ridges_3/CMakeLists.txt b/3rdparty/CGAL/examples/Ridges_3/CMakeLists.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Ridges_3/CMakeLists.txt
rename to 3rdparty/CGAL/examples/Ridges_3/CMakeLists.txt
diff --git a/3rdparty/CGAL-4.8/examples/Ridges_3/Compute_Ridges_Umbilics.cpp b/3rdparty/CGAL/examples/Ridges_3/Compute_Ridges_Umbilics.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Ridges_3/Compute_Ridges_Umbilics.cpp
rename to 3rdparty/CGAL/examples/Ridges_3/Compute_Ridges_Umbilics.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Ridges_3/PolyhedralSurf.h b/3rdparty/CGAL/examples/Ridges_3/PolyhedralSurf.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Ridges_3/PolyhedralSurf.h
rename to 3rdparty/CGAL/examples/Ridges_3/PolyhedralSurf.h
diff --git a/3rdparty/CGAL-4.8/examples/Ridges_3/PolyhedralSurf_rings.h b/3rdparty/CGAL/examples/Ridges_3/PolyhedralSurf_rings.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Ridges_3/PolyhedralSurf_rings.h
rename to 3rdparty/CGAL/examples/Ridges_3/PolyhedralSurf_rings.h
diff --git a/3rdparty/CGAL-4.8/examples/Ridges_3/README b/3rdparty/CGAL/examples/Ridges_3/README
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Ridges_3/README
rename to 3rdparty/CGAL/examples/Ridges_3/README
diff --git a/3rdparty/CGAL-4.8/examples/Ridges_3/Ridges_Umbilics_SM.cpp b/3rdparty/CGAL/examples/Ridges_3/Ridges_Umbilics_SM.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Ridges_3/Ridges_Umbilics_SM.cpp
rename to 3rdparty/CGAL/examples/Ridges_3/Ridges_Umbilics_SM.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Ridges_3/compute_normals.h b/3rdparty/CGAL/examples/Ridges_3/compute_normals.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Ridges_3/compute_normals.h
rename to 3rdparty/CGAL/examples/Ridges_3/compute_normals.h
diff --git a/3rdparty/CGAL-4.8/examples/Ridges_3/data/poly2x^2+y^2-0.062500.off b/3rdparty/CGAL/examples/Ridges_3/data/poly2x^2+y^2-0.062500.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Ridges_3/data/poly2x^2+y^2-0.062500.off
rename to 3rdparty/CGAL/examples/Ridges_3/data/poly2x^2+y^2-0.062500.off
diff --git a/3rdparty/CGAL-4.8/examples/Ridges_3/skip_vcproj_auto_generation b/3rdparty/CGAL/examples/Ridges_3/skip_vcproj_auto_generation
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Ridges_3/skip_vcproj_auto_generation
rename to 3rdparty/CGAL/examples/Ridges_3/skip_vcproj_auto_generation
diff --git a/3rdparty/CGAL/examples/STL_Extension/CMakeLists.txt b/3rdparty/CGAL/examples/STL_Extension/CMakeLists.txt
new file mode 100644
index 0000000..c8263df
--- /dev/null
+++ b/3rdparty/CGAL/examples/STL_Extension/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( STL_Extension_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/STL_Extension/Default.cpp b/3rdparty/CGAL/examples/STL_Extension/Default.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/STL_Extension/Default.cpp
rename to 3rdparty/CGAL/examples/STL_Extension/Default.cpp
diff --git a/3rdparty/CGAL-4.8/examples/STL_Extension/Dispatch_output_iterator.cpp b/3rdparty/CGAL/examples/STL_Extension/Dispatch_output_iterator.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/STL_Extension/Dispatch_output_iterator.cpp
rename to 3rdparty/CGAL/examples/STL_Extension/Dispatch_output_iterator.cpp
diff --git a/3rdparty/CGAL-4.8/examples/STL_Extension/in_place_list_prog.cpp b/3rdparty/CGAL/examples/STL_Extension/in_place_list_prog.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/STL_Extension/in_place_list_prog.cpp
rename to 3rdparty/CGAL/examples/STL_Extension/in_place_list_prog.cpp
diff --git a/3rdparty/CGAL-4.8/examples/STL_Extension/min_element_if_example.cpp b/3rdparty/CGAL/examples/STL_Extension/min_element_if_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/STL_Extension/min_element_if_example.cpp
rename to 3rdparty/CGAL/examples/STL_Extension/min_element_if_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/STL_Extension/min_max_element_example.cpp b/3rdparty/CGAL/examples/STL_Extension/min_max_element_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/STL_Extension/min_max_element_example.cpp
rename to 3rdparty/CGAL/examples/STL_Extension/min_max_element_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/STL_Extension/unordered_map.cpp b/3rdparty/CGAL/examples/STL_Extension/unordered_map.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/STL_Extension/unordered_map.cpp
rename to 3rdparty/CGAL/examples/STL_Extension/unordered_map.cpp
diff --git a/3rdparty/CGAL/examples/Scale_space_reconstruction_3/CMakeLists.txt b/3rdparty/CGAL/examples/Scale_space_reconstruction_3/CMakeLists.txt
new file mode 100644
index 0000000..4f0c1db
--- /dev/null
+++ b/3rdparty/CGAL/examples/Scale_space_reconstruction_3/CMakeLists.txt
@@ -0,0 +1,40 @@
+project( Scale_space )
+
+cmake_minimum_required(VERSION 2.8.11)
+
+find_package( CGAL QUIET)
+
+if ( CGAL_FOUND )
+  include( ${CGAL_USE_FILE} )
+
+  # Activate concurrency?
+  option(ACTIVATE_CONCURRENCY
+         "Enable concurrency"
+         ON)
+ 
+  if( ACTIVATE_CONCURRENCY )
+    find_package( TBB )
+    if( TBB_FOUND )
+      include( ${TBB_USE_FILE} )
+      list( APPEND CGAL_3RD_PARTY_LIBRARIES ${TBB_LIBRARIES} )
+    else()
+      message( STATUS "NOTICE: Intel TBB NOT found! The example is faster if TBB is linked." )
+    endif()
+  endif()
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  find_package( Eigen3 3.1.0 )
+  if( EIGEN3_FOUND )
+    include( ${EIGEN3_USE_FILE} )
+    create_single_source_cgal_program( "scale_space.cpp" )
+    create_single_source_cgal_program( "scale_space_incremental.cpp" )
+    create_single_source_cgal_program( "scale_space_manifold.cpp" )
+  else()
+    message( STATUS "NOTICE: The example needs Eigen 3.1 (or greater) and will not be compiled." )
+  endif()
+else()
+  
+  message( STATUS "This program requires the CGAL library, and will not be compiled." )
+  
+endif()
diff --git a/3rdparty/CGAL-4.8/examples/Scale_space_reconstruction_3/data/kitten.off b/3rdparty/CGAL/examples/Scale_space_reconstruction_3/data/kitten.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Scale_space_reconstruction_3/data/kitten.off
rename to 3rdparty/CGAL/examples/Scale_space_reconstruction_3/data/kitten.off
diff --git a/3rdparty/CGAL-4.8/examples/Scale_space_reconstruction_3/scale_space.cmd b/3rdparty/CGAL/examples/Scale_space_reconstruction_3/scale_space.cmd
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Scale_space_reconstruction_3/scale_space.cmd
rename to 3rdparty/CGAL/examples/Scale_space_reconstruction_3/scale_space.cmd
diff --git a/3rdparty/CGAL-4.8/examples/Scale_space_reconstruction_3/scale_space.cpp b/3rdparty/CGAL/examples/Scale_space_reconstruction_3/scale_space.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Scale_space_reconstruction_3/scale_space.cpp
rename to 3rdparty/CGAL/examples/Scale_space_reconstruction_3/scale_space.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Scale_space_reconstruction_3/scale_space_incremental.cmd b/3rdparty/CGAL/examples/Scale_space_reconstruction_3/scale_space_incremental.cmd
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Scale_space_reconstruction_3/scale_space_incremental.cmd
rename to 3rdparty/CGAL/examples/Scale_space_reconstruction_3/scale_space_incremental.cmd
diff --git a/3rdparty/CGAL-4.8/examples/Scale_space_reconstruction_3/scale_space_incremental.cpp b/3rdparty/CGAL/examples/Scale_space_reconstruction_3/scale_space_incremental.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Scale_space_reconstruction_3/scale_space_incremental.cpp
rename to 3rdparty/CGAL/examples/Scale_space_reconstruction_3/scale_space_incremental.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Scale_space_reconstruction_3/scale_space_manifold.cmd b/3rdparty/CGAL/examples/Scale_space_reconstruction_3/scale_space_manifold.cmd
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Scale_space_reconstruction_3/scale_space_manifold.cmd
rename to 3rdparty/CGAL/examples/Scale_space_reconstruction_3/scale_space_manifold.cmd
diff --git a/3rdparty/CGAL-4.8/examples/Scale_space_reconstruction_3/scale_space_manifold.cpp b/3rdparty/CGAL/examples/Scale_space_reconstruction_3/scale_space_manifold.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Scale_space_reconstruction_3/scale_space_manifold.cpp
rename to 3rdparty/CGAL/examples/Scale_space_reconstruction_3/scale_space_manifold.cpp
diff --git a/3rdparty/CGAL/examples/Segment_Delaunay_graph_2/CMakeLists.txt b/3rdparty/CGAL/examples/Segment_Delaunay_graph_2/CMakeLists.txt
new file mode 100644
index 0000000..9dc0d25
--- /dev/null
+++ b/3rdparty/CGAL/examples/Segment_Delaunay_graph_2/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Segment_Delaunay_graph_2_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_2/data/sites.cin b/3rdparty/CGAL/examples/Segment_Delaunay_graph_2/data/sites.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_2/data/sites.cin
rename to 3rdparty/CGAL/examples/Segment_Delaunay_graph_2/data/sites.cin
diff --git a/3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_2/data/sites2.cin b/3rdparty/CGAL/examples/Segment_Delaunay_graph_2/data/sites2.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_2/data/sites2.cin
rename to 3rdparty/CGAL/examples/Segment_Delaunay_graph_2/data/sites2.cin
diff --git a/3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_2/data/sitesx.cin b/3rdparty/CGAL/examples/Segment_Delaunay_graph_2/data/sitesx.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_2/data/sitesx.cin
rename to 3rdparty/CGAL/examples/Segment_Delaunay_graph_2/data/sitesx.cin
diff --git a/3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_2/data/sitesxx.cin b/3rdparty/CGAL/examples/Segment_Delaunay_graph_2/data/sitesxx.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_2/data/sitesxx.cin
rename to 3rdparty/CGAL/examples/Segment_Delaunay_graph_2/data/sitesxx.cin
diff --git a/3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_2/data/sitesxx.rb.cin b/3rdparty/CGAL/examples/Segment_Delaunay_graph_2/data/sitesxx.rb.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_2/data/sitesxx.rb.cin
rename to 3rdparty/CGAL/examples/Segment_Delaunay_graph_2/data/sitesxx.rb.cin
diff --git a/3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_2/sdg-count-sites.cpp b/3rdparty/CGAL/examples/Segment_Delaunay_graph_2/sdg-count-sites.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_2/sdg-count-sites.cpp
rename to 3rdparty/CGAL/examples/Segment_Delaunay_graph_2/sdg-count-sites.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_2/sdg-fast-sp-polygon.cpp b/3rdparty/CGAL/examples/Segment_Delaunay_graph_2/sdg-fast-sp-polygon.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_2/sdg-fast-sp-polygon.cpp
rename to 3rdparty/CGAL/examples/Segment_Delaunay_graph_2/sdg-fast-sp-polygon.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_2/sdg-fast-sp.cpp b/3rdparty/CGAL/examples/Segment_Delaunay_graph_2/sdg-fast-sp.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_2/sdg-fast-sp.cpp
rename to 3rdparty/CGAL/examples/Segment_Delaunay_graph_2/sdg-fast-sp.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_2/sdg-filtered-traits.cpp b/3rdparty/CGAL/examples/Segment_Delaunay_graph_2/sdg-filtered-traits.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_2/sdg-filtered-traits.cpp
rename to 3rdparty/CGAL/examples/Segment_Delaunay_graph_2/sdg-filtered-traits.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_2/sdg-info-set.cpp b/3rdparty/CGAL/examples/Segment_Delaunay_graph_2/sdg-info-set.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_2/sdg-info-set.cpp
rename to 3rdparty/CGAL/examples/Segment_Delaunay_graph_2/sdg-info-set.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_2/sdg-red-blue-info.cpp b/3rdparty/CGAL/examples/Segment_Delaunay_graph_2/sdg-red-blue-info.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_2/sdg-red-blue-info.cpp
rename to 3rdparty/CGAL/examples/Segment_Delaunay_graph_2/sdg-red-blue-info.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_2/sdg-voronoi-edges.cpp b/3rdparty/CGAL/examples/Segment_Delaunay_graph_2/sdg-voronoi-edges.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_2/sdg-voronoi-edges.cpp
rename to 3rdparty/CGAL/examples/Segment_Delaunay_graph_2/sdg-voronoi-edges.cpp
diff --git a/3rdparty/CGAL/examples/Segment_Delaunay_graph_Linf_2/CMakeLists.txt b/3rdparty/CGAL/examples/Segment_Delaunay_graph_Linf_2/CMakeLists.txt
new file mode 100644
index 0000000..32ec42b
--- /dev/null
+++ b/3rdparty/CGAL/examples/Segment_Delaunay_graph_Linf_2/CMakeLists.txt
@@ -0,0 +1,35 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Segment_Delaunay_graph_Linf_2_example )
+
+cmake_minimum_required(VERSION 2.8.11)
+
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  create_single_source_cgal_program( "sdg-count-sites-linf.cpp" )
+  create_single_source_cgal_program( "sdg-fast-sp-linf.cpp" )
+  create_single_source_cgal_program( "sdg-fast-sp-polygon-linf.cpp" )
+  create_single_source_cgal_program( "sdg-filtered-traits-linf.cpp" )
+  create_single_source_cgal_program( "sdg-info-set-linf.cpp" )
+  create_single_source_cgal_program( "sdg-red-blue-info-linf.cpp" )
+  create_single_source_cgal_program( "sdg-voronoi-edges-linf.cpp" )
+  create_single_source_cgal_program( "sdg-voronoi-edges-exact-linf.cpp" )
+  create_single_source_cgal_program( "print-sdg-linf.cpp" )
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_Linf_2/data/sites.cin b/3rdparty/CGAL/examples/Segment_Delaunay_graph_Linf_2/data/sites.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_Linf_2/data/sites.cin
rename to 3rdparty/CGAL/examples/Segment_Delaunay_graph_Linf_2/data/sites.cin
diff --git a/3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_Linf_2/data/sites2.cin b/3rdparty/CGAL/examples/Segment_Delaunay_graph_Linf_2/data/sites2.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_Linf_2/data/sites2.cin
rename to 3rdparty/CGAL/examples/Segment_Delaunay_graph_Linf_2/data/sites2.cin
diff --git a/3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_Linf_2/data/sitesx.cin b/3rdparty/CGAL/examples/Segment_Delaunay_graph_Linf_2/data/sitesx.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_Linf_2/data/sitesx.cin
rename to 3rdparty/CGAL/examples/Segment_Delaunay_graph_Linf_2/data/sitesx.cin
diff --git a/3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_Linf_2/data/sitesxx.cin b/3rdparty/CGAL/examples/Segment_Delaunay_graph_Linf_2/data/sitesxx.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_Linf_2/data/sitesxx.cin
rename to 3rdparty/CGAL/examples/Segment_Delaunay_graph_Linf_2/data/sitesxx.cin
diff --git a/3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_Linf_2/data/sitesxx.rb.cin b/3rdparty/CGAL/examples/Segment_Delaunay_graph_Linf_2/data/sitesxx.rb.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_Linf_2/data/sitesxx.rb.cin
rename to 3rdparty/CGAL/examples/Segment_Delaunay_graph_Linf_2/data/sitesxx.rb.cin
diff --git a/3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_Linf_2/print-sdg-linf.cpp b/3rdparty/CGAL/examples/Segment_Delaunay_graph_Linf_2/print-sdg-linf.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_Linf_2/print-sdg-linf.cpp
rename to 3rdparty/CGAL/examples/Segment_Delaunay_graph_Linf_2/print-sdg-linf.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_Linf_2/sdg-count-sites-linf.cpp b/3rdparty/CGAL/examples/Segment_Delaunay_graph_Linf_2/sdg-count-sites-linf.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_Linf_2/sdg-count-sites-linf.cpp
rename to 3rdparty/CGAL/examples/Segment_Delaunay_graph_Linf_2/sdg-count-sites-linf.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_Linf_2/sdg-fast-sp-linf.cpp b/3rdparty/CGAL/examples/Segment_Delaunay_graph_Linf_2/sdg-fast-sp-linf.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_Linf_2/sdg-fast-sp-linf.cpp
rename to 3rdparty/CGAL/examples/Segment_Delaunay_graph_Linf_2/sdg-fast-sp-linf.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_Linf_2/sdg-fast-sp-polygon-linf.cpp b/3rdparty/CGAL/examples/Segment_Delaunay_graph_Linf_2/sdg-fast-sp-polygon-linf.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_Linf_2/sdg-fast-sp-polygon-linf.cpp
rename to 3rdparty/CGAL/examples/Segment_Delaunay_graph_Linf_2/sdg-fast-sp-polygon-linf.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_Linf_2/sdg-filtered-traits-linf.cpp b/3rdparty/CGAL/examples/Segment_Delaunay_graph_Linf_2/sdg-filtered-traits-linf.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_Linf_2/sdg-filtered-traits-linf.cpp
rename to 3rdparty/CGAL/examples/Segment_Delaunay_graph_Linf_2/sdg-filtered-traits-linf.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_Linf_2/sdg-info-set-linf.cpp b/3rdparty/CGAL/examples/Segment_Delaunay_graph_Linf_2/sdg-info-set-linf.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_Linf_2/sdg-info-set-linf.cpp
rename to 3rdparty/CGAL/examples/Segment_Delaunay_graph_Linf_2/sdg-info-set-linf.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_Linf_2/sdg-red-blue-info-linf.cpp b/3rdparty/CGAL/examples/Segment_Delaunay_graph_Linf_2/sdg-red-blue-info-linf.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_Linf_2/sdg-red-blue-info-linf.cpp
rename to 3rdparty/CGAL/examples/Segment_Delaunay_graph_Linf_2/sdg-red-blue-info-linf.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_Linf_2/sdg-voronoi-edges-exact-linf.cpp b/3rdparty/CGAL/examples/Segment_Delaunay_graph_Linf_2/sdg-voronoi-edges-exact-linf.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_Linf_2/sdg-voronoi-edges-exact-linf.cpp
rename to 3rdparty/CGAL/examples/Segment_Delaunay_graph_Linf_2/sdg-voronoi-edges-exact-linf.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_Linf_2/sdg-voronoi-edges-linf.cpp b/3rdparty/CGAL/examples/Segment_Delaunay_graph_Linf_2/sdg-voronoi-edges-linf.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Segment_Delaunay_graph_Linf_2/sdg-voronoi-edges-linf.cpp
rename to 3rdparty/CGAL/examples/Segment_Delaunay_graph_Linf_2/sdg-voronoi-edges-linf.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Skin_surface_3/CMakeLists.txt b/3rdparty/CGAL/examples/Skin_surface_3/CMakeLists.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Skin_surface_3/CMakeLists.txt
rename to 3rdparty/CGAL/examples/Skin_surface_3/CMakeLists.txt
diff --git a/3rdparty/CGAL-4.8/examples/Skin_surface_3/data/1IYE.pdb b/3rdparty/CGAL/examples/Skin_surface_3/data/1IYE.pdb
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Skin_surface_3/data/1IYE.pdb
rename to 3rdparty/CGAL/examples/Skin_surface_3/data/1IYE.pdb
diff --git a/3rdparty/CGAL-4.8/examples/Skin_surface_3/data/1mvm.pdb b/3rdparty/CGAL/examples/Skin_surface_3/data/1mvm.pdb
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Skin_surface_3/data/1mvm.pdb
rename to 3rdparty/CGAL/examples/Skin_surface_3/data/1mvm.pdb
diff --git a/3rdparty/CGAL-4.8/examples/Skin_surface_3/data/1t7i.pdb b/3rdparty/CGAL/examples/Skin_surface_3/data/1t7i.pdb
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Skin_surface_3/data/1t7i.pdb
rename to 3rdparty/CGAL/examples/Skin_surface_3/data/1t7i.pdb
diff --git a/3rdparty/CGAL-4.8/examples/Skin_surface_3/data/4lfq.pdb b/3rdparty/CGAL/examples/Skin_surface_3/data/4lfq.pdb
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Skin_surface_3/data/4lfq.pdb
rename to 3rdparty/CGAL/examples/Skin_surface_3/data/4lfq.pdb
diff --git a/3rdparty/CGAL-4.8/examples/Skin_surface_3/data/caffeine.cin b/3rdparty/CGAL/examples/Skin_surface_3/data/caffeine.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Skin_surface_3/data/caffeine.cin
rename to 3rdparty/CGAL/examples/Skin_surface_3/data/caffeine.cin
diff --git a/3rdparty/CGAL-4.8/examples/Skin_surface_3/data/molecule_tunnel.cin b/3rdparty/CGAL/examples/Skin_surface_3/data/molecule_tunnel.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Skin_surface_3/data/molecule_tunnel.cin
rename to 3rdparty/CGAL/examples/Skin_surface_3/data/molecule_tunnel.cin
diff --git a/3rdparty/CGAL-4.8/examples/Skin_surface_3/include/extract_balls_from_pdb.h b/3rdparty/CGAL/examples/Skin_surface_3/include/extract_balls_from_pdb.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Skin_surface_3/include/extract_balls_from_pdb.h
rename to 3rdparty/CGAL/examples/Skin_surface_3/include/extract_balls_from_pdb.h
diff --git a/3rdparty/CGAL-4.8/examples/Skin_surface_3/skin_surface_pdb_reader.cpp b/3rdparty/CGAL/examples/Skin_surface_3/skin_surface_pdb_reader.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Skin_surface_3/skin_surface_pdb_reader.cpp
rename to 3rdparty/CGAL/examples/Skin_surface_3/skin_surface_pdb_reader.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Skin_surface_3/skin_surface_retrieve_defining_weighted_points.cpp b/3rdparty/CGAL/examples/Skin_surface_3/skin_surface_retrieve_defining_weighted_points.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Skin_surface_3/skin_surface_retrieve_defining_weighted_points.cpp
rename to 3rdparty/CGAL/examples/Skin_surface_3/skin_surface_retrieve_defining_weighted_points.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Skin_surface_3/skin_surface_simple.cpp b/3rdparty/CGAL/examples/Skin_surface_3/skin_surface_simple.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Skin_surface_3/skin_surface_simple.cpp
rename to 3rdparty/CGAL/examples/Skin_surface_3/skin_surface_simple.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Skin_surface_3/skin_surface_subdiv.cpp b/3rdparty/CGAL/examples/Skin_surface_3/skin_surface_subdiv.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Skin_surface_3/skin_surface_subdiv.cpp
rename to 3rdparty/CGAL/examples/Skin_surface_3/skin_surface_subdiv.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Skin_surface_3/skin_surface_subdiv_with_normals.cpp b/3rdparty/CGAL/examples/Skin_surface_3/skin_surface_subdiv_with_normals.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Skin_surface_3/skin_surface_subdiv_with_normals.cpp
rename to 3rdparty/CGAL/examples/Skin_surface_3/skin_surface_subdiv_with_normals.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Skin_surface_3/skin_surface_writer.h b/3rdparty/CGAL/examples/Skin_surface_3/skin_surface_writer.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Skin_surface_3/skin_surface_writer.h
rename to 3rdparty/CGAL/examples/Skin_surface_3/skin_surface_writer.h
diff --git a/3rdparty/CGAL-4.8/examples/Skin_surface_3/union_of_balls_simple.cpp b/3rdparty/CGAL/examples/Skin_surface_3/union_of_balls_simple.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Skin_surface_3/union_of_balls_simple.cpp
rename to 3rdparty/CGAL/examples/Skin_surface_3/union_of_balls_simple.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Skin_surface_3/union_of_balls_subdiv.cpp b/3rdparty/CGAL/examples/Skin_surface_3/union_of_balls_subdiv.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Skin_surface_3/union_of_balls_subdiv.cpp
rename to 3rdparty/CGAL/examples/Skin_surface_3/union_of_balls_subdiv.cpp
diff --git a/3rdparty/CGAL/examples/Snap_rounding_2/CMakeLists.txt b/3rdparty/CGAL/examples/Snap_rounding_2/CMakeLists.txt
new file mode 100644
index 0000000..40167a9
--- /dev/null
+++ b/3rdparty/CGAL/examples/Snap_rounding_2/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Snap_rounding_2_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Snap_rounding_2/data/snap_rounding_data b/3rdparty/CGAL/examples/Snap_rounding_2/data/snap_rounding_data
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Snap_rounding_2/data/snap_rounding_data
rename to 3rdparty/CGAL/examples/Snap_rounding_2/data/snap_rounding_data
diff --git a/3rdparty/CGAL-4.8/examples/Snap_rounding_2/snap_rounding.cpp b/3rdparty/CGAL/examples/Snap_rounding_2/snap_rounding.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Snap_rounding_2/snap_rounding.cpp
rename to 3rdparty/CGAL/examples/Snap_rounding_2/snap_rounding.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Snap_rounding_2/snap_rounding_data.cpp b/3rdparty/CGAL/examples/Snap_rounding_2/snap_rounding_data.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Snap_rounding_2/snap_rounding_data.cpp
rename to 3rdparty/CGAL/examples/Snap_rounding_2/snap_rounding_data.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Snap_rounding_2/snap_rounding_to_integer.cpp b/3rdparty/CGAL/examples/Snap_rounding_2/snap_rounding_to_integer.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Snap_rounding_2/snap_rounding_to_integer.cpp
rename to 3rdparty/CGAL/examples/Snap_rounding_2/snap_rounding_to_integer.cpp
diff --git a/3rdparty/CGAL/examples/Solver_interface/CMakeLists.txt b/3rdparty/CGAL/examples/Solver_interface/CMakeLists.txt
new file mode 100644
index 0000000..b50fe87
--- /dev/null
+++ b/3rdparty/CGAL/examples/Solver_interface/CMakeLists.txt
@@ -0,0 +1,35 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( examples_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../include")
+  
+  # Use Eigen
+  find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater)
+
+  if (EIGEN3_FOUND)
+    include( ${EIGEN3_USE_FILE} )
+    create_single_source_cgal_program( "singular_value_decomposition.cpp" )
+    create_single_source_cgal_program( "sparse_solvers.cpp" )
+  endif()
+
+  create_single_source_cgal_program( "diagonalize_matrix.cpp" )
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Solver_interface/diagonalize_matrix.cpp b/3rdparty/CGAL/examples/Solver_interface/diagonalize_matrix.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Solver_interface/diagonalize_matrix.cpp
rename to 3rdparty/CGAL/examples/Solver_interface/diagonalize_matrix.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Solver_interface/singular_value_decomposition.cpp b/3rdparty/CGAL/examples/Solver_interface/singular_value_decomposition.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Solver_interface/singular_value_decomposition.cpp
rename to 3rdparty/CGAL/examples/Solver_interface/singular_value_decomposition.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Solver_interface/sparse_solvers.cpp b/3rdparty/CGAL/examples/Solver_interface/sparse_solvers.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Solver_interface/sparse_solvers.cpp
rename to 3rdparty/CGAL/examples/Solver_interface/sparse_solvers.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Spatial_searching/CMakeLists.txt b/3rdparty/CGAL/examples/Spatial_searching/CMakeLists.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Spatial_searching/CMakeLists.txt
rename to 3rdparty/CGAL/examples/Spatial_searching/CMakeLists.txt
diff --git a/3rdparty/CGAL-4.8/examples/Spatial_searching/Distance.h b/3rdparty/CGAL/examples/Spatial_searching/Distance.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Spatial_searching/Distance.h
rename to 3rdparty/CGAL/examples/Spatial_searching/Distance.h
diff --git a/3rdparty/CGAL-4.8/examples/Spatial_searching/Point.h b/3rdparty/CGAL/examples/Spatial_searching/Point.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Spatial_searching/Point.h
rename to 3rdparty/CGAL/examples/Spatial_searching/Point.h
diff --git a/3rdparty/CGAL-4.8/examples/Spatial_searching/circular_query.cpp b/3rdparty/CGAL/examples/Spatial_searching/circular_query.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Spatial_searching/circular_query.cpp
rename to 3rdparty/CGAL/examples/Spatial_searching/circular_query.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Spatial_searching/data/tripod.off b/3rdparty/CGAL/examples/Spatial_searching/data/tripod.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Spatial_searching/data/tripod.off
rename to 3rdparty/CGAL/examples/Spatial_searching/data/tripod.off
diff --git a/3rdparty/CGAL-4.8/examples/Spatial_searching/distance_browsing.cpp b/3rdparty/CGAL/examples/Spatial_searching/distance_browsing.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Spatial_searching/distance_browsing.cpp
rename to 3rdparty/CGAL/examples/Spatial_searching/distance_browsing.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Spatial_searching/fuzzy_range_query.cpp b/3rdparty/CGAL/examples/Spatial_searching/fuzzy_range_query.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Spatial_searching/fuzzy_range_query.cpp
rename to 3rdparty/CGAL/examples/Spatial_searching/fuzzy_range_query.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Spatial_searching/general_neighbor_searching.cpp b/3rdparty/CGAL/examples/Spatial_searching/general_neighbor_searching.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Spatial_searching/general_neighbor_searching.cpp
rename to 3rdparty/CGAL/examples/Spatial_searching/general_neighbor_searching.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Spatial_searching/iso_rectangle_2_query.cpp b/3rdparty/CGAL/examples/Spatial_searching/iso_rectangle_2_query.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Spatial_searching/iso_rectangle_2_query.cpp
rename to 3rdparty/CGAL/examples/Spatial_searching/iso_rectangle_2_query.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Spatial_searching/nearest_neighbor_searching.cpp b/3rdparty/CGAL/examples/Spatial_searching/nearest_neighbor_searching.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Spatial_searching/nearest_neighbor_searching.cpp
rename to 3rdparty/CGAL/examples/Spatial_searching/nearest_neighbor_searching.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Spatial_searching/searching_polyhedron_vertices.cpp b/3rdparty/CGAL/examples/Spatial_searching/searching_polyhedron_vertices.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Spatial_searching/searching_polyhedron_vertices.cpp
rename to 3rdparty/CGAL/examples/Spatial_searching/searching_polyhedron_vertices.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Spatial_searching/searching_polyhedron_vertices_with_fuzzy_sphere.cpp b/3rdparty/CGAL/examples/Spatial_searching/searching_polyhedron_vertices_with_fuzzy_sphere.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Spatial_searching/searching_polyhedron_vertices_with_fuzzy_sphere.cpp
rename to 3rdparty/CGAL/examples/Spatial_searching/searching_polyhedron_vertices_with_fuzzy_sphere.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Spatial_searching/searching_sphere_orthogonally.cpp b/3rdparty/CGAL/examples/Spatial_searching/searching_sphere_orthogonally.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Spatial_searching/searching_sphere_orthogonally.cpp
rename to 3rdparty/CGAL/examples/Spatial_searching/searching_sphere_orthogonally.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Spatial_searching/searching_surface_mesh_vertices.cpp b/3rdparty/CGAL/examples/Spatial_searching/searching_surface_mesh_vertices.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Spatial_searching/searching_surface_mesh_vertices.cpp
rename to 3rdparty/CGAL/examples/Spatial_searching/searching_surface_mesh_vertices.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Spatial_searching/searching_with_circular_query.cpp b/3rdparty/CGAL/examples/Spatial_searching/searching_with_circular_query.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Spatial_searching/searching_with_circular_query.cpp
rename to 3rdparty/CGAL/examples/Spatial_searching/searching_with_circular_query.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Spatial_searching/searching_with_point_with_info.cpp b/3rdparty/CGAL/examples/Spatial_searching/searching_with_point_with_info.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Spatial_searching/searching_with_point_with_info.cpp
rename to 3rdparty/CGAL/examples/Spatial_searching/searching_with_point_with_info.cpp
diff --git a/3rdparty/CGAL/examples/Spatial_searching/searching_with_point_with_info_inplace.cpp b/3rdparty/CGAL/examples/Spatial_searching/searching_with_point_with_info_inplace.cpp
new file mode 100644
index 0000000..6d761ca
--- /dev/null
+++ b/3rdparty/CGAL/examples/Spatial_searching/searching_with_point_with_info_inplace.cpp
@@ -0,0 +1,76 @@
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+#include <CGAL/Search_traits_3.h>
+#include <CGAL/Search_traits_adapter.h>
+#include <CGAL/point_generators_3.h>
+#include <CGAL/Orthogonal_k_neighbor_search.h>
+#include <boost/iterator/counting_iterator.hpp>
+#include <utility>
+
+typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
+typedef Kernel::Point_3 Point_3;
+
+//definition of a non-mutable lvalue property map,
+//with the get function as a friend function to give it
+//access to the private member
+class My_point_property_map{
+  const std::vector<Point_3>& points;
+public:
+  typedef Point_3 value_type;
+  typedef const value_type& reference;
+  typedef std::size_t key_type;
+  typedef boost::lvalue_property_map_tag category;  
+
+  My_point_property_map(const std::vector<Point_3>& pts):points(pts){}
+
+  reference operator[](key_type k) const {return points[k];}
+
+  friend reference get(const My_point_property_map& ppmap,key_type i) 
+  {return ppmap[i];}
+};
+
+
+typedef CGAL::Random_points_in_cube_3<Point_3>                               Random_points_iterator;
+typedef CGAL::Search_traits_3<Kernel>                                        Traits_base;
+typedef CGAL::Search_traits_adapter<std::size_t,My_point_property_map,Traits_base> Traits;
+
+
+typedef CGAL::Orthogonal_k_neighbor_search<Traits>                      K_neighbor_search;
+typedef K_neighbor_search::Tree                                         Tree;
+typedef Tree::Splitter                                                  Splitter;
+typedef K_neighbor_search::Distance                                     Distance;
+
+int main() {
+  const unsigned int K = 5;
+  // generator for random data points in the cube ( (-1,-1,-1), (1,1,1) )
+  Random_points_iterator rpit( 1.0);
+  std::vector<Point_3> points;
+  
+  points.push_back(Point_3(*rpit++));
+  points.push_back(Point_3(*rpit++));
+  points.push_back(Point_3(*rpit++));
+  points.push_back(Point_3(*rpit++));
+  points.push_back(Point_3(*rpit++));
+  points.push_back(Point_3(*rpit++));
+  points.push_back(Point_3(*rpit++));
+
+  My_point_property_map ppmap(points);
+
+  // Insert number_of_data_points in the tree
+  Tree tree(
+    boost::counting_iterator<std::size_t>(0),
+    boost::counting_iterator<std::size_t>(points.size()),
+    Splitter(),
+    Traits(ppmap)
+  );
+  Point_3 query(0.0, 0.0, 0.0);
+  Distance tr_dist(ppmap);
+
+  // search K nearest neighbours
+  K_neighbor_search search(tree, query, K,0,true,tr_dist);
+  for(K_neighbor_search::iterator it = search.begin(); it != search.end(); it++){
+    std::cout << " d(q, nearest neighbor)=  "
+	      << tr_dist.inverse_of_transformed_distance(it->second) << " " 
+              << points[it->first] << " " << it->first << std::endl;
+  }
+  return 0;
+}
diff --git a/3rdparty/CGAL/examples/Spatial_searching/searching_with_point_with_info_pmap.cpp b/3rdparty/CGAL/examples/Spatial_searching/searching_with_point_with_info_pmap.cpp
new file mode 100644
index 0000000..8b51fd1
--- /dev/null
+++ b/3rdparty/CGAL/examples/Spatial_searching/searching_with_point_with_info_pmap.cpp
@@ -0,0 +1,58 @@
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+#include <CGAL/Search_traits_3.h>
+#include <CGAL/Search_traits_adapter.h>
+#include <CGAL/point_generators_3.h>
+#include <CGAL/Orthogonal_k_neighbor_search.h>
+#include <boost/iterator/counting_iterator.hpp>
+#include <utility>
+
+typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
+typedef Kernel::Point_3 Point_3;
+
+typedef boost::const_associative_property_map<std::map<std::size_t,Point_3> >           My_point_property_map;
+  
+typedef CGAL::Random_points_in_cube_3<Point_3>                                          Random_points_iterator;
+typedef CGAL::Search_traits_3<Kernel>                                                   Traits_base;
+typedef CGAL::Search_traits_adapter<std::size_t,My_point_property_map,Traits_base>      Traits;
+
+
+typedef CGAL::Orthogonal_k_neighbor_search<Traits>                      K_neighbor_search;
+typedef K_neighbor_search::Tree                                         Tree;
+typedef Tree::Splitter                                                  Splitter;
+typedef K_neighbor_search::Distance                                     Distance;
+
+int main() {
+  const unsigned int K = 5;
+  // generator for random data points in the cube ( (-1,-1,-1), (1,1,1) )
+  Random_points_iterator rpit( 1.0);
+  std::map<std::size_t,Point_3> points;
+  
+  points[0]=Point_3(*rpit++);
+  points[1]=Point_3(*rpit++);
+  points[2]=Point_3(*rpit++);
+  points[3]=Point_3(*rpit++);
+  points[4]=Point_3(*rpit++);
+  points[5]=Point_3(*rpit++);
+  points[6]=Point_3(*rpit++);
+
+  My_point_property_map ppmap(points);
+
+  // Insert number_of_data_points in the tree
+  Tree tree(
+    boost::counting_iterator<std::size_t>(0),
+    boost::counting_iterator<std::size_t>(points.size()),
+    Splitter(),
+    Traits(ppmap)
+  );
+  Point_3 query(0.0, 0.0, 0.0);
+  Distance tr_dist(ppmap);
+
+  // search K nearest neighbours
+  K_neighbor_search search(tree, query, K,0,true,tr_dist);
+  for(K_neighbor_search::iterator it = search.begin(); it != search.end(); it++){
+    std::cout << " d(q, nearest neighbor)=  "
+	      << tr_dist.inverse_of_transformed_distance(it->second) << " "
+              << points[it->first] << " " << it->first << std::endl;
+  }
+  return 0;
+}
diff --git a/3rdparty/CGAL-4.8/examples/Spatial_searching/splitter_worst_cases.cpp b/3rdparty/CGAL/examples/Spatial_searching/splitter_worst_cases.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Spatial_searching/splitter_worst_cases.cpp
rename to 3rdparty/CGAL/examples/Spatial_searching/splitter_worst_cases.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Spatial_searching/user_defined_point_and_distance.cpp b/3rdparty/CGAL/examples/Spatial_searching/user_defined_point_and_distance.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Spatial_searching/user_defined_point_and_distance.cpp
rename to 3rdparty/CGAL/examples/Spatial_searching/user_defined_point_and_distance.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Spatial_searching/using_fair_splitting_rule.cpp b/3rdparty/CGAL/examples/Spatial_searching/using_fair_splitting_rule.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Spatial_searching/using_fair_splitting_rule.cpp
rename to 3rdparty/CGAL/examples/Spatial_searching/using_fair_splitting_rule.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Spatial_searching/weighted_Minkowski_distance.cpp b/3rdparty/CGAL/examples/Spatial_searching/weighted_Minkowski_distance.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Spatial_searching/weighted_Minkowski_distance.cpp
rename to 3rdparty/CGAL/examples/Spatial_searching/weighted_Minkowski_distance.cpp
diff --git a/3rdparty/CGAL/examples/Spatial_sorting/CMakeLists.txt b/3rdparty/CGAL/examples/Spatial_sorting/CMakeLists.txt
new file mode 100644
index 0000000..7c06403
--- /dev/null
+++ b/3rdparty/CGAL/examples/Spatial_sorting/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Spatial_sorting_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Spatial_sorting/example_delaunay_2.cpp b/3rdparty/CGAL/examples/Spatial_sorting/example_delaunay_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Spatial_sorting/example_delaunay_2.cpp
rename to 3rdparty/CGAL/examples/Spatial_sorting/example_delaunay_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Spatial_sorting/hilbert.cpp b/3rdparty/CGAL/examples/Spatial_sorting/hilbert.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Spatial_sorting/hilbert.cpp
rename to 3rdparty/CGAL/examples/Spatial_sorting/hilbert.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Spatial_sorting/hilbert_policies.cpp b/3rdparty/CGAL/examples/Spatial_sorting/hilbert_policies.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Spatial_sorting/hilbert_policies.cpp
rename to 3rdparty/CGAL/examples/Spatial_sorting/hilbert_policies.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Spatial_sorting/hilbert_sort_on_sphere.cpp b/3rdparty/CGAL/examples/Spatial_sorting/hilbert_sort_on_sphere.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Spatial_sorting/hilbert_sort_on_sphere.cpp
rename to 3rdparty/CGAL/examples/Spatial_sorting/hilbert_sort_on_sphere.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Spatial_sorting/myPoint.cpp b/3rdparty/CGAL/examples/Spatial_sorting/myPoint.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Spatial_sorting/myPoint.cpp
rename to 3rdparty/CGAL/examples/Spatial_sorting/myPoint.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Spatial_sorting/small_example_delaunay_2.cpp b/3rdparty/CGAL/examples/Spatial_sorting/small_example_delaunay_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Spatial_sorting/small_example_delaunay_2.cpp
rename to 3rdparty/CGAL/examples/Spatial_sorting/small_example_delaunay_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Spatial_sorting/sort_indices.cpp b/3rdparty/CGAL/examples/Spatial_sorting/sort_indices.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Spatial_sorting/sort_indices.cpp
rename to 3rdparty/CGAL/examples/Spatial_sorting/sort_indices.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Spatial_sorting/sp_sort_using_property_map_2.cpp b/3rdparty/CGAL/examples/Spatial_sorting/sp_sort_using_property_map_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Spatial_sorting/sp_sort_using_property_map_2.cpp
rename to 3rdparty/CGAL/examples/Spatial_sorting/sp_sort_using_property_map_2.cpp
diff --git a/3rdparty/CGAL/examples/Spatial_sorting/sp_sort_using_property_map_3.cpp b/3rdparty/CGAL/examples/Spatial_sorting/sp_sort_using_property_map_3.cpp
new file mode 100644
index 0000000..fdda1a6
--- /dev/null
+++ b/3rdparty/CGAL/examples/Spatial_sorting/sp_sort_using_property_map_3.cpp
@@ -0,0 +1,39 @@
+#include <CGAL/Simple_cartesian.h>
+#include <CGAL/spatial_sort.h>
+#include <CGAL/Spatial_sort_traits_adapter_3.h>
+#include <vector>
+#include <boost/iterator/counting_iterator.hpp>
+
+typedef CGAL::Simple_cartesian<double>                  Kernel;
+typedef Kernel::Point_3                                 Point_3;
+typedef CGAL::Spatial_sort_traits_adapter_3<Kernel,
+          CGAL::Pointer_property_map<Point_3>::type > Search_traits_3;
+
+int main()
+{
+  std::vector<Point_3> points;
+  points.push_back(Point_3(1,3,11));
+  points.push_back(Point_3(14,34,46));
+  points.push_back(Point_3(414,34,4));
+  points.push_back(Point_3(4,2,56));
+  points.push_back(Point_3(744,4154,43));
+  points.push_back(Point_3(74,44,1));
+  
+  std::vector<std::size_t> indices;
+  indices.reserve(points.size());
+  
+  std::copy(boost::counting_iterator<std::size_t>(0),
+            boost::counting_iterator<std::size_t>(points.size()),
+            std::back_inserter(indices));
+  
+  CGAL::spatial_sort( indices.begin(),
+                      indices.end(),
+                      Search_traits_3(CGAL::make_property_map(points)) );
+
+  for (std::vector<std::size_t>::iterator it=indices.begin();it!=indices.end();++it)
+    std::cout << points[*it] << "\n";
+
+  std::cout << "done" << std::endl;
+  
+  return 0;
+}
diff --git a/3rdparty/CGAL-4.8/examples/Spatial_sorting/sp_sort_using_property_map_d.cpp b/3rdparty/CGAL/examples/Spatial_sorting/sp_sort_using_property_map_d.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Spatial_sorting/sp_sort_using_property_map_d.cpp
rename to 3rdparty/CGAL/examples/Spatial_sorting/sp_sort_using_property_map_d.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Spatial_sorting/spatial_sort_on_sphere.cpp b/3rdparty/CGAL/examples/Spatial_sorting/spatial_sort_on_sphere.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Spatial_sorting/spatial_sort_on_sphere.cpp
rename to 3rdparty/CGAL/examples/Spatial_sorting/spatial_sort_on_sphere.cpp
diff --git a/3rdparty/CGAL/examples/Straight_skeleton_2/CMakeLists.txt b/3rdparty/CGAL/examples/Straight_skeleton_2/CMakeLists.txt
new file mode 100644
index 0000000..ebca91e
--- /dev/null
+++ b/3rdparty/CGAL/examples/Straight_skeleton_2/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Straight_skeleton_2_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET COMPONENTS Core )
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Straight_skeleton_2/Create_offset_polygons_2.cpp b/3rdparty/CGAL/examples/Straight_skeleton_2/Create_offset_polygons_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Straight_skeleton_2/Create_offset_polygons_2.cpp
rename to 3rdparty/CGAL/examples/Straight_skeleton_2/Create_offset_polygons_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Straight_skeleton_2/Create_saop_from_polygon_with_holes_2.cpp b/3rdparty/CGAL/examples/Straight_skeleton_2/Create_saop_from_polygon_with_holes_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Straight_skeleton_2/Create_saop_from_polygon_with_holes_2.cpp
rename to 3rdparty/CGAL/examples/Straight_skeleton_2/Create_saop_from_polygon_with_holes_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Straight_skeleton_2/Create_skeleton_and_offset_polygons_2.cpp b/3rdparty/CGAL/examples/Straight_skeleton_2/Create_skeleton_and_offset_polygons_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Straight_skeleton_2/Create_skeleton_and_offset_polygons_2.cpp
rename to 3rdparty/CGAL/examples/Straight_skeleton_2/Create_skeleton_and_offset_polygons_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Straight_skeleton_2/Create_skeleton_and_offset_polygons_with_holes_2.cpp b/3rdparty/CGAL/examples/Straight_skeleton_2/Create_skeleton_and_offset_polygons_with_holes_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Straight_skeleton_2/Create_skeleton_and_offset_polygons_with_holes_2.cpp
rename to 3rdparty/CGAL/examples/Straight_skeleton_2/Create_skeleton_and_offset_polygons_with_holes_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Straight_skeleton_2/Create_straight_skeleton_2.cpp b/3rdparty/CGAL/examples/Straight_skeleton_2/Create_straight_skeleton_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Straight_skeleton_2/Create_straight_skeleton_2.cpp
rename to 3rdparty/CGAL/examples/Straight_skeleton_2/Create_straight_skeleton_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Straight_skeleton_2/Create_straight_skeleton_from_polygon_with_holes_2.cpp b/3rdparty/CGAL/examples/Straight_skeleton_2/Create_straight_skeleton_from_polygon_with_holes_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Straight_skeleton_2/Create_straight_skeleton_from_polygon_with_holes_2.cpp
rename to 3rdparty/CGAL/examples/Straight_skeleton_2/Create_straight_skeleton_from_polygon_with_holes_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Straight_skeleton_2/Low_level_API.cpp b/3rdparty/CGAL/examples/Straight_skeleton_2/Low_level_API.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Straight_skeleton_2/Low_level_API.cpp
rename to 3rdparty/CGAL/examples/Straight_skeleton_2/Low_level_API.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Straight_skeleton_2/Show_offset_polygon.cpp b/3rdparty/CGAL/examples/Straight_skeleton_2/Show_offset_polygon.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Straight_skeleton_2/Show_offset_polygon.cpp
rename to 3rdparty/CGAL/examples/Straight_skeleton_2/Show_offset_polygon.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Straight_skeleton_2/Show_straight_skeleton.cpp b/3rdparty/CGAL/examples/Straight_skeleton_2/Show_straight_skeleton.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Straight_skeleton_2/Show_straight_skeleton.cpp
rename to 3rdparty/CGAL/examples/Straight_skeleton_2/Show_straight_skeleton.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Straight_skeleton_2/dump_to_eps.h b/3rdparty/CGAL/examples/Straight_skeleton_2/dump_to_eps.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Straight_skeleton_2/dump_to_eps.h
rename to 3rdparty/CGAL/examples/Straight_skeleton_2/dump_to_eps.h
diff --git a/3rdparty/CGAL-4.8/examples/Straight_skeleton_2/input_file_format.txt b/3rdparty/CGAL/examples/Straight_skeleton_2/input_file_format.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Straight_skeleton_2/input_file_format.txt
rename to 3rdparty/CGAL/examples/Straight_skeleton_2/input_file_format.txt
diff --git a/3rdparty/CGAL-4.8/examples/Straight_skeleton_2/print.h b/3rdparty/CGAL/examples/Straight_skeleton_2/print.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Straight_skeleton_2/print.h
rename to 3rdparty/CGAL/examples/Straight_skeleton_2/print.h
diff --git a/3rdparty/CGAL-4.8/examples/Straight_skeleton_2/sample_1.dat b/3rdparty/CGAL/examples/Straight_skeleton_2/sample_1.dat
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Straight_skeleton_2/sample_1.dat
rename to 3rdparty/CGAL/examples/Straight_skeleton_2/sample_1.dat
diff --git a/3rdparty/CGAL-4.8/examples/Straight_skeleton_2/sample_2.dat b/3rdparty/CGAL/examples/Straight_skeleton_2/sample_2.dat
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Straight_skeleton_2/sample_2.dat
rename to 3rdparty/CGAL/examples/Straight_skeleton_2/sample_2.dat
diff --git a/3rdparty/CGAL-4.8/examples/Straight_skeleton_2/sample_3.dat b/3rdparty/CGAL/examples/Straight_skeleton_2/sample_3.dat
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Straight_skeleton_2/sample_3.dat
rename to 3rdparty/CGAL/examples/Straight_skeleton_2/sample_3.dat
diff --git a/3rdparty/CGAL-4.8/examples/Straight_skeleton_2/sample_4.dat b/3rdparty/CGAL/examples/Straight_skeleton_2/sample_4.dat
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Straight_skeleton_2/sample_4.dat
rename to 3rdparty/CGAL/examples/Straight_skeleton_2/sample_4.dat
diff --git a/3rdparty/CGAL/examples/Stream_lines_2/CMakeLists.txt b/3rdparty/CGAL/examples/Stream_lines_2/CMakeLists.txt
new file mode 100644
index 0000000..2d751ad
--- /dev/null
+++ b/3rdparty/CGAL/examples/Stream_lines_2/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Stream_lines_2_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Stream_lines_2/data/datap.tri.cin b/3rdparty/CGAL/examples/Stream_lines_2/data/datap.tri.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Stream_lines_2/data/datap.tri.cin
rename to 3rdparty/CGAL/examples/Stream_lines_2/data/datap.tri.cin
diff --git a/3rdparty/CGAL-4.8/examples/Stream_lines_2/data/datav.tri.cin b/3rdparty/CGAL/examples/Stream_lines_2/data/datav.tri.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Stream_lines_2/data/datav.tri.cin
rename to 3rdparty/CGAL/examples/Stream_lines_2/data/datav.tri.cin
diff --git a/3rdparty/CGAL-4.8/examples/Stream_lines_2/data/irregular_data.tri.cin b/3rdparty/CGAL/examples/Stream_lines_2/data/irregular_data.tri.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Stream_lines_2/data/irregular_data.tri.cin
rename to 3rdparty/CGAL/examples/Stream_lines_2/data/irregular_data.tri.cin
diff --git a/3rdparty/CGAL-4.8/examples/Stream_lines_2/data/vnoise.vec.cin b/3rdparty/CGAL/examples/Stream_lines_2/data/vnoise.vec.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Stream_lines_2/data/vnoise.vec.cin
rename to 3rdparty/CGAL/examples/Stream_lines_2/data/vnoise.vec.cin
diff --git a/3rdparty/CGAL-4.8/examples/Stream_lines_2/stl_regular_field.cpp b/3rdparty/CGAL/examples/Stream_lines_2/stl_regular_field.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Stream_lines_2/stl_regular_field.cpp
rename to 3rdparty/CGAL/examples/Stream_lines_2/stl_regular_field.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Stream_lines_2/stl_triangular_field.cpp b/3rdparty/CGAL/examples/Stream_lines_2/stl_triangular_field.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Stream_lines_2/stl_triangular_field.cpp
rename to 3rdparty/CGAL/examples/Stream_lines_2/stl_triangular_field.cpp
diff --git a/3rdparty/CGAL/examples/Subdivision_method_3/CMakeLists.txt b/3rdparty/CGAL/examples/Subdivision_method_3/CMakeLists.txt
new file mode 100644
index 0000000..2f71180
--- /dev/null
+++ b/3rdparty/CGAL/examples/Subdivision_method_3/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Subdivision_method_3_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Subdivision_method_3/CatmullClark_subdivision.cpp b/3rdparty/CGAL/examples/Subdivision_method_3/CatmullClark_subdivision.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Subdivision_method_3/CatmullClark_subdivision.cpp
rename to 3rdparty/CGAL/examples/Subdivision_method_3/CatmullClark_subdivision.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Subdivision_method_3/Customized_subdivision.cpp b/3rdparty/CGAL/examples/Subdivision_method_3/Customized_subdivision.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Subdivision_method_3/Customized_subdivision.cpp
rename to 3rdparty/CGAL/examples/Subdivision_method_3/Customized_subdivision.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Subdivision_method_3/DooSabin_subdivision.cpp b/3rdparty/CGAL/examples/Subdivision_method_3/DooSabin_subdivision.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Subdivision_method_3/DooSabin_subdivision.cpp
rename to 3rdparty/CGAL/examples/Subdivision_method_3/DooSabin_subdivision.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Subdivision_method_3/Loop_subdivision.cpp b/3rdparty/CGAL/examples/Subdivision_method_3/Loop_subdivision.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Subdivision_method_3/Loop_subdivision.cpp
rename to 3rdparty/CGAL/examples/Subdivision_method_3/Loop_subdivision.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Subdivision_method_3/data/corner.off b/3rdparty/CGAL/examples/Subdivision_method_3/data/corner.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Subdivision_method_3/data/corner.off
rename to 3rdparty/CGAL/examples/Subdivision_method_3/data/corner.off
diff --git a/3rdparty/CGAL-4.8/examples/Subdivision_method_3/data/corner_tris_with_hole.off b/3rdparty/CGAL/examples/Subdivision_method_3/data/corner_tris_with_hole.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Subdivision_method_3/data/corner_tris_with_hole.off
rename to 3rdparty/CGAL/examples/Subdivision_method_3/data/corner_tris_with_hole.off
diff --git a/3rdparty/CGAL-4.8/examples/Subdivision_method_3/data/corner_with_hole.off b/3rdparty/CGAL/examples/Subdivision_method_3/data/corner_with_hole.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Subdivision_method_3/data/corner_with_hole.off
rename to 3rdparty/CGAL/examples/Subdivision_method_3/data/corner_with_hole.off
diff --git a/3rdparty/CGAL-4.8/examples/Subdivision_method_3/data/corner_with_sharp_edge.off b/3rdparty/CGAL/examples/Subdivision_method_3/data/corner_with_sharp_edge.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Subdivision_method_3/data/corner_with_sharp_edge.off
rename to 3rdparty/CGAL/examples/Subdivision_method_3/data/corner_with_sharp_edge.off
diff --git a/3rdparty/CGAL-4.8/examples/Subdivision_method_3/data/cross.off b/3rdparty/CGAL/examples/Subdivision_method_3/data/cross.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Subdivision_method_3/data/cross.off
rename to 3rdparty/CGAL/examples/Subdivision_method_3/data/cross.off
diff --git a/3rdparty/CGAL-4.8/examples/Subdivision_method_3/data/quint_tris.off b/3rdparty/CGAL/examples/Subdivision_method_3/data/quint_tris.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Subdivision_method_3/data/quint_tris.off
rename to 3rdparty/CGAL/examples/Subdivision_method_3/data/quint_tris.off
diff --git a/3rdparty/CGAL/examples/Surface_mesh/CMakeLists.txt b/3rdparty/CGAL/examples/Surface_mesh/CMakeLists.txt
new file mode 100644
index 0000000..f84a6e4
--- /dev/null
+++ b/3rdparty/CGAL/examples/Surface_mesh/CMakeLists.txt
@@ -0,0 +1,35 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Surface_mesh_ )
+
+cmake_minimum_required(VERSION 2.8.11)
+
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  create_single_source_cgal_program( "sm_join.cpp" )
+  create_single_source_cgal_program( "sm_aabbtree.cpp" )
+  create_single_source_cgal_program( "sm_bgl.cpp" )
+  create_single_source_cgal_program( "sm_circulators.cpp" )
+  create_single_source_cgal_program( "sm_do_intersect.cpp" )
+  create_single_source_cgal_program( "sm_iterators.cpp" )
+  create_single_source_cgal_program( "sm_kruskal.cpp" )
+  create_single_source_cgal_program( "sm_memory.cpp" )
+  create_single_source_cgal_program( "sm_properties.cpp" )
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh/cube.off b/3rdparty/CGAL/examples/Surface_mesh/cube.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh/cube.off
rename to 3rdparty/CGAL/examples/Surface_mesh/cube.off
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh/data/elephant.off b/3rdparty/CGAL/examples/Surface_mesh/data/elephant.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh/data/elephant.off
rename to 3rdparty/CGAL/examples/Surface_mesh/data/elephant.off
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh/data/knot1.off b/3rdparty/CGAL/examples/Surface_mesh/data/knot1.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh/data/knot1.off
rename to 3rdparty/CGAL/examples/Surface_mesh/data/knot1.off
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh/data/quad.off b/3rdparty/CGAL/examples/Surface_mesh/data/quad.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh/data/quad.off
rename to 3rdparty/CGAL/examples/Surface_mesh/data/quad.off
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh/data/triangle.off b/3rdparty/CGAL/examples/Surface_mesh/data/triangle.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh/data/triangle.off
rename to 3rdparty/CGAL/examples/Surface_mesh/data/triangle.off
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh/sm_aabbtree.cpp b/3rdparty/CGAL/examples/Surface_mesh/sm_aabbtree.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh/sm_aabbtree.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh/sm_aabbtree.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh/sm_bgl.cmd b/3rdparty/CGAL/examples/Surface_mesh/sm_bgl.cmd
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh/sm_bgl.cmd
rename to 3rdparty/CGAL/examples/Surface_mesh/sm_bgl.cmd
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh/sm_bgl.cpp b/3rdparty/CGAL/examples/Surface_mesh/sm_bgl.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh/sm_bgl.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh/sm_bgl.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh/sm_circulators.cpp b/3rdparty/CGAL/examples/Surface_mesh/sm_circulators.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh/sm_circulators.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh/sm_circulators.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh/sm_do_intersect.cmd b/3rdparty/CGAL/examples/Surface_mesh/sm_do_intersect.cmd
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh/sm_do_intersect.cmd
rename to 3rdparty/CGAL/examples/Surface_mesh/sm_do_intersect.cmd
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh/sm_do_intersect.cpp b/3rdparty/CGAL/examples/Surface_mesh/sm_do_intersect.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh/sm_do_intersect.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh/sm_do_intersect.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh/sm_iterators.cpp b/3rdparty/CGAL/examples/Surface_mesh/sm_iterators.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh/sm_iterators.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh/sm_iterators.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh/sm_join.cpp b/3rdparty/CGAL/examples/Surface_mesh/sm_join.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh/sm_join.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh/sm_join.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh/sm_kruskal.cmd b/3rdparty/CGAL/examples/Surface_mesh/sm_kruskal.cmd
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh/sm_kruskal.cmd
rename to 3rdparty/CGAL/examples/Surface_mesh/sm_kruskal.cmd
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh/sm_kruskal.cpp b/3rdparty/CGAL/examples/Surface_mesh/sm_kruskal.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh/sm_kruskal.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh/sm_kruskal.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh/sm_memory.cpp b/3rdparty/CGAL/examples/Surface_mesh/sm_memory.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh/sm_memory.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh/sm_memory.cpp
diff --git a/3rdparty/CGAL/examples/Surface_mesh/sm_properties.cpp b/3rdparty/CGAL/examples/Surface_mesh/sm_properties.cpp
new file mode 100644
index 0000000..d2ead04
--- /dev/null
+++ b/3rdparty/CGAL/examples/Surface_mesh/sm_properties.cpp
@@ -0,0 +1,67 @@
+#include <string>
+
+#include <CGAL/Simple_cartesian.h>
+#include <CGAL/Surface_mesh.h>
+
+#include <boost/foreach.hpp>
+
+typedef CGAL::Simple_cartesian<double> K;
+typedef CGAL::Surface_mesh<K::Point_3> Mesh;
+typedef Mesh::Vertex_index vertex_descriptor;
+typedef Mesh::Face_index face_descriptor;
+
+int main()
+{
+
+  Mesh m;
+  vertex_descriptor v0 = m.add_vertex(K::Point_3(0,2,0));
+  vertex_descriptor v1 = m.add_vertex(K::Point_3(2,2,0));
+  vertex_descriptor v2 = m.add_vertex(K::Point_3(0,0,0));
+  vertex_descriptor v3 = m.add_vertex(K::Point_3(2,0,0));
+  vertex_descriptor v4 = m.add_vertex(K::Point_3(1,1,0));
+  m.add_face(v3, v1, v4);
+  m.add_face(v0, v4, v1);
+  m.add_face(v0, v2, v4);
+  m.add_face(v2, v3, v4);
+
+
+  // give each vertex a name, the default is empty
+  Mesh::Property_map<vertex_descriptor,std::string> name;
+  bool created;
+  boost::tie(name, created) = m.add_property_map<vertex_descriptor,std::string>("v:name","");
+  assert(created);
+  // add some names to the vertices
+  name[v0] = "hello";
+  name[v2] = "world";
+
+  {
+    // You get an existing property, and created will be false
+    Mesh::Property_map<vertex_descriptor,std::string> name;
+    bool created;
+    boost::tie(name, created) = m.add_property_map<vertex_descriptor,std::string>("v:name", "");
+    assert(! created);
+  }
+
+  //  You can't get a property that does not exist
+  Mesh::Property_map<face_descriptor,std::string> gnus;
+  bool found;
+  boost::tie(gnus, found) = m.property_map<face_descriptor,std::string>("v:gnus");
+  assert(! found);
+
+  // retrieve the point property for which exists a convenience function
+  Mesh::Property_map<vertex_descriptor, K::Point_3> location = m.points();
+  BOOST_FOREACH( vertex_descriptor vd, m.vertices()) { 
+    std::cout << name[vd] << " @ " << location[vd] << std::endl;
+  }
+
+  std::vector<std::string> props = m.properties<vertex_descriptor>();
+  BOOST_FOREACH(std::string p, props){
+    std::cout << p << std::endl;
+  }
+  
+  // delete the string property again
+  m.remove_property_map(name);
+
+  return 0;
+}
+
diff --git a/3rdparty/CGAL/examples/Surface_mesh_deformation/CMakeLists.txt b/3rdparty/CGAL/examples/Surface_mesh_deformation/CMakeLists.txt
new file mode 100644
index 0000000..b4becb3
--- /dev/null
+++ b/3rdparty/CGAL/examples/Surface_mesh_deformation/CMakeLists.txt
@@ -0,0 +1,49 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Surface_mesh_deformation_ )
+
+cmake_minimum_required(VERSION 2.8.11)
+
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  find_package(Eigen3 3.1.91) #(requires 3.2.0 or greater)
+  if (EIGEN3_FOUND)
+    include( ${EIGEN3_USE_FILE} )
+    include( CGAL_CreateSingleSourceCGALProgram )
+
+    include_directories (BEFORE "../../include")
+
+    create_single_source_cgal_program( "all_roi_assign_example.cpp" )
+    create_single_source_cgal_program( "all_roi_assign_example_custom_polyhedron.cpp" )
+    create_single_source_cgal_program( "all_roi_assign_example_Surface_mesh.cpp" )
+    create_single_source_cgal_program( "custom_weight_for_edges_example.cpp" )
+    create_single_source_cgal_program( "deform_polyhedron_with_custom_pmap_example.cpp" )
+    create_single_source_cgal_program( "k_ring_roi_translate_rotate_example.cpp" )
+    create_single_source_cgal_program( "k_ring_roi_translate_rotate_Surface_mesh.cpp" )
+    create_single_source_cgal_program( "deform_mesh_for_botsch08_format_sre_arap.cpp" )
+
+    find_package( OpenMesh QUIET )
+    if ( OpenMesh_FOUND )
+    include( UseOpenMesh )
+      create_single_source_cgal_program( "all_roi_assign_example_with_OpenMesh.cpp" )
+      target_link_libraries( all_roi_assign_example_with_OpenMesh ${OPENMESH_LIBRARIES} )
+    else()
+      message(STATUS "Example that use OpenMesh will not be compiled.")
+    endif()
+
+  else()
+    message(STATUS "NOTICE: These examples require the Eigen library, version 3.2 or later and will not be compiled.")
+  endif()
+else()
+  
+    message(STATUS "NOTICE: These exmaples require the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_deformation/all_roi_assign_example.cpp b/3rdparty/CGAL/examples/Surface_mesh_deformation/all_roi_assign_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_deformation/all_roi_assign_example.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh_deformation/all_roi_assign_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_deformation/all_roi_assign_example_Surface_mesh.cpp b/3rdparty/CGAL/examples/Surface_mesh_deformation/all_roi_assign_example_Surface_mesh.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_deformation/all_roi_assign_example_Surface_mesh.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh_deformation/all_roi_assign_example_Surface_mesh.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_deformation/all_roi_assign_example_custom_polyhedron.cpp b/3rdparty/CGAL/examples/Surface_mesh_deformation/all_roi_assign_example_custom_polyhedron.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_deformation/all_roi_assign_example_custom_polyhedron.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh_deformation/all_roi_assign_example_custom_polyhedron.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_deformation/all_roi_assign_example_with_OpenMesh.cpp b/3rdparty/CGAL/examples/Surface_mesh_deformation/all_roi_assign_example_with_OpenMesh.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_deformation/all_roi_assign_example_with_OpenMesh.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh_deformation/all_roi_assign_example_with_OpenMesh.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_deformation/custom_weight_for_edges_example.cpp b/3rdparty/CGAL/examples/Surface_mesh_deformation/custom_weight_for_edges_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_deformation/custom_weight_for_edges_example.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh_deformation/custom_weight_for_edges_example.cpp
diff --git a/3rdparty/CGAL/examples/Surface_mesh_deformation/data/cactus.def b/3rdparty/CGAL/examples/Surface_mesh_deformation/data/cactus.def
new file mode 100644
index 0000000..7bcc51d
--- /dev/null
+++ b/3rdparty/CGAL/examples/Surface_mesh_deformation/data/cactus.def
@@ -0,0 +1,5 @@
+# 4x4 handle transformation matrix
+0.999641 0.021031 0.016579 -0.019322
+-0.022776 0.342021 0.939416 -0.134331
+0.014087 -0.939457 0.342378 0.821073
+0.000000 0.000000 0.000000 1.000000
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_segmentation/data/cactus.off b/3rdparty/CGAL/examples/Surface_mesh_deformation/data/cactus.off
similarity index 100%
copy from 3rdparty/CGAL-4.8/examples/Surface_mesh_segmentation/data/cactus.off
copy to 3rdparty/CGAL/examples/Surface_mesh_deformation/data/cactus.off
diff --git a/3rdparty/CGAL/examples/Surface_mesh_deformation/data/cactus.sel b/3rdparty/CGAL/examples/Surface_mesh_deformation/data/cactus.sel
new file mode 100644
index 0000000..ff5c1ef
--- /dev/null
+++ b/3rdparty/CGAL/examples/Surface_mesh_deformation/data/cactus.sel
@@ -0,0 +1,622 @@
+# per vertex status: 0=fixed, 1=deformable-region, 2=handle
+# 620 vertices
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+2
+1
+1
+1
+1
+1
+1
+1
+1
+2
+1
+1
+1
+1
+1
+1
+1
+1
+2
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+2
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+2
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+2
+1
+1
+2
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+2
+1
+1
+1
+1
+1
+1
+1
+2
+2
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+2
+2
+2
+1
+1
+1
+1
+2
+2
+1
+1
+2
+2
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+1
+1
+1
+1
+2
+2
+1
+1
+2
+2
+2
+1
+1
+1
+1
+1
+1
+1
+2
+2
+2
+2
+1
+1
+1
+1
+2
+2
+1
+1
+2
+2
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+0
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+0
+0
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+0
+0
+1
+1
+1
+1
+1
+1
+1
+1
+0
+0
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+0
+0
+0
+0
+0
+1
+1
+1
+1
+1
+1
+1
+0
+1
+1
+1
+0
+0
+0
+0
+0
+1
+1
+1
+1
+1
+0
+0
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+0
+0
+1
+0
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+1
+1
+1
+1
+1
+1
+1
+1
+2
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+1
+1
+2
+2
+2
+1
+1
+2
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+1
+1
+1
+1
+1
+2
+2
+2
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+1
+2
+1
+1
+1
+2
+2
+2
+2
+2
+2
+2
+1
+1
+1
+1
+1
+1
+1
+2
+2
+1
+2
+1
+1
+1
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+2
+2
+1
+1
+1
+1
+2
+2
+1
+1
+1
+1
+2
+1
+1
+1
+1
+1
+1
+2
+2
+1
+1
+1
+1
+1
+1
+1
+2
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+1
+1
+1
+1
+1
+2
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+0
+0
+1
+1
+1
+1
+1
+1
+1
+1
+0
+0
+1
+1
+1
+0
+0
+1
+1
+1
+1
+1
+0
+0
+1
+1
+0
+0
+0
+1
+1
+1
+0
+0
+0
+0
+1
+1
+1
+0
+0
+0
+0
+0
+1
+1
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_deformation/data/plane.off b/3rdparty/CGAL/examples/Surface_mesh_deformation/data/plane.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_deformation/data/plane.off
rename to 3rdparty/CGAL/examples/Surface_mesh_deformation/data/plane.off
diff --git a/3rdparty/CGAL/examples/Surface_mesh_deformation/deform_mesh_for_botsch08_format_sre_arap.cmd b/3rdparty/CGAL/examples/Surface_mesh_deformation/deform_mesh_for_botsch08_format_sre_arap.cmd
new file mode 100644
index 0000000..949693c
--- /dev/null
+++ b/3rdparty/CGAL/examples/Surface_mesh_deformation/deform_mesh_for_botsch08_format_sre_arap.cmd
@@ -0,0 +1 @@
+data/cactus.off data/cactus.sel data/cactus.def
diff --git a/3rdparty/CGAL/examples/Surface_mesh_deformation/deform_mesh_for_botsch08_format_sre_arap.cpp b/3rdparty/CGAL/examples/Surface_mesh_deformation/deform_mesh_for_botsch08_format_sre_arap.cpp
new file mode 100644
index 0000000..d824c92
--- /dev/null
+++ b/3rdparty/CGAL/examples/Surface_mesh_deformation/deform_mesh_for_botsch08_format_sre_arap.cpp
@@ -0,0 +1,101 @@
+#include <CGAL/Simple_cartesian.h>
+#include <CGAL/Polyhedron_3.h>
+#include <CGAL/Polyhedron_items_with_id_3.h>
+#include <CGAL/IO/Polyhedron_iostream.h>
+// HalfedgeGraph adapters for Polyhedron_3
+#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
+#include <CGAL/boost/graph/properties_Polyhedron_3.h>
+#include <boost/foreach.hpp>
+#include <CGAL/Surface_mesh_deformation.h>
+
+#include <fstream>
+
+
+typedef CGAL::Simple_cartesian<double>                                   Kernel;
+typedef CGAL::Polyhedron_3<Kernel, CGAL::Polyhedron_items_with_id_3> Polyhedron;
+
+typedef boost::graph_traits<Polyhedron>::vertex_descriptor    vertex_descriptor;
+typedef boost::graph_traits<Polyhedron>::vertex_iterator        vertex_iterator;
+
+typedef CGAL::Surface_mesh_deformation<Polyhedron,CGAL::Default, CGAL::Default, CGAL::SRE_ARAP> Surface_mesh_deformation;
+
+int main(int argc,char** argv)
+{
+  if  ( argc!=4){
+    std::cerr <<"Usage " << argv[0] << " input.off input.sel input.def\n";
+    return 1;
+  }
+  Polyhedron mesh;
+  std::ifstream input(argv[1]);
+
+  if ( !input || !(input >> mesh) || mesh.empty() ) {
+    std::cerr<< argv[1] << " is not a valid off file" << std::endl;
+    return 1;
+  }
+  input.close();
+
+  // Init the indices of the halfedges and the vertices.
+  set_halfedgeds_items_id(mesh);
+
+  // Create a deformation object
+  Surface_mesh_deformation deform_mesh(mesh);
+
+  // Changing alpha value
+  deform_mesh.set_sre_arap_alpha(0.02);
+
+
+  // Definition of the region of interest (use the whole mesh)
+  vertex_iterator vb,ve;
+  boost::tie(vb, ve) = vertices(mesh);
+
+  //the selection is set by a file
+  input.open(argv[2]);
+  std::string line;
+  std::vector<vertex_descriptor> control_vertices;
+  while(getline(input, line))
+  {
+    if (line[0]=='#') continue;
+    if (line[0]=='1') deform_mesh.insert_roi_vertex(*vb);
+    if (line[0]=='2') {
+      deform_mesh.insert_control_vertex(*vb);
+      control_vertices.push_back(*vb);
+    }
+    ++vb;
+    if (vb==ve) break;
+  }
+  input.close();
+
+  std::cout << "Using " << control_vertices.size() << " control vertices\n";
+  // The definition of the ROI and the control vertices is done, call preprocess
+  bool is_matrix_factorization_OK = deform_mesh.preprocess();
+  if(!is_matrix_factorization_OK){
+    std::cerr << "Error in preprocessing, check documentation of preprocess()" << std::endl;
+    return 1;
+  }
+
+  //define the transformation
+  input.open(argv[3]);
+  double m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, hw, sink;
+  getline(input, line); // skip first comment line
+  input >> m00 >> m01 >> m02 >> m03;
+  input >> m10 >> m11 >> m12 >> m13;
+  input >> m20 >> m21 >> m22 >> m23;
+  input >> sink >> sink >> sink >> hw;
+
+  std::cout << "Setting target positions\n";
+  Kernel::Aff_transformation_3 aff(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23);
+  BOOST_FOREACH(vertex_descriptor vd, control_vertices)
+  {
+    Surface_mesh_deformation::Point pos = vd->point().transform(aff);
+    deform_mesh.set_target_position(vd, pos);
+  }
+
+  // Call the function deform() with one-time parameters:
+  std::cout << "Deforming the mesh\n";
+  deform_mesh.deform(1000, 1e-4);
+
+  // Save the deformed mesh into a file
+  std::ofstream output("deform_res.off");
+  output << mesh;
+  output.close();
+}
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_deformation/deform_polyhedron_with_custom_pmap_example.cpp b/3rdparty/CGAL/examples/Surface_mesh_deformation/deform_polyhedron_with_custom_pmap_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_deformation/deform_polyhedron_with_custom_pmap_example.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh_deformation/deform_polyhedron_with_custom_pmap_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_deformation/k_ring_roi_translate_rotate_Surface_mesh.cpp b/3rdparty/CGAL/examples/Surface_mesh_deformation/k_ring_roi_translate_rotate_Surface_mesh.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_deformation/k_ring_roi_translate_rotate_Surface_mesh.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh_deformation/k_ring_roi_translate_rotate_Surface_mesh.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_deformation/k_ring_roi_translate_rotate_example.cpp b/3rdparty/CGAL/examples/Surface_mesh_deformation/k_ring_roi_translate_rotate_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_deformation/k_ring_roi_translate_rotate_example.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh_deformation/k_ring_roi_translate_rotate_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/Authalic_parameterization.cmd b/3rdparty/CGAL/examples/Surface_mesh_parameterization/Authalic_parameterization.cmd
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/Authalic_parameterization.cmd
rename to 3rdparty/CGAL/examples/Surface_mesh_parameterization/Authalic_parameterization.cmd
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/Authalic_parameterization.cpp b/3rdparty/CGAL/examples/Surface_mesh_parameterization/Authalic_parameterization.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/Authalic_parameterization.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh_parameterization/Authalic_parameterization.cpp
diff --git a/3rdparty/CGAL/examples/Surface_mesh_parameterization/CMakeLists.txt b/3rdparty/CGAL/examples/Surface_mesh_parameterization/CMakeLists.txt
new file mode 100644
index 0000000..20ab167
--- /dev/null
+++ b/3rdparty/CGAL/examples/Surface_mesh_parameterization/CMakeLists.txt
@@ -0,0 +1,75 @@
+# This is the CMake script for compiling this folder.
+
+
+project( Surface_mesh_parameterization_example )
+
+cmake_minimum_required(VERSION 2.8.11)
+
+
+# Include this package's headers first
+include_directories (BEFORE . include ../../include)
+
+# Find CGAL
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  # VisualC++ optimization for applications dealing with large data
+  if (MSVC)
+    # Use /FR to turn on IntelliSense
+    SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /FR")
+
+    # Allow Windows applications to use up to 3GB of RAM
+    SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
+
+    # Turn off stupid VC++ warnings
+    SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267 /wd4311 /wd4800 /wd4503 /wd4244 /wd4345 /wd4996 /wd4396 /wd4018")
+    
+    # Print new compilation options
+    message( STATUS "USING DEBUG CXXFLAGS   = '${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}'" )
+    message( STATUS "USING DEBUG EXEFLAGS   = '${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_DEBUG}'" )
+    message( STATUS "USING RELEASE CXXFLAGS = '${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}'" )
+    message( STATUS "USING RELEASE EXEFLAGS = '${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_RELEASE}'" )
+  endif()
+
+
+  # Link with Boost.ProgramOptions (optional)
+  find_package(Boost QUIET COMPONENTS program_options)
+  if(Boost_PROGRAM_OPTIONS_FOUND)
+    if( CGAL_AUTO_LINK_ENABLED )
+      message( STATUS "Boost.ProgramOptions library: found" )
+    else()
+      message( STATUS "Boost.ProgramOptions library: ${Boost_PROGRAM_OPTIONS_LIBRARY}" )
+    endif()
+    add_definitions( "-DCGAL_USE_BOOST_PROGRAM_OPTIONS" )
+    list(APPEND CGAL_3RD_PARTY_LIBRARIES ${Boost_PROGRAM_OPTIONS_LIBRARY})
+ endif()
+
+ 
+  find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater)
+ 
+  if (EIGEN3_FOUND)
+    # Executables that require Eigen 3.1
+    include( ${EIGEN3_USE_FILE} ) 
+  create_single_source_cgal_program( "Authalic_parameterization.cpp" )
+  create_single_source_cgal_program( "Mesh_cutting_parameterization.cpp" )
+  create_single_source_cgal_program( "Simple_parameterization.cpp" )
+  create_single_source_cgal_program( "Square_border_parameterization.cpp" )
+
+    create_single_source_cgal_program( "Complete_parameterization_example.cpp" )
+
+  create_single_source_cgal_program( "polyhedron_ex_parameterization.cpp" )
+
+  else(EIGEN3_FOUND)
+    message(STATUS "NOTICE: Some examples require Eigen 3.1 (or greater) and will not be compiled.")  
+  endif(EIGEN3_FOUND)
+
+else()
+
+  message(STATUS "NOTICE: This program requires the CGAL library, and will not be compiled.")
+
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/Complete_parameterization_example.cmd b/3rdparty/CGAL/examples/Surface_mesh_parameterization/Complete_parameterization_example.cmd
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/Complete_parameterization_example.cmd
rename to 3rdparty/CGAL/examples/Surface_mesh_parameterization/Complete_parameterization_example.cmd
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/Complete_parameterization_example.cpp b/3rdparty/CGAL/examples/Surface_mesh_parameterization/Complete_parameterization_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/Complete_parameterization_example.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh_parameterization/Complete_parameterization_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/Mesh_cutting_parameterization.cmd b/3rdparty/CGAL/examples/Surface_mesh_parameterization/Mesh_cutting_parameterization.cmd
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/Mesh_cutting_parameterization.cmd
rename to 3rdparty/CGAL/examples/Surface_mesh_parameterization/Mesh_cutting_parameterization.cmd
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/Mesh_cutting_parameterization.cpp b/3rdparty/CGAL/examples/Surface_mesh_parameterization/Mesh_cutting_parameterization.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/Mesh_cutting_parameterization.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh_parameterization/Mesh_cutting_parameterization.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/Simple_parameterization.cmd b/3rdparty/CGAL/examples/Surface_mesh_parameterization/Simple_parameterization.cmd
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/Simple_parameterization.cmd
rename to 3rdparty/CGAL/examples/Surface_mesh_parameterization/Simple_parameterization.cmd
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/Simple_parameterization.cpp b/3rdparty/CGAL/examples/Surface_mesh_parameterization/Simple_parameterization.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/Simple_parameterization.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh_parameterization/Simple_parameterization.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/Square_border_parameterization.cmd b/3rdparty/CGAL/examples/Surface_mesh_parameterization/Square_border_parameterization.cmd
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/Square_border_parameterization.cmd
rename to 3rdparty/CGAL/examples/Surface_mesh_parameterization/Square_border_parameterization.cmd
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/Square_border_parameterization.cpp b/3rdparty/CGAL/examples/Surface_mesh_parameterization/Square_border_parameterization.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/Square_border_parameterization.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh_parameterization/Square_border_parameterization.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/data/check_64x64.bmp b/3rdparty/CGAL/examples/Surface_mesh_parameterization/data/check_64x64.bmp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/data/check_64x64.bmp
rename to 3rdparty/CGAL/examples/Surface_mesh_parameterization/data/check_64x64.bmp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/data/holes.off b/3rdparty/CGAL/examples/Surface_mesh_parameterization/data/holes.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/data/holes.off
rename to 3rdparty/CGAL/examples/Surface_mesh_parameterization/data/holes.off
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/data/mannequin-devil.off b/3rdparty/CGAL/examples/Surface_mesh_parameterization/data/mannequin-devil.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/data/mannequin-devil.off
rename to 3rdparty/CGAL/examples/Surface_mesh_parameterization/data/mannequin-devil.off
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/data/mask_cone.off b/3rdparty/CGAL/examples/Surface_mesh_parameterization/data/mask_cone.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/data/mask_cone.off
rename to 3rdparty/CGAL/examples/Surface_mesh_parameterization/data/mask_cone.off
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/data/nefertiti.off b/3rdparty/CGAL/examples/Surface_mesh_parameterization/data/nefertiti.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/data/nefertiti.off
rename to 3rdparty/CGAL/examples/Surface_mesh_parameterization/data/nefertiti.off
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/data/parameterization.mtl b/3rdparty/CGAL/examples/Surface_mesh_parameterization/data/parameterization.mtl
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/data/parameterization.mtl
rename to 3rdparty/CGAL/examples/Surface_mesh_parameterization/data/parameterization.mtl
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/data/rotor.off b/3rdparty/CGAL/examples/Surface_mesh_parameterization/data/rotor.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/data/rotor.off
rename to 3rdparty/CGAL/examples/Surface_mesh_parameterization/data/rotor.off
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/data/sphere966.off b/3rdparty/CGAL/examples/Surface_mesh_parameterization/data/sphere966.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/data/sphere966.off
rename to 3rdparty/CGAL/examples/Surface_mesh_parameterization/data/sphere966.off
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/data/three_peaks.off b/3rdparty/CGAL/examples/Surface_mesh_parameterization/data/three_peaks.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/data/three_peaks.off
rename to 3rdparty/CGAL/examples/Surface_mesh_parameterization/data/three_peaks.off
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/include/Mesh_cutter.h b/3rdparty/CGAL/examples/Surface_mesh_parameterization/include/Mesh_cutter.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/include/Mesh_cutter.h
rename to 3rdparty/CGAL/examples/Surface_mesh_parameterization/include/Mesh_cutter.h
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/include/Parameterization_polyhedron_adaptor_ex.h b/3rdparty/CGAL/examples/Surface_mesh_parameterization/include/Parameterization_polyhedron_adaptor_ex.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/include/Parameterization_polyhedron_adaptor_ex.h
rename to 3rdparty/CGAL/examples/Surface_mesh_parameterization/include/Parameterization_polyhedron_adaptor_ex.h
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/include/Polyhedron_ex.h b/3rdparty/CGAL/examples/Surface_mesh_parameterization/include/Polyhedron_ex.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/include/Polyhedron_ex.h
rename to 3rdparty/CGAL/examples/Surface_mesh_parameterization/include/Polyhedron_ex.h
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/polyhedron_ex_parameterization.cmd b/3rdparty/CGAL/examples/Surface_mesh_parameterization/polyhedron_ex_parameterization.cmd
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/polyhedron_ex_parameterization.cmd
rename to 3rdparty/CGAL/examples/Surface_mesh_parameterization/polyhedron_ex_parameterization.cmd
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/polyhedron_ex_parameterization.cpp b/3rdparty/CGAL/examples/Surface_mesh_parameterization/polyhedron_ex_parameterization.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/polyhedron_ex_parameterization.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh_parameterization/polyhedron_ex_parameterization.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/quick_test_suite.bat b/3rdparty/CGAL/examples/Surface_mesh_parameterization/quick_test_suite.bat
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/quick_test_suite.bat
rename to 3rdparty/CGAL/examples/Surface_mesh_parameterization/quick_test_suite.bat
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/quick_test_suite.sh b/3rdparty/CGAL/examples/Surface_mesh_parameterization/quick_test_suite.sh
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_parameterization/quick_test_suite.sh
rename to 3rdparty/CGAL/examples/Surface_mesh_parameterization/quick_test_suite.sh
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_segmentation/CMakeLists.txt b/3rdparty/CGAL/examples/Surface_mesh_segmentation/CMakeLists.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_segmentation/CMakeLists.txt
rename to 3rdparty/CGAL/examples/Surface_mesh_segmentation/CMakeLists.txt
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_segmentation/data/cactus.off b/3rdparty/CGAL/examples/Surface_mesh_segmentation/data/cactus.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_segmentation/data/cactus.off
rename to 3rdparty/CGAL/examples/Surface_mesh_segmentation/data/cactus.off
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_segmentation/sdf_values_example.cpp b/3rdparty/CGAL/examples/Surface_mesh_segmentation/sdf_values_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_segmentation/sdf_values_example.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh_segmentation/sdf_values_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_segmentation/segmentation_from_sdf_values_OpenMesh_example.cpp b/3rdparty/CGAL/examples/Surface_mesh_segmentation/segmentation_from_sdf_values_OpenMesh_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_segmentation/segmentation_from_sdf_values_OpenMesh_example.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh_segmentation/segmentation_from_sdf_values_OpenMesh_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_segmentation/segmentation_from_sdf_values_SM_example.cpp b/3rdparty/CGAL/examples/Surface_mesh_segmentation/segmentation_from_sdf_values_SM_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_segmentation/segmentation_from_sdf_values_SM_example.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh_segmentation/segmentation_from_sdf_values_SM_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_segmentation/segmentation_from_sdf_values_example.cpp b/3rdparty/CGAL/examples/Surface_mesh_segmentation/segmentation_from_sdf_values_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_segmentation/segmentation_from_sdf_values_example.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh_segmentation/segmentation_from_sdf_values_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_segmentation/segmentation_via_sdf_values_example.cpp b/3rdparty/CGAL/examples/Surface_mesh_segmentation/segmentation_via_sdf_values_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_segmentation/segmentation_via_sdf_values_example.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh_segmentation/segmentation_via_sdf_values_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_segmentation/segmentation_with_facet_ids_example.cpp b/3rdparty/CGAL/examples/Surface_mesh_segmentation/segmentation_with_facet_ids_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_segmentation/segmentation_with_facet_ids_example.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh_segmentation/segmentation_with_facet_ids_example.cpp
diff --git a/3rdparty/CGAL/examples/Surface_mesh_shortest_path/CMakeLists.txt b/3rdparty/CGAL/examples/Surface_mesh_shortest_path/CMakeLists.txt
new file mode 100644
index 0000000..fa30758
--- /dev/null
+++ b/3rdparty/CGAL/examples/Surface_mesh_shortest_path/CMakeLists.txt
@@ -0,0 +1,38 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Surface_mesh_shortest_path_ )
+
+cmake_minimum_required(VERSION 2.8.11)
+
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  create_single_source_cgal_program( "shortest_path_sequence.cpp" )
+  create_single_source_cgal_program( "shortest_paths_multiple_sources.cpp" )
+  create_single_source_cgal_program( "shortest_paths_no_id.cpp" )
+  create_single_source_cgal_program( "shortest_paths_with_id.cpp" )
+  
+  find_package( OpenMesh QUIET )
+  if ( OpenMesh_FOUND )
+    include( UseOpenMesh )
+    create_single_source_cgal_program( "shortest_paths_OpenMesh.cpp" )
+    target_link_libraries( shortest_paths_OpenMesh ${OPENMESH_LIBRARIES} )
+  else()
+    message(STATUS "Examples that use OpenMesh will not be compiled.")
+  endif()
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_shortest_path/data/elephant.off b/3rdparty/CGAL/examples/Surface_mesh_shortest_path/data/elephant.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_shortest_path/data/elephant.off
rename to 3rdparty/CGAL/examples/Surface_mesh_shortest_path/data/elephant.off
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_shortest_path/shortest_path_sequence.cpp b/3rdparty/CGAL/examples/Surface_mesh_shortest_path/shortest_path_sequence.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_shortest_path/shortest_path_sequence.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh_shortest_path/shortest_path_sequence.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_shortest_path/shortest_paths_OpenMesh.cpp b/3rdparty/CGAL/examples/Surface_mesh_shortest_path/shortest_paths_OpenMesh.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_shortest_path/shortest_paths_OpenMesh.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh_shortest_path/shortest_paths_OpenMesh.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_shortest_path/shortest_paths_multiple_sources.cpp b/3rdparty/CGAL/examples/Surface_mesh_shortest_path/shortest_paths_multiple_sources.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_shortest_path/shortest_paths_multiple_sources.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh_shortest_path/shortest_paths_multiple_sources.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_shortest_path/shortest_paths_no_id.cpp b/3rdparty/CGAL/examples/Surface_mesh_shortest_path/shortest_paths_no_id.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_shortest_path/shortest_paths_no_id.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh_shortest_path/shortest_paths_no_id.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_shortest_path/shortest_paths_with_id.cpp b/3rdparty/CGAL/examples/Surface_mesh_shortest_path/shortest_paths_with_id.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_shortest_path/shortest_paths_with_id.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh_shortest_path/shortest_paths_with_id.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_simplification/CMakeLists.txt b/3rdparty/CGAL/examples/Surface_mesh_simplification/CMakeLists.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_simplification/CMakeLists.txt
rename to 3rdparty/CGAL/examples/Surface_mesh_simplification/CMakeLists.txt
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_simplification/cube-meshed.off b/3rdparty/CGAL/examples/Surface_mesh_simplification/cube-meshed.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_simplification/cube-meshed.off
rename to 3rdparty/CGAL/examples/Surface_mesh_simplification/cube-meshed.off
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_simplification/cube.off b/3rdparty/CGAL/examples/Surface_mesh_simplification/cube.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_simplification/cube.off
rename to 3rdparty/CGAL/examples/Surface_mesh_simplification/cube.off
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_simplification/edge_collapse_OpenMesh.cpp b/3rdparty/CGAL/examples/Surface_mesh_simplification/edge_collapse_OpenMesh.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_simplification/edge_collapse_OpenMesh.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh_simplification/edge_collapse_OpenMesh.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_simplification/edge_collapse_constrain_sharp_edges.cmd b/3rdparty/CGAL/examples/Surface_mesh_simplification/edge_collapse_constrain_sharp_edges.cmd
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_simplification/edge_collapse_constrain_sharp_edges.cmd
rename to 3rdparty/CGAL/examples/Surface_mesh_simplification/edge_collapse_constrain_sharp_edges.cmd
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_simplification/edge_collapse_constrain_sharp_edges.cpp b/3rdparty/CGAL/examples/Surface_mesh_simplification/edge_collapse_constrain_sharp_edges.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_simplification/edge_collapse_constrain_sharp_edges.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh_simplification/edge_collapse_constrain_sharp_edges.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_simplification/edge_collapse_constrained_border_polyhedron.cmd b/3rdparty/CGAL/examples/Surface_mesh_simplification/edge_collapse_constrained_border_polyhedron.cmd
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_simplification/edge_collapse_constrained_border_polyhedron.cmd
rename to 3rdparty/CGAL/examples/Surface_mesh_simplification/edge_collapse_constrained_border_polyhedron.cmd
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_simplification/edge_collapse_constrained_border_polyhedron.cpp b/3rdparty/CGAL/examples/Surface_mesh_simplification/edge_collapse_constrained_border_polyhedron.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_simplification/edge_collapse_constrained_border_polyhedron.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh_simplification/edge_collapse_constrained_border_polyhedron.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_simplification/edge_collapse_constrained_border_surface_mesh.cmd b/3rdparty/CGAL/examples/Surface_mesh_simplification/edge_collapse_constrained_border_surface_mesh.cmd
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_simplification/edge_collapse_constrained_border_surface_mesh.cmd
rename to 3rdparty/CGAL/examples/Surface_mesh_simplification/edge_collapse_constrained_border_surface_mesh.cmd
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_simplification/edge_collapse_constrained_border_surface_mesh.cpp b/3rdparty/CGAL/examples/Surface_mesh_simplification/edge_collapse_constrained_border_surface_mesh.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_simplification/edge_collapse_constrained_border_surface_mesh.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh_simplification/edge_collapse_constrained_border_surface_mesh.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_simplification/edge_collapse_enriched_polyhedron.cmd b/3rdparty/CGAL/examples/Surface_mesh_simplification/edge_collapse_enriched_polyhedron.cmd
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_simplification/edge_collapse_enriched_polyhedron.cmd
rename to 3rdparty/CGAL/examples/Surface_mesh_simplification/edge_collapse_enriched_polyhedron.cmd
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_simplification/edge_collapse_enriched_polyhedron.cpp b/3rdparty/CGAL/examples/Surface_mesh_simplification/edge_collapse_enriched_polyhedron.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_simplification/edge_collapse_enriched_polyhedron.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh_simplification/edge_collapse_enriched_polyhedron.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_simplification/edge_collapse_polyhedron.cmd b/3rdparty/CGAL/examples/Surface_mesh_simplification/edge_collapse_polyhedron.cmd
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_simplification/edge_collapse_polyhedron.cmd
rename to 3rdparty/CGAL/examples/Surface_mesh_simplification/edge_collapse_polyhedron.cmd
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_simplification/edge_collapse_polyhedron.cpp b/3rdparty/CGAL/examples/Surface_mesh_simplification/edge_collapse_polyhedron.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_simplification/edge_collapse_polyhedron.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh_simplification/edge_collapse_polyhedron.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_simplification/edge_collapse_surface_mesh.cmd b/3rdparty/CGAL/examples/Surface_mesh_simplification/edge_collapse_surface_mesh.cmd
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_simplification/edge_collapse_surface_mesh.cmd
rename to 3rdparty/CGAL/examples/Surface_mesh_simplification/edge_collapse_surface_mesh.cmd
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_simplification/edge_collapse_surface_mesh.cpp b/3rdparty/CGAL/examples/Surface_mesh_simplification/edge_collapse_surface_mesh.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_simplification/edge_collapse_surface_mesh.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh_simplification/edge_collapse_surface_mesh.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_simplification/mesh_with_border.off b/3rdparty/CGAL/examples/Surface_mesh_simplification/mesh_with_border.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_simplification/mesh_with_border.off
rename to 3rdparty/CGAL/examples/Surface_mesh_simplification/mesh_with_border.off
diff --git a/3rdparty/CGAL/examples/Surface_mesh_skeletonization/CMakeLists.txt b/3rdparty/CGAL/examples/Surface_mesh_skeletonization/CMakeLists.txt
new file mode 100644
index 0000000..512a95b
--- /dev/null
+++ b/3rdparty/CGAL/examples/Surface_mesh_skeletonization/CMakeLists.txt
@@ -0,0 +1,41 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Surface_mesh_skeletonization_ )
+
+cmake_minimum_required(VERSION 2.8.11)
+
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  find_package(Eigen3 3.2.0) #(requires 3.2.0 or greater)
+
+  if(EIGEN3_FOUND)
+    include( ${EIGEN3_USE_FILE} )
+
+    include( CGAL_CreateSingleSourceCGALProgram )
+
+    include_directories (BEFORE "../../include")
+
+    create_single_source_cgal_program( "simple_mcfskel_example.cpp" )
+    create_single_source_cgal_program( "simple_mcfskel_sm_example.cpp" )
+    create_single_source_cgal_program( "MCF_Skeleton_example.cpp" )
+    create_single_source_cgal_program( "MCF_Skeleton_sm_example.cpp" )
+    create_single_source_cgal_program( "segmentation_example.cpp" )
+  else()
+    message(STATUS "These programs require the Eigen library (3.2 or greater), and will not be compiled.")
+  endif()
+
+else()
+
+  message(STATUS "This program requires the CGAL library, and will not be compiled.")
+
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_skeletonization/MCF_Skeleton_example.cpp b/3rdparty/CGAL/examples/Surface_mesh_skeletonization/MCF_Skeleton_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_skeletonization/MCF_Skeleton_example.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh_skeletonization/MCF_Skeleton_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_skeletonization/MCF_Skeleton_sm_example.cpp b/3rdparty/CGAL/examples/Surface_mesh_skeletonization/MCF_Skeleton_sm_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_skeletonization/MCF_Skeleton_sm_example.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh_skeletonization/MCF_Skeleton_sm_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_skeletonization/data/161.off b/3rdparty/CGAL/examples/Surface_mesh_skeletonization/data/161.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_skeletonization/data/161.off
rename to 3rdparty/CGAL/examples/Surface_mesh_skeletonization/data/161.off
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_skeletonization/data/elephant.off b/3rdparty/CGAL/examples/Surface_mesh_skeletonization/data/elephant.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_skeletonization/data/elephant.off
rename to 3rdparty/CGAL/examples/Surface_mesh_skeletonization/data/elephant.off
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_skeletonization/segmentation_example.cpp b/3rdparty/CGAL/examples/Surface_mesh_skeletonization/segmentation_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_skeletonization/segmentation_example.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh_skeletonization/segmentation_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_skeletonization/simple_mcfskel_example.cpp b/3rdparty/CGAL/examples/Surface_mesh_skeletonization/simple_mcfskel_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_skeletonization/simple_mcfskel_example.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh_skeletonization/simple_mcfskel_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesh_skeletonization/simple_mcfskel_sm_example.cpp b/3rdparty/CGAL/examples/Surface_mesh_skeletonization/simple_mcfskel_sm_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesh_skeletonization/simple_mcfskel_sm_example.cpp
rename to 3rdparty/CGAL/examples/Surface_mesh_skeletonization/simple_mcfskel_sm_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesher/CMakeLists.txt b/3rdparty/CGAL/examples/Surface_mesher/CMakeLists.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesher/CMakeLists.txt
rename to 3rdparty/CGAL/examples/Surface_mesher/CMakeLists.txt
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesher/data/skull_2.9.inr b/3rdparty/CGAL/examples/Surface_mesher/data/skull_2.9.inr
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesher/data/skull_2.9.inr
rename to 3rdparty/CGAL/examples/Surface_mesher/data/skull_2.9.inr
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesher/data/triceratops.off b/3rdparty/CGAL/examples/Surface_mesher/data/triceratops.off
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesher/data/triceratops.off
rename to 3rdparty/CGAL/examples/Surface_mesher/data/triceratops.off
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesher/mesh_a_3d_gray_image.cpp b/3rdparty/CGAL/examples/Surface_mesher/mesh_a_3d_gray_image.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesher/mesh_a_3d_gray_image.cpp
rename to 3rdparty/CGAL/examples/Surface_mesher/mesh_a_3d_gray_image.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesher/mesh_an_implicit_function.cpp b/3rdparty/CGAL/examples/Surface_mesher/mesh_an_implicit_function.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesher/mesh_an_implicit_function.cpp
rename to 3rdparty/CGAL/examples/Surface_mesher/mesh_an_implicit_function.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Surface_mesher/skip_vcproj_auto_generation b/3rdparty/CGAL/examples/Surface_mesher/skip_vcproj_auto_generation
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Surface_mesher/skip_vcproj_auto_generation
rename to 3rdparty/CGAL/examples/Surface_mesher/skip_vcproj_auto_generation
diff --git a/3rdparty/CGAL-4.8/examples/Sweep_line_2/CMakeLists.txt b/3rdparty/CGAL/examples/Sweep_line_2/CMakeLists.txt
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Sweep_line_2/CMakeLists.txt
rename to 3rdparty/CGAL/examples/Sweep_line_2/CMakeLists.txt
diff --git a/3rdparty/CGAL-4.8/examples/Sweep_line_2/sweep_line.cpp b/3rdparty/CGAL/examples/Sweep_line_2/sweep_line.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Sweep_line_2/sweep_line.cpp
rename to 3rdparty/CGAL/examples/Sweep_line_2/sweep_line.cpp
diff --git a/3rdparty/CGAL/examples/TDS_3/CMakeLists.txt b/3rdparty/CGAL/examples/TDS_3/CMakeLists.txt
new file mode 100644
index 0000000..7a7577c
--- /dev/null
+++ b/3rdparty/CGAL/examples/TDS_3/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( TDS_3_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/TDS_3/linking_2d_and_3d.cpp b/3rdparty/CGAL/examples/TDS_3/linking_2d_and_3d.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/TDS_3/linking_2d_and_3d.cpp
rename to 3rdparty/CGAL/examples/TDS_3/linking_2d_and_3d.cpp
diff --git a/3rdparty/CGAL-4.8/examples/TDS_3/tds.cpp b/3rdparty/CGAL/examples/TDS_3/tds.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/TDS_3/tds.cpp
rename to 3rdparty/CGAL/examples/TDS_3/tds.cpp
diff --git a/3rdparty/CGAL/examples/Triangulation/CMakeLists.txt b/3rdparty/CGAL/examples/Triangulation/CMakeLists.txt
new file mode 100644
index 0000000..90862a3
--- /dev/null
+++ b/3rdparty/CGAL/examples/Triangulation/CMakeLists.txt
@@ -0,0 +1,38 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Triangulation_example )
+
+cmake_minimum_required(VERSION 2.8.11)
+
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+  
+  find_package(Eigen3 3.1.0) 
+  if (EIGEN3_FOUND) 
+    include( ${EIGEN3_USE_FILE} ) 
+    include_directories (BEFORE "../../include")
+
+    create_single_source_cgal_program( "barycentric_subdivision.cpp" )
+    create_single_source_cgal_program( "delaunay_triangulation.cpp" )
+    create_single_source_cgal_program( "triangulation.cpp" )
+    create_single_source_cgal_program( "triangulation_data_structure_dynamic.cpp" )
+    create_single_source_cgal_program( "triangulation_data_structure_static.cpp" )
+
+  else()
+    message(STATUS "NOTICE: Some of the executables in this directory need Eigen 3.1 (or greater) and will not be compiled.")
+  endif()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation/barycentric_subdivision.cpp b/3rdparty/CGAL/examples/Triangulation/barycentric_subdivision.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation/barycentric_subdivision.cpp
rename to 3rdparty/CGAL/examples/Triangulation/barycentric_subdivision.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation/delaunay_triangulation.cpp b/3rdparty/CGAL/examples/Triangulation/delaunay_triangulation.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation/delaunay_triangulation.cpp
rename to 3rdparty/CGAL/examples/Triangulation/delaunay_triangulation.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation/triangulation.cpp b/3rdparty/CGAL/examples/Triangulation/triangulation.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation/triangulation.cpp
rename to 3rdparty/CGAL/examples/Triangulation/triangulation.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation/triangulation1.cpp b/3rdparty/CGAL/examples/Triangulation/triangulation1.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation/triangulation1.cpp
rename to 3rdparty/CGAL/examples/Triangulation/triangulation1.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation/triangulation2.cpp b/3rdparty/CGAL/examples/Triangulation/triangulation2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation/triangulation2.cpp
rename to 3rdparty/CGAL/examples/Triangulation/triangulation2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation/triangulation_data_structure_dynamic.cpp b/3rdparty/CGAL/examples/Triangulation/triangulation_data_structure_dynamic.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation/triangulation_data_structure_dynamic.cpp
rename to 3rdparty/CGAL/examples/Triangulation/triangulation_data_structure_dynamic.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation/triangulation_data_structure_static.cpp b/3rdparty/CGAL/examples/Triangulation/triangulation_data_structure_static.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation/triangulation_data_structure_static.cpp
rename to 3rdparty/CGAL/examples/Triangulation/triangulation_data_structure_static.cpp
diff --git a/3rdparty/CGAL/examples/Triangulation_2/CMakeLists.txt b/3rdparty/CGAL/examples/Triangulation_2/CMakeLists.txt
new file mode 100644
index 0000000..461607b
--- /dev/null
+++ b/3rdparty/CGAL/examples/Triangulation_2/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Triangulation_2_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_2/README b/3rdparty/CGAL/examples/Triangulation_2/README
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation_2/README
rename to 3rdparty/CGAL/examples/Triangulation_2/README
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_2/adding_handles.cpp b/3rdparty/CGAL/examples/Triangulation_2/adding_handles.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation_2/adding_handles.cpp
rename to 3rdparty/CGAL/examples/Triangulation_2/adding_handles.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_2/colored_face.cpp b/3rdparty/CGAL/examples/Triangulation_2/colored_face.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation_2/colored_face.cpp
rename to 3rdparty/CGAL/examples/Triangulation_2/colored_face.cpp
diff --git a/3rdparty/CGAL/examples/Triangulation_2/constrained.cpp b/3rdparty/CGAL/examples/Triangulation_2/constrained.cpp
new file mode 100644
index 0000000..a4cc792
--- /dev/null
+++ b/3rdparty/CGAL/examples/Triangulation_2/constrained.cpp
@@ -0,0 +1,32 @@
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+#include <CGAL/Constrained_Delaunay_triangulation_2.h>
+
+#include <cassert>
+#include <iostream>
+
+typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
+
+typedef CGAL::Exact_predicates_tag                               Itag;
+typedef CGAL::Constrained_Delaunay_triangulation_2<K, CGAL::Default, Itag> CDT;
+typedef CDT::Point          Point;
+
+int
+main( )
+{
+  CDT cdt;
+  std::cout << "Inserting a grid of 5x5 constraints " << std::endl;
+  for (int i = 1; i < 6; ++i)
+    cdt.insert_constraint( Point(0,i), Point(6,i));
+  for (int j = 1; j < 6; ++j)
+    cdt.insert_constraint( Point(j,0), Point(j,6));
+
+  assert(cdt.is_valid());
+  int count = 0;
+  for (CDT::Finite_edges_iterator eit = cdt.finite_edges_begin();
+       eit != cdt.finite_edges_end();
+       ++eit)
+    if (cdt.is_constrained(*eit)) ++count;
+  std::cout << "The number of resulting constrained edges is  ";
+  std::cout <<  count << std::endl;
+  return 0;
+}
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_2/constrained_hierarchy_plus.cpp b/3rdparty/CGAL/examples/Triangulation_2/constrained_hierarchy_plus.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation_2/constrained_hierarchy_plus.cpp
rename to 3rdparty/CGAL/examples/Triangulation_2/constrained_hierarchy_plus.cpp
diff --git a/3rdparty/CGAL/examples/Triangulation_2/constrained_plus.cpp b/3rdparty/CGAL/examples/Triangulation_2/constrained_plus.cpp
new file mode 100644
index 0000000..798dada
--- /dev/null
+++ b/3rdparty/CGAL/examples/Triangulation_2/constrained_plus.cpp
@@ -0,0 +1,34 @@
+#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
+#include <CGAL/intersections.h>
+#include <CGAL/Constrained_Delaunay_triangulation_2.h>
+#include <CGAL/Constrained_triangulation_plus_2.h>
+
+#include <cassert>
+#include <iostream>
+
+typedef CGAL::Exact_predicates_exact_constructions_kernel K;
+
+typedef CGAL::Exact_intersections_tag                     Itag;
+typedef CGAL::Constrained_Delaunay_triangulation_2<K,CGAL::Default,Itag> CDT;
+typedef CGAL::Constrained_triangulation_plus_2<CDT>       CDTplus;
+typedef CDTplus::Point                                    Point;
+
+int
+main( )
+{
+  CDTplus cdt;
+  std::cout  << "Inserting a grid 5 x 5 of constraints " << std::endl;
+  for (int i = 1; i < 6; ++i)
+    cdt.insert_constraint( Point(0,i), Point(6,i));
+  for (int j = 1; j < 6; ++j)
+    cdt.insert_constraint( Point(j,0), Point(j,6));
+
+  assert(cdt.is_valid());
+  int count = 0;
+  for (CDTplus::Subconstraint_iterator scit = cdt.subconstraints_begin();
+       scit != cdt.subconstraints_end();
+       ++scit)  ++count;
+  std::cout << "The number of resulting constrained edges is  "
+	    <<  count << std::endl;
+  return 0;
+}
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_2/copy_triangulation_2.cpp b/3rdparty/CGAL/examples/Triangulation_2/copy_triangulation_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation_2/copy_triangulation_2.cpp
rename to 3rdparty/CGAL/examples/Triangulation_2/copy_triangulation_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_2/data/constrained.cin b/3rdparty/CGAL/examples/Triangulation_2/data/constrained.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation_2/data/constrained.cin
rename to 3rdparty/CGAL/examples/Triangulation_2/data/constrained.cin
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_2/data/regular.cin b/3rdparty/CGAL/examples/Triangulation_2/data/regular.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation_2/data/regular.cin
rename to 3rdparty/CGAL/examples/Triangulation_2/data/regular.cin
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_2/data/terrain.cin b/3rdparty/CGAL/examples/Triangulation_2/data/terrain.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation_2/data/terrain.cin
rename to 3rdparty/CGAL/examples/Triangulation_2/data/terrain.cin
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_2/data/triangulation_prog1.cin b/3rdparty/CGAL/examples/Triangulation_2/data/triangulation_prog1.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation_2/data/triangulation_prog1.cin
rename to 3rdparty/CGAL/examples/Triangulation_2/data/triangulation_prog1.cin
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_2/data/voronoi.cin b/3rdparty/CGAL/examples/Triangulation_2/data/voronoi.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation_2/data/voronoi.cin
rename to 3rdparty/CGAL/examples/Triangulation_2/data/voronoi.cin
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_2/hierarchy.cpp b/3rdparty/CGAL/examples/Triangulation_2/hierarchy.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation_2/hierarchy.cpp
rename to 3rdparty/CGAL/examples/Triangulation_2/hierarchy.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_2/info_insert_with_pair_iterator_2.cpp b/3rdparty/CGAL/examples/Triangulation_2/info_insert_with_pair_iterator_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation_2/info_insert_with_pair_iterator_2.cpp
rename to 3rdparty/CGAL/examples/Triangulation_2/info_insert_with_pair_iterator_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_2/info_insert_with_pair_iterator_regular_2.cpp b/3rdparty/CGAL/examples/Triangulation_2/info_insert_with_pair_iterator_regular_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation_2/info_insert_with_pair_iterator_regular_2.cpp
rename to 3rdparty/CGAL/examples/Triangulation_2/info_insert_with_pair_iterator_regular_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_2/info_insert_with_transform_iterator_2.cpp b/3rdparty/CGAL/examples/Triangulation_2/info_insert_with_transform_iterator_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation_2/info_insert_with_transform_iterator_2.cpp
rename to 3rdparty/CGAL/examples/Triangulation_2/info_insert_with_transform_iterator_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_2/info_insert_with_zip_iterator_2.cpp b/3rdparty/CGAL/examples/Triangulation_2/info_insert_with_zip_iterator_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation_2/info_insert_with_zip_iterator_2.cpp
rename to 3rdparty/CGAL/examples/Triangulation_2/info_insert_with_zip_iterator_2.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_2/polygon_triangulation.cpp b/3rdparty/CGAL/examples/Triangulation_2/polygon_triangulation.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation_2/polygon_triangulation.cpp
rename to 3rdparty/CGAL/examples/Triangulation_2/polygon_triangulation.cpp
diff --git a/3rdparty/CGAL/examples/Triangulation_2/polylines_triangulation.cpp b/3rdparty/CGAL/examples/Triangulation_2/polylines_triangulation.cpp
new file mode 100644
index 0000000..46d2d63
--- /dev/null
+++ b/3rdparty/CGAL/examples/Triangulation_2/polylines_triangulation.cpp
@@ -0,0 +1,86 @@
+#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
+#include <CGAL/Polygon_2.h>
+#include <CGAL/Constrained_Delaunay_triangulation_2.h>
+#include <CGAL/Constrained_triangulation_plus_2.h>
+
+#include <vector>
+
+typedef CGAL::Exact_predicates_exact_constructions_kernel                 K;
+typedef CGAL::Polygon_2<K>                                                Polygon_2;
+typedef CGAL::Exact_intersections_tag                                     Itag;
+typedef CGAL::Constrained_Delaunay_triangulation_2<K,CGAL::Default, Itag> CDT;
+typedef CGAL::Constrained_triangulation_plus_2<CDT>                       CDTP;
+
+typedef CDTP::Point                                                       Point;
+typedef CDTP::Constraint_id                                               Cid;
+typedef CDTP::Vertex_handle                                               Vertex_handle;
+
+void 
+print(const CDTP& cdtp, Cid cid)
+{
+  typedef CDTP::Vertices_in_constraint Vertices_in_constraint;
+
+  std::cout << "Polyline constraint:" << std::endl;
+  for(Vertices_in_constraint it = cdtp.vertices_in_constraint_begin(cid);
+      it !=cdtp.vertices_in_constraint_end(cid);
+      it++){
+    Vertex_handle vh = *it;
+    std::cout << vh->point() << std::endl;
+  }
+}
+
+
+void 
+contexts(const CDTP& cdtp)
+{
+  CDTP::Subconstraint_iterator
+    beg = cdtp.subconstraints_begin(),
+    end = cdtp.subconstraints_end();
+
+  for(; beg!=end; ++beg){
+    Vertex_handle vp = beg->first.first, vq = beg->first.second;
+
+    if(cdtp.number_of_enclosing_constraints(vp, vq) == 2){
+      CDTP::Context_iterator cbeg = cdtp.contexts_begin(vp,vq),
+        cend = cdtp.contexts_end(vp,vq);
+      std::cout << "subconstraint " << vp->point() << " " << vq->point() 
+                << " is on constraints starting at:\n";
+      for(; cbeg !=  cend; ++cbeg){
+        CDTP::Context c = *cbeg;
+        std::cout << (*(c.vertices_begin()))->point() << std::endl;
+      }
+    }
+  }
+}
+
+int
+main( )
+{
+  CDTP cdtp;
+
+  cdtp.insert_constraint(Point(0,0), Point(1,1));
+
+  std::vector<Point> points;
+  points.push_back(Point(1,1));
+  points.push_back(Point(5,2));
+  points.push_back(Point(6,0));
+  points.push_back(Point(3,0));
+  Cid id1 = cdtp.insert_constraint(points.begin(), points.end());
+
+  print(cdtp, id1);
+
+  Polygon_2 poly;
+  poly.push_back(Point(2,3));
+  poly.push_back(Point(4,0));
+  poly.push_back(Point(5,0));
+  poly.push_back(Point(6,2));
+
+  Cid id2 = cdtp.insert_constraint(poly.vertices_begin(), poly.vertices_end(), true);
+
+  print(cdtp, id1);
+  print(cdtp, id2);
+
+  contexts(cdtp);
+
+  return 0;
+}
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_2/print_cropped_voronoi.cpp b/3rdparty/CGAL/examples/Triangulation_2/print_cropped_voronoi.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation_2/print_cropped_voronoi.cpp
rename to 3rdparty/CGAL/examples/Triangulation_2/print_cropped_voronoi.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_2/regular.cpp b/3rdparty/CGAL/examples/Triangulation_2/regular.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation_2/regular.cpp
rename to 3rdparty/CGAL/examples/Triangulation_2/regular.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_2/terrain.cpp b/3rdparty/CGAL/examples/Triangulation_2/terrain.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation_2/terrain.cpp
rename to 3rdparty/CGAL/examples/Triangulation_2/terrain.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_2/triangulation_prog1.cpp b/3rdparty/CGAL/examples/Triangulation_2/triangulation_prog1.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation_2/triangulation_prog1.cpp
rename to 3rdparty/CGAL/examples/Triangulation_2/triangulation_prog1.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_2/voronoi.cpp b/3rdparty/CGAL/examples/Triangulation_2/voronoi.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation_2/voronoi.cpp
rename to 3rdparty/CGAL/examples/Triangulation_2/voronoi.cpp
diff --git a/3rdparty/CGAL/examples/Triangulation_3/CMakeLists.txt b/3rdparty/CGAL/examples/Triangulation_3/CMakeLists.txt
new file mode 100644
index 0000000..09bbf0f
--- /dev/null
+++ b/3rdparty/CGAL/examples/Triangulation_3/CMakeLists.txt
@@ -0,0 +1,48 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Triangulation_3_example )
+
+cmake_minimum_required(VERSION 2.8.11)
+
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+  
+  find_package( TBB QUIET )
+
+  if( TBB_FOUND )
+    include(${TBB_USE_FILE})
+    list(APPEND CGAL_3RD_PARTY_LIBRARIES ${TBB_LIBRARIES})
+  endif()
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  create_single_source_cgal_program( "adding_handles_3.cpp" )
+  create_single_source_cgal_program( "color.cpp" )
+  create_single_source_cgal_program( "copy_triangulation_3.cpp" )
+  create_single_source_cgal_program( "fast_location_3.cpp" )
+  create_single_source_cgal_program( "find_conflicts_3.cpp" )
+  create_single_source_cgal_program( "info_insert_with_pair_iterator.cpp" )
+  create_single_source_cgal_program( "info_insert_with_pair_iterator_regular.cpp" )
+  create_single_source_cgal_program( "info_insert_with_transform_iterator.cpp" )
+  create_single_source_cgal_program( "info_insert_with_zip_iterator.cpp" )
+  create_single_source_cgal_program( "parallel_insertion_and_removal_in_regular_3.cpp" )
+  create_single_source_cgal_program( "parallel_insertion_in_delaunay_3.cpp" )
+  create_single_source_cgal_program( "regular_3.cpp" )
+  create_single_source_cgal_program( "sequential_parallel.cpp" )
+  create_single_source_cgal_program( "simple_triangulation_3.cpp" )
+  create_single_source_cgal_program( "simplex.cpp" )
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_3/README b/3rdparty/CGAL/examples/Triangulation_3/README
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation_3/README
rename to 3rdparty/CGAL/examples/Triangulation_3/README
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_3/adding_handles_3.cpp b/3rdparty/CGAL/examples/Triangulation_3/adding_handles_3.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation_3/adding_handles_3.cpp
rename to 3rdparty/CGAL/examples/Triangulation_3/adding_handles_3.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_3/color.cpp b/3rdparty/CGAL/examples/Triangulation_3/color.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation_3/color.cpp
rename to 3rdparty/CGAL/examples/Triangulation_3/color.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_3/copy_triangulation_3.cpp b/3rdparty/CGAL/examples/Triangulation_3/copy_triangulation_3.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation_3/copy_triangulation_3.cpp
rename to 3rdparty/CGAL/examples/Triangulation_3/copy_triangulation_3.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_3/fast_location_3.cpp b/3rdparty/CGAL/examples/Triangulation_3/fast_location_3.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation_3/fast_location_3.cpp
rename to 3rdparty/CGAL/examples/Triangulation_3/fast_location_3.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_3/find_conflicts_3.cpp b/3rdparty/CGAL/examples/Triangulation_3/find_conflicts_3.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation_3/find_conflicts_3.cpp
rename to 3rdparty/CGAL/examples/Triangulation_3/find_conflicts_3.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_3/info_insert_with_pair_iterator.cpp b/3rdparty/CGAL/examples/Triangulation_3/info_insert_with_pair_iterator.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation_3/info_insert_with_pair_iterator.cpp
rename to 3rdparty/CGAL/examples/Triangulation_3/info_insert_with_pair_iterator.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_3/info_insert_with_pair_iterator_regular.cpp b/3rdparty/CGAL/examples/Triangulation_3/info_insert_with_pair_iterator_regular.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation_3/info_insert_with_pair_iterator_regular.cpp
rename to 3rdparty/CGAL/examples/Triangulation_3/info_insert_with_pair_iterator_regular.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_3/info_insert_with_transform_iterator.cpp b/3rdparty/CGAL/examples/Triangulation_3/info_insert_with_transform_iterator.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation_3/info_insert_with_transform_iterator.cpp
rename to 3rdparty/CGAL/examples/Triangulation_3/info_insert_with_transform_iterator.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_3/info_insert_with_zip_iterator.cpp b/3rdparty/CGAL/examples/Triangulation_3/info_insert_with_zip_iterator.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation_3/info_insert_with_zip_iterator.cpp
rename to 3rdparty/CGAL/examples/Triangulation_3/info_insert_with_zip_iterator.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_3/parallel_insertion_and_removal_in_regular_3.cpp b/3rdparty/CGAL/examples/Triangulation_3/parallel_insertion_and_removal_in_regular_3.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation_3/parallel_insertion_and_removal_in_regular_3.cpp
rename to 3rdparty/CGAL/examples/Triangulation_3/parallel_insertion_and_removal_in_regular_3.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_3/parallel_insertion_in_delaunay_3.cpp b/3rdparty/CGAL/examples/Triangulation_3/parallel_insertion_in_delaunay_3.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation_3/parallel_insertion_in_delaunay_3.cpp
rename to 3rdparty/CGAL/examples/Triangulation_3/parallel_insertion_in_delaunay_3.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_3/regular_3.cpp b/3rdparty/CGAL/examples/Triangulation_3/regular_3.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation_3/regular_3.cpp
rename to 3rdparty/CGAL/examples/Triangulation_3/regular_3.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_3/sequential_parallel.cpp b/3rdparty/CGAL/examples/Triangulation_3/sequential_parallel.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation_3/sequential_parallel.cpp
rename to 3rdparty/CGAL/examples/Triangulation_3/sequential_parallel.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_3/simple_triangulation_3.cpp b/3rdparty/CGAL/examples/Triangulation_3/simple_triangulation_3.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation_3/simple_triangulation_3.cpp
rename to 3rdparty/CGAL/examples/Triangulation_3/simple_triangulation_3.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Triangulation_3/simplex.cpp b/3rdparty/CGAL/examples/Triangulation_3/simplex.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Triangulation_3/simplex.cpp
rename to 3rdparty/CGAL/examples/Triangulation_3/simplex.cpp
diff --git a/3rdparty/CGAL/examples/Visibility_2/CMakeLists.txt b/3rdparty/CGAL/examples/Visibility_2/CMakeLists.txt
new file mode 100644
index 0000000..a6056b1
--- /dev/null
+++ b/3rdparty/CGAL/examples/Visibility_2/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Visibility_2_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Visibility_2/general_polygon_example.cpp b/3rdparty/CGAL/examples/Visibility_2/general_polygon_example.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Visibility_2/general_polygon_example.cpp
rename to 3rdparty/CGAL/examples/Visibility_2/general_polygon_example.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Visibility_2/simple_polygon_visibility_2.cpp b/3rdparty/CGAL/examples/Visibility_2/simple_polygon_visibility_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Visibility_2/simple_polygon_visibility_2.cpp
rename to 3rdparty/CGAL/examples/Visibility_2/simple_polygon_visibility_2.cpp
diff --git a/3rdparty/CGAL/examples/Voronoi_diagram_2/CMakeLists.txt b/3rdparty/CGAL/examples/Voronoi_diagram_2/CMakeLists.txt
new file mode 100644
index 0000000..0a935f5
--- /dev/null
+++ b/3rdparty/CGAL/examples/Voronoi_diagram_2/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Created by the script cgal_create_cmake_script
+# This is the CMake script for compiling a CGAL application.
+
+
+project( Voronoi_diagram_2_ )
+
+cmake_minimum_required(VERSION 2.8.10)
+
+find_package(CGAL QUIET)
+
+if ( CGAL_FOUND )
+
+  include( ${CGAL_USE_FILE} )
+
+  include( CGAL_CreateSingleSourceCGALProgram )
+
+  include_directories (BEFORE "../../include")
+
+  # create a target per cppfile
+  file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+  foreach(cppfile ${cppfiles})
+    create_single_source_cgal_program( "${cppfile}" )
+  endforeach()
+
+else()
+  
+    message(STATUS "This program requires the CGAL library, and will not be compiled.")
+  
+endif()
+
diff --git a/3rdparty/CGAL-4.8/examples/Voronoi_diagram_2/data/1D.ag.cin b/3rdparty/CGAL/examples/Voronoi_diagram_2/data/1D.ag.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Voronoi_diagram_2/data/1D.ag.cin
rename to 3rdparty/CGAL/examples/Voronoi_diagram_2/data/1D.ag.cin
diff --git a/3rdparty/CGAL-4.8/examples/Voronoi_diagram_2/data/data1.ag.cin b/3rdparty/CGAL/examples/Voronoi_diagram_2/data/data1.ag.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Voronoi_diagram_2/data/data1.ag.cin
rename to 3rdparty/CGAL/examples/Voronoi_diagram_2/data/data1.ag.cin
diff --git a/3rdparty/CGAL-4.8/examples/Voronoi_diagram_2/data/data1.dt.cin b/3rdparty/CGAL/examples/Voronoi_diagram_2/data/data1.dt.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Voronoi_diagram_2/data/data1.dt.cin
rename to 3rdparty/CGAL/examples/Voronoi_diagram_2/data/data1.dt.cin
diff --git a/3rdparty/CGAL-4.8/examples/Voronoi_diagram_2/data/data1.svd.cin b/3rdparty/CGAL/examples/Voronoi_diagram_2/data/data1.svd.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Voronoi_diagram_2/data/data1.svd.cin
rename to 3rdparty/CGAL/examples/Voronoi_diagram_2/data/data1.svd.cin
diff --git a/3rdparty/CGAL-4.8/examples/Voronoi_diagram_2/data/data2.ag.cin b/3rdparty/CGAL/examples/Voronoi_diagram_2/data/data2.ag.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Voronoi_diagram_2/data/data2.ag.cin
rename to 3rdparty/CGAL/examples/Voronoi_diagram_2/data/data2.ag.cin
diff --git a/3rdparty/CGAL-4.8/examples/Voronoi_diagram_2/data/data3.ag.cin b/3rdparty/CGAL/examples/Voronoi_diagram_2/data/data3.ag.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Voronoi_diagram_2/data/data3.ag.cin
rename to 3rdparty/CGAL/examples/Voronoi_diagram_2/data/data3.ag.cin
diff --git a/3rdparty/CGAL-4.8/examples/Voronoi_diagram_2/data/degenerate.ag.cin b/3rdparty/CGAL/examples/Voronoi_diagram_2/data/degenerate.ag.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Voronoi_diagram_2/data/degenerate.ag.cin
rename to 3rdparty/CGAL/examples/Voronoi_diagram_2/data/degenerate.ag.cin
diff --git a/3rdparty/CGAL-4.8/examples/Voronoi_diagram_2/data/queries1.dt.cin b/3rdparty/CGAL/examples/Voronoi_diagram_2/data/queries1.dt.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Voronoi_diagram_2/data/queries1.dt.cin
rename to 3rdparty/CGAL/examples/Voronoi_diagram_2/data/queries1.dt.cin
diff --git a/3rdparty/CGAL-4.8/examples/Voronoi_diagram_2/data/queries1.svd.cin b/3rdparty/CGAL/examples/Voronoi_diagram_2/data/queries1.svd.cin
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Voronoi_diagram_2/data/queries1.svd.cin
rename to 3rdparty/CGAL/examples/Voronoi_diagram_2/data/queries1.svd.cin
diff --git a/3rdparty/CGAL-4.8/examples/Voronoi_diagram_2/vd_2_point_location.cpp b/3rdparty/CGAL/examples/Voronoi_diagram_2/vd_2_point_location.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Voronoi_diagram_2/vd_2_point_location.cpp
rename to 3rdparty/CGAL/examples/Voronoi_diagram_2/vd_2_point_location.cpp
diff --git a/3rdparty/CGAL-4.8/examples/Voronoi_diagram_2/vd_2_point_location_sdg_linf.cpp b/3rdparty/CGAL/examples/Voronoi_diagram_2/vd_2_point_location_sdg_linf.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/examples/Voronoi_diagram_2/vd_2_point_location_sdg_linf.cpp
rename to 3rdparty/CGAL/examples/Voronoi_diagram_2/vd_2_point_location_sdg_linf.cpp
diff --git a/3rdparty/CGAL-4.8/include/CGAL/AABB_C3T3_triangle_primitive.h b/3rdparty/CGAL/include/CGAL/AABB_C3T3_triangle_primitive.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/AABB_C3T3_triangle_primitive.h
rename to 3rdparty/CGAL/include/CGAL/AABB_C3T3_triangle_primitive.h
diff --git a/3rdparty/CGAL/include/CGAL/AABB_face_graph_triangle_primitive.h b/3rdparty/CGAL/include/CGAL/AABB_face_graph_triangle_primitive.h
new file mode 100644
index 0000000..364f0c7
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/AABB_face_graph_triangle_primitive.h
@@ -0,0 +1,178 @@
+// Copyright (c) 2012 INRIA Sophia-Antipolis (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
+// 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(s)     : Sebastien Loriot
+//
+
+#ifndef CGAL_AABB_FACE_GRAPH_TRIANGLE_PRIMITIVE_H
+#define CGAL_AABB_FACE_GRAPH_TRIANGLE_PRIMITIVE_H
+
+#include <CGAL/AABB_primitive.h>
+#include <CGAL/internal/AABB_tree/Halfedge_and_face_graph_property_maps.h>
+#include <CGAL/Default.h>
+
+namespace CGAL {
+
+/*!
+ * \ingroup PkgAABB_tree
+ * Primitive type for a facet of a polyhedral surface.
+ * It wraps a handle to a facet of a polyhedron to a 3D triangle.
+ * The polyhedron from which the primitive is built should not be deleted
+ * while the AABB tree holding the primitive is in use.
+ *
+ * \cgalModels `AABBPrimitiveWithSharedData`
+ *
+ *\tparam FaceGraph is a model of the face graph concept.
+ *\tparam VertexPointPMap  is a property map with `boost::graph_traits<FaceGraph>::%vertex_descriptor`
+ *   as key type and a \cgal Kernel `Point_3` as value type.
+ *                         The default is `typename boost::property_map< FaceGraph,vertex_point_t>::%type`.
+ *\tparam OneFaceGraphPerTree is either `CGAL::Tag_true` or `CGAL::Tag_false`.
+ * In the former case, we guarantee that all the primitives will be from a
+ * common polyhedron and some data will be factorized so that the size of
+ * the primitive is reduced. In the latter case, the primitives can be from
+ * different polyhedra and extra storage is required in the primitives. The default is `CGAL::Tag_true`.
+ *        This parameter is useless for the moment and will be useful in an upcoming release of \cgal.
+ *\tparam CacheDatum is either `CGAL::Tag_true` or `CGAL::Tag_false`. In the former case, the datum is stored
+ *        in the primitive, while in the latter it is constructed on the fly to reduce the memory footprint.
+ *        The default is `CGAL::Tag_false` (datum is not stored).
+ *\sa `AABBPrimitive`
+ *\sa `AABB_primitive<Id,ObjectPropertyMap,PointPropertyMapPolyhedron,ExternalPropertyMaps,CacheDatum>`
+ *\sa `AABB_halfedge_graph_segment_primitive<HalfedgeGraph,OneHalfedgeGraphPerTree,CacheDatum>`
+ */
+template < class FaceGraph,
+           class VertexPointPMap = Default,
+           class OneFaceGraphPerTree = Tag_true,
+           class CacheDatum=Tag_false >
+class AABB_face_graph_triangle_primitive
+#ifndef DOXYGEN_RUNNING
+  : public AABB_primitive<typename boost::graph_traits<FaceGraph>::face_descriptor,
+                        Triangle_from_face_descriptor_property_map<
+                          FaceGraph,
+                          typename Default::Get<VertexPointPMap,
+                                                typename boost::property_map< FaceGraph,
+                                                                              vertex_point_t>::type >::type>,
+                        One_point_from_face_descriptor_property_map<
+                          FaceGraph,
+                          typename Default::Get<VertexPointPMap,
+                                                typename boost::property_map< FaceGraph,
+                                                                              vertex_point_t>::type >::type>,
+                        OneFaceGraphPerTree,
+                        CacheDatum >
+#endif
+{
+  typedef typename Default::Get<VertexPointPMap, typename boost::property_map< FaceGraph, vertex_point_t>::type >::type VertexPointPMap_;
+
+  typedef typename boost::graph_traits<FaceGraph>::face_descriptor Id_;
+  typedef Triangle_from_face_descriptor_property_map<FaceGraph,VertexPointPMap_>  Triangle_property_map;
+  typedef One_point_from_face_descriptor_property_map<FaceGraph,VertexPointPMap_> Point_property_map;
+
+  typedef AABB_primitive< Id_,
+                          Triangle_property_map,
+                          Point_property_map,
+                          OneFaceGraphPerTree,
+                          CacheDatum > Base;
+
+public:
+  #ifdef DOXYGEN_RUNNING
+  /// \name Types
+  /// @{
+  /*!
+  The point type.
+  */
+  typedef boost::property_traits<VertexPointPMap>::value_type Point;
+  /*!
+  Geometric data type.
+  */
+  typedef Kernel_traits<Point>::Kernel::Triangle_3 Datum;
+  /*!
+  Id type.
+  */
+  typedef boost::graph_traits<FaceGraph>::face_descriptor Id;
+  /// @}
+
+  /*!
+  If `OneFaceGraphPerTree` is CGAL::Tag_true, constructs a `Shared_data` object from a reference to the polyhedon `graph`.
+  */
+  static unspecified_type construct_shared_data( FaceGraph& graph );
+  #else
+  typedef typename Base::Id Id;
+  #endif
+
+  // constructors
+  /*!
+    \tparam Iterator an input iterator with `Id` as value type.
+    Constructs a primitive.
+    If `VertexPointPMap` is the default of the class, an additional constructor
+    is available with `vppm` set to `get(vertex_point, graph)`.
+  */
+  template <class Iterator>
+  AABB_face_graph_triangle_primitive(Iterator it, const FaceGraph& graph, VertexPointPMap_ vppm)
+    : Base( Id_(*it),
+            Triangle_property_map(const_cast<FaceGraph*>(&graph),vppm),
+            Point_property_map(const_cast<FaceGraph*>(&graph),vppm) )
+  {}
+
+  /*!
+    Constructs a primitive.
+    If `VertexPointPMap` is the default of the class, an additional constructor
+    is available with `vppm` set to `get(vertex_point, graph)`.
+  */
+  AABB_face_graph_triangle_primitive(Id id, const FaceGraph& graph, VertexPointPMap_ vppm)
+    : Base( Id_(id),
+            Triangle_property_map(const_cast<FaceGraph*>(&graph),vppm),
+            Point_property_map(const_cast<FaceGraph*>(&graph),vppm) )
+  {}
+
+#ifndef DOXYGEN_RUNNING
+  template <class Iterator>
+  AABB_face_graph_triangle_primitive(Iterator it, const FaceGraph& graph)
+    : Base( Id_(*it),
+            Triangle_property_map(const_cast<FaceGraph*>(&graph)),
+            Point_property_map(const_cast<FaceGraph*>(&graph)) )
+  {}
+
+  AABB_face_graph_triangle_primitive(Id id, const FaceGraph& graph)
+    : Base( Id_(id),
+            Triangle_property_map(const_cast<FaceGraph*>(&graph)),
+            Point_property_map(const_cast<FaceGraph*>(&graph)) )
+  {}
+#endif
+
+  /// \internal
+  typedef internal::Cstr_shared_data<FaceGraph, Base, Triangle_property_map, Point_property_map, OneFaceGraphPerTree> Cstr_shared_data;
+  /// \internal
+  static
+  typename Cstr_shared_data::Shared_data
+  construct_shared_data(const FaceGraph& graph)
+  {
+    return Cstr_shared_data::construct_shared_data(const_cast<FaceGraph&>(graph));
+  }
+
+  static
+  typename Cstr_shared_data::Shared_data
+  construct_shared_data(const FaceGraph& graph, const VertexPointPMap_& vpm)
+  {
+    return Cstr_shared_data::construct_shared_data(const_cast<FaceGraph&>(graph), vpm);
+  }
+
+};
+
+}  // end namespace CGAL
+
+#endif // CGAL_AABB_FACE_GRAPH_TRIANGLE_PRIMITIVE_H
+
diff --git a/3rdparty/CGAL-4.8/include/CGAL/AABB_halfedge_graph_segment_primitive.h b/3rdparty/CGAL/include/CGAL/AABB_halfedge_graph_segment_primitive.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/AABB_halfedge_graph_segment_primitive.h
rename to 3rdparty/CGAL/include/CGAL/AABB_halfedge_graph_segment_primitive.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/AABB_intersections.h b/3rdparty/CGAL/include/CGAL/AABB_intersections.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/AABB_intersections.h
rename to 3rdparty/CGAL/include/CGAL/AABB_intersections.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/AABB_polyhedral_oracle.h b/3rdparty/CGAL/include/CGAL/AABB_polyhedral_oracle.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/AABB_polyhedral_oracle.h
rename to 3rdparty/CGAL/include/CGAL/AABB_polyhedral_oracle.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/AABB_polyhedron_segment_primitive.h b/3rdparty/CGAL/include/CGAL/AABB_polyhedron_segment_primitive.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/AABB_polyhedron_segment_primitive.h
rename to 3rdparty/CGAL/include/CGAL/AABB_polyhedron_segment_primitive.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/AABB_polyhedron_triangle_primitive.h b/3rdparty/CGAL/include/CGAL/AABB_polyhedron_triangle_primitive.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/AABB_polyhedron_triangle_primitive.h
rename to 3rdparty/CGAL/include/CGAL/AABB_polyhedron_triangle_primitive.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/AABB_primitive.h b/3rdparty/CGAL/include/CGAL/AABB_primitive.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/AABB_primitive.h
rename to 3rdparty/CGAL/include/CGAL/AABB_primitive.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/AABB_segment_primitive.h b/3rdparty/CGAL/include/CGAL/AABB_segment_primitive.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/AABB_segment_primitive.h
rename to 3rdparty/CGAL/include/CGAL/AABB_segment_primitive.h
diff --git a/3rdparty/CGAL/include/CGAL/AABB_traits.h b/3rdparty/CGAL/include/CGAL/AABB_traits.h
new file mode 100644
index 0000000..39e677d
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/AABB_traits.h
@@ -0,0 +1,505 @@
+// Copyright (c) 2009 INRIA Sophia-Antipolis (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
+// 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(s) : Stéphane Tayeb, Pierre Alliez, Camille Wormser
+//
+
+#ifndef CGAL_AABB_TRAITS_H_
+#define CGAL_AABB_TRAITS_H_
+
+#include <CGAL/Bbox_3.h>
+#include <CGAL/AABB_intersections.h>
+#include <CGAL/internal/AABB_tree/Has_nested_type_Shared_data.h>
+#include <CGAL/internal/AABB_tree/Is_ray_intersection_geomtraits.h>
+#include <CGAL/internal/AABB_tree/Primitive_helper.h>
+
+#include <boost/optional.hpp>
+#include <boost/bind.hpp>
+
+/// \file AABB_traits.h
+
+namespace CGAL {
+
+namespace internal{  namespace AABB_tree {
+
+template <class T>
+struct Remove_optional  { typedef T type; };
+
+template <class T>
+struct Remove_optional< ::boost::optional<T> >  { typedef T type; };
+
+//helper controlling whether extra data should be stored in the AABB_tree traits class
+template <class Primitive, bool has_shared_data=Has_nested_type_Shared_data<Primitive>::value>
+struct AABB_traits_base;
+
+template <class Primitive>
+struct AABB_traits_base<Primitive,false>{};
+
+template <class Primitive>
+struct AABB_traits_base<Primitive,true>{
+  typename  Primitive::Shared_data m_primitive_data;
+
+  #if !defined(CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES) && !defined(CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE)
+  template <typename ... T>
+  void set_shared_data(T&& ... t){
+    m_primitive_data=Primitive::construct_shared_data(std::forward<T>(t)...);
+  }
+  #else
+  void set_shared_data(){
+    m_primitive_data=Primitive::construct_shared_data();
+  }
+
+  template <class T1>
+  void set_shared_data(T1& t1){
+    m_primitive_data=Primitive::construct_shared_data(t1);
+  }
+
+  template <class T1,class T2>
+  void set_shared_data(T1& t1, T2& t2){
+    m_primitive_data=Primitive::construct_shared_data(t1,t2);
+  }
+
+  template <class T1,class T2,class T3>
+  void set_shared_data(T1& t1,T2& t2,T3& t3){
+    m_primitive_data=Primitive::construct_shared_data(t1,t2,t3);
+  }
+
+  template <class T1,class T2,class T3,class T4>
+  void set_shared_data(T1& t1,T2& t2,T3& t3,T4& t4){
+    m_primitive_data=Primitive::construct_shared_data(t1,t2,t3,t4);
+  }
+
+  template <class T1,class T2,class T3,class T4,class T5>
+  void set_shared_data(T1& t1,T2& t2,T3& t3,T4& t4,T5& t5){
+    m_primitive_data=Primitive::construct_shared_data(t1,t2,t3,t4,t5);
+  }
+  #endif
+  const typename Primitive::Shared_data& shared_data() const {return m_primitive_data;}
+};
+
+// AABB_traits_base_2 brings in the Intersection_distance predicate,
+// if GeomTraits is a model RayIntersectionGeomTraits.
+template <typename GeomTraits, bool ray_intersection_geom_traits=Is_ray_intersection_geomtraits<GeomTraits>::value>
+struct AABB_traits_base_2;
+
+template <typename GeomTraits>
+struct AABB_traits_base_2<GeomTraits,false>{};
+
+template <typename GeomTraits>
+struct AABB_traits_base_2<GeomTraits,true>{
+  typedef typename GeomTraits::Ray_3 Ray_3;
+  typedef typename GeomTraits::Point_3 Point_3;
+  typedef typename GeomTraits::Vector_3 Vector_3;
+  typedef typename GeomTraits::FT    FT;
+  typedef typename GeomTraits::Cartesian_const_iterator_3 Cartesian_const_iterator_3;
+  typedef typename GeomTraits::Construct_cartesian_const_iterator_3 Construct_cartesian_const_iterator_3;
+  typedef typename GeomTraits::Construct_source_3 Construct_source_3;
+  typedef typename GeomTraits::Construct_vector_3 Construct_vector_3;
+
+  // Defining Bounding_box and other types from the full AABB_traits
+  // here is might seem strange, but otherwise we would need to use
+  // CRTP to get access to the derived class, which would bloat the
+  // code more.
+  typedef typename CGAL::Bbox_3      Bounding_box;
+
+  struct Intersection_distance {
+    boost::optional<FT> operator()(const Ray_3& ray, const Bounding_box& bbox) const {
+      FT t_near = -DBL_MAX; // std::numeric_limits<FT>::lowest(); C++1903
+      FT t_far = DBL_MAX;
+
+      const Construct_cartesian_const_iterator_3 construct_cartesian_const_iterator_3
+        = GeomTraits().construct_cartesian_const_iterator_3_object();
+      const Construct_source_3 construct_source_3 = GeomTraits().construct_source_3_object();
+      const Construct_vector_3 construct_vector_3 = GeomTraits().construct_vector_3_object();
+      const Point_3 source = construct_source_3(ray);
+      const Vector_3 direction = construct_vector_3(ray);
+      Cartesian_const_iterator_3 source_iter = construct_cartesian_const_iterator_3(source);
+      Cartesian_const_iterator_3 direction_iter = construct_cartesian_const_iterator_3(direction);
+
+      for(int i = 0; i < 3; ++i, ++source_iter, ++direction_iter) {
+        if(*direction_iter == 0) {
+          if((*source_iter < (bbox.min)(i)) || (*source_iter > (bbox.max)(i))) {
+            return boost::none;
+          }
+        } else {
+          FT t1 = ((bbox.min)(i) - *source_iter) / *direction_iter;
+          FT t2 = ((bbox.max)(i) - *source_iter) / *direction_iter;
+ 
+          t_near = (std::max)(t_near, (std::min)(t1, t2));
+          t_far = (std::min)(t_far, (std::max)(t1, t2));
+
+          // if(t1 > t2)
+          //   std::swap(t1, t2);
+          // if(t1 > t_near)
+          //   t_near = t1;
+          // if(t2 < t_far)
+          //   t_far = t2;
+
+          if(t_near > t_far || t_far < FT(0.))
+            return boost::none;
+        }
+      }
+
+      if(t_near < FT(0.))
+        return FT(0.);
+      else
+        return t_near;
+    }
+  };
+
+  Intersection_distance intersection_distance_object() const { return Intersection_distance(); }
+};
+
+} } //end of namespace internal::AABB_tree
+
+/// \addtogroup PkgAABB_tree
+/// @{
+
+/// This traits class handles any type of 3D geometric
+/// primitives provided that the proper intersection tests and
+/// constructions are implemented. It handles points, rays, lines and
+/// segments as query types for intersection detection and
+/// computations, and it handles points as query type for distance
+/// queries.
+///
+/// \cgalModels AABBTraits
+/// \cgalModels AABBRayIntersectionTraits
+
+/// \tparam GeomTraits must  be a model of the concept \ref AABBGeomTraits,
+/// and provide the geometric types as well as the intersection tests and computations.
+/// \tparam Primitive provide the type of primitives stored in the AABB_tree.
+///   It is a model of the concept `AABBPrimitive` or `AABBPrimitiveWithSharedData`.
+///
+/// If the argument GeomTraits is a model of the concept \ref
+/// AABBRayIntersectionGeomTraits, this class is also a model of \ref
+/// AABBRayIntersectionTraits.
+///
+/// \sa `AABBTraits`
+/// \sa `AABB_tree`
+/// \sa `AABBPrimitive`
+/// \sa `AABBPrimitiveWithSharedData`
+template<typename GeomTraits, typename AABBPrimitive>
+class AABB_traits:
+  public internal::AABB_tree::AABB_traits_base<AABBPrimitive>,
+  public internal::AABB_tree::AABB_traits_base_2<GeomTraits>
+{
+  typedef typename CGAL::Object Object;
+public:
+  typedef GeomTraits Geom_traits;
+
+  typedef AABB_traits<GeomTraits, AABBPrimitive> AT;
+  // AABBTraits concept types
+  typedef typename GeomTraits::FT FT;
+  typedef AABBPrimitive Primitive;
+
+  typedef typename std::pair<Object,typename Primitive::Id> Object_and_primitive_id;
+
+  typedef typename std::pair<typename GeomTraits::Point_3, typename Primitive::Id> Point_and_primitive_id;
+
+  /// `Intersection_and_primitive_id<Query>::%Type::first_type` is found according to
+  /// the result type of `GeomTraits::Intersect_3::operator()`,
+  /// (that is cpp11::result_of<GeomTraits::Intersect_3(Query, Primitive::Datum)>::type). If it is
+  /// `boost::optional<T>` then it is `T`, and the result type otherwise.
+  template<typename Query>
+  struct Intersection_and_primitive_id {
+    typedef typename cpp11::result_of<
+      typename GeomTraits::Intersect_3(Query, typename Primitive::Datum)
+    >::type Intersection_type;
+
+    typedef std::pair<
+      typename internal::AABB_tree::Remove_optional<Intersection_type>::type,
+      typename Primitive::Id > Type;
+  };
+
+  // types for search tree
+  /// \name Types
+  /// @{
+
+  /// Point query type.
+  typedef typename GeomTraits::Point_3 Point_3;
+
+  /// additionnal types for the search tree, required by the RangeSearchTraits concept
+  /// \bug This is not documented for now in the AABBTraits concept.
+  typedef typename GeomTraits::Iso_cuboid_3 Iso_cuboid_3;
+
+  ///
+  typedef typename CGAL::Bbox_3 Bounding_box;
+
+  /// @}
+
+  typedef typename GeomTraits::Sphere_3 Sphere_3;
+  typedef typename GeomTraits::Cartesian_const_iterator_3 Cartesian_const_iterator_3;
+  typedef typename GeomTraits::Construct_cartesian_const_iterator_3 Construct_cartesian_const_iterator_3;
+  typedef typename GeomTraits::Construct_center_3 Construct_center_3;
+  typedef typename GeomTraits::Compute_squared_radius_3 Compute_squared_radius_3;
+  typedef typename GeomTraits::Construct_min_vertex_3 Construct_min_vertex_3;
+  typedef typename GeomTraits::Construct_max_vertex_3 Construct_max_vertex_3;
+  typedef typename GeomTraits::Construct_iso_cuboid_3 Construct_iso_cuboid_3;
+
+
+  /// Default constructor.
+  AABB_traits() { };
+
+
+  typedef typename GeomTraits::Compute_squared_distance_3 Squared_distance;
+  Squared_distance squared_distance_object() const { return GeomTraits().compute_squared_distance_3_object(); }
+
+  /**
+   * @internal
+   * @brief Sorts [first,beyond[
+   * @param first iterator on first element
+   * @param beyond iterator on beyond element
+   * @param bbox the bounding box of [first,beyond[
+   *
+   * Sorts the range defined by [first,beyond[. Sort is achieved on bbox longuest
+   * axis, using the comparison function `<dim>_less_than` (dim in {x,y,z})
+   */
+  class Sort_primitives
+  {
+    const AABB_traits<GeomTraits,AABBPrimitive>& m_traits;
+  public:
+    Sort_primitives(const AABB_traits<GeomTraits,AABBPrimitive>& traits)
+      : m_traits(traits) {}
+
+    template<typename PrimitiveIterator>
+    void operator()(PrimitiveIterator first,
+                    PrimitiveIterator beyond,
+                    const typename AT::Bounding_box& bbox) const
+      {
+        PrimitiveIterator middle = first + (beyond - first)/2;
+        switch(longest_axis(bbox))
+        {
+        case AT::CGAL_AXIS_X: // sort along x
+          std::nth_element(first, middle, beyond, boost::bind(less_x,_1,_2,m_traits));
+          break;
+        case AT::CGAL_AXIS_Y: // sort along y
+          std::nth_element(first, middle, beyond, boost::bind(less_y,_1,_2,m_traits));
+          break;
+        case AT::CGAL_AXIS_Z: // sort along z
+          std::nth_element(first, middle, beyond, boost::bind(less_z,_1,_2,m_traits));
+          break;
+        default:
+          CGAL_error();
+        }
+      }
+  };
+
+  Sort_primitives sort_primitives_object() const {return Sort_primitives(*this);}
+
+
+  /*
+   * Computes the bounding box of a set of primitives
+   * @param first an iterator on the first primitive
+   * @param beyond an iterator on the past-the-end primitive
+   * @return the bounding box of the primitives of the iterator range
+   */
+  class Compute_bbox {
+    const AABB_traits<GeomTraits,AABBPrimitive>& m_traits;
+  public:
+    Compute_bbox(const AABB_traits<GeomTraits,AABBPrimitive>& traits)
+      :m_traits (traits) {}
+
+    template<typename ConstPrimitiveIterator>
+    typename AT::Bounding_box operator()(ConstPrimitiveIterator first,
+                                         ConstPrimitiveIterator beyond) const
+      {
+        typename AT::Bounding_box bbox = compute_bbox(*first,m_traits);
+        for(++first; first != beyond; ++first)
+        {
+          bbox = bbox + compute_bbox(*first,m_traits);
+        }
+        return bbox;
+      }
+  };
+
+  Compute_bbox compute_bbox_object() const {return Compute_bbox(*this);}
+
+
+  class Do_intersect {
+    const AABB_traits<GeomTraits,AABBPrimitive>& m_traits;
+  public:
+    Do_intersect(const AABB_traits<GeomTraits,AABBPrimitive>& traits)
+      :m_traits(traits) {}
+
+    template<typename Query>
+    bool operator()(const Query& q, const Bounding_box& bbox) const
+    {
+      return CGAL::do_intersect(q, bbox);
+    }
+
+    template<typename Query>
+    bool operator()(const Query& q, const Primitive& pr) const
+    {
+      return GeomTraits().do_intersect_3_object()(q, internal::Primitive_helper<AT>::get_datum(pr,m_traits));
+    }
+  };
+
+  Do_intersect do_intersect_object() const {return Do_intersect(*this);}
+
+  class Intersection {
+    const AABB_traits<GeomTraits,AABBPrimitive>& m_traits;
+  public:
+    Intersection(const AABB_traits<GeomTraits,AABBPrimitive>& traits)
+      :m_traits(traits) {}
+    #if CGAL_INTERSECTION_VERSION < 2
+    template<typename Query>
+    boost::optional<typename AT::Object_and_primitive_id>
+    operator()(const Query& query, const typename AT::Primitive& primitive) const
+    {
+      typedef boost::optional<Object_and_primitive_id> Intersection;
+
+      CGAL::Object object = GeomTraits().intersect_3_object()(internal::Primitive_helper<AT>::get_datum(primitive,m_traits),query);
+      if ( object.empty() )
+        return Intersection();
+      else
+        return Intersection(Object_and_primitive_id(object,primitive.id()));
+    }
+    #else
+    template<typename Query>
+    boost::optional< typename Intersection_and_primitive_id<Query>::Type >
+    operator()(const Query& query, const typename AT::Primitive& primitive) const {
+      typename cpp11::result_of<typename GeomTraits::Intersect_3(Query, typename Primitive::Datum) >::type
+        inter_res = GeomTraits().intersect_3_object()(internal::Primitive_helper<AT>::get_datum(primitive,m_traits),query);
+      if (!inter_res)
+        return boost::none;
+      return boost::make_optional( std::make_pair(*inter_res, primitive.id()) );
+    }
+    #endif
+  };
+
+  Intersection intersection_object() const {return Intersection(*this);}
+
+
+  // This should go down to the GeomTraits, i.e. the kernel
+  class Closest_point {
+      typedef typename AT::Point_3 Point;
+      typedef typename AT::Primitive Primitive;
+    const AABB_traits<GeomTraits,AABBPrimitive>& m_traits;
+  public:
+    Closest_point(const AABB_traits<GeomTraits,AABBPrimitive>& traits)
+      : m_traits(traits) {}
+
+
+    Point operator()(const Point& p, const Primitive& pr, const Point& bound) const
+    {
+        return CGAL::nearest_point_3(p, internal::Primitive_helper<AT>::get_datum(pr,m_traits), bound);
+    }
+  };
+
+  // This should go down to the GeomTraits, i.e. the kernel
+  // and the internal implementation should change its name from
+  // do_intersect to something like does_contain (this is what we compute,
+  // this is not the same do_intersect as the spherical kernel)
+  class Compare_distance {
+      typedef typename AT::Point_3 Point;
+      typedef typename AT::FT FT;
+      typedef typename AT::Primitive Primitive;
+  public:
+      template <class Solid>
+      CGAL::Comparison_result operator()(const Point& p, const Solid& pr, const Point& bound) const
+      {
+          return GeomTraits().do_intersect_3_object()
+          (GeomTraits().construct_sphere_3_object()
+          (p, GeomTraits().compute_squared_distance_3_object()(p, bound)), pr)?
+          CGAL::SMALLER : CGAL::LARGER;
+      }
+
+      template <class Solid>
+      CGAL::Comparison_result operator()(const Point& p, const Solid& pr, const FT& sq_distance) const
+      {
+        return GeomTraits().do_intersect_3_object()
+          (GeomTraits().construct_sphere_3_object()(p, sq_distance),
+           pr) ?
+          CGAL::SMALLER :
+          CGAL::LARGER;
+      }
+  };
+
+  Closest_point closest_point_object() const {return Closest_point(*this);}
+  Compare_distance compare_distance_object() const {return Compare_distance();}
+
+
+private:
+  /**
+   * @brief Computes bounding box of one primitive
+   * @param pr the primitive
+   * @return the bounding box of the primitive \c pr
+   */
+  static Bounding_box compute_bbox (const Primitive& pr,
+                                    const AABB_traits<GeomTraits,AABBPrimitive>& traits)
+  {
+    return internal::Primitive_helper<AT>::get_datum(pr,traits).bbox();
+  }
+
+  typedef enum { CGAL_AXIS_X = 0,
+                 CGAL_AXIS_Y = 1,
+                 CGAL_AXIS_Z = 2} Axis;
+
+  static Axis longest_axis(const Bounding_box& bbox);
+
+  /// Comparison functions
+  static bool less_x(const Primitive& pr1, const Primitive& pr2,const AABB_traits<GeomTraits,AABBPrimitive>& traits)
+  { return internal::Primitive_helper<AT>::get_reference_point(pr1,traits).x() < internal::Primitive_helper<AT>::get_reference_point(pr2,traits).x(); }
+  static bool less_y(const Primitive& pr1, const Primitive& pr2,const AABB_traits<GeomTraits,AABBPrimitive>& traits)
+  { return internal::Primitive_helper<AT>::get_reference_point(pr1,traits).y() < internal::Primitive_helper<AT>::get_reference_point(pr2,traits).y(); }
+  static bool less_z(const Primitive& pr1, const Primitive& pr2,const AABB_traits<GeomTraits,AABBPrimitive>& traits)
+  { return internal::Primitive_helper<AT>::get_reference_point(pr1,traits).z() < internal::Primitive_helper<AT>::get_reference_point(pr2,traits).z(); }
+
+};  // end class AABB_traits
+
+
+//-------------------------------------------------------
+// Private methods
+//-------------------------------------------------------
+template<typename GT, typename P>
+typename AABB_traits<GT,P>::Axis
+AABB_traits<GT,P>::longest_axis(const Bounding_box& bbox)
+{
+  const double dx = bbox.xmax() - bbox.xmin();
+  const double dy = bbox.ymax() - bbox.ymin();
+  const double dz = bbox.zmax() - bbox.zmin();
+
+  if(dx>=dy)
+  {
+    if(dx>=dz)
+    {
+      return CGAL_AXIS_X;
+    }
+    else // dz>dx and dx>=dy
+    {
+      return CGAL_AXIS_Z;
+    }
+  }
+  else // dy>dx
+  {
+    if(dy>=dz)
+    {
+      return CGAL_AXIS_Y;
+    }
+    else  // dz>dy and dy>dx
+    {
+      return CGAL_AXIS_Z;
+    }
+  }
+}
+
+/// @}
+
+}  // end namespace CGAL
+
+#endif // CGAL_AABB_TRAITS_H_
diff --git a/3rdparty/CGAL/include/CGAL/AABB_tree.h b/3rdparty/CGAL/include/CGAL/AABB_tree.h
new file mode 100644
index 0000000..d3117a4
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/AABB_tree.h
@@ -0,0 +1,1294 @@
+// Copyright (c) 2008,2011  INRIA Sophia-Antipolis (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
+// 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(s) : Camille Wormser, Pierre Alliez, Stephane Tayeb
+
+#ifndef CGAL_AABB_TREE_H
+#define CGAL_AABB_TREE_H
+
+#include <vector>
+#include <iterator>
+#include <CGAL/internal/AABB_tree/AABB_traversal_traits.h>
+#include <CGAL/internal/AABB_tree/AABB_node.h>
+#include <CGAL/internal/AABB_tree/AABB_search_tree.h>
+#include <CGAL/internal/AABB_tree/Has_nested_type_Shared_data.h>
+#include <CGAL/internal/AABB_tree/Primitive_helper.h>
+#include <boost/optional.hpp>
+#include <boost/lambda/lambda.hpp>
+
+#ifdef CGAL_HAS_THREADS
+#include <CGAL/mutex.h>
+#endif
+
+/// \file AABB_tree.h
+
+namespace CGAL {
+
+/// \addtogroup PkgAABB_tree
+/// @{
+
+	/**
+   * Class AABB_tree is a static data structure for efficient
+   * intersection and distance computations in 3D. It builds a
+   * hierarchy of axis-aligned bounding boxes (an AABB tree) from a set
+   * of 3D geometric objects, and can receive intersection and distance
+   * queries, provided that the corresponding predicates are
+   * implemented in the traits class AABBTraits.
+   * An instance of the class `AABBTraits` is internally stored.
+   *
+   * \sa `AABBTraits`
+   * \sa `AABBPrimitive`
+   *
+   */
+	template <typename AABBTraits>
+	class AABB_tree
+	{
+	private:
+		// internal KD-tree used to accelerate the distance queries
+		typedef AABB_search_tree<AABBTraits> Search_tree;
+
+		// type of the primitives container
+		typedef std::vector<typename AABBTraits::Primitive> Primitives;
+
+	public:
+    typedef AABBTraits AABB_traits;
+    
+    /// \name Types
+    ///@{
+
+    /// Number type returned by the distance queries.
+		typedef typename AABBTraits::FT FT;
+
+
+    /// Type of 3D point.
+		typedef typename AABBTraits::Point_3 Point;
+
+    /// Type of input primitive.
+		typedef typename AABBTraits::Primitive Primitive;
+		/// Identifier for a primitive in the tree.
+		typedef typename Primitive::Id Primitive_id;
+		/// Unsigned integral size type.
+		typedef typename Primitives::size_type size_type; 
+    /// Type of bounding box.
+		typedef typename AABBTraits::Bounding_box Bounding_box;
+    /// 
+		typedef typename AABBTraits::Point_and_primitive_id Point_and_primitive_id;
+    /// \deprecated 
+		typedef typename AABBTraits::Object_and_primitive_id Object_and_primitive_id;
+
+    /*!
+    An alias to `AABBTraits::Intersection_and_primitive_id<Query>`
+    */
+    #ifdef DOXYGEN_RUNNING
+    template<typename Query>
+    using Intersection_and_primitive_id = AABBTraits::Intersection_and_primitive_id<Query>;
+    #else
+    template<typename Query>
+    struct Intersection_and_primitive_id {
+      typedef typename AABBTraits::template Intersection_and_primitive_id<Query>::Type Type;
+    };
+    #endif
+
+    
+    ///@}
+
+	public:
+    /// \name Creation
+    ///@{
+
+    /// Constructs an empty tree, and initializes the internally stored traits
+    /// class using `traits`.
+    AABB_tree(const AABBTraits& traits = AABBTraits());
+
+    /**
+     * @brief Builds the datastructure from a sequence of primitives.
+     * @param first iterator over first primitive to insert
+     * @param beyond past-the-end iterator
+     *
+     * It is equivalent to constructing an empty tree and calling `insert(first,last,t...)`.
+     * For compilers that do not support variadic templates, overloads up to 
+     * 5 template arguments are provided.
+     * The tree stays empty if the memory allocation is not successful.
+     */
+    #if !defined(CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES) && !defined(CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE)
+		template<typename InputIterator,typename ... T>
+		AABB_tree(InputIterator first, InputIterator beyond,T&& ...);  
+    #else
+		template<typename InputIterator>
+		AABB_tree(InputIterator first, InputIterator beyond);
+    template<typename InputIterator, typename T1>
+		AABB_tree(InputIterator first, InputIterator beyond, T1&);
+    template<typename InputIterator, typename T1, typename T2>
+    AABB_tree(InputIterator first, InputIterator beyond,T1&,T2&);
+    template<typename InputIterator, typename T1, typename T2, typename T3>
+		AABB_tree(InputIterator first, InputIterator beyond,T1&,T2&,T3&);
+    template<typename InputIterator, typename T1, typename T2, typename T3, typename T4>
+		AABB_tree(InputIterator first, InputIterator beyond,T1&,T2&,T3&,T4&);
+    template<typename InputIterator, typename T1, typename T2, typename T3, typename T4, typename T5>
+		AABB_tree(InputIterator first, InputIterator beyond,T1&,T2&,T3&,T4&,T5&);
+    #endif
+
+    ///@}
+
+		/// \name Operations
+		///@{
+
+    /// Equivalent to calling `clear()` and then `insert(first,last,t...)`.
+    /// For compilers that do not support variadic templates, overloads up
+    /// to 5 template arguments are provided.
+    #if !defined(CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES) && !defined(CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE)
+		template<typename ConstPrimitiveIterator,typename ... T>
+		void rebuild(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond,T&& ...);
+    #else
+		template<typename ConstPrimitiveIterator>
+		void rebuild(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond);
+    template<typename ConstPrimitiveIterator, typename T1>
+		void rebuild(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond, T1&);
+    template<typename ConstPrimitiveIterator, typename T1, typename T2>
+		void rebuild(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond,T1&,T2&);
+    template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3>
+		void rebuild(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond,T1&,T2&,T3&);
+    template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3, typename T4>
+		void rebuild(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond,T1&,T2&,T3&,T4&);
+    template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3, typename T4, typename T5>
+		void rebuild(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond,T1&,T2&,T3&,T4&,T5&);
+    #endif
+
+
+    /// Add a sequence of primitives to the set of primitives of the AABB tree.
+    /// `%InputIterator` is any iterator and the parameter pack `T` are any types
+    /// such that `Primitive` has a constructor with the following signature:
+    /// `Primitive(%InputIterator, T...)`. If `Primitive` is a model of the concept
+    /// `AABBPrimitiveWithSharedData`, a call to `AABBTraits::set_shared_data(t...)`
+    /// is made using the internally stored traits.
+    /// For compilers that do not support variadic templates,
+    /// overloads up to 5 template arguments are provided.
+    #if !defined(CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES) && !defined(CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE)
+		template<typename InputIterator,typename ... T>
+		void insert(InputIterator first, InputIterator beyond,T&& ...);
+    #else
+		template<typename InputIterator>
+		void insert(InputIterator first, InputIterator beyond);
+    template<typename InputIterator, typename T1>
+		void insert(InputIterator first, InputIterator beyond,T1&);
+    template<typename InputIterator, typename T1, typename T2>
+		void insert(InputIterator first, InputIterator beyond,T1&, T2&);
+    template<typename InputIterator, typename T1, typename T2, typename T3>
+		void insert(InputIterator first, InputIterator beyond,T1&,T2&,T3&);
+    template<typename InputIterator, typename T1, typename T2, typename T3, typename T4>
+		void insert(InputIterator first, InputIterator beyond,T1&,T2&,T3&,T4&);
+    template<typename InputIterator, typename T1, typename T2, typename T3, typename T4, typename T5>
+		void insert(InputIterator first, InputIterator beyond,T1&,T2&,T3&,T4&,T5&);
+    #endif
+
+    /// Adds a primitive to the set of primitives of the tree.
+    inline void insert(const Primitive& p);
+
+		/// Clears and destroys the tree.
+		~AABB_tree()
+		{
+			clear();
+		}
+    /// Returns a const reference to the internally stored traits class.
+    const AABBTraits& traits() const{
+      return m_traits; 
+    }
+    
+		/// Clears the tree.
+		void clear()
+		{
+			// clear AABB tree
+      clear_nodes();
+			m_primitives.clear();
+			clear_search_tree();
+		}
+
+		/// Returns the axis-aligned bounding box of the whole tree.
+		/// \pre `!empty()`
+		const Bounding_box bbox() const { 
+			CGAL_precondition(!empty());
+			if(size() > 1)
+				return root_node()->bbox(); 
+			else
+				return AABB_traits().compute_bbox_object()(m_primitives.begin(), 
+																									 m_primitives.end());
+		}
+    
+    /// Returns the number of primitives in the tree.
+		size_type size() const { return m_primitives.size(); }
+    
+    /// Returns \c true, iff the tree contains no primitive.
+		bool empty() const { return m_primitives.empty(); }
+		///@}
+
+    /// \name Advanced
+    ///@{
+
+    /// After one or more calls to `AABB_tree::insert()` the internal data
+    /// structure of the tree must be reconstructed. This procedure
+    /// has a complexity of \f$O(n log(n))\f$, where \f$n\f$ is the number of
+    /// primitives of the tree.  This procedure is called implicitly
+    /// at the first call to a query member function. You can call
+    /// AABB_tree::build() explicitly to ensure that the next call to
+    /// query functions will not trigger the reconstruction of the
+    /// data structure.
+    void build();
+
+    ///@}
+
+	private:
+    #if !defined(CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES) && !defined(CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE)
+    template <typename ... T>
+    void set_primitive_data_impl(CGAL::Boolean_tag<false>,T ... ){}
+    template <typename ... T>
+    void set_primitive_data_impl(CGAL::Boolean_tag<true>,T&& ... t)
+    {m_traits.set_shared_data(std::forward<T>(t)...);}
+
+    template <typename ... T>
+    void set_shared_data(T&& ...t){
+      set_primitive_data_impl(CGAL::Boolean_tag<internal::Has_nested_type_Shared_data<Primitive>::value>(),std::forward<T>(t)...);
+    }
+    #else
+    void set_primitive_data_impl(CGAL::Boolean_tag<false>){}
+    void set_primitive_data_impl(CGAL::Boolean_tag<true>)
+    {m_traits.set_shared_data();}
+    void set_shared_data(){
+      set_primitive_data_impl(CGAL::Boolean_tag<internal::Has_nested_type_Shared_data<Primitive>::value>());
+    }
+    
+    template <typename T1>
+    void set_primitive_data_impl(CGAL::Boolean_tag<false>,T1){}
+    template <typename T1>
+    void set_primitive_data_impl(CGAL::Boolean_tag<true>,T1& t1)
+    {m_traits.set_shared_data(t1);}
+    template <typename T1>
+    void set_shared_data(T1& t1){
+      set_primitive_data_impl(Boolean_tag<internal::Has_nested_type_Shared_data<Primitive>::value>(),t1);
+    }
+    
+    template <typename T1, typename T2>
+    void set_primitive_data_impl(CGAL::Boolean_tag<false>,T1,T2){}
+    template <typename T1, typename T2>
+    void set_primitive_data_impl(CGAL::Boolean_tag<true>,T1& t1,T2& t2)
+    {m_traits.set_shared_data(t1,t2);}
+    template <typename T1, typename T2>
+    void set_shared_data(const T1& t1,const T2& t2){
+      set_primitive_data_impl(Boolean_tag<internal::Has_nested_type_Shared_data<Primitive>::value>(),t1,t2);
+    }
+    
+    template <typename T1, typename T2, typename T3>
+    void set_primitive_data_impl(CGAL::Boolean_tag<false>,T1,T2,T3){}
+    template <typename T1, typename T2, typename T3>
+    void set_primitive_data_impl(CGAL::Boolean_tag<true>,T1& t1,T2& t2,T3& t3)
+    {m_traits.set_shared_data(t1,t2,t3);}
+    template <typename T1, typename T2, typename T3>
+    void set_shared_data(T1& t1,T2& t2,T3& t3){
+      set_primitive_data_impl(Boolean_tag<internal::Has_nested_type_Shared_data<Primitive>::value>(),t1,t2,t3);
+    }
+    
+    template <typename T1, typename T2, typename T3, typename T4>
+    void set_primitive_data_impl(CGAL::Boolean_tag<false>,T1,T2,T3,T4){}
+    template <typename T1, typename T2, typename T3, typename T4>
+    void set_primitive_data_impl(CGAL::Boolean_tag<true>,T1& t1,T2& t2,T3& t3,T4& t4)
+    {m_traits.set_shared_data(t1,t2,t3,t4);}
+    template <typename T1, typename T2, typename T3, typename T4>
+    void set_shared_data(T1& t1,T2& t2,T3& t3,T4& t4){
+      set_primitive_data_impl(Boolean_tag<internal::Has_nested_type_Shared_data<Primitive>::value>(),t1,t2,t3,t4);
+    }
+    
+    template <typename T1, typename T2, typename T3, typename T4, typename T5>
+    void set_primitive_data_impl(CGAL::Boolean_tag<false>,T1,T2,T3,T4,T5){}
+    template <typename T1, typename T2, typename T3, typename T4, typename T5>
+    void set_primitive_data_impl(CGAL::Boolean_tag<true>,T1& t1,T2& t2,T3& t3,T4& t4,T5& t5)
+    {m_traits.set_shared_data(t1,t2,t3,t4,t5);}
+    template <typename T1, typename T2, typename T3, typename T4, typename T5>
+    void set_shared_data(T1& t1,T2& t2,T3& t3,T4& t4,T5& t5){
+      set_primitive_data_impl(Boolean_tag<internal::Has_nested_type_Shared_data<Primitive>::value>(),t1,t2,t3,t4,t5);
+    }
+    #endif
+
+		template<typename ConstPointIterator>
+		bool accelerate_distance_queries_impl(ConstPointIterator first,
+                                          ConstPointIterator beyond) const;
+public:
+
+    /// \name Intersection Tests
+    ///@{
+
+		/// Returns `true`, iff the query intersects at least one of
+		/// the input primitives. \tparam Query must be a type for
+		/// which `do_intersect` predicates are
+		/// defined in the traits class `AABBTraits`.
+		template<typename Query>
+		bool do_intersect(const Query& query) const;
+
+    /// Returns the number of primitives intersected by the
+    /// query. \tparam Query must be a type for which
+    /// `do_intersect` predicates are defined
+    /// in the traits class `AABBTraits`.
+		template<typename Query>
+		size_type number_of_intersected_primitives(const Query& query) const;
+
+    /// Outputs to the iterator the list of all intersected primitives
+    /// ids. This function does not compute the intersection points
+    /// and is hence faster than the function `all_intersections()`
+    /// function below. \tparam Query must be a type for which
+    /// `do_intersect` predicates are defined
+    /// in the traits class `AABBTraits`.
+		template<typename Query, typename OutputIterator>
+		OutputIterator all_intersected_primitives(const Query& query, OutputIterator out) const;
+
+
+    /// Returns the intersected primitive id that is encountered first 
+		/// in the tree traversal, iff
+    /// the query intersects at least one of the input primitives. No
+    /// particular order is guaranteed over the tree traversal, such
+    /// that, e.g, the primitive returned is not necessarily the
+    /// closest from the source point of a ray query. \tparam Query
+    /// must be a type for which
+    /// `do_intersect` predicates are defined
+    /// in the traits class `AABBTraits`.
+		template <typename Query>
+		boost::optional<Primitive_id> any_intersected_primitive(const Query& query) const;
+    ///@}
+
+    /// \name Intersections
+    ///@{
+
+    /// Outputs the list of all intersections, as objects of
+    /// `Intersection_and_primitive_id<Query>::%Type`,
+    /// between the query and the input data to
+    /// the iterator. `do_intersect()`
+    /// predicates and intersections must be defined for `Query`
+    /// in the `AABBTraits` class.
+		template<typename Query, typename OutputIterator>
+		OutputIterator all_intersections(const Query& query, OutputIterator out) const;
+
+
+    /// Returns the intersection that is encountered first 
+		/// in the tree traversal. No particular
+    /// order is guaranteed over the tree traversal, e.g, the
+    /// primitive returned is not necessarily the closest from the
+    /// source point of a ray query. Type `Query` must be a type
+    /// for which `do_intersect` predicates
+    /// and intersections are defined in the traits class AABBTraits.
+		template <typename Query>
+    #if CGAL_INTERSECTION_VERSION < 2 && !defined(DOXYGEN_RUNNING)
+		boost::optional<Object_and_primitive_id> 
+    #else
+    boost::optional< typename Intersection_and_primitive_id<Query>::Type >
+    #endif
+    any_intersection(const Query& query) const;
+
+
+
+    /// Returns the intersection and  primitive id closest to the source point of the ray
+    /// query.
+    /// \tparam Ray must be the same as `AABBTraits::Ray_3` and
+    /// `do_intersect` predicates and intersections for it must be
+    /// defined.
+    /// \tparam Skip a functor with an operator
+    /// `bool operator()(const Primitive_id& id) const`
+    /// that returns `true` in order to skip the primitive.
+    /// Defaults to a functor that always returns `false`.
+    ///
+    /// `AABBTraits` must be a model of `AABBRayIntersectionTraits` to
+    /// call this member function.
+    template<typename Ray, typename SkipFunctor>
+    boost::optional< typename Intersection_and_primitive_id<Ray>::Type >
+    first_intersection(const Ray& query, const SkipFunctor& skip) const;
+
+    template<typename Ray>
+    boost::optional< typename Intersection_and_primitive_id<Ray>::Type >
+    first_intersection(const Ray& query) const
+    {
+      return first_intersection(query, boost::lambda::constant(false));
+    }
+
+    /// Returns the primitive id closest to the source point of the ray
+    /// query.
+    /// \tparam Ray must be the same as `AABBTraits::Ray_3` and
+    /// `do_intersect` predicates and intersections for it must be
+    /// defined.
+    /// \tparam Skip a functor with an operator
+    /// `bool operator()(const Primitive_id& id) const`
+    /// that returns `true` in order to skip the primitive.
+    /// Defaults to a functor that always returns `false`.
+    ///
+    /// `AABBTraits` must be a model of `AABBRayIntersectionTraits` to
+    /// call this member function.
+    template<typename Ray, typename SkipFunctor>
+    boost::optional<Primitive_id>
+    first_intersected_primitive(const Ray& query, const SkipFunctor& skip) const;
+
+    template<typename Ray>
+    boost::optional<Primitive_id>
+    first_intersected_primitive(const Ray& query) const
+    {
+      return first_intersected_primitive(query, boost::lambda::constant(false));
+    }
+    ///@}
+
+    /// \name Distance Queries
+    ///@{
+
+    /// Returns the minimum squared distance between the query point
+    /// and all input primitives. Method
+    /// `accelerate_distance_queries()` should be called before the
+    /// first distance query, so that an internal secondary search
+    /// structure is build, for improving performance.
+		/// \pre `!empty()`
+		FT squared_distance(const Point& query) const;
+
+    /// Returns the point in the union of all input primitives which
+    /// is closest to the query. In case there are several closest
+    /// points, one arbitrarily chosen closest point is
+    /// returned. Method `accelerate_distance_queries()` should be
+    /// called before the first distance query, so that an internal
+    /// secondary search structure is build, for improving
+    /// performance.
+		/// \pre `!empty()`
+		Point closest_point(const Point& query) const;
+
+    
+    /// Returns a `Point_and_primitive_id` which realizes the
+    /// smallest distance between the query point and all input
+    /// primitives. Method `accelerate_distance_queries()` should be
+    /// called before the first distance query, so that an internal
+    /// secondary search structure is build, for improving
+    /// performance.
+		/// \pre `!empty()`
+		Point_and_primitive_id closest_point_and_primitive(const Point& query) const;
+
+
+    ///@}
+
+    /// \name Accelerating the Distance Queries
+    /// 
+    /// In the following paragraphs, we discuss details of the
+    /// implementation of the distance queries. We explain the
+    /// internal use of hints, how the user can pass his own hints to
+    /// the tree, and how the user can influence the construction of
+    /// the secondary data structure used for accelerating distance
+    /// queries.
+    /// Internally, the distance queries algorithms are initialized
+    /// with some hint, which has the same type as the return type of
+    /// the query, and this value is refined along a traversal of the
+    /// tree, until it is optimal, that is to say until it realizes
+    /// the shortest distance to the primitives. In particular, the
+    /// exact specification of these internal algorithms is that they
+    /// minimize the distance to the object composed of the union of
+    /// the primitives and the hint.
+    /// It follows that 
+    /// - in order to return the exact distance to the set of
+    /// primitives, the algorithms need the hint to be exactly on the
+    /// primitives;
+    /// - if this is not the case, and if the hint happens to be closer
+    /// to the query point than any of the primitives, then the hint
+    /// is returned.
+    ///
+    /// This second observation is reasonable, in the sense that
+    /// providing a hint to the algorithm means claiming that this
+    /// hint belongs to the union of the primitives. These
+    /// considerations about the hints being exactly on the primitives
+    /// or not are important: in the case where the set of primitives
+    /// is a triangle soup, and if some of the primitives are large,
+    /// one may want to provide a much better hint than a vertex of
+    /// the triangle soup could be. It could be, for example, the
+    /// barycenter of one of the triangles. But, except with the use
+    /// of an exact constructions kernel, one cannot easily construct
+    /// points other than the vertices, that lie exactly on a triangle
+    /// soup. Hence, providing a good hint sometimes means not being
+    /// able to provide it exactly on the primitives. In rare
+    /// occasions, this hint can be returned as the closest point.
+    /// In order to accelerate distance queries significantly, the
+    /// AABB tree builds an internal KD-tree containing a set of
+    /// potential hints, when the method
+    /// `accelerate_distance_queries()` is called. This KD-tree
+    /// provides very good hints that allow the algorithms to run much
+    /// faster than with a default hint (such as the
+    /// `reference_point` of the first primitive). The set of
+    /// potential hints is a sampling of the union of the primitives,
+    /// which is obtained, by default, by calling the method
+    /// `reference_point` of each of the primitives. However, such
+    /// a sampling with one point per primitive may not be the most
+    /// relevant one: if some primitives are very large, it helps
+    /// inserting more than one sample on them. Conversely, a sparser
+    /// sampling with less than one point per input primitive is
+    /// relevant in some cases.
+    ///@{
+
+		/// Constructs internal search tree from
+		/// a point set taken on the internal primitives
+		/// returns `true` iff successful memory allocation
+		bool accelerate_distance_queries() const;
+
+    /// Constructs an internal KD-tree containing the specified point
+    /// set, to be used as the set of potential hints for accelerating
+    /// the distance queries. 
+		/// \tparam ConstPointIterator is an iterator with
+    /// value type `Point_and_primitive_id`.
+		template<typename ConstPointIterator>
+		bool accelerate_distance_queries(ConstPointIterator first,
+                                     ConstPointIterator beyond) const
+    {
+      #ifdef CGAL_HAS_THREADS
+      //this ensures that this is done once at a time
+      CGAL_SCOPED_LOCK(kd_tree_mutex);
+      #endif
+      clear_search_tree();
+      return accelerate_distance_queries_impl(first,beyond);
+      
+    }
+    
+    /// Returns the minimum squared distance between the query point
+    /// and all input primitives. The internal KD-tree is not used.
+		/// \pre `!empty()`
+		FT squared_distance(const Point& query, const Point& hint) const;
+
+    /// Returns the point in the union of all input primitives which
+    /// is closest to the query. In case there are several closest
+    /// points, one arbitrarily chosen closest point is returned. The
+    /// internal KD-tree is not used.
+		/// \pre `!empty()`
+		Point closest_point(const Point& query, const Point& hint) const;
+    
+    /// Returns a `Point_and_primitive_id` which realizes the
+    /// smallest distance between the query point and all input
+    /// primitives. The internal KD-tree is not used.
+		/// \pre `!empty()`
+		Point_and_primitive_id closest_point_and_primitive(const Point& query, const Point_and_primitive_id& hint) const;
+
+    ///@}
+
+	private:
+    template<typename AABBTree, typename SkipFunctor>
+    friend class AABB_ray_intersection;
+
+    // clear nodes
+    void clear_nodes()
+    {
+			if( size() > 1 ) {
+				delete [] m_p_root_node;
+			}
+			m_p_root_node = NULL;
+    }
+
+		// clears internal KD tree
+		void clear_search_tree() const
+		{
+			if ( m_search_tree_constructed )
+			{
+				CGAL_assertion( m_p_search_tree!=NULL );
+				delete m_p_search_tree;
+				m_p_search_tree = NULL;
+				m_search_tree_constructed = false;
+				m_default_search_tree_constructed = false;
+                        }
+		}
+
+	public:
+
+    /// \internal
+		template <class Query, class Traversal_traits>
+		void traversal(const Query& query, Traversal_traits& traits) const
+		{
+			switch(size())
+			{
+			case 0:
+				break;
+			case 1:
+				traits.intersection(query, singleton_data());
+				break;
+			default: // if(size() >= 2)
+				root_node()->template traversal<Traversal_traits,Query>(query, traits, m_primitives.size());
+			}
+		}
+
+	private:
+		typedef AABB_node<AABBTraits> Node;
+
+
+	public:
+		// returns a point which must be on one primitive
+		Point_and_primitive_id any_reference_point_and_id() const
+		{
+			CGAL_assertion(!empty());
+			return Point_and_primitive_id(
+        internal::Primitive_helper<AABB_traits>::get_reference_point(m_primitives[0],m_traits), m_primitives[0].id()
+      );
+		}
+
+	public:
+		Point_and_primitive_id best_hint(const Point& query) const
+		{
+			if(m_search_tree_constructed)
+				return m_p_search_tree->closest_point(query);
+			else
+				return this->any_reference_point_and_id();
+		}
+
+	private:
+    //Traits class
+    AABBTraits m_traits;
+		// set of input primitives
+		Primitives m_primitives;
+		// single root node
+		Node* m_p_root_node;
+    #ifdef CGAL_HAS_THREADS
+    mutable CGAL_MUTEX internal_tree_mutex;//mutex used to protect const calls inducing build()
+    mutable CGAL_MUTEX kd_tree_mutex;//mutex used to protect calls to accelerate_distance_queries
+    #endif
+  
+    const Node* root_node() const {
+			CGAL_assertion(size() > 1);
+      if(m_need_build){
+        #ifdef CGAL_HAS_THREADS
+        //this ensures that build() will be called once
+        CGAL_SCOPED_LOCK(internal_tree_mutex);
+        if(m_need_build)
+        #endif
+          const_cast< AABB_tree<AABBTraits>* >(this)->build(); 
+      }
+      return m_p_root_node;
+    }
+
+		const Primitive& singleton_data() const {
+			CGAL_assertion(size() == 1);
+			return *m_primitives.begin();
+		}
+
+		// search KD-tree
+		mutable const Search_tree* m_p_search_tree;
+		mutable bool m_search_tree_constructed;
+    mutable bool m_default_search_tree_constructed;
+    bool m_need_build;
+
+	private:
+		// Disabled copy constructor & assignment operator
+		typedef AABB_tree<AABBTraits> Self;
+		AABB_tree(const Self& src);
+		Self& operator=(const Self& src);
+
+	};  // end class AABB_tree
+
+/// @}
+
+  template<typename Tr>
+  AABB_tree<Tr>::AABB_tree(const Tr& traits)
+    : m_traits(traits)
+    , m_primitives()
+    , m_p_root_node(NULL)
+    , m_p_search_tree(NULL)
+    , m_search_tree_constructed(false)
+    , m_default_search_tree_constructed(false)
+    , m_need_build(false)
+  {}
+
+  #if !defined(CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES) && !defined(CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE) 
+ 	template<typename Tr>
+	template<typename ConstPrimitiveIterator, typename ... T>
+	AABB_tree<Tr>::AABB_tree(ConstPrimitiveIterator first,
+                           ConstPrimitiveIterator beyond,
+                           T&& ... t)
+		: m_traits()
+    , m_primitives()
+		, m_p_root_node(NULL)
+		, m_p_search_tree(NULL)
+		, m_search_tree_constructed(false)
+    , m_default_search_tree_constructed(false)
+    , m_need_build(false)
+	{
+		// Insert each primitive into tree
+    insert(first, beyond,std::forward<T>(t)...);
+ 	}
+  
+	template<typename Tr>
+	template<typename ConstPrimitiveIterator, typename ... T>
+	void AABB_tree<Tr>::insert(ConstPrimitiveIterator first,
+                             ConstPrimitiveIterator beyond,
+                             T&& ... t)
+	{
+    set_shared_data(std::forward<T>(t)...);
+		while(first != beyond)
+		{
+			m_primitives.push_back(Primitive(first,std::forward<T>(t)...));
+			++first;
+		}
+    m_need_build = true;
+  }
+  
+  // Clears tree and insert a set of primitives
+	template<typename Tr>
+	template<typename ConstPrimitiveIterator, typename ... T>
+	void AABB_tree<Tr>::rebuild(ConstPrimitiveIterator first,
+                              ConstPrimitiveIterator beyond,
+                              T&& ... t)
+	{
+		// cleanup current tree and internal KD tree
+		clear();
+
+		// inserts primitives
+    insert(first, beyond,std::forward<T>(t)...);
+
+    build();
+	}  
+  #else
+  //=============constructor======================
+	template<typename Tr>
+	template<typename ConstPrimitiveIterator>
+	AABB_tree<Tr>::AABB_tree(ConstPrimitiveIterator first,
+                           ConstPrimitiveIterator beyond)
+		: m_traits()
+    , m_primitives()
+		, m_p_root_node(NULL)
+		, m_p_search_tree(NULL)
+		, m_search_tree_constructed(false)
+    , m_default_search_tree_constructed(false)
+    , m_need_build(false)
+	{
+		// Insert each primitive into tree
+    insert(first, beyond);
+ 	}
+
+	template<typename Tr>
+	template<typename ConstPrimitiveIterator, typename T1>
+	AABB_tree<Tr>::AABB_tree(ConstPrimitiveIterator first,
+                           ConstPrimitiveIterator beyond,
+                           T1& t1)
+		: m_traits()
+    , m_primitives()
+		, m_p_root_node(NULL)
+		, m_p_search_tree(NULL)
+		, m_search_tree_constructed(false)
+    , m_default_search_tree_constructed(false)
+    , m_need_build(false)
+	{
+		// Insert each primitive into tree
+    insert(first, beyond,t1);
+ 	}
+
+	template<typename Tr>
+	template<typename ConstPrimitiveIterator, typename T1, typename T2>
+	AABB_tree<Tr>::AABB_tree(ConstPrimitiveIterator first,
+                           ConstPrimitiveIterator beyond,
+                           T1& t1,T2& t2)
+		: m_traits()
+    , m_primitives()
+		, m_p_root_node(NULL)
+		, m_p_search_tree(NULL)
+		, m_search_tree_constructed(false)
+    , m_default_search_tree_constructed(false)
+    , m_need_build(false)
+	{
+		// Insert each primitive into tree
+    insert(first, beyond,t1,t2);
+ 	}
+
+	template<typename Tr>
+	template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3>
+	AABB_tree<Tr>::AABB_tree(ConstPrimitiveIterator first,
+                           ConstPrimitiveIterator beyond,
+                           T1& t1,T2& t2,T3& t3)
+		: m_traits()
+    , m_primitives()
+		, m_p_root_node(NULL)
+		, m_p_search_tree(NULL)
+		, m_search_tree_constructed(false)
+    , m_default_search_tree_constructed(false)
+    , m_need_build(false)
+	{
+		// Insert each primitive into tree
+    insert(first, beyond,t1,t2,t3);
+ 	}
+
+	template<typename Tr>
+	template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3, typename T4>
+	AABB_tree<Tr>::AABB_tree(ConstPrimitiveIterator first,
+                           ConstPrimitiveIterator beyond,
+                           T1& t1,T2& t2,T3& t3,T4& t4)
+		: m_traits()
+    , m_primitives()
+		, m_p_root_node(NULL)
+		, m_p_search_tree(NULL)
+		, m_search_tree_constructed(false)
+    , m_default_search_tree_constructed(false)
+    , m_need_build(false)
+	{
+		// Insert each primitive into tree
+    insert(first, beyond,t1,t2,t3,t4);
+ 	}
+
+  template<typename Tr>
+	template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3, typename T4, typename T5>
+	AABB_tree<Tr>::AABB_tree(ConstPrimitiveIterator first,
+                           ConstPrimitiveIterator beyond,
+                           T1& t1,T2& t2,T3& t3,T4& t4,T5& t5)
+		: m_traits()
+    , m_primitives()
+		, m_p_root_node(NULL)
+		, m_p_search_tree(NULL)
+		, m_search_tree_constructed(false)
+    , m_default_search_tree_constructed(false)
+    , m_need_build(false)
+	{
+		// Insert each primitive into tree
+    insert(first, beyond,t1,t2,t3,t4,t5);
+ 	}
+  //=============insert======================
+	template<typename Tr>
+	template<typename ConstPrimitiveIterator>
+	void AABB_tree<Tr>::insert(ConstPrimitiveIterator first,
+                             ConstPrimitiveIterator beyond)
+	{
+    set_shared_data();
+		while(first != beyond)
+		{
+			m_primitives.push_back(Primitive(first));
+			++first;
+		}
+    m_need_build = true;
+  }
+
+	template<typename Tr>
+	template<typename ConstPrimitiveIterator, typename T1>
+	void AABB_tree<Tr>::insert(ConstPrimitiveIterator first,
+                             ConstPrimitiveIterator beyond,
+                             T1& t1)
+	{
+    set_shared_data(t1);
+		while(first != beyond)
+		{
+			m_primitives.push_back(Primitive(first,t1));
+			++first;
+		}
+    m_need_build = true;
+  }
+  
+	template<typename Tr>
+	template<typename ConstPrimitiveIterator, typename T1, typename T2>
+	void AABB_tree<Tr>::insert(ConstPrimitiveIterator first,
+                             ConstPrimitiveIterator beyond,
+                             T1& t1, T2& t2)
+	{
+    set_shared_data(t1,t2);
+		while(first != beyond)
+		{
+			m_primitives.push_back(Primitive(first,t1,t2));
+			++first;
+		}
+    m_need_build = true;
+  }
+
+  template<typename Tr>
+	template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3>
+	void AABB_tree<Tr>::insert(ConstPrimitiveIterator first,
+                             ConstPrimitiveIterator beyond,
+                             T1& t1,T2& t2,T3& t3)
+	{
+    set_shared_data(t1,t2,t3);
+		while(first != beyond)
+		{
+			m_primitives.push_back(Primitive(first,t1,t2,t3));
+			++first;
+		}
+    m_need_build = true;
+  }
+
+  template<typename Tr>
+	template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3, typename T4>
+	void AABB_tree<Tr>::insert(ConstPrimitiveIterator first,
+                             ConstPrimitiveIterator beyond,
+                             T1& t1,T2& t2,T3& t3,T4& t4)
+	{
+    set_shared_data(t1,t2,t3,t4);
+		while(first != beyond)
+		{
+			m_primitives.push_back(Primitive(first,t1,t2,t3,t4));
+			++first;
+		}
+    m_need_build = true;
+  }
+
+  template<typename Tr>
+	template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3, typename T4, typename T5>
+	void AABB_tree<Tr>::insert(ConstPrimitiveIterator first,
+                             ConstPrimitiveIterator beyond,
+                             T1& t1,T2& t2,T3& t3,T4& t4,T5& t5)
+	{
+    set_shared_data(t1,t2,t3,t4,t5);
+		while(first != beyond)
+		{
+			m_primitives.push_back(Primitive(first,t1,t2,t3,t4,t5));
+			++first;
+		}
+    m_need_build = true;
+  }
+
+  //=============rebuild======================
+	template<typename Tr>
+	template<typename ConstPrimitiveIterator>
+	void AABB_tree<Tr>::rebuild(ConstPrimitiveIterator first,
+                              ConstPrimitiveIterator beyond)
+	{
+		// cleanup current tree and internal KD tree
+		clear();
+
+		// inserts primitives
+    insert(first, beyond);
+
+    build();
+	}
+
+	template<typename Tr>
+	template<typename ConstPrimitiveIterator, typename T1>
+	void AABB_tree<Tr>::rebuild(ConstPrimitiveIterator first,
+                              ConstPrimitiveIterator beyond,
+                              T1& t1)
+	{
+		// cleanup current tree and internal KD tree
+		clear();
+
+		// inserts primitives
+    insert(first, beyond,t1);
+
+    build();
+	}
+  
+	template<typename Tr>
+	template<typename ConstPrimitiveIterator, typename T1, typename T2>
+	void AABB_tree<Tr>::rebuild(ConstPrimitiveIterator first,
+                              ConstPrimitiveIterator beyond,
+                              T1& t1, T2& t2)
+	{
+		// cleanup current tree and internal KD tree
+		clear();
+
+		// inserts primitives
+    insert(first, beyond,t1,t2);
+
+    build();
+	}
+
+  template<typename Tr>
+	template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3>
+	void AABB_tree<Tr>::rebuild(ConstPrimitiveIterator first,
+                              ConstPrimitiveIterator beyond,
+                              T1& t1,T2& t2,T3& t3)
+	{
+		// cleanup current tree and internal KD tree
+		clear();
+
+		// inserts primitives
+    insert(first, beyond,t1,t2,t3);
+
+    build();
+	}
+
+  template<typename Tr>
+	template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3, typename T4>
+	void AABB_tree<Tr>::rebuild(ConstPrimitiveIterator first,
+                              ConstPrimitiveIterator beyond,
+                              T1& t1,T2& t2,T3& t3,T4& t4)
+	{
+		// cleanup current tree and internal KD tree
+		clear();
+
+		// inserts primitives
+    insert(first, beyond,t1,t2,t3,t4);
+
+    build();
+	}
+
+  template<typename Tr>
+	template<typename ConstPrimitiveIterator, typename T1, typename T2, typename T3, typename T4, typename T5>
+	void AABB_tree<Tr>::rebuild(ConstPrimitiveIterator first,
+                              ConstPrimitiveIterator beyond,
+                              T1& t1,T2& t2,T3& t3,T4& t4,T5& t5)
+	{
+		// cleanup current tree and internal KD tree
+		clear();
+
+		// inserts primitives
+    insert(first, beyond,t1,t2,t3,t4,t5);
+
+    build();
+	}
+  #endif
+
+	template<typename Tr>
+	void AABB_tree<Tr>::insert(const Primitive& p)
+	{
+    m_primitives.push_back(p);
+    m_need_build = true;
+  }
+
+	// Build the data structure, after calls to insert(..)
+	template<typename Tr>
+	void AABB_tree<Tr>::build()
+	{
+    clear_nodes();
+
+    if(m_primitives.size() > 1) {
+
+			// allocates tree nodes
+			m_p_root_node = new Node[m_primitives.size()-1]();
+			if(m_p_root_node == NULL)
+			{
+				std::cerr << "Unable to allocate memory for AABB tree" << std::endl;
+				CGAL_assertion(m_p_root_node != NULL);
+				m_primitives.clear();
+				clear();
+			}
+
+			// constructs the tree
+			m_p_root_node->expand(m_primitives.begin(), m_primitives.end(),
+														m_primitives.size(), m_traits);
+		}
+
+    // In case the users has switched on the accelerated distance query
+    // data structure with the default arguments, then it has to be
+    // rebuilt.
+    if(m_default_search_tree_constructed)
+      accelerate_distance_queries();
+
+    m_need_build = false;    
+	}
+
+
+	// constructs the search KD tree from given points
+	// to accelerate the distance queries
+	template<typename Tr>
+	template<typename ConstPointIterator>
+	bool AABB_tree<Tr>::accelerate_distance_queries_impl(ConstPointIterator first,
+		ConstPointIterator beyond) const
+	{
+		m_p_search_tree = new Search_tree(first, beyond);
+		if(m_p_search_tree != NULL)
+		{
+			m_search_tree_constructed = true;
+			return true;
+		}
+		else
+    {
+			std::cerr << "Unable to allocate memory for accelerating distance queries" << std::endl;
+			return false;
+    }
+	}
+
+	// constructs the search KD tree from internal primitives
+	template<typename Tr>
+	bool AABB_tree<Tr>::accelerate_distance_queries() const
+	{
+		if(m_primitives.empty()) return true;
+    #ifdef CGAL_HAS_THREADS
+    //this ensures that this function will be done once
+    CGAL_SCOPED_LOCK(kd_tree_mutex);
+    #endif
+
+    //we only redo computation only if needed 
+    if (!m_need_build && m_default_search_tree_constructed)
+      return m_search_tree_constructed;
+    
+		// iterate over primitives to get reference points on them
+		std::vector<Point_and_primitive_id> points;
+		points.reserve(m_primitives.size());
+		typename Primitives::const_iterator it;
+		for(it = m_primitives.begin(); it != m_primitives.end(); ++it)
+			points.push_back(
+        Point_and_primitive_id(
+          internal::Primitive_helper<AABB_traits>::get_reference_point(*it,m_traits), it->id()
+        )
+      );
+
+    // clears current KD tree
+    clear_search_tree();
+    m_default_search_tree_constructed = true;
+		return accelerate_distance_queries_impl(points.begin(), points.end());
+	}
+
+	template<typename Tr>
+	template<typename Query>
+	bool
+		AABB_tree<Tr>::do_intersect(const Query& query) const
+	{
+    using namespace CGAL::internal::AABB_tree;
+    typedef typename AABB_tree<Tr>::AABB_traits AABBTraits;
+		Do_intersect_traits<AABBTraits, Query> traversal_traits(m_traits);
+		this->traversal(query, traversal_traits);
+		return traversal_traits.is_intersection_found();
+	}
+
+	template<typename Tr>
+	template<typename Query>
+	typename AABB_tree<Tr>::size_type
+		AABB_tree<Tr>::number_of_intersected_primitives(const Query& query) const
+	{
+    using namespace CGAL::internal::AABB_tree;
+    using CGAL::internal::AABB_tree::Counting_output_iterator;
+    typedef typename AABB_tree<Tr>::AABB_traits AABBTraits;
+    typedef Counting_output_iterator<Primitive_id, size_type> Counting_iterator;
+
+    size_type counter = 0;
+    Counting_iterator out(&counter);
+
+		Listing_primitive_traits<AABBTraits, 
+      Query, Counting_iterator> traversal_traits(out,m_traits);
+		this->traversal(query, traversal_traits);
+		return counter;
+	}
+
+	template<typename Tr>
+	template<typename Query, typename OutputIterator>
+	OutputIterator
+		AABB_tree<Tr>::all_intersected_primitives(const Query& query,
+		OutputIterator out) const
+	{
+    using namespace CGAL::internal::AABB_tree;
+    typedef typename AABB_tree<Tr>::AABB_traits AABBTraits;
+		Listing_primitive_traits<AABBTraits, 
+      Query, OutputIterator> traversal_traits(out,m_traits);
+		this->traversal(query, traversal_traits);
+		return out;
+	}
+
+	template<typename Tr>
+	template<typename Query, typename OutputIterator>
+	OutputIterator
+		AABB_tree<Tr>::all_intersections(const Query& query,
+		OutputIterator out) const
+	{
+    using namespace CGAL::internal::AABB_tree;
+    typedef typename AABB_tree<Tr>::AABB_traits AABBTraits;
+		Listing_intersection_traits<AABBTraits, 
+      Query, OutputIterator> traversal_traits(out,m_traits);
+		this->traversal(query, traversal_traits);
+		return out;
+	}
+
+
+	template <typename Tr>
+	template <typename Query>
+  #if CGAL_INTERSECTION_VERSION < 2
+	boost::optional<typename AABB_tree<Tr>::Object_and_primitive_id>
+  #else
+  boost::optional< typename AABB_tree<Tr>::template Intersection_and_primitive_id<Query>::Type >
+  #endif
+		AABB_tree<Tr>::any_intersection(const Query& query) const
+	{
+    using namespace CGAL::internal::AABB_tree;
+    typedef typename AABB_tree<Tr>::AABB_traits AABBTraits;
+		First_intersection_traits<AABBTraits, Query> traversal_traits(m_traits);
+		this->traversal(query, traversal_traits);
+		return traversal_traits.result();
+	}
+
+	template <typename Tr>
+	template <typename Query>
+	boost::optional<typename AABB_tree<Tr>::Primitive_id>
+		AABB_tree<Tr>::any_intersected_primitive(const Query& query) const
+	{
+    using namespace CGAL::internal::AABB_tree;
+    typedef typename AABB_tree<Tr>::AABB_traits AABBTraits;
+		First_primitive_traits<AABBTraits, Query> traversal_traits(m_traits);
+		this->traversal(query, traversal_traits);
+		return traversal_traits.result();
+	}
+
+	// closest point with user-specified hint
+	template<typename Tr>
+	typename AABB_tree<Tr>::Point
+		AABB_tree<Tr>::closest_point(const Point& query,
+		const Point& hint) const
+	{
+		CGAL_precondition(!empty());
+		typename Primitive::Id hint_primitive = m_primitives[0].id();
+    using namespace CGAL::internal::AABB_tree;
+    typedef typename AABB_tree<Tr>::AABB_traits AABBTraits;
+		Projection_traits<AABBTraits> projection_traits(hint,hint_primitive,m_traits);
+		this->traversal(query, projection_traits);
+		return projection_traits.closest_point();
+	}
+
+	// closest point without hint, the search KD-tree is queried for the
+	// first closest neighbor point to get a hint
+	template<typename Tr>
+	typename AABB_tree<Tr>::Point
+		AABB_tree<Tr>::closest_point(const Point& query) const
+	{
+		CGAL_precondition(!empty());
+		const Point_and_primitive_id hint = best_hint(query);
+		return closest_point(query,hint.first);
+	}
+
+	// squared distance with user-specified hint
+	template<typename Tr>
+	typename AABB_tree<Tr>::FT
+		AABB_tree<Tr>::squared_distance(const Point& query,
+		const Point& hint) const
+	{
+		CGAL_precondition(!empty());
+		const Point closest = this->closest_point(query, hint);
+		return Tr().squared_distance_object()(query, closest);
+	}
+
+	// squared distance without user-specified hint
+	template<typename Tr>
+	typename AABB_tree<Tr>::FT
+		AABB_tree<Tr>::squared_distance(const Point& query) const
+	{
+		CGAL_precondition(!empty());
+		const Point closest = this->closest_point(query);
+		return Tr().squared_distance_object()(query, closest);
+	}
+
+	// closest point with user-specified hint
+	template<typename Tr>
+	typename AABB_tree<Tr>::Point_and_primitive_id
+		AABB_tree<Tr>::closest_point_and_primitive(const Point& query) const
+	{
+		CGAL_precondition(!empty());
+		return closest_point_and_primitive(query,best_hint(query));
+	}
+
+	// closest point with user-specified hint
+	template<typename Tr>
+	typename AABB_tree<Tr>::Point_and_primitive_id
+		AABB_tree<Tr>::closest_point_and_primitive(const Point& query,
+		const Point_and_primitive_id& hint) const
+	{
+		CGAL_precondition(!empty());
+    using namespace CGAL::internal::AABB_tree;
+    typedef typename AABB_tree<Tr>::AABB_traits AABBTraits;
+		Projection_traits<AABBTraits> projection_traits(hint.first,hint.second,m_traits);
+		this->traversal(query, projection_traits);
+		return projection_traits.closest_point_and_primitive();
+	}
+
+} // end namespace CGAL
+
+#include <CGAL/internal/AABB_tree/AABB_ray_intersection.h>
+
+
+#endif // CGAL_AABB_TREE_H
+
+/***EMACS SETTINGS**    */
+/* Local Variables:     */
+/* tab-width: 2         */
+/* indent-tabs-mode: t  */
+/* End:                 */
diff --git a/3rdparty/CGAL-4.8/include/CGAL/AABB_triangle_primitive.h b/3rdparty/CGAL/include/CGAL/AABB_triangle_primitive.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/AABB_triangle_primitive.h
rename to 3rdparty/CGAL/include/CGAL/AABB_triangle_primitive.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Advancing_front_surface_reconstruction.h b/3rdparty/CGAL/include/CGAL/Advancing_front_surface_reconstruction.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Advancing_front_surface_reconstruction.h
rename to 3rdparty/CGAL/include/CGAL/Advancing_front_surface_reconstruction.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Advancing_front_surface_reconstruction_cell_base_3.h b/3rdparty/CGAL/include/CGAL/Advancing_front_surface_reconstruction_cell_base_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Advancing_front_surface_reconstruction_cell_base_3.h
rename to 3rdparty/CGAL/include/CGAL/Advancing_front_surface_reconstruction_cell_base_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Advancing_front_surface_reconstruction_vertex_base_3.h b/3rdparty/CGAL/include/CGAL/Advancing_front_surface_reconstruction_vertex_base_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Advancing_front_surface_reconstruction_vertex_base_3.h
rename to 3rdparty/CGAL/include/CGAL/Advancing_front_surface_reconstruction_vertex_base_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Aff_transformation_2.h b/3rdparty/CGAL/include/CGAL/Aff_transformation_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Aff_transformation_2.h
rename to 3rdparty/CGAL/include/CGAL/Aff_transformation_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Aff_transformation_3.h b/3rdparty/CGAL/include/CGAL/Aff_transformation_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Aff_transformation_3.h
rename to 3rdparty/CGAL/include/CGAL/Aff_transformation_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_extension_traits.h b/3rdparty/CGAL/include/CGAL/Algebraic_extension_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_extension_traits.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_extension_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_converter.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_converter.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_converter.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_converter.h
diff --git a/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h
new file mode 100644
index 0000000..2873fb0
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h
@@ -0,0 +1,2762 @@
+// Copyright (c) 2006-2009 Max-Planck-Institute Saarbruecken (Germany).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Eric Berberich <eric at mpi-inf.mpg.de>
+//                 Pavel Emeliyanenko <asm at mpi-sb.mpg.de>
+//                 Michael Kerber <mkerber at mpi-inf.mpg.de>
+//
+// ============================================================================
+
+/*! \file Algebraic_curve_kernel_2.h
+ *  \brief defines class \c Algebraic_curve_kernel_2
+ *
+ * A model for CGAL's AlgebraicKernelWithAnalysis_d_2 concept
+ */
+
+#ifndef CGAL_ALGEBRAIC_CURVE_KERNEL_D_2_H
+#define CGAL_ALGEBRAIC_CURVE_KERNEL_D_2_H
+
+#include <limits>
+
+#include <CGAL/assertions.h>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/optional.hpp>
+
+#include <CGAL/basic.h>
+#include <CGAL/config.h>
+#include <CGAL/array.h>
+#include <CGAL/Handle_with_policy.h>
+#include <CGAL/Algebraic_kernel_d/flags.h>
+#include <CGAL/Polynomial_traits_d.h>
+
+#include <CGAL/Algebraic_kernel_d/LRU_hashed_map.h>
+#include <CGAL/Algebraic_kernel_d/Xy_coordinate_2.h>
+#include <CGAL/Algebraic_kernel_d/Interval_evaluate_1.h>
+#include <CGAL/Algebraic_kernel_d/Interval_evaluate_2.h>
+
+#include <CGAL/Polynomial_type_generator.h>
+#include <CGAL/polynomial_utils.h>
+
+#include <CGAL/Algebraic_kernel_d/Curve_analysis_2.h>
+#include <CGAL/Algebraic_kernel_d/Curve_pair_analysis_2.h>
+
+#include <boost/shared_ptr.hpp>
+
+
+namespace CGAL {
+
+
+/*!
+ * \b Algebraic_curve_kernel_2 is a model of CGAL's concept \c
+ * AlgebraicKernelWithAnalysis_d_2 which itself refines \c AlgebraicKernel_d_2.
+ * As such, it contains functionality
+ * for solving and manipulating (systems of) bivariate polynomials,
+ * of arbitrary degree,
+ * as required by the \c AlgebraicKernel_d_2 concept. 
+ * Additionally, it contains functionality for the topological-geometric
+ * analysis of a single algebraic curve 
+ * (given as the vanishing set of the polynomial), 
+ * and of a pair of curves (given as a pair of polynomials), as required by the
+ * \c AlgebraicKernelWithAnalysis_d_2 concept. These two analyses are
+ * available via the types \c Curve_analysis_2 and Curve_pair_analysis_2.
+ *
+ * The given class is also a model of the \c CurveKernel_2 concept that is
+ * in turn required by the \c CurvedKernelViaAnalysis_2 concept
+ * (see the documentation of the corresponding package). Therefore,
+ * some types and methods of the class have both an "algebraic" name
+ * (demanded by \c CurveKernelWithAnalysis_d_2) and an "non-algebraic name
+ * (demanded by \c CurveKernel_2).
+ *
+ * \b Algebraic_curve_kernel_2 is a template class, and needs a model
+ * of the \c AlgebraicKernel_d_1 concept as parameter.
+ *
+ * Internally, the curve- and curve-pair analysis 
+ * are the computational fundament of the kernel. That means, whenever
+ * a polynomial is considered within the kernel, the curve analysis
+ * of the corresponding algebraic curve is performed.
+ * The same holds for the curve pair analysis,
+ * when a kernel function deals with two polynomials,
+ * implicitly or explicitly (e.g. \c Solve_2, \c Sign_at_2).
+ */
+template < class AlgebraicKernel_d_1 >
+class Algebraic_curve_kernel_2 : public AlgebraicKernel_d_1{
+
+// for each predicate functor defines a member function returning an instance
+// of this predicate
+#define CGAL_Algebraic_Kernel_pred(Y,Z) \
+    Y Z() const { return Y((const Algebraic_kernel_d_2*)this); }
+
+// the same for construction functors
+#define CGAL_Algebraic_Kernel_cons(Y,Z) CGAL_Algebraic_Kernel_pred(Y,Z)
+
+protected:    
+    // temporary types
+    
+public:
+    //!\name public typedefs
+    //!@{
+
+    //! type of 1D algebraic kernel
+    typedef AlgebraicKernel_d_1 Algebraic_kernel_d_1;
+    
+    //! type of x-coordinate
+    typedef typename Algebraic_kernel_d_1::Algebraic_real_1 Algebraic_real_1;
+
+    //! type of polynomial coefficient
+    typedef typename Algebraic_kernel_d_1::Coefficient Coefficient;
+
+    // myself
+    typedef Algebraic_curve_kernel_2<AlgebraicKernel_d_1> Self;
+
+    typedef Self Algebraic_kernel_d_2;
+    
+    // Bound type
+    typedef typename Algebraic_kernel_d_1::Bound Bound;
+
+    typedef typename Algebraic_kernel_d_1::size_type size_type;
+    typedef typename Algebraic_kernel_d_1::Multiplicity_type Multiplicity_type;
+        
+    typedef typename CGAL::Get_arithmetic_kernel<Bound>::Arithmetic_kernel
+      Arithmetic_kernel;
+    
+    typedef typename Arithmetic_kernel::Bigfloat Bigfloat;
+    typedef typename Arithmetic_kernel::Bigfloat_interval Bigfloat_interval;
+    
+    //! Univariate polynomial type 
+    typedef typename Algebraic_kernel_d_1::Polynomial_1 Polynomial_1;
+    
+    //! Bivariate polynomial type
+    typedef typename CGAL::Polynomial_traits_d<Polynomial_1>
+    :: template Rebind<Coefficient,2>::Other::Type Polynomial_2;
+    
+    //! bivariate polynomial traits
+    typedef ::CGAL::Polynomial_traits_d< Polynomial_2 >
+        Polynomial_traits_2;
+
+    /*!
+     * \brief  type of a curve point, a model for the 
+     * \c AlgebraicKernel_d_2::AlgebraicReal_2 concept
+     */
+    typedef internal::Xy_coordinate_2<Self> Algebraic_real_2;
+
+    /*! 
+     * type of the curve analysis, a model for the
+     * \c AlgebraicKernelWithAnalysis_d_2::CurveAnalysis_2 concept
+     */
+    typedef CGAL::Curve_analysis_2<Self> Curve_analysis_2; 
+
+    /*! 
+     * type of the curve pair analysis, a model for the
+     * \c AlgebraicKernelWithAnalysis_d_2::CurvePairAnalysis_2 concept
+     */
+    typedef CGAL::Curve_pair_analysis_2<Self> Curve_pair_analysis_2;
+
+    //! traits class used for approximations of y-coordinates
+
+
+    //  berfriending representations to make protected typedefs available
+    friend class internal::Curve_analysis_2_rep<Self>;
+    friend class internal::Curve_pair_analysis_2_rep<Self>;
+    
+    //!@}
+    //! \name rebind operator
+    //!@{
+
+    template <class NewAlgebraicKernel> 
+    struct rebind { 
+        typedef Algebraic_curve_kernel_2<NewAlgebraicKernel> Other;        
+    };
+
+    //!@}
+protected:
+    //! \name private functors
+    //!@{
+ 
+#if 0
+   
+    //! polynomial canonicalizer, needed for the cache
+    template <class Poly> 
+    struct Poly_canonicalizer : public std::unary_function< Poly, Poly >
+    {
+    // use Polynomial_traits_d<>::Canonicalize ?
+        Poly operator()(Poly p) 
+        {
+            typedef CGAL::Scalar_factor_traits<Poly> Sf_traits;
+            typedef typename Sf_traits::Scalar Scalar;
+            typename Sf_traits::Scalar_factor scalar_factor;
+            typename Sf_traits::Scalar_div scalar_div;
+            Scalar g = scalar_factor(p);
+            if (g == Scalar(0)) {
+                     CGAL_assertion(p == Poly(Scalar(0)));
+                     return p;
+            }
+            CGAL_assertion(g != Scalar(0));
+            if(g != Scalar(1)) 
+                scalar_div(p,g);
+            if(CGAL::leading_coefficient(CGAL::leading_coefficient(p))) < 0) 
+                scalar_div(p,Scalar(-1));
+            return p;        
+        }
+           
+    };
+#endif
+
+    // NOT a curve pair in our notation, simply a std::pair of Curve_analysis_2
+    typedef std::pair<Curve_analysis_2, Curve_analysis_2> Pair_of_curves_2;
+    
+    //! orders pair items by ids
+    struct Pair_id_order {
+
+        template<class T1, class T2>
+        std::pair<T1, T2> operator()(const std::pair<T1, T2>& p) const {
+            
+            if(p.first.id() > p.second.id())
+                return std::make_pair(p.second, p.first);
+            return p;
+        }
+    };
+    
+    class Curve_creator {
+
+    public:
+
+        Curve_creator(Algebraic_kernel_d_2* kernel) : _m_kernel(kernel) {}
+        Curve_analysis_2 operator()(const Polynomial_2& f) const {
+          return Curve_analysis_2(_m_kernel,f);
+        }
+
+    protected:
+        
+        Algebraic_kernel_d_2* _m_kernel;
+        
+    };
+
+    template <class Result>
+    class Pair_creator {
+
+    public:
+
+        Pair_creator(Algebraic_kernel_d_2* kernel) : _m_kernel(kernel) {}
+
+        template<class T1, class T2>
+        Result operator()(const std::pair<T1, T2>& p) const {
+            return Result(_m_kernel, p.first, p.second);
+        }
+
+    protected:
+        
+        Algebraic_kernel_d_2* _m_kernel;
+        
+    };
+    
+    struct Pair_id_equal_to {
+
+        template <class T1, class T2>
+        bool operator()(const std::pair<T1, T2>& p1,
+                const std::pair<T1, T2>& p2) const {
+            return (p1.first.id() == p2.first.id() &&
+                 p1.second.id() == p2.second.id());
+        }
+    };
+
+    //! type of curve analysis cache
+    typedef internal::LRU_hashed_map_with_kernel<Self,Polynomial_2,
+        Curve_analysis_2, internal::Poly_hasher,
+        std::equal_to<Polynomial_2>,
+        typename Polynomial_traits_2::Canonicalize,
+        Curve_creator > Curve_cache_2;
+
+    //! type of curve pair analysis cache 
+    typedef internal::LRU_hashed_map_with_kernel<Self,Pair_of_curves_2,
+        Curve_pair_analysis_2, internal::Pair_hasher, Pair_id_equal_to,
+        Pair_id_order,
+        Pair_creator<Curve_pair_analysis_2> > Curve_pair_cache_2;
+    
+    typedef std::pair<Polynomial_2, Polynomial_2>
+        Pair_of_polynomial_2;
+
+    template<typename T> struct Gcd {
+    
+        T operator() (std::pair<T,T> pair) {
+            return typename CGAL::Polynomial_traits_d<Polynomial_2>
+                ::Gcd_up_to_constant_factor()(pair.first,pair.second);
+        }
+    } ;     
+
+
+    template<typename T> struct Pair_cannonicalize {
+    
+        std::pair<T,T> operator() (std::pair<T,T> pair) {
+        
+            if(pair.first > pair.second) 
+                return std::make_pair(pair.second,pair.first);
+            return pair;
+        }
+    };
+
+    typedef CGAL::Pair_lexicographical_less_than
+    <Polynomial_2, Polynomial_2,
+            std::less<Polynomial_2>,
+            std::less<Polynomial_2> > Polynomial_2_compare;
+    
+    //! Cache for gcd computations
+    typedef CGAL::Cache<Pair_of_polynomial_2,
+                        Polynomial_2,
+                        Gcd<Polynomial_2>,
+                        Pair_cannonicalize<Polynomial_2>,
+                        Polynomial_2_compare> Gcd_cache_2;
+
+    //!@}
+
+public:
+    //!\name cache access functions
+    //!@{
+                        
+    //! access to the gcd_cache
+    Gcd_cache_2& gcd_cache_2() const {
+        return *_m_gcd_cache_2;
+    }
+
+    //! access to the curve cache
+    Curve_cache_2& curve_cache_2() const 
+    {
+        return *_m_curve_cache_2;
+    }
+    
+    //! access to the curve pair cache
+    Curve_pair_cache_2& curve_pair_cache_2() const 
+    {
+        return *_m_curve_pair_cache_2;
+    }
+
+    // Composition of two unary functors
+    template<typename InnerFunctor,typename OuterFunctor>
+      class Unary_compose 
+      : public std::unary_function<typename InnerFunctor::argument_type,
+                                   typename OuterFunctor::result_type> {
+				     
+    public:
+	     
+       Unary_compose(const InnerFunctor& inner,
+		     const OuterFunctor& outer) 
+	 : _inner(inner), _outer(outer) {}
+	 
+       Unary_compose(const Unary_compose& other)
+	 : _inner(other._inner), _outer(other._outer) {}
+
+	 Unary_compose() : _inner(::boost::none),_outer(::boost::none) {}
+
+       typedef typename InnerFunctor::argument_type argument_type;
+       typedef typename OuterFunctor::result_type result_type;
+			     
+
+       result_type operator() (const argument_type& arg) const {
+	 CGAL_assertion(bool(_inner));
+	 CGAL_assertion(bool(_outer));
+	 return _outer.get()(_inner.get()(arg));
+       }
+    private:
+       ::boost::optional<InnerFunctor> _inner;
+       ::boost::optional<OuterFunctor> _outer;
+    };
+
+    template<typename InnerFunctor,typename OuterFunctor>
+      Unary_compose<InnerFunctor,OuterFunctor>
+      unary_compose(const InnerFunctor& inner, const OuterFunctor& outer) 
+      const {
+      return Unary_compose<InnerFunctor,OuterFunctor>(inner, outer);
+    }
+
+
+    //!@}
+    //! \name public functors and predicates
+    //!@{
+       
+                
+public:
+    //! \brief default constructor 
+    Algebraic_curve_kernel_2() 
+      : _m_gcd_cache_2(new Gcd_cache_2())
+    {  
+      _m_curve_cache_2 = boost::shared_ptr<Curve_cache_2>(new Curve_cache_2(this)); 
+      _m_curve_pair_cache_2 =  boost::shared_ptr<Curve_pair_cache_2> (new Curve_pair_cache_2(this)); 
+      // std::cout << "CONSTRUCTION  Algebraic_curve_kernel_2 " << std::endl; 
+    }
+    
+public: 
+    static Algebraic_curve_kernel_2& get_static_instance(){
+      // a default constructed ack_2 instance
+      static Algebraic_curve_kernel_2 ack_2_instance;
+      return ack_2_instance;
+    }
+
+    /*! \brief
+     * constructs \c Curve_analysis_2 from bivariate polynomial, uses caching
+     * when appropriate
+     */
+    class Construct_curve_2 :
+        public std::unary_function< Polynomial_2, Curve_analysis_2 > {
+
+    public:
+
+        Construct_curve_2(const Algebraic_kernel_d_2* kernel) : _m_kernel(kernel) {}
+            
+      Curve_analysis_2 operator()
+        (const Polynomial_2& f) const {
+        return _m_kernel->curve_cache_2()(f);
+      }
+
+    protected:
+
+        const Algebraic_kernel_d_2* _m_kernel;
+        
+
+    };
+    CGAL_Algebraic_Kernel_cons(Construct_curve_2, construct_curve_2_object);
+
+    /*! \brief
+     * constructs \c Curve_pair_analysis_2 from pair of one curve analyses,
+     * caching is used when appropriate
+     */
+    class Construct_curve_pair_2 :
+            public std::binary_function<Curve_analysis_2, Curve_analysis_2,
+                Curve_pair_analysis_2> {
+
+    public:
+
+        Construct_curve_pair_2(const Algebraic_kernel_d_2* kernel) 
+            : _m_kernel(kernel) {}
+           
+        Curve_pair_analysis_2 operator()
+           (const Curve_analysis_2& ca1, const Curve_analysis_2& ca2) const {
+                
+            Curve_pair_analysis_2 cpa_2 =
+                _m_kernel->curve_pair_cache_2()(std::make_pair(ca1, ca2));
+            return cpa_2;
+        }
+
+    protected:
+
+        const Algebraic_kernel_d_2* _m_kernel;
+
+    };
+    CGAL_Algebraic_Kernel_cons(Construct_curve_pair_2,
+        construct_curve_pair_2_object);
+
+    class Construct_algebraic_real_2 {
+
+    private:
+
+      Curve_analysis_2 _construct_defining_polynomial_from(Bound b) const {
+	typedef CGAL::Fraction_traits<Bound> FT;
+	// We rely on the fact that the Bound is a fraction
+	CGAL_static_assertion((::boost::is_same<typename FT::Is_fraction,
+			                     CGAL::Tag_true>::value));
+	typedef typename FT::Numerator_type Numerator;
+	typedef typename FT::Denominator_type Denominator;
+	typedef CGAL::Coercion_traits<Numerator,Coefficient> Num_coercion;
+	CGAL_static_assertion((::boost::is_same
+			      <Coefficient,
+   			       typename Num_coercion::Type>::value));
+	typedef CGAL::Coercion_traits<Denominator,Coefficient> Denom_coercion;
+	CGAL_static_assertion((::boost::is_same
+			       <Coefficient,
+			        typename Denom_coercion::Type>::value));
+	typename Num_coercion::Cast num_cast;
+	typename Denom_coercion::Cast denom_cast;
+	typename FT::Decompose decompose;
+	
+	Numerator num_uncasted;
+	Denominator denom_uncasted;
+	decompose(b,num_uncasted,denom_uncasted);
+
+	Coefficient num = num_cast(num_uncasted);
+	Coefficient denom = denom_cast(denom_uncasted);
+
+	typedef CGAL::Exponent_vector Exponent;
+	std::pair<Exponent,Coefficient> coeffs[2] 
+	  = {std::make_pair(Exponent(0,0),num),
+	     std::make_pair(Exponent(0,1),-denom)};
+	Polynomial_2 pol = typename Polynomial_traits_2
+	  ::Construct_polynomial()(coeffs,coeffs+2);
+	return _m_kernel->construct_curve_2_object()(pol);
+      }
+	
+      Curve_analysis_2 _construct_defining_polynomial_from
+	(typename CGAL::First_if_different<Coefficient,Bound>::Type c) const {
+	typedef CGAL::Exponent_vector Exponent;
+	std::pair<Exponent,Coefficient> coeffs[2] 
+	  = {std::make_pair(Exponent(0,0),c),std::make_pair(Exponent(0,1),-1)};
+	Polynomial_2 pol = typename Polynomial_traits_2
+	  ::Construct_polynomial()(coeffs,coeffs+2);
+	return _m_kernel->construct_curve_2_object()(pol);
+      }
+
+
+    public:
+      
+      typedef Algebraic_real_2 result_type;
+
+      Construct_algebraic_real_2(const Algebraic_kernel_d_2* kernel) 
+	: _m_kernel(kernel) {}
+	
+
+      result_type operator() (int x,int y) const {
+	return this->operator()(Bound(x),Bound(y));
+      }
+
+      result_type operator() (Bound x,Bound y) const {
+	Algebraic_real_1 x_alg 
+	  = _m_kernel->construct_algebraic_real_1_object()(x);
+	Curve_analysis_2 ca
+	  = this->_construct_defining_polynomial_from(y);
+	return Algebraic_real_2(x_alg,ca,0);
+      }
+
+      result_type operator() 
+	(typename CGAL::First_if_different<Coefficient,Bound>::Type x,
+	 typename CGAL::First_if_different<Coefficient,Bound>::Type y) const {
+	Algebraic_real_1 x_alg 
+	  = _m_kernel->construct_algebraic_real_1_object()(x);
+	Curve_analysis_2 ca 
+	  = this->_construct_defining_polynomial_from(y);
+	return Algebraic_real_2(x_alg,ca,0);
+      }
+      
+      result_type operator() (Algebraic_real_1 x, Algebraic_real_1 y) const {
+	std::vector< Algebraic_real_1> roots;
+	Polynomial_1 y_pol =_m_kernel->compute_polynomial_1_object()(y); 
+	_m_kernel->solve_1_object()(y_pol,true,std::back_inserter(roots));
+	std::pair<typename std::vector< Algebraic_real_1>::iterator,
+            	  typename std::vector< Algebraic_real_1>::iterator>
+	  it_pair = std::equal_range(roots.begin(),roots.end(),y);
+	CGAL_assertion(std::distance(it_pair.first,it_pair.second)==1);
+	int index = std::distance(roots.begin(),it_pair.first);
+	
+	int degree = CGAL::degree(y_pol);
+	std::vector<std::pair<CGAL::Exponent_vector,Coefficient> > coeffs;
+	for(int i=0;i<=degree;i++) {
+	  Coefficient c = CGAL::get_coefficient(y_pol,i);
+	  coeffs.push_back(std::make_pair(CGAL::Exponent_vector(0,i),c));
+	}
+	Polynomial_2 y_pol_in_xy
+	  = typename Polynomial_traits_2::Construct_polynomial()
+	      (coeffs.begin(),coeffs.end());
+	Curve_analysis_2 ca 
+	  = _m_kernel->construct_curve_2_object()(y_pol_in_xy);
+	return Algebraic_real_2(x,ca,index);
+      }
+      
+      result_type operator() (Polynomial_2 f,Polynomial_2 g,size_type i) 
+	const {
+	CGAL_precondition(_m_kernel->is_square_free_2_object()(f));
+	CGAL_precondition(_m_kernel->is_square_free_2_object()(g));
+	CGAL_precondition(_m_kernel->is_coprime_2_object()(f,g));
+	std::vector<std::pair<Algebraic_real_2,Multiplicity_type> > roots;
+	this->_m_kernel->solve_2_object()(f,g,std::back_inserter(roots));
+	CGAL_assertion(roots.size()>static_cast<size_t>(i));
+	return roots[i].first;
+      }
+
+      result_type operator() (Polynomial_2 f,Polynomial_2 g,
+			      Bound x_l, Bound x_u, 
+			      Bound y_l, Bound y_u) const {
+	CGAL_precondition(x_l<x_u);
+	CGAL_precondition(y_l<y_u);
+	CGAL_precondition(_m_kernel->is_square_free_2_object()(f));
+	CGAL_precondition(_m_kernel->is_square_free_2_object()(g));
+	CGAL_precondition(_m_kernel->is_coprime_2_object()(f,g));
+	std::vector<std::pair<Algebraic_real_2,Multiplicity_type> > roots;
+	this->_m_kernel->solve_2_object()(f,g,x_l,x_u,y_l,y_u,
+					 std::back_inserter(roots));
+	CGAL_precondition(roots.size()==1);
+	CGAL_precondition(_m_kernel->compare_x_2_object()(roots[0].first,x_l)
+          	          == CGAL::LARGER);
+	CGAL_precondition(_m_kernel->compare_x_2_object()(roots[0].first,x_u)
+          	          == CGAL::SMALLER);
+	CGAL_precondition(_m_kernel->compare_y_2_object()(roots[0].first,y_l)
+          	          == CGAL::LARGER);
+	CGAL_precondition(_m_kernel->compare_y_2_object()(roots[0].first,y_u)
+          	          == CGAL::SMALLER);
+	return roots[0].first;
+      }
+
+      // These are not part of the concept, but used internally
+
+      result_type operator() (Algebraic_real_1 x,int y) const {
+	return this->operator()(x,Bound(y));
+      }
+
+      result_type operator() (Algebraic_real_1 x,Bound y) const {
+	Curve_analysis_2 ca 
+	  = this->_construct_defining_polynomial_from(y);
+	return Algebraic_real_2(x,ca,0);
+      }
+
+      result_type operator() 
+	(Algebraic_real_1 x,
+	 typename CGAL::First_if_different<Coefficient,Bound>::Type y) const {
+	Curve_analysis_2 ca 
+	  = this->_construct_defining_polynomial_from(y);
+	return Algebraic_real_2(x,ca,0);
+      }
+      
+
+    protected:
+      const Algebraic_kernel_d_2* _m_kernel;
+
+    };
+    CGAL_Algebraic_Kernel_cons(Construct_algebraic_real_2, 
+			       construct_algebraic_real_2_object);
+      
+
+    
+    class Compute_polynomial_x_2 :
+      public std::unary_function<Algebraic_real_2, Polynomial_1> {
+
+    public:
+
+      Compute_polynomial_x_2(const Algebraic_kernel_d_2* kernel) 
+	: _m_kernel(kernel) {}
+	  
+      Polynomial_1 operator()(const Algebraic_real_2& xy) const {
+	return _m_kernel->compute_polynomial_1_object()(xy.x());
+      }
+
+    protected:
+        
+      const Algebraic_kernel_d_2* _m_kernel;
+
+    };
+    CGAL_Algebraic_Kernel_cons(Compute_polynomial_x_2, 
+			       compute_polynomial_x_2_object);
+
+    class Compute_polynomial_y_2 :
+      public std::unary_function<Algebraic_real_2, Polynomial_1> {
+
+    public:
+
+      Compute_polynomial_y_2(const Algebraic_kernel_d_2* kernel) 
+	: _m_kernel(kernel) {}
+	  
+      Polynomial_1 operator()(const Algebraic_real_2& xy) const {
+	return _m_kernel->compute_polynomial_1_object()(xy.y());
+      }
+
+    protected:
+        
+      const Algebraic_kernel_d_2* _m_kernel;
+
+    };
+    CGAL_Algebraic_Kernel_cons(Compute_polynomial_y_2, 
+			       compute_polynomial_y_2_object);
+
+
+    class Isolate_x_2 : public std::binary_function<Algebraic_real_2,
+                                                    Polynomial_1,
+                                                    std::pair<Bound,Bound> > {
+      
+    public:
+
+      Isolate_x_2(const Algebraic_kernel_d_2* kernel) 
+	: _m_kernel(kernel) {}
+	  
+	std::pair<Bound,Bound> operator()(Algebraic_real_2 a,
+					  Polynomial_1 p) const {
+	  return _m_kernel->isolate_1_object()
+	    (_m_kernel->compute_x_2_object()(a),p);
+	}
+    
+    protected:
+        
+      const Algebraic_kernel_d_2* _m_kernel;
+
+    };
+    CGAL_Algebraic_Kernel_cons(Isolate_x_2, 
+			       isolate_x_2_object);
+
+    class Isolate_y_2 : public std::binary_function<Algebraic_real_2,
+                                                    Polynomial_1,
+                                                    std::pair<Bound,Bound> > {
+      
+    public:
+
+      Isolate_y_2(const Algebraic_kernel_d_2* kernel) 
+	: _m_kernel(kernel) {}
+	  
+	std::pair<Bound,Bound> operator()(Algebraic_real_2 a,
+					  Polynomial_1 p) const {
+	  // Note: One can avoid to compute the y-coordinate:
+	  // 1.) Construct a Polynomial_2 out of p (with no x-variable)
+	  // 2.) Check whether a lies on p
+	  // 3.) If no, approx the y-coordinate until it is isolated
+	  //     from all roots of p
+	  // 4.) If yes, return the isolating interval of the
+	  //     corresponding roots of p
+	  // 
+	  // It is not clear, however, whether this is less expensive,
+	  // especially if p has high degree
+	  return _m_kernel->isolate_1_object()
+	    (_m_kernel->compute_y_2_object()(a),p);
+	}
+    
+    protected:
+        
+      const Algebraic_kernel_d_2* _m_kernel;
+
+    };
+    CGAL_Algebraic_Kernel_cons(Isolate_y_2, 
+			       isolate_y_2_object);
+
+    class Isolate_2 {
+      
+    public:
+
+      typedef CGAL::cpp11::array<Bound,4> result_type;
+
+      Isolate_2(const Algebraic_kernel_d_2* kernel) 
+	: _m_kernel(kernel) {}
+	  
+    protected:
+
+      // refines the approximation of a until the box is away from all
+      // common solutions of f and g
+      result_type _approx_interval(Algebraic_real_2 a,
+				   Polynomial_2 f,
+				   Polynomial_2 g) const {
+	CGAL_precondition(!_m_kernel->is_zero_at_2_object()(f,a));
+        
+        typename Algebraic_curve_kernel_2::Approximate_absolute_x_2
+	  approx_x = _m_kernel->approximate_absolute_x_2_object();
+	typename Algebraic_curve_kernel_2::Approximate_absolute_y_2
+	  approx_y = _m_kernel->approximate_absolute_y_2_object();
+        
+        typedef CGAL::internal::Interval_evaluate_2< Polynomial_2, Bound > 
+          Interval_evaluate_2;
+        typedef typename Interval_evaluate_2::result_type 
+          Interval_result_type;
+        Interval_evaluate_2 interval_evaluate_2;
+
+        long prec = 4;
+        
+	while(true) {
+	  std::pair<Bound,Bound> x_pair = approx_x(a,prec);
+	  std::pair<Bound,Bound> y_pair = approx_y(a,prec);
+	  result_type curr_box = CGAL::make_array(x_pair.first,
+						  x_pair.second,
+						  y_pair.first,
+						  y_pair.second);
+	  Interval_result_type eval_f = interval_evaluate_2(f,curr_box);
+	  if((CGAL::sign(eval_f.first)==CGAL::sign(eval_f.second)) &&
+	     (CGAL::sign(eval_f.first)!=CGAL::ZERO)) {
+	    return curr_box;
+	  } 
+	  Interval_result_type eval_g = interval_evaluate_2(g,curr_box);
+	  if((CGAL::sign(eval_g.first)==CGAL::sign(eval_g.second)) &&
+	     (CGAL::sign(eval_g.first)!=CGAL::ZERO)) {
+	    return curr_box;
+	  } 
+	  prec*=2;
+	  
+	}
+      }
+
+    public:
+
+      result_type operator()(Algebraic_real_2 a,
+			     Polynomial_2 f) const {
+	return this->_approx_interval(a,f,Polynomial_2(Coefficient(0)));
+      }
+	
+
+      result_type operator()(Algebraic_real_2 a,
+			     Polynomial_2 f,
+			     Polynomial_2 g) const {
+
+	Curve_analysis_2 ca1 = _m_kernel->construct_curve_2_object()(f);
+	Curve_analysis_2 ca2 = _m_kernel->construct_curve_2_object()(g);
+	Curve_pair_analysis_2 cpa_2
+	  = _m_kernel->construct_curve_pair_2_object()(ca1,ca2);
+	int idx; bool event;
+	cpa_2.x_to_index(_m_kernel->compute_x_2_object()(a),idx,event);
+	if(! event) { // No critical point, no intersection
+	  return this->_approx_interval(a,f,g);
+	}
+	std::vector<std::pair<Algebraic_real_2,Multiplicity_type> > roots;
+	_m_kernel->solve_at_x_2_object()(cpa_2,idx,std::back_inserter(roots));
+	if(roots.size()==0) {
+	  // easy case: No intersection at a's x-coordinate:
+	  return this->_approx_interval(a,f,g);
+	}
+	// Check whether a is really an intersection
+	if(!_m_kernel->is_zero_at_2_object()(f,a)) {
+	  return this->operator()(a,f); 
+	}
+	if(!_m_kernel->is_zero_at_2_object()(g,a)) {
+	  return this->operator()(a,g);
+	}
+	// At this point, a is a common solution of f and g, it must
+	// be one of the points in roots
+	// Isolating x-interval is immediately available from CPA:
+	Bound xl = cpa_2.bound_value_in_interval(idx),
+	  xu  = cpa_2.bound_value_in_interval(idx+1);
+	// Often, there is just one point, so filter this easy case
+	if(roots.size()==1) {
+	  // Any y-interval containing roots[0].first is isolating
+	  std::pair<Bound,Bound> y_pair 
+	    = _m_kernel->approximate_absolute_y_2_object()(roots[0].first,4);
+	  return CGAL::make_array(xl,xu,y_pair.first,y_pair.second);
+	} else { 
+	  // more work! We should not assume that each
+	  // roots[i].first has f or g as defining polynomial, because
+	  // the representation might have been simplifed
+
+	  // Here's the safe way: Take the simpler of the curves
+	  // (but the one without vertical component!)
+	  Curve_analysis_2 ca;
+	  typedef typename Curve_analysis_2::Status_line_1 Status_line_CA_1;
+	  Status_line_CA_1 status_line;
+	  Status_line_CA_1 status_line1
+	    = ca1.status_line_at_exact_x(_m_kernel->compute_x_2_object()(a));
+	  Status_line_CA_1 status_line2
+	    = ca2.status_line_at_exact_x(_m_kernel->compute_x_2_object()(a));
+	  if(status_line1.covers_line()) {
+	    ca=ca2;
+	    status_line=status_line2;
+	  } else if(status_line2.covers_line()) {
+	    ca=ca1;
+	    status_line=status_line1;
+	  } else if(CGAL::total_degree(f)<CGAL::total_degree(g)) {
+	    ca=ca1;
+	    status_line=status_line1;
+	  } else {
+	    ca=ca2;
+	    status_line=status_line2;
+	  }
+	  // binary search is possible, but does not help here,
+	  // since the Curve_pair_analysis is the costly operation
+	  for(int i=0; i<status_line.number_of_events();i++) {
+	    if(status_line.algebraic_real_2(i)==a) {
+	      // Now, we can simply take the isolating interval
+	      return CGAL::make_array(xl,xu,
+				      status_line.lower_bound(i),
+				      status_line.upper_bound(i));
+	    }
+	  }
+	  
+	  CGAL_error_msg("Bug in Isolate_2, please contact developers"); 
+	  // We should never reach this point
+	
+	}
+	// Never reached, but make pedantics happy
+	return CGAL::make_array(Bound(0),Bound(0),Bound(0),Bound(0));
+      }
+
+    protected:
+        
+      const Algebraic_kernel_d_2* _m_kernel;
+
+    };
+    CGAL_Algebraic_Kernel_cons(Isolate_2, 
+			       isolate_2_object);
+
+            
+    //! returns the x-coordinate of an \c Algebraic_real_2 object
+    class Compute_x_2 :
+        public std::unary_function<Algebraic_real_2, Algebraic_real_1> {
+
+    public:
+
+        Compute_x_2(const Algebraic_kernel_d_2* kernel) 
+            : _m_kernel(kernel) {}
+        
+        Algebraic_real_1 operator()(const Algebraic_real_2& xy) const {
+            return xy.x();
+        }
+
+    protected:
+        
+        const Algebraic_kernel_d_2* _m_kernel;
+
+    };
+    CGAL_Algebraic_Kernel_cons(Compute_x_2, compute_x_2_object);
+    
+#if CGAL_AK_ENABLE_DEPRECATED_INTERFACE
+    typedef Compute_x_2 Get_x_2;
+    CGAL_Algebraic_Kernel_cons(Get_x_2, get_x_2_object);
+#endif
+
+    /*! 
+     * \brief returns the y-coordinate of \c Algebraic_real_2 object
+     *
+     * \attention{This method returns the y-coordinate in isolating interval
+     * representation. Calculating such a representation is usually a time-
+     * consuming taks, since it is against the "y-per-x"-view that we take
+     * in our kernel. Therefore, it is recommended, if possible,
+     *  to use the functors
+     * \c Approximate_absolute_y_2 and \c Approximate_relative_y_2 that 
+     * return approximation of the y-coordinate. 
+     */
+    class Compute_y_2 :
+        public std::unary_function<Algebraic_real_2, Algebraic_real_1> {
+        
+    public:
+        
+        Compute_y_2(const Algebraic_kernel_d_2* kernel) 
+            : _m_kernel(kernel) {}
+
+        Algebraic_real_1 operator()(const Algebraic_real_2& xy) const {
+            return xy.y();
+        }
+    protected:
+        
+        const Algebraic_kernel_d_2* _m_kernel;
+
+    };
+    CGAL_Algebraic_Kernel_cons(Compute_y_2, compute_y_2_object);
+    
+#if CGAL_AK_ENABLE_DEPRECATED_INTERFACE
+    typedef Compute_x_2 Get_y_2;
+    CGAL_Algebraic_Kernel_cons(Get_y_2, get_y_2_object);
+#endif
+
+    class Approximate_absolute_x_2 
+    : public std::binary_function<Algebraic_real_2,int,std::pair<Bound,Bound> >{
+    
+    public:
+
+        Approximate_absolute_x_2(const Algebraic_kernel_d_2* kernel) 
+            : _m_kernel(kernel) {}
+
+        std::pair<Bound,Bound> operator() (Algebraic_real_2 xy,
+                                    int prec) const {
+            Compute_x_2 get_x = _m_kernel->compute_x_2_object();
+            return _m_kernel->approximate_absolute_1_object() 
+	      (get_x(xy),prec);
+        }
+
+    protected:
+        
+        const Algebraic_kernel_d_2* _m_kernel;
+        
+    };
+    CGAL_Algebraic_Kernel_cons(Approximate_absolute_x_2, 
+                               approximate_absolute_x_2_object);
+
+    class Approximate_relative_x_2 
+    : public std::binary_function<Algebraic_real_2,int,std::pair<Bound,Bound> >{
+    
+    public:
+        
+        Approximate_relative_x_2(const Algebraic_kernel_d_2* kernel) 
+            : _m_kernel(kernel) {}
+
+        std::pair<Bound,Bound> operator() (Algebraic_real_2 xy,
+                                           int prec) const {
+            Compute_x_2 get_x = _m_kernel->compute_x_2_object();
+            return _m_kernel->approximate_relative_1_object() (get_x(xy),prec);
+        }
+
+    protected:
+        
+        const Algebraic_kernel_d_2* _m_kernel;
+
+    };
+    CGAL_Algebraic_Kernel_cons(Approximate_relative_x_2, 
+                               approximate_relative_x_2_object);
+
+    class Approximate_absolute_y_2 
+    : public std::binary_function<Algebraic_real_2,int,std::pair<Bound,Bound> >{
+
+    public:
+
+        Approximate_absolute_y_2(const Algebraic_kernel_d_2* kernel) 
+            : _m_kernel(kernel) {}
+        
+        std::pair<Bound,Bound> operator() (Algebraic_real_2 xy,
+                                    int prec) const {
+            
+            Bound l = xy.lower_bound_y();  
+            Bound u = xy.upper_bound_y();
+            Bound error = CGAL::ipower(Bound(2),CGAL::abs(prec));
+            while((u-l)*error>Bound(1)) {
+                xy.refine_y();
+                u = xy.upper_bound_y();
+                l = xy.lower_bound_y();
+          }
+          return std::make_pair(l,u);
+        }
+    
+    protected:
+
+        const Algebraic_kernel_d_2* _m_kernel;
+
+    };
+    CGAL_Algebraic_Kernel_cons(Approximate_absolute_y_2, 
+                               approximate_absolute_y_2_object);
+
+    class Approximate_relative_y_2 
+    : public std::binary_function<Algebraic_real_2,int,std::pair<Bound,Bound> >{
+        
+    public:
+        
+        Approximate_relative_y_2(const Algebraic_kernel_d_2* kernel) 
+            : _m_kernel(kernel) {}
+
+        std::pair<Bound,Bound> operator() (Algebraic_real_2 xy,
+                                           int prec) const {
+            if(xy.is_y_zero()) {
+                return std::make_pair(Bound(0),Bound(0));
+            }
+            while(CGAL::sign(xy.lower_bound_y())*CGAL::sign(xy.upper_bound_y())
+                  !=CGAL::POSITIVE) {
+                xy.refine_y();
+            }
+            Bound l = xy.lower_bound_y();  
+            Bound u = xy.upper_bound_y();
+            Bound error = CGAL::ipower(Bound(2),CGAL::abs(prec));
+            Bound min_b = (CGAL::min)(CGAL::abs(u),CGAL::abs(l));
+            while((prec>0)?((u-l)*error>min_b):((u-l)>error*min_b)){
+                xy.refine_y();
+                u = xy.upper_bound_y();
+                l = xy.lower_bound_y();
+                min_b = (CGAL::min)(CGAL::abs(u),CGAL::abs(l));
+          }
+          return std::make_pair(l,u);
+        }
+
+    protected:
+
+        const Algebraic_kernel_d_2* _m_kernel;
+
+    };
+    CGAL_Algebraic_Kernel_cons(Approximate_relative_y_2, 
+                               approximate_relative_y_2_object);
+
+    
+    /*! 
+     * \brief returns a value of type \c Bound that lies between
+     * the x-coordinates of the \c Algebraic_real_2s.
+     *
+     * \pre{The x-coordinates must not be equal}
+     */
+    class Bound_between_x_2 {
+
+    public:
+        
+        Bound_between_x_2(const Algebraic_kernel_d_2* kernel) 
+            : _m_kernel(kernel) {}
+       
+        typedef Algebraic_real_2 first_argument_type;
+        typedef Algebraic_real_2 second_argument_type;
+        typedef Bound result_type;
+            
+        result_type operator()(const Algebraic_real_2& r1, 
+                const Algebraic_real_2& r2) const {
+ 	  return this->_m_kernel->bound_between_1_object()
+                (r1.x(), r2.x());
+        }
+
+    protected:
+
+        const Algebraic_kernel_d_2* _m_kernel;
+
+    };
+    CGAL_Algebraic_Kernel_cons(Bound_between_x_2, 
+            bound_between_x_2_object);
+            
+    /*! 
+     * \brief returns a value of type \c Bound that lies between
+     * the y-coordinates of the \c Algebraic_real_2s.
+     *
+     * \pre{The y-coordinates must not be equal}
+     */
+    class Bound_between_y_2 {
+       
+    public:
+        
+        Bound_between_y_2(const Algebraic_kernel_d_2* kernel) 
+            : _m_kernel(kernel) {}
+
+        typedef Algebraic_real_2 first_argument_type;
+        typedef Algebraic_real_2 second_argument_type;
+        typedef Bound result_type;
+
+	typedef typename Algebraic_kernel_d_2::Curve_analysis_2
+	  ::Status_line_1::Bitstream_descartes Isolator;
+
+        result_type operator()(const Algebraic_real_2& r1, 
+                const Algebraic_real_2& r2) const {
+
+            CGAL_precondition(r1.y() != r2.y());
+
+            Bound res(0);
+
+            Isolator isol1 =
+                r1.curve().status_line_at_exact_x(r1.x()).isolator();
+
+            Isolator isol2 =
+                r2.curve().status_line_at_exact_x(r2.x()).isolator();
+            
+            Bound low1, low2, high1, high2;
+            
+            while (true) {
+                low1 = isol1.left_bound(r1.arcno());
+                high1 = isol1.right_bound(r1.arcno());
+                
+                low2 = isol2.left_bound(r2.arcno());
+                high2 = isol2.right_bound(r2.arcno());
+                
+                if (low1 > high2) {
+                    res = ((low1 + high2)/Bound(2));
+                    break;
+                }
+                if (low2 > high1) {
+                    res = ((low2 + high1)/Bound(2));
+                    break;
+                }
+                
+                // else
+                isol1.refine_interval(r1.arcno());
+                isol2.refine_interval(r2.arcno());
+            }
+
+            CGAL::simplify(res);
+
+            CGAL_postcondition_code(
+                    CGAL::Comparison_result exp = CGAL::SMALLER
+            );
+            CGAL_postcondition_code(
+                    if (r1.y() > r2.y()) {
+                        exp = CGAL::LARGER;
+                    }
+            );
+            CGAL_postcondition(r1.y().compare(res) == exp);
+            CGAL_postcondition(r2.y().compare(res) == -exp);
+
+            return res;
+        }
+
+    protected:
+
+        const Algebraic_kernel_d_2* _m_kernel;
+
+    };
+    CGAL_Algebraic_Kernel_cons(Bound_between_y_2, 
+            bound_between_y_2_object);
+    
+    //! \brief comparison of x-coordinates 
+    class Compare_x_2 :
+         public std::binary_function<Algebraic_real_2, Algebraic_real_2, 
+                Comparison_result > {
+
+    public:
+        
+        Compare_x_2(const Algebraic_kernel_d_2* kernel) 
+            : _m_kernel(kernel) {}
+
+        Comparison_result operator()(const Algebraic_real_2& xy1, 
+                                     const Algebraic_real_2& xy2) const {
+	  return _m_kernel->compare_1_object()(xy1.x(), xy2.x());
+        }
+
+#if CGAL_AK_ENABLE_DEPRECATED_INTERFACE
+        Comparison_result operator()(const Algebraic_real_1& xy1, 
+                                     const Algebraic_real_1& xy2) const {
+	  return _m_kernel->compare_1_object()(xy1, xy2);
+        }
+
+#endif
+
+        Comparison_result operator()(const Algebraic_real_2& xy, 
+                                     int i) const {
+	  return _m_kernel->compare_1_object()
+	    ( _m_kernel->compute_x_2_object()(xy), 
+	      _m_kernel->construct_algebraic_real_1_object()(i) );
+        }
+        Comparison_result operator()(int i, const Algebraic_real_2& xy) const {
+	  return _m_kernel->compare_1_object()
+	    ( _m_kernel->construct_algebraic_real_1_object()(i),
+	      _m_kernel->compute_x_2_object()(xy) );
+        }
+
+
+        Comparison_result operator()(const Algebraic_real_2& xy, 
+                                     Bound b) const {
+	  return _m_kernel->compare_1_object()
+	    ( _m_kernel->compute_x_2_object()(xy), 
+	      _m_kernel->construct_algebraic_real_1_object()(b) );
+        }
+        Comparison_result operator()(Bound b, 
+				     const Algebraic_real_2& xy) const {
+	  return _m_kernel->compare_1_object()
+	    ( _m_kernel->construct_algebraic_real_1_object()(b),
+	      _m_kernel->compute_x_2_object()(xy) );
+        }
+
+        Comparison_result operator()
+	  (const Algebraic_real_2& xy, 
+	   typename CGAL::First_if_different<Coefficient,Bound>::Type c) 
+	  const {
+	  return _m_kernel->compare_1_object()
+	    ( _m_kernel->compute_x_2_object()(xy), 
+	      _m_kernel->construct_algebraic_real_1_object()(c) );
+        }
+        Comparison_result operator()
+	  (typename CGAL::First_if_different<Coefficient,Bound>::Type c, 
+	   const Algebraic_real_2& xy) const {
+	  return _m_kernel->compare_1_object()
+	    ( _m_kernel->construct_algebraic_real_1_object()(c),
+	      _m_kernel->compute_x_2_object()(xy) );
+        }
+
+        Comparison_result operator()(const Algebraic_real_2& xy, 
+                                     const Algebraic_real_1 a) const {
+	  return _m_kernel->compare_1_object()
+	    ( _m_kernel->compute_x_2_object()(xy),a );
+        }
+        Comparison_result operator()(const Algebraic_real_1& a, 
+				     const Algebraic_real_2& xy) const {
+	  return _m_kernel->compare_1_object()
+	    ( a,_m_kernel->compute_x_2_object()(xy) );
+        }
+
+
+
+    protected:
+
+        const Algebraic_kernel_d_2* _m_kernel;
+
+    };
+    CGAL_Algebraic_Kernel_pred(Compare_x_2, compare_x_2_object);
+
+    /*! 
+     * \brief comparison of y-coordinates of two points
+     *
+     * \attention{If both points have different x-coordinates, this method
+     * has to translate both y-coordinates 
+     * into isolating interval representations which is a time-consuming
+     * operation (compare the documentation of the \c Get_y_2 functor)
+     * If possible, it is recommended to avoid this functor for efficiency.}
+     */
+    class Compare_y_2 :
+        public std::binary_function< Algebraic_real_2, Algebraic_real_2, 
+                Comparison_result > {
+    
+    public:
+
+        Compare_y_2(const Algebraic_kernel_d_2* kernel) 
+            : _m_kernel(kernel) {}
+    
+        Comparison_result operator()(const Algebraic_real_2& xy1, 
+                                     const Algebraic_real_2& xy2) const {
+            
+	  // It is easier if the x coordinates are equal!
+	  if(_m_kernel->compare_x_2_object()(xy1, xy2) ==
+	     CGAL::EQUAL) 
+	    return _m_kernel->compare_xy_2_object()(xy1, xy2, true);
+	  
+	  return _m_kernel->compare_1_object()(xy1.y(), xy2.y());
+        }
+	
+	Comparison_result operator()(const Algebraic_real_2& xy, 
+                                     int i) const {
+	  
+	  Algebraic_real_1 x = _m_kernel->compute_x_2_object()(xy);
+	  Algebraic_real_2 xy_from_i			       
+	    = _m_kernel->construct_algebraic_real_2_object()(x,i);
+	  return _m_kernel->compare_xy_2_object()(xy, xy_from_i, true);
+          
+        }
+
+	Comparison_result operator()(int i,const Algebraic_real_2& xy) const {
+	  
+	  Algebraic_real_1 x = _m_kernel->compute_x_2_object()(xy);
+	  Algebraic_real_2 xy_from_i			       
+	    = _m_kernel->construct_algebraic_real_2_object()(x,i);
+	  return _m_kernel->compare_xy_2_object()(xy_from_i, xy, true);
+          
+        }
+
+	Comparison_result operator()(const Algebraic_real_2& xy, 
+                                     Bound b) const {
+	  
+	  Algebraic_real_1 x = _m_kernel->compute_x_2_object()(xy);
+	  Algebraic_real_2 xy_from_b			       
+	    = _m_kernel->construct_algebraic_real_2_object()(x,b);
+	  return _m_kernel->compare_xy_2_object()(xy, xy_from_b, true);
+          
+        }
+
+	Comparison_result operator()(Bound b,
+				     const Algebraic_real_2& xy) const {
+	  
+	  Algebraic_real_1 x = _m_kernel->compute_x_2_object()(xy);
+	  Algebraic_real_2 xy_from_b			       
+	    = _m_kernel->construct_algebraic_real_2_object()(x,b);
+	  return _m_kernel->compare_xy_2_object()(xy_from_b, xy, true);
+	}
+
+	Comparison_result operator()
+	  (const Algebraic_real_2& xy, 
+	   typename CGAL::First_if_different<Coefficient,Bound>::Type c) 
+	  const {
+	  
+	  Algebraic_real_1 x = _m_kernel->compute_x_2_object()(xy);
+	  Algebraic_real_2 xy_from_c			       
+	    = _m_kernel->construct_algebraic_real_2_object()(x,c);
+	  return _m_kernel->compare_xy_2_object()(xy, xy_from_c, true);
+	}
+
+	Comparison_result operator()
+	  (typename CGAL::First_if_different<Coefficient,Bound>::Type c,
+	   const Algebraic_real_2& xy) 
+	  const {
+	  
+	  Algebraic_real_1 x = _m_kernel->compute_x_2_object()(xy);
+	  Algebraic_real_2 xy_from_c			       
+	    = _m_kernel->construct_algebraic_real_2_object()(x,c);
+	  return _m_kernel->compare_xy_2_object()(xy_from_c, xy, true);
+	}
+
+	Comparison_result operator()(const Algebraic_real_2& xy, 
+                                     const Algebraic_real_1& a) const {
+	  
+	  Algebraic_real_1 x = _m_kernel->compute_x_2_object()(xy);
+	  Algebraic_real_2 xy_from_a			       
+	    = _m_kernel->construct_algebraic_real_2_object()(x,a);
+	  return _m_kernel->compare_xy_2_object()(xy, xy_from_a, true);
+          
+        }
+
+	Comparison_result operator()(const Algebraic_real_1& a,
+				     const Algebraic_real_2& xy) const {
+	  
+	  Algebraic_real_1 x = _m_kernel->compute_x_2_object()(xy);
+	  Algebraic_real_2 xy_from_a			       
+	    = _m_kernel->construct_algebraic_real_2_object()(x,a);
+	  return _m_kernel->compare_xy_2_object()(xy_from_a, xy, true);
+	}
+
+    protected:
+        
+        const Algebraic_kernel_d_2* _m_kernel;
+        
+    };
+    CGAL_Algebraic_Kernel_pred(Compare_y_2, compare_y_2_object);
+    
+    /*! 
+     * \brief lexicographical comparison of two \c Algebraic_real_2 objects
+     *
+     * \param equal_x if set, the points are assumed 
+     * to have equal x-coordinates, thus only the y-coordinates are compared.
+     */
+    class Compare_xy_2 :
+          public std::binary_function<Algebraic_real_2, Algebraic_real_2, 
+                Comparison_result > {
+
+    public:
+
+         Compare_xy_2(const Algebraic_kernel_d_2* kernel) 
+            : _m_kernel(kernel) {}
+    
+         Comparison_result operator()(const Algebraic_real_2& xy1, 
+             const Algebraic_real_2& xy2, bool equal_x = false) const {
+
+             // handle easy cases first
+             /*if(xy1.is_identical(xy2))
+                return CGAL::EQUAL;
+                
+             if(equal_x && xy1.curve().is_identical(xy2.curve()))
+                return CGAL::sign(xy1.arcno() - xy2.arcno());
+                
+             bool swap = (xy1.id() > xy2.id());
+             std::pair<Algebraic_real_2, Algebraic_real_2> p(xy1, xy2);
+             if(swap) {
+                 p.first = xy2;
+                 p.second = xy1;
+             }
+           
+             typename Cmp_xy_map::Find_result r =
+                _m_kernel->_m_cmp_xy.find(p);
+             if(r.second) {
+               //std::cerr << "Xy_coordinate2: precached compare_xy result\n";
+                 return (swap ? -(r.first->second) : r.first->second);
+             }*/
+
+            return xy1.compare_xy(xy2, equal_x);             
+             //_m_kernel->_m_cmp_xy.insert(std::make_pair(p, res));
+             //return (swap ? -res : res);
+	 }
+
+	 Comparison_result operator() (const Algebraic_real_2& xy,
+				       int x, int y) const {
+	   Comparison_result comp_x
+	     = _m_kernel->compare_x_2_object()(xy,x);
+	   return (comp_x != CGAL::EQUAL 
+		   ? comp_x 
+		   : _m_kernel->compare_y_2_object()(xy,y) );
+	 }
+
+	 Comparison_result operator() (int x,int y,
+				       const Algebraic_real_2& xy) const {
+	   Comparison_result comp_x
+	     = _m_kernel->compare_x_2_object()(x,xy);
+	   return (comp_x != CGAL::EQUAL 
+		   ? comp_x 
+		   : _m_kernel->compare_y_2_object()(y,xy) );
+	 }
+
+	 Comparison_result operator() (const Algebraic_real_2& xy,
+				       Bound x, Bound y) const {
+	   Comparison_result comp_x
+	     = _m_kernel->compare_x_2_object()(xy,x);
+	   return (comp_x != CGAL::EQUAL 
+		   ? comp_x 
+		   : _m_kernel->compare_y_2_object()(xy,y) );
+	 }
+
+	 Comparison_result operator() (Bound x,Bound y,
+				       const Algebraic_real_2& xy) const {
+	   Comparison_result comp_x
+	     = _m_kernel->compare_x_2_object()(x,xy);
+	   return (comp_x != CGAL::EQUAL 
+		   ? comp_x 
+		   : _m_kernel->compare_y_2_object()(y,xy) );
+	 }
+
+	 Comparison_result operator() 
+	   (const Algebraic_real_2& xy,
+	    typename CGAL::First_if_different<Coefficient,Bound>::Type x, 
+	    typename CGAL::First_if_different<Coefficient,Bound>::Type y) 
+	   const {
+	   Comparison_result comp_x
+	     = _m_kernel->compare_x_2_object()(xy,x);
+	   return (comp_x != CGAL::EQUAL 
+		   ? comp_x 
+		   : _m_kernel->compare_y_2_object()(xy,y) );
+	 }
+
+	 Comparison_result operator() 
+	   (typename CGAL::First_if_different<Coefficient,Bound>::Type x,
+	    typename CGAL::First_if_different<Coefficient,Bound>::Type y,
+	    const Algebraic_real_2& xy) const {
+	   Comparison_result comp_x
+	     = _m_kernel->compare_x_2_object()(x,xy);
+	   return (comp_x != CGAL::EQUAL 
+		   ? comp_x 
+		   : _m_kernel->compare_y_2_object()(y,xy) );
+	 }
+
+	 Comparison_result operator() (const Algebraic_real_2& xy,
+				       const Algebraic_real_1& x, 
+				       const Algebraic_real_1& y) const {
+	   Comparison_result comp_x
+	     = _m_kernel->compare_x_2_object()(xy,x);
+	   return (comp_x != CGAL::EQUAL 
+		   ? comp_x 
+		   : _m_kernel->compare_y_2_object()(xy,y) );
+	 }
+
+	 Comparison_result operator() (const Algebraic_real_1& x, 
+				       const Algebraic_real_1& y,
+				       const Algebraic_real_2& xy) const {
+	   Comparison_result comp_x
+	     = _m_kernel->compare_x_2_object()(x,xy);
+	   return (comp_x != CGAL::EQUAL 
+		   ? comp_x 
+		   : _m_kernel->compare_y_2_object()(y,xy) );
+	 }
+
+    protected:
+
+        const Algebraic_kernel_d_2* _m_kernel;
+
+    };
+    CGAL_Algebraic_Kernel_pred(Compare_xy_2, compare_xy_2_object);
+    
+    /*!
+     * \brief checks whether the curve induced by \c p 
+     * has only finitely many self-intersection points
+     *
+     * In algebraic terms, it is checked whether  
+     * the polynomial \c p is square free.
+     */
+    class Has_finite_number_of_self_intersections_2 :
+            public std::unary_function< Polynomial_2, bool > {
+        
+    public:
+
+        Has_finite_number_of_self_intersections_2(const Algebraic_kernel_d_2* kernel) 
+            : _m_kernel(kernel) {}
+        
+        bool operator()(const Polynomial_2& p) const {
+
+            typename Polynomial_traits_2::Is_square_free is_square_free;
+            return is_square_free(p);
+        }
+
+    protected:
+        
+        const Algebraic_kernel_d_2* _m_kernel;
+        
+    };
+    CGAL_Algebraic_Kernel_pred(Has_finite_number_of_self_intersections_2, 
+            has_finite_number_of_self_intersections_2_object);
+            
+    /*! 
+     * \brief checks whether two curves induced bt \c f and \c g 
+     * habe finitely many intersections.
+     *
+     * In algebraic terms, it is checked whether 
+     * the two polynomials \c f and \c g are coprime.
+     */ 
+    class Has_finite_number_of_intersections_2 :
+        public std::binary_function< Polynomial_2, Polynomial_2, bool > {
+         
+    public:
+
+        Has_finite_number_of_intersections_2(const Algebraic_kernel_d_2* kernel) 
+            : _m_kernel(kernel) {}
+
+        bool operator()(const Polynomial_2& f,
+                        const Polynomial_2& g) const {
+            // if curve ids are the same - non-decomposable
+            if(f.id() == g.id())
+                return true;
+            typename Polynomial_traits_2::Gcd_up_to_constant_factor gcd_utcf;
+            typename Polynomial_traits_2::Total_degree total_degree;
+             return (total_degree(gcd_utcf(f, g)) == 0);
+        }
+
+    protected:
+        
+        const Algebraic_kernel_d_2* _m_kernel;
+        
+    };
+  CGAL_Algebraic_Kernel_pred(Has_finite_number_of_intersections_2, 
+            has_finite_number_of_intersections_2_object);
+    
+  // Square_free_factorize_2
+  class Square_free_factorize_2 {
+
+  public:
+      
+      Square_free_factorize_2(const Algebraic_kernel_d_2* kernel) 
+          : _m_kernel(kernel) {}
+      
+      typedef Polynomial_2 first_argument_type;
+      template< class OutputIterator>
+      OutputIterator operator()( const Polynomial_2& p, OutputIterator it) 
+          const {
+          return CGAL::square_free_factorize_up_to_constant_factor(p,it);
+      } 
+  
+  protected:
+
+        const Algebraic_kernel_d_2* _m_kernel;
+
+  };
+  CGAL_Algebraic_Kernel_cons(
+          Square_free_factorize_2, square_free_factorize_2_object);
+
+  //this is deprecated ! 
+    //! Various curve and curve pair decomposition functions
+  class Decompose_2 {
+    
+    public:
+
+        typedef bool result_type;
+
+        Decompose_2(const Algebraic_kernel_d_2* kernel) 
+            : _m_kernel(kernel) {}
+
+        //! returns the square free part of the curve induced by \c p
+        Polynomial_2 operator()(const Polynomial_2& p) {
+            typename Polynomial_traits_2::Make_square_free msf;
+            return msf(p);
+        }
+        
+        /*! 
+         * \brief computes a square-free factorization of a curve \c c, 
+         * returns the number of pairwise coprime square-free factors
+         * 
+         * returns square-free pairwise coprime factors in \c fit and
+         * multiplicities in \c mit. The value type of \c fit is
+         * \c Curve_analysis_2, the value type of \c mit is \c int
+         */
+        template< class OutputIterator1, class OutputIterator2 >
+        int operator()(const Curve_analysis_2& ca,
+                     OutputIterator1 fit, OutputIterator2 mit ) const {
+                        
+            typename Polynomial_traits_2::
+                Square_free_factorize_up_to_constant_factor factorize;
+            std::vector<Polynomial_2> factors;
+            
+            int n_factors = factorize(ca.polynomial_2(),
+                                      std::back_inserter(factors), mit);
+            Construct_curve_2 cc_2 = _m_kernel->construct_curve_2_object();
+            for(int i = 0; i < static_cast<int>(factors.size()); i++) 
+                *fit++ = cc_2(factors[i]);
+            
+            return n_factors;
+        }
+
+        /*!\brief
+         * Decomposes two curves \c ca1 and \c ca2 into common part
+         * and coprime parts
+         *
+         * The common part of the curves \c ca1 and \c ca2 is written in
+         * \c oib, the coprime parts are written to \c oi1 and \c oi2,
+         * respectively.
+         *         
+         * \return {true, if the two curves were not coprime (i.e., have a 
+         * non-trivial common part}
+         *
+         * The value type of \c oi{1,2,b} is \c Curve_analysis_2
+         */
+        template < class OutputIterator > 
+        bool operator()(const Curve_analysis_2& ca1,
+            const Curve_analysis_2& ca2, OutputIterator oi1,
+                OutputIterator oi2, OutputIterator oib) const {
+
+#if CGAL_ACK_DONT_CHECK_POLYNOMIALS_FOR_COPRIMALITY
+        return false;  
+#else 
+
+            Construct_curve_2 cc_2 = _m_kernel->construct_curve_2_object();
+          
+
+            if (ca1.id() == ca2.id()) {
+                return false;
+            }
+
+            const Polynomial_2& f = ca1.polynomial_2();
+            const Polynomial_2& g = ca2.polynomial_2();
+            
+            if(f == g) {
+              // both curves are equal, but have different representations!
+              // std::cout <<"f: " << f <<std::endl;
+              // std::cout <<"g: " << g <<std::endl;
+              CGAL_assertion(false);
+              return false;
+            }
+            Gcd_cache_2& gcd_cache = _m_kernel->gcd_cache_2();
+            typedef typename Curve_analysis_2::size_type size_type;
+            Polynomial_2 gcd = gcd_cache(std::make_pair(f,g));
+            size_type n = CGAL::degree(gcd);
+            size_type nc = CGAL::degree(
+                    CGAL::univariate_content_up_to_constant_factor(gcd));
+            if( n!=0 || nc!=0 ) {
+                Curve_analysis_2 common_curve = cc_2(gcd);
+                *oib++ = common_curve;
+                Polynomial_2 divided_curve 
+                    = CGAL::integral_division(f,gcd);
+                if( CGAL::degree(divided_curve)>=1 || 
+                    CGAL::degree(
+                            CGAL::univariate_content_up_to_constant_factor
+                            (divided_curve)) >=1 ) {
+                    Curve_analysis_2 divided_c = cc_2(divided_curve);
+                    *oi1++ = divided_c;
+                }
+                divided_curve = CGAL::integral_division(g,gcd);
+                if(CGAL::degree(divided_curve) >= 1 ||
+                   CGAL::degree(
+                           CGAL::univariate_content_up_to_constant_factor
+                           ( divided_curve )) >=1 ) {
+                    Curve_analysis_2 divided_c = cc_2(divided_curve);
+                    *oi2++ = divided_c;
+                }
+                return true;
+            }
+
+                
+            // copy original curves to the output iterator:
+            *oi1++ = ca1;
+            *oi2++ = ca2;
+            return false;
+#endif
+        }
+
+    protected:
+
+        const Algebraic_kernel_d_2* _m_kernel;
+
+  };
+    CGAL_Algebraic_Kernel_cons(Decompose_2, decompose_2_object);
+    
+    //!@}
+public:
+    //! \name types and functors for \c CurvedKernelViaAnalysis_2
+    //!@{
+    
+    //! Algebraic name
+    typedef Algebraic_real_1 Coordinate_1;
+
+    //! Non-Algebraic name
+    typedef Algebraic_real_2 Coordinate_2;
+
+    class Is_square_free_2 : public std::unary_function<Polynomial_2,bool> {
+
+    public:
+
+      Is_square_free_2(const Algebraic_kernel_d_2* kernel) 
+            : _m_kernel(kernel) {}
+
+      bool operator()(const Polynomial_2& p) const {
+	return typename Polynomial_traits_2::Is_square_free() (p);
+      }
+      
+    private:
+
+      const Algebraic_kernel_d_2* _m_kernel;
+
+    };
+    CGAL_Algebraic_Kernel_cons(Is_square_free_2, is_square_free_2_object);
+
+    //! Algebraic name
+    typedef Has_finite_number_of_intersections_2 Is_coprime_2;
+    CGAL_Algebraic_Kernel_cons(Is_coprime_2, is_coprime_2_object);
+
+    class Make_square_free_2 : public std::unary_function<Polynomial_2,
+                                                          Polynomial_2> {
+
+    public:
+      Make_square_free_2(const Algebraic_kernel_d_2* kernel) 
+            : _m_kernel(kernel) {}
+
+      Polynomial_2 operator()(const Polynomial_2& p) const {
+	return typename Polynomial_traits_2::Make_square_free() (p);
+      }
+      
+    private:
+
+      const Algebraic_kernel_d_2* _m_kernel;
+
+    };
+    CGAL_Algebraic_Kernel_cons(Make_square_free_2, make_square_free_2_object);
+
+    class Make_coprime_2 {
+
+    public:
+
+      typedef bool result_type;
+
+      Make_coprime_2(const Algebraic_kernel_d_2* kernel) 
+	: _m_kernel(kernel) {}
+	
+      bool operator()(const Polynomial_2& p1,
+		      const Polynomial_2& p2,
+		      Polynomial_2& g,
+		      Polynomial_2& q1,
+		      Polynomial_2& q2) const {
+	
+	Polynomial_2 one(Coefficient(1));
+	
+	if (p1==p2) {
+	  g=p1; q1=one; q2=one;
+	  return false;
+	}
+	Gcd_cache_2& gcd_cache = _m_kernel->gcd_cache_2();
+	g = gcd_cache(std::make_pair(p1,p2));
+	q1=CGAL::integral_division_up_to_constant_factor(p1,g);
+	q2=CGAL::integral_division_up_to_constant_factor(p2,g);
+	return CGAL::total_degree(g)==0;
+      }
+      
+    private:
+      
+      const Algebraic_kernel_d_2* _m_kernel;
+      
+    };
+    CGAL_Algebraic_Kernel_cons(Make_coprime_2, make_coprime_2_object);
+
+
+#if CGAL_AK_ENABLE_DEPRECATED_INTERFACE
+
+    /*!
+     * \brief computes the x-critical points of of a curve/a polynomial
+     *
+     * An x-critical point (x,y) of \c f (or its induced curve) 
+     * satisfies f(x,y) = f_y(x,y) = 0, 
+     * where f_y means the derivative w.r.t. y.
+     * In pariticular, each singular point is x-critical.
+     */
+    class X_critical_points_2 : 
+        public std::binary_function< Curve_analysis_2, 
+            std::iterator<std::output_iterator_tag, Algebraic_real_2>,
+            std::iterator<std::output_iterator_tag, Algebraic_real_2> > {
+       
+    public:
+        
+        X_critical_points_2(const Algebraic_kernel_d_2* kernel) 
+            : _m_kernel(kernel) {}
+        /*! 
+         * \brief writes the x-critical points of \c ca_2 into \c oi 
+         */
+        template <class OutputIterator>
+        OutputIterator operator()(const Curve_analysis_2& ca_2,
+                OutputIterator oi) const {
+                
+            typename Polynomial_traits_2::Differentiate diff;
+            Construct_curve_2 cc_2 = _m_kernel->construct_curve_2_object();
+            Construct_curve_pair_2 ccp_2 
+                = _m_kernel->construct_curve_pair_2_object();
+            // construct curve analysis of a derivative in y
+            Curve_analysis_2 ca_2x = cc_2(diff(ca_2.polynomial_2(),0));
+            Curve_pair_analysis_2 cpa_2 = ccp_2(ca_2, ca_2x);
+            typename Curve_pair_analysis_2::Status_line_1 cpv_line;
+            typename Curve_analysis_2::Status_line_1 cv_line;
+            
+            int i, j, n_arcs, n_events =
+                cpa_2.number_of_status_lines_with_event();
+            std::pair<int,int> ipair;
+            bool vline_constructed = false;
+            
+            for(i = 0; i < n_events; i++) {
+                cpv_line = cpa_2.status_line_at_event(i);
+                // no 2-curve intersections over this status line
+                if(!cpv_line.is_intersection())
+                    continue;
+                n_arcs = cpv_line.number_of_events();
+                for(j = 0; j < n_arcs; j++) {
+                    ipair = cpv_line.curves_at_event(j, ca_2,ca_2x);
+                    if(ipair.first == -1|| ipair.second == -1) 
+                        continue;
+                    if(!vline_constructed) {
+                        cv_line = ca_2.status_line_at_exact_x(cpv_line.x());
+                        vline_constructed = true;
+                    }
+                    // ipair.first is an arcno over status line of the
+                    // curve p
+                    *oi++ = cv_line.algebraic_real_2(ipair.first);
+                }
+                vline_constructed = false;
+            }
+            return oi;
+        }
+        
+        //! \brief computes the \c i-th x-critical point of  \c ca
+        Algebraic_real_2 operator()(const Curve_analysis_2& ca, int i) const
+        {
+            std::vector<Algebraic_real_2> x_points;
+            (*this)(ca, std::back_inserter(x_points));
+            CGAL_precondition(0 >= i&&i < x_points.size());
+            return x_points[i];
+        }
+    
+    protected:
+
+        const Algebraic_kernel_d_2* _m_kernel;
+
+    };
+    CGAL_Algebraic_Kernel_cons(X_critical_points_2,
+        x_critical_points_2_object);
+    
+    /*!
+     * \brief computes the y-critical points of of a curve/a polynomial
+     *
+     * An y-critical point (x,y) of \c f (or its induced curve) 
+     * satisfies f(x,y) = f_x(x,y) = 0, 
+     * where f_x means the derivative w.r.t. x.
+     * In pariticular, each singular point is y-critical.
+     */
+    class Y_critical_points_2 :
+        public std::binary_function< Curve_analysis_2, 
+            std::iterator<std::output_iterator_tag, Algebraic_real_2>,
+            std::iterator<std::output_iterator_tag, Algebraic_real_2> > {
+        
+
+    public:
+
+        Y_critical_points_2(const Algebraic_kernel_d_2* kernel) 
+            : _m_kernel(kernel) {}
+
+        /*! 
+         * \brief writes the y-critical points of \c ca_2 into \c oi 
+         */
+        template <class OutputIterator>
+        OutputIterator operator()(const Curve_analysis_2& ca_2, 
+            OutputIterator oi) const
+        {
+            Construct_curve_2 cc_2 = _m_kernel->construct_curve_2_object();
+            Construct_curve_pair_2 ccp_2 
+                = _m_kernel->construct_curve_pair_2_object();
+            
+            typename Curve_analysis_2::Status_line_1 cv_line;
+            std::pair<int,int> ipair;
+            int i, j, k, n_arcs, n_events =
+                ca_2.number_of_status_lines_with_event();
+            
+            bool cpa_constructed = false, vline_constructed = false; 
+            typename Curve_pair_analysis_2::Status_line_1
+                cpv_line;
+            Curve_pair_analysis_2 cpa_2;
+            
+            for(i = 0; i < n_events; i++) {
+                cv_line = ca_2.status_line_at_event(i);
+                n_arcs = cv_line.number_of_events();
+                for(j = 0; j < n_arcs; j++) {
+                    ipair = cv_line.number_of_incident_branches(j);
+                    // general case: no special tests required
+                    if(!(ipair.first == 1&&ipair.second == 1)) {
+                        *oi++ = cv_line.algebraic_real_2(j);
+                        continue;
+                    }
+                    if(!cpa_constructed) {
+                        typename Polynomial_traits_2::Differentiate diff;
+                        // construct curve analysis of a derivative in y
+                        Curve_analysis_2 ca_2y =
+                            cc_2(diff(ca_2.polynomial_2(),1));
+                        cpa_2 = ccp_2(ca_2, ca_2y);
+                        cpa_constructed = true;
+                    }
+                    if(!vline_constructed) {
+                        cpv_line = cpa_2.status_line_for_x(cv_line.x());
+                        vline_constructed = true;
+                    }
+                    if(!cpv_line.is_intersection())
+                        continue;
+                    // obtain the y-position of j-th event of curve p
+                    k = cpv_line.event_of_curve(j, ca_2);
+                    ipair = cpv_line.curves_at_event(k);
+                    
+                    // pick up only event comprised of both curve and its der
+                    if(ipair.first != -1&&ipair.second != -1)
+                        *oi++ = cv_line.algebraic_real_2(j);
+                }
+                vline_constructed = false;
+            }
+            return oi;
+        }
+
+        //! \brief computes the \c i-th x-critical point of  \c ca
+        Algebraic_real_2 operator()(const Curve_analysis_2& ca, int i) const
+        {
+            std::vector<Algebraic_real_2> y_points;
+            (*this)(ca, std::back_inserter(y_points));
+            CGAL_precondition(0 >= i&&i < y_points.size());
+            return y_points[i];
+        }
+
+    protected:
+
+        const Algebraic_kernel_d_2* _m_kernel;
+
+    };
+    CGAL_Algebraic_Kernel_cons(Y_critical_points_2,
+        y_critical_points_2_object);
+
+#endif
+
+ protected:
+
+// TODO typedef Interval_evaluate_2?
+ public:
+
+    // Overload the Sign_at_1 functor, to enable filter steps in the
+    // Curve analysis in a coherent way
+    class Sign_at_1 
+      : public::std::binary_function<Polynomial_1,Algebraic_real_1,Sign> {
+
+      
+    public:
+        
+        Sign_at_1(const Algebraic_kernel_d_2* kernel) 
+            : _m_kernel(kernel) {}
+       
+
+	// Version that refines r up to a certain precision. 
+	// If the (non-zero) sign was not computed until this
+	// precision, CGAL::ZERO is returned. This can be used internally
+	// as a filter to detect easy cases	
+	Sign operator()(const Polynomial_1& p,
+			const Algebraic_real_1& r,
+			int max_prec) const {
+	    typename Algebraic_kernel_d_2::Approximate_absolute_1 approx_x
+	      = _m_kernel->approximate_absolute_1_object();
+
+            typedef CGAL::internal::Interval_evaluate_1< Polynomial_1, Bound > 
+              Interval_evaluate_1;
+            typedef typename Interval_evaluate_1::result_type 
+              Interval_result_type;
+            Interval_evaluate_1 interval_evaluate_1;
+	    
+	    long prec = 1;
+
+            while(prec<=max_prec) {
+  	        std::pair<Bound,Bound> x_pair = approx_x(r,prec);
+		
+		Interval_result_type iv
+                  = interval_evaluate_1(p,
+					std::make_pair(x_pair.first,
+						       x_pair.second));
+                CGAL::Sign s_lower = CGAL::sign(iv.first);
+                if(s_lower == sign(iv.second)) {
+		  return s_lower;
+		} else {
+		  prec*=2;
+		}
+	    }
+	    return CGAL::ZERO;
+	  
+	}
+
+        Sign operator()(const Polynomial_1& p,
+                        const Algebraic_real_1& r,
+			bool known_to_be_non_zero=false) const {
+                
+	    if(!known_to_be_non_zero &&
+	       _m_kernel->is_zero_at_1_object()(p, r)) {
+	      return CGAL::ZERO;
+	    }
+	    CGAL::Sign result = this->operator()
+	      (p,r,(std::numeric_limits<int>::max)());
+	    CGAL_assertion(result != CGAL::ZERO);
+	    return result;	    
+        }
+        
+    protected:
+        
+        const Algebraic_kernel_d_2* _m_kernel;
+
+
+
+    };
+    CGAL_Algebraic_Kernel_pred(Sign_at_1, sign_at_1_object);    
+
+
+    /*!
+     * \brief sign computation of a point and a curve
+     *
+     * computes the sign of a point \c p, evaluate at the polynomial
+     * that defines a curve \c c. If the result is 0, the point lies on the
+     * curve. Returns a value convertible to \c CGAL::Sign
+     */
+    class Sign_at_2 :
+        public std::binary_function<Polynomial_2, Algebraic_real_2, Sign > {
+
+    public:
+        
+        Sign_at_2(const Algebraic_kernel_d_2* kernel) 
+            : _m_kernel(kernel) {}
+       
+	Sign operator()(const Polynomial_2& f,
+                        const Algebraic_real_2& r,
+			bool known_to_be_non_zero=false) const {
+
+	  return this->operator()(_m_kernel->construct_curve_2_object()(f),r,
+				  known_to_be_non_zero);
+        }
+
+	// Version that refines x- and y-coordinate up to a certain
+	// precision. If the non-zero sign was not computed until this
+	// precision, CGAL::ZERO is returned. This can used internally
+	// as a filter to detect easy cases	
+	Sign operator()(const Polynomial_2& f,
+			const Algebraic_real_2& r,
+			int max_prec) const {
+	  return this->operator()(_m_kernel->construct_curve_2_object()(f),r,
+				  max_prec);
+	}
+
+	// Version that refines x- and y-coordinate up to a certain
+	// precision. If the non-zero sign was not computed until this
+	// precision, CGAL::ZERO is returned. This can be used internally
+	// as a filter to detect easy cases	
+	Sign operator()(const Curve_analysis_2& ca_2,
+			const Algebraic_real_2& r,
+			int max_prec) const {
+	    if(ca_2.is_identical(r.curve())) {
+	      return CGAL::ZERO;
+	    }
+	    typename Algebraic_kernel_d_2::Approximate_absolute_x_2 approx_x
+	      = _m_kernel->approximate_absolute_x_2_object();
+	    typename Algebraic_kernel_d_2::Approximate_absolute_y_2 approx_y
+	      = _m_kernel->approximate_absolute_y_2_object();
+
+            typedef CGAL::internal::Interval_evaluate_2< Polynomial_2, Bound > 
+              Interval_evaluate_2;
+            typedef typename Interval_evaluate_2::result_type 
+              Interval_result_type;
+            Interval_evaluate_2 interval_evaluate_2;
+	    
+	    long prec = 4;
+
+            while(prec<=max_prec) {
+  	        std::pair<Bound,Bound> x_pair = approx_x(r,prec);
+  	        std::pair<Bound,Bound> y_pair = approx_y(r,prec);
+		
+		Interval_result_type iv
+                  = interval_evaluate_2(ca_2.polynomial_2(),
+					CGAL::make_array(x_pair.first,
+							 x_pair.second,
+							 y_pair.first,
+							 y_pair.second));
+                CGAL::Sign s_lower = CGAL::sign(iv.first);
+                if(s_lower == sign(iv.second)) {
+		  return s_lower;
+		} else {
+		  prec*=2;
+		}
+	    }
+	    return CGAL::ZERO;
+	  
+	}
+
+        Sign operator()(const Curve_analysis_2& ca_2,
+                        const Algebraic_real_2& r,
+			bool known_to_be_non_zero=false) const {
+                
+ 	    if(ca_2.is_identical(r.curve())) {
+	      return CGAL::ZERO;
+	    }
+	    if(!known_to_be_non_zero &&
+	       _m_kernel->is_zero_at_2_object()(ca_2, r)) {
+	      return CGAL::ZERO;
+	    }
+	    CGAL::Sign result = this->operator()
+	      (ca_2,r,(std::numeric_limits<int>::max)());
+	    CGAL_assertion(result != CGAL::ZERO);
+	    return result;	    
+        }
+        
+    protected:
+        
+        const Algebraic_kernel_d_2* _m_kernel;
+
+    
+    };
+    CGAL_Algebraic_Kernel_pred(Sign_at_2, sign_at_2_object);
+
+    class Is_zero_at_2 
+      : public std::binary_function<Polynomial_2,Algebraic_real_2,bool> {
+    
+    public:
+      
+      Is_zero_at_2(const Algebraic_kernel_d_2* kernel) 
+	: _m_kernel(kernel) {}
+	
+      bool operator() (const Polynomial_2& f, const Algebraic_real_2& r) const {
+	return this->operator() (_m_kernel->construct_curve_2_object()(f),r);
+      }
+
+      bool operator() (const Curve_analysis_2& ca_2, 
+		       const Algebraic_real_2& r) const {
+
+
+	if (CGAL::is_zero(ca_2.polynomial_2())) {
+	  return true;
+	}
+	
+	Construct_curve_2 cc_2 = _m_kernel->construct_curve_2_object();
+	Construct_curve_pair_2 ccp_2 
+	  = _m_kernel->construct_curve_pair_2_object();
+
+	typename Curve_analysis_2::Status_line_1
+	  cv_line = ca_2.status_line_for_x(r.x());
+	// fast check for the presence of status line at r.x()
+	if(cv_line.covers_line())    
+	  return true;
+	
+	// Handle non-coprime polynomial
+	Polynomial_2 gcd = _m_kernel->gcd_cache_2()
+	  (std::make_pair(ca_2.polynomial_2(), r.curve().polynomial_2()));
+	
+	Curve_analysis_2 gcd_curve = cc_2(gcd);
+	if(CGAL::total_degree(gcd)>0) {
+	  
+	  Construct_curve_pair_2 ccp_2
+	    = _m_kernel->construct_curve_pair_2_object();
+	  Curve_analysis_2 r_curve_remainder =
+	    cc_2(CGAL::integral_division_up_to_constant_factor
+		 (r.curve().polynomial_2(), gcd));
+                    
+	  r.simplify_by(ccp_2(gcd_curve, r_curve_remainder));
+	  if(r.curve().polynomial_2() == gcd) 
+	    return true;
+	}
+
+	Curve_pair_analysis_2 cpa_2 = ccp_2(ca_2, r.curve());
+	typename Curve_pair_analysis_2::Status_line_1
+	  cpv_line = cpa_2.status_line_for_x(r.x());
+	
+	if(cpv_line.is_event() && cpv_line.is_intersection()) {
+	  // get an y-position of the point r
+	  int idx = cpv_line.event_of_curve(r.arcno(), r.curve());
+	  std::pair<int, int> ipair =
+	    cpv_line.curves_at_event(idx);
+	  if(ipair.first != -1 && ipair.second != -1)
+	    return true;
+	}
+	return false;
+      }
+
+    protected:
+
+        const Algebraic_kernel_d_2* _m_kernel;
+
+    };
+    CGAL_Algebraic_Kernel_cons(Is_zero_at_2, 
+			       is_zero_at_2_object);
+
+
+ protected:
+
+    // Internal Functor to get all solutions at a certain x-coordinate
+    class Solve_at_x_2 {
+
+    public:
+
+        Solve_at_x_2(const Algebraic_kernel_d_2* kernel) 
+            : _m_kernel(kernel) {}
+
+
+	//! Version with Algebraic_real_1
+        template <class OutputIterator>
+	  OutputIterator
+           operator()(const Curve_pair_analysis_2& cpa_2, 
+		      Algebraic_real_1 a,
+		      OutputIterator res) const {
+	  int idx; bool event;
+	  cpa_2.x_to_index(a,idx,event);
+	  if(! event) {
+	    return res; // no intersections at a
+	  } else {
+	    return this->operator()(cpa_2,idx,res);
+	  }
+	}
+
+        //! Version with index (faster)
+        template <class OutputIterator>
+	  OutputIterator
+           operator()(const Curve_pair_analysis_2& cpa_2, 
+		      size_type index,
+		      OutputIterator res) const 
+        {
+  	    Curve_analysis_2 ca1 = cpa_2.curve_analysis(true),
+	      ca2 = cpa_2.curve_analysis(false);
+            typename Curve_pair_analysis_2::Status_line_1 cpv_line;
+            // do we need to check which supporting curve is simpler ?    
+            typename Polynomial_traits_2::Total_degree total_degree;
+
+            Polynomial_2 f1 = ca1.polynomial_2(),
+                f2 = ca2.polynomial_2();
+            bool first_curve = (total_degree(f1) < total_degree(f2));
+            
+            CGAL_assertion(index<cpa_2.number_of_status_lines_with_event());
+	    cpv_line = cpa_2.status_line_at_event(index);
+	    Algebraic_real_1 x = cpv_line.x(); 
+	    bool ca1_covers_line 
+	      = ca1.status_line_at_exact_x(x).covers_line();
+	    bool ca2_covers_line 
+	      = ca2.status_line_at_exact_x(x).covers_line();
+	    
+	    for(int j = 0; j < cpv_line.number_of_events(); j++) {
+	      std::pair<int,int> ipair = cpv_line.curves_at_event(j,ca1,ca2);
+	      if(ipair.first != -1 && ipair.second != -1) {
+		Algebraic_real_2 new_root   
+		  = Algebraic_real_2(x, 
+				     (first_curve ? ca1 : ca2),
+				     (first_curve ? ipair.first
+				      : ipair.second));
+		Multiplicity_type new_mult
+		  = cpv_line.multiplicity_of_intersection(j);
+		*res++ = std::make_pair(new_root,new_mult);
+		continue;
+	      }
+	      if(ipair.first!=-1 && ca2_covers_line) {
+		Algebraic_real_2 new_root   
+		  = Algebraic_real_2(x,ca1,ipair.first);
+		Multiplicity_type new_mult=-1;
+		*res++ = std::make_pair(new_root,new_mult);
+		continue;
+	      }
+	      if(ipair.second!=-1 && ca1_covers_line) {
+		Algebraic_real_2 new_root   
+		  = Algebraic_real_2(x,ca2,ipair.second);
+		Multiplicity_type new_mult=-1;
+		*res++ = std::make_pair(new_root,new_mult);
+		continue;
+	      }
+	    }
+	    return res;
+        }
+
+    protected:
+
+        const Algebraic_kernel_d_2* _m_kernel;
+
+    };
+    CGAL_Algebraic_Kernel_cons(Solve_at_x_2, solve_at_x_2_object);
+
+
+ public:
+
+    /*!
+     * \brief computes solutions of systems of two 2 equations and 2 variables
+     *
+     * \pre the polynomials must be square-free and coprime
+     */  
+    class Solve_2 {
+    
+    public:
+
+        Solve_2(const Algebraic_kernel_d_2* kernel) 
+            : _m_kernel(kernel) {}
+
+#if CGAL_AK_ENABLE_DEPRECATED_INTERFACE
+        template <class OutputIteratorRoots, class OutputIteratorMult>
+        std::pair<OutputIteratorRoots, OutputIteratorMult>
+           operator()
+               (const Polynomial_2& f, const Polynomial_2& g,
+                OutputIteratorRoots roots, OutputIteratorMult mults) const {
+	  std::vector<std::pair<Algebraic_real_2,Multiplicity_type> > 
+	    roots_vec;
+	  this->operator()(f,g,std::back_inserter(roots_vec));
+	  typename Algebraic_kernel_d_1::template Pair_first
+	    <Algebraic_real_2,Multiplicity_type> pair_first;	  
+	  typename Algebraic_kernel_d_1::template Pair_second
+	    <Algebraic_real_2,Multiplicity_type> pair_second;	  
+	  std::copy(::boost::make_transform_iterator
+		      (roots_vec.begin(),pair_first),
+		    ::boost::make_transform_iterator
+		      (roots_vec.end(),pair_first),
+		    roots);
+	  std::copy(::boost::make_transform_iterator
+		      (roots_vec.begin(),pair_second),
+		    ::boost::make_transform_iterator
+		      (roots_vec.end(),pair_second),
+		    mults);
+	  return std::make_pair(roots,mults);
+	}
+	  
+#endif
+
+        /*! 
+         * \brief solves the system (f=0,g=0)
+         *
+         * All solutions of the system are written into \c roots 
+         * (whose value type is \c Algebraic_real_2). The multiplicities
+         * are written into \c mults (whose value type is \c int)
+         */
+        template <class OutputIterator> OutputIterator
+           operator()
+               (const Polynomial_2& f, const Polynomial_2& g,
+                OutputIterator res) const {
+            return 
+                (*this)(_m_kernel->construct_curve_2_object()(f),
+                        _m_kernel->construct_curve_2_object()(g),
+                        res);
+        }
+
+#if CGAL_AK_ENABLE_DEPRECATED_INTERFACE
+        template <class OutputIteratorRoots, class OutputIteratorMult>
+        std::pair<OutputIteratorRoots, OutputIteratorMult>
+           operator()
+               (const Curve_analysis_2& f, const Curve_analysis_2& g,
+                OutputIteratorRoots roots, OutputIteratorMult mults) const {
+	  std::vector<std::pair<Algebraic_real_2,Multiplicity_type> > 
+	    roots_vec;
+	  this->operator()(f,g,std::back_inserter(roots_vec));
+	  typename Algebraic_kernel_d_1::template Pair_first
+	    <Algebraic_real_2,Multiplicity_type> pair_first;	  
+	  typename Algebraic_kernel_d_1::template Pair_second
+	    <Algebraic_real_2,Multiplicity_type> pair_second;	  
+	  std::copy(::boost::make_transform_iterator
+		      (roots_vec.begin(),pair_first),
+		    ::boost::make_transform_iterator
+		      (roots_vec.end(),pair_first),
+		    roots);
+	  std::copy(::boost::make_transform_iterator
+		      (roots_vec.begin(),pair_second),
+		    ::boost::make_transform_iterator
+		      (roots_vec.end(),pair_second),
+		    mults);
+	  return std::make_pair(roots,mults);
+	}
+	  
+#endif
+
+
+        //! Version with curve analyses
+        template <class OutputIterator>
+	  OutputIterator
+           operator()(const Curve_analysis_2& ca1, 
+		      const Curve_analysis_2& ca2,
+		      OutputIterator res) const 
+        {
+            // these tests are quite expensive... do we really need them ??
+            /*
+            CGAL_precondition_code (
+                typename Self::Has_finite_number_of_self_intersections_2 
+                    not_self_overlapped;
+                typename Self::Has_finite_number_of_intersections_2 
+                    do_not_overlap;
+                CGAL_precondition(not_self_overlapped(ca1) &&
+                    not_self_overlapped(ca2));
+                CGAL_precondition(do_not_overlap(ca1, ca2));
+            );
+            */
+            Construct_curve_pair_2 ccp_2
+                = _m_kernel->construct_curve_pair_2_object();
+            Curve_pair_analysis_2 cpa_2 = ccp_2(ca1, ca2);
+            typename Curve_pair_analysis_2::Status_line_1 cpv_line;
+            // do we need to check which supporting curve is simpler ?    
+            //typename Polynomial_traits_2::Total_degree total_degree;
+
+            //Polynomial_2 f1 = ca1.polynomial_2(),
+            //    f2 = ca2.polynomial_2();
+            //bool first_curve = (total_degree(f1) < total_degree(f2));
+            
+            int i, n = cpa_2.number_of_status_lines_with_event();
+	    for(i = 0; i < n; i++) {
+              _m_kernel->solve_at_x_2_object()(cpa_2,i,res);
+            }
+            return res;
+        }
+
+	template <class OutputIterator> OutputIterator
+	  operator()
+	  (const Polynomial_2& f, const Polynomial_2& g,
+	   Bound xl, Bound xu, Bound yl, Bound yu,
+	   OutputIterator res) const {
+	  // Note: This could be improved by not computing all solutions
+	  //       but only those in [xl,xu] (lazy evaluation)
+	  std::vector<std::pair<Algebraic_real_2,Multiplicity_type> > roots;
+	  this->operator() (f,g,std::back_inserter(roots));
+	  // Find the x-values using binary search:
+	  typename Algebraic_kernel_d_1::template Pair_first
+	    <Algebraic_real_2,Multiplicity_type> pair_first;
+	  typedef typename
+	    std::vector<std::pair<Algebraic_real_2,Multiplicity_type> >
+	    ::iterator Iterator;
+	  Iterator roots_start = std::lower_bound
+	    (::boost::make_transform_iterator
+	     (roots.begin(),
+	      _m_kernel->unary_compose(pair_first,
+				       _m_kernel->compute_x_2_object())),
+	     ::boost::make_transform_iterator
+	     (roots.end(),
+	      _m_kernel->unary_compose(pair_first,
+				       _m_kernel->compute_x_2_object())),
+	     _m_kernel->construct_algebraic_real_1_object()(xl)).base();
+	  Iterator roots_end = std::upper_bound
+	    (::boost::make_transform_iterator
+	     (roots_start,
+	      _m_kernel->unary_compose(pair_first,
+				       _m_kernel->compute_x_2_object())),
+	     ::boost::make_transform_iterator
+	     (roots.end(),
+	      _m_kernel->unary_compose(pair_first,
+				       _m_kernel->compute_x_2_object())),
+	     _m_kernel->construct_algebraic_real_1_object()(xu)).base();
+	  // Now check y-coordinate. Binary search is not possible here!
+	  // Note that compare_y is not too expensive here because we
+	  // only compare with rationals
+	  for(Iterator it=roots_start;it!=roots_end;it++) {
+	    if(_m_kernel->compare_y_2_object()(yl,it->first)==CGAL::LARGER) {
+	      continue;
+	    }
+	    if(_m_kernel->compare_y_2_object()(it->first,yu)==CGAL::LARGER) {
+	      continue;
+	    }
+	    *res++ = *it;
+	  }
+	  return res;
+	}
+	     
+    protected:
+
+        const Algebraic_kernel_d_2* _m_kernel;
+
+    };
+    CGAL_Algebraic_Kernel_cons(Solve_2, solve_2_object);
+
+    class Number_of_solutions_2 
+      : public std::binary_function<Polynomial_2,Polynomial_2,size_type> {
+    
+    public:
+      
+      Number_of_solutions_2(const Algebraic_kernel_d_2* kernel) 
+	: _m_kernel(kernel) {}
+	
+      size_type operator() 
+	(const Polynomial_2& f, const Polynomial_2& g) const {
+
+	std::vector<std::pair<Algebraic_real_2,Multiplicity_type> > roots;
+	_m_kernel->solve_2_object()(f,g,std::back_inserter(roots));
+	return roots.size(); 
+      }
+
+    protected:
+
+        const Algebraic_kernel_d_2* _m_kernel;
+
+    };
+    CGAL_Algebraic_Kernel_cons(Number_of_solutions_2, 
+			       number_of_solutions_2_object);
+
+    // Functor used to evaluate a Polynomial_2 in a Bound, up to a
+    // constant factor
+    class Evaluate_utcf_2 
+      : public std::binary_function<Polynomial_2,Bound,Polynomial_1> {
+    
+    public:
+      
+      Evaluate_utcf_2(const Algebraic_kernel_d_2* kernel) 
+	: _m_kernel(kernel) {}
+	
+      Polynomial_1 operator() (const Polynomial_2& f, Bound b) const {
+	typedef CGAL::Fraction_traits<Bound> FT;
+	// We rely on the fact that the Bound is a fraction
+	CGAL_static_assertion((::boost::is_same<typename FT::Is_fraction,
+			                     CGAL::Tag_true>::value));
+	typedef typename FT::Numerator_type Numerator;
+	typedef typename FT::Denominator_type Denominator;
+	typedef CGAL::Coercion_traits<Numerator,Coefficient> Num_coercion;
+	CGAL_static_assertion((::boost::is_same
+			      <Coefficient,
+   			       typename Num_coercion::Type>::value));
+	typedef CGAL::Coercion_traits<Denominator,Coefficient> Denom_coercion;
+	CGAL_static_assertion((::boost::is_same
+			       <Coefficient,
+			        typename Denom_coercion::Type>::value));
+	typename Num_coercion::Cast num_cast;
+	typename Denom_coercion::Cast denom_cast;
+	typename FT::Decompose decompose;
+	
+	Numerator num_uncasted;
+	Denominator denom_uncasted;
+	decompose(b,num_uncasted,denom_uncasted);
+
+	Coefficient num = num_cast(num_uncasted);
+	Coefficient denom = denom_cast(denom_uncasted);
+	return CGAL::evaluate_homogeneous(f,num,denom);
+      }
+
+    protected:
+
+        const Algebraic_kernel_d_2* _m_kernel;
+
+    };
+    CGAL_Algebraic_Kernel_cons(Evaluate_utcf_2, 
+			       evaluate_utcf_2_object);
+
+#if CGAL_AK_ENABLE_DEPRECATED_INTERFACE
+    /*!
+     * \brief Construct a curve with the roles of x and y interchanged.
+     */
+    class Swap_x_and_y_2 {
+
+    public:
+
+        Swap_x_and_y_2(const Algebraic_kernel_d_2* kernel) 
+            : _m_kernel(kernel) {}
+        
+        typedef Polynomial_2 argument_type;
+        typedef Curve_analysis_2 result_type;
+
+        Curve_analysis_2 operator() (const Curve_analysis_2& ca) {
+            return this->operator() (ca.polynomial_2());
+        }
+
+        Curve_analysis_2 operator() (const Polynomial_2& f) {
+            Polynomial_2 f_yx
+                = typename Polynomial_traits_2::Swap() (f,0,1);
+            return _m_kernel->construct_curve_2_object() (f_yx);
+        }
+    
+    protected:
+
+        const Algebraic_kernel_d_2* _m_kernel;
+
+    };
+    CGAL_Algebraic_Kernel_cons(Swap_x_and_y_2, swap_x_and_y_2_object);
+
+    //! Refines the x-coordinate of an Algebraic_real_2 object
+    class Refine_x_2 :
+        public std::unary_function<Algebraic_real_2, void> {
+
+    public:
+        
+        Refine_x_2(const Algebraic_kernel_d_2* kernel) 
+            : _m_kernel(kernel) {}
+      
+        void operator()(const Algebraic_real_2& r) const {
+            r.refine_x();            
+        }
+	/* TODO: if needed, include
+        void operator()(Algebraic_real_2& r, int rel_prec) const {  
+            r.refine_x(rel_prec);
+        }
+	*/
+        
+    protected:
+
+        const Algebraic_kernel_d_2* _m_kernel;
+
+    };
+    CGAL_Algebraic_Kernel_pred(Refine_x_2, refine_x_2_object);
+    
+    class Refine_y_2 :
+        public std::unary_function<Algebraic_real_2, void> {
+
+    public:
+
+        Refine_y_2(const Algebraic_kernel_d_2* kernel) 
+            : _m_kernel(kernel) {}
+      
+        void operator()(const Algebraic_real_2& r) const {
+  	    return r.refine_y();
+        }
+        
+	/* TODO: if needed, include
+        void operator()(Algebraic_real_2& r, int rel_prec) const {  
+            return r.refine_y(rel_prec);
+        }
+	*/
+    
+    protected:
+
+        const Algebraic_kernel_d_2* _m_kernel;
+
+    };
+    CGAL_Algebraic_Kernel_pred(Refine_y_2, refine_y_2_object);
+    
+    class Lower_bound_x_2 {
+       
+    public:
+
+        Lower_bound_x_2(const Algebraic_kernel_d_2* kernel) 
+            : _m_kernel(kernel) {}
+
+        typedef Algebraic_real_2 argument_type;
+        typedef Bound result_type;
+            
+        result_type operator()(const Algebraic_real_2& r) {
+	    return r.lower_bound_x();
+	}
+        
+    protected:
+
+        const Algebraic_kernel_d_2* _m_kernel;
+
+    };
+    CGAL_Algebraic_Kernel_cons(Lower_bound_x_2, lower_bound_x_2_object);
+    
+    class Upper_bound_x_2 {
+       
+    public:
+
+        Upper_bound_x_2(const Algebraic_kernel_d_2* kernel) 
+            : _m_kernel(kernel) {}
+
+        typedef Algebraic_real_2 argument_type;
+        typedef Bound result_type;
+            
+        result_type operator()(const Algebraic_real_2& r) {
+            return r.upper_bound_x();
+        }
+    
+    protected:
+
+        const Algebraic_kernel_d_2* _m_kernel;
+
+    };
+    CGAL_Algebraic_Kernel_cons(Upper_bound_x_2, upper_bound_x_2_object);
+
+    class Lower_bound_y_2 {
+    
+    public:
+
+        Lower_bound_y_2(const Algebraic_kernel_d_2* kernel) 
+            : _m_kernel(kernel) {}
+        
+        typedef Algebraic_real_2 argument_type;
+        typedef Bound result_type;
+            
+        result_type operator()(const Algebraic_real_2& r) {
+	  return r.lower_bound_y();
+	}
+
+    protected:
+
+        const Algebraic_kernel_d_2* _m_kernel;
+
+    };
+    CGAL_Algebraic_Kernel_cons(Lower_bound_y_2, lower_bound_y_2_object);
+    
+    //! an upper bound of the y-coordinate of \c r
+    class Upper_bound_y_2 {
+    
+    public:
+
+        Upper_bound_y_2(const Algebraic_kernel_d_2* kernel) 
+            : _m_kernel(kernel) {}
+   
+        typedef Algebraic_real_2 argument_type;
+        typedef Bound result_type;
+            
+        result_type operator()(const Algebraic_real_2& r) {
+ 	  return r.upper_bound_y();
+	}
+
+    protected:
+
+        const Algebraic_kernel_d_2* _m_kernel;
+
+    };
+    CGAL_Algebraic_Kernel_cons(Upper_bound_y_2, upper_bound_y_2_object);
+    
+
+
+  typedef Bound Boundary; 
+  typedef Lower_bound_x_2 Lower_boundary_x_2;
+  typedef Lower_bound_y_2 Lower_boundary_y_2;
+  typedef Upper_bound_x_2 Upper_boundary_x_2;
+  typedef Upper_bound_y_2 Upper_boundary_y_2;
+  typedef Bound_between_x_2 Boundary_between_x_2;
+  typedef Bound_between_y_2 Boundary_between_y_2;
+
+  CGAL_Algebraic_Kernel_cons(Lower_boundary_x_2,lower_boundary_x_2_object);
+  CGAL_Algebraic_Kernel_cons(Lower_boundary_y_2,lower_boundary_y_2_object);
+  CGAL_Algebraic_Kernel_cons(Upper_boundary_x_2,upper_boundary_x_2_object);
+  CGAL_Algebraic_Kernel_cons(Upper_boundary_y_2,upper_boundary_y_2_object);
+  CGAL_Algebraic_Kernel_cons(Boundary_between_x_2,boundary_between_x_2_object);
+  CGAL_Algebraic_Kernel_cons(Boundary_between_y_2,boundary_between_y_2_object);
+#endif
+
+
+#undef CGAL_Algebraic_Kernel_pred    
+#undef CGAL_Algebraic_Kernel_cons 
+    
+    //!@}
+
+protected:
+
+mutable boost::shared_ptr<Curve_cache_2> _m_curve_cache_2;
+mutable boost::shared_ptr<Curve_pair_cache_2> _m_curve_pair_cache_2;
+mutable boost::shared_ptr<Gcd_cache_2> _m_gcd_cache_2;
+
+    
+}; // class Algebraic_curve_kernel_2
+
+} // namespace CGAL
+
+#endif // CGAL_ALGEBRAIC_CURVE_KERNEL_D_2_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Algebraic_real_d_1.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Algebraic_real_d_1.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Algebraic_real_d_1.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Algebraic_real_d_1.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Algebraic_real_quadratic_refinement_rep_bfi.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Algebraic_real_quadratic_refinement_rep_bfi.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Algebraic_real_quadratic_refinement_rep_bfi.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Algebraic_real_quadratic_refinement_rep_bfi.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Algebraic_real_rep.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Algebraic_real_rep.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Algebraic_real_rep.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Algebraic_real_rep.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Algebraic_real_rep_bfi.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Algebraic_real_rep_bfi.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Algebraic_real_rep_bfi.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Algebraic_real_rep_bfi.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Bitstream_coefficient_kernel.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Bitstream_coefficient_kernel.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Bitstream_coefficient_kernel.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Bitstream_coefficient_kernel.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Bitstream_coefficient_kernel_at_alpha.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Bitstream_coefficient_kernel_at_alpha.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Bitstream_coefficient_kernel_at_alpha.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Bitstream_coefficient_kernel_at_alpha.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Bitstream_descartes.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Bitstream_descartes.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Bitstream_descartes.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Bitstream_descartes.h
diff --git a/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_E08_tree.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_E08_tree.h
new file mode 100644
index 0000000..0a6db49
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_E08_tree.h
@@ -0,0 +1,1054 @@
+// Copyright (c) 2006-2009 Max-Planck-Institute Saarbruecken (Germany).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Arno Eigenwillig <arno at mpi-inf.mpg.de>
+//
+// ============================================================================
+
+// TODO: The comments are all original EXACUS comments and aren't adapted. So
+//         they may be wrong now.
+
+
+#ifndef CGAL_BITSTREAM_DESCARTES_E08_TREE_H
+#define CGAL_BITSTREAM_DESCARTES_E08_TREE_H
+
+#include <vector>
+#include <list>
+#include <utility>
+#include <iterator>
+#include <algorithm>
+
+#include <CGAL/basic.h>
+#include <CGAL/Algebraic_kernel_d/Bitstream_descartes_rndl_tree.h> // TODO remove
+#include <CGAL/Handle_with_policy.h>
+#include <CGAL/Random.h>
+
+#include <boost/optional.hpp>
+
+/*
+ *  AUXILIARY CLASSES AND FUNCTIONS
+ */
+
+namespace CGAL {
+
+namespace internal {
+
+template <class Integer>
+Integer caching_binomial(int n, int k) {
+    CGAL_precondition(n >= 0);
+    if (k < 0 || k > n) return Integer(0);
+
+    // Pascal's triangle; augment if necessary
+    // TODO flat array with manual index computation should be slightly faster
+    typedef std::vector< Integer > Row;
+    typedef std::vector< Row > Triangle;
+    // MSVC uses "pascal" as a keyword or defines it as a macro!
+    static Triangle my_pascal;
+
+    int old_size = int(my_pascal.size());
+    if (n >= old_size) {
+        my_pascal.resize(n+1);
+        if (old_size == 0) {
+            my_pascal[0].push_back(Integer(1));
+            old_size = 1;
+        }
+        for (int i = old_size; i <= n; ++i) {
+            Row& prev = my_pascal[i-1];
+            Row& curr = my_pascal[i];
+            curr.reserve(i+1);
+            curr.push_back(Integer(1));
+            for (int j = 1; j < i; ++j) {
+                curr.push_back(prev[j-1] + prev[j]);
+            }
+            curr.push_back(Integer(1));
+        }
+    }
+    return my_pascal[n][k];
+}
+
+
+template <class Integer_>
+class Power_to_Bernstein_pm1_nofrac_matrix {
+public:
+    typedef Integer_ Integer;
+
+private:
+    int dim_;
+    std::vector<Integer> m_;
+    int ij_to_idx(int i, int j) const { return i*dim_ + j; }
+    void init_m();
+
+public:
+    Power_to_Bernstein_pm1_nofrac_matrix(int degree = -1)
+        : dim_(degree + 1), m_(dim_ * dim_)
+    {
+        CGAL_assertion(degree >= -1);
+        init_m();
+    }
+
+    void set_degree(int degree) {
+        CGAL_assertion(degree >= -1);
+        dim_ = degree + 1;
+        m_.resize(dim_ * dim_);
+        init_m();
+    }
+
+    Integer operator()(int i, int j) const {
+        CGAL_assertion(0 <= i && i < dim_);
+        CGAL_assertion(0 <= j && j < dim_);
+        return m_[ij_to_idx(i,j)];
+    }
+
+    int degree() const { return dim_ - 1; }
+}; // class Power_to_Bernstein_pm1_nofrac_matrix
+
+template <class Integer_>
+void Power_to_Bernstein_pm1_nofrac_matrix<Integer_>::init_m() {
+    // TODO: this implements the definition, but [E08] describes a faster way
+    int degree = dim_ - 1;
+    for (int i = 0; i < dim_; ++i) {
+        for (int j = 0; j < dim_; ++j) {
+            Integer sum(0);
+            int nu_lo = (std::max)(0, i+j-degree);
+            int nu_hi = (std::min)(i, j);
+            for (int nu = nu_lo; nu <= nu_hi; ++nu) {
+                Integer term = caching_binomial<Integer>(j, nu)
+                             * caching_binomial<Integer>(degree-j, i-nu);
+                if ((j - nu) & 1) { sum -= term; }
+                else              { sum += term; }
+            }
+            m_[ij_to_idx(i,j)] =
+                sum 
+              * CGAL::internal::caching_factorial<Integer>(i)
+              * CGAL::internal::caching_factorial<Integer>(degree - i);
+        }
+    }
+}
+
+template <class Traits_>
+class Bitstream_bernstein_from_power {
+public:
+    typedef Traits_  Traits;
+    typedef typename Traits::Coefficient           Coefficient;
+    typedef typename Traits::Integer               Integer;
+    typedef typename Traits::Approximator          Approximator;
+    typedef typename Traits::Lower_bound_log2_abs  Lower_bound_log2_abs;
+    typedef typename Traits::Ceil_log2_abs_Integer Ceil_log2_abs_Integer;
+    typedef typename Traits::Ceil_log2_abs_long    Ceil_log2_abs_long;
+
+    typedef std::vector<Coefficient> Coefficient_vector;
+    typedef std::vector<Integer>     Integer_vector;
+    typedef Power_to_Bernstein_pm1_nofrac_matrix<Integer> Mn;
+    typedef std::map<int, Mn> Mn_cache;
+
+private:
+    Coefficient_vector input_power_coeff_;
+    int degree_;        // $ =   n $ in [E08]
+    long log_radius_;   // $ = r+1 $ in [E08]
+    Approximator approximator_;
+    Lower_bound_log2_abs lower_bound_log2_abs_;
+    long ceil_log_degfac_, floor_log_degfac_, ceil_log_degp1_;
+    long lbd_log_lcoeff_;
+    long log_lcfscale_; // $ =   l $ in [E08]
+
+    Integer_vector bernstein_coeff_; // empty if uninitialized
+    long bernstein_coeff_prec_; // $ = p+1 $ in [E08]
+
+    static Mn_cache mn_cache_;
+    static const Mn& get_mn(int n) {
+        Mn& mn = mn_cache_[n];
+        if (mn.degree() == -1) mn.set_degree(n);
+        return mn;
+    }
+
+public:
+    Bitstream_bernstein_from_power() : degree_(-1) { }
+
+    template <class InputIterator>
+    Bitstream_bernstein_from_power(
+            InputIterator first, InputIterator beyond,
+            long log_radius,
+            const Traits_& traits = Traits_()
+    );
+
+    template <class OutputIterator>
+    OutputIterator operator()(OutputIterator oi, long prec);
+
+    int degree() const { return degree_; }
+
+    void set_traits(Traits& traits) {
+        approximator_ = traits.approximator_object();
+        lower_bound_log2_abs_ = traits.lower_bound_log2_abs_object();
+    }
+}; // class Bitstream_bernstein_from_power
+
+// static member definition
+template <class Traits_>
+std::map<int, Power_to_Bernstein_pm1_nofrac_matrix<typename Traits_::Integer> >
+Bitstream_bernstein_from_power<Traits_>::mn_cache_;
+
+// non-member functions
+template <class Traits_>
+template <class InputIterator>
+Bitstream_bernstein_from_power<Traits_>::Bitstream_bernstein_from_power(
+        InputIterator first, InputIterator beyond,
+        long log_radius,
+        const Traits_& traits // = Traits_()
+) : input_power_coeff_(first, beyond),
+    degree_(int(input_power_coeff_.size() - 1)),
+    log_radius_(log_radius),
+    approximator_(traits.approximator_object()),
+    lower_bound_log2_abs_(traits.lower_bound_log2_abs_object())
+{ 
+    CGAL_assertion(degree_ >= 0);
+    lbd_log_lcoeff_ = lower_bound_log2_abs_(input_power_coeff_[degree_]);
+    if (degree_ == 2) {
+        ceil_log_degfac_ = floor_log_degfac_ = 1;
+        ceil_log_degp1_ = 2;
+    } else {
+        ceil_log_degfac_
+            = Ceil_log2_abs_Integer()
+                (CGAL::internal::
+                 caching_factorial<Integer>(degree_));
+        floor_log_degfac_
+            = ceil_log_degfac_ - 1;
+        ceil_log_degp1_
+            = Ceil_log2_abs_long()(degree_ + 1);
+    }
+    log_lcfscale_
+        = lbd_log_lcoeff_ + floor_log_degfac_ + degree_ * (log_radius+1);
+}
+
+template <class Traits_>
+template <class OutputIterator>
+OutputIterator
+Bitstream_bernstein_from_power<Traits_>::operator()(
+        OutputIterator oi,
+        long prec // $ = p+1$ in [E08]
+) {
+    CGAL_precondition(degree_ >= 0);
+
+    // try to produce output from existing coefficient approximations
+    if (!bernstein_coeff_.empty()) {
+        long delta_prec = bernstein_coeff_prec_ - prec;
+        if (delta_prec == 0) {
+            for (int i = 0; i <= degree_; ++i) {
+                *oi = bernstein_coeff_[i];
+                ++oi;
+            }
+            return oi;
+        } else if (delta_prec > 0) {
+            Integer half = Integer(1) << (delta_prec-1);
+            for (int i = 0; i <= degree_; ++i) {
+                *oi = (bernstein_coeff_[i] + half) >> delta_prec;
+                ++oi;
+            }
+            return oi;
+        }
+        // else delta_prec < 0: fall through to precision increase
+    } else {
+        bernstein_coeff_.resize(degree_ + 1);
+    }
+
+    // compute coefficients at new precision
+    Integer_vector c(degree_ + 1);
+    long q = prec + ceil_log_degfac_ + ceil_log_degp1_ + 1;
+    for (int j = 0; j <= degree_; ++j) {
+        c[j] = approximator_(
+                input_power_coeff_[j],
+                j*log_radius_ - log_lcfscale_ + q
+        );
+    }
+    const Mn& mn = get_mn(degree_);
+    long shift = q - prec;
+    Integer half = Integer(1) << (shift-1);
+    for (int i = 0; i <= degree_; ++i) {
+        Integer bi(0);
+        for (int j = 0; j <= degree_; ++j) bi += mn(i,j) * c[j];
+        bernstein_coeff_[i] = (bi + half) >> shift;
+    }
+    bernstein_coeff_prec_ = prec;
+
+    // output new approximations
+    for (int i = 0; i <= degree_; ++i) {
+        *oi = bernstein_coeff_[i];
+        ++oi;
+    }
+    return oi;
+}
+
+} // namespace internal
+
+
+/*
+ * The generic de Casteljau method
+ */
+
+template <class Integer_>
+class Convex_combinator_approx_Integer_log {
+public:
+    typedef Integer_ Integer;
+
+private:
+    Integer alpha_num_, beta_num_, half_;
+    int log_denom_;
+
+public:
+    Convex_combinator_approx_Integer_log(
+            Integer alpha_num = Integer(1), int log_denom = 1
+    ) : alpha_num_(alpha_num),
+        beta_num_((Integer(1) << log_denom) - alpha_num),
+        half_((log_denom > 0) ? (Integer(1) << log_denom-1) : 0),
+        log_denom_(log_denom)
+    {
+        CGAL_precondition(log_denom_ >= 0);
+    }
+    void into_first(Integer& a, const Integer& b) const {
+        a *= alpha_num_; a += beta_num_*b;
+        a += half_; a >>= log_denom_;  // round to nearest
+    }
+    void into_second(const Integer& a, Integer& b) const {
+        b *= beta_num_; b += alpha_num_*a;
+        b += half_; b >>= log_denom_;  // round to nearest
+    }
+    void into_third(const Integer& a, const Integer& b, Integer& c) const {
+        c = a; c *= alpha_num_; c += beta_num_*b; // c might alias a but not b
+        c += half_; c >>= log_denom_;  // round to nearest
+    }
+};
+
+template <class NT_>
+class Convex_combinator_approx_fraction {
+public:
+    typedef NT_ NT;
+private:
+    NT alpha_num_, beta_num_, denom_, half_;
+public:
+    Convex_combinator_approx_fraction(NT alpha_num, NT denom)
+        : alpha_num_(alpha_num), beta_num_(denom - alpha_num),
+          denom_(denom), half_(denom >> 1)
+    { }
+    void into_first(NT& a, const NT& b) const {
+        a *= alpha_num_; a += beta_num_*b;
+        a += half_; a /= denom_;  // round to nearest
+    }
+    void into_second(const NT& a, NT& b) const {
+        b *= beta_num_; b += alpha_num_*a;
+        b += half_; b /= denom_;  // round to nearest
+    }
+    void into_third(const NT& a, const NT& b, NT& c) const {
+        c = a; c *= alpha_num_; c += beta_num_*b; // c might alias a but not b
+        c += half_; c /= denom_;  // round to nearest
+    }
+}; // class Convex_combinator_approx_fraction
+
+namespace internal {
+
+/*
+ * THE ACTUAL TREE CLASSES
+ */
+template <class BitstreamDescartesE08TreeTraits>
+class Bitstream_descartes_E08_tree;
+
+template <class BitstreamDescartesE08TreeTraits>
+        struct Bitstream_descartes_E08_node;
+
+        template <class BitstreamDescartesE08TreeTraits>
+        class Bitstream_descartes_E08_tree_rep;
+} // namespace internal
+
+} //namespace CGAL
+
+/* The template argument supplied as BitstreamDescartesE08TreeTraits
+ * shall be a class containing the following types in its scope:
+ *   Coefficient:           caller-supplied coefficient type
+ *   Bound:              type for interval bound output (exact)
+ *   Integer:               integer type for actual calculations, needs >>, <<
+ *   Approximator:          functor to get Integer approx to x*2^p from coeff x
+ *   Lower_bound_log2_abs:  functor for lower bound to log|x| for coeff x
+ *   Bound_creator:      functor to create bound x*2^p from x and p
+ *   Sign:                  functor to get sign of Integer x
+ *   Ceil_log2_abs_Integer: functor to get smallest long >= log|x| for Integer
+ *   Ceil_log2_abs_long:    functor to get smallest long >= log|x| for long
+ */
+
+/*
+ * macros for common typedefs
+ */
+
+// bring types from traits into local scope
+#define CGAL_SNAP_BITSTREAM_DESCARTES_E08_TREE_TRAITS_TYPEDEFS(TRAITS)  \
+  typedef typename TRAITS::Coefficient           Coefficient;           \
+  typedef typename TRAITS::Bound                 Bound;                 \
+  typedef typename TRAITS::Integer               Integer;               \
+  typedef typename TRAITS::Approximator          Approximator;          \
+  typedef typename TRAITS::Lower_bound_log2_abs  Lower_bound_log2_abs;  \
+  typedef typename TRAITS::Bound_creator      Bound_creator;            \
+  typedef typename TRAITS::Sign                  Sign;                  \
+  typedef typename TRAITS::Ceil_log2_abs_Integer Ceil_log2_abs_Integer; \
+  typedef typename TRAITS::Ceil_log2_abs_long    Ceil_log2_abs_long     \
+
+// end #define
+
+// common typedefs for all Bitstream_descartes_E08_* classes
+#define CGAL_BITSTREAM_DESCARTES_E08_TREE_COMMON_TYPEDEFS               \
+  typedef BitstreamDescartesE08TreeTraits TRAITS;                       \
+  typedef TRAITS Bitstream_descartes_E08_tree_traits;                   \
+  CGAL_SNAP_BITSTREAM_DESCARTES_E08_TREE_TRAITS_TYPEDEFS(TRAITS);       \
+  typedef CGAL::internal::Bitstream_bernstein_from_power<TRAITS> B_from_p; \
+  typedef std::vector<Integer> Integer_vector;                          \
+  typedef CGAL::internal::Abs_le_pow2<Ceil_log2_abs_Integer>            \
+  Abs_le_pow2;                                                          \
+  typedef CGAL::internal::Sign_eps_log2                                 \
+  <Integer, Abs_le_pow2, Sign>                                          \
+  Sign_eps_log2                                                         \
+  
+// end #define
+
+// typedefs for Bitstream_descartes_E08_tree{,_rep}
+#define CGAL_BITSTREAM_DESCARTES_E08_TREE_TYPEDEFS                     \
+  CGAL_BITSTREAM_DESCARTES_E08_TREE_COMMON_TYPEDEFS;                   \
+  typedef CGAL::internal::Bitstream_descartes_E08_node<TRAITS> Node;   \
+  typedef std::list<Node> Node_list                                    \
+  
+// end #define
+
+
+namespace CGAL {
+
+namespace internal {
+
+/*
+ * class Bitstream_descartes_E08_node
+ */
+
+template <class BitstreamDescartesE08TreeTraits>
+struct Bitstream_descartes_E08_node {
+public:
+  typedef Bitstream_descartes_E08_node Self;
+  CGAL_BITSTREAM_DESCARTES_E08_TREE_COMMON_TYPEDEFS;
+  
+  friend class CGAL::internal::Bitstream_descartes_E08_tree<TRAITS>;
+  friend class CGAL::internal::Bitstream_descartes_E08_tree_rep<TRAITS>;
+
+private:
+    // "node data" (set individually in subdivision)
+    Integer lower_num_, upper_num_; // TODO use lower_num_, width_num_ instead
+    long log_bdry_den_;
+    Integer_vector coeff_; // wrt [lower_, upper_], approximate
+    int min_var_, max_var_;
+    bool coeff_update_delayed_;
+    // "state data" (copied en bloc by .copy_state_from())
+    long subdepth_bound_, subdepth_current_;
+    long log_eps_;   // $q - p$
+    long log_C_eps_; // $q - p + 4n$
+
+    Bitstream_descartes_E08_node(int degree = -1,
+            Integer lower_num = Integer(0), Integer upper_num = Integer(0),
+            long log_bdry_den = 0, int min_var = -1, int max_var = -1
+    ) : lower_num_(lower_num), upper_num_(upper_num),
+          log_bdry_den_(log_bdry_den),
+          coeff_(degree+1),
+          min_var_(min_var), max_var_(max_var),
+          coeff_update_delayed_(false),
+          subdepth_bound_(0), subdepth_current_(0),
+           log_eps_(0), log_C_eps_(0)
+    { }
+
+    void copy_state_from(const Self& n) {
+        subdepth_bound_   = n.subdepth_bound_;
+        subdepth_current_ = n.subdepth_current_;
+        log_eps_          = n.log_eps_;
+        log_C_eps_        = n.log_C_eps_;
+    }
+
+    // const Self& operator= (const Self&); // assignment is forbidden
+}; // struct Bitstream_descartes_E08_node
+
+
+/*
+ * class Bitstream_descartes_E08_tree_rep
+ */
+
+template <class BitstreamDescartesE08TreeTraits>
+class Bitstream_descartes_E08_tree_rep {
+public:
+    typedef Bitstream_descartes_E08_tree_rep Self;
+    CGAL_BITSTREAM_DESCARTES_E08_TREE_TYPEDEFS;
+
+    class Monomial_basis_tag { };
+
+    friend class CGAL::internal::Bitstream_descartes_E08_tree<TRAITS>;
+
+private:
+    B_from_p b_from_p_;
+    long log_radius_;
+    int degree_;
+    long ceil_log_degree_;
+    Node_list node_list_;
+
+    long payload_prec_;
+    int subdiv_tries_, subdiv_fails_;
+    int bisect_tries_, bisect_fails_;
+
+    // temporary data fields for subdivision
+    Integer_vector tmp1_coeff_, tmp2_coeff_;
+    Integer splitpoint_num_;
+    long log_splitpoint_den_;
+
+public:
+    Bitstream_descartes_E08_tree_rep() : degree_(-1) { }
+
+    template <class InputIterator>
+    Bitstream_descartes_E08_tree_rep(
+            long log_radius,
+            InputIterator first, InputIterator beyond, Monomial_basis_tag,
+            const TRAITS& traits
+    ) : b_from_p_(first, beyond, log_radius, traits),
+        log_radius_(log_radius),
+        subdiv_tries_(0), subdiv_fails_(0),
+        bisect_tries_(0), bisect_fails_(0),
+        splitpoint_num_(0), log_splitpoint_den_(0)
+    {
+        degree_ = b_from_p_.degree();
+        CGAL_precondition(degree_ >= 0);
+        ceil_log_degree_ = (degree_ > 0) ? Ceil_log2_abs_long()(degree_) : -1;
+        node_list_.push_front(
+                Node(degree_, Integer(-1), Integer(1), -log_radius)
+        );
+        payload_prec_ = 6 * degree_ + 20;
+        tmp1_coeff_.resize(degree_ + 1);
+        tmp2_coeff_.resize(degree_ + 1);
+    }
+}; // class Bitstream_descartes_E08_tree_rep
+
+/*
+ * class Bitstream_descartes_E08_tree
+ */
+
+/*! \ingroup CGAL_Bitstream_descartes_tree
+ *  \brief Subdivision tree of the BitstreamDescartes method (E08 variant)
+ */
+template <class BitstreamDescartesE08TreeTraits>
+class Bitstream_descartes_E08_tree
+    : public
+        ::CGAL::Handle_with_policy<
+                 internal::Bitstream_descartes_E08_tree_rep<
+                         BitstreamDescartesE08TreeTraits
+                 >
+         >
+{
+public:
+    typedef Bitstream_descartes_E08_tree Self;
+    CGAL_BITSTREAM_DESCARTES_E08_TREE_TYPEDEFS;
+    typedef internal::Bitstream_descartes_E08_tree_rep<TRAITS> Rep;
+    typedef ::CGAL::Handle_with_policy<Rep> Base;
+
+    //! node iterator.
+    typedef typename Node_list::iterator       Node_iterator;
+    //! node iterator (for STL compatibility only).
+    typedef typename Node_list::iterator       iterator;
+    //! const node iterator.
+    typedef typename Node_list::const_iterator Node_const_iterator;
+    //! const node iterator (for STL compatibility only).
+    typedef typename Node_list::const_iterator const_iterator;
+
+    //! tag type to distinguish a certain constructor.
+    typedef typename Rep::Monomial_basis_tag Monomial_basis_tag;
+
+public:
+    //! default constructor (makes <tt>degree() == -1</tt>)
+    Bitstream_descartes_E08_tree() : Base(Rep()) { }
+
+    //! copy constructor
+    Bitstream_descartes_E08_tree(const Self& p)
+        : Base(static_cast<const Base&>(p))
+    { }
+
+    /*! \brief construct from initial interval and coefficients
+     *
+     *  The initial interval is
+     *  [\c lower_num, \c upper_num] / 2^(\c log_bdry_den ).
+     *
+     *  The iterator range [\c first, \c beyond ) gives the
+     *  coefficients of 1, <i>x</i>, <i>x</i><sup>2</sup>, ...
+     *  The leading coefficient (last in sequence) must be non-zero.
+     *
+     *  The \c Monomial_basis_tag is required for the benefit of
+     *  future extensions to coefficients w.r.t. other bases.
+     */
+    template <class InputIterator>
+    Bitstream_descartes_E08_tree(
+            long log_radius,
+            InputIterator first, InputIterator beyond, Monomial_basis_tag tag,
+            const BitstreamDescartesE08TreeTraits& traits
+                                        = BitstreamDescartesE08TreeTraits()
+    ) : Base(Rep(log_radius, first, beyond, tag, traits))
+    {
+        Node_iterator n = this->ptr()->node_list_.begin();
+        if (this->ptr()->degree_ > 0) {
+            bool init_ok = reinit_from_prec(n);
+            CGAL_assertion(init_ok); (void)init_ok;
+            if (n->min_var_ == 0) this->ptr()->node_list_.erase(n);
+        } else {
+            this->ptr()->node_list_.erase(n);
+        }
+    }
+
+    //! return degree of polynomial
+    int degree() const { return this->ptr()->degree_; }
+
+    //! iterator to first node
+    Node_iterator begin() {
+        return this->ptr()->node_list_.begin();
+    }
+    //! iterator beyond last node
+    Node_iterator end() {
+        return this->ptr()->node_list_.end();
+    }
+    //! const iterator to first node
+    Node_const_iterator begin() const {
+        return this->ptr()->node_list_.begin();
+    }
+    //! const iterator beyond last node
+    Node_const_iterator end() const {
+        return this->ptr()->node_list_.end();
+    }
+
+    //! get lower bound of interval at node \c n.
+    Bound lower(Node_iterator n) const {
+        CGAL_assertion(is_iterator_valid(n));
+        return Bound_creator()(n->lower_num_, -n->log_bdry_den_);
+    }
+    //! get lower bound of interval at node \c n.
+    Bound lower(Node_const_iterator n) const {
+        CGAL_assertion(is_iterator_valid(n));
+        return Bound_creator()(n->lower_num_, -n->log_bdry_den_);
+    }
+    //! get upper bound of interval at node \c n.
+    Bound upper(Node_iterator n) const {
+        CGAL_assertion(is_iterator_valid(n));
+        return Bound_creator()(n->upper_num_, -n->log_bdry_den_);
+    }
+    //! get upper bound of interval at node \c n.
+    Bound upper(Node_const_iterator n) const {
+        CGAL_assertion(is_iterator_valid(n));
+        return Bound_creator()(n->upper_num_, -n->log_bdry_den_);
+    }
+
+    //! get boundaries: interval at node \c n is
+    //! [\c lower_num, \c upper_num] / 2^(\c log_bdry_den ).
+    void boundaries(Node_iterator n,
+            Integer& lower_num, Integer& upper_num, long& log_bdry_den
+    ) {
+        CGAL_assertion(is_iterator_valid(n));
+        lower_num    = n->lower_num_;
+        upper_num    = n->upper_num_;
+        log_bdry_den = n->log_bdry_den_;
+    }
+
+    //! get minimum number of sign variations in Descartes Test
+    //! for approximate polynomial at node \c n
+    int min_var(Node_const_iterator n) const {
+        CGAL_assertion(is_iterator_valid(n));
+        return n->min_var_;
+    }
+    //! get maximum number of sign variations in Descartes Test
+    //! for approximate polynomial at node \c n
+    int max_var(Node_const_iterator n) const {
+        CGAL_assertion(is_iterator_valid(n));
+        return n->max_var_;
+    }
+
+    /*! \brief subdivide interval at node \c n.
+     *
+     *  The node representing interval \c n is replaced in the list
+     *  of nodes by 0, 1, or 2 nodes that represent those among the
+     *  two subintervals that have \c min_var() greater than 0.
+     *  The number of new nodes is returned as result.
+     *  The subrange of nodes consisting of the new nodes is
+     *  returned in the arguments \c first and \c beyond
+     *
+     *  Subdividing a node invalidates all iterators to it;
+     *  both for the object where \c subdivide() was called
+     *  and all copies of it (since they share the same
+     *  representation and state).
+     *
+     *  The parameter \c n is passed by value.  Hence you can
+     *  implement depth-first search for isolating intervals like this:
+     *  \code
+     *    Node_iterator dummy, curr = tree.begin();
+     *    while (curr != tree.end()) {
+     *        if (tree.max_var(curr) == 1) ++curr;
+     *        else tree.subdivide(curr, curr, dummy);
+     *    }
+     *  \endcode
+     */
+    int subdivide(
+            Node_iterator n, Node_iterator& first, Node_iterator& beyond
+    );
+
+    /*! \brief erase node \c n.
+     *
+     *  Erasing a node invalidates all iterators to it;
+     *  both for the object where \c subdivide() was called
+     *  and all copies of it (since they share the same
+     *  representation and state).
+     */
+    void erase(Node_iterator n) {
+        CGAL_assertion(is_iterator_valid(n));
+        this->ptr()->node_list_.erase(n);
+    }
+
+    /*! \brief Replace traits class
+     */
+    void set_traits(TRAITS& traits) {
+        this->ptr()->b_from_p_.set_traits(traits);
+    }
+
+    /*! \brief Returns a copy of this with its own representation
+     */
+    Self make_unique() const {
+      Self tmp = *this;
+      tmp.copy_on_write();
+      return tmp;
+    }
+
+protected:
+    int subdivide_at_midpoint(
+            Node_iterator n, Node_iterator& first, Node_iterator& beyond
+    );
+
+    int subdivide_at(
+            Node_iterator n, Node_iterator& first, Node_iterator& beyond,
+            long alpha_num, int log_alpha_den
+    );
+
+    bool is_iterator_valid(Node_const_iterator n) const {
+        Node_const_iterator it  = this->ptr()->node_list_.begin();
+        Node_const_iterator end = this->ptr()->node_list_.end();
+        while (it != end) {
+            if (it == n) return true;
+            ++it;
+        }
+        return false;
+    }
+
+private:
+    int replace_by_tmp(
+            Node_iterator n, Node_iterator& first, Node_iterator& beyond
+    );
+
+    static const long log_subdepth_bound_init_ = 6;
+
+    bool reinit_from_prec(Node_iterator n);
+    void global_prec_increase(Node_iterator n);
+
+}; // class Bitstream_descartes_E08_tree
+
+template <class BitstreamDescartesE08TreeTraits>
+const long
+Bitstream_descartes_E08_tree<BitstreamDescartesE08TreeTraits>
+::log_subdepth_bound_init_;
+
+
+
+/*
+ * Non-inline member functions of class Bitstream_descartes_E08_tree
+ */
+
+template <class BitstreamDescartesE08TreeTraits>
+bool
+Bitstream_descartes_E08_tree<BitstreamDescartesE08TreeTraits>
+::reinit_from_prec(Node_iterator n) {
+
+    n->subdepth_bound_   = 1L << log_subdepth_bound_init_;
+    n->subdepth_current_ = 0;
+    n->log_eps_ = this->ptr()->ceil_log_degree_
+                + log_subdepth_bound_init_
+                + 1;
+    n->log_C_eps_ = n->log_eps_ + 4*this->degree();
+
+    this->ptr()->b_from_p_(
+            this->ptr()->tmp1_coeff_.begin(),
+            this->ptr()->payload_prec_ + 1
+    );
+    for (int i = 0; i <= degree(); ++i) { // TODO avoid preceding rshift
+        this->ptr()->tmp1_coeff_[i] <<= (n->log_eps_ - 1);
+    }
+
+    Integer alpha_num =
+        (Integer(1) << (n->log_bdry_den_ + this->ptr()->log_radius_))
+        -  n->lower_num_;
+    long log_alpha_den = n->log_bdry_den_ + this->ptr()->log_radius_ + 1;
+    if (alpha_num != Integer(1) << log_alpha_den) {
+        de_casteljau_generic(
+            this->ptr()->tmp1_coeff_.begin(), this->ptr()->tmp1_coeff_.end(),
+            this->ptr()->tmp2_coeff_.begin(), this->ptr()->tmp1_coeff_.begin(),
+            Convex_combinator_approx_Integer_log<Integer>(
+                    alpha_num, log_alpha_den
+            )
+        );
+        ++(n->subdepth_current_);
+    }
+    alpha_num =
+        (Integer(1) << (n->log_bdry_den_ + this->ptr()->log_radius_))
+        -  n->upper_num_;
+    if (alpha_num != Integer(0)) {
+        Integer alpha_den =
+            (Integer(1) << (n->log_bdry_den_ + this->ptr()->log_radius_))
+            - n->lower_num_;
+        de_casteljau_generic(
+            this->ptr()->tmp1_coeff_.begin(), this->ptr()->tmp1_coeff_.end(),
+            n->coeff_.begin(), this->ptr()->tmp1_coeff_.begin(),
+            Convex_combinator_approx_fraction<Integer>(alpha_num, alpha_den)
+        );
+        ++(n->subdepth_current_);
+    } else {
+        n->coeff_.swap(this->ptr()->tmp1_coeff_);
+    }
+
+    if (Abs_le_pow2()(n->coeff_[degree()], n->log_C_eps_)
+            || Abs_le_pow2()(n->coeff_[0], n->log_C_eps_)
+    ) {
+        return false;
+    } else {
+        internal::var_eps(n->coeff_.begin(), n->coeff_.end(),
+                n->min_var_, n->max_var_, Sign_eps_log2(n->log_eps_)
+        );
+        return true;
+    }
+} // Bitstream_descartes_E08_tree::reinit_from_sep()
+
+template <class BitstreamDescartesE08TreeTraits>
+int
+Bitstream_descartes_E08_tree<BitstreamDescartesE08TreeTraits>
+::subdivide_at_midpoint(
+        Node_iterator n, Node_iterator& first, Node_iterator& beyond
+) {
+    de_casteljau_generic(n->coeff_.begin(), n->coeff_.end(),
+            this->ptr()->tmp1_coeff_.begin(), this->ptr()->tmp2_coeff_.begin(),
+            CGAL::internal::Convex_combinator_approx_midpoint<Integer>()
+    );
+    this->ptr()->splitpoint_num_     = n->lower_num_ + n->upper_num_;
+    this->ptr()->log_splitpoint_den_ = n->log_bdry_den_ + 1;
+
+    if (Abs_le_pow2()(this->ptr()->tmp2_coeff_[0], n->log_C_eps_)) {
+        return -1;
+    } else {
+        return replace_by_tmp(n, first, beyond);
+    }
+} // Bitstream_descartes_E08_tree::subdivide_at()
+
+template <class BitstreamDescartesE08TreeTraits>
+int
+Bitstream_descartes_E08_tree<BitstreamDescartesE08TreeTraits>
+::subdivide_at(
+        Node_iterator n, Node_iterator& first, Node_iterator& beyond,
+        long alpha_num, int log_alpha_den
+) {
+    de_casteljau_generic(n->coeff_.begin(), n->coeff_.end(),
+        this->ptr()->tmp1_coeff_.begin(), this->ptr()->tmp2_coeff_.begin(),
+        CGAL::internal::Convex_combinator_approx_long_log<Integer>
+            (alpha_num, log_alpha_den)
+    );
+    this->ptr()->splitpoint_num_ =
+        alpha_num * n->lower_num_
+            + ((1L << log_alpha_den) - alpha_num) * n->upper_num_;
+    this->ptr()->log_splitpoint_den_ = n->log_bdry_den_ + log_alpha_den;
+
+    if (Abs_le_pow2()(this->ptr()->tmp2_coeff_[0], n->log_C_eps_)) {
+        return -1;
+    } else {
+        return replace_by_tmp(n, first, beyond);
+    }
+} // Bitstream_descartes_E08_tree::subdivide_at()
+
+
+template <class BitstreamDescartesE08TreeTraits>
+int
+Bitstream_descartes_E08_tree<BitstreamDescartesE08TreeTraits>
+::replace_by_tmp(
+        Node_iterator n, Node_iterator& first, Node_iterator& beyond
+) {
+
+    ++(n->subdepth_current_);
+
+    long delta_log_bdry_den =
+        this->ptr()->log_splitpoint_den_ - n->log_bdry_den_;
+    CGAL_assertion(delta_log_bdry_den >= 0);
+
+    int l_min_var, l_max_var, r_min_var, r_max_var;
+    internal::var_eps(this->ptr()->tmp1_coeff_.begin(),
+                                     this->ptr()->tmp1_coeff_.end(),
+                                     l_min_var, l_max_var, 
+                                     Sign_eps_log2(n->log_eps_)
+    );
+    internal::var_eps(this->ptr()->tmp2_coeff_.begin(),
+            this->ptr()->tmp2_coeff_.end(),
+            r_min_var, r_max_var, Sign_eps_log2(n->log_eps_)
+    );
+    CGAL_assertion(0 <= l_min_var && l_min_var <= l_max_var);
+    CGAL_assertion(0 <= r_min_var && r_min_var <= r_max_var);
+
+    beyond = first = n;
+    ++beyond;
+
+    if (l_min_var > 0) {
+        int children = 1;
+        if (r_min_var > 0) {
+            // create new node for right child
+            Node_iterator r = 
+                this->ptr()->node_list_.insert(beyond, Node(degree(),
+                            this->ptr()->splitpoint_num_,        // lower
+                            n->upper_num_ << delta_log_bdry_den, // upper
+                            this->ptr()->log_splitpoint_den_,
+                            r_min_var, r_max_var
+                ));
+            r->coeff_.swap(this->ptr()->tmp2_coeff_);
+            r->copy_state_from(*n);
+            ++children;
+        }
+        // put left child into n
+        n->lower_num_  <<= delta_log_bdry_den;
+        n->upper_num_    = this->ptr()->splitpoint_num_;
+        n->log_bdry_den_ = this->ptr()->log_splitpoint_den_;
+        n->min_var_      = l_min_var;
+        n->max_var_      = l_max_var;
+        n->coeff_.swap(this->ptr()->tmp1_coeff_);
+        return children;
+    } else if (r_min_var > 0) {
+        // put right child into n
+        n->lower_num_    = this->ptr()->splitpoint_num_;
+        n->upper_num_  <<= delta_log_bdry_den;
+        n->log_bdry_den_ = this->ptr()->log_splitpoint_den_;
+        n->min_var_      = r_min_var;
+        n->max_var_      = r_max_var;
+        n->coeff_.swap(this->ptr()->tmp2_coeff_);
+        return 1;
+    } else /* l_min_var == 0 && r_min_var == 0 */ {
+        // delete n
+        first = beyond;
+        this->ptr()->node_list_.erase(n);
+        return 0;
+    }
+} // Bitstream_descartes_E08_tree::replace_by_tmp()
+
+template <class BitstreamDescartesE08TreeTraits>
+int
+Bitstream_descartes_E08_tree<BitstreamDescartesE08TreeTraits>
+::subdivide(
+        Node_iterator n, Node_iterator& first, Node_iterator& beyond
+) {
+    long alpha_num;
+    int  log_alpha_den;
+    long alpha_den_4;
+    int  ret;
+
+    CGAL_assertion(is_iterator_valid(n));
+
+    // check for delayed update
+    if (n->coeff_update_delayed_) {
+        reinit_from_prec(n);
+        n->coeff_update_delayed_ = false;
+    }
+
+    // apply Zeno trap
+    if (n->subdepth_current_ == n->subdepth_bound_) {
+        for (int i = 0; i <= degree(); ++i)  n->coeff_[i] <<= 2;
+        // n->working_prec_ += 2;
+        n->log_eps_ += 2;
+        n->log_C_eps_ += 2;
+        n->subdepth_bound_ <<= 1;
+        n->subdepth_current_ = 0;
+    }
+
+    for (;;) {
+        if (true) { // used to be recdepth > 0
+            // first try heuristic alpha = 1/2 (failures don't count)
+            ++(this->ptr()->bisect_tries_);
+            ret = subdivide_at_midpoint(n, first, beyond);
+            if (ret >= 0) { return ret; } else { ++(this->ptr()->bisect_fails_); }
+
+            // next try heuristic alpha with small denom (failures don't count)
+            log_alpha_den = 4;
+            alpha_den_4 = 1L << (log_alpha_den - 2);
+            alpha_num = CGAL::get_default_random().get_int(  // TODO .get_long
+                    alpha_den_4, 3*alpha_den_4 + 1
+            );
+            ++(this->ptr()->subdiv_tries_);
+            ret = subdivide_at(n, first, beyond, alpha_num, log_alpha_den);
+            if (ret >= 0) { return ret; } else { --(this->ptr()->subdiv_tries_); }
+
+            // now try alpha properly randomized, counting failure rate
+            log_alpha_den = 4 + this->ptr()->ceil_log_degree_;
+            alpha_den_4 = 1L << (log_alpha_den - 2);
+            do {
+                alpha_num = CGAL::get_default_random().get_int(  // TODO .get_long
+                        alpha_den_4, 3*alpha_den_4 + 1
+                );
+                ++(this->ptr()->subdiv_tries_);
+                ret = subdivide_at(n, first, beyond, alpha_num, log_alpha_den);
+                if (ret >= 0) {
+                    return ret;
+                } else {
+                    ++(this->ptr()->subdiv_fails_);
+                }
+            } while (
+(this->ptr()->subdiv_fails_ < 2 || 2 * this->ptr()->subdiv_fails_ < this->ptr()->subdiv_tries_)
+&& (this->ptr()->bisect_fails_ < degree())
+            );
+        } // if (true) // used to be recdepth > 0
+
+        // if failure rate too high, decrease guess of prec and restart
+        global_prec_increase(n);
+        // TODO what if now  n->max_var_ == 1  ??
+    } // for (;;)
+} // Bitstream_descartes_E08_tree::subdivide()
+
+template <class BitstreamDescartesE08TreeTraits>
+void
+Bitstream_descartes_E08_tree<BitstreamDescartesE08TreeTraits>
+::global_prec_increase(Node_iterator n)
+{
+    this->ptr()->payload_prec_ *= 2;
+
+    this->ptr()->subdiv_tries_ = this->ptr()->subdiv_fails_ = 0;
+    this->ptr()->bisect_tries_ = this->ptr()->bisect_fails_ = 0;
+
+    Node_iterator it  = this->ptr()->node_list_.begin();
+    Node_iterator end = this->ptr()->node_list_.end();
+    while (it != end) {
+        if (it != n && it->min_var_ == it->max_var_) {
+            it->coeff_update_delayed_ = true;
+        } else {
+            bool reinit_ok = reinit_from_prec(it);
+            CGAL_assertion(reinit_ok); (void)reinit_ok;
+            it->coeff_update_delayed_ = false;
+        }
+        ++it;
+    }
+} // Bitstream_descartes_E08_tree::global_prec_increase()
+
+} // namespace internal
+
+} //namespace CGAL
+
+#endif // CGAL_BITSTREAM_DESCARTES_E08_TREE_H
+
+// EOF
diff --git a/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_rndl_tree.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_rndl_tree.h
new file mode 100644
index 0000000..5181c5c
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_rndl_tree.h
@@ -0,0 +1,1572 @@
+// Copyright (c) 2006-2009 Max-Planck-Institute Saarbruecken (Germany).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Arno Eigenwillig <arno at mpi-inf.mpg.de>
+//
+// ============================================================================
+
+// TODO: The comments are all original EXACUS comments and aren't adapted. So
+//         they may be wrong now.
+
+/*! \file NiX/Bitstream_descartes_rndl_tree.h
+    \brief Definition of \c NiX::Bitstream_descartes_rndl_tree.
+*/
+
+#ifndef CGAL_ALGEBRAIC_KERNEL_D_BITSTREAM_DESCARTES_RNDL_TREE_H
+#define CGAL_ALGEBRAIC_KERNEL_D_BITSTREAM_DESCARTES_RNDL_TREE_H
+
+#include <vector>
+#include <list>
+#include <utility>
+#include <iterator>
+#include <algorithm>
+
+#include <CGAL/basic.h>
+#include <CGAL/Random.h>
+
+#include <CGAL/Algebraic_kernel_d/Real_embeddable_extension.h>
+/*#include <CGAL/Handle.h>
+#include <CGAL/Random.h>*/
+
+/*
+ *  AUXILIARY CLASSES AND FUNCTIONS
+ */
+
+namespace CGAL {
+
+namespace internal {
+
+// TODO: Copied from CGAL/enums.h:
+enum Three_valued_estimate {
+    CLEARLY_NEGATIVE         = -1, //!< = -1. Sign of a value is clearly
+                                   //!<       negative.
+    UNCLEAR_SIGN             =  0, //!< =  0. It is unclear whether value
+                                   //!<       has negative, zero, or positive
+                                   //!<       sign.
+    CLEARLY_POSITIVE         =  1, //!< = +1. Sign of a value is clearly
+                                   //!<       positive.
+
+    CLEARLY_LESS             = -1, //!< = -1. First value is clearly less
+                                   //!<       than second value.
+    UNCLEAR_COMPARISON       =  0, //!< =  0. It is unclear whether first value
+                                   //!<       is less than, equal to, or
+                                   //!<       greater than second value.
+    CLEARLY_GREATER          =  1, //!< = +1. First value is clearly greater
+                                   //!<       than second value.
+
+    CLEARLY_CLOCKWISE        = -1, //!< = -1. Points in the plane or space are
+                                   //!<       clearly oriented clockwise.
+    CLEAR_RIGHT_TURN         = -1, //!< = -1. Points in the plane or space
+                                   //!<       clearly form a right turn.
+    UNCLEAR_ORIENTATION      =  0, //!< =  0. It is not clear whether points in
+                                   //!<       the plane or space are oriented
+                                   //!<       clockwise, counterclockwise, or
+                                   //!<       are in degenerate position.
+
+    UNCLEAR_TURN             =  0, //!< =  0. It is not clear whether points in
+                                   //!<       the plane or space form a left
+                                   //!<       turn, a right turn, or are in
+                                   //!<       degenerate position.
+    CLEAR_LEFT_TURN          =  1, //!< = +1. Points in the plane or space
+                                   //!<       clearly form a left turn.
+    CLEARLY_COUNTERCLOCKWISE =  1, //!< = +1. Points in the plane or space are
+                                   //!<       clearly oriented
+                                   //!<       counterclockwise.
+
+    CLEARLY_ON_NEGATIVE_SIDE  = -1, //!< = -1. Point is clearly on the negative
+                                    //!<       side of an oriented surface.
+    ON_UNCLEAR_ORIENTED_SIDE  =  0, //!< =  0. It is unclear whether point is
+                                    //!<       outside, on, or inside an
+                                    //!<       oriented surface.
+    CLEARLY_ON_POSITIVE_SIDE  =  1, //!< = +1. Point is clearly on the positive
+                                    //!<       side of an oriented surface.
+
+    CLEARLY_ON_UNBOUNDED_SIDE = -1, //!< = -1. Point is clearly in the
+                                    //!<       exterior of a closed surface.
+    ON_UNCLEAR_SIDE           =  0, //!< =  0. It is unclear whether point is
+                                    //!<       outside, on, or inside a closed
+                                    //!<       surface.
+    CLEARLY_ON_BOUNDED_SIDE   =  1  //!< =  1. Point is clearly in the
+                                    //!<       interior of a closed surface.
+};
+
+//! reverses the \a sign (from plus to minus and minus to plus ;-)
+inline Three_valued_estimate operator- ( Three_valued_estimate sign ) {
+    return Three_valued_estimate( - int( sign));
+}
+
+
+// END: Copied from CGAL/enums.h
+
+/*
+ * Helper functions
+ */
+
+// compute g(x) = 2^p f((ax+b)/c) for c = 2^log_c with absolute error <= 1
+template <class Integer, class RandomAccessIterator, class OutputIterator,
+class Approximator, class CeilLog2AbsInteger, class CeilLog2AbsLong>
+OutputIterator
+polynomial_affine_transform_approx_log_denom(
+        RandomAccessIterator first, RandomAccessIterator beyond,
+        OutputIterator out,
+        Integer a, Integer b, long log_c,
+        long p,
+        Approximator approx,
+        CeilLog2AbsInteger log, CeilLog2AbsLong logl
+) {
+    // degree of input polynomial
+    const int n = int((beyond-first)-1);
+    CGAL_precondition(n >= 0);
+
+    // u[i][j] = \binom{i}{j} a^j b^{i-j}  (0 <= i <= n; 0 <= j <= i)
+    long max_log_u; // = \max_{i,j} \log\abs{u[i][j]}
+    std::vector< std::vector< Integer > > u(n+1);
+    u[0].push_back(Integer(1));
+    max_log_u = 0; // = log(1)
+    for (int i = 1; i <= n; ++i) {
+        u[i].reserve(i+1);
+        u[i].push_back(b*u[i-1][0]);
+        if (u[i][0] != 0) max_log_u = (std::max)(max_log_u, log(u[i][0]));
+        for (int j = 1; j <= i-1; ++j) {
+            u[i].push_back(a*u[i-1][j-1] + b*u[i-1][j]);
+            if (u[i][j] != 0) max_log_u = (std::max)(max_log_u, log(u[i][j]));
+        }
+        u[i].push_back(a*u[i-1][i-1]);
+        if (u[i][i] != 0) max_log_u = (std::max)(max_log_u, log(u[i][i]));
+    }
+
+    long q = logl(n+1) + max_log_u + 1;
+    Integer half = Integer(1) << q-1;
+    std::vector< Integer > h(n+1);
+    RandomAccessIterator it = first;
+    for (int i = 0; i <= n; ++i, ++it) {
+        h[i] = approx(*it, -i*log_c + p + q);
+    }
+    Integer sum;
+    for (int j = 0; j <= n; ++j) {
+        sum = 0;
+        for (int i = j; i <= n; ++i) {
+            sum += u[i][j]*h[i];
+        }
+        sum += half; sum >>= q;  // round to nearest
+        *out++ = sum;
+    }
+    return out;
+} // polynomial_affine_transform_approx_log_denom()
+
+
+template <class Integer>
+Integer caching_factorial(int n) {
+    CGAL_precondition(n >= 0);
+
+    // table of factorials; augment if necessary
+    static std::vector< Integer > factorial;
+    factorial.reserve(n+1);
+    if (factorial.empty()) {
+        factorial.push_back(Integer(1)); // 0! = 1
+        factorial.push_back(Integer(1)); // 1! = 1
+    }
+    for (int i = int(factorial.size()); i <= n; ++i) {
+        factorial.push_back(i*factorial[i-1]);
+    }
+
+    return factorial[n];
+}
+
+
+// Bernst coeff of 2^p n! f(x) wrt [lwr_num,upr_num]/2^log_den w/ abs err <= 1
+template <class Integer,
+    class RandomAccessIterator, class OutputIterator,
+    class Approximator, class CeilLog2AbsInteger, class CeilLog2AbsLong
+>
+OutputIterator
+polynomial_power_to_bernstein_approx(
+        RandomAccessIterator first, RandomAccessIterator beyond,
+        OutputIterator out,
+        Integer lower_num, Integer upper_num, long log_denom,
+        long p,
+        Approximator approx, CeilLog2AbsInteger log, CeilLog2AbsLong logl
+) {
+    // degree of input polynomial
+    const int n = int((beyond-first)-1);
+    CGAL_precondition(n >= 0);
+
+    long q = log(caching_factorial<Integer>(n)) + logl(n+1) + 1;
+    Integer half = Integer(1) << q-1;
+    std::vector<Integer> f(n+1);
+    polynomial_affine_transform_approx_log_denom(
+            first, beyond, f.begin(),
+            upper_num - lower_num, lower_num, log_denom,
+            p+q,
+            approx, log, logl
+    );
+    Integer sum, lprod;
+    for (int l = 0; l <= n; ++l) {
+        sum = 0;
+        lprod = 1; // = l*(l-1)*(l-2)*...*(l-(k-1))
+        for (int k = 0; k <= l; ++k) {
+            sum += lprod * caching_factorial<Integer>(n-k) * f[k];
+            lprod *= l-k;
+        }
+        sum += half; sum >>= q;  // round to nearest
+        *out++ = sum;
+    }
+    return out;
+} // polynomial_power_to_bernstein_approx()
+
+
+// min/max number of variations in epsilon-sign
+template <class InputIterator, class UnaryFunction>
+void var_eps( 
+        InputIterator first, InputIterator beyond,
+        int& min_var, int& max_var,
+        const UnaryFunction& sign_eps
+) {
+    min_var = max_var = 0;
+    InputIterator it = first;
+    CGAL_precondition(it != beyond);
+
+    internal::Three_valued_estimate last_sign_min, last_sign_max; // always non-zero
+    last_sign_min = last_sign_max = sign_eps(*it);
+    CGAL_assertion(last_sign_min != internal::UNCLEAR_SIGN);
+
+    while (++it != beyond) {
+        internal::Three_valued_estimate cur_sign = sign_eps(*it);
+        if (cur_sign == internal::UNCLEAR_SIGN) {
+            last_sign_max = -last_sign_max;
+            ++max_var;
+        } else {
+            if (last_sign_max != cur_sign) ++max_var;
+            if (last_sign_min != cur_sign) ++min_var;
+            last_sign_min = last_sign_max = cur_sign;
+        }
+    }
+} // var_eps()
+
+/*
+ * The generic de Casteljau method
+ */
+
+template <class NT_>
+class Convex_combinator_generic {
+public:
+    typedef NT_ NT;
+private:
+    NT alpha_, beta_;
+public:
+    Convex_combinator_generic(NT alpha) : alpha_(alpha), beta_(NT(1)-alpha) { }
+    void into_first (NT& a, const NT& b) const { a *= alpha_; a +=  beta_*b; }
+    void into_second(const NT& a, NT& b) const { b *=  beta_; b += alpha_*a; }
+    void into_third (const NT& a, const NT& b, NT& c) const {
+        c = a; c *= alpha_; c += beta_*b; // c might alias a but not b
+    }
+};
+
+template <class NT_>
+class Convex_combinator_approx_long_log {
+public:
+    typedef NT_ NT;
+
+private:
+    long alpha_num_, beta_num_, half_;
+    int log_denom_;
+
+public:
+    Convex_combinator_approx_long_log(
+            long alpha_num = 1, int log_denom = 1
+    ) : alpha_num_(alpha_num),
+        beta_num_((1L<<log_denom) - alpha_num),
+        half_((log_denom > 0) ? (1L << (log_denom-1)) : 0),
+        log_denom_(log_denom)
+    {
+        CGAL_precondition(log_denom_ >= 0);
+    }
+    void into_first(NT& a, const NT& b) const {
+        a *= alpha_num_; a += beta_num_*b;
+        a += half_; a >>= log_denom_;  // round to nearest
+    }
+    void into_second(const NT& a, NT& b) const {
+        b *= beta_num_; b += alpha_num_*a;
+        b += half_; b >>= log_denom_;  // round to nearest
+    }
+    void into_third(const NT& a, const NT& b, NT& c) const {
+        c = a; c *= alpha_num_; c += beta_num_*b; // c might alias a but not b
+        c += half_; c >>= log_denom_;  // round to nearest
+    }
+};
+
+template <class NT_>
+class Convex_combinator_approx_midpoint {
+public:
+    typedef NT_ NT;
+
+public:
+    void into_first(NT& a, const NT& b) const {
+        a += b;
+        a += 1; a >>= 1;  // round to nearest
+    }
+    void into_second(const NT& a, NT& b) const {
+        b += a;
+        b += 1; b >>= 1;  // round to nearest
+    }
+    void into_third(const NT& a, const NT& b, NT& c) const {
+        c = a; c += b;  // c might alias a but not b
+        c += 1; c >>= 1;  // round to nearest
+    }
+};
+
+template <class ForwardIterator1, class ForwardIterator2,
+    class ForwardIterator3, class Combinator
+>
+std::pair<ForwardIterator2, ForwardIterator3>
+de_casteljau_generic(
+        ForwardIterator1 first, ForwardIterator1 beyond,
+        ForwardIterator2 left, ForwardIterator3 right,
+        const Combinator& combine
+) {
+    // left may not alias any of the other two
+    CGAL_assertion((void*)(&(*left)) != (void*)(&(*first)));
+    CGAL_assertion((void*)(&(*left)) != (void*)(&(*right)));
+
+    /* In the sequel, we think of de Casteljau's algorithm as
+     * filling out a triangular array of numbers:
+     *
+     *     * * * .. *   row 0
+     *      * * .. *    row 1
+     *       .   .       .
+     *        . .        .
+     *         *
+     *
+     * The inputs [first, beyond) form row 0 (at the top).
+     * Row 1 (below row 0) consists of combinations of any two
+     * adjacent elements from row 0.
+     * Inductively, row i+1 consists of combinations of any two
+     * adjacent elements from row i, until we arrive at a row
+     * of length 1.
+     *
+     * We output through iterator left the values appearing
+     * on the triangle's left side.
+     *
+     * We use the container pointed to by iterator right as
+     * storage for the rows (one after the other).
+     * Since each row is one element shorter than the preceding
+     * one, towards the end of this container the values appearing
+     * on the triangle's right accumulate. When we terminate,
+     * the container pointed to by iterator right contains
+     * the triangle's right side, from bottom to top.
+     */
+
+    *left = *first; ++left; // output leftmost element of row 0
+
+    // to compute row 1, we iterate over pairs (*iit1, *iit2)
+    // of adjacent elements of row 0 and combine them into *rit1
+    ForwardIterator1 iit1 = first, iit2 = first; ++iit2; // source
+    ForwardIterator3 rit1 = right;                       // target
+    for (;;) {
+        combine.into_third(*iit1, *iit2, *rit1);
+        ++iit1; ++iit2;
+        if (iit2 == beyond) break;
+        ++rit1;
+    }
+    ForwardIterator3 right_end = rit1;   // point to rightmost element of row 1
+    *++rit1 = *iit1;                     // output rightmost element of row 0
+    ForwardIterator3 right_beyond = ++rit1; // past-the-end
+    *left = *right; ++left;              // output leftmost element of row 1
+
+    // compute rows 2 and later in the same style
+    // invariant: right_end is the rightmost element of the previous row
+    ForwardIterator3 rit2;
+    while (right != right_end) { // prev row was longer than 1 element
+        rit1 = rit2 = right; ++rit2;
+        combine.into_first(*rit1, *rit2);
+        *left = *rit1; ++left;           // output leftmost element
+        while (rit2 != right_end) {
+            ++rit1; ++rit2;
+            combine.into_first(*rit1, *rit2);
+        } 
+        right_end = rit1;
+    }
+
+    return std::make_pair(left, right_beyond);
+} // de_casteljau_generic()
+
+
+
+/*
+ * Helper functors
+ */
+
+template <class CeilLog2Abs>
+class Abs_le_pow2 {
+public:
+    typedef CeilLog2Abs Ceil_log2_abs;
+    typedef bool result_type;
+    typedef typename Ceil_log2_abs::argument_type first_argument_type;
+    typedef typename Ceil_log2_abs::result_type   second_argument_type;
+    result_type operator() (first_argument_type x, second_argument_type p) {
+        return x == 0 || Ceil_log2_abs()(x) <= p;
+    }
+};
+
+template <class Integer_, class AbsLePow2, class Sign_>
+class Sign_eps_log2 {
+private:
+    long log_eps_;
+
+public:
+    typedef Integer_ Integer;
+    typedef AbsLePow2 Abs_le_pow2;
+    typedef Sign_ Sign;
+    typedef internal::Three_valued_estimate result_type;
+    typedef Integer argument_type;
+
+    Sign_eps_log2(long log_eps = 0) : log_eps_(log_eps) { }
+    long log_eps() const { return log_eps_; }
+    void set_log_eps(long log_eps) { log_eps_ = log_eps; }
+
+    result_type operator() (argument_type x) const {
+        if (Abs_le_pow2()(x, log_eps_)) {
+            return internal::UNCLEAR_SIGN;
+        } else {
+            return internal::Three_valued_estimate(Sign()(x));
+        }
+    }
+}; // class Sign_eps_log2
+
+} // namespace internal
+
+
+namespace internal {
+    template <class BitstreamDescartesRndlTreeTraits>
+    class Bitstream_descartes_rndl_tree;
+
+    template <class BitstreamDescartesRndlTreeTraits>
+    struct Bitstream_descartes_rndl_node;
+
+    template <class BitstreamDescartesRndlTreeTraits>
+    class Bitstream_descartes_rndl_tree_rep;
+} // namespace internal
+
+/* The template argument supplied as BitstreamDescartesRndlTreeTraits
+ * shall be a class containing the following types in its scope:
+ *   Coefficient:           caller-supplied coefficient type
+ *   Bound:              type for interval bound output (exact)
+ *   Integer:               integer type for actual calculations, needs >>, <<
+ *   Approximator:          functor to get Integer approx to x*2^p from coeff x
+ *   Lower_bound_log2_abs:  functor for lower bound to log|x| for coeff x
+ *   Bound_creator:      functor to create bound x*2^p from x and p
+ *   Sign:                  functor to get sign of Integer x
+ *   Ceil_log2_abs_Integer: functor to get smallest long >= log|x| for Integer
+ *   Ceil_log2_abs_long:    functor to get smallest long >= log|x| for long
+ */
+
+/*
+ * macros for common typedefs
+ */
+
+// bring types from traits into local scope
+#define CGAL_SNAP_BITSTREAM_DESCARTES_RNDL_TREE_TRAITS_TYPEDEFS(TRAITS) \
+  typedef typename TRAITS::Coefficient           Coefficient;           \
+  typedef typename TRAITS::Bound              Bound;                    \
+  typedef typename TRAITS::Integer               Integer;               \
+  typedef typename TRAITS::Approximator          Approximator;          \
+  typedef typename TRAITS::Lower_bound_log2_abs  Lower_bound_log2_abs;  \
+  typedef typename TRAITS::Bound_creator      Bound_creator;            \
+  typedef typename TRAITS::Sign                  Sign;                  \
+  typedef typename TRAITS::Ceil_log2_abs_Integer Ceil_log2_abs_Integer; \
+  typedef typename TRAITS::Ceil_log2_abs_long    Ceil_log2_abs_long     \
+
+// end #define
+
+// common typedefs for all Bitstream_descartes_rndl_* classes
+#define CGAL_BITSTREAM_DESCARTES_RNDL_TREE_COMMON_TYPEDEFS              \
+  typedef BitstreamDescartesRndlTreeTraits TRAITS;                      \
+  typedef TRAITS Bitstream_descartes_rndl_tree_traits;                  \
+  CGAL_SNAP_BITSTREAM_DESCARTES_RNDL_TREE_TRAITS_TYPEDEFS(TRAITS);      \
+  typedef std::vector<Coefficient> Coefficient_vector;                  \
+  typedef std::vector<Integer> Integer_vector;                          \
+  typedef internal::Abs_le_pow2<Ceil_log2_abs_Integer> Abs_le_pow2;     \
+  typedef internal::Sign_eps_log2<Integer, Abs_le_pow2, Sign>           \
+  Sign_eps_log2                                                         \
+  
+// end #define
+
+// typedefs for Bitstream_descartes_rndl_tree{,_rep}
+#define CGAL_BITSTREAM_DESCARTES_RNDL_TREE_TYPEDEFS                   \
+  CGAL_BITSTREAM_DESCARTES_RNDL_TREE_COMMON_TYPEDEFS;                 \
+  typedef internal::Bitstream_descartes_rndl_node<TRAITS> Node;       \
+  typedef std::list<Node> Node_list                                   \
+
+// end #define
+
+
+namespace internal {
+
+/*
+ * class Bitstream_descartes_rndl_node
+ */
+
+template <class BitstreamDescartesRndlTreeTraits>
+struct Bitstream_descartes_rndl_node {
+public:
+    typedef Bitstream_descartes_rndl_node Self;
+    CGAL_BITSTREAM_DESCARTES_RNDL_TREE_COMMON_TYPEDEFS;
+
+    friend class internal::Bitstream_descartes_rndl_tree<TRAITS>;
+    friend class internal::Bitstream_descartes_rndl_tree_rep<TRAITS>;
+
+private:
+    // "node data" (set individually in subdivision)
+    Integer lower_num_, upper_num_; // TODO use lower_num_, width_num_ instead
+    long log_bdry_den_;
+    Integer_vector coeff_; // wrt [lower_, upper_], approximate
+    int min_var_, max_var_;
+    // "state data" (copied en bloc by .copy_state_from())
+    long subdiv_tries_, subdiv_fails_;
+    long recdepth_;
+    long log_sep_, delta_log_sep_, log_eps_, log_C_eps_;
+
+    Bitstream_descartes_rndl_node(int degree = -1,
+            Integer lower_num = Integer(0), Integer upper_num = Integer(0),
+            long log_bdry_den = 0, int min_var = -1, int max_var = -1
+    ) : lower_num_(lower_num), upper_num_(upper_num),
+          log_bdry_den_(log_bdry_den),
+          coeff_(degree+1),
+          min_var_(min_var), max_var_(max_var),
+          subdiv_tries_(0), subdiv_fails_(0),
+          recdepth_(-1),
+          log_sep_(0), delta_log_sep_(0), log_eps_(0), log_C_eps_(0)
+    { }
+
+    void copy_state_from(const Self& n) {
+        subdiv_tries_  = n.subdiv_tries_;
+        subdiv_fails_  = n.subdiv_fails_;
+        recdepth_      = n.recdepth_;
+        log_sep_       = n.log_sep_;
+        delta_log_sep_ = n.delta_log_sep_;
+        log_eps_       = n.log_eps_;
+        log_C_eps_     = n.log_C_eps_;
+    }
+
+    // const Self& operator= (const Self&); // assignment is forbidden
+}; // struct Bitstream_descartes_rndl_node
+
+
+/*
+ * class Bitstream_descartes_rndl_tree_rep
+ */
+
+template <class BitstreamDescartesRndlTreeTraits>
+class Bitstream_descartes_rndl_tree_rep {
+public:
+    typedef Bitstream_descartes_rndl_tree_rep Self;
+    CGAL_BITSTREAM_DESCARTES_RNDL_TREE_TYPEDEFS;
+
+    class Monomial_basis_tag { };
+
+    friend class internal::Bitstream_descartes_rndl_tree<TRAITS>;
+
+private:
+    Coefficient_vector input_monomial_coeff_;
+    int degree_;
+    long ceil_log_degree_;
+    long lbd_log_lcoeff_;
+    Node_list node_list_;
+
+    // temporary data fields for subdivision
+    Integer_vector tmp1_coeff_, tmp2_coeff_;
+    Integer splitpoint_num_;
+    long log_splitpoint_den_;
+
+    // function objects
+    Approximator         approximator_;
+    Lower_bound_log2_abs lower_bound_log2_abs_;
+
+public:
+    Bitstream_descartes_rndl_tree_rep() : degree_(-1) { }
+
+    template <class InputIterator>
+    Bitstream_descartes_rndl_tree_rep(
+            Integer lower_num,  Integer upper_num, long log_bdry_den,
+            InputIterator first, InputIterator beyond, Monomial_basis_tag,
+            const TRAITS& traits
+    ) : input_monomial_coeff_(first, beyond),
+        splitpoint_num_(0), log_splitpoint_den_(0),
+        approximator_(traits.approximator_object()),
+        lower_bound_log2_abs_(traits.lower_bound_log2_abs_object())
+    {
+        degree_ = int(input_monomial_coeff_.size() - 1);
+        CGAL_precondition(degree_ >= 0);
+        ceil_log_degree_ = (degree_ > 0) ? Ceil_log2_abs_long()(degree_) : -1;
+        lbd_log_lcoeff_
+            = lower_bound_log2_abs_(input_monomial_coeff_[degree_]);
+        node_list_.push_front(
+                Node(degree_, lower_num, upper_num, log_bdry_den)
+        );
+        tmp1_coeff_.resize(degree_ + 1);
+        tmp2_coeff_.resize(degree_ + 1);
+    }
+}; // class Bitstream_descartes_rndl_tree_rep
+
+/*
+ * class Bitstream_descartes_rndl_tree
+ */
+
+/*! \ingroup NiX_Bitstream_descartes_tree
+    \brief Subdivision tree of the BitstreamDescartes method (rndl variant)
+
+    Before you try to understand this class fully, you might want
+    to have a look at the paper on the BitstreamDescartes method
+    mentioned \link NiX_Bitstream_descartes here \endlink.
+    The next paragraph gives a brief summary;
+    the description of this class follows after it.
+
+    <b>The BitstreamDescartes method</b>
+
+    The BitstreamDescartes method searches the real roots of
+    a polynomial in some initial interval by subdividing this
+    interval recursively into open subintervals.
+    Each subinterval is subjected to the Descartes Test,
+    which gives an integer that is an upper bound on the
+    number of real roots in the interval.
+    For efficiency, the BitstreamDescartes method does not compute
+    with the coefficients given by the caller, only approximations of them.
+    Therefore, the result of the Descartes Test may only be known
+    in the form of lower and upper bounds on the exact test,
+    called min_var and max_var.
+    However, the approximation quality of the input coefficients
+    and the choice of the subdivision points are automatically
+    controlled in a way that allows the following conclusions:
+     - If min_var 0 for some interval, this interval
+       does not contain any real root.
+     - If max_var is 1 for some interval, this interval
+       contains exactly one simple real root.
+     - If all real roots of the input polynomial are simple,
+       repeated subdivision will eventually produce intervals
+       that all have min_var equal to max_var equal to 0 or 1.
+
+    Hence we have an algorithm for isolating the real roots
+    of square-free polynomials.  We think of it as constructing
+    a binary tree:
+    Each subinterval considered by the algorithm is a node of the tree.
+    The children of a node are the two subintervals created by subdivision.
+    The root of the tree is the initial interval.
+    At each stage of the algorithm, the interesting nodes are
+    the leaves of the tree.  Subdivision of a leaf turns it
+    into an internal node whose children are leaves.
+
+    <b>Description of class</b>
+
+    This class lets you interactively explore the subdivision
+    tree of the BitstreamDescartes method (or more precisely,
+    its variant called "rndL" in the paper).
+    An object \c T of this class is constructed from an
+    initial interval and the polynomial.
+    The polynomial is read from an iterator range,
+    whose first element is the constant coefficient and whose
+    last element is the leading coefficient (which has to be
+    non-zero).
+
+    After construction, \c T represents the list of leaves
+    in the current subdivision tree.  (Initially, there is
+    only one leaf: the node representing the initial interval.)
+    You can iterate through this list in the style of an
+    \c std::list; that is, a \c Node_iterator is a
+    \c BidirectionalIterator.
+    At any time, the nodes are sorted in the order of the intervals
+    they stand for.
+
+    You cannot dereference an iterator into anything meaningful;
+    however, you can pass it to various member functions
+    that tell you the relevant data about the interval
+    represented by the node, e.g., \c lower() and \c upper()
+    bound and \c min_var() and \c max_var().
+
+    Most importantly, you can \c subdivide() a node.
+    Conceptually, this replaces the interval by two subintervals.
+    However, subintervals with \c min_var() equal to 0
+    are immediately discarded; so \c subdivide() may
+    actually replace one node by zero, one or two new nodes.
+    In fact, if \c min_var() is 0 already for the initial interval,
+    a newly constructed object \c T has an empty list of leaves.
+    (In particular, this happens if the polynomial supplied in
+    construction is constant.)
+
+    Unlike STL containers, this class is implemented using
+    \c CGAL::Handle.  That means, an object is just a ref-counted
+    pointer to the actual representation.  Thus, copying an
+    object is cheap.  However, all copies of an object alias
+    each other.  If you modify one, this changes the state
+    of all copies; including invalidation of iterators pointing
+    to destroyed nodes.
+
+    A \c Node_iterator remains valid until the node it points to
+    is destroyed by \c subdivide() or \c erase().  Destruction
+    of one node does not affect validity of iterators pointing
+    to other nodes.
+
+    <b>Example</b> (root isolation (square-free case))
+
+    Once you have constructed \c T, implementing the BitstreamDescartes
+    method by exploring \c T is a matter of a few lines:
+    \code
+    Node_iterator it = T.begin();
+    Node_iterator chld_first, chld_beyond;
+    while (it != T.end()) {
+        if (T.max_var(it) == 1) {
+            cout << "found [" << T.lower(it) << ", " << T.upper(it) << "]\n"; 
+            ++it;
+        } else {
+            T.subdivide(it, chld_first, chld_beyond);
+            it = chld_first;
+        }
+    }
+    \endcode
+
+    <b>Supplying a traits class</b>
+
+    This class is actually a class template.
+    To use it, you need to instanciate it with a traits class
+    that defines the following three types and the various
+    functors on them listed below.
+     - \c Coefficient: The type of coefficients supplied
+       during construction. Must be \c Assignable .
+     - \c Integer: A type for infinite-precision integer arithmetic
+       (such as \c leda::integer or \c CORE::BigInt ).
+       All internal computations are done using this type.
+       Must be a model of \c Ring and additionally provide
+       operators \c >> and \c << with the usual semantics.
+     - \c Bound:  \c lower() and \c upper() return
+       interval boundaries in this type.  Must be \c Assignable.
+       The canonical choice is \c NiX::Exact_float_number<Integer>.
+       If you never instanciate \c lower() and \c upper()
+       (maybe use \c boundaries() instead), you might be lucky
+       and get away with typedef'ing this to \c void.
+
+    The traits class must also contain the following functors
+    and member functions for their construction:
+     - \c Approximator: A \c BinaryFunction with signature
+       <tt>Integer y = Approximator()(Coefficient x, long p)</tt>
+       that computes an \c Integer approximation
+       to 2<sup><i>p</i></sup> <tt>*</tt> <i>x</i> satisfying
+       |<i>y</i> - 2<sup><i>p</i></sup> <tt>*</tt> <i>x</i>| <= 1.
+     - \c approximator_object(): A \c const member function
+       taking no arguments and returning a function object
+       of class \c Approximator.  This function is called once
+       at construction of \c T to initialize one \c Approximator
+       that is used for all subsequent coefficient approximations.
+       It is only applied to arguments \c x that have had one
+       of the coefficients assigned to them that were supplied
+       during construction of \c T. Hence it can
+       keep state and maybe cache some knowledge about coefficients.
+     - \c Lower_bound_log2_abs: A \c UnaryFunction with signature
+       <tt>long l = Lower_bound_log2_abs()(Coefficient x)</tt>.
+       The result \c l must be a lower bound to log<sub>2</sub>(|<i>x</i>|).
+       If \c Coefficient posesses \c NiX::NT_traits::Floor_log2_abs,
+       you can simply use that.
+     - \c lower_bound_log2_abs_object(): A \c const member function
+       taking no arguments and returning a function object
+       of class \c Lower_bound_log2_abs.  This function is called once
+       at construction of \c T to get a \c Lower_bound_log2_abs
+       on the polynomial's leading coefficient.
+     - \c Bound_creator: A functor with signature
+       <tt>Bound b = Bound_creator()(Integer x, long p)</tt>
+       to construct \c b with value
+       <i>x</i> <tt>*</tt> 2<sup><i>p</i></sup>.
+       If \c Bound has a matching constructor
+       (as \c NiX::Exact_float_number<Integer> does), you can simply
+       <tt>typedef CGAL::Creator_2 <Integer, long, Bound>
+       Bound_creator;</tt>.
+     - \c Sign: A functor working identically to
+       \c NiX::NT_traits::Sign for \c NT equal to \c Integer.
+       (You can just typedef to that.)
+     - \c Ceil_log2_abs_Integer: A functor working identically to
+       \c NiX::NT_traits::Ceil_log2_abs for \c NT equal to \c Integer.
+       (You can just typedef to that.)
+     - \c Ceil_log2_abs_long: A functor working identically to
+       \c NiX::NT_traits::Ceil_log2_abs for \c NT equal to \c long.
+       (You can just typedef to that.)
+
+    In brief, the core requirement is that you can approximate
+    \c Coefficient to any arbitrarily small absolute error
+    2<sup><i>-p</i></sup> (for integral <i>p</i>)
+    and deliver that approximation scaled with 2<sup><i>p</i></sup>
+    as an \c Integer.
+    For the leading coefficient, you also need to be able to locate
+    the leading 1-bit in its binary expansion.
+    The functors dealing with \c Coefficient are accessed
+    through \c _object() member functions so that the user of
+    this class can supply them with an internal state, because
+    \c Coefficient might hide some non-trivial
+    approximation or evaluation process.
+    For the functors dealing with \c Integer, this does not
+    seem necessary.
+
+    <b>Example</b> (traits class)
+
+    You can use the BitstreamDescartes method for polynomials with
+    integer coefficients.  If the coefficients are very long, this
+    saves time over the exact Descartes method, because they are
+    only needed in truncated form. A suitable traits class looks
+    like this:
+    \code
+    template <class Integer_>
+    class Bitstream_descartes_rndl_tree_traits_from_Integer_coeff {
+    public:
+        typedef Integer_ Coefficient;
+        typedef Integer_ Integer;
+        typedef NiX::Exact_float_number<Integer> Bound;
+
+        class Approximator {
+        public:
+            Integer operator() (Coefficient x, long p) {
+                if (p >= 0) return x << p; else return x >> -p;
+            }
+        };
+        Approximator approximator_object() const { return Approximator(); }
+
+        typedef typename NiX::NT_traits<Coefficient>::Floor_log2_abs Lower_bound_log2_abs;
+        Lower_bound_log2_abs lower_bound_log2_abs_object() const { return Lower_bound_log2_abs(); }
+
+        typedef CGAL::Creator_2<Integer, long, Bound> Bound_creator;
+        typedef typename NiX::NT_traits<Integer>::Sign Sign;
+        typedef typename NiX::NT_traits<Integer>::Ceil_log2_abs Ceil_log2_abs_Integer;
+        typedef typename NiX::NT_traits<long>::Ceil_log2_abs Ceil_log2_abs_long;
+    };
+    \endcode
+
+    <b>Technical remarks</b>
+
+    This class implements essentially the "rndL" variant
+    of the BitstreamDescartes method. The following remarks apply:
+
+    It is an invariant that for all nodes, the first and
+    last Bernstein coefficient are larger in magnitude than C eps.
+    Consequently, Lemma 5 of the paper allow us to conclude
+    right away from \c min_var() being 0 what would happen
+    after one further subdivision (namely: there are no roots).
+    We don't have to do this extra subdivision, we know right away.
+    Unfortunately, the analogous argument for Lemma 6 doesn't work,
+    because we still would have to verify that the value at the
+    bisection point is large.
+
+    Subdivision points with value larger than C eps are found
+    by trying randomly and checking.  This randomization means
+    the same polynomial and same initial interval may give rise
+    to different intervals each time this class is used.
+    As indicated in the paper, we favour subdivision ratios
+    with a small denominator. Hence we first try denominator
+    2 (subdivision at midpoint), then denominator 16, and
+    only then the "proper" denominator prescribed by theory.
+    Failures are only counted for the "proper" tries.
+
+    Unlike the algorithm in the paper, we do not have one global
+    estimate for the separation of roots, and we do not restart
+    globally if that estimate turns out wrong.  Instead, each node
+    maintains an estimate.  Upon subdivision, its children
+    inherit it, including the counts of tried and failed
+    subdivisions. If fails/tries >= 1/2 and tries >= 2,
+    the estimate of separation (and all other parameters
+    coming out of it) are updated only for this one node.
+    The node's interval does not change; subdivision
+    resumes from this interval with an improved estimate of
+    separation.  All other nodes are unaffected.
+    Global restart is not an option for this class, because the user has
+    already observed the subintervals found up to this point,
+    so we cannot simply switch to other intervals.
+
+    This implementation relies on the assumption that the
+    <i>logarithms</i> of certain relevant quantities, in particular
+    the degree times the logarithm of the estimated separation,
+    are small enough to be representable in a <tt>long int</tt>.
+    Also, the degree of the input polynomial and related quantities
+    are assumed to fit into an \c int.
+ */
+template <class BitstreamDescartesRndlTreeTraits>
+class Bitstream_descartes_rndl_tree
+// TODO: Replaced CGAL::Handle by following CGAL::Handle_with_policy, is this correct?
+    : public ::CGAL::Handle_with_policy< Bitstream_descartes_rndl_tree_rep<
+        BitstreamDescartesRndlTreeTraits
+    >, ::CGAL::Handle_policy_no_union >
+{
+public:
+    typedef Bitstream_descartes_rndl_tree Self;
+    CGAL_BITSTREAM_DESCARTES_RNDL_TREE_TYPEDEFS;
+    typedef Bitstream_descartes_rndl_tree_rep<TRAITS> Rep;
+    typedef ::CGAL::Handle_with_policy< Rep, ::CGAL::Handle_policy_no_union > Base;
+
+    //! node iterator.
+    typedef typename Node_list::iterator       Node_iterator;
+    //! node iterator (for STL compatibility only).
+    typedef typename Node_list::iterator       iterator;
+    //! const node iterator.
+    typedef typename Node_list::const_iterator Node_const_iterator;
+    //! const node iterator (for STL compatibility only).
+    typedef typename Node_list::const_iterator const_iterator;
+
+    //! tag type to distinguish a certain constructor.
+    typedef typename Rep::Monomial_basis_tag Monomial_basis_tag;
+
+public:
+    //! default constructor (makes <tt>degree() == -1</tt>)
+    Bitstream_descartes_rndl_tree() : Base(Rep()) { }
+
+    //! copy constructor
+    Bitstream_descartes_rndl_tree(const Self& p)
+        : Base(static_cast<const Base&>(p))
+    { }
+
+    //! Internal function called by constructor. Avoids code duplication
+    void init_tree() {
+        Node_iterator n = this->ptr()->node_list_.begin();
+        if (this->ptr()->degree_ > 0) {
+            initial_guess_sep(n);
+            while (!reinit_from_sep(n)) next_guess_sep(n);
+            if (n->min_var_ == 0) this->ptr()->node_list_.erase(n);
+        } else {
+            this->ptr()->node_list_.erase(n);
+        }
+    }
+        
+
+    /*! \brief construct from initial interval and coefficients
+     *
+     *  The initial interval is
+     *  [\c lower_num, \c upper_num] / 2^(\c log_bdry_den ).
+     *
+     *  The iterator range [\c first, \c beyond ) gives the
+     *  coefficients of 1, <i>x</i>, <i>x</i><sup>2</sup>, ...
+     *  The leading coefficient (last in sequence) must be non-zero.
+     *
+     *  The \c Monomial_basis_tag is required for the benefit of
+     *  future extensions to coefficients w.r.t. other bases.
+     */
+    template <class InputIterator>
+    Bitstream_descartes_rndl_tree(
+            Integer lower_num,  Integer upper_num, long log_bdry_den,
+            InputIterator first, InputIterator beyond, Monomial_basis_tag tag,
+            const BitstreamDescartesRndlTreeTraits& traits
+                                        = BitstreamDescartesRndlTreeTraits()
+    ) : Base(Rep(lower_num, upper_num, log_bdry_den,
+                    first, beyond, tag, traits))
+    {
+        CGAL_precondition(lower_num < upper_num);
+        init_tree();
+        
+    }
+
+    /*! 
+     * This is needed for compatibility with other tree implementations
+     * The initial interval is
+     *  [-1, 1] / 2^(\c -log_bdry_den ).
+     * Be aware that log_bdry_den is negated here!
+     */
+    template <class InputIterator>
+    Bitstream_descartes_rndl_tree(
+            long log_bdry_den,
+            InputIterator first, InputIterator beyond, Monomial_basis_tag tag,
+            const BitstreamDescartesRndlTreeTraits& traits
+                                        = BitstreamDescartesRndlTreeTraits()
+    )
+        : Base(Rep(Integer(-1), Integer(1), -log_bdry_den, 
+                   first, beyond, tag, traits))
+    {
+        init_tree();
+    }
+
+    //! return degree of polynomial
+    int degree() const { return this->ptr()->degree_; }
+
+    //! iterator to first node
+    Node_iterator begin() {
+        return this->ptr()->node_list_.begin();
+    }
+    //! iterator beyond last node
+    Node_iterator end() {
+        return this->ptr()->node_list_.end();
+    }
+    //! const iterator to first node
+    Node_const_iterator begin() const {
+        return this->ptr()->node_list_.begin();
+    }
+    //! const iterator beyond last node
+    Node_const_iterator end() const {
+        return this->ptr()->node_list_.end();
+    }
+
+    //! get lower bound of interval at node \c n.
+    Bound lower(Node_iterator n) const {
+        return Bound_creator()(n->lower_num_, -n->log_bdry_den_);
+    }
+    //! get lower bound of interval at node \c n.
+    Bound lower(Node_const_iterator n) const {
+        return Bound_creator()(n->lower_num_, -n->log_bdry_den_);
+    }
+    //! get upper bound of interval at node \c n.
+    Bound upper(Node_iterator n) const {
+        return Bound_creator()(n->upper_num_, -n->log_bdry_den_);
+    }
+    //! get upper bound of interval at node \c n.
+    Bound upper(Node_const_iterator n) const {
+        return Bound_creator()(n->upper_num_, -n->log_bdry_den_);
+    }
+
+    //! get boundaries: interval at node \c n is
+    //! [\c lower_num, \c upper_num] / 2^(\c log_bdry_den ).
+    void boundaries(Node_iterator n,
+            Integer& lower_num, Integer& upper_num, long& log_bdry_den
+    ) {
+        lower_num    = n->lower_num_;
+        upper_num    = n->upper_num_;
+        log_bdry_den = n->log_bdry_den_;
+    }
+
+    //! get minimum number of sign variations in Descartes Test
+    //! for approximate polynomial at node \c n
+    int min_var(Node_const_iterator n) const { return n->min_var_; }
+    //! get maximum number of sign variations in Descartes Test
+    //! for approximate polynomial at node \c n
+    int max_var(Node_const_iterator n) const { return n->max_var_; }
+
+    /*! \brief subdivide interval at node \c n.
+     *
+     *  The node representing interval \c n is replaced in the list
+     *  of nodes by 0, 1, or 2 nodes that represent those among the
+     *  two subintervals that have \c min_var() greater than 0.
+     *  The number of new nodes is returned as result.
+     *  The subrange of nodes consisting of the new nodes is
+     *  returned in the arguments \c first and \c beyond
+     *
+     *  Subdividing a node invalidates all iterators to it;
+     *  both for the object where \c subdivide() was called
+     *  and all copies of it (since they share the same
+     *  representation and state).
+     *
+     *  The parameter \c n is passed by value.  Hence you can
+     *  implement depth-first search for isolating intervals like this:
+     *  \code
+     *    Node_iterator dummy, curr = tree.begin();
+     *    while (curr != tree.end()) {
+     *        if (tree.max_var(curr) == 1) ++curr;
+     *        else tree.subdivide(curr, curr, dummy);
+     *    }
+     *  \endcode
+     */
+    int subdivide(
+            Node_iterator n, Node_iterator& first, Node_iterator& beyond
+    );
+
+    /*! \brief erase node \c n.
+     *
+     *  Erasing a node invalidates all iterators to it;
+     *  both for the object where \c subdivide() was called
+     *  and all copies of it (since they share the same
+     *  representation and state).
+     */
+    void erase(Node_iterator n) {
+        this->ptr()->node_list_.erase(n);
+    }
+
+    /*! \brief Replace traits class
+     */
+    void set_traits(TRAITS& traits) {
+
+      this->ptr()->approximator_ 
+        = traits.approximator_object();
+      this->ptr()->lower_bound_log2_abs_ 
+        = traits.lower_bound_log2_abs_object();
+
+    }
+
+    /*! \brief Returns a copy of this with its own representation
+     */
+    Self make_unique() const {
+      Self tmp = *this;
+      tmp.copy_on_write();
+      return tmp;
+    }
+
+
+protected:
+    int subdivide_at_midpoint(
+            Node_iterator n, Node_iterator& first, Node_iterator& beyond
+    );
+
+    int subdivide_at(
+            Node_iterator n, Node_iterator& first, Node_iterator& beyond,
+            long alpha_num, int log_alpha_den
+    );
+
+private:
+    int replace_by_tmp(
+            Node_iterator n, Node_iterator& first, Node_iterator& beyond
+    );
+
+    void initial_guess_sep(Node_iterator n) {
+        Ceil_log2_abs_Integer log;
+        long log_I = log(n->upper_num_-n->lower_num_) - n->log_bdry_den_;
+        n->delta_log_sep_ = -5;
+        n->log_sep_ = log_I + n->delta_log_sep_;
+    }
+
+    void next_guess_sep(Node_iterator n) {
+        n->delta_log_sep_ *= 2;
+        CGAL_warning_msg(-n->delta_log_sep_ < 1L<<24, "delta_log_sep >= 1L<<24");
+        n->log_sep_ += n->delta_log_sep_;
+    }
+
+    bool reinit_from_sep(Node_iterator n);
+
+}; // class Bitstream_descartes_rndl_tree
+
+
+/*
+ * Non-inline member functions of class Bitstream_descartes_rndl_tree
+ */
+
+template <class BitstreamDescartesRndlTreeTraits>
+bool
+Bitstream_descartes_rndl_tree<BitstreamDescartesRndlTreeTraits>
+::reinit_from_sep(Node_iterator n) {
+    n->subdiv_tries_ = n->subdiv_fails_ = 0;
+
+    Ceil_log2_abs_Integer log;
+    /* We want to set recdepth to
+     *   floor( (log(|I|/sep) / log(4/3)) + 5/2 )
+     * or something slightly larger.
+     * Using the continued fractions expansion [2,2,2,3],
+     * we find an upper bound of 41/17 = 82/34 = 2.41176...
+     * for the exact multiplier     1/log(4/3) = 2.40942...
+     * which is off by less than 0.1%, namely    0.00234...
+     * Noting 5/2 = 85/34, we hence set recdepth to
+     *   floor( (log|I| - log(sep))*82 + 85) / 34 )
+     */
+    n->recdepth_ = (
+            (log(n->upper_num_ - n->lower_num_) - n->log_bdry_den_ // log|I|
+            - n->log_sep_
+        )*82 + 85) / 34;
+    if (n->recdepth_ < 6) n->recdepth_ = 6; // TODO find rationale
+
+    n->log_eps_ = this->ptr()->ceil_log_degree_
+        + Ceil_log2_abs_long()(n->recdepth_);
+    n->log_C_eps_ = n->log_eps_ + 4*degree(); // C = 16^n
+    long target_log_lcf = (4 - n->log_sep_)*this->ptr()->degree_
+        + n->log_eps_ + 2*this->ptr()->ceil_log_degree_ + 10;
+    long log_lcf_scale = target_log_lcf - this->ptr()->lbd_log_lcoeff_
+        - (log(caching_factorial<Integer>(this->ptr()->degree_)) - 1);
+
+    polynomial_power_to_bernstein_approx(
+            this->ptr()->input_monomial_coeff_.begin(),
+            this->ptr()->input_monomial_coeff_.end(),
+            n->coeff_.begin(),
+            n->lower_num_, n->upper_num_, n->log_bdry_den_,
+            log_lcf_scale - (n->log_eps_ - 1),
+            this->ptr()->approximator_,
+            Ceil_log2_abs_Integer(), Ceil_log2_abs_long()
+    );
+    for (int i = 0; i <= degree(); ++i) {
+        n->coeff_[i] <<= (n->log_eps_ - 1); // TODO avoid preceding rshift
+    }
+
+    if (Abs_le_pow2()(n->coeff_[ degree()], n->log_C_eps_)
+            ||  Abs_le_pow2()(n->coeff_[0], n->log_C_eps_)
+    ) {
+        return false;
+    } else {
+        var_eps(n->coeff_.begin(), n->coeff_.end(),
+                n->min_var_, n->max_var_, Sign_eps_log2(n->log_eps_)
+        );
+        return true;
+    }
+} // Bitstream_descartes_rndl_tree::reinit_from_sep()
+
+template <class BitstreamDescartesRndlTreeTraits>
+int
+Bitstream_descartes_rndl_tree<BitstreamDescartesRndlTreeTraits>
+::subdivide_at_midpoint(
+        Node_iterator n, Node_iterator& first, Node_iterator& beyond
+) {
+    de_casteljau_generic(n->coeff_.begin(), n->coeff_.end(),
+            this->ptr()->tmp1_coeff_.begin(), this->ptr()->tmp2_coeff_.begin(),
+            Convex_combinator_approx_midpoint<Integer>()
+    );
+    this->ptr()->splitpoint_num_     = n->lower_num_ + n->upper_num_;
+    this->ptr()->log_splitpoint_den_ = n->log_bdry_den_ + 1;
+
+    if (Abs_le_pow2()(this->ptr()->tmp2_coeff_[0], n->log_C_eps_)) {
+        return -1;
+    } else {
+        return replace_by_tmp(n, first, beyond);
+    }
+} // Bitstream_descartes_rndl_tree::subdivide_at()
+
+template <class BitstreamDescartesRndlTreeTraits>
+int
+Bitstream_descartes_rndl_tree<BitstreamDescartesRndlTreeTraits>
+::subdivide_at(
+        Node_iterator n, Node_iterator& first, Node_iterator& beyond,
+        long alpha_num, int log_alpha_den
+) {
+    de_casteljau_generic(n->coeff_.begin(), n->coeff_.end(),
+        this->ptr()->tmp1_coeff_.begin(), this->ptr()->tmp2_coeff_.begin(),
+        Convex_combinator_approx_long_log<Integer>(alpha_num, log_alpha_den)
+    );
+    this->ptr()->splitpoint_num_ =
+        alpha_num * n->lower_num_
+            + ((1L << log_alpha_den) - alpha_num) * n->upper_num_;
+    this->ptr()->log_splitpoint_den_ = n->log_bdry_den_ + log_alpha_den;
+
+    if (Abs_le_pow2()(this->ptr()->tmp2_coeff_[0], n->log_C_eps_)) {
+        return -1;
+    } else {
+        return replace_by_tmp(n, first, beyond);
+    }
+} // Bitstream_descartes_rndl_tree::subdivide_at()
+
+
+template <class BitstreamDescartesRndlTreeTraits>
+int
+Bitstream_descartes_rndl_tree<BitstreamDescartesRndlTreeTraits>
+::replace_by_tmp(
+        Node_iterator n, Node_iterator& first, Node_iterator& beyond
+) {
+    --(n->recdepth_);
+
+    long delta_log_bdry_den =
+        this->ptr()->log_splitpoint_den_ - n->log_bdry_den_;
+    CGAL_assertion(delta_log_bdry_den >= 0);
+
+    int l_min_var, l_max_var, r_min_var, r_max_var;
+    var_eps(this->ptr()->tmp1_coeff_.begin(),
+            this->ptr()->tmp1_coeff_.end(),
+            l_min_var, l_max_var, Sign_eps_log2(n->log_eps_)
+    );
+    var_eps(this->ptr()->tmp2_coeff_.begin(),
+            this->ptr()->tmp2_coeff_.end(),
+            r_min_var, r_max_var, Sign_eps_log2(n->log_eps_)
+    );
+    CGAL_assertion(l_min_var >= 0 && l_max_var >= 0);
+    CGAL_assertion(r_min_var >= 0 && r_max_var >= 0);
+
+    beyond = first = n;
+    ++beyond;
+
+    if (l_min_var > 0) {
+        int children = 1;
+        if (r_min_var > 0) {
+            // create new node for right child
+            Node_iterator r = 
+                this->ptr()->node_list_.insert(beyond, Node(degree(),
+                            this->ptr()->splitpoint_num_,        // lower
+                            n->upper_num_ << delta_log_bdry_den, // upper
+                            this->ptr()->log_splitpoint_den_,
+                            r_min_var, r_max_var
+                ));
+            r->coeff_.swap(this->ptr()->tmp2_coeff_);
+            r->copy_state_from(*n);
+            ++children;
+        }
+        // put left child into n
+        n->lower_num_  <<= delta_log_bdry_den;
+        n->upper_num_    = this->ptr()->splitpoint_num_;
+        n->log_bdry_den_ = this->ptr()->log_splitpoint_den_;
+        n->min_var_      = l_min_var;
+        n->max_var_      = l_max_var;
+        n->coeff_.swap(this->ptr()->tmp1_coeff_);
+        return children;
+    } else if (r_min_var > 0) {
+        // put right child into n
+        n->lower_num_    = this->ptr()->splitpoint_num_;
+        n->upper_num_  <<= delta_log_bdry_den;
+        n->log_bdry_den_ = this->ptr()->log_splitpoint_den_;
+        n->min_var_      = r_min_var;
+        n->max_var_      = r_max_var;
+        n->coeff_.swap(this->ptr()->tmp2_coeff_);
+        return 1;
+    } else /* l_min_var == 0 && r_min_var == 0 */ {
+        // delete n
+        first = beyond;
+        this->ptr()->node_list_.erase(n);
+        return 0;
+    }
+} // Bitstream_descartes_rndl_tree::replace_by_tmp()
+
+template <class BitstreamDescartesRndlTreeTraits>
+int
+Bitstream_descartes_rndl_tree<BitstreamDescartesRndlTreeTraits>
+::subdivide(
+        Node_iterator n, Node_iterator& first, Node_iterator& beyond
+) {
+    long alpha_num;
+    int  log_alpha_den;
+    long alpha_den_4;
+    int  ret;
+
+    for (;;) {
+        if (n->recdepth_ > 0) { // TODO decouple recdepth from guess_sep
+            // first try heuristic alpha = 1/2 (failures don't count)
+            ++(n->subdiv_tries_);
+            ret = subdivide_at_midpoint(n, first, beyond);
+            if (ret >= 0) { return ret; } else { --(n->subdiv_tries_); }
+
+            // next try heuristic alpha with small denom (failures don't count)
+            log_alpha_den = 4;
+            alpha_den_4 = 1L << (log_alpha_den - 2);
+            alpha_num = CGAL::get_default_random().get_int(  // TODO .get_long
+                    alpha_den_4, 3*alpha_den_4 + 1
+            );
+            ++(n->subdiv_tries_);
+            ret = subdivide_at(n, first, beyond, alpha_num, log_alpha_den);
+            if (ret >= 0) { return ret; } else { --(n->subdiv_tries_); }
+
+            // now try alpha properly randomized, counting failure rate
+            log_alpha_den = 5 + this->ptr()->ceil_log_degree_;
+            alpha_den_4 = 1L << (log_alpha_den - 2);
+            do {
+                alpha_num = CGAL::get_default_random().get_int(  // TODO .get_long
+                        alpha_den_4, 3*alpha_den_4 + 1
+                );
+                ++(n->subdiv_tries_);
+                ret = subdivide_at(n, first, beyond, alpha_num, log_alpha_den);
+                if (ret >= 0) {
+                    return ret;
+                } else {
+                    ++(n->subdiv_fails_);
+                }
+            } while (n->subdiv_fails_ < 2  // Arno says: 2 (not 6) is enough
+                    || 2 * n->subdiv_fails_ < n->subdiv_tries_);
+        } // if (n->recdepth_ > 0)
+
+        // if failure rate too high or recdepth exceeded,
+        // decrease guess of sep and restart
+        next_guess_sep(n);
+        bool reinit_success = reinit_from_sep(n);
+        CGAL_assertion(reinit_success); (void)reinit_success;
+    } // for (;;)
+} // Bitstream_descartes_rndl_tree::subdivide()
+
+} // namespace internal
+
+
+/*
+ * FUJIWARA ROOT BOUND
+ */
+
+namespace internal {
+
+struct Fujiwara_root_bound_queue_entry {
+    typedef Fujiwara_root_bound_queue_entry Self;
+
+    int n_minus_i;
+    long ub_log2_qi;
+    bool is_certainly_zero;
+    bool is_tight;
+
+    bool operator < (Self& rhs) {
+        if (is_certainly_zero) return !rhs.is_certainly_zero;
+        if (rhs.is_certainly_zero) return false;
+        return ub_log2_qi * rhs.n_minus_i < rhs.ub_log2_qi * n_minus_i;
+    }
+};
+
+class Fujiwara_root_bound_queue_entry_ptr_less {
+public:
+    typedef bool result_type;
+    typedef Fujiwara_root_bound_queue_entry* first_argument_type;
+    typedef Fujiwara_root_bound_queue_entry* second_argument_type;
+    result_type operator() (first_argument_type a, second_argument_type b) {
+        return *a < *b;
+    }
+};
+
+template <class CeilLog2Abs>
+class Upper_bound_log2_abs_approximator_from_ceil_log2_abs {
+public:
+    typedef Upper_bound_log2_abs_approximator_from_ceil_log2_abs Self;
+    typedef CeilLog2Abs Ceil_log2_abs;
+    typedef typename Ceil_log2_abs::argument_type NT;
+    bool initial_upper_bound(NT x, long& ub_log2, bool& is_certainly_zero) {
+        is_certainly_zero = (x == NT(0));
+        if (!is_certainly_zero) ub_log2 = Ceil_log2_abs()(x);
+        return true; // reported bound is tight
+    }
+    bool improve_upper_bound(NT, long&, bool&) { return true; }
+};
+
+/*! \ingroup NiX_Bitstream_descartes_tree
+    \brief Fujiwara root bound (as logarithm wrt base 2)
+
+    All complex roots of a polynomial
+    <i>A</i>(<i>X</i>) = <i>a<sub>n</sub>X<sup>n</sup></i> + ... + <i>a</i><sub>0</sub>
+    are bounded in magnitude by
+    F(<i>A</i>) = 2 max<sub><i>i</i><<i>n</i></sub> <i>q<sub>i</sub></i><sup>1/(<i>n</i>-<i>i</i>)</sup>
+    where <i>q<sub>i</sub></i> = |<i>a<sub>i</sub></i>/<i>a<sub>n</sub></i>|
+    for 0 < <i>i</i> < <i>n</i>
+    and <i>q</i><sub>0</sub>
+    = |<i>a</i><sub>0</sub>/(2<i>a<sub>n</sub></i>)|.
+    This bound goes back to M. Fujiwara
+    [<i>Tohoku Math. J.</i> <b>10</b> (1916) 167-171],
+    cited here after P. Batra's PhD thesis [TU Hamburg-Harburg, Germany, 1999].
+
+    This function computes an integer upper bound for
+    log<sub>2</sub>(F(<i>A</i>)) from an iterator range [first, beyond)
+    over values of some type \c Coefficient
+    where <tt>*(first+i)</tt> is <i>a<sub>i</sub></i>.
+    This function does not operate on type \c Coefficient
+    except through the two function objects passed to it:
+
+    <tt>LowerBoundLog2Abs lblog2</tt> has to be a function object
+    with a function call operator taking an argument
+    <tt>*(beyond-1)</tt> of type \c Coefficient
+    and returning a \c long which is a lower bound for
+    log<sub>2</sub>(|<i>a<sub>n</sub></i>|).
+    This functor is called once and should return a bound as
+    good as possible.
+
+    <tt>UpperBoundLog2AbsApproximator ublog2apx</tt> has to be an
+    object with two member functions
+    \c initial_upper_bound() and \c improve_upper_bound().
+    Both of them take three arguments:
+    <tt>(Coefficient ai, long& ub_log2, bool& is_certainly_zero)</tt>
+    and return <tt>bool</tt>. \c ai is one of the coefficients.
+    First, the member function \c initial_upper_bound() is invoked
+    on \c ai and uninitialized arguments \c ub_log2 and \c is_certainly_zero.
+    Then, \c improve_upper_bound() is invoked repeatedly on \c ai and
+    arguments \c ub_log2 and \c is_certainly_zero as set by the
+    previous call.  This sequence of calls has to create a
+    sequence of estimates of upper bounds for
+    log<sub>2</sub>(|<tt>ai</tt>|).  As long as
+    a later call will return a better approximation,
+    the function returns \c false. If the current bound is to be
+    regarded as best possible, the function returns \c true.
+    If, while improving the bound, it is discovered that
+    <tt>ai</tt> is zero, in which case the correct estimate would be
+    "minus infinity", \c is_certainly_zero is set to \c true;
+    otherwise it is always \c false.
+    If \c is_certainly_zero is set to \c true,
+    the value of \c ub_log2 is ignored.
+
+    Internally, this function works as follows:
+    It improves upper bounds of log<sub>2</sub>(|<i>a<sub>i</sub></i>|)
+    for all <i>i</i> < <i>n</i> until it has found one that
+    is designated as best possible (i.e., has returned \c true)
+    and that realizes the maximum in the definition
+    of the Fujiwara bound. Unlike \c LowerBoundLog2Abs, which is
+    called only once, namely for the leading coefficient, and should
+    provide the best possible bound at once,
+    \c UpperBoundLog2AbsApproximator is called repeatedly,
+    and each call should perform only a limited amount of work
+    (e.g., one round of interval refinement for its argument)
+    so that this function can distribute the approximation work
+    evenly over all coefficients until the maximum is found.
+
+    The leading coefficient <tt>*(beyond-1)</tt> has to be non-zero.
+    In the special case that all other coefficients are zero,
+    the result 0 (standing for 2<sup>0</sup>=1) is returned.
+    Obviously, this cannot happen for a square-free polynomial
+    of degree larger than 1.
+
+    <b>Warning:</b> This bound is tight for certain polynomials
+    (e.g., (<i>X</i>-2)(<i>X<sup>n</sup></i>-1)/(<i>X</i>-1)).
+    The BitstreamDescartes method, however, needs an initial interval
+    whose boundaries are far away from the zeroes. Hence you should
+    add 1 to the result of this function before using it there.
+    Also bear in mind that this function returns a logarithm of
+    the bound, whereas certain other functions may expect a
+    logarithm of a denominator, necessitating a negation.
+
+    For coefficients that are known explicitly (e.g., big integers)
+    and possess <tt>NiX::NT_traits::{Floor,Ceil}_log2_abs</tt> functors,
+    the lower and upper bound function objects for this function
+    should be constructed from them.  This is done automatically
+    by an overloaded version of this functions that takes only the
+    first two arguments.
+ */
+template<class RandomAccessIterator,
+    class LowerBoundLog2Abs,
+    class UpperBoundLog2AbsApproximator
+>
+long Fujiwara_root_bound_log(
+    RandomAccessIterator first, RandomAccessIterator beyond,
+    LowerBoundLog2Abs lblog2, UpperBoundLog2AbsApproximator ublog2apx
+) {
+    int n = beyond - first - 1; // degree
+    if (n < 1) return 0;
+    long lblog2_lcoeff = lblog2(*(beyond - 1));
+
+    Fujiwara_root_bound_queue_entry_ptr_less less;
+    typedef Fujiwara_root_bound_queue_entry QE;
+    std::vector<QE>  entries(n); // entries are never copied
+    std::vector<QE*> heap(n);    // heap is built from pointers to them
+    for (int i = 0; i < n; ++i) {
+        QE& entry = entries[i];
+        entry.n_minus_i = n - i;
+        entry.is_tight = ublog2apx.initial_upper_bound(
+                *(first + i), entry.ub_log2_qi, entry.is_certainly_zero
+        );
+        CGAL_assertion(entry.is_tight || !entry.is_certainly_zero);
+        if (!entry.is_certainly_zero) entry.ub_log2_qi -= lblog2_lcoeff;
+        heap[i] = &(entry);
+    }
+    entries[0].ub_log2_qi -= 1;
+
+    std::make_heap(heap.begin(), heap.end(), less);
+    while (!heap[0]->is_tight) {
+        std::pop_heap(heap.begin(), heap.end(), less);
+        QE& popped = **(heap.end() - 1);
+        int i = n - popped.n_minus_i;
+        CGAL_assertion(i >= 0 && i < n);
+        CGAL_assertion(&popped == &(entries[i]));
+        popped.is_tight = ublog2apx.improve_upper_bound(
+                *(first + i),
+                popped.ub_log2_qi, popped.is_certainly_zero
+        );
+        if (!popped.is_certainly_zero) {
+            popped.ub_log2_qi -= lblog2_lcoeff;
+            if (i == 0) popped.ub_log2_qi -= 1;
+        }
+        std::push_heap(heap.begin(), heap.end(), less);
+    }
+    QE& maxi = *(heap[0]);
+    if (maxi.is_certainly_zero) return 0;
+    long max_log2_qi_div_n_minus_i = maxi.ub_log2_qi / maxi.n_minus_i;
+    if (maxi.ub_log2_qi % maxi.n_minus_i > 0) ++max_log2_qi_div_n_minus_i;
+    return 1 + max_log2_qi_div_n_minus_i; // = log ( 2 * max_i q_i^{1/(n-i)} )
+}
+
+template<class RandomAccessIterator>
+inline
+long Fujiwara_root_bound_log(
+    RandomAccessIterator first, RandomAccessIterator beyond
+) {
+    typedef typename RandomAccessIterator::value_type NT;
+    typedef typename internal::Real_embeddable_extension<NT>::Floor_log2_abs Lbd;
+    typedef Upper_bound_log2_abs_approximator_from_ceil_log2_abs<
+                typename internal::Real_embeddable_extension<NT>::Ceil_log2_abs
+            > Ubd;
+    return Fujiwara_root_bound_log(first, beyond, Lbd(), Ubd());
+}
+
+
+} // namespace internal
+
+} //namespace CGAL
+
+#endif // CGAL_ALGEBRAIC_KERNEL_D_BITSTREAM_DESCARTES_RNDL_TREE_H
+
+// EOF
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_rndl_tree_traits.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_rndl_tree_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_rndl_tree_traits.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_rndl_tree_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Curve_analysis_2.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Curve_analysis_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Curve_analysis_2.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Curve_analysis_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Curve_pair_analysis_2.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Curve_pair_analysis_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Curve_pair_analysis_2.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Curve_pair_analysis_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Descartes.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Descartes.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Descartes.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Descartes.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Event_line_builder.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Event_line_builder.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Event_line_builder.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Event_line_builder.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Float_traits.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Float_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Float_traits.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Float_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Interval_evaluate_1.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Interval_evaluate_1.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Interval_evaluate_1.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Interval_evaluate_1.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Interval_evaluate_2.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Interval_evaluate_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Interval_evaluate_2.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Interval_evaluate_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/LRU_hashed_map.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/LRU_hashed_map.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/LRU_hashed_map.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/LRU_hashed_map.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Real_embeddable_extension.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Real_embeddable_extension.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Real_embeddable_extension.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Real_embeddable_extension.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Real_roots.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Real_roots.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Real_roots.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Real_roots.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Shear_controller.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Shear_controller.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Shear_controller.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Shear_controller.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Shear_transformation.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Shear_transformation.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Shear_transformation.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Shear_transformation.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Status_line_CA_1.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Status_line_CA_1.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Status_line_CA_1.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Status_line_CA_1.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Status_line_CPA_1.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Status_line_CPA_1.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Status_line_CPA_1.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Status_line_CPA_1.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Xy_coordinate_2.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Xy_coordinate_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/Xy_coordinate_2.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/Xy_coordinate_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/algebraic_curve_kernel_2_tools.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/algebraic_curve_kernel_2_tools.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/algebraic_curve_kernel_2_tools.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/algebraic_curve_kernel_2_tools.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/bound_between_1.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/bound_between_1.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/bound_between_1.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/bound_between_1.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/construct_binary.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/construct_binary.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/construct_binary.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/construct_binary.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/enums.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/enums.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/enums.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/enums.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/exceptions.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/exceptions.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/exceptions.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/exceptions.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/flags.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/flags.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/flags.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/flags.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/macros.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/macros.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/macros.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/macros.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/refine_zero_against.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/refine_zero_against.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/refine_zero_against.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/refine_zero_against.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/shear.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/shear.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/shear.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/shear.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/univariate_polynomial_utils.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/univariate_polynomial_utils.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d/univariate_polynomial_utils.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_d/univariate_polynomial_utils.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d_1.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d_1.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d_1.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_d_1.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d_2.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_d_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_d_2.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_d_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_for_circles/function_objects_on_roots_and_polynomials_2_2.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_for_circles/function_objects_on_roots_and_polynomials_2_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_for_circles/function_objects_on_roots_and_polynomials_2_2.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_for_circles/function_objects_on_roots_and_polynomials_2_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_for_circles/internal_functions_comparison_root_for_circles_2_2.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_for_circles/internal_functions_comparison_root_for_circles_2_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_for_circles/internal_functions_comparison_root_for_circles_2_2.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_for_circles/internal_functions_comparison_root_for_circles_2_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_for_circles/internal_functions_on_roots_and_polynomial_1_2_and_2_2.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_for_circles/internal_functions_on_roots_and_polynomial_1_2_and_2_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_for_circles/internal_functions_on_roots_and_polynomial_1_2_and_2_2.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_for_circles/internal_functions_on_roots_and_polynomial_1_2_and_2_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_for_circles/internal_functions_on_roots_and_polynomials_2_2.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_for_circles/internal_functions_on_roots_and_polynomials_2_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_for_circles/internal_functions_on_roots_and_polynomials_2_2.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_for_circles/internal_functions_on_roots_and_polynomials_2_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_for_circles_2_2.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_for_circles_2_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_for_circles_2_2.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_for_circles_2_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_for_spheres/function_objects_on_roots_and_polynomials_2_3.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_for_spheres/function_objects_on_roots_and_polynomials_2_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_for_spheres/function_objects_on_roots_and_polynomials_2_3.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_for_spheres/function_objects_on_roots_and_polynomials_2_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_for_spheres/internal_functions_comparison_root_for_spheres_2_3.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_for_spheres/internal_functions_comparison_root_for_spheres_2_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_for_spheres/internal_functions_comparison_root_for_spheres_2_3.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_for_spheres/internal_functions_comparison_root_for_spheres_2_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_for_spheres/internal_functions_on_roots_and_polynomial_1_3_and_2_3.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_for_spheres/internal_functions_on_roots_and_polynomial_1_3_and_2_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_for_spheres/internal_functions_on_roots_and_polynomial_1_3_and_2_3.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_for_spheres/internal_functions_on_roots_and_polynomial_1_3_and_2_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_for_spheres/internal_functions_on_roots_and_polynomials_1_3.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_for_spheres/internal_functions_on_roots_and_polynomials_1_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_for_spheres/internal_functions_on_roots_and_polynomials_1_3.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_for_spheres/internal_functions_on_roots_and_polynomials_1_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_for_spheres/internal_functions_on_roots_and_polynomials_2_3.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_for_spheres/internal_functions_on_roots_and_polynomials_2_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_for_spheres/internal_functions_on_roots_and_polynomials_2_3.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_for_spheres/internal_functions_on_roots_and_polynomials_2_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_for_spheres_2_3.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_for_spheres_2_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_for_spheres_2_3.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_for_spheres_2_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_rs_gmpq_d_1.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_rs_gmpq_d_1.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_rs_gmpq_d_1.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_rs_gmpq_d_1.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_rs_gmpz_d_1.h b/3rdparty/CGAL/include/CGAL/Algebraic_kernel_rs_gmpz_d_1.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_kernel_rs_gmpz_d_1.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_kernel_rs_gmpz_d_1.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Algebraic_structure_traits.h b/3rdparty/CGAL/include/CGAL/Algebraic_structure_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Algebraic_structure_traits.h
rename to 3rdparty/CGAL/include/CGAL/Algebraic_structure_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Alpha_shape_2.h b/3rdparty/CGAL/include/CGAL/Alpha_shape_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Alpha_shape_2.h
rename to 3rdparty/CGAL/include/CGAL/Alpha_shape_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Alpha_shape_3.h b/3rdparty/CGAL/include/CGAL/Alpha_shape_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Alpha_shape_3.h
rename to 3rdparty/CGAL/include/CGAL/Alpha_shape_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Alpha_shape_cell_base_3.h b/3rdparty/CGAL/include/CGAL/Alpha_shape_cell_base_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Alpha_shape_cell_base_3.h
rename to 3rdparty/CGAL/include/CGAL/Alpha_shape_cell_base_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Alpha_shape_euclidean_traits_2.h b/3rdparty/CGAL/include/CGAL/Alpha_shape_euclidean_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Alpha_shape_euclidean_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Alpha_shape_euclidean_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Alpha_shape_euclidean_traits_3.h b/3rdparty/CGAL/include/CGAL/Alpha_shape_euclidean_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Alpha_shape_euclidean_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/Alpha_shape_euclidean_traits_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Alpha_shape_face_base_2.h b/3rdparty/CGAL/include/CGAL/Alpha_shape_face_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Alpha_shape_face_base_2.h
rename to 3rdparty/CGAL/include/CGAL/Alpha_shape_face_base_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Alpha_shape_vertex_base_2.h b/3rdparty/CGAL/include/CGAL/Alpha_shape_vertex_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Alpha_shape_vertex_base_2.h
rename to 3rdparty/CGAL/include/CGAL/Alpha_shape_vertex_base_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Alpha_shape_vertex_base_3.h b/3rdparty/CGAL/include/CGAL/Alpha_shape_vertex_base_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Alpha_shape_vertex_base_3.h
rename to 3rdparty/CGAL/include/CGAL/Alpha_shape_vertex_base_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Apollonius_graph_2_impl.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Apollonius_graph_2_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Apollonius_graph_2_impl.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Apollonius_graph_2_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Apollonius_graph_hierarchy_2_impl.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Apollonius_graph_hierarchy_2_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Apollonius_graph_hierarchy_2_impl.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Apollonius_graph_hierarchy_2_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Bounded_side_of_ccw_circle_C2.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Bounded_side_of_ccw_circle_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Bounded_side_of_ccw_circle_C2.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Bounded_side_of_ccw_circle_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Compare_weight_2.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Compare_weight_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Compare_weight_2.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Compare_weight_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Compare_x_2.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Compare_x_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Compare_x_2.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Compare_x_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Compare_y_2.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Compare_y_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Compare_y_2.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Compare_y_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Constructions_C2.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Constructions_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Constructions_C2.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Constructions_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Constructions_ftC2.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Constructions_ftC2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Constructions_ftC2.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Constructions_ftC2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Constructions_rtH2.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Constructions_rtH2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Constructions_rtH2.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Constructions_rtH2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Finite_edge_test8_C2.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Finite_edge_test8_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Finite_edge_test8_C2.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Finite_edge_test8_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Finite_edge_test_C2.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Finite_edge_test_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Finite_edge_test_C2.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Finite_edge_test_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Incircle8_C2.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Incircle8_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Incircle8_C2.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Incircle8_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Incircle_C2.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Incircle_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Incircle_C2.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Incircle_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Infinite_edge_test_C2.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Infinite_edge_test_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Infinite_edge_test_C2.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Infinite_edge_test_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Is_degenerate_edge_C2.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Is_degenerate_edge_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Is_degenerate_edge_C2.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Is_degenerate_edge_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Is_hidden_C2.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Is_hidden_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Is_hidden_C2.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Is_hidden_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Kernel_wrapper_2.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Kernel_wrapper_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Kernel_wrapper_2.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Kernel_wrapper_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Orientation8_C2.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Orientation8_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Orientation8_C2.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Orientation8_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Orientation_2.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Orientation_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Orientation_2.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Orientation_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Oriented_side_of_bisector_C2.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Oriented_side_of_bisector_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Oriented_side_of_bisector_C2.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Oriented_side_of_bisector_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Predicate_constructions_C2.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Predicate_constructions_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Predicate_constructions_C2.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Predicate_constructions_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Predicates_C2.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Predicates_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Predicates_C2.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Predicates_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Traits_wrapper_2.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Traits_wrapper_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/Traits_wrapper_2.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_2/Traits_wrapper_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/basic.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_2/basic.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/basic.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_2/basic.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/check_filter.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_2/check_filter.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/check_filter.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_2/check_filter.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/comparator_profiler.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_2/comparator_profiler.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/comparator_profiler.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_2/comparator_profiler.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/compare_quadratic.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_2/compare_quadratic.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/compare_quadratic.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_2/compare_quadratic.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/predicate_profiler.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_2/predicate_profiler.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/predicate_profiler.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_2/predicate_profiler.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/uncertain/Uncertain_is_hidden_C2.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_2/uncertain/Uncertain_is_hidden_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/uncertain/Uncertain_is_hidden_C2.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_2/uncertain/Uncertain_is_hidden_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/uncertain/Uncertain_oriented_side_of_bisector_C2.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_2/uncertain/Uncertain_oriented_side_of_bisector_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/uncertain/Uncertain_oriented_side_of_bisector_C2.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_2/uncertain/Uncertain_oriented_side_of_bisector_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/uncertain/Uncertain_vertex_conflict_2.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_2/uncertain/Uncertain_vertex_conflict_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/uncertain/Uncertain_vertex_conflict_2.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_2/uncertain/Uncertain_vertex_conflict_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/uncertain/uncertain_functions_on_signs.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_2/uncertain/uncertain_functions_on_signs.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_2/uncertain/uncertain_functions_on_signs.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_2/uncertain/uncertain_functions_on_signs.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_adaptation_policies_2.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_adaptation_policies_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_adaptation_policies_2.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_adaptation_policies_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_adaptation_traits_2.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_adaptation_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_adaptation_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_adaptation_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_data_structure_2.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_data_structure_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_data_structure_2.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_data_structure_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_filtered_traits_2.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_filtered_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_filtered_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_filtered_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_hierarchy_2.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_hierarchy_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_hierarchy_2.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_hierarchy_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_hierarchy_vertex_base_2.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_hierarchy_vertex_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_hierarchy_vertex_base_2.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_hierarchy_vertex_base_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_traits_2.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_vertex_base_2.h b/3rdparty/CGAL/include/CGAL/Apollonius_graph_vertex_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_graph_vertex_base_2.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_graph_vertex_base_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Apollonius_site_2.h b/3rdparty/CGAL/include/CGAL/Apollonius_site_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Apollonius_site_2.h
rename to 3rdparty/CGAL/include/CGAL/Apollonius_site_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Approximate_min_ellipsoid_d.h b/3rdparty/CGAL/include/CGAL/Approximate_min_ellipsoid_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Approximate_min_ellipsoid_d.h
rename to 3rdparty/CGAL/include/CGAL/Approximate_min_ellipsoid_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Approximate_min_ellipsoid_d/Approximate_min_ellipsoid_d_configure.h b/3rdparty/CGAL/include/CGAL/Approximate_min_ellipsoid_d/Approximate_min_ellipsoid_d_configure.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Approximate_min_ellipsoid_d/Approximate_min_ellipsoid_d_configure.h
rename to 3rdparty/CGAL/include/CGAL/Approximate_min_ellipsoid_d/Approximate_min_ellipsoid_d_configure.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Approximate_min_ellipsoid_d/Approximate_min_ellipsoid_d_debug.h b/3rdparty/CGAL/include/CGAL/Approximate_min_ellipsoid_d/Approximate_min_ellipsoid_d_debug.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Approximate_min_ellipsoid_d/Approximate_min_ellipsoid_d_debug.h
rename to 3rdparty/CGAL/include/CGAL/Approximate_min_ellipsoid_d/Approximate_min_ellipsoid_d_debug.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Approximate_min_ellipsoid_d/Approximate_min_ellipsoid_d_impl.h b/3rdparty/CGAL/include/CGAL/Approximate_min_ellipsoid_d/Approximate_min_ellipsoid_d_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Approximate_min_ellipsoid_d/Approximate_min_ellipsoid_d_impl.h
rename to 3rdparty/CGAL/include/CGAL/Approximate_min_ellipsoid_d/Approximate_min_ellipsoid_d_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Approximate_min_ellipsoid_d/Khachiyan_approximation.h b/3rdparty/CGAL/include/CGAL/Approximate_min_ellipsoid_d/Khachiyan_approximation.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Approximate_min_ellipsoid_d/Khachiyan_approximation.h
rename to 3rdparty/CGAL/include/CGAL/Approximate_min_ellipsoid_d/Khachiyan_approximation.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Approximate_min_ellipsoid_d/Khachiyan_approximation_impl.h b/3rdparty/CGAL/include/CGAL/Approximate_min_ellipsoid_d/Khachiyan_approximation_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Approximate_min_ellipsoid_d/Khachiyan_approximation_impl.h
rename to 3rdparty/CGAL/include/CGAL/Approximate_min_ellipsoid_d/Khachiyan_approximation_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Approximate_min_ellipsoid_d_traits_2.h b/3rdparty/CGAL/include/CGAL/Approximate_min_ellipsoid_d_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Approximate_min_ellipsoid_d_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Approximate_min_ellipsoid_d_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Approximate_min_ellipsoid_d_traits_3.h b/3rdparty/CGAL/include/CGAL/Approximate_min_ellipsoid_d_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Approximate_min_ellipsoid_d_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/Approximate_min_ellipsoid_d_traits_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Approximate_min_ellipsoid_d_traits_d.h b/3rdparty/CGAL/include/CGAL/Approximate_min_ellipsoid_d_traits_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Approximate_min_ellipsoid_d_traits_d.h
rename to 3rdparty/CGAL/include/CGAL/Approximate_min_ellipsoid_d_traits_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arithmetic_kernel.h b/3rdparty/CGAL/include/CGAL/Arithmetic_kernel.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arithmetic_kernel.h
rename to 3rdparty/CGAL/include/CGAL/Arithmetic_kernel.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arithmetic_kernel/Arithmetic_kernel_base.h b/3rdparty/CGAL/include/CGAL/Arithmetic_kernel/Arithmetic_kernel_base.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arithmetic_kernel/Arithmetic_kernel_base.h
rename to 3rdparty/CGAL/include/CGAL/Arithmetic_kernel/Arithmetic_kernel_base.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_Bezier_curve_traits_2.h b/3rdparty/CGAL/include/CGAL/Arr_Bezier_curve_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_Bezier_curve_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_Bezier_curve_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_accessor.h b/3rdparty/CGAL/include/CGAL/Arr_accessor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_accessor.h
rename to 3rdparty/CGAL/include/CGAL/Arr_accessor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_algebraic_segment_traits_2.h b/3rdparty/CGAL/include/CGAL/Arr_algebraic_segment_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_algebraic_segment_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_algebraic_segment_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_batched_point_location.h b/3rdparty/CGAL/include/CGAL/Arr_batched_point_location.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_batched_point_location.h
rename to 3rdparty/CGAL/include/CGAL/Arr_batched_point_location.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_bounded_planar_topology_traits_2.h b/3rdparty/CGAL/include/CGAL/Arr_bounded_planar_topology_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_bounded_planar_topology_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_bounded_planar_topology_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_circle_segment_traits_2.h b/3rdparty/CGAL/include/CGAL/Arr_circle_segment_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_circle_segment_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_circle_segment_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_circular_arc_traits_2.h b/3rdparty/CGAL/include/CGAL/Arr_circular_arc_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_circular_arc_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_circular_arc_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_circular_line_arc_traits_2.h b/3rdparty/CGAL/include/CGAL/Arr_circular_line_arc_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_circular_line_arc_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_circular_line_arc_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_conic_traits_2.h b/3rdparty/CGAL/include/CGAL/Arr_conic_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_conic_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_conic_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_consolidated_curve_data_traits_2.h b/3rdparty/CGAL/include/CGAL/Arr_consolidated_curve_data_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_consolidated_curve_data_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_consolidated_curve_data_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_counting_traits_2.h b/3rdparty/CGAL/include/CGAL/Arr_counting_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_counting_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_counting_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_curve_data_traits_2.h b/3rdparty/CGAL/include/CGAL/Arr_curve_data_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_curve_data_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_curve_data_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_dcel_base.h b/3rdparty/CGAL/include/CGAL/Arr_dcel_base.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_dcel_base.h
rename to 3rdparty/CGAL/include/CGAL/Arr_dcel_base.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_default_dcel.h b/3rdparty/CGAL/include/CGAL/Arr_default_dcel.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_default_dcel.h
rename to 3rdparty/CGAL/include/CGAL/Arr_default_dcel.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_default_overlay_traits.h b/3rdparty/CGAL/include/CGAL/Arr_default_overlay_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_default_overlay_traits.h
rename to 3rdparty/CGAL/include/CGAL/Arr_default_overlay_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_directional_non_caching_segment_basic_traits_2.h b/3rdparty/CGAL/include/CGAL/Arr_directional_non_caching_segment_basic_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_directional_non_caching_segment_basic_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_directional_non_caching_segment_basic_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_enums.h b/3rdparty/CGAL/include/CGAL/Arr_enums.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_enums.h
rename to 3rdparty/CGAL/include/CGAL/Arr_enums.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_extended_dcel.h b/3rdparty/CGAL/include/CGAL/Arr_extended_dcel.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_extended_dcel.h
rename to 3rdparty/CGAL/include/CGAL/Arr_extended_dcel.h
diff --git a/3rdparty/CGAL/include/CGAL/Arr_face_index_map.h b/3rdparty/CGAL/include/CGAL/Arr_face_index_map.h
new file mode 100644
index 0000000..8ecdda1
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Arr_face_index_map.h
@@ -0,0 +1,277 @@
+// Copyright (c) 2010,2011 Tel-Aviv University (Israel).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Ron Wein          <wein at post.tau.ac.il>
+
+#ifndef CGAL_ARR_FACE_INDEX_MAP_H
+#define CGAL_ARR_FACE_INDEX_MAP_H
+
+/*! \file
+ * Definition of the Arr_face_index_map<Arrangement> class.
+ */
+
+#include <CGAL/Arr_observer.h>
+#include <CGAL/Unique_hash_map.h>
+#include <CGAL/property_map.h>
+
+#include <boost/graph/properties.hpp>
+
+namespace CGAL {
+
+/*! \class
+ * An auxiliary class that automatically maintains a mapping of the
+ * arrangement faces to the indices 0, ..., (n -1), where n is the number
+ * of faces in the arrangement.
+ */
+template <class Arrangement_>
+class Arr_face_index_map : public Arr_observer<Arrangement_>
+{
+public:
+
+  typedef Arrangement_                            Arrangement_2;
+  typedef typename Arrangement_2::Face_handle     Face_handle;
+
+  // Boost property type definitions:
+  typedef boost::readable_property_map_tag        category;
+  typedef unsigned int                            value_type;
+  typedef value_type                              reference;
+  typedef Face_handle                             key_type;
+
+private:
+
+  typedef Arr_face_index_map<Arrangement_2>       Self;
+  typedef Arr_observer<Arrangement_2>             Base;
+
+  typedef Unique_hash_map<Face_handle, unsigned int>     Index_map;
+
+  // Data members:
+  unsigned int                n_faces;     // The current number of faces.
+  Index_map                   index_map;   // Mapping faces to indices.
+  std::vector<Face_handle>    rev_map;     // Mapping indices to faces.
+
+  enum {MIN_REV_MAP_SIZE = 32};
+
+public:
+
+  /*! Default constructor. */
+  Arr_face_index_map () :
+    Base (),
+    n_faces (0),
+    rev_map (MIN_REV_MAP_SIZE)
+  {}
+
+  /*! Constructor with an associated arrangement. */
+  Arr_face_index_map (const Arrangement_2& arr) :
+    Base (const_cast<Arrangement_2&> (arr))
+  {
+    _init();
+  }
+
+  /*! Copy constructor. */
+  Arr_face_index_map (const Self& other) :
+    Base (const_cast<Arrangement_2&> (*(other.arrangement())))
+  {
+    _init();
+  }
+
+  /*! Assignment operator. */
+  Self& operator= (const Self& other)
+  {
+    if (this == &other)
+      return (*this);
+
+    this->detach();
+    this->attach (const_cast<Arrangement_2&> (*(other.arrangement())));
+
+    return (*this);
+  }
+
+  /*!
+   * Get the index of a given face.
+   * \param f A handle to the face.
+   * \pre f is a valid face in the arrangement.
+   */
+  unsigned int operator[] (Face_handle f) const
+  {
+    return (index_map[f]);
+  }
+
+  /*!
+   * Get the face given its index.
+   * \param i The index of the face.
+   * \pre i is less than the number of faces in the arrangement.
+   */
+  Face_handle face (const int i) const
+  {
+    CGAL_precondition((unsigned int) i < n_faces);
+
+    return (rev_map[i]);
+  }
+
+  /// \name Notification functions, to keep the mapping up-to-date.
+  //@{
+
+  /*!
+   * Update the mapping after the arrangement has been assigned with another
+   * arrangement.
+   */
+  virtual void after_assign ()
+  {
+    _init();
+  }
+
+  /*!
+   * Update the mapping after the arrangement is cleared.
+   */
+  virtual void after_clear ()
+  {
+    _init();
+  }
+
+  /*!
+   * Update the mapping after attaching to a new arrangement.
+   */
+  virtual void after_attach ()
+  {
+    _init();
+  }
+
+  /*!
+   * Update the mapping after detaching the arrangement.
+   */
+  virtual void after_detach ()
+  {
+    n_faces = 0;
+    index_map.clear();
+  }
+
+  /*!
+   * Update the mapping after the creation of a new face is split from another
+   * face.
+   * \param f A handle to the existing face.
+   * \param new_f A handle to the newly created face.
+   */
+  virtual void after_split_face (Face_handle /* f */,
+                                 Face_handle new_f,
+                                 bool /* is_hole */)
+  {
+    // Update the number of vertices.
+    n_faces++;
+
+    // If necessary, allocate memory for the reverse mapping.
+    if (rev_map.size() < n_faces)
+      rev_map.resize(2 * n_faces);
+
+    // Update the mapping of the newly created face.
+    index_map[new_f] = n_faces - 1;
+    rev_map[n_faces - 1] = new_f;
+
+    return;
+  }
+
+  /*!
+   * Update the mapping before the merge of two faces.
+   * \param f1 A handle to the face that is going to remain.
+   * \param f2 A handle to the face that is about to be removed.
+   */
+  virtual void before_merge_face (Face_handle /* f1 */,
+                                  Face_handle f2,
+                                  typename
+				  Arrangement_2::Halfedge_handle /* e */)
+  {
+    // Update the number of faces.
+    n_faces--;
+    
+    // Reduce memory consumption in case the number of faces has
+    // drastically decreased.
+    if (2*n_faces+1 < rev_map.size() && 
+	rev_map.size() / 2 >= MIN_REV_MAP_SIZE)
+    {
+      rev_map.resize (rev_map.size() / 2);
+    }
+
+    // Get the current face index, and assign this index to the face
+    // currently indexed (n - 1).
+    unsigned int   index = index_map[f2];
+
+    if (index == n_faces)
+      return;
+    
+    Face_handle    last_f = rev_map[n_faces];
+    index_map[last_f] = index;
+    rev_map[index] = last_f;
+
+    // Clear the reverse mapping for the last face.
+    rev_map[n_faces] = Face_handle();
+
+    return;
+  }
+  //@}
+
+private:
+  
+  /*! Initialize the map for the given arrangement. */
+  void _init ()
+  {
+    // Get the number of faces and allocate the reverse map accordingly.
+    n_faces = static_cast<unsigned int>(this->arrangement()->number_of_faces());
+    
+    if (n_faces < MIN_REV_MAP_SIZE)
+      rev_map.resize (MIN_REV_MAP_SIZE);
+    else
+      rev_map.resize (n_faces);
+
+    // Clear the current mapping.
+    index_map.clear();
+
+    // Create the initial mapping. 
+    typename Arrangement_2::Face_iterator     fit;
+    Face_handle                               fh;
+    unsigned int                              index = 0;
+
+    for (fit = this->arrangement()->faces_begin();
+	 fit != this->arrangement()->faces_end(); ++fit, ++index)
+    {
+      // Map the current face to the current index.
+      fh = fit;
+      index_map[fh] = index;
+      rev_map[index] = fh;
+    }
+
+    return;
+  }  
+
+};
+
+/*!
+ * Get the index property-map function. Provided so that boost is able to
+ * access the Arr_face_index_map above.
+ * \param index_map The index map.
+ * \param f A face handle.
+ * \return The face index.
+ */
+template<class Arrangement>
+unsigned int get (const CGAL::Arr_face_index_map<Arrangement>& index_map,
+		  typename Arrangement::Face_handle f) 
+{ 
+  return (index_map[f]);
+}
+
+} //namespace CGAL
+
+#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_face_map.h b/3rdparty/CGAL/include/CGAL/Arr_face_map.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_face_map.h
rename to 3rdparty/CGAL/include/CGAL/Arr_face_map.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_geodesic_arc_on_sphere_partition_traits_2.h b/3rdparty/CGAL/include/CGAL/Arr_geodesic_arc_on_sphere_partition_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_geodesic_arc_on_sphere_partition_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_geodesic_arc_on_sphere_partition_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_geodesic_arc_on_sphere_traits_2.h b/3rdparty/CGAL/include/CGAL/Arr_geodesic_arc_on_sphere_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_geodesic_arc_on_sphere_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_geodesic_arc_on_sphere_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/Arr_plane_3.h b/3rdparty/CGAL/include/CGAL/Arr_geometry_traits/Arr_plane_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/Arr_plane_3.h
rename to 3rdparty/CGAL/include/CGAL/Arr_geometry_traits/Arr_plane_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/Bezier_bounding_rational_traits.h b/3rdparty/CGAL/include/CGAL/Arr_geometry_traits/Bezier_bounding_rational_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/Bezier_bounding_rational_traits.h
rename to 3rdparty/CGAL/include/CGAL/Arr_geometry_traits/Bezier_bounding_rational_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/Bezier_cache.h b/3rdparty/CGAL/include/CGAL/Arr_geometry_traits/Bezier_cache.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/Bezier_cache.h
rename to 3rdparty/CGAL/include/CGAL/Arr_geometry_traits/Bezier_cache.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/Bezier_curve_2.h b/3rdparty/CGAL/include/CGAL/Arr_geometry_traits/Bezier_curve_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/Bezier_curve_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_geometry_traits/Bezier_curve_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/Bezier_point_2.h b/3rdparty/CGAL/include/CGAL/Arr_geometry_traits/Bezier_point_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/Bezier_point_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_geometry_traits/Bezier_point_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/Bezier_x_monotone_2.h b/3rdparty/CGAL/include/CGAL/Arr_geometry_traits/Bezier_x_monotone_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/Bezier_x_monotone_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_geometry_traits/Bezier_x_monotone_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/Circle_segment_2.h b/3rdparty/CGAL/include/CGAL/Arr_geometry_traits/Circle_segment_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/Circle_segment_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_geometry_traits/Circle_segment_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/Conic_arc_2.h b/3rdparty/CGAL/include/CGAL/Arr_geometry_traits/Conic_arc_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/Conic_arc_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_geometry_traits/Conic_arc_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/Conic_intersections_2.h b/3rdparty/CGAL/include/CGAL/Arr_geometry_traits/Conic_intersections_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/Conic_intersections_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_geometry_traits/Conic_intersections_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/Conic_point_2.h b/3rdparty/CGAL/include/CGAL/Arr_geometry_traits/Conic_point_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/Conic_point_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_geometry_traits/Conic_point_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/Conic_x_monotone_arc_2.h b/3rdparty/CGAL/include/CGAL/Arr_geometry_traits/Conic_x_monotone_arc_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/Conic_x_monotone_arc_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_geometry_traits/Conic_x_monotone_arc_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/Consolidated_curve_data_aux.h b/3rdparty/CGAL/include/CGAL/Arr_geometry_traits/Consolidated_curve_data_aux.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/Consolidated_curve_data_aux.h
rename to 3rdparty/CGAL/include/CGAL/Arr_geometry_traits/Consolidated_curve_data_aux.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/Curve_data_aux.h b/3rdparty/CGAL/include/CGAL/Arr_geometry_traits/Curve_data_aux.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/Curve_data_aux.h
rename to 3rdparty/CGAL/include/CGAL/Arr_geometry_traits/Curve_data_aux.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/Hyperbolic_arc_2.h b/3rdparty/CGAL/include/CGAL/Arr_geometry_traits/Hyperbolic_arc_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/Hyperbolic_arc_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_geometry_traits/Hyperbolic_arc_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/IO/Polycurve_2_iostream.h b/3rdparty/CGAL/include/CGAL/Arr_geometry_traits/IO/Polycurve_2_iostream.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/IO/Polycurve_2_iostream.h
rename to 3rdparty/CGAL/include/CGAL/Arr_geometry_traits/IO/Polycurve_2_iostream.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/Polycurve_2.h b/3rdparty/CGAL/include/CGAL/Arr_geometry_traits/Polycurve_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/Polycurve_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_geometry_traits/Polycurve_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/Polyline_2.h b/3rdparty/CGAL/include/CGAL/Arr_geometry_traits/Polyline_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/Polyline_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_geometry_traits/Polyline_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/Rational_arc_2.h b/3rdparty/CGAL/include/CGAL/Arr_geometry_traits/Rational_arc_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/Rational_arc_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_geometry_traits/Rational_arc_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/Segment_assertions.h b/3rdparty/CGAL/include/CGAL/Arr_geometry_traits/Segment_assertions.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/Segment_assertions.h
rename to 3rdparty/CGAL/include/CGAL/Arr_geometry_traits/Segment_assertions.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/de_Casteljau_2.h b/3rdparty/CGAL/include/CGAL/Arr_geometry_traits/de_Casteljau_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_geometry_traits/de_Casteljau_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_geometry_traits/de_Casteljau_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_landmarks_point_location.h b/3rdparty/CGAL/include/CGAL/Arr_landmarks_point_location.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_landmarks_point_location.h
rename to 3rdparty/CGAL/include/CGAL/Arr_landmarks_point_location.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_line_arc_traits_2.h b/3rdparty/CGAL/include/CGAL/Arr_line_arc_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_line_arc_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_line_arc_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_linear_traits_2.h b/3rdparty/CGAL/include/CGAL/Arr_linear_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_linear_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_linear_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_naive_point_location.h b/3rdparty/CGAL/include/CGAL/Arr_naive_point_location.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_naive_point_location.h
rename to 3rdparty/CGAL/include/CGAL/Arr_naive_point_location.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_non_caching_segment_basic_traits_2.h b/3rdparty/CGAL/include/CGAL/Arr_non_caching_segment_basic_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_non_caching_segment_basic_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_non_caching_segment_basic_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_non_caching_segment_traits_2.h b/3rdparty/CGAL/include/CGAL/Arr_non_caching_segment_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_non_caching_segment_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_non_caching_segment_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_observer.h b/3rdparty/CGAL/include/CGAL/Arr_observer.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_observer.h
rename to 3rdparty/CGAL/include/CGAL/Arr_observer.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_overlay.h b/3rdparty/CGAL/include/CGAL/Arr_overlay.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_overlay.h
rename to 3rdparty/CGAL/include/CGAL/Arr_overlay.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_overlay_2.h b/3rdparty/CGAL/include/CGAL/Arr_overlay_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_overlay_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_overlay_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Arr_batched_point_location_traits_2.h b/3rdparty/CGAL/include/CGAL/Arr_point_location/Arr_batched_point_location_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Arr_batched_point_location_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_point_location/Arr_batched_point_location_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Arr_landmarks_pl_impl.h b/3rdparty/CGAL/include/CGAL/Arr_point_location/Arr_landmarks_pl_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Arr_landmarks_pl_impl.h
rename to 3rdparty/CGAL/include/CGAL/Arr_point_location/Arr_landmarks_pl_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Arr_lm_generator_base.h b/3rdparty/CGAL/include/CGAL/Arr_point_location/Arr_lm_generator_base.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Arr_lm_generator_base.h
rename to 3rdparty/CGAL/include/CGAL/Arr_point_location/Arr_lm_generator_base.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Arr_lm_grid_generator.h b/3rdparty/CGAL/include/CGAL/Arr_point_location/Arr_lm_grid_generator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Arr_lm_grid_generator.h
rename to 3rdparty/CGAL/include/CGAL/Arr_point_location/Arr_lm_grid_generator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Arr_lm_halton_generator.h b/3rdparty/CGAL/include/CGAL/Arr_point_location/Arr_lm_halton_generator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Arr_lm_halton_generator.h
rename to 3rdparty/CGAL/include/CGAL/Arr_point_location/Arr_lm_halton_generator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Arr_lm_middle_edges_generator.h b/3rdparty/CGAL/include/CGAL/Arr_point_location/Arr_lm_middle_edges_generator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Arr_lm_middle_edges_generator.h
rename to 3rdparty/CGAL/include/CGAL/Arr_point_location/Arr_lm_middle_edges_generator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Arr_lm_nearest_neighbor.h b/3rdparty/CGAL/include/CGAL/Arr_point_location/Arr_lm_nearest_neighbor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Arr_lm_nearest_neighbor.h
rename to 3rdparty/CGAL/include/CGAL/Arr_point_location/Arr_lm_nearest_neighbor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Arr_lm_random_generator.h b/3rdparty/CGAL/include/CGAL/Arr_point_location/Arr_lm_random_generator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Arr_lm_random_generator.h
rename to 3rdparty/CGAL/include/CGAL/Arr_point_location/Arr_lm_random_generator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Arr_lm_specified_points_generator.h b/3rdparty/CGAL/include/CGAL/Arr_point_location/Arr_lm_specified_points_generator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Arr_lm_specified_points_generator.h
rename to 3rdparty/CGAL/include/CGAL/Arr_point_location/Arr_lm_specified_points_generator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Arr_lm_vertices_generator.h b/3rdparty/CGAL/include/CGAL/Arr_point_location/Arr_lm_vertices_generator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Arr_lm_vertices_generator.h
rename to 3rdparty/CGAL/include/CGAL/Arr_point_location/Arr_lm_vertices_generator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Arr_naive_point_location_impl.h b/3rdparty/CGAL/include/CGAL/Arr_point_location/Arr_naive_point_location_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Arr_naive_point_location_impl.h
rename to 3rdparty/CGAL/include/CGAL/Arr_point_location/Arr_naive_point_location_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Arr_simple_point_location_impl.h b/3rdparty/CGAL/include/CGAL/Arr_point_location/Arr_simple_point_location_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Arr_simple_point_location_impl.h
rename to 3rdparty/CGAL/include/CGAL/Arr_point_location/Arr_simple_point_location_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Arr_trapezoid_ric_pl_impl.h b/3rdparty/CGAL/include/CGAL/Arr_point_location/Arr_trapezoid_ric_pl_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Arr_trapezoid_ric_pl_impl.h
rename to 3rdparty/CGAL/include/CGAL/Arr_point_location/Arr_trapezoid_ric_pl_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Arr_triangulation_pl_functions.h b/3rdparty/CGAL/include/CGAL/Arr_point_location/Arr_triangulation_pl_functions.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Arr_triangulation_pl_functions.h
rename to 3rdparty/CGAL/include/CGAL/Arr_point_location/Arr_triangulation_pl_functions.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Arr_triangulation_pl_impl.h b/3rdparty/CGAL/include/CGAL/Arr_point_location/Arr_triangulation_pl_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Arr_triangulation_pl_impl.h
rename to 3rdparty/CGAL/include/CGAL/Arr_point_location/Arr_triangulation_pl_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Arr_walk_along_line_pl_impl.h b/3rdparty/CGAL/include/CGAL/Arr_point_location/Arr_walk_along_line_pl_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Arr_walk_along_line_pl_impl.h
rename to 3rdparty/CGAL/include/CGAL/Arr_point_location/Arr_walk_along_line_pl_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Td_X_trapezoid.h b/3rdparty/CGAL/include/CGAL/Arr_point_location/Td_X_trapezoid.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Td_X_trapezoid.h
rename to 3rdparty/CGAL/include/CGAL/Arr_point_location/Td_X_trapezoid.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Td_active_edge.h b/3rdparty/CGAL/include/CGAL/Arr_point_location/Td_active_edge.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Td_active_edge.h
rename to 3rdparty/CGAL/include/CGAL/Arr_point_location/Td_active_edge.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Td_active_fictitious_vertex.h b/3rdparty/CGAL/include/CGAL/Arr_point_location/Td_active_fictitious_vertex.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Td_active_fictitious_vertex.h
rename to 3rdparty/CGAL/include/CGAL/Arr_point_location/Td_active_fictitious_vertex.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Td_active_trapezoid.h b/3rdparty/CGAL/include/CGAL/Arr_point_location/Td_active_trapezoid.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Td_active_trapezoid.h
rename to 3rdparty/CGAL/include/CGAL/Arr_point_location/Td_active_trapezoid.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Td_active_vertex.h b/3rdparty/CGAL/include/CGAL/Arr_point_location/Td_active_vertex.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Td_active_vertex.h
rename to 3rdparty/CGAL/include/CGAL/Arr_point_location/Td_active_vertex.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Td_dag.h b/3rdparty/CGAL/include/CGAL/Arr_point_location/Td_dag.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Td_dag.h
rename to 3rdparty/CGAL/include/CGAL/Arr_point_location/Td_dag.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Td_dag_node.h b/3rdparty/CGAL/include/CGAL/Arr_point_location/Td_dag_node.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Td_dag_node.h
rename to 3rdparty/CGAL/include/CGAL/Arr_point_location/Td_dag_node.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Td_inactive_edge.h b/3rdparty/CGAL/include/CGAL/Arr_point_location/Td_inactive_edge.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Td_inactive_edge.h
rename to 3rdparty/CGAL/include/CGAL/Arr_point_location/Td_inactive_edge.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Td_inactive_fictitious_vertex.h b/3rdparty/CGAL/include/CGAL/Arr_point_location/Td_inactive_fictitious_vertex.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Td_inactive_fictitious_vertex.h
rename to 3rdparty/CGAL/include/CGAL/Arr_point_location/Td_inactive_fictitious_vertex.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Td_inactive_trapezoid.h b/3rdparty/CGAL/include/CGAL/Arr_point_location/Td_inactive_trapezoid.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Td_inactive_trapezoid.h
rename to 3rdparty/CGAL/include/CGAL/Arr_point_location/Td_inactive_trapezoid.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Td_inactive_vertex.h b/3rdparty/CGAL/include/CGAL/Arr_point_location/Td_inactive_vertex.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Td_inactive_vertex.h
rename to 3rdparty/CGAL/include/CGAL/Arr_point_location/Td_inactive_vertex.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Td_ninetuple.h b/3rdparty/CGAL/include/CGAL/Arr_point_location/Td_ninetuple.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Td_ninetuple.h
rename to 3rdparty/CGAL/include/CGAL/Arr_point_location/Td_ninetuple.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Td_predicates.h b/3rdparty/CGAL/include/CGAL/Arr_point_location/Td_predicates.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Td_predicates.h
rename to 3rdparty/CGAL/include/CGAL/Arr_point_location/Td_predicates.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Td_traits.h b/3rdparty/CGAL/include/CGAL/Arr_point_location/Td_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Td_traits.h
rename to 3rdparty/CGAL/include/CGAL/Arr_point_location/Td_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Td_traits_functions.h b/3rdparty/CGAL/include/CGAL/Arr_point_location/Td_traits_functions.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Td_traits_functions.h
rename to 3rdparty/CGAL/include/CGAL/Arr_point_location/Td_traits_functions.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2.h b/3rdparty/CGAL/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2_impl.h b/3rdparty/CGAL/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2_impl.h
rename to 3rdparty/CGAL/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2_iostream.h b/3rdparty/CGAL/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2_iostream.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2_iostream.h
rename to 3rdparty/CGAL/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2_iostream.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2_misc.h b/3rdparty/CGAL/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2_misc.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2_misc.h
rename to 3rdparty/CGAL/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2_misc.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_point_location_result.h b/3rdparty/CGAL/include/CGAL/Arr_point_location_result.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_point_location_result.h
rename to 3rdparty/CGAL/include/CGAL/Arr_point_location_result.h
diff --git a/3rdparty/CGAL/include/CGAL/Arr_polycurve_basic_traits_2.h b/3rdparty/CGAL/include/CGAL/Arr_polycurve_basic_traits_2.h
new file mode 100644
index 0000000..a84db26
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Arr_polycurve_basic_traits_2.h
@@ -0,0 +1,2724 @@
+// Copyright (c) 2006,2007,2008,2009,2010,2011 Tel-Aviv University(Israel).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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.
+//
+// Author(s)     : Efi Fogel <efif at post.tau.ac.il>
+//                 Ron Wein  <wein at post.tau.ac.il>
+//                 Dror Atariah <dror.atariah at fu-berlin.de>
+//                 Waqar Khan <wkhan at mpi-inf.mpg.de>
+
+#ifndef CGAL_ARR_POLYCURVE_BASIC_TRAITS_2_H
+#define CGAL_ARR_POLYCURVE_BASIC_TRAITS_2_H
+
+/*! \file
+ * The traits-class for the general piece-wise (polycurve) type of curves of the
+ * arrangement package.
+ */
+
+#include <iterator>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/utility/enable_if.hpp>
+
+#include <CGAL/basic.h>
+#include <CGAL/tags.h>
+#include <CGAL/Arr_non_caching_segment_traits_2.h>
+#include <CGAL/Arr_geometry_traits/Polycurve_2.h>
+#include <CGAL/Arr_geometry_traits/IO/Polycurve_2_iostream.h>
+#include <CGAL/Arr_tags.h>
+#include <CGAL/Arr_enums.h>
+
+namespace CGAL {
+
+template <typename SubcurveTraits_2 = Arr_non_caching_segment_traits_2<> >
+class Arr_polycurve_basic_traits_2 {
+public:
+  typedef SubcurveTraits_2                                 Subcurve_traits_2;
+
+  /// \name Types and functors inherited from the subcurve geometry traits.
+  //@{
+
+  typedef typename Subcurve_traits_2::Has_left_category    Has_left_category;
+  typedef typename Subcurve_traits_2::Has_do_intersect_category
+    Has_do_intersect_category;
+
+  typedef typename Subcurve_traits_2::Left_side_category   Left_side_category;
+  typedef typename Subcurve_traits_2::Bottom_side_category Bottom_side_category;
+  typedef typename Subcurve_traits_2::Top_side_category    Top_side_category;
+  typedef typename Subcurve_traits_2::Right_side_category  Right_side_category;
+
+  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;
+
+  typedef typename Subcurve_traits_2::Point_2              Point_2;
+  typedef typename Subcurve_traits_2::X_monotone_curve_2   X_monotone_subcurve_2;
+
+  //@}
+
+  // Backward compatibility:
+  typedef X_monotone_subcurve_2                            X_monotone_segment_2;
+
+private:
+  typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>  Self;
+
+  // Data members:
+  const Subcurve_traits_2* m_subcurve_traits;  // The base segment-traits class.
+  bool m_own_traits;
+
+protected:
+  enum { INVALID_INDEX = 0xffffffff };
+
+public:
+  /*! Construct default. */
+  Arr_polycurve_basic_traits_2() :
+    m_subcurve_traits(new Subcurve_traits_2()),
+    m_own_traits(true)
+  {}
+
+  /*! Construct from a subcurve traits.
+   * \param seg_traits an already existing subcurve tarits which is passed will
+   *        be used by the class.
+   */
+  Arr_polycurve_basic_traits_2(const Subcurve_traits_2* geom_traits) :
+    m_subcurve_traits(geom_traits), m_own_traits(false) {}
+
+  /*! Construct copy.
+   * If the 'other' polycurve traits owns its subcurve traits, then make
+   * this polycurve traits own its subcurve traits as well
+   * \param other the other traits.
+   */
+  Arr_polycurve_basic_traits_2(const Arr_polycurve_basic_traits_2& other)
+  {
+    m_subcurve_traits = (other.m_own_traits) ?
+      new Subcurve_traits_2() : other.m_subcurve_traits;
+    m_own_traits = other.m_own_traits;
+  }
+
+  /* Destructor
+   * Deletes the subcurve tarits class in case it was constructed during the
+   * construction of this.
+   */
+  ~Arr_polycurve_basic_traits_2()
+  { if (m_own_traits) delete m_subcurve_traits; }
+
+  /*! Obtain the subcurve traits.
+   * \return the subcurve traits.
+   */
+  const Subcurve_traits_2* subcurve_traits_2() const
+  { return m_subcurve_traits; }
+
+  /// \name Types and functors defined here, required by the
+  // ArrangementBasicTraits concept.
+  //@{
+
+  /*! An x monotone polycurve represents a continuous piecewise-linear
+   * curve which is either strongly x-monotone or vertical. Again,
+   * the polycurve is without degenerated subcurves.
+   */
+  typedef internal::X_monotone_polycurve_2<X_monotone_subcurve_2, Point_2>
+                                                           X_monotone_curve_2;
+  typedef typename X_monotone_curve_2::Size                Size;
+  typedef typename X_monotone_curve_2::size_type           size_type;
+
+
+  /*! Compare the x-coordinates of two points. */
+  class Compare_x_2 {
+  protected:
+    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
+      Polycurve_basic_traits_2;
+
+    /*! The polycurve traits (in case it has state). */
+    const Polycurve_basic_traits_2& m_poly_traits;
+
+  public:
+    /*! Constructor. */
+    Compare_x_2(const Polycurve_basic_traits_2& traits) :
+      m_poly_traits(traits)
+    {}
+
+    /*! Compare the x-coordinates of two directional points.
+     * \param p1 the first directional point.
+     * \param p2 the second directional point.
+     * \return SMALLER - x(p1) < x(p2);
+     *         EQUAL   - x(p1) = x(p2);
+     *         LARGER  - x(p1) > x(p2).
+     * \pre p1 does not lie on the boundary.
+     * \pre p2 does not lie on the boundary.
+     */
+    Comparison_result operator()(const Point_2& p1, const Point_2& p2) const
+    { return m_poly_traits.subcurve_traits_2()->compare_x_2_object()(p1, p2); }
+
+    /*! Compare two ends of x-monotone curves in x.
+     * \param xs1 the first curve.
+     * \param ce1 the curve-end indicator of the first x-monotone curve xs1:
+     *            ARR_MIN_END - the minimal end of xs1 or
+     *            ARR_MAX_END - the maximal end of xs1.
+     * \param p2 the second curve end.
+     */
+    Comparison_result operator()(const X_monotone_subcurve_2& xs1,
+                                 Arr_curve_end ce1,
+                                 const Point_2& p2)
+    { return operator()(xs1, ce1, p2, Are_all_sides_oblivious_tag()); }
+
+    /*! Compare two ends of x-monotone curves in x.
+     * \param xs1 the first curve.
+     * \param ce1 the curve-end indicator of the first x-monotone curve xs1:
+     *            ARR_MIN_END - the minimal end of xs1 or
+     *            ARR_MAX_END - the maximal end of xs1.
+     * \param xs2 the second curve.
+     * \param ce2 the curve-end indicator of the second x-monoton curve xs2:
+     *            ARR_MIN_END - the minimal end of xs2 or
+     *            ARR_MAX_END - the maximal end of xs2.
+     */
+    Comparison_result operator()(const X_monotone_subcurve_2& xs1,
+                                 Arr_curve_end ce1,
+                                 const X_monotone_subcurve_2& xs2,
+                                 Arr_curve_end ce2)
+    { return operator()(xs1, ce1, xs2, ce2, Are_all_sides_oblivious_tag()); }
+
+  private:
+    // Oblivious implementation
+    Comparison_result operator()(const X_monotone_subcurve_2& xs1,
+                                 Arr_curve_end ce1,
+                                 const Point_2& p2,
+                                 Arr_all_sides_oblivious_tag) const
+    {
+      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
+      const Point_2& p1 = (ce1 == ARR_MAX_END) ?
+        geom_traits->construct_max_vertex_2_object()(xs1) :
+        geom_traits->construct_min_vertex_2_object()(xs1);
+      return geom_traits->compare_x_2_object()(p1, p2);
+    }
+
+    // Boundary implementation
+    Comparison_result operator()(const X_monotone_subcurve_2& xs1,
+                                 Arr_curve_end ce1,
+                                 const Point_2& p2,
+                                 Arr_not_all_sides_oblivious_tag) const
+    {
+      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
+      typename Subcurve_traits_2::Parameter_space_in_x_2 ps_x =
+        geom_traits->parameter_space_in_x_2_object();
+      const Arr_parameter_space ps_x1 = ps_x(xs1, ce1);
+
+      if (ps_x1 != ARR_INTERIOR) {
+        if (ps_x1 == ARR_LEFT_BOUNDARY) return SMALLER;
+        if (ps_x1 == ARR_RIGHT_BOUNDARY) return LARGER;
+      }
+
+      typename Subcurve_traits_2::Parameter_space_in_y_2 ps_y =
+        geom_traits->parameter_space_in_y_2_object();
+      const Arr_parameter_space ps_y1 = ps_y(xs1, ce1);
+      if (ps_y1 == ARR_INTERIOR) {
+        const Point_2& p1 = (ce1 == ARR_MAX_END) ?
+          geom_traits->construct_max_vertex_2_object()(xs1) :
+          geom_traits->construct_min_vertex_2_object()(xs1);
+        return geom_traits->compare_x_2_object()(p1, p2);
+      }
+      typename Subcurve_traits_2::Compare_x_on_boundary_2 cmp_x_on_bnd =
+        geom_traits->compare_x_on_boundary_2_object();
+      return opposite(cmp_x_on_bnd(p2, xs1, ce1));
+    }
+
+    // Oblivious implementation
+    Comparison_result operator()(const X_monotone_subcurve_2& xs1,
+                                 Arr_curve_end ce1,
+                                 const X_monotone_subcurve_2& xs2,
+                                 Arr_curve_end ce2,
+                                 Arr_all_sides_oblivious_tag) const
+    {
+      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
+      const Point_2& p1 = (ce1 == ARR_MAX_END) ?
+        geom_traits->construct_max_vertex_2_object()(xs1) :
+        geom_traits->construct_min_vertex_2_object()(xs1);
+      const Point_2& p2 = (ce2 == ARR_MAX_END) ?
+        geom_traits->construct_max_vertex_2_object()(xs2) :
+        geom_traits->construct_min_vertex_2_object()(xs2);
+      return geom_traits->compare_x_2_object()(p1, p2);
+    }
+
+    // Boundary implementation
+    Comparison_result operator()(const X_monotone_subcurve_2& xs1,
+                                 Arr_curve_end ce1,
+                                 const X_monotone_subcurve_2& xs2,
+                                 Arr_curve_end ce2,
+                                 Arr_not_all_sides_oblivious_tag) const
+    {
+      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
+      typename Subcurve_traits_2::Parameter_space_in_x_2 ps_x =
+        geom_traits->parameter_space_in_x_2_object();
+      const Arr_parameter_space ps_x1 = ps_x(xs1, ce1);
+      const Arr_parameter_space ps_x2 = ps_x(xs2, ce2);
+
+      if (ps_x1 != ps_x2) {
+        if (ps_x1 == ARR_LEFT_BOUNDARY) return SMALLER;
+        if (ps_x1 == ARR_RIGHT_BOUNDARY) return LARGER;
+        if (ps_x2 == ARR_LEFT_BOUNDARY) return LARGER;
+        if (ps_x2 == ARR_RIGHT_BOUNDARY) return SMALLER;
+      }
+
+      // ps_x1 == ps_x2
+      if (ps_x1 != ARR_INTERIOR) return EQUAL;
+
+      typename Subcurve_traits_2::Parameter_space_in_y_2 ps_y =
+        geom_traits->parameter_space_in_y_2_object();
+      const Arr_parameter_space ps_y1 = ps_y(xs1, ce1);
+      const Arr_parameter_space ps_y2 = ps_y(xs2, ce2);
+      if (ps_y1 == ARR_INTERIOR) {
+        const Point_2& p1 = (ce1 == ARR_MAX_END) ?
+          geom_traits->construct_max_vertex_2_object()(xs1) :
+          geom_traits->construct_min_vertex_2_object()(xs1);
+        if (ps_y2 == ARR_INTERIOR) {
+          const Point_2& p2 = (ce2 == ARR_MAX_END) ?
+            geom_traits->construct_max_vertex_2_object()(xs2) :
+            geom_traits->construct_min_vertex_2_object()(xs2);
+          return geom_traits->compare_x_2_object()(p1, p2);
+        }
+        typename Subcurve_traits_2::Compare_x_on_boundary_2 cmp_x_on_bnd =
+          geom_traits->compare_x_on_boundary_2_object();
+        return cmp_x_on_bnd(p1, xs2, ce2);
+      }
+      if (ps_y2 == ARR_INTERIOR) {
+        const Point_2& p2 = (ce2 == ARR_MAX_END) ?
+          geom_traits->construct_max_vertex_2_object()(xs2) :
+          geom_traits->construct_min_vertex_2_object()(xs2);
+        typename Subcurve_traits_2::Compare_x_on_boundary_2 cmp_x_on_bnd =
+          geom_traits->compare_x_on_boundary_2_object();
+        return opposite(cmp_x_on_bnd(p2, xs1, ce1));
+      }
+      return geom_traits->compare_x_on_boundary_2_object()(xs1, ce1, xs2, ce2);
+    }
+  };
+
+  /*! Obtain a Compare_x_2 functor object. */
+  Compare_x_2 compare_x_2_object() const
+  { return Compare_x_2(*this); }
+
+  /*! Compare two curve-ends or points lexigoraphically: by x, then by y. */
+  class Compare_xy_2 {
+  protected:
+    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
+      Polycurve_basic_traits_2;
+
+    /*! The polycurve traits (in case it has state). */
+    const Polycurve_basic_traits_2& m_poly_traits;
+
+  public:
+    /*! Constructor. */
+    Compare_xy_2(const Polycurve_basic_traits_2& traits) :
+      m_poly_traits(traits)
+    {}
+
+    /*! Compare two directional points lexigoraphically: by x, then by y.
+     * \param p1 the first enpoint directional point.
+     * \param p2 the second endpoint directional point.
+     * \return SMALLER - x(p1) < x(p2);
+     *         SMALLER - x(p1) = x(p2) and y(p1) < y(p2);
+     *         EQUAL   - x(p1) = x(p2) and y(p1) = y(p2);
+     *         LARGER  - x(p1) = x(p2) and y(p1) > y(p2);
+     *         LARGER  - x(p1) > x(p2).
+     * \pre p1 does not lie on the boundary.
+     * \pre p2 does not lie on the boundary.
+     */
+    Comparison_result operator()(const Point_2& p1, const Point_2& p2) const
+    { return m_poly_traits.subcurve_traits_2()->compare_xy_2_object()(p1, p2); }
+
+    /*! Compare two ends of x-monotone curves lexicographically.
+     * \param xs1 the first curve.
+     * \param ce1 the curve-end indicator of the first x-monotone curve xs1:
+     *            ARR_MIN_END - the minimal end of xs1 or
+     *            ARR_MAX_END - the maximal end of xs1.
+     * \param p2 the second curve end.
+     */
+    Comparison_result operator()(const X_monotone_subcurve_2& xs1,
+                                 Arr_curve_end ce1,
+                                 const Point_2& p2)
+    { return operator()(xs1, ce1, p2, Are_all_sides_oblivious_tag()); }
+
+    /*! Compare two ends of x-monotone curves lexicographically.
+     * \param xs1 the first curve.
+     * \param ce1 the curve-end indicator of the first x-monotone curve xs1:
+     *            ARR_MIN_END - the minimal end of xs1 or
+     *            ARR_MAX_END - the maximal end of xs1.
+     * \param xs2 the second curve.
+     * \param ce2 the curve-end indicator of the second x-monoton curve xs2:
+     *            ARR_MIN_END - the minimal end of xs2 or
+     *            ARR_MAX_END - the maximal end of xs2.
+     */
+    Comparison_result operator()(const X_monotone_subcurve_2& xs1,
+                                 Arr_curve_end ce1,
+                                 const X_monotone_subcurve_2& xs2,
+                                 Arr_curve_end ce2)
+    { return operator()(xs1, ce1, xs2, ce2, Are_all_sides_oblivious_tag()); }
+
+  private:
+    // Oblivious implementation
+    Comparison_result operator()(const X_monotone_subcurve_2& xs1,
+                                 Arr_curve_end ce1,
+                                 const Point_2& p2,
+                                 Arr_all_sides_oblivious_tag) const
+    {
+      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
+      const Point_2& p1 = (ce1 == ARR_MAX_END) ?
+        geom_traits->construct_max_vertex_2_object()(xs1) :
+        geom_traits->construct_min_vertex_2_object()(xs1);
+      return geom_traits->compare_xy_2_object()(p1, p2);
+    }
+
+    // Boundary implementation
+    Comparison_result operator()(const X_monotone_subcurve_2& xs1,
+                                 Arr_curve_end ce1,
+                                 const Point_2& p2,
+                                 Arr_not_all_sides_oblivious_tag) const
+    {
+      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
+      typename Subcurve_traits_2::Parameter_space_in_x_2 ps_x =
+        geom_traits->parameter_space_in_x_2_object();
+      typename Subcurve_traits_2::Parameter_space_in_y_2 ps_y =
+        geom_traits->parameter_space_in_y_2_object();
+      const Arr_parameter_space ps_x1 = ps_x(xs1, ce1);
+      const Arr_parameter_space ps_y1 = ps_y(xs1, ce1);
+
+      if (ps_x1 != ARR_INTERIOR) {
+        if (ps_x1 == ARR_LEFT_BOUNDARY) return SMALLER;
+        if (ps_x1 == ARR_RIGHT_BOUNDARY) return LARGER;
+      }
+
+      if (ps_y1 == ARR_INTERIOR) {
+        const Point_2& p1 = (ce1 == ARR_MAX_END) ?
+          geom_traits->construct_max_vertex_2_object()(xs1) :
+          geom_traits->construct_min_vertex_2_object()(xs1);
+        return geom_traits->compare_xy_2_object()(p1, p2);
+      }
+
+      // EFEF: missing implementation for open boundary.
+      typename Subcurve_traits_2::Compare_x_on_boundary_2 cmp_x_on_bnd =
+        geom_traits->compare_x_on_boundary_2_object();
+      Comparison_result res = opposite(cmp_x_on_bnd(p2, xs1, ce1));
+      if (res != EQUAL) return res;
+      if (ps_y1 == ARR_TOP_BOUNDARY) return LARGER;
+      CGAL_assertion(ps_y1 == ARR_BOTTOM_BOUNDARY);
+      return SMALLER;
+    }
+
+    // Oblivious implementation
+    Comparison_result operator()(const X_monotone_subcurve_2& xs1,
+                                 Arr_curve_end ce1,
+                                 const X_monotone_subcurve_2& xs2,
+                                 Arr_curve_end ce2,
+                                 Arr_all_sides_oblivious_tag) const
+    {
+      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
+      const Point_2& p1 = (ce1 == ARR_MAX_END) ?
+        geom_traits->construct_max_vertex_2_object()(xs1) :
+        geom_traits->construct_min_vertex_2_object()(xs1);
+      const Point_2& p2 = (ce2 == ARR_MAX_END) ?
+        geom_traits->construct_max_vertex_2_object()(xs2) :
+        geom_traits->construct_min_vertex_2_object()(xs2);
+      return geom_traits->compare_xy_2_object()(p1, p2);
+    }
+
+    // Boundary implementation
+    Comparison_result operator()(const X_monotone_subcurve_2& xs1,
+                                 Arr_curve_end ce1,
+                                 const X_monotone_subcurve_2& xs2,
+                                 Arr_curve_end ce2,
+                                 Arr_not_all_sides_oblivious_tag) const
+    {
+      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
+      typename Subcurve_traits_2::Parameter_space_in_x_2 ps_x =
+        geom_traits->parameter_space_in_x_2_object();
+      typename Subcurve_traits_2::Parameter_space_in_y_2 ps_y =
+        geom_traits->parameter_space_in_y_2_object();
+      const Arr_parameter_space ps_x1 = ps_x(xs1, ce1);
+      const Arr_parameter_space ps_y1 = ps_y(xs1, ce1);
+      const Arr_parameter_space ps_x2 = ps_x(xs2, ce2);
+      const Arr_parameter_space ps_y2 = ps_y(xs2, ce2);
+
+      if (ps_x1 != ps_x2) {
+        if (ps_x1 == ARR_LEFT_BOUNDARY) return SMALLER;
+        if (ps_x1 == ARR_RIGHT_BOUNDARY) return LARGER;
+        if (ps_x2 == ARR_LEFT_BOUNDARY) return LARGER;
+        if (ps_x2 == ARR_RIGHT_BOUNDARY) return SMALLER;
+      }
+
+      if ((ps_x1 == ARR_INTERIOR) && (ps_y1 == ARR_INTERIOR)) {
+        const Point_2& p1 = (ce1 == ARR_MAX_END) ?
+          geom_traits->construct_max_vertex_2_object()(xs1) :
+          geom_traits->construct_min_vertex_2_object()(xs1);
+        // ps1 == ARR_INTERIOR
+
+        if ((ps_x2 == ARR_INTERIOR) && (ps_y2 == ARR_INTERIOR)) {
+          const Point_2& p2 = (ce2 == ARR_MAX_END) ?
+            geom_traits->construct_max_vertex_2_object()(xs2) :
+            geom_traits->construct_min_vertex_2_object()(xs2);
+
+          // ps1 == ARR_INTERIOR
+          // ps2 == ARR_INTERIOR
+          return geom_traits->compare_xy_2_object()(p1, p2);
+        }
+
+        // The cases ps_x2 == ARR_{LEFT,RIGHT}_BOUNDARY are handled above
+
+        // ps1 == ARR_INTERIOR
+        // ps_x2 == ARR_INTERIOR
+        // ps_y2 != ARR_INTERIOR
+        CGAL_assertion(ps_x2 == ARR_INTERIOR);
+        // EFEF: missing implementation for open boundary.
+        typename Subcurve_traits_2::Compare_x_on_boundary_2 cmp_x_on_bnd =
+          geom_traits->compare_x_on_boundary_2_object();
+        Comparison_result res = cmp_x_on_bnd(p1, xs2, ce2);
+        if (res != EQUAL) return res;
+        if (ps_y2 == ARR_TOP_BOUNDARY) return SMALLER;
+        CGAL_assertion(ps_y2 == ARR_BOTTOM_BOUNDARY);
+        return LARGER;
+      }
+
+      // ps1 != ARR_INTERIOR
+      if ((ps_x2 == ARR_INTERIOR) && (ps_y2 == ARR_INTERIOR)) {
+        const Point_2& p2 = (ce2 == ARR_MAX_END) ?
+          geom_traits->construct_max_vertex_2_object()(xs2) :
+          geom_traits->construct_min_vertex_2_object()(xs2);
+
+        // The cases ps_x1 == ARR_{LEFT,RIGHT}_BOUNDARY are handled above
+
+        // ps_x1 == ARR_INTERIOR
+        // ps_y1 != ARR_INTERIOR
+        // ps2 == ARR_INTERIOR
+        CGAL_assertion(ps_x1 == ARR_INTERIOR);
+        typename Subcurve_traits_2::Compare_x_on_boundary_2 cmp_x_on_bnd =
+          geom_traits->compare_x_on_boundary_2_object();
+        Comparison_result res = cmp_x_on_bnd(p2, xs1, ce1);
+        if (res != EQUAL) return opposite(res);
+        if (ps_y1 == ARR_TOP_BOUNDARY) return LARGER;
+        CGAL_assertion(ps_y1 == ARR_BOTTOM_BOUNDARY);
+        return SMALLER;
+      }
+
+      // ps1 != ARR_INTERIOR
+      // ps2 != ARR_INTERIOR
+      // ps_x1 == ps_x2
+      if (ps_x1 == ARR_INTERIOR) {
+        // ps_y1 != ARR_INTERIOR
+        // ps_y2 != ARR_INTERIOR
+        Comparison_result res =
+          geom_traits->compare_x_on_boundary_2_object()(xs1, ce1, xs2, ce2);
+        if (res != EQUAL) return res;
+        if (ps_y1 == ps_y2) return EQUAL;
+        return (ps_y1 == ARR_BOTTOM_BOUNDARY) ? SMALLER : LARGER;
+      }
+
+      CGAL_assertion(ce1 == ce2);
+      const Point_2& p1 = (ce1 == ARR_MAX_END) ?
+        geom_traits->construct_max_vertex_2_object()(xs1) :
+        geom_traits->construct_min_vertex_2_object()(xs1);
+      const Point_2& p2 = (ce2 == ARR_MAX_END) ?
+        geom_traits->construct_max_vertex_2_object()(xs2) :
+        geom_traits->construct_min_vertex_2_object()(xs2);
+      return geom_traits->compare_y_on_boundary_2_object()(p1, p2);
+    }
+  };
+
+  /*! Obtain a Compare_xy_2 functor object. */
+  Compare_xy_2 compare_xy_2_object() const
+  { return Compare_xy_2(*this); }
+
+  class Construct_min_vertex_2 {
+  protected:
+    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
+      Polycurve_basic_traits_2;
+
+    /*! The polycurve traits (in case it has state). */
+    const Polycurve_basic_traits_2& m_poly_traits;
+
+  public:
+    /* Constructor. */
+    Construct_min_vertex_2(const Polycurve_basic_traits_2& traits) :
+      m_poly_traits(traits)
+    {}
+
+    /*! Obtain the left endpoint of the x-monotone polycurve.
+     * \todo: is it possible to make the return type const reference if the
+     *        return type of the subcurve traits is const reference?
+     * \param cv The polycurve curve.
+     * \return The left endpoint.
+     */
+    Point_2 operator()(const X_monotone_curve_2& cv) const
+    {
+      CGAL_assertion(cv.number_of_subcurves() > 0);
+
+      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
+
+      if (geom_traits->compare_endpoints_xy_2_object()(cv[0]) == SMALLER)
+        return geom_traits->construct_min_vertex_2_object()(cv[0]);
+      else
+        return geom_traits->
+          construct_min_vertex_2_object()(cv[cv.number_of_subcurves()-1]);
+    }
+  };
+
+  /*! Obtain a Construct_min_vertex_2 functor object. */
+  Construct_min_vertex_2 construct_min_vertex_2_object() const
+  { return Construct_min_vertex_2(*this); }
+
+  class Construct_max_vertex_2 {
+  protected:
+    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
+      Polycurve_basic_traits_2;
+
+    /*! The polycurve traits (in case it has state). */
+    const Polycurve_basic_traits_2& m_poly_traits;
+
+  public:
+    /*! Constructor. */
+    Construct_max_vertex_2(const Polycurve_basic_traits_2& traits) :
+      m_poly_traits(traits)
+    {}
+
+    /*! Obtain the right endpoint of the x-monotone polycurve.
+     * \todo: is it possible to make the return type const reference if the
+     *        return type of the subcurve traits is const reference?
+     * \param cv The polycurve.
+     * \return The right endpoint.
+     */
+    Point_2 operator()(const X_monotone_curve_2& cv) const
+    {
+      CGAL_assertion(cv.number_of_subcurves() > 0);
+
+      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
+
+      if (geom_traits->compare_endpoints_xy_2_object()(cv[0]) == SMALLER)
+        return geom_traits->
+          construct_max_vertex_2_object()(cv[cv.number_of_subcurves()-1]);
+      else
+        return geom_traits->construct_max_vertex_2_object()(cv[0]);
+    }
+  };
+
+  /*! Obtain a Construct_max_vertex_2 functor object. */
+  Construct_max_vertex_2 construct_max_vertex_2_object() const
+  { return Construct_max_vertex_2(*this); }
+
+  class Is_vertical_2 {
+  protected:
+    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
+    Polycurve_basic_traits_2;
+
+    /*! The polycurve traits (in case it has state). */
+    const Polycurve_basic_traits_2& m_poly_traits;
+
+  public:
+    /*! Constructor. */
+    Is_vertical_2(const Polycurve_basic_traits_2& traits) :
+      m_poly_traits(traits)
+    {}
+
+    /*! Check whether the given x-monotone curve is a vertical segment.
+     * \param cv The curve.
+     * \return (true) if the curve is a vertical segment;(false) otherwise.
+     */
+    bool operator()(const X_monotone_curve_2& cv) const
+    {
+      // An x-monotone polycurve can represent a vertical segment only if it
+      // is comprised of vertical segments. If the first subcurve is vertical,
+      // all subcurves are vertical in an x-monotone polycurve
+      return m_poly_traits.subcurve_traits_2()->is_vertical_2_object()(cv[0]);
+    }
+  };
+
+  /*! Obtain an Is_vertical_2 functor object. */
+  Is_vertical_2 is_vertical_2_object() const
+  { return Is_vertical_2(*this); }
+
+  class Compare_y_at_x_2 {
+  private:
+    // Oblivious implementation
+    Comparison_result operator()(const X_monotone_subcurve_2& xs1,
+                                 Arr_curve_end ce1,
+                                 const X_monotone_subcurve_2& xs2,
+                                 Arr_all_sides_oblivious_tag) const
+    {
+      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
+      const Point_2& p = (ce1 == ARR_MAX_END) ?
+        geom_traits->construct_max_vertex_2_object()(xs1) :
+        geom_traits->construct_min_vertex_2_object()(xs1);
+      return geom_traits->compare_y_at_x_2_object()(p, xs2);
+    }
+
+    // Boundary implementation
+    Comparison_result operator()(const X_monotone_subcurve_2& xs1,
+                                 Arr_curve_end ce1,
+                                 const X_monotone_subcurve_2& xs2,
+                                 Arr_not_all_sides_oblivious_tag) const
+    {
+      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
+      typename Subcurve_traits_2::Parameter_space_in_x_2 ps_x =
+        geom_traits->parameter_space_in_x_2_object();
+      typename Subcurve_traits_2::Parameter_space_in_y_2 ps_y =
+        geom_traits->parameter_space_in_y_2_object();
+      typename Subcurve_traits_2::Construct_min_vertex_2 min_vertex =
+        geom_traits->construct_min_vertex_2_object();
+      typename Subcurve_traits_2::Construct_max_vertex_2 max_vertex =
+        geom_traits->construct_max_vertex_2_object();
+
+      const Arr_parameter_space ps_x1 = ps_x(xs1, ce1);
+      const Arr_parameter_space ps_y1 = ps_y(xs1, ce1);
+
+      CGAL_assertion(((ce1 == ARR_MAX_END) && (ps_x1 != ARR_LEFT_BOUNDARY)) ||
+                     ((ce1 == ARR_MIN_END) && (ps_x1 != ARR_RIGHT_BOUNDARY)));
+
+      if (ps_x1 == ARR_INTERIOR) {
+        if (ps_y1 == ARR_TOP_BOUNDARY) {
+          typename Subcurve_traits_2::Equal_2 equal =
+            geom_traits->equal_2_object();
+          const Point_2& p = (ce1 == ARR_MAX_END) ?
+            max_vertex(xs1) : min_vertex(xs1);
+          if (equal(p, max_vertex(xs2))) return EQUAL;
+          if (equal(p, min_vertex(xs2))) return EQUAL;
+          return LARGER;
+        }
+        if (ps_y1 == ARR_BOTTOM_BOUNDARY) {
+          typename Subcurve_traits_2::Equal_2 equal =
+            geom_traits->equal_2_object();
+          const Point_2& p = (ce1 == ARR_MAX_END) ?
+            max_vertex(xs1) : min_vertex(xs1);
+          if (equal(p, max_vertex(xs2))) return EQUAL;
+          if (equal(p, min_vertex(xs2))) return EQUAL;
+          return SMALLER;
+        }
+        // ps_y1 == ARR_INTERIOR
+        const Point_2& p = (ce1 == ARR_MAX_END) ?
+          max_vertex(xs1) : min_vertex(xs1);
+        return geom_traits->compare_y_at_x_2_object()(p, xs2);
+      }
+      // ps_x1 == ARR_RIGHT_BOUNDARY || ARR_LEFT_BOUNDARY
+      const Point_2& p1 = (ce1 == ARR_MAX_END) ?
+        max_vertex(xs1) : min_vertex(xs1);
+      const Point_2& p2 = (ce1 == ARR_MAX_END) ?
+        max_vertex(xs2) : min_vertex(xs2);
+      return geom_traits->compare_y_on_boundary_2_object()(p1, p2);
+    }
+
+  protected:
+    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
+      Polycurve_basic_traits_2;
+
+    /*! The polycurve traits (in case it has state). */
+    const Polycurve_basic_traits_2& m_poly_traits;
+
+  public:
+    /*! Constructor. */
+    Compare_y_at_x_2(const Polycurve_basic_traits_2& traits) :
+      m_poly_traits(traits) {}
+
+    /*! Obtain the location of the given point with respect to the input curve.
+     * \param p The point.
+     * \param xcv The polycurve curve.
+     * \pre p is in the x-range of cv.
+     * \return SMALLER if y(p) < cv(x(p)), i.e. the point is below the curve;
+     *         LARGER if y(p) > cv(x(p)), i.e. the point is above the curve;
+     *         EQUAL if p lies on the curve.
+     */
+    Comparison_result operator()(const Point_2& p,
+                                 const X_monotone_curve_2& xcv) const
+    {
+      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
+      if (! m_poly_traits.is_vertical_2_object()(xcv)) {
+        // Get the index of the subcurve in xcv containing p.
+        std::size_t i =
+          m_poly_traits.locate_impl(xcv, p, Are_all_sides_oblivious_tag());
+        CGAL_precondition(i != INVALID_INDEX);
+
+        // Compare the subcurve xcv[i] and p.
+        return geom_traits->compare_y_at_x_2_object()(p, xcv[i]);
+      }
+      // The curve is vertical
+      #ifdef CGAL_ALWAYS_LEFT_TO_RIGHT
+      const Comparison_result SMLLR = SMALLER;
+      const Comparison_result LRGR = LARGER;
+      #else
+      const bool is_left_to_right = m_poly_traits.subcurve_traits_2()->
+                                      compare_endpoints_xy_2_object()(xcv[0])
+                                        == SMALLER;
+      const Comparison_result SMLLR = is_left_to_right?SMALLER:LARGER;
+      const Comparison_result LRGR = is_left_to_right?LARGER:SMALLER;
+      #endif
+
+      Comparison_result rc = geom_traits->compare_y_at_x_2_object()(p, xcv[0]);
+      if (rc == SMLLR) return SMLLR;
+      std::size_t n = xcv.number_of_subcurves();
+      rc = geom_traits->compare_y_at_x_2_object()(p, xcv[n-1]);
+      if (rc == LRGR) return LRGR;
+      return EQUAL;
+    }
+
+    /*! Obtain the location of the given curve_end with respect to the input
+     * curve.
+     * \param xcv The polycurve curve.
+     * \param ce the curve-end indicator of the x-monotone subcurve xl:
+     *            ARR_MIN_END - the minimal end of xl or
+     *            ARR_MAX_END - the maximal end of xl.
+     * \param xcv The polycurve curve.
+     * \pre the curve-end is in the x-range of xcv.
+     * \return SMALLER if if y(xs, ce) < cv(x(xs, ce)), i.e.  the curve-end
+     *           is below the curve xcv;
+     *         LARGER if y(xs, ce) > cv(x(xs, ce)), i.e. the curve-end is
+     *           above the curve xcv;
+     *         EQUAL if the curve-end lies on the curve xcv.
+     */
+    Comparison_result operator()(const X_monotone_subcurve_2& xs1,
+                                 Arr_curve_end ce1,
+                                 const X_monotone_subcurve_2& xs2) const
+    { return operator()(xs1, ce1, xs2, Are_all_sides_oblivious_tag()); }
+  };
+
+  /*! Obtain a Compare_y_at_x_2 functor object. */
+  Compare_y_at_x_2 compare_y_at_x_2_object() const
+  { return Compare_y_at_x_2(*this); }
+
+  class Compare_y_at_x_left_2 {
+  protected:
+    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
+      Polycurve_basic_traits_2;
+
+    /*! The polycurve traits (in case it has state). */
+    const Polycurve_basic_traits_2& m_poly_traits;
+
+  public:
+    /*! Constructor. */
+    Compare_y_at_x_left_2(const Polycurve_basic_traits_2& traits) :
+      m_poly_traits(traits)
+    {}
+
+    /*! Compare the y value of two x-monotone curves immediately to the left
+     * of their intersection point.
+     * \param cv1 The first polycurve curve.
+     * \param cv2 The second polycurve curve.
+     * \param p The intersection point.
+     * \pre The point p lies on both curves, and both of them must be also be
+     *      defined(lexicographically) to its left.
+     * \return The relative position of cv1 with respect to cv2 immdiately to
+     *         the left of p: SMALLER, LARGER or EQUAL.
+     */
+    Comparison_result operator()(const X_monotone_curve_2& cv1,
+                                 const X_monotone_curve_2& cv2,
+                                 const Point_2& p) const
+    {
+      // Get the indices of the subcurves in cv1 and cv2 containing p and
+      // defined to its left.
+      std::size_t i1 = m_poly_traits.locate_side(cv1, p, false);
+      std::size_t i2 = m_poly_traits.locate_side(cv2, p, false);
+
+      CGAL_precondition(i1 != INVALID_INDEX);
+      CGAL_precondition(i2 != INVALID_INDEX);
+
+      // Compare cv1[i1] and cv2[i2] at p's left.
+      return m_poly_traits.subcurve_traits_2()->
+        compare_y_at_x_left_2_object()(cv1[i1], cv2[i2], p);
+    }
+  };
+
+  /*! Obtain a Compare_y_at_x_left_2 functor object. */
+  Compare_y_at_x_left_2 compare_y_at_x_left_2_object() const
+  { return Compare_y_at_x_left_2(*this); }
+
+  class Compare_y_at_x_right_2 {
+  protected:
+    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
+      Polycurve_basic_traits_2;
+
+    /*! The polycurve traits (in case it has state). */
+    const Polycurve_basic_traits_2& m_poly_traits;
+
+  public:
+    /*! Constructor. */
+    Compare_y_at_x_right_2(const Polycurve_basic_traits_2& traits) :
+      m_poly_traits(traits)
+    {}
+
+    /*! Compare the y value of two x-monotone curves immediately to the right
+     * of their intersection point.
+     * \param cv1 The first curve.
+     * \param cv2 The second curve.
+     * \param p The intersection point.
+     * \pre The point p lies on both curves, and both of them must be also be
+     *      defined(lexicographically) to its right.
+     * \return The relative position of cv1 with respect to cv2 immdiately to
+     *         the right of p: SMALLER, LARGER or EQUAL.
+     */
+    Comparison_result operator()(const X_monotone_curve_2& cv1,
+                                 const X_monotone_curve_2& cv2,
+                                 const Point_2& p) const
+    {
+      // Get the indices of the subcurves in cv1 and cv2 containing p and
+      // defined to its right.
+      std::size_t i1=m_poly_traits.locate_side(cv1, p, true);
+      std::size_t i2=m_poly_traits.locate_side(cv2, p, true);
+
+      CGAL_precondition(i1 != INVALID_INDEX);
+      CGAL_precondition(i2 != INVALID_INDEX);
+
+      // Compare cv1[i1] and cv2[i2] at p's right.
+      return m_poly_traits.subcurve_traits_2()->
+        compare_y_at_x_right_2_object()(cv1[i1], cv2[i2], p);
+    }
+  };
+
+  /*! Obtain a Compare_y_at_x_right_2 functor object.
+   */
+  Compare_y_at_x_right_2 compare_y_at_x_right_2_object() const
+  { return Compare_y_at_x_right_2(*this); }
+
+  class Equal_2 {
+  protected:
+    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
+      Polycurve_basic_traits_2;
+
+    /*! The polycurve traits (in case it has state). */
+    const Polycurve_basic_traits_2& m_poly_traits;
+
+  public:
+    /*! Constructor. */
+    Equal_2(const Polycurve_basic_traits_2& poly_tr) : m_poly_traits(poly_tr) {}
+
+    /*! Check whether the two points are the same.
+     * \param p1 The first point.
+     * \param p2 The second point.
+     * \return (true) if the two point are the same;(false) otherwise.
+     */
+    bool operator()(const Point_2& p1, const Point_2& p2) const
+    { return m_poly_traits.subcurve_traits_2()->equal_2_object()(p1, p2); }
+
+    /*! Check whether the two x-monotone curves are the same (have the same
+     * graph).
+     * \param cv1 The first curve.
+     * \param cv2 The second curve.
+     * \return(true) if the two curves are the same;(false) otherwise.
+     */
+    bool operator()(const X_monotone_curve_2& cv1,
+                    const X_monotone_curve_2& cv2) const
+    {
+      // Check the pairwise equality of the contained subcurves.
+      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
+      typename Subcurve_traits_2::Equal_2 equal =
+        geom_traits->equal_2_object();
+      typename Subcurve_traits_2::Compare_x_2 compare_x =
+        geom_traits->compare_x_2_object();
+      typename Subcurve_traits_2::Compare_y_at_x_2 compare_y_at_x =
+        geom_traits->compare_y_at_x_2_object();
+      typename Subcurve_traits_2::Construct_max_vertex_2 max_vertex =
+        geom_traits->construct_max_vertex_2_object();
+      typename Subcurve_traits_2::Compare_endpoints_xy_2 comp_endpt =
+        geom_traits->compare_endpoints_xy_2_object();
+      Is_vertical_2 is_vertical = m_poly_traits.is_vertical_2_object();
+      Construct_min_vertex_2 xpoly_min_v =
+        m_poly_traits.construct_min_vertex_2_object();
+      Construct_max_vertex_2 xpoly_max_v =
+        m_poly_traits.construct_max_vertex_2_object();
+
+      // The first and last points of the subcurves should be equal.
+      bool res = equal(xpoly_min_v(cv1), xpoly_min_v(cv2));
+      if (!res) return false;
+      res = equal(xpoly_max_v(cv1), xpoly_max_v(cv2));
+      if (!res) return false;
+
+      // If the first and last points are equal and the curves are vertical,
+      // it means that it is equal.
+      bool ver1 = is_vertical(cv1);
+      bool ver2 = is_vertical(cv2);
+      // both curves are vertical and therefore equal.
+      if (ver1 && ver2) return true;
+      // one is vertical and the other is not - hence not equal.
+      if (ver1 || ver2) return false;
+
+      // If we arrived here it means that the first and last point of the
+      // curve are equal.
+      std::size_t i = 0;
+      std::size_t j = 0;
+      std::size_t n1 = cv1.number_of_subcurves();
+      std::size_t n2 = cv2.number_of_subcurves();
+      Comparison_result is_cv1_left_to_right = comp_endpt(cv1[0]);
+      Comparison_result is_cv2_left_to_right = comp_endpt(cv2[0]);
+
+      while ((i < (n1-1)) || (j < (n2-1))) {
+        Point_2 point1, point2;
+        std::size_t cv1_seg_ind, cv2_seg_ind;
+        if (SMALLER == is_cv1_left_to_right) {
+          cv1_seg_ind = i;
+          point1 = max_vertex(cv1[cv1_seg_ind]);
+        }
+        else {
+          cv1_seg_ind = n1 - 1 - i;
+          point1 = max_vertex(cv1[cv1_seg_ind]);
+        }
+        if (SMALLER == is_cv2_left_to_right) {
+          cv2_seg_ind = j;
+          point2 = max_vertex(cv2[cv2_seg_ind]);
+        }
+        else {
+          cv2_seg_ind = n2 - 1 - j;
+          point2 = max_vertex(cv2[cv2_seg_ind]);
+        }
+
+        bool res = equal(point1, point2);
+        // Easy case - the two points are equal
+        if (res) {
+          ++i;
+          ++j;
+        }
+        else {
+          Comparison_result res_x = compare_x(point1,point2);
+          // Check if the different point is a collinear point situated on
+          // the line between its two neighbors.
+          if (SMALLER == res_x) {
+            Comparison_result res_y_at_x =
+              compare_y_at_x(point1, cv2[cv2_seg_ind]);
+            if (EQUAL == res_y_at_x) ++i;
+            else return false;
+          }
+          else if (LARGER == res_x) {
+            Comparison_result res_y_at_x =
+              compare_y_at_x(point2,cv1[cv1_seg_ind]);
+            if (EQUAL == res_y_at_x) ++j;
+            else return false;
+          }
+          else return false;
+        }
+      }
+      return true;
+    }
+  };
+
+  /*! Obtain an Equal_2 functor object. */
+  Equal_2 equal_2_object() const { return Equal_2(*this); }
+
+  class Compare_endpoints_xy_2 {
+  protected:
+    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
+      Polycurve_basic_traits_2;
+
+    /*! The traits (in case it has state). */
+    const Polycurve_basic_traits_2& m_poly_traits;
+
+  public:
+    /*! Constructor. */
+    Compare_endpoints_xy_2(const Polycurve_basic_traits_2& traits) :
+      m_poly_traits(traits)
+    {}
+
+    /*! Compare the endpoints of an \(x\)-monotone curve lexicographically.
+     * (assuming the curve has a designated source and target points).
+     * \param cv The curve.
+     * \return SMALLER if the curve is oriented left-to-right;
+     *         LARGER if the curve is oriented right-to-left.
+     */
+    Comparison_result operator()(const X_monotone_curve_2& xcv) const
+    {
+      return (m_poly_traits.subcurve_traits_2()->
+              compare_endpoints_xy_2_object()(xcv[0]) == SMALLER) ?
+        (SMALLER) : (LARGER);
+    }
+  };
+  //@}
+
+  /// \name Types and functors defined here, required by the
+  // ArrangementDirectionalXMonotoneTraits_2 concept.
+  //@{
+
+  Compare_endpoints_xy_2 compare_endpoints_xy_2_object() const
+  { return Compare_endpoints_xy_2(*this); }
+
+  class Construct_opposite_2 {
+  protected:
+    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
+      Polycurve_basic_traits_2;
+
+    /*! The traits (in case it has state). */
+    const Polycurve_basic_traits_2& m_poly_traits;
+
+  public:
+    /*! Constructor */
+    Construct_opposite_2(const Polycurve_basic_traits_2& traits) :
+      m_poly_traits(traits)
+    {}
+
+    /*! Construct the reversed \(x\)-monotone polycurve of the input.
+     * Note that the functor constructs the opposites of _all_ subcurves
+     * constituting xcv.
+     * \param xcv the \(x\)-monotone polycurve to be reveres
+     * \pre xcv contains at least one subcurve
+     * \return An \(x\)-monotone polycurve with the same graph as the input xcv
+     *         only with a reverse orientation.
+     */
+    X_monotone_curve_2 operator()(const X_monotone_curve_2& xcv) const
+    {
+      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
+      typename Subcurve_traits_2::Construct_opposite_2 const_op =
+        geom_traits->construct_opposite_2_object();
+      std::vector<X_monotone_subcurve_2> rev_segs(xcv.number_of_subcurves());;
+      typename X_monotone_curve_2::Subcurve_const_iterator sit;
+      typename X_monotone_curve_2::Subcurve_iterator tit = rev_segs.begin();
+      for (sit = xcv.subcurves_begin(); sit != xcv.subcurves_end(); ++sit)
+        *tit++ = const_op(*sit);
+      return X_monotone_curve_2(rev_segs.rbegin(), rev_segs.rend());
+    }
+  };
+
+  Construct_opposite_2 construct_opposite_2_object() const
+  { return Construct_opposite_2(*this); }
+
+  ///@}
+
+  /// \name Types and functors defined here, required by the
+  // ArrangementLandmarkTraits concept.
+  //@{
+
+#if 0
+  // The following block assumes that the subcurve traits template parameter
+  // is a model of the ArrangementLandmarkTraits concept; in other words, it
+  // defines the nested types Approximate_number_type and Approximate_2 and
+  // the member function approximate_2_object(). It cannot be used as is if
+  // the subcurve traits does not model the ArrangementLandmarkTraits concept.
+  // The functor Construct_x_monotone_curve_2 is provided regardless of the
+  // subcurve traits.
+
+  typedef typename Subcurve_traits_2::Approximate_number_type
+  Approximate_number_type;
+  typedef typename Subcurve_traits_2::Approximate_2    Approximate_2;
+
+  /*! Obtain an Approximate_2 functor object. */
+  Approximate_2 approximate_2_object() const
+  { return subcurve_traits_2()->approximate_2_object(); }
+#else
+  // The following block defines the nested types Approximate_number_type and
+  // Approximate_2 and the member function approximate_2_object() based on the
+  // corresponding types and function definitions of the subcurve traits. If
+  // the subcurve traits does not provide these definitions, they are defined
+  // as dummies. Essentially, the polycurve traits becomes a practical model of
+  // the ArrangementLandmarkTraits concept only if the subcurve traits is a
+  // model of this concept.
+  //
+  // The following implementation is inspired by
+  // http://stackoverflow.com/a/11816999/1915421
+
+  template <typename T>
+  struct Void {
+    typedef void type;
+  };
+
+  template <typename T, typename _ = void>
+  struct has_approximate_2 {
+    // Generic implementation
+    typedef void                        Approximate_number_type;
+    typedef void                        Approximate_2;
+  };
+
+  template <typename T>
+  struct has_approximate_2<T, typename Void<typename T::Approximate_2>::type>
+  {
+    // Specialization for types holding a nested type T::Approximate_2
+    typedef typename T::Approximate_number_type
+                                        Approximate_number_type;
+    typedef typename T::Approximate_2   Approximate_2;
+  };
+
+  typedef typename has_approximate_2<Subcurve_traits_2>::Approximate_number_type
+                                        Approximate_number_type;
+  typedef typename has_approximate_2<Subcurve_traits_2>::Approximate_2
+                                        Approximate_2;
+
+  /*! Obtain an Approximate_2 functor object. */
+  Approximate_2 approximate_2_object_impl(boost::false_type) const
+  { return subcurve_traits_2()->approximate_2_object(); }
+
+  Approximate_2 approximate_2_object_impl(boost::true_type) const { }
+
+  Approximate_2 approximate_2_object() const
+  {
+    typedef typename boost::is_same<void, Approximate_2>::type      Is_void;
+    return approximate_2_object_impl(Is_void());
+  }
+#endif
+
+  class Construct_x_monotone_curve_2 {
+  protected:
+    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
+      Polycurve_basic_traits_2;
+
+    /*! The polycurve traits (in case it has state). */
+    const Polycurve_basic_traits_2& m_poly_traits;
+
+  public:
+    /*! Constructor. */
+    Construct_x_monotone_curve_2(const Polycurve_basic_traits_2& traits) :
+      m_poly_traits(traits)
+    {}
+
+    /*! Obtain an x-monotone polycurve that consists of one given subcurve.
+     * \param seg input subcurve.
+     * \pre seg is not degenerated.
+     * \return An x-monotone polycurve with one subcurve.
+     */
+    X_monotone_curve_2 operator()(const X_monotone_subcurve_2& seg) const
+    {
+      CGAL_precondition_code
+        (
+         /* Test that the subcurve is not degenerated. We do this test
+          * independently from the subcurve traits in use, as we do not
+          * allow a polycurve with degenerated subcurves.
+          */
+         const Subcurve_traits_2* geom_traits =
+           m_poly_traits.subcurve_traits_2();
+         typename Subcurve_traits_2::Construct_min_vertex_2 get_min_v =
+           geom_traits->construct_min_vertex_2_object();
+         typename Subcurve_traits_2::Construct_max_vertex_2 get_max_v =
+           geom_traits->construct_max_vertex_2_object();
+         typename Subcurve_traits_2::Equal_2 equal =
+           geom_traits->equal_2_object();
+
+         CGAL_precondition_msg(!equal(get_min_v(seg),get_max_v(seg)),
+                               "Cannot construct a degenerated subcurve");
+         );
+
+#ifdef CGAL_ALWAYS_LEFT_TO_RIGHT
+      if (m_poly_traits.subcurve_traits_2()->
+          compare_endpoints_xy_2_object()(seg) == LARGER)
+        return X_monotone_subcurve_2(m_poly_traits.subcurve_traits_2()->
+                                    construct_opposite_2_object()(seg));
+#endif
+
+      return X_monotone_curve_2(seg);
+    }
+
+    /*! Construct an x-monotone polycurve which is well-oriented from a range of
+     * elements.
+     * \pre Range should from a continuous well-oriented x-monotone polycurve.
+     */
+    template <typename ForwardIterator>
+    X_monotone_curve_2 operator()(ForwardIterator begin,
+                                  ForwardIterator end) const
+    {
+      typedef typename std::iterator_traits<ForwardIterator>::value_type VT;
+      typedef typename boost::is_same<VT,Point_2>::type Is_point;
+
+      // Dispatch the range to the appropriate implementation.
+      return constructor_impl(begin, end, Is_point());
+    }
+
+    /*! Construct an x-monotone polycurve from a range of points.
+     * The polycurve may be oriented left-to-right or right-to-left
+     * depending on the lexicographical order of the points in the
+     * input.
+     * \pre Range contains at least two points.
+     * \pre No two consecutive points are the same.
+     * \pre The points form an continuous well-oriented x-monotone polycurve.
+     * \post By the construction the returned polycurve is well-oriented.
+     */
+    template <typename ForwardIterator>
+    X_monotone_curve_2 constructor_impl(ForwardIterator /* begin */,
+                                        ForwardIterator /* end */,
+                                        boost::true_type) const
+    { CGAL_error_msg("Cannot construct a polycurve from a range of points!"); }
+
+    /*! Obtain an x-monotone polycurve from a range of subcurves.
+     * \param begin An iterator pointing to the first subcurve in the range.
+     * \param end An iterator pointing to the past-the-end subcurve
+     * in the range.
+     * \pre The range contains at least one subcurve.
+     * \pre Subcurves correspond to a well-oriented polycurve. That
+     *      is, the target of the i-th subcurve is an source of the
+     *      (i+1)th subcurve.
+     * \pre The sequence of subcurves in the range forms a weak x-monotone
+     *      polycurve.
+     * \pre The container should support bidirectional iteration.
+     * \return A continuous, well-oriented x-monotone polycurve which
+     *         is directed either left-to-right or right-to-left
+     *         depending on the subcurves in the input.
+     */
+    template <typename ForwardIterator>
+    X_monotone_curve_2 constructor_impl(ForwardIterator begin,
+                                        ForwardIterator end,
+                                        boost::false_type) const
+    {
+      CGAL_precondition_msg
+        (
+         begin != end,
+         "Input range of subcurves has to contain at least one subcurve"
+         );
+
+      CGAL_precondition_code
+        (
+         const Subcurve_traits_2* geom_traits =
+           m_poly_traits.subcurve_traits_2();
+         typename Subcurve_traits_2::Compare_endpoints_xy_2 cmp_seg_endpts =
+           geom_traits->compare_endpoints_xy_2_object();
+         typename Subcurve_traits_2::Construct_min_vertex_2 get_min_v =
+           geom_traits->construct_min_vertex_2_object();
+         typename Subcurve_traits_2::Construct_max_vertex_2 get_max_v =
+           geom_traits->construct_max_vertex_2_object();
+         typename Subcurve_traits_2::Equal_2 equal =
+           geom_traits->equal_2_object();
+
+         ForwardIterator curr = begin;
+         ForwardIterator next = begin;
+         ++next;
+         );
+
+
+      CGAL_precondition_msg
+        (
+         (next != end) || !equal(get_max_v(*curr),get_min_v(*curr)),
+         "Cannot construct a polycurve with degenerated subcurve"
+         );
+
+      CGAL_precondition_code
+        (
+         // Range contains at least two subcurves
+
+         Comparison_result init_dir = cmp_seg_endpts(*curr);
+         while (next != end){
+           CGAL_precondition_msg
+             (!equal(get_min_v(*next),get_max_v(*next)),
+              "Cannot construct a polycurve with degenerated subcurve"
+              );
+           CGAL_precondition_msg
+             (
+              init_dir == cmp_seg_endpts(*next),
+              "Subcurves must form x-monotone polycurve"
+              );
+           if (init_dir == SMALLER){
+             CGAL_precondition_msg
+               (
+                equal(get_max_v(*curr),get_min_v(*next)),
+                "Subcurves should concatenate in source->target manner"
+                );
+           }
+           else{
+             CGAL_precondition_msg
+               (
+                equal(get_min_v(*curr),get_max_v(*next)),
+                "Subcurves should concatenate in source->target manner"
+                );
+           }
+           ++curr;
+           ++next;
+         }
+         );
+
+#ifdef CGAL_ALWAYS_LEFT_TO_RIGHT
+      if (m_poly_traits.subcurve_traits_2()->
+          compare_endpoints_xy_2_object()(*begin) == LARGER)
+      {
+        X_monotone_curve_2 xcv(begin, end);
+        return m_poly_traits.construct_opposite_2_object()(xcv);
+      }
+#endif
+
+      return X_monotone_curve_2(begin, end);
+    }
+  };
+
+  /*! Obtain a Construct_x_monotone_curve_2 functor object. */
+  Construct_x_monotone_curve_2 construct_x_monotone_curve_2_object() const
+  { return Construct_x_monotone_curve_2(*this); }
+
+  //@}
+
+  /// \name Types and functors defined here, required by the
+  // ArrangementOpenBoundaryTraits_2 concept.
+  //@{
+
+  /*! A function object that obtains the parameter space of a geometric
+   * entity along the x-axis
+   */
+  class Parameter_space_in_x_2 {
+  protected:
+    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
+      Polycurve_basic_traits_2;
+
+    /*! The polycurve traits (in case it has state). */
+    const Polycurve_basic_traits_2& m_poly_traits;
+
+  public:
+    /*! Constructor. */
+    Parameter_space_in_x_2(const Polycurve_basic_traits_2& traits) :
+      m_poly_traits(traits)
+    {}
+
+    /*! Obtains the parameter space at the end of a curve along the x-axis .
+     * Note that if the curve-end coincides with a pole, then unless the curve
+     * coincides with the identification curve, the curve-end is considered to
+     * be approaching the boundary, but not on the boundary.
+     * If the curve coincides with the identification curve, it is assumed to
+     * be smaller than any other object.
+     * \param xcv the curve
+     * \param ce the curve-end indicator:
+     *     ARR_MIN_END - the minimal end of xc or
+     *     ARR_MAX_END - the maximal end of xc
+     * \return the parameter space at the ce end of the curve xcv.
+     *   ARR_LEFT_BOUNDARY  - the curve approaches the identification curve
+     *                        from the right at the curve left end.
+     *   ARR_INTERIOR       - the curve does not approache the identification
+     *                        curve.
+     *   ARR_RIGHT_BOUNDARY - the curve approaches the identification curve
+     *                        from the left at the curve right end.
+     * \pre xcv does not coincide with the vertical identification curve.
+     */
+    Arr_parameter_space operator()(const X_monotone_curve_2& xcv,
+                                   Arr_curve_end ce) const
+    {
+      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
+      Comparison_result direction =
+        geom_traits->compare_endpoints_xy_2_object()(xcv[0]);
+      const X_monotone_subcurve_2& xs =
+        (((direction == SMALLER) && (ce == ARR_MAX_END)) ||
+         ((direction == LARGER) && (ce == ARR_MIN_END))) ?
+        xcv[xcv.number_of_subcurves()-1] : xcv[0];
+      return geom_traits->parameter_space_in_x_2_object()(xs, ce);
+    }
+
+    /*! Obtains the parameter space at a point along the x-axis.
+     * \param p the point.
+     * \return the parameter space at p.
+     * \pre p does not lie on the vertical identification curve.
+     */
+    Arr_parameter_space operator()(const Point_2 p) const
+    {
+      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
+      return geom_traits->parameter_space_in_x_2_object()(p);
+    }
+  };
+
+  /*! Obtain a Parameter_space_in_x_2 function object */
+  Parameter_space_in_x_2 parameter_space_in_x_2_object() const
+  { return Parameter_space_in_x_2(*this); }
+
+  /*! A function object that obtains the parameter space of a geometric
+   * entity along the y-axis
+   */
+  class Parameter_space_in_y_2 {
+  protected:
+    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
+      Polycurve_basic_traits_2;
+
+    /*! The polycurve traits (in case it has state). */
+    const Polycurve_basic_traits_2& m_poly_traits;
+
+  public:
+    /*! Constructor. */
+    Parameter_space_in_y_2(const Polycurve_basic_traits_2& traits) :
+      m_poly_traits(traits)
+    {}
+
+    /*! Obtains the parameter space at the end of an curve along the y-axis .
+     * Note that if the curve-end coincides with a pole, then unless the curve
+     * coincides with the identification curve, the curve-end is considered to
+     * be approaching the boundary, but not on the boundary.
+     * If the curve coincides with the identification curve, it is assumed to
+     * be smaller than any other object.
+     * \param xcv the curve
+     * \param ce the curve-end indicator:
+     *     ARR_MIN_END - the minimal end of xcv or
+     *     ARR_MAX_END - the maximal end of xcv
+     * \return the parameter space at the ce end of the curve xcv.
+     *   ARR_BOTTOM_BOUNDARY  - the curve approaches the south pole at the
+     *                          curve left end.
+     *   ARR_INTERIOR         - the curve does not approache a contraction
+     *                          point.
+     *   ARR_TOP_BOUNDARY     - the curve approaches the north pole at the
+     *                          curve right end.
+     * There are no horizontal identification curves!
+     */
+    Arr_parameter_space operator()(const X_monotone_curve_2& xcv,
+                                   Arr_curve_end ce) const
+    {
+      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
+      Comparison_result direction =
+        geom_traits->compare_endpoints_xy_2_object()(xcv[0]);
+      const X_monotone_subcurve_2& xs =
+        (((direction == SMALLER) && (ce == ARR_MAX_END)) ||
+         ((direction == LARGER) && (ce == ARR_MIN_END))) ?
+        xcv[xcv.number_of_subcurves()-1] : xcv[0];
+      return geom_traits->parameter_space_in_y_2_object()(xs, ce);
+    }
+
+    /*! Obtains the parameter space at a point along the y-axis.
+     * \param p the point.
+     * \return the parameter space at p.
+     * \pre p does not lie on the horizontal identification curve.
+     * There are no horizontal identification curves!
+     */
+    Arr_parameter_space operator()(const Point_2 p) const
+    {
+      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
+      return geom_traits->parameter_space_in_y_2_object()(p);
+    }
+  };
+
+  /*! Obtain a Parameter_space_in_y_2 function object */
+  Parameter_space_in_y_2 parameter_space_in_y_2_object() const
+  { return Parameter_space_in_y_2(*this); }
+
+  /*! A functor that compares the x-coordinate of curve-ends and points on the
+   * boundary of the parameter space.
+   */
+  class Compare_x_on_boundary_2 {
+  protected:
+    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
+      Polycurve_basic_traits_2;
+
+    /*! The polycurve traits (in case it has state). */
+    const Polycurve_basic_traits_2& m_poly_traits;
+
+  public:
+    /*! Constructor. */
+    Compare_x_on_boundary_2(const Polycurve_basic_traits_2& traits) :
+      m_poly_traits(traits)
+    {}
+
+    /*! Compare the x-limit of a point with the x-coordinate of an
+     * x-curve-end on the boundary.
+     * \param point the point.
+     * \param xcv the x-curve, the endpoint of which is compared.
+     * \param ce the x-curve-end indicator:
+     *            ARR_MIN_END - the minimal end of xcv or
+     *            ARR_MAX_END - the maximal end of xcv.
+     * \return the comparison result:
+     *         SMALLER - x(p) < x(xcv, ce);
+     *         EQUAL   - x(p) = x(xcv, ce);
+     *         LARGER  - x(p) > x(xcv, ce).
+     * \pre p lies in the interior of the parameter space.
+     * \pre the ce end of the x-curve xcv lies on the top boundary.
+     * \pre xcv does not coincide with the vertical identification curve.
+     */
+    Comparison_result operator()(const Point_2& point,
+                                 const X_monotone_curve_2& xcv,
+                                 Arr_curve_end ce) const
+    {
+      const Subcurve_traits_2* geom_traits =
+        m_poly_traits.subcurve_traits_2();
+      Comparison_result direction =
+        geom_traits->compare_endpoints_xy_2_object()(xcv[0]);
+      const X_monotone_subcurve_2& xs =
+        (((direction == SMALLER) && (ce == ARR_MAX_END)) ||
+         ((direction == LARGER) && (ce == ARR_MIN_END))) ?
+        xcv[0] : xcv[xcv.number_of_subcurves()-1];
+      return geom_traits->compare_x_on_boundary_2_object()(point, xs, ce);
+    }
+
+    /*! Compare the x-coordinates of 2 curve-ends near the boundary of the
+     * parameter space.
+     * \param xcv1 the first curve.
+     * \param ce1 the first curve-end indicator:
+     *            ARR_MIN_END - the minimal end of xcv1 or
+     *            ARR_MAX_END - the maximal end of xcv1.
+     * \param xcv2 the second curve.
+     * \param ce2 the second  curve-end indicator:
+     *            ARR_MIN_END - the minimal end of xcv2 or
+     *            ARR_MAX_END - the maximal end of xcv2.
+     * \return the second comparison result:
+     *         SMALLER - x(xcv1, ce1) < x(xcv2, ce2);
+     *         EQUAL   - x(xcv1, ce1) = x(xcv2, ce2);
+     *         LARGER  - x(xcv1, ce1) > x(xcv2, ce2).
+     * \pre the ce1 end of the curve xcv1 lies on a pole (implying ce1 is
+     *      vertical).
+     * \pre the ce2 end of the curve xcv2 lies on a pole (implying ce2 is
+     *      vertical).
+     * \pre xcv1 does not coincide with the vertical identification curve.
+     * \pre xcv2 does not coincide with the vertical identification curve.
+     */
+    Comparison_result operator()(const X_monotone_curve_2& xcv1,
+                                 Arr_curve_end ce1,
+                                 const X_monotone_curve_2& xcv2,
+                                 Arr_curve_end ce2) const
+    {
+      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
+      Comparison_result direction1 =
+        geom_traits->compare_endpoints_xy_2_object()(xcv1[0]);
+      const X_monotone_subcurve_2& xs1 =
+        (((direction1 == SMALLER) && (ce1 == ARR_MAX_END)) ||
+         ((direction1 == LARGER) && (ce1 == ARR_MIN_END))) ?
+        xcv1[0] : xcv1[xcv1.number_of_subcurves()-1];
+      Comparison_result direction2 =
+        geom_traits->compare_endpoints_xy_2_object()(xcv2[0]);
+      const X_monotone_subcurve_2& xs2 =
+        (((direction2 == SMALLER) && (ce2 == ARR_MAX_END)) ||
+         ((direction2 == LARGER) && (ce2 == ARR_MIN_END))) ?
+        xcv2[0] : xcv2[xcv2.number_of_subcurves()-1];
+      return geom_traits->compare_x_on_boundary_2_object()(xs1, ce1, xs2, ce2);
+    }
+  };
+
+  /*! Obtain a Compare_x_on_boundary_2 function object. */
+  Compare_x_on_boundary_2 compare_x_on_boundary_2_object() const
+  { return Compare_x_on_boundary_2(*this); }
+
+  class Compare_x_at_limit_2{
+  protected:
+    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
+      Polycurve_basic_traits_2;
+
+    /*! The polycurve traits (in case it has state). */
+    const Polycurve_basic_traits_2& m_poly_traits;
+
+  public:
+    Compare_x_at_limit_2(const Polycurve_basic_traits_2& traits) :
+      m_poly_traits(traits)
+    {}
+
+    unsigned int get_curve_index (const X_monotone_curve_2& xcv,
+                                  const Arr_curve_end ce) const
+    {
+      //waqar:: dont know why it is opposite in Parameter_space_in_x...
+      // I think this is because of the way the subcurves are stored in the
+      // curve_vector.
+      // I am assuming that min end depends upon the direction and not the
+      // x-value.
+      // and also that min end subcurve is always placed at position 0 of the
+      // vector.
+      // Comfirm with Eric.
+      return (ce == ARR_MIN_END) ? 0 : xcv.number_of_subcurves() - 1;
+    }
+
+    Comparison_result operator()(const Point_2& p,
+                                 const X_monotone_curve_2& xcv,
+                                 Arr_curve_end ce) const
+    {
+      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
+      typename Subcurve_traits_2::Compare_x_at_limit_2 compare_x_at_limit =
+        geom_traits->compare_x_at_limit_2_object();
+
+      unsigned int index = this->get_curve_index(xcv, ce);
+      return compare_x_at_limit(p, xcv[index], ce );
+    }
+
+    Comparison_result operator()(const X_monotone_curve_2& xcv1,
+                                 Arr_curve_end ce1/* for xcv1 */,
+                                 const X_monotone_curve_2 & xcv2,
+                                 Arr_curve_end ce2/*! for xcv2 */) const
+    {
+      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
+      typename Subcurve_traits_2::Compare_x_at_limit_2 compare_x_at_limit =
+        geom_traits->compare_x_at_limit_2_object();
+
+      unsigned int index_1 = this->get_curve_index(xcv1, ce1);
+      unsigned int index_2 = this->get_curve_index(xcv2, ce2);
+
+      return compare_x_at_limit(xcv1[index_1], ce1, xcv2[index_2], ce2);
+    }
+
+    Comparison_result operator()(const X_monotone_curve_2& xcv,
+                                 Arr_curve_end ce1/* for xcv */,
+                                 const X_monotone_subcurve_2& xseg,
+                                 Arr_curve_end ce2/*! for xseg */) const
+    {
+      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
+      typename Subcurve_traits_2::Compare_x_at_limit_2
+        compare_x_at_limit = geom_traits->compare_x_at_limit_2_object();
+
+      unsigned int index = this->get_curve_index(xcv, ce1 );
+
+      return compare_x_at_limit(xcv[index], ce1, xseg, ce2 );
+    }
+  };
+
+  Compare_x_at_limit_2 compare_x_at_limit_2_object() const
+  { return Compare_x_at_limit_2(*this); }
+
+  class Compare_x_near_limit_2{
+  protected:
+    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
+      Polycurve_basic_traits_2;
+
+    /*! The polycurve traits (in case it has state). */
+    const Polycurve_basic_traits_2& m_poly_traits;
+
+  public:
+    Compare_x_near_limit_2(const Polycurve_basic_traits_2& traits) :
+      m_poly_traits(traits)
+    {}
+
+    unsigned int get_curve_index (const X_monotone_curve_2& xcv,
+                                  const Arr_curve_end ce) const
+    {
+      //waqar:: dont know why it is opposite in Parameter_space_in_x...
+      // I think this is because of the way the subcurves are stored in the
+      // curve_vector.
+      // I am assuming that min end depends upon the direction and not the
+      // x-value.
+      // and also that min end subcurve is always placed at position 0 of the
+      // vector.
+      // Comfirm with Eric.
+      unsigned int index =
+        (ce == ARR_MIN_END) ? 0 : xcv.number_of_subcurves() - 1;
+      return index;
+    }
+
+    Comparison_result operator()(const X_monotone_curve_2 xcv1,
+                                 const X_monotone_curve_2 xcv2,
+                                 Arr_curve_end ce) const
+    {
+      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
+      typename Subcurve_traits_2::Compare_x_near_limit_2
+        cmp_x_near_limit = geom_traits->compare_x_near_limit_2_object();
+
+      unsigned int index_1 = this->get_curve_index(xcv1, ce);
+      unsigned int index_2 = this->get_curve_index(xcv2, ce);
+
+      return cmp_x_near_limit(xcv1[index_1], xcv2[index_2], ce);
+    }
+  };
+
+  Compare_x_near_limit_2 compare_x_near_limit_2_object() const
+  { return Compare_x_near_limit_2(*this); }
+
+  /*! A functor that compares the y-coordinate of two given points
+   * that lie on the vertical identification curve.
+   */
+  class Compare_y_on_boundary_2 {
+  protected:
+    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
+      Polycurve_basic_traits_2;
+
+    /*! The polycurve traits (in case it has state). */
+    const Polycurve_basic_traits_2& m_poly_traits;
+
+  public:
+    /*! Constructor. */
+    Compare_y_on_boundary_2(const Polycurve_basic_traits_2& traits) :
+      m_poly_traits(traits)
+    {}
+
+    /*! Compare the y-coordinate of two given points that lie on the vertical
+     * identification curve.
+     * \param p1 the first point.
+     * \param p2 the second point.
+     * \return SMALLER - p1 is lexicographically smaller than p2;
+     *         EQUAL   - p1 and p2 coincides;
+     *         LARGER  - p1 is lexicographically larger than p2;
+     * \pre p1 lies on the vertical identification curve.
+     * \pre p2 lies on the vertical identification curve.
+     */
+    Comparison_result operator()(const Point_2& p1, const Point_2& p2) const
+    {
+      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
+      return geom_traits->compare_y_on_boundary_2_object()(p1, p2);
+    }
+  };
+
+  /*! Obtain a Compare_y_on_boundary_2 function object */
+  Compare_y_on_boundary_2 compare_y_on_boundary_2_object() const
+  { return Compare_y_on_boundary_2(*this); }
+
+  /*! A functor that compares the y-coordinates of curve-ends near the
+   * boundary of the parameter space.
+   */
+  class Compare_y_near_boundary_2 {
+  protected:
+    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
+      Polycurve_basic_traits_2;
+
+    /*! The polycurve traits (in case it has state). */
+    const Polycurve_basic_traits_2& m_poly_traits;
+
+  public:
+    /*! Constructor. */
+    Compare_y_near_boundary_2(const Polycurve_basic_traits_2& traits) :
+      m_poly_traits(traits)
+    {}
+
+    /*! Compare the y-coordinates of 2 curves at their ends near the boundary
+     * of the parameter space.
+     * \param xcv1 the first curve.
+     * \param xcv2 the second curve.
+     * \param ce the curve-end indicator:
+     *     ARR_MIN_END - the minimal end or
+     *     ARR_MAX_END - the maximal end
+     * \return the second comparison result.
+     * \pre the ce ends of the curves xcv1 and xcv2 lie either on the left
+     *      boundary or on the right boundary of the parameter space (implying
+     *      that they cannot be vertical).
+     * There is no horizontal identification curve!
+     */
+    Comparison_result operator()(const X_monotone_curve_2& xcv1,
+                                 const X_monotone_curve_2& xcv2,
+                                 Arr_curve_end ce) const
+    {
+      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
+      Comparison_result direction1 =
+        geom_traits->compare_endpoints_xy_2_object()(xcv1[0]);
+      const X_monotone_subcurve_2& xs1 =
+        (((direction1 == SMALLER) && (ce == ARR_MAX_END)) ||
+         ((direction1 == LARGER) && (ce == ARR_MIN_END))) ?
+        xcv1[0] : xcv1[xcv1.number_of_subcurves()-1];
+      Comparison_result direction2 =
+        geom_traits->compare_endpoints_xy_2_object()(xcv2[0]);
+      const X_monotone_subcurve_2& xs2 =
+        (((direction2 == SMALLER) && (ce == ARR_MAX_END)) ||
+         ((direction2 == LARGER) && (ce == ARR_MIN_END))) ?
+        xcv2[0] : xcv2[xcv2.number_of_subcurves()-1];
+      return geom_traits->compare_y_near_boundary_2_object()(xs1, xs2, ce);
+    }
+  };
+
+  /*! Obtain a Compare_y_near_boundary_2 function object */
+  Compare_y_near_boundary_2 compare_y_near_boundary_2_object() const
+  { return Compare_y_near_boundary_2(*this); }
+
+  /*! A functor that indicates whether a geometric object lies on the
+   * vertical identification curve.
+   */
+  class Is_on_y_identification_2 {
+  protected:
+    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
+      Polycurve_basic_traits_2;
+
+    /*! The polycurve traits (in case it has state). */
+    const Polycurve_basic_traits_2& m_poly_traits;
+
+  public:
+    /*! Constructor. */
+    Is_on_y_identification_2(const Polycurve_basic_traits_2& traits) :
+      m_poly_traits(traits)
+    {}
+
+    /*! Determine whether a point lies in the vertical boundary.
+     * \param p the point.
+     * \return a Boolean indicating whether p lies in the vertical boundary.
+     */
+    bool operator()(const Point_2& p) const
+    {
+      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
+      return geom_traits->is_on_y_identification_2_object()(p);
+    }
+
+    /*! Determine whether an x-monotone curve lies in the vertical boundary.
+     * \param xcv the x-monotone curve.
+     * \return a Boolean indicating whether xcv lies in the vertical boundary.
+     */
+    bool operator()(const X_monotone_curve_2& xcv) const
+    {
+      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
+      typename X_monotone_curve_2::Subcurve_const_iterator it;
+      for (it = xcv.subcurves_begin(); it != xcv.subcurves_end(); ++it)
+        if (! geom_traits->is_on_y_identification_2_object()(*it)) return false;
+      return true;
+    }
+  };
+
+  /*! Obtain a Is_on_y_identification_2 function object */
+  Is_on_y_identification_2 is_on_y_identification_2_object() const
+  { return Is_on_y_identification_2(*this); }
+
+  /*! A functor that indicates whether a geometric object lies on the
+   * horizontal identification curve.
+   */
+  class Is_on_x_identification_2 {
+  protected:
+    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
+      Polycurve_basic_traits_2;
+
+    /*! The polycurve traits (in case it has state). */
+    const Polycurve_basic_traits_2& m_poly_traits;
+
+  public:
+    /*! Constructor. */
+    Is_on_x_identification_2(const Polycurve_basic_traits_2& traits) :
+      m_poly_traits(traits)
+    {}
+
+    /*! Determine whether a point lies in the vertical boundary.
+     * \param p the point.
+     * \return a Boolean indicating whether p lies in the vertical boundary.
+     */
+    bool operator()(const Point_2& p) const
+    {
+      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
+      return geom_traits->is_on_x_identification_2_object()(p);
+    }
+
+    /*! Determine whether an x-monotone curve lies in the vertical boundary.
+     * \param xcv the x-monotone curve.
+     * \return a Boolean indicating whether xcv lies in the vertical boundary.
+     */
+    bool operator()(const X_monotone_curve_2& xcv) const
+    {
+      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
+      typename X_monotone_curve_2::Subcurve_const_iterator it;
+      for (it = xcv.subcurves_begin(); it != xcv.subcurves_end(); ++it)
+        if (! geom_traits->is_on_x_identification_2_object()(*it)) return false;
+      return true;
+    }
+  };
+
+  /*! Obtain a Is_on_x_identification_2 function object */
+  Is_on_x_identification_2 is_on_x_identification_2_object() const
+  { return Is_on_x_identification_2(*this); }
+
+  //@}
+
+  /// \name Types and functors defined here not required by any concept.
+  //@{
+
+  /*! \class
+   * A functor that obtains the number of points of a polycurve.
+   */
+  class Number_of_points_2 {
+  public:
+    size_type operator()(const X_monotone_curve_2& cv) const
+    {
+      size_type num_seg = cv.number_of_subcurves();
+      return (num_seg == 0) ? 0 : num_seg + 1;
+    }
+  };
+
+  Number_of_points_2 number_of_points_2_object() const
+  { return Number_of_points_2(); }
+
+  /* Functor to augment a polycurve by adding a subcurve at the back.
+   * TODO: Test all the operator()'s. (Don't forget vertical cases!)
+   */
+  class Push_back_2 {
+  protected:
+    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
+      Polycurve_basic_traits_2;
+
+    /*! The traits (in case it has state). */
+    const Polycurve_basic_traits_2& m_poly_traits;
+
+  public:
+    /*! Constructor. */
+    Push_back_2(const Polycurve_basic_traits_2& traits) :
+      m_poly_traits(traits)
+    {}
+
+    /*! Append a subcurve to an existing x-monotone polycurve at the back.
+     */
+    void operator()(X_monotone_curve_2& xcv, const X_monotone_subcurve_2& seg)
+      const
+    { push_back_2_impl<void*>(xcv, seg, Are_all_sides_oblivious_tag()); }
+
+  private:
+    // Oblivious implementation
+    template<typename>
+    void push_back_2_impl(X_monotone_curve_2& xcv,
+                          const X_monotone_subcurve_2& seg,
+                          Arr_all_sides_oblivious_tag) const
+    {
+      CGAL_precondition_code
+        (
+         typedef typename X_monotone_curve_2::size_type size_type;
+         size_type num_seg = xcv.number_of_subcurves();
+         const Subcurve_traits_2* geom_traits =
+           m_poly_traits.subcurve_traits_2();
+         typename Subcurve_traits_2::Compare_endpoints_xy_2 cmp_seg_endpts =
+           geom_traits->compare_endpoints_xy_2_object();
+         Comparison_result dir = cmp_seg_endpts(seg);
+         typename Subcurve_traits_2::Construct_max_vertex_2 get_max_v =
+           geom_traits->construct_max_vertex_2_object();
+         typename Subcurve_traits_2::Construct_min_vertex_2 get_min_v =
+           geom_traits->construct_min_vertex_2_object();
+         typename Subcurve_traits_2::Equal_2 equal =
+           geom_traits->equal_2_object();
+         typename Subcurve_traits_2::Is_vertical_2 is_vertical =
+           geom_traits->is_vertical_2_object();
+
+         CGAL_precondition_msg((num_seg == 0) ||
+                               ((is_vertical(xcv[0]) && is_vertical(seg)) ||
+                                (!is_vertical(xcv[0]) && !is_vertical(seg))),
+                               "xcv is vertical and seg is not or vice versa!");
+
+         CGAL_precondition_msg((num_seg == 0) ||
+                               (cmp_seg_endpts(xcv[0]) == dir),
+                               "xcv and seg do not have the same orientation!");
+
+           CGAL_precondition_msg((num_seg == 0) ||
+                                 !equal(get_min_v(seg), get_max_v(seg)),
+                                 "Seg degenerates to a point!");
+
+           CGAL_precondition_msg((num_seg == 0) ||
+                                 (((dir != SMALLER) ||
+                                   equal(get_max_v(xcv[num_seg-1]),
+                                         get_min_v(seg)))),
+                                 "Seg does not connect to the right!");
+
+           CGAL_precondition_msg((num_seg == 0) ||
+                                 (((dir != LARGER) ||
+                                   equal(get_min_v(xcv[num_seg-1]),
+                                         get_max_v(seg)))),
+                                 "Seg does not connect to the left!");
+         ); // precondition code ends
+
+      xcv.push_back(seg);
+    }
+
+    // Boundary implementation
+    template<typename>
+    void push_back_2_impl(X_monotone_curve_2& xcv,
+                          const X_monotone_subcurve_2& seg,
+                          Arr_not_all_sides_oblivious_tag) const
+    {
+      CGAL_precondition_code
+        (
+         typedef typename X_monotone_curve_2::size_type size_type;
+         size_type num_seg = xcv.number_of_subcurves();
+         const Subcurve_traits_2* geom_traits =
+           m_poly_traits.subcurve_traits_2();
+         typename Subcurve_traits_2::Compare_endpoints_xy_2 cmp_seg_endpts =
+           geom_traits->compare_endpoints_xy_2_object();
+         Comparison_result dir = cmp_seg_endpts(seg);
+         typename Subcurve_traits_2::Construct_max_vertex_2 get_max_v =
+           geom_traits->construct_max_vertex_2_object();
+         typename Subcurve_traits_2::Construct_min_vertex_2 get_min_v =
+           geom_traits->construct_min_vertex_2_object();
+         typename Subcurve_traits_2::Equal_2 equal =
+           geom_traits->equal_2_object();
+         typename Subcurve_traits_2::Is_vertical_2 is_vertical =
+           geom_traits->is_vertical_2_object();
+         typename Subcurve_traits_2::Parameter_space_in_x_2 ps_x =
+           geom_traits->parameter_space_in_x_2_object();
+         typename Subcurve_traits_2::Parameter_space_in_y_2 ps_y =
+           geom_traits->parameter_space_in_y_2_object();
+
+         CGAL_precondition_msg((num_seg == 0) ||
+                               ((is_vertical(xcv[0]) && is_vertical(seg)) ||
+                                (!is_vertical(xcv[0]) && !is_vertical(seg))),
+                               "xcv is vertical and seg is not or vice versa!");
+
+         CGAL_precondition_msg((num_seg == 0) ||
+                               (cmp_seg_endpts(xcv[0]) == dir),
+                               "xcv and seg do not have the same orientation!");
+
+         const Arr_parameter_space min_x_seg = ps_x(seg, ARR_MIN_END);
+         const Arr_parameter_space min_y_seg = ps_y(seg, ARR_MIN_END);
+         const Arr_parameter_space max_x_seg = ps_x(seg, ARR_MAX_END);
+         const Arr_parameter_space max_y_seg = ps_y(seg, ARR_MAX_END);
+
+         CGAL_precondition_code(const Arr_parameter_space min_x_cv =
+                                ((num_seg>0) ?
+                                 ps_x(xcv[num_seg-1], ARR_MIN_END) :
+                                 ARR_INTERIOR));
+         CGAL_precondition_code(const Arr_parameter_space min_y_cv =
+                                ((num_seg>0) ?
+                                 ps_y(xcv[num_seg-1], ARR_MIN_END) :
+                                 ARR_INTERIOR));
+         CGAL_precondition_code(const Arr_parameter_space max_x_cv =
+                                ((num_seg>0) ?
+                                 ps_x(xcv[num_seg-1], ARR_MAX_END) :
+                                 ARR_INTERIOR));
+         CGAL_precondition_code(const Arr_parameter_space max_y_cv =
+                                ((num_seg>0) ?
+                                 ps_y(xcv[num_seg-1], ARR_MAX_END) :
+                                 ARR_INTERIOR));
+
+         // A subcurve should not be pushed if the polycurve is directed to
+         // the right and reaches the boundary.
+         CGAL_precondition_msg(((dir != SMALLER) ||
+                                ((max_x_cv == ARR_INTERIOR) &&
+                                 (max_y_cv == ARR_INTERIOR))),
+                               "Polycurve reaches the boundary to the right."
+                               "Can not push back any subcurve further." );
+
+         // A subcurve should not be pushed if the polycurve is directed to
+         // the left and reaches the boundary.
+         CGAL_precondition_msg(((dir != LARGER) ||
+                                ((min_x_cv == ARR_INTERIOR) &&
+                                 (min_y_cv == ARR_INTERIOR))),
+                               "Polycurve reaches the boundary to the left."
+                               "Can not push back any subcurve further." );
+
+         // Something like a line should not be pushed if there is already a
+         // subcurve present in the polycurve.
+         CGAL_precondition_msg((((min_x_seg == ARR_INTERIOR) &&
+                                 (min_y_seg == ARR_INTERIOR)) ||
+                                ((max_x_seg == ARR_INTERIOR) &&
+                                 (max_y_seg == ARR_INTERIOR)) ||
+                                (num_seg == 0) ),
+                               "Subcurve reaching the boundary at both ends "
+                               "can not be pushed if there is already one or "
+                               "more subcurves present in the polycurve.");
+
+         if ((min_x_seg == ARR_INTERIOR) && (min_y_seg == ARR_INTERIOR) &&
+             (max_x_seg == ARR_INTERIOR) && (max_y_seg == ARR_INTERIOR))
+         {
+           CGAL_precondition_msg((num_seg == 0) ||
+                                 !equal(get_min_v(seg), get_max_v(seg)),
+                                 "Seg degenerates to a point!");
+         }
+
+         if ((min_x_seg == ARR_INTERIOR) && (min_y_seg == ARR_INTERIOR)) {
+           CGAL_precondition_msg((num_seg == 0) ||
+                                 (((dir != SMALLER) ||
+                                   equal(get_max_v(xcv[num_seg-1]),
+                                         get_min_v(seg)))),
+                                 "Seg does not connect to the right!");
+         }
+
+         if ((max_x_seg == ARR_INTERIOR) && (max_y_seg == ARR_INTERIOR) ) {
+           CGAL_precondition_msg((num_seg == 0) ||
+                                 (((dir != LARGER) ||
+                                   equal(get_min_v(xcv[num_seg-1]),
+                                         get_max_v(seg)))),
+                                 "Seg does not connect to the left!");
+         }
+         ); // precondition code ends
+
+      xcv.push_back(seg);
+    }
+  };
+
+  /*! Obtain a Push_back_2 functor object. */
+  Push_back_2 push_back_2_object() const { return Push_back_2(*this); }
+
+  /* Functor to augment a polycurve by adding a subcurve at the front.
+   * TODO: Test all the operator()'s. (Don't forget vertical cases!)
+   */
+  class Push_front_2 {
+  protected:
+    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
+      Polycurve_basic_traits_2;
+
+    /*! The traits (in case it has state). */
+    const Polycurve_basic_traits_2& m_poly_traits;
+
+  public:
+    /*! Constructor. */
+    Push_front_2(const Polycurve_basic_traits_2& traits) :
+      m_poly_traits(traits)
+    {}
+
+    /* Append a subcurve `seg` to an existing polycurve `xcv` at the front. */
+    void operator()(X_monotone_curve_2& xcv, const X_monotone_subcurve_2& seg)
+      const
+    { push_front_2_impl<void*>(xcv, seg, Are_all_sides_oblivious_tag()); }
+
+  private:
+    // Oblivious implementation
+    template<typename>
+    void push_front_2_impl(X_monotone_curve_2& xcv,
+                           const X_monotone_subcurve_2& seg,
+                           Arr_all_sides_oblivious_tag)
+      const
+    {
+      CGAL_precondition_code
+        (
+         typedef typename X_monotone_curve_2::size_type size_type;
+         size_type num_seg = xcv.number_of_subcurves();
+         const Subcurve_traits_2* geom_traits =
+           m_poly_traits.subcurve_traits_2();
+         typename Subcurve_traits_2::Compare_endpoints_xy_2 cmp_seg_endpts =
+           geom_traits->compare_endpoints_xy_2_object();
+         Comparison_result dir = cmp_seg_endpts(seg);
+         typename Subcurve_traits_2::Construct_max_vertex_2 get_max_v =
+           geom_traits->construct_max_vertex_2_object();
+         typename Subcurve_traits_2::Construct_min_vertex_2 get_min_v =
+           geom_traits->construct_min_vertex_2_object();
+         typename Subcurve_traits_2::Equal_2 equal =
+           geom_traits->equal_2_object();
+         typename Subcurve_traits_2::Is_vertical_2 is_vertical =
+           geom_traits->is_vertical_2_object();
+
+         CGAL_precondition_msg((num_seg == 0) ||
+                               ((is_vertical(xcv[0]) && is_vertical(seg)) ||
+                                (!is_vertical(xcv[0]) && !is_vertical(seg))),
+                               "xcv is vertical and seg is not or vice versa!");
+
+         CGAL_precondition_msg((num_seg == 0) ||
+                               (cmp_seg_endpts(xcv[0]) == dir),
+                               "xcv and seg do not have the same orientation!");
+
+
+           CGAL_precondition_msg((num_seg == 0) ||
+                                 !equal(get_min_v(seg), get_max_v(seg)),
+                                 "Seg degenerates to a point!");
+           CGAL_precondition_msg((num_seg == 0) ||
+                                 (((dir != SMALLER) ||
+                                   equal(get_min_v(xcv[0]), get_max_v(seg)))),
+                                 "Seg does not connect to the left!");
+
+           CGAL_precondition_msg((num_seg == 0) ||
+                                 (((dir != LARGER) ||
+                                   equal(get_max_v(xcv[0]), get_min_v(seg)))),
+                                 "Seg does not connect to the right!");
+         ); // precondition code ends
+      xcv.push_front(seg);
+    }
+
+    // Boundary implementation
+    template<typename>
+    void push_front_2_impl(X_monotone_curve_2& xcv,
+                           const X_monotone_subcurve_2& seg,
+                           Arr_not_all_sides_oblivious_tag)
+      const
+    {
+      CGAL_precondition_code
+        (
+         typedef typename X_monotone_curve_2::size_type size_type;
+         size_type num_seg = xcv.number_of_subcurves();
+         const Subcurve_traits_2* geom_traits =
+           m_poly_traits.subcurve_traits_2();
+         typename Subcurve_traits_2::Compare_endpoints_xy_2 cmp_seg_endpts =
+           geom_traits->compare_endpoints_xy_2_object();
+         Comparison_result dir = cmp_seg_endpts(seg);
+         typename Subcurve_traits_2::Construct_max_vertex_2 get_max_v =
+           geom_traits->construct_max_vertex_2_object();
+         typename Subcurve_traits_2::Construct_min_vertex_2 get_min_v =
+           geom_traits->construct_min_vertex_2_object();
+         typename Subcurve_traits_2::Equal_2 equal =
+           geom_traits->equal_2_object();
+         typename Subcurve_traits_2::Parameter_space_in_x_2 ps_x =
+           geom_traits->parameter_space_in_x_2_object();
+         typename Subcurve_traits_2::Parameter_space_in_y_2 ps_y =
+           geom_traits->parameter_space_in_y_2_object();
+         typename Subcurve_traits_2::Is_vertical_2 is_vertical =
+           geom_traits->is_vertical_2_object();
+
+         CGAL_precondition_msg((num_seg == 0) ||
+                               ((is_vertical(xcv[0]) && is_vertical(seg)) ||
+                                (!is_vertical(xcv[0]) && !is_vertical(seg))),
+                               "xcv is vertical and seg is not or vice versa!");
+
+         CGAL_precondition_msg((num_seg == 0) ||
+                               (cmp_seg_endpts(xcv[0]) == dir),
+                               "xcv and seg do not have the same orientation!");
+
+         const Arr_parameter_space min_x_seg = ps_x(seg, ARR_MIN_END);
+         const Arr_parameter_space min_y_seg = ps_y(seg, ARR_MIN_END);
+         const Arr_parameter_space max_x_seg = ps_x(seg, ARR_MAX_END);
+         const Arr_parameter_space max_y_seg = ps_y(seg, ARR_MAX_END);
+
+         // Something like line should not be pushed if there is already a
+         // subcurve present in the polycurve.
+         CGAL_precondition_msg((((min_x_seg == ARR_INTERIOR) &&
+                                 (min_y_seg == ARR_INTERIOR)) ||
+                                ((max_x_seg == ARR_INTERIOR) &&
+                                 (max_y_seg == ARR_INTERIOR)) ||
+                                (num_seg == 0)),
+                               "Subcurve reaching the boundary at both ends"
+                               "can not be pushed if there is already one "
+                               "or more subcurves present in the polycurve.");
+
+         // Something like Ray should not be pushed front if there
+         // is already one or more subcurves present in polycurve.
+         CGAL_precondition_msg((((dir == SMALLER) &&
+                                 (max_x_seg == ARR_INTERIOR) &&
+                                 (max_y_seg == ARR_INTERIOR)) ||
+                                ((dir == LARGER) &&
+                                 (min_x_seg == ARR_INTERIOR) &&
+                                 (min_y_seg == ARR_INTERIOR)) ||
+                                (num_seg == 0)),
+                               "Subcurve reaching the boundary at the "
+                               "connecting end can not be pushed ");
+
+         if ((min_x_seg == ARR_INTERIOR) && (min_y_seg == ARR_INTERIOR) &&
+             (max_x_seg == ARR_INTERIOR) && (max_y_seg == ARR_INTERIOR))
+         {
+           CGAL_precondition_msg((num_seg == 0) ||
+                                 !equal(get_min_v(seg), get_max_v(seg)),
+                                 "Seg degenerates to a point!");
+         }
+
+         if ((max_x_seg == ARR_INTERIOR) && (max_y_seg == ARR_INTERIOR)) {
+           CGAL_precondition_msg((num_seg == 0) ||
+                                 (((dir != SMALLER) ||
+                                   equal(get_min_v(xcv[0]), get_max_v(seg)))),
+                                 "Seg does not connect to the left!");
+         }
+
+         if ((min_x_seg == ARR_INTERIOR) && (min_y_seg == ARR_INTERIOR)) {
+           CGAL_precondition_msg((num_seg == 0) ||
+                                 (((dir != LARGER) ||
+                                   equal(get_max_v(xcv[0]), get_min_v(seg)))),
+                                 "Seg does not connect to the right!");
+         }
+         ); // precondition code ends
+
+      xcv.push_front(seg);
+    }
+  };
+
+  /*! Obtain a Push_front_2 functor object. */
+  Push_front_2 push_front_2_object() const { return Push_front_2(*this); }
+
+  class Trim_2 {
+  protected:
+    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
+      Polycurve_basic_traits_2;
+
+    /* The polycurve traits (in case it has state). */
+    const Polycurve_basic_traits_2& m_poly_traits;
+
+    /*! \brief returns a trimmed version of the polycurve with src and tgt as
+     * end points.
+     */
+  public:
+    /*! Constructor. */
+    Trim_2(const Polycurve_basic_traits_2& traits) :
+      m_poly_traits(traits)
+    {}
+
+    X_monotone_curve_2 operator()(const X_monotone_curve_2& xcv,
+                                  const Point_2& src,
+                                  const Point_2& tgt)const
+    {
+      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
+      typename Subcurve_traits_2::Trim_2 trim = geom_traits->trim_2_object();
+
+      //check whether src and tgt lies on the polycurve/polycurve.
+      CGAL_precondition(m_poly_traits.compare_y_at_x_2_object()(src, xcv) ==
+                        EQUAL);
+      CGAL_precondition(m_poly_traits.compare_y_at_x_2_object()(tgt, xcv) ==
+                        EQUAL);
+
+      /* Check whether the source and the target conform with the
+       * direction of the polycurve.
+       * since the direction of the poly-line/curve should not be changed.
+       * we will interchange the source and the target.
+       */
+      Point_2 source = src;
+      Point_2 target = tgt;
+
+      // If curve is oriented from right to left but points are left to right.
+      if (m_poly_traits.compare_endpoints_xy_2_object()(xcv) == LARGER &&
+          m_poly_traits.compare_x_2_object()(src, tgt) == SMALLER )
+      {
+        source = tgt;
+        target = src;
+      }
+
+      /* If curve is oriented from left to right but points are from right
+       * to left.
+       */
+      else if (m_poly_traits.compare_endpoints_xy_2_object()(xcv) == SMALLER &&
+               m_poly_traits.compare_x_2_object()(src, tgt) == LARGER )
+      {
+        source = tgt;
+        target = src;
+      }
+
+      // std::cout << "**************the new sourc: " << source
+      //           << "the new target: " << target << std::endl;
+      /*
+       * Get the source and target subcurve numbers from the polycurve.
+       * The trimmed polycurve will have trimmed end subcurves(containing
+       * source and target) along with complete
+       * subcurves in between them.
+       */
+      std::size_t source_id = m_poly_traits.locate(xcv, source);
+      std::size_t target_id = m_poly_traits.locate(xcv, target);
+      // std::cout << "source number: " << source_id << "  Target number : "
+      //           << target_id << std::endl;
+      // std::cout << "target subcurve: " << xcv[target_id] << std::endl;
+
+      std::vector<X_monotone_subcurve_2> trimmed_subcurves;
+
+      Comparison_result orientation =
+        m_poly_traits.compare_endpoints_xy_2_object()(xcv);
+
+      Point_2 source_max_vertex =
+        geom_traits->construct_max_vertex_2_object()(xcv[source_id]);
+      Point_2 source_min_vertex =
+        geom_traits->construct_min_vertex_2_object()(xcv[source_id]);
+      Point_2 target_min_vertex =
+        geom_traits->construct_min_vertex_2_object()(xcv[target_id]);
+      Point_2 target_max_vertex =
+        geom_traits->construct_max_vertex_2_object()(xcv[target_id]);
+
+      //push the trimmed version of the source subcurve.
+      // if(sorientation == SMALLER && source != source_max_vertex)
+      if ((orientation == SMALLER) &&
+          ! geom_traits->equal_2_object()(source, source_max_vertex) )
+      {
+        if (source_id != target_id )
+          trimmed_subcurves.push_back(trim(xcv[source_id],
+                                           source, source_max_vertex));
+        else trimmed_subcurves.push_back(trim(xcv[source_id], source, target));
+      }
+      //else if(orientation == LARGER && source != source_min_vertex)
+      else if ((orientation == LARGER) &&
+               ! geom_traits->equal_2_object()(source, source_min_vertex))
+      {
+        if (source_id != target_id )
+          trimmed_subcurves.push_back(trim(xcv[source_id],
+                                          source, source_min_vertex));
+        else trimmed_subcurves.push_back(trim(xcv[source_id], source, target));
+      }
+
+      //push the middle subcurves as they are.
+      for (size_t i = source_id+1; i<target_id; ++i)
+        trimmed_subcurves.push_back(xcv[i] );
+
+      //push the appropriately trimmed target subcurve.
+      if (source_id != target_id) {
+        //if(orientation == SMALLER && target != target_min_vertex)
+        if ((orientation == SMALLER) &&
+            ! geom_traits->equal_2_object()(target, target_min_vertex))
+          trimmed_subcurves.push_back(trim(xcv[target_id],
+                                          target_min_vertex, target));
+
+        //else if (orientation == LARGER && target != target_max_vertex)
+        else if ((orientation == LARGER) &&
+                 ! geom_traits->equal_2_object()(target, target_max_vertex))
+          trimmed_subcurves.push_back(trim(xcv[target_id],
+                                          target_max_vertex, target));
+      }
+
+      return X_monotone_curve_2(trimmed_subcurves.begin(),
+                                trimmed_subcurves.end());
+    }
+  };
+
+  /*! Obtain a Trim_2 functor object. */
+  Trim_2 trim_2_object() const { return Trim_2(*this); }
+
+  ///@}
+
+protected:
+  /*
+   * Roadmap: locate() should return an iterator to the located subcurve
+   */
+
+  /*! Obtain the index of the subcurve in the polycurve that contains the
+   * point q in its x-range. The function performs a binary search, so if the
+   * point q is in the x-range of the polycurve with n subcurves, the subcurve
+   * containing it can be located in O(log n) operations.
+   * \param cv The polycurve curve.
+   * \param q The point.
+   * \return An index i such that q is in the x-range of cv[i].
+   *         If q is not in the x-range of cv, returns INVALID_INDEX.
+   */
+  template <typename Compare>
+  std::size_t locate_gen(const X_monotone_curve_2& cv, Compare compare) const
+  {
+    // The direction of cv. SMALLER means left-to-right and
+    // otherwise right-to-left
+    Comparison_result direction =
+      subcurve_traits_2()->compare_endpoints_xy_2_object()(cv[0]);
+    std::size_t from, to;
+    if (direction == SMALLER) {
+      from = 0;
+      to = cv.number_of_subcurves() - 1;
+    }
+    else {
+      from = cv.number_of_subcurves() - 1;
+      to = 0;
+    }
+
+    // Test if q is one of cv's end points
+    Comparison_result res_from = compare(cv[from], ARR_MIN_END);
+    if (res_from == EQUAL) return from;
+
+    Comparison_result res_to = compare(cv[to], ARR_MAX_END);
+    if (res_to == EQUAL) return to;
+
+    if (res_to == res_from) return INVALID_INDEX;
+
+    // Perform a binary search to locate the subcurve that contains q in its
+    // range:
+    while (((direction == SMALLER) && (to > from)) ||
+           ((direction == LARGER) && (to < from)))
+    {
+      std::size_t mid = (from + to) / 2;
+      if (((direction == SMALLER) && (mid > from)) ||
+          ((direction == LARGER) && (mid < from)))
+      {
+        Comparison_result res_mid = compare(cv[mid], ARR_MIN_END);
+        if (res_mid == EQUAL) {
+          // Ensure that the returned subcurve contains the query point
+          // on its right end (if possible)
+          if ((direction == SMALLER) && (mid > 0)) --mid;
+          else if ((direction == LARGER) &&
+                   ((mid + 1) < cv.number_of_subcurves()))
+            ++mid;
+          return mid;
+        }
+        if (res_mid == res_from) from = mid;
+        else to = (direction == SMALLER) ? mid - 1 : mid + 1;
+      }
+      else {
+        CGAL_assertion(((direction == SMALLER) && (mid < to)) ||
+                       ((direction == LARGER) && (mid > to)));
+        Comparison_result res_mid = compare(cv[mid], ARR_MAX_END);
+        if (res_mid == EQUAL) return mid;
+        if (res_mid == res_to) to = mid;
+        else from = (direction == SMALLER) ? mid + 1 : mid - 1;
+      }
+    }
+    // In case (from == to), and we know that the polycurve contains the q:
+    CGAL_assertion(from == to);
+    return from;
+  }
+
+  // A utility class that compare a curve-end with a point.
+  template <typename Comparer>
+  class Compare_points {
+  private:
+    typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
+      Polycurve_basic_traits_2;
+
+    /*! The polycurve traits (in case it has state). */
+    const Polycurve_basic_traits_2& m_poly_traits;
+
+    const Point_2& m_point;
+
+    Comparer m_compare;
+
+  public:
+    // Constructor
+    Compare_points(const Polycurve_basic_traits_2& traits, Comparer compare,
+                   const Point_2& p) :
+      m_poly_traits(traits),
+      m_point(p),
+      m_compare(compare)
+    {}
+
+    // Compare the given curve-end with the stored point.
+    Comparison_result operator()(const X_monotone_subcurve_2& xs,
+                                 Arr_curve_end ce)
+    {
+      const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
+      const Point_2& p = (ce == ARR_MAX_END) ?
+        geom_traits->construct_max_vertex_2_object()(xs) :
+        geom_traits->construct_min_vertex_2_object()(xs);
+      return m_compare(p, m_point);
+    }
+  };
+
+  // A utility class that compares two curve-ends.
+  template <typename Comparer>
+  class Compare_point_curve_end {
+  private:
+    const Point_2& m_point;
+
+    Comparer m_compare;
+
+  public:
+    // Constructor
+    Compare_point_curve_end(Comparer compare, const Point_2& p) :
+      m_point(p),
+      m_compare(compare)
+    {}
+
+    // Compare a given curve-end with the stored point.
+    Comparison_result operator()(const X_monotone_subcurve_2& xs,
+                                 Arr_curve_end ce)
+    { return m_compare(xs, ce, m_point); }
+  };
+
+  // A utility class that compare two curve-ends.
+  template <typename Comparer>
+  class Compare_curve_ends {
+  private:
+    const X_monotone_subcurve_2& m_x_monotone_subcurve;
+
+    Arr_curve_end m_curve_end;
+
+    Comparer m_compare;
+
+  public:
+    // Constructor
+    Compare_curve_ends(Comparer compare,
+                       const X_monotone_subcurve_2& xs, Arr_curve_end ce) :
+      m_x_monotone_subcurve(xs),
+      m_curve_end(ce),
+      m_compare(compare)
+    {}
+
+    // Compare the given curve-end with the stored curve end.
+    Comparison_result operator()(const X_monotone_subcurve_2& xs,
+                                 Arr_curve_end ce)
+    { return m_compare(xs, ce, m_x_monotone_subcurve, m_curve_end); }
+  };
+
+  /*! Locate the index of a curve in a polycurve that contains an endpoint
+   * of a curve.
+   * This implementation is used in the case where at least one side of the
+   * parameter space is not oblivious.
+   * \param xcv (in) the given polycurve.
+   * \param xs (in) the given curve.
+   * \param cd (in) the curve-end indicator.
+   */
+  std::size_t locate_impl(const X_monotone_curve_2& xcv,
+                          const X_monotone_subcurve_2& xs,
+                          Arr_curve_end ce,
+                          Arr_not_all_sides_oblivious_tag) const
+  {
+    const Subcurve_traits_2* geom_traits = subcurve_traits_2();
+    if (geom_traits->is_vertical_2_object()(xcv[0])) {
+      // Verify that q has the same x-coord as xcv (which is vertical)
+      Compare_x_2 compare_x = compare_x_2_object();
+      Comparison_result res = compare_x(xcv[0], ARR_MIN_END, xs, ce);
+      if (res != EQUAL) return INVALID_INDEX;
+
+      Compare_curve_ends<Compare_xy_2> compare(compare_xy_2_object(), xs, ce);
+      return locate_gen(xcv, compare);
+    }
+
+    Compare_curve_ends<Compare_x_2> compare(compare_x_2_object(), xs, ce);
+    return locate_gen(xcv, compare);
+  }
+
+  /*! Locate the index of a curve in a polycurve that contains an endpoint
+   * of a curve.
+   * This implementation is used in the case where all sides of the parameter
+   * space is oblivious.
+   * \param xcv (in) the given polycurve.
+   * \param xs (in) the given curve.
+   * \param cd (in) the curve-end indicator.
+   */
+  std::size_t locate_impl(const X_monotone_curve_2& xcv,
+                          const X_monotone_subcurve_2& xs,
+                          Arr_curve_end ce,
+                          Arr_all_sides_oblivious_tag) const
+  {
+    const Subcurve_traits_2* geom_traits = subcurve_traits_2();
+    const Point_2& p = (ce == ARR_MAX_END) ?
+      geom_traits->construct_max_vertex_2_object()(xs) :
+      geom_traits->construct_min_vertex_2_object()(xs);
+    return locate(xcv, p);
+  }
+
+  /*! Locate the index of a curve in a polycurve that contains an endpoint
+   * of a curve.
+   * This implementation is used in the case where at least one side of the
+   * parameter space is not oblivious.
+   * \param xcv (in) the given polycurve.
+   * \param p (in) the endpoint of a curve.
+   */
+  std::size_t locate_impl(const X_monotone_curve_2& xcv,
+                          const Point_2& p,
+                          Arr_not_all_sides_oblivious_tag) const
+  {
+    const Subcurve_traits_2* geom_traits = subcurve_traits_2();
+    if (geom_traits->is_vertical_2_object()(xcv[0])) {
+      // Verify that q has the same x-coord as xcv (which is vertical)
+      Compare_x_2 compare_x = compare_x_2_object();
+      Comparison_result res = compare_x(xcv[0], ARR_MIN_END, p);
+      if (res != EQUAL) return INVALID_INDEX;
+
+      Compare_point_curve_end<Compare_xy_2> compare(compare_xy_2_object(), p);
+      return locate_gen(xcv, compare);
+    }
+
+    Compare_point_curve_end<Compare_x_2> compare(compare_x_2_object(), p);
+    return locate_gen(xcv, compare);
+  }
+
+  /*! Locate the index of a curve in a polycurve that contains an endpoint
+   * of a curve.
+   * This implementation is used in the case where all sides of the parameter
+   * space is oblivious.
+   * \param xcv (in) the given polycurve.
+   * \param p (in) the endpoint of a curve.
+   */
+  std::size_t locate_impl(const X_monotone_curve_2& xcv, const Point_2& p,
+                          Arr_all_sides_oblivious_tag) const
+  { return locate(xcv, p); }
+
+  //
+  std::size_t locate(const X_monotone_curve_2& xcv, const Point_2& q) const
+  {
+    const Subcurve_traits_2* geom_traits = subcurve_traits_2();
+    if (geom_traits->is_vertical_2_object()(xcv[0])) {
+      // Verify that q has the same x-coord as cv (which is vertical)
+      typename Subcurve_traits_2::Construct_min_vertex_2 min_vertex =
+        geom_traits->construct_min_vertex_2_object();
+      typename Subcurve_traits_2::Compare_x_2 compare_x =
+        geom_traits->compare_x_2_object();
+      Comparison_result res = compare_x(min_vertex(xcv[0]), q);
+      if (res != EQUAL) return INVALID_INDEX;
+
+      Compare_points<Compare_xy_2> compare(geom_traits,
+                                           compare_xy_2_object(), q);
+      return locate_gen(xcv, compare);
+    }
+
+    Compare_points<Compare_x_2> compare(geom_traits, compare_x_2_object(), q);
+    return locate_gen(xcv, compare);
+  }
+
+  /*! Find the index of the subcurve in the polycurve that is defined to the
+   * left(or to the right) of the point q.
+   * \param cv The polycurve curve.
+   * \param q The point.
+   * \param to_right(true) if we wish to locate a subcurve to the right of q,
+   *               (false) if we wish to locate a subcurve to its right.
+   * \return An index i such that subcurves[i] is defined to the left(or to the
+   *         right) of q, or INVALID_INDEX if no such subcurve exists.
+   */
+  std::size_t locate_side(const X_monotone_curve_2& cv,
+                          const Point_2& q, const bool& to_right) const
+  {
+    // First locate a subcurve subcurves[i] that contains q in its x-range.
+    std::size_t i = locate(cv, q);
+    if (i == INVALID_INDEX) return INVALID_INDEX;
+
+    typename Subcurve_traits_2::Equal_2 equal =
+      subcurve_traits_2()->equal_2_object();
+    typename Subcurve_traits_2::Compare_endpoints_xy_2 cmp_seg_endpts =
+      subcurve_traits_2()->compare_endpoints_xy_2_object();
+    typename Subcurve_traits_2::Compare_x_2 comp_x =
+      subcurve_traits_2()->compare_x_2_object();
+    typename Subcurve_traits_2::Is_vertical_2 is_vert =
+      subcurve_traits_2()->is_vertical_2_object();
+    typename Subcurve_traits_2::Construct_max_vertex_2 get_max_v =
+      subcurve_traits_2()->construct_max_vertex_2_object();
+    typename Subcurve_traits_2::Construct_min_vertex_2 get_min_v =
+      subcurve_traits_2()->construct_min_vertex_2_object();
+
+    Comparison_result direction = cmp_seg_endpts(cv[i]);
+
+    if ((!is_vert(cv[0]) && (comp_x(get_min_v(cv[i]), q) == EQUAL)) ||
+        (is_vert(cv[0]) && equal(get_min_v(cv[i]), q))){
+      // q is the left endpoint of the i'th subcurve:
+      if (to_right) return i;
+      else {
+        // to_left
+        if (direction == SMALLER) {
+          if (i == 0) return INVALID_INDEX;
+          else return i - 1;
+        }
+        else {
+          if (i == cv.number_of_subcurves()-1) return INVALID_INDEX;
+          else return i+1;
+        }
+      }
+    }
+
+    if ((!is_vert(cv[0]) && (comp_x(get_max_v(cv[i]), q) == EQUAL)) ||
+        (is_vert(cv[0]) && equal(get_max_v(cv[i]), q)))
+    {
+      // q is the right endpoint of the i'th subcurve:
+      if (!to_right) return i;
+      else {
+        if (direction == SMALLER) {
+          if (i == (cv.number_of_subcurves() - 1)) return INVALID_INDEX;
+          else return i + 1;
+        }
+        else {
+          if (i == 0) return INVALID_INDEX;
+          else return i-1;
+        }
+      }
+    }
+
+    // In case q is in cv[i]'s interior:
+    return i;
+  }
+};
+
+} //namespace CGAL
+
+#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_polycurve_traits_2.h b/3rdparty/CGAL/include/CGAL/Arr_polycurve_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_polycurve_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_polycurve_traits_2.h
diff --git a/3rdparty/CGAL/include/CGAL/Arr_polyline_traits_2.h b/3rdparty/CGAL/include/CGAL/Arr_polyline_traits_2.h
new file mode 100644
index 0000000..ceaeb66
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Arr_polyline_traits_2.h
@@ -0,0 +1,600 @@
+// Copyright (c) 2000-2014
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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.
+//
+// Author(s)     : Waqar Khan <wkhan at mpi-inf.mpg.de>
+
+#ifndef CGAL_ARR_POLYLINE_TRAITS_2_H
+#define CGAL_ARR_POLYLINE_TRAITS_2_H
+
+/*! \file
+ * The traits-class for the linear piece-wiese(polyline) type of curves of the
+ * arrangement package.
+ */
+
+#include <list>
+#include <iterator>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/utility/enable_if.hpp>
+
+#include <CGAL/basic.h>
+#include <CGAL/tags.h>
+#include <CGAL/Arr_segment_traits_2.h>
+#include <CGAL/Arr_polycurve_traits_2.h>
+#include <CGAL/Arr_tags.h>
+#include <CGAL/Arr_enums.h>
+
+namespace CGAL {
+
+// If no template instantiation is provided, it will be instantiated
+// with Arr_segment_traits.
+template <typename SegmentTraits_2 = Arr_segment_traits_2<> >
+class Arr_polyline_traits_2 : public Arr_polycurve_traits_2<SegmentTraits_2> {
+public:
+  typedef SegmentTraits_2                             Segment_traits_2;
+
+private:
+  typedef Arr_polyline_traits_2<Segment_traits_2>     Self;
+  typedef Arr_polycurve_traits_2<Segment_traits_2>    Base;
+
+public:
+  /// \name Types inherited from the polycurve traits class.
+  //@{
+
+  // Tag definitions:
+  typedef typename Base::Has_left_category            Has_left_category;
+  typedef typename Base::Has_merge_category           Has_merge_category;
+  typedef typename Base::Has_do_intersect_category
+    Has_do_intersect_category;
+
+  typedef typename Base::Left_side_category           Left_side_category;
+  typedef typename Base::Bottom_side_category         Bottom_side_category;
+  typedef typename Base::Top_side_category            Top_side_category;
+  typedef typename Base::Right_side_category          Right_side_category;
+
+  typedef typename Base::Are_all_sides_oblivious_tag
+    Are_all_sides_oblivious_tag;
+
+  typedef typename Base::X_monotone_subcurve_2         X_monotone_subcurve_2;
+  typedef typename Base::Subcurve_2                   Subcurve_2;
+
+  typedef typename Base::Point_2                      Point_2;
+  typedef typename Base::Curve_2                      Curve_2;
+  typedef typename Base::X_monotone_curve_2           X_monotone_curve_2;
+
+  typedef typename Base::Multiplicity                 Multiplicity;
+
+  typedef typename Base::Compare_x_2                  Compare_x_2;
+  typedef typename Base::Compare_xy_2                 Compare_xy_2;
+  typedef typename Base::Construct_min_vertex_2       Construct_min_vertex_2;
+  typedef typename Base::Construct_max_vertex_2       Construct_max_vertex_2;
+  typedef typename Base::Is_vertical_2                Is_vertical_2;
+  typedef typename Base::Compare_y_at_x_2             Compare_y_at_x_2;
+  typedef typename Base::Compare_y_at_x_left_2        Compare_y_at_x_left_2;
+  typedef typename Base::Compare_y_at_x_right_2       Compare_y_at_x_right_2;
+  typedef typename Base::Equal_2                      Equal_2;
+  typedef typename Base::Compare_endpoints_xy_2       Compare_endpoints_xy_2;
+  typedef typename Base::Construct_opposite_2         Construct_opposite_2;
+  typedef typename Base::Approximate_2                Approximate_2;
+  typedef typename Base::Parameter_space_in_x_2       Parameter_space_in_x_2;
+  typedef typename Base::Parameter_space_in_y_2       Parameter_space_in_y_2;
+  typedef typename Base::Compare_x_on_boundary_2      Compare_x_on_boundary_2;
+  typedef typename Base::Compare_x_at_limit_2         Compare_x_at_limit_2;
+  typedef typename Base::Compare_x_near_limit_2       Compare_x_near_limit_2;
+  typedef typename Base::Compare_y_on_boundary_2      Compare_y_on_boundary_2;
+  typedef typename Base::Compare_y_near_boundary_2    Compare_y_near_boundary_2;
+  typedef typename Base::Is_on_y_identification_2     Is_on_y_identification_2;
+  typedef typename Base::Is_on_x_identification_2     Is_on_x_identification_2;
+
+  typedef typename Base::Split_2                      Split_2;
+  typedef typename Base::Intersect_2                  Intersect_2;
+  typedef typename Base::Are_mergeable_2              Are_mergeable_2;
+  typedef typename Base::Merge_2                      Merge_2;
+
+  typedef typename Base::Number_of_points_2           Number_of_points_2;
+  typedef typename Base::Trim_2                       Trim_2;
+
+  //@}
+
+public:
+  /*! Construct default. */
+  Arr_polyline_traits_2() : Base() {}
+
+  /*! Construct from a segment traits
+   * \param geom_traits an already existing segment tarits which is passed will
+   *        be used by the class.
+   */
+  Arr_polyline_traits_2(const Segment_traits_2* geom_traits) :
+    Base(geom_traits)
+  {}
+
+  /// \name Types and functors defined here.
+  //@{
+
+  /* Functor to augment a polyline by either adding a vertex or a segment
+   * at the back.
+   */
+  class Push_back_2 : public Base::Push_back_2 {
+  protected:
+    typedef Arr_polyline_traits_2<SegmentTraits_2>     Polyline_traits_2;
+
+  public:
+    /*! Constructor. */
+    Push_back_2(const Polyline_traits_2& traits) :
+      Base::Push_back_2(traits)
+    {}
+
+    // Normally, the moment the compiler finds a name, it stops looking. In
+    // other words, the compiler first finds the operator() in the current
+    // class and stops looking, never finding the one in the base class.
+    // Explicitly bring the base operator() into scope, unnecesitating the
+    // code below.
+    using Base::Push_back_2::operator();
+
+    // /*! Append a segment `seg` to an existing polyline `cv` at the back. */
+    // void operator()(Curve_2& cv, const Segment_2& seg) const
+    // { Base::Push_back_2::operator() (cv, seg); }
+
+    // /* Append a segment `seg` to an existing polyline `xcv` at the back. */
+    // void operator()(X_monotone_curve_2& xcv,
+    //                 const X_monotone_subcurve_2& seg) const
+    // { Base::Push_back_2::operator()(xcv, seg); }
+
+    /* Append a point `p` to an existing polyline `cv` at the back. */
+    void operator()(Curve_2& cv, const Point_2& p) const
+    {
+      typedef typename Curve_2::size_type size_type;
+      size_type num_seg = cv.number_of_subcurves();
+      CGAL_precondition(num_seg > 0);
+      int last_seg = num_seg-1;
+
+      const Segment_traits_2* seg_traits =
+        this->m_poly_traits.subcurve_traits_2();
+      typename Segment_traits_2::Compare_endpoints_xy_2 cmp_seg_endpts =
+        seg_traits->compare_endpoints_xy_2_object();
+
+      /* Since it is desired to maintain `cv` well-oriented, we have
+       * to append the segment [cv[last_seg].target(),p]. The
+       * following test determines which end of the last segment is
+       * the target, i.e. the actual end of `cv`.
+       */
+      if (cmp_seg_endpts(cv[last_seg]) == SMALLER) {
+        typename Segment_traits_2::Construct_max_vertex_2 get_max_v =
+          seg_traits->construct_max_vertex_2_object();
+        cv.push_back(Subcurve_2(get_max_v(cv[last_seg]), p));
+      }
+      else {
+        typename Segment_traits_2::Construct_min_vertex_2 get_min_v =
+          seg_traits->construct_min_vertex_2_object();
+        cv.push_back(Subcurve_2(get_min_v(cv[last_seg]), p));
+      }
+    }
+
+    /* Append a point `p` to an existing polyline `xcv` at the back. */
+    void operator()(X_monotone_curve_2& xcv, const Point_2& p) const
+    {
+      typedef typename X_monotone_curve_2::size_type size_type;
+      size_type num_seg = xcv.number_of_subcurves();
+      CGAL_precondition(num_seg > 0);
+
+      const Segment_traits_2* seg_traits =
+        this->m_poly_traits.subcurves_traits_2();
+      CGAL_precondition_code
+        (
+         typename Segment_traits_2::Compare_x_2 comp_x =
+           seg_traits->compare_x_2_object();
+         typename Segment_traits_2::Compare_xy_2 comp_xy =
+           seg_traits->compare_xy_2_object();
+         typename Base::Is_vertical_2 is_vertical =
+           this->m_poly_traits.is_vertical_2_object();
+         );
+
+      if (seg_traits->compare_endpoints_xy_2_object()(xcv[0]) == SMALLER) {
+        // xcv is oriented left-to-right
+        typename Segment_traits_2::Construct_max_vertex_2 get_max_v =
+          seg_traits->construct_max_vertex_2_object();
+        CGAL_precondition
+          (
+           (!is_vertical(xcv) &&
+            (comp_x(get_max_v(xcv[num_seg-1]), p) == SMALLER)) ||
+           (is_vertical(xcv) &&
+            (comp_x(get_max_v(xcv[num_seg-1]), p) == EQUAL) &&
+            (comp_xy(get_max_v(xcv[num_seg-1]), p) == SMALLER))
+           );
+        xcv.push_back(X_monotone_subcurve_2(get_max_v(xcv[num_seg-1]), p));
+      }
+      else {
+        // xcv is oriented right-to-left
+        typename Segment_traits_2::Construct_min_vertex_2 get_min_v =
+          seg_traits->construct_min_vertex_2_object();
+        CGAL_precondition
+          (
+           (!is_vertical(xcv) &&
+            (comp_x(get_min_v(xcv[num_seg-1]), p) == LARGER)) ||
+           (is_vertical(xcv) &&
+            (comp_x(get_min_v(xcv[num_seg-1]), p) == EQUAL) &&
+            (comp_xy(get_min_v(xcv[num_seg-1]), p) == LARGER))
+           );
+        xcv.push_back(X_monotone_subcurve_2(get_min_v(xcv[num_seg-1]), p));
+      }
+    }
+  };
+
+  /*! Obtain a Push_back_2 functor object. */
+  Push_back_2 push_back_2_object() const { return Push_back_2(*this); }
+
+  /* Functor to augment a polyline by either adding a vertex or a segment
+   * at the front.
+   * TODO: Test all the operator()'s. (Don't forget vertical cases!)
+   */
+  class Push_front_2 : public Base::Push_front_2 {
+  protected:
+    typedef Arr_polyline_traits_2<SegmentTraits_2>     Polyline_traits_2;
+
+  public:
+    /*! Constructor. */
+    Push_front_2(const Polyline_traits_2& traits) :
+      Base::Push_front_2(traits)
+    {}
+
+    // Normally, the moment the compiler finds a name, it stops looking. In
+    // other words, the compiler first finds the operator() in the current
+    // class and stops looking, never finding the one in the base class.
+    // Explicitly bring the base operator() into scope, unnecesitating the
+    // code below.
+    using Base::Push_front_2::operator();
+
+    // /*! Append a segment `seg` to an existing polyline `cv` at the front. */
+    // void operator()(Curve_2& cv, const Subcurve_2& seg) const
+    // { Base::Push_front_2::operator()(cv, seg); }
+
+    // /*! Append a segment `seg` to an existing polyline `xcv` at the front. */
+    // void operator()(X_monotone_curve_2& xcv,
+    //                 const X_monotone_subcurve_2& seg) const
+    // { Base::Push_front_2::operator()(xcv, seg); }
+
+    /* Append a point `p` to an existing polyline `cv` at the front. */
+    void operator()(Curve_2& cv, const Point_2& p) const
+    {
+      CGAL_precondition_code
+        (
+         typedef typename Curve_2::size_type size_type;
+         size_type num_seg = cv.number_of_subcurves();
+         );
+      CGAL_precondition(num_seg > 0);
+
+      const Segment_traits_2* geom_traits =
+        this->m_poly_traits.subcurve_traits_2();
+      typename Segment_traits_2::Compare_endpoints_xy_2 cmp_seg_endpts =
+        geom_traits->compare_endpoints_xy_2_object();
+
+      if (cmp_seg_endpts(cv[0]) == SMALLER) {
+        typename Segment_traits_2::Construct_min_vertex_2 get_min_v =
+          geom_traits->construct_min_vertex_2_object();
+        cv.push_front(Subcurve_2(p, get_min_v(cv[0])));
+      }
+      else {
+        typename Segment_traits_2::Construct_max_vertex_2 get_max_v =
+          geom_traits->construct_max_vertex_2_object();
+        cv.push_front(Subcurve_2(p, get_max_v(cv[0])));
+      }
+    }
+
+    /*! Append a point `p` to an existing polyline `xcv` at the front. */
+    void operator()(const X_monotone_curve_2& xcv, Point_2& p) const
+    {
+      const SegmentTraits_2* geom_traits =
+        this->m_poly_traits.subcurve_traits_2();
+      CGAL_precondition_code
+        (
+         typedef typename X_monotone_curve_2::size_type size_type;
+         size_type num_seg = xcv.number_of_subcurves();
+         typename Segment_traits_2::Compare_x_2 comp_x =
+         geom_traits->compare_x_2_object();
+         typename Segment_traits_2::Compare_xy_2 comp_xy =
+         geom_traits->compare_xy_2_object();
+         typename Base::Is_vertical_2 is_vertical =
+           this->m_poly_traits.is_vertical_2_object();
+         );
+      CGAL_precondition(num_seg > 0);
+
+      if (geom_traits->compare_endpoints_xy_2_object()(xcv[0]) == SMALLER) {
+        // xcv is oriented left-to-right
+        typename Segment_traits_2::Construct_max_vertex_2 get_max_v =
+          geom_traits->construct_max_vertex_2_object();
+        CGAL_precondition
+          (
+           (!is_vertical(xcv) &&
+            (comp_x(get_max_v(xcv[0]), p) == LARGER)) ||
+           (is_vertical(xcv) &&
+            (comp_x(get_max_v(xcv[0]), p) == EQUAL) &&
+            (comp_xy(get_max_v(xcv[0]), p) == LARGER))
+           );
+        xcv.push_front(X_monotone_subcurve_2(p, get_max_v(xcv[0])));
+      }
+      else {
+        // xcv is oriented right-to-left
+        typename Segment_traits_2::Construct_min_vertex_2 get_min_v =
+          geom_traits->construct_min_vertex_2_object();
+        CGAL_precondition
+          (
+           (!is_vertical(xcv) &&
+            (comp_x(get_min_v(xcv[0]), p) == SMALLER)) ||
+           (is_vertical(xcv) &&
+            (comp_x(get_min_v(xcv[0]), p) == EQUAL) &&
+            (comp_xy(get_min_v(xcv[0]), p) == SMALLER))
+           );
+        xcv.push_front(X_monotone_subcurve_2(p, get_min_v(xcv[0])));
+      }
+    }
+  };
+
+  /*! Obtain a Push_front_2 functor object. */
+  Push_front_2 push_front_2_object() const { return Push_front_2(*this); }
+
+  /*! Construct a general curve. */
+  class Construct_curve_2 : public Base::Construct_curve_2 {
+  protected:
+    typedef Arr_polyline_traits_2<Segment_traits_2>         Polyline_traits_2;
+
+  public:
+    /*! Constructor.
+     */
+    Construct_curve_2(const Polyline_traits_2& traits) :
+      Base::Construct_curve_2(traits)
+    {}
+
+    /* Obtain an polyline connecting two given endpoints.
+     */
+    Curve_2 operator()(const Point_2& p, const Point_2& q) const
+    { return Curve_2(Subcurve_2(p, q)); }
+
+    /* Obtain a polyline consists of one given segment.
+     */
+    Curve_2 operator()(const Subcurve_2& seg) const
+    { return Base::Construct_curve_2::operator()(seg); }
+
+    /* Construct a well-oriented polyline from a range of either
+     * `Segment_traits::Point_2` or `Segment_traits::Subcurve_2`.
+     */
+    template <typename ForwardIterator>
+    Curve_2 operator()(ForwardIterator begin, ForwardIterator end) const
+    {
+      typedef typename std::iterator_traits<ForwardIterator>::value_type VT;
+      typedef typename boost::is_same<VT, Point_2>::type Is_point;
+      // Dispatch the range to the appropriate implementation.
+      return constructor_impl(begin, end, Is_point());
+    }
+
+    /*! Construction implementation from a range of segments.
+     *  Note that the segments in the range are NOT necessarily x-monotone,
+     *  thus it is impossible to test (even in precondition) whether the input
+     *  forms a continuous and well oriented polyline.
+     *  \pre Range should contain at least one segment.
+     */
+    template <typename ForwardIterator>
+    Curve_2 constructor_impl(ForwardIterator begin, ForwardIterator end,
+                             boost::false_type) const
+    { return Base::Construct_curve_2::operator()(begin, end); }
+
+    /*! Construction of a polyline from a range of points.
+     * \pre The range contains at least two points
+     * \pre Consecutive points are disjoint.
+     * \return Well-oriented polyline connecting the given points. The order
+     *         of the vertices is determined by their order in the range.
+     *         Furthermore, the orientation of the polyline is induced by
+     *         their order.
+     */
+    template <typename ForwardIterator>
+    Curve_2 constructor_impl(ForwardIterator begin, ForwardIterator end,
+                             boost::true_type) const
+    {
+      // The range must contain at least two points.
+      CGAL_precondition_msg(std::distance(begin, end) > 1,
+                            "Range of points must contain at least 2 points");
+
+      // Container of the segments to be constructed from the range of points
+      std::list<Subcurve_2> segs;
+
+      CGAL_precondition_code
+        (
+         typename Segment_traits_2::Equal_2 equal =
+         this->m_poly_traits.subcurve_traits_2()->equal_2_object();
+         );
+
+      // Check whether there are no points in the range:
+      ForwardIterator next = begin;
+      ForwardIterator curr = next++;
+
+      // Construct a segment from each two adjacent points.
+      Curve_2 cv;
+      while (next != end) {
+        CGAL_precondition_msg(!equal(*curr,*next),
+                              "Cannot construct a degenerated segment");
+        segs.push_back(Subcurve_2(*curr, *next));
+        curr = next++;
+      }
+
+      return operator()(segs.begin(), segs.end());
+    }
+  };
+
+  /*! Obtain a Construct_curve_2 functor object. */
+  Construct_curve_2 construct_curve_2_object() const
+  { return Construct_curve_2(*this); }
+
+  /*! Construct an x-monotone curve. */
+  class Construct_x_monotone_curve_2 :
+    public Base::Construct_x_monotone_curve_2
+  {
+  protected:
+    typedef Arr_polyline_traits_2<Segment_traits_2>     Polyline_traits_2;
+
+  public:
+    /*! Constructor.
+     */
+    Construct_x_monotone_curve_2(const Polyline_traits_2& traits) :
+      Base::Construct_x_monotone_curve_2(traits)
+    {}
+
+    /*! Obtain an x-monotone polyline connecting two given endpoints.
+     * \param p The first point.
+     * \param q The second point.
+     * \pre p and q must not be the same.
+     * \return A segment connecting p and q.
+     */
+    X_monotone_curve_2 operator()(const Point_2& p, const Point_2& q) const
+    {
+      CGAL_precondition_msg
+        (!this->m_poly_traits.subcurve_traits_2()->equal_2_object()(p,q),
+         "Cannot construct a degenerated segment as a polyline");
+      X_monotone_subcurve_2 seg =  this->m_poly_traits.subcurve_traits_2()->
+        construct_x_monotone_curve_2_object()(p, q);
+
+#ifdef CGAL_ALWAYS_LEFT_TO_RIGHT
+      if (this->m_poly_traits.subcurve_traits_2()->compare_xy_2_object()(p,q) ==
+          LARGER)
+        seg = this->m_poly_traits.subcurve_traits_2()->
+          construct_opposite_2_object()(seg);
+#endif
+
+      return X_monotone_curve_2(seg);
+    }
+
+    /*! Obtain an x-monotone polyline that consists of one given segment.
+     * \param seg input segment.
+     * \pre seg is not degenerated.
+     * \return An x-monotone polyline with one segment.
+     */
+    X_monotone_curve_2 operator()(const X_monotone_subcurve_2& seg) const
+    { return Base::Construct_x_monotone_curve_2::operator()(seg); }
+
+    /*! Construct an x-monotone polyline from a range of elements.
+     * \pre Range should from a continuous well-oriented x-monotone polyline.
+     */
+    template <typename ForwardIterator>
+    X_monotone_curve_2 operator()(ForwardIterator begin, ForwardIterator end)
+      const
+    {
+      typedef typename std::iterator_traits<ForwardIterator>::value_type VT;
+      typedef typename boost::is_same<VT, Point_2>::type Is_point;
+      // Dispatch the range to the appropriate implementation.
+      return constructor_impl(begin, end, Is_point());
+    }
+
+    /*! Construction implementation from a range of segments.
+     * \param begin An iterator pointing to the first segment in the range.
+     * \param end An iterator pointing to the past-the-end segment
+     * in the range.
+     * \pre The range contains at least one segment.
+     * \pre Segments correspond to a well-oriented polyline. That
+     *      is, the target of the i-th segment is an source of the
+     *      (i+1)th segment.
+     * \pre The sequence of segments in the range forms a weak x-monotone
+     *      polyline.
+     * \pre The container should support bidirectional iteration.
+     * \return A continuous, well-oriented x-monotone polyline which
+     *         is directed either left-to-right or right-to-left
+     *         depending on the segments in the input.
+     */
+    template <typename ForwardIterator>
+    X_monotone_curve_2 constructor_impl(ForwardIterator begin,
+                                        ForwardIterator end,
+                                        boost::false_type) const
+    { return Base::Construct_x_monotone_curve_2::operator()(begin, end); }
+
+    /*! Construction of an x-monotone polyline from a range of points.
+     * The polyline may be oriented left-to-right or right-to-left
+     * depending on the lexicographical order of the points in the
+     * input.
+     * \pre Range contains at least two points.
+     * \pre No two consecutive points are the same.
+     * \pre The points form an continuous well-oriented x-monotone polyline.
+     * \post By the construction the returned polyline is well-oriented.
+     */
+    template <typename ForwardIterator>
+    X_monotone_curve_2 constructor_impl(ForwardIterator begin,
+                                        ForwardIterator end,
+                                        boost::true_type) const
+    {
+      // The range must contain at least two points.
+      CGAL_precondition_msg(std::distance(begin, end) > 1,
+                            "Range of points must contain at least 2 points");
+
+      // Container of the segments to be constructed from the range of points
+      std::list<X_monotone_subcurve_2> segs;
+      // Make sure the range of points contains at least two points.
+      ForwardIterator next = begin;
+      ForwardIterator curr = next++;
+
+      CGAL_precondition_code
+        (
+         const Segment_traits_2* geom_traits =
+           this->m_poly_traits.subcurve_traits_2();
+         // Initialize two comparison functors
+         typename Segment_traits_2::Compare_x_2 compare_x =
+           geom_traits->compare_x_2_object();
+         typename Segment_traits_2::Compare_xy_2 compare_xy =
+           geom_traits->compare_xy_2_object();
+         // Make sure there is no changed of directions.
+         // Saves the comp_x between the first two points
+         const Comparison_result cmp_x_res = compare_x(*curr, *next);
+         // Save the comp_xy between the first two points
+         const Comparison_result cmp_xy_res = compare_xy(*curr, *next);
+         );
+
+      // Assure that the first two points are not the same.
+      // Note that this also assures that non of the consecutive
+      // points are equal in the whole range.
+      CGAL_precondition(cmp_xy_res != EQUAL);
+
+      while (next != end) {
+        CGAL_precondition(compare_xy(*curr, *next) == cmp_xy_res);
+        CGAL_precondition(compare_x(*curr, *next) == cmp_x_res);
+
+        segs.push_back(X_monotone_subcurve_2(*curr, *next));
+        curr = next++;
+      }
+
+#ifdef CGAL_ALWAYS_LEFT_TO_RIGHT
+      if (this->m_poly_traits.subcurve_traits_2()->
+          compare_endpoints_xy_2_object()(*segs.begin()) == LARGER)
+      {
+        X_monotone_curve_2 xcv(segs.begin(), segs.end());
+        return this->m_poly_traits.construct_opposite_2_object()(xcv);
+      }
+#endif
+
+      return operator()(segs.begin(), segs.end());
+    }
+  };
+
+  /*! Obtain a Construct_x_monotone_curve_2 functor object. */
+  Construct_x_monotone_curve_2 construct_x_monotone_curve_2_object() const
+  { return Construct_x_monotone_curve_2(*this); }
+
+  /*! Deprecated!
+   * Obtain the segment traits.
+   * \return the segment traits.
+   */
+  CGAL_DEPRECATED const Segment_traits_2* segment_traits_2() const
+  { return this->subcurve_traits_2(); }
+};
+
+} // namespace CGAL
+
+#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_rat_arc/Algebraic_point_2.h b/3rdparty/CGAL/include/CGAL/Arr_rat_arc/Algebraic_point_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_rat_arc/Algebraic_point_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_rat_arc/Algebraic_point_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_rat_arc/Base_rational_arc_ds_1.h b/3rdparty/CGAL/include/CGAL/Arr_rat_arc/Base_rational_arc_ds_1.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_rat_arc/Base_rational_arc_ds_1.h
rename to 3rdparty/CGAL/include/CGAL/Arr_rat_arc/Base_rational_arc_ds_1.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_rat_arc/Cache.h b/3rdparty/CGAL/include/CGAL/Arr_rat_arc/Cache.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_rat_arc/Cache.h
rename to 3rdparty/CGAL/include/CGAL/Arr_rat_arc/Cache.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_rat_arc/Rational_arc_d_1.h b/3rdparty/CGAL/include/CGAL/Arr_rat_arc/Rational_arc_d_1.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_rat_arc/Rational_arc_d_1.h
rename to 3rdparty/CGAL/include/CGAL/Arr_rat_arc/Rational_arc_d_1.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_rat_arc/Rational_function.h b/3rdparty/CGAL/include/CGAL/Arr_rat_arc/Rational_function.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_rat_arc/Rational_function.h
rename to 3rdparty/CGAL/include/CGAL/Arr_rat_arc/Rational_function.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_rat_arc/Rational_function_canonicalized_pair.h b/3rdparty/CGAL/include/CGAL/Arr_rat_arc/Rational_function_canonicalized_pair.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_rat_arc/Rational_function_canonicalized_pair.h
rename to 3rdparty/CGAL/include/CGAL/Arr_rat_arc/Rational_function_canonicalized_pair.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_rat_arc/Rational_function_ordered_pair.h b/3rdparty/CGAL/include/CGAL/Arr_rat_arc/Rational_function_ordered_pair.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_rat_arc/Rational_function_ordered_pair.h
rename to 3rdparty/CGAL/include/CGAL/Arr_rat_arc/Rational_function_ordered_pair.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_rat_arc/Rational_function_pair.h b/3rdparty/CGAL/include/CGAL/Arr_rat_arc/Rational_function_pair.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_rat_arc/Rational_function_pair.h
rename to 3rdparty/CGAL/include/CGAL/Arr_rat_arc/Rational_function_pair.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_rat_arc/Singleton.h b/3rdparty/CGAL/include/CGAL/Arr_rat_arc/Singleton.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_rat_arc/Singleton.h
rename to 3rdparty/CGAL/include/CGAL/Arr_rat_arc/Singleton.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_rational_function_traits_2.h b/3rdparty/CGAL/include/CGAL/Arr_rational_function_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_rational_function_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_rational_function_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_segment_traits_2.h b/3rdparty/CGAL/include/CGAL/Arr_segment_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_segment_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_segment_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_simple_point_location.h b/3rdparty/CGAL/include/CGAL/Arr_simple_point_location.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_simple_point_location.h
rename to 3rdparty/CGAL/include/CGAL/Arr_simple_point_location.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_spherical_gaussian_map_3/Arr_on_sphere_transformation.h b/3rdparty/CGAL/include/CGAL/Arr_spherical_gaussian_map_3/Arr_on_sphere_transformation.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_spherical_gaussian_map_3/Arr_on_sphere_transformation.h
rename to 3rdparty/CGAL/include/CGAL/Arr_spherical_gaussian_map_3/Arr_on_sphere_transformation.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm.h b/3rdparty/CGAL/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm.h
rename to 3rdparty/CGAL/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_arr_dcel.h b/3rdparty/CGAL/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_arr_dcel.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_arr_dcel.h
rename to 3rdparty/CGAL/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_arr_dcel.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_initializer_visitor.h b/3rdparty/CGAL/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_initializer_visitor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_initializer_visitor.h
rename to 3rdparty/CGAL/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_initializer_visitor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_overlay.h b/3rdparty/CGAL/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_overlay.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_overlay.h
rename to 3rdparty/CGAL/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_overlay.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_polyhedron_3.h b/3rdparty/CGAL/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_polyhedron_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_polyhedron_3.h
rename to 3rdparty/CGAL/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_polyhedron_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_traits.h b/3rdparty/CGAL/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_traits.h
rename to 3rdparty/CGAL/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_transformation.h b/3rdparty/CGAL/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_transformation.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_transformation.h
rename to 3rdparty/CGAL/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_transformation.h
diff --git a/3rdparty/CGAL/include/CGAL/Arr_spherical_gaussian_map_3/Arr_spherical_gaussian_map_3.h b/3rdparty/CGAL/include/CGAL/Arr_spherical_gaussian_map_3/Arr_spherical_gaussian_map_3.h
new file mode 100644
index 0000000..93c659e
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Arr_spherical_gaussian_map_3/Arr_spherical_gaussian_map_3.h
@@ -0,0 +1,404 @@
+// Copyright (c) 2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s): Efi Fogel         <efif at post.tau.ac.il>
+//            Naama mayer       <naamamay at post.tau.ac.il>
+
+#ifndef CGAL_ARR_SPHERICAL_GAUSSIAN_MAP_3_H
+#define CGAL_ARR_SPHERICAL_GAUSSIAN_MAP_3_H
+
+/*! \file
+ * Spherical_gaussian_map is a data dtructure that represents a Gaussinal map
+ * embedded on the sphere.
+ *
+ * This file consists of the definition of the main type, namely
+ * Arr_spherical_gaussian_map_2 and a service tye,
+ * namely Arr_sgm_initializer, that initializes an object of the main type.
+ */
+
+#include <string>
+#include <vector>
+#include <list>
+#include <iostream>
+
+#include <CGAL/Arrangement_on_surface_2.h>
+#include <CGAL/intersections.h>
+#include <CGAL/Polygon_2_algorithms.h>
+#include <CGAL/Arr_default_dcel.h>
+#include <CGAL/Arr_spherical_topology_traits_2.h>
+
+#if defined(CGAL_USE_LEDA)
+#include <LEDA/numbers/rational.h>
+#endif
+
+namespace CGAL {
+
+// #define CGAL_ARR_SPHERICAL_GAUSSIAN_MAP_3_DEBUG 1
+
+/*! Sgm_normalizer normalizes the two coordinates of a point in tow-
+ * dimensional cartesian coordinate-system. It is parameterized by the
+ * field number-type of the point coordinates and by the type of the point
+ * which coordinates are to be normalized. Normalization is performed through
+ * a call an operator that accepts the point as a parameter.
+ * The normalization of field number-types that initiate normalization
+ * automatically (e.g., Gmpq) do not need to be initiated. Therefore, the
+ * default instance does nothing. Normalizers for field number-types that
+ * do not initiate normalization automatically, must be specialed.
+ */
+template <class FT, class Point_2>
+class Sgm_normalizer {
+public:
+  /*! Normalize the coordinates of the given point, but in fact does
+   * nothing.
+   * \param p the point which coordinates are to be normalized
+   */ 
+  void operator()(Point_2 & p) {}
+};
+
+#if defined(CGAL_USE_LEDA)
+/*! Sgm_normalizer normalizes the two coordinates of a point in tow-
+ * dimensional cartesian coordinate-system. It is parameterized by the
+ * type of the point which coordinates are to be normalized, and
+ * specialized for the leda::rational field number-type.
+ */
+template <class Point_2>
+class Sgm_normalizer<leda::rational, Point_2> {
+public:
+  /*! Normalize the coordinates of the given point
+   * \param p the point which coordinates are to be normalized
+   */
+  void operator()(Point_2 & p)
+  {
+    leda::rational x = p.x();
+    x.normalize();
+    leda::rational y = p.y();
+    y.normalize();
+    leda::rational z = p.z();
+    z.normalize();
+    p = Point_2(x, y, z);
+  }
+};
+#endif
+
+/*! Arr_sgm_initializer is an algorothmic framework that initializes a
+ * Arr_spherical_gaussian_map_3 structure. It is parameterized by the SGM to
+ * be initialized and by a visitor class.
+ */
+template <typename Sgm, typename T_Traits = typename Sgm::Traits>
+class Arr_sgm_initializer {
+public:
+  typedef T_Traits                                        Traits;
+  typedef typename Traits::Vector_3                       Vector_3;
+
+  typedef typename Sgm::Geometry_traits_2                 Geometry_traits_2;
+  typedef typename Geometry_traits_2::Point_2             Point_2;
+  typedef typename Geometry_traits_2::X_monotone_curve_2  X_monotone_curve_2;
+  typedef typename Geometry_traits_2::Curve_2             Curve_2;
+
+  typedef typename Sgm::Vertex_handle                     Vertex_handle;
+  typedef typename Sgm::Halfedge_handle                   Halfedge_handle;
+  typedef typename Sgm::Face_handle                       Face_handle;
+
+  /*! Constructor */
+  Arr_sgm_initializer(Sgm & sgm) : m_sgm(sgm) { }
+
+  /*! Destructor */
+  virtual ~Arr_sgm_initializer() {}
+  
+  /*! Insert a great arc whose angle is less than Pi and is represented by two
+   * normals into the SGM. Each normal defines an end point of the greate arc.
+   * \param normal1 represents the source normal.
+   * \param normal2 represents the target normal.
+   */
+  Halfedge_handle insert_non_intersecting(const Vector_3 & normal1,
+                                          const Vector_3 & normal2)
+  {
+    X_monotone_curve_2 xc(normal1.direction(), normal2.direction());
+    return insert_non_intersecting_curve(m_sgm, xc);
+  }
+
+  /*! Make x-monotone
+   */
+  template<typename OutputIterator>
+  OutputIterator make_x_monotone(const Vector_3 & normal1,
+                                 const Vector_3 & normal2,
+                                 OutputIterator oi)
+  {
+    Curve_2 cv(normal1.direction(), normal2.direction());
+    const Geometry_traits_2 * traits = this->m_sgm.geometry_traits();
+    oi = traits->make_x_monotone_2_object()(cv, oi);
+    return oi;
+  }
+  
+  /*! Insert a great arc whose angle is less than Pi and is represented by two
+   * normals into the SGM. Each normal defines an end point of the greate arc.
+   * \param normal1 represents the source normal.
+   * \param normal2 represents the target normal.
+   * \return the handle for the halfedge directed from the endpoint
+   * represented by normal1 toward the endpoint represented by normal2
+   * \pre the SGM is empty.
+   */
+  template<typename OutputIterator>
+  OutputIterator insert(const Vector_3 & normal1, const Vector_3 & normal2,
+                        OutputIterator oi)
+  {
+    std::list<CGAL::Object> x_objects;
+    make_x_monotone(normal1, normal2, std::back_inserter(x_objects));
+
+    typename std::list<CGAL::Object>::iterator it = x_objects.begin();
+    const X_monotone_curve_2 * xc = object_cast<X_monotone_curve_2>(&(*it));
+#if CGAL_ARR_SPHERICAL_GAUSSIAN_MAP_3_DEBUG==1
+    std::cout << "1.a. insert_in_face_interior(" << *xc << ")" << std::endl;
+#endif
+    Halfedge_handle he =
+      m_sgm.insert_in_face_interior(*xc, m_sgm.faces_begin());
+    if (!xc->is_directed_right()) he = he->twin();
+    *oi++ = he;
+
+    ++it;
+    if (it == x_objects.end()) return oi;
+
+    xc = object_cast<X_monotone_curve_2>(&(*it));
+#if CGAL_ARR_SPHERICAL_GAUSSIAN_MAP_3_DEBUG==1
+    std::cout << "1.b. insert_from_vertex(" << *xc << ")" << std::endl;
+#endif
+    *oi++ = (xc->is_directed_right()) ?
+      m_sgm.insert_from_left_vertex(*xc, he->target()) :     
+      m_sgm.insert_from_right_vertex(*xc, he->target());
+    return oi;
+  }
+
+  /*! Insert a great arc whose angle is less than Pi and is represented by two
+   * normals into the SGM. Each normal defines an end point of the greate arc.
+   * \param normal1 represents the source normal.
+   * \param normal2 represents the target normal.
+   * \return the handle for the halfedge directed from the endpoint
+   * represented by normal1 toward the endpoint represented by normal2
+   * \param vertex the handle of the vertex that is the source of the arc
+   */
+  template<typename OutputIterator>
+  OutputIterator insert(const Vector_3 & normal1, Vertex_handle vertex1,
+                        const Vector_3 & normal2,
+                        OutputIterator oi)
+  {
+    std::list<CGAL::Object> x_objects;
+    make_x_monotone(normal1, normal2, std::back_inserter(x_objects));
+
+    typename std::list<CGAL::Object>::iterator it = x_objects.begin();
+    const X_monotone_curve_2 * xc = object_cast<X_monotone_curve_2>(&(*it));
+#if CGAL_ARR_SPHERICAL_GAUSSIAN_MAP_3_DEBUG==1
+    std::cout << "2.a. insert_from_vertex(" << *xc << ", "
+              << vertex1->point() << ")" << std::endl;
+#endif
+
+    Halfedge_handle he = (xc->is_directed_right()) ?
+      m_sgm.insert_from_left_vertex(*xc, vertex1) :
+      m_sgm.insert_from_right_vertex(*xc, vertex1);
+    *oi++ = he;
+
+    ++it;
+    if (it == x_objects.end()) return oi;
+
+    xc = object_cast<X_monotone_curve_2>(&(*it));
+#if CGAL_ARR_SPHERICAL_GAUSSIAN_MAP_3_DEBUG==1
+    std::cout << "2.b. insert_from_vertex(" << *xc << ")" << std::endl;
+#endif
+    *oi++ = (xc->is_directed_right()) ?
+      m_sgm.insert_from_left_vertex(*xc, he->target()) :
+      m_sgm.insert_from_right_vertex(*xc, he->target());
+    return oi;
+  }
+
+  /*! Insert a great arc whose angle is less than Pi and is represented by two
+   * normals into the SGM. Each normal defines an end point of the greate arc.
+   * \param normal1 represents the source normal.
+   * \param normal2 represents the target normal.
+   * \param vertex the handle of the vertex that is the source of the arc
+   * \return the handle for the halfedge directed from the endpoint
+   * represented by normal1 toward the endpoint represented by normal2
+   */
+  template<typename OutputIterator>
+  OutputIterator insert(const Vector_3 & normal1, 
+                        const Vector_3 & normal2, Vertex_handle vertex2,
+                        OutputIterator oi)
+  {
+    std::list<CGAL::Object> x_objects;
+    make_x_monotone(normal1, normal2, std::back_inserter(x_objects));
+
+    typename std::list<CGAL::Object>::iterator it = x_objects.begin();
+    if (x_objects.size() == 1) {
+      const X_monotone_curve_2 * xc = object_cast<X_monotone_curve_2>(&(*it));
+#if CGAL_ARR_SPHERICAL_GAUSSIAN_MAP_3_DEBUG==1
+      std::cout << "3. insert_from_vertex(" << *xc << ")" << std::endl;
+#endif
+      Halfedge_handle he = (xc->is_directed_right()) ?
+        m_sgm.insert_from_right_vertex(*xc, vertex2) :
+        m_sgm.insert_from_left_vertex(*xc, vertex2);
+      *oi++ = he->twin();
+      return oi;
+    }
+
+    const X_monotone_curve_2 * xc1 = object_cast<X_monotone_curve_2>(&(*it++));
+    const X_monotone_curve_2 * xc2 = object_cast<X_monotone_curve_2>(&(*it));
+
+#if CGAL_ARR_SPHERICAL_GAUSSIAN_MAP_3_DEBUG==1
+    std::cout << "3.a. insert_from_vertex(" << *xc2 << ")" << std::endl;
+#endif
+    Halfedge_handle he2 = (xc2->is_directed_right()) ?
+      m_sgm.insert_from_right_vertex(*xc2, vertex2) :
+      m_sgm.insert_from_left_vertex(*xc2, vertex2);
+    he2 = he2->twin();
+#if CGAL_ARR_SPHERICAL_GAUSSIAN_MAP_3_DEBUG==1
+    std::cout << "3.b. insert_from_vertex(" << *xc1 << ")" << std::endl;
+#endif
+    Halfedge_handle he1 = (xc1->is_directed_right()) ?
+      m_sgm.insert_from_right_vertex(*xc1, he2->source()) :
+      m_sgm.insert_from_left_vertex(*xc1, he2->source());
+    he1 = he1->twin();
+    *oi++ = he1;
+    *oi++ = he2;
+    return oi;
+  }
+
+  /*! Insert a great arc whose angle is less than Pi and is represented by two
+   * normals into the SGM. Each normal defines an end point of the greate arc.
+   * \param normal1 represents the source normal.
+   * \param normal2 represents the target normal.
+   * \param vertex1 the handle of the vertex that is the source of the arc
+   * \param vertex2 the handle of the vertex that is the target of the arc
+   * \return the handle for the halfedge directed from the endpoint
+   * represented by normal1 toward the endpoint represented by normal2
+   */
+  template<typename OutputIterator>
+  OutputIterator insert(const Vector_3 & normal1, Vertex_handle vertex1,
+                        const Vector_3 & normal2, Vertex_handle vertex2,
+                        OutputIterator oi)
+  {
+    std::list<CGAL::Object> x_objects;
+    make_x_monotone(normal1, normal2, std::back_inserter(x_objects));
+    typename std::list<CGAL::Object>::iterator it = x_objects.begin();
+    if (x_objects.size() == 1) {
+      const X_monotone_curve_2 * xc = object_cast<X_monotone_curve_2>(&(*it));
+#if CGAL_ARR_SPHERICAL_GAUSSIAN_MAP_3_DEBUG==1
+      std::cout << "4. insert_at_vertices(" << *xc << ")" << std::endl;
+#endif
+      *oi++ = m_sgm.insert_at_vertices(*xc, vertex1, vertex2);
+      return oi;
+    }
+
+    const X_monotone_curve_2 * xc1 = object_cast<X_monotone_curve_2>(&(*it++));
+    const X_monotone_curve_2 * xc2 = object_cast<X_monotone_curve_2>(&(*it));
+
+#if CGAL_ARR_SPHERICAL_GAUSSIAN_MAP_3_DEBUG==1
+    std::cout << "4.a. insert_from_vertex(" << *xc1
+              << "," << vertex1->point() << ")" << std::endl;
+#endif
+    Halfedge_handle he = (xc1->is_directed_right()) ?
+      m_sgm.insert_from_left_vertex(*xc1, vertex1) :
+      m_sgm.insert_from_right_vertex(*xc1, vertex1);
+    *oi++ = he;
+#if CGAL_ARR_SPHERICAL_GAUSSIAN_MAP_3_DEBUG==1
+    std::cout << "4.b. insert_at_vertices(" << *xc2 << ")" << std::endl;
+#endif
+    *oi++ = m_sgm.insert_at_vertices(*xc2, he->target(), vertex2);
+    return oi;
+  }
+
+protected:
+  /*! The SGM to initialize */
+  Sgm & m_sgm;
+};
+
+/* Spherical_gaussian_map is a data dtructure that represents a Gaussinal map
+ * embedded on the sphere.
+ */
+template <class T_Traits,
+          template <class T>
+          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,
+      T_Dcel<T_Traits>
+    >
+  >
+{
+private:
+  typedef Arr_spherical_gaussian_map_3<T_Traits, T_Dcel>    Self;
+  
+public:
+  typedef T_Traits                                          Traits;
+  typedef Traits                                            Geometry_traits_2;
+  
+  typedef Arrangement_on_surface_2<Traits, 
+	Arr_spherical_topology_traits_2<Traits, T_Dcel<Traits> > >
+															Base;
+
+  /*! Parameter-less Constructor */
+  Arr_spherical_gaussian_map_3() { }
+
+  /*! Copy Constructor */
+  Arr_spherical_gaussian_map_3
+  (const Arr_spherical_gaussian_map_3 & gaussian_map)
+  {
+    // Not implemented yet!
+    CGAL_error();
+  }
+
+  /*! Destructor */
+  virtual ~Arr_spherical_gaussian_map_3() { this->clear(); }
+
+#if 0
+  /*! Clear the internal representation and auxiliary data structures */
+  void clear()
+  {
+    CGAL_error_msg( "Not implemented yet!");
+  }
+  
+  /*! returns true if the representation is empty */
+  bool is_empty() const
+  {
+    CGAL_error_msg( "Not implemented yet!");
+    return true;
+  }
+
+  /*! Return the degree of a vertex
+   * \param vh the vertex handle
+   * \return the degree
+   */
+  unsigned int degree(Vertex_const_handle vh) const
+  {
+    CGAL_error_msg( "Not implemented yet!");
+    return vh->degree();
+  }
+#endif
+  
+  /*! Print statistics */
+  void print_stat()
+  {
+    std::cout << "No. vertices: " << this->number_of_vertices()
+              << ",  no. halfedges: " << this->number_of_halfedges()
+              << ",  no. faces: " << this->number_of_faces()
+              << std::endl;
+  }
+
+  /*! Allow the initializer to update the SGM data members */
+  friend class CGAL::Arr_sgm_initializer<Self>;
+};
+
+} //namespace CGAL
+
+#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_spherical_gaussian_map_3/Arr_transform_on_sphere.h b/3rdparty/CGAL/include/CGAL/Arr_spherical_gaussian_map_3/Arr_transform_on_sphere.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_spherical_gaussian_map_3/Arr_transform_on_sphere.h
rename to 3rdparty/CGAL/include/CGAL/Arr_spherical_gaussian_map_3/Arr_transform_on_sphere.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_spherical_topology_traits_2.h b/3rdparty/CGAL/include/CGAL/Arr_spherical_topology_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_spherical_topology_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_spherical_topology_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_tags.h b/3rdparty/CGAL/include/CGAL/Arr_tags.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_tags.h
rename to 3rdparty/CGAL/include/CGAL/Arr_tags.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_bounded_planar_batched_pl_helper.h b/3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_bounded_planar_batched_pl_helper.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_bounded_planar_batched_pl_helper.h
rename to 3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_bounded_planar_batched_pl_helper.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_bounded_planar_construction_helper.h b/3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_bounded_planar_construction_helper.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_bounded_planar_construction_helper.h
rename to 3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_bounded_planar_construction_helper.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_bounded_planar_insertion_helper.h b/3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_bounded_planar_insertion_helper.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_bounded_planar_insertion_helper.h
rename to 3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_bounded_planar_insertion_helper.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_bounded_planar_overlay_helper.h b/3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_bounded_planar_overlay_helper.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_bounded_planar_overlay_helper.h
rename to 3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_bounded_planar_overlay_helper.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_bounded_planar_topology_traits_2_impl.h b/3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_bounded_planar_topology_traits_2_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_bounded_planar_topology_traits_2_impl.h
rename to 3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_bounded_planar_topology_traits_2_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_bounded_planar_vert_decomp_helper.h b/3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_bounded_planar_vert_decomp_helper.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_bounded_planar_vert_decomp_helper.h
rename to 3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_bounded_planar_vert_decomp_helper.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_inc_insertion_zone_visitor.h b/3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_inc_insertion_zone_visitor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_inc_insertion_zone_visitor.h
rename to 3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_inc_insertion_zone_visitor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_planar_topology_traits_base_2.h b/3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_planar_topology_traits_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_planar_topology_traits_base_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_planar_topology_traits_base_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_spherical_batched_pl_helper.h b/3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_spherical_batched_pl_helper.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_spherical_batched_pl_helper.h
rename to 3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_spherical_batched_pl_helper.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_spherical_construction_helper.h b/3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_spherical_construction_helper.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_spherical_construction_helper.h
rename to 3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_spherical_construction_helper.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_spherical_insertion_helper.h b/3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_spherical_insertion_helper.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_spherical_insertion_helper.h
rename to 3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_spherical_insertion_helper.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_spherical_overlay_helper.h b/3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_spherical_overlay_helper.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_spherical_overlay_helper.h
rename to 3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_spherical_overlay_helper.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h b/3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h
rename to 3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_spherical_vert_decomp_helper.h b/3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_spherical_vert_decomp_helper.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_spherical_vert_decomp_helper.h
rename to 3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_spherical_vert_decomp_helper.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_unb_planar_batched_pl_helper.h b/3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_unb_planar_batched_pl_helper.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_unb_planar_batched_pl_helper.h
rename to 3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_unb_planar_batched_pl_helper.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_unb_planar_construction_helper.h b/3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_unb_planar_construction_helper.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_unb_planar_construction_helper.h
rename to 3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_unb_planar_construction_helper.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_unb_planar_insertion_helper.h b/3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_unb_planar_insertion_helper.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_unb_planar_insertion_helper.h
rename to 3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_unb_planar_insertion_helper.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_unb_planar_overlay_helper.h b/3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_unb_planar_overlay_helper.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_unb_planar_overlay_helper.h
rename to 3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_unb_planar_overlay_helper.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_unb_planar_topology_traits_2_impl.h b/3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_unb_planar_topology_traits_2_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_unb_planar_topology_traits_2_impl.h
rename to 3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_unb_planar_topology_traits_2_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_unb_planar_vert_decomp_helper.h b/3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_unb_planar_vert_decomp_helper.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_topology_traits/Arr_unb_planar_vert_decomp_helper.h
rename to 3rdparty/CGAL/include/CGAL/Arr_topology_traits/Arr_unb_planar_vert_decomp_helper.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_tracing_traits_2.h b/3rdparty/CGAL/include/CGAL/Arr_tracing_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_tracing_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_tracing_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_trapezoid_ric_point_location.h b/3rdparty/CGAL/include/CGAL/Arr_trapezoid_ric_point_location.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_trapezoid_ric_point_location.h
rename to 3rdparty/CGAL/include/CGAL/Arr_trapezoid_ric_point_location.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_triangulation_point_location.h b/3rdparty/CGAL/include/CGAL/Arr_triangulation_point_location.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_triangulation_point_location.h
rename to 3rdparty/CGAL/include/CGAL/Arr_triangulation_point_location.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_unb_planar_topology_traits_2.h b/3rdparty/CGAL/include/CGAL/Arr_unb_planar_topology_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_unb_planar_topology_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_unb_planar_topology_traits_2.h
diff --git a/3rdparty/CGAL/include/CGAL/Arr_vertex_index_map.h b/3rdparty/CGAL/include/CGAL/Arr_vertex_index_map.h
new file mode 100644
index 0000000..997640e
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Arr_vertex_index_map.h
@@ -0,0 +1,281 @@
+// Copyright (c) 2010,2011 Tel-Aviv University (Israel).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Ron Wein          <wein at post.tau.ac.il>
+//                 Efi Fogel         <efif at post.tau.ac.il>
+
+#ifndef CGAL_ARR_VERTEX_INDEX_MAP_H
+#define CGAL_ARR_VERTEX_INDEX_MAP_H
+
+/*! \file
+ * Definition of the Arr_vertex_index_map<Arrangement> class.
+ */
+#include <CGAL/Arr_observer.h>
+#include <CGAL/Unique_hash_map.h>
+#include <CGAL/property_map.h>
+
+#include <boost/graph/properties.hpp>
+
+namespace CGAL {
+
+/*! \class
+ * An auxiliary class that automatically maintains a mapping of the
+ * arrangement vertices to the indices 0, ..., (n -1), where n is the number
+ * of vertices in the arrangement.
+ */
+template <class Arrangement_>
+class Arr_vertex_index_map : public Arr_observer<Arrangement_>
+{
+public:
+
+  typedef Arrangement_                            Arrangement_2;
+  typedef typename Arrangement_2::Vertex_handle   Vertex_handle;
+
+  // Boost property type definitions:
+  typedef boost::readable_property_map_tag        category;
+  typedef unsigned int                            value_type;
+  typedef value_type                              reference;
+  typedef Vertex_handle                           key_type;
+
+private:
+
+  typedef Arr_vertex_index_map<Arrangement_2>     Self;
+  typedef Arr_observer<Arrangement_2>             Base;
+
+  typedef Unique_hash_map<Vertex_handle, unsigned int>     Index_map;
+
+  // Data members:
+  unsigned int                n_vertices;  // The current number of vertices.
+  Index_map                   index_map;   // Mapping vertices to indices.
+  std::vector<Vertex_handle>  rev_map;     // Mapping indices to vertices.
+
+  enum {MIN_REV_MAP_SIZE = 32};
+
+public:
+
+  /*! Default constructor. */
+  Arr_vertex_index_map () :
+    Base (),
+    n_vertices (0),
+    rev_map (MIN_REV_MAP_SIZE)
+  {}
+
+  /*! Constructor with an associated arrangement. */
+  Arr_vertex_index_map (const Arrangement_2& arr) :
+    Base (const_cast<Arrangement_2&> (arr))
+  {
+    _init();
+  }
+
+  /*! Copy constructor. */
+  Arr_vertex_index_map (const Self& other) :
+    Base (const_cast<Arrangement_2&> (*(other.arrangement())))
+  {
+    _init();
+  }
+
+  /*! Assignment operator. */
+  Self& operator= (const Self& other)
+  {
+    if (this == &other)
+      return (*this);
+
+    this->detach();
+    this->attach (const_cast<Arrangement_2&> (*(other.arrangement())));
+
+    return (*this);
+  }
+
+  /*!
+   * Get the index of a given vertex.
+   * \param v A handle to the vertex.
+   * \pre v is a valid vertex in the arrangement.
+   */
+  unsigned int operator[] (Vertex_handle v) const
+  {
+    return index_map[v];
+  }
+
+  /*!
+   * Get the vertex given its index.
+   * \param i The index of the vertex.
+   * \pre i is less than the number of vertices in the graph.
+   */
+  Vertex_handle vertex (const int i) const
+  {
+    CGAL_precondition (i < n_vertices);
+
+    return rev_map[i];
+  }
+
+  /// \name Notification functions, to keep the mapping up-to-date.
+  //@{
+
+  /*!
+   * Update the mapping after the arrangement has been assigned with another
+   * arrangement.
+   */
+  virtual void after_assign ()
+  {
+    _init();
+  }
+
+  /*!
+   * Update the mapping after the arrangement is cleared.
+   */
+  virtual void after_clear ()
+  {
+    _init();
+  }
+
+  /*!
+   * Update the mapping after attaching to a new arrangement.
+   */
+  virtual void after_attach ()
+  {
+    _init();
+  }
+
+  /*!
+   * Update the mapping after detaching the arrangement.
+   */
+  virtual void after_detach ()
+  {
+    n_vertices = 0;
+    index_map.clear();
+  }
+
+  /*!
+   * Update the mapping after the creation of a new vertex.
+   * \param v A handle to the created vertex.
+   */
+  virtual void after_create_vertex (Vertex_handle v)
+  {
+    // Update the number of vertices.
+    n_vertices++;
+
+    // If necessary, allocate memory for the reverse mapping.
+    if (rev_map.size() < n_vertices)
+      rev_map.resize (2 * n_vertices);
+
+    // Update the mapping of the newly created vertex.
+    index_map[v] = n_vertices - 1;
+    rev_map[n_vertices - 1] = v;
+  }
+
+  /*!
+   * Update the mapping after the creation of a new boundary vertex.
+   * \param v A handle to the created vertex.
+   */
+  virtual void after_create_boundary_vertex (Vertex_handle v)
+  {
+    // Update the number of vertices.
+    n_vertices++;
+
+    // If necessary, allocate memory for the reverse mapping.
+    if (rev_map.size() < n_vertices)
+      rev_map.resize (2 * n_vertices);
+
+    // Update the mapping of the newly created vertex.
+    index_map[v] = n_vertices - 1;
+    rev_map[n_vertices - 1] = v;
+  }
+
+  /*!
+   * Update the mapping before the removal of a vertex.
+   * \param v A handle to the vertex to be removed.
+   */
+  virtual void before_remove_vertex (Vertex_handle v)
+  {
+    // Update the number of vertices.
+    n_vertices--;
+    
+    // Reduce memory consumption in case the number of vertices has
+    // drastically decreased.
+    if (2*n_vertices+1 < rev_map.size() && 
+	rev_map.size() / 2 >= MIN_REV_MAP_SIZE)
+    {
+      rev_map.resize (rev_map.size() / 2);
+    }
+
+    // Get the current vertex index, and assign this index to the vertex
+    // currently indexed (n - 1).
+    unsigned int   index = index_map[v];
+
+    if (index == n_vertices)
+      return;
+    
+    Vertex_handle  last_v = rev_map[n_vertices];
+    index_map[last_v] = index;
+    rev_map[index] = last_v;
+
+    // Clear the reverse mapping for the last vertex.
+    rev_map[n_vertices] = Vertex_handle();
+  }
+  //@}
+
+private:
+  
+  /*! Initialize the map for the given arrangement. */
+  void _init ()
+  {
+    // Get the number of vertices and allocate the reverse map accordingly.
+    n_vertices = static_cast<unsigned int>(this->arrangement()->number_of_vertices());
+    
+    if (n_vertices < MIN_REV_MAP_SIZE)
+      rev_map.resize (MIN_REV_MAP_SIZE);
+    else
+      rev_map.resize (n_vertices);
+
+    // Clear the current mapping.
+    index_map.clear();
+
+    // Create the initial mapping. 
+    typename Arrangement_2::Vertex_iterator   vit;
+    Vertex_handle                             vh;
+    unsigned int                              index = 0;
+
+    for (vit = this->arrangement()->vertices_begin();
+	 vit != this->arrangement()->vertices_end(); ++vit, ++index)
+    {
+      // Map the current vertex to the current index.
+      vh = vit;
+      index_map[vh] = index;
+      rev_map[index] = vh;
+    }
+  }  
+
+};
+
+/*!
+ * Get the index property-map function. Provided so that boost is able to
+ * access the Arr_vertex_index_map above.
+ * \param index_map The index map.
+ * \param v A vertex handle.
+ * \return The vertex index.
+ */
+template<class Arrangement>
+unsigned int get (const CGAL::Arr_vertex_index_map<Arrangement>& index_map,
+		  typename Arrangement::Vertex_handle v) 
+{ 
+  return index_map[v];
+}
+
+} //namespace CGAL
+
+#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_vertex_map.h b/3rdparty/CGAL/include/CGAL/Arr_vertex_map.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_vertex_map.h
rename to 3rdparty/CGAL/include/CGAL/Arr_vertex_map.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_vertical_decomposition_2.h b/3rdparty/CGAL/include/CGAL/Arr_vertical_decomposition_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_vertical_decomposition_2.h
rename to 3rdparty/CGAL/include/CGAL/Arr_vertical_decomposition_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arr_walk_along_line_point_location.h b/3rdparty/CGAL/include/CGAL/Arr_walk_along_line_point_location.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arr_walk_along_line_point_location.h
rename to 3rdparty/CGAL/include/CGAL/Arr_walk_along_line_point_location.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arrangement_2.h b/3rdparty/CGAL/include/CGAL/Arrangement_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arrangement_2.h
rename to 3rdparty/CGAL/include/CGAL/Arrangement_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arrangement_2/Arr_compute_zone_visitor.h b/3rdparty/CGAL/include/CGAL/Arrangement_2/Arr_compute_zone_visitor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arrangement_2/Arr_compute_zone_visitor.h
rename to 3rdparty/CGAL/include/CGAL/Arrangement_2/Arr_compute_zone_visitor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arrangement_2/Arr_default_planar_topology.h b/3rdparty/CGAL/include/CGAL/Arrangement_2/Arr_default_planar_topology.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arrangement_2/Arr_default_planar_topology.h
rename to 3rdparty/CGAL/include/CGAL/Arrangement_2/Arr_default_planar_topology.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arrangement_2/Arr_do_intersect_zone_visitor.h b/3rdparty/CGAL/include/CGAL/Arrangement_2/Arr_do_intersect_zone_visitor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arrangement_2/Arr_do_intersect_zone_visitor.h
rename to 3rdparty/CGAL/include/CGAL/Arrangement_2/Arr_do_intersect_zone_visitor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arrangement_2/Arr_on_surface_with_history_2_impl.h b/3rdparty/CGAL/include/CGAL/Arrangement_2/Arr_on_surface_with_history_2_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arrangement_2/Arr_on_surface_with_history_2_impl.h
rename to 3rdparty/CGAL/include/CGAL/Arrangement_2/Arr_on_surface_with_history_2_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arrangement_2/Arr_traits_adaptor_2.h b/3rdparty/CGAL/include/CGAL/Arrangement_2/Arr_traits_adaptor_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arrangement_2/Arr_traits_adaptor_2.h
rename to 3rdparty/CGAL/include/CGAL/Arrangement_2/Arr_traits_adaptor_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arrangement_2/Arr_traits_adaptor_2_dispatching.h b/3rdparty/CGAL/include/CGAL/Arrangement_2/Arr_traits_adaptor_2_dispatching.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arrangement_2/Arr_traits_adaptor_2_dispatching.h
rename to 3rdparty/CGAL/include/CGAL/Arrangement_2/Arr_traits_adaptor_2_dispatching.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arrangement_2/Arr_with_history_accessor.h b/3rdparty/CGAL/include/CGAL/Arrangement_2/Arr_with_history_accessor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arrangement_2/Arr_with_history_accessor.h
rename to 3rdparty/CGAL/include/CGAL/Arrangement_2/Arr_with_history_accessor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arrangement_2/Arrangement_2_iterators.h b/3rdparty/CGAL/include/CGAL/Arrangement_2/Arrangement_2_iterators.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arrangement_2/Arrangement_2_iterators.h
rename to 3rdparty/CGAL/include/CGAL/Arrangement_2/Arrangement_2_iterators.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arrangement_2/Arrangement_on_surface_2_global.h b/3rdparty/CGAL/include/CGAL/Arrangement_2/Arrangement_on_surface_2_global.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arrangement_2/Arrangement_on_surface_2_global.h
rename to 3rdparty/CGAL/include/CGAL/Arrangement_2/Arrangement_on_surface_2_global.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arrangement_2/Arrangement_on_surface_2_impl.h b/3rdparty/CGAL/include/CGAL/Arrangement_2/Arrangement_on_surface_2_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arrangement_2/Arrangement_on_surface_2_impl.h
rename to 3rdparty/CGAL/include/CGAL/Arrangement_2/Arrangement_on_surface_2_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arrangement_2/Arrangement_zone_2_impl.h b/3rdparty/CGAL/include/CGAL/Arrangement_2/Arrangement_zone_2_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arrangement_2/Arrangement_zone_2_impl.h
rename to 3rdparty/CGAL/include/CGAL/Arrangement_2/Arrangement_zone_2_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arrangement_2/Open_hash.h b/3rdparty/CGAL/include/CGAL/Arrangement_2/Open_hash.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arrangement_2/Open_hash.h
rename to 3rdparty/CGAL/include/CGAL/Arrangement_2/Open_hash.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arrangement_2/arrangement_type_traits.h b/3rdparty/CGAL/include/CGAL/Arrangement_2/arrangement_type_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arrangement_2/arrangement_type_traits.h
rename to 3rdparty/CGAL/include/CGAL/Arrangement_2/arrangement_type_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arrangement_on_surface_2.h b/3rdparty/CGAL/include/CGAL/Arrangement_on_surface_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arrangement_on_surface_2.h
rename to 3rdparty/CGAL/include/CGAL/Arrangement_on_surface_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arrangement_on_surface_with_history_2.h b/3rdparty/CGAL/include/CGAL/Arrangement_on_surface_with_history_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arrangement_on_surface_with_history_2.h
rename to 3rdparty/CGAL/include/CGAL/Arrangement_on_surface_with_history_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arrangement_with_history_2.h b/3rdparty/CGAL/include/CGAL/Arrangement_with_history_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arrangement_with_history_2.h
rename to 3rdparty/CGAL/include/CGAL/Arrangement_with_history_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Arrangement_zone_2.h b/3rdparty/CGAL/include/CGAL/Arrangement_zone_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Arrangement_zone_2.h
rename to 3rdparty/CGAL/include/CGAL/Arrangement_zone_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Barycentric_coordinates_2.h b/3rdparty/CGAL/include/CGAL/Barycentric_coordinates_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Barycentric_coordinates_2.h
rename to 3rdparty/CGAL/include/CGAL/Barycentric_coordinates_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Barycentric_coordinates_2/Discrete_harmonic_2.h b/3rdparty/CGAL/include/CGAL/Barycentric_coordinates_2/Discrete_harmonic_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Barycentric_coordinates_2/Discrete_harmonic_2.h
rename to 3rdparty/CGAL/include/CGAL/Barycentric_coordinates_2/Discrete_harmonic_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Barycentric_coordinates_2/Generalized_barycentric_coordinates_2.h b/3rdparty/CGAL/include/CGAL/Barycentric_coordinates_2/Generalized_barycentric_coordinates_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Barycentric_coordinates_2/Generalized_barycentric_coordinates_2.h
rename to 3rdparty/CGAL/include/CGAL/Barycentric_coordinates_2/Generalized_barycentric_coordinates_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Barycentric_coordinates_2/Mean_value_2.h b/3rdparty/CGAL/include/CGAL/Barycentric_coordinates_2/Mean_value_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Barycentric_coordinates_2/Mean_value_2.h
rename to 3rdparty/CGAL/include/CGAL/Barycentric_coordinates_2/Mean_value_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Barycentric_coordinates_2/Segment_coordinates_2.h b/3rdparty/CGAL/include/CGAL/Barycentric_coordinates_2/Segment_coordinates_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Barycentric_coordinates_2/Segment_coordinates_2.h
rename to 3rdparty/CGAL/include/CGAL/Barycentric_coordinates_2/Segment_coordinates_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Barycentric_coordinates_2/Triangle_coordinates_2.h b/3rdparty/CGAL/include/CGAL/Barycentric_coordinates_2/Triangle_coordinates_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Barycentric_coordinates_2/Triangle_coordinates_2.h
rename to 3rdparty/CGAL/include/CGAL/Barycentric_coordinates_2/Triangle_coordinates_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Barycentric_coordinates_2/Wachspress_2.h b/3rdparty/CGAL/include/CGAL/Barycentric_coordinates_2/Wachspress_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Barycentric_coordinates_2/Wachspress_2.h
rename to 3rdparty/CGAL/include/CGAL/Barycentric_coordinates_2/Wachspress_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Barycentric_coordinates_2/barycentric_enum_2.h b/3rdparty/CGAL/include/CGAL/Barycentric_coordinates_2/barycentric_enum_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Barycentric_coordinates_2/barycentric_enum_2.h
rename to 3rdparty/CGAL/include/CGAL/Barycentric_coordinates_2/barycentric_enum_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Barycentric_mapping_parameterizer_3.h b/3rdparty/CGAL/include/CGAL/Barycentric_mapping_parameterizer_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Barycentric_mapping_parameterizer_3.h
rename to 3rdparty/CGAL/include/CGAL/Barycentric_mapping_parameterizer_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Basic_sweep_line_2.h b/3rdparty/CGAL/include/CGAL/Basic_sweep_line_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Basic_sweep_line_2.h
rename to 3rdparty/CGAL/include/CGAL/Basic_sweep_line_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Bbox_2.h b/3rdparty/CGAL/include/CGAL/Bbox_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Bbox_2.h
rename to 3rdparty/CGAL/include/CGAL/Bbox_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Bbox_2_Line_2_intersection.h b/3rdparty/CGAL/include/CGAL/Bbox_2_Line_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Bbox_2_Line_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Bbox_2_Line_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Bbox_2_Line_2_intersection_impl.h b/3rdparty/CGAL/include/CGAL/Bbox_2_Line_2_intersection_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Bbox_2_Line_2_intersection_impl.h
rename to 3rdparty/CGAL/include/CGAL/Bbox_2_Line_2_intersection_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Bbox_2_Ray_2_intersection.h b/3rdparty/CGAL/include/CGAL/Bbox_2_Ray_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Bbox_2_Ray_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Bbox_2_Ray_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Bbox_2_intersection.h b/3rdparty/CGAL/include/CGAL/Bbox_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Bbox_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Bbox_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Bbox_3.h b/3rdparty/CGAL/include/CGAL/Bbox_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Bbox_3.h
rename to 3rdparty/CGAL/include/CGAL/Bbox_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Bigfloat_interval_traits.h b/3rdparty/CGAL/include/CGAL/Bigfloat_interval_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Bigfloat_interval_traits.h
rename to 3rdparty/CGAL/include/CGAL/Bigfloat_interval_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2.h b/3rdparty/CGAL/include/CGAL/Boolean_set_operations_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2.h
rename to 3rdparty/CGAL/include/CGAL/Boolean_set_operations_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Bso_internal_functions.h b/3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Bso_internal_functions.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Bso_internal_functions.h
rename to 3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Bso_internal_functions.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Ccb_curve_iterator.h b/3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Ccb_curve_iterator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Ccb_curve_iterator.h
rename to 3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Ccb_curve_iterator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Curve_with_halfedge.h b/3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Curve_with_halfedge.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Curve_with_halfedge.h
rename to 3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Curve_with_halfedge.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_agg_meta_traits.h b/3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_agg_meta_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_agg_meta_traits.h
rename to 3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_agg_meta_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_agg_op.h b/3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_agg_op.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_agg_op.h
rename to 3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_agg_op.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_agg_op_sweep.h b/3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_agg_op_sweep.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_agg_op_sweep.h
rename to 3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_agg_op_sweep.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_agg_op_visitor.h b/3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_agg_op_visitor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_agg_op_visitor.h
rename to 3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_agg_op_visitor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_base_functor.h b/3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_base_functor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_base_functor.h
rename to 3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_base_functor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_bfs_base_visitor.h b/3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_bfs_base_visitor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_bfs_base_visitor.h
rename to 3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_bfs_base_visitor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_bfs_intersection_visitor.h b/3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_bfs_intersection_visitor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_bfs_intersection_visitor.h
rename to 3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_bfs_intersection_visitor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_bfs_join_visitor.h b/3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_bfs_join_visitor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_bfs_join_visitor.h
rename to 3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_bfs_join_visitor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_bfs_scanner.h b/3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_bfs_scanner.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_bfs_scanner.h
rename to 3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_bfs_scanner.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_bfs_xor_visitor.h b/3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_bfs_xor_visitor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_bfs_xor_visitor.h
rename to 3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_bfs_xor_visitor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_default_dcel.h b/3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_default_dcel.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_default_dcel.h
rename to 3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_default_dcel.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_default_traits.h b/3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_default_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_default_traits.h
rename to 3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_default_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_difference_functor.h b/3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_difference_functor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_difference_functor.h
rename to 3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_difference_functor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_do_intersect_functor.h b/3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_do_intersect_functor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_do_intersect_functor.h
rename to 3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_do_intersect_functor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_insertion_meta_traits.h b/3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_insertion_meta_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_insertion_meta_traits.h
rename to 3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_insertion_meta_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_intersection_functor.h b/3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_intersection_functor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_intersection_functor.h
rename to 3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_intersection_functor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_join_functor.h b/3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_join_functor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_join_functor.h
rename to 3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_join_functor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_merge.h b/3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_merge.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_merge.h
rename to 3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_merge.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_on_surface_base_2.h b/3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_on_surface_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_on_surface_base_2.h
rename to 3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_on_surface_base_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_on_surface_base_2_impl.h b/3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_on_surface_base_2_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_on_surface_base_2_impl.h
rename to 3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_on_surface_base_2_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_polygon_simplifier.h b/3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_polygon_simplifier.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_polygon_simplifier.h
rename to 3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_polygon_simplifier.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_polygon_validation.h b/3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_polygon_validation.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_polygon_validation.h
rename to 3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_polygon_validation.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_simplifier_traits.h b/3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_simplifier_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_simplifier_traits.h
rename to 3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_simplifier_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_sym_diff_functor.h b/3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_sym_diff_functor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_sym_diff_functor.h
rename to 3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_sym_diff_functor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_traits_adaptor.h b/3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_traits_adaptor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_traits_adaptor.h
rename to 3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_traits_adaptor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_traits_decorator.h b/3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_traits_decorator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Gps_traits_decorator.h
rename to 3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Gps_traits_decorator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Point_with_vertex.h b/3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Point_with_vertex.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Point_with_vertex.h
rename to 3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Point_with_vertex.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Polygon_2_curve_iterator.h b/3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Polygon_2_curve_iterator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Boolean_set_operations_2/Polygon_2_curve_iterator.h
rename to 3rdparty/CGAL/include/CGAL/Boolean_set_operations_2/Polygon_2_curve_iterator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Bounded_kernel.h b/3rdparty/CGAL/include/CGAL/Bounded_kernel.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Bounded_kernel.h
rename to 3rdparty/CGAL/include/CGAL/Bounded_kernel.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Box_intersection_d/Box_d.h b/3rdparty/CGAL/include/CGAL/Box_intersection_d/Box_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Box_intersection_d/Box_d.h
rename to 3rdparty/CGAL/include/CGAL/Box_intersection_d/Box_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Box_intersection_d/Box_traits_d.h b/3rdparty/CGAL/include/CGAL/Box_intersection_d/Box_traits_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Box_intersection_d/Box_traits_d.h
rename to 3rdparty/CGAL/include/CGAL/Box_intersection_d/Box_traits_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Box_intersection_d/Box_with_handle_d.h b/3rdparty/CGAL/include/CGAL/Box_intersection_d/Box_with_handle_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Box_intersection_d/Box_with_handle_d.h
rename to 3rdparty/CGAL/include/CGAL/Box_intersection_d/Box_with_handle_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Box_intersection_d/Box_with_info_d.h b/3rdparty/CGAL/include/CGAL/Box_intersection_d/Box_with_info_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Box_intersection_d/Box_with_info_d.h
rename to 3rdparty/CGAL/include/CGAL/Box_intersection_d/Box_with_info_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Box_intersection_d/box_limits.h b/3rdparty/CGAL/include/CGAL/Box_intersection_d/box_limits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Box_intersection_d/box_limits.h
rename to 3rdparty/CGAL/include/CGAL/Box_intersection_d/box_limits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Box_intersection_d/segment_tree.h b/3rdparty/CGAL/include/CGAL/Box_intersection_d/segment_tree.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Box_intersection_d/segment_tree.h
rename to 3rdparty/CGAL/include/CGAL/Box_intersection_d/segment_tree.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CC_safe_handle.h b/3rdparty/CGAL/include/CGAL/CC_safe_handle.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CC_safe_handle.h
rename to 3rdparty/CGAL/include/CGAL/CC_safe_handle.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CGAL_Ipelet_base.h b/3rdparty/CGAL/include/CGAL/CGAL_Ipelet_base.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CGAL_Ipelet_base.h
rename to 3rdparty/CGAL/include/CGAL/CGAL_Ipelet_base.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CGAL_Ipelet_base_v6.h b/3rdparty/CGAL/include/CGAL/CGAL_Ipelet_base_v6.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CGAL_Ipelet_base_v6.h
rename to 3rdparty/CGAL/include/CGAL/CGAL_Ipelet_base_v6.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CGAL_Ipelet_base_v7.h b/3rdparty/CGAL/include/CGAL/CGAL_Ipelet_base_v7.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CGAL_Ipelet_base_v7.h
rename to 3rdparty/CGAL/include/CGAL/CGAL_Ipelet_base_v7.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/BigFloat.h b/3rdparty/CGAL/include/CGAL/CORE/BigFloat.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/BigFloat.h
rename to 3rdparty/CGAL/include/CGAL/CORE/BigFloat.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/BigFloatRep.h b/3rdparty/CGAL/include/CGAL/CORE/BigFloatRep.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/BigFloatRep.h
rename to 3rdparty/CGAL/include/CGAL/CORE/BigFloatRep.h
diff --git a/3rdparty/CGAL/include/CGAL/CORE/BigFloat_impl.h b/3rdparty/CGAL/include/CGAL/CORE/BigFloat_impl.h
new file mode 100644
index 0000000..0eceac3
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/CORE/BigFloat_impl.h
@@ -0,0 +1,1327 @@
+/****************************************************************************
+ * Core Library Version 1.7, August 2004
+ * Copyright (c) 1995-2004 Exact Computation Project
+ * 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.
+ *
+ *
+ * File: BigFloat.cpp
+ * Synopsis:
+ *       BigFloat numbers with error bounds 
+ *
+ *       EXACTNESS PROPERTY:
+ *       ==================
+ *       For BigFloats that are exact (i.e., error=0),
+ *       addition/subtraction and multiplication return the
+ *       exact result (i.e., error=0).  We also introduce the operation
+ *       div2(), which simply divides a BigFloat by 2,
+ *       but this again preserves exactness.  Such exactness
+ *       properties are used in our Newton iteration/Sturm Sequences.
+ *
+ * Written by 
+ *       Chee Yap <yap at cs.nyu.edu>
+ *       Chen Li <chenli at cs.nyu.edu>
+ *       Zilin Du <zilin at cs.nyu.edu>
+ *
+ * WWW URL: http://cs.nyu.edu/exact/
+ * Email: exact at cs.nyu.edu
+ *
+ * $URL$
+ * $Id$
+ ***************************************************************************/
+
+#ifdef CGAL_HEADER_ONLY
+#define CGAL_INLINE_FUNCTION inline
+#else
+#define CGAL_INLINE_FUNCTION
+#endif
+
+#include <ctype.h>
+#include <CGAL/CORE/BigFloat.h>
+#include <CGAL/CORE/Expr.h>
+
+namespace CORE { 
+
+
+////////////////////////////////////////////////////////////
+// Misc Helper Functions
+////////////////////////////////////////////////////////////
+
+CGAL_INLINE_FUNCTION
+BigInt FiveTo(unsigned long exp) {
+  if (exp == 0)
+    return BigInt(1);
+  else if (exp == 1)
+    return BigInt(5);
+  else {
+    BigInt x = FiveTo(exp / 2);
+
+    x = x * x;
+
+    if (exp & 1)
+      x *= 5;
+
+    return x;
+  }
+}
+
+////////////////////////////////////////////////////////////
+//  class BigFloat
+////////////////////////////////////////////////////////////
+
+// STATIC BIGFLOAT CONSTANTS
+// ZERO
+CGAL_INLINE_FUNCTION
+const BigFloat& BigFloat::getZero() {
+  static BigFloat Zero(0);
+  return Zero;
+}
+// ONE
+CGAL_INLINE_FUNCTION
+const BigFloat& BigFloat::getOne() {
+  static BigFloat One(1);
+  return One;
+}
+
+// A special constructor for BigFloat from Expr
+// -- this method is somewhat of an anomaly (we normally do not expect
+//    BigFloats to know about Expr).
+CGAL_INLINE_FUNCTION
+BigFloat::BigFloat(const Expr& E, const extLong& r, const extLong& a)
+  : RCBigFloat(new BigFloatRep()) {
+  *this = E.approx(r, a).BigFloatValue(); // lazy implementaion, any other way?
+}
+
+////////////////////////////////////////////////////////////
+//  class BigFloatRep
+////////////////////////////////////////////////////////////
+
+CGAL_INLINE_FUNCTION
+BigFloatRep::BigFloatRep(double d) : m(0), err(0), exp(0) {
+  if (d != 0.0) {
+    int isNegative = 0;
+
+    if (d < 0.0) {
+      isNegative = 1;
+      d          = - d;
+    }
+
+    int    binExp;
+    double f = frexp(d, &binExp);
+
+    exp = chunkFloor(binExp);
+
+    long s = binExp - bits(exp);
+
+    long   stop = 0;
+    double intPart;
+
+    // convert f into a BigInt
+    while (f != 0.0 && stop < DBL_MAX_CHUNK) {
+      f =   ldexp(f, (int)CHUNK_BIT);
+      f =   modf(f, &intPart);
+      m <<= CHUNK_BIT;
+      m +=  (long)intPart;
+      exp--;
+      stop++;
+    }
+#ifdef CORE_DEBUG
+    CGAL_assertion (s >= 0);
+#endif
+
+    if (s)
+      m <<= s;
+    if (isNegative)
+      negate(m);
+  }
+}//BigFloatRep constructor
+
+//  approximation
+CGAL_INLINE_FUNCTION
+void BigFloatRep::trunc(const BigInt& I, const extLong& r, const extLong& a) {
+  if (sign(I)) {
+    long tr = chunkFloor((- r + bitLength(I)).asLong());
+    long ta = chunkFloor(- a.asLong());
+    long t;
+
+    if (r.isInfty() || a.isTiny())
+      t = ta;
+    else if (a.isInfty())
+      t = tr;
+    else
+      t = ta < tr ? tr : ta;
+
+    if (t > 0) {  // BigInt remainder;
+      m   = chunkShift(I, - t);
+      err = 1;
+      exp = t;
+    } else { //  t <= 0
+      m   = I;
+      err = 0;
+      exp = 0;
+    }
+  } else {//  I == 0
+    m   = 0;
+    err = 0;
+    exp = 0;
+  }
+}
+
+CGAL_INLINE_FUNCTION
+void BigFloatRep :: truncM(const BigFloatRep& B, const extLong& r, const extLong& a) {
+  if (sign(B.m)) {
+    long tr = chunkFloor((- 1 - r + bitLength(B.m)).asLong());
+    long ta = chunkFloor(- 1 - a.asLong()) - B.exp;
+    long t;
+
+    if (r.isInfty() || a.isTiny())
+      t = ta;
+    else if (a.isInfty())
+      t = tr;
+    else
+      t = ta < tr ? tr : ta;
+
+    if (t >= chunkCeil(clLg(B.err))) {
+      m   = chunkShift(B.m, - t);
+      err = 2;
+      exp = B.exp + t;
+    } else //  t < chunkCeil(clLg(B.err))
+      core_error(std::string("BigFloat error: truncM called with stricter")
+	  + "precision than current error.", __FILE__, __LINE__, true);
+  } else {//  B.m == 0
+    long t = chunkFloor(- a.asLong()) - B.exp;
+
+    if (t >= chunkCeil(clLg(B.err))) {
+      m   = 0;
+      err = 1;
+      exp = B.exp + t;
+    } else //  t < chunkCeil(clLg(B.err))
+      core_error(std::string("BigFloat error: truncM called with stricter")
+	  + "precision than current error.", __FILE__, __LINE__, true);
+  }
+}
+
+// This is the main approximation function
+// REMARK: would be useful to have a self-modifying version
+// 		of this function (e.g., for Newton).
+CGAL_INLINE_FUNCTION
+void BigFloatRep::approx(const BigFloatRep& B,
+              const extLong& r, const extLong& a) {
+  if (B.err) {
+    if (1 + clLg(B.err) <= bitLength(B.m))
+      truncM(B, r + 1, a);
+    else //  1 + clLg(B.err) > lg(B.m)
+      truncM(B, CORE_posInfty, a);
+  } else {//  B.err == 0
+    trunc(B.m, r, a - bits(B.exp));
+    exp += B.exp;
+  }
+  // Call normalization globally     -- IP 10/9/98
+  normal();
+}
+
+CGAL_INLINE_FUNCTION
+void BigFloatRep::div(const BigInt& N, const BigInt& D,
+              const extLong& r, const extLong& a) {
+  if (sign(D)) {
+    if (sign(N)) {
+      long tr = chunkFloor((- r + bitLength(N) - bitLength(D) - 1).asLong());
+      long ta = chunkFloor(- a.asLong());
+
+      if (r.isInfty() || a.isTiny())
+        exp = ta;
+      else if (a.isInfty())
+        exp = tr;
+      else
+        exp = ta < tr ? tr : ta;
+
+      BigInt remainder;
+
+      // divide(chunkShift(N, - exp), D, m, remainder);
+      div_rem(m, remainder, chunkShift(N, - exp), D);
+
+      if (exp <= 0 && sign(remainder) == 0)
+        err = 0;
+      else
+        err = 1;
+    } else {//  N == 0
+      m   = 0;
+      err = 0;
+      exp = 0;
+    }
+  } else //  D == 0
+    core_error( "BigFloat error: zero divisor.", __FILE__, __LINE__, true);
+
+  // Call normalization globally     -- IP 10/9/98
+  normal();
+}//div
+
+//  error-normalization
+CGAL_INLINE_FUNCTION
+void BigFloatRep::normal() {
+  long le = flrLg(err);
+
+  if (le >= CHUNK_BIT + 2) { // so we do not carry more than 16 = CHUNK_BIT + 2
+	                     // bits of error
+    long f = chunkFloor(--le); // f is roughly equal to floor(le/CHUNK_BIT)
+    long bits_f = bits(f);   // f chunks will have bits_f many bits
+#ifdef CORE_DEBUG
+    CGAL_assertion (bits_f >= 0);
+#endif
+
+    m   >>= bits_f;  // reduce mantissa by bits_f many bits
+    err >>= bits_f;  // same for err
+    err +=  2;       // why 2?
+    exp +=  f;       
+  }
+  if (err == 0)      // unlikely, if err += 2 above
+    eliminateTrailingZeroes();
+}
+
+// bigNormal(err) 
+//     convert a bigInt error value (=err) into an error that fits into
+//     a long number.  This is done by
+//     by increasing the exponent, and corresponding decrease
+//     in the bit lengths of the mantissa and error.
+//
+CGAL_INLINE_FUNCTION
+void BigFloatRep::bigNormal(BigInt& bigErr) {
+  long le = bitLength(bigErr);
+
+  if (le < CHUNK_BIT + 2) {
+    err = ulongValue(bigErr);
+  } else {
+    long f = chunkFloor(--le);
+    long bits_f = bits(f);
+#ifdef CORE_DEBUG
+    CGAL_assertion(bits_f >= 0);
+#endif
+
+    m      >>= bits_f;
+    bigErr >>= bits_f;
+    err    = ulongValue(bigErr) + 2; // you need to add "2" because "1" comes
+    		// from truncation error in the mantissa, and another
+		// "1" comes from the truncation error in the bigErr.
+		// (But there is danger of overflow...)
+    exp    += f;
+  }
+
+  if (err == 0)
+    eliminateTrailingZeroes();
+}
+
+// ARITHMETIC:
+//  Addition
+CGAL_INLINE_FUNCTION
+void BigFloatRep::add(const BigFloatRep& x, const BigFloatRep& y) {
+  long expDiff = x.exp - y.exp;
+
+  if (expDiff > 0) {//  x.exp > y.exp
+    if (!x.err) {
+      m   = chunkShift(x.m, expDiff) + y.m;
+      err = y.err;
+      exp = y.exp;
+    } else {//  x.err > 0
+      m   = x.m + chunkShift(y.m, - expDiff); // negative shift!
+      err = x.err + 5; // To account for y.err (but why 5?)
+      exp = x.exp;     // 
+      // normal();
+    }
+  } else if (!expDiff) {//  x.exp == y.exp
+    m   = x.m + y.m;
+    err = x.err + y.err;
+    exp = x.exp;
+    // normal();
+  } else {//  x.exp < y.exp
+    if (!y.err) {
+      m   = x.m + chunkShift(y.m, - expDiff);
+      err = x.err;
+      exp = x.exp;
+    } else {//  y.err > 0
+      m   = chunkShift(x.m, expDiff) + y.m;
+      err = y.err + 5;
+      exp = y.exp;
+      // normal();
+    }
+  }
+  // Call normalization globally     -- IP 10/9/98
+  normal();
+}
+
+//  Subtraction
+CGAL_INLINE_FUNCTION
+void BigFloatRep::sub(const BigFloatRep& x, const BigFloatRep& y) {
+  long expDiff = x.exp - y.exp;
+
+  if (expDiff > 0) {//  x.exp > y.exp
+    if (!x.err) {
+      m   = chunkShift(x.m, expDiff) - y.m;
+      err = y.err;
+      exp = y.exp;
+    } else {//  x.err > 0
+      m   = x.m - chunkShift(y.m, - expDiff);
+      err = x.err + 5;
+      exp = x.exp;
+      // normal();
+    }
+  } else if (!expDiff) {
+    m   = x.m - y.m;
+    err = x.err + y.err;
+    exp = x.exp;
+    // normal();
+  } else { //  x.exp < y.exp
+    if (!y.err) {
+      m   = x.m - chunkShift(y.m, - expDiff);
+      err = x.err;
+      exp = x.exp;
+    } else {//  y.err > 0
+      m   = chunkShift(x.m, expDiff) - y.m;
+      err = y.err + 5;
+      exp = y.exp;
+      // normal();
+    }
+  }
+  // Call normalization globally     -- IP 10/9/98
+  normal();
+}
+
+CGAL_INLINE_FUNCTION
+void BigFloatRep::mul(const BigFloatRep& x, const BigFloatRep& y) {
+  m = x.m * y.m;
+  exp = x.exp + y.exp;
+  // compute error (new code, much faster. Zilin Du, Nov 2003)
+  if (x.err == 0 && y.err == 0) {
+    err = 0;
+    eliminateTrailingZeroes();
+  } else {
+    BigInt bigErr(0);
+    if (y.err != 0)
+      bigErr += abs(x.m)*y.err;
+    if (x.err != 0)
+      bigErr += abs(y.m)*x.err;
+    if (x.err !=0 && y.err != 0)
+      bigErr += x.err*y.err;
+    bigNormal(bigErr);
+  }
+}
+// BigFloat div2 will half the value of x, exactly with NO error
+// 	REMARK: should generalize this to dividing by any power of 2
+// 	We need this in our use of BigFloats to maintain isolation
+// 	intervals (e.g., in Sturm sequences)	--Chee/Vikram 4/2003
+//
+CGAL_INLINE_FUNCTION
+void BigFloatRep :: div2(const BigFloatRep& x) {
+  if (isEven(x.m)) {
+    m = (x.m >> 1);
+    exp = x.exp ;
+  } else {
+    m = (x.m << static_cast<unsigned long>(CHUNK_BIT-1));
+    exp = x.exp -1;
+  }
+}
+
+// Converts a BigFloat interval into one BigFloat with almost same error bound
+// This routine ignores the errors in inputs a and b.
+// But you cannot really ignore them since, they are taken into account
+// when you compute "r.sub(a,b)"...
+CGAL_INLINE_FUNCTION
+void BigFloatRep::centerize(const BigFloatRep& a, const BigFloatRep& b) {
+  if ((a.m == b.m) && (a.err == b.err) && (a.exp == b.exp)) {
+    m = a.m;
+    err = a.err;
+    exp = a.exp;
+    return;
+  }
+
+  BigFloatRep r;
+  r.sub(a, b);
+  r.div2(r);
+
+  //setup mantissa and exponent, but not error bits
+  // But this already sets the error bits? Chee
+  add(a,b);
+  div2(*this);
+  // error bits = ceil ( B^{-exp}*|a-b|/2 )
+
+  // bug fixed: possible overflow on converting
+  // Zilin & Vikram, 08/24/04
+  // err = 1 + longValue(chunkShift(r.m, r.exp - exp));
+  BigInt E = chunkShift(r.m, r.exp - exp);
+  bigNormal(E);
+}
+
+// BigFloat Division, computing x/y:
+//      Unlike +,-,*, this one takes a relative precision bound R
+//	Note that R is only used when x and y are error-free!
+//	(This remark means that we may be less efficient than we could be)
+//
+//  	Assert( R>0  && R< CORE_Infty )
+//
+CGAL_INLINE_FUNCTION
+void BigFloatRep :: div(const BigFloatRep& x, const BigFloatRep& y,
+                        const extLong& R) {
+  if (!y.isZeroIn()) { //  y.m > y.err, so we are not dividing by 0
+    if (!x.err && !y.err) {
+      if (R < 0 || R.isInfty()) //Oct 9, 2002: fixed major bug! [Zilin/Chee]
+        div(x.m, y.m, get_static_defBFdivRelPrec(), CORE_posInfty);
+      else
+        div(x.m, y.m, R, CORE_posInfty);
+      exp += x.exp - y.exp; // chen: adjust exp.
+    } else {//  x.err > 0 or y.err > 0
+      BigInt bigErr, errRemainder;
+
+      if (x.isZeroIn()) { //  x.m <= x.err
+        m   = 0;
+        exp = x.exp - y.exp;
+
+        div_rem(bigErr, errRemainder, abs(x.m) + static_cast<long>(x.err),
+                abs(y.m) - static_cast<long>(y.err));
+      } else { //  x.m > x.err
+        long lx = bitLength(x.m);
+        long ly = bitLength(y.m);
+        long r;
+
+        if (!x.err) //  x.err == 0 and y.err > 0
+          r = ly + 2;
+        else if(!y.err)  //  x.err > 0 and y.err == 0
+          r = lx + 2;
+        else  //  x.err > 0 and y.err > 0
+          r = lx < ly ? lx + 2: ly + 2;
+
+        long   t = chunkFloor(- r + lx - ly - 1);
+        BigInt remainder;
+
+        div_rem(m, remainder, chunkShift(x.m, - t), y.m);
+        exp = t + x.exp - y.exp;
+
+        long delta = ((t > 0) ? 2 : 0);
+
+        // Chen Li: 9/9/99
+        // here again, it use ">>" operator with a negative
+        // right operand. So the result is not well defined.
+        // Erroneous code:
+        //   divide(abs(remainder) + (static_cast<long>(x.err) >> bits(t))
+        //                     + delta + static_cast<long>(y.err) * abs(m),
+        //                     abs(y.m) - static_cast<long>(y.err),
+        //                     bigErr,
+        //                     errRemainder);
+        // New code:
+        BigInt errx_over_Bexp = x.err;
+        long bits_Bexp = bits(t);
+        if (bits_Bexp >= 0) {
+          errx_over_Bexp >>= bits_Bexp;
+        } else {
+          errx_over_Bexp <<= (-bits_Bexp);
+        }
+
+        // divide(abs(remainder) + errx_over_Bexp
+        //        + delta + static_cast<long>(y.err) * abs(m),
+        //        abs(y.m) - static_cast<long>(y.err),
+        //        bigErr,
+        //        errRemainder);
+        div_rem(bigErr, errRemainder,
+                abs(remainder) + errx_over_Bexp + delta + static_cast<long>(y.err) * abs(m),
+                abs(y.m) - static_cast<long>(y.err));
+      }
+
+      if (sign(errRemainder))
+        ++bigErr;
+
+      bigNormal(bigErr);
+    }
+  } else {//  y.m <= y.err
+    core_error("BigFloat error: possible zero divisor.",
+		    __FILE__, __LINE__, true);
+  }
+
+  // Call normalization globally     -- IP 10/9/98
+  // normal(); -- Chen: after calling bigNormal, this call is redundant.
+}// BigFloatRep::div
+
+//  squareroot for BigInt argument, without initial approximation
+//  sqrt(x,a) computes sqrt of x to absolute precision a.
+//      -- this is where Newton is applied
+//      -- this is called by BigFloatRep::sqrt(BigFloat, extLong)
+CGAL_INLINE_FUNCTION
+void BigFloatRep::sqrt(const BigInt& x, const extLong& a) {
+  sqrt(x, a, BigFloat(x, 0, 0));
+} // sqrt(BigInt x, extLong a) , without initial approx
+
+//  sqrt(x,a,A) where
+//      x = bigInt whose sqrt is to be computed
+//      a = absolute precision bound
+//      A = initial approximation in BigFloat
+//  -- this is where Newton is applied
+//  -- it is called by BigFloatRep::sqrt(BigFloatRep, extLong, BigFloat)
+CGAL_INLINE_FUNCTION
+void BigFloatRep::sqrt(const BigInt& x, const extLong& a, const BigFloat& A) {
+  if (sign(x) == 0) {
+    m = 0;
+    err = 0;
+    exp = 0;
+  } else if (x == 1) {
+    m = 1;
+    err = 0;
+    exp = 0;
+  } else  {// main case
+    // here is where we use the initial approximation
+    m = A.m();
+    err = 0;
+    exp = A.exp();
+
+    BigFloatRep q, z;
+    extLong     aa;
+    // need this to make sure that in case the
+    // initial approximation A is less than sqrt(x)
+    // then Newton iteration will still proceed at
+    // least one step.
+    bool firstTime = true;
+    for (;;) {
+      aa    = a - bits(exp);
+      q.div(x, m, CORE_posInfty, aa);
+      q.err = 0;
+      q.exp -= exp;
+
+      z.sub(*this, q);  // this=current approximation, so z = this - q
+      /*if (sign(z.m) <= 0 || z.MSB() < - a)  // justification: see Koji's
+          break;                              // thesis (p. 28) which states
+                                              // that we can exit when
+                                              // " (*this) <= q + 2**(-a)"
+      */
+      // The preceding code is replaced by what follows:
+      if (z.MSB() < -a)
+        break;
+      if (sign(z.m) <= 0) {
+        if (firstTime)
+          firstTime = false;
+        else
+          break;
+      }
+
+      z.add(*this, q);
+      // Chen Li: a bug fixed here.
+      //      m   = z.m >> 1;
+      //      err = 0;
+      //      exp = z.exp;
+      if ((z.m > 1) && isEven(z.m)) {
+        m = z.m >> 1;               // exact division by 2
+        err = 0;
+        exp = z.exp;
+      } else {                      // need to shift left before division by 2
+        m = chunkShift(z.m, 1) >> 1;
+        err = 0;
+        exp = z.exp - 1;
+      }//else
+    }//for
+  }//else
+} // sqrt of BigInt, with initial approx
+
+// MAIN ENTRY INTO SQRT FUNCTION (BIGFLOAT ARGUMENT, WITHOUT INITIAL APPROX)
+CGAL_INLINE_FUNCTION
+void BigFloatRep::sqrt(const BigFloatRep& x, const extLong& a) {
+  sqrt(x, a, BigFloat(x.m, 0, x.exp));
+} //sqrt(BigFloat, extLong a)
+
+// MAIN ENTRY INTO SQRT FUNCTION (BIGFLOAT ARGUMENT WITH INITIAL APPROXIMATION)
+CGAL_INLINE_FUNCTION
+void BigFloatRep::sqrt(const BigFloatRep& x, const extLong& a, const BigFloat& A) {
+  // This computes the sqrt of x to absolute precision a, starting with
+  // the initial approximation A
+  if (sign(x.m) >= 0) {          //  x.m >= 0
+    int delta = x.exp & 1;    // delta=0 if x.exp is even, otherwise delta=1
+
+    if (x.isZeroIn()) {         //  x.m <= x.err
+      m = 0;
+      if (!x.err)
+        err = 0;
+      else {                  //  x.err > 0
+        err = (long)(std::sqrt((double)x.err));
+        err++;
+        err <<= 1;
+        if (delta)
+          err <<= HALF_CHUNK_BIT;
+      }
+      exp = x.exp >> 1;
+      normal();
+    } else {
+      long aExp = A.exp() - (x.exp >> 1);
+      BigFloat AA( chunkShift(A.m(), delta), 0, aExp);
+
+      if (!x.err) {             //  x.m > x.err = 0 (ERROR FREE CASE)
+        BigFloatRep z;
+        extLong ppp;
+        if (a.isInfty())        //Oct 9, 2002: fixed major bug! [Zilin/Chee]
+          ppp = get_static_defBFsqrtAbsPrec();
+        else
+          ppp = a + EXTLONG_ONE;
+        extLong absp  = ppp + bits(x.exp >> 1);
+
+        z.sqrt(chunkShift(x.m, delta), absp, AA); // call sqrt(BigInt, a, AA)
+
+        long p = (absp + bits(z.exp)).asLong();
+
+        // Next, normalize the error:
+        if (p <= 0) {
+          m = z.m;
+          // Chen Li: a bug fixed
+          //    BigInt bigErr = 1 << (-p);
+          BigInt bigErr(1);
+          bigErr = bigErr << static_cast<unsigned long>(-p);
+          exp = z.exp + (x.exp >> 1);
+          bigNormal(bigErr);
+        } else {                  //  p > 0
+          m = chunkShift(z.m, chunkCeil(p));
+          long r = CHUNK_BIT - 1 - (p + CHUNK_BIT - 1) % CHUNK_BIT;
+#ifdef CORE_DEBUG
+          CGAL_assertion(r >= 0);
+#endif
+
+          err = 1 >> r;
+          exp = - chunkCeil(ppp.asLong());
+          normal();
+        }
+      } else {                      //  x.m > x.err > 0 (mantissa has error)
+        BigFloatRep z;
+        extLong absp=-flrLg(x.err)+bitLength(x.m)-(bits(delta) >> 1)+EXTLONG_FOUR;
+
+        z.sqrt(chunkShift(x.m, delta), absp, AA);
+
+        long qqq = - 1 + (bitLength(x.m) >> 1) - delta * HALF_CHUNK_BIT;
+        long qq  = qqq - clLg(x.err);
+        long q   = qq + bits(z.exp);
+
+        if (q <= 0) {
+          m = z.m;
+          long   qqqq   = - qqq - bits(z.exp);
+          // Chen Li (09/08/99), a bug fixed here:
+          //        BigInt bigErr = x.err << - qqqq;
+          // when (-qqqq) is negative, the result is not correct.
+          // how "<<" and ">>" process negative second operand is
+          // not well defined. Seems it just take it as a unsigned
+          // integer and extract the last few bits.
+          // x.err is a long number which easily overflows.
+          // From page 22 of Koji's paper, I think the exponent is
+          // wrong here. So I rewrote it as:
+          BigInt bigErr = x.err;
+          if (qqqq >= 0) {
+            bigErr <<= qqqq;
+          } else {
+            bigErr >>= (-qqqq);
+            ++bigErr; // we need to keep its ceiling.
+          }
+
+          exp = z.exp + (x.exp >> 1);
+          bigNormal(bigErr);
+        } else {         //  q > 0
+          m = chunkShift(z.m, chunkCeil(q));
+          long r = CHUNK_BIT - 1 - (q + CHUNK_BIT - 1) % CHUNK_BIT;
+#ifdef CORE_DEBUG
+          CGAL_assertion(r >= 0);
+#endif
+
+          err = 1 >> r;
+          exp = (x.exp >> 1) - chunkCeil(qq);
+          normal();
+        }
+      }  // end of case with error in mantissa
+    }//else
+  } else
+    core_error("BigFloat error: squareroot called with negative operand.",
+		    __FILE__, __LINE__, true);
+} //sqrt with initial approximation
+
+//  compareMExp(x)
+//    returns  1 if *this > x
+//             0 if *this = x,
+//            -1 if *this < x,
+//
+//      Main comparison method for BigFloat
+//      This is called by BigFloat::compare()
+//      BE CAREFUL:  The error bits are ignored!
+//      Need another version if we want to take care of error bits
+
+CGAL_INLINE_FUNCTION
+int BigFloatRep :: compareMExp(const BigFloatRep& x) const {
+  int st = sign(m);
+  int sx = sign(x.m);
+
+  if (st > sx)
+    return 1;
+  else if (st == 0 && sx == 0)
+    return 0;
+  else if (st < sx)
+    return - 1;
+  else { //  need to compare m && exp
+    long expDiff = exp - x.exp;
+
+    if (expDiff > 0) //  exp > x.exp
+      return cmp(chunkShift(m, expDiff), x.m);
+    else if (!expDiff)
+      return cmp(m, x.m);
+    else  //  exp < x.exp
+      return cmp(m, chunkShift(x.m, - expDiff));
+  }
+}
+
+// 3/6/2000:
+// This is a private function used by BigFloatRep::operator<<
+// to get the exact value
+// of floor(log10(M * 2^ e)) where E is an initial guess.
+// We will return the correct E which satisfies
+//              10^E <= M * 2^e < 10^{E+1}
+// But we convert this into
+//              mm <= M < 10.mm
+
+CGAL_INLINE_FUNCTION
+long BigFloatRep :: adjustE( long E, BigInt M, long ee) const {
+  if (M<0)
+    M=-M;
+  BigInt mm(1);
+  if (ee > 0)
+    M = (M<<static_cast<unsigned long>(ee));
+  else
+    mm = (mm << static_cast<unsigned long>(-ee));
+  if (E > 0)
+    mm *= (FiveTo(E)<< static_cast<unsigned long>(E));
+  else
+    M *= (FiveTo(-E) << static_cast<unsigned long>(-E));
+
+  if (M < mm) {
+    do {
+      E--;
+      M *= 10;
+    } while (M < mm);
+  } else if (M >= 10*mm) {
+    mm *= 10;
+    do {
+      E++;
+      mm *= 10;
+    } while (M >= mm);
+  }
+  return E;
+}
+
+CGAL_INLINE_FUNCTION
+BigFloatRep::DecimalOutput
+BigFloatRep::toDecimal(unsigned int width, bool Scientific) const {
+  BigFloatRep::DecimalOutput decOut;                // to be returned
+  if (err > 0) {
+    decOut.isExact = false;
+  } else { // err == 0
+    decOut.isExact = true;
+  }
+
+  if (err > 0 && err >= abs(m)) {
+    // if err is larger than mantissa, sign and significant values
+    // can not be determined.
+    core_error("BigFloat error: Error is too big!",
+		    __FILE__, __LINE__, false);
+    decOut.rep = "0.0e0";          // error is too big
+    decOut.isScientific = false;
+    decOut.noSignificant = 0;
+    decOut.errorCode = 1;          // sign of this number is unknown
+    return decOut;
+  }
+
+  decOut.sign = sign(m);
+  decOut.errorCode = 0;
+
+  BigInt M(m);                  // temporary mantissa
+  long lm = bitLength(M);       // binary length of mantissa
+  long e2 = bits(exp);          // binary shift length represented by exponent
+  long le = clLg(err);          // binary length of err
+  if (le == -1)
+    le = 0;
+
+  long L10 = 0;
+  if (M != 0) {
+    L10 = (long)std::floor((lm + e2) / lgTenM);
+    L10 = adjustE(L10, m, e2);     // L10: floor[log10(M 2^(e2))], M != 0
+  } else {
+    L10 = 0;
+  }
+  // Convention: in the positional format, when the output is
+  // the following string of 8 characters:
+  //             (d0, d1, d2, d3, ".", d4, d5, d6, d7)
+  // then the decimal point is said to be in the 4th position.
+  // E.g., (d0, ".", d1, d2) has the decimal point in the 1st position.
+  // The value of L10 says that the decimal point of output should be at
+  // the (L10 + 1)st position. This is
+  // true regardingless of whether M = 0 or not. For zero, we output
+  // {0.0*} so L10=0.  In general, the |value| is less than 10
+  // if and only if L10 is 0 and the
+  // decimal point is in the 1st place.  Note that L10 is defined even if
+  // the output is an integer (in which case it does not physically appear
+  // but conceptually terminates the sequence of digits).
+
+  // First, get the decimal representaion of (m * B^(exp)).
+  if (e2 < 0) {
+    M *= FiveTo(-e2); // M = x * 10^(-e2)
+  } else if (e2 > 0) {
+    M <<= e2;         // M = x * 2^(e2)
+  }
+
+  std::string decRep = M.get_str();
+  // Determine the "significant part" of this string, i.e. the part which
+  // is guaranteed to be correct in the presence of error,
+  // except that the last digit which might be subject to +/- 1.
+
+  if (err != 0) {     // valid = number of significant digits
+    unsigned long valid = floorlg10(m) - (long)std::floor(std::log10(float(err)));
+    if (decRep.length() > valid) {
+      decRep.erase(valid);
+    }
+  }
+
+  // All the digits in decM are correct, except the last one might
+  // subject to an error +/- 1.
+
+  if ((decRep[0] == '+') || (decRep[0] == '-')) {
+    decRep.erase(0, 1);
+  }
+
+  // Second, make choice between positional representation
+  // and scientific notation.  Use scientific notation when:
+  // 0) if scientific notation flag is on
+  // 1) err * B^exp >= 1, the error contribute to the integral part.
+  // 2) (1 + L10) >= width, there is not have enough places to hold the
+  //    positional representation, not including decimal point.
+  // 3) The distance between the first significant digit and decimal
+  //    point is too large for the width limit. This is equivalent to
+  //            Either ((L10 >= 0 and (L10 + 1) > width))
+  //            Or  ((L10 < 0) and (-L10 + 1) > width).
+
+  if (Scientific ||
+      ((err > 0) && (le + e2) >= 0) ||          // if err*B^exp >= 1
+      ((L10 >= 0) && (L10 + 1 >= (long)width )) ||
+      ((L10 < 0) && (-L10 + 1 > (long)width ))) {
+    // use scientific notation
+    decRep = round(decRep, L10, width);
+    decOut.noSignificant = width;
+    decRep.insert(1, ".");
+    if (L10 != 0) {
+      decRep += 'e';
+      if (L10 > 0) {
+        decRep += '+';
+      } else { // L10 < 0
+        decRep += '-';
+      }
+      char eBuf[48]; // enought to hold long number L10
+      int ne = 0;
+      if ((ne = sprintf(eBuf, "%ld", labs(L10))) >= 0) {
+        eBuf[ne] = '\0';
+      } else {
+        //perror("BigFloat.cpp: Problem in outputing the exponent!");
+        core_error("BigFloat error: Problem in outputing the exponent",
+			__FILE__, __LINE__, true);
+      }
+      decRep += eBuf;
+      decOut.isScientific = true;
+    }
+  } else {
+    // use conventional positional notation.
+    if (L10 >= 0) { // x >= 1 or x == 0 and L10 + 1 <= width
+      // round when necessary
+      if (decRep.length() > width ) {
+        decRep = round(decRep, L10, width );
+        if (decRep.length() > width ) {
+          // overflow happens! use scientific notation
+          return toDecimal(width, true);
+        }
+      }
+      decOut.noSignificant = decRep.length();
+      if (L10 + 1 < (long)width ) {
+        decRep.insert(L10 + 1, ".");
+      } else { // L10 + 1 == width
+        // do nothing
+      }
+    } else { // L10 < 0, 0 < x < 1
+      // (-L10) leading zeroes, including one to the left of decimal dot
+      // need to be added in beginning.
+      decRep = std::string(-L10, '0') + decRep;
+      // then round when necessary
+      if (decRep.length() > width ) {
+        decRep = round(decRep, L10, width );
+        // cannot overflow since there are L10 leading zeroes.
+      }
+      decOut.noSignificant = decRep.length() - (-L10);
+      decRep.insert(1, ".");
+    }
+    decOut.isScientific = false;
+  }
+#ifdef CORE_DEBUG
+  CGAL_assertion(decOut.noSignificant >= 0);
+#endif
+
+  decOut.rep = decRep;
+  return decOut;
+}//toDecimal
+
+CGAL_INLINE_FUNCTION
+std::string BigFloatRep::round(std::string inRep, long& L10, unsigned int width) const {
+  // round inRep so that the length would not exceed width.
+  if (inRep.length() <= width)
+    return inRep;
+
+  int i = width; // < length
+  bool carry = false;
+
+  if ((inRep[i] >= '5') && (inRep[i] <= '9')) {
+    carry = true;
+    i--;
+    while ((i >= 0) && carry) {
+      if (carry) {
+        inRep[i] ++;
+        if (inRep[i] > '9') {
+          inRep[i] = '0';
+          carry = true;
+        } else {
+          carry = false;
+        }
+      }
+      i-- ;
+    }
+
+    if ((i < 0) && carry) { // overflow
+      inRep.insert(inRep.begin(), '1');
+      L10 ++;
+      width ++;
+    }
+  }
+
+  return inRep.substr(0, width);
+}//round(string,width)
+
+
+// This function fromString(str, prec) is similar to the
+//      constructor Real(char * str, extLong prec)
+// See the file Real.cc for the differences
+
+CGAL_INLINE_FUNCTION
+void BigFloatRep :: fromString(const char *str, const extLong & prec ) {
+  // NOTE: prec defaults to get_static_defBigFloatInputDigits() (see BigFloat.h)
+  // check that prec is not INFTY
+  if (prec.isInfty())
+    core_error("BigFloat error: infinite precision not allowed",
+			__FILE__, __LINE__, true);
+
+  const char *e = strchr(str, 'e');
+  int dot = 0;
+  long e10 = 0;
+  if (e != NULL)
+    e10 = atol(e+1);    // e10 is decimal precision of the input string
+  // i.e., input is A/10^{e10}.
+  else {
+    e = str + strlen(str);
+#ifdef CORE_DEBUG
+    CGAL_assertion(*e == '\0');
+#endif
+
+  }
+
+  const char *p = str;
+  if (*p == '-' || *p == '+')
+    p++;
+  m = 0;
+  exp = 0;
+
+  for (; p < e; p++) {
+    if (*p == '.') {
+      dot = 1;
+      continue;
+    }
+    m = m * 10 + (*p - '0');
+    if (dot)
+      e10--;
+  }
+
+  BigInt one = 1;
+  long t = (e10 < 0) ? -e10 : e10;
+  BigInt ten = FiveTo(t) * (one << static_cast<unsigned long>(t));
+
+  // HERE IS WHERE WE USE THE SYSTEM CONSTANT
+  //           defBigFloatInputDigits
+  // Note: this constant is rather similar to defInputDigits which
+  //     is used by Real and Expr for controlling
+  //     input accuracy.  The difference is that defInputDigits can
+  //     be CORE_INFTY, but defBigFloatInputDigits must be finite.
+
+  if (e10 < 0)
+    div(m, ten, CORE_posInfty, 4 * prec);
+  else
+    m *= ten;
+  if (*str == '-')
+    m = -m;
+}//BigFloatRep::fromString
+
+CGAL_INLINE_FUNCTION
+std::istream& BigFloatRep :: operator >>(std::istream& i) {
+  int size = 20;
+  char *str = new char[size];
+  char *p = str;
+  char c;
+  int d = 0, e = 0, s = 0;
+  // d=1 means dot is found
+  // e=1 means 'e' or 'E' is found
+  //  int done = 0;
+
+  // Chen Li: fixed a bug, the original statement is
+  //  for (i.get(c); c == ' '; i.get(c));
+  // use isspace instead of testing c == ' ', since it must also
+  // skip tab, catridge/return, etc.
+  // Change to:
+  //  int status;
+  do {
+    c = i.get();
+  } while (isspace(c)); /* loop if met end-of-file, or
+                               char read in is white-space. */
+  // Chen Li, "if (c == EOF)" is unsafe since c is of char type and
+  // EOF is of int tyep with a negative value -1
+  if (i.eof()) {
+    i.clear(std::ios::eofbit | std::ios::failbit);
+    return i;
+  }
+
+  // the current content in "c" should be the first non-whitespace char
+  if (c == '-' || c == '+') {
+    *p++ = c;
+    i.get(c);
+  }
+
+  for (; isdigit(c) || (!d && c=='.') ||
+       (!e && ((c=='e') || (c=='E'))) || (!s && (c=='-' || c=='+')); i.get(c)) {
+    if (!e && (c == '-' || c == '+'))
+      break;
+    // Chen Li: put one more rule to prohibite input like
+    //  xxxx.xxxe+xxx.xxx:
+    if (e && (c == '.'))
+      break;
+    if (p - str == size) {
+      char *t = str;
+      str = new char[size*2];
+      memcpy(str, t, size);
+      delete [] t;
+      p = str + size;
+      size *= 2;
+    }
+#ifdef CORE_DEBUG
+    CGAL_assertion((p-str) < size);
+#endif
+
+    *p++ = c;
+    if (c == '.')
+      d = 1;
+    // Chen Li: fix a bug -- the sign of exponent can not happen before
+    // the character "e" appears! It must follow the "e' actually.
+    //    if (e || c == '-' || c == '+') s = 1;
+    if (e)
+      s = 1;
+    if ((c == 'e') || (c=='E'))
+      e = 1;
+  }
+
+  // chenli: make sure that the p is still in the range
+  if (p - str >= size) {
+    int len = p - str;
+    char *t = str;
+    str = new char[len + 1];
+    memcpy(str, t, len);
+    delete [] t;
+    p = str + len;
+  }
+
+#ifdef CORE_DEBUG
+  CGAL_assertion(p - str < size);
+#endif
+
+  *p = '\0';
+  i.putback(c);
+  fromString(str);
+  delete [] str;
+  return i;
+}//operator >>
+
+
+// BigFloatRep::toDouble()
+//      converts the BigFloat to a machine double
+//      This is a dangerous function as the method
+//      is silent when it does not fit into a machine double!
+// ToDo: fix this by return a machine NaN, +/- Infinity, +/- 0,
+//      when appropriate.
+//      Return NaN when error is larger than mantissa
+//      Return +/- Infinity if BigFloat is too big
+//      Return +/- 0 if BigFloat is too small
+#ifdef _MSC_VER
+#pragma warning(disable: 4723)
+#endif
+CGAL_INLINE_FUNCTION
+double BigFloatRep :: toDouble() const {
+  if (m == 0)
+    return (sign(m) * 0.0);
+
+  long e2 = bits(exp);
+  long le = clLg(err);  // if err=0, le will be -1
+  if (le == -1)
+    le = 0;
+
+  BigInt M = m >> static_cast<unsigned long>(le);// remove error bits in mantissa
+
+  // Below, we want to return NaN by computing 0.0/0.0.
+  // To avoid compiler warnings about divide by zero, we do this:
+
+  double foolCompilerZero;
+  foolCompilerZero = 0.0;
+
+  // COMMENT: we should directly store the
+  //    special IEEE values NaN, +/-Infinity, +/-0 in the code!!
+
+  if (M == 0)
+    return ( 0.0/foolCompilerZero ) ; // return NaN
+
+  e2 += le;             // adjust exponent corresponding to error bits
+
+  int len = bitLength(M) - 53;  // this is positive if M is too large
+
+  if (len > 0) {
+    M >>= len;
+    e2 += len;
+  }
+
+  double tt = doubleValue(M);
+
+  int ee = e2 + bitLength(M) - 1; // real exponent.
+
+  if (ee >= 1024)       // overflow!
+    return (  sign(m)/foolCompilerZero  );      // return a signed infinity
+
+  if (ee <= -1075)      // underflow!
+    // NOTE: if (-52 < ee <= 0) get denormalized number
+    return ( sign(m) * 0.0 );  // return signed zero.
+
+  // Execute this loop if e2 < 0;
+  for (int i = 0; i > e2; i--)
+    tt /= 2;
+
+  // Execute this loop if e2 > 0;
+  for (int j = 0; j < e2; j++)
+    tt *= 2;
+
+  return tt;
+}//toDouble
+#ifdef _MSC_VER
+#pragma warning(default: 4723)
+#endif
+CGAL_INLINE_FUNCTION
+BigInt BigFloatRep::toBigInt() const {
+  long e2 = bits(exp);
+  long le = clLg(err);
+  if (le == -1)
+    le = 0;
+#ifdef CORE_DEBUG
+  CGAL_assertion (le >= 0);
+#endif
+
+  BigInt M = m >> static_cast<unsigned long>(le); // discard the contaminated bits.
+  e2 += le;           // adjust the exponent
+
+  if (e2 < 0)
+    return M >> static_cast<unsigned long>(-e2);
+  else if (e2 > 0)
+    return M << static_cast<unsigned long>(e2);
+  else
+    return M;
+}
+
+CGAL_INLINE_FUNCTION
+long BigFloatRep :: toLong() const {
+  // convert a BigFloat to a long integer, rounded toward -\infty.
+  long e2 = bits(exp);
+  long le = clLg(err);
+#ifdef CORE_DEBUG
+  CGAL_assertion (le >= 0);
+#endif
+
+  BigInt M = m >> static_cast<unsigned long>(le); // discard the contaminated bits.
+  e2 += le;           // adjust the exponent
+  long t;
+  if (e2 < 0)
+    t = ulongValue(M >> static_cast<unsigned long>(-e2));
+  else if (e2 > 0)
+    t = ulongValue(M << static_cast<unsigned long>(e2));
+  else
+    t = ulongValue(M);
+  // t = M.as_long();
+  // Note: as_long() will return LONG_MAX in case of overflow.
+
+  return t;
+}
+
+// pow(r,n) function for BigFloat
+// Note: power(r,n) calls pow(r,n)
+CGAL_INLINE_FUNCTION
+BigFloat pow(const BigFloat& r, unsigned long n) {
+  if (n == 0)
+    return BigFloat(1);
+  else if (n == 1)
+    return r;
+  else {
+    BigFloat x = r;
+    while ((n % 2) == 0) { // n is even
+      x *= x;
+      n >>= 1;
+    }
+    BigFloat u = x;
+    while (true) {
+      n >>= 1;
+      if (n == 0)
+        return u;
+      x *= x;
+      if ((n % 2) == 1) // n is odd
+        u *= x;
+    }
+    //return u; // unreachable
+  }
+}//pow
+
+// experimental
+CGAL_INLINE_FUNCTION
+BigFloat root(const BigFloat& x, unsigned long k,
+         const extLong& a, const BigFloat& A) {
+  if (x.sign() == 0) {
+    return BigFloat(0);
+  } else if (x == 1) {
+    return BigFloat(1);
+  } else  {
+    BigFloat q, del, zz;
+    BigFloat z = A;
+    BigFloat bk = long(k);
+    for (; ;) {
+      zz = pow(z, k-1);
+      q = x.div(zz, a);
+      q.makeExact();
+      del = z - q;
+      del.makeExact();
+      if (del.MSB() < -a)
+        break;
+      z = ((bk-1)*z + q).div(bk, a);
+          // newton's iteration: z_{n+1}=((k-1)z_n+x/z_n^{k-1})/k
+      z.makeExact();
+    }
+    return z;
+  }
+}//root
+
+  CORE_MEMORY_IMPL(BigFloatRep)
+
+} //namespace CORE
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/BigInt.h b/3rdparty/CGAL/include/CGAL/CORE/BigInt.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/BigInt.h
rename to 3rdparty/CGAL/include/CGAL/CORE/BigInt.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/BigRat.h b/3rdparty/CGAL/include/CGAL/CORE/BigRat.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/BigRat.h
rename to 3rdparty/CGAL/include/CGAL/CORE/BigRat.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/CORE.h b/3rdparty/CGAL/include/CGAL/CORE/CORE.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/CORE.h
rename to 3rdparty/CGAL/include/CGAL/CORE/CORE.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/Config.h b/3rdparty/CGAL/include/CGAL/CORE/Config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/Config.h
rename to 3rdparty/CGAL/include/CGAL/CORE/Config.h
diff --git a/3rdparty/CGAL/include/CGAL/CORE/CoreAux.h b/3rdparty/CGAL/include/CGAL/CORE/CoreAux.h
new file mode 100644
index 0000000..2d2be9b
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/CORE/CoreAux.h
@@ -0,0 +1,189 @@
+/****************************************************************************
+ * Core Library Version 1.7, August 2004
+ * Copyright (c) 1995-2004 Exact Computation Project
+ * 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.
+ *
+ *
+ * File: CoreAux.h
+ * Synopsis:
+ *      Auxilliary functions
+ *
+ * Written by 
+ *       Chee Yap <yap at cs.nyu.edu>
+ *       Chen Li <chenli at cs.nyu.edu>
+ *       Zilin Du <zilin at cs.nyu.edu>
+ *
+ * WWW URL: http://cs.nyu.edu/exact/
+ * Email: exact at cs.nyu.edu
+ *
+ * $URL$
+ * $Id$
+ ***************************************************************************/
+
+#ifndef _CORE_COREAUX_H_
+#define _CORE_COREAUX_H_
+
+#include <iostream>
+#include <fstream>
+#include "CGAL/CORE/Impl.h"
+
+namespace CORE { 
+
+#ifndef LONG_BIT // such as in Linux
+  #define LONG_BIT (sizeof(long) * 8)
+#endif
+
+/// CORE_EPS is unit roundoff for IEEE standard double, i.e., 2^{-53}.
+// NOTES:
+// (1) CORE_EPS is used in our Floating Point Filter (Filter.h)
+// (2) 2^{-53} is called "unit roundoff" and
+// 	is the roundoff error for numbers in the range [1,2).
+//  	"Machine epsilon" is 2*CORE_EPS = 2^{-52}.  It is the
+//  	smallest gap between two normal machine numbers  --Chee 8/2003
+//
+// const double eps = (ldexp(1.0, -53)); // fails to link on SunPro
+#define CORE_EPS ((1.0/(1<<30))/(1<<23))
+// 
+#define CORE_MACHINE_EPS ((1.0/(1<<30))/(1<<22))
+
+/// relEps is relative error for IEEE standard double, 1+2^{-52}.
+const double relEps = (1.0 + std::ldexp(1.0, -52));
+
+/// CORE_DIAGFILE is used for all warning and error messages
+const char* const CORE_DIAGFILE = "Core_Diagnostics";  // global file name
+
+/// template function returns the maximum value of two
+template <class T>
+inline const T& core_max(const T& a, const T& b) {
+  return ((a > b) ? a : b);
+}
+
+/// template function returns the minimum value of two
+template <class T>
+inline const T& core_min(const T& a, const T& b) {
+  return ((a < b) ? a : b);
+}
+
+/// template function returns the maximum value of three
+template <class T>
+inline const T& core_max(const T& a, const T& b, const T& c) {
+  return ((a > b) ? core_max(a, c) : core_max(b, c));
+}
+
+/// template function swaps two values
+template <class T>
+inline  void core_swap(T& a, T& b) {
+  T tmp;
+  tmp = a;
+  a = b;
+  b = tmp;
+}
+
+/// template function rotate three values
+template <class T>
+inline  void core_rotate(T& a, T& b, T& c) {
+  T tmp;
+  tmp = a;
+  a = b;
+  b = c;
+  c = tmp;
+}
+
+/// template function returns the minimum value of three
+template <class T>
+inline const T& core_min(const T& a, const T& b, const T& c) {
+  return ((a < b) ? core_min(a, c) : core_min(b, c));
+}
+
+/// template function returns the absolute value
+template <class T>
+inline const T core_abs(const T& a) {
+  return ((a < T(0)) ? -a : a);
+}
+
+/// returns floor log base 2 of abs(x)
+/**  CONVENTION: lg(0) = -1 */
+CGAL_CORE_EXPORT int flrLg(long x);
+
+/// returns floor log base 2 of unsigned long x
+/**  CONVENTION: lg(0) = -1 */
+CGAL_CORE_EXPORT int flrLg(unsigned long x);
+
+/// returns ceiling log base 2 of abs(x)
+/**  CONVENTION: lg(0) = -1 */
+CGAL_CORE_EXPORT int clLg(long x);
+
+/// returns ceiling log base 2 of unsigned long x
+/**  CONVENTION: lg(0) = -1 */
+CGAL_CORE_EXPORT int clLg(unsigned long x);
+
+/// gcd for machine type long
+CGAL_CORE_EXPORT long gcd(long m, long n);
+
+/// abs for int type
+inline int abs(int x) {
+  return (x>=0) ? x : (-x);
+}
+
+/// abs for long type
+inline long abs(long x) {
+  return (x>=0) ? x : (-x);
+}
+
+/// sign for int type
+inline int sign(int x) {
+  return (x==0) ? 0 : ((x>0) ? 1 : (-1));
+}
+
+/// sign for long type
+inline long sign(long x) {
+  return (x==0) ? 0 : ((x>0) ? 1 : (-1));
+}
+
+/// overloaded << to print out std::string
+inline std::ostream& operator<< (std::ostream& o, const std::string& s) {
+  o << s.c_str();
+  return o;
+}
+
+/// implements the "integer mantissa" function
+//      (See CORE_PATH/progs/ieee/frexp.cpp for details)
+CGAL_CORE_EXPORT double IntMantissa(double d);
+
+/// implements the "integer exponent" function
+//      (See CORE_PATH/progs/ieee/frexp.cpp for details)
+CGAL_CORE_EXPORT int IntExponent(double d);
+
+/// Writes out an error or warning message in the local file CORE_DIAGFILE
+/** If last argument (err) is TRUE, then this is considered an error 
+ *  (not just warning).  In this case, the message is also printed in
+ *  std::cerr, using std::perror(). 
+ *  */
+CGAL_CORE_EXPORT void core_error(std::string msg, std::string file, int lineno, bool err);
+
+/// This is for debugging messages
+inline void core_debug(std::string msg){
+  std::cout << __FILE__ << "::" << __LINE__ << ": " << msg
+	    << std::endl;
+}
+
+
+} //namespace CORE
+
+#ifdef CGAL_HEADER_ONLY
+#include <CGAL/CORE/CoreAux_impl.h>
+#endif // CGAL_HEADER_ONLY
+
+#endif // _CORE_COREAUX_H_
diff --git a/3rdparty/CGAL/include/CGAL/CORE/CoreAux_impl.h b/3rdparty/CGAL/include/CGAL/CORE/CoreAux_impl.h
new file mode 100644
index 0000000..901ec82
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/CORE/CoreAux_impl.h
@@ -0,0 +1,226 @@
+/****************************************************************************
+ * Core Library Version 1.7, August 2004
+ * Copyright (c) 1995-2004 Exact Computation Project
+ * 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.
+ *
+ *
+ * File: CoreAux.cpp
+ * Synopsis:
+ *       Auxiliary routines such as ceiling of log_2, etc. 
+ *       they are not specific to any Core classes.
+ *
+ * Written by 
+ *       Chee Yap <yap at cs.nyu.edu>
+ *       Chen Li <chenli at cs.nyu.edu>
+ *       Zilin Du <zilin at cs.nyu.edu>
+ *
+ * WWW URL: http://cs.nyu.edu/exact/
+ * Email: exact at cs.nyu.edu
+ *
+ * $URL$
+ * $Id$
+ ***************************************************************************/
+
+#ifdef CGAL_HEADER_ONLY
+#define CGAL_INLINE_FUNCTION inline
+#else
+#define CGAL_INLINE_FUNCTION
+#endif
+
+#include <CGAL/CORE/CoreAux.h>
+#include <gmp.h>
+
+namespace CORE { 
+
+////////////////////////////////////////////////////////////
+//  More useful functions to implement:
+//
+//  To convert digits into bits:
+//      given X, compute X * log_2(10)
+//  To convert bits into digits:
+//      given X, compute X * log_10(2)
+//
+////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////
+// flrLg(x)
+//      returns floor log base 2 of abs(x)
+// CONVENTION lg(0) = -1	(Slight improvement, Zilin/Chee 8/5/02)
+////////////////////////////////////////////////////////////
+CGAL_INLINE_FUNCTION
+int flrLg(long x) {
+  if (x == LONG_MIN) {
+    // special treatment as -LONG_MIN would be not representable as "long"
+    return LONG_BIT - 1;
+  } else {
+    //  1 <= |x| <= LONG_MAX
+    if (x < 0)
+      x = - x;
+
+    int lg = -1;
+    while (x > 0) {
+      lg++;
+      x >>= 1;
+    }
+    return lg;
+  }
+}
+
+////////////////////////////////////////////////////////////
+// floor log base 2 of unsigned long x
+// CONVENTION lg(0) = -1	(Slight improvement, Zilin/Chee 8/5/02)
+////////////////////////////////////////////////////////////
+CGAL_INLINE_FUNCTION
+int flrLg(unsigned long x) {
+  int lg = -1;
+  while (x > 0) {
+    lg++;
+    x >>= 1;
+  }
+  return lg;
+}
+
+////////////////////////////////////////////////////////////
+// ceiling log base 2 of abs(x)
+// CONVENTION lg(0) = -1	(Slight improvement, Zilin/Chee 8/5/02)
+////////////////////////////////////////////////////////////
+CGAL_INLINE_FUNCTION
+int clLg(long x) {
+  if (x == LONG_MIN)
+    return LONG_BIT - 1;
+  if (x < 0)
+    x = -x; 		// use absolute value
+  if (x > (LONG_MAX >> 1)) 	// the leading data bit is 1
+    return (LONG_BIT - 1);	// exclude the sign bit
+  if (x >= 2)
+    return flrLg((unsigned long)((x << 1) - 1));
+  // SINCE ceilLog_2(x) = floorLog_2(2x-1) for x>=2
+  if (x == 1)
+    return 0;
+  return -1;			// x must be 0 here
+}
+
+////////////////////////////////////////////////////////////
+// ceiling log base 2 of unsigned long x
+// CONVENTION lg(0) = -1
+////////////////////////////////////////////////////////////
+CGAL_INLINE_FUNCTION
+int clLg(unsigned long x) {
+  if (x > (ULONG_MAX >> 1))	// the leading bit is 1
+    return LONG_BIT;
+  if (x >= 2)
+    return flrLg((x << 1) - 1);
+  // SINCE ceilLog_2(x) = floorLog_2(2x-1) for x>=2.
+  if (x == 1)
+    return 0;
+  return -1;	// x must be equal to 0
+}
+
+/// gcd for machine type long
+/** This is needed when we construct Polynomials with int or long coefficients */
+CGAL_INLINE_FUNCTION
+long gcd(long m, long n) {
+  if (m == 0)
+    return core_abs(n);
+  if (n == 0)
+    return core_abs(m);
+  long p = core_abs(m);
+  long q = core_abs(n);
+  if (p<q)
+    core_swap(p, q);
+  while (q>0) {
+    long r = p % q;
+    p = q;
+    q = r;
+  }
+  return p;
+}
+
+// return a gmp_randstate_t structure
+CGAL_INLINE_FUNCTION
+gmp_randstate_t* getRandstate() {
+  static gmp_randstate_t rstate;
+  static bool initialized = false;
+  if (!initialized) {
+    gmp_randinit(rstate, GMP_RAND_ALG_DEFAULT, 32L);
+    initialized = true;
+  }
+  return &rstate;
+}
+
+// char* core_itoa(int n, char* buffer)
+//      returns a pointer to the null-terminated string in buffer
+// NOTES:
+// 0. Buffer size should be 17 bytes (resp., 33 bytes, 65 bytes) on 16-bit
+//      (resp., 32-bit, 64-bit) machines.  Formula: 1+sizeof(int)*8 bytes.
+// 1. itoa(...) is available on some stdlib.h, but it is
+//      not defined by ANSI-C and so not all compilers support it.
+// 2. Our use of sprintf(...) to do the job is known to
+//      be inefficient, but this is hardly critical for our usage.
+// 3. A more general program should take a 3rd argument (the radix of
+//      output number).  We assume radix 10.
+CGAL_INLINE_FUNCTION
+char * core_itoa(int n, char* buffer) {
+	std::sprintf(buffer, "%d", n);
+	return buffer;
+}
+
+/// implements the "integer mantissa" function
+//      (See CORE_PATH/progs/ieee/frexp.cpp for details)
+CGAL_INLINE_FUNCTION
+double IntMantissa(double d) {
+	int e;
+	return std::ldexp(std::frexp(d, &e), 53);
+}
+
+/// implements the "integer exponent" function
+//      (See CORE_PATH/progs/ieee/frexp.cpp for details)
+CGAL_INLINE_FUNCTION
+int IntExponent(double d) {
+	int e;
+	std::frexp(d, &e);
+	return e-53;
+}
+
+/// core_error is the method to write Core Library warning or error messages
+/** 	Both warnings and errors are written to a file called CORE_DIAGFILE.
+ *	But errors are also written on std:cerr (similar to std::perror()).
+ * */
+// Usage: core_error(message, file_with_error, line_number, err_type)
+//   where err_type=0 means WARNING, error_type=0 means ERROR
+CGAL_INLINE_FUNCTION 
+void core_error(std::string msg, std::string file, int lineno, bool err) {
+  std::ofstream outFile(CORE_DIAGFILE, std::ios::app);  // open to append
+  if (!outFile) {
+     // perror("CORE ERROR: cannot open Core Diagnostics file");
+     std::cerr << "CORE ERROR: can't open Core Diagnostics file"<<std::endl;
+     std::exit(1); //Note: do not call abort()
+  }
+  outFile << "CORE " << (err? "ERROR" : "WARNING")
+     << " (at " << file << ": " << lineno << "): "
+     << msg << std::endl;
+  outFile.close();
+  if (err) {
+     char buf[65];
+     // perror((std::string("CORE ERROR") + " (file " + file + ", line "
+     //        + core_itoa(lineno,buf) +"):" + msg + "\n").c_str());
+     std::cerr << (std::string("CORE ERROR") + " (file " + file + ", line "
+             + core_itoa(lineno,buf) +"):" + msg + "\n").c_str();
+     std::exit(1); //Note: do not call abort()
+  }
+}
+
+
+} //namespace CORE
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/CoreDefs.h b/3rdparty/CGAL/include/CGAL/CORE/CoreDefs.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/CoreDefs.h
rename to 3rdparty/CGAL/include/CGAL/CORE/CoreDefs.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/CoreDefs_impl.h b/3rdparty/CGAL/include/CGAL/CORE/CoreDefs_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/CoreDefs_impl.h
rename to 3rdparty/CGAL/include/CGAL/CORE/CoreDefs_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/CoreIO_impl.h b/3rdparty/CGAL/include/CGAL/CORE/CoreIO_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/CoreIO_impl.h
rename to 3rdparty/CGAL/include/CGAL/CORE/CoreIO_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/Expr.h b/3rdparty/CGAL/include/CGAL/CORE/Expr.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/Expr.h
rename to 3rdparty/CGAL/include/CGAL/CORE/Expr.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/ExprRep.h b/3rdparty/CGAL/include/CGAL/CORE/ExprRep.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/ExprRep.h
rename to 3rdparty/CGAL/include/CGAL/CORE/ExprRep.h
diff --git a/3rdparty/CGAL/include/CGAL/CORE/Expr_impl.h b/3rdparty/CGAL/include/CGAL/CORE/Expr_impl.h
new file mode 100644
index 0000000..550a9fe
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/CORE/Expr_impl.h
@@ -0,0 +1,1255 @@
+/****************************************************************************
+ * Core Library Version 1.7, August 2004
+ * Copyright (c) 1995-2004 Exact Computation Project
+ * 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.
+ *
+ *
+ * File: Expr.cpp
+ *
+ * Written by 
+ *       Koji Ouchi <ouchi at simulation.nyu.edu>
+ *       Chee Yap <yap at cs.nyu.edu>
+ *       Igor Pechtchanski <pechtcha at cs.nyu.edu>
+ *       Vijay Karamcheti <vijayk at cs.nyu.edu>
+ *       Chen Li <chenli at cs.nyu.edu>
+ *       Zilin Du <zilin at cs.nyu.edu>
+ *       Sylvain Pion <pion at cs.nyu.edu> 
+ *
+ * WWW URL: http://cs.nyu.edu/exact/
+ * Email: exact at cs.nyu.edu
+ *
+ * $URL$
+ * $Id$
+ ***************************************************************************/
+
+#ifdef CGAL_HEADER_ONLY
+#define CGAL_INLINE_FUNCTION inline
+#else
+#define CGAL_INLINE_FUNCTION
+#endif
+
+#include <CGAL/CORE/Expr.h>
+#include <cmath>
+
+namespace CORE { 
+
+#if defined(CORE_DEBUG_BOUND) && !defined(CGAL_HEADER_ONLY)
+unsigned int BFMSS_counter = 0;
+unsigned int BFMSS_only_counter = 0;
+unsigned int Measure_counter = 0;
+unsigned int Measure_only_counter = 0;
+unsigned int Cauchy_counter = 0;
+unsigned int Cauchy_only_counter = 0;
+unsigned int LiYap_counter = 0;
+unsigned int LiYap_only_counter = 0;
+unsigned int rootBoundHitCounter = 0;
+unsigned int computeBoundCallsCounter = 0;
+#endif
+
+#ifndef CGAL_HEADER_ONLY
+const char* Add::name = "+";
+const char* Sub::name = "-";
+#endif
+
+/********************************************************
+ *  class Expr
+ ********************************************************/
+CGAL_INLINE_FUNCTION
+const Expr& Expr::getZero() {
+  static Expr Zero(0);
+  return Zero;
+}
+CGAL_INLINE_FUNCTION
+const Expr& Expr::getOne() {
+  static Expr One(1);
+  return One;
+}
+
+// computes an interval comprising a pair of doubles
+// Note:
+//
+// This function returns are two consecutive representable binary
+// IEEE double values whichs contain the real value, but when you print out
+// them, you might be confused by the decimal represention due to round.
+//
+CGAL_INLINE_FUNCTION
+void Expr::doubleInterval(double & lb, double & ub) const {
+  double d = doubleValue();
+  if (! CGAL_CORE_finite(d)) {	// if overflow, underflow or NaN
+    lb = ub = d;
+    return;
+  }
+  int sign = ((* this) -Expr(d)).sign();
+  // Seems like doubleValue() always give a lower bound,
+  // 	so sign = 0 or 1 (never -1).
+  //std::cout << "Sign = " << sign << std::endl;
+  if (sign == 0) {
+    lb = ub = d;
+    return;
+  }
+  int exp;
+  frexp(d, & exp);  	// get the exponent of d
+  exp--;		// the exp from frexp satisfies
+  //     2^{exp-1} <= d < 2^{exp}
+  // But, we want exp to satisfy
+  //     2^{exp} <= d < 2^{exp+1}
+  if (sign > 0) {
+    lb = d;
+    ub = d + ldexp(1.0, -52+exp);
+    return;
+  } else {
+    ub = d;
+    lb = d - ldexp(1.0, -52+exp);
+    return;
+  }
+}
+
+// floor(e, sub) returns the floor(e), and puts the
+//      remainder into sub.
+CGAL_INLINE_FUNCTION
+BigInt floor(const Expr& e, Expr &sub) {
+  if (e==0) {
+	  return 0;
+  }
+  BigInt f = e.approx(CORE_INFTY, 2).BigIntValue();
+  sub = e-f;
+  // Adjustment
+  if (sub<0)
+    ++sub, --f;
+  if (sub>=1)
+    --sub, ++f;
+  CGAL_assertion(sub >=0 && sub<1); // got an assertion error? (Chee 3/24/04)
+  return f;
+}
+
+// Chenli: implemented algorithm from Goldberg's article.
+// 7/01: Thanks to Serge Pashkov for fixing infinite loop when n=0.
+CGAL_INLINE_FUNCTION
+Expr pow(const Expr& e, unsigned long n) {
+  if (n == 0)
+    return Expr(1);
+  else if (n == 1)
+    return e;
+  else {
+    Expr x = e;
+    while ((n % 2) == 0) { // n is even
+      x *= x;
+      n >>= 1;
+    }
+    Expr u = x;
+    while (true) {
+      n >>= 1;
+      if (n == 0)
+        return u;
+      x *= x;
+      if ((n % 2) == 1) // n is odd
+        u *= x;
+    }
+    //return u; // unreachable
+  }
+}//pow
+
+CGAL_INLINE_FUNCTION
+NodeInfo::NodeInfo() : appValue(CORE_REAL_ZERO), appComputed(false),
+    flagsComputed(false), knownPrecision(CORE_negInfty),
+#ifdef CORE_DEBUG
+    relPrecision(EXTLONG_ZERO), absPrecision(CORE_negInfty), numNodes(0),
+#endif
+    // Most of the following data members don't need to be
+    // initialized here.
+    d_e(EXTLONG_ZERO), visited(false), sign(0),
+    uMSB(CORE_negInfty), lMSB(CORE_negInfty),
+    // length(0),
+    measure(EXTLONG_ZERO), high(EXTLONG_ZERO), low(EXTLONG_ONE),
+    lc(EXTLONG_ZERO), tc(EXTLONG_ZERO),
+    v2p(EXTLONG_ZERO), v2m(EXTLONG_ZERO),
+    v5p(EXTLONG_ZERO), v5m(EXTLONG_ZERO),
+    u25(EXTLONG_ZERO), l25(EXTLONG_ZERO),
+    ratFlag(0), ratValue(NULL) { }
+
+/********************************************************
+ *  class ExprRep
+ ********************************************************/
+//  constructor
+CGAL_INLINE_FUNCTION
+ExprRep::ExprRep() : refCount(1), nodeInfo(NULL), ffVal(0.0) { }
+
+// Computes the root bit bound of the expression.
+// In effect, computeBound() returns the current value of low.
+CGAL_INLINE_FUNCTION
+extLong ExprRep::computeBound() {
+  extLong measureBd = measure();
+  // extLong cauchyBd = length();
+  extLong ourBd = (d_e() - EXTLONG_ONE) * high() + lc();
+  // BFMSS[2,5] bound.
+  extLong bfmsskBd;
+  if (v2p().isInfty() || v2m().isInfty())
+    bfmsskBd = CORE_INFTY;
+  else
+    bfmsskBd = l25() + u25() * (d_e() - EXTLONG_ONE) - v2() - ceilLg5(v5());
+
+  // since we might compute \infty - \infty for this bound
+  if (bfmsskBd.isNaN())
+    bfmsskBd = CORE_INFTY;
+
+  extLong bd = core_min(measureBd,
+                        // core_min(cauchyBd,
+                        core_min(bfmsskBd, ourBd));
+#ifdef CORE_SHOW_BOUNDS
+    std::cout << "Bounds (" << measureBd <<
+                    "," << bfmsskBd << ", " << ourBd << "),  ";
+    std::cout << "MIN = " << bd << std::endl;
+    std::cout << "d_e= " << d_e() << std::endl;
+#endif
+
+#if defined(CORE_DEBUG_BOUND) && !defined(CGAL_HEADER_ONLY)
+  // Some statistics about which one is/are the winner[s].
+  computeBoundCallsCounter++;
+  int number_of_winners = 0;
+  std::cerr << " New contest " << std::endl;
+  if (bd == bfmsskBd) {
+    BFMSS_counter++;
+    number_of_winners++;
+    std::cerr << " BFMSS is the winner " << std::endl;
+  }
+  if (bd == measureBd) {
+    Measure_counter++;
+    number_of_winners++;
+    std::cerr << " measureBd is the winner " << std::endl;
+  }
+  /*  if (bd == cauchyBd) {
+      Cauchy_counter++;
+      number_of_winners++;
+      std::cerr << " cauchyBd is the winner " << std::endl;
+    }
+   */
+  if (bd == ourBd) {
+    LiYap_counter++;
+    number_of_winners++;
+    std::cerr << " ourBd is the winner " << std::endl;
+  }
+
+  CGAL_assertion(number_of_winners >= 1);
+
+  if (number_of_winners == 1) {
+    if (bd == bfmsskBd) {
+      BFMSS_only_counter++;
+      std::cerr << " BFMSSBd is the only winner " << std::endl;
+    } else if (bd == measureBd) {
+      Measure_only_counter++;
+      std::cerr << " measureBd is the only winner " << std::endl;
+    }
+    /* else if (bd == cauchyBd) {
+      Cauchy_only_counter++;
+      std::cerr << " cauchyBd is the only winner " << std::endl;
+    } */
+    else if (bd == ourBd) {
+      LiYap_only_counter++;
+      std::cerr << " ourBd is the only winner " << std::endl;
+    }
+  }
+#endif
+
+  return bd;
+}//computeBound()
+
+CGAL_INLINE_FUNCTION
+void ExprRep::reduceToBigRat(const BigRat& rat) {
+  Real value(rat);
+
+  //appValue() = value;
+  appComputed() = false; // since appValue is not assigned until approx() is called
+  flagsComputed() = true;
+  knownPrecision() = CORE_negInfty;
+
+#ifdef CORE_DEBUG
+  relPrecision() = EXTLONG_ZERO;
+  absPrecision() = CORE_negInfty;
+  //numNodes() = numNodes();
+#endif
+
+  d_e() = EXTLONG_ONE;
+  //visited() = e->visited();
+  sign() = value.sign();
+  uMSB() = value.MSB();
+  lMSB() = value.MSB();
+  // length() = value.length(); 	// fixed? original = 1
+  measure() = value.height();		// measure <= height for rational value
+
+  // BFMSS[2,5] bound.
+  value.ULV_E(u25(), l25(), v2p(), v2m(), v5p(), v5m());
+
+  extLong u_e = u25() + v2p();
+  extLong l_e = l25() + v2m();
+
+  u_e = u_e + ceilLg5(v5p());
+  l_e = l_e + ceilLg5(v5m());
+
+  if (l_e == EXTLONG_ZERO) {           // no divisions introduced
+    high() = u_e;
+    low() = EXTLONG_ONE - u_e; // - (u_e - 1)
+  } else {
+    high() = u_e - l_e + EXTLONG_ONE;
+    low() = 2 - high();
+  }
+
+  lc() = l_e;
+  tc() = u_e;
+
+  if (ratValue() == NULL)
+    ratValue() = new BigRat(rat);
+  else
+    *(ratValue()) = rat;
+}
+
+// This only copies the current information of the argument e to
+// 	*this ExprRep.
+CGAL_INLINE_FUNCTION
+void ExprRep::reduceTo(const ExprRep *e) {
+  if (e->appComputed()) {
+    appValue() = e->appValue();
+    appComputed() = true;
+    flagsComputed() = true;
+    knownPrecision() = e->knownPrecision();
+#ifdef CORE_DEBUG
+    relPrecision() = e->relPrecision();
+    absPrecision() = e->absPrecision();
+    numNodes() = e->numNodes();
+#endif
+
+  }
+  d_e() = e->d_e();
+  //visited() = e->visited();
+  sign() = e->sign();
+  uMSB() = e->uMSB();
+  lMSB() = e->lMSB();
+  // length() = e->length(); 	// fixed? original = 1
+  measure() = e->measure();
+
+  // BFMSS[2,5] bound.
+  u25() = e->u25();
+  l25() = e->l25();
+  v2p() = e->v2p();
+  v2m() = e->v2m();
+  v5p() = e->v5p();
+  v5m() = e->v5m();
+
+  high() = e->high();
+  low() = e->low();		// fixed? original = 0
+  lc() = e->lc();
+  tc() = e->tc();
+
+  // Chee (Mar 23, 2004), Notes on ratFlag():
+  // ===============================================================
+  // For more information on the use of this flag, see progs/pentagon.
+  // This is an integer valued member of the NodeInfo class.
+  // Its value is used to determine whether
+  // we can ``reduce'' an Expression to a single node containing
+  // a BigRat value.  This reduction is done if the global variable
+  // get_static_rationalReduceFlag()=true.  The default value is false.
+  // This is the intepretation of ratFlag:
+  //	ratFlag < 0 means irrational
+  //	ratFlag = 0 means not initialized
+  //	ratFlag > 0 means rational
+  // Currently, ratFlag>0 is an upper bound on the size of the expression,
+  // since we recursively compute
+  // 		ratFlag(v) = ratFlag(v.lchild)+ratFlag(v.rchild) + 1.
+  // PROPOSAL: if ratFlag() > RAT_REDUCE_THRESHHOLD
+  // 	then we automatically do a reduction.  We must determine
+  // 	an empirical value for RAT_REDUCE_THRESHOLD
+
+  if (get_static_rationalReduceFlag()) {
+    ratFlag() = e->ratFlag();
+
+    if (e->ratFlag() > 0 && e->ratValue() != NULL) {
+      ratFlag() ++;
+      if (ratValue() == NULL)
+        ratValue() = new BigRat(*(e->ratValue()));
+      else
+        *(ratValue()) = *(e->ratValue());
+    } else
+      ratFlag() = -1;
+  }
+}
+
+CGAL_INLINE_FUNCTION
+void ExprRep::reduceToZero() {
+  appValue() = CORE_REAL_ZERO;
+  appComputed() = true;
+  flagsComputed() = true;
+  knownPrecision() = CORE_negInfty;
+#ifdef CORE_DEBUG
+  relPrecision() = EXTLONG_ZERO;
+  absPrecision() = CORE_negInfty;
+  //  numNodes() = 0;
+#endif
+
+  d_e() = EXTLONG_ONE;
+  visited() = false;
+  sign() = 0;
+  uMSB() = CORE_negInfty;
+  lMSB() = CORE_negInfty;
+  // length() = 0; 	// fixed? original = 1
+  measure() = EXTLONG_ZERO;
+
+  // BFMSS[2,5] bound.
+  u25() = l25() = v2p() = v2m() = v5p() = v5m() = EXTLONG_ZERO;
+
+  low() = EXTLONG_ONE;		// fixed? original = 0
+  high() = lc() = tc() = EXTLONG_ZERO;
+
+  if (get_static_rationalReduceFlag()) {
+    if (ratFlag() > 0) {
+      ratFlag() ++;
+      if (ratValue() == NULL)
+        ratValue() = new BigRat(0);
+      else
+        *(ratValue()) = 0;
+    } else
+      ratFlag() = 1;
+  }
+}
+
+////////////////////////////////////////////////////////////
+//  Test whether the current approximate value satisfies
+//  the composite precision requirements [relPrec, absPrec].
+////////////////////////////////////////////////////////////
+
+CGAL_INLINE_FUNCTION
+bool ExprRep::withinKnownPrecision(const extLong& relPrec,
+                                   const extLong& absPrec) {
+  if (appComputed()) { // an approximate value has been evaluated.
+    if (appValue().isExact()) {
+      return true;
+    } else { // approximation has certain error.
+      // decide to which position it is required to compute correctly.
+      extLong required = core_max(-absPrec, appValue().lMSB()-relPrec);
+      // see whether the existing error is smaller than the requirement.
+      return (knownPrecision() <= required);
+    }
+  } else
+    return false;
+}//withinKnownPrecision(a, r)
+
+// approximate the expression to certain precisions when
+// necessary (either no approximate value available or
+// the existing one is not accurate enough).
+CGAL_INLINE_FUNCTION
+void ExprRep::approx(const extLong& relPrec = get_static_defRelPrec(),
+                     const extLong& absPrec = get_static_defAbsPrec()) {
+  if (!getSign())
+    return; // if it is exactly zero...
+
+  // NOTE: The Filter might give a precise enough approximation already.
+  if (!getExactSign())
+    return;
+
+  if (!appComputed() || (!withinKnownPrecision(relPrec, absPrec))) {
+    // it's necessary to re-evaluate.
+    // to avoid huge lMSB which would cause long time and problems.
+
+    // if it is a rational node
+    if (get_static_rationalReduceFlag() && ratFlag() > 0 && ratValue() != NULL)
+      appValue() = Real(*(ratValue())).approx(relPrec, absPrec); //< shouldn't
+                         // this case be done by computeApproxValue()?
+    else
+      computeApproxValue(relPrec, absPrec);
+
+    // update flags
+    appComputed() = true;
+    knownPrecision() = appValue().clLgErr();
+#ifdef CORE_DEBUG
+    if (relPrecision() < relPrec)
+      relPrecision() = relPrec;
+    if (absPrecision() < absPrec)
+      absPrecision() = absPrec;
+#endif
+
+  }
+}
+
+// return an approximate value to certain precision.
+CGAL_INLINE_FUNCTION
+const Real& ExprRep::getAppValue(const extLong& relPrec,
+		const extLong& absPrec) {
+  if (getSign()) {
+    approx(relPrec, absPrec);
+    return appValue();
+  } else
+    return CORE_REAL_ZERO;
+}
+
+CGAL_INLINE_FUNCTION
+std::ostream& operator<<(std::ostream& o, ExprRep& rep) {
+  if (rep.getSign()) {
+    rep.approx(get_static_defRelPrec(), get_static_defAbsPrec());
+    o << rep.appValue();
+  } else {
+    o << "0";
+  }
+  return o;
+}
+
+// Chee, Zilin: July 17, 2002
+//  Original algorithm is wrongly implemented, and can take time
+//	 exponential in the size of the dag.
+//
+//  METHOD:
+//	Inductively assume that all "visited" flags are false.
+//	This calls for a reimplementation of "count()" and "clearFlag()".
+//	Actually, we did not have to fix the count() function.
+//
+//  (1) First recursively compute d_e for each node
+//		by calling the count() function.
+//	Important thing is count() will turn the "visited" flags
+//		to be true, so that there is no double counting.
+//	Furthermore, if d_e had already been computed, the
+//		arithmetic for d_e can be avoided (in this case,
+//		it is only the setting of "visited" flag that we
+//		are interested in!
+//  (2) At the end of count(), we have set all reachable nodes
+//		to "visited", and their d_e have been computed.
+//  (3) Now, call clearFlag() to recursively clear all reachable
+//		nodes.  NOTE THAT PREVIOUSLY, clearFlag() was called
+//		first!  This obvious is wrong
+
+CGAL_INLINE_FUNCTION
+extLong ExprRep::degreeBound() {
+  if (d_e() == EXTLONG_ONE) // no radical nodes below
+    return EXTLONG_ONE;
+  count();
+  clearFlag();
+  return d_e();
+}
+//  class ConstRealRep
+//  constructor
+CGAL_INLINE_FUNCTION
+ConstRealRep::ConstRealRep(const Real & r) : value(r) {
+  if (!value.isExact()) {
+    // clone the BigFloat and set its error to zero.
+    value = value.BigFloatValue().makeExact();
+  }
+  ffVal = filteredFp(value);
+}
+
+// initialize nodeInfo
+CGAL_INLINE_FUNCTION
+void ConstRep::initNodeInfo() {
+  nodeInfo = new NodeInfo();
+  d_e() = EXTLONG_ONE;
+}
+CGAL_INLINE_FUNCTION
+void UnaryOpRep::initNodeInfo() {
+  if (child->nodeInfo == NULL)
+    child->initNodeInfo();
+  nodeInfo = new NodeInfo();
+}
+CGAL_INLINE_FUNCTION
+void BinOpRep::initNodeInfo() {
+  if (first->nodeInfo == NULL)
+    first->initNodeInfo();
+  if (second->nodeInfo == NULL)
+    second->initNodeInfo();
+  nodeInfo = new NodeInfo();
+}
+
+#ifdef CORE_DEBUG
+CGAL_INLINE_FUNCTION
+unsigned long ConstRep::dagSize() {
+  if (!visited()) {
+    visited() = true;
+    numNodes() = 1;
+  } else
+    numNodes() = 0;
+  return numNodes();
+}
+
+CGAL_INLINE_FUNCTION
+unsigned long UnaryOpRep::dagSize() {
+  if (!visited()) {
+    visited() = true;
+    numNodes() = child->dagSize() + 1;
+  } else
+    numNodes() = 0;
+  return numNodes();
+}
+
+CGAL_INLINE_FUNCTION
+unsigned long BinOpRep::dagSize() {
+  if (!visited()) {
+    visited() = true;
+    numNodes() = first->dagSize() + second->dagSize() + 1;
+  } else
+    numNodes() = 0;
+  return numNodes();
+}
+
+CGAL_INLINE_FUNCTION
+void ConstRep::fullClearFlag() {
+  if (visited())
+    visited() = false;
+}
+
+CGAL_INLINE_FUNCTION
+void UnaryOpRep::fullClearFlag() {
+  if (visited()) {
+    child->fullClearFlag();
+    visited() = false;
+  }
+}
+
+CGAL_INLINE_FUNCTION
+void BinOpRep::fullClearFlag() {
+  if (visited()) {
+    first->fullClearFlag();
+    second->fullClearFlag();
+    visited() = false;
+  }
+}
+#endif
+
+//
+// clear visited flag
+//
+/* see Expr.h
+  void ConstRep::clearFlag()
+  { visited = false; }
+*/
+CGAL_INLINE_FUNCTION
+void UnaryOpRep::clearFlag() {
+  if (d_e() == EXTLONG_ONE)
+    return; // no radicals below.
+  if (visited()) {
+    visited() = false;
+    child->clearFlag();
+  }
+}
+//  class BinOpRep
+CGAL_INLINE_FUNCTION
+void BinOpRep::clearFlag() {
+  if (d_e() == EXTLONG_ONE)
+    return; // rational below
+  if (visited()) {
+    visited() = false;
+    first->clearFlag();
+    second->clearFlag();
+  }
+}
+
+//
+// count # of squareroot
+//
+CGAL_INLINE_FUNCTION
+extLong ConstRep::count() {
+  if (visited())
+    return EXTLONG_ONE;
+  visited() = true;
+  return d_e();
+}
+
+CGAL_INLINE_FUNCTION
+extLong NegRep::count() {
+  if (d_e() == EXTLONG_ONE)
+    return EXTLONG_ONE;
+  if (visited())
+    return EXTLONG_ONE;
+  visited() = true;
+  d_e() = child->count();
+  return d_e();
+}
+
+CGAL_INLINE_FUNCTION
+extLong SqrtRep::count() {
+  if (d_e() == EXTLONG_ONE)
+    return EXTLONG_ONE;
+  if (visited())
+    return EXTLONG_ONE;
+  visited() = true;
+  d_e() = child->count() * EXTLONG_TWO;
+  return d_e();
+}
+
+CGAL_INLINE_FUNCTION
+extLong BinOpRep::count() {
+  if (d_e() == EXTLONG_ONE)
+    return EXTLONG_ONE;
+  if (visited())
+    return EXTLONG_ONE;
+  visited() = true;
+  d_e() = first->count() * second->count();
+  return d_e();
+}
+
+//
+// compute exact flags functions
+//
+//  exact value
+
+CGAL_INLINE_FUNCTION
+void computeExactFlags_temp(ConstRep* t, const Real &value) {
+  // Chen Li: the following is incorrect:
+  //    uMSB = lMSB = value.MSB();
+  // because the value could be a BigFloat which is an interval.
+  if (value.isExact()) {
+    t->uMSB() = t->lMSB() = value.MSB();
+  } else {
+    t->uMSB() = value.uMSB();
+    t->lMSB() = value.lMSB();
+    core_error("Leaves in DAG is not exact!", __FILE__, __LINE__, true);
+  }
+
+  t->sign() = value.sign();
+  // t->length() = value.length();
+  t->measure() = value.height(); // for rationals and integers,
+  // measure = height.
+
+  // BFMSS[2,5] bound.
+  value.ULV_E(t->u25(), t->l25(), t->v2p(), t->v2m(), t->v5p(), t->v5m());
+
+  // The original BFMSS parameters can be set from the BFMSS[2,5] parameters.
+  // Here we just need them locally.
+  extLong u_e = t->u25() + t->v2p() + ceilLg5(t->v5p());
+  extLong l_e = t->l25() + t->v2m() + ceilLg5(t->v5m());
+
+#ifdef ORIGINAL_BFMSS
+  // To go back to the original BFMSS :
+  t->u25() = u_e;
+  t->l25() = l_e;
+  t->v2p() = t->v2m() = t->v5p() = t->v5m() = EXTLONG_ZERO;
+#elif defined BFMSS_2_ONLY
+  // To go back to BFMSS[2] only :
+  t->u25() = t->u25() + ceilLg5(t->v5p());
+  t->l25() = t->l25() + ceilLg5(t->v5m());
+  t->v5p() = t->v5m() = EXTLONG_ZERO;
+#endif
+
+  if (l_e == EXTLONG_ZERO) {           // no divisions introduced
+    t->high() = u_e;
+    t->low() = EXTLONG_ONE - u_e; // - (u_e - 1)
+  } else {
+    t->high() = u_e - l_e + EXTLONG_ONE;
+    t->low() = EXTLONG_TWO - t->high();
+  }
+
+  t->lc() = l_e;
+  t->tc() = u_e;
+
+  // set BigRat value
+  if (get_static_rationalReduceFlag()) {
+    t->ratFlag() = 1;
+    t->ratValue() = new BigRat(value.BigRatValue());
+  }
+
+  t->flagsComputed() = true;
+}
+
+CGAL_INLINE_FUNCTION
+void ConstDoubleRep::computeExactFlags() {// can be made more efficient
+  computeExactFlags_temp(this, Real(ffVal.getValue()));
+}
+
+CGAL_INLINE_FUNCTION
+void ConstRealRep::computeExactFlags() {
+  computeExactFlags_temp(this, value);
+}
+
+CGAL_INLINE_FUNCTION
+void NegRep::computeExactFlags() {
+  if (!child->flagsComputed())
+    child->computeExactFlags();
+
+  if (child->sign() == 0) {
+    reduceToZero();
+    return;
+  }
+
+  if (get_static_rationalReduceFlag()) {
+    if (child->ratFlag()>0 && child->ratValue() != NULL) {
+      BigRat val = -(*(child->ratValue()));
+      reduceToBigRat(val);
+      ratFlag() = child->ratFlag()+1;
+      return;
+    } else
+      ratFlag() = -1;
+  }
+
+  sign() = -child->sign();
+  uMSB() = child->uMSB();
+  lMSB() = child->lMSB();
+
+  // length() = child->length();
+  measure() = child->measure();
+  u25() = child->u25();
+  l25() = child->l25();
+  v2p() = child->v2p();
+  v2m() = child->v2m();
+  v5p() = child->v5p();
+  v5m() = child->v5m();
+  high() = child->high();
+  low() = child->low();
+  lc()  = child->lc();
+  tc()  = child->tc();
+  flagsComputed() = true;
+}//NegRep::computeExactFlags
+
+CGAL_INLINE_FUNCTION
+void SqrtRep::computeExactFlags() {
+  if (!child->flagsComputed())
+    child->computeExactFlags();
+
+  if (get_static_rationalReduceFlag())
+    ratFlag() = -1;
+
+  sign() = child->sign();
+  if (sign() < 0)
+    core_error("squareroot is called with negative operand.",
+               __FILE__, __LINE__, true);
+
+  uMSB() = child->uMSB() / EXTLONG_TWO;
+  lMSB() = child->lMSB() / EXTLONG_TWO;
+
+  // length() = child->length();
+  measure() = child->measure();
+
+  // BFMSS[2,5] bound.
+  if (child->v2p() + ceilLg5(child->v5p()) + child->u25() >=
+      child->v2m() + ceilLg5(child->v5m()) + child->l25()) {
+    extLong vtilda2 = child->v2p() + child->v2m();
+    v2p() = vtilda2 / EXTLONG_TWO;
+    v2m() = child->v2m();
+    extLong vmod2;
+    if (v2p().isInfty())
+      vmod2 = CORE_INFTY;
+    else
+      vmod2 = vtilda2 - EXTLONG_TWO*v2p(); // == vtilda2 % 2
+    extLong vtilda5 = child->v5p() + child->v5m();
+    v5p() = vtilda5 / EXTLONG_TWO;
+    v5m() = child->v5m();
+    extLong vmod5;
+    if (v5p().isInfty())
+      vmod5 = CORE_INFTY;
+    else
+      vmod5 = vtilda5 - EXTLONG_TWO*v5p(); // == vtilda5 % 2
+    u25() = (child->u25() + child->l25() + vmod2 + ceilLg5(vmod5) + EXTLONG_ONE) / EXTLONG_TWO;
+    l25() = child->l25();
+  } else {
+    extLong vtilda2 = child->v2p() + child->v2m();
+    v2p() = child->v2p();
+    v2m() = vtilda2 / EXTLONG_TWO;
+    extLong vmod2;
+    if (v2m().isInfty())
+      vmod2 = CORE_INFTY;
+    else
+      vmod2 = vtilda2 - EXTLONG_TWO*v2m(); // == vtilda2 % 2
+    extLong vtilda5 = child->v5p() + child->v5m();
+    v5p() = child->v5p();
+    v5m() = vtilda5 / EXTLONG_TWO;
+    u25() = child->u25();
+    extLong vmod5;
+    if (v5m().isInfty())
+      vmod5 = CORE_INFTY;
+    else
+      vmod5 = vtilda5 - EXTLONG_TWO*v5m(); // == vtilda5 % 2
+    l25() = (child->u25() + child->l25() + vmod2 + ceilLg5(vmod5) + EXTLONG_ONE) / EXTLONG_TWO;
+  }
+
+  high() = (child->high() +EXTLONG_ONE)/EXTLONG_TWO;
+  low() = child->low() / EXTLONG_TWO;
+  lc() = child->lc();
+  tc() = child->tc();
+  flagsComputed() = true;
+}// SqrtRep::computeExactFlags
+
+CGAL_INLINE_FUNCTION
+void MultRep::computeExactFlags() {
+  if (!first->flagsComputed())
+    first->computeExactFlags();
+  if (!second->flagsComputed())
+    second->computeExactFlags();
+
+  if ((!first->sign()) || (!second->sign())) {
+    // value must be exactly zero.
+    reduceToZero();
+    return;
+  }
+  // rational node
+  if (get_static_rationalReduceFlag()) {
+    if (first->ratFlag() > 0 && second->ratFlag() > 0) {
+      BigRat val = (*(first->ratValue()))*(*(second->ratValue()));
+      reduceToBigRat(val);
+      ratFlag() = first->ratFlag() + second->ratFlag();
+      return;
+    } else
+      ratFlag() = -1;
+  }
+
+  // value is irrational.
+  uMSB() = first->uMSB() + second->uMSB() + EXTLONG_ONE;
+  lMSB() = first->lMSB() + second->lMSB();
+  sign() = first->sign() * second->sign();
+
+  extLong df = first->d_e();
+  extLong ds = second->d_e();
+  // extLong lf = first->length();
+  // extLong ls = second->length();
+
+  // length() = df * ls + ds * lf;
+  measure() = (first->measure()) * ds+(second->measure()) * df;
+
+  // BFMSS[2,5] bound.
+  v2p() = first->v2p() + second->v2p();
+  v2m() = first->v2m() + second->v2m();
+  v5p() = first->v5p() + second->v5p();
+  v5m() = first->v5m() + second->v5m();
+  u25() = first->u25() + second->u25();
+  l25() = first->l25() + second->l25();
+
+  high() = first->high() + second->high();
+  low() = first->low() + second->low();
+
+  lc() = ds * first->lc() + df * second->lc();
+  tc() = core_min(ds * first->tc() + df * second->tc(), measure());
+
+  flagsComputed() = true;
+}// MultRep::computeExactFlags
+
+CGAL_INLINE_FUNCTION
+void DivRep::computeExactFlags() {
+  if (!first->flagsComputed())
+    first->computeExactFlags();
+  if (!second->flagsComputed())
+    second->computeExactFlags();
+
+  if (!second->sign())
+    core_error("zero divisor.", __FILE__, __LINE__, true);
+
+  if (!first->sign()) {// value must be exactly zero.
+    reduceToZero();
+    return;
+  }
+
+  // rational node
+  if (get_static_rationalReduceFlag()) {
+    if (first->ratFlag() > 0 && second->ratFlag() > 0) {
+      BigRat val = (*(first->ratValue()))/(*(second->ratValue()));
+      reduceToBigRat(val);
+      ratFlag() = first->ratFlag() + second->ratFlag();
+      return;
+    } else
+      ratFlag() = -1;
+  }
+
+  // value is irrational.
+  uMSB() = first->uMSB() - second->lMSB();
+  lMSB() = first->lMSB() - second->uMSB() - EXTLONG_ONE;
+  sign() = first->sign() * second->sign();
+
+  extLong df = first->d_e();
+  extLong ds = second->d_e();
+  // extLong lf = first->length();
+  // extLong ls = second->length();
+
+  // length() = df * ls + ds * lf;
+  measure() = (first->measure())*ds + (second->measure())*df;
+
+  // BFMSS[2,5] bound.
+  v2p() = first->v2p() + second->v2m();
+  v2m() = first->v2m() + second->v2p();
+  v5p() = first->v5p() + second->v5m();
+  v5m() = first->v5m() + second->v5p();
+  u25() = first->u25() + second->l25();
+  l25() = first->l25() + second->u25();
+
+  high() = first->high() + second->low();
+  low() = first->low() + second->high();
+
+  lc() = ds * first->lc() + df * second->tc();
+  tc() = core_min(ds * first->tc() + df * second->lc(), measure());
+
+  flagsComputed() = true;
+}
+
+//
+//  approximation functions
+//
+CGAL_INLINE_FUNCTION
+void ConstDoubleRep::computeApproxValue(const extLong& /*relPrec*/,
+                                        const extLong& /*absPrec*/)
+// can ignore precision bounds since ffVal.getValue() returns exact value
+{
+  appValue() = Real(ffVal.getValue());
+}
+
+CGAL_INLINE_FUNCTION
+void ConstRealRep::computeApproxValue(const extLong& relPrec,
+                                      const extLong& absPrec) {
+  appValue() = value.approx(relPrec, absPrec);
+}
+
+CGAL_INLINE_FUNCTION
+void NegRep::computeApproxValue(const extLong& relPrec,
+                                const extLong& absPrec) {
+  appValue() = -child->getAppValue(relPrec, absPrec);
+}
+
+CGAL_INLINE_FUNCTION
+void SqrtRep::computeApproxValue(const extLong& relPrec,
+                                 const extLong& absPrec) {
+  extLong r = relPrec + relPrec + EXTLONG_EIGHT; // chenli: ???
+  extLong a = absPrec + absPrec + EXTLONG_EIGHT;
+  extLong pr = - lMSB() + r;
+  extLong p  = pr < a ? pr : a;
+
+  Real val = child->getAppValue(r, a);
+  if (get_static_incrementalEvalFlag()) {
+    if (appValue() == CORE_REAL_ZERO)
+      appValue() = val;
+    appValue() = val.sqrt(p, appValue().BigFloatValue());
+  } else
+    appValue() = val.sqrt(p);
+}
+
+CGAL_INLINE_FUNCTION
+void MultRep::computeApproxValue(const extLong& relPrec,
+                                 const extLong& absPrec) {
+  if (lMSB() < EXTLONG_BIG && lMSB() > EXTLONG_SMALL) {
+    extLong r   = relPrec + EXTLONG_FOUR;
+    extLong  afr = - first->lMSB() + EXTLONG_ONE;
+    extLong  afa = second->uMSB() + absPrec + EXTLONG_FIVE;
+    extLong  af  = afr > afa ? afr : afa;
+    extLong  asr = - second->lMSB() + EXTLONG_ONE;
+    extLong  asa = first->uMSB() + absPrec + EXTLONG_FIVE;
+    extLong  as  = asr > asa ? asr : asa;
+    appValue() = first->getAppValue(r, af)*second->getAppValue(r, as);
+  } else {
+    std::cerr << "lMSB = " << lMSB() << std::endl;
+    core_error("a huge lMSB in MulRep", __FILE__, __LINE__, false);
+  }
+}
+
+CGAL_INLINE_FUNCTION
+void DivRep::computeApproxValue(const extLong& relPrec,
+                                const extLong& absPrec) {
+  if (lMSB() < EXTLONG_BIG && lMSB() > EXTLONG_SMALL) {
+    extLong rr  = relPrec + EXTLONG_SEVEN;		// These rules come from
+    extLong ra  = uMSB() + absPrec + EXTLONG_EIGHT;	// Koji's Master Thesis, page 65
+    extLong ra2 = core_max(ra, EXTLONG_TWO);
+    extLong r   = core_min(rr, ra2);
+    extLong  af  = - first->lMSB() + r;
+    extLong  as  = - second->lMSB() + r;
+
+    extLong pr = relPrec + EXTLONG_SIX;
+    extLong pa = uMSB() + absPrec + EXTLONG_SEVEN;
+    extLong p  = core_min(pr, pa);	// Seems to be an error:
+    // p can be negative here!
+    // Also, this does not conform to
+    // Koji's thesis which has a default
+    // relative precision (p.65).
+
+    appValue() = first->getAppValue(r, af).div(second->getAppValue(r, as), p);
+  } else {
+    std::cerr << "lMSB = " << lMSB() << std::endl;
+    core_error("a huge lMSB in DivRep", __FILE__, __LINE__, false);
+  }
+}
+
+//
+// Debug Help Functions
+//
+CGAL_INLINE_FUNCTION
+void Expr::debug(int mode, int level, int depthLimit) const {
+  std::cout << "-------- Expr debug() -----------" << std::endl;
+  std::cout << "rep = " << rep << std::endl;
+  if (mode == Expr::LIST_MODE)
+    rep->debugList(level, depthLimit);
+  else if (mode == Expr::TREE_MODE)
+    rep->debugTree(level, 0, depthLimit);
+  else
+    core_error("unknown debugging mode", __FILE__, __LINE__, false);
+  std::cout << "---- End Expr debug(): " << std::endl;
+}
+
+
+CGAL_INLINE_FUNCTION
+const std::string ExprRep::dump(int level) const {
+  std::ostringstream ost;
+  if (level == OPERATOR_ONLY) {
+    ost << op();
+  } else if (level == VALUE_ONLY) {
+    ost << appValue();
+  } else if (level == OPERATOR_VALUE) {
+    ost << op() << "[val: " << appValue() << "]";
+  } else if (level == FULL_DUMP) {
+    ost << op()
+    << "[val: "  << appValue() << "; "
+    << "kp: " << knownPrecision() << "; "
+#ifdef CORE_DEBUG
+    << "r: " << relPrecision() << "; "
+    << "a: " << absPrecision() << "; "
+#endif
+    << "lMSB: " << lMSB() << "; "
+    << "uMSB: " << uMSB() << "; "
+    << "sign: " << sign() << "; "
+    // << "length: " << length() << "; "
+    << "measure: " << measure() << "; "
+    << "d_e: " << d_e() << "; "
+    << "u25: " << u25() << "; "
+    << "l25: " << l25() << "; "
+    << "v2p: " << v2p() << "; "
+    << "v2m: " << v2m() << "; "
+    << "v5p: " << v5p() << "; "
+    << "v5m: " << v5m() << "; "
+    << "high: " << high() << "; "
+    << "low: " << low() << "; "
+    << "lc: " << lc() << "; "
+    << "tc: " << tc()
+    << "]";
+  }
+  return std::string(ost.str());
+  // note that str() return an array not properly terminated!
+}
+
+
+CGAL_INLINE_FUNCTION
+void UnaryOpRep::debugList(int level, int depthLimit) const {
+  if (depthLimit <= 0)
+    return;
+  if (level == Expr::SIMPLE_LEVEL) {
+    std::cout << "(" << dump(OPERATOR_VALUE);
+    child->debugList(level, depthLimit - 1);
+    std::cout << ")";
+  } else if (level == Expr::DETAIL_LEVEL) {
+    std::cout << "(" << dump(FULL_DUMP);
+    child->debugList(level, depthLimit - 1);
+    std::cout << ")";
+  }
+}
+
+CGAL_INLINE_FUNCTION
+void UnaryOpRep::debugTree(int level, int indent, int depthLimit) const {
+  if (depthLimit <= 0)
+    return;
+  for (int i = 0; i<indent; i++ )
+    std::cout << "  ";
+  std::cout << "|_";
+  if (level == Expr::SIMPLE_LEVEL)
+    std::cout << dump(OPERATOR_VALUE);
+  else if (level == Expr::DETAIL_LEVEL)
+    std::cout << dump(FULL_DUMP);
+  std::cout << std::endl;
+  child->debugTree(level, indent + 2, depthLimit - 1);
+}
+
+CGAL_INLINE_FUNCTION
+void ConstRep::debugList(int level, int depthLimit) const {
+  if (depthLimit <= 0)
+    return;
+  if (level == Expr::SIMPLE_LEVEL) {
+    std::cout << "(" << dump(OPERATOR_VALUE) << ")";
+  } else if (level == Expr::DETAIL_LEVEL) {
+    std::cout << "(" << dump(FULL_DUMP) << ")";
+  }
+}
+
+CGAL_INLINE_FUNCTION
+void ConstRep::debugTree(int level, int indent, int depthLimit) const {
+  if (depthLimit <= 0)
+    return;
+  for (int i=0; i<indent; i++)
+    std::cout << "  ";
+  std::cout << "|_";
+  if (level == Expr::SIMPLE_LEVEL)
+    std::cout << dump(OPERATOR_VALUE);
+  else if (level == Expr::DETAIL_LEVEL)
+    std::cout << dump(FULL_DUMP);
+  std::cout << std::endl;
+}
+
+CGAL_INLINE_FUNCTION
+void BinOpRep::debugList(int level, int depthLimit) const {
+  if (depthLimit <= 0 )
+    return;
+  std::cout << "(";
+  if (level == Expr::SIMPLE_LEVEL) {
+    std::cout << dump(OPERATOR_VALUE);
+  } else if (level == Expr::DETAIL_LEVEL) {
+    std::cout << dump(FULL_DUMP);
+  }
+  first->debugList(level, depthLimit - 1);
+  std::cout << ", ";
+  second->debugList(level, depthLimit - 1);
+  std::cout << ")" ;
+}
+
+CGAL_INLINE_FUNCTION
+void BinOpRep::debugTree(int level, int indent, int depthLimit) const {
+  if (depthLimit <= 0)
+    return;
+  for (int i=0; i<indent; i++)
+    std::cout << "  ";
+  std::cout << "|_";
+  if (level == Expr::SIMPLE_LEVEL) {
+    std::cout << dump(OPERATOR_VALUE);
+  } else if (level == Expr::DETAIL_LEVEL) {
+    std::cout << dump(FULL_DUMP);
+  }
+  std::cout << std::endl;
+  first->debugTree(level, indent + 2, depthLimit - 1);
+  second->debugTree(level, indent + 2, depthLimit - 1);
+}
+
+CORE_MEMORY_IMPL(BigIntRep)
+CORE_MEMORY_IMPL(BigRatRep)
+CORE_MEMORY_IMPL(ConstDoubleRep)
+CORE_MEMORY_IMPL(ConstRealRep)
+
+CORE_MEMORY_IMPL(NegRep)
+CORE_MEMORY_IMPL(SqrtRep)
+
+CORE_MEMORY_IMPL(MultRep)
+CORE_MEMORY_IMPL(DivRep)
+
+template <typename O>
+void * AddSubRep<O>::operator new( size_t size)
+{ return MemoryPool<AddSubRep<O> >::global_allocator().allocate(size); }
+
+template <typename O>
+void AddSubRep<O>::operator delete( void *p, size_t )
+{ MemoryPool<AddSubRep<O> >::global_allocator().free(p); }
+
+
+
+template <class T>
+void * Realbase_for<T>::operator new( size_t size)
+{ return MemoryPool<Realbase_for<T> >::global_allocator().allocate(size); }
+
+template <class T>
+void Realbase_for<T>::operator delete( void *p, size_t )
+{ MemoryPool<Realbase_for<T> >::global_allocator().free(p); }
+
+ template class AddSubRep<Add>;
+ template class AddSubRep<Sub>;
+
+template class Realbase_for<long>;
+template class Realbase_for<double>;
+template class Realbase_for<BigInt>;
+template class Realbase_for<BigRat>;
+template class Realbase_for<BigFloat>;
+
+ template class ConstPolyRep<Expr>;
+ template class ConstPolyRep<BigFloat>;
+ template class ConstPolyRep<BigInt>;
+ template class ConstPolyRep<BigRat>;
+} //namespace CORE
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/Filter.h b/3rdparty/CGAL/include/CGAL/CORE/Filter.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/Filter.h
rename to 3rdparty/CGAL/include/CGAL/CORE/Filter.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/Gmp.h b/3rdparty/CGAL/include/CGAL/CORE/Gmp.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/Gmp.h
rename to 3rdparty/CGAL/include/CGAL/CORE/Gmp.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/Gmp_impl.h b/3rdparty/CGAL/include/CGAL/CORE/Gmp_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/Gmp_impl.h
rename to 3rdparty/CGAL/include/CGAL/CORE/Gmp_impl.h
diff --git a/3rdparty/CGAL/include/CGAL/CORE/Impl.h b/3rdparty/CGAL/include/CGAL/CORE/Impl.h
new file mode 100644
index 0000000..73bc8b1
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/CORE/Impl.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+ * Core Library Version 1.7, August 2004
+ * Copyright (c) 1995-2004 Exact Computation Project
+ * 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$
+ ***************************************************************************/
+
+#ifndef _CORE_IMPL_H_
+#define _CORE_IMPL_H_
+
+#include <CGAL/CORE/Config.h>
+
+// The following lines only for MS Visual C++
+#ifdef _MSC_VER
+  #pragma warning(disable: 4291) // no matching operator delete found
+  #pragma warning(disable: 4146) 
+  #pragma warning(disable: 4267)
+  #pragma warning(disable: 4244) 
+#endif
+
+// condition preprocessor for inline function
+#ifndef CORE_DISABLE_INLINE
+  #define CORE_INLINE inline
+#else
+  #define CORE_INLINE
+#endif
+
+#ifdef CGAL_HEADER_ONLY
+#define CGAL_INLINE_FUNCTION inline
+#else
+#define CGAL_INLINE_FUNCTION
+#endif
+
+// Macros for memory pool
+#ifdef CORE_DISABLE_MEMORY_POOL
+  #define CORE_NEW(T)
+  #define CORE_DELETE(T)
+  #define CORE_MEMORY_IMPL(T)
+#else
+  #include <CGAL/CORE/MemoryPool.h>
+  #define CORE_NEW(T)  void *operator new( size_t size);
+  #define CORE_DELETE(T)  void operator delete( void *p, size_t );
+
+  #define CORE_MEMORY_IMPL(T)                                            \
+    CGAL_INLINE_FUNCTION void *T::operator new( size_t size)             \
+    { return MemoryPool<T>::global_allocator().allocate(size); }         \
+    CGAL_INLINE_FUNCTION void T::operator delete( void *p, size_t )      \
+    { MemoryPool<T>::global_allocator().free(p); }
+#endif
+
+// include some common header files
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <cmath>
+#include <cfloat>
+#include <cassert>
+#include <cctype>
+#include <climits>
+#include <iostream>
+#include <iomanip>
+#include <sstream>
+#include <string>
+
+#endif // _CORE_IMPL_H_
diff --git a/3rdparty/CGAL/include/CGAL/CORE/MemoryPool.h b/3rdparty/CGAL/include/CGAL/CORE/MemoryPool.h
new file mode 100644
index 0000000..46b2cc9
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/CORE/MemoryPool.h
@@ -0,0 +1,138 @@
+/****************************************************************************
+ * Core Library Version 1.7, August 2004
+ * Copyright (c) 1995-2004 Exact Computation Project
+ * 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.
+ *
+ *
+ * File: MemoryPool.h
+ * Synopsis:
+ *      a memory pool template class.
+ * 
+ * Written by 
+ *       Zilin Du <zilin at cs.nyu.edu>
+ *       Chee Yap <yap at cs.nyu.edu>
+ *       Sylvain Pion <pion at cs.nyu.edu>
+ *
+ * WWW URL: http://cs.nyu.edu/exact/
+ * Email: exact at cs.nyu.edu
+ *
+ * $URL$
+ * $Id$
+ ***************************************************************************/
+#ifndef _CORE_MEMORYPOOL_H_
+#define _CORE_MEMORYPOOL_H_
+
+#include <new>           // for placement new
+#include <cassert>
+#include <CGAL/assertions.h>
+#include <vector>
+
+namespace CORE { 
+
+#define CORE_EXPANSION_SIZE 1024
+template< class T, int nObjects = CORE_EXPANSION_SIZE >
+class MemoryPool {
+private:
+   struct Thunk {
+      T object;
+      Thunk* next;
+   };
+
+public:
+   MemoryPool() : head( 0 ) {}
+
+  ~MemoryPool()
+  {
+    //CGAL_warning_code(
+      std::size_t count = 0;
+      Thunk* t = head;
+      while(t!=0){
+	++count;
+	t = t->next;
+      }
+    //);
+    //CGAL_warning_msg(count ==  nObjects * blocks.size(),
+    //                 "Cannot delete memory as there are cyclic references");
+
+    if(count ==  nObjects * blocks.size()){
+      for(std::size_t i=0; i < blocks.size();i++){
+        ::operator delete(blocks[i]);
+      }
+    }
+  }
+
+
+   void* allocate(std::size_t size);
+   void free(void* p);
+
+  // Access the corresponding static global allocator.
+  static MemoryPool<T>& global_allocator() {
+    return memPool;
+  }
+ 
+private:
+   Thunk* head; // next available block in the pool
+  std::vector<void*> blocks;
+
+private:
+  // Static global allocator.
+  static MemoryPool<T, nObjects> memPool;   
+};
+
+template <class T, int nObjects >
+MemoryPool<T, nObjects> MemoryPool<T, nObjects>::memPool;
+
+template< class T, int nObjects >
+void* MemoryPool< T, nObjects >::allocate(std::size_t) {
+   if ( head == 0 ) { // if no more memory in the pool
+      const int last = nObjects - 1;
+
+      // use the global operator new to allocate a block for the pool
+      Thunk* pool = reinterpret_cast<Thunk*>(
+	 ::operator new(nObjects * sizeof(Thunk)));
+
+      blocks.push_back(pool);
+      // initialize the chain (one-directional linked list)
+      head = pool;
+      for (int i = 0; i < last; ++i ) {
+	 pool[i].next = &pool[i+1];
+      }
+      pool[last].next = 0;
+   }
+
+   // set head to point to the next object in the list
+   Thunk* currentThunk = head;
+   head = currentThunk->next;
+
+   return currentThunk;
+}
+
+template< class T, int nObjects >
+void MemoryPool< T, nObjects >::free(void* t) {
+   CGAL_assertion(t != 0);     
+   if (t == 0) return; // for safety
+   if(blocks.empty()){
+     std::cerr << typeid(T).name() << std::endl;
+   }
+   CGAL_assertion (! blocks.empty());
+
+   // recycle the object memory, by putting it back into the chain
+   reinterpret_cast<Thunk*>(t)->next = head;
+   head = reinterpret_cast<Thunk*>(t);
+}
+
+} //namespace CORE
+
+#endif // _CORE_MEMORYPOOL_H_
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/Promote.h b/3rdparty/CGAL/include/CGAL/CORE/Promote.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/Promote.h
rename to 3rdparty/CGAL/include/CGAL/CORE/Promote.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/Real.h b/3rdparty/CGAL/include/CGAL/CORE/Real.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/Real.h
rename to 3rdparty/CGAL/include/CGAL/CORE/Real.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/RealRep.h b/3rdparty/CGAL/include/CGAL/CORE/RealRep.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/RealRep.h
rename to 3rdparty/CGAL/include/CGAL/CORE/RealRep.h
diff --git a/3rdparty/CGAL/include/CGAL/CORE/Real_impl.h b/3rdparty/CGAL/include/CGAL/CORE/Real_impl.h
new file mode 100644
index 0000000..dc00516
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/CORE/Real_impl.h
@@ -0,0 +1,292 @@
+/****************************************************************************
+ * Core Library Version 1.7, August 2004
+ * Copyright (c) 1995-2004 Exact Computation Project
+ * 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.
+ *
+ *
+ * File: Real.cpp
+ * Synopsis: The Real class is a superclass for all the number 
+ *           systems in the Core Library (int, long, float, double,
+ *           BigInt, BigRat, BigFloat, etc)
+ *           
+ * Written by 
+ *       Koji Ouchi <ouchi at simulation.nyu.edu>
+ *       Chee Yap <yap at cs.nyu.edu>
+ *       Chen Li <chenli at cs.nyu.edu>
+ *       Zilin Du <zilin at cs.nyu.edu>
+ *       Sylvain Pion <pion at cs.nyu.edu> 
+ *
+ * WWW URL: http://cs.nyu.edu/exact/
+ * Email: exact at cs.nyu.edu
+ *
+ * $URL$
+ * $Id$
+ ***************************************************************************/
+
+#ifdef CGAL_HEADER_ONLY
+#define CGAL_INLINE_FUNCTION inline
+#else
+#define CGAL_INLINE_FUNCTION
+#endif
+
+#include <ctype.h>
+#include <CGAL/CORE/Real.h>
+
+#ifdef CGAL_HEADER_ONLY
+#include <CGAL/CORE/BigFloat.h> // for FiveTo
+#endif
+
+namespace CORE { 
+
+CGAL_INLINE_FUNCTION
+const Real& Real::getZero() {
+  static Real Zero(0);
+  return Zero;
+}
+
+CGAL_INLINE_FUNCTION
+BigInt floor(const Real& r, Real &sub) {
+  BigInt f = r.approx(CORE_INFTY, 2).BigIntValue();
+  sub = r-f;
+  // Adjustment
+  if (sub<0)
+    ++sub, --f;
+  if (sub>=1)
+    --sub, ++f;
+  CGAL_assertion(sub >=0 && sub<1);
+  return f;
+}
+
+// pow(r,n) and power(r, n) are the same function
+//
+CGAL_INLINE_FUNCTION
+Real pow(const Real& r, unsigned long n) {
+  if (n == 0)
+    return Real(1);
+  else if (n == 1)
+    return r;
+  else {
+    Real x = r;
+    while ((n % 2) == 0) { // n is even
+      x *= x;
+      n >>= 1;
+    }
+    Real u = x;
+    while (true) {
+      n >>= 1;
+      if (n == 0)
+        return u;
+      x *= x;
+      if ((n % 2) == 1) // n is odd
+        u *= x;
+    }
+    //return u; // unreachable
+  }
+}//pow
+
+extern BigInt FiveTo(unsigned long exp);
+
+// Construct Real from String
+// Note:
+// 	-- Zilin Du: 06/03/2003
+// 	-- Original it is the code for Real's constructor for "const char*".
+// 	   I change it to a function so that two constrcutors can share the code.
+// 	   now it is private and no default value.
+//
+//   --Default value of the argument "prec" is get_static_defInputDigits()
+//   --If prec is CORE_posInfty, then the input is
+//	read in exactly.  Otherwise, we convert to a RealBigFloat
+//	with absolute error at most 10^{-prec}
+
+// Constructor Real( char *str, extLong& prec)
+//	is very similar to
+//		BigFloatRep::fromString( char *str, extLong& prec);
+// Differences:
+//	In BigFloat(str, prec), the value of prec cannot be infinity, and
+//		it defaults to defBigFloatInputDigits;
+//	In Real(str, prec), the value of prec is allowed to be infinity, and
+//		it defaults to defInputDigits.
+//
+// Why do we have the two versions?  It allows us to use the BigFloat class
+//	directly, without relying on Real class.
+
+CGAL_INLINE_FUNCTION
+void Real::constructFromString(const char *str, const extLong& prec )
+// NOTE: prec defaults to get_static_defInputDigits() (see Real.h)
+{
+  //	8/8/01, Chee and Zilin: add a new rational string format:
+  //		this format is indicated by the presence of a slash "/"
+  //		Moreover, the value of prec is ignored (basically
+  //		assumed to be infinity).
+
+  if (std::strchr(str, '/') != NULL) {	// this is a rational number
+    rep = new RealBigRat(BigRat(str));
+    return;
+  }
+
+  const char *e = std::strchr(str, 'e');
+  int dot = 0;
+  long e10 = 0;
+  if (e != NULL)
+    e10 = std::atol(e+1);	// e10 is decimal precision of the input string
+  // i.e., input is A/10^{e10}.
+  else {
+    e = str + std::strlen(str);
+#ifdef CORE_DEBUG
+    CGAL_assertion(*e == '\0');
+#endif
+  }
+
+  const char *p = str;
+  if (*p == '-' || *p == '+')
+    p++;
+  BigInt m(0);
+
+  for (; p < e; p++) {
+    if (*p == '.') {
+      dot = 1;
+      continue;
+    }
+    m = m * 10 + (*p - '0');
+    if (dot)
+      e10--;
+  }
+
+  long t = (e10 < 0) ? -e10 : e10;
+  BigInt one(1);
+  BigInt ten = FiveTo(t) * (one << static_cast<unsigned long>(t));
+  if (*str == '-')
+    m = -m;
+  if (e10 >= 0) {
+    // convert exactly from integer numbers
+    m *= ten;
+    rep = new RealBigInt(m);
+  } else { // e10 < 0,  fractional numbers
+    // HERE IS WHERE WE USE THE SYSTEM CONSTANT
+    //	       get_static_defInputDigits()
+    // Note: get_static_defInputDigits() should be at least log_2(10).
+    //       We default get_static_defInputDigits() to 4.
+    //std::cout << "(m,ten)=" << m << "," << ten << std::endl;
+    BigRat r(m, ten);
+    if (prec.isInfty()) { // convert exactly! to a big rational
+      rep = new RealBigRat(r);
+    } else {
+      // convert approximately, to a BigFloat within the
+      // specified precision:
+      // BigFloat bf(r, CORE_posInfty, prec * lgTenM) ;
+      BigFloat bf(r, CORE_posInfty, prec * 4) ;
+      rep = new RealBigFloat(bf);
+    }
+  }
+}// Real(str, prec)
+
+// The operator >>(i,x) calls the constructor Real(char*)
+CGAL_INLINE_FUNCTION
+std::istream& operator >>(std::istream& i, Real& x) {
+  int size = 20;
+  char *str = new char[size];
+  char *p = str;
+  char c;
+  int d = 0, e = 0, s = 0;
+  //  int done = 0;
+
+  // Chen Li: fixed a bug, the original statement is
+  //  for (i.get(c); c == ' '; i.get(c));
+  // use isspace instead of testing c == ' ', since it must also
+  // skip tab, catridge/return, etc.
+  // Change to:
+  //  int status;
+  do {
+    i.get(c);
+  } while (!i.eof() && isspace(c)); /* loop if met end-of-file, or
+  			   char read in is white-space. */
+  // Chen Li,
+  // original "if (c == EOF) ..." is unsafe since c is of char type and
+  // EOF is of int tyep with a negative value -1
+
+  if (i.eof()) {
+    i.clear(std::ios::eofbit | std::ios::failbit);
+    delete [] str;
+    return i;
+  }
+
+  // the current content in "c" should be the first non-whitespace char
+  if (c == '-' || c == '+') {
+    *p++ = c;
+    i.get(c);
+  }
+
+  for (; isdigit(c) || (!d && c=='.') ||
+       (!e && c=='e') || (!s && (c=='-' || c=='+')); i.get(c)) {
+    if (!i) break;
+    if (!e && (c == '-' || c == '+'))
+      break;
+    // Chen Li: put one more rule to prohibite input like
+    //  xxxx.xxxe+xxx.xxx:
+    if (e && (c == '.'))
+      break;
+    if (p - str == size) {
+      char *t = str;
+      str = new char[size*2];
+      std::memcpy(str, t, size);
+      delete [] t;
+      p = str + size;
+      size *= 2;
+    }
+#ifdef CORE_DEBUG
+    CGAL_assertion((p-str) < size);
+#endif
+
+    *p++ = c;
+    if (c == '.')
+      d = 1;
+    // Chen Li: fix a bug -- the sign of exponent can not happen before
+    // the character "e" appears! It must follow the "e' actually.
+    //    if (e || c == '-' || c == '+') s = 1;
+    if (e)
+      s = 1;
+    if (c == 'e')
+      e = 1;
+  }
+
+  if (!i && !i.eof()) {
+    delete [] str;
+    return i;
+  }
+  // chenli: make sure that the p is still in the range
+  if (p - str >= size) {
+    int len = p - str;
+    char *t = str;
+    str = new char[len + 1];
+    std::memcpy(str, t, len);
+    delete [] t;
+    p = str + len;
+  }
+
+#ifdef CORE_DEBUG
+  CGAL_assertion(p - str < size);
+#endif
+
+  *p = '\0';
+  i.putback(c);
+  i.clear();
+  // old: x = Real(str, i.precision()); // use precision of input stream.
+  x = Real(str);  // default precision = get_static_defInputDigits()
+  delete [] str;
+  return i;
+}//operator >> (std::istream&, Real&)
+
+
+} //namespace CORE
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/RefCount.h b/3rdparty/CGAL/include/CGAL/CORE/RefCount.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/RefCount.h
rename to 3rdparty/CGAL/include/CGAL/CORE/RefCount.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/Timer.h b/3rdparty/CGAL/include/CGAL/CORE/Timer.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/Timer.h
rename to 3rdparty/CGAL/include/CGAL/CORE/Timer.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/extLong.h b/3rdparty/CGAL/include/CGAL/CORE/extLong.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/extLong.h
rename to 3rdparty/CGAL/include/CGAL/CORE/extLong.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/extLong_impl.h b/3rdparty/CGAL/include/CGAL/CORE/extLong_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/extLong_impl.h
rename to 3rdparty/CGAL/include/CGAL/CORE/extLong_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/geom2d/circle2d.h b/3rdparty/CGAL/include/CGAL/CORE/geom2d/circle2d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/geom2d/circle2d.h
rename to 3rdparty/CGAL/include/CGAL/CORE/geom2d/circle2d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/geom2d/line2d.h b/3rdparty/CGAL/include/CGAL/CORE/geom2d/line2d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/geom2d/line2d.h
rename to 3rdparty/CGAL/include/CGAL/CORE/geom2d/line2d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/geom2d/point2d.h b/3rdparty/CGAL/include/CGAL/CORE/geom2d/point2d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/geom2d/point2d.h
rename to 3rdparty/CGAL/include/CGAL/CORE/geom2d/point2d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/geom2d/segment2d.h b/3rdparty/CGAL/include/CGAL/CORE/geom2d/segment2d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/geom2d/segment2d.h
rename to 3rdparty/CGAL/include/CGAL/CORE/geom2d/segment2d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/geom3d/line3d.h b/3rdparty/CGAL/include/CGAL/CORE/geom3d/line3d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/geom3d/line3d.h
rename to 3rdparty/CGAL/include/CGAL/CORE/geom3d/line3d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/geom3d/plane3d.h b/3rdparty/CGAL/include/CGAL/CORE/geom3d/plane3d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/geom3d/plane3d.h
rename to 3rdparty/CGAL/include/CGAL/CORE/geom3d/plane3d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/geom3d/point3d.h b/3rdparty/CGAL/include/CGAL/CORE/geom3d/point3d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/geom3d/point3d.h
rename to 3rdparty/CGAL/include/CGAL/CORE/geom3d/point3d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/geom3d/polygon3d.h b/3rdparty/CGAL/include/CGAL/CORE/geom3d/polygon3d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/geom3d/polygon3d.h
rename to 3rdparty/CGAL/include/CGAL/CORE/geom3d/polygon3d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/geom3d/segment3d.h b/3rdparty/CGAL/include/CGAL/CORE/geom3d/segment3d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/geom3d/segment3d.h
rename to 3rdparty/CGAL/include/CGAL/CORE/geom3d/segment3d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/geom3d/triangle3d.h b/3rdparty/CGAL/include/CGAL/CORE/geom3d/triangle3d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/geom3d/triangle3d.h
rename to 3rdparty/CGAL/include/CGAL/CORE/geom3d/triangle3d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/geombase.h b/3rdparty/CGAL/include/CGAL/CORE/geombase.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/geombase.h
rename to 3rdparty/CGAL/include/CGAL/CORE/geombase.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/geometry2d.h b/3rdparty/CGAL/include/CGAL/CORE/geometry2d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/geometry2d.h
rename to 3rdparty/CGAL/include/CGAL/CORE/geometry2d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/geometry3d.h b/3rdparty/CGAL/include/CGAL/CORE/geometry3d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/geometry3d.h
rename to 3rdparty/CGAL/include/CGAL/CORE/geometry3d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/linearAlgebra.h b/3rdparty/CGAL/include/CGAL/CORE/linearAlgebra.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/linearAlgebra.h
rename to 3rdparty/CGAL/include/CGAL/CORE/linearAlgebra.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/poly/Curves.h b/3rdparty/CGAL/include/CGAL/CORE/poly/Curves.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/poly/Curves.h
rename to 3rdparty/CGAL/include/CGAL/CORE/poly/Curves.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/poly/Curves.tcc b/3rdparty/CGAL/include/CGAL/CORE/poly/Curves.tcc
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/poly/Curves.tcc
rename to 3rdparty/CGAL/include/CGAL/CORE/poly/Curves.tcc
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/poly/Poly.h b/3rdparty/CGAL/include/CGAL/CORE/poly/Poly.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/poly/Poly.h
rename to 3rdparty/CGAL/include/CGAL/CORE/poly/Poly.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/poly/Poly.tcc b/3rdparty/CGAL/include/CGAL/CORE/poly/Poly.tcc
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/poly/Poly.tcc
rename to 3rdparty/CGAL/include/CGAL/CORE/poly/Poly.tcc
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE/poly/Sturm.h b/3rdparty/CGAL/include/CGAL/CORE/poly/Sturm.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE/poly/Sturm.h
rename to 3rdparty/CGAL/include/CGAL/CORE/poly/Sturm.h
diff --git a/3rdparty/CGAL/include/CGAL/CORE_BigFloat.h b/3rdparty/CGAL/include/CGAL/CORE_BigFloat.h
new file mode 100644
index 0000000..09302bc
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/CORE_BigFloat.h
@@ -0,0 +1,551 @@
+// Copyright (c) 2006-2008 Max-Planck-Institute Saarbruecken (Germany).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Michael Hemmer   <hemmer at mpi-inf.mpg.de>
+//============================================================================
+
+#ifndef CGAL_CORE_BIGFLOAT_H
+#define CGAL_CORE_BIGFLOAT_H
+
+#include <CGAL/basic.h>
+#include <CGAL/number_type_basic.h>
+#include <CGAL/CORE/BigFloat.h>
+#include <CGAL/CORE_coercion_traits.h>
+#include <CGAL/Interval_traits.h> 
+#include <CGAL/Bigfloat_interval_traits.h> 
+
+namespace CGAL {
+
+// ######### Interval_traits 
+
+template<> 
+class Interval_traits<CORE::BigFloat> 
+    : public internal::Interval_traits_base<CORE::BigFloat>{
+    typedef CORE::BigFloat Interval;
+public: 
+    typedef Interval_traits<CORE::BigFloat> Self; 
+    typedef CORE::BigFloat Type;
+    typedef CORE::BigFloat Bound;
+    typedef CGAL::Tag_true Is_interval; 
+    typedef CGAL::Tag_true Is_bigfloat_interval; 
+  
+ 
+    struct Lower :public std::unary_function<Interval,Bound>{
+        Bound operator() ( Interval x ) const {   
+            CORE::BigFloat result = ::CORE::BigFloat(x.m()-x.err(),0,x.exp());
+            CGAL_postcondition(result <= x);
+            return result; 
+        }
+    };
+    
+    struct Upper :public std::unary_function<Interval,Bound>{
+        Bound operator() ( Interval x ) const {     
+            CORE::BigFloat result = ::CORE::BigFloat(x.m()+x.err(),0,x.exp());
+            CGAL_postcondition(result >= x);
+            return result; 
+        }
+    };
+
+    struct Width :public std::unary_function<Interval,Bound>{
+         
+        Bound operator() ( Interval x ) const {    
+            unsigned long err = 2*x.err();
+            return Bound(CORE::BigInt(err),0,x.exp());
+        }
+    };
+
+    struct Median :public std::unary_function<Interval,Bound>{
+         
+        Bound operator() ( Interval x ) const {   
+            return Bound(x.m(),0,x.exp());
+        }
+    };
+
+    struct Norm :public std::unary_function<Interval,Bound>{
+        Bound operator() ( Interval x ) const {
+          BOOST_USING_STD_MAX();
+          return max BOOST_PREVENT_MACRO_SUBSTITUTION (Upper()(x).abs(),Lower()(x).abs());
+        }
+    };
+    
+    struct Zero_in :public std::unary_function<Interval,bool>{
+        bool operator() ( Interval x ) const {      
+            return x.isZeroIn(); 
+        }
+    };
+
+    struct In :public std::binary_function<Bound,Interval,bool>{  
+        bool operator()( Bound x, const Interval& a ) const {    
+            CGAL_precondition(CGAL::singleton(x));
+            return (Lower()(a) <= x && x <= Upper()(a));
+        }
+    };
+
+    struct Equal :public std::binary_function<Interval,Interval,bool>{  
+        bool operator()( const Interval& a, const Interval& b ) const { 
+            return (Upper()(a) == Upper()(b) &&  Lower()(a) == Lower()(b));
+        }
+    };
+    
+    struct Subset :public std::binary_function<Interval,Interval,bool>{  
+        bool operator()( const Interval& a, const Interval& b ) const {   
+            return Lower()(b) <= Lower()(a) && Upper()(a) <= Upper()(b);
+        }
+    };
+    
+    struct Proper_subset :public std::binary_function<Interval,Interval,bool>{ 
+        bool operator()( const Interval& a, const Interval& b ) const { 
+            return Subset()(a,b) && (!Equal()(a,b));
+        }
+    };
+    
+    struct Intersection :public std::binary_function<Interval,Interval,Interval>{ 
+      Interval operator()( const Interval& a, const Interval& b ) const {
+            BOOST_USING_STD_MAX();
+            BOOST_USING_STD_MIN();
+            // std::cout <<"a= (" << a.m() << "+-" << a.err() << ")*2^" << a.exp() << std::endl;
+            Bound l(max BOOST_PREVENT_MACRO_SUBSTITUTION (Lower()(a),Lower()(b)));
+            Bound u(min BOOST_PREVENT_MACRO_SUBSTITUTION (Upper()(a),Upper()(b)));
+
+            if(u < l ) throw Exception_intersection_is_empty();
+            return Construct()(l,u);
+        }
+    };
+ 
+
+    struct Overlap :public std::binary_function<Interval,Interval,bool>{
+        bool operator() ( Interval x, Interval y ) const {       
+            Self::Zero_in Zero_in;
+            bool result = Zero_in(x-y);
+            return result;
+        }
+    };
+   
+    struct Hull :public std::binary_function<Interval,Interval,Interval>{
+
+      // for debugging
+/*      void print_bf(CORE::BigFloat bf, std::string s) const {
+        
+        std::cout << s << ".m()=" << bf.m() << ","
+                  << s << ".err()=" << bf.err() << ","
+                  << s << ".exp()=" << bf.exp() << ","
+                  << "td=" << bf << std::endl;
+      }
+*/
+
+        Interval operator() ( Interval x, Interval y ) const {
+            BOOST_USING_STD_MAX();
+            BOOST_USING_STD_MIN();
+#if 0
+            // this is not possible since CORE::centerize has a bug.
+            Interval result = CORE::centerize(x,y);
+#else 
+
+            //print_bf(x,"x");
+            //print_bf(y,"y");
+            
+             CORE::BigFloat result;
+             
+            // Unfortunately, CORE::centerize(x,y) has bugs. 
+            if ((x.m() == y.m()) && (x.err() == y.err()) && (x.exp() == y.exp())) { 
+                return x;
+            }
+                         
+            CORE::BigFloat lower = min BOOST_PREVENT_MACRO_SUBSTITUTION (CGAL::lower(x), CGAL::lower(y));
+            CORE::BigFloat upper = max BOOST_PREVENT_MACRO_SUBSTITUTION (CGAL::upper(x), CGAL::upper(y));
+
+            CORE::BigFloat mid = (lower + upper)/2;
+             
+            //print_bf(lower,"lower");
+            //print_bf(upper,"upper");
+            //print_bf(mid,"mid");
+
+            // Now we have to compute the error. The problem is that .err() is just a long
+            CORE::BigFloat err = (upper - lower)/CORE::BigFloat(2);
+                   
+            //print_bf(err,"err");
+
+            //std::cout << "lower    " << lower << std::endl;
+            //std::cout << "upper    " << upper << std::endl;
+            //std::cout << "mid      " << mid << std::endl;
+            //std::cout << "err I    " << err << std::endl;
+            
+            // shift such that err.m()+err.err() fits into long 
+            int digits_long = std::numeric_limits<long>::digits;
+            if(::CORE::bitLength(err.m()+err.err()) >= digits_long){
+                long shift = ::CORE::bitLength(err.m()) - digits_long + 1 ; 
+                //std::cout << "shift " << shift<< std::endl;
+                long new_err = ((err.m()+err.err()) >> shift).longValue()+1; 
+                err = CORE::BigFloat(0,new_err,0) * CORE::BigFloat::exp2(err.exp()*CORE::CHUNK_BIT+shift);
+            }else{           
+                err = CORE::BigFloat(0,err.m().longValue()+err.err(),err.exp());
+            }
+            //print_bf(err,"new_err");
+
+            // TODO: This is a workaround for a bug in operator+ 
+            // of CORE::Bigfloat. If the exponent difference is too big,
+            // this might cause problems, since the error is a long
+            if(mid.exp() > err.exp()) {
+                long mid_err = mid.err();
+                CORE::BigInt mid_m = mid.m();
+                mid_err = mid_err << (mid.exp()-err.exp())*CORE::CHUNK_BIT;
+                mid_m = mid_m << (mid.exp()-err.exp())*CORE::CHUNK_BIT;
+                mid = CORE::BigFloat(mid_m,mid_err,err.exp());
+                //print_bf(mid,"corr_mid");
+            }
+            
+            //print_bf(result,"result");        
+
+            result = mid + err;  
+             
+#endif 
+
+            CGAL_postcondition( 
+                    CGAL::lower(result) 
+                    <=  min BOOST_PREVENT_MACRO_SUBSTITUTION (CGAL::lower(x), CGAL::lower(y)));
+            CGAL_postcondition( 
+                    CGAL::upper(result) 
+                    >= max BOOST_PREVENT_MACRO_SUBSTITUTION (CGAL::upper(x), CGAL::upper(y)));
+
+            
+
+            return result ;
+        }
+    };
+
+    struct Singleton :public std::unary_function<Interval,bool> {
+        bool operator() ( Interval x ) const {       
+            return (x.err() == 0); 
+        }
+    };
+
+    struct Construct :public std::binary_function<Bound,Bound,Interval>{
+        Interval operator()( const Bound& l,const Bound& r) const {
+            CGAL_precondition( l < r ); 
+            return Hull()(l,r);
+        }
+    };
+};
+
+
+// ########### Bigfloat_interval_traits 
+
+
+// template<typename BFI> long relative_precision(BFI bfi);
+namespace internal{
+
+CORE::BigFloat 
+inline 
+round(const CORE::BigFloat& x, long rel_prec = CORE::get_static_defRelPrec().toLong() ){
+    CGAL_postcondition(rel_prec >= 0);   
+
+    // since there is not rel prec defined if Zero_in(x)
+    if (x.isZeroIn()) return x; 
+    // if (CGAL::get_significant_bits(x) <= rel_prec) return x;
+   
+// if 1 
+//    CORE::BigFloat xr;
+//    xr.approx(x,rel_prec,1024);
+//    typedef CORE::BigFloat BF; 
+// else       
+    typedef CORE::BigFloat BF; 
+    BF xr;
+   
+    CORE::BigInt m = x.m();
+    long         err = x.err();
+    long         exp = x.exp(); 
+   
+
+//    std::cout <<"(" << m << "+-" <<err << ")*2^"<<(CORE::CHUNK_BIT*exp) << std::endl; 
+//    if (err != 0) 
+//      std::cout <<"current prec: " <<  CGAL::relative_precision(x) << std::endl;
+//    else 
+//      std::cout <<"current prec: " << " SINGLETON " << std::endl;
+//    std::cout <<"desired prec: " << rel_prec << std::endl; 
+//    std::cout <<"bitLength: " << CORE::bitLength(m) << std::endl; 
+//    long shift = ::CORE::bitLength(m) - rel_prec - 1;
+   
+    long shift ;
+    if (err == 0)
+      shift = ::CORE::bitLength(m) - rel_prec - 3;
+    else      
+      shift = CGAL::relative_precision(x) - rel_prec -1; 
+    
+    if( shift > 0 ){    
+      m   >>= shift ; 
+      err >>= shift; 
+      xr = BF(m,err+1,0)*BF::exp2(exp*CORE::CHUNK_BIT+shift);     
+    }else{    // noting to do
+        xr = x; 
+    }
+
+//    std::cout <<"(" <<m << "+-" <<err+1 << ")*2^"<<(CORE::CHUNK_BIT*exp) << std::endl; 
+//    if (xr.err() != 0) 
+//      std::cout <<"current prec: " <<  CGAL::relative_precision(xr) << std::endl;
+//    else 
+//      std::cout <<"current prec: " << " SINGLETON "<< std::endl;
+//    std::cout <<"desired prec: " << rel_prec << std::endl; 
+    
+// endif     
+    CGAL_postcondition(singleton(xr) || CGAL::relative_precision(xr) - rel_prec >= 0); 
+    CGAL_postcondition(singleton(xr) || CGAL::relative_precision(xr) - rel_prec <= 32);   
+    CGAL_postcondition(BF(xr.m()-xr.err(),0,xr.exp()) <= BF(x.m()-x.err(),0,x.exp()));
+    CGAL_postcondition(BF(xr.m()+xr.err(),0,xr.exp()) >= BF(x.m()+x.err(),0,x.exp()));
+    return xr;     
+}
+}
+
+template<> class Bigfloat_interval_traits<CORE::BigFloat> 
+:public Interval_traits<CORE::BigFloat>
+{
+
+    typedef CORE::BigFloat NT;
+    typedef CORE::BigFloat BF;
+public:
+  typedef Bigfloat_interval_traits<NT> Self;
+  
+   struct Relative_precision {
+        // type for the \c AdaptableUnaryFunction concept.
+        typedef NT  argument_type;
+        // type for the \c AdaptableUnaryFunction concept.
+        typedef long  result_type;
+
+        long operator()( NT x) const { 
+          CGAL_precondition(!Singleton()(x));
+          CGAL_precondition(!CGAL::zero_in(x));
+          
+          x = x.abs();
+          NT w = Width()(x);
+          w /= ::CORE::BigFloat(x.m()-x.err(),0,x.exp());    
+          w = w.abs();
+          return -(CORE::ceilLg(w.m()+w.err())+w.exp()*CORE::CHUNK_BIT);
+        }
+    };
+       
+    struct Set_precision {
+        // type for the \c AdaptableUnaryFunction concept.
+        typedef long  argument_type;
+        // type for the \c AdaptableUnaryFunction concept.
+        typedef long  result_type;  
+     
+        long operator() ( long prec ) const {    
+            long result =  ::CORE::get_static_defRelPrec().toLong();
+            ::CORE::get_static_defRelPrec() = prec; 
+            ::CORE::get_static_defBFdivRelPrec() = prec;
+            return result; 
+        }
+    };
+     
+    struct Get_precision {
+        // type for the \c AdaptableGenerator concept.
+        typedef long  result_type;  
+     
+        long operator() () const {
+            return  ::CORE::get_static_defRelPrec().toLong(); 
+        }
+    };
+};
+
+
+
+
+//
+// Algebraic structure traits
+//
+template <> class Algebraic_structure_traits< CORE::BigFloat >
+  : public Algebraic_structure_traits_base< CORE::BigFloat,
+                                            Field_with_kth_root_tag >  {
+  public:
+    typedef Tag_false          Is_exact;
+    typedef Tag_true           Is_numerical_sensitive;
+
+    class Sqrt
+      : public std::unary_function< Type, Type > {
+      public:
+        Type operator()( const Type& x ) const {
+            // What I want is a sqrt computed with 
+            // ::CORE::get_static_defRelPrec() bits.
+            // And not ::CORE::defBFsqrtAbsPrec as CORE does. 
+            
+            CGAL_precondition(::CORE::get_static_defRelPrec().toLong() > 0);
+            CGAL_precondition(x > 0);
+            
+            Type a = CGAL::internal::round(
+              x, ::CORE::get_static_defRelPrec().toLong()*2);
+            CGAL_postcondition(a > 0); 
+
+            Type tmp1 = CORE::BigFloat(
+                a.m(),0,0).sqrt(::CORE::get_static_defRelPrec().toLong());
+            Type err  =  
+                Type(0,long(std::sqrt(double(a.err()))),0) 
+                * CORE::BigFloat::exp2(a.exp()*7);
+            Type result = tmp1*CORE::BigFloat::exp2(a.exp()*7) + err;
+           
+            CGAL_postcondition(result >= 0);
+            CGAL_postcondition(CGAL::lower(result*result) <= CGAL::lower(x));
+            CGAL_postcondition(CGAL::upper(result*result) >= CGAL::upper(x));
+
+            return result;
+        }
+    };
+
+    class Kth_root
+      : public std::binary_function<int, Type, Type> {
+      public:
+        Type operator()( int k,
+                                        const Type& x) const {
+            CGAL_precondition_msg( k > 0, "'k' must be positive for k-th roots");
+            // CORE::radical isn't implemented for negative values of x, so we
+            //  have to handle this case separately
+            if( x < 0 && k%2 != 0) {
+              return Type(-CORE::radical( -x, k ) );
+            }
+
+            return Type( CORE::radical( x, k ) );
+        }
+    };
+};
+
+//
+// Real embeddable traits
+//
+template <> class Real_embeddable_traits< CORE::BigFloat >
+  : public INTERN_RET::Real_embeddable_traits_base< CORE::BigFloat , CGAL::Tag_true  > {
+  public:
+    class Abs
+      : public std::unary_function< Type, Type > {
+      public:
+        Type operator()( const Type& x ) const {
+            Type result; 
+          
+            if(x.isZeroIn()){
+                CORE::BigInt m; 
+                if(x.m() < 0 ){
+                    m = -(x.m()-x.err());
+                }else{
+                    m =  x.m()+x.err();
+                }
+                if(m % 2 == 1) m += 1;
+                
+                Type upper(m,0,x.exp());
+                result = CORE::centerize(CORE::BigFloat(0),upper);
+                
+                CGAL_postcondition(result.m()-result.err() <= 0); 
+                if(result.m()-result.err() != 0){
+                    result = this->operator()(result);
+                }
+                CGAL_postcondition(result.m()-result.err() == 0); 
+            }else{
+                result = CORE::abs(x);
+            }
+            CGAL_postcondition(result.m()-result.err() >= 0); 
+            CGAL_postcondition(Type(result.m()+result.err(),0,result.exp()) 
+                         >= Type(x.m()+x.err(),0,x.exp()));       
+            return result;
+        }
+    };
+
+    class Sgn
+      : public std::unary_function< Type, ::CGAL::Sign > {
+      public:
+        ::CGAL::Sign operator()( const Type& x ) const {
+            ::CGAL::Sign result =  sign( x.sign());
+            return result; 
+        }
+    };
+
+    class Compare
+      : public std::binary_function< Type, Type,
+                                Comparison_result > {
+      public:
+        Comparison_result operator()( const Type& x,
+                                            const Type& y ) const {
+          return (Comparison_result) sign( (x-y).sign());
+        }
+        CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT( Type, 
+                Comparison_result )
+    };
+
+    class To_double
+      : public std::unary_function< Type, double > {
+      public:
+        double operator()( const Type& x ) const {
+          // this call is required to get reasonable values for the double
+          // approximation
+          return x.doubleValue();
+        }
+    };
+
+    class To_interval
+      : public std::unary_function< Type, std::pair< double, double > > {
+    public:
+        std::pair<double, double> operator()( const Type& x ) const {
+                        
+            double lb,ub;
+           
+            Type x_lower = CGAL::lower(CGAL::internal::round(CGAL::lower(x),50));
+            Type x_upper = CGAL::upper(CGAL::internal::round(CGAL::upper(x),50));
+            
+            // since matissa has 50 bits only, conversion to double is exact 
+            lb = x_lower.doubleValue();
+            CGAL_postcondition(lb == x_lower);
+            ub = x_upper.doubleValue();
+            CGAL_postcondition(ub == x_upper);             
+            
+            std::pair<double, double> result(lb,ub);
+            CGAL_postcondition( result.first  <=  CORE::Expr(CGAL::lower(x)));
+            CGAL_postcondition( result.second >=  CORE::Expr(CGAL::upper(x)));
+            return result;      
+        }
+    };
+};
+
+} //namespace CGAL
+
+//since types are included by CORE_coercion_traits.h:
+#include <CGAL/CORE_Expr.h>
+#include <CGAL/CORE_BigInt.h>
+#include <CGAL/CORE_BigRat.h>
+#include <CGAL/CORE_BigFloat.h>
+#include <CGAL/CORE_arithmetic_kernel.h>
+
+namespace Eigen {
+  template<class> struct NumTraits;
+  template<> struct NumTraits<CORE::BigFloat>
+  {
+    typedef CORE::BigFloat Real;
+    typedef CORE::BigFloat NonInteger;
+    typedef CORE::BigFloat Nested;
+    typedef CORE::BigFloat Literal;
+
+    static inline Real epsilon() { return 0; }
+    static inline Real dummy_precision() { return 0; }
+
+    enum {
+      IsInteger = 0,
+      IsSigned = 1,
+      IsComplex = 0,
+      RequireInitialization = 1,
+      ReadCost = 6,
+      AddCost = 60,
+      MulCost = 60
+    };
+  };
+}
+
+#endif // CGAL_CORE_BIGFLOAT_H
diff --git a/3rdparty/CGAL/include/CGAL/CORE_BigInt.h b/3rdparty/CGAL/include/CGAL/CORE_BigInt.h
new file mode 100644
index 0000000..a3c18b1
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/CORE_BigInt.h
@@ -0,0 +1,227 @@
+// Copyright (c) 2006-2008 Max-Planck-Institute Saarbruecken (Germany).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Michael Hemmer   <hemmer at mpi-inf.mpg.de>
+
+
+#ifndef CGAL_CORE_BIGINT_H
+#define CGAL_CORE_BIGINT_H
+
+#include <CGAL/config.h>
+#include <CGAL/number_type_basic.h>
+#include <CGAL/CORE/BigInt.h>
+#include <CGAL/CORE/Expr.h>
+#include <CGAL/CORE_coercion_traits.h>
+
+#include <CGAL/Residue.h>
+#include <CGAL/Modular_traits.h>
+
+namespace CGAL {
+
+//
+// Algebraic structure traits
+//
+template <> class Algebraic_structure_traits< CORE::BigInt >
+  : public Algebraic_structure_traits_base< CORE::BigInt,
+                                            Euclidean_ring_tag >  {
+  public:
+    typedef Tag_true            Is_exact;
+    typedef Tag_false           Is_numerical_sensitive;
+
+    typedef INTERN_AST::Is_square_per_sqrt< Type >
+                                                                 Is_square;
+
+    typedef INTERN_AST::Div_per_operator< Type > Div;
+    typedef INTERN_AST::Mod_per_operator< Type > Mod;
+
+    class Sqrt
+      : public std::unary_function< Type, Type > {
+      public:
+        //! computes the largest NT not larger than the square root of \a a.
+        Type operator()( const Type& x) const {
+          Type result;
+          mpz_sqrt(result.get_mp(), x.get_mp());
+          return result;
+        }
+    };
+
+
+    class Gcd
+      : public std::binary_function< Type, Type,
+                                Type > {
+      public:
+        Type operator()( const Type& x,
+                                        const Type& y) const {
+          if ( x == Type(0) && y == Type(0) )
+              return Type(0);
+          Type result;
+          mpz_gcd(result.get_mp(), x.get_mp(), y.get_mp());
+          return result;
+        }
+    };
+};
+
+//
+// Real embeddable traits
+//
+template <> class Real_embeddable_traits< CORE::BigInt >
+  : public INTERN_RET::Real_embeddable_traits_base< CORE::BigInt , CGAL::Tag_true > {
+
+  public:
+
+    class Abs
+      : public std::unary_function< Type, Type > {
+      public:
+        Type operator()( const Type& x ) const {
+          return CORE::abs( x );
+        }
+    };
+
+    class Sgn
+      : public std::unary_function< Type, ::CGAL::Sign > {
+      public:
+        ::CGAL::Sign operator()( const Type& x ) const {
+          return (::CGAL::Sign) CORE::sign( x );
+        }
+    };
+
+    class Compare
+      : public std::binary_function< Type, Type,
+                                Comparison_result > {
+      public:
+        Comparison_result operator()( const Type& x,
+                                            const Type& y ) const {
+          return CGAL::sign(::CORE::cmp(x,y));
+        }
+    };
+
+    class To_double
+      : public std::unary_function< Type, double > {
+      public:
+        double operator()( const Type& x ) const {
+          // this call is required to get reasonable values for the double
+          // approximation
+          return x.doubleValue();
+        }
+    };
+
+    class To_interval
+      : public std::unary_function< Type, std::pair< double, double > > {
+      public:
+        std::pair<double, double> operator()( const Type& x_ ) const {
+            CORE::Expr x(x_);
+            std::pair<double,double> result;
+            x.doubleInterval(result.first, result.second);
+            CGAL_expensive_assertion(result.first  <= x);
+            CGAL_expensive_assertion(result.second >= x);
+            return result;
+        }
+    };
+};
+
+/*! \ingroup NiX_Modular_traits_spec
+ *  \brief a model of concept ModularTraits, 
+ *  specialization of NiX::Modular_traits. 
+ */
+template<>
+class Modular_traits< ::CORE::BigInt > {
+  typedef Residue RES;
+ public:
+    typedef ::CORE::BigInt NT;
+    typedef CGAL::Tag_true Is_modularizable;
+    typedef Residue Residue_type;
+
+    struct Modular_image{
+        Residue_type operator()(const NT& a){
+            NT tmp = a % NT(RES::get_current_prime());
+// TODO: reactivate this assertion
+// it fails with core_v1.6x_20040329
+//            NiX_assert(tmp.isInt());
+            int mi(tmp.longValue());
+            if (mi < 0) mi += RES::get_current_prime();
+            return Residue_type(mi);
+        }
+    };
+    struct Modular_image_representative{
+        NT operator()(const Residue_type& x){
+            return NT(x.get_value());
+        }
+    };    
+};
+
+
+template<>
+struct Needs_parens_as_product<CORE::BigInt>{
+    bool operator()(const CORE::BigInt& x){
+        return CGAL_NTS is_negative(x);
+    }
+};
+
+// Benchmark_rep specialization 
+template<>
+class Benchmark_rep< CORE::BigInt > {
+    const CORE::BigInt& t;
+public:
+    //! initialize with a const reference to \a t.
+    Benchmark_rep( const CORE::BigInt& tt) : t(tt) {}
+    //! perform the output, calls \c operator\<\< by default.
+    std::ostream& operator()( std::ostream& out) const { 
+            out << t;
+            return out;
+    }
+    
+    static std::string get_benchmark_name() {
+        return "Integer";
+    }
+};
+
+
+} //namespace CGAL
+
+//since types are included by CORE_coercion_traits.h:
+#include <CGAL/CORE_Expr.h>
+#include <CGAL/CORE_BigInt.h>
+#include <CGAL/CORE_BigRat.h>
+#include <CGAL/CORE_BigFloat.h>
+#include <CGAL/CORE_arithmetic_kernel.h>
+
+namespace Eigen {
+  template<class> struct NumTraits;
+  template<> struct NumTraits<CORE::BigInt>
+  {
+    typedef CORE::BigInt Real;
+    typedef CORE::BigRat NonInteger;
+    typedef CORE::BigInt Nested;
+    typedef CORE::BigInt Literal;
+
+    static inline Real epsilon() { return 0; }
+    static inline Real dummy_precision() { return 0; }
+
+    enum {
+      IsInteger = 1,
+      IsSigned = 1,
+      IsComplex = 0,
+      RequireInitialization = 1,
+      ReadCost = 6,
+      AddCost = 30,
+      MulCost = 50
+    };
+  };
+}
+
+#endif // CGAL_CORE_BIGINT_H
diff --git a/3rdparty/CGAL/include/CGAL/CORE_BigRat.h b/3rdparty/CGAL/include/CGAL/CORE_BigRat.h
new file mode 100644
index 0000000..8f5f726
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/CORE_BigRat.h
@@ -0,0 +1,263 @@
+// Copyright (c) 2006-2008 Max-Planck-Institute Saarbruecken (Germany).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Michael Hemmer   <hemmer at mpi-inf.mpg.de>
+
+
+#ifndef CGAL_CORE_BIGRAT_H
+#define CGAL_CORE_BIGRAT_H
+
+#include <CGAL/config.h>
+#include <CGAL/number_type_basic.h>
+#include <CGAL/CORE/BigRat.h>
+#include <CGAL/CORE_coercion_traits.h>
+#include <CGAL/CORE_Expr.h> // used for To_interval-functor
+
+//#if defined(CGAL_CORE_BIGRAT_NUMER_DENOM_ARE_MEMBERS)
+//  #define CGAL_CORE_NUMERATOR(X) ((X).numerator())
+//  #define CGAL_CORE_DENOMINATOR(X) ((X).denominator())
+//#elif defined(CGAL_CORE_BIGRAT_NUMER_DENOM_ARE_NONMEMBERS)
+  #define CGAL_CORE_NUMERATOR(X) (numerator((X)))
+  #define CGAL_CORE_DENOMINATOR(X) (denominator((X)))
+//#else
+
+namespace CGAL {
+
+//
+// Algebraic structure traits
+//
+template <> class Algebraic_structure_traits< CORE::BigRat >
+  : public Algebraic_structure_traits_base< CORE::BigRat,
+                                            Field_tag >  {
+  public:
+    typedef Tag_true            Is_exact;
+    typedef Tag_false           Is_numerical_sensitive;
+
+    // BigRat are always normalized, so no special simplify-functor is needed
+
+    // Nothing new...
+};
+
+
+
+
+//
+// Real embeddable traits
+//
+template <> class Real_embeddable_traits< CORE::BigRat >
+  : public INTERN_RET::Real_embeddable_traits_base< CORE::BigRat , CGAL::Tag_true > {
+  public:
+
+    class Abs
+      : public std::unary_function< Type, Type > {
+      public:
+        Type operator()( const Type& x ) const {
+          return CORE::abs( x );
+        }
+    };
+
+    class Sgn
+      : public std::unary_function< Type, ::CGAL::Sign > {
+      public:
+        ::CGAL::Sign operator()( const Type& x ) const {
+          return (::CGAL::Sign) CORE::sign( x );
+        }
+    };
+
+    class Compare
+      : public std::binary_function< Type, Type,
+                                Comparison_result > {
+      public:
+        Comparison_result operator()( const Type& x,
+                                            const Type& y ) const {
+          return CGAL::sign( ::CORE::cmp(x,y));
+        }
+        CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT(Type,Comparison_result)
+    };
+
+    class To_double
+      : public std::unary_function< Type, double > {
+      public:
+        double operator()( const Type& x ) const {
+          // this call is required to get reasonable values for the double
+          // approximation
+          return x.doubleValue();
+        }
+    };
+
+    class To_interval
+      : public std::unary_function< Type, std::pair< double, double > > {
+      public:
+        std::pair<double, double> operator()( const Type& x_ ) const {
+            CORE::Expr x(x_);
+            std::pair<double,double> result;
+            x.doubleInterval(result.first, result.second);
+            CGAL_expensive_assertion(result.first  <= x);
+            CGAL_expensive_assertion(result.second >= x);
+            return result;
+        }
+    };
+};
+
+/*! \ingroup NiX_Fraction_traits_spec
+ *  \brief Specialization of Fraction_traits for ::leda::rational
+ */
+template <>
+class Fraction_traits< CORE::BigRat > {
+public:
+    typedef CORE::BigRat Type;
+    typedef ::CGAL::Tag_true Is_fraction;
+    typedef CORE::BigInt Numerator_type;
+    typedef Numerator_type Denominator_type;
+
+    typedef Algebraic_structure_traits< Numerator_type >::Gcd Common_factor;
+
+    class Decompose {
+    public:
+        typedef Type first_argument_type;
+        typedef Numerator_type& second_argument_type;
+        typedef Numerator_type& third_argument_type;
+        void operator () (
+                const Type& rat,
+                Numerator_type& num,
+                Numerator_type& den) {
+            num = CGAL_CORE_NUMERATOR(rat);
+            den = CGAL_CORE_DENOMINATOR(rat);
+        }
+    };
+
+    class Compose {
+    public:
+        typedef Numerator_type first_argument_type;
+        typedef Numerator_type second_argument_type;
+        typedef Type result_type;
+        Type operator ()(
+                const Numerator_type& num ,
+                const Numerator_type& den ) {
+            return Type(num, den);
+        }
+    };
+};
+
+template <class F>
+class Output_rep< ::CORE::BigRat, F> : public IO_rep_is_specialized {
+    const ::CORE::BigRat& t;
+public:
+    //! initialize with a const reference to \a t.
+    Output_rep( const ::CORE::BigRat& tt) : t(tt) {}
+    //! perform the output, calls \c operator\<\< by default.
+    std::ostream& operator()( std::ostream& out) const {
+        switch (get_mode(out)) {
+        case IO::PRETTY:{
+            if(CGAL_CORE_DENOMINATOR(t) == ::CORE::BigRat(1))
+                return out <<CGAL_CORE_NUMERATOR(t);
+            else
+                return out << CGAL_CORE_NUMERATOR(t)
+                           << "/"
+                           << CGAL_CORE_DENOMINATOR(t);
+            //break; // unreachable
+        }
+
+        default:
+            return out << CGAL_CORE_NUMERATOR(t)
+                       << "/"
+                       << CGAL_CORE_DENOMINATOR(t);
+        }
+    }
+};
+
+template <>
+struct Needs_parens_as_product< ::CORE::BigRat >{
+    bool operator()( ::CORE::BigRat t){
+        if (CGAL_CORE_DENOMINATOR(t) != 1 )
+            return true;
+        else
+            return needs_parens_as_product(CGAL_CORE_NUMERATOR(t)) ;
+    }
+};
+
+template <>
+class Output_rep< ::CORE::BigRat, Parens_as_product_tag >
+  : public IO_rep_is_specialized
+{
+    const ::CORE::BigRat& t;
+public:
+    // Constructor
+    Output_rep( const ::CORE::BigRat& tt) : t(tt) {}
+    // operator
+    std::ostream& operator()( std::ostream& out) const {
+        Needs_parens_as_product< ::CORE::BigRat > needs_parens_as_product;
+        if (needs_parens_as_product(t))
+            return out <<"("<< oformat(t) <<")";
+        else
+            return out << oformat(t);
+    }
+};
+
+// Benchmark_rep specialization 
+template<>
+class Benchmark_rep< CORE::BigRat > {
+    const CORE::BigRat& t;
+public:
+    //! initialize with a const reference to \a t.
+    Benchmark_rep( const CORE::BigRat& tt) : t(tt) {}
+    //! perform the output, calls \c operator\<\< by default.
+    std::ostream& operator()( std::ostream& out) const { 
+            out << "Rational(" << numerator(t) << "," << denominator(t) << ")";
+            return out;
+    }
+    
+    static std::string get_benchmark_name() {
+        return "Rational";
+    }
+};
+
+} //namespace CGAL
+
+//since types are included by CORE_coercion_traits.h:
+#include <CGAL/CORE_Expr.h>
+#include <CGAL/CORE_BigInt.h>
+#include <CGAL/CORE_BigRat.h>
+#include <CGAL/CORE_BigFloat.h>
+#include <CGAL/CORE_arithmetic_kernel.h>
+
+namespace Eigen {
+  template<class> struct NumTraits;
+  template<> struct NumTraits<CORE::BigRat>
+  {
+    typedef CORE::BigRat Real;
+    typedef CORE::BigRat NonInteger;
+    typedef CORE::BigRat Nested;
+    typedef CORE::BigRat Literal;
+
+    static inline Real epsilon() { return 0; }
+    static inline Real dummy_precision() { return 0; }
+
+    enum {
+      IsInteger = 0,
+      IsSigned = 1,
+      IsComplex = 0,
+      RequireInitialization = 1,
+      ReadCost = 6,
+      AddCost = 150,
+      MulCost = 100
+    };
+  };
+}
+
+#endif // CGAL_CORE_BIGRAT_H
diff --git a/3rdparty/CGAL/include/CGAL/CORE_Expr.h b/3rdparty/CGAL/include/CGAL/CORE_Expr.h
new file mode 100644
index 0000000..4bd3894
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/CORE_Expr.h
@@ -0,0 +1,216 @@
+// Copyright (c) 2002-2004,2007  
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved. 
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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(s)     : Sylvain Pion, Michael Hemmer
+
+#ifndef CGAL_CORE_EXPR_H
+#define CGAL_CORE_EXPR_H
+
+#include <CGAL/number_type_basic.h>
+#include <CGAL/CORE_coercion_traits.h>
+#include <CGAL/CORE/Expr.h>
+#include <utility>
+
+
+namespace CGAL {
+
+template <> class Algebraic_structure_traits< CORE::Expr >
+  : public Algebraic_structure_traits_base< CORE::Expr,
+                                            Field_with_root_of_tag >  {
+  public:
+    typedef Tag_true            Is_exact;
+    typedef Tag_true            Is_numerical_sensitive;
+
+    class Sqrt
+      : public std::unary_function< Type, Type > {
+      public:
+        Type operator()( const Type& x ) const {
+          return CORE::sqrt( x );
+        }
+    };
+
+    class Kth_root
+      : public std::binary_function<int, Type, Type> {
+      public:
+        Type operator()( int k,
+                                        const Type& x) const {
+          CGAL_precondition_msg( k > 0, "'k' must be positive for k-th roots");
+          // CORE::radical isn't implemented for negative values of x, so we
+          //  have to handle this case separately
+          if( x < 0 && k%2 != 0)
+            return -CORE::radical( -x, k );
+
+          return CORE::radical( x, k );
+        }
+    };
+
+    class Root_of {
+      public:
+//        typedef CORE::BigRat Boundary;
+        typedef Type   result_type;
+
+
+      public:
+        // constructs the kth roots of the polynomial
+        // given by the iterator range, starting from 0.
+        template< class ForwardIterator >
+        Type operator()( int k,
+                                        ForwardIterator begin,
+                                        ForwardIterator end) const {
+            std::vector<Type> coeffs;
+            for(ForwardIterator it = begin; it != end; it++){
+                coeffs.push_back(*it);
+            }
+            CORE::Polynomial<Type> polynomial(coeffs);
+            return Type(polynomial,k);
+        }
+
+// TODO: Need to be fixed: polynomial<CORE::Expr>.eval() cannot return
+//       CORE::BigFloat, so this does not compile.
+
+/*        template <class ForwardIterator>
+        Type operator()( CORE::BigRat lower,
+                                        CORE::BigRat upper,
+                                        ForwardIterator begin,
+                                        ForwardIterator end) const {
+            std::vector<Type> coeffs;
+            for(ForwardIterator it = begin; it != end; it++){
+                 coeffs.push_back(*it);
+            }
+            CORE::Polynomial<Type> polynomial(coeffs);
+            CORE::BigFloat lower_bf, upper_bf;
+            CORE::BigFloat eval_at_lower(0), eval_at_upper(0);
+
+            CORE::extLong r(16),a(16);
+            while((eval_at_lower.isZeroIn() ||
+                   eval_at_upper.isZeroIn())){
+                //std::cout << "while"<<std::endl;
+                r*=2;
+                a*=2;
+                lower_bf.approx(lower,r,a);
+                upper_bf.approx(upper,r,a);
+                // The most expensive precond I've ever seen :)),
+                // since the coefficients of the polynomial are CORE::Expr
+                // TODO: be sure that lower_bf, upper_bf contain exactly one root
+                //NiX_expensive_precond(
+                //     CORE::Sturm(polynomial).numberOfRoots(lower_bf,upper_bf)==1);
+                eval_at_lower = polynomial.eval(lower_bf);
+                eval_at_upper = polynomial.eval(upper_bf);
+            }
+            CORE::BFInterval interval(lower_bf,upper_bf);
+
+            return Type(polynomial,interval);
+        };  */
+    };
+
+};
+
+template <> class Real_embeddable_traits< CORE::Expr >
+  : public INTERN_RET::Real_embeddable_traits_base< CORE::Expr , CGAL::Tag_true > {
+  public:
+    class Abs
+      : public std::unary_function< Type, Type > {
+      public:
+        Type operator()( const Type& x ) const {
+            return CORE::abs( x );
+        }
+    };
+
+    class Sgn
+      : public std::unary_function< Type, ::CGAL::Sign > {
+      public:
+        ::CGAL::Sign operator()( const Type& x ) const {
+          return (::CGAL::Sign) CORE::sign( x );
+        }
+    };
+
+    class Compare
+      : public std::binary_function< Type, Type,
+                                Comparison_result > {
+      public:
+        Comparison_result operator()( const Type& x,
+                                            const Type& y ) const {
+          return (Comparison_result) CORE::cmp( x, y );
+        }
+
+        CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT( Type,
+                                                      Comparison_result )
+
+    };
+
+    class To_double
+      : public std::unary_function< Type, double > {
+      public:
+        double operator()( const Type& x ) const {
+          x.approx(53,1075);
+          return x.doubleValue();
+        }
+    };
+
+    class To_interval
+      : public std::unary_function< Type, std::pair< double, double > > {
+      public:
+        std::pair<double, double> operator()( const Type& x ) const {
+            std::pair<double,double> result;
+            x.approx(53,1075);
+            x.doubleInterval(result.first, result.second);
+            CGAL_expensive_assertion(result.first  <= x);
+            CGAL_expensive_assertion(result.second >= x);
+            return result;
+        }
+    };
+};
+
+} //namespace CGAL
+
+//since types are included by CORE_coercion_traits.h:
+#include <CGAL/CORE_Expr.h>
+#include <CGAL/CORE_BigInt.h> 
+#include <CGAL/CORE_BigRat.h>
+#include <CGAL/CORE_BigFloat.h>
+#include <CGAL/CORE_arithmetic_kernel.h>
+
+namespace Eigen {
+  template<class> struct NumTraits;
+  template<> struct NumTraits<CORE::Expr>
+  {
+    typedef CORE::Expr Real;
+    typedef CORE::Expr NonInteger;
+    typedef CORE::Expr Nested;
+    typedef CORE::Expr Literal;
+
+    static inline Real epsilon() { return 0; }
+    static inline Real dummy_precision() { return 0; }
+
+    enum {
+      IsInteger = 0,
+      IsSigned = 1,
+      IsComplex = 0,
+      RequireInitialization = 1,
+      ReadCost = 6,
+      AddCost = 200,
+      MulCost = 200
+    };
+  };
+}
+
+#endif // CGAL_CORE_EXPR_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE_algebraic_number_traits.h b/3rdparty/CGAL/include/CGAL/CORE_algebraic_number_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE_algebraic_number_traits.h
rename to 3rdparty/CGAL/include/CGAL/CORE_algebraic_number_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE_arithmetic_kernel.h b/3rdparty/CGAL/include/CGAL/CORE_arithmetic_kernel.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE_arithmetic_kernel.h
rename to 3rdparty/CGAL/include/CGAL/CORE_arithmetic_kernel.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/CORE_coercion_traits.h b/3rdparty/CGAL/include/CGAL/CORE_coercion_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/CORE_coercion_traits.h
rename to 3rdparty/CGAL/include/CGAL/CORE_coercion_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cache.h b/3rdparty/CGAL/include/CGAL/Cache.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cache.h
rename to 3rdparty/CGAL/include/CGAL/Cache.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian.h b/3rdparty/CGAL/include/CGAL/Cartesian.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/Aff_transformation_2.h b/3rdparty/CGAL/include/CGAL/Cartesian/Aff_transformation_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/Aff_transformation_2.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/Aff_transformation_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/Aff_transformation_3.h b/3rdparty/CGAL/include/CGAL/Cartesian/Aff_transformation_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/Aff_transformation_3.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/Aff_transformation_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/Aff_transformation_rep_2.h b/3rdparty/CGAL/include/CGAL/Cartesian/Aff_transformation_rep_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/Aff_transformation_rep_2.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/Aff_transformation_rep_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/Aff_transformation_rep_3.h b/3rdparty/CGAL/include/CGAL/Cartesian/Aff_transformation_rep_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/Aff_transformation_rep_3.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/Aff_transformation_rep_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/Cartesian_base.h b/3rdparty/CGAL/include/CGAL/Cartesian/Cartesian_base.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/Cartesian_base.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/Cartesian_base.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/Circle_2.h b/3rdparty/CGAL/include/CGAL/Cartesian/Circle_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/Circle_2.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/Circle_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/Circle_3.h b/3rdparty/CGAL/include/CGAL/Cartesian/Circle_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/Circle_3.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/Circle_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/Data_accessor_2.h b/3rdparty/CGAL/include/CGAL/Cartesian/Data_accessor_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/Data_accessor_2.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/Data_accessor_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/Direction_2.h b/3rdparty/CGAL/include/CGAL/Cartesian/Direction_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/Direction_2.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/Direction_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/Direction_3.h b/3rdparty/CGAL/include/CGAL/Cartesian/Direction_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/Direction_3.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/Direction_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/Iso_cuboid_3.h b/3rdparty/CGAL/include/CGAL/Cartesian/Iso_cuboid_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/Iso_cuboid_3.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/Iso_cuboid_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/Iso_rectangle_2.h b/3rdparty/CGAL/include/CGAL/Cartesian/Iso_rectangle_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/Iso_rectangle_2.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/Iso_rectangle_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/Line_2.h b/3rdparty/CGAL/include/CGAL/Cartesian/Line_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/Line_2.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/Line_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/Line_3.h b/3rdparty/CGAL/include/CGAL/Cartesian/Line_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/Line_3.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/Line_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/MatrixC33.h b/3rdparty/CGAL/include/CGAL/Cartesian/MatrixC33.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/MatrixC33.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/MatrixC33.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/Plane_3.h b/3rdparty/CGAL/include/CGAL/Cartesian/Plane_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/Plane_3.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/Plane_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/Point_2.h b/3rdparty/CGAL/include/CGAL/Cartesian/Point_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/Point_2.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/Point_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/Point_3.h b/3rdparty/CGAL/include/CGAL/Cartesian/Point_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/Point_3.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/Point_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/Ray_2.h b/3rdparty/CGAL/include/CGAL/Cartesian/Ray_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/Ray_2.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/Ray_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/Ray_3.h b/3rdparty/CGAL/include/CGAL/Cartesian/Ray_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/Ray_3.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/Ray_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/Rotation_rep_2.h b/3rdparty/CGAL/include/CGAL/Cartesian/Rotation_rep_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/Rotation_rep_2.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/Rotation_rep_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/Scaling_rep_2.h b/3rdparty/CGAL/include/CGAL/Cartesian/Scaling_rep_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/Scaling_rep_2.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/Scaling_rep_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/Scaling_rep_3.h b/3rdparty/CGAL/include/CGAL/Cartesian/Scaling_rep_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/Scaling_rep_3.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/Scaling_rep_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/Segment_2.h b/3rdparty/CGAL/include/CGAL/Cartesian/Segment_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/Segment_2.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/Segment_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/Segment_3.h b/3rdparty/CGAL/include/CGAL/Cartesian/Segment_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/Segment_3.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/Segment_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/Sphere_3.h b/3rdparty/CGAL/include/CGAL/Cartesian/Sphere_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/Sphere_3.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/Sphere_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/Tetrahedron_3.h b/3rdparty/CGAL/include/CGAL/Cartesian/Tetrahedron_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/Tetrahedron_3.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/Tetrahedron_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/Translation_rep_2.h b/3rdparty/CGAL/include/CGAL/Cartesian/Translation_rep_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/Translation_rep_2.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/Translation_rep_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/Translation_rep_3.h b/3rdparty/CGAL/include/CGAL/Cartesian/Translation_rep_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/Translation_rep_3.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/Translation_rep_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/Triangle_2.h b/3rdparty/CGAL/include/CGAL/Cartesian/Triangle_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/Triangle_2.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/Triangle_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/Triangle_3.h b/3rdparty/CGAL/include/CGAL/Cartesian/Triangle_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/Triangle_3.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/Triangle_3.h
diff --git a/3rdparty/CGAL/include/CGAL/Cartesian/Vector_2.h b/3rdparty/CGAL/include/CGAL/Cartesian/Vector_2.h
new file mode 100644
index 0000000..1c4bca0
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Cartesian/Vector_2.h
@@ -0,0 +1,153 @@
+// Copyright (c) 2000  
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved. 
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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(s)     : Andreas Fabri, Herve Bronnimann
+
+#ifndef CGAL_CARTESIAN_VECTOR_2_H
+#define CGAL_CARTESIAN_VECTOR_2_H
+
+#include <CGAL/Origin.h>
+#include <CGAL/array.h>
+#include <CGAL/constant.h>
+#include <CGAL/Handle_for.h>
+
+namespace CGAL {
+
+template < class R_ >
+class VectorC2
+{
+  typedef typename R_::FT                   FT;
+  typedef typename R_::Point_2              Point_2;
+  typedef typename R_::Vector_2             Vector_2;
+  typedef typename R_::Segment_2            Segment_2;
+  typedef typename R_::Ray_2                Ray_2;
+  typedef typename R_::Line_2               Line_2;
+  typedef typename R_::Direction_2          Direction_2;
+
+  typedef cpp11::array<FT, 2>               Rep;
+  typedef typename R_::template Handle<Rep>::type  Base;
+
+  Base base;
+
+public:
+
+  typedef typename Rep::const_iterator      Cartesian_const_iterator;
+
+  typedef R_                                R;
+
+  VectorC2() {}
+ 
+  VectorC2(const FT &x, const FT &y)
+    : base(CGAL::make_array(x, y)) {}
+
+  VectorC2(const FT &hx, const FT &hy, const FT &hw)
+    : base( hw != FT(1) ? CGAL::make_array<FT>(hx/hw, hy/hw)
+                        : CGAL::make_array(hx, hy) ) {}
+
+  const FT & x() const
+  {
+      return CGAL::get_pointee_or_identity(base)[0];
+  }
+
+  const FT & y() const
+  {
+      return CGAL::get_pointee_or_identity(base)[1];
+  }
+
+  const FT & hx() const
+  {
+      return x();
+  }
+
+  const FT & hy() const
+  {
+      return y();
+  }
+
+  const FT& hw() const
+  {
+    return constant<FT, 1>();
+  }
+
+  Cartesian_const_iterator cartesian_begin() const
+  {
+    return CGAL::get_pointee_or_identity(base).begin();
+  }
+
+  Cartesian_const_iterator cartesian_end() const
+  {
+    return CGAL::get_pointee_or_identity(base).end();
+  }
+
+};
+
+template < class R >
+CGAL_KERNEL_INLINE
+bool 
+operator==(const VectorC2<R> &v, const VectorC2<R> &w)
+{
+  return w.x() == v.x() && w.y() == v.y();
+}
+
+template < class R >
+inline
+bool 
+operator!=(const VectorC2<R> &v, const VectorC2<R> &w)
+{
+  return !(v == w);
+}
+
+template < class R >
+inline
+bool
+operator==(const VectorC2<R> &v, const Null_vector &)
+{
+  return CGAL_NTS is_zero(v.x()) && CGAL_NTS is_zero(v.y());
+}
+
+template < class R >
+inline
+bool
+operator==(const Null_vector &n, const VectorC2<R> &v)
+{
+  return v == n;
+}
+
+template < class R >
+inline
+bool
+operator!=(const VectorC2<R> &v, const Null_vector &n)
+{
+  return !(v == n);
+}
+
+template < class R >
+inline
+bool
+operator!=(const Null_vector &n, const VectorC2<R> &v)
+{
+  return !(v == n);
+}
+
+} //namespace CGAL
+
+#endif // CGAL_CARTESIAN_VECTOR_2_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/Vector_3.h b/3rdparty/CGAL/include/CGAL/Cartesian/Vector_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/Vector_3.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/Vector_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/basic_constructions_2.h b/3rdparty/CGAL/include/CGAL/Cartesian/basic_constructions_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/basic_constructions_2.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/basic_constructions_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/basic_constructions_3.h b/3rdparty/CGAL/include/CGAL/Cartesian/basic_constructions_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/basic_constructions_3.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/basic_constructions_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/ft_constructions_2.h b/3rdparty/CGAL/include/CGAL/Cartesian/ft_constructions_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/ft_constructions_2.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/ft_constructions_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/ft_constructions_3.h b/3rdparty/CGAL/include/CGAL/Cartesian/ft_constructions_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/ft_constructions_3.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/ft_constructions_3.h
diff --git a/3rdparty/CGAL/include/CGAL/Cartesian/function_objects.h b/3rdparty/CGAL/include/CGAL/Cartesian/function_objects.h
new file mode 100644
index 0000000..79f6844
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Cartesian/function_objects.h
@@ -0,0 +1,4083 @@
+// Copyright (c) 1999-2005  
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved. 
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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(s)     : Stefan Schirra, Sylvain Pion, Michael Hoffmann
+
+#ifndef CGAL_CARTESIAN_FUNCTION_OBJECTS_H
+#define CGAL_CARTESIAN_FUNCTION_OBJECTS_H
+
+#include <CGAL/Kernel/function_objects.h>
+#include <CGAL/predicates/kernel_ftC2.h>
+#include <CGAL/predicates/kernel_ftC3.h>
+#include <CGAL/constructions/kernel_ftC2.h>
+#include <CGAL/constructions/kernel_ftC3.h>
+#include <CGAL/Cartesian/solve_3.h>
+
+namespace CGAL {
+
+namespace CartesianKernelFunctors {
+
+  using namespace CommonKernelFunctors;
+
+  template <typename K>
+  class Angle_2
+  {
+    typedef typename K::Point_2  Point_2;
+    typedef typename K::Vector_2 Vector_2;
+  public:
+    typedef typename K::Angle   result_type;
+
+    result_type
+    operator()(const Vector_2& u, const Vector_2& v) const
+    { return angleC2(u.x(), u.y(), v.x(), v.y()); }
+
+    result_type
+    operator()(const Point_2& p, const Point_2& q, const Point_2& r) const
+    { return angleC2(p.x(), p.y(), q.x(), q.y(), r.x(), r.y()); }
+
+    result_type
+    operator()(const Point_2& p, const Point_2& q, 
+               const Point_2& r, const Point_2& s) const
+    {
+      return angleC2(p.x(), p.y(),
+		     q.x(), q.y(),
+		     r.x(), r.y(),
+                     s.x(), s.y());
+    }
+  };
+
+  template <typename K>
+  class Angle_3
+  {
+    typedef typename K::Point_3  Point_3;
+    typedef typename K::Vector_3 Vector_3;
+  public:
+    typedef typename K::Angle    result_type;
+
+    result_type
+    operator()(const Vector_3& u, const Vector_3& v) const
+    {
+      return angleC3(u.x(), u.y(), u.z(),
+		     v.x(), v.y(), v.z());
+    }
+    result_type
+    operator()(const Point_3& p, const Point_3& q, const Point_3& r) const
+    {
+      return angleC3(p.x(), p.y(), p.z(),
+		     q.x(), q.y(), q.z(),
+		     r.x(), r.y(), r.z());
+    }
+
+    result_type
+    operator()(const Point_3& p, const Point_3& q,
+               const Point_3& r, const Point_3& s) const
+    {
+      return angleC3(p.x(), p.y(), p.z(),
+		     q.x(), q.y(), q.z(),
+		     r.x(), r.y(), r.z(),
+		     s.x(), s.y(), s.z());
+    }
+  };
+
+  template <typename K>
+  class Are_parallel_2
+  {
+    typedef typename K::Line_2          Line_2;
+    typedef typename K::Segment_2       Segment_2;
+    typedef typename K::Ray_2           Ray_2;
+
+  public:
+    typedef typename K::Boolean         result_type;
+
+    result_type
+    operator()(const Line_2& l1, const Line_2& l2) const
+    { return parallelC2(l1.a(), l1.b(), l2.a(), l2.b()); }
+
+    result_type
+    operator()(const Segment_2& s1, const Segment_2& s2) const
+    { return parallelC2(s1.source().x(), s1.source().y(),
+                        s1.target().x(), s1.target().y(),
+                        s2.source().x(), s2.source().y(),
+                        s2.target().x(), s2.target().y());
+    }
+
+    result_type
+    operator()(const Ray_2& r1, const Ray_2& r2) const
+    { return parallelC2(r1.source().x(), r1.source().y(),
+                        r1.second_point().x(), r1.second_point().y(),
+                        r2.source().x(), r2.source().y(),
+                        r2.second_point().x(), r2.second_point().y());
+    }
+  };
+
+  template <typename K>
+  class Are_parallel_3
+  {
+    typedef typename K::Line_3          Line_3;
+    typedef typename K::Segment_3       Segment_3;
+    typedef typename K::Ray_3           Ray_3;
+    typedef typename K::Plane_3         Plane_3;
+
+  public:
+    typedef typename K::Boolean         result_type;
+
+    result_type
+    operator()(const Line_3& l1, const Line_3& l2) const
+    { return parallelC3(
+                l1.to_vector().x(), l1.to_vector().y(), l1.to_vector().z(),
+                l2.to_vector().x(), l2.to_vector().y(), l2.to_vector().z());
+    }
+
+    result_type
+    operator()(const Plane_3& h1, const Plane_3& h2) const
+    { return parallelC3(h1.a(), h1.b(), h1.c(),
+                        h2.a(), h2.b(), h2.c());
+    }
+
+    result_type
+    operator()(const Segment_3& s1, const Segment_3& s2) const
+    { return parallelC3(s1.source().x(), s1.source().y(), s1.source().z(),
+                        s1.target().x(), s1.target().y(), s1.target().z(),
+                        s2.source().x(), s2.source().y(), s2.source().z(),
+                        s2.target().x(), s2.target().y(), s2.target().z());
+    }
+
+    result_type
+    operator()(const Ray_3& r1, const Ray_3& r2) const
+    { return parallelC3(r1.source().x(), r1.source().y(), r1.source().z(),
+	r1.second_point().x(), r1.second_point().y(), r1.second_point().z(),
+                        r2.source().x(), r2.source().y(), r2.source().z(),
+	r2.second_point().x(), r2.second_point().y(), r2.second_point().z());
+    }
+  };
+
+  template <typename K>
+  class Bounded_side_2
+  {
+    typedef typename K::Point_2         Point_2;
+    typedef typename K::Circle_2        Circle_2;
+    typedef typename K::Triangle_2      Triangle_2;
+    typedef typename K::Iso_rectangle_2 Iso_rectangle_2;
+  public:
+    typedef typename K::Bounded_side    result_type;
+
+    result_type
+    operator()( const Circle_2& c, const Point_2& p) const
+    {
+      typename K::Compute_squared_distance_2 squared_distance;
+      return enum_cast<Bounded_side>(CGAL::compare(c.squared_radius(),
+                                                   squared_distance(c.center(),p)));
+    }
+
+    result_type
+    operator()( const Triangle_2& t, const Point_2& p) const
+    {
+      typename K::Collinear_are_ordered_along_line_2
+	collinear_are_ordered_along_line;
+      typename K::Orientation_2 orientation;
+      typename K::Orientation o1 = orientation(t.vertex(0), t.vertex(1), p),
+	                      o2 = orientation(t.vertex(1), t.vertex(2), p),
+	                      o3 = orientation(t.vertex(2), t.vertex(3), p);
+
+      if (o2 == o1 && o3 == o1)
+	return ON_BOUNDED_SIDE;
+      return
+	(o1 == COLLINEAR
+	 && collinear_are_ordered_along_line(t.vertex(0), p, t.vertex(1))) ||
+	(o2 == COLLINEAR
+	 && collinear_are_ordered_along_line(t.vertex(1), p, t.vertex(2))) ||
+	(o3 == COLLINEAR
+	 && collinear_are_ordered_along_line(t.vertex(2), p, t.vertex(3)))
+	? ON_BOUNDARY
+	: ON_UNBOUNDED_SIDE;
+    }
+
+    result_type
+    operator()( const Iso_rectangle_2& r, const Point_2& p) const
+    {
+      bool x_incr = (r.xmin() < p.x()) && (p.x() < r.xmax()),
+	   y_incr = (r.ymin() < p.y()) && (p.y() < r.ymax());
+      if (x_incr)
+	{
+	  if (y_incr)
+	    return ON_BOUNDED_SIDE;
+	  if ( (p.y() == r.ymin()) || (r.ymax() == p.y()) )
+	    return ON_BOUNDARY;
+	}
+      if ( (p.x() == r.xmin()) || (r.xmax() == p.x()) )
+	if ( y_incr || (p.y() == r.ymin()) || (r.ymax() == p.y()) )
+          return ON_BOUNDARY;
+
+      return ON_UNBOUNDED_SIDE;
+    }
+  };
+
+  template <typename K>
+  class Bounded_side_3
+  {
+    typedef typename K::FT              FT;
+    typedef typename K::Point_3         Point_3;
+    typedef typename K::Sphere_3        Sphere_3;
+    typedef typename K::Circle_3        Circle_3;
+    typedef typename K::Tetrahedron_3   Tetrahedron_3;
+    typedef typename K::Iso_cuboid_3    Iso_cuboid_3;
+  public:
+    typedef typename K::Bounded_side    result_type;
+
+    result_type
+    operator()( const Sphere_3& s, const Point_3& p) const
+    { return s.rep().bounded_side(p); }
+
+    result_type
+    operator()( const Circle_3& s, const Point_3& p) const
+    { return s.rep().bounded_side(p); }
+
+    result_type
+    operator()( const Tetrahedron_3& t, const Point_3& p) const
+    {
+      FT alpha, beta, gamma;
+
+      Cartesian_internal::solve(t.vertex(1)-t.vertex(0),
+                                t.vertex(2)-t.vertex(0),
+                                t.vertex(3)-t.vertex(0),
+                                p - t.vertex(0), alpha, beta, gamma);
+      if (   (alpha < 0) || (beta < 0) || (gamma < 0)
+          || (alpha + beta + gamma > 1) )
+          return ON_UNBOUNDED_SIDE;
+
+      if (   (alpha == 0) || (beta == 0) || (gamma == 0)
+          || (alpha+beta+gamma == 1) )
+        return ON_BOUNDARY;
+
+      return ON_BOUNDED_SIDE;
+    }
+
+    result_type
+    operator()( const Iso_cuboid_3& c, const Point_3& p) const
+    {
+      return c.rep().bounded_side(p);
+    }
+
+  };
+
+  template <typename K>
+  class Collinear_are_ordered_along_line_2
+  {
+    typedef typename K::Point_2         Point_2;
+  public:
+    typedef typename K::Boolean         result_type;
+
+    result_type
+    operator()(const Point_2& p, const Point_2& q, const Point_2& r) const
+    {
+      CGAL_kernel_exactness_precondition( collinear(p, q, r) );
+      return collinear_are_ordered_along_lineC2
+	(p.x(), p.y(), q.x(), q.y(), r.x(), r.y());
+    }
+  };
+
+  template <typename K>
+  class Collinear_are_ordered_along_line_3
+  {
+    typedef typename K::Point_3         Point_3;
+  public:
+    typedef typename K::Boolean         result_type;
+
+    result_type
+    operator()(const Point_3& p, const Point_3& q, const Point_3& r) const
+    {
+      CGAL_kernel_exactness_precondition( collinear(p, q, r) );
+      return collinear_are_ordered_along_lineC3(p.x(), p.y(), p.z(),
+						q.x(), q.y(), q.z(),
+						r.x(), r.y(), r.z());
+    }
+  };
+
+  template <typename K>
+  class Collinear_are_strictly_ordered_along_line_2
+  {
+    typedef typename K::Point_2         Point_2;
+  public:
+    typedef typename K::Boolean         result_type;
+
+    result_type
+    operator()(const Point_2& p, const Point_2& q, const Point_2& r) const
+    {
+      CGAL_kernel_exactness_precondition( collinear(p, q, r) );
+      return collinear_are_strictly_ordered_along_lineC2
+	(p.x(), p.y(), q.x(), q.y(), r.x(), r.y());
+    }
+  };
+
+  template <typename K>
+  class Collinear_are_strictly_ordered_along_line_3
+  {
+    typedef typename K::Point_3         Point_3;
+  public:
+    typedef typename K::Boolean         result_type;
+
+    result_type
+    operator()(const Point_3& p, const Point_3& q, const Point_3& r) const
+    {
+      CGAL_kernel_exactness_precondition( collinear(p, q, r) );
+      return collinear_are_strictly_ordered_along_lineC3(p.x(), p.y(), p.z(),
+							 q.x(), q.y(), q.z(),
+							 r.x(), r.y(), r.z());
+    }
+  };
+
+  template <typename K>
+  class Collinear_has_on_2
+  {
+    typedef typename K::Point_2               Point_2;
+    typedef typename K::Ray_2                 Ray_2;
+    typedef typename K::Segment_2             Segment_2;
+  public:
+    typedef typename K::Boolean               result_type;
+
+    result_type
+    operator()( const Ray_2& r, const Point_2& p) const
+    {
+      const Point_2 & source = r.source();
+      const Point_2 & second = r.second_point();
+      switch(make_certain(compare_x(source, second))) {
+      case SMALLER:
+        return compare_x(source, p) != LARGER;
+      case LARGER:
+        return compare_x(p, source) != LARGER;
+      default:
+        switch(make_certain(compare_y(source, second))){
+        case SMALLER:
+	  return compare_y(source, p) != LARGER;
+        case LARGER:
+	  return compare_y(p, source) != LARGER;
+        default:
+	  return true; // p == source
+        }
+      } // switch
+    }
+
+    result_type
+    operator()( const Segment_2& s, const Point_2& p) const
+    {
+      return collinear_are_ordered_along_line(s.source(), p, s.target());
+    }
+  };
+
+  template <typename K>
+  class Collinear_2
+  {
+    typedef typename K::Point_2        Point_2;
+    typedef typename K::Orientation_2  Orientation_2;
+    Orientation_2 o;
+  public:
+    typedef typename K::Boolean        result_type;
+
+    Collinear_2() {}
+    Collinear_2(const Orientation_2 o_) : o(o_) {}
+
+    result_type
+    operator()(const Point_2& p, const Point_2& q, const Point_2& r) const
+    { return o(p, q, r) == COLLINEAR; }
+  };
+
+  template <typename K>
+  class Collinear_3
+  {
+    typedef typename K::Point_3    Point_3;
+  public:
+    typedef typename K::Boolean    result_type;
+
+    result_type
+    operator()(const Point_3& p, const Point_3& q, const Point_3& r) const
+    {
+      return collinearC3(p.x(), p.y(), p.z(),
+			 q.x(), q.y(), q.z(),
+			 r.x(), r.y(), r.z());
+    }
+  };
+
+  template <typename K>
+  class Compare_angle_with_x_axis_2
+  {
+    typedef typename K::Direction_2        Direction_2;
+  public:
+    typedef typename K::Comparison_result  result_type;
+
+    result_type
+    operator()(const Direction_2& d1, const Direction_2& d2) const
+    {
+      return compare_angle_with_x_axisC2(d1.dx(), d1.dy(), d2.dx(), d2.dy());
+    }
+  };
+
+  template <typename K>
+  class Compare_distance_2
+  {
+    typedef typename K::Point_2            Point_2;
+  public:
+    typedef typename K::Comparison_result  result_type;
+
+    result_type
+    operator()(const Point_2& p, const Point_2& q, const Point_2& r) const
+    {
+      return cmp_dist_to_pointC2(p.x(), p.y(), q.x(), q.y(), r.x(), r.y());
+    }
+
+    template <class T1, class T2, class T3>
+    result_type
+    operator()(const T1& p, const T2& q, const T3& r) const
+    {
+      return CGAL::compare(squared_distance(p, q), squared_distance(p, r));
+    }
+
+    template <class T1, class T2, class T3, class T4>
+    result_type
+    operator()(const T1& p, const T2& q, const T3& r, const T4& s) const
+    {
+      return CGAL::compare(squared_distance(p, q), squared_distance(r, s));
+    }
+  };
+
+  template <typename K>
+  class Compare_distance_3
+  {
+    typedef typename K::Point_3            Point_3;
+    typedef typename K::Segment_3          Segment_3;
+  public:
+    typedef typename K::Comparison_result  result_type;
+
+    result_type
+    operator()(const Point_3& p, const Point_3& q, const Point_3& r) const
+    {
+      return cmp_dist_to_pointC3(p.x(), p.y(), p.z(),
+				 q.x(), q.y(), q.z(),
+				 r.x(), r.y(), r.z());
+    }
+
+    result_type
+    operator()(const Point_3& p1, const Segment_3& s1, const Segment_3& s2) const
+    {
+      return CGAL::internal::compare_distance_pssC3(p1,s1,s2, K());
+    }
+
+    result_type
+    operator()(const Point_3& p1, const Point_3& p2, const Segment_3& s2) const
+    {
+      return CGAL::internal::compare_distance_ppsC3(p1,p2,s2, K());
+    }
+
+    result_type
+    operator()(const Point_3& p1, const Segment_3& s2, const Point_3& p2) const
+    {
+      return opposite(CGAL::internal::compare_distance_ppsC3(p1,p2,s2, K()));
+    }
+
+    template <class T1, class T2, class T3>
+    result_type
+    operator()(const T1& p, const T2& q, const T3& r) const
+    {
+      return CGAL::compare(squared_distance(p, q), squared_distance(p, r));
+    }
+
+    template <class T1, class T2, class T3, class T4>
+    result_type
+    operator()(const T1& p, const T2& q, const T3& r, const T4& s) const
+    {
+      return CGAL::compare(squared_distance(p, q), squared_distance(r, s));
+    }
+  };
+
+  template <typename K>
+  class Compare_squared_radius_3
+  {
+    typedef typename K::Point_3            Point_3;
+    typedef typename K::FT                 FT;
+  public:
+    typedef typename K::Comparison_result  result_type;
+
+    result_type
+    operator()(const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& s, const FT& ft) const
+    {
+      return CGAL::compare(squared_radiusC3(p.x(), p.y(), p.z(), 
+                                            q.x(), q.y(), q.z(), 
+                                            r.x(), r.y(), r.z(), 
+                                            s.x(), s.y(), s.z() ),
+                           ft);
+    }
+
+    result_type
+    operator()(const Point_3& p, const Point_3& q, const Point_3& r, const FT& ft) const
+    {
+      return CGAL::compare(squared_radiusC3(p.x(), p.y(), p.z(), 
+                                            q.x(), q.y(), q.z(), 
+                                            r.x(), r.y(), r.z()),
+                           ft);
+    }
+
+    result_type
+    operator()(const Point_3& p, const Point_3& q, const FT& ft) const
+    {
+      return CGAL::compare(squared_radiusC3(p.x(), p.y(), p.z(), 
+                                            q.x(), q.y(), q.z() ),
+                           ft);
+    }
+    
+    result_type
+    operator()(const Point_3&, const FT& ft) const
+    {
+      return - CGAL_NTS sign(ft);
+    }    
+  };
+
+
+
+  template <typename K>
+  class Compare_slope_2
+  {
+    typedef typename K::Line_2             Line_2;
+    typedef typename K::Segment_2          Segment_2;
+  public:
+    typedef typename K::Comparison_result  result_type;
+
+    result_type
+    operator()(const Line_2& l1, const Line_2& l2) const
+    {
+      return compare_slopesC2(l1.a(), l1.b(), l2.a(), l2.b());
+    }
+
+    result_type
+    operator()(const Segment_2& s1, const Segment_2& s2) const
+    {
+      return compare_slopesC2(s1.source().x(), s1.source().y(),
+			      s1.target().x(), s1.target().y(),
+			      s2.source().x(), s2.source().y(),
+			      s2.target().x(), s2.target().y());
+    }
+  };
+
+  template <typename K>
+  class Compare_x_at_y_2
+  {
+    typedef typename K::Point_2             Point_2;
+    typedef typename K::Line_2              Line_2;
+  public:
+    typedef typename K::Comparison_result   result_type;
+
+    result_type
+    operator()( const Point_2& p, const Line_2& h) const
+    { return compare_y_at_xC2(p.y(), p.x(), h.b(), h.a(), h.c()); }
+
+    result_type
+    operator()( const Point_2& p, const Line_2& h1, const Line_2& h2) const
+    {
+      return compare_y_at_xC2(p.y(), h1.b(), h1.a(), h1.c(),
+			      h2.b(), h2.a(), h2.c());
+    }
+
+    result_type
+    operator()( const Line_2& l1, const Line_2& l2, const Line_2& h) const
+    {
+      return compare_y_at_xC2(l1.b(), l1.a(), l1.c(), l2.b(), l2.a(), l2.c(),
+			      h.b(), h.a(), h.c());
+    }
+
+    result_type
+    operator()( const Line_2& l1, const Line_2& l2,
+	        const Line_2& h1, const Line_2& h2) const
+    {
+      return compare_y_at_xC2(l1.b(), l1.a(), l1.c(), l2.b(), l2.a(), l2.c(),
+			      h1.b(), h1.a(), h1.c(), h2.b(), h2.a(), h2.c());
+    }
+  };
+
+  template <typename K>
+  class Compare_xyz_3
+  {
+    typedef typename K::Point_3             Point_3;
+  public:
+    typedef typename K::Comparison_result   result_type;
+
+    result_type
+    operator()( const Point_3& p, const Point_3& q) const
+    {
+      return compare_lexicographically_xyzC3(p.x(), p.y(), p.z(),
+					     q.x(), q.y(), q.z());
+    }
+  };
+
+  template <typename K>
+  class Compare_xy_2
+  {
+    typedef typename K::Point_2            Point_2;
+  public:
+    typedef typename K::Comparison_result  result_type;
+
+    result_type
+    operator()( const Point_2& p, const Point_2& q) const
+    { return compare_lexicographically_xyC2(p.x(), p.y(), q.x(), q.y()); }
+  };
+
+  template <typename K>
+  class Compare_xy_3
+  {
+    typedef typename K::Point_3            Point_3;
+  public:
+    typedef typename K::Comparison_result  result_type;
+
+    result_type
+    operator()( const Point_3& p, const Point_3& q) const
+    { return compare_lexicographically_xyC2(p.x(), p.y(), q.x(), q.y()); }
+  };
+
+  template <typename K>
+  class Compare_x_2
+  {
+    typedef typename K::Point_2             Point_2;
+    typedef typename K::Line_2              Line_2;
+  public:
+    typedef typename K::Comparison_result   result_type;
+
+    result_type
+    operator()( const Point_2& p, const Point_2& q) const
+    { return CGAL::compare(p.x(), q.x()); }
+
+    result_type
+    operator()( const Point_2& p, const Line_2& l, const Line_2& h) const
+    { return compare_xC2(p.x(), l.a(), l.b(), l.c(), h.a(), h.b(), h.c()); }
+
+    result_type
+    operator()( const Line_2& l, const Line_2& h1, const Line_2& h2) const
+    {
+      return compare_xC2(l.a(), l.b(), l.c(), h1.a(), h1.b(), h1.c(),
+			 h2.a(), h2.b(), h2.c());
+    }
+
+    result_type
+    operator()( const Line_2& l1, const Line_2& l2,
+	        const Line_2& h1, const Line_2& h2) const
+    {
+      return compare_xC2(l1.a(), l1.b(), l1.c(), l2.a(), l2.b(), l2.c(),
+			 h1.a(), h1.b(), h1.c(), h2.a(), h2.b(), h2.c());
+    }
+  };
+
+  template <typename K>
+  class Compare_x_3
+  {
+    typedef typename K::Point_3             Point_3;
+  public:
+    typedef typename K::Comparison_result   result_type;
+
+    result_type
+    operator()( const Point_3& p, const Point_3& q) const
+    { return CGAL::compare(p.x(), q.x()); }
+  };
+
+  template <typename K>
+  class Compare_yx_2
+  {
+    typedef typename K::Point_2            Point_2;
+  public:
+    typedef typename K::Comparison_result  result_type;
+
+    result_type
+    operator()( const Point_2& p, const Point_2& q) const
+    { return compare_lexicographically_xyC2(p.y(), p.x(), q.y(), q.x()); }
+  };
+
+  template <typename K>
+  class Compare_y_at_x_2
+  {
+    typedef typename K::Point_2             Point_2;
+    typedef typename K::Line_2              Line_2;
+    typedef typename K::Segment_2           Segment_2;
+  public:
+    typedef typename K::Comparison_result   result_type;
+
+    result_type
+    operator()( const Point_2& p, const Line_2& h) const
+    { return compare_y_at_xC2(p.x(), p.y(), h.a(), h.b(), h.c()); }
+
+    result_type
+    operator()( const Point_2& p, const Line_2& h1, const Line_2& h2) const
+    {
+      return compare_y_at_xC2(p.x(), h1.a(), h1.b(), h1.c(),
+			      h2.a(), h2.b(), h2.c());
+    }
+
+    result_type
+    operator()( const Line_2& l1, const Line_2& l2, const Line_2& h) const
+    {
+      return compare_y_at_xC2(l1.a(), l1.b(), l1.c(), l2.a(), l2.b(), l2.c(),
+			      h.a(), h.b(), h.c());
+    }
+
+    result_type
+    operator()( const Line_2& l1, const Line_2& l2,
+	        const Line_2& h1, const Line_2& h2) const
+    {
+      return compare_y_at_xC2(l1.a(), l1.b(), l1.c(), l2.a(), l2.b(), l2.c(),
+			      h1.a(), h1.b(), h1.c(), h2.a(), h2.b(), h2.c());
+    }
+
+    result_type
+    operator()( const Point_2& p, const Segment_2& s) const
+    {
+      return compare_y_at_xC2(p.x(), p.y(),
+			      s.source().x(), s.source().y(),
+			      s.target().x(), s.target().y());
+    }
+
+    result_type
+    operator()( const Point_2& p,
+	        const Segment_2& s1, const Segment_2& s2) const
+    {
+      return compare_y_at_x_segment_C2(p.x(),
+				       s1.source().x(), s1.source().y(),
+				       s1.target().x(), s1.target().y(),
+				       s2.source().x(), s2.source().y(),
+				       s2.target().x(), s2.target().y());
+    }
+  };
+
+  template <typename K>
+  class Compare_y_2
+  {
+    typedef typename K::Point_2             Point_2;
+    typedef typename K::Line_2              Line_2;
+  public:
+    typedef typename K::Comparison_result   result_type;
+
+    result_type
+    operator()( const Point_2& p, const Point_2& q) const
+    { return CGAL::compare(p.y(), q.y()); }
+
+    result_type
+    operator()( const Point_2& p, const Line_2& l1, const Line_2& l2) const
+    {
+      return compare_xC2(p.y(),
+			 l1.b(), l1.a(), l1.c(),
+			 l2.b(), l2.a(), l2.c());
+    }
+
+    result_type
+    operator()( const Line_2& l, const Line_2& h1, const Line_2& h2) const
+    {
+      return compare_xC2(l.b(), l.a(), l.c(), h1.b(), h1.a(), h1.c(),
+			 l.b(), l.a(), l.c(), h2.b(), h2.a(), h2.c());
+    }
+
+    result_type
+    operator()( const Line_2& l1, const Line_2& l2,
+	        const Line_2& h1, const Line_2& h2) const
+    {
+      return compare_xC2(l1.b(), l1.a(), l1.c(), l2.b(), l2.a(), l2.c(),
+			 h1.b(), h1.a(), h1.c(), h2.b(), h2.a(), h2.c());
+    }
+  };
+
+  template <typename K>
+  class Compare_y_3
+  {
+    typedef typename K::Point_3             Point_3;
+  public:
+    typedef typename K::Comparison_result   result_type;
+
+    result_type
+    operator()( const Point_3& p, const Point_3& q) const
+    { return CGAL::compare(p.y(), q.y()); }
+  };
+
+  template <typename K>
+  class Compare_z_3
+  {
+    typedef typename K::Point_3            Point_3;
+  public:
+    typedef typename K::Comparison_result  result_type;
+
+    result_type
+    operator()( const Point_3& p, const Point_3& q) const
+    { return CGAL::compare(p.z(), q.z()); }
+  };
+
+  template <class K>
+  class Compute_approximate_area_3
+  {
+    typedef typename K::Circle_3                  Circle_3;
+    typedef typename K::FT                        FT;
+
+  public:
+
+    typedef double result_type;
+
+    result_type 
+    operator() (const Circle_3 & c) const
+    // { return c.rep().approximate_area(); }
+    { return CGAL_PI * to_double(c.squared_radius()); }
+  };
+
+  template <class K>
+  class Compute_approximate_squared_length_3
+  {
+    typedef typename K::Circle_3                  Circle_3;
+    typedef typename K::FT                        FT;
+
+  public:
+
+    typedef double result_type;
+
+    result_type 
+    operator() (const Circle_3 & c) const
+    // { return c.rep().approximate_squared_length(); }
+    { return CGAL_PI * CGAL_PI * 4.0 * to_double(c.squared_radius()); }
+  };
+
+
+  template <typename K>
+  class Compute_area_2
+  {
+    typedef typename K::FT                FT;
+    typedef typename K::Iso_rectangle_2   Iso_rectangle_2;
+    typedef typename K::Triangle_2        Triangle_2;
+    typedef typename K::Point_2           Point_2;
+  public:
+    typedef FT               result_type;
+
+    result_type
+    operator()( const Point_2& p, const Point_2& q, const Point_2& r ) const
+    {
+      FT v1x = q.x() - p.x();
+      FT v1y = q.y() - p.y();
+      FT v2x = r.x() - p.x();
+      FT v2y = r.y() - p.y();
+      return determinant(v1x, v1y, v2x, v2y)/2;
+    }
+
+    result_type
+    operator()( const Iso_rectangle_2& r ) const
+    { return (r.xmax()-r.xmin()) * (r.ymax()-r.ymin()); }
+
+    result_type
+    operator()( const Triangle_2& t ) const
+    { return t.area(); }
+  };
+
+  template <typename K>
+  class Compute_area_divided_by_pi_3
+  {
+    typedef typename K::Circle_3                  Circle_3;
+    typedef typename K::FT                        FT;
+
+  public:
+
+    typedef FT result_type;
+
+    result_type 
+    operator()(const Circle_3 & c) const
+    { return c.rep().area_divided_by_pi(); }
+
+  };
+
+  template <typename K>
+  class Compute_determinant_2
+  {
+    typedef typename K::FT                FT;
+    typedef typename K::Vector_2          Vector_2;
+  public:
+    typedef FT               result_type;
+
+    result_type
+    operator()(const Vector_2& v, const Vector_2& w) const
+    {
+	return determinant(v.x(), v.y(), w.x(), w.y());
+    }
+  };
+
+  template <typename K>
+  class Compute_determinant_3
+  {
+    typedef typename K::FT                FT;
+    typedef typename K::Vector_3          Vector_3;
+  public:
+    typedef FT               result_type;
+
+    result_type
+    operator()(const Vector_3& v, const Vector_3& w, const Vector_3& t) const
+    {
+	return determinant(v.x(), v.y(), v.z(),
+                                 w.x(), w.y(), w.z(),
+                                 t.x(), t.y(), t.z());
+    }
+  };
+
+  template <typename K>
+  class Compute_scalar_product_2
+  {
+    typedef typename K::FT                FT;
+    typedef typename K::Vector_2          Vector_2;
+  public:
+    typedef FT               result_type;
+
+    result_type
+    operator()(const Vector_2& v, const Vector_2& w) const
+    {
+	return v.x() * w.x() + v.y() * w.y();
+    }
+  };
+
+  template <typename K>
+  class Compute_scalar_product_3
+  {
+    typedef typename K::FT                FT;
+    typedef typename K::Vector_3          Vector_3;
+  public:
+    typedef FT               result_type;
+
+    result_type
+    operator()(const Vector_3& v, const Vector_3& w) const
+    {
+	return v.x() * w.x() + v.y() * w.y() + v.z() * w.z();
+    }
+  };
+
+  template <typename K>
+  class Compute_squared_area_3
+  {
+    typedef typename K::FT                FT;
+    typedef typename K::Point_3           Point_3;
+    typedef typename K::Triangle_3        Triangle_3;
+  public:
+    typedef FT               result_type;
+
+    result_type
+    operator()( const Triangle_3& t ) const
+    {
+	return this->operator()(t.vertex(0), t.vertex(1), t.vertex(2));
+    }
+
+    result_type
+    operator()( const Point_3& p, const Point_3& q, const Point_3& r ) const
+    {
+	return squared_areaC3(p.x(), p.y(), p.z(),
+                              q.x(), q.y(), q.z(),
+                              r.x(), r.y(), r.z());
+    }
+  };
+
+  // FIXME
+  template <typename K>
+  class Compute_squared_distance_Point_Point_2
+  {
+    typedef typename K::FT       FT;
+    typedef typename K::Point_2  Point_2;
+  public:
+    typedef FT               result_type;
+
+    result_type
+    operator()( const Point_2& p, const Point_2& q) const
+    {
+      return squared_distanceC2(p.x(), p.y(), q.x(), q.y());
+    }
+  };
+
+  template <class K>
+  class Compute_squared_length_divided_by_pi_square_3
+  {
+    typedef typename K::Circle_3                  Circle_3;
+    typedef typename K::FT                        FT;
+
+  public:
+
+    typedef FT result_type;
+
+    result_type 
+    operator() (const Circle_3 & c) const
+    { return c.rep().squared_length_divided_by_pi_square(); }
+
+  };
+
+  // TODO ...
+  template <typename K>
+  class Compute_squared_radius_2
+  {
+    typedef typename K::FT          FT;
+    typedef typename K::Point_2     Point_2;
+    typedef typename K::Circle_2    Circle_2;
+  public:
+    template<class>
+    struct result {
+      typedef FT type;
+    };
+    
+    template<typename F>
+    struct result<F(Circle_2)> {
+      typedef const FT& type;
+    };
+
+    const FT&
+    operator()( const Circle_2& c) const
+    { return c.rep().squared_radius(); }
+
+    FT
+    operator()( const Point_2& /*p*/) const
+    { return FT(0); }
+
+    FT
+    operator()( const Point_2& p, const Point_2& q) const
+    { return squared_radiusC2(p.x(), p.y(), q.x(), q.y()); }
+
+    FT
+    operator()( const Point_2& p, const Point_2& q, const Point_2& r) const
+    { return squared_radiusC2(p.x(), p.y(), q.x(), q.y(), r.x(), r.y()); }
+  };
+
+} //namespace CartesianKernelFunctors
+
+// For the non specialized template will do the right thing,
+// namely return a copy of an FT
+
+namespace CartesianKernelFunctors {
+
+  template <typename K>
+  class Compute_squared_radius_3
+  {
+    typedef typename K::FT          FT;
+    typedef typename K::Point_3     Point_3;
+    typedef typename K::Sphere_3    Sphere_3;
+    typedef typename K::Circle_3    Circle_3;
+  public:
+    typedef FT               result_type;
+
+    result_type
+    operator()( const Sphere_3& s) const
+    { return s.rep().squared_radius(); }
+
+    result_type
+    operator()( const Circle_3& c) const
+    { return c.rep().squared_radius(); }
+
+    result_type
+    operator()( const Point_3& /*p*/) const
+    { return FT(0); }
+
+    result_type
+    operator()( const Point_3& p, const Point_3& q) const
+    {
+      return squared_radiusC3(p.x(), p.y(), p.z(),
+			      q.x(), q.y(), q.z());
+    }
+
+    result_type
+    operator()( const Point_3& p, const Point_3& q, const Point_3& r) const
+    {
+      return squared_radiusC3(p.x(), p.y(), p.z(),
+			      q.x(), q.y(), q.z(),
+			      r.x(), r.y(), r.z());
+    }
+
+    result_type
+    operator()( const Point_3& p, const Point_3& q,
+	        const Point_3& r, const Point_3& s) const
+    {
+      return squared_radiusC3(p.x(), p.y(), p.z(),
+			      q.x(), q.y(), q.z(),
+			      r.x(), r.y(), r.z(),
+			      s.x(), s.y(), s.z());
+    }
+  };
+
+  template <typename K>
+  class Compute_volume_3
+  {
+    typedef typename K::FT             FT;
+    typedef typename K::Point_3        Point_3;
+    typedef typename K::Tetrahedron_3  Tetrahedron_3;
+    typedef typename K::Iso_cuboid_3   Iso_cuboid_3;
+  public:
+    typedef FT               result_type;
+
+    result_type
+    operator()(const Point_3& p0, const Point_3& p1,
+	       const Point_3& p2, const Point_3& p3) const
+    {
+      return determinant<FT>(p1.x()-p0.x(), p1.y()-p0.y(), p1.z()-p0.z(),
+                             p2.x()-p0.x(), p2.y()-p0.y(), p2.z()-p0.z(),
+                             p3.x()-p0.x(), p3.y()-p0.y(), p3.z()-p0.z())/6;
+    }
+
+    result_type
+    operator()( const Tetrahedron_3& t ) const
+    {
+      return this->operator()(t.vertex(0), t.vertex(1),
+		              t.vertex(2), t.vertex(3));
+    }
+
+    result_type
+    operator()( const Iso_cuboid_3& c ) const
+    { return c.rep().volume(); }
+  };
+
+
+  template <typename K>
+  class Compute_x_2
+  {
+    typedef typename K::FT             FT;
+    typedef typename K::Point_2        Point_2;
+    typedef typename K::Vector_2       Vector_2;
+
+  public:
+    typedef const FT&                  result_type;
+
+    result_type
+    operator()(const Point_2& p) const
+    {
+      return p.rep().x();
+    }
+
+    result_type
+    operator()(const Vector_2& v) const
+    {
+      return v.rep().x();
+    }
+  };
+
+  template <typename K>
+  class Compute_x_3
+  {
+    typedef typename K::FT             FT;
+    typedef typename K::Point_3        Point_3;
+    typedef typename K::Vector_3       Vector_3;
+
+  public:
+    typedef const FT&                  result_type;
+
+    result_type
+    operator()(const Point_3& p) const
+    {
+      return p.rep().x();
+    }
+
+    result_type
+    operator()(const Vector_3& v) const
+    {
+      return v.rep().x();
+    }
+  };
+
+
+  template <typename K>
+  class Compute_y_2
+  {
+    typedef typename K::FT             FT;
+    typedef typename K::Point_2        Point_2;
+    typedef typename K::Vector_2       Vector_2;
+
+  public:
+    typedef const FT&                  result_type;
+
+    result_type
+    operator()(const Point_2& p) const
+    {
+      return p.rep().y();
+    }
+
+    result_type
+    operator()(const Vector_2& v) const
+    {
+      return v.rep().y();
+    }
+  };
+
+
+  template <typename K>
+  class Compute_y_3
+  {
+    typedef typename K::FT             FT;
+    typedef typename K::Point_3        Point_3;
+    typedef typename K::Vector_3       Vector_3;
+
+  public:
+    typedef const FT&                  result_type;
+
+    result_type
+    operator()(const Point_3& p) const
+    {
+      return p.rep().y();
+    }
+
+    result_type
+    operator()(const Vector_3& v) const
+    {
+      return v.rep().y();
+    }
+  };
+
+  template <typename K>
+  class Compute_z_3
+  {
+    typedef typename K::FT             FT;
+    typedef typename K::Point_3        Point_3;
+    typedef typename K::Vector_3       Vector_3;
+
+  public:
+    typedef const FT&                  result_type;
+
+    result_type
+    operator()(const Point_3& p) const
+    {
+      return p.rep().z();
+    }
+
+    result_type
+    operator()(const Vector_3& v) const
+    {
+      return v.rep().z();
+    }
+  };
+
+
+
+  template <typename K>
+  class Compute_dx_2
+  {
+    typedef typename K::FT             FT;
+    typedef typename K::Direction_2    Direction_2;
+
+  public:
+    typedef const FT&                  result_type;
+
+    result_type
+    operator()(const Direction_2& d) const
+    {
+      return d.rep().dx();
+    }
+  };
+
+  template <typename K>
+  class Compute_dx_3
+  {
+    typedef typename K::FT             FT;
+    typedef typename K::Direction_3    Direction_3;
+
+  public:
+    typedef const FT&                  result_type;
+
+    result_type
+    operator()(const Direction_3& d) const
+    {
+      return d.rep().dx();
+    }
+  };
+
+  template <typename K>
+  class Compute_dy_2
+  {
+    typedef typename K::FT             FT;
+    typedef typename K::Direction_2    Direction_2;
+
+  public:
+    typedef const FT&                  result_type;
+
+    result_type
+    operator()(const Direction_2& d) const
+    {
+      return d.rep().dy();
+    }
+  };
+
+  template <typename K>
+  class Compute_dy_3
+  {
+    typedef typename K::FT             FT;
+    typedef typename K::Direction_3    Direction_3;
+
+  public:
+    typedef const FT&                  result_type;
+
+    result_type
+    operator()(const Direction_3& d) const
+    {
+      return d.rep().dy();
+    }
+  };
+
+  template <typename K>
+  class Compute_dz_3
+  {
+    typedef typename K::FT             FT;
+    typedef typename K::Direction_3        Direction_3;
+
+  public:
+    typedef const FT&               result_type;
+
+    result_type
+    operator()(const Direction_3& d) const
+    {
+      return d.rep().dz();
+    }
+  };
+
+  template <typename K>
+  class Compute_hx_2
+  {
+    typedef typename K::FT             FT;
+    typedef typename K::Point_2        Point_2;
+    typedef typename K::Vector_2       Vector_2;
+
+  public:
+    typedef const FT&                  result_type;
+
+    result_type
+    operator()(const Point_2& p) const
+    {
+      return p.rep().hx();
+    }
+
+    result_type
+    operator()(const Vector_2& v) const
+    {
+      return v.rep().hx();
+    }
+  };
+
+  template <typename K>
+  class Compute_hx_3
+  {
+    typedef typename K::FT             FT;
+    typedef typename K::Point_3        Point_3;
+    typedef typename K::Vector_3       Vector_3;
+
+  public:
+    typedef const FT&                  result_type;
+
+    result_type
+    operator()(const Point_3& p) const
+    {
+      return p.rep().hx();
+    }
+
+    result_type
+    operator()(const Vector_3& v) const
+    {
+      return v.rep().hx();
+    }
+  };
+
+  template <typename K>
+  class Compute_hy_2
+  {
+    typedef typename K::FT             FT;
+    typedef typename K::Point_2        Point_2;
+    typedef typename K::Vector_2       Vector_2;
+
+  public:
+    typedef const FT&                  result_type;
+
+    result_type
+    operator()(const Point_2& p) const
+    {
+      return p.rep().hy();
+    }
+
+    result_type
+    operator()(const Vector_2& v) const
+    {
+      return v.rep().hy();
+    }
+  };
+
+  template <typename K>
+  class Compute_hy_3
+  {
+    typedef typename K::FT             FT;
+    typedef typename K::Point_3        Point_3;
+    typedef typename K::Vector_3       Vector_3;
+
+  public:
+    typedef const FT&                  result_type;
+
+    result_type
+    operator()(const Point_3& p) const
+    {
+      return p.rep().hy();
+    }
+
+    result_type
+    operator()(const Vector_3& v) const
+    {
+      return v.rep().hy();
+    }
+  };
+
+  template <typename K>
+  class Compute_hz_3
+  {
+    typedef typename K::FT             FT;
+    typedef typename K::Point_3        Point_3;
+    typedef typename K::Vector_3       Vector_3;
+
+  public:
+    typedef const FT&                  result_type;
+
+    result_type
+    operator()(const Point_3& p) const
+    {
+      return p.rep().hz();
+    }
+
+    result_type
+    operator()(const Vector_3& v) const
+    {
+      return v.rep().hz();
+    }
+  };
+
+  template <typename K>
+  class Compute_hw_2
+  {
+    typedef typename K::FT             FT;
+    typedef typename K::Point_2        Point_2;
+    typedef typename K::Vector_2       Vector_2;
+
+  public:
+    typedef const FT&                  result_type;
+
+    result_type
+    operator()(const Point_2& p) const
+    {
+      return p.rep().hw();
+    }
+
+    result_type
+    operator()(const Vector_2& v) const
+    {
+      return v.rep().hw();
+    }
+  };
+
+  template <typename K>
+  class Compute_hw_3
+  {
+    typedef typename K::FT             FT;
+    typedef typename K::Point_3        Point_3;
+    typedef typename K::Vector_3       Vector_3;
+
+  public:
+    typedef const FT&                 result_type;
+
+    result_type
+    operator()(const Point_3& p) const
+    {
+      return p.rep().hw();
+    }
+
+    result_type
+    operator()(const Vector_3& v) const
+    {
+      return v.rep().hw();
+    }
+  };
+
+
+  template <typename K>
+  class Compute_xmin_2
+  {
+    typedef typename K::FT              FT;
+    typedef typename K::Iso_rectangle_2 Iso_rectangle_2;
+
+  public:
+    typedef const FT&                   result_type;
+
+    result_type
+    operator()(const Iso_rectangle_2& r) const
+    {
+      return (r.min)().x();
+    }
+  };
+
+  template <typename K>
+  class Compute_xmax_2
+  {
+    typedef typename K::FT              FT;
+    typedef typename K::Iso_rectangle_2 Iso_rectangle_2;
+
+  public:
+    typedef const FT&                   result_type;
+
+    result_type
+    operator()(const Iso_rectangle_2& r) const
+    {
+      return (r.max)().x();
+    }
+  };
+
+  template <typename K>
+  class Compute_ymin_2
+  {
+    typedef typename K::FT              FT;
+    typedef typename K::Iso_rectangle_2 Iso_rectangle_2;
+
+  public:
+    typedef const FT&                   result_type;
+
+    result_type
+    operator()(const Iso_rectangle_2& r) const
+    {
+      return (r.min)().y();
+    }
+  };
+
+  template <typename K>
+  class Compute_ymax_2
+  {
+    typedef typename K::FT              FT;
+    typedef typename K::Iso_rectangle_2 Iso_rectangle_2;
+
+  public:
+    typedef const FT&                   result_type;
+
+    result_type
+    operator()(const Iso_rectangle_2& r) const
+    {
+      return (r.max)().y();
+    }
+  };
+
+
+  template <typename K>
+  class Construct_barycenter_2
+  {
+    typedef typename K::FT          FT;
+    typedef typename K::Point_2     Point_2;
+  public:
+    typedef Point_2                 result_type;
+
+    result_type
+    operator()(const Point_2& p1, const FT&w1, const Point_2& p2) const
+    {
+      typename K::Construct_point_2 construct_point_2;
+      FT x, y;
+      barycenterC2(p1.x(), p1.y(), w1, p2.x(), p2.y(), x, y);
+      return construct_point_2(x, y);
+    }
+
+    result_type
+    operator()(const Point_2& p1, const FT& w1, const Point_2& p2, const FT& w2) const
+    {
+      typename K::Construct_point_2 construct_point_2;
+      FT x, y;
+      barycenterC2(p1.x(), p1.y(), w1, p2.x(), p2.y(), w2, x, y);
+      return construct_point_2(x, y);
+    }
+
+    result_type
+    operator()(const Point_2& p1, const FT& w1, const Point_2& p2, const FT& w2,
+               const Point_2& p3) const
+    {
+      typename K::Construct_point_2 construct_point_2;
+      FT x, y;
+      barycenterC2(p1.x(), p1.y(), w1, p2.x(), p2.y(), w2, p3.x(), p3.y(), x, y);
+      return construct_point_2(x, y);
+    }
+
+    result_type
+    operator()(const Point_2& p1, const FT& w1, const Point_2& p2, const FT& w2,
+               const Point_2& p3, const FT& w3) const
+    {
+      typename K::Construct_point_2 construct_point_2;
+      FT x, y;
+      barycenterC2(p1.x(), p1.y(), w1, p2.x(), p2.y(), w2, p3.x(), p3.y(), w3, x, y);
+      return construct_point_2(x, y);
+    }
+
+    result_type
+    operator()(const Point_2& p1, const FT& w1, const Point_2& p2, const FT& w2,
+               const Point_2& p3, const FT& w3, const Point_2& p4) const
+    {
+      typename K::Construct_point_2 construct_point_2;
+      FT x, y;
+      barycenterC2(p1.x(), p1.y(), w1, p2.x(), p2.y(), w2, p3.x(), p3.y(), w3, p4.x(), p4.y(), x, y);
+      return construct_point_2(x, y);
+    }
+
+    result_type
+    operator()(const Point_2& p1, const FT& w1, const Point_2& p2, const FT& w2,
+               const Point_2& p3, const FT& w3, const Point_2& p4, const FT& w4) const
+    {
+      typename K::Construct_point_2 construct_point_2;
+      FT x, y;
+      barycenterC2(p1.x(), p1.y(), w1, p2.x(), p2.y(), w2, p3.x(), p3.y(), w3, p4.x(), p4.y(), w4, x, y);
+      return construct_point_2(x, y);
+    }
+
+  };
+
+  template <typename K>
+  class Construct_barycenter_3
+  {
+    typedef typename K::FT          FT;
+    typedef typename K::Point_3     Point_3;
+  public:
+    typedef Point_3                 result_type;
+    
+    result_type
+    operator()(const Point_3& p1, const FT&w1, const Point_3& p2) const
+    {
+      typename K::Construct_point_3 construct_point_3;
+      FT x, y, z;
+      barycenterC3(p1.x(), p1.y(), p1.z(), w1, p2.x(), p2.y(), p2.z(), x, y, z);
+      return construct_point_3(x, y, z);
+    }
+
+    result_type
+    operator()(const Point_3& p1, const FT& w1, const Point_3& p2, const FT& w2) const
+    {
+      typename K::Construct_point_3 construct_point_3;
+      FT x, y, z;
+      barycenterC3(p1.x(), p1.y(), p1.z(), w1, p2.x(), p2.y(), p2.z(), w2, x, y, z);
+      return construct_point_3(x, y, z);
+    }
+
+    result_type
+    operator()(const Point_3& p1, const FT& w1, const Point_3& p2, const FT& w2,
+               const Point_3& p3) const
+    {
+      typename K::Construct_point_3 construct_point_3;
+      FT x, y, z;
+      barycenterC3(p1.x(), p1.y(), p1.z(), w1, p2.x(), p2.y(), p2.z(), w2, p3.x(), p3.y(), p3.z(), x, y, z);
+      return construct_point_3(x, y, z);
+    }
+    
+    result_type
+    operator()(const Point_3& p1, const FT& w1, const Point_3& p2, const FT& w2,
+               const Point_3& p3, const FT& w3) const
+    {
+      typename K::Construct_point_3 construct_point_3;
+      FT x, y, z;
+      barycenterC3(p1.x(), p1.y(), p1.z(), w1, p2.x(), p2.y(), p2.z(), w2,
+                   p3.x(), p3.y(), p3.z(), w3, x, y, z);
+      return construct_point_3(x, y, z);
+    }
+    
+    result_type
+    operator()(const Point_3& p1, const FT& w1, const Point_3& p2, const FT& w2,
+               const Point_3& p3, const FT& w3, const Point_3& p4) const
+    {
+      typename K::Construct_point_3 construct_point_3;
+      FT x, y, z;
+      barycenterC3(p1.x(), p1.y(), p1.z(), w1, p2.x(), p2.y(), p2.z(), w2,
+                   p3.x(), p3.y(), p3.z(), w3, p4.x(), p4.y(), p4.z(), x, y, z);
+      return construct_point_3(x, y, z);
+    }
+
+    result_type
+    operator()(const Point_3& p1, const FT& w1, const Point_3& p2, const FT& w2,
+               const Point_3& p3, const FT& w3, const Point_3& p4, const FT& w4) const
+    {
+      typename K::Construct_point_3 construct_point_3;
+      FT x, y, z;
+      barycenterC3(p1.x(), p1.y(), p1.z(), w1, p2.x(), p2.y(), p2.z(), w2,
+                   p3.x(), p3.y(), p3.z(), w3, p4.x(), p4.y(), p4.z(), w4, x, y, z);
+      return construct_point_3(x, y, z);
+    }
+    
+  };
+
+
+  template <typename K>
+  class Construct_base_vector_3
+  {
+    typedef typename K::Vector_3   Vector_3;
+    typedef typename K::Plane_3    Plane_3;
+    typedef typename K::FT         FT;
+    typedef typename K::Construct_cross_product_vector_3
+    Construct_cross_product_vector_3;
+    typedef typename K::Construct_orthogonal_vector_3
+    Construct_orthogonal_vector_3;
+    Construct_cross_product_vector_3 cp;
+    Construct_orthogonal_vector_3 co;
+  public:
+    typedef Vector_3         result_type;
+
+    Construct_base_vector_3() {}
+    Construct_base_vector_3(const Construct_cross_product_vector_3& cp_,
+			    const Construct_orthogonal_vector_3& co_)
+      : cp(cp_), co(co_)
+    {}
+
+    result_type
+    operator()( const Plane_3& h, int index ) const
+    {
+      if (index == 1) {
+	if ( CGAL_NTS is_zero(h.a()) )  // parallel to x-axis
+	  return Vector_3(FT(1), FT(0), FT(0));
+	
+	if ( CGAL_NTS is_zero(h.b()) )  // parallel to y-axis
+	  return Vector_3(FT(0), FT(1), FT(0));
+	
+	if ( CGAL_NTS is_zero(h.c()) )  // parallel to z-axis
+	  return Vector_3(FT(0), FT(0), FT(1));
+	
+	return Vector_3(-h.b(), h.a(), FT(0));
+      } else {
+	return cp(co(h), this->operator()(h,1));
+      }
+    }
+  };
+
+
+  template <typename K>
+  class Construct_bbox_2
+  {
+    typedef typename K::Point_2          Point_2;
+    typedef typename K::Segment_2        Segment_2;
+    typedef typename K::Iso_rectangle_2  Iso_rectangle_2;
+    typedef typename K::Triangle_2       Triangle_2;
+    typedef typename K::Circle_2         Circle_2;
+  public:
+    typedef Bbox_2                       result_type;
+
+    result_type
+    operator()(const Point_2& p) const
+    {
+      std::pair<double,double> xp = CGAL_NTS to_interval(p.x());
+      std::pair<double,double> yp = CGAL_NTS to_interval(p.y());
+      return Bbox_2(xp.first, yp.first, xp.second, yp.second);
+    }
+
+    result_type
+    operator()(const Segment_2& s) const
+    { return s.source().bbox() + s.target().bbox(); }
+
+    result_type
+    operator()(const Triangle_2& t) const
+    {
+      typename K::Construct_bbox_2 construct_bbox_2;
+      return construct_bbox_2(t.vertex(0))
+	   + construct_bbox_2(t.vertex(1))
+	   + construct_bbox_2(t.vertex(2));
+    }
+
+    result_type
+    operator()(const Iso_rectangle_2& r) const
+    {
+      typename K::Construct_bbox_2 construct_bbox_2;
+      return construct_bbox_2((r.min)()) + construct_bbox_2((r.max)());
+    }
+
+    result_type
+    operator()(const Circle_2& c) const
+    {
+      typename K::Construct_bbox_2 construct_bbox_2;
+      Bbox_2 b = construct_bbox_2(c.center());
+
+      Interval_nt<> x (b.xmin(), b.xmax());
+      Interval_nt<> y (b.ymin(), b.ymax());
+
+      Interval_nt<> sqr = CGAL_NTS to_interval(c.squared_radius());
+      Interval_nt<> r = CGAL::sqrt(sqr);
+      Interval_nt<> minx = x-r;
+      Interval_nt<> maxx = x+r;
+      Interval_nt<> miny = y-r;
+      Interval_nt<> maxy = y+r;
+
+      return Bbox_2(minx.inf(), miny.inf(), maxx.sup(), maxy.sup());
+    }
+  };
+
+
+  template <typename K>
+  class Construct_bbox_3
+  {
+    typedef typename K::Point_3          Point_3;
+    typedef typename K::Segment_3        Segment_3;
+    typedef typename K::Iso_cuboid_3     Iso_cuboid_3;
+    typedef typename K::Triangle_3       Triangle_3;
+    typedef typename K::Tetrahedron_3    Tetrahedron_3;
+    typedef typename K::Sphere_3         Sphere_3;
+    typedef typename K::Circle_3         Circle_3;
+  public:
+    typedef Bbox_3          result_type;
+
+    Bbox_3
+    operator()(const Point_3& p) const
+    {
+      std::pair<double,double> xp = CGAL_NTS to_interval(p.x());
+      std::pair<double,double> yp = CGAL_NTS to_interval(p.y());
+      std::pair<double,double> zp = CGAL_NTS to_interval(p.z());
+      return Bbox_3(xp.first, yp.first, zp.first,
+                    xp.second, yp.second, zp.second);
+    }
+
+    Bbox_3
+    operator()(const Segment_3& s) const
+    { return s.source().bbox() + s.target().bbox(); }
+
+    Bbox_3
+    operator()(const Triangle_3& t) const
+    {
+      typename K::Construct_bbox_3 construct_bbox_3;
+      return construct_bbox_3(t.vertex(0))
+	   + construct_bbox_3(t.vertex(1))
+	   + construct_bbox_3(t.vertex(2));
+    }
+
+    Bbox_3
+    operator()(const Iso_cuboid_3& r) const
+    {
+      typename K::Construct_bbox_3 construct_bbox_3;
+      return construct_bbox_3((r.min)()) + construct_bbox_3((r.max)());
+    }
+
+    Bbox_3
+    operator()(const Tetrahedron_3& t) const
+    {
+      typename K::Construct_bbox_3 construct_bbox_3;
+      return construct_bbox_3(t.vertex(0)) + construct_bbox_3(t.vertex(1))
+           + construct_bbox_3(t.vertex(2)) + construct_bbox_3(t.vertex(3));
+    }
+
+    Bbox_3
+    operator()(const Sphere_3& s) const
+    {
+      typename K::Construct_bbox_3 construct_bbox_3;
+      Bbox_3 b = construct_bbox_3(s.center());
+
+      Interval_nt<> x (b.xmin(), b.xmax());
+      Interval_nt<> y (b.ymin(), b.ymax());
+      Interval_nt<> z (b.zmin(), b.zmax());
+
+      Interval_nt<> sqr = CGAL_NTS to_interval(s.squared_radius());
+      Interval_nt<> r = CGAL::sqrt(sqr);
+      Interval_nt<> minx = x-r;
+      Interval_nt<> maxx = x+r;
+      Interval_nt<> miny = y-r;
+      Interval_nt<> maxy = y+r;
+      Interval_nt<> minz = z-r;
+      Interval_nt<> maxz = z+r;
+
+      return Bbox_3(minx.inf(), miny.inf(), minz.inf(), 
+                    maxx.sup(), maxy.sup(), maxz.sup());
+    }
+
+    Bbox_3
+    operator()(const Circle_3& c) const
+    { return c.rep().bbox(); }
+
+  };
+
+
+  template <typename K>
+  class Construct_bisector_2
+  {
+    typedef typename K::FT      FT;
+    typedef typename K::Point_2 Point_2;
+    typedef typename K::Line_2  Line_2;
+  public:
+    typedef Line_2              result_type;
+
+    result_type
+    operator()(const Point_2& p, const Point_2& q) const
+    {
+      FT a, b, c;
+      bisector_of_pointsC2(p.x(), p.y(), q.x(), q.y(), a, b, c);
+      return Line_2(a, b, c);
+    }
+
+    result_type
+    operator()(const Line_2& p, const Line_2& q) const
+    {
+      FT a, b, c;
+      bisector_of_linesC2(p.a(), p.b(), p.c(),
+                          q.a(), q.b(), q.c(),
+                          a, b, c);
+      return Line_2(a, b, c);
+    }
+  };
+
+  template <typename K>
+  class Construct_bisector_3
+  {
+    typedef typename K::FT        FT;
+    typedef typename K::Point_3   Point_3;
+    typedef typename K::Plane_3   Plane_3;
+  public:
+    typedef Plane_3               result_type;
+
+    result_type
+    operator()(const Point_3& p, const Point_3& q) const
+    {
+      FT a, b, c, d;
+      bisector_of_pointsC3(p.x(), p.y(), p.z(),
+	                   q.x(), q.y(), q.z(),
+			   a, b, c, d);
+      return Plane_3(a, b, c, d);
+    }
+
+    result_type
+    operator()(const Plane_3& p, const Plane_3& q) const
+    {
+      FT a, b, c, d;
+      bisector_of_planesC3(p.a(), p.b(), p.c(), p.d(),
+                           q.a(), q.b(), q.c(), q.d(),
+                           a, b, c, d);
+      return Plane_3(a, b, c, d);
+    }
+  };
+
+  template <typename K>
+  class Construct_centroid_2
+  {
+    typedef typename K::FT          FT;
+    typedef typename K::Point_2     Point_2;
+    typedef typename K::Triangle_2  Triangle_2;
+  public:
+    typedef Point_2                 result_type;
+
+    result_type
+    operator()(const Point_2& p, const Point_2& q, const Point_2& r) const
+    {
+      typename K::Construct_point_2 construct_point_2;
+      FT x, y;
+      centroidC2(p.x(), p.y(), q.x(), q.y(), r.x(), r.y(), x, y);
+      return construct_point_2(x, y);
+    }
+
+    result_type
+    operator()(const Triangle_2& t) const
+    {
+      return this->operator()(t.vertex(0), t.vertex(1), t.vertex(2));
+    }
+
+    result_type
+    operator()(const Point_2& p, const Point_2& q,
+               const Point_2& r, const Point_2& s) const
+    {
+      typename K::Construct_point_2 construct_point_2;
+      FT x, y;
+      centroidC2(p.x(), p.y(), q.x(), q.y(), r.x(), r.y(), s.x(), s.y(), x, y);
+      return construct_point_2(x, y);
+    }
+  };
+
+  template <typename K>
+  class Construct_centroid_3
+  {
+    typedef typename K::FT             FT;
+    typedef typename K::Point_3        Point_3;
+    typedef typename K::Triangle_3     Triangle_3;
+    typedef typename K::Tetrahedron_3  Tetrahedron_3;
+  public:
+    typedef Point_3                    result_type;
+
+    result_type
+    operator()(const Point_3& p, const Point_3& q, const Point_3& r) const
+    {
+      typename K::Construct_point_3 construct_point_3;
+      FT x, y, z;
+      centroidC3(p.x(), p.y(), p.z(),
+		 q.x(), q.y(), q.z(),
+		 r.x(), r.y(), r.z(),
+		 x, y, z);
+      return construct_point_3(x, y, z);
+    }
+
+    result_type
+    operator()(const Point_3& p, const Point_3& q,
+               const Point_3& r, const Point_3& s) const
+    {
+      typename K::Construct_point_3 construct_point_3;
+      FT x, y, z;
+      centroidC3(p.x(), p.y(), p.z(),
+		 q.x(), q.y(), q.z(),
+		 r.x(), r.y(), r.z(),
+		 s.x(), s.y(), s.z(),
+		 x, y, z);
+      return construct_point_3(x, y, z);
+    }
+
+    result_type
+    operator()(const Triangle_3& t) const
+    {
+      return this->operator()(t.vertex(0), t.vertex(1), t.vertex(2));
+    }
+
+    result_type
+    operator()(const Tetrahedron_3& t) const
+    {
+      return this->operator()(t.vertex(0), t.vertex(1),
+                              t.vertex(2), t.vertex(3));
+    }
+  };
+
+  template <typename K>
+  class Construct_circumcenter_2
+  {
+    typedef typename K::Point_2     Point_2;
+    typedef typename K::Triangle_2  Triangle_2;
+  public:
+    typedef Point_2                 result_type;
+
+    Point_2
+    operator()(const Point_2& p, const Point_2& q) const
+    {
+      typename K::Construct_midpoint_2 construct_midpoint_2;
+      return construct_midpoint_2(p, q);
+    }
+
+    result_type
+    operator()(const Point_2& p, const Point_2& q, const Point_2& r) const
+    {
+      typename K::Construct_point_2 construct_point_2;
+      typedef typename K::FT        FT;
+      FT x, y;
+      circumcenterC2(p.x(), p.y(), q.x(), q.y(), r.x(), r.y(), x, y);
+      return construct_point_2(x, y);
+    }
+
+    result_type
+    operator()(const Triangle_2& t) const
+    {
+      return this->operator()(t.vertex(0), t.vertex(1), t.vertex(2));
+    }
+  };
+
+  template <typename K>
+  class Construct_circumcenter_3
+  {
+    typedef typename K::FT             FT;
+    typedef typename K::Tetrahedron_3  Tetrahedron_3;
+    typedef typename K::Triangle_3     Triangle_3;
+    typedef typename K::Point_3        Point_3;
+  public:
+    typedef Point_3                    result_type;
+
+    Point_3
+    operator()(const Point_3& p, const Point_3& q) const
+    {
+      typename K::Construct_midpoint_3 construct_midpoint_3;
+      return construct_midpoint_3(p, q);
+    }
+
+    Point_3
+    operator()(const Point_3& p, const Point_3& q, const Point_3& s) const
+    {
+      typename K::Construct_point_3 construct_point_3;
+      // Translate s to origin to simplify the expression.
+      FT psx = p.x()-s.x();
+      FT psy = p.y()-s.y();
+      FT psz = p.z()-s.z();
+      FT ps2 = CGAL_NTS square(psx) + CGAL_NTS square(psy) + CGAL_NTS square(psz);
+      FT qsx = q.x()-s.x();
+      FT qsy = q.y()-s.y();
+      FT qsz = q.z()-s.z();
+      FT qs2 = CGAL_NTS square(qsx) + CGAL_NTS square(qsy) + CGAL_NTS square(qsz);
+      FT rsx = psy*qsz-psz*qsy;
+      FT rsy = psz*qsx-psx*qsz;
+      FT rsz = psx*qsy-psy*qsx;
+
+      // The following determinants can be developped and simplified.
+      //
+      // FT num_x = determinant(psy,psz,ps2,
+      //                              qsy,qsz,qs2,
+      //                              rsy,rsz,0);
+      // FT num_y = determinant(psx,psz,ps2,
+      //                              qsx,qsz,qs2,
+      //                              rsx,rsz,0);
+      // FT num_z = determinant(psx,psy,ps2,
+      //                              qsx,qsy,qs2,
+      //                              rsx,rsy,0);
+
+      FT num_x = ps2 * determinant(qsy,qsz,rsy,rsz)
+	       - qs2 * determinant(psy,psz,rsy,rsz);
+      FT num_y = ps2 * determinant(qsx,qsz,rsx,rsz)
+	       - qs2 * determinant(psx,psz,rsx,rsz);
+      FT num_z = ps2 * determinant(qsx,qsy,rsx,rsy)
+	       - qs2 * determinant(psx,psy,rsx,rsy);
+
+      FT den   = determinant(psx,psy,psz,
+                             qsx,qsy,qsz,
+                             rsx,rsy,rsz);
+
+      CGAL_kernel_assertion( den != 0 );
+      FT inv = 1 / (2 * den);
+
+      FT x = s.x() + num_x*inv;
+      FT y = s.y() - num_y*inv;
+      FT z = s.z() + num_z*inv;
+      return construct_point_3(x, y, z);
+    }
+
+    Point_3
+    operator()(const Triangle_3& t) const
+    {
+      return this->operator()(t.vertex(0), t.vertex(1), t.vertex(2));
+    }
+
+    Point_3
+    operator()(const Point_3& p, const Point_3& q,
+	       const Point_3& r, const Point_3& s) const
+    {
+      typename K::Construct_point_3 construct_point_3;
+      // Translate p to origin to simplify the expression.
+      FT qpx = q.x()-p.x();
+      FT qpy = q.y()-p.y();
+      FT qpz = q.z()-p.z();
+      FT qp2 = CGAL_NTS square(qpx) + CGAL_NTS square(qpy) + CGAL_NTS square(qpz);
+      FT rpx = r.x()-p.x();
+      FT rpy = r.y()-p.y();
+      FT rpz = r.z()-p.z();
+      FT rp2 = CGAL_NTS square(rpx) + CGAL_NTS square(rpy) + CGAL_NTS square(rpz);
+      FT spx = s.x()-p.x();
+      FT spy = s.y()-p.y();
+      FT spz = s.z()-p.z();
+      FT sp2 = CGAL_NTS square(spx) + CGAL_NTS square(spy) + CGAL_NTS square(spz);
+
+      FT num_x = determinant(qpy,qpz,qp2,
+                             rpy,rpz,rp2,
+                             spy,spz,sp2);
+      FT num_y = determinant(qpx,qpz,qp2,
+                             rpx,rpz,rp2,
+                             spx,spz,sp2);
+      FT num_z = determinant(qpx,qpy,qp2,
+                             rpx,rpy,rp2,
+                             spx,spy,sp2);
+      FT den   = determinant(qpx,qpy,qpz,
+                             rpx,rpy,rpz,
+                             spx,spy,spz);
+      CGAL_kernel_assertion( ! CGAL_NTS is_zero(den) );
+      FT inv = 1 / (2 * den);
+
+      FT x = p.x() + num_x*inv;
+      FT y = p.y() - num_y*inv;
+      FT z = p.z() + num_z*inv;
+      return construct_point_3(x, y, z);
+    }
+
+    Point_3
+    operator()(const Tetrahedron_3& t) const
+    {
+      return this->operator()(t.vertex(0), t.vertex(1),
+                              t.vertex(2), t.vertex(3));
+    }
+  };
+
+  template <typename K>
+  class Construct_cross_product_vector_3
+  {
+    typedef typename K::Vector_3  Vector_3;
+  public:
+    typedef Vector_3              result_type;
+
+    Vector_3
+    operator()(const Vector_3& v, const Vector_3& w) const
+    {
+      return Vector_3(v.y() * w.z() - v.z() * w.y(),
+		      v.z() * w.x() - v.x() * w.z(),
+		      v.x() * w.y() - v.y() * w.x());
+    }
+  };
+
+  template <typename K>
+  class Construct_lifted_point_3
+  {
+    typedef typename K::Point_2                    Point_2;
+    typedef typename K::Point_3                    Point_3;
+    typedef typename K::Plane_3                    Plane_3;
+    typedef typename K::Construct_base_vector_3    Construct_base_vector_3;
+    typedef typename K::Construct_point_on_3       Construct_point_on_3;
+    typedef typename K::Construct_scaled_vector_3  Construct_scaled_vector_3;
+    typedef typename K::Construct_translated_point_3
+    Construct_translated_point_3;
+    Construct_base_vector_3 cb;
+    Construct_point_on_3 cp;
+    Construct_scaled_vector_3 cs;
+    Construct_translated_point_3 ct;
+  public:
+    typedef Point_3          result_type;
+
+    Construct_lifted_point_3() {}
+    Construct_lifted_point_3(const Construct_base_vector_3& cb_,
+			     const Construct_point_on_3& cp_,
+			     const Construct_scaled_vector_3& cs_,
+			     const Construct_translated_point_3& ct_)
+      : cb(cb_), cp(cp_), cs(cs_), ct(ct_)
+    {}
+
+    Point_3
+    operator()(const Plane_3& h, const Point_2& p) const
+    {
+      return ct(ct(cp(h), cs(cb(h,1), p.x())), cs(cb(h,2), p.y()));
+    }
+  };
+
+  template <typename K>
+  class Construct_direction_2
+  {
+    typedef typename K::Direction_2     Direction_2;
+    typedef typename Direction_2::Rep   Rep;
+    typedef typename K::Point_2         Point_2;
+    typedef typename K::Vector_2        Vector_2;
+    typedef typename K::Line_2          Line_2;
+    typedef typename K::Ray_2           Ray_2;
+    typedef typename K::Segment_2       Segment_2;
+    typedef typename K::RT              RT;
+
+  public:
+    typedef Direction_2                 result_type;
+
+    Rep // Direction_2
+    operator()(Return_base_tag, const RT& x, const RT& y) const
+    { return Rep(x, y); }
+
+    Rep // Direction_2
+    operator()(Return_base_tag, const Vector_2& v) const
+    {
+      return Rep(v.x(),v.y()); }
+
+    Rep // Direction_2
+    operator()(Return_base_tag, const Line_2& l) const
+    { return Rep(l.b(), -l.a()); }
+
+    Rep // Direction_2
+    operator()(Return_base_tag, const Point_2& p, const Point_2& q) const
+    {
+      return Rep(q.x() - p.x(), q.y() - p.y());
+    }
+
+    Rep // Direction_2
+    operator()(Return_base_tag, const Ray_2& r) const
+    {
+      return this->operator()(Return_base_tag(), r.source(), r.second_point());
+    }
+
+    Rep // Direction_2
+    operator()(Return_base_tag, const Segment_2& s) const
+    {
+      return this->operator()(Return_base_tag(), s.source(), s.target());
+    }
+
+
+    Direction_2
+    operator()(const RT& x, const RT& y) const
+    { return this->operator()(Return_base_tag(), x, y); }
+
+    Direction_2
+    operator()(const Vector_2& v) const
+    {
+      return this->operator()(Return_base_tag(), v); }
+
+    Direction_2
+    operator()(const Line_2& l) const
+    { return this->operator()(Return_base_tag(), l); }
+
+    Direction_2
+    operator()(const Point_2& p, const Point_2& q) const
+    {
+      return this->operator()(Return_base_tag(), p, q);
+    }
+
+    Direction_2
+    operator()(const Ray_2& r) const
+    {
+      return this->operator()(Return_base_tag(), r);
+    }
+
+    Direction_2
+    operator()(const Segment_2& s) const
+    {
+      return this->operator()(Return_base_tag(), s);
+    }
+  };
+
+  template <typename K>
+  class Construct_direction_3
+  {
+    typedef typename K::Direction_3     Direction_3;
+    typedef typename K::Vector_3        Vector_3;
+    typedef typename K::Line_3          Line_3;
+    typedef typename K::Ray_3           Ray_3;
+    typedef typename K::Segment_3       Segment_3;
+    typedef typename K::RT              RT;
+    typedef typename Direction_3::Rep   Rep;
+  public:
+    typedef Direction_3       result_type;
+
+    Rep // Direction_3
+    operator()(Return_base_tag, const RT& x, const RT& y, const RT& z) const
+    { return Rep(x, y, z); }
+
+    Rep // Direction_3
+    operator()(Return_base_tag, const Vector_3& v) const
+    { return Rep(v); }
+
+    Rep // Direction_3
+    operator()(Return_base_tag, const Line_3& l) const
+    { return Rep(l); }
+
+    Rep // Direction_3
+    operator()(Return_base_tag, const Ray_3& r) const
+    { return Rep(r); }
+
+    Rep // Direction_3
+    operator()(Return_base_tag, const Segment_3& s) const
+    { return Rep(s); }
+
+
+    Direction_3
+    operator()(const RT& x, const RT& y, const RT& z) const
+    { return this->operator()(Return_base_tag(), x, y, z); }
+
+    Direction_3
+    operator()(const Vector_3& v) const
+    { return this->operator()(Return_base_tag(), v); }
+
+    Direction_3
+    operator()(const Line_3& l) const
+    { return this->operator()(Return_base_tag(), l); }
+
+    Direction_3
+    operator()(const Ray_3& r) const
+    { return this->operator()(Return_base_tag(), r); }
+
+    Direction_3
+    operator()(const Segment_3& s) const
+    { return this->operator()(Return_base_tag(), s); }
+  };
+
+  template <typename K>
+  class Construct_equidistant_line_3
+  {
+    typedef typename K::FT          FT;
+    typedef typename K::Point_3     Point_3;
+    typedef typename K::Vector_3    Vector_3;
+    typedef typename K::Line_3      Line_3;
+    typedef typename Line_3::Rep    Rep;
+  public:
+    typedef Line_3           result_type;
+
+    Line_3
+    operator()( const Point_3& p, const Point_3& q, const Point_3& s) const
+    {
+      CGAL_kernel_precondition(! collinear(p, q, s));
+
+      // Translate s to origin to simplify the expression.
+      FT psx = p.x()-s.x();
+      FT psy = p.y()-s.y();
+      FT psz = p.z()-s.z();
+      FT ps2 = CGAL_NTS square(psx) + CGAL_NTS square(psy) + CGAL_NTS square(psz);
+      FT qsx = q.x()-s.x();
+      FT qsy = q.y()-s.y();
+      FT qsz = q.z()-s.z();
+      FT qs2 = CGAL_NTS square(qsx) + CGAL_NTS square(qsy) + CGAL_NTS square(qsz);
+      FT rsx = psy*qsz-psz*qsy;
+      FT rsy = psz*qsx-psx*qsz;
+      FT rsz = psx*qsy-psy*qsx;
+
+      // The following determinants can be developped and simplified.
+      //
+      // FT num_x = determinant(psy,psz,ps2,
+      //                              qsy,qsz,qs2,
+      //                              rsy,rsz,0);
+      // FT num_y = determinant(psx,psz,ps2,
+      //                              qsx,qsz,qs2,
+      //                              rsx,rsz,0);
+      // FT num_z = determinant(psx,psy,ps2,
+      //                              qsx,qsy,qs2,
+      //                              rsx,rsy,0);
+
+      FT num_x = ps2 * determinant(qsy,qsz,rsy,rsz)
+	       - qs2 * determinant(psy,psz,rsy,rsz);
+      FT num_y = ps2 * determinant(qsx,qsz,rsx,rsz)
+	       - qs2 * determinant(psx,psz,rsx,rsz);
+      FT num_z = ps2 * determinant(qsx,qsy,rsx,rsy)
+	       - qs2 * determinant(psx,psy,rsx,rsy);
+
+      FT den   = determinant(psx,psy,psz,
+                             qsx,qsy,qsz,
+                             rsx,rsy,rsz);
+
+      CGAL_kernel_assertion( den != 0 );
+      FT inv = 1 / (2 * den);
+
+      FT x = s.x() + num_x*inv;
+      FT y = s.y() - num_y*inv;
+      FT z = s.z() + num_z*inv;
+      return Rep(Point_3(x, y, z), Vector_3(rsx, rsy, rsz));
+    }
+
+  };
+
+  template <typename K>
+  class Construct_iso_rectangle_2
+  {
+    typedef typename K::RT               RT;
+    typedef typename K::FT               FT;
+    typedef typename K::Point_2          Point_2;
+    typedef typename K::Iso_rectangle_2  Iso_rectangle_2;
+    typedef typename Iso_rectangle_2::Rep     Rep;
+
+  public:
+    typedef Iso_rectangle_2              result_type;
+
+    Rep // Iso_rectangle_2
+    operator()(Return_base_tag, const Point_2& p, const Point_2& q, int) const
+    {
+      // I have to remove the assertions, because of Cartesian_converter.
+      // CGAL_kernel_assertion(p.x()<=q.x());
+      // CGAL_kernel_assertion(p.y()<=q.y());
+      return Rep(p, q, 0);
+    }
+
+    Rep // Iso_rectangle_2
+    operator()(Return_base_tag, const Point_2& p, const Point_2& q) const
+    {
+      FT minx, maxx, miny, maxy;
+      if (p.x() < q.x()) { minx = p.x(); maxx = q.x(); }
+      else               { minx = q.x(); maxx = p.x(); }
+      if (p.y() < q.y()) { miny = p.y(); maxy = q.y(); }
+      else               { miny = q.y(); maxy = p.y(); }
+
+      return Rep(Point_2(minx, miny),
+	         Point_2(maxx, maxy), 0);
+    }
+
+    Rep // Iso_rectangle_2
+    operator()(Return_base_tag, const Point_2 &left,   const Point_2 &right,
+               const Point_2 &bottom, const Point_2 &top) const
+    {
+      CGAL_kernel_assertion_code(typename K::Less_x_2 less_x;)
+      CGAL_kernel_assertion_code(typename K::Less_y_2 less_y;)
+      CGAL_kernel_assertion(!less_x(right, left));
+      CGAL_kernel_assertion(!less_y(top, bottom));
+      return Rep(Point_2(left.x(), bottom.y()),
+		 Point_2(right.x(), top.y()), 0);
+    }
+
+    Rep // Iso_rectangle_2
+    operator()(Return_base_tag, const RT& min_hx, const RT& min_hy,
+	       const RT& max_hx, const RT& max_hy) const
+    {
+      CGAL_kernel_precondition(min_hx <= max_hx);
+      CGAL_kernel_precondition(min_hy <= max_hy);
+      return Rep(Point_2(min_hx, min_hy),
+		 Point_2(max_hx, max_hy), 0);
+    }
+
+    Rep // Iso_rectangle_2
+    operator()(Return_base_tag, const RT& min_hx, const RT& min_hy,
+	       const RT& max_hx, const RT& max_hy, const RT& hw) const
+    {
+      if (hw == 1)
+	return Rep(Point_2(min_hx, min_hy),
+		   Point_2(max_hx, max_hy), 0);
+      return Rep(Point_2(min_hx/hw, min_hy/hw),
+		 Point_2(max_hx/hw, max_hy/hw), 0);
+    }
+
+
+    Iso_rectangle_2
+    operator()(const Point_2& p, const Point_2& q, int i) const
+    {
+      return this->operator()(Return_base_tag(), p, q, i);
+    }
+
+    Iso_rectangle_2
+    operator()(const Point_2& p, const Point_2& q) const
+    {
+      return this->operator()(Return_base_tag(), p, q);
+    }
+
+    Iso_rectangle_2
+    operator()(const Point_2 &left,   const Point_2 &right,
+               const Point_2 &bottom, const Point_2 &top) const
+    {
+      return this->operator()(Return_base_tag(), left, right, bottom, top);
+    }
+
+    Iso_rectangle_2
+    operator()(const RT& min_hx, const RT& min_hy,
+	       const RT& max_hx, const RT& max_hy) const
+    {
+      return this->operator()(Return_base_tag(), min_hx, min_hy, max_hx, max_hy);
+    }
+
+    Iso_rectangle_2
+    operator()(const RT& min_hx, const RT& min_hy,
+	       const RT& max_hx, const RT& max_hy, const RT& hw) const
+    {
+      return this->operator()(Return_base_tag(), min_hx, min_hy, max_hx, max_hy, hw);
+    }
+  };
+
+  template <typename K>
+  class Construct_line_2
+  {
+    typedef typename K::RT                        RT;
+    typedef typename K::FT                        FT;
+    typedef typename K::Point_2                   Point_2;
+    typedef typename K::Direction_2               Direction_2;
+    typedef typename K::Vector_2                  Vector_2;
+    typedef typename K::Segment_2                 Segment_2;
+    typedef typename K::Ray_2                     Ray_2;
+    typedef typename K::Line_2                    Line_2;
+    typedef typename Line_2::Rep                  Rep;
+    typedef typename K::Construct_point_on_2      Construct_point_on_2;
+    Construct_point_on_2 c;
+  public:
+    typedef Line_2            result_type;
+
+    Construct_line_2() {}
+    Construct_line_2(const Construct_point_on_2& c_) : c(c_) {}
+
+    Rep // Line_2
+    operator()(Return_base_tag, const RT& a, const RT& b, const RT& cc) const
+    { return Rep(a, b, cc); }
+
+    Rep // Line_2
+    operator()(Return_base_tag, const Point_2& p, const Point_2& q) const
+    {
+      FT a, b, cc;
+      line_from_pointsC2(p.x(), p.y(), q.x(), q.y(), a, b, cc);
+      return Rep(a, b, cc);
+    }
+
+    Rep // Line_2
+    operator()(Return_base_tag, const Point_2& p, const Direction_2& d) const
+    {
+      FT a, b, cc;
+      line_from_point_directionC2(p.x(), p.y(), d.dx(), d.dy(), a, b, cc);
+      return Rep(a, b, cc);
+    }
+
+    Rep // Line_2
+    operator()(Return_base_tag, const Point_2& p, const Vector_2& v) const
+    {
+      FT a, b, cc;
+      line_from_point_directionC2(p.x(), p.y(), v.x(), v.y(), a, b, cc);
+      return Rep(a, b, cc);
+    }
+
+    Rep // Line_2
+    operator()(Return_base_tag, const Segment_2& s) const
+    { return this->operator()(Return_base_tag(), c(s, 0), c(s, 1)); }
+
+    Rep // Line_2
+    operator()(Return_base_tag, const Ray_2& r) const
+    { return this->operator()(Return_base_tag(), c(r, 0), c(r, 1)); }
+
+
+    Line_2
+    operator()(const RT& a, const RT& b, const RT& cc) const
+    { return this->operator()(Return_base_tag(), a, b, cc); }
+
+    Line_2
+    operator()(const Point_2& p, const Point_2& q) const
+    { return this->operator()(Return_base_tag(), p, q); }
+
+    Line_2
+    operator()(const Point_2& p, const Direction_2& d) const
+    { return this->operator()(Return_base_tag(), p, d); }
+
+    Line_2
+    operator()(const Point_2& p, const Vector_2& v) const
+    { return this->operator()(Return_base_tag(), p, v); }
+
+    Line_2
+    operator()(const Segment_2& s) const
+    { return this->operator()(Return_base_tag(), s); }
+
+    Line_2
+    operator()(const Ray_2& r) const
+    { return this->operator()(Return_base_tag(), r); }
+  };
+
+  template <typename K>
+  class Construct_line_3
+  {
+    typedef typename K::Point_3                   Point_3;
+    typedef typename K::Direction_3               Direction_3;
+    typedef typename K::Segment_3                 Segment_3;
+    typedef typename K::Ray_3                     Ray_3;
+    typedef typename K::Line_3                    Line_3;
+    typedef typename K::Vector_3                  Vector_3;
+    typedef typename Line_3::Rep                  Rep;
+  public:
+    typedef Line_3            result_type;
+
+    Rep // Line_3
+    operator()(Return_base_tag, const Point_3& p, const Point_3& q) const
+    { return Rep(p, Vector_3(p, q)); }
+
+    Rep // Line_3
+    operator()(Return_base_tag, const Point_3& p, const Direction_3& d) const
+    { return operator()(Return_base_tag(), p, Vector_3(d.dx(), d.dy(), d.dz())); }
+
+    Rep // Line_3
+    operator()(Return_base_tag, const Point_3& p, const Vector_3& v) const
+    { return Rep(p, v); }
+
+    Rep // Line_3
+    operator()(Return_base_tag, const Segment_3& s) const
+    { return Rep(s.source(), Vector_3(s.source(), s.target())); }
+
+    Rep // Line_3
+    operator()(Return_base_tag, const Ray_3& r) const
+    { return Rep(r.source(), Vector_3(r.source(), r.second_point())); }
+
+
+    Line_3
+    operator()(const Point_3& p, const Point_3& q) const
+    { return this->operator()(Return_base_tag(), p, q); }
+
+    Line_3
+    operator()(const Point_3& p, const Direction_3& d) const
+    { return this->operator()(Return_base_tag(), p, d); }
+
+    Line_3
+    operator()(const Point_3& p, const Vector_3& v) const
+    { return this->operator()(Return_base_tag(), p, v); }
+
+    Line_3
+    operator()(const Segment_3& s) const
+    { return this->operator()(Return_base_tag(), s); }
+
+    Line_3
+    operator()(const Ray_3& r) const
+    { return this->operator()(Return_base_tag(), r); }
+  };
+
+  template <typename K>
+  class Construct_midpoint_2
+  {
+    typedef typename K::FT        FT;
+    typedef typename K::Point_2   Point_2;
+  public:
+    typedef Point_2          result_type;
+
+    Point_2
+    operator()(const Point_2& p, const Point_2& q) const
+    {
+      typename K::Construct_point_2 construct_point_2;
+      FT x, y;
+      midpointC2(p.x(), p.y(), q.x(), q.y(), x, y);
+      return construct_point_2(x, y);
+    }
+  };
+
+  template <typename K>
+  class Construct_midpoint_3
+  {
+    typedef typename K::FT        FT;
+    typedef typename K::Point_3   Point_3;
+  public:
+    typedef Point_3               result_type;
+
+    Point_3
+    operator()(const Point_3& p, const Point_3& q) const
+    {
+      typename K::Construct_point_3 construct_point_3;
+      FT x, y, z;
+      midpointC3(p.x(), p.y(), p.z(), q.x(), q.y(), q.z(), x, y, z);
+      return construct_point_3(x, y, z);
+    }
+  };
+
+  template <typename K>
+  class Construct_opposite_vector_2
+  {
+    typedef typename K::Vector_2    Vector_2;
+  public:
+    typedef Vector_2                result_type;
+
+    Vector_2
+    operator()( const Vector_2& v) const
+    { return Vector_2(-v.x(), -v.y()); }
+  };
+
+  template <typename K>
+  class Construct_difference_of_vectors_2
+  {
+    typedef typename K::Vector_2    Vector_2;
+  public:
+    typedef Vector_2                result_type;
+
+    Vector_2
+    operator()( const Vector_2& v, const Vector_2& w) const
+    { return Vector_2(v.x()-w.x(), v.y()-w.y()); }
+  };
+
+  template <typename K>
+  class Construct_difference_of_vectors_3
+  {
+    typedef typename K::Vector_3    Vector_3;
+  public:
+    typedef Vector_3                result_type;
+
+    Vector_3
+    operator()( const Vector_3& v, const Vector_3& w) const
+    { return Vector_3(v.x()-w.x(), v.y()-w.y(), v.z()-w.z()); }
+  };
+
+  template <typename K>
+  class Construct_sum_of_vectors_2
+  {
+    typedef typename K::Vector_2    Vector_2;
+  public:
+    typedef Vector_2                result_type;
+
+    Vector_2
+    operator()( const Vector_2& v, const Vector_2& w) const
+    { return Vector_2(v.x()+w.x(), v.y()+w.y()); }
+  };
+
+  template <typename K>
+  class Construct_sum_of_vectors_3
+  {
+    typedef typename K::Vector_3    Vector_3;
+  public:
+    typedef Vector_3                result_type;
+
+    Vector_3
+    operator()( const Vector_3& v, const Vector_3& w) const
+    { return Vector_3(v.x()+w.x(), v.y()+w.y(), v.z()+w.z()); }
+  };
+
+  template <typename K>
+  class Construct_opposite_vector_3
+  {
+    typedef typename K::Vector_3    Vector_3;
+  public:
+    typedef Vector_3                result_type;
+
+    Vector_3
+    operator()( const Vector_3& v) const
+    { return Vector_3(-v.x(), -v.y(), -v.z()); }
+  };
+
+  template <typename K>
+  class Construct_orthogonal_vector_3
+  {
+    typedef typename K::FT FT;
+    typedef typename K::Point_3     Point_3;
+    typedef typename K::Vector_3    Vector_3;
+    typedef typename K::Plane_3     Plane_3;
+  public:
+    typedef Vector_3                result_type;
+
+    Vector_3
+    operator()( const Plane_3& p ) const
+    { return Vector_3(p.a(), p.b(), p.c()); }
+
+    Vector_3
+    operator()( const Point_3& p, const Point_3& q, const Point_3& r ) const
+    {
+      FT rpx = p.x()-r.x();
+      FT rpy = p.y()-r.y();
+      FT rpz = p.z()-r.z();
+      FT rqx = q.x()-r.x();
+      FT rqy = q.y()-r.y();
+      FT rqz = q.z()-r.z();
+      // Cross product rp * rq
+      FT vx = rpy*rqz - rqy*rpz;
+      FT vy = rpz*rqx - rqz*rpx;
+      FT vz = rpx*rqy - rqx*rpy;
+      typename K::Construct_vector_3 construct_vector;
+
+      return construct_vector(vx, vy, vz);
+    }
+  };
+
+  template <typename K>
+  class Construct_perpendicular_vector_2
+  {
+    typedef typename K::Vector_2   Vector_2;
+  public:
+    typedef Vector_2               result_type;
+
+    Vector_2
+    operator()( const Vector_2& v, Orientation o) const
+    {
+      CGAL_kernel_precondition( o != COLLINEAR );
+      if (o == COUNTERCLOCKWISE)
+	return K().construct_vector_2_object()(-v.y(), v.x());
+      else
+	return K().construct_vector_2_object()(v.y(), -v.x());
+    }
+  };
+
+  template <typename K>
+  class Construct_perpendicular_direction_2
+  {
+    typedef typename K::Direction_2   Direction_2;
+  public:
+    typedef Direction_2               result_type;
+
+    Direction_2
+    operator()( const Direction_2& d, Orientation o) const
+    {
+      CGAL_kernel_precondition( o != COLLINEAR );
+      if (o == COUNTERCLOCKWISE)
+	return K().construct_direction_2_object()(-d.dy(), d.dx());
+      else
+	return K().construct_direction_2_object()(d.dy(), -d.dx());
+    }
+  };
+
+
+  template <typename K>
+  class Construct_perpendicular_line_2
+  {
+    typedef typename K::Line_2    Line_2;
+    typedef typename K::Point_2   Point_2;
+  public:
+    typedef Line_2                result_type;
+
+    Line_2
+    operator()( const Line_2& l, const Point_2& p) const
+    {
+      typename K::FT fta, ftb, ftc;
+      perpendicular_through_pointC2(l.a(), l.b(), p.x(), p.y(), fta, ftb, ftc);
+      return Line_2(fta, ftb, ftc);
+    }
+  };
+
+
+  template <typename K>
+  class Construct_point_2
+  {
+    typedef typename K::RT         RT;
+    typedef typename K::Point_2    Point_2;
+    typedef typename K::Line_2     Line_2;
+    typedef typename Point_2::Rep  Rep;
+  public:
+    typedef Point_2                result_type;
+
+    Rep // Point_2
+    operator()(Return_base_tag, Origin o) const
+    { return Rep(o); }
+
+    Rep // Point_2
+    operator()(Return_base_tag, const RT& x, const RT& y) const
+    { return Rep(x, y); }
+
+    Rep // Point_2
+    operator()(Return_base_tag, const RT& x, const RT& y, const RT& w) const
+    { return Rep(x, y, w); }
+
+    Point_2
+    operator()(const Line_2& l) const
+    {
+      typename K::Construct_point_2 construct_point_2;
+      typename K::FT x, y;
+      line_get_pointC2(l.a(), l.b(), l.c(), 0, x, y);
+      return construct_point_2(x,y);
+    }
+
+    Point_2
+    operator()(const Line_2& l, int i) const
+    {
+      typename K::Construct_point_2 construct_point_2;
+      typename K::FT x, y;
+      line_get_pointC2(l.a(), l.b(), l.c(), i, x, y);
+      return construct_point_2(x,y);
+    }
+
+
+    Point_2
+    operator()(Origin o) const
+    { return Point_2(o); }
+
+    Point_2
+    operator()(const RT& x, const RT& y) const
+    { return Point_2(x, y); }
+
+    Point_2
+    operator()(const RT& x, const RT& y, const RT& w) const
+    { return Point_2(x, y, w); }
+  };
+
+  template <typename K>
+  class Construct_point_3
+  {
+    typedef typename K::RT         RT;
+    typedef typename K::Point_3    Point_3;
+    typedef typename Point_3::Rep  Rep;
+  public:
+    typedef Point_3          result_type;
+
+    Rep // Point_3
+    operator()(Return_base_tag, Origin o) const
+    { return Rep(o); }
+
+    Rep // Point_3
+    operator()(Return_base_tag, const RT& x, const RT& y, const RT& z) const
+    { return Rep(x, y, z); }
+
+    Rep // Point_3
+    operator()(Return_base_tag, const RT& x, const RT& y, const RT& z, const RT& w) const
+    { return Rep(x, y, z, w); }
+
+
+    Point_3
+    operator()(Origin o) const
+    { return Point_3(o); }
+
+    Point_3
+    operator()(const RT& x, const RT& y, const RT& z) const
+    { return Point_3(x, y, z); }
+
+    Point_3
+    operator()(const RT& x, const RT& y, const RT& z, const RT& w) const
+    { return Point_3(x, y, z, w); }
+  };
+
+
+  template <typename K>
+  class Construct_projected_point_2
+  {
+    typedef typename K::Point_2    Point_2;
+    typedef typename K::Line_2     Line_2;
+  public:
+    typedef Point_2                result_type;
+
+    Point_2
+    operator()( const Line_2& l, const Point_2& p ) const
+    {
+      typename K::FT x, y;
+      typename K::Construct_point_2 construct_point_2;
+      line_project_pointC2(l.a(), l.b(), l.c(), p.x(), p.y(), x, y);
+      return construct_point_2(x, y);
+    }
+  };
+
+
+  template <typename K>
+  class Construct_projected_point_3
+  {
+    typedef typename K::Point_3    Point_3;
+    typedef typename K::Plane_3    Plane_3;
+    typedef typename K::Line_3     Line_3;
+    typedef typename K::FT         FT;
+  public:
+    typedef Point_3                result_type;
+
+    Point_3
+    operator()( const Line_3& l, const Point_3& p ) const
+    {
+      // projects p on the line l
+      FT lpx = l.point().x();
+      FT lpy = l.point().y();
+      FT lpz = l.point().z();
+      FT ldx = l.direction().dx();
+      FT ldy = l.direction().dy();
+      FT ldz = l.direction().dz();
+      FT dpx = p.x()-lpx;
+      FT dpy = p.y()-lpy;
+      FT dpz = p.z()-lpz;
+      FT lambda = (ldx*dpx+ldy*dpy+ldz*dpz) / (ldx*ldx+ldy*ldy+ldz*ldz);
+      return Point_3(lpx + lambda * ldx,
+                     lpy + lambda * ldy,
+                     lpz + lambda * ldz);
+    }
+
+    Point_3
+    operator()( const Plane_3& h, const Point_3& p ) const
+    { return h.rep().projection(p); }
+  };
+
+  template <class K> 
+  class Construct_radical_line_2
+  {
+    typedef typename K::Line_2            Line_2;
+    typedef typename K::Circle_2          Circle_2;
+    typedef typename K::FT                 FT;
+
+  public:
+
+    typedef Line_2 result_type;
+
+    result_type 
+    operator() (const Circle_2 & c1, const Circle_2 & c2) const
+	  {
+      // Concentric Circles don't have radical line
+      CGAL_kernel_precondition (c1.center() != c2.center());
+      const FT a = 2*(c2.center().x() - c1.center().x());
+      const FT b = 2*(c2.center().y() - c1.center().y());
+      const FT c = CGAL::square(c1.center().x()) + 
+        CGAL::square(c1.center().y()) - c1.squared_radius() -
+        CGAL::square(c2.center().x()) -
+        CGAL::square(c2.center().y()) + c2.squared_radius();
+      return Line_2(a, b, c);
+    }
+  };
+
+  template <class K> 
+  class Construct_radical_plane_3
+  {
+    typedef typename K::Plane_3            Plane_3;
+    typedef typename K::Sphere_3           Sphere_3;
+    typedef typename K::FT                 FT;
+
+  public:
+
+    typedef Plane_3 result_type;
+
+    result_type 
+    operator() (const Sphere_3 & s1, const Sphere_3 & s2) const
+    {
+      // Concentric Spheres don't have radical plane
+      CGAL_kernel_precondition (s1.center() != s2.center());
+      const FT a = 2*(s2.center().x() - s1.center().x());
+      const FT b = 2*(s2.center().y() - s1.center().y());
+      const FT c = 2*(s2.center().z() - s1.center().z());
+      const FT d = CGAL::square(s1.center().x()) + 
+        CGAL::square(s1.center().y()) +
+        CGAL::square(s1.center().z()) - s1.squared_radius() -
+        CGAL::square(s2.center().x()) -
+        CGAL::square(s2.center().y()) -
+        CGAL::square(s2.center().z()) + s2.squared_radius();
+      return Plane_3(a, b, c, d);
+    }
+  };
+
+
+  template <typename K>
+  class Construct_scaled_vector_2
+  {
+    typedef typename K::FT         FT;
+    typedef typename K::Vector_2   Vector_2;
+  public:
+    typedef Vector_2               result_type;
+
+    Vector_2
+    operator()( const Vector_2& v, const FT& c) const
+    {
+      return Vector_2(c * v.x(), c * v.y());
+    }
+  };
+
+  template <typename K>
+  class Construct_divided_vector_2
+  {
+    typedef typename K::FT         FT;
+    typedef typename K::Vector_2   Vector_2;
+  public:
+    typedef Vector_2               result_type;
+
+    Vector_2
+    operator()( const Vector_2& v, const FT& c) const
+    {
+      return Vector_2(v.x()/c, v.y()/c);
+    }
+  };
+
+  template <typename K>
+  class Construct_divided_vector_3
+  {
+    typedef typename K::FT         FT;
+    typedef typename K::Vector_3   Vector_3;
+  public:
+    typedef Vector_3               result_type;
+
+    Vector_3
+    operator()( const Vector_3& v, const FT& c) const
+    {
+      return Vector_3(v.x()/c, v.y()/c, v.z()/c);
+    }
+  };
+
+  template <typename K>
+  class Construct_scaled_vector_3
+  {
+    typedef typename K::FT         FT;
+    typedef typename K::Vector_3   Vector_3;
+  public:
+    typedef Vector_3               result_type;
+
+    Vector_3
+    operator()( const Vector_3& w, const FT& c) const
+    {
+      return Vector_3(c * w.x(), c * w.y(), c * w.z());
+    }
+  };
+
+  template <typename K>
+  class Construct_translated_point_2
+  {
+    typedef typename K::Point_2   Point_2;
+    typedef typename K::Vector_2  Vector_2;
+  public:
+    typedef Point_2               result_type;
+
+    Point_2
+    operator()( const Point_2& p, const Vector_2& v) const
+    {
+      typename K::Construct_point_2 construct_point_2;
+      return construct_point_2(p.x() + v.x(), p.y() + v.y());
+    }
+
+    Point_2
+    operator()( const Origin& , const Vector_2& v) const
+    {
+      typename K::Construct_point_2 construct_point_2;
+      return construct_point_2(v.x(), v.y());
+    }
+  };
+
+  template <typename K>
+  class Construct_translated_point_3
+  {
+    typedef typename K::Point_3   Point_3;
+    typedef typename K::Vector_3  Vector_3;
+  public:
+    typedef Point_3               result_type;
+
+    Point_3
+    operator()( const Point_3& p, const Vector_3& v) const
+    {
+      typename K::Construct_point_3 construct_point_3;
+      return construct_point_3(p.x() + v.x(), p.y() + v.y(), p.z() + v.z());
+    }
+
+    Point_3
+    operator()( const Origin& , const Vector_3& v) const
+    {
+      typename K::Construct_point_3 construct_point_3;
+      return construct_point_3(v.x(), v.y(), v.z());
+    }
+  };
+
+  template <typename K>
+  class Construct_vector_2
+  {
+    typedef typename K::RT           RT;
+    typedef typename K::FT           FT;
+    typedef typename K::Segment_2    Segment_2;
+    typedef typename K::Ray_2        Ray_2;
+    typedef typename K::Line_2       Line_2;
+    typedef typename K::Vector_2     Vector_2;
+    typedef typename K::Point_2      Point_2;
+    typedef typename K::Direction_2  Direction_2;
+    typedef typename Vector_2::Rep   Rep;
+  public:
+    typedef Vector_2                 result_type;
+
+    Rep // Vector_2
+    operator()(Return_base_tag, const Point_2& p, const Point_2& q) const
+    { return Rep(q.x() - p.x(), q.y() - p.y()); }
+
+    Rep // Vector_2
+    operator()(Return_base_tag, const Origin&, const Point_2& q) const
+    { return Rep(q.x(), q.y()); }
+
+    Rep // Vector_2
+    operator()(Return_base_tag, const Point_2& p, const Origin& ) const
+    { return Rep(-p.x(), -p.y()); }
+
+    Rep // Vector_2
+    operator()(Return_base_tag, const Direction_2& d ) const
+    { return Rep(d.dx(), d.dy()); }
+
+    Vector_2
+    operator()(Return_base_tag, const Segment_2& s) const
+    { return s.to_vector(); }
+
+    Vector_2
+    operator()(Return_base_tag, const Ray_2& r) const
+    { return r.to_vector(); }
+
+    Rep // Vector_2
+    operator()(Return_base_tag, const Line_2& l) const
+    { return Rep(l.b(), -l.a()); }
+
+    Rep // Vector_2
+    operator()(Return_base_tag, Null_vector) const
+    { return Rep(FT(0), FT(0)); }
+
+    Rep // Vector_2
+    operator()(Return_base_tag, const RT& x, const RT& y) const
+    { return Rep(x, y); }
+
+    Rep // Vector_2
+    operator()(Return_base_tag, const RT& x, const RT& y, const RT& w) const
+    { return Rep(x, y, w); }
+
+
+
+    Vector_2
+    operator()( const Point_2& p, const Point_2& q) const
+    { return this->operator()(Return_base_tag(), p, q); }
+
+    Vector_2
+    operator()( const Origin& o, const Point_2& q) const
+    { return this->operator()(Return_base_tag(), o, q); }
+
+    Vector_2
+    operator()( const Point_2& p, const Origin& o) const
+    { return this->operator()(Return_base_tag(), p, o); }
+
+    Vector_2
+    operator()( const Direction_2& d ) const
+    { return this->operator()(Return_base_tag(), d); }
+
+    Vector_2
+    operator()( const Segment_2& s) const
+    { return this->operator()(Return_base_tag(), s); }
+
+    Vector_2
+    operator()( const Ray_2& r) const
+    { return this->operator()(Return_base_tag(), r); }
+
+    Vector_2
+    operator()( const Line_2& l) const
+    { return this->operator()(Return_base_tag(), l); }
+
+    Vector_2
+    operator()( Null_vector n) const
+    { return this->operator()(Return_base_tag(), n); }
+
+    Vector_2
+    operator()( const RT& x, const RT& y) const
+    { return this->operator()(Return_base_tag(), x, y); }
+
+    Vector_2
+    operator()( const RT& x, const RT& y, const RT& w) const
+    { return this->operator()(Return_base_tag(), x, y, w); }
+  };
+
+  template <typename K>
+  class Construct_vector_3
+  {
+    typedef typename K::RT           RT;
+    typedef typename K::FT           FT;
+    typedef typename K::Segment_3    Segment_3;
+    typedef typename K::Direction_3  Direction_3;
+    typedef typename K::Ray_3        Ray_3;
+    typedef typename K::Line_3       Line_3;
+    typedef typename K::Vector_3     Vector_3;
+    typedef typename K::Point_3      Point_3;
+    typedef typename Vector_3::Rep   Rep;
+  public:
+    typedef Vector_3                 result_type;
+
+    Rep // Vector_3
+    operator()(Return_base_tag, const Point_3& p, const Point_3& q) const
+    {
+      return Rep(q.x() - p.x(), q.y() - p.y(), q.z() - p.z());
+    }
+
+    Rep // Vector_3
+    operator()(Return_base_tag, const Origin&, const Point_3& q) const
+    {
+      return Rep(q.x(), q.y(), q.z());
+    }
+
+    Rep // Vector_3
+    operator()(Return_base_tag, const Point_3& p, const Origin&) const
+    {
+      return Rep(- p.x(), - p.y(), - p.z());
+    }
+
+    Rep // Vector_3
+    operator()(Return_base_tag, const Direction_3& d) const
+    { return d.rep().to_vector(); }
+
+    Rep // Vector_3
+    operator()(Return_base_tag, const Segment_3& s) const
+    { return s.rep().to_vector(); }
+
+    Rep // Vector_3
+    operator()(Return_base_tag, const Ray_3& r) const
+    { return r.rep().to_vector(); }
+
+    Rep // Vector_3
+    operator()(Return_base_tag, const Line_3& l) const
+    { return l.rep().to_vector(); }
+
+    Rep // Vector_3
+    operator()(Return_base_tag, const Null_vector&) const
+    { return Rep(FT(0), FT(0), FT(0)); }
+
+    Rep // Vector_3
+    operator()(Return_base_tag, const RT& x, const RT& y, const RT& z) const
+    { return Rep(x, y, z); }
+
+    Rep // Vector_3
+    operator()(Return_base_tag, const RT& x, const RT& y, const RT& z, const RT& w) const
+    { return Rep(x, y, z, w); }
+
+
+    Vector_3
+    operator()( const Point_3& p, const Point_3& q) const
+    { return this->operator()(Return_base_tag(), p, q); }
+
+    Vector_3
+    operator()( const Origin& o, const Point_3& q) const
+    { return this->operator()(Return_base_tag(), o, q); }
+
+    Vector_3
+    operator()( const Point_3& p, const Origin& q) const
+    { return this->operator()(Return_base_tag(), p, q); }
+
+    Vector_3
+    operator()( const Direction_3& d) const
+    { return this->operator()(Return_base_tag(), d); }
+
+    Vector_3
+    operator()( const Segment_3& s) const
+    { return this->operator()(Return_base_tag(), s); }
+
+    Vector_3
+    operator()( const Ray_3& r) const
+    { return this->operator()(Return_base_tag(), r); }
+
+    Vector_3
+    operator()( const Line_3& l) const
+    { return this->operator()(Return_base_tag(), l); }
+
+    Vector_3
+    operator()( const Null_vector& n) const
+    { return this->operator()(Return_base_tag(), n); }
+
+    Vector_3
+    operator()( int x, int y, int z) const
+    { return this->operator()(Return_base_tag(), x, y, z); }
+
+    Vector_3
+    operator()( const RT& x, const RT& y, const RT& z) const
+    { return this->operator()(Return_base_tag(), x, y, z); }
+
+    Vector_3
+    operator()( const RT& x, const RT& y, const RT& z, const RT& w) const
+    { return this->operator()(Return_base_tag(), x, y, z, w); }
+  };
+
+  template <typename K>
+  class Construct_vertex_2
+  {
+    typedef typename K::Point_2          Point_2;
+    typedef typename K::Segment_2        Segment_2;
+    typedef typename K::Iso_rectangle_2  Iso_rectangle_2;
+    typedef typename K::Triangle_2       Triangle_2;
+  public:
+    template<class>
+    struct result {
+      typedef const Point_2& type;
+    };
+    
+    template<typename F>
+    struct result<F(Iso_rectangle_2, int)> {
+      typedef Point_2 type;
+    };
+
+    const Point_2 &
+    operator()( const Segment_2& s, int i) const
+    { return s.vertex(i); }
+
+    const Point_2 &
+    operator()( const Triangle_2& t, int i) const
+    { return t.rep().vertex(i); }
+
+    Point_2
+    operator()( const Iso_rectangle_2& r, int i) const
+    {
+      switch (i%4) {
+      case 0: return (r.min)();
+      case 1: return Point_2(r.xmax(), r.ymin());
+      case 2: return (r.max)();
+      default: return Point_2(r.xmin(), r.ymax());
+      }
+    }
+  };
+
+} //namespace CartesianKernelFunctors
+
+namespace CartesianKernelFunctors {
+
+  template <typename K>
+  class Coplanar_orientation_3
+  {
+    typedef typename K::Point_3      Point_3;
+#ifdef CGAL_kernel_exactness_preconditions
+    typedef typename K::Coplanar_3   Coplanar_3;
+    typedef typename K::Collinear_3  Collinear_3;
+    Coplanar_3 cp;
+    Collinear_3 cl;
+#endif // CGAL_kernel_exactness_preconditions
+  public:
+    typedef typename K::Orientation  result_type;
+
+#ifdef CGAL_kernel_exactness_preconditions
+    Coplanar_orientation_3() {}
+    Coplanar_orientation_3(const Coplanar_3& cp_, const Collinear_3& cl_)
+      : cp(cp_), cl(cl_)
+    {}
+#endif // CGAL_kernel_exactness_preconditions
+
+    result_type
+    operator()(const Point_3& p, const Point_3& q, const Point_3& r) const
+    {
+      return coplanar_orientationC3(p.x(), p.y(), p.z(),
+				    q.x(), q.y(), q.z(),
+				    r.x(), r.y(), r.z());
+    }
+
+    result_type
+    operator()( const Point_3& p, const Point_3& q,
+	        const Point_3& r, const Point_3& s) const
+    {
+      // p,q,r,s supposed to be coplanar
+      // p,q,r supposed to be non collinear
+      // tests whether s is on the same side of p,q as r
+      // returns :
+      // COLLINEAR if pqr collinear
+      // POSITIVE if qrp and qrs have the same orientation
+      // NEGATIVE if qrp and qrs have opposite orientations
+      CGAL_kernel_exactness_precondition( ! cl(p, q, r) );
+      CGAL_kernel_exactness_precondition( cp(p, q, r, s) );
+      return coplanar_orientationC3(p.x(), p.y(), p.z(),
+				    q.x(), q.y(), q.z(),
+				    r.x(), r.y(), r.z(),
+				    s.x(), s.y(), s.z());
+    }
+  };
+
+  template <typename K>
+  class Coplanar_side_of_bounded_circle_3
+  {
+    typedef typename K::Point_3   Point_3;
+#ifdef CGAL_kernel_exactness_preconditions
+    typedef typename K::Coplanar_3   Coplanar_3;
+    typedef typename K::Collinear_3  Collinear_3;
+    Coplanar_3 cp;
+    Collinear_3 cl;
+#endif // CGAL_kernel_exactness_preconditions
+  public:
+    typedef typename K::Bounded_side     result_type;
+
+#ifdef CGAL_kernel_exactness_preconditions
+    Coplanar_side_of_bounded_circle_3() {}
+    Coplanar_side_of_bounded_circle_3(const Coplanar_3& cp_,
+				      const Collinear_3& cl_)
+      : cp(cp_), cl(cl_)
+    {}
+#endif // CGAL_kernel_exactness_preconditions
+
+    result_type
+    operator()( const Point_3& p, const Point_3& q,
+	        const Point_3& r, const Point_3& t) const
+    {
+      // p,q,r,t are supposed to be coplanar.
+      // p,q,r determine an orientation of this plane (not collinear).
+      // returns the equivalent of side_of_bounded_circle(p,q,r,t)
+      // in this plane
+      CGAL_kernel_exactness_precondition( cp(p,q,r,t) );
+      CGAL_kernel_exactness_precondition( !cl(p,q,r) );
+      return coplanar_side_of_bounded_circleC3(p.x(), p.y(), p.z(),
+					       q.x(), q.y(), q.z(),
+					       r.x(), r.y(), r.z(),
+					       t.x(), t.y(), t.z());
+    }
+  };
+
+  template <typename K>
+  class Equal_xy_3
+  {
+    typedef typename K::Point_3    Point_3;
+  public:
+    typedef typename K::Boolean    result_type;
+
+    result_type
+    operator()( const Point_3& p, const Point_3& q) const
+    {
+      return CGAL_AND( p.x() == q.x() , p.y() == q.y() );
+    }
+  };
+
+  template <typename K>
+  class Equal_x_2
+  {
+    typedef typename K::Point_2    Point_2;
+  public:
+    typedef typename K::Boolean    result_type;
+
+    result_type
+    operator()( const Point_2& p, const Point_2& q) const
+    { return p.x() == q.x(); }
+  };
+
+  template <typename K>
+  class Equal_x_3
+  {
+    typedef typename K::Point_3    Point_3;
+  public:
+    typedef typename K::Boolean    result_type;
+
+    result_type
+    operator()( const Point_3& p, const Point_3& q) const
+    { return p.x() == q.x(); }
+  };
+
+  template <typename K>
+  class Equal_y_2
+  {
+    typedef typename K::Point_2    Point_2;
+  public:
+    typedef typename K::Boolean    result_type;
+
+    result_type
+    operator()( const Point_2& p, const Point_2& q) const
+    { return p.y() == q.y(); }
+  };
+
+  template <typename K>
+  class Equal_y_3
+  {
+    typedef typename K::Point_3    Point_3;
+  public:
+    typedef typename K::Boolean    result_type;
+
+    result_type
+    operator()( const Point_3& p, const Point_3& q) const
+    { return p.y() == q.y(); }
+  };
+
+  template <typename K>
+  class Equal_z_3
+  {
+    typedef typename K::Point_3    Point_3;
+  public:
+    typedef typename K::Boolean    result_type;
+
+    result_type
+    operator()( const Point_3& p, const Point_3& q) const
+    { return p.z() == q.z(); }
+  };
+
+  template <typename K>
+  class Has_on_3
+  {
+    typedef typename K::FT               FT;
+    typedef typename K::Point_3          Point_3;
+    typedef typename K::Vector_3         Vector_3;
+    typedef typename K::Line_3           Line_3;
+    typedef typename K::Ray_3            Ray_3;
+    typedef typename K::Segment_3        Segment_3;
+    typedef typename K::Plane_3          Plane_3;
+    typedef typename K::Triangle_3       Triangle_3;
+    typedef typename K::Circle_3         Circle_3;
+    typedef typename K::Sphere_3         Sphere_3;
+  public:
+    typedef typename K::Boolean          result_type;
+
+    result_type
+    operator()( const Line_3& l, const Point_3& p) const
+    { return l.rep().has_on(p); }
+
+    result_type
+    operator()( const Ray_3& r, const Point_3& p) const
+    { return r.rep().has_on(p); }
+
+    result_type
+    operator()( const Segment_3& s, const Point_3& p) const
+    { return s.has_on(p); }
+
+    result_type
+    operator()( const Plane_3& pl, const Point_3& p) const
+    { return pl.rep().has_on(p); }
+
+    result_type
+    operator()( const Plane_3& pl, const Line_3& l) const
+    { return pl.rep().has_on(l); }
+
+    result_type
+    operator()( const Triangle_3& t, const Point_3& p) const
+    {
+      Point_3  o  = t.vertex(0) + t.supporting_plane().orthogonal_vector();
+      Vector_3 v0 = t.vertex(0)-o,
+               v1 = t.vertex(1)-o,
+               v2 = t.vertex(2)-o;
+
+      FT alpha, beta, gamma;
+      Cartesian_internal::solve(v0, v1, v2, p-o, alpha, beta, gamma);
+      return (alpha >= FT(0)) && (beta >= FT(0)) && (gamma >= FT(0))
+          && ((alpha+beta+gamma == FT(1)));
+    }
+
+    result_type
+    operator()(const Circle_3 &a, const Point_3 &p) const
+    { return a.rep().has_on(p); }
+
+    result_type
+    operator()(const Sphere_3 &a, const Circle_3 &p) const
+    { return a.rep().has_on(p); }
+
+    result_type
+    operator()(const Sphere_3 &a, const Point_3 &p) const
+    { return a.rep().has_on(p); }    
+    
+    result_type
+    operator()(const Plane_3 &a, const Circle_3 &p) const
+    { return a.rep().has_on(p); }
+
+
+  };
+
+  template <typename K>
+  class Less_distance_to_point_2
+  {
+    typedef typename K::Point_2   Point_2;
+  public:
+    typedef typename K::Boolean   result_type;
+
+    result_type
+    operator()(const Point_2& p, const Point_2& q, const Point_2& r) const
+    {
+      return has_smaller_dist_to_pointC2(p.x(), p.y(),
+					 q.x(), q.y(),
+					 r.x(), r.y());
+    }
+  };
+
+  template <typename K>
+  class Less_distance_to_point_3
+  {
+    typedef typename K::Point_3   Point_3;
+  public:
+    typedef typename K::Boolean   result_type;
+
+    result_type
+    operator()(const Point_3& p, const Point_3& q, const Point_3& r) const
+    {
+      return has_smaller_dist_to_pointC3(p.x(), p.y(), p.z(),
+					 q.x(), q.y(), q.z(),
+					 r.x(), r.y(), r.z());
+    }
+  };
+
+  // TODO ...
+  template <typename K>
+  class Less_signed_distance_to_line_2
+  {
+    typedef typename K::Point_2   Point_2;
+    typedef typename K::Line_2    Line_2;
+    typedef typename K::Equal_2   Equal_2;
+  public:
+    typedef typename K::Boolean   result_type;
+
+    result_type
+    operator()(const Point_2& a, const Point_2& b,
+               const Point_2& c, const Point_2& d) const
+    {
+      CGAL_kernel_precondition_code(Equal_2 equal;)
+      CGAL_kernel_precondition(! equal(a,b));
+      return cmp_signed_dist_to_lineC2( a.x(), a.y(),
+					b.x(), b.y(),
+					c.x(), c.y(),
+					d.x(), d.y()) == SMALLER;
+    }
+
+    result_type
+    operator()(const Line_2& l, const Point_2& p, const Point_2& q) const
+    {
+      return has_smaller_signed_dist_to_directionC2(l.a(), l.b(),
+						    p.x(), p.y(),
+						    q.x(), q.y());
+    }
+  };
+
+  template <typename K>
+  class Less_signed_distance_to_plane_3
+  {
+    typedef typename K::Point_3       Point_3;
+    typedef typename K::Plane_3       Plane_3;
+    typedef typename K::Collinear_3   Collinear_3;
+  public:
+    typedef typename K::Boolean       result_type;
+
+    result_type
+    operator()( const Plane_3& h, const Point_3& p, const Point_3& q) const
+    {
+      return has_smaller_signed_dist_to_directionC3(h.a(), h.b(), h.c(),
+						    p.x(), p.y(), p.z(),
+						    q.x(), q.y(), q.z());
+    }
+
+    result_type
+    operator()( const Point_3& hp, const Point_3& hq,  const Point_3& hr,
+		const Point_3& p, const Point_3& q) const
+    {
+      CGAL_kernel_precondition_code(Collinear_3 collinear_3;)
+      CGAL_kernel_precondition(! collinear_3(hp, hq, hr));
+      return has_smaller_signed_dist_to_planeC3(hp.x(), hp.y(), hp.z(),
+						hq.x(), hq.y(), hq.z(),
+						hr.x(), hr.y(), hr.z(),
+						p.x(),  p.y(),  p.z(),
+						q.x(),  q.y(),  q.z());;
+    }
+  };
+
+  template <typename K>
+  class Less_xyz_3
+  {
+    typedef typename K::Point_3         Point_3;
+    typedef typename K::Compare_xyz_3   Compare_xyz_3;
+    Compare_xyz_3 c;
+  public:
+    typedef typename K::Boolean         result_type;
+
+    Less_xyz_3() {}
+    Less_xyz_3(const Compare_xyz_3& c_) : c(c_) {}
+
+    result_type
+    operator()( const Point_3& p, const Point_3& q) const
+    { return c(p, q) == SMALLER; }
+  };
+
+  template <typename K>
+  class Less_xy_2
+  {
+    typedef typename K::Point_2        Point_2;
+    typedef typename K::Compare_xy_2   Compare_xy_2;
+    Compare_xy_2 c;
+  public:
+    typedef typename K::Boolean        result_type;
+
+    Less_xy_2() {}
+    Less_xy_2(const Compare_xy_2& c_) : c(c_) {}
+
+    result_type
+    operator()( const Point_2& p, const Point_2& q) const
+    { return c(p, q) == SMALLER; }
+  };
+
+  template <typename K>
+  class Less_xy_3
+  {
+    typedef typename K::Point_3        Point_3;
+    typedef typename K::Compare_xy_3   Compare_xy_3;
+    Compare_xy_3 c;
+  public:
+    typedef typename K::Boolean        result_type;
+
+    Less_xy_3() {}
+    Less_xy_3(const Compare_xy_3& c_) : c(c_) {}
+
+    result_type
+    operator()( const Point_3& p, const Point_3& q) const
+    { return c(p, q) == SMALLER; }
+  };
+
+  template <typename K>
+  class Less_x_2
+  {
+    typedef typename K::Point_2        Point_2;
+  public:
+    typedef typename K::Boolean        result_type;
+
+    result_type
+    operator()( const Point_2& p, const Point_2& q) const
+    { return p.x() < q.x(); }
+  };
+
+  template <typename K>
+  class Less_x_3
+  {
+    typedef typename K::Point_3        Point_3;
+  public:
+    typedef typename K::Boolean        result_type;
+
+    result_type
+    operator()( const Point_3& p, const Point_3& q) const
+    { return p.x() < q.x(); }
+  };
+
+  template <typename K>
+  class Less_yx_2
+  {
+    typedef typename K::Point_2        Point_2;
+  public:
+    typedef typename K::Boolean        result_type;
+
+    result_type
+    operator()( const Point_2& p, const Point_2& q) const
+    {
+      return compare_lexicographically_xyC2(p.y(), p.x(),
+					    q.y(), q.x()) == SMALLER;
+    }
+  };
+
+  template <typename K>
+  class Less_y_2
+  {
+    typedef typename K::Point_2        Point_2;
+  public:
+    typedef typename K::Boolean        result_type;
+
+    result_type
+    operator()( const Point_2& p, const Point_2& q) const
+    { return p.y() < q.y(); }
+  };
+
+  template <typename K>
+  class Less_y_3
+  {
+    typedef typename K::Point_3        Point_3;
+  public:
+    typedef typename K::Boolean        result_type;
+
+    result_type
+    operator()( const Point_3& p, const Point_3& q) const
+    { return p.y() < q.y(); }
+  };
+
+  template <typename K>
+  class Less_z_3
+  {
+    typedef typename K::Point_3        Point_3;
+  public:
+    typedef typename K::Boolean        result_type;
+
+    result_type
+    operator()( const Point_3& p, const Point_3& q) const
+    { return p.z() < q.z(); }
+  };
+
+  template <typename K>
+  class Orientation_2
+  {
+    typedef typename K::Point_2       Point_2;
+    typedef typename K::Vector_2      Vector_2;
+    typedef typename K::Circle_2      Circle_2;
+  public:
+    typedef typename K::Orientation   result_type;
+
+    result_type
+    operator()(const Point_2& p, const Point_2& q, const Point_2& r) const
+    {
+      return orientationC2(p.x(), p.y(), q.x(), q.y(), r.x(), r.y());
+    }
+
+    result_type
+    operator()(const Vector_2& u, const Vector_2& v) const
+    {
+      return orientationC2(u.x(), u.y(), v.x(), v.y());
+    }
+
+    result_type
+    operator()(const Circle_2& c) const
+    {
+      return c.rep().orientation();
+    }
+  };
+
+  template <typename K>
+  class Orientation_3
+  {
+    typedef typename K::Point_3        Point_3;
+    typedef typename K::Vector_3       Vector_3;
+    typedef typename K::Tetrahedron_3  Tetrahedron_3;
+    typedef typename K::Sphere_3       Sphere_3;
+  public:
+    typedef typename K::Orientation    result_type;
+
+    result_type
+    operator()( const Point_3& p, const Point_3& q,
+	        const Point_3& r, const Point_3& s) const
+    {
+      return orientationC3(p.x(), p.y(), p.z(),
+			   q.x(), q.y(), q.z(),
+			   r.x(), r.y(), r.z(),
+			   s.x(), s.y(), s.z());
+    }
+
+    result_type
+    operator()( const Vector_3& u, const Vector_3& v, const Vector_3& w) const
+    {
+      return orientationC3(u.x(), u.y(), u.z(),
+			   v.x(), v.y(), v.z(),
+			   w.x(), w.y(), w.z());
+    }
+
+    result_type
+    operator()( const Tetrahedron_3& t) const
+    {
+      return t.rep().orientation();
+    }
+
+    result_type
+    operator()(const Sphere_3& s) const
+    {
+      return s.rep().orientation();
+    }
+  };
+
+  template <typename K>
+  class Oriented_side_2
+  {
+    typedef typename K::Point_2        Point_2;
+    typedef typename K::Circle_2       Circle_2;
+    typedef typename K::Line_2         Line_2;
+    typedef typename K::Triangle_2     Triangle_2;
+  public:
+    typedef typename K::Oriented_side  result_type;
+
+    result_type
+    operator()( const Circle_2& c, const Point_2& p) const
+    { return enum_cast<Oriented_side>(c.bounded_side(p)) * c.orientation(); }
+
+    result_type
+    operator()( const Line_2& l, const Point_2& p) const
+    { return side_of_oriented_lineC2(l.a(), l.b(), l.c(), p.x(), p.y()); }
+
+    result_type
+    operator()( const Triangle_2& t, const Point_2& p) const
+    {
+      typename K::Collinear_are_ordered_along_line_2
+	collinear_are_ordered_along_line;
+      typename K::Orientation_2 orientation;
+      // depends on the orientation of the vertices
+      typename K::Orientation
+                  o1 = orientation(t.vertex(0), t.vertex(1), p),
+	          o2 = orientation(t.vertex(1), t.vertex(2), p),
+	          o3 = orientation(t.vertex(2), t.vertex(3), p),
+	          ot = orientation(t.vertex(0), t.vertex(1), t.vertex(2));
+
+      if (o1 == ot && o2 == ot && o3 == ot) // ot cannot be COLLINEAR
+	return ot;
+      return
+	(o1 == COLLINEAR
+	 && collinear_are_ordered_along_line(t.vertex(0), p, t.vertex(1))) ||
+	(o2 == COLLINEAR
+	 && collinear_are_ordered_along_line(t.vertex(1), p, t.vertex(2))) ||
+	(o3 == COLLINEAR
+	 && collinear_are_ordered_along_line(t.vertex(2), p, t.vertex(3)))
+	? result_type(ON_ORIENTED_BOUNDARY)
+	: opposite(ot);
+    }
+  };
+
+  template <typename K>
+  class Side_of_bounded_circle_2
+  {
+    typedef typename K::Point_2        Point_2;
+  public:
+    typedef typename K::Bounded_side   result_type;
+
+    result_type
+    operator()( const Point_2& p, const Point_2& q, const Point_2& t) const
+    {
+      return side_of_bounded_circleC2(p.x(), p.y(),
+				      q.x(), q.y(),
+				      t.x(), t.y());
+    }
+
+    result_type
+    operator()( const Point_2& p, const Point_2& q,
+	        const Point_2& r, const Point_2& t) const
+    {
+      return side_of_bounded_circleC2(p.x(), p.y(), q.x(), q.y(), r.x(), r.y(),
+				      t.x(), t.y());
+    }
+  };
+
+  template <typename K>
+  class Side_of_bounded_sphere_3
+  {
+    typedef typename K::Point_3        Point_3;
+  public:
+    typedef typename K::Bounded_side   result_type;
+
+    result_type
+    operator()( const Point_3& p, const Point_3& q, const Point_3& test) const
+    {
+      return side_of_bounded_sphereC3(p.x(), p.y(), p.z(),
+				      q.x(), q.y(), q.z(),
+				      test.x(), test.y(), test.z());
+    }
+
+    result_type
+    operator()( const Point_3& p, const Point_3& q,
+	        const Point_3& r, const Point_3& test) const
+    {
+      return side_of_bounded_sphereC3(p.x(), p.y(), p.z(),
+				      q.x(), q.y(), q.z(),
+				      r.x(), r.y(), r.z(),
+				      test.x(), test.y(), test.z());
+    }
+
+    result_type
+    operator()( const Point_3& p, const Point_3& q, const Point_3& r,
+	        const Point_3& s, const Point_3& test) const
+    {
+      return side_of_bounded_sphereC3(p.x(), p.y(), p.z(),
+				      q.x(), q.y(), q.z(),
+				      r.x(), r.y(), r.z(),
+				      s.x(), s.y(), s.z(),
+				      test.x(), test.y(), test.z());
+    }
+  };
+
+  template <typename K>
+  class Side_of_oriented_circle_2
+  {
+    typedef typename K::Point_2        Point_2;
+  public:
+    typedef typename K::Oriented_side  result_type;
+
+    result_type
+    operator()( const Point_2& p, const Point_2& q,
+	        const Point_2& r, const Point_2& t) const
+    {
+      return side_of_oriented_circleC2(p.x(), p.y(),
+				       q.x(), q.y(),
+				       r.x(), r.y(),
+				       t.x(), t.y());
+    }
+  };
+
+  template <typename K>
+  class Side_of_oriented_sphere_3
+  {
+    typedef typename K::Point_3        Point_3;
+  public:
+    typedef typename K::Oriented_side  result_type;
+
+    result_type
+    operator()( const Point_3& p, const Point_3& q, const Point_3& r,
+	        const Point_3& s, const Point_3& test) const
+    {
+      return side_of_oriented_sphereC3(p.x(), p.y(), p.z(),
+				       q.x(), q.y(), q.z(),
+				       r.x(), r.y(), r.z(),
+				       s.x(), s.y(), s.z(),
+				       test.x(), test.y(), test.z());
+    }
+  };
+
+} // namespace CartesianKernelFunctors
+
+} //namespace CGAL
+
+#endif // CGAL_CARTESIAN_FUNCTION_OBJECTS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/line_constructions_2.h b/3rdparty/CGAL/include/CGAL/Cartesian/line_constructions_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/line_constructions_2.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/line_constructions_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/plane_constructions_3.h b/3rdparty/CGAL/include/CGAL/Cartesian/plane_constructions_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/plane_constructions_3.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/plane_constructions_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/point_constructions_2.h b/3rdparty/CGAL/include/CGAL/Cartesian/point_constructions_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/point_constructions_2.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/point_constructions_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/point_constructions_3.h b/3rdparty/CGAL/include/CGAL/Cartesian/point_constructions_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/point_constructions_3.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/point_constructions_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/predicates_on_directions_2.h b/3rdparty/CGAL/include/CGAL/Cartesian/predicates_on_directions_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/predicates_on_directions_2.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/predicates_on_directions_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/predicates_on_planes_3.h b/3rdparty/CGAL/include/CGAL/Cartesian/predicates_on_planes_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/predicates_on_planes_3.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/predicates_on_planes_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/predicates_on_points_2.h b/3rdparty/CGAL/include/CGAL/Cartesian/predicates_on_points_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/predicates_on_points_2.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/predicates_on_points_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/predicates_on_points_3.h b/3rdparty/CGAL/include/CGAL/Cartesian/predicates_on_points_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/predicates_on_points_3.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/predicates_on_points_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian/solve_3.h b/3rdparty/CGAL/include/CGAL/Cartesian/solve_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian/solve_3.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian/solve_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian_converter.h b/3rdparty/CGAL/include/CGAL/Cartesian_converter.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian_converter.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian_converter.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian_d.h b/3rdparty/CGAL/include/CGAL/Cartesian_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian_d.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cartesian_matrix.h b/3rdparty/CGAL/include/CGAL/Cartesian_matrix.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cartesian_matrix.h
rename to 3rdparty/CGAL/include/CGAL/Cartesian_matrix.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cell_attribute.h b/3rdparty/CGAL/include/CGAL/Cell_attribute.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cell_attribute.h
rename to 3rdparty/CGAL/include/CGAL/Cell_attribute.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cell_attribute_with_point.h b/3rdparty/CGAL/include/CGAL/Cell_attribute_with_point.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cell_attribute_with_point.h
rename to 3rdparty/CGAL/include/CGAL/Cell_attribute_with_point.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cell_const_iterators.h b/3rdparty/CGAL/include/CGAL/Cell_const_iterators.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cell_const_iterators.h
rename to 3rdparty/CGAL/include/CGAL/Cell_const_iterators.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Cell_iterators.h b/3rdparty/CGAL/include/CGAL/Cell_iterators.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Cell_iterators.h
rename to 3rdparty/CGAL/include/CGAL/Cell_iterators.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Chinese_remainder_traits.h b/3rdparty/CGAL/include/CGAL/Chinese_remainder_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Chinese_remainder_traits.h
rename to 3rdparty/CGAL/include/CGAL/Chinese_remainder_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circle_2.h b/3rdparty/CGAL/include/CGAL/Circle_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circle_2.h
rename to 3rdparty/CGAL/include/CGAL/Circle_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circle_2_Circle_2_intersection.h b/3rdparty/CGAL/include/CGAL/Circle_2_Circle_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circle_2_Circle_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Circle_2_Circle_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circle_2_Line_2_intersection.h b/3rdparty/CGAL/include/CGAL/Circle_2_Line_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circle_2_Line_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Circle_2_Line_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circle_3.h b/3rdparty/CGAL/include/CGAL/Circle_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circle_3.h
rename to 3rdparty/CGAL/include/CGAL/Circle_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circle_type.h b/3rdparty/CGAL/include/CGAL/Circle_type.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circle_type.h
rename to 3rdparty/CGAL/include/CGAL/Circle_type.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_arc_2.h b/3rdparty/CGAL/include/CGAL/Circular_arc_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_arc_2.h
rename to 3rdparty/CGAL/include/CGAL/Circular_arc_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_arc_3.h b/3rdparty/CGAL/include/CGAL/Circular_arc_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_arc_3.h
rename to 3rdparty/CGAL/include/CGAL/Circular_arc_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_arc_point_2.h b/3rdparty/CGAL/include/CGAL/Circular_arc_point_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_arc_point_2.h
rename to 3rdparty/CGAL/include/CGAL/Circular_arc_point_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_arc_point_3.h b/3rdparty/CGAL/include/CGAL/Circular_arc_point_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_arc_point_3.h
rename to 3rdparty/CGAL/include/CGAL/Circular_arc_point_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_border_parameterizer_3.h b/3rdparty/CGAL/include/CGAL/Circular_border_parameterizer_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_border_parameterizer_3.h
rename to 3rdparty/CGAL/include/CGAL/Circular_border_parameterizer_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_2.h b/3rdparty/CGAL/include/CGAL/Circular_kernel_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_2.h
rename to 3rdparty/CGAL/include/CGAL/Circular_kernel_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_2/Circular_arc_2.h b/3rdparty/CGAL/include/CGAL/Circular_kernel_2/Circular_arc_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_2/Circular_arc_2.h
rename to 3rdparty/CGAL/include/CGAL/Circular_kernel_2/Circular_arc_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_2/Circular_arc_point_2.h b/3rdparty/CGAL/include/CGAL/Circular_kernel_2/Circular_arc_point_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_2/Circular_arc_point_2.h
rename to 3rdparty/CGAL/include/CGAL/Circular_kernel_2/Circular_arc_point_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_2/Intersection_traits.h b/3rdparty/CGAL/include/CGAL/Circular_kernel_2/Intersection_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_2/Intersection_traits.h
rename to 3rdparty/CGAL/include/CGAL/Circular_kernel_2/Intersection_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_2/Line_arc_2.h b/3rdparty/CGAL/include/CGAL/Circular_kernel_2/Line_arc_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_2/Line_arc_2.h
rename to 3rdparty/CGAL/include/CGAL/Circular_kernel_2/Line_arc_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_2/function_objects_on_circle_2.h b/3rdparty/CGAL/include/CGAL/Circular_kernel_2/function_objects_on_circle_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_2/function_objects_on_circle_2.h
rename to 3rdparty/CGAL/include/CGAL/Circular_kernel_2/function_objects_on_circle_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_2/function_objects_on_line_2.h b/3rdparty/CGAL/include/CGAL/Circular_kernel_2/function_objects_on_line_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_2/function_objects_on_line_2.h
rename to 3rdparty/CGAL/include/CGAL/Circular_kernel_2/function_objects_on_line_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_2/function_objects_polynomial_circular.h b/3rdparty/CGAL/include/CGAL/Circular_kernel_2/function_objects_polynomial_circular.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_2/function_objects_polynomial_circular.h
rename to 3rdparty/CGAL/include/CGAL/Circular_kernel_2/function_objects_polynomial_circular.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_2/interface_macros.h b/3rdparty/CGAL/include/CGAL/Circular_kernel_2/interface_macros.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_2/interface_macros.h
rename to 3rdparty/CGAL/include/CGAL/Circular_kernel_2/interface_macros.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_2/internal_functions_on_circle_2.h b/3rdparty/CGAL/include/CGAL/Circular_kernel_2/internal_functions_on_circle_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_2/internal_functions_on_circle_2.h
rename to 3rdparty/CGAL/include/CGAL/Circular_kernel_2/internal_functions_on_circle_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_2/internal_functions_on_circular_arc_2.h b/3rdparty/CGAL/include/CGAL/Circular_kernel_2/internal_functions_on_circular_arc_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_2/internal_functions_on_circular_arc_2.h
rename to 3rdparty/CGAL/include/CGAL/Circular_kernel_2/internal_functions_on_circular_arc_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_2/internal_functions_on_line_2.h b/3rdparty/CGAL/include/CGAL/Circular_kernel_2/internal_functions_on_line_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_2/internal_functions_on_line_2.h
rename to 3rdparty/CGAL/include/CGAL/Circular_kernel_2/internal_functions_on_line_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_2/internal_functions_on_line_arc_2.h b/3rdparty/CGAL/include/CGAL/Circular_kernel_2/internal_functions_on_line_arc_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_2/internal_functions_on_line_arc_2.h
rename to 3rdparty/CGAL/include/CGAL/Circular_kernel_2/internal_functions_on_line_arc_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_2/intersection_line_2_circle_2_map.h b/3rdparty/CGAL/include/CGAL/Circular_kernel_2/intersection_line_2_circle_2_map.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_2/intersection_line_2_circle_2_map.h
rename to 3rdparty/CGAL/include/CGAL/Circular_kernel_2/intersection_line_2_circle_2_map.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_3/Circular_arc_3.h b/3rdparty/CGAL/include/CGAL/Circular_kernel_3/Circular_arc_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_3/Circular_arc_3.h
rename to 3rdparty/CGAL/include/CGAL/Circular_kernel_3/Circular_arc_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_3/Circular_arc_point_3.h b/3rdparty/CGAL/include/CGAL/Circular_kernel_3/Circular_arc_point_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_3/Circular_arc_point_3.h
rename to 3rdparty/CGAL/include/CGAL/Circular_kernel_3/Circular_arc_point_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_3/Intersection_traits.h b/3rdparty/CGAL/include/CGAL/Circular_kernel_3/Intersection_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_3/Intersection_traits.h
rename to 3rdparty/CGAL/include/CGAL/Circular_kernel_3/Intersection_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_3/Line_arc_3.h b/3rdparty/CGAL/include/CGAL/Circular_kernel_3/Line_arc_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_3/Line_arc_3.h
rename to 3rdparty/CGAL/include/CGAL/Circular_kernel_3/Line_arc_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_3/function_objects_polynomial_sphere.h b/3rdparty/CGAL/include/CGAL/Circular_kernel_3/function_objects_polynomial_sphere.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_3/function_objects_polynomial_sphere.h
rename to 3rdparty/CGAL/include/CGAL/Circular_kernel_3/function_objects_polynomial_sphere.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_3/get_equation_object_on_curved_kernel_3.h b/3rdparty/CGAL/include/CGAL/Circular_kernel_3/get_equation_object_on_curved_kernel_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_3/get_equation_object_on_curved_kernel_3.h
rename to 3rdparty/CGAL/include/CGAL/Circular_kernel_3/get_equation_object_on_curved_kernel_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_3/interface_macros.h b/3rdparty/CGAL/include/CGAL/Circular_kernel_3/interface_macros.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_3/interface_macros.h
rename to 3rdparty/CGAL/include/CGAL/Circular_kernel_3/interface_macros.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_3/internal_function_compare_spherical_kernel.h b/3rdparty/CGAL/include/CGAL/Circular_kernel_3/internal_function_compare_spherical_kernel.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_3/internal_function_compare_spherical_kernel.h
rename to 3rdparty/CGAL/include/CGAL/Circular_kernel_3/internal_function_compare_spherical_kernel.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_3/internal_function_compare_to_right_spherical_kernel.h b/3rdparty/CGAL/include/CGAL/Circular_kernel_3/internal_function_compare_to_right_spherical_kernel.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_3/internal_function_compare_to_right_spherical_kernel.h
rename to 3rdparty/CGAL/include/CGAL/Circular_kernel_3/internal_function_compare_to_right_spherical_kernel.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_3/internal_function_has_on_spherical_kernel.h b/3rdparty/CGAL/include/CGAL/Circular_kernel_3/internal_function_has_on_spherical_kernel.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_3/internal_function_has_on_spherical_kernel.h
rename to 3rdparty/CGAL/include/CGAL/Circular_kernel_3/internal_function_has_on_spherical_kernel.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_3/internal_functions_on_circle_3.h b/3rdparty/CGAL/include/CGAL/Circular_kernel_3/internal_functions_on_circle_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_3/internal_functions_on_circle_3.h
rename to 3rdparty/CGAL/include/CGAL/Circular_kernel_3/internal_functions_on_circle_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_3/internal_functions_on_circular_arc_3.h b/3rdparty/CGAL/include/CGAL/Circular_kernel_3/internal_functions_on_circular_arc_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_3/internal_functions_on_circular_arc_3.h
rename to 3rdparty/CGAL/include/CGAL/Circular_kernel_3/internal_functions_on_circular_arc_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_3/internal_functions_on_circular_arc_point_3.h b/3rdparty/CGAL/include/CGAL/Circular_kernel_3/internal_functions_on_circular_arc_point_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_3/internal_functions_on_circular_arc_point_3.h
rename to 3rdparty/CGAL/include/CGAL/Circular_kernel_3/internal_functions_on_circular_arc_point_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_3/internal_functions_on_line_3.h b/3rdparty/CGAL/include/CGAL/Circular_kernel_3/internal_functions_on_line_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_3/internal_functions_on_line_3.h
rename to 3rdparty/CGAL/include/CGAL/Circular_kernel_3/internal_functions_on_line_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_3/internal_functions_on_line_arc_3.h b/3rdparty/CGAL/include/CGAL/Circular_kernel_3/internal_functions_on_line_arc_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_3/internal_functions_on_line_arc_3.h
rename to 3rdparty/CGAL/include/CGAL/Circular_kernel_3/internal_functions_on_line_arc_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_3/internal_functions_on_plane_3.h b/3rdparty/CGAL/include/CGAL/Circular_kernel_3/internal_functions_on_plane_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_3/internal_functions_on_plane_3.h
rename to 3rdparty/CGAL/include/CGAL/Circular_kernel_3/internal_functions_on_plane_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_3/internal_functions_on_sphere_3.h b/3rdparty/CGAL/include/CGAL/Circular_kernel_3/internal_functions_on_sphere_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_3/internal_functions_on_sphere_3.h
rename to 3rdparty/CGAL/include/CGAL/Circular_kernel_3/internal_functions_on_sphere_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_converter.h b/3rdparty/CGAL/include/CGAL/Circular_kernel_converter.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_converter.h
rename to 3rdparty/CGAL/include/CGAL/Circular_kernel_converter.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_intersections.h b/3rdparty/CGAL/include/CGAL/Circular_kernel_intersections.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_intersections.h
rename to 3rdparty/CGAL/include/CGAL/Circular_kernel_intersections.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_type_equality_wrapper.h b/3rdparty/CGAL/include/CGAL/Circular_kernel_type_equality_wrapper.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circular_kernel_type_equality_wrapper.h
rename to 3rdparty/CGAL/include/CGAL/Circular_kernel_type_equality_wrapper.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circulator/Circulator_adapters.h b/3rdparty/CGAL/include/CGAL/Circulator/Circulator_adapters.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circulator/Circulator_adapters.h
rename to 3rdparty/CGAL/include/CGAL/Circulator/Circulator_adapters.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circulator/Circulator_concepts.h b/3rdparty/CGAL/include/CGAL/Circulator/Circulator_concepts.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circulator/Circulator_concepts.h
rename to 3rdparty/CGAL/include/CGAL/Circulator/Circulator_concepts.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circulator/Safe_circulator_from_iterator.h b/3rdparty/CGAL/include/CGAL/Circulator/Safe_circulator_from_iterator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circulator/Safe_circulator_from_iterator.h
rename to 3rdparty/CGAL/include/CGAL/Circulator/Safe_circulator_from_iterator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circulator_identity.h b/3rdparty/CGAL/include/CGAL/Circulator_identity.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circulator_identity.h
rename to 3rdparty/CGAL/include/CGAL/Circulator_identity.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circulator_on_node.h b/3rdparty/CGAL/include/CGAL/Circulator_on_node.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circulator_on_node.h
rename to 3rdparty/CGAL/include/CGAL/Circulator_on_node.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Circulator_project.h b/3rdparty/CGAL/include/CGAL/Circulator_project.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Circulator_project.h
rename to 3rdparty/CGAL/include/CGAL/Circulator_project.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Coercion_traits.h b/3rdparty/CGAL/include/CGAL/Coercion_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Coercion_traits.h
rename to 3rdparty/CGAL/include/CGAL/Coercion_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Combination_enumerator.h b/3rdparty/CGAL/include/CGAL/Combination_enumerator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Combination_enumerator.h
rename to 3rdparty/CGAL/include/CGAL/Combination_enumerator.h
diff --git a/3rdparty/CGAL/include/CGAL/Combinatorial_map.h b/3rdparty/CGAL/include/CGAL/Combinatorial_map.h
new file mode 100644
index 0000000..5b2bf94
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Combinatorial_map.h
@@ -0,0 +1,4761 @@
+// Copyright (c) 2010-2011 CNRS and LIRIS' Establishments (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Guillaume Damiand <guillaume.damiand at liris.cnrs.fr>
+//
+#ifndef CGAL_COMBINATORIAL_MAP_H
+#define CGAL_COMBINATORIAL_MAP_H 1
+
+#include <CGAL/Compact_container.h>
+#include <CGAL/internal/Combinatorial_map_utility.h>
+#include <CGAL/internal/Combinatorial_map_group_functors.h>
+#include <CGAL/internal/Combinatorial_map_copy_functors.h>
+#include <CGAL/internal/Combinatorial_map_sewable.h>
+#include <CGAL/Combinatorial_map_functors.h>
+#include <CGAL/Combinatorial_map_min_items.h>
+#include <CGAL/Dart_const_iterators.h>
+#include <CGAL/Cell_const_iterators.h>
+#include <CGAL/Combinatorial_map_basic_operations.h>
+#include <CGAL/Combinatorial_map_storages.h>
+#include <CGAL/Combinatorial_map_operations.h>
+#include <CGAL/Unique_hash_map.h>
+#include <bitset>
+#include <vector>
+#include <deque>
+
+#include <boost/type_traits/is_same.hpp>
+
+#include <CGAL/config.h>
+
+#if defined( __INTEL_COMPILER )
+// Workarounf for warning in function basic_link_beta_0
+#pragma warning disable 1017
+#endif
+
+#include <boost/config.hpp>
+#if  (BOOST_GCC >= 40900)
+_Pragma("GCC diagnostic push")
+_Pragma("GCC diagnostic ignored \"-Warray-bounds\"")
+#endif
+
+namespace CGAL {
+
+  /** @file Combinatorial_map.h
+   * Definition of generic dD Combinatorial map.
+   */
+
+
+  /** Generic definition of combinatorial map in dD.
+   * The Combinatorial_map class describes an dD combinatorial map. It allows
+   * mainly to create darts, to use marks onto these darts, to get and set
+   * the beta links, and to manage enabled attributes.
+   */
+  template < unsigned int d_, class Refs,
+             class Items_=Combinatorial_map_min_items<d_>,
+             class Alloc_=CGAL_ALLOCATOR(int),
+             class Storage_= Combinatorial_map_storage_1<d_, Items_, Alloc_> >
+  class Combinatorial_map_base: public Storage_
+  {
+    template<typename CMap,unsigned int i,typename Enabled>
+    friend struct CGAL::internal::Call_merge_functor;
+    template<typename CMap,unsigned int i,typename Enabled>
+    friend struct CGAL::internal::Call_split_functor;
+    template<class Map, unsigned int i, unsigned int nmi>
+    friend struct Remove_cell_functor;
+    template<class Map, unsigned int i>
+    friend struct Contract_cell_functor;
+    template <typename CMap, typename Attrib>
+    friend struct internal::Reverse_orientation_of_map_functor;
+    template <typename CMap, typename Attrib>
+    friend struct internal::Reverse_orientation_of_connected_component_functor;
+    template<typename CMap>
+    friend struct internal::Init_attribute_functor;
+
+  public:
+    template < unsigned int A, class B, class I, class D, class S >
+    friend class Combinatorial_map_base;
+
+    /// Types definition
+    typedef Storage_                                                    Storage;
+    typedef Storage                                                     Base;
+    typedef Combinatorial_map_base<d_, Refs, Items_, Alloc_, Storage_ > Self;
+
+    typedef typename Base::Dart Dart;
+    typedef typename Base::Dart_handle Dart_handle;
+    typedef typename Base::Dart_const_handle Dart_const_handle;
+    typedef typename Base::Dart_container Dart_container;
+    typedef typename Base::Dart_wrapper Dart_wrapper;
+    typedef typename Base::size_type size_type;
+    typedef typename Base::Helper Helper;
+    typedef typename Base::Attributes Attributes;
+    typedef typename Base::Items Items;
+    typedef typename Base::Alloc Alloc;
+    typedef typename Base::Use_index Use_index;
+
+    static const size_type NB_MARKS = Base::NB_MARKS;
+    static const size_type INVALID_MARK = NB_MARKS;
+
+    static const unsigned int dimension = Base::dimension;
+
+    typedef typename Base::Null_handle_type Null_handle_type;
+
+    using Base::null_handle;
+    using Base::null_dart_handle;
+    using Base::mdarts;
+    using Base::get_beta;
+    using Base::is_free;
+    using Base::set_dart_mark;
+    using Base::get_dart_mark;
+    using Base::flip_dart_mark;
+    using Base::set_dart_marks;
+    using Base::get_dart_marks;
+    using Base::dart_link_beta;
+    using Base::dart_unlink_beta;
+    using Base::attribute;
+    using Base::mattribute_containers;
+    using Base::get_attribute;
+    using Base::dart_of_attribute;
+    using Base::set_dart_of_attribute;
+    using Base::info_of_attribute;
+    using Base::info;
+    using Base::dart;
+
+    /// Typedef for Dart_range, a range through all the darts of the map.
+    typedef Dart_container       Dart_range;
+    typedef const Dart_container Dart_const_range;
+
+    /// Typedef for attributes
+    template<int i>
+    struct Attribute_type: public Base::template Attribute_type<i>
+    {};
+    template<int i>
+    struct Attribute_handle: public Base::template Attribute_handle<i>
+    {};
+    template<int i>
+    struct Attribute_const_handle:
+      public Base::template Attribute_const_handle<i>
+    {};
+    template<int i>
+    struct Attribute_range: public Base::template Attribute_range<i>
+    {};
+    template<int i>
+    struct Attribute_const_range:
+      public Base::template Attribute_const_range<i>
+    {};
+
+    class Exception_no_more_available_mark {};
+
+  public:
+    /** Default Combinatorial_map constructor.
+     * The map is empty.
+     */
+    Combinatorial_map_base()
+    {
+      CGAL_static_assertion_msg(Dart::dimension==dimension,
+                  "Dimension of dart different from dimension of map");
+
+      CGAL_static_assertion_msg(Helper::nb_attribs<=dimension+1,
+                  "Too many attributes in the tuple Attributes_enabled");
+      this->init_storage();
+
+      this->mnb_used_marks = 0;
+      this->mmask_marks.reset();
+
+      for ( size_type i = 0; i < NB_MARKS; ++i)
+      {
+        this->mfree_marks_stack[i]        = i;
+        this->mindex_marks[i]             = i;
+        this->mnb_marked_darts[i]         = 0;
+        this->mnb_times_reserved_marks[i] = 0;
+      }
+
+      this->automatic_attributes_management = true;
+
+      init_dart(null_dart_handle);
+
+      CGAL_assertion(number_of_darts()==0);
+    }
+
+    /** Copy the given combinatorial map into *this.
+     *  Note that both CMap can have different dimensions and/or non void attributes.
+     *  @param amap the combinatorial map to copy.
+     *  @post *this is valid.
+     */
+    template <typename CMap2, typename Converters, typename Pointconverter>
+    void copy(const CMap2& amap, const Converters& converters,
+              const Pointconverter& pointconverter)
+    {
+      this->clear();
+
+      this->mnb_used_marks = amap.mnb_used_marks;
+      this->mmask_marks    = amap.mmask_marks;
+
+      for (size_type i = 0; i < NB_MARKS; ++i)
+      {
+        this->mfree_marks_stack[i]        = amap.mfree_marks_stack[i];
+        this->mindex_marks[i]             = amap.mindex_marks[i];
+        this->mnb_marked_darts[i]         = amap.mnb_marked_darts[i];
+        this->mnb_times_reserved_marks[i] = amap.mnb_times_reserved_marks[i];
+      }
+
+      init_dart(null_dart_handle, amap.get_marks(amap.null_dart_handle));
+
+      // Create an mapping between darts of the two maps (originals->copies).
+      // TODO: replace the std::map by a boost::unordered_map
+      // (here we cannot use CGAL::Unique_hash_map because it does not provide
+      // iterators...
+      std::map<typename CMap2::Dart_const_handle, Dart_handle> dartmap;
+
+      for (typename CMap2::Dart_const_range::const_iterator
+             it=amap.darts().begin(), itend=amap.darts().end();
+           it!=itend; ++it)
+      {
+        dartmap[it]=mdarts.emplace();
+        init_dart(dartmap[it], amap.get_marks(it));
+      }
+
+      unsigned int min_dim=(dimension<amap.dimension?dimension:amap.dimension);
+
+      typename std::map<typename CMap2::Dart_const_handle,Dart_handle>
+        ::iterator dartmap_iter, dartmap_iter_end=dartmap.end();
+      for (dartmap_iter=dartmap.begin(); dartmap_iter!=dartmap_iter_end;
+           ++dartmap_iter)
+      {
+        for (unsigned int i=0; i<=min_dim; i++)
+        {
+          if (!amap.is_free(dartmap_iter->first,i) &&
+              (dartmap_iter->first)<(amap.beta(dartmap_iter->first,i)))
+          {
+            basic_link_beta(dartmap_iter->second,
+                            dartmap[amap.beta(dartmap_iter->first,i)], i);
+          }
+        }
+      }
+
+      /** Copy attributes */
+      for (dartmap_iter=dartmap.begin(); dartmap_iter!=dartmap_iter_end;
+           ++dartmap_iter)
+      {
+        Helper::template Foreach_enabled_attributes
+          < internal::Copy_attributes_functor <CMap2, Refs, Converters,
+            Pointconverter> >::
+          run(&amap, static_cast<Refs*>(this),
+              dartmap_iter->first, dartmap_iter->second,
+              converters, pointconverter);
+      }
+
+      CGAL_assertion (is_valid () == 1);
+    }
+
+    template <typename CMap2>
+    void copy(const CMap2& amap)
+    {
+      CGAL::cpp11::tuple<> converters;
+      Default_converter_cmap_0attributes_with_point<CMap2, Refs> pointconverter;
+      return copy< CMap2, CGAL::cpp11::tuple<>,
+          Default_converter_cmap_0attributes_with_point<CMap2, Refs> >
+          (amap, converters, pointconverter);
+    }
+
+    template <typename CMap2, typename Converters>
+    void copy(const CMap2& amap, const Converters& converters)
+    {
+      Default_converter_cmap_0attributes_with_point<CMap2, Refs> pointconverter;
+      return copy< CMap2, Converters,
+          Default_converter_cmap_0attributes_with_point<CMap2, Refs> >
+          (amap, converters, pointconverter);
+    }
+
+    // Copy constructor from a map having exactly the same type.
+    Combinatorial_map_base (const Self & amap)
+    { copy<Self>(amap); }
+
+    // "Copy constructor" from a map having different type.
+    template <typename CMap2>
+    Combinatorial_map_base(const CMap2& amap)
+    { copy<CMap2>(amap); }
+
+    // "Copy constructor" from a map having different type.
+    template <typename CMap2, typename Converters>
+    Combinatorial_map_base(const CMap2& amap, Converters& converters)
+    { copy<CMap2,Converters>(amap, converters); }
+
+    // "Copy constructor" from a map having different type.
+    template <typename CMap2, typename Converters, typename Pointconverter>
+    Combinatorial_map_base(const CMap2& amap, Converters& converters,
+                           const Pointconverter& pointconverter)
+    { copy<CMap2,Converters, Pointconverter>
+          (amap, converters, pointconverter); }
+
+    /** Affectation operation. Copies one map to the other.
+     * @param amap a combinatorial map.
+     * @return A copy of that combinatorial map.
+     */
+    Self & operator= (const Self & amap)
+    {
+      if (this!=&amap)
+      {
+        Self tmp(amap);
+        this->swap(tmp);
+      }
+      return *this;
+    }
+
+    /** Swap this combinatorial map with amap, a second combinatorial map.
+     * Note that the two maps have exactly the same type.
+     * @param amap a combinatorial map.
+     */
+    void swap(Self & amap)
+    {
+      if (this!=&amap)
+      {
+        amap.mdarts.swap(mdarts);
+
+        std::swap_ranges(mnb_times_reserved_marks,
+                         mnb_times_reserved_marks+NB_MARKS,
+                         amap.mnb_times_reserved_marks);
+        std::swap(mmask_marks,amap.mmask_marks);
+        std::swap(mnb_used_marks, amap.mnb_used_marks);
+        std::swap_ranges(mindex_marks,mindex_marks+NB_MARKS,
+                         amap.mindex_marks);
+        std::swap_ranges(mfree_marks_stack, mfree_marks_stack+NB_MARKS,
+                         amap.mfree_marks_stack);
+        std::swap_ranges(mused_marks_stack,mused_marks_stack+NB_MARKS,
+                         amap.mused_marks_stack);
+        std::swap_ranges(mnb_marked_darts,mnb_marked_darts+NB_MARKS,
+                         amap.mnb_marked_darts);
+        mattribute_containers.swap(amap.mattribute_containers);
+        std::swap(null_dart_handle, amap.null_dart_handle);
+        this->mnull_dart_container.swap(amap.mnull_dart_container);
+      }
+    }
+
+    /** Clear the combinatorial map. Remove all darts and all attributes.
+     *  Note that reserved marks are not free.
+     */
+    void clear()
+    {
+      mdarts.clear();
+      for ( size_type i = 0; i < NB_MARKS; ++i)
+        this->mnb_marked_darts[i]  = 0;
+
+      internal::Clear_all::run(mattribute_containers);
+      this->init_storage();
+      init_dart(null_dart_handle);
+    }
+
+    /** Test if the map is empty.
+     *  @return true iff the map is empty.
+     */
+    bool is_empty() const
+    { return mdarts.empty(); }
+
+    friend std::ostream& operator<< (std::ostream& os, const Self& amap)
+    {
+      save_combinatorial_map(amap, os);
+      return os;
+    }
+
+    friend std::ifstream& operator>> (std::ifstream& is, Self& amap)
+    {
+      load_combinatorial_map(is, amap);
+      return is;
+    }
+
+    /** Create a new dart and add it to the map.
+     * The marks of the darts are initialised with mmask_marks, i.e. the dart
+     * is unmarked for all the marks.
+     * @return a Dart_handle on the new dart.
+     */
+#ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
+    template < typename... Args >
+    Dart_handle create_dart(const Args&... args)
+    {
+      Dart_handle res=mdarts.emplace(args...);
+      init_dart(res);
+      return res;
+    }
+#else
+    Dart_handle create_dart()
+    {
+      Dart_handle res=mdarts.emplace();
+      init_dart(res);
+      return res;
+    }
+    template < typename T1 >
+    Dart_handle create_dart(const T1 &t1)
+    {
+      Dart_handle res=mdarts.emplace(t1);
+      init_dart(res);
+      return res;
+    }
+    template < typename T1, typename T2 >
+    Dart_handle create_dart(const T1 &t1, const T2 &t2)
+    {
+      Dart_handle res=mdarts.emplace(t1, t2);
+      init_dart(res);
+      return res;
+    }
+    template < typename T1, typename T2, typename T3 >
+    Dart_handle create_dart(const T1 &t1, const T2 &t2, const T3 &t3)
+    {
+      Dart_handle res=mdarts.emplace(t1, t2, t3);
+      init_dart(res);
+      return res;
+    }
+    template < typename T1, typename T2, typename T3, typename T4 >
+    Dart_handle create_dart(const T1 &t1, const T2 &t2, const T3 &t3,
+                            const T4 &t4)
+    {
+      Dart_handle res=mdarts.emplace(t1, t2, t3, t4);
+      init_dart(res);
+      return res;
+    }
+    template < typename T1, typename T2, typename T3, typename T4, typename T5 >
+    Dart_handle create_dart(const T1 &t1, const T2 &t2, const T3 &t3,
+                            const T4 &t4, const T5 &t5)
+    {
+      Dart_handle res=mdarts.emplace(t1, t2, t3, t4, t5);
+      init_dart(res);
+      return res;
+    }
+    template < typename T1, typename T2, typename T3, typename T4, typename T5,
+               typename T6 >
+    Dart_handle create_dart(const T1 &t1, const T2 &t2, const T3 &t3,
+                            const T4 &t4, const T5 &t5, const T6 &t6)
+    {
+      Dart_handle res=mdarts.emplace(t1, t2, t3, t4, t5, t6);
+      init_dart(res);
+      return res;
+    }
+    template < typename T1, typename T2, typename T3, typename T4, typename T5,
+               typename T6, typename T7 >
+    Dart_handle create_dart(const T1 &t1, const T2 &t2, const T3 &t3,
+                            const T4 &t4, const T5 &t5, const T6 &t6,
+                            const T7 &t7)
+    {
+      Dart_handle res=mdarts.emplace(t1, t2, t3, t4, t5, t6, t7);
+      init_dart(res);
+      return res;
+    }
+    template < typename T1, typename T2, typename T3, typename T4, typename T5,
+               typename T6, typename T7, typename T8 >
+    Dart_handle create_dart(const T1 &t1, const T2 &t2, const T3 &t3,
+                            const T4 &t4, const T5 &t5, const T6 &t6,
+                            const T7 &t7, const T8 &t8)
+    {
+      Dart_handle res=mdarts.emplace(t1, t2, t3, t4, t5, t6, t7, t8);
+      init_dart(res);
+      return res;
+    }
+    template < typename T1, typename T2, typename T3, typename T4, typename T5,
+               typename T6, typename T7, typename T8, typename T9 >
+    Dart_handle create_dart(const T1 &t1, const T2 &t2, const T3 &t3,
+                            const T4 &t4, const T5 &t5, const T6 &t6,
+                            const T7 &t7, const T8 &t8, const T9 &t9)
+    {
+      Dart_handle res=mdarts.emplace(t1, t2, t3, t4, t5, t6, t7, t8, t9);
+      init_dart(res);
+      return res;
+    }
+#endif
+
+    /** Erase a dart from the list of darts.
+     * @param adart the dart to erase.
+     */
+    void erase_dart(Dart_handle adart)
+    {
+      // 1) We update the number of marked darts.
+      for ( size_type i = 0; i < mnb_used_marks; ++i)
+      {
+        if (is_marked(adart, mused_marks_stack[i]))
+          --mnb_marked_darts[mused_marks_stack[i]];
+      }
+
+      // 2) We update the attribute_ref_counting.
+      Helper::template Foreach_enabled_attributes
+        <internal::Decrease_attribute_functor<Self> >::run(this,adart);
+
+      // 3) We erase the dart.
+      mdarts.erase(adart);
+    }
+
+    /// @return true if dh points to a used dart (i.e. valid).
+    bool is_dart_used(Dart_const_handle dh) const
+    { return mdarts.is_used(dh); }
+
+    /// @return a Dart_range (range through all the darts of the map).
+    Dart_range& darts()             { return mdarts;}
+    Dart_const_range& darts() const { return mdarts; }
+
+    /** Get the first dart of this map.
+     * @return the first dart.
+     */
+    Dart_handle first_dart()
+    {
+      if (darts().begin() == darts().end()) return null_handle;
+      return mdarts.begin();
+    }
+    Dart_const_handle first_dart() const
+    {
+      if (darts().begin() == darts().end()) return null_handle;
+      return mdarts.begin();
+    }
+
+    /// @return the Dart_handle corresponding to the given dart.
+    Dart_handle dart_handle(Dart& adart)
+    { return mdarts.iterator_to(adart); }
+    Dart_const_handle dart_handle(const Dart& adart) const
+    { return mdarts.iterator_to(adart); }
+
+    /** Return the highest dimension for which dh is not free.
+     * @param dh a dart handle
+     * @return the dimension d such that dh is not d-free but k-free for
+     *         all k>d. -1 if the dart is free for all d in {0..n}
+     */
+    int highest_nonfree_dimension(Dart_const_handle dh) const
+    {
+      for (int i=(int)dimension; i>=0; --i)
+      { if ( !is_free(dh, i) ) return i; }
+      return -1;
+    }
+
+    /** Return a dart belonging to the same edge and to the second vertex
+     * of the current edge (NULL if such a dart does not exist).
+     * @return An handle to the opposite dart.
+     */
+    Dart_handle opposite(Dart_handle dh)
+    {
+      for (unsigned int i = 2; i <= dimension; ++i)
+        if (!is_free(dh, i)) return beta(dh, i);
+      return null_handle;
+    }
+    Dart_const_handle opposite(Dart_const_handle dh) const
+    {
+      for (unsigned int i = 2; i <= dimension; ++i)
+        if (!is_free(dh, i)) return beta(dh, i);
+      return null_handle;
+    }
+
+    /** Return a dart incident to the other extremity of the current edge,
+     *  but contrary to opposite, non necessary to the same edge
+     *  (NULL if such a dart does not exist).
+     * @return An handle to the opposite dart.
+     */
+    Dart_handle other_extremity(Dart_handle dh)
+    {
+      for (unsigned int i = 1; i <= dimension; ++i)
+        if (!is_free(dh, i)) return beta(dh, i);
+      return null_handle;
+    }
+    Dart_const_handle other_extremity(Dart_const_handle dh) const
+    {
+      for (unsigned int i = 1; i <= dimension; ++i)
+        if (!is_free(dh, i)) return beta(dh, i);
+      return null_handle;
+    }
+
+    // Set the handle on the i th attribute
+    template<unsigned int i>
+    void set_dart_attribute(Dart_handle dh,
+                            typename Attribute_handle<i>::type ah)
+    {
+      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
+                     "set_dart_attribute<i> called but i-attributes are disabled.");
+
+      if ( this->template attribute<i>(dh)==ah ) return;
+
+      if ( this->template attribute<i>(dh)!=null_handle )
+      {
+        this->template get_attribute<i>(this->template attribute<i>(dh)).
+          dec_nb_refs();
+        if ( this->template get_attribute<i>(this->template attribute<i>(dh)).
+             get_nb_refs()==0 )
+          this->template erase_attribute<i>(this->template attribute<i>(dh));
+      }
+
+      this->template basic_set_dart_attribute<i>(dh, ah);
+
+      if ( ah!=null_handle )
+      {
+        this->template set_dart_of_attribute<i>(ah, dh);
+        this->template get_attribute<i>(ah).inc_nb_refs();
+      }
+    }
+
+  protected:
+    /// Marks can be modified even for const handle; otherwise it is not
+    /// possible to iterate through const combinatorial maps.
+
+    // Initialize a given dart: all beta to null_dart_handle and all
+    // attributes to null, all marks unmarked.
+    void init_dart(Dart_handle adart)
+    {
+      set_dart_marks(adart, mmask_marks);
+
+      for (unsigned int i = 0; i <= dimension; ++i)
+        dart_unlink_beta(adart, i);
+
+      Helper::template Foreach_enabled_attributes
+          <internal::Init_attribute_functor<Self> >::run(this, adart);
+    }
+    // Initialize a given dart: all beta to null_dart_handle and all
+    // attributes to null, marks are given.
+    void init_dart(Dart_handle adart,
+                   const std::bitset<NB_MARKS>& amarks)
+    {
+      set_marks(adart, amarks);
+
+      for (unsigned int i = 0; i <= dimension; ++i)
+        dart_unlink_beta(adart, i);
+
+      Helper::template Foreach_enabled_attributes
+          <internal::Init_attribute_functor<Self> >::run(this, adart);
+    }
+
+  public:
+
+    /// @return the betas of ADart (beta are used in the same order than
+    ///         they are given as parameters)
+
+#ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
+    template<typename ...Betas>
+    Dart_handle beta(Dart_handle ADart, Betas... betas)
+    { return CGAL::internal::Beta_functor<Self, Dart_handle, Betas...>::
+        run(this, ADart, betas...); }
+    template<typename ...Betas>
+    Dart_const_handle beta(Dart_const_handle ADart, Betas... betas) const
+    { return CGAL::internal::Beta_functor<const Self, Dart_const_handle, Betas...>::
+        run(this, ADart, betas...); }
+    template<int... Betas>
+    Dart_handle beta(Dart_handle ADart)
+    { return CGAL::internal::Beta_functor_static<Self, Dart_handle, Betas...>::
+        run(this, ADart); }
+    template<int... Betas>
+    Dart_const_handle beta(Dart_const_handle ADart) const
+    { return CGAL::internal::Beta_functor_static<const Self, Dart_const_handle, Betas...>::
+        run(this, ADart); }
+#else
+    Dart_handle beta(Dart_handle ADart, int B1)
+    { return this->get_beta(ADart, B1); }
+    Dart_handle beta(Dart_handle ADart, int B1, int B2)
+    { return beta(beta(ADart, B1), B2); }
+    Dart_handle beta(Dart_handle ADart, int B1, int B2, int B3)
+    { return beta(beta(ADart, B1), B2, B3); }
+    Dart_handle beta(Dart_handle ADart, int B1, int B2, int B3,
+                           int B4)
+    { return beta(beta(ADart, B1), B2, B3, B4); }
+    Dart_handle beta(Dart_handle ADart, int B1, int B2, int B3,
+                           int B4, int B5)
+    { return beta(beta(ADart, B1), B2, B3, B4, B5); }
+    Dart_handle beta(Dart_handle ADart, int B1, int B2, int B3,
+                           int B4, int B5, int B6)
+    { return beta(beta(ADart, B1), B2, B3, B4, B5, B6); }
+    Dart_handle beta(Dart_handle ADart, int B1, int B2, int B3,
+                           int B4, int B5, int B6, int B7)
+    { return beta(beta(ADart, B1), B2, B3, B4, B5, B6, B7); }
+    Dart_handle beta(Dart_handle ADart, int B1, int B2, int B3,
+                           int B4, int B5, int B6, int B7, int B8)
+    { return beta(beta(ADart, B1), B2, B3, B4, B5, B6, B7, B8); }
+    Dart_handle beta(Dart_handle ADart, int B1, int B2, int B3,
+                           int B4, int B5, int B6, int B7, int B8, int B9)
+    { return beta(beta(ADart, B1), B2, B3, B4, B5, B6, B7, B8, B9); }
+
+    template<int B1>
+    Dart_handle beta(Dart_handle ADart)
+    { return this->template get_beta<B1>(ADart); }
+    template<int B1, int B2>
+    Dart_handle beta(Dart_handle ADart)
+    { return beta<B2>(beta<B1>(ADart)); }
+    template<int B1, int B2, int B3>
+    Dart_handle beta(Dart_handle ADart)
+    { return beta<B2, B3>(beta<B1>(ADart)); }
+    template<int B1, int B2, int B3, int B4>
+    Dart_handle beta(Dart_handle ADart)
+    { return beta<B2, B3, B4>(beta<B1>(ADart)); }
+    template<int B1, int B2, int B3, int B4, int B5>
+    Dart_handle beta(Dart_handle ADart)
+    { return beta<B2, B3, B4, B5>(beta<B1>(ADart)); }
+    template<int B1, int B2, int B3, int B4, int B5, int B6>
+    Dart_handle beta(Dart_handle ADart)
+    { return beta<B2, B3, B4, B5, B6>(beta<B1>(ADart)); }
+    template<int B1, int B2, int B3, int B4, int B5, int B6,
+             int B7>
+    Dart_handle beta(Dart_handle ADart)
+    { return beta<B2, B3, B4, B5, B6, B7>(beta<B1>(ADart)); }
+    template<int B1, int B2, int B3, int B4, int B5, int B6,
+             int B7, int B8>
+    Dart_handle beta(Dart_handle ADart)
+    { return beta<B2, B3, B4, B5, B6, B7, B8>(beta<B1>(ADart)); }
+    template<int B1, int B2, int B3, int B4, int B5, int B6,
+             int B7, int B8, int B9>
+     Dart_handle beta(Dart_handle ADart)
+    { return beta<B2, B3, B4, B5, B6, B7, B8, B9>(beta<B1>(ADart)); }
+
+    Dart_const_handle beta(Dart_const_handle ADart, int B1) const
+    { return this->get_beta(ADart, B1); }
+    Dart_const_handle beta(Dart_const_handle ADart, int B1, int B2) const
+    { return beta(beta(ADart, B1), B2); }
+    Dart_const_handle beta(Dart_const_handle ADart, int B1, int B2, int B3) const
+    { return beta(beta(ADart, B1), B2, B3); }
+    Dart_const_handle beta(Dart_const_handle ADart, int B1, int B2, int B3,
+                           int B4) const
+    { return beta(beta(ADart, B1), B2, B3, B4); }
+    Dart_const_handle beta(Dart_const_handle ADart, int B1, int B2, int B3,
+                           int B4, int B5) const
+    { return beta(beta(ADart, B1), B2, B3, B4, B5); }
+    Dart_const_handle beta(Dart_const_handle ADart, int B1, int B2, int B3,
+                           int B4, int B5, int B6) const
+    { return beta(beta(ADart, B1), B2, B3, B4, B5, B6); }
+    Dart_const_handle beta(Dart_const_handle ADart, int B1, int B2, int B3,
+                           int B4, int B5, int B6, int B7) const
+    { return beta(beta(ADart, B1), B2, B3, B4, B5, B6, B7); }
+    Dart_const_handle beta(Dart_const_handle ADart, int B1, int B2, int B3,
+                           int B4, int B5, int B6, int B7, int B8) const
+    { return beta(beta(ADart, B1), B2, B3, B4, B5, B6, B7, B8); }
+    Dart_const_handle beta(Dart_const_handle ADart, int B1, int B2, int B3,
+                           int B4, int B5, int B6, int B7, int B8, int B9) const
+    { return beta(beta(ADart, B1), B2, B3, B4, B5, B6, B7, B8, B9); }
+
+    template<int B1>
+    Dart_const_handle beta(Dart_const_handle ADart) const
+    { return this->template get_beta<B1>(ADart); }
+    template<int B1, int B2>
+    Dart_const_handle beta(Dart_const_handle ADart) const
+    { return beta<B2>(beta<B1>(ADart)); }
+    template<int B1, int B2, int B3>
+    Dart_const_handle beta(Dart_const_handle ADart) const
+    { return beta<B2, B3>(beta<B1>(ADart)); }
+    template<int B1, int B2, int B3, int B4>
+    Dart_const_handle beta(Dart_const_handle ADart) const
+    { return beta<B2, B3, B4>(beta<B1>(ADart)); }
+    template<int B1, int B2, int B3, int B4, int B5>
+    Dart_const_handle beta(Dart_const_handle ADart) const
+    { return beta<B2, B3, B4, B5>(beta<B1>(ADart)); }
+    template<int B1, int B2, int B3, int B4, int B5, int B6>
+    Dart_const_handle beta(Dart_const_handle ADart) const
+    { return beta<B2, B3, B4, B5, B6>(beta<B1>(ADart)); }
+    template<int B1, int B2, int B3, int B4, int B5, int B6,
+              int B7>
+    Dart_const_handle beta(Dart_const_handle ADart) const
+    { return beta<B2, B3, B4, B5, B6, B7>(beta<B1>(ADart)); }
+    template<int B1, int B2, int B3, int B4, int B5, int B6,
+              int B7, int B8>
+    Dart_const_handle beta(Dart_const_handle ADart) const
+    { return beta<B2, B3, B4, B5, B6, B7, B8>(beta<B1>(ADart)); }
+    template<int B1, int B2, int B3, int B4, int B5, int B6,
+              int B7, int B8, int B9>
+    Dart_const_handle beta(Dart_const_handle ADart) const
+    { return beta<B2, B3, B4, B5, B6, B7, B8, B9>(beta<B1>(ADart)); }
+#endif
+
+    /** Count the number of used marks.
+     * @return the number of used marks.
+     */
+    size_type number_of_used_marks() const
+    { return mnb_used_marks; }
+
+    /** Test if a given mark is reserved.
+     *  @return true iff the mark is reserved (ie in used).
+     */
+    bool is_reserved(size_type amark) const
+    {
+      CGAL_assertion(amark<NB_MARKS);
+
+      return (mnb_times_reserved_marks[amark]!=0);
+    }
+
+    /**  Count the number of marked darts for a given mark.
+     * @param amark the mark index.
+     * @return the number of marked darts for amark.
+     */
+    size_type number_of_marked_darts(size_type amark) const
+    {
+      CGAL_assertion( is_reserved(amark) );
+
+      return mnb_marked_darts[amark];
+    }
+
+    /**  Count the number of unmarked darts for a given mark.
+     * @param amark the mark index.
+     * @return the number of unmarked darts for amark.
+     */
+    size_type number_of_unmarked_darts(size_type amark) const
+    {
+      CGAL_assertion( is_reserved(amark) );
+      return number_of_darts() - number_of_marked_darts(amark);
+    }
+
+    /** Test if all the darts are unmarked for a given mark.
+     * @param amark the mark index.
+     * @return true iff all the darts are unmarked for amark.
+     */
+    bool is_whole_map_unmarked(size_type amark) const
+    { return number_of_marked_darts(amark) == 0; }
+
+    /** Test if all the darts are marked for a given mark.
+     * @param amark the mark index.
+     * @return true iff all the darts are marked for amark.
+     */
+    bool is_whole_map_marked(size_type amark) const
+    {  return number_of_marked_darts(amark) == number_of_darts(); }
+
+    /** Reserve a new mark.
+     * Get a new free mark and return its index.
+     * All the darts are unmarked for this mark.
+     * @return the index of the new mark.
+     * @pre mnb_used_marks < NB_MARKS
+     */
+    size_type get_new_mark() const
+    {
+      if (mnb_used_marks == NB_MARKS)
+      {
+        std::cerr << "Not enough Boolean marks: "
+          "increase NB_MARKS in item class." << std::endl;
+        std::cerr << "  (exception launched)" << std::endl;
+        throw Exception_no_more_available_mark();
+      }
+
+      size_type m = mfree_marks_stack[mnb_used_marks];
+      mused_marks_stack[mnb_used_marks] = m;
+
+      mindex_marks[m] = mnb_used_marks;
+      mnb_times_reserved_marks[m]=1;
+
+      ++mnb_used_marks;
+      CGAL_assertion(is_whole_map_unmarked(m));
+
+      return m;
+    }
+
+    /** Increase the number of times a mark is reserved.
+     *  @param amark the mark to share.
+     */
+    void share_a_mark(size_type amark) const
+    {
+      CGAL_assertion( is_reserved(amark) );
+
+      ++mnb_times_reserved_marks[amark];
+    }
+
+    /** @return the number of times a mark is reserved.
+     *  @param amark the mark to share.
+     */
+    size_type get_number_of_times_mark_reserved(size_type amark) const
+    {
+      CGAL_assertion( amark<NB_MARKS );
+
+      return mnb_times_reserved_marks[amark];
+    }
+
+    /** Negate the mark of all the darts for a given mark.
+     * After this call, all the marked darts become unmarked and all the
+     * unmarked darts become marked (in constant time operation).
+     * @param amark the mark index
+     */
+    void negate_mark(size_type amark) const
+    {
+      CGAL_assertion( is_reserved(amark) );
+
+      mnb_marked_darts[amark] = number_of_darts() - mnb_marked_darts[amark];
+
+      mmask_marks.flip(amark);
+    }
+
+    /** Test if a given dart is marked for a given mark.
+     * @param adart the dart to test.
+     * @param amark the given mark.
+     * @return true iff adart is marked for the mark amark.
+     */
+    bool is_marked(Dart_const_handle adart, size_type amark) const
+    {
+      // CGAL_assertion( adart != null_dart_handle );
+      CGAL_assertion( is_reserved(amark) );
+
+      return get_dart_mark(adart, amark)!=mmask_marks[amark];
+    }
+
+    /** Set the mark of a given dart to a state (on or off).
+     * @param adart the dart.
+     * @param amark the given mark.
+     * @param astate the state of the mark (on or off).
+     */
+    void set_mark_to(Dart_const_handle adart, size_type amark,
+                     bool astate) const
+    {
+      CGAL_assertion( adart != null_dart_handle );
+      CGAL_assertion( is_reserved(amark) );
+
+      if (is_marked(adart, amark) != astate)
+      {
+        if (astate) ++mnb_marked_darts[amark];
+        else --mnb_marked_darts[amark];
+
+        flip_dart_mark(adart, amark);
+      }
+    }
+
+    /** Mark the given dart.
+     * @param adart the dart.
+     * @param amark the given mark.
+     */
+    void mark(Dart_const_handle adart, size_type amark) const
+    {
+      CGAL_assertion( adart != null_dart_handle );
+      CGAL_assertion( is_reserved(amark) );
+
+      if (is_marked(adart, amark)) return;
+
+      ++mnb_marked_darts[amark];
+      flip_dart_mark(adart, amark);
+    }
+
+    /** Unmark the given dart.
+     * @param adart the dart.
+     * @param amark the given mark.
+     */
+    void unmark(Dart_const_handle adart, size_type amark) const
+    {
+      CGAL_assertion( adart != null_dart_handle );
+      CGAL_assertion( is_reserved(amark) );
+
+      if (!is_marked(adart, amark)) return;
+
+      --mnb_marked_darts[amark];
+      flip_dart_mark(adart, amark);
+    }
+
+    /** Mark null_dart (used as a sentinel in iterators).
+     * As null dart does not belong to the set of darts, it is not counted
+     * as number of marked darts.
+     * @param amark the given mark.
+     */
+    void mark_null_dart(size_type amark) const
+    {
+      CGAL_assertion( is_reserved(amark) );
+      set_dart_mark(null_dart_handle, amark, !mmask_marks[amark]);
+    }
+
+    /** Unmark null_dart.
+     * @param amark the given mark.
+     */
+    void unmark_null_dart(size_type amark) const
+    {
+      CGAL_assertion( is_reserved(amark) );
+      set_dart_mark(null_dart_handle, amark, mmask_marks[amark]);
+    }
+
+    /** Unmark all the darts of the map for a given mark.
+     * If all the darts are marked or unmarked, this operation takes O(1)
+     * operations, otherwise it traverses all the darts of the map.
+     * @param amark the given mark.
+     */
+    void unmark_all(size_type amark) const
+    {
+      CGAL_assertion( is_reserved(amark) );
+
+      if ( is_whole_map_marked(amark) )
+      {
+        negate_mark(amark);
+      }
+      else if ( !is_whole_map_unmarked(amark) )
+      {
+        for ( typename Dart_range::const_iterator it(darts().begin()),
+               itend(darts().end()); it!=itend; ++it)
+          unmark(it, amark);
+      }
+      CGAL_assertion(is_whole_map_unmarked(amark));
+      unmark_null_dart(amark);
+    }
+
+    /** Free a given mark, previously calling unmark_all_darts.
+     * @param amark the given mark.
+     */
+    void free_mark(size_type amark) const
+    {
+      CGAL_assertion( is_reserved(amark) );
+
+      if ( mnb_times_reserved_marks[amark]>1 )
+      {
+        --mnb_times_reserved_marks[amark];
+        return;
+      }
+
+      unmark_all(amark);
+
+      // 1) We remove amark from the array mused_marks_stack by
+      //    replacing it with the last mark in this array.
+      mused_marks_stack[mindex_marks[amark]] =
+        mused_marks_stack[--mnb_used_marks];
+      mindex_marks[mused_marks_stack[mnb_used_marks]] =
+        mindex_marks[amark];
+
+      // 2) We add amark in the array mfree_marks_stack and update its index.
+      mfree_marks_stack[ mnb_used_marks ] = amark;
+      mindex_marks[amark] = mnb_used_marks;
+
+      mnb_times_reserved_marks[amark]=0;
+    }
+
+    /** Test if this map is without boundary for a given dimension.
+     * @param i the dimension.
+     * @return true iff all the darts are not i-free.
+     * @pre 1<=i<=n
+     */
+    bool is_without_boundary(unsigned int i) const
+    {
+      CGAL_assertion(1<=i && i<=dimension);
+      for ( typename Dart_const_range::const_iterator it(darts().begin()),
+             itend(darts().end()); it!=itend; ++it)
+        if (is_free(it, i)) return false;
+      return true;
+    }
+
+    /** Test if this map is without boundary for all the dimensions.
+     * @return true iff all the darts are non free.
+     */
+    bool is_without_boundary() const
+    {
+      for ( typename Dart_const_range::const_iterator it(darts().begin()),
+             itend(darts().end()); it!=itend; ++it)
+        for ( unsigned int i = 1; i<=dimension; ++i)
+          if (is_free(it, i)) return false;
+      return true;
+    }
+
+    /** Close the combinatorial map for a given dimension.
+     *  @param i the dimension to close
+     *  @return the number of new darts.
+     *  @pre 2<=i<=n (TODO case i==1)
+     *  @TODO move into Combinatorial_map_operations ?
+     */
+    template<unsigned int i>
+    unsigned int close()
+    {
+      CGAL_assertion( 2<=i && i<=dimension );
+      unsigned int res = 0;
+      Dart_handle d, d2;
+
+      for ( typename Dart_range::iterator it(darts().begin());
+           it!=darts().end(); ++it)
+      {
+        if ( this->template is_free<i>(it) )
+        {
+          d = create_dart();
+          ++res;
+
+          link_beta_for_involution<i>(it, d);
+
+          // Special cases for 0 and 1
+          if ( !this->template is_free<1>(it) && !this->template is_free<i>(beta<1>(it)) )
+            link_beta<1>(beta<1,i>(it),d);
+          if ( !this->template is_free<0>(it) && !this->template is_free<i>(beta<0>(it)) )
+            link_beta<0>(beta<0,i>(it),d);
+          // General case for 2...dimension
+          for ( unsigned int j=2; j<=dimension; ++j)
+          {
+            if ( j+1!=i && j!=i && j!=i+1 &&
+                 !is_free(it,j) && !this->template is_free<i>(beta(it, j)) )
+            {
+              basic_link_beta_for_involution(beta(it, j, i), d, j);
+            }
+          }
+
+          d2 = it;
+          while (d2 != null_dart_handle && !this->template is_free<i-1>(d2))
+          { d2 = beta<i-1, i>(d2); }
+          if (d2 != null_dart_handle)
+          {
+            if (i==2) basic_link_beta<1>(d2, d);
+            else basic_link_beta_for_involution<i-1>(d2, d);
+          }
+        }
+      }
+      return res;
+    }
+
+    /** Test if the map is valid.
+     * @return true iff the map is valid.
+     */
+    bool is_valid() const
+    {
+      bool valid = true;
+      unsigned int i = 0, j = 0;
+      std::vector<size_type> marks(dimension+1);
+      for ( i=0; i<=dimension; ++i)
+        marks[i] = INVALID_MARK;
+
+      Helper::template
+        Foreach_enabled_attributes<Reserve_mark_functor<Self> >::
+          run(this,&marks);
+
+      for ( typename Dart_range::const_iterator it(darts().begin()),
+             itend(darts().end()); it!=itend; ++it)
+      {
+        if ( !valid )
+        { // We continue the traversal to mark all the darts.
+          for ( i=0; i<=dimension; ++i)
+            if (marks[i]!=INVALID_MARK) mark(it,marks[i]);
+        }
+        else
+        {
+          // beta0 must be the inverse of beta1
+          if ((!is_free(it, 0) && beta(it, 0, 1)!=it) ||
+              (!is_free(it, 1) && beta(it, 1, 0)!=it ))
+          {
+            std::cerr << "Map not valid: beta(0) "
+              "is not the inverse of beta(1) for "
+                      <<&(*it) << std::endl;
+            valid = false;
+          }
+
+          // Each beta(i>=2) must be an involution
+          for ( i = 2; i <= dimension; ++i)
+            if (!is_free(it, i) && beta(it, i, i)!=it)
+            {
+              std::cerr << "Map not valid: beta(" << i
+                        << ") is not an involution for "
+                        <<&(*it) << std::endl;
+              valid = false;
+            }
+
+          // beta1 o betai and beta0 o betai (i>=3) must be involutions
+          if (!is_free(it, 0))
+          {
+            for ( i = 3; i <= dimension; ++i)
+              if ((is_free(it, i) != is_free(beta(it, 0), i)) ||
+                  (!is_free(it, i) && beta(it, 0, i)!=beta(it, i, 1)))
+              {
+                std::cerr << "Map not valid: beta(0) o beta(" << i
+                          << ") is not an involution for "
+                          <<&(*it) << std::endl;
+                valid = false;
+              }
+          }
+          if (!is_free(it, 1))
+          {
+            for ( i = 3; i <= dimension; ++i)
+              if ((is_free(it, i) != is_free(beta(it, 1), i)) ||
+                  (!is_free(it, i) && beta(it, 1, i)!=beta(it, i, 0)))
+              {
+                std::cerr << "Map not valid: beta(1) o beta(" << i
+                          << ") is not an involution for "
+                          <<&(*it)<< std::endl;
+                valid = false;
+              }
+          }
+
+          // beta(i>=2) o beta(j>=i+2) must be an involution
+          for ( i = 2; i <= dimension; ++i)
+          {
+            if (!is_free(it, i))
+            {
+              for ( j = i + 2; j <= dimension; ++j)
+                if ((is_free(it, j)!=is_free(beta(it, i), j)) ||
+                    (!is_free(it, j) && beta(it, i, j)!=beta(it, j, i)))
+                {
+                  std::cerr << "Map not valid: beta(" << i
+                            << ") o beta(" << j
+                            << ") is not an involution for "
+                            << &(*it)<< std::endl;
+                  valid = false;
+                }
+            }
+          }
+          Helper::template Foreach_enabled_attributes
+            <internal::Test_is_valid_attribute_functor<Self> >::
+            run(this,it,&marks,&valid);
+        }
+      }
+      for ( i=0; i<=dimension; ++i)
+        if ( marks[i]!=INVALID_MARK )
+        {
+          CGAL_assertion( is_whole_map_marked(marks[i]) );
+          free_mark(marks[i]);
+        }
+
+      return valid;
+    }
+
+    /// correct invalid attributes in the map
+    void correct_invalid_attributes()
+    {
+      std::vector<size_type> marks(dimension+1);
+      for ( unsigned int i=0; i<=dimension; ++i)
+        marks[i] = INVALID_MARK;
+
+      Helper::template
+        Foreach_enabled_attributes<Reserve_mark_functor<Self> >::
+          run(this,&marks);
+
+      for ( typename Dart_range::iterator it(darts().begin()),
+             itend(darts().end()); it!=itend; ++it)
+      {
+        Helper::template Foreach_enabled_attributes
+          <internal::Correct_invalid_attributes_functor<Self> >::
+          run(this,it,&marks);
+      }
+
+      for ( unsigned int i=0; i<=dimension; ++i)
+        if ( marks[i]!=INVALID_MARK )
+        {
+          CGAL_assertion( is_whole_map_marked(marks[i]) );
+          free_mark(marks[i]);
+        }
+    }
+
+    /// @return the number of darts.
+    size_type number_of_darts() const
+    { return mdarts.size(); }
+
+    /// @return an estimation of the bytes used by the combinatorial map.
+    size_type bytes() const
+    {
+      return mdarts.capacity() * sizeof(Dart) +
+        internal::Count_bytes_all_attributes_functor<Self>::run(*this);
+    }
+
+    /** Write the content of the map: each dart and each beta links.
+     * @param os the ostream.
+     * @return the ostream.
+     */
+    std::ostream& display_darts(std::ostream & os, bool attribs=false) const
+    {
+      unsigned int nb = 0;
+      for ( typename Dart_range::const_iterator it=darts().begin();
+           it!=darts().end(); ++it)
+      {
+        os << " dart " << &(*it) << "; beta[i]=";
+        for ( unsigned int i=0; i<=dimension; ++i)
+        {
+          os << &(*it->beta(i)) << ",\t";
+          if (it->is_free(i)) os << "\t";
+        }
+        if ( attribs )
+        {
+          Helper::template Foreach_enabled_attributes
+              <Display_attribute_functor<Self> >::run(this, it);
+        }
+        os << std::endl;
+        ++nb;
+      }
+      os << "Number of darts: " << nb <<"(sizeofdarts="
+         <<number_of_darts()<<")" << std::endl;
+      return os;
+    }
+
+    /** Write the content of each given orbit of the map.
+     * @param aos the ostream.
+     * @return the ostream.
+     */
+    template < class Ite >
+    std::ostream& display_orbits(std::ostream & aos) const
+    {
+      CGAL_static_assertion( (boost::is_same<typename Ite::Basic_iterator,
+                              Tag_true>::value) );
+      unsigned int nb = 0;
+      size_type amark = get_new_mark();
+      for ( typename Dart_range::const_iterator it1(darts().begin()),
+             itend(darts().end()); it1!=itend; ++it1)
+      {
+        if ( !is_marked(it1, amark) )
+        {
+          ++nb;
+          for ( Ite it2(*this, it1, amark); it2.cont(); ++it2 )
+          {
+            aos << &(**it2) << " - " << std::flush;
+            mark(*it2, amark);
+          }
+          aos << std::endl;
+        }
+      }
+      CGAL_assertion( is_whole_map_marked(amark) );
+      free_mark(amark);
+      aos << "Number of orbits: " << nb << std::endl;
+      return aos;
+    }
+
+    /** Write the content of each i-cell of the map.
+     * @param aos the ostream.
+     * @return the ostream.
+     */
+    template < unsigned int i >
+    std::ostream& display_cells(std::ostream & aos) const
+    {
+      return display_orbits<CMap_dart_const_iterator_basic_of_cell<Self,i> >
+        (aos);
+    }
+
+    /** Write the number of darts and cells of the map into a given ostream.
+     * @param os the ostream.
+     * @return the ostream.
+     */
+    std::ostream& display_characteristics(std::ostream & os) const
+    {
+      std::vector<unsigned int> cells(dimension+2);
+      for ( unsigned int i=0; i<=dimension+1; ++i)
+      { cells[i]=i; }
+
+      std::vector<unsigned int> res = count_cells(cells);
+
+      os << "#Darts=" << number_of_darts();
+      for ( unsigned int i=0; i<=dimension; ++i)
+        os<<", #"<<i<<"-cells="<<res[i];
+      os<<", #ccs="<<res[dimension+1];
+
+      return os;
+    }
+
+    /// Create a new attribute.
+    /// @return a handle on the new attribute.
+#ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
+    template<unsigned int i, typename ...Args>
+    typename Attribute_handle<i>::type create_attribute(const Args&... args)
+    {
+      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
+                  "create_attribute<i> but i-attributes are disabled");
+     typename Attribute_handle<i>::type res=
+       CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
+        (mattribute_containers).emplace(args...);
+     // Reinitialize the ref counting of the new attribute. This is normally
+     // not required except if create_attribute is used as "copy contructor".
+     this->template get_attribute<i>(res).mrefcounting = 0;
+     return res;
+    }
+#else
+    template<unsigned int i>
+    typename Attribute_handle<i>::type
+    create_attribute()
+    {
+      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
+                  "create_attribute<i> but i-attributes are disabled");
+      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
+        (mattribute_containers).emplace();
+    }
+    template<unsigned int i, typename T1>
+    typename Attribute_handle<i>::type
+    create_attribute(const T1 &t1)
+    {
+      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
+                  "create_attribute<i> but i-attributes are disabled");
+     typename Attribute_handle<i>::type res=
+       CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
+        (mattribute_containers).emplace(t1);
+     this->template get_attribute<i>(res).mrefcounting = 0;
+     return res;
+    }
+    template<unsigned int i, typename T1, typename T2>
+    typename Attribute_handle<i>::type
+    create_attribute(const T1 &t1, const T2 &t2)
+    {
+      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
+                  "create_attribute<i> but i-attributes are disabled");
+      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
+        (mattribute_containers).emplace(t1, t2);
+    }
+    template<unsigned int i, typename T1, typename T2, typename T3>
+    typename Attribute_handle<i>::type
+    create_attribute(const T1 &t1, const T2 &t2, const T3 &t3)
+    {
+      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
+                  "create_attribute<i> but i-attributes are disabled");
+      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
+        (mattribute_containers).emplace(t1, t2, t3);
+    }
+    template<unsigned int i, typename T1, typename T2, typename T3, typename T4>
+    typename Attribute_handle<i>::type
+    create_attribute(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4)
+    {
+      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
+                  "create_attribute<i> but i-attributes are disabled");
+      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
+        (mattribute_containers).emplace(t1, t2, t3, t4);
+    }
+    template<unsigned int i, typename T1, typename T2, typename T3, typename T4,
+             typename T5>
+    typename Attribute_handle<i>::type
+    create_attribute(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4,
+                     const T5 &t5)
+    {
+      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
+                  "create_attribute<i> but i-attributes are disabled");
+      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
+        (mattribute_containers).emplace(t1, t2, t3, t4, t5);
+    }
+    template<unsigned int i, typename T1, typename T2, typename T3, typename T4,
+             typename T5, typename T6>
+    typename Attribute_handle<i>::type
+    create_attribute(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4,
+                     const T5 &t5, const T6 &t6)
+    {
+      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
+                  "create_attribute<i> but i-attributes are disabled");
+      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
+        (mattribute_containers).emplace(t1, t2, t3, t4, t5, t6);
+    }
+    template<unsigned int i, typename T1, typename T2, typename T3, typename T4,
+             typename T5, typename T6, typename T7>
+    typename Attribute_handle<i>::type
+    create_attribute(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4,
+                     const T5 &t5, const T6 &t6, const T7 &t7)
+    {
+      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
+                  "create_attribute<i> but i-attributes are disabled");
+      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
+        (mattribute_containers).emplace(t1, t2, t3, t4, t5, t6, t7);
+    }
+    template<unsigned int i, typename T1, typename T2, typename T3, typename T4,
+             typename T5, typename T6, typename T7, typename T8>
+    typename Attribute_handle<i>::type
+    create_attribute(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4,
+                     const T5 &t5, const T6 &t6, const T7 &t7, const T8 &t8)
+    {
+      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
+                  "create_attribute<i> but i-attributes are disabled");
+      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
+        (mattribute_containers).emplace(t1, t2, t3, t4, t5, t6, t7, t8);
+    }
+    template<unsigned int i, typename T1, typename T2, typename T3, typename T4,
+             typename T5, typename T6, typename T7, typename T8, typename T9>
+    typename Attribute_handle<i>::type
+    create_attribute(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4,
+                     const T5 &t5, const T6 &t6, const T7 &t7, const T8 &t8,
+                     const T9 &t9)
+    {
+      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
+                  "create_attribute<i> but i-attributes are disabled");
+      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
+        (mattribute_containers).emplace(t1, t2, t3, t4, t5, t6, t7, t8, t9);
+    }
+#endif
+
+    /// Erase an attribute.
+    /// @param h a handle to the attribute to erase.
+    template<unsigned int i>
+    void erase_attribute(typename Attribute_handle<i>::type h)
+    {
+      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
+                  "erase_attribute<i> but i-attributes are disabled");
+      CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
+        (mattribute_containers).erase(h);
+    }
+
+    /// @return true if ah points to a used i-attribute (i.e. valid).
+    template<unsigned int i>
+    bool is_attribute_used(typename Attribute_const_handle< i >::type ah) const
+    {
+      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
+                                "is_attribute_used<i> but i-attributes are disabled");
+      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
+        (mattribute_containers).is_used(ah);
+    }
+
+    /// @return the number of attributes.
+    template <unsigned int i>
+    size_type number_of_attributes() const
+    {
+      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
+                  "number_of_attributes<i> but i-attributes are disabled");
+      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
+        (mattribute_containers).size();
+    }
+
+    /** Set the i th attribute of all the darts of a given i-cell.
+     * @param adart a dart of the i-cell.
+     * @param ah the vertex to set.
+     */
+    template<unsigned int i>
+    void set_attribute(Dart_handle dh,
+                       typename Attribute_handle<i>::type ah)
+    {
+      CGAL_static_assertion(i<=dimension);
+      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
+                  "set_attribute<i> but i-attributes are disabled");
+      for ( typename Dart_of_cell_range<i>::iterator it(*this, dh);
+            it.cont(); ++it)
+      {
+        this->template set_dart_attribute<i>(it, ah);
+      }
+    }
+
+    /// @return a Attributes_range<i> (range through all the
+    /// attributes<i> of the map).
+    template<unsigned int i>
+    typename Attribute_range<i>::type & attributes()
+    {
+      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
+                                "attributes<i> but i-attributes are disabled");
+      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
+        (mattribute_containers);
+    }
+
+    template<unsigned int i>
+    typename Attribute_const_range<i>::type & attributes() const
+    {
+      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
+                                "attributes<i> but i-attributes are disabled");
+      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
+        (mattribute_containers);
+    }
+
+    // Get the ith dynamic onsplit functor (by reference so that we can
+    // modify it directly).
+    template<int i>
+    boost::function<void(typename Attribute_type<i>::type&,
+                         typename Attribute_type<i>::type&)>&
+    onsplit_functor()
+    {
+      CGAL_static_assertion_msg
+          (Helper::template Dimension_index<i>::value>=0,
+           "onsplit_functor<i> but "
+           "i-attributes are disabled");
+
+      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
+        (m_onsplit_functors);
+    }
+
+    // Get the ith dynamic onsplit functor (by reference so that we can
+    // modify it directly).
+    template<int i>
+    const boost::function<void(typename Attribute_type<i>::type&,
+                               typename Attribute_type<i>::type&)>&
+    onsplit_functor() const
+    {
+      CGAL_static_assertion_msg
+          (Helper::template Dimension_index<i>::value>=0,
+           "onsplit_functor<i> but "
+           "i-attributes are disabled");
+
+      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
+        (m_onsplit_functors);
+    }
+
+    // Get the ith dynamic onmerge functor (by reference so that we can
+    // modify it directly).
+    template<int i>
+    boost::function<void(typename Attribute_type<i>::type&,
+                               typename Attribute_type<i>::type&)>&
+    onmerge_functor()
+    {
+      CGAL_static_assertion_msg
+          (Helper::template Dimension_index<i>::value>=0,
+           "onsplit_functor<i> but "
+           "i-attributes are disabled");
+
+      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
+        (m_onmerge_functors);
+    }
+    // Get the ith dynamic onmerge functor (by reference so that we can
+    // modify it directly).
+    template<int i>
+    const boost::function<void(typename Attribute_type<i>::type&,
+                               typename Attribute_type<i>::type&)>&
+    onmerge_functor() const
+    {
+      CGAL_static_assertion_msg
+          (Helper::template Dimension_index<i>::value>=0,
+           "onsplit_functor<i> but "
+           "i-attributes are disabled");
+
+      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
+        (m_onmerge_functors);
+    }
+
+    /** Double link a dart with beta 0 to a second dart.
+     * \em adart1 is 0-linked to \em adart2 and \em adart2 is 1-linked
+     * with \em adart1. Attributes are not updated, thus we can obtain
+     * a non-valid map with darts belonging to a same orbit and having
+     * different attributes.
+     * @param adart1 a first dart.
+     * @param adart2 a second dart.
+     */
+    void basic_link_beta_0(Dart_handle adart1, Dart_handle adart2)
+    {
+      // Intel warning #1017: name following "template" must be a template
+      this->template dart_link_beta<0>(adart1, adart2);
+      this->template dart_link_beta<1>(adart2, adart1);
+    }
+
+    /** Double link a dart with beta 0 to a second dart.
+     * \em adart1 is 0-linked to \em adart2 and \em adart2 is 1-linked
+     * with \em adart1. Attributes are not updated, thus we can obtain
+     * a non-valid map with darts belonging to a same orbit and having
+     * different attributes.
+     * @param adart1 a first dart.
+     * @param adart2 a second dart.
+     */
+    void basic_link_beta_1(Dart_handle adart1, Dart_handle adart2)
+    {
+      this->template dart_link_beta<1>(adart1, adart2);
+      this->template dart_link_beta<0>(adart2, adart1);
+    }
+
+    /** Double link a dart with beta i to a second dart, when i>=2.
+     * \em adart1 is i-linked to \em adart2 and \em adart2 is i-linked
+     * with \em adart1. Attributes are not updated, thus we can obtain
+     * a non-valid map with darts belonging to a same orbit and having
+     * different attributes.
+     * @param adart1 a first dart.
+     * @param adart2 a second dart.
+     * @param i the dimension of the beta.
+     */
+    template<unsigned int i>
+    void basic_link_beta_for_involution(Dart_handle adart1, Dart_handle adart2)
+    {
+      CGAL_assertion( i>=2 && i<=dimension );
+      this->template dart_link_beta<i>(adart1, adart2);
+      this->template dart_link_beta<i>(adart2, adart1);
+    }
+    void basic_link_beta_for_involution(Dart_handle adart1, Dart_handle adart2,
+                                        unsigned int i)
+    {
+      CGAL_assertion( i>=2 && i<=dimension );
+      CGAL_assertion( i>=2 && i<=dimension );
+      dart_link_beta(adart1, adart2, i);
+      dart_link_beta(adart2, adart1, i);
+    }
+
+    /** Double link a dart with betai to a second dart.
+     * \em adart1 is i-linked to \em adart2 and \em adart2 is i^-1-linked
+     * with \em adart1. Attributes are not updated, thus we can obtain
+     * a non-valid map with darts belonging to a same orbit and having
+     * different attributes.
+     * @param adart1 a first dart.
+     * @param adart2 a second dart.
+     */
+    template<unsigned int i>
+    void basic_link_beta(Dart_handle adart1, Dart_handle adart2)
+    {
+      if ( i==0 ) basic_link_beta_0(adart1, adart2);
+      else if ( i==1 ) basic_link_beta_1(adart1, adart2);
+      else basic_link_beta_for_involution<i>(adart1, adart2);
+    }
+    void basic_link_beta(Dart_handle adart1, Dart_handle adart2,
+                         unsigned int i)
+    {
+      if ( i==0 ) basic_link_beta_0(adart1, adart2);
+      else if ( i==1 ) basic_link_beta_1(adart1, adart2);
+      else basic_link_beta_for_involution(adart1, adart2, i);
+    }
+
+    /** Double link two darts, and update the NULL attributes.
+     * \em adart1 is 0-linked to \em adart2 and \em adart2 is 1-linked
+     * with \em adart1. The NULL attributes of \em adart1 are updated to
+     * non NULL attributes associated to \em adart2, and vice-versa.
+     * If both darts have an attribute, the attribute of adart1 is
+     * associated to adart2.
+     * We can obtain a non-valid map with darts belonging to a same cell
+     * and having different attributes.
+     * @param adart1 a first dart.
+     * @param adart2 a second dart.
+     */
+    void link_beta_0(Dart_handle adart1, Dart_handle adart2)
+    {
+      Helper::template Foreach_enabled_attributes_except
+        <internal::Group_attribute_functor_of_dart<Self, 0>, 1>::
+        run(this,adart1,adart2);
+      this->template dart_link_beta<0>(adart1, adart2);
+      this->template dart_link_beta<1>(adart2, adart1);
+    }
+
+    /** Double link two darts, and update the NULL attributes.
+     * \em adart1 is 1-linked to \em adart2 and \em adart2 is 0-linked
+     * with \em adart1. The NULL attributes of \em adart1 are updated to
+     * non NULL attributes associated to \em adart2, and vice-versa.
+     * If both darts have an attribute, the attribute of adart1 is
+     * associated to adart2.
+     * We can obtain a non-valid map with darts belonging to a same cell
+     * and having different attributes.
+     * @param adart1 a first dart.
+     * @param adart2 a second dart.
+     */
+    void link_beta_1(Dart_handle adart1, Dart_handle adart2)
+    {
+      Helper::template Foreach_enabled_attributes_except
+        <internal::Group_attribute_functor_of_dart<Self, 1>, 1>::
+        run(this,adart1,adart2);
+      this->template dart_link_beta<1>(adart1, adart2);
+      this->template dart_link_beta<0>(adart2, adart1);
+    }
+
+    /** Double link two darts, and update the NULL attributes.
+     * \em adart1 is i-linked to \em adart2 and \em adart2 is i^-1-linked
+     * with \em adart1. The NULL attributes of \em adart1 are updated to
+     * non NULL attributes associated to \em adart2, and vice-versa.
+     * If both darts have an attribute, the attribute of adart1 is
+     * associated to adart2.
+     * We can obtain a non-valid map with darts belonging to a same cell
+     * and having different attributes.
+     * @param adart1 a first dart.
+     * @param adart2 a second dart.
+     * @param i the dimension of the beta.
+     * @pre 2<=i<=dimension.
+     */
+    template<unsigned int i>
+    void link_beta_for_involution(Dart_handle adart1, Dart_handle adart2)
+    {
+      CGAL_assertion( 2<=i && i<=dimension );
+      Helper::template Foreach_enabled_attributes_except
+        <internal::Group_attribute_functor_of_dart<Self, i>, i>::
+        run(this,adart1,adart2);
+      this->template dart_link_beta<i>(adart1, adart2);
+      this->template dart_link_beta<i>(adart2, adart1);
+    }
+
+    /** Double link two darts, and update the NULL attributes.
+     * \em adart1 is i-linked to \em adart2 and \em adart2 is i^-1-linked
+     * with \em adart1. The NULL attributes of \em adart1 are updated to
+     * non NULL attributes associated to \em adart2, and vice-versa.
+     * If both darts have an attribute, the attribute of adart1 is
+     * associated to adart2.
+     * We can obtain a non-valid map with darts belonging to a same cell
+     * and having different attributes.
+     * @param adart1 a first dart.
+     * @param adart2 a second dart.
+     */
+    template<unsigned int i>
+    void link_beta(Dart_handle adart1, Dart_handle adart2)
+    {
+      if ( are_attributes_automatically_managed() )
+      {
+        if ( i==0 ) link_beta_0(adart1, adart2);
+        else if ( i==1 ) link_beta_1(adart1, adart2);
+        else link_beta_for_involution<i>(adart1, adart2);
+      }
+      else basic_link_beta<i>(adart1, adart2);
+    }
+
+    /** Double link a dart with betai to a second dart.
+     * \em adart1 is i-linked to \em adart2 and \em adart2 is i^-1-linked
+     * with \em adart1. The NULL attributes of \em adart1 are updated to
+     * non NULL attributes associated to \em adart2, and vice-versa,
+     * if both darts have an attribute, the attribute of adart1 is
+     * associated to adart2 (only if update_attributes==true).
+     * @param adart1 a first dart.
+     * @param adart2 a second dart.
+     * @param update_attributes a boolean to update the enabled attributes.
+     *         (deprecated, now we use are_attributes_automatically_managed())
+     */
+    template<unsigned int i>
+    void link_beta(Dart_handle adart1, Dart_handle adart2,
+                   bool update_attributes)
+    {
+      if ( update_attributes ) link_beta<i>(adart1, adart2);
+      else basic_link_beta<i>(adart1, adart2);
+    }
+
+    /** Double unlink a dart with beta 0.
+     * beta0(\em adart) is 1-unlinked and \em adart is 0-unlinked.
+     * The attributes are not updated, thus we can obtain a non-valid map
+     * with darts belonging to different orbits and having the same
+     * attributes.
+     * @param adart a dart.
+     */
+    void unlink_beta_0(Dart_handle adart)
+    {
+      CGAL_assertion(!this->template is_free<0>(adart));
+      this->template dart_unlink_beta<1>(beta<0>(adart));
+      this->template dart_unlink_beta<0>(adart);
+    }
+
+    /** Double unlink a dart with beta 1.
+     * beta1(\em adart) is 0-unlinked and \em adart is 1-unlinked.
+     * The attributes are not updated, thus we can obtain a non-valid map
+     * with darts belonging to different orbits and having the same
+     * attributes.
+     * @param adart a dart.
+     */
+    void unlink_beta_1(Dart_handle adart)
+    {
+      CGAL_assertion(!this->template is_free<1>(adart));
+      this->template dart_unlink_beta<0>(beta<1>(adart));
+      this->template dart_unlink_beta<1>(adart);
+    }
+
+    /** Double unlink a dart with beta i, for i>=2.
+     * betai(\em adart) is i-unlinked and \em adart is i-unlinked.
+     * The attributes are not updated, thus we can obtain a non-valid map
+     * with darts belonging to different orbits and having the same
+     * attributes.
+     * @param adart a dart.
+     * @param i the dimension of the beta.
+     */
+    template<unsigned int i>
+    void unlink_beta_for_involution(Dart_handle adart)
+    {
+      CGAL_assertion(!this->template is_free<i>(adart));
+      CGAL_assertion(2<=i && i<=dimension);
+      this->template dart_unlink_beta<i>(beta<i>(adart));
+      this->template dart_unlink_beta<i>(adart);
+    }
+    void unlink_beta_for_involution(Dart_handle adart, unsigned int i)
+    {
+      CGAL_assertion(!is_free(adart,i));
+      CGAL_assertion(2<=i && i<=dimension);
+      dart_unlink_beta(beta(adart, i), i);
+      dart_unlink_beta(adart, i);
+    }
+
+    /** Double unlink a dart with beta i.
+     * betai(\em adart) is i-1-unlinked and \em adart is i-unlinked.
+     * The attributes are not updated, thus we can obtain a non-valid map
+     * with darts belonging to different orbits and having the same
+     * attributes.
+     * @param adart a dart.
+     * @param i the dimension of the beta.
+     */
+    template<unsigned int i>
+    void unlink_beta(Dart_handle adart)
+    {
+      if ( i==0 ) unlink_beta_0(adart);
+      else if ( i==1 ) unlink_beta_1(adart);
+      else unlink_beta_for_involution<i>(adart);
+    }
+    void unlink_beta(Dart_handle adart, unsigned int i)
+    {
+      if ( i==0 ) unlink_beta_0(adart);
+      else if ( i==1 ) unlink_beta_1(adart);
+      else unlink_beta_for_involution(adart, i);
+    }
+
+    /** Test if it is possible to sew by betai the two given darts
+     * @param adart1 the first dart.
+     * @param adart2 the second dart.
+     * @return true iff \em adart1 can be i-sewn with \em adart2.
+     */
+    template<unsigned int i>
+    bool is_sewable(Dart_const_handle adart1, Dart_const_handle adart2) const
+    {
+      return CGAL::internal::
+          Is_sewable_functor<Self, i>::run(this, adart1, adart2);
+    }
+
+    /** Topological sew by beta1 the two given darts plus all the required darts
+     * to satisfy the combinatorial map validity: but do not update attributes
+     * thus the map can be non valid.
+     * @param adart1 the first dart.
+     * @param adart2 the second dart.
+     * @pre is_sewable<1>(adart1, adart2).
+     */
+    void topo_sew_1(Dart_handle adart1, Dart_handle adart2)
+    {
+      CGAL_assertion( (is_sewable<1>(adart1,adart2)) );
+
+      if ( adart1==adart2 )
+      {
+        for ( CGAL::CMap_dart_iterator_of_involution<Self,1> it(*this, adart1);
+              it.cont(); ++it )
+        {
+          basic_link_beta_1(it, it);
+        }
+      }
+      else
+      {
+        size_type m = get_new_mark();
+        std::deque<Dart_handle> dartv;
+        for ( CGAL::CMap_dart_iterator_basic_of_cell<Self,0>
+              it(*this, adart1, m); it.cont(); ++it )
+        {
+          mark(it,m);
+          dartv.push_back(it);
+        }
+
+        CGAL::CMap_dart_iterator_of_involution<Self,1>     I1(*this, adart1);
+        CGAL::CMap_dart_iterator_of_involution_inv<Self,1> I2(*this, adart2);
+        for ( ; I1.cont(); ++I1, ++I2 )
+        {
+          if ( is_marked(I1,m) ) basic_link_beta_1(I1, I2);
+          else                   basic_link_beta_0(I1, I2);
+        }
+
+        for ( typename std::deque<Dart_handle>::iterator it=dartv.begin();
+              it!=dartv.end(); ++it)
+        { unmark(*it,m); }
+        CGAL_assertion( is_whole_map_unmarked(m) );
+        free_mark(m);
+      }
+    }
+
+    /** Topological sew by beta0 two given darts plus all the required darts
+     * to satisfy the combinatorial map validity: but do not update attributes
+     * thus the map can be non valid.
+     * @param adart1 the first dart.
+     * @param adart2 the second dart.
+     * @pre is_sewable<0>(adart1, adart2).
+     */
+    void topo_sew_0(Dart_handle adart1, Dart_handle adart2)
+    { topo_sew_1(adart2, adart1); }
+
+    /** Topological sew by betai two given darts plus all the required darts
+     * to satisfy the combinatorial map validity: but do not update attributes
+     * thus the map can be non valid.
+     * @param adart1 the first dart.
+     * @param adart2 the second dart.
+     * @pre 2<=i<=dimension.
+     * @pre is_sewable<i>(adart1, adart2).
+     */
+    template<unsigned int i>
+    void topo_sew_for_involution(Dart_handle adart1, Dart_handle adart2)
+    {
+      CGAL_assertion( 2<=i && i<=Self::dimension );
+      CGAL_assertion( (is_sewable<i>(adart1,adart2)) );
+
+      CGAL::CMap_dart_iterator_of_involution<Self,i>     I1(*this, adart1);
+      CGAL::CMap_dart_iterator_of_involution_inv<Self,i> I2(*this, adart2);
+      for ( ; I1.cont();  ++I1, ++I2 )
+      {
+        basic_link_beta_for_involution<i>(I1, I2);
+      }
+    }
+
+    /** Topological sew by betai two given darts plus all the required darts
+     * to satisfy the combinatorial map validity: but do not update attributes
+     * thus the map can be non valid.
+     * @param adart1 the first dart.
+     * @param adart2 the second dart.
+     * @pre is_sewable<i>(adart1, adart2).
+     */
+    template<unsigned int i>
+    void topo_sew(Dart_handle adart1, Dart_handle adart2)
+    {
+      if ( i==0 ) topo_sew_1(adart2, adart1);
+      else if ( i==1 ) topo_sew_1(adart1, adart2);
+      else topo_sew_for_involution<i>(adart1, adart2);
+    }
+
+    /** Sew by beta0 the two given darts plus all the required darts
+     * to satisfy the combinatorial map validity, and updates enabled
+     * attributes when necessary so that the final map is valid.
+     * @param adart1 the first dart.
+     * @param adart2 the second dart.
+     * @pre is_sewable<0>(adart1, adart2).
+     * @post is_valid()
+     */
+    void sew_0(Dart_handle adart1, Dart_handle adart2)
+    {
+      CGAL_assertion( (is_sewable<0>(adart1,adart2)) );
+
+      if ( adart1==adart2 )
+      {
+        for ( CGAL::CMap_dart_iterator_of_involution<Self,1> it(*this, adart1);
+              it.cont(); ++it )
+        {
+          basic_link_beta_1(it, it);
+        }
+        return;
+      }
+
+      size_type m = get_new_mark();
+      std::deque<Dart_handle> dartv;
+      for ( CGAL::CMap_dart_iterator_basic_of_cell<Self, 0>
+            it(*this, adart1, m); it.cont(); ++it )
+      {
+        mark(it,m);
+        dartv.push_back(it);
+      }
+
+      size_type mark = get_new_mark();
+
+      CGAL::CMap_dart_iterator_basic_of_involution<Self, 1>
+          I1(*this, adart1, mark);
+      CGAL::CMap_dart_iterator_basic_of_involution_inv<Self, 1>
+          I2(*this, adart2, mark);
+
+      // This first loop do not modify the map, but only the attributes
+      // (by calling when required the onmerge functors).
+      for ( ; I1.cont(); ++I1, ++I2 )
+      {
+        if ( is_marked(I1,m) )
+          Helper::template Foreach_enabled_attributes_except
+              <CGAL::internal::Group_attribute_functor<Self, 0>, 1>::
+              run(this, I1, I2);
+        else
+          Helper::template Foreach_enabled_attributes_except
+              <CGAL::internal::Group_attribute_functor<Self, 1>, 1>::
+              run(this, I1, I2);
+      }
+
+      // Now we update the beta links.
+      negate_mark( mark );
+      for ( I1.rewind(), I2.rewind(); I1.cont(); ++I1, ++I2 )
+      {
+        if ( is_marked(I1,m) ) basic_link_beta_0(I1, I2);
+        else                   basic_link_beta_1(I1, I2);
+      }
+
+      for ( typename std::deque<Dart_handle>::iterator it=dartv.begin();
+            it!=dartv.end(); ++it )
+      { unmark(*it,m); }
+      CGAL_assertion( is_whole_map_unmarked(m) );
+      free_mark(m);
+
+      negate_mark( mark );
+      CGAL_assertion( is_whole_map_unmarked(mark) );
+      free_mark(mark);
+    }
+
+    /** Sew by beta1 the two given darts plus all the required darts
+     * to satisfy the combinatorial map validity, and updates enabled
+     * attributes when necessary so that the final map is valid.
+     * @param adart1 the first dart.
+     * @param adart2 the second dart.
+     * @pre is_sewable<1>(adart1, adart2).
+     * @post is_valid()
+     */
+    void sew_1(Dart_handle adart1, Dart_handle adart2)
+    {
+      CGAL_assertion( (is_sewable<1>(adart1,adart2)) );
+
+      if ( adart1==adart2 )
+      {
+        for ( CGAL::CMap_dart_iterator_of_involution<Self, 1>
+              it(*this, adart1); it.cont(); ++it )
+        {
+          basic_link_beta_1(it, it);
+        }
+        return;
+      }
+
+      size_type m = get_new_mark();
+      std::deque<Dart_handle> dartv;
+      for ( CGAL::CMap_dart_iterator_basic_of_cell<Self, 0>
+            it(*this, adart1, m); it.cont(); ++it )
+      {
+        mark(it,m);
+        dartv.push_back(it);
+      }
+
+      size_type mark = get_new_mark();
+
+      CGAL::CMap_dart_iterator_basic_of_involution<Self, 1>
+          I1(*this, adart1, mark);
+      CGAL::CMap_dart_iterator_basic_of_involution_inv<Self, 1>
+          I2(*this, adart2, mark);
+
+      // This first loop do not modify the map, but only the attributes
+      // (by calling when required the onmerge functors).
+      for ( ; I1.cont(); ++I1, ++I2 )
+      {
+        CGAL_assertion( I2.cont() );
+        if ( is_marked(I1,m) )
+          Helper::template Foreach_enabled_attributes_except
+              <internal::Group_attribute_functor<Self, 1>, 1>::
+              run(this, I1, I2);
+        else
+          Helper::template Foreach_enabled_attributes_except
+              <internal::Group_attribute_functor<Self, 0>, 1>::
+              run(this, I1, I2);
+      }
+
+      // Now we update the beta links.
+      negate_mark( mark );
+      for ( I1.rewind(), I2.rewind(); I1.cont(); ++I1, ++I2 )
+      {
+        if ( is_marked(I1,m) ) basic_link_beta_1(I1, I2);
+        else                   basic_link_beta_0(I1, I2);
+      }
+
+      for ( typename std::deque<Dart_handle>::iterator it=dartv.begin();
+            it!=dartv.end(); ++it )
+      { unmark(*it,m); }
+      CGAL_assertion( is_whole_map_unmarked(m) );
+      free_mark(m);
+
+      negate_mark( mark );
+      CGAL_assertion( is_whole_map_unmarked(mark) );
+      free_mark(mark);
+    }
+
+    /** Sew by betai the two given darts plus all the required darts
+     * to satisfy the combinatorial map validity, and updates enabled
+     * attributes when necessary so that the final map is valid.
+     * @param adart1 the first dart.
+     * @param adart2 the second dart.
+     * @pre is_sewable<i>(adart1, adart2).
+     * @pre 2<=i<=dimension.
+     * @post is_valid()
+     */
+    template<unsigned int i>
+    void sew_for_involution(Dart_handle adart1, Dart_handle adart2)
+    {
+      CGAL_assertion( 2<=i && i<=dimension );
+      CGAL_assertion( (is_sewable<i>(adart1,adart2)) );
+
+      size_type mark=get_new_mark();
+
+      CGAL::CMap_dart_iterator_basic_of_involution<Self, i>
+          I1(*this, adart1, mark);
+      CGAL::CMap_dart_iterator_basic_of_involution_inv<Self, i>
+          I2(*this, adart2, mark);
+
+      // This first loop do not modify the map, but only the attributes
+      // (by calling when required the onmerge functors).
+      for ( ; I1.cont(); ++I1, ++I2 )
+      {
+        Helper::template Foreach_enabled_attributes_except
+            <CGAL::internal::Group_attribute_functor<Self, i>, i>::
+            run(this, I1, I2);
+      }
+
+      // Now we update the beta links.
+      negate_mark( mark );
+      for ( I1.rewind(), I2.rewind(); I1.cont(); ++I1, ++I2 )
+      {
+        basic_link_beta_for_involution<i>(I1, I2);
+      }
+
+      negate_mark( mark );
+      CGAL_assertion( is_whole_map_unmarked(mark) );
+      free_mark(mark);
+    }
+
+    /** Sew by betai the two given darts plus all the required darts
+     * to satisfy the combinatorial map validity, and updates enabled
+     * attributes when necessary so that the final map is valid.
+     * @param adart1 the first dart.
+     * @param adart2 the second dart.
+     * @pre is_sewable<i>(adart1, adart2).
+     * @post is_valid()
+     */
+    template<unsigned int i>
+    void sew(Dart_handle adart1, Dart_handle adart2)
+    {
+      if ( are_attributes_automatically_managed() )
+      {
+        if ( i==0 ) sew_0(adart1, adart2);
+        else if ( i==1 ) sew_1(adart1, adart2);
+        else sew_for_involution<i>(adart1, adart2);
+      }
+      else topo_sew<i>(adart1, adart2);
+    }
+
+    /** Sew by betai the two given darts plus all the required darts
+     * to satisfy the combinatorial map validity. Enabled attributes
+     * are updated only if update_attributes==true.
+     * @param adart1 the first dart.
+     * @param adart2 the second dart.
+     * @param update_attributes a boolean to update the enabled attributes
+     *         (deprecated, now we use are_attributes_automatically_managed())
+     * @pre is_sewable<i>(adart1, adart2).
+     */
+    template<unsigned int i>
+    void sew(Dart_handle adart1, Dart_handle adart2, bool update_attributes)
+    {
+      if ( update_attributes ) sew<i>(adart1, adart2);
+      else topo_sew<i>(adart1, adart2);
+    }
+
+    /** Topological unsew by beta1 the given dart plus all the required darts
+     * to satisfy the combinatorial map validity: but do not update attributes
+     * thus the map can be non valid
+     * @param adart first dart.
+     * @pre !adart->is_free(1).
+     */
+    void topo_unsew_1(Dart_handle adart)
+    {
+      CGAL_assertion( !this->template is_free<1>(adart) );
+
+      size_type m = get_new_mark();
+      std::deque<Dart_handle> dartv;
+      for ( CGAL::CMap_dart_iterator_basic_of_cell<Self,0> it(*this, adart, m);
+            it.cont(); ++it )
+      {
+        mark(it,m);
+        dartv.push_back(it);
+      }
+
+      for ( CGAL::CMap_dart_iterator_of_involution<Self,1> it(*this, adart);
+            it.cont(); ++it )
+      {
+        if ( is_marked(it,m) ) unlink_beta_1(it);
+        else unlink_beta_0(it);
+      }
+
+      for ( typename std::deque<Dart_handle>::iterator it=dartv.begin();
+            it!=dartv.end(); ++it )
+      { unmark(*it,m); }
+      CGAL_assertion( is_whole_map_unmarked(m) );
+      free_mark(m);
+    }
+
+    /** Topological unsew by beta0 the given dart plus all the required darts
+     * to satisfy the combinatorial map validity: but do not update attributes
+     * thus the map can be non valid
+     * @param adart first dart.
+     * @pre !adart->is_free(0).
+     */
+    void topo_unsew_0(Dart_handle adart)
+    {
+      CGAL_assertion( !this->template is_free<0>(adart) );
+      topo_unsew_1( adart->template beta<0>() );
+    }
+
+    /** Topological unsew by betai the given dart plus all the required darts
+     * to satisfy the combinatorial map validity: but do not update attributes
+     * thus the map can be non valid
+     * @param adart first dart.
+     * @pre !adart->is_free(i).
+     * @pre 2<=i<=dimension.
+     */
+    template<unsigned int i>
+    void topo_unsew_for_involution(Dart_handle adart)
+    {
+      CGAL_assertion( !this->template is_free<i>(adart) );
+      CGAL_assertion( 2<=i && i<=Self::dimension );
+
+      for ( CGAL::CMap_dart_iterator_of_involution<Self,i> it(*this, adart);
+            it.cont(); ++it )
+      { unlink_beta<i>(it); }
+    }
+
+    /** Topological unsew by betai the given dart plus all the required darts
+     * to satisfy the combinatorial map validity: but do not update attributes
+     * thus the map can be non valid
+     * @param adart first dart.
+     * @pre !adart->is_free(i).
+     */
+    template<unsigned int i>
+    void topo_unsew(Dart_handle adart)
+    {
+      if ( i==0 ) topo_unsew_0(adart);
+      else if ( i==1 ) topo_unsew_1(adart);
+      else topo_unsew_for_involution<i>(adart);
+    }
+
+    /** Unsew by beta0 the given dart plus all the required darts
+     * to satisfy the combinatorial map validity, and update enabled
+     * attributes when necessary so that the final map is valid.
+     * @param adart first dart.
+     * @pre !adart->is_free(0).
+     * @post is_valid()
+     */
+    void unsew_0(Dart_handle adart)
+    {
+      CGAL_assertion( !this->template is_free<0>(adart) );
+
+      size_type m=get_new_mark();
+      std::deque<Dart_handle> dartv;
+      std::deque<Dart_handle> modified_darts;
+      std::deque<Dart_handle> modified_darts2;
+
+      for ( CGAL::CMap_dart_iterator_basic_of_cell<Self,0> it(*this, adart, m);
+            it.cont(); ++it )
+      {
+        mark(it, m);
+        dartv.push_back(it);
+      }
+
+      for ( CGAL::CMap_dart_iterator_of_involution<Self,1> it(*this, adart);
+            it.cont(); ++it )
+      {
+        if ( is_marked(it, m) )
+        {
+          modified_darts.push_back(it);
+          modified_darts2.push_back(beta<0>(it));
+          unlink_beta_0(it);
+        }
+        else
+        {
+          modified_darts2.push_back(it);
+          modified_darts.push_back(beta<1>(it));
+          unlink_beta_1(it);
+        }
+      }
+
+      for ( typename std::deque<Dart_handle>::iterator it=dartv.begin();
+            it!=dartv.end(); ++it )
+      { unmark(*it,m); }
+
+      CGAL_assertion( is_whole_map_unmarked(m) );
+      free_mark(m);
+
+      // We test the split of all the incident cells for all the non
+      // void attributes.
+      Helper::template Foreach_enabled_attributes_except
+          <CGAL::internal::Test_split_attribute_functor<Self,0>, 1>::
+          run(this, modified_darts, modified_darts2);
+    }
+
+    /** Unsew by beta1 the given dart plus all the required darts
+     * to satisfy the combinatorial map validity, and update enabled
+     * attributes when necessary so that the final map is valid.
+     * @param adart first dart.
+     * @pre !adart->is_free(1).
+     * @post is_valid()
+     */
+    void unsew_1(Dart_handle adart)
+    {
+      CGAL_assertion( !this->template is_free<1>(adart) );
+
+      size_type m = get_new_mark();
+      std::deque<Dart_handle> dartv;
+      std::deque<Dart_handle> modified_darts;
+      std::deque<Dart_handle> modified_darts2;
+
+      for ( CGAL::CMap_dart_iterator_basic_of_cell<Self,0>
+            it(*this, adart, m); it.cont(); ++it)
+      {
+        mark(it, m);
+        dartv.push_back(it);
+      }
+
+      for ( CGAL::CMap_dart_iterator_of_involution<Self, 1> it(*this, adart);
+            it.cont(); ++it )
+      {
+        if ( is_marked(it, m) )
+        {
+          modified_darts2.push_back(it);
+          modified_darts.push_back(beta<1>(it));
+          unlink_beta_1(it);
+        }
+        else
+        {
+          modified_darts.push_back(it);
+          modified_darts2.push_back(beta<0>(it));
+          unlink_beta_0(it);
+        }
+      }
+
+      for ( typename std::deque<Dart_handle>::iterator
+             it=dartv.begin(); it!=dartv.end(); ++it)
+      { unmark(*it, m); }
+      CGAL_assertion( is_whole_map_unmarked(m) );
+      free_mark(m);
+
+      // We test the split of all the incident cells for all the non
+      // void attributes.
+      Helper::template Foreach_enabled_attributes_except
+          <CGAL::internal::Test_split_attribute_functor<Self,1>, 1>::
+          run(this, modified_darts, modified_darts2);
+    }
+
+    /** Unsew by betai the given dart plus all the required darts
+     * to satisfy the combinatorial map validity, and update enabled
+     * attributes when necessary so that the final map is valid.
+     * @param adart first dart.
+     * @pre !adart->is_free(i).
+     * @post is_valid()
+     * @pre 2<=i<=dimension
+     */
+    template<unsigned int i>
+    void unsew_for_involution(Dart_handle adart)
+    {
+      CGAL_assertion(2<=i && i<=Self::dimension);
+      CGAL_assertion( !this->template is_free<i>(adart) );
+
+      std::deque<Dart_handle> modified_darts;
+
+      for ( CGAL::CMap_dart_iterator_of_involution<Self, i> it(*this, adart);
+            it.cont(); ++it )
+      {
+        modified_darts.push_back(it);
+        modified_darts.push_back(beta<i>(it));
+        unlink_beta_for_involution<i>(it);
+      }
+
+      // We test the split of all the incident cells for all the non
+      // void attributes.
+      Helper::template Foreach_enabled_attributes_except
+          <CGAL::internal::Test_split_attribute_functor<Self, i>, i>::
+          run(this, modified_darts);
+    }
+
+    /** Unsew by betai the given dart plus all the required darts
+     * to satisfy the combinatorial map validity, and update enabled
+     * attributes when necessary so that the final map is valid.
+     * @param adart first dart.
+     * @pre !adart->is_free(i).
+     * @post is_valid()
+     */
+    template<unsigned int i>
+    void unsew(Dart_handle adart)
+    {
+      if ( are_attributes_automatically_managed() )
+      {
+        if ( i==0 ) unsew_0(adart);
+        else if ( i==1 ) unsew_1(adart);
+        else unsew_for_involution<i>(adart);
+      }
+      else topo_unsew<i>(adart);
+    }
+
+    /** Unsew by betai the given dart plus all the required darts
+     * to satisfy the combinatorial map validity. Enabled attributes
+     * are updated only if update_attributes==true.
+     * @param adart first dart.
+     * @param update_attributes a boolean to update the enabled attributes
+     *         (deprecated, now we use are_attributes_automatically_managed())
+     * @pre !adart->is_free(i).
+     */
+    template<unsigned int i>
+    void unsew(Dart_handle adart, bool update_attributes)
+    {
+      if ( update_attributes ) unsew<i>(adart);
+      else topo_unsew<i>(adart);
+    }
+
+    /** Reverse the orientation (swap beta 0 & 1 links) of the entire map.
+     * A valid map after this operation remains valid.
+     * @param none
+     * @return none
+     */
+    void reverse_orientation()
+    {
+      internal::Reverse_orientation_of_map_functor<Self>::run(this);
+    }
+
+    /** Reverse the orientation (swap beta 0 & 1 links) of the connected
+     * component containing the given dart.
+     * A valid map after this operation remains valid.
+     * @param adart handle to a dart
+     * @return none
+     */
+    void reverse_orientation_connected_component (Dart_handle adart)
+    {
+      internal::Reverse_orientation_of_connected_component_functor<Self>::
+          run(this, adart);
+    }
+
+    /** Count the marked cells (at least one marked dart).
+     * @param amark the mark to consider.
+     * @param avector containing the dimensions of the cells to count.
+     * @return a vector containing the number of cells.
+     */
+    std::vector<unsigned int>
+    count_marked_cells(size_type amark, const std::vector<unsigned int>& acells) const
+    {
+      std::vector<unsigned int> res(dimension+2);
+      std::vector<size_type> marks(dimension+2);
+
+      // Initialization of the result
+      for ( unsigned int i=0; i<dimension+2; ++i)
+      {
+        res[i]=0;
+        marks[i]=INVALID_MARK;
+      }
+
+      // Mark reservation
+      for ( unsigned int i=0; i<acells.size(); ++i)
+      {
+        CGAL_assertion(acells[i]<=dimension+1);
+        if ( marks[acells[i]]==INVALID_MARK )
+        {
+          marks[acells[i]] = get_new_mark();
+        }
+      }
+
+      // Counting and marking cells
+      for ( typename Dart_range::const_iterator it(darts().begin()),
+             itend(darts().end()); it!=itend; ++it)
+      {
+        if ( is_marked(it, amark) )
+        {
+          CGAL::internal::Foreach_static
+            <CGAL::internal::Count_cell_functor<Self>,dimension+1>::
+            run(this, it, &marks, &res);
+        }
+      }
+
+      // Unmarking darts
+      std::vector<size_type> tounmark;
+      for ( unsigned int i=0; i<acells.size(); ++i)
+      {
+        if ( is_whole_map_marked(marks[acells[i]]) ||
+             is_whole_map_unmarked(marks[acells[i]]))
+        {
+          free_mark(marks[acells[i]]);
+        }
+        else
+        {
+          tounmark.push_back(marks[acells[i]]);
+        }
+      }
+
+      if ( tounmark.size() > 0 )
+      {
+        for ( typename Dart_range::const_iterator it(darts().begin()),
+               itend(darts().end()); it!=itend; ++it)
+        {
+          for ( unsigned int i=0; i<tounmark.size(); ++i)
+            unmark(it, tounmark[i]);
+        }
+        for ( unsigned int i=0; i<tounmark.size(); ++i)
+        {
+          CGAL_assertion(is_whole_map_unmarked(tounmark[i]));
+          free_mark(tounmark[i]);
+        }
+      }
+
+      return res;
+    }
+
+    /** Count the number of given cells
+     * @param avector containing the dimensions of the cells to count.
+     * @return a vector containing the number of cells.
+     */
+    std::vector<unsigned int>
+    count_cells(const std::vector<unsigned int>& acells) const
+    {
+      std::vector<unsigned int> res;
+      size_type m = get_new_mark();
+      negate_mark(m); // We mark all the cells.
+
+      res = count_marked_cells(m, acells);
+
+      negate_mark(m); // We unmark the cells
+      free_mark(m);
+
+      return res;
+    }
+
+    /** Count the number of cells in each dimension.
+     * @return a vector containing the number of cells.
+     */
+    std::vector<unsigned int> count_all_cells() const
+    {
+      std::vector<unsigned int> dim(dimension+2);
+
+      for ( unsigned int i=0; i<dimension+2; ++i)
+        dim[i]=i;
+
+      return count_cells(dim);
+    }
+
+  protected:
+    /** Set simultaneously all the marks of a given dart.
+     * @param adart the dart.
+     * @param amarks the marks to set.
+     */
+    void set_marks(Dart_const_handle adart,
+                   const std::bitset<NB_MARKS> & amarks) const
+    { set_dart_marks(adart, amarks ^ mmask_marks); }
+
+    /** Get simultaneously all the marks of a given dart.
+     * @param adart the dart.
+     * @return allt the marks of adart.
+     */
+    std::bitset<NB_MARKS> get_marks(Dart_const_handle adart) const
+    { return get_dart_marks(adart) ^ mmask_marks; }
+
+    /** Get the mask associated to a given mark.
+     * @param amark the mark.
+     * @return the mask associated to mark amark.
+     */
+    bool get_mask_mark(size_type amark) const
+    {
+      CGAL_assertion(amark>=0 && amark<NB_MARKS);
+      return mmask_marks[amark];
+    }
+
+  public:
+    /** Erase marked darts from the map.
+     * Marked darts are unlinked before to be removed, thus surviving darts
+     * are correctly linked, but the map is not necessarily valid depending
+     * on the configuration of removed darts. User must check carefully marked
+     * darts before calling this method.
+     * @param amark the mark of darts to erase.
+     * @return the number of removed darts.
+     */
+    unsigned int erase_marked_darts(size_type amark)
+    {
+      unsigned int res = 0, i = 0;
+      Dart_handle d;
+      for ( typename Dart_range::iterator it(darts().begin()),
+             itend(darts().end()); it!=itend; )
+      {
+        d = it++;
+        if (is_marked(d, amark))
+        {
+          for ( i = 0; i <= dimension; ++i)
+          { if (!d->is_free(i)) unlink_beta(d, i); }
+          erase_dart(d); ++res;
+        }
+      }
+      return res;
+    }
+
+#ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
+    //**************************************************************************
+    // Dart_of_orbit_basic_range
+    template<unsigned int ... Beta>
+    struct Dart_of_orbit_basic_range : public CGAL::CMap_range
+    <Self, CGAL::CMap_dart_iterator_basic_of_orbit<Self,Beta...>,
+     CGAL::CMap_dart_const_iterator_basic_of_orbit<Self,Beta...> >
+    {
+      typedef CGAL::CMap_range
+      <Self, CGAL::CMap_dart_iterator_basic_of_orbit<Self,Beta...>,
+       CGAL::CMap_dart_const_iterator_basic_of_orbit<Self,Beta...> > Base;
+
+      Dart_of_orbit_basic_range(Self &amap, Dart_handle adart, size_type amark=INVALID_MARK):
+        Base(amap, adart, amark)
+      {}
+    };
+    //**************************************************************************
+    // Dart_of_orbit_basic_const_range
+    template<unsigned int ... Beta>
+    struct Dart_of_orbit_basic_const_range : public CGAL::CMap_const_range
+    <Self, CGAL::CMap_dart_const_iterator_basic_of_orbit<Self,Beta...> >
+    {
+      typedef CGAL::CMap_const_range
+      <Self, CGAL::CMap_dart_const_iterator_basic_of_orbit<Self,Beta...> >
+      Base;
+
+      Dart_of_orbit_basic_const_range(const Self &amap, Dart_const_handle
+                                      adart, size_type amark=INVALID_MARK):
+        Base(amap, adart, amark)
+      {}
+    };
+    //**************************************************************************
+    // Dart_of_orbit_range
+    template<unsigned int ... Beta>
+    struct Dart_of_orbit_range : public CGAL::CMap_range
+    <Self, CGAL::CMap_dart_iterator_of_orbit<Self,Beta...>,
+     CGAL::CMap_dart_const_iterator_of_orbit<Self,Beta...> >
+    {
+      typedef CGAL::CMap_range
+      <Self, CGAL::CMap_dart_iterator_of_orbit<Self,Beta...>,
+       CGAL::CMap_dart_const_iterator_of_orbit<Self,Beta...> > Base;
+
+      Dart_of_orbit_range(Self &amap, Dart_handle adart) : Base(amap,adart)
+      {}
+    };
+    //**************************************************************************
+    // Dart_of_orbit_const_range
+    template<unsigned int ... Beta>
+    struct Dart_of_orbit_const_range : public CGAL::CMap_const_range
+    <Self, CGAL::CMap_dart_const_iterator_of_orbit<Self,Beta...> >
+    {
+      typedef CGAL::CMap_const_range
+      <Self, CGAL::CMap_dart_const_iterator_of_orbit<Self,Beta...> > Base;
+
+      Dart_of_orbit_const_range(const Self &amap, Dart_const_handle adart):
+        Base(amap,adart)
+      {}
+    };
+    //**************************************************************************
+    /// @return a range on all the darts of the given orbit
+    template<unsigned int ... Beta>
+    Dart_of_orbit_range<Beta...> darts_of_orbit(Dart_handle adart)
+    { return Dart_of_orbit_range<Beta...>(*this,adart); }
+    //--------------------------------------------------------------------------
+    template<unsigned int ... Beta>
+    Dart_of_orbit_const_range<Beta...>
+    darts_of_orbit(Dart_const_handle adart) const
+    { return Dart_of_orbit_const_range<Beta...>(*this,adart); }
+    //--------------------------------------------------------------------------
+    template<unsigned int ... Beta>
+    Dart_of_orbit_basic_range<Beta...> darts_of_orbit_basic(Dart_handle adart,
+                                                            size_type amark=INVALID_MARK)
+    { return Dart_of_orbit_basic_range<Beta...>(*this,adart,amark); }
+    //--------------------------------------------------------------------------
+    template<unsigned int ... Beta>
+    Dart_of_orbit_basic_const_range<Beta...>
+    darts_of_orbit_basic(Dart_const_handle adart, size_type amark=INVALID_MARK) const
+    { return Dart_of_orbit_basic_const_range<Beta...>(*this,adart,amark); }
+    //**************************************************************************
+#else
+    //**************************************************************************
+    // Dart_of_orbit_basic_range
+    template<int B1=-1,int B2=-1,int B3=-1,int B4=-1,int B5=-1,
+             int B6=-1,int B7=-1,int B8=-1,int B9=-1>
+    struct Dart_of_orbit_basic_range: public CGAL::CMap_range
+    <Self, CGAL::CMap_dart_iterator_basic_of_orbit<Self,B1,B2,B3,B4,B5,B6,B7,
+        B8,B9>,
+     CGAL::CMap_dart_const_iterator_basic_of_orbit<Self,B1,B2,B3,B4,B5,B6,B7,
+        B8,B9> >
+    {
+      typedef CGAL::CMap_range
+      <Self, CGAL::CMap_dart_iterator_basic_of_orbit<Self,B1,B2,B3,B4,B5,B6,B7,
+      B8,B9>,
+       CGAL::CMap_dart_const_iterator_basic_of_orbit<Self,B1,B2,B3,B4,B5,
+                                               B6,B7,B8,B9> > Base;
+
+      Dart_of_orbit_basic_range(Self &amap, Dart_handle adart,
+                                size_type /*amark*/=INVALID_MARK):
+        Base(amap, adart)
+      {}
+    };
+    //**************************************************************************
+    // Dart_of_orbit_basic_const_range
+    template<int B1=-1,int B2=-1,int B3=-1,int B4=-1,int B5=-1,
+             int B6=-1,int B7=-1,int B8=-1,int B9=-1>
+    struct Dart_of_orbit_basic_const_range: public CMap_const_range
+    <Self,
+     CGAL::CMap_dart_const_iterator_basic_of_orbit<Self,B1,B2,B3,B4,B5,B6,B7,
+        B8,B9> >
+    {
+      typedef CMap_const_range
+      <Self, CGAL::CMap_dart_const_iterator_basic_of_orbit
+       <Self,B1,B2,B3,B4,B5,B6,B7,B8,B9> > Base;
+
+      Dart_of_orbit_basic_const_range(const Self &amap,
+                                      Dart_const_handle adart, size_type amark=INVALID_MARK):
+        Base(amap, adart, amark)
+      {}
+    };
+    //**************************************************************************
+    // Dart_of_orbit_range
+    template<int B1=-1,int B2=-1,int B3=-1,int B4=-1,int B5=-1,
+             int B6=-1,int B7=-1,int B8=-1,int B9=-1>
+    struct Dart_of_orbit_range: public CGAL::CMap_range
+    <Self, CGAL::CMap_dart_iterator_of_orbit<Self,B1,B2,B3,B4,B5,B6,B7,B8,B9>,
+     CGAL::CMap_dart_const_iterator_of_orbit<Self,B1,B2,B3,B4,B5,B6,B7,B8,B9> >
+    {
+      typedef CGAL::CMap_range
+      <Self, CGAL::CMap_dart_iterator_of_orbit<Self,B1,B2,B3,B4,B5,B6,B7,
+      B8,B9>,
+       CGAL::CMap_dart_const_iterator_of_orbit<Self,B1,B2,B3,B4,B5,B6,B7,
+      B8,B9> >
+      Base;
+
+      Dart_of_orbit_range(Self &amap, Dart_handle adart):
+        Base(amap, adart)
+      {}
+    };
+    //**************************************************************************
+    // Dart_of_orbit_const_range
+    template<int B1=-1,int B2=-1,int B3=-1,int B4=-1,int B5=-1,
+             int B6=-1,int B7=-1,int B8=-1,int B9=-1>
+    struct Dart_of_orbit_const_range: public CMap_const_range
+    <Self, CGAL::CMap_dart_const_iterator_of_orbit<Self,B1,B2,B3,B4,B5,B6,B7,
+        B8,B9> >
+    {
+      typedef CMap_const_range
+      <Self, CGAL::CMap_dart_const_iterator_of_orbit
+       <Self,B1,B2,B3,B4,B5,B6,B7,B8,B9> > Base;
+
+      Dart_of_orbit_const_range(const Self &amap, Dart_const_handle adart):
+        Base(amap, adart)
+      {}
+    };
+    //**************************************************************************
+    /// @return a range on all the darts of the given orbit
+    Dart_of_orbit_range<> darts_of_orbit(Dart_handle adart)
+    { return Dart_of_orbit_range<>(*this,adart); }
+    //--------------------------------------------------------------------------
+    template <unsigned int B1>
+    Dart_of_orbit_range<B1> darts_of_orbit(Dart_handle adart)
+    { return Dart_of_orbit_range<B1>(*this,adart); }
+    //--------------------------------------------------------------------------
+    template <unsigned int B1,unsigned int B2>
+    Dart_of_orbit_range<B1,B2> darts_of_orbit(Dart_handle adart)
+    { return Dart_of_orbit_range<B1,B2>(*this,adart); }
+    //--------------------------------------------------------------------------
+    template <unsigned int B1,unsigned int B2,unsigned int B3>
+    Dart_of_orbit_range<B1,B2,B3> darts_of_orbit(Dart_handle adart)
+    { return Dart_of_orbit_range<B1,B2,B3>(*this,adart); }
+    //--------------------------------------------------------------------------
+    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4>
+    Dart_of_orbit_range<B1,B2,B3,B4> darts_of_orbit(Dart_handle adart)
+    { return Dart_of_orbit_range<B1,B2,B3,B4>(*this,adart); }
+    //--------------------------------------------------------------------------
+    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
+              unsigned int B5>
+    Dart_of_orbit_range<B1,B2,B3,B4,B5> darts_of_orbit(Dart_handle adart)
+    { return Dart_of_orbit_range<B1,B2,B3,B4,B5>(*this,adart); }
+    //--------------------------------------------------------------------------
+    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
+              unsigned int B5,unsigned int B6>
+    Dart_of_orbit_range<B1,B2,B3,B4,B5,B6> darts_of_orbit(Dart_handle adart)
+    { return Dart_of_orbit_range<B1,B2,B3,B4,B5,B6>(*this,adart); }
+    //--------------------------------------------------------------------------
+    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
+              unsigned int B5,unsigned int B6,unsigned int B7>
+    Dart_of_orbit_range<B1,B2,B3,B4,B5,B6,B7> darts_of_orbit(Dart_handle adart)
+    { return Dart_of_orbit_range<B1,B2,B3,B4,B5,B6,B7>(*this,adart); }
+    //--------------------------------------------------------------------------
+    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
+              unsigned int B5,unsigned int B6,unsigned int B7,unsigned int B8>
+    Dart_of_orbit_range<B1,B2,B3,B4,B5,B6,B7,B8> darts_of_orbit
+    (Dart_handle adart)
+    { return Dart_of_orbit_range<B1,B2,B3,B4,B5,B6,B7,B8>(*this,adart); }
+    //--------------------------------------------------------------------------
+    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
+              unsigned int B5,unsigned int B6,unsigned int B7,unsigned int B8,
+              unsigned int B9>
+    Dart_of_orbit_range<B1,B2,B3,B4,B5,B6,B7,B8,B9>
+    darts_of_orbit(Dart_handle adart)
+    { return Dart_of_orbit_range<B1,B2,B3,B4,B5,B6,B7,B8,B9>(*this,adart); }
+    //--------------------------------------------------------------------------
+    // Const versions.
+    Dart_of_orbit_const_range<> darts_of_orbit(Dart_const_handle adart) const
+    { return Dart_of_orbit_const_range<>(*this,adart); }
+    //--------------------------------------------------------------------------
+    template <unsigned int B1>
+    Dart_of_orbit_const_range<B1> darts_of_orbit(Dart_const_handle
+                                                 adart) const
+    { return Dart_of_orbit_const_range<B1>(*this,adart); }
+    //--------------------------------------------------------------------------
+    template <unsigned int B1,unsigned int B2>
+    Dart_of_orbit_const_range<B1,B2> darts_of_orbit(Dart_const_handle
+                                                    adart) const
+    { return Dart_of_orbit_const_range<B1,B2>(*this,adart); }
+    //--------------------------------------------------------------------------
+    template <unsigned int B1,unsigned int B2,unsigned int B3>
+    Dart_of_orbit_const_range<B1,B2,B3> darts_of_orbit
+    (Dart_const_handle adart) const
+    { return Dart_of_orbit_const_range<B1,B2,B3>(*this,adart); }
+    //--------------------------------------------------------------------------
+    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4>
+    Dart_of_orbit_const_range<B1,B2,B3,B4>
+    darts_of_orbit(Dart_const_handle adart) const
+    { return Dart_of_orbit_const_range<B1,B2,B3,B4>(*this,adart); }
+    //--------------------------------------------------------------------------
+    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
+              unsigned int B5>
+    Dart_of_orbit_const_range<B1,B2,B3,B4,B5>
+    darts_of_orbit(Dart_const_handle adart) const
+    { return Dart_of_orbit_const_range<B1,B2,B3,B4,B5>(*this,adart); }
+    //--------------------------------------------------------------------------
+    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
+              unsigned int B5,unsigned int B6>
+    Dart_of_orbit_const_range<B1,B2,B3,B4,B5,B6>
+    darts_of_orbit(Dart_const_handle adart) const
+    { return Dart_of_orbit_const_range<B1,B2,B3,B4,B5,B6>(*this,adart); }
+    //--------------------------------------------------------------------------
+    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
+              unsigned int B5,unsigned int B6,unsigned int B7>
+    Dart_of_orbit_const_range<B1,B2,B3,B4,B5,B6,B7>
+    darts_of_orbit(Dart_const_handle adart) const
+    { return Dart_of_orbit_const_range<B1,B2,B3,B4,B5,B6,B7>(*this,adart); }
+    //--------------------------------------------------------------------------
+    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
+              unsigned int B5,unsigned int B6,unsigned int B7,unsigned int B8>
+    Dart_of_orbit_const_range<B1,B2,B3,B4,B5,B6,B7,B8>
+    darts_of_orbit(Dart_const_handle adart) const
+    { return Dart_of_orbit_const_range<B1,B2,B3,B4,B5,B6,B7,B8>(*this,adart); }
+    //--------------------------------------------------------------------------
+    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
+              unsigned int B5,unsigned int B6,unsigned int B7,unsigned int B8,
+              unsigned int B9>
+    Dart_of_orbit_const_range<B1,B2,B3,B4,B5,B6,B7,B8,B9>
+    darts_of_orbit(Dart_const_handle adart) const
+    { return Dart_of_orbit_const_range<B1,B2,B3,B4,B5,B6,B7,B8,B9>
+        (*this,adart); }
+    //--------------------------------------------------------------------------
+    // Basic versions
+    Dart_of_orbit_basic_range<> darts_of_orbit_basic(Dart_handle adart,
+                                                     size_type amark=INVALID_MARK)
+    { return Dart_of_orbit_basic_range<>(*this,adart,amark); }
+    //--------------------------------------------------------------------------
+    Dart_of_orbit_basic_const_range<> darts_of_orbit_basic
+    (Dart_const_handle adart,size_type amark=INVALID_MARK) const
+    { return Dart_of_orbit_basic_const_range<>(*this,adart,amark); }
+    //--------------------------------------------------------------------------
+    template <unsigned int B1>
+    Dart_of_orbit_basic_range<B1> darts_of_orbit_basic(Dart_handle adart,
+                                                       size_type amark=INVALID_MARK)
+    { return Dart_of_orbit_basic_range<B1>(*this,adart,amark); }
+    //--------------------------------------------------------------------------
+    template <unsigned int B1>
+    Dart_of_orbit_basic_const_range<B1> darts_of_orbit_basic
+    (Dart_const_handle adart, size_type amark=INVALID_MARK) const
+    { return Dart_of_orbit_basic_const_range<B1>(*this,adart,amark); }
+    //--------------------------------------------------------------------------
+    template <unsigned int B1,unsigned int B2>
+    Dart_of_orbit_basic_range<B1,B2> darts_of_orbit_basic(Dart_handle adart,
+                                                          size_type amark=INVALID_MARK)
+    { return Dart_of_orbit_basic_range<B1,B2>(*this,adart,amark); }
+    //--------------------------------------------------------------------------
+    template <unsigned int B1,unsigned int B2>
+    Dart_of_orbit_basic_const_range<B1,B2> darts_of_orbit_basic
+    (Dart_const_handle adart, size_type amark=INVALID_MARK) const
+    { return Dart_of_orbit_basic_const_range<B1,B2>(*this,adart,amark); }
+    //--------------------------------------------------------------------------
+    template <unsigned int B1,unsigned int B2,unsigned int B3>
+    Dart_of_orbit_basic_range<B1,B2,B3> darts_of_orbit_basic(Dart_handle adart,
+                                                             size_type amark=INVALID_MARK)
+    { return Dart_of_orbit_basic_range<B1,B2,B3>(*this,adart,amark); }
+    //--------------------------------------------------------------------------
+    template <unsigned int B1,unsigned int B2,unsigned int B3>
+    Dart_of_orbit_basic_const_range<B1,B2,B3> darts_of_orbit_basic
+    (Dart_const_handle adart, size_type amark=INVALID_MARK) const
+    { return Dart_of_orbit_basic_const_range<B1,B2,B3>(*this,adart,amark); }
+    //--------------------------------------------------------------------------
+    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4>
+    Dart_of_orbit_basic_range<B1,B2,B3,B4> darts_of_orbit_basic
+    (Dart_handle adart, size_type amark=INVALID_MARK)
+    { return Dart_of_orbit_basic_range<B1,B2,B3,B4>(*this,adart,amark); }
+    //--------------------------------------------------------------------------
+    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4>
+    Dart_of_orbit_basic_const_range<B1,B2,B3,B4>
+    darts_of_orbit_basic(Dart_const_handle adart, size_type amark=INVALID_MARK) const
+    { return Dart_of_orbit_basic_const_range<B1,B2,B3,B4>(*this,adart,amark); }
+    //--------------------------------------------------------------------------
+    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
+              unsigned int B5>
+    Dart_of_orbit_basic_range<B1,B2,B3,B4,B5> darts_of_orbit_basic
+    (Dart_handle adart, size_type amark=INVALID_MARK)
+    { return Dart_of_orbit_basic_range<B1,B2,B3,B4,B5>(*this,adart,amark); }
+    //--------------------------------------------------------------------------
+    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
+              unsigned int B5>
+    Dart_of_orbit_basic_const_range<B1,B2,B3,B4,B5>
+    darts_of_orbit_basic(Dart_const_handle adart, size_type amark=INVALID_MARK) const
+    { return Dart_of_orbit_basic_const_range<B1,B2,B3,B4,B5>
+        (*this,adart,amark); }
+    //--------------------------------------------------------------------------
+    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
+              unsigned int B5,unsigned int B6>
+    Dart_of_orbit_basic_range<B1,B2,B3,B4,B5,B6> darts_of_orbit_basic
+    (Dart_handle adart, size_type amark=INVALID_MARK)
+    { return Dart_of_orbit_basic_range<B1,B2,B3,B4,B5,B6>(*this,adart,amark); }
+    //--------------------------------------------------------------------------
+    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
+              unsigned int B5,unsigned int B6>
+    Dart_of_orbit_basic_const_range<B1,B2,B3,B4,B5,B6>
+    darts_of_orbit_basic(Dart_const_handle adart, size_type amark=INVALID_MARK) const
+    { return Dart_of_orbit_basic_const_range<B1,B2,B3,B4,B5,B6>
+        (*this,adart,amark); }
+    //--------------------------------------------------------------------------
+    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
+              unsigned int B5,unsigned int B6,unsigned int B7>
+    Dart_of_orbit_basic_range<B1,B2,B3,B4,B5,B6,B7> darts_of_orbit_basic
+    (Dart_handle adart, size_type amark=INVALID_MARK)
+    { return Dart_of_orbit_basic_range<B1,B2,B3,B4,B5,B6,B7>
+        (*this,adart,amark); }
+    //--------------------------------------------------------------------------
+    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
+              unsigned int B5,unsigned int B6,unsigned int B7>
+    Dart_of_orbit_basic_const_range<B1,B2,B3,B4,B5,B6,B7>
+    darts_of_orbit_basic(Dart_const_handle adart, size_type amark=INVALID_MARK) const
+    { return Dart_of_orbit_basic_const_range<B1,B2,B3,B4,B5,B6,B7>
+        (*this,adart,amark); }
+    //--------------------------------------------------------------------------
+    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
+              unsigned int B5,unsigned int B6,unsigned int B7,unsigned int B8>
+    Dart_of_orbit_basic_range<B1,B2,B3,B4,B5,B6,B7,B8> darts_of_orbit
+    (Dart_handle adart, size_type amark=INVALID_MARK)
+    { return Dart_of_orbit_basic_range<B1,B2,B3,B4,B5,B6,B7,B8>
+        (*this,adart,amark); }
+    //--------------------------------------------------------------------------
+    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
+              unsigned int B5,unsigned int B6,unsigned int B7,unsigned int B8>
+    Dart_of_orbit_basic_const_range<B1,B2,B3,B4,B5,B6,B7,B8>
+    darts_of_orbit_basic(Dart_const_handle adart, size_type amark=INVALID_MARK) const
+    { return Dart_of_orbit_basic_const_range<B1,B2,B3,B4,B5,B6,B7,B8>
+        (*this,adart,amark); }
+    //--------------------------------------------------------------------------
+    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
+              unsigned int B5,unsigned int B6,unsigned int B7,unsigned int B8,
+              unsigned int B9>
+    Dart_of_orbit_basic_range<B1,B2,B3,B4,B5,B6,B7,B8,B9>
+    darts_of_orbit_basic(Dart_handle adart, size_type amark=INVALID_MARK)
+    { return Dart_of_orbit_basic_range<B1,B2,B3,B4,B5,B6,B7,B8,B9>
+        (*this,adart,amark); }
+    //--------------------------------------------------------------------------
+    template <unsigned int B1,unsigned int B2,unsigned int B3,unsigned int B4,
+              unsigned int B5,unsigned int B6,unsigned int B7,unsigned int B8,
+              unsigned int B9>
+    Dart_of_orbit_basic_const_range<B1,B2,B3,B4,B5,B6,B7,B8,B9>
+    darts_of_orbit_basic(Dart_const_handle adart, size_type amark=INVALID_MARK) const
+    { return Dart_of_orbit_basic_const_range<B1,B2,B3,B4,B5,B6,B7,B8,B9>
+        (*this,adart,amark); }
+    //**************************************************************************
+#endif //CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
+    //**************************************************************************
+    // Dart_of_cell_basic_range
+    template<unsigned int i,int dim=Self::dimension>
+    struct Dart_of_cell_basic_range: public CGAL::CMap_range
+    <Self, CGAL::CMap_dart_iterator_basic_of_cell<Self,i,dim>,
+     CGAL::CMap_dart_const_iterator_basic_of_cell<Self,i,dim> >
+    {
+      typedef CGAL::CMap_range
+      <Self, CGAL::CMap_dart_iterator_basic_of_cell<Self,i,dim>,
+       CGAL::CMap_dart_const_iterator_basic_of_cell<Self,i,dim> > Base;
+
+      Dart_of_cell_basic_range(Self &amap, Dart_handle adart, size_type amark=INVALID_MARK) :
+        Base(amap, adart, amark)
+      {}
+    };
+    //**************************************************************************
+    // Dart_of_cell_basic_const_range
+    template<unsigned int i,int dim=Self::dimension>
+    struct Dart_of_cell_basic_const_range: public CMap_const_range
+    <Self, CGAL::CMap_dart_const_iterator_basic_of_cell<Self,i,dim> >
+    {
+      typedef CMap_const_range
+      <Self, CGAL::CMap_dart_const_iterator_basic_of_cell<Self,i,dim> > Base;
+
+      Dart_of_cell_basic_const_range(const Self &amap, Dart_const_handle adart,
+                                     size_type amark=INVALID_MARK) :
+        Base(amap, adart, amark)
+      {}
+    };
+    //**************************************************************************
+    // Dart_of_cell_range
+    template<unsigned int i,int dim=Self::dimension>
+    struct Dart_of_cell_range: public CGAL::CMap_range
+    <Self,CMap_dart_iterator_of_cell<Self,i,dim>,
+     CGAL::CMap_dart_const_iterator_of_cell<Self,i,dim> >
+    {
+      typedef CGAL::CMap_range
+      <Self,CMap_dart_iterator_of_cell<Self,i,dim>,
+       CGAL::CMap_dart_const_iterator_of_cell<Self,i,dim> > Base;
+
+      Dart_of_cell_range(Self &amap, Dart_handle adart) :
+        Base(amap, adart)
+      {}
+    };
+    //**************************************************************************
+    // Dart_of_cell_const_range
+    template<unsigned int i,int dim=Self::dimension>
+    struct Dart_of_cell_const_range: public CMap_const_range
+    <Self, CGAL::CMap_dart_const_iterator_of_cell<Self,i,dim> >
+    {
+      typedef CMap_const_range
+      <Self, CGAL::CMap_dart_const_iterator_of_cell<Self,i,dim> > Base;
+
+      Dart_of_cell_const_range(const Self &amap, Dart_const_handle adart) :
+        Base(amap, adart)
+      {}
+    };
+    //--------------------------------------------------------------------------
+    /// @return a range on all the darts of the given i-cell
+    template<unsigned int i, int dim>
+    Dart_of_cell_basic_range<i,dim> darts_of_cell_basic(Dart_handle adart,
+                                                        size_type amark=INVALID_MARK)
+    { return Dart_of_cell_basic_range<i,dim>(*this,adart,amark); }
+    //--------------------------------------------------------------------------
+    template<unsigned int i, int dim>
+    Dart_of_cell_basic_const_range<i,dim> darts_of_cell_basic
+    (Dart_const_handle adart, size_type amark=INVALID_MARK) const
+    { return Dart_of_cell_basic_const_range<i,dim>(*this,adart,amark); }
+    //--------------------------------------------------------------------------
+    template<unsigned int i>
+    Dart_of_cell_basic_range<i,Self::dimension>
+    darts_of_cell_basic(Dart_handle adart, size_type amark=INVALID_MARK)
+    { return darts_of_cell_basic<i,Self::dimension>(adart,amark); }
+    //--------------------------------------------------------------------------
+    template<unsigned int i>
+    Dart_of_cell_basic_const_range<i,Self::dimension>
+    darts_of_cell_basic(Dart_const_handle adart, size_type amark=INVALID_MARK) const
+    { return darts_of_cell_basic<i,Self::dimension>(adart,amark); }
+    //--------------------------------------------------------------------------
+    template<unsigned int i, int dim>
+    Dart_of_cell_range<i,dim> darts_of_cell(Dart_handle adart)
+    { return Dart_of_cell_range<i,dim>(*this,adart); }
+    //--------------------------------------------------------------------------
+    template<unsigned int i, int dim>
+    Dart_of_cell_const_range<i,dim> darts_of_cell(Dart_const_handle adart) const
+    { return Dart_of_cell_const_range<i,dim>(*this,adart); }
+    //--------------------------------------------------------------------------
+    template<unsigned int i>
+    Dart_of_cell_range<i,Self::dimension> darts_of_cell(Dart_handle adart)
+    { return darts_of_cell<i,Self::dimension>(adart); }
+    //--------------------------------------------------------------------------
+    template<unsigned int i>
+    Dart_of_cell_const_range<i,Self::dimension>
+    darts_of_cell(Dart_const_handle adart) const
+    { return darts_of_cell<i,Self::dimension>(adart); }
+    //**************************************************************************
+    // Dart_of_involution_basic_range
+    template<unsigned int i,int dim=Self::dimension>
+    struct Dart_of_involution_basic_range: public CGAL::CMap_range
+    <Self, CGAL::CMap_dart_iterator_basic_of_involution<Self,i,dim>,
+     CGAL::CMap_dart_const_iterator_basic_of_involution<Self,i,dim> >
+    {
+      typedef CGAL::CMap_range
+      <Self, CGAL::CMap_dart_iterator_basic_of_involution<Self,i,dim>,
+       CGAL::CMap_dart_const_iterator_basic_of_involution<Self,i,dim> > Base;
+
+      Dart_of_involution_basic_range(Self &amap, Dart_handle adart,
+                                     size_type amark=INVALID_MARK):
+        Base(amap, adart, amark)
+      {}
+    };
+    //**************************************************************************
+    // Dart_of_involution_basic_const_range
+    template<unsigned int i,int dim=Self::dimension>
+    struct Dart_of_involution_basic_const_range: public CMap_const_range
+    <Self, CGAL::CMap_dart_const_iterator_basic_of_involution<Self,i,dim> >
+    {
+      typedef CMap_const_range
+      <Self, CGAL::CMap_dart_const_iterator_basic_of_involution<Self,i,dim> >
+      Base;
+
+      Dart_of_involution_basic_const_range(const Self &amap,
+                                           Dart_const_handle adart,
+                                           size_type amark=INVALID_MARK) :
+        Base(amap, adart, amark)
+      {}
+    };
+    //**************************************************************************
+    template<unsigned int i,int dim>
+    Dart_of_involution_basic_range<i,dim>
+    darts_of_involution_basic(Dart_handle adart, size_type amark=INVALID_MARK)
+    { return Dart_of_involution_basic_range<i,dim>(*this,adart,amark); }
+    //--------------------------------------------------------------------------
+    template<unsigned int i,int dim>
+    Dart_of_involution_basic_const_range<i,dim>
+    darts_of_involution_basic(Dart_const_handle adart, size_type amark=INVALID_MARK) const
+    { return Dart_of_involution_basic_const_range<i,dim>(*this,adart,amark); }
+    //--------------------------------------------------------------------------
+    template<unsigned int i>
+    Dart_of_involution_basic_range<i,Self::dimension>
+    darts_of_involution_basic(Dart_handle adart, size_type amark=INVALID_MARK)
+    { return Dart_of_involution_basic_range<i,Self::dimension>
+        (*this,adart,amark); }
+    //--------------------------------------------------------------------------
+    template<unsigned int i>
+    Dart_of_involution_basic_const_range<i,Self::dimension>
+    darts_of_involution_basic(Dart_const_handle adart, size_type amark=INVALID_MARK) const
+    { return Dart_of_involution_basic_const_range<i,Self::dimension>
+        (*this,adart,amark); }
+    //**************************************************************************
+    // Dart_of_involution_inv_basic_range
+    template<unsigned int i,int dim=Self::dimension>
+    struct Dart_of_involution_inv_basic_range: public CGAL::CMap_range
+    <Self, CGAL::CMap_dart_iterator_basic_of_involution_inv<Self,i,dim>,
+     CGAL::CMap_dart_const_iterator_basic_of_involution_inv<Self,i,dim> >
+    {
+      typedef CGAL::CMap_range
+      <Self, CGAL::CMap_dart_iterator_basic_of_involution_inv<Self,i,dim>,
+       CGAL::CMap_dart_const_iterator_basic_of_involution_inv<Self,i,dim> >
+      Base;
+
+      Dart_of_involution_inv_basic_range(Self &amap, Dart_handle adart,
+                                         size_type amark=INVALID_MARK):
+        Base(amap, adart, amark)
+      {}
+    };
+    //**************************************************************************
+    // Dart_of_involution_inv_basic_const_range
+    template<unsigned int i,int dim=Self::dimension>
+    struct Dart_of_involution_inv_basic_const_range: public CMap_const_range
+    <Self, CGAL::CMap_dart_const_iterator_basic_of_involution_inv<Self,i,dim> >
+    {
+      typedef CMap_const_range
+      <Self, CGAL::CMap_dart_const_iterator_basic_of_involution_inv
+      <Self,i,dim> >
+      Base;
+
+      Dart_of_involution_inv_basic_const_range(const Self &amap,
+                                               Dart_const_handle adart,
+                                               size_type amark=INVALID_MARK) :
+        Base(amap, adart, amark)
+      {}
+    };
+    //**************************************************************************
+    template<unsigned int i,int dim>
+    Dart_of_involution_inv_basic_range<i,dim>
+    darts_of_involution_inv_basic(Dart_handle adart, size_type amark=INVALID_MARK)
+    { return Dart_of_involution_inv_basic_range<i,dim>(*this,adart,amark); }
+    //--------------------------------------------------------------------------
+    template<unsigned int i,int dim>
+    Dart_of_involution_inv_basic_const_range<i,dim>
+    darts_of_involution_inv_basic(Dart_const_handle adart, size_type amark=INVALID_MARK) const
+    { return Dart_of_involution_inv_basic_const_range<i,dim>
+        (*this,adart,amark); }
+    //--------------------------------------------------------------------------
+    template<unsigned int i>
+    Dart_of_involution_inv_basic_range<i,Self::dimension>
+    darts_of_involution_inv_basic(Dart_handle adart, size_type amark=INVALID_MARK)
+    { return Dart_of_involution_inv_basic_range<i,Self::dimension>
+        (*this,adart,amark); }
+    //--------------------------------------------------------------------------
+    template<unsigned int i>
+    Dart_of_involution_inv_basic_const_range<i,Self::dimension>
+    darts_of_involution_inv_basic(Dart_const_handle adart, size_type amark=INVALID_MARK) const
+    { return Dart_of_involution_inv_basic_const_range<i,Self::dimension>
+        (*this,adart,amark); }
+    //**************************************************************************
+    // Dart_of_involution_range
+    template<unsigned int i,int dim=Self::dimension>
+    struct Dart_of_involution_range: public CGAL::CMap_range
+    <Self, CGAL::CMap_dart_iterator_of_involution<Self,i,dim>,
+     CGAL::CMap_dart_const_iterator_of_involution<Self,i,dim> >
+    {
+      typedef CGAL::CMap_range
+      <Self, CGAL::CMap_dart_iterator_of_involution<Self,i,dim>,
+       CGAL::CMap_dart_const_iterator_of_involution<Self,i,dim> > Base;
+
+      Dart_of_involution_range(Self &amap, Dart_handle adart) :
+        Base(amap, adart)
+      {}
+    };
+    //**************************************************************************
+    // Dart_of_involution_const_range
+    template<unsigned int i,int dim=Self::dimension>
+    struct Dart_of_involution_const_range: public CMap_const_range
+    <Self, CGAL::CMap_dart_const_iterator_of_involution<Self,i,dim> >
+    {
+      typedef CMap_const_range
+      <Self, CGAL::CMap_dart_const_iterator_of_involution<Self,i,dim> > Base;
+
+      Dart_of_involution_const_range(const Self &amap,
+                                     Dart_const_handle adart):
+        Base(amap, adart)
+      {}
+    };
+    //**************************************************************************
+    template<unsigned int i,int dim>
+    Dart_of_involution_range<i,dim>
+    darts_of_involution(Dart_handle adart)
+    { return Dart_of_involution_range<i,dim>(*this,adart); }
+    //--------------------------------------------------------------------------
+    template<unsigned int i,int dim>
+    Dart_of_involution_const_range<i,dim>
+    darts_of_involution(Dart_const_handle adart) const
+    { return Dart_of_involution_const_range<i,dim>(*this,adart); }
+    //--------------------------------------------------------------------------
+    template<unsigned int i>
+    Dart_of_involution_range<i,Self::dimension>
+    darts_of_involution(Dart_handle adart)
+    { return Dart_of_involution_range<i,Self::dimension>(*this,adart); }
+    //--------------------------------------------------------------------------
+    template<unsigned int i>
+    Dart_of_involution_const_range<i,Self::dimension>
+    darts_of_involution(Dart_const_handle adart) const
+    { return Dart_of_involution_const_range<i,Self::dimension>(*this,adart); }
+    //**************************************************************************
+    // Dart_of_involution_inv_range
+    template<unsigned int i,int dim=Self::dimension>
+    struct Dart_of_involution_inv_range: public CGAL::CMap_range
+    <Self, CGAL::CMap_dart_iterator_of_involution_inv<Self,i,dim>,
+     CGAL::CMap_dart_const_iterator_of_involution_inv<Self,i,dim> >
+    {
+      typedef CGAL::CMap_range
+      <Self, CGAL::CMap_dart_iterator_of_involution_inv<Self,i,dim>,
+       CGAL::CMap_dart_const_iterator_of_involution_inv<Self,i,dim> > Base;
+
+      Dart_of_involution_inv_range(Self &amap, Dart_handle adart) :
+        Base(amap, adart)
+      {}
+    };
+    //**************************************************************************
+    // Dart_of_involution_inv_const_range
+    template<unsigned int i,int dim=Self::dimension>
+    struct Dart_of_involution_inv_const_range: public CMap_const_range
+    <Self, CGAL::CMap_dart_const_iterator_of_involution_inv<Self,i,dim> >
+    {
+      typedef CMap_const_range
+      <Self, CGAL::CMap_dart_const_iterator_of_involution_inv<Self,i,dim> >
+      Base;
+
+      Dart_of_involution_inv_const_range(const Self &amap,
+                                         Dart_const_handle adart):
+        Base(amap, adart)
+      {}
+    };
+    //**************************************************************************
+    template<unsigned int i,int dim>
+    Dart_of_involution_inv_range<i,dim>
+    darts_of_involution_inv(Dart_handle adart)
+    { return Dart_of_involution_inv_range<i,dim>(*this,adart); }
+    //--------------------------------------------------------------------------
+    template<unsigned int i,int dim>
+    Dart_of_involution_inv_const_range<i,dim>
+    darts_of_involution_inv(Dart_const_handle adart) const
+    { return Dart_of_involution_inv_const_range<i,dim>(*this,adart); }
+    //--------------------------------------------------------------------------
+    template<unsigned int i>
+    Dart_of_involution_inv_range<i,Self::dimension>
+    darts_of_involution_inv(Dart_handle adart)
+    { return Dart_of_involution_inv_range<i,Self::dimension>(*this,adart); }
+    //--------------------------------------------------------------------------
+    template<unsigned int i>
+    Dart_of_involution_inv_const_range<i,Self::dimension>
+    darts_of_involution_inv(Dart_const_handle adart) const
+    { return Dart_of_involution_inv_const_range<i,Self::dimension>
+        (*this,adart); }
+    //**************************************************************************
+    // Dart_basic_range
+    struct Dart_basic_range {
+      typedef CGAL::CMap_dart_iterator_basic_of_all<Self> iterator;
+      typedef CGAL::CMap_dart_const_iterator_basic_of_all<Self> const_iterator;
+      Dart_basic_range(Self &amap) : mmap(amap)
+      {}
+      iterator begin() { return iterator(mmap); }
+      iterator end()   { return iterator(mmap,mmap.null_handle); }
+      const_iterator begin() const { return const_iterator(mmap); }
+      const_iterator end() const   { return const_iterator(mmap,mmap.null_handle); }
+      size_type size() const
+      { return mmap.number_of_darts(); }
+      bool empty() const
+      { return mmap.is_empty(); }
+    private:
+      Self & mmap;
+    };
+    //**************************************************************************
+    // Dart_basic_const_range
+    struct Dart_basic_const_range {
+      typedef CGAL::CMap_dart_const_iterator_basic_of_all<Self> const_iterator;
+      Dart_basic_const_range(Self &amap) : mmap(amap)
+      {}
+      const_iterator begin() const { return const_iterator(mmap); }
+      const_iterator end() const   { return const_iterator(mmap,mmap.null_handle); }
+      size_type size() const
+      { return mmap.number_of_darts(); }
+      bool empty() const
+      { return mmap.is_empty(); }
+    private:
+      const Self & mmap;
+    };
+    //**************************************************************************
+    Dart_basic_range darts_basic()
+    { return Dart_basic_range(*this); }
+    //--------------------------------------------------------------------------
+    Dart_basic_const_range darts_basic() const
+    { return Dart_basic_const_range(*this); }
+    //**************************************************************************
+    // One_dart_per_incident_cell_range
+    template<unsigned int i,unsigned int j,int dim=Self::dimension>
+    struct One_dart_per_incident_cell_range: public CGAL::CMap_range
+    <Self, CGAL::CMap_one_dart_per_incident_cell_iterator<Self,i,j,dim>,
+     CGAL::CMap_one_dart_per_incident_cell_const_iterator<Self,i,j,dim> >
+    {
+      typedef CGAL::CMap_range
+      <Self, CGAL::CMap_one_dart_per_incident_cell_iterator<Self,i,j,dim>,
+       CGAL::CMap_one_dart_per_incident_cell_const_iterator<Self,i,j,dim> >
+      Base;
+
+      One_dart_per_incident_cell_range(Self &amap, Dart_handle adart):
+        Base(amap, adart)
+      {}
+    };
+    //**************************************************************************
+    // One_dart_per_incident_cell_const_range
+    template<unsigned int i,unsigned int j,int dim=Self::dimension>
+    struct One_dart_per_incident_cell_const_range: public CMap_const_range
+    <Self, CGAL::CMap_one_dart_per_incident_cell_const_iterator<Self,i,j,dim> >
+    {
+      typedef CMap_const_range
+      <Self, CGAL::CMap_one_dart_per_incident_cell_const_iterator
+      <Self,i,j,dim> > Base;
+
+      One_dart_per_incident_cell_const_range(const Self &amap,
+                                             Dart_const_handle adart) :
+        Base(amap, adart)
+      {}
+    };
+    //**************************************************************************
+    // One_dart_per_cell_range
+    template<unsigned int i,int dim=Self::dimension>
+    struct One_dart_per_cell_range {
+      typedef CGAL::CMap_one_dart_per_cell_iterator<Self,i,dim> iterator;
+      typedef CGAL::CMap_one_dart_per_cell_const_iterator<Self,i,dim>
+      const_iterator;
+      One_dart_per_cell_range(Self &amap) : mmap(amap), msize(0)
+      {}
+      iterator begin() { return iterator(mmap); }
+      iterator end()   { return iterator(mmap,mmap.null_handle); }
+      const_iterator begin() const { return const_iterator(mmap); }
+      const_iterator end() const   { return const_iterator(mmap,mmap.null_handle); }
+      size_type size() const
+      {
+        if (msize==0)
+          for ( const_iterator it=begin(), itend=end(); it!=itend; ++it)
+            ++msize;
+        return msize;
+      }
+      bool empty() const
+      { return mmap.is_empty(); }
+    private:
+      Self & mmap;
+      mutable size_type msize;
+    };
+    //**************************************************************************
+    // One_dart_per_cell_const_range
+    template<unsigned int i,int dim=Self::dimension>
+    struct One_dart_per_cell_const_range {
+      typedef CGAL::CMap_one_dart_per_cell_const_iterator<Self,i,dim>
+      const_iterator;
+      One_dart_per_cell_const_range(const Self &amap) : mmap(amap), msize(0)
+      {}
+      const_iterator begin() const { return const_iterator(mmap); }
+      const_iterator end() const   { return const_iterator(mmap,mmap.null_handle); }
+      size_type size() const
+      {
+        if (msize==0)
+          for ( const_iterator it=begin(), itend=end(); it!=itend; ++it)
+            ++msize;
+        return msize;
+      }
+      bool empty() const
+      { return mmap.is_empty(); }
+    private:
+      const Self & mmap;
+      mutable size_type msize;
+    };
+    //**************************************************************************
+    /// @return a range on the i-cells incindent to the given j-cell.
+    template<unsigned int i, unsigned int j, int dim>
+    One_dart_per_incident_cell_range<i,j,dim>
+    one_dart_per_incident_cell(Dart_handle adart)
+    { return One_dart_per_incident_cell_range<i,j,dim>(*this,adart); }
+    //--------------------------------------------------------------------------
+    template<unsigned int i, unsigned int j, int dim>
+    One_dart_per_incident_cell_const_range<i,j,dim>
+    one_dart_per_incident_cell(Dart_const_handle adart) const
+    { return One_dart_per_incident_cell_const_range<i,j,dim>(*this,adart); }
+    //--------------------------------------------------------------------------
+    template<unsigned int i, unsigned int j>
+    One_dart_per_incident_cell_range<i,j,Self::dimension>
+    one_dart_per_incident_cell(Dart_handle adart)
+    { return one_dart_per_incident_cell<i,j,Self::dimension>(adart); }
+    //--------------------------------------------------------------------------
+    template<unsigned int i, unsigned int j>
+    One_dart_per_incident_cell_const_range<i,j,Self::dimension>
+    one_dart_per_incident_cell(Dart_const_handle adart) const
+    { return one_dart_per_incident_cell<i,j,Self::dimension>(adart); }
+    //--------------------------------------------------------------------------
+    /// @return a range on all the i-cells
+    template<unsigned int i, int dim>
+    One_dart_per_cell_range<i,dim> one_dart_per_cell()
+    { return One_dart_per_cell_range<i,dim>(*this); }
+    //--------------------------------------------------------------------------
+    template<unsigned int i, int dim>
+    One_dart_per_cell_const_range<i,dim> one_dart_per_cell() const
+    { return One_dart_per_cell_const_range<i,dim>(*this); }
+    //--------------------------------------------------------------------------
+    template<unsigned int i>
+    One_dart_per_cell_range<i,Self::dimension> one_dart_per_cell()
+    { return one_dart_per_cell<i,Self::dimension>(); }
+    //--------------------------------------------------------------------------
+    template<unsigned int i>
+    One_dart_per_cell_const_range<i,Self::dimension> one_dart_per_cell() const
+    { return one_dart_per_cell<i,Self::dimension>(); }
+    //--------------------------------------------------------------------------
+
+  public:
+
+    /** Compute the dual of a Combinatorial_map.
+     * @param amap the cmap in which we build the dual of this map.
+     * @param adart a dart of the initial map, NULL by default.
+     * @return adart of the dual map, the dual of adart if adart!=NULL,
+     *         any dart otherwise.
+     * As soon as we don't modify this map and amap map, we can iterate
+     * simultaneously through all the darts of the two maps and we have
+     * each time of the iteration two "dual" darts.
+     */
+    Dart_handle dual(Self& amap, Dart_handle adart=null_handle)
+    {
+      CGAL_assertion( is_without_boundary(dimension) );
+
+      CGAL::Unique_hash_map< Dart_handle, Dart_handle,
+        typename Self::Hash_function > dual;
+      Dart_handle d, d2, res = amap.null_handle;
+
+      // We clear amap. TODO return a new amap ?
+      amap.clear();
+
+      // We create a copy of all the dart of the map.
+      for ( typename Dart_range::iterator it=darts().begin();
+            it!=darts().end(); ++it)
+      {
+        dual[it] = amap.create_dart();
+        if ( it==adart && res==amap.null_handle ) res = dual[it];
+      }
+
+      // Then we link the darts by using the dual formula :
+      // G(B,b1,b2,...,bn-1,bn) =>
+      //    dual(G)=(B, b(n-1)obn, b(n-2)obn,...,b1obn, bn)
+      // We suppose darts are run in the same order for both maps.
+      typename Dart_range::iterator it2=amap.darts().begin();
+      for ( typename Dart_range::iterator it=darts().begin();
+            it!=darts().end(); ++it, ++it2)
+      {
+        d = it2; // The supposition on the order allows to avoid d=dual[it];
+        CGAL_assertion( it2==dual[it] );
+
+        // First case outside the loop since we need to use link_beta1
+        if ( amap.template is_free<1>(d) &&
+             beta<dimension, dimension-1>(it)!=null_dart_handle )
+          amap.basic_link_beta_1(d, dual[beta<dimension, dimension-1>(it)]);
+
+        // and during the loop we use link_beta(d1,d2,i)
+        for ( unsigned int i=dimension-2; i>=1; --i)
+        {
+          if ( amap.is_free(d,dimension-i) &&
+               beta(it, dimension, i)!=null_dart_handle )
+            amap.basic_link_beta(d, dual[beta(it, dimension, i)], dimension-i);
+        }
+        if ( amap.template is_free<dimension>(d) )
+        {
+          CGAL_assertion ( !this->template is_free<dimension>(it) );
+          amap.basic_link_beta(d, dual[beta<dimension>(it)], dimension);
+        }
+      }
+
+      //  CGAL_postcondition(amap2.is_valid());
+
+      if ( res==amap.null_handle ) res = amap.darts().begin();
+      return res;
+    }
+
+
+    /** Test if the connected component of cmap containing dart dh1 is
+     *  isomorphic to the connected component of map2 containing dart dh2,
+     *  starting from dh1 and dh2.
+     * @param dh1  initial dart for this map
+     * @param map2 the second combinatorial map
+     * @param dh2  initial dart for map2
+     * @param testAttributes Boolean to test the equality of attributes (true)
+     *                       or not (false)
+     * @return true iff the cc of map is isomorphic to the cc of map2 starting
+     *     from dh1 and dh2; by testing the equality of attributes if
+     *     testAttributes is true
+     */
+    template <unsigned int d2, typename Refs2, typename Items2, class Alloc2,
+              class Storage2>
+    bool are_cc_isomorphic(Dart_const_handle dh1,
+                           const Combinatorial_map_base
+                           <d2,Refs2,Items2,Alloc2, Storage2>& map2,
+                           typename Combinatorial_map_base
+                           <d2,Refs2,Items2,Alloc2, Storage2>::Dart_const_handle dh2,
+                           bool testAttributes=true) const
+    {
+      // CGAL_assertion(dimension==map2.dimension);
+      typedef Combinatorial_map_base<d2,Refs2,Items2,Alloc2, Storage2> Map2;
+
+      bool match = true;
+
+      // Two stacks used to run through the two maps.
+      std::deque< Dart_const_handle > toTreat1;
+      std::deque< typename Map2::Dart_const_handle > toTreat2;
+
+      size_type m1 = get_new_mark();
+      size_type m2 = map2.get_new_mark();
+
+      toTreat1.push_back(dh1);
+      toTreat2.push_back(dh2);
+
+      Dart_const_handle current;
+      typename Map2::Dart_const_handle other;
+
+      unsigned int i = 0;
+      CGAL::Unique_hash_map<Dart_const_handle,
+                            typename Map2::Dart_const_handle,
+                            typename Self::Hash_function> bijection;
+
+      if ( testAttributes )
+      {
+        internal::Test_is_same_attribute_functor<Self, Map2>::
+            value = true;
+        internal::Test_is_same_attribute_functor<Map2, Self>::
+            value = true;
+      }
+
+      while (match && !toTreat1.empty())
+      {
+        // Next dart
+        current = toTreat1.front();
+        toTreat1.pop_front();
+        other = toTreat2.front();
+        toTreat2.pop_front();
+
+        if (!is_marked(current, m1))
+        {
+          if (map2.is_marked(other, m2))
+            match=false;
+          else
+          {
+            bijection[current] = other;
+
+            mark(current, m1);
+            map2.mark(other, m2);
+
+            if (testAttributes)
+            {
+              // We need to test in both direction because
+              // Foreach_enabled_attributes only test non void attributes
+              // of Self.
+              Helper::template Foreach_enabled_attributes
+                < internal::Test_is_same_attribute_functor<Self, Map2> >::
+                run(this,&map2,current, other);
+              Map2::Helper::template Foreach_enabled_attributes
+                < internal::Test_is_same_attribute_functor<Map2, Self> >::
+                run(&map2,this,other, current);
+              if ( !internal::Test_is_same_attribute_functor<Self, Map2>::
+                   value ||
+                   !internal::Test_is_same_attribute_functor<Map2, Self>::
+                   value )
+                match=false;
+            }
+
+            // We test if the injection is valid with its neighboors.
+            // We go out as soon as it is not satisfied.
+            for (i = 0; match && i <= dimension; ++i)
+            {
+              if ( i>map2.dimension )
+              {
+                if (!is_free(current,i)) match=false;
+              }
+              else
+              {
+                if (is_free(current,i))
+                {
+                  if (!map2.is_free(other,i))
+                    match = false;
+                }
+                else
+                {
+                  if (map2.is_free(other,i))
+                    match = false;
+                  else
+                  {
+                    if (is_marked(beta(current,i), m1) !=
+                        map2.is_marked(map2.beta(other,i), m2))
+                      match = false;
+                    else
+                    {
+                      if (!is_marked(beta(current,i), m1))
+                      {
+                        toTreat1.push_back(beta(current,i));
+                        toTreat2.push_back(map2.beta(other,i));
+                      }
+                      else
+                      {
+                        if (bijection[beta(current,i)]!=map2.beta(other,i))
+                          match = false;
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            // Now we test if the second map has more beta links than the first
+            for ( i=dimension+1; match && i<=map2.dimension; ++i )
+            {
+              if (!map2.is_free(other,i)) match=false;
+            }
+          }
+        }
+        else
+        {
+          if (!map2.is_marked(other, m2))
+            match = false;
+        }
+      }
+
+      // Here we test if both queue are empty
+      if ( !toTreat1.empty() || !toTreat2.empty() ) match = false;
+
+      // Here we unmark all the marked darts.
+      toTreat1.clear();
+      toTreat2.clear();
+
+      toTreat1.push_back(dh1);
+      toTreat2.push_back(dh2);
+
+      while (!toTreat1.empty())
+      {
+        current = toTreat1.front();
+        toTreat1.pop_front();
+        other = toTreat2.front();
+        toTreat2.pop_front();
+
+        unmark(current, m1);
+        map2.unmark(other, m2);
+
+        for (i = 0; match && i <= dimension; ++i)
+        {
+          if (!is_free(current,i) && is_marked(beta(current,i), m1))
+          {
+            CGAL_assertion(!map2.is_free(other,i) &&
+                           map2.is_marked(map2.beta(other,i), m2));
+            toTreat1.push_back(beta(current,i));
+            toTreat2.push_back(map2.beta(other,i));
+          }
+        }
+      }
+
+      free_mark(m1);
+      map2.free_mark(m2);
+
+      return match;
+    }
+
+    /** Test if this cmap is isomorphic to map2.
+     * @pre cmap is connected.
+     * @param map2 the second combinatorial map
+     * @param testAttributes Boolean to test the equality of attributes (true)
+     *                       or not (false)
+     * @return true iff this map is isomorphic to map2, testing the equality
+     *         of attributes if testAttributes is true
+     */
+    template <unsigned int d2, typename Refs2, typename Items2, class Alloc2,
+              class Storage2>
+    bool is_isomorphic_to(const Combinatorial_map_base
+                          <d2,Refs2,Items2,Alloc2, Storage2>& map2,
+                          bool testAttributes=true)
+    {
+      // if ( dimension!=map2.dimension ) return false;
+
+      Dart_const_handle d1=darts().begin();
+
+      for (typename Combinatorial_map_base<d2,Refs2,Items2,Alloc2, Storage2>::
+             Dart_range::const_iterator it(map2.darts().begin()),
+             itend(map2.darts().end()); it!=itend; ++it)
+      {
+        if (are_cc_isomorphic(d1, map2, it, testAttributes))
+        {
+          return true;
+        }
+      }
+
+      return false;
+    }
+
+    /** Test if the attributes of this map are automatically updated.
+     * @return true iff the boolean automatic_attributes_management is set to true.
+     */
+    bool are_attributes_automatically_managed() const
+    {
+      return automatic_attributes_management;
+    }
+
+    /** Sets the automatic_attributes_management boolean.
+     */
+    void set_automatic_attributes_management(bool newval)
+    {
+      if (this->automatic_attributes_management == false && newval == true)
+      {
+        correct_invalid_attributes();
+      }
+
+      this->automatic_attributes_management = newval;
+    }
+
+  /** @file Combinatorial_map_constructors.h
+   * Basic creation operations  for a combinatorial map.
+   * Create edge, triangle, quadrilateral, tetrahedron, hexahedron.
+   */
+
+  /** Create an edge.
+   * @return a dart of the new edge.
+   */
+    Dart_handle make_edge()
+    {
+      Dart_handle d1 = create_dart();
+      Dart_handle d2 = create_dart();
+      this->template basic_link_beta_for_involution<2>(d1, d2);
+      return d1;
+    }
+
+  /** Create a combinatorial polygon of length alg
+   * (a cycle of alg darts beta1 links together).
+   * @return a new dart.
+   */
+    Dart_handle make_combinatorial_polygon(unsigned int alg)
+    {
+      CGAL_assertion(alg>0);
+
+      Dart_handle start = create_dart();
+      Dart_handle prev = start;
+      for ( unsigned int nb=1; nb<alg; ++nb )
+      {
+        Dart_handle cur = create_dart();
+        basic_link_beta_1(prev, cur);
+        prev=cur;
+      }
+
+      basic_link_beta_1(prev, start);
+      return start;
+    }
+
+    /** Test if a face is a combinatorial polygon of length alg
+     *  (a cycle of alg darts beta1 links together).
+     * @param adart an intial dart
+     * @return true iff the face containing adart is a polygon of length alg.
+     */
+    bool is_face_combinatorial_polygon(Dart_const_handle adart,
+                                       unsigned int alg) const
+    {
+      CGAL_assertion(alg>0);
+
+      unsigned int nb = 0;
+      Dart_const_handle cur = adart;
+      do
+      {
+        ++nb;
+        if ( cur==null_dart_handle ) return false; // Open face
+        cur = beta(cur,1);
+      }
+      while( cur!=adart );
+      return (nb==alg);
+    }
+
+    /** Create a combinatorial tetrahedron from 4 triangles.
+     * @param d1 a dart onto a first triangle.
+     * @param d2 a dart onto a second triangle.
+     * @param d3 a dart onto a third triangle.
+     * @param d4 a dart onto a fourth triangle.
+     * @return a new dart.
+     */
+    Dart_handle make_combinatorial_tetrahedron(Dart_handle d1,
+                                               Dart_handle d2,
+                                               Dart_handle d3,
+                                               Dart_handle d4)
+    {
+      basic_link_beta_for_involution(d1, d2, 2);
+      basic_link_beta_for_involution(d3, beta(d2, 0), 2);
+      basic_link_beta_for_involution(beta(d1, 1), beta(d3, 0), 2);
+      basic_link_beta_for_involution(d4, beta(d2, 1), 2);
+      basic_link_beta_for_involution(beta(d4, 0), beta(d3, 1), 2);
+      basic_link_beta_for_involution(beta(d4, 1), beta(d1, 0), 2);
+
+      return d1;
+    }
+
+    /** Test if a volume is a combinatorial tetrahedron.
+     * @param adart an intial dart
+     * @return true iff the volume containing adart is a combinatorial tetrahedron.
+     */
+    bool is_volume_combinatorial_tetrahedron(Dart_const_handle d1) const
+    {
+      Dart_const_handle d2 = beta(d1, 2);
+      Dart_const_handle d3 = beta(d2, 0, 2);
+      Dart_const_handle d4 = beta(d2, 1, 2);
+
+      if ( d1==null_dart_handle || d2==null_dart_handle ||
+           d3==null_dart_handle || d4==null_dart_handle ) return false;
+
+      if ( !is_face_combinatorial_polygon(d1, 3) ||
+           !is_face_combinatorial_polygon(d2, 3) ||
+           !is_face_combinatorial_polygon(d3, 3) ||
+           !is_face_combinatorial_polygon(d4, 3) ) return false;
+
+      // TODO do better with marks (?).
+      if ( belong_to_same_cell<Self,2,1>(*this, d1, d2) ||
+           belong_to_same_cell<Self,2,1>(*this, d1, d3) ||
+           belong_to_same_cell<Self,2,1>(*this, d1, d4) ||
+           belong_to_same_cell<Self,2,1>(*this, d2, d3) ||
+           belong_to_same_cell<Self,2,1>(*this, d2, d4) ||
+           belong_to_same_cell<Self,2,1>(*this, d3, d4) ) return false;
+
+      if ( beta(d1,1,2)!=beta(d3,0) ||
+           beta(d4,0,2)!=beta(d3,1) ||
+           beta(d4,1,2)!=beta(d1,0) ) return false;
+
+      return true;
+    }
+
+    /** Create a new combinatorial tetrahedron.
+     * @return a new dart.
+     */
+    Dart_handle make_combinatorial_tetrahedron()
+    {
+      Dart_handle d1 = make_combinatorial_polygon(3);
+      Dart_handle d2 = make_combinatorial_polygon(3);
+      Dart_handle d3 = make_combinatorial_polygon(3);
+      Dart_handle d4 = make_combinatorial_polygon(3);
+
+      return make_combinatorial_tetrahedron(d1, d2, d3, d4);
+    }
+
+    /** Create a combinatorial hexahedron from 6 quadrilaterals.
+     * @param d1 a dart onto a first quadrilateral.
+     * @param d2 a dart onto a second quadrilateral.
+     * @param d3 a dart onto a third quadrilateral.
+     * @param d4 a dart onto a fourth quadrilateral.
+     * @param d5 a dart onto a fifth quadrilateral.
+     * @param d6 a dart onto a sixth quadrilateral.
+     * @return a dart of the new cuboidal_cell.
+     */
+    Dart_handle make_combinatorial_hexahedron(Dart_handle d1,
+                                              Dart_handle d2,
+                                              Dart_handle d3,
+                                              Dart_handle d4,
+                                              Dart_handle d5,
+                                              Dart_handle d6)
+    {
+      basic_link_beta_for_involution(d1,
+                                     beta(d4, 1, 1), 2);
+      basic_link_beta_for_involution(beta(d1, 1),
+                                     beta(d6, 0)   , 2);
+      basic_link_beta_for_involution(beta(d1, 1, 1),
+                                     d2            , 2);
+      basic_link_beta_for_involution(beta(d1, 0),
+                                     d5            , 2);
+
+      basic_link_beta_for_involution(d3,
+                                     beta(d2, 1, 1), 2);
+      basic_link_beta_for_involution(beta(d3, 1),
+                                     beta(d6, 1)   , 2);
+      basic_link_beta_for_involution(beta(d3, 1, 1),
+                                     d4            , 2);
+      basic_link_beta_for_involution(beta(d3, 0),
+                                     beta(d5, 1, 1), 2);
+
+      basic_link_beta_for_involution(d6,
+                                     beta(d4, 1)   , 2);
+      basic_link_beta_for_involution(beta(d6, 1, 1),
+                                     beta(d2, 1)   , 2);
+
+      basic_link_beta_for_involution(beta(d5, 0),
+                                     beta(d4, 0)   , 2);
+      basic_link_beta_for_involution(beta(d5, 1),
+                                     beta(d2, 0)   , 2);
+
+      return d1;
+  }
+
+    /** Test if a volume is a combinatorial hexahedron.
+     * @param adart an intial dart
+     * @return true iff the volume containing adart is a combinatorial hexahedron.
+     */
+    bool is_volume_combinatorial_hexahedron(Dart_const_handle d1) const
+    {
+      Dart_const_handle d2 = beta(d1, 1, 1, 2);
+      Dart_const_handle d3 = beta(d2, 1, 1, 2);
+      Dart_const_handle d4 = beta(d3, 1, 1, 2);
+      Dart_const_handle d5 = beta(d1, 0, 2);
+      Dart_const_handle d6 = beta(d4, 1, 2);
+
+      if ( d1==null_dart_handle || d2==null_dart_handle ||
+           d3==null_dart_handle || d4==null_dart_handle ||
+           d5==null_dart_handle || d6==null_dart_handle ) return false;
+
+      if (!is_face_combinatorial_polygon(d1, 4) ||
+          !is_face_combinatorial_polygon(d2, 4) ||
+          !is_face_combinatorial_polygon(d3, 4) ||
+          !is_face_combinatorial_polygon(d4, 4) ||
+          !is_face_combinatorial_polygon(d5, 4) ||
+          !is_face_combinatorial_polygon(d6, 4) ) return false;
+
+      // TODO do better with marks.
+      if ( belong_to_same_cell<Self,2,1>(*this, d1, d2) ||
+           belong_to_same_cell<Self,2,1>(*this, d1, d3) ||
+           belong_to_same_cell<Self,2,1>(*this, d1, d4) ||
+           belong_to_same_cell<Self,2,1>(*this, d1, d5) ||
+           belong_to_same_cell<Self,2,1>(*this, d1, d6) ||
+           belong_to_same_cell<Self,2,1>(*this, d2, d3) ||
+           belong_to_same_cell<Self,2,1>(*this, d2, d4) ||
+           belong_to_same_cell<Self,2,1>(*this, d2, d5) ||
+           belong_to_same_cell<Self,2,1>(*this, d2, d6) ||
+           belong_to_same_cell<Self,2,1>(*this, d3, d4) ||
+           belong_to_same_cell<Self,2,1>(*this, d3, d5) ||
+           belong_to_same_cell<Self,2,1>(*this, d3, d6) ||
+           belong_to_same_cell<Self,2,1>(*this, d4, d5) ||
+           belong_to_same_cell<Self,2,1>(*this, d4, d6) ||
+           belong_to_same_cell<Self,2,1>(*this, d5, d6) )
+        return false;
+
+      if ( beta(d1,2)    !=beta(d4,1,1) ||
+           beta(d1,1,2)  !=beta(d6,0)   ||
+           beta(d3,1,2)  !=beta(d6,1)   ||
+           beta(d3,0,2)  !=beta(d5,1,1) ||
+           beta(d6,1,1,2)!=beta(d2,1)   ||
+           beta(d5,0,2)  !=beta(d4,0)   ||
+           beta(d5,1,2)  !=beta(d2,0) ) return false;
+
+      return true;
+    }
+
+    /** Create a new combinatorial hexahedron.
+     * @return a new dart.
+     */
+    Dart_handle make_combinatorial_hexahedron()
+    {
+      Dart_handle d1 = make_combinatorial_polygon(4);
+      Dart_handle d2 = make_combinatorial_polygon(4);
+      Dart_handle d3 = make_combinatorial_polygon(4);
+      Dart_handle d4 = make_combinatorial_polygon(4);
+      Dart_handle d5 = make_combinatorial_polygon(4);
+      Dart_handle d6 = make_combinatorial_polygon(4);
+
+      return make_combinatorial_hexahedron(d1, d2, d3, d4, d5, d6);
+    }
+
+    /** Test if an i-cell can be removed.
+     *  An i-cell can be removed if i==dimension or i==dimension-1,
+     *     or if there are at most two (i+1)-cell incident to it.
+     * @param adart a dart of the i-cell.
+     * @return true iff the i-cell can be removed.
+     */
+    template < unsigned int i >
+    bool is_removable(Dart_const_handle adart) const
+    { return CGAL::Is_removable_functor<Self, i>::run(*this, adart); }
+
+    /** Remove an i-cell, 0<=i<=dimension.
+     * @param adart a dart of the i-cell to remove.
+     * @param update_attributes a boolean to update the enabled attributes
+     * @return the number of deleted darts.
+     */
+    template < unsigned int i >
+    size_t remove_cell(Dart_handle adart, bool update_attributes = true)
+    {
+      return CGAL::Remove_cell_functor<Self,i,Self::dimension-i>::
+        run(*this,adart,update_attributes);
+    }
+
+    /** Test if an i-cell can be contracted.
+     *  An i-cell can be contracted if i==1
+     *     or if there are at most two (i-1)-cell incident to it.
+     * @param adart a dart of the i-cell.
+     * @return true iff the i-cell can be contracted.
+     */
+    template < unsigned int i >
+    bool is_contractible(Dart_const_handle adart) const
+    { return CGAL::Is_contractible_functor<Self, i>::run(*this,adart); }
+
+    /** Contract an i-cell, 1<=i<=dimension.
+     * @param adart a dart of the i-cell to remove.
+     * @return the number of deleted darts.
+     */
+    template < unsigned int i >
+    size_t contract_cell(Dart_handle adart, bool update_attributes = true)
+    {
+      return CGAL::Contract_cell_functor<Self,i>::
+        run(*this,adart, update_attributes);
+    }
+
+    /** Insert a vertex in a given edge.
+     * @param adart a dart of the edge (!=NULL && !=null_dart_handle).
+     * @param update_attributes a boolean to update the enabled attributes
+     * @return a dart of the new vertex.
+     */
+    Dart_handle insert_cell_0_in_cell_1( Dart_handle adart,
+                                         typename Attribute_handle<0>::type
+                                         ah=null_handle,
+                                         bool update_attributes=true )
+    {
+      Dart_handle d1, d2;
+      size_type amark=get_new_mark();
+
+      // 1) We store all the darts of the edge.
+      std::deque<Dart_handle> vect;
+      size_type m=get_new_mark();
+      {
+        for ( typename Dart_of_cell_basic_range<1>::iterator
+                it=darts_of_cell_basic<1>(adart, m).begin();
+              it != darts_of_cell_basic<1>(adart, m).end(); ++it )
+          vect.push_back(it);
+      }
+
+      // 2) For each dart of the cell, we modify link of neighbors.
+      typename std::deque<Dart_handle>::iterator it = vect.begin();
+      for (; it != vect.end(); ++it)
+      {
+        d1 = create_dart();
+
+        if (!this->template is_free<1>(*it))
+        { basic_link_beta_1(d1, this->template beta<1>(*it)); }
+
+        for ( unsigned int dim=2; dim<=dimension; ++dim )
+        {
+          if (!is_free(*it, dim) && is_marked(beta(*it, dim), amark))
+          {
+            basic_link_beta_for_involution(beta(*it, dim), d1, dim);
+            basic_link_beta_for_involution(*it, beta(*it, dim, 1), dim);
+          }
+        }
+
+        basic_link_beta_1(*it, d1);
+
+        if (are_attributes_automatically_managed() && update_attributes)
+        {
+          // We copy all the attributes except for dim=0
+          Helper::template Foreach_enabled_attributes_except
+            <internal::Group_attribute_functor_of_dart<Self>, 0>::
+            run(this,*it,d1);
+        }
+        if (ah != null_handle)
+        {
+          // We initialise the 0-atttrib to ah
+          internal::Set_i_attribute_of_dart_functor<Self, 0>::
+            run(this, d1, ah);
+        }
+        mark(*it, amark);
+      }
+
+      for (it = vect.begin(); it != vect.end(); ++it)
+      {
+        unmark(*it, m);
+        unmark(*it, amark);
+      }
+
+      CGAL_assertion(is_whole_map_unmarked(m));
+      CGAL_assertion(is_whole_map_unmarked(amark));
+
+      free_mark(m);
+      free_mark(amark);
+
+      if (are_attributes_automatically_managed() && update_attributes)
+      {
+        internal::Degroup_attribute_functor_run<Self, 1>::
+          run(this, adart, this->template beta<1>(adart));
+      }
+
+#ifdef CGAL_CMAP_TEST_VALID_INSERTIONS
+      CGAL_assertion( is_valid() );
+#endif
+
+      return this->template beta<1>(adart);
+    }
+
+    /** Insert a vertex in the given 2-cell which is splitted in triangles,
+     *  once for each inital edge of the facet.
+     * @param adart a dart of the facet to triangulate.
+     * @param update_attributes a boolean to update the enabled attributes
+     *        (deprecated, now we use are_attributes_automatically_managed())
+     * @return A dart incident to the new vertex.
+     */
+    Dart_handle insert_cell_0_in_cell_2( Dart_handle adart,
+                                         typename Attribute_handle<0>::type
+                                         ah=null_handle,
+                                         bool update_attributes=true )
+    {
+      CGAL_assertion(adart!=null_dart_handle);
+
+      Dart_handle first=adart, prev=null_handle,
+        cur=null_handle, next=null_handle,
+        n1=null_handle, n2=null_handle,
+        nn1=null_handle, nn2=null_handle;
+
+      // If the facet is open, we search the dart 0-free
+      while ( !this->template is_free<0>(first) &&
+              this->template beta<0>(first)!=adart )
+        first = this->template beta<0>(first);
+
+      // Mark used to mark darts already treated.
+      size_type treated = get_new_mark();
+
+      // Stack of marked darts
+      std::deque<Dart_handle> tounmark;
+
+      // Now we run through the facet
+      cur = first;
+      do
+      {
+        next = this->template beta<1>(cur);
+        mark(cur, treated);
+        tounmark.push_back(cur);
+
+        if (!this->template is_free<0>(cur))
+        {
+          n1=create_dart();
+          link_beta_0(cur, n1);
+        }
+        else n1 = null_handle;
+
+        if (!this->template is_free<1>(cur))
+        {
+          n2 = create_dart();
+          link_beta_1(cur, n2);
+        }
+        else n2 = null_handle;
+
+        if ( n1!=null_handle )
+        {
+          if ( n2!=null_handle )
+            basic_link_beta_0(n1, n2);
+
+          if ( prev!=null_handle )
+            this->template basic_link_beta_for_involution<2>(prev, n1);
+
+          if (are_attributes_automatically_managed() && update_attributes)
+          {
+            internal::Set_i_attribute_of_dart_functor<Self, 0>::
+              run(this, n1, ah);
+          }
+        }
+
+        for (unsigned int dim=3; dim<=dimension; ++dim)
+        {
+          if ( !is_free(adart, dim) )
+          {
+            if ( !is_marked(beta(cur, dim), treated) )
+            {
+              if (n1!=null_handle)
+              {
+                nn1=create_dart();
+                link_beta_1(beta(cur, dim), nn1);
+                basic_link_beta_for_involution(n1, nn1, dim);
+              }
+              else nn1=null_handle;
+
+              if (n2!=null_handle)
+              {
+                nn2=create_dart();
+                link_beta_0(beta(cur, dim), nn2);
+                basic_link_beta_for_involution(n2, nn2, dim);
+                if (are_attributes_automatically_managed() && update_attributes)
+                {
+                  internal::Set_i_attribute_of_dart_functor<Self, 0>::
+                    run(this, nn2, ah);
+                }
+              }
+              else nn2=null_handle;
+
+              if (nn1 != null_handle && nn2 != null_handle)
+                basic_link_beta_1(nn1, nn2);
+
+              if (nn1 != null_handle && prev != null_handle)
+                this->template basic_link_beta_for_involution<2>(nn1, beta(prev, dim));
+
+              mark(beta(cur, dim), treated);
+            }
+            else
+            {
+              if ( n1!=null_handle )
+                basic_link_beta_for_involution(n1,
+                                               beta(cur, dim, 1), dim);
+              if ( n2!=null_handle )
+                basic_link_beta_for_involution(n2,
+                                               beta(cur, dim, 0), dim);
+            }
+          }
+        }
+
+        prev = n2;
+        cur = next;
+      }
+      while(cur!=first && cur!=null_dart_handle);
+
+      if (n2 != null_handle)
+      {
+        this->template basic_link_beta_for_involution<2>
+          (this->template beta<0>(first), n2);
+        for (unsigned int dim=3; dim<=dimension; ++dim)
+        {
+          if ( !is_free(adart, dim) )
+          {
+            this->template basic_link_beta_for_involution<2>(beta(first, 0, dim),
+                                                             beta(n2, dim));
+          }
+        }
+      }
+
+      // Now we unmark all marked darts, and we degroup the new faces with the
+      // initial one (if 2-attributes are non void).
+      for ( typename std::deque<Dart_handle>::iterator
+              itd=tounmark.begin(); itd!=tounmark.end(); ++itd )
+      {
+        unmark(*itd, treated);
+        for (unsigned int dim=3; dim<=dimension; ++dim)
+        {
+          if ( !is_free(*itd, dim) )
+            unmark(beta(*itd, dim), treated);
+        }
+        if ( *itd!=adart )
+          if (are_attributes_automatically_managed() && update_attributes)
+          {
+            internal::Degroup_attribute_functor_run<Self, 2>::
+              run(this, adart, *itd);
+          }
+      }
+
+      CGAL_assertion(is_whole_map_unmarked(treated));
+      free_mark(treated);
+
+#ifdef CGAL_CMAP_TEST_VALID_INSERTIONS
+      CGAL_assertion( is_valid() );
+#endif
+
+      return n1;
+    }
+
+    /** Insert a dangling edge in a 2-cell between given by a dart.
+     * @param adart1 a first dart of the facet (!=NULL && !=null_dart_handle).
+     * @param update_attributes a boolean to update the enabled attributes
+     * @return a dart of the new edge, not incident to the vertex of adart1.
+     */
+    Dart_handle insert_dangling_cell_1_in_cell_2( Dart_handle adart1,
+                                                  typename Attribute_handle<0>::type
+                                                  ah=null_handle,
+                                                  bool update_attributes=true )
+    {
+      size_type mark1 = get_new_mark();
+      std::deque<Dart_handle> to_unmark;
+      {
+        for ( CMap_dart_iterator_basic_of_cell<Self,0> it(*this,adart1,mark1);
+              it.cont(); ++it )
+        {
+          to_unmark.push_back(it);
+          mark(it,mark1);
+        }
+      }
+
+      Dart_handle d1 = null_handle;
+      Dart_handle d2 = null_handle;
+      unsigned int s1 = 0;
+
+      size_type treated=get_new_mark();
+
+      CMap_dart_iterator_basic_of_involution<Self,1> it1(*this, adart1, treated);
+
+      for ( ; it1.cont(); ++it1)
+      {
+        d1 = create_dart();
+        d2 = create_dart();
+
+        if ( is_marked(it1, mark1) ) s1 = 0;
+        else s1 = 1;
+
+        if ( !is_free(it1, s1) )
+        {
+          if ( s1==0 )
+            link_beta_1(beta<0>(it1), d2);
+          else
+            link_beta_0(beta<1>(it1), d2);
+        }
+
+        if (s1==0)
+        {
+          link_beta_0(it1, d1);
+          link_beta_0(d1, d2);
+        }
+        else
+        {
+          link_beta_1(it1, d1);
+          link_beta_1(d1, d2);
+        }
+
+        basic_link_beta_for_involution<2>(d1, d2);
+
+        for ( unsigned int dim=3; dim<=dimension; ++dim)
+        {
+          if ( !is_free(it1, dim) &&
+               is_marked(beta(it1, dim), treated) )
+          {
+            basic_link_beta_for_involution
+              (beta(it1, dim, CGAL_BETAINV(s1)), d1, dim);
+            basic_link_beta_for_involution
+              (beta(it1, dim, CGAL_BETAINV(s1), 2), d2, dim);
+          }
+        }
+        if (are_attributes_automatically_managed() && update_attributes)
+        {
+          internal::Set_i_attribute_of_dart_functor<Self, 0>::run(this, d1, ah);
+        }
+        mark(it1, treated);
+      }
+
+      negate_mark(treated);
+      for ( it1.rewind(); it1.cont(); ++it1 )
+      { mark(it1, treated); }
+
+      CGAL_assertion( is_whole_map_marked(treated) );
+      free_mark(treated);
+
+      for ( typename std::deque<Dart_handle>::iterator it=to_unmark.begin();
+            it!=to_unmark.end(); ++it)
+      { unmark(*it, mark1); }
+
+      CGAL_assertion( is_whole_map_unmarked(mark1) );
+      free_mark(mark1);
+
+#ifdef CGAL_CMAP_TEST_VALID_INSERTIONS
+      CGAL_assertion( is_valid() );
+#endif
+
+      return this->template beta<0>(adart1);
+    }
+
+    /** Test if an edge can be inserted onto a 2-cell between two given darts.
+     * @param adart1 a first dart.
+     * @param adart2 a second dart.
+     * @return true iff an edge can be inserted between adart1 and adart2.
+     */
+    bool is_insertable_cell_1_in_cell_2(Dart_const_handle adart1,
+                                        Dart_const_handle adart2) const
+    {
+      if ( adart1==adart2 ) return false;
+      for ( CMap_dart_const_iterator_of_orbit<Self,1> it(*this,adart1);
+            it.cont(); ++it )
+      {
+        if ( it==adart2 )  return true;
+      }
+      return false;
+    }
+
+    /** Insert an edge in a 2-cell between two given darts.
+     * @param adart1 a first dart of the facet (!=NULL && !=null_dart_handle).
+     * @param adart2 a second dart of the facet. If NULL insert a dangling edge.
+     * @param update_attributes a boolean to update the enabled attributes
+     * @return a dart of the new edge, and not incident to the
+     *         same vertex than adart1.
+     */
+    Dart_handle insert_cell_1_in_cell_2(Dart_handle adart1,
+                                        Dart_handle adart2,
+                                        bool update_attributes=true)
+    {
+      if ( adart2==null_handle )
+        return insert_dangling_cell_1_in_cell_2(adart1, null_handle,
+                                                update_attributes);
+
+      CGAL_assertion(is_insertable_cell_1_in_cell_2(adart1, adart2));
+
+      size_type m1=get_new_mark();
+      CMap_dart_iterator_basic_of_involution<Self,1> it1(*this, adart1, m1);
+
+      size_type m2=get_new_mark();
+      CMap_dart_iterator_basic_of_involution<Self,1> it2(*this, adart2, m2);
+
+      size_type mark1=get_new_mark();
+      std::deque<Dart_handle> to_unmark;
+      {
+        for ( CMap_dart_iterator_basic_of_cell<Self,0> it(*this,adart1,mark1);
+              it.cont(); ++it )
+        {
+          to_unmark.push_back(it);
+          mark(it, mark1);
+        }
+      }
+
+      Dart_handle d1=null_handle;
+      Dart_handle d2=null_handle;
+      unsigned int s1=0;
+
+      size_type treated=get_new_mark();
+
+      for ( ; it1.cont(); ++it1, ++it2)
+      {
+        CGAL_assertion ( it2.cont() );
+        d1 = create_dart();
+        d2 = create_dart();
+
+        if ( is_marked(it1, mark1) ) s1 = 0;
+        else s1 = 1;
+
+        if ( !is_free(it1, s1) )
+        {
+          if ( s1==0 ) link_beta_1(this->template beta<0>(it1), d2);
+          else link_beta_0(this->template beta<1>(it1), d2);
+        }
+
+        if ( !is_free(it2, s1) )
+        {
+          if ( s1==0 ) link_beta_1(this->template beta<0>(it2), d1);
+          else link_beta_0(this->template beta<1>(it2), d1);
+        }
+
+        if ( s1==0 )
+        {
+          link_beta_0(it1, d1);
+          link_beta_0(it2, d2);
+        }
+        else
+        {
+          link_beta_1(it1, d1);
+          link_beta_1(it2, d2);
+        }
+        this->template basic_link_beta_for_involution<2>(d2, d1);
+
+        for ( unsigned int dim=3; dim<=dimension; ++dim)
+        {
+          if ( !is_free(it1, dim) &&
+               is_marked(beta(it1, dim), treated) )
+          {
+            basic_link_beta_for_involution
+              (beta(it1, dim, CGAL_BETAINV(s1)), d1, dim);
+            basic_link_beta_for_involution
+              (beta(it1, dim, CGAL_BETAINV(s1), 2), d2, dim);
+          }
+        }
+
+        mark(it1,treated);
+      }
+
+      if (are_attributes_automatically_managed() && update_attributes)
+      {
+        internal::Degroup_attribute_functor_run<Self, 2>::run(this, d1, d2);
+      }
+
+      negate_mark(m1);
+      negate_mark(m2);
+      it1.rewind(); it2.rewind();
+      for ( ; it1.cont(); ++it1, ++it2)
+      {
+        mark(it1,m1);
+        unmark(it1,treated);
+        mark(it2,m2);
+      }
+      negate_mark(m1);
+      negate_mark(m2);
+      CGAL_assertion( is_whole_map_unmarked(m1) );
+      CGAL_assertion( is_whole_map_unmarked(m2) );
+      CGAL_assertion( is_whole_map_unmarked(treated) );
+      free_mark(m1);
+      free_mark(m2);
+      free_mark(treated);
+
+      typename std::deque<Dart_handle>::iterator it = to_unmark.begin();
+      for (; it != to_unmark.end(); ++it)
+      { unmark(*it, mark1); }
+      CGAL_assertion( is_whole_map_unmarked(mark1) );
+      free_mark(mark1);
+
+#ifdef CGAL_CMAP_TEST_VALID_INSERTIONS
+      CGAL_assertion( is_valid() );
+#endif
+
+      return this->template beta<0>(adart1);
+    }
+
+    /** Test if a 2-cell can be inserted onto a given 3-cell along
+     * a path of edges.
+     * @param afirst iterator on the begining of the path.
+     * @param alast  iterator on the end of the path.
+     * @return true iff a 2-cell can be inserted along the path.
+     */
+    template <class InputIterator>
+    bool is_insertable_cell_2_in_cell_3(InputIterator afirst,
+                                        InputIterator alast) const
+    {
+      CGAL_assertion( dimension>= 3 );
+
+      // The path must have at least one dart.
+      if (afirst==alast) return false;
+      Dart_const_handle prec = null_handle;
+      Dart_const_handle od = null_handle;
+
+      for (InputIterator it(afirst); it!=alast; ++it)
+      {
+        // The path must contain only non empty darts.
+        if (*it == null_handle || *it==null_dart_handle) return false;
+
+        // Two consecutive darts of the path must belong to two edges
+        // incident to the same vertex of the same volume.
+        if (prec != null_handle)
+        {
+          od = other_extremity(prec);
+          if ( od==null_handle ) return false;
+
+          // of and *it must belong to the same vertex of the same volume
+          if ( !belong_to_same_cell<Self, 0, 2>(*this, od, *it) )
+            return false;
+        }
+        prec = *it;
+      }
+
+      // The path must be closed.
+      od = other_extremity(prec);
+      if ( od==null_handle ) return false;
+
+      if (!belong_to_same_cell<Self, 0, 2>(*this, od, *afirst))
+        return false;
+
+      return true;
+    }
+
+    /** Insert a 2-cell in a given 3-cell along a path of darts.
+     * @param afirst iterator on the begining of the path.
+     * @param alast  iterator on the end of the path.
+     * @param update_attributes a boolean to update the enabled attributes
+     * @return a dart of the new 2-cell.
+     */
+    template<class InputIterator>
+    Dart_handle insert_cell_2_in_cell_3(InputIterator afirst, InputIterator alast,
+                                        bool update_attributes=true)
+    {
+      CGAL_assertion(is_insertable_cell_2_in_cell_3(afirst,alast));
+
+      Dart_handle prec = null_handle, d = null_handle,
+        dd = null_handle, first = null_handle;
+      bool withBeta3 = false;
+
+      {
+        for (InputIterator it(afirst); !withBeta3 && it!=alast; ++it)
+        {
+          if (!this->template is_free<2>(*it)) withBeta3 = true;
+        }
+      }
+
+      {
+        for (InputIterator it(afirst); it!=alast; ++it)
+        {
+          d = create_dart();
+          if ( withBeta3 )
+            dd = create_dart();
+
+          if (prec != null_handle)
+          {
+            basic_link_beta_0(prec, d);
+            if (withBeta3)
+              basic_link_beta_1(this->template beta<3>(prec), dd);
+          }
+          else first = d;
+
+          if ( !this->template is_free<2>((*it)) )
+            basic_link_beta_for_involution<2>(this->template beta<2>(*it), dd);
+
+          this->template link_beta_for_involution<2>(*it, d);
+          if ( withBeta3 )
+            this->template link_beta_for_involution<3>(d, dd);
+
+          prec = d;
+        }
+      }
+
+      basic_link_beta_0(prec, first);
+      if ( withBeta3 )
+      {
+        basic_link_beta_1(this->template beta<3>(prec),
+                          this->template beta<3>(first));
+      }
+
+      // Make copies of the new facet for dimension >=4
+      for ( unsigned int dim=4; dim<=dimension; ++dim )
+      {
+        if ( !is_free(first, dim) )
+        {
+          Dart_handle first2 = null_handle;
+          prec = null_handle;
+          for ( CMap_dart_iterator_basic_of_orbit<Self, 1> it(*this, first);
+                it.cont(); ++it )
+          {
+            d = create_dart();
+            basic_link_beta_for_involution(this->template beta<2>(it), d, dim);
+            if ( withBeta3 )
+            {
+              dd = create_dart();
+              basic_link_beta_for_involution(this->template beta<2,3>(it), dd, dim);
+              this->template basic_link_beta_for_involution<3>(d, dd);
+            }
+            if ( prec!=null_handle )
+            {
+              link_beta_0(prec, d);
+              if ( withBeta3 )
+              {
+                basic_link_beta_1(this->template beta<3>(prec), dd);
+              }
+            }
+            else first2 = prec;
+
+            // We consider dim2=2 out of the loop to use link_beta instead of
+            // basic _link_beta (to modify non void attributes only once).
+            if ( !this->template is_free<2>(it) && is_free(this->template beta<2>(it), dim) )
+              this->template link_beta_for_involution<2>(beta(it,2,dim), d);
+            if ( withBeta3 && !this->template is_free<2>(this->template beta<3>(it)) &&
+                 is_free(this->template beta<3,2>(it), dim) )
+             this->template link_beta_for_involution<2>(beta(it,3,2,dim), dd);
+
+            for ( unsigned int dim2=3; dim2<=dimension; ++dim2 )
+            {
+              if ( dim2+1!=dim && dim2!=dim && dim2!=dim+1 )
+              {
+                if ( !is_free(it, dim2) && is_free(beta(it, dim2), dim) )
+                  basic_link_beta_for_involution(beta(it, dim2, dim),
+                                                 d, dim2);
+                if ( withBeta3 && !is_free(this->template beta<3>(it), dim2) &&
+                     is_free(beta(it, 3, dim2), dim) )
+                  basic_link_beta_for_involution(beta(it, 3, dim2, dim), dd,
+                                                 dim2);
+              }
+            }
+            prec = d;
+          }
+          basic_link_beta_0( prec, first2 );
+          if ( withBeta3 )
+          {
+            basic_link_beta_1( this->template beta<3>(prec), this->template beta<3>(first2) );
+          }
+        }
+      }
+
+      // Degroup the attributes
+      if ( withBeta3 )
+      { // Here we cannot use Degroup_attribute_functor_run as new darts do not
+        // have their 3-attribute
+        if (are_attributes_automatically_managed() && update_attributes)
+        {
+          CGAL::internal::Degroup_attribute_functor_run<Self, 3>::
+            run(this, first, this->template beta<3>(first));
+        }
+      }
+
+#ifdef CGAL_CMAP_TEST_VALID_INSERTIONS
+      CGAL_assertion( is_valid() );
+#endif
+
+      return first;
+    }
+
+  protected:
+    /// Number of times each mark is reserved. 0 if the mark is free.
+    mutable size_type mnb_times_reserved_marks[NB_MARKS];
+
+    /// Mask marks to know the value of unmark dart, for each index i.
+    mutable std::bitset<NB_MARKS> mmask_marks;
+
+    /// Number of used marks.
+    mutable size_type mnb_used_marks;
+
+    /// Index of each mark, in mfree_marks_stack or in mfree_marks_stack.
+    mutable size_type mindex_marks[NB_MARKS];
+
+    /// "Stack" of free marks.
+    mutable size_type mfree_marks_stack[NB_MARKS];
+
+    /// "Stack" of used marks.
+    mutable size_type mused_marks_stack[NB_MARKS];
+
+    /// Number of marked darts for each used marks.
+    mutable size_type mnb_marked_darts[NB_MARKS];
+
+    /// Automatic management of the attributes:
+    /// true means attributes are always maintained updated during operations.
+    bool automatic_attributes_management;
+
+    /// Tuple of unary and binary functors (for all non void attributes).
+    typename Helper::Split_functors m_onsplit_functors;
+    typename Helper::Merge_functors m_onmerge_functors;
+  };
+
+  template < unsigned int d_,
+             class Items_=Combinatorial_map_min_items<d_>,
+             class Alloc_=CGAL_ALLOCATOR(int),
+             class Storage_= Combinatorial_map_storage_1<d_, Items_, Alloc_> >
+  class Combinatorial_map :
+    public Combinatorial_map_base<d_,
+                                  Combinatorial_map<d_,Items_,Alloc_, Storage_>,
+                                  Items_, Alloc_, Storage_ >
+  {
+  public:
+    typedef Combinatorial_map<d_, Items_,Alloc_, Storage_>  Self;
+    typedef Combinatorial_map_base<d_, Self, Items_, Alloc_, Storage_> Base;
+
+    typedef typename Base::Dart_handle Dart_handle;
+    typedef typename Base::Dart_const_handle Dart_const_handle;
+    typedef typename Base::Alloc Alloc;
+    typedef typename Base::Exception_no_more_available_mark
+    Exception_no_more_available_mark;
+
+    Combinatorial_map() : Base()
+    {}
+
+    Combinatorial_map(const Self & amap) : Base()
+    { Base::template copy<Self>(amap); }
+
+    template < class CMap >
+    Combinatorial_map(const CMap & amap)
+    { Base::template copy<CMap>(amap); }
+
+    template < class CMap, typename Converters >
+    Combinatorial_map(const CMap & amap, const Converters& converters)
+    { Base::template copy<CMap, Converters>
+          (amap, converters); }
+
+    template < class CMap, typename Converters, typename Pointconverter >
+    Combinatorial_map(const CMap & amap, const Converters& converters,
+                      const Pointconverter& pointconverter)
+    { Base::template copy<CMap, Converters, Pointconverter>
+          (amap, converters, pointconverter); }
+  };
+
+} // namespace CGAL
+
+#if  (BOOST_GCC >= 40900)
+ _Pragma("GCC diagnostic pop")
+#endif
+
+#endif // CGAL_COMBINATORIAL_MAP_H //
+// EOF //
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Combinatorial_map_basic_operations.h b/3rdparty/CGAL/include/CGAL/Combinatorial_map_basic_operations.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Combinatorial_map_basic_operations.h
rename to 3rdparty/CGAL/include/CGAL/Combinatorial_map_basic_operations.h
diff --git a/3rdparty/CGAL/include/CGAL/Combinatorial_map_constructors.h b/3rdparty/CGAL/include/CGAL/Combinatorial_map_constructors.h
new file mode 100644
index 0000000..bfcef7b
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Combinatorial_map_constructors.h
@@ -0,0 +1,143 @@
+// Copyright (c) 2010-2011 CNRS and LIRIS' Establishments (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Guillaume Damiand <guillaume.damiand at liris.cnrs.fr>
+//
+#ifndef CGAL_COMBINATORIAL_MAP_CONSTRUCTORS_H
+#define CGAL_COMBINATORIAL_MAP_CONSTRUCTORS_H 1
+
+#ifndef CGAL_NO_DEPRECATED_CODE
+
+#include <CGAL/Combinatorial_map_basic_operations.h>
+
+namespace CGAL {
+
+  /** @file Combinatorial_map_constructors.h
+   * Basic creation operations  for a combinatorial map.
+   * Create edge, triangle, quadrilateral, tetrahedron, hexahedron.
+   */
+
+  /** Create an edge.
+   * @param amap the used combinatorial map.
+   * @return a dart of the new edge.
+   */
+  template < class Map >
+  CGAL_DEPRECATED typename Map::Dart_handle make_edge(Map& amap)
+  { return amap.make_edge(); }
+
+  /** Create a combinatorial polygon of length alg
+   * (a cycle of alg darts beta1 links together).
+   * @param amap the used combinatorial map.
+   * @return a new dart.
+   */
+  template < class Map >
+  CGAL_DEPRECATED typename Map::Dart_handle make_combinatorial_polygon(Map& amap,
+                                                       unsigned int alg)
+  { return amap.make_combinatorial_polygon(alg); }
+
+  /** Test if a face is a combinatorial polygon of length alg
+   *  (a cycle of alg darts beta1 links together).
+   * @param amap the used combinatorial map.
+   * @param adart an intial dart
+   * @return true iff the face containing adart is a polygon of length alg.
+   */
+  template < class Map >
+  CGAL_DEPRECATED bool is_face_combinatorial_polygon(const Map& amap,
+                                     typename Map::Dart_const_handle adart,
+                                     unsigned int alg)
+  { return amap.is_face_combinatorial_polygon(adart, alg); }
+
+  /** Create a combinatorial tetrahedron from 4 triangles.
+   * @param amap the used combinatorial map.
+   * @param d1 a dart onto a first triangle.
+   * @param d2 a dart onto a second triangle.
+   * @param d3 a dart onto a third triangle.
+   * @param d4 a dart onto a fourth triangle.
+   * @return a new dart.
+   */
+  template < class Map >
+  typename Map::Dart_handle
+  CGAL_DEPRECATED make_combinatorial_tetrahedron(Map& amap,
+                                 typename Map::Dart_handle d1,
+                                 typename Map::Dart_handle d2,
+                                 typename Map::Dart_handle d3,
+                                 typename Map::Dart_handle d4)
+  { return amap.make_combinatorial_tetrahedron(d1, d2, d3, d4); }
+
+  /** Test if a volume is a combinatorial tetrahedron.
+   * @param amap the used combinatorial map.
+   * @param adart an intial dart
+   * @return true iff the volume containing adart is a combinatorial tetrahedron.
+   */
+  template < class Map >
+  CGAL_DEPRECATED bool is_volume_combinatorial_tetrahedron(const Map& amap,
+                                           typename Map::Dart_const_handle d1)
+  { return amap.is_volume_combinatorial_tetrahedron(d1); }
+
+  /** Create a new combinatorial tetrahedron.
+   * @param amap the used combinatorial map.
+   * @return a new dart.
+   */
+  template < class Map >
+  CGAL_DEPRECATED typename Map::Dart_handle make_combinatorial_tetrahedron(Map& amap)
+  { return amap.make_combinatorial_tetrahedron(); }
+
+  /** Create a combinatorial hexahedron from 6 quadrilaterals.
+   * @param amap the used combinatorial map.
+   * @param d1 a dart onto a first quadrilateral.
+   * @param d2 a dart onto a second quadrilateral.
+   * @param d3 a dart onto a third quadrilateral.
+   * @param d4 a dart onto a fourth quadrilateral.
+   * @param d5 a dart onto a fifth quadrilateral.
+   * @param d6 a dart onto a sixth quadrilateral.
+   * @return a dart of the new cuboidal_cell.
+   */
+  template < class Map >
+  typename Map::Dart_handle
+  CGAL_DEPRECATED make_combinatorial_hexahedron(Map& amap,
+                                typename Map::Dart_handle d1,
+                                typename Map::Dart_handle d2,
+                                typename Map::Dart_handle d3,
+                                typename Map::Dart_handle d4,
+                                typename Map::Dart_handle d5,
+                                typename Map::Dart_handle d6)
+  { return amap.make_combinatorial_hexahedron(d1, d2, d3, d4, d5, d6); }
+
+  /** Test if a volume is a combinatorial hexahedron.
+   * @param amap the used combinatorial map.
+   * @param adart an intial dart
+   * @return true iff the volume containing adart is a combinatorial hexahedron.
+   */
+  template < class Map >
+  CGAL_DEPRECATED bool is_volume_combinatorial_hexahedron(const Map& amap,
+                                          typename Map::Dart_const_handle d1)
+  { return amap.is_volume_combinatorial_hexahedron(d1); }
+
+  /** Create a new combinatorial hexahedron.
+   * @param amap the used combinatorial map.
+   * @return a new dart.
+   */
+  template < class Map >
+  CGAL_DEPRECATED typename Map::Dart_handle make_combinatorial_hexahedron(Map& amap)
+  { return amap.make_combinatorial_hexahedron(); }
+
+} // namespace CGAL
+
+#endif // CGAL_NO_DEPRECATED_CODE
+
+#endif // CGAL_COMBINATORIAL_MAP_CONSTRUCTORS_H //
+// EOF //
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Combinatorial_map_functors.h b/3rdparty/CGAL/include/CGAL/Combinatorial_map_functors.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Combinatorial_map_functors.h
rename to 3rdparty/CGAL/include/CGAL/Combinatorial_map_functors.h
diff --git a/3rdparty/CGAL/include/CGAL/Combinatorial_map_insertions.h b/3rdparty/CGAL/include/CGAL/Combinatorial_map_insertions.h
new file mode 100644
index 0000000..0885b02
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Combinatorial_map_insertions.h
@@ -0,0 +1,154 @@
+// Copyright (c) 2010-2011 CNRS and LIRIS' Establishments (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Guillaume Damiand <guillaume.damiand at liris.cnrs.fr>
+//
+#ifndef CGAL_COMBINATORIAL_MAP_INSERTIONS_H
+#define CGAL_COMBINATORIAL_MAP_INSERTIONS_H
+
+#include <deque>
+
+namespace CGAL
+{
+/** @file Combinatorial_map_insertions.h
+ * Insertion operations on combinatorial map.
+ */
+
+#ifndef CGAL_NO_DEPRECATED_CODE
+
+/** Insert a vertex in a given edge.
+ * @param amap the used combinatorial map.
+ * @param adart a dart of the edge (!=NULL && !=null_dart_handle).
+ * @param update_attributes a boolean to update the enabled attributes
+ *        (deprecated, now we use are_attributes_automatically_managed())
+ * @return a dart of the new vertex.
+ */
+template<class CMap>
+CGAL_DEPRECATED typename CMap::Dart_handle
+insert_cell_0_in_cell_1( CMap& amap, typename CMap::Dart_handle adart,
+                         typename CMap::template
+                         Attribute_handle<0>::type ah=CMap::null_handle,
+                         bool update_attributes=true )
+{
+  return amap.insert_cell_0_in_cell_1(adart, ah, update_attributes);
+}
+
+/** Insert a vertex in the given 2-cell which is splitted in triangles,
+ * once for each inital edge of the facet.
+ * @param amap the used combinatorial map.
+ * @param adart a dart of the facet to triangulate.
+ * @param update_attributes a boolean to update the enabled attributes
+ *        (deprecated, now we use are_attributes_automatically_managed())
+ * @return A dart incident to the new vertex.
+ */
+template < class CMap >
+CGAL_DEPRECATED typename CMap::Dart_handle
+insert_cell_0_in_cell_2( CMap& amap, typename CMap::Dart_handle adart,
+                         typename CMap::template
+                         Attribute_handle<0>::type ah=CMap::null_handle,
+                         bool update_attributes=true )
+{
+  return amap.insert_cell_0_in_cell_2(adart, ah, update_attributes);
+}
+/** Insert a dangling edge in a 2-cell between given by a dart.
+ * @param amap the used combinatorial map.
+ * @param adart1 a first dart of the facet (!=NULL && !=null_dart_handle).
+ * @param update_attributes a boolean to update the enabled attributes
+ *        (deprecated, now we use are_attributes_automatically_managed())
+ * @return a dart of the new edge, not incident to the vertex of adart1.
+ */
+template<class CMap>
+CGAL_DEPRECATED typename CMap::Dart_handle
+insert_dangling_cell_1_in_cell_2( CMap& amap,
+                                  typename CMap::Dart_handle adart1,
+                                  typename CMap::template
+                                  Attribute_handle<0>::type ah=CMap::null_handle,
+                                  bool update_attributes=true )
+{
+  return amap.insert_dangling_cell_1_in_cell_2(adart1,
+                                               ah, update_attributes);
+}
+
+/** Test if an edge can be inserted onto a 2-cell between two given darts.
+ * @param amap the used combinatorial map.
+ * @param adart1 a first dart.
+ * @param adart2 a second dart.
+ * @return true iff an edge can be inserted between adart1 and adart2.
+ */
+template < class CMap >
+CGAL_DEPRECATED bool is_insertable_cell_1_in_cell_2
+(const CMap& amap, typename CMap::Dart_const_handle adart1,
+ typename CMap::Dart_const_handle adart2)
+{
+  return amap.is_insertable_cell_1_in_cell_2(adart1, adart2);
+}
+
+/** Insert an edge in a 2-cell between two given darts.
+ * @param amap the used combinatorial map.
+ * @param adart1 a first dart of the facet (!=NULL && !=null_dart_handle).
+ * @param adart2 a second dart of the facet. If NULL insert a dangling edge.
+ * @param update_attributes a boolean to update the enabled attributes
+ *        (deprecated, now we use are_attributes_automatically_managed())
+ * @return a dart of the new edge, and not incident to the
+ *         same vertex than adart1.
+ */
+template<class CMap>
+CGAL_DEPRECATED typename CMap::Dart_handle
+insert_cell_1_in_cell_2(CMap& amap,
+                        typename CMap::Dart_handle adart1,
+                        typename CMap::Dart_handle adart2,
+                        bool update_attributes=true)
+{
+  return amap.insert_cell_1_in_cell_2(adart1, adart2,
+                                      update_attributes);
+}
+
+/** Test if a 2-cell can be inserted onto a given 3-cell along
+ * a path of edges.
+ * @param amap the used combinatorial map.
+ * @param afirst iterator on the begining of the path.
+ * @param alast  iterator on the end of the path.
+ * @return true iff a 2-cell can be inserted along the path.
+ */
+template <class CMap, class InputIterator>
+CGAL_DEPRECATED bool is_insertable_cell_2_in_cell_3
+(const CMap& amap, InputIterator afirst, InputIterator alast)
+{
+  return amap.is_insertable_cell_2_in_cell_3(afirst, alast);
+}
+
+/** Insert a 2-cell in a given 3-cell along a path of darts.
+ * @param amap the used combinatorial map.
+ * @param afirst iterator on the begining of the path.
+ * @param alast  iterator on the end of the path.
+ * @param update_attributes a boolean to update the enabled attributes
+ *        (deprecated, now we use are_attributes_automatically_managed())
+ * @return a dart of the new 2-cell.
+ */
+template<class CMap, class InputIterator>
+CGAL_DEPRECATED typename CMap::Dart_handle
+insert_cell_2_in_cell_3(CMap& amap, InputIterator afirst, InputIterator alast,
+                        bool update_attributes=true)
+{
+  return amap.insert_cell_2_in_cell_3(afirst, alast, update_attributes);
+}
+
+#endif // CGAL_NO_DEPRECATED_CODE
+
+} // namespace CGAL
+
+#endif // CGAL_COMBINATORIAL_MAP_INSERTIONS_H
diff --git a/3rdparty/CGAL/include/CGAL/Combinatorial_map_iterators_base.h b/3rdparty/CGAL/include/CGAL/Combinatorial_map_iterators_base.h
new file mode 100644
index 0000000..8a8c77d
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Combinatorial_map_iterators_base.h
@@ -0,0 +1,601 @@
+// Copyright (c) 2010-2011 CNRS and LIRIS' Establishments (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Guillaume Damiand <guillaume.damiand at liris.cnrs.fr>
+//
+#ifndef CGAL_COMBINATORIAL_MAP_ITERATORS_BASE_HH
+#define CGAL_COMBINATORIAL_MAP_ITERATORS_BASE_HH 1
+
+#include <CGAL/Compact_container.h>
+#include <queue>
+#include <boost/mpl/if.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+namespace CGAL {
+
+  /** @file Combinatorial_map_iterators_base.h
+   * Basic classes that serve as tools for definition of iterators.
+   There are 3 classes:
+   *  - CMap_dart_iterator<Map,Const> is the basic generic class defining
+   *    what is an interator on darts.
+   *  - CMap_extend_iterator<Map,Ite,Bi> to extend the given iterator by adding
+   *    the involution Bi.
+   *  - CMap_non_basic_iterator<Map_,Ite> to transform the basic iterator Ite
+   *    into the corresponding non basic iterator.
+   *  - CMap_range<Map,It,ConstIt,BasicIt> generic definition of a range
+   *    given an iterator and its const version
+   *  - CMap_const_range<Map,It,ConstIt,BasicIt> generic definition of a const
+   *    range given an iterator and its const version
+   */
+  //****************************************************************************
+  /// OperationState: type to keep the last operation used by the previous ++.
+  typedef char OperationState;
+
+  /// Enum of all the possible operations used by the ++ operator.
+  enum
+  {
+    OP_NONE = -1, ///< Beginning of the iterator (there is not yet operator++).
+    OP_BETAI,     ///< Previous op was the first beta.
+    OP_BETAI_INV, ///< Previous op was the inverse of the first beta.
+    OP_BETAJ,     ///< Previous op was the second beta.
+    OP_BETAK,     ///< Previous op was the third beta.
+    OP_BETA0I,    ///< Previous op was beta0 o the first beta.
+    OP_BETAI1,    ///< Previous op was the first beta o beta1.
+    OP_BETAIJ,    ///< Previous op was the composition of two beta.
+    OP_BETAJI,    ///< Previous op was the composition of two beta.
+    OP_BETA21,     ///< Previous op was beta21.
+    OP_JUMP,      ///< Previous op was a jump .
+    OP_POP,       ///< Previous op pop a dart from a stack or a queue.
+    OP_END        ///< Previous op go out of the iterator.
+  };
+  //****************************************************************************
+  /** Generic class of iterator onto darts.
+   * Class CMap_dart_iterator is a generic iterator. All the combinatorial
+   * map iterator classes inherit from this class (or one of its subclass).
+   */
+  template < typename Map_,bool Const=false >
+  class CMap_dart_iterator: public boost::mpl::if_c< Const,
+      typename Map_::Dart_container::const_iterator,
+      typename Map_::Dart_container::iterator>::type
+    //public internal::CC_iterator<typename Map_::Dart_container,Const>
+  {
+  public:
+    typedef CMap_dart_iterator<Map_,Const> Self;
+
+    typedef typename boost::mpl::if_c< Const,
+          typename Map_::Dart_container::const_iterator,
+          typename Map_::Dart_container::iterator>::type Base;
+
+    typedef typename boost::mpl::if_c< Const,
+                                       typename Map_::Dart_const_handle,
+                                       typename Map_::Dart_handle>::type
+                                     Dart_handle;
+    typedef typename boost::mpl::if_c< Const, const Map_,
+                                       Map_>::type Map;
+
+    typedef std::input_iterator_tag iterator_category;
+    typedef typename Base::value_type value_type;
+    typedef typename Base::difference_type difference_type;
+    typedef typename Base::pointer pointer;
+    typedef typename Base::reference reference;
+
+    /// true iff this iterator is basic
+    typedef Tag_true Basic_iterator;
+
+    typedef typename Map::size_type size_type;
+
+  public:
+    /// Main constructor.
+    CMap_dart_iterator(Map& amap, Dart_handle adart):
+      Base(adart),
+      mmap(&amap),
+      mfirst_dart(adart),
+      mprev_op(OP_NONE)
+    {}
+
+    /// == operator.
+    bool operator==(const Self& aiterator) const
+    {
+      return ( ((*this==mmap->null_handle) && (aiterator==mmap->null_handle)) ||
+               (mfirst_dart == aiterator.mfirst_dart &&
+               static_cast<const Base&>(*this)==
+                static_cast<const Base&>(aiterator)) );
+    }
+
+    /// != operator.
+    bool operator!=(const Self& aiterator) const
+    { return !operator==(aiterator); }
+
+    /// Accessor to the initial dart of the iterator.
+    Dart_handle get_first_dart() const { return mfirst_dart; }
+
+    /// Accessor to the combinatorial map.
+    Map* get_combinatorial_map() const { return mmap; }
+
+    /// Rewind of the iterator to its beginning.
+    void rewind()
+    { set_current_dart(mfirst_dart); mprev_op = OP_NONE; }
+
+    /// Test if the iterator is at its end.
+    bool cont() const
+    { return static_cast<const Base&>(*this)!=mmap->null_handle; }
+
+    /// Get the previous operation used for the last ++.
+    OperationState prev_operation()  const { return mprev_op; }
+
+  protected:
+    /// Set the current dart to a given dart
+    void set_current_dart(Dart_handle adart)
+    { Base::operator=(adart); }
+
+  private:
+    /// operator -- in private to invalidate the base operator.
+    Self& operator--()
+    { return *this; }
+    /// operator -- in private to invalidate the base operator.
+    Self operator--(int)
+    { return *this; }
+
+  protected:
+    /// test if adart->beta(ai) exists and is not marked for amark
+    bool is_unmarked(Dart_handle adart, unsigned int ai, size_type amark) const
+    { return
+        !mmap->is_marked(mmap->beta(adart,ai), amark);
+    }
+
+    /// test if adart->beta(ai)->beta(aj) exists
+    bool exist_betaij(Dart_handle adart, unsigned int ai, unsigned int aj) const
+    { return !mmap->is_free(adart, ai) && !mmap->is_free(mmap->beta(adart, ai), aj); }
+
+    /// test if adart->beta(ai)->beta(aj) exists and is not marked for amark
+    bool is_unmarked2(Dart_handle adart, unsigned int ai, unsigned int aj,
+                      typename Map::size_type amark) const
+    { return
+        !mmap->is_marked(mmap->beta(adart, ai, aj), amark);
+    }
+
+  protected:
+    /// The map containing the darts to iterate on.
+    Map* mmap;
+
+    /// The initial dart of the iterator.
+    Dart_handle mfirst_dart;
+
+    /// The last operation used for the ++ operator.
+    OperationState mprev_op;
+  };
+  //****************************************************************************
+  /* Class CMap_extend_iterator<Map,Ite,Bi> which extend a given iterator by
+   * adding Bi and by using a stack and a mark.
+   * General case when Ite does not have already a stack.
+   */
+  template <typename Map_,typename Ite,int Bi,
+            typename Ite_has_stack=typename Ite::Use_mark>
+  class CMap_extend_iterator: public Ite
+  {
+  public:
+    typedef CMap_extend_iterator<Map_,Ite,Bi, Ite_has_stack> Self;
+    typedef Ite Base;
+
+    typedef typename Base::Dart_handle Dart_handle;
+    typedef typename Base::Map Map;
+
+    typedef Tag_true Use_mark;
+
+    typedef typename Map::size_type size_type;
+
+    CGAL_static_assertion( (Bi<=Map::dimension &&
+                            boost::is_same<Ite_has_stack,Tag_false>::value) );
+
+  public:
+    /// Main constructor.
+    CMap_extend_iterator(Map& amap, Dart_handle adart, size_type amark):
+      Base(amap, adart),
+      mmark_number(amark),
+      minitial_dart(adart)
+    {
+      if ( minitial_dart!=amap.null_handle )
+      {
+        this->mmap->mark_null_dart(mmark_number);
+        this->mmap->mark(minitial_dart, mmark_number);
+        if (!this->mmap->is_free(minitial_dart, Bi) &&
+            this->mmap->beta(minitial_dart, Bi)!=minitial_dart )
+        {
+          mto_treat.push(this->mmap->beta(minitial_dart, Bi));
+        }
+      }
+    }
+
+    /// Rewind of the iterator to its beginning.
+    void rewind()
+    {
+      CGAL_assertion(mmark_number != Map::INVALID_MARK);
+      Base::operator= ( Base(*this->mmap,minitial_dart) );
+      mto_treat = std::queue<Dart_handle>();
+      this->mmap->mark(minitial_dart, mmark_number);
+      this->mmap->mark_null_dart(mmark_number);
+      if (!this->mmap->is_free(minitial_dart, Bi) &&
+          this->mmap->beta(minitial_dart, Bi)!=minitial_dart)
+      {
+        mto_treat.push(this->mmap->beta(minitial_dart, Bi));
+      }
+    }
+
+    /// Prefix ++ operator.
+    Self& operator++()
+    {
+      CGAL_assertion(mmark_number != Map::INVALID_MARK);
+      CGAL_assertion(this->cont());
+
+      do
+      {
+        Base::operator++();
+      }
+      while ( this->cont() &&
+              this->mmap->is_marked(*this, mmark_number) );
+
+      if ( !this->cont() )
+      {
+        while ( !mto_treat.empty() &&
+                this->mmap->is_marked(mto_treat.front(), mmark_number))
+        {
+          mto_treat.pop();
+        }
+
+        if ( !mto_treat.empty() )
+        {
+          Base::operator= ( Base(*this->mmap,mto_treat.front()) );
+          mto_treat.pop();
+          this->mprev_op = OP_POP;
+          CGAL_assertion( !this->mmap->is_marked((*this), mmark_number) );
+          this->mmap->mark((*this), mmark_number);
+
+          if (
+               !this->mmap->is_marked(this->mmap->beta(*this, Bi), mmark_number) )
+          {
+            mto_treat.push(this->mmap->beta(*this, Bi));
+          }
+        }
+      }
+      else
+      {
+        this->mmap->mark((*this), mmark_number);
+        if (
+             !this->mmap->is_marked(this->mmap->beta(*this, Bi), mmark_number) )
+        {
+          mto_treat.push(this->mmap->beta(*this, Bi));
+        }
+      }
+
+      return *this;
+    }
+
+    /// Postfix ++ operator.
+    Self operator++(int)
+    { Self res=*this; operator ++(); return res; }
+
+  protected:
+    /// Queue of darts to process.
+    std::queue<Dart_handle> mto_treat;
+
+    /// Index of the used mark.
+    size_type mmark_number;
+
+    /// Initial dart
+    Dart_handle minitial_dart;
+  };
+  //****************************************************************************
+  /* Class CMap_extend_iterator<Map,Ite,Bi> which extend a given iterator by
+   * adding Bi and by using a stack and a mark.
+   * Specialization when Ite has already a stack.
+   */
+  template <typename Map_,typename Ite,int Bi>
+  class CMap_extend_iterator<Map_,Ite,Bi,Tag_true>: public Ite
+  {
+  public:
+    typedef CMap_extend_iterator<Map_,Ite,Bi,Tag_true> Self;
+    typedef Ite Base;
+
+    typedef typename Base::Dart_handle Dart_handle;
+    typedef typename Base::Map Map;
+
+    typedef Tag_true Use_mark;
+
+    typedef typename Map::size_type size_type;
+
+    /// Main constructor.
+    CMap_extend_iterator(Map& amap, Dart_handle adart, size_type amark):
+      Base(amap, adart, amark)
+    {
+      if ( this->minitial_dart!=amap.null_handle &&
+           !this->mmap->is_free(this->minitial_dart, Bi) &&
+           this->mmap->beta(this->minitial_dart, Bi)!=this->minitial_dart )
+      {
+        this->mto_treat.push(this->mmap->beta(this->minitial_dart, Bi));
+      }
+    }
+
+    /// Rewind of the iterator to its beginning.
+    void rewind()
+    {
+      CGAL_assertion(this->mmark_number != Map::INVALID_MARK);
+      Base::rewind();
+      if ( !this->mmap->is_free(this->minitial_dart, Bi) &&
+           this->mmap->beta(this->minitial_dart, Bi)!=this->minitial_dart )
+      {
+        this->mto_treat.push(this->mmap->beta(this->minitial_dart, Bi));
+      }
+    }
+
+    /// Prefix ++ operator.
+    Self& operator++()
+    {
+      Base::operator++();
+
+      if ( this->cont() )
+      {
+        CGAL_assertion( this->mmap->is_marked(*this, this->mmark_number) );
+
+        if (
+            !this->mmap->is_marked(this->mmap->beta(*this, Bi), this->mmark_number) )
+        {
+          this->mto_treat.push(this->mmap->beta(*this, Bi));
+        }
+      }
+      return *this;
+    }
+
+    /// Postfix ++ operator.
+    Self operator++(int)
+    { Self res=*this; operator ++(); return res; }
+  };
+  //****************************************************************************
+  //* Class CMap_non_basic_iterator allows to transform a basic_iterator onto
+  //* a non basic one, depending if the basic iterator uses mark or not.
+  template <typename Map_,typename Basic_iterator,
+            typename Use_mark=typename Basic_iterator::Use_mark>
+  class CMap_non_basic_iterator;
+  //****************************************************************************
+  template <typename Map_,typename Base_>
+  class CMap_non_basic_iterator<Map_,Base_,Tag_true>:
+    public Base_
+  {
+  public:
+    typedef CMap_non_basic_iterator<Map_,Base_,Tag_true> Self;
+    typedef Base_ Base;
+
+    typedef typename Base::Map Map;
+    typedef typename Base::Dart_handle Dart_handle;
+
+    /// True iff this iterator is basic
+    typedef Tag_false Basic_iterator;
+
+    typedef typename Map::size_type size_type;
+
+    CGAL_static_assertion( (boost::is_same<typename Base::Basic_iterator,
+                            Tag_true>::value) );
+
+    /// Main constructor.
+    CMap_non_basic_iterator(Map& amap, Dart_handle adart1):
+      Base(amap, adart1, amap.get_new_mark())
+    {}
+
+    /// Destructor.
+    ~CMap_non_basic_iterator() CGAL_NOEXCEPT(CGAL_NO_ASSERTIONS_BOOL)
+    {
+      CGAL_destructor_assertion( this->mmark_number!=Map::INVALID_MARK );
+      if (this->mmap->get_number_of_times_mark_reserved
+          (this->mmark_number)==1)
+        unmark_treated_darts();
+      this->mmap->free_mark(this->mmark_number);
+      this->mmark_number = Map::INVALID_MARK; // To avoid basic class to try to unmark darts.
+    }
+
+    /// Copy constructor.
+    CMap_non_basic_iterator(const Self& aiterator):
+      Base(aiterator)
+    { this->mmap->share_a_mark(this->mmark_number); }
+
+    /// Assignment operator.
+    Self& operator=(const Self& aiterator)
+    {
+      if (this != &aiterator)
+      {
+        if (this->mmap->get_number_of_times_mark_reserved
+            (this->mmark_number)==1)
+          unmark_treated_darts();
+        this->mmap->free_mark(this->mmark_number);
+        this->mmark_number = Map::INVALID_MARK;
+
+        Base::operator=(aiterator);
+        this->mmap->share_a_mark(this->mmark_number);
+      }
+      return *this;
+    }
+
+    /// Rewind of the iterator to its beginning.
+    void rewind()
+    {
+      unmark_treated_darts();
+      Base::rewind();
+    }
+
+    using Base::operator++;
+
+    /// Postfix ++ operator.
+    Self operator++(int)
+    { Self res=*this; operator ++(); return res; }
+
+  protected:
+    /// Unmark all the marked darts during the iterator.
+    void unmark_treated_darts()
+    {
+      if (this->mmap->is_whole_map_unmarked(this->mmark_number)) return;
+
+      this->mmap->negate_mark(this->mmark_number);
+
+      if (this->mmap->is_whole_map_unmarked(this->mmark_number)) return;
+
+      Base::rewind();
+      while (this->mmap->number_of_unmarked_darts(this->mmark_number) > 0)
+        this->operator++();
+      this->mmap->negate_mark(this->mmark_number);
+      CGAL_assertion(this->mmap->is_whole_map_unmarked(this->mmark_number));
+    }
+  };
+  //****************************************************************************
+  template <typename Map_,typename Base_>
+  class CMap_non_basic_iterator<Map_,Base_,Tag_false>:
+    public Base_
+  {
+  public:
+    typedef CMap_non_basic_iterator<Map_,Base_,Tag_false> Self;
+    typedef Base_ Base;
+
+    typedef typename Base::Map Map;
+    typedef typename Base::Dart_handle Dart_handle;
+
+    /// True iff this iterator is basic
+    typedef Tag_false Basic_iterator;
+
+    CGAL_static_assertion( (boost::is_same<typename Base::Basic_iterator,
+                            Tag_true>::value) );
+
+    /// Main constructor.
+    CMap_non_basic_iterator(Map& amap, Dart_handle adart):
+      Base(amap, adart)
+    {}
+  };
+  //****************************************************************************
+  template <typename Map_, typename It, typename Const_it,
+            typename Basic_iterator=typename It::Basic_iterator>
+  struct CMap_range
+  {
+    typedef It iterator;
+    typedef Const_it const_iterator;
+    CMap_range(Map_ &amap, typename Map_::Dart_handle adart) :
+      mmap(amap), mdart(adart), msize(0)
+    {}
+    iterator begin()             { return iterator(mmap,mdart); }
+    iterator end()               { return iterator(mmap,mmap.null_handle); }
+    const_iterator begin() const { return const_iterator(mmap,mdart); }
+    const_iterator end() const   { return const_iterator(mmap,mmap.null_handle); }
+    typename Map_::size_type size() const
+    {
+      if (msize==0)
+        for ( const_iterator it=begin(), itend=end(); it!=itend; ++it)
+          ++msize;
+      return msize;
+    }
+    bool empty() const
+    { return mmap.is_empty(); }
+  private:
+    Map_ & mmap;
+    typename Map_::Dart_handle mdart;
+    mutable typename Map_::size_type msize;
+  };
+  //****************************************************************************
+  template <typename Map_, typename It, typename Const_it>
+  struct CMap_range<Map_,It,Const_it,Tag_true>
+  {
+    typedef CMap_range<Map_,It,Const_it,Tag_true> Base_cmap_range;
+    typedef It iterator;
+    typedef Const_it const_iterator;
+
+    typedef typename Map_::size_type size_type;
+
+    CMap_range(Map_ &amap, typename Map_::Dart_handle adart, size_type amark=Map_::INVALID_MARK):
+      mmap(amap), mdart(adart), msize(0), mmark(amark)
+    {}
+    iterator begin()             { return iterator(mmap,mdart,mmark); }
+    iterator end()               { return iterator(mmap,mmap.null_handle,mmark); }
+    const_iterator begin() const { return const_iterator(mmap,mdart,mmark); }
+    const_iterator end() const   { return const_iterator(mmap,mmap.null_handle,mmark); }
+    typename Map_::size_type size() const
+    {
+      if (msize==0)
+        for ( CMap_non_basic_iterator<Map_,const_iterator> it(mmap,mdart);
+              it.cont(); ++it )
+          ++msize;
+      return msize;
+    }
+    bool empty() const
+    { return mmap.is_empty(); }
+  private:
+    Map_ & mmap;
+    typename Map_::Dart_handle mdart;
+    mutable typename Map_::size_type msize;
+    size_type mmark;
+  };
+  //****************************************************************************
+  template <typename Map_, typename Const_it,
+            typename Basic_iterator=typename Const_it::Basic_iterator>
+  struct CMap_const_range
+  {
+    typedef Const_it const_iterator;
+    CMap_const_range(const Map_ &amap, typename Map_::Dart_const_handle adart):
+      mmap(amap), mdart(adart), msize(0)
+    {}
+    const_iterator begin() const { return const_iterator(mmap,mdart); }
+    const_iterator end() const   { return const_iterator(mmap,mmap.null_handle); }
+    typename Map_::size_type size() const
+    {
+      if (msize==0)
+        for ( const_iterator it=begin(), itend=end(); it!=itend; ++it)
+          ++msize;
+      return msize;
+    }
+    bool empty() const
+    { return mmap.is_empty(); }
+  private:
+    const Map_ & mmap;
+    typename Map_::Dart_const_handle mdart;
+    mutable typename Map_::size_type msize;
+  };
+  //****************************************************************************
+  template <typename Map_, typename Const_it>
+  struct CMap_const_range<Map_,Const_it,Tag_true>
+  {
+    typedef Const_it const_iterator;
+    typedef typename Map_::size_type size_type;
+    CMap_const_range(const Map_ &amap, typename Map_::Dart_const_handle adart,
+                     size_type amark=Map_::INVALID_MARK):
+      mmap(amap), mdart(adart), msize(0), mmark(amark)
+    {}
+    const_iterator begin() const { return const_iterator(mmap,mdart,mmark); }
+    const_iterator end() const   { return const_iterator(mmap,mmap.null_handle,mmark); }
+    typename Map_::size_type size() const
+    {
+      if (msize==0)
+        for ( CMap_non_basic_iterator<Map_,const_iterator> it(mmap,mdart);
+              it.cont(); ++it )
+          ++msize;
+      return msize;
+    }
+    bool empty() const
+    { return mmap.is_empty(); }
+  private:
+    const Map_ & mmap;
+    typename Map_::Dart_const_handle mdart;
+    mutable typename Map_::size_type msize;
+    size_type mmark;
+  };
+  //****************************************************************************
+} // namespace CGAL
+//******************************************************************************
+#endif // CGAL_COMBINATORIAL_MAP_ITERATORS_BASE_HH
+//******************************************************************************
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Combinatorial_map_min_items.h b/3rdparty/CGAL/include/CGAL/Combinatorial_map_min_items.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Combinatorial_map_min_items.h
rename to 3rdparty/CGAL/include/CGAL/Combinatorial_map_min_items.h
diff --git a/3rdparty/CGAL/include/CGAL/Combinatorial_map_operations.h b/3rdparty/CGAL/include/CGAL/Combinatorial_map_operations.h
new file mode 100644
index 0000000..69188e8
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Combinatorial_map_operations.h
@@ -0,0 +1,824 @@
+// Copyright (c) 2010-2011 CNRS and LIRIS' Establishments (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Guillaume Damiand <guillaume.damiand at liris.cnrs.fr>
+//
+#ifndef CGAL_COMBINATORIAL_MAP_OPERATIONS_H
+#define CGAL_COMBINATORIAL_MAP_OPERATIONS_H 1
+
+#include <CGAL/Combinatorial_map_basic_operations.h>
+#include <CGAL/Combinatorial_map_insertions.h>
+#include <deque>
+#include <stack>
+
+namespace CGAL
+{
+  /** @file Combinatorial_map_operations.h
+   * Some operations to modify a combinatorial map.
+   */
+
+  /** Test if an i-cell can be removed.
+   *  An i-cell can be removed if i==CMap::dimension or i==CMap::dimension-1,
+   *     or if there are at most two (i+1)-cell incident to it.
+   * @param adart a dart of the i-cell.
+   * @return true iff the i-cell can be removed.
+   */
+  template <class CMap, unsigned int i, unsigned int nmi=CMap::dimension-i>
+  struct Is_removable_functor
+  {
+    static bool run(const CMap& amap, typename CMap::Dart_const_handle adart)
+    {
+      // TODO? Optimisation for dim-2, and to not test all the darts of the cell?
+      bool res = true;
+      for ( CGAL::CMap_dart_const_iterator_of_cell<CMap,i> it(amap, adart);
+            res && it.cont(); ++it )
+      {
+        if ( amap.template beta<i+2,i+1>(it)!=
+             amap.template beta<CGAL_BETAINV(i+1),i+2>(it) )
+          res = false;
+      }
+      return res;
+    }
+  };
+  // Specialization for i=CMap::dimension
+  template <class CMap, unsigned int i>
+  struct Is_removable_functor<CMap, i, 0>
+  {
+    static bool run(const CMap&, typename CMap::Dart_const_handle)
+    { return true; }
+  };
+  // Specialization for i=CMap::dimension-1
+  template <class CMap, unsigned int i>
+  struct Is_removable_functor<CMap, i, 1>
+  {
+    static bool run(const CMap&, typename CMap::Dart_const_handle)
+    { return true; }
+  };
+  /** Test if an i-cell can be removed.
+   *  An i-cell can be removed if i==CMap::dimension or i==CMap::dimension-1,
+   *     or if there are at most two (i+1)-cell incident to it.
+   * @param adart a dart of the i-cell.
+   * @return true iff the i-cell can be removed.
+   */
+#ifndef CGAL_NO_DEPRECATED_CODE
+  template < class CMap, unsigned int i >
+  CGAL_DEPRECATED bool is_removable(const CMap& amap,
+                                    typename CMap::Dart_const_handle adart)
+  { return CGAL::Is_removable_functor<CMap, i>::run(amap,adart); }
+#endif // CGAL_NO_DEPRECATED_CODE
+
+  /** Remove an i-cell, 0<i<dimension, and merge eventually both incident
+   *  (i+1)-cells.
+   *  @param amap the used combinatorial map.
+   *  @param adart a dart of the i-cell to remove.
+   *  @param update_attributes a boolean to update the enabled attributes
+   *         (deprecated, now we use are_attributes_automatically_managed())
+   *  @return the number of deleted darts.
+   */
+  template<class CMap, unsigned int i, unsigned int nmi>
+  struct Remove_cell_functor
+  {
+    static size_t run(CMap& amap, typename CMap::Dart_handle adart,
+                      bool update_attributes)
+    {
+      CGAL_static_assertion ( 1<=i && i<CMap::dimension );
+      CGAL_assertion( (amap.template is_removable<i>(adart)) );
+
+      size_t res = 0;
+
+      typename CMap::Dart_handle d1, d2;
+      typename CMap::Dart_handle dg1=amap.null_handle, dg2=amap.null_handle;
+
+      typename CMap::size_type mark = amap.get_new_mark();
+      typename CMap::size_type mark_modified_darts = amap.get_new_mark();
+
+      std::deque<typename CMap::Dart_handle> to_erase;
+
+      const int iinv = CGAL_BETAINV(i);
+
+      // First we store and mark all the darts of the i-cell to remove.
+      for ( CGAL::CMap_dart_iterator_basic_of_cell<CMap,i> it(amap,adart,mark);
+            it.cont(); ++it )
+      {
+        to_erase.push_back(it);
+        if ( !amap.template is_free<i+1>(it) && dg1==amap.null_handle )
+        { dg1=it; dg2=amap.template beta<i+1>(it); }
+        amap.mark(it, mark);
+        ++res;
+      }
+
+      if (amap.are_attributes_automatically_managed() && update_attributes)
+      {
+        // We group the two (i+1)-cells incident if they exist.
+        if ( dg1!=amap.null_handle )
+          CGAL::internal::Group_attribute_functor_run<CMap, i+1>::
+              run(&amap, dg1, dg2);
+      }
+
+      // During the operation, we store in modified_darts the darts modified
+      // to test after the loop the non void attributes that are split.
+      std::deque<typename CMap::Dart_handle> modified_darts;
+
+      // If i==1, we modify beta1, thus in modified_darts we store all
+      // the darts having beta0 modified, and in modified_darts2 all the
+      // darts having beta1 modified. For i>1 all the modified darts are
+      // stored in modified_darts.
+      std::deque<typename CMap::Dart_handle> modified_darts2;
+      std::deque<typename CMap::Dart_handle> &first_modified_darts=
+          (i==1?modified_darts2:modified_darts);
+
+      // For each dart of the i-cell, we modify i-links of neighbors.
+      typename std::deque<typename CMap::Dart_handle>::iterator it =
+          to_erase.begin();
+      for ( ; it!=to_erase.end(); ++it )
+      {
+        d1=amap.template beta<iinv>(*it);
+        while ( d1!=amap.null_dart_handle && amap.is_marked(d1, mark) )
+        {
+          d1=amap.template beta<i+1, iinv>(d1);
+          if ( d1==amap. template beta<iinv>(*it) ) d1=amap.null_dart_handle;
+        }
+
+        if ( !amap.is_marked(d1, mark_modified_darts) )
+        {
+          d2=amap.template beta<i+1,i>(*it);
+          while ( d2!=amap.null_dart_handle && amap.is_marked(d2, mark) )
+          {
+            d2=amap.template beta<i+1,i>(d2);
+            if ( d2==amap.template beta<i+1,i>(*it) )
+              d2=amap.null_dart_handle;
+          }
+
+          if ( !amap.is_marked(d2, mark_modified_darts) )
+          {
+            if ( d1!=amap.null_dart_handle )
+            {
+              if ( d2!=amap.null_dart_handle && d1!=d2 )
+              {
+                //d1->basic_link_beta(d2, i);
+                amap.template basic_link_beta<i>(d1, d2);
+                amap.mark(d1, mark_modified_darts);
+                amap.mark(d2, mark_modified_darts);
+                first_modified_darts.push_back(d1);
+                modified_darts.push_back(d2);
+                // TODO push only one out of two dart ?
+
+                /*if ( i==1 )
+                {
+                  d2->basic_link_beta(d1, 0);
+                  modified_darts.push_back(d2);
+                }*/
+                //            modified_darts2.push_back(d1);
+              }
+              else
+              {
+                if ( !amap.template is_free<i>(d1) )
+                {
+                  amap.template unlink_beta<i>(d1);
+                  CGAL_assertion( !amap.is_marked(d1, mark_modified_darts) );
+                  amap.mark(d1, mark_modified_darts);
+                  first_modified_darts.push_back(d1);
+                }
+              }
+            }
+            else if ( d2!=amap.null_dart_handle )
+            {
+              if ( !amap.template is_free<iinv>(d2) )
+              {
+                amap.template unlink_beta<iinv>(d2);
+                CGAL_assertion( !amap.is_marked(d2, mark_modified_darts) );
+                amap.mark(d2, mark_modified_darts);
+                modified_darts.push_back(d2);
+              }
+            }
+          }
+        }
+        if ( amap.template is_free<i+1>(*it) &&
+             !amap.template is_free<i>(*it) )
+        {
+          d1 = amap.template beta<i>(*it);
+          if ( !amap.template is_free<iinv>(d1) )
+          {
+            amap.template unlink_beta<iinv>(d1);
+            CGAL_assertion( !amap.is_marked(d1, mark_modified_darts) );
+            amap.mark(d1, mark_modified_darts);
+            modified_darts.push_back(d1);
+          }
+        }
+      }
+
+      if (amap.are_attributes_automatically_managed() && update_attributes)
+      {
+        // We test the split of all the incident cells for all the non
+        // void attributes.
+        if ( i==1 )
+          CMap::Helper::template Foreach_enabled_attributes_except
+              <CGAL::internal::Test_split_attribute_functor<CMap,i>, i>::
+              run(&amap, modified_darts, modified_darts2,
+                  mark_modified_darts);
+        else
+          CMap::Helper::template Foreach_enabled_attributes_except
+              <CGAL::internal::Test_split_attribute_functor<CMap,i>, i>::
+              run(&amap, modified_darts, mark_modified_darts);
+      }
+
+      // We remove all the darts of the i-cell.
+      for ( it=to_erase.begin(); it!=to_erase.end(); ++it )
+      { amap.erase_dart(*it); }
+
+      CGAL_assertion( amap.is_whole_map_unmarked(mark) );
+      amap.free_mark(mark);
+
+      // If no attribute is enabled (or if only i-attributes are enabled),
+      // the darts are not unmark by Foreach_enabled_attributes_except.
+      // Thus we unmark them now.
+      if ( !amap.is_whole_map_unmarked(mark_modified_darts) )
+      {
+        for ( typename std::deque<typename CMap::Dart_handle>::
+                iterator it=modified_darts.begin();
+              it!=modified_darts.end(); ++it )
+          amap.unmark(*it, mark_modified_darts);
+        if ( i==1 )
+        {
+          for ( typename std::deque<typename CMap::Dart_handle>::
+                  iterator it=modified_darts2.begin();
+                it!=modified_darts2.end(); ++it )
+            amap.unmark(*it, mark_modified_darts);
+        }
+      }
+
+      CGAL_assertion ( amap.is_whole_map_unmarked(mark_modified_darts) );
+      amap.free_mark(mark_modified_darts);
+
+#ifdef CGAL_CMAP_TEST_VALID_REMOVALS
+      CGAL_assertion( amap.is_valid() );
+#endif
+
+      return res;
+    }
+  };
+
+  /** Remove a d-cell, in a d-map (special case).
+   *  @param amap the used combinatorial map.
+   *  @param adart a dart of the volume to remove.
+   *  @param update_attributes a boolean to update the enabled attributes
+   *         (deprecated, now we use are_attributes_automatically_managed())
+   *  @return the number of deleted darts.
+   */
+  template<class CMap,unsigned int i>
+  struct Remove_cell_functor<CMap,i,0>
+  {
+    static size_t run(CMap& amap, typename CMap::Dart_handle adart,
+                      bool update_attributes)
+    {
+      typename CMap::size_type mark = amap.get_new_mark();
+      std::deque<typename CMap::Dart_handle> to_erase;
+      size_t res = 0;
+
+      std::deque<typename CMap::Dart_handle> modified_darts;
+
+      // We mark all the darts of the d-cell.
+      for ( CGAL::CMap_dart_iterator_basic_of_cell<CMap,CMap::dimension>
+            it(amap,adart,mark); it.cont(); ++it )
+      {
+        to_erase.push_back(it);
+        amap.mark(it,mark);
+        ++res;
+      }
+
+      // We unlink all the darts of the volume for beta-d.
+      typename std::deque<typename CMap::Dart_handle>::iterator
+        it = to_erase.begin();
+      for ( it = to_erase.begin(); it != to_erase.end(); ++it )
+      {
+        if ( !amap.template is_free<CMap::dimension>(*it) &&
+             !amap.is_marked(amap.template beta<CMap::dimension>(*it), mark) )
+        {
+          if (amap.are_attributes_automatically_managed() && update_attributes)
+          {
+            modified_darts.push_back(amap.template beta<CMap::dimension>(*it));
+          }
+          amap.template unlink_beta_for_involution<CMap::dimension>(*it);
+        }
+      }
+
+      if (amap.are_attributes_automatically_managed() && update_attributes)
+      {
+        // We test the split of all the incident cells for all the non
+        // void attributes.
+        CMap::Helper::template Foreach_enabled_attributes_except
+          <CGAL::internal::Test_split_attribute_functor<CMap,i>,
+           CMap::dimension>::run(&amap, modified_darts);
+      }
+
+      // We remove all the darts of the d-cell.
+      for ( it = to_erase.begin(); it != to_erase.end(); ++it )
+      { amap.erase_dart(*it); }
+
+      CGAL_assertion( amap.is_whole_map_unmarked(mark) );
+      amap.free_mark(mark);
+
+#ifdef CGAL_CMAP_TEST_VALID_REMOVALS
+      CGAL_assertion( amap.is_valid() );
+#endif
+
+      return res;
+    }
+  };
+
+  /** Remove a vertex, and merge eventually both incident edges.
+   * @param amap the used combinatorial map.
+   * @param adart a dart of the vertex to remove.
+   * @param update_attributes a boolean to update the enabled attributes
+   *        (deprecated, now we use are_attributes_automatically_managed())
+   * @return the number of deleted darts.
+   */
+  template<class CMap,unsigned int nmi>
+  struct Remove_cell_functor<CMap,0,nmi>
+  {
+    static size_t run(CMap& amap, typename CMap::Dart_handle adart,
+                      bool update_attributes)
+    {
+      CGAL_assertion( (amap.template is_removable<0>(adart)) );
+
+      size_t res = 0;
+
+      typename CMap::Dart_handle d1, d2;
+      typename CMap::Dart_handle dg1=amap.null_handle, dg2=amap.null_handle;
+
+      typename CMap::size_type mark = amap.get_new_mark();
+
+      // First we store and mark all the darts of the 0-cell to remove.
+      std::deque<typename CMap::Dart_handle> to_erase;
+      for ( CGAL::CMap_dart_iterator_basic_of_cell<CMap,0> it(amap,adart,mark);
+            it.cont(); ++it )
+      {
+        to_erase.push_back(it);
+        if ( !amap.template is_free<0>(it) && dg1==amap.null_handle )
+        { dg1=it; dg2=amap.template beta<0>(it); }
+        amap.mark(it, mark);
+        ++res;
+      }
+
+      if (amap.are_attributes_automatically_managed() && update_attributes )
+      {
+        // We group the two edges incident if they exist.
+        if ( dg1!=amap.null_handle )
+          CGAL::internal::Group_attribute_functor_run<CMap, 1>::
+              run(&amap, dg1, dg2);
+      }
+
+      // During the operation, we store in modified_darts the darts modified
+      // by beta0 to test after the loop non void attributes that are split.
+      std::deque<typename CMap::Dart_handle> modified_darts;
+      // And we store in modified_darts2 all the darts having beta1 modified.
+      std::deque<typename CMap::Dart_handle> modified_darts2;
+
+      // For each dart of the vertex, we modify 0 and 1-links of neighbors.
+      typename std::deque<typename CMap::Dart_handle>::iterator it =
+          to_erase.begin();
+      for ( ; it != to_erase.end(); ++it)
+      {
+        if ( !amap.template is_free<0>(*it) )
+        {
+          if ( !amap.template is_free<1>(*it) &&
+               amap.template beta<0>(*it)!=(*it) )
+          {
+            amap.basic_link_beta_1(amap.template beta<0>(*it),
+                                   amap.template beta<1>(*it));
+            if (amap.are_attributes_automatically_managed() && update_attributes)
+            {
+              modified_darts.push_back(amap.template beta<0>(*it));
+              modified_darts2.push_back(amap.template beta<1>(*it));
+              // TODO push only one out of two dart ?
+            }
+          }
+          else
+          {
+            amap.template dart_unlink_beta<1>(amap.template beta<0>(*it));
+            if (amap.are_attributes_automatically_managed() && update_attributes)
+            {
+              modified_darts.push_back(amap.template beta<0>(*it));
+            }
+          }
+
+          for ( unsigned int j=2; j<=CMap::dimension; ++j )
+          {
+            if ( !amap.is_free(*it,j) )
+            {
+              amap.basic_link_beta(amap.template beta<0>(*it),
+                                   amap.beta(*it,j), j);
+            //((*it)->beta(0))->basic_link_beta((*it)->beta(j),j);
+            }
+          }
+        }
+        else
+        {
+          if ( !amap.template is_free<1>(*it) )
+          {
+            amap.template dart_unlink_beta<0>(amap.template beta<1>(*it));
+            if (amap.are_attributes_automatically_managed() && update_attributes)
+            {
+              modified_darts2.push_back(amap.template beta<1>(*it));
+            }
+          }
+
+          for ( unsigned int j=2; j<=CMap::dimension; ++j )
+          {
+            if ( !amap.is_free(*it,j) )
+            { amap.unlink_beta(*it, j); }
+          }
+        }
+      }
+
+      if (amap.are_attributes_automatically_managed() && update_attributes)
+      {
+        // We test the split of all the incident cells for all the non
+        // void attributes.
+        CMap::Helper::template Foreach_enabled_attributes_except
+            <CGAL::internal::Test_split_attribute_functor<CMap,0>, 1>::
+            run(&amap,modified_darts, modified_darts2);
+      }
+
+      // We remove all the darts of the 0-cell.
+      for ( it=to_erase.begin(); it!=to_erase.end(); ++it )
+      { amap.erase_dart(*it); }
+
+      CGAL_assertion( amap.is_whole_map_unmarked(mark) );
+      amap.free_mark(mark);
+
+#ifdef CGAL_CMAP_TEST_VALID_REMOVALS
+      CGAL_assertion( amap.is_valid() );
+#endif
+
+      return res;
+    }
+  };
+
+  /** Remove an i-cell, 0<=i<=dimension.
+   * @param amap the used combinatorial map.
+   * @param adart a dart of the i-cell to remove.
+   * @param update_attributes a boolean to update the enabled attributes
+   * @return the number of deleted darts.
+   */
+#ifndef CGAL_NO_DEPRECATED_CODE
+  template < class CMap, unsigned int i >
+  CGAL_DEPRECATED size_t remove_cell(CMap& amap, typename CMap::Dart_handle adart,
+                                     bool update_attributes = true)
+  {
+    return CGAL::Remove_cell_functor<CMap,i,CMap::dimension-i>::
+      run(amap,adart,update_attributes);
+  }
+#endif // CGAL_NO_DEPRECATED_CODE
+
+  /** Test if an i-cell can be contracted.
+   *  An i-cell can be contracted if i==1
+   *     or if there are at most two (i-1)-cell incident to it.
+   * @param adart a dart of the i-cell.
+   * @return true iff the i-cell can be contracted.
+   */
+  template <class CMap, unsigned int i>
+  struct Is_contractible_functor
+  {
+    static bool run(const CMap& amap, typename CMap::Dart_const_handle adart)
+    {
+      // TODO ? Optimisation possible to not test all the darts of the cell ?
+      bool res = true;
+      for ( CGAL::CMap_dart_const_iterator_of_cell<CMap,i> it(amap, adart);
+            res && it.cont(); ++it )
+      {
+        if ( amap.template beta<i-2,i-1>(it)!=
+             amap.template beta<i-1,CGAL_BETAINV(i-2)>(it) )
+          res = false;
+      }
+      return res;
+    }
+  };
+  // Specialization for i=0
+  template <class CMap>
+  struct Is_contractible_functor<CMap, 0>
+  {
+    static bool run(const CMap&, typename CMap::Dart_const_handle)
+    { return false; }
+  };
+  // Specialization for i=1
+  template <class CMap>
+  struct Is_contractible_functor<CMap, 1>
+  {
+    static bool run(const CMap&, typename CMap::Dart_const_handle)
+    { return true; }
+  };
+  /** Test if an i-cell can be contracted.
+   *  An i-cell can be contracted if i==1
+   *     or if there are at most two (i-1)-cell incident to it.
+   * @param adart a dart of the i-cell.
+   * @return true iff the i-cell can be contracted.
+   */
+#ifndef CGAL_NO_DEPRECATED_CODE
+  template < class CMap, unsigned int i >
+  CGAL_DEPRECATED bool is_contractible(const CMap& amap, typename CMap::Dart_const_handle adart)
+  { return CGAL::Is_contractible_functor<CMap, i>::run(amap,adart); }
+#endif // CGAL_NO_DEPRECATED_CODE
+
+  /** Contract an i-cell, 1<i<=dimension, and merge eventually both incident
+   *  (i-1)-cells.
+   * @param amap the used combinatorial map.
+   * @param adart a dart of the i-cell to contract.
+   * @return the number of deleted darts.
+   */
+  template<class CMap, unsigned int i>
+  struct Contract_cell_functor
+  {
+    static size_t run(CMap& amap, typename CMap::Dart_handle adart,
+                      bool update_attributes)
+    {
+      CGAL_static_assertion ( 2<=i && i<=CMap::dimension );
+      CGAL_assertion( (amap.template is_contractible<i>(adart)) );
+
+      size_t res = 0;
+
+      typename CMap::Dart_handle d1, d2;
+      typename CMap::Dart_handle dg1=amap.null_handle, dg2=amap.null_handle;
+
+      typename CMap::size_type mark = amap.get_new_mark();
+      typename CMap::size_type mark_modified_darts = amap.get_new_mark();
+
+      const int imuinv = CGAL_BETAINV(i-1);
+
+      // First we store and mark all the darts of the i-cell to contract.
+      std::deque<typename CMap::Dart_handle> to_erase;
+      for ( CGAL::CMap_dart_iterator_basic_of_cell<CMap,i> it(amap,adart,mark);
+            it.cont(); ++it )
+      {
+        to_erase.push_back(it);
+        if ( !amap.template is_free<i-1>(it) && dg1==amap.null_handle )
+        { dg1=it; dg2=amap.template beta<i-1>(it); }
+        amap.mark(it, mark);
+        ++res;
+      }
+
+      if ( amap.are_attributes_automatically_managed() && update_attributes )
+      {
+        // We group the two (i+1)-cells incident if they exist.
+        if ( dg1!=amap.null_handle )
+          CGAL::internal::Group_attribute_functor_run<CMap,i-1>::
+            run(&amap, dg1, dg2);
+      }
+
+      // During the operation, we store in modified_darts the darts modified
+      // to test after the loop the non void attributes that are split.
+      std::deque<typename CMap::Dart_handle> modified_darts;
+
+      // For each dart of the i-cell, we modify i-links of neighbors.
+      typename std::deque<typename CMap::Dart_handle>::iterator it =
+          to_erase.begin();
+      for ( ; it!=to_erase.end(); ++it )
+      {
+        d1 = amap.template beta<i>(*it);
+        while ( d1!=amap.null_dart_handle && amap.is_marked(d1, mark) )
+        {
+          d1 = amap.template beta<imuinv,i>(d1);
+          if (d1 == amap.template beta<i>(*it)) d1 = amap.null_dart_handle;
+        }
+
+        if ( !amap.is_marked(d1, mark_modified_darts) )
+        {
+          d2 = amap.template beta<i-1,i>(*it);
+          while ( d2!=amap.null_dart_handle && amap.is_marked(d2, mark) )
+          {
+            d2 = amap.template beta<i-1,i>(d2);
+            if ( d2==amap.template beta<i-1,i>(*it) )
+              d2=amap.null_dart_handle;
+          }
+
+          if ( !amap.is_marked(d2, mark_modified_darts) )
+          {
+            if (d1 != amap.null_dart_handle)
+            {
+              if (d2 != amap.null_dart_handle && d1!=d2 )
+              {
+                amap.template basic_link_beta_for_involution<i>(d1, d2);
+                amap.mark(d1, mark_modified_darts);
+                amap.mark(d2, mark_modified_darts);
+                modified_darts.push_back(d1);
+                modified_darts.push_back(d2);
+                // TODO push only one out of two dart ?
+              }
+              else
+              {
+                if ( !amap.template is_free<i>(d1) )
+                {
+                  amap.template unlink_beta<i>(d1);
+                  CGAL_assertion( !amap.is_marked(d1, mark_modified_darts) );
+                  amap.mark(d1, mark_modified_darts);
+                  modified_darts.push_back(d1);
+                }
+              }
+            }
+            else if (d2 != amap.null_dart_handle)
+            {
+              if ( !amap.is_free(d2,i) )
+              {
+                amap.template unlink_beta<i>(d2);
+                CGAL_assertion( !amap.is_marked(d2, mark_modified_darts) );
+                amap.mark(d2, mark_modified_darts);
+                modified_darts.push_back(d2);
+              }
+            }
+          }
+        }
+        if (amap.is_free(*it,i-1) && !amap.is_free(*it,i))
+        {
+          d1 = amap.beta(*it,i);
+          if ( !amap.is_free(d1,i) )
+          {
+            amap.template unlink_beta<i>(d1);
+            CGAL_assertion( !amap.is_marked(d1, mark_modified_darts) );
+            amap.mark(d1, mark_modified_darts);
+            modified_darts.push_back(d1);
+          }
+        }
+      }
+
+      if ( amap.are_attributes_automatically_managed() && update_attributes )
+      {
+        // We test the split of all the incident cells for all the non
+        // void attributes.
+        CMap::Helper::template Foreach_enabled_attributes_except
+          <CGAL::internal::Test_split_attribute_functor<CMap,i>, i>::
+          run(&amap, modified_darts, mark_modified_darts);
+      }
+
+      // We remove all the darts of the i-cell.
+      for ( it=to_erase.begin(); it!=to_erase.end(); ++it )
+      { amap.erase_dart(*it); }
+
+      CGAL_assertion( amap.is_whole_map_unmarked(mark) );
+      amap.free_mark(mark);
+
+      // If no attribute is enabled (or if only i-attributes are enabled),
+      // the darts are not unmark by Foreach_enabled_attributes_except.
+      // Thus we unmark them now.
+      if ( !amap.is_whole_map_unmarked(mark_modified_darts) )
+      {
+        for ( typename std::deque<typename CMap::Dart_handle>::
+              iterator it=modified_darts.begin();
+              it!=modified_darts.end(); ++it )
+          amap.unmark(*it, mark_modified_darts);
+      }
+
+      CGAL_assertion ( amap.is_whole_map_unmarked(mark_modified_darts) );
+      amap.free_mark(mark_modified_darts);
+
+#ifdef CGAL_CMAP_TEST_VALID_CONTRACTIONS
+      CGAL_assertion( amap.is_valid() );
+#endif
+
+      return res;
+    }
+  };
+
+  /** Contract an edge, and merge eventually both incident vertices.
+   * @param amap the used combinatorial map.
+   * @param adart a dart of the edge to contract.
+   * @return the number of deleted darts.
+   */
+  template<class CMap>
+  struct Contract_cell_functor<CMap,1>
+  {
+    static size_t run(CMap& amap, typename CMap::Dart_handle adart,
+                      bool update_attributes)
+    {
+      CGAL_assertion( (amap.template is_contractible<1>(adart)) );
+
+      size_t res = 0;
+
+      typename CMap::Dart_handle d1, d2;
+      typename CMap::Dart_handle dg1=amap.null_handle, dg2=amap.null_handle;
+
+      typename CMap::size_type mark = amap.get_new_mark();
+
+      // First we store and mark all the darts of the 1-cell to contract.
+      std::deque<typename CMap::Dart_handle> to_erase;
+      for ( CGAL::CMap_dart_iterator_basic_of_cell<CMap,1> it(amap,adart,mark);
+            it.cont(); ++it )
+      {
+        to_erase.push_back(it);
+        if ( dg1==amap.null_handle && !amap.template is_free<0>(it) &&
+             !amap.template is_free<1>(it) )
+        { dg1=amap.template beta<0>(it); dg2=amap.template beta<1>(it); }
+        amap.mark(it, mark);
+        ++res;
+      }
+
+      if ( amap.are_attributes_automatically_managed() && update_attributes )
+      {
+        // We group the two vertices incident if they exist.
+        if ( dg1!=amap.null_handle )
+          CGAL::internal::Group_attribute_functor_run<CMap, 0, 1>::
+            run(&amap, dg1, dg2);
+      }
+
+      // During the operation, we store in modified_darts the darts modified
+      // by beta0 to test after the loop non void attributes that are split.
+      std::deque<typename CMap::Dart_handle> modified_darts;
+      // And we store in modified_darts2 all the darts having beta1 modified.
+      std::deque<typename CMap::Dart_handle> modified_darts2;
+
+      // For each dart of the cell, we modify link of neighbors.
+      typename std::deque<typename CMap::Dart_handle>::iterator it =
+        to_erase.begin();
+      for ( ; it!=to_erase.end(); ++it )
+      {
+        if ( !amap.template is_free<0>(*it) )
+        {
+          if ( !amap.template is_free<1>(*it) )
+          {
+            if ( amap.template beta<1>(*it)!=*it )
+            {
+               /*modified_darts2.push_back((*it)->template beta<0>());
+              if ( (*it)->beta(0)!=(*it)->beta(1) )*/
+              if ( amap.are_attributes_automatically_managed() && update_attributes )
+              {
+                modified_darts.push_back(amap.template beta<1>(*it));
+              }
+              amap.basic_link_beta_1(amap.template beta<0>(*it),
+                                     amap.template beta<1>(*it));
+            }
+          }
+          else
+          {
+            if ( amap.are_attributes_automatically_managed() && update_attributes )
+            {
+              modified_darts2.push_back(amap.template beta<0>(*it));
+            }
+            amap.template dart_unlink_beta<1>(amap.template beta<0>(*it));
+          }
+        }
+        else
+        {
+          if ( !amap.template is_free<1>(*it) )
+          {
+            if ( amap.are_attributes_automatically_managed() && update_attributes )
+            {
+              modified_darts.push_back(amap.template beta<1>(*it));
+            }
+            amap.template dart_unlink_beta<0>(amap.template beta<1>(*it));
+          }
+        }
+      }
+
+      // We remove all the darts of the cell.
+      for ( it=to_erase.begin(); it!=to_erase.end(); ++it )
+      { amap.erase_dart(*it); }
+
+      CGAL_assertion( amap.is_whole_map_unmarked(mark) );
+      amap.free_mark(mark);
+
+      if ( amap.are_attributes_automatically_managed() && update_attributes )
+      {
+        // We test the split of all the incident cells for all the non
+        // void attributes.
+        CMap::Helper::template Foreach_enabled_attributes_except
+          <CGAL::internal::Test_split_attribute_functor<CMap,1>, 1>::
+          run(&amap, modified_darts, modified_darts2);
+      }
+
+#ifdef CGAL_CMAP_TEST_VALID_CONTRACTIONS
+      CGAL_assertion( amap.is_valid() );
+#endif
+
+      return res;
+    }
+  };
+
+  /** Contract an i-cell, 1<=i<=dimension.
+   * @param amap the used combinatorial map.
+   * @param adart a dart of the i-cell to remove.
+   * @return the number of deleted darts.
+   */
+#ifndef CGAL_NO_DEPRECATED_CODE
+  template < class CMap, unsigned int i >
+  CGAL_DEPRECATED size_t contract_cell(CMap& amap, typename CMap::Dart_handle adart,
+                                       bool update_attributes)
+  { return CGAL::Contract_cell_functor<CMap,i>::run(amap,adart, update_attributes); }
+#endif // CGAL_NO_DEPRECATED_CODE
+
+} // namespace CGAL
+
+#endif // CGAL_COMBINATORIAL_MAP_OPERATIONS_H //
+// EOF //
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Combinatorial_map_save_load.h b/3rdparty/CGAL/include/CGAL/Combinatorial_map_save_load.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Combinatorial_map_save_load.h
rename to 3rdparty/CGAL/include/CGAL/Combinatorial_map_save_load.h
diff --git a/3rdparty/CGAL/include/CGAL/Combinatorial_map_storages.h b/3rdparty/CGAL/include/CGAL/Combinatorial_map_storages.h
new file mode 100644
index 0000000..d513b81
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Combinatorial_map_storages.h
@@ -0,0 +1,391 @@
+// Copyright (c) 2013 CNRS and LIRIS' Establishments (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Guillaume Damiand <guillaume.damiand at liris.cnrs.fr>
+//
+#ifndef CGAL_COMBINATORIAL_MAP_STORAGES_H
+#define CGAL_COMBINATORIAL_MAP_STORAGES_H 1
+
+#include <CGAL/Handle_hash_function.h>
+
+#include <CGAL/Compact_container.h>
+
+#include <boost/config.hpp>
+#if  (BOOST_GCC >= 40900)
+_Pragma("GCC diagnostic push")
+_Pragma("GCC diagnostic ignored \"-Warray-bounds\"")
+#endif
+
+namespace CGAL {
+
+  /** @file Combinatorial_map_storages.h
+   * Definition of storages for dD Combinatorial map.
+   */
+
+  struct Index_hash_function {
+    typedef std::size_t result_type;
+    template <class H>
+    std::size_t operator() (const H& h) const {
+      return h;
+    }
+  };
+
+  // Storage of darts with compact container, beta with handles
+  template<unsigned int d_, class Items_, class Alloc_ >
+  class Combinatorial_map_storage_1
+  {
+  public:
+    typedef Combinatorial_map_storage_1<d_, Items_, Alloc_> Self;
+    typedef CGAL::Tag_false Use_index;
+
+    typedef internal::Combinatorial_map_helper<Self> Helper;
+
+    typedef typename Items_::template Dart_wrapper<Self>  Dart_wrapper;
+    typedef typename Dart_wrapper::Dart                   Dart;
+    typedef typename Alloc_::template rebind<Dart>::other Dart_allocator;
+
+    typedef Compact_container<Dart,Dart_allocator>  Dart_container;
+
+    typedef typename Dart_container::iterator       Dart_handle;
+    typedef typename Dart_container::const_iterator Dart_const_handle;
+    typedef typename Dart_container::size_type      size_type;
+
+    typedef CGAL::Void* Null_handle_type;
+    static const Null_handle_type null_handle;
+
+    typedef Items_ Items;
+    typedef Alloc_ Alloc;
+
+    template <typename T>
+    struct Container_for_attributes :
+        public Compact_container<T, typename Alloc_::template rebind<T>::other>
+    {};
+
+    /// Typedef for attributes
+    typedef typename Dart_wrapper::Attributes Attributes;
+
+    template<int i>
+    struct Attribute_type: public Helper::template Attribute_type<i>
+    {};
+    template<int i>
+    struct Attribute_handle: public Helper::template Attribute_handle<i>
+    {};
+    template<int i>
+    struct Attribute_const_handle:
+      public Helper::template Attribute_const_handle<i>
+    {};
+    template<int i>
+    struct Attribute_range: public Helper::template Attribute_range<i>
+    {};
+    template<int i>
+    struct Attribute_const_range:
+      public Helper::template Attribute_const_range<i>
+    {};
+
+    /// Number of marks
+    static const size_type NB_MARKS = 32;
+
+    /// The dimension of the combinatorial map.
+    static const unsigned int dimension = d_;
+
+    typedef Handle_hash_function Hash_function;
+
+    // Init
+    void init_storage()
+    {
+      // emplace null_dart; initialized in Combinatorial_map class
+      null_dart_handle = mnull_dart_container.emplace();
+    }
+
+   /** Return if this dart is free for adimension.
+     * @param dh a dart handle
+     * @param i the dimension.
+     * @return true iff dh is linked with NULL for \em adimension.
+     */
+    template<unsigned int i>
+    bool is_free(Dart_const_handle dh) const
+    {
+      CGAL_assertion( dh!=NULL );
+      CGAL_assertion(i <= dimension);
+      return dh->mbeta[i]==null_dart_handle;
+    }
+    bool is_free(Dart_const_handle dh, unsigned int i) const
+    {
+      CGAL_assertion( dh!=NULL );
+      CGAL_assertion(i <= dimension);
+      return dh->mbeta[i]==null_dart_handle;
+    }
+
+    /// Set simultaneously all the marks of this dart to a given value.
+    void set_dart_marks(Dart_const_handle ADart,
+                        const std::bitset<NB_MARKS>& amarks) const
+    {
+      CGAL_assertion( ADart!=NULL );
+      ADart->set_marks(amarks);
+    }
+    /// Return all the marks of a dart.
+    std::bitset<NB_MARKS> get_dart_marks(Dart_const_handle ADart) const
+    {
+      CGAL_assertion( ADart!=NULL );
+      return ADart->get_marks();
+    }
+    /// Return the mark value of dart a given mark number.
+    bool get_dart_mark(Dart_const_handle ADart, size_type amark) const
+    {
+      CGAL_assertion( ADart!=NULL );
+      return ADart->get_mark(amark);
+    }
+
+    /// Set the mark of a given mark number to a given value.
+    void set_dart_mark(Dart_const_handle ADart, size_type amark, bool avalue) const
+    {
+      CGAL_assertion( ADart!=NULL );
+      ADart->set_mark(amark, avalue);
+    }
+
+    /// Flip the mark of a given mark number to a given value.
+    void flip_dart_mark(Dart_const_handle ADart, size_type amark) const
+    {
+      CGAL_assertion( ADart!=NULL );
+      ADart->flip_mark(amark);
+    }
+
+    // Access to beta maps
+    Dart_handle get_beta(Dart_handle ADart, int B1)
+    {
+      CGAL_assertion(ADart!=NULL && B1>=0 && B1<=(int)dimension);
+      return ADart->mbeta[B1];
+    }
+    Dart_const_handle get_beta(Dart_const_handle ADart, int B1) const
+    {
+      CGAL_assertion(ADart!=NULL && B1>=0 && B1<=(int)dimension);
+      return  ADart->mbeta[B1];
+    }
+    template<int B1>
+    Dart_handle get_beta(Dart_handle ADart)
+    {
+      CGAL_assertion(ADart!=NULL && B1>=0 && B1<=(int)dimension);
+      return  ADart->mbeta[B1];
+    }
+    template<int B1>
+    Dart_const_handle get_beta(Dart_const_handle ADart) const
+    {
+      CGAL_assertion(ADart!=NULL && B1>=0 && B1<=(int)dimension);
+      return  ADart->mbeta[B1];
+    }
+
+    // return a handle on the i-attribute
+    template<unsigned int i>
+    typename Attribute_handle<i>::type attribute(Dart_handle ADart)
+    {
+      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
+                     "attribute<i> called but i-attributes are disabled.");
+      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
+        (ADart->mattribute_handles);
+    }
+    template<unsigned int i>
+    typename Attribute_const_handle<i>::type
+    attribute(Dart_const_handle ADart) const
+    {
+      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
+                     "attribute<i> called but i-attributes are disabled.");
+      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
+        (ADart->mattribute_handles);
+    }
+
+    // get the attribute given its handle
+    template<unsigned int i>
+    typename Attribute_type<i>::type&
+    get_attribute(typename Attribute_handle<i>::type ah)
+    {
+      CGAL_assertion( ah!=NULL );
+      return *ah;
+    }
+    template<unsigned int i>
+    const typename Attribute_type<i>::type&
+    get_attribute(typename Attribute_const_handle<i>::type ah) const
+    {
+      CGAL_assertion( ah!=NULL );
+      return *ah;
+    }
+
+    Dart & get_dart(Dart_handle ah)
+    {
+      CGAL_assertion( ah!=NULL );
+      return *ah;
+    }
+    const Dart & get_dart(Dart_const_handle ah) const
+    {
+      CGAL_assertion( ah!=NULL );
+      return *ah;
+    }
+
+    // Get the dart of the given attribute
+    template<unsigned int i>
+    Dart_handle dart_of_attribute(typename Attribute_handle<i>::type ah)
+    {
+      CGAL_assertion( ah!=NULL );
+      return ah->dart();
+    }
+    template<unsigned int i>
+    Dart_const_handle
+    dart_of_attribute(typename Attribute_const_handle<i>::type ah) const
+    {
+      CGAL_assertion( ah!=NULL );
+      return ah->dart();
+    }
+
+    // Set the dart of the given attribute
+    template<unsigned int i>
+    void set_dart_of_attribute(typename Attribute_handle<i>::type ah,
+                               Dart_handle adart)
+    {
+      CGAL_assertion( ah!=NULL );
+      ah->set_dart(adart);
+    }
+
+    // Get the info of the given attribute
+    template<unsigned int i>
+    typename Attribute_type<i>::type::Info &
+    info_of_attribute(typename Attribute_handle<i>::type ah)
+    {
+      CGAL_assertion( ah!=NULL );
+      return ah->info();
+    }
+    template<unsigned int i>
+    const typename Attribute_type<i>::type::Info &
+    info_of_attribute(typename Attribute_const_handle<i>::type ah) const
+    {
+      CGAL_assertion( ah!=NULL );
+      return ah->info();
+    }
+
+    // Get the info of the i-cell attribute associated with the given dart
+    template<unsigned int i>
+    typename Attribute_type<i>::type::Info & info(Dart_handle adart)
+    {
+      CGAL_assertion( adart!=NULL );
+      CGAL_assertion( attribute<i>(adart)!=NULL );
+      return info_of_attribute<i>(attribute<i>(adart));
+    }
+    template<unsigned int i>
+    const typename Attribute_type<i>::type::Info &
+    info(Dart_const_handle adart) const
+    {
+      CGAL_assertion( adart!=NULL );
+      CGAL_assertion( attribute<i>(adart)!=NULL );
+      return info_of_attribute<i>(attribute<i>(adart));
+    }
+
+    // Get the dart of the i-cell attribute associated with the given dart
+    template<unsigned int i>
+    Dart_handle & dart(Dart_handle adart)
+    {
+      CGAL_assertion( adart!=NULL );
+      CGAL_assertion( attribute<i>(adart)!=NULL );
+      return dart_of_attribute<i>(attribute<i>(adart));
+    }
+    template<unsigned int i>
+    Dart_const_handle dart(Dart_const_handle adart) const
+    {
+      CGAL_assertion( adart!=NULL );
+      CGAL_assertion( attribute<i>(adart)!=NULL );
+      return dart_of_attribute<i>(attribute<i>(adart));
+    }
+
+    void display_dart(Dart_const_handle ADart) const
+    { std::cout<<&*ADart; }
+
+    template<unsigned int i>
+    void display_attribute(typename Attribute_const_handle<i>::type ah) const
+    { std::cout<<&*ah; }
+
+  protected:
+    // Set the handle on the i th attribute
+    template<unsigned int i>
+    void basic_set_dart_attribute(Dart_handle dh,
+                                  typename Attribute_handle<i>::type ah)
+    {
+      CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
+        (dh->mattribute_handles) = ah;
+    }
+
+    /** Link a dart with a given dart for a given dimension.
+     * @param adart the dart to link.
+     * @param adart2 the dart to link with.
+     * @param i the dimension.
+     */
+    template<unsigned int i>
+    void dart_link_beta(Dart_handle adart, Dart_handle adart2)
+    {
+      CGAL_assertion(i <= dimension);
+      CGAL_assertion(adart!=NULL && adart2!=NULL);
+      CGAL_assertion(adart!=null_dart_handle);
+      adart->mbeta[i] = adart2;
+    }
+    void dart_link_beta(Dart_handle adart, Dart_handle adart2, unsigned int i)
+    {
+      CGAL_assertion(i <= dimension);
+      CGAL_assertion(adart!=NULL && adart2!=NULL);
+      CGAL_assertion(adart!=null_dart_handle);
+      adart->mbeta[i] = adart2;
+    }
+
+    /** Unlink a dart for a given dimension.
+     * @param adart a dart.
+     * @param i the dimension.
+     */
+    template<unsigned int i>
+    void dart_unlink_beta(Dart_handle adart)
+    {
+      CGAL_assertion(adart!=NULL && i <= dimension);
+      adart->mbeta[i] = null_dart_handle;
+    }
+    void dart_unlink_beta(Dart_handle adart, unsigned int i)
+    {
+      CGAL_assertion(adart!=NULL && i <= dimension);
+      adart->mbeta[i] = null_dart_handle;
+    }
+
+  public:
+    /// Void dart. A dart d is i-free if beta_i(d)=null_dart_handle.
+    Dart_handle null_dart_handle; // Todo Dart_const_handle ??
+
+  protected:
+    /// Dart container.
+    Dart_container mdarts;
+
+    /// Container for the null_dart_handle, static data member.
+    Dart_container mnull_dart_container;
+
+    /// Tuple of attributes containers
+    typename Helper::Attribute_containers mattribute_containers;
+  };
+
+  /// null_handle
+  template < unsigned int d_, class Items_, class Alloc_ >
+  const typename Combinatorial_map_storage_1<d_, Items_, Alloc_>::Null_handle_type
+  Combinatorial_map_storage_1<d_, Items_, Alloc_>::null_handle = NULL;
+
+} // namespace CGAL
+
+#if  (BOOST_GCC >= 40900)
+ _Pragma("GCC diagnostic pop")
+#endif
+
+#endif // CGAL_COMBINATORIAL_MAP_STORAGES_H //
+// EOF //
diff --git a/3rdparty/CGAL/include/CGAL/Compact_container.h b/3rdparty/CGAL/include/CGAL/Compact_container.h
new file mode 100644
index 0000000..3152f04
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Compact_container.h
@@ -0,0 +1,1208 @@
+// Copyright (c) 2003,2004,2007-2010  INRIA Sophia-Antipolis (France).
+// Copyright (c) 2014  GeometryFactory Sarl (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(s)     : Sylvain Pion
+
+#ifndef CGAL_COMPACT_CONTAINER_H
+#define CGAL_COMPACT_CONTAINER_H
+
+#include <CGAL/basic.h>
+#include <CGAL/Default.h>
+
+#include <iterator>
+#include <algorithm>
+#include <vector>
+#include <cstring>
+#include <functional>
+
+#include <CGAL/memory.h>
+#include <CGAL/iterator.h>
+#include <CGAL/CC_safe_handle.h>
+#include <CGAL/Time_stamper.h>
+
+#include <boost/mpl/if.hpp>
+
+// An STL like container with the following properties :
+// - to achieve compactness, it requires access to a pointer stored in T,
+//   specified by a traits.  This pointer is supposed to be 4 bytes aligned
+//   when the object is alive, otherwise, the container uses the 2 least
+//   significant bits to store information in the pointer.
+// - Ts are allocated in arrays of increasing size, which are linked together
+//   by their first and last element.
+// - the iterator looks at the famous 2 bits to know if it has to deal with
+//   a free/used/boundary element.
+
+// TODO :
+// - Add .resize() (and proper copy of capacity_).
+// - Add preconditions in input that real pointers need to have clean bits.
+//   Also for the allocated memory alignment, and sizeof().
+// - Do a benchmark before/after.
+// - Check the end result with Valgrind.
+// - The bit squatting mechanism will be reused for the conflict flag, maybe
+//   it could be put out of the class.
+
+// TODO low priority :
+// - rebind<> the allocator
+// - Exception safety guarantees
+// - Thread safety guarantees
+// - std requirements on iterators says all defined operations are constant
+//   time amortized (it's not true here, maybe it could be with some work...)
+// - all this is expected especially when there are not so many free objects
+//   compared to the allocated elements.
+// - Should block_size be selectable/hintable by .reserve() ?
+// - would be nice to have a temporary_free_list (still active elements, but
+//   which are going to be freed soon).  Probably it prevents compactness.
+// - eventually something to copy this data structure, providing a way to
+//   update the pointers (give access to a hash_map, at least a function that
+//   converts an old pointer to the new one ?).  Actually it doesn't have to
+//   be stuck to a particular DS, because for a list it's useful too...
+// - Currently, end() can be invalidated on insert() if a new block is added.
+//   It would be nice to fix this.  We could insert the new block at the
+//   beginning instead ?  That would drop the property that iterator order
+//   is preserved.  Maybe it's not a problem if end() is not preserved, after
+//   all nothing is going to dereference it, it's just for comparing with
+//   end() that it can be a problem.
+//   Another way would be to have end() point to the end of an always
+//   empty block (containing no usable element), and insert new blocks just
+//   before this one.
+//   Instead of having the blocks linked between them, the start/end pointers
+//   could point back to the container, so that we can do more interesting
+//   things (e.g. freeing empty blocks automatically) ?
+
+namespace CGAL {
+
+#define CGAL_GENERATE_MEMBER_DETECTOR(X)                                             \
+template<typename T> class has_##X {                                          \
+    struct Fallback { int X; };                                               \
+    struct Derived : T, Fallback { };                                         \
+                                                                              \
+    template<typename U, U> struct Check;                                     \
+                                                                              \
+    typedef char ArrayOfOne[1];                                               \
+    typedef char ArrayOfTwo[2];                                               \
+                                                                              \
+    template<typename U> static ArrayOfOne & func(                            \
+                                            Check<int Fallback::*, &U::X> *); \
+    template<typename U> static ArrayOfTwo & func(...);                       \
+  public:                                                                     \
+    typedef has_##X type;                                                     \
+    enum { value = sizeof(func<Derived>(0)) == 2 };                           \
+} // semicolon is after the macro call
+
+#define CGAL_INIT_COMPACT_CONTAINER_BLOCK_SIZE 14
+#define CGAL_INCREMENT_COMPACT_CONTAINER_BLOCK_SIZE 16
+
+template<unsigned int first_block_size_, unsigned int block_size_increment>
+struct Addition_size_policy
+{
+  static const unsigned int first_block_size = first_block_size_;
+
+  template<typename Compact_container>
+  static void increase_size(Compact_container& cc)
+  { cc.block_size += block_size_increment; }
+
+  template<typename Compact_container>
+  static void get_index_and_block(typename Compact_container::size_type i,
+                                  typename Compact_container::size_type& index,
+                                  typename Compact_container::size_type& block)
+  {
+    typedef typename Compact_container::size_type ST;
+    const ST TWO_M_N = 2*first_block_size_ - block_size_increment;
+    ST delta = TWO_M_N*TWO_M_N + 8*block_size_increment*i;
+    block= (static_cast<ST>(std::sqrt(static_cast<double>(delta))) - TWO_M_N)
+      / (2*block_size_increment);
+
+    if ( block==0 )
+    { index = i + 1; }
+    else
+    {
+      const typename Compact_container::size_type first_element_in_block =
+        block*(first_block_size_+ (block_size_increment*(block - 1))/2);
+
+      index=i - first_element_in_block + 1;
+    }
+  }
+};
+
+template<unsigned int k>
+struct Constant_size_policy
+{
+  static const unsigned int first_block_size = k;
+
+  template<typename Compact_container>
+  static void increase_size(Compact_container& /*cc*/)
+  {}
+
+  template<typename Compact_container>
+  static void get_index_and_block(typename Compact_container::size_type i,
+                                  typename Compact_container::size_type& index,
+                                  typename Compact_container::size_type& block)
+  {
+    block=i/k;
+    index=(i%k)+1;
+  }
+};
+
+// The following base class can be used to easily add a squattable pointer
+// to a class (maybe you loose a bit of compactness though).
+// TODO : Shouldn't adding these bits be done automatically and transparently,
+//        based on the traits class info ?
+class Compact_container_base
+{
+  void * p;
+public:
+  Compact_container_base()
+  : p(NULL) {}
+  void *   for_compact_container() const { return p; }
+  void * & for_compact_container()       { return p; }
+};
+
+// The traits class describes the way to access the pointer.
+// It can be specialized.
+template < class T >
+struct Compact_container_traits {
+  static void *   pointer(const T &t) { return t.for_compact_container(); }
+  static void * & pointer(T &t)       { return t.for_compact_container(); }
+};
+
+namespace internal {
+  template < class DSC, bool Const >
+  class CC_iterator;
+
+  CGAL_GENERATE_MEMBER_DETECTOR(increment_erase_counter);
+
+  // A basic "no erase counter" strategy
+  template <bool Has_erase_counter_tag>
+  class Erase_counter_strategy {
+  public:
+    // Do nothing
+    template <typename Element>
+    static unsigned int erase_counter(const Element &) { return 0; }
+    template <typename Element>
+    static void set_erase_counter(Element &, unsigned int) {}
+    template <typename Element>
+    static void increment_erase_counter(Element &) {}
+  };
+
+
+  // A strategy managing an internal counter
+  template <>
+  class Erase_counter_strategy<true>
+  {
+  public:
+    template <typename Element>
+    static unsigned int erase_counter(const Element &e)
+    {
+      return e.erase_counter();
+    }
+
+    template <typename Element>
+    static void set_erase_counter(Element &e, unsigned int c)
+    {
+      e.set_erase_counter(c);
+    }
+
+    template <typename Element>
+    static void increment_erase_counter(Element &e)
+    {
+      e.increment_erase_counter();
+    }
+  };
+}
+
+template < class T,
+           class Allocator_ = Default,
+           class Increment_policy_ = Default,
+           class TimeStamper_ = Default >
+class Compact_container
+{
+  typedef Allocator_                                Al;
+  typedef typename Default::Get< Al, CGAL_ALLOCATOR(T) >::type Allocator;
+  typedef Increment_policy_                         Ip;
+  typedef typename Default::Get< Ip, 
+            Addition_size_policy<CGAL_INIT_COMPACT_CONTAINER_BLOCK_SIZE,
+                             CGAL_INCREMENT_COMPACT_CONTAINER_BLOCK_SIZE> 
+          >::type                                   Increment_policy;
+  typedef TimeStamper_                              Ts;
+  typedef Compact_container <T, Al, Ip, Ts>         Self;
+  typedef Compact_container_traits <T>              Traits;
+public:
+  typedef typename Default::Get< TimeStamper_,
+                                 CGAL::Time_stamper_impl<T> >::type
+                                                    Time_stamper_impl;
+
+  typedef T                                         value_type;
+  typedef Allocator                                 allocator_type;
+  typedef typename Allocator::reference             reference;
+  typedef typename Allocator::const_reference       const_reference;
+  typedef typename Allocator::pointer               pointer;
+  typedef typename Allocator::const_pointer         const_pointer;
+  typedef typename Allocator::size_type             size_type;
+  typedef typename Allocator::difference_type       difference_type;
+  typedef internal::CC_iterator<Self, false> iterator;
+  typedef internal::CC_iterator<Self, true>  const_iterator;
+  typedef std::reverse_iterator<iterator>           reverse_iterator;
+  typedef std::reverse_iterator<const_iterator>     const_reverse_iterator;
+
+  friend class internal::CC_iterator<Self, false>;
+  friend class internal::CC_iterator<Self, true>;
+
+  template<unsigned int first_block_size_, unsigned int block_size_increment>
+    friend struct Addition_size_policy;
+  template<unsigned int k> friend struct Constant_size_policy;
+
+  explicit Compact_container(const Allocator &a = Allocator())
+  : alloc(a)
+  , time_stamper(new Time_stamper_impl())
+  {
+    init ();
+  }
+
+  template < class InputIterator >
+  Compact_container(InputIterator first, InputIterator last,
+                    const Allocator & a = Allocator())
+  : alloc(a)
+  , time_stamper(new Time_stamper_impl())
+  {
+    init();
+    std::copy(first, last, CGAL::inserter(*this));
+  }
+
+  // The copy constructor and assignment operator preserve the iterator order
+  Compact_container(const Compact_container &c)
+  : alloc(c.get_allocator())
+  , time_stamper(new Time_stamper_impl())
+  {
+    init();
+    block_size = c.block_size;
+    *time_stamper = *c.time_stamper;
+    std::copy(c.begin(), c.end(), CGAL::inserter(*this));
+  }
+
+  Compact_container & operator=(const Compact_container &c)
+  {
+    if (&c != this) {
+      Self tmp(c);
+      swap(tmp);
+    }
+    return *this;
+  }
+
+  ~Compact_container()
+  {
+    clear();
+    delete time_stamper;
+  }
+
+  bool is_used(const_iterator ptr) const
+  {
+    return (type(&*ptr)==USED);
+  }
+
+  bool is_used(size_type i) const
+  {
+    typename Self::size_type block_number, index_in_block;
+    Increment_policy::template get_index_and_block<Self>(i,
+                                                         index_in_block,
+                                                         block_number);
+    return (type(&all_items[block_number].first[index_in_block])
+                 == USED);
+  }
+
+  const T& operator[] (size_type i) const
+  {
+    CGAL_assertion( is_used(i) );
+
+    typename Self::size_type block_number, index_in_block;
+    Increment_policy::template get_index_and_block<Self>(i,
+                                                         index_in_block,
+                                                         block_number);
+    return all_items[block_number].first[index_in_block];
+  }
+
+  T& operator[] (size_type i)
+  {
+    CGAL_assertion( is_used(i) );
+
+    typename Self::size_type block_number, index_in_block;
+    Increment_policy::template get_index_and_block<Self>(i,
+                                                         index_in_block,
+                                                         block_number);
+    return all_items[block_number].first[index_in_block];
+  }
+
+  void swap(Self &c)
+  {
+    std::swap(alloc, c.alloc);
+    std::swap(capacity_, c.capacity_);
+    std::swap(size_, c.size_);
+    std::swap(block_size, c.block_size);
+    std::swap(first_item, c.first_item);
+    std::swap(last_item, c.last_item);
+    std::swap(free_list, c.free_list);
+    all_items.swap(c.all_items);
+    std::swap(time_stamper, c.time_stamper);
+  }
+
+  iterator begin() { return iterator(first_item, 0, 0); }
+  iterator end()   { return iterator(last_item, 0); }
+
+  const_iterator begin() const { return const_iterator(first_item, 0, 0); }
+  const_iterator end()   const { return const_iterator(last_item, 0); }
+
+  reverse_iterator rbegin() { return reverse_iterator(end()); }
+  reverse_iterator rend()   { return reverse_iterator(begin()); }
+
+  const_reverse_iterator
+  rbegin() const { return const_reverse_iterator(end()); }
+  const_reverse_iterator
+  rend()   const { return const_reverse_iterator(begin()); }
+
+  // Boost.Intrusive interface
+  iterator iterator_to(reference value) const {
+    return iterator(&value, 0);
+  }
+  const_iterator iterator_to(const_reference value) const {
+    return const_iterator(&value, 0);
+  }
+  static iterator s_iterator_to(reference value) {
+    return iterator(&value, 0);
+  }
+  static const_iterator s_iterator_to(const_reference value) {
+    return const_iterator(&value, 0);
+  }
+
+  // Special insert methods that construct the objects in place
+  // (just forward the arguments to the constructor, to optimize a copy).
+#ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
+  template < typename... Args >
+  iterator
+  emplace(const Args&... args)
+  {
+    if (free_list == NULL)
+      allocate_new_block();
+
+    pointer ret = free_list;
+    free_list = clean_pointee(ret);
+    new (ret) value_type(args...);
+    CGAL_assertion(type(ret) == USED);
+    ++size_;
+    time_stamper->set_time_stamp(ret);
+    return iterator(ret, 0);
+  }
+#else
+  // inserts a default constructed item.
+  iterator emplace()
+  {
+    if (free_list == NULL)
+      allocate_new_block();
+
+    pointer ret = free_list;
+    free_list = clean_pointee(ret);
+    new (ret) value_type();
+    CGAL_assertion(type(ret) == USED);
+    ++size_;
+    time_stamper->set_time_stamp(ret);
+    return iterator(ret, 0);
+  }
+
+  template < typename T1 >
+  iterator
+  emplace(const T1 &t1)
+  {
+    if (free_list == NULL)
+      allocate_new_block();
+
+    pointer ret = free_list;
+    free_list = clean_pointee(ret);
+    new (ret) value_type(t1);
+    CGAL_assertion(type(ret) == USED);
+    ++size_;
+    time_stamper->set_time_stamp(ret);
+    return iterator(ret, 0);
+  }
+
+  template < typename T1, typename T2 >
+  iterator
+  emplace(const T1 &t1, const T2 &t2)
+  {
+    if (free_list == NULL)
+      allocate_new_block();
+
+    pointer ret = free_list;
+    free_list = clean_pointee(ret);
+    new (ret) value_type(t1, t2);
+    CGAL_assertion(type(ret) == USED);
+    ++size_;
+    time_stamper->set_time_stamp(ret);
+    return iterator(ret, 0);
+  }
+
+  template < typename T1, typename T2, typename T3 >
+  iterator
+  emplace(const T1 &t1, const T2 &t2, const T3 &t3)
+  {
+    if (free_list == NULL)
+      allocate_new_block();
+
+    pointer ret = free_list;
+    free_list = clean_pointee(ret);
+    new (ret) value_type(t1, t2, t3);
+    CGAL_assertion(type(ret) == USED);
+    ++size_;
+    time_stamper->set_time_stamp(ret);
+    return iterator(ret, 0);
+  }
+
+  template < typename T1, typename T2, typename T3, typename T4 >
+  iterator
+  emplace(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4)
+  {
+    if (free_list == NULL)
+      allocate_new_block();
+
+    pointer ret = free_list;
+    free_list = clean_pointee(ret);
+    new (ret) value_type(t1, t2, t3, t4);
+    CGAL_assertion(type(ret) == USED);
+    ++size_;
+    time_stamper->set_time_stamp(ret);
+    return iterator(ret, 0);
+  }
+
+  template < typename T1, typename T2, typename T3, typename T4, typename T5 >
+  iterator
+  emplace(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4,
+          const T5 &t5)
+  {
+    if (free_list == NULL)
+      allocate_new_block();
+
+    pointer ret = free_list;
+    free_list = clean_pointee(ret);
+    new (ret) value_type(t1, t2, t3, t4, t5);
+    CGAL_assertion(type(ret) == USED);
+    ++size_;
+    time_stamper->set_time_stamp(ret);
+    return iterator(ret, 0);
+  }
+
+  template < typename T1, typename T2, typename T3, typename T4,
+             typename T5, typename T6 >
+  iterator
+  emplace(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4,
+          const T5 &t5, const T6 &t6)
+  {
+    if (free_list == NULL)
+      allocate_new_block();
+
+    pointer ret = free_list;
+    free_list = clean_pointee(ret);
+    new (ret) value_type(t1, t2, t3, t4, t5, t6);
+    CGAL_assertion(type(ret) == USED);
+    ++size_;
+    time_stamper->set_time_stamp(ret);
+    return iterator(ret, 0);
+  }
+
+  template < typename T1, typename T2, typename T3, typename T4,
+             typename T5, typename T6, typename T7 >
+  iterator
+  emplace(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4,
+          const T5 &t5, const T6 &t6, const T7 &t7)
+  {
+    if (free_list == NULL)
+      allocate_new_block();
+
+    pointer ret = free_list;
+    free_list = clean_pointee(ret);
+    new (ret) value_type(t1, t2, t3, t4, t5, t6, t7);
+    CGAL_assertion(type(ret) == USED);
+    ++size_;
+    time_stamper->set_time_stamp(ret);
+    return iterator(ret, 0);
+  }
+
+  template < typename T1, typename T2, typename T3, typename T4,
+             typename T5, typename T6, typename T7, typename T8 >
+  iterator
+  emplace(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4,
+          const T5 &t5, const T6 &t6, const T7 &t7, const T8 &t8)
+  {
+    if (free_list == NULL)
+      allocate_new_block();
+
+    pointer ret = free_list;
+    free_list = clean_pointee(ret);
+    new (ret) value_type(t1, t2, t3, t4, t5, t6, t7, t8);
+    CGAL_assertion(type(ret) == USED);
+    ++size_;
+    time_stamper->set_time_stamp(ret);
+    return iterator(ret, 0);
+  }
+#endif // CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
+
+  iterator insert(const T &t)
+  {
+    if (free_list == NULL)
+      allocate_new_block();
+
+    pointer ret = free_list;
+    free_list = clean_pointee(ret);
+    alloc.construct(ret, t);
+    CGAL_assertion(type(ret) == USED);
+    ++size_;
+    time_stamper->set_time_stamp(ret);
+    return iterator(ret, 0);
+  }
+
+  template < class InputIterator >
+  void insert(InputIterator first, InputIterator last)
+  {
+    for (; first != last; ++first)
+      insert(*first);
+  }
+
+  template < class InputIterator >
+  void assign(InputIterator first, InputIterator last)
+  {
+    clear(); // erase(begin(), end()); // ?
+    insert(first, last);
+  }
+
+  void erase(iterator x)
+  {
+    typedef internal::Erase_counter_strategy<
+      internal::has_increment_erase_counter<T>::value> EraseCounterStrategy;
+
+    CGAL_precondition(type(&*x) == USED);
+    EraseCounterStrategy::increment_erase_counter(*x);
+    alloc.destroy(&*x);
+/*#ifndef CGAL_NO_ASSERTIONS
+    std::memset(&*x, 0, sizeof(T));
+#endif*/
+    put_on_free_list(&*x);
+    --size_;
+  }
+
+  void erase(iterator first, iterator last) {
+    while (first != last)
+      erase(first++);
+  }
+
+  void clear();
+
+  // Merge the content of d into *this.  d gets cleared.
+  // The complexity is O(size(free list = capacity-size)).
+  void merge(Self &d);
+
+  size_type size() const
+  {
+    CGAL_expensive_assertion(size_ ==
+                             (size_type) std::distance(begin(), end()));
+    return size_;
+  }
+
+  size_type max_size() const
+  {
+    return alloc.max_size();
+  }
+
+  size_type capacity() const
+  {
+    return capacity_;
+  }
+
+  // void resize(size_type sz, T c = T()); // TODO  makes sense ???
+
+  bool empty() const
+  {
+    return size_ == 0;
+  }
+
+  allocator_type get_allocator() const
+  {
+    return alloc;
+  }
+
+  // Returns whether the iterator "cit" is in the range [begin(), end()].
+  // Complexity : O(#blocks) = O(sqrt(capacity())).
+  // This function is mostly useful for purposes of efficient debugging at
+  // higher levels.
+  bool owns(const_iterator cit) const
+  {
+    // We use the block structure to provide an efficient version :
+    // we check if the address is in the range of each block,
+    // and then test whether it is valid (not a free element).
+
+    if (cit == end())
+      return true;
+
+    const_pointer c = &*cit;
+
+    for (typename All_items::const_iterator it = all_items.begin(), itend = all_items.end();
+         it != itend; ++it) {
+      const_pointer p = it->first;
+      size_type s = it->second;
+
+      // Are we in the address range of this block (excluding first and last
+      // elements) ?
+      if (c <= p || (p+s-1) <= c)
+        continue;
+
+      CGAL_assertion_msg( (c-p)+p == c, "wrong alignment of iterator");
+
+      return type(c) == USED;
+    }
+    return false;
+  }
+
+  bool owns_dereferencable(const_iterator cit) const
+  {
+    return cit != end() && owns(cit);
+  }
+
+  /** Reserve method to ensure that the capacity of the Compact_container be
+   * greater or equal than a given value n.
+   */
+  void reserve(size_type n)
+  {
+    if ( capacity_>=n ) return;
+
+    size_type lastblock = all_items.size();
+
+    while ( capacity_<n )
+    { // Pb because the order of free list is no more the order of
+      // allocate_new_block();
+      pointer new_block = alloc.allocate(block_size + 2);
+      all_items.push_back(std::make_pair(new_block, block_size + 2));
+      capacity_ += block_size;
+      // We insert this new block at the end.
+      if (last_item == NULL) // First time
+      {
+        first_item = new_block;
+        last_item  = new_block + block_size + 1;
+        set_type(first_item, NULL, START_END);
+      }
+      else
+      {
+        set_type(last_item, new_block, BLOCK_BOUNDARY);
+        set_type(new_block, last_item, BLOCK_BOUNDARY);
+        last_item = new_block + block_size + 1;
+      }
+      set_type(last_item, NULL, START_END);
+      // Increase the block_size for the next time.
+      Increment_policy::increase_size(*this);
+    }
+
+    // Now we put all the new elements on freelist, starting from the last block
+    // inserted and mark them free in reverse order, so that the insertion order
+    // will correspond to the iterator order...
+    // We don't touch the first and the last one.
+    size_type curblock=all_items.size();
+    do
+    {
+      --curblock; // We are sure we have at least create a new block
+      pointer new_block = all_items[curblock].first;
+      for (size_type i = all_items[curblock].second-2; i >= 1; --i)
+        put_on_free_list(new_block + i);
+    }
+    while ( curblock>lastblock );
+  }
+
+private:
+
+  void allocate_new_block();
+
+  void put_on_free_list(pointer x)
+  {
+    set_type(x, free_list, FREE);
+    free_list = x;
+  }
+
+  // Definition of the bit squatting :
+  // =================================
+  // ptr is composed of a pointer part and the last 2 bits.
+  // Here is the meaning of each of the 8 cases.
+  //
+  //                          value of the last 2 bits as "Type"
+  // pointer part     0              1                2              3
+  //         NULL     user elt       unused           free_list end  start/end
+  //      != NULL     user elt       block boundary   free elt       unused
+  //
+  // meaning of ptr : user stuff     next/prev block  free_list      unused
+
+  enum Type { USED = 0, BLOCK_BOUNDARY = 1, FREE = 2, START_END = 3 };
+
+  // The bit squatting is implemented by casting pointers to (char *), then
+  // subtracting to NULL, doing bit manipulations on the resulting integer,
+  // and converting back.
+
+  static char * clean_pointer(char * p)
+  {
+    return ((p - (char *) NULL) & ~ (std::ptrdiff_t) START_END) + (char *) NULL;
+  }
+
+  // Returns the pointee, cleaned up from the squatted bits.
+  static pointer clean_pointee(const_pointer ptr)
+  {
+    return (pointer) clean_pointer((char *) Traits::pointer(*ptr));
+  }
+
+  // Get the type of the pointee.
+  static Type type(const_pointer ptr)
+  {
+    char * p = (char *) Traits::pointer(*ptr);
+    return (Type) (p - clean_pointer(p));
+  }
+
+  // Sets the pointer part and the type of the pointee.
+  static void set_type(pointer ptr, void * p, Type t)
+  {
+    // This out of range compare is always true and causes lots of
+    // unnecessary warnings.
+    // CGAL_precondition(0 <= t && t < 4);
+    Traits::pointer(*ptr) = (void *) ((clean_pointer((char *) p)) + (int) t);
+  }
+
+  // We store a vector of pointers to all allocated blocks and their sizes.
+  // Knowing all pointers, we don't have to walk to the end of a block to reach
+  // the pointer to the next block.
+  // Knowing the sizes allows to deallocate() without having to compute the size
+  // by walking through the block till its end.
+  // This opens up the possibility for the compiler to optimize the clear()
+  // function considerably when has_trivial_destructor<T>.
+  typedef std::vector<std::pair<pointer, size_type> >  All_items;
+
+  void init()
+  {
+    block_size = Increment_policy::first_block_size;
+    capacity_  = 0;
+    size_      = 0;
+    free_list  = NULL;
+    first_item = NULL;
+    last_item  = NULL;
+    all_items  = All_items();
+    time_stamper->reset();
+  }
+
+  allocator_type   alloc;
+  size_type        capacity_;
+  size_type        size_;
+  size_type        block_size;
+  pointer          free_list;
+  pointer          first_item;
+  pointer          last_item;
+  All_items        all_items;
+
+  // This is a pointer, so that the definition of Compact_container does
+  // not require a complete type `T`.
+  Time_stamper_impl* time_stamper;
+};
+
+template < class T, class Allocator, class Increment_policy, class TimeStamper >
+void Compact_container<T, Allocator, Increment_policy, TimeStamper>::merge(Self &d)
+{
+  CGAL_precondition(&d != this);
+
+  // Allocators must be "compatible" :
+  CGAL_precondition(get_allocator() == d.get_allocator());
+
+  // Concatenate the free_lists.
+  if (free_list == NULL) {
+    free_list = d.free_list;
+  } else if (d.free_list != NULL) {
+    pointer p = free_list;
+    while (clean_pointee(p) != NULL)
+      p = clean_pointee(p);
+    set_type(p, d.free_list, FREE);
+  }
+  // Concatenate the blocks.
+  if (last_item == NULL) { // empty...
+    first_item = d.first_item;
+    last_item  = d.last_item;
+  } else if (d.last_item != NULL) {
+    set_type(last_item, d.first_item, BLOCK_BOUNDARY);
+    set_type(d.first_item, last_item, BLOCK_BOUNDARY);
+    last_item = d.last_item;
+  }
+  all_items.insert(all_items.end(), d.all_items.begin(), d.all_items.end());
+  // Add the sizes.
+  size_ += d.size_;
+  // Add the capacities.
+  capacity_ += d.capacity_;
+  // It seems reasonnable to take the max of the block sizes.
+  block_size = (std::max)(block_size, d.block_size);
+  // Clear d.
+  d.init();
+}
+
+template < class T, class Allocator, class Increment_policy, class TimeStamper >
+void Compact_container<T, Allocator, Increment_policy, TimeStamper>::clear()
+{
+  for (typename All_items::iterator it = all_items.begin(), itend = all_items.end();
+       it != itend; ++it) {
+    pointer p = it->first;
+    size_type s = it->second;
+    for (pointer pp = p + 1; pp != p + s - 1; ++pp) {
+      if (type(pp) == USED)
+      {
+        alloc.destroy(pp);
+        set_type(pp, NULL, FREE);
+      }
+    }
+    alloc.deallocate(p, s);
+  }
+  init();
+}
+
+template < class T, class Allocator, class Increment_policy, class TimeStamper >
+void Compact_container<T, Allocator, Increment_policy, TimeStamper>::allocate_new_block()
+{
+  typedef internal::Erase_counter_strategy<
+    internal::has_increment_erase_counter<T>::value> EraseCounterStrategy;
+
+  pointer new_block = alloc.allocate(block_size + 2);
+  all_items.push_back(std::make_pair(new_block, block_size + 2));
+  capacity_ += block_size;
+  // We don't touch the first and the last one.
+  // We mark them free in reverse order, so that the insertion order
+  // will correspond to the iterator order...
+  for (size_type i = block_size; i >= 1; --i)
+  {
+    EraseCounterStrategy::set_erase_counter(*(new_block + i), 0);
+    put_on_free_list(new_block + i);
+  }
+  // We insert this new block at the end.
+  if (last_item == NULL) // First time
+  {
+      first_item = new_block;
+      last_item  = new_block + block_size + 1;
+      set_type(first_item, NULL, START_END);
+  }
+  else
+  {
+      set_type(last_item, new_block, BLOCK_BOUNDARY);
+      set_type(new_block, last_item, BLOCK_BOUNDARY);
+      last_item = new_block + block_size + 1;
+  }
+  set_type(last_item, NULL, START_END);
+  // Increase the block_size for the next time.
+  Increment_policy::increase_size(*this);
+}
+
+template < class T, class Allocator, class Increment_policy, class TimeStamper >
+inline
+bool operator==(const Compact_container<T, Allocator, Increment_policy, TimeStamper> &lhs,
+                const Compact_container<T, Allocator, Increment_policy, TimeStamper> &rhs)
+{
+  return lhs.size() == rhs.size() &&
+    std::equal(lhs.begin(), lhs.end(), rhs.begin());
+}
+
+template < class T, class Allocator, class Increment_policy, class TimeStamper >
+inline
+bool operator!=(const Compact_container<T, Allocator, Increment_policy, TimeStamper> &lhs,
+                const Compact_container<T, Allocator, Increment_policy, TimeStamper> &rhs)
+{
+  return ! (lhs == rhs);
+}
+
+template < class T, class Allocator, class Increment_policy, class TimeStamper >
+inline
+bool operator< (const Compact_container<T, Allocator, Increment_policy, TimeStamper> &lhs,
+                const Compact_container<T, Allocator, Increment_policy, TimeStamper> &rhs)
+{
+  return std::lexicographical_compare(lhs.begin(), lhs.end(),
+                                      rhs.begin(), rhs.end());
+}
+
+template < class T, class Allocator, class Increment_policy, class TimeStamper >
+inline
+bool operator> (const Compact_container<T, Allocator, Increment_policy, TimeStamper> &lhs,
+                const Compact_container<T, Allocator, Increment_policy, TimeStamper> &rhs)
+{
+  return rhs < lhs;
+}
+
+template < class T, class Allocator, class Increment_policy, class TimeStamper >
+inline
+bool operator<=(const Compact_container<T, Allocator, Increment_policy, TimeStamper> &lhs,
+                const Compact_container<T, Allocator, Increment_policy, TimeStamper> &rhs)
+{
+  return ! (lhs > rhs);
+}
+
+template < class T, class Allocator, class Increment_policy, class TimeStamper >
+inline
+bool operator>=(const Compact_container<T, Allocator, Increment_policy, TimeStamper> &lhs,
+                const Compact_container<T, Allocator, Increment_policy, TimeStamper> &rhs)
+{
+  return ! (lhs < rhs);
+}
+
+namespace internal {
+
+  template < class DSC, bool Const >
+  class CC_iterator
+  {
+    typedef typename DSC::iterator                    iterator;
+    typedef CC_iterator<DSC, Const>                   Self;
+  public:
+    typedef typename DSC::value_type                  value_type;
+    typedef typename DSC::size_type                   size_type;
+    typedef typename DSC::difference_type             difference_type;
+    typedef typename boost::mpl::if_c< Const, const value_type*,
+                                       value_type*>::type pointer;
+    typedef typename boost::mpl::if_c< Const, const value_type&,
+                                       value_type&>::type reference;
+    typedef std::bidirectional_iterator_tag           iterator_category;
+
+    // the initialization with NULL is required by our Handle concept.
+    CC_iterator()
+    {
+      m_ptr.p = NULL;
+    }
+
+    // Either a harmless copy-ctor,
+    // or a conversion from iterator to const_iterator.
+    CC_iterator (const iterator &it)
+    {
+      m_ptr.p = &(*it);
+    }
+
+    // Same for assignment operator (otherwise MipsPro warns)
+    CC_iterator & operator= (const iterator &it)
+    {
+      m_ptr.p = &(*it);
+      return *this;
+    }
+
+    // Construction from NULL
+    CC_iterator (Nullptr_t CGAL_assertion_code(n))
+    {
+      CGAL_assertion (n == NULL);
+      m_ptr.p = NULL;
+    }
+
+  private:
+
+    typedef typename DSC::Time_stamper_impl           Time_stamper_impl;
+
+    union {
+      pointer      p;
+      void        *vp;
+    } m_ptr;
+
+    // Only Compact_container should access these constructors.
+    friend class Compact_container<value_type,
+                                   typename DSC::Al,
+                                   typename DSC::Ip,
+                                   typename DSC::Ts>;
+
+
+    // For begin()
+    CC_iterator(pointer ptr, int, int)
+    {
+      m_ptr.p = ptr;
+      if (m_ptr.p == NULL) // empty container.
+        return;
+
+      ++(m_ptr.p); // if not empty, p = start
+      if (DSC::type(m_ptr.p) == DSC::FREE)
+        increment();
+    }
+
+    // Construction from raw pointer and for end().
+    CC_iterator(pointer ptr, int)
+    {
+      m_ptr.p = ptr;
+    }
+
+    // NB : in case empty container, begin == end == NULL.
+    void increment()
+    {
+      // It's either pointing to end(), or valid.
+      CGAL_assertion_msg(m_ptr.p != NULL,
+         "Incrementing a singular iterator or an empty container iterator ?");
+      CGAL_assertion_msg(DSC::type(m_ptr.p) != DSC::START_END,
+         "Incrementing end() ?");
+
+      // If it's not end(), then it's valid, we can do ++.
+      do {
+        ++(m_ptr.p);
+        if (DSC::type(m_ptr.p) == DSC::USED ||
+            DSC::type(m_ptr.p) == DSC::START_END)
+          return;
+
+        if (DSC::type(m_ptr.p) == DSC::BLOCK_BOUNDARY)
+          m_ptr.p = DSC::clean_pointee(m_ptr.p);
+      } while (true);
+    }
+
+    void decrement()
+    {
+      // It's either pointing to end(), or valid.
+      CGAL_assertion_msg(m_ptr.p != NULL,
+         "Decrementing a singular iterator or an empty container iterator ?");
+      CGAL_assertion_msg(DSC::type(m_ptr.p - 1) != DSC::START_END,
+         "Decrementing begin() ?");
+
+      // If it's not begin(), then it's valid, we can do --.
+      do {
+        --m_ptr.p;
+        if (DSC::type(m_ptr.p) == DSC::USED ||
+            DSC::type(m_ptr.p) == DSC::START_END)
+          return;
+
+        if (DSC::type(m_ptr.p) == DSC::BLOCK_BOUNDARY)
+          m_ptr.p = DSC::clean_pointee(m_ptr.p);
+      } while (true);
+    }
+
+  public:
+
+    Self & operator++()
+    {
+      CGAL_assertion_msg(m_ptr.p != NULL,
+         "Incrementing a singular iterator or an empty container iterator ?");
+      /* CGAL_assertion_msg(DSC::type(m_ptr.p) == DSC::USED,
+         "Incrementing an invalid iterator."); */
+      increment();
+      return *this;
+    }
+
+    Self & operator--()
+    {
+      CGAL_assertion_msg(m_ptr.p != NULL,
+         "Decrementing a singular iterator or an empty container iterator ?");
+      /*CGAL_assertion_msg(DSC::type(m_ptr.p) == DSC::USED
+                      || DSC::type(m_ptr.p) == DSC::START_END,
+                      "Decrementing an invalid iterator.");*/
+      decrement();
+      return *this;
+    }
+
+    Self operator++(int) { Self tmp(*this); ++(*this); return tmp; }
+    Self operator--(int) { Self tmp(*this); --(*this); return tmp; }
+
+    reference operator*() const { return *(m_ptr.p); }
+
+    pointer   operator->() const { return (m_ptr.p); }
+
+    // For std::less...
+    bool operator<(const CC_iterator& other) const
+    {
+      return Time_stamper_impl::less(m_ptr.p, other.m_ptr.p);
+    }
+
+    bool operator>(const CC_iterator& other) const
+    {
+      return Time_stamper_impl::less(other.m_ptr.p, m_ptr.p);
+    }
+
+    bool operator<=(const CC_iterator& other) const
+    {
+      return Time_stamper_impl::less(m_ptr.p, other.m_ptr.p)
+          || (*this == other);
+    }
+
+    bool operator>=(const CC_iterator& other) const
+    {
+      return Time_stamper_impl::less(other.m_ptr.p, m_ptr.p)
+          || (*this == other);
+    }
+
+    // Can itself be used for bit-squatting.
+    void *   for_compact_container() const { return (m_ptr.vp); }
+    void * & for_compact_container()       { return (m_ptr.vp); }
+  };
+
+  template < class DSC, bool Const1, bool Const2 >
+  inline
+  bool operator==(const CC_iterator<DSC, Const1> &rhs,
+                  const CC_iterator<DSC, Const2> &lhs)
+  {
+    return rhs.operator->() == lhs.operator->();
+  }
+
+  template < class DSC, bool Const1, bool Const2 >
+  inline
+  bool operator!=(const CC_iterator<DSC, Const1> &rhs,
+                  const CC_iterator<DSC, Const2> &lhs)
+  {
+    return rhs.operator->() != lhs.operator->();
+  }
+
+  // Comparisons with NULL are part of CGAL's Handle concept...
+  template < class DSC, bool Const >
+  inline
+  bool operator==(const CC_iterator<DSC, Const> &rhs,
+                  Nullptr_t CGAL_assertion_code(n))
+  {
+    CGAL_assertion( n == NULL);
+    return rhs.operator->() == NULL;
+  }
+
+  template < class DSC, bool Const >
+  inline
+  bool operator!=(const CC_iterator<DSC, Const> &rhs,
+                  Nullptr_t CGAL_assertion_code(n))
+  {
+    CGAL_assertion( n == NULL);
+    return rhs.operator->() != NULL;
+  }
+
+  template <class DSC, bool Const>
+  std::size_t hash_value(const CC_iterator<DSC, Const>&  i)
+  {
+    typedef Time_stamper_impl<typename DSC::value_type> Stamper;
+    return Stamper::hash_value(&*i);
+  }
+
+} // namespace internal
+
+} //namespace CGAL
+
+namespace std {
+
+#if defined(BOOST_MSVC)
+#  pragma warning(push)
+#  pragma warning(disable:4099) // For VC10 it is class hash 
+#endif
+
+#ifndef CGAL_CFG_NO_STD_HASH
+  
+  template < class DSC, bool Const >
+  struct hash<CGAL::internal::CC_iterator<DSC, Const> >
+    : public std::unary_function<CGAL::internal::CC_iterator<DSC, Const>, std::size_t> {
+
+    std::size_t operator()(const CGAL::internal::CC_iterator<DSC, Const>& i) const
+    {
+      return reinterpret_cast<std::size_t>(&*i) / sizeof(typename DSC::value_type);
+    }
+  };
+#endif // CGAL_CFG_NO_STD_HASH
+
+#if defined(BOOST_MSVC)
+#  pragma warning(pop)
+#endif
+
+} // namespace std
+
+#endif // CGAL_COMPACT_CONTAINER_H
diff --git a/3rdparty/CGAL/include/CGAL/Compact_mesh_cell_base_3.h b/3rdparty/CGAL/include/CGAL/Compact_mesh_cell_base_3.h
new file mode 100644
index 0000000..cca7b39
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Compact_mesh_cell_base_3.h
@@ -0,0 +1,715 @@
+// Copyright (c) 2006-2007  INRIA Sophia-Antipolis (France).
+// Copyright (c) 2008,2011 GeometryFactory Sarl (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
+// 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: https://scm.gforge.inria.fr/svn/cgal/branches/features/Mesh_3-experimental-GF/Mesh_3/include/CGAL/Compact_mesh_cell_base_3.h $
+// $Id: Compact_mesh_cell_base_3.h 70288 2012-07-05 10:09:48Z jtournoi $
+//
+//
+// Author(s)     : Laurent Rineau, Stephane Tayeb, Andreas Fabri
+
+
+#ifndef CGAL_COMPACT_MESH_CELL_BASE_3_H
+#define CGAL_COMPACT_MESH_CELL_BASE_3_H
+
+#include <CGAL/Mesh_3/config.h>
+
+#include <CGAL/basic.h>
+#include <CGAL/array.h>
+#include <CGAL/triangulation_assertions.h>
+#include <CGAL/internal/Dummy_tds_3.h>
+#include <CGAL/tags.h>
+#include <CGAL/Has_timestamp.h>
+
+#include <CGAL/Regular_triangulation_cell_base_3.h>
+#include <CGAL/Mesh_3/io_signature.h>
+
+#ifdef CGAL_LINKED_WITH_TBB
+# include <tbb/atomic.h>
+#endif
+
+namespace CGAL {
+
+// Class Compact_mesh_cell_base_3_base
+// Base for Compact_mesh_cell_base_3, with specializations
+// for different values of Concurrency_tag
+// Sequential
+template <typename GT, typename Concurrency_tag>
+class Compact_mesh_cell_base_3_base
+{
+  typedef typename GT::Point_3 Point;
+
+protected:
+  Compact_mesh_cell_base_3_base()
+    : bits_(0)
+    , circumcenter_(NULL)
+  {}
+
+public:
+#if defined(CGAL_MESH_3_USE_LAZY_SORTED_REFINEMENT_QUEUE) \
+ || defined(CGAL_MESH_3_USE_LAZY_UNSORTED_REFINEMENT_QUEUE)
+
+  // Erase counter (cf. Compact_container)
+  unsigned int erase_counter() const
+  {
+    return this->m_erase_counter;
+  }
+  void set_erase_counter(unsigned int c)
+  {
+    this->m_erase_counter = c;
+  }
+  void increment_erase_counter()
+  {
+    ++this->m_erase_counter;
+  }
+#endif
+
+  /// Marks \c facet as visited
+  void set_facet_visited (const int facet)
+  {
+    CGAL_precondition(facet>=0 && facet <4);
+    bits_ |= char(1 << facet);
+  }
+
+  /// Marks \c facet as not visited
+  void reset_visited (const int facet)
+  {
+    CGAL_precondition(facet>=0 && facet<4);
+    bits_ = char(bits_ & (15 & ~(1 << facet)));
+  }
+
+  /// Returns \c true if \c facet is marked as visited
+  bool is_facet_visited (const int facet) const
+  {
+    CGAL_precondition(facet>=0 && facet<4);
+    return ( (bits_ & (1 << facet)) != 0 );
+  }
+
+  /// Precondition circumcenter_ == NULL
+  void try_to_set_circumcenter(Point *cc) const
+  {
+    CGAL_precondition(circumcenter_ == NULL);
+    circumcenter_ = cc;
+  }
+
+private:
+  char bits_;
+
+#if defined(CGAL_MESH_3_USE_LAZY_SORTED_REFINEMENT_QUEUE) \
+ || defined(CGAL_MESH_3_USE_LAZY_UNSORTED_REFINEMENT_QUEUE)
+
+  typedef unsigned int              Erase_counter_type;
+  Erase_counter_type                m_erase_counter;
+#endif
+
+protected:
+  mutable Point * circumcenter_;
+};
+
+
+#ifdef CGAL_LINKED_WITH_TBB
+// Class Compact_mesh_cell_base_3_base
+// Specialization for parallel
+template <typename GT>
+class Compact_mesh_cell_base_3_base<GT, Parallel_tag>
+{
+  typedef typename GT::Point_3 Point;
+
+protected:
+  Compact_mesh_cell_base_3_base()
+  {
+    bits_ = 0;
+    circumcenter_ = NULL;
+  }
+
+public:
+  // Erase counter (cf. Compact_container)
+  unsigned int erase_counter() const
+  {
+    return this->m_erase_counter;
+  }
+  void set_erase_counter(unsigned int c)
+  {
+    this->m_erase_counter = c;
+  }
+  void increment_erase_counter()
+  {
+    ++this->m_erase_counter;
+  }
+
+  /// Marks \c facet as visited
+  void set_facet_visited (const int facet)
+  {
+    CGAL_precondition(facet>=0 && facet<4);
+    char current_bits = bits_;
+    while (bits_.compare_and_swap(current_bits | char(1 << facet), current_bits) != current_bits)
+    {
+      current_bits = bits_;
+    }
+  }
+
+  /// Marks \c facet as not visited
+  void reset_visited (const int facet)
+  {
+    CGAL_precondition(facet>=0 && facet<4);
+    char current_bits = bits_;
+    char mask = char(15 & ~(1 << facet));
+    char wanted_value = current_bits & mask;
+    while (bits_.compare_and_swap(wanted_value, current_bits) != current_bits)
+    {
+      current_bits = bits_;
+    }
+  }
+
+  /// Returns \c true if \c facet is marked as visited
+  bool is_facet_visited (const int facet) const
+  {
+    CGAL_precondition(facet>=0 && facet<4);
+    return ( (bits_ & char(1 << facet)) != 0 );
+  }
+
+  /// If the circumcenter is already set (circumcenter_ != NULL),
+  /// this function "deletes" cc
+  void try_to_set_circumcenter(Point *cc) const
+  {
+    if (circumcenter_.compare_and_swap(cc, NULL) != NULL)
+      delete cc;
+  }
+
+private:
+  typedef tbb::atomic<unsigned int> Erase_counter_type;
+  Erase_counter_type                m_erase_counter;
+  /// Stores visited facets (4 first bits)
+  tbb::atomic<char> bits_;
+
+protected:
+  mutable tbb::atomic<Point*> circumcenter_;
+};
+
+#endif // CGAL_LINKED_WITH_TBB
+
+
+// Class Compact_mesh_cell_base_3
+// Cell base class used in 3D meshing process.
+// Adds information to Cb about the cell of the input complex containing it
+template< class GT,
+          class MD,
+          class TDS = void >
+class Compact_mesh_cell_base_3
+  : public Compact_mesh_cell_base_3_base<GT, typename TDS::Concurrency_tag>
+{
+  typedef typename GT::FT FT;
+  typedef Compact_mesh_cell_base_3_base<GT,typename TDS::Concurrency_tag> Base;
+  using Base::circumcenter_;
+
+public:
+  typedef TDS                          Triangulation_data_structure;
+  typedef typename TDS::Vertex_handle  Vertex_handle;
+  typedef typename TDS::Cell_handle    Cell_handle;
+  typedef typename TDS::Vertex         Vertex;
+  typedef typename TDS::Cell           Cell;
+  typedef typename TDS::Cell_data      TDS_data;
+
+
+  template <typename TDS2>
+  struct Rebind_TDS {
+    typedef Compact_mesh_cell_base_3<GT, MD, TDS2> Other;
+  };
+
+
+  // Index Type
+  typedef typename MD::Subdomain_index      Subdomain_index;
+  typedef typename MD::Surface_patch_index  Surface_patch_index;
+  typedef typename MD::Index                Index;
+
+  typedef GT                   Geom_traits;
+  typedef typename GT::Point_3 Point;
+
+  typedef Point*           Point_container;
+  typedef Point*           Point_iterator;
+  typedef const Point*     Point_const_iterator;
+
+public:
+  void invalidate_circumcenter() const
+  {
+    if (circumcenter_) {
+      delete circumcenter_;
+      circumcenter_ = NULL;
+    }
+  }
+
+public:
+  // Constructors
+  Compact_mesh_cell_base_3()
+    : surface_index_table_()
+    , surface_center_table_()
+#ifdef CGAL_INTRUSIVE_LIST
+    , next_intrusive_()
+    , previous_intrusive_()
+#endif
+    , time_stamp_(-1)
+    , surface_center_index_table_()
+    , sliver_value_(FT(0.))
+    , subdomain_index_()  
+    , sliver_cache_validity_(false)
+  {}
+
+  Compact_mesh_cell_base_3(const Compact_mesh_cell_base_3& rhs)
+    : N(rhs.N)
+    , V(rhs.V)
+#ifdef CGAL_INTRUSIVE_LIST
+    , next_intrusive_(rhs.next_intrusive_)
+    , previous_intrusive_(rhs.previous_intrusive_)
+#endif
+    , time_stamp_(rhs.time_stamp_)
+    , sliver_value_(rhs.sliver_value_)
+    , subdomain_index_(rhs.subdomain_index_)
+    , sliver_cache_validity_(false)
+  {
+    for(int i=0; i <4; i++){
+      surface_index_table_[i] = rhs.surface_index_table_[i];
+      surface_center_table_[i]= rhs.surface_center_table_[i];
+      surface_center_index_table_[i] = rhs.surface_center_index_table_[i];
+    }
+  }
+
+  Compact_mesh_cell_base_3 (Vertex_handle v0,
+                            Vertex_handle v1,
+                            Vertex_handle v2,
+                            Vertex_handle v3)
+    : surface_index_table_()
+    , surface_center_table_()
+    , V(CGAL::make_array(v0, v1, v2, v3))
+#ifdef CGAL_INTRUSIVE_LIST
+    , next_intrusive_()
+    , previous_intrusive_()
+#endif
+    , time_stamp_(-1)
+    , surface_center_index_table_()
+    , sliver_value_(FT(0.))
+    , subdomain_index_()
+    , sliver_cache_validity_(false)
+  {
+  }
+
+
+  Compact_mesh_cell_base_3 (Vertex_handle v0,
+                            Vertex_handle v1,
+                            Vertex_handle v2,
+                            Vertex_handle v3,
+                            Cell_handle n0,
+                            Cell_handle n1,
+                            Cell_handle n2,
+                            Cell_handle n3)
+    : surface_index_table_()
+    , surface_center_table_()
+    , N(CGAL::make_array(n0, n1, n2, n3))
+    , V(CGAL::make_array(v0, v1, v2, v3))
+#ifdef CGAL_INTRUSIVE_LIST
+    , next_intrusive_()
+    , previous_intrusive_()
+#endif
+    , time_stamp_(-1)
+    , surface_center_index_table_()
+    , sliver_value_(FT(0.))
+    , subdomain_index_()
+    , sliver_cache_validity_(false)
+  {
+  }
+
+  ~Compact_mesh_cell_base_3()
+  {
+    if(circumcenter_ != NULL){
+      delete circumcenter_;
+    }
+  }
+
+  // ACCESS FUNCTIONS
+
+  Vertex_handle vertex(int i) const
+  {
+    CGAL_triangulation_precondition( i >= 0 && i <= 3 );
+    return V[i];
+  }
+
+  bool has_vertex(Vertex_handle v) const
+  {
+    return (V[0] == v) || (V[1] == v) || (V[2]== v) || (V[3]== v);
+  }
+
+  bool has_vertex(Vertex_handle v, int & i) const
+  {
+    if (v == V[0]) { i = 0; return true; }
+    if (v == V[1]) { i = 1; return true; }
+    if (v == V[2]) { i = 2; return true; }
+    if (v == V[3]) { i = 3; return true; }
+    return false;
+  }
+
+  int index(Vertex_handle v) const
+  {
+    if (v == V[0]) { return 0; }
+    if (v == V[1]) { return 1; }
+    if (v == V[2]) { return 2; }
+    CGAL_triangulation_assertion( v == V[3] );
+    return 3;
+  }
+
+  Cell_handle neighbor(int i) const
+  {
+    CGAL_triangulation_precondition( i >= 0 && i <= 3);
+    return N[i];
+  }
+
+  bool has_neighbor(Cell_handle n) const
+  {
+    return (N[0] == n) || (N[1] == n) || (N[2] == n) || (N[3] == n);
+  }
+
+  bool has_neighbor(Cell_handle n, int & i) const
+  {
+    if(n == N[0]){ i = 0; return true; }
+    if(n == N[1]){ i = 1; return true; }
+    if(n == N[2]){ i = 2; return true; }
+    if(n == N[3]){ i = 3; return true; }
+    return false;
+  }
+
+  int index(Cell_handle n) const
+  {
+    if (n == N[0]) return 0;
+    if (n == N[1]) return 1;
+    if (n == N[2]) return 2;
+    CGAL_triangulation_assertion( n == N[3] );
+    return 3;
+  }
+
+  // SETTING
+
+
+  void set_neighbor(int i, Cell_handle n)
+  {
+    CGAL_triangulation_precondition( i >= 0 && i <= 3);
+    CGAL_triangulation_precondition( this != &*n );
+    N[i] = n;
+  }
+
+
+  void set_neighbors()
+  {
+    N[0] = N[1] = N[2] = N[3] = Cell_handle();
+  }
+
+  void set_neighbors(Cell_handle n0, Cell_handle n1,
+                     Cell_handle n2, Cell_handle n3)
+  {
+    CGAL_triangulation_precondition( this != &*n0 );
+    CGAL_triangulation_precondition( this != &*n1 );
+    CGAL_triangulation_precondition( this != &*n2 );
+    CGAL_triangulation_precondition( this != &*n3 );
+    N[0] = n0;
+    N[1] = n1;
+    N[2] = n2;
+    N[3] = n3;
+  }
+
+  // CHECKING
+
+  // the following trivial is_valid allows
+  // the user of derived cell base classes
+  // to add their own purpose checking
+  bool is_valid(bool = false, int = 0) const
+  { return true; }
+
+  // For use by Compact_container.
+  void * for_compact_container() const { return N[0].for_compact_container(); }
+  void * & for_compact_container()     { return N[0].for_compact_container(); }
+
+  // TDS internal data access functions.
+        TDS_data& tds_data()       { return _tds_data; }
+  const TDS_data& tds_data() const { return _tds_data; }
+
+
+  Point_iterator hidden_points_begin() const { return hidden_points_end(); }
+  Point_iterator hidden_points_end() const { return NULL; }
+  void hide_point (const Point &) const { }
+
+
+  // We must override the functions that modify the vertices.
+  // And if the point inside a vertex is modified, we fail,
+  // but there's not much we can do for this now.
+  void set_vertex(int i, Vertex_handle v)
+  {
+    CGAL_triangulation_precondition( i >= 0 && i <= 3);
+    invalidate_circumcenter();
+    V[i] = v;
+  }
+
+  void set_vertices()
+  {
+    invalidate_circumcenter();
+    V[0] = V[1] = V[2] = V[3] = Vertex_handle();
+  }
+
+  void set_vertices(Vertex_handle v0, Vertex_handle v1,
+                    Vertex_handle v2, Vertex_handle v3)
+  {
+    invalidate_circumcenter();
+    V[0] = v0;
+    V[1] = v1;
+    V[2] = v2;
+    V[3] = v3;
+  }
+
+  const Point &
+  weighted_circumcenter(const Geom_traits& gt = Geom_traits()) const
+  {
+    if (circumcenter_ == NULL) {
+      this->try_to_set_circumcenter(
+        new Point(gt.construct_weighted_circumcenter_3_object()
+                  (this->vertex(0)->point(),
+                   this->vertex(1)->point(),
+                   this->vertex(2)->point(),
+                   this->vertex(3)->point())));
+    } else {
+      CGAL_expensive_assertion(gt.construct_weighted_circumcenter_3_object()
+                                (this->vertex(0)->point(),
+                                 this->vertex(1)->point(),
+                                 this->vertex(2)->point(),
+                                 this->vertex(3)->point()) == *circumcenter_);
+    }
+    return *circumcenter_;
+  }
+
+
+  // Returns the index of the cell of the input complex that contains the cell
+  Subdomain_index subdomain_index() const { return subdomain_index_; }
+
+  // Sets the index of the cell of the input complex that contains the cell
+  void set_subdomain_index(const Subdomain_index& index)
+  { subdomain_index_ = index; }
+
+  void set_sliver_value(const FT& value)
+  {
+    sliver_cache_validity_ = true;
+    sliver_value_ = value;
+  }
+
+  const FT& sliver_value() const
+  {
+    CGAL_assertion(is_cache_valid());
+    return sliver_value_;
+  }
+
+  bool is_cache_valid() const { return sliver_cache_validity_; }
+  void reset_cache_validity() const { sliver_cache_validity_ = false;  }
+
+  /// Set surface index of \c facet to \c index
+  void set_surface_patch_index(const int facet, const Surface_patch_index& index)
+  {
+    CGAL_precondition(facet>=0 && facet<4);
+    surface_index_table_[facet] = index;
+  }
+
+  /// Returns surface index of facet \c facet
+  Surface_patch_index surface_patch_index(const int facet) const
+  {
+    CGAL_precondition(facet>=0 && facet<4);
+    return surface_index_table_[facet];
+  }
+
+  /// Sets surface center of \c facet to \c point
+  void set_facet_surface_center(const int facet, const Point& point)
+  {
+    CGAL_precondition(facet>=0 && facet<4);
+    surface_center_table_[facet] = point;
+  }
+
+  /// Returns surface center of \c facet
+  Point get_facet_surface_center(const int facet) const
+  {
+    CGAL_precondition(facet>=0 && facet<4);
+    return surface_center_table_[facet];
+  }
+
+  /// Sets surface center index of \c facet to \c index
+  void set_facet_surface_center_index(const int facet, const Index& index)
+  {
+    CGAL_precondition(facet>=0 && facet<4);
+    surface_center_index_table_[facet] = index;
+  }
+
+  /// Returns surface center of \c facet
+  Index get_facet_surface_center_index(const int facet) const
+  {
+    CGAL_precondition(facet>=0 && facet<4);
+    return surface_center_index_table_[facet];
+  }
+
+  /// Returns true if facet lies on a surface patch
+  bool is_facet_on_surface(const int facet) const
+  {
+    CGAL_precondition(facet>=0 && facet<4);
+    return ( !( Surface_patch_index() == surface_index_table_[facet] ));
+  }
+
+  // -----------------------------------
+  // Backward Compatibility
+  // -----------------------------------
+#ifndef CGAL_MESH_3_NO_DEPRECATED_SURFACE_INDEX
+  typedef Surface_patch_index   Surface_index;
+
+  void set_surface_index(const int facet, const Surface_index& index)
+  { set_surface_patch_index(facet,index); }
+
+  /// Returns surface index of facet \c facet
+  Surface_index surface_index(const int facet) const
+  { return surface_patch_index(facet); }
+#endif // CGAL_MESH_3_NO_DEPRECATED_SURFACE_INDEX
+  // -----------------------------------
+  // End backward Compatibility
+  // -----------------------------------
+
+  static
+  std::string io_signature()
+  {
+    return
+      Get_io_signature<Subdomain_index>()() + "+" +
+      Get_io_signature<Regular_triangulation_cell_base_3<Geom_traits> >()()
+      + "+(" + Get_io_signature<Surface_patch_index>()() + ")[4]";
+  }
+
+#ifdef CGAL_INTRUSIVE_LIST
+public:
+  Cell_handle next_intrusive() const { return next_intrusive_; }
+  void set_next_intrusive(Cell_handle c)
+  { 
+    next_intrusive_ = c; 
+  }
+
+  Cell_handle previous_intrusive() const { return previous_intrusive_; }
+  void set_previous_intrusive(Cell_handle c)
+  { 
+    previous_intrusive_ = c; 
+  }
+#endif // CGAL_INTRUSIVE_LIST
+
+  /// For the determinism of Compact_container iterators
+  ///@{
+  typedef Tag_true Has_timestamp;
+
+  std::size_t time_stamp() const {
+    return time_stamp_;
+  }
+  void set_time_stamp(const std::size_t& ts) {
+    time_stamp_ = ts;
+  }
+  ///@}
+
+private:
+
+
+  /// Stores surface_index for each facet of the cell
+  CGAL::cpp11::array<Surface_patch_index, 4> surface_index_table_;
+  /// Stores surface center of each facet of the cell
+  CGAL::cpp11::array<Point, 4> surface_center_table_;
+  /// Stores surface center index of each facet of the cell
+
+  CGAL::cpp11::array<Cell_handle, 4> N;
+  CGAL::cpp11::array<Vertex_handle, 4> V;
+
+#ifdef CGAL_INTRUSIVE_LIST
+  Cell_handle next_intrusive_, previous_intrusive_;
+#endif
+  std::size_t time_stamp_;
+
+  CGAL::cpp11::array<Index, 4> surface_center_index_table_;
+  /// Stores visited facets (4 first bits)
+
+  //  Point_container _hidden;
+
+  FT sliver_value_;
+
+  // The index of the cell of the input complex that contains me
+  Subdomain_index subdomain_index_;
+
+  TDS_data      _tds_data;
+  mutable bool sliver_cache_validity_;
+
+
+};  // end class Compact_mesh_cell_base_3
+
+template < class GT, class MT, class Cb >
+std::istream&
+operator>>(std::istream &is,
+           Compact_mesh_cell_base_3<GT, MT, Cb> &c)
+{
+  typename Compact_mesh_cell_base_3<GT, MT, Cb>::Subdomain_index index;
+  if(is_ascii(is))
+    is >> index;
+  else
+    read(is, index);
+  if(is) {
+    c.set_subdomain_index(index);
+    for(int i = 0; i < 4; ++i)
+    {
+      typename Compact_mesh_cell_base_3<GT, MT, Cb>::Surface_patch_index i2;
+      if(is_ascii(is))
+        is >> iformat(i2);
+      else
+      {
+        read(is, i2);
+      }
+      c.set_surface_patch_index(i, i2);
+    }
+  }
+  return is;
+}
+
+template < class GT, class MT, class Cb >
+std::ostream&
+operator<<(std::ostream &os,
+           const Compact_mesh_cell_base_3<GT, MT, Cb> &c)
+{
+  if(is_ascii(os))
+     os << c.subdomain_index();
+  else
+    write(os, c.subdomain_index());
+  for(int i = 0; i < 4; ++i)
+  {
+    if(is_ascii(os))
+      os << ' ' << oformat(c.surface_patch_index(i));
+    else
+      write(os, c.surface_patch_index(i));
+  }
+  return os;
+}
+
+
+// Specialization for void.
+template <typename GT, typename MD>
+class Compact_mesh_cell_base_3<GT, MD, void>
+{
+public:
+  typedef internal::Dummy_tds_3                         Triangulation_data_structure;
+  typedef Triangulation_data_structure::Vertex_handle   Vertex_handle;
+  typedef Triangulation_data_structure::Cell_handle     Cell_handle;
+  template <typename TDS2>
+  struct Rebind_TDS { typedef Compact_mesh_cell_base_3<GT, MD, TDS2> Other; };
+};
+
+}  // end namespace CGAL
+
+
+#endif // CGAL_COMPACT_MESH_CELL_BASE_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Complex_2_in_triangulation_3.h b/3rdparty/CGAL/include/CGAL/Complex_2_in_triangulation_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Complex_2_in_triangulation_3.h
rename to 3rdparty/CGAL/include/CGAL/Complex_2_in_triangulation_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Complex_2_in_triangulation_cell_base_3.h b/3rdparty/CGAL/include/CGAL/Complex_2_in_triangulation_cell_base_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Complex_2_in_triangulation_cell_base_3.h
rename to 3rdparty/CGAL/include/CGAL/Complex_2_in_triangulation_cell_base_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Complex_2_in_triangulation_vertex_base_3.h b/3rdparty/CGAL/include/CGAL/Complex_2_in_triangulation_vertex_base_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Complex_2_in_triangulation_vertex_base_3.h
rename to 3rdparty/CGAL/include/CGAL/Complex_2_in_triangulation_vertex_base_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Complexity_tags.h b/3rdparty/CGAL/include/CGAL/Complexity_tags.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Complexity_tags.h
rename to 3rdparty/CGAL/include/CGAL/Complexity_tags.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Compute_anchor_3.h b/3rdparty/CGAL/include/CGAL/Compute_anchor_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Compute_anchor_3.h
rename to 3rdparty/CGAL/include/CGAL/Compute_anchor_3.h
diff --git a/3rdparty/CGAL/include/CGAL/Compute_cone_boundaries_2.h b/3rdparty/CGAL/include/CGAL/Compute_cone_boundaries_2.h
new file mode 100644
index 0000000..4140fc7
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Compute_cone_boundaries_2.h
@@ -0,0 +1,220 @@
+// Copyright (c) 2013-2015  The University of Western Sydney, Australia.
+// 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
+// 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$
+//
+//
+// Authors: Weisheng Si, Quincy Tse
+
+/*! \file Compute_cone_boundaries_2.h
+ *
+ * This header implements the functor for computing the directions of cone boundaries with a given
+ *  cone number and a given initial direction either exactly or inexactly.
+ */
+
+#ifndef CGAL_COMPUTE_CONE_BOUNDARIES_2_H
+#define CGAL_COMPUTE_CONE_BOUNDARIES_2_H
+
+#include <iostream>
+#include <cstdlib>
+#include <vector>
+#include <utility>
+#include <CGAL/config.h>      // included compiler_config.h, defining CGAL_USE_CORE, etc.
+#include <CGAL/Polynomial.h>
+#include <CGAL/number_type_config.h>    // CGAL_PI is defined there
+#include <CGAL/enum.h>
+#include <CGAL/Exact_predicates_exact_constructions_kernel_with_root_of.h>
+#include <CGAL/Aff_transformation_2.h>
+
+namespace CGAL {
+
+/*! \ingroup PkgConeBasedSpanners
+ *
+ *  \brief The functor for computing the directions of cone boundaries with a given
+ *  cone number and a given initial direction.
+ *
+ *  This computation can be either inexact by simply dividing an approximate \f$ \pi \f$ by the cone number
+ *  (which is quick), or exact by using roots of polynomials (requiring number types such as `CORE::Expr` or `leda_real`,
+ *  which are slow). The inexact computation is done by the general functor definition,
+ *  while the exact computation is done by a specialization of this functor.
+ *
+ *  In the construction of cone-based spanners such as Yao graph and Theta graph implemented by this package,
+ *  this functor is called first to compute the cone boundaries.
+ *  Of course, this functor can also be used in other applications where the plane needs to be divided
+ *  into equally-angled cones.
+ *
+ * \tparam Traits_  Must be either `CGAL::Exact_predicates_exact_constructions_kernel_with_root_of` 
+ *                  or `CGAL::Exact_predicates_inexact_constructions_kernel`.
+ *
+ */
+template <typename Traits_>
+class Compute_cone_boundaries_2 {
+
+public:
+    /*! the geometric traits class. */
+    typedef  Traits_      Traits;
+
+    /*! the direction type. */
+    typedef  typename Traits::Direction_2       Direction_2;
+
+private:
+
+    typedef  typename Traits::Aff_transformation_2    Transformation;
+
+public:
+    /* Note: No member variables in this class, so a custom constructor is not needed. */
+
+    /*! \brief The operator().
+     *
+     * \details The direction of the first ray can be specified by the parameter `initial_direction`,
+     * which allows the first ray to start at any direction.
+     * This operator first places the `initial_direction` at the
+     * position pointed by `result`. Then, it calculates the remaining directions (cone boundaries)
+     * and output them to `result` in the counterclockwise order.
+     * Finally, the past-the-end iterator for the resulting directions is returned.
+     *
+         * \tparam DirectionOutputIterator  an `OutputIterator` with value type `Direction_2`.
+     * \param cone_number The number of cones
+     * \param initial_direction The direction of the first ray
+     * \param result  The output iterator
+     */
+    template<class DirectionOutputIterator>
+    DirectionOutputIterator operator()(const unsigned int cone_number,
+                                       const Direction_2& initial_direction,
+                                       DirectionOutputIterator result)  {
+        if (cone_number<2) {
+            std::cout << "The number of cones must be larger than 1!" << std::endl;
+            CGAL_assertion(false);
+        }
+
+        *result++ = initial_direction;
+
+        const double cone_angle = 2*CGAL_PI/cone_number;
+        double sin_value, cos_value;
+        Direction_2 ray;
+        for (unsigned int i = 1; i < cone_number; i++) {
+            sin_value = std::sin(i*cone_angle);
+            cos_value = std::cos(i*cone_angle);
+            ray = Transformation(cos_value, -sin_value, sin_value, cos_value)(initial_direction);
+            *result++ = ray;
+        }
+
+        return result;
+    } // end of operator
+
+};
+
+
+/*
+ The specialised functor for computing the directions of cone boundaries exactly
+ with a given cone number and a given initial direction.
+*/
+template <>
+class Compute_cone_boundaries_2<Exact_predicates_exact_constructions_kernel_with_root_of> {
+
+public:
+    /* Indicate the type of the cgal kernel. */
+    typedef  Exact_predicates_exact_constructions_kernel_with_root_of  Kernel_type;
+
+private:
+    typedef Kernel_type::FT            FT;
+    typedef Kernel_type::Direction_2   Direction_2;
+    typedef Kernel_type::Aff_transformation_2   Transformation;
+
+public:
+    /* Note: No member variables in this class, so a Constructor is not needed. */
+
+    /* The operator().
+
+      The direction of the first ray can be specified by the parameter
+      initial_direction, which allows the first ray to start at any direction.
+      The remaining directions are calculated in counter-clockwise order.
+
+      \param cone_number The number of cones
+      \param initial_direction The direction of the first ray
+      \param result  The output iterator
+    */
+    template<typename DirectionOutputIterator>
+    DirectionOutputIterator operator()(const unsigned int cone_number,
+                                       const Direction_2& initial_direction,
+                                       DirectionOutputIterator result)  {
+
+        if (cone_number<2) {
+            std::cout << "The number of cones must be larger than 1!" << std::endl;
+            std::exit(1);
+        }
+
+        // Since CGAL::root_of() gives the k-th smallest root,
+        // here -x is actually used instead of x.
+        // But we want the second largest one with no need to count.
+        Polynomial<FT> x(CGAL::shift(Polynomial<FT>(-1), 1));
+        Polynomial<FT> double_x(2*x);
+        Polynomial<FT> a(1), b(x);
+        for (unsigned int i = 2; i <= cone_number; ++i) {
+            Polynomial<FT> c = double_x*b - a;
+            a = b;
+            b = c;
+        }
+        a = b - 1;
+
+        unsigned int m, i;
+        bool is_even;
+        if (cone_number % 2 == 0) {
+            is_even = true;
+            m = cone_number/2;       // for even number of cones
+        }
+        else {
+            m= cone_number/2 + 1;    // for odd number of cones
+            is_even = false;
+        }
+
+        FT cos_value, sin_value;
+        // for storing the intermediate result
+        Direction_2 ray;
+        // For saving the first half number of rays when cone_number is even
+        std::vector<Direction_2> ray_store;
+
+        // add the first half number of rays in counter clockwise order
+        for (i = 1; i <= m; i++) {
+            cos_value = - root_of(i, a.begin(), a.end());
+            sin_value = sqrt(FT(1) - cos_value*cos_value);
+            ray = Transformation(cos_value, -sin_value, sin_value, cos_value)(initial_direction);
+            *result++ = ray;
+            if (is_even)
+                ray_store.push_back(ray);
+        }
+
+        // add the remaining half number of rays in ccw order
+        if (is_even) {
+            for (i = 0; i < m; i++) {
+                *result++ = -ray_store[i];
+            }
+        } else {
+            for (i = 0; i < m-1; i++) {
+                cos_value = - root_of(m-i, a.begin(), a.end());
+                sin_value = - sqrt(FT(1) - cos_value*cos_value);
+                ray = Transformation(cos_value, -sin_value, sin_value, cos_value)(initial_direction);
+                *result++ = ray;
+            }
+        }
+
+        return result;
+
+    };      // end of operator()
+};      // end of functor specialization: Compute_cone_..._2
+
+}  // namespace CGAL
+
+#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Concatenate_iterator.h b/3rdparty/CGAL/include/CGAL/Concatenate_iterator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Concatenate_iterator.h
rename to 3rdparty/CGAL/include/CGAL/Concatenate_iterator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Concurrent_compact_container.h b/3rdparty/CGAL/include/CGAL/Concurrent_compact_container.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Concurrent_compact_container.h
rename to 3rdparty/CGAL/include/CGAL/Concurrent_compact_container.h
diff --git a/3rdparty/CGAL/include/CGAL/Cone_spanners_2/Less_by_direction_2.h b/3rdparty/CGAL/include/CGAL/Cone_spanners_2/Less_by_direction_2.h
new file mode 100644
index 0000000..c18353f
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Cone_spanners_2/Less_by_direction_2.h
@@ -0,0 +1,107 @@
+// Copyright (c) 2013-2015  The University of Western Sydney, Australia.
+// 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
+// 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$
+//
+//
+// Authors: Weisheng Si, Quincy Tse
+
+#ifndef CGAL_LESS_BY_DIRECTION_2_H
+#define CGAL_LESS_BY_DIRECTION_2_H
+
+#include <iostream>
+#include <cstdlib>
+#include <utility>
+#include <CGAL/Polynomial.h>
+#include <CGAL/number_utils.h>
+#include <CGAL/enum.h>
+#include <CGAL/Exact_predicates_exact_constructions_kernel_with_sqrt.h>
+#include <CGAL/Aff_transformation_2.h>
+
+#include <boost/config.hpp>
+#include <boost/graph/adjacency_list.hpp>
+
+namespace CGAL {
+
+/*  Function object that orders 2D graph vertex_descriptors based on the order
+ *  induced by the direction D described in the book:
+ *
+ *  Giri Narasimhan and Michiel Smid, Chapter 4: Spanners based on the Theta graph, Geometric Spanner Networks,
+ *  Cambridge University Press, 2007.
+ *
+ *  The ties are broken according to the direction of ccw90(D).
+ *  The way of breaking ties in this functor is intended to prevent the overlapping of cone boundaries.
+ *  As a result, a vertex on the cw boundary will be considered to be inside this cone,
+ *  while a vertex on the ccw boundary will not.
+ *
+ *  This function object is implemented using the function `CGAL::compare_signed_distance_to_line_2()`,
+ *  which orders two points according to their signed distance to a base line.
+ *
+ */
+template <typename Kernel_, typename Graph_>
+class  Less_by_direction_2 : public std::binary_function <typename Graph_::vertex_descriptor,
+        typename Graph_::vertex_descriptor, bool> {
+
+public:
+    // typedef for C++11 - doesn't hurt to also have for C++98
+    typedef typename Graph_::vertex_descriptor first_argument_type;
+    typedef typename Graph_::vertex_descriptor second_argument_type;
+    typedef bool     result_type;
+
+    // typedef for Direction_2 and Line_2
+    typedef typename Kernel_::Direction_2 Direction_2;
+    typedef typename Kernel_::Line_2 Line_2;
+    typedef typename Kernel_::Point_2 Point_2;
+    typedef typename Kernel_::Aff_transformation_2 Transformation;
+
+    // constructor
+    Less_by_direction_2(const Graph_& g, const Direction_2& d)
+        : graph(g), base_line(Point_2(0,0), d) {};
+
+    bool operator() (const typename Graph_::vertex_descriptor& p,
+                     const typename Graph_::vertex_descriptor& q) const {
+        Comparison_result outcome;
+        outcome = compare_signed_distance_to_line(base_line, graph[p], graph[q]);
+        if (outcome == SMALLER)
+            return true;
+        else {
+            if (outcome == LARGER)
+                return false;
+        }
+
+        /* otherwise, outcome == CGAL::EQUAL, ties will be broken by a second order
+         * according to the ccw90(base_line) direction.
+         */
+        // define a rotation of counter clockwise 90
+        Transformation ccw90(0, -1, 1,  0);
+        // rotate
+        Line_2 ccw90_line = ccw90(base_line);
+        outcome = compare_signed_distance_to_line(ccw90_line, graph[p], graph[q]);
+        if (outcome == SMALLER)
+            return true;
+        else
+            return false;
+    }
+
+private:
+    const Graph_& graph;
+    const Line_2 base_line;
+
+};      // class Less_by_direction_2
+
+}  // namespace CGAL
+
+
+#endif
diff --git a/3rdparty/CGAL/include/CGAL/Cone_spanners_2/Plane_scan_tree.h b/3rdparty/CGAL/include/CGAL/Cone_spanners_2/Plane_scan_tree.h
new file mode 100644
index 0000000..d62123d
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Cone_spanners_2/Plane_scan_tree.h
@@ -0,0 +1,255 @@
+// Copyright (c) 2013  The University of Western Sydney, Australia.
+// 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
+// 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(s)     : Quincy Tse, Weisheng Si
+
+/* Plane_scan_tree.h
+ *
+ * This header defines the class Plane_scan_tree, the data structure for the balanced search tree used in
+ * the Narasimhan and Smid's algorithm for constructing Theta graph.
+ * Implementations of members in this class can be found in Plane_scan_tree_impl.h.
+ */
+
+#ifndef CGAL_PLANE_SCAN_TREE_H
+#define CGAL_PLANE_SCAN_TREE_H
+
+#include <iostream>
+#include <algorithm>
+#include <functional>
+#include <cstring>
+
+#include <CGAL/Cone_spanners_2/Plane_scan_tree_impl.h>
+
+namespace CGAL {
+
+/* This namespace contains the internal implementation of the tree for builiding Theta graph.
+ * This is not meant to be imported by other code.
+ */
+namespace ThetaDetail {
+
+/*
+ * This is the balanced tree structure needed in Narasimhan and Smid's book,
+ * but implemented using a partial ternary B+ tree instead of red-black tree.
+ *
+ * This tree supports insert and search only, and, similar to a treap, is able
+ * to determine not only the ordering according to a primary order specified
+ * in the key_compare, but is also able to determine minimum weighted value
+ * according to value_compare. Any single operation on this tree is guaranteed
+ * to be at worst O(log n), and builds the tree from a list at O(nlogn).
+ *
+ * !!! Note: No two keys in the tree may have equal ordering
+ * according to key_compare. Results are undefined if key_compare does not give
+ * unique ordering of the inserted keys. The `Less_by_direction_2` functor implemented
+ * by us guarantees the unique ordering, and is passed to Comp and VComp.
+ *
+ *  see  G. Narasimhan and M. Smid, Geometric Spanner Networks: Cambridge
+ *        University Press, 2007, p. 71
+ */
+template <typename Key,
+         typename T,
+         typename Comp=std::less<Key>,
+         typename VComp=std::less<const T>
+         >
+class Plane_scan_tree {
+private:
+    typedef _Node<Key, T, Comp, VComp>            _node_type;
+    typedef typename  _node_type::_leaf_type      _leaf_type;
+    typedef typename  _node_type::_internal_type  _internal_type;
+
+public:
+    typedef typename  _node_type::key_type      key_type;
+    typedef typename  _node_type::mapped_type   mapped_type;
+    typedef typename  _node_type::value_type    value_type;
+    typedef typename  _node_type::key_compare   key_compare;
+    typedef typename  _node_type::value_compare value_compare;
+
+    typedef           value_type&               reference;
+    typedef           const value_type&         const_reference;
+    typedef           value_type*               pointer;
+    typedef           const value_type*         const_pointer;
+
+    typedef _Iterator<key_type, mapped_type, key_compare, value_compare>
+    iterator;
+    typedef _RIterator<key_type, mapped_type, key_compare, value_compare>
+    reverse_iterator;
+    typedef           iterator                  const_iterator;
+    typedef           reverse_iterator          const_reverse_iterator;
+    typedef           size_t                    size_type;
+
+    /* Explicit Constructor. */
+    explicit Plane_scan_tree (const key_compare& comp = key_compare(),
+                              const value_compare& vcomp = value_compare())
+        : less (comp), vless (vcomp), root (NULL), m_min (NULL),
+          m_max (NULL), _size (0) {}
+
+    /* Constructor */
+    template <typename InputIterator>
+    Plane_scan_tree (InputIterator first, InputIterator last,
+                     const key_compare& comp = key_compare(),
+                     const value_compare& vcomp = value_compare())
+        : less (comp), vless (vcomp), root (NULL), m_min (NULL),
+          m_max (NULL), _size (0)
+    {
+        // buids the tree
+        /* Note: a more efficient algorithm building the tree bottom up may be
+          worth implementing later */
+        for (; first != last; ++first)
+            add (first->first, first->second);
+    }
+
+    /* Destructor. This will recursively destroy all nodes in the tree, making
+     * all iterators and pointers to values stored in this tree invalid.
+     */
+    ~Plane_scan_tree () {
+        delete root;
+        root = NULL;
+        m_min = NULL;
+        m_max = NULL;
+        _size = 0;;
+    }
+
+
+    /* Returns the number of key-value pairs in the tree
+     *
+     * @return The number of key-value pairs in the tree.
+     */
+    size_t size() const {
+        return _size;
+    }
+
+    /* Inserts a key-value pair into the tree.
+     * @param k   The key
+     * @param v   The value
+     */
+    void add (const key_type& k, const mapped_type& v) {
+        if (NULL == root) {
+            m_min = new _leaf_type (less, vless, this);
+            m_max = m_min;
+            root = m_min;
+        }
+        _leaf_type* l = root->leafNode(k);
+        l->add(k, v);
+        _size++;
+    }
+
+    /* find a key */
+    iterator find(const key_type& k) {
+        _leaf_type* l = root->leafNode(k);
+        return iterator (l, k);
+    }
+
+    /* find a constant key */
+    const_iterator find(const key_type& k) const {
+        _leaf_type* l = root->leafNode(k);
+        return const_iterator (l, k);
+    }
+
+    /* Returns the the minimum value that has a key strictly greater than
+     * the specified key.
+     *
+     * @param x The threshold key
+     * @return  The minimum value whose key is strictly greater than x.
+     */
+    const mapped_type* minAbove (const key_type& x) const {
+        if (NULL == root) return NULL;
+        return root->minAbove(x);
+    }
+
+    /* Begin Iterator */
+    inline iterator begin() {
+        return iterator (this->m_min);
+    }
+
+    /* Const Begin Iterator */
+    inline const_iterator begin() const {
+        return const_iterator (this->m_min);
+    }
+
+    /* End Iterator */
+    inline iterator end() {
+        static iterator res;
+
+        return res;
+    }
+
+    /* Constant End Iterator */
+    inline const_iterator end() const {
+        static const_iterator res;
+
+        return res;
+    }
+
+    /* Reverse order Begin Iterator */
+    inline reverse_iterator rbegin() {
+        return reverse_iterator (this->m_max);
+    }
+
+    /* Constant Reverse order Begin Iterator */
+    const_reverse_iterator rbegin() const {
+        return const_reverse_iterator (this->m_max);
+    }
+
+    /* Reverse order End Iterator */
+    reverse_iterator rend() {
+        static reverse_iterator res;
+
+        return res;
+    }
+
+    /* Constant Reverse order End Iterator */
+    const_reverse_iterator rend() const {
+        static const_reverse_iterator res;
+
+        return res;
+    }
+
+    friend class _Leaf<Key, T, Comp, VComp>;
+    friend class _Internal<Key, T, Comp, VComp>;
+
+    friend std::ostream& operator<< (std::ostream& os, const Plane_scan_tree<Key, T, Comp, VComp>& pst) {
+        os << *pst.root << std::endl;
+
+        return os;
+    }
+
+protected:
+private:
+    /* key_compare funtor */
+    const key_compare less;
+
+    /* value_compare funtor */
+    const value_compare vless;
+
+    /* pointer to root */
+    _node_type* root;
+
+    /* pointer to m_min */
+    _leaf_type* m_min;
+
+    /* pointer to m_max */
+    _leaf_type* m_max;
+
+    /* size of the tree */
+    size_t _size;
+};
+
+}    // namespace ThetaDetail
+
+}    // namespace CGAL
+
+#endif
diff --git a/3rdparty/CGAL/include/CGAL/Cone_spanners_2/Plane_scan_tree_impl.h b/3rdparty/CGAL/include/CGAL/Cone_spanners_2/Plane_scan_tree_impl.h
new file mode 100644
index 0000000..1ec02d8
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Cone_spanners_2/Plane_scan_tree_impl.h
@@ -0,0 +1,636 @@
+// Copyright (c) 2013  The University of Western Sydney, Australia.
+// 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
+// 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(s)     : Quincy Tse, Weisheng Si
+
+/* Plane_scan_tree_impl.h
+ *
+ * This header implements the details of the class Plane_scan_tree.
+ */
+
+#ifndef CGAL_CONE_SPANNER_PLANE_SCAN_TREE_IMPL_H
+#define CGAL_CONE_SPANNER_PLANE_SCAN_TREE_IMPL_H
+
+#include <stdexcept>
+
+namespace CGAL {
+
+/* This namespace contains the internal implementation of the tree for building Theta graph.
+ * This is not meant to be imported by other codes.
+ */
+namespace ThetaDetail {
+
+/* Contains the internal data structure for the Plane_scan_tree.
+ *
+ * Plane_scan_tree is a ternary B+ tree using linked structures.
+ */
+template < typename Key, typename T, typename Comp, typename VComp >
+class Plane_scan_tree;
+
+template < typename Key, typename T, typename Comp=std::less<Key>, typename VComp=std::less<const T> >
+class _Node;
+template < typename Key, typename T, typename Comp=std::less<Key>, typename VComp=std::less<const T> >
+class _Leaf;
+template < typename Key, typename T, typename Comp=std::less<Key>, typename VComp=std::less<const T> >
+class _Internal;
+
+template < typename Key, typename T, typename Comp=std::less<Key>, typename VComp=std::less<const T> >
+class _Iterator;
+
+template < typename Key, typename T, typename Comp=std::less<Key>, typename VComp=std::less<const T> >
+class _RIterator;
+
+/* Abstract superclass */
+template < typename Key, typename T, typename Comp, typename VComp >
+class _Node {
+public:
+    typedef Key                                 key_type;
+    typedef T                                   mapped_type;
+    typedef std::pair<const Key, T>             value_type;
+    typedef Comp                                key_compare;
+    typedef VComp                               value_compare;
+
+    typedef _Node<Key, T, Comp, VComp>          _node_type;
+    typedef _Leaf<Key, T, Comp, VComp>          _leaf_type;
+    typedef _Internal<Key, T, Comp, VComp>      _internal_type;
+    typedef Plane_scan_tree<Key, T, Comp, VComp>  tree_type;
+
+    /* Constructor */
+    _Node(const key_compare& less, const value_compare& vless, tree_type *const t)
+        : parent(NULL), less(less), vless(vless), tree(t) {}
+
+    /* Destructor */
+    virtual ~_Node() {}
+
+    /* @return true if the node is a leaf node, false otherwise. */
+    virtual bool isLeaf() const = 0;
+
+    /* Retrieves the leaf node that handles the specified key.
+     *
+     * @param k The key being queried
+     * @return The leaf node that handles the key.
+     */
+    virtual _leaf_type* leafNode(const key_type& k) = 0;
+
+    /* Returns the minimum value whose key is greater than x.
+     *
+     * @param x The threshold key
+     * @return the minimum value whose key is greater than x.
+     */
+    virtual const mapped_type* minAbove(const key_type& x) const = 0;
+
+    friend std::ostream& operator<< (std::ostream& os, const _node_type& n) {
+        n.print(os, 0);
+        return os;
+    }
+
+protected:
+    /* Prints a string representation of the node in the ostream. */
+    virtual void print(std::ostream&, const size_t) const = 0;
+
+    /* Sets the parent internal node for the node */
+    void setParent(_internal_type *const p) {
+        parent = p;
+    }
+
+    /* Returns the minimum value in the subtree rooted at the current node. */
+    virtual const mapped_type* minV() const = 0;
+
+    _internal_type* parent;
+    const key_compare& less;
+    const value_compare& vless;
+    tree_type* tree;
+
+    friend class _Leaf<key_type, mapped_type, key_compare, value_compare>;
+    friend class _Internal<key_type, mapped_type, key_compare, value_compare>;
+};
+
+/* Leaf node of the B+ tree. */
+template < typename Key, typename T, typename Comp, typename VComp >
+class _Leaf : public _Node<Key, T, Comp, VComp> {
+public:
+    typedef _Node<Key, T, Comp, VComp>  _node_type;
+
+    typedef typename _node_type::key_type       key_type;
+    typedef typename _node_type::mapped_type    mapped_type;
+    typedef typename _node_type::value_type     value_type;
+    typedef typename _node_type::key_compare    key_compare;
+    typedef typename _node_type::value_compare  value_compare;
+
+    typedef typename _node_type::_leaf_type     _leaf_type;
+    typedef typename _node_type::_internal_type _internal_type;
+    typedef typename _node_type::tree_type      tree_type;
+
+    _Leaf (const key_compare& less, const value_compare& vless, tree_type *const t,
+           _leaf_type *const prev = NULL,
+           _leaf_type *const next = NULL)
+        : _node_type (less, vless, t), prev (prev), next (next) {
+        std::memset (values, 0, 2*sizeof(value_type*));
+    }
+
+    /* Destructor.
+     * Frees memory used for storing key-value pair, thus invalidating any
+     * exisitng pointers to any keys and/or values in the tree. During and
+     * after destruction, neighbour nodes are not guarenteed to be consistent.
+     * Specifically, the linked list along the leaves of the B+ tree is
+     * invalidated. */
+    virtual ~_Leaf() {
+        delete values[0];
+        delete values[1];
+        values[0] = NULL;
+        values[1] = NULL;
+        prev = NULL;
+        next = NULL;
+    }
+
+    virtual bool isLeaf() const {
+        return true;
+    }
+
+    virtual _leaf_type* leafNode(const key_type&) {
+        return this;
+    }
+
+    void add(const key_type& k, const mapped_type& v) {
+        if (NULL == values[0]) {
+            // empty
+            values[0] = new value_type(k, v);
+        } else if (NULL == values[1]) {
+            // Not full;
+            if (this->less(k, values[0]->first)) {
+                values[1] = values[0];
+                values[0] = new value_type(k, v);
+                if (this->parent && this->vless(v, values[1]->second))
+                    this->parent->updateMin(this);
+            } else {
+                values[1] = new value_type(k, v);
+                if (this->parent && this->vless(v, values[0]->second))
+                    this->parent->updateMin(this);
+            }
+        } else {
+            _leaf_type* split
+                = new _leaf_type(this->less, this->vless, this->tree, this, next);
+            if (NULL != next) next->prev = split;
+            next = split;
+            if (this->less(k, values[0]->first)) {
+                // k, [0], [1]
+                split->values[0] = values[0];
+                split->values[1] = values[1];
+                values[0] = new value_type(k, v);
+                values[1] = NULL;
+            } else if (this->less(k, values[1]->first)) {
+                // [0], k, [1]
+                split->values[0] = new value_type(k, v);
+                split->values[1] = values[1];
+                values[1] = NULL;
+            } else {
+                split->values[0] = values[1];
+                split->values[1] = new value_type(k, v);
+                values[1] = NULL;
+            }
+
+            // Update pointer to max leaf (for reverse iterator)
+            if (this->tree->m_max == this) this->tree->m_max = split;
+
+            // Create new parent node current node is not root
+            if (NULL == this->parent) {
+                this->setParent(new _internal_type(this->less, this->vless, this->tree));
+                this->tree->root = this->parent;
+            }
+            // Promote middle key and get parent to readjust pointers
+            this->parent->splitMe (&(split->values[0]->first), this, split);
+        }
+    }
+
+    virtual const mapped_type* minAbove(const key_type& x) const {
+        if ( !this->less(x, values[0]->first) && !this->less(values[0]->first, x) // equals
+                && NULL != values[1]) {
+            return &values[1]->second;
+        }
+        return NULL;
+    }
+
+    virtual const mapped_type* minV() const {
+        return (NULL == values[1]) ? &values[0]->second : &(std::min)(values[0]->second, values[1]->second, this->vless);
+    }
+
+protected:
+    virtual void print(std::ostream& os, const size_t /* level */) const {
+        os << "\t\"" << this << "\"--\"" << &(values[0]->first) << "\" [style=bold];" << std::endl;
+        os << "\t" << "{rank=same; \"" << &(values[0]->first) << "\"--\"" << &(values[0]->second) << "\" [style=dotted];}" << std::endl;
+        os << "\t\"" << &(values[0]->first) << "\"--\"" << values[0]->first << "\";" << std::endl;
+        os << "\t\"" << &(values[0]->second) << "\"--\"" << values[0]->second << "\";" << std::endl;
+        if (NULL != values[1]) {
+            os << "\t\"" << this << "\"--\"" << &(values[1]->first) << "\" [style=bold];" << std::endl;
+            os << "\t" << "{rank=same; \"" << &(values[1]->first) << "\"--\"" << &(values[1]->second) << "\" [style=dotted];}" << std::endl;
+            os << "\t" << "{rank=same; \"" << &(values[0]->second) << "\"--\"" << &(values[1]->first) << "\" [color=white]; rankdir=LR;}" << std::endl;
+            os << "\t\"" << &(values[1]->first) << "\"--\"" << values[1]->first << "\";" << std::endl;
+            os << "\t\"" << &(values[1]->second) << "\"--\"" << values[1]->second << "\";" << std::endl;
+        }
+        os << "\t\"" << this << "\" [style=diagonals];" << std::endl;
+    }
+
+private:
+    /* Key-value pairs */
+    value_type* values[2];
+
+    /* Linked list structure of the B+ tree */
+    _leaf_type* prev;
+    _leaf_type* next;
+
+    friend class _Iterator<key_type, mapped_type, key_compare, value_compare>;
+    friend class _RIterator<key_type, mapped_type, key_compare, value_compare>;
+};
+
+template < typename Key, typename T, typename Comp, typename VComp >
+class _Internal : public _Node<Key, T, Comp, VComp> {
+public:
+    typedef _Node<Key, T, Comp, VComp>  _node_type;
+
+    typedef typename _node_type::key_type       key_type;
+    typedef typename _node_type::mapped_type    mapped_type;
+    typedef typename _node_type::value_type     value_type;
+    typedef typename _node_type::key_compare    key_compare;
+    typedef typename _node_type::value_compare  value_compare;
+
+    typedef typename _node_type::_leaf_type     _leaf_type;
+    typedef typename _node_type::_internal_type _internal_type;
+    typedef typename _node_type::tree_type      tree_type;
+
+    _Internal (const Comp& less, const VComp& vless, tree_type *const t)
+        : _node_type(less, vless, t) {
+        std::memset (keys, 0, 2*sizeof(key_type*));
+        std::memset (children, 0, 3*sizeof(_node_type*));
+        std::memset (vMin, 0, 3*sizeof(mapped_type*));
+    }
+
+    virtual ~_Internal() {
+        keys[0] = NULL;
+        keys[1] = NULL;
+
+        delete children[0];
+        children[0] = NULL;
+        delete children[1];
+        children[1] = NULL;
+        delete children[2];
+        children[2] = NULL;
+
+        vMin[0] = NULL;
+        vMin[1] = NULL;
+        vMin[2] = NULL;
+    }
+
+    virtual bool isLeaf() const {
+        return false;
+    }
+
+    virtual _leaf_type* leafNode(const key_type& k) {
+        int i = 0;
+        for (i = 0; (i < 2) && (NULL != keys[i]); i++) {
+            if (this->less(k, *(keys[i]))) return children[i]->leafNode(k);
+        }
+        return children[i]->leafNode(k);
+    }
+
+    /* Update references to min values.
+     *
+     *  @param ch   The child node involved.
+     */
+    void updateMin(const _node_type *const ch) {
+        int i = 0;
+        while (i < 3) {
+            if (children[i] == ch) break;
+            ++i;
+        }
+        if (i >= 3)
+            throw std::runtime_error("Cannot find child");
+
+        vMin[i] = ch->minV();
+        if (this->parent && minV() == vMin[i])
+            this->parent->updateMin(this);
+    }
+
+    /* Process the splitting of children. This is called by the affected
+     * child AFTER splitting had occurred. This function updates relevant
+     * pointers, and splits current internal node as necessary.
+     *
+     * @param k     The key the child was split on.
+     * @param left  The (existing) child that lies to the left of k.
+     * @param right The (new) child that lies to the right of k.
+     */
+    void splitMe(const key_type *const k,
+                 _node_type *const left,
+                 _node_type *const right) {
+        if (keys[0] == NULL) {
+            // New root
+            keys[0] = k;
+            children[0] = left;
+            left->setParent(this);
+            vMin[0] = left->minV();
+            children[1] = right;
+            right->setParent(this);
+            vMin[1] = right->minV();
+        } else if (keys[1] == NULL) {
+            // not full
+            if (left == children[0]) {
+                // split 0th
+                keys[1] = keys[0];
+                keys[0] = k;
+                children[2] = children[1];
+                children[1] = right;
+                right->setParent(this);
+
+                vMin[0] = children[0]->minV();
+                vMin[1] = children[1]->minV();
+                vMin[2] = children[2]->minV();
+            } else {
+                // split 1st
+                keys[1] = k;
+                children[2] = right;
+                right->setParent(this);
+
+                // did not touch children[0]
+                vMin[1] = children[1]->minV();
+                vMin[2] = children[2]->minV();
+            }
+            if (this->parent)
+                this->parent->updateMin(this);
+        } else {
+            // full
+            _internal_type* split
+                = new _internal_type(this->less, this->vless, this->tree);
+            const key_type * toPromote;
+            if (left == children[0]) {
+                // Split 0th
+                split->keys[0] = keys[1];
+                toPromote = keys[0];
+                keys[1] = NULL;
+                keys[0] = k;
+
+                split->children[1] = children[2];
+                split->vMin[1] = split->children[1]->minV();
+                split->children[1]->setParent(split);
+
+                split->children[0] = children[1];
+                split->vMin[0] = split->children[0]->minV();
+                split->children[0]->setParent(split);
+
+                children[1] = right;
+                vMin[1] = children[1]->minV();
+                children[1]->setParent(this);
+
+                vMin[0] = children[0]->minV();
+
+                children[2] = NULL;
+                vMin[2] = NULL;
+            } else if (left == children[1]) {
+                // Split 1st
+                split->keys[0] = keys[1];
+                toPromote = k;
+                keys[1] = NULL;
+
+                split->children[1] = children[2];
+                split->vMin[1] = split->children[1]->minV();
+                split->children[1]->setParent(split);
+
+                split->children[0] = right;
+                split->vMin[0] = split->children[0]->minV();
+                split->children[0]->setParent(split);
+
+                vMin[1] = children[1]->minV();
+
+                children[2] = NULL;
+                vMin[2] = NULL;
+            } else {
+                // Split last
+                split->keys[0] = k;
+                toPromote = keys[1];
+                keys[1] = NULL;
+
+                split->children[1] = right;
+                split->vMin[1] = split->children[1]->minV();
+                split->children[1]->setParent(split);
+
+                split->children[0] = left;
+                split->vMin[0] = split->children[0]->minV();
+                split->children[0]->setParent(split);
+
+                children[2] = NULL;
+                vMin[2] = NULL;
+            }
+
+            if (NULL == this->parent) {
+                this->setParent(new _internal_type(this->less, this->vless, this->tree));
+                this->tree->root = this->parent;
+            }
+
+            this->parent->splitMe (toPromote, this, split);
+        }
+    }
+
+    virtual const mapped_type* minAbove(const key_type& x) const {
+        if (this->less(x, *keys[0])) {
+            // x in left tree
+            const mapped_type* minFromCh = children[0]->minAbove(x);
+            const mapped_type* res =
+                (NULL == minFromCh) ?
+                vMin[1] :
+                &(std::min) (*children[0]->minAbove(x), *vMin[1], this->vless);
+            if (vMin[2] != NULL)
+                res = &(std::min) (*res, *vMin[2], this->vless);
+            return res;
+        } else if (NULL == keys[1] || this->less(x, *keys[1])) {
+            // x in middle
+            const mapped_type* res = children[1]->minAbove(x);
+            if (NULL == res) return vMin[2];
+
+            if (vMin[2] != NULL)
+                res = &(std::min) (*res, *vMin[2], this->vless);
+            return res;
+        } else {
+            return children[2]->minAbove(x);
+        }
+    }
+
+    virtual const mapped_type* minV() const {
+        const mapped_type* res = &(std::min)(*vMin[0], *vMin[1], this->vless);
+        if (NULL != children[2])
+            res = &(std::min)(*res, *vMin[2], this->vless);
+        return res;
+    }
+
+protected:
+    virtual void print(std::ostream& os, const size_t level) const {
+        os << "\t\"" << this << "\"--\"" << children[0] << "\";" << std::endl;
+        os << "\t\"" << this << "\"--\"" << children[1] << "\";" << std::endl;
+        if (NULL != children[2])
+            os << "\t\"" << this << "\"--\"" << children[2] << "\";" << std::endl;
+
+        children[0]->print(os, level+1);
+        children[1]->print(os, level+1);
+        if (NULL != children[2])
+            children[2]->print(os, level+1);
+
+        os << "\t\"" << this << "\"--\"" << vMin[0] << "\" [style=dashed,label=vMin0];" << std::endl;
+        os << "\t\"" << this << "\"--\"" << vMin[1] << "\" [style=dashed,label=vMin1];" << std::endl;
+        if (NULL != vMin[2])
+            os << "\t\"" << this << "\"--\"" << vMin[2] << "\" [style=dashed,label=vMin2];" << std::endl;
+
+        os << "\t\"" << this << "\"--\"" << keys[0] << "\" [style=dotted,label=keys0];" << std::endl;
+        if (NULL != keys[1])
+            os << "\t\"" << this << "\"--\"" << keys[1] << "\" [style=dotted,label=keys1];" << std::endl;
+    }
+
+private:
+    const key_type* keys[2];
+    _node_type* children[3];
+    const mapped_type* vMin[3];
+};
+
+template <typename Key, typename T, typename Comp, typename VComp >
+class _Iterator {
+public:
+    typedef           _Leaf<Key, T, Comp, VComp>      leaf_type;
+
+    typedef typename  leaf_type::value_type           value_type;
+    typedef           _Iterator<Key, T, Comp, VComp>  iterator_type;
+
+    _Iterator(leaf_type* start = NULL) : cell (0), leaf(start) {}
+    _Iterator(leaf_type* start, const Key& key) : cell(0), leaf(start) {
+        if (start->values[0]->first != key) {
+            if (!start->values[1] || start->values[1]->first != key)
+                leaf = NULL;
+            else
+                cell = 1;
+        }
+    }
+    ~_Iterator() {
+        cell = 0;
+        leaf = NULL;
+    }
+
+    value_type& operator*() const {
+        return *(leaf->values[cell]);
+    }
+
+    value_type* operator->() const {
+        return leaf->values[cell];
+    }
+
+    iterator_type& operator++() {
+        cell++;
+        if (NULL == leaf) return *this;
+
+        if (cell > 1 || NULL == leaf->values[cell]) {
+            cell = 0;
+            leaf = leaf->next;
+        }
+        return *this;
+    }
+
+    iterator_type operator++(int) {
+        iterator_type res (*this);
+        ++(*this);
+        return res;
+    }
+
+    bool operator==(const iterator_type& x) const {
+        return (leaf == x.leaf) && (cell == x.cell);
+    }
+
+    bool operator!=(const iterator_type& x) const {
+        return (leaf != x.leaf) || (cell != x.cell);
+    }
+
+private:
+    size_t cell;
+    leaf_type* leaf;
+
+    friend class _Node<Key, T, Comp, VComp>;
+};
+
+template <typename Key, typename T, typename Comp, typename VComp >
+class _RIterator {
+public:
+    typedef           _Leaf<Key, T, Comp, VComp>      leaf_type;
+
+    typedef typename  leaf_type::value_type           value_type;
+    typedef           _RIterator<Key, T, Comp, VComp> iterator_type;
+
+    _RIterator(_Leaf<Key, T, Comp, VComp>* start = NULL) : cell (1), leaf(start) {
+        if (NULL == start) return;
+
+        if (NULL == leaf->values[cell]) {
+            cell--;
+            if (NULL == leaf->values[cell]) leaf = NULL;
+        }
+    }
+
+    ~_RIterator() {
+        cell = 0;
+        leaf = NULL;
+    }
+
+    value_type& operator*() const {
+        return *(leaf->values[cell]);
+    }
+
+    value_type* operator->() const {
+        return leaf->values[cell];
+    }
+
+    iterator_type& operator++() {
+        if (NULL == leaf) return *this;
+        if (cell == 1) {
+            cell--;
+        } else if (cell == 0) {
+            cell = 1;
+            leaf = leaf->prev;
+            if (NULL == leaf) return *this;
+
+            if (NULL == leaf->values[cell]) cell--;
+        }
+        return *this;
+    }
+
+    iterator_type operator++(int) {
+        iterator_type res (*this);
+        ++(*this);
+        return res;
+    }
+
+    bool operator==(const iterator_type& x) const {
+        return (leaf == x.leaf) && (cell == x.cell);
+    }
+
+    bool operator!=(const iterator_type& x) const {
+        return (leaf != x.leaf) || (cell != x.cell);
+    }
+
+private:
+    size_t cell;
+    leaf_type* leaf;
+
+    friend class _Node<Key, T, Comp, VComp>;
+};
+
+}    // namespace ThetaDetail
+
+}   // namespace CGAL
+
+#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/ConicCPA2.h b/3rdparty/CGAL/include/CGAL/ConicCPA2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/ConicCPA2.h
rename to 3rdparty/CGAL/include/CGAL/ConicCPA2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/ConicHPA2.h b/3rdparty/CGAL/include/CGAL/ConicHPA2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/ConicHPA2.h
rename to 3rdparty/CGAL/include/CGAL/ConicHPA2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Conic_2.h b/3rdparty/CGAL/include/CGAL/Conic_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Conic_2.h
rename to 3rdparty/CGAL/include/CGAL/Conic_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Conic_misc.h b/3rdparty/CGAL/include/CGAL/Conic_misc.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Conic_misc.h
rename to 3rdparty/CGAL/include/CGAL/Conic_misc.h
diff --git a/3rdparty/CGAL/include/CGAL/Constrained_Delaunay_triangulation_2.h b/3rdparty/CGAL/include/CGAL/Constrained_Delaunay_triangulation_2.h
new file mode 100644
index 0000000..167393e
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Constrained_Delaunay_triangulation_2.h
@@ -0,0 +1,981 @@
+// Copyright (c) 1997  INRIA Sophia-Antipolis (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
+// 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(s)     : Mariette Yvinec, Jean Daniel Boissonnat
+ 
+#ifndef CGAL_CONSTRAINED_DELAUNAY_TRIANGULATION_2_H
+#define CGAL_CONSTRAINED_DELAUNAY_TRIANGULATION_2_H
+
+#include <CGAL/triangulation_assertions.h>
+#include <CGAL/Constrained_triangulation_2.h>
+#include <CGAL/Triangulation_2/insert_constraints.h>
+
+#ifndef CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
+#include <CGAL/Spatial_sort_traits_adapter_2.h>
+#include <CGAL/internal/info_check.h>
+#include <CGAL/is_iterator.h>
+
+#include <boost/iterator/zip_iterator.hpp>
+#include <boost/mpl/and.hpp>
+
+namespace CGAL {
+
+namespace internal{
+
+template <class T,bool has_info=is_iterator<T>::value>
+struct Get_iterator_value_type{
+ struct type{};
+};
+
+template <class T>
+struct Get_iterator_value_type<T,true>{
+ typedef typename std::iterator_traits<T>::value_type type;
+};
+
+} } //namespace CGAL::internal
+#endif //CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
+
+
+
+namespace CGAL {
+
+
+template <class Gt,
+          class Tds_ = Default ,
+	  class Itag_ = Default>
+class Constrained_Delaunay_triangulation_2
+  : public  Constrained_triangulation_2<Gt, Tds_, Itag_>
+{
+public:
+  typedef Constrained_triangulation_2<Gt,Tds_,Itag_>            Ctr;
+  typedef typename Ctr::Tds Tds;
+  typedef typename Ctr::Itag Itag;
+
+  typedef Constrained_Delaunay_triangulation_2<Gt,Tds_,Itag_>    CDt;
+  typedef typename Ctr::Geom_traits      Geom_traits;
+  typedef typename Ctr::Intersection_tag Intersection_tag;
+
+  typedef typename Ctr::Constraint    Constraint;
+  typedef typename Ctr::Vertex_handle Vertex_handle;
+  typedef typename Ctr::Face_handle   Face_handle;
+  typedef typename Ctr::Edge          Edge;
+  typedef typename Ctr::Finite_faces_iterator Finite_faces_iterator;
+  typedef typename Ctr::Face_circulator       Face_circulator;
+  typedef typename Ctr::size_type             size_type;
+  typedef typename Ctr::Locate_type           Locate_type;
+ 
+  typedef typename Ctr::List_edges List_edges;  
+  typedef typename Ctr::List_faces List_faces;
+  typedef typename Ctr::List_vertices  List_vertices;
+  typedef typename Ctr::List_constraints List_constraints;
+  typedef typename Ctr::Less_edge less_edge;
+  typedef typename Ctr::Edge_set Edge_set;
+
+#ifndef CGAL_CFG_USING_BASE_MEMBER_BUG_2
+  using Ctr::geom_traits;
+  using Ctr::number_of_vertices;
+  using Ctr::finite_faces_begin;
+  using Ctr::finite_faces_end;
+  using Ctr::dimension;
+  using Ctr::cw;
+  using Ctr::ccw;
+  using Ctr::infinite_vertex;
+  using Ctr::side_of_oriented_circle;
+  using Ctr::is_infinite;
+  using Ctr::collinear_between;
+  using Ctr::are_there_incident_constraints;
+  using Ctr::make_hole;
+  // The next using statement makes trouble for VC++ with the version
+  // of the method that is templated with PointIterator
+  // VC++ cannot disambiguate between this method and the method of the base class
+  // using Ctr::insert_constraint;
+  using Ctr::locate;
+  using Ctr::test_dim_down;
+  using Ctr::fill_hole_delaunay;
+  using Ctr::update_constraints;
+  using Ctr::delete_vertex;
+  using Ctr::push_back;
+#endif
+
+  typedef typename Geom_traits::Point_2  Point;
+
+  Constrained_Delaunay_triangulation_2(const Geom_traits& gt=Geom_traits()) 
+    : Ctr(gt) { }
+
+  Constrained_Delaunay_triangulation_2(const CDt& cdt)
+    : Ctr(cdt) {}
+
+  Constrained_Delaunay_triangulation_2(const List_constraints& lc,
+				       const Geom_traits& gt=Geom_traits())
+    : Ctr(gt) 
+    {
+      insert_constraints(lc.begin(), lc.end());
+      CGAL_triangulation_postcondition( is_valid() );
+    }
+
+  template<class InputIterator>
+  Constrained_Delaunay_triangulation_2(InputIterator it,
+				       InputIterator last,
+				       const Geom_traits& gt=Geom_traits() )
+    : Ctr(gt) 
+    {
+      insert_constraints(it, last);
+      CGAL_triangulation_postcondition( is_valid() );
+    }
+
+  virtual ~Constrained_Delaunay_triangulation_2() {}
+  
+
+  // FLIPS
+  bool is_flipable(Face_handle f, int i, bool perturb = true) const;
+  void flip(Face_handle& f, int i);
+  void flip_around(Vertex_handle va);
+  void flip_around(List_vertices & new_vertices);
+#ifndef CGAL_CDT2_USE_RECURSIVE_PROPAGATING_FLIP
+  void non_recursive_propagating_flip(Face_handle f,int i);
+  void propagating_flip(Face_handle f,int i, int depth=0);
+#else
+  void propagating_flip(Face_handle f,int i);
+#endif
+  void propagating_flip(List_edges & edges);
+
+  // CONFLICTS
+  bool test_conflict(Face_handle fh, const Point& p) const; //deprecated
+  bool test_conflict(const Point& p, Face_handle fh) const;
+  void find_conflicts(const Point& p, std::list<Edge>& le,  //deprecated
+		      Face_handle hint= Face_handle()) const;
+  //  //template member functions, declared and defined at the end 
+  // template <class OutputItFaces, class OutputItBoundaryEdges> 
+  // std::pair<OutputItFaces,OutputItBoundaryEdges>
+  // get_conflicts_and_boundary(const Point  &p, 
+  // 		                OutputItFaces fit, 
+  // 		                OutputItBoundaryEdges eit,
+  // 		                Face_handle start) const;
+  // template <class OutputItFaces>
+  // OutputItFaces
+  // get_conflicts (const Point  &p, 
+  //                OutputItFaces fit, 
+  // 		    Face_handle start ) const;
+  // template <class OutputItBoundaryEdges>
+  // OutputItBoundaryEdges
+  // get_boundary_of_conflicts(const Point  &p, 
+  // 			       OutputItBoundaryEdges eit, 
+  // 			       Face_handle start ) const;
+
+  // INSERTION-REMOVAL
+  Vertex_handle insert(const Point & a, Face_handle start = Face_handle());
+  Vertex_handle insert(const Point& p,
+		       Locate_type lt,
+		       Face_handle loc, int li );
+  Vertex_handle push_back(const Point& a);
+//   template < class InputIterator >
+//   std::ptrdiff_t insert(InputIterator first, InputIterator last);
+
+  void remove(Vertex_handle v);
+  void remove_incident_constraints(Vertex_handle v);
+  void remove_constrained_edge(Face_handle f, int i);
+//  template <class OutputItFaces>
+//  OutputItFaces
+//  remove_constrained_edge(Face_handle f, int i, OutputItFaces out)
+ 
+  //for backward compatibility
+  void insert(Point a, Point b) { insert_constraint(a, b);}
+
+  void insert(Vertex_handle va, Vertex_handle  vb) {insert_constraint(va,vb);}
+
+  void insert_constraint(Vertex_handle va, Vertex_handle  vb)
+  {
+    ((Ctr*)this)->insert_constraint(va,vb);
+  }
+
+  void
+  insert_constraint(const Point& a, const Point& b)
+  {
+    ((Ctr*)this)->insert_constraint(a,b);
+  }
+
+  template <class PointIterator>
+  void insert_constraint(PointIterator first, PointIterator last, bool close=false)
+  {
+    if(first == last){
+      return;
+    }
+    const Point& p0 = *first;
+    Point p = p0;
+    Vertex_handle v0 = insert(p0), v(v0), w(v0);
+    ++first;
+    for(; first!=last; ++first){
+      const Point& q = *first;
+      if(p != q){
+        w = insert(q);
+        insert_constraint(v,w);
+        v = w;
+        p = q;
+      }
+    }
+    if(close && (p != p0)){
+      insert(w,v0);
+    }
+  }
+
+
+  void remove_constraint(Face_handle f, int i){remove_constrained_edge(f,i);}
+
+  // CHECK
+  bool is_valid(bool verbose = false, int level = 0) const;
+ 
+protected:
+  virtual Vertex_handle virtual_insert(const Point & a, 
+				       Face_handle start = Face_handle());
+  virtual Vertex_handle virtual_insert(const Point& a,
+				       Locate_type lt,
+				       Face_handle loc, 
+				       int li );
+//Vertex_handle special_insert_in_edge(const Point & a, Face_handle f, int i);
+  void remove_2D(Vertex_handle v );
+  virtual void triangulate_hole(List_faces& intersected_faces,
+				List_edges& conflict_boundary_ab,
+				List_edges& conflict_boundary_ba);
+
+public:
+  // MESHING 
+  // suppressed meshing functions from here
+
+  //template member functions
+public:
+  template < class InputIterator >
+#ifndef CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
+  std::ptrdiff_t
+  insert( InputIterator first, InputIterator last,
+          typename boost::enable_if<
+            boost::is_convertible<
+                typename internal::Get_iterator_value_type< InputIterator >::type,
+                Point
+            >
+          >::type* = NULL
+  )
+#else
+#if defined(_MSC_VER)
+  std::ptrdiff_t insert(InputIterator first, InputIterator last, int i = 0)
+#else
+    std::ptrdiff_t insert(InputIterator first, InputIterator last) 
+#endif
+#endif
+    {
+      size_type n = number_of_vertices();
+
+      std::vector<Point> points (first, last);
+      spatial_sort (points.begin(), points.end(), geom_traits());
+      Face_handle f;
+      for (typename std::vector<Point>::const_iterator p = points.begin(), end = points.end();
+              p != end; ++p)
+          f = insert (*p, f)->face();
+
+      return number_of_vertices() - n;
+    }
+
+#ifndef CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
+private:
+  //top stands for tuple-or-pair
+  template <class Info>
+  const Point& top_get_first(const std::pair<Point,Info>& pair) const { return pair.first; }
+  template <class Info>
+  const Info& top_get_second(const std::pair<Point,Info>& pair) const { return pair.second; }
+  template <class Info>
+  const Point& top_get_first(const boost::tuple<Point,Info>& tuple) const { return boost::get<0>(tuple); }
+  template <class Info>
+  const Info& top_get_second(const boost::tuple<Point,Info>& tuple) const { return boost::get<1>(tuple); }
+
+  template <class Tuple_or_pair,class InputIterator>
+  std::ptrdiff_t insert_with_info(InputIterator first,InputIterator last)
+  {
+    size_type n = this->number_of_vertices();
+    std::vector<std::size_t> indices;
+    std::vector<Point> points;
+    std::vector<typename Tds::Vertex::Info> infos;
+    std::size_t index=0;
+    for (InputIterator it=first;it!=last;++it){
+      Tuple_or_pair value=*it;
+      points.push_back( top_get_first(value)  );
+      infos.push_back ( top_get_second(value) );
+      indices.push_back(index++);
+    }
+
+    typedef typename Pointer_property_map<Point>::type Pmap;
+    typedef Spatial_sort_traits_adapter_2<Geom_traits,Pmap> Search_traits;
+
+    spatial_sort(indices.begin(),
+                 indices.end(),
+                 Search_traits(make_property_map(points),geom_traits()));
+
+    Vertex_handle v_hint;
+    Face_handle hint;
+    for (typename std::vector<std::size_t>::const_iterator
+      it = indices.begin(), end = indices.end();
+      it != end; ++it){
+      v_hint = insert(points[*it], hint);
+      if (v_hint!=Vertex_handle()){
+        v_hint->info()=infos[*it];
+        hint=v_hint->face();
+      }
+    }
+
+    return this->number_of_vertices() - n;
+  }
+
+public:
+
+  template < class InputIterator >
+  std::ptrdiff_t
+  insert( InputIterator first,
+          InputIterator last,
+          typename boost::enable_if<
+            boost::is_convertible<
+              typename internal::Get_iterator_value_type< InputIterator >::type,
+              std::pair<Point,typename internal::Info_check<typename Tds::Vertex>::type>
+            >
+          >::type* =NULL
+  )
+  {
+    return insert_with_info< std::pair<Point,typename internal::Info_check<typename Tds::Vertex>::type> >(first,last);
+  }
+
+  template <class  InputIterator_1,class InputIterator_2>
+  std::ptrdiff_t
+  insert( boost::zip_iterator< boost::tuple<InputIterator_1,InputIterator_2> > first,
+          boost::zip_iterator< boost::tuple<InputIterator_1,InputIterator_2> > last,
+          typename boost::enable_if<
+            boost::mpl::and_<
+              boost::is_convertible< typename std::iterator_traits<InputIterator_1>::value_type, Point >,
+              boost::is_convertible< typename std::iterator_traits<InputIterator_2>::value_type, typename internal::Info_check<typename Tds::Vertex>::type >
+            >
+          >::type* =NULL
+  )
+  {
+    return insert_with_info< boost::tuple<Point,typename internal::Info_check<typename Tds::Vertex>::type> >(first,last);
+  }
+#endif //CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
+
+
+  template <class PointIterator, class IndicesIterator>
+  std::size_t insert_constraints(PointIterator points_first,
+                                 PointIterator points_beyond,
+                                 IndicesIterator indices_first,
+                                 IndicesIterator indices_beyond)
+  {
+    std::vector<Point> points(points_first, points_beyond);
+    return internal::insert_constraints(*this,points, indices_first, indices_beyond);
+  }
+
+
+ template <class ConstraintIterator>
+  std::size_t insert_constraints(ConstraintIterator first,
+                                 ConstraintIterator beyond)
+  {
+    return internal::insert_constraints(*this,first,beyond);
+  }
+
+
+  template <class OutputItFaces, class OutputItBoundaryEdges> 
+  std::pair<OutputItFaces,OutputItBoundaryEdges>
+  get_conflicts_and_boundary(const Point  &p, 
+			     OutputItFaces fit, 
+			     OutputItBoundaryEdges eit,
+			     Face_handle start = Face_handle()) const {
+    CGAL_triangulation_precondition( dimension() == 2);
+    int li;
+    Locate_type lt;
+    Face_handle fh = locate(p,lt,li, start);
+    switch(lt) {
+    case Ctr::OUTSIDE_AFFINE_HULL:
+    case Ctr::VERTEX:
+      return std::make_pair(fit,eit);
+    case Ctr::FACE:
+    case Ctr::EDGE:
+    case Ctr::OUTSIDE_CONVEX_HULL:
+      *fit++ = fh; //put fh in OutputItFaces
+      std::pair<OutputItFaces,OutputItBoundaryEdges>
+	pit = std::make_pair(fit,eit);
+      pit = propagate_conflicts(p,fh,0,pit);
+      pit = propagate_conflicts(p,fh,1,pit);
+      pit = propagate_conflicts(p,fh,2,pit);
+      return pit;
+    }
+    CGAL_triangulation_assertion(false);
+    return std::make_pair(fit,eit);
+  } 
+
+  template <class OutputItFaces>
+  OutputItFaces
+  get_conflicts (const Point  &p, 
+		 OutputItFaces fit, 
+		 Face_handle start= Face_handle()) const {
+    std::pair<OutputItFaces,Emptyset_iterator> pp = 
+      get_conflicts_and_boundary(p,fit,Emptyset_iterator(),start);
+    return pp.first;
+  }
+
+  template <class OutputItBoundaryEdges> 
+  OutputItBoundaryEdges
+  get_boundary_of_conflicts(const Point  &p, 
+			    OutputItBoundaryEdges eit, 
+			    Face_handle start= Face_handle()) const {
+    std::pair<Emptyset_iterator, OutputItBoundaryEdges> pp = 
+      get_conflicts_and_boundary(p,Emptyset_iterator(),eit,start);
+    return pp.second;
+  }
+
+
+public:
+// made  public for the need of Mesh_2
+// but not documented
+#ifdef CGAL_CDT2_USE_RECURSIVE_PROPAGATE_CONFLICTS
+  template <class OutputItFaces, class OutputItBoundaryEdges> 
+  std::pair<OutputItFaces,OutputItBoundaryEdges>
+  propagate_conflicts (const Point  &p,
+                      Face_handle fh, 
+                      int i,
+                      std::pair<OutputItFaces,OutputItBoundaryEdges>  pit)  const 
+  {
+     Face_handle fn = fh->neighbor(i);
+     
+     if ( fh->is_constrained(i) || ! test_conflict(p,fn)) {
+       *(pit.second)++ = Edge(fn, fn->index(fh));
+     } else {
+       *(pit.first)++ = fn;
+       int j = fn->index(fh);
+       pit = propagate_conflicts(p,fn,ccw(j),pit);
+       pit = propagate_conflicts(p,fn,cw(j), pit);
+     }
+     return pit;
+  }
+#else // NO CGAL_CDT2_USE_RECURSIVE_PROPAGATE_CONFLICTS
+  template <class OutputItFaces, class OutputItBoundaryEdges> 
+  std::pair<OutputItFaces,OutputItBoundaryEdges>
+  non_recursive_propagate_conflicts (const Point  &p,
+                                     Face_handle fh, 
+                                     int i,
+                                     std::pair<OutputItFaces,OutputItBoundaryEdges>  pit)  const 
+  {
+    std::stack<std::pair<Face_handle, int> > stack;
+    stack.push(std::make_pair(fh, i));
+    while(!stack.empty()) {
+      const Face_handle fh = stack.top().first;
+      const int i = stack.top().second;
+      stack.pop();
+      const Face_handle fn = fh->neighbor(i);
+      if ( fh->is_constrained(i) || ! test_conflict(p,fn)) {
+        *(pit.second)++ = Edge(fn, fn->index(fh));
+      } else {
+        *(pit.first)++ = fn;
+        int j = fn->index(fh);
+        stack.push(std::make_pair(fn, cw(j)));
+        stack.push(std::make_pair(fn,ccw(j)));
+      }
+    }
+    return pit;
+  }
+
+  template <class OutputItFaces, class OutputItBoundaryEdges> 
+  std::pair<OutputItFaces,OutputItBoundaryEdges>
+  propagate_conflicts (const Point  &p,
+                      Face_handle fh, 
+                      int i,
+                      std::pair<OutputItFaces,OutputItBoundaryEdges>  pit,
+                      int depth=0)  const 
+  {
+    if ( depth==100) return non_recursive_propagate_conflicts(p,fh,i,pit);
+    Face_handle fn = fh->neighbor(i);
+ 
+    if ( fh->is_constrained(i) || ! test_conflict(p,fn)) {
+      *(pit.second)++ = Edge(fn, fn->index(fh));
+    } else {
+      *(pit.first)++ = fn;
+      int j = fn->index(fh);
+      pit = propagate_conflicts(p,fn,ccw(j),pit,depth+1);
+      pit = propagate_conflicts(p,fn,cw(j), pit,depth+1);
+    }
+     return pit;
+  }
+#endif // NO CGAL_CDT2_USE_RECURSIVE_PROPAGATE_CONFLICTS
+
+
+
+
+public:
+ template <class OutputItFaces>
+ OutputItFaces
+ propagating_flip(List_edges & edges, 
+		  OutputItFaces out = Emptyset_iterator()) {
+  // makes the triangulation Delaunay by flipping 
+  // List edges contains an initial list of edges to be flipped
+  // Precondition : the output triangulation is Delaunay if the list 
+  // edges contains all edges of the input triangulation that need to be
+  // flipped (plus possibly others)
+  int i, ii, indf, indn;
+  Face_handle ni, f,ff;
+  Edge ei,eni; 
+  typename Ctr::Edge_set edge_set;
+  typename Ctr::Less_edge less_edge;
+  Edge e[4];
+  typename List_edges::iterator itedge=edges.begin();
+
+  // initialization of the set of edges to be flip
+  while (itedge != edges.end()) {
+    f=(*itedge).first;
+    i=(*itedge).second;
+    if (is_flipable(f,i)) {
+      eni=Edge(f->neighbor(i),this->mirror_index(f,i));
+      if (less_edge(*itedge,eni)) edge_set.insert(*itedge);
+      else edge_set.insert(eni);
+    }
+    ++itedge;
+  }
+
+  // flip edges and updates the set of edges to be flipped
+  while (!(edge_set.empty())) {
+    f=(*(edge_set.begin())).first;
+    indf=(*(edge_set.begin())).second;
+ 
+    // erase from edge_set the 4 edges of the wing of the edge to be
+    // flipped (edge_set.begin) , i.e. the edges of the faces f and
+    // f->neighbor(indf) that are distinct from the edge to be flipped
+
+    ni = f->neighbor(indf); 
+    indn=this->mirror_index(f,indf);
+    ei= Edge(f,indf);
+    edge_set.erase(ei);
+    e[0]= Edge(f,cw(indf));
+    e[1]= Edge(f,ccw(indf));
+    e[2]= Edge(ni,cw(indn));
+    e[3]= Edge(ni,ccw(indn));
+
+    for(i=0;i<4;i++) { 
+      ff=e[i].first;
+      ii=e[i].second;
+      eni=Edge(ff->neighbor(ii),this->mirror_index(ff,ii));
+      if (less_edge(e[i],eni)) {edge_set.erase(e[i]);}
+      else { edge_set.erase(eni);} 
+    } 
+
+    // here is the flip 
+    *out++ = f;
+    *out++ = f->neighbor(indf);
+    flip(f, indf); 
+    
+
+    //insert in edge_set the 4 edges of the wing of the edge that
+    //have been flipped 
+    e[0]= Edge(f,indf);
+    e[1]= Edge(f,cw(indf));
+    e[2]= Edge(ni,indn);
+    e[3]= Edge(ni,cw(indn));
+
+    for(i=0;i<4;i++) { 
+      ff=e[i].first;
+      ii=e[i].second;
+      if (is_flipable(ff,ii)) {
+	eni=Edge(ff->neighbor(ii),this->mirror_index(ff,ii));
+	if (less_edge(e[i],eni)) { 
+	  edge_set.insert(e[i]);}
+	else {
+	  edge_set.insert(eni);} 
+      }
+    } 
+  }
+  return out;
+ }
+
+ template <class OutputItFaces>
+ OutputItFaces
+ remove_constrained_edge(Face_handle f, int i, OutputItFaces out) {
+  Ctr::remove_constrained_edge(f,i);
+  if(dimension() == 2) {
+    List_edges le;
+    le.push_back(Edge(f,i));
+    propagating_flip(le,out);
+  }
+  return out;  
+ }
+ 
+};
+
+
+template < class Gt, class Tds, class Itag >
+bool 
+Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
+is_flipable(Face_handle f, int i, bool perturb /* = true */) const
+  // determines if edge (f,i) can be flipped 
+{
+  Face_handle ni = f->neighbor(i); 
+  if (is_infinite(f) || is_infinite(ni)) return false; 
+  if (f->is_constrained(i)) return false;
+  return (side_of_oriented_circle(ni, f->vertex(i)->point(), perturb) 
+                                        == ON_POSITIVE_SIDE);
+}
+
+template < class Gt, class Tds, class Itag >
+void 
+Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
+flip (Face_handle& f, int i)
+{
+  Face_handle g = f->neighbor(i);
+  int j = this->mirror_index(f,i);
+
+  // save wings neighbors to be able to restore contraint status
+  Face_handle f1 = f->neighbor(cw(i));
+  int i1 = this->mirror_index(f,cw(i));
+  Face_handle f2 = f->neighbor(ccw(i));
+  int i2 = this->mirror_index(f,ccw(i));
+  Face_handle f3 = g->neighbor(cw(j));
+  int i3 = this->mirror_index(g,cw(j));
+  Face_handle f4 = g->neighbor(ccw(j));
+  int i4 = this->mirror_index(g,ccw(j));
+
+  // The following precondition prevents the test suit 
+  // of triangulation to work on constrained Delaunay triangulation
+  //CGAL_triangulation_precondition(is_flipable(f,i));
+  this->_tds.flip(f, i);
+   
+  // restore constraint status
+  f->set_constraint(f->index(g), false);
+  g->set_constraint(g->index(f), false);
+  f1->neighbor(i1)->set_constraint(this->mirror_index(f1,i1),
+				   f1->is_constrained(i1));
+  f2->neighbor(i2)->set_constraint(this->mirror_index(f2,i2),
+				   f2->is_constrained(i2));
+  f3->neighbor(i3)->set_constraint(this->mirror_index(f3,i3),
+				   f3->is_constrained(i3));
+  f4->neighbor(i4)->set_constraint(this->mirror_index(f4,i4),
+				   f4->is_constrained(i4));
+  return;
+}
+
+template < class Gt, class Tds, class Itag >
+void 
+Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
+flip_around(Vertex_handle va)
+  // makes the triangles incident to vertex va Delaunay using flips
+{
+  if (dimension() <= 1) return;
+  Face_handle f=va->face();
+  Face_handle next;    
+  Face_handle start(f);
+  int i;
+  do {
+    i = f->index(va); // FRAGILE : DIM 1
+    next = f->neighbor(ccw(i));  // turns ccw around a
+    propagating_flip(f,i);
+    f=next;
+  } while(next != start);
+}
+
+template < class Gt, class Tds, class Itag >
+void 
+Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
+flip_around(List_vertices& new_vertices)
+{
+  typename List_vertices::iterator itv=new_vertices.begin();
+  for( ; itv != new_vertices.end(); itv++) {
+    flip_around(*itv);
+  }
+  return;
+}
+
+
+#ifndef CGAL_CDT2_USE_RECURSIVE_PROPAGATING_FLIP
+template <class Gt, class Tds, class Itag >
+void
+Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
+non_recursive_propagating_flip(Face_handle f , int i)
+{
+  std::stack<Edge> edges;
+  const Vertex_handle& vp = f->vertex(i);
+  edges.push(Edge(f,i));
+
+  while(! edges.empty()){
+    const Edge& e = edges.top();
+    f = e.first;
+    i = e.second;
+
+    Face_handle ni = f->neighbor(i);
+    flip(f,i);
+    if ( !is_flipable(f,i) ) edges.pop();
+
+    i = ni->index(vp);
+    if ( is_flipable(ni,i) ) edges.push( Edge(ni,i) );
+  }
+}
+
+template <class Gt, class Tds, class Itag >
+void
+Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
+propagating_flip(Face_handle f,int i, int depth)
+{
+  if (!is_flipable(f,i)) return;
+#ifdef CGAL_CDT2_IMMEDIATELY_NON_RECURSIVE_PROPAGATING_FLIP
+  non_recursive_propagating_flip(f,i);
+#else
+  int max_depth = 100;
+  if(depth==max_depth){
+    non_recursive_propagating_flip(f,i);
+    return;
+  }
+
+  Face_handle ni = f->neighbor(i);
+  flip(f, i); // flip for constrained triangulations
+  propagating_flip(f,i);
+  i = ni->index(f->vertex(i));
+  propagating_flip(ni,i);
+#endif
+}
+#else 
+template < class Gt, class Tds, class Itag >
+void
+Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
+propagating_flip(Face_handle f,int i)
+// similar to the corresponding function in Delaunay_triangulation_2.h
+{
+  if (!is_flipable(f,i)) return;
+  Face_handle ni = f->neighbor(i);
+  flip(f, i); // flip for constrained triangulations
+  propagating_flip(f,i);
+  i = ni->index(f->vertex(i));
+  propagating_flip(ni,i);
+}
+#endif
+
+ template < class Gt, class Tds, class Itag > 
+ void
+ Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>:: 
+ propagating_flip(List_edges & edges) {
+    propagating_flip(edges,Emptyset_iterator());
+ }
+
+
+template < class Gt, class Tds, class Itag >
+inline bool
+Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
+test_conflict(const Point& p, Face_handle fh) const
+  // true if point P lies inside the circle circumscribing face fh
+{
+  // return true  if P is inside the circumcircle of fh
+  // if fh is infinite, return true when p is in the positive
+  // halfspace or on the boundary and in the  finite edge of fh
+  Oriented_side os = side_of_oriented_circle(fh,p,true);
+  if (os == ON_POSITIVE_SIDE) return true;
+ 
+  if (os == ON_ORIENTED_BOUNDARY && is_infinite(fh)) {
+    int i = fh->index(infinite_vertex());
+    return collinear_between(fh->vertex(cw(i))->point(), p,
+			     fh->vertex(ccw(i))->point() );
+  }
+
+  return false;
+}
+
+template < class Gt, class Tds, class Itag >
+inline bool
+Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
+test_conflict(Face_handle fh, const Point& p) const
+  // true if point P lies inside the circle circumscribing face fh
+{
+  return test_conflict(p,fh);
+}
+
+template < class Gt, class Tds, class Itag >    
+void 
+Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
+find_conflicts(const Point& p, std::list<Edge>& le, Face_handle hint) const
+{
+  // sets in le the counterclocwise list of the edges of the boundary of the 
+  // union of the faces in conflict with p
+  // an edge is represented by the incident face that is not in conflict with p
+  get_boundary_of_conflicts(p, std::back_inserter(le), hint);
+}
+  
+template < class Gt, class Tds, class Itag >  
+inline 
+typename Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::Vertex_handle 
+Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
+virtual_insert(const Point & a, Face_handle start)
+  // virtual version of the insertion
+{
+  return insert(a,start);
+}
+
+template < class Gt, class Tds, class Itag >  
+inline 
+typename Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::Vertex_handle 
+Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
+virtual_insert(const Point& a,
+	       Locate_type lt,
+	       Face_handle loc, 
+	       int li )
+// virtual version of insert
+{
+  return insert(a,lt,loc,li);
+}
+
+template < class Gt, class Tds, class Itag >  
+inline 
+typename Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::Vertex_handle 
+Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
+insert(const Point & a, Face_handle start)
+ // inserts a in the triangulation
+// constrained edges are updated
+// Delaunay property is restored
+{
+  Vertex_handle va= Ctr::insert(a, start);
+  flip_around(va); 
+  return va;
+}
+
+template < class Gt, class Tds, class Itag >
+typename Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::Vertex_handle
+Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
+insert(const Point& a, Locate_type lt, Face_handle loc, int li)
+// insert a point p, whose localisation is known (lt, f, i)
+// constrained edges are updated
+// Delaunay property is restored
+{
+  Vertex_handle va= Ctr::insert(a,lt,loc,li);
+  flip_around(va); 
+  return va;
+}
+
+template < class Gt, class Tds, class Itag >
+inline
+typename Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::Vertex_handle
+Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
+push_back(const Point &p)
+{
+  return insert(p);
+}
+
+template < class Gt, class Tds, class Itag >
+void 
+Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
+triangulate_hole(List_faces& intersected_faces,
+		 List_edges& conflict_boundary_ab,
+		 List_edges& conflict_boundary_ba)
+{
+  List_edges new_edges;
+  Ctr::triangulate_hole(intersected_faces,
+		       conflict_boundary_ab,
+		       conflict_boundary_ba,
+		       new_edges);
+  propagating_flip(new_edges);
+  return;
+}
+
+
+template < class Gt, class Tds, class Itag >  
+inline void 
+Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
+remove(Vertex_handle v)
+  // remove a vertex and updates the constrained edges of the new faces
+  // precondition : there is no incident constraints
+{
+  CGAL_triangulation_precondition( v != Vertex_handle() );
+  CGAL_triangulation_precondition( ! is_infinite(v));
+  CGAL_triangulation_precondition( ! are_there_incident_constraints(v));
+  if  (dimension() <= 1)    Ctr::remove(v);
+  else  remove_2D(v);
+  return;
+}
+
+// template < class Gt, class Tds, class Itag >  
+// typename
+// Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::Vertex_handle
+// Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
+// special_insert_in_edge(const Point & a, Face_handle f, int i)
+//   // insert  point p in edge(f,i)
+//   // bypass the precondition for point a to be in edge(f,i)
+//   // update constrained status
+//   // this member fonction is not robust with exact predicates 
+//   // and approximate construction. Should be removed 
+// {
+//   Vertex_handle vh=Ctr::special_insert_in_edge(a,f,i);
+//   flip_around(vh);
+//   return vh;
+// }
+
+template < class Gt, class Tds, class Itag >  
+void 
+Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
+remove_2D(Vertex_handle v)
+{
+ if (test_dim_down(v)) {  this->_tds.remove_dim_down(v);  }
+  else {
+     std::list<Edge> hole;
+    make_hole(v, hole);
+    std::list<Edge> shell=hole; //because hole will be emptied by fill_hole
+    fill_hole_delaunay(hole);
+    update_constraints(shell);
+    delete_vertex(v);
+  }
+  return;
+}
+
+template < class Gt, class Tds, class Itag >
+void
+Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
+remove_incident_constraints(Vertex_handle v)
+{
+   List_edges iconstraints;
+   if (are_there_incident_constraints(v,
+				      std::back_inserter(iconstraints))) {
+     Ctr::remove_incident_constraints(v);
+     if (dimension()==2) propagating_flip(iconstraints);
+   }
+   return;
+}
+
+template < class Gt, class Tds, class Itag >
+void
+Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
+remove_constrained_edge(Face_handle f, int i)
+{
+  remove_constrained_edge(f,i,Emptyset_iterator());
+  return;  
+}
+
+
+template < class Gt, class Tds, class Itag >  
+bool 
+Constrained_Delaunay_triangulation_2<Gt,Tds,Itag>::
+is_valid(bool verbose, int level) const
+{
+  bool result = Ctr::is_valid(verbose, level);
+  CGAL_triangulation_assertion( result );
+
+    Finite_faces_iterator fit= finite_faces_begin();
+    for (; fit != finite_faces_end(); fit++) {
+      for(int i=0;i<3;i++) {
+	result = result && !is_flipable(fit,i, false);
+	CGAL_triangulation_assertion( result );
+      }
+    }
+    return result;
+}
+
+
+
+} //namespace CGAL
+#endif // CGAL_CONSTRAINED_DELAUNAY_TRIANGULATION_2_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Constrained_Delaunay_triangulation_face_base_2.h b/3rdparty/CGAL/include/CGAL/Constrained_Delaunay_triangulation_face_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Constrained_Delaunay_triangulation_face_base_2.h
rename to 3rdparty/CGAL/include/CGAL/Constrained_Delaunay_triangulation_face_base_2.h
diff --git a/3rdparty/CGAL/include/CGAL/Constrained_triangulation_2.h b/3rdparty/CGAL/include/CGAL/Constrained_triangulation_2.h
new file mode 100644
index 0000000..6a14a41
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Constrained_triangulation_2.h
@@ -0,0 +1,1453 @@
+// Copyright (c) 1997  INRIA Sophia-Antipolis (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
+// 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(s)     : Mariette Yvinec, Jean-Daniel Boissonnat
+
+
+#ifndef CGAL_CONSTRAINED_TRIANGULATION_2_H
+#define CGAL_CONSTRAINED_TRIANGULATION_2_H
+
+#include <set>
+
+#include <CGAL/triangulation_assertions.h>
+#include <CGAL/Triangulation_2.h> 
+#include <CGAL/Constrained_triangulation_face_base_2.h>
+#include <CGAL/iterator.h>
+#include <CGAL/Default.h>
+#include <CGAL/intersections.h>
+#include <CGAL/squared_distance_2.h>
+
+#include <boost/mpl/if.hpp>
+
+namespace CGAL {
+
+struct No_intersection_tag{};
+struct Exact_intersections_tag{}; // to be used with an exact number type
+struct Exact_predicates_tag{}; // to be used with filtered exact number
+
+namespace internal {
+
+template <typename K>
+struct Itag {
+  typedef typename boost::mpl::if_<typename Algebraic_structure_traits<typename K::FT>::Is_exact,
+                                   Exact_intersections_tag,
+                                   Exact_predicates_tag>::type type;
+};
+
+} // namespace internal
+
+template < class Gt, 
+           class Tds_ = Default ,
+           class Itag_ = Default >
+class Constrained_triangulation_2  
+  : public Triangulation_2<Gt,typename Default::Get< Tds_,
+                                                     Triangulation_data_structure_2 <
+                                                       Triangulation_vertex_base_2<Gt>,
+                                                       Constrained_triangulation_face_base_2<Gt> > >::type >
+{
+
+public:
+  typedef typename Default::Get<Tds_, Triangulation_data_structure_2 <
+                                        Triangulation_vertex_base_2<Gt>,
+                                        Constrained_triangulation_face_base_2<Gt> > >::type Tds;
+
+  typedef typename Default::Get<Itag_, No_intersection_tag>::type Itag;
+
+  typedef Triangulation_2<Gt,Tds> Triangulation;
+  typedef Constrained_triangulation_2<Gt,Tds_,Itag_>  Constrained_triangulation;
+  
+  typedef typename Triangulation::Edge Edge;
+  typedef typename Triangulation::Vertex Vertex;
+  typedef typename Triangulation::Vertex_handle Vertex_handle;
+  typedef typename Triangulation::Face_handle Face_handle;
+  typedef typename Triangulation::size_type size_type;
+  typedef typename Triangulation::Locate_type Locate_type;
+  typedef typename Triangulation::All_faces_iterator All_faces_iterator;
+  typedef typename Triangulation::Face_circulator Face_circulator;
+  typedef typename Triangulation::Edge_circulator Edge_circulator;
+  typedef typename Triangulation::Vertex_circulator Vertex_circulator;
+  typedef typename Triangulation::Line_face_circulator Line_face_circulator;
+
+#ifndef CGAL_CFG_USING_BASE_MEMBER_BUG_2
+  using Triangulation::number_of_vertices;
+  using Triangulation::cw;
+  using Triangulation::ccw;
+  using Triangulation::dimension;
+  using Triangulation::geom_traits;
+  using Triangulation::all_faces_begin;
+  using Triangulation::all_faces_end;
+  using Triangulation::side_of_oriented_circle;
+  using Triangulation::is_infinite;
+  using Triangulation::collinear_between;
+  using Triangulation::incident_edges;
+  using Triangulation::test_dim_down;
+  using Triangulation::make_hole;
+  using Triangulation::fill_hole;
+  using Triangulation::delete_vertex;
+  using Triangulation::delete_face;
+  using Triangulation::create_face;
+  using Triangulation::incident_faces;
+  using Triangulation::locate;
+  using Triangulation::includes_edge;
+  using Triangulation::remove_first;
+  using Triangulation::remove_second;
+#endif
+
+  typedef Gt                                 Geom_traits;
+  typedef Itag                               Intersection_tag;
+  typedef typename Geom_traits::Point_2      Point;
+  typedef typename Geom_traits::Segment_2    Segment;
+  typedef std::pair<Point,Point>             Constraint;
+  typedef std::list<Edge>                    List_edges;
+  typedef std::list<Face_handle>             List_faces;
+  typedef std::list<Vertex_handle>           List_vertices;
+  typedef std::list<Constraint>              List_constraints;
+
+  // Tag to mark the presence of a hierarchy of constraints
+ typedef Tag_false                           Constraint_hierarchy_tag;
+   
+
+  class Less_edge;
+  typedef std::set<Edge,Less_edge> Edge_set;
+
+
+  Constrained_triangulation_2(const Gt& gt = Gt()) : Triangulation(gt) { }
+
+  Constrained_triangulation_2(const Constrained_triangulation_2& ct)
+    : Triangulation(ct) {}
+
+  Constrained_triangulation_2(std::list<Constraint>& lc, const Gt& gt=Gt())
+      : Triangulation_2<Gt,Tds>(gt)
+  {
+    typename List_constraints::iterator lcit=lc.begin();
+    for( ;lcit != lc.end(); lcit++) {
+      insert( (*lcit).first, (*lcit).second);
+    }
+     CGAL_triangulation_postcondition( this->is_valid() );
+  }
+
+  template<class InputIterator>
+  Constrained_triangulation_2(InputIterator it,
+			      InputIterator last,
+			      const Gt& gt=Gt() )
+     : Triangulation_2<Gt,Tds>(gt)
+  {
+    for ( ; it != last; it++) {
+      	insert_constraint((*it).first, (*it).second);
+      }
+      CGAL_triangulation_postcondition( this->is_valid() );
+  }
+
+  //TODO Is that destructor correct ?
+  virtual ~Constrained_triangulation_2() {}
+
+  // INSERTION
+  Vertex_handle insert(const Point& p, 
+			       Face_handle start = Face_handle() );
+  Vertex_handle insert(const Point& p,
+		       Locate_type lt,
+		       Face_handle loc, 
+		       int li );
+  Vertex_handle push_back(const Point& a);
+//   template < class InputIterator >
+//   std::ptrdiff_t insert(InputIterator first, InputIterator last);
+
+
+
+  // The iterator range [edge_it, edge_pteit) is a set of edges
+  // that delimit areas in the triangulation.
+  // This function writes the face handles that cover this
+  // area to the output iterator faces_it
+  template <class InputIterator, class OutputIterator>
+  void
+  get_bounded_faces(InputIterator edge_it, InputIterator edge_pteit,
+		    OutputIterator faces_it) const
+  {
+    Edge e;
+    Unique_hash_map<Face_handle,bool> visited;
+    std::stack<Face_handle> st;
+
+    for(; edge_it != edge_pteit; edge_it++){
+      e = *edge_it;
+      visited[e.first] = true;
+      st.push(e.first->neighbor(e.second));
+    }
+
+    while(! st.empty()){
+      Face_handle fh = st.top();
+      st.pop();
+      typename CGAL::Unique_hash_map<Face_handle, bool>::Data& data = visited[fh];    
+      if(! data) {
+	data = true;
+	*faces_it++ = fh;
+	for(int i = 0 ; i < 3 ; ++i){
+	  Face_handle n = fh->neighbor(i);
+	  if(! visited[n]) {
+	    st.push(n);
+	  }
+	}
+      }
+    }
+
+  }
+
+#if 1
+  template <class Segment_2>
+  static const Point& get_source(const Segment_2& segment){
+    return segment.source();
+  }
+  template <class Segment_2>
+  static const Point& get_target(const Segment_2& segment){
+    return segment.target();
+  }
+
+  static const Point& get_source(const Constraint& cst){
+    return cst.first;
+  }
+  static const Point& get_target(const Constraint& cst){
+    return cst.second;
+  }
+#endif
+
+  // A version of insert_constraint, that additionally writes
+  // the new faces in an output iterator
+  // We duplicate code, as to run this one with an Emptyset_iterator 
+  // is still too much overhead 
+template <class OutputIterator>
+void
+insert_constraint(Vertex_handle  vaa, Vertex_handle vbb, OutputIterator out)
+// forces the constrained [va,vb]
+// [va,vb] will eventually be splitted into several edges
+// if a vertex vc of t lies on segment ab
+// of if ab intersect some constrained edges
+{
+  CGAL_triangulation_precondition( vaa != vbb);
+  Vertex_handle vi;
+
+  Face_handle fr;
+  int i;
+  if(includes_edge(vaa,vbb,vi,fr,i)) {
+    mark_constraint(fr,i);
+    if (vi != vbb)  {
+      insert_constraint(vi,vbb,out);
+    }
+    return;
+  }
+
+  List_faces intersected_faces;
+  List_edges conflict_boundary_ab, conflict_boundary_ba;
+
+  bool intersection  = find_intersected_faces( vaa, vbb,
+			                       intersected_faces,
+					       conflict_boundary_ab,
+					       conflict_boundary_ba,
+					       vi);
+  if ( intersection) {
+    if (vi != vaa && vi != vbb) {
+      insert_constraint(vaa,vi,out); 
+      insert_constraint(vi,vbb,out); 
+     }
+    else {
+      insert_constraint(vaa,vbb,out);
+    }
+    return;
+  }
+  List_edges edges(conflict_boundary_ab);
+  std::copy(conflict_boundary_ba.begin(), conflict_boundary_ba.end(), std::back_inserter(edges));
+
+  typename List_edges::iterator last = edges.end();
+  --last;
+  for(typename List_edges::iterator it = edges.begin();
+      it != last;
+      ){
+    typename List_edges::iterator n = it;
+    ++n;
+    if(it->first == n->first->neighbor(n->second) ){
+      // remove dangling edge
+      edges.erase(it);
+      it = n;
+      ++n;
+      edges.erase(it);
+    }
+    it = n;
+  }
+  triangulate_hole(intersected_faces,
+		   conflict_boundary_ab,
+		   conflict_boundary_ba);
+
+  get_bounded_faces(edges.begin(),
+		    edges.end(),
+		    out);
+  
+  if (vi != vbb) {
+    insert_constraint(vi,vbb,out); 
+  }
+  return;
+
+}
+ 
+  void insert_constraint(const Point& a, const Point& b);
+  void insert_constraint(Vertex_handle va, Vertex_handle  vb);
+  void push_back(const Constraint& c);
+
+
+  template <class PointIterator>
+  void insert_constraint(PointIterator first, PointIterator last, bool close=false)
+  {
+    if(first == last){
+      return;
+    }
+    const Point& p0 = *first;
+    Point p = p0;
+    Vertex_handle v0 = insert(p0), v(v0), w(v0);
+    ++first;
+    for(; first!=last; ++first){
+      const Point& q = *first;
+      if(p != q){
+        w = insert(q);
+        insert_constraint(v,w);
+        v = w;
+        p = q;
+      }
+    }
+    if(close && (p != p0)){
+      insert(w,v0);
+    }
+  }
+
+  void remove(Vertex_handle  v);
+  void remove_constrained_edge(Face_handle f, int i);
+  void remove_incident_constraints(Vertex_handle  v);
+  // to be used by Constrained_triangulation_plus_2
+ template <class OutputItFaces>
+ OutputItFaces 
+ remove_constrained_edge(Face_handle f, int i, OutputItFaces out) 
+ {
+   remove_constrained_edge(f, i);
+   return out;
+ }
+
+  //for backward compatibility
+  void remove_constraint(Face_handle f, int i) {remove_constrained_edge(f,i);}
+  void insert(Point a, Point b) { insert_constraint(a, b);}
+  void insert(Vertex_handle va, Vertex_handle  vb) {insert_constraint(va,vb);}
+
+  // QUERY
+  bool is_constrained(Edge e) const;
+  bool are_there_incident_constraints(Vertex_handle v) const;
+  bool is_valid(bool verbose = false, int level = 0) const;
+  // template<class OutputItEdges>
+  // OutputItEdges incident_constraints(Vertex_handle v, 
+  //                                     OutputItEdges out) const;
+  
+
+  class Less_edge 
+    :  public std::binary_function<Edge, Edge, bool>
+  {
+  public:
+    Less_edge() {}
+    bool operator() (const Edge& e1, const Edge& e2) const
+      {
+	int ind1=e1.second, ind2=e2.second;
+ 	return( (&(*e1.first) < &(*e2.first))
+ 		|| ( (&(*e1.first) == &(*e2.first)) && (ind1 < ind2)));
+      } 
+  };
+
+
+  void file_output(std::ostream& os) const;
+
+protected:
+  virtual Vertex_handle virtual_insert(const Point& a, 
+				       Face_handle start = Face_handle());
+  virtual Vertex_handle virtual_insert(const Point& a,
+				       Locate_type lt,
+				       Face_handle loc, 
+				       int li );
+//Vertex_handle special_insert_in_edge(const Point & a, Face_handle f, int i);
+  void update_constraints_incident(Vertex_handle va, 
+				   Vertex_handle c1,
+				   Vertex_handle c2);
+  void clear_constraints_incident(Vertex_handle va);
+  void update_constraints_opposite(Vertex_handle va);
+  void update_constraints(const List_edges &hole);
+
+  void mark_constraint(Face_handle fr, int i);
+
+  virtual Vertex_handle intersect(Face_handle f, int i, 
+			  Vertex_handle vaa,
+			  Vertex_handle vbb);
+  Vertex_handle intersect(Face_handle f, int i, 
+			  Vertex_handle vaa,
+			  Vertex_handle vbb,
+			  No_intersection_tag);
+  Vertex_handle intersect(Face_handle f, int i, 
+			  Vertex_handle vaa,
+			  Vertex_handle vbb,
+			   Exact_intersections_tag);
+  Vertex_handle intersect(Face_handle f, int i, 
+			  Vertex_handle vaa,
+			  Vertex_handle vbb,
+			  Exact_predicates_tag);
+private:
+  //made private to avoid using the Triangulation_2 version
+  Vertex_handle move(Vertex_handle v, const Point &)
+  {
+    CGAL_error_msg("Do not use that function!");
+    return v;
+  }
+
+public:
+// made public for Laurent  to find out deleted faces
+// when inserting a constraint with most probably 
+// no intersection
+  bool find_intersected_faces(Vertex_handle va, 
+			      Vertex_handle vb,
+			      List_faces & intersected_faces,
+			      List_edges & list_ab, 
+			      List_edges & list_ba,
+			      Vertex_handle& vi);
+protected:
+  virtual void triangulate_hole(List_faces& intersected_faces,
+				List_edges& conflict_boundary_ab,
+				List_edges& conflict_boundary_ba);
+  
+  void triangulate_hole(List_faces& intersected_faces,
+			List_edges& conflict_boundary_ab,
+			List_edges& conflict_boundary_ba,
+			List_edges& new_edges);
+  
+  void triangulate_half_hole(List_edges & list_edges, 
+			     List_edges & new_edges);
+
+  void remove_1D(Vertex_handle v);
+  void remove_2D(Vertex_handle v);
+
+  //templated member function
+public:
+  // the int parameter is a work around for VC7 to compile
+  template < class InputIterator >
+#if defined(_MSC_VER)
+  std::ptrdiff_t insert(InputIterator first, InputIterator last, int i = 0)
+#else
+    std::ptrdiff_t insert(InputIterator first, InputIterator last) 
+#endif
+    {
+      size_type n = number_of_vertices(); 
+
+      std::vector<Point> points (first, last);
+      CGAL::spatial_sort (points.begin(), points.end(), geom_traits());
+
+      Face_handle hint;
+      for (typename std::vector<Point>::const_iterator p = points.begin(), end = points.end();
+              p != end; ++p)
+          hint = insert (*p, hint)->face();
+
+      return number_of_vertices() - n;
+    }
+
+  //deprecated
+ template<class OutputIterator>
+  bool are_there_incident_constraints(Vertex_handle v, 
+				      OutputIterator out) const
+    {
+      Edge_circulator ec=incident_edges(v), done(ec);
+      bool are_there = false;
+      if (ec == 0) return are_there;
+      do {
+	if(is_constrained(*ec)) {
+	  *out++ = *ec;
+	  are_there = true;
+	}
+	ec++;
+      } while (ec != done);
+      return are_there;
+    }
+
+  
+ template<class OutputItEdges>
+ OutputItEdges  incident_constraints(Vertex_handle v, 
+				      OutputItEdges out) const {
+   Edge_circulator ec=incident_edges(v), done(ec);
+   if (ec == 0) return  out;
+   do {
+     if(is_constrained(*ec))    *out++ = *ec;
+     ec++;
+   } while (ec != done);
+   return out;
+ }
+ 
+  // the following fonctions are overloaded 
+  // to take care of constraint marks 
+  template<class EdgeIt>
+  Vertex_handle star_hole( const Point& p, 
+			   EdgeIt edge_begin,  
+			   EdgeIt edge_end) {
+    std::list<Face_handle> empty_list;
+    return star_hole(p, 
+		     edge_begin, 
+		     edge_end, 
+		     empty_list.begin(),
+		     empty_list.end());
+  }
+
+  template<class EdgeIt, class FaceIt>
+  Vertex_handle star_hole( const Point& p, 
+			   EdgeIt edge_begin,
+			   EdgeIt edge_end,
+			   FaceIt face_begin,
+			   FaceIt face_end)
+{
+    Vertex_handle v =  Triangulation::star_hole(p, 
+						edge_begin, 
+						edge_end, 
+						face_begin,
+						face_end);
+    // restore constraint status for new faces.
+    int vindex;
+    Face_handle fh;
+    int ih;
+    Face_circulator fc = incident_faces(v), done(fc);
+    do {
+      vindex = fc->index(v);
+      fc->set_constraint(cw(vindex), false);
+      fc->set_constraint(ccw(vindex), false);
+      fh = fc->neighbor(vindex);
+      ih = this->mirror_index(fc,vindex);
+      fc->set_constraint(vindex, fh->is_constrained(ih));
+    } while (++fc != done);
+    return v;
+}
+ 
+};
+
+template < class Gt, class Tds, class Itag >
+inline
+typename Constrained_triangulation_2<Gt,Tds,Itag>::Vertex_handle
+Constrained_triangulation_2<Gt,Tds,Itag>::
+virtual_insert(const Point& a, Face_handle start)
+// virtual version of insert
+{
+  return insert(a,start);
+}
+
+template < class Gt, class Tds, class Itag >
+inline
+typename Constrained_triangulation_2<Gt,Tds,Itag>::Vertex_handle
+Constrained_triangulation_2<Gt,Tds,Itag>::
+virtual_insert(const Point& a,
+	       Locate_type lt,
+	       Face_handle loc, 
+	       int li )
+// virtual version of insert
+{
+  return insert(a,lt,loc,li);
+}
+    
+template < class Gt, class Tds, class Itag >
+inline
+typename Constrained_triangulation_2<Gt,Tds,Itag>::Vertex_handle
+Constrained_triangulation_2<Gt,Tds,Itag>::
+insert(const Point& a, Face_handle start)
+// inserts point a 
+// in addition to what is done for non constrained triangulations
+// constrained edges are updated
+{
+  Face_handle loc;
+  int li;
+  Locate_type lt;
+  loc = locate(a, lt, li, start);
+  return Constrained_triangulation::insert(a,lt,loc,li);
+}
+
+template < class Gt, class Tds, class Itag >
+typename Constrained_triangulation_2<Gt,Tds,Itag>::Vertex_handle
+Constrained_triangulation_2<Gt,Tds,Itag>::
+insert(const Point& a, Locate_type lt, Face_handle loc, int li)
+// insert a point p, whose localisation is known (lt, f, i)
+// in addition to what is done for non constrained triangulations
+// constrained edges are updated
+{
+  Vertex_handle va;
+  Vertex_handle v1, v2;
+  bool insert_in_constrained_edge = false;
+
+  if ( lt == Triangulation::EDGE && loc->is_constrained(li) ){
+    insert_in_constrained_edge = true;
+    v1=loc->vertex(ccw(li)); //endpoint of the constraint
+    v2=loc->vertex(cw(li)); // endpoint of the constraint
+  }
+
+  va = Triangulation::insert(a,lt,loc,li);
+  if (insert_in_constrained_edge) update_constraints_incident(va, v1,v2);
+  else if(lt != Triangulation::VERTEX) clear_constraints_incident(va);
+  if (dimension() == 2) update_constraints_opposite(va);
+  return va;
+}
+
+// template < class Gt, class Tds, class Itag >  
+// typename Constrained_triangulation_2<Gt,Tds,Itag>::Vertex_handle 
+// Constrained_triangulation_2<Gt, Tds, Itag>::
+// special_insert_in_edge(const Point & a, Face_handle f, int i)
+//   // insert  point p in edge(f,i)
+//   // bypass the precondition for point a to be in edge(f,i)
+//   // update constrained status
+// {
+//   Vertex_handle va;
+//   Vertex_handle c1,c2;
+//   c1 = f->vertex(cw(i));  //endpoint of edge
+//   c2 = f->vertex(ccw(i)); //endpoint of edge
+//   bool insert_in_constrained_edge = f->is_constrained(i);
+ 
+//   va = this->_tds.insert_in_edge(f, i);
+//   va->set_point(a);
+
+//   if (insert_in_constrained_edge) update_constraints_incident(va, c1,c2);
+//   else clear_constraints_incident(va);
+//   if (dimension() == 2) update_constraints_opposite(va);
+//   return va;
+// }
+
+
+template < class Gt, class Tds, class Itag >
+inline void
+Constrained_triangulation_2<Gt,Tds,Itag>::
+insert_constraint(const Point& a, const Point& b)
+// the algorithm first inserts a and b, 
+// and then forces the constraint [va,vb]
+{
+  Vertex_handle va= virtual_insert(a);
+  Vertex_handle vb= virtual_insert(b);
+  if ( va != vb)   insert_constraint(va,vb);
+}
+
+
+template <class Gt, class Tds, class Itag >
+inline void
+Constrained_triangulation_2<Gt,Tds,Itag>::
+insert_constraint(Vertex_handle  vaa, Vertex_handle vbb)
+// forces the constraint [va,vb]
+// [va,vb] will eventually be split into several edges
+// if a vertex vc of t lies on segment ab
+// or if ab intersect some constrained edges
+{
+  CGAL_triangulation_precondition( vaa != vbb);
+  Vertex_handle vi;
+
+  Face_handle fr;
+  int i;
+  if(includes_edge(vaa,vbb,vi,fr,i)) {
+    mark_constraint(fr,i);
+    if (vi != vbb)  {
+      insert_constraint(vi,vbb);
+    }
+    return;
+  }
+      
+  List_faces intersected_faces;
+  List_edges conflict_boundary_ab, conflict_boundary_ba;
+     
+  bool intersection  = find_intersected_faces( vaa, vbb,
+			                       intersected_faces,
+					       conflict_boundary_ab,
+					       conflict_boundary_ba,
+					       vi);
+  if ( intersection) {
+    if (vi != vaa && vi != vbb) {
+      insert_constraint(vaa,vi); 
+      insert_constraint(vi,vbb); 
+     }
+    else insert_constraint(vaa,vbb);
+    return;
+  }
+
+  //no intersection
+  triangulate_hole(intersected_faces,
+		   conflict_boundary_ab,
+		   conflict_boundary_ba);
+
+  if (vi != vbb) {
+    insert_constraint(vi,vbb); 
+  }
+  return;
+
+}
+
+template <class Gt, class Tds, class Itag >
+bool
+Constrained_triangulation_2<Gt,Tds,Itag>::
+find_intersected_faces(Vertex_handle vaa,
+		       Vertex_handle vbb,
+		       List_faces & intersected_faces,
+		       List_edges & list_ab, 
+		       List_edges & list_ba,
+		       Vertex_handle & vi) 
+  // vi is set to the first vertex of the triangulation on [vaa,vbb].
+  // Return true if an intersection with a constrained edge is
+  // encountered, false otherwise
+  // When false : 
+  // intersected_faces contains the list if faces intersected by [va,vi]
+  // list_ab and list_ba represents the boundary of the union
+  // of the intersected faces oriented cw
+  // list_ab consists of the edges from vaa to vi (i.e. on the left of a->b)
+  // list_ba    "         "        from vi to vaa (i.e. on the right of a->b)
+{
+  const Point& aa = vaa->point();
+  const Point& bb = vbb->point();
+  Line_face_circulator current_face=Line_face_circulator(vaa, this, bb);
+  int ind=current_face->index(vaa);
+      
+  // to deal with the case where the first crossed edge
+  // is constrained
+  if(current_face->is_constrained(ind)) {
+    vi=intersect(current_face, ind, vaa, vbb);
+    return true;
+  }
+
+  Face_handle lf= current_face->neighbor(ccw(ind)); 
+  Face_handle rf= current_face->neighbor(cw(ind));
+  Orientation orient;
+  Face_handle previous_face;
+  Vertex_handle current_vertex;	
+
+  list_ab.push_back(Edge(lf, lf->index(current_face)));
+  list_ba.push_front(Edge(rf, rf->index(current_face)));
+  intersected_faces.push_front(current_face);
+
+  // initcd
+  previous_face=current_face; 
+  ++current_face;
+  ind=current_face->index(previous_face);  
+  current_vertex=current_face->vertex(ind);  
+
+  // loop over triangles intersected by ab
+  bool done = false;
+  while (current_vertex != vbb && !done)  { 
+    orient = this->orientation(aa,bb,current_vertex->point());
+    int i1, i2;
+    switch (orient) {
+    case COLLINEAR :  
+      done = true; // current_vertex is the new endpoint
+      break;
+    case LEFT_TURN :
+    case RIGHT_TURN :
+      if (orient == LEFT_TURN) {
+	i1 = ccw(ind) ; //index of second intersected edge of current_face
+	i2 = cw(ind); //index of non intersected edge of current_face
+      }
+      else {
+	i1 = cw(ind) ; //index of second intersected edge of current_face
+	i2 = ccw(ind); //index of non intersected edge of current_face
+      }
+      if(current_face->is_constrained(i1)) {
+	vi = intersect(current_face, i1, vaa,vbb);
+	return true;
+      }
+      else {
+	lf= current_face->neighbor(i2);
+	intersected_faces.push_front(current_face);
+	if (orient == LEFT_TURN) 
+	  list_ab.push_back(Edge(lf, lf->index(current_face)));
+	else // orient == RIGHT_TURN
+	  list_ba.push_front(Edge(lf, lf->index(current_face)));
+	previous_face=current_face;
+	++current_face;
+	ind=current_face->index(previous_face); 
+	current_vertex=current_face->vertex(ind);
+      }
+      break;
+    }
+  }
+    
+  // last triangle 
+  vi = current_vertex;
+  intersected_faces.push_front(current_face);
+  lf= current_face->neighbor(cw(ind));
+  list_ab.push_back(Edge(lf, lf->index(current_face))); 
+  rf= current_face->neighbor(ccw(ind));
+  list_ba.push_front(Edge(rf, rf->index(current_face)));
+  return false;
+}
+
+
+template <class Gt, class Tds, class Itag >
+typename Constrained_triangulation_2<Gt,Tds,Itag>::Vertex_handle 
+Constrained_triangulation_2<Gt,Tds,Itag>::
+intersect(Face_handle f, int i, 
+	  Vertex_handle vaa,
+	  Vertex_handle vbb) 
+{
+  return intersect(f, i, vaa, vbb, Itag());
+}
+
+template <class Gt, class Tds, class Itag >
+typename Constrained_triangulation_2<Gt,Tds,Itag>::Vertex_handle 
+Constrained_triangulation_2<Gt,Tds,Itag>::
+intersect(Face_handle , int , 
+	  Vertex_handle ,
+	  Vertex_handle ,
+	  No_intersection_tag)
+{
+  //SL: I added that to be able to throw while we find a better solution
+  #ifdef CGAL_CT2_WANTS_TO_HAVE_EXTRA_ACTION_FOR_INTERSECTING_CONSTRAINTS
+  CGAL_CDT2_EXTRA_ACTION_FOR_INTERSECTING_CONSTRAINTS
+  #endif
+  
+  std::cerr << " sorry, this triangulation does not deal with" 
+	    <<    std::endl
+	    << " intersecting constraints" << std::endl;
+  CGAL_triangulation_assertion(false);
+  return Vertex_handle() ;
+}
+
+template <class Gt, class Tds, class Itag >
+typename Constrained_triangulation_2<Gt,Tds,Itag>::Vertex_handle 
+Constrained_triangulation_2<Gt,Tds,Itag>::
+intersect(Face_handle f, int i, 
+	  Vertex_handle vaa,
+	  Vertex_handle vbb,
+	  Exact_intersections_tag)
+// compute the intersection of the constraint edge (f,i) 
+// with the subconstraint (vaa,vbb) being inserted
+// insert the intersection point
+// split constraint edge (f,i) 
+// and return the Vertex_handle of the new Vertex
+{ 
+  std::cerr << "You are using an exact number types" << std::endl;
+  std::cerr << "using a Constrained_triangulation_plus_2 class" << std::endl;
+  std::cerr << "would avoid cascading intersection computation" << std::endl;
+  std::cerr << " and be much more efficient" << std::endl;
+  const Point& pa = vaa->point();
+  const Point& pb = vbb->point();
+  const Point& pc = f->vertex(cw(i))->point();
+  const Point& pd = f->vertex(ccw(i))->point();
+  Point pi;
+  Itag itag = Itag();
+  CGAL_triangulation_assertion_code( bool ok = )
+  intersection(geom_traits(), pa, pb, pc, pd, pi, itag );
+  CGAL_triangulation_assertion(ok);
+  Vertex_handle vi = virtual_insert(pi, Triangulation::EDGE, f, i);
+  return vi; 
+}
+
+template <class Gt, class Tds, class Itag >
+typename Constrained_triangulation_2<Gt,Tds,Itag>::Vertex_handle 
+Constrained_triangulation_2<Gt,Tds,Itag>::
+intersect(Face_handle f, int i, 
+	  Vertex_handle vaa,
+	  Vertex_handle vbb,
+	  Exact_predicates_tag)
+{
+  Vertex_handle  vcc, vdd;
+  vcc = f->vertex(cw(i));
+  vdd = f->vertex(ccw(i));
+
+  const Point& pa = vaa->point();
+  const Point& pb = vbb->point();
+  const Point& pc = vcc->point();
+  const Point& pd = vdd->point();
+
+  Point pi; //creator for point is required here
+  Itag itag = Itag();
+  bool ok  = intersection(geom_traits(), pa, pb, pc, pd, pi, itag );
+
+  Vertex_handle vi;
+  if ( !ok) {  //intersection detected but not computed
+    int i = limit_intersection(geom_traits(), pa, pb, pc, pd, itag);
+    switch(i){
+    case 0 : vi = vaa; break;
+    case 1 : vi = vbb; break;
+    case 2 : vi = vcc; break;
+    case 3 : vi = vdd; break; 
+    }
+    if(vi == vaa || vi == vbb) {
+      remove_constrained_edge(f, i);
+    }
+  }
+  else{ //intersection computed
+    remove_constrained_edge(f, i);
+    vi = virtual_insert(pi, f);
+  }
+
+  // vi == vc or vi == vd may happen even if intersection==true
+  // due to approximate construction of the intersection
+  if (vi != vcc && vi != vdd) { 
+    insert_constraint(vcc,vi); 
+    insert_constraint(vi, vdd);
+  } 
+  else {
+    insert_constraint(vcc,vdd);
+  }
+  return vi; 
+}
+
+template <class Gt, class Tds, class Itag >
+inline
+typename Constrained_triangulation_2<Gt,Tds,Itag>::Vertex_handle
+Constrained_triangulation_2<Gt,Tds,Itag>::
+push_back(const Point &p)
+{
+  return insert(p);
+}
+
+
+template <class Gt, class Tds, class Itag >
+inline
+void
+Constrained_triangulation_2<Gt,Tds,Itag>::
+push_back(const Constraint &c)
+{
+  insert(c.first, c.second);
+}
+
+
+template < class Gt, class Tds, class Itag >
+void
+Constrained_triangulation_2<Gt,Tds,Itag>::
+update_constraints_incident(Vertex_handle va, 
+			    Vertex_handle c1,
+			    Vertex_handle c2)
+  // update status of edges incident to a 
+  // after insertion in the  constrained edge c1c2
+{
+  if (dimension() == 0) return;
+  if (dimension()== 1) {
+    Edge_circulator ec=this->incident_edges(va), done(ec);
+    do {
+      ((*ec).first)->set_constraint(2,true);
+    }while (++ec != done);
+  }
+  else{
+    //dimension() ==2
+    int cwi, ccwi, indf;
+    Face_circulator fc=this->incident_faces(va), done(fc);  
+    CGAL_triangulation_assertion(fc != 0);
+    do {
+      indf = fc->index(va);
+      cwi=cw(indf);
+      ccwi=ccw(indf); 
+      if ((fc->vertex(cwi) == c1)||(fc->vertex(cwi) == c2)) {
+	  fc->set_constraint(ccwi,true);
+	  fc->set_constraint(cwi,false);
+	}	
+	else {
+	  fc->set_constraint(ccwi,false);
+	  fc->set_constraint(cwi,true);
+	}
+	++fc;
+      } while (fc != done);
+  }
+}
+
+template < class Gt, class Tds ,class Itag >
+void
+Constrained_triangulation_2<Gt,Tds,Itag>::
+clear_constraints_incident(Vertex_handle va)
+// make the edges incident to a newly created vertex unconstrained
+{
+ Edge_circulator ec=this->incident_edges(va), done(ec);
+ Face_handle f;
+ int indf;
+  if ( ec != 0){
+    do {
+      f = (*ec).first ;
+      indf = (*ec).second;
+      f->set_constraint(indf,false);
+      if (dimension() == 2) {
+	f->neighbor(indf)->set_constraint(this->mirror_index(f,indf),false);
+      }
+    } while (++ec != done);
+  }
+  return;
+}
+
+
+template < class Gt, class Tds, class Itag >
+void
+Constrained_triangulation_2<Gt,Tds,Itag>::  
+update_constraints_opposite(Vertex_handle va)
+  // update status of edges opposite to a
+  // after insertion of a
+{
+  CGAL_triangulation_assertion(dimension()==2); 
+  Face_handle f=va->face(), start=f;
+  int indf;
+  do {
+    indf = f->index(va);
+    if (f->neighbor(indf)->is_constrained(this->mirror_index(f,indf)) ) {
+      f->set_constraint(indf,true);
+    }
+    else {
+      f->set_constraint(indf,false);
+    }
+    f= f->neighbor(ccw(indf)); // turns ccw around va 
+  } while (f != start);
+  return;
+}
+
+template < class Gt, class Tds, class Itag >
+void
+Constrained_triangulation_2<Gt,Tds,Itag>:: 
+update_constraints( const List_edges &hole)
+{
+  typename List_edges::const_iterator it = hole.begin();
+  Face_handle f;
+  int i;
+  for ( ; it != hole.end(); it ++) {
+    f =(*it).first;
+    i = (*it).second;
+    if ( f->is_constrained(i) ) 
+      (f->neighbor(i))->set_constraint(this->mirror_index(f,i),true);
+    else (f->neighbor(i))->set_constraint(this->mirror_index(f,i),false);
+  }
+}
+
+
+template < class Gt, class Tds, class Itag >
+inline void
+Constrained_triangulation_2<Gt,Tds,Itag>::
+mark_constraint(Face_handle fr, int i)
+{
+  if (dimension()==1) fr->set_constraint(2, true);
+  else{
+    fr->set_constraint(i,true);
+    fr->neighbor(i)->set_constraint(this->mirror_index(fr,i),true);
+  }
+  return;
+}
+
+template < class Gt, class Tds, class Itag >
+inline void
+Constrained_triangulation_2<Gt,Tds,Itag>::
+triangulate_hole(List_faces& intersected_faces,
+		 List_edges& conflict_boundary_ab,
+		 List_edges& conflict_boundary_ba)
+{
+  List_edges new_edges;
+  triangulate_hole(intersected_faces,
+		   conflict_boundary_ab,
+		   conflict_boundary_ba,
+		   new_edges);
+}
+
+
+
+template < class Gt, class Tds, class Itag >
+void
+Constrained_triangulation_2<Gt,Tds,Itag>::
+triangulate_hole(List_faces& intersected_faces,
+		 List_edges& conflict_boundary_ab,
+		 List_edges& conflict_boundary_ba,
+		 List_edges& new_edges)
+  // triangulate the hole limited by conflict_boundary_ab
+  // and conflict_boundary_ba
+  // insert the new edges in new-edges 
+  // delete the faces of intersected_faces
+{
+  if ( !conflict_boundary_ab.empty() ) {
+    triangulate_half_hole(conflict_boundary_ab, new_edges);
+    triangulate_half_hole(conflict_boundary_ba, new_edges);
+	
+    // the two faces that share edge ab are neighbors
+    // their common edge ab is a constraint
+    Face_handle fr,fl;
+    fl=(*conflict_boundary_ab.begin()).first;
+    fr=(*conflict_boundary_ba.begin()).first;
+    fl->set_neighbor(2, fr);
+    fr->set_neighbor(2, fl);
+    fl->set_constraint(2, true);
+    fr->set_constraint(2, true);
+   
+    // delete intersected faces
+    while( ! intersected_faces.empty()) {
+      fl = intersected_faces.front();
+      intersected_faces.pop_front();
+      delete_face(fl);
+    }
+  }
+}
+
+
+
+template < class Gt, class Tds, class Itag >
+void
+Constrained_triangulation_2<Gt,Tds,Itag>::
+remove(Vertex_handle  v)
+  // remove a vertex and updates the constrained edges of the new faces
+  // precondition : there is no incident constraints
+{
+  CGAL_triangulation_precondition( v != Vertex_handle() );
+  CGAL_triangulation_precondition( ! is_infinite(v));
+  CGAL_triangulation_precondition( ! are_there_incident_constraints(v));
+    
+  if  (number_of_vertices() == 1)     remove_first(v);
+  else if (number_of_vertices() == 2) remove_second(v);
+  else   if ( dimension() == 1) remove_1D(v);
+  else  remove_2D(v);
+  return;
+}
+
+
+template < class Gt, class Tds, class Itag >
+void
+Constrained_triangulation_2<Gt,Tds,Itag>::
+remove_1D(Vertex_handle  v)
+{
+  Edge_circulator ec = incident_edges(v), done(ec);
+  do {
+    (*ec).first->set_constraint(2,false);
+  } while (++ec != done);
+  Triangulation::remove_1D(v);
+}
+
+template < class Gt, class Tds, class Itag >
+void
+Constrained_triangulation_2<Gt,Tds,Itag>::
+remove_2D(Vertex_handle v)
+{
+  if (test_dim_down(v)) { this->_tds.remove_dim_down(v);}
+  else {
+    List_edges hole;
+    make_hole(v, hole);
+    List_edges shell=hole; //save hole because it will be emptied by fill_hole
+    fill_hole(v, hole);
+    update_constraints(shell);
+    delete_vertex(v);
+  }
+  return;       
+}
+
+
+template < class Gt, class Tds, class Itag >
+void
+Constrained_triangulation_2<Gt,Tds,Itag>::
+remove_constrained_edge(Face_handle f, int i)
+{
+  f->set_constraint(i, false);
+  if (dimension() == 2)
+    (f->neighbor(i))->set_constraint(this->mirror_index(f,i), false);
+  return;
+}
+
+template < class Gt, class Tds, class Itag >
+void
+Constrained_triangulation_2<Gt,Tds,Itag>::
+remove_incident_constraints(Vertex_handle v)
+{
+   Edge_circulator ec=incident_edges(v), done(ec);
+   if (ec == 0) return;
+   do {
+	if(is_constrained(*ec)) { remove_constrained_edge((*ec).first,
+						   (*ec).second);}
+	ec++;
+   } while (ec != done);
+   return;	
+}
+
+template < class Gt, class Tds, class Itag >
+inline  bool 
+Constrained_triangulation_2<Gt,Tds,Itag>::
+are_there_incident_constraints(Vertex_handle v) const
+{
+  return are_there_incident_constraints(v, Emptyset_iterator());
+}
+
+template < class Gt, class Tds, class Itag >
+inline  bool 
+Constrained_triangulation_2<Gt,Tds,Itag>::
+is_valid(bool verbose, int level) const
+{
+    bool result = Triangulation::is_valid(verbose,level);
+    for( All_faces_iterator it = all_faces_begin(); 
+	                    it != all_faces_end() ; it++) {
+      for(int i=0; i<3; i++) {
+	Face_handle n = it->neighbor(i);
+	result = result && 
+	  it->is_constrained(i) == n->is_constrained(n->index(it));
+      }
+    }
+    return result;
+}
+
+template < class Gt, class Tds, class Itag >
+inline  bool 
+Constrained_triangulation_2<Gt,Tds,Itag>::
+is_constrained(Edge e) const
+{
+  return (e.first)->is_constrained(e.second);
+}
+    
+template < class Gt, class Tds, class Itag >
+void
+Constrained_triangulation_2<Gt,Tds,Itag>::
+triangulate_half_hole(List_edges & list_edges,  List_edges & new_edges)
+  // triangulates the  polygon whose boundary consists of list_edges
+  // plus the edge ab joining the two endpoints of list_edges
+  // the orientation of the polygon (as provided by list_edges) must
+  // be cw
+  // the edges of list_edges are assumed to be edges of a
+  // triangulation that will be updated by the procedure
+  // the edges that are created are put in list new_edges
+  // takes linear time
+{
+  Vertex_handle va; // first vertex of list_edges 
+  Face_handle newlf;
+  Face_handle n1,n2,n;
+  int ind1, ind2,ind;
+  Orientation orient;
+    
+  typename List_edges::iterator current, next, tempo;
+  current=list_edges.begin();
+
+  va=((*current).first)->vertex(ccw((*current).second));
+  next=current; 
+  ++next;
+
+  do
+    {
+      n1=(*current).first;
+      ind1=(*current).second;
+      // in case n1 is no longer a triangle of the new triangulation
+      if ( n1->neighbor(ind1) != Face_handle() ) {
+	n=n1->neighbor(ind1);
+	//ind=this->mirror_index(n1,ind1); 
+	// mirror_index does not work in this case
+	ind = cw(n->index(n1->vertex(cw(ind1))));
+	n1=n->neighbor(ind); 
+	ind1= this->mirror_index(n,ind);
+      }
+      n2=(*next).first;
+      ind2=(*next).second;
+      // in case n2 is no longer a triangle of the new triangulation
+      if (n2->neighbor(ind2) != Face_handle() ) {
+	n=n2->neighbor(ind2); 
+	// ind=this->mirror_index(n2,ind2);
+	// mirror_index does not work in this case
+	ind = cw(n->index(n2->vertex(cw(ind2))));
+	n2=n->neighbor(ind); 
+	ind2= this->mirror_index(n,ind);
+      }
+
+      Vertex_handle v0=n1->vertex(ccw(ind1));
+      Vertex_handle v1=n1->vertex(cw(ind1));
+      Vertex_handle v2=n2->vertex(cw(ind2));
+      orient = this->orientation(v0->point(),v1->point(),v2->point());
+      switch (orient) {
+      case RIGHT_TURN : 	  		
+	// creates the new triangle v0v1v2
+	// updates the neighbors, the constraints 
+	//and the list of new edges
+	newlf = create_face(v0,v2,v1);
+	new_edges.push_back(Edge(newlf,2));
+	newlf->set_neighbor(1, n1);
+	newlf->set_neighbor(0, n2);
+	n1->set_neighbor(ind1, newlf);
+	n2->set_neighbor(ind2, newlf);
+	if (n1->is_constrained(ind1)) {
+	  newlf->set_constraint(1,true);
+	}
+	if (n2->is_constrained(ind2)) {
+	  newlf->set_constraint(0,true);
+	}
+	// v0, v1 or v2.face() may have been removed
+	v0->set_face(newlf); 
+	v1->set_face(newlf);
+	v2->set_face(newlf);
+	// update list_edges
+	tempo=current;
+	current=list_edges.insert(current, Edge(newlf,2));
+	list_edges.erase(tempo);
+	list_edges.erase(next);
+	next=current;
+	if (v0 != va) {--current;} 
+	else {++next;} 
+	break;
+      case LEFT_TURN : 	  
+	++current; ++next;
+	break;
+      case COLLINEAR : 
+	++current; ++next;
+	break;
+      }
+    } while (next != list_edges.end());
+}
+
+template < class Gt, class Tds, class Itag >
+void
+Constrained_triangulation_2<Gt, Tds, Itag>::
+file_output(std::ostream& os) const
+{
+  Triangulation_2<Gt, Tds>::file_output(os);
+
+  // write constrained status
+  typename Tds::Face_iterator ib = this->_tds.face_iterator_base_begin();
+  for( ; ib != this->_tds.face_iterator_base_end(); ++ib) {
+    for(int j = 0; j < 3; ++j){
+      if (ib->is_constrained(j)) { os << "C";}
+      else { os << "N";}
+      if(is_ascii(os)){
+	if(j==2) {
+	  os << "\n";
+	} else {
+	  os <<  ' ';
+	}
+      }
+    }
+  }
+}
+
+template < class Gt, class Tds, class Itag >
+std::ostream &
+operator<<(std::ostream& os, 
+	   const Constrained_triangulation_2<Gt,Tds,Itag> &ct)
+{
+  ct.file_output(os);
+  return os ;
+}
+
+template < class Gt, class Tds, class Itag >
+std::istream &
+operator>>(std::istream& is, 
+	         Constrained_triangulation_2<Gt,Tds,Itag> &ct)
+{
+  typedef Constrained_triangulation_2<Gt,Tds,Itag> CDT;
+  ct.clear();
+  is >> static_cast<typename CDT::Triangulation&>(ct);
+  for (typename CDT::All_faces_iterator fit=ct.all_faces_begin(),
+                                        fit_end=ct.all_faces_end();fit_end!=fit;++fit){
+    char c[3];
+    is >> c[0] >>  c[1] >> c[2];
+    for (int k=0;k<3;++k){
+      fit->set_constraint(k,c[k]=='C');
+    }
+  }  
+  return is;
+}
+
+//Helping functions to compute intersections of constrained edges
+template<class Gt>
+bool
+intersection(const Gt& ,
+	     const typename Gt::Point_2& , 
+	     const typename Gt::Point_2& , 
+	     const typename Gt::Point_2& , 
+	     const typename Gt::Point_2& ,
+	     typename Gt::Point_2& ,
+	     No_intersection_tag)
+{
+  return false;
+}
+	     
+template<class Gt>
+bool
+intersection(const Gt& gt,
+	     const typename Gt::Point_2& pa, 
+	     const typename Gt::Point_2& pb, 
+	     const typename Gt::Point_2& pc, 
+	     const typename Gt::Point_2& pd,
+	     typename Gt::Point_2& pi,
+	     Exact_intersections_tag)
+{
+  return compute_intersection(gt,pa,pb,pc,pd,pi);
+}
+
+
+template<class Gt>
+inline bool
+intersection(const Gt& gt,
+	     const typename Gt::Point_2& pa, 
+	     const typename Gt::Point_2& pb, 
+	     const typename Gt::Point_2& pc, 
+	     const typename Gt::Point_2& pd,
+	     typename Gt::Point_2& pi,
+	     Exact_predicates_tag)
+{
+  return compute_intersection(gt,pa,pb,pc,pd,pi);
+}
+
+
+template<class Gt>
+bool
+compute_intersection(const Gt& gt,
+	     const typename Gt::Point_2& pa, 
+	     const typename Gt::Point_2& pb, 
+	     const typename Gt::Point_2& pc, 
+	     const typename Gt::Point_2& pd,
+	     typename Gt::Point_2& pi)
+{
+  typename Gt::Intersect_2 compute_intersec=gt.intersect_2_object();
+   typename Gt::Construct_segment_2  
+    construct_segment=gt.construct_segment_2_object();
+  Object result = compute_intersec(construct_segment(pa,pb),
+				   construct_segment(pc,pd));
+  return assign(pi, result);
+}
+
+
+template<class Gt>
+int
+limit_intersection(const Gt& ,
+		   const typename Gt::Point_2& , 
+		   const typename Gt::Point_2& , 
+		   const typename Gt::Point_2& , 
+		   const typename Gt::Point_2& ,
+		   No_intersection_tag)
+{
+  return 0;
+}
+
+template<class Gt>
+int
+limit_intersection(const Gt& ,
+		   const typename Gt::Point_2& , 
+		   const typename Gt::Point_2& , 
+		   const typename Gt::Point_2& , 
+		   const typename Gt::Point_2& ,
+		   Exact_intersections_tag)
+{
+  return 0;
+}
+
+template<class Gt>
+int
+limit_intersection(const Gt& gt,
+	     const typename Gt::Point_2& pa, 
+	     const typename Gt::Point_2& pb, 
+	     const typename Gt::Point_2& pc, 
+	     const typename Gt::Point_2& pd,
+	     Exact_predicates_tag)
+{
+  typename Gt::Construct_line_2 line = gt.construct_line_2_object();
+  typename Gt::Compute_squared_distance_2 
+    distance = gt.compute_squared_distance_2_object();
+  typename Gt::Line_2 l1 = line(pa,pb);
+  typename Gt::Line_2 l2 = line(pc,pd);
+  int i = 0;
+  typename Gt::FT dx = distance(l2,pa);
+  typename Gt::FT db = distance(l2,pb);
+  typename Gt::FT dc = distance(l1,pc);
+  typename Gt::FT dd = distance(l1,pd);
+  if ( db < dx  ) { dx = db; i = 1;}
+  if ( dc < dx  ) { dx = dc; i = 2;}
+  if ( dd < dx  ) { i = 3;}
+  return i;
+}
+
+} //namespace CGAL
+
+#endif //CGAL_CONSTRAINED_TRIANGULATION_2_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Constrained_triangulation_face_base_2.h b/3rdparty/CGAL/include/CGAL/Constrained_triangulation_face_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Constrained_triangulation_face_base_2.h
rename to 3rdparty/CGAL/include/CGAL/Constrained_triangulation_face_base_2.h
diff --git a/3rdparty/CGAL/include/CGAL/Constrained_triangulation_plus_2.h b/3rdparty/CGAL/include/CGAL/Constrained_triangulation_plus_2.h
new file mode 100644
index 0000000..987e233
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Constrained_triangulation_plus_2.h
@@ -0,0 +1,1236 @@
+// Copyright (c) 2012  INRIA Sophia-Antipolis (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
+// 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(s)     : Andreas Fabri, Mariette Yvinec
+
+#ifndef CGAL_CONSTRAINED_TRIANGULATION_PLUS_2_H
+#define CGAL_CONSTRAINED_TRIANGULATION_PLUS_2_H
+
+#include <CGAL/triangulation_assertions.h>
+#include <CGAL/Polygon_2.h>
+#include <CGAL/Polyline_constraint_hierarchy_2.h>
+#include <boost/tuple/tuple.hpp>
+
+#include <CGAL/Default.h>
+#include <CGAL/Constrained_Delaunay_triangulation_2.h>
+#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
+#include <CGAL/Triangulation_2/insert_constraints.h>
+
+#if defined(BOOST_MSVC) && (BOOST_VERSION == 105500)
+#include <set>
+#else
+#include <boost/container/flat_set.hpp>
+#endif
+
+#if defined(BOOST_MSVC)
+#  pragma warning(push)
+#  pragma warning(disable:4355)
+//warning C4355: 'this' : used in base member initializer list
+#endif
+
+namespace CGAL {
+
+// Comparison functor that compares two Vertex_handle.
+// Used as 'Compare' functor for the constraint hierarchy.
+template < class Tr >
+class Pct2_vertex_handle_less_xy {
+  const Tr* tr_p;
+
+public:
+  Pct2_vertex_handle_less_xy(const Tr* tr_p) : tr_p(tr_p) {}
+
+  typedef typename Tr::Vertex_handle Vertex_handle;
+
+  bool operator()(const Vertex_handle& va,
+                  const Vertex_handle& vb) const
+  {
+    return tr_p->compare_xy(va->point(), vb->point()) == SMALLER;
+  }
+}; // end class template Pct2_vertex_handle_less_xy
+
+// Tr the base triangulation class 
+// Tr has to be Constrained or Constrained_Delaunay with Constrained_triangulation_plus_vertex_base
+
+template < class Tr_ = Default >
+class Constrained_triangulation_plus_2  
+  : public  
+Default::Get< Tr_, Constrained_Delaunay_triangulation_2< 
+                      Exact_predicates_inexact_constructions_kernel
+                      , Triangulation_data_structure_2< 
+                            Triangulation_vertex_base_2<Exact_predicates_inexact_constructions_kernel>
+                          , Constrained_triangulation_face_base_2<Exact_predicates_inexact_constructions_kernel>
+                          >
+                      , CGAL::Exact_predicates_tag
+                      > >::type
+{
+  typedef typename 
+  Default::Get< Tr_, Constrained_Delaunay_triangulation_2< 
+                  Exact_predicates_inexact_constructions_kernel
+                  , Triangulation_data_structure_2< 
+                        Triangulation_vertex_base_2<Exact_predicates_inexact_constructions_kernel>
+                      , Constrained_triangulation_face_base_2<Exact_predicates_inexact_constructions_kernel>
+                      >
+                  , CGAL::Exact_predicates_tag
+                  > >::type Tr;
+
+
+  template<class CDT>
+  class Face_container
+  {
+    typedef typename CDT::Vertex_handle Vertex_handle;
+    typedef typename CDT::Face_handle Face_handle;
+  private:
+    typedef boost::tuple<Vertex_handle, Vertex_handle, Vertex_handle> TFace; 
+    std::vector<TFace> faces;
+    CDT& cdt;
+
+  public:
+    typedef Face_handle value_type;
+    typedef Face_handle& reference;
+    typedef const Face_handle& const_reference;
+
+    Face_container(CDT& cdt_ ) : cdt(cdt_) {}
+
+    void push_back(Face_handle fh)
+    {
+      faces.push_back(boost::make_tuple(fh->vertex(0),
+                                        fh->vertex(1),
+                                        fh->vertex(2)));
+    }
+
+    template <class OutputIterator>
+    void
+    write_faces(OutputIterator out)
+    {
+      for(typename std::vector<TFace>::reverse_iterator 
+            it = faces.rbegin(); it != faces.rend(); ++it) { 
+        Face_handle fh;
+        if(cdt.is_face(boost::get<0>(*it), boost::get<1>(*it), boost::get<2>(*it), fh)){
+          *out++ = fh;
+        }
+      }
+    }
+  };
+
+public:
+  typedef Tr                                   Triangulation;
+  typedef typename Tr::Intersection_tag        Intersection_tag;
+  typedef Constrained_triangulation_plus_2<Tr_> Self;
+  typedef Tr                                   Base;
+
+  typedef typename Triangulation::Edge             Edge;
+  typedef typename Triangulation::Vertex           Vertex;
+  typedef typename Triangulation::Vertex_handle    Vertex_handle;
+  typedef typename Triangulation::Face_handle      Face_handle;
+  typedef typename Triangulation::Face_circulator  Face_circulator ;
+  typedef typename Triangulation::Vertex_iterator  Vertex_iterator;
+  typedef typename Triangulation::Vertex_circulator  Vertex_circulator;
+  typedef typename Triangulation::Locate_type      Locate_type;
+  typedef typename Triangulation::Line_face_circulator Line_face_circulator;
+  typedef typename Triangulation::Geom_traits      Geom_traits;
+  typedef typename Geom_traits::Point_2            Point;
+  typedef typename Geom_traits::Segment_2          Segment;
+  typedef typename Triangulation::Constraint       Constraint;
+  typedef typename Triangulation::size_type        size_type;
+
+  typedef typename Triangulation::List_edges       List_edges;
+  typedef typename Triangulation::List_faces       List_faces;
+  typedef typename Triangulation::List_vertices    List_vertices;
+  typedef typename Triangulation::List_constraints List_constraints;
+
+  typedef Pct2_vertex_handle_less_xy<Self>         Vh_less_xy;
+  typedef Polyline_constraint_hierarchy_2<Vertex_handle, Vh_less_xy, Point>
+                                                   Constraint_hierarchy;
+public:
+  typedef Tag_true                                Constraint_hierarchy_tag;
+
+  // for user interface with the constraint hierarchy
+
+  typedef typename Constraint_hierarchy::Vertex_it 
+                                            Vertices_in_constraint_iterator;
+  
+  typedef typename Constraint_hierarchy::Point_it
+                                            Points_in_constraint_iterator;
+
+  typedef typename Constraint_hierarchy::Context      Context;
+  typedef typename Constraint_hierarchy::Context_iterator  Context_iterator;
+  typedef typename Constraint_hierarchy::C_iterator   Constraint_iterator;
+  typedef typename Constraint_hierarchy::Subconstraint_iterator  Subconstraint_iterator;
+  typedef typename Constraint_hierarchy::Constraint_id Constraint_id;   
+                                            
+  typedef std::pair<Vertex_handle, Vertex_handle> Subconstraint;
+  
+  //for backward compatibility
+  typedef Vertices_in_constraint_iterator     Vertices_in_constraint;
+
+  using Triangulation::geom_traits;
+  using Triangulation::cw;
+  using Triangulation::ccw;
+  using Triangulation::incident_faces;
+
+protected:
+  Constraint_hierarchy hierarchy;
+ 
+public:
+  Constraint_hierarchy& hierarchy_ref()
+  {
+    return hierarchy;
+  }
+
+  Constrained_triangulation_plus_2(const Geom_traits& gt=Geom_traits()) 
+    : Triangulation(gt)
+    , hierarchy(Vh_less_xy(this))
+  { }
+
+  Constrained_triangulation_plus_2(const Constrained_triangulation_plus_2& ctp)
+    : Triangulation()
+    , hierarchy(Vh_less_xy(this))
+  { copy_triangulation(ctp);}
+
+  virtual ~Constrained_triangulation_plus_2() {}
+
+  Constrained_triangulation_plus_2 & operator=(const Constrained_triangulation_plus_2& ctp)
+  {
+    copy_triangulation(ctp);
+    return *this;
+  }
+
+  template<class InputIterator>
+  Constrained_triangulation_plus_2(InputIterator first,
+				   InputIterator last,
+				   const Geom_traits& gt=Geom_traits() )
+     : Triangulation(gt)
+     , hierarchy(Vh_less_xy(this))
+  {
+    insert_constraints(first, last);
+    CGAL_triangulation_postcondition( this->is_valid() );
+  }
+
+
+  Constrained_triangulation_plus_2(const std::list<std::pair<Point,Point> > &constraints,
+				   const Geom_traits& gt=Geom_traits() )
+    : Triangulation(gt)
+     , hierarchy(Vh_less_xy(this))
+  {
+    insert_constraints(constraints.begin(), constraints.end());
+    CGAL_triangulation_postcondition( this->is_valid() );
+  }
+  //Helping
+  void clear() { Base::clear(); hierarchy.clear(); }
+  void copy_triangulation(const Constrained_triangulation_plus_2 &ctp);
+  void swap(Constrained_triangulation_plus_2 &ctp);
+
+  // INSERTION
+  Vertex_handle insert(const Point& a, 
+		       Face_handle start = Face_handle() );
+  Vertex_handle insert(const Point& p,
+		       Locate_type lt,
+		       Face_handle loc, int li );
+  
+  Constraint_id insert_constraint(const Point& a, const Point& b)
+  {
+    Vertex_handle va= insert(a);
+    // If the segment is "short" it is a good idea to start the next insertion
+    // close to point a
+    // Otherwise, to start here is as good as elsewhere
+    Vertex_handle vb = insert(b, va->face());
+    return insert_constraint(va, vb); 
+  }
+
+  Constraint_id insert_constraint(const Constraint& c) 
+  {
+    return insert_constraint(c.first, c.second);
+  }
+  
+  Constraint_id insert_constraint(Vertex_handle va, Vertex_handle vb)
+  {
+    // protects against inserting a zero length constraint
+    if(va == vb){
+    return Constraint_id(NULL);
+    }
+    // protects against inserting twice the same constraint
+    Constraint_id cid = hierarchy.insert_constraint(va, vb);
+    if (va != vb && (cid != Constraint_id(NULL)) )  insert_subconstraint(va,vb); 
+
+    return cid;
+  }
+
+  template < class InputIterator>
+  Constraint_id insert_constraint(InputIterator first, InputIterator last, bool close=false)
+  {
+    return insert_constraint_seq_impl(first, last, close);
+  }
+
+  template<typename Range>
+  Constraint_id insert_constraint(const Range& r)
+  {
+    return insert_constraint_seq_impl(r.begin(), r.end(), false);
+  }
+
+  template < class PolygonTraits_2, class Container>
+  Constraint_id insert_constraint(const Polygon_2<PolygonTraits_2,Container>& polygon)
+  {
+    return insert_constraint_seq_impl(polygon.vertices_begin(), polygon.vertices_end(), true);
+  }
+  /*
+  template<typename InputIterator>
+  size_type insert_constraints(InputIterator first, InputIterator last)
+  {
+    size_type n = 0;
+
+    for(; first != last; ++first)
+    {
+      if(insert_constraint(*first))
+        ++n;
+    }
+    return n;
+  }
+  */
+  Vertex_handle push_back(const Point& p)
+  {
+    return insert(p);
+  }
+
+  Constraint_id push_back(const Constraint& c)
+  {
+    return insert_constraint(c.first, c.second);
+  }
+
+  // for backward compatibility
+  // not const Point&, because otherwise VC6/7 messes it up with 
+  // the insert that takes an iterator range
+  Constraint_id insert(Point a, Point b) { return insert_constraint(a, b); }
+  Constraint_id insert(Vertex_handle va, Vertex_handle  vb) { return insert_constraint(va,vb); }
+
+
+
+  template <class PointIterator, class IndicesIterator>
+  std::size_t insert_constraints(PointIterator points_first,
+                                 PointIterator points_beyond,
+                                 IndicesIterator indices_first,
+                                 IndicesIterator indices_beyond)
+  {
+    std::vector<Point> points(points_first, points_beyond);
+    return internal::insert_constraints(*this,points, indices_first, indices_beyond);
+  }
+
+
+ template <class ConstraintIterator>
+  std::size_t insert_constraints(ConstraintIterator first,
+                                 ConstraintIterator beyond)
+  {
+    return internal::insert_constraints(*this,first,beyond);
+  }
+
+
+  Vertices_in_constraint_iterator
+  insert_vertex_in_constraint(Constraint_id cid, Vertices_in_constraint_iterator pos, 
+			      Vertex_handle vh)
+  {
+    return insert_vertex_in_constraint(cid, pos, vh, Emptyset_iterator());
+  }
+
+  Vertices_in_constraint_iterator
+  remove_vertex_from_constraint(Constraint_id cid, Vertices_in_constraint_iterator pos)
+  {
+    return remove_vertex_from_constraint(cid, pos, Emptyset_iterator());
+  }
+
+
+  template <class OutputIterator>
+  Vertices_in_constraint_iterator
+  remove_vertex_from_constraint(Constraint_id cid, Vertices_in_constraint_iterator pos, 
+				OutputIterator out)
+  {
+    if(pos == vertices_in_constraint_begin(cid)){
+      ++pos;
+      Constraint_id aux = hierarchy.split2(cid,pos);
+      remove_constraint(aux, out);
+      return pos;
+    }
+
+    Vertices_in_constraint_iterator it = vertices_in_constraint_end(cid);
+    it--;
+    if(pos == it){
+      --pos;
+      Constraint_id aux = hierarchy.split(cid, pos);
+      remove_constraint(aux, out);
+      return vertices_in_constraint_end(cid);
+    }
+
+    Vertices_in_constraint_iterator pp = pos;
+    --pp;
+    Vertex_handle a = *pp;
+    pp = pos;
+    ++pp;
+    Vertex_handle b = *pp;
+    --it;
+    Vertices_in_constraint_iterator beg = vertices_in_constraint_begin(cid);
+    ++beg;
+    Face_container<Constrained_triangulation_plus_2> fc(*this);
+
+    Constraint_id head = 0, tail = 0;
+    if(pos != beg){
+      // split off head
+      --pos;
+      head = hierarchy.split2(cid, pos);
+      ++pos;
+    }
+    if(pos != it){
+      // split off tail
+      ++pos;
+      tail = hierarchy.split(cid,pos);
+    }
+  
+    Constraint_id aux = insert_constraint(a, b, std::back_inserter(fc));
+    pos = vertices_in_constraint_end(aux);
+    --pos;
+    --pos; // this is not necessarily == vertices_in_constraint_begin(aux);
+    hierarchy.swap(cid, aux);
+    remove_constraint(aux, std::back_inserter(fc));
+
+    if(head.vl_ptr()){
+      hierarchy.concatenate2(head, cid);
+    }
+
+    if(tail.vl_ptr()){
+      hierarchy.concatenate(cid, tail);
+    }
+    fc.write_faces(out);
+    ++pos; // we went one too far back because the last vertex gets removed by concatenate
+    return pos;
+  }
+
+  // Inserts vh before pos
+  // Returns an iterator pointing on the newly inserted vertex
+  // Writes the modified faces to out
+  template <class OutputIterator>
+  Vertices_in_constraint_iterator
+  insert_vertex_in_constraint(Constraint_id cid, Vertices_in_constraint_iterator pos, 
+			      Vertex_handle vh, OutputIterator out)
+  {
+    // Insertion before the first vertex
+    if(pos == vertices_in_constraint_begin(cid)){
+      //std::cout << "insertion before first vertex" << std::endl;
+      Constraint_id head = insert_constraint(vh, *pos, out);
+      hierarchy.concatenate2(head, cid);
+      return vertices_in_constraint_begin(cid);
+    } 
+
+    // Insertion after the last vertex
+    if(pos == vertices_in_constraint_end(cid)){
+      //std::cout << "insertion after last vertex" << std::endl;
+      pos--;
+      Constraint_id tail = insert_constraint(*pos, vh, out);
+      pos = vertices_in_constraint_end(tail);
+      --pos;
+      hierarchy.concatenate(cid, tail);
+      return pos;
+    }
+    Vertex_handle b = *pos;
+    --pos;    
+    Vertex_handle a = *pos;
+    ++pos;
+    Face_container<Constrained_triangulation_plus_2> fc(*this);
+    Vertices_in_constraint_iterator beg = vertices_in_constraint_begin(cid), vcit;
+    ++beg;
+    vcit = beg;
+    ++beg;
+    // If the constraint consists only of a segment, and we want to insert
+    // in the middle 
+    if((pos == vcit) && (beg == vertices_in_constraint_end(cid))){
+      //std::cout << "insertion in constraint which is a segment" << std::endl;
+      Constraint_id aux1 = insert_constraint(a, vh, std::back_inserter(fc));
+      Constraint_id aux2 = insert_constraint(vh, b, std::back_inserter(fc));
+      pos = vertices_in_constraint_begin(aux2);
+      concatenate(aux1, aux2);
+      hierarchy.swap(cid, aux1);
+      remove_constraint(aux1, std::back_inserter(fc));
+      fc.write_faces(out);
+      return pos;
+      
+    }
+    Constraint_id head = 0, tail = 0;
+    Vertices_in_constraint_iterator bit = vertices_in_constraint_begin(cid);
+    Vertices_in_constraint_iterator pred = pos;
+    --pred;
+    ++bit;
+    if(pos != bit){
+      //std::cout << "split head" << std::endl;
+      head = split(cid, pred);
+      std::swap(head,cid); // split2 does the job
+      pred = vertices_in_constraint_begin(cid);
+      pos = pred;
+      ++pos;
+    }
+    Vertices_in_constraint_iterator eit = vertices_in_constraint_end(cid);
+    --eit;
+    if(pos != eit){
+      //std::cout << "split tail" << std::endl;
+      tail = split(cid, pos);    
+    }
+    
+    // make the new constraint
+    Constraint_id aux1 = insert_constraint(a, vh, std::back_inserter(fc));
+    Constraint_id aux2 = insert_constraint(vh, b, std::back_inserter(fc));
+    pos = vertices_in_constraint_begin(aux2);
+    concatenate(aux1, aux2);
+
+    if(head.vl_ptr()){
+      //std::cout << "concatenate head" << std::endl;
+      remove_constraint(cid, std::back_inserter(fc));
+      hierarchy.concatenate(head, aux1);
+    } else {
+      hierarchy.swap(cid, aux1);
+      remove_constraint(aux1, std::back_inserter(fc));
+      head = cid;
+    }
+
+    if(tail.vl_ptr()){
+      //std::cout << "concatenate tail" << std::endl;
+      concatenate(head, tail);
+    }
+    fc.write_faces(out);
+    return pos;
+  }
+
+  template < class InputIterator, class OutputIterator>
+  Constraint_id insert_constraint(InputIterator first, InputIterator last, OutputIterator out)
+  {
+    Face_handle hint;
+    Face_container<Constrained_triangulation_plus_2> fc(*this);
+    std::vector<Vertex_handle> vertices;
+    for(;first!= last; first++){
+      Vertex_handle vh = insert(*first, hint);
+      hint = vh->face();
+      // no duplicates
+      if(vertices.empty() || (vertices.back() != vh)){
+	vertices.push_back(vh);
+      }
+    }
+    int n = vertices.size();
+    if(n == 1){
+      return NULL;
+    }
+    Constraint_id ca = hierarchy.insert_constraint(vertices[0],vertices[1]);
+    insert_subconstraint(vertices[0],vertices[1], std::back_inserter(fc)); 
+
+    if(n>2){
+      for(int j=1; j<n-1; j++){
+	hierarchy.append_constraint(ca, vertices[j], vertices[j+1]);
+	insert_subconstraint(vertices[j], vertices[j+1], std::back_inserter(fc));
+      }
+    }
+    for(Vertices_in_constraint_iterator vcit = vertices_in_constraint_begin(ca);
+	vcit != vertices_in_constraint_end(ca);
+	vcit++){
+      insert_incident_faces(vcit, out);
+    }
+    //AF    vertices_in_constraint_begin(ca)->fixed() = true;
+    // Vertices_in_constraint_iterator end = boost::prior(vertices_in_constraint_end(ca));
+    // end->fixed() = true;
+    fc.write_faces(out);
+    
+    return ca;
+  }
+
+
+private:
+  template < class InputIterator>
+  Constraint_id insert_constraint_seq_impl(InputIterator first, InputIterator last, bool is_polygon)
+  {
+    Face_handle hint;
+    std::vector<Vertex_handle> vertices;
+    for(;first!= last; first++){
+      Vertex_handle vh = insert(*first, hint);
+      hint = vh->face();
+      // no duplicates
+      if(vertices.empty() || (vertices.back() != vh)){
+	vertices.push_back(vh);
+      }
+    }
+    if(is_polygon && (vertices.size()>1) && (vertices.front() != vertices.back())){
+      vertices.push_back(vertices.front());
+    }
+
+    std::size_t n = vertices.size();
+    if(n == 1){
+      return NULL;
+    }
+    CGAL_assertion(n >= 2);
+    
+    Constraint_id ca = hierarchy.insert_constraint(vertices[0],vertices[1]);
+    insert_subconstraint(vertices[0],vertices[1]); 
+
+    if(n>2){
+      for(std::size_t j=1; j<n-1; j++){
+	hierarchy.append_constraint(ca, vertices[j], vertices[j+1]);
+	insert_subconstraint(vertices[j], vertices[j+1]);
+      }
+    }
+ 
+    // fix first and last, one is redundant for is_polygon == true
+    // vertices.front()->fixed() = true;
+    // vertices.back()->fixed() = true;
+
+    return ca;
+  }
+public:
+  template <class OutputIterator>
+  typename Constrained_triangulation_plus_2<Tr>::Constraint_id
+  insert_constraint(Vertex_handle va, Vertex_handle vb, OutputIterator out)
+  {
+    // protects against inserting a zero length constraint
+    if(va == vb){
+    return Constraint_id(NULL);
+    }
+    // protects against inserting twice the same constraint
+    Constraint_id cid = hierarchy.insert_constraint(va, vb);
+    if (va != vb && (cid != NULL) )  insert_subconstraint(va,vb,out); 
+  
+    for(Vertices_in_constraint_iterator vcit = vertices_in_constraint_begin(cid);
+	vcit != vertices_in_constraint_end(cid);
+	vcit++){
+      insert_incident_faces(vcit, out);
+    }
+    return cid;
+  }
+
+  virtual Vertex_handle intersect(Face_handle f, int i, 
+			  Vertex_handle vaa,
+			  Vertex_handle vbb);
+  Vertex_handle intersect(Face_handle f, int i, 
+			  Vertex_handle vaa,
+			  Vertex_handle vbb,
+			  No_intersection_tag);
+  Vertex_handle intersect(Face_handle f, int i, 
+			  Vertex_handle vaa,
+			  Vertex_handle vbb,
+			  Exact_intersections_tag);
+  Vertex_handle intersect(Face_handle f, int i, 
+			  Vertex_handle vaa,
+			  Vertex_handle vbb,
+			  Exact_predicates_tag);
+ 
+  // REMOVAL
+
+  template <class OutputIterator>
+  void remove_constraint(Constraint_id cid, OutputIterator out)
+  {
+    std::list<Vertex_handle> vertices(hierarchy.vertices_in_constraint_begin(cid),
+				      hierarchy.vertices_in_constraint_end(cid));
+
+    hierarchy.remove_constraint(cid);
+    for(typename std::list<Vertex_handle>::iterator it = vertices.begin(), 
+	  succ = it; 
+	++succ != vertices.end(); 
+	++it){
+      if(! is_subconstraint(*it, *succ)){ // this checks whether other constraints pass
+	Face_handle fh;
+	int i;
+        CGAL_triangulation_assertion_code(bool b =)
+          Triangulation::is_edge(*it, *succ, fh, i);
+	CGAL_triangulation_assertion(b);
+	Triangulation::remove_constrained_edge(fh,i, out); // this does also flipping if necessary.
+      }
+    }
+  }
+  void remove_constraint(Constraint_id cid)
+  {
+    remove_constraint(cid, Emptyset_iterator());
+  }
+
+  void remove_constraint(Vertex_handle va, Vertex_handle vb)
+  {
+    hierarchy.remove_constraint(va,vb);
+  }
+
+  void simplify(Vertices_in_constraint_iterator v)
+  {
+    Vertices_in_constraint_iterator u = boost::prior(v);
+    Vertices_in_constraint_iterator w = boost::next(v);
+    bool unew = (*u != *w);
+    hierarchy.simplify(u,v,w);
+    
+    Triangulation::remove_incident_constraints(*v);
+  
+    Triangulation::remove(*v);
+  
+    if(unew){
+      Triangulation::insert_constraint(*u, *w);
+    }
+  }
+
+  std::size_t remove_points_without_corresponding_vertex(Constraint_id cid)
+  {
+    return hierarchy.remove_points_without_corresponding_vertex(cid);
+  }
+  std::size_t remove_points_without_corresponding_vertex()
+  {
+    return hierarchy.remove_points_without_corresponding_vertex();
+  }
+
+
+  // CONCATENATE AND SPLIT
+
+  // concatenates two constraints
+  Constraint_id
+  concatenate(Constraint_id first, Constraint_id second);
+
+  // split a constraint in two constraints, so that vcit becomes the first
+  // vertex of the new constraint
+  // returns the new constraint 
+  Constraint_id
+  split(Constraint_id first, Vertices_in_constraint_iterator vcit);
+  
+  // Query of the constraint hierarchy
+  Constraint_iterator constraints_begin() const;
+  Constraint_iterator constraints_end()   const;
+  Subconstraint_iterator subconstraints_begin() const;
+  Subconstraint_iterator subconstraints_end() const;
+  Context   context(Vertex_handle va, Vertex_handle vb); //AF: const; 
+
+  bool is_subconstraint(Vertex_handle va, 
+			Vertex_handle vb);
+  size_type number_of_enclosing_constraints(Vertex_handle va, 
+                                            Vertex_handle vb) const;
+  Context_iterator   contexts_begin(Vertex_handle va, 
+				    Vertex_handle vb) const;
+  Context_iterator   contexts_end(Vertex_handle va, 
+				  Vertex_handle vb) const;
+
+  Vertices_in_constraint_iterator vertices_in_constraint_begin(Constraint_id cid) const;
+  Vertices_in_constraint_iterator vertices_in_constraint_end(Constraint_id cid) const ;  
+  Vertices_in_constraint_iterator vertices_in_constraint_begin(Vertex_handle va, Vertex_handle vb) const;
+  Vertices_in_constraint_iterator vertices_in_constraint_end(Vertex_handle va, Vertex_handle vb) const ;
+  Points_in_constraint_iterator points_in_constraint_begin(Constraint_id cid) const;
+  Points_in_constraint_iterator points_in_constraint_end(Constraint_id cid) const ;
+
+
+  size_type number_of_constraints() {
+    return static_cast<size_type> (hierarchy.number_of_constraints());}
+  size_type number_of_subconstraints(){
+    return static_cast<size_type> (hierarchy.number_of_subconstraints());}
+
+  // public member, used by Mesh_2::Refine_edges
+  void split_constraint(Vertex_handle v1, Vertex_handle v2,
+                        Vertex_handle va) {
+    hierarchy.split_constraint(v1,v2,va);
+  }
+
+protected:
+  template <class OutputItertator>
+  void insert_incident_faces(Vertices_in_constraint_iterator vcit, OutputItertator out)
+  {
+    Vertex_handle vh = *vcit;
+    Face_circulator fc = incident_faces(vh), done = fc;
+    Face_circulator null ;
+    if ( fc != null )
+    {
+      do {
+        Face_handle fh = fc;
+        out = fh;
+        out++;
+        fc++;
+      }while(fc != done);
+    }
+  }  
+
+
+void
+insert_subconstraint(Vertex_handle vaa,
+		     Vertex_handle vbb)
+  {
+    insert_subconstraint(vaa,vbb,Emptyset_iterator());
+  }
+
+
+
+
+template <class OutputItertator>
+void
+insert_subconstraint(Vertex_handle vaa,
+		     Vertex_handle vbb,
+		     OutputItertator out)
+  // insert the subconstraint [vaa vbb] 
+  // it will eventually be splitted into several subconstraints
+{
+  CGAL_triangulation_precondition( vaa != vbb);
+  Vertex_handle vi;
+
+  Face_handle fr;
+  int i;
+  if(this->includes_edge(vaa,vbb,vi,fr,i)) {
+    this->mark_constraint(fr,i);
+    if (vi != vbb)  {
+      hierarchy.split_constraint(vaa,vbb,vi);
+      insert_subconstraint(vi,vbb, out);
+    }
+    return;
+  }
+      
+  List_faces intersected_faces;
+  List_edges conflict_boundary_ab, conflict_boundary_ba;
+     
+  bool intersection  = this->find_intersected_faces( 
+    vaa, vbb,
+    intersected_faces,
+    conflict_boundary_ab,
+    conflict_boundary_ba,
+    vi);
+
+  if ( intersection) {
+    if (vi != vaa && vi != vbb) {
+      hierarchy.split_constraint(vaa,vbb,vi);
+      insert_subconstraint(vaa,vi, out); 
+      insert_subconstraint(vi,vbb, out); 
+     }
+    else insert_subconstraint(vaa,vbb,out);  
+
+    
+    return;
+  }
+
+
+  //no intersection
+
+  List_edges edges(conflict_boundary_ab);
+  std::copy(conflict_boundary_ba.begin(), conflict_boundary_ba.end(), std::back_inserter(edges));
+
+  // edges may contain mirror edges. They no longer exist after triangulate_hole
+  // so we have to remove them before calling get_bounded_faces
+  if(! edges.empty()){
+
+#if defined(BOOST_MSVC) && (BOOST_VERSION == 105500)
+    std::set<Face_handle> faces(intersected_faces.begin(), intersected_faces.end());
+#else
+    boost::container::flat_set<Face_handle> faces(intersected_faces.begin(), intersected_faces.end());
+#endif
+    typename List_edges::iterator it2;
+    for(typename List_edges::iterator it = edges.begin(); it!= edges.end();){
+      if(faces.find(it->first) != faces.end()){
+        typename List_edges::iterator it2 = it;
+        ++it;
+        edges.erase(it2);
+      }else {
+        ++it;
+      }
+    }
+  }
+
+  this->triangulate_hole(intersected_faces,
+                         conflict_boundary_ab,
+                         conflict_boundary_ba);
+
+  this->get_bounded_faces(edges.begin(),
+                          edges.end(),
+                          out);
+
+  if (vi != vbb) {
+    hierarchy.split_constraint(vaa,vbb,vi);
+    insert_subconstraint(vi,vbb, out); 
+  }
+  return;
+}
+
+
+
+  //to debug
+public:
+  void print_hierarchy() { hierarchy.print(); }
+
+  //template member functions
+public:
+  template < class InputIterator >
+#if defined(_MSC_VER)
+  std::ptrdiff_t insert(InputIterator first, InputIterator last, int i = 0)
+#else
+    std::ptrdiff_t insert(InputIterator first, InputIterator last) 
+#endif
+  {
+    size_type n = this->number_of_vertices();
+
+    std::vector<Point> points (first, last);
+
+    spatial_sort (points.begin(), points.end(), geom_traits());
+
+    Face_handle hint;
+    for (typename std::vector<Point>::const_iterator p = points.begin(), end = points.end();
+            p != end; ++p)
+        hint = insert (*p, hint)->face();
+
+    return this->number_of_vertices() - n;
+  }
+
+};
+
+template <class Tr>
+void
+Constrained_triangulation_plus_2<Tr>::
+copy_triangulation(const Constrained_triangulation_plus_2 &ctp)
+{
+  Base::copy_triangulation(ctp);
+  //the following assumes that the triangulation and its copy
+  // iterate on their vertices in the same order 
+  std::map<Vertex_handle,Vertex_handle> vmap;
+  Vertex_iterator vit = ctp.vertices_begin();
+  Vertex_iterator vvit = this->vertices_begin();
+  for( ; vit != ctp.vertices_end(); ++vit, ++vvit) {
+    CGAL_triangulation_assertion(vit->point() == vvit->point());
+    vmap[vit] = vvit;
+  }
+  hierarchy.copy(ctp.hierarchy, vmap);
+}
+
+template <class Tr>
+void
+Constrained_triangulation_plus_2<Tr>::
+swap(Constrained_triangulation_plus_2 &ctp)
+{
+  Base::swap(ctp);
+  hierarchy.swap(ctp.hierarchy);
+}
+
+template < class Tr >
+inline 
+typename Constrained_triangulation_plus_2<Tr>::Vertex_handle
+Constrained_triangulation_plus_2<Tr>::
+insert(const Point& a, Face_handle start)
+{
+  Locate_type lt;
+  int li;
+  Face_handle loc = this->locate(a, lt, li, start);
+  return insert(a,lt,loc,li);
+}
+
+template < class Tr>
+typename Constrained_triangulation_plus_2<Tr>::Vertex_handle
+Constrained_triangulation_plus_2<Tr>::
+insert(const Point& a, Locate_type lt, Face_handle loc, int li)
+{
+  Vertex_handle v1, v2;
+  bool insert_in_constrained_edge = false;
+
+  if ( lt == Triangulation::EDGE && loc->is_constrained(li) ){
+    insert_in_constrained_edge = true;
+    v1=loc->vertex(ccw(li)); //endpoint of the constraint
+    v2=loc->vertex(cw(li)); // endpoint of the constraint
+  }
+  Vertex_handle va = Triangulation::insert(a,lt,loc,li);
+  // update the hierarchy
+  if (insert_in_constrained_edge) {
+    hierarchy.split_constraint(v1,v2,va);
+  }
+  return va;
+}
+
+template <class Tr>
+typename Constrained_triangulation_plus_2<Tr>:: Vertex_handle 
+Constrained_triangulation_plus_2<Tr>::
+intersect(Face_handle f, int i, 
+	  Vertex_handle vaa,
+	  Vertex_handle vbb) 
+{
+  return intersect(f, i, vaa, vbb, Intersection_tag());
+}
+
+template <class Tr>
+typename Constrained_triangulation_plus_2<Tr>:: Vertex_handle 
+Constrained_triangulation_plus_2<Tr>::
+
+intersect(Face_handle , int , 
+	  Vertex_handle ,
+	  Vertex_handle ,
+	  No_intersection_tag)
+{
+  std::cerr << " sorry, this triangulation does not deal with" 
+	    <<    std::endl
+	    << " intersecting constraints" << std::endl;
+  CGAL_triangulation_assertion(false);
+  return Vertex_handle();
+}
+
+template <class Tr>
+typename Constrained_triangulation_plus_2<Tr>:: Vertex_handle 
+Constrained_triangulation_plus_2<Tr>::
+intersect(Face_handle f, int i, 
+	  Vertex_handle vaa,
+	  Vertex_handle vbb,
+	  Exact_intersections_tag)
+// compute the intersection of the constraint edge (f,i) 
+// with the subconstraint (vaa,vbb) being inserted
+// insert the intersection point
+// (the  constraint edge (f,i) will be split in hierarchy by insert)
+// and return the Vertex_handle of the new Vertex
+{
+  Vertex_handle  vc, vd, va, vb;
+  Vertex_handle  vcc, vdd;
+  vcc = f->vertex(cw(i));
+  vdd = f->vertex(ccw(i));
+  CGAL_triangulation_assertion_code( bool b1 = )
+  hierarchy.enclosing_constraint(vcc,vdd,vc,vd);
+  CGAL_triangulation_assertion_code( bool b2 = )
+  hierarchy.enclosing_constraint(vaa,vbb,va,vb);
+  CGAL_triangulation_assertion(b1);
+  CGAL_triangulation_assertion(b2);
+
+  const Point& pa = va->point();
+  const Point& pb = vb->point();
+  const Point& pc = vc->point();
+  const Point& pd = vd->point();
+  Point pi;
+  Intersection_tag itag = Intersection_tag();
+  CGAL_triangulation_assertion_code( bool ok = )
+  intersection(geom_traits(), pa, pb, pc, pd, pi, itag );
+  CGAL_triangulation_assertion(ok);
+
+  Vertex_handle vi = insert(pi, Triangulation::EDGE, f, i);
+  return vi; 
+}
+
+template <class Tr>
+typename Constrained_triangulation_plus_2<Tr>::Vertex_handle 
+Constrained_triangulation_plus_2<Tr>::
+intersect(Face_handle f, int i, 
+	  Vertex_handle vaa,
+	  Vertex_handle vbb,
+	  Exact_predicates_tag)
+{
+  Vertex_handle  vcc, vdd;
+  vcc = f->vertex(cw(i));
+  vdd = f->vertex(ccw(i));
+
+  const Point& pa = vaa->point();
+  const Point& pb = vbb->point();
+  const Point& pc = vcc->point();
+  const Point& pd = vdd->point();
+
+  Point pi; //creator for point is required here
+  Intersection_tag itag = Intersection_tag();
+  bool ok  = intersection(geom_traits(), pa, pb, pc, pd, pi, itag );
+
+  Vertex_handle vi;
+  if ( !ok) {  //intersection detected but not computed
+    int i = limit_intersection(geom_traits(), pa, pb, pc, pd, itag);
+    switch(i){
+    case 0 : vi = vaa; break;
+    case 1 : vi = vbb; break;
+    case 2 : vi = vcc; break;
+    case 3 : vi = vdd; break; 
+    }
+    if(vi == vaa || vi == vbb) {
+      Triangulation::remove_constrained_edge(f, i);
+    }
+  }
+  else{ //computed
+    Triangulation::remove_constrained_edge(f, i);
+    vi = insert(pi, f);
+  }
+
+  // vi == vc or vi == vd may happen even if intersection==true
+  // due to approximate construction of the intersection
+  if (vi != vcc && vi != vdd) { 
+    hierarchy.split_constraint(vcc,vdd,vi);
+    insert_subconstraint(vcc,vi); 
+    insert_subconstraint(vi, vdd);
+  } 
+  else {
+    insert_subconstraint(vcc,vdd);
+  }
+  return vi; 
+}
+
+  // CONCATENATE AND SPLIT
+
+  // concatenates two constraints
+template <class Tr>
+typename Constrained_triangulation_plus_2<Tr>::Constraint_id
+Constrained_triangulation_plus_2<Tr>::concatenate(Constraint_id first, Constraint_id second)
+{
+  return hierarchy.concatenate(first,second);
+}
+
+  // split a constraint in two constraints, so that vcit becomes the first
+  // vertex of the new constraint
+  // returns the new constraint 
+template <class Tr>
+typename Constrained_triangulation_plus_2<Tr>::Constraint_id
+Constrained_triangulation_plus_2<Tr>::split(Constraint_id first, Vertices_in_constraint_iterator vcit)
+{
+  return hierarchy.split(first, vcit);
+}
+
+
+template <class Tr>
+std::ostream &
+operator<<(std::ostream& os, 
+	   const Constrained_triangulation_plus_2<Tr> &ct)
+{
+  ct.file_output(os);
+  return os ;
+}
+
+// Constraint Hierarchy Queries
+
+template <class Tr>
+inline
+typename
+Constrained_triangulation_plus_2<Tr>::Constraint_iterator
+Constrained_triangulation_plus_2<Tr>::
+constraints_begin() const
+{
+  return hierarchy.c_begin();
+}
+
+template <class Tr>
+inline
+typename
+Constrained_triangulation_plus_2<Tr>::Constraint_iterator
+Constrained_triangulation_plus_2<Tr>::
+constraints_end() const
+{
+  return hierarchy.c_end();
+}
+
+template <class Tr>
+inline
+typename
+Constrained_triangulation_plus_2<Tr>::Subconstraint_iterator
+Constrained_triangulation_plus_2<Tr>::
+subconstraints_begin() const
+{
+  return hierarchy.subconstraint_begin();
+}
+
+template <class Tr>
+inline
+typename
+Constrained_triangulation_plus_2<Tr>::Subconstraint_iterator
+Constrained_triangulation_plus_2<Tr>::
+subconstraints_end() const
+{
+  return hierarchy.subconstraint_end();
+}
+
+
+template <class Tr>
+inline
+typename Constrained_triangulation_plus_2<Tr>::Context
+Constrained_triangulation_plus_2<Tr>::
+context(Vertex_handle va, Vertex_handle vb) // AF: const
+{
+  return hierarchy.context(va,vb);
+}
+
+
+template <class Tr>
+inline 
+typename Constrained_triangulation_plus_2<Tr>::size_type
+Constrained_triangulation_plus_2<Tr>::
+number_of_enclosing_constraints(Vertex_handle va, Vertex_handle vb) const
+{
+ return static_cast<size_type> 
+   (hierarchy.number_of_enclosing_constraints(va,vb)); 
+}
+
+template <class Tr>
+inline bool
+Constrained_triangulation_plus_2<Tr>::
+is_subconstraint(Vertex_handle va, Vertex_handle vb)
+{
+ return hierarchy.is_subconstrained_edge(va,vb); 
+}
+
+
+template <class Tr>
+inline
+typename Constrained_triangulation_plus_2<Tr>::Context_iterator
+Constrained_triangulation_plus_2<Tr>::
+contexts_begin(Vertex_handle va, Vertex_handle vb) const
+{
+  return hierarchy.contexts_begin(va,vb);
+}
+
+template <class Tr>
+inline
+typename Constrained_triangulation_plus_2<Tr>::Context_iterator
+Constrained_triangulation_plus_2<Tr>::
+contexts_end(Vertex_handle va, Vertex_handle vb) const
+{
+  return hierarchy.contexts_end(va,vb);
+}
+
+template <class Tr>
+inline
+typename Constrained_triangulation_plus_2<Tr>::Vertices_in_constraint_iterator
+Constrained_triangulation_plus_2<Tr>::
+vertices_in_constraint_begin(Constraint_id cid) const
+{
+  return  hierarchy.vertices_in_constraint_begin(cid);
+}
+
+template <class Tr>
+inline
+typename Constrained_triangulation_plus_2<Tr>::Vertices_in_constraint_iterator
+Constrained_triangulation_plus_2<Tr>::
+vertices_in_constraint_end(Constraint_id cid) const
+{
+  return  hierarchy.vertices_in_constraint_end(cid);
+}
+template <class Tr>
+inline
+typename Constrained_triangulation_plus_2<Tr>::Vertices_in_constraint_iterator
+Constrained_triangulation_plus_2<Tr>::
+vertices_in_constraint_begin(Vertex_handle va, Vertex_handle vb) const
+{
+  return  hierarchy.vertices_in_constraint_begin(va,vb);
+}
+
+template <class Tr>
+inline
+typename Constrained_triangulation_plus_2<Tr>::Vertices_in_constraint_iterator
+Constrained_triangulation_plus_2<Tr>::
+vertices_in_constraint_end(Vertex_handle va, Vertex_handle vb) const
+{
+  return  hierarchy.vertices_in_constraint_end(va,vb);
+}
+
+template <class Tr>
+inline
+typename Constrained_triangulation_plus_2<Tr>::Points_in_constraint_iterator
+Constrained_triangulation_plus_2<Tr>::
+points_in_constraint_begin(Constraint_id cid) const
+{
+  return  hierarchy.points_in_constraint_begin(cid);
+}
+
+template <class Tr>
+inline
+typename Constrained_triangulation_plus_2<Tr>::Points_in_constraint_iterator
+Constrained_triangulation_plus_2<Tr>::
+points_in_constraint_end(Constraint_id cid) const
+{
+  return  hierarchy.points_in_constraint_end(cid);
+}
+
+} //namespace CGAL
+
+#if defined(BOOST_MSVC)
+#  pragma warning(pop)
+#endif
+#endif //CGAL_CONSTRAINED_TRIANGULATION_PLUS_2_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Constrained_voronoi_diagram_2.h b/3rdparty/CGAL/include/CGAL/Constrained_voronoi_diagram_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Constrained_voronoi_diagram_2.h
rename to 3rdparty/CGAL/include/CGAL/Constrained_voronoi_diagram_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Constraint_hierarchy_2.h b/3rdparty/CGAL/include/CGAL/Constraint_hierarchy_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Constraint_hierarchy_2.h
rename to 3rdparty/CGAL/include/CGAL/Constraint_hierarchy_2.h
diff --git a/3rdparty/CGAL/include/CGAL/Construct_theta_graph_2.h b/3rdparty/CGAL/include/CGAL/Construct_theta_graph_2.h
new file mode 100644
index 0000000..0163176
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Construct_theta_graph_2.h
@@ -0,0 +1,230 @@
+// Copyright (c) 2013-2015  The University of Western Sydney, Australia.
+// 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
+// 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$
+//
+//
+// Authors: Weisheng Si, Quincy Tse
+
+/*! \file Construct_theta_graph_2.h
+ *
+ * This header implements the functor for constructing Theta graphs.
+ */
+
+#ifndef CGAL_CONSTRUCT_THETA_GRAPH_2_H
+#define CGAL_CONSTRUCT_THETA_GRAPH_2_H
+
+#include <iostream>
+#include <cstdlib>
+#include <utility>
+#include <CGAL/Aff_transformation_2.h>
+#include <CGAL/Compute_cone_boundaries_2.h>
+#include <CGAL/Cone_spanners_2/Less_by_direction_2.h>
+#include <CGAL/Cone_spanners_2/Plane_scan_tree.h>
+
+#include <boost/config.hpp>
+#include <boost/graph/adjacency_list.hpp>
+
+namespace CGAL {
+
+/*! \ingroup PkgConeBasedSpanners
+
+ \brief A template functor for constructing Theta graphs with a given set of 2D points and
+         a given initial direction for the cone boundaries.
+
+ \tparam Traits_  Must be either `CGAL::Exact_predicates_exact_constructions_kernel_with_root_of` 
+                  or `CGAL::Exact_predicates_inexact_constructions_kernel`.
+
+ \tparam Graph_   The graph type to store the constructed cone based spanner.
+                  It must be <A HREF="http://www.boost.org/libs/graph/doc/adjacency_list.html">`boost::adjacency_list`</A> 
+                  with `Traits_::Point_2` as `VertexProperties`.
+ */
+template <typename Traits_, typename Graph_>
+class Construct_theta_graph_2 {
+
+public:
+
+    /*! the geometric traits class.  */
+    typedef Traits_ Traits;
+
+    /*! the specific type of `boost::adjacency_list`. */
+    typedef Graph_                           Graph;
+
+    /*! the point type */
+    typedef typename Traits::Point_2                 Point_2;
+
+    /*! the direction type */
+    typedef typename Traits::Direction_2             Direction_2;
+
+private:
+
+
+    typedef typename Traits::Line_2                  Line_2;
+    typedef typename Traits::Aff_transformation_2    Transformation;
+    typedef Less_by_direction_2<Traits, Graph_>      Less_by_direction;
+
+    /* Store the number of cones.  */
+    unsigned int  cone_number;
+
+    /* Store the directions of the rays dividing the plane. The initial direction will be
+     * stored in rays[0].
+     */
+    std::vector<Direction_2>   rays;
+
+public:
+    /*! \brief Constructor.
+
+     \param k     Number of cones to divide space into
+     \param initial_direction  A direction denoting one of the rays dividing the
+                   cones. This allows arbitary rotations of the rays that divide
+                   the plane.  (default: positive x-axis)
+     */
+    Construct_theta_graph_2 (unsigned int k,
+                             Direction_2 initial_direction = Direction_2(1,0)
+                            ): cone_number(k), rays(std::vector<Direction_2>(k))
+
+    {
+        if (k<2) {
+            std::cout << "The number of cones must be larger than 1!" << std::endl;
+            CGAL_assertion(false);
+        }
+
+        /* Initialize a functor, specialization will happen here depending on the kernel type to
+         compute the cone boundaries either exactly or inexactly */
+        Compute_cone_boundaries_2<Traits> compute_cones;
+        // compute the rays using the functor
+        compute_cones(k, initial_direction, rays.begin());
+    }
+
+    /*!
+     \brief Function operator to construct a Theta graph.
+
+     \details For the details of this algorithm, please refer to the User Manual.
+
+     \tparam  PointInputIterator an `InputIterator` with value type `Point_2`.
+     \param[in] start An iterator pointing to the first vertex of the input.
+     \param[in] end   An iterator pointing to the past-the-end location of the input.
+     \param[out] g    The constructed graph object.
+     */
+    template <typename PointInputIterator>
+    Graph_& operator()(const PointInputIterator& start,
+                       const PointInputIterator& end,
+                       Graph_& g) {
+        // add vertices into the graph
+        for (PointInputIterator curr = start; curr != end; ++curr) {
+            g[boost::add_vertex(g)] = *curr;
+        }
+
+        unsigned int i;   // ray index of the cw ray
+        unsigned int j;   // index of the ccw ray
+
+        // add edges into the graph for every cone
+        for (i = 0; i < cone_number; i++) {
+            j = (i+1) % cone_number;
+            add_edges_in_cone(rays[i], rays[j], g);
+        }
+
+        return g;
+    }
+
+    /*! \brief returns the number of cones.
+     */
+    unsigned int number_of_cones() const {
+        return cone_number;
+    }
+
+    /*! \brief outputs the set of directions to the iterator `result`.
+
+      \tparam DirectionOutputIterator  an `OutputIterator` with value type `Direction_2`.
+       \return `result`
+     */
+    template<class DirectionOutputIterator>
+    DirectionOutputIterator directions(DirectionOutputIterator result) {
+        typename std::vector<Direction_2>::iterator it;
+        for (it=rays.begin(); it!=rays.end(); it++) {
+            *result++ = *it;
+        }
+        return result;
+    }
+
+protected:
+
+    /* Construct edges in one cone bounded by two directions.
+
+     \param cwBound      The direction of the clockwise boundary of the cone.
+     \param ccwBound     The direction of the counter-clockwise boundary.
+     \param g            The Theta graph to be built.
+    */
+    void add_edges_in_cone(const Direction_2& cwBound, const Direction_2& ccwBound, Graph_& g) {
+        if (ccwBound == cwBound) {
+            // Degenerate case,  not allowed.
+            throw std::out_of_range("The cw boundary and the ccw boundary shouldn't be same!");
+        }
+
+        // Find angle bisector (requiring sqrt(), not exact)
+        Line_2 cwLine(ORIGIN, cwBound);
+        Line_2 ccwLine(ORIGIN, ccwBound);
+        Direction_2 bisector_direction = bisector(cwLine, ccwLine).direction();
+
+        // Rotational transformation of cw 90 degree
+        static const Transformation cw90( 0, 1, -1,  0);
+
+        // Ordering
+        // here D1 is the reverse of D1 in the book, we find this is easier to implement
+        const Less_by_direction  orderD1 (g, ccwBound);
+        const Less_by_direction  orderD2 (g, cwBound);
+        const Less_by_direction  orderMid(g, cw90(bisector_direction));
+
+        typename Graph_::vertex_iterator vit, ve;
+        boost::tie(vit, ve) = boost::vertices(g);
+
+        // Step 1: Sort S according to order induced by D1
+        std::vector<typename Graph_::vertex_descriptor> S(vit, ve);
+        std::sort(S.begin (), S.end (), orderD1);
+
+        // Step 2: Initialise an empty set to store vertices sorted by orderD2
+        typedef CGAL::ThetaDetail::Plane_scan_tree<typename Graph_::vertex_descriptor,
+                typename Graph_::vertex_descriptor,
+                Less_by_direction,
+                Less_by_direction > PSTree;
+        PSTree pst(orderD2, orderMid);
+
+        // Step 3: visit S in orderD1 
+        //         insert '*it' into T
+        //         find ri = T.minAbove(*it)
+        //         add an edge 
+        for (typename std::vector<typename Graph_::vertex_descriptor>::const_iterator
+                it = S.begin(); it != S.end(); ++it) {
+            pst.add(*it, *it);
+            const typename Graph_::vertex_descriptor *const ri = pst.minAbove(*it);
+            if ( ri != NULL ) {
+                typename Graph_::edge_descriptor existing_e;
+                bool                    existing;
+                // check whether the edge already exists
+                boost::tie(existing_e, existing)=boost::edge(*it, *ri, g);
+                if (!existing)
+                    boost::add_edge(*it, *ri, g);
+            }
+
+        }  // end of for
+    };     // end of add edges in cone
+
+};      // class Construct_theta_graph_2
+
+
+}  // namespace CGAL
+
+
+#endif
diff --git a/3rdparty/CGAL/include/CGAL/Construct_yao_graph_2.h b/3rdparty/CGAL/include/CGAL/Construct_yao_graph_2.h
new file mode 100644
index 0000000..b3e0af3
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Construct_yao_graph_2.h
@@ -0,0 +1,238 @@
+// Copyright (c) 2013-2015  The University of Western Sydney, Australia.
+// 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
+// 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$
+//
+//
+// Authors: Weisheng Si, Quincy Tse
+
+/*! \file Construct_yao_graph_2.h
+ *
+ * This header implements the functor for constructing Yao graphs.
+ */
+
+#ifndef CGAL_CONSTRUCT_YAO_GRAPH_2_H
+#define CGAL_CONSTRUCT_YAO_GRAPH_2_H
+
+#include <iostream>
+#include <cstdlib>
+#include <utility>
+#include <CGAL/Compute_cone_boundaries_2.h>
+#include <CGAL/Cone_spanners_2/Less_by_direction_2.h>
+
+#include <boost/config.hpp>
+#include <boost/graph/adjacency_list.hpp>
+
+namespace CGAL {
+
+/*! \ingroup PkgConeBasedSpanners
+
+ \brief A template functor for constructing Yao graphs with a given set of 2D points and
+         a given initial direction for the cone boundaries.
+
+ \tparam Traits_  Must be either `CGAL::Exact_predicates_exact_constructions_kernel_with_root_of` 
+                  or `CGAL::Exact_predicates_inexact_constructions_kernel`.
+
+ \tparam Graph_  The graph type to store the constructed cone based spanner.
+                 It must be <A HREF="http://www.boost.org/libs/graph/doc/adjacency_list.html">`boost::adjacency_list`</A> 
+                 with `Traits_::Point_2` as `VertexProperties`
+ */
+template <typename Traits_, typename Graph_>
+class Construct_yao_graph_2 {
+
+public:
+    /*! the geometric traits class. */
+    typedef Traits_      Traits;
+    /*! the specific type of `boost::adjacency_list`. */
+    typedef Graph_                        Graph;
+
+    /*! the point type */
+    typedef typename Traits::Point_2                 Point_2;
+
+    /*! the direction type */
+    typedef typename Traits::Direction_2             Direction_2;
+
+private:
+    typedef typename Traits::Line_2                Line_2;
+    typedef Less_by_direction_2<Traits, Graph_>    Less_by_direction;
+    // a type for the set to store vertices sorted by a direction
+    typedef std::set<typename Graph_::vertex_descriptor, Less_by_direction> Point_set;
+
+    /* Store the number of cones.  */
+    unsigned int  cone_number;
+
+    /* Store the directions of the rays dividing the plane. The initial direction will be
+       stored in rays[0].  */
+    std::vector<Direction_2>   rays;
+
+public:
+    /*!
+      \brief    Constructor.
+
+      \param k     Number of cones to divide space into
+      \param initial_direction  A direction denoting one of the rays dividing the
+                   cones. This allows arbitary rotations of the rays that divide
+                   the plane.  (default: positive x-axis)
+     */
+    Construct_yao_graph_2 (unsigned int k,
+                           Direction_2 initial_direction = Direction_2(1,0)
+                          ): cone_number(k), rays(std::vector<Direction_2>(k))
+
+    {
+        if (k<2) {
+            std::cout << "The number of cones must be larger than 1!" << std::endl;
+            CGAL_assertion(false);
+        }
+
+        /* Initialize a functor, specialization will happen here depending on the kernel type to
+         compute the cone boundaries either exactly or inexactly */
+        Compute_cone_boundaries_2<Traits> compute_cones;
+        // compute the rays using the functor
+        compute_cones(k, initial_direction, rays.begin());
+    }
+
+    /*!
+      \brief Function operator to construct a Yao graph.
+
+      \details For the details of this algorithm, please refer to the User Manual.
+
+      \tparam  PointInputIterator an `InputIterator` with value type `Point_2`.
+
+      \param[in] start An iterator pointing to the first vertex of the input.
+      \param[in]  end  An iterator pointing to the past-the-end location of the input.
+      \param[out]  g   The constructed graph object.
+     */
+    template <typename PointInputIterator>
+    Graph_& operator()(const PointInputIterator& start,
+                       const PointInputIterator& end,
+                       Graph_& g) {
+        // add vertices into the graph
+        for (PointInputIterator curr = start; curr != end; ++curr) {
+            g[boost::add_vertex(g)] = *curr;
+        }
+
+        unsigned int i;   // ray index of the cw ray
+        unsigned int j;   // index of the ccw ray
+
+        // add edges into the graph for every cone
+        for (i = 0; i < cone_number; i++) {
+            j = (i+1) % cone_number;
+            add_edges_in_cone(rays[i], rays[j], g);
+        }
+
+        return g;
+    }
+
+    /*! \brief returns the number of cones.
+     */
+    unsigned int number_of_cones() const {
+        return cone_number;
+    }
+
+    /*! \brief outputs the set of directions to the iterator `result`.
+
+      \tparam DirectionOutputIterator  an `OutputIterator` with value type `Direction_2`.
+        \return `result`
+    */
+    template<class DirectionOutputIterator>
+    DirectionOutputIterator directions(DirectionOutputIterator result) {
+        typename std::vector<Direction_2>::iterator it;
+        for (it=rays.begin(); it!=rays.end(); it++) {
+            *result++ = *it;
+        }
+        return result;
+    }
+
+protected:
+
+    /* Construct edges in one cone bounded by two directions.
+
+     \param cwBound      The direction of the clockwise boundary of the cone.
+     \param ccwBound     The direction of the counter-clockwise boundary.
+     \param g            The Yao graph to be built.
+    */
+    void add_edges_in_cone(const Direction_2& cwBound, const Direction_2& ccwBound, Graph_& g) {
+        if (ccwBound == cwBound) {
+            // Degenerate case,  not allowed.
+            throw std::out_of_range("The cw boundary and the ccw boundary shouldn't be same!");
+        }
+
+        // Ordering
+        // here D1 is the reverse of D1 in the book, we find this is easier to implement
+        const Less_by_direction  orderD1 (g, ccwBound);
+        const Less_by_direction  orderD2 (g, cwBound);
+
+        typename Graph_::vertex_iterator vit, ve;
+        boost::tie(vit, ve) = boost::vertices(g);
+
+        // Step 1: Sort S according to order induced by D1
+        std::vector<typename Graph_::vertex_descriptor> S(vit, ve);
+        std::sort(S.begin (), S.end (), orderD1);
+
+        // Step 2: Initialise an empty set to store vertices sorted by orderD2
+        Point_set pst(orderD2);
+
+        // Step 3: visit S in orderD1
+        //         insert 'it' into pst
+        //         search the min in pst
+        for (typename std::vector<typename Graph_::vertex_descriptor>::const_iterator
+                it = S.begin(); it != S.end(); ++it) {
+            Less_euclidean_distance comp(g[*it], g);
+
+            pst.insert(*it);
+            // Find the last added node - O(logn)
+            typename Point_set::iterator it2 = pst.find(*it);
+            // Find minimum in pst from last ended node - O(n)
+            typename Point_set::iterator min = std::min_element(++it2, pst.end(), comp);
+            // add an edge
+            if (min != pst.end()) {
+                typename Graph_::edge_descriptor existing_e;
+                bool                    existing;
+                // check whether the edge already exists
+                boost::tie(existing_e, existing)=boost::edge(*it, *min, g);
+                if (!existing)
+                    boost::add_edge(*it, *min, g);
+            }
+
+        } // end of for
+
+    };     // end of add edges in cone
+
+
+    /* Functor for comparing Euclidean distances of two vertices in a graph g to a given vertex.
+      It is implemented by encapsulating the CGAL::has_smaller_distance_to_point() function.
+     */
+    struct Less_euclidean_distance {
+        const Point_2& p;
+        const Graph_& g;
+
+        // constructor
+        Less_euclidean_distance(const Point_2&p, const Graph_& g) : p(p), g(g) {}
+
+        // operator
+        bool operator() (const typename Point_set::iterator::value_type& i, const typename Point_set::iterator::value_type& j) {
+            const Point_2& p1 = g[i];
+            const Point_2& p2 = g[j];
+            return has_smaller_distance_to_point(p, p1, p2);
+        }
+    };
+
+};      // class Construct_yao_graph_2
+
+
+}  // namespace CGAL
+
+
+#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convertible_circulator_project.h b/3rdparty/CGAL/include/CGAL/Convertible_circulator_project.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convertible_circulator_project.h
rename to 3rdparty/CGAL/include/CGAL/Convertible_circulator_project.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convertible_filter_iterator.h b/3rdparty/CGAL/include/CGAL/Convertible_filter_iterator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convertible_filter_iterator.h
rename to 3rdparty/CGAL/include/CGAL/Convertible_filter_iterator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convertible_iterator_project.h b/3rdparty/CGAL/include/CGAL/Convertible_iterator_project.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convertible_iterator_project.h
rename to 3rdparty/CGAL/include/CGAL/Convertible_iterator_project.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convex_decomposition_3/Edge_sorter.h b/3rdparty/CGAL/include/CGAL/Convex_decomposition_3/Edge_sorter.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convex_decomposition_3/Edge_sorter.h
rename to 3rdparty/CGAL/include/CGAL/Convex_decomposition_3/Edge_sorter.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convex_decomposition_3/External_structure_builder.h b/3rdparty/CGAL/include/CGAL/Convex_decomposition_3/External_structure_builder.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convex_decomposition_3/External_structure_builder.h
rename to 3rdparty/CGAL/include/CGAL/Convex_decomposition_3/External_structure_builder.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convex_decomposition_3/Insert_vertex_into_edge.h b/3rdparty/CGAL/include/CGAL/Convex_decomposition_3/Insert_vertex_into_edge.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convex_decomposition_3/Insert_vertex_into_edge.h
rename to 3rdparty/CGAL/include/CGAL/Convex_decomposition_3/Insert_vertex_into_edge.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convex_decomposition_3/Ray_hit_generator.h b/3rdparty/CGAL/include/CGAL/Convex_decomposition_3/Ray_hit_generator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convex_decomposition_3/Ray_hit_generator.h
rename to 3rdparty/CGAL/include/CGAL/Convex_decomposition_3/Ray_hit_generator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convex_decomposition_3/Ray_hit_generator2.h b/3rdparty/CGAL/include/CGAL/Convex_decomposition_3/Ray_hit_generator2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convex_decomposition_3/Ray_hit_generator2.h
rename to 3rdparty/CGAL/include/CGAL/Convex_decomposition_3/Ray_hit_generator2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convex_decomposition_3/Reflex_edge_searcher.h b/3rdparty/CGAL/include/CGAL/Convex_decomposition_3/Reflex_edge_searcher.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convex_decomposition_3/Reflex_edge_searcher.h
rename to 3rdparty/CGAL/include/CGAL/Convex_decomposition_3/Reflex_edge_searcher.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convex_decomposition_3/Reflex_vertex_searcher.h b/3rdparty/CGAL/include/CGAL/Convex_decomposition_3/Reflex_vertex_searcher.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convex_decomposition_3/Reflex_vertex_searcher.h
rename to 3rdparty/CGAL/include/CGAL/Convex_decomposition_3/Reflex_vertex_searcher.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convex_decomposition_3/SFace_separator.h b/3rdparty/CGAL/include/CGAL/Convex_decomposition_3/SFace_separator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convex_decomposition_3/SFace_separator.h
rename to 3rdparty/CGAL/include/CGAL/Convex_decomposition_3/SFace_separator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convex_decomposition_3/SM_walls.h b/3rdparty/CGAL/include/CGAL/Convex_decomposition_3/SM_walls.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convex_decomposition_3/SM_walls.h
rename to 3rdparty/CGAL/include/CGAL/Convex_decomposition_3/SM_walls.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convex_decomposition_3/Single_wall_creator.h b/3rdparty/CGAL/include/CGAL/Convex_decomposition_3/Single_wall_creator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convex_decomposition_3/Single_wall_creator.h
rename to 3rdparty/CGAL/include/CGAL/Convex_decomposition_3/Single_wall_creator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convex_decomposition_3/Single_wall_creator2.h b/3rdparty/CGAL/include/CGAL/Convex_decomposition_3/Single_wall_creator2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convex_decomposition_3/Single_wall_creator2.h
rename to 3rdparty/CGAL/include/CGAL/Convex_decomposition_3/Single_wall_creator2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convex_decomposition_3/Single_wall_creator3.h b/3rdparty/CGAL/include/CGAL/Convex_decomposition_3/Single_wall_creator3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convex_decomposition_3/Single_wall_creator3.h
rename to 3rdparty/CGAL/include/CGAL/Convex_decomposition_3/Single_wall_creator3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convex_decomposition_3/YVertical_wall_builder.h b/3rdparty/CGAL/include/CGAL/Convex_decomposition_3/YVertical_wall_builder.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convex_decomposition_3/YVertical_wall_builder.h
rename to 3rdparty/CGAL/include/CGAL/Convex_decomposition_3/YVertical_wall_builder.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convex_decomposition_3/is_reflex_sedge.h b/3rdparty/CGAL/include/CGAL/Convex_decomposition_3/is_reflex_sedge.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convex_decomposition_3/is_reflex_sedge.h
rename to 3rdparty/CGAL/include/CGAL/Convex_decomposition_3/is_reflex_sedge.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convex_hull_2/ch_akl_toussaint_impl.h b/3rdparty/CGAL/include/CGAL/Convex_hull_2/ch_akl_toussaint_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convex_hull_2/ch_akl_toussaint_impl.h
rename to 3rdparty/CGAL/include/CGAL/Convex_hull_2/ch_akl_toussaint_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convex_hull_2/ch_assertions.h b/3rdparty/CGAL/include/CGAL/Convex_hull_2/ch_assertions.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convex_hull_2/ch_assertions.h
rename to 3rdparty/CGAL/include/CGAL/Convex_hull_2/ch_assertions.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convex_hull_2/ch_bykat_impl.h b/3rdparty/CGAL/include/CGAL/Convex_hull_2/ch_bykat_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convex_hull_2/ch_bykat_impl.h
rename to 3rdparty/CGAL/include/CGAL/Convex_hull_2/ch_bykat_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convex_hull_2/ch_eddy_impl.h b/3rdparty/CGAL/include/CGAL/Convex_hull_2/ch_eddy_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convex_hull_2/ch_eddy_impl.h
rename to 3rdparty/CGAL/include/CGAL/Convex_hull_2/ch_eddy_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convex_hull_2/ch_graham_andrew_impl.h b/3rdparty/CGAL/include/CGAL/Convex_hull_2/ch_graham_andrew_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convex_hull_2/ch_graham_andrew_impl.h
rename to 3rdparty/CGAL/include/CGAL/Convex_hull_2/ch_graham_andrew_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convex_hull_2/ch_jarvis_impl.h b/3rdparty/CGAL/include/CGAL/Convex_hull_2/ch_jarvis_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convex_hull_2/ch_jarvis_impl.h
rename to 3rdparty/CGAL/include/CGAL/Convex_hull_2/ch_jarvis_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convex_hull_2/ch_melkman_impl.h b/3rdparty/CGAL/include/CGAL/Convex_hull_2/ch_melkman_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convex_hull_2/ch_melkman_impl.h
rename to 3rdparty/CGAL/include/CGAL/Convex_hull_2/ch_melkman_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convex_hull_2/ch_selected_extreme_points_2_impl.h b/3rdparty/CGAL/include/CGAL/Convex_hull_2/ch_selected_extreme_points_2_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convex_hull_2/ch_selected_extreme_points_2_impl.h
rename to 3rdparty/CGAL/include/CGAL/Convex_hull_2/ch_selected_extreme_points_2_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convex_hull_2/convexity_check_2_impl.h b/3rdparty/CGAL/include/CGAL/Convex_hull_2/convexity_check_2_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convex_hull_2/convexity_check_2_impl.h
rename to 3rdparty/CGAL/include/CGAL/Convex_hull_2/convexity_check_2_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convex_hull_3/dual/Convex_hull_traits_dual_2.h b/3rdparty/CGAL/include/CGAL/Convex_hull_3/dual/Convex_hull_traits_dual_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convex_hull_3/dual/Convex_hull_traits_dual_2.h
rename to 3rdparty/CGAL/include/CGAL/Convex_hull_3/dual/Convex_hull_traits_dual_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convex_hull_3/dual/Convex_hull_traits_dual_3.h b/3rdparty/CGAL/include/CGAL/Convex_hull_3/dual/Convex_hull_traits_dual_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convex_hull_3/dual/Convex_hull_traits_dual_3.h
rename to 3rdparty/CGAL/include/CGAL/Convex_hull_3/dual/Convex_hull_traits_dual_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convex_hull_3/dual/halfspace_intersection_3.h b/3rdparty/CGAL/include/CGAL/Convex_hull_3/dual/halfspace_intersection_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convex_hull_3/dual/halfspace_intersection_3.h
rename to 3rdparty/CGAL/include/CGAL/Convex_hull_3/dual/halfspace_intersection_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convex_hull_3/dual/halfspace_intersection_with_constructions_3.h b/3rdparty/CGAL/include/CGAL/Convex_hull_3/dual/halfspace_intersection_with_constructions_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convex_hull_3/dual/halfspace_intersection_with_constructions_3.h
rename to 3rdparty/CGAL/include/CGAL/Convex_hull_3/dual/halfspace_intersection_with_constructions_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convex_hull_3/dual/interior_polyhedron_3.h b/3rdparty/CGAL/include/CGAL/Convex_hull_3/dual/interior_polyhedron_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convex_hull_3/dual/interior_polyhedron_3.h
rename to 3rdparty/CGAL/include/CGAL/Convex_hull_3/dual/interior_polyhedron_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convex_hull_3/dual/predicates.h b/3rdparty/CGAL/include/CGAL/Convex_hull_3/dual/predicates.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convex_hull_3/dual/predicates.h
rename to 3rdparty/CGAL/include/CGAL/Convex_hull_3/dual/predicates.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convex_hull_d.h b/3rdparty/CGAL/include/CGAL/Convex_hull_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convex_hull_d.h
rename to 3rdparty/CGAL/include/CGAL/Convex_hull_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convex_hull_d_to_polyhedron_3.h b/3rdparty/CGAL/include/CGAL/Convex_hull_d_to_polyhedron_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convex_hull_d_to_polyhedron_3.h
rename to 3rdparty/CGAL/include/CGAL/Convex_hull_d_to_polyhedron_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convex_hull_d_traits_3.h b/3rdparty/CGAL/include/CGAL/Convex_hull_d_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convex_hull_d_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/Convex_hull_d_traits_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convex_hull_face_base_2.h b/3rdparty/CGAL/include/CGAL/Convex_hull_face_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convex_hull_face_base_2.h
rename to 3rdparty/CGAL/include/CGAL/Convex_hull_face_base_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convex_hull_projective_xy_traits_2.h b/3rdparty/CGAL/include/CGAL/Convex_hull_projective_xy_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convex_hull_projective_xy_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Convex_hull_projective_xy_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convex_hull_projective_xz_traits_2.h b/3rdparty/CGAL/include/CGAL/Convex_hull_projective_xz_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convex_hull_projective_xz_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Convex_hull_projective_xz_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convex_hull_projective_yz_traits_2.h b/3rdparty/CGAL/include/CGAL/Convex_hull_projective_yz_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convex_hull_projective_yz_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Convex_hull_projective_yz_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Convex_hull_traits_3.h b/3rdparty/CGAL/include/CGAL/Convex_hull_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Convex_hull_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/Convex_hull_traits_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Counted_number.h b/3rdparty/CGAL/include/CGAL/Counted_number.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Counted_number.h
rename to 3rdparty/CGAL/include/CGAL/Counted_number.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Counting_iterator.h b/3rdparty/CGAL/include/CGAL/Counting_iterator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Counting_iterator.h
rename to 3rdparty/CGAL/include/CGAL/Counting_iterator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/Arc_2.h b/3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/Arc_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/Arc_2.h
rename to 3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/Arc_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/Curve_interval_arcno_cache.h b/3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/Curve_interval_arcno_cache.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/Curve_interval_arcno_cache.h
rename to 3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/Curve_interval_arcno_cache.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/Curve_renderer_facade.h b/3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/Curve_renderer_facade.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/Curve_renderer_facade.h
rename to 3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/Curve_renderer_facade.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/Curved_kernel_via_analysis_2_functors.h b/3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/Curved_kernel_via_analysis_2_functors.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/Curved_kernel_via_analysis_2_functors.h
rename to 3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/Curved_kernel_via_analysis_2_functors.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/Curved_kernel_via_analysis_2_impl.h b/3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/Curved_kernel_via_analysis_2_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/Curved_kernel_via_analysis_2_impl.h
rename to 3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/Curved_kernel_via_analysis_2_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/Fig_stream_Curve_renderer_2.h b/3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/Fig_stream_Curve_renderer_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/Fig_stream_Curve_renderer_2.h
rename to 3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/Fig_stream_Curve_renderer_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/Filtered_curved_kernel_via_analysis_2_impl.h b/3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/Filtered_curved_kernel_via_analysis_2_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/Filtered_curved_kernel_via_analysis_2_impl.h
rename to 3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/Filtered_curved_kernel_via_analysis_2_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/Generic_arc_2.h b/3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/Generic_arc_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/Generic_arc_2.h
rename to 3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/Generic_arc_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/Generic_point_2.h b/3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/Generic_point_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/Generic_point_2.h
rename to 3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/Generic_point_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/Make_x_monotone_2.h b/3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/Make_x_monotone_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/Make_x_monotone_2.h
rename to 3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/Make_x_monotone_2.h
diff --git a/3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/Non_x_monotone_arc_2.h b/3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/Non_x_monotone_arc_2.h
new file mode 100644
index 0000000..759acb7
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/Non_x_monotone_arc_2.h
@@ -0,0 +1,313 @@
+// Copyright (c) 2008,2009,2010,2011 Max-Planck-Institute Saarbruecken (Germany), 
+// and Tel-Aviv University (Israel).  All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// 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(s)     : Pavel Emeliyanenko <asm at mpi-sb.mpg.de>
+
+#ifndef CGAL_CURVED_KERNEL_VIA_ANALYSIS_2_NON_X_MONOTONE_ARC_2_H
+#define CGAL_CURVED_KERNEL_VIA_ANALYSIS_2_NON_X_MONOTONE_ARC_2_H
+
+/*!\file include/CGAL/Curved_kernel_via_analysis_2/Non_x_monotone_arc_2.h
+ * \brief defines class \c Non_x_monotone_arc_2
+ *  
+ * non x-monotone arc of a generic curve
+ */
+
+#include <CGAL/config.h>
+#include <CGAL/Handle_with_policy.h>
+
+#include <CGAL/Curved_kernel_via_analysis_2/Arc_2.h>
+
+
+namespace CGAL {
+
+namespace internal {
+
+template < class CurvedKernelViaAnalysis_2 >
+class Non_x_monotone_arc_2_rep { 
+
+public:
+
+    // this instance's first template parameter
+    typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2;
+    
+    // myself
+    typedef Non_x_monotone_arc_2_rep< Curved_kernel_via_analysis_2 > Self;
+
+    // type of an arc on generic curve
+    typedef typename Curved_kernel_via_analysis_2::Arc_2 Arc_2;
+
+    // a list of x-monotone arcs
+    typedef std::vector< Arc_2 > Arc_vector;
+
+public:    
+
+    /*!\brief
+     * Default constructor
+     */
+    Non_x_monotone_arc_2_rep() {
+    }
+
+    /*!\brief 
+     * constructs from one x-monotone arc
+     */
+    Non_x_monotone_arc_2_rep(const Arc_2& arc) {
+        _m_x_monotone_arcs.push_back(arc);
+    }
+
+    /*!\brief 
+     * constructs a non x-monotone arc from the list of x-monotone pieces
+     */
+    template <class InputIterator>
+    Non_x_monotone_arc_2_rep(InputIterator start, InputIterator end) :
+        _m_x_monotone_arcs(std::distance(start, end)) {
+
+        std::copy(start, end, _m_x_monotone_arcs.begin());
+    }
+
+    //! a list of x-monotone pieces this arc consists of
+    mutable Arc_vector _m_x_monotone_arcs;
+
+}; // Non_x_monotone_arc_2_rep
+
+/*! \brief
+ * Class representing a (not necessary x-monotone) curve arc
+ *
+ * This class represents a not necessarily x-monotone curve arc. The arc is
+ * given as a list of connected x-monotone pieces.
+ *
+ * By constructing a new arc, its validity is checked to ensure that its
+ * x-monotone pieces form a single chain
+ */
+template < class CurvedKernelViaAnalysis_2,
+        class Rep_  = Non_x_monotone_arc_2_rep< CurvedKernelViaAnalysis_2 > >
+class Non_x_monotone_arc_2 :
+    public CGAL::Handle_with_policy< Rep_ > {
+    
+public:
+    //!\name public typedefs
+    //!@{
+    
+    //! this instance's first template parameter
+    typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2;
+
+    //! this instance's second template parameter
+    typedef Rep_ Rep;
+
+    //! this instance itself
+    typedef Non_x_monotone_arc_2< Curved_kernel_via_analysis_2, Rep > Self;
+    
+    //! type of curve kernel
+    typedef typename Curved_kernel_via_analysis_2::Curve_kernel_2
+        Curve_kernel_2;
+       
+    //! type of analysis of a pair of curves
+    typedef typename Curve_kernel_2::Curve_analysis_2 Curve_analysis_2;
+    
+    //! type of a point on generic curve
+    typedef typename Curved_kernel_via_analysis_2::Point_2 Point_2;
+
+    //! type of an x-monotone arc on generic curve
+    typedef typename Curved_kernel_via_analysis_2::Arc_2 Arc_2;
+
+    //! iterator type to range through the list of x-monotone arcs
+    typedef typename Rep::Arc_vector::const_iterator Arc_const_iterator;
+    
+    //! the handle superclass
+    typedef ::CGAL::Handle_with_policy< Rep > Base;
+
+    //!@}
+public:
+    //!\name basic constructors
+    //!@{
+
+    /*!\brief
+     * Default constructor
+     */
+    Non_x_monotone_arc_2() : 
+        Base(Rep()) {   
+    }
+
+    /*!\brief
+     * copy constructor
+     */
+    Non_x_monotone_arc_2(const Self& a) :
+        Base(static_cast<const Base&>(a)) {  
+    }
+
+    /*! \brief
+     * constructs an arc from one x-monotone piece
+     */
+    Non_x_monotone_arc_2(const Arc_2& arc) :
+        Base(Rep(arc)) {
+    }
+
+    /*! \brief
+     * constructs an arc from a list x-monotone pieces specified by
+     * iterator range <tt>[start; end)</tt>
+     *
+     * template argument type of \c InputIterator is \c Arc_2
+     * 
+     * \pre the x-monotone arcs must be connected into a single chain
+     * \pre either all x-monotone arcs must be vertical or non-vertical
+     */
+    template <class InputIterator>
+    Non_x_monotone_arc_2(InputIterator start, InputIterator end) :
+        Base(Rep(start, end)) {
+
+        CGAL_precondition(start != end);
+        CGAL_precondition_code(
+            InputIterator oi = start;
+            InputIterator next = ++oi;
+            bool vertical = oi->is_vertical();
+            Curve_analysis_2 curve = oi->curve();
+            for(; next != end; next++) {
+                // ensure that supporting curves are identical for all arcs
+                CGAL_precondition(next->curve().is_identical(curve));
+                // either all arcs are vertical or not
+                CGAL_precondition(vertical == next->is_vertical());
+                /* this condition is hard to check because end-points can be
+                 reordered in Arc_2 constructor
+                CGAL_precondition(oi->curve_end(CGAL::ARR_MAX_END).
+                    compare_xy(next->curve_end(CGAL::ARR_MIN_END)) ==
+                            CGAL::EQUAL);*/
+                oi = next;
+            }
+        );
+    }
+
+    //!@}
+public:
+    //! \name Access functions
+    //!@{
+    
+    /*!\brief
+     * returns the number of x-monotone arcs this object consists of
+     */
+    int number_of_x_monotone_arcs() const {
+        return static_cast<int>(this->ptr()->_m_x_monotone_arcs.size());
+    }
+    
+    /*!\brief
+     * returns iterator pointing to the first x-monotone arc in the list
+     */
+    Arc_const_iterator begin() const {
+        return this->ptr()->_m_x_monotone_arcs.begin(); 
+    }
+
+    /*!\brief
+     * returns iterator pointing to beyond the last x-monotone arc in the list
+     */
+    Arc_const_iterator end() const {
+        return this->ptr()->_m_x_monotone_arcs.end();
+    }
+
+#if 1 // not needed
+    /*!\brief
+     * returns a distinct \c ith x-monotone piece of the arc
+     */
+    const Arc_2& x_monotone_arc(int i) const {
+        CGAL_precondition(i >= 0);
+        CGAL_precondition(i < number_of_x_monotone_arcs());
+        return this->ptr()->_m_x_monotone_arcs[i];
+    }
+#endif	
+
+    /*!\brief
+     * returns the supporting curve
+     */
+    Curve_analysis_2 curve() const {
+        CGAL_precondition(number_of_x_monotone_arcs() > 0);
+        return this->ptr()->_m_x_monotone_arcs[0].curve();
+    }
+
+    /*!\brief
+     * returns \c true if this arc consists of vertical segments
+     */
+    bool is_vertical() const {
+        CGAL_precondition(number_of_x_monotone_arcs() > 0);
+        return this->ptr()->_m_x_monotone_arcs[0].is_vertical();
+    } 
+    
+    //!@}
+}; // Non_x_monotone_arc_2
+
+/*!\relates Non_x_monotone_arc_2
+ * \brief 
+ * output operator
+ */
+template < class CurvedKernelViaAnalysis_2, class Rep_>
+std::ostream& operator <<(std::ostream& os,
+    const Non_x_monotone_arc_2<CurvedKernelViaAnalysis_2, Rep_>& arc) {
+
+    os << "List of x-monotone arcs: [\n";
+    int i = 0;
+
+    typename Non_x_monotone_arc_2<CurvedKernelViaAnalysis_2, Rep_>::
+        Arc_const_iterator ait;
+    for(ait = arc.begin(); ait != arc.end(); ait++, i++)
+        os << i << ": " << *ait << std::endl;
+    os << "]\n\n";
+    return os;
+}
+
+#if DOXYGEN_RUNNING
+
+/*!\relates Non_x_monotone_arc_2
+ * \brief
+ * draws an arc to Qt window \c qt
+ */
+template < class CurvedKernelViaAnalysis_2, class Rep_>
+CGAL::Qt_widget& operator <<(CGAL::Qt_widget& ws,
+        const Non_x_monotone_arc_2<CurvedKernelViaAnalysis_2, Rep_>& arc) {
+
+    QPainter *ppnt = &ws.get_painter();
+
+    int n_arcs = arc.number_of_x_monotone_arcs();
+
+    QBrush defbrush = ppnt->brush();
+    // forbid drawing connection points between x-monotone pieces
+    if(n_arcs > 1)
+        ppnt->setBrush(Qt::NoBrush);
+
+    typename Non_x_monotone_arc_2<CurvedKernelViaAnalysis_2, Rep_>::
+        Arc_const_iterator ait;
+    for(ait = arc.begin(); ait != arc.end(); ait++)
+        ws << *ait;
+
+    if(n_arcs > 1) {
+        ppnt->setBrush(defbrush);
+
+        typeof(arc.x_monotone_arc(0)) const *xarc = &arc.x_monotone_arc(0);
+        if(xarc->location(CGAL::ARR_MIN_END) == CGAL::ARR_INTERIOR)
+            ws << xarc->curve_end(CGAL::ARR_MIN_END);
+
+        xarc = &arc.x_monotone_arc(n_arcs-1);
+        if(xarc->location(CGAL::ARR_MAX_END) == CGAL::ARR_INTERIOR)
+            ws << xarc->curve_end(CGAL::ARR_MAX_END);
+    }
+    return ws;
+};
+
+#endif // DOXYGEN_RUNNING
+
+} // namespace internal
+
+} //namespace CGAL
+
+#endif // CGAL_CURVED_KERNEL_VIA_ANALYSIS_2_NON_X_MONOTONE_ARC_2_H
+// EOF
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/Point_2.h b/3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/Point_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/Point_2.h
rename to 3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/Point_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/Sweep_curves_adapter_2.h b/3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/Sweep_curves_adapter_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/Sweep_curves_adapter_2.h
rename to 3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/Sweep_curves_adapter_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/gfx/Curve_renderer_2.h b/3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/gfx/Curve_renderer_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/gfx/Curve_renderer_2.h
rename to 3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/gfx/Curve_renderer_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/gfx/Curve_renderer_internals.h b/3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/gfx/Curve_renderer_internals.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/gfx/Curve_renderer_internals.h
rename to 3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/gfx/Curve_renderer_internals.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/gfx/Curve_renderer_traits.h b/3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/gfx/Curve_renderer_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/gfx/Curve_renderer_traits.h
rename to 3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/gfx/Curve_renderer_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/gfx/Subdivision_1.h b/3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/gfx/Subdivision_1.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/gfx/Subdivision_1.h
rename to 3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/gfx/Subdivision_1.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/gfx/Subdivision_2.h b/3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/gfx/Subdivision_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/gfx/Subdivision_2.h
rename to 3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/gfx/Subdivision_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/test/simple_models.h b/3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/test/simple_models.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Curved_kernel_via_analysis_2/test/simple_models.h
rename to 3rdparty/CGAL/include/CGAL/Curved_kernel_via_analysis_2/test/simple_models.h
diff --git a/3rdparty/CGAL/include/CGAL/Dart.h b/3rdparty/CGAL/include/CGAL/Dart.h
new file mode 100644
index 0000000..03fae72
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Dart.h
@@ -0,0 +1,244 @@
+// Copyright (c) 2010-2011 CNRS and LIRIS' Establishments (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Guillaume Damiand <guillaume.damiand at liris.cnrs.fr>
+//
+#ifndef CGAL_DART_H
+#define CGAL_DART_H 1
+
+#include <CGAL/Compact_container.h>
+#include <CGAL/assertions.h>
+#include <bitset>
+
+namespace CGAL {
+
+  /** @file Dart.h
+   * Definition of nD dart.
+   */
+
+  namespace internal {
+    template <typename Map,unsigned int i>
+    struct basic_link_beta_functor;
+
+    template <typename CMap,unsigned int i>
+    struct link_beta_functor;
+  }
+
+#define CGAL_BETAINV(i) (i>1?i:(i==1?0:1))
+
+  /** Definition of nD dart.
+   * The Dart class describes an nD dart (basic element of a
+   * combinatorial map). A dart is composed with handle towards its neighbors,
+   * a bitset containing Boolean marks, and handle towards enabled attributes.
+   * n is the dimension of the space (2 for 2D, 3 for 3D...)
+   * Refs the ref class
+   */
+  template <unsigned int d, typename Refs>
+  struct Dart
+  {
+    template < unsigned int, class, class, class, class >
+    friend class Combinatorial_map_base;
+
+    template<unsigned int, class, class>
+    friend class Combinatorial_map_storage_1;
+
+    template<unsigned int, class, class>
+    friend class Combinatorial_map_storage_2;
+
+    template<unsigned int, unsigned int, class, class, class>
+    friend class Linear_cell_complex_storage_1;
+
+    template<unsigned int, unsigned int, class, class, class>
+    friend class Linear_cell_complex_storage_2;
+
+    template <class, class, class, class>
+    friend class Compact_container;
+
+    template<class, unsigned int, unsigned int>
+    friend struct Remove_cell_functor;
+
+    template<class, unsigned int>
+    friend struct Contract_cell_functor;
+
+    template <typename,unsigned int>
+    friend struct internal::link_beta_functor;
+
+    template <typename, typename>
+    friend struct internal::Reverse_orientation_of_map_functor;
+
+    template <typename, typename>
+    friend struct internal::Reverse_orientation_of_connected_component_functor;
+
+  public:
+    typedef Dart<d,Refs>                     Self;
+    typedef typename Refs::Dart_handle       Dart_handle;
+    typedef typename Refs::size_type         size_type;
+    typedef typename Refs::Dart_const_handle Dart_const_handle;
+    typedef typename Refs::Helper            Helper;
+    /// Typedef for attributes
+    template<int i>
+    struct Attribute_handle: public Refs::template Attribute_handle<i>
+    {};
+    template<int i>
+    struct Attribute_const_handle:
+      public Refs::template Attribute_const_handle<i>
+    {};
+
+    /// The number of used marks.
+    static const size_type NB_MARKS = Refs::NB_MARKS;
+
+    /// The dimension of the combinatorial map.
+    static const unsigned int dimension = d;
+
+    /** Return the beta of this dart for a given dimension.
+     * @param i the dimension.
+     * @return beta(\em i).
+     */
+    template<unsigned int i>
+    Dart_handle beta()
+    {
+      CGAL_assertion(i <= dimension);
+      return mbeta[i];
+    }
+    Dart_handle beta(unsigned int i)
+    {
+      CGAL_assertion(i <= dimension);
+      return mbeta[i];
+    }
+    template<unsigned int i>
+    Dart_const_handle beta() const
+    {
+      CGAL_assertion(i <= dimension);
+      return mbeta[i];
+    }
+    Dart_const_handle beta(unsigned int i) const
+    {
+      CGAL_assertion(i <= dimension);
+      return mbeta[i];
+    }
+
+    /** Return the beta inverse of this dart for a given dimension.
+     * @param i the dimension.
+     * @return beta^{-1}(\em i).
+     */
+    template<unsigned int i>
+    Dart_handle beta_inv()
+    { return beta<CGAL_BETAINV(i)>(); }
+    Dart_handle beta_inv(unsigned int i)
+    { return beta(CGAL_BETAINV(i)); }
+    template<unsigned int i>
+    Dart_const_handle beta_inv() const
+    { return beta<CGAL_BETAINV(i)>(); }
+    Dart_const_handle beta_inv(unsigned int i) const
+    { return beta(CGAL_BETAINV(i)); }
+
+    /// @return a handle on the i-attribute
+    template<int i>
+    typename Attribute_handle<i>::type attribute()
+    {
+      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
+                     "attribute<i> called but i-attributes are disabled.");
+      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
+        (mattribute_handles);
+    }
+    template<int i>
+    typename Attribute_const_handle<i>::type attribute() const
+    {
+      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
+                     "attribute<i> called but i-attributes are disabled.");
+      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
+        (mattribute_handles);
+    }
+
+    /** Return the mark value of a given mark number.
+     * @param amark the mark number.
+     * @return the value for this number.
+     */
+    bool get_mark(size_type amark) const
+    {
+      CGAL_assertion(amark>=0 && amark<NB_MARKS);
+      return mmarks[amark];
+    }
+
+    /** Set the mark of a given mark number to a given value.
+     * @param amark the mark number.
+     * @param AValue the value.
+     */
+    void set_mark(size_type amark, bool avalue) const
+    {
+      CGAL_assertion(amark>=0 && amark<NB_MARKS);
+      mmarks.set(amark, avalue);
+    }
+    /** Flip the mark of a given mark number.
+     * @param amark the mark number.
+     */
+    void flip_mark(size_type amark) const
+    {
+      CGAL_assertion(amark>=0 && amark<NB_MARKS);
+      mmarks.flip(amark);
+    }
+
+    /** Return all the marks of this dart.
+     * @return the marks.
+     */
+     std::bitset<NB_MARKS> get_marks() const
+    { return mmarks; }
+
+    /** Set simultaneously all the marks of this dart to a given value.
+     * @param amarks the value of the marks.
+     */
+     void set_marks(const std::bitset<NB_MARKS>& amarks) const
+    { mmarks = amarks; }
+
+  protected:
+    /** Default constructor: no real initialisation,
+     *  because this is done in the combinatorial map class.
+     */
+    Dart()
+    {}
+
+    /** Copy constructor:
+     * @param adart a dart.
+     */
+    Dart(const Dart& adart) : mmarks(adart.mmarks),
+    mattribute_handles(adart.mattribute_handles)
+    {
+      for (unsigned int i = 0; i <= dimension; ++i)
+        mbeta[i] = adart.mbeta[i];
+    }
+
+   public:
+    void * for_compact_container() const
+    { return mbeta[0].for_compact_container(); }
+    void * & for_compact_container()
+    { return mbeta[0].for_compact_container(); }
+
+  protected:
+    /// Beta for each dimension +1 (from 0 to dimension).
+    Dart_handle mbeta[dimension+1];
+
+    /// Values of Boolean marks.
+    mutable std::bitset<NB_MARKS> mmarks;
+
+    /// Attributes enabled
+    typename Helper::Attribute_handles mattribute_handles;
+  };
+
+} // namespace CGAL
+
+#endif // CGAL_DART_H //
+// EOF //
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Dart_const_iterators.h b/3rdparty/CGAL/include/CGAL/Dart_const_iterators.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Dart_const_iterators.h
rename to 3rdparty/CGAL/include/CGAL/Dart_const_iterators.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Dart_iterators.h b/3rdparty/CGAL/include/CGAL/Dart_iterators.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Dart_iterators.h
rename to 3rdparty/CGAL/include/CGAL/Dart_iterators.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Default.h b/3rdparty/CGAL/include/CGAL/Default.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Default.h
rename to 3rdparty/CGAL/include/CGAL/Default.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Default_diagonalize_traits.h b/3rdparty/CGAL/include/CGAL/Default_diagonalize_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Default_diagonalize_traits.h
rename to 3rdparty/CGAL/include/CGAL/Default_diagonalize_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Deformation_Eigen_closest_rotation_traits_3.h b/3rdparty/CGAL/include/CGAL/Deformation_Eigen_closest_rotation_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Deformation_Eigen_closest_rotation_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/Deformation_Eigen_closest_rotation_traits_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Deformation_Eigen_polar_closest_rotation_traits_3.h b/3rdparty/CGAL/include/CGAL/Deformation_Eigen_polar_closest_rotation_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Deformation_Eigen_polar_closest_rotation_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/Deformation_Eigen_polar_closest_rotation_traits_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Delaunay_d.h b/3rdparty/CGAL/include/CGAL/Delaunay_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Delaunay_d.h
rename to 3rdparty/CGAL/include/CGAL/Delaunay_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Delaunay_mesh_area_criteria_2.h b/3rdparty/CGAL/include/CGAL/Delaunay_mesh_area_criteria_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Delaunay_mesh_area_criteria_2.h
rename to 3rdparty/CGAL/include/CGAL/Delaunay_mesh_area_criteria_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Delaunay_mesh_criteria_2.h b/3rdparty/CGAL/include/CGAL/Delaunay_mesh_criteria_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Delaunay_mesh_criteria_2.h
rename to 3rdparty/CGAL/include/CGAL/Delaunay_mesh_criteria_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Delaunay_mesh_face_base_2.h b/3rdparty/CGAL/include/CGAL/Delaunay_mesh_face_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Delaunay_mesh_face_base_2.h
rename to 3rdparty/CGAL/include/CGAL/Delaunay_mesh_face_base_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Delaunay_mesh_local_size_criteria_2.h b/3rdparty/CGAL/include/CGAL/Delaunay_mesh_local_size_criteria_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Delaunay_mesh_local_size_criteria_2.h
rename to 3rdparty/CGAL/include/CGAL/Delaunay_mesh_local_size_criteria_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Delaunay_mesh_size_criteria_2.h b/3rdparty/CGAL/include/CGAL/Delaunay_mesh_size_criteria_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Delaunay_mesh_size_criteria_2.h
rename to 3rdparty/CGAL/include/CGAL/Delaunay_mesh_size_criteria_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Delaunay_mesh_vertex_base_2.h b/3rdparty/CGAL/include/CGAL/Delaunay_mesh_vertex_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Delaunay_mesh_vertex_base_2.h
rename to 3rdparty/CGAL/include/CGAL/Delaunay_mesh_vertex_base_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Delaunay_mesher_2.h b/3rdparty/CGAL/include/CGAL/Delaunay_mesher_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Delaunay_mesher_2.h
rename to 3rdparty/CGAL/include/CGAL/Delaunay_mesher_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Delaunay_mesher_no_edge_refinement_2.h b/3rdparty/CGAL/include/CGAL/Delaunay_mesher_no_edge_refinement_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Delaunay_mesher_no_edge_refinement_2.h
rename to 3rdparty/CGAL/include/CGAL/Delaunay_mesher_no_edge_refinement_2.h
diff --git a/3rdparty/CGAL/include/CGAL/Delaunay_triangulation.h b/3rdparty/CGAL/include/CGAL/Delaunay_triangulation.h
new file mode 100644
index 0000000..4110f99
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Delaunay_triangulation.h
@@ -0,0 +1,897 @@
+// Copyright (c) 2009-2014 INRIA Sophia-Antipolis (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
+// 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(s)    : Samuel Hornus
+
+#ifndef CGAL_DELAUNAY_COMPLEX_H
+#define CGAL_DELAUNAY_COMPLEX_H
+
+#include <CGAL/tss.h>
+#include <CGAL/Triangulation.h>
+#include <CGAL/Dimension.h>
+#include <CGAL/Default.h>
+
+#include <boost/iterator/transform_iterator.hpp>
+
+#include <algorithm>
+
+namespace CGAL {
+
+template< typename DCTraits, typename _TDS = Default >
+class Delaunay_triangulation
+: public Triangulation<DCTraits,
+            typename Default::Get<_TDS, Triangulation_data_structure<
+                             typename DCTraits::Dimension,
+                             Triangulation_vertex<DCTraits>,
+                             Triangulation_full_cell<DCTraits> >
+                    >::type >
+{
+    typedef typename DCTraits::Dimension            Maximal_dimension_;
+    typedef typename Default::Get<_TDS, Triangulation_data_structure<
+                         Maximal_dimension_,
+                         Triangulation_vertex<DCTraits>,
+                         Triangulation_full_cell<DCTraits> >
+                >::type                             TDS;
+    typedef Triangulation<DCTraits, TDS>            Base;
+    typedef Delaunay_triangulation<DCTraits, _TDS>  Self;
+
+    typedef typename DCTraits::Side_of_oriented_sphere_d
+                                                    Side_of_oriented_sphere_d;
+    typedef typename DCTraits::Orientation_d        Orientation_d;
+
+public: // PUBLIC NESTED TYPES
+
+    typedef DCTraits                                Geom_traits;
+    typedef typename Base::Triangulation_ds          Triangulation_ds;
+
+    typedef typename Base::Vertex                   Vertex;
+    typedef typename Base::Full_cell                Full_cell;
+    typedef typename Base::Facet                    Facet;
+    typedef typename Base::Face                     Face;
+
+    typedef typename Base::Maximal_dimension        Maximal_dimension;
+    typedef typename DCTraits::Point_d              Point;
+    typedef typename DCTraits::Point_d              Point_d;
+
+    typedef typename Base::Vertex_handle            Vertex_handle;
+    typedef typename Base::Vertex_iterator          Vertex_iterator;
+    typedef typename Base::Vertex_const_handle      Vertex_const_handle;
+    typedef typename Base::Vertex_const_iterator    Vertex_const_iterator;
+
+    typedef typename Base::Full_cell_handle           Full_cell_handle;
+    typedef typename Base::Full_cell_iterator         Full_cell_iterator;
+    typedef typename Base::Full_cell_const_handle     Full_cell_const_handle;
+    typedef typename Base::Full_cell_const_iterator   Full_cell_const_iterator;
+
+    typedef typename Base::size_type                size_type;
+    typedef typename Base::difference_type          difference_type;
+
+    typedef typename Base::Locate_type              Locate_type;
+
+protected: // DATA MEMBERS
+
+
+public:
+    
+    using Base::maximal_dimension;
+    using Base::are_incident_full_cells_valid;
+    using Base::coaffine_orientation_predicate;
+    using Base::reset_flat_orientation;
+    using Base::current_dimension;
+    //using Base::star;
+    //using Base::incident_full_cells;
+    using Base::geom_traits;
+    using Base::index_of_covertex;
+    using Base::infinite_vertex;
+    using Base::insert_in_hole;
+    using Base::insert_outside_convex_hull_1;
+    using Base::is_infinite;
+    using Base::is_valid;
+    using Base::locate;
+    using Base::points_begin;
+    using Base::set_neighbors;
+    using Base::new_full_cell;
+    using Base::number_of_vertices;
+    using Base::orientation;
+    using Base::tds;
+    using Base::reorient_full_cells;
+    using Base::full_cell;
+    using Base::full_cells_begin;
+    using Base::full_cells_end;
+    using Base::vertices_begin;
+    using Base::vertices_end;
+    // using Base::
+    
+private:
+    //*** Side_of_oriented_subsphere_d ***
+    typedef typename Base::Flat_orientation_d Flat_orientation_d;
+    typedef typename Base::Construct_flat_orientation_d Construct_flat_orientation_d;
+    typedef typename DCTraits::In_flat_side_of_oriented_sphere_d In_flat_side_of_oriented_sphere_d;
+    // Wrapper
+    struct Side_of_oriented_subsphere_d
+    {
+      boost::optional<Flat_orientation_d>* fop;
+      Construct_flat_orientation_d cfo;
+      In_flat_side_of_oriented_sphere_d ifsoos;
+
+      Side_of_oriented_subsphere_d(
+        boost::optional<Flat_orientation_d>& x,
+        Construct_flat_orientation_d const&y,
+        In_flat_side_of_oriented_sphere_d const&z)
+      : fop(&x), cfo(y), ifsoos(z) {}
+
+      template<class Iter>
+      CGAL::Orientation operator()(Iter a, Iter b, const Point & p)const
+      {
+        if(!*fop)
+          *fop=cfo(a,b);
+        return ifsoos(fop->get(),a,b,p);
+      }
+    };
+public:
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - UTILITIES
+
+    // A co-dimension 2 sub-simplex. called a Rotor because we can rotate
+    // the two "covertices" around the sub-simplex. Useful for traversing the
+    // boundary of a hole. NOT DOCUMENTED
+    typedef cpp11::tuple<Full_cell_handle, int, int>    Rotor;
+
+    /*Full_cell_handle full_cell(const Rotor & r) const // NOT DOCUMENTED
+    {
+        return cpp11::get<0>(r);
+    }
+    int index_of_covertex(const Rotor & r) const // NOT DOCUMENTED
+    {
+        return cpp11::get<1>(r);
+    }
+    int index_of_second_covertex(const Rotor & r) const // NOT DOCUMENTED
+    {
+        return cpp11::get<2>(r);
+    }*/
+    Rotor rotate_rotor(Rotor & r) // NOT DOCUMENTED...
+    {
+        int opposite = cpp11::get<0>(r)->mirror_index(cpp11::get<1>(r));
+        Full_cell_handle s = cpp11::get<0>(r)->neighbor(cpp11::get<1>(r));
+        int new_second = s->index(cpp11::get<0>(r)->vertex(cpp11::get<2>(r)));
+        return Rotor(s, new_second, opposite);
+    }
+    
+// - - - - - - - - - - - - - - - - - - - - - - - - - - CREATION / CONSTRUCTORS
+
+    Delaunay_triangulation(int dim, const Geom_traits k = Geom_traits())
+    : Base(dim, k)
+    {
+    }
+
+    // With this constructor,
+    // the user can specify a Flat_orientation_d object to be used for 
+    // orienting simplices of a specific dimension 
+    // (= preset_flat_orientation_.first)
+    // It it used by the dark triangulations created by DT::remove
+    Delaunay_triangulation(
+      int dim, 
+      const std::pair<int, const Flat_orientation_d *> &preset_flat_orientation,
+      const Geom_traits k = Geom_traits())
+    : Base(dim, preset_flat_orientation, k)
+    {
+    }
+
+    ~Delaunay_triangulation() {}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ACCESS
+
+    // Not Documented
+    Side_of_oriented_subsphere_d side_of_oriented_subsphere_predicate() const
+    {
+      return Side_of_oriented_subsphere_d (
+        flat_orientation_, 
+        geom_traits().construct_flat_orientation_d_object(), 
+        geom_traits().in_flat_side_of_oriented_sphere_d_object()
+      );
+    }
+
+
+    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - REMOVALS
+
+    Full_cell_handle remove(Vertex_handle);
+    Full_cell_handle remove(const Point & p, Full_cell_handle hint = Full_cell_handle())
+    {
+        Locate_type lt;
+        Face f(maximal_dimension());
+        Facet ft;
+        Full_cell_handle s = locate(p, lt, f, ft, hint);
+        if( Base::ON_VERTEX == lt )
+        {
+            return remove(s->vertex(f.index(0)));
+        }
+        return Full_cell_handle();
+    }
+
+    template< typename ForwardIterator >
+    void remove(ForwardIterator start, ForwardIterator end)
+    {
+        while( start != end )
+            remove(*start++);
+    }
+
+    // Not documented
+    void remove_decrease_dimension(Vertex_handle);
+
+    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - INSERTIONS
+
+    template< typename ForwardIterator >
+    size_type insert(ForwardIterator start, ForwardIterator end)
+    {
+        size_type n = number_of_vertices();
+        std::vector<Point> points(start, end);
+        spatial_sort(points.begin(), points.end(), geom_traits());
+        Full_cell_handle hint;
+        for( typename std::vector<Point>::const_iterator p = points.begin(); p != points.end(); ++p )
+        {
+            hint = insert(*p, hint)->full_cell();
+        }
+        return number_of_vertices() - n;
+    }
+    Vertex_handle insert(const Point &, const Locate_type, const Face &, const Facet &, const Full_cell_handle);
+    Vertex_handle insert(const Point & p, const Full_cell_handle start = Full_cell_handle())
+    {
+        Locate_type lt;
+        Face f(maximal_dimension());
+        Facet ft;
+        Full_cell_handle s = locate(p, lt, f, ft, start);
+        return insert(p, lt, f, ft, s);
+    }
+    Vertex_handle insert(const Point & p, const Vertex_handle hint)
+    {
+        CGAL_assertion( Vertex_handle() != hint );
+        return insert(p, hint->full_cell());
+    }
+    Vertex_handle insert_outside_affine_hull(const Point &);
+    Vertex_handle insert_in_conflicting_cell(const Point &, const Full_cell_handle);
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - GATHERING CONFLICTING SIMPLICES
+
+    bool is_in_conflict(const Point &, Full_cell_const_handle) const;
+    template< class OrientationPredicate >
+    Oriented_side perturbed_side_of_positive_sphere(const Point &,
+            Full_cell_const_handle, const OrientationPredicate &) const;
+
+    template< typename OutputIterator >
+    Facet compute_conflict_zone(const Point &, const Full_cell_handle, OutputIterator) const;
+
+    template < typename OrientationPredicate, typename SideOfOrientedSpherePredicate >
+    class Conflict_predicate
+    {
+        const Self & dc_;
+        const Point & p_;
+        OrientationPredicate ori_;
+        SideOfOrientedSpherePredicate side_of_s_;
+        int cur_dim_;
+    public:
+        Conflict_predicate(
+                const Self & dc,
+                const Point & p,
+                const OrientationPredicate & ori,
+                const SideOfOrientedSpherePredicate & side)
+        : dc_(dc), p_(p), ori_(ori), side_of_s_(side), cur_dim_(dc.current_dimension()) {}
+
+        inline
+        bool operator()(Full_cell_const_handle s) const
+        {
+            bool ok;
+            if( ! dc_.is_infinite(s) )
+            {
+                Oriented_side side = side_of_s_(dc_.points_begin(s), dc_.points_begin(s) + cur_dim_ + 1, p_);
+                if( ON_POSITIVE_SIDE == side )
+                    ok = true;
+                else if( ON_NEGATIVE_SIDE == side )
+                    ok = false;
+                else
+                    ok = ON_POSITIVE_SIDE == dc_.perturbed_side_of_positive_sphere<OrientationPredicate>(p_, s, ori_);
+            }
+            else
+            {
+                typedef typename Full_cell::Vertex_handle_const_iterator VHCI;
+                typedef Substitute_point_in_vertex_iterator<VHCI> F;
+                F spivi(dc_.infinite_vertex(), &p_);
+
+                Orientation o =  ori_(
+                  boost::make_transform_iterator(s->vertices_begin(), spivi),
+                  boost::make_transform_iterator(s->vertices_begin() + cur_dim_ + 1, 
+                                                 spivi));
+
+                if( POSITIVE == o )
+                    ok = true;
+                else if( o == NEGATIVE )
+                    ok = false;
+                else
+                    ok = (*this)(s->neighbor( s->index( dc_.infinite_vertex() ) ));
+            }
+            return ok;
+        }
+    };
+
+    template < typename ConflictPredicate >
+    class Conflict_traversal_predicate
+    {
+        const Self & dc_;
+        const ConflictPredicate & pred_;
+    public:
+        Conflict_traversal_predicate(const Self & dc, const ConflictPredicate & pred)
+        : dc_(dc), pred_(pred)
+        {}
+        inline
+        bool operator()(const Facet & f) const
+        {
+            return pred_(dc_.full_cell(f)->neighbor(dc_.index_of_covertex(f)));
+        }
+    };
+
+private:
+    // Some internal types to shorten notation
+    typedef typename Base::Coaffine_orientation_d Coaffine_orientation_d;
+    using Base::flat_orientation_;
+    typedef Conflict_predicate<Coaffine_orientation_d, Side_of_oriented_subsphere_d>
+            Conflict_pred_in_subspace;
+    typedef Conflict_predicate<Orientation_d, Side_of_oriented_sphere_d>
+            Conflict_pred_in_fullspace;
+    typedef Conflict_traversal_predicate<Conflict_pred_in_subspace>
+            Conflict_traversal_pred_in_subspace;
+    typedef Conflict_traversal_predicate<Conflict_pred_in_fullspace>
+            Conflict_traversal_pred_in_fullspace;
+
+    // This is used in the |remove(v)| member function to manage sets of Full_cell_handles
+    template< typename FCH >
+    struct Full_cell_set : public std::vector<FCH>
+    {
+        typedef std::vector<FCH> Base_set;
+        using Base_set::begin;
+        using Base_set::end;
+        void make_searchable()
+        {   // sort the full cell handles
+            std::sort(begin(), end());
+        }
+        bool contains(const FCH & fch) const
+        {
+            return std::binary_search(begin(), end(), fch);
+        }
+        bool contains_1st_and_not_2nd(const FCH & fst, const FCH & snd) const
+        {
+            return ( ! contains(snd) ) && ( contains(fst) );
+        }
+    };
+};
+
+// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
+// FUNCTIONS THAT ARE MEMBER METHODS:
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - REMOVALS
+
+template< typename DCTraits, typename TDS >
+typename Delaunay_triangulation<DCTraits, TDS>::Full_cell_handle
+Delaunay_triangulation<DCTraits, TDS>
+::remove( Vertex_handle v )
+{
+    CGAL_precondition( ! is_infinite(v) );
+    CGAL_expensive_precondition( is_vertex(v) );
+
+    // THE CASE cur_dim == 0
+    if( 0 == current_dimension() )
+    {
+        remove_decrease_dimension(v);
+        return Full_cell_handle();
+    }
+    else if( 1 == current_dimension() )
+    {   // THE CASE cur_dim == 1
+        if( 2 == number_of_vertices() )
+        {
+            remove_decrease_dimension(v);
+            return Full_cell_handle();
+        }
+        Full_cell_handle left = v->full_cell();
+        if( is_infinite(left) && left->neighbor(0)->index(left) == 0 ) // we are on the infinite right.
+            left = left->neighbor(0);
+        if( 0 == left->index(v) )
+            left = left->neighbor(1);
+        CGAL_assertion( 1 == left->index(v) );
+        Full_cell_handle right = left->neighbor(0);
+        if( ! is_infinite(right) )
+        {
+            tds().associate_vertex_with_full_cell(left, 1, right->vertex(1));
+            set_neighbors(left, 0, right->neighbor(0), right->mirror_index(0));
+        }
+        else
+        {
+            tds().associate_vertex_with_full_cell(left, 1, left->vertex(0));
+            tds().associate_vertex_with_full_cell(left, 0, infinite_vertex());
+            set_neighbors(left, 0, left->neighbor(1), left->mirror_index(1));
+            set_neighbors(left, 1, right->neighbor(1), right->mirror_index(1));
+        }
+        tds().delete_vertex(v);
+        tds().delete_full_cell(right);
+        return left;
+    }
+
+    // THE CASE cur_dim >= 2
+    // Gather the finite vertices sharing an edge with |v|
+    typedef Full_cell_set<Full_cell_handle> Simplices;
+    Simplices simps;
+    std::back_insert_iterator<Simplices> out(simps);
+    tds().incident_full_cells(v, out);
+    typedef std::set<Vertex_handle> Vertex_set;
+    Vertex_set verts;
+    Vertex_handle vh;
+    for( typename Simplices::iterator it = simps.begin(); it != simps.end(); ++it )
+        for( int i = 0; i <= current_dimension(); ++i )
+        {
+            vh = (*it)->vertex(i);
+            if( is_infinite(vh) )
+                continue;
+            if( vh == v )
+                continue;
+            verts.insert(vh);
+        }
+
+    // After gathering finite neighboring vertices, create their Dark Delaunay triangulation
+    typedef Triangulation_vertex<Geom_traits, Vertex_handle> Dark_vertex_base;
+    typedef Triangulation_full_cell<Geom_traits,
+        internal::Triangulation::Dark_full_cell_data<Self> > Dark_full_cell_base;
+    typedef Triangulation_data_structure<Maximal_dimension, Dark_vertex_base, Dark_full_cell_base> Dark_tds;
+    typedef Delaunay_triangulation<DCTraits, Dark_tds>   Dark_triangulation;
+    typedef typename Dark_triangulation::Face             Dark_face;
+    typedef typename Dark_triangulation::Facet            Dark_facet;
+    typedef typename Dark_triangulation::Vertex_handle    Dark_v_handle;
+    typedef typename Dark_triangulation::Full_cell_handle   Dark_s_handle;
+
+    // If flat_orientation_ is defined, we give it the Dark triangulation
+    // so that the orientation it uses for "current_dimension()"-simplices is
+    // coherent with the global triangulation
+    Dark_triangulation dark_side(
+      maximal_dimension(),
+      flat_orientation_ ?
+      std::pair<int, const Flat_orientation_d *>(current_dimension(), flat_orientation_.get_ptr())
+      : std::pair<int, const Flat_orientation_d *>((std::numeric_limits<int>::max)(), (Flat_orientation_d*) NULL) );
+
+    Dark_s_handle dark_s;
+    Dark_v_handle dark_v;
+    typedef std::map<Vertex_handle, Dark_v_handle> Vertex_map;
+    Vertex_map light_to_dark;
+    typename Vertex_set::iterator vit = verts.begin();
+    while( vit != verts.end() )
+    {
+        dark_v = dark_side.insert((*vit)->point(), dark_s);
+        dark_s = dark_v->full_cell();
+        dark_v->data() = *vit;
+        light_to_dark[*vit] = dark_v;
+        ++vit;
+    }
+
+    if( dark_side.current_dimension() != current_dimension() )
+    {
+        CGAL_assertion( dark_side.current_dimension() + 1 == current_dimension() );
+        // Here, the finite neighbors of |v| span a affine subspace of
+        // dimension one less than the current dimension. Two cases are possible:
+        if( (size_type)(verts.size() + 1) == number_of_vertices() )
+        {
+            remove_decrease_dimension(v);
+            return Full_cell_handle();
+        }
+        else
+        {   // |v| is strictly outside the convex hull of the rest of the points. This is an
+            // easy case: first, modify the finite full_cells, then, delete the infinite ones.
+            // We don't even need the Dark triangulation.
+            Simplices infinite_simps;
+            {
+                Simplices finite_simps;
+                for( typename Simplices::iterator it = simps.begin(); it != simps.end(); ++it )
+                    if( is_infinite(*it) )
+                        infinite_simps.push_back(*it);
+                    else
+                        finite_simps.push_back(*it);
+                simps.swap(finite_simps);
+            } // now, simps only contains finite simplices
+            // First, modify the finite full_cells:
+            for( typename Simplices::iterator it = simps.begin(); it != simps.end(); ++it )
+            {
+                int v_idx = (*it)->index(v);
+                tds().associate_vertex_with_full_cell(*it, v_idx, infinite_vertex());
+                if( v_idx != 0 )
+                {
+                    // we must put the infinite vertex at index 0.
+                    // OK, now with the new convention that the infinite vertex
+                    // does not have to be at index 0, this is not necessary,
+                    // but still, I prefer to keep this piece of code here. [-- Samuel Hornus]
+                    (*it)->swap_vertices(0, v_idx);
+                    // Now, we preserve the positive orientation of the full_cell
+                    (*it)->swap_vertices(current_dimension() - 1, current_dimension());
+                }
+            }
+            // Make the handles to infinite full cells searchable
+            infinite_simps.make_searchable();
+            // Then, modify the neighboring relation
+            for( typename Simplices::iterator it = simps.begin(); it != simps.end(); ++it )
+            {
+                for( int i = 1; i <= current_dimension(); ++i )
+                {
+                    (*it)->vertex(i)->set_full_cell(*it);
+                    Full_cell_handle n = (*it)->neighbor(i);
+                    // Was |n| a finite full cell prior to removing |v| ?
+                    if( ! infinite_simps.contains(n) )
+                        continue;
+                    int n_idx = n->index(v);
+                    set_neighbors(*it, i, n->neighbor(n_idx), n->neighbor(n_idx)->index(n));
+                }
+            }
+            Full_cell_handle ret_s;
+            // Then, we delete the infinite full_cells
+            for( typename Simplices::iterator it = infinite_simps.begin(); it != infinite_simps.end(); ++it )
+                tds().delete_full_cell(*it);
+            tds().delete_vertex(v);
+            return simps.front();
+        }
+    }
+    else //  From here on, dark_side.current_dimension() == current_dimension()
+    {
+        dark_side.infinite_vertex()->data() = infinite_vertex();
+        light_to_dark[infinite_vertex()] = dark_side.infinite_vertex();
+    }
+
+    // Now, compute the conflict zone of v->point() in
+    // the dark side. This is precisely the set of full_cells
+    // that we have to glue back into the light side.
+    Dark_face       dark_f(dark_side.maximal_dimension());
+    Dark_facet      dark_ft;
+    typename Dark_triangulation::Locate_type     lt;
+    dark_s = dark_side.locate(v->point(), lt, dark_f, dark_ft);
+    CGAL_assertion( lt != Dark_triangulation::ON_VERTEX
+        && lt != Dark_triangulation::OUTSIDE_AFFINE_HULL );
+
+    // |ret_s| is the full_cell that we return
+    Dark_s_handle dark_ret_s = dark_s;
+    Full_cell_handle ret_s;
+
+    typedef Full_cell_set<Dark_s_handle> Dark_full_cells;
+    Dark_full_cells conflict_zone;
+    std::back_insert_iterator<Dark_full_cells> dark_out(conflict_zone);
+    
+    dark_ft = dark_side.compute_conflict_zone(v->point(), dark_s, dark_out);
+    // Make the dark simplices in the conflict zone searchable
+    conflict_zone.make_searchable();
+
+    // THE FOLLOWING SHOULD MAYBE GO IN TDS.
+    // Here is the plan:
+    // 1. Pick any Facet from boundary of the light zone
+    // 2. Find corresponding Facet on boundary of dark zone
+    // 3. stitch.
+
+    // 1. Build a facet on the boudary of the light zone:
+    Full_cell_handle light_s = *simps.begin();
+    Facet light_ft(light_s, light_s->index(v));
+
+    // 2. Find corresponding Dark_facet on boundary of the dark zone
+    Dark_full_cells dark_incident_s;
+    for( int i = 0; i <= current_dimension(); ++i )
+    {
+        if( index_of_covertex(light_ft) == i )
+            continue;
+        Dark_v_handle dark_v = light_to_dark[full_cell(light_ft)->vertex(i)];
+        dark_incident_s.clear();
+        dark_out = std::back_inserter(dark_incident_s);
+        dark_side.tds().incident_full_cells(dark_v, dark_out);
+        for( typename Dark_full_cells::iterator it = dark_incident_s.begin(); it != dark_incident_s.end(); ++it )
+        {
+            (*it)->data().count_ += 1;
+        }
+    }
+
+    for( typename Dark_full_cells::iterator it = dark_incident_s.begin(); it != dark_incident_s.end(); ++it )
+    {
+        if( current_dimension() != (*it)->data().count_ )
+            continue;
+        if( ! conflict_zone.contains(*it) )
+            continue;
+        // We found a full_cell incident to the dark facet corresponding to the light facet |light_ft|
+        int ft_idx = 0;
+        while( light_s->has_vertex( (*it)->vertex(ft_idx)->data() ) )
+            ++ft_idx;
+        dark_ft = Dark_facet(*it, ft_idx);
+        break;
+    }
+    // Pre-3. Now, we are ready to traverse both boundary and do the stiching.
+
+    // But first, we create the new full_cells in the light triangulation,
+    // with as much adjacency information as possible.
+
+    // Create new full_cells with vertices
+    for( typename Dark_full_cells::iterator it = conflict_zone.begin(); it != conflict_zone.end(); ++it )
+    {
+        Full_cell_handle new_s = new_full_cell();
+        (*it)->data().light_copy_ = new_s;
+        for( int i = 0; i <= current_dimension(); ++i )
+            tds().associate_vertex_with_full_cell(new_s, i, (*it)->vertex(i)->data());
+        if( dark_ret_s == *it )
+            ret_s = new_s;
+    }
+
+    // Setup adjacencies inside the hole
+    for( typename Dark_full_cells::iterator it = conflict_zone.begin(); it != conflict_zone.end(); ++it )
+    {
+        Full_cell_handle new_s = (*it)->data().light_copy_;
+        for( int i = 0; i <= current_dimension(); ++i )
+            if( conflict_zone.contains((*it)->neighbor(i)) )
+                tds().set_neighbors(new_s, i, (*it)->neighbor(i)->data().light_copy_, (*it)->mirror_index(i));
+    }
+
+    // 3. Stitch
+    simps.make_searchable();
+    typedef std::queue<std::pair<Facet, Dark_facet> > Queue;
+    Queue q;
+    q.push(std::make_pair(light_ft, dark_ft));
+    dark_s = dark_side.full_cell(dark_ft);
+    int dark_i = dark_side.index_of_covertex(dark_ft);
+    // mark dark_ft as visited:
+    // TODO try by marking with Dark_v_handle (vertex)
+    dark_s->neighbor(dark_i)->set_neighbor(dark_s->mirror_index(dark_i), Dark_s_handle());
+    while( ! q.empty() )
+    {
+        std::pair<Facet, Dark_facet> p = q.front();
+        q.pop();
+        light_ft = p.first;
+        dark_ft = p.second;
+        light_s = full_cell(light_ft);
+        int light_i = index_of_covertex(light_ft);
+        dark_s = dark_side.full_cell(dark_ft);
+        int dark_i = dark_side.index_of_covertex(dark_ft);
+        Full_cell_handle light_n = light_s->neighbor(light_i);
+        set_neighbors(dark_s->data().light_copy_, dark_i, light_n, light_s->mirror_index(light_i));
+        for( int di = 0; di <= current_dimension(); ++di )
+        {
+            if( di == dark_i )
+                continue;
+            int li = light_s->index(dark_s->vertex(di)->data());
+            Rotor light_r(light_s, li, light_i);
+            typename Dark_triangulation::Rotor dark_r(dark_s, di, dark_i);
+            
+            while (simps.contains(cpp11::get<0>(light_r)->neighbor(cpp11::get<1>(light_r))))
+                light_r = rotate_rotor(light_r);
+
+            while (conflict_zone.contains(cpp11::get<0>(dark_r)->neighbor(cpp11::get<1>(dark_r))))
+                dark_r = dark_side.rotate_rotor(dark_r);
+
+            Dark_s_handle dark_ns = cpp11::get<0>(dark_r);
+            int dark_ni = cpp11::get<1>(dark_r);
+            Full_cell_handle light_ns = cpp11::get<0>(light_r);
+            int light_ni = cpp11::get<1>(light_r);
+            // mark dark_r as visited:
+            // TODO try by marking with Dark_v_handle (vertex)
+            Dark_s_handle outside = dark_ns->neighbor(dark_ni);
+            Dark_v_handle mirror = dark_ns->mirror_vertex(dark_ni, current_dimension());
+            int dn = outside->index(mirror);
+            if( Dark_s_handle() == outside->neighbor(dn) )
+                continue;
+            outside->set_neighbor(dn, Dark_s_handle());
+            q.push(std::make_pair(Facet(light_ns, light_ni), Dark_facet(dark_ns, dark_ni)));
+        }
+    }
+    tds().delete_full_cells(simps.begin(), simps.end());
+    tds().delete_vertex(v);
+    return ret_s;
+}
+
+template< typename DCTraits, typename TDS >
+void
+Delaunay_triangulation<DCTraits, TDS>
+::remove_decrease_dimension(Vertex_handle v)
+{
+    CGAL_precondition( current_dimension() >= 0 );
+    tds().remove_decrease_dimension(v, infinite_vertex());
+    // reset the predicates:
+    reset_flat_orientation();
+    if( 1 <= current_dimension() )
+    {
+        Full_cell_handle inf_v_cell = infinite_vertex()->full_cell();
+        int inf_v_index = inf_v_cell->index(infinite_vertex());
+        Full_cell_handle s = inf_v_cell->neighbor(inf_v_index);
+        Orientation o = orientation(s);
+        CGAL_assertion( ZERO != o );
+        if( NEGATIVE == o )
+            reorient_full_cells();
+    }
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - INSERTIONS
+
+template< typename DCTraits, typename TDS >
+typename Delaunay_triangulation<DCTraits, TDS>::Vertex_handle
+Delaunay_triangulation<DCTraits, TDS>
+::insert(const Point & p, const Locate_type lt, const Face & f, const Facet &, const Full_cell_handle s)
+{
+    switch( lt )
+    {
+        case Base::OUTSIDE_AFFINE_HULL:
+            return insert_outside_affine_hull(p);
+            break;
+        case Base::ON_VERTEX:
+        {
+            Vertex_handle v = s->vertex(f.index(0));
+            v->set_point(p);
+            return v;
+            break;
+        }
+        default:
+            if( 1 == current_dimension() )
+            {
+                if( Base::OUTSIDE_CONVEX_HULL == lt )
+                {
+                    return insert_outside_convex_hull_1(p, s);
+                }
+                Vertex_handle v = tds().insert_in_full_cell(s);
+                v->set_point(p);
+                return v;
+            }
+            else
+                return insert_in_conflicting_cell(p, s);
+            break;
+    }
+}
+
+template< typename DCTraits, typename TDS >
+typename Delaunay_triangulation<DCTraits, TDS>::Vertex_handle
+Delaunay_triangulation<DCTraits, TDS>
+::insert_outside_affine_hull(const Point & p)
+{
+    // we don't use Base::insert_outside_affine_hull(...) because here, we
+    // also need to reset the side_of_oriented_subsphere functor.
+    CGAL_precondition( current_dimension() < maximal_dimension() );
+    Vertex_handle v = tds().insert_increase_dimension(infinite_vertex());
+    // reset the predicates:
+    reset_flat_orientation();
+    v->set_point(p);
+    if( current_dimension() >= 1 )
+    {
+        Full_cell_handle inf_v_cell = infinite_vertex()->full_cell();
+        int inf_v_index = inf_v_cell->index(infinite_vertex());
+        Full_cell_handle s = inf_v_cell->neighbor(inf_v_index);
+        Orientation o = orientation(s);
+        CGAL_assertion( ZERO != o );
+            if( NEGATIVE == o )
+                reorient_full_cells();
+    }
+    return v;
+}
+
+template< typename DCTraits, typename TDS >
+typename Delaunay_triangulation<DCTraits, TDS>::Vertex_handle
+Delaunay_triangulation<DCTraits, TDS>
+::insert_in_conflicting_cell(const Point & p, const Full_cell_handle s)
+{
+    // for storing conflicting full_cells.
+    typedef std::vector<Full_cell_handle> Full_cell_h_vector;
+    CGAL_STATIC_THREAD_LOCAL_VARIABLE(Full_cell_h_vector,cs,0);
+    cs.clear();
+
+    std::back_insert_iterator<Full_cell_h_vector> out(cs);
+    Facet ft = compute_conflict_zone(p, s, out);
+    return insert_in_hole(p, cs.begin(), cs.end(), ft);
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - GATHERING CONFLICTING SIMPLICES
+
+// NOT DOCUMENTED
+template< typename DCTraits, typename TDS >
+template< typename OrientationPred >
+Oriented_side
+Delaunay_triangulation<DCTraits, TDS>
+::perturbed_side_of_positive_sphere(const Point & p, Full_cell_const_handle s,
+        const OrientationPred & ori) const
+{
+    CGAL_precondition_msg( ! is_infinite(s), "full cell must be finite");
+    CGAL_expensive_precondition( POSITIVE == orientation(s) );
+    typedef std::vector<const Point *> Points;
+    Points points(current_dimension() + 2);
+    int i(0);
+    for( ; i <= current_dimension(); ++i )
+        points[i] = &(s->vertex(i)->point());
+    points[i] = &p;
+    std::sort(points.begin(), points.end(),
+            internal::Triangulation::Compare_points_for_perturbation<Self>(*this));
+    typename Points::const_reverse_iterator cut_pt = points.rbegin();
+    Points test_points;
+    while( cut_pt != points.rend() )
+    {
+        if( &p == *cut_pt )
+            // because the full_cell "s" is assumed to be positively oriented
+            return ON_NEGATIVE_SIDE; // we consider |p| to lie outside the sphere
+        test_points.clear();
+        typename Base::Point_const_iterator spit = points_begin(s);
+        int adjust_sign = -1;
+        for( i = 0; i < current_dimension(); ++i )
+        {
+            if( &(*spit) == *cut_pt )
+            {
+                ++spit;
+                adjust_sign = (((current_dimension() + i) % 2) == 0) ? -1 : +1;
+            }
+            test_points.push_back(&(*spit));
+            ++spit;
+        }
+        test_points.push_back(&p);
+
+        typedef typename CGAL::Iterator_project<typename Points::iterator,
+                        internal::Triangulation::Point_from_pointer<Self>,
+                const Point &, const Point *> Point_pointer_iterator;
+
+        Orientation ori_value = ori(
+                Point_pointer_iterator(test_points.begin()),
+                Point_pointer_iterator(test_points.end()));
+
+        if( ZERO != ori_value )
+            return Oriented_side( - adjust_sign * ori_value );
+
+        ++cut_pt;
+    }
+    CGAL_assertion(false); // we should never reach here
+    return ON_NEGATIVE_SIDE;
+}
+
+template< typename DCTraits, typename TDS >
+bool
+Delaunay_triangulation<DCTraits, TDS>
+::is_in_conflict(const Point & p, Full_cell_const_handle s) const
+{
+    CGAL_precondition( 2 <= current_dimension() );
+    if( current_dimension() < maximal_dimension() )
+    {
+        Conflict_pred_in_subspace c(*this, p, coaffine_orientation_predicate(), side_of_oriented_subsphere_predicate());
+        return c(s);
+    }
+    else
+    {
+        Orientation_d ori = geom_traits().orientation_d_object();
+        Side_of_oriented_sphere_d side = geom_traits().side_of_oriented_sphere_d_object();
+        Conflict_pred_in_fullspace c(*this, p, ori, side);
+        return c(s);
+    }
+}
+
+template< typename DCTraits, typename TDS >
+template< typename OutputIterator >
+typename Delaunay_triangulation<DCTraits, TDS>::Facet
+Delaunay_triangulation<DCTraits, TDS>
+::compute_conflict_zone(const Point & p, const Full_cell_handle s, OutputIterator out) const
+{
+    CGAL_precondition( 2 <= current_dimension() );
+    if( current_dimension() < maximal_dimension() )
+    {
+        Conflict_pred_in_subspace c(*this, p, coaffine_orientation_predicate(), side_of_oriented_subsphere_predicate());
+        Conflict_traversal_pred_in_subspace tp(*this, c);
+        return tds().gather_full_cells(s, tp, out);
+    }
+    else
+    {
+        Orientation_d ori = geom_traits().orientation_d_object();
+        Side_of_oriented_sphere_d side = geom_traits().side_of_oriented_sphere_d_object();
+        Conflict_pred_in_fullspace c(*this, p, ori, side);
+        Conflict_traversal_pred_in_fullspace tp(*this, c);
+        return tds().gather_full_cells(s, tp, out);
+    }
+}
+
+} //namespace CGAL
+
+#endif // CGAL_DELAUNAY_COMPLEX_H
diff --git a/3rdparty/CGAL/include/CGAL/Delaunay_triangulation_2.h b/3rdparty/CGAL/include/CGAL/Delaunay_triangulation_2.h
new file mode 100644
index 0000000..7acc27d
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Delaunay_triangulation_2.h
@@ -0,0 +1,2488 @@
+// Copyright (c) 1997  INRIA Sophia-Antipolis (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
+// 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(s)     : Mariette Yvinec
+//               : Olivier Devillers  (remove)
+//               : Pedro de Castro (displacement)
+
+
+
+#ifndef CGAL_DELAUNAY_TRIANGULATION_2_H
+#define CGAL_DELAUNAY_TRIANGULATION_2_H
+
+#include <CGAL/Triangulation_2.h>
+#include <CGAL/iterator.h>
+
+#ifndef CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
+#include <CGAL/Spatial_sort_traits_adapter_2.h>
+#include <CGAL/internal/info_check.h>
+#include <CGAL/tss.h>
+#include <boost/iterator/zip_iterator.hpp>
+#include <boost/mpl/and.hpp>
+
+
+#endif //CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
+
+namespace CGAL {
+
+template < class Gt, 
+           class Tds = Triangulation_data_structure_2 <
+                           Triangulation_vertex_base_2<Gt> > >
+class Delaunay_triangulation_2 : public Triangulation_2<Gt,Tds>
+{
+public:
+  typedef Gt Geom_traits;
+  typedef typename Geom_traits::Point_2       Point;
+  typedef typename Geom_traits::Segment_2     Segment;
+  typedef typename Geom_traits::Triangle_2    Triangle;
+
+  typedef typename Geom_traits::Orientation_2 Orientation_2;
+  typedef typename Geom_traits::Compare_x_2   Compare_x;
+  typedef typename Geom_traits::Compare_y_2   Compare_y;
+  typedef typename Geom_traits::Side_of_oriented_circle_2 
+                                              Side_of_oriented_circle;
+
+  
+  typedef Triangulation_2<Gt,Tds>                       Triangulation;
+  typedef typename Triangulation::size_type             size_type;
+  typedef typename Triangulation::Locate_type           Locate_type;
+  typedef typename Triangulation::Face_handle           Face_handle;
+  typedef typename Triangulation::Vertex_handle         Vertex_handle;
+  typedef typename Triangulation::Edge                  Edge;
+  typedef typename Triangulation::Edge_circulator       Edge_circulator;
+  typedef typename Triangulation::Face_circulator       Face_circulator;
+  typedef typename Triangulation::Vertex_circulator     Vertex_circulator;
+  typedef typename Triangulation::Finite_edges_iterator Finite_edges_iterator;
+  typedef typename Triangulation::Finite_faces_iterator Finite_faces_iterator;
+  typedef typename Triangulation::Finite_vertices_iterator 
+                                                     Finite_vertices_iterator;
+  typedef typename Triangulation::All_faces_iterator    All_faces_iterator;
+ 
+#ifndef CGAL_CFG_USING_BASE_MEMBER_BUG_2
+  using Triangulation::side_of_oriented_circle;
+  using Triangulation::circumcenter;
+  using Triangulation::collinear_between;
+  using Triangulation::test_dim_down;
+  using Triangulation::make_hole;
+  using Triangulation::fill_hole_delaunay;
+  using Triangulation::delete_vertex;
+#endif
+
+ Delaunay_triangulation_2(const Gt& gt = Gt())
+  : Triangulation_2<Gt,Tds>(gt) {}
+  
+  Delaunay_triangulation_2(
+	       const Delaunay_triangulation_2<Gt,Tds> &tr)
+       : Triangulation_2<Gt,Tds>(tr)
+  {   CGAL_triangulation_postcondition( is_valid() );  }
+
+ template <class InputIterator>
+ Delaunay_triangulation_2(InputIterator first, InputIterator last,
+                          const Gt& gt = Gt())
+ : Triangulation_2<Gt,Tds>(gt)
+ {
+  insert(first,last);
+ }
+
+// CHECK -QUERY
+  bool is_valid(bool verbose = false, int level = 0) const;
+
+  Vertex_handle
+  nearest_vertex(const Point& p, Face_handle f= Face_handle()) const;
+  
+  bool does_conflict(const Point  &p, Face_handle fh) const;// deprecated
+  bool test_conflict(const Point  &p, Face_handle fh, bool strict = true) const;
+  bool find_conflicts(const Point  &p,                //deprecated
+		      std::list<Face_handle>& conflicts,
+		      Face_handle start= Face_handle() ) const;
+  //  //template member functions, declared and defined at the end 
+  // template <class OutputItFaces, class OutputItBoundaryEdges> 
+  // std::pair<OutputItFaces,OutputItBoundaryEdges>
+  // get_conflicts_and_boundary(const Point  &p, 
+  // 		                OutputItFaces fit, 
+  // 		                OutputItBoundaryEdges eit,
+  // 		                Face_handle start) const;
+  // template <class OutputItFaces>
+  // OutputItFaces
+  // get_conflicts (const Point  &p, 
+  //                OutputItFaces fit, 
+  // 		    Face_handle start ) const;
+  // template <class OutputItBoundaryEdges>
+  // OutputItBoundaryEdges
+  // get_boundary_of_conflicts(const Point  &p, 
+  // 			       OutputItBoundaryEdges eit, 
+  // 			       Face_handle start ) const;
+   
+ 
+  // DUAL
+  Point dual (Face_handle f) const;
+  Object dual(const Edge &e) const ;
+  Object dual(const Edge_circulator& ec) const;
+  Object dual(const Finite_edges_iterator& ei) const;
+
+  //INSERTION-REMOVAL
+  Vertex_handle insert(const Point  &p, 
+		       Face_handle start = Face_handle() );
+  Vertex_handle insert(const Point& p,
+		       Locate_type lt,
+		       Face_handle loc, int li );
+  Vertex_handle push_back(const Point &p);
+
+  void  remove(Vertex_handle v );
+
+  // DISPLACEMENT
+  void restore_Delaunay(Vertex_handle v);
+
+  Vertex_handle move_if_no_collision(Vertex_handle v, const Point &p);
+  Vertex_handle move(Vertex_handle v, const Point &p);
+
+protected: // some internal stuffs
+
+  template <class OutputItFaces>
+  Vertex_handle insert_and_give_new_faces(const Point  &p, 
+                                          OutputItFaces fit,
+                                          Face_handle start = Face_handle() );
+  template <class OutputItFaces>
+  Vertex_handle insert_and_give_new_faces(const Point& p,
+                                          Locate_type lt,
+                                          Face_handle loc, int li, 
+                                          OutputItFaces fit);
+
+  template <class OutputItFaces>
+  Vertex_handle move_if_no_collision_and_give_new_faces(Vertex_handle v, 
+                                                        const Point &p, 
+                                                        OutputItFaces fit);
+
+  template <class OutputItFaces>
+  void remove_and_give_new_faces(Vertex_handle v, 
+                                 OutputItFaces fit);
+public:
+
+  bool is_delaunay_after_displacement(Vertex_handle v, 
+                                      const Point &p) const;
+
+#ifndef CGAL_CFG_USING_BASE_MEMBER_BUG_2  
+  using Triangulation::cw;
+  using Triangulation::ccw;
+  using Triangulation::geom_traits;
+#endif
+
+private:
+#ifndef CGAL_DT2_USE_RECURSIVE_PROPAGATING_FLIP
+  void non_recursive_propagating_flip(Face_handle f,int i);
+  void propagating_flip(const Face_handle& f,int i, int depth=0);
+#else
+  void propagating_flip(const Face_handle& f,int i);
+#endif
+
+
+// auxilliary functions for remove
+  void remove_degree_init(Vertex_handle v, std::vector<Face_handle> &f,
+         std::vector<Vertex_handle> &w, std::vector<int> &i,int&d,int&maxd);
+  void remove_degree_triangulate(Vertex_handle v, std::vector<Face_handle> &f,
+		      std::vector<Vertex_handle> &w, std::vector<int> &i,int d);
+  void remove_degree_d(Vertex_handle v, std::vector<Face_handle> &f,
+		      std::vector<Vertex_handle> &w, std::vector<int> &i,int d);
+  void remove_degree3(Vertex_handle v, std::vector<Face_handle> &f,
+		      std::vector<Vertex_handle> &w, std::vector<int> &i);
+  void remove_degree4(Vertex_handle v, std::vector<Face_handle> &f,
+		      std::vector<Vertex_handle> &w, std::vector<int> &i);
+  void remove_degree5(Vertex_handle v, std::vector<Face_handle> &f,
+		      std::vector<Vertex_handle> &w, std::vector<int> &i );
+  void remove_degree5_star   (Vertex_handle &v, 
+     Face_handle & ,Face_handle & ,Face_handle & ,Face_handle & ,Face_handle & ,
+     Vertex_handle&,Vertex_handle&,Vertex_handle&,Vertex_handle&,Vertex_handle&,
+     int           ,int           ,int           ,int           ,int );
+  void remove_degree6(Vertex_handle v , std::vector<Face_handle> &f,
+		      std::vector<Vertex_handle> &w, std::vector<int> &i);
+  void remove_degree6_star   (Vertex_handle &v,
+			      Face_handle & ,Face_handle & ,Face_handle & ,
+			      Face_handle & ,Face_handle & ,Face_handle & ,
+			      Vertex_handle&,Vertex_handle&,Vertex_handle&,
+			      Vertex_handle&,Vertex_handle&,Vertex_handle&,
+			      int           ,int           ,int           ,
+			      int           ,int           ,int );
+  void remove_degree6_N      (Vertex_handle &v,
+			      Face_handle & ,Face_handle & ,Face_handle & ,
+			      Face_handle & ,Face_handle & ,Face_handle & ,
+			      Vertex_handle&,Vertex_handle&,Vertex_handle&,
+			      Vertex_handle&,Vertex_handle&,Vertex_handle&,
+			      int           ,int           ,int           ,
+			      int           ,int           ,int  );
+  void remove_degree6_antiN  (Vertex_handle &v,
+			      Face_handle & ,Face_handle & ,Face_handle & ,
+			      Face_handle & ,Face_handle & ,Face_handle & ,
+			      Vertex_handle&,Vertex_handle&,Vertex_handle&,
+			      Vertex_handle&,Vertex_handle&,Vertex_handle&,
+			      int           ,int           ,int           ,
+			      int           ,int           ,int  );
+  void remove_degree6_diamond(Vertex_handle &v,
+			      Face_handle & ,Face_handle & ,Face_handle & ,
+			      Face_handle & ,Face_handle & ,Face_handle & ,
+			      Vertex_handle&,Vertex_handle&,Vertex_handle&,
+			      Vertex_handle&,Vertex_handle&,Vertex_handle&,
+			      int           ,int           ,int           ,
+			      int           ,int           ,int  );
+  void remove_degree7(Vertex_handle v,std::vector<Face_handle> &f,
+		      std::vector<Vertex_handle> &w, std::vector<int> &i);
+  bool incircle(int x, int j, int, int l, std::vector<Face_handle> &f,
+		std::vector<Vertex_handle> &w, std::vector<int> &i){
+    // k is supposed to be j+1 modulo degree, x is supposed to be finite
+    //test if w[x] inside circle w[j]w[k]w[l] (f[j] has vertices w[j]w[k])
+    // THE FOLLOWING LINE IS TO BE REMOVED. JUST THERE FOR STUPID PRECONDITION
+    //if (geom_traits().orientation_2_object()(w[j]->point(),w[k]->point(),w[l]->point())!=POSITIVE) return true;
+    f[j]->set_vertex( i[j], w[l]) ; // change vertex v for another one
+    return (test_conflict( w[x]->point(), f[j]) );
+  }
+  void rotate7(int j, std::vector<Vertex_handle> &w, 
+	       std::vector<Face_handle> &f, std::vector<int> &i);
+  void remove_degree7_star      (Vertex_handle&,int,std::vector<Face_handle> &f,
+		      std::vector<Vertex_handle> &w, std::vector<int> &i);
+  void remove_degree7_zigzag    (Vertex_handle&,int,std::vector<Face_handle> &f,
+		      std::vector<Vertex_handle> &w, std::vector<int> &i);
+  void remove_degree7_leftdelta (Vertex_handle&,int,std::vector<Face_handle> &f,
+		      std::vector<Vertex_handle> &w, std::vector<int> &i);
+  void remove_degree7_rightdelta(Vertex_handle&,int,std::vector<Face_handle> &f,
+		      std::vector<Vertex_handle> &w, std::vector<int> &i);
+  void remove_degree7_leftfan   (Vertex_handle&,int,std::vector<Face_handle> &f,
+		      std::vector<Vertex_handle> &w, std::vector<int> &i);
+  void remove_degree7_rightfan  (Vertex_handle&,int,std::vector<Face_handle> &f,
+		      std::vector<Vertex_handle> &w, std::vector<int> &i);
+// end of auxilliary functions for remove
+
+
+
+  Vertex_handle nearest_vertex_2D(const Point& p, Face_handle f) const;
+  Vertex_handle nearest_vertex_1D(const Point& p) const;
+
+  void  look_nearest_neighbor(const Point& p,
+			      Face_handle f,
+			      int i,
+			      Vertex_handle& nn) const;
+
+public:
+  template < class Stream>
+  Stream& draw_dual(Stream & ps)
+    {
+      Finite_edges_iterator eit= this->finite_edges_begin();
+      for (; eit != this->finite_edges_end(); ++eit) {
+	Object o = dual(eit);
+	typename Geom_traits::Line_2  l;
+	typename Geom_traits::Ray_2   r;
+	Segment s;
+	if (CGAL::assign(s,o)) ps << s;
+	if (CGAL::assign(r,o)) ps << r;
+	if (CGAL::assign(l,o)) ps << l;
+      }
+      return ps;
+    }
+#ifndef CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
+  template < class InputIterator >
+  std::ptrdiff_t
+  insert( InputIterator first, InputIterator last,
+          typename boost::enable_if<
+            boost::is_convertible<
+                typename std::iterator_traits<InputIterator>::value_type,
+                Point
+            >
+          >::type* = NULL
+  )
+#else
+  template < class InputIterator >
+  std::ptrdiff_t
+  insert(InputIterator first, InputIterator last)
+#endif //CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO 
+    {
+      size_type n = this->number_of_vertices();
+
+      std::vector<Point> points (first, last);
+      spatial_sort (points.begin(), points.end(), geom_traits());
+      Face_handle f;
+      for (typename std::vector<Point>::const_iterator p = points.begin(), end = points.end();
+              p != end; ++p)
+          f = insert (*p, f)->face();
+
+      return this->number_of_vertices() - n;
+    }
+
+#ifndef CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
+private:  
+  //top stands for tuple-or-pair
+  template <class Info>
+  const Point& top_get_first(const std::pair<Point,Info>& pair) const { return pair.first; }
+  template <class Info>
+  const Info& top_get_second(const std::pair<Point,Info>& pair) const { return pair.second; }
+  template <class Info>
+  const Point& top_get_first(const boost::tuple<Point,Info>& tuple) const { return boost::get<0>(tuple); }
+  template <class Info>
+  const Info& top_get_second(const boost::tuple<Point,Info>& tuple) const { return boost::get<1>(tuple); }
+
+  template <class Tuple_or_pair,class InputIterator>
+  std::ptrdiff_t insert_with_info(InputIterator first,InputIterator last)
+  {
+    size_type n = this->number_of_vertices();
+    std::vector<std::size_t> indices;
+    std::vector<Point> points;
+    std::vector<typename Tds::Vertex::Info> infos;
+    std::size_t index=0;
+    for (InputIterator it=first;it!=last;++it){
+      Tuple_or_pair value=*it;
+      points.push_back( top_get_first(value)  );
+      infos.push_back ( top_get_second(value) );
+      indices.push_back(index++);
+    }
+
+    typedef typename Pointer_property_map<Point>::type Pmap;
+    typedef Spatial_sort_traits_adapter_2<Geom_traits,Pmap> Search_traits;
+    
+    spatial_sort(indices.begin(),
+                 indices.end(),
+                 Search_traits(make_property_map(points),geom_traits()));
+
+    Vertex_handle v_hint;
+    Face_handle hint;
+    for (typename std::vector<std::size_t>::const_iterator
+      it = indices.begin(), end = indices.end();
+      it != end; ++it){
+      v_hint = insert(points[*it], hint);
+      if (v_hint!=Vertex_handle()){
+        v_hint->info()=infos[*it];
+        hint=v_hint->face();
+      }
+    }
+    
+    return this->number_of_vertices() - n;
+  }
+  
+public:
+
+  template < class InputIterator >
+  std::ptrdiff_t
+  insert( InputIterator first,
+          InputIterator last,
+          typename boost::enable_if<
+            boost::is_convertible<
+              typename std::iterator_traits<InputIterator>::value_type,
+              std::pair<Point,typename internal::Info_check<typename Tds::Vertex>::type>
+            > >::type* =NULL
+  )
+  {
+    return insert_with_info< std::pair<Point,typename internal::Info_check<typename Tds::Vertex>::type> >(first,last);
+  }
+
+  template <class  InputIterator_1,class InputIterator_2>
+  std::ptrdiff_t
+  insert( boost::zip_iterator< boost::tuple<InputIterator_1,InputIterator_2> > first,
+          boost::zip_iterator< boost::tuple<InputIterator_1,InputIterator_2> > last,
+          typename boost::enable_if<
+            boost::mpl::and_<
+              boost::is_convertible< typename std::iterator_traits<InputIterator_1>::value_type, Point >,
+              boost::is_convertible< typename std::iterator_traits<InputIterator_2>::value_type, typename internal::Info_check<typename Tds::Vertex>::type >
+            >
+          >::type* =NULL
+  )
+  {
+    return insert_with_info< boost::tuple<Point,typename internal::Info_check<typename Tds::Vertex>::type> >(first,last);
+  }
+#endif //CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
+
+  template <class OutputItFaces, class OutputItBoundaryEdges> 
+  std::pair<OutputItFaces,OutputItBoundaryEdges>
+  get_conflicts_and_boundary(const Point  &p, 
+			     OutputItFaces fit, 
+			     OutputItBoundaryEdges eit,
+			     Face_handle start = Face_handle(),
+                             bool strict = true) const {
+    CGAL_triangulation_precondition( this->dimension() == 2);
+    int li;
+    Locate_type lt;
+    Face_handle fh = this->locate(p,lt,li, start);
+    switch(lt) {
+    case Triangulation::OUTSIDE_AFFINE_HULL:
+    case Triangulation::VERTEX:
+      return std::make_pair(fit,eit);
+    case Triangulation::FACE:
+    case Triangulation::EDGE:
+    case Triangulation::OUTSIDE_CONVEX_HULL:
+      *fit++ = fh; //put fh in OutputItFaces
+      std::pair<OutputItFaces,OutputItBoundaryEdges>
+	pit = std::make_pair(fit,eit);
+      pit = propagate_conflicts(p,fh,0,pit, strict);
+      pit = propagate_conflicts(p,fh,1,pit, strict);
+      pit = propagate_conflicts(p,fh,2,pit, strict);
+      return pit;    
+    }
+    CGAL_triangulation_assertion(false);
+    return std::make_pair(fit,eit);
+  } 
+
+  template <class OutputItFaces> 
+  OutputItFaces
+  get_conflicts (const Point  &p, 
+		 OutputItFaces fit, 
+		 Face_handle start= Face_handle(),
+                 bool strict = true) const {
+    std::pair<OutputItFaces,Emptyset_iterator> pp = 
+      get_conflicts_and_boundary(p,fit,Emptyset_iterator(),start, strict);
+    return pp.first;
+  }
+
+  template <class OutputItBoundaryEdges> 
+  OutputItBoundaryEdges
+  get_boundary_of_conflicts(const Point  &p, 
+			    OutputItBoundaryEdges eit, 
+			    Face_handle start= Face_handle(),
+                            bool strict = true) const {
+    std::pair<Emptyset_iterator, OutputItBoundaryEdges> pp = 
+      get_conflicts_and_boundary(p,Emptyset_iterator(),eit,start,strict);
+    return pp.second;
+  }
+
+private:
+  
+
+
+
+#ifdef CGAL_DT2_USE_RECURSIVE_PROPAGATE_CONFLICTS
+  template <class OutputItFaces, class OutputItBoundaryEdges> 
+  std::pair<OutputItFaces,OutputItBoundaryEdges>
+  propagate_conflicts (const Point  &p,
+		       const Face_handle fh, 
+		       const int i,
+		       std::pair<OutputItFaces,OutputItBoundaryEdges>
+		       pit,
+                       bool strict = true)  const {
+    Face_handle fn = fh->neighbor(i);
+    if (! test_conflict(p,fn,strict)) {
+      *(pit.second)++ = Edge(fn, fn->index(fh));
+    } else {
+      *(pit.first)++ = fn;
+      int j = fn->index(fh);
+      pit = propagate_conflicts(p,fn,ccw(j),pit,strict);
+      pit = propagate_conflicts(p,fn,cw(j), pit,strict);
+    }
+    return pit;
+  }
+#else // NO CGAL_DT2_USE_RECURSIVE_PROPAGATE_CONFLICTS
+  template <class OutputItFaces, class OutputItBoundaryEdges> 
+  std::pair<OutputItFaces,OutputItBoundaryEdges>
+  non_recursive_propagate_conflicts ( const Point  &p,
+                                      const Face_handle fh, 
+                                      const int i,
+		                      std::pair<OutputItFaces,OutputItBoundaryEdges> pit,
+                                      bool strict = true)  const 
+  {
+    std::stack<std::pair<Face_handle, int> > stack;
+    stack.push( std::make_pair(fh,i) );
+    while ( !stack.empty() )
+    {
+      const Face_handle fh=stack.top().first;
+      const int i=stack.top().second;
+      stack.pop();
+      Face_handle fn = fh->neighbor(i);
+      if (! test_conflict(p,fn,strict)) {
+        *(pit.second)++ = Edge(fn, fn->index(fh));
+      } else {
+        *(pit.first)++ = fn;
+        int j = fn->index(fh);
+        stack.push( std::make_pair(fn,ccw(j)) );
+        stack.push( std::make_pair(fn,cw(j)) );
+      }
+    }
+    return pit;
+  }
+
+  template <class OutputItFaces, class OutputItBoundaryEdges> 
+  std::pair<OutputItFaces,OutputItBoundaryEdges>
+  propagate_conflicts (const Point  &p,
+		       const Face_handle fh, 
+		       const int i,
+		       std::pair<OutputItFaces,OutputItBoundaryEdges>
+		       pit,
+                       bool strict = true,
+                       int depth=0)  const 
+  {
+    if (depth == 100)
+      return non_recursive_propagate_conflicts(p, fh, i, pit, strict);
+
+    Face_handle fn = fh->neighbor(i);
+    if (! test_conflict(p,fn,strict)) {
+      *(pit.second)++ = Edge(fn, fn->index(fh));
+    } else {
+      *(pit.first)++ = fn;
+      int j = fn->index(fh);
+      pit = propagate_conflicts(p,fn,ccw(j),pit, strict, depth+1);
+      pit = propagate_conflicts(p,fn,cw(j), pit, strict, depth+1);
+    }
+    return pit;
+  }
+#endif // NO CGAL_DT2_USE_RECURSIVE_PROPAGATE_CONFLICTS
+
+protected:
+
+  void restore_edges(Vertex_handle v)
+  {
+    std::list<Edge> edges;
+    Face_circulator fc = this->incident_faces(v), done(fc);
+    int degree = 0;
+    do {
+      if((++degree) > 3) break;
+    } while(++fc != done);
+    fc = this->incident_faces(v);
+    done = fc;
+    if(degree == 3) {
+      do {
+        int i = fc->index(v);
+        edges.push_back(Edge(fc, i));
+      } while(++fc != done);
+    } else {
+      do {
+        int i = fc->index(v);
+        edges.push_back(Edge(fc, i));
+        edges.push_back(Edge(fc, this->cw(i)));
+      } while(++fc != done);
+    }
+    while(!edges.empty()) {
+      const Edge &e = edges.front();
+      Face_handle f = e.first;
+      int i = e.second;
+      edges.pop_front();
+      if(this->is_infinite(f->vertex(i))) continue;
+      Face_handle fi = f->neighbor(i);
+      int mi = this->_tds.mirror_index(f, i);
+      Vertex_handle vm = this->_tds.mirror_vertex(f, i);
+      if(this->is_infinite(vm)) continue;
+      if(this->side_of_oriented_circle(f, vm->point(),true) == ON_POSITIVE_SIDE) {
+        this->_tds.flip(f, i);
+        edges.push_back(Edge(f, i));
+        edges.push_back(Edge(f, this->cw(i)));
+        edges.push_back(Edge(fi, this->cw(mi)));
+        edges.push_back(Edge(fi, mi));
+      }
+    }
+  }
+
+  void restore_edges(Vertex_handle v, std::set<Face_handle> &faces)
+  {
+    typedef std::list<Edge> Edges_list;	
+    Edges_list edges;
+    Face_circulator fc = this->incident_faces(v), done(fc);
+    int degree = 0;
+    do {
+      if((++degree) > 3) break;
+    } while(++fc != done);
+    fc = this->incident_faces(v);
+    done = fc;
+    if(degree == 3) {
+      do {
+        int i = fc->index(v);
+        edges.push_back(Edge(fc, i));
+      } while(++fc != done);
+    } else {
+      do {
+        int i = fc->index(v);
+        edges.push_back(Edge(fc, i));
+        edges.push_back(Edge(fc, this->cw(i)));
+      } while(++fc != done);
+    }
+    while(!edges.empty()) {
+      const Edge &e = edges.front();
+      Face_handle f = e.first;
+      int i = e.second;
+      edges.pop_front();
+      faces.insert(f);
+      if(this->is_infinite(f->vertex(i))) continue;
+      Face_handle fi = f->neighbor(i);
+      int mi = this->_tds.mirror_index(f, i);
+      Vertex_handle vm = this->_tds.mirror_vertex(f, i);
+      if(this->is_infinite(vm)) continue;
+      if(this->side_of_oriented_circle(f, vm->point()) == ON_POSITIVE_SIDE) {
+        this->_tds.flip(f, i);
+        edges.push_back(Edge(f, i));
+        edges.push_back(Edge(f, this->cw(i)));
+        edges.push_back(Edge(fi, this->cw(mi)));
+        edges.push_back(Edge(fi, mi));
+      }
+    }
+  }
+
+};
+
+template < class Gt, class Tds >
+inline bool
+Delaunay_triangulation_2<Gt,Tds>::
+test_conflict(const Point  &p, Face_handle fh, bool strict) const
+{
+  if(! strict){
+    Oriented_side os = side_of_oriented_circle(fh,p,false);
+    return os == ON_POSITIVE_SIDE;
+  }
+  // return true  if P is inside the circumcircle of fh
+  // if fh is infinite, return true when p is in the positive
+  // halfspace or on the boundary and in the  finite edge of fh
+  Oriented_side os = side_of_oriented_circle(fh,p,true);
+  if (os == ON_POSITIVE_SIDE) return true;
+ 
+  if (os == ON_ORIENTED_BOUNDARY && this->is_infinite(fh)) {
+    int i = fh->index(this->infinite_vertex());
+    return collinear_between(fh->vertex(cw(i))->point(), p,
+			     fh->vertex(ccw(i))->point() );
+  }
+
+  return false;
+}
+
+template < class Gt, class Tds >
+inline bool
+Delaunay_triangulation_2<Gt,Tds>::
+does_conflict(const Point  &p, Face_handle fh) const
+{
+  return test_conflict(p,fh);
+}
+
+template < class Gt, class Tds >
+inline bool
+Delaunay_triangulation_2<Gt,Tds>::
+find_conflicts(const Point  &p, 
+	       std::list<Face_handle>& conflicts,
+	       Face_handle start ) const
+{
+  get_conflicts(p, std::back_inserter(conflicts), start);
+  return (! conflicts.empty());
+}
+
+template < class Gt, class Tds >
+bool
+Delaunay_triangulation_2<Gt,Tds>::
+is_valid(bool verbose, int level) const
+{
+  bool result = Triangulation_2<Gt,Tds>::is_valid(verbose, level);
+
+  for( Finite_faces_iterator it = this->finite_faces_begin(); 
+       it != this->finite_faces_end() ; it++) {
+    for(int i=0; i<3; i++) {
+      if ( ! this->is_infinite( this->mirror_vertex(it,i))) {
+	result = result &&  ON_POSITIVE_SIDE != 
+	  side_of_oriented_circle( it, this->mirror_vertex(it,i)->point(), false);
+      }
+      CGAL_triangulation_assertion( result );
+    }
+  }
+  return result;
+}
+
+template < class Gt, class Tds >
+typename Delaunay_triangulation_2<Gt,Tds>::Vertex_handle
+Delaunay_triangulation_2<Gt,Tds>:: 
+nearest_vertex(const Point  &p, Face_handle f) const
+{
+  switch (this->dimension()) {
+  case 0:
+    if (this->number_of_vertices() == 0) return Vertex_handle();
+    if (this->number_of_vertices() == 1) return this->finite_vertex();
+    //break;
+  case 1:
+    return nearest_vertex_1D(p);
+    //break;      
+  case 2:
+    return nearest_vertex_2D(p,f);
+    //break;
+  }
+  return Vertex_handle();
+}
+  
+template < class Gt, class Tds >
+typename Delaunay_triangulation_2<Gt,Tds>::Vertex_handle
+Delaunay_triangulation_2<Gt,Tds>:: 
+nearest_vertex_2D(const Point& p, Face_handle f) const
+{
+  CGAL_triangulation_precondition(this->dimension() == 2);
+  f = this->locate(p,f);
+
+  typename Geom_traits::Compare_distance_2 
+    compare_distance =  this->geom_traits().compare_distance_2_object();
+  Vertex_handle nn =  !this->is_infinite(f->vertex(0)) ? f->vertex(0):f->vertex(1);
+  if ( !this->is_infinite(f->vertex(1)) && compare_distance(p,
+					    f->vertex(1)->point(),
+					    nn->point()) == SMALLER) 
+    nn=f->vertex(1);
+  if ( !this->is_infinite(f->vertex(2)) && compare_distance(p,
+					    f->vertex(2)->point(), 
+					    nn->point()) == SMALLER) 
+    nn=f->vertex(2);
+       
+  look_nearest_neighbor(p,f,0,nn);
+  look_nearest_neighbor(p,f,1,nn);
+  look_nearest_neighbor(p,f,2,nn);
+  return nn;
+}
+
+template < class Gt, class Tds >
+typename Delaunay_triangulation_2<Gt,Tds>::Vertex_handle
+Delaunay_triangulation_2<Gt,Tds>:: 
+nearest_vertex_1D(const Point& p) const
+{
+  typename Geom_traits::Compare_distance_2 
+    compare_distance =  this->geom_traits().compare_distance_2_object();
+  Vertex_handle nn;
+  
+  Finite_vertices_iterator vit=this->finite_vertices_begin();
+  nn = vit;
+  for ( ; vit != this->finite_vertices_end(); ++vit){
+    if (compare_distance(p, vit->point(), nn->point()) == SMALLER) 
+      nn = vit;
+  } 
+  return nn;
+}
+  
+template < class Gt, class Tds >
+void
+Delaunay_triangulation_2<Gt,Tds>::
+look_nearest_neighbor(const Point& p,
+                      Face_handle f,
+		      int i,
+		      Vertex_handle& nn) const
+{
+  Face_handle  ni=f->neighbor(i);
+  if ( ON_POSITIVE_SIDE != side_of_oriented_circle(ni,p,true) ) return;
+
+  typename Geom_traits::Compare_distance_2 
+    compare_distance =  this->geom_traits().compare_distance_2_object();
+  i = ni->index(f);
+  if ( !this->is_infinite(ni->vertex(i)) &&
+       compare_distance(p, 
+	      ni->vertex(i)->point(),
+	      nn->point())  == SMALLER)  nn=ni->vertex(i);
+    
+  // recursive exploration of triangles whose circumcircle contains p
+  look_nearest_neighbor(p, ni, ccw(i), nn);
+  look_nearest_neighbor(p, ni, cw(i), nn);
+} 
+
+//DUALITY
+template<class Gt, class Tds>
+inline
+typename Delaunay_triangulation_2<Gt,Tds>::Point
+Delaunay_triangulation_2<Gt,Tds>::
+dual (Face_handle f) const
+{
+  CGAL_triangulation_precondition(this->_tds.is_face(f));
+  CGAL_triangulation_precondition (this->dimension()==2);
+  return circumcenter(f);
+}
+
+  
+template < class Gt, class Tds >
+Object
+Delaunay_triangulation_2<Gt,Tds>::
+dual(const Edge &e) const
+{
+  CGAL_triangulation_precondition(this->_tds.is_edge(e.first,e.second));
+  
+  typedef typename Geom_traits::Line_2        Line;
+  typedef typename Geom_traits::Ray_2         Ray;
+
+  CGAL_triangulation_precondition (!this->is_infinite(e));
+  if( this->dimension()== 1 ){
+    const Point& p = (e.first)->vertex(cw(e.second))->point();
+    const Point& q = (e.first)->vertex(ccw(e.second))->point();
+    Line l  = this->geom_traits().construct_bisector_2_object()(p,q);
+    return make_object(l);
+  }
+		    
+  // dimension==2
+  if( (!this->is_infinite(e.first)) &&
+      (!this->is_infinite(e.first->neighbor(e.second))) ) {
+    Segment s = this->geom_traits().construct_segment_2_object()
+                          (dual(e.first),dual(e.first->neighbor(e.second)));
+    return make_object(s);
+  } 
+  // one of the adjacent faces is infinite
+  Face_handle f; int i;
+  if (this->is_infinite(e.first)) {
+    f=e.first->neighbor(e.second); i=f->index(e.first);
+  }
+  else {
+    f=e.first; i=e.second;
+  }
+  const Point& p = f->vertex(cw(i))->point();
+  const Point& q = f->vertex(ccw(i))->point();
+  Line l = this->geom_traits().construct_bisector_2_object()(p,q);
+  Ray r = this->geom_traits().construct_ray_2_object()(dual(f), l);
+  return make_object(r);
+}
+  
+template < class Gt, class Tds >
+inline Object
+Delaunay_triangulation_2<Gt,Tds>::  
+dual(const Edge_circulator& ec) const
+{
+  return dual(*ec);
+}
+
+template < class Gt, class Tds >
+inline Object
+Delaunay_triangulation_2<Gt,Tds>::
+dual(const Finite_edges_iterator& ei) const
+{
+  return dual(*ei);
+}
+
+
+///////////////////////////////////////////////////////////////
+//  INSERT
+
+template < class Gt, class Tds >
+inline
+typename Delaunay_triangulation_2<Gt,Tds>::Vertex_handle
+Delaunay_triangulation_2<Gt,Tds>::
+insert(const Point  &p,  Face_handle start)
+{
+  Locate_type lt;
+  int li;
+  Face_handle loc = this->locate (p, lt, li, start);
+  return insert(p, lt, loc, li);
+}
+  
+template < class Gt, class Tds >
+inline
+typename Delaunay_triangulation_2<Gt,Tds>::Vertex_handle
+Delaunay_triangulation_2<Gt,Tds>::
+push_back(const Point &p)
+{
+  return insert(p);
+}
+  
+template < class Gt, class Tds >
+inline
+typename Delaunay_triangulation_2<Gt,Tds>::Vertex_handle
+Delaunay_triangulation_2<Gt,Tds>::
+insert(const Point  &p, Locate_type lt, Face_handle loc, int li)
+{
+  Vertex_handle v = Triangulation_2<Gt,Tds>::insert(p,lt,loc,li);
+  restore_Delaunay(v);
+  return(v);
+}
+
+template < class Gt, class Tds >
+template < class OutputItFaces >
+inline
+typename Delaunay_triangulation_2<Gt,Tds>::Vertex_handle 
+Delaunay_triangulation_2<Gt,Tds>::
+insert_and_give_new_faces(const Point  &p, 
+                          OutputItFaces oif,
+                          Face_handle start)
+{
+  Vertex_handle v = insert(p, start);
+  int dimension = this->dimension();
+  if(dimension == 2)
+  {
+    Face_circulator fc = this->incident_faces(v), done(fc);
+    do {
+      *oif++ = fc;
+    } while(++fc != done);
+  }
+  else if(dimension == 1)
+  {
+    Face_handle c = v->face();
+    *oif++ = c;
+    *oif++ = c->neighbor((~(c->index(v)))&1);
+  }
+  else *oif++ = v->face(); // dimension == 0
+  return v;
+}
+		
+template < class Gt, class Tds >
+template < class OutputItFaces >
+inline
+typename Delaunay_triangulation_2<Gt,Tds>::Vertex_handle 
+Delaunay_triangulation_2<Gt,Tds>::
+insert_and_give_new_faces(const Point  &p,
+                          Locate_type lt,
+                          Face_handle loc, int li, 
+                          OutputItFaces oif)
+{
+  Vertex_handle v = insert(p, lt, loc, li);
+  int dimension = this->dimension();
+  if(dimension == 2)
+  {
+    Face_circulator fc = this->incident_faces(v), done(fc);
+    do {
+      *oif++ = fc;
+    } while(++fc != done);
+  }
+  else if(dimension == 1)
+  {
+    Face_handle c = v->face();
+    *oif++ = c;
+    *oif++ = c->neighbor((~(c->index(v)))&1);
+  }
+  else *oif++ = v->face(); // dimension == 0	
+  return v;	
+}
+
+template < class Gt, class Tds >
+void
+Delaunay_triangulation_2<Gt,Tds>::
+restore_Delaunay(Vertex_handle v)
+{
+  if(this->dimension() <= 1) return;
+
+  Face_handle f=v->face();
+  Face_handle next;
+  int i;
+  Face_handle start(f);
+  do {
+    i = f->index(v);
+    next = f->neighbor(ccw(i));  // turn ccw around v
+    propagating_flip(f,i);
+    f=next;
+  } while(next != start);
+  return;
+}
+
+#ifndef CGAL_DT2_USE_RECURSIVE_PROPAGATING_FLIP
+template < class Gt, class Tds >
+void
+Delaunay_triangulation_2<Gt,Tds>::
+non_recursive_propagating_flip(Face_handle f , int i)
+{
+  std::stack<Edge> edges;
+  const Vertex_handle& vp = f->vertex(i);
+  const Point& p = vp->point();
+  edges.push(Edge(f,i));
+
+  while(! edges.empty()){
+    const Edge& e = edges.top();
+    f = e.first; 
+    i = e.second;
+    const Face_handle& n = f->neighbor(i);
+    
+    if ( ON_POSITIVE_SIDE != 
+         side_of_oriented_circle(n,  p, true) ) {
+      edges.pop();
+      continue;
+    }
+    this->flip(f, i);
+    // As we haven't popped it, we don't have to push it
+    edges.push(Edge(n,n->index(vp)));
+  }
+}
+
+template < class Gt, class Tds >
+void
+Delaunay_triangulation_2<Gt,Tds>::
+propagating_flip(const Face_handle& f,int i, int depth)
+{
+#ifdef CGAL_DT2_IMMEDIATELY_NON_RECURSIVE_PROPAGATING_FLIP
+  non_recursive_propagating_flip(f,i);
+#else
+  int max_depth = 100;
+  if(depth==max_depth){
+    non_recursive_propagating_flip(f,i);
+    return;
+  }
+  Face_handle n = f->neighbor(i);
+      
+  if ( ON_POSITIVE_SIDE != 
+       side_of_oriented_circle(n,  f->vertex(i)->point(), true) ) {
+    return;
+  }
+  this->flip(f, i);
+  propagating_flip(f,i,depth+1);
+  i = n->index(f->vertex(i));
+  propagating_flip(n,i,depth+1);
+#endif
+}
+#else 
+template < class Gt, class Tds >
+void
+Delaunay_triangulation_2<Gt,Tds>::
+propagating_flip(const Face_handle& f,int i)
+{
+ 
+  Face_handle n = f->neighbor(i);
+      
+  if ( ON_POSITIVE_SIDE != 
+       side_of_oriented_circle(n,  f->vertex(i)->point(), true) ) {
+    return;
+  }
+  this->flip(f, i);
+  propagating_flip(f,i);
+  i = n->index(f->vertex(i));
+  propagating_flip(n,i);
+}
+#endif
+
+///////////////////////////////////////////////////////////////
+//  REMOVE    see INRIA RResearch Report 7104
+
+template < class Gt, class Tds >
+template <class OutputItFaces>
+void
+Delaunay_triangulation_2<Gt,Tds>::
+remove_and_give_new_faces(Vertex_handle v, OutputItFaces fit)
+{
+  CGAL_triangulation_precondition( v != Vertex_handle());
+  CGAL_triangulation_precondition( !this->is_infinite(v));
+    
+  if(this->number_of_vertices() == 1) this->remove_first(v);
+  else if(this->number_of_vertices() == 2) this->remove_second(v);
+  else if( this->dimension() == 1) 
+  {
+    Point p = v->point();
+    Triangulation::remove(v);
+    *fit++ = this->locate(p);
+  }
+  else if (this->test_dim_down(v)) {  
+    this->_tds.remove_dim_down(v);  
+    for(All_faces_iterator afi = this-> all_faces_begin(); 
+        afi != this->all_faces_end(); 
+        afi++) *fit++ = afi;
+  }
+  else {
+    CGAL_STATIC_THREAD_LOCAL_VARIABLE(int, maxd,30);
+    CGAL_STATIC_THREAD_LOCAL_VARIABLE(std::vector<Face_handle> , f, maxd);
+    CGAL_STATIC_THREAD_LOCAL_VARIABLE(std::vector<int>, i, maxd);
+    CGAL_STATIC_THREAD_LOCAL_VARIABLE(std::vector<Vertex_handle>, w, maxd);
+
+    int d;
+    remove_degree_init(v,f,w,i,d,maxd);
+    remove_degree_triangulate(v,f,w,i,d);
+    this->delete_vertex(v);
+    Face_circulator fc(v[0]),done;
+    do *fit++ = fc++; while (fc!=done);
+  }
+  return;		
+}
+
+
+template < class Gt, class Tds >
+void
+Delaunay_triangulation_2<Gt,Tds>::
+remove(Vertex_handle v)
+{
+  int d;
+
+  CGAL_triangulation_precondition( v != Vertex_handle());
+  CGAL_triangulation_precondition( !this->is_infinite(v));
+
+  if ( this->dimension() <= 1) { Triangulation::remove(v); return; }
+
+  CGAL_STATIC_THREAD_LOCAL_VARIABLE(int, maxd,30);
+  CGAL_STATIC_THREAD_LOCAL_VARIABLE(std::vector<Face_handle> , f, maxd);
+  CGAL_STATIC_THREAD_LOCAL_VARIABLE(std::vector<int>, i, maxd);
+  CGAL_STATIC_THREAD_LOCAL_VARIABLE(std::vector<Vertex_handle>, w, maxd);
+
+  remove_degree_init(v,f,w,i,d,maxd);
+  if (d == 0) return; //  dim is going down
+  remove_degree_triangulate(v,f,w,i,d);
+  this->delete_vertex(v);
+}
+
+template < class Gt, class Tds >
+void
+Delaunay_triangulation_2<Gt,Tds>::
+remove_degree_init(Vertex_handle v, std::vector<Face_handle> &f,
+		   std::vector<Vertex_handle> &w, std::vector<int> &i,
+		   int &d, int &maxd)
+{
+  f[0] = v->face();d=0;
+  do{
+    i[d] = f[d]->index(v);
+    w[d] = f[d]->vertex( ccw(i[d]) );
+    if(this->is_infinite(w[d])) {
+      f[0] = f[d]; i[0]=i[d]; w[0]=w[d];
+      w[0]->set_face( f[0]->neighbor(i[0]));
+      f[1] = f[0]->neighbor( ccw(i[0]) );
+      i[1] = f[1]->index(v);
+      w[1] = f[1]->vertex( ccw(i[1]) );
+      if ( this->is_infinite( f[1]->neighbor( i[1] ) ) ){//otherwise dim remains 2
+	if ( this->test_dim_down(v) ) {
+	  d=0;
+	  this->tds().remove_dim_down(v);
+	  return; 
+	}
+      }
+      d=1;
+    }
+    w[d]->set_face( f[d]->neighbor(i[d]));//do no longer bother about set_face 
+    ++d;
+    if ( d==maxd) { maxd *=2; f.resize(maxd); w.resize(maxd); i.resize(maxd);}
+    f[d] = f[d-1]->neighbor( ccw(i[d-1]) );
+  } while(f[d]!=f[0]);
+  // all vertices finite but possibly w[0]
+}
+
+
+
+template < class Gt, class Tds >
+void
+Delaunay_triangulation_2<Gt,Tds>::
+remove_degree_triangulate(Vertex_handle v,
+                          std::vector<Face_handle> &f,
+                          std::vector<Vertex_handle> &w, 
+                          std::vector<int> &i,int d)
+{
+  switch (d) {
+  case 3:
+    remove_degree3(v,f,w,i);    break;
+  case 4:
+    remove_degree4(v,f,w,i);    break;
+  case 5:
+    remove_degree5(v,f,w,i);    break;
+  case 6:
+    remove_degree6(v,f,w,i);    break;
+  case 7:
+    remove_degree7(v,f,w,i);    break;
+  default:
+    remove_degree_d(v,f,w,i,d);    break;
+  }
+}
+
+template < class Gt, class Tds >
+void
+Delaunay_triangulation_2<Gt,Tds>::
+remove_degree_d(Vertex_handle v, std::vector<Face_handle> &,
+                std::vector<Vertex_handle> &, 
+                std::vector<int> &,int)
+{
+  // removing a degree d vertex, (dim is not going down)
+  // this is the old removal procedure that is used now only if d > 7
+
+    std::list<Edge> hole;
+    make_hole(v, hole);
+    fill_hole_delaunay(hole);
+    return;
+}
+
+template < class Gt, class Tds >
+void
+Delaunay_triangulation_2<Gt,Tds>::
+remove_degree3(Vertex_handle, std::vector<Face_handle> &f,
+	       std::vector<Vertex_handle> &, std::vector<int> &i)
+{
+  // removing a degree 3 vertex
+  // only w[0] can be infinite
+
+  // modify the triangulation
+  Face_handle nn= f[1]->neighbor( i[1] );
+  this->tds().set_adjacency(f[0], ccw(i[0]) , nn , nn->index(f[1])  );
+  nn= f[2]->neighbor( i[2] );
+  this->tds().set_adjacency(f[0], cw(i[0]) , nn , nn->index(f[2])  );
+  f[0]->set_vertex  (            i[0] , f[1]->vertex( cw(i[1]) ) );
+  
+  // clean container
+  this->tds().delete_face(f[1]);
+  this->tds().delete_face(f[2]);
+  
+  return;
+}
+
+template < class Gt, class Tds >
+void
+Delaunay_triangulation_2<Gt,Tds>::
+remove_degree4(Vertex_handle, std::vector<Face_handle> &f,
+	       std::vector<Vertex_handle> &w, std::vector<int> &i )
+{
+  // removing a degree 4 vertex
+  // only w[0] can be infinite
+
+  Face_handle nn;
+  // modify f[0] f[1] for incircle test
+  f[0]->set_vertex( i[0], w[3] ); //w0 w1 w3
+
+  if ( !test_conflict( w[2]->point(), f[0]) )  {
+    // diagonal 1 3
+    f[1]->set_vertex( i[1], w[3] ); //w1 w2 w3
+    nn = f[3]->neighbor( i[3] );
+    this->tds().set_adjacency(f[0], cw(i[0]) , nn , nn->index(f[3])  );
+    nn = f[2]->neighbor( i[2] );
+    this->tds().set_adjacency(f[1], ccw(i[1]) , nn , nn->index(f[2]) );
+    // clean container
+    this->tds().delete_face(f[2]);
+    this->tds().delete_face(f[3]);
+  }else{
+    // diagonal 0 2
+    f[0]->set_vertex( i[0], w[2]); //w0 w1 w2
+    f[3]->set_vertex( i[3], w[2]); //w3 w0 w2
+    nn = f[1]->neighbor( i[1] );
+    this->tds().set_adjacency(f[0], ccw(i[0]) , nn , nn->index(f[1])  );
+    nn = f[2]->neighbor( i[2] );
+    this->tds().set_adjacency(f[3], cw(i[3]) , nn , nn->index(f[2])  );
+    // clean container
+    this->tds().delete_face(f[1]);
+    this->tds().delete_face(f[2]);
+  }
+
+  return;
+}
+
+template < class Gt, class Tds >
+void
+Delaunay_triangulation_2<Gt,Tds>::
+remove_degree5(Vertex_handle v, std::vector<Face_handle> &f,
+	       std::vector<Vertex_handle> &w, std::vector<int> &i )
+{  
+  // removing a degree 5 vertex
+  // only w[0] can be infinite
+
+  if (incircle(3,0,1,2,f,w,i)) {
+    if (incircle(4,0,1,3,f,w,i)) {
+      if (incircle(4,1,2,3,f,w,i)) {
+	// star from 4
+	remove_degree5_star(v,f[4],f[0],f[1],f[2],f[3],
+			      w[4],w[0],w[1],w[2],w[3],
+			      i[4],i[0],i[1],i[2],i[3]);
+      }else{
+	//star from 1
+	remove_degree5_star(v,f[1],f[2],f[3],f[4],f[0],
+			      w[1],w[2],w[3],w[4],w[0],
+			      i[1],i[2],i[3],i[4],i[0]);
+			      
+			      
+      }
+    }else{
+      // star from 3
+      remove_degree5_star(v,f[3],f[4],f[0],f[1],f[2],
+			    w[3],w[4],w[0],w[1],w[2],
+			    i[3],i[4],i[0],i[1],i[2]);
+    }
+  } else {
+    if (incircle(4,2,3,0,f,w,i)){
+      if (incircle(4,0,1,2,f,w,i)){
+	// star from 4
+	remove_degree5_star(v,f[4],f[0],f[1],f[2],f[3],
+			      w[4],w[0],w[1],w[2],w[3],
+			      i[4],i[0],i[1],i[2],i[3]);
+      }else{
+	//star from 2
+	remove_degree5_star(v,f[2],f[3],f[4],f[0],f[1],
+			      w[2],w[3],w[4],w[0],w[1],
+			      i[2],i[3],i[4],i[0],i[1]);
+      }
+    }else{
+      // star from 0
+      remove_degree5_star(v,f[0],f[1],f[2],f[3],f[4],
+			    w[0],w[1],w[2],w[3],w[4],
+			    i[0],i[1],i[2],i[3],i[4]);
+    }
+  }
+  
+  return;
+}
+
+template < class Gt, class Tds >
+inline void
+Delaunay_triangulation_2<Gt,Tds>::remove_degree5_star
+(
+ Vertex_handle &,
+ Face_handle &  f0, Face_handle &  f1, Face_handle &  f2,
+ Face_handle &  f3, Face_handle &  f4,
+ Vertex_handle &v0, Vertex_handle &, Vertex_handle &,
+ Vertex_handle &, Vertex_handle &,
+ int i0, int i1, int i2, int i3, int i4 )
+{ // removing a degree 5 vertex, staring from v0
+  Face_handle nn;
+  f1->set_vertex( i1, v0) ;  // f1 = v1v2v0
+  f2->set_vertex( i2, v0) ;  // f2 = v2v3v0
+  f3->set_vertex( i3, v0) ;  // f3 = v3v4v0
+  nn = f0->neighbor( i0 );
+  this->tds().set_adjacency(f1, cw(i1) , nn , nn->index(f0) );
+  nn = f4->neighbor( i4 );
+  this->tds().set_adjacency(f3, ccw(i3) , nn , nn->index(f4) );
+  this->tds().delete_face(f0);
+  this->tds().delete_face(f4);
+}
+
+template < class Gt, class Tds >
+void
+Delaunay_triangulation_2<Gt,Tds>::
+remove_degree6(Vertex_handle v, std::vector<Face_handle> &f,
+		      std::vector<Vertex_handle> &w, std::vector<int> &i)
+{
+  // removing a degree 6 vertex
+  // only w[0] can be infinite
+
+  if(incircle(1,2,3,0,f,w,i)){
+    if(incircle(4,2,3,5,f,w,i)){
+      if(incircle(1,2,3,4,f,w,i)){
+	if(incircle(4,0,1,3,f,w,i)){
+	  if(incircle(5,0,1,4,f,w,i)){
+	    remove_degree6_star(v,f[1],f[2],f[3],f[4],f[5],f[0],
+				w[1],w[2],w[3],w[4],w[5],w[0],
+				i[1],i[2],i[3],i[4],i[5],i[0]);
+	  }else{
+	    remove_degree6_N(v,f[1],f[2],f[3],f[4],f[5],f[0],
+				w[1],w[2],w[3],w[4],w[5],w[0],
+				i[1],i[2],i[3],i[4],i[5],i[0]);
+	  }}else{
+	  remove_degree6_antiN(v,f[0],f[1],f[2],f[3],f[4],f[5],
+			       w[0],w[1],w[2],w[3],w[4],w[5],
+			       i[0],i[1],i[2],i[3],i[4],i[5]);
+	}}else{
+	if(incircle(5,1,2,4,f,w,i)){
+	  remove_degree6_N(v,f[2],f[3],f[4],f[5],f[0],f[1],
+			   w[2],w[3],w[4],w[5],w[0],w[1],
+			   i[2],i[3],i[4],i[5],i[0],i[1]);
+	}else{
+	  if(incircle(5,0,1,4,f,w,i)){
+	    remove_degree6_antiN(v,f[1],f[2],f[3],f[4],f[5],f[0],
+				w[1],w[2],w[3],w[4],w[5],w[0],
+				i[1],i[2],i[3],i[4],i[5],i[0]);
+	  }else{
+	    remove_degree6_star(v,f[4],f[5],f[0],f[1],f[2],f[3],
+				w[4],w[5],w[0],w[1],w[2],w[3],
+				i[4],i[5],i[0],i[1],i[2],i[3]);
+	  }}}}else{
+      if(incircle(1,2,3,5,f,w,i)){
+	if(incircle(1,3,4,5,f,w,i)){
+	  if(incircle(4,0,1,3,f,w,i)){
+	    if(incircle(5,0,1,4,f,w,i)){
+	    remove_degree6_star(v,f[1],f[2],f[3],f[4],f[5],f[0],
+				w[1],w[2],w[3],w[4],w[5],w[0],
+				i[1],i[2],i[3],i[4],i[5],i[0]);
+	    }else{
+	    remove_degree6_N(v,f[1],f[2],f[3],f[4],f[5],f[0],
+				w[1],w[2],w[3],w[4],w[5],w[0],
+				i[1],i[2],i[3],i[4],i[5],i[0]);
+	    }}else{
+	  remove_degree6_antiN(v,f[0],f[1],f[2],f[3],f[4],f[5],
+			       w[0],w[1],w[2],w[3],w[4],w[5],
+			       i[0],i[1],i[2],i[3],i[4],i[5]);
+	  }}else{
+	  if(incircle(5,0,1,3,f,w,i)){
+	    remove_degree6_diamond(v,f[1],f[2],f[3],f[4],f[5],f[0],
+				w[1],w[2],w[3],w[4],w[5],w[0],
+				i[1],i[2],i[3],i[4],i[5],i[0]);
+	  }else{
+	    if(incircle(4,5,0,3,f,w,i)){
+	  remove_degree6_antiN(v,f[0],f[1],f[2],f[3],f[4],f[5],
+			       w[0],w[1],w[2],w[3],w[4],w[5],
+			       i[0],i[1],i[2],i[3],i[4],i[5]);
+	    }else{
+	    remove_degree6_star(v,f[3],f[4],f[5],f[0],f[1],f[2],
+				w[3],w[4],w[5],w[0],w[1],w[2],
+				i[3],i[4],i[5],i[0],i[1],i[2]);
+	    }}}}else{
+	    remove_degree6_star(v,f[5],f[0],f[1],f[2],f[3],f[4],
+				w[5],w[0],w[1],w[2],w[3],w[4],
+				i[5],i[0],i[1],i[2],i[3],i[4]);
+      }}}else{
+    if(incircle(4,2,3,5,f,w,i)){
+      if(incircle(4,2,3,0,f,w,i)){
+	if(incircle(4,0,1,2,f,w,i)){
+	  if(incircle(4,1,2,5,f,w,i)){
+	    if(incircle(4,0,1,5,f,w,i)){
+	    remove_degree6_star(v,f[4],f[5],f[0],f[1],f[2],f[3],
+				w[4],w[5],w[0],w[1],w[2],w[3],
+				i[4],i[5],i[0],i[1],i[2],i[3]);
+	    }else{
+	    remove_degree6_antiN(v,f[1],f[2],f[3],f[4],f[5],f[0],
+				w[1],w[2],w[3],w[4],w[5],w[0],
+				i[1],i[2],i[3],i[4],i[5],i[0]);
+	    }}else{
+	  remove_degree6_N(v,f[2],f[3],f[4],f[5],f[0],f[1],
+			   w[2],w[3],w[4],w[5],w[0],w[1],
+			   i[2],i[3],i[4],i[5],i[0],i[1]);
+	  }}else{
+	  if(incircle(4,5,0,2,f,w,i)){
+	  remove_degree6_diamond(v,f[0],f[1],f[2],f[3],f[4],f[5],
+			       w[0],w[1],w[2],w[3],w[4],w[5],
+			       i[0],i[1],i[2],i[3],i[4],i[5]);
+	  }else{
+	    if(incircle(5,0,1,2,f,w,i)){
+	  remove_degree6_N(v,f[2],f[3],f[4],f[5],f[0],f[1],
+			   w[2],w[3],w[4],w[5],w[0],w[1],
+			   i[2],i[3],i[4],i[5],i[0],i[1]);
+	    }else{
+	  remove_degree6_star(v,f[2],f[3],f[4],f[5],f[0],f[1],
+			   w[2],w[3],w[4],w[5],w[0],w[1],
+			   i[2],i[3],i[4],i[5],i[0],i[1]);
+	    }}}}else{
+	  remove_degree6_star(v,f[0],f[1],f[2],f[3],f[4],f[5],
+			       w[0],w[1],w[2],w[3],w[4],w[5],
+			       i[0],i[1],i[2],i[3],i[4],i[5]);
+      }}else{
+      if(incircle(5,2,3,0,f,w,i)){
+	if(incircle(5,0,1,2,f,w,i)){
+	  remove_degree6_star(v,f[5],f[0],f[1],f[2],f[3],f[4],
+			       w[5],w[0],w[1],w[2],w[3],w[4],
+			      i[5],i[0],i[1],i[2],i[3],i[4]);
+	}else{
+	  remove_degree6_antiN(v,f[2],f[3],f[4],f[5],f[0],f[1],
+			   w[2],w[3],w[4],w[5],w[0],w[1],
+			   i[2],i[3],i[4],i[5],i[0],i[1]);
+	}}else{
+	  if(incircle(4,5,0,3,f,w,i)){
+	  remove_degree6_star(v,f[0],f[1],f[2],f[3],f[4],f[5],
+			       w[0],w[1],w[2],w[3],w[4],w[5],
+			       i[0],i[1],i[2],i[3],i[4],i[5]);
+	  }else{
+	  remove_degree6_N(v,f[0],f[1],f[2],f[3],f[4],f[5],
+			       w[0],w[1],w[2],w[3],w[4],w[5],
+			       i[0],i[1],i[2],i[3],i[4],i[5]);
+	  }}}}
+}
+
+template < class Gt, class Tds >
+inline void
+Delaunay_triangulation_2<Gt,Tds>::remove_degree6_star
+(
+ Vertex_handle &,
+ Face_handle &  f0, Face_handle &  f1, Face_handle &  f2,
+ Face_handle &  f3, Face_handle &  f4, Face_handle &  f5,
+ Vertex_handle &v0, Vertex_handle &, Vertex_handle &,
+ Vertex_handle &, Vertex_handle &, Vertex_handle &,
+ int i0, int i1, int i2, int i3, int i4, int i5 )
+{ // removing a degree 6 vertex, staring from v0
+  Face_handle nn;
+  f1->set_vertex( i1, v0) ;  // f1 = v1v2v0
+  f2->set_vertex( i2, v0) ;  // f2 = v2v3v0
+  f3->set_vertex( i3, v0) ;  // f3 = v3v4v0
+  f4->set_vertex( i4, v0) ;  // f4 = v4v5v0
+  nn = f0->neighbor( i0 );
+  this->tds().set_adjacency(f1, cw(i1), nn, nn->index(f0));
+  nn = f5->neighbor( i5 );
+  this->tds().set_adjacency(f4, ccw(i4), nn,  nn->index(f5));
+  this->tds().delete_face(f0);
+  this->tds().delete_face(f5);
+}
+
+template < class Gt, class Tds >
+inline void
+Delaunay_triangulation_2<Gt,Tds>::remove_degree6_N
+(
+ Vertex_handle &,
+ Face_handle &  f0, Face_handle &  f1, Face_handle &  f2,
+ Face_handle &  f3, Face_handle &  f4, Face_handle &  f5,
+ Vertex_handle &v0, Vertex_handle &, Vertex_handle &,
+ Vertex_handle &v3, Vertex_handle &, Vertex_handle &,
+ int i0, int i1, int i2, int i3, int i4, int i5 )
+{ // removing a degree 6 vertex, N configuration with diagonal v0v3
+  Face_handle nn;
+  f1->set_vertex( i1, v0) ;  // f1 = v1v2v0
+  f2->set_vertex( i2, v0) ;  // f2 = v2v3v0
+  f4->set_vertex( i4, v3) ;  // f4 = v4v5v3
+  f5->set_vertex( i5, v3) ;  // f5 = v5v0v3
+  nn = f0->neighbor( i0 );
+  this->tds().set_adjacency(f1, cw(i1) , nn , nn->index(f0)  );
+  nn = f3->neighbor( i3 );
+  this->tds().set_adjacency(f4, cw(i4) , nn, nn->index(f3) );
+  this->tds().set_adjacency(f2, ccw(i2) , f5 , ccw(i5)  );
+  this->tds().delete_face(f0);
+  this->tds().delete_face(f3);
+}
+
+template < class Gt, class Tds >
+inline void
+Delaunay_triangulation_2<Gt,Tds>::remove_degree6_antiN
+(
+ Vertex_handle &,
+ Face_handle &  f0, Face_handle &  f1, Face_handle &  f2,
+ Face_handle &  f3, Face_handle &  f4, Face_handle &  f5,
+ Vertex_handle &v0, Vertex_handle &, Vertex_handle &,
+ Vertex_handle &v3, Vertex_handle &, Vertex_handle &,
+ int i0, int i1, int i2, int i3, int i4, int i5 )
+{ // removing a degree 6 vertex, antiN configuration with diagonal v0v3
+  Face_handle nn;
+  f0->set_vertex( i0, v3) ;  // f0 = v0v1v3
+  f1->set_vertex( i1, v3) ;  // f1 = v1v2v3
+  f3->set_vertex( i3, v0) ;  // f3 = v3v4v0
+  f4->set_vertex( i4, v0) ;  // f4 = v4v5v0
+  nn = f2->neighbor( i2 );
+  this->tds().set_adjacency(f1, ccw(i1) , nn , nn->index(f2)  );
+  nn = f5->neighbor( i5 );
+  this->tds().set_adjacency(f4, ccw(i4) , nn , nn->index(f5) );
+  this->tds().set_adjacency(f0, cw(i0) , f3, cw(i3) );
+  this->tds().delete_face(f2);
+  this->tds().delete_face(f5);
+}
+
+template < class Gt, class Tds >
+inline void
+Delaunay_triangulation_2<Gt,Tds>::remove_degree6_diamond
+(
+ Vertex_handle &,
+ Face_handle &  f0, Face_handle &  f1, Face_handle &  f2,
+ Face_handle &  f3, Face_handle &  f4, Face_handle &  f5,
+ Vertex_handle &v0, Vertex_handle &, Vertex_handle &v2,
+ Vertex_handle &, Vertex_handle &v4, Vertex_handle &,
+ int i0, int i1, int i2, int i3, int i4, int i5 )
+{ // removing a degree 6 vertex, with chords v0v2 v2v4 v4v0
+  Face_handle nn;
+  f0->set_vertex( i0, v2) ;  // f0 = v0v1v2
+  f2->set_vertex( i2, v4) ;  // f2 = v2v3v4
+  f4->set_vertex( i4, v0) ;  // f4 = v4v5v0
+  f1->set_vertex( i1, v4) ; 
+  f1->set_vertex( ccw(i1), v0) ;  // f1 = v0v2v4
+  nn = f1->neighbor( i1 );
+  this->tds().set_adjacency(f0, ccw(i0) , nn , nn->index(f1) );
+  nn = f3->neighbor( i3 );
+  this->tds().set_adjacency(f2, ccw(i2) , nn , nn->index(f3) );
+  nn = f5->neighbor( i5 );
+  this->tds().set_adjacency(f4, ccw(i4) , nn , nn->index(f5) );
+  this->tds().set_adjacency(f0, cw(i0) , f1 , i1  );
+  this->tds().set_adjacency(f4, cw(i4) , f1 , cw(i1) );
+
+  this->tds().delete_face(f3);
+  this->tds().delete_face(f5);
+}
+
+
+template < class Gt, class Tds >
+void
+Delaunay_triangulation_2<Gt,Tds>::
+remove_degree7(Vertex_handle v,std::vector<Face_handle> &f,
+		      std::vector<Vertex_handle> &w, std::vector<int> &i)
+{ 
+  // removing a degree 7 vertex
+  // only w[0] can be infinite
+
+  if (incircle(2,0,1,3,f,w,i)) { // sweeping from above
+    if (incircle(2,3,4,0,f,w,i)) {
+      if (incircle(5,3,4,6,f,w,i)) {
+	if (incircle(5,3,4,2,f,w,i)) {
+	  if (incircle(6,2,3,5,f,w,i)) {
+	    if (incircle(6,0,1,2,f,w,i)) {
+	      remove_degree7_leftfan(v,  6  ,f,w,i);
+	    }else{
+	      remove_degree7_zigzag(v,  6  ,f,w,i);
+	    }}else{
+	    if (incircle(5,0,1,2,f,w,i)) {
+	      if (incircle(6,1,2,5,f,w,i)) {
+		remove_degree7_zigzag(v, 2   ,f,w,i);
+	      }else{
+		if (incircle(6,0,1,5,f,w,i)) {
+		  remove_degree7_rightfan(v, 5   ,f,w,i);
+		}else{
+		  remove_degree7_star(v,  5  ,f,w,i);
+		}}}else{
+	      if (incircle(2,5,6,0,f,w,i)) {
+		if (incircle(6,0,1,2,f,w,i)) {
+		  remove_degree7_zigzag(v,  2  ,f,w,i);
+		}else{
+		  remove_degree7_rightfan(v,  2  ,f,w,i);
+		}}else{
+		remove_degree7_rightdelta(v,  5  ,f,w,i);
+	      }}}}else{
+	  if (incircle(4,0,1,2,f,w,i)) {
+	    if (incircle(5,1,2,4,f,w,i)) {
+	      if (incircle(6,1,2,5,f,w,i)) {
+		remove_degree7_leftfan(v,  2  ,f,w,i);
+	      }else{
+		if (incircle(6,0,1,5,f,w,i)) {
+		  remove_degree7_zigzag(v,  5  ,f,w,i);
+		}else{
+		  remove_degree7_leftfan(v,  5  ,f,w,i);
+		}}}else{
+	      if (incircle(5,0,1,4,f,w,i)) {
+		if (incircle(6,0,1,5,f,w,i)) {
+		  remove_degree7_rightfan(v,  1  ,f,w,i);
+		}else{
+		  remove_degree7_zigzag(v,  1  ,f,w,i);
+		}}else{
+		remove_degree7_rightfan(v,  4  ,f,w,i);
+	      }}}else{
+	    if (incircle(2,4,5,0,f,w,i)) {
+	      if (incircle(5,0,1,2,f,w,i)) {
+		if (incircle(6,1,2,5,f,w,i)) {
+		  remove_degree7_leftfan(v,  2  ,f,w,i);
+		}else{
+		  if (incircle(6,0,1,5,f,w,i)) {
+		    remove_degree7_zigzag(v,  5  ,f,w,i);
+		  }else{
+		    remove_degree7_leftfan(v,  5  ,f,w,i);
+		  }}}else{
+		if (incircle(2,5,6,0,f,w,i)) {
+		  if (incircle(6,0,1,2,f,w,i)) {
+		    remove_degree7_leftfan(v,  2  ,f,w,i);
+		  }else{
+		    remove_degree7_star(v,  2  ,f,w,i);
+		  }}else{
+		  remove_degree7_leftdelta(v,  2  ,f,w,i);
+		}}}else{
+	      remove_degree7_rightdelta(v,  0  ,f,w,i);
+	    }}}}else{
+	if (incircle(6,3,4,2,f,w,i)) {
+	  if (incircle(6,0,1,2,f,w,i)) {
+	    remove_degree7_star(v,  6  ,f,w,i);
+	  }else{
+	    remove_degree7_rightfan(v,  6  ,f,w,i);
+	  }}else{
+	  if (incircle(4,0,1,2,f,w,i)) {
+	    if (incircle(2,4,5,6,f,w,i)) {
+	      if (incircle(5,1,2,4,f,w,i)) {
+		if (incircle(6,1,2,5,f,w,i)) {
+		  remove_degree7_leftfan(v,  2  ,f,w,i);
+		}else{
+		  if (incircle(6,0,1,5,f,w,i)) {
+		    remove_degree7_zigzag(v,  5  ,f,w,i);
+		  }else{
+		    remove_degree7_leftfan(v,  5  ,f,w,i);
+		  }}}else{
+		if (incircle(5,0,1,4,f,w,i)) {
+		  if (incircle(6,0,1,5,f,w,i)) {
+		    remove_degree7_rightfan(v,  1  ,f,w,i);
+		  }else{
+		    remove_degree7_zigzag(v,  1  ,f,w,i);
+		  }} else{
+		  remove_degree7_rightfan(v,  4  ,f,w,i);
+		}}} else {
+	      if (incircle(6,1,2,4,f,w,i)) {
+		remove_degree7_leftdelta(v,  6  ,f,w,i);
+	      }else{
+		if (incircle(1,4,5,6,f,w,i)) {
+		  if (incircle(1,4,5,0,f,w,i)) {
+		    if (incircle(6,0,1,5,f,w,i)) {
+		      remove_degree7_rightfan(v,  1  ,f,w,i);
+		    }else{
+		      remove_degree7_zigzag(v,  1  ,f,w,i);
+		    }}else{
+		    remove_degree7_rightfan(v,  4  ,f,w,i);
+		  }} else {
+		  if (incircle(6,0,1,4,f,w,i)) {
+		    remove_degree7_rightdelta(v,  4  ,f,w,i);
+		  }else{
+		    if (incircle(6,4,5,0,f,w,i)) {
+		      remove_degree7_star(v,  4  ,f,w,i);
+		    }else{
+		      remove_degree7_rightfan(v,  4  ,f,w,i);
+		    }}}}}}else{
+	    if (incircle(2,4,5,6,f,w,i)) {
+	      if (incircle(2,4,5,0,f,w,i)) {
+		if (incircle(5,0,1,2,f,w,i)) {
+		  if (incircle(6,1,2,5,f,w,i)) {
+		    remove_degree7_leftfan(v,  2  ,f,w,i);
+		  }else{
+		    if (incircle(6,0,1,5,f,w,i)) {
+		      remove_degree7_zigzag(v,  5  ,f,w,i);
+		    }else{
+		      remove_degree7_leftfan(v,  5  ,f,w,i);
+		    }}}else{
+		  if (incircle(2,5,6,0,f,w,i)) {
+		    if (incircle(6,0,1,2,f,w,i)) {
+		      remove_degree7_leftfan(v,  2  ,f,w,i);
+		    }else{
+		      remove_degree7_star(v,  2  ,f,w,i);
+		    }}else{
+		    remove_degree7_leftdelta(v,  2  ,f,w,i);
+		  }}}else{
+		remove_degree7_rightdelta(v,  0  ,f,w,i);
+	      }}else{
+	      if (incircle(2,6,0,4,f,w,i)) {
+		if (incircle(6,0,1,2,f,w,i)) {
+		  remove_degree7_leftdelta(v,  6  ,f,w,i);
+		}else{
+		  remove_degree7_rightdelta(v,  2  ,f,w,i);
+		}}else{
+		if (incircle(6,4,5,0,f,w,i)) {
+		  remove_degree7_leftdelta(v,  4  ,f,w,i);
+		}else{
+		  remove_degree7_rightdelta(v,  0  ,f,w,i);
+		}}}}}}} else{
+      if (incircle(5,3,4,6,f,w,i)) {
+	if (incircle(5,3,4,0,f,w,i)) {
+	  if (incircle(5,2,3,0,f,w,i)) {
+	    if (incircle(6,2,3,5,f,w,i)) {
+	      if (incircle(6,0,1,2,f,w,i)) {
+		remove_degree7_leftfan(v,  6  ,f,w,i);
+	      }else{
+		remove_degree7_zigzag(v,  6  ,f,w,i);
+	      }}else
+	      if (incircle(5,0,1,2,f,w,i)) {
+	  	if (incircle(6,1,2,5,f,w,i)) {
+		  remove_degree7_zigzag(v,  2  ,f,w,i);
+		}else{
+		  if (incircle(6,0,1,5,f,w,i)) {
+		    remove_degree7_rightfan(v,  5  ,f,w,i);
+		  }else{
+		    remove_degree7_star(v,  5  ,f,w,i);
+		  }}}else{
+		if (incircle(2,5,6,0,f,w,i)) {
+		  if (incircle(6,0,1,2,f,w,i)) {
+		    remove_degree7_zigzag(v,  2  ,f,w,i);
+		  }else{
+		    remove_degree7_rightfan(v,  2  ,f,w,i);
+		  }}else{
+		  remove_degree7_rightdelta(v,  5  ,f,w,i);
+		}}}else{
+	    if (incircle(3,5,6,0,f,w,i)) {
+	      if (incircle(6,2,3,0,f,w,i)) {
+		if (incircle(6,0,1,2,f,w,i)) {
+		  remove_degree7_leftfan(v,  6  ,f,w,i);
+		}else{
+		  remove_degree7_zigzag(v,  6  ,f,w,i);
+		}}else{
+		remove_degree7_leftfan(v,  3  ,f,w,i);
+	      }}else{
+	      remove_degree7_leftdelta(v,  0  ,f,w,i);
+	    }}}else{
+	  remove_degree7_star(v,  0  ,f,w,i);
+	}}else{
+	if (incircle(6,3,4,0,f,w,i)) {
+	  if (incircle(6,2,3,0,f,w,i)) {
+	    if (incircle(6,0,1,2,f,w,i)) {
+	      remove_degree7_star(v,  6  ,f,w,i);
+	    }else{
+	      remove_degree7_rightfan(v,  6  ,f,w,i);
+	    }}else{
+	    remove_degree7_zigzag(v,  3  ,f,w,i);
+	  }}else{
+	  if (incircle(6,4,5,0,f,w,i)) {
+	    remove_degree7_leftfan(v,  0  ,f,w,i);
+	  }else{
+	    remove_degree7_star(v,  0  ,f,w,i);
+	  }}}}}else{  //sweeping from below
+    if (incircle(1,6,0,3,f,w,i)) {
+      if (incircle(5,6,0,4,f,w,i)) {
+	if (incircle(5,6,0,1,f,w,i)) {
+	  if (incircle(4,0,1,5,f,w,i)) {
+	    if (incircle(4,2,3,1,f,w,i)) {
+	      remove_degree7_rightfan(v,  4  ,f,w,i);
+	    }else{
+	      remove_degree7_zigzag(v,  4  ,f,w,i);
+	    }}else{
+	    if (incircle(5,2,3,1,f,w,i)) {
+	      if (incircle(4,1,2,5,f,w,i)) {
+		remove_degree7_zigzag(v, 1   ,f,w,i);
+	      }else{
+		if (incircle(4,2,3,5,f,w,i)) {
+		  remove_degree7_leftfan(v, 5   ,f,w,i);
+		}else{
+		  remove_degree7_star(v,  5  ,f,w,i);
+		}}}else{
+	      if (incircle(1,4,5,3,f,w,i)) {
+		if (incircle(4,2,3,1,f,w,i)) {
+		  remove_degree7_zigzag(v,  1  ,f,w,i);
+		}else{
+		  remove_degree7_leftfan(v,  1  ,f,w,i);
+		}}else{
+		remove_degree7_leftdelta(v,  5  ,f,w,i);
+	      }}}}else{
+	  if (incircle(6,2,3,1,f,w,i)) {
+	    if (incircle(5,1,2,6,f,w,i)) {
+	      if (incircle(4,1,2,5,f,w,i)) {
+		remove_degree7_rightfan(v,  1  ,f,w,i);
+	      }else{
+		if (incircle(4,2,3,5,f,w,i)) {
+		  remove_degree7_zigzag(v,  5  ,f,w,i);
+		}else{
+		  remove_degree7_rightfan(v,  5  ,f,w,i);
+		}}}else{
+	      if (incircle(5,2,3,6,f,w,i)) {
+		if (incircle(4,2,3,5,f,w,i)) {
+		  remove_degree7_leftfan(v,  2  ,f,w,i);
+		}else{
+		  remove_degree7_zigzag(v,  2  ,f,w,i);
+		}}else{
+		remove_degree7_leftfan(v,  6  ,f,w,i);
+	      }}}else{
+	    if (incircle(1,5,6,3,f,w,i)) {
+	      if (incircle(5,2,3,1,f,w,i)) {
+		if (incircle(4,1,2,5,f,w,i)) {
+		  remove_degree7_rightfan(v,  1  ,f,w,i);
+		}else{
+		  if (incircle(4,2,3,5,f,w,i)) {
+		    remove_degree7_zigzag(v,  5  ,f,w,i);
+		  }else{
+		    remove_degree7_rightfan(v,  5  ,f,w,i);
+		  }}}else{
+		if (incircle(1,4,5,3,f,w,i)) {
+		  if (incircle(4,2,3,1,f,w,i)) {
+		    remove_degree7_rightfan(v,  1  ,f,w,i);
+		  }else{
+		    remove_degree7_star(v,  1  ,f,w,i);
+		  }}else{
+		  remove_degree7_rightdelta(v,  1  ,f,w,i);
+		}}}else{
+	      remove_degree7_leftdelta(v,  3  ,f,w,i);
+	    }}}}else{
+	if (incircle(4,6,0,1,f,w,i)) {
+	  if (incircle(4,2,3,1,f,w,i)) {
+	    remove_degree7_star(v,  4  ,f,w,i);
+	  }else{
+	    remove_degree7_leftfan(v,  4  ,f,w,i);
+	  }}else{
+	  if (incircle(6,2,3,1,f,w,i)) {
+	    if (incircle(1,5,6,4,f,w,i)) {
+	      if (incircle(5,1,2,6,f,w,i)) {
+		if (incircle(4,1,2,5,f,w,i)) {
+		  remove_degree7_rightfan(v,  1  ,f,w,i);
+		}else{
+		  if (incircle(4,2,3,5,f,w,i)) {
+		    remove_degree7_zigzag(v,  5  ,f,w,i);
+		  }else{
+		    remove_degree7_rightfan(v,  5  ,f,w,i);
+		  }}}else{
+		if (incircle(5,2,3,6,f,w,i)) {
+		  if (incircle(4,2,3,5,f,w,i)) {
+		    remove_degree7_leftfan(v,  2  ,f,w,i);
+		  }else{
+		    remove_degree7_zigzag(v,  2  ,f,w,i);
+		  }} else{
+		  remove_degree7_leftfan(v,  6  ,f,w,i);
+		}}} else {
+	      if (incircle(4,1,2,6,f,w,i)) {
+		remove_degree7_rightdelta(v,  4  ,f,w,i);
+	      }else{
+		if (incircle(2,5,6,4,f,w,i)) {
+		  if (incircle(2,5,6,3,f,w,i)) {
+		    if (incircle(4,2,3,5,f,w,i)) {
+		      remove_degree7_leftfan(v,  2  ,f,w,i);
+		    }else{
+		      remove_degree7_zigzag(v,  2  ,f,w,i);
+		    }}else{
+		    remove_degree7_leftfan(v,  6  ,f,w,i);
+		  }} else {
+		  if (incircle(4,2,3,6,f,w,i)) {
+		    remove_degree7_leftdelta(v,  6  ,f,w,i);
+		  }else{
+		    if (incircle(4,5,6,3,f,w,i)) {
+		      remove_degree7_star(v,  6  ,f,w,i);
+		    }else{
+		      remove_degree7_leftfan(v,  6  ,f,w,i);
+		    }}}}}}else{
+	    if (incircle(1,5,6,4,f,w,i)) {
+	      if (incircle(1,5,6,3,f,w,i)) {
+		if (incircle(5,2,3,1,f,w,i)) {
+		  if (incircle(4,1,2,5,f,w,i)) {
+		    remove_degree7_rightfan(v,  1  ,f,w,i);
+		  }else{
+		    if (incircle(4,2,3,5,f,w,i)) {
+		      remove_degree7_zigzag(v,  5  ,f,w,i);
+		    }else{
+		      remove_degree7_rightfan(v,  5  ,f,w,i);
+		    }}}else{
+		  if (incircle(1,4,5,3,f,w,i)) {
+		    if (incircle(4,2,3,1,f,w,i)) {
+		      remove_degree7_rightfan(v,  1  ,f,w,i);
+		    }else{
+		      remove_degree7_star(v,  1  ,f,w,i);
+		    }}else{
+		    remove_degree7_rightdelta(v,  1  ,f,w,i);
+		  }}}else{
+		remove_degree7_leftdelta(v,  3  ,f,w,i);
+	      }}else{
+	      if (incircle(1,3,4,6,f,w,i)) {
+		if (incircle(4,2,3,1,f,w,i)) {
+		  remove_degree7_rightdelta(v,  4  ,f,w,i);
+		}else{
+		  remove_degree7_leftdelta(v,  1  ,f,w,i);
+		}}else{
+		if (incircle(4,5,6,3,f,w,i)) {
+		  remove_degree7_rightdelta(v,  6  ,f,w,i);
+		}else{
+		  remove_degree7_leftdelta(v,  3  ,f,w,i);
+		}}}}}}} else{
+      if (incircle(5,6,0,4,f,w,i)) {
+	if (incircle(5,6,0,3,f,w,i)) {
+	  if (incircle(5,0,1,3,f,w,i)) {
+	    if (incircle(4,0,1,5,f,w,i)) {
+	      if (incircle(4,2,3,1,f,w,i)) {
+		remove_degree7_rightfan(v,  4  ,f,w,i);
+	      }else{
+		remove_degree7_zigzag(v,  4  ,f,w,i);
+	      }}else
+	      if (incircle(5,2,3,1,f,w,i)) {
+	  	if (incircle(4,1,2,5,f,w,i)) {
+		  remove_degree7_zigzag(v,  1  ,f,w,i);
+		}else{
+		  if (incircle(4,2,3,5,f,w,i)) {
+		    remove_degree7_leftfan(v,  5  ,f,w,i);
+		  }else{
+		    remove_degree7_star(v,  5  ,f,w,i);
+		  }}}else{
+		if (incircle(1,4,5,3,f,w,i)) {
+		  if (incircle(4,2,3,1,f,w,i)) {
+		    remove_degree7_zigzag(v,  1  ,f,w,i);
+		  }else{
+		    remove_degree7_leftfan(v,  1  ,f,w,i);
+		  }}else{
+		  remove_degree7_leftdelta(v,  5  ,f,w,i);
+		}}}else{
+	    if (! incircle(3,4,5,0,f,w,i)) {
+	      if (incircle(4,0,1,3,f,w,i)) {
+		if (incircle(4,2,3,1,f,w,i)) {
+		  remove_degree7_rightfan(v,  4  ,f,w,i);
+		}else{
+		  remove_degree7_zigzag(v,  4  ,f,w,i);
+		}}else{
+		remove_degree7_rightfan(v,  0  ,f,w,i);
+	      }}else{
+	      remove_degree7_rightdelta(v,  3  ,f,w,i);
+	    }}}else{
+	  remove_degree7_star(v,  3  ,f,w,i);
+	}}else{
+	if (incircle(4,6,0,3,f,w,i)) {
+	  if (incircle(4,0,1,3,f,w,i)) {
+	    if (incircle(4,2,3,1,f,w,i)) {
+	      remove_degree7_star(v,  4  ,f,w,i);
+	    }else{
+	      remove_degree7_leftfan(v,  4  ,f,w,i);
+	    }}else{
+	    remove_degree7_zigzag(v,  0  ,f,w,i);
+	  }}else{
+	  if (incircle(4,5,6,3,f,w,i)) {
+	    remove_degree7_rightfan(v,  3  ,f,w,i);
+	  }else{
+	    remove_degree7_star(v,  3  ,f,w,i);    
+	  }}}}}
+}
+
+
+
+template < class Gt, class Tds >
+inline void
+Delaunay_triangulation_2<Gt,Tds>::
+rotate7(int j,  std::vector<Vertex_handle> &w, 
+	       std::vector<Face_handle> &f, std::vector<int> &i)
+{
+  if (j==0) return;
+  Face_handle ff=f[0];
+  int ii=i[0],k=0,kk=(6*j)%7;
+  Vertex_handle ww=w[0];
+  for (int jj=0; k!=kk; jj=k) { // 7 is prime
+    k=(jj+j)%7;
+    w[jj]=w[k]; f[jj]=f[k]; i[jj]=i[k];
+  }
+  w[kk]=ww;f[kk]=ff;i[kk]=ii;
+}
+
+template < class Gt, class Tds >
+inline void
+Delaunay_triangulation_2<Gt,Tds>::
+remove_degree7_star   (Vertex_handle &, int j,
+std::vector<Face_handle> &f, std::vector<Vertex_handle> &w, std::vector<int> &i)
+{ // removing a degree 7 vertex, staring from w[j]
+
+  rotate7(j,w,f,i);
+
+  Face_handle nn;
+  f[1]->set_vertex( i[1], w[0]) ;  // f1 = w1w2w0
+  f[2]->set_vertex( i[2], w[0]) ;  // f2 = w2w3w0
+  f[3]->set_vertex( i[3], w[0]) ;  // f3 = w3w4w0
+  f[4]->set_vertex( i[4], w[0]) ;  // f4 = w4w5w0
+  f[5]->set_vertex( i[5], w[0]) ;  // f5 = w5w6w0
+
+  nn = f[0]->neighbor( i[0] );
+  this->tds().set_adjacency(f[1], cw(i[1]) , nn , nn->index(f[0])  );
+  nn = f[6]->neighbor( i[6] );
+  this->tds().set_adjacency(f[5], ccw(i[5]) , nn , nn->index(f[6]) );
+  this->tds().delete_face(f[0]);
+  this->tds().delete_face(f[6]);
+}
+template < class Gt, class Tds >
+inline void
+Delaunay_triangulation_2<Gt,Tds>::
+remove_degree7_zigzag (Vertex_handle &, int j,
+ std::vector<Face_handle> &f,std::vector<Vertex_handle> &w, std::vector<int> &i)
+{ // removing a degree 7 vertex, zigzag, w[j] = middle point
+
+ rotate7(j,w,f,i);
+
+  Face_handle nn;
+  f[1]->set_vertex(    i[1] , w[3]) ;  // f1 = w1w2w3
+  f[2]->set_vertex(ccw(i[2]), w[1]) ;  
+  f[2]->set_vertex(    i[2] , w[0]) ;  // f2 = w1w3w0
+  f[3]->set_vertex(    i[3] , w[0]) ;  // f3 = w3w4w0
+  f[4]->set_vertex( cw(i[4]), w[6]) ;  
+  f[4]->set_vertex(    i[4] , w[0]) ;  // f4 = w4w6w0
+  f[5]->set_vertex(    i[5] , w[4]) ;  // f5 = w5w6w4
+
+  nn = f[2]->neighbor( i[2] );
+  this->tds().set_adjacency(f[1], ccw(i[1]) , nn, nn->index(f[2]) );
+  nn = f[0]->neighbor( i[0] );
+  this->tds().set_adjacency(f[2], cw(i[2]) , nn , nn->index(f[0]) );
+  nn = f[6]->neighbor( i[6] );
+  this->tds().set_adjacency(f[4], ccw(i[4]) , nn , nn->index(f[6])  );
+  nn = f[4]->neighbor( i[4] );
+  this->tds().set_adjacency(f[5], cw(i[5]) , nn , nn->index(f[4])  );
+  this->tds().set_adjacency(f[1], cw(i[1]) , f[2] , i[2]   );
+  this->tds().set_adjacency(f[4], i[4]  , f[5] , ccw(i[5])  );
+
+  this->tds().delete_face(f[0]);
+  this->tds().delete_face(f[6]);
+}
+template < class Gt, class Tds >
+inline void
+Delaunay_triangulation_2<Gt,Tds>::
+remove_degree7_leftdelta(Vertex_handle &, int j,
+ std::vector<Face_handle> &f,std::vector<Vertex_handle> &w, std::vector<int> &i)
+{ // removing a degree 7 vertex, left delta from w[j]
+ rotate7(j,w,f,i);
+
+  Face_handle nn;
+  f[1]->set_vertex(    i[1] , w[0]) ;  // f1 = w1w2w0
+  f[2]->set_vertex(    i[2] , w[0]) ;  // f2 = w2w3w0
+  f[3]->set_vertex( cw(i[3]), w[5]) ;  
+  f[3]->set_vertex(    i[3] , w[0]) ;  // f3 = w3w5w0
+  f[4]->set_vertex(    i[4] , w[3]) ;  // f4 = w4w5w3
+  f[5]->set_vertex(    i[5] , w[0]) ;  // f5 = w5w6w0
+
+  nn = f[0]->neighbor( i[0] );
+  this->tds().set_adjacency(f[1], cw(i[1]) , nn , nn->index(f[0])  );
+  nn = f[3]->neighbor( i[3] );
+  this->tds().set_adjacency(f[4], cw(i[4]) , nn , nn->index(f[3]) );
+  nn = f[6]->neighbor( i[6] );
+  this->tds().set_adjacency(f[5], ccw(i[5]) , nn , nn->index(f[6])  );
+  this->tds().set_adjacency(f[3], i[3]  , f[4] , ccw(i[4])  );
+  this->tds().set_adjacency(f[3], ccw(i[3]) , f[5] ,  cw(i[5]) );
+
+  this->tds().delete_face(f[0]);
+  this->tds().delete_face(f[6]);
+}
+template < class Gt, class Tds >
+inline void
+Delaunay_triangulation_2<Gt,Tds>::
+remove_degree7_rightdelta(Vertex_handle &, int j,
+ std::vector<Face_handle> &f,std::vector<Vertex_handle> &w, std::vector<int> &i)
+{ // removing a degree 7 vertex, right delta from w[j]
+  rotate7(j,w,f,i);
+
+  Face_handle nn;
+  f[1]->set_vertex(    i[1] , w[0]) ;  // f1 = w1w2w0
+  f[2]->set_vertex(    i[2] , w[4]) ;  // f2 = w2w3w4
+  f[3]->set_vertex(ccw(i[3]), w[2]) ;  
+  f[3]->set_vertex(    i[3] , w[0]) ;  // f3 = w2w4w0
+  f[4]->set_vertex(    i[4] , w[0]) ;  // f4 = w4w5w0
+  f[5]->set_vertex(    i[5] , w[0]) ;  // f5 = w5w6w0
+
+  nn = f[0]->neighbor( i[0] );
+  this->tds().set_adjacency(f[1], cw(i[1]) , nn , nn->index(f[0]) );
+  nn = f[3]->neighbor( i[3] );
+  this->tds().set_adjacency(f[2], ccw(i[2]) , nn, nn->index(f[3]) );
+  nn = f[6]->neighbor( i[6] );
+  this->tds().set_adjacency(f[5], ccw(i[5]) , nn , nn->index(f[6]) );
+  this->tds().set_adjacency(f[1], ccw(i[1]) , f[3], cw(i[3])  );
+  this->tds().set_adjacency(f[3], i[3]  , f[2], cw(i[2]) );
+
+  this->tds().delete_face(f[0]);
+  this->tds().delete_face(f[6]);
+}
+template < class Gt, class Tds >
+inline void
+Delaunay_triangulation_2<Gt,Tds>::
+remove_degree7_leftfan(Vertex_handle &, int j,
+ std::vector<Face_handle> &f,std::vector<Vertex_handle> &w, std::vector<int> &i)
+{ // removing a degree 7 vertex, left fan from w[j]
+  rotate7(j,w,f,i);
+
+  Face_handle nn;
+  f[1]->set_vertex(    i[1] , w[0]) ;  // f1 = w1w2w0
+  f[2]->set_vertex(    i[2] , w[0]) ;  // f2 = w2w3w0
+  f[3]->set_vertex(    i[3] , w[0]) ;  // f3 = w3w4w0
+  f[4]->set_vertex(    i[4] , w[6]) ;  // f4 = w4w5w6
+  f[6]->set_vertex(    i[6] , w[4]) ;  // f6 = w6w0w4
+
+  nn = f[0]->neighbor( i[0] );
+  this->tds().set_adjacency(f[1], cw(i[1]) , nn, nn->index(f[0]) );
+  nn = f[5]->neighbor( i[5] );
+  this->tds().set_adjacency(f[4], ccw(i[4]) , nn, nn->index(f[5]) );
+  this->tds().set_adjacency(f[3], ccw(i[3]) , f[6], ccw(i[6]) );
+  this->tds().set_adjacency(f[6], cw(i[6]) , f[4], cw(i[4]) );
+
+  this->tds().delete_face(f[0]);
+  this->tds().delete_face(f[5]);
+}
+template < class Gt, class Tds >
+inline void
+Delaunay_triangulation_2<Gt,Tds>::
+remove_degree7_rightfan(Vertex_handle &, int j,
+ std::vector<Face_handle> &f,std::vector<Vertex_handle> &w, std::vector<int> &i)
+{ // removing a degree 7 vertex, right fan from w[j]
+
+  rotate7(j,w,f,i);
+
+  Face_handle nn;
+  f[0]->set_vertex(    i[0] , w[3]) ;  // f0 = w0w1w3
+  f[2]->set_vertex(    i[2] , w[1]) ;  // f2 = w2w3w1
+  f[3]->set_vertex(    i[3] , w[0]) ;  // f3 = w3w4w0
+  f[4]->set_vertex(    i[4] , w[0]) ;  // f4 = w4w5w0
+  f[5]->set_vertex(    i[5] , w[0]) ;  // f5 = w5w6w0
+
+  nn = f[1]->neighbor( i[1] );
+  this->tds().set_adjacency(f[2], cw(i[2]) , nn, nn->index(f[1]) );
+  nn = f[6]->neighbor( i[6] );
+  this->tds().set_adjacency(f[5], ccw(i[5]) , nn, nn->index(f[6]) );
+  this->tds().set_adjacency(f[2], ccw(i[2]) , f[0], ccw(i[0])  );
+  this->tds().set_adjacency(f[0], cw(i[0]) , f[3] , cw(i[3]) );
+
+  this->tds().delete_face(f[1]);
+  this->tds().delete_face(f[6]);
+}
+
+
+
+
+///////////////////////////////////////////////////////////////
+//  DISPLACEMENT
+
+template <class Gt, class Tds >
+typename Delaunay_triangulation_2<Gt,Tds>::Vertex_handle
+Delaunay_triangulation_2<Gt,Tds>::
+move_if_no_collision(Vertex_handle v, const Point &p) {
+  CGAL_triangulation_precondition(!this->is_infinite(v));
+  if(v->point() == p) return v;
+  const int dim = this->dimension();
+
+  if(dim == 2) {
+    Point ant = v->point();
+    v->set_point(p);
+		// This option optimizes only when most of the
+	  // displacements would not break the orientation
+	  // of the faces.. we will consider this as an a priori,
+	  // because otherwise it is pointless to just do
+	  // not rebuild from scratch.
+    if(this->well_oriented(v)) {
+      restore_edges(v);
+      return v;
+    }
+    v->set_point(ant);
+  }
+
+  Locate_type lt;
+  int li;
+  Vertex_handle inserted;
+  Face_handle loc = this->locate(p, lt, li, v->face());
+
+  if(lt == Triangulation_2<Gt,Tds>::VERTEX) return loc->vertex(li);
+
+  if(dim == 0) {
+    v->point() = p;
+    return v;
+  }
+
+  size_type n_vertices = this->tds().number_of_vertices();
+
+  if((lt == Triangulation::OUTSIDE_AFFINE_HULL) && 
+     (dim == 1) && (n_vertices == 3)) {
+    v->point() = p;
+    return v;
+  }
+
+  if((lt != Triangulation::OUTSIDE_AFFINE_HULL) && (dim == 1)) {
+    if(loc->has_vertex(v)) {
+      v->point() = p;
+    } else {
+      inserted = insert(p, lt, loc, li);
+      Face_handle f = v->face();
+      int i = f->index(v);
+      if (i==0) {f = f->neighbor(1);}
+      CGAL_triangulation_assertion(f->index(v) == 1);
+      Face_handle g= f->neighbor(0);
+      f->set_vertex(1, g->vertex(1));
+      f->set_neighbor(0,g->neighbor(0));
+      g->neighbor(0)->set_neighbor(1,f);
+      g->vertex(1)->set_face(f);
+      this->delete_face(g);
+      Face_handle f_ins = inserted->face();
+      i = f_ins->index(inserted);
+      if (i==0) {f_ins = f_ins->neighbor(1);}
+      CGAL_triangulation_assertion(f_ins->index(inserted) == 1);
+      Face_handle g_ins = f_ins->neighbor(0);
+      f_ins->set_vertex(1, v);
+      g_ins->set_vertex(0, v);
+    	v->set_point(p);
+      v->set_face(inserted->face());
+      this->delete_vertex(inserted);
+    }
+    return v;
+  }
+
+  if((lt != Triangulation::OUTSIDE_AFFINE_HULL) && this->test_dim_down(v)) {
+    // verify if p and two static vertices are collinear in this case
+    int iinf = 0;
+    Face_circulator finf = this->incident_faces(this->infinite_vertex()), 
+      fdone(finf);
+    do { 
+      if(!finf->has_vertex(v))
+      {
+        iinf = ~(finf->index(this->infinite_vertex()));
+        break;
+      }
+    } while(++finf != fdone);
+    if(this->orientation(finf->vertex(iinf&1)->point(),
+                         finf->vertex(iinf&2)->point(),
+                         p) == COLLINEAR)
+    {
+      v->point() = p;
+      this->tds().dim_down(loc, loc->index(v));
+      return v;
+    }
+  }
+
+  inserted = insert(p, lt, loc, li);
+
+  {
+    int d;
+    CGAL_STATIC_THREAD_LOCAL_VARIABLE(int, maxd,30);
+    CGAL_STATIC_THREAD_LOCAL_VARIABLE(std::vector<Face_handle> , f, maxd);
+    CGAL_STATIC_THREAD_LOCAL_VARIABLE(std::vector<int>, i, maxd);
+    CGAL_STATIC_THREAD_LOCAL_VARIABLE(std::vector<Vertex_handle>, w, maxd);
+
+    remove_degree_init(v,f,w,i,d,maxd);
+    remove_degree_triangulate(v,f,w,i,d);
+  }
+
+  // fixing pointer
+  Face_circulator fc = this->incident_faces(inserted), done(fc);
+  std::vector<Face_handle> faces_pt;
+  faces_pt.reserve(16);
+  do { faces_pt.push_back(fc); } while(++fc != done);
+  std::size_t ss = faces_pt.size();
+  for(std::size_t k=0; k<ss; k++)
+    {
+      Face_handle f = faces_pt[k];
+      int i = f->index(inserted);
+      f->set_vertex(i, v);
+    }
+  
+  v->set_point(p);
+  v->set_face(inserted->face());
+  
+  this->delete_vertex(inserted);
+
+  return v;
+}
+
+template <class Gt, class Tds >
+typename Delaunay_triangulation_2<Gt,Tds>::Vertex_handle
+Delaunay_triangulation_2<Gt,Tds>::
+move(Vertex_handle v, const Point &p) {
+  CGAL_triangulation_precondition(!this->is_infinite(v));
+  if(v->point() == p) return v;
+  Vertex_handle w = move_if_no_collision(v,p);
+  if(w != v) {
+    remove(v);
+    return w;
+  }
+  return v;
+}
+
+template <class Gt, class Tds >
+bool 
+Delaunay_triangulation_2<Gt,Tds>::
+is_delaunay_after_displacement(Vertex_handle v, const Point &p) const
+{
+  CGAL_triangulation_precondition(!this->is_infinite(v));		
+  CGAL_triangulation_precondition(this->dimension() == 2);	
+  CGAL_triangulation_precondition(!this->test_dim_down(v));	
+	if(v->point() == p) return true;
+  Point ant = v->point();
+  v->set_point(p);
+  if(!this->well_oriented(v))
+  {
+    v->set_point(ant);
+    return false;
+  }
+  std::list<Edge> edges;
+  Face_circulator fc = this->incident_faces(v), done(fc);
+  int degree = 0;
+  do {
+    if((++degree) > 3) break;
+  } while(++fc != done);
+  fc = this->incident_faces(v);
+  done = fc;
+  if(degree == 3) {
+    do {
+      int i = fc->index(v);
+      edges.push_back(Edge(fc, i));
+    } while(++fc != done);
+  } else {
+    do {
+      int i = fc->index(v);
+      edges.push_back(Edge(fc, i));
+      edges.push_back(Edge(fc, this->cw(i)));
+    } while(++fc != done);
+  }
+  while(!edges.empty()) {
+    const Edge &e = edges.front();
+    Face_handle f = e.first;
+    int i = e.second;
+    edges.pop_front();
+    if(this->is_infinite(f->vertex(i))) continue;
+    Vertex_handle vm = this->_tds.mirror_vertex(f, i);
+    if(this->is_infinite(vm)) continue;
+    if(this->side_of_oriented_circle(f, vm->point()) == ON_POSITIVE_SIDE) {
+      v->set_point(ant);
+      return false;
+    }
+  }
+  v->set_point(ant);
+  return true;
+}
+
+template <class Gt, class Tds >
+template <class OutputItFaces>
+typename Delaunay_triangulation_2<Gt,Tds>::Vertex_handle 
+Delaunay_triangulation_2<Gt,Tds>::
+move_if_no_collision_and_give_new_faces(Vertex_handle v, 
+                                        const Point &p,
+                                        OutputItFaces oif)
+{
+  CGAL_triangulation_precondition(!this->is_infinite(v));	
+  if(v->point() == p) return v;
+
+  const int dim = this->dimension();
+
+  if(dim == 2) {
+    Point ant = v->point();
+    v->set_point(p);
+    // This option optimizes only when most of the
+    // displacements would not break the orientation
+    // of the faces.. we will consider this as an a priori,
+    // because otherwise it is pointless to just do
+    // not rebuild from scratch.
+    if(well_oriented(v)) {
+      std::set<Face_handle> faces_set;
+      restore_edges(v, faces_set);
+      for(typename std::set<Face_handle>::iterator ib = faces_set.begin(),
+            iend = faces_set.end(); ib != iend; ib++) *oif++ = *ib;
+      return v;
+    }
+    v->set_point(ant);
+  }
+
+  Locate_type lt;
+  int li;
+  Vertex_handle inserted;
+  Face_handle loc = this->locate(p, lt, li, v->face());
+
+  if(lt == Triangulation::VERTEX) return loc->vertex(li);
+
+  if(dim == 0) {
+    v->point() = p;
+    return v;
+  }
+
+  size_type n_vertices = this->tds().number_of_vertices();
+
+  if((lt == Triangulation::OUTSIDE_AFFINE_HULL) && 
+     (dim == 1) && (n_vertices == 3)) {
+    v->point() = p;
+    for(All_faces_iterator afi = this-> all_faces_begin(); 
+        afi != this->all_faces_end(); 
+        afi++) *oif++ = afi;	
+    return v;
+  }
+
+  if((lt != Triangulation::OUTSIDE_AFFINE_HULL) && (dim == 1)) {
+    if(loc->has_vertex(v)) {
+      v->point() = p;
+    } else {
+      inserted = insert(p, lt, loc, li);
+      Face_handle f = v->face();
+      int i = f->index(v);
+      if (i==0) {f = f->neighbor(1);}
+      CGAL_triangulation_assertion(f->index(v) == 1);
+      Face_handle g= f->neighbor(0);
+      f->set_vertex(1, g->vertex(1));
+      f->set_neighbor(0,g->neighbor(0));
+      g->neighbor(0)->set_neighbor(1,f);
+      g->vertex(1)->set_face(f);
+      this->delete_face(g);
+      *oif++ = f;
+      Face_handle f_ins = inserted->face();
+      i = f_ins->index(inserted);
+      if (i==0) {f_ins = f_ins->neighbor(1);}
+      CGAL_triangulation_assertion(f_ins->index(inserted) == 1);
+      Face_handle g_ins = f_ins->neighbor(0);
+      f_ins->set_vertex(1, v);
+      g_ins->set_vertex(0, v);
+      v->set_face(inserted->face());
+    	v->set_point(p);
+      this->delete_vertex(inserted);
+    }
+    *oif++ = v->face();
+    if(v->face()->neighbor(0)->has_vertex(v)) 
+      *oif++ = v->face()->neighbor(0);
+    if(v->face()->neighbor(1)->has_vertex(v)) 
+      *oif++ = v->face()->neighbor(1);			
+    return v;
+  }
+
+  if((lt != Triangulation::OUTSIDE_AFFINE_HULL) && this->test_dim_down(v)) {
+    // verify if p and two static vertices are collinear in this case
+    int iinf;
+    Face_circulator finf = incident_faces(this->infinite_vertex()), 
+      fdone(finf);
+    do { 
+      if(!finf->has_vertex(v))
+      {
+        iinf = ~(finf->index(this->infinite_vertex()));
+        break;
+      }
+    } while(++finf != fdone);
+    if(this->orientation(finf->vertex(iinf&1)->point(),
+                         finf->vertex(iinf&2)->point(),
+                         p) == COLLINEAR)
+    {
+      v->point() = p;
+      this->tds().dim_down(loc, loc->index(v));
+      for(All_faces_iterator afi = this-> all_faces_begin(); 
+          afi != this->all_faces_end(); 
+          afi++) *oif++ = afi;
+      return v;
+    }
+  }
+
+  std::set<Face_handle> faces_set;
+  inserted = Delaunay_triangulation_2<Gt,Tds>::insert(p, lt, loc, li);
+  Face_circulator fc = this->incident_faces(inserted), done(fc);
+  do { faces_set.insert(fc); } while(++fc != done);
+
+
+  {
+    CGAL_STATIC_THREAD_LOCAL_VARIABLE(int, maxd,30);
+    CGAL_STATIC_THREAD_LOCAL_VARIABLE(std::vector<Face_handle> , f, maxd);
+    CGAL_STATIC_THREAD_LOCAL_VARIABLE(std::vector<int>, i, maxd);
+    CGAL_STATIC_THREAD_LOCAL_VARIABLE(std::vector<Vertex_handle>, w, maxd);
+
+    int d;
+    remove_degree_init(v,f,w,i,d,maxd);
+    remove_degree_triangulate(v,f,w,i,d);
+    this->delete_vertex(v);
+    Face_circulator fc(v[0]),done;
+    do *oif++ = fc++; while (fc!=done);    
+  }
+
+  fc = this->incident_faces(inserted), done(fc);
+  std::vector<Face_handle> faces_pt;
+  faces_pt.reserve(16);
+  do { faces_pt.push_back(fc); } while(++fc != done);
+  int ss = faces_pt.size();
+  for(int k=0; k<ss; k++)
+  {
+    Face_handle f = faces_pt[k];
+    int i = f->index(inserted);
+    f->set_vertex(i, v);
+  }
+  v->set_point(p);
+  v->set_face(inserted->face());
+  this->delete_vertex(inserted);
+
+  for(typename std::set<Face_handle>::const_iterator ib = faces_set.begin(),
+        iend = faces_set.end(); ib != iend; ib++) *oif++ = *ib;
+
+  return v;
+}
+
+} //namespace CGAL
+
+#endif // CGAL_DELAUNAY_TRIANGULATION_2_H
diff --git a/3rdparty/CGAL/include/CGAL/Delaunay_triangulation_3.h b/3rdparty/CGAL/include/CGAL/Delaunay_triangulation_3.h
new file mode 100644
index 0000000..16de02c
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Delaunay_triangulation_3.h
@@ -0,0 +1,2084 @@
+// Copyright (c) 1999-2004   INRIA Sophia-Antipolis (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
+// 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(s)     : Monique Teillaud <Monique.Teillaud at sophia.inria.fr>
+//                 Sylvain Pion
+//                 Andreas Fabri <Andreas.Fabri at sophia.inria.fr>
+//                 Clement Jamin
+
+#ifndef CGAL_DELAUNAY_TRIANGULATION_3_H
+#define CGAL_DELAUNAY_TRIANGULATION_3_H
+
+#include <CGAL/basic.h>
+
+#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
+# define CGAL_PROFILE
+# include <CGAL/Profile_counter.h>
+#endif
+
+#include <utility>
+#include <vector>
+
+#include <CGAL/Triangulation_3.h>
+#include <CGAL/iterator.h>
+#include <CGAL/Location_policy.h>
+#ifdef CGAL_TRIANGULATION_3_PROFILING
+# include <CGAL/Mesh_3/Profiling_tools.h>
+#endif
+
+#ifndef CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
+#include <CGAL/Spatial_sort_traits_adapter_3.h>
+#include <CGAL/internal/info_check.h>
+
+#include <boost/tuple/tuple.hpp>
+#include <boost/iterator/zip_iterator.hpp>
+#include <boost/mpl/and.hpp>
+#endif //CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
+
+#ifdef CGAL_LINKED_WITH_TBB
+# include <CGAL/point_generators_3.h>
+# include <tbb/parallel_for.h>
+# include <tbb/enumerable_thread_specific.h>
+# include <tbb/concurrent_vector.h>
+#endif
+
+#ifdef CGAL_DELAUNAY_3_OLD_REMOVE
+#  error "The old remove() code has been removed.  Please report any issue you may have with the current one."
+#endif
+
+#ifdef CGAL_CONCURRENT_TRIANGULATION_3_ADD_TEMPORARY_POINTS_ON_FAR_SPHERE
+#include <CGAL/point_generators_3.h>
+#endif
+
+namespace CGAL {
+
+// Here is the declaration of a class template with three arguments, one
+// having a default value. There is no definition of that class template.
+template < class Gt,
+           class Tds_ = Default,
+           class Location_policy = Default,
+           class Lock_data_structure_ = Default >
+class Delaunay_triangulation_3;
+
+// There is a specialization Delaunay_triangulation_3<Gt, Tds, Fast_location>
+// defined in <CGAL/internal/Delaunay_triangulation_hierarchy_3.h>.
+
+// Here is the specialization Delaunay_triangulation_3<Gt, Tds>, with two
+// arguments, that is if Location_policy being the default value 'Default'.
+template < class Gt, class Tds_,
+           class Lock_data_structure_ >
+class Delaunay_triangulation_3<Gt, Tds_, Default, Lock_data_structure_>
+  : public Triangulation_3<Gt, Tds_, Lock_data_structure_>
+{
+  typedef Delaunay_triangulation_3<Gt, Tds_, Default,
+                                   Lock_data_structure_> Self;
+  typedef Triangulation_3<Gt,Tds_,Lock_data_structure_>  Tr_Base;
+
+public:
+
+  typedef typename Tr_Base::Triangulation_data_structure
+                                     Triangulation_data_structure;
+  typedef Gt                         Geom_traits;
+  typedef Compact_location           Location_policy;
+
+  typedef typename Tr_Base::Lock_data_structure Lock_data_structure;
+
+  typedef typename Gt::Point_3       Point;
+  typedef typename Gt::Segment_3     Segment;
+  typedef typename Gt::Triangle_3    Triangle;
+  typedef typename Gt::Tetrahedron_3 Tetrahedron;
+
+  // types for dual:
+  typedef typename Gt::Line_3        Line;
+  typedef typename Gt::Ray_3         Ray;
+  //typedef typename Gt::Plane_3       Plane;
+  typedef typename Gt::Object_3      Object;
+
+  typedef typename Tr_Base::Cell_handle   Cell_handle;
+  typedef typename Tr_Base::Vertex_handle Vertex_handle;
+
+  typedef typename Tr_Base::Cell   Cell;
+  typedef typename Tr_Base::Vertex Vertex;
+  typedef typename Tr_Base::Facet  Facet;
+  typedef typename Tr_Base::Edge   Edge;
+
+  typedef typename Tr_Base::Cell_circulator  Cell_circulator;
+  typedef typename Tr_Base::Facet_circulator Facet_circulator;
+  typedef typename Tr_Base::Cell_iterator    Cell_iterator;
+  typedef typename Tr_Base::Facet_iterator   Facet_iterator;
+  typedef typename Tr_Base::Edge_iterator    Edge_iterator;
+  typedef typename Tr_Base::Vertex_iterator  Vertex_iterator;
+
+  typedef typename Tr_Base::Finite_vertices_iterator Finite_vertices_iterator;
+  typedef typename Tr_Base::Finite_cells_iterator    Finite_cells_iterator;
+  typedef typename Tr_Base::Finite_facets_iterator   Finite_facets_iterator;
+  typedef typename Tr_Base::Finite_edges_iterator    Finite_edges_iterator;
+
+  typedef typename Tr_Base::All_cells_iterator       All_cells_iterator;
+
+  typedef typename Tr_Base::size_type size_type;
+  typedef typename Tr_Base::Locate_type Locate_type;
+
+
+#ifndef CGAL_CFG_USING_BASE_MEMBER_BUG_2
+  using Tr_Base::cw;
+  using Tr_Base::ccw;
+  using Tr_Base::geom_traits;
+  using Tr_Base::number_of_vertices;
+  using Tr_Base::dimension;
+  using Tr_Base::finite_facets_begin;
+  using Tr_Base::finite_facets_end;
+  using Tr_Base::finite_vertices_begin;
+  using Tr_Base::finite_vertices_end;
+  using Tr_Base::finite_cells_begin;
+  using Tr_Base::finite_cells_end;
+  using Tr_Base::finite_edges_begin;
+  using Tr_Base::finite_edges_end;
+  using Tr_Base::tds;
+  using Tr_Base::infinite_vertex;
+  using Tr_Base::next_around_edge;
+  using Tr_Base::vertex_triple_index;
+  using Tr_Base::mirror_vertex;
+  using Tr_Base::coplanar;
+  using Tr_Base::coplanar_orientation;
+  using Tr_Base::orientation;
+  using Tr_Base::adjacent_vertices;
+  using Tr_Base::construct_segment;
+  using Tr_Base::incident_facets;
+  using Tr_Base::insert_in_conflict;
+  using Tr_Base::is_infinite;
+  using Tr_Base::is_valid_finite;
+  using Tr_Base::locate;
+  using Tr_Base::side_of_edge;
+  using Tr_Base::side_of_segment;
+  using Tr_Base::find_conflicts;
+#endif
+
+protected:
+
+  Oriented_side
+  side_of_oriented_sphere(const Point &p0, const Point &p1, const Point &p2,
+         const Point &p3, const Point &t, bool perturb = false) const;
+
+  Bounded_side
+  coplanar_side_of_bounded_circle(const Point &p, const Point &q,
+                  const Point &r, const Point &s, bool perturb = false) const;
+
+  // for dual:
+  Point
+  construct_circumcenter(const Point &p, const Point &q, const Point &r) const
+  {
+      return geom_traits().construct_circumcenter_3_object()(p, q, r);
+  }
+
+  Line
+  construct_equidistant_line(const Point &p1, const Point &p2,
+                             const Point &p3) const
+  {
+      return geom_traits().construct_equidistant_line_3_object()(p1, p2, p3);
+  }
+
+  Ray
+  construct_ray(const Point &p, const Line &l) const
+  {
+      return geom_traits().construct_ray_3_object()(p, l);
+  }
+
+  Object
+  construct_object(const Point &p) const
+  {
+      return geom_traits().construct_object_3_object()(p);
+  }
+
+  Object
+  construct_object(const Segment &s) const
+  {
+      return geom_traits().construct_object_3_object()(s);
+  }
+
+  Object
+  construct_object(const Ray &r) const
+  {
+      return geom_traits().construct_object_3_object()(r);
+  }
+
+  bool
+  less_distance(const Point &p, const Point &q, const Point &r) const
+  {
+      return geom_traits().compare_distance_3_object()(p, q, r) == SMALLER;
+  }
+
+public:
+
+  Delaunay_triangulation_3(const Gt& gt = Gt(), Lock_data_structure *lock_ds = NULL)
+    : Tr_Base(gt, lock_ds)
+  {}
+
+  Delaunay_triangulation_3(Lock_data_structure *lock_ds, const Gt& gt = Gt())
+    : Tr_Base(lock_ds, gt)
+  {}
+
+  // Create a 3D triangulation from 4 points which must be well-oriented
+  // AND non-coplanar
+  Delaunay_triangulation_3(const Point &p0, const Point &p1,
+                           const Point &p2, const Point &p3,
+                           const Gt& gt = Gt(),
+                           Lock_data_structure *lock_ds = NULL)
+    : Tr_Base(p0, p1, p2, p3, gt, lock_ds)
+  {}
+
+
+  // copy constructor duplicates vertices and cells
+  Delaunay_triangulation_3(const Delaunay_triangulation_3 & tr)
+    : Tr_Base(tr)
+  {
+    CGAL_triangulation_postcondition( is_valid() );
+  }
+
+  template < typename InputIterator >
+  Delaunay_triangulation_3(InputIterator first, InputIterator last,
+                           const Gt& gt = Gt(), Lock_data_structure *lock_ds = NULL)
+    : Tr_Base(gt, lock_ds)
+  {
+      insert(first, last);
+  }
+
+  template < typename InputIterator >
+  Delaunay_triangulation_3(InputIterator first, InputIterator last,
+                           Lock_data_structure *lock_ds,
+                           const Gt& gt = Gt())
+    : Tr_Base(gt, lock_ds)
+  {
+      insert(first, last);
+  }
+
+private:
+  #ifdef CGAL_CONCURRENT_TRIANGULATION_3_ADD_TEMPORARY_POINTS_ON_FAR_SPHERE
+  std::vector<Vertex_handle> 
+  add_temporary_points_on_far_sphere(const size_t num_points)
+  {
+      std::vector<Vertex_handle> far_sphere_vertices;
+
+      const size_t MIN_NUM_POINTS_FOR_FAR_SPHERE_POINTS = 1000000;
+      if (num_points >= MIN_NUM_POINTS_FOR_FAR_SPHERE_POINTS)
+      {
+          // Add temporary vertices on a "far sphere" to reduce contention on
+          // the infinite vertex
+
+          // Get bbox
+          const Bbox_3 &bbox = *this->get_bbox();
+          // Compute radius for far sphere
+          const double& xdelta = bbox.xmax() - bbox.xmin();
+          const double& ydelta = bbox.ymax() - bbox.ymin();
+          const double& zdelta = bbox.zmax() - bbox.zmin();
+          const double radius = 1.3 * 0.5 * std::sqrt(xdelta*xdelta +
+                                                      ydelta*ydelta +
+                                                      zdelta*zdelta);
+          // WARNING - TODO: this code has to be fixed because Vector_3 is not
+          // required by the traits concept
+          const typename Gt::Vector_3 center(
+                  bbox.xmin() + 0.5*xdelta,
+                  bbox.ymin() + 0.5*ydelta,
+                  bbox.zmin() + 0.5*zdelta);
+          Random_points_on_sphere_3<Point> random_point(radius);
+          const int NUM_PSEUDO_INFINITE_VERTICES = static_cast<int>(
+                  tbb::task_scheduler_init::default_num_threads() * 3.5);
+          std::vector<Point> points_on_far_sphere;
+
+          points_on_far_sphere.reserve(NUM_PSEUDO_INFINITE_VERTICES);
+          far_sphere_vertices.reserve(NUM_PSEUDO_INFINITE_VERTICES);
+
+          for (int i = 0 ; i < NUM_PSEUDO_INFINITE_VERTICES ; ++i, ++random_point)
+              points_on_far_sphere.push_back(*random_point + center);
+
+          spatial_sort(points_on_far_sphere.begin(),
+                       points_on_far_sphere.end(),
+                       geom_traits());
+
+          typename std::vector<Point>::const_iterator it_p = points_on_far_sphere.begin();
+          typename std::vector<Point>::const_iterator it_p_end = points_on_far_sphere.end();
+
+          Vertex_handle hint;
+          for ( ; it_p != it_p_end ; ++it_p)
+          {
+              hint = insert(*it_p, hint);
+              far_sphere_vertices.push_back(hint);
+          }
+      }
+
+      return far_sphere_vertices;
+  }
+
+  void remove_temporary_points_on_far_sphere(
+    const std::vector<Vertex_handle> & far_sphere_vertices)
+  {
+      if(!far_sphere_vertices.empty())
+      {
+          // Remove the temporary vertices on far sphere
+          remove(far_sphere_vertices.begin(), far_sphere_vertices.end());
+      }
+  }
+  #endif
+
+public:
+
+#ifndef CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
+  template < class InputIterator >
+  std::ptrdiff_t
+  insert( InputIterator first, InputIterator last,
+          typename boost::enable_if<
+            boost::is_convertible<
+                typename std::iterator_traits<InputIterator>::value_type,
+                Point
+            >
+          >::type* = NULL
+  )
+#else
+  template < class InputIterator >
+  std::ptrdiff_t
+  insert( InputIterator first, InputIterator last)
+#endif //CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
+  {
+#ifdef CGAL_TRIANGULATION_3_PROFILING
+    WallClockTimer t;
+#endif
+
+    size_type n = number_of_vertices();
+    std::vector<Point> points (first, last);
+    spatial_sort (points.begin(), points.end(), geom_traits());
+
+    // Parallel
+#ifdef CGAL_LINKED_WITH_TBB
+    if (this->is_parallel())
+    {
+      size_t num_points = points.size();
+
+      Vertex_handle hint;
+      
+#ifdef CGAL_CONCURRENT_TRIANGULATION_3_ADD_TEMPORARY_POINTS_ON_FAR_SPHERE
+      std::vector<Vertex_handle> far_sphere_vertices =
+        add_temporary_points_on_far_sphere(num_points);
+#endif // CGAL_CONCURRENT_TRIANGULATION_3_ADD_TEMPORARY_POINTS_ON_FAR_SPHERE
+      
+      size_t i = 0;
+      // Insert "num_points_seq" points sequentially
+      // (or more if dim < 3 after that)
+      size_t num_points_seq = (std::min)(num_points, (size_t)100);
+      while (dimension() < 3 || i < num_points_seq)
+      {
+        hint = insert(points[i], hint);
+        ++i;
+      }
+
+      tbb::enumerable_thread_specific<Vertex_handle> tls_hint(hint);
+      tbb::parallel_for(
+        tbb::blocked_range<size_t>( i, num_points ),
+        Insert_point<Self>(*this, points, tls_hint)
+      );
+      
+#ifdef CGAL_CONCURRENT_TRIANGULATION_3_ADD_TEMPORARY_POINTS_ON_FAR_SPHERE
+      remove_temporary_points_on_far_sphere(far_sphere_vertices);
+#endif // CGAL_CONCURRENT_TRIANGULATION_3_ADD_TEMPORARY_POINTS_ON_FAR_SPHERE
+    }
+    // Sequential
+    else
+#endif // CGAL_LINKED_WITH_TBB
+    {
+      Vertex_handle hint;
+      for (typename std::vector<Point>::const_iterator p = points.begin(), end = points.end();
+              p != end; ++p)
+          hint = insert(*p, hint);
+    }
+
+#ifdef CGAL_TRIANGULATION_3_PROFILING
+    std::cerr << "Triangulation computed in " << t.elapsed() << " seconds." << std::endl;
+#endif
+
+    return number_of_vertices() - n;
+  }
+
+
+#ifndef CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
+private:
+  //top stands for tuple-or-pair
+  template <class Info>
+  const Point& top_get_first(const std::pair<Point,Info>& pair) const { return pair.first; }
+  template <class Info>
+  const Info& top_get_second(const std::pair<Point,Info>& pair) const { return pair.second; }
+  template <class Info>
+  const Point& top_get_first(const boost::tuple<Point,Info>& tuple) const { return boost::get<0>(tuple); }
+  template <class Info>
+  const Info& top_get_second(const boost::tuple<Point,Info>& tuple) const { return boost::get<1>(tuple); }
+
+  template <class Tuple_or_pair,class InputIterator>
+  std::ptrdiff_t insert_with_info(InputIterator first,InputIterator last)
+  {
+    size_type n = number_of_vertices();
+    std::vector<std::size_t> indices;
+    std::vector<Point> points;
+    std::vector<typename Triangulation_data_structure::Vertex::Info> infos;
+    std::size_t index=0;
+    for (InputIterator it=first;it!=last;++it){
+      Tuple_or_pair value=*it;
+      points.push_back( top_get_first(value)  );
+      infos.push_back ( top_get_second(value) );
+      indices.push_back(index++);
+    }
+
+    typedef typename Pointer_property_map<Point>::type Pmap;
+    typedef Spatial_sort_traits_adapter_3<Geom_traits,Pmap> Search_traits;
+
+    spatial_sort(indices.begin(),
+                 indices.end(),
+                 Search_traits(make_property_map(points),geom_traits()));
+
+#ifdef CGAL_LINKED_WITH_TBB
+      if(this->is_parallel()){
+
+        size_t num_points = points.size();
+        Vertex_handle hint;
+
+#ifdef CGAL_CONCURRENT_TRIANGULATION_3_ADD_TEMPORARY_POINTS_ON_FAR_SPHERE
+        std::vector<Vertex_handle> far_sphere_vertices =
+          add_temporary_points_on_far_sphere(num_points);
+#endif // CGAL_CONCURRENT_TRIANGULATION_3_ADD_TEMPORARY_POINTS_ON_FAR_SPHERE
+
+        size_t i = 0;
+        // Insert "num_points_seq" points sequentially
+        // (or more if dim < 3 after that)
+        size_t num_points_seq = (std::min)(num_points, (size_t)100);
+        while (dimension() < 3 || i < num_points_seq)
+        {
+          hint = insert(points[indices[i]], hint);
+          if (hint != Vertex_handle()) hint->info() = infos[indices[i]];
+          ++i;
+        }
+
+        tbb::enumerable_thread_specific<Vertex_handle> tls_hint(hint);
+        tbb::parallel_for(
+          tbb::blocked_range<size_t>( i, num_points ),
+          Insert_point_with_info<Self>(*this, points, infos, indices, tls_hint)
+        );
+
+#ifdef CGAL_CONCURRENT_TRIANGULATION_3_ADD_TEMPORARY_POINTS_ON_FAR_SPHERE
+      remove_temporary_points_on_far_sphere(far_sphere_vertices);
+#endif // CGAL_CONCURRENT_TRIANGULATION_3_ADD_TEMPORARY_POINTS_ON_FAR_SPHERE
+
+      }
+      // Sequential
+      else
+#endif
+      {
+          Vertex_handle hint;
+          for (typename std::vector<std::size_t>::const_iterator
+                       it = indices.begin(), end = indices.end();
+               it != end; ++it) {
+              hint = insert(points[*it], hint);
+              if (hint != Vertex_handle()) hint->info() = infos[*it];
+          }
+      }
+
+    return number_of_vertices() - n;
+  }
+
+public:
+
+  template < class InputIterator >
+  std::ptrdiff_t
+  insert( InputIterator first,
+          InputIterator last,
+          typename boost::enable_if<
+            boost::is_convertible<
+              typename std::iterator_traits<InputIterator>::value_type,
+              std::pair<Point,typename internal::Info_check<typename Triangulation_data_structure::Vertex>::type>
+            > >::type* =NULL
+  )
+  {
+    return insert_with_info< std::pair<Point,typename internal::Info_check<typename Triangulation_data_structure::Vertex>::type> >(first,last);
+  }
+
+  template <class  InputIterator_1,class InputIterator_2>
+  std::ptrdiff_t
+  insert( boost::zip_iterator< boost::tuple<InputIterator_1,InputIterator_2> > first,
+          boost::zip_iterator< boost::tuple<InputIterator_1,InputIterator_2> > last,
+          typename boost::enable_if<
+            boost::mpl::and_<
+              boost::is_convertible< typename std::iterator_traits<InputIterator_1>::value_type, Point >,
+              boost::is_convertible< typename std::iterator_traits<InputIterator_2>::value_type, typename internal::Info_check<typename Triangulation_data_structure::Vertex>::type >
+            >
+          >::type* =NULL
+  )
+  {
+    return insert_with_info< boost::tuple<Point,typename internal::Info_check<typename Triangulation_data_structure::Vertex>::type> >(first,last);
+  }
+#endif //CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
+
+  Vertex_handle insert(const Point & p, Vertex_handle hint,
+                       bool *could_lock_zone = NULL)
+  {
+    return insert(p, hint == Vertex_handle() ? this->infinite_cell() : hint->cell(),
+                  could_lock_zone);
+  }
+
+  Vertex_handle insert(const Point & p, Cell_handle start = Cell_handle(),
+                       bool *could_lock_zone = NULL);
+
+  Vertex_handle insert(const Point & p, Locate_type lt,
+                       Cell_handle c, int li, int,
+                 bool *could_lock_zone = NULL);
+
+public: // internal methods
+
+  template <class OutputItCells>
+  Vertex_handle insert_and_give_new_cells(const Point  &p,
+                                          OutputItCells fit,
+                                          Cell_handle start = Cell_handle() );
+
+  template <class OutputItCells>
+  Vertex_handle insert_and_give_new_cells(const Point& p,
+                                          OutputItCells fit,
+                                          Vertex_handle hint);
+
+  template <class OutputItCells>
+  Vertex_handle insert_and_give_new_cells(const Point& p,
+                                          Locate_type lt,
+                                          Cell_handle c, int li, int lj,
+                                          OutputItCells fit);
+
+public:
+
+#ifndef CGAL_NO_DEPRECATED_CODE
+  CGAL_DEPRECATED Vertex_handle move_point(Vertex_handle v, const Point & p);
+#endif
+
+  template <class OutputIteratorBoundaryFacets,
+            class OutputIteratorCells,
+            class OutputIteratorInternalFacets>
+  Triple<OutputIteratorBoundaryFacets,
+         OutputIteratorCells,
+         OutputIteratorInternalFacets>
+  find_conflicts(const Point &p, Cell_handle c,
+                 OutputIteratorBoundaryFacets bfit,
+                 OutputIteratorCells cit,
+                 OutputIteratorInternalFacets ifit,
+                 bool *could_lock_zone = NULL) const
+  {
+      CGAL_triangulation_precondition(dimension() >= 2);
+
+      std::vector<Cell_handle> cells;
+      cells.reserve(32);
+      std::vector<Facet> facets;
+      facets.reserve(64);
+
+      if (dimension() == 2) {
+          Conflict_tester_2 tester(p, this);
+          ifit = Tr_Base::find_conflicts
+            (c, tester,
+             make_triple(std::back_inserter(facets),
+                         std::back_inserter(cells),
+                         ifit), could_lock_zone).third;
+      }
+      else {
+          Conflict_tester_3 tester(p, this);
+          ifit = Tr_Base::find_conflicts
+            (c, tester,
+             make_triple(std::back_inserter(facets),
+                         std::back_inserter(cells),
+                         ifit), could_lock_zone).third;
+      }
+
+      // Reset the conflict flag on the boundary.
+      for(typename std::vector<Facet>::iterator fit=facets.begin();
+          fit != facets.end(); ++fit) {
+        fit->first->neighbor(fit->second)->tds_data().clear();
+        *bfit++ = *fit;
+      }
+
+      // Reset the conflict flag in the conflict cells.
+      for(typename std::vector<Cell_handle>::iterator ccit=cells.begin();
+        ccit != cells.end(); ++ccit) {
+        (*ccit)->tds_data().clear();
+        *cit++ = *ccit;
+      }
+      return make_triple(bfit, cit, ifit);
+  }
+
+  template <class OutputIteratorBoundaryFacets, class OutputIteratorCells>
+  std::pair<OutputIteratorBoundaryFacets, OutputIteratorCells>
+  find_conflicts(const Point &p, Cell_handle c,
+                 OutputIteratorBoundaryFacets bfit,
+                 OutputIteratorCells cit,
+                 bool *could_lock_zone = NULL) const
+  {
+      Triple<OutputIteratorBoundaryFacets,
+             OutputIteratorCells,
+             Emptyset_iterator> t = find_conflicts(p, c, bfit, cit,
+                                                   Emptyset_iterator(),
+                                                   could_lock_zone);
+      return std::make_pair(t.first, t.second);
+  }
+
+#ifndef CGAL_NO_DEPRECATED_CODE
+  // Returns the vertices on the boundary of the conflict hole.
+  template <class OutputIterator>
+  OutputIterator
+  vertices_in_conflict(const Point&p, Cell_handle c, OutputIterator res) const
+  {
+    return vertices_on_conflict_zone_boundary(p, c, res);
+  }
+#endif // CGAL_NO_DEPRECATED_CODE
+
+  // Returns the vertices on the boundary of the conflict hole.
+  template <class OutputIterator>
+  OutputIterator
+  vertices_on_conflict_zone_boundary(const Point&p, Cell_handle c,
+                                     OutputIterator res) const
+  {
+      CGAL_triangulation_precondition(dimension() >= 2);
+
+      // Get the facets on the boundary of the hole.
+      std::vector<Facet> facets;
+      find_conflicts(p, c, std::back_inserter(facets),
+                     Emptyset_iterator(), Emptyset_iterator());
+
+      // Then extract uniquely the vertices.
+      std::set<Vertex_handle> vertices;
+      if (dimension() == 3) {
+          for (typename std::vector<Facet>::const_iterator i = facets.begin();
+               i != facets.end(); ++i) {
+              vertices.insert(i->first->vertex((i->second+1)&3));
+              vertices.insert(i->first->vertex((i->second+2)&3));
+              vertices.insert(i->first->vertex((i->second+3)&3));
+          }
+      } else {
+          for (typename std::vector<Facet>::const_iterator i = facets.begin();
+               i != facets.end(); ++i) {
+              vertices.insert(i->first->vertex(cw(i->second)));
+              vertices.insert(i->first->vertex(ccw(i->second)));
+          }
+      }
+
+      return std::copy(vertices.begin(), vertices.end(), res);
+  }
+
+  // REMOVE
+  void remove(Vertex_handle v);
+  // Concurrency-safe
+  // See Triangulation_3::remove for more information
+  bool remove(Vertex_handle v, bool *could_lock_zone);
+
+  // return new cells (internal)
+  template <class OutputItCells>
+  void remove_and_give_new_cells(Vertex_handle v,
+                                 OutputItCells fit);
+
+  template < typename InputIterator >
+  size_type remove(InputIterator first, InputIterator beyond)
+  {
+    CGAL_triangulation_precondition(!this->does_repeat_in_range(first, beyond));
+    size_type n = number_of_vertices();
+
+#ifdef CGAL_TRIANGULATION_3_PROFILING
+    WallClockTimer t;
+#endif
+
+    // Parallel
+#ifdef CGAL_LINKED_WITH_TBB
+    if (this->is_parallel())
+    {
+      // TODO: avoid that by asking for random-access iterators?
+      std::vector<Vertex_handle> vertices(first, beyond);
+      tbb::concurrent_vector<Vertex_handle> vertices_to_remove_sequentially;
+
+      tbb::parallel_for(
+        tbb::blocked_range<size_t>( 0, vertices.size()),
+        Remove_point<Self>(*this, vertices, vertices_to_remove_sequentially)
+      );
+
+      // Do the rest sequentially
+      for ( typename tbb::concurrent_vector<Vertex_handle>::const_iterator
+              it = vertices_to_remove_sequentially.begin(),
+              it_end = vertices_to_remove_sequentially.end()
+          ; it != it_end
+          ; ++it)
+      {
+        remove(*it);
+      }
+    }
+    // Sequential
+    else
+#endif // CGAL_LINKED_WITH_TBB
+    {
+      while (first != beyond) {
+        remove(*first);
+        ++first;
+      }
+    }
+
+#ifdef CGAL_TRIANGULATION_3_PROFILING
+    double elapsed = t.elapsed();
+    std::cerr << "Points removed in " << elapsed << " seconds." << std::endl;
+#endif
+    return n - number_of_vertices();
+  }
+
+  template < typename InputIterator >
+  size_type remove_cluster(InputIterator first, InputIterator beyond)
+  {
+    Self tmp;
+    Vertex_remover<Self> remover (tmp);
+    return Tr_Base::remove(first, beyond, remover);
+  }
+
+  // MOVE
+  Vertex_handle move_if_no_collision(Vertex_handle v, const Point &p);
+
+  Vertex_handle move(Vertex_handle v, const Point &p);
+
+  // return new cells (internal)
+  template <class OutputItCells>
+  Vertex_handle move_if_no_collision_and_give_new_cells(Vertex_handle v,
+                                                        const Point &p,
+                                                        OutputItCells fit);
+
+private:
+
+  Bounded_side
+  side_of_sphere(Vertex_handle v0, Vertex_handle v1,
+                 Vertex_handle v2, Vertex_handle v3,
+                 const Point &p, bool perturb) const;
+public:
+
+  // Queries
+  Bounded_side
+  side_of_sphere(Cell_handle c, const Point & p,
+                 bool perturb = false) const
+  {
+      return side_of_sphere(c->vertex(0), c->vertex(1),
+                            c->vertex(2), c->vertex(3), p, perturb);
+  }
+
+  Bounded_side
+  side_of_circle( const Facet & f, const Point & p, bool perturb = false) const
+  {
+      return side_of_circle(f.first, f.second, p, perturb);
+  }
+
+  Bounded_side
+  side_of_circle( Cell_handle c, int i, const Point & p,
+                  bool perturb = false) const;
+
+  Vertex_handle
+  nearest_vertex_in_cell(const Point& p, Cell_handle c) const;
+
+  Vertex_handle
+  nearest_vertex(const Point& p, Cell_handle c = Cell_handle()) const;
+
+  bool is_Gabriel(Cell_handle c, int i) const;
+  bool is_Gabriel(Cell_handle c, int i, int j) const;
+  bool is_Gabriel(const Facet& f)const ;
+  bool is_Gabriel(const Edge& e) const;
+
+  bool is_delaunay_after_displacement(Vertex_handle v,
+                                      const Point &p) const;
+
+// Dual functions
+  Point dual(Cell_handle c) const;
+
+  Object dual(const Facet & f) const
+  { return dual( f.first, f.second ); }
+
+  Object dual(Cell_handle c, int i) const;
+
+  Line dual_support(Cell_handle c, int i) const;
+
+  bool is_valid(bool verbose = false, int level = 0) const;
+
+  bool is_valid(Cell_handle c, bool verbose = false, int level = 0) const;
+
+  template < class Stream>
+  Stream& draw_dual(Stream & os)
+    {
+      for (Finite_facets_iterator fit = finite_facets_begin(),
+                                  end = finite_facets_end();
+           fit != end; ++fit) {
+        Object o = dual(*fit);
+        if      (const Segment *s = object_cast<Segment>(&o)) os << *s;
+        else if (const Ray *r     = object_cast<Ray>(&o))     os << *r;
+        else if (const Point *p   = object_cast<Point>(&o))   os << *p;
+      }
+      return os;
+    }
+
+protected:
+
+  Vertex_handle
+  nearest_vertex(const Point &p, Vertex_handle v, Vertex_handle w) const
+  {
+      // In case of equality, v is returned.
+      CGAL_triangulation_precondition(v != w);
+
+      if (is_infinite(v))
+          return w;
+      if (is_infinite(w))
+          return v;
+      return less_distance(p, w->point(), v->point()) ? w : v;
+  }
+
+  class Conflict_tester_3
+  {
+      const Point &p;
+      const Self *t;
+
+  public:
+
+    Conflict_tester_3(const Point &pt, const Self *tr)
+      : p(pt), t(tr) {}
+
+    bool operator()(const Cell_handle c) const
+    {
+      return t->side_of_sphere(c, p, true) == ON_BOUNDED_SIDE;
+    }
+    Oriented_side compare_weight(const Point &, const Point &) const
+    {
+      return ZERO;
+    }
+    bool test_initial_cell(Cell_handle) const
+    {
+      return true;
+    }
+  };
+
+  class Conflict_tester_2
+  {
+      const Point &p;
+      const Self *t;
+
+  public:
+
+    Conflict_tester_2(const Point &pt, const Self *tr)
+      : p(pt), t(tr) {}
+
+    bool operator()(const Cell_handle c) const
+    {
+      return t->side_of_circle(c, 3, p, true) == ON_BOUNDED_SIDE;
+    }
+    Oriented_side compare_weight(const Point &, const Point &) const
+    {
+      return ZERO;
+    }
+    bool test_initial_cell(Cell_handle) const
+    {
+      return true;
+    }
+  };
+  class Hidden_point_visitor
+  {
+  public:
+
+    Hidden_point_visitor() {}
+
+    template <class InputIterator>
+    void process_cells_in_conflict(InputIterator, InputIterator) const {}
+    void reinsert_vertices(Vertex_handle ) {}
+    Vertex_handle replace_vertex(Cell_handle c, int index,
+                                 const Point &) {
+      return c->vertex(index);
+    }
+    void hide_point(Cell_handle, const Point &) {}
+  };
+
+  class Perturbation_order {
+      const Self *t;
+
+  public:
+      Perturbation_order(const Self *tr)
+          : t(tr) {}
+
+      bool operator()(const Point *p, const Point *q) const {
+          return t->compare_xyz(*p, *q) == SMALLER;
+      }
+  };
+
+#ifdef CGAL_LINKED_WITH_TBB
+  // Functor for parallel insert(begin, end) function
+  template <typename DT>
+  class Insert_point
+  {
+    typedef typename DT::Point                          Point;
+    typedef typename DT::Vertex_handle                  Vertex_handle;
+
+    DT                                                  & m_dt;
+    const std::vector<Point>                            & m_points;
+    tbb::enumerable_thread_specific<Vertex_handle>      & m_tls_hint;
+
+  public:
+    // Constructor
+    Insert_point(DT & dt,
+                 const std::vector<Point> & points,
+                 tbb::enumerable_thread_specific<Vertex_handle> & tls_hint)
+    : m_dt(dt), m_points(points), m_tls_hint(tls_hint)
+    {}
+
+    // Constructor
+    Insert_point(const Insert_point &ip)
+    : m_dt(ip.m_dt), m_points(ip.m_points), m_tls_hint(ip.m_tls_hint)
+    {}
+
+    // operator()
+    void operator()( const tbb::blocked_range<size_t>& r ) const
+    {
+#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
+      static Profile_branch_counter_3 bcounter(
+        "early withdrawals / late withdrawals / successes [Delaunay_tri_3::insert]");
+#endif
+
+      Vertex_handle &hint = m_tls_hint.local();
+      for( std::size_t i_point = r.begin() ; i_point != r.end() ; ++i_point)
+      {
+        bool success = false;
+        while(!success)
+        {
+          if (m_dt.try_lock_vertex(hint) && m_dt.try_lock_point(m_points[i_point]))
+          {
+            bool could_lock_zone;
+            Vertex_handle new_hint = m_dt.insert(
+              m_points[i_point], hint, &could_lock_zone);
+
+            m_dt.unlock_all_elements();
+
+            if (could_lock_zone)
+            {
+              hint = new_hint;
+              success = true;
+#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
+              ++bcounter;
+#endif
+            }
+#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
+            else
+            {
+              bcounter.increment_branch_1(); // THIS is a late withdrawal!
+            }
+#endif
+          }
+          else
+          {
+            m_dt.unlock_all_elements();
+
+#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
+            bcounter.increment_branch_2(); // THIS is an early withdrawal!
+#endif
+          }
+        }
+
+      }
+    }
+  };
+
+  // Functor for parallel insert_with_info(begin, end) function
+  template <typename DT>
+  class Insert_point_with_info
+  {
+    typedef typename DT::Point                                  Point;
+    typedef typename DT::Vertex_handle                          Vertex_handle;
+    typedef typename DT::Triangulation_data_structure::Vertex::Info Info;
+
+    DT                                                  & m_dt;
+    const std::vector<Point>                            & m_points;
+    const std::vector<Info>                             & m_infos;
+    const std::vector<std::size_t>                      & m_indices;
+    tbb::enumerable_thread_specific<Vertex_handle>      & m_tls_hint;
+
+  public:
+    // Constructor
+    Insert_point_with_info(DT & dt,
+                 const std::vector<Point> & points,
+                 const std::vector<Info> & infos,
+                 const std::vector<std::size_t> & indices,
+                 tbb::enumerable_thread_specific<Vertex_handle> & tls_hint)
+    : m_dt(dt), m_points(points), m_infos(infos), m_indices(indices), 
+      m_tls_hint(tls_hint)
+    {}
+
+    // Constructor
+    Insert_point_with_info(const Insert_point_with_info &ip)
+      : m_dt(ip.m_dt), m_points(ip.m_points), m_infos(ip.m_infos),
+      m_indices(ip.m_indices), m_tls_hint(ip.m_tls_hint)
+    {}
+
+    // operator()
+    void operator()( const tbb::blocked_range<size_t>& r ) const
+    {
+#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
+      static Profile_branch_counter_3 bcounter(
+        "early withdrawals / late withdrawals / successes [Delaunay_tri_3::insert_with_info]");
+#endif
+
+      Vertex_handle &hint = m_tls_hint.local();
+      for( std::size_t i_idx = r.begin() ; i_idx != r.end() ; ++i_idx)
+      {
+        bool success = false;
+        std::ptrdiff_t i_point = m_indices[i_idx];
+        const Point &p = m_points[i_point];
+        while(!success)
+        {
+          if (m_dt.try_lock_vertex(hint) && m_dt.try_lock_point(p))
+          {
+            bool could_lock_zone;
+            Vertex_handle new_hint = m_dt.insert(
+              p, hint, &could_lock_zone);
+
+            m_dt.unlock_all_elements();
+
+            if (could_lock_zone)
+            {
+              hint = new_hint;
+              if (hint!=Vertex_handle()) hint->info()=m_infos[i_point];
+              success = true;
+#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
+              ++bcounter;
+#endif
+            }
+#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
+            else
+            {
+              bcounter.increment_branch_1(); // THIS is a late withdrawal!
+            }
+#endif
+          }
+          else
+          {
+            m_dt.unlock_all_elements();
+
+#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
+            bcounter.increment_branch_2(); // THIS is an early withdrawal!
+#endif
+          }
+        }
+
+      }
+    }
+  };
+
+  // Functor for parallel remove(begin, end) function
+  template <typename DT>
+  class Remove_point
+  {
+    typedef typename DT::Point                          Point;
+    typedef typename DT::Vertex_handle                  Vertex_handle;
+
+    DT                                    & m_dt;
+    const std::vector<Vertex_handle>      & m_vertices;
+    tbb::concurrent_vector<Vertex_handle> & m_vertices_to_remove_sequentially;
+
+  public:
+    // Constructor
+    Remove_point(DT & dt,
+                 const std::vector<Vertex_handle> & vertices,
+                 tbb::concurrent_vector<Vertex_handle> & 
+                   vertices_to_remove_sequentially)
+    : m_dt(dt), m_vertices(vertices), 
+      m_vertices_to_remove_sequentially(vertices_to_remove_sequentially)
+    {}
+
+    // Constructor
+    Remove_point(const Remove_point &rp)
+    : m_dt(rp.m_dt), m_vertices(rp.m_vertices),
+      m_vertices_to_remove_sequentially(rp.m_vertices_to_remove_sequentially)
+    {}
+
+    // operator()
+    void operator()( const tbb::blocked_range<size_t>& r ) const
+    {
+      for( size_t i_vertex = r.begin() ; i_vertex != r.end() ; ++i_vertex)
+      {
+        Vertex_handle v = m_vertices[i_vertex];
+        bool could_lock_zone, needs_to_be_done_sequentially;
+        do
+        {
+          needs_to_be_done_sequentially =
+            !m_dt.remove(v, &could_lock_zone);
+          m_dt.unlock_all_elements();
+        } while (!could_lock_zone);
+
+        if (needs_to_be_done_sequentially)
+          m_vertices_to_remove_sequentially.push_back(v);
+      }
+    }
+  };
+#endif // CGAL_LINKED_WITH_TBB
+
+  template < class DelaunayTriangulation_3 >
+  class Vertex_remover;
+
+  template < class DelaunayTriangulation_3 >
+  class Vertex_inserter;
+
+  friend class Perturbation_order;
+  friend class Conflict_tester_3;
+  friend class Conflict_tester_2;
+
+  Hidden_point_visitor hidden_point_visitor;
+};
+
+template < class Gt, class Tds, class Lds >
+typename Delaunay_triangulation_3<Gt,Tds,Default,Lds>::Vertex_handle
+Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
+insert(const Point & p, Cell_handle start, bool *could_lock_zone)
+{
+  Locate_type lt;
+  int li, lj;
+
+  // Parallel
+  if (could_lock_zone)
+  {
+    Cell_handle c = locate(p, lt, li, lj, start, could_lock_zone);
+    if (*could_lock_zone)
+      return insert(p, lt, c, li, lj, could_lock_zone);
+    else
+      return Vertex_handle();
+  }
+  // Sequential
+  else
+  {
+    Cell_handle c = locate(p, lt, li, lj, start);
+    return insert(p, lt, c, li, lj);
+  }
+
+}
+
+template < class Gt, class Tds, class Lds >
+typename Delaunay_triangulation_3<Gt,Tds,Default,Lds>::Vertex_handle
+Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
+insert(const Point & p, Locate_type lt, Cell_handle c, int li, int lj,
+       bool *could_lock_zone)
+{
+  switch (dimension()) {
+  case 3:
+    {
+      Conflict_tester_3 tester(p, this);
+      Vertex_handle v = insert_in_conflict(p, lt, c, li, lj,
+                                           tester, hidden_point_visitor, could_lock_zone);
+      return v;
+    }// dim 3
+  case 2:
+    {
+      Conflict_tester_2 tester(p, this);
+      return insert_in_conflict(p, lt, c, li, lj,
+                                tester, hidden_point_visitor, could_lock_zone);
+    }//dim 2
+  default :
+    // dimension <= 1
+    // Do not use the generic insert.
+    return Tr_Base::insert(p, c);
+  }
+}
+
+template < class Gt, class Tds, class Lds >
+template <class OutputItCells>
+typename Delaunay_triangulation_3<Gt,Tds,Default,Lds>::Vertex_handle
+Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
+insert_and_give_new_cells(const Point  &p,
+                          OutputItCells fit,
+                          Cell_handle start)
+{
+  Vertex_handle v = insert(p, start);
+  int dimension = this->dimension();
+  if(dimension == 3) this->incident_cells(v, fit);
+  else if(dimension == 2)
+  {
+    Cell_handle c = v->cell(), end = c;
+    do {
+      *fit++ = c;
+      int i = c->index(v);
+      c = c->neighbor((i+1)%3);
+    } while(c != end);
+  }
+  else if(dimension == 1)
+  {
+    Cell_handle c = v->cell();
+    *fit++ = c;
+    *fit++ = c->neighbor((~(c->index(v)))&1);
+  }
+  else *fit++ = v->cell(); // dimension = 0
+  return v;
+}
+
+template < class Gt, class Tds, class Lds >
+template <class OutputItCells>
+typename Delaunay_triangulation_3<Gt,Tds,Default,Lds>::Vertex_handle
+Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
+insert_and_give_new_cells(const Point& p,
+                          OutputItCells fit,
+                          Vertex_handle hint)
+{
+  Vertex_handle v = insert(p, hint);
+  int dimension = this->dimension();
+  if(dimension == 3) this->incident_cells(v, fit);
+  else if(dimension == 2)
+  {
+    Cell_handle c = v->cell(), end = c;
+    do {
+      *fit++ = c;
+      int i = c->index(v);
+      c = c->neighbor((i+1)%3);
+    } while(c != end);
+  }
+  else if(dimension == 1)
+  {
+    Cell_handle c = v->cell();
+    *fit++ = c;
+    *fit++ = c->neighbor((~(c->index(v)))&1);
+  }
+  else *fit++ = v->cell(); // dimension = 0
+  return v;
+}
+
+template < class Gt, class Tds, class Lds >
+template <class OutputItCells>
+typename Delaunay_triangulation_3<Gt,Tds,Default,Lds>::Vertex_handle
+Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
+insert_and_give_new_cells(const Point& p,
+                          Locate_type lt,
+                          Cell_handle c, int li, int lj,
+                          OutputItCells fit)
+{
+  Vertex_handle v = insert(p, lt, c, li, lj);
+  int dimension = this->dimension();
+  if(dimension == 3) this->incident_cells(v, fit);
+  else if(dimension == 2)
+  {
+    Cell_handle c = v->cell(), end = c;
+    do {
+      *fit++ = c;
+      int i = c->index(v);
+      c = c->neighbor((i+1)%3);
+    } while(c != end);
+  }
+  else if(dimension == 1)
+  {
+    Cell_handle c = v->cell();
+    *fit++ = c;
+    *fit++ = c->neighbor((~(c->index(v)))&1);
+  }
+  else *fit++ = v->cell(); // dimension = 0
+  return v;
+}
+
+#ifndef CGAL_NO_DEPRECATED_CODE
+template < class Gt, class Tds, class Lds >
+typename Delaunay_triangulation_3<Gt,Tds,Default,Lds>::Vertex_handle
+Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
+move_point(Vertex_handle v, const Point & p)
+{
+    CGAL_triangulation_precondition(! is_infinite(v));
+    CGAL_triangulation_expensive_precondition(is_vertex(v));
+
+    // Dummy implementation for a start.
+
+    // Remember an incident vertex to restart
+    // the point location after the removal.
+    Cell_handle c = v->cell();
+    Vertex_handle old_neighbor = c->vertex(c->index(v) == 0 ? 1 : 0);
+    CGAL_triangulation_assertion(old_neighbor != v);
+
+    remove(v);
+
+    if (dimension() <= 0)
+        return insert(p);
+    return insert(p, old_neighbor->cell());
+}
+#endif
+
+template <class Gt, class Tds, class Lds >
+template <class DelaunayTriangulation_3>
+class Delaunay_triangulation_3<Gt,Tds,Default,Lds>::Vertex_remover {
+  typedef DelaunayTriangulation_3 Delaunay;
+public:
+  typedef Nullptr_t Hidden_points_iterator;
+
+  Vertex_remover(Delaunay &tmp_) : tmp(tmp_) {}
+
+  Delaunay &tmp;
+
+  void add_hidden_points(Cell_handle) {}
+  Hidden_points_iterator hidden_points_begin() { return NULL; }
+  Hidden_points_iterator hidden_points_end() { return NULL; }
+
+  Bounded_side side_of_bounded_circle(const Point &p, const Point &q,
+    const Point &r, const Point &s, bool perturb = false) const {
+    return tmp.coplanar_side_of_bounded_circle(p,q,r,s,perturb);
+  }
+};
+
+template <class Gt, class Tds, class Lds >
+template <class DelaunayTriangulation_3>
+class Delaunay_triangulation_3<Gt,Tds,Default,Lds>::Vertex_inserter {
+  typedef DelaunayTriangulation_3 Delaunay;
+public:
+  typedef Nullptr_t Hidden_points_iterator;
+
+  Vertex_inserter(Delaunay &tmp_) : tmp(tmp_) {}
+
+  Delaunay &tmp;
+
+  void add_hidden_points(Cell_handle) {}
+  Hidden_points_iterator hidden_points_begin() { return NULL; }
+  Hidden_points_iterator hidden_points_end() { return NULL; }
+
+  Vertex_handle insert(const Point& p,
+                       Locate_type lt, Cell_handle c, int li, int lj) {
+    return tmp.insert(p, lt, c, li, lj);
+  }
+
+  Vertex_handle insert(const Point& p, Cell_handle c) {
+    return tmp.insert(p, c);
+  }
+
+  Vertex_handle insert(const Point& p) {
+    return tmp.insert(p);
+  }
+};
+
+template < class Gt, class Tds, class Lds >
+void
+Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
+remove(Vertex_handle v)
+{
+  Self tmp;
+  Vertex_remover<Self> remover (tmp);
+  Tr_Base::remove(v, remover);
+
+  CGAL_triangulation_expensive_postcondition(is_valid());
+}
+
+template < class Gt, class Tds, class Lds >
+bool
+Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
+remove(Vertex_handle v, bool *could_lock_zone)
+{
+  Self tmp;
+  Vertex_remover<Self> remover (tmp);
+  bool ret = Tr_Base::remove(v, remover, could_lock_zone);
+
+  CGAL_triangulation_expensive_postcondition(is_valid());
+  return ret;
+}
+
+template < class Gt, class Tds, class Lds >
+typename Delaunay_triangulation_3<Gt,Tds,Default,Lds>::Vertex_handle
+Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
+move_if_no_collision(Vertex_handle v, const Point &p)
+{
+  Self tmp;
+  Vertex_remover<Self> remover (tmp);
+  Vertex_inserter<Self> inserter (*this);
+  Vertex_handle res = Tr_Base::move_if_no_collision(v,p,remover,inserter);
+
+  CGAL_triangulation_expensive_postcondition(is_valid());
+        return res;
+}
+
+template <class Gt, class Tds, class Lds >
+typename Delaunay_triangulation_3<Gt,Tds,Default,Lds>::Vertex_handle
+Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
+move(Vertex_handle v, const Point &p) {
+  CGAL_triangulation_precondition(!is_infinite(v));
+  if(v->point() == p) return v;
+  Self tmp;
+  Vertex_remover<Self> remover (tmp);
+  Vertex_inserter<Self> inserter (*this);
+        return Tr_Base::move(v,p,remover,inserter);
+}
+
+template < class Gt, class Tds, class Lds >
+template <class OutputItCells>
+void
+Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
+remove_and_give_new_cells(Vertex_handle v, OutputItCells fit)
+{
+  Self tmp;
+  Vertex_remover<Self> remover (tmp);
+  Tr_Base::remove_and_give_new_cells(v,remover,fit);
+
+  CGAL_triangulation_expensive_postcondition(is_valid());
+}
+
+template < class Gt, class Tds, class Lds >
+template <class OutputItCells>
+typename Delaunay_triangulation_3<Gt,Tds,Default,Lds>::Vertex_handle
+Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
+move_if_no_collision_and_give_new_cells(Vertex_handle v, const Point &p,
+  OutputItCells fit)
+{
+  Self tmp;
+  Vertex_remover<Self> remover (tmp);
+  Vertex_inserter<Self> inserter (*this);
+  Vertex_handle res =
+    Tr_Base::move_if_no_collision_and_give_new_cells(v,p,
+      remover,inserter,fit);
+
+  CGAL_triangulation_expensive_postcondition(is_valid());
+        return res;
+}
+
+template < class Gt, class Tds, class Lds >
+Oriented_side
+Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
+side_of_oriented_sphere(const Point &p0, const Point &p1, const Point &p2,
+                        const Point &p3, const Point &p, bool perturb) const
+{
+    CGAL_triangulation_precondition( orientation(p0, p1, p2, p3) == POSITIVE );
+
+    Oriented_side os =
+        geom_traits().side_of_oriented_sphere_3_object()(p0, p1, p2, p3, p);
+
+    if (os != ON_ORIENTED_BOUNDARY || !perturb)
+        return os;
+
+    // We are now in a degenerate case => we do a symbolic perturbation.
+
+    // We sort the points lexicographically.
+    const Point * points[5] = {&p0, &p1, &p2, &p3, &p};
+    std::sort(points, points+5, Perturbation_order(this) );
+
+    // We successively look whether the leading monomial, then 2nd monomial
+    // of the determinant has non null coefficient.
+    // 2 iterations are enough (cf paper)
+    for (int i=4; i>2; --i) {
+        if (points[i] == &p)
+            return ON_NEGATIVE_SIDE; // since p0 p1 p2 p3 are non coplanar
+                                     // and positively oriented
+        Orientation o;
+        if (points[i] == &p3 && (o = orientation(p0,p1,p2,p)) != COPLANAR )
+            return o;
+        if (points[i] == &p2 && (o = orientation(p0,p1,p,p3)) != COPLANAR )
+            return o;
+        if (points[i] == &p1 && (o = orientation(p0,p,p2,p3)) != COPLANAR )
+            return o;
+        if (points[i] == &p0 && (o = orientation(p,p1,p2,p3)) != COPLANAR )
+            return o;
+    }
+
+    CGAL_triangulation_assertion(false);
+    return ON_NEGATIVE_SIDE;
+}
+
+template < class Gt, class Tds, class Lds >
+Bounded_side
+Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
+coplanar_side_of_bounded_circle(const Point &p0, const Point &p1,
+               const Point &p2, const Point &p, bool perturb) const
+{
+    // In dim==2, we should even be able to assert orient == POSITIVE.
+    CGAL_triangulation_precondition( coplanar_orientation(p0, p1, p2)
+                                     != COLLINEAR );
+
+    Bounded_side bs =
+      geom_traits().coplanar_side_of_bounded_circle_3_object()(p0, p1, p2, p);
+
+    if (bs != ON_BOUNDARY || !perturb)
+        return bs;
+
+    // We are now in a degenerate case => we do a symbolic perturbation.
+
+    // We sort the points lexicographically.
+    const Point * points[4] = {&p0, &p1, &p2, &p};
+    std::sort(points, points+4, Perturbation_order(this) );
+
+    Orientation local = coplanar_orientation(p0, p1, p2);
+
+    // we successively look whether the leading monomial, then 2nd monimial,
+    // then 3rd monomial, of the determinant which has non null coefficient
+    // [syl] : TODO : Probably it can be stopped earlier like the 3D version
+    for (int i=3; i>0; --i) {
+        if (points[i] == &p)
+            return Bounded_side(NEGATIVE); // since p0 p1 p2 are non collinear
+                                   // but not necessarily positively oriented
+        Orientation o;
+        if (points[i] == &p2
+                && (o = coplanar_orientation(p0,p1,p)) != COLLINEAR )
+            // [syl] : TODO : I'm not sure of the signs here (nor the rest :)
+            return Bounded_side(o*local);
+        if (points[i] == &p1
+                && (o = coplanar_orientation(p0,p,p2)) != COLLINEAR )
+            return Bounded_side(o*local);
+        if (points[i] == &p0
+                && (o = coplanar_orientation(p,p1,p2)) != COLLINEAR )
+            return Bounded_side(o*local);
+    }
+
+    // case when the first non null coefficient is the coefficient of
+    // the 4th monomial
+    // moreover, the tests (points[] == &p) were false up to here, so the
+    // monomial corresponding to p is the only monomial with non-zero
+    // coefficient, it is equal to coplanar_orient(p0,p1,p2) == positive
+    // so, no further test is required
+    return Bounded_side(-local); //ON_UNBOUNDED_SIDE;
+}
+
+template < class Gt, class Tds, class Lds >
+Bounded_side
+Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
+side_of_sphere(Vertex_handle v0, Vertex_handle v1,
+               Vertex_handle v2, Vertex_handle v3,
+               const Point &p, bool perturb) const
+{
+    CGAL_triangulation_precondition( dimension() == 3 );
+
+    if (is_infinite(v0)) {
+        Orientation o = orientation(v2->point(), v1->point(), v3->point(), p);
+        if (o != COPLANAR)
+            return Bounded_side(o);
+        return coplanar_side_of_bounded_circle(v2->point(), v1->point(), v3->point(), p, perturb);
+    }
+
+    if (is_infinite(v1)) {
+        Orientation o = orientation(v2->point(), v3->point(), v0->point(), p);
+        if (o != COPLANAR)
+            return Bounded_side(o);
+        return coplanar_side_of_bounded_circle(v2->point(), v3->point(), v0->point(), p, perturb);
+    }
+
+    if (is_infinite(v2)) {
+        Orientation o = orientation(v1->point(), v0->point(), v3->point(), p);
+        if (o != COPLANAR)
+            return Bounded_side(o);
+        return coplanar_side_of_bounded_circle(v1->point(), v0->point(), v3->point(), p, perturb);
+    }
+
+    if (is_infinite(v3)) {
+        Orientation o = orientation(v0->point(), v1->point(), v2->point(), p);
+        if (o != COPLANAR)
+            return Bounded_side(o);
+        return coplanar_side_of_bounded_circle(v0->point(), v1->point(), v2->point(), p, perturb);
+    }
+
+    return (Bounded_side) side_of_oriented_sphere(v0->point(), v1->point(), v2->point(), v3->point(), p, perturb);
+}
+
+template < class Gt, class Tds, class Lds >
+Bounded_side
+Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
+side_of_circle(Cell_handle c, int i,
+               const Point & p, bool perturb) const
+  // precondition : dimension >=2
+  // in dimension 3, - for a finite facet
+  // returns ON_BOUNDARY if the point lies on the circle,
+  // ON_UNBOUNDED_SIDE when exterior, ON_BOUNDED_SIDE
+  // interior
+  // for an infinite facet, considers the plane defined by the
+  // adjacent finite facet of the same cell, and does the same as in
+  // dimension 2 in this plane
+  // in dimension 2, for an infinite facet
+  // in this case, returns ON_BOUNDARY if the point lies on the
+  // finite edge (endpoints included)
+  // ON_BOUNDED_SIDE for a point in the open half-plane
+  // ON_UNBOUNDED_SIDE elsewhere
+{
+  CGAL_triangulation_precondition( dimension() >= 2 );
+  int i3 = 5;
+
+  if ( dimension() == 2 ) {
+    CGAL_triangulation_precondition( i == 3 );
+    // the triangulation is supposed to be valid, ie the facet
+    // with vertices 0 1 2 in this order is positively oriented
+    if ( ! c->has_vertex( infinite_vertex(), i3 ) )
+      return coplanar_side_of_bounded_circle( c->vertex(0)->point(),
+                                              c->vertex(1)->point(),
+                                              c->vertex(2)->point(),
+                                              p, perturb);
+    // else infinite facet
+    // v1, v2 finite vertices of the facet such that v1,v2,infinite
+    // is positively oriented
+    Vertex_handle v1 = c->vertex( ccw(i3) ),
+                  v2 = c->vertex( cw(i3) );
+    CGAL_triangulation_assertion(coplanar_orientation(v1->point(), v2->point(),
+                                 mirror_vertex(c, i3)->point()) == NEGATIVE);
+    Orientation o = coplanar_orientation(v1->point(), v2->point(), p);
+    if ( o != COLLINEAR )
+        return Bounded_side( o );
+    // because p is in f iff
+    // it does not lie on the same side of v1v2 as vn
+    int i_e;
+    Locate_type lt;
+    // case when p collinear with v1v2
+    return side_of_segment( p,
+                            v1->point(), v2->point(),
+                            lt, i_e );
+  }
+
+  // else dimension == 3
+  CGAL_triangulation_precondition( i >= 0 && i < 4 );
+  if ( ( ! c->has_vertex(infinite_vertex(),i3) ) || ( i3 != i ) ) {
+    // finite facet
+    // initialization of i0 i1 i2, vertices of the facet positively
+    // oriented (if the triangulation is valid)
+    int i0 = (i>0) ? 0 : 1;
+    int i1 = (i>1) ? 1 : 2;
+    int i2 = (i>2) ? 2 : 3;
+    CGAL_triangulation_precondition( coplanar( c->vertex(i0)->point(),
+                                               c->vertex(i1)->point(),
+                                               c->vertex(i2)->point(),
+                                               p ) );
+    return coplanar_side_of_bounded_circle( c->vertex(i0)->point(),
+                                            c->vertex(i1)->point(),
+                                            c->vertex(i2)->point(),
+                                            p, perturb);
+  }
+
+  //else infinite facet
+  // v1, v2 finite vertices of the facet such that v1,v2,infinite
+  // is positively oriented
+  Vertex_handle v1 = c->vertex( next_around_edge(i3,i) ),
+                v2 = c->vertex( next_around_edge(i,i3) );
+  Orientation o = (Orientation)
+                  (coplanar_orientation( v1->point(), v2->point(),
+                                         c->vertex(i)->point()) *
+                  coplanar_orientation( v1->point(), v2->point(), p ));
+  // then the code is duplicated from 2d case
+  if ( o != COLLINEAR )
+      return Bounded_side( -o );
+  // because p is in f iff
+  // it is not on the same side of v1v2 as c->vertex(i)
+  int i_e;
+  Locate_type lt;
+  // case when p collinear with v1v2
+  return side_of_segment( p,
+                          v1->point(), v2->point(),
+                          lt, i_e );
+}
+
+template < class Gt, class Tds, class Lds >
+typename Delaunay_triangulation_3<Gt,Tds,Default,Lds>::Vertex_handle
+Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
+nearest_vertex_in_cell(const Point& p, Cell_handle c) const
+// Returns the finite vertex of the cell c which is the closest to p.
+{
+    CGAL_triangulation_precondition(dimension() >= 0);
+
+    Vertex_handle nearest = nearest_vertex(p, c->vertex(0), c->vertex(1));
+    if (dimension() >= 2) {
+        nearest = nearest_vertex(p, nearest, c->vertex(2));
+        if (dimension() == 3)
+            nearest = nearest_vertex(p, nearest, c->vertex(3));
+    }
+    return nearest;
+}
+
+template < class Gt, class Tds, class Lds >
+typename Delaunay_triangulation_3<Gt,Tds,Default,Lds>::Vertex_handle
+Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
+nearest_vertex(const Point& p, Cell_handle start) const
+{
+    if (number_of_vertices() == 0)
+        return Vertex_handle();
+
+    // Use a brute-force algorithm if dimension < 3.
+    if (dimension() < 3) {
+        Finite_vertices_iterator vit = finite_vertices_begin();
+        Vertex_handle res = vit;
+        ++vit;
+        for (Finite_vertices_iterator end = finite_vertices_end(); vit != end; ++vit)
+            res = nearest_vertex(p, res, vit);
+        return res;
+    }
+
+    Locate_type lt;
+    int li, lj;
+    Cell_handle c = locate(p, lt, li, lj, start);
+    if (lt == Tr_Base::VERTEX)
+        return c->vertex(li);
+
+    // - start with the closest vertex from the located cell.
+    // - repeatedly take the nearest of its incident vertices if any
+    // - if not, we're done.
+    Vertex_handle nearest = nearest_vertex_in_cell(p, c);
+    std::vector<Vertex_handle> vs;
+    vs.reserve(32);
+    while (true) {
+        Vertex_handle tmp = nearest;
+        adjacent_vertices(nearest, std::back_inserter(vs));
+        for (typename std::vector<Vertex_handle>::const_iterator
+                vsit = vs.begin(); vsit != vs.end(); ++vsit)
+            tmp = nearest_vertex(p, tmp, *vsit);
+        if (tmp == nearest)
+            break;
+        vs.clear();
+        nearest = tmp;
+    }
+
+    return nearest;
+}
+
+// This is not a fast version.
+// The optimized version needs an int for book-keeping in
+// tds() so as to avoiding the need to clear
+// the tds marker in each cell (which is an unsigned char)
+// Also the visitor in TDS could be more clever.
+// The Delaunay triangulation which filters displacements
+// will do these optimizations.
+template <class Gt, class Tds, class Lds >
+bool
+Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
+is_delaunay_after_displacement(Vertex_handle v, const Point &p) const
+{
+  CGAL_triangulation_precondition(!this->is_infinite(v));
+  CGAL_triangulation_precondition(this->dimension() == 2);
+  CGAL_triangulation_precondition(!this->test_dim_down(v));
+        if(v->point() == p) return true;
+  Point ant = v->point();
+  v->set_point(p);
+
+  std::size_t size;
+
+  // are incident cells well-oriented
+  std::vector<Cell_handle> cells;
+  cells.reserve(64);
+  this->incident_cells(v, std::back_inserter(cells));
+  size = cells.size();
+  for(std::size_t i=0; i<size; i++)
+  {
+    Cell_handle c = cells[i];
+    if(this->is_infinite(c)) continue;
+    if(this->orientation(c->vertex(0)->point(), c->vertex(1)->point(),
+                         c->vertex(2)->point(), c->vertex(3)->point())
+       != POSITIVE)
+    {
+      v->set_point(ant);
+      return false;
+    }
+  }
+
+  // are incident bi-cells Delaunay?
+  std::vector<Facet> facets;
+  facets.reserve(128);
+  this->incident_facets(v, std::back_inserter(facets));
+  size = facets.size();
+  for(std::size_t i=0; i<size; i++)
+  {
+    const Facet &f = facets[i];
+    Cell_handle c = f.first;
+    int j = f.second;
+    Cell_handle cj = c->neighbor(j);
+    int mj = this->mirror_index(c, j);
+    Vertex_handle h1 = c->vertex(j);
+    if(this->is_infinite(h1)) {
+      if(this->side_of_sphere(c, cj->vertex(mj)->point(), true)
+         != ON_UNBOUNDED_SIDE) {
+        v->set_point(ant);
+        return false;
+      }
+    } else {
+      if(this->side_of_sphere(cj, h1->point(), true) != ON_UNBOUNDED_SIDE) {
+        v->set_point(ant);
+        return false;
+      }
+    }
+  }
+
+  v->set_point(ant);
+  return true;
+}
+
+template < class Gt, class Tds, class Lds >
+bool
+Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
+is_Gabriel(const Facet& f) const
+{
+  return is_Gabriel(f.first, f.second);
+}
+
+template < class Gt, class Tds, class Lds >
+bool
+Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
+is_Gabriel(Cell_handle c, int i) const
+{
+  CGAL_triangulation_precondition(dimension() == 3 && !is_infinite(c,i));
+  typename Geom_traits::Side_of_bounded_sphere_3
+    side_of_bounded_sphere =
+    geom_traits().side_of_bounded_sphere_3_object();
+
+  if ((!is_infinite(c->vertex(i))) &&
+      side_of_bounded_sphere (
+        c->vertex(vertex_triple_index(i,0))->point(),
+        c->vertex(vertex_triple_index(i,1))->point(),
+        c->vertex(vertex_triple_index(i,2))->point(),
+        c->vertex(i)->point()) == ON_BOUNDED_SIDE ) return false;
+    Cell_handle neighbor = c->neighbor(i);
+  int in = neighbor->index(c);
+
+  if ((!is_infinite(neighbor->vertex(in))) &&
+      side_of_bounded_sphere(
+         c->vertex(vertex_triple_index(i,0))->point(),
+         c->vertex(vertex_triple_index(i,1))->point(),
+         c->vertex(vertex_triple_index(i,2))->point(),
+         neighbor->vertex(in)->point()) == ON_BOUNDED_SIDE ) return false;
+
+  return true;
+}
+
+template < class Gt, class Tds, class Lds >
+bool
+Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
+is_Gabriel(const Edge& e) const
+{
+  return is_Gabriel(e.first, e.second, e.third);
+}
+
+template < class Gt, class Tds, class Lds >
+bool
+Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
+is_Gabriel(Cell_handle c, int i, int j) const
+{
+  CGAL_triangulation_precondition(dimension() == 3 && !is_infinite(c,i,j));
+  typename Geom_traits::Side_of_bounded_sphere_3
+    side_of_bounded_sphere =
+    geom_traits().side_of_bounded_sphere_3_object();
+
+  Facet_circulator fcirc = incident_facets(c,i,j),
+                   fdone(fcirc);
+  Vertex_handle v1 = c->vertex(i);
+  Vertex_handle v2 = c->vertex(j);
+  do {
+      // test whether the vertex of cc opposite to *fcirc
+      // is inside the sphere defined by the edge e = (s, i,j)
+      Cell_handle cc = (*fcirc).first;
+      int ii = (*fcirc).second;
+      if (!is_infinite(cc->vertex(ii)) &&
+           side_of_bounded_sphere( v1->point(),
+                                   v2->point(),
+                                   cc->vertex(ii)->point())
+          == ON_BOUNDED_SIDE ) return false;
+  } while(++fcirc != fdone);
+  return true;
+}
+
+template < class Gt, class Tds, class Lds >
+typename Delaunay_triangulation_3<Gt,Tds,Default,Lds>::Point
+Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
+dual(Cell_handle c) const
+{
+  CGAL_triangulation_precondition(dimension()==3);
+  CGAL_triangulation_precondition( ! is_infinite(c) );
+  return c->circumcenter(geom_traits());
+}
+
+
+template < class Gt, class Tds, class Lds >
+typename Delaunay_triangulation_3<Gt,Tds,Default,Lds>::Object
+Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
+dual(Cell_handle c, int i) const
+{
+  CGAL_triangulation_precondition(dimension()>=2);
+  CGAL_triangulation_precondition( ! is_infinite(c,i) );
+
+  if ( dimension() == 2 ) {
+    CGAL_triangulation_precondition( i == 3 );
+    return construct_object( construct_circumcenter(c->vertex(0)->point(),
+                                                    c->vertex(1)->point(),
+                                                    c->vertex(2)->point()) );
+  }
+
+  // dimension() == 3
+  Cell_handle n = c->neighbor(i);
+  if ( ! is_infinite(c) && ! is_infinite(n) )
+    return construct_object(construct_segment( dual(c), dual(n) ));
+
+  // either n or c is infinite
+  int in;
+  if ( is_infinite(c) )
+    in = n->index(c);
+  else {
+    n = c;
+    in = i;
+  }
+  // n now denotes a finite cell, either c or c->neighbor(i)
+  int ind[3] = {(in+1)&3,(in+2)&3,(in+3)&3};
+  if ( (in&1) == 1 )
+      std::swap(ind[0], ind[1]);
+  // in=0: 1 2 3
+  // in=1: 3 2 0
+  // in=2: 3 0 1
+  // in=3: 1 0 2
+  const Point& p = n->vertex(ind[0])->point();
+  const Point& q = n->vertex(ind[1])->point();
+  const Point& r = n->vertex(ind[2])->point();
+
+  Line l = construct_equidistant_line( p, q, r );
+  return construct_object(construct_ray( dual(n), l));
+}
+
+
+
+template < class Gt, class Tds, class Lds >
+typename Delaunay_triangulation_3<Gt,Tds,Default,Lds>::Line
+Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
+dual_support(Cell_handle c, int i) const
+{
+  CGAL_triangulation_precondition(dimension()>=2);
+  CGAL_triangulation_precondition( ! is_infinite(c,i) );
+
+  if ( dimension() == 2 ) {
+    CGAL_triangulation_precondition( i == 3 );
+    return construct_equidistant_line( c->vertex(0)->point(),
+                                       c->vertex(1)->point(),
+                                       c->vertex(2)->point() );
+  }
+
+  return construct_equidistant_line( c->vertex((i+1)&3)->point(),
+                                     c->vertex((i+2)&3)->point(),
+                                     c->vertex((i+3)&3)->point() );
+}
+
+
+template < class Gt, class Tds, class Lds >
+bool
+Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
+is_valid(bool verbose, int level) const
+{
+  if ( ! tds().is_valid(verbose,level) ) {
+    if (verbose)
+        std::cerr << "invalid data structure" << std::endl;
+    CGAL_triangulation_assertion(false);
+    return false;
+  }
+
+  if ( infinite_vertex() == Vertex_handle() ) {
+    if (verbose)
+        std::cerr << "no infinite vertex" << std::endl;
+    CGAL_triangulation_assertion(false);
+    return false;
+  }
+
+  switch ( dimension() ) {
+  case 3:
+    {
+      for(Finite_cells_iterator it = finite_cells_begin(), end = finite_cells_end(); it != end; ++it) {
+        is_valid_finite(it);
+        for(int i=0; i<4; i++ ) {
+          if ( !is_infinite
+               (it->neighbor(i)->vertex(it->neighbor(i)->index(it))) ) {
+            if ( side_of_sphere
+                 (it,
+                  it->neighbor(i)->vertex(it->neighbor(i)->index(it))->point())
+                 == ON_BOUNDED_SIDE ) {
+              if (verbose)
+                std::cerr << "non-empty sphere " << std::endl;
+              CGAL_triangulation_assertion(false);
+              return false;
+            }
+          }
+        }
+      }
+      break;
+    }
+  case 2:
+    {
+      for(Finite_facets_iterator it = finite_facets_begin(), end = finite_facets_end(); it != end; ++it) {
+        is_valid_finite((*it).first);
+        for(int i=0; i<3; i++ ) {
+          if( !is_infinite
+              ((*it).first->neighbor(i)->vertex( (((*it).first)->neighbor(i))
+                                                 ->index((*it).first))) ) {
+            if ( side_of_circle ( (*it).first, 3,
+                                  (*it).first->neighbor(i)->
+                                  vertex( (((*it).first)->neighbor(i))
+                                          ->index((*it).first) )->point() )
+                 == ON_BOUNDED_SIDE ) {
+              if (verbose)
+                std::cerr << "non-empty circle " << std::endl;
+              CGAL_triangulation_assertion(false);
+              return false;
+            }
+          }
+        }
+      }
+      break;
+    }
+  case 1:
+    {
+      for(Finite_edges_iterator it = finite_edges_begin(), end = finite_edges_end(); it != end; ++it)
+        is_valid_finite((*it).first);
+      break;
+    }
+  }
+  if (verbose)
+      std::cerr << "Delaunay valid triangulation" << std::endl;
+  return true;
+}
+
+template < class Gt, class Tds, class Lds >
+bool
+Delaunay_triangulation_3<Gt,Tds,Default,Lds>::
+is_valid(Cell_handle c, bool verbose, int level) const
+{
+  if ( ! Tr_Base::is_valid(c,verbose,level) ) {
+    if (verbose) {
+      std::cerr << "combinatorically invalid cell" ;
+      for (int i=0; i <= dimension(); i++ )
+        std::cerr << c->vertex(i)->point() << ", " ;
+      std::cerr << std::endl;
+    }
+    CGAL_triangulation_assertion(false);
+    return false;
+  }
+  switch ( dimension() ) {
+  case 3:
+    {
+      if ( ! is_infinite(c) ) {
+        is_valid_finite(c,verbose,level);
+        for (int i=0; i<4; i++ ) {
+          if (side_of_sphere(c, c->vertex((c->neighbor(i))->index(c))->point())
+              == ON_BOUNDED_SIDE ) {
+            if (verbose)
+                std::cerr << "non-empty sphere " << std::endl;
+            CGAL_triangulation_assertion(false);
+            return false;
+          }
+        }
+      }
+      break;
+    }
+  case 2:
+    {
+      if ( ! is_infinite(c,3) ) {
+        for (int i=0; i<2; i++ ) {
+          if (side_of_circle(c, 3, c->vertex(c->neighbor(i)->index(c))->point())
+               == ON_BOUNDED_SIDE ) {
+            if (verbose)
+                std::cerr << "non-empty circle " << std::endl;
+            CGAL_triangulation_assertion(false);
+            return false;
+          }
+        }
+      }
+      break;
+    }
+  }
+  if (verbose)
+      std::cerr << "Delaunay valid cell" << std::endl;
+  return true;
+}
+
+} //namespace CGAL
+
+#include <CGAL/internal/Delaunay_triangulation_hierarchy_3.h>
+
+#endif // CGAL_DELAUNAY_TRIANGULATION_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Delaunay_triangulation_adaptation_policies_2.h b/3rdparty/CGAL/include/CGAL/Delaunay_triangulation_adaptation_policies_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Delaunay_triangulation_adaptation_policies_2.h
rename to 3rdparty/CGAL/include/CGAL/Delaunay_triangulation_adaptation_policies_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Delaunay_triangulation_adaptation_traits_2.h b/3rdparty/CGAL/include/CGAL/Delaunay_triangulation_adaptation_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Delaunay_triangulation_adaptation_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Delaunay_triangulation_adaptation_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Delaunay_triangulation_cell_base_3.h b/3rdparty/CGAL/include/CGAL/Delaunay_triangulation_cell_base_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Delaunay_triangulation_cell_base_3.h
rename to 3rdparty/CGAL/include/CGAL/Delaunay_triangulation_cell_base_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Delaunay_triangulation_cell_base_with_circumcenter_3.h b/3rdparty/CGAL/include/CGAL/Delaunay_triangulation_cell_base_with_circumcenter_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Delaunay_triangulation_cell_base_with_circumcenter_3.h
rename to 3rdparty/CGAL/include/CGAL/Delaunay_triangulation_cell_base_with_circumcenter_3.h
diff --git a/3rdparty/CGAL/include/CGAL/Diagonalize_traits.h b/3rdparty/CGAL/include/CGAL/Diagonalize_traits.h
new file mode 100644
index 0000000..5de36a4
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Diagonalize_traits.h
@@ -0,0 +1,275 @@
+// Copyright (c) 2015 GeometryFactory (France), All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Simon Giraudot
+
+
+#ifndef CGAL_DIAGONALIZE_TRAITS_H
+#define CGAL_DIAGONALIZE_TRAITS_H
+
+#include <cmath>
+#include <CGAL/array.h>
+#include <CGAL/number_utils.h>
+#include <CGAL/number_type_config.h>
+#include <CGAL/double.h>
+
+namespace CGAL {
+
+  /// A model of the concept `DiagonalizeTraits` 
+  /// \cgalModels `DiagonalizeTraits`
+
+template <typename FT, unsigned int dim = 3>
+class Diagonalize_traits{
+
+public:
+  
+    typedef cpp11::array<FT, dim> Vector;
+    typedef cpp11::array<FT, dim*dim> Matrix;
+    typedef cpp11::array<FT, (dim * (dim+1) / 2)> Covariance_matrix;
+
+    static bool
+    diagonalize_selfadjoint_covariance_matrix
+      (const Covariance_matrix& cov,
+       Vector& eigenvalues)
+    {
+      Matrix eigenvectors;
+      return diagonalize_selfadjoint_covariance_matrix (cov, eigenvalues, eigenvectors);
+    }
+
+    // Extract the eigenvector associated to the largest eigenvalue
+    static bool
+    extract_largest_eigenvector_of_covariance_matrix
+      (const Covariance_matrix& cov,
+       Vector& normal)
+    {
+      Vector eigenvalues;
+      Matrix eigenvectors;
+
+      diagonalize_selfadjoint_covariance_matrix (cov, eigenvalues, eigenvectors);
+
+      for (std::size_t i = 0; i < dim; ++ i)
+	normal[i] = static_cast<FT> (eigenvectors[(dim*(dim-1))+i]);
+
+      return true;
+    }
+
+    static bool diagonalize_selfadjoint_covariance_matrix
+       (const Covariance_matrix& mat,
+	Vector& eigen_values,
+	Matrix& eigen_vectors)
+    {
+      const int n = dim;
+      
+      const int MAX_ITER = 100;
+      static const FT EPSILON = (FT)0.00001;
+      
+      // number of entries in mat
+      int nn = (n*(n+1))/2;
+      
+      // copy matrix
+      FT *a = new FT[nn];
+      int ij;
+
+      // This function requires lower triangular, so we switch
+      for (int i = 0; i < n; ++ i)
+	for (int j = i; j < n; ++ j)
+	  a[(n * i) + j - ((i * (i+1)) / 2)]
+	    = mat[i + (j * (j+1) / 2)];
+
+      // Fortran-porting
+      a--;
+      
+      // init diagonalization matrix as the unit matrix
+      FT *v = new FT[n*n];
+      ij = 0;
+      int i;
+      for(i=0; i<n; i++)
+	for(int j=0; j<n; j++) 
+	  if(i==j)
+	    v[ij++] = 1.0;
+	  else
+	    v[ij++] = 0.0;
+      // Fortran-porting
+      v--;
+      
+      // compute weight of the non diagonal terms 
+      ij = 1;
+      FT a_norm = 0.0;
+      for(i=1; i<=n; i++)
+	for(int j=1; j<=i; j++) 
+	  {
+	    if( i!=j ) 
+	      {
+		FT a_ij = a[ij];
+		a_norm += a_ij * a_ij;
+	      }
+	    ij++;
+	  }
+      
+      if(a_norm != 0.0) 
+	{
+	  FT a_normEPS = a_norm * EPSILON;
+	  FT thr = a_norm;
+  
+	  // rotations
+	  int nb_iter = 0;
+	  while(thr > a_normEPS && nb_iter < MAX_ITER) 
+	    {
+	      nb_iter++;
+	      FT thr_nn = thr / nn;
+          
+	      for(int l=1; l< n; l++) 
+		{
+		  for(int m=l+1; m<=n; m++) 
+		    {
+		      // compute sinx and cosx 
+		      int lq = (l*l-l)/2;
+		      int mq = (m*m-m)/2;
+          
+		      int lm = l + mq;
+		      FT a_lm = a[lm];
+		      FT a_lm_2 = a_lm * a_lm;
+          
+		      if(a_lm_2 < thr_nn)
+			continue;
+          
+		      int ll   = l + lq;
+		      int mm   = m + mq;
+		      FT a_ll = a[ll];
+		      FT a_mm = a[mm];
+          
+		      FT delta = a_ll - a_mm;
+          
+		      FT x;
+		      if(delta == 0.0)
+			x = (FT) - CGAL_PI / 4; 
+		      else 
+			x = (FT)(- std::atan( (a_lm+a_lm) / delta ) / 2.0);
+
+		      FT sinx    = std::sin(x);
+		      FT cosx    = std::cos(x);
+		      FT sinx_2  = sinx * sinx;
+		      FT cosx_2  = cosx * cosx;
+		      FT sincos  = sinx * cosx;
+          
+		      // rotate L and M columns 
+		      int ilv = n*(l-1);
+		      int imv = n*(m-1);
+          
+		      int i;
+		      for( i=1; i<=n;i++ ) 
+			{
+			  if( (i!=l) && (i!=m) ) 
+			    {
+			      int iq = (i*i-i)/2;
+              
+			      int im;
+			      if( i<m )  
+				im = i + mq; 
+			      else
+				im = m + iq;
+			      FT a_im = a[im];
+              
+			      int il;
+			      if( i<l ) 
+				il = i + lq; 
+			      else 
+				il = l + iq;
+			      FT a_il = a[il];
+              
+			      a[il] = a_il * cosx - a_im * sinx;
+			      a[im] = a_il * sinx + a_im * cosx;
+			    }
+            
+			  ilv++;
+			  imv++;
+            
+			  FT v_ilv = v[ilv];
+			  FT v_imv = v[imv];
+            
+			  v[ilv] = cosx * v_ilv - sinx * v_imv;
+			  v[imv] = sinx * v_ilv + cosx * v_imv;
+			} 
+          
+		      x = a_lm * sincos; 
+		      x += x;
+          
+		      a[ll] =  a_ll * cosx_2 + a_mm * sinx_2 - x;
+		      a[mm] =  a_ll * sinx_2 + a_mm * cosx_2 + x;
+		      a[lm] =  0.0;
+          
+		      thr = CGAL::abs(thr - a_lm_2);
+		    }
+		}
+	    }         
+	}
+      
+      // convert indices and copy eigen values 
+      a++;
+      for(i=0; i<n; i++) 
+	{
+	  int k = i + (i*(i+1))/2;
+	  eigen_values[i] = a[k];
+	}
+      delete [] a;
+      
+      // sort eigen values and vectors 
+      int *index = new int[n];
+      for(i=0; i<n; i++)
+	index[i] = i;
+      
+      for(i=0; i<(n-1); i++)
+	{
+	  FT x = eigen_values[i];
+	  int k = i;
+        
+	  for(int j=i+1; j<n; j++) 
+	    if(x > eigen_values[j]) 
+	      {
+		k = j;
+		x = eigen_values[j];
+	      }
+        
+	  eigen_values[k] = eigen_values[i];
+	  eigen_values[i] = x;
+      
+	  int jj = index[k];
+	  index[k] = index[i];
+	  index[i] = jj;
+	}
+
+
+      // save eigen vectors 
+      v++; // back to C++
+      ij = 0;
+      for(int k=0; k<n; k++ ) 
+	{
+	  int ik = index[k]*n;
+	  for(int i=0; i<n; i++) 
+	    eigen_vectors[ij++] = v[ik++];
+	}
+  
+      delete [] v;
+      delete [] index;
+
+      return true;
+    }
+
+  };
+
+} // namespace CGAL
+
+#endif // CGAL_DIAGONALIZE_TRAITS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Dimension.h b/3rdparty/CGAL/include/CGAL/Dimension.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Dimension.h
rename to 3rdparty/CGAL/include/CGAL/Dimension.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Direction_2.h b/3rdparty/CGAL/include/CGAL/Direction_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Direction_2.h
rename to 3rdparty/CGAL/include/CGAL/Direction_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Direction_3.h b/3rdparty/CGAL/include/CGAL/Direction_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Direction_3.h
rename to 3rdparty/CGAL/include/CGAL/Direction_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Discrete_authalic_parameterizer_3.h b/3rdparty/CGAL/include/CGAL/Discrete_authalic_parameterizer_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Discrete_authalic_parameterizer_3.h
rename to 3rdparty/CGAL/include/CGAL/Discrete_authalic_parameterizer_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Discrete_conformal_map_parameterizer_3.h b/3rdparty/CGAL/include/CGAL/Discrete_conformal_map_parameterizer_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Discrete_conformal_map_parameterizer_3.h
rename to 3rdparty/CGAL/include/CGAL/Discrete_conformal_map_parameterizer_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Distance_2.h b/3rdparty/CGAL/include/CGAL/Distance_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Distance_2.h
rename to 3rdparty/CGAL/include/CGAL/Distance_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Double_map.h b/3rdparty/CGAL/include/CGAL/Double_map.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Double_map.h
rename to 3rdparty/CGAL/include/CGAL/Double_map.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Dummy_tds_2.h b/3rdparty/CGAL/include/CGAL/Dummy_tds_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Dummy_tds_2.h
rename to 3rdparty/CGAL/include/CGAL/Dummy_tds_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Dynamic_matrix.h b/3rdparty/CGAL/include/CGAL/Dynamic_matrix.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Dynamic_matrix.h
rename to 3rdparty/CGAL/include/CGAL/Dynamic_matrix.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Edge_hash_function.h b/3rdparty/CGAL/include/CGAL/Edge_hash_function.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Edge_hash_function.h
rename to 3rdparty/CGAL/include/CGAL/Edge_hash_function.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Eigen_diagonalize_traits.h b/3rdparty/CGAL/include/CGAL/Eigen_diagonalize_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Eigen_diagonalize_traits.h
rename to 3rdparty/CGAL/include/CGAL/Eigen_diagonalize_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Eigen_matrix.h b/3rdparty/CGAL/include/CGAL/Eigen_matrix.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Eigen_matrix.h
rename to 3rdparty/CGAL/include/CGAL/Eigen_matrix.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Eigen_solver_traits.h b/3rdparty/CGAL/include/CGAL/Eigen_solver_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Eigen_solver_traits.h
rename to 3rdparty/CGAL/include/CGAL/Eigen_solver_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Eigen_svd.h b/3rdparty/CGAL/include/CGAL/Eigen_svd.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Eigen_svd.h
rename to 3rdparty/CGAL/include/CGAL/Eigen_svd.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Eigen_vector.h b/3rdparty/CGAL/include/CGAL/Eigen_vector.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Eigen_vector.h
rename to 3rdparty/CGAL/include/CGAL/Eigen_vector.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Enum_converter.h b/3rdparty/CGAL/include/CGAL/Enum_converter.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Enum_converter.h
rename to 3rdparty/CGAL/include/CGAL/Enum_converter.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Env_default_diagram_1.h b/3rdparty/CGAL/include/CGAL/Env_default_diagram_1.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Env_default_diagram_1.h
rename to 3rdparty/CGAL/include/CGAL/Env_default_diagram_1.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Env_plane_traits_3.h b/3rdparty/CGAL/include/CGAL/Env_plane_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Env_plane_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/Env_plane_traits_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Env_sphere_traits_3.h b/3rdparty/CGAL/include/CGAL/Env_sphere_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Env_sphere_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/Env_sphere_traits_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Env_surface_data_traits_3.h b/3rdparty/CGAL/include/CGAL/Env_surface_data_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Env_surface_data_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/Env_surface_data_traits_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Env_tracing_traits_3.h b/3rdparty/CGAL/include/CGAL/Env_tracing_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Env_tracing_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/Env_tracing_traits_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Env_triangle_traits_3.h b/3rdparty/CGAL/include/CGAL/Env_triangle_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Env_triangle_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/Env_triangle_traits_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Envelope_2/Env_divide_and_conquer_2.h b/3rdparty/CGAL/include/CGAL/Envelope_2/Env_divide_and_conquer_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Envelope_2/Env_divide_and_conquer_2.h
rename to 3rdparty/CGAL/include/CGAL/Envelope_2/Env_divide_and_conquer_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Envelope_2/Env_divide_and_conquer_2_impl.h b/3rdparty/CGAL/include/CGAL/Envelope_2/Env_divide_and_conquer_2_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Envelope_2/Env_divide_and_conquer_2_impl.h
rename to 3rdparty/CGAL/include/CGAL/Envelope_2/Env_divide_and_conquer_2_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Envelope_3/Env_plane_traits_3_functions.h b/3rdparty/CGAL/include/CGAL/Envelope_3/Env_plane_traits_3_functions.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Envelope_3/Env_plane_traits_3_functions.h
rename to 3rdparty/CGAL/include/CGAL/Envelope_3/Env_plane_traits_3_functions.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Envelope_3/Envelope_base.h b/3rdparty/CGAL/include/CGAL/Envelope_3/Envelope_base.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Envelope_3/Envelope_base.h
rename to 3rdparty/CGAL/include/CGAL/Envelope_3/Envelope_base.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Envelope_3/Envelope_diagram_on_surface_2.h b/3rdparty/CGAL/include/CGAL/Envelope_3/Envelope_diagram_on_surface_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Envelope_3/Envelope_diagram_on_surface_2.h
rename to 3rdparty/CGAL/include/CGAL/Envelope_3/Envelope_diagram_on_surface_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Envelope_3/Envelope_divide_and_conquer_3.h b/3rdparty/CGAL/include/CGAL/Envelope_3/Envelope_divide_and_conquer_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Envelope_3/Envelope_divide_and_conquer_3.h
rename to 3rdparty/CGAL/include/CGAL/Envelope_3/Envelope_divide_and_conquer_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Envelope_3/Envelope_element_visitor_3.h b/3rdparty/CGAL/include/CGAL/Envelope_3/Envelope_element_visitor_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Envelope_3/Envelope_element_visitor_3.h
rename to 3rdparty/CGAL/include/CGAL/Envelope_3/Envelope_element_visitor_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Envelope_3/Envelope_overlay_2.h b/3rdparty/CGAL/include/CGAL/Envelope_3/Envelope_overlay_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Envelope_3/Envelope_overlay_2.h
rename to 3rdparty/CGAL/include/CGAL/Envelope_3/Envelope_overlay_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Envelope_3/Envelope_overlay_functor.h b/3rdparty/CGAL/include/CGAL/Envelope_3/Envelope_overlay_functor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Envelope_3/Envelope_overlay_functor.h
rename to 3rdparty/CGAL/include/CGAL/Envelope_3/Envelope_overlay_functor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Envelope_3/Envelope_pm_dcel.h b/3rdparty/CGAL/include/CGAL/Envelope_3/Envelope_pm_dcel.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Envelope_3/Envelope_pm_dcel.h
rename to 3rdparty/CGAL/include/CGAL/Envelope_3/Envelope_pm_dcel.h
diff --git a/3rdparty/CGAL/include/CGAL/Envelope_3/set_dividors.h b/3rdparty/CGAL/include/CGAL/Envelope_3/set_dividors.h
new file mode 100644
index 0000000..2b491ad
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Envelope_3/set_dividors.h
@@ -0,0 +1,120 @@
+// Copyright (c) 2005  Tel-Aviv University (Israel).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Michal Meyerovitch     <gorgymic at post.tau.ac.il>
+//                 Baruch Zukerman        <baruchzu at post.tau.ac.il>
+
+#ifndef CGAL_ENVELOPE_SET_DIVIDORS_H
+#define CGAL_ENVELOPE_SET_DIVIDORS_H
+
+#include <CGAL/Random.h>
+
+namespace CGAL
+{
+namespace Envelope_3
+{
+
+//! All even-indexed elements are stored in the first sequence and all the 
+//  odd-indexed are stored in the second sequence.
+class Arbitrary_dividor
+{
+public:
+
+  template <class InputIterator, class OutputIterator>
+  void operator()(InputIterator begin, InputIterator end,
+                  OutputIterator set1, OutputIterator set2)
+  {
+    bool set_first = true;
+    for(; begin != end; ++begin, set_first = !set_first)
+      if (set_first)
+        *set1++ = *begin;
+      else
+        *set2++ = *begin;
+
+  }
+  
+};
+
+//! The last element is stored in the second sequence and all the other (n-1) 
+//  elments are stored in the first sequence.
+class Incremental_dividor
+{
+public:
+
+  template <class InputIterator, class OutputIterator>
+  void operator()(InputIterator begin, InputIterator end,
+                  OutputIterator set1, OutputIterator set2)
+  {
+    std::size_t i, n = std::distance(begin, end);
+    // all items but the last go to the first set
+    for(i=0; i<(n-1); ++i, ++begin)
+      *set1++ = *begin;
+    // the last item goes to the second set
+    *set2++ = *begin;
+  }
+
+};
+
+//! The elements are divided exactly in the middle.
+class Middle_dividor
+{
+public:
+
+  template <class InputIterator, class OutputIterator>
+  void operator()(InputIterator begin, InputIterator end,
+                  OutputIterator set1, OutputIterator set2)
+  {
+    std::size_t i, n = std::distance(begin, end);
+
+    for(i=0; i < n; ++i, ++begin)
+    {
+      if (i < n/2)
+        *set1++ = *begin;
+      else
+        *set2++ = *begin;
+    }
+  }
+
+};
+
+//! The elements are divided randomly
+class Random_dividor
+{
+public:
+  
+  template <class InputIterator, class OutputIterator>
+  void operator()(InputIterator begin, InputIterator end,
+                  OutputIterator set1, OutputIterator set2)
+  {
+    while (begin != end)
+    {
+      
+      if (CGAL::get_default_random().get_bool())
+        *set1++ = *begin++;
+      else
+        *set2++ = *begin++;
+    }
+  }
+
+};
+
+
+} // namespace Envelope_3
+} // namespace CGAL
+
+#endif 
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Envelope_diagram_1.h b/3rdparty/CGAL/include/CGAL/Envelope_diagram_1.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Envelope_diagram_1.h
rename to 3rdparty/CGAL/include/CGAL/Envelope_diagram_1.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Epick_d.h b/3rdparty/CGAL/include/CGAL/Epick_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Epick_d.h
rename to 3rdparty/CGAL/include/CGAL/Epick_d.h
diff --git a/3rdparty/CGAL/include/CGAL/Euclidean_distance.h b/3rdparty/CGAL/include/CGAL/Euclidean_distance.h
new file mode 100644
index 0000000..d6d952d
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Euclidean_distance.h
@@ -0,0 +1,205 @@
+// Copyright (c) 2002,2011 Utrecht University (The Netherlands).
+// 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
+// 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(s)     : Hans Tangelder (<hanst at cs.uu.nl>)
+
+
+#ifndef CGAL_EUCLIDEAN_DISTANCE_H
+#define CGAL_EUCLIDEAN_DISTANCE_H
+
+#include <CGAL/Kd_tree_rectangle.h>
+#include <CGAL/number_utils.h>
+#include <CGAL/internal/Get_dimension_tag.h>
+
+
+namespace CGAL {
+
+  template <class SearchTraits>
+  class Euclidean_distance;
+
+    
+  namespace internal{
+    template <class SearchTraits>
+    struct Spatial_searching_default_distance{
+      typedef ::CGAL::Euclidean_distance<SearchTraits> type;
+    };
+  } //namespace internal
+
+  template <class SearchTraits>
+  class Euclidean_distance {
+    
+    SearchTraits traits;
+    
+    public:
+
+    typedef typename SearchTraits::FT    FT;
+    typedef typename SearchTraits::Point_d Point_d;
+    typedef Point_d Query_item;
+
+    typedef typename internal::Get_dimension_tag<SearchTraits>::Dimension D;
+	
+
+    // default constructor
+    Euclidean_distance(const SearchTraits& traits_=SearchTraits()):traits(traits_) {}
+
+    
+    inline FT transformed_distance(const Query_item& q, const Point_d& p) const {
+        return transformed_distance(q,p, D());
+    }
+
+    //Dynamic version for runtime dimension
+    inline FT transformed_distance(const Query_item& q, const Point_d& p, Dynamic_dimension_tag) const {
+        FT distance = FT(0);
+	typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object();
+        typename SearchTraits::Cartesian_const_iterator_d qit = construct_it(q),
+	qe = construct_it(q,1), pit = construct_it(p);
+	for(; qit != qe; qit++, pit++){
+	    distance += ((*qit)-(*pit))*((*qit)-(*pit));
+	}
+        return distance;
+    }
+
+    //Generic version for DIM > 3
+    template < int DIM >
+    inline FT transformed_distance(const Query_item& q, const Point_d& p, Dimension_tag<DIM>) const {
+        FT distance = FT(0);
+        typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object();
+        typename SearchTraits::Cartesian_const_iterator_d qit = construct_it(q),
+          qe = construct_it(q,1), pit = construct_it(p);
+        for(; qit != qe; qit++, pit++){
+	  distance += ((*qit)-(*pit))*((*qit)-(*pit));
+        }
+        return distance;
+    }
+
+    //DIM = 2 loop unrolled
+    inline FT transformed_distance(const Query_item& q, const Point_d& p, Dimension_tag<2> ) const {
+        typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object();
+        typename SearchTraits::Cartesian_const_iterator_d qit = construct_it(q),pit = construct_it(p);
+        FT distance = square(*qit - *pit);
+        qit++;pit++;
+        distance += square(*qit - *pit);
+        return distance;
+    }
+
+    //DIM = 3 loop unrolled
+    inline FT transformed_distance(const Query_item& q, const Point_d& p, Dimension_tag<3> ) const {
+        typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object();
+        typename SearchTraits::Cartesian_const_iterator_d qit = construct_it(q),pit = construct_it(p);
+        FT distance = square(*qit - *pit);
+        qit++;pit++;
+        distance += square(*qit - *pit);
+        qit++;pit++;
+        distance += square(*qit - *pit);
+        return distance;
+    }
+
+ 
+
+
+	inline FT min_distance_to_rectangle(const Query_item& q,
+					    const Kd_tree_rectangle<FT,D>& r) const {
+		FT distance = FT(0);
+		typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object();
+                typename SearchTraits::Cartesian_const_iterator_d qit = construct_it(q),
+		  qe = construct_it(q,1);
+		for(unsigned int i = 0;qit != qe; i++, qit++){
+		  if((*qit) < r.min_coord(i))
+				distance += 
+				(r.min_coord(i)-(*qit))*(r.min_coord(i)-(*qit));
+		  else if ((*qit) > r.max_coord(i))
+				distance +=  
+				((*qit)-r.max_coord(i))*((*qit)-r.max_coord(i));
+			
+		}
+		return distance;
+	}
+
+        inline FT min_distance_to_rectangle(const Query_item& q,
+					    const Kd_tree_rectangle<FT,D>& r,std::vector<FT>& dists) const {
+		FT distance = FT(0);
+		typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object();
+                typename SearchTraits::Cartesian_const_iterator_d qit = construct_it(q),
+		  qe = construct_it(q,1);
+		for(unsigned int i = 0;qit != qe; i++, qit++){
+		  if((*qit) < r.min_coord(i)){
+                                dists[i] = (r.min_coord(i)-(*qit));
+				distance += dists[i] * dists[i];
+                  }
+		  else if ((*qit) > r.max_coord(i)){
+                                dists[i] = ((*qit)-r.max_coord(i));
+				distance +=  dists[i] * dists[i];
+                  }
+			
+		}
+		return distance;
+	}
+
+	inline FT max_distance_to_rectangle(const Query_item& q,
+					     const Kd_tree_rectangle<FT,D>& r) const {
+		FT distance=FT(0);
+		typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object();
+                typename SearchTraits::Cartesian_const_iterator_d qit = construct_it(q),
+		  qe = construct_it(q,1);
+		for(unsigned int i = 0;qit != qe; i++, qit++){
+				if ((*qit) <= (r.min_coord(i)+r.max_coord(i))/FT(2.0))
+					distance += (r.max_coord(i)-(*qit))*(r.max_coord(i)-(*qit));
+				else
+					distance += ((*qit)-r.min_coord(i))*((*qit)-r.min_coord(i));
+		};
+		return distance;
+	}
+
+        inline FT max_distance_to_rectangle(const Query_item& q,
+					     const Kd_tree_rectangle<FT,D>& r,std::vector<FT>& dists ) const {
+		FT distance=FT(0);
+		typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object();
+                typename SearchTraits::Cartesian_const_iterator_d qit = construct_it(q),
+		  qe = construct_it(q,1);
+		for(unsigned int i = 0;qit != qe; i++, qit++){
+				if ((*qit) <= (r.min_coord(i)+r.max_coord(i))/FT(2.0)){
+                                        dists[i] = (r.max_coord(i)-(*qit));
+					distance += dists[i] * dists[i];
+                                }
+				else{
+                                        dists[i] = ((*qit)-r.min_coord(i));
+					distance += dists[i] * dists[i];
+                                }
+		};
+		return distance;
+	}
+
+	inline FT new_distance(FT dist, FT old_off, FT new_off,
+			       int /* cutting_dimension */)  const {
+		
+		FT new_dist = dist + (new_off*new_off - old_off*old_off);
+                return new_dist;
+	}
+
+  inline FT transformed_distance(FT d) const {
+		return d*d;
+	}
+
+  inline FT inverse_of_transformed_distance(FT d) const {
+		return CGAL::sqrt(d);
+	}
+
+  }; // class Euclidean_distance
+
+} // namespace CGAL
+#endif // EUCLIDEAN_DISTANCE_H
diff --git a/3rdparty/CGAL/include/CGAL/Euclidean_distance_sphere_point.h b/3rdparty/CGAL/include/CGAL/Euclidean_distance_sphere_point.h
new file mode 100644
index 0000000..eea1408
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Euclidean_distance_sphere_point.h
@@ -0,0 +1,167 @@
+// Copyright (c) 2002,2011 Utrecht University (The Netherlands).
+// 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
+// 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(s)     : Hans Tangelder (<hanst at cs.uu.nl>)
+
+
+#ifndef CGAL_EUCLIDEAN_DISTANCE_SPHERE_POINT_H
+#define CGAL_EUCLIDEAN_DISTANCE_SPHERE_POINT_H
+
+#include <CGAL/Kd_tree_rectangle.h>
+#include <CGAL/number_utils.h>
+#include <CGAL/internal/Get_dimension_tag.h>
+
+namespace CGAL {
+
+  template <class SearchTraits>
+  class Euclidean_distance_sphere_point {
+   
+    
+    SearchTraits traits;
+    
+    public:
+
+    typedef typename SearchTraits::Point_d Point_d;
+    typedef typename SearchTraits::Sphere_d Sphere_d;
+    typedef typename SearchTraits::FT    FT;
+    typedef typename SearchTraits::Construct_center_d Construct_center_d;
+    typedef typename SearchTraits::Compute_squared_radius_d Compute_squared_radius_d;
+    typedef typename SearchTraits::Construct_cartesian_const_iterator_d Construct_cartesian_const_iterator_d;
+    typedef typename SearchTraits::Cartesian_const_iterator_d Cartesian_const_iterator_d;
+    typedef Sphere_d Query_item;   
+    typedef typename internal::Get_dimension_tag<SearchTraits>::Dimension Dimension;
+    public:
+
+    	// default constructor
+    	Euclidean_distance_sphere_point(const SearchTraits& traits_=SearchTraits()):traits(traits_) {}
+
+
+	inline FT transformed_distance(const Sphere_d& q, const Point_d& p) const {
+                Point_d c= Construct_center_d()(q);
+		FT distance = FT(0);
+		Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object();
+                Cartesian_const_iterator_d cit = construct_it(c),
+		  ce = construct_it(c,1), pit = construct_it(p);
+		for(; cit != ce; cit++, pit++){
+		  distance += ((*cit)-(*pit))*((*cit)-(*pit));
+		}
+                distance += - Compute_squared_radius_d()(q);
+                if (distance<0) distance=FT(0);
+        	return distance;
+	}
+
+
+	inline FT min_distance_to_rectangle(const Sphere_d& q,
+					     const Kd_tree_rectangle<FT,Dimension>& r) const {
+                Point_d c= Construct_center_d()(q);
+		FT distance = FT(0);
+		Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object();
+                Cartesian_const_iterator_d cit = construct_it(c),
+		  ce = construct_it(c,1);
+		for (unsigned int i = 0; cit != ce; ++i, ++cit) {
+			if ((*cit) < r.min_coord(i))
+				distance += 
+				(r.min_coord(i)-(*cit))*(r.min_coord(i)-(*cit));
+			else if ((*cit) > r.max_coord(i))
+				distance +=  
+				((*cit)-r.max_coord(i))*((*cit)-r.max_coord(i));
+			
+		};
+                distance += - Compute_squared_radius_d()(q);
+                if (distance<0) distance=FT(0);
+		return distance;
+	}
+
+        inline FT min_distance_to_rectangle(const Sphere_d& q,
+					     const Kd_tree_rectangle<FT,Dimension>& r,std::vector<FT>& dists) const {
+                Point_d c= Construct_center_d()(q);
+		FT distance = FT(0);
+		Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object();
+                Cartesian_const_iterator_d cit = construct_it(c),
+		  ce = construct_it(c,1);
+		for (unsigned int i = 0; cit != ce; ++i, ++cit) {
+			if ((*cit) < r.min_coord(i)){
+                                dists[i] =(r.min_coord(i)-(*cit));
+				distance += dists[i] * dists[i];
+                        }
+			else if ((*cit) > r.max_coord(i)){
+                                dists[i] = ((*cit)-r.max_coord(i));
+				distance +=  dists[i] * dists[i];
+                        }			
+		};
+                distance += - Compute_squared_radius_d()(q);
+                if (distance<0) distance=FT(0);
+		return distance;
+	}
+
+	inline FT max_distance_to_rectangle(const Sphere_d& q,
+					      const Kd_tree_rectangle<FT,Dimension>& r) const {
+	  Construct_center_d construct_center_d;
+                Point_d c = construct_center_d(q);
+		FT distance=FT(0);
+		Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object();
+                Cartesian_const_iterator_d cit = construct_it(c),
+		  ce = construct_it(c,1);
+		for (unsigned int i = 0; cit != ce; ++i, ++cit) {
+				if ((*cit) <= (r.min_coord(i)+r.max_coord(i))/FT(2.0))
+					distance += (r.max_coord(i)-(*cit))*(r.max_coord(i)-(*cit));
+				else
+					distance += ((*cit)-r.min_coord(i))*((*cit)-r.min_coord(i));
+		};
+		distance += - Compute_squared_radius_d()(q);
+                if (distance<0) distance=FT(0);
+		return distance;
+	}
+
+        inline FT max_distance_to_rectangle(const Sphere_d& q,
+					      const Kd_tree_rectangle<FT,Dimension>& r,std::vector<FT>& dists) const {
+	  Construct_center_d construct_center_d;
+                Point_d c = construct_center_d(q);
+		FT distance=FT(0);
+		Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object();
+                Cartesian_const_iterator_d cit = construct_it(c),
+		  ce = construct_it(c,1);
+		for (unsigned int i = 0; cit != ce; ++i, ++cit) {
+				if ((*cit) <= (r.min_coord(i)+r.max_coord(i))/FT(2.0)){
+                                        dists[i] = (r.max_coord(i)-(*cit));
+					distance += dists[i] * dists[i];
+                                }
+				else{
+                                        dists[i] = ((*cit)-r.min_coord(i));
+					distance += dists[i] * dists[i];
+                                }
+		};
+		distance += - Compute_squared_radius_d()(q);
+                if (distance<0) distance=FT(0);
+		return distance;
+	}
+
+
+
+  inline FT transformed_distance(FT d) const {
+		return d*d;
+	}
+
+  inline FT inverse_of_transformed_distance(FT d) const {
+		return CGAL::sqrt(d);
+	}
+
+  }; // class Euclidean_distance_sphere_point
+
+} // namespace CGAL
+#endif // EUCLIDEAN_DISTANCE_SPHERE_POINT_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Euler_integrator_2.h b/3rdparty/CGAL/include/CGAL/Euler_integrator_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Euler_integrator_2.h
rename to 3rdparty/CGAL/include/CGAL/Euler_integrator_2.h
diff --git a/3rdparty/CGAL/include/CGAL/Exact_circular_kernel_2.h b/3rdparty/CGAL/include/CGAL/Exact_circular_kernel_2.h
new file mode 100644
index 0000000..09e0032
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Exact_circular_kernel_2.h
@@ -0,0 +1,77 @@
+// Copyright (c) 2003-2008  INRIA Sophia-Antipolis (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
+// 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(s)     : Monique Teillaud, Sylvain Pion, Pedro Machado
+
+// Partially supported by the IST Programme of the EU as a Shared-cost
+// RTD (FET Open) Project under Contract No  IST-2000-26473 
+// (ECG - Effective Computational Geometry for Curves and Surfaces) 
+// and a STREP (FET Open) Project under Contract No  IST-006413 
+// (ACS -- Algorithms for Complex Shapes)
+
+#ifndef CGAL_EXACT_CIRCULAR_2_KERNEL_H
+#define CGAL_EXACT_CIRCULAR_2_KERNEL_H
+
+#include <CGAL/Cartesian.h>
+#include <CGAL/Algebraic_kernel_for_circles_2_2.h>
+#include <CGAL/Circular_kernel_2.h>
+
+
+//TODO: CORRECT THE MAKE_ROOT_OF_2 of GMPq GMPz
+#ifdef CGAL_USE_GMP
+#  include <CGAL/Gmpq.h>
+#else
+
+#  include <CGAL/MP_Float.h>
+#  include <CGAL/Quotient.h>
+
+#endif
+
+
+#include <CGAL/Filtered_bbox_circular_kernel_2.h>
+
+namespace CGAL {
+
+namespace internal {
+
+#ifdef CGAL_USE_GMP
+  typedef CGAL::Gmpq                                           NT1;
+#else
+
+  typedef Quotient<MP_Float>                       NT1;
+
+#endif
+
+  typedef Cartesian<NT1>                                 Linear_k1;
+  typedef Algebraic_kernel_for_circles_2_2<NT1>          Algebraic_k1;
+  typedef Circular_kernel_2<Linear_k1, Algebraic_k1>     CK1;
+
+//   typedef CGAL::Interval_nt_advanced                           NT2;
+//   typedef CGAL::Cartesian<NT2>                                 Linear_k2;
+//   typedef CGAL::Algebraic_kernel_for_circles_2_2<NT2>          Algebraic_k2;
+//   typedef CGAL::Circular_kernel_2<Linear_k2,Algebraic_k2>      CK2;
+
+//  typedef CGAL::Lazy_circular_kernel_2<CK1,CK2>
+//  Exact_circular_kernel_2;
+
+} // namespace internal
+
+typedef Filtered_bbox_circular_kernel_2<internal::CK1>   Exact_circular_kernel_2;
+
+} //namespace CGAL
+
+#endif // CGAL_EXACT_CIRCULAR_2_KERNEL_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Exact_integer.h b/3rdparty/CGAL/include/CGAL/Exact_integer.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Exact_integer.h
rename to 3rdparty/CGAL/include/CGAL/Exact_integer.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Exact_predicates_exact_constructions_kernel.h b/3rdparty/CGAL/include/CGAL/Exact_predicates_exact_constructions_kernel.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Exact_predicates_exact_constructions_kernel.h
rename to 3rdparty/CGAL/include/CGAL/Exact_predicates_exact_constructions_kernel.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Exact_predicates_exact_constructions_kernel_with_kth_root.h b/3rdparty/CGAL/include/CGAL/Exact_predicates_exact_constructions_kernel_with_kth_root.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Exact_predicates_exact_constructions_kernel_with_kth_root.h
rename to 3rdparty/CGAL/include/CGAL/Exact_predicates_exact_constructions_kernel_with_kth_root.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Exact_predicates_exact_constructions_kernel_with_root_of.h b/3rdparty/CGAL/include/CGAL/Exact_predicates_exact_constructions_kernel_with_root_of.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Exact_predicates_exact_constructions_kernel_with_root_of.h
rename to 3rdparty/CGAL/include/CGAL/Exact_predicates_exact_constructions_kernel_with_root_of.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Exact_predicates_exact_constructions_kernel_with_sqrt.h b/3rdparty/CGAL/include/CGAL/Exact_predicates_exact_constructions_kernel_with_sqrt.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Exact_predicates_exact_constructions_kernel_with_sqrt.h
rename to 3rdparty/CGAL/include/CGAL/Exact_predicates_exact_constructions_kernel_with_sqrt.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Exact_predicates_inexact_constructions_kernel.h b/3rdparty/CGAL/include/CGAL/Exact_predicates_inexact_constructions_kernel.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Exact_predicates_inexact_constructions_kernel.h
rename to 3rdparty/CGAL/include/CGAL/Exact_predicates_inexact_constructions_kernel.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Exact_rational.h b/3rdparty/CGAL/include/CGAL/Exact_rational.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Exact_rational.h
rename to 3rdparty/CGAL/include/CGAL/Exact_rational.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Exact_spherical_kernel_3.h b/3rdparty/CGAL/include/CGAL/Exact_spherical_kernel_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Exact_spherical_kernel_3.h
rename to 3rdparty/CGAL/include/CGAL/Exact_spherical_kernel_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Exponent_vector.h b/3rdparty/CGAL/include/CGAL/Exponent_vector.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Exponent_vector.h
rename to 3rdparty/CGAL/include/CGAL/Exponent_vector.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Extended_cartesian.h b/3rdparty/CGAL/include/CGAL/Extended_cartesian.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Extended_cartesian.h
rename to 3rdparty/CGAL/include/CGAL/Extended_cartesian.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Extended_homogeneous.h b/3rdparty/CGAL/include/CGAL/Extended_homogeneous.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Extended_homogeneous.h
rename to 3rdparty/CGAL/include/CGAL/Extended_homogeneous.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Extremal_polygon_traits_2.h b/3rdparty/CGAL/include/CGAL/Extremal_polygon_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Extremal_polygon_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Extremal_polygon_traits_2.h
diff --git a/3rdparty/CGAL/include/CGAL/FPU.h b/3rdparty/CGAL/include/CGAL/FPU.h
new file mode 100644
index 0000000..5705dda
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/FPU.h
@@ -0,0 +1,523 @@
+// Copyright (c) 1998-2008
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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(s)     : Sylvain Pion
+
+#ifndef CGAL_FPU_H
+#define CGAL_FPU_H
+
+#include <CGAL/assertions.h>
+#include <CGAL/use.h>
+
+#ifndef __INTEL_COMPILER
+#include <cmath> // for HUGE_VAL
+#endif
+
+// This file specifies some platform dependant functions, regarding the FPU
+// directed rounding modes.  There is only support for double precision.
+//
+// It also contains the definition of the Protect_FPU_rounding<> class,
+// which helps to protect blocks of code needing a particular rounding mode.
+
+#if defined __alpha__  && defined __linux__
+extern "C" {
+#  include <fenv.h>
+}
+#elif defined __SUNPRO_CC && defined __sun
+#  include <ieeefp.h>
+#elif defined __osf || defined __osf__
+#  ifdef __GNUG__
+     // GCC seems to remove (fixincludes) read_rnd/write_rnd...
+#    include "/usr/include/float.h"
+#  else
+#    include <cfloat>
+#  endif
+#elif defined _MSC_VER || defined __sparc__ || \
+     (defined __i386__ && !defined __PGI && !defined __SUNPRO_CC \
+      && !defined __SSE2__)
+   // Nothing to include.
+#else
+   // By default we use the ISO C99 version.
+#  include <fenv.h>
+#endif
+
+
+// Some useful constants
+
+#if defined CGAL_CFG_NO_LIMITS
+#  if defined CGAL_CFG_DENORMALS_COMPILE_BUG
+     // For compilers crashing when dealing with denormalized values.
+     // So we have to generate it at run time instead.
+#    define CGAL_IA_MIN_DOUBLE (CGAL::internal::get_static_minimin())
+#  else
+#    define CGAL_IA_MIN_DOUBLE (5e-324)
+#  endif
+#  define CGAL_IA_MAX_DOUBLE (1.7976931348623157081e+308)
+#else
+#  include <limits>
+#  define CGAL_IA_MIN_DOUBLE std::numeric_limits<double>::denorm_min()
+#  define CGAL_IA_MAX_DOUBLE (std::numeric_limits<double>::max)()
+#endif
+
+
+// Pure and safe SSE2 mode (g++ -mfpmath=sse && (-msse2 || -march=pentium4))
+// can be detected by :
+// TODO : see what Intel and VC++ have to say about this.
+#if defined __FLT_EVAL_METHOD__ && defined __SSE2_MATH__ && \
+      (__FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == 1)
+#  define CGAL_SAFE_SSE2
+#  include <xmmintrin.h>
+#endif
+
+// The CGAL_FPU_HAS_EXCESS_PRECISION macro is defined if some computations with
+// double can use more than the 53bits of precision of IEEE754, and/or if the
+// exponent has a wider range.  This can produce double rounding effects and
+// other bad things that we need to protect against.
+// The typical offender is the traditional FPU of x86 (SSE2-only mode is not affected).
+// Are there others, besides itanium and m68k?
+#if !defined CGAL_IA_NO_X86_OVER_UNDER_FLOW_PROTECT && \
+  (((defined __i386__ || defined __x86_64__) && !defined CGAL_SAFE_SSE2) \
+   || defined __ia64__ \
+   || defined _M_IX86 || defined _M_X64 || defined _M_IA64 \
+   || (defined FLT_EVAL_METHOD && FLT_EVAL_METHOD != 0 && FLT_EVAL_METHOD != 1))
+#  define CGAL_FPU_HAS_EXCESS_PRECISION
+#endif
+
+// Presence of SSE2 (for explicit use)
+#if  defined(__SSE2__) \
+  || (defined(_M_IX86_FP) && _M_IX86_FP >= 2) \
+  || defined(_M_X64)
+#  include <emmintrin.h>
+#  define CGAL_HAS_SSE2 1
+#endif
+
+// Only define CGAL_USE_SSE2 for 64 bits where malloc has a suitable
+// alignment, 32 bits is too dangerous.
+#if defined(CGAL_HAS_SSE2) && (defined(__x86_64__) || defined(_M_X64))
+#  define CGAL_USE_SSE2 1
+#endif
+
+#ifdef CGAL_CFG_DENORMALS_COMPILE_BUG
+double& get_static_minimin(); // Defined in Interval_arithmetic_impl.h
+#endif
+
+namespace CGAL {
+namespace internal {
+#ifdef __INTEL_COMPILER
+const double infinity = std::numeric_limits<double>::infinity();
+#else
+const double infinity = HUGE_VAL;
+#endif
+
+} // namespace internal
+
+#ifdef CGAL_HEADER_ONLY
+// Defined in test_FPU_rounding_mode_impl.h
+struct Check_FPU_rounding_mode_is_restored;
+inline const Check_FPU_rounding_mode_is_restored&
+get_static_check_fpu_rounding_mode_is_restored();
+#endif
+
+// Inline function to stop compiler optimizations that shouldn't happen with
+// pragma fenv on.
+// - constant propagation
+// - migration of fesetround across floating point operations
+// - (-a)-b -> -(a+b)
+// - (-a)*b -> -(a*b)
+// etc
+inline double IA_opacify(double x)
+{
+#ifdef __llvm__
+  // LLVM's support for inline asm is completely messed up:
+  // http://llvm.org/bugs/show_bug.cgi?id=17958
+  // http://llvm.org/bugs/show_bug.cgi?id=17959
+  // etc.
+  // This seems to produce code that is ok (not optimal but better than
+  // volatile). In case of trouble, use volatile instead.
+# ifdef CGAL_HAS_SSE2
+  asm volatile ("" : "+x"(x) );
+# elif (defined __VFP_FP__ && !defined __SOFTFP__) || defined __aarch64__
+  // ARM
+  asm volatile ("" : "+w"(x) );
+# else
+  asm volatile ("" : "+m"(x) );
+# endif
+  return x;
+#elif defined __xlC__
+  // PowerPC - XL C++ (the z/OS version supposedly does not define this macro)
+  // If we give it an alternative "+fm", it gets confused and generates worse code.
+  asm volatile ("" : "+f"(x) );
+  return x;
+#elif defined __GNUG__
+  // Intel used not to emulate this perfectly, we'll see.
+  // If we create a version of IA_opacify for vectors, note that gcc < 4.8
+  // fails with "+g" and we need to use "+mx" instead.
+  // "+X" ICEs ( http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59155 ) and
+  // may not be safe?
+  // The constraint 'g' doesn't include floating point registers ???
+  // Intel has a bug where -mno-sse still defines __SSE__ and __SSE2__
+  // (-mno-sse2 works though), no work-around for now.
+# if defined __SSE2_MATH__ || (defined __INTEL_COMPILER && defined __SSE2__)
+#  if __GNUC__ * 100 + __GNUC_MINOR__ >= 409
+  // ICEs in reload/LRA with older versions.
+  asm volatile ("" : "+gx"(x) );
+#  else
+  asm volatile ("" : "+mx"(x) );
+#  endif
+# elif (defined __i386__ || defined __x86_64__)
+  // "+f" doesn't compile on x86(_64)
+  // ( http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59157 )
+  // Don't mix "t" with "g": http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59180
+  // We can't put "t" with "x" either, prefer "x" for -mfpmath=sse,387.
+  // ( http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59181 )
+  asm volatile ("" : "+mt"(x) );
+# elif (defined __VFP_FP__ && !defined __SOFTFP__) || defined __aarch64__
+  // ARM
+  asm volatile ("" : "+gw"(x) );
+# elif defined __powerpc__ || defined __POWERPC__
+  // PowerPC
+  asm volatile ("" : "+gd"(x) );
+# elif defined __sparc
+  // Sparc
+  asm volatile ("" : "+ge"(x) );
+# elif defined __ia64
+  // Itanium
+  asm volatile ("" : "+gf"(x) );
+# else
+  asm volatile ("" : "+g"(x) );
+# endif
+  return x;
+#else
+  volatile double e = x;
+  return e;
+#endif
+}
+
+// Inline function to drop excess precision before we forget the rounding mode,
+// and stop compiler optimizations at the same time.
+inline double IA_force_to_double(double x)
+{
+#ifndef CGAL_FPU_HAS_EXCESS_PRECISION
+  return IA_opacify (x);
+#else
+#if defined __GNUG__
+#  ifdef CGAL_HAS_SSE2
+  // For an explanation of volatile:
+  // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56027
+  asm volatile ("" : "+mx"(x) );
+#  else
+  // Similar to writing to a volatile and reading back, except that calling
+  // it k times in a row only goes through memory once.
+  asm volatile ("" : "+m"(x) );
+#  endif
+  return x;
+#else
+  volatile double e = x;
+  return e;
+#endif
+#endif
+}
+
+// Interval arithmetic needs to protect against double-rounding effects
+// caused by excess FPU precision, even if it forces the 53bit mantissa
+// precision, because there is no way to fix the problem for the exponent
+// which has the same problem.  This affects underflow and overflow cases.
+// In case one does not care about such "extreme" situations, one can
+// set CGAL_IA_NO_X86_OVER_UNDER_FLOW_PROTECT to pretend there is no excess
+// precision.
+#if defined CGAL_FPU_HAS_EXCESS_PRECISION
+#  define CGAL_IA_FORCE_TO_DOUBLE(x) CGAL::IA_force_to_double(x)
+#elif 1
+// LLVM doesn't have -frounding-math so needs extra protection.
+// GCC also migrates fesetround calls over FP instructions, so protect
+// everyone.
+#  define CGAL_IA_FORCE_TO_DOUBLE(x) CGAL::IA_opacify(x)
+#else
+// Unused, reserved to compilers without excess precision and pragma fenv on.
+// ??? Should we trust Visual Studio not to optimize too much and let it use
+// this when CGAL_IA_NO_X86_OVER_UNDER_FLOW_PROTECT?
+#  define CGAL_IA_FORCE_TO_DOUBLE(x) (x)
+#endif
+
+// We sometimes need to stop constant propagation,
+// because operations are done with a wrong rounding mode at compile time.
+#ifndef CGAL_IA_DONT_STOP_CONSTANT_PROPAGATION
+#  define CGAL_IA_STOP_CPROP(x)    CGAL::IA_opacify(x)
+#else
+#  define CGAL_IA_STOP_CPROP(x)    (x)
+#endif
+
+// std::sqrt(double) on VC++ and CygWin is buggy when not optimizing.
+#if defined ( _MSC_VER ) && ! defined ( _WIN64 )
+inline double IA_bug_sqrt(double d)
+{
+  _asm
+  {
+    fld d
+    fsqrt
+    fstp d
+  }
+  return d;
+}
+
+#  define CGAL_BUG_SQRT(d) IA_bug_sqrt(d)
+
+
+#elif defined __SSE2_MATH__
+// For SSE2, we need to call __builtin_sqrt() instead of libc's sqrt().
+#  define CGAL_BUG_SQRT(d) __builtin_sqrt(d)
+#elif defined __CYGWIN__
+inline double IA_bug_sqrt(double d)
+{
+  double r;
+  asm volatile ("fsqrt" : "=t"(r) : "0"(d));
+  return r;
+}
+#  define CGAL_BUG_SQRT(d) IA_bug_sqrt(d)
+#else
+#  define CGAL_BUG_SQRT(d) std::sqrt(d)
+#endif
+
+// Here are the operator macros that make use of the above.
+// With GCC, we can do slightly better : test with __builtin_constant_p()
+// that both arguments are constant before stopping one of them.
+// Use inline functions instead ?
+#define CGAL_IA_ADD(a,b) CGAL_IA_FORCE_TO_DOUBLE((a)+CGAL_IA_STOP_CPROP(b))
+#define CGAL_IA_SUB(a,b) CGAL_IA_FORCE_TO_DOUBLE(CGAL_IA_STOP_CPROP(a)-(b))
+#define CGAL_IA_MUL(a,b) CGAL_IA_FORCE_TO_DOUBLE((a)*CGAL_IA_STOP_CPROP(b))
+#define CGAL_IA_DIV(a,b) CGAL_IA_FORCE_TO_DOUBLE((a)/CGAL_IA_STOP_CPROP(b))
+#define CGAL_IA_SQUARE(a) CGAL_IA_MUL(a,a)
+#define CGAL_IA_SQRT(a) \
+        CGAL_IA_FORCE_TO_DOUBLE(CGAL_BUG_SQRT(CGAL_IA_STOP_CPROP(a)))
+
+
+#if defined CGAL_SAFE_SSE2
+
+#define CGAL_IA_SETFPCW(CW) _MM_SET_ROUNDING_MODE(CW)
+#define CGAL_IA_GETFPCW(CW) CW = _MM_GET_ROUNDING_MODE()
+typedef unsigned int FPU_CW_t;
+#define CGAL_FE_TONEAREST    _MM_ROUND_NEAREST
+#define CGAL_FE_TOWARDZERO   _MM_ROUND_TOWARD_ZERO
+#define CGAL_FE_UPWARD       _MM_ROUND_UP
+#define CGAL_FE_DOWNWARD     _MM_ROUND_DOWN
+
+#elif defined __i386__ && !defined __PGI && !defined __SUNPRO_CC \
+      && !defined CGAL_HAS_SSE2
+// If we use both 387 and sse2, be safe and drop to fe[gs]etround.
+// Can we test CGAL_USE_SSE2 instead?
+
+// The GNU libc version (cf powerpc) is nicer, but doesn't work on libc 5 :(
+// This one also works with CygWin.
+// Note that the ISO C99 version may not be enough because of the extended
+// mantissa issue on x86 (may be required by some kinds of computation, but
+// as far as CGAL::Interval_nt<> is concerned, the double-rounding issues
+// are taking care of there).
+#define CGAL_IA_SETFPCW(CW) asm volatile ("fldcw %0" : :"m" (CW))
+#define CGAL_IA_GETFPCW(CW) asm volatile ("fnstcw %0" : "=m" (CW))
+typedef unsigned short FPU_CW_t;
+#define CGAL_FE_TONEAREST    (0x000 | 0x127f)
+#define CGAL_FE_TOWARDZERO   (0xc00 | 0x127f)
+#define CGAL_FE_UPWARD       (0x800 | 0x127f)
+#define CGAL_FE_DOWNWARD     (0x400 | 0x127f)
+
+#elif defined __SUNPRO_CC && defined __sun
+#define CGAL_IA_SETFPCW(CW) fpsetround(fp_rnd(CW))
+#define CGAL_IA_GETFPCW(CW) CW = fpgetround()
+typedef unsigned int FPU_CW_t;
+#define CGAL_FE_TONEAREST    FP_RN
+#define CGAL_FE_TOWARDZERO   FP_RZ
+#define CGAL_FE_UPWARD       FP_RP
+#define CGAL_FE_DOWNWARD     FP_RM
+
+#elif defined __sparc__
+#define CGAL_IA_SETFPCW(CW) asm volatile ("ld %0,%%fsr" : :"m" (CW))
+#define CGAL_IA_GETFPCW(CW) asm volatile ("st %%fsr,%0" : "=m" (CW))
+typedef unsigned int FPU_CW_t;
+#define CGAL_FE_TONEAREST    (0x0        | 0x20000000 | 0x1f)
+#define CGAL_FE_TOWARDZERO   (0x40000000 | 0x20000000 | 0x1f)
+#define CGAL_FE_UPWARD       (0x80000000 | 0x20000000 | 0x1f)
+#define CGAL_FE_DOWNWARD     (0xc0000000 | 0x20000000 | 0x1f)
+
+#elif defined __mips__
+#define CGAL_IA_SETFPCW(CW) asm volatile ("ctc1 %0,$31" : :"r" (CW))
+#define CGAL_IA_GETFPCW(CW) asm volatile ("cfc1 %0,$31" : "=r" (CW))
+typedef unsigned int FPU_CW_t;
+#define CGAL_FE_TONEAREST    (0x0)
+#define CGAL_FE_TOWARDZERO   (0x1)
+#define CGAL_FE_UPWARD       (0x2)
+#define CGAL_FE_DOWNWARD     (0x3)
+
+#elif defined __osf || defined __osf__  // Not yet supported.
+#define CGAL_IA_SETFPCW(CW) write_rnd(CW)
+#define CGAL_IA_GETFPCW(CW) CW = read_rnd()
+typedef unsigned int FPU_CW_t;
+#define CGAL_FE_TONEAREST    FP_RND_RN
+#define CGAL_FE_TOWARDZERO   FP_RND_RZ
+#define CGAL_FE_UPWARD       FP_RND_RP
+#define CGAL_FE_DOWNWARD     FP_RND_RM
+
+#elif defined ( _MSC_VER )
+#if ( _MSC_VER < 1400)
+#define CGAL_IA_SETFPCW(CW) _controlfp (CW, _MCW_RC )
+#define CGAL_IA_GETFPCW(CW) CW = _controlfp (0, 0 ) &  _MCW_RC
+typedef unsigned short FPU_CW_t;
+#else
+#define CGAL_IA_SETFPCW(CW) unsigned int dummy; _controlfp_s (&dummy, CW, _MCW_RC )
+#define CGAL_IA_GETFPCW(CW)_controlfp_s (&CW, 0, 0 ); CW  &=  _MCW_RC
+typedef unsigned int FPU_CW_t;
+#endif
+
+#define CGAL_FE_TONEAREST    _RC_NEAR
+#define CGAL_FE_TOWARDZERO   _RC_CHOP
+#define CGAL_FE_UPWARD       _RC_UP
+#define CGAL_FE_DOWNWARD     _RC_DOWN
+
+#else
+// This is a version following the ISO C99 standard, which aims at portability.
+// The drawbacks are speed on one hand, and also, on x86, it doesn't fix the
+// extended mantissa issue (this is not a problem for IA, but it is one for
+// some future modular computations).
+#define CGAL_IA_SETFPCW(CW)  fesetround(CW)
+#define CGAL_IA_GETFPCW(CW)  CW = fegetround()
+typedef int FPU_CW_t;
+#define CGAL_FE_TONEAREST    FE_TONEAREST
+#define CGAL_FE_TOWARDZERO   FE_TOWARDZERO
+#define CGAL_FE_UPWARD       FE_UPWARD
+#define CGAL_FE_DOWNWARD     FE_DOWNWARD
+#endif
+
+// User interface:
+
+inline
+FPU_CW_t
+FPU_get_cw (void)
+{
+    FPU_CW_t cw;
+    CGAL_IA_GETFPCW(cw);
+    return cw;
+}
+
+// User interface (cont):
+
+inline
+void
+FPU_set_cw (FPU_CW_t cw)
+{
+  CGAL_IA_SETFPCW(cw);
+}
+
+inline
+FPU_CW_t
+FPU_get_and_set_cw (FPU_CW_t cw)
+{
+    FPU_CW_t old = FPU_get_cw();
+    FPU_set_cw(cw);
+    return old;
+}
+
+
+// A class whose constructor sets the FPU mode to +inf, saves a backup of it,
+// and whose destructor resets it back to the saved state.
+
+template <bool Protected = true> struct Protect_FPU_rounding;
+
+template <>
+struct Protect_FPU_rounding<true>
+{
+  Protect_FPU_rounding(FPU_CW_t r = CGAL_FE_UPWARD)
+    : backup( FPU_get_and_set_cw(r) ) {}
+
+  ~Protect_FPU_rounding()
+  {
+     FPU_set_cw(backup);
+  }
+
+private:
+  FPU_CW_t backup;
+};
+
+template <>
+struct Protect_FPU_rounding<false>
+{
+  Protect_FPU_rounding() {}
+  Protect_FPU_rounding(FPU_CW_t /*= CGAL_FE_UPWARD*/) {}
+};
+
+
+// A wrapper on top of the Protect_FPU_rounding to add "expensive" checks
+// of the rounding mode.  It is used internally, to benefit from the
+// protector declarations to add checks in non-protected mode.
+
+template <bool Protected = true>
+struct Checked_protect_FPU_rounding
+  : Protect_FPU_rounding<Protected>
+{
+  Checked_protect_FPU_rounding()
+  {
+    CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_UPWARD);
+  }
+
+  Checked_protect_FPU_rounding(FPU_CW_t r)
+    : Protect_FPU_rounding<Protected>(r)
+  {
+    CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_UPWARD);
+  }
+};
+
+
+// The class Set_ieee_double_precision forces the double precision (53bit mantissa),
+// to protect from double rounding effects on x86 FPU.
+// ( Note that it also sets the rounding mode to nearest. )
+// Its destructor restores the FPU state as it was previously.
+// Note that this affects "long double" as well, and other potential side effects.
+// And note that it does not (cannot) "fix" the same problem for the exponent.
+
+struct Set_ieee_double_precision
+#ifdef CGAL_FPU_HAS_EXCESS_PRECISION
+  : public Protect_FPU_rounding<>
+{
+  Set_ieee_double_precision()
+    : Protect_FPU_rounding<>(CGAL_FE_TONEAREST) {}
+};
+#else
+{
+  Set_ieee_double_precision() {} // only to kill compiler warnings.
+};
+#endif
+
+
+// The following function serves the same goal as Set_ieee_double_precision but
+// does the change globally (no destructor resets the previous behavior).
+inline void force_ieee_double_precision()
+{
+#ifdef CGAL_FPU_HAS_EXCESS_PRECISION
+    FPU_set_cw(CGAL_FE_TONEAREST);
+#endif
+}
+
+} //namespace CGAL
+
+#ifdef CGAL_HEADER_ONLY
+#include <CGAL/test_FPU_rounding_mode_impl.h>
+#endif // CGAL_HEADER_ONLY
+
+#endif // CGAL_FPU_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/FPU_extension.h b/3rdparty/CGAL/include/CGAL/FPU_extension.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/FPU_extension.h
rename to 3rdparty/CGAL/include/CGAL/FPU_extension.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/FPU_gcc_i386.h b/3rdparty/CGAL/include/CGAL/FPU_gcc_i386.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/FPU_gcc_i386.h
rename to 3rdparty/CGAL/include/CGAL/FPU_gcc_i386.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/FPU_gcc_i386_sse2.h b/3rdparty/CGAL/include/CGAL/FPU_gcc_i386_sse2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/FPU_gcc_i386_sse2.h
rename to 3rdparty/CGAL/include/CGAL/FPU_gcc_i386_sse2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/FPU_msvc.h b/3rdparty/CGAL/include/CGAL/FPU_msvc.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/FPU_msvc.h
rename to 3rdparty/CGAL/include/CGAL/FPU_msvc.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Filter_circulator.h b/3rdparty/CGAL/include/CGAL/Filter_circulator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Filter_circulator.h
rename to 3rdparty/CGAL/include/CGAL/Filter_circulator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Filtered_bbox_circular_kernel_2.h b/3rdparty/CGAL/include/CGAL/Filtered_bbox_circular_kernel_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Filtered_bbox_circular_kernel_2.h
rename to 3rdparty/CGAL/include/CGAL/Filtered_bbox_circular_kernel_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Filtered_bbox_circular_kernel_2/bbox_filtered_predicates.h b/3rdparty/CGAL/include/CGAL/Filtered_bbox_circular_kernel_2/bbox_filtered_predicates.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Filtered_bbox_circular_kernel_2/bbox_filtered_predicates.h
rename to 3rdparty/CGAL/include/CGAL/Filtered_bbox_circular_kernel_2/bbox_filtered_predicates.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Filtered_bbox_circular_kernel_2/interface_macros.h b/3rdparty/CGAL/include/CGAL/Filtered_bbox_circular_kernel_2/interface_macros.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Filtered_bbox_circular_kernel_2/interface_macros.h
rename to 3rdparty/CGAL/include/CGAL/Filtered_bbox_circular_kernel_2/interface_macros.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Filtered_construction.h b/3rdparty/CGAL/include/CGAL/Filtered_construction.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Filtered_construction.h
rename to 3rdparty/CGAL/include/CGAL/Filtered_construction.h
diff --git a/3rdparty/CGAL/include/CGAL/Filtered_extended_homogeneous.h b/3rdparty/CGAL/include/CGAL/Filtered_extended_homogeneous.h
new file mode 100644
index 0000000..08ea67a
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Filtered_extended_homogeneous.h
@@ -0,0 +1,1287 @@
+// Copyright (c) 1997-2000  Max-Planck-Institute Saarbruecken (Germany).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Michael Seel <seel at mpi-sb.mpg.de>
+#ifndef CGAL_FILTERED_EXTENDED_HOMOGENEOUS_H
+#define CGAL_FILTERED_EXTENDED_HOMOGENEOUS_H
+
+#include <CGAL/basic.h>
+#include <CGAL/Handle_for.h>
+#include <CGAL/Interval_arithmetic.h>
+#include <CGAL/Homogeneous.h>
+#include <CGAL/number_utils.h>
+#undef CGAL_NEF_DEBUG
+#define CGAL_NEF_DEBUG 5
+#include <CGAL/Nef_2/debug.h>
+
+#define REDUCE_INTERSECTION_POINTS
+//#define KERNEL_ANALYSIS
+//#define KERNEL_CHECK
+
+#ifdef  KERNEL_CHECK
+#include <CGAL/Extended_homogeneous.h>
+#define CHECK(c1,c2) CGAL_assertion((c1) == (c2));
+#define PRINT_CHECK_ENABLED std::cout << "kernel check enabled!\n"
+#else
+#define CHECK(c1,c2)
+#define PRINT_CHECK_ENABLED std::cout << "no kernel check!\n"
+#endif
+
+#ifdef KERNEL_ANALYSIS
+#define DEFCOUNTER(c) \
+  static int c##_total=0; static int c##_exception=0;
+#define INCTOTAL(c) c##_total++
+#define INCEXCEPTION(c) c##_exception++
+#define PRINT_STATISTICS(c) \
+std::cout << #c##" " << c##_exception << "/" << c##_total << std::endl
+#else
+#define DEFCOUNTER(c)
+#define INCTOTAL(c)
+#define INCEXCEPTION(c)
+#define PRINT_STATISTICS(c)
+#endif
+
+namespace CGAL {
+
+template <typename RT>
+class SPolynomial {
+  RT _m,_n;
+public:
+  SPolynomial() : _m(),_n() {}
+  SPolynomial(const RT& m, const RT& n) : _m(m),_n(n) {}
+  SPolynomial(const RT& n) : _m(),_n(n) {}
+  SPolynomial(const SPolynomial<RT>& p) : _m(p._m),_n(p._n) {}
+  SPolynomial<RT>& operator=(const SPolynomial<RT>& p)
+  { _m=p._m; _n=p._n; return *this; }
+
+  const RT& m() const { return _m; }
+  const RT& n() const { return _n; }
+  void negate() { _m=-_m; _n=-_n; }
+
+  SPolynomial<RT> operator*(const RT& c) const
+  { return SPolynomial<RT>(c*_m,c*_n); }
+  SPolynomial<RT> operator+(const SPolynomial<RT>& p) const
+  { return SPolynomial<RT>(_m+p._m,_n+p._n); }
+  SPolynomial<RT> operator-(const SPolynomial<RT>& p) const
+  { return SPolynomial<RT>(_m-p._m,_n-p._n); }
+  SPolynomial<RT> operator-() const
+  { return SPolynomial<RT>(-_m,-_n); }
+  void operator /= (const RT& c)
+  { _m /= c; _n /= c; }
+  const RT& operator[](int i) { return (i%2 ? _n : _m); }
+  const RT& operator[](int i) const { return (i%2 ? _n : _m); }
+  bool is_zero() const { return (_m==0 && _n==0); }
+  int sign() const
+  { if ( _m != 0 ) return CGAL_NTS sign(_m);
+    return CGAL_NTS sign(_n);
+  }
+
+
+  // only for visualization:
+  static void set_R(const RT& R) { R_ = R; }
+  RT eval_at(const RT& r) const { return _m*r+_n; }
+  RT eval_at_R() const { return _m*R_+_n; }
+protected:
+  static RT R_;
+};
+
+template <class RT> RT SPolynomial<RT>::R_;
+
+template <typename RT>
+int sign(const SPolynomial<RT>& p)
+{
+  return p.sign();
+}
+
+
+template <typename RT>
+bool operator==(const SPolynomial<RT>& p1, const SPolynomial<RT>& p2)
+{ return (p1-p2).is_zero(); }
+
+template <typename RT>
+bool operator>(const SPolynomial<RT>& p1, const SPolynomial<RT>& p2)
+{ return (p1-p2).sign()>0; }
+
+template <typename RT>
+bool operator<(const SPolynomial<RT>& p1, const SPolynomial<RT>& p2)
+{ return (p1-p2).sign()<0; }
+
+template <typename RT>
+bool operator<(int i, const SPolynomial<RT>& p2)
+{
+  SPolynomial<RT> p1(i);
+  return (p1-p2).sign()<0;
+}
+
+
+template <typename RT>
+bool operator<(const SPolynomial<RT>& p1, int i)
+{
+  SPolynomial<RT> p2(i);
+  return (p1-p2).sign()<0;
+}
+
+template <class RT>
+inline double to_double(const SPolynomial<RT>& p)
+{ return (CGAL::to_double(p.eval_at(SPolynomial<RT>::R_))); }
+
+template <class RT>
+std::ostream& operator<<(std::ostream& os, const SPolynomial<RT>& p)
+{
+  switch( get_mode(os) ) {
+    case CGAL::IO::ASCII :
+      os << p.m() << " " << p.n(); break;
+    case CGAL::IO::BINARY :
+      CGAL::write(os,p.m());CGAL::write(os,p.n()); break;
+    default:
+      if ( p.m() == 0 ) os<<"["<<p.n()<<"]";
+      else os<<"["<<p.m()<<" R + "<<p.n()<<"]";
+  }
+  return os;
+}
+template <class RT>
+std::istream& operator>>(std::istream& is, SPolynomial<RT>& p)
+{ RT m,n;
+  switch( get_mode(is) ){
+    case CGAL::IO::ASCII :
+      is >> m >> n; p = SPolynomial<RT>(m,n); break;
+    case CGAL::IO::BINARY :
+      CGAL::read(is,m);CGAL::read(is,n);break;
+    default:
+    CGAL_error_msg("\nStream must be in ascii or binary mode\n");
+      break;
+  }
+  return is;
+}
+
+template <class RT> /*CGAL_KERNEL_INLINE*/
+CGAL::io_Operator io_tag(const SPolynomial<RT>&)
+{ return CGAL::io_Operator(); }
+
+
+template <typename RT>
+class SQuotient {
+  SPolynomial<RT> _p;
+  RT              _n;
+public:
+  SQuotient() : _p(),_n() {}
+  SQuotient(const SPolynomial<RT>& p, const RT& n) : _p(p),_n(n) {}
+  SQuotient(const SQuotient<RT>& p) : _p(p._p),_n(p._n) {}
+  SQuotient<RT>& operator=(const SQuotient<RT>& p)
+  { _p=p._p; _n=p._n; return *this; }
+  const SPolynomial<RT>& numerator() const { return _p; }
+  const RT&              denominator() const { return _n; }
+};
+
+template <class RT>
+inline double to_double(const SQuotient<RT>& q)
+{ return (CGAL::to_double(q.numerator().eval_at_R())/
+          CGAL::to_double(q.denominator())); }
+
+
+template <typename RT> class Extended_point;
+template <typename RT> class Extended_point_rep;
+
+template <typename RT>
+class Extended_point_rep {
+  friend class Extended_point<RT>;
+  SPolynomial<RT> x_,y_; RT w_;
+  typedef Interval_nt_advanced DT;
+  DT mxd,myd,nxd,nyd,wd;
+public:
+  Extended_point_rep(const RT& x, const RT& y, const RT& w) :
+    x_(x),y_(y),w_(w)
+  { CGAL_assertion_msg(w!=0,"denominator is zero.");
+    nxd=CGAL::to_interval(x);
+    nyd=CGAL::to_interval(y);
+    wd=CGAL::to_interval(w);
+    mxd=myd=0;
+  }
+
+  Extended_point_rep(const SPolynomial<RT>& x,
+                     const SPolynomial<RT>& y,
+                     const RT& w) : x_(x),y_(y),w_(w)
+  { CGAL_assertion_msg(w!=0,"denominator is zero.");
+    mxd=CGAL::to_interval(x.m());
+    myd=CGAL::to_interval(y.m());
+    nxd=CGAL::to_interval(x.n());
+    nyd=CGAL::to_interval(y.n());
+    wd=CGAL::to_interval(w);
+  }
+
+  Extended_point_rep() : x_(),y_(),w_() {}
+  ~Extended_point_rep() {}
+  void negate()
+  { x_ = -x_; y_ = -y_; w_ = -w_;
+    mxd = -mxd; myd = -myd; nxd = -nxd; nyd = -nyd; wd = -wd; }
+
+};
+
+template <typename RT_>
+class Extended_point : public Handle_for< Extended_point_rep<RT_> > {
+  typedef Extended_point_rep<RT_> Rep;
+  typedef Handle_for< Rep >       Base;
+
+  using Base::ptr;
+
+public:
+  typedef typename Rep::DT DT;
+  typedef RT_ RT;
+  typedef SPolynomial<RT>  SP;
+
+  Extended_point() : Base( Rep() ) {}
+
+  Extended_point(const RT& x, const RT& y, const RT& w) :
+    Base( Rep(x,y,w) )
+  { if (w < 0) this->ptr()->negate(); }
+
+  Extended_point(const SPolynomial<RT>& x,
+                 const SPolynomial<RT>& y,
+                 const RT& w) : Base( Rep(x,y,w) )
+  { if (w < 0) this->ptr()->negate(); }
+
+  Extended_point(const RT& mx, const RT& nx,
+                 const RT& my, const RT& ny, const RT& w) :
+    Base( Rep(SP(mx,nx), SP(my,ny), w) )
+  { if (w < 0) this->ptr()->negate(); }
+
+  Extended_point(const Extended_point<RT>& p) : Base(p) {}
+  ~Extended_point() {}
+
+  Extended_point& operator=(const Extended_point<RT>& p)
+  { Base::operator=(p); return *this; }
+
+  const RT& mx() const { return this->ptr()->x_.m(); }
+  const RT& nx() const { return this->ptr()->x_.n(); }
+  const RT& my() const { return this->ptr()->y_.m(); }
+  const RT& ny() const { return this->ptr()->y_.n(); }
+  const RT& hw()  const { return this->ptr()->w_; }
+  const DT& mxD() const { return this->ptr()->mxd; }
+  const DT& nxD() const { return this->ptr()->nxd; }
+  const DT& myD() const { return this->ptr()->myd; }
+  const DT& nyD() const { return this->ptr()->nyd; }
+  const DT& hwD() const { return this->ptr()->wd; }
+
+  SQuotient<RT> x() const
+  { return SQuotient<RT>(this->ptr()->x_, this->ptr()->w_); }
+  SQuotient<RT> y() const
+  { return SQuotient<RT>(this->ptr()->y_, this->ptr()->w_); }
+
+  const SPolynomial<RT> hx() const { return this->ptr()->x_; }
+  const SPolynomial<RT> hy() const { return this->ptr()->y_; }
+
+  bool is_standard() const { return (mx()==0)&&(my()==0); }
+  Extended_point<RT> opposite() const
+  { return Extended_point<RT>(-mx(),nx(),-my(),ny(),this->w()); }
+
+#ifdef KERNEL_CHECK
+typedef CGAL::Extended_homogeneous<RT_> CheckKernel;
+typedef typename CheckKernel::Point_2   CheckPoint;
+typedef typename CheckKernel::RT        CheckRT;
+
+CheckRT convert(const CGAL::SPolynomial<RT_>& p) const
+{ return CheckRT(p.n(),p.m()); }
+CheckRT convert(const RT_& t) const
+{ return CheckRT(t); }
+CheckPoint checkrep() const
+{ return CheckPoint(convert(hx()),convert(hy()),convert(w())); }
+
+#endif // KERNEL_CHECK
+
+
+};
+
+template <class RT>
+std::ostream& operator<<(std::ostream& os, const Extended_point<RT>& p)
+{ switch( get_mode(os) ) {
+    case CGAL::IO::ASCII :
+      os << p.hx() << " " << p.hy() << " " << p.hw(); break;
+    case CGAL::IO::BINARY :
+      CGAL::write(os,p.hx());CGAL::write(os,p.hy());
+      CGAL::write(os,p.hw()); break;
+    default:
+      os << "(" << p.hx() << "," << p.hy() << "," << p.hw() << ")";
+#if 0
+      os << "((" << CGAL::to_double(p.nx())/CGAL::to_double(p.hw()) << ","
+         << CGAL::to_double(p.ny())/CGAL::to_double(p.hw()) << "))";
+#endif
+  }
+  return os;
+}
+template <class RT>
+std::istream& operator>>(std::istream& is, Extended_point<RT>& p)
+{ SPolynomial<RT> x,y; RT w;
+  switch( get_mode(is) ){
+    case CGAL::IO::ASCII :
+      is >> x >> y >> w; break;
+    case CGAL::IO::BINARY :
+      CGAL::read(is,x);CGAL::read(is,y);CGAL::read(is,w); break;
+    default:
+    CGAL_error_msg("\nStream must be in ascii or binary mode\n");
+      break;
+  }
+  p = Extended_point<RT>(x,y,w);
+  return is;
+}
+
+
+template <typename NT> inline
+int orientation_coeff2(const NT& mx1, const NT& /*nx1*/,
+                       const NT& my1, const NT& /*ny1*/, const NT& w1,
+                       const NT& mx2, const NT& /*nx2*/,
+                       const NT& my2, const NT& /*ny2*/, const NT& w2,
+                       const NT& mx3, const NT& /*nx3*/,
+                       const NT& my3, const NT& /*ny3*/, const NT& w3)
+{
+  NT coeff2 = mx1*w3*my2-mx1*w2*my3+mx3*w2*my1-
+              mx2*w3*my1-mx3*w1*my2+mx2*w1*my3;
+  return CGAL_NTS sign(coeff2);
+}
+
+template <typename NT> inline
+int orientation_coeff1(const NT& mx1, const NT& nx1,
+                       const NT& my1, const NT& ny1, const NT& w1,
+                       const NT& mx2, const NT& nx2,
+                       const NT& my2, const NT& ny2, const NT& w2,
+                       const NT& mx3, const NT& nx3,
+                       const NT& my3, const NT& ny3, const NT& w3)
+{
+  NT coeff1 = mx1*w3*ny2-mx1*w2*ny3+nx1*w3*my2-mx2*w3*ny1-
+              nx1*w2*my3+mx2*w1*ny3-nx2*w3*my1+mx3*w2*ny1+
+              nx2*w1*my3-mx3*w1*ny2+nx3*w2*my1-nx3*w1*my2;
+  return CGAL_NTS sign(coeff1);
+}
+
+template <typename NT> inline
+int orientation_coeff0(const NT& /*mx1*/, const NT& nx1,
+                       const NT& /*my1*/, const NT& ny1, const NT& w1,
+                       const NT& /*mx2*/, const NT& nx2,
+                       const NT& /*my2*/, const NT& ny2, const NT& w2,
+                       const NT& /*mx3*/, const NT& nx3,
+                       const NT& /*my3*/, const NT& ny3, const NT& w3)
+{
+  NT coeff0 = -nx2*w3*ny1+nx1*w3*ny2+nx2*w1*ny3-
+               nx1*w2*ny3+nx3*w2*ny1-nx3*w1*ny2;
+  return CGAL_NTS sign(coeff0);
+}
+
+DEFCOUNTER(or0)
+DEFCOUNTER(or1)
+DEFCOUNTER(or2)
+template <typename RT>
+int orientation(const Extended_point<RT>& p1,
+                const Extended_point<RT>& p2,
+                const Extended_point<RT>& p3)
+{ CGAL_NEF_TRACEN("orientation "<<p1<<p2<<p3);
+  int res;
+  try { INCTOTAL(or2); Protect_FPU_rounding<true> Protection;
+    res = orientation_coeff2(p1.mxD(),p1.nxD(),p1.myD(),p1.nyD(),p1.hwD(),
+                             p2.mxD(),p2.nxD(),p2.myD(),p2.nyD(),p2.hwD(),
+                             p3.mxD(),p3.nxD(),p3.myD(),p3.nyD(),p3.hwD());
+  }
+  catch (Uncertain_conversion_exception) { INCEXCEPTION(or2);
+    res = orientation_coeff2(p1.mx(),p1.nx(),p1.my(),p1.ny(),p1.hw(),
+                             p2.mx(),p2.nx(),p2.my(),p2.ny(),p2.hw(),
+                             p3.mx(),p3.nx(),p3.my(),p3.ny(),p3.hw());
+  }
+  if ( res != 0 ) return res;
+
+  try { INCTOTAL(or1); Protect_FPU_rounding<true> Protection;
+    res = orientation_coeff1(p1.mxD(),p1.nxD(),p1.myD(),p1.nyD(),p1.hwD(),
+                             p2.mxD(),p2.nxD(),p2.myD(),p2.nyD(),p2.hwD(),
+                             p3.mxD(),p3.nxD(),p3.myD(),p3.nyD(),p3.hwD());
+  }
+  catch (Uncertain_conversion_exception) { INCEXCEPTION(or1);
+    res = orientation_coeff1(p1.mx(),p1.nx(),p1.my(),p1.ny(),p1.hw(),
+                             p2.mx(),p2.nx(),p2.my(),p2.ny(),p2.hw(),
+                             p3.mx(),p3.nx(),p3.my(),p3.ny(),p3.hw());
+  }
+  if ( res != 0 ) return res;
+
+  try { INCTOTAL(or0); Protect_FPU_rounding<true> Protection;
+    res = orientation_coeff0(p1.mxD(),p1.nxD(),p1.myD(),p1.nyD(),p1.hwD(),
+                             p2.mxD(),p2.nxD(),p2.myD(),p2.nyD(),p2.hwD(),
+                             p3.mxD(),p3.nxD(),p3.myD(),p3.nyD(),p3.hwD());
+  }
+  catch (Uncertain_conversion_exception) { INCEXCEPTION(or0);
+    res = orientation_coeff0(p1.mx(),p1.nx(),p1.my(),p1.ny(),p1.hw(),
+                             p2.mx(),p2.nx(),p2.my(),p2.ny(),p2.hw(),
+                             p3.mx(),p3.nx(),p3.my(),p3.ny(),p3.hw());
+  }
+  return res;
+}
+
+template <typename NT>
+inline
+int compare_expr(const NT& n1, const NT& d1,
+                 const NT& n2, const NT& d2)
+{ return CGAL_NTS sign( n1*d2 - n2*d1 ); }
+
+DEFCOUNTER(cmpx0)
+DEFCOUNTER(cmpx1)
+
+template <typename RT>
+int compare_x(const Extended_point<RT>& p1,
+              const Extended_point<RT>& p2)
+{
+  int res;
+  try { INCTOTAL(cmpx1); Protect_FPU_rounding<true> Protection;
+    res = compare_expr(p1.mxD(),p1.hwD(),p2.mxD(),p2.hwD());
+  }
+  catch (Uncertain_conversion_exception) { INCEXCEPTION(cmpx1);
+    res = compare_expr(p1.mx(),p1.hw(),p2.mx(),p2.hw());
+  }
+  if ( res != 0 ) return res;
+
+  try { INCTOTAL(cmpx0); Protect_FPU_rounding<true> Protection;
+    res = compare_expr(p1.nxD(),p1.hwD(),p2.nxD(),p2.hwD());
+  }
+  catch (Uncertain_conversion_exception) { INCEXCEPTION(cmpx0);
+    res = compare_expr(p1.nx(),p1.hw(),p2.nx(),p2.hw());
+  }
+  return res;
+}
+
+DEFCOUNTER(cmpy0)
+DEFCOUNTER(cmpy1)
+
+template <typename RT>
+int compare_y(const Extended_point<RT>& p1,
+              const Extended_point<RT>& p2)
+{
+  int res;
+  try { INCTOTAL(cmpy1); Protect_FPU_rounding<true> Protection;
+    res = compare_expr(p1.myD(),p1.hwD(),p2.myD(),p2.hwD());
+  }
+  catch (Uncertain_conversion_exception) { INCEXCEPTION(cmpy1);
+    res = compare_expr(p1.my(),p1.hw(),p2.my(),p2.hw());
+  }
+  if ( res != 0 ) return res;
+
+  try { INCTOTAL(cmpy0); Protect_FPU_rounding<true> Protection;
+    res = compare_expr(p1.nyD(),p1.hwD(),p2.nyD(),p2.hwD());
+  }
+  catch (Uncertain_conversion_exception) { INCEXCEPTION(cmpy0);
+    res = compare_expr(p1.ny(),p1.hw(),p2.ny(),p2.hw());
+  }
+  return res;
+}
+
+
+template <typename RT>
+inline
+int compare_xy(const Extended_point<RT>& p1,
+               const Extended_point<RT>& p2)
+{ int c1 = compare_x(p1,p2);
+  if ( c1 != 0 ) return c1;
+  else return compare_y(p1,p2);
+}
+
+template <typename RT>
+inline
+bool strictly_ordered_along_line(const Extended_point<RT>& p1,
+                                 const Extended_point<RT>& p2,
+                                 const Extended_point<RT>& p3)
+{ return ( orientation(p1,p2,p3) == 0 ) &&
+         ( compare_xy(p1,p2) * compare_xy(p2,p3) == 1 );
+}
+
+template <typename RT>
+inline bool operator==(const Extended_point<RT>& p1,
+                       const Extended_point<RT>& p2)
+{ CHECK(bool(compare_xy(p1,p2) == 0),p1.checkrep()==p2.checkrep())
+  return (p1.identical(p2) || compare_xy(p1,p2) == 0); }
+
+template <typename RT>
+inline bool operator!=(const Extended_point<RT>& p1,
+                       const Extended_point<RT>& p2)
+{ return !(p1==p2); }
+
+
+template <typename NT>
+inline
+int cmppd_coeff2(const NT& mx1, const NT& /*nx1*/,
+                 const NT& my1, const NT& /*ny1*/, const NT& w1,
+                 const NT& mx2, const NT& /*nx2*/,
+                 const NT& my2, const NT& /*ny2*/, const NT& w2,
+                 const NT& mx3, const NT& /*nx3*/,
+                 const NT& my3, const NT& /*ny3*/, const NT& w3,
+                 const NT& mx4, const NT& /*nx4*/,
+                 const NT& my4, const NT& /*ny4*/, const NT& w4)
+{
+  NT w1Q(w1*w1), w2Q(w2*w2), w3Q(w3*w3), w4Q(w4*w4);
+  NT w1w2Q(w1Q*w2Q), w3w4Q(w3Q*w4Q), two(2);
+  NT coeff2 =    w3w4Q * w2Q *mx1*mx1-
+                 two* w3w4Q  *w2*mx1*w1*mx2+
+                 w3w4Q * w1Q *mx2*mx2+
+                 w3w4Q * w2Q *my1*my1-
+                 two* w3w4Q  *w2*my1*w1*my2+
+                 w3w4Q * w1Q *my2*my2-
+                 w1w2Q * w4Q *mx3*mx3+
+                 two* w1w2Q  *w4*mx3*w3*mx4-
+                 w1w2Q * w3Q *mx4*mx4-
+                 w1w2Q * w4Q *my3*my3+
+                 two* w1w2Q  *w4*my3*w3*my4-
+                 w1w2Q * w3Q *my4*my4;
+  return CGAL_NTS sign(coeff2);
+}
+
+
+template <typename NT>
+inline
+int cmppd_coeff1(const NT& mx1, const NT& nx1,
+                 const NT& my1, const NT& ny1, const NT& w1,
+                 const NT& mx2, const NT& nx2,
+                 const NT& my2, const NT& ny2, const NT& w2,
+                 const NT& mx3, const NT& nx3,
+                 const NT& my3, const NT& ny3, const NT& w3,
+                 const NT& mx4, const NT& nx4,
+                 const NT& my4, const NT& ny4, const NT& w4)
+{
+  NT w1Q(w1*w1), w2Q(w2*w2), w3Q(w3*w3), w4Q(w4*w4);
+  NT w1w2Q(w1Q*w2Q), w3w4Q(w3Q*w4Q), two(2);
+  NT coeff1 = two * (w3w4Q * w1Q * mx2*nx2-
+                     w3w4Q * w2*my1*w1*ny2+
+                     w3w4Q * w1Q * my2*ny2+
+                     w1w2Q * w4*nx3*w3*mx4-
+                     w1w2Q * w4Q *mx3*nx3+
+                     w3w4Q * w2Q *mx1*nx1-
+                     w3w4Q * w2*mx1*w1*nx2-
+                     w3w4Q * w2*nx1*w1*mx2-
+                     w3w4Q * w2*ny1*w1*my2-
+                     w1w2Q * w4Q *my3*ny3+
+                     w1w2Q * w4*my3*w3*ny4+
+                     w1w2Q * w4*ny3*w3*my4+
+                     w3w4Q * w2Q *my1*ny1-
+                     w1w2Q * w3Q *my4*ny4+
+                     w1w2Q * w4*mx3*w3*nx4-
+                     w1w2Q * w3Q *mx4*nx4);
+  return CGAL_NTS sign(coeff1);
+}
+
+template <typename NT>
+inline
+int cmppd_coeff0(const NT& /*mx1*/, const NT& nx1,
+                 const NT& /*my1*/, const NT& ny1, const NT& w1,
+                 const NT& /*mx2*/, const NT& nx2,
+                 const NT& /*my2*/, const NT& ny2, const NT& w2,
+                 const NT& /*mx3*/, const NT& nx3,
+                 const NT& /*my3*/, const NT& ny3, const NT& w3,
+                 const NT& /*mx4*/, const NT& nx4,
+                 const NT& /*my4*/, const NT& ny4, const NT& w4)
+{
+  NT w1Q(w1*w1), w2Q(w2*w2), w3Q(w3*w3), w4Q(w4*w4);
+  NT w1w2Q(w1Q*w2Q), w3w4Q(w3Q*w4Q), two(2);
+  NT coeff0 = w3w4Q * (w1Q * ( nx2*nx2 + ny2*ny2 ) +
+                       w2Q * ( ny1*ny1 + nx1*nx1 )) -
+              w1w2Q * (w4Q * ( nx3*nx3 + ny3*ny3 ) +
+                       w3Q * ( nx4*nx4 + ny4*ny4 )) +
+              two* (- w3w4Q * (w2*nx1*w1*nx2 + w2*ny1*w1*ny2)
+                    + w1w2Q * (w4*ny3*w3*ny4 + w4*nx3*w3*nx4));
+  return CGAL_NTS sign(coeff0);
+}
+
+DEFCOUNTER(cmppd2)
+DEFCOUNTER(cmppd1)
+DEFCOUNTER(cmppd0)
+
+// leghth.mws
+template <typename RT>
+int compare_pair_dist(
+  const Extended_point<RT>& p1, const Extended_point<RT>& p2,
+  const Extended_point<RT>& p3, const Extended_point<RT>& p4)
+{
+  int res;
+  try { INCTOTAL(cmppd2); Protect_FPU_rounding<true> Protection;
+    res = cmppd_coeff2(p1.mxD(),p1.nxD(),p1.myD(),p1.nyD(),p1.hwD(),
+                       p2.mxD(),p2.nxD(),p2.myD(),p2.nyD(),p2.hwD(),
+                       p3.mxD(),p3.nxD(),p3.myD(),p3.nyD(),p3.hwD(),
+                       p4.mxD(),p4.nxD(),p4.myD(),p4.nyD(),p4.hwD());
+  }
+  catch (Uncertain_conversion_exception) { INCEXCEPTION(cmppd2);
+    res = cmppd_coeff2(p1.mx(),p1.nx(),p1.my(),p1.ny(),p1.hw(),
+                       p2.mx(),p2.nx(),p2.my(),p2.ny(),p2.hw(),
+                       p3.mx(),p3.nx(),p3.my(),p3.ny(),p3.hw(),
+                       p4.mx(),p4.nx(),p4.my(),p4.ny(),p4.hw());
+  }
+  if ( res != 0 ) return res;
+
+  try { INCTOTAL(cmppd1); Protect_FPU_rounding<true> Protection;
+    res = cmppd_coeff1(p1.mxD(),p1.nxD(),p1.myD(),p1.nyD(),p1.hwD(),
+                       p2.mxD(),p2.nxD(),p2.myD(),p2.nyD(),p2.hwD(),
+                       p3.mxD(),p3.nxD(),p3.myD(),p3.nyD(),p3.hwD(),
+                       p4.mxD(),p4.nxD(),p4.myD(),p4.nyD(),p4.hwD());
+  }
+  catch (Uncertain_conversion_exception) { INCEXCEPTION(cmppd1);
+    res = cmppd_coeff1(p1.mx(),p1.nx(),p1.my(),p1.ny(),p1.hw(),
+                       p2.mx(),p2.nx(),p2.my(),p2.ny(),p2.hw(),
+                       p3.mx(),p3.nx(),p3.my(),p3.ny(),p3.hw(),
+                       p4.mx(),p4.nx(),p4.my(),p4.ny(),p4.hw());
+  }
+  if ( res != 0 ) return res;
+
+  try { INCTOTAL(cmppd0); Protect_FPU_rounding<true> Protection;
+    res = cmppd_coeff0(p1.mxD(),p1.nxD(),p1.myD(),p1.nyD(),p1.hwD(),
+                       p2.mxD(),p2.nxD(),p2.myD(),p2.nyD(),p2.hwD(),
+                       p3.mxD(),p3.nxD(),p3.myD(),p3.nyD(),p3.hwD(),
+                       p4.mxD(),p4.nxD(),p4.myD(),p4.nyD(),p4.hwD());
+  }
+  catch (Uncertain_conversion_exception) { INCEXCEPTION(cmppd0);
+    res = cmppd_coeff0(p1.mx(),p1.nx(),p1.my(),p1.ny(),p1.hw(),
+                       p2.mx(),p2.nx(),p2.my(),p2.ny(),p2.hw(),
+                       p3.mx(),p3.nx(),p3.my(),p3.ny(),p3.hw(),
+                       p4.mx(),p4.nx(),p4.my(),p4.ny(),p4.hw());
+  }
+  return res;
+}
+
+
+template <typename RT>
+class Extended_segment {
+  Extended_point<RT> _p1,_p2;
+public:
+  Extended_segment() : _p1(),_p2() {}
+  Extended_segment(const Extended_point<RT>& p1,
+                   const Extended_point<RT>& p2) :
+    _p1(p1), _p2(p2) {}
+  Extended_segment(const Extended_segment<RT>& s) :
+    _p1(s._p1), _p2(s._p2) {}
+  Extended_segment<RT>& operator=(const Extended_segment<RT>& s)
+  { _p1 = s._p1; _p2 = s._p2; return *this; }
+
+  const Extended_point<RT>& source() const { return _p1; }
+  const Extended_point<RT>& target() const { return _p2; }
+
+  void line_equation(RT& a, RT& b, SPolynomial<RT>& c) const;
+};
+
+template <class RT>
+std::ostream& operator<<(std::ostream& os, const Extended_segment<RT>& s)
+{ os << s.source() << s.target(); return os; }
+template <class RT>
+std::istream& operator>>(std::istream& is, Extended_segment<RT>& s)
+{ Extended_point<RT> p1,p2;
+  is >> p1 >> p2; s=Extended_segment<RT>(p1,p2); return is; }
+
+template <typename RT>
+void Extended_segment<RT>::
+line_equation(RT& a, RT& b, SPolynomial<RT>& c) const
+{
+  bool sstandard = _p1.is_standard();
+  bool tstandard = _p2.is_standard();
+  if (sstandard && tstandard) {
+    a = _p1.ny()*_p2.hw() - _p2.ny()*_p1.hw();
+    b = _p1.hw()*_p2.nx() - _p2.hw()*_p1.nx();
+    c = SPolynomial<RT>(_p1.nx()*_p2.ny() - _p2.nx()*_p1.ny());
+    return;
+
+  }
+  Extended_point<RT> p;
+  bool correct_orientation=true;
+  if (!sstandard && !tstandard) {
+    bool x_equal = (_p1.hx()*_p2.hw() - _p2.hx()*_p1.hw()).is_zero();
+    bool y_equal = (_p1.hy()*_p2.hw() - _p2.hy()*_p1.hw()).is_zero();
+    if (x_equal && CGAL_NTS abs(_p1.mx())==_p1.hw() && _p1.nx()==0 )
+    { int dy = (_p2.hy()-_p1.hy()).sign();
+      a=-dy; b=0; c = SPolynomial<RT>(dy*_p1.hx().sign(),0); return; }
+    if (y_equal && CGAL_NTS abs(_p1.my())==_p1.hw() && _p1.ny()==0 )
+    { int dx = (_p2.hx()-_p1.hx()).sign();
+      a=0; b=dx; c = SPolynomial<RT>(-dx*_p1.hy().sign(),0); return; }
+    p = _p2; // evaluation according to mixed case
+
+  }
+  else if (sstandard && !tstandard)
+  { p = _p2; }
+  else if (!sstandard && tstandard)
+  { p = _p1; correct_orientation=false; }
+  RT w = p.hw();
+  RT ci;
+  if ( correct_orientation ) {
+    a = -p.my();
+    b =  p.mx();
+    ci = (p.nx()*p.my()-p.ny()*p.mx())/w;
+  } else {
+    a =  p.my();
+    b = -p.mx();
+    ci = (p.ny()*p.mx()-p.nx()*p.my())/w;
+  }
+  c = SPolynomial<RT>(ci);
+
+
+
+}
+
+template <typename RT>
+Extended_point<RT> intersection(
+  const Extended_segment<RT>& s1, const Extended_segment<RT>& s2)
+{
+  RT a1,b1,a2,b2;
+  SPolynomial<RT> c1,c2;
+  s1.line_equation(a1,b1,c1);
+  s2.line_equation(a2,b2,c2);
+  SPolynomial<RT> x = c2*b1 - c1*b2;
+  SPolynomial<RT> y = c1*a2 - c2*a1;
+  RT w = a1*b2 - a2*b1; CGAL_assertion(w!=0);
+  #ifdef REDUCE_INTERSECTION_POINTS
+  RT xgcd,ygcd;
+  if ( x.m() == RT(0) )  xgcd = ( x.n() == 0 ? RT(1) : x.n() );
+  else /* != 0 */    xgcd = ( x.n() == 0 ? x.m() : CGAL_NTS gcd(x.m(),x.n()) );
+  if ( y.m() == RT(0) )  ygcd = ( y.n() == 0 ? RT(1) : y.n() );
+  else /* != 0 */    ygcd = ( y.n() == 0 ? y.m() : CGAL_NTS gcd(y.m(),y.n()) );
+  RT d = CGAL_NTS gcd(w,CGAL_NTS gcd(xgcd,ygcd));
+  x /= d;
+  y /= d;
+  w /= d;
+  #endif // REDUCE_INTERSECTION_POINTS
+  return Extended_point<RT>(x,y,w);
+}
+
+template <typename RT>
+inline
+int orientation(const Extended_segment<RT>& s, const Extended_point<RT>& p)
+{ return orientation(s.source(),s.target(),p); }
+
+template <typename RT>
+inline
+bool is_degenerate(const Extended_segment<RT>& s)
+{ return s.source()==s.target(); }
+
+template <typename RT>
+inline
+bool contains(const Extended_segment<RT>& s,
+              const Extended_point<RT>& p)
+{ int p_rel_source = compare_xy(p,s.source());
+  int p_rel_target = compare_xy(p,s.target());
+  return ( orientation(s,p) == 0 ) &&
+    ( ( p_rel_source >= 0 && p_rel_target <= 0 ) ||
+      ( p_rel_source <= 0 && p_rel_target >= 0 ) );
+}
+
+
+template <typename RT>
+class Extended_direction {
+  Extended_point<RT> _p1,_p2;
+public:
+  Extended_direction() : _p1(),_p2() {}
+  Extended_direction(const Extended_direction<RT>& d) :
+    _p1(d._p1),_p2(d._p2) {}
+  Extended_direction<RT>& operator=(const Extended_direction<RT>& d)
+  { _p1 = d._p1; _p2 = d._p2; return *this; }
+
+  Extended_direction(const Extended_point<RT>& p1,
+                     const Extended_point<RT>& p2) :
+    _p1(p1),_p2(p2) {}
+
+  Extended_direction(const RT& x, const RT& y) :
+    _p1(0,0,1),_p2(x,y,1) {}
+
+  const Extended_point<RT>& p1() const { return _p1; }
+  const Extended_point<RT>& p2() const { return _p2; }
+  int dx_sign() const
+  { return (_p2.hx()*_p1.hw()-_p1.hx()*_p2.hw()).sign(); }
+  int dy_sign() const
+  { return (_p2.hy()*_p1.hw()-_p1.hy()*_p2.hw()).sign(); }
+};
+
+template <class RT>
+std::ostream& operator<<(std::ostream& os, const Extended_direction<RT>& d)
+{ os << d.p1() << "," << d.p2();
+  return os; }
+template <class RT>
+std::istream& operator>>(std::istream& is, Extended_direction<RT>& d)
+{ Extended_point<RT> x,y;
+  is >> x >> y; d = Extended_direction<RT>(x,y);
+  return is; }
+
+
+template <typename NT>
+inline
+int coeff2_dor(const NT& mx1, const NT& /*nx1*/,
+               const NT& my1, const NT& /*ny1*/, const NT& w1,
+               const NT& mx2, const NT& /*nx2*/,
+               const NT& my2, const NT& /*ny2*/, const NT& w2,
+               const NT& mx3, const NT& /*nx3*/,
+               const NT& my3, const NT& /*ny3*/, const NT& w3,
+               const NT& mx4, const NT& /*nx4*/,
+               const NT& my4, const NT& /*ny4*/, const NT& w4)
+{
+  NT coeff2 = w1*mx2*w3*my4-w1*mx2*w4*my3-w2*mx1*w3*my4+w2*mx1*w4*my3-
+              w1*my2*w3*mx4+w1*my2*w4*mx3+w2*my1*w3*mx4-w2*my1*w4*mx3;
+  return CGAL_NTS sign(coeff2);
+}
+
+template <typename NT>
+inline
+int coeff1_dor(const NT& mx1, const NT& nx1,
+               const NT& my1, const NT& ny1, const NT& w1,
+               const NT& mx2, const NT& nx2,
+               const NT& my2, const NT& ny2, const NT& w2,
+               const NT& mx3, const NT& nx3,
+               const NT& my3, const NT& ny3, const NT& w3,
+               const NT& mx4, const NT& nx4,
+               const NT& my4, const NT& ny4, const NT& w4)
+{
+  NT coeff1 = -w1*my2*w3*nx4+w1*mx2*w3*ny4+w1*my2*w4*nx3-w1*mx2*w4*ny3+
+               w1*nx2*w3*my4-w1*nx2*w4*my3+w2*my1*w3*nx4-w2*mx1*w3*ny4-
+               w2*my1*w4*nx3+w2*mx1*w4*ny3-w2*nx1*w3*my4+w2*nx1*w4*my3-
+               w1*ny2*w3*mx4+w1*ny2*w4*mx3+w2*ny1*w3*mx4-w2*ny1*w4*mx3;
+  return CGAL_NTS sign(coeff1);
+}
+
+template <typename NT>
+inline
+int coeff0_dor(const NT& /*mx1*/, const NT& nx1,
+               const NT& /*my1*/, const NT& ny1, const NT& w1,
+               const NT& /*mx2*/, const NT& nx2,
+               const NT& /*my2*/, const NT& ny2, const NT& w2,
+               const NT& /*mx3*/, const NT& nx3,
+               const NT& /*my3*/, const NT& ny3, const NT& w3,
+               const NT& /*mx4*/, const NT& nx4,
+               const NT& /*my4*/, const NT& ny4, const NT& w4)
+{
+  NT coeff0 = w1*nx2*w3*ny4-w1*nx2*w4*ny3-w2*nx1*w3*ny4+w2*nx1*w4*ny3-
+              w1*ny2*w3*nx4+w1*ny2*w4*nx3+w2*ny1*w3*nx4-w2*ny1*w4*nx3;
+  return CGAL_NTS sign(coeff0);
+}
+
+DEFCOUNTER(ord2)
+DEFCOUNTER(ord1)
+DEFCOUNTER(ord0)
+
+
+template <typename RT>
+inline
+int orientation(const Extended_direction<RT>& d1,
+                const Extended_direction<RT>& d2)
+{
+  Extended_point<RT> p1(d1.p1()), p2(d1.p2()),
+                     p3(d2.p1()), p4(d2.p2());
+  int res;
+  try { INCTOTAL(ord2); Protect_FPU_rounding<true> Protection;
+    res = coeff2_dor(p1.mxD(),p1.nxD(),p1.myD(),p1.nyD(),p1.hwD(),
+                     p2.mxD(),p2.nxD(),p2.myD(),p2.nyD(),p2.hwD(),
+                     p3.mxD(),p3.nxD(),p3.myD(),p3.nyD(),p3.hwD(),
+                     p4.mxD(),p4.nxD(),p4.myD(),p4.nyD(),p4.hwD());
+  } catch (Uncertain_conversion_exception) { INCEXCEPTION(ord2);
+    res = coeff2_dor(p1.mx(),p1.nx(),p1.my(),p1.ny(),p1.hw(),
+                     p2.mx(),p2.nx(),p2.my(),p2.ny(),p2.hw(),
+                     p3.mx(),p3.nx(),p3.my(),p3.ny(),p3.hw(),
+                     p4.mx(),p4.nx(),p4.my(),p4.ny(),p4.hw());
+  }
+  if ( res != 0 ) return res;
+
+  try { INCTOTAL(ord1); Protect_FPU_rounding<true> Protection;
+    res = coeff1_dor(p1.mxD(),p1.nxD(),p1.myD(),p1.nyD(),p1.hwD(),
+                     p2.mxD(),p2.nxD(),p2.myD(),p2.nyD(),p2.hwD(),
+                     p3.mxD(),p3.nxD(),p3.myD(),p3.nyD(),p3.hwD(),
+                     p4.mxD(),p4.nxD(),p4.myD(),p4.nyD(),p4.hwD());
+  } catch (Uncertain_conversion_exception) { INCEXCEPTION(ord1);
+    res = coeff1_dor(p1.mx(),p1.nx(),p1.my(),p1.ny(),p1.hw(),
+                     p2.mx(),p2.nx(),p2.my(),p2.ny(),p2.hw(),
+                     p3.mx(),p3.nx(),p3.my(),p3.ny(),p3.hw(),
+                     p4.mx(),p4.nx(),p4.my(),p4.ny(),p4.hw());
+  }
+  if ( res != 0 ) return res;
+  try { INCTOTAL(ord0); Protect_FPU_rounding<true> Protection;
+    res = coeff0_dor(p1.mxD(),p1.nxD(),p1.myD(),p1.nyD(),p1.hwD(),
+                     p2.mxD(),p2.nxD(),p2.myD(),p2.nyD(),p2.hwD(),
+                     p3.mxD(),p3.nxD(),p3.myD(),p3.nyD(),p3.hwD(),
+                     p4.mxD(),p4.nxD(),p4.myD(),p4.nyD(),p4.hwD());
+  } catch (Uncertain_conversion_exception) { INCEXCEPTION(ord0);
+    res = coeff0_dor(p1.mx(),p1.nx(),p1.my(),p1.ny(),p1.hw(),
+                     p2.mx(),p2.nx(),p2.my(),p2.ny(),p2.hw(),
+                     p3.mx(),p3.nx(),p3.my(),p3.ny(),p3.hw(),
+                     p4.mx(),p4.nx(),p4.my(),p4.ny(),p4.hw());
+  }
+  return res;
+}
+
+template <typename RT>
+inline
+bool operator==(const Extended_direction<RT>& d1,
+                const Extended_direction<RT>& d2)
+{
+  return orientation(d1,d2) == 0 &&
+         d1.dx_sign() == d2.dx_sign() &&
+         d1.dy_sign() == d2.dy_sign();
+}
+
+template <typename RT>
+inline
+bool operator!=(const Extended_direction<RT>& d1,
+                const Extended_direction<RT>& d2)
+{ return !(d1==d2); }
+
+
+template <typename RT>
+bool strictly_ordered_ccw(const Extended_direction<RT>& d1,
+                          const Extended_direction<RT>& d2,
+                          const Extended_direction<RT>& d3)
+{
+  if (d1 == d3) return (d1 != d2);
+  int or12 = orientation(d1,d2);
+  int or13 = orientation(d1,d3);
+  int or32 = orientation(d3,d2);
+  if ( or13 >= 0 ) // not right_turn
+    return ( or12 > 0 && or32 < 0 );
+  else // ( or13 < 0 ) right_turn
+    return ( or12 > 0 || or32 < 0 );
+}
+
+template <typename RT>
+inline
+bool operator<(const Extended_direction<RT>& d1,
+               const Extended_direction<RT>& d2)
+{ Extended_direction<RT> d0(1,0);
+  bool d0d1eq = (d1 == d0);
+  bool d0d2eq = (d2 == d0);
+  return ( (d0d1eq && !d0d2eq) ||
+           ( strictly_ordered_ccw(d0,d1,d2) && (! d0d2eq) ) );
+}
+
+
+
+template<class Kernel>
+struct Is_extended_kernel;
+template <typename RT_>
+class Filtered_extended_homogeneous;
+
+template<class T>
+struct Is_extended_kernel<Filtered_extended_homogeneous<T> > {
+       typedef Tag_true value_type;
+};
+
+
+template <typename RT_>
+class Filtered_extended_homogeneous {
+typedef Filtered_extended_homogeneous<RT_> Self;
+
+public:
+typedef CGAL::Homogeneous<RT_> Standard_kernel;
+typedef typename Standard_kernel::RT           Standard_RT;
+typedef typename Standard_kernel::FT           Standard_FT;
+typedef typename Standard_kernel::Point_2      Standard_point_2;
+typedef typename Standard_kernel::Segment_2    Standard_segment_2;
+typedef typename Standard_kernel::Line_2       Standard_line_2;
+typedef typename Standard_kernel::Direction_2  Standard_direction_2;
+typedef typename Standard_kernel::Ray_2        Standard_ray_2;
+typedef typename Standard_kernel::Aff_transformation_2
+  Standard_aff_transformation_2;
+
+typedef SPolynomial<RT_>        RT;
+typedef SQuotient<RT_>          FT;
+typedef Extended_point<RT_>     Point_2;
+typedef Extended_segment<RT_>   Segment_2;
+typedef Extended_direction<RT_> Direction_2;
+#ifdef KERNEL_CHECK
+typedef Extended_homogeneous<RT_>         CheckKernel;
+typedef typename CheckKernel::Point_2     CheckPoint;
+typedef typename CheckKernel::Direction_2 CheckDirection;
+typedef typename CheckKernel::Segment_2   CheckSegment;
+CheckKernel K;
+
+CheckSegment convert(const Segment_2& s) const
+{ return CheckSegment(s.source().checkrep(),
+                      s.target().checkrep()); }
+CheckDirection convert(const Direction_2& d) const
+{ return K.construct_direction(d.p2().checkrep(),d.p1().checkrep()); }
+
+#endif // KERNEL_CHECK
+
+
+
+
+enum Point_type { SWCORNER=1, LEFTFRAME, NWCORNER,
+                  BOTTOMFRAME, STANDARD, TOPFRAME,
+                  SECORNER, RIGHTFRAME, NECORNER };
+
+Standard_RT dx(const Standard_line_2& l) const { return l.b(); }
+Standard_RT dy(const Standard_line_2& l) const { return -l.a(); }
+Standard_FT abscissa_distance(const Standard_line_2& l) const {
+  typename CGAL::Rational_traits<typename Standard_kernel::FT> rat_traits;
+  return rat_traits.make_rational(-l.c(), l.b());
+  //  return -l.c() / l.b();
+}
+
+Point_type determine_type(const Standard_line_2& l) const
+{
+  // CGAL_NEF_TRACEN("determine_type "<<l);
+  Standard_RT adx = CGAL_NTS abs(dx(l)), ady = CGAL_NTS abs(dy(l));
+  int sdx = CGAL_NTS sign(dx(l)), sdy = CGAL_NTS sign(dy(l));
+  int cmp_dx_dy = CGAL_NTS compare(adx,ady), s(1);
+  // CGAL_NEF_TRACEN("   "<<cmp_dx_dy<<" "<<sdx<<" "<<sdy);
+  if (sdx < 0 && ( cmp_dx_dy > 0 || ( cmp_dx_dy == 0 &&
+                                      sdy != (s=CGAL_NTS sign(abscissa_distance(l)))))) {
+    if (0 == s) return ( sdy < 0 ? SWCORNER : NWCORNER );
+    else        return LEFTFRAME;
+  } else if (sdx > 0 && ( cmp_dx_dy > 0 || ( cmp_dx_dy == 0 &&
+                                             sdy != (s=CGAL_NTS sign(abscissa_distance(l)))))) {
+    if (0 == s) return ( sdy < 0 ? SECORNER : NECORNER );
+    else        return RIGHTFRAME;
+  } else if (sdy < 0 && ( cmp_dx_dy < 0 || ( cmp_dx_dy == 0 &&
+                                             abscissa_distance(l) < Standard_FT(0)))) {
+    return BOTTOMFRAME;
+  } else if (sdy > 0 && ( cmp_dx_dy < 0 || ( cmp_dx_dy == 0 &&
+                                             abscissa_distance(l) > Standard_FT(0)))) {
+    return TOPFRAME;
+  }
+  CGAL_error_msg(" determine_type: degenerate line.");
+  return (Point_type)-1; // never come here
+}
+
+Point_2 epoint(const Standard_RT& m1, const Standard_RT& n1,
+                  const Standard_RT& m2, const Standard_RT& n2,
+                                 const Standard_RT& n3) const
+{ return Point_2(m1,n1,m2,n2,n3); }
+
+public:
+
+Point_2 construct_point(const Standard_point_2& p) const
+{ return Point_2(p.hx(), p.hy(), p.hw()); }
+
+Point_2 construct_point(const Standard_line_2& l, Point_type& t) const
+{
+  t = determine_type(l);
+  // CGAL_NEF_TRACEN("construct_point(line)"<<l<<" "<<t);
+  Point_2 res;
+  switch (t) {
+    case SWCORNER:   res = epoint(-1, 0, -1, 0, 1); break;
+    case NWCORNER:   res = epoint(-1, 0,  1, 0, 1); break;
+    case SECORNER:   res = epoint( 1, 0, -1, 0, 1); break;
+    case NECORNER:   res = epoint( 1, 0,  1, 0, 1); break;
+    case LEFTFRAME:  res = epoint(-l.b(), 0,  l.a(), -l.c(), l.b());
+                     break;
+    case RIGHTFRAME: res = epoint( l.b(), 0, -l.a(), -l.c(), l.b());
+                     break;
+    case BOTTOMFRAME: res = epoint( l.b(), -l.c(), -l.a(), 0, l.a());
+                     break;
+    case TOPFRAME: res = epoint(-l.b(), -l.c(),  l.a(), 0, l.a());
+                     break;
+    default: CGAL_error_msg("EPoint type not correct!");
+  }
+  return res;
+}
+
+Point_2 construct_point(const Standard_point_2& p1,
+                        const Standard_point_2& p2,
+                        Point_type& t) const
+{ return construct_point(Standard_line_2(p1,p2),t); }
+Point_2 construct_point(const Standard_line_2& l) const
+{ Point_type dummy; return construct_point(l,dummy); }
+Point_2 construct_point(const Standard_point_2& p1,
+                        const Standard_point_2& p2) const
+{ return construct_point(Standard_line_2(p1,p2)); }
+Point_2 construct_point(const Standard_point_2& p,
+                        const Standard_direction_2& d) const
+{ return construct_point(Standard_line_2(p,d)); }
+Point_2 construct_opposite_point(const Standard_line_2& l) const
+{ Point_type dummy; return construct_point(l.opposite(),dummy); }
+
+Point_type type(const Point_2& p) const
+{
+  if (p.is_standard()) return STANDARD;
+  // now we are on the square frame
+  RT rx = p.hx();
+  RT ry = p.hy();
+  int sx = CGAL_NTS sign(rx);
+  int sy = CGAL_NTS sign(ry);
+  if (sx < 0) rx = -rx;
+  if (sy < 0) ry = -ry;
+  if (rx>ry) {
+    if (sx > 0) return RIGHTFRAME;
+    else        return LEFTFRAME;
+  }
+  if (rx<ry) {
+    if (sy > 0) return TOPFRAME;
+    else        return BOTTOMFRAME;
+  }
+  // now (rx == ry)
+  if (sx==sy) {
+    if (sx < 0) return SWCORNER;
+    else        return NECORNER;
+  } else { CGAL_assertion(sx==-sy);
+    if (sx < 0) return NWCORNER;
+    else        return SECORNER;
+  }
+}
+
+
+bool is_standard(const Point_2& p) const
+{ return p.is_standard();  }
+
+Standard_point_2 standard_point(const Point_2& p) const
+{ CGAL_assertion(is_standard(p));
+  return Standard_point_2(p.nx(),p.ny(),p.hw());
+}
+
+Standard_line_2 standard_line(const Point_2& p) const
+{ CGAL_assertion(!p.is_standard());
+  Standard_point_2 p0(p.nx(),p.ny(),p.hw());
+  Standard_point_2 p1(p.mx()+p.nx(),p.my()+p.ny(),p.hw());
+  return Standard_line_2(p0,p1);
+}
+
+Standard_ray_2 standard_ray(const Point_2& p) const
+{ CGAL_assertion(!p.is_standard());
+  Standard_line_2 l = standard_line(p);
+  Standard_direction_2 d = l.direction();
+  Standard_point_2 q = l.point(0);
+  return Standard_ray_2(q,d);
+}
+
+Point_2 NE() const { return construct_point(Standard_line_2(-1, 1,0)); }
+Point_2 SE() const { return construct_point(Standard_line_2( 1, 1,0)); }
+Point_2 NW() const { return construct_point(Standard_line_2(-1,-1,0)); }
+Point_2 SW() const { return construct_point(Standard_line_2( 1,-1,0)); }
+
+int orientation(const Point_2& p1, const Point_2& p2, const Point_2& p3)
+const
+{ CHECK(K.orientation(p1.checkrep(),p2.checkrep(),p3.checkrep()),
+        CGAL::orientation(p1,p2,p3))
+  return CGAL::orientation(p1,p2,p3); }
+
+bool left_turn(const Point_2& p1, const Point_2& p2, const Point_2& p3)
+const
+{ return orientation(p1,p2,p3) > 0; }
+
+bool first_pair_closer_than_second(
+  const Point_2& p1, const Point_2& p2,
+  const Point_2& p3, const Point_2& p4) const
+{ CHECK(K.first_pair_closer_than_second(p1.checkrep(),p2.checkrep(),
+                                        p3.checkrep(),p4.checkrep()),
+        CGAL::compare_pair_dist(p1,p2,p3,p4)<0)
+  return CGAL::compare_pair_dist(p1,p2,p3,p4)<0; }
+
+int compare_xy(const Point_2& p1, const Point_2& p2) const
+{ CHECK(K.compare_xy(p1.checkrep(),p2.checkrep()),
+        CGAL::compare_xy(p1,p2))
+  return CGAL::compare_xy(p1,p2); }
+
+int compare_x(const Point_2& p1, const Point_2& p2) const
+{ CHECK(K.compare_x(p1.checkrep(),p2.checkrep()),
+        CGAL::compare_x(p1,p2))
+  return CGAL::compare_x(p1,p2); }
+
+int compare_y(const Point_2& p1, const Point_2& p2) const
+{ CHECK(K.compare_y(p1.checkrep(),p2.checkrep()),
+        CGAL::compare_y(p1,p2))
+  return CGAL::compare_y(p1,p2); }
+
+bool strictly_ordered_along_line(
+  const Point_2& p1, const Point_2& p2, const Point_2& p3) const
+{ CHECK(K.strictly_ordered_along_line(
+          p1.checkrep(),p2.checkrep(),p3.checkrep()),
+        CGAL::strictly_ordered_along_line(p1,p2,p3))
+  return CGAL::strictly_ordered_along_line(p1,p2,p3); }
+
+
+Segment_2 construct_segment(const Point_2& p, const Point_2& q) const
+{ return Segment_2(p,q); }
+
+Point_2 source(const Segment_2& s) const
+{ return s.source(); }
+
+Point_2 target(const Segment_2& s) const
+{ return s.target(); }
+
+bool is_degenerate(const Segment_2& s) const
+{ return s.source()==s.target(); }
+
+int orientation(const Segment_2& s, const Point_2& p) const
+{ return orientation(s.source(),s.target(),p); }
+
+Point_2 intersection(const Segment_2& s1, const Segment_2& s2) const
+{ CHECK(CGAL::intersection(s1,s2).checkrep(),
+        K.intersection(convert(s1),convert(s2)))
+  return CGAL::intersection(s1,s2); }
+
+bool contains(const Segment_2& s, const Point_2& p) const
+/*{\Mop returns true iff |s| contains |p|.}*/
+{ return CGAL::contains(s,p); }
+
+Direction_2 construct_direction(
+  const Point_2& p1, const Point_2& p2) const
+{ return Direction_2(p1,p2); }
+
+bool strictly_ordered_ccw(const Direction_2& d1,
+  const Direction_2& d2, const Direction_2& d3) const
+{ CHECK(K.strictly_ordered_ccw(convert(d1),convert(d2),convert(d3)),
+        CGAL::strictly_ordered_ccw(d1,d2,d3));
+  return CGAL::strictly_ordered_ccw(d1,d2,d3); }
+
+void print_statistics() const
+{
+  std::cout << "Statistics of filtered kernel:\n";
+  std::cout << "total failed double filter stages = (now needs CGAL_PROFILE)\n";
+  PRINT_CHECK_ENABLED;
+  PRINT_STATISTICS(or2);
+  PRINT_STATISTICS(or1);
+  PRINT_STATISTICS(or0);
+  PRINT_STATISTICS(cmpx1);
+  PRINT_STATISTICS(cmpx0);
+  PRINT_STATISTICS(cmpy1);
+  PRINT_STATISTICS(cmpy0);
+  PRINT_STATISTICS(cmppd2);
+  PRINT_STATISTICS(cmppd1);
+  PRINT_STATISTICS(cmppd0);
+  PRINT_STATISTICS(ord2);
+  PRINT_STATISTICS(ord1);
+  PRINT_STATISTICS(ord0);
+}
+
+template <class Forward_iterator>
+void determine_frame_radius(Forward_iterator start, Forward_iterator end,
+                            Standard_RT& R0) const
+{ Standard_RT R;
+  while ( start != end ) {
+    Point_2 p = *start;
+    if ( is_standard(p) ) {
+      R = (CGAL::max)(CGAL_NTS abs(p.mx())/p.hw(),
+		      CGAL_NTS abs(p.my())/p.hw());
+    } else {
+      RT rx = CGAL_NTS abs(p.hx()), ry = CGAL_NTS abs(p.hy());
+      if ( rx[1] > ry[1] )      R = CGAL_NTS abs(ry[0]-rx[0])/(rx[1]-ry[1]);
+      else if ( rx[1] < ry[1] ) R = CGAL_NTS abs(rx[0]-ry[0])/(ry[1]-rx[1]);
+      else /* rx[1] == ry[1] */ R = CGAL_NTS abs(rx[0]-ry[0])/(2*p.hw());
+    }
+    R0 = (CGAL::max)(R+1,R0); ++start;
+  }
+}
+
+const char* output_identifier() const
+{ return "Filtered_extended_homogeneous"; }
+
+
+
+};
+
+
+
+} //namespace CGAL
+
+#undef CHECK
+#undef KERNEL_CHECK
+#undef REDUCE_INTERSECTION_POINTS
+#undef KERNEL_ANALYSIS
+#undef COUNTER
+#undef INCTOTAL
+#undef INCEXCEPTION
+#undef PRINT_STATISTICS
+#undef PRINT_CHECK_ENABLED
+
+#endif // CGAL_FILTERED_EXTENDED_HOMOGENEOUS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Filtered_kernel.h b/3rdparty/CGAL/include/CGAL/Filtered_kernel.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Filtered_kernel.h
rename to 3rdparty/CGAL/include/CGAL/Filtered_kernel.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Filtered_kernel/Cartesian_coordinate_iterator_2.h b/3rdparty/CGAL/include/CGAL/Filtered_kernel/Cartesian_coordinate_iterator_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Filtered_kernel/Cartesian_coordinate_iterator_2.h
rename to 3rdparty/CGAL/include/CGAL/Filtered_kernel/Cartesian_coordinate_iterator_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Filtered_kernel/Cartesian_coordinate_iterator_3.h b/3rdparty/CGAL/include/CGAL/Filtered_kernel/Cartesian_coordinate_iterator_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Filtered_kernel/Cartesian_coordinate_iterator_3.h
rename to 3rdparty/CGAL/include/CGAL/Filtered_kernel/Cartesian_coordinate_iterator_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Filtered_kernel_d.h b/3rdparty/CGAL/include/CGAL/Filtered_kernel_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Filtered_kernel_d.h
rename to 3rdparty/CGAL/include/CGAL/Filtered_kernel_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Filtered_kernel_fwd.h b/3rdparty/CGAL/include/CGAL/Filtered_kernel_fwd.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Filtered_kernel_fwd.h
rename to 3rdparty/CGAL/include/CGAL/Filtered_kernel_fwd.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Filtered_predicate.h b/3rdparty/CGAL/include/CGAL/Filtered_predicate.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Filtered_predicate.h
rename to 3rdparty/CGAL/include/CGAL/Filtered_predicate.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Fixed_alpha_shape_3.h b/3rdparty/CGAL/include/CGAL/Fixed_alpha_shape_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Fixed_alpha_shape_3.h
rename to 3rdparty/CGAL/include/CGAL/Fixed_alpha_shape_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Fixed_alpha_shape_cell_base_3.h b/3rdparty/CGAL/include/CGAL/Fixed_alpha_shape_cell_base_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Fixed_alpha_shape_cell_base_3.h
rename to 3rdparty/CGAL/include/CGAL/Fixed_alpha_shape_cell_base_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Fixed_alpha_shape_vertex_base_3.h b/3rdparty/CGAL/include/CGAL/Fixed_alpha_shape_vertex_base_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Fixed_alpha_shape_vertex_base_3.h
rename to 3rdparty/CGAL/include/CGAL/Fixed_alpha_shape_vertex_base_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Fixed_border_parameterizer_3.h b/3rdparty/CGAL/include/CGAL/Fixed_border_parameterizer_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Fixed_border_parameterizer_3.h
rename to 3rdparty/CGAL/include/CGAL/Fixed_border_parameterizer_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Flattening_iterator.h b/3rdparty/CGAL/include/CGAL/Flattening_iterator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Flattening_iterator.h
rename to 3rdparty/CGAL/include/CGAL/Flattening_iterator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Fourtuple.h b/3rdparty/CGAL/include/CGAL/Fourtuple.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Fourtuple.h
rename to 3rdparty/CGAL/include/CGAL/Fourtuple.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Fraction_traits.h b/3rdparty/CGAL/include/CGAL/Fraction_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Fraction_traits.h
rename to 3rdparty/CGAL/include/CGAL/Fraction_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Fuzzy_iso_box.h b/3rdparty/CGAL/include/CGAL/Fuzzy_iso_box.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Fuzzy_iso_box.h
rename to 3rdparty/CGAL/include/CGAL/Fuzzy_iso_box.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Fuzzy_sphere.h b/3rdparty/CGAL/include/CGAL/Fuzzy_sphere.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Fuzzy_sphere.h
rename to 3rdparty/CGAL/include/CGAL/Fuzzy_sphere.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/GMP/Gmpfi_type.h b/3rdparty/CGAL/include/CGAL/GMP/Gmpfi_type.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/GMP/Gmpfi_type.h
rename to 3rdparty/CGAL/include/CGAL/GMP/Gmpfi_type.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/GMP/Gmpfi_type_static.h b/3rdparty/CGAL/include/CGAL/GMP/Gmpfi_type_static.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/GMP/Gmpfi_type_static.h
rename to 3rdparty/CGAL/include/CGAL/GMP/Gmpfi_type_static.h
diff --git a/3rdparty/CGAL/include/CGAL/GMP/Gmpfr_type.h b/3rdparty/CGAL/include/CGAL/GMP/Gmpfr_type.h
new file mode 100644
index 0000000..8abb8c8
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/GMP/Gmpfr_type.h
@@ -0,0 +1,1341 @@
+// Copyright (c) 2007-2010 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 at gmx.com>
+
+#ifndef CGAL_GMPFR_TYPE_H
+#define CGAL_GMPFR_TYPE_H
+
+#include <CGAL/gmp.h>
+#include <mpfr.h>
+#include <boost/operators.hpp>
+#include <CGAL/Handle_for.h>
+#include <CGAL/GMP/Gmpz_type.h>
+#include <CGAL/GMP/Gmpzf_type.h>
+#include <limits>
+#include <CGAL/Uncertain.h>
+#include <CGAL/ipower.h>
+#include <CGAL/IO/io.h>
+
+#if MPFR_VERSION_MAJOR < 3
+        typedef mp_rnd_t mpfr_rnd_t;
+        typedef mp_prec_t mpfr_prec_t;
+        typedef mp_exp_t mpfr_exp_t;
+        #define MPFR_RNDN GMP_RNDN
+        #define MPFR_RNDZ GMP_RNDZ
+        #define MPFR_RNDU GMP_RNDU
+        #define MPFR_RNDD GMP_RNDD
+        #define CGAL_GMPFR_GET_Z_2EXP mpfr_get_z_exp
+#else
+        #define CGAL_GMPFR_GET_Z_2EXP mpfr_get_z_2exp
+#endif
+
+namespace CGAL{
+
+class Gmpfr;
+
+bool operator<(const Gmpfr&,const Gmpfr&);
+bool operator==(const Gmpfr&,const Gmpfr&);
+
+bool operator<(const Gmpfr&,long);
+bool operator>(const Gmpfr&,long);
+bool operator==(const Gmpfr&,long);
+
+bool operator<(const Gmpfr&,unsigned long);
+bool operator>(const Gmpfr&,unsigned long);
+bool operator==(const Gmpfr&,unsigned long);
+
+bool operator<(const Gmpfr&,int);
+bool operator>(const Gmpfr&,int);
+bool operator==(const Gmpfr&,int);
+
+bool operator<(const Gmpfr&,double);
+bool operator>(const Gmpfr&,double);
+bool operator==(const Gmpfr&,double);
+
+bool operator<(const Gmpfr&,long double);
+bool operator>(const Gmpfr&,long double);
+bool operator==(const Gmpfr&,long double);
+
+bool operator<(const Gmpfr&,const Gmpz&);
+bool operator>(const Gmpfr&,const Gmpz&);
+bool operator==(const Gmpfr&,const Gmpz&);
+
+struct Gmpfr_rep{
+        mpfr_t floating_point_number;
+        bool clear_on_destruction;
+        Gmpfr_rep():clear_on_destruction(true){}
+        ~Gmpfr_rep(){
+                if(clear_on_destruction)
+                        mpfr_clear(floating_point_number);
+        }
+};
+
+namespace internal{
+        template <>
+        struct Minmax_traits<mpfr_rnd_t>{
+                static const mpfr_rnd_t min=MPFR_RNDN;
+        #if MPFR_VERSION_MAJOR < 3
+                static const mpfr_rnd_t max=GMP_RND_MAX;
+        #else
+                static const mpfr_rnd_t max=MPFR_RNDF;
+        #endif
+        };
+} // namespace internal
+
+// The class Gmpfr is reference-counted using CGAL's handle mechanism. This
+// behavior may be changed, setting the flag CGAL_GMPFR_NO_REFCOUNT. A
+// non-reference-counted class is slightly more efficient in case the
+// implementation does not need to copy numbers (this is not usually the
+// case). Nevertheless, setting the flag may be useful for debugging
+// purposes.
+
+class Gmpfr:
+#ifdef CGAL_GMPFR_NO_REFCOUNT
+        Gmpfr_rep,
+#else
+        Handle_for<Gmpfr_rep>,
+#endif
+        boost::ordered_euclidian_ring_operators1<Gmpfr,
+        boost::ordered_euclidian_ring_operators2<Gmpfr,long,
+        boost::ordered_euclidian_ring_operators2<Gmpfr,unsigned long,
+        boost::ordered_euclidian_ring_operators2<Gmpfr,int,
+        boost::totally_ordered2<Gmpfr,double,
+        boost::totally_ordered2<Gmpfr,long double,
+        boost::ordered_euclidian_ring_operators2<Gmpfr,Gmpz
+        > > > > > > >
+{
+        private:
+
+#ifndef CGAL_GMPFR_NO_REFCOUNT
+        typedef Handle_for<Gmpfr_rep>   Base;
+#endif
+
+        static Uncertain<mpfr_rnd_t> _gmp_rnd(std::float_round_style r){
+                switch(r){
+                        case std::round_toward_infinity: return MPFR_RNDU;
+                        case std::round_toward_neg_infinity: return MPFR_RNDD;
+                        case std::round_toward_zero: return MPFR_RNDZ;
+                        case std::round_to_nearest: return MPFR_RNDN;
+                        default: return Uncertain<mpfr_rnd_t>::indeterminate();
+                }
+        };
+
+        static std::float_round_style _cgal_rnd(mpfr_rnd_t r){
+                switch(r){
+                        case MPFR_RNDU: return std::round_toward_infinity;
+                        case MPFR_RNDD: return std::round_toward_neg_infinity;
+                        case MPFR_RNDZ: return std::round_toward_zero;
+                        case MPFR_RNDN: return std::round_to_nearest;
+                        default: return std::round_indeterminate;
+                }
+        };
+
+        public:
+
+        typedef mpfr_prec_t             Precision_type;
+
+        // access
+
+        mpfr_srcptr fr()const{
+#ifdef CGAL_GMPFR_NO_REFCOUNT
+                return floating_point_number;
+#else
+                return Ptr()->floating_point_number;
+#endif
+        }
+
+        mpfr_ptr fr(){
+#ifdef CGAL_GMPFR_NO_REFCOUNT
+                return floating_point_number;
+#else
+                return ptr()->floating_point_number;
+#endif
+        }
+
+        // The function dont_clear_on_destruction() is used to tell the
+        // object that the mpfr_t must not be cleared at object destruction
+        // (the destructor contrasts with that of the GMP types, where the
+        // structure is always cleared). The reason to do this is that,
+        // sometimes, the object is constructed from a mpfr_t structure and
+        // we know that the structure will be cleared somewhere else. The
+        // mpfr_t will not need to be cleared in case the object A is
+        // constructed from another Gmpfr object B, specifying the
+        // precision, and it happens that this precision is the same as the
+        // precision of A. In this case, a shallow copy is constructed.
+
+        void dont_clear_on_destruction(){
+#ifdef CGAL_GMPFR_NO_REFCOUNT
+                clear_on_destruction=false;
+#else
+                ptr()->clear_on_destruction=false;
+#endif
+        }
+
+        bool is_unique(){
+#ifdef CGAL_GMPFR_NO_REFCOUNT
+                return true;
+#else
+                return unique();
+#endif
+        }
+
+        // construction
+
+        Gmpfr(){
+                mpfr_init(fr());
+        }
+
+        Gmpfr(mpfr_srcptr f){
+                mpfr_custom_init_set(
+                        fr(),
+                        mpfr_custom_get_kind(f),
+                        mpfr_custom_get_exp(f),
+                        mpfr_get_prec(f),
+                        mpfr_custom_get_mantissa(f));
+                dont_clear_on_destruction();
+                CGAL_assertion((mpfr_nan_p(f)!=0 && mpfr_nan_p(fr())!=0) ||
+                               (mpfr_unordered_p(f,fr())==0 &&
+                                mpfr_equal_p(f,fr())!=0));
+        }
+
+        Gmpfr(mpfr_srcptr f,
+              std::float_round_style r,
+              Gmpfr::Precision_type p=Gmpfr::get_default_precision()){
+                CGAL_assertion(p>=MPFR_PREC_MIN&&p<=MPFR_PREC_MAX);
+                if(p==mpfr_get_prec(f)){
+                        mpfr_custom_init_set(
+                                fr(),
+                                mpfr_custom_get_kind(f),
+                                mpfr_custom_get_exp(f),
+                                mpfr_get_prec(f),
+                                mpfr_custom_get_mantissa(f));
+                        dont_clear_on_destruction();
+                        CGAL_assertion((mpfr_nan_p(f)!=0&&mpfr_nan_p(fr())!=0)||
+                                       (mpfr_unordered_p(f,fr())==0&&
+                                        mpfr_equal_p(f,fr())!=0));
+                }else{
+                        mpfr_init2(fr(),p);
+                        mpfr_set(fr(),f,_gmp_rnd(r));
+                        CGAL_assertion(mpfr_get_prec(fr())<mpfr_get_prec(f)||
+                                       mpfr_equal_p(fr(),f)!=0);
+                }
+        }
+
+        Gmpfr(mpfr_srcptr f,Gmpfr::Precision_type p){
+                CGAL_assertion(p>=MPFR_PREC_MIN&&p<=MPFR_PREC_MAX);
+                if(p==mpfr_get_prec(f)){
+                        mpfr_custom_init_set(
+                                fr(),
+                                mpfr_custom_get_kind(f),
+                                mpfr_custom_get_exp(f),
+                                mpfr_get_prec(f),
+                                mpfr_custom_get_mantissa(f));
+                        dont_clear_on_destruction();
+                        CGAL_assertion((mpfr_nan_p(f)!=0&&mpfr_nan_p(fr())!=0)||
+                                       (mpfr_unordered_p(f,fr())==0&&
+                                        mpfr_equal_p(f,fr())!=0));
+                }else{
+                        mpfr_init2(fr(),p);
+                        mpfr_set(fr(),f,mpfr_get_default_rounding_mode());
+                        CGAL_assertion(p<mpfr_get_prec(f)||
+                                       mpfr_equal_p(fr(),f)!=0);
+                }
+        }
+
+        Gmpfr(const Gmpzf &f,
+              std::float_round_style r,
+              Gmpfr::Precision_type p=Gmpfr::get_default_precision()){
+                CGAL_assertion(p>=MPFR_PREC_MIN&&p<=MPFR_PREC_MAX);
+                mpfr_init2(fr(),p);
+                mpfr_set_z(fr(),f.man(),_gmp_rnd(r));
+                mpfr_mul_2si(fr(),fr(),f.exp(),_gmp_rnd(r));
+        }
+
+        Gmpfr(const Gmpzf &f,Gmpfr::Precision_type p){
+                CGAL_assertion(p>=MPFR_PREC_MIN&&p<=MPFR_PREC_MAX);
+                mpfr_init2(fr(),p);
+                mpfr_set_z(fr(),f.man(),mpfr_get_default_rounding_mode());
+                mpfr_mul_2si(fr(),
+                             fr(),
+                             f.exp(),
+                             mpfr_get_default_rounding_mode());
+        }
+
+        Gmpfr(const Gmpzf &f){
+                mpfr_init2(fr(),
+                           static_cast<Gmpfr::Precision_type>(
+                                   mpz_sizeinbase(f.man(),2)<MPFR_PREC_MIN?
+                                   MPFR_PREC_MIN:
+                                   mpz_sizeinbase(f.man(),2)));
+                mpfr_set_z(fr(),f.man(),MPFR_RNDN);
+                CGAL_assertion_msg(mpfr_cmp_z(fr(),f.man())==0,
+                                   "inexact conversion of a Gmpzf mantissa");
+                CGAL_assertion_code(int inexact=)
+                mpfr_mul_2si(fr(),fr(),f.exp(),MPFR_RNDN);
+                CGAL_assertion_msg(inexact==0,"inexact conversion from Gmpzf");
+        }
+
+        Gmpfr(const std::pair<Gmpz,long> &intexp,
+              std::float_round_style r=Gmpfr::get_default_rndmode(),
+              Gmpfr::Precision_type p=Gmpfr::get_default_precision()){
+                CGAL_assertion(p>=MPFR_PREC_MIN&&p<=MPFR_PREC_MAX);
+                mpfr_init2(fr(),p);
+                mpfr_set_z(fr(),intexp.first.mpz(),_gmp_rnd(r));
+                mpfr_mul_2si(fr(),fr(),intexp.second,_gmp_rnd(r));
+        }
+
+        Gmpfr(const std::pair<Gmpz,long> &intexp,Gmpfr::Precision_type p){
+                CGAL_assertion(p>=MPFR_PREC_MIN&&p<=MPFR_PREC_MAX);
+                mpfr_init2(fr(),p);
+                mpfr_set_z(fr(),
+                           intexp.first.mpz(),
+                           mpfr_get_default_rounding_mode());
+                mpfr_mul_2si(fr(),
+                             fr(),
+                             intexp.second,
+                             mpfr_get_default_rounding_mode());
+        }
+
+#define CGAL_GMPFR_CONSTRUCTOR_FROM_TYPE(_type,_fun) \
+        Gmpfr(_type x, \
+              std::float_round_style r, \
+              Gmpfr::Precision_type p=Gmpfr::get_default_precision()){ \
+                CGAL_assertion(p>=MPFR_PREC_MIN&&p<=MPFR_PREC_MAX); \
+                mpfr_init2(fr(),p); \
+                _fun(fr(),x,_gmp_rnd(r)); \
+        } \
+        Gmpfr(_type x,Gmpfr::Precision_type p){ \
+                CGAL_assertion(p>=MPFR_PREC_MIN&&p<=MPFR_PREC_MAX); \
+                mpfr_init2(fr(),p); \
+                _fun(fr(),x,mpfr_get_default_rounding_mode()); \
+        } \
+        Gmpfr(_type x){ \
+                mpfr_init2(fr(),mp_bits_per_limb*sizeof(_type)); \
+                _fun(fr(),x,mpfr_get_default_rounding_mode()); \
+        }
+
+        CGAL_GMPFR_CONSTRUCTOR_FROM_TYPE(int,mpfr_set_si);
+        CGAL_GMPFR_CONSTRUCTOR_FROM_TYPE(long,mpfr_set_si);
+        CGAL_GMPFR_CONSTRUCTOR_FROM_TYPE(unsigned,mpfr_set_ui);
+        CGAL_GMPFR_CONSTRUCTOR_FROM_TYPE(unsigned long,mpfr_set_ui);
+        CGAL_GMPFR_CONSTRUCTOR_FROM_TYPE(double,mpfr_set_d);
+
+        // With the MSVC compiler, 'long double' and 'double' are two
+        // different types, but with the same size: sizeof(long double)==8.
+        // For that reason, the cast of a long double to a double is
+        // exact.
+        // What is more, if one compile the mpfr library with mingw(32|64),
+        // on Windows, this compiler has sizeof(long double)==16, as
+        // gcc/g++ on Linux, and the produces libmpfr-1.dll has a symbol
+        // mpfr_set_ld which is binary incompatible with a call from MSVC.
+        // For those two reason, the constructor from 'long
+        // double' calls 'mpfr_set_l' on MSVC, instead of 'mpfr_set_ld'.
+        // That should not modify the semantic of a CGAL program, but
+        // only avoid the binary incompatibility of a CGAL program compiled
+        // with MSVC with the libmpfr-1.dll compiled with mingw.
+#ifdef _MSC_VER
+        CGAL_GMPFR_CONSTRUCTOR_FROM_TYPE(long double,mpfr_set_d);
+#else
+        CGAL_GMPFR_CONSTRUCTOR_FROM_TYPE(long double,mpfr_set_ld);
+#endif
+#undef CGAL_GMPFR_CONSTRUCTOR_FROM_TYPE
+
+#define CGAL_GMPFR_CONSTRUCTOR_FROM_OBJECT(_class,_member,_fun,_preccode) \
+        Gmpfr(const _class &x, \
+              std::float_round_style r, \
+              Gmpfr::Precision_type p=Gmpfr::get_default_precision()){ \
+                CGAL_assertion(p>=MPFR_PREC_MIN&&p<=MPFR_PREC_MAX); \
+                mpfr_init2(fr(),p); \
+                _fun(fr(),x._member,_gmp_rnd(r)); \
+        } \
+        Gmpfr(const _class &x,Gmpfr::Precision_type p){ \
+                CGAL_assertion(p<=MPFR_PREC_MAX); \
+                mpfr_init2(fr(),MPFR_PREC_MIN<p?p:MPFR_PREC_MIN); \
+                _fun(fr(),x._member,mpfr_get_default_rounding_mode()); \
+        } \
+        Gmpfr(const _class &x){ \
+                Gmpfr::Precision_type p=(_preccode); \
+                mpfr_init2(fr(),MPFR_PREC_MIN<p?p:MPFR_PREC_MIN); \
+                _fun(fr(),x._member,MPFR_RNDN); \
+        }
+
+        CGAL_GMPFR_CONSTRUCTOR_FROM_OBJECT(Gmpz,
+                                           mpz(),
+                                           mpfr_set_z,
+                                           static_cast<Gmpfr::Precision_type>(
+                                                x.bit_size()));
+
+#undef CGAL_GMPFR_CONSTRUCTOR_FROM_OBJECT
+
+        // When Gmpfr is refence counted, we inherit the assignment
+        // operator and the copy constructor from Handle_for.
+#ifdef CGAL_GMPFR_NO_REFCOUNT
+        Gmpfr& operator=(const Gmpfr &a){
+                mpfr_set_prec(fr(),a.get_precision());
+                mpfr_set(fr(),a.fr(),mpfr_get_default_rounding_mode());
+                return *this;
+        }
+
+        Gmpfr(const Gmpfr &a){
+                mpfr_init2(fr(),a.get_precision());
+                mpfr_set(fr(),a.fr(),MPFR_RNDN);
+        }
+#endif
+
+        Gmpfr(const Gmpfr &a,
+              std::float_round_style r,
+              Gmpfr::Precision_type p=Gmpfr::get_default_precision()){
+                CGAL_assertion(p>=MPFR_PREC_MIN&&p<=MPFR_PREC_MAX);
+#ifndef CGAL_GMPFR_NO_REFCOUNT
+                if(p==a.get_precision()){
+                        Gmpfr temp(a);
+                        // we use dont_clear_on_destruction because the
+                        // mpfr_t pointed to by fr() was never initialized
+                        dont_clear_on_destruction();
+                        swap(temp);
+                }else
+#endif
+                {
+                        mpfr_init2(fr(),p);
+                        mpfr_set(fr(),a.fr(),_gmp_rnd(r));
+                }
+        }
+
+        Gmpfr(const Gmpfr &a,Gmpfr::Precision_type p){
+                CGAL_assertion(p>=MPFR_PREC_MIN&&p<=MPFR_PREC_MAX);
+#ifndef CGAL_GMPFR_NO_REFCOUNT
+                if(p==a.get_precision()){
+                        Gmpfr temp(a);
+                        // we use dont_clear_on_destruction because the
+                        // mpfr_t pointed to by fr() was never initialized
+                        dont_clear_on_destruction();
+                        swap(temp);
+                }else
+#endif
+                {
+                        mpfr_init2(fr(),p);
+                        mpfr_set(fr(),a.fr(),mpfr_get_default_rounding_mode());
+                }
+        }
+
+        // default rounding mode
+
+        static std::float_round_style get_default_rndmode();
+        static std::float_round_style
+                set_default_rndmode(std::float_round_style);
+
+        // default precision
+
+        static Gmpfr::Precision_type get_default_precision();
+        static Gmpfr::Precision_type
+                set_default_precision(Gmpfr::Precision_type);
+
+        // precision of a single Gmpfr object
+
+        Gmpfr::Precision_type get_precision()const;
+        Gmpfr round(Gmpfr::Precision_type,std::float_round_style)const;
+
+        // mpfr global inexact flags
+
+        static void clear_flags();
+        static bool underflow_flag();
+        static bool overflow_flag();
+        static bool nan_flag();
+        static bool inex_flag();
+        static bool erange_flag();
+
+        // arithmetics
+
+        Gmpfr operator+()const;
+        Gmpfr operator-()const;
+
+#define CGAL_GMPFR_DECLARE_OPERATORS(_type) \
+        Gmpfr& operator+=(_type); \
+        Gmpfr& operator-=(_type); \
+        Gmpfr& operator*=(_type); \
+        Gmpfr& operator/=(_type);
+
+        CGAL_GMPFR_DECLARE_OPERATORS(const Gmpfr&)
+        Gmpfr& operator%=(const Gmpfr&);
+        CGAL_GMPFR_DECLARE_OPERATORS(long)
+        CGAL_GMPFR_DECLARE_OPERATORS(unsigned long)
+        CGAL_GMPFR_DECLARE_OPERATORS(int)
+        CGAL_GMPFR_DECLARE_OPERATORS(const Gmpz&)
+
+#undef CGAL_GMPFR_DECLARE_OPERATORS
+
+#define CGAL_GMPFR_DECLARE_STATIC_FUNCTION(_f,_t1,_t2) \
+        static Gmpfr _f (_t1, \
+                         _t2, \
+                         std::float_round_style=Gmpfr::get_default_rndmode()); \
+        static Gmpfr _f (_t1, \
+                         _t2, \
+                         Gmpfr::Precision_type, \
+                         std::float_round_style=Gmpfr::get_default_rndmode());
+
+#define CGAL_GMPFR_DECLARE_STATIC_FUNCTIONS(_t2) \
+        CGAL_GMPFR_DECLARE_STATIC_FUNCTION(add,const Gmpfr&,_t2) \
+        CGAL_GMPFR_DECLARE_STATIC_FUNCTION(sub,const Gmpfr&,_t2) \
+        CGAL_GMPFR_DECLARE_STATIC_FUNCTION(mul,const Gmpfr&,_t2) \
+        CGAL_GMPFR_DECLARE_STATIC_FUNCTION(div,const Gmpfr&,_t2)
+
+        CGAL_GMPFR_DECLARE_STATIC_FUNCTIONS(const Gmpfr&)
+        CGAL_GMPFR_DECLARE_STATIC_FUNCTIONS(long)
+        CGAL_GMPFR_DECLARE_STATIC_FUNCTIONS(unsigned long)
+        CGAL_GMPFR_DECLARE_STATIC_FUNCTIONS(int)
+        CGAL_GMPFR_DECLARE_STATIC_FUNCTIONS(const Gmpz&)
+
+#undef CGAL_GMPFR_DECLARE_STATIC_FUNCTION
+#undef CGAL_GMPFR_DECLARE_STATIC_FUNCTIONS
+
+#define CGAL_GMPFR_DECLARE_NO_ARGUMENT_FUNCTION(_f) \
+        Gmpfr _f (std::float_round_style=Gmpfr::get_default_rndmode()) const; \
+        Gmpfr _f (Gmpfr::Precision_type,\
+                  std::float_round_style=Gmpfr::get_default_rndmode()) const;
+
+        CGAL_GMPFR_DECLARE_NO_ARGUMENT_FUNCTION(abs)
+        CGAL_GMPFR_DECLARE_NO_ARGUMENT_FUNCTION(sqrt)
+        CGAL_GMPFR_DECLARE_NO_ARGUMENT_FUNCTION(cbrt)
+        Gmpfr kthroot
+                (int,std::float_round_style=Gmpfr::get_default_rndmode()) const;
+        Gmpfr kthroot
+                (int,
+                 Gmpfr::Precision_type,
+                 std::float_round_style=Gmpfr::get_default_rndmode()) const;
+        CGAL_GMPFR_DECLARE_NO_ARGUMENT_FUNCTION(square)
+
+#undef CGAL_GMPFR_DECLARE_NO_ARGUMENT_FUNCTION
+
+        // comparison and query functions
+
+        bool is_zero()const;
+        bool is_one()const;
+        bool is_nan()const;
+        bool is_inf()const;
+        bool is_number()const;
+        Sign sign()const;
+        bool is_square()const;
+        bool is_square(Gmpfr&)const;
+        Comparison_result compare(const Gmpfr&)const;
+
+        // conversion functions
+
+        double to_double(std::float_round_style=Gmpfr::get_default_rndmode())
+                const;
+        std::pair<double,double> to_interval()const;
+        std::pair<double,long> to_double_exp(std::float_round_style=
+                                             Gmpfr::get_default_rndmode())const;
+        std::pair<std::pair<double,double>,long> to_interval_exp()const;
+        std::pair<Gmpz,long> to_integer_exp()const;
+};
+
+
+
+
+// --------------
+// implementation
+// --------------
+
+// default rounding mode, handled by mpfr
+inline
+std::float_round_style Gmpfr::get_default_rndmode(){
+        return _cgal_rnd(mpfr_get_default_rounding_mode());
+}
+
+inline
+std::float_round_style
+Gmpfr::set_default_rndmode(std::float_round_style rnd_mode){
+        std::float_round_style old_rnd_mode=Gmpfr::get_default_rndmode();
+        mpfr_set_default_rounding_mode(_gmp_rnd(rnd_mode));
+        return old_rnd_mode;
+}
+
+// default precision, handled by mpfr
+inline
+Gmpfr::Precision_type Gmpfr::get_default_precision(){
+        return static_cast<Gmpfr::Precision_type>(mpfr_get_default_prec());
+}
+
+inline
+Gmpfr::Precision_type Gmpfr::set_default_precision(Gmpfr::Precision_type prec){
+        Gmpfr::Precision_type old_prec=Gmpfr::get_default_precision();
+        CGAL_assertion(prec>=MPFR_PREC_MIN&&prec<=MPFR_PREC_MAX);
+        mpfr_set_default_prec(prec);
+        return old_prec;
+}
+
+// precision of a single Gmpfr object
+
+inline
+Gmpfr::Precision_type Gmpfr::get_precision()const{
+        return mpfr_get_prec(fr());
+}
+
+inline
+Gmpfr Gmpfr::round(Gmpfr::Precision_type p,std::float_round_style r)const{
+        CGAL_assertion(p>=MPFR_PREC_MIN&&p<=MPFR_PREC_MAX);
+        return Gmpfr(*this,r,p);
+}
+
+// mpfr global inexact flags
+
+inline
+void Gmpfr::clear_flags(){
+        mpfr_clear_flags();
+}
+
+inline
+bool Gmpfr::underflow_flag(){
+        return mpfr_underflow_p()!=0;
+}
+
+inline
+bool Gmpfr::overflow_flag(){
+        return mpfr_overflow_p()!=0;
+}
+
+inline
+bool Gmpfr::nan_flag(){
+        return mpfr_nanflag_p()!=0;
+}
+
+inline
+bool Gmpfr::inex_flag(){
+        return mpfr_inexflag_p()!=0;
+}
+
+inline
+bool Gmpfr::erange_flag(){
+        return mpfr_erangeflag_p()!=0;
+}
+
+// arithmetics
+
+inline
+Gmpfr Gmpfr::operator+()const{
+        return(*this);
+}
+
+inline
+Gmpfr Gmpfr::operator-()const{
+        Gmpfr result(0,get_precision());
+        mpfr_neg(result.fr(),fr(),MPFR_RNDN);
+        return result;
+}
+
+// CGAL_GMPFR_MEMBER_PREC returns the precision to be used to operate between
+// *this and a number of another type or class. Currently, the maximum of
+// *this' precision and the default precision is returned.
+#define CGAL_GMPFR_MEMBER_PREC() \
+        (get_precision()>Gmpfr::get_default_precision()? \
+         get_precision(): \
+         Gmpfr::get_default_precision())
+
+// CGAL_GMPFR_MEMBER_PREC_2 returns the precision for the operation between Gmpfr
+// objects *this and _b. Currently, it is the maximum of the precisions of
+// *this and _b and the default precision.
+// TODO: maybe we can rewrite this define optimally, maybe with an inline
+#define CGAL_GMPFR_MEMBER_PREC_2(_b) \
+        ( get_precision() >= mpfr_get_prec(_b.fr()) ? \
+                ( get_precision()>(Gmpfr::get_default_precision())? \
+                        get_precision():(Gmpfr::get_default_precision())): \
+                ( mpfr_get_prec(_b.fr())>(Gmpfr::get_default_precision())? \
+                        mpfr_get_prec(_b.fr()): \
+                        (Gmpfr::get_default_precision())) \
+        )
+
+// CGAL_GMPFR_OBJECT_BINARY_OPERATOR defines an overloaded binary operator of
+// the Gmpfr class, where the second parameter of the operator is an
+// object. It behaves differently when the Gmpfr class is reference-counted
+// or not.
+#ifdef CGAL_GMPFR_NO_REFCOUNT
+#define CGAL_GMPFR_OBJECT_BINARY_OPERATOR(_op,_class,_member,_fun) \
+        inline \
+        Gmpfr& Gmpfr::_op(const _class &b){ \
+                if(get_precision()>=Gmpfr::get_default_precision()) { \
+                        _fun(fr(), \
+                             fr(), \
+                             b._member, \
+                             mpfr_get_default_rounding_mode()); \
+                }else{ \
+                        Gmpfr _temp(0,Gmpfr::get_default_precision()); \
+                        _fun(_temp.fr(), \
+                             fr(), \
+                             b._member, \
+                             mpfr_get_default_rounding_mode()); \
+                        mpfr_swap(_temp.fr(),fr()); \
+                } \
+                return *this; \
+        }
+#else
+#define CGAL_GMPFR_OBJECT_BINARY_OPERATOR(_op,_class,_member,_fun) \
+        inline \
+        Gmpfr& Gmpfr::_op(const _class &b){ \
+                if(unique()){ \
+                        if(get_precision()>Gmpfr::get_default_precision()) { \
+                                _fun(fr(), \
+                                     fr(), \
+                                     b._member, \
+                                     mpfr_get_default_rounding_mode()); \
+                        }else{ \
+                                Gmpfr _temp(0,Gmpfr::get_default_precision()); \
+                                _fun(_temp.fr(), \
+                                     fr(), \
+                                     b._member, \
+                                     mpfr_get_default_rounding_mode()); \
+                                swap(_temp); \
+                        } \
+                }else{ \
+                        Gmpfr result(0,CGAL_GMPFR_MEMBER_PREC()); \
+                        _fun(result.fr(), \
+                             fr(), \
+                             b._member, \
+                             mpfr_get_default_rounding_mode()); \
+                        swap(result); \
+                } \
+                return *this; \
+        }
+#endif
+
+// CGAL_GMPFR_GMPFR_BINARY_OPERATOR is analogous to
+// CGAL_GMPFR_OBJECT_BINARY_OPERATOR, and it is used when the second operand is
+// another Gmpfr. The difference is the computation of the operation
+// precision.
+#ifdef CGAL_GMPFR_NO_REFCOUNT
+#define CGAL_GMPFR_GMPFR_BINARY_OPERATOR(_op,_fun) \
+        inline \
+        Gmpfr& Gmpfr::_op(const Gmpfr &b){ \
+                Gmpfr::Precision_type _p=CGAL_GMPFR_MEMBER_PREC_2(b); \
+                if(_p==get_precision()) { \
+                        _fun(fr(), \
+                             fr(), \
+                             b.fr(), \
+                             mpfr_get_default_rounding_mode()); \
+                }else{ \
+                        Gmpfr _temp(0,_p); \
+                        _fun(_temp.fr(), \
+                             fr(), \
+                             b.fr(), \
+                             mpfr_get_default_rounding_mode()); \
+                        mpfr_swap(_temp.fr(),fr()); \
+                } \
+                return *this; \
+        }
+#else
+#define CGAL_GMPFR_GMPFR_BINARY_OPERATOR(_op,_fun) \
+        inline \
+        Gmpfr& Gmpfr::_op(const Gmpfr &b){ \
+                Gmpfr::Precision_type _p=CGAL_GMPFR_MEMBER_PREC_2(b); \
+                if(unique()&&(_p==get_precision())){ \
+                        _fun(fr(), \
+                             fr(), \
+                             b.fr(), \
+                             mpfr_get_default_rounding_mode()); \
+                }else{ \
+                        Gmpfr result(0,_p); \
+                        _fun(result.fr(), \
+                             fr(), \
+                             b.fr(), \
+                             mpfr_get_default_rounding_mode()); \
+                        swap(result); \
+                } \
+                return *this; \
+        }
+#endif
+
+// CGAL_GMPFR_TYPE_BINARY_OPERATOR is analogous to the
+// CGAL_GMPFR_OBJECT_BINARY_OPERATOR, where the second parameter is a type
+// instead of an object.
+#ifdef CGAL_GMPFR_NO_REFCOUNT
+#define CGAL_GMPFR_TYPE_BINARY_OPERATOR(_op,_type,_fun) \
+        inline \
+        Gmpfr& Gmpfr::_op(_type x){ \
+                if(get_precision()>=Gmpfr::get_default_precision()) { \
+                        _fun(fr(),fr(),x,mpfr_get_default_rounding_mode()); \
+                }else{ \
+                        Gmpfr _temp(0,Gmpfr::get_default_precision()); \
+                        _fun(_temp.fr(), \
+                             fr(), \
+                             x, \
+                             mpfr_get_default_rounding_mode()); \
+                        mpfr_swap(_temp.fr(),fr()); \
+                } \
+                return *this; \
+        }
+#else
+#define CGAL_GMPFR_TYPE_BINARY_OPERATOR(_op,_type,_fun) \
+        inline \
+        Gmpfr& Gmpfr::_op(_type x){ \
+                if(unique()){ \
+                        if(get_precision()>Gmpfr::get_default_precision()) { \
+                                _fun(fr(), \
+                                     fr(), \
+                                     x, \
+                                     mpfr_get_default_rounding_mode()); \
+                        }else{ \
+                                Gmpfr _temp(0,Gmpfr::get_default_precision()); \
+                                _fun(_temp.fr(), \
+                                     fr(), \
+                                     x, \
+                                     mpfr_get_default_rounding_mode()); \
+                                swap(_temp); \
+                        } \
+                }else{ \
+                        Gmpfr result(0,CGAL_GMPFR_MEMBER_PREC()); \
+                        _fun(result.fr(), \
+                             fr(), \
+                             x, \
+                             mpfr_get_default_rounding_mode()); \
+                        swap(result); \
+                } \
+                return *this; \
+        }
+#endif
+
+CGAL_GMPFR_GMPFR_BINARY_OPERATOR(operator+=,mpfr_add)
+CGAL_GMPFR_GMPFR_BINARY_OPERATOR(operator-=,mpfr_sub)
+CGAL_GMPFR_GMPFR_BINARY_OPERATOR(operator*=,mpfr_mul)
+CGAL_GMPFR_GMPFR_BINARY_OPERATOR(operator/=,mpfr_div)
+#if(defined(MPFR_VERSION)&&(MPFR_VERSION>=MPFR_VERSION_NUM(2,3,0)))
+CGAL_GMPFR_GMPFR_BINARY_OPERATOR(operator%=,mpfr_remainder)
+#else
+//#  warning "Gmpfr::operator%= is optimized in MPFR 2.3.0."
+inline
+Gmpfr& Gmpfr::operator%=(const Gmpfr &b){
+        Gmpfr::Precision_type _p=CGAL_GMPFR_MEMBER_PREC_2(b);
+        Gmpfr result(*this,_p);
+        result/=b;
+        mpfr_trunc(result.fr(),result.fr());
+        result*=b;
+        result-=*this;
+        mpfr_neg(result.fr(),result.fr(),MPFR_RNDN);
+#  ifdef CGAL_GMPFR_NO_REFCOUNT
+        mpfr_swap(result.fr(),fr());
+#  else
+        if(unique())
+                mpfr_swap(result.fr(),fr());
+        else
+                swap(result);
+#  endif
+        return *this;
+}
+#endif
+
+CGAL_GMPFR_TYPE_BINARY_OPERATOR(operator+=,long,mpfr_add_si)
+CGAL_GMPFR_TYPE_BINARY_OPERATOR(operator-=,long,mpfr_sub_si)
+CGAL_GMPFR_TYPE_BINARY_OPERATOR(operator*=,long,mpfr_mul_si)
+CGAL_GMPFR_TYPE_BINARY_OPERATOR(operator/=,long,mpfr_div_si)
+
+CGAL_GMPFR_TYPE_BINARY_OPERATOR(operator+=,unsigned long,mpfr_add_ui)
+CGAL_GMPFR_TYPE_BINARY_OPERATOR(operator-=,unsigned long,mpfr_sub_ui)
+CGAL_GMPFR_TYPE_BINARY_OPERATOR(operator*=,unsigned long,mpfr_mul_ui)
+CGAL_GMPFR_TYPE_BINARY_OPERATOR(operator/=,unsigned long,mpfr_div_ui)
+
+CGAL_GMPFR_TYPE_BINARY_OPERATOR(operator+=,int,mpfr_add_si)
+CGAL_GMPFR_TYPE_BINARY_OPERATOR(operator-=,int,mpfr_sub_si)
+CGAL_GMPFR_TYPE_BINARY_OPERATOR(operator*=,int,mpfr_mul_si)
+CGAL_GMPFR_TYPE_BINARY_OPERATOR(operator/=,int,mpfr_div_si)
+
+CGAL_GMPFR_OBJECT_BINARY_OPERATOR(operator+=,Gmpz,mpz(),mpfr_add_z)
+CGAL_GMPFR_OBJECT_BINARY_OPERATOR(operator-=,Gmpz,mpz(),mpfr_sub_z)
+CGAL_GMPFR_OBJECT_BINARY_OPERATOR(operator*=,Gmpz,mpz(),mpfr_mul_z)
+CGAL_GMPFR_OBJECT_BINARY_OPERATOR(operator/=,Gmpz,mpz(),mpfr_div_z)
+
+#undef CGAL_GMPFR_OBJECT_BINARY_OPERATOR
+#undef CGAL_GMPFR_GMPFR_BINARY_OPERATOR
+#undef CGAL_GMPFR_TYPE_BINARY_OPERATOR
+
+// the static arithmetic functions are defined in a separate file
+#include <CGAL/GMP/Gmpfr_type_static.h>
+
+#define CGAL_GMPFR_ARITHMETIC_FUNCTION(_name,_fun) \
+        inline \
+        Gmpfr Gmpfr::_name (std::float_round_style r)const{ \
+                Gmpfr result(0,CGAL_GMPFR_MEMBER_PREC()); \
+                _fun(result.fr(),fr(),_gmp_rnd(r)); \
+                return result; \
+        } \
+        inline \
+        Gmpfr Gmpfr::_name (Gmpfr::Precision_type p, \
+                            std::float_round_style r)const{ \
+                CGAL_assertion(p>=MPFR_PREC_MIN&&p<=MPFR_PREC_MAX); \
+                Gmpfr result(0,p); \
+                _fun(result.fr(),fr(),_gmp_rnd(r)); \
+                return result; \
+        }
+
+CGAL_GMPFR_ARITHMETIC_FUNCTION(abs,mpfr_abs)
+CGAL_GMPFR_ARITHMETIC_FUNCTION(sqrt,mpfr_sqrt)
+CGAL_GMPFR_ARITHMETIC_FUNCTION(cbrt,mpfr_cbrt)
+
+inline
+Gmpfr Gmpfr::kthroot(int k,std::float_round_style r)const{
+        Gmpfr result(0,CGAL_GMPFR_MEMBER_PREC());
+        mpfr_root(result.fr(),fr(),k,_gmp_rnd(r));
+        return result;
+}
+
+inline
+Gmpfr Gmpfr::kthroot(int k,
+                     Gmpfr::Precision_type p,
+                     std::float_round_style r)const{
+        CGAL_assertion(p>=MPFR_PREC_MIN&&p<=MPFR_PREC_MAX);
+        Gmpfr result(0,p);
+        mpfr_root(result.fr(),fr(),k,_gmp_rnd(r));
+        return result;
+}
+
+CGAL_GMPFR_ARITHMETIC_FUNCTION(square,mpfr_sqr)
+
+#undef CGAL_GMPFR_ARITHMETIC_FUNCTION
+#undef CGAL_GMPFR_MEMBER_PREC
+#undef CGAL_GMPFR_MEMBER_PREC_2
+
+// comparison and query functions
+
+inline
+bool Gmpfr::is_zero()const{
+        return mpfr_zero_p(fr())!=0;
+}
+
+inline
+bool Gmpfr::is_one()const{
+        return mpfr_cmp_ui(fr(),1)==0;
+}
+
+inline
+bool Gmpfr::is_nan()const{
+        return mpfr_nan_p(fr())!=0;
+}
+
+inline
+bool Gmpfr::is_inf()const{
+        return mpfr_inf_p(fr())!=0;
+}
+
+inline
+bool Gmpfr::is_number()const{
+        return mpfr_number_p(fr())!=0;
+}
+
+inline
+Sign Gmpfr::sign()const{
+        int s=mpfr_sgn(fr());
+        return(s==0?ZERO:(s>0?POSITIVE:NEGATIVE));
+}
+
+inline
+bool Gmpfr::is_square()const{
+        Sign s=sign();
+        if(s==NEGATIVE)
+                return false;
+        if(s==ZERO)
+                return true;
+        std::pair<Gmpz,long> r=Gmpfr::to_integer_exp();
+        if(r.second%2)
+                r.first=r.first*2;
+        return mpz_perfect_square_p(r.first.mpz())!=0;
+}
+
+inline
+bool Gmpfr::is_square(Gmpfr &y)const{
+        bool ret=is_square();
+        if(ret)
+                y=sqrt();
+        return ret;
+}
+
+inline
+Comparison_result Gmpfr::compare(const Gmpfr& b)const{
+        int c=mpfr_cmp(fr(),b.fr());
+        return(c?(c>0?LARGER:SMALLER):EQUAL);
+}
+
+// conversion functions
+
+inline
+double Gmpfr::to_double(std::float_round_style r)const{
+        return mpfr_get_d(fr(),_gmp_rnd(r));
+}
+
+inline
+std::pair<double,double>Gmpfr::to_interval()const{
+        return std::make_pair(
+                        mpfr_get_d(fr(),MPFR_RNDD),
+                        mpfr_get_d(fr(),MPFR_RNDU));
+}
+
+inline
+std::pair<double,long> Gmpfr::to_double_exp(std::float_round_style r)const{
+        long e;
+        double d=mpfr_get_d_2exp(&e,fr(),_gmp_rnd(r));
+        return std::make_pair(d,e);
+}
+
+inline
+std::pair<std::pair<double,double>,long> Gmpfr::to_interval_exp()const{
+        long e1,e2;
+        double d_low=mpfr_get_d_2exp(&e1,fr(),MPFR_RNDD);
+        double d_upp=mpfr_get_d_2exp(&e2,fr(),MPFR_RNDU);
+        CGAL_assertion(e1==e2);
+        return std::make_pair(std::make_pair(d_low,d_upp),e1);
+}
+
+inline
+std::pair<Gmpz,long> Gmpfr::to_integer_exp()const{
+        if(this->is_zero())
+                return std::make_pair(Gmpz(0),long(0));
+
+        Gmpz z;
+        long e=CGAL_GMPFR_GET_Z_2EXP(z.mpz(),this->fr());
+
+        long zeros=mpz_scan1(z.mpz(),0);
+        CGAL_assertion(z==(z>>zeros)<<zeros);
+        z>>=zeros;
+        CGAL_assertion(z%2!=0);
+        e+=zeros;
+
+        CGAL_postcondition_code(if(e>=0))
+        CGAL_postcondition(
+              (*this)==(Gmpfr(z,(mpfr_prec_t)z.bit_size())*CGAL::ipower(Gmpfr(2),e)));
+        CGAL_postcondition_code(else)
+        CGAL_postcondition(((*this)*(Gmpz(1)<<(-e)))==z);
+
+        return std::make_pair(z,e);
+}
+
+
+// input/output
+
+// This function was based on the Gmpq's one. It reads a number in the form
+// MeE, where M and E are integers. The read number is M.2^E. The number
+// may contain spaces between integers and the 'e', but not in the middle
+// of the numbers.
+inline
+std::istream& operator>>(std::istream& is,Gmpfr &f){
+        std::istream::int_type c;
+        std::ios::fmtflags old_flags = is.flags();
+
+        is.unsetf(std::ios::skipws);
+        internal::eat_white_space(is);
+
+        // 1. read the mantissa, it starts in +, - or a digit and ends in e
+        Gmpz mant(0);           // the mantissa of the number
+        Gmpz exp(0);            // the exponent of the number
+        bool neg_mant=false;    // true iff the mantissa is negative
+        bool neg_exp=false;     // true iff the exponent is negative
+        c=is.peek();
+        switch(c){
+                case '-':
+                        neg_mant=true;
+                        is.get();
+                        internal::eat_white_space(is);
+                        break;
+                case '+':
+                        is.get();
+                        internal::eat_white_space(is);
+                        break;
+                case 'n':       // this is NaN
+                        is.get();
+                        if(is.get()=='a'&&is.get()=='n'){
+                                f=Gmpfr();
+                                return is;
+                        }
+                        else
+                                goto invalid_number;
+                default:
+                        if(c!='i'&&(c<'0'||c>'9')){     // invalid number
+                                invalid_number:
+                                is.setstate(std::ios_base::failbit);
+                                is.flags(old_flags);
+                                return is;
+                        }
+        }
+
+        // at this point, we have the sign of the number and we are ready
+        // to read the mantissa
+        c=is.get();
+        if(c=='i'){     // infinity comes
+                if(is.get()=='n'&&is.get()=='f'){
+                        f=Gmpfr();
+                        mpfr_set_inf(f.fr(),neg_mant?-1:1);
+                        return is;
+                }
+                else
+                        goto invalid_number;
+        }
+
+        while(c>='0'&&c<='9'){
+                mant=10*mant+(c-'0');
+                c=is.get();
+        }
+
+        // set the correct sign of the mantissa
+        if(neg_mant)
+                mant=-mant;
+
+        is.putback(static_cast<std::istream::char_type>(c));
+        internal::eat_white_space(is);
+
+        switch(c=is.get()){
+                case 'e':
+                        break;
+                default:
+                        is.setstate(std::ios_base::failbit);
+                        is.flags(old_flags);
+                        return is;
+        }
+        c=is.peek();
+        switch(c){
+                case '-':
+                        neg_exp=true;
+                        is.get();
+                        internal::eat_white_space(is);
+                        break;
+                case '+':
+                        is.get();
+                        internal::eat_white_space(is);
+                        break;
+                default:
+                        if(c<'0'||c>'9')
+                                goto invalid_number;
+        }
+        internal::eat_white_space(is);
+        while((c=is.get())>='0'&&c<='9')
+                exp=10*exp+(c-'0');
+        is.putback(static_cast<std::istream::char_type>(c));
+        if(exp.bit_size()>8*sizeof(mpfr_exp_t))
+                mpfr_set_erangeflag();
+
+        // we have now both exponent and mantissa
+        f=Gmpfr(mant,
+                static_cast<Gmpfr::Precision_type>(
+                        mant.bit_size()>MPFR_PREC_MIN?
+                        mant.bit_size():
+                        MPFR_PREC_MIN));
+        if(neg_exp)
+                mpfr_div_2ui(f.fr(),f.fr(),mpz_get_ui(exp.mpz()),MPFR_RNDN);
+        else
+                mpfr_mul_2ui(f.fr(),f.fr(),mpz_get_ui(exp.mpz()),MPFR_RNDN);
+
+        // this expensive assertion checks that we didn't lose bits when
+        // multiplying or dividing by 2^exp
+        CGAL_expensive_assertion_code( \
+                Gmpfr g(0,static_cast<Gmpfr::Precision_type>( \
+                                MPFR_PREC_MIN<mant.bit_size()? \
+                                mant.bit_size(): \
+                                MPFR_PREC_MIN)); \
+                if(neg_exp) \
+                        mpfr_div_2ui(g.fr(), \
+                                     f.fr(), \
+                                     mpz_get_ui(exp.mpz()), \
+                                     MPFR_RNDN); \
+                else \
+                        mpfr_mul_2ui(g.fr(), \
+                                     f.fr(), \
+                                     mpz_get_ui(exp.mpz()), \
+                                     MPFR_RNDN); \
+        )
+        CGAL_expensive_assertion(g==mant);
+
+        return is;
+}
+
+inline
+std::ostream& operator<<(std::ostream& os,const Gmpfr &a){
+        if(a.is_nan())
+                return os<<"nan";
+        if(a.is_inf())
+                return os<<(a<0?"-inf":"+inf");
+        // The rest of the function was written by George Tzoumas.
+        if (!is_pretty(os)) {
+                std::pair<Gmpz,long> ie=a.to_integer_exp();
+                os << ie.first << 'e' << ie.second;
+                return os;
+        } else {
+                // human-readable format
+                mpfr_exp_t expptr;
+                char *str = mpfr_get_str(NULL, &expptr, 10, 0, a.fr(),
+                                mpfr_get_default_rounding_mode());
+                if (str == NULL) return os << "@err@";
+                std::string s(str);
+                mpfr_free_str(str);
+                int i = 0;
+                size_t n = s.length();
+                size_t k = 0;
+                while (k < n && s[n-k-1] == '0') k++; // count trailing zeros
+                if (k == n) return os << "0";
+                else if (k) {
+                        s.erase(n-k, k);  // remove trailing zeros
+                        n = s.length();
+                }
+                bool exp = false;
+                if(s[0] == '-') { os << "-"; i++; n--; } // sign
+                if (expptr < -5) {              // .125e-99
+                        s.insert(i, 1, '.'); exp = true;
+                } else if (expptr < 0) {
+                        s.insert(i, -expptr, '0');  // .00000125 -- .0125
+                        s.insert(i, 1, '.');
+                // The following cast of expptr is done for avoiding some
+                // compiler warnings. The cast is exact, because we know
+                // expptr is not negative here.
+                } else if ((size_t)expptr < n) {        // .125 -- 12.5
+                        s.insert(i+expptr, 1, '.');
+                } else if (expptr - n <= 5) {   // 125 -- 12500000
+                        s.append(expptr - n, '0');
+                } else {                        // .125e99
+                        s.insert(i, 1, '.'); exp = true;
+                }
+                os << s.substr(i);
+                if (exp) os << "e" << expptr;
+                return os;
+        }
+}
+
+// comparisons
+
+inline
+bool operator<(const Gmpfr &a,const Gmpfr &b){
+        return mpfr_less_p(a.fr(),b.fr())!=0;
+}
+
+inline
+bool operator==(const Gmpfr &a,const Gmpfr &b){
+        return mpfr_equal_p(a.fr(),b.fr())!=0;
+}
+
+inline
+bool operator<(const Gmpfr &a,long b){
+        return(mpfr_cmp_si(a.fr(),b)<0);
+}
+
+inline
+bool operator>(const Gmpfr &a,long b){
+        return(mpfr_cmp_si(a.fr(),b)>0);
+}
+
+inline
+bool operator==(const Gmpfr &a,long b){
+        return !mpfr_cmp_si(a.fr(),b);
+}
+
+inline
+bool operator<(const Gmpfr &a,unsigned long b){
+        return(mpfr_cmp_ui(a.fr(),b)<0);
+}
+
+inline
+bool operator>(const Gmpfr &a,unsigned long b){
+        return(mpfr_cmp_ui(a.fr(),b)>0);
+}
+
+inline
+bool operator==(const Gmpfr &a,unsigned long b){
+        return !mpfr_cmp_ui(a.fr(),b);
+}
+
+inline
+bool operator<(const Gmpfr &a,int b){
+        return(mpfr_cmp_si(a.fr(),b)<0);
+}
+
+inline
+bool operator>(const Gmpfr &a,int b){
+        return(mpfr_cmp_si(a.fr(),b)>0);
+}
+
+inline
+bool operator==(const Gmpfr &a,int b){
+        return !mpfr_cmp_si(a.fr(),b);
+}
+
+inline
+bool operator<(const Gmpfr &a,double b){
+        return(mpfr_cmp_d(a.fr(),b)<0);
+}
+
+inline
+bool operator>(const Gmpfr &a,double b){
+        return(mpfr_cmp_d(a.fr(),b)>0);
+}
+
+inline
+bool operator==(const Gmpfr &a,double b){
+        return !mpfr_cmp_d(a.fr(),b);
+}
+
+// See the comment about mpfr_set_ld and MSVC++, above.
+#ifdef _MSC_VER
+inline
+bool operator<(const Gmpfr &a,long double b){
+        return(mpfr_cmp_d(a.fr(),b)<0);
+}
+
+inline
+bool operator>(const Gmpfr &a,long double b){
+        return(mpfr_cmp_d(a.fr(),b)>0);
+}
+
+inline
+bool operator==(const Gmpfr &a,long double b){
+        return !mpfr_cmp_d(a.fr(),b);
+}
+#else
+inline
+bool operator<(const Gmpfr &a,long double b){
+        return(mpfr_cmp_ld(a.fr(),b)<0);
+}
+
+inline
+bool operator>(const Gmpfr &a,long double b){
+        return(mpfr_cmp_ld(a.fr(),b)>0);
+}
+
+inline
+bool operator==(const Gmpfr &a,long double b){
+        return !mpfr_cmp_ld(a.fr(),b);
+}
+#endif
+
+inline
+bool operator<(const Gmpfr &a,const Gmpz &b){
+        return(mpfr_cmp_z(a.fr(),b.mpz())<0);
+}
+
+inline
+bool operator>(const Gmpfr &a,const Gmpz &b){
+        return(mpfr_cmp_z(a.fr(),b.mpz())>0);
+}
+
+inline
+bool operator==(const Gmpfr &a,const Gmpz &b){
+        return !mpfr_cmp_z(a.fr(),b.mpz());
+}
+
+inline
+Gmpfr min BOOST_PREVENT_MACRO_SUBSTITUTION(const Gmpfr& x,const Gmpfr& y){
+        return (x<=y)?x:y;
+}
+
+inline
+Gmpfr max BOOST_PREVENT_MACRO_SUBSTITUTION(const Gmpfr& x,const Gmpfr& y){
+        return (x>=y)?x:y;
+}
+
+} // namespace CGAL
+
+#endif  // CGAL_GMPFR_TYPE_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/GMP/Gmpfr_type_static.h b/3rdparty/CGAL/include/CGAL/GMP/Gmpfr_type_static.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/GMP/Gmpfr_type_static.h
rename to 3rdparty/CGAL/include/CGAL/GMP/Gmpfr_type_static.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/GMP/Gmpq_type.h b/3rdparty/CGAL/include/CGAL/GMP/Gmpq_type.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/GMP/Gmpq_type.h
rename to 3rdparty/CGAL/include/CGAL/GMP/Gmpq_type.h
diff --git a/3rdparty/CGAL/include/CGAL/GMP/Gmpz_type.h b/3rdparty/CGAL/include/CGAL/GMP/Gmpz_type.h
new file mode 100644
index 0000000..6173fc3
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/GMP/Gmpz_type.h
@@ -0,0 +1,438 @@
+// Copyright (c) 1999,2003,2004  
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved. 
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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(s)     : Andreas Fabri, Stefan Schirra, Sylvain Pion, Michael Hemmer
+
+
+#ifndef CGAL_GMPZ_TYPE_H
+#define CGAL_GMPZ_TYPE_H
+
+#include <CGAL/basic.h>
+#include <CGAL/IO/io.h>
+
+#include <CGAL/gmp.h>
+#include <mpfr.h>
+
+#include <boost/operators.hpp>
+#include <CGAL/Handle_for.h>
+
+#include <string>
+#include <locale>
+
+namespace CGAL {
+
+// TODO : benchmark without ref-counting, and maybe give the possibility
+// to select ref-counting or not, then... => template class.
+
+// Wrapper around mpz_t to get the destructor call mpz_clear.
+struct Gmpz_rep
+{
+// FIXME : bug if ~() is called before an mpz_init*() is called.
+// not a problem in practice, but not nice.
+// maybe the mpz_init_set* functions should move back to Gmpz_rep.
+// But then we should use the Storage_traits::construct/get...
+
+  mpz_t mpZ;
+
+  Gmpz_rep() {}
+  ~Gmpz_rep() { mpz_clear(mpZ); }
+
+private:
+  // Make sure it does not get accidentally copied.
+  Gmpz_rep(const Gmpz_rep &);
+  Gmpz_rep & operator= (const Gmpz_rep &);
+};
+
+
+class Gmpz
+  : Handle_for<Gmpz_rep>,
+    boost::ordered_euclidian_ring_operators1< Gmpz
+  , boost::ordered_euclidian_ring_operators2< Gmpz, int
+  , boost::ordered_euclidian_ring_operators2< Gmpz, long
+  , boost::ordered_euclidian_ring_operators2< Gmpz, unsigned long
+  , boost::shiftable< Gmpz , long
+  , boost::unit_steppable<Gmpz
+  , boost::bitwise<Gmpz
+> > > > > > >
+{
+  typedef Handle_for<Gmpz_rep> Base;
+public:
+  typedef Tag_true  Has_gcd;
+  typedef Tag_true  Has_division;
+  typedef Tag_true  Has_sqrt;
+
+  typedef Tag_true  Has_exact_ring_operations;
+  typedef Tag_true  Has_exact_division;
+  typedef Tag_false Has_exact_sqrt;
+
+  Gmpz()
+  { mpz_init(mpz()); }
+
+  Gmpz(const mpz_t z)
+  { mpz_init_set(mpz(), z); }
+
+  Gmpz(int i)
+  { mpz_init_set_si(mpz(), i); }
+
+  Gmpz(long l)
+  { mpz_init_set_si(mpz(), l); }
+
+  Gmpz(unsigned long l)
+  { mpz_init_set_ui(mpz(), l); }
+
+  Gmpz(double d)
+  {
+     CGAL_warning_msg(is_integer(d), "Gmpz constructed from non-integer double value");
+     CGAL_assertion(is_finite(d));
+     mpz_init_set_d(mpz(), d);
+   }
+
+  Gmpz(const std::string& str, int base = 10)
+  { mpz_init_set_str(mpz(), str.c_str(), base); }
+
+  // returns the number of bits used to represent this number
+  size_t bit_size() const { return mpz_sizeinbase(mpz(),2); }
+
+  // returns the memory size in bytes
+  size_t size() const { return mpz_size(mpz()) / (mp_bits_per_limb/8); }
+
+  // returns the number of decimal digits needed to represent this number
+  size_t approximate_decimal_length() const { return mpz_sizeinbase(mpz(),10); }
+
+  double to_double() const {return mpz_get_d(mpz());}
+  Sign sign() const { return static_cast<Sign>(mpz_sgn(mpz()));}
+
+  const mpz_t & mpz() const { return Ptr()->mpZ; }
+  mpz_t & mpz() { return ptr()->mpZ; }
+
+  #ifdef CGAL_ROOT_OF_2_ENABLE_HISTOGRAM_OF_NUMBER_OF_DIGIT_ON_THE_COMPLEX_CONSTRUCTOR
+  int tam() const { return 0; }  // put here a code
+                                 // measuring the number of digits
+                                 // of the Gmpz
+#endif
+
+#define CGAL_GMPZ_OBJECT_OPERATOR(_op,_class,_fun)    \
+  Gmpz& _op(const _class& z){                        \
+    Gmpz Res;                                         \
+    _fun(Res.mpz(), mpz(), z.mpz());                  \
+    swap(Res);                                        \
+    return *this;                                     \
+  }
+
+  CGAL_GMPZ_OBJECT_OPERATOR(operator+=,Gmpz,mpz_add);
+  CGAL_GMPZ_OBJECT_OPERATOR(operator-=,Gmpz,mpz_sub);
+  CGAL_GMPZ_OBJECT_OPERATOR(operator*=,Gmpz,mpz_mul);
+  CGAL_GMPZ_OBJECT_OPERATOR(operator/=,Gmpz,mpz_tdiv_q);
+  CGAL_GMPZ_OBJECT_OPERATOR(operator%=,Gmpz,mpz_tdiv_r);
+  CGAL_GMPZ_OBJECT_OPERATOR(operator&=,Gmpz,mpz_and);
+  CGAL_GMPZ_OBJECT_OPERATOR(operator|=,Gmpz,mpz_ior);
+  CGAL_GMPZ_OBJECT_OPERATOR(operator^=,Gmpz,mpz_xor);
+#undef CGAL_GMPZ_OBJECT_OPERATOR
+
+  bool operator<(const Gmpz &b) const
+  { return mpz_cmp(this->mpz(), b.mpz()) < 0; }
+  bool operator==(const Gmpz &b) const
+  { return mpz_cmp(this->mpz(), b.mpz()) == 0; }
+
+
+  Gmpz operator+() const {return Gmpz( mpz() );}
+  Gmpz operator-() const {
+    Gmpz Res;
+    mpz_neg(Res.mpz(), mpz());
+    return Res;
+  }
+
+  Gmpz& operator <<= (const unsigned long& i){
+    Gmpz Res;
+    mpz_mul_2exp(Res.mpz(),this->mpz(), i);
+    swap(Res);
+    return *this;
+  }
+  Gmpz& operator >>= (const unsigned long& i){
+    Gmpz Res;
+    mpz_tdiv_q_2exp(Res.mpz(),this->mpz(), i);
+    swap(Res);
+    return *this;
+  }
+
+  Gmpz& operator++(){return *this+=1;}
+  Gmpz& operator--(){return *this-=1;}
+
+
+  // interoperability with int
+  Gmpz& operator+=(int i);
+  Gmpz& operator-=(int i);
+  Gmpz& operator*=(int i);
+  Gmpz& operator/=(int i);
+  bool  operator==(int i) const {return mpz_cmp_si(this->mpz(), i) == 0;};
+  bool  operator< (int i) const {return mpz_cmp_si(this->mpz(), i) < 0;};
+  bool  operator> (int i) const {return mpz_cmp_si(this->mpz(), i) > 0;};
+
+  // interoperability with long
+  Gmpz& operator+=(long i);
+  Gmpz& operator-=(long i);
+  Gmpz& operator*=(long i);
+  Gmpz& operator/=(long i);
+  bool  operator==(long i) const {return mpz_cmp_si(this->mpz(), i) == 0;};
+  bool  operator< (long i) const {return mpz_cmp_si(this->mpz(), i) < 0;};
+  bool  operator> (long i) const {return mpz_cmp_si(this->mpz(), i) > 0;};
+
+  // interoperability with unsigned long
+  Gmpz& operator+=(unsigned long i);
+  Gmpz& operator-=(unsigned long i);
+  Gmpz& operator*=(unsigned long i);
+  Gmpz& operator/=(unsigned long i);
+  bool  operator==(unsigned long i) const {return mpz_cmp_ui(this->mpz(), i) == 0;};
+  bool  operator< (unsigned long i) const {return mpz_cmp_ui(this->mpz(), i) < 0;};
+  bool  operator> (unsigned long i) const {return mpz_cmp_ui(this->mpz(), i) > 0;};
+};
+
+
+
+#define CGAL_GMPZ_SCALAR_OPERATOR(_op,_type,_fun)   \
+  inline Gmpz& Gmpz::_op(_type z) {                 \
+    Gmpz Res;                                       \
+    _fun(Res.mpz(), mpz(), z);                      \
+    swap(Res);                                      \
+    return *this;                                   \
+  }
+
+CGAL_GMPZ_SCALAR_OPERATOR(operator*=,int,mpz_mul_si)
+CGAL_GMPZ_SCALAR_OPERATOR(operator*=,long,mpz_mul_si)
+
+CGAL_GMPZ_SCALAR_OPERATOR(operator+=,unsigned long,mpz_add_ui)
+CGAL_GMPZ_SCALAR_OPERATOR(operator-=,unsigned long,mpz_sub_ui)
+CGAL_GMPZ_SCALAR_OPERATOR(operator*=,unsigned long,mpz_mul_ui)
+CGAL_GMPZ_SCALAR_OPERATOR(operator/=,unsigned long,mpz_tdiv_q_ui)
+#undef CGAL_GMPZ_SCALAR_OPERATOR
+
+
+inline Gmpz& Gmpz::operator+=(int i)
+{
+  Gmpz Res;
+  if (i >= 0)
+    mpz_add_ui(Res.mpz(), mpz(), i);
+  else
+    mpz_sub_ui(Res.mpz(), mpz(), -i);
+  swap(Res);
+  return *this;
+}
+
+inline Gmpz& Gmpz::operator+=(long i)
+{
+  Gmpz Res;
+  if (i >= 0)
+    mpz_add_ui(Res.mpz(), mpz(), i);
+  else
+    mpz_sub_ui(Res.mpz(), mpz(), -i);
+  swap(Res);
+  return *this;
+}
+
+
+
+inline Gmpz& Gmpz::operator-=(int  i){return *this+=-i;}
+inline Gmpz& Gmpz::operator-=(long i){return *this+=-i;}
+
+inline Gmpz& Gmpz::operator/=(int b) {
+  if (b>0) {
+    Gmpz Res;
+    mpz_tdiv_q_ui(Res.mpz(), mpz(), b);
+    swap(Res);
+    return *this;
+  }
+  return *this /= Gmpz(b);
+}
+
+inline Gmpz& Gmpz::operator/=(long b) {
+  if (b>0) {
+    Gmpz Res;
+    mpz_tdiv_q_ui(Res.mpz(), mpz(), b);
+    swap(Res);
+    return *this;
+  }
+  return *this /= Gmpz(b);
+}
+
+inline
+std::ostream&
+operator<<(std::ostream& os, const Gmpz &z)
+{
+  char *str = new char [mpz_sizeinbase(z.mpz(),10) + 2];
+  str = mpz_get_str(str, 10, z.mpz());
+  os << str ;
+  delete[] str;
+  return os;
+}
+
+
+inline
+std::istream &
+gmpz_new_read(std::istream &is, Gmpz &z)
+{
+  bool negative = false;
+  const std::istream::char_type zero = '0';
+  std::istream::int_type c;
+  Gmpz r;
+  std::ios::fmtflags old_flags = is.flags();
+
+  is.unsetf(std::ios::skipws);
+  internal::eat_white_space(is);
+
+  c=is.peek();
+  if (c=='-' || c=='+'){
+      is.get();
+      CGAL_assertion(!is.fail());
+      negative=(c=='-');
+      internal::eat_white_space(is);
+      c=is.peek();
+  }
+
+  std::istream::char_type cc= static_cast<std::istream::char_type>(c);
+
+  if (c== std::istream::traits_type::eof() ||
+      !std::isdigit(cc, std::locale::classic() ) ){
+    is.setstate(std::ios_base::failbit);
+  } else {
+    CGAL_assertion(cc==c);
+    r= cc-zero;
+    is.get();
+    CGAL_assertion(!is.fail());
+
+    // The following loop was supposed to be an infinite loop with:
+    //   while (true)
+    // where the break condition is that is.peek() returns and EOF or a
+    // non-digit character.
+    //
+    // Unfortunately, the wording of the C++03 and C++11 standard was not
+    // well understood by the authors of libc++ (the STL of clang++) and,
+    // in the version of libc++ shipped with Apple-clang-3.2,
+    // istream::peek() set the flag eofbit when it reads the last character
+    // of the stream *instead* of setting it only when it *tries to read
+    // past the last character*. For that reason, to avoid that the next
+    // peek() sets also the failbit, one has to check for EOL twice.
+    //
+    // See the LWG C++ Issue 2036, classified as Not-A-Defect:
+    //   http://lwg.github.com/issues/lwg-closed.html#2036
+    // and a StackOverflow related question:
+    //   http://stackoverflow.com/a/9020292/1728537
+    // --
+    // Laurent Rineau, 2013/10/10
+    while (!is.eof()) {
+      c=is.peek();
+      if (c== std::istream::traits_type::eof()) {
+        break;
+      }
+      cc=static_cast<std::istream::char_type>(c);
+      if  ( !std::isdigit(cc, std::locale::classic() )) {
+        break;
+      }
+      is.get();
+      CGAL_assertion(!is.fail());
+      CGAL_assertion(cc==c);
+      r= r*10+(cc-zero);
+    }
+  }
+
+  is.flags(old_flags);
+  if (!is.fail()) {
+    if (negative) {
+      z=-r;
+    } else {
+      z=r;
+    }
+  }
+  return is;
+}
+
+/*inline
+std::istream&
+read_gmpz(std::istream& is, Gmpz &z) {
+  bool negative = false;
+  bool good = false;
+  const int null = '0';
+  char c;
+  Gmpz tmp;
+  std::ios::fmtflags old_flags = is.flags();
+
+  is.unsetf(std::ios::skipws);
+  while (is.get(c) && std::isspace(c, std::locale::classic() ))
+  {}
+
+  if (c == '-')
+  {
+        negative = true;
+        while (is.get(c) && std::isspace(c, std::locale::classic() ))
+        {}
+  }
+  if (std::isdigit(c, std::locale::classic() ))
+  {
+        good = true;
+        tmp = c - null;
+        while (is.get(c) && std::isdigit(c, std::locale::classic() ))
+        {
+            tmp = 10*tmp + (c-null);
+        }
+  }
+  if (is)
+        is.putback(c);
+  if (sign(tmp) != ZERO && negative)
+      tmp = -tmp;
+  if (good){
+      z = tmp;
+      }
+   else
+    is.clear(is.rdstate() | std::ios::failbit);
+
+  is.flags(old_flags);
+  return is;
+  }*/
+
+inline
+std::istream&
+operator>>(std::istream& is, Gmpz &z)
+{
+  return gmpz_new_read(is, z);
+}
+
+template <>
+struct Split_double<Gmpz>
+{
+  void operator()(double d, Gmpz &num, Gmpz &den) const
+  {
+    std::pair<double, double> p = split_numerator_denominator(d);
+    num = Gmpz(p.first);
+    den = Gmpz(p.second);
+  }
+};
+
+inline Gmpz min BOOST_PREVENT_MACRO_SUBSTITUTION(const Gmpz& x,const Gmpz& y){
+  return (x<=y)?x:y;
+}
+inline Gmpz max BOOST_PREVENT_MACRO_SUBSTITUTION(const Gmpz& x,const Gmpz& y){
+  return (x>=y)?x:y;
+}
+
+
+} //namespace CGAL
+
+#endif // CGAL_GMPZ_TYPE_H
diff --git a/3rdparty/CGAL/include/CGAL/GMP/Gmpzf_type.h b/3rdparty/CGAL/include/CGAL/GMP/Gmpzf_type.h
new file mode 100644
index 0000000..30fb488
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/GMP/Gmpzf_type.h
@@ -0,0 +1,591 @@
+// Copyright (c) 1997-2001  ETH Zurich (Switzerland).
+// 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(s)     : Bernd Gaertner <gaertner at inf.ethz.ch>
+
+#ifndef CGAL_GMPZF_TYPE_H
+#define CGAL_GMPZF_TYPE_H
+
+// includes
+#include <CGAL/basic.h>
+#include <CGAL/Handle_for.h>
+#include <CGAL/gmp.h>
+#include <mpfr.h>
+#include <CGAL/Quotient.h>
+#include <CGAL/GMP/Gmpz_type.h>
+#include <boost/operators.hpp>
+#include <iostream>
+#include <cmath>
+#include <limits>
+#include <string>
+#include <utility>
+
+namespace CGAL {
+
+//internal fwd
+class Gmpzf;
+bool operator<(const Gmpzf &a, const Gmpzf &b);
+bool operator==(const Gmpzf &a, const Gmpzf &b);
+bool operator<(const Gmpzf &a, int b);
+bool operator==(const Gmpzf &a, int b);
+bool operator>(const Gmpzf &a, int b);
+Gmpzf approximate_sqrt(const Gmpzf &f);
+
+struct Gmpzf_rep // as in Gmpz.h
+{
+// FIXME : bug if ~() is called before an mpz_init*() is called.
+// not a problem in practice, but not nice.
+// maybe the mpz_init_set* functions should move back to Gmpz_rep.
+// But then we should use the Storage_traits::construct/get...
+
+  mpz_t mpZ;
+
+  Gmpzf_rep() {}
+  ~Gmpzf_rep() { mpz_clear(mpZ); }
+
+private:
+  // Make sure it does not get accidentally copied.
+  Gmpzf_rep(const Gmpzf_rep &);
+  Gmpzf_rep & operator= (const Gmpzf_rep &);
+};
+
+// class declaration
+// =================
+// This is an exact floating point type; it can represent numbers
+// of the form m*2^e, where m is of type mpz_t and e (currently)
+// of type long
+
+class Gmpzf :
+  Handle_for<Gmpzf_rep>,
+    boost::ordered_euclidian_ring_operators1< Gmpzf
+  , boost::ordered_euclidian_ring_operators2< Gmpzf, int
+    > >
+{
+  typedef Handle_for<Gmpzf_rep> Base;
+
+public:
+
+  // exponent type
+  // --------------------
+  typedef long Exponent; // may overflow, but if it does, the mantissa is
+                         // potentially too large to be useful, anyway;
+                         // still, repeated squaring of a power of two
+                         // quickly brings this type to its limits...
+
+  friend Gmpzf approximate_sqrt(const Gmpzf &f);
+
+private:
+  // data members (mantissa is from Gmpzf_rep)
+  // ----------------------------------------
+  // Invariant:
+  // - number is in canonical form, i.e.(m,e) == 0 or m is odd
+  Exponent  e;
+
+public:
+  // access
+  // ------
+  const mpz_t& man() const
+  {
+    return Ptr()->mpZ;
+  }
+
+  mpz_t& man()
+  {
+    return ptr()->mpZ;
+  }
+
+  const Exponent& exp() const
+  {
+    return e;
+  }
+
+  // construction
+  // ------------
+
+  Gmpzf( )
+    : e(0)
+  {
+    mpz_init(man());
+    CGAL_postcondition(is_canonical());
+  }
+
+
+  Gmpzf(const mpz_t z)
+    : e(0)
+  {
+    mpz_init_set(man(), z);
+    canonicalize();
+  }
+
+
+  Gmpzf(const Gmpz& n )
+    : e(0)
+  {
+    mpz_init_set(man(), n.mpz());
+    canonicalize();
+  }
+
+
+  Gmpzf( int i)
+    : e(0)
+  {
+    mpz_init_set_si( man(), i);
+    canonicalize();
+  }
+
+  Gmpzf( long l)
+    : e(0)
+  {
+    mpz_init_set_si( man(), l);
+    canonicalize();
+  }
+
+  Gmpzf( double d)
+  {
+    Protect_FPU_rounding<> P(CGAL_FE_TONEAREST);
+    if (d == 0) {
+      mpz_init (man());
+      e = 0;
+      return;
+    }
+    const int p = std::numeric_limits<double>::digits;
+    CGAL_assertion(CGAL_NTS is_finite(d) & is_valid(d));
+    int exp;
+    double x = std::frexp(d, &exp); // x in [1/2, 1], x*2^exp = d
+    mpz_init_set_d (man(), // to the following integer:
+		    std::ldexp( x, p));
+    e = exp - p;
+    canonicalize();
+  }
+
+  // arithmetics
+  // -----------
+  Gmpzf operator+() const;
+  Gmpzf operator-() const;
+  Gmpzf& operator+=( const Gmpzf& b);
+  Gmpzf& operator+=( int i);
+  Gmpzf& operator-=( const Gmpzf& b);
+  Gmpzf& operator-=( int i);
+  Gmpzf& operator*=( const Gmpzf& b);
+  Gmpzf& operator*=( int i);
+  Gmpzf& div(const Gmpzf& b);
+  Gmpzf& operator%= (const Gmpzf& b);
+  Gmpzf& div(int i);
+  Gmpzf& operator%= (int i);
+  bool is_zero() const;
+  Sign sign() const;
+  Gmpzf integral_division(const Gmpzf& b) const;
+  Gmpzf gcd (const Gmpzf& b) const;
+  Comparison_result compare (const Gmpzf &b) const;
+  double to_double() const ;
+  std::pair<double, double> to_interval() const ;
+  std::pair<double, long> to_double_exp() const;
+  std::pair<std::pair<double, double>, long> to_interval_exp() const ;
+private:
+  void canonicalize();
+  bool is_canonical() const;
+  static void align ( const mpz_t*& a_aligned, const mpz_t*& b_aligned,
+		     Exponent& rexp, const Gmpzf& a, const Gmpzf& b);
+};
+
+
+
+
+
+// implementation
+// ==============
+
+// arithmetics
+// -----------
+
+inline
+Gmpzf Gmpzf::operator+() const
+{
+    return *this;
+}
+
+inline
+Gmpzf Gmpzf::operator-() const
+{
+  Gmpzf result;
+  mpz_neg (result.man(), man());
+  result.e = exp();
+  CGAL_postcondition(is_canonical());
+  return result;
+}
+
+inline
+Gmpzf& Gmpzf::operator+=( const Gmpzf& b)
+{
+  Gmpzf result;
+  if (b.is_zero()) return *this; // important in sparse contexts
+  const mpz_t *a_aligned, *b_aligned;
+  align (a_aligned, b_aligned, e, *this, b);
+  mpz_add(result.man(), *a_aligned, *b_aligned);
+  swap(result);
+  canonicalize();
+  return(*this);
+}
+
+inline
+Gmpzf& Gmpzf::operator+=( int i)
+{
+  return operator+=(Gmpzf (i));   // could be optimized, but why?
+}
+
+inline
+Gmpzf& Gmpzf::operator-=( const Gmpzf& b)
+{
+  Gmpzf result;
+  if (b.is_zero()) return *this; // important in sparse contexts
+  const mpz_t *a_aligned, *b_aligned;
+  align (a_aligned, b_aligned, e, *this, b);
+  mpz_sub(result.man(), *a_aligned, *b_aligned);
+  swap(result);
+  canonicalize();
+  return(*this);
+}
+
+inline
+Gmpzf& Gmpzf::operator-=( int i)
+{
+  return operator-=(Gmpzf (i));   // could be optimized, but why?
+}
+
+inline
+Gmpzf& Gmpzf::operator*=( const Gmpzf& b)
+{
+  Gmpzf result;
+  mpz_mul(result.man(), man(), b.man());
+  e += b.exp();
+  swap (result);
+  if(is_zero()) e=0; // product is 0 or odd, so we can skip canonicalize()
+  CGAL_postcondition(is_canonical());
+  return *this;
+}
+
+inline
+Gmpzf& Gmpzf::operator*=( int i)
+{
+  Gmpzf result;
+  mpz_mul_si(result.man(), man(), i);
+  swap (result);
+  canonicalize();
+  return *this;
+}
+
+// *this = m1 * 2 ^ e1 = a_aligned * 2 ^ rexp
+//     b = m2 * 2 ^ e2 = b_aligned * 2 ^ rexp,   where rexp = min (e1, e2)
+//
+// => a / b = a div b = (a_aligned div b_aligned)
+//            a mod b = (a_aligned mod b_aligned) * 2 ^ rexp
+inline
+Gmpzf& Gmpzf::div(const Gmpzf& b)
+{
+  CGAL_precondition(!b.is_zero());
+  Gmpzf result;
+  const mpz_t *a_aligned, *b_aligned;
+  align (a_aligned, b_aligned, e, *this, b);
+  mpz_tdiv_q (result.man(), *a_aligned, *b_aligned); // round towards zero
+  e = 0;
+  swap(result);
+  canonicalize();
+  return(*this);
+}
+
+inline
+Gmpzf& Gmpzf::operator%= (const Gmpzf& b)
+{
+  CGAL_precondition(!b.is_zero());
+  Gmpzf result;
+  const mpz_t *a_aligned, *b_aligned;
+  align (a_aligned, b_aligned, e, *this, b);
+  mpz_tdiv_r (result.man(), *a_aligned, *b_aligned);
+  swap(result);
+  canonicalize();
+  return(*this);
+}
+
+inline
+Gmpzf& Gmpzf::div(int i)
+{
+  return div(Gmpzf(i));
+}
+
+inline
+Gmpzf& Gmpzf::operator%= (int i)
+{
+  return operator%= (Gmpzf(i));
+}
+
+inline
+bool Gmpzf::is_zero() const
+{
+  return mpz_sgn( man()) == 0;
+}
+
+inline
+Sign Gmpzf::sign() const
+{
+  return static_cast<Sign>(mpz_sgn( man()));
+}
+
+inline
+Gmpzf Gmpzf::integral_division(const Gmpzf& b) const
+{
+  Gmpzf result;
+  mpz_divexact(result.man(), man(), b.man());
+  result.e = exp()-b.exp();
+  result.canonicalize();
+  CGAL_postcondition (*this == b * result);
+  return result;
+}
+
+inline
+Gmpzf Gmpzf::gcd (const Gmpzf& b) const
+{
+  Gmpzf result;
+  mpz_gcd (result.man(), man(), b.man()); // exponent is 0
+  result.canonicalize();
+  return result;
+}
+
+inline
+Gmpzf approximate_sqrt(const Gmpzf &f)
+{
+  // is there a well-defined sqrt at all?? Here we do the
+  // following: write *this as m * 2 ^ e with e even, and
+  // then return sqrt(m) * 2 ^ (e/2)
+  Gmpzf result;
+  // make exponent even
+  if (f.exp() % 2 == 0) {
+    mpz_set (result.man(), f.man());
+  } else {
+    mpz_mul_2exp (result.man(), f.man(), 1);
+  }
+  mpz_sqrt(result.man(), result.man());
+  result.e = f.exp() / 2;
+  result.canonicalize();
+  return result;
+}
+
+inline
+Comparison_result Gmpzf::compare (const Gmpzf &b) const
+{
+  const mpz_t *a_aligned, *b_aligned;
+  Exponent rexp; // ignored
+  align (a_aligned, b_aligned, rexp, *this, b);
+  int c = mpz_cmp(*a_aligned, *b_aligned);
+  if (c < 0) return SMALLER;
+  if (c > 0) return LARGER;
+  return EQUAL;
+}
+
+inline
+double Gmpzf::to_double() const
+{
+  Exponent k;                                 // exponent
+  double l = mpz_get_d_2exp (&k, man());      // mantissa in [0.5,1)
+  return std::ldexp(l, static_cast<int>(k+exp()));
+}
+
+
+
+// internal functions
+inline
+std::pair<double, long> Gmpzf::to_double_exp() const
+{
+  Exponent k = 0;
+  double l = mpz_get_d_2exp (&k, man());
+  return std::pair<double, long>(l, k+exp());
+}
+
+inline
+std::pair<std::pair<double, double>, long> Gmpzf::to_interval_exp() const
+{
+  // get surrounding interval of the form [l * 2 ^ k, u * 2^ k]
+  // first get mantissa in the form l*2^k, with 0.5 <= d < 1;
+  // truncation is guaranteed to go towards zero
+  long k = 0;
+  double l = mpz_get_d_2exp (&k, man());
+  // l = +/- 0.1*...*
+  //           ------
+  //           53 digits
+  // in order to round away from zero, it suffices to add/subtract 2^-53
+  double u = l;
+  if (l < 0)
+    // u is already the upper bound, decrease l to get lower bound
+    l -= std::ldexp(1.0, -53);
+  else
+    // l is already the lower bound, increase u to get upper bound
+    u += std::ldexp(1.0, -53);
+  // the interval is now [l * 2^(k + exp()), u * 2^(k + exp())]
+  // we may cast the exponents to int, since if that's going to
+  // create an overflow, we correctly get infinities
+  return std::pair<std::pair<double, double>, long>
+    (std::pair<double, double>(l, u), k + exp());
+}
+
+inline
+std::pair<double, double> Gmpzf::to_interval() const
+{
+  std::pair<std::pair<double, double>, long> lue = to_interval_exp();
+  double l = lue.first.first;
+  double u = lue.first.second;
+  int k = static_cast<int>(lue.second);
+  return std::pair<double,double> (std::ldexp (l, k), std::ldexp (u, k));
+}
+
+inline
+void Gmpzf::canonicalize()
+{
+  if (!is_zero()) {
+    // chop off trailing zeros in m
+    unsigned long zeros = mpz_scan1(man(), 0);
+    if (zeros != 0) {
+      mpz_tdiv_q_2exp( man(), man(), zeros);  // bit-wise right-shift
+      e += zeros;
+    }
+  } else {
+    e = 0;
+  }
+  CGAL_postcondition(is_canonical());
+}
+
+inline
+bool Gmpzf::is_canonical() const
+{
+  return (is_zero() && e==0) || mpz_odd_p (man());
+}
+
+// align a and b such that they have the same exponent:
+// a = m1 * 2 ^ e1 -> a_aligned * 2 ^ rexp,
+// b = m2 * 2 ^ e2 -> b_aligned * 2 ^ rexp,   where rexp = min (e1, e2)
+//
+// function sets (pointers to) a_aligned and b_aligned and rexp;
+// it uses the static s to store the shifted number
+inline
+void Gmpzf::align ( const mpz_t*& a_aligned,
+			   const mpz_t*& b_aligned,
+			   Exponent& rexp,
+			   const Gmpzf& a, const Gmpzf& b) {
+  static Gmpz s;
+  switch (CGAL_NTS compare (b.exp(), a.exp())) {
+  case SMALLER:
+    {
+      // leftshift of a to reach b.exp()
+      mpz_mul_2exp (s.mpz(), a.man(), a.exp() - b.exp());
+      const mpz_t& smpzref = s.mpz();  // leftshifted a
+      a_aligned = &smpzref;  // leftshifted a
+      const mpz_t& bmanref = b.man();
+      b_aligned = &bmanref;  // b
+      rexp = b.exp();
+      break;
+    }
+  case LARGER:
+    {
+      // leftshift of b to reach a.exp()
+      mpz_mul_2exp (s.mpz(), b.man(), b.exp() - a.exp());
+      const mpz_t& amanref = a.man();
+      a_aligned = &amanref; // a
+      const mpz_t& smpzref = s.mpz();  // leftshifted b
+      b_aligned = &smpzref; // leftshifted b
+      rexp = a.exp();
+      break;
+    }
+  default:
+  case EQUAL:
+    {
+      const mpz_t& amanref = a.man();
+      a_aligned = &amanref;
+      const mpz_t& bmanref = b.man();
+      b_aligned = &bmanref;
+      rexp = a.exp();
+    }
+  }
+}
+
+// input/output
+// ------------
+inline
+std::ostream& operator<< (std::ostream& os, const Gmpzf& a)
+{
+    return os << a.to_double();
+}
+
+inline
+std::ostream& print (std::ostream& os, const Gmpzf& a)
+{
+  return os << a.man() << "*2^" << a.exp();
+}
+
+inline
+std::istream&  operator>> ( std::istream& is, Gmpzf& a)
+{
+  // simply read from double
+  double d;
+  is >> d;
+  if (is)
+    a = Gmpzf(d);
+  return is;
+}
+
+// comparisons
+// -----------
+
+inline
+bool operator<(const Gmpzf &a, const Gmpzf &b)
+{
+  return a.compare(b) == SMALLER;
+}
+
+inline
+bool operator==(const Gmpzf &a, const Gmpzf &b)
+{
+  return ( (mpz_cmp(a.man(), b.man()) == 0) && a.exp() == b.exp() );
+}
+
+// mixed operators
+inline
+bool operator<(const Gmpzf &a, int b)
+{
+  return operator<(a, Gmpzf(b));
+}
+
+inline
+bool operator==(const Gmpzf &a, int b)
+{
+  return operator==(a, Gmpzf(b));
+}
+
+inline
+bool operator>(const Gmpzf &a, int b)
+{
+  return operator>(a, Gmpzf(b));
+}
+
+inline Gmpzf min BOOST_PREVENT_MACRO_SUBSTITUTION(const Gmpzf& x,const Gmpzf& y){
+  return (x<=y)?x:y; 
+}
+inline Gmpzf max BOOST_PREVENT_MACRO_SUBSTITUTION(const Gmpzf& x,const Gmpzf& y){
+  return (x>=y)?x:y; 
+}
+
+} //namespace CGAL
+
+#endif // CGAL_GMPZF_TYPE_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/GMP_arithmetic_kernel.h b/3rdparty/CGAL/include/CGAL/GMP_arithmetic_kernel.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/GMP_arithmetic_kernel.h
rename to 3rdparty/CGAL/include/CGAL/GMP_arithmetic_kernel.h
diff --git a/3rdparty/CGAL/include/CGAL/General_polygon_2.h b/3rdparty/CGAL/include/CGAL/General_polygon_2.h
new file mode 100644
index 0000000..5654bb3
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/General_polygon_2.h
@@ -0,0 +1,221 @@
+// Copyright (c) 2005  Tel-Aviv University (Israel).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Baruch Zukerman <baruchzu at post.tau.ac.il>
+
+#ifndef CGAL_GENERAL_POLYGON_2_H
+#define CGAL_GENERAL_POLYGON_2_H
+
+#include <list>
+#include <CGAL/Boolean_set_operations_2/Gps_traits_adaptor.h>
+#include <CGAL/Bbox_2.h>
+
+
+namespace CGAL {
+
+template <class Arr_traits>
+class General_polygon_2
+{
+public:
+
+  typedef Arr_traits                                 Traits_2;
+  typedef typename Traits_2::Point_2                 Point_2;
+  typedef typename Traits_2::X_monotone_curve_2      X_monotone_curve_2;
+  typedef std::list<X_monotone_curve_2>              Containter;
+  typedef typename Containter::iterator              Curve_iterator;
+  typedef typename Containter::const_iterator        Curve_const_iterator;
+
+protected:
+  std::list<X_monotone_curve_2>    m_xcurves;
+
+public:
+
+  General_polygon_2(){}
+
+  template <class CurveIterator>
+  General_polygon_2(CurveIterator begin,
+                    CurveIterator end) : m_xcurves (begin, end)
+  {}
+
+  template <class CurveIterator>
+  void init(CurveIterator begin, CurveIterator end)
+  {
+    m_xcurves.clear();
+    m_xcurves.insert(m_xcurves.end(), begin, end);
+  }
+
+  template <class CurveIterator>
+  void insert(CurveIterator begin, CurveIterator end)
+  {
+    m_xcurves.insert(m_xcurves.end(), begin, end);
+  }
+
+  bool is_empty() const
+  {
+    return m_xcurves.empty();
+  }
+
+  unsigned int size() const
+  {
+    return static_cast<unsigned int>(m_xcurves.size());
+  }
+
+  Curve_iterator curves_begin()
+  {
+    return m_xcurves.begin();
+  }
+
+  Curve_iterator curves_end()
+  {
+    return m_xcurves.end();
+  }
+
+  Curve_const_iterator curves_begin() const
+  {
+    return m_xcurves.begin();
+  }
+
+  Curve_const_iterator curves_end() const
+  {
+    return m_xcurves.end();
+  }
+
+  void push_back(const X_monotone_curve_2& cv)
+  {
+    m_xcurves.push_back(cv);
+  }
+
+  void clear()
+  {
+    m_xcurves.clear();
+  }
+
+  Curve_iterator erase(Curve_iterator it)
+  {
+    return (m_xcurves.erase(it));
+  }
+
+  Orientation orientation() const
+  {
+    Gps_traits_adaptor<Traits_2>  tr;
+    return (tr.orientation_2_object()(m_xcurves.begin(), m_xcurves.end()));
+  }
+  
+  void reverse_orientation()
+  {
+    m_xcurves.reverse();
+    Traits_2 tr;
+    typename Traits_2::Construct_opposite_2 ctr_opp =
+      tr.construct_opposite_2_object();
+    for(Curve_iterator ci = m_xcurves.begin(); ci != m_xcurves.end(); ++ci)
+    {
+      const X_monotone_curve_2& opp_cv = ctr_opp(*ci);
+      *ci = opp_cv;
+    }
+  }
+
+  template <class OutputIterator>
+  void approximate(OutputIterator oi, unsigned int n) const
+  {
+    for(Curve_const_iterator itr = m_xcurves.begin();
+        itr != m_xcurves.end();
+        ++itr)
+    {
+      itr->approximate(oi, n);
+    }
+  }
+
+  Bbox_2 bbox() const
+  {
+    Bbox_2 result;
+    if(m_xcurves.empty())
+      return (result);
+
+    Curve_const_iterator first = m_xcurves.begin();
+    result = first->bbox();
+
+    for(++first; first != m_xcurves.end(); ++first)
+    {
+      result = result + first->bbox();
+    }
+      
+    return result;
+  }
+};
+
+
+//-----------------------------------------------------------------------//
+//                          operator>>
+//-----------------------------------------------------------------------//
+
+template <class Traits>
+std::istream &operator>>(std::istream &is, General_polygon_2<Traits>& p)
+{
+  int n; // number of edges
+  is >> n;
+  typename Traits::X_monotone_curve_2 cv;
+ 
+  if (is) {
+      p.clear();
+      for (int i=0; i<n; i++) {
+        is >> cv;
+        p.push_back(cv);
+      }
+  }
+ 
+  return is;
+}
+
+//-----------------------------------------------------------------------//
+//                          operator<<
+//-----------------------------------------------------------------------//
+
+template <class Traits>
+std::ostream
+&operator<<(std::ostream &os, const General_polygon_2<Traits>& p)
+{
+  typename General_polygon_2<Traits>::Curve_const_iterator i;
+
+  switch(get_mode(os)) {
+    case IO::ASCII :
+      os << p.size() << ' ';
+      for (i = p.curves_begin(); i != p.curves_end(); ++i) {
+        os << *i << ' ';
+      }
+      return os;
+
+    case IO::BINARY :
+      os << p.size();
+      for (i = p.curves_begin(); i != p.curves_end(); ++i) {
+        os << *i;
+      }
+      return os;
+
+    default:
+      os << "Polygon_2(" << std::endl;
+      for (i = p.curves_begin(); i != p.curves_end(); ++i) {
+        os << "  " << *i << std::endl;
+      }
+      os << ")" << std::endl;
+      return os;
+  }
+}
+
+} //namespace CGAL
+
+#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/General_polygon_set_2.h b/3rdparty/CGAL/include/CGAL/General_polygon_set_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/General_polygon_set_2.h
rename to 3rdparty/CGAL/include/CGAL/General_polygon_set_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/General_polygon_set_on_surface_2.h b/3rdparty/CGAL/include/CGAL/General_polygon_set_on_surface_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/General_polygon_set_on_surface_2.h
rename to 3rdparty/CGAL/include/CGAL/General_polygon_set_on_surface_2.h
diff --git a/3rdparty/CGAL/include/CGAL/General_polygon_with_holes_2.h b/3rdparty/CGAL/include/CGAL/General_polygon_with_holes_2.h
new file mode 100644
index 0000000..82d9cf4
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/General_polygon_with_holes_2.h
@@ -0,0 +1,200 @@
+// Copyright (c) 2005  Tel-Aviv University (Israel).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Baruch Zukerman <baruchzu at post.tau.ac.il>
+
+#ifndef CGAL_GENERAL_POLYGON_WITH_HOLES_2_H
+#define CGAL_GENERAL_POLYGON_WITH_HOLES_2_H
+
+#include <list>
+#include <iostream>
+#include <CGAL/IO/io.h>
+
+namespace CGAL {
+
+template <class Polygon_>
+class General_polygon_with_holes_2
+{
+
+public:
+  typedef General_polygon_with_holes_2<Polygon_> 		Self;
+  typedef Polygon_                                    Polygon_2;
+  typedef typename Self::Polygon_2							General_polygon_2;  
+  typedef std::list<Polygon_>                         Holes_container;
+
+  typedef typename Holes_container::iterator          Hole_iterator;
+  typedef typename Holes_container::const_iterator    Hole_const_iterator;
+
+  typedef unsigned int                                 Size;
+
+  General_polygon_with_holes_2() : m_pgn()
+  {}
+
+
+  explicit General_polygon_with_holes_2(const General_polygon_2& pgn_boundary) 
+  : m_pgn(pgn_boundary)
+  {}
+
+
+  template <class HolesInputIterator>
+  General_polygon_with_holes_2(const General_polygon_2& pgn_boundary,
+                       HolesInputIterator h_begin,
+                       HolesInputIterator h_end) : m_pgn(pgn_boundary),
+                                                   m_holes(h_begin, h_end)
+  {}
+
+  Hole_iterator holes_begin()
+  {
+    return m_holes.begin();
+  }
+
+  Hole_iterator holes_end()
+  {
+    return m_holes.end();
+  }
+
+  Hole_const_iterator holes_begin() const
+  {
+    return m_holes.begin();
+  }
+
+  Hole_const_iterator holes_end() const
+  {
+    return m_holes.end();
+  }
+
+  bool is_unbounded() const
+  {
+    return m_pgn.is_empty();
+  }
+
+  General_polygon_2& outer_boundary()
+  {
+    return m_pgn;
+  }
+
+  const General_polygon_2& outer_boundary() const
+  {
+    return m_pgn;
+  }
+
+  void add_hole(const General_polygon_2& pgn_hole)
+  {
+    m_holes.push_back(pgn_hole);
+  }
+
+  void erase_hole(Hole_iterator hit)
+  {
+    m_holes.erase(hit);
+  }
+
+  bool has_holes() const
+  {
+    return (!m_holes.empty());
+  }
+
+  Size number_of_holes() const
+  {
+    return static_cast<Size>(m_holes.size());
+  }
+
+  void clear()
+  {
+    m_pgn.clear();
+    m_holes.clear();
+  }
+
+  bool is_plane() const
+  {
+    return (m_pgn.is_empty() && m_holes.empty());
+  }
+
+
+
+protected:
+
+  General_polygon_2           m_pgn;
+  Holes_container            m_holes;
+};
+
+
+//-----------------------------------------------------------------------//
+//                          operator<<
+//-----------------------------------------------------------------------//
+
+template <class Polygon_>
+std::ostream
+&operator<<(std::ostream &os, const General_polygon_with_holes_2<Polygon_>& p)
+{
+  typename General_polygon_with_holes_2<Polygon_>::Hole_const_iterator hit;
+
+  switch(get_mode(os)) {
+    case IO::ASCII :
+      os << p.outer_boundary() << ' ' << p.number_of_holes()<< ' ';
+      for (hit = p.holes_begin(); hit != p.holes_end(); ++hit) {
+        os << *hit << ' ';
+      }
+      return os;
+
+    case IO::BINARY :
+      os << p.outer_boundary()  << p.number_of_holes();
+      for (hit = p.holes_begin(); hit != p.holes_end(); ++hit) {
+        os << *hit;
+      }
+      return os;
+     
+
+    default:
+      os << "General_polygon_with_holes_2( " << std::endl;
+      os << p.outer_boundary() << " " << p.number_of_holes()<< " ";
+      for (hit = p.holes_begin(); hit != p.holes_end(); ++hit) {
+        os << *hit << " )";
+      }
+      return os;
+  }
+}
+
+//-----------------------------------------------------------------------//
+//                          operator>>
+//-----------------------------------------------------------------------//
+
+template <class Polygon_>
+std::istream &operator>>(std::istream &is, General_polygon_with_holes_2<Polygon_>& p)
+{
+  p.clear();
+  is >> p.outer_boundary();
+
+  unsigned int n_holes;
+  is >> n_holes;
+  if (is) 
+  {
+    Polygon_ pgn_hole;
+    for (unsigned int i=0; i<n_holes; i++) 
+    {
+      is >> pgn_hole;
+      p.add_hole(pgn_hole);
+    }
+  }
+ 
+  return is;
+}
+
+
+} //namespace CGAL
+
+#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Get_arithmetic_kernel.h b/3rdparty/CGAL/include/CGAL/Get_arithmetic_kernel.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Get_arithmetic_kernel.h
rename to 3rdparty/CGAL/include/CGAL/Get_arithmetic_kernel.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Gmp_coercion_traits.h b/3rdparty/CGAL/include/CGAL/Gmp_coercion_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Gmp_coercion_traits.h
rename to 3rdparty/CGAL/include/CGAL/Gmp_coercion_traits.h
diff --git a/3rdparty/CGAL/include/CGAL/Gmpfi.h b/3rdparty/CGAL/include/CGAL/Gmpfi.h
new file mode 100644
index 0000000..479f160
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Gmpfi.h
@@ -0,0 +1,369 @@
+// Copyright (c) 2007-2009 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 at gmx.com>
+//         Michael Hemmer <Michael.Hemmer at sophia.inria.fr>
+
+#ifndef CGAL_GMPFI_H
+#define CGAL_GMPFI_H
+
+#include <CGAL/config.h>
+#ifdef CGAL_USE_MPFI
+
+#include <CGAL/GMP/Gmpfi_type.h>
+#include <CGAL/number_type_basic.h>
+#include <CGAL/mpfi_coercion_traits.h>
+#include <CGAL/Interval_traits.h>
+#include <CGAL/Bigfloat_interval_traits.h>
+
+namespace CGAL{
+
+template <>
+class Algebraic_structure_traits<Gmpfi>:
+public Algebraic_structure_traits_base<Gmpfi,Field_with_kth_root_tag>{
+public:
+
+        typedef Tag_false       Is_exact;
+        typedef Tag_true        Is_numerical_sensitive;
+        typedef Uncertain<bool> Boolean;
+
+        struct Is_zero:
+        public std::unary_function<Type,Boolean>{
+                Boolean operator()(const Type &x)const{
+                        return x.is_zero();
+                }
+        };
+
+        struct Is_one:
+        public std::unary_function<Type,Boolean>{
+                Boolean operator()(const Type &x)const{
+                        return x.is_one();
+                }
+        };
+
+        struct Square:
+        public std::unary_function<Type,Type>{
+                Type operator()(const Type &x)const{
+                        return x.square();
+                };
+        };
+
+        struct Is_square:
+        public std::binary_function<Type,Type&,Boolean>{
+                Boolean operator()(const Type &x)const{
+                        return x.is_square();
+                };
+                Boolean operator()(const Type &x,Type &y)const{
+                        return x.is_square(y);
+                };
+        };
+
+        struct Sqrt:
+        public std::unary_function<Type,Type>{
+                Type operator()(const Type &x)const{
+                        return x.sqrt();
+                };
+        };
+
+        struct Kth_Root:
+        public std::binary_function<int,Type,Type>{
+                Type operator()(int k,const Type &x)const{
+                        return (k==3?x.cbrt():x.kthroot(k));
+                };
+        };
+
+        struct Divides:
+        public std::binary_function<Type,Type,Boolean>{
+                Boolean operator()(const Type &d,const Type &n)const{
+                        // Avoid compiler warning
+		        (void)n;
+                        return !(d.is_zero());
+                };
+                Boolean operator()(const Type &d,const Type &n,Type &c)const{
+                        return d.divides(n,c);
+                };
+        };
+};
+
+template <>
+class Real_embeddable_traits<Gmpfi>:
+public INTERN_RET::Real_embeddable_traits_base<Gmpfi,CGAL::Tag_true>{
+
+        typedef Algebraic_structure_traits<Type>        AST;
+
+        public:
+
+        typedef Tag_true                                Is_real_embeddable;
+        typedef Uncertain<bool>                         Boolean;
+        typedef Uncertain<CGAL::Comparison_result>      Comparison_result;
+        typedef Uncertain<CGAL::Sign>                   Sign;
+ 
+        typedef AST::Is_zero    Is_zero;
+
+        struct Is_finite:
+        public std::unary_function<Type,Boolean>{
+                inline Boolean operator()(const Type &x)const{
+                        return(x.is_number());
+                };
+        };
+
+        struct Abs:
+        public std::unary_function<Type,Type>{
+                inline Type operator()(const Type &x)const{
+                        return x.abs();
+                };
+        };
+
+        struct Sgn:
+        public std::unary_function<Type,Sign>{
+                inline Sign operator()(const Type &x)const{
+                        return x.sign();
+                };
+        };
+
+        struct Is_positive:
+        public std::unary_function<Type,Boolean>{
+                inline Boolean operator()(const Type &x)const{
+                        return x.is_positive();
+                };
+        };
+
+        struct Is_negative:
+        public std::unary_function<Type,Boolean>{
+                inline Boolean operator()(const Type &x)const{
+                        return x.is_negative();
+                };
+        };
+
+        struct Compare:
+        public std::binary_function<Type,Type,Comparison_result>{
+                inline Comparison_result operator()
+                        (const Type &x,const Type &y)const{
+                                return x.compare(y);
+                        };
+          CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT(Type,Comparison_result)
+        };
+
+        struct To_double:
+        public std::unary_function<Type,double>{
+                inline double operator()(const Type &x)const{
+                        return x.to_double();
+                };
+        };
+
+        struct To_interval:
+        public std::unary_function<Type,std::pair<double,double> >{
+                inline std::pair<double,double> operator()(const Type &x)const{
+                                return x.to_interval();
+                        };
+                };
+};
+
+
+
+template<>
+class Interval_traits<Gmpfi>
+  : public internal::Interval_traits_base<Gmpfi>{
+public: 
+  typedef Interval_traits<Gmpfi> Self; 
+  typedef Gmpfi Interval; 
+  typedef CGAL::Gmpfr Bound; 
+  typedef CGAL::Tag_false With_empty_interval; 
+  typedef CGAL::Tag_true  Is_interval; 
+
+  struct Construct :public std::binary_function<Bound,Bound,Interval>{
+    Interval operator()( const Bound& l,const Bound& r) const {
+      CGAL_precondition( l < r ); 
+      return Interval(std::make_pair(l,r));
+    }
+  };
+
+  struct Lower :public std::unary_function<Interval,Bound>{
+    Bound operator()( const Interval& a ) const {
+      return a.inf();
+    }
+  };
+
+  struct Upper :public std::unary_function<Interval,Bound>{
+    Bound operator()( const Interval& a ) const {
+      return a.sup();
+    }
+  };
+
+  struct Width :public std::unary_function<Interval,Bound>{
+    Bound operator()( const Interval& a ) const {
+      return Gmpfr::sub(a.sup(),a.inf(),std::round_toward_infinity);
+    }
+  };
+
+  struct Median :public std::unary_function<Interval,Bound>{
+    Bound operator()( const Interval& a ) const {
+      return (a.inf()+a.sup())/2;
+    }
+  };
+    
+  struct Norm :public std::unary_function<Interval,Bound>{
+    Bound operator()( const Interval& a ) const {
+      return a.abs().sup();
+    }
+  };
+
+  struct Singleton :public std::unary_function<Interval,bool>{
+    bool operator()( const Interval& a ) const {
+      return a.inf() == a.sup();
+    }
+  };
+
+  struct Zero_in :public std::unary_function<Interval,bool>{
+    bool operator()( const Interval& a ) const {
+      return a.inf() <= 0  &&  0 <= a.sup();
+    }
+  };
+
+  struct In :public std::binary_function<Bound,Interval,bool>{
+    bool operator()( Bound x, const Interval& a ) const {
+      return a.inf() <= x && x <= a.sup();
+    }
+  };
+
+  struct Equal :public std::binary_function<Interval,Interval,bool>{
+    bool operator()( const Interval& a, const Interval& b ) const {
+      return a.is_same(b);
+    }
+  };
+    
+  struct Overlap :public std::binary_function<Interval,Interval,bool>{
+    bool operator()( const Interval& a, const Interval& b ) const {
+      return a.do_overlap(b);
+    }
+  };
+    
+  struct Subset :public std::binary_function<Interval,Interval,bool>{
+    bool operator()( const Interval& a, const Interval& b ) const {
+      return b.inf() <= a.inf() && a.sup() <= b.sup() ;  
+    }
+  };
+    
+  struct Proper_subset :public std::binary_function<Interval,Interval,bool>{
+    bool operator()( const Interval& a, const Interval& b ) const {
+      return Subset()(a,b) && ! Equal()(a,b); 
+    }
+  };
+    
+  struct Hull :public std::binary_function<Interval,Interval,Interval>{
+    Interval operator()( const Interval& a, const Interval& b ) const {
+      BOOST_USING_STD_MAX();
+      BOOST_USING_STD_MIN();
+      return Interval( 
+          std::make_pair(
+              min BOOST_PREVENT_MACRO_SUBSTITUTION (a.inf(),b.inf()), 
+              max BOOST_PREVENT_MACRO_SUBSTITUTION (a.sup(),b.sup())));
+    }
+  };
+    
+  
+//  struct Empty is Null_functor 
+  
+  struct Intersection :public std::binary_function<Interval,Interval,Interval>{
+    Interval operator()( const Interval& a, const Interval& b ) const {
+      BOOST_USING_STD_MAX();
+      BOOST_USING_STD_MIN();
+      Bound l(max BOOST_PREVENT_MACRO_SUBSTITUTION (Lower()(a),Lower()(b)));
+      Bound u(min BOOST_PREVENT_MACRO_SUBSTITUTION (Upper()(a),Upper()(b)));
+      if(u < l ) throw Exception_intersection_is_empty();
+      return Construct()(l,u);
+    }
+  };
+};
+
+template<>
+class Bigfloat_interval_traits<Gmpfi>
+  :public Interval_traits<Gmpfi>
+{
+  typedef Gmpfi NT;
+  typedef CGAL::Gmpfr BF;
+public:
+  typedef Bigfloat_interval_traits<Gmpfi> Self; 
+  typedef CGAL::Tag_true                  Is_bigfloat_interval; 
+  
+  struct Relative_precision: public std::unary_function<NT,long>{
+
+    long operator()(const NT& x) const {
+      CGAL_precondition(!Singleton()(x));
+      CGAL_precondition(!CGAL::zero_in(x));
+      
+      // w = |x| * 2^-p (return p)
+      BF w(CGAL::width(x));
+      mpfr_div(w.fr(), w.fr(), CGAL::lower(CGAL::abs(x)).fr(), GMP_RNDU);
+      mpfr_log2(w.fr(), w.fr(), GMP_RNDU);
+      return -mpfr_get_si(w.fr(), GMP_RNDU);
+    }
+  };
+   
+  struct Set_precision {
+    // type for the \c AdaptableUnaryFunction concept.
+    typedef long  argument_type;
+    // type for the \c AdaptableUnaryFunction concept.
+    typedef long  result_type;  
+     
+    long operator()( long prec ) const {
+      return Gmpfi::set_default_precision(prec); 
+    }
+  };
+  
+  struct Get_precision {
+    // type for the \c AdaptableGenerator concept.
+    typedef long  result_type;  
+    long operator()() const {
+      return Gmpfi::get_default_precision(); 
+    }
+  };
+};
+
+} // namespace CGAL
+
+namespace Eigen {
+  template<class> struct NumTraits;
+  template<> struct NumTraits<CGAL::Gmpfi>
+  {
+    typedef CGAL::Gmpfi Real;
+    typedef CGAL::Gmpfi NonInteger;
+    typedef CGAL::Gmpfi Nested;
+    typedef CGAL::Gmpfi Literal;
+
+    static inline Real epsilon() { return 0; }
+    static inline Real dummy_precision() { return 0; }
+
+    enum {
+      IsInteger = 0,
+      IsSigned = 1,
+      IsComplex = 0,
+      RequireInitialization = 1,
+      ReadCost = 12,
+      AddCost = 100,
+      MulCost = 100
+    };
+  };
+}
+
+#include <CGAL/GMP/Gmpfi_type.h>
+#include <CGAL/GMP_arithmetic_kernel.h>
+
+#endif
+
+#endif  // CGAL_GMPFI_H
+
+// vim: tabstop=8: softtabstop=8: smarttab: shiftwidth=8: expandtab
diff --git a/3rdparty/CGAL/include/CGAL/Gmpfr.h b/3rdparty/CGAL/include/CGAL/Gmpfr.h
new file mode 100644
index 0000000..94bb613
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Gmpfr.h
@@ -0,0 +1,187 @@
+// Copyright (c) 2007-2009 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 at gmx.com>
+
+#ifndef CGAL_GMPFR_H
+#define CGAL_GMPFR_H
+
+#include <CGAL/number_type_basic.h>
+#include <CGAL/mpfr_coercion_traits.h>
+
+namespace CGAL{
+
+template <>
+class Algebraic_structure_traits<Gmpfr>:
+public Algebraic_structure_traits_base<Gmpfr,Field_with_kth_root_tag>{
+public:
+
+        typedef Tag_false       Is_exact;
+        typedef Tag_true        Is_numerical_sensitive;
+        typedef bool            Boolean;
+
+        struct Is_zero:
+        public std::unary_function<Type,Boolean>{
+                Boolean operator()(const Type &x)const{
+                        return x.is_zero();
+                }
+        };
+
+        struct Is_one:
+        public std::unary_function<Type,Boolean>{
+                Boolean operator()(const Type &x)const{
+                        return x.is_one();
+                }
+        };
+
+        struct Square:
+        public std::unary_function<Type,Type>{
+                Type operator()(const Type &x)const{
+                        return x.square();
+                };
+        };
+
+        struct Is_square:
+        public std::binary_function<Type,Type&,Boolean>{
+                Boolean operator()(const Type &x,Type &y)const{
+                        return x.is_square(y);
+                };
+                Boolean operator()(const Type &x)const{
+                        return x.is_square();
+                };
+        };
+
+        struct Sqrt:
+        public std::unary_function<Type,Type>{
+                Type operator()(const Type &x)const{
+                        return x.sqrt();
+                };
+        };
+
+        struct Kth_Root:
+        public std::binary_function<int,Type,Type>{
+                Type operator()(int k,const Type &x)const{
+                        return (k==3?x.cbrt():x.kthroot(k));
+                };
+        };
+};
+
+template <>
+class Real_embeddable_traits<Gmpfr>:
+public INTERN_RET::Real_embeddable_traits_base<Gmpfr,CGAL::Tag_true>{
+  
+        typedef Algebraic_structure_traits<Type>        AST;
+
+        public:
+
+        typedef Tag_true                Is_real_embeddable;
+        typedef bool                    Boolean;
+        typedef CGAL::Comparison_result Comparison_result;
+        typedef CGAL::Sign              Sign;
+
+        typedef AST::Is_zero    Is_zero;
+
+        struct Is_finite:
+        public std::unary_function<Type,Boolean>{
+                inline Boolean operator()(const Type &x)const{
+                        return(x.is_number());
+                };
+        };
+
+        struct Abs:
+        public std::unary_function<Type,Type>{
+                inline Type operator()(const Type &x)const{
+                        return x.abs();
+                };
+        };
+
+        struct Sgn:
+        public std::unary_function<Type,Sign>{
+                inline Sign operator()(const Type &x)const{
+                        return x.sign();
+                };
+        };
+
+        struct Is_positive:
+        public std::unary_function<Type,Boolean>{
+                inline Boolean operator()(const Type &x)const{
+                        return(x.sign()==POSITIVE);
+                };
+        };
+
+        struct Is_negative:
+        public std::unary_function<Type,Boolean>{
+                inline Boolean operator()(const Type &x)const{
+                        return(x.sign()==NEGATIVE);
+                };
+        };
+
+        struct Compare:
+        public std::binary_function<Type,Type,Comparison_result>{
+                inline Comparison_result operator()
+                        (const Type &x,const Type &y)const{
+                                return x.compare(y);
+                        }; 
+          CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT(Type,Comparison_result)
+        };
+
+        struct To_double:
+        public std::unary_function<Type,double>{
+                inline double operator()(const Type &x)const{
+                        return x.to_double();
+                };
+        };
+
+        struct To_interval:
+        public std::unary_function<Type,std::pair<double,double> >{
+                inline std::pair<double,double>operator()(const Type &x)const{
+                                return x.to_interval();
+                };
+        };
+};
+
+}
+
+namespace Eigen {
+  template<class> struct NumTraits;
+  template<> struct NumTraits<CGAL::Gmpfr>
+  {
+    typedef CGAL::Gmpfr Real;
+    typedef CGAL::Gmpfr NonInteger;
+    typedef CGAL::Gmpfr Nested;
+    typedef CGAL::Gmpfr Literal;
+
+    static inline Real epsilon() { return 0; }
+    static inline Real dummy_precision() { return 0; }
+
+    enum {
+      IsInteger = 0,
+      IsSigned = 1,
+      IsComplex = 0,
+      RequireInitialization = 1,
+      ReadCost = 6,
+      AddCost = 50,
+      MulCost = 50
+    };
+  };
+}
+
+#include <CGAL/GMP/Gmpfr_type.h>
+#include <CGAL/GMP_arithmetic_kernel.h>
+
+#endif  // CGAL_GMPFR_H
+
+// vim: tabstop=8: softtabstop=8: smarttab: shiftwidth=8: expandtab
diff --git a/3rdparty/CGAL/include/CGAL/Gmpq.h b/3rdparty/CGAL/include/CGAL/Gmpq.h
new file mode 100644
index 0000000..2fde983
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Gmpq.h
@@ -0,0 +1,167 @@
+// Copyright (c) 2006-2008 Max-Planck-Institute Saarbruecken (Germany).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Michael Hemmer   <hemmer at mpi-inf.mpg.de>
+
+#ifndef CGAL_GMPQ_H
+#define CGAL_GMPQ_H
+
+#include <CGAL/number_type_basic.h>
+#include <CGAL/Gmpz.h>
+#include <CGAL/Gmp_coercion_traits.h>
+
+namespace CGAL {
+
+// AST for Gmpq-class
+template <> class Algebraic_structure_traits< Gmpq >
+  : public Algebraic_structure_traits_base< Gmpq, Field_tag >  {
+  public:
+    typedef Tag_true            Is_exact;
+    typedef Tag_false            Is_numerical_sensitive;
+
+    class Is_square
+      : public std::binary_function< Type, Type&,
+                                bool > {
+      public:
+        bool operator()( const Type& x_, Type& y ) const {
+          Gmpq x( x_ );
+          mpq_canonicalize( x.mpq() );
+          Algebraic_structure_traits< Gmpz >::Sqrt sqrt;
+          y = Gmpq( sqrt( x.numerator() ), sqrt( x.denominator() ) );
+          return y*y == x;
+        }
+        bool operator()( const Type& x) const {
+            Type y;
+            return operator()(x,y);
+        }
+
+    };
+
+    class Simplify
+      : public std::unary_function< Type&, void > {
+      public:
+        void operator()( Type& x) const {
+          mpq_canonicalize( x.mpq() );
+        }
+    };
+
+};
+
+// RET for Gmpq-class
+
+template <> class Real_embeddable_traits< Gmpq >
+  : public INTERN_RET::Real_embeddable_traits_base< Gmpq , CGAL::Tag_true > {
+  public:
+  
+    class Sgn
+      : public std::unary_function< Type, ::CGAL::Sign > {
+      public:
+        ::CGAL::Sign operator()( const Type& x ) const {
+          return x.sign();
+        }
+    };
+
+    class To_double
+      : public std::unary_function< Type, double > {
+      public:
+        double operator()( const Type& x ) const {
+          return x.to_double();
+        }
+    };
+
+    class To_interval
+      : public std::unary_function< Type, std::pair< double, double > > {
+      public:
+        std::pair<double, double> operator()( const Type& x ) const {
+          mpfr_t y;
+          mpfr_init2 (y, 53); /* Assume IEEE-754 */
+          mpfr_set_q (y, x.mpq(), GMP_RNDD);
+          double i = mpfr_get_d (y, GMP_RNDD); /* EXACT but can overflow */
+          mpfr_set_q (y, x.mpq(), GMP_RNDU);
+          double s = mpfr_get_d (y, GMP_RNDU); /* EXACT but can overflow */
+          mpfr_clear (y);
+          return std::pair<double, double>(i, s);
+        }
+    };
+};
+
+/*! \ingroup NiX_Fraction_traits_spec
+ *  \brief Specialization of Fraction_traits for Gmpq
+ */
+template <>
+class Fraction_traits< Gmpq > {
+public:
+    typedef Gmpq Type;
+    typedef ::CGAL::Tag_true Is_fraction;
+    typedef Gmpz Numerator_type;
+    typedef Gmpz Denominator_type;
+    typedef Algebraic_structure_traits< Gmpz >::Gcd Common_factor;
+    class Decompose {
+    public:
+        typedef Gmpq first_argument_type;
+        typedef Gmpz& second_argument_type;
+        typedef Gmpz& third_argument_type;
+        void operator () (const Gmpq& rat, Gmpz& num,Gmpz& den) {
+            num = rat.numerator();
+            den = rat.denominator();
+        }
+    };
+    class Compose {
+    public:
+        typedef Gmpz first_argument_type;
+        typedef Gmpz second_argument_type;
+        typedef Gmpq result_type;
+        Gmpq operator () (const Gmpz& num,const Gmpz& den) {
+            return Gmpq(num, den);
+        }
+    };
+};
+
+} //namespace CGAL
+
+namespace Eigen {
+  template<class> struct NumTraits;
+  template<> struct NumTraits<CGAL::Gmpq>
+  {
+    typedef CGAL::Gmpq Real;
+    typedef CGAL::Gmpq NonInteger;
+    typedef CGAL::Gmpq Nested;
+    typedef CGAL::Gmpq Literal;
+
+    static inline Real epsilon() { return 0; }
+    static inline Real dummy_precision() { return 0; }
+
+    enum {
+      IsInteger = 0,
+      IsSigned = 1,
+      IsComplex = 0,
+      RequireInitialization = 1,
+      ReadCost = 6,
+      AddCost = 150,
+      MulCost = 100
+    };
+  };
+}
+
+//since types are included by Gmp_coercion_traits.h:
+#include <CGAL/Gmpz.h>
+#include <CGAL/Gmpq.h>
+#include <CGAL/Gmpzf.h>
+#include <CGAL/GMP_arithmetic_kernel.h>
+
+#endif // CGAL_GMPQ_H
diff --git a/3rdparty/CGAL/include/CGAL/Gmpz.h b/3rdparty/CGAL/include/CGAL/Gmpz.h
new file mode 100644
index 0000000..5a1b15d
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Gmpz.h
@@ -0,0 +1,242 @@
+// Copyright (c) 2006-2008 Max-Planck-Institute Saarbruecken (Germany),
+// INRIA Sophia-Antipolis (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(s)     : Michael Hemmer   <hemmer at mpi-inf.mpg.de>
+//                 Sylvain Pion
+
+#ifndef CGAL_GMPZ_H
+#define CGAL_GMPZ_H
+
+#include <CGAL/config.h>
+#if defined(BOOST_MSVC)
+#  pragma warning(push)
+#  pragma warning(disable:4800) // complaint about performance in std::map where we can't do anything
+#endif
+
+#include <CGAL/number_type_basic.h>
+#include <CGAL/Gmp_coercion_traits.h>
+#include <CGAL/Quotient.h> // spec of AST for Quotient<Gmpz>
+
+#include <string>
+#include <locale>
+
+#include <CGAL/Modular_traits.h>
+
+namespace CGAL {
+
+// Algebraic structure traits
+template <> class Algebraic_structure_traits< Gmpz >
+    : public Algebraic_structure_traits_base< Gmpz,
+                                            Euclidean_ring_tag >  {
+public:
+    typedef Tag_true            Is_exact;
+    typedef Tag_false           Is_numerical_sensitive;
+
+    typedef INTERN_AST::Is_square_per_sqrt< Type >
+    Is_square;
+    class Integral_division
+        : public std::binary_function< Type, Type,
+                                Type > {
+    public:
+        Type operator()( const Type& x,
+                const Type& y ) const {
+            Gmpz result;
+            mpz_divexact(result.mpz(), x.mpz(), y.mpz());
+            CGAL_postcondition_msg(result * y == x, "exact_division failed\n");
+            return result;
+        }
+    };
+
+    class Gcd
+        : public std::binary_function< Type, Type,
+                                Type > {
+    public:
+        Type operator()( const Type& x,
+                const Type& y ) const {
+            Gmpz result;
+            mpz_gcd(result.mpz(), x.mpz(), y.mpz());
+            return result;
+
+        }
+
+        Type operator()( const Type& x,
+                                        const int& y ) const {
+          if (y > 0)
+          {
+              Gmpz Res;
+              mpz_gcd_ui(Res.mpz(), x.mpz(), y);
+              return Res;
+          }
+          return CGAL_NTS gcd(x, Gmpz(y));
+        }
+
+        Type operator()( const int& x,
+                                        const Type& y ) const {
+          return CGAL_NTS gcd(Gmpz(x), y );
+        }
+    };
+
+    typedef INTERN_AST::Div_per_operator< Type > Div;
+    typedef INTERN_AST::Mod_per_operator< Type > Mod;
+
+    class Sqrt
+        : public std::unary_function< Type, Type > {
+    public:
+        Type operator()( const Type& x ) const {
+            Gmpz result;
+            mpz_sqrt(result.mpz(), x.mpz());
+            return result;
+        }
+    };
+};
+
+template <> class Real_embeddable_traits< Gmpz >
+    : public INTERN_RET::Real_embeddable_traits_base< Gmpz , CGAL::Tag_true > {
+public:
+    class Sgn
+        : public std::unary_function< Type, ::CGAL::Sign > {
+    public:
+        ::CGAL::Sign operator()( const Type& x ) const {
+            return x.sign();
+        }
+    };
+
+    class To_double
+        : public std::unary_function< Type, double > {
+    public:
+        double operator()( const Type& x ) const {
+            return x.to_double();
+        }
+    };
+
+    class To_interval
+        : public std::unary_function< Type, std::pair< double, double > > {
+    public:
+        std::pair<double, double> operator()( const Type& x ) const {
+
+            mpfr_t y;
+            mpfr_init2 (y, 53); /* Assume IEEE-754 */
+            mpfr_set_z (y, x.mpz(), GMP_RNDD);
+            double i = mpfr_get_d (y, GMP_RNDD); /* EXACT but can overflow */
+            mpfr_set_z (y, x.mpz(), GMP_RNDU);
+            double s = mpfr_get_d (y, GMP_RNDU); /* EXACT but can overflow */
+            mpfr_clear (y);
+            return std::pair<double, double>(i, s);
+        }
+    };
+};
+
+template<> class Algebraic_structure_traits< Quotient<Gmpz> >
+    : public INTERN_QUOTIENT::Algebraic_structure_traits_quotient_base<Quotient<Gmpz> >{
+    // specialization of to double functor
+public:
+    typedef Quotient<Gmpz> Type;
+
+    struct To_double: public std::unary_function<Quotient<Gmpz>, double>{
+        double operator()(const Quotient<Gmpz>& quot){
+            mpq_t  mpQ;
+            mpq_init(mpQ);
+            const Gmpz& n = quot.numerator();
+            const Gmpz& d = quot.denominator();
+            mpz_set(mpq_numref(mpQ), n.mpz());
+            mpz_set(mpq_denref(mpQ), d.mpz());
+
+            mpq_canonicalize(mpQ);
+
+            double ret = mpq_get_d(mpQ);
+            mpq_clear(mpQ);
+            return ret;
+        }
+    };
+};
+
+//
+// Needs_parens_as_product
+//
+template <>
+struct Needs_parens_as_product<Gmpz> {
+  bool operator()(const Gmpz& x) {
+    return CGAL_NTS is_negative(x);
+  }
+};
+
+
+/*! \ingroup NiX_Modular_traits_spec
+ *  \brief a model of concept ModularTraits, 
+ *  specialization of NiX::Modular_traits. 
+ */
+template<>
+class Modular_traits< Gmpz > {
+  typedef Residue RES;
+ public:
+    typedef Gmpz NT;
+    typedef CGAL::Tag_true Is_modularizable;
+    typedef Residue Residue_type;
+
+    struct Modular_image{
+        Residue_type operator()(const NT& a){
+          NT tmp_1(a % NT(RES::get_current_prime()));
+          return CGAL::Residue(int(mpz_get_si(tmp_1.mpz())));
+        }
+    };
+    struct Modular_image_representative{
+        NT operator()(const Residue_type& x){
+          return NT(x.get_value());
+        }
+    };    
+};
+
+} //namespace CGAL
+
+#if defined(BOOST_MSVC)
+#  pragma warning(pop)
+#endif
+
+namespace Eigen {
+  template<class> struct NumTraits;
+  template<> struct NumTraits<CGAL::Gmpz>
+  {     
+    typedef CGAL::Gmpz Real;
+    typedef CGAL::Gmpq NonInteger;
+    typedef CGAL::Gmpz Nested;
+    typedef CGAL::Gmpz Literal;
+
+    static inline Real epsilon() { return 0; }
+    static inline Real dummy_precision() { return 0; }
+
+    enum {
+      IsInteger = 1,
+      IsSigned = 1,
+      IsComplex = 0,
+      RequireInitialization = 1,
+      ReadCost = 6,
+      AddCost = 30,
+      MulCost = 50
+    };
+  };
+}
+
+
+//since types are included by Gmp_coercion_traits.h:
+#include <CGAL/Gmpz.h>
+#include <CGAL/Gmpq.h>
+#include <CGAL/Gmpzf.h>
+#include <CGAL/GMP_arithmetic_kernel.h>
+
+#endif // CGAL_GMPZ_H
diff --git a/3rdparty/CGAL/include/CGAL/Gmpzf.h b/3rdparty/CGAL/include/CGAL/Gmpzf.h
new file mode 100644
index 0000000..94b769d
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Gmpzf.h
@@ -0,0 +1,186 @@
+// Copyright (c) 2006-2008 Max-Planck-Institute Saarbruecken (Germany).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Michael Hemmer   <hemmer at mpi-inf.mpg.de>
+
+#ifndef CGAL_GMPZF_H
+#define CGAL_GMPZF_H
+
+// includes
+#include <CGAL/number_type_basic.h>
+#include <CGAL/Gmp_coercion_traits.h>
+#include <CGAL/Gmpz.h>
+#include <CGAL/Interval_nt.h>
+
+namespace CGAL {
+
+// Algebraic structure traits
+template <> class Algebraic_structure_traits< Gmpzf >
+    : public Algebraic_structure_traits_base< Gmpzf, Euclidean_ring_tag >  {
+public:
+    typedef Tag_true            Is_exact;
+
+    struct Is_zero
+        : public std::unary_function< Type, bool > {
+    public:
+        bool operator()( const Type& x ) const {
+            return x.is_zero();
+        }
+    };
+
+    struct Integral_division
+        : public std::binary_function< Type,
+                                Type,
+                                Type > {
+    public:
+        Type operator()(
+                const Type& x,
+                const Type& y ) const {
+            return x.integral_division(y);
+        }
+    };
+
+    struct Gcd
+        : public std::binary_function< Type,
+                                Type,
+                                Type > {
+    public:
+        Type operator()(
+                const Type& x,
+                const Type& y ) const {
+            return x.gcd(y);
+        }
+        CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR(int)
+    };
+
+    class Div
+        : public std::binary_function< Type, Type, Type > {
+    public:
+        Type operator()( const Type& x, const Type& y ) const {
+            return Type(x).div( y );
+	}
+    };
+
+    typedef INTERN_AST::Mod_per_operator< Type > Mod;
+  
+  class Is_square
+    : public std::binary_function< Type, Type&, bool > {
+  public:      
+    bool operator()( const Type& x, Type& y ) const {
+      y = CGAL::approximate_sqrt(x);
+      return y * y == x;
+    }
+    bool operator()( const Type& x) const {
+      Type dummy;
+      return operator()(x,dummy);
+    }
+  };
+};
+
+
+// Real embeddable traits
+template <>
+class Real_embeddable_traits< Gmpzf >
+    : public INTERN_RET::Real_embeddable_traits_base< Gmpzf , CGAL::Tag_true > {
+
+    typedef Algebraic_structure_traits<Gmpzf> AST;
+public:
+  typedef AST::Is_zero Is_zero;
+  
+    struct Sgn
+        : public std::unary_function< Type, ::CGAL::Sign > {
+    public:
+        ::CGAL::Sign operator()( const Type& x ) const {
+            return x.sign();
+        }
+    };
+
+    struct Compare
+        : public std::binary_function< Type,
+                                  Type,
+                                  Comparison_result > {
+    public:
+        Comparison_result operator()(
+                const Type& x,
+                const Type& y ) const {
+            return x.compare(y);
+        }
+    };
+
+    struct To_double
+        : public std::unary_function< Type, double > {
+    public:
+        double operator()( const Type& x ) const {
+            return x.to_double();
+        }
+    };
+
+    struct To_interval
+        : public std::unary_function< Type, std::pair< double, double > > {
+    public:
+        std::pair<double, double> operator()( const Type& x ) const {
+	    return x.to_interval();
+        }
+    };
+};
+
+// specialization of to double functor
+template<>
+class Real_embeddable_traits< Quotient<Gmpzf> >
+    : public
+INTERN_QUOTIENT::Real_embeddable_traits_quotient_base< Quotient<Gmpzf> >
+{
+public:
+    struct To_double: public std::unary_function<Quotient<Gmpzf>, double>{
+        inline
+        double operator()(const Quotient<Gmpzf>& q) const {
+	  std::pair<double, long> n = q.numerator().to_double_exp();
+	  std::pair<double, long> d = q.denominator().to_double_exp();
+	  double scale = std::ldexp(1.0,
+                                    static_cast<int>(n.second - d.second));
+	  return (n.first / d.first) * scale;
+	}
+    };
+    struct To_interval
+        : public std::unary_function<Quotient<Gmpzf>, std::pair<double,double> >{
+        inline
+        std::pair<double,double> operator()(const Quotient<Gmpzf>& q) const {
+	  // do here as MP_Float does
+	  std::pair<std::pair<double, double>, long> n =
+	    q.numerator().to_interval_exp();
+	  std::pair<std::pair<double, double>, long> d =
+	    q.denominator().to_interval_exp();
+
+	  CGAL_assertion_msg(CGAL::abs(double(n.second) - double(d.second)) < (1<<30)*2.0,
+                     "Exponent overflow in Quotient<MP_Float> to_interval");
+	  return ldexp(Interval_nt<>(n.first) / Interval_nt<>(d.first),
+                       static_cast<int>(n.second - d.second)).pair();
+        }
+    };
+};
+
+} //namespace CGAL
+
+//since types are included by Gmp_coercion_traits.h:
+#include <CGAL/Gmpz.h>
+#include <CGAL/Gmpq.h>
+#include <CGAL/Gmpzf.h>
+
+#endif // CGAL_GMPZF_H
+
+// ===== EOF ==================================================================
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Gps_circle_segment_traits_2.h b/3rdparty/CGAL/include/CGAL/Gps_circle_segment_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Gps_circle_segment_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Gps_circle_segment_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Gps_segment_traits_2.h b/3rdparty/CGAL/include/CGAL/Gps_segment_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Gps_segment_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Gps_segment_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Gps_traits_2.h b/3rdparty/CGAL/include/CGAL/Gps_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Gps_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Gps_traits_2.h
diff --git a/3rdparty/CGAL/include/CGAL/Gray_image_mesh_domain_3.h b/3rdparty/CGAL/include/CGAL/Gray_image_mesh_domain_3.h
new file mode 100644
index 0000000..42db4c9
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Gray_image_mesh_domain_3.h
@@ -0,0 +1,140 @@
+// Copyright (c) 2009 INRIA Sophia-Antipolis (France).
+// Copyright (c) 2012  GeometryFactory Sarl (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
+// 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(s)     : Stephane Tayeb, Laurent Rineau
+//
+
+#ifndef CGAL_GRAY_IMAGE_MESH_DOMAIN_3_H
+#define CGAL_GRAY_IMAGE_MESH_DOMAIN_3_H
+
+#include <CGAL/Random.h>
+#include <CGAL/Labeled_mesh_domain_3.h>
+#include <CGAL/Mesh_3/Image_to_labeled_function_wrapper.h>
+
+#include <functional>
+
+namespace CGAL {
+
+namespace internal {
+
+  template<typename T>
+  struct Greater_than {
+    typedef T argument_type;
+    Greater_than(const T& second) : second(second) {}
+    bool operator()(const T& first) const {
+      return std::greater<T>()(first, second);
+    }
+    T second;
+  };
+
+}
+
+/**
+ * @class Gray_image_mesh_domain_3
+ *
+ *
+ */
+template<class Image,
+         class BGT,
+         typename Image_word_type = float,
+         typename Transform = internal::Greater_than<double>,
+         typename Subdomain_index = int>
+class Gray_image_mesh_domain_3
+  : public Labeled_mesh_domain_3<
+  Mesh_3::Image_to_labeled_function_wrapper<Image, BGT,
+                                            Image_word_type,
+                                            Subdomain_index,
+                                            Transform,
+                                            false> ,
+  BGT>
+{
+public:
+  typedef Mesh_3::Image_to_labeled_function_wrapper<Image, BGT,
+                                                    Image_word_type,
+                                                    Subdomain_index,
+                                                    Transform,
+                                                    false>           Wrapper;
+
+  typedef Labeled_mesh_domain_3<Wrapper, BGT>                        Base;
+
+  typedef typename Base::Sphere_3 Sphere_3;
+  typedef typename Base::FT FT;
+  typedef BGT Geom_traits;
+  typedef CGAL::Bbox_3 Bbox_3;
+
+  /// Constructor
+  Gray_image_mesh_domain_3(const Image& image,
+                           const Image_word_type iso_value,
+                           const Image_word_type value_outside = 0.,
+                           const FT& error_bound = FT(1e-3),
+                           CGAL::Random* p_rng = NULL)
+    : Base(Wrapper(image, 
+                   Transform(iso_value),
+                   Transform(iso_value)(value_outside)),
+           compute_bounding_box(image),
+           error_bound,
+           Null_subdomain_index(),
+           p_rng)
+  {
+    CGAL_assertion(Transform(iso_value)(value_outside) == 0);
+  }
+
+  Gray_image_mesh_domain_3(const Image& image,
+                           const Transform& transform,
+                           const Image_word_type value_outside = 0.,
+                           const FT& error_bound = FT(1e-3),
+                           CGAL::Random* p_rng = NULL)
+    : Base(Wrapper(image, transform, transform(value_outside)),
+           compute_bounding_box(image),
+           error_bound,
+           Null_subdomain_index(),
+           p_rng)
+  {
+    CGAL_assertion(transform(value_outside) == 0);
+  }
+
+  /// Destructor
+  virtual ~Gray_image_mesh_domain_3() {}
+
+
+private:
+  /// Returns a box enclosing image \c im
+  Bbox_3 compute_bounding_box(const Image& im) const
+  {
+    return Bbox_3(-1,-1,-1,
+                  double(im.xdim())*im.vx()+1,
+                  double(im.ydim())*im.vy()+1,
+                  double(im.zdim())*im.vz()+1);
+  }
+
+private:
+  // Disabled copy constructor & assignment operator
+  typedef Gray_image_mesh_domain_3<Image, BGT> Self;
+  Gray_image_mesh_domain_3(const Self& src);
+  Self& operator=(const Self& src);
+
+};  // end class Gray_image_mesh_domain_3
+
+
+
+}  // end namespace CGAL
+
+
+
+#endif // CGAL_GRAY_IMAGE_MESH_DOMAIN_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Gray_level_image_3.h b/3rdparty/CGAL/include/CGAL/Gray_level_image_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Gray_level_image_3.h
rename to 3rdparty/CGAL/include/CGAL/Gray_level_image_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/HalfedgeDS_const_decorator.h b/3rdparty/CGAL/include/CGAL/HalfedgeDS_const_decorator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/HalfedgeDS_const_decorator.h
rename to 3rdparty/CGAL/include/CGAL/HalfedgeDS_const_decorator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/HalfedgeDS_decorator.h b/3rdparty/CGAL/include/CGAL/HalfedgeDS_decorator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/HalfedgeDS_decorator.h
rename to 3rdparty/CGAL/include/CGAL/HalfedgeDS_decorator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/HalfedgeDS_default.h b/3rdparty/CGAL/include/CGAL/HalfedgeDS_default.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/HalfedgeDS_default.h
rename to 3rdparty/CGAL/include/CGAL/HalfedgeDS_default.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/HalfedgeDS_face_base.h b/3rdparty/CGAL/include/CGAL/HalfedgeDS_face_base.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/HalfedgeDS_face_base.h
rename to 3rdparty/CGAL/include/CGAL/HalfedgeDS_face_base.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/HalfedgeDS_face_max_base_with_id.h b/3rdparty/CGAL/include/CGAL/HalfedgeDS_face_max_base_with_id.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/HalfedgeDS_face_max_base_with_id.h
rename to 3rdparty/CGAL/include/CGAL/HalfedgeDS_face_max_base_with_id.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/HalfedgeDS_face_min_base.h b/3rdparty/CGAL/include/CGAL/HalfedgeDS_face_min_base.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/HalfedgeDS_face_min_base.h
rename to 3rdparty/CGAL/include/CGAL/HalfedgeDS_face_min_base.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/HalfedgeDS_halfedge_base.h b/3rdparty/CGAL/include/CGAL/HalfedgeDS_halfedge_base.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/HalfedgeDS_halfedge_base.h
rename to 3rdparty/CGAL/include/CGAL/HalfedgeDS_halfedge_base.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/HalfedgeDS_halfedge_max_base_with_id.h b/3rdparty/CGAL/include/CGAL/HalfedgeDS_halfedge_max_base_with_id.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/HalfedgeDS_halfedge_max_base_with_id.h
rename to 3rdparty/CGAL/include/CGAL/HalfedgeDS_halfedge_max_base_with_id.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/HalfedgeDS_halfedge_min_base.h b/3rdparty/CGAL/include/CGAL/HalfedgeDS_halfedge_min_base.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/HalfedgeDS_halfedge_min_base.h
rename to 3rdparty/CGAL/include/CGAL/HalfedgeDS_halfedge_min_base.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/HalfedgeDS_items_2.h b/3rdparty/CGAL/include/CGAL/HalfedgeDS_items_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/HalfedgeDS_items_2.h
rename to 3rdparty/CGAL/include/CGAL/HalfedgeDS_items_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/HalfedgeDS_items_decorator.h b/3rdparty/CGAL/include/CGAL/HalfedgeDS_items_decorator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/HalfedgeDS_items_decorator.h
rename to 3rdparty/CGAL/include/CGAL/HalfedgeDS_items_decorator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/HalfedgeDS_iterator.h b/3rdparty/CGAL/include/CGAL/HalfedgeDS_iterator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/HalfedgeDS_iterator.h
rename to 3rdparty/CGAL/include/CGAL/HalfedgeDS_iterator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/HalfedgeDS_iterator_adaptor.h b/3rdparty/CGAL/include/CGAL/HalfedgeDS_iterator_adaptor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/HalfedgeDS_iterator_adaptor.h
rename to 3rdparty/CGAL/include/CGAL/HalfedgeDS_iterator_adaptor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/HalfedgeDS_list.h b/3rdparty/CGAL/include/CGAL/HalfedgeDS_list.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/HalfedgeDS_list.h
rename to 3rdparty/CGAL/include/CGAL/HalfedgeDS_list.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/HalfedgeDS_min_items.h b/3rdparty/CGAL/include/CGAL/HalfedgeDS_min_items.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/HalfedgeDS_min_items.h
rename to 3rdparty/CGAL/include/CGAL/HalfedgeDS_min_items.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/HalfedgeDS_vector.h b/3rdparty/CGAL/include/CGAL/HalfedgeDS_vector.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/HalfedgeDS_vector.h
rename to 3rdparty/CGAL/include/CGAL/HalfedgeDS_vector.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/HalfedgeDS_vertex_base.h b/3rdparty/CGAL/include/CGAL/HalfedgeDS_vertex_base.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/HalfedgeDS_vertex_base.h
rename to 3rdparty/CGAL/include/CGAL/HalfedgeDS_vertex_base.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/HalfedgeDS_vertex_max_base_with_id.h b/3rdparty/CGAL/include/CGAL/HalfedgeDS_vertex_max_base_with_id.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/HalfedgeDS_vertex_max_base_with_id.h
rename to 3rdparty/CGAL/include/CGAL/HalfedgeDS_vertex_max_base_with_id.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/HalfedgeDS_vertex_min_base.h b/3rdparty/CGAL/include/CGAL/HalfedgeDS_vertex_min_base.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/HalfedgeDS_vertex_min_base.h
rename to 3rdparty/CGAL/include/CGAL/HalfedgeDS_vertex_min_base.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Handle.h b/3rdparty/CGAL/include/CGAL/Handle.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Handle.h
rename to 3rdparty/CGAL/include/CGAL/Handle.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Handle_for.h b/3rdparty/CGAL/include/CGAL/Handle_for.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Handle_for.h
rename to 3rdparty/CGAL/include/CGAL/Handle_for.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Handle_for_virtual.h b/3rdparty/CGAL/include/CGAL/Handle_for_virtual.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Handle_for_virtual.h
rename to 3rdparty/CGAL/include/CGAL/Handle_for_virtual.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Handle_hash_function.h b/3rdparty/CGAL/include/CGAL/Handle_hash_function.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Handle_hash_function.h
rename to 3rdparty/CGAL/include/CGAL/Handle_hash_function.h
diff --git a/3rdparty/CGAL/include/CGAL/Handle_with_policy.h b/3rdparty/CGAL/include/CGAL/Handle_with_policy.h
new file mode 100644
index 0000000..478e957
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Handle_with_policy.h
@@ -0,0 +1,1401 @@
+// Copyright (c) 2001-2007 Max-Planck-Institute Saarbruecken (Germany).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Michael Seel <seel at mpi-inf.mpg.de>
+//                 Arno Eigenwillig <arno at mpi-inf.mpg.de>
+//                 Lutz Kettner <kettner at mpi-inf.mpg.de>
+
+#ifndef CGAL_HANDLE_WITH_POLICY_H
+#define CGAL_HANDLE_WITH_POLICY_H
+
+#include <CGAL/basic.h>
+#include <CGAL/memory.h>
+#include <CGAL/type_traits.h>
+
+#include <CGAL/assertions.h>
+#include <CGAL/use.h>
+
+#include <boost/mpl/if.hpp>
+
+#include <cstddef>
+
+#ifdef CGAL_USE_LEDA
+#  include <LEDA/system/memory.h>
+#endif
+
+
+
+namespace CGAL {
+
+/*! \brief <tt>\#include <CGAL/Handle_with_policy.h></tt> for handles with policy
+    parameter for reference counting and union-find strategy. Uses 
+    \c LEDA_MEMORY if available. 
+
+    There are two fundamentally different usages of this base class:
+
+        - with a single representation class. In this case the handle
+          manages allocation and deallocation and the type \c T can
+          be an arbitrary type---the handle adds the necessary reference
+          counter internally.
+
+        - with a hierarchy of representation classes. Type \c T will be 
+          the common base class of this hierarchy and it has to be derived
+          itself from a specific base class, which can be accessed directly
+          or generically from the policy class. The allocator in the 
+          handle will not be used in this scenario, since the handle class
+          does not allocate any representations. Instead, the handle class
+          derived from this handle base class is allocating the different
+          representations with the \c new operator. In this case, 
+          the allocator in the base class of \c T is used.
+
+    We give an example for each usage. See also the documentation
+    of \c Handle_with_policy.
+
+\b Example
+
+We use a single representation class to store an integer. The second
+constructor makes use of one of the forwarding template constructors
+that simply forward their parameter list to the representation
+constructors. They exist for up to ten parameters.  The third
+constructor illustrates how the \c USE_WITH_INITIALIZE_WITH can be
+used. It is useful if extensive computations are necessary before the
+representation can be created.
+
+\code
+struct Int_rep {
+    int val;
+    Int_rep( int i = 0) : val(i) {}
+    Int_rep( int i, int j) : val(i+j) {}
+    Int_rep( int i, int j, int k) : val(i+j+k) {}
+};
+
+template < class Unify>
+struct Int_t : public Handle_with_policy< Int_rep, Unify > {
+    typedef Handle_with_policy< Int_rep, Unify > Base;
+    Int_t( int i = 0) : Base( i) {}
+    Int_t( int i, int j) : Base( i, j) {}     // template constructors
+    Int_t( int i, int j, int k) : Base( Base::USE_WITH_INITIALIZE_WITH) {
+        initialize_with( i, j + k);
+    }
+    int  value() const { return ptr()->val; }
+    void set_value( int i) {
+        copy_on_write();
+        ptr()->val = i;
+    }
+    bool operator==( const Int_t<Unify>& i) const {
+        bool equal = (value() == i.value());
+        if ( equal)
+            Base::unify(i);
+        return equal;
+    }
+};
+\endcode
+
+\b Example
+
+We use a class hierarchy of two representation classes: one base class
+for representing one integer, and a derived class to represent an
+additional integer. To also added virtual get and set functions to
+make this example similar to the one above. 
+
+We use the generic solution to pick the base class for \c Int_vrep
+from the policy class. So all representations are class templates with
+a policy and an allocator as parameter and the handle class
+instantiates them. If this flexibility is not needed, one could derive
+directly from the appropriate base class, i.e., \c
+::CGAL::Reference_counted_hierarchy<Alloc> or \c
+::CGAL::Reference_counted_hierarchy_with_union<Alloc>. \c Alloc is an
+allocator of \c char's here.
+
+\code
+template <class Policy, class Alloc>
+struct Int_vrep : public Policy::Hierarchy_base< Alloc>::Type {
+    int val;
+    virtual ::CGAL::Reference_counted_hierarchy<Alloc>* clone() { 
+        return new Int_vrep( *this); 
+    }
+    virtual int  get_val() const { return val; }
+    virtual void set_val( int i) { val = i; }
+    Int_vrep( int i = 0) : val(i) {}
+};
+
+template <class Policy, class Alloc>
+struct Int_vrep2 : public Int_vrep<Policy,Alloc> {
+    int val2;
+    virtual ::CGAL::Reference_counted_hierarchy<Alloc>* clone() { 
+        return new Int_vrep2( *this);
+    }
+    virtual int get_val() const { return val + val2; }
+    virtual void set_val( int i) { val = i - val2; }
+    Int_vrep2( int i, int j) : Int_vrep<Policy,Alloc>(i), val2(j) {}
+};
+
+template < class Unify, class Alloc = CGAL_ALLOCATOR(char) >
+struct Int_vt : public Handle_with_policy< Int_vrep<Unify,Alloc>, Unify > {
+    typedef Handle_with_policy< Int_vrep<Unify,Alloc>, Unify > Base;
+    Int_vt( int i = 0) : Base( new Int_vrep<Unify,Alloc>(i)) {}
+    Int_vt( int i, int j) : Base( new Int_vrep2<Unify,Alloc>(i,j)) {}
+
+    int  value() const { return ptr()->get_val(); }
+    void set_value( int i) {
+        copy_on_write();
+        ptr()->set_val(i);
+    }
+    bool operator==( const Int_vt<Unify>& i) const {
+        bool equal = (value() == i.value());
+        if ( equal)
+            Base::unify(i);
+        return equal;
+    }
+};
+\endcode
+
+*/
+//@{
+
+// Forward declarations of HandlePolicy classes
+class Handle_policy_in_place;
+class Handle_policy_no_union;
+class Handle_policy_union;
+class Handle_policy_union_and_reset;
+
+// Reference counted representation
+// ================================
+
+//! the base class for bodies of reference counted representations \c T.
+template <class T_>
+class Reference_counted {
+public:
+    typedef T_                          rep_type;
+    typedef Reference_counted<rep_type> Self;
+    typedef rep_type*                   Rep_pointer;
+private:
+    mutable unsigned int count;  // reference counter
+    rep_type             rep;
+public:
+    Reference_counted() : count(1) {}
+    Reference_counted( const rep_type& t) : count(1), rep(t) {}
+    Reference_counted( const Self& r) : count(1), rep(r.rep) {}
+
+    void clear() { rep = rep_type(); }
+    Rep_pointer  base_ptr()  { return &rep; }
+    void add_reference()     { ++count; }
+    void remove_reference()  { --count; }
+    bool is_shared() const   { return count > 1; }
+    int  union_size() const  { return 1+count; }
+    void add_union_size(int) {}
+};
+
+/*!\brief
+ * Base class for bodies of reference counted representations \c T
+ * with a forwarding pointer for identical representations.
+ */
+template <class T_>
+class Reference_counted_with_forwarding {
+public:
+    typedef T_ rep_type;
+    typedef Reference_counted_with_forwarding<rep_type> Self;
+    typedef rep_type*  Rep_pointer;
+    friend class Handle_policy_union;
+    friend class Handle_policy_union_and_reset;
+private:
+    mutable unsigned int count;  // reference counter
+    mutable Self*        next;   // forwarding pointer to valid rep or 0
+    mutable int          u_size; // union set size incl this rep and its handle
+    mutable rep_type     rep;
+public:
+    Reference_counted_with_forwarding()
+        : count(1), next(0), u_size(2) {}
+    Reference_counted_with_forwarding( const rep_type& t)
+        : count(1), next(0), u_size(2), rep(t) {}
+    Reference_counted_with_forwarding( const Self& r)
+        : count(1), next(0), u_size(2), rep(r.rep) {}
+
+    void clear() { rep = rep_type(); }
+    Rep_pointer  base_ptr()    { return &rep; }
+    void add_reference()       { ++count; }
+    void remove_reference()    { --count; }
+    bool is_shared() const     { return count > 1; }
+    bool is_forwarding() const { return next != 0; }
+    int  union_size() const    { return u_size; }
+    void add_union_size(int a) {  
+        CGAL_precondition( u_size + a > 0);
+        u_size += a;
+    }
+};
+
+
+struct Reference_counted_hierarchy_base {};
+
+
+/*!\brief Base class for reference counted representations with a class 
+ * hierarchy of different representations. Needs an allocator for \c char's
+ * as parameter.
+ */
+template <class Allocator_  = CGAL_ALLOCATOR(char)>
+class Reference_counted_hierarchy : public Reference_counted_hierarchy_base {
+    // make sure it's always a char allocator
+    typedef typename Allocator_::template rebind< char> Char_alloc_rebind;
+    typedef typename Char_alloc_rebind::other   Char_allocator;
+
+    static Char_allocator alloc;
+
+public:
+    void* operator new(size_t bytes) { return alloc.allocate( bytes); }
+    void  operator delete(void* p, size_t bytes) { 
+        alloc.deallocate((char*)p, bytes);
+    }
+
+public:
+    typedef Allocator_ Allocator;
+    typedef Reference_counted_hierarchy<Allocator> Self;
+    typedef Self*  Rep_pointer;
+private:
+    mutable unsigned int count;  // reference counter
+public:
+    Reference_counted_hierarchy() : count(1) {}
+    Reference_counted_hierarchy( const Self&) : count(1) {}
+
+    Rep_pointer base_ptr()   { return this; }
+    void add_reference()     { ++count; }
+    void remove_reference()  { --count; }
+    bool is_shared() const   { return count > 1; }
+    int  union_size() const  { return 1+count; }
+    void add_union_size(int) {}
+
+    //! returns a copy of \c this. Can be implemented like
+    //! <tt>return new Derived_type( *this);</tt>
+    virtual Self* clone() = 0;
+    //! the virtual destructor is essential for proper memory management here.
+    virtual ~Reference_counted_hierarchy() {}
+    //! can be used to minimize memory consumption once it is known that this
+    //! representation is not used anymore and only needed to keep a fowarding
+    //! pointer. One example would be cleaning up dynamically allocated
+    //! data, or another example would be overwriting a \c leda::real with 
+    //! a default constructed value to free its old expression tree. However,
+    //! this function can also be savely ignored and kept empty.
+    virtual void clear() {}
+};
+
+template <class Alloc>
+typename Reference_counted_hierarchy<Alloc>::Char_allocator
+    Reference_counted_hierarchy<Alloc>::alloc;
+
+/*!\brief Base class for reference counted representations with a class 
+ * hierarchy of different representations. Needs an allocator for \c char's
+ * as parameter.
+ */
+template <class Allocator_  = CGAL_ALLOCATOR(char)>
+class Reference_counted_hierarchy_with_union 
+    : public Reference_counted_hierarchy<Allocator_> 
+{
+    friend class Handle_policy_union;
+    friend class Handle_policy_union_and_reset;
+public:
+    typedef Allocator_ Allocator;
+    typedef Reference_counted_hierarchy_with_union<Allocator> Self;
+private:
+    mutable Self*        next;   // forwarding pointer to valid rep or 0
+    mutable int          u_size; // union set size incl this rep and its handle
+public:
+    Reference_counted_hierarchy_with_union() : 
+        Reference_counted_hierarchy<Allocator_>(), next(0), u_size(2) {}
+    bool is_forwarding() const { return next != 0; }
+    int  union_size() const    { return u_size; }
+    void add_union_size(int a) {  
+        CGAL_precondition( u_size + a > 0);
+        u_size += a;
+    }
+};
+
+
+// Handle for reference counted representation
+// ===========================================
+
+namespace Intern {
+    // Some helper classes to select representation between single class
+    // representations and class hierarchy representations.
+
+    // the representation type including a reference counter. 
+    // The handle allocates objects of this type. This is the version
+    // for the single representation type.
+    template <class T, int HandleHierarchyPolicy>
+    struct Rep_bind_reference_counted {
+        typedef Reference_counted<T> Rep;
+    };
+
+    // the representation type including a reference counter. 
+    // The handle allocates objects of this type. This is the version
+    // for the class hierarchy of representation types.
+    template <class T>
+    struct Rep_bind_reference_counted<T, true> {
+        typedef T Rep;
+    };
+
+    // the two versions for Reference_counted_with_forwarding
+    template <class T, int HandleHierarchyPolicy>
+    struct Rep_bind_reference_counted_with_forwarding {
+        typedef Reference_counted_with_forwarding<T> Rep;
+    };
+
+    // the representation type including a reference counter. 
+    // The handle allocates objects of this type. This is the version
+    // for the class hierarchy of representation types.
+    template <class T>
+    struct Rep_bind_reference_counted_with_forwarding<T, true> {
+        Rep_bind_reference_counted_with_forwarding() {
+            // make sure we derived from the right type 
+            typedef typename T::Allocator Alloc;
+            typedef ::CGAL::Reference_counted_hierarchy_with_union<Alloc> 
+                Reference_counted_hierarchy_with_union;
+            CGAL_USE_TYPE(Reference_counted_hierarchy_with_union);
+            CGAL_static_assertion((
+              ::CGAL::is_same_or_derived< Reference_counted_hierarchy_with_union, T >::value ));
+        }
+        typedef T Rep;
+    };
+
+}
+
+/*! \brief Policy class for \c Handle_with_policy that stores the
+    representation directly without reference counting and without dynamic 
+    memory allocation, is actually \e not a model of the \c HandlePolicy
+    concept, but can be  used instead of one. It selects a different
+    specialized implementation of \c Handle_with_policy. It works only with
+    the single representation type, not with a class hierarchy of 
+    representation types since they need the pointer in the handle
+    for the polymorphy.
+*/
+class Handle_policy_in_place {};
+
+/*!\brief
+ * Policy class for \c Handle_with_policy<T> that ignores unifying of
+ * identical representations \c T, is a model of the \c HandlePolicy concept.
+ */
+class Handle_policy_no_union {
+public:
+    /*!\brief
+     * A rebind mechanism to create the representation type.
+     */
+    template <class T, int hierarchy>
+    struct Rep_bind {
+        //! the representation type including a reference counter. 
+        //! The handle allocates objects of this type.
+        typedef typename 
+            Intern::Rep_bind_reference_counted<T,hierarchy>::Rep Rep;
+    };
+
+    /*!\brief
+     * A rebind mechanism to access the base class for class hierarchies
+     * of representations. 
+     * 
+     * The base classes can be used directly, but this
+     * rebind mechamism allows the implementation of handle-rep classes
+     * that are parameterized with the policy class only and adapt to
+     * the necessary base class.
+     */
+    template <class Alloc>
+    struct Hierarchy_base {
+        //! type that can be used as base class for the representation type.
+        typedef Reference_counted_hierarchy<Alloc> Type;
+    };
+    
+    /*! \brief unifies the representations of the two handles \a h and \a g.
+     *  The effect is void here.
+     * 
+     * \pre The representations represent the same value and one could be 
+     *  replaced by the other.
+    */
+    template <class H>
+    static void unify( const H& h, const H& g) {
+        (void)h; // avoid warnings for unused parameters
+        (void)g; // but keep the names in the definition for the doc.
+    }
+
+    //! finds the currently valid representation for the handle \a h
+    //! and returns a pointer to its stored value of type \a T.
+    template <class H>
+    static typename H::Rep_pointer find( const H& h) {
+        return h.ptr_->base_ptr();
+    }
+};
+
+/*!\brief
+ * Policy class for \c Handle_with_policy that implements unifying of
+ * identical representations \c T with trees and path compression, is a
+ * model of the \c HandlePolicy concept.
+ */
+class Handle_policy_union {
+public:
+    /*!\brief
+     * A rebind mechanism to create the representation type.
+     */
+    template <class T, int hierarchy>
+    struct Rep_bind {
+        //! this default constructor contains some compile-time checks.
+        Rep_bind() {
+	  //Intern::Rep_bind_reference_counted_with_forwarding<T, hierarchy>
+	  //     check;
+          //  (void)check;
+	  (void)Intern::Rep_bind_reference_counted_with_forwarding<T, hierarchy>();
+        }
+        //! the representation type including a reference counter. 
+        //! The handle allocates objects of this type.
+        typedef typename Intern::Rep_bind_reference_counted_with_forwarding<T,
+            hierarchy>::Rep Rep;
+    };
+
+    /*!\brief
+     * A rebind mechanism to access the base class for class hierarchies
+     * of representations. 
+     * 
+     * The base classes can be used directly, but this
+     * rebind mechamism allows the implementation of handle-rep classes
+     * that are parameterized with the policy class only and adapt to
+     * the necessary base class.
+     */
+    template <class Alloc>
+    struct Hierarchy_base {
+        //! type that can be used as base class for the representation type.
+        typedef Reference_counted_hierarchy_with_union<Alloc> Type;
+    };
+    
+    /*! \brief unifies the representations of the two handles \a h and \a g.
+        Performs union.
+        \pre The representations represent the same value and one can be 
+        replaced by the other. The handles \a h and \a g are already
+        the representatives found by the find operation and \a h is not
+        equal to \a g. The tree representing the union of \a h has size
+        not smaller than the corresponding tree size of \a g.
+    */
+    template <class H>
+    static void unify_large_small( const H& h, const H& g) {
+        typename H::Rep* hrep = h.ptr_;
+        typename H::Rep* grep = g.ptr_;
+        CGAL_precondition( ! grep->is_forwarding());
+        CGAL_precondition( hrep->union_size() >= grep->union_size());
+        grep->add_union_size(-1);
+        // make g point to h's rep.
+        if ( grep->is_shared()) {
+            // grep survises the loss of one reference 
+            // and hrep gets one more reference
+            grep->remove_reference();
+            hrep->add_reference();
+            hrep->add_union_size( grep->union_size());
+            grep->next = hrep;
+        } else {
+            g.delete_rep( grep); // did not survive loss of handle g
+        }
+        // redirect handle g and incr. hrep's counter
+        g.ptr_ = hrep;
+        hrep->add_reference();
+        hrep->add_union_size(1);
+    }
+
+    /*! \brief unifies the representations of the two handles \a h and \a g.
+        Performs union with path compression.
+        \pre The representations represent the same value and one can be 
+        replaced by the other.
+    */
+    template <class H>
+    static void unify( const H& h, const H& g) {
+        if ( find(h) !=  find(g)) {
+            if ( h.ptr_->union_size() > g.ptr_->union_size())
+                unify_large_small( h, g); // make g point to h's rep.
+            else
+                unify_large_small( g, h); // make h point to g's rep.
+        }
+    }
+
+    /*! \brief finds the currently valid representation for the handle \a h
+        and returns a pointer to its stored value of type \a T. Performs
+        path-compression to speed-up later union operations.
+    */
+    template <class H>
+    static typename H::Rep_pointer find( const H& h) {
+        typedef typename H::Rep Rep;
+        if ( h.ptr_->is_forwarding()) {
+            // find new valid representation
+            Rep* new_rep = h.ptr_;
+            while ( new_rep->next != 0)
+                new_rep = static_cast<Rep*>(new_rep->next);
+            // path compression: assign new rep to all reps seen on the path
+            // update reference count properly: all reps on the path loose
+            // one reference, and the new_rep gains all of them unless
+            // the rep on the path get actually deleted.
+            Rep* rep = h.ptr_;
+            while ( rep != new_rep) {
+                Rep* tmp = static_cast<Rep*>(rep->next);
+                if ( rep->is_shared()) {
+                    // rep survives the loss of one reference 
+                    // and new_rep gets one more reference
+                    rep->remove_reference();
+                    if ( tmp != new_rep) {
+                        // re-link rep to the new_rep
+                        rep->next = new_rep;
+                        new_rep->add_reference();
+                    }
+                } else {
+                    h.delete_rep( rep); // we have to delete the current rep
+		    tmp->remove_reference();
+                }                
+                rep = tmp;
+            }
+            // hook h to new_rep
+            h.ptr_ = new_rep;
+            new_rep->add_reference();
+        }
+        return h.ptr_->base_ptr();
+    }
+};
+
+/*!\brief Policy class for \c Handle_with_policy that implements unifying of
+ * identical representations \c T with trees and path compression. 
+ * 
+ * It also 
+ * sets the unused representation immediately to the default constructed
+ * representation \c T(), which can help to free memory if the 
+ * representation is dynamically allocated and potentially large, e.g.,
+ * \c leda::real. This class is a model of the \c HandlePolicy concept.
+ */
+class Handle_policy_union_and_reset {
+public:
+    /*!\brief
+     * A rebind mechanism to create the representation type.
+     */
+    template <class T, int hierarchy>
+    struct Rep_bind {
+        //! this default constructor contains some compile-time checks.
+        Rep_bind() {
+	  //Intern::Rep_bind_reference_counted_with_forwarding<T, hierarchy>
+	  //     check;
+	  // (void)check;
+	  (void)Intern::Rep_bind_reference_counted_with_forwarding<T, hierarchy>();
+        }
+        //! the representation type including a reference counter. 
+        //! The handle allocates objects of this type.
+        typedef typename Intern::Rep_bind_reference_counted_with_forwarding<T,
+            hierarchy>::Rep Rep;
+    };
+
+    /*!\brief
+     * A rebind mechanism to access the base class for class hierarchies
+     * of representations. 
+     *
+     * The base classes can be used directly, but this
+     * rebind mechamism allows the implementation of handle-rep classes
+     * that are parameterized with the policy class only and adapt to
+     * the necessary base class.
+     */
+    template <class Alloc>
+    struct Hierarchy_base {
+        //! type that can be used as base class for the representation type.
+        typedef Reference_counted_hierarchy_with_union<Alloc> Type;
+    };
+
+    // abbreviation to re-use its implementation below.
+    typedef Handle_policy_union U;
+
+    /*! \brief unifies the representations of the two handles \a h and \a g.
+        Performs union with path compression and assigns a default
+        constructed value of the representation type \c Rep to the
+        superfluous representation.
+        \pre The representations represent the same value and one can be 
+        replaced by the other.
+    */
+    template <class H>
+    static void unify( const H& h, const H& g) {
+        if ( find(h) !=  find(g)) {
+            if ( h.ptr_->union_size() > g.ptr_->union_size()) {
+                // reset representation in g to default construction of T
+                if ( g.ptr_->is_shared())
+                    g.ptr_->clear();
+                U::unify_large_small( h, g); // make g point to h's rep.
+            } else {
+                // reset representation in h to default construction of T
+                if ( h.ptr_->is_shared())
+                    h.ptr_->clear();
+                U::unify_large_small( g, h); // make h point to g's rep.
+            }
+        }
+    }
+
+    /*! \brief finds the currently valid representation for the handle \a h
+        and returns a pointer to its stored value of type \a T. Performs
+        path-compression to speed-up later union operations.
+    */
+    template <class H>
+    static typename H::Rep_pointer find( const H& h) { return U::find(h); }
+};
+
+
+/*! \brief the base class for handles of reference counted representations of
+    \c T. 
+
+    There are two fundamentally different usages of this base class:
+
+        - with a single representation class. In this case the handle
+          manages allocation and deallocation and the type \c T can
+          be an arbitrary type---the handle adds the necessary reference
+          counter internally.
+
+        - with a hierarchy of representation classes. Type \c T will be 
+          the common base class of this hierarchy and it has to be derived
+          itself from either \c ::CGAL::Reference_counted_hierarchy or
+          \c ::CGAL::Reference_counted_hierarchy_with_union, both parameterized 
+          with an allocator. The allocator in the handle will not be used in 
+          this scenario, since the handle class does not allocate any 
+          representations. Instead, the handle class derived from this handle
+          base class is allocating the different representations with the
+          \c new operator. In this case, the allocator in the base class
+          of \c T is used.
+
+    The handle class distinguishes between these two alternative
+    usages by checking if \c T is derived from one of the two base
+    classes mentioned for the second alternative. If not, it picks the
+    first alternative.
+
+    In the second alternative, the correct base class, \c 
+    ::CGAL::Reference_counted_hierarchy_with_union, has to be used
+    if the policy class is one of \c class Handle_policy_union r \c 
+    Handle_policy_union_and_reset. Otherwise, the other base class can 
+    be used to save space.
+
+    The policy class \c Handle_policy_in_place is incompatible with the class
+    hierarchy for representation classes since the pointer in the
+    handle class would be missing.
+
+    The dependency of the base classes for \c T and the policy classes
+    is also encoded in the policy classes and can be used to write
+    generic handle-rep scheme classes. To do that one can derive \c T
+    from the expressions \c Policy::Hierarchy_base<Alloc>::Type
+    assuming that \c Policy is the handle policy and \c Alloc is the
+    allocator. Btw, the allocator is used as an allocator of character
+    arrays here.
+
+    \see \link Handle Handle for Reference Counting\endlink for 
+    an example for each of the two alternative usages.
+
+    The template parameters are:
+        - \b T: is one of the two following:
+            - an arbitrary type but it must be a model of the
+              \c DefaultConstructible concept if the default constructor
+              of the handle is used.
+            - a type derived from \c Reference_counted_hierarchy<Alloc> or
+              \c Reference_counted_hierarchy_with_union<Alloc> implementing
+              their virtual member function interface, namely a \c clone()
+              function.
+
+        - \b HandlePolicy: a model of the \c HandlePolicy concept or the
+              \c Handle_policy_in_place class template that selects a specialized
+              implementation without reference counting. Has the
+              default \c Handle_policy_no_union.
+
+        - \b Allocator_: a model of the \c Allocator concept,
+          has the default \c CGAL_ALLOCATOR(T).
+
+*/
+template <class T_, 
+          class HandlePolicy = Handle_policy_no_union, 
+          class Allocator_ = CGAL_ALLOCATOR(T_)>
+class Handle_with_policy {
+public:
+
+    //! first template parameter
+    typedef T_ Handled_type;
+
+    //! the handle type itself.
+    typedef Handle_with_policy< Handled_type, HandlePolicy, Allocator_>    Self;
+
+    //! the instantiated model of the \c HandlePolicy concept.
+    typedef HandlePolicy                Handle_policy;
+
+    //! the allocator type.
+    typedef Allocator_                  Allocator;
+
+    enum { is_class_hierarchy  = 
+        ::CGAL::is_same_or_derived< Reference_counted_hierarchy_base, Handled_type>::value };
+        
+    typedef typename Handle_policy::template Rep_bind< Handled_type, is_class_hierarchy > Bind;
+    
+    // instantiate Rep_bind to activate compile time check in there
+    static Bind bind;
+    
+    // Define type that is used for function matching 
+    typedef typename ::boost::mpl::if_c< 
+         is_class_hierarchy, 
+           ::CGAL::Tag_true, 
+           ::CGAL::Tag_false >::type 
+         Class_hierarchy;
+
+    //! the internal representation, i.e., \c T plus a reference count
+    //! (if needed), or just \c T if we derived from the base class to
+    //! support a class hierarchy for the representations.    
+    typedef typename Bind::Rep  Rep;
+
+    typedef typename Rep::Rep_pointer  Rep_pointer;
+
+    typedef typename Allocator_::template rebind<Rep>::other  Rep_allocator;
+
+
+    //! integer type for identifying a representation.
+    typedef std::ptrdiff_t              Id_type;
+
+    friend class Handle_policy_no_union;
+    friend class Handle_policy_union;
+    friend class Handle_policy_union_and_reset;
+private:
+    mutable Rep*  ptr_;
+
+    // We have to distinguish between allocating single representations
+    // and where we have a class hierarchy of representations, where the
+    // user is responsible for allocating the first representations
+    // and we can just \c clone and delete them.
+    static Rep_allocator allocator;
+
+    static Rep* new_rep( const Rep& rep) { 
+        CGAL_static_assertion( !(
+           ::CGAL::is_same_or_derived< Reference_counted_hierarchy_base, Handled_type >::value ));
+        Rep* p = allocator.allocate(1);
+        allocator.construct(p, rep);
+        return p;
+    }
+    static void delete_rep( Rep* p, ::CGAL::Tag_false ) {
+        allocator.destroy( p);
+        allocator.deallocate( p, 1);
+    }
+    static void delete_rep( Rep* p, ::CGAL::Tag_true ) {
+        delete p;
+    }
+    static void delete_rep( Rep* p) { delete_rep(p, Class_hierarchy()); }
+
+    static Rep* clone_rep( Rep* p, ::CGAL::Tag_false ) {
+        return new_rep( *p);
+    }
+    static Rep* clone_rep( Rep* p, ::CGAL::Tag_true ) {
+        return static_cast<Rep*>(p->clone());
+    }
+    static Rep* clone_rep( Rep* p) { return clone_rep( p, Class_hierarchy()); }
+
+    void remove_reference() {
+        // cleans up the possible chain of forwarding reps
+        Handle_policy::find( *this);
+        if ( ! is_shared()) {
+            delete_rep( ptr_);
+        } else {
+            ptr_->remove_reference();
+            ptr_->add_union_size( -1);
+        }
+    }
+
+    template <class TT>
+    Rep* make_from_single_arg( const TT& t, ::CGAL::Tag_false ) {
+        return new_rep( Rep( Handled_type(t)));
+    }
+    template <class TT>
+    Rep* make_from_single_arg( TT t, ::CGAL::Tag_true ) {
+      //Bind bind_; // trigger compile-time check
+      // (void)bind_;
+      (void)Bind(); // shouldn't this be enough to trigger?
+        return t; // has to be a pointer convertible to Rep*
+    }
+
+protected:
+    //! protected access to the stored representation
+    Handled_type*       ptr()       { return static_cast<Handled_type*>(Handle_policy::find(*this));}
+    //! protected access to the stored representation
+    const Handled_type* ptr() const { 
+        return static_cast<const Handled_type*>(Handle_policy::find( *this));
+    }
+
+    //! unify two representations. \pre The two representations describe
+    //! the same value  and one can be replaced by the other, i.e., the 
+    //! values are immutable, or protected from changes with \c copy_on_write()
+    //! calls!
+    void unify( const Self& h) const { Handle_policy::unify( *this, h); }
+
+    //! can be called before modifying a shared representation
+    //! to get an own copy of the representation which avoids effecting the
+    //! other sharing handles. Does nothing if representation is actually
+    //! not shared.
+    void copy_on_write() {
+        Handle_policy::find( *this);
+        if ( is_shared() ) {
+            Rep* tmp_ptr = clone_rep( ptr_);
+            ptr_->remove_reference();
+            ptr_->add_union_size( -1);
+            ptr_ = tmp_ptr;
+        }
+    }
+
+    //! used with special protected constructor
+    enum Use_with_initialize_with {
+        USE_WITH_INITIALIZE_WITH //!< used with special protected constructor
+                                 //!< of \c Handle_with_policy.
+    };
+
+    //! special constructor, postpones the construction of the representation
+    //! to one of the \c initialize_with() functions. An object is in an
+    //! invalid state (and will report a failed precondition later) if
+    //! it is not initialized with an \c initialize_with() function call
+    //! after this constructor. Applicable for single representation but 
+    //! also for a class hierarchy of representations.
+    Handle_with_policy( Use_with_initialize_with) : ptr_( 0) {}
+
+    //! constructor used for class hierarchies of representations, where
+    //! the handle class derived from this handle creates the different 
+    //! representations itself with the \c new operator. Except for this
+    //! constructor, the the one with the \c Use_with_initialize_with
+    //! argument, and the single argument template constructor no other 
+    //! constructor will work for class hierarchies of representations.
+    Handle_with_policy( Rep* p) : ptr_( p) {
+        CGAL_static_assertion((
+           ::CGAL::is_same_or_derived< Reference_counted_hierarchy_base, Handled_type >::value ));
+        //Bind bind_; // trigger compile-time check
+        //(void)bind_;
+	(void)Bind();
+    }
+
+    //! initializes the representation after the constructor from 
+    //! \c USE_WITH_INITIALIZE_WITH has been used. Applicable for a
+    //! class hierarchy of representations only, where the derived handle class
+    //! created the representation \c p with the \c new operator. No other
+    //! version of \c initialize_with is applicable in this case except
+    //! the template version with one argument.
+    void initialize_with( Rep* p) {
+        CGAL_static_assertion((
+           ::CGAL::is_same_or_derived< Reference_counted_hierarchy_base, Handled_type >::value ));
+        //Bind bind_; // trigger compile-time check
+        //(void)bind_;
+	(void)Bind();
+        CGAL_precondition_msg( ptr_ == 0, "Handle_with_policy::initialize_with(): the "
+                         "representation has already been initialized.");
+        ptr_ = p;
+    }
+
+    //! initializes the representation after the constructor from 
+    //! \c USE_WITH_INITIALIZE_WITH has been used.
+    //! In case of the class hierarchy of representation classes,
+    //! this function is also chosen for pointers to newly allocated
+    //! representations that are types derived from \c T. In that case,
+    //! the pointer is just assigned to the internal pointer.
+    template <class T1>
+    void initialize_with( const T1& t1) {
+        CGAL_precondition_msg( ptr_ == 0, "Handle_with_policy::initialize_with(): the "
+                         "representation has already been initialized.");
+        ptr_ = make_from_single_arg( t1, Class_hierarchy());
+    }
+
+    //! initializes the representation after the constructor from 
+    //! \c USE_WITH_INITIALIZE_WITH has been used.
+    template <class T1, class T2>
+    void initialize_with( const T1& t1, const T2& t2) {
+        CGAL_precondition_msg( ptr_ == 0, "Handle_with_policy::initialize_with(): the "
+                         "representation has already been initialized.");
+        ptr_ = new_rep( Rep( Handled_type(t1,t2)));
+    }
+
+    //! initializes the representation after the constructor from 
+    //! \c USE_WITH_INITIALIZE_WITH has been used.
+    template <class T1, class T2, class T3>
+    void initialize_with( const T1& t1, const T2& t2, const T3& t3) {
+        CGAL_precondition_msg( ptr_ == 0, "Handle_with_policy::initialize_with(): the "
+                         "representation has already been initialized.");
+        ptr_ = new_rep( Rep( Handled_type(t1,t2,t3)));
+    }
+
+    //! initializes the representation after the constructor from 
+    //! \c USE_WITH_INITIALIZE_WITH has been used.
+    template <class T1, class T2, class T3, class T4>
+    void initialize_with( const T1& t1, const T2& t2, const T3& t3,
+                          const T4& t4) {
+        CGAL_precondition_msg( ptr_ == 0, "Handle_with_policy::initialize_with(): the "
+                         "representation has already been initialized.");
+        ptr_ = new_rep( Rep( Handled_type(t1,t2,t3,t4)));
+    }
+
+    //! initializes the representation after the constructor from 
+    //! \c USE_WITH_INITIALIZE_WITH has been used.
+    template <class T1, class T2, class T3, class T4, class T5>
+    void initialize_with( const T1& t1, const T2& t2, const T3& t3,
+                          const T4& t4, const T5& t5) {
+        CGAL_precondition_msg( ptr_ == 0, "Handle_with_policy::initialize_with(): the "
+                         "representation has already been initialized.");
+        ptr_ = new_rep( Rep( Handled_type(t1,t2,t3,t4,t5)));
+    }
+
+    //! initializes the representation after the constructor from 
+    //! \c USE_WITH_INITIALIZE_WITH has been used.
+    template <class T1, class T2, class T3, class T4, class T5, class T6>
+    void initialize_with( const T1& t1, const T2& t2, const T3& t3,
+                          const T4& t4, const T5& t5, const T6& t6) {
+        CGAL_precondition_msg( ptr_ == 0, "Handle_with_policy::initialize_with(): the "
+                         "representation has already been initialized.");
+        ptr_ = new_rep( Rep( Handled_type(t1,t2,t3,t4,t5,t6)));
+    }
+
+    //! initializes the representation after the constructor from 
+    //! \c USE_WITH_INITIALIZE_WITH has been used.
+    template <class T1, class T2, class T3, class T4, class T5, class T6,
+              class T7>
+    void initialize_with( const T1& t1, const T2& t2, const T3& t3,
+                          const T4& t4, const T5& t5, const T6& t6,
+                          const T7& t7) {
+        CGAL_precondition_msg( ptr_ == 0, "Handle_with_policy::initialize_with(): the "
+                         "representation has already been initialized.");
+        ptr_ = new_rep( Rep( Handled_type(t1,t2,t3,t4,t5,t6,t7)));
+    }
+
+    //! initializes the representation after the constructor from 
+    //! \c USE_WITH_INITIALIZE_WITH has been used.
+    template <class T1, class T2, class T3, class T4, class T5, class T6,
+              class T7, class T8>
+    void initialize_with( const T1& t1, const T2& t2, const T3& t3,
+                          const T4& t4, const T5& t5, const T6& t6,
+                          const T7& t7, const T8& t8) {
+        CGAL_precondition_msg( ptr_ == 0, "Handle_with_policy::initialize_with(): the "
+                         "representation has already been initialized.");
+        ptr_ = new_rep( Rep( Handled_type(t1,t2,t3,t4,t5,t6,t7,t8)));
+    }
+
+    //! initializes the representation after the constructor from 
+    //! \c USE_WITH_INITIALIZE_WITH has been used.
+    template <class T1, class T2, class T3, class T4, class T5, class T6,
+              class T7, class T8, class T9>
+    void initialize_with( const T1& t1, const T2& t2, const T3& t3,
+                          const T4& t4, const T5& t5, const T6& t6,
+                          const T7& t7, const T8& t8, const T9& t9) {
+        CGAL_precondition_msg( ptr_ == 0, "Handle_with_policy::initialize_with(): the "
+                         "representation has already been initialized.");
+        ptr_ = new_rep( Rep( Handled_type(t1,t2,t3,t4,t5,t6,t7,t8,t9)));
+    }
+
+public:
+    //! default constructor.
+    Handle_with_policy() : ptr_( new_rep( Rep())) {}
+
+    //! copy constructor, increments reference count.
+    Handle_with_policy(const Self& h) {
+        CGAL_precondition_msg( h.ptr_ != 0, "Handle_with_policy::Handle_with_policy( Self): probably "
+                         "used special protected constructor and not the "
+                         "'initialize_with()' function.");
+        Handle_policy::find( h);
+        ptr_ = h.ptr_;
+        ptr_->add_reference();
+        ptr_->add_union_size( 1);
+    }
+
+    //! forwarding constructor passing its parameter to the representation
+    //! constructor. In case of the class hierarchy of representation classes,
+    //! this constructor is also chosen for pointers to newly allocated
+    //! representations that are types derived from \c T. In that case,
+    //! the pointer is just assigned to the internal pointer.
+    template <class T1>
+    explicit Handle_with_policy( const T1& t) 
+        : ptr_( make_from_single_arg( t, Class_hierarchy())) {}
+
+    //! forwarding constructor passing its parameters to the representation
+    //! constructor.
+    template <class T1, class T2>
+    Handle_with_policy( const T1& t1, const T2& t2) : ptr_( new_rep( Rep( Handled_type( t1, t2)))) {}
+
+    //! forwarding constructor passing its parameters to the representation
+    //! constructor.
+    template <class T1, class T2, class T3>
+    Handle_with_policy( const T1& t1, const T2& t2, const T3& t3) 
+        : ptr_( new_rep( Rep( Handled_type( t1, t2, t3)))) {}
+
+    //! forwarding constructor passing its parameters to the representation
+    //! constructor.
+    template <class T1, class T2, class T3, class T4>
+    Handle_with_policy( const T1& t1, const T2& t2, const T3& t3, const T4& t4) 
+        : ptr_( new_rep( Rep( Handled_type( t1, t2, t3, t4)))) {}
+
+    //! forwarding constructor passing its parameters to the representation
+    //! constructor.
+    template <class T1, class T2, class T3, class T4, class T5>
+    Handle_with_policy( const T1& t1, const T2& t2, const T3& t3, const T4& t4,
+            const T5& t5) 
+        : ptr_( new_rep( Rep( Handled_type( t1, t2, t3, t4, t5)))) {}
+
+    //! forwarding constructor passing its parameters to the representation
+    //! constructor.
+    template <class T1, class T2, class T3, class T4, class T5, class T6>
+    Handle_with_policy( const T1& t1, const T2& t2, const T3& t3, const T4& t4,
+            const T5& t5, const T6& t6) 
+        : ptr_( new_rep( Rep( Handled_type( t1, t2, t3, t4, t5, t6)))) {}
+
+    //! forwarding constructor passing its parameters to the representation
+    //! constructor.
+    template <class T1, class T2, class T3, class T4, class T5, class T6, 
+              class T7>
+    Handle_with_policy( const T1& t1, const T2& t2, const T3& t3, const T4& t4,
+            const T5& t5, const T6& t6, const T7& t7) 
+        : ptr_( new_rep( Rep( Handled_type( t1, t2, t3, t4, t5, t6, t7)))) {}
+
+    //! forwarding constructor passing its parameters to the representation
+    //! constructor.
+    template <class T1, class T2, class T3, class T4, class T5, class T6, 
+              class T7, class T8>
+    Handle_with_policy( const T1& t1, const T2& t2, const T3& t3, const T4& t4,
+            const T5& t5, const T6& t6, const T7& t7, const T8& t8) 
+        : ptr_( new_rep( Rep( Handled_type( t1, t2, t3, t4, t5, t6, t7, t8)))) {}
+
+    //! forwarding constructor passing its parameters to the representation
+    //! constructor.
+    template <class T1, class T2, class T3, class T4, class T5, class T6, 
+              class T7, class T8, class T9>
+    Handle_with_policy( const T1& t1, const T2& t2, const T3& t3, const T4& t4,
+            const T5& t5, const T6& t6, const T7& t7, const T8& t8,
+            const T9& t9) 
+        : ptr_( new_rep( Rep( Handled_type( t1, t2, t3, t4, t5, t6, t7, t8, t9)))) {}
+
+    //! destructor, decrements reference count.
+    ~Handle_with_policy() {
+      //Bind bind_; // trigger compile-time check
+      //(void)bind_;
+      (void)Bind();
+        CGAL_precondition_msg( ptr_ != 0, "Handle_with_policy::~Handle_with_policy(): probably used "
+                         "special protected constructor and not the "
+                         "'initialize_with()' function.");
+        remove_reference();
+    }
+
+    //! assignment, updates reference count correspondingly.
+    Self& operator=( const Self& h) {
+        CGAL_precondition_msg( h.ptr_ != 0, "Handle_with_policy::operator=(): probably "
+                         "used special protected constructor and not the "
+                         "'initialize_with()' function.");
+        Handle_policy::find( h);
+        h.ptr_->add_reference();
+        h.ptr_->add_union_size( 1);
+        remove_reference();
+        ptr_ = h.ptr_;
+        return *this;
+    }
+
+    //! returns \c true if both share the same representation.
+    bool is_identical( const Self& h) const { return ptr() == h.ptr(); }
+
+    //! returns a unique id value. Two handles share their representation
+    //! is their id values are identical.
+    Id_type id() const { return reinterpret_cast<Id_type>(&*ptr()); }
+
+    //! returns true if the representation is shared, i.e., the reference
+    //! counter is greater than one.
+    bool is_shared() const { return ptr_->is_shared(); }
+
+    //! returns \c true if the representation is actually forwarding to
+    //! another equivalent representation (happens only with the
+    //! union-find policies).
+    bool is_forwarding() const { return ptr_->is_forwarding(); }
+
+    //! returns the size of the union set including all reference counts that
+    //! have been accumulated so far for this representation.
+    int  union_size() const { return ptr_->union_size(); }
+
+    // backwards compatible
+    bool identical( const Self& h) const { return is_identical(h); }
+
+#ifdef CGAL_HANDLE_WITH_POLICY_INTERNAL_TEST
+    // provide access to pointer for testing only!!
+    const Rep* test_ptr() const { return ptr_; }
+    // provide access to pointer for testing only!!
+    bool test_identical_ptr( const Self& h) const { return ptr_ == h.ptr_; }
+#endif // CGAL_HANDLE_WITH_POLICY_INTERNAL_TEST
+};
+
+// instantiate Rep_bind to activate compile time check in there
+template <class T, class Policy, class Alloc>
+typename Handle_with_policy<T,Policy,Alloc>::Bind Handle_with_policy<T,Policy,Alloc>::bind;
+
+
+//! alternative syntax for \c h.id() to allow use with LEDA
+/*! This is only provided for \c Handle_policy_no_union because
+ *  ID numbers have to be fixed throughout an object's lifetime.
+ */
+template <class T, class A>
+typename Handle_with_policy<T, Handle_policy_no_union, A>::Id_type
+ID_Number(const Handle_with_policy<T, Handle_policy_no_union, A>& h)
+    { return h.id(); }
+
+template <class T, class Policy, class Alloc>
+typename Handle_with_policy<T, Policy, Alloc>::Rep_allocator 
+    Handle_with_policy<T, Policy, Alloc>::allocator;
+
+
+/*! \brief specialization of the base class for handles for non-reference
+    counted representations.
+    Uses \c LEDA_MEMORY if available.
+*/
+template <class T_, class Allocator_>
+class Handle_with_policy<T_, Handle_policy_in_place, Allocator_> {
+public:
+
+    //! first template paramter
+    typedef T_ Handled_type;
+
+    //! the handle type itself.
+    typedef Handle_with_policy< Handled_type, Handle_policy_in_place, Allocator_>   Self;
+
+    //! the model of the \c HandlePolicy concept.
+    typedef Handle_policy_in_place                           Handle_policy;
+
+    //! the allocator type.
+    typedef Allocator_                                Allocator;
+
+    //! identify \c T with the internal representation \c Rep.
+    typedef Handled_type                              Rep;
+
+    //! integer type for identifying a representation.
+    typedef std::ptrdiff_t                            Id_type;
+private:
+    // store the rep in place
+    Rep  rep;
+
+protected:
+    //! protected access to the stored representation
+    Handled_type*       ptr()       { return &rep; }
+    //! protected access to the stored representation
+    const Handled_type* ptr() const { return &rep; }
+
+    //! unify two representations, a null op here.
+    void unify( const Self&) const {}
+
+    //! can be called before modifying a shared representation
+    //! to get an own copy of the representation, a null op here.
+    void copy_on_write() {}
+
+    //! used with special protected constructor
+    enum Use_with_initialize_with {
+        USE_WITH_INITIALIZE_WITH //!< used with special protected constructor
+    };
+
+    //! special constructor, postpones the construction of the representation
+    //! to one of the \c initialize_with() functions. Requires default
+    //! constructor for \c T.
+    Handle_with_policy( Use_with_initialize_with) {}
+    
+    //! initializes the representation after the constructor from 
+    //! \c USE_WITH_INITIALIZE_WITH has been used.
+    template <class T1>
+    void initialize_with( const T1& t1) { rep = Rep(t1); }
+
+    //! initializes the representation after the constructor from 
+    //! \c USE_WITH_INITIALIZE_WITH has been used.
+    template <class T1, class T2>
+    void initialize_with( const T1& t1, const T2& t2) { rep = Rep(t1,t2); }
+
+    //! initializes the representation after the constructor from 
+    //! \c USE_WITH_INITIALIZE_WITH has been used.
+    template <class T1, class T2, class T3>
+    void initialize_with( const T1& t1, const T2& t2, const T3& t3) {
+        rep = Rep(t1,t2,t3);
+    }
+
+    //! initializes the representation after the constructor from 
+    //! \c USE_WITH_INITIALIZE_WITH has been used.
+    template <class T1, class T2, class T3, class T4>
+    void initialize_with( const T1& t1, const T2& t2, const T3& t3,
+                          const T4& t4) {
+        rep = Rep(t1,t2,t3,t4);
+    }
+
+    //! initializes the representation after the constructor from 
+    //! \c USE_WITH_INITIALIZE_WITH has been used.
+    template <class T1, class T2, class T3, class T4, class T5>
+    void initialize_with( const T1& t1, const T2& t2, const T3& t3,
+                          const T4& t4, const T5& t5) {
+        rep = Rep(t1,t2,t3,t4,t5);
+    }
+
+    //! initializes the representation after the constructor from 
+    //! \c USE_WITH_INITIALIZE_WITH has been used.
+    template <class T1, class T2, class T3, class T4, class T5, class T6>
+    void initialize_with( const T1& t1, const T2& t2, const T3& t3,
+                          const T4& t4, const T5& t5, const T6& t6) {
+        rep = Rep(t1,t2,t3,t4,t5,t6);
+    }
+
+    //! initializes the representation after the constructor from 
+    //! \c USE_WITH_INITIALIZE_WITH has been used.
+    template <class T1, class T2, class T3, class T4, class T5, class T6,
+              class T7>
+    void initialize_with( const T1& t1, const T2& t2, const T3& t3,
+                          const T4& t4, const T5& t5, const T6& t6,
+                          const T7& t7) {
+        rep = Rep(t1,t2,t3,t4,t5,t6,t7);
+    }
+
+    //! initializes the representation after the constructor from 
+    //! \c USE_WITH_INITIALIZE_WITH has been used.
+    template <class T1, class T2, class T3, class T4, class T5, class T6,
+              class T7, class T8>
+    void initialize_with( const T1& t1, const T2& t2, const T3& t3,
+                          const T4& t4, const T5& t5, const T6& t6,
+                          const T7& t7, const T8& t8) {
+        rep = Rep(t1,t2,t3,t4,t5,t6,t7,t8);
+    }
+
+    //! initializes the representation after the constructor from 
+    //! \c USE_WITH_INITIALIZE_WITH has been used.
+    template <class T1, class T2, class T3, class T4, class T5, class T6,
+              class T7, class T8, class T9>
+    void initialize_with( const T1& t1, const T2& t2, const T3& t3,
+                          const T4& t4, const T5& t5, const T6& t6,
+                          const T7& t7, const T8& t8, const T9& t9) {
+        rep = Rep(t1,t2,t3,t4,t5,t6,t7,t8,t9);
+    }
+
+public:
+    //! default constructor.
+    Handle_with_policy() {}
+
+    //! copy constructor.
+    Handle_with_policy(const Self& h) : rep( h.rep) {}
+
+    //! forwarding constructor passing its parameter to the representation
+    //! constructor.
+    template <class T1>
+    explicit Handle_with_policy( const T1& t) : rep( Rep(t)) {}
+
+    //! forwarding constructor passing its parameters to the representation
+    //! constructor.
+    template <class T1, class T2>
+    Handle_with_policy( const T1& t1, const T2& t2) : rep( Rep(t1,t2)) {}
+
+    //! forwarding constructor passing its parameters to the representation
+    //! constructor.
+    template <class T1, class T2, class T3>
+    Handle_with_policy( const T1& t1, const T2& t2, const T3& t3) : rep( Rep(t1,t2,t3)) {}
+
+    //! forwarding constructor passing its parameters to the representation
+    //! constructor.
+    template <class T1, class T2, class T3, class T4>
+    Handle_with_policy( const T1& t1, const T2& t2, const T3& t3, const T4& t4) 
+        : rep( Rep( t1, t2, t3, t4)) {}
+
+    //! forwarding constructor passing its parameters to the representation
+    //! constructor.
+    template <class T1, class T2, class T3, class T4, class T5>
+    Handle_with_policy( const T1& t1, const T2& t2, const T3& t3, const T4& t4,
+            const T5& t5) 
+        : rep( Rep( t1, t2, t3, t4, t5)) {}
+
+    //! forwarding constructor passing its parameters to the representation
+    //! constructor.
+    template <class T1, class T2, class T3, class T4, class T5, class T6>
+    Handle_with_policy( const T1& t1, const T2& t2, const T3& t3, const T4& t4,
+            const T5& t5, const T6& t6) 
+        : rep( Rep( t1, t2, t3, t4, t5, t6)) {}
+
+    //! forwarding constructor passing its parameters to the representation
+    //! constructor.
+    template <class T1, class T2, class T3, class T4, class T5, class T6, 
+              class T7>
+    Handle_with_policy( const T1& t1, const T2& t2, const T3& t3, const T4& t4,
+            const T5& t5, const T6& t6, const T7& t7) 
+        : rep( Rep( t1, t2, t3, t4, t5, t6, t7)) {}
+
+    //! forwarding constructor passing its parameters to the representation
+    //! constructor.
+    template <class T1, class T2, class T3, class T4, class T5, class T6, 
+              class T7, class T8>
+    Handle_with_policy( const T1& t1, const T2& t2, const T3& t3, const T4& t4,
+            const T5& t5, const T6& t6, const T7& t7, const T8& t8) 
+        : rep( Rep( t1, t2, t3, t4, t5, t6, t7, t8)) {}
+
+    //! forwarding constructor passing its parameters to the representation
+    //! constructor.
+    template <class T1, class T2, class T3, class T4, class T5, class T6, 
+              class T7, class T8, class T9>
+    Handle_with_policy( const T1& t1, const T2& t2, const T3& t3, const T4& t4,
+            const T5& t5, const T6& t6, const T7& t7, const T8& t8,
+            const T9& t9) 
+        : rep( Rep( t1, t2, t3, t4, t5, t6, t7, t8, t9)) {}
+
+    //! returns \c true if both share the same representation.
+    bool is_identical( const Self& h) const { return this == &h; }
+
+    //! returns a unique id value. Two handles share their representation
+    //! is their id values are identical.
+    Id_type id() const { return ptr() - static_cast<Handled_type const*>(0); }
+
+    //! returns \c false since the representation is not shared for
+    //! this specialization.
+    bool is_shared() const { return false; }
+
+    //! returns \c false since the representation is not forwarding for
+    //! this specialization.
+    bool is_forwarding() const { return false; }
+
+    //! returns \c 1 as the union size for this specialization.
+    int  union_size() const { return 1; }
+
+    // backwards compatible
+    bool identical( const Self& h) const { return is_identical(h); }
+
+#ifdef CGAL_HANDLE_WITH_POLICY_INTERNAL_TEST
+    // provide access to pointer for testing only!!
+    const Rep* test_ptr() const { return *rep; }
+    // provide access to pointer for testing only!!
+    bool test_identical_ptr( const Self& h) const { return this == &h; }
+#endif // CGAL_HANDLE_WITH_POLICY_INTERNAL_TEST
+
+#ifdef CGAL_USE_LEDA
+    LEDA_MEMORY( Self)
+#endif
+};
+
+template <class T, class HandlePolicy, class Allocator>
+inline bool identical(const Handle_with_policy<T,HandlePolicy,Allocator> &h1, const Handle_with_policy<T,HandlePolicy,Allocator> &h2) { return h1.is_identical(h2); }
+
+
+/*\brief
+ * This class' function call operator test whether one handle's \c id is
+ * less than the \c id of the other handle.
+ *
+ * "Less" is defined in terms of the second template argument,
+ * which defaults to \c std::less<Handle::Id_type>
+ */
+template <class Handle, class Less = std::less<typename Handle::Id_type> >
+class Handle_id_less_than {
+public:
+    //! result_type
+    typedef bool result_type;
+    //! type of first argument
+    typedef Handle first_argument_type;
+    //! type of second argument
+    typedef Handle second_argument_type;
+    //! returns \c true iff \c h1.id() < \c h2.id()
+    bool operator () (Handle h1, Handle h2) {
+        Less is_less;
+        return is_less(h1.id(), h2.id());
+    }
+    //! returns \c true iff \c h1.id() < \c h2.id()
+    bool operator () (Handle h1, Handle h2) const {
+        Less is_less;
+        return is_less(h1.id(), h2.id());
+    }
+};
+
+
+//@}
+
+} //namespace CGAL
+
+#endif // CGAL_HANDLE_WITH_POLICY_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Has_timestamp.h b/3rdparty/CGAL/include/CGAL/Has_timestamp.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Has_timestamp.h
rename to 3rdparty/CGAL/include/CGAL/Has_timestamp.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Hilbert_policy_tags.h b/3rdparty/CGAL/include/CGAL/Hilbert_policy_tags.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Hilbert_policy_tags.h
rename to 3rdparty/CGAL/include/CGAL/Hilbert_policy_tags.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Hilbert_sort_2.h b/3rdparty/CGAL/include/CGAL/Hilbert_sort_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Hilbert_sort_2.h
rename to 3rdparty/CGAL/include/CGAL/Hilbert_sort_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Hilbert_sort_3.h b/3rdparty/CGAL/include/CGAL/Hilbert_sort_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Hilbert_sort_3.h
rename to 3rdparty/CGAL/include/CGAL/Hilbert_sort_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Hilbert_sort_base.h b/3rdparty/CGAL/include/CGAL/Hilbert_sort_base.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Hilbert_sort_base.h
rename to 3rdparty/CGAL/include/CGAL/Hilbert_sort_base.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Hilbert_sort_d.h b/3rdparty/CGAL/include/CGAL/Hilbert_sort_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Hilbert_sort_d.h
rename to 3rdparty/CGAL/include/CGAL/Hilbert_sort_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Hilbert_sort_median_2.h b/3rdparty/CGAL/include/CGAL/Hilbert_sort_median_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Hilbert_sort_median_2.h
rename to 3rdparty/CGAL/include/CGAL/Hilbert_sort_median_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Hilbert_sort_median_3.h b/3rdparty/CGAL/include/CGAL/Hilbert_sort_median_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Hilbert_sort_median_3.h
rename to 3rdparty/CGAL/include/CGAL/Hilbert_sort_median_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Hilbert_sort_median_d.h b/3rdparty/CGAL/include/CGAL/Hilbert_sort_median_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Hilbert_sort_median_d.h
rename to 3rdparty/CGAL/include/CGAL/Hilbert_sort_median_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Hilbert_sort_middle_2.h b/3rdparty/CGAL/include/CGAL/Hilbert_sort_middle_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Hilbert_sort_middle_2.h
rename to 3rdparty/CGAL/include/CGAL/Hilbert_sort_middle_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Hilbert_sort_middle_3.h b/3rdparty/CGAL/include/CGAL/Hilbert_sort_middle_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Hilbert_sort_middle_3.h
rename to 3rdparty/CGAL/include/CGAL/Hilbert_sort_middle_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Hilbert_sort_middle_base.h b/3rdparty/CGAL/include/CGAL/Hilbert_sort_middle_base.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Hilbert_sort_middle_base.h
rename to 3rdparty/CGAL/include/CGAL/Hilbert_sort_middle_base.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Hilbert_sort_middle_d.h b/3rdparty/CGAL/include/CGAL/Hilbert_sort_middle_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Hilbert_sort_middle_d.h
rename to 3rdparty/CGAL/include/CGAL/Hilbert_sort_middle_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Hilbert_sort_on_sphere_3.h b/3rdparty/CGAL/include/CGAL/Hilbert_sort_on_sphere_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Hilbert_sort_on_sphere_3.h
rename to 3rdparty/CGAL/include/CGAL/Hilbert_sort_on_sphere_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Homogeneous.h b/3rdparty/CGAL/include/CGAL/Homogeneous.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Homogeneous.h
rename to 3rdparty/CGAL/include/CGAL/Homogeneous.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Homogeneous/Aff_transformationH2.h b/3rdparty/CGAL/include/CGAL/Homogeneous/Aff_transformationH2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Homogeneous/Aff_transformationH2.h
rename to 3rdparty/CGAL/include/CGAL/Homogeneous/Aff_transformationH2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Homogeneous/Aff_transformationH3.h b/3rdparty/CGAL/include/CGAL/Homogeneous/Aff_transformationH3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Homogeneous/Aff_transformationH3.h
rename to 3rdparty/CGAL/include/CGAL/Homogeneous/Aff_transformationH3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Homogeneous/CircleH2.h b/3rdparty/CGAL/include/CGAL/Homogeneous/CircleH2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Homogeneous/CircleH2.h
rename to 3rdparty/CGAL/include/CGAL/Homogeneous/CircleH2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Homogeneous/Data_accessorH2.h b/3rdparty/CGAL/include/CGAL/Homogeneous/Data_accessorH2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Homogeneous/Data_accessorH2.h
rename to 3rdparty/CGAL/include/CGAL/Homogeneous/Data_accessorH2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Homogeneous/DirectionH2.h b/3rdparty/CGAL/include/CGAL/Homogeneous/DirectionH2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Homogeneous/DirectionH2.h
rename to 3rdparty/CGAL/include/CGAL/Homogeneous/DirectionH2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Homogeneous/DirectionH3.h b/3rdparty/CGAL/include/CGAL/Homogeneous/DirectionH3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Homogeneous/DirectionH3.h
rename to 3rdparty/CGAL/include/CGAL/Homogeneous/DirectionH3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Homogeneous/Homogeneous_base.h b/3rdparty/CGAL/include/CGAL/Homogeneous/Homogeneous_base.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Homogeneous/Homogeneous_base.h
rename to 3rdparty/CGAL/include/CGAL/Homogeneous/Homogeneous_base.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Homogeneous/Iso_cuboidH3.h b/3rdparty/CGAL/include/CGAL/Homogeneous/Iso_cuboidH3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Homogeneous/Iso_cuboidH3.h
rename to 3rdparty/CGAL/include/CGAL/Homogeneous/Iso_cuboidH3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Homogeneous/Iso_rectangleH2.h b/3rdparty/CGAL/include/CGAL/Homogeneous/Iso_rectangleH2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Homogeneous/Iso_rectangleH2.h
rename to 3rdparty/CGAL/include/CGAL/Homogeneous/Iso_rectangleH2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Homogeneous/LineH2.h b/3rdparty/CGAL/include/CGAL/Homogeneous/LineH2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Homogeneous/LineH2.h
rename to 3rdparty/CGAL/include/CGAL/Homogeneous/LineH2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Homogeneous/PlaneH3.h b/3rdparty/CGAL/include/CGAL/Homogeneous/PlaneH3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Homogeneous/PlaneH3.h
rename to 3rdparty/CGAL/include/CGAL/Homogeneous/PlaneH3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Homogeneous/PointH2.h b/3rdparty/CGAL/include/CGAL/Homogeneous/PointH2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Homogeneous/PointH2.h
rename to 3rdparty/CGAL/include/CGAL/Homogeneous/PointH2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Homogeneous/PointH3.h b/3rdparty/CGAL/include/CGAL/Homogeneous/PointH3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Homogeneous/PointH3.h
rename to 3rdparty/CGAL/include/CGAL/Homogeneous/PointH3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Homogeneous/RayH3.h b/3rdparty/CGAL/include/CGAL/Homogeneous/RayH3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Homogeneous/RayH3.h
rename to 3rdparty/CGAL/include/CGAL/Homogeneous/RayH3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Homogeneous/SphereH3.h b/3rdparty/CGAL/include/CGAL/Homogeneous/SphereH3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Homogeneous/SphereH3.h
rename to 3rdparty/CGAL/include/CGAL/Homogeneous/SphereH3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Homogeneous/VectorH2.h b/3rdparty/CGAL/include/CGAL/Homogeneous/VectorH2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Homogeneous/VectorH2.h
rename to 3rdparty/CGAL/include/CGAL/Homogeneous/VectorH2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Homogeneous/VectorH3.h b/3rdparty/CGAL/include/CGAL/Homogeneous/VectorH3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Homogeneous/VectorH3.h
rename to 3rdparty/CGAL/include/CGAL/Homogeneous/VectorH3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Homogeneous/basic_constructionsH2.h b/3rdparty/CGAL/include/CGAL/Homogeneous/basic_constructionsH2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Homogeneous/basic_constructionsH2.h
rename to 3rdparty/CGAL/include/CGAL/Homogeneous/basic_constructionsH2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Homogeneous/basic_constructionsH3.h b/3rdparty/CGAL/include/CGAL/Homogeneous/basic_constructionsH3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Homogeneous/basic_constructionsH3.h
rename to 3rdparty/CGAL/include/CGAL/Homogeneous/basic_constructionsH3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Homogeneous/distance_predicatesH2.h b/3rdparty/CGAL/include/CGAL/Homogeneous/distance_predicatesH2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Homogeneous/distance_predicatesH2.h
rename to 3rdparty/CGAL/include/CGAL/Homogeneous/distance_predicatesH2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Homogeneous/distance_predicatesH3.h b/3rdparty/CGAL/include/CGAL/Homogeneous/distance_predicatesH3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Homogeneous/distance_predicatesH3.h
rename to 3rdparty/CGAL/include/CGAL/Homogeneous/distance_predicatesH3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Homogeneous/function_objects.h b/3rdparty/CGAL/include/CGAL/Homogeneous/function_objects.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Homogeneous/function_objects.h
rename to 3rdparty/CGAL/include/CGAL/Homogeneous/function_objects.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Homogeneous/predicates_on_directionsH2.h b/3rdparty/CGAL/include/CGAL/Homogeneous/predicates_on_directionsH2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Homogeneous/predicates_on_directionsH2.h
rename to 3rdparty/CGAL/include/CGAL/Homogeneous/predicates_on_directionsH2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Homogeneous/predicates_on_pointsH2.h b/3rdparty/CGAL/include/CGAL/Homogeneous/predicates_on_pointsH2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Homogeneous/predicates_on_pointsH2.h
rename to 3rdparty/CGAL/include/CGAL/Homogeneous/predicates_on_pointsH2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Homogeneous/predicates_on_pointsH3.h b/3rdparty/CGAL/include/CGAL/Homogeneous/predicates_on_pointsH3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Homogeneous/predicates_on_pointsH3.h
rename to 3rdparty/CGAL/include/CGAL/Homogeneous/predicates_on_pointsH3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Homogeneous_converter.h b/3rdparty/CGAL/include/CGAL/Homogeneous_converter.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Homogeneous_converter.h
rename to 3rdparty/CGAL/include/CGAL/Homogeneous_converter.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Homogeneous_d.h b/3rdparty/CGAL/include/CGAL/Homogeneous_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Homogeneous_d.h
rename to 3rdparty/CGAL/include/CGAL/Homogeneous_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Hyperbola_2.h b/3rdparty/CGAL/include/CGAL/Hyperbola_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Hyperbola_2.h
rename to 3rdparty/CGAL/include/CGAL/Hyperbola_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Hyperbola_ray_2.h b/3rdparty/CGAL/include/CGAL/Hyperbola_ray_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Hyperbola_ray_2.h
rename to 3rdparty/CGAL/include/CGAL/Hyperbola_ray_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Hyperbola_segment_2.h b/3rdparty/CGAL/include/CGAL/Hyperbola_segment_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Hyperbola_segment_2.h
rename to 3rdparty/CGAL/include/CGAL/Hyperbola_segment_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IEEE_754_unions.h b/3rdparty/CGAL/include/CGAL/IEEE_754_unions.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IEEE_754_unions.h
rename to 3rdparty/CGAL/include/CGAL/IEEE_754_unions.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Alpha_shape_3_VRML_2_ostream.h b/3rdparty/CGAL/include/CGAL/IO/Alpha_shape_3_VRML_2_ostream.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Alpha_shape_3_VRML_2_ostream.h
rename to 3rdparty/CGAL/include/CGAL/IO/Alpha_shape_3_VRML_2_ostream.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Arr_iostream.h b/3rdparty/CGAL/include/CGAL/IO/Arr_iostream.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Arr_iostream.h
rename to 3rdparty/CGAL/include/CGAL/IO/Arr_iostream.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Arr_text_formatter.h b/3rdparty/CGAL/include/CGAL/IO/Arr_text_formatter.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Arr_text_formatter.h
rename to 3rdparty/CGAL/include/CGAL/IO/Arr_text_formatter.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Arr_with_history_2_reader.h b/3rdparty/CGAL/include/CGAL/IO/Arr_with_history_2_reader.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Arr_with_history_2_reader.h
rename to 3rdparty/CGAL/include/CGAL/IO/Arr_with_history_2_reader.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Arr_with_history_2_writer.h b/3rdparty/CGAL/include/CGAL/IO/Arr_with_history_2_writer.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Arr_with_history_2_writer.h
rename to 3rdparty/CGAL/include/CGAL/IO/Arr_with_history_2_writer.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Arr_with_history_iostream.h b/3rdparty/CGAL/include/CGAL/IO/Arr_with_history_iostream.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Arr_with_history_iostream.h
rename to 3rdparty/CGAL/include/CGAL/IO/Arr_with_history_iostream.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Arr_with_history_text_formatter.h b/3rdparty/CGAL/include/CGAL/IO/Arr_with_history_text_formatter.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Arr_with_history_text_formatter.h
rename to 3rdparty/CGAL/include/CGAL/IO/Arr_with_history_text_formatter.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Arrangement_2_reader.h b/3rdparty/CGAL/include/CGAL/IO/Arrangement_2_reader.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Arrangement_2_reader.h
rename to 3rdparty/CGAL/include/CGAL/IO/Arrangement_2_reader.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Arrangement_2_writer.h b/3rdparty/CGAL/include/CGAL/IO/Arrangement_2_writer.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Arrangement_2_writer.h
rename to 3rdparty/CGAL/include/CGAL/IO/Arrangement_2_writer.h
diff --git a/3rdparty/CGAL/include/CGAL/IO/Color.h b/3rdparty/CGAL/include/CGAL/IO/Color.h
new file mode 100644
index 0000000..b4bacf1
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/IO/Color.h
@@ -0,0 +1,104 @@
+// Copyright (c) 1997
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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(s)     : Andreas Fabri
+
+#include <CGAL/config.h>
+
+#ifndef CGAL_COLOR_H
+#define CGAL_COLOR_H
+
+namespace CGAL {
+
+class Color {
+public:
+  Color(): _red(120), _green(120), _blue(120), _alpha(120) {}
+  Color(unsigned char red,
+	unsigned char green,
+	unsigned char blue,
+	unsigned char alpha = 120)
+    : _red(red), _green(green), _blue(blue), _alpha(alpha)
+  {}
+
+  unsigned char r() const {return _red;}
+  unsigned char g() const {return _green;}
+  unsigned char b() const {return _blue;}
+
+  unsigned char red() const {return _red;}
+  unsigned char green() const {return _green;}
+  unsigned char blue() const {return _blue;}
+  unsigned char alpha() const {return _alpha;}
+  void set_alpha(unsigned char a) {_alpha=a;}
+  bool operator==(const Color &c) const
+  {
+    return ( (red() == c.red()) &&
+             (green() == c.green()) &&
+             (blue() == c.blue()) );
+  }
+
+  bool operator!=(const Color &c) const
+  {
+    return !( (*this) == c);
+  }
+
+  Color& operator=(const Color &c)
+  {
+    _red = c.red();
+    _green = c.green();
+    _blue = c.blue();
+    _alpha = c.alpha();
+    return *this;
+  }
+
+private:
+  unsigned char _red;
+  unsigned char _green;
+  unsigned char _blue;
+  unsigned char _alpha;
+};
+
+#ifndef CGAL_HEADER_ONLY
+
+CGAL_EXPORT extern const Color BLACK  ;
+CGAL_EXPORT extern const Color WHITE  ;
+CGAL_EXPORT extern const Color GRAY   ;
+
+CGAL_EXPORT extern const Color RED    ;
+CGAL_EXPORT extern const Color GREEN  ;
+
+CGAL_EXPORT extern const Color DEEPBLUE;
+CGAL_EXPORT extern const Color BLUE   ;
+CGAL_EXPORT extern const Color PURPLE ;
+CGAL_EXPORT extern const Color VIOLET ;
+
+CGAL_EXPORT extern const Color ORANGE ;
+CGAL_EXPORT extern const Color YELLOW ;
+
+#endif // CGAL_HEADER_ONLY
+
+} //namespace CGAL
+
+#ifdef CGAL_HEADER_ONLY
+#include <CGAL/IO/Color_impl.h>
+#endif // CGAL_HEADER_ONLY
+
+#endif  // CGAL_COLOR_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Color_impl.h b/3rdparty/CGAL/include/CGAL/IO/Color_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Color_impl.h
rename to 3rdparty/CGAL/include/CGAL/IO/Color_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Complex_2_in_triangulation_3_file_writer.h b/3rdparty/CGAL/include/CGAL/IO/Complex_2_in_triangulation_3_file_writer.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Complex_2_in_triangulation_3_file_writer.h
rename to 3rdparty/CGAL/include/CGAL/IO/Complex_2_in_triangulation_3_file_writer.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Complex_2_in_triangulation_3_polyhedron_builder.h b/3rdparty/CGAL/include/CGAL/IO/Complex_2_in_triangulation_3_polyhedron_builder.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Complex_2_in_triangulation_3_polyhedron_builder.h
rename to 3rdparty/CGAL/include/CGAL/IO/Complex_2_in_triangulation_3_polyhedron_builder.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Complex_2_in_triangulation_3_to_vtk.h b/3rdparty/CGAL/include/CGAL/IO/Complex_2_in_triangulation_3_to_vtk.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Complex_2_in_triangulation_3_to_vtk.h
rename to 3rdparty/CGAL/include/CGAL/IO/Complex_2_in_triangulation_3_to_vtk.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Complex_3_in_triangulation_3_to_vtk.h b/3rdparty/CGAL/include/CGAL/IO/Complex_3_in_triangulation_3_to_vtk.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Complex_3_in_triangulation_3_to_vtk.h
rename to 3rdparty/CGAL/include/CGAL/IO/Complex_3_in_triangulation_3_to_vtk.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Dxf_bsop_reader.h b/3rdparty/CGAL/include/CGAL/IO/Dxf_bsop_reader.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Dxf_bsop_reader.h
rename to 3rdparty/CGAL/include/CGAL/IO/Dxf_bsop_reader.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Dxf_reader.h b/3rdparty/CGAL/include/CGAL/IO/Dxf_reader.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Dxf_reader.h
rename to 3rdparty/CGAL/include/CGAL/IO/Dxf_reader.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Dxf_reader_doubles.h b/3rdparty/CGAL/include/CGAL/IO/Dxf_reader_doubles.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Dxf_reader_doubles.h
rename to 3rdparty/CGAL/include/CGAL/IO/Dxf_reader_doubles.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Dxf_stream.h b/3rdparty/CGAL/include/CGAL/IO/Dxf_stream.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Dxf_stream.h
rename to 3rdparty/CGAL/include/CGAL/IO/Dxf_stream.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Dxf_variant_reader.h b/3rdparty/CGAL/include/CGAL/IO/Dxf_variant_reader.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Dxf_variant_reader.h
rename to 3rdparty/CGAL/include/CGAL/IO/Dxf_variant_reader.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Dxf_writer.h b/3rdparty/CGAL/include/CGAL/IO/Dxf_writer.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Dxf_writer.h
rename to 3rdparty/CGAL/include/CGAL/IO/Dxf_writer.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Fig_stream.h b/3rdparty/CGAL/include/CGAL/IO/Fig_stream.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Fig_stream.h
rename to 3rdparty/CGAL/include/CGAL/IO/Fig_stream.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Fig_stream_Conic_arc_2.h b/3rdparty/CGAL/include/CGAL/IO/Fig_stream_Conic_arc_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Fig_stream_Conic_arc_2.h
rename to 3rdparty/CGAL/include/CGAL/IO/Fig_stream_Conic_arc_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/File_avizo.h b/3rdparty/CGAL/include/CGAL/IO/File_avizo.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/File_avizo.h
rename to 3rdparty/CGAL/include/CGAL/IO/File_avizo.h
diff --git a/3rdparty/CGAL/include/CGAL/IO/File_binary_mesh_3.h b/3rdparty/CGAL/include/CGAL/IO/File_binary_mesh_3.h
new file mode 100644
index 0000000..442d1f0
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/IO/File_binary_mesh_3.h
@@ -0,0 +1,83 @@
+// Copyright (c) 2012  GeometryFactory Sarl (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
+// 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(s)     : Laurent Rineau
+
+#ifndef CGAL_IO_FILE_BINARY_MESH_3_H
+#define CGAL_IO_FILE_BINARY_MESH_3_H
+
+#include <iostream>
+#include <string>
+#include <limits>
+#include <CGAL/Mesh_3/io_signature.h>
+
+namespace CGAL {
+
+namespace Mesh_3 {
+
+template <class C3T3>
+bool
+save_binary_file(std::ostream& os,
+                 const C3T3& c3t3,
+                 bool binary = true)
+{
+  typedef typename C3T3::Triangulation::Geom_traits::FT FT;
+  if(binary) os << "binary ";
+  os << "CGAL c3t3 " << CGAL::Get_io_signature<C3T3>()() << "\n";
+  if(binary) {
+    CGAL::set_binary_mode(os);
+  } else {
+    CGAL::set_ascii_mode(os);
+    os.precision(std::numeric_limits<FT>::digits10+2);
+  }
+  return !!(os << c3t3);
+  // call operator!() twice, because operator bool() is C++11
+}
+
+template <class C3T3>
+bool load_binary_file(std::istream& is, C3T3& c3t3)
+{
+  std::string s;
+  is >> s;
+  if (s != "binary" ||
+      !(is >> s) ||
+      s != "CGAL" ||
+      !(is >> s) ||
+      s != "c3t3") 
+  {
+    return false;
+  }
+  std::getline(is, s);
+  if(s != "") {
+    if(s != std::string(" ") + CGAL::Get_io_signature<C3T3>()()) {
+      std::cerr << "load_binary_file:"
+                << "\n  expected format: " << CGAL::Get_io_signature<C3T3>()()
+                << "\n       got format:" << s << std::endl;
+      return false;
+    }
+  }
+  CGAL::set_binary_mode(is);
+  is >> c3t3;
+  return !!is;
+  // call operator!() twice, because operator bool() is C++11
+}
+
+} // end namespace Mesh_3
+} // end namespace CGAL
+
+#endif // CGAL_IO_FILE_BINARY_MESH_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/File_header_OFF.h b/3rdparty/CGAL/include/CGAL/IO/File_header_OFF.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/File_header_OFF.h
rename to 3rdparty/CGAL/include/CGAL/IO/File_header_OFF.h
diff --git a/3rdparty/CGAL/include/CGAL/IO/File_header_OFF_impl.h b/3rdparty/CGAL/include/CGAL/IO/File_header_OFF_impl.h
new file mode 100644
index 0000000..0355e4d
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/IO/File_header_OFF_impl.h
@@ -0,0 +1,411 @@
+// Copyright (c) 1997
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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(s)     : Lutz Kettner  <kettner at mpi-sb.mpg.de>
+
+#ifdef CGAL_HEADER_ONLY
+#define CGAL_INLINE_FUNCTION inline
+#else
+#define CGAL_INLINE_FUNCTION
+#endif
+
+#include <CGAL/basic.h>
+#include <cstdlib>
+#include <cctype>
+#include <cstring>
+#include <iostream>
+#include <CGAL/IO/binary_file_io.h>
+#include <CGAL/IO/File_header_OFF.h>
+#include <algorithm>
+#include <boost/cstdint.hpp>
+
+namespace CGAL {
+
+CGAL_INLINE_FUNCTION
+File_header_OFF::File_header_OFF( bool verbose)
+:   File_header_extended_OFF( verbose),
+    n_vertices(0),
+    n_facets(0),
+    m_skel(false),
+    m_binary(false),
+    m_no_comments(false),
+    m_offset(0),
+    m_colors(false),
+    m_normals(false),
+    m_tag4(false),
+    m_tagDim(false),
+    m_dim(3)
+{}
+CGAL_INLINE_FUNCTION
+File_header_OFF::File_header_OFF(
+                     bool binary, bool noc, bool skel, bool verbose)
+:   File_header_extended_OFF( verbose),
+    n_vertices(0),
+    n_facets(0),
+    m_skel(skel),
+    m_binary(binary),
+    m_no_comments(noc),
+    m_offset(0),
+    m_colors(false),
+    m_normals(false),
+    m_tag4(false),
+    m_tagDim(false),
+    m_dim(3)
+{}
+//CGAL_INLINE_FUNCTION
+//File_header_OFF::File_header_OFF( int v, int h, int f,
+//                                          bool verbose)
+//:   File_header_extended_OFF( verbose),
+//    n_vertices(v),
+//    n_facets(f),
+//    m_skel(false),
+//    m_binary(false),
+//    m_no_comments(false),
+//    m_offset(0),
+//    m_colors(false),
+//    m_normals(false),
+//    m_tag4(false),
+//    m_tagDim(false),
+//    m_dim(3)
+//{
+//    set_halfedges(h);
+//}
+CGAL_INLINE_FUNCTION
+File_header_OFF::File_header_OFF( std::size_t v, std::size_t h, std::size_t f,
+                     bool binary, bool noc, bool skel, bool verbose)
+:   File_header_extended_OFF( verbose),
+    n_vertices(v),
+    n_facets(f),
+    m_skel(skel),
+    m_binary(binary),
+    m_no_comments(noc),
+    m_offset(0),
+    m_colors(false),
+    m_normals(false),
+    m_tag4(false),
+    m_tagDim(false),
+    m_dim(3)
+{
+    set_halfedges(h);
+}
+CGAL_INLINE_FUNCTION
+File_header_OFF::File_header_OFF(
+                     const File_header_extended_OFF& ext_header)
+:   File_header_extended_OFF( ext_header),
+    n_vertices(0),
+    n_facets(0),
+    m_skel(false),
+    m_binary(false),
+    m_no_comments(false),
+    m_offset(0),
+    m_colors(false),
+    m_normals(false),
+    m_tag4(false),
+    m_tagDim(false),
+    m_dim(3)
+{}
+CGAL_INLINE_FUNCTION
+File_header_OFF::File_header_OFF(
+                     const File_header_extended_OFF& ext_header,
+                     bool binary, bool noc, bool skel)
+:   File_header_extended_OFF( ext_header),
+    n_vertices(0),
+    n_facets(0),
+    m_skel(skel),
+    m_binary(binary),
+    m_no_comments(noc),
+    m_offset(0),
+    m_colors(false),
+    m_normals(false),
+    m_tag4(false),
+    m_tagDim(false),
+    m_dim(3)
+{}
+CGAL_INLINE_FUNCTION
+File_header_OFF::File_header_OFF(
+                                 std::size_t v, std::size_t h, std::size_t f,
+                     const File_header_extended_OFF& ext_header)
+:   File_header_extended_OFF( ext_header),
+    n_vertices(v),
+    n_facets(f),
+    m_skel(false),
+    m_binary(false),
+    m_no_comments(false),
+    m_offset(0),
+    m_colors(false),
+    m_normals(false),
+    m_tag4(false),
+    m_tagDim(false),
+    m_dim(3)
+{
+    set_halfedges(h);
+}
+CGAL_INLINE_FUNCTION
+File_header_OFF::File_header_OFF(
+                                 std::size_t v, std::size_t h, std::size_t f,
+                     const File_header_extended_OFF& ext_header,
+                     bool binary, bool noc, bool skel)
+:   File_header_extended_OFF( ext_header),
+    n_vertices(v),
+    n_facets(f),
+    m_skel(skel),
+    m_binary(binary),
+    m_no_comments(noc),
+    m_offset(0),
+    m_colors(false),
+    m_normals(false),
+    m_tag4(false),
+    m_tagDim(false),
+    m_dim(3)
+{
+    set_halfedges(h);
+}
+
+CGAL_INLINE_FUNCTION
+File_header_OFF& File_header_OFF::
+operator+=( const File_header_OFF& header) {
+    (File_header_extended_OFF&)(*this) = header;
+    n_vertices += header.n_vertices;
+    n_facets   += header.n_facets;
+    return *this;
+}
+
+// Write header.
+CGAL_INLINE_FUNCTION
+std::ostream& operator<<( std::ostream& out, const File_header_OFF& h) {
+    if ( h.comments()) {
+        out << "# Output of a CGAL tool\n";
+        out << static_cast<const File_header_extended_OFF&>( h);
+    }
+    if ( h.has_normals())
+        out << 'N';
+    if ( h.skel())
+        out << "SKEL";
+    else
+        out << "OFF";
+    if ( h.binary()) {
+        out << " BINARY\n";
+        I_Binary_write_big_endian_integer32( out, static_cast<int>(h.size_of_vertices()));
+        I_Binary_write_big_endian_integer32( out, static_cast<int>(h.size_of_facets()));
+        if ( h.off())
+            I_Binary_write_big_endian_integer32( out, 0);
+    } else {
+        out << '\n';
+        out << h.size_of_vertices() << ' '<< h.size_of_facets();
+        if ( h.off())
+            out << " 0";
+        if ( h.comments()) {
+            out << "\n\n# " << h.size_of_vertices() << " vertices\n";
+            out << "# ------------------------------------------\n";
+        }
+        out << std::endl;
+    }
+    return out;
+}
+
+// Scan header. Marks streams badbit if not in SKEL format nor in OFF.
+CGAL_INLINE_FUNCTION
+std::istream& operator>>( std::istream& in, File_header_OFF& h) {
+    // read in the first character and scan for comments, `OFF', or `NOFF',
+    // or `SKEL', or `4SKEL'.
+    h.set_off_header( false);
+    char c;
+    while ( (in >> c) && c == '#') {
+        if ( in.get(c) && c == 'C' &&
+             in.get(c) && c == 'B' &&
+             in.get(c) && c == 'P') {
+            in >> static_cast<File_header_extended_OFF&>( h);
+        } else if ( c != '\n')
+            in >> skip_until_EOL;
+    }
+    if ( ! in)
+        return in;
+    h.set_skel( false);
+    h.set_binary( false);
+    h.set_index_offset( 1);
+    h.set_colors( false);
+    h.set_normals( false);
+    h.set_homogeneous( false);
+    h.set_dimensional( false);
+    h.set_dimension( 3);
+
+    const int max_keyword = 42;
+    char keyword[max_keyword] = "";
+    int i = 0;
+    keyword[i++] = c;
+    while( i < max_keyword - 1 && in.get(c) && std::isalnum(c))
+        keyword[i++] = c;
+    keyword[i] = '\0';
+    if ( i < 2 || (std::isdigit(keyword[0]) && keyword[0] != '4')
+               || std::isdigit(keyword[1])) {
+        h.set_vertices( std::atoi( keyword));
+    } else {
+        h.set_index_offset( 0);
+        int j = 0;
+        if ( j < i && keyword[j] == 'C') {
+            h.set_colors( true);
+            j++;
+        }
+        if ( j < i && keyword[j] == 'N') {
+            h.set_normals( true);
+            j++;
+        }
+        if ( j < i && keyword[j] == '4') {
+            h.set_homogeneous( true);
+            j++;
+        }
+        if ( j < i && keyword[j] == 'n') {
+            h.set_dimensional( true);
+            j++;
+        }
+        if ( i-j != 3 || keyword[j]   != 'O'
+                      || keyword[j+1] != 'F'
+                      || keyword[j+2] != 'F') {
+            if ( i-j != 4 || keyword[j]   != 'S'
+                          || keyword[j+1] != 'K'
+                          || keyword[j+2] != 'E'
+                          || keyword[j+3] != 'L') {
+                in.clear( std::ios::badbit);
+                if ( h.verbose()) {
+                    std::cerr << " " << std::endl;
+                    std::cerr << "error: File_header_OFF: "
+                                  "wrong format: neither OFF nor SKEL."
+                              << std::endl;
+                }
+                return in;
+            } else {
+                h.set_skel( true);
+            }
+        }
+        in >> skip_comment_OFF >> c;
+        if ( std::isdigit(c)) {
+            in.putback(c);
+            int n;
+            in >> n;
+            h.set_vertices(n);
+        } else {
+            i = 0;
+            keyword[i++] = c;
+            while( i < max_keyword - 1 && in.get(c) &&
+                   std::isalnum(c))
+                keyword[i++] = c;
+            keyword[i] = '\0';
+            if ( std::strcmp( keyword, "BINARY") == 0) {
+                h.set_binary( true);
+                if ( c != '\n')
+                    in >> skip_until_EOL;
+            } else {
+                in.clear( std::ios::badbit);
+                if ( h.verbose()) {
+                    std::cerr << " " << std::endl;
+                    std::cerr << "error: File_header_OFF(): "
+                                 "wrong format: neither OFF nor SKEL."
+                              << std::endl;
+                }
+                return in;
+            }
+        }
+    }
+    // Read remaining size value(s).
+    int n_h;
+    if ( h.binary()) {
+        boost::int32_t a, b, c;
+        I_Binary_read_big_endian_integer32( in, a);
+        if ( h.n_dimensional()) {
+            h.set_dimension( a);
+            I_Binary_read_big_endian_integer32( in, a);
+        }
+        I_Binary_read_big_endian_integer32( in, b);
+        if ( h.off())
+            I_Binary_read_big_endian_integer32( in, c);
+        else
+            c = 0;
+        h.set_vertices( a);
+        if (b<0){
+          in.clear( std::ios::badbit );
+          if ( h.verbose()) {
+              std::cerr << " " << std::endl;
+              std::cerr << "error: File_header_OFF(): File contains < 0 facets."
+                        << std::endl;
+          }
+          return in;
+        }
+        h.set_facets( b);
+        n_h = c;
+    } else {
+        int n;
+        if ( h.n_dimensional()) {
+            h.set_dimension( static_cast<int>(h.size_of_vertices()));
+            in >> n;
+            h.set_vertices(n);
+        }
+        in >> n;
+        if (n < 0){
+          in.clear( std::ios::badbit );
+          if ( h.verbose()) {
+              std::cerr << " " << std::endl;
+              std::cerr << "error: File_header_OFF(): File contains < 0 facets."
+                        << std::endl;
+          }
+          return in;
+        }
+        h.set_facets(n);
+        if ( h.off())
+            in >> n_h;
+        else
+            n_h = 0;
+    }
+    if ( n_h == 0)
+        h.set_index_offset( 0);
+    if ( ! in || h.size_of_vertices() <= 0 ) {
+        in.clear( std::ios::badbit);
+        if ( h.verbose()) {
+            std::cerr << " " << std::endl;
+            std::cerr << "error: File_header_OFF(): File contains <= 0 vertices."
+                      << std::endl;
+        }
+        return in;
+    }
+    if ( h.size_of_halfedges() == 0) {
+        // be careful, because border edges count twice
+        h.set_halfedges( 2 * n_h);
+        // check against the Eulerian equation for connected planar graphs.
+        // We do not know the number of holes we must represent as dummy
+        // facets and we do not know the genus of the surface.
+        // So we add 12 and a factor of 5 percent.
+        if (    h.size_of_halfedges() == 0
+             || h.size_of_halfedges() > double(h.size_of_vertices()
+                + h.size_of_facets() - 2 + 12) * 2.1
+             || h.size_of_halfedges() < (h.size_of_vertices()
+                + h.size_of_facets() - 2) * 2
+        )
+            h.set_halfedges( int( double(h.size_of_vertices() +
+                                         h.size_of_facets() - 2 + 12) * 2.1
+                                 )
+                            );
+    }
+    h.set_off_header( h.off());
+    return in;
+}
+
+} //namespace CGAL
+// EOF //
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/File_header_extended_OFF.h b/3rdparty/CGAL/include/CGAL/IO/File_header_extended_OFF.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/File_header_extended_OFF.h
rename to 3rdparty/CGAL/include/CGAL/IO/File_header_extended_OFF.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/File_header_extended_OFF_impl.h b/3rdparty/CGAL/include/CGAL/IO/File_header_extended_OFF_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/File_header_extended_OFF_impl.h
rename to 3rdparty/CGAL/include/CGAL/IO/File_header_extended_OFF_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/File_maya.h b/3rdparty/CGAL/include/CGAL/IO/File_maya.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/File_maya.h
rename to 3rdparty/CGAL/include/CGAL/IO/File_maya.h
diff --git a/3rdparty/CGAL/include/CGAL/IO/File_medit.h b/3rdparty/CGAL/include/CGAL/IO/File_medit.h
new file mode 100644
index 0000000..b879cef
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/IO/File_medit.h
@@ -0,0 +1,909 @@
+// Copyright (c) 2004-2006  INRIA Sophia-Antipolis (France).
+// Copyright (c) 2009  INRIA Sophia-Antipolis (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
+// 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(s)     : Laurent RINEAU, Stephane Tayeb
+
+#ifndef CGAL_IO_FILE_MEDIT_H
+#define CGAL_IO_FILE_MEDIT_H
+
+#include <CGAL/Mesh_3/config.h>
+
+#include <iostream>
+#include <map>
+#include <set>
+#include <vector>
+#include <string>
+#include <CGAL/utility.h>
+
+#include <boost/unordered_map.hpp>
+
+namespace CGAL {
+
+namespace Mesh_3 {
+
+
+//-------------------------------------------------------
+// Needed in verbose mode
+//-------------------------------------------------------
+#ifdef CGAL_MESH_3_IO_VERBOSE
+template<class T>
+inline
+std::ostream&
+operator<<(std::ostream &os, const std::pair<T,T>& pair)
+{
+  return os << "<" << pair.first << "," << pair.second << ">";
+}
+#endif
+
+// -----------------------------------
+// Rebind_cell_pmap
+// -----------------------------------
+template <typename C3T3>
+class Rebind_cell_pmap
+{
+  typedef typename C3T3::Subdomain_index Subdomain_index;
+  typedef std::map<Subdomain_index,int> Subdomain_map;
+  typedef typename C3T3::Cell_handle Cell_handle;
+  typedef unsigned int size_type;
+
+public:
+  Rebind_cell_pmap(const C3T3& c3t3)
+    : r_c3t3_(c3t3)
+  {
+    typedef typename C3T3::Cells_in_complex_iterator Cell_iterator;
+
+    int first_index = 0;
+    int index_counter = first_index + 1;
+
+    for( Cell_iterator cell_it = r_c3t3_.cells_in_complex_begin();
+         cell_it != r_c3t3_.cells_in_complex_end();
+         ++cell_it)
+    {
+      // Add subdomain index in internal map if needed
+      if ( subdomain_map_.end() ==
+              subdomain_map_.find(r_c3t3_.subdomain_index(cell_it)) )
+      {
+        subdomain_map_.insert(std::make_pair(r_c3t3_.subdomain_index(cell_it),
+                                             index_counter));
+        ++index_counter;
+      }
+    }
+    
+    // Rebind indices in alphanumeric order
+    index_counter = first_index + 1;
+    for ( typename Subdomain_map::iterator mit = subdomain_map_.begin() ;
+          mit != subdomain_map_.end() ;
+          ++mit )
+    {
+      mit->second = index_counter++;
+    }
+
+#ifdef CGAL_MESH_3_IO_VERBOSE
+    std::cerr << "Nb of subdomains: " << subdomain_map_.size() << "\n";
+    std::cerr << "Subdomain mapping:\n\t" ;
+
+    typedef typename Subdomain_map::iterator Subdomain_map_iterator;
+    for ( Subdomain_map_iterator sub_it = subdomain_map_.begin() ;
+          sub_it != subdomain_map_.end() ;
+          ++sub_it )
+    {
+      std::cerr << "[" << (*sub_it).first << ":" << (*sub_it).second << "] ";
+    }
+    std::cerr << "\n";
+#endif
+  }
+
+  int subdomain_index(const Cell_handle& ch) const
+  {
+    return subdomain_index(r_c3t3_.subdomain_index(ch));
+  }
+
+  size_type subdomain_number() const
+  {
+    return subdomain_map_.size();
+  }
+
+private:
+  int subdomain_index(const Subdomain_index& index) const
+  {
+    typedef typename Subdomain_map::const_iterator Smi;
+    Smi elt_it = subdomain_map_.find(index);
+    if ( elt_it != subdomain_map_.end() )
+      return elt_it->second;
+    else
+      return -1;
+  }
+  
+private:
+  const C3T3& r_c3t3_;
+  Subdomain_map subdomain_map_;
+};
+  
+// Accessor  
+template <typename C3T3>
+int
+get(const Rebind_cell_pmap<C3T3>& cmap,
+    const typename C3T3::Cell_handle& ch)
+{
+  return cmap.subdomain_index(ch);
+}
+
+template <typename C3T3>
+unsigned int get_size(const Rebind_cell_pmap<C3T3>& cmap)
+{
+  return cmap.subdomain_number();
+}
+  
+
+// -----------------------------------
+// No_rebind_cell_pmap
+// -----------------------------------
+template <typename C3T3>
+class No_rebind_cell_pmap
+{
+  typedef typename C3T3::Subdomain_index Subdomain_index;
+  typedef typename C3T3::Cell_handle Cell_handle;
+  typedef unsigned int size_type;
+  
+public:
+  No_rebind_cell_pmap(const C3T3& c3t3)
+    : r_c3t3_(c3t3) {}
+  
+  int subdomain_index(const Cell_handle& ch) const
+  {
+    return static_cast<int>(r_c3t3_.subdomain_index(ch));
+  }
+  
+  size_type subdomain_number() const
+  {
+    typedef typename C3T3::Cells_in_complex_iterator Cell_iterator;
+    std::set<Subdomain_index> subdomain_set;
+    
+    for( Cell_iterator cell_it = r_c3t3_.cells_in_complex_begin();
+        cell_it != r_c3t3_.cells_in_complex_end();
+        ++cell_it)
+    {
+      // Add subdomain index in set if new
+      if ( subdomain_set.end() == subdomain_set.find(subdomain_index(cell_it)) )
+      {
+        subdomain_set.insert(subdomain_index(cell_it));
+      }
+    }
+    
+    return subdomain_set.size();
+  }
+  
+private:
+  const C3T3& r_c3t3_;
+};
+  
+// Accessor  
+template <typename C3T3>
+int
+get(const No_rebind_cell_pmap<C3T3>& cmap,
+    const typename C3T3::Cell_handle& ch)
+{
+  return cmap.subdomain_index(ch);
+}
+  
+  
+// -----------------------------------
+// Rebind_facet_pmap
+// -----------------------------------
+template <typename C3T3, typename Cell_pmap>
+class Rebind_facet_pmap
+{
+  typedef typename C3T3::Surface_patch_index Surface_patch_index;
+  typedef std::map<Surface_patch_index,int> Surface_map;
+  typedef typename C3T3::Facet Facet;
+  typedef unsigned int size_type;
+  
+public:
+  Rebind_facet_pmap(const C3T3& c3t3, const Cell_pmap& cell_pmap)
+    : r_c3t3_(c3t3)
+    , cell_pmap_(cell_pmap)
+  {
+    typedef typename C3T3::Facets_in_complex_iterator Facet_iterator;
+    
+    int first_index = 1;
+    int index_counter = first_index;
+    
+    for( Facet_iterator facet_it = r_c3t3_.facets_in_complex_begin();
+        facet_it != r_c3t3_.facets_in_complex_end();
+        ++facet_it)
+    {
+      // Add surface index in internal map if needed
+      if ( surface_map_.end() ==
+          surface_map_.find(c3t3.surface_patch_index((*facet_it).first,
+                                                     (*facet_it).second)) )
+      {
+        surface_map_.insert(std::make_pair(r_c3t3_.surface_patch_index(*facet_it),
+                                           index_counter));
+        ++index_counter;
+      }
+    }
+    
+    // Find cell_pmap_ unused indices
+    typedef typename C3T3::Cells_in_complex_iterator Cell_iterator;
+    std::set<int> cell_label_set;
+    
+    for( Cell_iterator cell_it = r_c3t3_.cells_in_complex_begin();
+        cell_it != r_c3t3_.cells_in_complex_end();
+        ++cell_it)
+    {
+      // Add subdomain index in set if new
+      if ( cell_label_set.end()
+          == cell_label_set.find(get(cell_pmap_,cell_it)) )
+      {
+        cell_label_set.insert(get(cell_pmap_,cell_it));
+      }
+    }
+    
+    // Rebind indices
+    index_counter = get_first_unused_label(cell_label_set,first_index);
+    for ( typename Surface_map::iterator mit = surface_map_.begin() ;
+         mit != surface_map_.end() ;
+         ++mit )
+    {
+      mit->second = index_counter++;
+      index_counter = get_first_unused_label(cell_label_set,index_counter);
+    }
+    
+#ifdef CGAL_MESH_3_IO_VERBOSE
+    std::cerr << "Nb of surface patches: " << surface_map_.size() << "\n";
+    std::cerr << "Surface mapping:\n\t" ;
+    
+    typedef typename Surface_map::iterator Surface_map_iterator;
+    for ( Surface_map_iterator surf_it = surface_map_.begin() ;
+         surf_it != surface_map_.end() ;
+         ++surf_it )
+    {
+      std::cerr << "[" << (*surf_it).first
+      << ":" << (*surf_it).second << "] ";
+    }
+    std::cerr << "\n";
+#endif
+  }
+  
+  int surface_index(const Facet& f) const
+  {
+    return surface_index(r_c3t3_.surface_patch_index(f));
+  }
+  
+  size_type surface_number() const
+  {
+    return surface_map_.size();
+  }
+  
+private:
+  int surface_index(const Surface_patch_index& index) const
+  {
+    typedef typename Surface_map::const_iterator Smi;
+    Smi elt_it = surface_map_.find(index);
+    if ( elt_it != surface_map_.end() )
+      return elt_it->second;
+    else
+      return -1;
+  }
+  
+  int get_first_unused_label(const std::set<int>& label_set,
+                             int search_start) const
+  {
+    while ( label_set.end() != label_set.find(search_start) )
+      ++search_start;
+    
+    return search_start;
+  }
+  
+private:
+  const C3T3& r_c3t3_;
+  const Cell_pmap& cell_pmap_;
+  Surface_map surface_map_;
+};
+
+  
+// Accessors
+template <typename C3T3, typename Cell_pmap>
+int
+get(const Rebind_facet_pmap<C3T3,Cell_pmap>& fmap,
+    const typename C3T3::Facet& f)
+{
+  return fmap.surface_index(f);
+}
+  
+template <typename C3T3, typename Cell_pmap>
+unsigned int
+get_size(const Rebind_facet_pmap<C3T3,Cell_pmap>& fmap,
+         const typename C3T3::Facet& f)
+{
+  return fmap.surface_number(f);
+}
+
+  
+// -----------------------------------
+// No_rebind_facet_pmap
+// -----------------------------------
+template <typename C3T3, typename Cell_pmap>
+class No_rebind_facet_pmap
+{
+  typedef typename C3T3::Surface_patch_index Surface_patch_index;
+  typedef typename C3T3::Facet Facet;
+  typedef unsigned int size_type;
+  
+public:
+  No_rebind_facet_pmap(const C3T3& c3t3, const Cell_pmap& /*cell_pmap*/)
+    : r_c3t3_(c3t3) {}
+
+  int surface_index(const Facet& f) const
+  {
+    return static_cast<int>(r_c3t3_.surface_patch_index(f));
+  }
+  
+private:
+  const C3T3& r_c3t3_;
+};
+
+
+// Accessors
+template <typename C3T3, typename Cell_pmap>
+int
+get(const No_rebind_facet_pmap<C3T3,Cell_pmap>& fmap,
+    const typename C3T3::Facet& f)
+{
+return fmap.surface_index(f);
+}
+
+// -----------------------------------
+// No_rebind_facet_pmap_first
+// -----------------------------------
+template <typename C3T3, typename Cell_pmap>
+class No_rebind_facet_pmap_first
+{
+  typedef typename C3T3::Surface_patch_index Surface_patch_index;
+  typedef typename C3T3::Facet Facet;
+  typedef unsigned int size_type;
+  
+public:
+  No_rebind_facet_pmap_first(const C3T3& c3t3, const Cell_pmap& /*cell_pmap*/)
+    : r_c3t3_(c3t3) {}
+  
+  int surface_index(const Facet& f) const
+  {
+    return static_cast<int>(r_c3t3_.surface_patch_index(f).first);
+  }
+  
+private:
+  const C3T3& r_c3t3_;
+};
+
+
+// Accessors
+template <typename C3T3, typename Cell_pmap>
+int
+get(const No_rebind_facet_pmap_first<C3T3,Cell_pmap>& fmap,
+  const typename C3T3::Facet& f)
+{
+  return fmap.surface_index(f);
+}
+  
+  
+// -----------------------------------
+// No_rebind_facet_pmap_second
+// -----------------------------------
+template <typename C3T3, typename Cell_pmap>
+class No_rebind_facet_pmap_second
+{
+  typedef typename C3T3::Surface_patch_index Surface_patch_index;
+  typedef typename C3T3::Facet Facet;
+  typedef unsigned int size_type;
+  
+public:
+  No_rebind_facet_pmap_second(const C3T3& c3t3, const Cell_pmap& /*cell_pmap*/)
+  : r_c3t3_(c3t3) {}
+  
+  int surface_index(const Facet& f) const
+  {
+    return static_cast<int>(r_c3t3_.surface_patch_index(f).second);
+  }
+  
+private:
+  const C3T3& r_c3t3_;
+};
+
+
+// Accessors
+template <typename C3T3, typename Cell_pmap>
+int
+get(const No_rebind_facet_pmap_second<C3T3,Cell_pmap>& fmap,
+    const typename C3T3::Facet& f)
+{
+  return fmap.surface_index(f);
+}
+  
+  
+  
+// -----------------------------------
+// No_patch_facet_pmap_first
+// -----------------------------------
+template <typename C3T3, typename Cell_pmap>
+class No_patch_facet_pmap_first
+{
+  typedef typename C3T3::Surface_patch_index Surface_patch_index;
+  typedef typename C3T3::Facet Facet;
+  typedef typename C3T3::Cell_handle Cell_handle;
+  
+public:
+  No_patch_facet_pmap_first(const C3T3&, const Cell_pmap& cell_pmap)
+    : cell_pmap_(cell_pmap) { }
+  
+  int surface_index(const Facet& f) const
+  {
+    Cell_handle c1 = f.first;
+    Cell_handle c2 = c1->neighbor(f.second);
+    
+    int label1 = get(cell_pmap_,c1);
+    int label2 = get(cell_pmap_,c2);
+    
+    if ( 0 == label1 || -1 == label1 )
+      label1 = label2;
+    if ( 0 == label2 || -1 == label2 )
+      label2 = label1;
+    
+    return (std::min)(label1,label2);
+  }
+  
+private:
+  const Cell_pmap& cell_pmap_;
+};
+
+// Accessors 
+template <typename C3T3, typename Cell_pmap>
+int
+get(const No_patch_facet_pmap_first<C3T3,Cell_pmap>& fmap,
+    const typename C3T3::Facet& f)
+{
+  return fmap.surface_index(f);
+}
+
+// -----------------------------------
+// No_patch_facet_pmap_second
+// -----------------------------------
+template <typename C3T3, typename Cell_pmap>
+class No_patch_facet_pmap_second
+{
+  typedef typename C3T3::Surface_patch_index Surface_patch_index;
+  typedef typename C3T3::Facet Facet;
+  typedef typename C3T3::Cell_handle Cell_handle;
+  
+public:
+  No_patch_facet_pmap_second(const C3T3&, const Cell_pmap& cell_pmap)
+    : cell_pmap_(cell_pmap) { }
+  
+  int surface_index(const Facet& f) const
+  {
+    Cell_handle c1 = f.first;
+    Cell_handle c2 = c1->neighbor(f.second);
+    
+    int label1 = get(cell_pmap_,c1);
+    int label2 = get(cell_pmap_,c2);
+    
+    if ( 0 == label1 || -1 == label1 )
+      label1 = label2;
+    if ( 0 == label2 || -1 == label2 )
+      label2 = label1;
+    
+    return (std::max)(label1,label2);
+  }
+  
+private:
+  const Cell_pmap& cell_pmap_;
+};
+
+// Accessors 
+template <typename C3T3, typename Cell_pmap>
+int
+get(const No_patch_facet_pmap_second<C3T3,Cell_pmap>& fmap,
+    const typename C3T3::Facet& f)
+{
+  return fmap.surface_index(f);
+}
+  
+  
+// -----------------------------------
+// Default_vertex_index_pmap
+// ----------------------------------- 
+template <typename C3T3, typename Cell_pmap, typename Facet_pmap>
+class Default_vertex_pmap
+{
+  typedef typename C3T3::Surface_patch_index Surface_patch_index;
+  typedef typename C3T3::Subdomain_index Subdomain_index;
+  typedef typename C3T3::Index Index;
+  typedef typename C3T3::Vertex_handle Vertex_handle;
+  typedef typename C3T3::Cell_handle Cell_handle;
+  typedef typename C3T3::Facet Facet;
+
+public:
+  Default_vertex_pmap(const C3T3& c3t3,
+                      const Cell_pmap& c_pmap,
+                      const Facet_pmap& f_pmap)
+    : c_pmap_(c_pmap)
+    , f_pmap_(f_pmap)
+    , r_c3t3_(c3t3)
+    , edge_index_(0) {}
+
+  int index(const Vertex_handle& vh) const
+  {
+    switch ( r_c3t3_.in_dimension(vh) )
+    {
+    case 2:
+      {
+        // Check if each incident surface facet of vh has the same surface index
+        typename std::vector<Facet> facets;
+        r_c3t3_.triangulation().finite_incident_facets(
+            vh, std::back_inserter(facets));
+
+        if ( facets.begin() == facets.end() )
+          return -1;
+
+        // Look for the first surface facet
+        typename std::vector<Facet>::iterator it_facet = facets.begin();
+        while ( ! r_c3t3_.is_in_complex(*it_facet) )
+        {
+          if ( ++it_facet == facets.end() )
+            return -1;
+        }
+
+        Surface_patch_index facet_index = r_c3t3_.surface_patch_index(*it_facet);
+        Facet facet = *it_facet;
+        ++it_facet;
+
+        for( ; it_facet != facets.end() ; ++it_facet)
+        {
+          // If another index is found, return value for edge vertice
+          if (   r_c3t3_.is_in_complex(*it_facet)
+              && !( facet_index == r_c3t3_.surface_patch_index(*it_facet) ) )
+            return edge_index_;
+        }
+
+        return get(f_pmap_,facet);
+      }
+      break;
+
+    case 3:
+      {
+        // Returns value of any incident cell
+        typename std::vector<Cell_handle> cells;
+        r_c3t3_.triangulation().finite_incident_cells(
+            vh,std::back_inserter(cells));
+
+        if ( cells.begin() != cells.end() )
+          return get(c_pmap_, *cells.begin());
+        else
+          return -1;
+      }
+      break;
+
+    default:
+      // should not happen
+      return -1;
+      break;
+    }
+  }
+
+private:
+  const Cell_pmap& c_pmap_;
+  const Facet_pmap& f_pmap_;
+  const C3T3& r_c3t3_;
+  const unsigned int edge_index_;
+};
+
+template <typename C3T3, typename Cell_pmap, typename Facet_pmap>
+int
+get(const Default_vertex_pmap<C3T3,Cell_pmap,Facet_pmap>& vmap,
+    const typename C3T3::Vertex_handle& vh)
+{
+  return vmap.index(vh);
+}
+
+
+// -----------------------------------
+// Null pmap
+// -----------------------------------  
+template <typename C3T3, typename Cell_pmap>
+struct Null_facet_pmap
+{
+  Null_facet_pmap(const C3T3&, const Cell_pmap&) {}
+};
+  
+template <typename C3T3, typename Cell_pmap>
+int get(const Null_facet_pmap<C3T3,Cell_pmap>&,
+        const typename C3T3::Facet&)
+{
+  return 0;
+}
+  
+template <typename C3T3, typename Cell_pmap, typename Facet_pmap>
+struct Null_vertex_pmap
+{
+  Null_vertex_pmap(const C3T3&, const Cell_pmap&, const Facet_pmap&) {}
+};
+  
+template <typename C3T3, typename Cell_pmap, typename Facet_pmap>
+int get(const Null_vertex_pmap<C3T3, Cell_pmap, Facet_pmap>&,
+        const typename C3T3::Vertex_handle&)
+{
+  return 0;
+}
+
+
+// -----------------------------------
+// Generator
+// -----------------------------------
+template <typename C3T3, bool rebind, bool no_patch>
+struct Medit_pmap_generator{};
+
+  
+template <typename C3T3>
+struct Medit_pmap_generator<C3T3, true, false>
+{
+  typedef Rebind_cell_pmap<C3T3>                            Cell_pmap;
+  typedef Rebind_facet_pmap<C3T3, Cell_pmap>                Facet_pmap;
+  typedef Null_facet_pmap<C3T3, Cell_pmap>                  Facet_pmap_twice;
+  typedef Default_vertex_pmap<C3T3, Cell_pmap, Facet_pmap>  Vertex_pmap;
+  
+  bool print_twice() { return false; }
+};
+  
+  
+template <typename C3T3>
+struct Medit_pmap_generator<C3T3, true, true>
+{
+  typedef Rebind_cell_pmap<C3T3>                            Cell_pmap;
+  typedef No_patch_facet_pmap_first<C3T3,Cell_pmap>         Facet_pmap;
+  typedef No_patch_facet_pmap_second<C3T3,Cell_pmap>        Facet_pmap_twice;
+  typedef Default_vertex_pmap<C3T3, Cell_pmap, Facet_pmap>  Vertex_pmap;
+  
+  bool print_twice() { return true; }
+};
+
+
+template <typename C3T3>
+struct Medit_pmap_generator<C3T3, false, true>
+{
+  typedef No_rebind_cell_pmap<C3T3>                         Cell_pmap;
+  typedef No_patch_facet_pmap_first<C3T3,Cell_pmap>         Facet_pmap;
+  typedef No_patch_facet_pmap_second<C3T3,Cell_pmap>        Facet_pmap_twice;
+  typedef Default_vertex_pmap<C3T3, Cell_pmap, Facet_pmap>  Vertex_pmap;
+  
+  bool print_twice() { return true; }
+};
+  
+template <typename C3T3>
+struct Medit_pmap_generator<C3T3, false, false>
+{
+  typedef No_rebind_cell_pmap<C3T3>                         Cell_pmap;
+  typedef Rebind_facet_pmap<C3T3,Cell_pmap>                 Facet_pmap;
+  typedef Null_facet_pmap<C3T3, Cell_pmap>                  Facet_pmap_twice;
+  typedef Null_vertex_pmap<C3T3, Cell_pmap, Facet_pmap>     Vertex_pmap;
+  
+  bool print_twice() { return false; }
+};
+
+  
+//-------------------------------------------------------
+// IO functions
+//-------------------------------------------------------
+
+
+  
+template <class C3T3, bool rebind, bool no_patch>
+void
+output_to_medit(std::ostream& os,
+                const C3T3& c3t3)
+{
+#ifdef CGAL_MESH_3_IO_VERBOSE
+  std::cerr << "Output to medit:\n";
+#endif
+  
+  typedef Medit_pmap_generator<C3T3,rebind,no_patch> Generator;
+  typedef typename Generator::Cell_pmap Cell_pmap;
+  typedef typename Generator::Facet_pmap Facet_pmap;
+  typedef typename Generator::Facet_pmap_twice Facet_pmap_twice;
+  typedef typename Generator::Vertex_pmap Vertex_pmap;
+  
+  Cell_pmap cell_pmap(c3t3);
+  Facet_pmap facet_pmap(c3t3,cell_pmap);
+  Facet_pmap_twice facet_pmap_twice(c3t3,cell_pmap);
+  Vertex_pmap vertex_pmap(c3t3,cell_pmap,facet_pmap);
+  
+  output_to_medit(os,
+                  c3t3,
+                  vertex_pmap,
+                  facet_pmap,
+                  cell_pmap,
+                  facet_pmap_twice,
+                  Generator().print_twice());
+  
+#ifdef CGAL_MESH_3_IO_VERBOSE
+  std::cerr << "done.\n";
+#endif
+}
+
+
+  
+template <class C3T3,
+          class Vertex_index_property_map,
+          class Facet_index_property_map,
+          class Facet_index_property_map_twice,
+          class Cell_index_property_map>
+void
+output_to_medit(std::ostream& os,
+                const C3T3& c3t3,
+                const Vertex_index_property_map& vertex_pmap,
+                const Facet_index_property_map& facet_pmap,
+                const Cell_index_property_map& cell_pmap,
+                const Facet_index_property_map_twice& facet_twice_pmap = Facet_index_property_map_twice(),
+                const bool print_each_facet_twice = false)
+{
+  typedef typename C3T3::Triangulation Tr;
+  typedef typename C3T3::Facets_in_complex_iterator Facet_iterator;
+  typedef typename C3T3::Cells_in_complex_iterator Cell_iterator;
+
+  typedef typename Tr::Finite_vertices_iterator Finite_vertices_iterator;
+  typedef typename Tr::Vertex_handle Vertex_handle;
+  typedef typename Tr::Point Point_3;
+
+  const Tr& tr = c3t3.triangulation();
+
+  //-------------------------------------------------------
+  // File output
+  //-------------------------------------------------------
+
+  //-------------------------------------------------------
+  // Header
+  //-------------------------------------------------------
+  os << std::setprecision(17);
+
+  os << "MeshVersionFormatted 1\n"
+     << "Dimension 3\n";
+
+
+  //-------------------------------------------------------
+  // Vertices
+  //-------------------------------------------------------
+  os << "Vertices\n" << tr.number_of_vertices() << '\n';
+
+  boost::unordered_map<Vertex_handle, int> V;
+  int inum = 1;
+  for( Finite_vertices_iterator vit = tr.finite_vertices_begin();
+       vit != tr.finite_vertices_end();
+       ++vit)
+  {
+    V[vit] = inum++;
+    Point_3 p = vit->point();
+    os << CGAL::to_double(p.x()) << ' '
+       << CGAL::to_double(p.y()) << ' '
+       << CGAL::to_double(p.z()) << ' '
+       << get(vertex_pmap, vit)
+       << '\n';
+  }
+
+  //-------------------------------------------------------
+  // Facets
+  //-------------------------------------------------------
+  typename C3T3::size_type number_of_triangles = c3t3.number_of_facets_in_complex();
+  
+  if ( print_each_facet_twice )
+    number_of_triangles += number_of_triangles;
+  
+  os << "Triangles\n" 
+     << number_of_triangles << '\n';
+
+  for( Facet_iterator fit = c3t3.facets_in_complex_begin();
+       fit != c3t3.facets_in_complex_end();
+       ++fit)
+  {
+    for (int i=0; i<4; i++)
+    {
+      if (i != fit->second)
+      {
+        const Vertex_handle& vh = (*fit).first->vertex(i);
+        os << V[vh] << ' ';
+      }
+    }
+    os << get(facet_pmap, *fit) << '\n';
+    
+    // Print triangle again if needed
+    if ( print_each_facet_twice )
+    {
+      for (int i=0; i<4; i++)
+      {
+        if (i != fit->second)
+        {
+          const Vertex_handle& vh = (*fit).first->vertex(i);
+          os << V[vh] << ' ';
+        }
+      }
+      os << get(facet_twice_pmap, *fit) << '\n';
+    }
+  }
+
+  //-------------------------------------------------------
+  // Tetrahedra
+  //-------------------------------------------------------
+  os << "Tetrahedra\n"
+     << c3t3.number_of_cells_in_complex() << '\n';
+
+  for( Cell_iterator cit = c3t3.cells_in_complex_begin() ;
+       cit != c3t3.cells_in_complex_end() ;
+       ++cit )
+  {
+    for (int i=0; i<4; i++)
+      os << V[cit->vertex(i)] << ' ';
+
+    os << get(cell_pmap, cit) << '\n';
+  }
+
+  //-------------------------------------------------------
+  // End
+  //-------------------------------------------------------
+  os << "End\n";
+
+} // end output_to_medit(...)
+
+} // end namespace Mesh_3
+
+  
+
+  
+/**
+ * @brief outputs mesh to medit format
+ * @param os the stream
+ * @param c3t3 the mesh
+ * @param rebind if true, labels of cells are rebinded into [1..nb_of_labels]
+ * @param show_patches if true, patches are labeled with different labels than
+ * cells. If false, each surface facet is written twice, using label of
+ * each adjacent cell.
+ */
+template <class C3T3>
+void
+output_to_medit(std::ostream& os,
+                const C3T3& c3t3,
+                bool rebind = false,
+                bool show_patches = false) 
+{
+  if ( rebind )
+  {
+    if ( show_patches )
+      Mesh_3::output_to_medit<C3T3,true,false>(os,c3t3);
+    else
+      Mesh_3::output_to_medit<C3T3,true,true>(os,c3t3);
+  }
+  else
+  {
+    if ( show_patches )
+      Mesh_3::output_to_medit<C3T3,false,false>(os,c3t3);
+    else
+      Mesh_3::output_to_medit<C3T3,false,true>(os,c3t3);
+  }
+}
+
+} // end namespace CGAL
+
+#endif // CGAL_IO_FILE_MEDIT_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/File_poly.h b/3rdparty/CGAL/include/CGAL/IO/File_poly.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/File_poly.h
rename to 3rdparty/CGAL/include/CGAL/IO/File_poly.h
diff --git a/3rdparty/CGAL/include/CGAL/IO/File_scanner_OFF.h b/3rdparty/CGAL/include/CGAL/IO/File_scanner_OFF.h
new file mode 100644
index 0000000..f8cb0e6
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/IO/File_scanner_OFF.h
@@ -0,0 +1,702 @@
+// Copyright (c) 1997  
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved. 
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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(s)     : Lutz Kettner  <kettner at mpi-sb.mpg.de>
+
+#ifndef CGAL_IO_FILE_SCANNER_OFF_H
+#define CGAL_IO_FILE_SCANNER_OFF_H 1
+
+#include <CGAL/basic.h>
+#include <cstddef>
+#include <CGAL/IO/binary_file_io.h>
+#include <CGAL/IO/File_header_OFF.h>
+#include <iostream>
+#include <sstream>
+#include <boost/cstdint.hpp>
+
+#include <CGAL/Point_3.h>
+#include <CGAL/Vector_3.h>
+
+namespace CGAL {
+
+class CGAL_EXPORT File_scanner_OFF : public File_header_OFF {
+    std::istream&  m_in;
+    bool           normals_read;
+    void skip_comment() { m_in >> skip_comment_OFF; }
+public:
+    File_scanner_OFF( std::istream& in, bool verbose = false)
+      : File_header_OFF(verbose), m_in(in), normals_read(false) {
+        in >> static_cast<File_header_OFF&>( *this);
+    }
+    File_scanner_OFF( std::istream& in, const File_header_OFF& header)
+      : File_header_OFF(header), m_in(in), normals_read(false) {}
+
+    std::istream& in() { return m_in; }
+
+    // The scan_vertex() routine is provided for multiple
+    // coordinate types to support parameterized polytopes.
+    void scan_vertex( float&  x, float&  y, float&  z) {
+        if ( binary()) {
+            I_Binary_read_big_endian_float32( m_in, x);
+            I_Binary_read_big_endian_float32( m_in, y);
+            I_Binary_read_big_endian_float32( m_in, z);
+            if ( is_homogeneous()) {
+                float w;
+                I_Binary_read_big_endian_float32( m_in, w);
+                x /= w;
+                y /= w;
+                z /= w;
+            }
+        } else {
+            skip_comment();
+            m_in >> iformat(x) >> iformat(y) >> iformat(z);
+            if ( is_homogeneous()) {
+                float w;
+                m_in >> iformat(w);
+                x /= w;
+                y /= w;
+                z /= w;
+            }
+        }
+    }
+    void scan_vertex( double& x, double& y, double& z) {
+        if ( binary()) {
+            float f;
+            I_Binary_read_big_endian_float32( m_in, f);
+            x = f;
+            I_Binary_read_big_endian_float32( m_in, f);
+            y = f;
+            I_Binary_read_big_endian_float32( m_in, f);
+            z = f;
+            if ( is_homogeneous()) {
+                I_Binary_read_big_endian_float32( m_in, f);
+                x /= f;
+                y /= f;
+                z /= f;
+            }
+        } else {
+            skip_comment();
+            m_in >> iformat(x) >> iformat(y) >> iformat(z);
+            if ( is_homogeneous()) {
+                double w;
+                m_in >> iformat(w);
+                x /= w;
+                y /= w;
+                z /= w;
+            }
+        }
+    }
+    void scan_vertex( int& x, int& y, int& z) {
+        if ( binary()) {
+            float fx, fy, fz;
+            I_Binary_read_big_endian_float32( m_in, fx);
+            I_Binary_read_big_endian_float32( m_in, fy);
+            I_Binary_read_big_endian_float32( m_in, fz);
+            if ( is_homogeneous()) {
+                float fw;
+                I_Binary_read_big_endian_float32( m_in, fw);
+                x = int( fx / fw);
+                y = int( fy / fw);
+                z = int( fz / fw);
+            } else {
+                x = int(fx);
+                y = int(fy);
+                z = int(fz);
+            }
+        } else {
+            skip_comment();
+            if ( is_homogeneous()) {
+                double fx, fy, fz, fw;
+                m_in >> iformat(fx) >> iformat(fy) >> iformat(fz) >> iformat(fw);
+                x = int( fx / fw);
+                y = int( fy / fw);
+                z = int( fz / fw);
+            } else {
+                double d;
+                m_in >> iformat(d);
+                x = int(d);
+                m_in >> iformat(d);
+                y = int(d);
+                m_in >> iformat(d);
+                z = int(d);
+            }
+        }
+    }
+
+    void scan_vertex( float&  x, float&  y, float&  z, float&  w) {
+        w = 1;
+        if ( binary()) {
+            I_Binary_read_big_endian_float32( m_in, x);
+            I_Binary_read_big_endian_float32( m_in, y);
+            I_Binary_read_big_endian_float32( m_in, z);
+            if ( is_homogeneous())
+                I_Binary_read_big_endian_float32( m_in, w);
+        } else {
+            skip_comment();
+            m_in >> iformat(x) >> iformat(y) >> iformat(z);
+            if ( is_homogeneous())
+              m_in >> iformat(w);
+        }
+    }
+    void scan_vertex( double& x, double& y, double& z, double& w) {
+        w = 1;
+        if ( binary()) {
+            float f;
+            I_Binary_read_big_endian_float32( m_in, f);
+            x = f;
+            I_Binary_read_big_endian_float32( m_in, f);
+            y = f;
+            I_Binary_read_big_endian_float32( m_in, f);
+            z = f;
+            if ( is_homogeneous()) {
+                I_Binary_read_big_endian_float32( m_in, f);
+                w = f;
+            }
+        } else {
+            skip_comment();
+            m_in >> iformat(x);
+            m_in >> iformat(y);
+            m_in >> iformat(z);
+            if ( is_homogeneous())
+              m_in >> iformat(w);
+        }
+    }
+    void scan_vertex( int& x, int& y, int& z, int& w) {
+        w = 1;
+        if ( binary()) {
+            float f;
+            I_Binary_read_big_endian_float32( m_in, f);
+            x = int(f);
+            I_Binary_read_big_endian_float32( m_in, f);
+            y = int(f);
+            I_Binary_read_big_endian_float32( m_in, f);
+            z = int(f);
+            if ( is_homogeneous()) {
+                I_Binary_read_big_endian_float32( m_in, f);
+                w = int(f);
+            }
+        } else {
+            skip_comment();
+            double d;
+            m_in >> iformat(d);
+            x = int(d);
+            m_in >> iformat(d);
+            y = int(d);
+            m_in >> iformat(d);
+            z = int(d);
+            if ( is_homogeneous()) {
+                m_in >> iformat(d);
+                w = int(d);
+            }
+        }
+    }
+
+    void scan_normal( float&  x, float&  y, float&  z) {
+        if ( has_normals()) {
+            normals_read = true;
+            if ( binary()) {
+                I_Binary_read_big_endian_float32( m_in, x);
+                I_Binary_read_big_endian_float32( m_in, y);
+                I_Binary_read_big_endian_float32( m_in, z);
+                if ( is_homogeneous()) {
+                    float w;
+                    I_Binary_read_big_endian_float32( m_in, w);
+                    x /= w;
+                    y /= w;
+                    z /= w;
+                }
+            } else {
+                m_in >> iformat(x) >> iformat(y) >> iformat(z);
+                if ( is_homogeneous()) {
+                    float w;
+                    m_in >> iformat(w);
+                    x /= w;
+                    y /= w;
+                    z /= w;
+                }
+            }
+        }
+    }
+    void scan_normal( double& x, double& y, double& z) {
+        if ( has_normals()) {
+            normals_read = true;
+            if ( binary()) {
+                float fx, fy, fz;
+                I_Binary_read_big_endian_float32( m_in, fx);
+                I_Binary_read_big_endian_float32( m_in, fy);
+                I_Binary_read_big_endian_float32( m_in, fz);
+                if ( is_homogeneous()) {
+                    float fw;
+                    I_Binary_read_big_endian_float32( m_in, fw);
+                    x = fx / fw;
+                    y = fy / fw;
+                    z = fz / fw;
+                } else {
+                    x = fx;
+                    y = fy;
+                    z = fz;
+                }
+            } else {
+                if ( is_homogeneous()) {
+                    float fx, fy, fz, fw;
+                    m_in >> iformat(fx) >> iformat(fy) >> iformat(fz) >> iformat(fw);
+                    x = fx / fw;
+                    y = fy / fw;
+                    z = fz / fw;
+                } else
+                    m_in >> iformat(x) >> iformat(y) >> iformat(z);
+            }
+        }
+    }
+    void scan_normal( int& x, int& y, int& z) {
+        if ( has_normals()) {
+            normals_read = true;
+            if ( binary()) {
+                float fx, fy, fz;
+                I_Binary_read_big_endian_float32( m_in, fx);
+                I_Binary_read_big_endian_float32( m_in, fy);
+                I_Binary_read_big_endian_float32( m_in, fz);
+                if ( is_homogeneous()) {
+                    float fw;
+                    I_Binary_read_big_endian_float32( m_in, fw);
+                    x = int( fx / fw);
+                    y = int( fy / fw);
+                    z = int( fz / fw);
+                } else {
+                    x = int(fx);
+                    y = int(fy);
+                    z = int(fz);
+                }
+            } else {
+                if ( is_homogeneous()) {
+                    float fx, fy, fz, fw;
+                    m_in >> iformat(fx) >> iformat(fy) >> iformat(fz) >> iformat(fw);
+                    x = int( fx / fw);
+                    y = int( fy / fw);
+                    z = int( fz / fw);
+                } else {
+                    double d;
+                    m_in >> iformat(d);
+                    x = int(d);
+                    m_in >> iformat(d);
+                    y = int(d);
+                    m_in >> iformat(d);
+                    z = int(d);
+                }
+            }
+        }
+    }
+
+    void scan_normal( float&  x, float&  y, float&  z, float&  w) {
+        w = 1;
+        if ( has_normals()) {
+            normals_read = true;
+            if ( binary()) {
+                I_Binary_read_big_endian_float32( m_in, x);
+                I_Binary_read_big_endian_float32( m_in, y);
+                I_Binary_read_big_endian_float32( m_in, z);
+                if ( is_homogeneous())
+                    I_Binary_read_big_endian_float32( m_in, w);
+            } else {
+                m_in >> iformat(x) >> iformat(y) >> iformat(z);
+                if ( is_homogeneous())
+                    m_in >> iformat(w);
+            }
+        }
+    }
+    void scan_normal( double& x, double& y, double& z, double& w) {
+        w = 1;
+        if ( has_normals()) {
+            normals_read = true;
+            if ( binary()) {
+                float f;
+                I_Binary_read_big_endian_float32( m_in, f);
+                x = f;
+                I_Binary_read_big_endian_float32( m_in, f);
+                y = f;
+                I_Binary_read_big_endian_float32( m_in, f);
+                z = f;
+                if ( is_homogeneous()) {
+                    I_Binary_read_big_endian_float32( m_in, f);
+                    w = f;
+                }
+            } else {
+                m_in >> iformat(x) >> iformat(y) >> iformat(z);
+                if ( is_homogeneous())
+                    m_in >> iformat(w);
+            }
+        }
+    }
+    void scan_normal( int& x, int& y, int& z, int& w) {
+        w = 1;
+        if ( has_normals()) {
+            normals_read = true;
+            if ( binary()) {
+                float f;
+                I_Binary_read_big_endian_float32( m_in, f);
+                x = int(f);
+                I_Binary_read_big_endian_float32( m_in, f);
+                y = int(f);
+                I_Binary_read_big_endian_float32( m_in, f);
+                z = int(f);
+                if ( is_homogeneous()) {
+                    I_Binary_read_big_endian_float32( m_in, f);
+                    w = int(f);
+                }
+            } else {
+                double d;
+                m_in >> iformat(d);
+                x = int(d);
+                m_in >> iformat(d);
+                y = int(d);
+                m_in >> iformat(d);
+                z = int(d);
+                if ( is_homogeneous()) {
+                    m_in >> iformat(d);
+                    w = int(d);
+                }
+            }
+        }
+    }
+
+    static const Color& get_indexed_color(int id)
+    {
+      static const Color color[149] = {
+        Color(255, 255, 255, 191),
+        Color(255, 255, 255, 191),
+        Color(255, 255, 255, 191),
+        Color(255, 255, 255, 191),
+        Color(255, 255, 255, 191),
+        Color(255, 255, 255, 191),
+        Color(178, 38, 25, 191),
+        Color(51, 51, 204, 191),
+        Color(229, 153, 5, 191),
+        Color(25, 76, 204, 191),
+        Color(25, 178, 51, 191),
+        Color(204, 204, 102, 191),
+        Color(178, 178, 0, 191),
+        Color(178, 0, 178, 191),
+        Color(0, 178, 178, 191),
+        Color(229, 0, 51, 191),
+        Color(51, 229, 0, 191),
+        Color(0, 51, 229, 191),
+        Color(191, 191, 191, 191),
+        Color(204, 102, 0, 191),
+        Color(204, 102, 0, 191),
+        Color(0, 102, 204, 191),
+        Color(0, 102, 204, 191),
+        Color(0, 204, 102, 191),
+        Color(0, 204, 102, 191),
+        Color(102, 0, 204, 191),
+        Color(102, 0, 204, 191),
+        Color(204, 0, 102, 191),
+        Color(204, 0, 102, 191),
+        Color(178, 127, 51, 191),
+        Color(178, 127, 51, 191),
+        Color(178, 178, 0, 191),
+        Color(178, 0, 178, 191),
+        Color(0, 178, 178, 191),
+        Color(229, 0, 0, 191),
+        Color(0, 229, 0, 191),
+        Color(0, 0, 229, 191),
+        Color(191, 191, 191, 191),
+        Color(204, 102, 0, 191),
+        Color(102, 204, 0, 191),
+        Color(0, 102, 204, 191),
+        Color(0, 204, 102, 191),
+        Color(102, 0, 204, 191),
+        Color(204, 0, 102, 191),
+        Color(178, 178, 0, 191),
+        Color(178, 0, 178, 191),
+        Color(0, 178, 178, 191),
+        Color(229, 0, 0, 191),
+        Color(0, 229, 0, 191),
+        Color(0, 0, 229, 191),
+        Color(191, 191, 191, 191),
+        Color(204, 102, 0, 191),
+        Color(102, 204, 0, 191),
+        Color(0, 102, 204, 191),
+        Color(0, 204, 102, 191),
+        Color(102, 0, 204, 191),
+        Color(204, 0, 102, 191),
+        Color(178, 178, 0, 191),
+        Color(178, 0, 178, 191),
+        Color(0, 178, 178, 191),
+        Color(229, 0, 0, 191),
+        Color(0, 229, 0, 191),
+        Color(0, 0, 229, 191),
+        Color(191, 191, 191, 191),
+        Color(204, 102, 0, 191),
+        Color(102, 204, 0, 191),
+        Color(0, 102, 204, 191),
+        Color(0, 204, 102, 191),
+        Color(102, 0, 204, 191),
+        Color(204, 0, 102, 191),
+        Color(255, 255, 255, 191),
+        Color(255, 255, 255, 191),
+        Color(255, 255, 255, 191),
+        Color(255, 255, 255, 191),
+        Color(255, 255, 255, 191),
+        Color(255, 255, 255, 191),
+        Color(12, 76, 25, 191),
+        Color(178, 2, 25, 191),
+        Color(51, 12, 153, 191),
+        Color(229, 229, 5, 191),
+        Color(0, 51, 102, 191),
+        Color(25, 102, 102, 191),
+        Color(204, 204, 204, 191),
+        Color(178, 178, 0, 191),
+        Color(178, 178, 0, 191),
+        Color(178, 0, 178, 191),
+        Color(178, 0, 178, 191),
+        Color(0, 178, 178, 191),
+        Color(0, 178, 178, 191),
+        Color(229, 0, 0, 191),
+        Color(229, 0, 0, 191),
+        Color(0, 229, 0, 191),
+        Color(0, 229, 0, 191),
+        Color(0, 0, 229, 191),
+        Color(0, 0, 229, 191),
+        Color(191, 191, 191, 191),
+        Color(191, 191, 191, 191),
+        Color(204, 102, 0, 191),
+        Color(204, 102, 0, 191),
+        Color(0, 102, 204, 191),
+        Color(0, 102, 204, 191),
+        Color(0, 204, 102, 191),
+        Color(0, 204, 102, 191),
+        Color(102, 0, 204, 191),
+        Color(102, 0, 204, 191),
+        Color(204, 0, 102, 191),
+        Color(204, 0, 102, 191),
+        Color(178, 127, 51, 191),
+        Color(178, 127, 51, 191),
+        Color(178, 178, 0, 191),
+        Color(178, 0, 178, 191),
+        Color(0, 178, 178, 191),
+        Color(229, 0, 0, 191),
+        Color(0, 229, 0, 191),
+        Color(0, 0, 229, 191),
+        Color(191, 191, 191, 191),
+        Color(204, 102, 0, 191),
+        Color(102, 204, 0, 191),
+        Color(0, 102, 204, 191),
+        Color(0, 204, 102, 191),
+        Color(102, 0, 204, 191),
+        Color(204, 0, 102, 191),
+        Color(178, 178, 0, 191),
+        Color(178, 0, 178, 191),
+        Color(0, 178, 178, 191),
+        Color(229, 0, 0, 191),
+        Color(0, 229, 0, 191),
+        Color(0, 0, 229, 191),
+        Color(191, 191, 191, 191),
+        Color(204, 102, 0, 191),
+        Color(102, 204, 0, 191),
+        Color(0, 102, 204, 191),
+        Color(0, 204, 102, 191),
+        Color(102, 0, 204, 191),
+        Color(204, 0, 102, 191),
+        Color(178, 178, 0, 191),
+        Color(178, 0, 178, 191),
+        Color(0, 178, 178, 191),
+        Color(229, 0, 0, 191),
+        Color(0, 229, 0, 191),
+        Color(0, 0, 229, 191),
+        Color(191, 191, 191, 191),
+        Color(204, 102, 0, 191),
+        Color(102, 204, 0, 191),
+        Color(0, 102, 204, 191),
+        Color(0, 204, 102, 191),
+        Color(102, 0, 204, 191),
+        Color(204, 0, 102, 191),
+        Color(120, 120, 120, 120) };
+      if(id > 148) id =148;
+      return color[id];
+    }
+
+    static CGAL::Color get_color_from_line(std::istream &is)
+    {
+
+        std::string color_info;
+        bool is_float = false;
+
+        std::string col;
+        //get the line content
+        std::getline(is, col);
+        //split it into strings
+        std::istringstream iss(col);
+        //holds the rgb values
+        unsigned char rgb[3];
+        int index =0;
+        //split the string into numbers
+        while(iss>>color_info){
+            //stop if comment is read
+            if(color_info.at(0) == '#')
+                break;
+            //detect if the value is float
+            for(int c = 0; c<static_cast<int>(color_info.length()); c++)
+            {
+                if(color_info.at(c) == '.')
+                {
+                    is_float = true;
+                    break;
+                }
+            }
+            //if the value is of float type, convert it into an int
+            if(is_float)
+                rgb[index] = static_cast<unsigned char>(atof(color_info.c_str())*255);
+            //else stores the value
+            else
+                rgb[index] = static_cast<unsigned char>(atoi(color_info.c_str()));
+            index++;
+            if(index == 3)
+             break;
+        }
+        CGAL::Color color;
+        //if there were only one number, fetch the color in the color map
+        if(index<2)
+            color = get_indexed_color(rgb[0]);
+        //else create the coor with the 3 values;
+        else
+            color = CGAL::Color(rgb[0], rgb[1], rgb[2]);
+        return color;
+    }
+
+    void scan_color( unsigned char& r, unsigned char& g, unsigned char& b) {
+        if ( binary()) {
+            float fr, fg, fb;
+            I_Binary_read_big_endian_float32( m_in, fr);
+            I_Binary_read_big_endian_float32( m_in, fg);
+            I_Binary_read_big_endian_float32( m_in, fb);
+            r = (unsigned char)(fr);
+            g = (unsigned char)(fg);
+            b = (unsigned char)(fb);
+
+        } else {
+            CGAL::Color color = get_color_from_line(m_in);
+            r = color.red();
+            g = color.green();
+            b = color.blue();
+        }
+    }
+
+  void skip_to_next_vertex( std::size_t current_vertex);
+
+  void scan_facet( std::size_t& size, std::size_t CGAL_assertion_code(current_facet)) {
+        CGAL_assertion( current_facet < size_of_facets());
+        if ( binary()){
+            boost::int32_t i32;
+            I_Binary_read_big_endian_integer32( m_in, i32);
+            size = i32;
+        } else {
+            skip_comment();
+            m_in >> size;
+        }
+    }
+
+  void scan_facet_vertex_index( std::size_t& index,
+                                std::size_t current_facet) {
+    if ( binary()){
+      boost::int32_t i32;
+      I_Binary_read_big_endian_integer32( m_in, i32);
+      index = i32;
+    } else
+      m_in >> index;
+
+    if( m_in.fail()) {
+      if ( verbose()) {
+        std::cerr << " " << std::endl;
+        std::cerr << "File_scanner_OFF::" << std::endl;
+        std::cerr << "scan_facet_vertex_index(): input error:  "
+          "cannot read OFF file beyond facet "
+                  << current_facet << "." << std::endl;
+      }
+      set_off_header( false);
+      return;
+    }
+    bool error  = index < index_offset();
+    index -= index_offset();
+
+    if(error || (index >= size_of_vertices())) {
+      m_in.clear( std::ios::failbit);
+      if ( verbose()) {
+        std::cerr << " " << std::endl;
+        std::cerr << "File_scanner_OFF::" << std::endl;
+        std::cerr << "scan_facet_vertex_index(): input error: "
+          "facet " << current_facet << ": vertex index "
+                  << index + index_offset() << ": is out of range."
+                  << std::endl;
+      }
+      set_off_header( false);
+      return;
+    }
+  }
+
+  void skip_to_next_facet( std::size_t current_facet);
+};
+
+template < class Point> inline
+Point&
+file_scan_vertex( File_scanner_OFF& scanner, Point& p) {
+    typedef typename Point::R R;
+    typedef typename R::RT    RT;
+    double x, y, z, w;
+    scanner.scan_vertex( x, y, z, w);
+    if ( w == 1)
+        p = Point( RT(x), RT(y), RT(z));
+    else
+        p = Point( RT(x), RT(y), RT(z), RT(w));
+    return p;
+}
+
+template < class T_Color> inline
+T_Color&
+file_scan_color( File_scanner_OFF& scanner, T_Color& c) {
+    unsigned char r, g, b;
+    scanner.scan_color(r,g,b);
+        c = T_Color(r,g,b);
+    return c;
+}
+
+template < class Vector> inline
+Vector&
+file_scan_normal( File_scanner_OFF& scanner, Vector& v) {
+    typedef typename Vector::R R;
+    typedef typename R::RT     RT;
+    double x, y, z, w;
+    scanner.scan_normal( x, y, z, w);
+    if ( w == 1)
+        v = Vector( RT(x), RT(y), RT(z));
+    else
+        v = Vector( RT(x), RT(y), RT(z), RT(w));
+    return v;
+}
+
+} //namespace CGAL
+
+#ifdef CGAL_HEADER_ONLY
+#include <CGAL/IO/File_scanner_OFF_impl.h>
+#endif // CGAL_HEADER_ONLY
+
+#endif // CGAL_IO_FILE_SCANNER_OFF_H //
+// EOF //
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/File_scanner_OFF_impl.h b/3rdparty/CGAL/include/CGAL/IO/File_scanner_OFF_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/File_scanner_OFF_impl.h
rename to 3rdparty/CGAL/include/CGAL/IO/File_scanner_OFF_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/File_tetgen.h b/3rdparty/CGAL/include/CGAL/IO/File_tetgen.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/File_tetgen.h
rename to 3rdparty/CGAL/include/CGAL/IO/File_tetgen.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/File_writer_OFF.h b/3rdparty/CGAL/include/CGAL/IO/File_writer_OFF.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/File_writer_OFF.h
rename to 3rdparty/CGAL/include/CGAL/IO/File_writer_OFF.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/File_writer_OFF_impl.h b/3rdparty/CGAL/include/CGAL/IO/File_writer_OFF_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/File_writer_OFF_impl.h
rename to 3rdparty/CGAL/include/CGAL/IO/File_writer_OFF_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/File_writer_VRML_2.h b/3rdparty/CGAL/include/CGAL/IO/File_writer_VRML_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/File_writer_VRML_2.h
rename to 3rdparty/CGAL/include/CGAL/IO/File_writer_VRML_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/File_writer_VRML_2_impl.h b/3rdparty/CGAL/include/CGAL/IO/File_writer_VRML_2_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/File_writer_VRML_2_impl.h
rename to 3rdparty/CGAL/include/CGAL/IO/File_writer_VRML_2_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/File_writer_inventor.h b/3rdparty/CGAL/include/CGAL/IO/File_writer_inventor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/File_writer_inventor.h
rename to 3rdparty/CGAL/include/CGAL/IO/File_writer_inventor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/File_writer_inventor_impl.h b/3rdparty/CGAL/include/CGAL/IO/File_writer_inventor_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/File_writer_inventor_impl.h
rename to 3rdparty/CGAL/include/CGAL/IO/File_writer_inventor_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/File_writer_wavefront.h b/3rdparty/CGAL/include/CGAL/IO/File_writer_wavefront.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/File_writer_wavefront.h
rename to 3rdparty/CGAL/include/CGAL/IO/File_writer_wavefront.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/File_writer_wavefront_impl.h b/3rdparty/CGAL/include/CGAL/IO/File_writer_wavefront_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/File_writer_wavefront_impl.h
rename to 3rdparty/CGAL/include/CGAL/IO/File_writer_wavefront_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Generic_writer.h b/3rdparty/CGAL/include/CGAL/IO/Generic_writer.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Generic_writer.h
rename to 3rdparty/CGAL/include/CGAL/IO/Generic_writer.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Geomview_stream.h b/3rdparty/CGAL/include/CGAL/IO/Geomview_stream.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Geomview_stream.h
rename to 3rdparty/CGAL/include/CGAL/IO/Geomview_stream.h
diff --git a/3rdparty/CGAL/include/CGAL/IO/Geomview_stream_impl.h b/3rdparty/CGAL/include/CGAL/IO/Geomview_stream_impl.h
new file mode 100644
index 0000000..5f62204
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/IO/Geomview_stream_impl.h
@@ -0,0 +1,612 @@
+// Copyright (c) 1999-2004  
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved. 
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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(s)     : Andreas Fabri, Herve Bronnimann, Sylvain Pion
+
+#ifdef CGAL_USE_GEOMVIEW
+
+#ifdef CGAL_HEADER_ONLY
+#define CGAL_INLINE_FUNCTION inline
+#else
+#define CGAL_INLINE_FUNCTION
+#endif
+
+#include <sstream>
+#include <csignal>
+#include <cerrno>
+#include <cstring>
+#include <cstdlib>
+#include <unistd.h>
+
+#include <sys/types.h> // kill() on SunPro requires these 2 #includes.
+#include <signal.h>
+
+#include <CGAL/IO/binary_file_io.h>
+
+namespace CGAL {
+
+CGAL_INLINE_FUNCTION
+Geomview_stream::Geomview_stream(const Bbox_3 &bbox,
+				 const char *machine,
+				 const char *login)
+    : bb(bbox), vertex_color(BLACK), edge_color(BLACK), face_color(BLACK),
+      wired_flag(false), echo_flag(true), raw_flag(false),
+      trace_flag(false), binary_flag(false),
+      line_width(1)
+{
+    setup_geomview(machine, login);
+    frame(bbox);
+    pickplane(bbox);
+    set_vertex_radius((bbox.xmax() - bbox.xmin())/100.0);
+}
+
+CGAL_INLINE_FUNCTION
+Geomview_stream::~Geomview_stream()
+{
+    kill(pid, SIGKILL);  // kills geomview
+}
+
+CGAL_INLINE_FUNCTION
+void Geomview_stream::setup_geomview(const char *machine, const char *login)
+{
+    int pipe_out[2], pipe_in[2];
+
+    // Communication between CGAL and geomview should be possible
+    // in two directions. To achieve this we open two pipes
+
+    std::cout << "Starting Geomview..." << std::flush;
+    if (pipe(pipe_out) < 0) {
+        CGAL_error_msg( "out pipe failed" );
+    }
+
+    if (pipe(pipe_in) < 0) {
+        CGAL_error_msg(  "in pipe failed" );
+    }
+
+    switch (pid = fork()){
+    case -1:
+        CGAL_error_msg( "fork failed" );
+    case 0:               // The child process
+        close(pipe_out[1]); // does not write to the out pipe,
+        close(pipe_in[0]);  // does not read from the in pipe.
+
+	if (dup2(pipe_out[0], 0) != 0)
+	    std::cerr << "Connect pipe to stdin failed." << std::endl;
+	if (dup2(pipe_in[1], 1) != 1)
+	    std::cerr << "Connect pipe to stdout failed." << std::endl;
+
+        if (machine && (std::strlen(machine)>0)) {
+	    std::string s (" rgeomview ");
+	    s += machine;
+	    s += ":0.0";
+            execlp("rsh", "rsh", machine, "-l", login, s.data(),
+                   static_cast<void *>(NULL)); // cast to stop gcc warning
+        } else {
+            execlp("geomview", "geomview", "-c", "-",
+                   static_cast<void *>(NULL)); // cast to stop gcc warning
+        }
+
+        // if we get to this point something went wrong.
+        std::cerr << "execl geomview failed" << std::endl;
+        switch(errno) {
+        case EACCES:
+            std::cerr << "please check your environment variable PATH"
+		      << std::endl;
+            std::cerr << "make sure the file `geomview' is contained in it"
+		      << std::endl;
+            std::cerr << "and is executable" << std::endl;
+            break;
+        case ELOOP:
+            std::cerr << "too many links for filename `geomview'" << std::endl;
+            break;
+        default:
+            std::cerr << "error number " << errno << " (check `man execlp')"
+		      << std::endl;
+        };
+        CGAL_error();
+    default:              // The parent process
+        close(pipe_out[0]); // does not read from the out pipe,
+        close(pipe_in[1]);  // does not write to the in pipe.
+
+        in = pipe_in[0];
+        out = pipe_out[1];
+
+	// Necessary to wait a little bit for Geomview,
+        // otherwise you won't be able to ask for points...
+        sleep(1);
+
+#if 1
+        // We want to get rid of the requirement in the CGAL doc about
+	// (echo "started").  But we want to be backward compatible, that is,
+	// people who have this echo in their .geomview must still have CGAL
+	// working, at least for a few public releases.
+        // So the plan is to send, from CGAL, the command : (echo "CGAL-3D")
+        // It's the same length as "started", 7.
+        // Then we read 7 chars from Geomview, and test which string it is.
+        // If it's "CGAL-3D", then fine, the user doesn't have .geomview with
+        // the back-compatible echo command.
+        // In the very long run, we'll be able to get rid of all this code as
+        // well.
+	// Maybe we should simply read the pipe, till we find "CGAL-3D" ?
+
+        *this << "(echo \"CGAL-3D\")";
+
+        char inbuf[10];
+        std::size_t retread=::read(in, inbuf, 7);
+        (void)retread;
+
+        if (std::strncmp(inbuf, "started", 7) == 0)
+        {
+            // std::cerr << "You still have a .geomview file with the\n"
+                   // << "(echo \"started\") command. Note that this is not\n"
+                   // << "compulsory anymore, since CGAL 2.3" << std::endl;
+
+            // Then the next one is supposed to be CGAL-3D.
+            retread=::read(in, inbuf, 7);
+            (void)retread;
+            if (std::strncmp(inbuf, "CGAL-3D", 7) != 0)
+                std::cerr << "Unexpected string from Geomview !" << std::endl;
+        }
+        else if (std::strncmp(inbuf, "CGAL-3D", 7) == 0)
+        {
+            // std::cerr << "Good, you don't have a .geomview file with the\n"
+                      // << "(echo \"started\") command" << std::endl;
+        }
+        else
+        {
+            std::cerr << "Unexcepted string from Geomview at initialization!\n"
+                      << "Going on nevertheless !" << std::endl;
+        }
+#else
+        // Old original version
+        char inbuf[10];
+        // Waits for "started" from the .geomview file.
+        retread=::read(in, inbuf, 7);
+        (void)retread;
+#endif
+
+        std::cout << "done." << std::endl;
+
+        (*this) << "(normalization g* none)(bbox-draw g* no)";
+    }
+}
+
+CGAL_INLINE_FUNCTION
+void
+Geomview_stream::pickplane(const Bbox_3 &bbox)
+{
+    bool bin_bak = set_binary_mode();
+    (*this) << "(geometry pickplane {QUAD BINARY\n"
+            << 1
+    // here are the four corners
+            << bbox.xmin() << bbox.ymin() << bbox.zmin()
+            << bbox.xmin() << bbox.ymax() << bbox.zmin()
+            << bbox.xmax() << bbox.ymax() << bbox.zmin()
+            << bbox.xmax() << bbox.ymin() << bbox.zmin()
+
+    // close the text bracket
+            << "}) (pickable pickplane no)";
+    set_ascii_mode(bin_bak);
+}
+
+CGAL_INLINE_FUNCTION
+void
+Geomview_stream::clear()
+{
+    (*this) << "(delete World)";
+    id.clear();
+}
+
+CGAL_INLINE_FUNCTION
+void
+Geomview_stream::look_recenter()
+{
+    (*this) << "(look-recenter World)";
+}
+
+CGAL_INLINE_FUNCTION
+Geomview_stream&
+Geomview_stream::operator<<(const std::string & s)
+{
+    if ((int)s.length() != ::write(out, s.data(), s.length())) {
+        CGAL_error_msg( "write problem in the pipe while sending data to geomview" );
+    }
+    trace(s);
+
+    return *this;
+}
+
+CGAL_INLINE_FUNCTION
+Geomview_stream&
+Geomview_stream::operator<<(int i)
+{
+    // Depending on the mode chosen
+    if (get_binary_mode()) {
+        // we write raw binary data to the stream.
+        int num = i;
+        I_swap_to_big_endian(num);
+        std::size_t retwrite=::write(out, (char*)&num, sizeof(num));
+        (void)retwrite;
+        trace(i);
+    } else {
+        // transform the int in a character sequence and put whitespace around
+        std::ostringstream str;
+        str << i << ' ' << std::ends;
+        *this << str.str().c_str();
+    }
+
+    return *this;
+}
+
+CGAL_INLINE_FUNCTION
+Geomview_stream&
+Geomview_stream::operator<<(unsigned int i)
+{
+    // Depending on the mode chosen
+    if (get_binary_mode()) {
+        // we write raw binary data to the stream.
+        unsigned int num = i;
+        I_swap_to_big_endian(num);
+        std::size_t retwrite=::write(out, (char*)&num, sizeof(num));
+        (void)retwrite;
+        trace(i);
+    } else {
+        // transform the int in a character sequence and put whitespace around
+        std::ostringstream str;
+        str << i << ' ' << std::ends;
+        *this << str.str().c_str();
+    }
+
+    return *this;
+}
+
+CGAL_INLINE_FUNCTION
+Geomview_stream&
+Geomview_stream::operator<<(long i)
+{
+    return operator<<((int) i);
+}
+
+CGAL_INLINE_FUNCTION
+Geomview_stream&
+Geomview_stream::operator<<(unsigned long i)
+{
+    return operator<<((unsigned int) i);
+}
+
+CGAL_INLINE_FUNCTION
+Geomview_stream&
+Geomview_stream::operator<<(double d)
+{
+    float f = float(d);
+    if (get_binary_mode()) {
+        float num = float(d);
+        I_swap_to_big_endian(num);
+        std::size_t retwrite= ::write(out, (char*)&num, sizeof(num));
+        (void)retwrite;
+        trace(f);
+    } else {
+        // 'copy' the float in a string and append a blank
+        std::ostringstream str;
+        str << f << ' ' << std::ends;
+        *this << str.str().c_str();
+    }
+    return *this;
+}
+
+CGAL_INLINE_FUNCTION
+Geomview_stream&
+operator<<(Geomview_stream &gv, const Bbox_2 &bbox)
+{
+    bool ascii_bak = gv.set_ascii_mode();
+    gv << "(geometry " << gv.get_new_id("Bbox")
+       << " {VECT 1 5 0 5 0 ";
+    // here are the four corners
+
+    gv << bbox.xmin() << bbox.ymin() << 0.0
+       << bbox.xmin() << bbox.ymax() << 0.0
+       << bbox.xmax() << bbox.ymax() << 0.0
+       << bbox.xmax() << bbox.ymin() << 0.0
+       << bbox.xmin() << bbox.ymin() << 0.0;
+
+    // close the text bracket
+    gv << "})";
+    gv.set_ascii_mode(ascii_bak);
+
+    return gv;
+}
+
+CGAL_INLINE_FUNCTION
+Geomview_stream&
+operator<<(Geomview_stream &gv, const Bbox_3 &bbox)
+{
+    bool ascii_bak = gv.set_ascii_mode();
+    gv << "(geometry " << gv.get_new_id("Bbox")
+       << " {appearance {material {edgecolor "
+       << gv.ecr() << gv.ecg() << gv.ecb() <<  "}}{SKEL 8 4 "
+    // here are the corners
+       << bbox.xmin() << bbox.ymin() << bbox.zmin()
+       << bbox.xmin() << bbox.ymax() << bbox.zmin()
+       << bbox.xmax() << bbox.ymax() << bbox.zmin()
+       << bbox.xmax() << bbox.ymin() << bbox.zmin()
+       << bbox.xmax() << bbox.ymin() << bbox.zmax()
+       << bbox.xmax() << bbox.ymax() << bbox.zmax()
+       << bbox.xmin() << bbox.ymax() << bbox.zmax()
+       << bbox.xmin() << bbox.ymin() << bbox.zmax()
+
+       << "10 0 1 2 3 4 5 6 7 0 3\n"
+       << "2 1 6\n"
+       << "2 2 5\n"
+       << "2 4 7\n"
+
+    // close the text bracket
+       << "}})";
+    gv.set_ascii_mode(ascii_bak);
+
+    return gv;
+}
+
+CGAL_INLINE_FUNCTION
+void
+Geomview_stream::set_bg_color(const Color &c)
+{
+    bool ascii_bak = set_ascii_mode();
+    *this << "(backcolor \"Camera\" "
+          << double(c.r())/255.0
+          << double(c.g())/255.0
+          << double(c.b())/255.0
+          << ")";
+    set_ascii_mode(ascii_bak);
+}
+
+CGAL_INLINE_FUNCTION
+Geomview_stream&
+Geomview_stream::operator<<(const Color &c)
+{
+    vertex_color = edge_color = face_color = c;
+    return (*this);
+}
+
+CGAL_INLINE_FUNCTION
+Color
+Geomview_stream::get_vertex_color() const
+{
+    return vertex_color;
+}
+
+CGAL_INLINE_FUNCTION
+Color
+Geomview_stream::get_edge_color() const
+{
+    return edge_color;
+}
+
+CGAL_INLINE_FUNCTION
+Color
+Geomview_stream::get_face_color() const
+{
+    return face_color;
+}
+
+CGAL_INLINE_FUNCTION
+Color
+Geomview_stream::set_vertex_color(const Color &c)
+{
+    Color old = vertex_color;
+    vertex_color = c;
+    return old;
+}
+
+CGAL_INLINE_FUNCTION
+Color
+Geomview_stream::set_edge_color(const Color &c)
+{
+    Color old = edge_color;
+    edge_color = c;
+    return old;
+}
+
+CGAL_INLINE_FUNCTION
+Color
+Geomview_stream::set_face_color(const Color &c)
+{
+    Color old = face_color;
+    face_color = c;
+    return old;
+}
+
+CGAL_INLINE_FUNCTION
+double
+Geomview_stream::vcr() const
+{
+    return double(vertex_color.r())/255.0;
+}
+
+CGAL_INLINE_FUNCTION
+double
+Geomview_stream::vcg() const
+{
+    return double(vertex_color.g())/255.0;
+}
+
+CGAL_INLINE_FUNCTION
+double
+Geomview_stream::vcb() const
+{
+    return double(vertex_color.b())/255.0;
+}
+
+CGAL_INLINE_FUNCTION
+double
+Geomview_stream::ecr() const
+{
+    return double(edge_color.r())/255.0;
+}
+
+CGAL_INLINE_FUNCTION
+double
+Geomview_stream::ecg() const
+{
+    return double(edge_color.g())/255.0;
+}
+
+CGAL_INLINE_FUNCTION
+double
+Geomview_stream::ecb() const
+{
+    return double(edge_color.b())/255.0;
+}
+
+CGAL_INLINE_FUNCTION
+double
+Geomview_stream::fcr() const
+{
+    return double(face_color.r())/255.0;
+}
+
+CGAL_INLINE_FUNCTION
+double
+Geomview_stream::fcg() const
+{
+    return double(face_color.g())/255.0;
+}
+
+CGAL_INLINE_FUNCTION
+double
+Geomview_stream::fcb() const
+{
+    return double(face_color.b())/255.0;
+}
+
+CGAL_INLINE_FUNCTION
+void
+Geomview_stream::frame(const Bbox_3 &bbox)
+{
+    (*this) << bbox << "(look-recenter g0 c0)";
+}
+
+CGAL_INLINE_FUNCTION
+Geomview_stream&
+Geomview_stream::operator>>(char *expr)
+{
+    // Skip whitespaces
+    do {
+      std::size_t retread=::read(in, expr, 1);
+      (void)retread;
+    } while (expr[0] != '(');
+
+    int pcount = 1;
+    int i = 1;
+    while (1) {
+        std::size_t retread=::read(in, &expr[i], 1);
+        (void)retread;
+        if (expr[i] == ')'){
+            pcount--;
+        } else if (expr[i] == '('){
+            pcount++;
+        }
+        if (pcount == 0){
+            expr[i+1]='\0';
+            break;  // we encountered a balanced number of parantheses
+        }
+        i++;
+    }
+    return *this;
+}
+
+// Parse a Lisp expression, return a pointer to the beginning of the
+// nth subexpression, and terminate it by '\0'.
+// It's either a word terminated by ' ' or ')', or a well parenthesed
+// expression, or a quoted "string".
+CGAL_INLINE_FUNCTION
+char*
+Geomview_stream::nth(char* s, int count)
+{
+    s++; // skip first character (always a parenthesis)
+
+    // Skip "count" words.
+    for(; count != 0; count--) {
+        while (*s == ' ')       // skip whitespaces
+            s++;
+        s++;
+        while (*s != ' ')       // skip a word
+            s++;
+    }
+    while (*s == ' ')           // skip whitespaces
+        s++;
+
+    // Now we have the beginning of the searched sub-expression.
+    int j = 1;
+    if (*s == '(')              // Case of a well-parenthesed expression.
+        for (int pcount = 1; pcount != 0;) {
+            if (s[j] == ')') pcount--;
+            if (s[j] == '(') pcount++;
+            j++;
+        }
+    else if (*s == '"') {       // Case of a quoted "string".
+        while (s[j] != '"')
+            j++;
+        j++;
+    }
+    else                        // Case of a word terminated by ' ' or ')'.
+        while (s[j] != ' ' && s[j] != ')')
+            j++;
+
+    s[j] = '\0';
+    return s;
+}
+
+CGAL_INLINE_FUNCTION
+void
+Geomview_stream::parse_point(const char* pickpoint,
+		     double &x, double &y, double &z, double &w)
+{
+    std::stringstream ss;
+    ss << pickpoint << std::ends;
+
+    char parenthesis;
+    ss >> parenthesis >> x >> y >> z >> w;
+}
+
+CGAL_INLINE_FUNCTION
+std::string
+Geomview_stream::get_new_id(const std::string & s)
+{
+    std::ostringstream str;
+    str << s << id[s]++ << std::ends;
+    return str.str();
+}
+
+} //namespace CGAL
+
+#else
+
+#ifndef CGAL_HEADER_ONLY
+// Add a dummy symbol to prevent warnings of empty translation unit.
+namespace CGAL {
+namespace {
+int dummy;
+}
+} //namespace CGAL
+#endif
+
+#endif // CGAL_USE_GEOMVIEW
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Gps_iostream.h b/3rdparty/CGAL/include/CGAL/IO/Gps_iostream.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Gps_iostream.h
rename to 3rdparty/CGAL/include/CGAL/IO/Gps_iostream.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Inventor_ostream.h b/3rdparty/CGAL/include/CGAL/IO/Inventor_ostream.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Inventor_ostream.h
rename to 3rdparty/CGAL/include/CGAL/IO/Inventor_ostream.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Istream_iterator.h b/3rdparty/CGAL/include/CGAL/IO/Istream_iterator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Istream_iterator.h
rename to 3rdparty/CGAL/include/CGAL/IO/Istream_iterator.h
diff --git a/3rdparty/CGAL/include/CGAL/IO/Nef_polyhedron_2_PS_stream.h b/3rdparty/CGAL/include/CGAL/IO/Nef_polyhedron_2_PS_stream.h
new file mode 100644
index 0000000..c12fd5c
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/IO/Nef_polyhedron_2_PS_stream.h
@@ -0,0 +1,116 @@
+// Copyright (c) 1997-2000  Max-Planck-Institute Saarbruecken (Germany).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Michael Seel <seel at mpi-sb.mpg.de>
+
+#ifndef CGAL_NEF_POLYHEDRON_2_PS_STREAM_H
+#define CGAL_NEF_POLYHEDRON_2_PS_STREAM_H
+
+#include <CGAL/Nef_polyhedron_2.h>
+#include <LEDA/geo/gen_polygon.h>
+#include <LEDA/graphics/ps_file.h>
+#include <LEDA/graphics/color.h>
+
+namespace CGAL {
+static int frame_default = 100;
+
+template <typename CIRC>
+leda_list<leda_point>
+face_cycle(CIRC c)
+{
+  leda_list<leda_point> L;
+  CIRC c_end(c);
+  CGAL_For_all(c,c_end) {
+    L.append(leda_point(CGAL::to_double(c->vertex()->point().x()),
+                        CGAL::to_double(c->vertex()->point().y())));
+  }
+  return L;
+}
+
+
+template <typename T>
+ps_file& operator<<(ps_file& PS, const Nef_polyhedron_2<T>& P)
+{
+  typedef Nef_polyhedron_2<T> NefPoly;
+  typedef typename NefPoly::Const_decorator  PMCDec;
+  typedef typename NefPoly::Point            Point;
+  typedef typename NefPoly::Line             Line;
+  typedef typename T::RT  RT;
+  typedef typename T::Standard_RT Standard_RT;
+
+  PMCDec D = P.explorer(); 
+  const T& E = Nef_polyhedron_2<T>::EK;
+
+  Standard_RT frame_radius = frame_default;
+  E.determine_frame_radius(D.points_begin(),D.points_end(),frame_radius);
+  RT::set_R(frame_radius);
+  double r = CGAL::to_double(frame_radius);
+  PS.init(-r,r,-r);
+
+  typedef typename PMCDec::Vertex_const_iterator   Vertex_const_iterator;
+  typedef typename PMCDec::Halfedge_const_iterator Halfedge_const_iterator;
+  typedef typename PMCDec::Face_const_iterator     Face_const_iterator;
+  typedef typename PMCDec::Hole_const_iterator     Hole_const_iterator;
+  typedef typename PMCDec::Halfedge_around_face_const_circulator
+    Halfedge_around_face_const_circulator;
+
+  Face_const_iterator fit = D.faces_begin();
+  for (++fit; fit != D.faces_end(); ++fit) {
+    leda_list<leda_polygon> LP;
+    Halfedge_around_face_const_circulator hfc(fit->halfedge());
+    LP.append(leda_polygon(face_cycle(hfc),leda_polygon::NO_CHECK));
+    Hole_const_iterator hit;
+    for (hit = fit->fc_begin(); hit != fit->fc_end(); ++hit) {
+      hfc = Halfedge_around_face_const_circulator(hit);
+      LP.append(leda_polygon(face_cycle(hfc),leda_polygon::NO_CHECK));
+    }
+    leda_gen_polygon GP(LP,leda_gen_polygon::NO_CHECK);
+    if ( fit->mark() ) PS.set_fill_color(leda_grey3);
+    else               PS.set_fill_color(leda_white);
+    PS << GP;
+  }
+
+  Halfedge_const_iterator hit;
+  for (hit = D.halfedges_begin(); hit != D.halfedges_end(); ++(++hit)) {
+    leda_segment s(CGAL::to_double(hit->vertex()->point().x()),
+		   CGAL::to_double(hit->vertex()->point().y()),
+		   CGAL::to_double(hit->opposite()->vertex()->point().x()),
+		   CGAL::to_double(hit->opposite()->vertex()->point().y()));
+    if ( hit->mark() ) PS.set_color(leda_black);
+    else               PS.set_color(leda_grey1);
+    PS << s;
+  }
+
+  PS.set_node_width(3);
+  Vertex_const_iterator v;
+  for (v = D.vertices_begin(); v != D.vertices_end(); ++v) {
+    leda_point p(CGAL::to_double(v->point().x()),
+		 CGAL::to_double(v->point().y()));
+    leda_color pc;
+    if ( v->mark() ) pc = leda_black;
+    else             pc = leda_grey1;
+    PS.draw_filled_node(p,pc);
+  }
+
+
+  return PS;
+}
+
+} //namespace CGAL
+
+#endif // CGAL_NEF_POLYHEDRON_2_PS_STREAM_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Nef_polyhedron_iostream_3.h b/3rdparty/CGAL/include/CGAL/IO/Nef_polyhedron_iostream_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Nef_polyhedron_iostream_3.h
rename to 3rdparty/CGAL/include/CGAL/IO/Nef_polyhedron_iostream_3.h
diff --git a/3rdparty/CGAL/include/CGAL/IO/OBJ_reader.h b/3rdparty/CGAL/include/CGAL/IO/OBJ_reader.h
new file mode 100644
index 0000000..dcb560d
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/IO/OBJ_reader.h
@@ -0,0 +1,59 @@
+// Copyright (c) 2016 GeometryFactory
+//
+// 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(s)     : Andreas Fabri and Maxime Gimeno
+
+#ifndef CGAL_IO_OBJ_READER_H
+#define CGAL_IO_OBJ_READER_H
+#include <istream>
+#include <vector>
+
+
+namespace CGAL {
+
+template <class Point_3>
+bool
+read_OBJ( std::istream& input,
+          std::vector<Point_3> &points,
+          std::vector<std::vector<std::size_t> > &faces)
+{
+  Point_3 p;
+  std::string line;
+  while(getline(input, line)) {
+    if(line[0] == 'v' && line[1] == ' ') {
+      std::istringstream iss(line.substr(1));
+      iss >> p;
+      if(!iss)
+        return false;
+      points.push_back(p);
+    }
+    else if(line[0] == 'f') {
+      std::istringstream iss(line.substr(1));
+      int i;
+      faces.push_back( std::vector<std::size_t>() );
+      while(iss >> i)
+      {
+        faces.back().push_back(i-1);
+        iss.ignore(256, ' ');
+      }
+    }
+  }
+  return true;
+}
+
+} // namespace CGAL
+
+#endif // CGAL_IO_OBJ_READER_H
diff --git a/3rdparty/CGAL/include/CGAL/IO/OFF_reader.h b/3rdparty/CGAL/include/CGAL/IO/OFF_reader.h
new file mode 100644
index 0000000..917610e
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/IO/OFF_reader.h
@@ -0,0 +1,172 @@
+// Copyright (c) 2015 GeometryFactory
+//
+// 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(s)     : Laurent Rineau and Sebastien Loriot
+
+#ifndef CGAL_IO_OFF_READER_H
+#define CGAL_IO_OFF_READER_H
+
+#include <CGAL/IO/File_scanner_OFF.h>
+
+#include <vector>
+#include <iostream>
+#include <CGAL/array.h>
+#include <CGAL/assertions.h>
+#include <CGAL/use.h>
+
+namespace CGAL{
+
+  namespace read_OFF_internal{
+    template <class Point_3>
+    void fill_point(double x, double y, double z, Point_3& pt)
+    {
+      pt = Point_3(x, y, z);
+    }
+
+    void fill_point(double x, double y, double z, CGAL::cpp11::array<double,3>& p)
+    {
+      p = CGAL::make_array(x,y,z);
+    }
+
+    template <class Polygon_3>
+    void resize(Polygon_3& p, std::size_t size)
+    {
+      p.resize(size);
+    }
+
+    template <std::size_t N, class INT>
+    void resize(CGAL::cpp11::array<INT, N>&, std::size_t size)
+    {
+      CGAL_USE(size);
+      CGAL_assertion( size>=N );
+    }
+  }
+
+  template <class Point_3, class Polygon_3>
+  bool
+  read_OFF( std::istream& in,
+            std::vector< Point_3 >& points,
+            std::vector< Polygon_3 >& polygons,
+            bool /* verbose */ = false)
+  {
+    CGAL::File_scanner_OFF scanner(in);
+
+    points.resize(scanner.size_of_vertices());
+    polygons.resize(scanner.size_of_facets());
+    for (std::size_t i = 0; i < scanner.size_of_vertices(); ++i) {
+      double x, y, z, w;
+      scanner.scan_vertex( x, y, z, w);
+      CGAL_assertion(w!=0);
+      read_OFF_internal::fill_point( x/w, y/w, z/w, points[i] );
+      scanner.skip_to_next_vertex( i);
+    }
+    if(!in)
+      return false;
+
+    for (std::size_t i = 0; i < scanner.size_of_facets(); ++i) {
+      std::size_t no;
+
+      scanner.scan_facet( no, i);
+      read_OFF_internal::resize(polygons[i], no);
+      for(std::size_t j = 0; j < no; ++j) {
+        std::size_t id;
+        scanner.scan_facet_vertex_index(id, i);
+        if(id < scanner.size_of_vertices())
+        {
+          polygons[i][j] = id;
+        }
+        else
+          return false;
+      }
+    }
+    return in.good();
+  }
+
+  template <class Point_3, class Polygon_3, class Color_rgb >
+  bool
+  read_OFF( std::istream& in,
+            std::vector< Point_3 >& points,
+            std::vector< Polygon_3 >& polygons,
+            std::vector<Color_rgb>& fcolors,
+            std::vector<Color_rgb>& vcolors,
+            bool /* verbose */ = false)
+  {
+    CGAL::File_scanner_OFF scanner(in);
+    points.resize(scanner.size_of_vertices());
+    polygons.resize(scanner.size_of_facets());
+    if(scanner.has_colors())
+      vcolors.resize(scanner.size_of_vertices());
+    for (std::size_t i = 0; i < scanner.size_of_vertices(); ++i) {
+        double x, y, z, w;
+        scanner.scan_vertex( x, y, z, w);
+        CGAL_assertion(w!=0);
+        read_OFF_internal::fill_point( x/w, y/w, z/w, points[i] );
+        if(scanner.has_colors())
+        {
+            unsigned char r=0, g=0, b=0;
+            scanner.scan_color( r, g, b);
+            vcolors[i] = Color_rgb(r,g,b);
+        }
+        else
+            scanner.skip_to_next_vertex(i);
+    }
+    if(!in)
+      return false;
+    bool has_fcolors = false;
+    for (std::size_t i = 0; i < scanner.size_of_facets(); ++i) {
+      std::size_t no;
+      scanner.scan_facet( no, i);
+
+      read_OFF_internal::resize(polygons[i], no);
+      for(std::size_t j = 0; j < no; ++j) {
+        std::size_t id;
+        scanner.scan_facet_vertex_index(id, i);
+        if(id < scanner.size_of_vertices())
+        {
+          polygons[i][j] = id;
+        }
+        else
+        {
+          return false;
+        }
+      }
+
+      if(i==0)
+      {
+        std::string col;
+        std::getline(in, col);
+        std::istringstream iss(col);
+        char ci =' ';
+        if(iss >> ci){
+          has_fcolors = true;
+          fcolors.resize(scanner.size_of_facets());
+          std::istringstream iss2(col);
+          fcolors[i] = scanner.get_color_from_line(iss2);
+        }
+      }
+      else if(has_fcolors)
+      {
+        unsigned char r=0, g=0, b=0;
+        scanner.scan_color(r,g,b);
+        fcolors[i] = Color_rgb(r,g,b);
+      }
+    }
+    return in.good();
+  }
+
+} // namespace CGAL
+
+#endif // CGAL_IO_OFF_READER_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Ostream_iterator.h b/3rdparty/CGAL/include/CGAL/IO/Ostream_iterator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Ostream_iterator.h
rename to 3rdparty/CGAL/include/CGAL/IO/Ostream_iterator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Polyhedron_VRML_1_ostream.h b/3rdparty/CGAL/include/CGAL/IO/Polyhedron_VRML_1_ostream.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Polyhedron_VRML_1_ostream.h
rename to 3rdparty/CGAL/include/CGAL/IO/Polyhedron_VRML_1_ostream.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Polyhedron_VRML_2_ostream.h b/3rdparty/CGAL/include/CGAL/IO/Polyhedron_VRML_2_ostream.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Polyhedron_VRML_2_ostream.h
rename to 3rdparty/CGAL/include/CGAL/IO/Polyhedron_VRML_2_ostream.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Polyhedron_builder_from_STL.h b/3rdparty/CGAL/include/CGAL/IO/Polyhedron_builder_from_STL.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Polyhedron_builder_from_STL.h
rename to 3rdparty/CGAL/include/CGAL/IO/Polyhedron_builder_from_STL.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Polyhedron_geomview_ostream.h b/3rdparty/CGAL/include/CGAL/IO/Polyhedron_geomview_ostream.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Polyhedron_geomview_ostream.h
rename to 3rdparty/CGAL/include/CGAL/IO/Polyhedron_geomview_ostream.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Polyhedron_inventor_ostream.h b/3rdparty/CGAL/include/CGAL/IO/Polyhedron_inventor_ostream.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Polyhedron_inventor_ostream.h
rename to 3rdparty/CGAL/include/CGAL/IO/Polyhedron_inventor_ostream.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Polyhedron_iostream.h b/3rdparty/CGAL/include/CGAL/IO/Polyhedron_iostream.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Polyhedron_iostream.h
rename to 3rdparty/CGAL/include/CGAL/IO/Polyhedron_iostream.h
diff --git a/3rdparty/CGAL/include/CGAL/IO/Polyhedron_scan_OFF.h b/3rdparty/CGAL/include/CGAL/IO/Polyhedron_scan_OFF.h
new file mode 100644
index 0000000..53a3477
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/IO/Polyhedron_scan_OFF.h
@@ -0,0 +1,151 @@
+// Copyright (c) 1997  ETH Zurich (Switzerland).
+// 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
+// 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(s)     : Lutz Kettner  <kettner at mpi-sb.mpg.de>
+
+#ifndef CGAL_IO_POLYHEDRON_SCAN_OFF_H
+#define CGAL_IO_POLYHEDRON_SCAN_OFF_H 1
+
+#include <CGAL/basic.h>
+#include <CGAL/IO/File_header_OFF.h>
+#include <CGAL/IO/File_scanner_OFF.h>
+#include <CGAL/Modifier_base.h>
+#include <CGAL/Polyhedron_incremental_builder_3.h>
+#include <CGAL/Polyhedron_3.h>
+#include <iostream>
+#include <cstddef>
+
+namespace CGAL {
+
+template < class HDS>
+class Polyhedron_scan_OFF :  public Modifier_base<HDS> {
+protected:
+    std::istream&    m_in;
+    File_header_OFF  m_file_header;
+public:
+
+    typedef HDS Halfedge_data_structure;
+
+// DEFINITION
+//
+// Polyhedron_scan_OFF<Traits> is a polyhedral surface builder.
+// It scans a polyhedron given in OFF from a stream and appends it
+// incrementally using the incremental builder.
+
+    Polyhedron_scan_OFF( std::istream& in, bool verbose = false)
+        : m_in(in), m_file_header( verbose) {}
+
+    // Activation
+    void operator()( HDS& hds);
+
+    const File_header_OFF&  header() const { return m_file_header; }
+};
+
+template < class HDS >
+void
+Polyhedron_scan_OFF<HDS>:: operator()( HDS& target) {
+    File_scanner_OFF scanner( m_in, m_file_header.verbose());
+    if ( ! m_in) {
+        if ( scanner.verbose()) {
+            std::cerr << " " << std::endl;
+            std::cerr << "Polyhedron_scan_OFF<HDS>::" << std::endl;
+            std::cerr << "operator(): input error: file format is not in "
+                         "OFF." << std::endl;
+        }
+        return;
+    }
+    m_file_header = scanner;  // Remember file header after return.
+
+    Polyhedron_incremental_builder_3<HDS> B( target, scanner.verbose());
+    B.begin_surface( scanner.size_of_vertices(),
+                     scanner.size_of_facets(),
+                     scanner.size_of_halfedges());
+
+    typedef typename HDS::Traits     Traits;
+    typedef typename Traits::Point_3 Point;
+
+    // read in all vertices
+    std::size_t  i;
+    for ( i = 0; i < scanner.size_of_vertices(); i++) {
+        Point p;
+        file_scan_vertex( scanner, p);
+        B.add_vertex( p);
+        if(scanner.has_colors())
+        {
+         Color c;
+         file_scan_color(scanner, c);
+        }
+        else
+         scanner.skip_to_next_vertex( i);
+    }
+    if ( ! m_in  || B.error()) {
+        B.rollback();
+        m_in.clear( std::ios::badbit);
+        return;
+    }
+
+    // read in all facets
+    for ( i = 0; i < scanner.size_of_facets(); i++) {
+        B.begin_facet();
+        std::size_t no;
+        scanner.scan_facet( no, i);
+        if( ! m_in || B.error() || no < 3) {
+            if ( scanner.verbose()) {
+                std::cerr << " " << std::endl;
+                std::cerr << "Polyhedron_scan_OFF<Traits>::" << std::endl;
+                std::cerr << "operator()(): input error: facet " << i
+                     << " has less than 3 vertices." << std::endl;
+            }
+            B.rollback();
+            m_in.clear( std::ios::badbit);
+            return;
+        }
+        for ( std::size_t j = 0; j < no; j++) {
+            std::size_t index;
+            scanner.scan_facet_vertex_index( index, i);
+            B.add_vertex_to_facet( index);
+        }
+        //TO DO : Insert read color
+        B.end_facet();
+        scanner.skip_to_next_facet( i);
+    }
+    if ( ! m_in  || B.error()) {
+        B.rollback();
+        m_in.clear( std::ios::badbit);
+        return;
+    }
+    if ( B.check_unconnected_vertices()) {
+        if ( ! B.remove_unconnected_vertices()) {
+            if ( scanner.verbose()) {
+                std::cerr << " " << std::endl;
+                std::cerr << "Polyhedron_scan_OFF<Traits>::" << std::endl;
+                std::cerr << "operator()(): input error: cannot "
+                             "successfully remove isolated vertices."
+                          << std::endl;
+            }
+            B.rollback();
+            m_in.clear( std::ios::badbit);
+            return;
+        }
+    }
+    B.end_surface();
+}
+
+} //namespace CGAL
+#endif // CGAL_IO_POLYHEDRON_SCAN_OFF_H //
+// EOF //
diff --git a/3rdparty/CGAL/include/CGAL/IO/STL_reader.h b/3rdparty/CGAL/include/CGAL/IO/STL_reader.h
new file mode 100644
index 0000000..eae9cd1
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/IO/STL_reader.h
@@ -0,0 +1,156 @@
+// Copyright (c) 2015 GeometryFactory
+//
+// 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(s)     : Andreas Fabri
+
+#ifndef CGAL_IO_STL_READER_H
+#define CGAL_IO_STL_READER_H
+
+#include <CGAL/array.h>
+#include <boost/cstdint.hpp> 
+#include <vector>
+#include <map>
+#include <iostream>
+#include <string>
+
+namespace CGAL{
+
+  bool
+  read_STL( std::istream& input,
+            std::vector< cpp11::array<double,3> >& points,
+            std::vector< cpp11::array<int,3> >& facets,
+            bool verbose = false)
+  {
+    std::string s, solid("solid");
+    std::map<cpp11::array<double,3>, int> pmap;
+    int index = 0;
+    cpp11::array<int,3> ijk;
+    cpp11::array<double,3> p;
+
+    char line[80];
+    for(int i=0;i < 80; i++){
+      boost::uint8_t c;
+      input.read(reinterpret_cast<char*>(&c), sizeof(c));
+      line[i]=c;
+      if(i==5){
+        s = std::string(line,5);
+        if(s == solid){
+          break;
+        }
+      }
+    }
+
+    if(s!= solid){
+      boost::uint32_t N32;
+      input.read(reinterpret_cast<char*>(&N32), sizeof(N32));
+      unsigned int N = N32;
+
+      for(unsigned int i=0; i < N; i++){
+        float normal[3];
+        input.read(reinterpret_cast<char*>(&normal[0]), sizeof(normal[0]));
+        input.read(reinterpret_cast<char*>(&normal[1]), sizeof(normal[1]));
+        input.read(reinterpret_cast<char*>(&normal[2]), sizeof(normal[2]));
+
+        for(int j=0; j < 3; j++){
+          float x,y,z;
+          input.read(reinterpret_cast<char*>(&x), sizeof(x));
+          input.read(reinterpret_cast<char*>(&y), sizeof(y));
+          input.read(reinterpret_cast<char*>(&z), sizeof(z));
+          p[0]=x; p[1]=y; p[2]=z;
+          std::map<cpp11::array<double,3>, int>::iterator iti=
+            pmap.insert(std::make_pair(p,-1)).first;
+          if(iti->second==-1){
+            ijk[j] = index;
+            iti->second = index++;
+            points.push_back(p);
+          } else {
+            ijk[j] = iti->second;
+          }
+        }
+        if((ijk[0] != ijk[1]) && 
+           (ijk[0] != ijk[2]) &&
+           (ijk[1] != ijk[2])){
+          facets.push_back(ijk);
+        }else{
+          if(verbose){
+            std::cerr << "ignore degenerate face" << std::endl;
+          }
+        }
+        char c;
+        input.read(reinterpret_cast<char*>(&c), sizeof(c));
+        input.read(reinterpret_cast<char*>(&c), sizeof(c));
+      }
+      return true;
+    } else {
+      std::string facet("facet"),
+        outer("outer"),
+        loop("loop"),
+        vertex("vertex"),
+        endloop("endloop"),
+        endsolid("endsolid");
+
+      while(input >> s){
+        if(s == endsolid){
+          //std::cerr << "found endsolid" << std::endl;
+        } else if(s == facet){
+          //std::cerr << "found facet" << std::endl;
+          std::getline(input, s); // ignore the normal
+          input >> s;
+          if(s != outer){
+            if (verbose)
+              std::cerr << "Expect 'outer' and got " << s << std::endl;
+            return false;
+          }
+          input >> s;
+          if(s != loop){
+            if (verbose)
+              std::cerr << "Expect 'loop' and got " << s << std::endl;
+            return false;
+          }
+          int count = 0;
+          do {
+            input >> s;
+            if(s == vertex){
+              //      std::cerr << "found vertex" << std::endl;
+              if(count < 3){
+                input >> p[0] >> p[1] >> p[2];
+                std::map<cpp11::array<double,3>, int>::iterator iti=
+                  pmap.insert(std::make_pair(p,-1)).first;
+                if(iti->second==-1){
+                  ijk[count] = index;
+                  iti->second = index++;
+                  points.push_back(p);
+                } else {
+                  ijk[count] = iti->second;
+                }
+                ++count;
+              } else {
+                if (verbose)
+                  std::cerr << "We can only read triangulated surfaces" << std::endl;
+                return false;
+              }
+            }
+          }while(s != endloop);
+          
+          facets.push_back(ijk);
+        }
+      }
+      return true;
+    }
+  }
+} // namespace CGAL
+
+#endif // CGAL_IO_STL_READER_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Scanner_OFF.h b/3rdparty/CGAL/include/CGAL/IO/Scanner_OFF.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Scanner_OFF.h
rename to 3rdparty/CGAL/include/CGAL/IO/Scanner_OFF.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Tee_for_output_iterator.h b/3rdparty/CGAL/include/CGAL/IO/Tee_for_output_iterator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Tee_for_output_iterator.h
rename to 3rdparty/CGAL/include/CGAL/IO/Tee_for_output_iterator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Triangulation_geomview_ostream_2.h b/3rdparty/CGAL/include/CGAL/IO/Triangulation_geomview_ostream_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Triangulation_geomview_ostream_2.h
rename to 3rdparty/CGAL/include/CGAL/IO/Triangulation_geomview_ostream_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Triangulation_geomview_ostream_3.h b/3rdparty/CGAL/include/CGAL/IO/Triangulation_geomview_ostream_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Triangulation_geomview_ostream_3.h
rename to 3rdparty/CGAL/include/CGAL/IO/Triangulation_geomview_ostream_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Triangulation_ps_stream.h b/3rdparty/CGAL/include/CGAL/IO/Triangulation_ps_stream.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Triangulation_ps_stream.h
rename to 3rdparty/CGAL/include/CGAL/IO/Triangulation_ps_stream.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/VRML_1_ostream.h b/3rdparty/CGAL/include/CGAL/IO/VRML_1_ostream.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/VRML_1_ostream.h
rename to 3rdparty/CGAL/include/CGAL/IO/VRML_1_ostream.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/VRML_2_ostream.h b/3rdparty/CGAL/include/CGAL/IO/VRML_2_ostream.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/VRML_2_ostream.h
rename to 3rdparty/CGAL/include/CGAL/IO/VRML_2_ostream.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Verbose_ostream.h b/3rdparty/CGAL/include/CGAL/IO/Verbose_ostream.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Verbose_ostream.h
rename to 3rdparty/CGAL/include/CGAL/IO/Verbose_ostream.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/Writer_OFF.h b/3rdparty/CGAL/include/CGAL/IO/Writer_OFF.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/Writer_OFF.h
rename to 3rdparty/CGAL/include/CGAL/IO/Writer_OFF.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/alpha_shape_geomview_ostream_3.h b/3rdparty/CGAL/include/CGAL/IO/alpha_shape_geomview_ostream_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/alpha_shape_geomview_ostream_3.h
rename to 3rdparty/CGAL/include/CGAL/IO/alpha_shape_geomview_ostream_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/binary_file_io.h b/3rdparty/CGAL/include/CGAL/IO/binary_file_io.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/binary_file_io.h
rename to 3rdparty/CGAL/include/CGAL/IO/binary_file_io.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/generic_copy_OFF.h b/3rdparty/CGAL/include/CGAL/IO/generic_copy_OFF.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/generic_copy_OFF.h
rename to 3rdparty/CGAL/include/CGAL/IO/generic_copy_OFF.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/generic_print_polyhedron.h b/3rdparty/CGAL/include/CGAL/IO/generic_print_polyhedron.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/generic_print_polyhedron.h
rename to 3rdparty/CGAL/include/CGAL/IO/generic_print_polyhedron.h
diff --git a/3rdparty/CGAL/include/CGAL/IO/io.h b/3rdparty/CGAL/include/CGAL/IO/io.h
new file mode 100644
index 0000000..81c68f6
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/IO/io.h
@@ -0,0 +1,555 @@
+// Copyright (c) 1997  
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved. 
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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(s)     : Andreas Fabri
+
+
+#ifndef CGAL_IO_H
+#define CGAL_IO_H
+
+
+#include <cstdio>
+#include <cctype>
+#include <string>
+#include <locale>
+#include <iostream>
+#include <CGAL/tags.h>
+#include <CGAL/IO/io_tags.h>
+#include <CGAL/IO/Color.h>
+#include <CGAL/assertions.h>
+
+
+namespace CGAL {
+
+class IO {
+public:
+#ifndef CGAL_HEADER_ONLY
+  CGAL_EXPORT static int mode;
+  static int& get_static_mode()
+  { return IO::mode; }
+#else // CGAL_HEADER_ONLY
+  static int& get_static_mode()
+  {
+    static int mode = std::ios::xalloc();
+    return mode;
+  }
+#endif // CGAL_HEADER_ONLY
+    enum Mode {ASCII = 0, PRETTY, BINARY};
+};
+
+template <typename Dummy>
+struct IO_rep_is_specialized_aux
+{
+  static const bool is_specialized = true;
+};
+template< class Dummy >
+const bool IO_rep_is_specialized_aux<Dummy>::is_specialized;
+
+template <typename Dummy>
+struct IO_rep_is_not_specialized_aux
+{
+  static const bool is_specialized = false;
+};
+template< class Dummy >
+const bool IO_rep_is_not_specialized_aux<Dummy>::is_specialized;
+
+typedef IO_rep_is_specialized_aux<void>     IO_rep_is_specialized;
+typedef IO_rep_is_not_specialized_aux<void> IO_rep_is_not_specialized;
+
+template <class T, class F = ::CGAL::Null_tag >
+class Output_rep : public IO_rep_is_not_specialized {
+    const T& t;
+public:
+    //! initialize with a const reference to \a t.
+    Output_rep( const T& tt) : t(tt) {}
+    //! perform the output, calls \c operator\<\< by default.
+    std::ostream& operator()( std::ostream& out) const { return (out << t); }
+};
+
+/*! \relates Output_rep
+    \brief stream output of the \c Output_rep calls its \c operator().
+*/
+template <class T, class F>
+std::ostream&
+operator<<( std::ostream& out, Output_rep<T,F> rep) {
+    return rep( out);
+}
+
+//! generic IO output format manipulator.
+template <class T>
+Output_rep<T>
+oformat( const T& t) { return Output_rep<T>(t); }
+
+//! generic IO output format manipulator with formatting tag.
+template <class T, class F>
+Output_rep<T,F>
+oformat( const T& t, F) { return Output_rep<T,F>(t); }
+
+
+
+/*!\brief
+ * input functor class created by the generic IO input manipulator.
+ *
+ * It holds a reference to the input object. Default implementation
+ * calls the stream input operator. Specializations can be written
+ * for external types not supporting our stream IO format.
+ */
+template <class T>
+class Input_rep : public IO_rep_is_not_specialized {
+    T& t;
+public:
+    //! initialize with a reference to \a t.
+    Input_rep( T& tt) : t(tt) {}
+    //! perform the input, calls \c operator\>\> by default.
+    std::istream& operator()( std::istream& in) const { return (in >> t); }
+};
+
+#if CGAL_FORCE_IFORMAT_DOUBLE || \
+  ( ( _MSC_VER > 1600 ) && (! defined( CGAL_NO_IFORMAT_DOUBLE )) )
+template <>
+class Input_rep<double> : public IO_rep_is_specialized {
+    double& t;
+public:
+  //! initialize with a reference to \a t.
+  Input_rep( double& tt) : t(tt) {}
+
+  std::istream& operator()( std::istream& is) const 
+  {
+    typedef std::istream istream;
+    typedef istream::char_type char_type;
+    typedef istream::int_type int_type;
+    typedef istream::traits_type traits_type;
+
+    std::string buffer;
+    buffer.reserve(32);
+
+    char_type c;
+    do {
+      const int_type i = is.get();
+      if(i == traits_type::eof()) {
+	return is;
+      }
+      c = static_cast<char_type>(i);
+    }while (std::isspace(c));
+    if(c == '-'){
+      buffer += '-';
+    } else if(c != '+'){
+      is.unget();
+    }
+    do {
+      const int_type i = is.get();
+      if(i == traits_type::eof()) {
+	is.clear(is.rdstate() & ~std::ios_base::failbit);
+	break;
+      }
+      c = static_cast<char_type>(i);
+      if(std::isdigit(c) || (c =='.') || (c =='E') || (c =='e') || (c =='+') || (c =='-')){
+        buffer += c;
+      }else{
+	is.unget();
+	break;
+      }
+    }while(true);
+
+    if(sscanf(buffer.c_str(), "%lf", &t) != 1) {
+      // if a 'buffer' does not contain a double, set the fail bit.
+      is.setstate(std::ios_base::failbit);
+    }
+    return is; 
+  }
+};
+#endif
+
+/*! \relates Input_rep
+    \brief stream input to the \c Input_rep calls its \c operator().
+*/
+template <class T>
+std::istream&
+operator>>( std::istream& in, Input_rep<T> rep) {
+    return rep( in);
+}
+
+//! generic IO input format manipulator.
+template <class T>
+Input_rep<T>
+iformat( T& t) { return Input_rep<T>(t); }
+
+
+template <class T, class F = Null_tag >
+class Benchmark_rep {
+    const T& t;
+public:
+    //! initialize with a const reference to \a t.
+    Benchmark_rep( const T& tt) : t(tt) {}
+    //! perform the output, calls \c operator\<\< by default.
+    std::ostream& operator()( std::ostream& out) const {
+        return out << t;
+    }
+    
+    // static function to get the benchmark name
+    static std::string get_benchmark_name() {
+        return "";
+    }
+};
+
+template <class T, class F>
+std::ostream& operator<<( std::ostream& out, Benchmark_rep<T,F> rep) {
+    return rep( out);
+}
+
+template <class T>
+Benchmark_rep<T> bmformat( const T& t) { return Benchmark_rep<T>(t); }
+
+template <class T, class F>
+Benchmark_rep<T,F> bmformat( const T& t, F) { return Benchmark_rep<T,F>(t); }
+
+
+CGAL_EXPORT
+IO::Mode
+get_mode(std::ios& i);
+
+CGAL_EXPORT
+IO::Mode
+set_ascii_mode(std::ios& i);
+
+CGAL_EXPORT
+IO::Mode
+set_binary_mode(std::ios& i);
+
+CGAL_EXPORT
+IO::Mode
+set_pretty_mode(std::ios& i);
+
+CGAL_EXPORT
+IO::Mode
+set_mode(std::ios& i, IO::Mode m);
+
+CGAL_EXPORT
+bool
+is_pretty(std::ios& i);
+
+CGAL_EXPORT
+bool
+is_ascii(std::ios& i);
+
+CGAL_EXPORT
+bool
+is_binary(std::ios& i);
+
+
+template < class T >
+inline
+void
+write(std::ostream& os, const T& t, const io_Read_write&)
+{
+    os.write(reinterpret_cast<const char*>(&t), sizeof(t));
+}
+
+
+template < class T >
+inline
+void
+write(std::ostream& os, const T& t, const io_Operator&)
+{
+    os << oformat(t);
+}
+
+
+template < class T >
+inline
+void
+write(std::ostream& os, const T& t, const io_Extract_insert&)
+{
+    insert(os, t);
+}
+
+
+template < class T >
+inline
+void
+write(std::ostream& os, const T& t)
+{
+    write(os, t, typename Io_traits<T>::Io_tag());
+}
+
+
+template < class T >
+inline
+void
+read(std::istream& is, T& t, const io_Read_write&)
+{
+    is.read(reinterpret_cast<char*>(&t), sizeof(t));
+}
+
+
+template < class T >
+inline
+void
+read(std::istream& is, T& t, const io_Operator&)
+{
+    is >> iformat(t);
+}
+
+
+template < class T >
+inline
+void
+read(std::istream& is, T& t, const io_Extract_insert&)
+{
+    extract(is, t);
+}
+
+
+template < class T >
+inline
+void
+read(std::istream& is, T& t)
+{
+    read(is, t, typename Io_traits<T>::Io_tag());
+}
+
+
+inline
+std::ostream& operator<<( std::ostream& out, const Color& col)
+{
+    switch(get_mode(out)) {
+    case IO::ASCII :
+        return out << static_cast<int>(col.red())   << ' '
+		   << static_cast<int>(col.green()) << ' '
+		   << static_cast<int>(col.blue());
+    case IO::BINARY :
+        write(out, static_cast<int>(col.red()));
+        write(out, static_cast<int>(col.green()));
+        write(out, static_cast<int>(col.blue()));
+        return out;
+    default:
+        return out << "Color(" << static_cast<int>(col.red()) << ", "
+		   << static_cast<int>(col.green()) << ", "
+                   << static_cast<int>(col.blue()) << ')';
+    }
+}
+
+inline
+std::istream &operator>>(std::istream &is, Color& col)
+{
+    int r = 0, g = 0, b = 0;
+    switch(get_mode(is)) {
+    case IO::ASCII :
+        is >> r >> g >> b;
+        break;
+    case IO::BINARY :
+        read(is, r);
+        read(is, g);
+        read(is, b);
+        break;
+    default:
+        std::cerr << "" << std::endl;
+        std::cerr << "Stream must be in ascii or binary mode" << std::endl;
+        break;
+    }
+    col = Color((unsigned char)r,(unsigned char)g,(unsigned char)b);
+    return is;
+}
+
+CGAL_EXPORT
+const char* mode_name( IO::Mode m );
+
+// From polynomial.h TODO: Where to put this?
+CGAL_EXPORT
+void swallow(std::istream &is, char d);
+
+CGAL_EXPORT
+void swallow(std::istream &is, const std::string& s );
+
+
+  namespace internal {
+inline
+void eat_white_space(std::istream &is)
+{
+  std::istream::int_type c;
+  do {
+    c= is.peek();
+    if (c== std::istream::traits_type::eof())
+      return;
+    else {
+      std::istream::char_type cc= static_cast<std::istream::char_type>(c);
+      if ( std::isspace(cc, std::locale::classic()) ) {
+        is.get();
+        // since peek succeeded, this should too
+        CGAL_assertion(!is.fail());
+      } else {
+        return;
+      }
+    }
+  } while (true);
+}
+ 
+
+  inline
+  bool is_space (const std::istream& /*is*/, std::istream::int_type c)
+  {
+    return (c == std::istream::traits_type::eof()) ||
+      std::isspace(static_cast<std::istream::char_type>(c),
+                   std::locale::classic() );
+  }
+
+  inline
+  bool is_eof (const std::istream& /*is*/, std::istream::int_type c)
+  {
+    return c == std::istream::traits_type::eof();
+  }
+
+  inline
+  bool is_digit (const std::istream& /*is*/, std::istream::int_type c)
+  {
+    CGAL_assertion(c != std::istream::traits_type::eof());
+    return std::isdigit(static_cast<std::istream::char_type>(c),
+                        std::locale::classic() );
+  }
+
+  inline std::istream::int_type peek(std::istream& is)
+  {
+    // Workaround for a bug in the version of libc++ that is shipped with
+    // Apple-clang-3.2. See the long comment in the function
+    // gmpz_new_read() in <CGAL/GMP/Gmpz_type.h>.
+
+    if(is.eof())
+      return std::istream::traits_type::eof();
+    else
+      return is.peek();
+  }
+   
+    
+template <typename ET>
+inline void read_float_or_quotient(std::istream & is, ET& et)
+{
+  is >> et;
+}   
+
+
+
+template <typename Int, typename Rat>
+inline void read_float_or_quotient(std::istream& is, Rat &z)
+{
+  // reads rational and floating point literals.
+  const std::istream::char_type zero = '0';
+  std::istream::int_type c;
+  std::ios::fmtflags old_flags = is.flags();
+
+  is.unsetf(std::ios::skipws);
+  internal::eat_white_space(is);
+
+  Int n(0);             // unsigned number before '/' or '.'
+  Int d(1);             // number after '/', or denominator (fp-case)
+  bool negative = false; // do we have a leading '-'?
+  bool digits = false;   // for fp-case: are there any digits at all?
+
+  c = internal::peek(is);
+  if (c != '.') {
+    // is there a sign?
+    if (c == '-' || c == '+') {
+      is.get();
+      negative = (c == '-');
+      internal::eat_white_space(is);
+      c=internal::peek(is);
+    }
+    // read n (could be empty)
+    while (!internal::is_eof(is, c) && internal::is_digit(is, c)) {
+      digits = true;
+      n = n*10 + (c-zero);
+      is.get();
+      c = internal::peek(is);
+    }
+    // are we done?
+    if (internal::is_eof(is, c) || internal::is_space(is, c)) {
+      is.flags(old_flags);
+      if (digits && !is.fail())
+        z = negative? Rat(-n,1): Rat(n,1);
+      return;
+    }
+  } else
+    n = 0;
+
+  // now we have read n, we are not done, and c is the next character
+  // in the stream
+  if (c == '/' || c == '.') {
+    is.get();
+    if (c == '/') {
+      // rational case
+      is >> d;
+      is.flags(old_flags);
+      if (!is.fail())
+        z = negative? Rat(-n,d): Rat(n,d);
+      return;
+    }
+
+    // floating point case; read number after '.' (may be empty)
+    while (true) {
+      c = internal::peek(is);
+      if (internal::is_eof(is, c) || !internal::is_digit(is, c))
+        break;
+      // now we have a digit
+      is.get();
+      digits = true;
+      d *= 10;
+      n = n*10 + (c-zero);
+    }
+  }
+
+  // now we have read all digits after '.', and c is the next character;
+  // read the exponential part (optional)
+  int e = 0;
+  if (c == 'e' || c == 'E') {
+    is.get();
+    is >> e;
+  }
+
+  // now construct the Gmpq
+  if (!digits) {
+    // illegal floating-point number
+    is.setstate(std::ios_base::failbit);
+    is.flags(old_flags);
+    return;
+  }
+
+  // handle e
+  if (e > 0)
+    while (e--) n *= 10;
+  else
+    while (e++) d *= 10;
+  is.flags(old_flags);
+  if (!is.fail())
+    z = (negative ? Rat(-n,d) : Rat(n,d));
+
+} 
+    
+    
+  } // namespace internal
+
+} //namespace CGAL
+
+
+#ifdef CGAL_HEADER_ONLY
+#include <CGAL/IO/io_impl.h>
+#endif // CGAL_HEADER_ONLY
+
+#endif // CGAL_IO_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/io_impl.h b/3rdparty/CGAL/include/CGAL/IO/io_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/io_impl.h
rename to 3rdparty/CGAL/include/CGAL/IO/io_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/io_tags.h b/3rdparty/CGAL/include/CGAL/IO/io_tags.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/io_tags.h
rename to 3rdparty/CGAL/include/CGAL/IO/io_tags.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/output_surface_facets_to_polyhedron.h b/3rdparty/CGAL/include/CGAL/IO/output_surface_facets_to_polyhedron.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/output_surface_facets_to_polyhedron.h
rename to 3rdparty/CGAL/include/CGAL/IO/output_surface_facets_to_polyhedron.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/output_surface_facets_to_triangle_soup.h b/3rdparty/CGAL/include/CGAL/IO/output_surface_facets_to_triangle_soup.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/output_surface_facets_to_triangle_soup.h
rename to 3rdparty/CGAL/include/CGAL/IO/output_surface_facets_to_triangle_soup.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/print_OFF.h b/3rdparty/CGAL/include/CGAL/IO/print_OFF.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/print_OFF.h
rename to 3rdparty/CGAL/include/CGAL/IO/print_OFF.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/print_VRML_1.h b/3rdparty/CGAL/include/CGAL/IO/print_VRML_1.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/print_VRML_1.h
rename to 3rdparty/CGAL/include/CGAL/IO/print_VRML_1.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/print_VRML_2.h b/3rdparty/CGAL/include/CGAL/IO/print_VRML_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/print_VRML_2.h
rename to 3rdparty/CGAL/include/CGAL/IO/print_VRML_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/print_inventor.h b/3rdparty/CGAL/include/CGAL/IO/print_inventor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/print_inventor.h
rename to 3rdparty/CGAL/include/CGAL/IO/print_inventor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/print_wavefront.h b/3rdparty/CGAL/include/CGAL/IO/print_wavefront.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/print_wavefront.h
rename to 3rdparty/CGAL/include/CGAL/IO/print_wavefront.h
diff --git a/3rdparty/CGAL/include/CGAL/IO/read_off_points.h b/3rdparty/CGAL/include/CGAL/IO/read_off_points.h
new file mode 100644
index 0000000..e03e01e
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/IO/read_off_points.h
@@ -0,0 +1,416 @@
+// Copyright (c) 2007-09  INRIA Sophia-Antipolis (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
+// 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(s) : Pierre Alliez and Laurent Saboret
+
+#ifndef CGAL_READ_OFF_POINTS_H
+#define CGAL_READ_OFF_POINTS_H
+
+#include <CGAL/property_map.h>
+#include <CGAL/value_type_traits.h>
+#include <CGAL/point_set_processing_assertions.h>
+
+#include <iostream>
+#include <sstream>
+#include <string>
+
+namespace CGAL {
+
+
+//===================================================================================
+/// \ingroup PkgPointSetProcessing
+/// Reads points (positions + normals, if available) from a .off ASCII stream.
+/// The function expects for each point a line with the x y z position,
+/// optionally followed by the nx ny nz normal.
+/// Faces are ignored.
+///
+/// @tparam OutputIteratorValueType type of objects that can be put in `OutputIterator`.
+///         It is default to `value_type_traits<OutputIterator>::%type` and can be omitted when the default is fine.
+/// @tparam OutputIterator iterator over output points.
+/// @tparam PointPMap is a model of `WritablePropertyMap` with  value type `Point_3<Kernel>`.
+///        It can be omitted if the value type of `OutputIterator` is convertible to `Point_3<Kernel>`.
+/// @tparam NormalPMap is a model of `WritablePropertyMap` with value type `Vector_3<Kernel>`.
+/// @tparam Kernel Geometric traits class.
+///        It can be omitted and deduced automatically from the value type of `PointPMap`.
+///
+/// @return true on success.
+
+// This variant requires all parameters.
+//-----------------------------------------------------------------------------------
+template <typename OutputIteratorValueType,
+          typename OutputIterator,
+          typename PointPMap,
+          typename NormalPMap,
+          typename Kernel
+>
+bool
+read_off_points_and_normals(
+    std::istream& stream, ///< input stream.
+    OutputIterator output, ///< output iterator over points.
+    PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
+    NormalPMap normal_pmap, ///< property map: value_type of OutputIterator -> Vector_3.
+    const Kernel& /*kernel*/) ///< geometric traits.
+{
+  // value_type_traits is a workaround as back_insert_iterator's value_type is void
+  // typedef typename value_type_traits<OutputIterator>::type Enriched_point;
+  typedef OutputIteratorValueType Enriched_point;
+
+  typedef typename Kernel::Point_3 Point;
+  typedef typename Kernel::Vector_3 Vector;
+
+  if(!stream)
+  {
+    std::cerr << "Error: cannot open file" << std::endl;
+    return false;
+  }
+
+  // scan points
+  long pointsCount = 0, facesCount = 0, edgesCount = 0; // number of items in file
+  int pointsRead = 0; // current number of points read
+  int lineNumber = 0; // current line number
+  std::string line;
+  std::istringstream iss;
+  while(getline(stream,line))
+  {
+    iss.clear();
+    iss.str(line);
+
+    // Ignore empty lines and comments
+    if (line.empty () || line[0] == '#')
+      continue;
+
+    lineNumber++;
+
+    // Reads file signature on first line
+    if (lineNumber == 1)
+    {
+      std::string signature;
+      if ( !(iss >> signature)
+        || (signature != "OFF" && signature != "NOFF") )
+      {
+        // if wrong file format
+        std::cerr << "Incorrect file format line " << lineNumber << " of file" << std::endl;
+        return false;
+      }
+    }
+
+    // Reads number of points on 2nd line
+    else if (lineNumber == 2)
+    {
+      if ( !(iss >> pointsCount >> facesCount >> edgesCount) )
+      {
+        std::cerr << "Error line " << lineNumber << " of file" << std::endl;
+        return false;
+      }
+    }
+
+    // Reads 3D points on next lines
+    else if (pointsRead < pointsCount)
+    {
+      // Reads position + normal...
+      double x,y,z;
+      double nx,ny,nz;
+      if (iss >> iformat(x) >> iformat(y) >> iformat(z))
+      {
+        Point point(x,y,z);
+        Vector normal = CGAL::NULL_VECTOR;
+        // ... + normal...
+        if (iss >> iformat(nx))
+        {
+          // In case we could read one number, we expect that there are two more
+          if(iss  >> iformat(ny) >> iformat(nz)){
+            normal = Vector(nx,ny,nz);
+          } else {
+            std::cerr << "Error line " << lineNumber << " of file" << std::endl;
+            return false;
+          }
+        }
+        Enriched_point pwn;
+        put(point_pmap,  pwn, point);  // point_pmap[&pwn] = point
+        put(normal_pmap, pwn, normal); // normal_pmap[&pwn] = normal
+        *output++ = pwn;
+        pointsRead++;
+      }
+      // ...or skip comment line
+    }
+    // Skip remaining lines
+  }
+
+  return true;
+}
+
+/// @cond SKIP_IN_MANUAL
+template <typename OutputIterator,
+          typename PointPMap,
+          typename NormalPMap,
+          typename Kernel
+>
+bool
+read_off_points_and_normals(
+  std::istream& stream, ///< input stream.
+  OutputIterator output, ///< output iterator over points.
+  PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
+  NormalPMap normal_pmap, ///< property map: value_type of OutputIterator -> Vector_3.
+  const Kernel& kernel) ///< geometric traits.
+{
+  // just deduce value_type of OutputIterator
+  return read_off_points_and_normals
+    <typename value_type_traits<OutputIterator>::type>(
+    stream,
+    output,
+    point_pmap,
+    normal_pmap,
+    kernel);
+}
+//-----------------------------------------------------------------------------------
+/// @endcond
+
+/// @cond SKIP_IN_MANUAL
+// This variant deduces the kernel from the point property map.
+//-----------------------------------------------------------------------------------
+template <typename OutputIteratorValueType,
+          typename OutputIterator,
+          typename PointPMap,
+          typename NormalPMap
+>
+bool
+read_off_points_and_normals(
+  std::istream& stream, ///< input stream.
+  OutputIterator output, ///< output iterator over points.
+  PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
+  NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
+{
+  typedef typename boost::property_traits<PointPMap>::value_type Point;
+  typedef typename Kernel_traits<Point>::Kernel Kernel;
+  return read_off_points_and_normals
+    <OutputIteratorValueType>(
+    stream,
+    output,
+    point_pmap,
+    normal_pmap,
+    Kernel());
+}
+
+template <typename OutputIterator,
+          typename PointPMap,
+          typename NormalPMap
+>
+bool
+read_off_points_and_normals(
+  std::istream& stream, ///< input stream.
+  OutputIterator output, ///< output iterator over points.
+  PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
+  NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
+{
+  // just deduce value_type of OutputIterator
+  return read_off_points_and_normals
+    <typename value_type_traits<OutputIterator>::type>(
+    stream,
+    output,
+    point_pmap,
+    normal_pmap);
+}
+//-----------------------------------------------------------------------------------
+/// @endcond
+
+/// @cond SKIP_IN_MANUAL
+// This variant creates a default point property map = Identity_property_map.
+//-----------------------------------------------------------------------------------
+template <typename OutputIteratorValueType,
+          typename OutputIterator,
+          typename NormalPMap
+>
+bool
+read_off_points_and_normals(
+  std::istream& stream, ///< input stream.
+  OutputIterator output, ///< output iterator over points.
+  NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
+{
+  return read_off_points_and_normals
+    <OutputIteratorValueType>(
+    stream,
+    output,
+    make_identity_property_map(OutputIteratorValueType()),
+    normal_pmap);
+}
+
+template <typename OutputIterator,
+          typename NormalPMap
+>
+bool
+read_off_points_and_normals(
+  std::istream& stream, ///< input stream.
+  OutputIterator output, ///< output iterator over points.
+  NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
+{
+  // just deduce value_type of OutputIterator
+  return read_off_points_and_normals
+    <typename value_type_traits<OutputIterator>::type>(
+    stream,
+    output,
+    normal_pmap);
+}
+//-----------------------------------------------------------------------------------
+/// @endcond
+
+
+//===================================================================================
+/// \ingroup PkgPointSetProcessing
+/// Reads points (position only) from a .off ASCII stream.
+/// The function expects for each point a line with the x y z position.
+/// If the position is followed by the nx ny nz normal, then the normal will be ignored.
+/// Faces are ignored.
+///
+/// @tparam OutputIteratorValueType type of objects that can be put in `OutputIterator`.
+///         It is default to `value_type_traits<OutputIterator>::%type` and can be omitted when the default is fine.
+/// @tparam OutputIterator iterator over output points.
+/// @tparam PointPMap is a model of `WritablePropertyMap` with  value_type `Point_3<Kernel>`.
+///        It can be omitted if the value type of `OutputIterator` is convertible to `Point_3<Kernel>`.
+/// @tparam Kernel Geometric traits class.
+///        It can be omitted and deduced automatically from  the value type of `PointPMap`.
+///
+/// @return `true` on success.
+
+// This variant requires all parameters.
+//-----------------------------------------------------------------------------------
+template <typename OutputIteratorValueType,
+          typename OutputIterator,
+          typename PointPMap,
+          typename Kernel
+>
+bool
+read_off_points(
+  std::istream& stream, ///< input stream.
+  OutputIterator output, ///< output iterator over points.
+  PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
+  const Kernel& kernel) ///< geometric traits.
+{
+  // Calls read_off_points_and_normals() with a normal property map = boost::dummy_property_map
+  return read_off_points_and_normals
+    <OutputIteratorValueType>(
+    stream,
+    output,
+    point_pmap,
+    boost::dummy_property_map(),
+    kernel);
+}
+
+/// @cond SKIP_IN_MANUAL
+template <typename OutputIterator,
+          typename PointPMap,
+          typename Kernel
+>
+bool
+read_off_points(
+  std::istream& stream, ///< input stream.
+  OutputIterator output, ///< output iterator over points.
+  PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
+  const Kernel& kernel) ///< geometric traits.
+{
+  // just deduce value_type of OutputIterator
+  return read_off_points
+    <typename value_type_traits<OutputIterator>::type>(
+    stream,
+    output,
+    point_pmap,
+    kernel);
+}
+//-----------------------------------------------------------------------------------
+/// @endcond
+
+/// @cond SKIP_IN_MANUAL
+// This variant deduces the kernel from the point property map.
+//-----------------------------------------------------------------------------------
+template <typename OutputIteratorValueType,
+          typename OutputIterator,
+          typename PointPMap
+>
+bool
+read_off_points(
+  std::istream& stream, ///< input stream.
+  OutputIterator output, ///< output iterator over points.
+  PointPMap point_pmap) ///< property map: value_type of OutputIterator -> Point_3.
+{
+  typedef typename boost::property_traits<PointPMap>::value_type Point;
+  typedef typename Kernel_traits<Point>::Kernel Kernel;
+  return read_off_points
+    <OutputIteratorValueType>(
+    stream,
+    output,
+    point_pmap,
+    Kernel());
+}
+
+template <typename OutputIterator,
+          typename PointPMap
+>
+bool
+read_off_points(
+  std::istream& stream, ///< input stream.
+  OutputIterator output, ///< output iterator over points.
+  PointPMap point_pmap) ///< property map: value_type of OutputIterator -> Point_3.
+{
+  // just deduce value_type of OutputIterator
+  return read_off_points
+    <typename value_type_traits<OutputIterator>::type>(
+    stream,
+    output,
+    point_pmap);
+}
+//-----------------------------------------------------------------------------------
+/// @endcond
+
+/// @cond SKIP_IN_MANUAL
+// This variant creates a default point property map = Identity_property_map.
+//-----------------------------------------------------------------------------------
+template <typename OutputIteratorValueType,
+          typename OutputIterator
+>
+bool
+read_off_points(
+  std::istream& stream, ///< input stream.
+  OutputIterator output) ///< output iterator over points.
+{
+  return read_off_points
+    <OutputIteratorValueType>(
+    stream,
+    output,
+    make_identity_property_map(OutputIteratorValueType())
+    );
+}
+
+template <typename OutputIterator
+>
+bool
+read_off_points(
+  std::istream& stream, ///< input stream.
+  OutputIterator output) ///< output iterator over points.
+{
+  // just deduce value_type of OutputIterator
+  return read_off_points
+    <typename value_type_traits<OutputIterator>::type>(
+    stream,
+    output);
+}
+//-----------------------------------------------------------------------------------
+
+/// @endcond
+
+
+} //namespace CGAL
+
+#endif // CGAL_READ_OFF_POINTS_H
diff --git a/3rdparty/CGAL/include/CGAL/IO/read_ply_points.h b/3rdparty/CGAL/include/CGAL/IO/read_ply_points.h
new file mode 100644
index 0000000..6055d35
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/IO/read_ply_points.h
@@ -0,0 +1,771 @@
+// Copyright (c) 2015  Geometry Factory
+// 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
+// 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(s) : Simon Giraudot
+
+#ifndef CGAL_READ_PLY_POINTS_H
+#define CGAL_READ_PLY_POINTS_H
+
+#include <CGAL/property_map.h>
+#include <CGAL/value_type_traits.h>
+#include <CGAL/point_set_processing_assertions.h>
+#include <CGAL/Kernel_traits.h>
+
+#include <boost/version.hpp>
+#include <boost/cstdint.hpp>
+
+#include <iostream>
+#include <sstream>
+#include <string>
+
+
+namespace CGAL {
+
+
+// PLY types:
+// name        type        number of bytes
+// ---------------------------------------
+// char       character                 1
+// uchar      unsigned character        1
+// short      short integer             2
+// ushort     unsigned short integer    2
+// int        integer                   4
+// uint       unsigned integer          4
+// float      single-precision float    4
+// double     double-precision float    8
+
+/// \cond SKIP_IN_MANUAL
+
+namespace internal {
+
+  class Ply_read_number
+  {
+  protected:
+    std::string m_name;
+    std::size_t m_format;
+    
+  public:
+    Ply_read_number (std::string name, std::size_t format)
+      : m_name (name), m_format (format) { }
+    virtual ~Ply_read_number() { }
+
+    const std::string& name () const { return m_name; }
+
+    virtual void get (std::istream& stream) const = 0;
+
+    // The two following functions prevent the stream to only extract
+    // ONE character (= what the types char imply) by requiring
+    // explicitely an integer object when reading the stream
+    void read_ascii (std::istream& stream, boost::int8_t& c) const
+    {
+      short s;
+      stream >> s;
+      c = static_cast<char>(s);
+    }
+    void read_ascii (std::istream& stream, boost::uint8_t& c) const
+    {
+      unsigned short s;
+      stream >> s;
+      c = static_cast<unsigned char>(s);
+    }
+
+    // Default template when Type is not a char type
+    template <typename Type>
+    void read_ascii (std::istream& stream, Type& t) const
+    {
+      stream >> t;
+    }
+    
+    template <typename Type>
+    Type read (std::istream& stream) const
+    {
+      if (m_format == 0) // Ascii
+        {
+          Type t;
+          read_ascii (stream, t);
+          return t;
+        }
+      else // Binary (2 = little endian)
+        {
+          union
+          {
+            char uChar[sizeof (Type)];
+            Type type;
+          } buffer;
+          
+          std::size_t size = sizeof (Type);
+
+          stream.read(buffer.uChar, size);
+      
+          if (m_format == 2) // Big endian
+            {
+              for (std::size_t i = 0; i < size / 2; ++ i)
+                {
+                  unsigned char tmp = buffer.uChar[i];
+                  buffer.uChar[i] = buffer.uChar[size - 1 - i];
+                  buffer.uChar[size - 1 - i] = tmp;
+                }
+            }
+          return buffer.type;
+        }
+      return Type();
+    }
+  };
+
+  template <typename Type>
+  class Ply_read_typed_number : public Ply_read_number
+  {
+    mutable Type m_buffer;
+  public:
+    Ply_read_typed_number (std::string name, std::size_t format)
+      : Ply_read_number (name, format)
+    {
+    }
+    void get (std::istream& stream) const
+    {
+      m_buffer = (this->read<Type> (stream));
+    }
+    const Type& buffer() const
+    {
+      return m_buffer;
+    }
+  };
+  
+} // namespace internal
+  
+
+/// \endcond
+
+
+
+//===================================================================================
+/// \ingroup PkgPointSetProcessing
+///
+/// The PLY reader is initialized with the correct set of properties (along
+/// with their name tags and number types) based on the header of the PLY input
+/// file. It loads all the points with their specific properties of the PLY
+/// input and delegates the interpretation to a user-specified `PlyInterpreter`.
+///
+//-----------------------------------------------------------------------------------
+class Ply_reader
+{
+
+  std::vector<internal::Ply_read_number*> m_readers;
+  std::size_t m_nb_points;
+
+public:
+  
+  /// \cond SKIP_IN_MANUAL
+  Ply_reader () : m_nb_points (0) { }
+
+  template <typename Stream>
+  bool init (Stream& stream)
+  {
+    std::size_t lineNumber = 0; // current line number
+    enum Format { ASCII = 0, BINARY_LITTLE_ENDIAN = 1, BINARY_BIG_ENDIAN = 2};
+    Format format = ASCII;
+    
+    std::string line;
+    std::istringstream iss;
+
+    // Check the order of the properties of the point set
+    bool reading_properties = false;
+  
+    while (getline (stream,line))
+      {
+        iss.clear();
+        iss.str (line);
+        ++ lineNumber;
+
+        // Reads file signature on first line
+        if (lineNumber == 1)
+          {
+            std::string signature;
+            if (!(iss >> signature) || (signature != "ply"))
+              {
+                // if wrong file format
+                std::cerr << "Error: incorrect file format line " << lineNumber << " of file" << std::endl;
+                return false;
+              }
+          }
+
+        // Reads format on 2nd line
+        else if (lineNumber == 2)
+          {
+            std::string tag, format_string, version;
+            if ( !(iss >> tag >> format_string >> version) )
+              {
+                std::cerr << "Error line " << lineNumber << " of file" << std::endl;
+                return false;
+              }
+            if (format_string == "ascii") format = ASCII;
+            else if (format_string == "binary_little_endian") format = BINARY_LITTLE_ENDIAN;
+            else if (format_string == "binary_big_endian") format = BINARY_BIG_ENDIAN;
+            else
+              {
+                std::cerr << "Error: unknown file format \"" << format_string << "\" line " << lineNumber << std::endl;
+                return false;
+              }
+          }
+
+        // Comments and vertex properties
+        else
+          {
+            std::string keyword;
+            if (!(iss >> keyword))
+              {
+                std::cerr << "Error line " << lineNumber << " of file" << std::endl;
+                return false;
+              }
+
+            if (keyword == "property")
+              {
+                if (!reading_properties)
+                  continue;
+
+                std::string type, name;
+                if (!(iss >> type >> name))
+                  {
+                    std::cerr << "Error line " << lineNumber << " of file" << std::endl;
+                    return false;
+                  }
+
+                if (     type == "char"   || type == "int8")
+                  m_readers.push_back (new internal::Ply_read_typed_number<boost::int8_t> (name, format));
+                else if (type == "uchar"  || type == "uint8")
+                  m_readers.push_back (new internal::Ply_read_typed_number<boost::uint8_t> (name, format));
+                else if (type == "short"  || type == "int16")
+                  m_readers.push_back (new internal::Ply_read_typed_number<boost::int16_t> (name, format));
+                else if (type == "ushort" || type == "uint16")
+                  m_readers.push_back (new internal::Ply_read_typed_number<boost::uint16_t> (name, format));
+                else if (type == "int"    || type == "int32")
+                  m_readers.push_back (new internal::Ply_read_typed_number<boost::int32_t> (name, format));
+                else if (type == "uint"   || type == "uint32")
+                  m_readers.push_back (new internal::Ply_read_typed_number<boost::uint32_t> (name, format));
+                else if (type == "float"  || type == "float32")
+                  m_readers.push_back (new internal::Ply_read_typed_number<float> (name, format));
+                else if (type == "double" || type == "float64")
+                  m_readers.push_back (new internal::Ply_read_typed_number<double> (name, format));
+                
+                continue;
+              }
+            else
+              reading_properties = false;
+            
+            // ignore comments and properties (if not in element
+            // vertex - cf below - properties are useless in our case)
+            if (keyword == "comment" || keyword == "property")
+              continue;
+
+            // When end_header is reached, stop loop and begin reading points
+            if (keyword == "end_header")
+              break;
+            
+            if (keyword == "element")
+              {
+                std::string type;
+                std::size_t number;
+                if (!(iss >> type >> number))
+                  {
+                    std::cerr << "Error line " << lineNumber << " of file" << std::endl;
+                    return false;
+                  }
+                
+                if (type == "vertex")
+                  {
+                    m_nb_points = number;
+                    reading_properties = true;
+                  }
+                else
+                  continue;
+              }
+            
+          }
+      }
+    return true;
+  }
+
+  ~Ply_reader ()
+  {
+    for (std::size_t i = 0; i < m_readers.size (); ++ i)
+      delete m_readers[i];
+    m_readers.clear();
+  }
+
+  template <typename Stream, typename PlyInterpreter>
+  bool read_content (Stream& stream, PlyInterpreter& interpreter)
+  {
+    std::size_t points_read = 0;
+    
+    while (!(stream.eof()) && points_read < m_nb_points)
+      {
+        for (std::size_t i = 0; i < m_readers.size (); ++ i)
+          m_readers[i]->get (stream);
+
+        interpreter.process_line (*this);
+
+        ++ points_read;
+      }
+    // Skip remaining lines
+
+    return (points_read == m_nb_points);
+  }
+  /// \endcond
+  
+  /*!
+    \tparam Type type of the property (ex: double, float, unsigned char, etc.)
+    \param tag name of the property (ex: _nx_ for x normal coordinate)
+
+    \return true if points inside the PLY input contain the property
+    `tag` with type `Type`, false otherwise
+  */
+  template <typename Type>
+  bool does_tag_exist (const char* tag)
+  {
+    return does_tag_exist (tag, Type());
+  }
+
+  /*!
+    \param t reference to store last read value of the property `tag`
+    \param tag name of the required property
+  */
+  template <typename Type>
+  void assign (Type& t, const char* tag)
+  {
+    for (std::size_t i = 0; i < m_readers.size (); ++ i)
+      if (m_readers[i]->name () == tag)
+        {
+          internal::Ply_read_typed_number<Type>*
+            reader = dynamic_cast<internal::Ply_read_typed_number<Type>*>(m_readers[i]);
+          CGAL_assertion (reader != NULL);
+          t = reader->buffer();
+          return;
+        }
+  }
+
+  /// \cond SKIP_IN_MANUAL
+  
+  // Convenience functions: a float property in the PLY input can be
+  // directly interpreted as a double without loss of information.
+  template <typename Type>
+  bool does_tag_exist (const char* tag, Type)
+  {
+    for (std::size_t i = 0; i < m_readers.size (); ++ i)
+      if (m_readers[i]->name () == tag)
+        return (dynamic_cast<internal::Ply_read_typed_number<Type>*>(m_readers[i]) != NULL);
+    return false;
+  }
+  bool does_tag_exist (const char* tag, double)
+  {
+    for (std::size_t i = 0; i < m_readers.size (); ++ i)
+      if (m_readers[i]->name () == tag)
+        return (dynamic_cast<internal::Ply_read_typed_number<double>*>(m_readers[i]) != NULL
+                || dynamic_cast<internal::Ply_read_typed_number<float>*>(m_readers[i]) != NULL);
+
+    return false;
+  }
+  void assign (double& t, const char* tag)
+  {
+    for (std::size_t i = 0; i < m_readers.size (); ++ i)
+      if (m_readers[i]->name () == tag)
+        {
+          internal::Ply_read_typed_number<double>*
+            reader_double = dynamic_cast<internal::Ply_read_typed_number<double>*>(m_readers[i]);
+          if (reader_double == NULL)
+            {
+              internal::Ply_read_typed_number<float>*
+                reader_float = dynamic_cast<internal::Ply_read_typed_number<float>*>(m_readers[i]);
+              CGAL_assertion (reader_float != NULL);
+              t = reader_float->buffer();
+            }
+          else
+            t = reader_double->buffer();
+          
+          return;
+        }
+  }
+  /// \endcond
+  
+};
+
+//===================================================================================
+/// \ingroup PkgPointSetProcessing
+///
+/// PLY interpreter designed to fill an output iterator of points and
+/// normals based on given property maps. It is used internally by the
+/// functions `read_ply_points()` and `read_ply_points_and_normals()`.
+///
+/// @tparam OutputIteratorValueType type of objects that can be put in `OutputIterator`.
+/// @tparam OutputIterator iterator over output points.
+/// @tparam PointPMap is a model of `WritablePropertyMap` with  value type `Point_3<Kernel>`.
+/// @tparam NormalPMap is a model of `WritablePropertyMap` with value type `Vector_3<Kernel>`.
+/// @tparam Kernel Geometric traits class.
+///
+/// \cgalModels `PlyInterpreter`
+//-----------------------------------------------------------------------------------
+
+template <typename OutputIteratorValueType,
+          typename OutputIterator,
+          typename PointPMap,
+          typename NormalPMap,
+          typename Kernel>
+class Ply_interpreter_points_and_normals_3
+{
+  // value_type_traits is a workaround as back_insert_iterator's value_type is void
+  // typedef typename value_type_traits<OutputIterator>::type Enriched_point;
+  typedef OutputIteratorValueType Enriched_point;
+  typedef typename Kernel::FT FT;
+  typedef typename Kernel::Point_3 Point;
+  typedef typename Kernel::Vector_3 Vector;
+    
+  OutputIterator m_output;
+  PointPMap& m_point_pmap;
+  NormalPMap& m_normal_pmap;
+  
+public:
+  /*!
+    Constructs a PLY interpreter for points and normals.
+   */
+  Ply_interpreter_points_and_normals_3 (OutputIterator output,
+                                        PointPMap& point_pmap,
+                                        NormalPMap& normal_pmap)
+    : m_output (output),
+      m_point_pmap (point_pmap),
+      m_normal_pmap (normal_pmap)
+  { }
+
+  bool is_applicable (Ply_reader& reader)
+  {
+    return reader.does_tag_exist<FT> ("x")
+      && reader.does_tag_exist<FT> ("y")
+      && reader.does_tag_exist<FT> ("z");
+  }
+  
+  void process_line (Ply_reader& reader)
+  {
+    FT x = (FT)0.,y = (FT)0., z = (FT)0.,
+      nx = (FT)0., ny = (FT)0., nz = (FT)0.;
+    reader.assign (x, "x");
+    reader.assign (y, "y");
+    reader.assign (z, "z");
+    reader.assign (nx, "nx");
+    reader.assign (ny, "ny");
+    reader.assign (nz, "nz");
+
+    Point point (x, y, z);
+    Vector normal (nx, ny, nz);
+    Enriched_point pwn;
+      
+    put(m_point_pmap,  pwn, point);  // point_pmap[&pwn] = point
+    put(m_normal_pmap, pwn, normal); // normal_pmap[&pwn] = normal
+    *m_output++ = pwn;
+  }
+
+};
+
+
+
+//===================================================================================
+/// \ingroup PkgPointSetProcessing
+/// Reads points from a .ply stream (ASCII or binary) using a custom
+/// interpreter provided by the user.
+///
+/// @tparam PlyInterpreter Interpreter of Ply input, must be a model of `PlyInterpreter`
+/// @tparam Kernel Geometric traits class.
+///
+/// @return true on success.
+//-----------------------------------------------------------------------------------
+template < typename PlyInterpreter,
+           typename Kernel >
+bool read_ply_custom_points(std::istream& stream, ///< input stream.
+                            PlyInterpreter& interpreter, ///< Custom PLY interpreter
+                            const Kernel& /* kernel */) ///< geometric traits.
+{
+  if(!stream)
+    {
+      std::cerr << "Error: cannot open file" << std::endl;
+      return false;
+    }
+
+  Ply_reader reader;
+  
+  if (!(reader.init (stream)))
+    return false;
+  
+  if (!(interpreter.is_applicable (reader)))
+    {
+      std::cerr << "Error: PLY interpreter is not applicable to input file" << std::endl;
+      return false;
+    }
+
+  return reader.read_content (stream, interpreter);
+}
+
+
+
+//===================================================================================
+/// \ingroup PkgPointSetProcessing
+/// Reads points (positions + normals, if available) from a .ply
+/// stream (ASCII or binary).
+/// Potential additional point properties and faces are ignored.
+///
+/// @tparam OutputIteratorValueType type of objects that can be put in `OutputIterator`.
+///         It is default to `value_type_traits<OutputIterator>::%type` and can be omitted when the default is fine.
+/// @tparam OutputIterator iterator over output points.
+/// @tparam PointPMap is a model of `WritablePropertyMap` with  value type `Point_3<Kernel>`.
+///        It can be omitted if the value type of `OutputIterator` is convertible to `Point_3<Kernel>`.
+/// @tparam NormalPMap is a model of `WritablePropertyMap` with value type `Vector_3<Kernel>`.
+/// @tparam Kernel Geometric traits class.
+///        It can be omitted and deduced automatically from the value type of `PointPMap`.
+///
+/// @return true on success.
+
+// This variant requires all parameters.
+//-----------------------------------------------------------------------------------
+template < typename OutputIteratorValueType,
+           typename OutputIterator,
+           typename PointPMap,
+           typename NormalPMap,
+           typename Kernel >
+bool read_ply_points_and_normals(std::istream& stream, ///< input stream.
+                                 OutputIterator output, ///< output iterator over points.
+                                 PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
+                                 NormalPMap normal_pmap, ///< property map: value_type of OutputIterator -> Vector_3.
+                                 const Kernel& kernel) ///< geometric traits.
+{
+  Ply_interpreter_points_and_normals_3
+    <OutputIteratorValueType, OutputIterator, PointPMap, NormalPMap, Kernel>
+    interpreter (output, point_pmap, normal_pmap);
+
+  return read_ply_custom_points (stream, interpreter, kernel);
+}
+
+/// @cond SKIP_IN_MANUAL
+template < typename OutputIterator,
+           typename PointPMap,
+           typename NormalPMap,
+           typename Kernel >
+bool read_ply_points_and_normals(std::istream& stream, ///< input stream.
+                                 OutputIterator output, ///< output iterator over points.
+                                 PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
+                                 NormalPMap normal_pmap, ///< property map: value_type of OutputIterator -> Vector_3.
+                                 const Kernel& kernel) ///< geometric traits.
+{
+  // just deduce value_type of OutputIterator
+  return read_ply_points_and_normals
+    <typename value_type_traits<OutputIterator>::type>(stream,
+                                                       output,
+                                                       point_pmap,
+                                                       normal_pmap,
+                                                       kernel);
+}
+//-----------------------------------------------------------------------------------
+/// @endcond
+
+/// @cond SKIP_IN_MANUAL
+// This variant deduces the kernel from the point property map.
+//-----------------------------------------------------------------------------------
+template < typename OutputIteratorValueType,
+           typename OutputIterator,
+           typename PointPMap,
+           typename NormalPMap >
+bool read_ply_points_and_normals(std::istream& stream, ///< input stream.
+                                 OutputIterator output, ///< output iterator over points.
+                                 PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
+                                 NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
+{
+  typedef typename boost::property_traits<PointPMap>::value_type Point;
+  typedef typename Kernel_traits<Point>::Kernel Kernel;
+  return read_ply_points_and_normals
+    <OutputIteratorValueType>(stream,
+                              output,
+                              point_pmap,
+                              normal_pmap,
+                              Kernel());
+}
+
+template < typename OutputIterator,
+           typename PointPMap,
+           typename NormalPMap >
+bool read_ply_points_and_normals(std::istream& stream, ///< input stream.
+                                 OutputIterator output, ///< output iterator over points.
+                                 PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
+                                 NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
+{
+  // just deduce value_type of OutputIterator
+  return read_ply_points_and_normals
+    <typename value_type_traits<OutputIterator>::type>(stream,
+                                                       output,
+                                                       point_pmap,
+                                                       normal_pmap);
+}
+//-----------------------------------------------------------------------------------
+/// @endcond
+
+/// @cond SKIP_IN_MANUAL
+// This variant creates a default point property map = Identity_property_map.
+//-----------------------------------------------------------------------------------
+template < typename OutputIteratorValueType,
+           typename OutputIterator,
+           typename NormalPMap >
+bool read_ply_points_and_normals(std::istream& stream, ///< input stream.
+                                 OutputIterator output, ///< output iterator over points.
+                                 NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
+{
+  return read_ply_points_and_normals
+    <OutputIteratorValueType>(stream,
+                              output,
+                              make_identity_property_map(OutputIteratorValueType()),
+                              normal_pmap);
+}
+
+template < typename OutputIterator,
+           typename NormalPMap >
+bool read_ply_points_and_normals(std::istream& stream, ///< input stream.
+                                 OutputIterator output, ///< output iterator over points.
+                                 NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
+{
+  // just deduce value_type of OutputIterator
+  return read_ply_points_and_normals
+    <typename value_type_traits<OutputIterator>::type>(stream,
+                                                       output,
+                                                       normal_pmap);
+}
+//-----------------------------------------------------------------------------------
+/// @endcond
+
+
+//===================================================================================
+/// \ingroup PkgPointSetProcessing
+/// Reads points (position only) from a .ply stream (ASCII or binary).
+/// Potential additional point properties (including normals) and faces are ignored.
+///
+/// @tparam OutputIteratorValueType type of objects that can be put in `OutputIterator`.
+///         It is default to `value_type_traits<OutputIterator>::%type` and can be omitted when the default is fine.
+/// @tparam OutputIterator iterator over output points.
+/// @tparam PointPMap is a model of `WritablePropertyMap` with  value_type `Point_3<Kernel>`.
+///        It can be omitted if the value type of `OutputIterator` is convertible to `Point_3<Kernel>`.
+/// @tparam Kernel Geometric traits class.
+///        It can be omitted and deduced automatically from  the value type of `PointPMap`.
+///
+/// @return `true` on success.
+
+// This variant requires all parameters.
+//-----------------------------------------------------------------------------------
+template < typename OutputIteratorValueType,
+           typename OutputIterator,
+           typename PointPMap,
+           typename Kernel >
+bool read_ply_points(std::istream& stream, ///< input stream.
+                     OutputIterator output, ///< output iterator over points.
+                     PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
+                     const Kernel& kernel) ///< geometric traits.
+{
+  // Calls read_ply_points_and_normals() with a normal property map = boost::dummy_property_map
+  return read_ply_points_and_normals
+    <OutputIteratorValueType>(stream,
+                              output,
+                              point_pmap,
+                              boost::dummy_property_map(),
+                              kernel);
+}
+
+/// @cond SKIP_IN_MANUAL
+template < typename OutputIterator,
+           typename PointPMap,
+           typename Kernel >
+bool read_ply_points(std::istream& stream, ///< input stream.
+                     OutputIterator output, ///< output iterator over points.
+                     PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
+                     const Kernel& kernel) ///< geometric traits.
+{
+  // just deduce value_type of OutputIterator
+  return read_ply_points
+    <typename value_type_traits<OutputIterator>::type>(stream,
+                                                       output,
+                                                       point_pmap,
+                                                       kernel);
+}
+//-----------------------------------------------------------------------------------
+/// @endcond
+
+/// @cond SKIP_IN_MANUAL
+// This variant deduces the kernel from the point property map.
+//-----------------------------------------------------------------------------------
+template < typename OutputIteratorValueType,
+           typename OutputIterator,
+           typename PointPMap >
+bool read_ply_points(std::istream& stream, ///< input stream.
+                     OutputIterator output, ///< output iterator over points.
+                     PointPMap point_pmap) ///< property map: value_type of OutputIterator -> Point_3.
+{
+  typedef typename boost::property_traits<PointPMap>::value_type Point;
+  typedef typename Kernel_traits<Point>::Kernel Kernel;
+  return read_ply_points
+    <OutputIteratorValueType>(stream,
+                              output,
+                              point_pmap,
+                              Kernel());
+}
+
+template < typename OutputIterator,
+           typename PointPMap >
+bool read_ply_points(std::istream& stream, ///< input stream.
+                     OutputIterator output, ///< output iterator over points.
+                     PointPMap point_pmap) ///< property map: value_type of OutputIterator -> Point_3.
+{
+  // just deduce value_type of OutputIterator
+  return read_ply_points
+    <typename value_type_traits<OutputIterator>::type>(stream,
+                                                       output,
+                                                       point_pmap);
+}
+//-----------------------------------------------------------------------------------
+/// @endcond
+
+/// @cond SKIP_IN_MANUAL
+// This variant creates a default point property map = Identity_property_map.
+//-----------------------------------------------------------------------------------
+template < typename OutputIteratorValueType,
+           typename OutputIterator >
+bool read_ply_points(std::istream& stream, ///< input stream.
+                     OutputIterator output) ///< output iterator over points.
+{
+  return read_ply_points
+    <OutputIteratorValueType>(stream,
+                              output,
+                              make_identity_property_map(OutputIteratorValueType())
+                              );
+}
+
+template < typename OutputIterator>
+bool read_ply_points(std::istream& stream, ///< input stream.
+                     OutputIterator output) ///< output iterator over points.
+{
+  // just deduce value_type of OutputIterator
+  return read_ply_points
+    <typename value_type_traits<OutputIterator>::type>(stream,
+                                                       output);
+}
+//-----------------------------------------------------------------------------------
+
+/// @endcond
+
+
+} //namespace CGAL
+
+#endif // CGAL_READ_PLY_POINTS_H
diff --git a/3rdparty/CGAL/include/CGAL/IO/read_xyz_points.h b/3rdparty/CGAL/include/CGAL/IO/read_xyz_points.h
new file mode 100644
index 0000000..c30fbff
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/IO/read_xyz_points.h
@@ -0,0 +1,408 @@
+// Copyright (c) 2007-09  INRIA Sophia-Antipolis (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
+// 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(s) : Pierre Alliez and Laurent Saboret
+
+#ifndef CGAL_READ_XYZ_POINTS_H
+#define CGAL_READ_XYZ_POINTS_H
+
+#include <CGAL/property_map.h>
+#include <CGAL/value_type_traits.h>
+#include <CGAL/point_set_processing_assertions.h>
+
+#include <iostream>
+#include <sstream>
+#include <string>
+
+namespace CGAL {
+
+
+//===================================================================================
+/// \ingroup PkgPointSetProcessing
+/// Reads points (positions + normals, if available) from a .xyz ASCII stream.
+/// The function expects for each point a line with the x y z position,
+/// optionally followed by the nx ny nz normal.
+/// The first line may contain the number of points in the file.
+/// Empty lines and comments starting by # character are allowed.
+///
+/// @tparam OutputIteratorValueType type of objects that can be put in `OutputIterator`.
+///         It is default to `value_type_traits<OutputIterator>::%type` and can be omitted when the default is fine.
+/// @tparam OutputIterator iterator over output points.
+/// @tparam PointPMap is a model of `WritablePropertyMap` with  value type `Point_3<Kernel>`.
+///        It can be omitted if the value type of OutputIterator value_type is convertible to `Point_3<Kernel>`.
+/// @tparam NormalPMap is a model of `WritablePropertyMap` with value type  `Vector_3<Kernel>`.
+/// @tparam Kernel Geometric traits class.
+///        It can be omitted and deduced automatically from the value type of `PointPMap`.
+///
+/// @return true on success.
+
+// This variant requires all parameters.
+//-----------------------------------------------------------------------------------
+template <typename OutputIteratorValueType,
+          typename OutputIterator,
+          typename PointPMap,
+          typename NormalPMap,
+          typename Kernel
+>
+bool
+read_xyz_points_and_normals(
+  std::istream& stream, ///< input stream.
+  OutputIterator output, ///< output iterator over points.
+  PointPMap point_pmap,  ///< property map: value_type of OutputIterator -> Point_3.
+  NormalPMap normal_pmap, ///< property map: value_type of OutputIterator -> Vector_3.
+  const Kernel& /*kernel*/) ///< geometric traits.
+{
+  // value_type_traits is a workaround as back_insert_iterator's value_type is void
+  //typedef typename value_type_traits<OutputIterator>::type Enriched_point;
+  typedef OutputIteratorValueType Enriched_point;
+  
+  typedef typename Kernel::FT FT;
+  typedef typename Kernel::Point_3 Point;
+  typedef typename Kernel::Vector_3 Vector;
+
+  if(!stream)
+  {
+    std::cerr << "Error: cannot open file" << std::endl;
+    return false;
+  }
+
+  // scan points
+  long pointsCount; // number of points in file
+  int lineNumber = 0; // line counter
+  std::string line; // line buffer
+  std::istringstream iss;
+
+  while(getline(stream,line))
+  {
+    // position + normal
+    FT x,y,z;
+    FT nx,ny,nz;
+
+    lineNumber++;
+
+    // Trims line buffer
+    line.erase(line.find_last_not_of (" ")+1);
+    line.erase(0, line.find_first_not_of (" "));
+
+    // Skips comment or empty line...
+    if (line.length() == 0 || line[0] == '#')
+    {
+      continue;
+    }
+    // ...or reads position...
+    else {
+      iss.clear();
+      iss.str(line);
+      if (iss >> iformat(x) >> iformat(y) >> iformat(z))
+        {
+          Point point(x,y,z);
+          Vector normal = CGAL::NULL_VECTOR;
+          // ... + normal...
+          if (iss >> iformat(nx))
+            {
+              // In case we could read one number, we expect that there are two more
+              if(iss  >> iformat(ny) >> iformat(nz)){
+                normal = Vector(nx,ny,nz);
+              } else {
+                std::cerr << "Error line " << lineNumber << " of file" << std::endl;
+                return false;
+              }
+            }
+          Enriched_point pwn;
+          put(point_pmap,  pwn, point);  // point_pmap[pwn] = point
+          put(normal_pmap, pwn, normal); // normal_pmap[pwn] = normal
+          *output++ = pwn;
+          continue;
+        } 
+      
+    }
+    // ...or skips number of points on first line (optional)
+    if (lineNumber == 1 && std::istringstream(line) >> pointsCount)
+    {
+      continue;
+    }
+    else // if wrong file format
+    {
+      std::cerr << "Error line " << lineNumber << " of file" << std::endl;
+      return false;
+    }
+  }
+
+  return true;
+}
+
+/// @cond SKIP_IN_MANUAL
+template <typename OutputIterator,
+          typename PointPMap,
+          typename NormalPMap,
+          typename Kernel
+>
+bool
+read_xyz_points_and_normals(
+  std::istream& stream, ///< input stream.
+  OutputIterator output, ///< output iterator over points.
+  PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
+  NormalPMap normal_pmap, ///< property map: value_type of OutputIterator -> Vector_3.
+  const Kernel& kernel) ///< geometric traits.
+{
+  // just deduce value_type of OutputIterator
+  return read_xyz_points_and_normals
+    <typename value_type_traits<OutputIterator>::type>(
+    stream,
+    output,
+    point_pmap,
+    normal_pmap,
+    kernel);
+}
+//-----------------------------------------------------------------------------------
+/// @endcond
+
+/// @cond SKIP_IN_MANUAL
+// This variant deduces the kernel from the point property map.
+//-----------------------------------------------------------------------------------
+template <typename OutputIteratorValueType,
+          typename OutputIterator,
+          typename PointPMap,
+          typename NormalPMap
+>
+bool
+read_xyz_points_and_normals(
+  std::istream& stream, ///< input stream.
+  OutputIterator output, ///< output iterator over points.
+  PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
+  NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
+{
+  typedef typename boost::property_traits<PointPMap>::value_type Point;
+  typedef typename Kernel_traits<Point>::Kernel Kernel;
+  return read_xyz_points_and_normals
+    <OutputIteratorValueType>(
+    stream,
+    output,
+    point_pmap,
+    normal_pmap,
+    Kernel());
+}
+
+template <typename OutputIterator,
+          typename PointPMap,
+          typename NormalPMap
+>
+bool
+read_xyz_points_and_normals(
+  std::istream& stream, ///< input stream.
+  OutputIterator output, ///< output iterator over points.
+  PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
+  NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
+{
+  // just deduce value_type of OutputIterator
+  return read_xyz_points_and_normals
+    <typename value_type_traits<OutputIterator>::type>(
+    stream,
+    output,
+    point_pmap,
+    normal_pmap);
+}
+//-----------------------------------------------------------------------------------
+/// @endcond
+
+/// @cond SKIP_IN_MANUAL
+// This variant creates a default point property map = Identity_property_map.
+//-----------------------------------------------------------------------------------
+template <typename OutputIteratorValueType,
+          typename OutputIterator,
+          typename NormalPMap
+>
+bool
+read_xyz_points_and_normals(
+  std::istream& stream, ///< input stream.
+  OutputIterator output, ///< output iterator over points.
+  NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
+{
+  return read_xyz_points_and_normals
+    <OutputIteratorValueType>(
+    stream,
+    output,
+    make_identity_property_map(OutputIteratorValueType()),
+    normal_pmap);
+}
+
+template <typename OutputIterator,
+          typename NormalPMap
+>
+bool
+read_xyz_points_and_normals(
+  std::istream& stream, ///< input stream.
+  OutputIterator output, ///< output iterator over points.
+  NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
+{
+  // just deduce value_type of OutputIterator
+  return read_xyz_points_and_normals
+    <typename value_type_traits<OutputIterator>::type>(
+    stream,
+    output,
+    normal_pmap);
+}
+//-----------------------------------------------------------------------------------
+/// @endcond
+
+
+//===================================================================================
+/// \ingroup PkgPointSetProcessing
+/// Reads points (positions only) from a .xyz ASCII stream.
+/// The function expects for each point a line with the x y z position.
+/// If the position is followed by the nx ny nz normal, then the normal will be ignored.
+/// The first line may contain the number of points in the file.
+/// Empty lines and comments starting by # character are allowed.
+///
+/// @tparam OutputIteratorValueType type of objects that can be put in `OutputIterator`.
+///         It is default to `value_type_traits<OutputIterator>::%type` and can be omitted when the default is fine.
+/// @tparam OutputIterator iterator over output points.
+/// @tparam PointPMap is a model of `WritablePropertyMap` with value type  `Point_3<Kernel>`.
+///        It can be omitted if the value type of `OutputIterator` is convertible to `Point_3<Kernel>`.
+/// @tparam Kernel Geometric traits class.
+///        It can be omitted and deduced automatically from the value type of `PointPMap`.
+///
+/// @return true on success.
+
+// This variant requires all parameters.
+//-----------------------------------------------------------------------------------
+template <typename OutputIteratorValueType,
+          typename OutputIterator,
+          typename PointPMap,
+          typename Kernel
+>
+bool
+read_xyz_points(
+  std::istream& stream, ///< input stream.
+  OutputIterator output, ///< output iterator over points.
+  PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
+  const Kernel& kernel) ///< geometric traits.
+{
+  // Calls read_xyz_points_and_normals() with a normal property map = boost::dummy_property_map
+  return read_xyz_points_and_normals
+    <OutputIteratorValueType>(
+    stream,
+    output,
+    point_pmap,
+    boost::dummy_property_map(),
+    kernel);
+}
+
+/// @cond SKIP_IN_MANUAL
+template <typename OutputIterator,
+          typename PointPMap,
+          typename Kernel
+>
+bool
+read_xyz_points(
+  std::istream& stream, ///< input stream.
+  OutputIterator output, ///< output iterator over points.
+  PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
+  const Kernel& kernel) ///< geometric traits.
+{
+  // just deduce value_type of OutputIterator
+  return read_xyz_points
+    <typename value_type_traits<OutputIterator>::type>(
+    stream,
+    output,
+    point_pmap,
+    kernel);
+}
+/// @endcond
+//-----------------------------------------------------------------------------------
+
+/// @cond SKIP_IN_MANUAL
+// This variant deduces the kernel from the point property map.
+//-----------------------------------------------------------------------------------
+template <typename OutputIteratorValueType,
+          typename OutputIterator,
+          typename PointPMap
+>
+bool
+read_xyz_points(
+  std::istream& stream, ///< input stream.
+  OutputIterator output, ///< output iterator over points.
+  PointPMap point_pmap) ///< property map: value_type of OutputIterator -> Point_3.
+{
+  typedef typename boost::property_traits<PointPMap>::value_type Point;
+  typedef typename Kernel_traits<Point>::Kernel Kernel;
+  return read_xyz_points
+    <OutputIteratorValueType>(
+    stream,
+    output,
+    point_pmap,
+    Kernel());
+}
+
+template <typename OutputIterator,
+          typename PointPMap
+>
+bool
+read_xyz_points(
+  std::istream& stream, ///< input stream.
+  OutputIterator output, ///< output iterator over points.
+  PointPMap point_pmap) ///< property map: value_type of OutputIterator -> Point_3.
+{
+  // just deduce value_type of OutputIterator
+  return read_xyz_points
+    <typename value_type_traits<OutputIterator>::type>(
+    stream,
+    output,
+    point_pmap);
+}
+//-----------------------------------------------------------------------------------
+/// @endcond
+
+/// @cond SKIP_IN_MANUAL
+// This variant creates a default point property map = Identity_property_map.
+//-----------------------------------------------------------------------------------
+template <typename OutputIteratorValueType,
+          typename OutputIterator
+>
+bool
+read_xyz_points(
+  std::istream& stream, ///< input stream.
+  OutputIterator output) ///< output iterator over points.
+{
+  return read_xyz_points
+    <OutputIteratorValueType>(
+    stream,
+    output,
+    make_identity_property_map(OutputIteratorValueType())
+    );
+}
+
+template <typename OutputIterator
+>
+bool
+read_xyz_points(
+  std::istream& stream, ///< input stream.
+  OutputIterator output) ///< output iterator over points.
+{
+  // just deduce value_type of OutputIterator
+  return read_xyz_points
+    <typename value_type_traits<OutputIterator>::type>(
+    stream,
+    output);
+}
+//-----------------------------------------------------------------------------------
+/// @endcond
+
+
+} //namespace CGAL
+
+#endif // CGAL_READ_XYZ_POINTS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/IO/scan_OFF.h b/3rdparty/CGAL/include/CGAL/IO/scan_OFF.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/IO/scan_OFF.h
rename to 3rdparty/CGAL/include/CGAL/IO/scan_OFF.h
diff --git a/3rdparty/CGAL/include/CGAL/IO/write_off_points.h b/3rdparty/CGAL/include/CGAL/IO/write_off_points.h
new file mode 100644
index 0000000..ad25e86
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/IO/write_off_points.h
@@ -0,0 +1,224 @@
+// Copyright (c) 2007-09  INRIA Sophia-Antipolis (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
+// 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(s) : Pierre Alliez and Laurent Saboret
+
+#ifndef CGAL_WRITE_OFF_POINTS_H
+#define CGAL_WRITE_OFF_POINTS_H
+
+#include <CGAL/property_map.h>
+#include <CGAL/point_set_processing_assertions.h>
+
+#include <iostream>
+#include <iterator>
+
+namespace CGAL {
+
+
+//===================================================================================
+/// \ingroup PkgPointSetProcessing
+/// Saves the [first, beyond) range of points (positions + normals) to a .off ASCII stream.
+/// The function writes for each point a line with the x y z position
+/// followed by the nx ny nz normal.
+///
+/// \pre normals must be unit vectors
+///
+/// @tparam ForwardIterator iterator over input points.
+/// @tparam PointPMap is a model of `ReadablePropertyMap` with  value type `Point_3<Kernel>`.
+///        It can be omitted if the value type of `ForwardIterator` is convertible to `Point_3<Kernel>`.
+/// @tparam NormalPMap is a model of `ReadablePropertyMap` with a value type  `Vector_3<Kernel>`.
+/// @tparam Kernel Geometric traits class.
+///        It can be omitted and deduced automatically from the value type of `PointPMap`.
+///
+/// @return true on success.
+
+// This variant requires all parameters.
+template <typename ForwardIterator,
+          typename PointPMap,
+          typename NormalPMap,
+          typename Kernel
+>
+bool
+write_off_points_and_normals(
+  std::ostream& stream, ///< output stream.
+  ForwardIterator first,  ///< iterator over the first input point.
+  ForwardIterator beyond, ///< past-the-end iterator over the input points.
+  PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3. 
+  NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3. 
+  const Kernel& /*kernel*/) ///< geometric traits.
+{
+  CGAL_point_set_processing_precondition(first != beyond);
+
+  if(!stream)
+  {
+    std::cerr << "Error: cannot open file" << std::endl;
+    return false;
+  }
+
+  // Write header
+  const std::size_t num_input_points = std::distance(first, beyond);
+  stream << "NOFF" << std::endl;
+  stream << num_input_points << " 0 0" << std::endl;
+
+  // Write positions + normals
+  for(ForwardIterator it = first; it != beyond; it++)
+  {
+    stream << get(point_pmap, *it) << " "
+           << get(normal_pmap, *it) << std::endl;
+  }
+
+  return ! stream.fail();
+}
+
+/// @cond SKIP_IN_MANUAL
+// This variant deduces the kernel from the point property map.
+template <typename ForwardIterator,
+          typename PointPMap,
+          typename NormalPMap
+>
+bool
+write_off_points_and_normals(
+  std::ostream& stream, ///< output stream.
+  ForwardIterator first, ///< first input point.
+  ForwardIterator beyond, ///< past-the-end input point.
+  PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
+  NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
+{
+  typedef typename boost::property_traits<PointPMap>::value_type Point;
+  typedef typename Kernel_traits<Point>::Kernel Kernel;
+  return write_off_points_and_normals(
+    stream,
+    first, beyond,
+    point_pmap,
+    normal_pmap,
+    Kernel());
+}
+/// @endcond
+
+/// @cond SKIP_IN_MANUAL
+// This variant creates a default point property map = Identity_property_map.
+template <typename ForwardIterator,
+          typename NormalPMap
+>
+bool
+write_off_points_and_normals(
+  std::ostream& stream, ///< output stream.
+  ForwardIterator first, ///< first input point.
+  ForwardIterator beyond, ///< past-the-end input point.
+  NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
+{
+  return write_off_points_and_normals(
+    stream,
+    first, beyond,
+    make_identity_property_map(
+    typename std::iterator_traits<ForwardIterator>::value_type()),
+    normal_pmap);
+}
+/// @endcond
+
+
+//===================================================================================
+/// \ingroup PkgPointSetProcessing
+/// Saves the [first, beyond) range of points (positions only) to a .off ASCII stream.
+/// The function writes for each point a line with the x y z position.
+///
+/// @tparam ForwardIterator iterator over input points.
+/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = `Point_3<Kernel>`.
+///        It can be omitted if the value type of `ForwardIterator` is convertible to `Point_3<Kernel>`.
+/// @tparam Kernel Geometric traits class.
+///        It can be omitted and deduced automatically from the value type of `PointPMap`.
+///
+/// @return true on success.
+
+// This variant requires all parameters.
+template <typename ForwardIterator,
+          typename PointPMap,
+          typename Kernel
+>
+bool
+write_off_points(
+  std::ostream& stream, ///< output stream.
+  ForwardIterator first,  ///< iterator over the first input point.
+  ForwardIterator beyond, ///< past-the-end iterator over the input points.
+  PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3.
+  const Kernel& ) ///< geometric traits.
+{
+  CGAL_point_set_processing_precondition(first != beyond);
+
+  if(!stream)
+  {
+    std::cerr << "Error: cannot open file" << std::endl;
+    return false;
+  }
+
+  // Write header
+  const std::size_t num_input_points = std::distance(first, beyond);
+  stream << "OFF" << std::endl;
+  stream << num_input_points << " 0 0" << std::endl;
+
+  // Write positions
+  for(ForwardIterator it = first; it != beyond; it++)
+    stream << get(point_pmap, *it) << std::endl;
+
+  return ! stream.fail();
+}
+
+/// @cond SKIP_IN_MANUAL
+// This variant deduces the kernel from the point property map.
+template <typename ForwardIterator,
+          typename PointPMap
+>
+bool
+write_off_points(
+  std::ostream& stream, ///< output stream.
+  ForwardIterator first, ///< first input point.
+  ForwardIterator beyond, ///< past-the-end input point.
+  PointPMap point_pmap) ///< property map: value_type of OutputIterator -> Point_3.
+{
+  typedef typename boost::property_traits<PointPMap>::value_type Point;
+  typedef typename Kernel_traits<Point>::Kernel Kernel;
+  return write_off_points(
+    stream,
+    first, beyond,
+    point_pmap,
+    Kernel());
+}
+/// @endcond
+
+/// @cond SKIP_IN_MANUAL
+// This variant creates a default point property map = Identity_property_map.
+template <typename ForwardIterator
+>
+bool
+write_off_points(
+  std::ostream& stream, ///< output stream.
+  ForwardIterator first, ///< first input point.
+  ForwardIterator beyond) ///< past-the-end input point.
+{
+  return write_off_points(
+    stream,
+    first, beyond,
+    make_identity_property_map(
+    typename std::iterator_traits<ForwardIterator>::value_type())
+    );
+}
+/// @endcond
+
+
+} //namespace CGAL
+
+#endif // CGAL_WRITE_OFF_POINTS_H
diff --git a/3rdparty/CGAL/include/CGAL/IO/write_ply_points.h b/3rdparty/CGAL/include/CGAL/IO/write_ply_points.h
new file mode 100644
index 0000000..e85bdf7
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/IO/write_ply_points.h
@@ -0,0 +1,238 @@
+// Copyright (c) 2015  Geometry Factory
+// 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
+// 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(s) : Simon Giraudot
+
+#ifndef CGAL_WRITE_PLY_POINTS_H
+#define CGAL_WRITE_PLY_POINTS_H
+
+#include <CGAL/property_map.h>
+#include <CGAL/point_set_processing_assertions.h>
+
+#include <boost/version.hpp>
+
+#include <iostream>
+#include <iterator>
+
+namespace CGAL {
+
+
+//===================================================================================
+/// \ingroup PkgPointSetProcessing
+/// Saves the [first, beyond) range of points (positions + normals) to a .ply ASCII stream.
+///
+/// \pre normals must be unit vectors
+///
+/// @tparam ForwardIterator iterator over input points.
+/// @tparam PointPMap is a model of `ReadablePropertyMap` with  value type `Point_3<Kernel>`.
+///        It can be omitted if the value type of `ForwardIterator` is convertible to `Point_3<Kernel>`.
+/// @tparam NormalPMap is a model of `ReadablePropertyMap` with a value type  `Vector_3<Kernel>`.
+/// @tparam Kernel Geometric traits class.
+///        It can be omitted and deduced automatically from the value type of `PointPMap`.
+///
+/// @return true on success.
+
+// This variant requires all parameters.
+template < typename ForwardIterator,
+           typename PointPMap,
+           typename NormalPMap,
+           typename Kernel >
+bool
+write_ply_points_and_normals(
+  std::ostream& stream, ///< output stream.
+  ForwardIterator first,  ///< iterator over the first input point.
+  ForwardIterator beyond, ///< past-the-end iterator over the input points.
+  PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3. 
+  NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3. 
+  const Kernel& /*kernel*/) ///< geometric traits.
+{
+  CGAL_point_set_processing_precondition(first != beyond);
+
+  if(!stream)
+  {
+    std::cerr << "Error: cannot open file" << std::endl;
+    return false;
+  }
+
+  // Write header
+  stream << "ply" << std::endl
+         << "format ascii 1.0" << std::endl
+         << "comment Generated by the CGAL library" << std::endl
+         << "element vertex " << std::distance (first, beyond) << std::endl
+         << "property double x" << std::endl
+         << "property double y" << std::endl
+         << "property double z" << std::endl
+         << "property double nx" << std::endl
+         << "property double ny" << std::endl
+         << "property double nz" << std::endl
+         << "end_header" << std::endl;
+  
+
+  // Write positions + normals
+  for(ForwardIterator it = first; it != beyond; it++)
+  {
+    stream << get(point_pmap, *it) << " "
+           << get(normal_pmap, *it) << std::endl;
+  }
+
+  return ! stream.fail();
+}
+
+/// @cond SKIP_IN_MANUAL
+// This variant deduces the kernel from the point property map.
+template < typename ForwardIterator,
+           typename PointPMap,
+           typename NormalPMap >
+bool
+write_ply_points_and_normals(
+  std::ostream& stream, ///< output stream.
+  ForwardIterator first, ///< first input point.
+  ForwardIterator beyond, ///< past-the-end input point.
+  PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
+  NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
+{
+  typedef typename boost::property_traits<PointPMap>::value_type Point;
+  typedef typename Kernel_traits<Point>::Kernel Kernel;
+  return write_ply_points_and_normals(
+    stream,
+    first, beyond,
+    point_pmap,
+    normal_pmap,
+    Kernel());
+}
+/// @endcond
+
+/// @cond SKIP_IN_MANUAL
+// This variant creates a default point property map = Identity_property_map.
+template <typename ForwardIterator,
+          typename NormalPMap
+>
+bool
+write_ply_points_and_normals(
+  std::ostream& stream, ///< output stream.
+  ForwardIterator first, ///< first input point.
+  ForwardIterator beyond, ///< past-the-end input point.
+  NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
+{
+  return write_ply_points_and_normals(
+    stream,
+    first, beyond,
+    make_identity_property_map(
+    typename std::iterator_traits<ForwardIterator>::value_type()),
+    normal_pmap);
+}
+/// @endcond
+
+
+//===================================================================================
+/// \ingroup PkgPointSetProcessing
+/// Saves the [first, beyond) range of points (positions only) to a .ply ASCII stream.
+///
+/// @tparam ForwardIterator iterator over input points.
+/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = `Point_3<Kernel>`.
+///        It can be omitted if the value type of `ForwardIterator` is convertible to `Point_3<Kernel>`.
+/// @tparam Kernel Geometric traits class.
+///        It can be omitted and deduced automatically from the value type of `PointPMap`.
+///
+/// @return true on success.
+
+// This variant requires all parameters.
+template < typename ForwardIterator,
+           typename PointPMap,
+           typename Kernel >
+bool
+write_ply_points(
+  std::ostream& stream, ///< output stream.
+  ForwardIterator first,  ///< iterator over the first input point.
+  ForwardIterator beyond, ///< past-the-end iterator over the input points.
+  PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3.
+  const Kernel& ) ///< geometric traits.
+{
+  // basic geometric types
+  typedef typename Kernel::Point_3 Point;
+
+  CGAL_point_set_processing_precondition(first != beyond);
+
+  if(!stream)
+  {
+    std::cerr << "Error: cannot open file" << std::endl;
+    return false;
+  }
+
+  // Write header
+  stream << "ply" << std::endl
+         << "format ascii 1.0" << std::endl
+         << "comment Generated by the CGAL library" << std::endl
+         << "element vertex " << std::distance (first, beyond) << std::endl
+         << "property double x" << std::endl
+         << "property double y" << std::endl
+         << "property double z" << std::endl
+         << "end_header" << std::endl;
+
+  // Write positions
+  for(ForwardIterator it = first; it != beyond; it++)
+  {
+    Point p = get(point_pmap, *it);
+    stream << p << std::endl;
+  }
+
+  return ! stream.fail();
+}
+
+/// @cond SKIP_IN_MANUAL
+// This variant deduces the kernel from the point property map.
+template < typename ForwardIterator,
+           typename PointPMap >
+bool
+write_ply_points(
+  std::ostream& stream, ///< output stream.
+  ForwardIterator first, ///< first input point.
+  ForwardIterator beyond, ///< past-the-end input point.
+  PointPMap point_pmap) ///< property map: value_type of OutputIterator -> Point_3.
+{
+  typedef typename boost::property_traits<PointPMap>::value_type Point;
+  typedef typename Kernel_traits<Point>::Kernel Kernel;
+  return write_ply_points(
+    stream,
+    first, beyond,
+    point_pmap,
+    Kernel());
+}
+/// @endcond
+
+/// @cond SKIP_IN_MANUAL
+// This variant creates a default point property map = Identity_property_map.
+template < typename ForwardIterator >
+bool
+write_ply_points(
+  std::ostream& stream, ///< output stream.
+  ForwardIterator first, ///< first input point.
+  ForwardIterator beyond) ///< past-the-end input point.
+{
+  return write_ply_points(
+    stream,
+    first, beyond,
+    make_identity_property_map(
+    typename std::iterator_traits<ForwardIterator>::value_type())
+    );
+}
+/// @endcond
+
+
+} //namespace CGAL
+
+#endif // CGAL_WRITE_PLY_POINTS_H
diff --git a/3rdparty/CGAL/include/CGAL/IO/write_xyz_points.h b/3rdparty/CGAL/include/CGAL/IO/write_xyz_points.h
new file mode 100644
index 0000000..4134d8b
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/IO/write_xyz_points.h
@@ -0,0 +1,214 @@
+// Copyright (c) 2007-09  INRIA Sophia-Antipolis (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
+// 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(s) : Pierre Alliez and Laurent Saboret
+
+#ifndef CGAL_WRITE_XYZ_POINTS_H
+#define CGAL_WRITE_XYZ_POINTS_H
+
+#include <CGAL/property_map.h>
+#include <CGAL/point_set_processing_assertions.h>
+
+#include <iostream>
+#include <iterator>
+
+namespace CGAL {
+
+
+//===================================================================================
+/// \ingroup PkgPointSetProcessing
+/// Saves the [first, beyond) range of points (positions + normals) to a .xyz ASCII stream.
+/// The function writes for each point a line with the x y z position
+/// followed by the nx ny nz normal.
+///
+/// \pre normals must be unit vectors
+///
+/// @tparam ForwardIterator iterator over input points.
+/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value type = `Point_3<Kernel>`.
+///        It can be omitted if the value type of `ForwardIterator` is convertible to `Point_3<Kernel>`.
+/// @tparam NormalPMap is a model of `ReadablePropertyMap` with a value type  `Vector_3<Kernel>`.
+/// @tparam Kernel Geometric traits class.
+///        It can be omitted and deduced automatically from the value type of `PointPMap`.
+///
+/// @return true on success.
+
+// This variant requires all parameters.
+template <typename ForwardIterator,
+          typename PointPMap,
+          typename NormalPMap,
+          typename Kernel
+>
+bool
+write_xyz_points_and_normals(
+  std::ostream& stream, ///< output stream.
+  ForwardIterator first,  ///< iterator over the first input point.
+  ForwardIterator beyond, ///< past-the-end iterator over the input points.
+  PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3.
+  NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3.
+  const Kernel& /*kernel*/) ///< geometric traits.
+{
+  CGAL_point_set_processing_precondition(first != beyond);
+
+  if(!stream)
+  {
+    std::cerr << "Error: cannot open file" << std::endl;
+    return false;
+  }
+
+  // Write positions + normals
+  for(ForwardIterator it = first; it != beyond; it++)
+  {
+    stream << get(point_pmap, *it) << " "
+           << get(normal_pmap, *it) << std::endl;
+  }
+
+  return ! stream.fail();
+}
+
+/// @cond SKIP_IN_MANUAL
+// This variant deduces the kernel from the point property map.
+template <typename ForwardIterator,
+          typename PointPMap,
+          typename NormalPMap
+>
+bool
+write_xyz_points_and_normals(
+  std::ostream& stream, ///< output stream.
+  ForwardIterator first, ///< first input point.
+  ForwardIterator beyond, ///< past-the-end input point.
+  PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
+  NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
+{
+  typedef typename boost::property_traits<PointPMap>::value_type Point;
+  typedef typename Kernel_traits<Point>::Kernel Kernel;
+  return write_xyz_points_and_normals(
+    stream,
+    first, beyond,
+    point_pmap,
+    normal_pmap,
+    Kernel());
+}
+/// @endcond
+
+/// @cond SKIP_IN_MANUAL
+// This variant creates a default point property map = Identity_property_map.
+template <typename ForwardIterator,
+          typename NormalPMap
+>
+bool
+write_xyz_points_and_normals(
+  std::ostream& stream, ///< output stream.
+  ForwardIterator first, ///< first input point.
+  ForwardIterator beyond, ///< past-the-end input point.
+  NormalPMap normal_pmap) ///< property map: value_type of ForwardIterator -> Vector_3.
+{
+  return write_xyz_points_and_normals(
+    stream,
+    first, beyond,
+    make_identity_property_map(
+      typename std::iterator_traits<ForwardIterator>::value_type()),
+    normal_pmap);
+}
+/// @endcond
+
+
+//===================================================================================
+/// \ingroup PkgPointSetProcessing
+/// Saves the [first, beyond) range of points (positions only) to a .xyz ASCII stream.
+/// The function writes for each point a line with the x y z position.
+///
+/// @tparam ForwardIterator iterator over input points.
+/// @tparam PointPMap is a model of `ReadablePropertyMap` with value type  `Point_3<Kernel>`.
+///        It can be omitted if the value type of `ForwardIterator value_type is convertible to `Point_3<Kernel>`.
+/// @tparam Kernel Geometric traits class.
+///        It can be omitted and deduced automatically from the value type of `PointPMap`.
+///
+/// @return true on success.
+
+// This variant requires all parameters.
+template <typename ForwardIterator,
+          typename PointPMap,
+          typename Kernel
+>
+bool
+write_xyz_points(
+  std::ostream& stream, ///< output stream.
+  ForwardIterator first,  ///< iterator over the first input point.
+  ForwardIterator beyond, ///< past-the-end iterator over the input points.
+  PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3.
+  const Kernel& /*kernel*/) ///< geometric traits.
+{
+  CGAL_point_set_processing_precondition(first != beyond);
+
+  if(!stream)
+  {
+    std::cerr << "Error: cannot open file" << std::endl;
+    return false;
+  }
+
+  // Write positions
+  for(ForwardIterator it = first; it != beyond; it++)
+    stream << get(point_pmap, *it) << std::endl;
+
+  return ! stream.fail();
+}
+
+/// @cond SKIP_IN_MANUAL
+// This variant deduces the kernel from the point property map.
+template <typename ForwardIterator,
+          typename PointPMap
+>
+bool
+write_xyz_points(
+  std::ostream& stream, ///< output stream.
+  ForwardIterator first, ///< first input point.
+  ForwardIterator beyond, ///< past-the-end input point.
+  PointPMap point_pmap) ///< property map: value_type of OutputIterator -> Point_3.
+{
+  typedef typename boost::property_traits<PointPMap>::value_type Point;
+  typedef typename Kernel_traits<Point>::Kernel Kernel;
+  return write_xyz_points(
+    stream,
+    first, beyond,
+    point_pmap,
+    Kernel());
+}
+/// @endcond
+
+/// @cond SKIP_IN_MANUAL
+// This variant creates a default point property map = Identity_property_map.
+template <typename ForwardIterator
+>
+bool
+write_xyz_points(
+  std::ostream& stream, ///< output stream.
+  ForwardIterator first, ///< first input point.
+  ForwardIterator beyond) ///< past-the-end input point.
+{
+  return write_xyz_points(
+    stream,
+    first, beyond,
+    make_identity_property_map(
+      typename std::iterator_traits<ForwardIterator>::value_type())
+    );
+}
+/// @endcond
+
+
+} //namespace CGAL
+
+#endif // CGAL_WRITE_XYZ_POINTS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Identity_policy_2.h b/3rdparty/CGAL/include/CGAL/Identity_policy_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Identity_policy_2.h
rename to 3rdparty/CGAL/include/CGAL/Identity_policy_2.h
diff --git a/3rdparty/CGAL/include/CGAL/ImageIO.h b/3rdparty/CGAL/include/CGAL/ImageIO.h
new file mode 100644
index 0000000..29d5c42
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/ImageIO.h
@@ -0,0 +1,716 @@
+// Copyright (c) 2005, 2006 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// Copyright (c) 2007 Geometrica Project, INRIA Sophia-Antipolis (France) 
+// Copyright (c) 2008 GeometryFactory, Sophia-Antipolis (France) 
+// All rights reserved.
+//
+// The files in this directory are part of the ImageIO Library.
+// You can redistribute them and/or  modify them 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+// $URL$
+// $Id$
+//
+
+#ifndef IMAGEIO_H
+#define IMAGEIO_H
+
+#include <CGAL/config.h>
+#include <CGAL/export/ImageIO.h>
+
+#include <CGAL/auto_link/ImageIO.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <boost/cstdint.hpp> // for uint32_t, etc.
+
+#ifdef CGAL_USE_ZLIB
+#include <zlib.h>
+/* see http://www.gzip.org/zlib/
+   for details and documentation
+*/
+#endif
+
+
+
+#if (defined(_LINUX_) || defined(_SOLARIS_))
+
+/* should be declared in stdio.h
+ */
+extern int fileno( FILE *stream);
+extern FILE *fdopen (int fildes, const char *mode);
+/* should be declared in string.h
+ */
+#ifndef __cplusplus
+extern char *strdup(const char *s);
+extern int strncasecmp(const char *s1, const char *s2, size_t n);
+#endif
+
+#endif
+
+
+
+
+
+#ifndef LONGINT
+
+#if (defined _ALPHA_ || (defined _SGI_ && (defined _64_ || defined _64_M4_ || defined _64_M3_)))
+/* the 64-bits type on 64-bits platform (long int) */
+#define LONGINT long  int
+#else
+#ifdef __GNUC__
+/* the 64-bits type on 32-bits platform (long long int) */
+#define LONGINT long long int
+#else
+/*#define LONGINT __int64 */
+#define LONGINT long int
+#endif
+#endif
+
+#endif
+
+
+
+
+
+
+
+
+/** file open mode */
+typedef enum {
+  /** no file open */
+  OM_CLOSE,
+  /** file is stdin or stdout */
+  OM_STD,
+  /** file is gzipped */
+#ifdef CGAL_USE_ZLIB
+  OM_GZ,
+#endif
+  /** normal file */
+  OM_FILE
+} OPEN_MODE;
+
+
+/** data mode */
+typedef enum {
+  /** data are binary */
+  DM_BINARY,
+  /** data are ascii */
+  DM_ASCII
+} DATA_MODE;
+
+
+/** kind of image word */
+typedef enum {
+  /** fixed type */
+  WK_FIXED,
+  /** floating point */
+  WK_FLOAT,
+  /** unknown (uninitialized) */
+  WK_UNKNOWN
+} WORD_KIND;
+
+
+/** image word sign */
+typedef enum {
+  /** signed */
+  SGN_SIGNED,
+  /** unsigned */
+  SGN_UNSIGNED,
+  /** unknown (uninitialized or floating point words) */
+  SGN_UNKNOWN
+} SIGN;
+
+
+/** endianness */
+typedef enum {
+  /** Little endian processor */
+  END_LITTLE,
+  /** Big endian processor */
+  END_BIG,
+  /** Unknown endianness (unopenned file) */
+  END_UNKNOWN
+} ENDIANNESS;
+
+
+/** inrimage vectorial storage mode */
+typedef enum {
+  /** interlaced vectors (i.e. x1, y1, z1, x2, y2, z2, x3, y3, z3, ...) */
+  VM_INTERLACED,
+  /** non interlaced vectors (i.e. x1, x2, x3, ..., y1, y2, y3, ..., z1, z2, z3...) */
+  VM_NON_INTERLACED,
+  /** scalar inrimage */
+  VM_SCALAR
+} VECTORIAL_MODE;
+
+
+
+#ifdef CGAL_USE_ZLIB
+typedef gzFile _ImageIO_file;
+#else
+typedef FILE*  _ImageIO_file;
+#endif
+
+#define IMAGE_FORMAT_NAME_LENGTH 100
+
+
+struct point_image;
+
+/** defines the type of function called to test if an image is of a given
+    format. The first parameter is an array of char of size 5 (ends with
+    character 0) that describes the first file character (magic string). The
+    second parameter is the filename. The output value is >=0 if the image is
+    of that given format and <0 otherwise */
+typedef int (*TEST_IMAGE_FORMAT)(char *,const char *);
+/** defines the type of function called to read an image or an image header
+    from a file corresponding to a given format. The first parameter is the
+    file name whereas the second parameter is an _image structure. Note that 
+    the file has been already opened (the file descriptor fd is valid). 
+    The output value is >0  if  the whole image has been read, it is 0 if 
+    only the header has been read and it is  <0 otherwise */
+typedef int (*READ_IMAGE_HEADER)(const char *, struct point_image *);
+/** defines the type of function called to write an image to a file
+    corresponding to a given format.  
+    The first parameter is the full file name whereas the second parameter
+    is an _image structure. 
+    Note that the file has to be opened and closed in the function.
+    The output value is >=0 if the whole image has been written
+    correctly and it is <0 otherwise */
+typedef int (*WRITE_IMAGE)(char *,struct point_image *);
+
+
+/** Image Format descriptor */
+typedef struct imformat {
+
+  /** a pointer on a function that tests if an image is of a given format */
+  TEST_IMAGE_FORMAT testImageFormat;
+
+  /** a pointer on a function that reads the header of an image file */
+  READ_IMAGE_HEADER readImageHeader;
+
+  /** a pointer on a function that writes  image of a given
+      format */
+  WRITE_IMAGE writeImage;
+
+  /* the file extension of format (including a dot ".": if several 
+     extensions may be used, they should be separed with a 
+     comma ".inr,.inr.gz" */
+  char fileExtension[IMAGE_FORMAT_NAME_LENGTH];
+  
+  /** the usual name given to a format : for instance "inrimage", "gif" */
+  char realName[IMAGE_FORMAT_NAME_LENGTH];
+  /* pointer towards the next image format*/
+  struct imformat *next;
+} IMAGE_FORMAT, *PTRIMAGE_FORMAT;
+
+/** Image descriptor */
+typedef struct point_image {
+  /** Image x dimension (number of columns) */
+  std::size_t xdim;
+  /** Image y dimension (number of rows) */
+  std::size_t ydim;
+  /** Image z dimension (number of planes) */
+  std::size_t zdim;
+  /** Image vectorial dimension */
+  std::size_t vdim;
+
+  /** Image voxel size in x dimension */
+  double vx;
+  /** Image voxel size in y dimension */
+  double vy;
+  /** Image voxel size in z dimension */
+  double vz;
+
+  /** Image offset in x dimension */
+  float tx;
+  /** Image offset in y dimension */
+  float ty;
+  /** Image offset in z dimension */
+  float tz;
+
+  /** Image rotation vector in x dimension */
+  float rx;
+  /** Image rotation vector in y dimension */
+  float ry;
+  /** Image rotation vector in z dimension */
+  float rz;
+
+  /** Image center in x dimension */
+  int cx;
+  /** Image center in y dimension */
+  int cy;
+  /** Image center in z dimension */
+  int cz;
+
+  /** spm */
+  float spm_offset;
+  float spm_scale;
+
+  /** Image data buffer */
+  void *data;
+
+  /** Image word size (in bytes) */
+  std::size_t wdim;
+  /** Image format to use for I/0. Should not be set by user */
+  PTRIMAGE_FORMAT imageFormat;
+  /** Data buffer vectors are interlaced or non interlaced */
+  VECTORIAL_MODE vectMode;
+  /** Image words kind */
+  WORD_KIND wordKind;
+  /** Image words sign */
+  SIGN sign;
+
+  /** User defined strings array. The user can use any internal purpose string.
+      Each string is written at then end of header after a '#' character. */
+  char **user;
+  /** Number of user defined strings */
+  unsigned int nuser;
+
+  /** Image file descriptor */
+  _ImageIO_file fd;
+
+
+  /** Kind of image file descriptor */
+  OPEN_MODE openMode;
+  /** Written words endianness */
+  ENDIANNESS endianness;
+  /** Kind of image data encoding */
+  DATA_MODE dataMode;
+
+} _image;
+
+
+
+/** Error codes */
+#define ImageIO_NO_ERROR 0
+#define ImageIO_UNKNOWN_TYPE -1
+#define ImageIO_OPENING -2
+#define ImageIO_READING_HEADER -3
+#define ImageIO_READING_IMAGE -4
+#define ImageIO_WRITING_HEADER -3
+#define ImageIO_WRITING_IMAGE -4
+#define ImageIO_WRITING_DATA  -5
+
+
+
+
+
+/** Allocates and initializes an image descriptor */
+CGAL_IMAGEIO_EXPORT _image *_initImage();
+
+/** Free an image descriptor
+    @param im image descriptor */
+CGAL_IMAGEIO_EXPORT void _freeImage(_image *im);
+
+/** creates an image descriptor from the given header information
+    @param x image x dimension (number of columns)
+    @param y image y dimension (number of rows)
+    @param z image z dimension (number of planes)
+    @param v image vectorial dimension
+    @param vx image voxel size in x dimension
+    @param vy image voxel size in y dimension
+    @param vz image voxel size in z dimension
+    @param w image word size in bytes
+    @param wk image word kind
+    @param sgn image word sign */
+CGAL_IMAGEIO_EXPORT _image *_createImage(int x, int y, int z, int v,
+                                         float vx, float vy, float vz, int w,
+                                         WORD_KIND wk, SIGN sgn);
+
+
+/** Reads an image from a file and returns an image descriptor or NULL if<br>
+    reading failed.<br>
+    Reads from stdin if image name is NULL.
+    The image data field points to a xdim * ydim * zdim * vdim buffer
+    containing voxels in order:
+    (Z1, Y1, X1, V1) (Z1, Y1, X1, V2), ... , (Z1, Y1, X1, Vt),
+    (Z1, Y1, X2, V1) ...         ...       , (Z1, Y1, X2, Vt),
+    ...
+    (Z1, Y1, Xn, V1) ...         ...       , (Z1, Y1, Xn, Vt),
+    (Z1, Y2, X1, V1) ...         ...       , (Z1, Y2, X1, Vt),
+    ...
+    (Z2, Y1, X1, V1) ...         ...       , (Z2, Y1, X1, Vt),
+    ...
+                     ...         ...       , (Zl, Ym, Xn, Vt)
+
+    Read the following format:
+    Inrimage,
+    GIF,
+    IRIS,
+    ANALYSE,
+    PGM,
+    PPM,
+    BMP,
+    GIS (CEA, IRISA, ENST 3D image format).
+    
+    See also:
+    http://www.dcs.ed.ac.uk/home/mxr/gfx/2d-hi.html and
+    http://www.gzip.org/zlib/
+    
+
+   @param name image file name or NULL for stdin */
+CGAL_IMAGEIO_EXPORT _image* _readImage(const char *name);
+
+/** Reads an image from a file and returns an image descriptor or NULL if<br>
+    reading failed.<br>
+    Reads from stdin if image name is NULL.
+    If the image is vectorial, it is uninterlaced, i.e. the image data
+    field points to a xdim * ydim * zdim * vdim buffer containing voxels
+    in order:
+     (V1, Z1, Y1, X1) (V1, Z1, Y1, X2), ... , (V1, Z1, Y1, Xn),
+     (V1, Z1, Y2, X1) ...         ...       , (V1, Z1, Y2, Xn),
+     ...
+     (V1, Z1, Ym, X1) ...         ...       , (V1, Z1, Ym, Xn),
+     (V1, Z2, Y1, X1) ...         ...       , (V1, Z2, Y1, Xn),
+     ...
+     (V2, Z1, Y1, X1) ...         ...       , (V2, Z1, Y1, Xn),
+     ...
+                      ...         ...       , (Vt, Zl, Ym, Xn)
+   @param name image file name or NULL */
+CGAL_IMAGEIO_EXPORT _image* _readNonInterlacedImage(const char *name);
+
+/** Read an image from a file. The word type is supposed to be unsigned
+    char, and the dimensions are (rx, ry, rz). */
+CGAL_IMAGEIO_EXPORT _image* _readImage_raw(const char *name,
+                                           const unsigned int rx,
+                                           const unsigned int ry,
+                                           const unsigned int rz,
+                                           const double vx = 1.,
+                                           const double vy = 1.,
+                                           const double vz = 1.,
+                                           const unsigned int offset = 0);
+
+
+/** Writes given image in file 'name'.<br>
+    If name ends with '.gz', file is gzipped.<br>
+    If name is NULL, image is sent to stdout.
+    @param im image descriptor 
+    @param name file name to store image or NULL */
+CGAL_IMAGEIO_EXPORT int _writeImage(_image *im, const char *name);
+
+/** Read one slice of given image whose header has already been read.<br>
+    File descriptor is let at the beginning of next slice and closed<br>
+    when end of file is encountered.<br>
+    If data buffer is NULL, it is allocated for one slice only.<br>
+    This funtion is dedicated to read huge inrimages.
+    @param im image descriptor */
+CGAL_IMAGEIO_EXPORT void _getNextSlice(_image *im);
+
+
+/** adds a format in the list of image format. Test if all mandatory
+    fields have been filled 
+    @param format : an image format 
+    @return -1 if it failed (missing information) and 0 if it succeeded */
+CGAL_IMAGEIO_EXPORT int addImageFormat( PTRIMAGE_FORMAT format);
+
+
+/** returns the first available image format */
+CGAL_IMAGEIO_EXPORT PTRIMAGE_FORMAT firstImageFormat();
+
+/** Reads header from an image file<br>
+    If file is an inrimage, only header is read. Otherwise, whole image<br>
+    is read and image file descriptor is closed.<br>
+    If name is NULL, header is read from STDIN
+    @param name image file name or NULL */
+CGAL_IMAGEIO_EXPORT _image* _readImageHeader(const char *name);
+CGAL_IMAGEIO_EXPORT _image *_readImageHeaderAndGetError( const char *name, int *error );
+
+/** Reads body from an inrmage whose header has been read by
+    _readImageHeader
+    @param im image to read */
+CGAL_IMAGEIO_EXPORT int _readImageData(_image *im);
+
+/** Reads body from a vectorial inrimage whose header has been read by
+    _readImageHeader. The image is uninterlaced
+    (see _readNonInterlacedImage for details).
+    @param im image descriptor*/
+CGAL_IMAGEIO_EXPORT int _readNonInterlacedImageData(_image *im);
+
+/** Reads body from a non-interlaced vectorial inrimage whose header has
+    been read by _readImageHeader. The image buffer is interlaced.
+    @param im image descriptor */
+CGAL_IMAGEIO_EXPORT int _readNonInterlacedFileData(_image *im);
+
+
+
+
+/** given an initialized file descriptor and a file name, open file
+   from stdout (if name == NULL), a gziped pipe (if file is gziped)
+   or a standard file otherwise.
+   @param im initialized image descriptor
+   @param name image file name */
+CGAL_IMAGEIO_EXPORT void _openWriteImage(_image* im, const char *name) ;
+   
+/** open an image file from stdin (if name == NULL), from a pipe
+   (piped with gzip if image was compressed) or from a standard file
+   @param im initialized image descriptor
+   @param name image file name */
+CGAL_IMAGEIO_EXPORT void _openReadImage(_image *im, const char *name);
+
+/** close an image file descriptor that was opened using _openImage
+    @param im opened image descriptor */
+
+
+/** return the bounding box of the image
+    @param im opened image descriptor */
+CGAL_IMAGEIO_EXPORT void _get_image_bounding_box(_image* im,
+                                                 double* x_min, double* y_min, double* z_min,
+                                                 double* x_max, double* y_max, double* z_max);
+
+/** returns the endianness of the hardware architecture */
+CGAL_IMAGEIO_EXPORT ENDIANNESS  _getEndianness(); 
+/** initializes the list of  supported image formats */
+CGAL_IMAGEIO_EXPORT void initSupportedFileFormat();
+/** prints supported image formats */
+CGAL_IMAGEIO_EXPORT void printSupportedFileFormat();
+/** free the list of  supported image formats */
+CGAL_IMAGEIO_EXPORT void removeSupportedFileFormat();
+
+
+/** return image type in given file
+    @param fileName image file name */
+CGAL_IMAGEIO_EXPORT PTRIMAGE_FORMAT imageType(const char *fileName);
+
+extern "C" {
+/** function prototype to allocate memory */
+typedef void *(*ALLOCATION_FUNCTION)(size_t);
+
+/** function prototype to free memory */
+typedef void (*DEALLOCATION_FUNCTION)(void *);
+}
+
+/** set allocation and deallocation routines
+    @param alloc new allocation routine
+    @param del new deallocation routine */
+CGAL_IMAGEIO_EXPORT void setImageIOAllocationRoutines(ALLOCATION_FUNCTION alloc,
+                                                      DEALLOCATION_FUNCTION del);
+
+
+
+/** call allocation routine */
+CGAL_IMAGEIO_EXPORT void *ImageIO_alloc(size_t);
+/** call deallocation routine */
+CGAL_IMAGEIO_EXPORT void ImageIO_free(void *);
+
+/** replaces fwrite function
+    @param im image to write
+    @param buf data buffer to write
+    @param len buffer length */
+CGAL_IMAGEIO_EXPORT size_t ImageIO_write(const _image *im, const void *buf, size_t len);
+
+
+/** replaces fread function
+    @param im image to read
+    @param buf data buffer to read
+    @param len buffer length */
+CGAL_IMAGEIO_EXPORT size_t ImageIO_read(const _image *im, void *buf, size_t len);
+
+/** replaces fgets function
+ */
+CGAL_IMAGEIO_EXPORT char *ImageIO_gets( const _image *im, char *str, int size );
+
+/** replaces fseek function
+ */
+CGAL_IMAGEIO_EXPORT long ImageIO_seek( const _image *im, long offset, int whence );
+
+/** replaces ferror function
+ */
+CGAL_IMAGEIO_EXPORT int ImageIO_error( const _image *im );
+
+/** replaces fclose function
+ */
+CGAL_IMAGEIO_EXPORT int ImageIO_close( _image *im );
+
+/** trilinear interpolation in an _image. The returned type is float (cast
+    are made if the image word type is different).
+ */
+CGAL_IMAGEIO_EXPORT float triLinInterp(const _image* image, float posx, float posy, float posz,
+                                       const float value_outside = 0.);
+
+/** Alias for triLinInterp */
+CGAL_IMAGEIO_EXPORT inline float trilinear_interpolation(const _image* image,
+                                                         float posx, float posy, float posz)
+{
+  return triLinInterp(image, posx, posy, posz);
+}
+
+namespace CGAL {
+namespace IMAGEIO {
+
+//
+// The following definition are for the evaluate function.
+// 
+template <WORD_KIND wordKind, SIGN sign, std::size_t wdim>
+struct Word_type_generator
+{
+};
+
+template <SIGN sign>
+struct Word_type_generator<WK_FLOAT, sign, 4>
+{
+  typedef float type;
+};
+
+template <SIGN sign>
+struct Word_type_generator<WK_FLOAT, sign, 8>
+{
+  typedef double type;
+};
+
+template <>
+struct Word_type_generator<WK_FIXED, SGN_SIGNED, 1>
+{
+//   typedef boost::int8_t type;
+  typedef char type;
+};
+
+template <>
+struct Word_type_generator<WK_FIXED, SGN_UNSIGNED, 1>
+{
+  typedef boost::uint8_t type;
+};
+
+template <>
+struct Word_type_generator<WK_FIXED, SGN_SIGNED, 2>
+{
+  typedef boost::int16_t type;
+};
+
+template <>
+struct Word_type_generator<WK_FIXED, SGN_UNSIGNED, 2>
+{
+  typedef boost::uint16_t type;
+};
+
+template <>
+struct Word_type_generator<WK_FIXED, SGN_SIGNED, 4>
+{
+  typedef boost::int32_t type;
+};
+
+template <>
+struct Word_type_generator<WK_FIXED, SGN_UNSIGNED, 4>
+{
+  typedef boost::uint32_t type;
+};
+
+template <WORD_KIND wordKind, SIGN sign, std::size_t wdim>
+inline
+typename Word_type_generator<wordKind, sign, wdim>::type
+static_evaluate(const _image* image,
+                const std::size_t i,
+                const std::size_t j,
+                const std::size_t k)
+{
+  typedef typename Word_type_generator<wordKind, sign, wdim>::type Word;
+
+  return static_evaluate<Word>(image, i, j, k);
+}
+
+template <typename Word>
+inline
+Word&
+static_evaluate(const _image* image,
+                const std::size_t i,
+                const std::size_t j,
+                const std::size_t k)
+{
+  return ((Word*)image->data)[(k * image->ydim + j) * image->xdim + i];
+}
+
+template <typename Word>
+inline
+Word&
+static_evaluate(const _image* image,
+                const std::size_t i)
+{
+  return ((Word*)image->data)[i];
+}
+
+} // end namespace IMAGEIO
+} // end namespace CGAL
+
+#define CGAL_IMAGE_IO_CASE(image_ptr,code)                                                 \
+  switch(image_ptr->wordKind)                                                              \
+  {                                                                                        \
+  case WK_FLOAT:                                                                           \
+    switch(image_ptr->wdim)                                                                \
+    {                                                                                      \
+    case 4: {                                                                              \
+      typedef CGAL::IMAGEIO::Word_type_generator<WK_FLOAT, SGN_UNKNOWN, 4>::type Word;     \
+      code;                                                                                \
+      break;                                                                               \
+    }                                                                                      \
+    case 8: {                                                                              \
+      typedef CGAL::IMAGEIO::Word_type_generator<WK_FLOAT, SGN_UNKNOWN, 8>::type Word;     \
+      code;                                                                                \
+      break;                                                                               \
+    }                                                                                      \
+    default:                                                                               \
+      break;                                                                               \
+    }                                                                                      \
+    break;                                                                                 \
+  case WK_FIXED:                                                                           \
+    switch(image_ptr->wdim)                                                                \
+    {                                                                                      \
+    case 2: {                                                                              \
+      if(image_ptr->sign == SGN_SIGNED) {                                                  \
+        typedef CGAL::IMAGEIO::Word_type_generator<WK_FIXED, SGN_SIGNED, 2>::type Word;    \
+        code;                                                                              \
+        break;                                                                             \
+      }                                                                                    \
+      else {                                                                               \
+        typedef CGAL::IMAGEIO::Word_type_generator<WK_FIXED, SGN_UNSIGNED, 2>::type Word;  \
+        code;                                                                              \
+        break;                                                                             \
+      }                                                                                    \
+    }                                                                                      \
+    case 1: {                                                                              \
+      if(image_ptr->sign == SGN_SIGNED) {                                                  \
+        typedef CGAL::IMAGEIO::Word_type_generator<WK_FIXED, SGN_SIGNED, 1>::type Word;    \
+        code;                                                                              \
+        break;                                                                             \
+      }                                                                                    \
+      else {                                                                               \
+        typedef CGAL::IMAGEIO::Word_type_generator<WK_FIXED, SGN_UNSIGNED, 1>::type Word;  \
+        code;                                                                              \
+        break;                                                                             \
+      }                                                                                    \
+    }                                                                                      \
+    case 4: {                                                                              \
+      if(image_ptr->sign == SGN_SIGNED) {                                                  \
+        typedef CGAL::IMAGEIO::Word_type_generator<WK_FIXED, SGN_SIGNED, 4>::type Word;    \
+        code;                                                                              \
+        break;                                                                             \
+      }                                                                                    \
+      else {                                                                               \
+        typedef CGAL::IMAGEIO::Word_type_generator<WK_FIXED, SGN_UNSIGNED, 4>::type Word;  \
+        code;                                                                              \
+        break;                                                                             \
+      }                                                                                    \
+    }                                                                                      \
+    default:                                                                               \
+      break;                                                                               \
+    }                                                                                      \
+    break;                                                                                 \
+  default:                                                                                 \
+    break;                                                                                 \
+  }
+
+CGAL_IMAGEIO_EXPORT float evaluate(const _image* image,const std::size_t i,const std::size_t j,const std::size_t k);
+
+
+/** convert the data of the image to float 
+*/
+CGAL_IMAGEIO_EXPORT void convertImageTypeToFloat(_image* image);
+
+#ifdef CGAL_HEADER_ONLY
+#include <CGAL/ImageIO_impl.h>
+#endif // CGAL_HEADER_ONLY
+
+#endif // end IMAGEIO_H
diff --git a/3rdparty/CGAL/include/CGAL/ImageIO/analyze.h b/3rdparty/CGAL/include/CGAL/ImageIO/analyze.h
new file mode 100644
index 0000000..bc3a1c4
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/ImageIO/analyze.h
@@ -0,0 +1,74 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+#ifndef ANALYZE_H
+#define ANALYZE_H
+
+#ifdef _MSC_VER
+#pragma warning ( disable : 4068 4786 4081 4267 )
+#endif
+
+
+
+#include <CGAL/ImageIO.h>
+
+/* read analyse format header
+
+   return:
+   -1: error
+   0: success
+ */
+int readAnalyzeHeader(const char* name,_image *im);
+
+int testAnalyzeHeader(char *magic,const char *name);
+
+/** creates an return the file format structure associated with the Analyze file format */
+PTRIMAGE_FORMAT createAnalyzeFormat();
+
+/* 
+   return:
+   -1: error
+    1: success
+ */
+int writeAnalyze( char *basename, _image* im ) ;
+
+
+/* 
+   return:
+   -1: error
+    1: success
+ */
+int writeAnalyzeHeader( const _image* im ) ;
+
+
+
+/* 
+   return:
+   -1: error
+    1: success
+ */
+int writeAnalyzeData( const _image* im ) ;
+
+#ifdef CGAL_HEADER_ONLY
+#include <CGAL/ImageIO/analyze_impl.h>
+#endif // CGAL_HEADER_ONLY
+
+#endif
diff --git a/3rdparty/CGAL/include/CGAL/ImageIO/analyze_impl.h b/3rdparty/CGAL/include/CGAL/ImageIO/analyze_impl.h
new file mode 100644
index 0000000..ec4aac4
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/ImageIO/analyze_impl.h
@@ -0,0 +1,849 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+#include <cstring>
+
+#ifdef CGAL_HEADER_ONLY
+#define CGAL_INLINE_FUNCTION inline
+#else
+#define CGAL_INLINE_FUNCTION
+#endif
+
+/* compile time endianness */
+/* replaced by _getEndianness()
+   see below
+#if (defined (_ALPHA_) || defined (_LINUX_))
+#define ARCHITECTURE_ENDIANNESS END_LITTLE
+#else
+#define ARCHITECTURE_ENDIANNESS END_BIG
+#endif
+*/
+
+/** Magic header for ANALYZE files written in little endian format */
+#define ANALYZE_LE_MAGIC "\000\000\001\134"
+/** Magic header for ANALYZE files written in big endian format */
+#define ANALYZE_BE_MAGIC "\134\001\000\000"
+
+#define DT_NONE			0 
+#define DT_UNKNOWN              0 /*Unknown data type*/ 
+#define DT_BINARY               1 /*Binary (1 bit per voxel)*/ 
+#define DT_UNSIGNED_CHAR        2 /*Unsigned character (8 bits per voxel)*/ 
+#define DT_SIGNED_SHORT         4 /*Signed short (16 bits per voxel)*/ 
+#define DT_SIGNED_INT           8 /*Signed integer (32 bits per voxel)*/ 
+#define DT_FLOAT                16 /*Floating point (32 bits per voxel)*/ 
+#define DT_COMPLEX              32 /*Complex (64 bits per voxel; 2 floating point numbers) */
+#define DT_DOUBLE               64 /*Double precision (64 bits per voxel)*/ 
+#define DT_RGB                  128 /* */
+#define DT_ALL                  255 /* */
+
+#include <cstring>
+
+struct header_key                       /*      header_key       */
+    {                                           /* off + size*/
+        int sizeof_hdr;                         /* 0 + 4     */
+        char data_type[10];                     /* 4 + 10    */
+        char db_name[18];                       /* 14 + 18   */
+        int extents;                            /* 32 + 4    */
+        short int session_error;                /* 36 + 2    */
+        char regular;                           /* 38 + 1    */
+        char hkey_un0;                          /* 39 + 1    */
+    };                                          /* total=40  */
+
+struct image_dimension                  /*      image_dimension  */
+    {                                           /* off + size*/
+        short int dim[8];                       /* 0 + 16    */
+        char vox_units[4];                      /* 16 + 4    */
+        char cal_units[8];                      /* 20 + 4    */
+        short int unused1;                      /* 24 + 2    */
+        short int datatype;                     /* 30 + 2    */
+        short int bitpix;                       /* 32 + 2    */
+        short int dim_un0;                      /* 34 + 2    */
+        float pixdim[8];                        /* 36 + 32   */
+                        /* 
+                                pixdim[] specifies the voxel dimensions:
+                                pixdim[1] - voxel width
+                                pixdim[2] - voxel height
+                                pixdim[3] - interslice distance
+                                        ..etc
+                        */
+        float vox_offset;                       /* 68 + 4    */
+        float funused1;                         /* 72 + 4    */
+        float funused2;                         /* 76 + 4    */
+        float funused3;                         /* 80 + 4    */
+        float cal_max;                          /* 84 + 4    */
+        float cal_min;                          /* 88 + 4    */
+        int compressed;                         /* 92 + 4    */
+        int verified;                           /* 96 + 4    */
+        int glmax, glmin;                       /* 100 + 8   */
+    };                                          /* total=108 */
+         
+struct data_history                     /*      data_history     */
+    {                                           /* off + size*/
+        char descrip[80];                       /* 0 + 80    */
+        char aux_file[24];                      /* 80 + 24   */
+        char orient;                            /* 104 + 1   */
+        char originator[10];                    /* 105 + 10  */
+        char generated[10];                     /* 115 + 10  */
+        char scannum[10];                       /* 125 + 10  */
+        char patient_id[10];                    /* 135 + 10  */
+        char exp_date[10];                      /* 145 + 10  */
+        char exp_time[10];                      /* 155 + 10  */
+        char hist_un0[3];                       /* 165 + 3   */
+        int views;                              /* 168 + 4   */
+        int vols_added;                         /* 172 + 4   */
+        int start_field;                        /* 176 + 4   */
+        int field_skip;                         /* 180 + 4   */
+        int omax,omin;                          /* 184 + 8   */
+        int smax,smin;                          /* 192 + 8   */
+    };                                        
+
+
+struct dsr                                   /*      dsr              */
+   {                                         /* off + size*/
+     struct header_key hk;                   /* 0 + 40    */
+     struct image_dimension dime;            /* 40 + 108  */
+     struct data_history hist;               /* 148 + 200 */
+   };                                        /* total=348 */
+
+ 
+
+
+/*---------------- _swapLong ------------------------------------------------*/
+CGAL_INLINE_FUNCTION
+static void _swapLong( unsigned char *pntr)
+{
+  unsigned char b0, b1, b2, b3;
+  
+  b0 = *pntr;
+  b1 = *(pntr+1);
+  b2 = *(pntr+2);
+  b3 = *(pntr+3);
+  
+  *pntr = b3;
+  *(pntr+1) = b2;
+  *(pntr+2) = b1;
+  *(pntr+3) = b0;
+}
+        
+/*---------------- _swapShort -----------------------------------------------*/
+CGAL_INLINE_FUNCTION
+static void _swapShort( unsigned char *pntr)
+{
+  unsigned char b0, b1;
+  
+  b0 = *pntr;
+  b1 = *(pntr+1);
+
+  *pntr = b1;
+  *(pntr+1) = b0;
+}
+
+/*---------------- _swapAnalyzeHdr ------------------------------------------*/
+CGAL_INLINE_FUNCTION
+static void _swapAnalyzeHdr( struct dsr *pntr)
+{
+  
+  _swapLong((unsigned char*) &pntr->hk.sizeof_hdr) ;
+  _swapLong((unsigned char*) &pntr->hk.extents) ;
+  _swapShort((unsigned char*) &pntr->hk.session_error) ;
+  _swapShort((unsigned char*) &pntr->dime.dim[0]) ;
+  _swapShort((unsigned char*) &pntr->dime.dim[1]) ;
+  _swapShort((unsigned char*) &pntr->dime.dim[2]) ;
+  _swapShort((unsigned char*) &pntr->dime.dim[3]) ;
+  _swapShort((unsigned char*) &pntr->dime.dim[4]) ;
+  _swapShort((unsigned char*) &pntr->dime.dim[5]) ;
+  _swapShort((unsigned char*) &pntr->dime.dim[6]) ;
+  _swapShort((unsigned char*) &pntr->dime.dim[7]) ;
+  _swapShort((unsigned char*) &pntr->dime.unused1) ;
+  _swapShort((unsigned char*) &pntr->dime.datatype) ;
+  _swapShort((unsigned char*) &pntr->dime.bitpix) ;
+  _swapLong((unsigned char*) &pntr->dime.pixdim[0]) ;
+  _swapLong((unsigned char*) &pntr->dime.pixdim[1]) ;
+  _swapLong((unsigned char*) &pntr->dime.pixdim[2]) ;
+  _swapLong((unsigned char*) &pntr->dime.pixdim[3]) ;
+  _swapLong((unsigned char*) &pntr->dime.pixdim[4]) ;
+  _swapLong((unsigned char*) &pntr->dime.pixdim[5]) ;
+  _swapLong((unsigned char*) &pntr->dime.pixdim[6]) ;
+  _swapLong((unsigned char*) &pntr->dime.pixdim[7]) ;
+  _swapLong((unsigned char*) &pntr->dime.vox_offset) ;
+  _swapLong((unsigned char*) &pntr->dime.funused1) ;
+  _swapLong((unsigned char*) &pntr->dime.funused2) ;
+  _swapLong((unsigned char*) &pntr->dime.cal_max) ;
+  _swapLong((unsigned char*) &pntr->dime.cal_min) ;
+  _swapLong((unsigned char*) &pntr->dime.compressed) ;
+  _swapLong((unsigned char*) &pntr->dime.verified) ;
+  _swapShort((unsigned char*) &pntr->dime.dim_un0) ;
+  _swapLong((unsigned char*) &pntr->dime.glmax) ;
+  _swapLong((unsigned char*) &pntr->dime.glmin) ;
+}
+
+CGAL_INLINE_FUNCTION
+PTRIMAGE_FORMAT createAnalyzeFormat() {
+  PTRIMAGE_FORMAT f=(PTRIMAGE_FORMAT) ImageIO_alloc(sizeof(IMAGE_FORMAT));
+
+  f->testImageFormat=&testAnalyzeHeader;
+  f->readImageHeader=&readAnalyzeHeader;
+  f->writeImage=&writeAnalyze;
+  strcpy(f->fileExtension,".hdr,.hdr.gz,.img,.img.gz");
+  strcpy(f->realName,"Analyze");
+  return f;
+}
+
+CGAL_INLINE_FUNCTION
+int testAnalyzeHeader(char *magic,const char *) {
+   /* opened image is an ANALYZE */
+  if( !memcmp(magic,ANALYZE_LE_MAGIC,4) ||
+      !memcmp(magic,ANALYZE_BE_MAGIC,4)) 
+    return 0;
+  else 
+    return -1;
+}
+
+CGAL_INLINE_FUNCTION
+int writeAnalyze( char *name, _image* im) {
+  char *outputName;
+  std::size_t length, extLength=0;
+
+
+  length=strlen(name);
+  outputName= (char *)ImageIO_alloc(length+8);
+  
+  if ( strncmp( name+length-4, ".hdr", 4 ) == 0 ) {
+    extLength = 4;
+  }
+  else if ( strncmp( name+length-4, ".img", 4 ) == 0 ) {
+    extLength = 4;
+  }
+  else if ( strncmp( name+length-7, ".img.gz", 7 ) == 0 ) {
+    extLength = 7;
+  }
+  else if ( strncmp( name+length-7, ".hdr.gz", 7 ) == 0 ) {
+    extLength = 7;
+  }
+
+  strncpy( outputName, name, length-extLength );
+  if ( strncmp( name+length-7, ".hdr.gz", 7 ) == 0 )
+    strcpy( outputName+length-extLength, ".hdr.gz" );
+  else
+    strcpy( outputName+length-extLength, ".hdr" );
+  
+  _openWriteImage(im, outputName);
+  if( !im->fd ) {
+    fprintf(stderr, "writeAnalyze: error: unable to open file \'%s\'\n", outputName);
+    if ( outputName != NULL ) ImageIO_free( outputName );
+    return ImageIO_OPENING;
+  }
+
+  int res = writeAnalyzeHeader(im);
+  if ( res < 0 ) {
+    fprintf(stderr, "writeAnalyze: error: unable to write header of \'%s\'\n",
+	    outputName);
+    if ( outputName != NULL ) ImageIO_free( outputName );
+    ImageIO_close( im );
+    im->fd = NULL;
+    im->openMode = OM_CLOSE;
+    return( res );
+  }
+  
+  ImageIO_close(im);
+  
+  strncpy( outputName, name, length-extLength );
+  if ( strncmp( name+length-3, ".gz", 3 ) == 0 ) {
+    strcpy( outputName+length-extLength, ".img.gz" );
+  }
+  else {
+    strcpy( outputName+length-extLength, ".img" );
+  }
+
+  _openWriteImage(im, outputName);
+
+  if( !im->fd ) {
+    fprintf(stderr, "writeAnalyze: error: unable to open file \'%s\'\n", outputName);
+    if ( outputName != NULL ) ImageIO_free( outputName );
+    return ImageIO_OPENING;
+  }
+
+  res = writeAnalyzeData(im);
+  if (res < 0) {
+    fprintf(stderr, "writeAnalyze: error: unable to write data in \'%s\'\n",
+	    outputName );
+    ImageIO_close( im );
+    im->fd = NULL;
+    im->openMode = OM_CLOSE;
+    return( res );
+  }
+
+  if ( outputName != NULL ) ImageIO_free( outputName );
+  ImageIO_close( im );
+  im->fd = NULL;
+  im->openMode = OM_CLOSE;
+
+  return ( res );
+}
+
+/* 
+   return:
+   -1: error
+   0: success
+ */
+
+CGAL_INLINE_FUNCTION
+int _readAnalyzeHeader( _image* im, const char* name, 
+			struct dsr *analyzeHeader )
+{
+
+   unsigned int i ;
+   /* compile time endianness */
+   ENDIANNESS ARCHITECTURE_ENDIANNESS = _getEndianness();
+
+   if(im->openMode != OM_CLOSE) {
+      
+     ImageIO_read( im, analyzeHeader, sizeof(struct dsr) );
+      
+      if( analyzeHeader->hk.sizeof_hdr == sizeof(struct dsr) )
+      {
+	 im->endianness = ARCHITECTURE_ENDIANNESS ;
+      }
+      else
+      {
+	_swapAnalyzeHdr( analyzeHeader );
+	 if( analyzeHeader->hk.sizeof_hdr != sizeof(struct dsr) )
+	 {
+	    fprintf (stderr,
+		     "_readAnalyzeHeader: error: unknown magic (%d)...\n",
+		     analyzeHeader->hk.sizeof_hdr );
+	    return -1;
+	 }
+	 if( ARCHITECTURE_ENDIANNESS == END_LITTLE )
+	 {
+	    im->endianness = END_BIG;
+	 }
+	 else
+	 {
+	    im->endianness = END_LITTLE;
+	 }
+      }
+      
+      if ( analyzeHeader->dime.dim[0] > 4 ) {
+	 fprintf (stderr,
+		  "_readAnalyzeHeader: error: dimensionality not supported (%d)...\n",
+		  analyzeHeader->dime.dim[0] );
+	 return -1;
+      }
+      
+      im->xdim = analyzeHeader->dime.dim[1];
+      im->ydim = analyzeHeader->dime.dim[2];
+      im->zdim = analyzeHeader->dime.dim[3];
+
+      /* 0 time-points is a convention for one volume only at MNI */
+      /* Corrected by X. Pennec following a bug report by Irina Kezele at MNI */
+      if( analyzeHeader->dime.dim[4] == 0 ){
+	fprintf (stderr,
+		 "_readAnalyzeHeader: warning: time dimension / number if volume (dim[4]) is 0. Assuming this means 1 (otherwise there would be no image...). \n");
+	analyzeHeader->dime.dim[4] = 1; 
+      }
+
+      /* Analyze doesn't support vector images.
+	 The forth dimension relates to time. */
+      if( analyzeHeader->dime.dim[4] != 1 )
+      {
+	 fprintf (stderr,
+		  "_readAnalyzeHeader: error: time dimension not supported (%d)...\n",
+		  analyzeHeader->dime.dim[4] );
+	 return -1;
+      }
+      im->vectMode = VM_SCALAR;
+      
+      im->vx = analyzeHeader->dime.pixdim[1];
+      im->vy = analyzeHeader->dime.pixdim[2];
+      im->vz = analyzeHeader->dime.pixdim[3];
+
+      if( im->vx == 0.0 ) im->vx = 1.0 ;
+      if( im->vy == 0.0 ) im->vy = im->vx ;
+      if( im->vz == 0.0 ) im->vz = im->vy ;
+      
+      switch(analyzeHeader->dime.datatype)
+      {
+	 case DT_BINARY:
+	 case DT_UNSIGNED_CHAR:
+	 case DT_SIGNED_SHORT:
+	 case DT_SIGNED_INT:
+	 case DT_FLOAT:
+	 case DT_COMPLEX:
+	 case DT_DOUBLE:
+	    im->vdim = 1;
+	    break ;
+	    
+	 case DT_RGB:
+	    im->vdim = 3;
+	    break ;
+	    
+	 default:
+	    fprintf (stderr,
+		     "_readAnalyzeHeader: error: data type not supported (%d)...\n",
+		     analyzeHeader->dime.datatype );
+	    return -1;
+      }
+      
+      switch(analyzeHeader->dime.datatype)
+      {
+	 case DT_BINARY:
+	 case DT_UNSIGNED_CHAR:
+	 case DT_SIGNED_SHORT:
+	 case DT_SIGNED_INT:
+	 case DT_RGB:
+	    im->wordKind = WK_FIXED;
+	    break ;
+	    
+	 case DT_FLOAT:
+	 case DT_COMPLEX:
+	 case DT_DOUBLE:
+	    im->wordKind = WK_FLOAT;
+	    break ;
+	    
+	 default:
+	    fprintf (stderr,
+		     "_readAnalyzeHeader: error: data type not supported (%d)...\n",
+		     analyzeHeader->dime.datatype );
+	    return -1;
+      }
+      
+      switch(analyzeHeader->dime.datatype)
+      {
+	 case DT_BINARY:
+	 case DT_UNSIGNED_CHAR:
+	 case DT_RGB:
+	    im->sign = SGN_UNSIGNED;
+	    break ;
+	    
+	 case DT_SIGNED_SHORT:
+	 case DT_SIGNED_INT:
+	 case DT_FLOAT:
+	 case DT_COMPLEX:
+	 case DT_DOUBLE:
+	    im->sign = SGN_SIGNED;
+	    break ;
+	    
+	 default:
+	    fprintf (stderr,
+		     "_readAnalyzeHeader: error: data type not supported (%d)...\n",
+		     analyzeHeader->dime.datatype );
+	    return -1;
+      }
+      
+      im->wdim = analyzeHeader->dime.bitpix;
+      if( analyzeHeader->dime.datatype == DT_RGB )
+      {
+	 im->wdim /= 3 ;
+      }
+      if(im->wdim != 8 && im->wdim != 16 && im->wdim != 32 && im->wdim != 64)
+      {
+	 fprintf (stderr,
+		  "_readAnalyzeHeader: error: pixel size not supported (%d)...\n",
+		  analyzeHeader->dime.bitpix );
+	 return -1;
+      }
+      im->wdim >>= 3 ;
+      
+      /* There are 17 optional data fields 
+	 be careful in the allocation
+       */
+      im->nuser = 1 + 17 ;
+      im->user = (char **) ImageIO_alloc(im->nuser * sizeof(char *));
+      for ( i=0; i<im->nuser; i++ ) im->user[i] = NULL;
+      i = 0 ;
+      
+      im->user[i] = (char *) ImageIO_alloc((strlen("Data lost in the Analyze -> ImageIO conversion:") + 1));
+      sprintf( im->user[i++], "Data lost in the Analyze -> ImageIO conversion:" );
+      
+      im->user[i] = (char *) ImageIO_alloc((strlen("  descrip: ") + 1 + strlen(analyzeHeader->hist.descrip) ));
+      sprintf( im->user[i++], "  descrip: %s", analyzeHeader->hist.descrip );
+      
+      im->user[i] = (char *) ImageIO_alloc((strlen("  aux_file: ") + 1 + strlen(analyzeHeader->hist.descrip) ));
+      sprintf( im->user[i++], "  aux_file: %s", analyzeHeader->hist.descrip );
+      
+      im->user[i] = (char *) ImageIO_alloc((strlen("  orient: ") + 1+ 2));
+      sprintf( im->user[i++], "  orient: %d", analyzeHeader->hist.orient );
+      
+      im->user[i] = (char *) ImageIO_alloc((strlen("  originator: ") + 1 + strlen(analyzeHeader->hist.originator) ));
+      sprintf( im->user[i++], "  originator: %s", analyzeHeader->hist.originator );
+      
+      im->user[i] = (char *) ImageIO_alloc((strlen("  generated: ") + 1 + strlen(analyzeHeader->hist.generated) ));
+      sprintf( im->user[i++], "  generated: %s", analyzeHeader->hist.generated );
+      
+      im->user[i] = (char *) ImageIO_alloc((strlen("  scannum: ") + 1 + strlen(analyzeHeader->hist.scannum) ));
+      sprintf( im->user[i++], "  scannum: %s", analyzeHeader->hist.scannum );
+      
+      im->user[i] = (char *) ImageIO_alloc((strlen("  patient_id: ") + 1 + strlen(analyzeHeader->hist.patient_id) ));
+      sprintf( im->user[i++], "  patient_id: %s", analyzeHeader->hist.patient_id );
+      
+      im->user[i] = (char *) ImageIO_alloc((strlen("  exp_date: ") + 1 + strlen(analyzeHeader->hist.exp_date) ));
+      sprintf( im->user[i++], "  exp_date: %s", analyzeHeader->hist.exp_date );
+      
+      im->user[i] = (char *) ImageIO_alloc((strlen("  exp_time: ") + 1 + strlen(analyzeHeader->hist.exp_time) ));
+      sprintf( im->user[i++], "  exp_time: %s", analyzeHeader->hist.exp_time );
+
+      /* A 32 bit int doesn't print on more than 11 chars */
+      im->user[i] = (char *) ImageIO_alloc((strlen("  views: ") + 11 + 1));
+      sprintf( im->user[i++], "  views: %d", analyzeHeader->hist.views );
+      
+      im->user[i] = (char *) ImageIO_alloc((strlen("  vols_added: ") + 11 + 1));
+      sprintf( im->user[i++], "  vols_added: %d", analyzeHeader->hist.vols_added );
+      
+      im->user[i] = (char *) ImageIO_alloc((strlen("  start_field: ") + 11 + 1));
+      sprintf( im->user[i++], "  start_field: %d", analyzeHeader->hist.start_field );
+      
+      im->user[i] = (char *) ImageIO_alloc((strlen("  field_skip: ") + 11 + 1));
+      sprintf( im->user[i++], "  field_skip: %d", analyzeHeader->hist.field_skip );
+      
+      im->user[i] = (char *) ImageIO_alloc((strlen("  omax: ") + 11 + 1));
+      sprintf( im->user[i++], "  omax: %d", analyzeHeader->hist.omax );
+      
+      im->user[i] = (char *) ImageIO_alloc((strlen("  omin: ") + 11 + 1));
+      sprintf( im->user[i++], "  omin: %d", analyzeHeader->hist.omin );
+      
+      im->user[i] = (char *) ImageIO_alloc((strlen("  smax: ") + 11 + 1));
+      sprintf( im->user[i++], "  smax: %d", analyzeHeader->hist.smax );
+      
+      im->user[i] = (char *) ImageIO_alloc((strlen("  smin: ") + 11 + 1));
+      sprintf( im->user[i++], "  smin: %d", analyzeHeader->hist.smin );
+
+
+      /* header is read. close header file and open data file. */
+      if( name != NULL ) {
+
+        std::size_t length = strlen(name) ;
+	char* data_filename = (char *) ImageIO_alloc(length+4) ;
+	
+	if( strcmp( name+length-4, ".hdr" ) )
+	  {
+	    fprintf (stderr,
+		     "_readAnalyzeHeader: error: file header extension must be .hdr\n");
+	    ImageIO_free( data_filename );
+	    return -1;
+	  }
+	 
+	ImageIO_close(im);
+	
+	strcpy(data_filename,name);
+	strcpy(data_filename+length-3, "img.gz");
+	_openReadImage(im,data_filename);
+	
+	if(!im->fd) {
+
+	  strcpy(data_filename,name);
+	  strcpy(data_filename+length-3, "img");
+	  _openReadImage(im,data_filename);
+	  if(!im->fd) {
+	    fprintf(stderr, "_readAnalyzeHeader: error: unable to open data file \'%s\'\n", data_filename);
+	    ImageIO_free( data_filename );
+	    return -1;
+	    
+	  }
+	}
+	ImageIO_free( data_filename );
+      }
+      
+      /* check header validity */
+      if(im->xdim > 0 && im->ydim > 0 && im->zdim > 0 && im->vdim > 0 &&
+	 im->vx > 0.0 && im->vy > 0.0 && im->vz > 0.0 &&
+	 (im->wordKind == WK_FLOAT || (im->wordKind == WK_FIXED &&
+				       im->sign != SGN_UNKNOWN)) &&
+	 im->endianness != END_UNKNOWN) {
+	 return 0;
+      }
+      else return -1;
+   }
+   else return -1;
+}
+
+
+
+
+
+
+CGAL_INLINE_FUNCTION
+int readAnalyzeHeader( const char* name, _image* im)
+{
+  struct dsr analyzeHeader ;
+  return( _readAnalyzeHeader( im, name, &analyzeHeader ) );
+}
+
+
+
+CGAL_INLINE_FUNCTION
+int
+writeAnalyzeHeader( const _image* im )
+{
+  const char *proc = "writeAnalyzeHeader";
+  struct dsr hdr;
+  int i ;
+  int imin = 0;
+  int imax = 0;
+ 
+   memset(&hdr,0, sizeof(struct dsr));
+   
+   for(i=0;i<8;i++) {
+      hdr.dime.pixdim[i] = 0.0;
+   }
+   hdr.dime.vox_offset  = 0.0;
+   hdr.dime.funused1    = 0.0;
+   hdr.dime.funused2    = 0.0;
+   hdr.dime.funused3    = 0.0;
+   hdr.dime.cal_max     = 0.0;
+   hdr.dime.cal_min     = 0.0;
+
+   hdr.dime.dim[0] = 4;
+   hdr.dime.dim[1] = short(im->xdim);
+   hdr.dime.dim[2] = short(im->ydim);
+   hdr.dime.dim[3] = short(im->zdim);
+   hdr.dime.dim[4] = 1 ;
+
+   if ( im->wordKind == WK_FIXED && im->sign == SGN_UNSIGNED ) {
+     if( im->wdim == 1 ) {
+       
+	if ( im->vdim == 1 ) {
+	  hdr.dime.datatype = DT_UNSIGNED_CHAR ;
+	}
+	else if ( im->vdim == 3 ) {
+	  hdr.dime.datatype = DT_RGB ;
+	}
+	else {
+	  fprintf( stderr, "%s: unsupported image type\n", proc );
+	  return -1;
+	}
+	
+	{
+	  unsigned char *buf = (unsigned char *)im->data;
+          std::size_t size = std::size_t(im->xdim) * im->ydim * im->zdim * im->vdim;
+	  imin = imax = *buf;
+	  for (std::size_t i=0; i<size; i++, buf++) {
+	    if ( imax < *buf ) imax = *buf;
+	    if ( imin > *buf ) imin = *buf;
+	  }
+	}
+	
+      }
+      else if ( im->wdim == 2 ) {
+	if ( im->vdim == 1 ) {
+	  unsigned short int *buf = (unsigned short int*)im->data;
+          std::size_t size = std::size_t(im->xdim) * im->ydim *im->zdim;
+	  imin = imax = *buf;
+	  for (std::size_t i=0; i<size; i++, buf++) {
+	    if ( imax < *buf ) imax = *buf;
+	    if ( imin > *buf ) imin = *buf;
+	  }
+	  if ( imax < 32768 ) {
+	    hdr.dime.datatype = DT_SIGNED_SHORT ;
+	  } 
+	  else {
+	    fprintf( stderr, "%s: conversion from unsigned short to short impossible, max=%d\n", proc, imax );
+	    return -1;
+	  }
+	}
+	else {
+	  fprintf( stderr, "%s: unsupported image type\n", proc );
+	  return -1;
+	}
+      }
+      
+      else {
+	  fprintf( stderr, "%s: unsupported image type\n", proc );
+	  return -1;
+      }
+      
+   } /* if ( im->wordKind == WK_FIXED && im->sign == SGN_UNSIGNED ) */
+
+   else if( im->wordKind == WK_FIXED && im->sign == SGN_SIGNED ) {
+     if ( im->vdim != 1 ) {
+       fprintf( stderr, "%s: unsupported image type\n", proc );
+       return -1;
+     }
+     if( im->wdim == 2 ) {
+       short int *buf = (short int*)im->data;
+       std::size_t size = std::size_t(im->xdim) * im->ydim *im->zdim;
+       imin = imax = *buf;
+       for (std::size_t i=0; i<size; i++, buf++) {
+	 if ( imax < *buf ) imax = *buf;
+	 if ( imin > *buf ) imin = *buf;
+       }
+       hdr.dime.datatype = DT_SIGNED_SHORT ;
+     }
+     else if( im->wdim == 4 ) {
+       int *buf = (int*)im->data;
+       std::size_t size = std::size_t(im->xdim) * im->ydim *im->zdim;
+       imin = imax = *buf;
+       for (std::size_t i=0; i<size; i++, buf++) {
+	 if ( imax < *buf ) imax = *buf;
+	 if ( imin > *buf ) imin = *buf;
+       }
+       hdr.dime.datatype = DT_SIGNED_INT ;
+     }
+     else {
+       fprintf( stderr, "%s: unsupported image type\n", proc );
+       return -1;
+     }
+   }
+   else if( im->wordKind == WK_FLOAT ) {
+     if ( im->vdim != 1 ) {
+       fprintf( stderr, "%s: unsupported image type\n", proc );
+       return -1;
+     }
+     if( im->wdim == 4 ) {
+       hdr.dime.datatype = DT_FLOAT ;
+     }
+     else if( im->wdim == 8 ) {
+       hdr.dime.datatype = DT_DOUBLE ;
+     }
+     else {
+       fprintf( stderr, "%s: unsupported image type\n", proc );
+       return -1;
+     }
+   }
+   else
+   {
+      fprintf( stderr, "%s: unsupported image type\n", proc );
+      return -1;
+   }
+	 
+   hdr.dime.bitpix = short(8*im->wdim*im->vdim) ;
+
+   hdr.hk.regular = 'r';
+   hdr.hk.sizeof_hdr = sizeof(struct dsr);
+
+   /* this is probably bad and should be changed to the
+      real values, but I'm too lazy to do it now. AG */
+   hdr.dime.glmax  = 0 ;  /* maximum voxel value  */
+   hdr.dime.glmin  = 0 ;  /* minimum voxel value */
+   
+   /* corrected GM
+    */
+   hdr.dime.glmax  = imax ;  /* maximum voxel value  */
+   hdr.dime.glmin  = imin ;  /* minimum voxel value */
+    
+/*     Set the voxel dimension fields: 
+       A value of 0.0 for these fields implies that the value is unknown.
+         Change these values to what is appropriate for your data
+         or pass additional command line arguments     */      
+         
+    hdr.dime.pixdim[1] = (float)im->vx;
+    hdr.dime.pixdim[2] = (float)im->vy;
+    hdr.dime.pixdim[3] = (float)im->vz;
+    
+/*   Assume zero offset in .img file, byte at which pixel
+       data starts in the image file */
+
+    hdr.dime.vox_offset = 0.0; 
+    
+/*   Planar Orientation;    */
+/*   Movie flag OFF: 0 = transverse, 1 = coronal, 2 = sagittal
+     Movie flag ON:  3 = transverse, 4 = coronal, 5 = sagittal  */  
+
+    hdr.hist.orient     = 0;  
+    
+/*   up to 3 characters for the voxels units label; i.e. mm., um., cm. */
+
+    strcpy(hdr.dime.vox_units,"mm.");
+   
+/*   up to 7 characters for the calibration units label; i.e. HU */
+
+    strcpy(hdr.dime.cal_units," ");  
+    
+/*     Calibration maximum and minimum values;  
+       values of 0.0 for both fields imply that no 
+       calibration max and min values are used    */
+
+    hdr.dime.cal_max = 0.0; 
+    hdr.dime.cal_min = 0.0;
+
+    if(ImageIO_write(im, &hdr, sizeof(struct dsr)) !=sizeof(struct dsr) )
+       return -1;
+
+    return 1 ;
+}
+
+
+
+
+
+/* Writes the given image body in an already opened file.*/
+CGAL_INLINE_FUNCTION
+int writeAnalyzeData(const _image *im) {
+  std::size_t lineSize = std::size_t(im->wdim) * im->xdim * im->vdim ;
+  std::size_t size = lineSize * im->ydim * im->zdim;
+  std::size_t nwrt ;
+
+  if(im->openMode != OM_CLOSE) {
+
+#ifdef _REVERSE_LINES_IN_ANALYZE_
+    char* data = (char *)im->data ;
+    char* buf = data + size - lineSize ;
+    
+    while( buf >= data )
+      {
+	nwrt = ImageIO_write(im, buf, lineSize);
+	if(nwrt != lineSize) return -1;
+	buf -= lineSize ;
+      }
+#else
+    nwrt = ImageIO_write(im, im->data, size);
+    if(nwrt != size) return -1;
+#endif    
+
+    return 1 ;
+  }
+  else return -1;
+}
+
+
+/* Writes the given image body in an already opened file.*/
+CGAL_INLINE_FUNCTION
+int printAnalyzeHeader( const char* name )
+{
+  _image *im;
+  struct dsr analyzeHeader ;
+
+  im = _initImage();
+  _openReadImage(im, name);
+  if(!im->fd) {
+    fprintf(stderr, "printAnalyzeHeader: error: unable to open file \'%s\'\n", name);
+    _freeImage(im);
+    return -1;
+  }
+
+  if ( _readAnalyzeHeader( im, name, &analyzeHeader ) != 1 ) {
+    fprintf(stderr, "printAnalyzeHeader: error: unable to read header in file \'%s\'\n", name);
+    _freeImage(im);
+    return -1;
+  }
+
+
+  
+
+
+  ImageIO_close(im);
+  im->fd = NULL;
+  im->openMode = OM_CLOSE;
+  _freeImage(im);
+  return( 1 );
+
+
+}
diff --git a/3rdparty/CGAL/include/CGAL/ImageIO/bmp.h b/3rdparty/CGAL/include/CGAL/ImageIO/bmp.h
new file mode 100644
index 0000000..d18a7e8
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/ImageIO/bmp.h
@@ -0,0 +1,65 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+/*************************************************************************
+ * iobmp.h - I procedures for BMP raw images
+ *
+ * $Id$
+ *
+ * Copyright INRIA
+ *
+ * AUTHOR:
+ * Gregoire Malandain (greg at sophia.inria.fr)
+ * 
+ * CREATION DATE: 
+ * Wed Oct  6 17:03:48 MET DST 1999
+ *
+ * ADDITIONS, CHANGES
+ *
+ *
+ */
+
+#ifndef _bmp_h_
+#define _bmp_h_
+
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h> /* open, close */
+#include <sys/stat.h> /* open, close */
+#include <sys/types.h> /* open, close */
+#include <string.h>
+#include <CGAL/ImageIO.h>
+extern int readBmpImage(const char *name, _image *im);
+extern void *_readBmpImage( const char *name, int *dimx, int *dimy, int *dimz );
+int testBmpHeader(char *magic,const char *name);
+/** creates an return the file format structure associated with the BMP file format */
+PTRIMAGE_FORMAT createBMPFormat();
+
+extern void IoBmp_verbose ( );
+extern void IoBmp_noverbose ( );
+
+#ifdef CGAL_HEADER_ONLY
+#include <CGAL/ImageIO/bmp_impl.h>
+#endif // CGAL_HEADER_ONLY
+
+#endif /* _bmp_h_ */
diff --git a/3rdparty/CGAL/include/CGAL/ImageIO/bmp_impl.h b/3rdparty/CGAL/include/CGAL/ImageIO/bmp_impl.h
new file mode 100644
index 0000000..2e64dc6
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/ImageIO/bmp_impl.h
@@ -0,0 +1,519 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+#ifdef CGAL_HEADER_ONLY
+#define CGAL_INLINE_FUNCTION inline
+#else
+#define CGAL_INLINE_FUNCTION
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <CGAL/ImageIO/bmptypes.h>
+#include <CGAL/ImageIO/bmpendian.h>
+#include <CGAL/ImageIO/bmpread.h>
+
+
+
+
+
+
+/** Magic header for bmp */
+#define BMP_MAGIC "BM"
+
+
+#ifdef CGAL_HEADER_ONLY
+
+inline int& get_static_verbose_bmp()
+{
+  static int _VERBOSE_BMP_ = 1;
+  return _VERBOSE_BMP_;
+}
+
+#else // CGAL_HEADER_ONLY
+
+static int _VERBOSE_BMP_ = 1;
+inline int& get_static_verbose_bmp()
+{ return _VERBOSE_BMP_; }
+
+#endif // CGAL_HEADER_ONLY
+
+
+CGAL_INLINE_FUNCTION
+int testBmpHeader(char *magic,const char *) {
+  if( !strncmp(magic, BMP_MAGIC, strlen(BMP_MAGIC)))
+    return 0;
+  else 
+    return -1;
+}
+
+CGAL_INLINE_FUNCTION
+PTRIMAGE_FORMAT createBMPFormat() {
+  PTRIMAGE_FORMAT f=(PTRIMAGE_FORMAT) ImageIO_alloc(sizeof(IMAGE_FORMAT));
+
+  f->testImageFormat=&testBmpHeader;
+  f->readImageHeader=&readBmpImage;
+  f->writeImage=0;
+  strcpy(f->fileExtension,".bmp");
+  strcpy(f->realName,"BMP");
+  return f;
+}
+
+CGAL_INLINE_FUNCTION
+int readBmpImage( const char *name,_image *im)
+{
+  int dimx, dimy, dimv;
+
+  im->data = _readBmpImage( name, &dimx,  &dimy,  &dimv );
+  if ( im->data == NULL ) {
+    fprintf( stderr, "readBmpImage: unable to read \'%s\'\n", name );
+    return( -1 );
+  }
+
+  im->xdim = dimx;
+  im->ydim = dimy;
+  im->vdim = dimv;
+
+  im->zdim = 1;
+
+  im->wdim = 1;
+  im->wordKind = WK_FIXED;
+  im->sign = SGN_UNSIGNED;
+
+  return 1;
+}
+
+
+
+CGAL_INLINE_FUNCTION
+void *_readBmpImage( const char *name, 
+		     int *dimx, int *dimy, int *dimz )
+{
+  const char *proc="_readBmpImage";
+  void *buf = (void*)NULL;
+  unsigned char *myBuf = NULL;
+
+  FILE *fp = NULL;
+  RGB **argbs = NULL;
+  char **xorMasks = NULL, **andMasks = NULL;
+  CGAL_UINT32 *heights = NULL, *widths = NULL, row = 0, col = 0;
+  CGAL_UINT16 fileType = 0;
+  long filePos = 0;
+  int numImages = 0, i = 0;
+  int rc = 0;
+    
+    fp = fopen(name, "rb");
+    if (fp == NULL) {
+      if ( get_static_verbose_bmp() ) 
+	fprintf( stderr, "%s: error in opening %s\n", proc, name );
+      return( (void*)NULL );
+    }
+
+
+    /*
+     * Read the first two bytes as little-endian to determine the file type.
+     * Preserve the file position.
+     */
+    filePos = ftell(fp);
+    rc = readUINT16little(fp, &fileType);
+    if (rc != 0) {
+      fclose(fp);
+      if ( get_static_verbose_bmp() ) 
+	fprintf( stderr, "%s: error in getting file type %s\n", proc, name );
+      return( (void*)NULL );
+    }
+    fseek(fp, filePos, SEEK_SET);
+
+    /*
+     * Read the images.
+     */
+    switch (fileType) {
+    case TYPE_ARRAY:
+	/*
+	 * If this is an array of images, read them.  All the arrays we need
+	 * will be allocated by the reader function.
+	 */
+	rc = readMultipleImage(fp, &argbs, &xorMasks, &andMasks, &heights,
+			       &widths, &numImages);
+	break;
+    case TYPE_BMP:
+    case TYPE_ICO:
+    case TYPE_ICO_COLOR:
+    case TYPE_PTR:
+    case TYPE_PTR_COLOR:
+	/*
+	 * If this is a single-image file, we've a little more work.  In order
+	 * to make the output part of this test program easy to write, we're
+	 * going to allocate dummy arrays that represent what
+	 * readMultipleImage would have allocated.  We'll read the data into
+	 * those arrays.
+	 */
+	argbs = (RGB **)calloc(1, sizeof(RGB *));
+	if (argbs == NULL)
+	{
+	    rc = 1005;
+	    break;
+	}
+	xorMasks = (char **)calloc(1, sizeof(char *));
+	if (xorMasks == NULL)
+	{
+	    free(argbs);
+	    rc = 1005;
+	    break;
+	}
+	andMasks = (char **)calloc(1, sizeof(char *));
+	if (andMasks == NULL)
+	{
+	    free(argbs);
+	    free(xorMasks);
+	    rc = 1005;
+	    break;
+	}
+	heights = (CGAL_UINT32 *)calloc(1, sizeof(CGAL_UINT32));
+	if (heights == NULL)
+	{
+	    free(argbs);
+	    free(xorMasks);
+	    free(andMasks);
+	    rc = 1005;
+	    break;
+	}
+	widths = (CGAL_UINT32 *)calloc(1, sizeof(CGAL_UINT32));
+	if (widths == NULL)
+	{
+	    free(argbs);
+	    free(xorMasks);
+	    free(andMasks);
+	    free(heights);
+	    rc = 1005;
+	    break;
+	}
+	numImages = 1;
+
+	/*
+	 * Now that we have our arrays allocted, read the image into them.
+	 */
+	switch (fileType) {
+	case TYPE_BMP:
+	    rc = readSingleImageBMP(fp, argbs, widths, heights);
+	    break;
+	case TYPE_ICO:
+	case TYPE_PTR:
+	    rc = readSingleImageICOPTR(fp, xorMasks, andMasks, widths,
+				       heights);
+	    break;
+	case TYPE_ICO_COLOR:
+	case TYPE_PTR_COLOR:
+	    rc = readSingleImageColorICOPTR(fp, argbs, xorMasks, andMasks,
+					    widths, heights);
+	    break;
+	}
+	break;
+    default:
+	rc = 1000;
+    }
+    fclose(fp);
+
+
+  
+    /*
+     * At this point, everything's been read.  Display status messages based
+     * on the return values.
+     */
+    switch (rc) {
+    case 1000:
+    case 1006:
+      if ( get_static_verbose_bmp() ) 
+	fprintf( stderr, "%s: File is not a valid bitmap file\n", proc );
+      break;
+    case 1001:
+      if ( get_static_verbose_bmp() ) 
+	fprintf( stderr, "%s: Illegal information in an image\n", proc );
+      break;
+    case 1002:
+      if ( get_static_verbose_bmp() ) 
+	fprintf( stderr, "%s: Legal information that I can't handle yet in an image\n", proc );
+      break;
+    case 1003:
+    case 1004:
+    case 1005:
+      if ( get_static_verbose_bmp() ) 
+	fprintf( stderr, "%s: Ran out of memory\n", proc );
+      break;
+    case 0:
+      if ( get_static_verbose_bmp() > 1 ) 
+	fprintf( stderr, "%s: Got good data from file, writing results\n", proc );
+      break;
+    default:
+      if ( get_static_verbose_bmp() ) 
+	fprintf( stderr, "%s: Error reading file rc=%d\n", proc,rc );
+      break;
+    }
+
+    /*
+     * If the return value wasn't 0, something went wrong.
+     */
+    if (rc != 0)
+    {
+	if (rc != 1000 && rc != 1005)
+	{
+	    for (i=0; i<numImages; i++)
+	    {
+		if (argbs[i] != NULL)
+		    free(argbs[i]);
+		if (andMasks[i] != NULL)
+		    free(andMasks[i]);
+		if (xorMasks[i] != NULL)
+		    free(xorMasks[i]);
+	    }
+	    free(argbs);
+	    free(andMasks);
+	    free(xorMasks);
+	    free(widths);
+	    free(heights);
+	}
+	return( (void*)NULL );
+    }
+    
+    
+    /*
+     * Dump the images.
+     */
+    if ( get_static_verbose_bmp() > 1 ) 
+      fprintf (stderr, "%s: There are %d images in the file\n", proc, numImages);
+
+    if ( numImages >= 2 ) 
+      fprintf (stderr, "%s: read only first image among %d\n", proc, numImages );
+    
+    /*
+     * my stuff:
+     * just reading one bmp image
+     */
+    if ( (numImages > 0) &&
+	 (argbs[0] != NULL) ) {
+
+      buf = (void*)malloc( widths[0]*heights[0]*3 * sizeof( unsigned char ) );
+      if ( buf == (void*)NULL ) {
+	if ( get_static_verbose_bmp() ) 
+	  fprintf( stderr, "%s: error in allocating data buffer for %s\n", proc, name );
+
+	for (i=0; i<numImages; i++) {
+	  if (argbs[i] != NULL)
+	    free(argbs[i]);
+	  if (andMasks[i] != NULL)
+	    free(andMasks[i]);
+	  if (xorMasks[i] != NULL)
+	    free(xorMasks[i]);
+	}
+	free(argbs);
+	free(andMasks);
+	free(xorMasks);
+	free(widths);
+	free(heights);
+
+	return( (void*)NULL );
+      }
+
+      myBuf = (unsigned char*)buf;
+      i = 0;
+      for (row = 0; row < heights[0]; row++)
+      for (col = 0; col < widths[0]; col++,i+=3) {
+	myBuf[i  ] = argbs[0][row * widths[0] + col].red;
+	myBuf[i+1] = argbs[0][row * widths[0] + col].green;
+	myBuf[i+2] = argbs[0][row * widths[0] + col].blue;
+      }
+      
+      *dimx = int(widths[0]);
+      *dimy = int(heights[0]);
+      *dimz = 3;
+
+    } else {
+      if ( get_static_verbose_bmp() ) 
+	fprintf( stderr, "%s: no image or null image\n", proc );
+      
+      for (i=0; i<numImages; i++) {
+	if (argbs[i] != NULL)
+	  free(argbs[i]);
+	if (andMasks[i] != NULL)
+	  free(andMasks[i]);
+	if (xorMasks[i] != NULL)
+	  free(xorMasks[i]);
+      }
+      free(argbs);
+      free(andMasks);
+      free(xorMasks);
+      free(widths);
+      free(heights);
+      
+      return( (void*)NULL );
+    }
+
+
+
+    for (i=0; i<numImages; i++) {
+      if (argbs[i] != NULL)
+	free(argbs[i]);
+      if (andMasks[i] != NULL)
+	free(andMasks[i]);
+      if (xorMasks[i] != NULL)
+	free(xorMasks[i]);
+    }
+    free(argbs);
+    free(andMasks);
+    free(xorMasks);
+    free(widths);
+    free(heights);
+    
+    return( buf );
+
+
+
+
+
+#if 0
+    /*
+     * old stuff from test.c
+     */
+
+    for (i=0; i<numImages; i++)
+    {
+	/*
+	 * Loop through all the images that were returned.
+	 */
+      if ( get_static_verbose_bmp() ) {
+	fprintf (stderr, "%s: Doing image number %d\n\n", proc, i+1);
+	fprintf (stderr, "%s: Image dimensions: (%ld,%ld)\n", proc, widths[i], heights[i]);
+      }
+
+      if (argbs[i] != NULL) {
+	/*
+	 * If the image has colors, dump them (BMP, color ICO and color
+	 * PTR files
+	 */
+	fprintf(stderr, "Colors");
+	for (row = 0; row < heights[i]; row++)
+	  {
+	    fprintf (stderr, "\n\nRow %ld pixels (R,G,B), hex values:\n",
+		     row);
+	    for (col = 0; col < widths[i]; col++)
+	      {
+		fprintf (stderr, "(%2.2x,%2.2x,%2.2x)",
+			 argbs[i][row * widths[i] + col].red,
+			 argbs[i][row * widths[i] + col].green,
+			 argbs[i][row * widths[i] + col].blue);
+	      }
+	  }
+      } else {
+	/*
+	 * If there image has no colors, say so.  (monochrome ICO and PTR
+	 * files) 
+	 */
+	fprintf (stderr, "No color image\n");
+      }
+
+
+      
+      if (xorMasks[i] != NULL) {
+	/*
+	 * If the image has an xor mask, dump it.  (ICO and PTR files)
+	 */
+	fprintf (stderr, "\nXOR mask\n");
+	for (row = 0; row < heights[i]; row++)
+	  {
+	    for (col = 0; col < widths[i]; col++)
+	      {
+		fprintf (stderr, "%c",
+			 xorMasks[i][row * widths[i] + col] ? '@' : '.');
+	      }
+	    fprintf (stderr, "\n");
+	  }
+      } else {
+	/*
+	 * If the image has no xor mask, say so.  (BMP files).
+	 */
+	fprintf (stderr, "No xor mask\n");
+      }
+      
+
+
+      if (andMasks[i] != NULL) {
+	/*
+	 * If the image has an and mask, dump it.  (ICO and PTR files)
+	 */
+	fprintf (stderr, "\nAND mask\n");
+	for (row = 0; row < heights[i]; row++)
+	  {
+	    for (col = 0; col < widths[i]; col++)
+	      {
+		fprintf (stderr, "%c",
+			 andMasks[i][row * widths[i] + col] ? '@' : '.');
+	      }
+	    fprintf (stderr, "\n");
+	  }
+      } else {
+	/*
+	 * If the image has noand mask, say so.  (BMP files)
+	 */
+	fprintf (stderr, "No and mask\n");
+      }
+      
+
+      if (i != numImages-1)
+	fprintf (stderr, "\n------------------------------------------\n\n");
+      
+    }
+    
+    /*
+     * Dumping is complete.  Free all the arrays and quit
+     */
+    for (i=0; i<numImages; i++)
+    {
+	if (argbs[i] != NULL)
+	    free(argbs[i]);
+	if (andMasks[i] != NULL)
+	    free(andMasks[i]);
+	if (xorMasks[i] != NULL)
+	    free(xorMasks[i]);
+    }
+    free(argbs);
+    free(andMasks);
+    free(xorMasks);
+    free(widths);
+    free(heights);
+    
+    return( buf );
+#endif
+}
+
+CGAL_INLINE_FUNCTION
+void IoBmp_verbose ( )
+{
+  if ( get_static_verbose_bmp() <= 0 )
+    get_static_verbose_bmp() = 1;
+  else 
+    get_static_verbose_bmp() += 1;
+}
+
+CGAL_INLINE_FUNCTION
+void IoBmp_noverbose ( )
+{
+  get_static_verbose_bmp() = 0;
+}
diff --git a/3rdparty/CGAL/include/CGAL/ImageIO/bmpendian.h b/3rdparty/CGAL/include/CGAL/ImageIO/bmpendian.h
new file mode 100644
index 0000000..3d2cd76
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/ImageIO/bmpendian.h
@@ -0,0 +1,80 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+/*
+ * from bmp.zip, see the url http://www.ddj.com/ftp/1995/1995.03/
+ * author Dr. Dobb's
+ */
+
+/*
+ * This is the header for endian.c - functions to read/write our
+ * CGAL_INT8, CGAL_INT16 and CGAL_INT32 types from/to a little-endian file.
+ */
+
+#ifndef __ENDIAN_H_INCLUDED__
+#define __ENDIAN_H_INCLUDED__
+
+#include <cstdio>
+#include <CGAL/ImageIO/bmptypes.h>
+#include <cstdio>
+
+/*
+ * Read the basic types as little-endian values.  The return value will be
+ * zero if successful, EOF, otherwise.
+ */
+extern int readINT8little(FILE *f, CGAL_INT8 *i);
+extern int readINT16little(FILE *f, CGAL_INT16 *i);
+extern int readINT32little(FILE *f, CGAL_INT32 *i);
+extern int readUINT8little(FILE *f, CGAL_UINT8 *i);
+extern int readUINT16little(FILE *f, CGAL_UINT16 *i);
+extern int readUINT32little(FILE *f, CGAL_UINT32 *i);
+
+/*
+ * Write the basic types as little-endian values.  The return value will be
+ * zero if successful, EOF otherwise.
+ */
+int writeINT8little(FILE *f, CGAL_INT8 i);
+int writeINT16little(FILE *f, CGAL_INT16 i);
+int writeINT32little(FILE *f, CGAL_INT32 i);
+int writeUINT8little(FILE *f, CGAL_UINT8 i);
+int writeUINT16little(FILE *f, CGAL_UINT16 i);
+int writeUINT32little(FILE *f, CGAL_UINT32 i);
+
+#ifdef CGAL_HEADER_ONLY
+#include <CGAL/ImageIO/bmpendian_impl.h>
+#endif // CGAL_HEADER_ONLY
+
+#endif  /* __ENDIAN_H_INCLUDED__ */
+
+
+/*
+ * Formatting information for emacs in c-mode
+ *
+ * Local Variables:
+ * c-indent-level:4
+ * c-continued-statement-offset:4
+ * c-brace-offset:-4
+ * c-brace-imaginary-offset:0
+ * c-argdecl-indent:4
+ * c-label-offset:-4
+ * End:
+ */
+
diff --git a/3rdparty/CGAL/include/CGAL/ImageIO/bmpendian_impl.h b/3rdparty/CGAL/include/CGAL/ImageIO/bmpendian_impl.h
new file mode 100644
index 0000000..9539c3d
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/ImageIO/bmpendian_impl.h
@@ -0,0 +1,257 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+#ifdef CGAL_HEADER_ONLY
+#define CGAL_INLINE_FUNCTION inline
+#else
+#define CGAL_INLINE_FUNCTION
+#endif
+
+/*
+ * These functions read and write our basic integer types from a little-endian
+ * file.  The endian and word-size of the host machine will not affect this
+ * code.  The only assumption made is that the C data type (char) is one byte
+ * long.  This should be a safe assumption.
+ */
+
+#include <stdio.h>
+#include <CGAL/ImageIO/bmptypes.h>
+
+/*****************************************************************************
+*
+* Read functions.  All read functions take an open file pointer as the first
+* parameter and a pointer to data as the second parameter.  The return value
+* will be 0 on success, and EOF on failure.  If successful, the second
+* parameter will point to the data read.
+*/
+
+/*
+ * The CGAL_INT8 and CGAL_UINT8 types are stored as a single byte on disk.  The INT8
+ * type is a signed integer with range (-128..127).  The CGAL_UINT8 type is an
+ * unsigned integer with range (0..255).
+ */
+CGAL_INLINE_FUNCTION
+int readINT8little(FILE *f, CGAL_INT8 *i)
+{
+    int rc;
+    
+    rc = fgetc(f);
+    if (rc == EOF)
+	return rc;
+    
+    *i = CGAL_INT8(rc & 0xff);
+    return 0;
+}
+
+CGAL_INLINE_FUNCTION
+int readUINT8little(FILE *f, CGAL_UINT8 *i)
+{
+    int  rc;
+    
+    rc = fgetc(f);
+    if (rc == EOF)
+	return rc;
+    
+    *i = CGAL_UINT8(rc & 0xff);
+    return 0;
+}
+
+
+/*
+ * The CGAL_INT16 and CGAL_UINT16 types are stored as two bytes on disk.  The INT16 type
+ * is a signed integer with range (-32768..32767).  The CGAL_UINT16 type is an
+ * unisgned integer with range (0..65535).
+ */
+CGAL_INLINE_FUNCTION
+int readINT16little(FILE *f, CGAL_INT16 *i)
+{
+    int rc;
+    CGAL_INT16 temp = 0;
+    
+    temp = (fgetc(f) & 0xff);
+    
+    rc = fgetc(f);
+    if (rc == EOF)
+	return rc;
+    
+    temp = temp | CGAL_INT16((rc & 0xff) << 8);
+    *i = temp;
+    return 0;
+}
+
+CGAL_INLINE_FUNCTION
+int readUINT16little(FILE *f, CGAL_UINT16 *i)
+{
+    int rc;
+    CGAL_UINT16 temp = 0;
+    
+    temp = (fgetc(f) & 0xff);
+    
+    rc = fgetc(f);
+    if (rc == EOF)
+	return rc;
+    
+    temp = CGAL_INT16(temp | ((rc & 0xff) << 8));
+    *i = temp;
+    return 0;
+}
+
+/*
+ * The CGAL_INT32 and CGAL_UINT32 types are stored as four bytes on disk.  The INT32
+ * type is a signed integer with range (-2147483648..2147483647).  The CGAL_UINT32
+ * type is an unisgned integer with range (0..4294967295).
+ */
+CGAL_INLINE_FUNCTION
+int readINT32little(FILE *f, CGAL_INT32 *i)
+{
+    int rc;
+    CGAL_INT32 temp = 0;
+    
+    temp = ((long)fgetc(f) & 0xff);
+    temp = CGAL_INT32(temp | (((long)fgetc(f) & 0xff) << 8));
+    temp = CGAL_INT32(temp | (((long)fgetc(f) & 0xff) << 16));
+    
+    rc = fgetc(f);
+    if (rc == EOF)
+	return rc;
+    
+    temp = CGAL_INT32(temp | (((long)rc & 0xff) << 24));
+    *i = temp;
+    return 0;
+}
+
+CGAL_INLINE_FUNCTION
+int readUINT32little(FILE *f, CGAL_UINT32 *i)
+{
+    int rc;
+    CGAL_UINT32 temp = 0;
+    
+    temp = ((long)fgetc(f) & 0xff);
+    temp = CGAL_UINT32(temp | (((long)fgetc(f) & 0xff) << 8));
+    temp = CGAL_UINT32(temp | (((long)fgetc(f) & 0xff) << 16));
+    
+    rc = fgetc(f);
+    if (rc == EOF)
+	return rc;
+    
+    temp = CGAL_UINT32(temp | (((long)rc & 0xff) << 24));
+    *i = temp;
+    return 0;
+}
+
+/*****************************************************************************
+*
+* Write functions.  All write functions take an open file pointer as the first
+* parameter and a data as the second parameter.  The return value will be 0 on
+* success, and EOF on failure.  If successful, the second parameter will have
+* been written to the open file.
+*/
+
+CGAL_INLINE_FUNCTION
+int writeINT8little(FILE *f, CGAL_INT8 i)
+{
+    return fputc(i, f);
+}
+
+CGAL_INLINE_FUNCTION
+int writeUINT8little(FILE *f, CGAL_UINT8 i)
+{
+    return fputc(i, f);
+}
+
+CGAL_INLINE_FUNCTION
+int writeINT16little(FILE *f, CGAL_INT16 i)
+{
+    int rc;
+    
+    rc = fputc((i & 0xff), f);
+    if (rc == EOF)
+	return rc;
+    
+    return fputc(((i >> 8) & 0xff), f);
+}
+
+CGAL_INLINE_FUNCTION
+int writeUINT16little(FILE *f, CGAL_UINT16 i)
+{
+    int rc;
+    
+    rc = fputc((i & 0xff), f);
+    if (rc == EOF)
+	return rc;
+    
+    return fputc(((i >> 8) & 0xff), f);
+}
+
+CGAL_INLINE_FUNCTION
+int writeINT32little(FILE *f, CGAL_INT32 i)
+{
+    int rc;
+    
+    rc = fputc((i & 0xff), f);
+    if (rc == EOF)
+	return rc;
+    
+    rc = fputc(((i >> 8) & 0xff), f);
+    if (rc == EOF)
+	return rc;
+    
+    rc = fputc(((i >> 16) & 0xff), f);
+    if (rc == EOF)
+	return rc;
+    
+    return fputc(((i >> 24) & 0xff), f);
+}
+
+
+CGAL_INLINE_FUNCTION
+int writeUINT32little(FILE *f, CGAL_UINT32 i)
+{
+    int rc;
+    
+    rc = fputc((i & 0xff), f);
+    if (rc == EOF)
+	return rc;
+    
+    rc = fputc(((i >> 8) & 0xff), f);
+    if (rc == EOF)
+	return rc;
+    
+    rc = fputc(((i >> 16) & 0xff), f);
+    if (rc == EOF)
+	return rc;
+    
+    return fputc(((i >> 24) & 0xff), f);
+}
+
+/*
+ * Formatting information for emacs in c-mode
+ *
+ * Local Variables:
+ * c-indent-level:4
+ * c-continued-statement-offset:4
+ * c-brace-offset:-4
+ * c-brace-imaginary-offset:0
+ * c-argdecl-indent:4
+ * c-label-offset:-4
+ * End:
+ */
+
diff --git a/3rdparty/CGAL/include/CGAL/ImageIO/bmpread.h b/3rdparty/CGAL/include/CGAL/ImageIO/bmpread.h
new file mode 100644
index 0000000..8deb399
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/ImageIO/bmpread.h
@@ -0,0 +1,87 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+/*
+ * from bmp.zip, see the url http://www.ddj.com/ftp/1995/1995.03/
+ * author Dr. Dobb's
+ */
+
+/*
+ * This is the header for readbmp.c - functions to read the bitmap file
+ * structures.  See readbmp.c for details.
+ */
+
+#ifndef __READBMP_H_INCLUDED__
+#define __READBMP_H_INCLUDED__
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <CGAL/ImageIO/bmptypes.h>
+#include <CGAL/ImageIO/bmpendian.h>
+
+/*
+ * Mid-level functions
+ */
+int readBitmapFileHeader(FILE *fp, Bitmapfileheader *bfh);
+int readBitmapArrayHeader(FILE *fp, BITMAPARRAYHEADER *bah);
+int readBitmapHeader(FILE *fp, BITMAPHEADER *bh);
+int readRgb(FILE *fp, RGB *rgb, int numBytes);
+int readColorTable(FILE *fp, RGB *rgb, int numEntries, int numBytesPerEntry);
+
+int readBitsUncompressed(FILE *fp, RGB *image, int width, int height,
+			 int depth, RGB* colorTable);
+int readMaskBitsUncompressed(FILE *fp, char *image, int width, int height);
+
+void reflectYRGB(RGB *image, int width, int height);
+void reflectYchar(char *image, int width, int height);
+
+/*
+ * High level functions.
+ */
+int readSingleImageBMP(FILE *fp, RGB **argb, CGAL_UINT32 *width, CGAL_UINT32 *height);
+int readSingleImageICOPTR(FILE *fp, char **xorMask, char **andMask,
+		          CGAL_UINT32 *width, CGAL_UINT32 *height);
+int readSingleImageColorICOPTR(FILE *fp, RGB **argb, char **xorMask,
+			       char **andMask, CGAL_UINT32 *width, CGAL_UINT32 *height);
+int readMultipleImage(FILE *fp, RGB ***argbs, char ***xorMasks,
+		      char ***andMasks, CGAL_UINT32 **widths, CGAL_UINT32 **heights,
+		      int *imageCount);
+
+#ifdef CGAL_HEADER_ONLY
+#include <CGAL/ImageIO/bmpread_impl.h>
+#endif // CGAL_HEADER_ONLY
+
+#endif
+
+/*
+ * Formatting information for emacs in c-mode
+ *
+ * Local Variables:
+ * c-indent-level:4
+ * c-continued-statement-offset:4
+ * c-brace-offset:-4
+ * c-brace-imaginary-offset:0
+ * c-argdecl-indent:4
+ * c-label-offset:-4
+ * End:
+ */
+
diff --git a/3rdparty/CGAL/include/CGAL/ImageIO/bmpread_impl.h b/3rdparty/CGAL/include/CGAL/ImageIO/bmpread_impl.h
new file mode 100644
index 0000000..ae2b560
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/ImageIO/bmpread_impl.h
@@ -0,0 +1,1238 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+/*
+ * from bmp.zip, see the url http://www.ddj.com/ftp/1995/1995.03/
+ * author Dr. Dobb's
+ */
+
+/*
+ * This file contains mid-level functions for reading bitmap structures and
+ * high-level functions that read bitmap files.
+ */
+
+#ifdef CGAL_HEADER_ONLY
+#define CGAL_INLINE_FUNCTION inline
+#else
+#define CGAL_INLINE_FUNCTION
+#endif
+
+/*****************************************************************************
+ *
+ * Mid-level functions.
+ *
+ * These functions read in the various structures defined in bmptypes.h.  Each
+ * function assumes that the file pointer is positioned at the start of the
+ * given structure.  Upon completion, each function will leave the file
+ * pointer positioned on the byte immediately following the structure.  Return
+ * values will be 0 for success and non-zero for failure.  In all cases, a
+ * return value of non-zero means that the file position has been left in an
+ * indeterminate state and further reading should not be attempted.
+ */
+
+/*
+ * Read a Bitmapfileheader structure.
+ */
+CGAL_INLINE_FUNCTION
+int readBitmapFileHeader(FILE *fp, Bitmapfileheader *bfh)
+{
+    int rc;
+  
+    rc = readUINT16little(fp, &(bfh->type));
+    if (rc != 0)
+	return rc;
+    
+    rc = readUINT32little(fp, &(bfh->size));
+    if (rc != 0)
+	return rc;
+    
+    rc = readINT16little(fp, &(bfh->xHotspot));
+    if (rc != 0)
+	return rc;
+    
+    rc = readINT16little(fp, &(bfh->yHotspot));
+    if (rc != 0)
+	return rc;
+    
+    rc = readUINT32little(fp, &(bfh->offsetToBits));
+    return rc;
+}
+
+/*
+ * Read a BITMAPARRAYHEADER
+ */
+CGAL_INLINE_FUNCTION
+int readBitmapArrayHeader(FILE *fp, BITMAPARRAYHEADER *bah)
+{
+    int rc;
+    
+    rc = readUINT16little(fp, &(bah->type));
+    if (rc != 0)
+	return rc;
+    rc = readUINT32little(fp, &(bah->size));
+    if (rc != 0)
+	return rc;
+    rc = readUINT32little(fp, &(bah->next));
+    if (rc != 0)
+	return rc;
+    rc = readUINT16little(fp, &(bah->screenWidth));
+    if (rc != 0)
+	return rc;
+    rc = readUINT16little(fp, &(bah->screenHeight));
+    return rc;
+}
+
+/*
+ * Read the BITMAPHEADER structure.  This one requires a bit of sanity
+ * checking.  The length of the structure on the disk is specified in the
+ * first field.  We must stop reading after that many bytes, and if that value
+ * is longer than sizeof(BITMAPHEADER), we must skip over any leftover bytes.
+ * Finally, if size is 12, then width an height are really 16-bit values, and
+ * we have to read them differently so they'll be properly stored in the
+ * 32-bit fields BITMAPHEADER uses.
+ */
+CGAL_INLINE_FUNCTION
+int readBitmapHeader(FILE *fp, BITMAPHEADER *bh)
+{
+    int    rc, oldFormat;
+	unsigned int bytesRead;
+    CGAL_UINT16 tempVal;
+    
+    /*
+     * Clear the structure.  Default values for all fields are zeros.  This
+     * will prevent garbage from being returned if the structure is truncated
+     * on disk.
+     */
+    memset(bh, 0, sizeof(BITMAPHEADER));
+    
+    /*
+     * Read the size of the structure.  From here on in, we'll have to be sure
+     * we don't read more bytes than this value.
+     */
+    rc = readUINT32little(fp, &(bh->size));
+    if (rc != 0)
+	return rc;
+    bytesRead = 4;
+    
+    /*
+     * If the size is 12 bytes or less, than this is an "old format"
+     * structure.  So the width and height fields will have to be read
+     * differently.
+     */
+    if (bh->size <= 12)
+	oldFormat = 1;
+    else
+	oldFormat = 0;
+    
+    /*
+     * Width and height are read differently for old and new format files.  In
+     * the old format, they're 16-bit values.  In the new format, they're
+     * 32-bits long.
+     */
+    if (oldFormat)
+    {
+	rc = readUINT16little(fp, &tempVal);
+	if (rc != 0)
+	    return rc;
+	bh->width = tempVal;
+	bytesRead += 2;
+    }
+    else
+    {
+	rc = readINT32little(fp, &(bh->width));
+	if (rc != 0)
+	    return rc;
+	bytesRead += 4;
+    }
+    if (bytesRead >= bh->size)
+	return 0;
+    
+    if (oldFormat)
+    {
+	rc = readUINT16little(fp, &tempVal);
+	if (rc != 0)
+	    return rc;
+	bh->height = tempVal;
+	bytesRead += 2;
+    }
+    else
+    {
+	rc = readINT32little(fp, &(bh->height));
+	if (rc != 0)
+	    return rc;
+	bytesRead += 4;
+    }
+    if (bytesRead >= bh->size)
+	return 0;
+    
+    /*
+     * From this point on, old and new formats are identical to each other,
+     * and we can proceed as if there was no difference.  For each field, we
+     * read it in and increment the count of bytes read.  If at any time we
+     * have read the amount we got earlier (in the size field), then stop and
+     * leave the rest of the fields as zeros.
+     */
+    rc = readUINT16little(fp, &(bh->numBitPlanes));
+    if (rc != 0)
+	return rc;
+    bytesRead += 2;
+    if (bytesRead >= bh->size)
+	return 0;
+    
+    rc = readUINT16little(fp, &(bh->numBitsPerPlane));
+    if (rc != 0)
+	return rc;
+    bytesRead += 2;
+    if (bytesRead >= bh->size)
+	return 0;
+  
+    /*
+     * Old format stop here.  But we don't have to check, because in that
+     * format, 12 bytes have been read and the function will have exited 
+     * without any extra checking.
+     */
+    rc = readUINT32little(fp, &(bh->compressionScheme));
+    if (rc != 0)
+	return rc;
+    bytesRead += 4;
+    if (bytesRead >= bh->size)
+	return 0;
+    
+    rc = readUINT32little(fp, &(bh->sizeOfImageData));
+    if (rc != 0)
+	return rc;
+    bytesRead += 4;
+    if (bytesRead >= bh->size)
+	return 0;
+    
+    rc = readUINT32little(fp, &(bh->xResolution));
+    if (rc != 0)
+	return rc;
+    bytesRead += 4;
+    if (bytesRead >= bh->size)
+	return 0;
+    
+    rc = readUINT32little(fp, &(bh->yResolution));
+    if (rc != 0)
+	return rc;
+    bytesRead += 4;
+    if (bytesRead >= bh->size)
+	return 0;
+    
+    rc = readUINT32little(fp, &(bh->numColorsUsed));
+    if (rc != 0)
+	return rc;
+    bytesRead += 4;
+    if (bytesRead >= bh->size)
+	return 0;
+    
+    rc = readUINT32little(fp, &(bh->numImportantColors));
+    if (rc != 0)
+	return rc;
+    bytesRead += 4;
+    if (bytesRead >= bh->size)
+	return 0;
+    
+    rc = readUINT16little(fp, &(bh->resolutionUnits));
+    if (rc != 0)
+	return rc;
+    bytesRead += 2;
+    if (bytesRead >= bh->size)
+	return 0;
+    
+    rc = readUINT16little(fp, &(bh->padding));
+    if (rc != 0)
+	return rc;
+    bytesRead += 2;
+    if (bytesRead >= bh->size)
+	return 0;
+    
+    rc = readUINT16little(fp, &(bh->origin));
+    if (rc != 0)
+	return rc;
+    bytesRead += 2;
+    if (bytesRead >= bh->size)
+	return 0;
+    
+    rc = readUINT16little(fp, &(bh->halftoning));
+    if (rc != 0)
+	return rc;
+    bytesRead += 2;
+    if (bytesRead >= bh->size)
+	return 0;
+    
+    rc = readUINT32little(fp, &(bh->halftoningParam1));
+    if (rc != 0)
+	return rc;
+    bytesRead += 4;
+    if (bytesRead >= bh->size)
+	return 0;
+    
+    rc = readUINT32little(fp, &(bh->halftoningParam2));
+    if (rc != 0)
+	return rc;
+    bytesRead += 4;
+    if (bytesRead >= bh->size)
+	return 0;
+  
+    rc = readUINT32little(fp, &(bh->colorEncoding));
+    if (rc != 0)
+	return rc;
+    bytesRead += 4;
+    if (bytesRead >= bh->size)
+	return 0;
+    
+    rc = readUINT32little(fp, &(bh->identifier));
+    if (rc != 0)
+	return rc;
+    bytesRead += 4;
+    if (bytesRead >= bh->size)
+	return 0;
+    
+    /*
+     * If there are more bytes in the file than this, then the file is using a
+     * future format that doesn't exist yet.  Skip over the bytes.  Assuming
+     * this future format somewhat resembles what we know now, ignoring the
+     * fields will be safe.  We _MUST_ skip them, though, since the color
+     * table begins on the byte after this structure, and we have to position
+     * the file pointer there.
+     */
+    return fseek(fp, (bh->size - bytesRead), SEEK_CUR);
+}
+
+
+/*
+ * readRgb reads in a single RGB structure from the disk.  The numBytes field
+ * indicates how many bytes the field occupies on the disk.  It assumes that
+ * each component is one byte on disk and the rest is padding.  This will
+ * compensate for the old/new differences in color tables.  (Old format
+ * bitmaps use 3 bytes per entry, while new format bitmaps use 4.)  Note how
+ * it will never read more than the number of bytes requested.
+ */
+CGAL_INLINE_FUNCTION
+int readRgb(FILE *fp, RGB *rgb, int numBytes)
+{
+    int rc;
+    
+    if (numBytes == 0)
+	return 0;
+    rc = readUINT8little(fp, &(rgb->blue));
+    if (rc != 0)
+	return rc;
+    
+    if (numBytes == 1)
+	return 0;
+    rc = readUINT8little(fp, &(rgb->green));
+    if (rc != 0)
+	return rc;
+    
+    if (numBytes == 2)
+	return 0;
+    rc = readUINT8little(fp, &(rgb->red));
+    if (rc != 0)
+	return rc;
+    
+    if (numBytes == 3)
+	return 0;
+    
+    /* Skip over extra bytes if more than three were requested */
+    return fseek(fp, (numBytes - 3), SEEK_CUR);
+}
+
+/*
+ * A color table is a block of RGB structures, all the same size.  Read it by
+ * calling readRgb repeatedly.
+ */
+CGAL_INLINE_FUNCTION
+int readColorTable(FILE *fp, RGB *rgb, int numEntries, int numBytesPerEntry)
+{
+    int i, rc;
+    
+    for (i=0; i<numEntries; i++)
+    {
+	rc = readRgb(fp, &(rgb[i]), numBytesPerEntry);
+	if (rc != 0)
+	    return rc;
+    }
+    return 0;
+}
+
+
+/*
+ * ReadBitsUncompressed.  Reads pixel values into an array of RGB
+ * values.  It assmes that there is no compression.  Note that there we're
+ * only handling bit depths of 1, 4, 8, 16, and 24. Note that OS/2 bitmaps
+ * can (in theory) have any number of bits per pixel, so you might find a
+ * strange bitmap file that this can't handle, but the chances of finding such
+ * a file this are nearly zero.
+ *
+ * Each row of pixels is always padded to a 4-byte boundary.
+ */
+CGAL_INLINE_FUNCTION
+int readBitsUncompressed(FILE *fp, RGB *image, int width, int height,
+			 int depth, RGB *colorTable)
+{
+    CGAL_UINT8 temp;
+    int   rc, padBytes, i;
+    long  row, column, pixel, value;
+    
+    switch (depth) {
+    case 1:
+	/*
+	 * For 1 bit per pixel, each byte is 8 pixels.  Each one is an index
+	 * into the color table (1 or 0).  Most significant byte first.  All
+	 * is padded to 32-bit boundaries as well.
+	 */
+	pixel = 0;
+	if (((width % 32) == 0) || ((width % 32) > 24))
+	    padBytes = 0;
+	else if ((width % 32) <= 8)
+	    padBytes = 3;
+	else if ((width % 32) <= 16)
+	    padBytes = 2;
+	else
+	    padBytes = 1;
+
+	for (row = height; row > 0; row--)
+	{
+	    for (column = width; column > 0; column -= 8)
+	    {
+		rc = readUINT8little(fp, &temp);
+		if (rc != 0)
+		    return rc;
+		for (i=0; i < ((column < 8) ? column : 8); i++)
+		{
+		    /*
+		     * For each byte read, bit-decompose it.  Note that the
+		     * last byte on a row could have less than 8 bits used.
+		     * Most significant bits come first.
+		     */
+		    value = ((temp & (1 << (7-i))) == 0) ? 0 : 1;
+		    image[pixel].red   = colorTable[value].red;
+		    image[pixel].green = colorTable[value].green;
+		    image[pixel].blue  = colorTable[value].blue;
+		    pixel++;
+		}
+	    }
+	    if (padBytes != 0)
+	    {
+		rc = fseek(fp, padBytes, SEEK_CUR);
+		if (rc != 0)
+		    return rc;
+	    }
+	}
+	break;
+
+    case 4:
+	/*
+	 * For 4 bits per pixel, each byte is two pixels.  The upper half go to
+	 * the first pixel, and the lower half to the second.
+	 */
+	pixel = 0;
+	if (((width % 8) == 0) || ((width % 8) > 6))
+	    padBytes = 0;
+	else if ((width % 8) <= 2)
+	    padBytes = 3;
+	else if ((width % 8) <= 4)
+	    padBytes = 2;
+	else
+	    padBytes = 1;
+	
+	for (row = height; row > 0; row--)
+	{
+	    for (column = width; column > 0; column -= 2)
+	    {
+		/*
+		 * Each byte here is two pixels.  Note that the last byte on a
+		 * row may only contain one pixel.
+		 */
+		rc = readUINT8little(fp, &temp);
+		if (rc != 0)
+		    return rc;
+		/*
+		 * First pixel is the upper 4 bits
+		 */
+		value = temp >> 4;
+		image[pixel].red   = colorTable[value].red;
+		image[pixel].green = colorTable[value].green;
+		image[pixel].blue  = colorTable[value].blue;
+		pixel++;
+
+		/*
+		 * Second pixel is lower 4 bits.  If this is the last byte in
+		 * the row, and there are an odd number of pixels per row, then
+		 * this is not valid data.
+		 */
+		if (column == 1)
+		{
+		    value = temp & 0x0f;
+		    image[pixel].red   = colorTable[value].red;
+		    image[pixel].green = colorTable[value].green;
+		    image[pixel].blue  = colorTable[value].blue;
+		    pixel++;
+		}
+	    }
+	    if (padBytes != 0)
+	    {
+		rc = fseek(fp, padBytes, SEEK_CUR);
+		if (rc != 0)
+		    return rc;
+	    }
+	}
+	break;
+
+    case 8:
+	/*
+	 * For 8 bits per pixel, each byte is one pixel.
+	 */
+	pixel = 0;
+	padBytes = ((width % 4) == 0) ? 0 : (4 - (width % 4));
+
+	for (row=height; row > 0; row--)
+	{
+	    for (column=width; column > 0; column--)
+	    {
+		rc = readUINT8little(fp, &temp);
+		if (rc != 0)
+		    return rc;
+		image[pixel].red   = colorTable[temp].red;
+		image[pixel].green = colorTable[temp].green;
+		image[pixel].blue  = colorTable[temp].blue;
+		pixel++;
+	    }
+	    if (padBytes != 0)
+	    {
+		rc = fseek(fp, padBytes, SEEK_CUR);
+		if (rc != 0)
+		    return rc;
+	    }
+	}
+	break;
+
+    case 16:
+	/*
+	 * For 16 bits per pixel, you must read two bytes per pixel.  But
+	 * there's a catch. The data is big endian!  This is because all pixel
+	 * data (for all formats, actually) is stored as a packed array,
+	 * stored in pixel order.
+	 */
+	pixel = 0;
+	padBytes = ((width % 2) == 0) ? 0 : 2;
+	for (row=height; row > 0; row--)
+	{
+	    for (column=width; column > 0; column--)
+	    {
+		/*
+		 * Read a 16-bit integer as big endian.  Do this by reading
+		 * two bytes and mathematically combine them.  After that,
+		 * proceed as usual.
+		 */
+		rc = readUINT8little(fp, &temp);
+		if (rc != 0)
+		    return rc;
+		value = ((long)temp) << 8;
+		rc = readUINT8little(fp, &temp);
+		if (rc != 0)
+		    return rc;
+		value |= temp;
+
+		image[pixel].red   = colorTable[value].red;
+		image[pixel].green = colorTable[value].green;
+		image[pixel].blue  = colorTable[value].blue;
+		pixel++;
+	    }
+	    if (padBytes != 0)
+	    {
+		rc = fseek(fp, padBytes, SEEK_CUR);
+		if (rc != 0)
+		    return rc;
+	    }
+	}
+	break;
+
+    case 24:
+	/*
+	 * For 24 bits per pixel, it's an RGB structure.  Note that the color
+	 * table is ignore for bit depths greater than 24 bits.
+	 */
+	pixel = 0;
+	padBytes = width % 4;
+
+	for (row=height; row > 0; row--)
+	{
+	    for (column=width; column > 0; column--)
+	    {
+		rc = readRgb(fp, image+pixel, 3);
+		pixel++;
+	    }
+	    if (padBytes != 0)
+	    {
+		rc = fseek(fp, padBytes, SEEK_CUR);
+		if (rc != 0)
+		    return rc;
+	    }
+	}          
+	break;
+    }
+    
+    return 0;
+}
+
+
+/*
+ * ReadMaskBitsUncompressed.  Reads a monochrome mask into an array of
+ * characters.  It assmes that there is no compression.  This is very similar
+ * (internally) to the readBitsUncompressed function.  Note that if the data
+ * read isn't really one-bit-deep data, you'll probably get garbage back.
+ */
+CGAL_INLINE_FUNCTION
+int readMaskBitsUncompressed(FILE *fp, char *image, int width, int height)
+{
+    CGAL_UINT8 temp;
+    int   rc, padBytes, i;
+    long  row, column, pixel;
+    char value;
+    
+    /*
+     * see the one-bit-depth part of readBitsUncompressed for comments
+     */
+    pixel = 0;
+    if (((width % 32) == 0) || ((width % 32) > 24))
+	padBytes = 0;
+    else if ((width % 32) <= 8)
+	padBytes = 3;
+    else if ((width % 32) <= 16)
+	padBytes = 2;
+    else
+	padBytes = 1;
+
+    for (row = height; row > 0; row--)
+    {
+	for (column = width; column > 0; column -= 8)
+	{
+	    rc = readUINT8little(fp, &temp);
+	    if (rc != 0)
+		return rc;
+	    for (i=0; i < ((column < 8) ? column : 8); i++)
+	    {
+		value = ((temp & (1 << (7-i))) == 0) ? 0 : 1;
+		image[pixel] = value;
+		pixel++;
+	    }
+	}
+	if (padBytes != 0)
+	{
+	    rc = fseek(fp, padBytes, SEEK_CUR);
+	    if (rc != 0)
+		return rc;
+	}
+    }
+
+    return 0;
+}
+
+
+/*
+ * reflectYRGB takes an array of RGB vales and the dimensions they represent
+ * and flips it vertically.  This will convert a bottom-left origin array to a
+ * top-left origin array.
+ */
+CGAL_INLINE_FUNCTION
+void reflectYRGB(RGB *image, int width, int height)
+{
+    int row, col;
+    RGB temp;
+    
+    for (row = 0; row < (height / 2); row++)
+    {
+	for (col = 0; col < width; col++)
+	{
+	    /* Swap pixels at (x,y) with (x,height-y) */
+	    memcpy(&temp, image+(row * width + col), sizeof(RGB));
+	    memcpy(image+(row * width + col),
+		   image+((height - row - 1) * width + col), sizeof(RGB));
+	    memcpy(image+((height - row - 1) * width + col), &temp,
+		   sizeof(RGB));
+	}
+    }
+}
+/*
+ * reflectYchar takes an array of char values and the dimensions they
+ * represent and flips it vertically.  This will convert a bottom-left origin
+ * array to a top-left origin array.
+ */
+CGAL_INLINE_FUNCTION
+void reflectYchar(char *image, int width, int height)
+{
+    int row, col;
+    char temp;
+    
+    for (row = 0; row < (height / 2); row++)
+    {
+	for (col = 0; col < width; col++)
+	{
+	    /* Swap values at (x,y) with (x,height-y) */
+	    temp = image[row * width + col];
+	    image[row * width + col]=image[(height - row - 1) * width + col];
+	    image[(height - row - 1) * width + col] = temp;
+	}
+    }
+}
+
+/*****************************************************************************
+ *
+ * High-level functions
+ *
+ * These functions read in specific types of bitmap files.  Each assumes that
+ * the file pointer is positioned at the appropriate place in a bitmap file.
+ * (At the start of a Bitmapfileheader for all functions except
+ * readMultipleImages, which assumes the file pointer to be positioned on the
+ * start of a BITMAPARRAYHEADER.  These functions will leave the file pointer
+ * on the byte after the image's color table.
+ *
+ * The coordinate speaces in the returned arrays will have an upper-left
+ * origin.   As before, a non-zero return value indicates that something went
+ * wrong.
+ *
+ * Note that the BMP and mono-ICO functions will not return 1000 if the image
+ * is of type color-icon.  This is because a color icon consists of a bitmap
+ * and a monochrome icon.
+ *
+ * return values:
+ *	   0 - success
+ *	1000 - incorrect file type for the routine called
+ *	1001 - image data out of range or damaged file
+ *	1002 - good data, but the routine called can't handle it (yet)
+ *	1003 - out of memory allocating color table
+ *	1004 - out of memory allocating image
+ *	1005 - out of memory allocating image arrays
+ *	1006 - Illegal image type in a multi-image array
+ *
+ *     other - I/O error of some kind
+ */
+
+
+/*
+ * readSingleImageBMP will read a single BMP image and generate an array of RGB
+ * triples that contain the RGB values for every pixel.  It will also return
+ * the dimensions of the image.
+ */
+CGAL_INLINE_FUNCTION
+int readSingleImageBMP(FILE *fp, RGB **argb, CGAL_UINT32 *width, CGAL_UINT32 *height)
+{
+    Bitmapfileheader  bfh;
+    BITMAPHEADER      bh;
+    RGB              *colorTable = (RGB*)NULL;
+    RGB              *image = (RGB*)NULL;
+    int               rc, depth, inverted;
+    int               numColors;
+    long              numPixels, endPos;
+    
+    /*
+     * First, get the file header and sanity check it.  The type field must be
+     * TYPE_BMP or we're aborting.
+     */
+    rc = readBitmapFileHeader(fp, &bfh);
+    if (rc != 0)
+	return rc;
+    if ((bfh.type != TYPE_BMP) &&
+	(bfh.type != TYPE_ICO_COLOR) &&
+	(bfh.type != TYPE_PTR_COLOR))
+	return 1000;
+    
+    /*
+     * Immediately following a file header is always the bitmap header.  Read
+     * it.  Sanity check any values we might need.  Specifically, less than
+     * 32-bit depth, known compression scheme, known origin, and known color
+     * encoding, and valid height/width.  Note that negative height is OK,
+     * that indicates an upper-left origin for a Windows bitmap.
+     */
+    rc = readBitmapHeader(fp, &bh);
+    if (rc != 0)
+	return rc;
+    depth = bh.numBitPlanes * bh.numBitsPerPlane;
+    if ((depth > 32) ||
+	(bh.compressionScheme > COMPRESSION_LAST) ||
+	(bh.origin > ORIGIN_LAST) ||
+	(bh.colorEncoding > COLOR_ENCODING_LAST) ||
+	(bh.width < 1) ||
+	(bh.height == 0))
+	return 1001;
+    
+    /*
+     * If the height is negative, then this is a Windows bitmap whose origin
+     * is the upper-left corner and not the lower-left.  The inverted flag
+     * indicates a lower-left origin.  Our code will be outputting an
+     * upper-left origin pixel array.
+     */
+    if (bh.height < 0)
+    {
+	inverted = 0;
+	bh.height = -bh.height;
+    }
+    else
+	inverted = 1;
+    
+    /*
+     * Now, sanity check a few fields that are valid, but I don't have code to
+     * deal with them yet.  This includes: more than one bit plane, any
+     * compression scheme, and bit depths that are not 1, 4, 8, 16, or 24.
+     */
+    if ((bh.numBitPlanes > 1) ||
+	((bh.numBitsPerPlane != 1) &&
+	 (bh.numBitsPerPlane != 4) &&
+	 (bh.numBitsPerPlane != 8) &&
+	 (bh.numBitsPerPlane != 16) &&
+	 (bh.numBitsPerPlane != 24)) ||
+	(bh.compressionScheme != COMPRESSION_NONE))
+	return 1002;
+    
+    /*
+     * Allocate and read the color table.  The file pointer has been
+     * positioned in the right place by the readBitmapHeader function.  Note
+     * that images with 24-bits or more color depth have no color table.  They
+     * are  already RGB.  When reading the color table, be sure to check for
+     * old/new format bitmaps. 
+     */
+    if (depth < 24)
+    {
+	numColors = 1 << depth;
+	colorTable = (RGB *)calloc(numColors, sizeof(RGB));
+	if (colorTable == NULL)
+	    return 1003;
+	if (bh.size <= 12)
+	    rc = readColorTable(fp, colorTable, numColors, 3);
+	else
+	    rc = readColorTable(fp, colorTable, numColors, 4);
+	if (rc != 0)
+	{
+	    free(colorTable);
+	    return rc;
+	}
+    }
+    
+    /*
+     * We're at the end of the color table.  Preserve this position.  We'll
+     * need to leave the file pointer there before returning from this
+     * function. 
+     */
+    endPos = ftell(fp);
+
+    /*
+     * Allocate the array of pixels and fill it in.
+     */
+    numPixels = bh.width * bh.height;
+    image = (RGB *)calloc(numPixels, sizeof(RGB));
+    if (image == NULL)
+    {
+	free (colorTable);
+	return 1004;
+    }
+    
+    /*
+     * Seek to the bits
+     */
+    rc = fseek(fp, bfh.offsetToBits, SEEK_SET);
+    if (rc != 0)
+    {
+	free (colorTable);
+	free (image);
+	return rc;
+    }
+    
+    /*
+     * Read the bits.  If code for decompressing bits should be written,
+     * insert the call here.
+     */
+    switch ((int)bh.compressionScheme) {
+    case COMPRESSION_NONE:
+	rc = readBitsUncompressed(fp, image, bh.width, bh.height, depth,
+				  colorTable);
+	break;
+    }
+    
+    if (rc != 0)
+    {
+	free(image);
+	return rc;
+    }
+    
+    /*
+     * If the origin is lower-left, flip the image upside down
+     */
+    if (inverted)
+	reflectYRGB(image, bh.width, bh.height);
+
+    /*
+     * Return the output values.  Set the file pointer to the byte after the
+     * color table.
+     */
+    *argb = image;
+    *width = bh.width;
+    *height = bh.height;
+    fseek(fp, endPos, SEEK_SET);
+
+    /*
+     * Clean up and return.  Note that we don't return the color table.  This
+     * is because we're returning an array of RGB values for the image - such
+     * a table would be redundant.
+     */
+    if (colorTable != NULL)
+	free(colorTable);
+
+    return 0;
+}
+
+
+/*
+ * Read in a monochrome OS/2 icon/pointer.  return two arrays of bytes
+ * (interpreted as booleans) for the XOR and AND masks.
+ */
+CGAL_INLINE_FUNCTION
+int readSingleImageICOPTR(FILE *fp, char **xorMask, char **andMask,
+		          CGAL_UINT32 *width, CGAL_UINT32 *height) 
+{
+    Bitmapfileheader  bfh;
+    BITMAPHEADER      bh;
+    char             *mask1, *mask2;
+    int               rc;
+    long              numPixels, endPos;
+
+    /*
+     * Read and sanity check the header.  Monochrom OS/2 icons are TYPE_ICO.
+     * Monochrome pointers are TYPE_PTR.  Color ICO and PTR is also allowed,
+     * because monochrome masks are part of those images.
+     */
+    rc = readBitmapFileHeader(fp, &bfh);
+    if (rc != 0)
+	return rc;
+    if ((bfh.type != TYPE_ICO) &&
+	(bfh.type != TYPE_PTR) &&
+	(bfh.type != TYPE_ICO_COLOR) &&
+	(bfh.type != TYPE_PTR_COLOR))
+	return 1000;
+
+    /*
+     * Now read the bitmap data and sanity check it.  Since this is a
+     * monochrome icon, bit depth must be 1.  Additionally, a known
+     * compression scheme, known origin, known color encoding, and valid
+     * height/width.  Height can't be less than 0, as it can with color
+     * images, since this code is only used on for OS/2-type images.
+     */
+    rc = readBitmapHeader(fp, &bh);
+    if (rc != 0)
+	return rc;
+    if ((bh.numBitPlanes != 1) ||
+	(bh.numBitsPerPlane != 1) ||
+	(bh.compressionScheme > COMPRESSION_LAST) ||
+	(bh.origin > ORIGIN_LAST) ||
+	(bh.colorEncoding > COLOR_ENCODING_LAST) ||
+	(bh.width < 1) ||
+	(bh.height < 1))
+	return 1001;
+
+    /*
+     * Sanity check some valid fields that I can't deal with yet.
+     */
+    if (bh.compressionScheme != COMPRESSION_NONE)
+	return 1002;
+
+    /*
+     * Skip over the color table, since this is a monochrome mask.  Note that
+     * the size is already known - 2 entries - which is 6 or 8 bytes.
+     * this isn't, and we don't.
+     */
+    if (bh.size <= 12)
+	rc = fseek(fp, 6, SEEK_CUR);
+    else
+	rc = fseek(fp, 8, SEEK_CUR);
+    if (rc != 0)
+    {
+	return rc;
+    }
+
+    /*
+     * Save this file position.  we'll have to seek back to it after reading
+     * in the image data.
+     */
+    endPos = ftell(fp);
+
+    /*
+     * The image is actually two images.  The top half is an AND mask and the
+     * bottom half is an XOR mask.  Allocate the images.
+     */
+    numPixels = bh.width * bh.height / 2;
+    mask1 = (char *)malloc(numPixels);
+    if (mask1 == NULL)
+	return 1004;
+    mask2 = (char *)malloc(numPixels);
+    if (mask2 == NULL)
+    {
+	free(mask1);
+	return 1004;
+    }
+
+    /*
+     * Seek to the bit data
+     */
+    rc = fseek(fp, bfh.offsetToBits, SEEK_SET);
+    if (rc != 0)
+    {
+	free (mask1);
+	free (mask2);
+	return rc;
+    }
+
+    /*
+     * Read in the bits.  Note: since these are really two images, two calls
+     * to readMaskBitsUncompressed are made, and the height used is 1/2 the
+     * height mentioned in the header.
+     */
+    switch ((int) bh.compressionScheme) {
+    case COMPRESSION_NONE:
+	rc = readMaskBitsUncompressed(fp, mask1, bh.width, bh.height/2);
+	if (rc == 0)
+	    rc = readMaskBitsUncompressed(fp, mask2, bh.width, bh.height/2);
+	break;
+    }
+
+    if (rc != 0)
+    {
+	free (mask1);
+	free (mask2);
+	return rc;
+    }
+
+    /*
+     * A mask will never have an upper-left origin, since Windows will never
+     * produce one in a bitmap file.
+     */
+    reflectYchar(mask1, bh.width, bh.height / 2);
+    reflectYchar(mask2, bh.width, bh.height / 2);
+
+    /*
+     * Return everything we've read.
+     */
+    *xorMask = mask1;
+    *andMask = mask2;
+    *width = bh.width;
+    *height = bh.height / 2;
+    fseek(fp, endPos, SEEK_SET);
+    
+    return 0;
+}
+
+
+/*
+ * Read in a color OS/2 icon.  return an array of RGBs for the colors.
+ * and two arrays of bytes (interpreted as booleans) for the XOR and AND
+ * masks.
+ */
+CGAL_INLINE_FUNCTION
+int readSingleImageColorICOPTR(FILE *fp, RGB **argb, char **xorMask,
+			       char **andMask, CGAL_UINT32 *width, CGAL_UINT32 *height)
+{
+    CGAL_UINT32 width1, height1, width2, height2;
+    int rc;
+
+    /*
+     * Color icons consist of a monochrome icon followed by a bitmap.  This
+     * makes reading them easy - first do a monochrome mask read, and then do
+     * a color bitmap read.  We should probably add some more descriptive
+     * error codes here.
+     *
+     * First read the mask.
+     */
+    rc = readSingleImageICOPTR(fp, xorMask, andMask, &width2, &height2);
+    if (rc != 0)
+    {
+	return rc;
+    }
+
+    /*
+     * Next, read the color bitmap part
+     */
+    rc = readSingleImageBMP(fp, argb, &width1, &height1);
+    if (rc != 0)
+    {
+	return rc;
+    }
+
+    /*
+     * Now, just sanity check the image - the dimensions for the image should
+     * match the dimensions of the masks.
+     */
+    if ((width1 != width2) || (height1 != height2))
+	return 1001;
+
+    *width = width1;
+    *height = height1;
+    return 0;
+}
+
+
+/*
+ * readMultipleImage runs down the list of images in a file and returns them
+ * all.  ImageCount is the number of images in the file.  The other returned
+ * values are parallel arrays.  If an element in aargb, axorMask, or aandMask
+ * is NULL, then that image has no such array.  (Bitmaps have no xor or and
+ * masks, monochrome icons have no color arrays.
+ *
+ * Note that on errors other than 1000 and 1005, the arrays will contain good
+ * data - the images that have been read properly will be in the arrays.
+ * Images that have not yet been read will consist of NULL pointers in the
+ * arrays. 
+ */
+CGAL_INLINE_FUNCTION
+int readMultipleImage(FILE *fp, RGB ***argbs, char ***xorMasks,
+		      char ***andMasks, CGAL_UINT32 **widths, CGAL_UINT32 **heights,
+		      int *imageCount)
+{
+    int rc;
+    long filePos;
+    BITMAPARRAYHEADER bah;
+    CGAL_UINT16 imageType;
+    int count;
+    
+    /*
+     * First count the images.  Preserve the file position for later.  If some
+     * structure in the list isn't an array header, return 1000.
+     */
+    filePos = ftell(fp);
+    count = 0;
+    do
+    {
+	rc = readBitmapArrayHeader(fp, &bah);
+	if (rc != 0)
+	    return rc;
+	if (bah.type != TYPE_ARRAY)
+	    return 1000;
+	fseek(fp, bah.next, SEEK_SET);
+	count++;
+    } while (bah.next != 0);
+    fseek(fp, filePos, SEEK_SET);
+    
+    /*
+     * Allocate the arrays.  Return 1005 on any failures
+     */
+    *argbs = (RGB **)calloc(count, sizeof(RGB *));
+    if (*argbs == NULL)
+	return 1005;
+    *xorMasks = (char **)calloc(count, sizeof(char *));
+    if (*xorMasks == NULL)
+    {
+	free(*argbs);
+	return 1005;
+    }
+    *andMasks = (char **)calloc(count, sizeof(char *));
+    if (*andMasks == NULL)
+    {
+	free(*argbs);
+	free(*xorMasks);
+	return 1005;
+    }
+    *widths = (CGAL_UINT32 *)calloc(count, sizeof(CGAL_UINT32));
+    if (*widths == NULL)
+    {
+	free(*argbs);
+	free(*xorMasks);
+	free(*andMasks);
+	return 1005;
+    }
+    *heights = (CGAL_UINT32 *)calloc(count, sizeof(CGAL_UINT32));
+    if (*heights == NULL)
+    {
+	free(*argbs);
+	free(*xorMasks);
+	free(*andMasks);
+	free(*widths);
+	return 1005;
+    }
+    *imageCount = count;
+
+    /*
+     * Loop through the images again.  This time, read each image
+     */
+    count = 0;
+    do
+    {
+	rc = readBitmapArrayHeader(fp, &bah);
+	if (rc != 0)
+	    return rc;
+	/*
+	 * Get the image type.  Preserve the position, since we're reading
+	 * into the next structure.
+	 */
+	filePos = ftell(fp);
+	rc = readUINT16little(fp, &imageType);
+	if (rc != 0)
+	    return rc;
+	rc = fseek(fp, filePos, SEEK_SET);
+
+	/*
+	 * Now that we know what kind of image we're about to read, read it. 
+	 */
+	switch(imageType) {
+	case TYPE_BMP:
+	    rc = readSingleImageBMP(fp, (*argbs)+count, (*widths)+count,
+				    (*heights)+count);
+	    break;
+	case TYPE_ICO:
+	case TYPE_PTR:
+	    rc = readSingleImageICOPTR(fp, (*xorMasks)+count,
+				       (*andMasks)+count, (*widths)+count,
+				       (*heights)+count);
+	    break;
+	case TYPE_ICO_COLOR:
+	case TYPE_PTR_COLOR:
+	    rc = readSingleImageColorICOPTR(fp, (*argbs)+count,
+					    (*xorMasks)+count,
+					    (*andMasks)+count,
+					    (*widths)+count,
+					    (*heights)+count);
+	    break;
+	default:
+	    return 1006;
+	}
+	if (rc != 0)
+	    return rc;
+	
+	fseek(fp, bah.next, SEEK_SET);
+	count++;
+    } while (bah.next != 0);
+
+    return 0;
+}
+
+
+/*
+ * Formatting information for emacs in c-mode
+ *
+ * Local Variables:
+ * c-indent-level:4
+ * c-continued-statement-offset:4
+ * c-brace-offset:-4
+ * c-brace-imaginary-offset:0
+ * c-argdecl-indent:4
+ * c-label-offset:-4
+ * End:
+ */
+
diff --git a/3rdparty/CGAL/include/CGAL/ImageIO/bmptypes.h b/3rdparty/CGAL/include/CGAL/ImageIO/bmptypes.h
new file mode 100644
index 0000000..6468459
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/ImageIO/bmptypes.h
@@ -0,0 +1,224 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+/*
+ * from bmp.zip, see the url http://www.ddj.com/ftp/1995/1995.03/
+ * author Dr. Dobb's
+ */
+
+/*
+ * Data types used in bitmap files.
+ */
+
+#ifndef __BMPTYPES_H_INCLUDED__
+#define __BMPTYPES_H_INCLUDED__
+
+/*****************************************************************************
+*
+* Data types.
+*
+* CGAL_INT8 is an integer of at least 8 bits wide.
+* CGAL_INT16 is an integer of at least 16 bits wide.
+* CGAL_INT32 is an integer of at least 32 bits wide.
+*
+* CGAL_UINT8 is an unsigned CGAL_INT8
+* CGAL_UINT16 is an unsigned CGAL_INT16
+* CGAL_UINT32 is an unsigned CGAL_INT32
+*/
+
+#include <boost/cstdint.hpp>
+
+typedef char            CGAL_INT8;
+typedef short           CGAL_INT16;
+typedef boost::int32_t  CGAL_INT32;
+typedef unsigned char   CGAL_UINT8;
+typedef unsigned short  CGAL_UINT16;
+typedef boost::uint32_t CGAL_UINT32;
+
+/*****************************************************************************
+*
+* Constants.  Each set corresponds to a field in a structure.  Note that some
+* sets only have one value.  Default values for all fields are the value
+* corresponding to 0. 
+*/
+
+/*
+ * Constants used in the "type" field of Bitmapfileheader and
+ * BITMAPARRAYHEADER structures.  Note that these are all two-character
+ * mnemonics as well as integer constants.
+ */
+#define TYPE_ICO        (0x4349)   /* 'IC' */
+#define TYPE_BMP        (0x4d42)   /* 'BM' */
+#define TYPE_PTR        (0x5450)   /* 'PT' */
+#define TYPE_ICO_COLOR  (0x4943)   /* 'CI' */
+#define TYPE_PTR_COLOR  (0x5043)   /* 'CP' */
+#define TYPE_ARRAY      (0x4142)   /* 'BA' */
+   
+/*
+ * Compression schemes.  Note that BITFIELDS (from NT) uses the same number as
+ * HUFFMAN1D (from OS/2)
+ */
+#define COMPRESSION_NONE       (0)
+#define COMPRESSION_RLE_8      (1)
+#define COMPRESSION_RLE_4      (2)
+#define COMPRESSION_HUFFMAN1D  (3)
+#define COMPRESSION_BITFIELDS  (3)
+#define COMPRESSION_RLE_24     (4)
+#define COMPRESSION_LAST       (4)
+   
+/*
+ * units of resolution
+ */
+#define UNITS_PELS_PER_METER (0)
+#define UNITS_LAST           (0)
+
+/*
+ * origin of coordinate space
+ */   
+#define ORIGIN_LOWER_LEFT  (0)
+#define ORIGIN_LAST        (0)
+
+/*
+ * halftoning algorithms
+ */   
+#define HALFTONING_NONE             (0)
+#define HALFTONING_ERROR_DIFFUSION  (1)
+#define HALFTONING_PANDA            (2)
+#define HALFTONING_SUPER_CIRCLE     (3)
+#define HALFTONING_LAST             (3)
+   
+/*
+ * color table encoding
+ */
+#define COLOR_ENCODING_RGB   (0)
+#define COLOR_ENCODING_LAST  (0)
+
+/*****************************************************************************
+*
+* Structures.
+*/
+   
+/*
+ * Bitmapfileheader defines a single bitmap image.  Its analogue in the
+ * Windows SDK is the Bitmapfileheader.  Its analogues in the OS/2 Toolkit are
+ * the Bitmapfileheader and Bitmapfileheader2 structures.
+ *
+ * A BITMAPHEADER structure is always concatenated to the end of a
+ * Bitmapfileheader structure.
+ */
+typedef struct Bitmapfileheader
+{
+    CGAL_UINT16    type;
+    CGAL_UINT32    size;
+    CGAL_INT16     xHotspot;
+    CGAL_INT16     yHotspot;
+    CGAL_UINT32    offsetToBits;
+} Bitmapfileheader;
+
+
+/*
+ * BITMAPARRAYHEADER is used to establish a linked list of Bitmapfileheader
+ * structures for a bitmap file with multiple images in it.  There is no
+ * equivalent structure in the Windows SDK.  Its analogues in the OS/2 toolkit
+ * are the BITMAPARRAYFILEHEADER and BITMAPARRAYFILEHEADER2 strucutres.
+ *
+ * A Bitmapfileheader structure is always concatenated to the end of a
+ * BITMAPARRAYHEADER structure.
+ */
+typedef struct BITMAPARRAYHEADER
+{
+    CGAL_UINT16    type;
+    CGAL_UINT32    size;
+    CGAL_UINT32    next;
+    CGAL_UINT16    screenWidth;
+    CGAL_UINT16    screenHeight;
+} BITMAPARRAYHEADER;
+   
+
+/*
+ * BITMAPHEADER defines the properties of a bitmap.  Its analogues in the
+ * Windows SDK are the BITMAPCOREINFOHEADER and BITMAPINFOHEADER structures.
+ * Its analogues in the OS/2 Toolkit are the BITMAPINFOHEADER and
+ * BITMAPINFOHEADER2 structures.
+ *
+ * A color table is concatenated to this structure.  The number of elements in
+ * the color table determined by the bit-depth of the image.
+ *
+ * Note, that if the field "size" is 12 or less, then the width and height
+ * fields should be read as CGAL_UINT16's instead of CGAL_UINT32's.
+ *
+ * Also note that if the field "size" is greater than 12, then the color table
+ * will have an extra byte of padding between each structures (to longword
+ * align it)
+ *
+ * The different sizes for the width, height, and color table are the only
+ * differences between the "old" and "new" bitmap file formats.
+ */
+typedef struct BITMAPHEADER
+{
+    CGAL_UINT32 size;
+    CGAL_INT32  width;
+    CGAL_INT32  height;
+    CGAL_UINT16 numBitPlanes;
+    CGAL_UINT16 numBitsPerPlane;
+    CGAL_UINT32 compressionScheme;
+    CGAL_UINT32 sizeOfImageData;
+    CGAL_UINT32 xResolution;
+    CGAL_UINT32 yResolution;
+    CGAL_UINT32 numColorsUsed;
+    CGAL_UINT32 numImportantColors;
+    CGAL_UINT16 resolutionUnits;
+    CGAL_UINT16 padding;
+    CGAL_UINT16 origin;
+    CGAL_UINT16 halftoning;
+    CGAL_UINT32 halftoningParam1;
+    CGAL_UINT32 halftoningParam2;
+    CGAL_UINT32 colorEncoding;
+    CGAL_UINT32 identifier;
+} BITMAPHEADER;
+
+
+/*
+ * RGB defines a single color palette entry.  Its analogues in the Windows SDK
+ * are the RGBTRIPLE and RGBQUAD structures.  Its analogues in the OS/2
+ * Toolkit are the RGB and RGB2 structure. 
+ */
+typedef struct RGB
+{
+    CGAL_UINT8 blue;
+    CGAL_UINT8 green;
+    CGAL_UINT8 red;
+} RGB;
+
+#endif   /* __BMPTYPES_H_INCLUDED__ */
+
+/*
+ * Formatting information for emacs in c-mode
+ *
+ * Local Variables:
+ * c-indent-level:4
+ * c-continued-statement-offset:4
+ * c-brace-offset:-4
+ * c-brace-imaginary-offset:0
+ * c-argdecl-indent:4
+ * c-label-offset:-4
+ * End:
+ */
diff --git a/3rdparty/CGAL/include/CGAL/ImageIO/convert.h b/3rdparty/CGAL/include/CGAL/ImageIO/convert.h
new file mode 100644
index 0000000..8902dea
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/ImageIO/convert.h
@@ -0,0 +1,108 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+/*************************************************************************
+ * convert.h - conversion between types
+ *
+ * $Id$
+ *
+ * Copyright©INRIA 1998
+ *
+ * AUTHOR:
+ * Gregoire Malandain (greg at sophia.inria.fr)
+ * http://www.inria.fr/epidaure/personnel/malandain/
+ * 
+ * CREATION DATE: 
+ * June, 9 1998
+ *
+ * ADDITIONS, CHANGES
+ *
+ */
+
+#ifndef _convert_h_
+#define _convert_h_
+
+
+
+
+
+
+
+#include <stdio.h> /* memcpy */
+#include <string.h> /* memcpy */
+#include <CGAL/ImageIO/typedefs.h>
+
+
+
+
+
+
+/* Converts buffers from one type into another.
+ *
+ * DESCRIPTION:
+ *
+ * Conversions from types DOUBLE or FLOAT to 
+ * others types are all implemented. I hope
+ * I do not make mistakes.
+ *
+ * - When a real value is converted into an integer
+ *   one, we take the nearest integer, i.e.
+ *   (int)(real value - 0.5) for negative
+ *   numbers, and (int)(real value + 0.5) for 
+ *   positive ones.
+ *
+ * - Some conversions are not yet implemented.
+ *
+ * - When types and pointers are equal, nothing is
+ *   done.
+ */
+extern void ConvertBuffer( void *bufferIn, /* buffer to be converted */
+			   bufferType typeIn, /* type of this buffer */
+			   void *bufferOut, /* result buffer */
+			   bufferType typeOut, /* type of this buffer */
+			   int bufferLength /* buffers' length */
+			   );
+
+extern void Convert_r32_to_s8( r32 *theBuf,
+			       s8 *resBuf,
+			       int size );
+
+extern void Convert_r32_to_u8( r32 *theBuf,
+			       u8 *resBuf,
+			       int size );
+
+extern void Convert_r32_to_s16( r32 *theBuf,
+				s16 *resBuf,
+				int size );
+
+extern void Convert_r32_to_u16( r32 *theBuf,
+				u16 *resBuf,
+				int size );
+
+
+
+
+
+#ifdef CGAL_HEADER_ONLY
+#include <CGAL/ImageIO/convert_impl.h>
+#endif // CGAL_HEADER_ONLY
+
+#endif
diff --git a/3rdparty/CGAL/include/CGAL/ImageIO/convert_impl.h b/3rdparty/CGAL/include/CGAL/ImageIO/convert_impl.h
new file mode 100644
index 0000000..5e0539e
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/ImageIO/convert_impl.h
@@ -0,0 +1,490 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+/*************************************************************************
+ * convert.c - conversion between types
+ *
+ * $Id$
+ *
+ * Copyright©INRIA 1999
+ *
+ * AUTHOR:
+ * Gregoire Malandain (greg at sophia.inria.fr)
+ * 
+ * CREATION DATE: 
+ * June, 9 1998
+ *
+ * ADDITIONS, CHANGES
+ *
+ * - Tue Feb 22 11:25:39 MET 2000 (G. Malandain)
+ *   add in ConvertBuffer():
+ *       USHORT to UCHAR
+ *       USHORT to SHORT
+ *
+ */
+
+#ifdef CGAL_HEADER_ONLY
+#define CGAL_INLINE_FUNCTION inline
+#else
+#define CGAL_INLINE_FUNCTION
+#endif
+
+CGAL_INLINE_FUNCTION
+void ConvertBuffer( void *bufferIn,
+		    bufferType typeIn,
+		    void *bufferOut,
+		    bufferType typeOut,
+		    int bufferLength )
+{
+  const char *proc = "ConvertBuffer";
+  int i;
+  u8 *u8buf;
+  s8 *s8buf;
+  u16 *u16buf;
+  s16 *s16buf;
+  s32 *s32buf;
+  r32 *r32buf;
+  r64 *r64buf;
+
+  if ( (typeOut == typeIn) && (bufferOut == bufferIn) )
+    return;
+
+  if ( bufferLength <= 0 ) {
+    fprintf( stderr, " Fatal error in %s: buffer length is negative or zero.\n", 
+	     proc );
+    return;
+  }
+  if ( (bufferIn == (void*)NULL) || (bufferOut == (void*)NULL) ) {
+    fprintf( stderr, " Fatal error in %s: NULL buffer(s).\n", 
+	     proc );
+    return;
+  }
+  
+  switch ( typeOut ) {
+  case CGAL_SCHAR : {
+    s8buf = (s8*)bufferOut;
+    s8 min = -128, max = 127;
+    switch( typeIn ) {
+    case CGAL_SCHAR :
+      if ( bufferOut == bufferIn ) return;
+      (void)memcpy( bufferOut, bufferIn, bufferLength * sizeof(s8) );
+      break;
+    case CGAL_FLOAT :
+      r32buf = (r32*)bufferIn;
+      for (i=bufferLength; i>0; i--, s8buf++, r32buf++ ) {
+	if ( *r32buf < min ) *s8buf = min;
+	else if ( *r32buf < 0.0 ) *s8buf = (s8)(*r32buf - 0.5);
+	else if ( *r32buf < max ) *s8buf = (s8)(*r32buf + 0.5);
+	else *s8buf = max;
+      }
+      break;
+    case CGAL_DOUBLE :
+      r64buf = (r64*)bufferIn;
+      for (i=bufferLength; i>0; i--, s8buf++, r64buf++ ) {
+	if ( *r64buf < min ) *s8buf = min;
+	else if ( *r64buf < 0.0 ) *s8buf = (s8)(*r64buf - 0.5);
+	else if ( *r64buf < max ) *s8buf = (s8)(*r64buf + 0.5);
+	else *s8buf = max;
+      }
+      break;
+    default :
+      fprintf( stderr, " Error in %s: such conversion not yet implemented.\n", 
+	       proc );
+      return;
+    }
+    break; /* end case typeOut = CGAL_SCHAR */
+  }
+
+
+
+    
+  case CGAL_UCHAR : {
+    u8buf = (u8*)bufferOut;
+    u8 min = 0, max = 255;
+    switch( typeIn ) {
+    case CGAL_UCHAR :
+      if ( bufferOut == bufferIn ) return;
+      (void)memcpy( bufferOut, bufferIn, bufferLength * sizeof(u8) );
+      break;
+    case CGAL_USHORT :
+      u16buf = (u16*)bufferIn;
+      for (i=bufferLength; i>0; i--, u8buf++, u16buf++ ) {
+	if ( *u16buf < max ) *u8buf = (u8)*u16buf;
+	else *u8buf = max;
+      }
+      break;
+    case CGAL_FLOAT :
+      r32buf = (r32*)bufferIn;
+      for (i=bufferLength; i>0; i--, u8buf++, r32buf++ ) {
+	if ( *r32buf < min ) *u8buf = min;
+	else if ( *r32buf < max ) *u8buf = (u8)(*r32buf + 0.5);
+	else *u8buf = max;
+      }
+      break;
+    case CGAL_DOUBLE :
+      r64buf = (r64*)bufferIn;
+      for (i=bufferLength; i>0; i--, u8buf++, r64buf++ ) {
+	if ( *r64buf < min ) *u8buf = min;
+	else if ( *r64buf < max ) *u8buf = (u8)(*r64buf + 0.5);
+	else *u8buf = max;
+      }
+      break;
+    default :
+      fprintf( stderr, " Error in %s: such conversion not yet implemented.\n", 
+	       proc );
+      return;
+    }
+    break; /* end case typeOut = CGAL_UCHAR */
+  }
+
+
+
+
+    
+  case CGAL_SSHORT : {
+    s16buf = (s16*)bufferOut;
+    s16 min = -32768, max = 32767;
+    switch( typeIn ) {
+    case CGAL_SSHORT :
+      if ( bufferOut == bufferIn ) return;
+      (void)memcpy( bufferOut, bufferIn, bufferLength * sizeof(s16) );
+      break;
+    case CGAL_USHORT :
+      u16buf = (u16*)bufferIn;
+      for (i=bufferLength; i>0; i--, s16buf++, u16buf++ ) {
+	if ( *u16buf < max ) *s16buf = (s16)*u16buf;
+	else *s16buf = max;
+      }
+      break;
+    case CGAL_FLOAT :
+      r32buf = (r32*)bufferIn;
+      for (i=bufferLength; i>0; i--, s16buf++, r32buf++ ) {
+	if ( *r32buf < min ) *s16buf = min;
+	else if ( *r32buf < 0.0 ) *s16buf = (s16)(*r32buf - 0.5);
+	else if ( *r32buf < max ) *s16buf = (s16)(*r32buf + 0.5);
+	else *s16buf = max;
+      }
+      break;
+    case CGAL_DOUBLE :
+      r64buf = (r64*)bufferIn;
+      for (i=bufferLength; i>0; i--, s16buf++, r64buf++ ) {
+	if ( *r64buf < min ) *s16buf = min;
+	else if ( *r64buf < 0.0 ) *s16buf = (s16)(*r64buf - 0.5);
+	else if ( *r64buf < max ) *s16buf = (s16)(*r64buf + 0.5);
+	else *s16buf = max;
+      }
+      break;
+    default :
+      fprintf( stderr, " Error in %s: such conversion not yet implemented.\n",
+	       proc );
+      return;
+    }
+    break; /* end case typeOut = CGAL_SSHORT */
+  }
+
+
+
+    
+  case CGAL_USHORT : {
+    u16buf = (u16*)bufferOut;
+    u16 min = 0, max = 65535;
+    switch( typeIn ) {
+    case CGAL_USHORT :
+      if ( bufferOut == bufferIn ) return;
+      (void)memcpy( bufferOut, bufferIn, bufferLength * sizeof(u16) );
+      break;
+    case CGAL_FLOAT :
+      r32buf = (r32*)bufferIn;
+      for (i=bufferLength; i>0; i--, u16buf++, r32buf++ ) {
+	if ( *r32buf < min ) *u16buf = min;
+	else if ( *r32buf < 0.0 ) *u16buf = (u16)(*r32buf - 0.5);
+	else if ( *r32buf < max ) *u16buf = (u16)(*r32buf + 0.5);
+	else *u16buf = max;
+      }
+      break;
+    case CGAL_DOUBLE :
+      r64buf = (r64*)bufferIn;
+      for (i=bufferLength; i>0; i--, u16buf++, r64buf++ ) {
+	if ( *r64buf < min ) *u16buf = min;
+	else if ( *r64buf < 0.0 ) *u16buf = (u16)(*r64buf - 0.5);
+	else if ( *r64buf < max ) *u16buf = (u16)(*r64buf + 0.5);
+	else *u16buf = max;
+      }
+      break;
+    default :
+      fprintf( stderr, " Error in %s: such conversion not yet implemented.\n",
+	       proc );
+      return;
+    }
+    break; /* end case typeOut = CGAL_USHORT */
+  }
+
+
+
+
+    
+  case CGAL_INT :
+    s32buf = (s32*)bufferOut;
+    switch( typeIn ) {
+    case CGAL_INT :
+      if ( bufferOut == bufferIn ) return;
+      (void)memcpy( bufferOut, bufferIn, bufferLength * sizeof(s32) );
+      break;
+    case CGAL_FLOAT :
+      r32buf = (r32*)bufferIn;
+      for (i=bufferLength; i>0; i--, s32buf++, r32buf++ ) {
+	*s32buf = (int)(*r32buf);
+      }
+      break;
+    case CGAL_DOUBLE :
+      r64buf = (r64*)bufferIn;
+      for (i=bufferLength; i>0; i--, s32buf++, r64buf++ ) {
+	*s32buf = (int)(*r64buf);
+      }
+      break;
+    default :
+      fprintf( stderr, " Error in %s: such conversion not yet implemented.\n",
+	       proc );
+      return;
+    }
+    break; /* end case typeOut = CGAL_INT */
+
+
+
+
+
+    
+  case CGAL_FLOAT :
+    r32buf = (r32*)bufferOut;
+    switch( typeIn ) {
+    case CGAL_UCHAR :
+      u8buf = (u8*)bufferIn;
+      for (i=bufferLength; i>0; i--, r32buf++, u8buf++ ) {
+	*r32buf = (float)(*u8buf);
+      }
+      break;
+    case CGAL_SCHAR :
+      s8buf = (s8*)bufferIn;
+      for (i=bufferLength; i>0; i--, r32buf++, s8buf++ ) {
+	*r32buf = (float)(*s8buf);
+      }
+      break;
+    case CGAL_USHORT :
+      u16buf = (u16*)bufferIn;
+      for (i=bufferLength; i>0; i--, r32buf++, u16buf++ ) {
+	*r32buf = (float)(*u16buf);
+      }
+      break;
+    case CGAL_SSHORT :
+      s16buf = (s16*)bufferIn;
+      for (i=bufferLength; i>0; i--, r32buf++, s16buf++ ) {
+	*r32buf = (float)(*s16buf);
+      }
+      break;
+    case CGAL_INT :
+      s32buf = (s32*)bufferIn;
+      for (i=bufferLength; i>0; i--, r32buf++, s32buf++ ) {
+	*r32buf = (float)(*s32buf);
+      }
+      break;
+    case CGAL_FLOAT :
+      if ( bufferOut == bufferIn ) return;
+      (void)memcpy( bufferOut, bufferIn, bufferLength * sizeof(r32) );
+      break;
+    case CGAL_DOUBLE :
+      r64buf = (r64*)bufferIn;
+      for (i=bufferLength; i>0; i--, r32buf++, r64buf++ ) {
+	*r32buf = (float)(*r64buf);
+      }
+      break;
+    default :
+      fprintf( stderr, " Error in %s: such conversion not yet implemented.\n",
+	       proc );
+      return;
+    }
+    break; /* end case typeOut = CGAL_FLOAT */
+
+
+
+
+    
+  case CGAL_DOUBLE :
+    r64buf = (r64*)bufferOut;
+    switch( typeIn ) {
+    case CGAL_UCHAR :
+      u8buf = (u8*)bufferIn;
+      for (i=bufferLength; i>0; i--, r64buf++, u8buf++ ) {
+	*r64buf = (double)(*u8buf);
+      }
+      break;
+    case CGAL_SCHAR :
+      s8buf = (s8*)bufferIn;
+      for (i=bufferLength; i>0; i--, r64buf++, s8buf++ ) {
+	*r64buf = (double)(*s8buf);
+      }
+      break;
+    case CGAL_USHORT :
+      u16buf = (u16*)bufferIn;
+      for (i=bufferLength; i>0; i--, r64buf++, u16buf++ ) {
+	*r64buf = (double)(*u16buf);
+      }
+      break;
+    case CGAL_SSHORT :
+      s16buf = (s16*)bufferIn;
+      for (i=bufferLength; i>0; i--, r64buf++, s16buf++ ) {
+	*r64buf = (double)(*s16buf);
+      }
+      break;
+    case CGAL_INT :
+      s32buf = (s32*)bufferIn;
+      for (i=bufferLength; i>0; i--, r64buf++, s32buf++ ) {
+	*r64buf = (double)(*s32buf);
+      }
+      break;
+    case CGAL_FLOAT :
+      r32buf = (r32*)bufferIn;
+      for (i=bufferLength; i>0; i--, r32buf++, r64buf++ ) {
+	*r64buf = (double)(*r32buf);
+      }
+      break;
+    case CGAL_DOUBLE :
+      if ( bufferOut == bufferIn ) return;
+      (void)memcpy( bufferOut, bufferIn, bufferLength * sizeof(r64) );
+      break;
+    default :
+      fprintf( stderr, " Error in %s: such conversion not yet implemented.\n", 
+	       proc );
+      return;
+    }
+    break; /* end case typeOut = CGAL_DOUBLE */
+
+
+
+   
+  default :
+    fprintf( stderr, " Error in %s: such output type not yet handled.\n",
+	     proc );
+    return;
+  }
+}
+
+
+
+
+
+CGAL_INLINE_FUNCTION
+void Convert_r32_to_s8( r32 *theBuf,
+			s8 *resBuf,
+			int size )
+{
+  int i;
+  r32* tb = theBuf;
+  s8* rb = resBuf;
+  
+  for ( i=0; i<size; i++, tb++, rb++ ) {
+    if ( *tb < -128.0 ) {
+      *rb = -128;
+    } else if ( *tb < 0.0 ) {
+      *rb = (s8)(*tb - 0.5);
+    } else if ( *tb < 127.0 ) {
+      *rb = (s8)(*tb + 0.5);
+    } else {
+      *rb = 127;
+    }
+  }
+}
+
+
+
+
+
+CGAL_INLINE_FUNCTION
+void Convert_r32_to_u8( r32 *theBuf,
+			u8 *resBuf,
+			int size )
+{
+  int i;
+  r32* tb = theBuf;
+  u8* rb = resBuf;
+  
+  for ( i=0; i<size; i++, tb++, rb++ ) {
+    if ( *tb < 0.0 ) {
+      *rb = 0;
+    } else if ( *tb < 255.0 ) {
+      *rb = (u8)(*tb + 0.5);
+    } else {
+      *rb = 255;
+    }
+  }
+}
+
+
+
+
+
+CGAL_INLINE_FUNCTION
+void Convert_r32_to_s16( r32 *theBuf,
+			 s16 *resBuf,
+			 int size )
+{
+  int i;
+  r32* tb = theBuf;
+  s16* rb = resBuf;
+  
+  for ( i=0; i<size; i++, tb++, rb++ ) {
+    if ( *tb < -32768.0 ) {
+      *rb = -32768;
+    } else if ( *tb < 0.0 ) {
+      *rb = (s16)(*tb - 0.5);
+    } else if ( *tb < 32767.0 ) {
+      *rb = (s16)(*tb + 0.5);
+    } else {
+      *rb = 32767;
+    }
+  }
+}
+
+
+
+
+
+CGAL_INLINE_FUNCTION
+void Convert_r32_to_u16( r32 *theBuf,
+			 u16 *resBuf,
+			 int size )
+{
+  int i;
+  r32* tb = theBuf;
+  u16* rb = resBuf;
+  
+  for ( i=0; i<size; i++, tb++, rb++ ) {
+    if ( *tb < 0.0 ) {
+      *rb = 0;
+    } else if ( *tb < 65535.0 ) {
+      *rb = (u16)(*tb + 0.5);
+    } else {
+      *rb = 65535;
+    }
+  }
+}
+
+
+      
diff --git a/3rdparty/CGAL/include/CGAL/ImageIO/fgetns.h b/3rdparty/CGAL/include/CGAL/ImageIO/fgetns.h
new file mode 100644
index 0000000..e7b7552
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/ImageIO/fgetns.h
@@ -0,0 +1,35 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+#ifndef FGETNS_H
+#define FGETNS_H
+
+#include <CGAL/ImageIO.h>
+
+/* get a string from a file and discard the ending newline character
+   if any */
+char *fgetns(char *str, int n,  _image *im );
+
+#ifdef CGAL_HEADER_ONLY
+#include <CGAL/ImageIO/fgetns_impl.h>
+#endif // CGAL_HEADER_ONLY
+
+#endif // FGETNS_H
diff --git a/3rdparty/CGAL/include/CGAL/ImageIO/fgetns_impl.h b/3rdparty/CGAL/include/CGAL/ImageIO/fgetns_impl.h
new file mode 100644
index 0000000..5a10ea8
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/ImageIO/fgetns_impl.h
@@ -0,0 +1,43 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+#ifdef CGAL_HEADER_ONLY
+#define CGAL_INLINE_FUNCTION inline
+#else
+#define CGAL_INLINE_FUNCTION
+#endif
+
+#include <string.h>
+
+/* get a string from a file and discard the ending newline character
+   if any */
+CGAL_INLINE_FUNCTION
+char *fgetns(char *str, int n,  _image *im ) {
+
+  memset( str, 0, n );
+  char* ret = ImageIO_gets( im, str, n );
+
+  if(!ret) return NULL;
+
+  std::size_t l = strlen(str);
+  if(l > 0 && str[l-1] == '\n') str[l-1] = '\0';
+  return ret;
+}
diff --git a/3rdparty/CGAL/include/CGAL/ImageIO/gif.h b/3rdparty/CGAL/include/CGAL/ImageIO/gif.h
new file mode 100644
index 0000000..2c0914f
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/ImageIO/gif.h
@@ -0,0 +1,38 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+#ifndef GIF_H
+#define GIF_H
+
+
+#include <stdio.h>
+#include <CGAL/ImageIO.h>
+int readGifImage(const char *name,_image *im);
+
+int testGifHeader(char *magic,const char *name);
+/** creates an return the file format structure associated with the Gif file format */
+PTRIMAGE_FORMAT createGifFormat();
+
+#ifdef CGAL_HEADER_ONLY
+#include <CGAL/ImageIO/gif_impl.h>
+#endif // CGAL_HEADER_ONLY
+
+#endif
diff --git a/3rdparty/CGAL/include/CGAL/ImageIO/gif_impl.h b/3rdparty/CGAL/include/CGAL/ImageIO/gif_impl.h
new file mode 100644
index 0000000..2ecee99
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/ImageIO/gif_impl.h
@@ -0,0 +1,700 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+#ifdef CGAL_HEADER_ONLY
+#define CGAL_INLINE_FUNCTION inline
+#else
+#define CGAL_INLINE_FUNCTION
+#endif
+
+#include <string.h>
+
+#ifdef WIN32
+#include <io.h>
+#endif
+
+#ifdef CGAL_HEADER_ONLY
+  
+  #define CGAL_GLOBAL_STATE_VAR(TYPE, NAME, VALUE)  \
+    inline TYPE & get_static_##NAME()               \
+    {                                               \
+      static TYPE NAME = VALUE;                     \
+      return NAME;                                  \
+    }
+  
+#else // CGAL_HEADER_ONLY
+
+  #define CGAL_GLOBAL_STATE_VAR(TYPE, NAME, VALUE)  \
+    TYPE NAME;                                      \
+    inline TYPE& get_static_##NAME()                \
+    {                                               \
+      return NAME;                                  \
+    }
+
+#endif // CGAL_HEADER_ONLY
+
+
+/** Magic header for GIF files */
+#define GIF_MAGIC "GIF8"
+
+
+
+typedef unsigned char byte;
+#define TRUE 1
+#define FALSE 0
+
+#define NEXTBYTE      (*ptr++)
+#define EXTENSION     0x21
+#define IMAGESEP      0x2c
+#define TRAILER       0x3b
+#define INTERLACEMASK 0x40
+#define COLORMAPMASK  0x80
+
+
+#define DEBUG 0
+
+//FILE *fp;
+//int   gif89 = 0;
+static const char *id87 = "GIF87a";
+static const char *id89 = "GIF89a";
+
+static int EGApalette[16][3] = {
+  {0,0,0},       {0,0,128},     {0,128,0},     {0,128,128}, 
+  {128,0,0},     {128,0,128},   {128,128,0},   {200,200,200},
+  {100,100,100}, {100,100,255}, {100,255,100}, {100,255,255},
+  {255,100,100}, {255,100,255}, {255,255,100}, {255,255,255} };
+  
+
+static int  ReadCode();
+static void DoInterlace(byte);
+static int GifError(const char *);
+
+CGAL_GLOBAL_STATE_VAR(byte *, Raster, NULL) /* The raster data stream, unblocked */
+CGAL_GLOBAL_STATE_VAR(byte *, RawGIF, NULL)
+CGAL_GLOBAL_STATE_VAR(byte *, r, NULL)
+CGAL_GLOBAL_STATE_VAR(byte *, g, NULL)
+CGAL_GLOBAL_STATE_VAR(byte *, b, NULL)     /* The colormap */
+CGAL_GLOBAL_STATE_VAR(int, BitOffset, 0)    /* Bit Offset of next code */
+CGAL_GLOBAL_STATE_VAR(int, XC, 0)
+CGAL_GLOBAL_STATE_VAR(int, YC, 0)	    /* Output X and Y coords of current pixel */
+CGAL_GLOBAL_STATE_VAR(int, CodeSize, 0)	    /* Code size, read from GIF header */
+CGAL_GLOBAL_STATE_VAR(int, ReadMask, 0)     /* Code AND mask for current code size */
+CGAL_GLOBAL_STATE_VAR(int, Pass, 0)	    /* Used by output routine if interlaced pic */
+CGAL_GLOBAL_STATE_VAR(int, Width, 0)
+CGAL_GLOBAL_STATE_VAR(int, Height, 0)       /* image dimensions */
+CGAL_GLOBAL_STATE_VAR(unsigned char *, org, NULL)
+CGAL_GLOBAL_STATE_VAR(unsigned char *, buf, NULL)
+
+CGAL_INLINE_FUNCTION
+int testGifHeader(char *magic,const char *) {
+  if (!strcmp(magic, GIF_MAGIC))
+    return 0;
+  else 
+    return -1;
+}
+CGAL_INLINE_FUNCTION
+PTRIMAGE_FORMAT createGifFormat() {
+  PTRIMAGE_FORMAT f=(PTRIMAGE_FORMAT) ImageIO_alloc(sizeof(IMAGE_FORMAT));
+
+  f->testImageFormat=&testGifHeader;
+  f->readImageHeader=&readGifImage;
+  f->writeImage=0;
+  strcpy(f->fileExtension,".gif");
+  strcpy(f->realName,"Gif");
+  return f;
+}
+
+CGAL_INLINE_FUNCTION
+void use(int) {} // warning killer
+
+/*****************************/
+CGAL_INLINE_FUNCTION
+int readGifImage(const char *name,_image *im) {
+FILE *fp;
+int   gif89 = 0;
+
+  byte ch, ch1;
+  byte *ptr, *ptr1;
+  int i, block;
+  int npixels, maxpixels, aspect;
+  float normaspect;
+  int OutCount = 0,		/* Decompressor output 'stack count' */
+    RWidth, RHeight,		/* screen dimensions */
+    /*LeftOfs, TopOfs,		 image offset */
+    BitsPerPixel,		/* Bits per pixel, read from GIF header */
+    ColorMapSize,		/* number of colors */
+    Background,		         /* background color */
+    InitCodeSize,		/* Starting code size, used during Clear */
+    Code,			/* Value returned by ReadCode */
+    MaxCode,			/* limiting value for current code size */
+    ClearCode,			/* GIF clear code */
+    EOFCode,			/* GIF end-of-information code */
+    CurCode, OldCode=0, InCode,	/* Decompressor variables */
+    FirstFree,			/* First free code, generated per GIF spec */
+    FreeCode,			/* Decompressor,next free slot in hash table */
+    FinChar=0,			/* Decompressor variable */
+    BitMask,			/* AND mask for data size */
+    Misc;                       /* miscellaneous bits (interlace, local cmap)*/
+  int Interlace, HasColormap;
+  /* not used
+   */
+  /* char header[10]; */
+
+  /* The hash table used by the decompressor */
+  int Prefix[4096];
+  int Suffix[4096];
+  /* An output array used by the decompressor */
+  int OutCode[4097];
+
+  /* initialize variables */
+  get_static_BitOffset() =
+    get_static_XC() =
+    get_static_YC() =
+    get_static_Pass() =
+    OutCount =
+    npixels =
+    maxpixels = 0;
+  get_static_RawGIF() = get_static_Raster() = NULL;
+  gif89 = 0;
+
+#ifdef WIN32
+ fp = fopen(name,"rb");
+#else
+  fp = fopen(name,"r");
+#endif
+  fp = fopen(name,"rb");
+  if (!fp) {
+    return(GifError("could not open a GIF file"));
+  }
+  /* find the size of the file */
+  fseek(fp, 0L, 2);
+  long filesize = ftell(fp);
+  fseek(fp, 0L, 0);
+
+ /* the +256's are so we can read truncated GIF files without fear of 
+     segmentation violation */
+  if (!(ptr = get_static_RawGIF() = (byte *) ImageIO_alloc(filesize+256)))
+    return( GifError("not enough memory to read gif file") );
+  
+  if (!(get_static_Raster() = (byte *) ImageIO_alloc(filesize+256)))    
+    return( GifError("not enough memory to read gif file") );
+  
+  if (fread(ptr, filesize, 1, fp) != 1)
+    return( GifError("GIF data read failed") );
+   if      (strncmp((char *) ptr, id87, 6)==0) gif89 = 0;
+  else if (strncmp((char *) ptr, id89, 6)==0) gif89 = 1;
+  else    return( GifError("not a GIF file"));
+  
+  ptr += 6;
+ /* Get variables from the GIF screen descriptor */
+  
+  ch = NEXTBYTE;
+  RWidth = ch + 0x100 * NEXTBYTE;	/* screen dimensions... not used. */
+  ch = NEXTBYTE;
+  RHeight = ch + 0x100 * NEXTBYTE;
+  use(RWidth);
+  use(RHeight);
+  
+  ch = NEXTBYTE;
+  HasColormap = ((ch & COLORMAPMASK) ? TRUE : FALSE);
+  
+  BitsPerPixel = (ch & 7) + 1;
+  ColorMapSize = 1 << BitsPerPixel;
+  BitMask = ColorMapSize - 1;
+  
+  Background = NEXTBYTE;		/* background color... not used. */
+  use(Background);
+
+
+  aspect = NEXTBYTE;
+  if (aspect) {
+    if (!gif89) return(GifError("corrupt GIF file (screen descriptor)"));
+    else normaspect = (float) (aspect + 15) / 64.0f;   /* gif89 aspect ratio */
+    if (DEBUG) fprintf(stderr,"GIF89 aspect = %f\n", normaspect);
+  }
+
+
+  /* Read in global colormap. */
+  if (HasColormap)
+    {
+      get_static_r() = (byte *) ImageIO_alloc(ColorMapSize * sizeof(byte));
+      get_static_g() = (byte *) ImageIO_alloc(ColorMapSize * sizeof(byte));
+      get_static_b() = (byte *) ImageIO_alloc(ColorMapSize * sizeof(byte));
+
+      for (i = 0; i < ColorMapSize; i++) {
+	get_static_r()[i] = NEXTBYTE;
+	get_static_g()[i] = NEXTBYTE;
+        get_static_b()[i] = NEXTBYTE;
+      }
+    }
+  else {
+    /* no colormap in GIF file */
+    /* put std EGA palette (repeated 16 times) into colormap, for lack of
+       anything better to do */
+    ColorMapSize = 256;
+    get_static_r() = (byte *) ImageIO_alloc(256 * sizeof(byte));
+    get_static_g() = (byte *) ImageIO_alloc(256 * sizeof(byte));
+    get_static_b() = (byte *) ImageIO_alloc(256 * sizeof(byte));
+   
+    for (i = 0; i < 256; i++) {
+      get_static_r()[i] = byte(EGApalette[i&15][0]);
+      get_static_g()[i] = byte(EGApalette[i&15][1]);
+      get_static_b()[i] = byte(EGApalette[i&15][2]);
+    }
+  }
+
+  /* possible things at this point are:
+   *   an application extension block
+   *   a comment extension block
+   *   an (optional) graphic control extension block
+   *       followed by either an image
+   *	   or a plaintext extension
+   */
+  while (1) {
+    block = NEXTBYTE;
+   
+    if (block == EXTENSION) {  /* parse extension blocks */
+      int i, fn, blocksize, aspnum, aspden;
+	  
+      /* read extension block */
+      fn = NEXTBYTE;
+	  
+      if (DEBUG) fprintf(stderr,"GIF extension type 0x%02x\n", fn);
+	  
+      if (fn == 'R') {                  /* GIF87 aspect extension */
+	blocksize = NEXTBYTE;
+	if (blocksize == 2) {
+	  aspnum = NEXTBYTE;
+	  aspden = NEXTBYTE;
+	  if (aspden>0 && aspnum>0) 
+	    normaspect = (float) aspnum / (float) aspden;
+	  else { normaspect = 1.0;  aspnum = aspden = 1; }
+			
+	  if (DEBUG) fprintf(stderr,"GIF87 aspect extension: %d:%d = %f\n\n", 
+			     aspnum, aspden,normaspect);
+	}
+	else {
+	  for (i=0; i<blocksize; i++) (void)NEXTBYTE;
+	}
+      }
+	  
+      else if (fn == 0xFE) {  /* Comment Extension.  just eat it */
+	int ch, j, sbsize;
+		 
+	if (DEBUG) fprintf(stderr,"Comment extension:  ");
+	/* read (and ignore) data sub-blocks */
+	do {
+	  j = 0;  sbsize = NEXTBYTE;
+	  while (j<sbsize) {
+	    ch = NEXTBYTE;  j++;
+	    if (DEBUG) fprintf(stderr,"%c", ch);
+	  }
+	} while (sbsize);
+	if (DEBUG) fprintf(stderr,"\n\n");
+      }
+	  
+      else if (fn == 0x01) {  /* PlainText Extension */
+	int j,sbsize,ch;
+	int tgLeft, tgTop, tgWidth, tgHeight, cWidth, cHeight, fg, bg;
+		 
+	/*	SetISTR(ISTR_WARNING, 
+		"PlainText extension found in GIF file.  Ignored.");*/
+		 
+	sbsize   = NEXTBYTE;
+	tgLeft   = NEXTBYTE;  tgLeft   += (NEXTBYTE)<<8;
+	tgTop    = NEXTBYTE;  tgTop    += (NEXTBYTE)<<8;
+	tgWidth  = NEXTBYTE;  tgWidth  += (NEXTBYTE)<<8;
+	tgHeight = NEXTBYTE;  tgHeight += (NEXTBYTE)<<8;
+	cWidth   = NEXTBYTE;
+	cHeight  = NEXTBYTE;
+	fg       = NEXTBYTE;
+	bg       = NEXTBYTE;
+	i=12;
+	for ( ; i<sbsize; i++) (void)NEXTBYTE;   /* read rest of first subblock */
+		 
+	if (DEBUG) fprintf(stderr,
+			   "PlainText: tgrid=%d,%d %dx%d  cell=%dx%d  col=%d,%d\n",
+			   tgLeft, tgTop, tgWidth, tgHeight, cWidth, cHeight,
+			   fg, bg);
+		 
+	/* read (and ignore) data sub-blocks */
+	do {
+	  j = 0;
+	  sbsize = NEXTBYTE;
+	  while (j<sbsize) {
+	    ch = NEXTBYTE;  j++;
+	    if (DEBUG) fprintf(stderr,"%c", ch);
+	  }
+	} while (sbsize);
+	if (DEBUG) fprintf(stderr,"\n\n");
+      }
+	  
+	  
+      else if (fn == 0xF9) {  /* Graphic Control Extension */
+	int j, sbsize;
+		 
+	if (DEBUG) fprintf(stderr,"Graphic Control extension\n\n");
+		 
+	/*	SetISTR(ISTR_WARNING, 
+		"Graphic Control Extension in GIF file.  Ignored.");*/
+		 
+	/* read (and ignore) data sub-blocks */
+	do {
+	  j = 0; sbsize = NEXTBYTE;
+	  while (j<sbsize) { (void)NEXTBYTE;  j++; }
+	} while (sbsize);
+      }
+      
+	  
+      else { /* unknown extension */
+	int j, sbsize;
+		 
+	if (DEBUG) fprintf(stderr,"unknown GIF extension 0x%02x\n\n", fn);
+		 
+	/*	SetISTR(ISTR_WARNING, 
+		"Unknown extension 0x%02x in GIF file.  Ignored.",fn);*/
+		 
+	/* read (and ignore) data sub-blocks */
+	do {
+	  j = 0; sbsize = NEXTBYTE;
+	  while (j<sbsize) { (void)NEXTBYTE;  j++; }
+	} while (sbsize);
+      }
+    }
+   
+    else if (block == IMAGESEP) break;   /* read an image */
+
+    else if (block == TRAILER) {
+      return( GifError("no image data found in GIF file") );
+    }
+   
+    else return (GifError("Unknown block type found in file."));
+  }
+
+
+  /* read in values from the image descriptor */
+  ch = NEXTBYTE;
+  /* LeftOfs = ch + 0x100 * NEXTBYTE;*/
+  ch = NEXTBYTE;
+  /* TopOfs = ch + 0x100 * NEXTBYTE; */
+  ch = NEXTBYTE;
+  ch = NEXTBYTE;
+  ch = NEXTBYTE;
+  get_static_Width() = ch + 0x100 * NEXTBYTE;
+  ch = NEXTBYTE;
+  get_static_Height() = ch + 0x100 * NEXTBYTE;
+
+  Misc = NEXTBYTE;
+  Interlace = ((Misc & INTERLACEMASK) ? TRUE : FALSE);
+
+  if (Misc & 0x80) {
+    for (i=0; i< 1 << ((Misc&7)+1); i++) {
+      get_static_r()[i] = NEXTBYTE;
+      get_static_g()[i] = NEXTBYTE;
+      get_static_b()[i] = NEXTBYTE;
+    }
+  }
+
+
+  if (!HasColormap && !(Misc&0x80)) {
+    /* no global or local colormap */
+    /*    SetISTR(ISTR_WARNING,
+	  "No colormap in this GIF file.  Assuming EGA colors.");*/
+  }
+
+
+
+  /* Start reading the raster data. First we get the intial code size
+   * and compute decompressor constant values, based on this code size.
+   */
+  
+  /*  SetISTR(ISTR_FORMAT, "GIF%s, %d bits per pixel, %sinterlaced.  (%d bytes)",
+      (gif89) ? "89" : "87", BitsPerPixel, 
+      Interlace ? "" : "non-", filesize);*/
+
+  get_static_CodeSize() = NEXTBYTE;
+
+  ClearCode = (1 << get_static_CodeSize());
+  EOFCode = ClearCode + 1;
+  FreeCode = FirstFree = ClearCode + 2;
+
+  /* The GIF spec has it that the code size is the code size used to
+   * compute the above values is the code size given in the file, but the
+   * code size used in compression/decompression is the code size given in
+   * the file plus one. (thus the ++).
+   */
+  get_static_CodeSize()++;
+  InitCodeSize = get_static_CodeSize();
+  MaxCode = (1 << get_static_CodeSize());
+  get_static_ReadMask() = MaxCode - 1;
+
+  /* UNBLOCK:
+   * Read the raster data.  Here we just transpose it from the GIF array
+   * to the Raster array, turning it from a series of blocks into one long
+   * data stream, which makes life much easier for ReadCode().
+   */
+  
+  ptr1 = get_static_Raster();
+  do {
+    ch = ch1 = NEXTBYTE;
+    while (ch--) { 
+		*ptr1 = NEXTBYTE; 
+		ptr1++; }
+    if ((ptr - get_static_RawGIF()) > filesize) {
+      /*      SetISTR(ISTR_WARNING,
+	      "This GIF file seems to be truncated.  Winging it.");*/
+      break;
+    }
+  } while(ch1);
+  ImageIO_free(get_static_RawGIF());  get_static_RawGIF() = NULL;
+
+
+  if (DEBUG) {
+    fprintf(stderr,"xv: LoadGIF() - picture is %dx%d, %d bits, %sinterlaced\n",
+	    get_static_Width(), get_static_Height(), BitsPerPixel, Interlace ? "" : "non-");
+  }
+  
+
+  /* Allocate the 'pic' */
+  maxpixels = get_static_Width()*get_static_Height();
+  im->xdim = get_static_Width();
+  im->ydim = get_static_Height();
+  im->zdim = 1;
+  im->vdim = 3;
+  im->wdim = 1;
+  im->wordKind = WK_FIXED;
+  im->sign = SGN_UNSIGNED;
+  im->data = ImageIO_alloc(get_static_Width() * get_static_Height() * 3);
+  get_static_org() = get_static_buf() = (unsigned char *) im->data;
+
+  if (!get_static_org())
+    return( GifError("not enough memory for image buffer") );
+
+
+  /* Decompress the file, continuing until you see the GIF EOF code.
+   * One obvious enhancement is to add checking for corrupt files here.
+   */
+  Code = ReadCode();
+  while (Code != EOFCode) {
+   /* Clear code sets everything back to its initial value, then reads the
+     * immediately subsequent code as uncompressed data.
+     */
+   
+	  if (Code == ClearCode) { 
+      get_static_CodeSize() = InitCodeSize;
+      MaxCode = (1 << get_static_CodeSize());
+      get_static_ReadMask() = MaxCode - 1;
+      FreeCode = FirstFree;
+      Code = ReadCode();
+      CurCode = OldCode = Code;
+      FinChar = CurCode & BitMask;
+      if (!Interlace) {
+	*get_static_buf()++ = get_static_r()[FinChar];
+	*get_static_buf()++ = get_static_g()[FinChar];
+	*get_static_buf()++ = get_static_b()[FinChar];
+      }
+      else DoInterlace((byte)FinChar);
+      npixels++;
+    }
+
+    else {
+      /* If not a clear code, must be data: save same as CurCode and InCode */
+	   
+      /* if we're at maxcode and didn't get a clear, stop loading */
+      if (FreeCode>=4096) { 
+		  printf("freecode blew up\n"); 
+	      break;
+	  }
+	   
+      CurCode = InCode = Code;
+	   
+      /* If greater or equal to FreeCode, not in the hash table yet;
+       * repeat the last character decoded
+       */
+	   
+      if (CurCode >= FreeCode) {
+	CurCode = OldCode;
+	if (OutCount > 4096) {   
+		printf("outcount1 blew up\n");  break; }
+	OutCode[OutCount++] = FinChar;
+      }
+	   
+      /* Unless this code is raw data, pursue the chain pointed to by CurCode
+       * through the hash table to its end; each code in the chain puts its
+       * associated output code on the output queue.
+       */
+	   
+      while (CurCode > BitMask) {
+		  if (OutCount > 4096) {
+			  fprintf(stderr,"outcount2 blew up\n"); break;}   /* corrupt file */
+	OutCode[OutCount++] = Suffix[CurCode];
+	CurCode = Prefix[CurCode];
+      }
+	   
+      if (OutCount > 4096) {  
+		  printf("outcount blew up\n");  break; }
+	   
+      /* The last code in the chain is treated as raw data. */
+	   
+      FinChar = CurCode & BitMask;
+      OutCode[OutCount++] = FinChar;
+	   
+      /* Now we put the data out to the Output routine.
+       * It's been stacked LIFO, so deal with it that way...
+       */
+
+      /* safety thing:  prevent exceeding range of 'pic' */
+      if (npixels + OutCount > maxpixels) OutCount = maxpixels-npixels;
+	   
+      npixels += OutCount;
+      if (!Interlace) for (i=OutCount-1; i>=0; i--) {
+          *get_static_buf()++ = get_static_r()[OutCode[i]];
+          *get_static_buf()++ = get_static_g()[OutCode[i]];
+          *get_static_buf()++ = get_static_b()[OutCode[i]];
+      }
+      else  for (i=OutCount-1; i>=0; i--) DoInterlace((byte)OutCode[i]);
+      OutCount = 0;
+	   
+      /* Build the hash table on-the-fly. No table is stored in the file. */
+      
+      Prefix[FreeCode] = OldCode;
+      Suffix[FreeCode] = FinChar;
+      OldCode = InCode;
+	   
+      /* Point to the next slot in the table.  If we exceed the current
+       * MaxCode value, increment the code size unless it's already 12.  If it
+       * is, do nothing: the next code decompressed better be CLEAR
+       */
+	   
+      FreeCode++;
+      if (FreeCode >= MaxCode) {
+	if (get_static_CodeSize() < 12) {
+	  get_static_CodeSize()++;
+	  MaxCode *= 2;
+	  get_static_ReadMask() = (1 << get_static_CodeSize()) - 1;
+	}
+      }
+    }
+    Code = ReadCode();
+    if (npixels >= maxpixels) break;
+  }
+  ImageIO_free(get_static_Raster());  get_static_Raster() = NULL;
+
+  if (npixels != maxpixels) {
+    /*    SetISTR(ISTR_WARNING,"This GIF file seems to be truncated.  Winging it.");*/
+    if (!Interlace)
+      memset(get_static_buf(), 0, 3*(maxpixels-npixels)); /* clear to EOBuffer */
+  }
+  /*  SetDirRButt(F_FORMAT, F_GIF);
+      SetDirRButt(F_COLORS, F_FULLCOLOR);*/
+  return 1;
+}
+
+
+/* Fetch the next code from the raster data stream.  The codes can be
+ * any length from 3 to 12 bits, packed into 8-bit bytes, so we have to
+ * maintain our location in the Raster array as a BIT Offset.  We compute
+ * the byte Offset into the raster array by dividing this by 8, pick up
+ * three bytes, compute the bit Offset into our 24-bit chunk, shift to
+ * bring the desired code to the bottom, then mask it off and return it. 
+ */
+
+CGAL_INLINE_FUNCTION
+static int ReadCode()
+{
+  int RawCode, ByteOffset;
+  
+  ByteOffset = get_static_BitOffset() / 8;
+  RawCode = get_static_Raster()[ByteOffset] + (get_static_Raster()[ByteOffset + 1] << 8);
+  if (get_static_CodeSize() >= 8)
+    RawCode += ( ((int) get_static_Raster()[ByteOffset + 2]) << 16);
+  RawCode >>= (get_static_BitOffset() % 8);
+  get_static_BitOffset() += get_static_CodeSize();
+
+  return(RawCode & get_static_ReadMask());
+}
+
+
+/***************************/
+CGAL_INLINE_FUNCTION
+static void DoInterlace(byte Index) {
+  static byte *ptr = NULL;
+  static int   oldYC = -1;
+  
+  if (oldYC != get_static_YC()) {
+    ptr = get_static_org() + 3 * get_static_YC() * get_static_Width();
+    oldYC = get_static_YC();
+  }
+  
+  if (get_static_YC() < get_static_Height()) {
+    *ptr++ = get_static_r()[Index];
+    *ptr++ = get_static_g()[Index];
+    *ptr++ = get_static_b()[Index];
+  }
+  
+  /* Update the X-coordinate, and if it overflows, update the Y-coordinate */
+  if (++get_static_XC() == get_static_Width()) {
+    
+    /* deal with the interlace as described in the GIF
+     * spec.  Put the decoded scan line out to the screen if we haven't gone
+     * past the bottom of it
+     */
+    
+    get_static_XC() = 0;
+    
+    switch (get_static_Pass()) {
+    case 0:
+      get_static_YC() += 8;
+      if (get_static_YC() >= get_static_Height()) { get_static_Pass()++; get_static_YC() = 4; }
+      break;
+      
+    case 1:
+      get_static_YC() += 8;
+      if (get_static_YC() >= get_static_Height()) { get_static_Pass()++; get_static_YC() = 2; }
+      break;
+      
+    case 2:
+      get_static_YC() += 4;
+      if (get_static_YC() >= get_static_Height()) { get_static_Pass()++; get_static_YC() = 1; }
+      break;
+      
+    case 3:
+      get_static_YC() += 2;  break;
+      
+    default:
+      break;
+    }
+  }
+}
+
+
+      
+/*****************************/
+CGAL_INLINE_FUNCTION
+static int GifError(const char *st) {
+  fprintf(stderr,"readGifImage: error: %s\n",st);
+
+  if (get_static_RawGIF() != NULL) ImageIO_free(get_static_RawGIF());
+  if (get_static_Raster() != NULL) ImageIO_free(get_static_Raster());
+  
+  return -1;
+}
+
diff --git a/3rdparty/CGAL/include/CGAL/ImageIO/gis.h b/3rdparty/CGAL/include/CGAL/ImageIO/gis.h
new file mode 100644
index 0000000..f2233a6
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/ImageIO/gis.h
@@ -0,0 +1,141 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+#ifndef GIS_H
+#define GIS_H
+
+
+#include <CGAL/ImageIO.h>
+
+
+
+
+/* read gis format header
+
+   Format du fichier texte associe aux fichiers binaires (images)
+
+exemple :
+         512 512 100 2
+	 -type U16
+	 -dx 1. 
+	 -dy 2.
+	 -dz .5
+	 -z2 5
+         -ar SUN
+	 -mod MR
+         -txt image acquise sur SIGNA 1.5T au CHRU de Caen
+         donnees brutes sans traitement  -endtxt
+	
+- la première ligne comporte les dimensions de l'image, respectivement, le nombre de colonnes, de lignes, de coupes et de temps; ces deux, trois ou quatre entiers doivent être strictement positifs et rester inférieurs à 4096.
+
+- les lignes suivantes comportent des champs indiques par des mots clefs:
+			
+   -type typespecifier
+
+   U8 entier non signé codé sur 8 bit (unsigned char) 
+   S8  entier signé codé sur 8 bit (signed char)
+   U16  entier non signé codé sur 16 bit (unsigned short)
+   S16  entier signé codé sur 16 bit (signed short)	
+   U32  entier non signé codé sur 32 bit (unsigned int)
+   S32  entier signé codé sur 32 bit (signed int)
+   FLOAT  flottant simple précision (float)
+   DOUBLE  flottant double précision (double)
+			
+   -dx double  (taille du voxel en x)
+   -dy double  (taille du voxel en y)
+   -dz double  (taille du voxel en z)
+               (les tailles sont donnees en millimetres)
+   -dt double  (taille du voxel en t)
+               (taille donnee en secondes)
+
+   (spécification d'un sous-volume)
+   -x1 entier  	
+   -x2 entier  	
+   -y1 entier  
+   -y2 entier  
+   -z1 entier  
+   -z2 entier  
+   -ref nom x y z t   
+        (origine d'un sous-volume : fichier correspondant a une
+         sous-image de "nom")
+
+   -ar architecture (string)
+   -mod modalite (string) : MR, PET, fMR, etc.
+   -dir plan de coupe (string) : sagittal, frontal, axial
+   -min double (valeur physique correspondant au minimum des voxels)
+   -max double (valeur physique correspondant au maximum des voxels)
+   -ca x y z (3 entiers pour la position de CA)
+   -cp x y z (3 entiers pour la position de CP)
+   -ip a b c d (4 double pour les coefficients du plan inter-hemispherique
+                equation de la forme ax+by+cz+d = 0)
+   -td d1 d2 d3 d4 d5 d6 (6 entiers pour les distances au repere de
+		Talairach, en voxels :
+		d1 : Talairach anterior plane-CA distance
+		d2 : Talairach posterior plane-CP distance
+		d3 : Talairach left plane-IP distance
+		d4 : Talairach right plane-IP distance
+   		d5 : Talairach bottom plane-CACP distance
+   		d6 : Talairach top plane-CACP distance
+   -a age (entier)
+   -s sexe (1/2)
+   -l lateralite
+   -txt texte libre (ascii)
+   -endtxt (fin du texte)
+
+
+   return:
+   -1: error
+   0: success
+ */
+int readGisHeader(const char* name,_image *im);
+
+
+int testGisHeader(char *magic,const char *name);
+
+/** creates an return the file format structure associated with the Gis file format */
+PTRIMAGE_FORMAT createGisFormat();
+
+/* 
+   return:
+   -1: error
+    1: success
+ */
+int writeGis( char *basename, _image* im ) ;
+/* 
+   return:
+   false: error
+   true: success
+ */
+bool writeGisHeader( const _image* im ) ;
+
+
+/* 
+   return:
+   -1: error
+    1: success
+ */
+int writeGisData( const _image* im ) ;
+
+#ifdef CGAL_HEADER_ONLY
+#include <CGAL/ImageIO/gis_impl.h>
+#endif // CGAL_HEADER_ONLY
+
+#endif
diff --git a/3rdparty/CGAL/include/CGAL/ImageIO/gis_impl.h b/3rdparty/CGAL/include/CGAL/ImageIO/gis_impl.h
new file mode 100644
index 0000000..d978b01
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/ImageIO/gis_impl.h
@@ -0,0 +1,735 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+#ifdef CGAL_HEADER_ONLY
+#define CGAL_INLINE_FUNCTION inline
+#else
+#define CGAL_INLINE_FUNCTION
+#endif
+
+#include <string>
+#include <sstream>
+#include <cstring>
+
+#include <CGAL/ImageIO/inr.h>
+#include <CGAL/ImageIO/fgetns.h>
+
+#define _LGTH_STRING_ 1024
+
+CGAL_INLINE_FUNCTION
+PTRIMAGE_FORMAT createGisFormat() {
+  PTRIMAGE_FORMAT f=(PTRIMAGE_FORMAT) ImageIO_alloc(sizeof(IMAGE_FORMAT));
+
+  f->testImageFormat=&testGisHeader;
+  f->readImageHeader=&readGisHeader;
+  f->writeImage=&writeGis;
+  strcpy(f->fileExtension,".dim,.dim.gz,.ima,.ima.gz");
+  strcpy(f->realName,"Gis");
+  return f;
+}
+CGAL_INLINE_FUNCTION
+int writeGis( char *name, _image* im) {
+  char *outputName;
+  std::size_t length, extLength=0;
+  int res;
+  std::size_t done;
+
+  length=strlen(name);
+  outputName= (char *)ImageIO_alloc(length+8);
+  
+  if ( strncmp( name+length-4, ".dim", 4 ) == 0 ) {
+    extLength = 4;
+  }
+  else if ( strncmp( name+length-4, ".ima", 4 ) == 0 ) {
+    extLength = 4;
+  }
+  else if ( strncmp( name+length-7, ".ima.gz", 7 ) == 0 ) {
+    extLength = 7;
+  }
+  else if ( strncmp( name+length-7, ".dim.gz", 7 ) == 0 ) {
+    extLength = 7;
+  }
+
+  strncpy( outputName, name, length-extLength );
+  if ( strncmp( name+length-7, ".dim.gz", 7 ) == 0 )
+    strcpy( outputName+length-extLength, ".dim.gz" );
+  else
+    strcpy( outputName+length-extLength, ".dim" );
+
+  _openWriteImage(im, outputName);
+  if( !im->fd ) {
+    fprintf(stderr, "writeGis: error: unable to open file \'%s\'\n", outputName);
+    if ( outputName != NULL ) ImageIO_free( outputName );
+    return ImageIO_OPENING;
+  }
+
+  if ( !writeGisHeader(im) ) {
+    fprintf(stderr, "writeGis: error: unable to write header of \'%s\'\n",
+	    outputName);
+    if ( outputName != NULL ) ImageIO_free( outputName );
+    ImageIO_close( im );
+    im->fd = NULL;
+    im->openMode = OM_CLOSE;
+    return -1;
+  }
+
+  ImageIO_close(im);
+  
+  strncpy( outputName, name, length-extLength );
+  if ( strncmp( name+length-3, ".gz", 3 ) == 0 ) {
+    strcpy( outputName+length-extLength, ".ima.gz" );
+  }
+  else {
+    strcpy( outputName+length-extLength, ".ima" );
+  }
+
+  _openWriteImage(im, outputName);
+
+  if( !im->fd ) {
+    fprintf(stderr, "writeGis: error: unable to open file \'%s\'\n", outputName);
+    if ( outputName != NULL ) ImageIO_free( outputName );
+    return ImageIO_OPENING;
+  }
+
+  if ( im->dataMode == DM_ASCII ) {
+    std::size_t i, j, n, size;
+    char *str = (char*)ImageIO_alloc( _LGTH_STRING_+1 );
+    size = im->xdim * im->ydim * im->zdim * im->vdim;
+    n = ( im->xdim < 16 ) ? im->xdim : 16;
+    i = 0;
+
+    switch( im->wordKind ) {
+    default :
+      fprintf(stderr, "writeGis: such word kind not handled in ascii mode for file \'%s\'\n", outputName);
+      if ( outputName != NULL ) ImageIO_free( outputName );
+      return( -3 );
+    case WK_FIXED :
+      switch ( im->wdim ) {
+      default :
+	fprintf(stderr, "writeGis: such word dim not handled in ascii mode for file \'%s\'\n", outputName);
+	if ( outputName != NULL ) ImageIO_free( outputName );
+	return( -3 );
+      case 1 :
+	switch ( im->sign ) {
+	default :
+	  fprintf(stderr, "writeGis: such sign not handled in ascii mode for file \'%s\'\n", outputName);
+	  if ( outputName != NULL ) ImageIO_free( outputName );
+	  return( -3 );
+	case SGN_UNSIGNED :
+	  {
+	    unsigned char *theBuf = ( unsigned char * )im->data;
+	    do {
+	      memset( str, 0, _LGTH_STRING_ );
+	      for ( j=0; j<n && i<size; j++, i++ ) {
+		sprintf( str+strlen(str), "%d", theBuf[i] );
+		if ( j<n && i<size ) sprintf( str+strlen(str), " " );
+	      }
+	      sprintf( str+strlen(str), "\n" );
+              done = ImageIO_write( im, str, strlen( str )  );
+              res = (done == strlen( str )) ? int(done) : -1;
+	      if ( res  <= 0 ) {
+		fprintf(stderr, "writeGis: error when writing data in \'%s\'\n", outputName);
+		if ( outputName != NULL ) ImageIO_free( outputName );
+		return( -3 );
+	      }
+	    } while ( i < size );
+	  }
+	  break;
+	case SGN_SIGNED :
+	  {
+	    char *theBuf = ( char * )im->data;
+	    do {
+	      memset( str, 0, _LGTH_STRING_ );
+	      for ( j=0; j<n && i<size; j++, i++ ) {
+		sprintf( str+strlen(str), "%d", theBuf[i] );
+		if ( j<n && i<size ) sprintf( str+strlen(str), " " );
+	      }
+	      sprintf( str+strlen(str), "\n" );
+              done = ImageIO_write( im, str, strlen( str )  );
+              res = (done == strlen( str )) ? int(done) : -1;
+	      if ( res  <= 0 ) {
+		fprintf(stderr, "writeGis: error when writing data in \'%s\'\n", outputName);
+		if ( outputName != NULL ) ImageIO_free( outputName );
+		return( -3 );
+	      }
+	    } while ( i < size );
+	  }
+	  break;
+	} /* end of switch ( im->sign ) */
+	break;
+      case 2 :
+	switch ( im->sign ) {
+	default :
+	  fprintf(stderr, "writeGis: such sign not handled in ascii mode for file \'%s\'\n", outputName);
+	  if ( outputName != NULL ) ImageIO_free( outputName );
+	  return( -3 );
+	case SGN_UNSIGNED :
+	  {
+	    unsigned short int *theBuf = ( unsigned short int * )im->data;
+	    do {
+	      memset( str, 0, _LGTH_STRING_ );
+	      for ( j=0; j<n && i<size; j++, i++ ) {
+		sprintf( str+strlen(str), "%d", theBuf[i] );
+		if ( j<n && i<size ) sprintf( str+strlen(str), " " );
+	      }
+	      sprintf( str+strlen(str), "\n" );
+	      done = ImageIO_write( im, str, strlen( str )  );
+              res = (done == strlen( str )) ? int(done) : -1;
+	      if ( res  <= 0 ) {
+		fprintf(stderr, "writeGis: error when writing data in \'%s\'\n", outputName);
+		if ( outputName != NULL ) ImageIO_free( outputName );
+		return( -3 );
+	      }
+	    } while ( i < size );
+	  }
+	  break;
+	case SGN_SIGNED :
+	  {
+	    short int *theBuf = ( short int * )im->data;
+	    do {
+	      memset( str, 0, _LGTH_STRING_ );
+	      for ( j=0; j<n && i<size; j++, i++ ) {
+		sprintf( str+strlen(str), "%d", theBuf[i] );
+		if ( j<n && i<size ) sprintf( str+strlen(str), " " );
+	      }
+	      sprintf( str+strlen(str), "\n" );
+	      done = ImageIO_write( im, str, strlen( str )  );
+              res = (done == strlen( str )) ? int(done) : -1;
+	      if ( res  <= 0 ) {
+		fprintf(stderr, "writeGis: error when writing data in \'%s\'\n", outputName);
+		if ( outputName != NULL ) ImageIO_free( outputName );
+		return( -3 );
+	      }
+	    } while ( i < size );
+	  }
+	  break;
+	} /* end of switch ( im->sign ) */
+	break;	
+      } /* end of switch ( im->wdim ) */
+    } /* end of switch( im->wordKind ) */
+
+    ImageIO_free( str ); 
+    if (outputName != NULL) ImageIO_free(outputName);
+    return static_cast<int>(res);
+  }
+  else {
+    bool ret = _writeInrimageData(im);
+    if (outputName != NULL) ImageIO_free(outputName);
+    return (ret ? 1 : -1);
+  }
+}
+
+CGAL_INLINE_FUNCTION
+int testGisHeader(char *,const char *name) {
+   if (( !strncmp(name+strlen(name)-4, ".dim", 4)) || 
+       ( !strncmp(name+strlen(name)-4, ".ima", 4)) || 
+       ( !strncmp(name+strlen(name)-7, ".ima.gz", 7)) || 
+       ( !strncmp(name+strlen(name)-7, ".dim.gz", 7)) )
+     return 0;
+  else 
+    return -1;
+}
+
+
+
+CGAL_INLINE_FUNCTION
+int readGisHeader( const char* name,_image* im)
+{
+  char *s, *str = NULL;
+  int status;
+  int n=0, nusermax = 20;
+
+  str = (char*)ImageIO_alloc( _LGTH_STRING_+1 );
+  
+  if ( !fgetns(str, _LGTH_STRING_, im) ) 
+    { ImageIO_free( str ); return -1; }
+
+  std::istringstream iss;
+  iss.str(str);
+  iss >> im->xdim >> im->ydim >> im->zdim >> im->vdim;
+
+  status = (int)iss.str().length();
+  switch ( status ) {
+  case 2 :    im->zdim = 1;
+  case 3 :    im->vdim = 1;
+  case 4 :    break;
+  default :
+    fprintf( stderr, "readGisHeader: unable to read dimensions in '%s'\n", name );
+    ImageIO_free( str ); 
+    return -1;
+  }
+  if ( im->vdim > 1 ) {
+    im->vectMode = VM_INTERLACED;
+  } 
+  else {
+    im->vectMode = VM_SCALAR;
+  }
+#define ADD_USER_STRING { \
+    if ( n == 0 ) { \
+      im->user = (char**)ImageIO_alloc( nusermax * sizeof( char*) ); \
+      for ( n=0; n<nusermax; n++ ) im->user[n] = NULL; \
+      n = 0; \
+    } \
+    im->user[n] = (char*)ImageIO_alloc( 1+strlen( s ) ); \
+    strcpy( im->user[n++], s ); \
+  }
+
+
+
+  while( fgetns( str, _LGTH_STRING_, im ) != 0 ) {
+    s = str;
+    do {
+
+      while ( *s == ' ' || *s == '\t' ) s++;
+
+      if ( !strncmp( s, "-dx ", 4 ) ) {
+	s += 4;
+	status = sscanf( s, "%lf", &(im->vx) );
+	if ( status != 1 ) {
+	  fprintf( stderr, "readGisHeader: error while reading -dx in '%s'\n", s-4 );
+	  *s = '\0';
+	} 
+	else {
+	  while ( *s == '.' || (*s >= '0' && *s <= '9') ) s++;
+	}
+      }
+      else if ( !strncmp( s, "-dy ", 4 ) ) {
+	s += 4;
+	status = sscanf( s, "%lf", &(im->vy) );
+	if ( status != 1 ) {
+	  fprintf( stderr, "readGisHeader: error while reading -dy in '%s'\n", s-4 );
+	  *s = '\0';
+	} 
+	else {
+	  while ( *s == '.' || (*s >= '0' && *s <= '9') ) s++;
+	}
+      }
+      else if ( !strncmp( s, "-dz ", 4 ) ) {
+	s += 4;
+	status = sscanf( s, "%lf", &(im->vz) );
+	if ( status != 1 ) {
+	  fprintf( stderr, "readGisHeader: error while reading -dz in '%s'\n", s-4 );
+	  *s = '\0';
+	} 
+	else {
+	  while ( *s == '.' || (*s >= '0' && *s <= '9') ) s++;
+	}
+      }
+      else if ( !strncmp( s, "-dt ", 4 ) ) {
+	ADD_USER_STRING
+	s += 4; 
+	while ( *s == '.' || (*s >= '0' && *s <= '9') ) s++; 
+      }
+
+      else if ( !strncmp( s, "-type ", 6 ) ) {
+	s += 6; 
+	if ( !strncmp( s, "U8", 2 ) ) {
+	  im->wdim     = 1;
+	  im->wordKind = WK_FIXED;
+	  im->sign     = SGN_UNSIGNED;
+	  s += 2;
+	}
+	else if ( !strncmp( s, "S8", 2 ) ) {
+	  im->wdim     = 1;
+	  im->wordKind = WK_FIXED;
+	  im->sign     = SGN_SIGNED;
+	  s += 2;
+	} 
+	else if ( !strncmp( s, "U16", 3 ) ) {
+	  im->wdim     = 2;
+	  im->wordKind = WK_FIXED;
+	  im->sign     = SGN_UNSIGNED;
+	  s += 3;
+	}
+	else if ( !strncmp( s, "S16", 3 ) ) {
+	  im->wdim     = 2;
+	  im->wordKind = WK_FIXED;
+	  im->sign     = SGN_SIGNED;
+	  s += 3;
+	}
+	else if ( !strncmp( s, "U32", 3 ) ) {
+	  im->wdim     = 4;
+	  im->wordKind = WK_FIXED;
+	  im->sign     = SGN_UNSIGNED;
+	  s += 3;
+	}
+	else if ( !strncmp( s, "S32", 3 ) ) {
+	  im->wdim     = 4;
+	  im->wordKind = WK_FIXED;
+	  im->sign     = SGN_SIGNED;
+	  s += 3;
+	}
+	else if ( !strncmp( s, "FLOAT", 5 ) ) {
+	  im->wdim     = sizeof( float );
+	  im->wordKind = WK_FLOAT;
+	  im->sign     = SGN_UNKNOWN;
+	  s += 5;
+	}
+	else if ( !strncmp( s, "DOUBLE", 6 ) ) {
+	  im->wdim     = sizeof( double );
+	  im->wordKind = WK_FLOAT;
+	  im->sign     = SGN_UNKNOWN;
+	  s += 6;
+	}
+	else {
+	  fprintf( stderr, "readGisHeader: unknown type '%s'\n", s-6 );
+	  *s = '\0'; 
+	}
+      }
+
+      else if ( !strncmp( s, "-bo ", 4 ) ) {
+	s += 4;
+	if ( !strncmp( s, "ABCD", 4 ) ) {
+	  im->endianness = END_BIG;
+	  s += 4;
+	}
+	else if ( !strncmp( s, "SUN", 3 ) ) {
+	  im->endianness = END_BIG;
+	  s += 3;
+	}
+	else if ( !strncmp( s, "DCBA", 4 ) ) {
+	  im->endianness = END_LITTLE;
+	  s += 4;
+	}
+	else if ( !strncmp( s, "ALPHA", 5 ) ) {
+	  im->endianness = END_LITTLE;
+	  s += 5;
+	}
+	else {
+	  fprintf( stderr, "readGisHeader: unknown byte order '%s'\n", s-4 );
+	  *s = '\0'; 
+	}
+      }
+
+      else if ( !strncmp( s, "-ar ", 4 ) ) {
+	s += 4;
+	if ( !strncmp( s, "SUN", 3 ) ) {
+	  im->endianness = END_BIG;
+	  s += 3;
+	}
+	else if ( !strncmp( s, "ALPHA", 5 ) ) {
+	  im->endianness = END_LITTLE;
+	  s += 5;
+	}
+	else {
+	  fprintf( stderr, "readGisHeader: unknown architecture '%s'\n", s-4 );
+	  *s = '\0'; 
+	}
+      }
+
+      else if ( !strncmp( s, "-om ", 4 ) ) {
+	s += 4;
+	if ( !strncmp( s, "binar", 5 ) ) {
+	  im->dataMode = DM_BINARY;
+	  s += 5;
+	} 
+	else if ( !strncmp( s, "ascii", 5 ) ) {
+	  im->dataMode = DM_ASCII;
+	  s += 5;
+	} 
+	else {
+	  fprintf( stderr, "readGisHeader: unknown data type '%s'\n", s-4 );
+	  ImageIO_free( str );
+	  return -1;
+	}
+      }
+      
+      
+      else {
+	fprintf( stderr, "readGisHeader: unknown indentifier '%s'\n", s );
+	ADD_USER_STRING
+	*s = '\0'; 
+      }
+
+    } while( *s != '\0' && *s != '\n' );
+
+  }
+  ImageIO_free( str );
+  
+
+  if ( im->endianness == END_UNKNOWN ) {
+    im->endianness = _getEndianness();
+  }
+
+
+  /* header is read. close header file and open data file. */
+  if( name != NULL ) {
+    
+    std::size_t length = strlen(name) ;
+    char* data_filename = (char *) ImageIO_alloc(length+4) ;
+    
+    if( strcmp( name+length-4, ".dim" ) ) {
+      fprintf (stderr,
+	       "readGisHeader: error: file header extension must be .dim\n");
+      ImageIO_free( data_filename );
+      return -1;
+    }
+    
+    ImageIO_close(im);
+
+
+    /* open data file
+     */
+    
+    strcpy(data_filename,name);
+    strcpy(data_filename+length-3, "ima.gz");
+    _openReadImage(im,data_filename);
+    
+    if(!im->fd) {
+      
+      strcpy(data_filename,name);
+      strcpy(data_filename+length-3, "ima");
+      _openReadImage(im,data_filename);
+      if(!im->fd) {
+	fprintf(stderr, "readGisHeader: error: unable to open data file \'%s\'\n", data_filename);
+	ImageIO_free( data_filename );
+	return -1;
+	
+      }
+    }
+    ImageIO_free( data_filename );
+
+
+
+
+
+    /* read data if ascii
+       only U8 and S8
+     */
+    if ( im->dataMode == DM_ASCII ) {
+      std::size_t size = std::size_t(im->xdim) * im->ydim * im->zdim * im->vdim * im->wdim;
+      unsigned int n;
+      char *tmp;
+      int ret, iv=0;
+      
+      if ( im->wdim != 1 || im->wordKind != WK_FIXED ) {
+	fprintf(stderr, "readGisHeader: error: unable to read such ascii type\n" );
+	return -1;
+      }
+
+      n = 0 ;
+      if ( size <= 0 ) return -1;
+      if(!im->data) {
+	im->data = ( void*) ImageIO_alloc(size);
+	if(!im->data) return -1;
+      }
+      
+      n = 0;
+      str = (char*)ImageIO_alloc( _LGTH_STRING_+1 );
+      while( fgetns( str, _LGTH_STRING_, im ) != 0 &&
+	     n < im->xdim * im->ydim * im->zdim * im->vdim ) {
+	tmp = str;
+	while ( *tmp != '\n' && *tmp != '\0' && *tmp != EOF &&
+		n < im->xdim * im->ydim * im->zdim * im->vdim ) {
+	  /* skip trailing whitespace
+	   */
+	  while ( *tmp == ' ' || *tmp == '\t' )
+	    tmp++;
+	  if ( *tmp == '\0' || *tmp == '\n' || *tmp == EOF )
+	    continue;
+	  
+	  /* read a number
+	   */
+	  switch ( im->wordKind ) {
+	  case WK_FIXED :
+	    ret = sscanf( tmp, "%d", &iv );
+	  break;
+	  default :
+	    ImageIO_free( im->data ); im->data = NULL;
+	    ImageIO_free( str );
+	    return -1;
+	  }
+	  
+	  if ( ret != 1 ) {
+	    fprintf( stderr, "readGisHeader: error in reading ascii data\n" );
+	    ImageIO_free( im->data ); im->data = NULL;
+	    ImageIO_free( str );
+	    return -1;	
+	  }
+	  
+	  if ( im->wordKind == WK_FIXED 
+	       && im->sign == SGN_UNSIGNED 
+	       && im->wdim == 1 ) {
+	    unsigned char *buf = (unsigned char *)im->data;
+	    buf += n;
+	    if ( iv < 0 )        *buf = (unsigned char)0;
+	    else if ( iv > 255 ) *buf = (unsigned char)255;
+	    else                 *buf = (unsigned char)iv;
+	    n ++;
+	  }
+	  else if ( im->wordKind == WK_FIXED 
+		    && im->sign == SGN_SIGNED 
+		    && im->wdim == 1 ) {
+	    char *buf = (char *)im->data;
+	    buf += n;
+	    if ( iv < -128 )     *buf = (char)-128;
+	    else if ( iv > 127 ) *buf = (char)127;
+	    else                 *buf = (char)iv;
+	    n ++;
+	  }
+	  else if ( im->wordKind == WK_FIXED 
+		    && im->sign == SGN_UNSIGNED 
+		    && im->wdim == 2 ) {
+	    unsigned short int *buf = (unsigned short int *)im->data;
+	    buf += n;
+	    if ( iv < 0 )          *buf = (unsigned short int)0;
+	    else if ( iv > 65535 ) *buf = (unsigned short int)65535;
+	    else                   *buf = (unsigned short int)iv;
+	    n ++;
+	  }
+	  else if ( im->wordKind == WK_FIXED 
+		    && im->sign == SGN_SIGNED 
+		    && im->wdim == 2 ) {
+	    short int *buf = (short int *)im->data;
+	    buf += n;
+	    if ( iv < -32768 )     *buf = (short int)-32768;
+	    else if ( iv > 32767 ) *buf = (short int)32767;
+	    else                   *buf = (short int)iv;
+	    n ++;
+	  }
+	  else {
+	    ImageIO_free( im->data ); im->data = NULL;
+	    ImageIO_free( str );
+	    return -1;
+	  }
+	  
+
+
+	  /* skip a number 
+	   */
+	  while ( (*tmp >= '0' && *tmp <= '9') || *tmp == '.' || *tmp == '-' )
+	    tmp++;
+	}
+      }
+      ImageIO_free( str );
+      ImageIO_close(im);
+    }
+
+  }
+
+  
+  /* check header validity */
+  if ( im->xdim > 0 && im->ydim > 0 && im->zdim > 0 && im->vdim > 0 &&
+       im->vx > 0.0 && im->vy > 0.0 && im->vz > 0.0 &&
+       ( im->wordKind == WK_FLOAT ||
+	 (im->wordKind == WK_FIXED && im->sign != SGN_UNKNOWN) ) &&
+       im->endianness != END_UNKNOWN ) {
+    return 0;
+  }
+
+  return -1;
+}
+
+
+
+CGAL_INLINE_FUNCTION
+bool writeGisHeader( const _image* inr )
+{
+  const char *proc = "writeGisHeader";
+  std::ostringstream oss;
+
+  if ( inr->vectMode == VM_NON_INTERLACED ) {
+    fprintf( stderr, "%s: can not write non interlaced data\n", proc );
+    return false;
+  }
+
+  /* dimensions
+   */
+  oss << " " << inr->xdim << " " << inr->ydim;
+  if ( inr->vdim > 1 ) {
+    oss << " " << inr->zdim << " " << inr->vdim;
+  }
+  else if ( inr->zdim > 1 ) {
+    oss << " " << inr->zdim;
+  }
+  oss << "\n";
+
+  /* type
+   */
+  oss << "-type ";
+  switch ( inr->wordKind ) {
+  case WK_FIXED :
+    switch( inr->sign ) {
+    case SGN_UNSIGNED :
+      oss << "U" << 8*inr->wdim;
+      break;
+    case SGN_SIGNED :
+      oss << "S" << 8*inr->wdim;
+      break;
+    default :
+      fprintf( stderr, "%s: unknown wordSign\n", proc );
+      return false;    
+    }
+    break;
+  case WK_FLOAT :
+    if ( inr->wdim == sizeof( float ) ) {
+      oss << "FLOAT";
+    }
+    else if ( inr->wdim  == sizeof( double ) ) {
+      oss << "DOUBLE";
+    }
+    else {
+      fprintf( stderr, "%s: unknown WK_FLOAT word dim\n", proc );
+      return false;    
+    }
+    break;
+  default :
+    fprintf( stderr, "%s: unknown wordKind for image\n", proc );
+    return false;  
+  }
+  oss << "\n";
+  
+  oss << "-dx "<< inr->vx <<"\n";
+  oss << "-dy "<< inr->vy <<"\n";
+  if ( inr->zdim > 1 )
+    oss << "-dz " << inr->vz << "\n";
+
+  if ( inr->wdim > 1 ) {
+    oss << "-bo ";
+    switch ( _getEndianness() ) {
+    default :
+    case END_LITTLE :
+      oss << "DCBA"; break;
+    case END_BIG :
+      oss << "ABCD"; break;
+    }
+    oss << "\n";
+  }
+  switch ( inr->dataMode ) {
+  default :
+  case DM_BINARY :
+    oss << "-om binar\n";
+    break;
+  case DM_ASCII :
+    oss << "-om ascii\n";
+  }
+  if( ImageIO_write( inr, oss.str().data(), oss.str().length()) == 0) {
+    return false;
+  }
+  return true;
+}
+
+
+CGAL_INLINE_FUNCTION
+int writeGisData( const _image*) 
+{
+  return -1;
+}
diff --git a/3rdparty/CGAL/include/CGAL/ImageIO/inr.h b/3rdparty/CGAL/include/CGAL/ImageIO/inr.h
new file mode 100644
index 0000000..44a3faf
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/ImageIO/inr.h
@@ -0,0 +1,65 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+
+#ifndef INR_H
+#define INR_H
+
+
+#include <CGAL/ImageIO.h>
+
+
+
+/** Writes the given inrimage header in an already opened file.
+    @param im image descriptor
+    @param end image data endianness (END_UNKNOWN to use architecture endianness) */
+int _writeInrimageHeader(const _image *im,
+			 ENDIANNESS end);
+
+/** Writes the given image body in an already opened file.
+    @param im image descriptor */
+bool _writeInrimageData(const _image *im);
+
+/** read header from an opened inrimage file
+    @param im opened inrmage descriptor */
+int readInrimageHeader(const char *,_image *im);
+
+/** test if an image file has the Inrimage format, given the magic string
+    and filename
+    @param magic this string is of size 5 and corresponds to the first 4 characters of the file (terminated with a null character)
+    @param filename the file name
+    @return -1 if it is not an Inrimage file and 0 otherwise */
+int testInrimageHeader(char *magic,const char *filename); 
+
+/** calls _writeInrimageHeader and _writeInrimageData
+    @param basename the file name without any extension 
+    @param im structure
+    @return same as  _writeInrimageHeader*/
+int writeInrimage(char *basename,_image *im);
+/** creates an return the file format structure associated with the Inrimage file format */
+PTRIMAGE_FORMAT createInrimageFormat();
+
+#ifdef CGAL_HEADER_ONLY
+#include <CGAL/ImageIO/inr_impl.h>
+#endif // CGAL_HEADER_ONLY
+
+
+#endif
diff --git a/3rdparty/CGAL/include/CGAL/ImageIO/inr_impl.h b/3rdparty/CGAL/include/CGAL/ImageIO/inr_impl.h
new file mode 100644
index 0000000..0e497d3
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/ImageIO/inr_impl.h
@@ -0,0 +1,514 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+#ifdef CGAL_HEADER_ONLY
+#define CGAL_INLINE_FUNCTION inline
+#else
+#define CGAL_INLINE_FUNCTION
+#endif
+
+#include <CGAL/ImageIO/fgetns.h>
+
+#include <string>
+#include <sstream>
+#include <string.h>
+
+/* Magic header for inrimages v4 */
+#define INR4_MAGIC "#INRIMAGE-4#{"
+
+
+/** Magic header for inrimages */
+#define INR_MAGIC "#INR"
+
+typedef struct stringListElementStruct {
+  char *string;
+  struct stringListElementStruct *next;
+} stringListElement;
+/* list element with a pointer on a string */
+
+typedef struct {
+  stringListElement *begin, *end;
+} stringListHead;
+/* string list descriptor */
+
+#include <clocale>
+class Set_numeric_locale {
+  const char * old_locale;
+public:
+  Set_numeric_locale(const char* locale) 
+    : old_locale(std::setlocale(LC_NUMERIC, locale))
+  {
+  }
+
+  ~Set_numeric_locale() {
+    std::setlocale(LC_NUMERIC, old_locale);
+  }
+};
+
+static void addStringElement(stringListHead *strhead,
+			     const char *str);
+/* add a string element at the tail of given list */
+
+static void concatStringElement(const stringListHead *strhead,
+				const char *str);
+/* concat given string at the last element of given list */
+
+
+/* Writes the given inrimage header in an already opened file.*/
+CGAL_INLINE_FUNCTION
+int _writeInrimageHeader(const _image *im, ENDIANNESS end) {
+  std::size_t pos, i;
+  char type[30], endianness[5], buf[257], scale[20];
+  std::ostringstream oss;
+
+  Set_numeric_locale num_locale("C");
+
+  if(im->openMode != OM_CLOSE) {
+    /* fix word kind */
+    switch(im->wordKind) {
+
+    case WK_FLOAT:
+      sprintf(type, "float");
+      scale[0] = '\0';
+      break;
+
+    case WK_FIXED:
+      switch(im->sign) {
+      case SGN_SIGNED:
+	sprintf(type, "signed fixed");
+	break;
+      case SGN_UNSIGNED:
+	sprintf(type, "unsigned fixed");
+	break;
+      default:
+	return -1;
+      }
+      sprintf(scale, "SCALE=2**0\n");
+      break;
+      
+    default:
+      return -1;
+    }
+    
+    switch(end) {
+    case END_LITTLE:
+      sprintf(endianness, "decm");
+      break;
+    case END_BIG:
+      sprintf(endianness, "sun");
+      break;
+    default:
+      /* fix architecture endianness */
+      if( _getEndianness() == END_LITTLE)
+	sprintf(endianness, "decm");
+      else
+	sprintf(endianness, "sun");
+      break;
+    }
+
+    /* write header information */
+    oss << INR4_MAGIC << "\n";
+    oss << "XDIM=" << im->xdim << "\n";
+    oss << "YDIM=" << im->ydim << "\n";
+    oss << "ZDIM=" << im->zdim << "\n";
+    oss << "VDIM=" << im->vdim << "\n";
+    oss << "TYPE=" << type << "\n";
+    oss << "PIXSIZE=" << im->wdim*8 <<" bits\n";
+    oss << scale << "CPU=" << endianness << "\n";
+    oss << "VX=" << im->vx << "\n";
+    oss << "VY=" << im->vy << "\n";
+    oss << "VZ=" << im->vz << "\n";
+
+    if ( im->cx != 0 ) 
+      oss << "XO="<< im->cx << "\n";
+    if ( im->cy != 0 ) 
+      oss << "YO="<< im->cy << "\n";
+    if ( im->cz != 0 ) 
+      oss << "ZO="<< im->cz << "\n";
+    if ( im->tx != 0.0 ) 
+      oss << "TX="<< im->tx << "\n";
+    if ( im->ty != 0.0 ) 
+      oss << "TY="<< im->ty << "\n";
+    if ( im->tz != 0.0 ) 
+      oss << "TZ="<< im->tz << "\n";
+    if ( im->rx != 0.0 ) 
+      oss << "RX="<< im->rx <<"\n";
+    if ( im->ry != 0.0 ) 
+      oss << "RY="<< im->ry << "\n";
+    if ( im->rz != 0.0 ) 
+      oss << "RZ=" << im->rz <<"\n";
+
+    pos = oss.str().length();
+    
+    if(ImageIO_write(im, oss.str().data(), oss.str().length()) == 0)
+      return -1;
+    
+    
+    /* write user strings */
+    if ( im->user != NULL ) {
+      for(i = 0; i < im->nuser; i++) {
+	if ( im->user[i] == NULL ) continue;
+	pos += strlen(im->user[i]) + 2;
+	if(ImageIO_write(im, "#", 1) == 0) return -1;
+	if(ImageIO_write(im, im->user[i], strlen(im->user[i])) == 0) return -1;
+	if(ImageIO_write(im, "\n", 1) == 0) return -1;
+      }
+    }
+    /* write end of header */
+    pos = pos % 256;
+    if(pos > 252) {
+      for(i = pos; i < 256; i++)
+	if(ImageIO_write(im, "\n", 1) != 1) return -1;
+      pos = 0;
+    }
+    buf[0] = '\0';
+    for(i = pos; i < 252; i++) strcat(buf, "\n");
+    strcat(buf, "##}\n");
+    
+    if(ImageIO_write(im, buf, strlen(buf)) == 0) return -1;
+    else return 1;
+  }
+
+  else return -1;
+}
+
+
+
+/* Writes the given image body in an already opened file.*/
+CGAL_INLINE_FUNCTION
+bool _writeInrimageData(const _image *im) {
+  std::size_t size, nbv, nwrt, i, v;
+  unsigned char **vp;
+  
+  if(im->openMode != OM_CLOSE) {
+
+    /* scalar or interlaced vectors */
+    if(im->vectMode != VM_NON_INTERLACED) {
+      size = im->xdim * im->ydim * im->zdim * im->vdim * im->wdim;
+      nwrt = ImageIO_write(im, im->data, size);
+      return nwrt == size;
+    }
+
+    /* non interlaced vectors: interlace for saving */
+    else {
+      nbv = im->xdim * im->ydim * im->zdim;
+      size = im->xdim * im->ydim * im->zdim * im->wdim;
+      vp = (unsigned char **) ImageIO_alloc(im->vdim * sizeof(unsigned char *));
+      for(v = 0; v < im->vdim; v++)
+	vp[v] = (unsigned char *) im->data + v * size;
+      for(i = 0; i < nbv; i++)
+	for(v = 0; v < im->vdim; v++) {
+	  if(ImageIO_write(im, (const void *) vp[v], im->wdim) != im->wdim)
+	    return false;
+	  vp[v] += im->wdim;
+	}
+      ImageIO_free(vp);
+      return true;
+    }
+  }
+  else return false;
+}
+
+
+
+
+/* read header of an opened inrimage */
+CGAL_INLINE_FUNCTION
+int readInrimageHeader(const char *,_image *im) {
+  char str[257];
+  int n, nusr;
+  stringListHead strl = { NULL, NULL };
+  stringListElement *oel, *el;
+
+  Set_numeric_locale num_locale("C");
+
+  if(im->openMode != OM_CLOSE) {
+    /* read image magic number */
+    if(!fgetns(str, 257, im )) return -1;
+    if(strcmp(str, INR4_MAGIC)) return -1;
+
+
+    /* while read line does not begin with '#' or '\n', read line
+       and decode field */
+    if(!fgetns(str, 257, im)) return -1;
+
+    while(str[0] != '#' && str[0] != '\0') {
+
+      if(!strncmp(str, "XDIM=", 5)) {
+        std::istringstream iss(str+5);
+        if(!(iss >> im->xdim)) return -1;
+      }
+      else if(!strncmp(str, "YDIM=", 5)) {
+        std::istringstream iss(str+5);
+        if(!(iss >> im->ydim)) return -1;
+      }
+      else if(!strncmp(str, "ZDIM=", 5)) {
+        std::istringstream iss(str+5);
+        if(!(iss >> im->zdim)) return -1;
+      }
+      else if(!strncmp(str, "VDIM=", 5)) {
+        std::istringstream iss(str+5);
+        if(!(iss >> im->vdim)) return -1;
+	if(im->vdim == 1) im->vectMode = VM_SCALAR;
+	else im->vectMode = VM_INTERLACED;
+      }
+      else if(!strncmp(str, "VX=", 3)) {
+        std::istringstream iss(str+3);
+        if(!(iss >> im->vx)) return -1;
+      }
+      else if(!strncmp(str, "VY=", 3)) {
+        std::istringstream iss(str+3);
+        if(!(iss >> im->vy)) return -1;
+      }
+      else if(!strncmp(str, "VZ=", 3)) {
+        std::istringstream iss(str+3);
+        if(!(iss >> im->vz)) return -1;
+      }
+      else if(!strncmp(str, "TYPE=", 5)) {
+	if(!strncmp(str+5, "float", 5)) im->wordKind = WK_FLOAT;
+	else {
+	  if(!strncmp(str+5, "signed fixed", 12)) {
+	    im->wordKind = WK_FIXED;
+	    im->sign = SGN_SIGNED;
+	  }
+	  else if(!strncmp(str+5, "unsigned fixed", 14)) {
+	    im->wordKind = WK_FIXED;
+	    im->sign = SGN_UNSIGNED;
+	  }
+	  else return -1;
+	}
+      }
+      /* before "sscanf(str+8, "%i %n", &im->wdim, &n) != 1"
+	 was used. 
+	 However the man said 
+         ...
+	 n      Nothing is expected; instead, the number of charac­
+              ters consumed thus far from  the  input  is  stored
+              through  the  next pointer, which must be a pointer
+              to int.  This is not a conversion, although it  can
+              be  suppressed  with  the  *  flag.  The C standard
+              says: `Execution of a %n directive does not  incre­
+              ment  the  assignment count returned at the comple­
+              tion of execution' but  the  Corrigendum  seems  to
+              contradict  this.  Probably  it is wise not to make
+              any assumptions on the effect of %n conversions  on
+              the return value.
+	 ...
+	 Thus I change it. It was yielding a RETURN_FAILURE with 
+	 insight (GM).
+      */
+      else if(!strncmp(str, "PIXSIZE=", 8)) {
+        std::istringstream iss(str+8);
+        if(!(iss >> im->wdim)) return -1;
+	if(im->wdim != 8 && im->wdim != 16 && im->wdim != 32 &&
+	   im->wdim != 64) return -1;
+	
+	if ( im->wdim <= 9 ) {
+	  if(strncmp(str+8+1, " bits", 5)) return -1;
+	}
+	else if ( im->wdim <= 99 ) {
+	  if(strncmp(str+8+2, " bits", 5)) return -1;
+	}
+	else {
+	  return -1;
+	}
+
+	im->wdim >>= 3;
+      }
+      else if(!strncmp(str, "SCALE=", 6)) ;
+      else if(!strncmp(str, "CPU=", 4)) {
+	if(!strncmp(str+4, "decm", 4)) im->endianness = END_LITTLE;
+	else if(!strncmp(str+4, "alpha", 5)) im->endianness = END_LITTLE;
+	else if(!strncmp(str+4, "pc", 2)) im->endianness = END_LITTLE;
+	else if(!strncmp(str+4, "sun", 3)) im->endianness = END_BIG;
+	else if(!strncmp(str+4, "sgi", 3)) im->endianness = END_BIG;
+	else return -1;
+      }
+
+      else if(!strncmp(str, "XO=", 3)) {
+        std::istringstream iss(str+3);
+        if(!(iss >> im->cx)) return -1;
+      }
+      else if(!strncmp(str, "YO=", 3)) {
+        std::istringstream iss(str+3);
+        if(!(iss >> im->cy)) return -1;
+      }
+      else if(!strncmp(str, "ZO=", 3)) {
+        std::istringstream iss(str+3);
+        if(!(iss >> im->cz)) return -1;
+      }
+
+      else if(!strncmp(str, "TX=", 3)) {
+        std::istringstream iss(str+3);
+        if(!(iss >> im->tx)) return -1;
+      }
+      else if(!strncmp(str, "TY=", 3)) {
+        std::istringstream iss(str+3);
+        if(!(iss >> im->ty)) return -1;
+      }
+      else if(!strncmp(str, "TZ=", 3)) {
+        std::istringstream iss(str+3);
+        if(!(iss >> im->tz)) return -1;
+      }
+      else if(!strncmp(str, "RX=", 3)) {
+        std::istringstream iss(str+3);
+        if(!(iss >> im->rx)) return -1;
+      }
+      else if(!strncmp(str, "RY=", 3)) {
+        std::istringstream iss(str+3);
+        if(!(iss >> im->ry)) return -1;
+      }
+      else if(!strncmp(str, "RZ=", 3)) {
+        std::istringstream iss(str+3);
+        if(!(iss >> im->rz)) return -1;
+      }
+
+      if(!fgetns(str, 257, im)) return -1;
+    }
+
+    /* parse user strings */
+    im->nuser = nusr = 0;
+    while(str[0] == '#' && strncmp(str, "##}", 3)) {
+      addStringElement(&strl, str + 1);
+      while(strlen(str) == 256) {
+	if(!fgetns(str, 257, im)) return -1;
+	concatStringElement(&strl, str);
+      }
+      nusr++;
+      if(!fgetns(str, 257, im)) return -1;      
+    }
+    
+    /* go to end of header */
+    while(strncmp(str, "##}", 3)) {
+      if(!fgetns(str, 257, im)) return -1;
+    }
+    
+
+    /* check header validity */
+    if(im->xdim > 0 && im->ydim > 0 && im->zdim > 0 && im->vdim > 0 &&
+       im->vx > 0.0 && im->vy > 0.0 && im->vz > 0.0 &&
+       (im->wordKind == WK_FLOAT || (im->wordKind == WK_FIXED &&
+				     im->sign != SGN_UNKNOWN)) &&
+       im->endianness != END_UNKNOWN) {
+      if(nusr > 0) {
+	im->nuser = nusr;
+	im->user = (char **) ImageIO_alloc(im->nuser * sizeof(char *));
+	oel = NULL;
+	for(el = strl.begin, n = 0; el != NULL; el = oel, n++) {
+	  im->user[n] = el->string;
+	  oel = el->next;
+	  ImageIO_free(el);
+	}
+      }
+      return 0;
+    }
+    else return -1;
+
+  }
+  else return -1;
+}
+
+
+
+/* add a string element at the tail of given list */
+static void addStringElement(stringListHead *strhead, const char *str) {
+  stringListElement *el;
+
+  el = (stringListElement *) ImageIO_alloc(sizeof(stringListElement));
+  /* was strdup(str); */
+  el->string = (char*)ImageIO_alloc( strlen(str)+1);
+  memcpy(el->string, str,  strlen(str)+1);
+  el->next = NULL;
+  if(strhead->begin == NULL)
+    strhead->begin = strhead->end = el;
+  else {
+    strhead->end->next = el;
+    strhead->end = el;
+  }
+}
+
+
+/* concat given string at the last element of given list */
+static void concatStringElement(const stringListHead *strhead,
+				const char *str) {
+  stringListElement *el;
+
+  el = strhead->end;
+  el->string = (char *) realloc(el->string,
+				strlen(el->string) + strlen(str) + 1);
+  strcat(el->string, str);
+}
+
+CGAL_INLINE_FUNCTION
+int testInrimageHeader(char *magic,const char *) {
+  if (!strcmp(magic, INR_MAGIC))
+    return 0;
+  else 
+    return -1;
+}
+CGAL_INLINE_FUNCTION
+int writeInrimage(char *name,_image *im) {
+  int res;
+
+  _openWriteImage( im, name );
+
+  if(!im->fd) {
+    fprintf(stderr, "writeInrimage: error: unable to open file \'%s\'\n", name );
+    return ImageIO_OPENING;
+  }
+
+  res = _writeInrimageHeader(im, END_UNKNOWN);
+  if (res < 0) {
+    fprintf(stderr, "writeInrimage: error: unable to write header of \'%s\'\n",
+	    name);
+    ImageIO_close( im );
+    im->fd = NULL;
+    im->openMode = OM_CLOSE;
+    return( res );
+  }
+  
+  if (!_writeInrimageData(im)) {
+    fprintf(stderr, "writeInrimage: error: unable to write data of \'%s\'\n",
+	    name);
+    ImageIO_close( im );
+    im->fd = NULL;
+    im->openMode = OM_CLOSE;
+    return -1;
+  }
+
+  ImageIO_close( im );
+  im->fd = NULL;
+  im->openMode = OM_CLOSE;
+
+  return ( res );  
+}
+
+CGAL_INLINE_FUNCTION
+PTRIMAGE_FORMAT createInrimageFormat() {
+  PTRIMAGE_FORMAT f=(PTRIMAGE_FORMAT) ImageIO_alloc(sizeof(IMAGE_FORMAT));
+
+  f->testImageFormat=&testInrimageHeader;
+  f->readImageHeader=&readInrimageHeader;
+  f->writeImage=&writeInrimage;
+  strcpy(f->fileExtension,".inr,.inr.gz,.gradient,.gradient.gz,.gradient_direction,.gradient_direction.gz");
+  strcpy(f->realName,"Inrimage");
+  return f;
+}
diff --git a/3rdparty/CGAL/include/CGAL/ImageIO/iris.h b/3rdparty/CGAL/include/CGAL/ImageIO/iris.h
new file mode 100644
index 0000000..4144eef
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/ImageIO/iris.h
@@ -0,0 +1,37 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+#ifndef IRIS_H
+#define IRIS_H
+
+#include <CGAL/ImageIO.h>
+
+
+
+PTRIMAGE_FORMAT createIrisFormat();
+int readIrisImage( const char *name, _image *im );
+int testIrisHeader(char *magic,const char *name);
+
+#ifdef CGAL_HEADER_ONLY
+#include <CGAL/ImageIO/iris_impl.h>
+#endif // CGAL_HEADER_ONLY
+
+#endif
diff --git a/3rdparty/CGAL/include/CGAL/ImageIO/iris_impl.h b/3rdparty/CGAL/include/CGAL/ImageIO/iris_impl.h
new file mode 100644
index 0000000..e3b370d
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/ImageIO/iris_impl.h
@@ -0,0 +1,499 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+/*
+ * xviris.c - load routine for IRIS 'rgb' format pictures
+ *
+ * LoadIRIS()
+ * WriteIRIS()
+ */
+
+#ifdef CGAL_HEADER_ONLY
+#define CGAL_INLINE_FUNCTION inline
+#else
+#define CGAL_INLINE_FUNCTION
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+
+
+
+/** Magic header for RGB files */
+#define IRIS_MAGIC 0732
+
+
+
+typedef unsigned char byte;
+
+#define BPPMASK			0x00ff
+#define ITYPE_VERBATIM		0x0000
+#define ITYPE_RLE		0x0100
+#define ISRLE(type)		(((type) & 0xff00) == ITYPE_RLE)
+#define ISVERBATIM(type)	(((type) & 0xff00) == ITYPE_VERBATIM)
+#define BPP(type)		((type) & BPPMASK)
+#define RLE(bpp)		(ITYPE_RLE | (bpp))
+#define VERBATIM(bpp)		(ITYPE_VERBATIM | (bpp))
+
+
+
+
+
+
+#define TAGLEN	(5)
+
+#define RINTLUM (79)
+#define GINTLUM (156)
+#define BINTLUM (21)
+
+#define OFFSET_R	3	/* this is byte order dependent */
+#define OFFSET_G	2
+#define OFFSET_B	1
+#define OFFSET_A	0
+
+#define ILUM(r,g,b)     ((int)(RINTLUM*(r)+GINTLUM*(g)+BINTLUM*(b))>>8)
+#define CHANOFFSET(z)	(3-(z))	/* this is byte order dependent */
+
+static byte    *getimagedata  (const _image *im, unsigned short, int, int, int);
+static void     interleaverow (byte *, byte *, int, int);
+static void     expandrow     (byte *, byte *, int);
+static void     readtab       (const _image *im, unsigned long *, int);
+static void     addimgtag     (byte *, int, int);
+
+
+static unsigned short  getshort      (const _image *im);
+static unsigned long   getlong       (const _image *im);
+
+
+CGAL_INLINE_FUNCTION
+int testIrisHeader(char *magic,const char *) {
+  if((((unsigned char *)magic)[0]<<8) + ((unsigned char *)magic)[1]
+     == IRIS_MAGIC)
+    return 0;
+  else 
+    return -1;
+}
+
+CGAL_INLINE_FUNCTION
+PTRIMAGE_FORMAT createIrisFormat() {
+  PTRIMAGE_FORMAT f=(PTRIMAGE_FORMAT) ImageIO_alloc(sizeof(IMAGE_FORMAT));
+
+  f->testImageFormat=&testIrisHeader;
+  f->readImageHeader=&readIrisImage;
+  f->writeImage=0;
+  strcpy(f->fileExtension,".rgb");
+  strcpy(f->realName,"IRIS");
+  return f;
+}
+
+
+
+/******************************************/
+static void interleaverow(byte *lptr, byte *cptr, int z, int n)
+{
+  lptr += z;
+  while(n--) {
+    *lptr = *cptr++;
+    lptr += 4;
+  }
+}
+
+
+/******************************************/
+static void expandrow(byte *optr, byte *iptr, int z)
+{
+  byte pixel, count;
+
+  optr += z;
+  while (1) {
+    pixel = *iptr++;
+    if ( !(count = (pixel & 0x7f)) ) return;
+    if (pixel & 0x80) {
+      while (count>=8) {
+	optr[0*4] = iptr[0];
+	optr[1*4] = iptr[1];
+	optr[2*4] = iptr[2];
+	optr[3*4] = iptr[3];
+	optr[4*4] = iptr[4];
+	optr[5*4] = iptr[5];
+	optr[6*4] = iptr[6];
+	optr[7*4] = iptr[7];
+	optr += 8*4;
+	iptr += 8;
+	count = byte(count - 8);
+      }
+      while(count--) {
+	*optr = *iptr++;
+	optr+=4;
+      }
+    }
+    else {
+      pixel = *iptr++;
+      while(count>=8) {
+	optr[0*4] = pixel;
+	optr[1*4] = pixel;
+	optr[2*4] = pixel;
+	optr[3*4] = pixel;
+	optr[4*4] = pixel;
+	optr[5*4] = pixel;
+	optr[6*4] = pixel;
+	optr[7*4] = pixel;
+	optr += 8*4;
+	count = byte(count - 8);
+      }
+      while(count--) {
+	*optr = pixel;
+	optr+=4;
+      }
+    }
+  }
+}
+
+/****************************************************/
+static void readtab(const _image *im, unsigned long *tab, int n)
+{
+  while (n) {
+    *tab++ = getlong(im);
+    n--;
+  }
+}
+
+
+/*****************************************************/
+static void addimgtag(byte *dptr, int xsize, int ysize)
+{
+  /* this is used to extract image data from core dumps. 
+     I doubt this is necessary...  --jhb */
+
+  dptr    = dptr + (xsize * ysize * 4);
+  dptr[0] = 0x12;  dptr[1] = 0x34;  dptr[2] = 0x56;  dptr[3] = 0x78;
+  dptr += 4;
+
+  dptr[0] = 0x59;  dptr[1] = 0x49;  dptr[2] = 0x33;  dptr[3] = 0x33;
+  dptr += 4;
+
+  dptr[0] = 0x69;  dptr[1] = 0x43;  dptr[2] = 0x42;  dptr[3] = 0x22;
+  dptr += 4;
+
+  dptr[0] = byte((xsize>>24)&0xff);
+  dptr[1] = byte((xsize>>16)&0xff);
+  dptr[2] = byte((xsize>> 8)&0xff);
+  dptr[3] = byte((xsize    )&0xff);
+  dptr += 4;
+
+  dptr[0] = byte((ysize>>24)&0xff);
+  dptr[1] = byte((ysize>>16)&0xff);
+  dptr[2] = byte((ysize>> 8)&0xff);
+  dptr[3] = byte((ysize    )&0xff);
+}
+
+/* byte order independent read/write of shorts and longs. */
+/*****************************************************/
+static unsigned short getshort( const _image *im)
+{
+  byte buf[2];
+  ImageIO_read( im, buf, (size_t) 2);
+  return (unsigned short)((buf[0]<<8)+(buf[1]<<0));
+}
+
+/*****************************************************/
+static unsigned long getlong( const _image *im )
+{
+  byte buf[4];
+  ImageIO_read( im, buf, (size_t) 4);
+  return (((unsigned long) buf[0])<<24) + (((unsigned long) buf[1])<<16)
+       + (((unsigned long) buf[2])<<8) + buf[3];
+}
+
+/*****************************************************/
+CGAL_INLINE_FUNCTION
+int readIrisImage( const char *, _image *im ) {
+  byte   *rawdata, *rptr;
+  byte   *pic824,  *bptr, *iptr;
+  std::size_t i, j, size;
+  unsigned short imagic, type;
+  unsigned int xsize, ysize, zsize;
+
+
+  /* read header information from file */
+  imagic = getshort( im );
+  type   = getshort( im );
+  getshort( im );
+  xsize  = getshort( im );
+  ysize  = getshort( im );
+  zsize  = getshort( im );
+
+  if ( ImageIO_error(im) ) return( 0 );
+
+  if (imagic != IRIS_MAGIC) return( 0 );
+
+  rawdata = getimagedata(im, type, xsize, ysize, zsize);
+  if (!rawdata) return( 0 );
+
+  if ( ImageIO_error(im) ) return( 0 );   /* probably truncated file */
+
+
+  /*  t1=texture_alloc();
+  (void) strcpy(t1->name,fname);
+  t1->type=IRIS;
+  
+  t1->nrows = ysize;
+  t1->ncols = xsize;
+    
+  t1->image = create_int_array(t1->nrows,t1->ncols);*/
+
+  /* got the raw image data.  Convert to an XV image (1,3 bytes / pix) */
+  if (zsize < 3) 
+    {  /* grayscale */
+      im->xdim = xsize;
+      im->ydim = ysize;
+      im->zdim = 1;
+      im->vdim = 1;
+      im->wdim = 1;
+      im->wordKind = WK_FIXED;
+      im->sign = SGN_UNSIGNED;
+      im->data = ImageIO_alloc(xsize * ysize);
+
+      pic824 = (byte *) ImageIO_alloc((size_t) xsize * ysize);
+      if (!pic824) exit(-1);
+      
+      /* copy plane 3 from rawdata into pic824, inverting pic vertically */
+      for (i = 0, bptr = pic824; i < ysize; i++)
+	{
+	  rptr = rawdata + 3 + ((ysize - 1) - i) * (xsize * 4);
+	  for (j = 0; j < xsize; j++, bptr++, rptr += 4)
+	    *bptr = *rptr;
+	}
+      
+      
+      size = im->xdim * im->ydim;
+      for (bptr = pic824, iptr = (unsigned char *) im->data,
+	     i = 0; i < size; ++i, ++iptr, ++bptr)
+	{
+	  *iptr = *bptr;
+	}
+      
+      ImageIO_free(pic824);
+    
+  }
+
+  else {  /* truecolor */
+    im->xdim = xsize;
+    im->ydim = ysize;
+    im->zdim = zsize / 3;
+    im->vdim = 4;
+    im->wdim = 1;
+    im->wordKind = WK_FIXED;
+    im->sign = SGN_UNSIGNED;
+    im->data = ImageIO_alloc(xsize * ysize * im->zdim * 4);
+
+    pic824 = (byte *) ImageIO_alloc((size_t) xsize * ysize * 3);
+    if (!pic824) 
+      exit(1);
+    
+    /* copy plane 3 from rawdata into pic824, inverting pic vertically */
+    for (i = 0, bptr = pic824; i< ysize; i++)
+      {
+	rptr = rawdata + ((ysize - 1) - i) * (xsize * 4);
+
+	for (j=0; j< xsize; j++, rptr += 4) {
+	  *bptr++ = rptr[3];
+	  *bptr++ = rptr[2];
+	  *bptr++ = rptr[1];
+	}
+      }
+    
+    
+    size = im->xdim * im->ydim;
+    for (bptr = pic824, iptr = (unsigned char *) im->data, i = 0;
+	 i < size; ++i, iptr += 4, bptr += 3)
+      {
+	if ( _getEndianness() == END_LITTLE ) {
+	  iptr[0] = 0xFF;
+	  iptr[1] = bptr[2];
+	  iptr[2] = bptr[1];
+	  iptr[3] = bptr[0];
+	}
+	else {
+	  iptr[0] = bptr[0];
+	  iptr[1] = bptr[1];
+	  iptr[2] = bptr[2];
+	  iptr[3] = 0xFF;
+	}
+      }
+      ImageIO_free(pic824);
+  }
+
+  ImageIO_free(rawdata);
+
+  return 1;
+}     
+
+
+
+
+/****************************************************/
+static byte *getimagedata(const _image *im, unsigned short type, int xsize, int ysize,
+			  int zsize)
+{
+  /* read in a B/W RGB or RGBA iris image file and return a 
+     pointer to an array of 4-byte pixels, arranged ABGR, NULL on error */
+
+  byte   *base, *lptr;
+  byte   *verdat;
+  int     y, z, tablen;
+  int     bpp, rle, badorder;
+  int     rlebuflen;
+  byte *rledat;
+  unsigned long *starttab, *lengthtab, cur;
+
+
+  rle     = ISRLE(type);
+  bpp     = BPP(type);
+
+  if (bpp != 1) {
+    return (byte *) NULL;
+  }
+
+  if (rle) {
+
+    rlebuflen = 2 * xsize + 10;
+    tablen    = ysize * zsize;
+    starttab  = (unsigned long *) ImageIO_alloc((size_t) tablen * sizeof(long));
+    lengthtab = (unsigned long *) ImageIO_alloc((size_t) tablen * sizeof(long));
+    rledat    = (byte *)   ImageIO_alloc((size_t) rlebuflen);
+
+    if (!starttab || !lengthtab || !rledat) 
+      exit(1);
+
+    ImageIO_seek( im, 512L, SEEK_SET );
+    readtab(im, starttab,  tablen);
+    readtab(im, lengthtab, tablen);
+
+    if ( ImageIO_error(im) ) {
+      ImageIO_free(starttab);  ImageIO_free(lengthtab);  ImageIO_free(rledat);
+      return (byte *) NULL;
+    }
+
+
+    /* check data order */
+    cur = 0;
+    badorder = 0;
+    for (y=0; y<ysize && !badorder; y++) {
+      for (z=0; z<zsize && !badorder; z++) {
+	if (starttab[y+z*ysize] < cur) badorder = 1;
+	else cur = starttab[y+z*ysize];
+      }
+    }
+
+    ImageIO_seek( im, (long) (512 + 2*tablen*4), 0);
+
+    cur = 512 + 2*tablen*4;
+
+    base = (byte *) ImageIO_alloc((size_t) (xsize*ysize+TAGLEN) * 4);
+    if (!base) 
+      exit(1);
+
+    addimgtag(base,xsize,ysize);
+
+    if (badorder) {
+      for (z=0; z<zsize; z++) {
+	lptr = base;
+	for (y=0; y<ysize; y++) {
+	  if (cur != starttab[y+z*ysize]) {
+	    ImageIO_seek( im, (long) starttab[y+z*ysize], 0);
+	    cur = starttab[y+z*ysize];
+	  }
+
+	  if (lengthtab[y+z*ysize]>(unsigned long)rlebuflen) {
+	    ImageIO_free(starttab); ImageIO_free(lengthtab); ImageIO_free(rledat); ImageIO_free(base);
+	    return (byte *) NULL;
+	  }
+	  ImageIO_read(im, rledat, (size_t) lengthtab[y+z*ysize]);
+	  cur += lengthtab[y+z*ysize];
+	  expandrow(lptr,rledat,3-z);
+	  lptr += (xsize * 4);
+	}
+      }
+    }
+    else {
+      lptr = base;
+      for (y=0; y<ysize; y++) {
+	for (z=0; z<zsize; z++) {
+	  if (cur != starttab[y+z*ysize]) {
+	    ImageIO_seek( im, (long) starttab[y+z*ysize], 0);
+	    cur = starttab[y+z*ysize];
+	  }
+	  
+	  ImageIO_read(im, rledat, (size_t) lengthtab[y+z*ysize]);
+	  cur += lengthtab[y+z*ysize];
+	  expandrow(lptr,rledat,3-z);
+	}
+	lptr += (xsize * 4);
+      }
+    }
+
+    ImageIO_free(starttab);
+    ImageIO_free(lengthtab);
+    ImageIO_free(rledat);
+    return base;
+  }      /* end of RLE case */
+
+  else {  /* not RLE */
+    verdat = (byte *) ImageIO_alloc((size_t) xsize);
+    base   = (byte *) ImageIO_alloc((size_t) (xsize*ysize+TAGLEN) * 4);
+    if (!base || !verdat) 
+      exit(1);
+
+    addimgtag(base,xsize,ysize);
+
+    ImageIO_seek( im, 512L,0);
+
+    for (z=0; z<zsize; z++) {
+      lptr = base;
+      for (y=0; y<ysize; y++) {
+	ImageIO_read(im, verdat, (size_t) xsize);
+	interleaverow(lptr,verdat,3-z,xsize);
+	lptr += (xsize * 4);
+      }
+    }
+
+    ImageIO_free(verdat);
+    return base;
+  }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/3rdparty/CGAL/include/CGAL/ImageIO/mincio.h b/3rdparty/CGAL/include/CGAL/ImageIO/mincio.h
new file mode 100644
index 0000000..369b842
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/ImageIO/mincio.h
@@ -0,0 +1,77 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+#ifndef MINCIO_H
+#define MINCIO_H
+
+#ifdef MINC_FILES
+
+#include <CGAL/ImageIO.h>
+#include <minc.h>
+
+
+/** read an image from a minc file
+    @param im image structure
+    @param name image file name
+    @param startx returned X coordinate of origin vertor
+    @param starty returned Y coordinate of origin vertor
+    @param startz returned Z coordinate of origin vertor
+    @param stepx returned X coordinate of step vertor
+    @param stepy returned Y coordinate of step vertor
+    @param stepz returned Z coordinate of step vertor
+    @param Xcosine 3 dimensional array containing X axis cosine directions
+    @param Ycosine 3 dimensional array containing Y axis cosine directions
+    @param Zcosine 3 dimensional array containing Z axis cosine directions
+    @return a negative value in case of failure */
+int readMincHeader(_image *im, const char* name,
+		   double *startx, double *starty, double *startz,
+		   double *stepx, double *stepy, double *stepz,
+		   double *Xcosine, double *Ycosine, double *Zcosine);
+
+/** write an image in a minc file
+    @param im image structure
+    @param name image file name
+    @param sourceName original minc file name
+    @param startx origin X coordinate
+    @param starty origin Y coordinate
+    @param startz origin Z coordinate
+    @param stepx returned X coordinate of step vertor
+    @param stepy returned Y coordinate of step vertor
+    @param stepz returned Z coordinate of step vertor
+    @param Xcosine 3 dimensional array containing X axis cosine directions
+    @param Ycosine 3 dimensional array containing Y axis cosine directions
+    @param Zcosine 3 dimensional array containing Z axis cosine directions
+    @param range 2 dimensional array containing min an max image intensity
+    @return a negative value in case of failure */
+int writeMincFile( const _image* im, const char *name, const char *sourceName,
+		   double startx, double starty, double startz,
+		   double stepx, double stepy, double stepz,
+		   const double *Xcosine, const double *Ycosine,
+		   const double *Zcosine, const double *range );
+
+
+#endif
+
+#ifdef CGAL_HEADER_ONLY
+#include <CGAL/ImageIO/mincio_impl.h>
+#endif // CGAL_HEADER_ONLY
+
+#endif
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/mincio_impl.h b/3rdparty/CGAL/include/CGAL/ImageIO/mincio_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL_ImageIO/mincio_impl.h
rename to 3rdparty/CGAL/include/CGAL/ImageIO/mincio_impl.h
diff --git a/3rdparty/CGAL/include/CGAL/ImageIO/pnm.h b/3rdparty/CGAL/include/CGAL/ImageIO/pnm.h
new file mode 100644
index 0000000..0659c9c
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/ImageIO/pnm.h
@@ -0,0 +1,46 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+#ifndef PNM_H
+#define PNM_H
+
+#include <stdio.h>
+
+#include <CGAL/ImageIO.h>
+
+
+int readPpmImage(const char *name,_image *im);
+int writePpmImage(char *name, _image *im);
+int readPgmAsciiImage(const char *name,_image *im);
+int readPgmImage(const char *name,_image *im);
+int writePgmImage(char *name,  _image *im);
+int testPgmAsciiHeader(char *magic,const char *name);
+int testPgmHeader(char *magic,const char *name);
+int testPpmHeader(char *magic,const char *name);
+PTRIMAGE_FORMAT createPgmFormat();
+PTRIMAGE_FORMAT createPgmAscIIFormat();
+PTRIMAGE_FORMAT createPpmFormat();
+
+#ifdef CGAL_HEADER_ONLY
+#include <CGAL/ImageIO/pnm_impl.h>
+#endif // CGAL_HEADER_ONLY
+
+#endif
diff --git a/3rdparty/CGAL/include/CGAL/ImageIO/pnm_impl.h b/3rdparty/CGAL/include/CGAL/ImageIO/pnm_impl.h
new file mode 100644
index 0000000..2f45b47
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/ImageIO/pnm_impl.h
@@ -0,0 +1,643 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+#ifdef CGAL_HEADER_ONLY
+#define CGAL_INLINE_FUNCTION inline
+#else
+#define CGAL_INLINE_FUNCTION
+#endif
+
+#ifdef _MSC_VER
+#pragma warning ( disable : 4068 4786 4081 )
+#endif
+
+#include <string.h>
+#include <sstream>
+
+#include <CGAL/ImageIO/fgetns.h>
+
+
+
+
+/** pnm - portable anymap file format */
+/** Magic header for pgm - portable graymap file format */
+#define PGM_ASCII_MAGIC "P2"
+#define PGM_MAGIC "P5"
+
+/** Magic header for ppm - portable pixmap file format */
+#define PPM_MAGIC "P6"
+
+
+
+#define _LGTH_STRING_ 1024
+
+
+CGAL_INLINE_FUNCTION
+int testPpmHeader(char *magic,const char *) {
+  if( !strncmp(magic, PPM_MAGIC, strlen(PPM_MAGIC))) 
+    return 0;
+  else 
+    return -1;
+}
+CGAL_INLINE_FUNCTION
+int testPgmHeader(char *magic,const char *) {
+  if (( !strncmp(magic, PGM_MAGIC, strlen(PGM_MAGIC))))
+    return 0;
+  else 
+    return -1;
+}
+CGAL_INLINE_FUNCTION
+int testPgmAsciiHeader(char *magic,const char *) {
+  if  ( !strncmp(magic, PGM_ASCII_MAGIC, strlen(PGM_ASCII_MAGIC)))
+    return 0;
+  else 
+    return -1;
+}
+
+CGAL_INLINE_FUNCTION
+PTRIMAGE_FORMAT createPgmFormat() {
+  PTRIMAGE_FORMAT f=(PTRIMAGE_FORMAT) ImageIO_alloc(sizeof(IMAGE_FORMAT));
+
+  f->testImageFormat=&testPgmHeader;
+  f->readImageHeader=&readPgmImage;
+  f->writeImage=&writePgmImage;
+  strcpy(f->fileExtension,".pgm,.pgm.gz");
+  strcpy(f->realName,"Pgm");
+  return f;
+}
+
+CGAL_INLINE_FUNCTION
+PTRIMAGE_FORMAT createPgmAscIIFormat() {
+  PTRIMAGE_FORMAT f=(PTRIMAGE_FORMAT) ImageIO_alloc(sizeof(IMAGE_FORMAT));
+
+  f->testImageFormat=&testPgmAsciiHeader;
+  f->readImageHeader=&readPgmAsciiImage;
+  f->writeImage=&writePgmImage;
+  strcpy(f->fileExtension,".pgm,.pgm.gz");
+  strcpy(f->realName,"Pgm-ASCII");
+  return f;
+}
+
+CGAL_INLINE_FUNCTION
+PTRIMAGE_FORMAT createPpmFormat() {
+  PTRIMAGE_FORMAT f=(PTRIMAGE_FORMAT) ImageIO_alloc(sizeof(IMAGE_FORMAT));
+
+  f->testImageFormat=&testPpmHeader;
+  f->readImageHeader=&readPpmImage;
+  f->writeImage=&writePpmImage;
+  strcpy(f->fileExtension,".ppm,.ppm.gz");
+  strcpy(f->realName,"Ppm");
+  return f;
+}
+
+
+/*
+       The  portable pixmap format is a lowest common denominator
+       color image file format.
+
+       The definition is as follows:
+
+       - A  "magic  number" for identifying the file type.  A pgm
+         file's magic number is the two characters "P6".
+
+       - Whitespace (blanks, TABs, CRs, LFs).
+
+       - A width, formatted as ASCII characters in decimal.
+
+       - Whitespace.
+
+       - A height, again in ASCII decimal.
+       - Whitespace.
+
+       - The maximum color value (Maxval), again in  ASCII  deci-
+         mal.  Must be less than 65536.
+
+       - Newline or other single whitespace character.
+
+       - A  raster  of  Width * Height pixels, proceeding through
+         the image in normal English reading order.   Each  pixel
+         is  a  triplet  of red, green, and blue samples, in that
+         order.  Each sample is represented  in  pure  binary  by
+         either 1 or 2 bytes.  If the Maxval is less than 256, it
+         is 1 byte.  Otherwise, it is 2 bytes.  The most signifi-
+         cant byte is first.
+
+       - In the raster, the sample values are proportional to the
+         intensity of the CIE Rec. 709 red, green,  and  blue  in
+         the pixel.  A value of Maxval for all three samples rep-
+         resents CIE D65 white and the most intense color in  the
+         color  universe  of  which  the image is part (the color
+         universe is all the colors in all images to  which  this
+         image might be compared).
+
+       - Characters  from  a  "#" to the next end-of-line, before
+         the maxval line, are comments and are ignored.
+
+*/
+CGAL_INLINE_FUNCTION
+int readPpmImage(const char *name,_image *im)
+{
+  char string[256];
+  int x=0, y=0;
+  int max=0;
+  
+  fgetns( string, 255, im );
+  if ( strncmp(string, PPM_MAGIC, strlen(PPM_MAGIC) ) ) {
+    fprintf( stderr, "readPpmImage: bad magic string in \'%s\'\n", name );
+    return( -1 );
+  }
+  
+  do {
+    fgetns( string, 255, im );
+
+    if ( string[0] != '#' ) {
+      if ( x == 0 && y == 0 ) {
+	sscanf( string, "%d %d", &x, &y );
+      }
+      else if ( max == 0 ) {
+	sscanf( string, "%d", &max );
+      }
+    }
+  } while ( max == 0 );
+
+
+  im->xdim = static_cast<std::size_t>(x);
+  im->ydim = static_cast<std::size_t>(y);
+  im->zdim = 1;
+  im->vdim = 3;
+
+  im->wordKind = WK_FIXED;
+  im->sign = SGN_UNSIGNED;
+
+  if ( max < 256 ) im->wdim = 1;
+  else if ( max < 65536 ) {
+    im->wdim = 2;
+    fprintf( stderr, "readPpmImage: Warning, data of \'%s\' may have to be swapped\n", name );
+  }
+  else {
+    fprintf( stderr, "readPpmImage: max value too large (%d) in \'%s\'\n", max, name );
+    return( -1 );
+  }
+  im->data = ImageIO_alloc( x*y*3 );		     
+  
+  ImageIO_read( im, im->data,  x*y*3 );
+  
+  return 1;
+}
+
+CGAL_INLINE_FUNCTION
+int writePpmImage( char *name,_image *im )
+{
+  std::ostringstream string;
+  int max;
+  unsigned int i;
+
+  if ( im->xdim <= 0 || im->ydim <= 0 || im->zdim != 1 || im->vdim != 3 ) {
+    fprintf( stderr, "writePpmImage: bad dimensions, unable to write '%s'\n", name );
+    return -1;
+  }
+  if ( im->wordKind != WK_FIXED || im->sign != SGN_UNSIGNED 
+       || ( im->wdim != 1 && im->wdim != 2 ) ) {
+    fprintf( stderr, "writePpmImage: bad type, unable to write '%s'\n", name );
+    return -1;  
+  }
+  
+  _openWriteImage( im, name );
+  
+  if(!im->fd) {
+    fprintf(stderr, "writeInrimage: error: unable to open file \'%s\'\n", name );
+    return ImageIO_OPENING;
+  }
+
+  string << PPM_MAGIC << "\n";
+  string << "# CREATOR: pnm.c $Revision$ $Date$\n";
+  string << im->xdim << " " << im->ydim << "\n";
+
+  max = 0;
+  switch ( im->wdim ) {
+  case 1 :
+    {
+      unsigned char *buf = (unsigned char *)im->data;
+      for ( i=0; i<im->xdim*im->ydim*3; i++, buf++ )
+	if ( max < *buf ) max = *buf;
+    }
+    break;
+  case 2 :
+    {
+      unsigned short *buf = (unsigned short *)im->data;
+      for ( i=0; i<im->xdim*im->ydim*3; i++, buf++ )
+	if ( max < *buf ) max = *buf;
+    }
+    break;
+  }
+
+  if ( max == 0 ) max = 1;
+  string << max << "\n";
+  ImageIO_write(im, string.str().data(), string.str().length());
+
+  if ( im->wdim == 1 || ( im->wdim == 2 && max > 255 ) ) {
+    ImageIO_write( im, im->data, im->xdim*im->ydim*3*im->wdim );
+  }
+  else {
+    /* 2 octets, but max <= 255
+       has to be converted on one octet
+    */
+    unsigned short *buf = (unsigned short *)im->data;
+    unsigned char *tmp = (unsigned char *)ImageIO_alloc( im->xdim*im->ydim*3 );
+    if ( tmp == NULL ) {
+      fprintf( stderr, "writePpmImage: unable to allocate auxiliary buffer\n" );
+      return -1; 
+    }
+    for ( i=0; i<im->xdim*im->ydim*3; i++, buf++ )
+      tmp[i] = (unsigned char)*buf;
+    ImageIO_write( im, tmp, im->xdim*im->ydim*3 );
+    ImageIO_free( tmp );
+  }
+  ImageIO_close( im );
+  im->openMode = OM_CLOSE;
+  return 1;
+}
+
+
+
+/*
+       The portable graymap format is a lowest common denominator
+       grayscale file format.  The definition is as follows:
+
+       - A "magic number" for identifying the file type.   A  pgm
+         file's magic number is the two characters "P2".
+
+       - Whitespace (blanks, TABs, CRs, LFs).
+
+       - A width, formatted as ASCII characters in decimal.
+
+       - Whitespace.
+       - A height, again in ASCII decimal.
+
+       - Whitespace.
+
+       - The maximum gray value (Maxval), again in ASCII decimal.
+         Must be less than 65536.
+
+       - Newline or other single whitespace character.
+
+       - A raster of  Width  *  Height  gray  values,  proceeding
+         through the image in normal English reading order.  Each
+         gray value is a number from 0  through  Maxval,  with  0
+         being  black and Maxval being white.  Each gray value is
+         represented in pure binary by either 1 or 2  bytes.   If
+         the  Maxval  is less than 256, it is 1 byte.  Otherwise,
+         it is 2 bytes.  The most significant byte is first.
+
+       - Characters from a "#" to the  next  end-of-line,  before
+         the maxval line, are comments and are ignored.
+*/
+CGAL_INLINE_FUNCTION
+int readPgmAsciiImage(const char *name,_image *im)
+{
+  char string[256];
+  int x=0, y=0;
+  int max=0;
+
+  int n;
+  char *tmp;
+  int iv;
+
+  fgetns( string, 255, im );
+  if ( strncmp(string, PGM_ASCII_MAGIC, strlen(PGM_ASCII_MAGIC) ) ) {
+    fprintf( stderr, "readAsciiPgmImage: bad magic string in \'%s\'\n", name );
+    return( -1 );
+  }
+  
+  do {
+    fgetns( string, 255, im );
+
+    if ( string[0] != '#' ) {
+      if ( x == 0 && y == 0 ) {
+	sscanf( string, "%d %d", &x, &y );
+      }
+      else if ( max == 0 ) {
+	sscanf( string, "%d", &max );
+      }
+    }
+  } while ( max == 0 );
+
+  im->xdim = x;
+  im->ydim = y;
+  im->zdim = 1;
+  im->vdim = 1;
+
+  im->wordKind = WK_FIXED;
+  im->sign = SGN_UNSIGNED;
+
+  if ( max < 256 ) im->wdim = 1;
+  else if ( max < 65536 ) {
+    im->wdim = 2;
+  }
+  else {
+    fprintf( stderr, "readAsciiPgmImage: max value too large (%d) in \'%s\'\n", max, name );
+    return( -1 );
+  }
+  im->data = ImageIO_alloc( x*y );		     
+  
+  n=0;
+
+  while( fgetns( string, 255, im ) != 0 && n < x*y ) {
+    tmp = string;
+    while ( *tmp != '\n' && *tmp != '\0' && *tmp != EOF && n < x*y ) {
+      /* skip trailing whitespace
+       */
+      while ( *tmp == ' ' || *tmp == '\t' )
+	tmp++;
+      if ( *tmp == '\0' || *tmp == '\n' || *tmp == EOF )
+	continue;
+      
+      /* read a number
+       */
+      switch ( im->wordKind ) {
+      case WK_FIXED :
+	if ( sscanf( tmp, "%d", &iv ) != 1 ) {
+	  fprintf( stderr, "readAsciiPgmImage: error in reading ascii data\n" );
+	  ImageIO_free( im->data ); im->data = NULL;
+	  return 0;
+	}
+	break;
+      default :
+	ImageIO_free( im->data ); im->data = NULL;
+	return 0;
+      }
+	  
+      if ( im->wdim == 1 ) {
+	unsigned char *buf = (unsigned char *)im->data;
+	buf += n;
+	if ( iv < 0 )        *buf = (unsigned char)0;
+	else if ( iv > 255 ) *buf = (unsigned char)255;
+	else                 *buf = (unsigned char)iv;
+	n ++;
+      }
+      else if ( im->wdim == 2 ) {
+	unsigned short int *buf = (unsigned short int *)im->data;
+	buf += n;
+	if ( iv < 0 )          *buf = (unsigned short int)0;
+	else if ( iv > 65535 ) *buf = (unsigned short int)65535;
+	else                   *buf = (unsigned short int)iv;
+	n ++;
+      }
+      else {
+	fprintf( stderr, "readAsciiPgmImage: word im not handled\n" );
+	ImageIO_free( im->data ); im->data = NULL;
+	return 0;
+      }
+      
+      /* skip a number 
+       */
+      while ( (*tmp >= '0' && *tmp <= '9') || *tmp == '.' || *tmp == '-' )
+	tmp++;
+    }
+  }
+
+  
+  return 1;
+}
+
+
+
+
+/*
+       The portable graymap format is a lowest common denominator
+       grayscale file format.  The definition is as follows:
+
+       - A "magic number" for identifying the file type.   A  pgm
+         file's magic number is the two characters "P5".
+
+       - Whitespace (blanks, TABs, CRs, LFs).
+
+       - A width, formatted as ASCII characters in decimal.
+
+       - Whitespace.
+       - A height, again in ASCII decimal.
+
+       - Whitespace.
+
+       - The maximum gray value (Maxval), again in ASCII decimal.
+         Must be less than 65536.
+
+       - Newline or other single whitespace character.
+
+       - A raster of  Width  *  Height  gray  values,  proceeding
+         through the image in normal English reading order.  Each
+         gray value is a number from 0  through  Maxval,  with  0
+         being  black and Maxval being white.  Each gray value is
+         represented in pure binary by either 1 or 2  bytes.   If
+         the  Maxval  is less than 256, it is 1 byte.  Otherwise,
+         it is 2 bytes.  The most significant byte is first.
+
+       - Characters from a "#" to the  next  end-of-line,  before
+         the maxval line, are comments and are ignored.
+*/
+CGAL_INLINE_FUNCTION
+int readPgmImage(const char *name,_image *im)
+{
+  
+  char string[256];
+  int x=0, y=0;
+  int max=0;
+  
+  fgetns( string, 255, im );
+  if ( strncmp(string, PGM_MAGIC, strlen(PGM_MAGIC) ) ) {
+    fprintf( stderr, "readPgmImage: bad magic string in \'%s\'\n", name );
+    return( -1 );
+  }
+  
+  do {
+    fgetns( string, 255, im );
+
+    if ( string[0] != '#' ) {
+      if ( x == 0 && y == 0 ) {
+	sscanf( string, "%d %d", &x, &y );
+      }
+      else if ( max == 0 ) {
+	sscanf( string, "%d", &max );
+      }
+    }
+  } while ( max == 0 );
+
+
+  im->xdim = x;
+  im->ydim = y;
+  im->zdim = 1;
+  im->vdim = 1;
+
+  im->wordKind = WK_FIXED;
+  im->sign = SGN_UNSIGNED;
+
+  if ( max < 256 ) im->wdim = 1;
+  else if ( max < 65536 ) {
+    im->wdim = 2;
+    fprintf( stderr, "readPgmImage: Warning, data of \'%s\' may have to be swapped\n", name );
+  }
+  else {
+    fprintf( stderr, "readPgmImage: max value too large (%d) in \'%s\'\n", max, name );
+    return( -1 );
+  }
+  im->data = ImageIO_alloc( x*y );		     
+  
+  ImageIO_read( im, im->data,  x*y );
+  
+  return 1;
+}
+
+CGAL_INLINE_FUNCTION
+int writePgmImage(char *name,_image *im  )
+{
+  char string[256];
+  int max;
+  unsigned int i;
+
+  if ( im->xdim <= 0 || im->ydim <= 0 || im->zdim != 1 || im->vdim != 1 ) {
+    fprintf( stderr, "writePgmImage: bad dimensions, unable to write '%s'\n", name );
+    return -1;
+  }
+  if ( im->wordKind != WK_FIXED || im->sign != SGN_UNSIGNED 
+       || ( im->wdim != 1 && im->wdim != 2 ) ) {
+    fprintf( stderr, "writePgmImage: bad type, unable to write '%s'\n", name );
+    return -1;  
+  }
+
+  if ( 0 )
+    im->dataMode = DM_ASCII;
+  
+  _openWriteImage( im, name );
+  
+  if(!im->fd) {
+    fprintf(stderr, "writePgmImage: error: unable to open file \'%s\'\n", name );
+    return ImageIO_OPENING;
+  }
+  
+  if ( im->dataMode == DM_ASCII ) 
+    sprintf( string, "%s\n", PGM_ASCII_MAGIC );
+  else 
+    sprintf( string, "%s\n", PGM_MAGIC );
+  
+  ImageIO_write( im, string, strlen( string ) );
+  sprintf( string, "# CREATOR: pnm.c $Revision$ $Date$\n" );
+  ImageIO_write( im, string, strlen( string ) );
+  sprintf( string, "%zu %zu\n", im->xdim, im->ydim );
+  ImageIO_write( im, string, strlen( string ) );
+  max = 0;
+  switch ( im->wdim ) {
+  case 1 :
+    {
+      unsigned char *buf = (unsigned char *)im->data;
+      for ( i=0; i<im->xdim*im->ydim; i++, buf++ )
+	if ( max < *buf ) max = *buf;
+    }
+    break;
+  case 2 :
+    {
+      unsigned short *buf = (unsigned short *)im->data;
+      for ( i=0; i<im->xdim*im->ydim; i++, buf++ )
+	if ( max < *buf ) max = *buf;
+    }
+    break;
+  }
+  /* max == 0 causes problems for xv */
+  if ( max == 0 ) max = 1;
+  sprintf( string, "%d\n", max );
+  ImageIO_write( im, string, strlen( string ) );
+
+  if ( im->dataMode == DM_ASCII ) {
+    std::size_t i, j, n, size;
+    char *str = (char*)ImageIO_alloc( _LGTH_STRING_+1 );
+    size = std::size_t(im->xdim) * im->ydim * im->zdim * im->vdim;
+    n = ( im->xdim < 16 ) ? im->xdim : 16;
+    i = 0;
+    switch( im->wdim ) {
+    default :
+      /* can not occur */
+      fprintf( stderr, "writePgmImage: bad type, unable to write '%s'\n", name );
+      ImageIO_close( im );
+      im->openMode = OM_CLOSE;
+      return -1;
+    case 1 :
+      {
+	unsigned char *theBuf = ( unsigned char * )im->data;
+	do {
+	  memset( str, 0, _LGTH_STRING_ );
+	  for ( j=0; j<n && i<size; j++, i++ ) {
+	    sprintf( str+strlen(str), "%d", theBuf[i] );
+	    if ( j<n && i<size ) sprintf( str+strlen(str), " " );
+	  }
+	  sprintf( str+strlen(str), "\n" );
+	  if ( ImageIO_write( im, str, strlen( str ) ) <= 0 ) {
+	    fprintf(stderr, "writePgmImage: error when writing data in \'%s\'\n", name );
+	    return( -3 );
+	  }
+	} while ( i < size );
+      }
+      break;
+    case 2 :
+      {
+	unsigned short int *theBuf = ( unsigned short int * )im->data;
+	do {
+	  memset( str, 0, _LGTH_STRING_ );
+	  for ( j=0; j<n && i<size; j++, i++ ) {
+	    sprintf( str+strlen(str), "%d", theBuf[i] );
+	    if ( j<n && i<size ) sprintf( str+strlen(str), " " );
+	  }
+	  sprintf( str+strlen(str), "\n" );
+	  if ( ImageIO_write( im, str, strlen( str ) ) <= 0 ) {
+	    fprintf(stderr, "writePgmImage: error when writing data in \'%s\'\n", name );
+	    return( -3 );
+	  }
+	} while ( i < size );
+      }
+      break;
+    }
+  }
+  else {
+    if ( im->wdim == 1 || ( im->wdim == 2 && max > 255 ) ) {
+      ImageIO_write( im, im->data, im->xdim*im->ydim*im->wdim );
+    }
+    else {
+      /* 2 octets, but max <= 255
+	 has to be converted on one octet
+      */
+      unsigned short *buf = (unsigned short *)im->data;
+      unsigned char *tmp = (unsigned char *)ImageIO_alloc( im->xdim*im->ydim );
+      if ( tmp == NULL ) {
+	fprintf( stderr, "writePgmImage: unable to allocate auxiliary buffer\n" );
+	return -1; 
+      }
+      for ( i=0; i<im->xdim*im->ydim; i++, buf++ )
+	tmp[i] = (unsigned char)*buf;
+      ImageIO_write( im, tmp, im->xdim*im->ydim );
+      ImageIO_free( tmp );
+    }
+  }
+
+  ImageIO_close( im );
+  im->openMode = OM_CLOSE;
+  return 1;
+}
+
+
+
diff --git a/3rdparty/CGAL/include/CGAL/ImageIO/recbuffer.h b/3rdparty/CGAL/include/CGAL/ImageIO/recbuffer.h
new file mode 100644
index 0000000..d7ba590
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/ImageIO/recbuffer.h
@@ -0,0 +1,203 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+/*************************************************************************
+ * recbuffer.h - tools for recursive filtering of 3D and 2D image buffers
+ *
+ * $Id$
+ *
+ * Copyright©INRIA 1999
+ *
+ * DESCRIPTION: 
+ *
+ *
+ *
+ * AUTHOR:
+ * Gregoire Malandain (greg at sophia.inria.fr)
+ * http://www.inria.fr/epidaure/personnel/malandain/
+ * 
+ * CREATION DATE: 
+ * June, 9 1998
+ *
+ * Copyright Gregoire Malandain, INRIA
+ *
+ * ADDITIONS, CHANGES
+ *
+ *
+ */
+
+
+#ifndef _recbuffer_h_
+#define _recbuffer_h_
+
+
+#include <CGAL/ImageIO/typedefs.h>
+#include <CGAL/ImageIO/recline.h>
+
+
+
+
+
+extern int GradientModulus( void *bufferIn, bufferType typeIn,
+			    void *bufferOut, bufferType typeOut,
+			    int *bufferDims, int *borderLengths,
+			    float *filterCoefs, recursiveFilterType filterType );
+extern int Laplacian_2D( void *bufferIn, bufferType typeIn,
+			 void *bufferOut, bufferType typeOut,
+			 int *bufferDims, int *borderLengths,
+			 float *filterCoefs, recursiveFilterType filterType );
+extern int Laplacian( void *bufferIn, bufferType typeIn,
+		      void *bufferOut, bufferType typeOut,
+		      int *bufferDims, int *borderLengths,
+		      float *filterCoefs, recursiveFilterType filterType );
+
+extern int GradientHessianGradient_2D( void *bufferIn, bufferType typeIn,
+			 void *bufferOut, bufferType typeOut,
+			 int *bufferDims, int *borderLengths,
+			 float *filterCoefs, recursiveFilterType filterType );
+extern int GradientHessianGradient( void *bufferIn, bufferType typeIn,
+		      void *bufferOut, bufferType typeOut,
+		      int *bufferDims, int *borderLengths,
+		      float *filterCoefs, recursiveFilterType filterType );
+
+
+
+
+
+/* Recursive filtering on 3D buffers.
+ *
+ * DESCRIPTION:
+ * Performs recursive filtering on 3D buffers.
+ * Each direction (X, Y or Z) is performed 
+ * independently (separability).
+ *
+ * A direction is filtered if there are enough
+ * points along this direction (at least 5),
+ * if the coefficient along this direction is 
+ * positive, and if the derivative's order along
+ * this direction is not NODERIVATIVE (see
+ * derivativeOrder).
+ *
+ * Once a line along a direction is extracted for
+ * filtering, one may want to add points at both 
+ * ends of the line to avoid cut-off effects. The
+ * value of each endpoint is repeated n times.
+ * Thus the length of the line is increased by 
+ * 2*n.
+ *
+ * PARAMETERS:
+ *
+ * - bufferDims[0] is the dimension along X,
+ *
+ *   bufferDims[1] is the dimension along Y,
+ *
+ *   bufferDims[2] is the dimension along Y.
+ *
+ * - borderLengths[0] is the number of points to be
+ *   added at both ends of each X line (if
+ *   positive). The value of each endpoint is 
+ *   repeated borderLengths[0] times to produce
+ *   a line of length 
+ *   bufferDims[0] + 2 * borderLengths[0].
+ *
+ *   borderLengths[1] is the number of points to be
+ *   added at both ends of each Y line.
+ *
+ *   borderLengths[2] is the number of points to be
+ *   added at both ends of each Z line.
+ *
+ * - derivatives[0] is the order of the derivative 
+ *   to be computed along direction X. 
+ *
+ *   derivatives[1] is the order of the derivative 
+ *   to be computed along direction Y. 
+ *
+ *   derivatives[2] is the order of the derivative 
+ *   to be computed along direction Z. 
+ *
+ * - filterCoefs[0] is the coefficient of the filter
+ *   to be applied along direction X. 
+ *
+ *   filterCoefs[1] is the coefficient of the filter
+ *   to be applied along direction Y. 
+ *
+ *   filterCoefs[2] is the coefficient of the filter
+ *   to be applied along direction Z. 
+ *
+ * - filterType is the type of recursive filter to
+ *   be applied to the 3D buffer.
+ *
+ * RETURN:
+ *
+ * - 0 in case of error
+ *
+ * - 1 if successful
+ *
+ * SEE ALSO:
+ *
+ * - bufferType.
+ *
+ * - derivativeOrder.
+ *
+ * - recursiveFilterType.
+ *
+ * - InitRecursiveCoefficients
+ */
+extern int RecursiveFilterOnBuffer( void *bufferIn, /* input buffer */
+				    bufferType typeIn, /* type of the input buffer */
+				    void *bufferOut, /* output buffer */
+				    bufferType typeOut, /* type of the output buffer */
+				    int *bufferDims, /* buffers' dimensions */
+				    int *borderLengths, /* number of points to be added at both ends */
+				    derivativeOrder *derivatives, /* order of derivatives to be computed */
+				    float *filterCoefs, /* coefficients of the filters to be applied */
+				    recursiveFilterType filterType /* type of the recursive filter to be applied */
+				    );
+
+
+
+/* Turn on verbose mode.
+ *
+ * DESCRIPTION:
+ * Some information will be written on stderr when processing.
+ * It will turn on the verbose mode of recline too, by 
+ * calling Recline_verbose();
+ */
+extern void Recbuffer_verbose ( );
+
+
+
+/* Turn off verbose mode.
+ *
+ * DESCRIPTION:
+ * Nothing will be written on stderr when processing.
+ * Exactly the contrary of Recbuffer_verbose ().
+ * It will turn off the verbose mode of recline too.
+ */
+extern void Recbuffer_noverbose ( );
+
+
+#ifdef CGAL_HEADER_ONLY
+#include <CGAL/ImageIO/recbuffer_impl.h>
+#endif // CGAL_HEADER_ONLY
+
+
+#endif /* _recbuffer_h_ */
diff --git a/3rdparty/CGAL/include/CGAL/ImageIO/recbuffer_impl.h b/3rdparty/CGAL/include/CGAL/ImageIO/recbuffer_impl.h
new file mode 100644
index 0000000..def419e
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/ImageIO/recbuffer_impl.h
@@ -0,0 +1,1743 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+/*************************************************************************
+ * recbuffer.c - tools for recursive filtering of 3D and 2D image buffers
+ *
+ * $Id$
+ *
+ * Copyright©INRIA 1999
+ *
+ * DESCRIPTION: 
+ *
+ * recursive filtering of a buffer (a [1,2,3]D array)
+ * according that the filtering is separable
+ *
+ *
+ *
+ * AUTHOR:
+ * Gregoire Malandain (greg at sophia.inria.fr)
+ * 
+ * CREATION DATE: 
+ * June, 9 1998
+ *
+ * Copyright Gregoire Malandain, INRIA
+ *
+ * ADDITIONS, CHANGES
+ *
+ * * Jul 6 1999 (Gregoire Malandain)
+ *   a bug in RecursiveFilterOnBuffer (*&%^@$^ cut and paste)
+ *
+ */
+
+#ifdef CGAL_HEADER_ONLY
+#define CGAL_INLINE_FUNCTION inline
+#else
+#define CGAL_INLINE_FUNCTION
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+#include <CGAL/ImageIO/convert.h>
+
+#ifdef CGAL_HEADER_ONLY
+
+inline int& get_static_verbose_recbuffer()
+{
+  static int _VERBOSE_ = 0;
+  return _VERBOSE_;
+}
+
+#else // CGAL_HEADER_ONLY
+
+static int _VERBOSE_ = 0;
+
+inline int& get_static_verbose_recbuffer()
+{ return _VERBOSE_; }
+
+#endif // CGAL_HEADER_ONLY
+
+
+#define EXIT_ON_FAILURE 0
+#define EXIT_ON_SUCCESS 1
+
+/*
+ *
+ * Gradient modulus
+ *
+ *
+ */
+CGAL_INLINE_FUNCTION
+int GradientModulus( void *bufferIn,
+		     bufferType typeIn,
+		     void *bufferOut,
+		     bufferType typeOut,
+		     int *bufferDims,
+		     int *borderLengths,
+		     float *filterCoefs,
+		     recursiveFilterType filterType )
+{
+  const char *proc = "GradientModulus";
+  float *auxBuf = NULL;
+  float *tmpBuf = NULL, *grdBuf = NULL;
+  int sizeAuxBuf = 0;
+  derivativeOrder derivatives[3];
+  int i;
+
+
+  sizeAuxBuf = bufferDims[0] * bufferDims[1] * bufferDims[2];
+  if ( typeOut != CGAL_FLOAT || bufferIn == bufferOut )
+    sizeAuxBuf *= 2;
+
+
+  /* allocation des buffers de calcul
+   */
+  auxBuf = (float*)malloc( sizeAuxBuf * sizeof(float) );
+  if ( auxBuf == NULL ) {
+    if ( _VERBOSE_ > 0 )
+      fprintf( stderr, "%s: unable to allocate auxiliary buffer\n", proc );
+    return( EXIT_ON_FAILURE );
+  }
+  tmpBuf = auxBuf;
+  if ( typeOut != CGAL_FLOAT || bufferIn == bufferOut ) {
+    grdBuf  = tmpBuf;
+    grdBuf += bufferDims[0] * bufferDims[1] * bufferDims[2];
+  } else {
+    grdBuf  = (float*)bufferOut;
+  }
+  
+  /* cas 2D
+   */
+  if ( bufferDims[2] == 1 ) {
+
+    derivatives[0] = DERIVATIVE_1; 
+    derivatives[1] = DERIVATIVE_0;
+    derivatives[2] = NODERIVATIVE;
+    if ( RecursiveFilterOnBuffer( bufferIn, typeIn, (void*)grdBuf, CGAL_FLOAT,
+				  bufferDims, borderLengths, derivatives,
+				  filterCoefs, filterType ) != EXIT_ON_SUCCESS ) {
+      if ( _VERBOSE_ ) 
+	fprintf( stderr, "%s: unable to compute X derivative (2D)\n", proc );
+      free( auxBuf );
+      return( EXIT_ON_FAILURE );
+    }
+
+    derivatives[0] = DERIVATIVE_0; 
+    derivatives[1] = DERIVATIVE_1;
+    derivatives[2] = NODERIVATIVE;
+    if ( RecursiveFilterOnBuffer( bufferIn, typeIn, (void*)tmpBuf, CGAL_FLOAT,
+				  bufferDims, borderLengths, derivatives,
+				  filterCoefs, filterType ) != EXIT_ON_SUCCESS ) {
+      if ( _VERBOSE_ ) 
+	fprintf( stderr, "%s: unable to compute Y derivative (2D)\n", proc );
+      free( auxBuf );
+      return( EXIT_ON_FAILURE );
+    }
+    
+    sizeAuxBuf = bufferDims[0] * bufferDims[1] * bufferDims[2];
+    for ( i = 0; i < sizeAuxBuf; i++ )
+      grdBuf[i] = (float)sqrt( grdBuf[i]*grdBuf[i] + tmpBuf[i]*tmpBuf[i] );
+    
+  } else {
+    
+    derivatives[0] = NODERIVATIVE;
+    derivatives[1] = NODERIVATIVE;
+    derivatives[2] = DERIVATIVE_0;
+    if ( RecursiveFilterOnBuffer( bufferIn, typeIn, (void*)tmpBuf, CGAL_FLOAT,
+				  bufferDims, borderLengths, derivatives,
+				  filterCoefs, filterType ) != EXIT_ON_SUCCESS ) {
+      if ( _VERBOSE_ ) 
+	fprintf( stderr, "%s: unable to compute Z smoothing (3D)\n", proc );
+      free( auxBuf );
+      return( EXIT_ON_FAILURE );
+    }
+
+    derivatives[0] = DERIVATIVE_1; 
+    derivatives[1] = DERIVATIVE_0;
+    derivatives[2] = NODERIVATIVE;
+    if ( RecursiveFilterOnBuffer( (void*)tmpBuf, CGAL_FLOAT, (void*)grdBuf, CGAL_FLOAT,
+				  bufferDims, borderLengths, derivatives,
+				  filterCoefs, filterType ) != EXIT_ON_SUCCESS ) {
+      if ( _VERBOSE_ ) 
+	fprintf( stderr, "%s: unable to compute X derivative (3D)\n", proc );
+      free( auxBuf );
+      return( EXIT_ON_FAILURE );
+    }
+
+    derivatives[0] = DERIVATIVE_0; 
+    derivatives[1] = DERIVATIVE_1;
+    derivatives[2] = NODERIVATIVE;
+    if ( RecursiveFilterOnBuffer( (void*)tmpBuf, CGAL_FLOAT, (void*)tmpBuf, CGAL_FLOAT,
+				  bufferDims, borderLengths, derivatives,
+				  filterCoefs, filterType ) != EXIT_ON_SUCCESS ) {
+      if ( _VERBOSE_ ) 
+	fprintf( stderr, "%s: unable to compute Y derivative (3D)\n", proc );
+      free( auxBuf );
+      return( EXIT_ON_FAILURE );
+    }
+
+    sizeAuxBuf = bufferDims[0] * bufferDims[1] * bufferDims[2];
+    for ( i = 0; i < sizeAuxBuf; i++ )
+      grdBuf[i] = grdBuf[i]*grdBuf[i] + tmpBuf[i]*tmpBuf[i];
+    
+    derivatives[0] = DERIVATIVE_0;
+    derivatives[1] = DERIVATIVE_0;
+    derivatives[2] = DERIVATIVE_1;
+    if ( RecursiveFilterOnBuffer( bufferIn, typeIn, (void*)tmpBuf, CGAL_FLOAT,
+				  bufferDims, borderLengths, derivatives,
+				  filterCoefs, filterType ) != EXIT_ON_SUCCESS ) {
+      if ( _VERBOSE_ ) 
+	fprintf( stderr, "%s: unable to compute Z derivative (3D)\n", proc );
+      free( auxBuf );
+      return( EXIT_ON_FAILURE );
+    }
+    
+    for ( i = 0; i < sizeAuxBuf; i++ )
+      grdBuf[i] = (float)sqrt( grdBuf[i] + tmpBuf[i]*tmpBuf[i] );
+    
+  }
+
+  if ( grdBuf != bufferOut ) 
+    ConvertBuffer( grdBuf, CGAL_FLOAT, bufferOut, typeOut,
+		   bufferDims[0]*bufferDims[1]*bufferDims[2] );
+  free( auxBuf );
+  return( EXIT_ON_SUCCESS );
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/*
+ *
+ * Laplacian
+ *
+ *
+ */
+CGAL_INLINE_FUNCTION
+int Laplacian_2D ( void *bufferIn,
+		   bufferType typeIn,
+		   void *bufferOut,
+		   bufferType typeOut,
+		   int *bufferDims,
+		   int *borderLengths,
+		   float *filterCoefs,
+		   recursiveFilterType filterType )
+{
+  const char *proc = "Laplacian_2D";
+  float *theXX = NULL;
+  float *theYY = NULL;
+
+  derivativeOrder XXderiv[3] = { DERIVATIVE_2, SMOOTHING, NODERIVATIVE };
+  derivativeOrder YYderiv[3] = { SMOOTHING, DERIVATIVE_2, NODERIVATIVE };
+  int sliceDims[3];
+  int z, i, dimxXdimy;
+
+  void *sliceOut = NULL;
+
+
+
+  /* 
+   * We check the buffers' dimensions.
+   */
+  if ( (bufferDims[0] <= 0) || (bufferDims[1] <= 0) || (bufferDims[2] <= 0) ) {
+    if ( _VERBOSE_ > 0 )
+      fprintf( stderr, " Fatal error in %s: improper buffer's dimension.\n", proc );
+    return( EXIT_ON_FAILURE );
+  }
+  
+  /*
+   * test of the coefficients
+   */
+  if ( (filterCoefs[0] < 0.0) || (filterCoefs[1] < 0.0) ||
+       (filterCoefs[2] < 0.0) ) {
+    if ( _VERBOSE_ > 0 )
+      fprintf( stderr, " Error in %s: negative coefficient's value.\n", proc );
+    return( EXIT_ON_FAILURE );
+  }
+  
+
+  /*
+   *
+   */
+  dimxXdimy = bufferDims[0] * bufferDims[1];
+  sliceDims[0] = bufferDims[0];
+  sliceDims[1] = bufferDims[1];
+  sliceDims[2] = 1;
+  
+
+  if ( typeOut == CGAL_FLOAT ) {
+    theXX = (float*)malloc( dimxXdimy * sizeof( float ) );
+  } else {
+    theXX = (float*)malloc( 2 * dimxXdimy * sizeof( float ) );
+  }
+  
+  if ( theXX == NULL ) {
+    if ( _VERBOSE_ > 0 ) {
+      fprintf( stderr, " Fatal error in %s:", proc );
+      fprintf( stderr, " unable to allocate auxiliary buffer.\n" );
+    }
+    return( EXIT_ON_FAILURE );
+  }
+
+  if ( typeOut != CGAL_FLOAT ) {
+    theYY  = theXX;
+    theYY += dimxXdimy;
+  }
+  
+  
+  
+  for ( z=0; z<bufferDims[2]; z++ ) {
+
+    if ( typeOut == CGAL_FLOAT ) {
+      theYY = ((float*)bufferOut) + z * dimxXdimy;
+    }
+    
+    if ( RecursiveFilterOnBuffer( bufferIn, typeIn, theXX, CGAL_FLOAT, 
+				  sliceDims, borderLengths,
+				  XXderiv, filterCoefs, filterType ) == 0 ) {
+      if ( _VERBOSE_ > 0 ) {
+	fprintf( stderr, " Fatal error in %s:", proc );
+	fprintf( stderr, " unable to compute X^2 derivative.\n" );
+      }
+      free( theXX );
+      return( EXIT_ON_FAILURE );
+    }
+
+    if ( RecursiveFilterOnBuffer( bufferIn, typeIn, theYY, CGAL_FLOAT, 
+				  sliceDims, borderLengths,
+				  YYderiv, filterCoefs, filterType ) == 0 ) {
+      if ( _VERBOSE_ > 0 ) {
+	fprintf( stderr, " Fatal error in %s:", proc );
+	fprintf( stderr, " unable to compute Y^2 derivative.\n" );
+      }
+      free( theXX );
+      return( EXIT_ON_FAILURE );
+    }
+    
+    
+    for ( i=0; i<dimxXdimy; i++ ) theYY[i] += theXX[i];
+    if ( typeOut != CGAL_FLOAT ) {
+      switch ( typeOut ) {
+      case CGAL_UCHAR :
+	sliceOut = (((u8*)bufferOut) + z * dimxXdimy);
+	break;
+      case CGAL_SCHAR :
+	sliceOut = (((s8*)bufferOut) + z * dimxXdimy);
+	break;
+      case CGAL_SSHORT :
+	sliceOut = (((s16*)bufferOut) + z * dimxXdimy);
+	break;
+      case CGAL_DOUBLE :
+	sliceOut = (((r64*)bufferOut) + z * dimxXdimy);
+	break;
+      default :
+	if ( _VERBOSE_ > 0 )
+	  fprintf( stderr, " Error in %s: such output type not handled.\n", proc );
+	free( theXX );
+	return( EXIT_ON_FAILURE );
+      }
+      ConvertBuffer( theYY, CGAL_FLOAT, sliceOut, typeOut, dimxXdimy );
+    }
+  }
+
+  return( EXIT_ON_SUCCESS );
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+CGAL_INLINE_FUNCTION
+int Laplacian ( void *bufferIn,
+		   bufferType typeIn,
+		   void *bufferOut,
+		   bufferType typeOut,
+		   int *bufferDims,
+		   int *borderLengths,
+		   float *filterCoefs,
+		   recursiveFilterType filterType )
+{
+  const char *proc = "Laplacian";
+  float *theSL = NULL;
+  float *theZZ = NULL;
+  float *theZ0 = NULL;
+
+
+  derivativeOrder XXderiv[3] = { DERIVATIVE_2, SMOOTHING, NODERIVATIVE };
+  derivativeOrder YYderiv[3] = { SMOOTHING, DERIVATIVE_2, NODERIVATIVE };
+  derivativeOrder Zsmooth[3] = { NODERIVATIVE, NODERIVATIVE, SMOOTHING };
+  derivativeOrder ZZderiv[3] = { SMOOTHING, SMOOTHING, DERIVATIVE_2 };
+  
+  int sliceDims[3];
+  int z, i, j, dimxXdimy;
+
+
+
+
+  /* 
+   * We check the buffers' dimensions.
+   */
+  if ( bufferDims[2] == 1 ) {
+    return( Laplacian_2D ( bufferIn, typeIn, bufferOut, typeOut,
+			   bufferDims, borderLengths, filterCoefs, filterType ) );
+  }
+
+  if ( (bufferDims[0] <= 0) || (bufferDims[1] <= 0) || (bufferDims[2] <= 0) ) {
+    if ( _VERBOSE_ > 0 )
+      fprintf( stderr, " Fatal error in %s: improper buffer's dimension.\n", proc );
+    return( EXIT_ON_FAILURE );
+  }
+  
+  /*
+   * test of the coefficients
+   */
+  if ( (filterCoefs[0] < 0.0) || (filterCoefs[1] < 0.0) ||
+       (filterCoefs[2] < 0.0) ) {
+    if ( _VERBOSE_ > 0 )
+      fprintf( stderr, " Error in %s: negative coefficient's value.\n", proc );
+    return( EXIT_ON_FAILURE );
+  }
+  
+
+  /*
+   *
+   */
+  dimxXdimy = bufferDims[0] * bufferDims[1];
+  sliceDims[0] = bufferDims[0];
+  sliceDims[1] = bufferDims[1];
+  sliceDims[2] = 1;
+
+  
+
+  if ( typeOut == CGAL_FLOAT ) {
+    theSL = (float*)malloc( (1+bufferDims[2]) * dimxXdimy * sizeof( float ) );
+  } else {
+    theSL = (float*)malloc( (1+2*bufferDims[2]) * dimxXdimy * sizeof( float ) );
+  }
+
+
+  
+  if ( theSL == NULL ) {
+    if ( _VERBOSE_ > 0 ) {
+      fprintf( stderr, " Fatal error in %s:", proc );
+      fprintf( stderr, " unable to allocate auxiliary buffer.\n" );
+    }
+    return( EXIT_ON_FAILURE );
+  }
+
+
+
+  theZ0 = theSL;
+  theZ0 += dimxXdimy;
+
+
+  
+  if ( typeOut == CGAL_FLOAT ) {
+    theZZ = (float*) bufferOut;
+  } else {
+    theZZ  = theZ0;
+    theZZ += dimxXdimy * bufferDims[2];
+  }
+  
+  
+  
+  /*
+   *
+   * 3D filtering / filtering along Z
+   *
+   */
+
+  if ( RecursiveFilterOnBuffer( bufferIn, typeIn, theZ0, CGAL_FLOAT, 
+				bufferDims, borderLengths,
+				Zsmooth, filterCoefs, filterType ) == 0 ) {
+    if ( _VERBOSE_ > 0 ) {
+      fprintf( stderr, " Fatal error in %s:", proc );
+      fprintf( stderr, " unable to compute Z^0 derivative.\n" );
+    }
+    free( theSL );
+    return( EXIT_ON_FAILURE );
+  }
+  if ( RecursiveFilterOnBuffer( bufferIn, typeIn, theZZ, CGAL_FLOAT, 
+				bufferDims, borderLengths,
+				ZZderiv, filterCoefs, filterType ) == 0 ) {
+    if ( _VERBOSE_ > 0 ) {
+      fprintf( stderr, " Fatal error in %s:", proc );
+      fprintf( stderr, " unable to compute Z^2 derivative.\n" );
+    }
+    free( theSL );
+    return( EXIT_ON_FAILURE );
+  }
+  
+
+
+
+
+
+  for ( z=0; z<bufferDims[2]; z++ ) {
+
+    /*
+     *
+     * 2D filtering / filtering along X and Y
+     *
+     */
+
+    if ( RecursiveFilterOnBuffer( theZ0+z*dimxXdimy, CGAL_FLOAT, theSL, CGAL_FLOAT, 
+				  sliceDims, borderLengths,
+				  XXderiv, filterCoefs, filterType ) == 0 ) {
+      if ( _VERBOSE_ > 0 ) {
+	fprintf( stderr, " Fatal error in %s:", proc );
+	fprintf( stderr, " unable to compute X^2 derivative.\n" );
+      }
+      free( theSL );
+      return( EXIT_ON_FAILURE );
+    }
+
+    for ( j=z*dimxXdimy, i=0; i<dimxXdimy; j++, i++ ) {
+      theZZ[j] += theSL[i];
+    }
+
+    if ( RecursiveFilterOnBuffer( theZ0+z*dimxXdimy, CGAL_FLOAT, theSL, CGAL_FLOAT, 
+				  sliceDims, borderLengths,
+				  YYderiv, filterCoefs, filterType ) == 0 ) {
+      if ( _VERBOSE_ > 0 ) {
+	fprintf( stderr, " Fatal error in %s:", proc );
+	fprintf( stderr, " unable to compute Y^2 derivative.\n" );
+      }
+      free( theSL );
+      return( EXIT_ON_FAILURE );
+    }
+    
+    for ( j=z*dimxXdimy, i=0; i<dimxXdimy; j++, i++ ) {
+      theZZ[j] += theSL[i];
+    }
+
+  }
+
+  if ( typeOut != CGAL_FLOAT ) {
+    ConvertBuffer( theZZ, CGAL_FLOAT, bufferOut, typeOut, bufferDims[2]*dimxXdimy );
+  }
+
+  return( EXIT_ON_SUCCESS );
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/*
+ *
+ * Gradient . Hessian * Gradient
+ *
+ *
+ */
+CGAL_INLINE_FUNCTION
+int GradientHessianGradient_2D ( void *bufferIn,
+		   bufferType typeIn,
+		   void *bufferOut,
+		   bufferType typeOut,
+		   int *bufferDims,
+		   int *borderLengths,
+		   float *filterCoefs,
+		   recursiveFilterType filterType )
+{
+  const char *proc = "GradientHessianGradient_2D";
+  float *theXX = NULL;
+  float *theYY = NULL;
+  float *theXY = NULL;
+  float *theX  = NULL;
+  float *theY  = NULL;
+
+  derivativeOrder Xsmooth[3] = { SMOOTHING,          NODERIVATIVE,       NODERIVATIVE };
+  derivativeOrder Yderiv[3]  = { NODERIVATIVE,       DERIVATIVE_1_EDGES, NODERIVATIVE };
+  derivativeOrder YYderiv[3] = { NODERIVATIVE,       DERIVATIVE_2,       NODERIVATIVE };
+
+  derivativeOrder Ysmooth[3] = { NODERIVATIVE,       SMOOTHING,          NODERIVATIVE };
+  derivativeOrder Xderiv[3]  = { DERIVATIVE_1_EDGES, NODERIVATIVE,       NODERIVATIVE };
+  derivativeOrder XXderiv[3] = { DERIVATIVE_2,       NODERIVATIVE,       NODERIVATIVE };
+
+  derivativeOrder XYderiv[3] = { DERIVATIVE_1,       DERIVATIVE_1,       NODERIVATIVE };
+
+  int sliceDims[3];
+  int z, i, dimxXdimy;
+
+  void *sliceIn = NULL;
+  void *sliceOut = NULL;
+
+  double gx, gy, g;
+
+  /* 
+   * We check the buffers' dimensions.
+   */
+  if ( (bufferDims[0] <= 0) || (bufferDims[1] <= 0) || (bufferDims[2] <= 0) ) {
+    if ( _VERBOSE_ > 0 )
+      fprintf( stderr, " Fatal error in %s: improper buffer's dimension.\n", proc );
+    return( EXIT_ON_FAILURE );
+  }
+  
+  /*
+   * test of the coefficients
+   */
+  if ( (filterCoefs[0] < 0.0) || (filterCoefs[1] < 0.0) ||
+       (filterCoefs[2] < 0.0) ) {
+    if ( _VERBOSE_ > 0 )
+      fprintf( stderr, " Error in %s: negative coefficient's value.\n", proc );
+    return( EXIT_ON_FAILURE );
+  }
+  
+
+  /*
+   *
+   */
+  dimxXdimy = bufferDims[0] * bufferDims[1];
+  sliceDims[0] = bufferDims[0];
+  sliceDims[1] = bufferDims[1];
+  sliceDims[2] = 1;
+  
+
+  if ( typeOut == CGAL_FLOAT ) {
+    theXX = (float*)malloc( 4 * dimxXdimy * sizeof( float ) );
+  } else {
+    theXX = (float*)malloc( 5 * dimxXdimy * sizeof( float ) );
+  }
+  
+  if ( theXX == NULL ) {
+    if ( _VERBOSE_ > 0 ) {
+      fprintf( stderr, " Fatal error in %s:", proc );
+      fprintf( stderr, " unable to allocate auxiliary buffer.\n" );
+    }
+    return( EXIT_ON_FAILURE );
+  }
+  
+
+
+  theX = theY = theYY = theXX;
+  theYY +=   dimxXdimy;
+  theX  += 2*dimxXdimy;
+  theY  += 3*dimxXdimy;
+
+
+
+  if ( typeOut != CGAL_FLOAT ) {
+    theXY  =   theXX;
+    theXY += 4*dimxXdimy;
+  }
+  
+  
+  
+  for ( z=0; z<bufferDims[2]; z++ ) {
+
+    switch( typeIn ) {
+    default :
+      break;
+    case CGAL_UCHAR :
+    case CGAL_SCHAR :
+      sliceIn = (void*)( ((u8*)bufferIn) + z*dimxXdimy ); break;
+    case CGAL_USHORT :
+    case CGAL_SSHORT :
+      sliceIn = (void*)( ((u16*)bufferIn) + z*dimxXdimy ); break;
+    case CGAL_FLOAT :
+      sliceIn = (void*)( ((float*)bufferIn) + z*dimxXdimy ); break;
+    case CGAL_DOUBLE :
+      sliceIn = (void*)( ((double*)bufferIn) + z*dimxXdimy ); break;
+    }
+    if ( typeOut == CGAL_FLOAT ) {
+      theXY = ((float*)bufferOut) + z * dimxXdimy;
+    }
+    
+    if ( RecursiveFilterOnBuffer( sliceIn, typeIn, theX, CGAL_FLOAT, 
+				  sliceDims, borderLengths,
+				  Ysmooth, filterCoefs, filterType ) == 0 ) {
+      if ( _VERBOSE_ > 0 ) {
+	fprintf( stderr, " Fatal error in %s:", proc );
+	fprintf( stderr, " unable to compute Y^0 derivative.\n" );
+      }
+      free( theXX );
+      return( EXIT_ON_FAILURE );
+    }
+
+    if ( RecursiveFilterOnBuffer( sliceIn, typeIn, theY, CGAL_FLOAT, 
+				  sliceDims, borderLengths,
+				  Xsmooth, filterCoefs, filterType ) == 0 ) {
+      if ( _VERBOSE_ > 0 ) {
+	fprintf( stderr, " Fatal error in %s:", proc );
+	fprintf( stderr, " unable to compute X^0 derivative.\n" );
+      }
+      free( theXX );
+      return( EXIT_ON_FAILURE );
+    }
+
+
+
+
+    if ( RecursiveFilterOnBuffer( sliceIn, typeIn, theXY, CGAL_FLOAT, 
+				  sliceDims, borderLengths,
+				  XYderiv, filterCoefs, filterType ) == 0 ) {
+      if ( _VERBOSE_ > 0 ) {
+	fprintf( stderr, " Fatal error in %s:", proc );
+	fprintf( stderr, " unable to compute X^1Y^1 derivative.\n" );
+      }
+      free( theXX );
+      return( EXIT_ON_FAILURE );
+    }
+
+
+
+
+    if ( RecursiveFilterOnBuffer( theX, CGAL_FLOAT, theXX, CGAL_FLOAT, 
+				  sliceDims, borderLengths,
+				  XXderiv, filterCoefs, filterType ) == 0 ) {
+      if ( _VERBOSE_ > 0 ) {
+	fprintf( stderr, " Fatal error in %s:", proc );
+	fprintf( stderr, " unable to compute X^2 derivative.\n" );
+      }
+      free( theXX );
+      return( EXIT_ON_FAILURE );
+    }
+
+    if ( RecursiveFilterOnBuffer( theY, CGAL_FLOAT, theYY, CGAL_FLOAT, 
+				  sliceDims, borderLengths,
+				  YYderiv, filterCoefs, filterType ) == 0 ) {
+      if ( _VERBOSE_ > 0 ) {
+	fprintf( stderr, " Fatal error in %s:", proc );
+	fprintf( stderr, " unable to compute Y^2 derivative.\n" );
+      }
+      free( theXX );
+      return( EXIT_ON_FAILURE );
+    }
+
+
+
+
+    if ( RecursiveFilterOnBuffer( theX, CGAL_FLOAT, theX, CGAL_FLOAT, 
+				  sliceDims, borderLengths,
+				  Xderiv, filterCoefs, filterType ) == 0 ) {
+      if ( _VERBOSE_ > 0 ) {
+	fprintf( stderr, " Fatal error in %s:", proc );
+	fprintf( stderr, " unable to compute X^1 derivative.\n" );
+      }
+      free( theXX );
+      return( EXIT_ON_FAILURE );
+    }
+
+    if ( RecursiveFilterOnBuffer( theY, CGAL_FLOAT, theY, CGAL_FLOAT, 
+				  sliceDims, borderLengths,
+				  Yderiv, filterCoefs, filterType ) == 0 ) {
+      if ( _VERBOSE_ > 0 ) {
+	fprintf( stderr, " Fatal error in %s:", proc );
+	fprintf( stderr, " unable to compute Y^1 derivative.\n" );
+      }
+      free( theXX );
+      return( EXIT_ON_FAILURE );
+    }
+
+
+    
+    
+    for ( i=0; i<dimxXdimy; i++ ) {
+      gx = theX[i];
+      gy = theY[i];
+      g = (gx*gx + gy*gy);
+      theXY[i] = (float)(gx * ( theXX[i] * gx + theXY[i] * gy ) +
+			 gy * ( theXY[i] * gx + theYY[i] * gy ));
+      if ( g > 1e-10 ) theXY[i] = (float)(theXY[i] / g);
+    }
+
+    if ( typeOut != CGAL_FLOAT ) {
+      switch ( typeOut ) {
+      case CGAL_UCHAR :
+	sliceOut = (((u8*)bufferOut) + z * dimxXdimy);
+	break;
+      case CGAL_SCHAR :
+	sliceOut = (((s8*)bufferOut) + z * dimxXdimy);
+	break;
+      case CGAL_SSHORT :
+	sliceOut = (((s16*)bufferOut) + z * dimxXdimy);
+	break;
+      case CGAL_DOUBLE :
+	sliceOut = (((r64*)bufferOut) + z * dimxXdimy);
+	break;
+      default :
+	if ( _VERBOSE_ > 0 )
+	  fprintf( stderr, " Error in %s: such output type not handled.\n", proc );
+	free( theXX );
+	return( EXIT_ON_FAILURE );
+      }
+      ConvertBuffer( theXY, CGAL_FLOAT, sliceOut, typeOut, dimxXdimy );
+    }
+  }
+
+  return( EXIT_ON_SUCCESS );
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CGAL_INLINE_FUNCTION
+int GradientHessianGradient ( void *bufferIn,
+		   bufferType typeIn,
+		   void *bufferOut,
+		   bufferType typeOut,
+		   int *bufferDims,
+		   int *borderLengths,
+		   float *filterCoefs,
+		   recursiveFilterType filterType )
+{
+  const char *proc = "GradientHessianGradient";
+
+
+
+  float *theZZ = NULL;
+  float *theZ  = NULL;
+  float *theZ1 = NULL;
+  float *theZ0 = NULL;
+
+  float *theXZ = NULL;
+  float *theYZ = NULL;
+
+  float *theXX = NULL;
+  float *theYY = NULL;
+  float *theXY = NULL;
+
+  float *theX  = NULL;
+  float *theY  = NULL;
+
+
+  derivativeOrder ZZderiv[3] = { SMOOTHING,    SMOOTHING,    DERIVATIVE_2 };
+  derivativeOrder Zderiv[3]  = { SMOOTHING,    SMOOTHING,    DERIVATIVE_1 };
+  derivativeOrder Z1deriv[3] = { NODERIVATIVE, NODERIVATIVE, DERIVATIVE_1 };
+  derivativeOrder Z0deriv[3] = { NODERIVATIVE, NODERIVATIVE, SMOOTHING };
+
+  derivativeOrder XZderiv[3] = { DERIVATIVE_1, SMOOTHING,    NODERIVATIVE };
+  derivativeOrder YZderiv[3] = { SMOOTHING,    DERIVATIVE_1, NODERIVATIVE };
+
+  derivativeOrder XXderiv[3] = { DERIVATIVE_2, SMOOTHING,    NODERIVATIVE };
+  derivativeOrder YYderiv[3] = { SMOOTHING,    DERIVATIVE_2, NODERIVATIVE };
+  derivativeOrder XYderiv[3] = { DERIVATIVE_1, DERIVATIVE_1, NODERIVATIVE };
+
+  derivativeOrder Xderiv[3]  = { DERIVATIVE_1, SMOOTHING,    NODERIVATIVE };
+  derivativeOrder Yderiv[3]  = { SMOOTHING,    DERIVATIVE_1, NODERIVATIVE };
+
+  int sliceDims[3];
+  int z, i, j, dimxXdimy;
+
+  double gx, gy, gz, g;
+
+  /* 
+   * We check the buffers' dimensions.
+   */
+  if ( bufferDims[2] == 1 ) {
+    return( GradientHessianGradient_2D ( bufferIn, typeIn, bufferOut, typeOut,
+			   bufferDims, borderLengths, filterCoefs, filterType ) );
+  }
+
+  if ( (bufferDims[0] <= 0) || (bufferDims[1] <= 0) || (bufferDims[2] <= 0) ) {
+    if ( _VERBOSE_ > 0 )
+      fprintf( stderr, " Fatal error in %s: improper buffer's dimension.\n", proc );
+    return( EXIT_ON_FAILURE );
+  }
+  
+  /*
+   * test of the coefficients
+   */
+  if ( (filterCoefs[0] < 0.0) || (filterCoefs[1] < 0.0) ||
+       (filterCoefs[2] < 0.0) ) {
+    if ( _VERBOSE_ > 0 )
+      fprintf( stderr, " Error in %s: negative coefficient's value.\n", proc );
+    return( EXIT_ON_FAILURE );
+  }
+  
+
+  /*
+   *
+   */
+  dimxXdimy = bufferDims[0] * bufferDims[1];
+  sliceDims[0] = bufferDims[0];
+  sliceDims[1] = bufferDims[1];
+  sliceDims[2] = 1;
+  
+
+  if ( typeOut == CGAL_FLOAT ) {
+    theX  = (float*)malloc( (7+3*bufferDims[2]) * dimxXdimy * sizeof( float ) );
+  } else {
+    theX = (float*)malloc( (7+4*bufferDims[2]) * dimxXdimy * sizeof( float ) );
+  }
+
+  
+  if ( theX == NULL ) {
+    if ( _VERBOSE_ > 0 ) {
+      fprintf( stderr, " Fatal error in %s:", proc );
+      fprintf( stderr, " unable to allocate auxiliary buffer.\n" );
+    }
+    return( EXIT_ON_FAILURE );
+  }
+  
+  /*
+   * BUFFERS
+   *
+   * slices  : theX  theY  theXY theYY theXX theYZ theXZ
+   *
+   * volumes : theZ0 theZ1 theZ  theZZ
+   *
+   */
+
+  theY  = theXX = theXY = theYY = theYZ = theXZ = theX;
+  theZ0 = theZ1 = theZ  = theX;
+
+  theY  +=   dimxXdimy;
+  theXY += 2*dimxXdimy;
+  theYY += 3*dimxXdimy;
+  theXX += 4*dimxXdimy;
+  theYZ += 5*dimxXdimy;
+  theXZ += 6*dimxXdimy;
+ 
+  theZ0 += 7*dimxXdimy;
+  theZ1 += 7*dimxXdimy +   bufferDims[2]*dimxXdimy;
+  theZ  += 7*dimxXdimy + 2*bufferDims[2]*dimxXdimy;
+
+  if ( typeOut == CGAL_FLOAT ) {
+    theZZ  = (float*)bufferOut;
+  } else {
+    theZZ  = theX;
+    theZZ += 7*dimxXdimy + 3*bufferDims[2]*dimxXdimy;
+  }
+  
+  
+  
+  /*
+   *
+   * 3D filtering / filtering along Z
+   *
+   */
+
+  if ( RecursiveFilterOnBuffer( bufferIn, typeIn, theZ0, CGAL_FLOAT, 
+				bufferDims, borderLengths,
+				Z0deriv, filterCoefs, filterType ) == 0 ) {
+    if ( _VERBOSE_ > 0 ) {
+      fprintf( stderr, " Fatal error in %s:", proc );
+      fprintf( stderr, " unable to compute Z^0 derivative.\n" );
+    }
+    free( theX );
+    return( EXIT_ON_FAILURE );
+  }
+  
+  if ( RecursiveFilterOnBuffer( bufferIn, typeIn, theZ1, CGAL_FLOAT, 
+				bufferDims, borderLengths,
+				Z1deriv, filterCoefs, filterType ) == 0 ) {
+    if ( _VERBOSE_ > 0 ) {
+      fprintf( stderr, " Fatal error in %s:", proc );
+      fprintf( stderr, " unable to compute Z^1 derivative.\n" );
+    }
+    free( theX );
+    return( EXIT_ON_FAILURE );
+  }
+  
+  if ( RecursiveFilterOnBuffer( bufferIn, typeIn, theZ, CGAL_FLOAT, 
+				bufferDims, borderLengths,
+				Zderiv, filterCoefs, filterType ) == 0 ) {
+    if ( _VERBOSE_ > 0 ) {
+      fprintf( stderr, " Fatal error in %s:", proc );
+      fprintf( stderr, " unable to compute Z^1 derivative (edge).\n" );
+    }
+    free( theX );
+    return( EXIT_ON_FAILURE );
+  }
+  
+  if ( RecursiveFilterOnBuffer( bufferIn, typeIn, theZZ, CGAL_FLOAT, 
+				bufferDims, borderLengths,
+				ZZderiv, filterCoefs, filterType ) == 0 ) {
+    if ( _VERBOSE_ > 0 ) {
+      fprintf( stderr, " Fatal error in %s:", proc );
+      fprintf( stderr, " unable to compute Z^2 derivative.\n" );
+    }
+    free( theX );
+    return( EXIT_ON_FAILURE );
+  }
+
+
+  /*
+   * theZ0 : smoothed         along Z
+   * theZ1 : first derivative along Z
+   * theZ  : first derivative along Z, smoothed along X and Y
+   * theZZ : second derivative along Z, smoothed along X and Y
+   */
+
+
+
+  for ( z=0; z<bufferDims[2]; z++ ) {
+    fprintf( stderr, "%s: processing slice %3d/%d\r",
+	     proc, z, bufferDims[2] );
+    /*
+     *
+     * 2D filtering / filtering along X and Y
+     *
+     */
+    
+    if ( RecursiveFilterOnBuffer( theZ1+z*dimxXdimy, CGAL_FLOAT, theXZ, CGAL_FLOAT, 
+				  sliceDims, borderLengths,
+				  XZderiv, filterCoefs, filterType ) == 0 ) {
+      if ( _VERBOSE_ > 0 ) {
+	fprintf( stderr, " Fatal error in %s:", proc );
+	fprintf( stderr, " unable to compute X^1Z^1 derivative.\n" );
+      }
+      free( theX );
+      return( EXIT_ON_FAILURE );
+    }
+
+    if ( RecursiveFilterOnBuffer( theZ1+z*dimxXdimy, CGAL_FLOAT, theYZ, CGAL_FLOAT, 
+				  sliceDims, borderLengths,
+				  YZderiv, filterCoefs, filterType ) == 0 ) {
+      if ( _VERBOSE_ > 0 ) {
+	fprintf( stderr, " Fatal error in %s:", proc );
+	fprintf( stderr, " unable to compute Y^1Z^1 derivative.\n" );
+      }
+      free( theX );
+      return( EXIT_ON_FAILURE );
+    }
+
+
+
+
+    if ( RecursiveFilterOnBuffer( theZ0+z*dimxXdimy, CGAL_FLOAT, theXX, CGAL_FLOAT,
+				  sliceDims, borderLengths,
+				  XXderiv, filterCoefs, filterType ) == 0 ) {
+      if ( _VERBOSE_ > 0 ) {
+	fprintf( stderr, " Fatal error in %s:", proc );
+	fprintf( stderr, " unable to compute X^2 derivative.\n" );
+      }
+      free( theX );
+      return( EXIT_ON_FAILURE );
+    }
+
+    if ( RecursiveFilterOnBuffer( theZ0+z*dimxXdimy, CGAL_FLOAT, theYY, CGAL_FLOAT,
+				  sliceDims, borderLengths,
+				  YYderiv, filterCoefs, filterType ) == 0 ) {
+      if ( _VERBOSE_ > 0 ) {
+	fprintf( stderr, " Fatal error in %s:", proc );
+	fprintf( stderr, " unable to compute Y^2 derivative.\n" );
+      }
+      free( theX );
+      return( EXIT_ON_FAILURE );
+    }
+
+    if ( RecursiveFilterOnBuffer( theZ0+z*dimxXdimy, CGAL_FLOAT, theXY, CGAL_FLOAT,
+				  sliceDims, borderLengths,
+				  XYderiv, filterCoefs, filterType ) == 0 ) {
+      if ( _VERBOSE_ > 0 ) {
+	fprintf( stderr, " Fatal error in %s:", proc );
+	fprintf( stderr, " unable to compute X^1Y^1 derivative.\n" );
+      }
+      free( theX );
+      return( EXIT_ON_FAILURE );
+    }
+
+
+
+    if ( RecursiveFilterOnBuffer( theZ0+z*dimxXdimy, CGAL_FLOAT, theX, CGAL_FLOAT,
+				  sliceDims, borderLengths,
+				  Xderiv, filterCoefs, filterType ) == 0 ) {
+      if ( _VERBOSE_ > 0 ) {
+	fprintf( stderr, " Fatal error in %s:", proc );
+	fprintf( stderr, " unable to compute X^1 derivative (edge).\n" );
+      }
+      free( theX );
+      return( EXIT_ON_FAILURE );
+    }
+
+    if ( RecursiveFilterOnBuffer( theZ0+z*dimxXdimy, CGAL_FLOAT, theY, CGAL_FLOAT,
+				  sliceDims, borderLengths,
+				  Yderiv, filterCoefs, filterType ) == 0 ) {
+      if ( _VERBOSE_ > 0 ) {
+	fprintf( stderr, " Fatal error in %s:", proc );
+	fprintf( stderr, " unable to compute Y^1 derivative (edge).\n" );
+      }
+      free( theX );
+      return( EXIT_ON_FAILURE );
+    }
+
+    
+    
+    for ( j=z*dimxXdimy, i=0; i<dimxXdimy; j++, i++ ) {
+      gx = theX[i];
+      gy = theY[i];
+      gz = theZ[j];
+      g = gx*gx + gy*gy + gz*gz;
+      theZZ[j] = (float)(gx * ( theXX[i] * gx + theXY[i] * gy  + theXZ[i] * gz ) +
+			 gy * ( theXY[i] * gx + theYY[i] * gy  + theYZ[i] * gz ) +
+			 gz * ( theXZ[i] * gx + theYZ[i] * gy  + theZZ[j] * gz ));
+      if ( g > 1e-10 ) theZZ[j] = (float)(theZZ[j] / g);
+
+    }
+
+  }
+
+  if ( typeOut != CGAL_FLOAT ) {
+    ConvertBuffer( theZZ, CGAL_FLOAT, bufferOut, typeOut, bufferDims[2]*dimxXdimy );
+  }
+  
+  free( theX );
+
+  return( EXIT_ON_SUCCESS );
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/*
+ *
+ * 
+ *
+ *
+ */
+CGAL_INLINE_FUNCTION
+int RecursiveFilterOnBuffer( void *bufferIn,
+			     bufferType typeIn,
+			     void *bufferOut,
+			     bufferType typeOut,
+			     int *bufferDims,
+			     int *borderLengths,
+			     derivativeOrder *derivatives,
+			     float *filterCoefs,
+			     recursiveFilterType filterType )
+{
+  const char *proc = "RecursiveFilterOnBuffer";
+  int dimx, dimxXdimy;
+  int dimy, dimz;
+  int x, y, z;
+  /* 
+   *obviously, we need to perform the computation 
+   * with float or double values. For this reason,
+   * we allocate an auxiliary buffer if the output buffer
+   * is not of type float or double.
+   */
+  void *bufferToBeProcessed = (void*)NULL;
+  bufferType typeToBeProcessed = TYPE_UNKNOWN;
+  void *bufferResult = (void*)NULL;
+  bufferType typeResult = TYPE_UNKNOWN;
+  /*
+   * lines' lengths
+   */
+  int lengthX = 0;
+  int lengthY = 0;
+  int lengthZ = 0;
+  int maxLengthline = 0;
+  int borderXlength = 0;
+  int borderYlength = 0;
+  int borderZlength = 0;
+  /*
+   * 1D arrays for computations.
+   */
+  double *theLine = (double*)NULL;
+  double *resLine = (double*)NULL;
+  double *tmpLine = (double*)NULL;
+  /*
+   * pointers for computations;
+   */
+  r32 *r32firstPoint = (r32*)NULL;
+  r64 *r64firstPoint = (r64*)NULL;
+  r32 *r32_pt = (r32*)NULL;
+  r64 *r64_pt = (r64*)NULL;
+  double *dbl_pt1 = (double*)NULL;
+  double *dbl_pt2 = (double*)NULL;
+  double dbl_first = 0.0;
+  double dbl_last = 0.0;
+  int offsetLastPoint = 0;
+  int offsetNextFirstPoint = 0;
+  r32 *r32firstPointResult = (r32*)NULL;
+  r64 *r64firstPointResult = (r64*)NULL;
+  double *theLinePlusBorder = (double*)NULL;
+  double *resLinePlusBorder = (double*)NULL;
+
+  RFcoefficientType *RFC = NULL;
+
+  /* 
+   * We check the buffers' dimensions.
+   */
+  dimx = bufferDims[0];   dimy = bufferDims[1];   dimz = bufferDims[2];
+  dimxXdimy = dimx * dimy;
+  if ( (dimx <= 0) || (dimy <= 0) || (dimz <= 0) ) {
+    if ( _VERBOSE_ > 0 )
+      fprintf( stderr, " Fatal error in %s: improper buffer's dimension.\n", proc );
+    return( EXIT_ON_FAILURE );
+  }
+  /*
+   * We check the pointers.
+   */
+  if ( (bufferIn == (void*)NULL) || (bufferOut == (void*)NULL) ) {
+    if ( _VERBOSE_ > 0 )
+      fprintf( stderr, " Fatal error in %s: NULL pointer on buffer.\n", proc );
+    return( EXIT_ON_FAILURE );
+  }
+
+  /* 
+   * May we use the buffer bufferOut as the bufferResult?
+   * If its type is CGAL_FLOAT or CGAL_DOUBLE, then yes.
+   * If not, we have to allocate an auxiliary buffer.
+   */
+  if ( (typeOut == CGAL_FLOAT) || (typeOut == CGAL_DOUBLE) ) {
+    bufferResult = bufferOut;
+    typeResult = typeOut;
+  } else {
+    bufferResult = (void*)malloc( (dimx*dimy*dimz) * sizeof(r32) );
+    if ( bufferResult == (void*)NULL ) {
+      if ( _VERBOSE_ > 0 )
+	fprintf( stderr, " Fatal error in %s: unable to allocate auxiliary buffer.\n", proc );
+      return( EXIT_ON_FAILURE );
+    }
+    typeResult = CGAL_FLOAT;
+  }
+  
+  /* 
+   * May we consider the buffer bufferIn as the bufferToBeProcessed?
+   * If its type is CGAL_FLOAT or CGAL_DOUBLE, then yes.
+   * If not, we convert it into the buffer bufferResult, and this
+   * last buffer is the bufferToBeProcessed.
+   */
+  if ( (typeIn == CGAL_FLOAT) || (typeIn == CGAL_DOUBLE) ) {
+    bufferToBeProcessed = bufferIn;
+    typeToBeProcessed = typeIn;
+  } else {
+    ConvertBuffer( bufferIn, typeIn, bufferResult, typeResult, (dimx*dimy*dimz) );
+    bufferToBeProcessed = bufferResult;
+    typeToBeProcessed = typeResult;
+  }
+
+  /*
+   * Estimation of the lines' length along each direction.
+   */
+  if ( borderLengths != NULL ) {
+    borderXlength = borderLengths[0];
+    borderYlength = borderLengths[1];
+    borderZlength = borderLengths[2];
+    if ( borderXlength < 0 ) borderXlength = 0;
+    if ( borderYlength < 0 ) borderYlength = 0;
+    if ( borderZlength < 0 ) borderZlength = 0;
+  }
+
+  /*
+   * Tue Jul  6 19:15:15 MET DST 1999 (gregoire Malandain)
+   * changes 3 x dimx -> dimx, dimy, dimz
+   */
+  lengthX = dimx + 2 * borderXlength;
+  lengthY = dimy + 2 * borderYlength;
+  lengthZ = dimz + 2 * borderZlength;
+  maxLengthline = lengthX;
+  if ( maxLengthline < lengthY ) maxLengthline = lengthY;
+  if ( maxLengthline < lengthZ ) maxLengthline = lengthZ;
+  if ( maxLengthline <= 0 ) {
+    if ( _VERBOSE_ > 0 )
+      fprintf( stderr, " Error in %s: unable to deal with dimensions = 0.\n", proc );
+    if ( (typeOut != CGAL_FLOAT) && (typeOut != CGAL_DOUBLE) )
+      free( bufferResult );
+    return( EXIT_ON_FAILURE );
+  }
+  /*
+   * Allocations of work arrays. 
+   * We will use them to process each line.
+   */
+  theLine = (double*)malloc( 3 * maxLengthline * sizeof(double) );
+  if ( theLine == (double*)NULL ) {
+    if ( _VERBOSE_ > 0 )
+      fprintf( stderr, " Fatal error in %s: unable to allocate auxiliary work arrays.\n", proc );
+    if ( (typeOut != CGAL_FLOAT) && (typeOut != CGAL_DOUBLE) )
+      free( bufferResult );
+    return( EXIT_ON_FAILURE );
+  }
+  resLine = theLine + maxLengthline;
+  tmpLine = resLine + maxLengthline;
+
+  /*
+   * From now,
+   * typeToBeProcessed is either CGAL_FLOAT or CGAL_DOUBLE
+   * so is typeResult.
+   */
+
+
+  /*
+   * Processing along X.
+   */
+  if ( dimx > 4 )
+  if (derivatives[0] != NODERIVATIVE)
+  if (filterCoefs[0] > 0.0) {
+
+    if ( _VERBOSE_ != 0 )
+      fprintf( stderr, " %s: processing along X.\n", proc );
+
+    RFC = InitRecursiveCoefficients( (double)filterCoefs[0], filterType, derivatives[0] );
+
+    if ( RFC == NULL ) {
+      if ( _VERBOSE_ != 0 )
+	fprintf( stderr, " %s: unable to allocate coefficients\n", proc );
+      if ( (typeOut != CGAL_FLOAT) && (typeOut != CGAL_DOUBLE) )
+	free( bufferResult );
+      return( EXIT_ON_FAILURE );
+    }
+    
+    r64firstPoint = (r64*)bufferToBeProcessed;
+    r32firstPoint = (r32*)bufferToBeProcessed;
+
+    r64firstPointResult = (r64*)bufferResult;
+    r32firstPointResult = (r32*)bufferResult;
+
+    offsetLastPoint = borderXlength + dimx - 1;
+
+    theLinePlusBorder = theLine + borderXlength;
+    resLinePlusBorder = resLine + borderXlength;
+
+    /*
+     * There are dimz*dimy X lines to be processed.
+     */
+    for ( z=0; z<dimz; z++ )
+    for ( y=0; y<dimy; y++ ) {
+      /*
+       * Acquiring a X line.
+       */ 
+      dbl_pt1 = theLinePlusBorder;
+      switch ( typeToBeProcessed ) {
+      case CGAL_DOUBLE :
+	(void)memcpy( (void*)dbl_pt1, (void*)r64firstPoint, dimx * sizeof(r64) );
+	r64firstPoint += dimx;
+	break;
+      case CGAL_FLOAT :
+      default :
+	for ( x=0; x<dimx; x++, dbl_pt1++, r32firstPoint++ ) *dbl_pt1 = *r32firstPoint;
+      }
+      /*
+       * Adding points at both ends of the line.
+       */
+      if ( borderXlength > 0 ) {
+	dbl_pt1 = theLine + borderXlength;   dbl_first = *dbl_pt1;
+	dbl_pt2 = theLine + offsetLastPoint; dbl_last  = *dbl_pt2;
+	for ( x=0; x<borderXlength; x++ ) {
+	  *--dbl_pt1 = dbl_first;
+	  *++dbl_pt2 = dbl_last;
+	}
+      }
+      /*
+       * Processing the line.
+       */
+      if ( RecursiveFilter1D( RFC, theLine, resLine, tmpLine, resLine, lengthX ) == 0 ) {
+	if ( _VERBOSE_ != 0 ) 
+	  fprintf(stderr," Error in %s: unable to process X line (y=%d,z=%d).\n", proc, y, z);
+	if ( (typeOut != CGAL_FLOAT) && (typeOut != CGAL_DOUBLE) )
+	  free( bufferResult );
+	free( (void*)theLine );
+	return( EXIT_ON_FAILURE );
+      }
+      /*
+       * Copy the result into the buffer bufferResult.
+       */
+      dbl_pt1 = resLinePlusBorder;
+      switch ( typeResult ) {
+      case CGAL_DOUBLE :
+	(void)memcpy( (void*)r64firstPointResult, (void*)dbl_pt1, dimx * sizeof(r64) );
+	r64firstPointResult += dimx;
+	break;
+      case CGAL_FLOAT :
+      default :
+	for ( x=0; x<dimx; x++, dbl_pt1++, r32firstPointResult++ )
+	  *r32firstPointResult = (r32)(*dbl_pt1);
+      }
+    }
+    
+    /*
+     * The next buffer to be processed is the buffer
+     * bufferResult.
+     */
+    bufferToBeProcessed = bufferResult;
+    typeToBeProcessed = typeResult;
+    
+    free( RFC );
+    RFC = NULL;
+
+  } /* end of Processing along X. */
+  
+  /*
+   * Processing along Y.
+   */
+  if ( dimy > 4 )
+  if (derivatives[1] != NODERIVATIVE)
+  if (filterCoefs[1] > 0.0) {
+
+    if ( _VERBOSE_ != 0 )
+      fprintf( stderr, " %s: processing along Y.\n", proc );
+
+    RFC = InitRecursiveCoefficients( (double)filterCoefs[1], filterType, derivatives[1] );
+
+    if ( RFC == NULL ) {
+      if ( _VERBOSE_ != 0 )
+	fprintf( stderr, " %s: unable to allocate coefficients\n", proc );
+      if ( (typeOut != CGAL_FLOAT) && (typeOut != CGAL_DOUBLE) )
+	free( bufferResult );
+      return( EXIT_ON_FAILURE );
+    }
+
+    r64firstPoint = (r64*)bufferToBeProcessed;
+    r32firstPoint = (r32*)bufferToBeProcessed;
+
+    r64firstPointResult = (r64*)bufferResult;
+    r32firstPointResult = (r32*)bufferResult;
+
+    offsetLastPoint = borderYlength + dimy - 1;
+    offsetNextFirstPoint = dimx * dimy - dimx;
+
+    theLinePlusBorder = theLine + borderYlength;
+    resLinePlusBorder = resLine + borderYlength;
+
+    /*
+     * There are dimz*dimx Y lines to be processed.
+     */
+    for ( z=0; z<dimz; z++ ) {
+      for ( x=0; x<dimx; x++ ) {
+      /*
+       * Acquiring a Y line.
+       */ 
+	dbl_pt1 = theLinePlusBorder;
+	switch ( typeToBeProcessed ) {
+	case CGAL_DOUBLE :
+	  r64_pt = r64firstPoint;
+	  for ( y=0; y<dimy; y++, dbl_pt1++, r64_pt += dimx ) *dbl_pt1 = *r64_pt;
+	  /*
+	   * Going to the first point of the next Y line
+	   */
+	  r64firstPoint ++;
+	  break;
+	case CGAL_FLOAT :
+	default :
+	  r32_pt = r32firstPoint;
+	  for ( y=0; y<dimy; y++, dbl_pt1++, r32_pt += dimx ) *dbl_pt1 = *r32_pt;
+	  r32firstPoint ++;
+	}
+	/*
+	 * Adding points at both ends of the line.
+	 */
+	if ( borderYlength > 0 ) {
+	  dbl_pt1 = theLine + borderYlength;   dbl_first = *dbl_pt1;
+	  dbl_pt2 = theLine + offsetLastPoint; dbl_last  = *dbl_pt2;
+	  for ( y=0; y<borderYlength; y++ ) {
+	    *--dbl_pt1 = dbl_first;
+	    *++dbl_pt2 = dbl_last;
+	  }
+	}
+	/*
+	 * Processing the line.
+	 */
+	if ( RecursiveFilter1D( RFC, theLine, resLine, tmpLine, resLine, lengthY ) == 0 ) {
+	  if ( _VERBOSE_ != 0 ) 
+	    fprintf(stderr," Error in %s: unable to process Y line (x=%d,z=%d).\n", proc, x, z);
+	  if ( (typeOut != CGAL_FLOAT) && (typeOut != CGAL_DOUBLE) )
+	    free( bufferResult );
+	  free( (void*)theLine );
+	  return( EXIT_ON_FAILURE );
+	}
+	/*
+	 * Copy the result into the buffer bufferResult.
+	 */
+	dbl_pt1 = resLinePlusBorder;
+	switch ( typeResult ) {
+	case CGAL_DOUBLE :
+	  r64_pt = r64firstPointResult;
+	  for ( y=0; y<dimy; y++, dbl_pt1++, r64_pt += dimx ) *r64_pt = *dbl_pt1;
+	  r64firstPointResult ++;
+	  break;
+	case CGAL_FLOAT :
+	default :
+	  r32_pt = r32firstPointResult;
+	  for ( y=0; y<dimy; y++, dbl_pt1++, r32_pt += dimx ) 
+	    *r32_pt = (float)*dbl_pt1;
+	  r32firstPointResult ++;
+	}
+      }
+      /*
+       * Going to the first point of the next Y line
+       * which is the first Y line of the next slice.
+       *
+       * The pointer r[32,64]firstPoint[Result] has
+       * already been increased by dimx. To reach
+       * the first point of the next slice, we
+       * have to increase it by (dimx*dimy)-dimx.
+       */
+      switch ( typeToBeProcessed ) {
+      case CGAL_DOUBLE :
+	r64firstPoint += offsetNextFirstPoint;
+	break;
+      case CGAL_FLOAT :
+      default :
+	r32firstPoint += offsetNextFirstPoint;
+      }
+      switch ( typeResult ) {
+      case CGAL_DOUBLE :
+	r64firstPointResult += offsetNextFirstPoint;
+	break;
+      case CGAL_FLOAT :
+      default :
+	r32firstPointResult += offsetNextFirstPoint;
+      }
+    }
+    
+    /*
+     * The next buffer to be processed is the buffer
+     * bufferResult.
+     */
+    bufferToBeProcessed = bufferResult;
+    typeToBeProcessed = typeResult;
+  
+    free( RFC );
+    RFC = NULL;
+
+  } /* end of Processing along Y. */
+  
+
+  /*
+   * Processing along Z.
+   */
+  if ( dimz > 4 )
+  if (derivatives[2] != NODERIVATIVE)
+  if (filterCoefs[2] > 0.0) {
+
+    if ( _VERBOSE_ != 0 )
+      fprintf( stderr, " %s: processing along Z.\n", proc );
+    
+    RFC = InitRecursiveCoefficients( (double)filterCoefs[2], filterType, derivatives[2] );
+    
+    if ( RFC == NULL ) {
+      if ( _VERBOSE_ != 0 )
+	fprintf( stderr, " %s: unable to allocate coefficients\n", proc );
+      if ( (typeOut != CGAL_FLOAT) && (typeOut != CGAL_DOUBLE) )
+	free( bufferResult );
+      return( EXIT_ON_FAILURE );
+    }
+
+    r64firstPoint = (r64*)bufferToBeProcessed;
+    r32firstPoint = (r32*)bufferToBeProcessed;
+
+    offsetLastPoint = borderZlength + dimz - 1;
+
+    r64firstPointResult = (r64*)bufferResult;
+    r32firstPointResult = (r32*)bufferResult;
+
+    offsetLastPoint = borderZlength + dimz - 1;
+
+    theLinePlusBorder = theLine + borderYlength;
+    resLinePlusBorder = resLine + borderYlength;
+
+    /*
+     * There are dimy*dimx Z lines to be processed.
+     */
+    for ( y=0; y<dimy; y++ )
+    for ( x=0; x<dimx; x++ ) {
+      /*
+       * Acquiring a Z line.
+       */ 
+      dbl_pt1 = theLinePlusBorder;
+      switch ( typeToBeProcessed ) {
+      case CGAL_DOUBLE :
+	r64_pt = r64firstPoint;
+	for ( z=0; z<dimz; z++, dbl_pt1++, r64_pt += dimxXdimy ) *dbl_pt1 = *r64_pt;
+	/*
+	 * Going to the first point of the next Z line
+	 */
+	r64firstPoint ++;
+	break;
+      case CGAL_FLOAT :
+      default :
+	r32_pt = r32firstPoint;
+	for ( z=0; z<dimz; z++, dbl_pt1++, r32_pt += dimxXdimy ) *dbl_pt1 = *r32_pt;
+	r32firstPoint ++;
+      }
+      /*
+       * Adding points at both ends of the line.
+       */
+      if ( borderZlength > 0 ) {
+	dbl_pt1 = theLine + borderZlength;   dbl_first = *dbl_pt1;
+	dbl_pt2 = theLine + offsetLastPoint; dbl_last  = *dbl_pt2;
+	for ( z=0; z<borderZlength; z++ ) {
+	  *--dbl_pt1 = dbl_first;
+	  *++dbl_pt2 = dbl_last;
+	}
+      }
+      /*
+       * Processing the line.
+       */
+      if ( RecursiveFilter1D( RFC, theLine, resLine, tmpLine, resLine, lengthZ ) == 0 ) {
+	if ( _VERBOSE_ != 0 ) 
+	  fprintf(stderr," Error in %s: unable to process Z line (x=%d,y=%d).\n", proc, x, y);
+	if ( (typeOut != CGAL_FLOAT) && (typeOut != CGAL_DOUBLE) )
+	  free( bufferResult );
+	free( (void*)theLine );
+	return( EXIT_ON_FAILURE );
+      }
+      
+      /*
+       * Copy the result into the buffer bufferResult.
+       */
+      dbl_pt1 = resLinePlusBorder;
+      switch ( typeResult ) {
+      case CGAL_DOUBLE :
+	r64_pt = r64firstPointResult;
+	for ( z=0; z<dimz; z++, dbl_pt1++, r64_pt += dimxXdimy ) 
+	  *r64_pt = *dbl_pt1;
+	r64firstPointResult ++;
+	break;
+      case CGAL_FLOAT :
+      default :
+	r32_pt = r32firstPointResult;
+	for ( z=0; z<dimz; z++, dbl_pt1++, r32_pt += dimxXdimy ) 
+	  *r32_pt = (float)*dbl_pt1;
+	r32firstPointResult ++;
+      }
+    }
+
+    free( RFC );
+    RFC = NULL;
+
+  } /* end of Processing along Z. */
+  
+
+
+
+  /*
+   * From bufferResult to bufferOut
+   */
+  ConvertBuffer( bufferResult, typeResult, bufferOut, typeOut, (dimx*dimy*dimz) );
+
+  /*
+   * Releasing the buffers.
+   */
+  if ( (typeOut != CGAL_FLOAT) && (typeOut != CGAL_DOUBLE) )
+    free( bufferResult );
+  free( (void*)theLine );
+  
+  return( EXIT_ON_SUCCESS );
+}
+
+CGAL_INLINE_FUNCTION
+void Recbuffer_verbose ( )
+{
+  get_static_verbose_recbuffer() = 1;
+  Recline_verbose ( );
+}
+
+CGAL_INLINE_FUNCTION
+void Recbuffer_noverbose ( )
+{
+  get_static_verbose_recbuffer() = 0;
+  Recline_noverbose ( );
+}
diff --git a/3rdparty/CGAL/include/CGAL/ImageIO/recline.h b/3rdparty/CGAL/include/CGAL/ImageIO/recline.h
new file mode 100644
index 0000000..7332c07
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/ImageIO/recline.h
@@ -0,0 +1,235 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+/*************************************************************************
+ * recline.h - tools for recursive filtering of 1D lines
+ *
+ * $Id$
+ *
+ * Copyright©INRIA 1998
+ *
+ * DESCRIPTION: 
+ *
+ * Recursive filtering of a line (a 1D array)
+ *
+ * AUTHOR:
+ * Gregoire Malandain (greg at sophia.inria.fr)
+ * http://www.inria.fr/epidaure/personnel/malandain/
+ * 
+ * CREATION DATE: 
+ * June, 9 1998
+ *
+ * Copyright Gregoire Malandain, INRIA
+ *
+ * ADDITIONS, CHANGES
+ *
+ */
+
+/*
+ * recursive filtering of a line (a 1D array)
+ */
+
+#ifndef _recline_h_
+#define _recline_h_
+
+
+
+/* The different recursive filter's types.
+ *
+ * DESCRIPTION:
+ *
+ * - ALPHA_DERICHE is the first recurvise filter designed
+ *   by R. Deriche. See REFERENCES.
+ *
+ * - with ALPHA_DERICHE's filters, one can either compute
+ *   derivatives from order 0 (smoothing) to 3, or extract edges.
+ *
+ * - GAUSSIAN_DERICHE is a 4th order recursive filter which
+ *   approximates the gaussien. See
+ *   "Recursively Implementing The Gaussian and Its Derivatives",
+ *   R. Deriche, International Conference On Image Processing,
+ *   pp 263-267, Singapore, September 1992. Also INRIA research
+ *   report.
+ *
+ * - with GAUSSIAN_DERICHE's filters, one can either compute
+ *   derivatives from order 0 (smoothing) to 2, or extract edges.
+ *
+ * - Extracting edges with ALPHA_DERICHE's filters is faster but
+ *   the modulus of the gradient (the estimated height of the step 
+ *   edge) depens on the gradient orientation because the filter
+ *   is not isotropic. Heights are better estimated with 
+ *   GAUSSIAN_DERICHE's filters but they seem not be perfectly
+ *   symmetrical.
+ *
+ * REFERENCES:
+ *
+ * - "Optimal edge detection using recursive filtering", R. Deriche,
+ *   International Journal of Computer Vision, pp 167-187, 1987.
+ *
+ * - "Recursive filtering and edge tracking: two primary tools
+ *    for 3-D edge detection", O. Monga, R. Deriche,
+ *   G. Malandain and J.-P. Cocquerez, Image and Vision
+ *   Computing 4:9, pp 203-214, August 1991.
+ */
+typedef enum {
+  UNKNOWN_FILTER = 0 /* unknown filter type */,
+  ALPHA_DERICHE = 1 /* Deriche's filter (exponential (- alpha |X|)) */,
+  GAUSSIAN_DERICHE = 2 /* gaussian approximation (Deriche's coefficients) */,
+  GAUSSIAN_FIDRICH = 3 /* gaussian approximation (Fidrich's coefficients) */
+} recursiveFilterType;
+
+
+
+/* Order of the derivative to be computed.
+ *
+ * DESCRIPTION:
+ *
+ * - NODERIVATIVE nothing will be done.
+ *
+ * - DERIVATIVE_0 means smoothing.
+ *
+ * - DERIVATIVE_1 first derivative. The normalization
+ *   of the filter is made so that the response to the
+ *   signal i=x will be 1.
+ *
+ * - DERIVATIVE_1_CONTOURS first derivative but adapted
+ *   to edge detections. The normalization of the filter 
+ *   is made so that the response to a step edge is 
+ *   the step edge height.
+ *
+ * - DERIVATIVE_2 second derivative. The normalization
+ *   of the filter is made so that the response to the
+ *   signal i=x*2/2 will be 1.
+ *
+ * - DERIVATIVE_3 third derivative. The normalization
+ *   of the filter is made so that the response to the
+ *   signal i=x*3/6 will be 1.
+ */
+typedef enum {
+  NODERIVATIVE  = -1 /* no derivative (no filtering) */,
+  DERIVATIVE_0  = 0 /* smoothing */,
+  SMOOTHING     = 0 /* smoothing */,
+  DERIVATIVE_1  = 1 /* derivative of order 1 */,
+  DERIVATIVE_2  = 2 /* derivative of order 2 */,
+  DERIVATIVE_3  = 3 /* derivative of order 3 */,
+  DERIVATIVE_1_CONTOURS = 11 /* derivative of order 1, normalization adapted to
+				contours. The response to a step-edge is the 
+				height of the step. */,
+  DERIVATIVE_1_EDGES = 11 /* derivative of order 1, normalization adapted to
+				contours. The response to a step-edge is the 
+				height of the step. */
+} derivativeOrder;
+
+
+
+typedef struct {
+  /*--- denominateur       ---*/
+  double sd1;
+  double sd2;
+  double sd3;
+  double sd4;
+  /*--- numerateur positif ---*/
+  double sp0;
+  double sp1;
+  double sp2;
+  double sp3;
+  /*--- numerateur negatif ---*/
+  double sn0;
+  double sn1;
+  double sn2;
+  double sn3;
+  double sn4;
+  /*--- type de filtre en cours ---*/
+  recursiveFilterType type_filter;
+  derivativeOrder derivative;
+} RFcoefficientType;
+
+
+
+/* Initialization of coefficients for recursive filtering.
+ *
+ * PARAMETERS:
+ *
+ * - the coefficient is the sigma's value in case of
+ *   gaussian filtering, or the alpha's value in case
+ *   of Deriche's filters.
+ *
+ * - the coefficient's value must be larger than 0.1
+ *   in case of gaussian filtering, and in the
+ *   [0.1,1.9] range in case of Deriche's filters.
+ *
+ * SEE:
+ *
+ * - recursiveFilterType
+ *
+ * - derivativeOrder
+ */
+extern RFcoefficientType * InitRecursiveCoefficients( double x, /* coefficient's value */
+				       recursiveFilterType filterType, /* filter's type */
+				       derivativeOrder derivative /* derivative's order */ );
+
+
+
+/* 1D recursive filtering along a line.
+ *
+ * WARNING:
+ * Coefficients should already be initialized.
+ *
+ * SEE:
+ *
+ * - recursiveFilterType
+ *
+ * - derivativeOrder
+ *
+ * RETURN:
+ *
+ * - 0 in case of error
+ *
+ * - 1 if successful
+ */
+extern int RecursiveFilter1D( RFcoefficientType *RFC,
+			      double *in, /* input line */ 
+			      double *out, /* output line */
+			      double *work1, /* first work array */
+			      double *work2, /* second work array, 
+						could be out if out is different from in */
+			      int dim /* lines' length */ );
+
+
+/* Turn on verbose mode.
+ *
+ * DESCRIPTION:
+ * Some information will be written on stderr when processing.
+ */
+extern void Recline_verbose ( );
+
+/* Turn off verbose mode.
+ *
+ * DESCRIPTION:
+ * Nothing will be written on stderr when processing.
+ */
+extern void Recline_noverbose ( );
+
+#ifdef CGAL_HEADER_ONLY
+#include <CGAL/ImageIO/recline_impl.h>
+#endif // CGAL_HEADER_ONLY
+
+#endif /* _recline_h_ */
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/recline_impl.h b/3rdparty/CGAL/include/CGAL/ImageIO/recline_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL_ImageIO/recline_impl.h
rename to 3rdparty/CGAL/include/CGAL/ImageIO/recline_impl.h
diff --git a/3rdparty/CGAL/include/CGAL/ImageIO/reech4x4.h b/3rdparty/CGAL/include/CGAL/ImageIO/reech4x4.h
new file mode 100644
index 0000000..51422ea
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/ImageIO/reech4x4.h
@@ -0,0 +1,288 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+/*************************************************************************
+ * reech4x4.h -
+ *
+ * $Id$
+ *
+ * Copyright©INRIA 1999
+ *
+ * AUTHOR:
+ * Gregoire Malandain (greg at sophia.inria.fr)
+ * 
+ * CREATION DATE: 
+ *
+ *
+ * ADDITIONS, CHANGES
+ *	
+ *	
+ *	
+ *
+ */
+
+
+/* CAUTION
+   DO NOT EDIT THIS FILE,
+   UNLESS YOU HAVE A VERY GOOD REASON 
+ */
+
+#ifndef _reech4x4_h_
+#define _reech4x4_h_
+
+
+
+
+
+
+
+
+
+extern void Reech3DTriLin4x4_u8 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim,  /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat   /* transformation matrix */
+			     );
+extern void Reech3DTriLin4x4gb_u8 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim, /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat,   /* transformation matrix */
+			     float gain,
+			     float bias );
+extern void Reech3DNearest4x4_u8 ( void* theBuf, /* buffer to be resampled */
+			      int *theDim,  /* dimensions of this buffer */
+			      void* resBuf, /* result buffer */
+			      int *resDim,  /* dimensions of this buffer */
+			      double* mat   /* transformation matrix */
+			      );
+extern void Reech2DTriLin4x4_u8 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim,  /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat   /* transformation matrix */
+			     );
+extern void Reech2DTriLin4x4gb_u8 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim, /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat,   /* transformation matrix */
+			     float gain,
+			     float bias );
+extern void Reech2DNearest4x4_u8 ( void* theBuf, /* buffer to be resampled */
+			      int *theDim,  /* dimensions of this buffer */
+			      void* resBuf, /* result buffer */
+			      int *resDim,  /* dimensions of this buffer */
+			      double* mat   /* transformation matrix */
+			      );
+
+
+
+
+
+
+extern void Reech3DTriLin4x4_s8 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim,  /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat   /* transformation matrix */
+			     );
+extern void Reech3DTriLin4x4gb_s8 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim, /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat,   /* transformation matrix */
+			     float gain,
+			     float bias );
+extern void Reech3DNearest4x4_s8 ( void* theBuf, /* buffer to be resampled */
+			      int *theDim,  /* dimensions of this buffer */
+			      void* resBuf, /* result buffer */
+			      int *resDim,  /* dimensions of this buffer */
+			      double* mat   /* transformation matrix */
+			      );
+extern void Reech2DTriLin4x4_s8 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim,  /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat   /* transformation matrix */
+			     );
+extern void Reech2DTriLin4x4gb_s8 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim, /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat,   /* transformation matrix */
+			     float gain,
+			     float bias );
+extern void Reech2DNearest4x4_s8 ( void* theBuf, /* buffer to be resampled */
+			      int *theDim,  /* dimensions of this buffer */
+			      void* resBuf, /* result buffer */
+			      int *resDim,  /* dimensions of this buffer */
+			      double* mat   /* transformation matrix */
+			      );
+
+
+
+
+
+
+extern void Reech3DTriLin4x4_u16 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim,  /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat   /* transformation matrix */
+			     );
+extern void Reech3DTriLin4x4gb_u16 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim, /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat,   /* transformation matrix */
+			     float gain,
+			     float bias );
+extern void Reech3DNearest4x4_u16 ( void* theBuf, /* buffer to be resampled */
+			      int *theDim,  /* dimensions of this buffer */
+			      void* resBuf, /* result buffer */
+			      int *resDim,  /* dimensions of this buffer */
+			      double* mat   /* transformation matrix */
+			      );
+extern void Reech2DTriLin4x4_u16 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim,  /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat   /* transformation matrix */
+			     );
+extern void Reech2DTriLin4x4gb_u16 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim, /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat,   /* transformation matrix */
+			     float gain,
+			     float bias );
+extern void Reech2DNearest4x4_u16 ( void* theBuf, /* buffer to be resampled */
+			      int *theDim,  /* dimensions of this buffer */
+			      void* resBuf, /* result buffer */
+			      int *resDim,  /* dimensions of this buffer */
+			      double* mat   /* transformation matrix */
+			      );
+
+
+
+
+
+
+extern void Reech3DTriLin4x4_s16 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim,  /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat   /* transformation matrix */
+			     );
+extern void Reech3DTriLin4x4gb_s16 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim, /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat,   /* transformation matrix */
+			     float gain,
+			     float bias );
+extern void Reech3DNearest4x4_s16 ( void* theBuf, /* buffer to be resampled */
+			      int *theDim,  /* dimensions of this buffer */
+			      void* resBuf, /* result buffer */
+			      int *resDim,  /* dimensions of this buffer */
+			      double* mat   /* transformation matrix */
+			      );
+extern void Reech2DTriLin4x4_s16 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim,  /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat   /* transformation matrix */
+			     );
+extern void Reech2DTriLin4x4gb_s16 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim, /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat,   /* transformation matrix */
+			     float gain,
+			     float bias );
+extern void Reech2DNearest4x4_s16 ( void* theBuf, /* buffer to be resampled */
+			      int *theDim,  /* dimensions of this buffer */
+			      void* resBuf, /* result buffer */
+			      int *resDim,  /* dimensions of this buffer */
+			      double* mat   /* transformation matrix */
+			      );
+
+
+
+
+
+
+extern void Reech3DTriLin4x4_r32 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim,  /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat   /* transformation matrix */
+			     );
+extern void Reech3DTriLin4x4gb_r32 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim, /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat,   /* transformation matrix */
+			     float gain,
+			     float bias );
+extern void Reech3DNearest4x4_r32 ( void* theBuf, /* buffer to be resampled */
+			      int *theDim,  /* dimensions of this buffer */
+			      void* resBuf, /* result buffer */
+			      int *resDim,  /* dimensions of this buffer */
+			      double* mat   /* transformation matrix */
+			      );
+extern void Reech2DTriLin4x4_r32 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim,  /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat   /* transformation matrix */
+			     );
+extern void Reech2DTriLin4x4gb_r32 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim, /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat,   /* transformation matrix */
+			     float gain,
+			     float bias );
+extern void Reech2DNearest4x4_r32 ( void* theBuf, /* buffer to be resampled */
+			      int *theDim,  /* dimensions of this buffer */
+			      void* resBuf, /* result buffer */
+			      int *resDim,  /* dimensions of this buffer */
+			      double* mat   /* transformation matrix */
+			      );
+
+
+
+
+
+
+
+extern void Reech4x4_verbose ( );
+extern void Reech4x4_noverbose ( );
+
+#ifdef CGAL_HEADER_ONLY
+#include <CGAL/ImageIO/reech4x4_impl.h>
+#endif // CGAL_HEADER_ONLY
+
+
+#endif
diff --git a/3rdparty/CGAL/include/CGAL/ImageIO/reech4x4_impl.h b/3rdparty/CGAL/include/CGAL/ImageIO/reech4x4_impl.h
new file mode 100644
index 0000000..741c0ff
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/ImageIO/reech4x4_impl.h
@@ -0,0 +1,3176 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+/*************************************************************************
+ * reech4x4.c -
+ *
+ * $Id$
+ *
+ * Copyright©INRIA 1999
+ *
+ * AUTHOR:
+ * Gregoire Malandain (greg at sophia.inria.fr)
+ * 
+ * CREATION DATE: 
+ *
+ *
+ * ADDITIONS, CHANGES
+ *	
+ *	
+ *	
+ *
+ */
+
+#ifdef CGAL_HEADER_ONLY
+#define CGAL_INLINE_FUNCTION inline
+#else
+#define CGAL_INLINE_FUNCTION
+#endif
+
+/* CAUTION
+   DO NOT EDIT THIS FILE,
+   UNLESS YOU HAVE A VERY GOOD REASON 
+ */
+
+#include <stdio.h>
+#include <CGAL/ImageIO/typedefs.h>
+
+#define _CONVERTR_(R) ( R )
+#define _CONVERTI_(R) ( (R) >= 0.0 ? ((int)((R)+0.5)) : ((int)((R)-0.5)) )
+
+
+#ifdef CGAL_HEADER_ONLY
+
+inline int& get_static_verbose_reech4x4()
+{
+  static int _VERBOSE_REECH_ = 0;
+  return _VERBOSE_REECH_;
+}
+
+#else // CGAL_HEADER_ONLY
+
+static int _VERBOSE_REECH_ = 0;
+
+inline int& get_static_verbose_reech4x4()
+{ return _VERBOSE_REECH_; }
+
+#endif // CGAL_HEADER_ONLY
+
+
+
+
+
+
+/* Resampling procedure.
+
+   Work for 3D images, not for vectorial ones.
+   
+   (double* mat) is the matrix which permits to get
+   from resBuf into theBuf. 
+   If one only have the matrix from theBuf into resBuf,
+   it must be inverted first.
+
+   Soit x le point transforme et ix=(int)x;
+   nous allons distinguer les cas suivants :
+    x < -0.5               => resultat = 0
+    -0.5 <= x < 0.0        => ix=0, on n'interpole pas selon X
+    0.0 < x && ix < dimx-1 => on interpole selon X
+    x < dimx-0.5           => ix=dimx-1, on n'interpole pas selon X
+    x >= dimx-0.5          => resultat = 0
+
+*/
+
+CGAL_INLINE_FUNCTION
+void Reech3DTriLin4x4_u8 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim, /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat   /* transformation matrix */
+			     )
+{
+  int i, j, k, ix, iy, iz;
+  double x, y, z, dx, dy, dz, dxdy,dxdz,dydz,dxdydz;
+  double res;
+  double v6, v5, v4;
+  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
+  int tdimx=theDim[0], tdimy=theDim[1], tdimz=theDim[2];
+  int tdimxy=tdimx*tdimy;
+  int toffset1=tdimxy+tdimx+1, toffset2=tdimxy-tdimx-1;
+  int t1dimx=tdimx-1, t1dimy=tdimy-1, t1dimz=tdimz-1;
+  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
+  double ddimz = (double)tdimz-0.5;
+  u8 *tbuf = (u8*)theBuf;
+  u8 *tpt;
+  u8 *rbuf = (u8*)resBuf;
+
+  for ( k = 0; k < rdimz; k ++ ) {
+    if ( get_static_verbose_reech4x4() != 0 )
+      fprintf( stderr, "Processing slice %d\r", k );
+    for ( j = 0; j < rdimy; j ++ )
+    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
+      /* computation of the corresponding point coordinates in theBuf */
+      x = mat[0] * i +  mat[1] * j + mat[2] * k + mat[3];
+      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
+      y = mat[4] * i +  mat[5] * j + mat[6] * k + mat[7];
+      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
+      z = mat[8] * i +  mat[9] * j + mat[10] * k + mat[11];
+      if ((z < -0.5) || ( z > ddimz)) { *rbuf = 0; continue; }
+
+      /* here, the point lies on the borders or completely inside
+	 the image */
+      ix = (int)x;
+      iy = (int)y;
+      iz = (int)z;
+      tpt = (u8 *)tbuf;
+      
+      /* are we on the border or not ? */
+      if ( (x > 0.0) && (ix < t1dimx) &&
+	   (y > 0.0) && (iy < t1dimy) &&
+	   (z > 0.0) && (iz < t1dimz) ) {
+	/* the corresponding point is in the box defined 
+	   by (ix[+1],iy[+1],iz[+1]) */
+	dx = x - ix;
+	dy = y - iy;
+	dz = z - iz;
+	dxdy = dx*dy;
+	dxdz = dx*dz;
+	dydz = dy*dz;
+	dxdydz = dxdy*dz;
+
+	/* we have
+	   v[7]=dxdydz;            coefficient of tbuf(ix+1,iy+1,iz+1)
+	   v[6]=dxdz-dxdydz;       coefficient of tbuf(ix+1,iy,  iz+1)
+	   v[5]=dxdy-dxdydz;       coefficient of tbuf(ix+1,iy+1,iz  )
+	   v[4]=dx-dxdy-v[6];      coefficient of tbuf(ix+1,iy  ,iz  )
+	   v[3]=dydz-dxdydz;       coefficient of tbuf(ix  ,iy+1,iz+1)
+	   v[2]=dz-dydz-v[6];      coefficient of tbuf(ix  ,iy  ,iz+1)
+	   v[1]=dy-dydz-v[5];      coefficient of tbuf(ix  ,iy+1,iz  )
+	   v[0]=1-dy-dz+dydz-v[4]; coefficient of tbuf(ix  ,iy  ,iz  )
+	*/
+	tpt += ix + iy * tdimx + iz * tdimxy + toffset1;
+	v6 = dxdz-dxdydz;
+	v5 = dxdy-dxdydz;
+	v4 = dx-dxdy-v6;
+
+	res = 0;
+	res += dxdydz * (*tpt);            /* tbuf(ix+1,iy+1,iz+1) */
+	tpt --;
+	res += (dydz-dxdydz) * (*tpt);     /* tbuf(ix  ,iy+1,iz+1) */
+	tpt -= t1dimx;
+	res += v6 * (*tpt);                /* tbuf(ix+1  ,iy,  iz+1) */
+	tpt --;
+	res += (dz-dydz-v6) * (*tpt);      /* tbuf(ix  ,iy  ,iz+1) */
+	tpt -= toffset2;
+	res += v5 * (*tpt);                /* tbuf(ix+1,iy+1,iz  ) */
+	tpt --;
+	res += (dy-dydz-v5) * (*tpt);      /* tbuf(ix  ,iy+1,iz  ) */
+	tpt -= t1dimx;
+	res += v4 * (*tpt);                /* tbuf(ix+1,iy  ,iz  ) */
+	tpt --;
+	res += (1-dy-dz+dydz-v4) * (*tpt); /* tbuf(ix  ,iy  ,iz  ) */
+	*rbuf = (u8)_CONVERTI_( res );
+	continue;
+      }
+      /* here, we are sure we are on some border */
+      tpt += ix + iy * tdimx + iz * tdimxy;
+      if ( (x < 0.0) || (ix == t1dimx) ) {
+	if ( (y < 0.0) || (iy == t1dimy) ) {
+	  if ( (z < 0.0) || (iz == t1dimz) ) {
+	    *rbuf = *tpt;
+	    continue;
+	  }
+	  dz = z - iz;
+	  res  = (1-dz) * (*tpt); /* (1-dz)* tbuf(ix,iy,iz) */
+	  tpt += tdimxy;
+	  res += dz * (*tpt);     /* dz * tbuf(ix,iy,iz+1) */
+	  *rbuf = (u8)_CONVERTI_( res );
+	  continue;
+	}
+	dy = y - iy;
+	if ( (z < 0.0) || (iz == t1dimz) ) {
+	  res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy,iz) */
+	  tpt += tdimx;
+	  res += dy * (*tpt);     /* dy * tbuf(ix,iy+1,iz) */
+	  *rbuf = (u8)_CONVERTI_( res );
+	  continue;
+ 	}
+	dz = z - iz;
+	res = (1-dy)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
+	tpt += tdimx;
+	res += dy*(1-dz) * (*tpt);    /* tbuf(ix,iy+1,iz) */
+	tpt += toffset2+1;
+	res += (1-dy)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
+	tpt += tdimx;
+	res += dy*dz * (*tpt);        /* tbuf(ix,iy+1,iz+1) */
+	*rbuf = (u8)_CONVERTI_( res );
+	continue;
+      }
+      /* here we are sure that the border is either
+	 along the Y or the Z axis */
+      dx = x - ix;
+      if ( (y < 0.0) || (iy == t1dimy) ) {
+	if ( (z < 0.0) || (iz == t1dimz) ) {
+	  res = (1-dx) * (*tpt); /* tbuf(ix,iy,iz) */
+	  tpt ++;
+	  res += dx * (*tpt);    /* tbuf(ix+1,iy,iz) */
+	  *rbuf = (u8)_CONVERTI_( res );
+	  continue;
+	}
+	dz = z - iz;
+	res = (1-dx)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
+	tpt ++;
+	res += dx*(1-dz) * (*tpt);    /* tbuf(ix+1,iy,iz) */
+	tpt += tdimxy-1;
+	res += (1-dx)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
+	tpt ++;
+	res += dx*dz * (*tpt);        /* tbuf(ix+1,iy,iz+1) */
+	*rbuf = (u8)_CONVERTI_( res );
+	continue;
+      }
+      /* here we are sure that the border is along the Z axis */
+      dy = y - iy;
+      res = (1-dx)*(1-dy) * (*tpt); /* tbuf(ix,iy,iz) */
+      tpt ++;
+      res += dx*(1-dy) * (*tpt);    /* tbuf(ix+1,iy,iz) */
+      tpt += t1dimx;
+      res += (1-dx)*dy * (*tpt);    /* tbuf(ix,iy+1,iz) */
+      tpt ++;
+      res += dx*dy * (*tpt);        /* tbuf(ix+1,iy+1,iz) */
+      *rbuf = (u8)_CONVERTI_( res );
+    }
+  }
+}
+
+CGAL_INLINE_FUNCTION
+void Reech3DTriLin4x4gb_u8 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim, /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat,   /* transformation matrix */
+			     float gain,
+			     float bias )
+{
+  int i, j, k, ix, iy, iz;
+  double x, y, z, dx, dy, dz, dxdy,dxdz,dydz,dxdydz;
+  double res;
+  double v6, v5, v4;
+  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
+  int tdimx=theDim[0], tdimy=theDim[1], tdimz=theDim[2];
+  int tdimxy=tdimx*tdimy;
+  int toffset1=tdimxy+tdimx+1, toffset2=tdimxy-tdimx-1;
+  int t1dimx=tdimx-1, t1dimy=tdimy-1, t1dimz=tdimz-1;
+  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
+  double ddimz = (double)tdimz-0.5;
+  u8 *tbuf = (u8*)theBuf;
+  u8 *tpt;
+  u8 *rbuf = (u8*)resBuf;
+  double b=bias;
+  double g=gain;
+
+  for ( k = 0; k < rdimz; k ++ ) {
+    if ( get_static_verbose_reech4x4() != 0 )
+      fprintf( stderr, "Processing slice %d\r", k );
+    for ( j = 0; j < rdimy; j ++ )
+    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
+      /* computation of the corresponding point coordinates in theBuf */
+      x = mat[0] * i +  mat[1] * j + mat[2] * k + mat[3];
+      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
+      y = mat[4] * i +  mat[5] * j + mat[6] * k + mat[7];
+      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
+      z = mat[8] * i +  mat[9] * j + mat[10] * k + mat[11];
+      if ((z < -0.5) || ( z > ddimz)) { *rbuf = 0; continue; }
+
+      /* here, the point lies on the borders or completely inside
+	 the image */
+      ix = (int)x;
+      iy = (int)y;
+      iz = (int)z;
+      tpt = (u8 *)tbuf;
+      
+      /* are we on the border or not ? */
+      if ( (x > 0.0) && (ix < t1dimx) &&
+	   (y > 0.0) && (iy < t1dimy) &&
+	   (z > 0.0) && (iz < t1dimz) ) {
+	/* the corresponding point is in the box defined 
+	   by (ix[+1],iy[+1],iz[+1]) */
+	dx = x - ix;
+	dy = y - iy;
+	dz = z - iz;
+	dxdy = dx*dy;
+	dxdz = dx*dz;
+	dydz = dy*dz;
+	dxdydz = dxdy*dz;
+
+	/* we have
+	   v[7]=dxdydz;            coefficient of tbuf(ix+1,iy+1,iz+1)
+	   v[6]=dxdz-dxdydz;       coefficient of tbuf(ix+1,iy,  iz+1)
+	   v[5]=dxdy-dxdydz;       coefficient of tbuf(ix+1,iy+1,iz  )
+	   v[4]=dx-dxdy-v[6];      coefficient of tbuf(ix+1,iy  ,iz  )
+	   v[3]=dydz-dxdydz;       coefficient of tbuf(ix  ,iy+1,iz+1)
+	   v[2]=dz-dydz-v[6];      coefficient of tbuf(ix  ,iy  ,iz+1)
+	   v[1]=dy-dydz-v[5];      coefficient of tbuf(ix  ,iy+1,iz  )
+	   v[0]=1-dy-dz+dydz-v[4]; coefficient of tbuf(ix  ,iy  ,iz  )
+	*/
+	tpt += ix + iy * tdimx + iz * tdimxy + toffset1;
+	v6 = dxdz-dxdydz;
+	v5 = dxdy-dxdydz;
+	v4 = dx-dxdy-v6;
+
+	res = 0;
+	res += dxdydz * (*tpt);            /* tbuf(ix+1,iy+1,iz+1) */
+	tpt --;
+	res += (dydz-dxdydz) * (*tpt);     /* tbuf(ix  ,iy+1,iz+1) */
+	tpt -= t1dimx;
+	res += v6 * (*tpt);                /* tbuf(ix+1  ,iy,  iz+1) */
+	tpt --;
+	res += (dz-dydz-v6) * (*tpt);      /* tbuf(ix  ,iy  ,iz+1) */
+	tpt -= toffset2;
+	res += v5 * (*tpt);                /* tbuf(ix+1,iy+1,iz  ) */
+	tpt --;
+	res += (dy-dydz-v5) * (*tpt);      /* tbuf(ix  ,iy+1,iz  ) */
+	tpt -= t1dimx;
+	res += v4 * (*tpt);                /* tbuf(ix+1,iy  ,iz  ) */
+	tpt --;
+	res += (1-dy-dz+dydz-v4) * (*tpt); /* tbuf(ix  ,iy  ,iz  ) */
+	res = res * g + b;
+	*rbuf = (u8)_CONVERTI_( res );
+	continue;
+      }
+      /* here, we are sure we are on some border */
+      tpt += ix + iy * tdimx + iz * tdimxy;
+      if ( (x < 0.0) || (ix == t1dimx) ) {
+	if ( (y < 0.0) || (iy == t1dimy) ) {
+	  if ( (z < 0.0) || (iz == t1dimz) ) {
+	    res = (double)(*tpt) * g + b;
+	    *rbuf = (u8)_CONVERTI_( res );
+	    continue;
+	  }
+	  dz = z - iz;
+	  res  = (1-dz) * (*tpt); /* (1-dz)* tbuf(ix,iy,iz) */
+	  tpt += tdimxy;
+	  res += dz * (*tpt);     /* dz * tbuf(ix,iy,iz+1) */
+	  res = res * g + b;
+	  *rbuf = (u8)_CONVERTI_( res );
+	  continue;
+	}
+	dy = y - iy;
+	if ( (z < 0.0) || (iz == t1dimz) ) {
+	  res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy,iz) */
+	  tpt += tdimx;
+	  res += dy * (*tpt);     /* dy * tbuf(ix,iy+1,iz) */
+	  res = res * g + b;
+	  *rbuf = (u8)_CONVERTI_( res );
+	  continue;
+ 	}
+	dz = z - iz;
+	res = (1-dy)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
+	tpt += tdimx;
+	res += dy*(1-dz) * (*tpt);    /* tbuf(ix,iy+1,iz) */
+	tpt += toffset2+1;
+	res += (1-dy)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
+	tpt += tdimx;
+	res += dy*dz * (*tpt);        /* tbuf(ix,iy+1,iz+1) */
+	res = res * g + b;
+	*rbuf = (u8)_CONVERTI_( res );
+	continue;
+      }
+      /* here we are sure that the border is either
+	 along the Y or the Z axis */
+      dx = x - ix;
+      if ( (y < 0.0) || (iy == t1dimy) ) {
+	if ( (z < 0.0) || (iz == t1dimz) ) {
+	  res = (1-dx) * (*tpt); /* tbuf(ix,iy,iz) */
+	  tpt ++;
+	  res += dx * (*tpt);    /* tbuf(ix+1,iy,iz) */
+	  res = res * g + b;
+	  *rbuf = (u8)_CONVERTI_( res );
+	  continue;
+	}
+	dz = z - iz;
+	res = (1-dx)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
+	tpt ++;
+	res += dx*(1-dz) * (*tpt);    /* tbuf(ix+1,iy,iz) */
+	tpt += tdimxy-1;
+	res += (1-dx)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
+	tpt ++;
+	res += dx*dz * (*tpt);        /* tbuf(ix+1,iy,iz+1) */
+	res = res * g + b;
+	*rbuf = (u8)_CONVERTI_( res );
+	continue;
+      }
+      /* here we are sure that the border is along the Z axis */
+      dy = y - iy;
+      res = (1-dx)*(1-dy) * (*tpt); /* tbuf(ix,iy,iz) */
+      tpt ++;
+      res += dx*(1-dy) * (*tpt);    /* tbuf(ix+1,iy,iz) */
+      tpt += t1dimx;
+      res += (1-dx)*dy * (*tpt);    /* tbuf(ix,iy+1,iz) */
+      tpt ++;
+      res += dx*dy * (*tpt);        /* tbuf(ix+1,iy+1,iz) */
+      res = res * g + b;
+      *rbuf = (u8)_CONVERTI_( res );
+    }
+  }
+}
+
+CGAL_INLINE_FUNCTION
+void Reech3DNearest4x4_u8 ( void* theBuf, /* buffer to be resampled */
+			      int *theDim,  /* dimensions of this buffer */
+			      void* resBuf, /* result buffer */
+			      int *resDim,  /* dimensions of this buffer */
+			      double* mat   /* transformation matrix */
+			      )
+{
+  int i, j, k, ix, iy, iz;
+  double x, y, z;
+  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
+  int tdimx=theDim[0], tdimy=theDim[1], tdimz=theDim[2];
+  int tdimxy=tdimx*tdimy;
+  int t1dimx=tdimx-1, t1dimy=tdimy-1, t1dimz=tdimz-1;
+  u8 *tbuf = (u8*)theBuf;
+  u8 *rbuf = (u8*)resBuf;
+
+  for ( k = 0; k < rdimz; k ++ ) {
+    if ( get_static_verbose_reech4x4() != 0 )
+      fprintf( stderr, "Processing slice %d\r", k );
+    for ( j = 0; j < rdimy; j ++ )
+    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
+      /* computation of the corresponding point coordinates in theBuf */
+      x = mat[0] * i +  mat[1] * j + mat[2] * k + mat[3];
+      ix = (int)(x+0.5);
+      if (( x < -0.5 ) || ( ix > t1dimx)) { *rbuf = 0; continue; }
+      y = mat[4] * i +  mat[5] * j + mat[6] * k + mat[7];
+      iy = (int)(y+0.5);
+      if (( y < -0.5 ) || ( iy > t1dimy)) { *rbuf = 0; continue; }
+      z = mat[8] * i +  mat[9] * j + mat[10] * k + mat[11];
+      iz = (int)(z+0.5);
+      if (( z < -0.5 ) || ( iz > t1dimz)) { *rbuf = 0; continue; }
+      
+      *rbuf = tbuf[ ix + iy * tdimx + iz * tdimxy ];
+    }
+  }
+}
+
+CGAL_INLINE_FUNCTION
+void Reech2DTriLin4x4_u8 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim,  /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat   /* transformation matrix */
+			     )
+{
+  int i, j, k, ix, iy;
+  double x, y, dx, dy, dxdy;
+  double res, v;
+  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
+  int tdimx=theDim[0], tdimy=theDim[1];
+  int toffset=tdimx-1;
+  int t1dimx=tdimx-1, t1dimy=tdimy-1;
+  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
+  u8 *tbuf = (u8*)theBuf;
+  u8 *tpt;
+  u8 *rbuf = (u8*)resBuf;
+
+  for ( k = 0; k < rdimz; k ++ ) {
+    if ( get_static_verbose_reech4x4() != 0 )
+      fprintf( stderr, "Processing slice %d\r", k );
+    /* tbuf represente le premier point du plan */
+    tbuf  = (u8*)theBuf;
+    tbuf += k*(tdimx * tdimy);
+    for ( j = 0; j < rdimy; j ++ )
+    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
+      /* computation of the corresponding point coordinates in theBuf */
+      x = mat[0] * i +  mat[1] * j +              mat[3];
+      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
+      y = mat[4] * i +  mat[5] * j +              mat[7];
+      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
+
+      /* here, the point lies on the borders or completely inside
+	 the image */
+      ix = (int)x;      
+      iy = (int)y;
+      tpt = (u8 *)tbuf;
+      tpt += ix + iy * tdimx;
+      
+      /* are we on the border or not ? */
+      if ( (x > 0.0) && (ix < t1dimx) &&
+	   (y > 0.0) && (iy < t1dimy) ) {
+	dx = x - ix;
+	dy = y - iy;
+	dxdy = dx*dy;
+	/* we have
+	   v[5]=dxdy;         coefficient of tbuf(ix+1,iy+1)
+	   v[4]=dx-dxdy;      coefficient of tbuf(ix+1,iy  )
+	   v[1]=dy-dxdy;      coefficient of tbuf(ix  ,iy+1)
+	   v[0]=1-dx-dy+dxdy; coefficient of tbuf(ix  ,iy  )
+	*/
+	v = dy-dxdy;
+	res = 0;
+	res += (1-dx-v) * (*tpt);  /* tbuf(ix  ,iy  ) */
+	tpt ++;
+	res += (dx-dxdy) * (*tpt); /* tbuf(ix+1,iy  ) */
+	tpt += toffset;
+	res += v * (*tpt);       /* tbuf(ix,iy+1  ) */
+	tpt ++;
+	res += dxdy * (*tpt);      /* tbuf(ix+1,iy+1) */
+	*rbuf = (u8)_CONVERTI_( res );
+	continue;
+      }
+
+      /* here, we are sure we are on some border */
+      if ( (x < 0.0) || (ix == t1dimx) ) {
+	/* we just look at y */
+	if ( (y < 0.0) || (iy == t1dimy) ) {
+	  *rbuf = *tpt;
+	  continue;
+	}
+	dy = y - iy;
+	res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy) */
+	tpt += tdimx;
+	res += dy * (*tpt);     /* dy * tbuf(ix,iy+1) */
+	*rbuf = (u8)_CONVERTI_( res );
+	continue;
+      }
+      dx = x - ix;
+      res  = (1-dx) * (*tpt); /* (1-dx)* tbuf(ix,iy) */
+      tpt ++;
+      res += dx * (*tpt);     /* dx * tbuf(ix+1,iy) */
+      *rbuf = (u8)_CONVERTI_( res );
+    }
+  }
+}
+
+CGAL_INLINE_FUNCTION
+void Reech2DTriLin4x4gb_u8 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim,  /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat,   /* transformation matrix */
+			     float gain,
+			     float bias )
+{
+  int i, j, k, ix, iy;
+  double x, y, dx, dy, dxdy;
+  double res, v;
+  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
+  int tdimx=theDim[0], tdimy=theDim[1];
+  int toffset=tdimx-1;
+  int t1dimx=tdimx-1, t1dimy=tdimy-1;
+  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
+  u8 *tbuf = (u8*)theBuf;
+  u8 *tpt;
+  u8 *rbuf = (u8*)resBuf;
+  double b=bias;
+  double g=gain;
+
+  for ( k = 0; k < rdimz; k ++ ) {
+    if ( get_static_verbose_reech4x4() != 0 )
+      fprintf( stderr, "Processing slice %d\r", k );
+    /* tbuf represente le premier point du plan */
+    tbuf  = (u8*)theBuf;
+    tbuf += k*(tdimx * tdimy);
+    for ( j = 0; j < rdimy; j ++ )
+    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
+      /* computation of the corresponding point coordinates in theBuf */
+      x = mat[0] * i +  mat[1] * j +              mat[3];
+      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
+      y = mat[4] * i +  mat[5] * j +              mat[7];
+      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
+
+      /* here, the point lies on the borders or completely inside
+	 the image */
+      ix = (int)x;      
+      iy = (int)y;
+      tpt = (u8 *)tbuf;
+      tpt += ix + iy * tdimx;
+      
+      /* are we on the border or not ? */
+      if ( (x > 0.0) && (ix < t1dimx) &&
+	   (y > 0.0) && (iy < t1dimy) ) {
+	dx = x - ix;
+	dy = y - iy;
+	dxdy = dx*dy;
+	/* we have
+	   v[5]=dxdy;         coefficient of tbuf(ix+1,iy+1)
+	   v[4]=dx-dxdy;      coefficient of tbuf(ix+1,iy  )
+	   v[1]=dy-dxdy;      coefficient of tbuf(ix  ,iy+1)
+	   v[0]=1-dx-dy+dxdy; coefficient of tbuf(ix  ,iy  )
+	*/
+	v = dy-dxdy;
+	res = 0;
+	res += (1-dx-v) * (*tpt);  /* tbuf(ix  ,iy  ) */
+	tpt ++;
+	res += (dx-dxdy) * (*tpt); /* tbuf(ix+1,iy  ) */
+	tpt += toffset;
+	res += v * (*tpt);       /* tbuf(ix,iy+1  ) */
+	tpt ++;
+	res += dxdy * (*tpt);      /* tbuf(ix+1,iy+1) */
+	res = res * g + b;
+	*rbuf = (u8)_CONVERTI_( res );
+	continue;
+      }
+
+      /* here, we are sure we are on some border */
+      if ( (x < 0.0) || (ix == t1dimx) ) {
+	/* we just look at y */
+	if ( (y < 0.0) || (iy == t1dimy) ) {
+	  res = (double)(*tpt) * g + b;
+	  *rbuf = (u8)_CONVERTI_( res );
+	  continue;
+	}
+	dy = y - iy;
+	res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy) */
+	tpt += tdimx;
+	res += dy * (*tpt);     /* dy * tbuf(ix,iy+1) */
+	res = (double)(*tpt) * g + b;
+	*rbuf = (u8)_CONVERTI_( res );
+	continue;
+      }
+      dx = x - ix;
+      res  = (1-dx) * (*tpt); /* (1-dx)* tbuf(ix,iy) */
+      tpt ++;
+      res += dx * (*tpt);     /* dx * tbuf(ix+1,iy) */
+      res = res * g + b;
+            *rbuf = (u8)_CONVERTI_( res );
+    }
+  }
+}
+
+CGAL_INLINE_FUNCTION
+void Reech2DNearest4x4_u8 ( void* theBuf, /* buffer to be resampled */
+			      int *theDim,  /* dimensions of this buffer */
+			      void* resBuf, /* result buffer */
+			      int *resDim,  /* dimensions of this buffer */
+			      double* mat   /* transformation matrix */
+			      )
+{
+  int i, j, k, ix, iy;
+  double x, y;
+  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
+  int tdimx=theDim[0], tdimy=theDim[1];
+  int t1dimx=tdimx-1, t1dimy=tdimy-1;
+  u8 *tbuf = (u8*)theBuf;
+  u8 *rbuf = (u8*)resBuf;
+
+  for ( k = 0; k < rdimz; k ++ ) {
+    if ( get_static_verbose_reech4x4() != 0 )
+      fprintf( stderr, "Processing slice %d\r", k );
+    /* tbuf represente le premier point du plan */
+    tbuf  = (u8*)theBuf;
+    tbuf += k*(tdimx * tdimy);
+    for ( j = 0; j < rdimy; j ++ )
+    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
+      /* computation of the corresponding point coordinates in theBuf */
+      x = mat[0] * i +  mat[1] * j + mat[3];
+      ix = (int)(x+0.5);
+      if (( x < -0.5 ) || ( ix > t1dimx)) { *rbuf = 0; continue; }
+      y = mat[4] * i +  mat[5] * j + mat[7];
+      iy = (int)(y+0.5);
+      if (( y < -0.5 ) || ( iy > t1dimy)) { *rbuf = 0; continue; }
+      
+      *rbuf = tbuf[ ix + iy * tdimx ];
+    }
+  }
+}
+
+
+
+
+
+
+/* Resampling procedure.
+
+   Work for 3D images, not for vectorial ones.
+   
+   (double* mat) is the matrix which permits to get
+   from resBuf into theBuf. 
+   If one only have the matrix from theBuf into resBuf,
+   it must be inverted first.
+
+   Soit x le point transforme et ix=(int)x;
+   nous allons distinguer les cas suivants :
+    x < -0.5               => resultat = 0
+    -0.5 <= x < 0.0        => ix=0, on n'interpole pas selon X
+    0.0 < x && ix < dimx-1 => on interpole selon X
+    x < dimx-0.5           => ix=dimx-1, on n'interpole pas selon X
+    x >= dimx-0.5          => resultat = 0
+
+*/
+CGAL_INLINE_FUNCTION
+void Reech3DTriLin4x4_s8 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim, /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat   /* transformation matrix */
+			     )
+{
+  int i, j, k, ix, iy, iz;
+  double x, y, z, dx, dy, dz, dxdy,dxdz,dydz,dxdydz;
+  double res;
+  double v6, v5, v4;
+  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
+  int tdimx=theDim[0], tdimy=theDim[1], tdimz=theDim[2];
+  int tdimxy=tdimx*tdimy;
+  int toffset1=tdimxy+tdimx+1, toffset2=tdimxy-tdimx-1;
+  int t1dimx=tdimx-1, t1dimy=tdimy-1, t1dimz=tdimz-1;
+  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
+  double ddimz = (double)tdimz-0.5;
+  s8 *tbuf = (s8*)theBuf;
+  s8 *tpt;
+  s8 *rbuf = (s8*)resBuf;
+
+  for ( k = 0; k < rdimz; k ++ ) {
+    if ( get_static_verbose_reech4x4() != 0 )
+      fprintf( stderr, "Processing slice %d\r", k );
+    for ( j = 0; j < rdimy; j ++ )
+    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
+      /* computation of the corresponding point coordinates in theBuf */
+      x = mat[0] * i +  mat[1] * j + mat[2] * k + mat[3];
+      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
+      y = mat[4] * i +  mat[5] * j + mat[6] * k + mat[7];
+      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
+      z = mat[8] * i +  mat[9] * j + mat[10] * k + mat[11];
+      if ((z < -0.5) || ( z > ddimz)) { *rbuf = 0; continue; }
+
+      /* here, the point lies on the borders or completely inside
+	 the image */
+      ix = (int)x;
+      iy = (int)y;
+      iz = (int)z;
+      tpt = (s8 *)tbuf;
+      
+      /* are we on the border or not ? */
+      if ( (x > 0.0) && (ix < t1dimx) &&
+	   (y > 0.0) && (iy < t1dimy) &&
+	   (z > 0.0) && (iz < t1dimz) ) {
+	/* the corresponding point is in the box defined 
+	   by (ix[+1],iy[+1],iz[+1]) */
+	dx = x - ix;
+	dy = y - iy;
+	dz = z - iz;
+	dxdy = dx*dy;
+	dxdz = dx*dz;
+	dydz = dy*dz;
+	dxdydz = dxdy*dz;
+
+	/* we have
+	   v[7]=dxdydz;            coefficient of tbuf(ix+1,iy+1,iz+1)
+	   v[6]=dxdz-dxdydz;       coefficient of tbuf(ix+1,iy,  iz+1)
+	   v[5]=dxdy-dxdydz;       coefficient of tbuf(ix+1,iy+1,iz  )
+	   v[4]=dx-dxdy-v[6];      coefficient of tbuf(ix+1,iy  ,iz  )
+	   v[3]=dydz-dxdydz;       coefficient of tbuf(ix  ,iy+1,iz+1)
+	   v[2]=dz-dydz-v[6];      coefficient of tbuf(ix  ,iy  ,iz+1)
+	   v[1]=dy-dydz-v[5];      coefficient of tbuf(ix  ,iy+1,iz  )
+	   v[0]=1-dy-dz+dydz-v[4]; coefficient of tbuf(ix  ,iy  ,iz  )
+	*/
+	tpt += ix + iy * tdimx + iz * tdimxy + toffset1;
+	v6 = dxdz-dxdydz;
+	v5 = dxdy-dxdydz;
+	v4 = dx-dxdy-v6;
+
+	res = 0;
+	res += dxdydz * (*tpt);            /* tbuf(ix+1,iy+1,iz+1) */
+	tpt --;
+	res += (dydz-dxdydz) * (*tpt);     /* tbuf(ix  ,iy+1,iz+1) */
+	tpt -= t1dimx;
+	res += v6 * (*tpt);                /* tbuf(ix+1  ,iy,  iz+1) */
+	tpt --;
+	res += (dz-dydz-v6) * (*tpt);      /* tbuf(ix  ,iy  ,iz+1) */
+	tpt -= toffset2;
+	res += v5 * (*tpt);                /* tbuf(ix+1,iy+1,iz  ) */
+	tpt --;
+	res += (dy-dydz-v5) * (*tpt);      /* tbuf(ix  ,iy+1,iz  ) */
+	tpt -= t1dimx;
+	res += v4 * (*tpt);                /* tbuf(ix+1,iy  ,iz  ) */
+	tpt --;
+	res += (1-dy-dz+dydz-v4) * (*tpt); /* tbuf(ix  ,iy  ,iz  ) */
+	*rbuf = (s8)_CONVERTI_( res );
+	continue;
+      }
+      /* here, we are sure we are on some border */
+      tpt += ix + iy * tdimx + iz * tdimxy;
+      if ( (x < 0.0) || (ix == t1dimx) ) {
+	if ( (y < 0.0) || (iy == t1dimy) ) {
+	  if ( (z < 0.0) || (iz == t1dimz) ) {
+	    *rbuf = *tpt;
+	    continue;
+	  }
+	  dz = z - iz;
+	  res  = (1-dz) * (*tpt); /* (1-dz)* tbuf(ix,iy,iz) */
+	  tpt += tdimxy;
+	  res += dz * (*tpt);     /* dz * tbuf(ix,iy,iz+1) */
+	  *rbuf = (s8)_CONVERTI_( res );
+	  continue;
+	}
+	dy = y - iy;
+	if ( (z < 0.0) || (iz == t1dimz) ) {
+	  res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy,iz) */
+	  tpt += tdimx;
+	  res += dy * (*tpt);     /* dy * tbuf(ix,iy+1,iz) */
+	  *rbuf = (s8)_CONVERTI_( res );
+	  continue;
+ 	}
+	dz = z - iz;
+	res = (1-dy)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
+	tpt += tdimx;
+	res += dy*(1-dz) * (*tpt);    /* tbuf(ix,iy+1,iz) */
+	tpt += toffset2+1;
+	res += (1-dy)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
+	tpt += tdimx;
+	res += dy*dz * (*tpt);        /* tbuf(ix,iy+1,iz+1) */
+	*rbuf = (s8)_CONVERTI_( res );
+	continue;
+      }
+      /* here we are sure that the border is either
+	 along the Y or the Z axis */
+      dx = x - ix;
+      if ( (y < 0.0) || (iy == t1dimy) ) {
+	if ( (z < 0.0) || (iz == t1dimz) ) {
+	  res = (1-dx) * (*tpt); /* tbuf(ix,iy,iz) */
+	  tpt ++;
+	  res += dx * (*tpt);    /* tbuf(ix+1,iy,iz) */
+	  *rbuf = (s8)_CONVERTI_( res );
+	  continue;
+	}
+	dz = z - iz;
+	res = (1-dx)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
+	tpt ++;
+	res += dx*(1-dz) * (*tpt);    /* tbuf(ix+1,iy,iz) */
+	tpt += tdimxy-1;
+	res += (1-dx)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
+	tpt ++;
+	res += dx*dz * (*tpt);        /* tbuf(ix+1,iy,iz+1) */
+	*rbuf = (s8)_CONVERTI_( res );
+	continue;
+      }
+      /* here we are sure that the border is along the Z axis */
+      dy = y - iy;
+      res = (1-dx)*(1-dy) * (*tpt); /* tbuf(ix,iy,iz) */
+      tpt ++;
+      res += dx*(1-dy) * (*tpt);    /* tbuf(ix+1,iy,iz) */
+      tpt += t1dimx;
+      res += (1-dx)*dy * (*tpt);    /* tbuf(ix,iy+1,iz) */
+      tpt ++;
+      res += dx*dy * (*tpt);        /* tbuf(ix+1,iy+1,iz) */
+      *rbuf = (s8)_CONVERTI_( res );
+    }
+  }
+}
+
+CGAL_INLINE_FUNCTION
+void Reech3DTriLin4x4gb_s8 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim, /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat,   /* transformation matrix */
+			     float gain,
+			     float bias )
+{
+  int i, j, k, ix, iy, iz;
+  double x, y, z, dx, dy, dz, dxdy,dxdz,dydz,dxdydz;
+  double res;
+  double v6, v5, v4;
+  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
+  int tdimx=theDim[0], tdimy=theDim[1], tdimz=theDim[2];
+  int tdimxy=tdimx*tdimy;
+  int toffset1=tdimxy+tdimx+1, toffset2=tdimxy-tdimx-1;
+  int t1dimx=tdimx-1, t1dimy=tdimy-1, t1dimz=tdimz-1;
+  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
+  double ddimz = (double)tdimz-0.5;
+  s8 *tbuf = (s8*)theBuf;
+  s8 *tpt;
+  s8 *rbuf = (s8*)resBuf;
+  double b=bias;
+  double g=gain;
+
+  for ( k = 0; k < rdimz; k ++ ) {
+    if ( get_static_verbose_reech4x4() != 0 )
+      fprintf( stderr, "Processing slice %d\r", k );
+    for ( j = 0; j < rdimy; j ++ )
+    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
+      /* computation of the corresponding point coordinates in theBuf */
+      x = mat[0] * i +  mat[1] * j + mat[2] * k + mat[3];
+      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
+      y = mat[4] * i +  mat[5] * j + mat[6] * k + mat[7];
+      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
+      z = mat[8] * i +  mat[9] * j + mat[10] * k + mat[11];
+      if ((z < -0.5) || ( z > ddimz)) { *rbuf = 0; continue; }
+
+      /* here, the point lies on the borders or completely inside
+	 the image */
+      ix = (int)x;
+      iy = (int)y;
+      iz = (int)z;
+      tpt = (s8 *)tbuf;
+      
+      /* are we on the border or not ? */
+      if ( (x > 0.0) && (ix < t1dimx) &&
+	   (y > 0.0) && (iy < t1dimy) &&
+	   (z > 0.0) && (iz < t1dimz) ) {
+	/* the corresponding point is in the box defined 
+	   by (ix[+1],iy[+1],iz[+1]) */
+	dx = x - ix;
+	dy = y - iy;
+	dz = z - iz;
+	dxdy = dx*dy;
+	dxdz = dx*dz;
+	dydz = dy*dz;
+	dxdydz = dxdy*dz;
+
+	/* we have
+	   v[7]=dxdydz;            coefficient of tbuf(ix+1,iy+1,iz+1)
+	   v[6]=dxdz-dxdydz;       coefficient of tbuf(ix+1,iy,  iz+1)
+	   v[5]=dxdy-dxdydz;       coefficient of tbuf(ix+1,iy+1,iz  )
+	   v[4]=dx-dxdy-v[6];      coefficient of tbuf(ix+1,iy  ,iz  )
+	   v[3]=dydz-dxdydz;       coefficient of tbuf(ix  ,iy+1,iz+1)
+	   v[2]=dz-dydz-v[6];      coefficient of tbuf(ix  ,iy  ,iz+1)
+	   v[1]=dy-dydz-v[5];      coefficient of tbuf(ix  ,iy+1,iz  )
+	   v[0]=1-dy-dz+dydz-v[4]; coefficient of tbuf(ix  ,iy  ,iz  )
+	*/
+	tpt += ix + iy * tdimx + iz * tdimxy + toffset1;
+	v6 = dxdz-dxdydz;
+	v5 = dxdy-dxdydz;
+	v4 = dx-dxdy-v6;
+
+	res = 0;
+	res += dxdydz * (*tpt);            /* tbuf(ix+1,iy+1,iz+1) */
+	tpt --;
+	res += (dydz-dxdydz) * (*tpt);     /* tbuf(ix  ,iy+1,iz+1) */
+	tpt -= t1dimx;
+	res += v6 * (*tpt);                /* tbuf(ix+1  ,iy,  iz+1) */
+	tpt --;
+	res += (dz-dydz-v6) * (*tpt);      /* tbuf(ix  ,iy  ,iz+1) */
+	tpt -= toffset2;
+	res += v5 * (*tpt);                /* tbuf(ix+1,iy+1,iz  ) */
+	tpt --;
+	res += (dy-dydz-v5) * (*tpt);      /* tbuf(ix  ,iy+1,iz  ) */
+	tpt -= t1dimx;
+	res += v4 * (*tpt);                /* tbuf(ix+1,iy  ,iz  ) */
+	tpt --;
+	res += (1-dy-dz+dydz-v4) * (*tpt); /* tbuf(ix  ,iy  ,iz  ) */
+	res = res * g + b;
+	*rbuf = (s8)_CONVERTI_( res );
+	continue;
+      }
+      /* here, we are sure we are on some border */
+      tpt += ix + iy * tdimx + iz * tdimxy;
+      if ( (x < 0.0) || (ix == t1dimx) ) {
+	if ( (y < 0.0) || (iy == t1dimy) ) {
+	  if ( (z < 0.0) || (iz == t1dimz) ) {
+	    res = (double)(*tpt) * g + b;
+	    *rbuf = (s8)_CONVERTI_( res );
+	    continue;
+	  }
+	  dz = z - iz;
+	  res  = (1-dz) * (*tpt); /* (1-dz)* tbuf(ix,iy,iz) */
+	  tpt += tdimxy;
+	  res += dz * (*tpt);     /* dz * tbuf(ix,iy,iz+1) */
+	  res = res * g + b;
+	  *rbuf = (s8)_CONVERTI_( res );
+	  continue;
+	}
+	dy = y - iy;
+	if ( (z < 0.0) || (iz == t1dimz) ) {
+	  res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy,iz) */
+	  tpt += tdimx;
+	  res += dy * (*tpt);     /* dy * tbuf(ix,iy+1,iz) */
+	  res = res * g + b;
+	  *rbuf = (s8)_CONVERTI_( res );
+	  continue;
+ 	}
+	dz = z - iz;
+	res = (1-dy)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
+	tpt += tdimx;
+	res += dy*(1-dz) * (*tpt);    /* tbuf(ix,iy+1,iz) */
+	tpt += toffset2+1;
+	res += (1-dy)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
+	tpt += tdimx;
+	res += dy*dz * (*tpt);        /* tbuf(ix,iy+1,iz+1) */
+	res = res * g + b;
+	*rbuf = (s8)_CONVERTI_( res );
+	continue;
+      }
+      /* here we are sure that the border is either
+	 along the Y or the Z axis */
+      dx = x - ix;
+      if ( (y < 0.0) || (iy == t1dimy) ) {
+	if ( (z < 0.0) || (iz == t1dimz) ) {
+	  res = (1-dx) * (*tpt); /* tbuf(ix,iy,iz) */
+	  tpt ++;
+	  res += dx * (*tpt);    /* tbuf(ix+1,iy,iz) */
+	  res = res * g + b;
+	  *rbuf = (s8)_CONVERTI_( res );
+	  continue;
+	}
+	dz = z - iz;
+	res = (1-dx)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
+	tpt ++;
+	res += dx*(1-dz) * (*tpt);    /* tbuf(ix+1,iy,iz) */
+	tpt += tdimxy-1;
+	res += (1-dx)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
+	tpt ++;
+	res += dx*dz * (*tpt);        /* tbuf(ix+1,iy,iz+1) */
+	res = res * g + b;
+	*rbuf = (s8)_CONVERTI_( res );
+	continue;
+      }
+      /* here we are sure that the border is along the Z axis */
+      dy = y - iy;
+      res = (1-dx)*(1-dy) * (*tpt); /* tbuf(ix,iy,iz) */
+      tpt ++;
+      res += dx*(1-dy) * (*tpt);    /* tbuf(ix+1,iy,iz) */
+      tpt += t1dimx;
+      res += (1-dx)*dy * (*tpt);    /* tbuf(ix,iy+1,iz) */
+      tpt ++;
+      res += dx*dy * (*tpt);        /* tbuf(ix+1,iy+1,iz) */
+      res = res * g + b;
+      *rbuf = (s8)_CONVERTI_( res );
+    }
+  }
+}
+
+CGAL_INLINE_FUNCTION
+void Reech3DNearest4x4_s8 ( void* theBuf, /* buffer to be resampled */
+			      int *theDim,  /* dimensions of this buffer */
+			      void* resBuf, /* result buffer */
+			      int *resDim,  /* dimensions of this buffer */
+			      double* mat   /* transformation matrix */
+			      )
+{
+  int i, j, k, ix, iy, iz;
+  double x, y, z;
+  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
+  int tdimx=theDim[0], tdimy=theDim[1], tdimz=theDim[2];
+  int tdimxy=tdimx*tdimy;
+  int t1dimx=tdimx-1, t1dimy=tdimy-1, t1dimz=tdimz-1;
+  s8 *tbuf = (s8*)theBuf;
+  s8 *rbuf = (s8*)resBuf;
+
+  for ( k = 0; k < rdimz; k ++ ) {
+    if ( get_static_verbose_reech4x4() != 0 )
+      fprintf( stderr, "Processing slice %d\r", k );
+    for ( j = 0; j < rdimy; j ++ )
+    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
+      /* computation of the corresponding point coordinates in theBuf */
+      x = mat[0] * i +  mat[1] * j + mat[2] * k + mat[3];
+      ix = (int)(x+0.5);
+      if (( x < -0.5 ) || ( ix > t1dimx)) { *rbuf = 0; continue; }
+      y = mat[4] * i +  mat[5] * j + mat[6] * k + mat[7];
+      iy = (int)(y+0.5);
+      if (( y < -0.5 ) || ( iy > t1dimy)) { *rbuf = 0; continue; }
+      z = mat[8] * i +  mat[9] * j + mat[10] * k + mat[11];
+      iz = (int)(z+0.5);
+      if (( z < -0.5 ) || ( iz > t1dimz)) { *rbuf = 0; continue; }
+      
+      *rbuf = tbuf[ ix + iy * tdimx + iz * tdimxy ];
+    }
+  }
+}
+
+CGAL_INLINE_FUNCTION
+void Reech2DTriLin4x4_s8 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim,  /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat   /* transformation matrix */
+			     )
+{
+  int i, j, k, ix, iy;
+  double x, y, dx, dy, dxdy;
+  double res, v;
+  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
+  int tdimx=theDim[0], tdimy=theDim[1];
+  int toffset=tdimx-1;
+  int t1dimx=tdimx-1, t1dimy=tdimy-1;
+  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
+  s8 *tbuf = (s8*)theBuf;
+  s8 *tpt;
+  s8 *rbuf = (s8*)resBuf;
+
+  for ( k = 0; k < rdimz; k ++ ) {
+    if ( get_static_verbose_reech4x4() != 0 )
+      fprintf( stderr, "Processing slice %d\r", k );
+    /* tbuf represente le premier point du plan */
+    tbuf  = (s8*)theBuf;
+    tbuf += k*(tdimx * tdimy);
+    for ( j = 0; j < rdimy; j ++ )
+    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
+      /* computation of the corresponding point coordinates in theBuf */
+      x = mat[0] * i +  mat[1] * j +              mat[3];
+      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
+      y = mat[4] * i +  mat[5] * j +              mat[7];
+      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
+
+      /* here, the point lies on the borders or completely inside
+	 the image */
+      ix = (int)x;      
+      iy = (int)y;
+      tpt = (s8 *)tbuf;
+      tpt += ix + iy * tdimx;
+      
+      /* are we on the border or not ? */
+      if ( (x > 0.0) && (ix < t1dimx) &&
+	   (y > 0.0) && (iy < t1dimy) ) {
+	dx = x - ix;
+	dy = y - iy;
+	dxdy = dx*dy;
+	/* we have
+	   v[5]=dxdy;         coefficient of tbuf(ix+1,iy+1)
+	   v[4]=dx-dxdy;      coefficient of tbuf(ix+1,iy  )
+	   v[1]=dy-dxdy;      coefficient of tbuf(ix  ,iy+1)
+	   v[0]=1-dx-dy+dxdy; coefficient of tbuf(ix  ,iy  )
+	*/
+	v = dy-dxdy;
+	res = 0;
+	res += (1-dx-v) * (*tpt);  /* tbuf(ix  ,iy  ) */
+	tpt ++;
+	res += (dx-dxdy) * (*tpt); /* tbuf(ix+1,iy  ) */
+	tpt += toffset;
+	res += v * (*tpt);       /* tbuf(ix,iy+1  ) */
+	tpt ++;
+	res += dxdy * (*tpt);      /* tbuf(ix+1,iy+1) */
+	*rbuf = (s8)_CONVERTI_( res );
+	continue;
+      }
+
+      /* here, we are sure we are on some border */
+      if ( (x < 0.0) || (ix == t1dimx) ) {
+	/* we just look at y */
+	if ( (y < 0.0) || (iy == t1dimy) ) {
+	  *rbuf = *tpt;
+	  continue;
+	}
+	dy = y - iy;
+	res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy) */
+	tpt += tdimx;
+	res += dy * (*tpt);     /* dy * tbuf(ix,iy+1) */
+	*rbuf = (s8)_CONVERTI_( res );
+	continue;
+      }
+      dx = x - ix;
+      res  = (1-dx) * (*tpt); /* (1-dx)* tbuf(ix,iy) */
+      tpt ++;
+      res += dx * (*tpt);     /* dx * tbuf(ix+1,iy) */
+      *rbuf = (s8)_CONVERTI_( res );
+    }
+  }
+}
+
+CGAL_INLINE_FUNCTION
+void Reech2DTriLin4x4gb_s8 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim,  /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat,   /* transformation matrix */
+			     float gain,
+			     float bias )
+{
+  int i, j, k, ix, iy;
+  double x, y, dx, dy, dxdy;
+  double res, v;
+  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
+  int tdimx=theDim[0], tdimy=theDim[1];
+  int toffset=tdimx-1;
+  int t1dimx=tdimx-1, t1dimy=tdimy-1;
+  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
+  s8 *tbuf = (s8*)theBuf;
+  s8 *tpt;
+  s8 *rbuf = (s8*)resBuf;
+  double b=bias;
+  double g=gain;
+
+  for ( k = 0; k < rdimz; k ++ ) {
+    if ( get_static_verbose_reech4x4() != 0 )
+      fprintf( stderr, "Processing slice %d\r", k );
+    /* tbuf represente le premier point du plan */
+    tbuf  = (s8*)theBuf;
+    tbuf += k*(tdimx * tdimy);
+    for ( j = 0; j < rdimy; j ++ )
+    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
+      /* computation of the corresponding point coordinates in theBuf */
+      x = mat[0] * i +  mat[1] * j +              mat[3];
+      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
+      y = mat[4] * i +  mat[5] * j +              mat[7];
+      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
+
+      /* here, the point lies on the borders or completely inside
+	 the image */
+      ix = (int)x;      
+      iy = (int)y;
+      tpt = (s8 *)tbuf;
+      tpt += ix + iy * tdimx;
+      
+      /* are we on the border or not ? */
+      if ( (x > 0.0) && (ix < t1dimx) &&
+	   (y > 0.0) && (iy < t1dimy) ) {
+	dx = x - ix;
+	dy = y - iy;
+	dxdy = dx*dy;
+	/* we have
+	   v[5]=dxdy;         coefficient of tbuf(ix+1,iy+1)
+	   v[4]=dx-dxdy;      coefficient of tbuf(ix+1,iy  )
+	   v[1]=dy-dxdy;      coefficient of tbuf(ix  ,iy+1)
+	   v[0]=1-dx-dy+dxdy; coefficient of tbuf(ix  ,iy  )
+	*/
+	v = dy-dxdy;
+	res = 0;
+	res += (1-dx-v) * (*tpt);  /* tbuf(ix  ,iy  ) */
+	tpt ++;
+	res += (dx-dxdy) * (*tpt); /* tbuf(ix+1,iy  ) */
+	tpt += toffset;
+	res += v * (*tpt);       /* tbuf(ix,iy+1  ) */
+	tpt ++;
+	res += dxdy * (*tpt);      /* tbuf(ix+1,iy+1) */
+	res = res * g + b;
+	*rbuf = (s8)_CONVERTI_( res );
+	continue;
+      }
+
+      /* here, we are sure we are on some border */
+      if ( (x < 0.0) || (ix == t1dimx) ) {
+	/* we just look at y */
+	if ( (y < 0.0) || (iy == t1dimy) ) {
+	  res = (double)(*tpt) * g + b;
+	  *rbuf = (s8)_CONVERTI_( res );
+	  continue;
+	}
+	dy = y - iy;
+	res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy) */
+	tpt += tdimx;
+	res += dy * (*tpt);     /* dy * tbuf(ix,iy+1) */
+	res = (double)(*tpt) * g + b;
+	*rbuf = (s8)_CONVERTI_( res );
+	continue;
+      }
+      dx = x - ix;
+      res  = (1-dx) * (*tpt); /* (1-dx)* tbuf(ix,iy) */
+      tpt ++;
+      res += dx * (*tpt);     /* dx * tbuf(ix+1,iy) */
+      res = res * g + b;
+            *rbuf = (s8)_CONVERTI_( res );
+    }
+  }
+}
+
+CGAL_INLINE_FUNCTION
+void Reech2DNearest4x4_s8 ( void* theBuf, /* buffer to be resampled */
+			      int *theDim,  /* dimensions of this buffer */
+			      void* resBuf, /* result buffer */
+			      int *resDim,  /* dimensions of this buffer */
+			      double* mat   /* transformation matrix */
+			      )
+{
+  int i, j, k, ix, iy;
+  double x, y;
+  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
+  int tdimx=theDim[0], tdimy=theDim[1];
+  int t1dimx=tdimx-1, t1dimy=tdimy-1;
+  s8 *tbuf = (s8*)theBuf;
+  s8 *rbuf = (s8*)resBuf;
+
+  for ( k = 0; k < rdimz; k ++ ) {
+    if ( get_static_verbose_reech4x4() != 0 )
+      fprintf( stderr, "Processing slice %d\r", k );
+    /* tbuf represente le premier point du plan */
+    tbuf  = (s8*)theBuf;
+    tbuf += k*(tdimx * tdimy);
+    for ( j = 0; j < rdimy; j ++ )
+    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
+      /* computation of the corresponding point coordinates in theBuf */
+      x = mat[0] * i +  mat[1] * j + mat[3];
+      ix = (int)(x+0.5);
+      if (( x < -0.5 ) || ( ix > t1dimx)) { *rbuf = 0; continue; }
+      y = mat[4] * i +  mat[5] * j + mat[7];
+      iy = (int)(y+0.5);
+      if (( y < -0.5 ) || ( iy > t1dimy)) { *rbuf = 0; continue; }
+      
+      *rbuf = tbuf[ ix + iy * tdimx ];
+    }
+  }
+}
+
+
+
+
+
+
+/* Resampling procedure.
+
+   Work for 3D images, not for vectorial ones.
+   
+   (double* mat) is the matrix which permits to get
+   from resBuf into theBuf. 
+   If one only have the matrix from theBuf into resBuf,
+   it must be inverted first.
+
+   Soit x le point transforme et ix=(int)x;
+   nous allons distinguer les cas suivants :
+    x < -0.5               => resultat = 0
+    -0.5 <= x < 0.0        => ix=0, on n'interpole pas selon X
+    0.0 < x && ix < dimx-1 => on interpole selon X
+    x < dimx-0.5           => ix=dimx-1, on n'interpole pas selon X
+    x >= dimx-0.5          => resultat = 0
+
+*/
+
+CGAL_INLINE_FUNCTION
+void Reech3DTriLin4x4_u16 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim, /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat   /* transformation matrix */
+			     )
+{
+  int i, j, k, ix, iy, iz;
+  double x, y, z, dx, dy, dz, dxdy,dxdz,dydz,dxdydz;
+  double res;
+  double v6, v5, v4;
+  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
+  int tdimx=theDim[0], tdimy=theDim[1], tdimz=theDim[2];
+  int tdimxy=tdimx*tdimy;
+  int toffset1=tdimxy+tdimx+1, toffset2=tdimxy-tdimx-1;
+  int t1dimx=tdimx-1, t1dimy=tdimy-1, t1dimz=tdimz-1;
+  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
+  double ddimz = (double)tdimz-0.5;
+  u16 *tbuf = (u16*)theBuf;
+  u16 *tpt;
+  u16 *rbuf = (u16*)resBuf;
+
+  for ( k = 0; k < rdimz; k ++ ) {
+    if ( get_static_verbose_reech4x4() != 0 )
+      fprintf( stderr, "Processing slice %d\r", k );
+    for ( j = 0; j < rdimy; j ++ )
+    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
+      /* computation of the corresponding point coordinates in theBuf */
+      x = mat[0] * i +  mat[1] * j + mat[2] * k + mat[3];
+      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
+      y = mat[4] * i +  mat[5] * j + mat[6] * k + mat[7];
+      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
+      z = mat[8] * i +  mat[9] * j + mat[10] * k + mat[11];
+      if ((z < -0.5) || ( z > ddimz)) { *rbuf = 0; continue; }
+
+      /* here, the point lies on the borders or completely inside
+	 the image */
+      ix = (int)x;
+      iy = (int)y;
+      iz = (int)z;
+      tpt = (u16 *)tbuf;
+      
+      /* are we on the border or not ? */
+      if ( (x > 0.0) && (ix < t1dimx) &&
+	   (y > 0.0) && (iy < t1dimy) &&
+	   (z > 0.0) && (iz < t1dimz) ) {
+	/* the corresponding point is in the box defined 
+	   by (ix[+1],iy[+1],iz[+1]) */
+	dx = x - ix;
+	dy = y - iy;
+	dz = z - iz;
+	dxdy = dx*dy;
+	dxdz = dx*dz;
+	dydz = dy*dz;
+	dxdydz = dxdy*dz;
+
+	/* we have
+	   v[7]=dxdydz;            coefficient of tbuf(ix+1,iy+1,iz+1)
+	   v[6]=dxdz-dxdydz;       coefficient of tbuf(ix+1,iy,  iz+1)
+	   v[5]=dxdy-dxdydz;       coefficient of tbuf(ix+1,iy+1,iz  )
+	   v[4]=dx-dxdy-v[6];      coefficient of tbuf(ix+1,iy  ,iz  )
+	   v[3]=dydz-dxdydz;       coefficient of tbuf(ix  ,iy+1,iz+1)
+	   v[2]=dz-dydz-v[6];      coefficient of tbuf(ix  ,iy  ,iz+1)
+	   v[1]=dy-dydz-v[5];      coefficient of tbuf(ix  ,iy+1,iz  )
+	   v[0]=1-dy-dz+dydz-v[4]; coefficient of tbuf(ix  ,iy  ,iz  )
+	*/
+	tpt += ix + iy * tdimx + iz * tdimxy + toffset1;
+	v6 = dxdz-dxdydz;
+	v5 = dxdy-dxdydz;
+	v4 = dx-dxdy-v6;
+
+	res = 0;
+	res += dxdydz * (*tpt);            /* tbuf(ix+1,iy+1,iz+1) */
+	tpt --;
+	res += (dydz-dxdydz) * (*tpt);     /* tbuf(ix  ,iy+1,iz+1) */
+	tpt -= t1dimx;
+	res += v6 * (*tpt);                /* tbuf(ix+1  ,iy,  iz+1) */
+	tpt --;
+	res += (dz-dydz-v6) * (*tpt);      /* tbuf(ix  ,iy  ,iz+1) */
+	tpt -= toffset2;
+	res += v5 * (*tpt);                /* tbuf(ix+1,iy+1,iz  ) */
+	tpt --;
+	res += (dy-dydz-v5) * (*tpt);      /* tbuf(ix  ,iy+1,iz  ) */
+	tpt -= t1dimx;
+	res += v4 * (*tpt);                /* tbuf(ix+1,iy  ,iz  ) */
+	tpt --;
+	res += (1-dy-dz+dydz-v4) * (*tpt); /* tbuf(ix  ,iy  ,iz  ) */
+	*rbuf = (u16)_CONVERTI_( res );
+	continue;
+      }
+      /* here, we are sure we are on some border */
+      tpt += ix + iy * tdimx + iz * tdimxy;
+      if ( (x < 0.0) || (ix == t1dimx) ) {
+	if ( (y < 0.0) || (iy == t1dimy) ) {
+	  if ( (z < 0.0) || (iz == t1dimz) ) {
+	    *rbuf = *tpt;
+	    continue;
+	  }
+	  dz = z - iz;
+	  res  = (1-dz) * (*tpt); /* (1-dz)* tbuf(ix,iy,iz) */
+	  tpt += tdimxy;
+	  res += dz * (*tpt);     /* dz * tbuf(ix,iy,iz+1) */
+	  *rbuf = (u16)_CONVERTI_( res );
+	  continue;
+	}
+	dy = y - iy;
+	if ( (z < 0.0) || (iz == t1dimz) ) {
+	  res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy,iz) */
+	  tpt += tdimx;
+	  res += dy * (*tpt);     /* dy * tbuf(ix,iy+1,iz) */
+	  *rbuf = (u16)_CONVERTI_( res );
+	  continue;
+ 	}
+	dz = z - iz;
+	res = (1-dy)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
+	tpt += tdimx;
+	res += dy*(1-dz) * (*tpt);    /* tbuf(ix,iy+1,iz) */
+	tpt += toffset2+1;
+	res += (1-dy)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
+	tpt += tdimx;
+	res += dy*dz * (*tpt);        /* tbuf(ix,iy+1,iz+1) */
+	*rbuf = (u16)_CONVERTI_( res );
+	continue;
+      }
+      /* here we are sure that the border is either
+	 along the Y or the Z axis */
+      dx = x - ix;
+      if ( (y < 0.0) || (iy == t1dimy) ) {
+	if ( (z < 0.0) || (iz == t1dimz) ) {
+	  res = (1-dx) * (*tpt); /* tbuf(ix,iy,iz) */
+	  tpt ++;
+	  res += dx * (*tpt);    /* tbuf(ix+1,iy,iz) */
+	  *rbuf = (u16)_CONVERTI_( res );
+	  continue;
+	}
+	dz = z - iz;
+	res = (1-dx)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
+	tpt ++;
+	res += dx*(1-dz) * (*tpt);    /* tbuf(ix+1,iy,iz) */
+	tpt += tdimxy-1;
+	res += (1-dx)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
+	tpt ++;
+	res += dx*dz * (*tpt);        /* tbuf(ix+1,iy,iz+1) */
+	*rbuf = (u16)_CONVERTI_( res );
+	continue;
+      }
+      /* here we are sure that the border is along the Z axis */
+      dy = y - iy;
+      res = (1-dx)*(1-dy) * (*tpt); /* tbuf(ix,iy,iz) */
+      tpt ++;
+      res += dx*(1-dy) * (*tpt);    /* tbuf(ix+1,iy,iz) */
+      tpt += t1dimx;
+      res += (1-dx)*dy * (*tpt);    /* tbuf(ix,iy+1,iz) */
+      tpt ++;
+      res += dx*dy * (*tpt);        /* tbuf(ix+1,iy+1,iz) */
+      *rbuf = (u16)_CONVERTI_( res );
+    }
+  }
+}
+
+CGAL_INLINE_FUNCTION
+void Reech3DTriLin4x4gb_u16 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim, /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat,   /* transformation matrix */
+			     float gain,
+			     float bias )
+{
+  int i, j, k, ix, iy, iz;
+  double x, y, z, dx, dy, dz, dxdy,dxdz,dydz,dxdydz;
+  double res;
+  double v6, v5, v4;
+  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
+  int tdimx=theDim[0], tdimy=theDim[1], tdimz=theDim[2];
+  int tdimxy=tdimx*tdimy;
+  int toffset1=tdimxy+tdimx+1, toffset2=tdimxy-tdimx-1;
+  int t1dimx=tdimx-1, t1dimy=tdimy-1, t1dimz=tdimz-1;
+  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
+  double ddimz = (double)tdimz-0.5;
+  u16 *tbuf = (u16*)theBuf;
+  u16 *tpt;
+  u16 *rbuf = (u16*)resBuf;
+  double b=bias;
+  double g=gain;
+
+  for ( k = 0; k < rdimz; k ++ ) {
+    if ( get_static_verbose_reech4x4() != 0 )
+      fprintf( stderr, "Processing slice %d\r", k );
+    for ( j = 0; j < rdimy; j ++ )
+    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
+      /* computation of the corresponding point coordinates in theBuf */
+      x = mat[0] * i +  mat[1] * j + mat[2] * k + mat[3];
+      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
+      y = mat[4] * i +  mat[5] * j + mat[6] * k + mat[7];
+      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
+      z = mat[8] * i +  mat[9] * j + mat[10] * k + mat[11];
+      if ((z < -0.5) || ( z > ddimz)) { *rbuf = 0; continue; }
+
+      /* here, the point lies on the borders or completely inside
+	 the image */
+      ix = (int)x;
+      iy = (int)y;
+      iz = (int)z;
+      tpt = (u16 *)tbuf;
+      
+      /* are we on the border or not ? */
+      if ( (x > 0.0) && (ix < t1dimx) &&
+	   (y > 0.0) && (iy < t1dimy) &&
+	   (z > 0.0) && (iz < t1dimz) ) {
+	/* the corresponding point is in the box defined 
+	   by (ix[+1],iy[+1],iz[+1]) */
+	dx = x - ix;
+	dy = y - iy;
+	dz = z - iz;
+	dxdy = dx*dy;
+	dxdz = dx*dz;
+	dydz = dy*dz;
+	dxdydz = dxdy*dz;
+
+	/* we have
+	   v[7]=dxdydz;            coefficient of tbuf(ix+1,iy+1,iz+1)
+	   v[6]=dxdz-dxdydz;       coefficient of tbuf(ix+1,iy,  iz+1)
+	   v[5]=dxdy-dxdydz;       coefficient of tbuf(ix+1,iy+1,iz  )
+	   v[4]=dx-dxdy-v[6];      coefficient of tbuf(ix+1,iy  ,iz  )
+	   v[3]=dydz-dxdydz;       coefficient of tbuf(ix  ,iy+1,iz+1)
+	   v[2]=dz-dydz-v[6];      coefficient of tbuf(ix  ,iy  ,iz+1)
+	   v[1]=dy-dydz-v[5];      coefficient of tbuf(ix  ,iy+1,iz  )
+	   v[0]=1-dy-dz+dydz-v[4]; coefficient of tbuf(ix  ,iy  ,iz  )
+	*/
+	tpt += ix + iy * tdimx + iz * tdimxy + toffset1;
+	v6 = dxdz-dxdydz;
+	v5 = dxdy-dxdydz;
+	v4 = dx-dxdy-v6;
+
+	res = 0;
+	res += dxdydz * (*tpt);            /* tbuf(ix+1,iy+1,iz+1) */
+	tpt --;
+	res += (dydz-dxdydz) * (*tpt);     /* tbuf(ix  ,iy+1,iz+1) */
+	tpt -= t1dimx;
+	res += v6 * (*tpt);                /* tbuf(ix+1  ,iy,  iz+1) */
+	tpt --;
+	res += (dz-dydz-v6) * (*tpt);      /* tbuf(ix  ,iy  ,iz+1) */
+	tpt -= toffset2;
+	res += v5 * (*tpt);                /* tbuf(ix+1,iy+1,iz  ) */
+	tpt --;
+	res += (dy-dydz-v5) * (*tpt);      /* tbuf(ix  ,iy+1,iz  ) */
+	tpt -= t1dimx;
+	res += v4 * (*tpt);                /* tbuf(ix+1,iy  ,iz  ) */
+	tpt --;
+	res += (1-dy-dz+dydz-v4) * (*tpt); /* tbuf(ix  ,iy  ,iz  ) */
+	res = res * g + b;
+	*rbuf = (u16)_CONVERTI_( res );
+	continue;
+      }
+      /* here, we are sure we are on some border */
+      tpt += ix + iy * tdimx + iz * tdimxy;
+      if ( (x < 0.0) || (ix == t1dimx) ) {
+	if ( (y < 0.0) || (iy == t1dimy) ) {
+	  if ( (z < 0.0) || (iz == t1dimz) ) {
+	    res = (double)(*tpt) * g + b;
+	    *rbuf = (u16)_CONVERTI_( res );
+	    continue;
+	  }
+	  dz = z - iz;
+	  res  = (1-dz) * (*tpt); /* (1-dz)* tbuf(ix,iy,iz) */
+	  tpt += tdimxy;
+	  res += dz * (*tpt);     /* dz * tbuf(ix,iy,iz+1) */
+	  res = res * g + b;
+	  *rbuf = (u16)_CONVERTI_( res );
+	  continue;
+	}
+	dy = y - iy;
+	if ( (z < 0.0) || (iz == t1dimz) ) {
+	  res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy,iz) */
+	  tpt += tdimx;
+	  res += dy * (*tpt);     /* dy * tbuf(ix,iy+1,iz) */
+	  res = res * g + b;
+	  *rbuf = (u16)_CONVERTI_( res );
+	  continue;
+ 	}
+	dz = z - iz;
+	res = (1-dy)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
+	tpt += tdimx;
+	res += dy*(1-dz) * (*tpt);    /* tbuf(ix,iy+1,iz) */
+	tpt += toffset2+1;
+	res += (1-dy)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
+	tpt += tdimx;
+	res += dy*dz * (*tpt);        /* tbuf(ix,iy+1,iz+1) */
+	res = res * g + b;
+	*rbuf = (u16)_CONVERTI_( res );
+	continue;
+      }
+      /* here we are sure that the border is either
+	 along the Y or the Z axis */
+      dx = x - ix;
+      if ( (y < 0.0) || (iy == t1dimy) ) {
+	if ( (z < 0.0) || (iz == t1dimz) ) {
+	  res = (1-dx) * (*tpt); /* tbuf(ix,iy,iz) */
+	  tpt ++;
+	  res += dx * (*tpt);    /* tbuf(ix+1,iy,iz) */
+	  res = res * g + b;
+	  *rbuf = (u16)_CONVERTI_( res );
+	  continue;
+	}
+	dz = z - iz;
+	res = (1-dx)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
+	tpt ++;
+	res += dx*(1-dz) * (*tpt);    /* tbuf(ix+1,iy,iz) */
+	tpt += tdimxy-1;
+	res += (1-dx)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
+	tpt ++;
+	res += dx*dz * (*tpt);        /* tbuf(ix+1,iy,iz+1) */
+	res = res * g + b;
+	*rbuf = (u16)_CONVERTI_( res );
+	continue;
+      }
+      /* here we are sure that the border is along the Z axis */
+      dy = y - iy;
+      res = (1-dx)*(1-dy) * (*tpt); /* tbuf(ix,iy,iz) */
+      tpt ++;
+      res += dx*(1-dy) * (*tpt);    /* tbuf(ix+1,iy,iz) */
+      tpt += t1dimx;
+      res += (1-dx)*dy * (*tpt);    /* tbuf(ix,iy+1,iz) */
+      tpt ++;
+      res += dx*dy * (*tpt);        /* tbuf(ix+1,iy+1,iz) */
+      res = res * g + b;
+      *rbuf = (u16)_CONVERTI_( res );
+    }
+  }
+}
+
+CGAL_INLINE_FUNCTION
+void Reech3DNearest4x4_u16 ( void* theBuf, /* buffer to be resampled */
+			      int *theDim,  /* dimensions of this buffer */
+			      void* resBuf, /* result buffer */
+			      int *resDim,  /* dimensions of this buffer */
+			      double* mat   /* transformation matrix */
+			      )
+{
+  int i, j, k, ix, iy, iz;
+  double x, y, z;
+  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
+  int tdimx=theDim[0], tdimy=theDim[1], tdimz=theDim[2];
+  int tdimxy=tdimx*tdimy;
+  int t1dimx=tdimx-1, t1dimy=tdimy-1, t1dimz=tdimz-1;
+  u16 *tbuf = (u16*)theBuf;
+  u16 *rbuf = (u16*)resBuf;
+
+  for ( k = 0; k < rdimz; k ++ ) {
+    if ( get_static_verbose_reech4x4() != 0 )
+      fprintf( stderr, "Processing slice %d\r", k );
+    for ( j = 0; j < rdimy; j ++ )
+    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
+      /* computation of the corresponding point coordinates in theBuf */
+      x = mat[0] * i +  mat[1] * j + mat[2] * k + mat[3];
+      ix = (int)(x+0.5);
+      if (( x < -0.5 ) || ( ix > t1dimx)) { *rbuf = 0; continue; }
+      y = mat[4] * i +  mat[5] * j + mat[6] * k + mat[7];
+      iy = (int)(y+0.5);
+      if (( y < -0.5 ) || ( iy > t1dimy)) { *rbuf = 0; continue; }
+      z = mat[8] * i +  mat[9] * j + mat[10] * k + mat[11];
+      iz = (int)(z+0.5);
+      if (( z < -0.5 ) || ( iz > t1dimz)) { *rbuf = 0; continue; }
+      
+      *rbuf = tbuf[ ix + iy * tdimx + iz * tdimxy ];
+    }
+  }
+}
+
+CGAL_INLINE_FUNCTION
+void Reech2DTriLin4x4_u16 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim,  /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat   /* transformation matrix */
+			     )
+{
+  int i, j, k, ix, iy;
+  double x, y, dx, dy, dxdy;
+  double res, v;
+  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
+  int tdimx=theDim[0], tdimy=theDim[1];
+  int toffset=tdimx-1;
+  int t1dimx=tdimx-1, t1dimy=tdimy-1;
+  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
+  u16 *tbuf = (u16*)theBuf;
+  u16 *tpt;
+  u16 *rbuf = (u16*)resBuf;
+
+  for ( k = 0; k < rdimz; k ++ ) {
+    if ( get_static_verbose_reech4x4() != 0 )
+      fprintf( stderr, "Processing slice %d\r", k );
+    /* tbuf represente le premier point du plan */
+    tbuf  = (u16*)theBuf;
+    tbuf += k*(tdimx * tdimy);
+    for ( j = 0; j < rdimy; j ++ )
+    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
+      /* computation of the corresponding point coordinates in theBuf */
+      x = mat[0] * i +  mat[1] * j +              mat[3];
+      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
+      y = mat[4] * i +  mat[5] * j +              mat[7];
+      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
+
+      /* here, the point lies on the borders or completely inside
+	 the image */
+      ix = (int)x;      
+      iy = (int)y;
+      tpt = (u16 *)tbuf;
+      tpt += ix + iy * tdimx;
+      
+      /* are we on the border or not ? */
+      if ( (x > 0.0) && (ix < t1dimx) &&
+	   (y > 0.0) && (iy < t1dimy) ) {
+	dx = x - ix;
+	dy = y - iy;
+	dxdy = dx*dy;
+	/* we have
+	   v[5]=dxdy;         coefficient of tbuf(ix+1,iy+1)
+	   v[4]=dx-dxdy;      coefficient of tbuf(ix+1,iy  )
+	   v[1]=dy-dxdy;      coefficient of tbuf(ix  ,iy+1)
+	   v[0]=1-dx-dy+dxdy; coefficient of tbuf(ix  ,iy  )
+	*/
+	v = dy-dxdy;
+	res = 0;
+	res += (1-dx-v) * (*tpt);  /* tbuf(ix  ,iy  ) */
+	tpt ++;
+	res += (dx-dxdy) * (*tpt); /* tbuf(ix+1,iy  ) */
+	tpt += toffset;
+	res += v * (*tpt);       /* tbuf(ix,iy+1  ) */
+	tpt ++;
+	res += dxdy * (*tpt);      /* tbuf(ix+1,iy+1) */
+	*rbuf = (u16)_CONVERTI_( res );
+	continue;
+      }
+
+      /* here, we are sure we are on some border */
+      if ( (x < 0.0) || (ix == t1dimx) ) {
+	/* we just look at y */
+	if ( (y < 0.0) || (iy == t1dimy) ) {
+	  *rbuf = *tpt;
+	  continue;
+	}
+	dy = y - iy;
+	res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy) */
+	tpt += tdimx;
+	res += dy * (*tpt);     /* dy * tbuf(ix,iy+1) */
+	*rbuf = (u16)_CONVERTI_( res );
+	continue;
+      }
+      dx = x - ix;
+      res  = (1-dx) * (*tpt); /* (1-dx)* tbuf(ix,iy) */
+      tpt ++;
+      res += dx * (*tpt);     /* dx * tbuf(ix+1,iy) */
+      *rbuf = (u16)_CONVERTI_( res );
+    }
+  }
+}
+
+CGAL_INLINE_FUNCTION
+void Reech2DTriLin4x4gb_u16 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim,  /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat,   /* transformation matrix */
+			     float gain,
+			     float bias )
+{
+  int i, j, k, ix, iy;
+  double x, y, dx, dy, dxdy;
+  double res, v;
+  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
+  int tdimx=theDim[0], tdimy=theDim[1];
+  int toffset=tdimx-1;
+  int t1dimx=tdimx-1, t1dimy=tdimy-1;
+  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
+  u16 *tbuf = (u16*)theBuf;
+  u16 *tpt;
+  u16 *rbuf = (u16*)resBuf;
+  double b=bias;
+  double g=gain;
+
+  for ( k = 0; k < rdimz; k ++ ) {
+    if ( get_static_verbose_reech4x4() != 0 )
+      fprintf( stderr, "Processing slice %d\r", k );
+    /* tbuf represente le premier point du plan */
+    tbuf  = (u16*)theBuf;
+    tbuf += k*(tdimx * tdimy);
+    for ( j = 0; j < rdimy; j ++ )
+    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
+      /* computation of the corresponding point coordinates in theBuf */
+      x = mat[0] * i +  mat[1] * j +              mat[3];
+      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
+      y = mat[4] * i +  mat[5] * j +              mat[7];
+      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
+
+      /* here, the point lies on the borders or completely inside
+	 the image */
+      ix = (int)x;      
+      iy = (int)y;
+      tpt = (u16 *)tbuf;
+      tpt += ix + iy * tdimx;
+      
+      /* are we on the border or not ? */
+      if ( (x > 0.0) && (ix < t1dimx) &&
+	   (y > 0.0) && (iy < t1dimy) ) {
+	dx = x - ix;
+	dy = y - iy;
+	dxdy = dx*dy;
+	/* we have
+	   v[5]=dxdy;         coefficient of tbuf(ix+1,iy+1)
+	   v[4]=dx-dxdy;      coefficient of tbuf(ix+1,iy  )
+	   v[1]=dy-dxdy;      coefficient of tbuf(ix  ,iy+1)
+	   v[0]=1-dx-dy+dxdy; coefficient of tbuf(ix  ,iy  )
+	*/
+	v = dy-dxdy;
+	res = 0;
+	res += (1-dx-v) * (*tpt);  /* tbuf(ix  ,iy  ) */
+	tpt ++;
+	res += (dx-dxdy) * (*tpt); /* tbuf(ix+1,iy  ) */
+	tpt += toffset;
+	res += v * (*tpt);       /* tbuf(ix,iy+1  ) */
+	tpt ++;
+	res += dxdy * (*tpt);      /* tbuf(ix+1,iy+1) */
+	res = res * g + b;
+	*rbuf = (u16)_CONVERTI_( res );
+	continue;
+      }
+
+      /* here, we are sure we are on some border */
+      if ( (x < 0.0) || (ix == t1dimx) ) {
+	/* we just look at y */
+	if ( (y < 0.0) || (iy == t1dimy) ) {
+	  res = (double)(*tpt) * g + b;
+	  *rbuf = (u16)_CONVERTI_( res );
+	  continue;
+	}
+	dy = y - iy;
+	res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy) */
+	tpt += tdimx;
+	res += dy * (*tpt);     /* dy * tbuf(ix,iy+1) */
+	res = (double)(*tpt) * g + b;
+	*rbuf = (u16)_CONVERTI_( res );
+	continue;
+      }
+      dx = x - ix;
+      res  = (1-dx) * (*tpt); /* (1-dx)* tbuf(ix,iy) */
+      tpt ++;
+      res += dx * (*tpt);     /* dx * tbuf(ix+1,iy) */
+      res = res * g + b;
+            *rbuf = (u16)_CONVERTI_( res );
+    }
+  }
+}
+
+CGAL_INLINE_FUNCTION
+void Reech2DNearest4x4_u16 ( void* theBuf, /* buffer to be resampled */
+			      int *theDim,  /* dimensions of this buffer */
+			      void* resBuf, /* result buffer */
+			      int *resDim,  /* dimensions of this buffer */
+			      double* mat   /* transformation matrix */
+			      )
+{
+  int i, j, k, ix, iy;
+  double x, y;
+  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
+  int tdimx=theDim[0], tdimy=theDim[1];
+  int t1dimx=tdimx-1, t1dimy=tdimy-1;
+  u16 *tbuf = (u16*)theBuf;
+  u16 *rbuf = (u16*)resBuf;
+
+  for ( k = 0; k < rdimz; k ++ ) {
+    if ( get_static_verbose_reech4x4() != 0 )
+      fprintf( stderr, "Processing slice %d\r", k );
+    /* tbuf represente le premier point du plan */
+    tbuf  = (u16*)theBuf;
+    tbuf += k*(tdimx * tdimy);
+    for ( j = 0; j < rdimy; j ++ )
+    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
+      /* computation of the corresponding point coordinates in theBuf */
+      x = mat[0] * i +  mat[1] * j + mat[3];
+      ix = (int)(x+0.5);
+      if (( x < -0.5 ) || ( ix > t1dimx)) { *rbuf = 0; continue; }
+      y = mat[4] * i +  mat[5] * j + mat[7];
+      iy = (int)(y+0.5);
+      if (( y < -0.5 ) || ( iy > t1dimy)) { *rbuf = 0; continue; }
+      
+      *rbuf = tbuf[ ix + iy * tdimx ];
+    }
+  }
+}
+
+
+
+
+
+
+/* Resampling procedure.
+
+   Work for 3D images, not for vectorial ones.
+   
+   (double* mat) is the matrix which permits to get
+   from resBuf into theBuf. 
+   If one only have the matrix from theBuf into resBuf,
+   it must be inverted first.
+
+   Soit x le point transforme et ix=(int)x;
+   nous allons distinguer les cas suivants :
+    x < -0.5               => resultat = 0
+    -0.5 <= x < 0.0        => ix=0, on n'interpole pas selon X
+    0.0 < x && ix < dimx-1 => on interpole selon X
+    x < dimx-0.5           => ix=dimx-1, on n'interpole pas selon X
+    x >= dimx-0.5          => resultat = 0
+
+*/
+
+CGAL_INLINE_FUNCTION
+void Reech3DTriLin4x4_s16 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim, /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat   /* transformation matrix */
+			     )
+{
+  int i, j, k, ix, iy, iz;
+  double x, y, z, dx, dy, dz, dxdy,dxdz,dydz,dxdydz;
+  double res;
+  double v6, v5, v4;
+  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
+  int tdimx=theDim[0], tdimy=theDim[1], tdimz=theDim[2];
+  int tdimxy=tdimx*tdimy;
+  int toffset1=tdimxy+tdimx+1, toffset2=tdimxy-tdimx-1;
+  int t1dimx=tdimx-1, t1dimy=tdimy-1, t1dimz=tdimz-1;
+  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
+  double ddimz = (double)tdimz-0.5;
+  s16 *tbuf = (s16*)theBuf;
+  s16 *tpt;
+  s16 *rbuf = (s16*)resBuf;
+
+  for ( k = 0; k < rdimz; k ++ ) {
+    if ( get_static_verbose_reech4x4() != 0 )
+      fprintf( stderr, "Processing slice %d\r", k );
+    for ( j = 0; j < rdimy; j ++ )
+    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
+      /* computation of the corresponding point coordinates in theBuf */
+      x = mat[0] * i +  mat[1] * j + mat[2] * k + mat[3];
+      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
+      y = mat[4] * i +  mat[5] * j + mat[6] * k + mat[7];
+      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
+      z = mat[8] * i +  mat[9] * j + mat[10] * k + mat[11];
+      if ((z < -0.5) || ( z > ddimz)) { *rbuf = 0; continue; }
+
+      /* here, the point lies on the borders or completely inside
+	 the image */
+      ix = (int)x;
+      iy = (int)y;
+      iz = (int)z;
+      tpt = (s16 *)tbuf;
+      
+      /* are we on the border or not ? */
+      if ( (x > 0.0) && (ix < t1dimx) &&
+	   (y > 0.0) && (iy < t1dimy) &&
+	   (z > 0.0) && (iz < t1dimz) ) {
+	/* the corresponding point is in the box defined 
+	   by (ix[+1],iy[+1],iz[+1]) */
+	dx = x - ix;
+	dy = y - iy;
+	dz = z - iz;
+	dxdy = dx*dy;
+	dxdz = dx*dz;
+	dydz = dy*dz;
+	dxdydz = dxdy*dz;
+
+	/* we have
+	   v[7]=dxdydz;            coefficient of tbuf(ix+1,iy+1,iz+1)
+	   v[6]=dxdz-dxdydz;       coefficient of tbuf(ix+1,iy,  iz+1)
+	   v[5]=dxdy-dxdydz;       coefficient of tbuf(ix+1,iy+1,iz  )
+	   v[4]=dx-dxdy-v[6];      coefficient of tbuf(ix+1,iy  ,iz  )
+	   v[3]=dydz-dxdydz;       coefficient of tbuf(ix  ,iy+1,iz+1)
+	   v[2]=dz-dydz-v[6];      coefficient of tbuf(ix  ,iy  ,iz+1)
+	   v[1]=dy-dydz-v[5];      coefficient of tbuf(ix  ,iy+1,iz  )
+	   v[0]=1-dy-dz+dydz-v[4]; coefficient of tbuf(ix  ,iy  ,iz  )
+	*/
+	tpt += ix + iy * tdimx + iz * tdimxy + toffset1;
+	v6 = dxdz-dxdydz;
+	v5 = dxdy-dxdydz;
+	v4 = dx-dxdy-v6;
+
+	res = 0;
+	res += dxdydz * (*tpt);            /* tbuf(ix+1,iy+1,iz+1) */
+	tpt --;
+	res += (dydz-dxdydz) * (*tpt);     /* tbuf(ix  ,iy+1,iz+1) */
+	tpt -= t1dimx;
+	res += v6 * (*tpt);                /* tbuf(ix+1  ,iy,  iz+1) */
+	tpt --;
+	res += (dz-dydz-v6) * (*tpt);      /* tbuf(ix  ,iy  ,iz+1) */
+	tpt -= toffset2;
+	res += v5 * (*tpt);                /* tbuf(ix+1,iy+1,iz  ) */
+	tpt --;
+	res += (dy-dydz-v5) * (*tpt);      /* tbuf(ix  ,iy+1,iz  ) */
+	tpt -= t1dimx;
+	res += v4 * (*tpt);                /* tbuf(ix+1,iy  ,iz  ) */
+	tpt --;
+	res += (1-dy-dz+dydz-v4) * (*tpt); /* tbuf(ix  ,iy  ,iz  ) */
+	*rbuf = (s16)_CONVERTI_( res );
+	continue;
+      }
+      /* here, we are sure we are on some border */
+      tpt += ix + iy * tdimx + iz * tdimxy;
+      if ( (x < 0.0) || (ix == t1dimx) ) {
+	if ( (y < 0.0) || (iy == t1dimy) ) {
+	  if ( (z < 0.0) || (iz == t1dimz) ) {
+	    *rbuf = *tpt;
+	    continue;
+	  }
+	  dz = z - iz;
+	  res  = (1-dz) * (*tpt); /* (1-dz)* tbuf(ix,iy,iz) */
+	  tpt += tdimxy;
+	  res += dz * (*tpt);     /* dz * tbuf(ix,iy,iz+1) */
+	  *rbuf = (s16)_CONVERTI_( res );
+	  continue;
+	}
+	dy = y - iy;
+	if ( (z < 0.0) || (iz == t1dimz) ) {
+	  res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy,iz) */
+	  tpt += tdimx;
+	  res += dy * (*tpt);     /* dy * tbuf(ix,iy+1,iz) */
+	  *rbuf = (s16)_CONVERTI_( res );
+	  continue;
+ 	}
+	dz = z - iz;
+	res = (1-dy)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
+	tpt += tdimx;
+	res += dy*(1-dz) * (*tpt);    /* tbuf(ix,iy+1,iz) */
+	tpt += toffset2+1;
+	res += (1-dy)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
+	tpt += tdimx;
+	res += dy*dz * (*tpt);        /* tbuf(ix,iy+1,iz+1) */
+	*rbuf = (s16)_CONVERTI_( res );
+	continue;
+      }
+      /* here we are sure that the border is either
+	 along the Y or the Z axis */
+      dx = x - ix;
+      if ( (y < 0.0) || (iy == t1dimy) ) {
+	if ( (z < 0.0) || (iz == t1dimz) ) {
+	  res = (1-dx) * (*tpt); /* tbuf(ix,iy,iz) */
+	  tpt ++;
+	  res += dx * (*tpt);    /* tbuf(ix+1,iy,iz) */
+	  *rbuf = (s16)_CONVERTI_( res );
+	  continue;
+	}
+	dz = z - iz;
+	res = (1-dx)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
+	tpt ++;
+	res += dx*(1-dz) * (*tpt);    /* tbuf(ix+1,iy,iz) */
+	tpt += tdimxy-1;
+	res += (1-dx)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
+	tpt ++;
+	res += dx*dz * (*tpt);        /* tbuf(ix+1,iy,iz+1) */
+	*rbuf = (s16)_CONVERTI_( res );
+	continue;
+      }
+      /* here we are sure that the border is along the Z axis */
+      dy = y - iy;
+      res = (1-dx)*(1-dy) * (*tpt); /* tbuf(ix,iy,iz) */
+      tpt ++;
+      res += dx*(1-dy) * (*tpt);    /* tbuf(ix+1,iy,iz) */
+      tpt += t1dimx;
+      res += (1-dx)*dy * (*tpt);    /* tbuf(ix,iy+1,iz) */
+      tpt ++;
+      res += dx*dy * (*tpt);        /* tbuf(ix+1,iy+1,iz) */
+      *rbuf = (s16)_CONVERTI_( res );
+    }
+  }
+}
+
+CGAL_INLINE_FUNCTION
+void Reech3DTriLin4x4gb_s16 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim, /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat,   /* transformation matrix */
+			     float gain,
+			     float bias )
+{
+  int i, j, k, ix, iy, iz;
+  double x, y, z, dx, dy, dz, dxdy,dxdz,dydz,dxdydz;
+  double res;
+  double v6, v5, v4;
+  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
+  int tdimx=theDim[0], tdimy=theDim[1], tdimz=theDim[2];
+  int tdimxy=tdimx*tdimy;
+  int toffset1=tdimxy+tdimx+1, toffset2=tdimxy-tdimx-1;
+  int t1dimx=tdimx-1, t1dimy=tdimy-1, t1dimz=tdimz-1;
+  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
+  double ddimz = (double)tdimz-0.5;
+  s16 *tbuf = (s16*)theBuf;
+  s16 *tpt;
+  s16 *rbuf = (s16*)resBuf;
+  double b=bias;
+  double g=gain;
+
+  for ( k = 0; k < rdimz; k ++ ) {
+    if ( get_static_verbose_reech4x4() != 0 )
+      fprintf( stderr, "Processing slice %d\r", k );
+    for ( j = 0; j < rdimy; j ++ )
+    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
+      /* computation of the corresponding point coordinates in theBuf */
+      x = mat[0] * i +  mat[1] * j + mat[2] * k + mat[3];
+      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
+      y = mat[4] * i +  mat[5] * j + mat[6] * k + mat[7];
+      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
+      z = mat[8] * i +  mat[9] * j + mat[10] * k + mat[11];
+      if ((z < -0.5) || ( z > ddimz)) { *rbuf = 0; continue; }
+
+      /* here, the point lies on the borders or completely inside
+	 the image */
+      ix = (int)x;
+      iy = (int)y;
+      iz = (int)z;
+      tpt = (s16 *)tbuf;
+      
+      /* are we on the border or not ? */
+      if ( (x > 0.0) && (ix < t1dimx) &&
+	   (y > 0.0) && (iy < t1dimy) &&
+	   (z > 0.0) && (iz < t1dimz) ) {
+	/* the corresponding point is in the box defined 
+	   by (ix[+1],iy[+1],iz[+1]) */
+	dx = x - ix;
+	dy = y - iy;
+	dz = z - iz;
+	dxdy = dx*dy;
+	dxdz = dx*dz;
+	dydz = dy*dz;
+	dxdydz = dxdy*dz;
+
+	/* we have
+	   v[7]=dxdydz;            coefficient of tbuf(ix+1,iy+1,iz+1)
+	   v[6]=dxdz-dxdydz;       coefficient of tbuf(ix+1,iy,  iz+1)
+	   v[5]=dxdy-dxdydz;       coefficient of tbuf(ix+1,iy+1,iz  )
+	   v[4]=dx-dxdy-v[6];      coefficient of tbuf(ix+1,iy  ,iz  )
+	   v[3]=dydz-dxdydz;       coefficient of tbuf(ix  ,iy+1,iz+1)
+	   v[2]=dz-dydz-v[6];      coefficient of tbuf(ix  ,iy  ,iz+1)
+	   v[1]=dy-dydz-v[5];      coefficient of tbuf(ix  ,iy+1,iz  )
+	   v[0]=1-dy-dz+dydz-v[4]; coefficient of tbuf(ix  ,iy  ,iz  )
+	*/
+	tpt += ix + iy * tdimx + iz * tdimxy + toffset1;
+	v6 = dxdz-dxdydz;
+	v5 = dxdy-dxdydz;
+	v4 = dx-dxdy-v6;
+
+	res = 0;
+	res += dxdydz * (*tpt);            /* tbuf(ix+1,iy+1,iz+1) */
+	tpt --;
+	res += (dydz-dxdydz) * (*tpt);     /* tbuf(ix  ,iy+1,iz+1) */
+	tpt -= t1dimx;
+	res += v6 * (*tpt);                /* tbuf(ix+1  ,iy,  iz+1) */
+	tpt --;
+	res += (dz-dydz-v6) * (*tpt);      /* tbuf(ix  ,iy  ,iz+1) */
+	tpt -= toffset2;
+	res += v5 * (*tpt);                /* tbuf(ix+1,iy+1,iz  ) */
+	tpt --;
+	res += (dy-dydz-v5) * (*tpt);      /* tbuf(ix  ,iy+1,iz  ) */
+	tpt -= t1dimx;
+	res += v4 * (*tpt);                /* tbuf(ix+1,iy  ,iz  ) */
+	tpt --;
+	res += (1-dy-dz+dydz-v4) * (*tpt); /* tbuf(ix  ,iy  ,iz  ) */
+	res = res * g + b;
+	*rbuf = (s16)_CONVERTI_( res );
+	continue;
+      }
+      /* here, we are sure we are on some border */
+      tpt += ix + iy * tdimx + iz * tdimxy;
+      if ( (x < 0.0) || (ix == t1dimx) ) {
+	if ( (y < 0.0) || (iy == t1dimy) ) {
+	  if ( (z < 0.0) || (iz == t1dimz) ) {
+	    res = (double)(*tpt) * g + b;
+	    *rbuf = (s16)_CONVERTI_( res );
+	    continue;
+	  }
+	  dz = z - iz;
+	  res  = (1-dz) * (*tpt); /* (1-dz)* tbuf(ix,iy,iz) */
+	  tpt += tdimxy;
+	  res += dz * (*tpt);     /* dz * tbuf(ix,iy,iz+1) */
+	  res = res * g + b;
+	  *rbuf = (s16)_CONVERTI_( res );
+	  continue;
+	}
+	dy = y - iy;
+	if ( (z < 0.0) || (iz == t1dimz) ) {
+	  res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy,iz) */
+	  tpt += tdimx;
+	  res += dy * (*tpt);     /* dy * tbuf(ix,iy+1,iz) */
+	  res = res * g + b;
+	  *rbuf = (s16)_CONVERTI_( res );
+	  continue;
+ 	}
+	dz = z - iz;
+	res = (1-dy)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
+	tpt += tdimx;
+	res += dy*(1-dz) * (*tpt);    /* tbuf(ix,iy+1,iz) */
+	tpt += toffset2+1;
+	res += (1-dy)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
+	tpt += tdimx;
+	res += dy*dz * (*tpt);        /* tbuf(ix,iy+1,iz+1) */
+	res = res * g + b;
+	*rbuf = (s16)_CONVERTI_( res );
+	continue;
+      }
+      /* here we are sure that the border is either
+	 along the Y or the Z axis */
+      dx = x - ix;
+      if ( (y < 0.0) || (iy == t1dimy) ) {
+	if ( (z < 0.0) || (iz == t1dimz) ) {
+	  res = (1-dx) * (*tpt); /* tbuf(ix,iy,iz) */
+	  tpt ++;
+	  res += dx * (*tpt);    /* tbuf(ix+1,iy,iz) */
+	  res = res * g + b;
+	  *rbuf = (s16)_CONVERTI_( res );
+	  continue;
+	}
+	dz = z - iz;
+	res = (1-dx)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
+	tpt ++;
+	res += dx*(1-dz) * (*tpt);    /* tbuf(ix+1,iy,iz) */
+	tpt += tdimxy-1;
+	res += (1-dx)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
+	tpt ++;
+	res += dx*dz * (*tpt);        /* tbuf(ix+1,iy,iz+1) */
+	res = res * g + b;
+	*rbuf = (s16)_CONVERTI_( res );
+	continue;
+      }
+      /* here we are sure that the border is along the Z axis */
+      dy = y - iy;
+      res = (1-dx)*(1-dy) * (*tpt); /* tbuf(ix,iy,iz) */
+      tpt ++;
+      res += dx*(1-dy) * (*tpt);    /* tbuf(ix+1,iy,iz) */
+      tpt += t1dimx;
+      res += (1-dx)*dy * (*tpt);    /* tbuf(ix,iy+1,iz) */
+      tpt ++;
+      res += dx*dy * (*tpt);        /* tbuf(ix+1,iy+1,iz) */
+      res = res * g + b;
+      *rbuf = (s16)_CONVERTI_( res );
+    }
+  }
+}
+
+CGAL_INLINE_FUNCTION
+void Reech3DNearest4x4_s16 ( void* theBuf, /* buffer to be resampled */
+			      int *theDim,  /* dimensions of this buffer */
+			      void* resBuf, /* result buffer */
+			      int *resDim,  /* dimensions of this buffer */
+			      double* mat   /* transformation matrix */
+			      )
+{
+  int i, j, k, ix, iy, iz;
+  double x, y, z;
+  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
+  int tdimx=theDim[0], tdimy=theDim[1], tdimz=theDim[2];
+  int tdimxy=tdimx*tdimy;
+  int t1dimx=tdimx-1, t1dimy=tdimy-1, t1dimz=tdimz-1;
+  s16 *tbuf = (s16*)theBuf;
+  s16 *rbuf = (s16*)resBuf;
+
+  for ( k = 0; k < rdimz; k ++ ) {
+    if ( get_static_verbose_reech4x4() != 0 )
+      fprintf( stderr, "Processing slice %d\r", k );
+    for ( j = 0; j < rdimy; j ++ )
+    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
+      /* computation of the corresponding point coordinates in theBuf */
+      x = mat[0] * i +  mat[1] * j + mat[2] * k + mat[3];
+      ix = (int)(x+0.5);
+      if (( x < -0.5 ) || ( ix > t1dimx)) { *rbuf = 0; continue; }
+      y = mat[4] * i +  mat[5] * j + mat[6] * k + mat[7];
+      iy = (int)(y+0.5);
+      if (( y < -0.5 ) || ( iy > t1dimy)) { *rbuf = 0; continue; }
+      z = mat[8] * i +  mat[9] * j + mat[10] * k + mat[11];
+      iz = (int)(z+0.5);
+      if (( z < -0.5 ) || ( iz > t1dimz)) { *rbuf = 0; continue; }
+      
+      *rbuf = tbuf[ ix + iy * tdimx + iz * tdimxy ];
+    }
+  }
+}
+
+CGAL_INLINE_FUNCTION
+void Reech2DTriLin4x4_s16 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim,  /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat   /* transformation matrix */
+			     )
+{
+  int i, j, k, ix, iy;
+  double x, y, dx, dy, dxdy;
+  double res, v;
+  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
+  int tdimx=theDim[0], tdimy=theDim[1];
+  int toffset=tdimx-1;
+  int t1dimx=tdimx-1, t1dimy=tdimy-1;
+  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
+  s16 *tbuf = (s16*)theBuf;
+  s16 *tpt;
+  s16 *rbuf = (s16*)resBuf;
+
+  for ( k = 0; k < rdimz; k ++ ) {
+    if ( get_static_verbose_reech4x4() != 0 )
+      fprintf( stderr, "Processing slice %d\r", k );
+    /* tbuf represente le premier point du plan */
+    tbuf  = (s16*)theBuf;
+    tbuf += k*(tdimx * tdimy);
+    for ( j = 0; j < rdimy; j ++ )
+    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
+      /* computation of the corresponding point coordinates in theBuf */
+      x = mat[0] * i +  mat[1] * j +              mat[3];
+      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
+      y = mat[4] * i +  mat[5] * j +              mat[7];
+      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
+
+      /* here, the point lies on the borders or completely inside
+	 the image */
+      ix = (int)x;      
+      iy = (int)y;
+      tpt = (s16 *)tbuf;
+      tpt += ix + iy * tdimx;
+      
+      /* are we on the border or not ? */
+      if ( (x > 0.0) && (ix < t1dimx) &&
+	   (y > 0.0) && (iy < t1dimy) ) {
+	dx = x - ix;
+	dy = y - iy;
+	dxdy = dx*dy;
+	/* we have
+	   v[5]=dxdy;         coefficient of tbuf(ix+1,iy+1)
+	   v[4]=dx-dxdy;      coefficient of tbuf(ix+1,iy  )
+	   v[1]=dy-dxdy;      coefficient of tbuf(ix  ,iy+1)
+	   v[0]=1-dx-dy+dxdy; coefficient of tbuf(ix  ,iy  )
+	*/
+	v = dy-dxdy;
+	res = 0;
+	res += (1-dx-v) * (*tpt);  /* tbuf(ix  ,iy  ) */
+	tpt ++;
+	res += (dx-dxdy) * (*tpt); /* tbuf(ix+1,iy  ) */
+	tpt += toffset;
+	res += v * (*tpt);       /* tbuf(ix,iy+1  ) */
+	tpt ++;
+	res += dxdy * (*tpt);      /* tbuf(ix+1,iy+1) */
+	*rbuf = (s16)_CONVERTI_( res );
+	continue;
+      }
+
+      /* here, we are sure we are on some border */
+      if ( (x < 0.0) || (ix == t1dimx) ) {
+	/* we just look at y */
+	if ( (y < 0.0) || (iy == t1dimy) ) {
+	  *rbuf = *tpt;
+	  continue;
+	}
+	dy = y - iy;
+	res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy) */
+	tpt += tdimx;
+	res += dy * (*tpt);     /* dy * tbuf(ix,iy+1) */
+	*rbuf = (s16)_CONVERTI_( res );
+	continue;
+      }
+      dx = x - ix;
+      res  = (1-dx) * (*tpt); /* (1-dx)* tbuf(ix,iy) */
+      tpt ++;
+      res += dx * (*tpt);     /* dx * tbuf(ix+1,iy) */
+      *rbuf = (s16)_CONVERTI_( res );
+    }
+  }
+}
+
+CGAL_INLINE_FUNCTION
+void Reech2DTriLin4x4gb_s16 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim,  /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat,   /* transformation matrix */
+			     float gain,
+			     float bias )
+{
+  int i, j, k, ix, iy;
+  double x, y, dx, dy, dxdy;
+  double res, v;
+  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
+  int tdimx=theDim[0], tdimy=theDim[1];
+  int toffset=tdimx-1;
+  int t1dimx=tdimx-1, t1dimy=tdimy-1;
+  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
+  s16 *tbuf = (s16*)theBuf;
+  s16 *tpt;
+  s16 *rbuf = (s16*)resBuf;
+  double b=bias;
+  double g=gain;
+
+  for ( k = 0; k < rdimz; k ++ ) {
+    if ( get_static_verbose_reech4x4() != 0 )
+      fprintf( stderr, "Processing slice %d\r", k );
+    /* tbuf represente le premier point du plan */
+    tbuf  = (s16*)theBuf;
+    tbuf += k*(tdimx * tdimy);
+    for ( j = 0; j < rdimy; j ++ )
+    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
+      /* computation of the corresponding point coordinates in theBuf */
+      x = mat[0] * i +  mat[1] * j +              mat[3];
+      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
+      y = mat[4] * i +  mat[5] * j +              mat[7];
+      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
+
+      /* here, the point lies on the borders or completely inside
+	 the image */
+      ix = (int)x;      
+      iy = (int)y;
+      tpt = (s16 *)tbuf;
+      tpt += ix + iy * tdimx;
+      
+      /* are we on the border or not ? */
+      if ( (x > 0.0) && (ix < t1dimx) &&
+	   (y > 0.0) && (iy < t1dimy) ) {
+	dx = x - ix;
+	dy = y - iy;
+	dxdy = dx*dy;
+	/* we have
+	   v[5]=dxdy;         coefficient of tbuf(ix+1,iy+1)
+	   v[4]=dx-dxdy;      coefficient of tbuf(ix+1,iy  )
+	   v[1]=dy-dxdy;      coefficient of tbuf(ix  ,iy+1)
+	   v[0]=1-dx-dy+dxdy; coefficient of tbuf(ix  ,iy  )
+	*/
+	v = dy-dxdy;
+	res = 0;
+	res += (1-dx-v) * (*tpt);  /* tbuf(ix  ,iy  ) */
+	tpt ++;
+	res += (dx-dxdy) * (*tpt); /* tbuf(ix+1,iy  ) */
+	tpt += toffset;
+	res += v * (*tpt);       /* tbuf(ix,iy+1  ) */
+	tpt ++;
+	res += dxdy * (*tpt);      /* tbuf(ix+1,iy+1) */
+	res = res * g + b;
+	*rbuf = (s16)_CONVERTI_( res );
+	continue;
+      }
+
+      /* here, we are sure we are on some border */
+      if ( (x < 0.0) || (ix == t1dimx) ) {
+	/* we just look at y */
+	if ( (y < 0.0) || (iy == t1dimy) ) {
+	  res = (double)(*tpt) * g + b;
+	  *rbuf = (s16)_CONVERTI_( res );
+	  continue;
+	}
+	dy = y - iy;
+	res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy) */
+	tpt += tdimx;
+	res += dy * (*tpt);     /* dy * tbuf(ix,iy+1) */
+	res = (double)(*tpt) * g + b;
+	*rbuf = (s16)_CONVERTI_( res );
+	continue;
+      }
+      dx = x - ix;
+      res  = (1-dx) * (*tpt); /* (1-dx)* tbuf(ix,iy) */
+      tpt ++;
+      res += dx * (*tpt);     /* dx * tbuf(ix+1,iy) */
+      res = res * g + b;
+            *rbuf = (s16)_CONVERTI_( res );
+    }
+  }
+}
+
+CGAL_INLINE_FUNCTION
+void Reech2DNearest4x4_s16 ( void* theBuf, /* buffer to be resampled */
+			      int *theDim,  /* dimensions of this buffer */
+			      void* resBuf, /* result buffer */
+			      int *resDim,  /* dimensions of this buffer */
+			      double* mat   /* transformation matrix */
+			      )
+{
+  int i, j, k, ix, iy;
+  double x, y;
+  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
+  int tdimx=theDim[0], tdimy=theDim[1];
+  int t1dimx=tdimx-1, t1dimy=tdimy-1;
+  s16 *tbuf = (s16*)theBuf;
+  s16 *rbuf = (s16*)resBuf;
+
+  for ( k = 0; k < rdimz; k ++ ) {
+    if ( get_static_verbose_reech4x4() != 0 )
+      fprintf( stderr, "Processing slice %d\r", k );
+    /* tbuf represente le premier point du plan */
+    tbuf  = (s16*)theBuf;
+    tbuf += k*(tdimx * tdimy);
+    for ( j = 0; j < rdimy; j ++ )
+    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
+      /* computation of the corresponding point coordinates in theBuf */
+      x = mat[0] * i +  mat[1] * j + mat[3];
+      ix = (int)(x+0.5);
+      if (( x < -0.5 ) || ( ix > t1dimx)) { *rbuf = 0; continue; }
+      y = mat[4] * i +  mat[5] * j + mat[7];
+      iy = (int)(y+0.5);
+      if (( y < -0.5 ) || ( iy > t1dimy)) { *rbuf = 0; continue; }
+      
+      *rbuf = tbuf[ ix + iy * tdimx ];
+    }
+  }
+}
+
+
+
+
+
+
+/* Resampling procedure.
+
+   Work for 3D images, not for vectorial ones.
+   
+   (double* mat) is the matrix which permits to get
+   from resBuf into theBuf. 
+   If one only have the matrix from theBuf into resBuf,
+   it must be inverted first.
+
+   Soit x le point transforme et ix=(int)x;
+   nous allons distinguer les cas suivants :
+    x < -0.5               => resultat = 0
+    -0.5 <= x < 0.0        => ix=0, on n'interpole pas selon X
+    0.0 < x && ix < dimx-1 => on interpole selon X
+    x < dimx-0.5           => ix=dimx-1, on n'interpole pas selon X
+    x >= dimx-0.5          => resultat = 0
+
+*/
+
+CGAL_INLINE_FUNCTION
+void Reech3DTriLin4x4_r32 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim, /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat   /* transformation matrix */
+			     )
+{
+  int i, j, k, ix, iy, iz;
+  double x, y, z, dx, dy, dz, dxdy,dxdz,dydz,dxdydz;
+  double res;
+  double v6, v5, v4;
+  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
+  int tdimx=theDim[0], tdimy=theDim[1], tdimz=theDim[2];
+  int tdimxy=tdimx*tdimy;
+  int toffset1=tdimxy+tdimx+1, toffset2=tdimxy-tdimx-1;
+  int t1dimx=tdimx-1, t1dimy=tdimy-1, t1dimz=tdimz-1;
+  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
+  double ddimz = (double)tdimz-0.5;
+  r32 *tbuf = (r32*)theBuf;
+  r32 *tpt;
+  r32 *rbuf = (r32*)resBuf;
+
+  for ( k = 0; k < rdimz; k ++ ) {
+    if ( get_static_verbose_reech4x4() != 0 )
+      fprintf( stderr, "Processing slice %d\r", k );
+    for ( j = 0; j < rdimy; j ++ )
+    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
+      /* computation of the corresponding point coordinates in theBuf */
+      x = mat[0] * i +  mat[1] * j + mat[2] * k + mat[3];
+      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
+      y = mat[4] * i +  mat[5] * j + mat[6] * k + mat[7];
+      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
+      z = mat[8] * i +  mat[9] * j + mat[10] * k + mat[11];
+      if ((z < -0.5) || ( z > ddimz)) { *rbuf = 0; continue; }
+
+      /* here, the point lies on the borders or completely inside
+	 the image */
+      ix = (int)x;
+      iy = (int)y;
+      iz = (int)z;
+      tpt = (r32 *)tbuf;
+      
+      /* are we on the border or not ? */
+      if ( (x > 0.0) && (ix < t1dimx) &&
+	   (y > 0.0) && (iy < t1dimy) &&
+	   (z > 0.0) && (iz < t1dimz) ) {
+	/* the corresponding point is in the box defined 
+	   by (ix[+1],iy[+1],iz[+1]) */
+	dx = x - ix;
+	dy = y - iy;
+	dz = z - iz;
+	dxdy = dx*dy;
+	dxdz = dx*dz;
+	dydz = dy*dz;
+	dxdydz = dxdy*dz;
+
+	/* we have
+	   v[7]=dxdydz;            coefficient of tbuf(ix+1,iy+1,iz+1)
+	   v[6]=dxdz-dxdydz;       coefficient of tbuf(ix+1,iy,  iz+1)
+	   v[5]=dxdy-dxdydz;       coefficient of tbuf(ix+1,iy+1,iz  )
+	   v[4]=dx-dxdy-v[6];      coefficient of tbuf(ix+1,iy  ,iz  )
+	   v[3]=dydz-dxdydz;       coefficient of tbuf(ix  ,iy+1,iz+1)
+	   v[2]=dz-dydz-v[6];      coefficient of tbuf(ix  ,iy  ,iz+1)
+	   v[1]=dy-dydz-v[5];      coefficient of tbuf(ix  ,iy+1,iz  )
+	   v[0]=1-dy-dz+dydz-v[4]; coefficient of tbuf(ix  ,iy  ,iz  )
+	*/
+	tpt += ix + iy * tdimx + iz * tdimxy + toffset1;
+	v6 = dxdz-dxdydz;
+	v5 = dxdy-dxdydz;
+	v4 = dx-dxdy-v6;
+
+	res = 0;
+	res += dxdydz * (*tpt);            /* tbuf(ix+1,iy+1,iz+1) */
+	tpt --;
+	res += (dydz-dxdydz) * (*tpt);     /* tbuf(ix  ,iy+1,iz+1) */
+	tpt -= t1dimx;
+	res += v6 * (*tpt);                /* tbuf(ix+1  ,iy,  iz+1) */
+	tpt --;
+	res += (dz-dydz-v6) * (*tpt);      /* tbuf(ix  ,iy  ,iz+1) */
+	tpt -= toffset2;
+	res += v5 * (*tpt);                /* tbuf(ix+1,iy+1,iz  ) */
+	tpt --;
+	res += (dy-dydz-v5) * (*tpt);      /* tbuf(ix  ,iy+1,iz  ) */
+	tpt -= t1dimx;
+	res += v4 * (*tpt);                /* tbuf(ix+1,iy  ,iz  ) */
+	tpt --;
+	res += (1-dy-dz+dydz-v4) * (*tpt); /* tbuf(ix  ,iy  ,iz  ) */
+	*rbuf = (r32)_CONVERTR_( res );
+	continue;
+      }
+      /* here, we are sure we are on some border */
+      tpt += ix + iy * tdimx + iz * tdimxy;
+      if ( (x < 0.0) || (ix == t1dimx) ) {
+	if ( (y < 0.0) || (iy == t1dimy) ) {
+	  if ( (z < 0.0) || (iz == t1dimz) ) {
+	    *rbuf = *tpt;
+	    continue;
+	  }
+	  dz = z - iz;
+	  res  = (1-dz) * (*tpt); /* (1-dz)* tbuf(ix,iy,iz) */
+	  tpt += tdimxy;
+	  res += dz * (*tpt);     /* dz * tbuf(ix,iy,iz+1) */
+	  *rbuf = (r32)_CONVERTR_( res );
+	  continue;
+	}
+	dy = y - iy;
+	if ( (z < 0.0) || (iz == t1dimz) ) {
+	  res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy,iz) */
+	  tpt += tdimx;
+	  res += dy * (*tpt);     /* dy * tbuf(ix,iy+1,iz) */
+	  *rbuf = (r32)_CONVERTR_( res );
+	  continue;
+ 	}
+	dz = z - iz;
+	res = (1-dy)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
+	tpt += tdimx;
+	res += dy*(1-dz) * (*tpt);    /* tbuf(ix,iy+1,iz) */
+	tpt += toffset2+1;
+	res += (1-dy)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
+	tpt += tdimx;
+	res += dy*dz * (*tpt);        /* tbuf(ix,iy+1,iz+1) */
+	*rbuf = (r32)_CONVERTR_( res );
+	continue;
+      }
+      /* here we are sure that the border is either
+	 along the Y or the Z axis */
+      dx = x - ix;
+      if ( (y < 0.0) || (iy == t1dimy) ) {
+	if ( (z < 0.0) || (iz == t1dimz) ) {
+	  res = (1-dx) * (*tpt); /* tbuf(ix,iy,iz) */
+	  tpt ++;
+	  res += dx * (*tpt);    /* tbuf(ix+1,iy,iz) */
+	  *rbuf = (r32)_CONVERTR_( res );
+	  continue;
+	}
+	dz = z - iz;
+	res = (1-dx)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
+	tpt ++;
+	res += dx*(1-dz) * (*tpt);    /* tbuf(ix+1,iy,iz) */
+	tpt += tdimxy-1;
+	res += (1-dx)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
+	tpt ++;
+	res += dx*dz * (*tpt);        /* tbuf(ix+1,iy,iz+1) */
+	*rbuf = (r32)_CONVERTR_( res );
+	continue;
+      }
+      /* here we are sure that the border is along the Z axis */
+      dy = y - iy;
+      res = (1-dx)*(1-dy) * (*tpt); /* tbuf(ix,iy,iz) */
+      tpt ++;
+      res += dx*(1-dy) * (*tpt);    /* tbuf(ix+1,iy,iz) */
+      tpt += t1dimx;
+      res += (1-dx)*dy * (*tpt);    /* tbuf(ix,iy+1,iz) */
+      tpt ++;
+      res += dx*dy * (*tpt);        /* tbuf(ix+1,iy+1,iz) */
+      *rbuf = (r32)_CONVERTR_( res );
+    }
+  }
+}
+
+CGAL_INLINE_FUNCTION
+void Reech3DTriLin4x4gb_r32 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim, /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat,   /* transformation matrix */
+			     float gain,
+			     float bias )
+{
+  int i, j, k, ix, iy, iz;
+  double x, y, z, dx, dy, dz, dxdy,dxdz,dydz,dxdydz;
+  double res;
+  double v6, v5, v4;
+  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
+  int tdimx=theDim[0], tdimy=theDim[1], tdimz=theDim[2];
+  int tdimxy=tdimx*tdimy;
+  int toffset1=tdimxy+tdimx+1, toffset2=tdimxy-tdimx-1;
+  int t1dimx=tdimx-1, t1dimy=tdimy-1, t1dimz=tdimz-1;
+  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
+  double ddimz = (double)tdimz-0.5;
+  r32 *tbuf = (r32*)theBuf;
+  r32 *tpt;
+  r32 *rbuf = (r32*)resBuf;
+  double b=bias;
+  double g=gain;
+
+  for ( k = 0; k < rdimz; k ++ ) {
+    if ( get_static_verbose_reech4x4() != 0 )
+      fprintf( stderr, "Processing slice %d\r", k );
+    for ( j = 0; j < rdimy; j ++ )
+    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
+      /* computation of the corresponding point coordinates in theBuf */
+      x = mat[0] * i +  mat[1] * j + mat[2] * k + mat[3];
+      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
+      y = mat[4] * i +  mat[5] * j + mat[6] * k + mat[7];
+      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
+      z = mat[8] * i +  mat[9] * j + mat[10] * k + mat[11];
+      if ((z < -0.5) || ( z > ddimz)) { *rbuf = 0; continue; }
+
+      /* here, the point lies on the borders or completely inside
+	 the image */
+      ix = (int)x;
+      iy = (int)y;
+      iz = (int)z;
+      tpt = (r32 *)tbuf;
+      
+      /* are we on the border or not ? */
+      if ( (x > 0.0) && (ix < t1dimx) &&
+	   (y > 0.0) && (iy < t1dimy) &&
+	   (z > 0.0) && (iz < t1dimz) ) {
+	/* the corresponding point is in the box defined 
+	   by (ix[+1],iy[+1],iz[+1]) */
+	dx = x - ix;
+	dy = y - iy;
+	dz = z - iz;
+	dxdy = dx*dy;
+	dxdz = dx*dz;
+	dydz = dy*dz;
+	dxdydz = dxdy*dz;
+
+	/* we have
+	   v[7]=dxdydz;            coefficient of tbuf(ix+1,iy+1,iz+1)
+	   v[6]=dxdz-dxdydz;       coefficient of tbuf(ix+1,iy,  iz+1)
+	   v[5]=dxdy-dxdydz;       coefficient of tbuf(ix+1,iy+1,iz  )
+	   v[4]=dx-dxdy-v[6];      coefficient of tbuf(ix+1,iy  ,iz  )
+	   v[3]=dydz-dxdydz;       coefficient of tbuf(ix  ,iy+1,iz+1)
+	   v[2]=dz-dydz-v[6];      coefficient of tbuf(ix  ,iy  ,iz+1)
+	   v[1]=dy-dydz-v[5];      coefficient of tbuf(ix  ,iy+1,iz  )
+	   v[0]=1-dy-dz+dydz-v[4]; coefficient of tbuf(ix  ,iy  ,iz  )
+	*/
+	tpt += ix + iy * tdimx + iz * tdimxy + toffset1;
+	v6 = dxdz-dxdydz;
+	v5 = dxdy-dxdydz;
+	v4 = dx-dxdy-v6;
+
+	res = 0;
+	res += dxdydz * (*tpt);            /* tbuf(ix+1,iy+1,iz+1) */
+	tpt --;
+	res += (dydz-dxdydz) * (*tpt);     /* tbuf(ix  ,iy+1,iz+1) */
+	tpt -= t1dimx;
+	res += v6 * (*tpt);                /* tbuf(ix+1  ,iy,  iz+1) */
+	tpt --;
+	res += (dz-dydz-v6) * (*tpt);      /* tbuf(ix  ,iy  ,iz+1) */
+	tpt -= toffset2;
+	res += v5 * (*tpt);                /* tbuf(ix+1,iy+1,iz  ) */
+	tpt --;
+	res += (dy-dydz-v5) * (*tpt);      /* tbuf(ix  ,iy+1,iz  ) */
+	tpt -= t1dimx;
+	res += v4 * (*tpt);                /* tbuf(ix+1,iy  ,iz  ) */
+	tpt --;
+	res += (1-dy-dz+dydz-v4) * (*tpt); /* tbuf(ix  ,iy  ,iz  ) */
+	res = res * g + b;
+	*rbuf = (r32)_CONVERTR_( res );
+	continue;
+      }
+      /* here, we are sure we are on some border */
+      tpt += ix + iy * tdimx + iz * tdimxy;
+      if ( (x < 0.0) || (ix == t1dimx) ) {
+	if ( (y < 0.0) || (iy == t1dimy) ) {
+	  if ( (z < 0.0) || (iz == t1dimz) ) {
+	    res = (double)(*tpt) * g + b;
+	    *rbuf = (r32)_CONVERTR_( res );
+	    continue;
+	  }
+	  dz = z - iz;
+	  res  = (1-dz) * (*tpt); /* (1-dz)* tbuf(ix,iy,iz) */
+	  tpt += tdimxy;
+	  res += dz * (*tpt);     /* dz * tbuf(ix,iy,iz+1) */
+	  res = res * g + b;
+	  *rbuf = (r32)_CONVERTR_( res );
+	  continue;
+	}
+	dy = y - iy;
+	if ( (z < 0.0) || (iz == t1dimz) ) {
+	  res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy,iz) */
+	  tpt += tdimx;
+	  res += dy * (*tpt);     /* dy * tbuf(ix,iy+1,iz) */
+	  res = res * g + b;
+	  *rbuf = (r32)_CONVERTR_( res );
+	  continue;
+ 	}
+	dz = z - iz;
+	res = (1-dy)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
+	tpt += tdimx;
+	res += dy*(1-dz) * (*tpt);    /* tbuf(ix,iy+1,iz) */
+	tpt += toffset2+1;
+	res += (1-dy)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
+	tpt += tdimx;
+	res += dy*dz * (*tpt);        /* tbuf(ix,iy+1,iz+1) */
+	res = res * g + b;
+	*rbuf = (r32)_CONVERTR_( res );
+	continue;
+      }
+      /* here we are sure that the border is either
+	 along the Y or the Z axis */
+      dx = x - ix;
+      if ( (y < 0.0) || (iy == t1dimy) ) {
+	if ( (z < 0.0) || (iz == t1dimz) ) {
+	  res = (1-dx) * (*tpt); /* tbuf(ix,iy,iz) */
+	  tpt ++;
+	  res += dx * (*tpt);    /* tbuf(ix+1,iy,iz) */
+	  res = res * g + b;
+	  *rbuf = (r32)_CONVERTR_( res );
+	  continue;
+	}
+	dz = z - iz;
+	res = (1-dx)*(1-dz) * (*tpt); /* tbuf(ix,iy,iz) */
+	tpt ++;
+	res += dx*(1-dz) * (*tpt);    /* tbuf(ix+1,iy,iz) */
+	tpt += tdimxy-1;
+	res += (1-dx)*dz * (*tpt);    /* tbuf(ix,iy,iz+1) */
+	tpt ++;
+	res += dx*dz * (*tpt);        /* tbuf(ix+1,iy,iz+1) */
+	res = res * g + b;
+	*rbuf = (r32)_CONVERTR_( res );
+	continue;
+      }
+      /* here we are sure that the border is along the Z axis */
+      dy = y - iy;
+      res = (1-dx)*(1-dy) * (*tpt); /* tbuf(ix,iy,iz) */
+      tpt ++;
+      res += dx*(1-dy) * (*tpt);    /* tbuf(ix+1,iy,iz) */
+      tpt += t1dimx;
+      res += (1-dx)*dy * (*tpt);    /* tbuf(ix,iy+1,iz) */
+      tpt ++;
+      res += dx*dy * (*tpt);        /* tbuf(ix+1,iy+1,iz) */
+      res = res * g + b;
+      *rbuf = (r32)_CONVERTR_( res );
+    }
+  }
+}
+
+CGAL_INLINE_FUNCTION
+void Reech3DNearest4x4_r32 ( void* theBuf, /* buffer to be resampled */
+			      int *theDim,  /* dimensions of this buffer */
+			      void* resBuf, /* result buffer */
+			      int *resDim,  /* dimensions of this buffer */
+			      double* mat   /* transformation matrix */
+			      )
+{
+  int i, j, k, ix, iy, iz;
+  double x, y, z;
+  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
+  int tdimx=theDim[0], tdimy=theDim[1], tdimz=theDim[2];
+  int tdimxy=tdimx*tdimy;
+  int t1dimx=tdimx-1, t1dimy=tdimy-1, t1dimz=tdimz-1;
+  r32 *tbuf = (r32*)theBuf;
+  r32 *rbuf = (r32*)resBuf;
+
+  for ( k = 0; k < rdimz; k ++ ) {
+    if ( get_static_verbose_reech4x4() != 0 )
+      fprintf( stderr, "Processing slice %d\r", k );
+    for ( j = 0; j < rdimy; j ++ )
+    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
+      /* computation of the corresponding point coordinates in theBuf */
+      x = mat[0] * i +  mat[1] * j + mat[2] * k + mat[3];
+      ix = (int)(x+0.5);
+      if (( x < -0.5 ) || ( ix > t1dimx)) { *rbuf = 0; continue; }
+      y = mat[4] * i +  mat[5] * j + mat[6] * k + mat[7];
+      iy = (int)(y+0.5);
+      if (( y < -0.5 ) || ( iy > t1dimy)) { *rbuf = 0; continue; }
+      z = mat[8] * i +  mat[9] * j + mat[10] * k + mat[11];
+      iz = (int)(z+0.5);
+      if (( z < -0.5 ) || ( iz > t1dimz)) { *rbuf = 0; continue; }
+      
+      *rbuf = tbuf[ ix + iy * tdimx + iz * tdimxy ];
+    }
+  }
+}
+
+CGAL_INLINE_FUNCTION
+void Reech2DTriLin4x4_r32 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim,  /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat   /* transformation matrix */
+			     )
+{
+  int i, j, k, ix, iy;
+  double x, y, dx, dy, dxdy;
+  double res, v;
+  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
+  int tdimx=theDim[0], tdimy=theDim[1];
+  int toffset=tdimx-1;
+  int t1dimx=tdimx-1, t1dimy=tdimy-1;
+  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
+  r32 *tbuf = (r32*)theBuf;
+  r32 *tpt;
+  r32 *rbuf = (r32*)resBuf;
+
+  for ( k = 0; k < rdimz; k ++ ) {
+    if ( get_static_verbose_reech4x4() != 0 )
+      fprintf( stderr, "Processing slice %d\r", k );
+    /* tbuf represente le premier point du plan */
+    tbuf  = (r32*)theBuf;
+    tbuf += k*(tdimx * tdimy);
+    for ( j = 0; j < rdimy; j ++ )
+    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
+      /* computation of the corresponding point coordinates in theBuf */
+      x = mat[0] * i +  mat[1] * j +              mat[3];
+      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
+      y = mat[4] * i +  mat[5] * j +              mat[7];
+      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
+
+      /* here, the point lies on the borders or completely inside
+	 the image */
+      ix = (int)x;      
+      iy = (int)y;
+      tpt = (r32 *)tbuf;
+      tpt += ix + iy * tdimx;
+      
+      /* are we on the border or not ? */
+      if ( (x > 0.0) && (ix < t1dimx) &&
+	   (y > 0.0) && (iy < t1dimy) ) {
+	dx = x - ix;
+	dy = y - iy;
+	dxdy = dx*dy;
+	/* we have
+	   v[5]=dxdy;         coefficient of tbuf(ix+1,iy+1)
+	   v[4]=dx-dxdy;      coefficient of tbuf(ix+1,iy  )
+	   v[1]=dy-dxdy;      coefficient of tbuf(ix  ,iy+1)
+	   v[0]=1-dx-dy+dxdy; coefficient of tbuf(ix  ,iy  )
+	*/
+	v = dy-dxdy;
+	res = 0;
+	res += (1-dx-v) * (*tpt);  /* tbuf(ix  ,iy  ) */
+	tpt ++;
+	res += (dx-dxdy) * (*tpt); /* tbuf(ix+1,iy  ) */
+	tpt += toffset;
+	res += v * (*tpt);       /* tbuf(ix,iy+1  ) */
+	tpt ++;
+	res += dxdy * (*tpt);      /* tbuf(ix+1,iy+1) */
+	*rbuf = (r32)_CONVERTR_( res );
+	continue;
+      }
+
+      /* here, we are sure we are on some border */
+      if ( (x < 0.0) || (ix == t1dimx) ) {
+	/* we just look at y */
+	if ( (y < 0.0) || (iy == t1dimy) ) {
+	  *rbuf = *tpt;
+	  continue;
+	}
+	dy = y - iy;
+	res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy) */
+	tpt += tdimx;
+	res += dy * (*tpt);     /* dy * tbuf(ix,iy+1) */
+	*rbuf = (r32)_CONVERTR_( res );
+	continue;
+      }
+      dx = x - ix;
+      res  = (1-dx) * (*tpt); /* (1-dx)* tbuf(ix,iy) */
+      tpt ++;
+      res += dx * (*tpt);     /* dx * tbuf(ix+1,iy) */
+      *rbuf = (r32)_CONVERTR_( res );
+    }
+  }
+}
+
+CGAL_INLINE_FUNCTION
+void Reech2DTriLin4x4gb_r32 ( void* theBuf, /* buffer to be resampled */
+			     int *theDim,  /* dimensions of this buffer */
+			     void* resBuf, /* result buffer */
+			     int *resDim,  /* dimensions of this buffer */
+			     double* mat,   /* transformation matrix */
+			     float gain,
+			     float bias )
+{
+  int i, j, k, ix, iy;
+  double x, y, dx, dy, dxdy;
+  double res, v;
+  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
+  int tdimx=theDim[0], tdimy=theDim[1];
+  int toffset=tdimx-1;
+  int t1dimx=tdimx-1, t1dimy=tdimy-1;
+  double ddimx = (double)tdimx-0.5, ddimy = (double)tdimy-0.5;
+  r32 *tbuf = (r32*)theBuf;
+  r32 *tpt;
+  r32 *rbuf = (r32*)resBuf;
+  double b=bias;
+  double g=gain;
+
+  for ( k = 0; k < rdimz; k ++ ) {
+    if ( get_static_verbose_reech4x4() != 0 )
+      fprintf( stderr, "Processing slice %d\r", k );
+    /* tbuf represente le premier point du plan */
+    tbuf  = (r32*)theBuf;
+    tbuf += k*(tdimx * tdimy);
+    for ( j = 0; j < rdimy; j ++ )
+    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
+      /* computation of the corresponding point coordinates in theBuf */
+      x = mat[0] * i +  mat[1] * j +              mat[3];
+      if ((x < -0.5) || ( x > ddimx)) { *rbuf = 0; continue; }
+      y = mat[4] * i +  mat[5] * j +              mat[7];
+      if ((y < -0.5) || ( y > ddimy)) { *rbuf = 0; continue; }
+
+      /* here, the point lies on the borders or completely inside
+	 the image */
+      ix = (int)x;      
+      iy = (int)y;
+      tpt = (r32 *)tbuf;
+      tpt += ix + iy * tdimx;
+      
+      /* are we on the border or not ? */
+      if ( (x > 0.0) && (ix < t1dimx) &&
+	   (y > 0.0) && (iy < t1dimy) ) {
+	dx = x - ix;
+	dy = y - iy;
+	dxdy = dx*dy;
+	/* we have
+	   v[5]=dxdy;         coefficient of tbuf(ix+1,iy+1)
+	   v[4]=dx-dxdy;      coefficient of tbuf(ix+1,iy  )
+	   v[1]=dy-dxdy;      coefficient of tbuf(ix  ,iy+1)
+	   v[0]=1-dx-dy+dxdy; coefficient of tbuf(ix  ,iy  )
+	*/
+	v = dy-dxdy;
+	res = 0;
+	res += (1-dx-v) * (*tpt);  /* tbuf(ix  ,iy  ) */
+	tpt ++;
+	res += (dx-dxdy) * (*tpt); /* tbuf(ix+1,iy  ) */
+	tpt += toffset;
+	res += v * (*tpt);       /* tbuf(ix,iy+1  ) */
+	tpt ++;
+	res += dxdy * (*tpt);      /* tbuf(ix+1,iy+1) */
+	res = res * g + b;
+	*rbuf = (r32)_CONVERTR_( res );
+	continue;
+      }
+
+      /* here, we are sure we are on some border */
+      if ( (x < 0.0) || (ix == t1dimx) ) {
+	/* we just look at y */
+	if ( (y < 0.0) || (iy == t1dimy) ) {
+	  res = (double)(*tpt) * g + b;
+	  *rbuf = (r32)_CONVERTR_( res );
+	  continue;
+	}
+	dy = y - iy;
+	res  = (1-dy) * (*tpt); /* (1-dy)* tbuf(ix,iy) */
+	tpt += tdimx;
+	res += dy * (*tpt);     /* dy * tbuf(ix,iy+1) */
+	res = (double)(*tpt) * g + b;
+	*rbuf = (r32)_CONVERTR_( res );
+	continue;
+      }
+      dx = x - ix;
+      res  = (1-dx) * (*tpt); /* (1-dx)* tbuf(ix,iy) */
+      tpt ++;
+      res += dx * (*tpt);     /* dx * tbuf(ix+1,iy) */
+      res = res * g + b;
+            *rbuf = (r32)_CONVERTR_( res );
+    }
+  }
+}
+
+CGAL_INLINE_FUNCTION
+void Reech2DNearest4x4_r32 ( void* theBuf, /* buffer to be resampled */
+			      int *theDim,  /* dimensions of this buffer */
+			      void* resBuf, /* result buffer */
+			      int *resDim,  /* dimensions of this buffer */
+			      double* mat   /* transformation matrix */
+			      )
+{
+  int i, j, k, ix, iy;
+  double x, y;
+  int rdimx=resDim[0], rdimy=resDim[1], rdimz=resDim[2];
+  int tdimx=theDim[0], tdimy=theDim[1];
+  int t1dimx=tdimx-1, t1dimy=tdimy-1;
+  r32 *tbuf = (r32*)theBuf;
+  r32 *rbuf = (r32*)resBuf;
+
+  for ( k = 0; k < rdimz; k ++ ) {
+    if ( get_static_verbose_reech4x4() != 0 )
+      fprintf( stderr, "Processing slice %d\r", k );
+    /* tbuf represente le premier point du plan */
+    tbuf  = (r32*)theBuf;
+    tbuf += k*(tdimx * tdimy);
+    for ( j = 0; j < rdimy; j ++ )
+    for ( i = 0; i < rdimx; i ++, rbuf ++ ) {
+      /* computation of the corresponding point coordinates in theBuf */
+      x = mat[0] * i +  mat[1] * j + mat[3];
+      ix = (int)(x+0.5);
+      if (( x < -0.5 ) || ( ix > t1dimx)) { *rbuf = 0; continue; }
+      y = mat[4] * i +  mat[5] * j + mat[7];
+      iy = (int)(y+0.5);
+      if (( y < -0.5 ) || ( iy > t1dimy)) { *rbuf = 0; continue; }
+      
+      *rbuf = tbuf[ ix + iy * tdimx ];
+    }
+  }
+}
+
+
+
+
+
+
+CGAL_INLINE_FUNCTION
+void Reech4x4_verbose ( )
+{
+  get_static_verbose_reech4x4() = 1;
+}
+
+CGAL_INLINE_FUNCTION
+void Reech4x4_noverbose ( )
+{
+  get_static_verbose_reech4x4() = 0;
+}
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/typedefs.h b/3rdparty/CGAL/include/CGAL/ImageIO/typedefs.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL_ImageIO/typedefs.h
rename to 3rdparty/CGAL/include/CGAL/ImageIO/typedefs.h
diff --git a/3rdparty/CGAL/include/CGAL/ImageIO_impl.h b/3rdparty/CGAL/include/CGAL/ImageIO_impl.h
new file mode 100644
index 0000000..ff1b83a
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/ImageIO_impl.h
@@ -0,0 +1,1700 @@
+// Copyright (c) 2005, 2006 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// Copyright (c) 2007 Geometrica Project, INRIA Sophia-Antipolis (France) 
+// Copyright (c) 2008 GeometryFactory, Sophia-Antipolis (France) 
+// All rights reserved.
+//
+// The files in this directory are part of the ImageIO Library.
+// You can redistribute them and/or  modify them 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE.
+//
+// $URL$
+// $Id$
+//
+
+#ifdef CGAL_HEADER_ONLY
+#define CGAL_INLINE_FUNCTION inline
+#else
+#define CGAL_INLINE_FUNCTION
+#endif
+
+#ifdef _MSC_VER
+// Suppress deprecated warning for fileno and strdup
+#  pragma warning(disable:4996) 
+
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <io.h>
+#include <stdio.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* formats actuellement lus 
+
+   format     |   extension(s)   |  lecture  | ecriture 
+   INRIMAGE   |  .inr[.gz]       |     X     |     X     -> + .gradient[.gz] + .gradient_direction[.gz]
+   GIS        |  .dim, .ima[.gz] |     X     |     X
+   ANALYZE    |  .hdr, .img[.gz] |     X     |     X
+   PNM        |  .ppm, .pgm      |     X     |     X
+   GIF        |  .gif            |     X     |     
+   BMP        |  .gif            |     X     |     
+*/
+#include <CGAL/ImageIO/inr.h>
+#include <CGAL/ImageIO/gif.h>
+#include <CGAL/ImageIO/gis.h>
+#include <CGAL/ImageIO/pnm.h>
+#include <CGAL/ImageIO/bmp.h>
+#include <CGAL/ImageIO/iris.h>
+#include <CGAL/ImageIO/analyze.h>
+#ifdef MINC_FILES
+#include <CGAL/ImageIO/mincio.h>
+#endif
+
+struct Remove_supported_file_format {
+  ~Remove_supported_file_format()
+  {
+    removeSupportedFileFormat();
+  }
+};
+
+#ifdef CGAL_HEADER_ONLY
+
+inline PTRIMAGE_FORMAT & get_static_firstFormat()
+{
+  static PTRIMAGE_FORMAT firstFormat = NULL;
+  return firstFormat;
+}
+
+inline PTRIMAGE_FORMAT & get_static_inrimageFormat()
+{
+  static PTRIMAGE_FORMAT inrimageFormat = NULL;
+  return inrimageFormat;
+}
+
+inline Remove_supported_file_format & get_static_rsff()
+{
+  static Remove_supported_file_format rsff;
+  return rsff;
+}
+// Dummy call to get_static_rsff(), otherwise it would not get instanced
+CGAL_UNUSED static Remove_supported_file_format &rsff_dummy_ref = get_static_rsff();
+
+
+#else // not header-only
+
+/** the first file format is initialized to null */
+static PTRIMAGE_FORMAT firstFormat = NULL;
+inline PTRIMAGE_FORMAT & get_static_firstFormat()
+{
+  return firstFormat;
+}
+
+/** the Inrimage file format (default format) is initialized to null */
+static PTRIMAGE_FORMAT InrimageFormat = NULL;
+inline PTRIMAGE_FORMAT & get_static_inrimageFormat()
+{
+  return InrimageFormat;
+}
+
+static Remove_supported_file_format rsff;
+inline Remove_supported_file_format & get_static_rsff()
+{
+  return rsff;
+}
+
+#endif
+
+/*--------------------------------------------------
+ *
+ * mimics standard routines
+ *
+ --------------------------------------------------*/
+
+
+
+extern "C" {
+  /* default allocation routine */
+  static void *(*allocRoutine)(size_t) = 0;
+  /* default deallocation routine */
+  static void (*deleteRoutine)(void *) = 0;
+}
+
+CGAL_INLINE_FUNCTION
+void *ImageIO_alloc(size_t s) {
+  if(!allocRoutine) allocRoutine = malloc;
+  return ( (*allocRoutine)(s) );
+}
+/* call allocation routine */
+CGAL_INLINE_FUNCTION
+void ImageIO_free(void *m) {
+  if(!deleteRoutine) deleteRoutine = free;
+  (*deleteRoutine)(m);
+}
+/* call deallocation routine */
+
+
+CGAL_INLINE_FUNCTION
+unsigned int ImageIO_limit_len(size_t to_be_read)
+{
+  return (unsigned int)(std::min)(to_be_read, size_t(1u<<30));
+}
+
+/* mimics fwrite() function.
+   According to _openWriteImage(), openMode will has one 
+   of the following value:
+   - OM_STD (for stdout)
+   - OM_GZ 
+   - OM_FILE
+*/
+CGAL_INLINE_FUNCTION
+size_t ImageIO_write(const _image *im, const void *buf, size_t len) {
+  size_t to_be_written = len;
+  int l = -1;
+  char *b = (char*)buf;
+
+  switch(im->openMode) {
+  default :
+  case OM_CLOSE :
+    return 0;
+  case OM_STD :
+#ifdef CGAL_USE_ZLIB
+    while ( (to_be_written > 0) && ((l = gzwrite(im->fd, (void *) b, ImageIO_limit_len(to_be_written))) > 0) ) {
+      to_be_written -= l;
+      b += l;
+    }
+#else 
+    while ( (to_be_written > 0) && ((l = fwrite( b, 1, ImageIO_limit_len(to_be_written), im->fd )) > 0) ) {
+      to_be_written -= l;
+      b += l;
+    }
+#endif
+    return ( len - to_be_written );
+#ifdef CGAL_USE_ZLIB
+  case OM_GZ :
+    while ( (to_be_written > 0) && ((l = gzwrite(im->fd, (void *) b, ImageIO_limit_len(to_be_written))) > 0) ) {
+      to_be_written -= l;
+      b += l;
+    }
+    if(l<0)
+    {
+      int errnum;
+      fprintf(stderr, "zlib error: %s\n", gzerror(im->fd, &errnum));
+    }
+    return ( len - to_be_written );
+#else
+  case OM_FILE :
+    while ( (to_be_written > 0) && ((l = fwrite( b, 1, ImageIO_limit_len(to_be_written), im->fd )) > 0) ) {
+      to_be_written -= l;
+      b += l;
+    }
+    return ( len - to_be_written );
+#endif
+  }
+}
+
+CGAL_INLINE_FUNCTION
+size_t ImageIO_limit_read(size_t to_be_read)
+{
+  return (std::min)(to_be_read, size_t(1u<<30));
+}
+
+/* mimics fread() function.
+   According to _openReadImage(), openMode will has one 
+   of the following value:
+   - OM_STD (for stdin)
+   - OM_GZ *or* OM_FILE
+*/
+CGAL_INLINE_FUNCTION
+size_t ImageIO_read(const _image *im, void *buf, size_t len) 
+{
+  size_t to_be_read = len;
+  int l = -1;
+  char *b = (char*)buf;
+
+  switch(im->openMode) {
+  default :
+  case OM_CLOSE :
+    return 0;
+  case OM_STD :
+#ifdef CGAL_USE_ZLIB
+    while ( (to_be_read > 0) && ((l = gzread(im->fd, (void *) b, ImageIO_limit_len(to_be_read))) > 0) ) {
+      to_be_read -= l;
+      b += l;
+    }
+#else 
+    while ( (to_be_read > 0) && ((l = fread( b, 1, ImageIO_limit_len(to_be_read), im->fd )) > 0) ) {
+      to_be_read -= l;
+      b += l;
+    }
+#endif
+    return ( len - to_be_read );
+#ifdef CGAL_USE_ZLIB
+  case OM_GZ :
+    while ( (to_be_read > 0) && ((l = gzread(im->fd, (void *) b, ImageIO_limit_len(to_be_read))) > 0) ) {
+      to_be_read -= l;
+      b += l;
+    }
+    if(l<0)
+    {
+      int errnum;
+      fprintf(stderr, "zlib error: %s\n", gzerror(im->fd, &errnum));
+    }
+    return ( len - to_be_read );
+#else
+  case OM_FILE :
+    while ( (to_be_read > 0) && ((l = fread( b, 1, ImageIO_limit_len(to_be_read), im->fd )) > 0) ) {
+      to_be_read -= l;
+      b += l;
+    }
+    return ( len - to_be_read );
+#endif
+  }
+
+  //return 0;
+}
+
+
+
+/* mimics fgets() function.
+   According to _openReadImage(), openMode will has one 
+   of the following value:
+   - OM_STD (for stdout)
+   - OM_GZ *or* OM_FILE
+*/
+CGAL_INLINE_FUNCTION
+char *ImageIO_gets( const _image *im, char *str, int size )
+{
+  char *ret = NULL;
+  switch(im->openMode) {
+  default :
+  case OM_CLOSE :
+    return NULL;
+  case OM_STD :
+#ifdef CGAL_USE_ZLIB
+    ret = (char *) gzgets(im->fd, str, size );
+#else
+    ret = fgets(str, size, im->fd);
+#endif
+    break;
+#ifdef CGAL_USE_ZLIB
+  case OM_GZ :
+    ret = (char *) gzgets(im->fd, str, size);
+    break;
+#else
+  case OM_FILE :
+    ret = fgets(str, size, im->fd);
+    break;
+#endif
+  }
+  return ret;
+}
+
+
+
+CGAL_INLINE_FUNCTION
+long ImageIO_seek( const _image *im, long offset, int whence ) {
+  switch(im->openMode) {
+  case OM_CLOSE :
+  default :
+    return -1;
+#ifdef CGAL_USE_ZLIB
+  case OM_GZ:
+    return gzseek(im->fd, offset, whence );
+#endif
+  case OM_FILE:
+    return fseek( (FILE*)im->fd, offset, whence );
+  }
+}
+
+/* return non 0 in case of error
+ */
+CGAL_INLINE_FUNCTION
+int ImageIO_error( const _image *im )
+{
+  switch(im->openMode) {
+  case OM_CLOSE :
+  default :
+    return 0;
+#ifdef CGAL_USE_ZLIB
+  case OM_GZ :
+    static int errnum;
+    (void)gzerror(im->fd, &errnum);
+    return( (errnum != Z_OK) || gzeof(im->fd) );
+#endif
+  case OM_FILE :
+    return( ferror( (FILE*)im->fd ) || feof( (FILE*)im->fd ) );
+  }
+  //return 0;
+}
+
+
+
+/* Upon successful completion 0 is returned.
+   
+   Closing the standard output with gzclose()
+   is necessary as it will flush the pending output.
+ */
+CGAL_INLINE_FUNCTION
+int ImageIO_close( _image* im )
+{
+  int ret=0;
+  
+  switch ( im->openMode ) {
+  default :
+  case OM_CLOSE :
+    break;
+#ifdef CGAL_USE_ZLIB
+  case OM_GZ :
+  case OM_STD :
+    ret = gzclose( im->fd );
+    break;
+#else 
+  case OM_STD :
+    break;
+#endif
+  case OM_FILE :
+    ret = fclose( (FILE*)im->fd );
+  }
+  im->fd = NULL;
+  im->openMode = OM_CLOSE;
+  
+  return ret;
+}
+
+
+
+
+
+
+
+/* given an initialized file descriptor and a file name, 
+   open file from stdin (if name == NULL, or name == "-", or name == "<"), 
+   or a standard/gzipped file otherwise (gzipped files are handled assuming
+   that it is compiled and linked with zlib). 
+   openMode will have one of the following value:
+   - OM_STD (for stdin)
+   - OM_GZ *or* OM_FILE
+*/
+CGAL_INLINE_FUNCTION
+void _openReadImage(_image* im, const char *name) {
+  if(im->openMode == OM_CLOSE) {
+
+    /* open from stdin */
+    if( name == NULL || name[0] == '\0' 
+	|| (name[0] == '-' && name[1] == '\0') 
+	|| (name[0] == '<' && name[1] == '\0') ) {
+#ifdef CGAL_USE_ZLIB      
+      im->fd = gzdopen(fileno(stdin), "rb");
+#else
+      im->fd = fdopen(fileno(stdin), "rb");
+#endif
+      im->openMode = OM_STD;
+    }
+
+    else {
+#ifdef CGAL_USE_ZLIB     
+      im->fd = gzopen(name, "rb");
+      if(im->fd) im->openMode = OM_GZ;
+#else
+      im->fd = fopen(name, "rb");
+      if(im->fd) im->openMode = OM_FILE;
+#endif
+
+    }
+
+  }
+}
+
+
+
+
+
+/* given an initialized file descriptor and a file name, 
+   open file from stdout (if name == NULL, or name == "-", or name == ">"), 
+   a gzipped pipe (if name got the extension ".gz")
+   or a standard file otherwise.
+   openMode will have one of the following value:
+   - OM_STD (for stdout)
+   - OM_GZ 
+   - OM_FILE
+*/
+CGAL_INLINE_FUNCTION
+void _openWriteImage(_image* im, const char *name) 
+{
+  im->openMode = OM_CLOSE;
+
+  if( name == NULL || name[0] == '\0' 
+      || (name[0] == '-' && name[1] == '\0') 
+      || (name[0] == '>' && name[1] == '\0') ) {
+
+#ifdef CGAL_USE_ZLIB
+#if (defined _LINUX_) || (defined _SOLARIS_) || (defined _SGI_)
+    im->fd = gzdopen(1, "wb");
+#else
+    im->fd = gzdopen(fileno(stdout), "wb");
+#endif
+#else    
+    im->fd = (_ImageIO_file) stdout;
+#endif
+    im->openMode = OM_STD;
+  }
+
+  else{
+#ifdef CGAL_USE_ZLIB      
+    
+    /* from gzopen() doc:
+       ... The mode parameter is as in fopen ("rb" or "wb") but can
+       also include a compression level ("wb9") or a strategy: 'f' for
+       filtered data as in "wb6f", 'h' for Huffman only compression as
+       in "wb1h" ...
+       However, a small .gz header will be written ... thus gz(d)open can not
+       be used for rgular files.
+    */
+    
+    if( !strncmp(name+strlen(name)-3, ".gz", 3) )
+      {
+#ifdef _MSC_VER
+	int ffd=_open(name,_O_RDWR | _O_CREAT| _O_TRUNC | _O_BINARY, _S_IREAD|_S_IWRITE);
+	im->fd = gzdopen( ffd, "wb" );
+#else
+	im->fd = gzopen( name, "wb" );
+#endif
+	im->openMode = OM_GZ;
+      }
+    else 
+#endif
+    {
+      im->fd = (_ImageIO_file) fopen(name, "wb");
+      im->openMode = OM_FILE;
+    }
+  }
+}
+
+
+
+/* set allocation and deallocation routines */
+CGAL_INLINE_FUNCTION
+void setImageIOAllocationRoutines(ALLOCATION_FUNCTION alloc,
+				  DEALLOCATION_FUNCTION del) {
+  if(alloc != NULL) allocRoutine = alloc;
+  if(del != NULL) deleteRoutine = del;
+}
+
+
+
+
+
+/*--------------------------------------------------
+ *
+ *
+ *
+ --------------------------------------------------*/
+
+
+
+
+
+CGAL_INLINE_FUNCTION
+ENDIANNESS _getEndianness()
+{
+  union {
+    unsigned char uc[2];
+    unsigned short us;
+  } twobytes;
+  twobytes.us = 255;
+  /* on linux or dec
+   */
+  if ( twobytes.uc[1] == 0 ) return( END_LITTLE );
+  /* on solaris or sgi
+   */
+  return( END_BIG );
+}
+
+
+
+
+
+
+
+/* Allocates and initializes an image descriptor */
+CGAL_INLINE_FUNCTION
+_image *_initImage() {
+  _image *im;
+
+  im = (_image *) ImageIO_alloc(sizeof(_image));
+  if ( im == NULL ) return( im );
+
+  /* default image size is 1*1*1 */
+  im->xdim = im->ydim = im->zdim = im->vdim = 1;
+  /* default image voxel size is 1.0*1.0*1.0 */
+  im->vx = im->vy = im->vz = 1.0;
+
+  /* default image center  is 0 0 0 */
+  im->cx = im->cy = im->cz = 0;
+
+  /* default image offset  is 0 0 0 */
+  im->tx = im->ty = im->tz = 0.0;
+
+  /* default image rotation  is 0 0 0 */
+  im->rx = im->ry = im->rz = 0.0;
+
+  /* no data yet */
+  im->data = NULL;
+
+  /* no file associated to image */
+  im->fd = NULL;
+  im->openMode = OM_CLOSE;
+  im->endianness = END_UNKNOWN;
+
+  /* unknown data kind
+     default is binary
+   */
+  im->dataMode = DM_BINARY;
+
+  /* no user string */
+  im->user = NULL;
+  im->nuser = 0;
+
+  /* unknown word kind */
+  im->wdim = 0;
+  im->wordKind = WK_UNKNOWN;
+  im->vectMode = VM_SCALAR;
+  im->sign = SGN_UNKNOWN;
+  im->imageFormat = NULL;
+
+  /** eventually initializes the supported file formats */
+  if (get_static_firstFormat()==NULL)
+    initSupportedFileFormat();
+  /* return image descriptor */
+  return im;
+}
+
+CGAL_INLINE_FUNCTION
+_image *_createImage(int x, int y, int z, int v,
+		     float vx, float vy, float vz, int w,
+		     WORD_KIND wk, SIGN sgn)
+{
+  _image *im;
+  
+  im = (_image *) ImageIO_alloc(sizeof(_image));
+  if ( im == NULL ) return( im );
+  
+  im->xdim = x;
+  im->ydim = y;
+  im->zdim = z;
+  im->vdim = v;
+  im->vx = vx;
+  im->vy = vy;
+  im->vz = vz;
+
+  /* default image center  is 0 0 0 */
+  im->cx = im->cy = im->cz = 0;
+
+  /* default image offset  is 0 0 0 */
+  im->tx = im->ty = im->tz = 0.0;
+
+  /* default image rotation  is 0 0 0 */
+  im->rx = im->ry = im->rz = 0.0;
+
+  /* no data yet */
+  im->data = ImageIO_alloc(std::size_t(x)*std::size_t(y)*std::size_t(z)*std::size_t(v)*std::size_t(w));
+
+  /* no file associated to image */
+  im->fd = NULL;
+  im->openMode = OM_CLOSE;
+  im->endianness = END_UNKNOWN;
+
+  /* unknown data kind
+     default is binary
+   */
+  im->dataMode = DM_BINARY;
+
+  /* no user string */
+  im->user = NULL;
+  im->nuser = 0;
+
+  /* unknown word kind */
+  im->wdim = w;
+  im->wordKind = wk;
+  im->vectMode = VM_SCALAR;
+  im->sign = sgn;
+  im->imageFormat = NULL;
+
+  /** eventually initializes the supported file formats */
+  if (get_static_firstFormat()==NULL)
+    initSupportedFileFormat();
+  /* return image descriptor */
+  return im;
+}
+
+/* return the bounding box of the image */
+CGAL_INLINE_FUNCTION
+void _get_image_bounding_box(_image* im,
+			     double* x_min, double* y_min, double* z_min,
+			     double* x_max, double* y_max, double* z_max) {
+  *x_min = im->tx;
+  *y_min = im->ty;
+  *z_min = im->tz;
+  *x_max = (double(im->xdim) - 1.0)*(im->vx) + *x_min ;
+  *y_max = (double(im->ydim) - 1.0)*(im->vy) + *y_min ;
+  *z_max = (double(im->zdim) - 1.0)*(im->vz) + *z_min ;
+}
+
+/* Free an image descriptor */
+CGAL_INLINE_FUNCTION
+void _freeImage(_image *im) {
+  unsigned int i;
+
+  if ( im == NULL ) return;
+
+  /* close image if opened */
+  if(im->openMode != OM_CLOSE) ImageIO_close(im);
+
+  /* free data if any */
+  if(im->data != NULL) ImageIO_free(im->data);
+  im->data = NULL;
+
+  /* free user string array if any */
+  if( (im->nuser > 0) && (im->user != NULL) ) {
+    for(i = 0; i < im->nuser; i++)
+      if ( im->user[i] != NULL ) ImageIO_free(im->user[i]);
+    ImageIO_free(im->user);
+  }
+  im->nuser = 0;
+  im->user = NULL;
+
+  /* free given descriptor */
+  ImageIO_free(im);
+}
+
+
+
+
+
+/* Reads an image from a file and returns an image descriptor or NULL if
+   reading failed.
+   Reads from stdin if image name is NULL. */
+CGAL_INLINE_FUNCTION
+_image* _readImage(const char *name) {
+  _image *im;
+
+
+  /* read header */
+  im = _readImageHeader( name );
+
+  if(im != NULL && im->openMode != OM_CLOSE) {
+    /* read body */
+    if(_readImageData(im) < 0) {
+      fprintf(stderr, "_readImage: error: invalid data encountered in \'%s\'\n",
+	      name);
+      _freeImage(im);
+      return NULL;
+    }
+    ImageIO_close(im);
+  }
+
+  return im;
+}
+
+// raw
+CGAL_INLINE_FUNCTION
+_image* _readImage_raw(const char *name,
+                       const unsigned int rx,
+                       const unsigned int ry,
+                       const unsigned int rz,
+                       const double vx,
+                       const double vy,
+                       const double vz,
+		       const unsigned int offset)
+{
+  _image *im = NULL;
+  im = (_image *) ImageIO_alloc(sizeof(_image));
+  if ( im == NULL )
+    return NULL;
+
+  im->xdim = rx;
+  im->ydim = ry;
+  im->zdim = rz;
+  im->vdim = 1;
+  im->vx = vx;
+  im->vy = vy;
+  im->vz = vz;
+
+  // image center
+  im->cx = im->cy = im->cz = 0;
+
+  // image offset
+  im->tx = im->ty = im->tz = 0.0;
+
+  // image rotation
+  im->rx = im->ry = im->rz = 0.0;
+
+
+  im->fd = NULL;
+  im->openMode = OM_CLOSE;
+  im->endianness = END_UNKNOWN;
+
+  im->dataMode = DM_BINARY;
+
+  // no user string
+  im->user = NULL;
+  im->nuser = 0;
+
+  // word type (unsigned byte)
+  im->wdim = 1;
+  im->wordKind = WK_FIXED;
+  im->vectMode = VM_SCALAR;
+  im->sign = SGN_UNSIGNED;
+  im->imageFormat = NULL;
+
+  // read file
+  ::_openReadImage(im, name);
+  if(!im->fd) {
+    fprintf(stderr, "_readImage_raw: error: unable to open file \'%s\'\n", name);
+    _freeImage(im);
+    return NULL;
+  }
+
+  // read offset
+  if(offset > 0) {
+    im->data = ImageIO_alloc(offset+1);
+    ImageIO_read(im, im->data, offset);
+    ImageIO_free(im->data);
+  }
+  // allocate memory
+  im->data = ImageIO_alloc(rx*ry*rz);
+  if(im->data == NULL)
+    return NULL;
+
+  // read
+  ImageIO_read(im, im->data, rx*ry*rz);
+
+  ImageIO_close(im);
+  /*
+    unsigned int i,j,k;
+    unsigned char *data = (unsigned char *)im->data;
+    int dimxy = rx * ry;
+    for(i=0;i<rx;i++)
+    for(j=0;j<ry;j++)
+    for(k=0;k<rz;k++)
+    {
+    unsigned char voxel;
+    fread(&voxel,1,1,pFile);
+    data[k * dimxy + j * rx + i] = voxel;
+    }
+  */
+
+  return im;
+}
+
+/* Reads an image from a file and returns an image descriptor or NULL if<br>
+   reading failed.<br>
+   Reads from stdin if image name is NULL.
+   If the image is vectorial, it is uninterlaced. */
+CGAL_INLINE_FUNCTION
+_image* _readNonInterlacedImage(const char *name) {
+  _image *im;
+
+  /* read header */
+  im = _readImageHeader(name);
+
+  if(im && im->openMode != OM_CLOSE) {
+    /* read scalar image body */
+    if(im->vdim == 1) {
+      if(_readImageData(im) < 0) {
+	fprintf(stderr, "_readImage: error: invalid data encountered in \'%s\'\n",
+		name);
+	_freeImage(im);
+	return NULL;
+      }
+    }
+    /* read vectorial image body */
+    else {
+      im->vectMode = VM_NON_INTERLACED;
+      if(_readNonInterlacedImageData(im) < 0) {
+	fprintf(stderr, "_readImage: error: invalid data encountered in \'%s\'\n",
+		name);
+	_freeImage(im);
+	return NULL;
+      }
+    }
+    ImageIO_close(im);
+   }
+
+  return im;
+}
+
+
+
+
+
+
+
+
+
+
+
+/* Write inrimage given in inr in file name. If file name's suffix is
+   .gz, the image is gziped. If file name's suffix is .hdr, the image
+   is written in ANALYZE format. If file name is NULL, image is written
+   on stdout */
+CGAL_INLINE_FUNCTION
+int _writeImage(_image *im, const char *name_to_be_written ) {
+
+  int r = ImageIO_NO_ERROR;
+  std::size_t length = 0;
+  char *name = NULL;
+  char *baseName = NULL;
+
+  if ( im == NULL ) return -1;
+
+  /* different conventions for the standard input
+   */
+  if ( name_to_be_written == NULL || name_to_be_written[0] == '\0' 
+       || (name_to_be_written[0] == '-' && name_to_be_written[1] == '\0') 
+       || (name_to_be_written[0] == '>' && name_to_be_written[1] == '\0') ) {
+    name = NULL;
+  }
+  else {
+    name = strdup( name_to_be_written );
+  }
+
+  initSupportedFileFormat();
+
+  /* what is the wanted format
+   */
+  if ( name == NULL ) {
+    im->imageFormat = get_static_inrimageFormat();
+  } else {
+    std::size_t i,extLength;
+    PTRIMAGE_FORMAT f;
+    char ext[IMAGE_FORMAT_NAME_LENGTH];
+    char *ptr;
+    
+    
+    /* scan all formats; */
+    im->imageFormat=NULL;
+    length=strlen(name);
+
+    for(f=get_static_firstFormat();(f!=NULL)&& (im->imageFormat==NULL);f=f->next) {
+      /* scan all extensions for that format */
+      ptr=&f->fileExtension[0];
+
+      do {
+	/* get next file extension */
+	i=0;
+	for(i=0;((*ptr)!=',' && (*ptr)!='\0');i++,ptr++) {
+	  ext[i]=(*ptr);
+	}
+	if ((*ptr)==',') {
+	  ext[i]='\0';
+	  ptr++;
+	}
+	else {
+	  ext[i]='\0';
+	}
+	extLength=strlen(ext);
+
+	/* test if the tail of name matches the extension */
+	if ( (length > extLength) && (!strcmp( name + length - extLength, ext)) ) {
+	  im->imageFormat=f;
+	  /* copy original name and removes extension */
+	  baseName=strdup(name);
+	  for(i= length - extLength;i<length;++i)
+	    baseName[i]='\0';
+	}
+
+      } while (((*ptr)!='\0') && (im->imageFormat==NULL));
+    }
+
+    if (!im->imageFormat) { 
+      fprintf(stderr, "_writeImage: warning : unknown extension in %s = assuming Inrimage\n",name);
+      im->imageFormat=get_static_inrimageFormat();
+      baseName=strdup(name);
+    }
+  }
+
+
+  /* open file descriptor */
+  /* _openWriteImage( im, name ) ; 
+  
+  
+
+  if(!im->fd) {
+     fprintf(stderr, "_writeImage: error: open failed\n");
+     if ( name != NULL ) free( name );
+     if ( baseName != NULL ) free( baseName );
+     return ImageIO_OPENING;
+  }
+  */
+
+  if (im->imageFormat) {
+
+    if (im->imageFormat->writeImage==NULL) {
+      im->imageFormat=get_static_inrimageFormat();
+    }
+
+    if ( 0 ) {
+      fprintf(stderr, "_writeImage: will write '%s' with '%s' format\n",
+	      name, im->imageFormat->realName );
+    }
+
+    if ((*im->imageFormat->writeImage)(name, im)<0) {
+      fprintf(stderr, "_writeImage: error: unable to write \'%s\'\n",
+	      name);
+      r = ImageIO_WRITING_HEADER;
+    } 
+    
+  }
+  
+
+
+  /* close file descriptor */
+  ImageIO_close( im );
+
+  im->fd = NULL;
+  im->openMode = OM_CLOSE;
+
+  if ( baseName != NULL ) free( baseName );
+  if ( name != NULL ) free( name );
+ 
+  return r;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+/* read header from an image file 
+   
+   if standard input, it's an inrimage
+   if not, get a magic string
+   and try to find the good format
+
+   if data are in a separate file,
+   the header reading procedure will open
+   the data file.
+
+   error:
+   0  success
+   -1 unknown image type
+   -2 error while opening
+   -3 error while reading header
+   -4 error while reading header or data
+ */
+CGAL_INLINE_FUNCTION
+_image *_readImageHeader( const char *name ) {
+  int error = 0;
+  return( _readImageHeaderAndGetError( name, &error ) );
+}
+
+
+
+CGAL_INLINE_FUNCTION
+_image *_readImageHeaderAndGetError( const char *name_to_be_read, int *error )
+{
+  _image *im;
+  char magic[5];
+  char *name = NULL;
+  PTRIMAGE_FORMAT f;
+  int res;
+
+  *error = ImageIO_NO_ERROR;
+  
+  /* open image file */
+  im = _initImage();
+  if ( name_to_be_read == NULL || name_to_be_read[0] == '\0' 
+       || (name_to_be_read[0] == '-' && name_to_be_read[1] == '\0') 
+       || (name_to_be_read[0] == '<' && name_to_be_read[1] == '\0') ) {
+    name = NULL;
+  }
+  else {
+    name = strdup( name_to_be_read );
+  }
+
+
+  _openReadImage(im, name);	
+
+  if(!im->fd) {
+    fprintf(stderr, "_readImageHeaderAndGetError: error: unable to open file \'%s\'\n", name);
+    _freeImage(im);
+    *error = ImageIO_OPENING;
+    if ( name != NULL ) free( name );
+    return NULL;
+  }
+
+  initSupportedFileFormat();
+  
+  /* what is the wanted format ?
+     assume that stdin is inrimage
+   */
+  if(im->openMode == OM_STD) {
+    im->imageFormat=get_static_inrimageFormat();
+  }
+  else {
+   /* get magic string for disk files
+    */
+    ImageIO_read(im, magic, 4);
+    magic[4] = '\0';
+    ImageIO_seek(im, 0L, SEEK_SET);
+    /** test each format */
+    for(f=get_static_firstFormat();(f!=NULL)&& (im->imageFormat==NULL);f=f->next) {
+      /* test if it is the correct format based on magic and file extension */
+      if (((*f->testImageFormat)(magic, name)) >=0) {
+	im->imageFormat=f;
+      }
+    }
+  }
+
+  if ( im->imageFormat == NULL ) {
+    fprintf(stderr, "_readImageHeaderAndGetError: does not find image format for \'%s\'\n", name);
+    ImageIO_close( im );
+    _freeImage(im);
+    *error = ImageIO_UNKNOWN_TYPE;
+    if ( name != NULL ) free( name );
+    return NULL;
+  }
+
+  /* now tests if the header can be read correctly */
+	
+  res=(*(im->imageFormat)->readImageHeader)(name,im);
+  /* could read header only */ 
+  if (res == 0) {
+    if ( name != NULL ) free( name );
+    return( im );
+  } 
+  /* could read header and data */
+  else if ( res > 0 ) {
+    ImageIO_close(im);
+    if ( name != NULL ) free( name );
+    return im;
+  }  
+
+  /* could not read error : throw error */
+  fprintf(stderr, "_readImageHeaderAndGetError: an error occurs when reading image\n" );
+  if ( name == NULL || im->openMode == OM_STD) {
+    fprintf(stderr, "\t from \'standard input\'" );
+  }
+  else {
+    fprintf(stderr, "\t from file \'%s\'", name );
+  }
+  fprintf(stderr, " using format \'%s\'\n", (im->imageFormat)->realName );
+  ImageIO_close( im );
+  _freeImage(im);
+  *error = ImageIO_READING_HEADER;
+  if ( name != NULL ) free( name );
+  return NULL;
+
+}
+
+
+
+
+
+
+
+CGAL_INLINE_FUNCTION
+static void _swapImageData( _image *im ) 
+{
+  unsigned char *ptr1, *ptr2, b[8];
+  unsigned short int si, *ptr3, *ptr4;
+  unsigned int        i, *ptr5, *ptr6;
+  std::size_t size, length;
+  
+  if( _getEndianness() != im->endianness) {
+
+    size = std::size_t(im->xdim) * im->ydim * im->zdim * im->vdim * im->wdim;
+    if ( size <= 0 ) return;
+
+    length = size / im->wdim;
+    ptr1 = ptr2 = (unsigned char *) im->data;
+    
+    /* 2 bytes swap */
+    if(im->wdim == 2) {
+      /*
+	while(length--) {
+	b[0] = *ptr1++;
+	b[1] = *ptr1++;
+	*ptr2++ = b[1];
+	*ptr2++ = b[0];
+	}
+      */
+      ptr3 = ptr4 = (unsigned short int *) im->data;
+      while( length-- ) {
+	si = *ptr3++;
+	*ptr4++ = (unsigned short int)(((si >> 8) & 0xff) | (si << 8));
+      }
+    }
+    
+    /* 4 bytes swap */
+    else if(im->wdim == 4) {
+      /*
+	while(length--) {
+	b[0] = *ptr1++;
+	b[1] = *ptr1++;
+	b[2] = *ptr1++;
+	b[3] = *ptr1++;
+	*ptr2++ = b[3];
+	*ptr2++ = b[2];
+	*ptr2++ = b[1];
+	*ptr2++ = b[0];
+	}
+      */
+      ptr5 = ptr6 = (unsigned int *) im->data;
+      while( length-- ) {
+	i = *ptr5++;
+	*ptr6++ =  (i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | ((i >> 24) & 0xff);
+      }
+    }
+    /* 8 bytes swap */
+    else if(im->wdim == 8) {
+      while(length--) {
+	b[0] = *ptr1++;
+	b[1] = *ptr1++;
+	b[2] = *ptr1++;
+	b[3] = *ptr1++;
+	b[4] = *ptr1++;
+	b[5] = *ptr1++;
+	b[6] = *ptr1++;
+	b[7] = *ptr1++;
+	*ptr2++ = b[7];
+	*ptr2++ = b[6];
+	*ptr2++ = b[5];
+	*ptr2++ = b[4];
+	*ptr2++ = b[3];
+	*ptr2++ = b[2];
+	*ptr2++ = b[1];
+	*ptr2++ = b[0];
+      }
+    }
+  }
+}
+
+
+
+
+
+
+/* Read data of an inrimage.
+   If im->data is not NULL, assume that the buffer was previously allocated
+   Swap bytes depending on the endianness and the current architecture  */
+CGAL_INLINE_FUNCTION
+int _readImageData(_image *im) {
+  unsigned long size, nread;
+
+  if(im->openMode != OM_CLOSE) {
+    size = im->xdim * im->ydim * im->zdim * im->vdim * im->wdim;
+    
+    if ( size <= 0 ) return -3;
+
+    if(!im->data) {
+      im->data = (unsigned char *) ImageIO_alloc(size);
+      if(!im->data) return -2;
+    }
+
+    nread = ImageIO_read(im, im->data, size);
+    if(nread != size) return -1;
+
+
+    /* architecture is big endian and data little endian 
+       length = nb of points
+     */
+    _swapImageData( im );
+
+
+  }
+
+  return 1;
+}
+
+
+
+
+
+/* Read data of a vectorial inrimage, making the resulting buffer non-
+   inerlaced.
+   If im->data is not NULL, assume that the buffer was previously allocated
+   Swap bytes depending on the endianness and the current architecture. */
+CGAL_INLINE_FUNCTION
+int _readNonInterlacedImageData(_image *im) {
+  unsigned long size, nread;
+  unsigned char **vp, *buf;
+  unsigned int i, j, k, v, w;
+
+  if(im->vdim == 1) return _readImageData(im);
+  
+  if(im->openMode != OM_CLOSE) {
+    size = im->xdim * im->ydim * im->zdim * im->vdim * im->wdim;
+
+    if ( size <= 0 ) return -3;
+
+    if(!im->data) {
+      im->data = (unsigned char *) ImageIO_alloc(size);
+      if(!im->data) return -2;
+    }
+
+    vp = (unsigned char **) ImageIO_alloc(im->vdim * sizeof(unsigned char *));
+    buf = (unsigned char *) ImageIO_alloc(im->vdim * im->wdim);
+    size = im->xdim * im->ydim * im->zdim * im->wdim;
+    for(v = 0; v < im->vdim; v++)
+      vp[v] = (unsigned char *) im->data + v * size;
+
+    for(k = 0; k < im->zdim; k++) {
+      for(j = 0; j < im->ydim; j++) {
+	for(i = 0; i < im->xdim; i++) {
+	  nread = ImageIO_read(im, buf, im->vdim * im->wdim);
+	  if(nread != im->vdim * im->wdim) return -1;
+	  for(v = 0; v < im->vdim; v++)
+	    for(w = 0; w < im->wdim; w++)
+	      *vp[v]++ = *buf++;
+	  buf -= im->vdim * im->wdim;
+	}
+      }
+    }
+
+    ImageIO_free(buf);
+    ImageIO_free(vp);
+
+    /* architecture is big endian and data little endian */
+    _swapImageData( im );
+
+    
+    /* reorder lines */
+    /* no non-interlaced data for ANALYZE. But if ever... */
+/*     if( im->imageFormat == IF_ANALYZE ) { */
+/*        int v ; */
+/*        int vdim = im->vdim ; */
+/*        int lineSize = im->wdim * im->xdim ; */
+/*        int vsize = lineSize * im->ydim * im->zdim ; */
+/*        char* swapped = ImageIO_alloc(lineSize) ; */
+/*        for( v = 0 ; v < vdim ; ++v ) */
+/*        { */
+/* 	  char* buf1 = (char*)im->data + v*vsize ; */
+/* 	  char* buf2 = buf1 + vsize - lineSize ; */
+	  
+/* 	  while( buf1 < buf2 ) */
+/* 	  { */
+/* 	     memcpy( swapped, buf1, lineSize ) ; */
+/* 	     memcpy( buf1, buf2, lineSize ) ; */
+/* 	     memcpy( buf2, swapped, lineSize ) ; */
+/* 	     buf1 += lineSize ; */
+/* 	     buf2 -= lineSize ; */
+/* 	  } */
+
+/* 	  ImageIO_free( swapped ) ; */
+/*        } */
+/*     } */
+  }
+
+  return 1;
+}
+
+
+/* Reads body from a non-interlaced vectorial inrimage whose header has
+   been read by _readImageHeader. The image buffer is interlaced. */
+CGAL_INLINE_FUNCTION
+int _readNonInterlacedFileData(_image *im) {
+  unsigned long size, nread;
+  unsigned char *ptr1, *vp, *buf;
+  unsigned int i, j, k, v, w;
+
+  if(im->vdim == 1) return _readImageData(im);
+
+  if(im->openMode != OM_CLOSE) {
+    size = im->xdim * im->ydim * im->zdim * im->vdim * im->wdim;
+
+    if ( size <= 0 ) return -3;
+
+    if(!im->data) {
+      im->data = (unsigned char *) ImageIO_alloc(size);
+      if(!im->data) return -2;
+    }
+
+    size = im->xdim * im->ydim * im->zdim * im->wdim;
+    buf = ptr1 = (unsigned char *) ImageIO_alloc(size);
+
+    for(v = 0; v < im->vdim; v++) {
+      buf = ptr1;
+      nread = ImageIO_read(im, buf, size);
+      if(nread != size) return -1;
+      vp = (unsigned char *) im->data + (v * im->wdim);
+      for(k = 0; k < im->zdim; k++) {
+	for(j = 0; j < im->ydim; j++) {
+	  for(i = 0; i < im->xdim; i++) {
+	    for(w = 0; w < im->wdim; w++) *vp++ = *buf++;
+	    vp += (im->vdim - 1) * im->wdim;
+	  }
+	}
+      }
+    }
+
+    ImageIO_free(buf);
+
+    /* architecture is big endian and data little endian */
+    _swapImageData( im );
+    
+    
+    /* reorder lines */
+    /* no non-interlaced data for ANALYZE. But if ever... */
+/*     if( im->imageFormat == IF_ANALYZE ) { */
+/*        int v ; */
+/*        int vdim = im->vdim ; */
+/*        int lineSize = im->wdim * im->xdim ; */
+/*        int vsize = lineSize * im->ydim * im->zdim ; */
+/*        char* swapped = ImageIO_alloc(lineSize) ; */
+/*        for( v = 0 ; v < vdim ; ++v ) */
+/*        { */
+/* 	  char* buf1 = (char*)im->data + v*vsize ; */
+/* 	  char* buf2 = buf1 + vsize - lineSize ; */
+	  
+/* 	  while( buf1 < buf2 ) */
+/* 	  { */
+/* 	     memcpy( swapped, buf1, lineSize ) ; */
+/* 	     memcpy( buf1, buf2, lineSize ) ; */
+/* 	     memcpy( buf2, swapped, lineSize ) ; */
+/* 	     buf1 += lineSize ; */
+/* 	     buf2 -= lineSize ; */
+/* 	  } */
+
+/* 	  ImageIO_free( swapped ) ; */
+/*        } */
+/*     } */
+  }
+
+  return 1;  
+}
+
+
+
+
+
+
+
+
+
+
+/*--------------------------------------------------
+ *
+ * ?????
+ *
+ --------------------------------------------------*/
+
+
+
+
+
+/* check the type of image in fileName */
+CGAL_INLINE_FUNCTION
+PTRIMAGE_FORMAT imageType(const char *fileName) {
+  _ImageIO_file f;
+  char magic[5];
+  PTRIMAGE_FORMAT format;
+
+  if(!fileName) {
+#ifdef CGAL_USE_ZLIB    
+    f = gzdopen(fileno(stdin), "rb");
+#else
+    f = fdopen(fileno(stdin), "rb");
+#endif
+  }
+  else {
+#ifdef CGAL_USE_ZLIB      
+    f = gzopen(fileName, "rb");
+#else
+    f = fopen(fileName, "rb");
+#endif
+  }
+
+  if(!f) return NULL;
+  
+#ifdef CGAL_USE_ZLIB
+  gzread( f, (void *) magic, 4);
+#else
+  fread( (void *) magic, 1, 4, f );
+#endif
+
+
+  magic[4] = '\0';
+
+#ifdef CGAL_USE_ZLIB 
+  gzclose( f );
+#else
+  if(fileName) fclose( f );
+#endif
+
+  if (get_static_firstFormat()==NULL)
+    initSupportedFileFormat();
+
+  for(format=get_static_firstFormat();(format!=NULL);format=format->next) {
+    /* test if it is the correct header based on magic and file extension */
+    if (((*format->testImageFormat)(magic,fileName)) >=0) {
+      return format;
+    }
+  }
+  return 0;
+
+}
+
+
+
+
+
+/*--------------------------------------------------
+ *
+ * Image Format Management
+ *
+ --------------------------------------------------*/
+
+
+
+
+
+/** adds a format at the beginning of the list of image formats. 
+    Test if all mandatory fields have been filled */
+CGAL_INLINE_FUNCTION
+int addImageFormat( PTRIMAGE_FORMAT format) 
+{
+  if ( (format->testImageFormat) &&
+       (format->readImageHeader) &&
+       (strlen(format->fileExtension)>0) &&
+       (strlen(format->realName)>0) ) {
+
+    format->next=get_static_firstFormat();
+    get_static_firstFormat()=format;
+    
+    return 0;
+
+  } 
+  else {
+    fprintf(stderr,"addImageFormat: information missing in file format %s\n",
+	    format->realName);
+    return -1;
+  }
+}
+
+/** adds a format at the end of the list of image formats. 
+    Test if all mandatory fields have been filled */
+CGAL_INLINE_FUNCTION
+int addImageFormatAtEnd( PTRIMAGE_FORMAT format) 
+{
+  PTRIMAGE_FORMAT f;
+  if ( (format->testImageFormat) &&
+       (format->readImageHeader) &&
+       (strlen(format->fileExtension)>0) &&
+       (strlen(format->realName)>0) ) {
+
+    format->next = NULL;
+    
+    if (get_static_firstFormat() == NULL) {
+      get_static_firstFormat()=format;
+    }
+    else {
+      for(f=get_static_firstFormat();(f->next!=NULL);f=f->next)
+	;
+      f->next=format;    
+    }
+    
+    return 0;
+
+  } 
+  else {
+    fprintf(stderr,"addImageFormatAtEnd: information missing in file format %s\n",
+	    format->realName);
+    return -1;
+  }
+}
+
+
+/** creates supported image formats */
+CGAL_INLINE_FUNCTION
+void initSupportedFileFormat() 
+{
+  PTRIMAGE_FORMAT f;
+  if ( get_static_inrimageFormat() == NULL ) {
+    f = createAnalyzeFormat();
+    addImageFormatAtEnd( f );
+    f = createBMPFormat();
+    addImageFormatAtEnd( f );
+    f = createGifFormat();
+    addImageFormatAtEnd( f );
+    f = createGisFormat();
+    addImageFormatAtEnd( f );
+    f = createIrisFormat();
+    addImageFormatAtEnd( f );
+    f = createPgmFormat();
+    addImageFormatAtEnd( f );
+    f = createPgmAscIIFormat();
+    addImageFormatAtEnd( f );
+    f = createPpmFormat();
+    addImageFormatAtEnd( f );
+    get_static_inrimageFormat() = createInrimageFormat();
+    addImageFormat( get_static_inrimageFormat() );
+  }
+}
+
+
+
+CGAL_INLINE_FUNCTION
+PTRIMAGE_FORMAT firstImageFormat() {
+  return get_static_firstFormat();
+}
+
+
+
+/** prints supported image formats */
+CGAL_INLINE_FUNCTION
+void printSupportedFileFormat() {    
+  PTRIMAGE_FORMAT f;
+  int i;
+
+  initSupportedFileFormat();
+
+  for(i=0, f=get_static_firstFormat();(f!=NULL);i++, f=f->next) {
+    if ( (f->testImageFormat) &&
+	 (f->readImageHeader) &&
+	 (strlen(f->fileExtension)>0) &&
+	 (strlen(f->realName)>0)) {
+      fprintf( stderr, "#%2d: format name ='%s', extensions='%s'",
+	      i, f->realName, f->fileExtension );
+      if (f->readImageHeader) 
+	fprintf( stderr, ", read" );
+      if (f->writeImage) 
+	fprintf( stderr, ", write" );
+      fprintf( stderr, "\n" );
+    }
+  }
+}
+
+
+/** remove supported image formats */
+CGAL_INLINE_FUNCTION
+void removeSupportedFileFormat() {    
+  PTRIMAGE_FORMAT f=get_static_firstFormat();
+  
+  while( f != NULL) {
+    PTRIMAGE_FORMAT f_old = f;
+    f = f->next;
+    ImageIO_free( f_old);
+  }
+  get_static_inrimageFormat()=NULL;
+
+}
+
+
+/** trilinear interpolation in an _image float type
+ */
+CGAL_INLINE_FUNCTION
+float triLinInterp(const _image* image,
+                   float posx, 
+                   float posy, 
+                   float posz,
+                   float value_outside /*= 0.f */)
+{
+  const std::size_t dimx = image->xdim;
+  const std::size_t dimy = image->ydim;
+  const std::size_t dimz = image->zdim;
+  const std::size_t dimxy = dimx*dimy;
+  
+  if(posx < 0.f || posy < 0.f || posz < 0.f )
+    return value_outside;
+
+  posx = static_cast<float>(posx /(image->vx));
+  posy = static_cast<float>(posy /(image->vy));
+  posz = static_cast<float>(posz /(image->vz));
+
+  //patch suggested by J.Cugnoni to prevent integer overflow
+  if(posz >= dimz-1 || posy >= dimy-1 || posx >= dimx-1)
+    return value_outside;
+  
+  const int i1 = (int)(posz);
+  const int j1 = (int)(posy);
+  const int k1 = (int)(posx);
+
+  const int i2 = i1 + 1;
+  const int j2 = j1 + 1;
+  const int k2 = k1 + 1;
+
+  const float KI2 = float(i2)-posz;
+  const float KI1 = posz-float(i1);
+  const float KJ2 = float(j2)-posy;
+  const float KJ1 = posy-float(j1);
+
+  CGAL_IMAGE_IO_CASE
+    (image,
+     Word *array = (Word *) image->data;
+     return (((float)array[i1 * dimxy + j1 * dimx + k1] * KI2 +
+              (float)array[i2 * dimxy + j1 * dimx + k1] * KI1) * KJ2 +
+             ((float)array[i1 * dimxy + j2 * dimx + k1] * KI2 +
+              (float)array[i2 * dimxy + j2 * dimx + k1] * KI1) * KJ1) * (float(k2)-posx)+
+     (((float)array[i1 * dimxy + j1 * dimx + k2] * KI2 +
+       (float)array[i2 * dimxy + j1 * dimx + k2] * KI1) * KJ2 +
+      ((float)array[i1 * dimxy + j2 * dimx + k2] * KI2 +
+       (float)array[i2 * dimxy + j2 * dimx + k2] * KI1) * KJ1) * (posx-float(k1));
+     );
+  return 0.f;
+}
+
+// Gives the value of the image at pixel (i,j,k), converted in float.
+CGAL_INLINE_FUNCTION
+float evaluate(const _image* image,
+               const std::size_t i,
+               const std::size_t j,
+               const std::size_t k)
+{
+  using CGAL::IMAGEIO::static_evaluate;
+
+  CGAL_IMAGE_IO_CASE(image, return (float)static_evaluate<Word>(image, i, j, k); );
+
+  return 0.f;
+}
+
+/** convert the data of the image to float 
+*/
+CGAL_INLINE_FUNCTION
+void convertImageTypeToFloat(_image* image){ 
+  if(image->wordKind == WK_FLOAT && image->wdim == 4)
+    return;
+
+  const std::size_t dimx = image->xdim;
+  const std::size_t dimy = image->ydim;
+  const std::size_t dimz = image->zdim;
+  
+  float * array = (float*)ImageIO_alloc (dimx * dimy * dimz *sizeof(float));
+  if (array == NULL ) {
+    fprintf ( stderr, "allocation error\n" );
+    return;
+  }
+
+  CGAL_IMAGE_IO_CASE
+    (image, 
+     Word * typedArray  = (Word *)(image->data);
+     for(unsigned int i = 0; i<dimx * dimy * dimz;++i)
+       array[i] = (float)(typedArray[i]);
+     );
+
+  ImageIO_free ( image->data );
+  image->data = array;
+  
+  image->wordKind = WK_FLOAT;
+  image->wdim = 4;
+}
+
diff --git a/3rdparty/CGAL/include/CGAL/Image_3.h b/3rdparty/CGAL/include/CGAL/Image_3.h
new file mode 100644
index 0000000..069ef4e
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Image_3.h
@@ -0,0 +1,529 @@
+// Copyright (c) 2005-2008  INRIA Sophia-Antipolis (France).
+//               2008 GeometryFactory
+// 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(s)     : Laurent Rineau, Pierre Alliez
+
+#ifndef CGAL_IMAGE_3_H
+#define CGAL_IMAGE_3_H
+
+#include <CGAL/basic.h>
+#include <CGAL/array.h>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/format.hpp>
+#include <boost/unordered_set.hpp>
+#include <CGAL/ImageIO.h>
+#include <CGAL/function_objects.h>
+
+#include <limits>
+#include <set>
+#include <cstdlib>
+
+#if defined(BOOST_MSVC)
+#  pragma warning(push)
+#  pragma warning(disable:4244 4251) // double float conversion loss of data and dll linkage
+#endif
+
+class vtkImageData;
+
+namespace CGAL {
+
+namespace ImageIO {
+
+template <typename T>
+struct Indicator_factory
+{
+  class Indicator : public std::unary_function<T, double>
+  {
+    const T label;
+  public:
+    Indicator(T i) : label(i) {}
+
+    double operator()(T x) const
+    {
+      return (x == label) ? 1. : 0.;
+    }
+  }; // end nested class Indicator
+
+  Indicator indicator(T i) const {
+    return Indicator(i);
+  }
+};
+
+} // end namespace CGAL::ImageIO
+
+class CGAL_IMAGEIO_EXPORT Image_3
+{
+
+  struct Image_deleter {
+    void operator()(_image* image)
+    {
+      ::_freeImage(image);
+    }
+  };
+public:
+  typedef boost::shared_ptr<_image> Image_shared_ptr;
+  typedef Image_shared_ptr Pointer;
+
+protected:
+  Image_shared_ptr image_ptr;
+
+   // implementation in src/CGAL_ImageIO/Image_3.cpp
+  bool private_read(_image* im);
+
+public:
+  Image_3()
+    : image_ptr()
+  {
+  }
+
+  Image_3(const Image_3& bi)
+    : image_ptr(bi.image_ptr)
+  {
+//     std::cerr << "Image_3::copy_constructor\n";
+  }
+
+  Image_3(_image* im) 
+  {
+    private_read(im);
+  }
+
+  ~Image_3()
+  {
+  }
+
+  const _image* image() const
+  {
+    return image_ptr.get();
+  }
+
+  _image* image()
+  {
+    return image_ptr.get();
+  }
+
+  const void* data() const
+  {
+    return image()->data;
+  }
+
+  void* data()
+  {
+    return image()->data;
+  }
+
+  void set_data(void* d)
+  {
+    image()->data = d;
+  }
+
+  std::size_t xdim() const { return image_ptr->xdim; }
+  std::size_t ydim() const { return image_ptr->ydim; }
+  std::size_t zdim() const { return image_ptr->zdim; }
+
+  std::size_t size() const { return xdim() * ydim() * zdim(); }
+
+  double vx() const { return image_ptr->vx; }
+  double vy() const { return image_ptr->vy; }
+  double vz() const { return image_ptr->vz; }
+
+  float value(const std::size_t i,
+              const std::size_t j,
+              const std::size_t k) const
+  {
+    return ::evaluate(image(),i,j,k);
+  }
+
+public:
+
+  bool read(const char* file)
+  {
+    return private_read(::_readImage(file));
+  }
+
+  bool read_raw(const char* file,
+                const unsigned int rx,
+                const unsigned int ry,
+                const unsigned int rz,
+                const double vx = 1,
+                const double vy = 1,
+                const double vz = 1,
+		const unsigned int offset = 0)
+  {
+    return private_read(::_readImage_raw(file,
+                                         rx,ry,rz,
+                                         vx,vy,vz,offset));
+  }
+
+public:
+  template <typename Image_word_type,
+	    typename Target_type,
+	    typename Coord_type,
+	    class Image_transform>
+  Target_type
+  trilinear_interpolation(const Coord_type&x, 
+			  const Coord_type&y, 
+			  const Coord_type&z,
+			  const Target_type& value_outside =
+			    Target_type(),
+			  Image_transform transform = 
+			    Image_transform() ) const;
+
+  // default Image_transform = CGAL::Identity
+  template <typename Image_word_type,
+	    typename Target_type,
+	    typename Coord_type>
+  Target_type
+  trilinear_interpolation(const Coord_type&x, 
+			  const Coord_type&y, 
+			  const Coord_type&z,
+			  const Target_type& value_outside =
+			  Target_type()) const
+  {
+    return trilinear_interpolation<
+      Image_word_type,
+      Target_type>(x, y, z, value_outside,
+			  CGAL::Identity<Image_word_type>());
+  }
+
+  template <typename Image_word_type,
+	    typename Coord_type,
+            typename Target_type>
+  Target_type
+  labellized_trilinear_interpolation(const Coord_type&x,
+				     const Coord_type&y,
+				     const Coord_type&z,
+				     const Target_type& value_outside =
+  				       Target_type()) const
+  {
+    CGAL::ImageIO::Indicator_factory<Image_word_type> indicator_factory;
+    return labellized_trilinear_interpolation<Image_word_type>
+      (x, y, z, value_outside, indicator_factory);
+  }
+
+  template <typename Image_word_type,
+	    typename Coord_type,
+            typename Target_type,
+            typename Indicator_factory>
+  Target_type
+  labellized_trilinear_interpolation
+    (const Coord_type&x,
+     const Coord_type&y,
+     const Coord_type&z,
+     const Target_type& value_outside,
+     const Indicator_factory indicator_factory) const;
+
+}; // end Image_3
+
+template <typename Image_word_type,
+	  typename Target_type,
+	  typename Coord_type,
+	  class Image_transform>
+Target_type
+Image_3::trilinear_interpolation(const Coord_type& x, 
+				 const Coord_type& y, 
+				 const Coord_type& z,
+				 const Target_type& value_outside,
+				 Image_transform transform) const 
+{
+  // Check on double/float coordinates, because (int)-0.1 gives 0
+  if ( x < 0 || y < 0 || z < 0 )
+    return value_outside;
+  
+  const Coord_type lx = x / image()->vx;
+  const Coord_type ly = y / image()->vy;
+  const Coord_type lz = z / image()->vz;
+  const std::size_t dimx = xdim();
+  const std::size_t dimy = ydim();
+  const std::size_t dimz = zdim();
+  const std::size_t dimxy = dimx*dimy;
+  
+  if(lx < 0 ||
+     ly < 0 ||
+     lz < 0 ||
+     lz >= dimz-1 ||
+     ly >= dimy-1 ||
+     lx >= dimx-1)
+  {
+    return value_outside;
+  }  
+
+  // images are indexed by (z,y,x)
+  const int i1 = (int)(lz); 
+  const int j1 = (int)(ly);
+  const int k1 = (int)(lx);
+  const int i2 = i1 + 1;
+  const int j2 = j1 + 1;
+  const int k2 = k1 + 1;
+
+  /*   We assume (x,y,z) lies in the following cube.
+   *   a, b, c, d, e, f, g, h are the value of the image at the corresponding
+   *   voxels:
+   *
+   *
+   *     x        z
+   *     |       /
+   *        f___ __ g
+   *       /|      /|
+   *     e/_|____h/ |
+   *     |  |    |  |
+   *     |  |b___|_c|
+   *     | /     | /
+   *    a|/_____d|/  _y
+   *    
+   *
+   * a = val(i1, j1, k1)
+   * b = val(i2, j1, k1)
+   * c = val(i2, j2, k1)
+   * d = val(i1, j2, k1)
+   * e = val(i1, j1, k2)
+   * f = val(i2, j1, k2)
+   * g = val(i2, j2, k2)
+   * h = val(i1, j2, k2)
+   */
+
+  Image_word_type* ptr = (Image_word_type*)image()->data;
+  ptr += i1 * dimxy + j1 * dimx + k1;
+  const Target_type a = Target_type(transform(*ptr));
+  const Target_type e = Target_type(transform(*(ptr+1)));
+  ptr += dimxy; // i2 * dimxy + j1 * dimx + k1;
+  const Target_type b = Target_type(transform(*ptr));
+  const Target_type f = Target_type(transform(*(ptr+1)));
+  ptr += dimx; // i2 * dimxy + j2 * dimx + k1
+  const Target_type c = Target_type(transform(*ptr));
+  const Target_type g = Target_type(transform(*(ptr+1)));
+  ptr -= dimxy; // i1 * dimxy + j2 * dimx + k1
+  const Target_type d = Target_type(transform(*ptr));
+  const Target_type h = Target_type(transform(*(ptr+1)));
+  
+
+//   const Target_type a = ((Image_word_type*)image()->data)[i1 * dimxy + j1 * dimx + k1];
+//   const Target_type b = ((Image_word_type*)image()->data)[i2 * dimxy + j1 * dimx + k1];
+//   const Target_type c = ((Image_word_type*)image()->data)[i2 * dimxy + j2 * dimx + k1];
+//   const Target_type d = ((Image_word_type*)image()->data)[i1 * dimxy + j2 * dimx + k1];
+//   const Target_type e = ((Image_word_type*)image()->data)[i1 * dimxy + j1 * dimx + k2];
+//   const Target_type f = ((Image_word_type*)image()->data)[i2 * dimxy + j1 * dimx + k2];
+//   const Target_type g = ((Image_word_type*)image()->data)[i2 * dimxy + j2 * dimx + k2];
+//   const Target_type h = ((Image_word_type*)image()->data)[i1 * dimxy + j2 * dimx + k2];
+
+//   const Target_type outside = Target_type(transform(value_outside);
+
+//   if(x < 0.f ||
+//      y < 0.f ||
+//      z < 0.f ||
+//      i1 >= dimz ||
+//      j1 >= dimy ||
+//      k1 >= dimx)
+//   {
+//     return outside;
+//   }
+
+//   Target_type a, b, c, d, e, f, g, h;
+
+//   if(k1 < 0) {
+//     a = b = c = d = outside;
+//   }
+//   else {
+//     if(j1 < 0) {
+//       a = b = outside;
+//     }
+//     else {
+//       if(i1 < 0)
+// 	a = outside;
+//       else
+// 	a = ((Image_word_type*)image()->data)[i1 * dimxy + j1 * dimx + k1];
+
+//       if(i2 >= dimz)
+// 	b = outside;
+//       else 
+// 	b = ((Image_word_type*)image()->data)[i2 * dimxy + j1 * dimx + k1];
+//     }
+
+//     if(j2 >= dimy) {
+//       c = d = outside;
+//     }
+//     else {
+//       if(i1 < 0)
+// 	d = outside;
+//       else
+// 	d = ((Image_word_type*)image()->data)[i1 * dimxy + j2 * dimx + k1];
+
+//       if(i2 >= dimz)
+// 	c = outside;
+//       else
+// 	c = ((Image_word_type*)image()->data)[i2 * dimxy + j2 * dimx + k1];
+//     }
+//   }
+
+//   if(k2 >= dimx) {
+//     e = f = g = h = outside;
+//   }
+//   else {
+//     if(j1 < 0) {
+//       e = f = outside;
+//     }
+//     else {
+//       if(i1 < 0)
+// 	e = outside;
+//       else
+// 	e = ((Image_word_type*)image()->data)[i1 * dimxy + j1 * dimx + k2];
+
+//       if(i2 >= dimz)
+// 	f = outside;
+//       else 
+// 	f = ((Image_word_type*)image()->data)[i2 * dimxy + j1 * dimx + k2];
+//     }
+
+//     if(j2 >= dimy) {
+//       g = h = outside;
+//     }
+//     else {
+//       if(i1 < 0)
+// 	h = outside;
+//       else
+// 	h = ((Image_word_type*)image()->data)[i1 * dimxy + j2 * dimx + k2];
+
+//       if(i2 >= dimz)
+// 	g = outside;
+//       else
+// 	g = ((Image_word_type*)image()->data)[i2 * dimxy + j2 * dimx + k2];
+//     }
+//   }
+
+  const Target_type di2 = i2 - lz;
+  const Target_type di1 = lz - i1;
+  const Target_type dj2 = j2 - ly;
+  const Target_type dj1 = ly - j1;
+  const Target_type dk2 = k2 - lx;
+  const Target_type dk1 = lx - k1;
+//   std::cerr << di2 << " " << di1 << "\n";
+//   std::cerr << dj2 << " " << dj1 << "\n";
+//   std::cerr << dk2 << " " << dk1 << "\n";
+
+  return ( (  ( a * di2 + b * di1 ) * dj2 + 
+	      ( d * di2 + c * di1 ) * dj1   ) * dk2 +
+	   (  ( e * di2 + f * di1 ) * dj2 + 
+	      ( h * di2 + g * di1 ) * dj1   ) * dk1 );
+} // end trilinear_interpolation
+
+
+template <typename Image_word_type,
+	  typename Coord_type,
+          typename Target_type,
+          typename Indicator_factory>
+Target_type
+Image_3::labellized_trilinear_interpolation
+  (const Coord_type& x,
+   const Coord_type& y,
+   const Coord_type& z,
+   const Target_type& value_outside,
+   const Indicator_factory indicator_factory) const
+{
+  // Check on double/float coordinates, because (int)-0.1 gives 0
+  if ( x < 0 || y < 0 || z < 0 ) return value_outside;
+  
+  Coord_type lx = x / image()->vx;
+  Coord_type ly = y / image()->vy;
+  Coord_type lz = z / image()->vz;
+  const std::size_t dimx = xdim();
+  const std::size_t dimy = ydim();
+  const std::size_t dimz = zdim();
+  
+  if( lx < 0 ||
+      ly < 0 ||
+      lz < 0 ||
+     lz >= dimz-1 ||
+     ly >= dimy-1 ||
+     lx >= dimx-1)
+  {
+    return value_outside;
+  }  
+
+  // images are indexed by (z,y,x)
+  const int i1 = (int)(lz); 
+  const int j1 = (int)(ly);
+  const int k1 = (int)(lx);
+  const int i2 = i1 + 1;
+  const int j2 = j1 + 1;
+
+  CGAL::cpp11::array<std::size_t,8> index;
+  index[0] = (i1 * dimy + j1) * dimx + k1;
+  index[1] = index[0] + 1;
+  index[2] = (i1 * dimy + j2) * dimx + k1;
+  index[3] = index[2] + 1;
+  index[4] = (i2 * dimy + j1) * dimx + k1;
+  index[5] = index[4] + 1;
+  index[6] = (i2 * dimy + j2) * dimx + k1;
+  index[7] = index[6] + 1;
+
+  CGAL::cpp11::array<Image_word_type,8> labels;
+  
+  labels[0] = ((Image_word_type*)image()->data)[index[0]];
+  int lc = 1;
+  for(int lci=1; lci<8; ++lci){
+    bool found = false;
+    Image_word_type iwt = ((Image_word_type*)image()->data)[index[lci]];
+    for(int lcj=0; lcj < lc; ++lcj){
+      if(iwt == labels[lcj]){
+        found = true;
+        break;
+      }
+    }
+    if(found) continue;
+    labels[lc] = iwt;
+    ++lc;
+  }
+
+  CGAL_HISTOGRAM_PROFILER(
+    "Number of labels around a vertex, Image_3::labellized_trilinear_interpolation()", 
+    static_cast<unsigned int>(lc));
+
+  if(lc == 1) {
+    return labels[0];
+  }
+    
+  double best_value = 0.;
+  Image_word_type best = 0;
+  for(int i = 0; i < lc; ++i)
+  {
+    Image_word_type iwt = labels[i];
+    const double r = 
+      trilinear_interpolation<Image_word_type,double,Coord_type>(
+        x, y, z, value_outside, indicator_factory.indicator(iwt));
+
+    if(r > best_value) {
+      best = iwt;
+      best_value = r;
+    }
+  }
+//   CGAL_assertion(best_value > 0.5);
+  return best;
+}
+
+} // end namespace CGAL
+
+#ifdef CGAL_HEADER_ONLY
+#include <CGAL/Image_3_impl.h>
+#endif // CGAL_HEADER_ONLY
+
+#if defined(BOOST_MSVC)
+#  pragma warning(pop)
+#endif
+ 
+#endif // CGAL_IMAGE_3_H
diff --git a/3rdparty/CGAL/include/CGAL/Image_3_impl.h b/3rdparty/CGAL/include/CGAL/Image_3_impl.h
new file mode 100644
index 0000000..7bc8607
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Image_3_impl.h
@@ -0,0 +1,125 @@
+// Copyright (c) 2005-2008  INRIA Sophia-Antipolis (France).
+//               2008 GeometryFactory, Sophia Antipolis (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(s)     : Laurent Rineau, Pierre Alliez
+
+#ifdef CGAL_HEADER_ONLY
+#define CGAL_INLINE_FUNCTION inline
+#else
+#define CGAL_INLINE_FUNCTION
+#endif
+
+#include <CGAL/basic.h>
+
+namespace CGAL {
+
+CGAL_INLINE_FUNCTION
+bool Image_3::private_read(_image* im)
+{
+  if(im != 0)
+  {
+    if(image() != 0)
+    {
+      ::_freeImage(image());
+    }
+    image_ptr = Image_shared_ptr(im, Image_deleter());
+
+//     std::cerr << 
+//       boost::format("image=%1% (xdim=%2%, ydim=%3%, zdim=%4%)\n")
+//       % image_ptr.get() % image_ptr->xdim % image_ptr->ydim % image_ptr->zdim;
+
+  }
+  return im != 0;
+}
+
+
+} // end namespace CGAL
+
+#if 0
+
+#include <vtkImageData.h>
+#include <CGAL/Image_3_vtk_interface.h>
+
+namespace CGAL {
+
+namespace {
+
+struct VTK_to_ImageIO_type_mapper {
+  WORD_KIND wordKind;
+  SIGN sign;
+  unsigned int wdim;
+};
+
+static const VTK_to_ImageIO_type_mapper VTK_to_ImageIO_type[VTK_ID_TYPE] = 
+  { { WK_UNKNOWN, SGN_UNKNOWN,  0}, //  0=VTK_VOID
+    { WK_UNKNOWN, SGN_UNKNOWN,  0}, //  1=VTK_BIT
+    { WK_FIXED,   SGN_SIGNED,   1}, //  2=VTK_CHAR
+    { WK_FIXED,   SGN_UNSIGNED, 1}, //  3=VTK_UNSIGNED_CHAR
+    { WK_FIXED,   SGN_SIGNED,   2}, //  4=VTK_SHORT 
+    { WK_FIXED,   SGN_UNSIGNED, 2}, //  5=VTK_UNSIGNED_SHORT
+    { WK_FIXED,   SGN_SIGNED,   4}, //  6=VTK_INT
+    { WK_FIXED,   SGN_UNSIGNED, 4}, //  7=VTK_UNSIGNED_INT
+    { WK_FIXED,   SGN_SIGNED,   8}, //  8=VTK_LONG
+    { WK_FIXED,   SGN_UNSIGNED, 8}, //  9=VTK_UNSIGNED_LONG
+    { WK_FLOAT,   SGN_SIGNED,   4}, // 10=VTK_FLOAT
+    { WK_FIXED,   SGN_SIGNED,   8}  // 11=VTK_DOUBLE
+ }; 
+
+} //end anonymous namespace
+
+CGAL_INLINE_FUNCTION
+bool
+Image_3::read_vtk_image_data(vtkImageData* vtk_image)
+{
+  if(!vtk_image)
+    return false;
+
+  _image* image = ::_initImage();
+  const int* dims = vtk_image->GetDimensions();
+  const double* spacing = vtk_image->GetSpacing();
+  image->vectMode = VM_SCALAR;
+  image->xdim = dims[0];
+  image->ydim = dims[1];
+  image->zdim = dims[2];
+  image->vdim = 1;
+  image->vx = spacing[0];
+  image->vy = spacing[1];
+  image->vz = spacing[2];
+  image->endianness = ::_getEndianness();
+  int vtk_type = vtk_image->GetScalarType();
+  if(vtk_type == VTK_SIGNED_CHAR) vtk_type = VTK_CHAR;
+  if(vtk_type < 0 || vtk_type > VTK_DOUBLE)
+    vtk_type = VTK_DOUBLE;
+  const VTK_to_ImageIO_type_mapper& imageio_type = 
+    VTK_to_ImageIO_type[vtk_type];
+  image->wdim = imageio_type.wdim;
+  image->wordKind = imageio_type.wordKind;
+  image->sign = imageio_type.sign;
+  image->data = ::ImageIO_alloc(dims[0]*dims[1]*dims[2]*image->wdim);
+  std::cerr << "GetNumberOfTuples()=" << vtk_image->GetPointData()->GetScalars()->GetNumberOfTuples()
+            << "\nimage->size()=" << dims[0]*dims[1]*dims[2]
+            << "\nwdim=" << image->wdim << '\n';
+  CGAL_assertion(vtk_image->GetPointData()->GetScalars()->GetNumberOfTuples() == dims[0]*dims[1]*dims[2]);
+  vtk_image->GetPointData()->GetScalars()->ExportToVoidPointer(image->data);
+
+  return this->private_read(image);
+}
+
+} // end namespace CGAL
+
+#endif // CGAL_USE_VTK
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Image_3_vtk_interface.h b/3rdparty/CGAL/include/CGAL/Image_3_vtk_interface.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Image_3_vtk_interface.h
rename to 3rdparty/CGAL/include/CGAL/Image_3_vtk_interface.h
diff --git a/3rdparty/CGAL/include/CGAL/Implicit_mesh_domain_3.h b/3rdparty/CGAL/include/CGAL/Implicit_mesh_domain_3.h
new file mode 100644
index 0000000..456acd7
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Implicit_mesh_domain_3.h
@@ -0,0 +1,94 @@
+// Copyright (c) 2009 INRIA Sophia-Antipolis (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
+// 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(s)     : Stéphane Tayeb
+//
+//******************************************************************************
+// File Description :
+// class Implicit_mesh_domain_3. See class description.
+//******************************************************************************
+
+#ifndef CGAL_IMPLICIT_MESH_DOMAIN_3_H
+#define CGAL_IMPLICIT_MESH_DOMAIN_3_H
+
+#if defined(BOOST_MSVC)
+#  pragma warning(push)
+#  pragma warning(disable:4180) // qualifier applied to function type has no meaning; ignored
+#endif
+
+#include <CGAL/Labeled_mesh_domain_3.h>
+#include <CGAL/Implicit_to_labeling_function_wrapper.h>
+#include <CGAL/Random.h>
+
+namespace CGAL {
+
+
+/**
+ * @class Implicit_mesh_domain_3
+ *
+ * Implements mesh_traits for a domain defined as the negative values of
+ * an implicit function.
+ */
+template<class Function,
+  class BGT,
+  class Wrapper = Implicit_to_labeling_function_wrapper<Function,BGT> >
+class Implicit_mesh_domain_3
+ : public Labeled_mesh_domain_3<Wrapper, BGT >
+{
+public:
+  /// Base type
+  typedef Labeled_mesh_domain_3<Wrapper, BGT> Base;
+
+  /// Public types
+  typedef typename Base::Sphere_3 Sphere_3;
+  typedef typename Base::FT FT;
+  typedef BGT Geom_traits;
+
+  /**
+   * Constructor
+   * @param f the function which negative values defines the domain
+   * @param bounding_sphere a bounding sphere of the domain
+   * @param error_bound the error bound relative to the sphere radius
+   */
+  Implicit_mesh_domain_3(const Function& f,
+                         const Sphere_3& bounding_sphere,
+                         const FT& error_bound = FT(1e-6),
+                         CGAL::Random* p_rng = NULL)
+    : Base(Wrapper(f), bounding_sphere, error_bound,
+           Null_subdomain_index(), p_rng)  {}
+
+  /// Destructor
+  virtual ~Implicit_mesh_domain_3() {}
+
+  using Base::bbox;
+private:
+  // Disabled copy constructor & assignment operator
+  typedef Implicit_mesh_domain_3<Function,BGT> Self;
+  Implicit_mesh_domain_3(const Self& src);
+  Self& operator=(const Self& src);
+
+};  // end class Implicit_mesh_domain_3
+
+
+}  // end namespace CGAL
+
+#if defined(BOOST_MSVC)
+#  pragma warning(pop)
+#endif
+
+#endif // CGAL_IMPLICIT_MESH_DOMAIN_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Implicit_surface_3.h b/3rdparty/CGAL/include/CGAL/Implicit_surface_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Implicit_surface_3.h
rename to 3rdparty/CGAL/include/CGAL/Implicit_surface_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Implicit_to_labeling_function_wrapper.h b/3rdparty/CGAL/include/CGAL/Implicit_to_labeling_function_wrapper.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Implicit_to_labeling_function_wrapper.h
rename to 3rdparty/CGAL/include/CGAL/Implicit_to_labeling_function_wrapper.h
diff --git a/3rdparty/CGAL/include/CGAL/In_place_list.h b/3rdparty/CGAL/include/CGAL/In_place_list.h
new file mode 100644
index 0000000..b89ac65
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/In_place_list.h
@@ -0,0 +1,812 @@
+// Copyright (c) 2003  
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved. 
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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(s)     : Michael Hoffmann <hoffmann at inf.ethz.ch>
+//                 Lutz Kettner <kettner at mpi-sb.mpg.de>
+//                 Sylvain Pion
+
+#ifndef CGAL_IN_PLACE_LIST_H
+#define CGAL_IN_PLACE_LIST_H 1
+
+#include <CGAL/basic.h>
+#include <cstddef>
+#include <iterator>
+#include <functional>
+#include <algorithm>
+#include <CGAL/memory.h>
+#include <boost/functional/hash.hpp>
+
+namespace CGAL {
+
+// Forward declarations
+namespace internal {
+  template <class T, class Alloc> class In_place_list_iterator;
+  template <class T, class Alloc> class In_place_list_const_iterator;
+}
+
+template <class T, bool managed, class Alloc = CGAL_ALLOCATOR(T)>
+class In_place_list;
+
+template < class T >
+class In_place_sl_list_base {
+public:
+  T* next_link;        // forward pointer
+};
+
+template < class T >
+class In_place_list_base {
+public:
+  T* next_link;        // forward pointer
+  T* prev_link;        // backwards pointer
+  //friend  class internal::In_place_list_iterator<T, Alloc>;
+  //friend  class internal::In_place_list_const_iterator<T, Alloc>;
+  //friend  class In_place_list<T,false, Alloc>;
+  //friend  class In_place_list<T,true, Alloc>;
+};
+
+
+namespace internal {
+  template <class T, class Alloc>
+  class In_place_list_iterator {
+  protected:
+    T* node;
+  public:
+    friend  class In_place_list<T,false, Alloc>;
+    friend  class In_place_list<T,true, Alloc>;
+
+    typedef In_place_list_iterator<T, Alloc>  Self;
+    typedef In_place_list_base<T>      Base;
+
+    typedef T               value_type;
+    typedef T*              pointer;
+    typedef T&              reference;
+    typedef std::size_t     size_type;
+    typedef std::ptrdiff_t  difference_type;
+    typedef std::bidirectional_iterator_tag   iterator_category;
+
+    In_place_list_iterator() : node(0) {}
+    In_place_list_iterator(T* x) : node(x) {}
+
+    bool  operator==( const Self& x) const { return node == x.node; }
+    bool  operator!=( const Self& x) const { return node != x.node; }
+    bool  operator< ( const Self& x) const { return node< x.node;   }
+    bool  operator<=( const Self& x) const { return node<= x.node;  }
+    bool  operator> ( const Self& x) const { return node> x.node;   }
+    bool  operator>=( const Self& x) const { return node>= x.node;  }
+    T&    operator*()  const { return *node; }
+    T*    operator->() const { return  node; }
+    Self& operator++() {
+      node = ((Base*)(node))->next_link;
+      return *this;
+    }
+    Self  operator++(int) {
+      Self tmp = *this;
+      ++*this;
+      return tmp;
+    }
+    Self& operator--() {
+      node = ((Base*)(node))->prev_link;
+      return *this;
+    }
+    Self  operator--(int) {
+      Self tmp = *this;
+      --*this;
+      return tmp;
+    }
+  };
+}
+
+namespace internal {
+  template <class T, class Alloc>
+  class In_place_list_const_iterator {
+  protected:
+    const T* node;  // It's not Ptr. Otherwise traversal won't work.
+  public:
+    friend  class In_place_list<T,false, Alloc>;
+    friend  class In_place_list<T,true, Alloc>;
+
+    typedef In_place_list_const_iterator<T, Alloc> Self;
+    typedef In_place_list_iterator<T, Alloc>       Iterator;
+    typedef In_place_list_base<T>           Base;
+
+    typedef T               value_type;
+    typedef const T*        pointer;
+    typedef const T&        reference;
+    typedef std::size_t     size_type;
+    typedef std::ptrdiff_t  difference_type;
+    typedef std::bidirectional_iterator_tag   iterator_category;
+
+    In_place_list_const_iterator() : node(0) {}
+    In_place_list_const_iterator( Iterator i) : node(&*i) {}
+    In_place_list_const_iterator(const T* x) : node(x) {}
+
+    bool     operator==( const Self& x) const { return node == x.node; }
+    bool     operator!=( const Self& x) const { return node != x.node; }
+    bool     operator< ( const Self& x) const { return node< x.node;   }
+    bool     operator<=( const Self& x) const { return node<= x.node;  }
+    bool     operator> ( const Self& x) const { return node> x.node;   }
+    bool     operator>=( const Self& x) const { return node>= x.node;  }
+    const T& operator*()  const { return *node; }
+    const T* operator->() const { return  node; }
+    Self& operator++() {
+      node = ((const Base*)(node))->next_link;
+      return *this;
+    }
+    Self  operator++(int) {
+      Self tmp = *this;
+      ++*this;
+      return tmp;
+    }
+    Self& operator--() {
+      node = ((const Base*)(node))->prev_link;
+      return *this;
+    }
+    Self  operator--(int) {
+      Self tmp = *this;
+      --*this;
+      return tmp;
+    }
+    In_place_list_iterator<T,Alloc>
+    remove_const() const
+    {
+      return In_place_list_iterator<T,Alloc>(const_cast<T*>(node));
+    }
+  };
+
+
+
+template <class T, class Alloc>
+  std::size_t hash_value(const In_place_list_iterator<T,Alloc>&  i)
+  {
+    T* ptr = &*i;
+    return reinterpret_cast<std::size_t>(ptr)/ sizeof(T);
+  }
+
+
+template <class T, class Alloc>
+  std::size_t hash_value(const In_place_list_const_iterator<T,Alloc>&  i)
+  {
+    const T* ptr = &*i;
+    return reinterpret_cast<std::size_t>(ptr)/ sizeof(T);
+   }
+
+}
+
+
+template <class T, bool managed, class Alloc>
+class In_place_list {
+
+  // Bidirectional List Managing Objects in Place
+  // --------------------------------------------
+  //
+  // DEFINITION An object of the class In_place_list<T,bool> is a
+  // sequence that supports bidirectional iterators and allows constant time
+  // insert and erase operations anywhere within the sequence. The
+  // functionality is similar to the `list<T>' in the STL.
+  //
+  // The In_place_list<T,bool> manages element items in place. Two
+  // pointers `T*' are expected in the class. For example the base class
+  // `In_place_list_base<T>' can be used.
+  //
+  // The In_place_list<T,bool> does not copy element items during
+  // insertion (unless otherwise stated for a function). On removal or
+  // destruction of the list the element items are not deleted by default.
+  // The second template parameter `bool' has to be set to `false' in this
+  // case. If the In_place_list<T,bool> should take the responsibility
+  // for the stored objects the `bool' parameter could be set to `true', in
+  // which case the list will delete removed items and will delete all
+  // remaining items on destruction. In any case, the `destroy()' member
+  // function deletes all elements.
+  //
+  // On purpose, these two possible versions of In_place_list<T,bool>
+  // are not assignment compatible to avoid confusions between the different
+  // storage responsibilities.
+  //
+  // PARAMETERS
+  //
+  // The full classname is `In_place_list<T,bool managed = false, Alloc
+  // = CGAL_ALLOCATOR(T)>'.
+  //
+  // TYPES
+
+public:
+  typedef Alloc           Allocator;
+  typedef Alloc           allocator_type; // STL compliant
+
+  // Note: the standard requires the following types to be equivalent
+  // to T, T*, const T*, T&, const T&, size_t, and ptrdiff_t, respectively.
+  // So we don't pass these types to the iterators explicitly.
+  typedef typename Allocator::value_type          value_type;
+  typedef typename Allocator::pointer             pointer;
+  typedef typename Allocator::const_pointer       const_pointer;
+  typedef typename Allocator::reference           reference;
+  typedef typename Allocator::const_reference     const_reference;
+  typedef typename Allocator::size_type           size_type;
+  typedef typename Allocator::difference_type     difference_type;
+
+  typedef internal::In_place_list_iterator<T, Alloc> iterator;
+  typedef internal::In_place_list_const_iterator<T, Alloc> const_iterator;
+
+  typedef std::reverse_iterator<iterator>         reverse_iterator;
+  typedef std::reverse_iterator<const_iterator>   const_reverse_iterator;
+
+  typedef In_place_list<T,managed,Alloc>          Self;
+
+protected:
+  Allocator allocator;
+
+  pointer      node;
+  size_type    length;
+
+  // These are the only places where the allocator gets called.
+  pointer get_node() {
+    pointer p = allocator.allocate(1);
+#ifdef CGAL_USE_ALLOCATOR_CONSTRUCT_DESTROY
+    allocator.construct(p, value_type());
+#else
+    new (p) value_type;
+#endif
+    return p;
+  }
+  pointer get_node( const T& t) {
+    pointer p = allocator.allocate(1);
+#ifdef CGAL_USE_ALLOCATOR_CONSTRUCT_DESTROY
+    allocator.construct(p, t);
+#else
+    new (p) value_type(t);
+#endif
+    return p;
+  }
+  void put_node( pointer p) {
+#ifdef CGAL_USE_ALLOCATOR_CONSTRUCT_DESTROY  
+    allocator.destroy( p);
+#else 
+   p->~value_type();
+#endif
+    allocator.deallocate( p, 1);
+  }
+
+public:
+  // CREATION
+  //
+  // New creation variable is: `l'
+
+  explicit In_place_list() : length(0) {
+    // introduces an empty list.
+    node = get_node();
+    (*node).next_link = node;
+    (*node).prev_link = node;
+  }
+  void swap(Self& x) {
+    std::swap(node, x.node);
+    std::swap(length, x.length);
+  }
+
+  // ACCESS MEMBER FUNCTIONS
+
+  allocator_type get_allocator() const { return allocator; }
+
+  iterator       begin() { return (*node).next_link; }
+  const_iterator begin() const { return (*node).next_link; }
+  iterator       end() { return node; }
+  const_iterator end() const { return node; }
+
+  reverse_iterator       rbegin() { return reverse_iterator(end()); }
+  const_reverse_iterator rbegin() const {
+    return const_reverse_iterator(end());
+  }
+  reverse_iterator       rend() { return reverse_iterator(begin()); }
+  const_reverse_iterator rend() const {
+    return const_reverse_iterator(begin());
+  }
+
+  bool            empty() const    { return length == 0; }
+  size_type       size() const     { return length; }
+  size_type       max_size() const { return size_type(-1); }
+
+  reference       front()          { return *begin(); }
+  const_reference front() const    { return *begin(); }
+  reference       back()           { return *(--end()); }
+  const_reference back() const     { return *(--end()); }
+
+  // INSERTION
+
+  iterator insert(iterator position, T& x) {
+    // inserts `t' in front of iterator `pos'. The return value points
+    // to the inserted item.
+    x.next_link = position.node;
+    x.prev_link = (*position.node).prev_link;
+    (*((*position.node).prev_link)).next_link = &x;
+    (*position.node).prev_link = &x;
+    ++length;
+    return &x;
+  }
+  iterator insert(T* pos, T& x) {
+    return insert( iterator(pos), x);
+  }
+  void push_front(T& x) { insert(begin(), x); }
+  // inserts an item in front of list `l'.
+
+  void push_back(T& x)  { insert(end(), x); }
+  // inserts an item at the back of list `l'.
+
+  void insert(iterator position, size_type n);
+  // inserts n copies of `T()' in front of iterator `pos'.
+
+  void insert(iterator position, size_type n, const T& x);
+  // inserts n copies of `t' in front of iterator `pos'.
+
+  void insert( T* pos, size_type n) { insert( iterator(pos), n); }
+  void insert( T* pos, size_type n, const T& x) {
+    insert( iterator(pos), n, x);
+  }
+
+  template <class InputIterator>
+  void insert(iterator pos, InputIterator first, InputIterator last) {
+    // inserts the range [`first, last') in front of iterator `pos'.
+    while (first != last)
+      insert(pos, *get_node(*first++));
+  }
+
+  template <class InputIterator>
+  void insert(T* pos, InputIterator first, InputIterator last) {
+    // inserts the range [`first, last') in front of iterator `pos'.
+    while (first != last)
+      insert(pos, *get_node(*first++));
+  }
+
+  void insert(T* pos, const T* first, const T* last) {
+    insert( iterator(pos), const_iterator(first),
+            const_iterator(last));
+  }
+
+
+  // REMOVAL
+
+  void erase(iterator i) {
+    // removes the item from list `l', where `pos' refers to.
+    CGAL_assertion( length > 0);
+    (*((*i.node).prev_link)).next_link = (*i.node).next_link;
+    (*((*i.node).next_link)).prev_link = (*i.node).prev_link;
+    if (managed)
+      put_node(i.node);
+    --length;
+  }
+  void erase(T* pos)  { erase( iterator( pos)); }
+
+  void pop_front() { erase(begin()); }
+  // removes the first item from list `l'.
+
+  void pop_back() {
+    // removes the last item from list `l'.
+    iterator tmp = end();
+    erase(--tmp);
+  }
+
+  void erase(iterator first, iterator last);
+  // removes the items in the range [`first, last') from list `l'.
+
+  void erase(T* first, T* last) {
+    erase( iterator(first), iterator(last));
+  }
+
+  void clear() { erase( begin(), end()); }
+
+  // CREATION (Continued)
+
+  explicit In_place_list(size_type n, const T& value = T()) : length(0) {
+    // introduces a list with n items, all initialized with copies of
+    // value.
+    node = get_node();
+    (*node).next_link = node;
+    (*node).prev_link = node;
+    insert(begin(), n, value);
+  }
+
+  template <class InputIterator>
+  In_place_list( InputIterator first, InputIterator last) : length(0) {
+    // a list with copies from the range [`first,last').
+    node = get_node();
+    (*node).next_link = node;
+    (*node).prev_link = node;
+    insert( begin(), first, last);
+  }
+
+  In_place_list(const T* first, const T* last) : length(0) {
+    // a list with copies from the range [`first,last').
+    node = get_node();
+    (*node).next_link = node;
+    (*node).prev_link = node;
+    insert(begin(), first, last);
+  }
+  In_place_list(const Self& x) : length(0) {
+    // copy constructor. Each item in `l1' is copied.
+    node = get_node();
+    (*node).next_link = node;
+    (*node).prev_link = node;
+    insert(begin(), x.begin(), x.end());
+  }
+  ~In_place_list() {
+    erase(begin(), end());
+    put_node(node);
+  }
+
+  Self& operator=(const Self& x);
+
+  void destroy();
+
+  template <class InputIterator>
+  void assign( InputIterator first, InputIterator last) {
+    erase( begin(), end());
+    insert( begin(), first, last);
+  }
+
+  void assign( size_type n, const T& t) {
+    erase( begin(), end());
+    insert( begin(), n, t);
+  }
+
+  void resize( size_type sz, const T& c = T()) {
+    if ( sz > size())
+      insert( end(), sz - size(), c);
+    else if ( sz < size()) {
+      iterator i = begin();
+      while ( sz-- > 0)
+        ++i;
+      erase( i, end());
+    }  // else do nothing
+  }
+
+  // COMPARISON OPERATIONS
+
+  bool operator==( const Self& y) const {
+    return size() == y.size() && std::equal(begin(), end(), y.begin());
+  }
+
+  bool operator!=( const Self& y) const {
+    return size() != y.size() || ! std::equal(begin(),end(),y.begin());
+  }
+
+  bool operator<(const Self& y) const {
+    return std::lexicographical_compare( begin(),end(),
+                                         y.begin(),y.end());
+  }
+  bool operator> ( const Self& i) const { return i < *this; }
+  bool operator<=( const Self& i) const { return !(i < *this); }
+  bool operator>=( const Self& i) const { return !(*this < i); }
+
+  // SPECIAL LIST OPERATIONS
+
+protected:
+  void transfer(iterator position, iterator first, iterator last) {
+    // move the range [`first, last') before the position.
+    (*((*last.node).prev_link)).next_link = position.node;
+    (*((*first.node).prev_link)).next_link = last.node;
+    (*((*position.node).prev_link)).next_link = first.node;
+    T* tmp = (*position.node).prev_link;
+    (*position.node).prev_link = (*last.node).prev_link;
+    (*last.node).prev_link = (*first.node).prev_link;
+    (*first.node).prev_link = tmp;
+  }
+
+public:
+  void splice(iterator position, Self& x) {
+    // inserts the list x before position `pos' and x becomes empty.
+    // It takes constant time. Precondition: `&l != &x'.
+    if (!x.empty()) {
+      transfer(position, x.begin(), x.end());
+      length += x.length;
+      x.length = 0;
+    }
+  }
+  void splice(T* position, Self& x) {
+    splice( iterator(position), x);
+  }
+  void splice( iterator position, Self& x, iterator i) {
+    // inserts an element pointed to by i from list x before position
+    // `pos' and removes the element from x. It takes constant time. i
+    // is a valid dereferenceable iterator of x. The result is
+    // unchanged if `pos == i' or `pos == ++i'.
+    iterator j = i;
+    if (position == i || position == ++j) return;
+    transfer(position, i, j);
+    ++length;
+    --x.length;
+  }
+  void splice(T* position, Self& x, T* i) {
+    splice( iterator(position), x, iterator(i));
+  }
+  void splice(iterator pos, Self& x, iterator first, iterator last) {
+    // inserts elements in the range [`first, last') before position
+    // `pos' and removes the elements from x. It takes constant time
+    // if `&x == $l'; otherwise, it takes linear time. [`first,
+    // last') is a valid range in x. Precondition: `pos' is not in the
+    // range [`first, last').
+    if (first != last) {
+      if (&x != this) {
+        difference_type n = std::distance(first, last);
+        x.length -= n;
+        length += n;
+      }
+      transfer(pos, first, last);
+    }
+  }
+  void splice(T* p, Self& x, T* first, T* last) {
+    splice( iterator(p), x, iterator(first), iterator(last));
+  }
+
+  void remove(const T& value);
+  // erases all elements e in the list l for which `e == value'.
+  // It is stable. Precondition: a suitable `operator==' for the
+  // type T.
+
+  void reverse();
+  // reverses the order of the elements in `l' in linear time.
+
+  void unique();
+  // erases all but the first element from every consecutive group
+  // of equal elements in the list `l'. Precondition: a suitable
+  // `operator==' for the type T.
+
+  void merge(Self& x);
+  // merges the list x into the list `l' and x becomes empty. It is
+  // stable. Precondition: Both lists are increasingly sorted. A
+  // suitable `operator<' for the type T.
+
+  template < class StrictWeakOrdering >
+  void merge(Self& x, StrictWeakOrdering ord)
+  // merges the list x into the list `l' and x becomes empty.
+  // It is stable.
+  // Precondition: Both lists are increasingly sorted wrt. ord.
+  {
+    iterator first1 = begin();
+    iterator last1 = end();
+    iterator first2 = x.begin();
+    iterator last2 = x.end();
+    while (first1 != last1 && first2 != last2)
+      if (ord(*first2, *first1)) {
+        iterator next = first2;
+        transfer(first1, first2, ++next);
+        first2 = next;
+      } else
+        ++first1;
+    if (first2 != last2)
+      transfer(last1, first2, last2);
+    length += x.length;
+    x.length= 0;
+  }
+
+  void sort();
+  // sorts the list `l' according to the `operator<' in time O(n
+  // log n) where `n = size()'. It is stable. Precondition: a
+  // suitable `operator<' for the type T.
+
+  template < class StrictWeakOrdering >
+  void sort(StrictWeakOrdering ord)
+  // sorts the list `l' according to ord in time O(n log n)
+  // where `n = size()'. It is stable.
+  {
+    if (size() < 2) return;
+    In_place_list<T,managed,Alloc> carry;
+    In_place_list<T,managed,Alloc> counter[64];
+    int fill = 0;
+    while (!empty()) {
+      carry.splice(carry.begin(), *this, begin());
+      int i = 0;
+      while(i < fill && !counter[i].empty()) {
+        counter[i].merge(carry, ord);
+        carry.swap(counter[i++]);
+      }
+      carry.swap(counter[i]);
+      if (i == fill)
+        ++fill;
+    }
+    for (int i = 1; i < fill; ++i)
+      counter[i].merge(counter[i-1], ord);
+    swap(counter[fill-1]);
+  }
+
+};
+
+template <class T, bool managed, class Alloc>
+void In_place_list<T,managed,Alloc>::
+insert(internal::In_place_list_iterator<T, Alloc> position, size_type n) {
+  while (n--)
+    insert(position, *get_node());
+}
+
+template <class T, bool managed, class Alloc>
+void In_place_list<T,managed,Alloc>::
+insert(internal::In_place_list_iterator<T, Alloc> position, size_type n, const T& x) {
+  while (n--)
+    insert(position, *get_node(x));
+}
+
+template <class T, bool managed, class Alloc>
+void In_place_list<T,managed,Alloc>::
+erase(internal::In_place_list_iterator<T, Alloc> first,
+      internal::In_place_list_iterator<T, Alloc> last)
+{
+  while (first != last)
+    erase(first++);
+}
+
+template <class T, bool managed, class Alloc>
+In_place_list<T,managed,Alloc>&
+In_place_list<T,managed,Alloc>::
+operator=(const In_place_list<T,managed,Alloc>& x) {
+  if (this != &x) {
+    iterator first1 = begin();
+    iterator last1  = end();
+    const_iterator first2 = x.begin();
+    const_iterator last2  = x.end();
+    while (first1 != last1 && first2 != last2) {
+      // Save the pointer values before assignment.
+      // Assignment avoids unneccassary delete's and new's.
+      T* tmp1 = (*first1).next_link;
+      T* tmp2 = (*first1).prev_link;
+      *first1 = *first2++;
+      (*first1).next_link = tmp1;
+      (*first1).prev_link = tmp2;
+      ++first1;
+    }
+    if (first2 == last2)
+      erase(first1, last1);
+    else
+      insert(last1, first2, last2);
+  }
+  return *this;
+}
+
+template <class T, bool managed, class Alloc>
+void In_place_list<T,managed,Alloc>::
+destroy() {
+  iterator first = begin();
+  iterator last  = end();
+  while( first != last) {
+    iterator i = first++;
+    put_node(i.node);
+  }
+  length = 0;
+  (*node).next_link = node;
+  (*node).prev_link = node;
+}
+
+template <class T, bool managed, class Alloc>
+void In_place_list<T,managed,Alloc>::remove(const T& value) {
+  iterator first = begin();
+  iterator last = end();
+  while (first != last) {
+    iterator next = first;
+    ++next;
+    if (*first == value)
+      erase(first);
+    first = next;
+  }
+}
+
+template <class T, bool managed, class Alloc>
+void In_place_list<T,managed,Alloc>::reverse() {
+  if (size() < 2) return;
+  for (iterator first = ++begin(); first != end();) {
+    iterator old = first++;
+    transfer(begin(), old, first);
+  }
+}
+
+template <class T, bool managed, class Alloc>
+void In_place_list<T,managed,Alloc>::unique() {
+  iterator first = begin();
+  iterator last = end();
+  if (first == last) return;
+  iterator next = first;
+  while (++next != last) {
+    if (*first == *next)
+      erase(next);
+    else
+      first = next;
+    next = first;
+  }
+}
+
+template <class T, bool managed, class Alloc>
+void In_place_list<T,managed,Alloc>::merge(In_place_list<T,managed,Alloc>& x) {
+  iterator first1 = begin();
+  iterator last1 = end();
+  iterator first2 = x.begin();
+  iterator last2 = x.end();
+  while (first1 != last1 && first2 != last2)
+    if (*first2 < *first1) {
+      iterator next = first2;
+      transfer(first1, first2, ++next);
+      first2 = next;
+    } else
+      ++first1;
+  if (first2 != last2)
+    transfer(last1, first2, last2);
+  length += x.length;
+  x.length= 0;
+}
+
+template <class T, bool managed, class Alloc>
+void In_place_list<T,managed,Alloc>::sort() {
+  if (size() < 2) return;
+  In_place_list<T,managed,Alloc> carry;
+  In_place_list<T,managed,Alloc> counter[64];
+  int fill = 0;
+  while (!empty()) {
+    carry.splice(carry.begin(), *this, begin());
+    int i = 0;
+    while(i < fill && !counter[i].empty()) {
+      counter[i].merge(carry);
+      carry.swap(counter[i++]);
+    }
+    carry.swap(counter[i]);
+    if (i == fill)
+      ++fill;
+  }
+  for (int i = 1; i < fill; ++i)
+    counter[i].merge(counter[i-1]);
+  swap(counter[fill-1]);
+}
+
+} //namespace CGAL
+
+namespace std {
+
+#if defined(BOOST_MSVC)
+#  pragma warning(push)
+#  pragma warning(disable:4099) // For VC10 it is class hash 
+#endif
+
+#ifndef CGAL_CFG_NO_STD_HASH
+
+  template < class T, class Alloc >
+  struct hash<CGAL::internal::In_place_list_iterator<T, Alloc> >
+    : public std::unary_function<CGAL::internal::In_place_list_iterator<T, Alloc>, std::size_t>  {
+
+    std::size_t operator()(const CGAL::internal::In_place_list_iterator<T, Alloc>& i) const
+    {
+      const T* ptr = &*i;
+      return reinterpret_cast<std::size_t>(ptr)/ sizeof(T);
+    }
+  };
+
+  template < class T, class Alloc >
+  struct hash<CGAL::internal::In_place_list_const_iterator<T, Alloc> >
+    : public std::unary_function<CGAL::internal::In_place_list_const_iterator<T, Alloc>, std::size_t> {
+
+    std::size_t operator()(const CGAL::internal::In_place_list_const_iterator<T, Alloc>& i) const
+    {
+      const T* ptr = &*i;
+      return reinterpret_cast<std::size_t>(ptr)/ sizeof(T);
+    }
+  };
+#endif // CGAL_CFG_NO_STD_HASH
+
+#if defined(BOOST_MSVC)
+#  pragma warning(pop)
+#endif
+
+} // namespace std
+
+#endif // CGAL_IN_PLACE_LIST_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Incremental_neighbor_search.h b/3rdparty/CGAL/include/CGAL/Incremental_neighbor_search.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Incremental_neighbor_search.h
rename to 3rdparty/CGAL/include/CGAL/Incremental_neighbor_search.h
diff --git a/3rdparty/CGAL/include/CGAL/Index_property_map.h b/3rdparty/CGAL/include/CGAL/Index_property_map.h
new file mode 100644
index 0000000..580d459
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Index_property_map.h
@@ -0,0 +1,162 @@
+// Copyright (c) 20009  INRIA Sophia-Antipolis (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(s)     : Laurent Saboret
+
+#ifndef CGAL_INDEX_PROPERTY_MAP_H
+#define CGAL_INDEX_PROPERTY_MAP_H
+
+#include <CGAL/property_map.h>
+#include <boost/shared_ptr.hpp>
+
+#include <iterator>
+#include <map>
+
+namespace CGAL {
+
+/// \cond SKIP_IN_MANUAL
+  
+// ----------------------------------------------------------------------------
+// Private section
+// ----------------------------------------------------------------------------
+namespace internal {
+
+/// Functor for operator< that compares iterators address.
+template <typename Iterator>
+struct Compare_iterator_address
+{
+  bool operator()(const Iterator& lhs, const Iterator& rhs) const
+  {
+    return (&*lhs < &*rhs);
+  }
+};
+
+
+} /* namespace internal */
+
+
+// ----------------------------------------------------------------------------
+// Public section
+// ----------------------------------------------------------------------------
+
+
+/// Template class "index" property map, which associates a 0-based index (unsigned int) 
+/// to the `[first, beyond)` range of elements.
+/// 
+/// 2 specializations exist:
+/// - if Iter is a random access iterator (typically vector and deque), 
+/// get() just calls std::distance() and is very efficient;
+/// - else, the property map allocates a std::map to store indices
+/// and get() requires a lookup in the map.
+///
+/// @heading Is Model for the Concepts:
+/// Model of the `ReadablePropertyMap` concept.
+///
+/// @heading Parameters:
+/// @param Iter iterator over input elements.
+/// @param iterator_tag Iter's iterator category.
+
+// This is the default variant that creates a temporary std::map<Iter,unsigned int>.
+template <class Iter,
+          typename iterator_tag=typename std::iterator_traits<Iter>::iterator_category>
+class Index_property_map 
+  : public boost::associative_property_map< std::map<Iter,
+                                                     unsigned int,
+                                                     internal::Compare_iterator_address<Iter> > >
+{
+  // std::map to store indices
+  typedef typename std::map<Iter,
+                            unsigned int,
+                            internal::Compare_iterator_address<Iter> >
+                                            Index_map;
+  // base class = property map
+  typedef typename boost::associative_property_map<Index_map>
+                                            Base;
+public:
+  Index_property_map(
+    Iter first,  ///< iterator over the first element (index 0)
+    Iter beyond) ///< past-the-end iterator over the elements
+    
+  : m_index_map(new Index_map)  // Allocate std::map
+  {
+    // Index elements in std::map
+    Iter it;
+    unsigned int index;
+    for (it = first, index = 0; it != beyond; it++, index++)
+      (*m_index_map)[it] = index;
+      
+    // Wrap std::map in property map
+    (Base&)(*this) = *m_index_map;
+  }
+
+private:
+  // Property maps must be lightweight classes => share std::map
+  boost::shared_ptr<Index_map> m_index_map;
+};
+
+/// @cond SKIP_IN_MANUAL
+// This variant is optimized for a random access container.
+template <class Iter> 
+class Index_property_map<Iter,
+                         std::random_access_iterator_tag>
+{
+public:
+  // Property maps' required types
+  typedef boost::readable_property_map_tag  category;
+  typedef std::size_t                       value_type;
+  typedef value_type                        reference;
+  typedef Iter                              key_type;
+
+  Index_property_map(
+    Iter first,  ///< iterator over the first element (index 0)
+    Iter /*beyond*/) ///< past-the-end iterator over the elements
+  : m_first(first)
+  {}
+
+  /// Free function to access the map elements.
+  friend inline
+  reference get(const Index_property_map& map, key_type p)
+  {
+    return std::distance(map.m_first, p);
+  }
+
+private:
+  Iter m_first; // iterator over the first element (index 0)
+};
+/// @endcond
+
+
+/// Free function to create an Index_property_map property map.
+///
+/// @tparam Iter iterator over input elements.
+///
+/// @return an "index" property map, which associates a 0-based index (unsigned int) 
+/// to the `[first, beyond)` range of elements.
+template <class Iter>
+Index_property_map<Iter>
+make_index_property_map(
+    Iter first,  ///< iterator over the first element (index 0)
+    Iter beyond) ///< past-the-end iterator over the elements
+{
+  return Index_property_map<Iter>(first, beyond);
+}
+
+/// \endcond
+
+} // namespace CGAL
+
+#endif // CGAL_INDEX_PROPERTY_MAP_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Interpolation_gradient_fitting_traits_2.h b/3rdparty/CGAL/include/CGAL/Interpolation_gradient_fitting_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Interpolation_gradient_fitting_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Interpolation_gradient_fitting_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Interpolation_traits_2.h b/3rdparty/CGAL/include/CGAL/Interpolation_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Interpolation_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Interpolation_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Intersection_traits.h b/3rdparty/CGAL/include/CGAL/Intersection_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Intersection_traits.h
rename to 3rdparty/CGAL/include/CGAL/Intersection_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Intersection_traits_2.h b/3rdparty/CGAL/include/CGAL/Intersection_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Intersection_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Intersection_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Intersection_traits_3.h b/3rdparty/CGAL/include/CGAL/Intersection_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Intersection_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/Intersection_traits_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Intersections_2/Triangle_2_Triangle_2_intersection_impl.h b/3rdparty/CGAL/include/CGAL/Intersections_2/Triangle_2_Triangle_2_intersection_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Intersections_2/Triangle_2_Triangle_2_intersection_impl.h
rename to 3rdparty/CGAL/include/CGAL/Intersections_2/Triangle_2_Triangle_2_intersection_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Intersections_3/intersection_3_1_impl.h b/3rdparty/CGAL/include/CGAL/Intersections_3/intersection_3_1_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Intersections_3/intersection_3_1_impl.h
rename to 3rdparty/CGAL/include/CGAL/Intersections_3/intersection_3_1_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Interval_arithmetic.h b/3rdparty/CGAL/include/CGAL/Interval_arithmetic.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Interval_arithmetic.h
rename to 3rdparty/CGAL/include/CGAL/Interval_arithmetic.h
diff --git a/3rdparty/CGAL/include/CGAL/Interval_arithmetic_impl.h b/3rdparty/CGAL/include/CGAL/Interval_arithmetic_impl.h
new file mode 100644
index 0000000..1cb6e68
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Interval_arithmetic_impl.h
@@ -0,0 +1,76 @@
+// Copyright (c) 1999-2004
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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(s)     : Sylvain Pion
+
+namespace CGAL {
+
+#ifdef CGAL_CFG_DENORMALS_COMPILE_BUG
+// For compilers which bug on denormalized values at compile time.
+// We generate CGAL_IA_MIN_DOUBLE at run time.
+namespace {
+double init_min_double()
+{
+    double d = 1;
+    double e = 1;
+    do {
+	d = e;
+	e = CGAL_IA_FORCE_TO_DOUBLE(e/2);
+    } while (e != 0);
+    return d;
+}
+} // anonymous namespace
+
+#ifndef CGAL_HEADER_ONLY
+
+namespace internal {
+  double minimin = init_min_double();
+  double& get_static_minimin()
+  {
+    return minimin;
+  }
+}
+
+#else // CGAL_HEADER_ONLY
+
+namespace internal {
+  double& get_static_minimin()
+  {
+    static double minimin = init_min_double();
+    return minimin;
+  }
+}
+#endif // CGAL_HEADER_ONLY
+
+#endif // CGAL_CFG_DENORMALS_COMPILE_BUG
+
+#ifndef CGAL_HEADER_ONLY
+
+#ifdef _MSC_VER
+namespace {
+int dummy_symbol_for_stopping_VC_linker_warning;
+} // namespace
+#endif
+
+#endif // CGAL_HEADER_ONLY
+
+} //namespace CGAL
diff --git a/3rdparty/CGAL/include/CGAL/Interval_nt.h b/3rdparty/CGAL/include/CGAL/Interval_nt.h
new file mode 100644
index 0000000..5dfa8b3
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Interval_nt.h
@@ -0,0 +1,1289 @@
+// Copyright (c) 1998-2005,2007  
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved. 
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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(s)     : Sylvain Pion, Michael Hemmer
+
+#ifndef CGAL_INTERVAL_NT_H
+#define CGAL_INTERVAL_NT_H
+
+// This file contains the description of the following classes:
+// - Interval_nt<false>  It's a number type that needs the FPU rounding mode
+//                       to be set to +inf.  It is also typedef'd to
+//                       Interval_nt_advanced for backward compatibility.
+// - Interval_nt<true>   Same but it does the rounding mode itself so you
+//                       don't have to worry about it.  But it's slower.
+//
+// Note: When rounding is towards +infinity, to make an operation rounded
+// towards -infinity, it's enough to take the opposite of some of the operand,
+// and the opposite of the result (see operator+, operator*,...).
+
+// TODO : 
+// - test whether stopping constant propagation only in functions taking
+//   double as arguments, improves performance.
+
+#include <utility> // for std::pair
+#include <CGAL/number_type_config.h>
+#include <CGAL/number_utils.h>
+#include <CGAL/utils_classes.h>
+#include <CGAL/number_utils.h>
+#include <CGAL/Uncertain.h>
+#include <CGAL/Interval_traits.h>
+#include <CGAL/double.h>
+#include <CGAL/FPU.h>
+#include <CGAL/IO/io.h>
+#include <iostream>
+
+namespace CGAL {
+
+template <bool Protected = true>
+class Interval_nt
+{
+  typedef Interval_nt<Protected>     IA;
+  typedef std::pair<double, double>  Pair;
+
+public:
+
+  typedef double      value_type;
+
+  typedef Uncertain_conversion_exception            unsafe_comparison;
+  typedef Checked_protect_FPU_rounding<Protected>   Internal_protector;
+  typedef Protect_FPU_rounding<!Protected>          Protector;
+
+  Interval_nt()
+#ifndef CGAL_NO_ASSERTIONS
+      : _inf(1), _sup(0)
+             // to early and deterministically detect use of uninitialized
+#endif
+    {}
+
+  Interval_nt(int i)
+    : _inf(i), _sup(i) {}
+
+  Interval_nt(unsigned i)
+    : _inf(i), _sup(i) {}
+
+  Interval_nt(long long i)
+    : _inf((double)i), _sup((double)i)
+  {
+    // gcc ignores -frounding-math when converting integers to floats.
+#ifdef __GNUC__
+    long long safe = 1LL << 52; // Use numeric_limits?
+    bool exact = ((long long)_inf == i) || (i <= safe && i >= -safe);
+    if (!(__builtin_constant_p(exact) && exact))
+#endif
+      *this += smallest();
+  }
+
+  Interval_nt(unsigned long long i)
+    : _inf((double)i), _sup((double)i)
+  {
+#ifdef __GNUC__
+    unsigned long long safe = 1ULL << 52; // Use numeric_limits?
+    bool exact = ((unsigned long long)_inf == i) || (i <= safe);
+    if (!(__builtin_constant_p(exact) && exact))
+#endif
+      *this += smallest();
+  }
+
+  Interval_nt(long i)
+  {
+    *this = (sizeof(int)==sizeof(long)) ?
+      Interval_nt((int)i) :
+      Interval_nt((long long)i);
+  }
+
+  Interval_nt(unsigned long i)
+  {
+    *this = (sizeof(int)==sizeof(long)) ?
+      Interval_nt((unsigned)i) :
+      Interval_nt((unsigned long long)i);
+  }
+
+  Interval_nt(double d)
+    : _inf(d), _sup(d) { CGAL_assertion(is_finite(d)); }
+
+// The Intel compiler on Linux is aggressive with constant propagation and
+// it seems there is no flag to stop it, so disable this check for it.
+#if !defined(CGAL_DISABLE_ROUNDING_MATH_CHECK) && \
+    defined(__INTEL_COMPILER) && defined(__linux)
+#  define CGAL_DISABLE_ROUNDING_MATH_CHECK
+#endif
+
+  Interval_nt(double i, double s)
+    : _inf(i), _sup(s)
+  {
+    // Previously it was:
+    //    CGAL_assertion_msg(!(i>s);
+    // But MSVC++ 2012 optimizes the test "!(i>s)" to "i<=s", even with
+    // /fp:strict. If 'i' or 's' is a NaN, that makes a difference.
+    CGAL_assertion_msg( (!is_valid(i)) || (!is_valid(s)) || (!(i>s)),
+	      " Variable used before being initialized (or CGAL bug)");
+#ifndef CGAL_DISABLE_ROUNDING_MATH_CHECK
+    CGAL_assertion_code((void) tester;) // Necessary to trigger a runtime test of rounding modes.
+#endif
+  }
+
+  Interval_nt(const Pair & p)
+    : _inf(p.first), _sup(p.second) {}
+
+  IA operator-() const { return IA (-sup(), -inf()); }
+
+  IA & operator+= (const IA &d) { return *this = *this + d; }
+  IA & operator-= (const IA &d) { return *this = *this - d; }
+  IA & operator*= (const IA &d) { return *this = *this * d; }
+  IA & operator/= (const IA &d) { return *this = *this / d; }
+
+  bool is_point() const
+  {
+    return sup() == inf();
+  }
+
+  bool is_same (const IA & d) const
+  {
+    return inf() == d.inf() && sup() == d.sup();
+  }
+
+  bool do_overlap (const IA & d) const
+  {
+    return !(d.inf() > sup() || d.sup() < inf());
+  }
+
+  const double & inf() const { return _inf; }
+  const double & sup() const { return _sup; }
+
+  std::pair<double, double> pair() const
+  {
+    return std::pair<double, double>(inf(), sup());
+  }
+
+  static IA largest()
+  {
+    return IA(-internal::infinity, internal::infinity);
+  }
+
+  static IA smallest()
+  {
+    return IA(-CGAL_IA_MIN_DOUBLE, CGAL_IA_MIN_DOUBLE);
+  }
+
+#if 0 // def CGAL_HISTOGRAM_PROFILER  // not yet ready
+  ~Interval_nt()
+  {
+    CGAL_HISTOGRAM_PROFILER("[Interval_nt relative precision in log2 scale]",
+                             (unsigned) ( ::log(relative_precision(*this))) / ::log(2.0) )  );
+  }
+#endif
+
+private:
+  // Pair inf_sup;
+  double _inf, _sup;
+
+  struct Test_runtime_rounding_modes {
+    Test_runtime_rounding_modes()
+    {
+      // We test whether GCC's -frounding-math option has been forgotten.
+      // The macros CGAL_IA_MUL and CGAL_IA_DIV stop constant propagation only
+      // on the second argument, so if -fno-rounding-math, the compiler optimizes
+      // the 2 negations and we get wrong rounding.
+      typename Interval_nt<>::Internal_protector P;
+      CGAL_assertion_msg(-CGAL_IA_MUL(-1.1, 10.1) != CGAL_IA_MUL(1.1, 10.1),
+                         "Wrong rounding: did you forget the  -frounding-math  option if you use GCC (or  -fp-model strict  for Intel)?");
+      CGAL_assertion_msg(-CGAL_IA_DIV(-1., 10) != CGAL_IA_DIV(1., 10),
+                         "Wrong rounding: did you forget the  -frounding-math  option if you use GCC (or  -fp-model strict  for Intel)?");
+    }
+  };
+
+#ifndef CGAL_DISABLE_ROUNDING_MATH_CHECK
+  static Test_runtime_rounding_modes tester;
+#endif
+};
+
+#ifndef CGAL_DISABLE_ROUNDING_MATH_CHECK
+template <bool Protected>
+typename Interval_nt<Protected>::Test_runtime_rounding_modes
+Interval_nt<Protected>::tester;
+#endif
+
+template <bool Protected>
+inline
+Uncertain<bool>
+operator<(const Interval_nt<Protected> &a, const Interval_nt<Protected> &b)
+{
+  if (a.sup()  < b.inf()) return true;
+  if (a.inf() >= b.sup()) return false;
+  return Uncertain<bool>::indeterminate();
+}
+
+template <bool Protected>
+inline
+Uncertain<bool>
+operator>(const Interval_nt<Protected> &a, const Interval_nt<Protected> &b)
+{ return b < a; }
+
+template <bool Protected>
+inline
+Uncertain<bool>
+operator<=(const Interval_nt<Protected> &a, const Interval_nt<Protected> &b)
+{
+  if (a.sup() <= b.inf()) return true;
+  if (a.inf() >  b.sup()) return false;
+  return Uncertain<bool>::indeterminate();
+}
+
+template <bool Protected>
+inline
+Uncertain<bool>
+operator>=(const Interval_nt<Protected> &a, const Interval_nt<Protected> &b)
+{ return b <= a; }
+
+template <bool Protected>
+inline
+Uncertain<bool>
+operator==(const Interval_nt<Protected> &a, const Interval_nt<Protected> &b)
+{
+  if (b.inf() >  a.sup() || b.sup() <  a.inf()) return false;
+  if (b.inf() == a.sup() && b.sup() == a.inf()) return true;
+  return Uncertain<bool>::indeterminate();
+}
+
+template <bool Protected>
+inline
+Uncertain<bool>
+operator!=(const Interval_nt<Protected> &a, const Interval_nt<Protected> &b)
+{ return ! (a == b); }
+
+
+// Mixed operators with double.
+
+template <bool Protected>
+inline
+Uncertain<bool>
+operator<(double a, const Interval_nt<Protected> &b)
+{
+  if (a < b.inf()) return true;
+  if (a >= b.sup()) return false;
+  return Uncertain<bool>::indeterminate();
+}
+
+template <bool Protected>
+inline
+Uncertain<bool>
+operator>(double a, const Interval_nt<Protected> &b)
+{ return b < a; }
+
+template <bool Protected>
+inline
+Uncertain<bool>
+operator<=(double a, const Interval_nt<Protected> &b)
+{
+  if (a <= b.inf()) return true;
+  if (a >  b.sup()) return false;
+  return Uncertain<bool>::indeterminate();
+}
+
+template <bool Protected>
+inline
+Uncertain<bool>
+operator>=(double a, const Interval_nt<Protected> &b)
+{ return b <= a; }
+
+template <bool Protected>
+inline
+Uncertain<bool>
+operator==(double a, const Interval_nt<Protected> &b)
+{
+  if (b.inf() >  a || b.sup() <  a) return false;
+  if (b.inf() == a && b.sup() == a) return true;
+  return Uncertain<bool>::indeterminate();
+}
+
+template <bool Protected>
+inline
+Uncertain<bool>
+operator!=(double a, const Interval_nt<Protected> &b)
+{ return ! (a == b); }
+
+template <bool Protected>
+inline
+Uncertain<bool>
+operator<(const Interval_nt<Protected> &a, double b)
+{
+  if (a.sup()  < b) return true;
+  if (a.inf() >= b) return false;
+  return Uncertain<bool>::indeterminate();
+}
+
+template <bool Protected>
+inline
+Uncertain<bool>
+operator>(const Interval_nt<Protected> &a, double b)
+{ return b < a; }
+
+template <bool Protected>
+inline
+Uncertain<bool>
+operator<=(const Interval_nt<Protected> &a, double b)
+{
+  if (a.sup() <= b) return true;
+  if (a.inf() >  b) return false;
+  return Uncertain<bool>::indeterminate();
+}
+
+template <bool Protected>
+inline
+Uncertain<bool>
+operator>=(const Interval_nt<Protected> &a, double b)
+{ return b <= a; }
+
+template <bool Protected>
+inline
+Uncertain<bool>
+operator==(const Interval_nt<Protected> &a, double b)
+{
+  if (b >  a.sup() || b <  a.inf()) return false;
+  if (b == a.sup() && b == a.inf()) return true;
+  return Uncertain<bool>::indeterminate();
+}
+
+template <bool Protected>
+inline
+Uncertain<bool>
+operator!=(const Interval_nt<Protected> &a, double b)
+{ return ! (a == b); }
+
+
+
+// Non-documented
+// Returns true if the interval is a unique representable double.
+template <bool Protected>
+inline
+bool
+fit_in_double (const Interval_nt<Protected> & d, double &r)
+{
+  bool b = d.is_point();
+  if (b)
+    r = d.inf();
+  return b;
+}
+
+// Non-documented
+template <bool Protected>
+inline
+bool
+is_singleton (const Interval_nt<Protected> & d)
+{
+  return d.is_point();
+}
+
+// Non-documented
+template <bool Protected>
+inline
+double
+magnitude (const Interval_nt<Protected> & d)
+{
+  return (std::max)(CGAL::abs(d.inf()), CGAL::abs(d.sup()));
+}
+
+// Non-documented
+template <bool Protected>
+inline
+double
+width (const Interval_nt<Protected> & d)
+{
+  return d.sup() - d.inf();
+}
+
+// Non-documented
+template <bool Protected>
+inline
+double
+radius (const Interval_nt<Protected> & d)
+{
+  return width(d)/2; // This could be improved to avoid overflow.
+}
+
+// Non-documented
+// This is the relative precision of to_double() (the center of the interval),
+// hence we use radius() instead of width().
+template <bool Protected>
+inline
+bool
+has_smaller_relative_precision(const Interval_nt<Protected> & d, double prec)
+{
+  return magnitude(d) == 0 || radius(d) < prec * magnitude(d);
+}
+
+// Non-documented
+template <bool Protected>
+double
+relative_precision(const Interval_nt<Protected> & d)
+{
+  if (magnitude(d) == 0.0)
+    return 0.0;
+  return radius(d) / magnitude(d);
+}
+
+
+template< bool Protected >
+class Is_valid< Interval_nt<Protected> >
+  : public std::unary_function< Interval_nt<Protected>, bool > {
+  public :
+    bool operator()( const Interval_nt<Protected>& x ) const {
+      return is_valid(x.inf()) &&
+             is_valid(x.sup()) &&
+             x.inf() <= x.sup();
+    }
+};
+
+template <bool Protected>
+std::ostream & operator<< (std::ostream &os, const Interval_nt<Protected> & I )
+{
+  return os << "[" << I.inf() << ";" << I.sup() << "]";
+}
+
+#define CGAL_SWALLOW(IS,CHAR)                           \
+    {                                                   \
+        char c;                                         \
+        do c = is.get(); while (isspace(c));            \
+        if (c != CHAR) {                                \
+            is.setstate(std::ios_base::failbit);        \
+        }                                               \
+    }                                                   \
+
+template <bool Protected>
+std::istream & operator>> (std::istream &is, Interval_nt<Protected> & I)
+{
+    char c;
+    do c = is.get(); while (isspace(c));
+    is.putback(c);
+    if(c == '['){ // read original output from operator <<
+        double inf,sup;
+        CGAL_SWALLOW(is, '[');// read the "["
+        is >> iformat(inf);
+        CGAL_SWALLOW(is, ';');// read the ";"
+        is >> iformat(sup);
+        CGAL_SWALLOW(is, ']');// read the "]"
+        I = Interval_nt<Protected>(inf,sup);
+    }else{ //read double (backward compatibility)
+        double d;
+        is >> d;
+        I = d;
+    }
+    return is;
+}
+#undef CGAL_SWALLOW
+
+typedef Interval_nt<false> Interval_nt_advanced;  // for backward-compatibility
+
+
+template <bool Protected>
+inline
+Interval_nt<Protected>
+operator+ (const Interval_nt<Protected> &a, const Interval_nt<Protected> & b)
+{
+  typename Interval_nt<Protected>::Internal_protector P;
+  return Interval_nt<Protected> (-CGAL_IA_SUB(-a.inf(), b.inf()),
+                                  CGAL_IA_ADD(a.sup(), b.sup()));
+}
+
+template <bool Protected>
+inline
+Interval_nt<Protected>
+operator+ (double a, const Interval_nt<Protected> & b)
+{
+  return Interval_nt<Protected>(a)+b;
+}
+
+template <bool Protected>
+inline
+Interval_nt<Protected>
+operator+ (const Interval_nt<Protected> & a, double b)
+{
+  return a+Interval_nt<Protected>(b);
+}
+
+template< bool Protected >
+inline
+Interval_nt<Protected>
+operator+( const Interval_nt<Protected>& a ) {
+  return a;
+}
+
+template <bool Protected>
+inline
+Interval_nt<Protected>
+operator- (const Interval_nt<Protected> &a, const Interval_nt<Protected> & b)
+{
+  typename Interval_nt<Protected>::Internal_protector P;
+  return Interval_nt<Protected>(-CGAL_IA_SUB(b.sup(), a.inf()),
+                                 CGAL_IA_SUB(a.sup(), b.inf()));
+}
+
+template <bool Protected>
+inline
+Interval_nt<Protected>
+operator- (double a, const Interval_nt<Protected> & b)
+{
+  return Interval_nt<Protected>(a)-b;
+}
+
+template <bool Protected>
+inline
+Interval_nt<Protected>
+operator- (const Interval_nt<Protected> & a, double b)
+{
+  return a-Interval_nt<Protected>(b);
+}
+
+template <bool Protected>
+inline
+Interval_nt<Protected>
+operator* (const Interval_nt<Protected> &a, const Interval_nt<Protected> & b)
+{
+  typedef Interval_nt<Protected> IA;
+  typename Interval_nt<Protected>::Internal_protector P;
+  if (a.inf() >= 0.0)					// a>=0
+  {
+    // b>=0     [a.inf()*b.inf(); a.sup()*b.sup()]
+    // b<=0     [a.sup()*b.inf(); a.inf()*b.sup()]
+    // b~=0     [a.sup()*b.inf(); a.sup()*b.sup()]
+    double aa = a.inf(), bb = a.sup();
+    if (b.inf() < 0.0)
+    {
+	aa = bb;
+	if (b.sup() < 0.0)
+	    bb = a.inf();
+    }
+    return IA(-CGAL_IA_MUL(aa, -b.inf()), CGAL_IA_MUL(bb, b.sup()));
+  }
+  else if (a.sup()<=0.0)				// a<=0
+  {
+    // b>=0     [a.inf()*b.sup(); a.sup()*b.inf()]
+    // b<=0     [a.sup()*b.sup(); a.inf()*b.inf()]
+    // b~=0     [a.inf()*b.sup(); a.inf()*b.inf()]
+    double aa = a.sup(), bb = a.inf();
+    if (b.inf() < 0.0)
+    {
+	aa=bb;
+	if (b.sup() < 0.0)
+	    bb=a.sup();
+    }
+    return IA(-CGAL_IA_MUL(bb, -b.sup()), CGAL_IA_MUL(aa, b.inf()));
+  }
+  else						// 0 \in a
+  {
+    if (b.inf()>=0.0)				// b>=0
+      return IA(-CGAL_IA_MUL(a.inf(), -b.sup()),
+                 CGAL_IA_MUL(a.sup(), b.sup()));
+    if (b.sup()<=0.0)				// b<=0
+      return IA(-CGAL_IA_MUL(a.sup(), -b.inf()),
+                 CGAL_IA_MUL(a.inf(), b.inf()));
+        					// 0 \in b
+    double tmp1 = CGAL_IA_MUL(a.inf(), -b.sup());
+    double tmp2 = CGAL_IA_MUL(a.sup(), -b.inf());
+    double tmp3 = CGAL_IA_MUL(a.inf(),  b.inf());
+    double tmp4 = CGAL_IA_MUL(a.sup(),  b.sup());
+    return IA(-(std::max)(tmp1,tmp2), (std::max)(tmp3,tmp4));
+  }
+}
+
+template <bool Protected>
+inline
+Interval_nt<Protected>
+operator* (double a, const Interval_nt<Protected> & b)
+{
+  return Interval_nt<Protected>(a)*b;
+}
+
+template <bool Protected>
+inline
+Interval_nt<Protected>
+operator* (const Interval_nt<Protected> & a, double b)
+{
+  return a*Interval_nt<Protected>(b);
+}
+
+template <bool Protected>
+inline
+Interval_nt<Protected>
+operator/ (const Interval_nt<Protected> &a, const Interval_nt<Protected> & b)
+{
+  typedef Interval_nt<Protected> IA;
+  typename Interval_nt<Protected>::Internal_protector P;
+  if (b.inf() > 0.0)				// b>0
+  {
+    // e>=0	[a.inf()/b.sup(); a.sup()/b.inf()]
+    // e<=0	[a.inf()/b.inf(); a.sup()/b.sup()]
+    // e~=0	[a.inf()/b.inf(); a.sup()/b.inf()]
+    double aa = b.sup(), bb = b.inf();
+    if (a.inf() < 0.0)
+    {
+	aa = bb;
+	if (a.sup() < 0.0)
+	    bb = b.sup();
+    }
+    return IA(-CGAL_IA_DIV(a.inf(), -aa), CGAL_IA_DIV(a.sup(), bb));
+  }
+  else if (b.sup()<0.0)			// b<0
+  {
+    // e>=0	[a.sup()/b.sup(); a.inf()/b.inf()]
+    // e<=0	[a.sup()/b.inf(); a.inf()/b.sup()]
+    // e~=0	[a.sup()/b.sup(); a.inf()/b.sup()]
+    double aa = b.sup(), bb = b.inf();
+    if (a.inf() < 0.0)
+    {
+	bb = aa;
+	if (a.sup() < 0.0)
+	    aa = b.inf();
+    }
+    return IA(-CGAL_IA_DIV(a.sup(), -aa), CGAL_IA_DIV(a.inf(), bb));
+  }
+  else					// b~0
+    return IA::largest();
+	   // We could do slightly better -> [0;infinity] when b.sup()==0,
+	   // but is this worth ?
+}
+
+template <bool Protected>
+inline
+Interval_nt<Protected>
+operator/ (double a, const Interval_nt<Protected> & b)
+{
+  return Interval_nt<Protected>(a)/b;
+}
+
+template <bool Protected>
+inline
+Interval_nt<Protected>
+operator/ (const Interval_nt<Protected> & a, double b)
+{
+  return a/Interval_nt<Protected>(b);
+}
+
+// TODO: What about these two guys? Where do they belong to?
+template <bool Protected>
+struct Min <Interval_nt<Protected> >
+    : public std::binary_function<Interval_nt<Protected>,
+                             Interval_nt<Protected>,
+                             Interval_nt<Protected> >
+{
+    Interval_nt<Protected> operator()( const Interval_nt<Protected>& d,
+                                       const Interval_nt<Protected>& e) const
+    {
+        return Interval_nt<Protected>(
+                (std::min)(d.inf(), e.inf()),
+                (std::min)(d.sup(), e.sup()));
+    }
+};
+
+template <bool Protected>
+struct Max <Interval_nt<Protected> >
+    : public std::binary_function<Interval_nt<Protected>,
+                             Interval_nt<Protected>,
+                             Interval_nt<Protected> >
+{
+    Interval_nt<Protected> operator()( const Interval_nt<Protected>& d,
+                                       const Interval_nt<Protected>& e) const
+    {
+        return Interval_nt<Protected>(
+                (std::max)(d.inf(), e.inf()),
+                (std::max)(d.sup(), e.sup()));
+    }
+};
+
+template<bool Protected> inline 
+Interval_nt<Protected> min BOOST_PREVENT_MACRO_SUBSTITUTION(
+const Interval_nt<Protected> & x,
+const Interval_nt<Protected> & y){
+  return CGAL::Min<Interval_nt<Protected> > ()(x,y);
+}
+template<bool Protected> inline 
+Interval_nt<Protected> max BOOST_PREVENT_MACRO_SUBSTITUTION(
+const Interval_nt<Protected> & x,
+const Interval_nt<Protected> & y){
+  return CGAL::Max<Interval_nt<Protected> > ()(x,y);
+}
+
+
+
+// TODO : document, when we are OK with the interface.
+// - should it allow other number types for the exponent ?
+template < bool b >
+Interval_nt<b>
+ldexp(const Interval_nt<b> &i, int e)
+{
+  double scale = std::ldexp(1.0, e);
+  Interval_nt<b> scale_interval (
+                      CGAL_NTS is_finite(scale) ? scale : CGAL_IA_MAX_DOUBLE,
+                      scale == 0 ? CGAL_IA_MIN_DOUBLE : scale);
+  return i * scale_interval;
+}
+
+
+// We also specialize some corresponding functors returning Uncertain<>.
+
+// TODO: To which concept do these functors belong? Can we remove them??
+template < bool b >
+struct Equal_to < Interval_nt<b>, Interval_nt<b> >
+  : public std::binary_function< Interval_nt<b>, Interval_nt<b>, Uncertain<bool> >
+{
+  Uncertain<bool> operator()( const Interval_nt<b>& x,
+                              const Interval_nt<b>& y) const
+  { return x == y; }
+};
+
+template < bool b >
+struct Not_equal_to < Interval_nt<b>, Interval_nt<b> >
+  : public std::binary_function< Interval_nt<b>, Interval_nt<b>, Uncertain<bool> >
+{
+  Uncertain<bool> operator()( const Interval_nt<b>& x,
+                              const Interval_nt<b>& y) const
+  { return x != y; }
+};
+
+template < bool b >
+struct Greater < Interval_nt<b>, Interval_nt<b> >
+  : public std::binary_function< Interval_nt<b>, Interval_nt<b>, Uncertain<bool> >
+{
+  Uncertain<bool> operator()( const Interval_nt<b>& x,
+                              const Interval_nt<b>& y) const
+  { return x > y; }
+};
+
+template < bool b >
+struct Less < Interval_nt<b>, Interval_nt<b> >
+  : public std::binary_function< Interval_nt<b>, Interval_nt<b>, Uncertain<bool> >
+{
+  Uncertain<bool> operator()( const Interval_nt<b>& x,
+                              const Interval_nt<b>& y) const
+  { return x < y; }
+};
+
+template < bool b >
+struct Greater_equal < Interval_nt<b>, Interval_nt<b> >
+  : public std::binary_function< Interval_nt<b>, Interval_nt<b>, Uncertain<bool> >
+{
+  Uncertain<bool> operator()( const Interval_nt<b>& x,
+                              const Interval_nt<b>& y) const
+  { return x >= y; }
+};
+
+template < bool b >
+struct Less_equal < Interval_nt<b>, Interval_nt<b> >
+  : public std::binary_function< Interval_nt<b>, Interval_nt<b>, Uncertain<bool> >
+{
+  Uncertain<bool> operator()( const Interval_nt<b>& x,
+                              const Interval_nt<b>& y) const
+  { return x <= y; }
+};
+
+
+// As in MP_float.h, the namespace INTERN_INTERVAL_NT contains (now) global
+// functions like square or sqrt which would have collided with the new
+// global functions from AST/RET
+//
+// TODO: IMHO, a better solution would be to put the INTERN_MP_FLOAT-functions
+//       into the MP_Float-class... But there is surely a reason why this is not
+//       the case..?
+
+
+namespace INTERN_INTERVAL_NT {
+
+  template <bool Protected>
+  inline
+  double
+  to_double (const Interval_nt<Protected> & d)
+  {
+    return (d.sup() + d.inf()) * 0.5;
+    // This may overflow...
+  }
+
+  template <bool Protected>
+  inline
+  std::pair<double, double>
+  to_interval (const Interval_nt<Protected> & d)
+  {
+    return d.pair();
+  }
+
+  template <bool Protected>
+  inline
+  Interval_nt<Protected>
+  sqrt (const Interval_nt<Protected> & d)
+  {
+    typename Interval_nt<Protected>::Internal_protector P;  // not optimal here.
+    // sqrt([+a,+b]) => [sqrt(+a);sqrt(+b)]
+    // sqrt([-a,+b]) => [0;sqrt(+b)] => assumes roundoff error.
+    // sqrt([-a,-b]) => [0;sqrt(-b)] => assumes user bug (unspecified result).
+    FPU_set_cw(CGAL_FE_DOWNWARD);
+    double i = (d.inf() > 0.0) ? CGAL_IA_SQRT(d.inf()) : 0.0;
+    FPU_set_cw(CGAL_FE_UPWARD);
+    return Interval_nt<Protected>(i, CGAL_IA_SQRT(d.sup()));
+  }
+
+  template <bool Protected>
+  inline
+  Interval_nt<Protected>
+  square (const Interval_nt<Protected> & d)
+  {
+    typename Interval_nt<Protected>::Internal_protector P;
+    if (d.inf()>=0.0)
+        return Interval_nt<Protected>(-CGAL_IA_MUL(d.inf(), -d.inf()),
+                                 CGAL_IA_MUL(d.sup(), d.sup()));
+    if (d.sup()<=0.0)
+        return Interval_nt<Protected>(-CGAL_IA_MUL(d.sup(), -d.sup()),
+                               CGAL_IA_MUL(d.inf(), d.inf()));
+    return Interval_nt<Protected>(0.0, CGAL_IA_SQUARE((std::max)(-d.inf(),
+                     d.sup())));
+  }
+
+  template <bool Protected>
+  inline
+  Interval_nt<Protected>
+  abs (const Interval_nt<Protected> & d)
+  {
+    if (d.inf() >= 0.0) return d;
+    if (d.sup() <= 0.0) return -d;
+    return Interval_nt<Protected>(0.0, (std::max)(-d.inf(), d.sup()));
+  }
+
+  template <bool Protected>
+  inline
+  Uncertain<Sign>
+  sign (const Interval_nt<Protected> & d)
+  {
+    if (d.inf() > 0.0) return POSITIVE;
+    if (d.sup() < 0.0) return NEGATIVE;
+    if (d.inf() == d.sup()) return ZERO;
+    return Uncertain<Sign>::indeterminate();
+  }
+
+  template <bool Protected>
+  inline
+  Uncertain<Comparison_result>
+  compare (const Interval_nt<Protected> & d, const Interval_nt<Protected> & e)
+  {
+    if (d.inf() > e.sup()) return LARGER;
+    if (e.inf() > d.sup()) return SMALLER;
+    if (e.inf() == d.sup() && d.inf() == e.sup()) return EQUAL;
+    return Uncertain<Comparison_result>::indeterminate();
+  }
+
+  template <bool Protected>
+  inline
+  Uncertain<bool>
+  is_zero (const Interval_nt<Protected> & d)
+  {
+    if (d.inf() > 0.0) return false;
+    if (d.sup() < 0.0) return false;
+    if (d.inf() == d.sup()) return true;
+    return Uncertain<bool>::indeterminate();
+  }
+
+  template <bool Protected>
+  inline
+  Uncertain<bool>
+  is_one (const Interval_nt<Protected> & d)
+  {
+    if (d.inf() > 1) return false;
+    if (d.sup() < 1) return false;
+    if (d.inf() == d.sup()) return true;
+    return Uncertain<bool>::indeterminate();
+  }
+
+  template <bool Protected>
+  inline
+  Uncertain<bool>
+  is_positive (const Interval_nt<Protected> & d)
+  {
+    if (d.inf() > 0.0) return true;
+    if (d.sup() <= 0.0) return false;
+    return Uncertain<bool>::indeterminate();
+  }
+
+  template <bool Protected>
+  inline
+  Uncertain<bool>
+  is_negative (const Interval_nt<Protected> & d)
+  {
+    if (d.inf() >= 0.0) return false;
+    if (d.sup() < 0.0) return true;
+    return Uncertain<bool>::indeterminate();
+  }
+
+ // TODO: Whats this for? Why is this in this file??
+  inline
+  std::pair<double, double>
+  to_interval (const long & l)
+  {
+    if (sizeof(double) > sizeof(long)) {
+      // On 64bit platforms, a long doesn't fit exactly in a double.
+      // Well, a perfect fix would be to use std::numeric_limits<>, but...
+      Protect_FPU_rounding<true> P(CGAL_FE_TONEAREST);
+      Interval_nt<false> approx ((double) l);
+      FPU_set_cw(CGAL_FE_UPWARD);
+      approx += Interval_nt<false>::smallest();
+      return approx.pair();
+    }
+    else
+      return std::pair<double,double>(l,l);
+  }
+} // namespace INTERN_INTERVAL_NT
+
+
+template< bool B > class Real_embeddable_traits< Interval_nt<B> >
+  : public INTERN_RET::Real_embeddable_traits_base< Interval_nt<B> , CGAL::Tag_true> {
+  public:
+    typedef Interval_nt<B>  Type;
+  typedef Uncertain<CGAL::Sign> Sign;
+  typedef Uncertain<bool> Boolean;
+  typedef Uncertain<CGAL::Comparison_result> Comparison_result; 
+
+    class Abs
+      : public std::unary_function< Type, Type > {
+      public:
+        Type operator()( const Type& x ) const {
+            return INTERN_INTERVAL_NT::abs( x );
+        }
+    };
+
+    class Sgn
+        : public std::unary_function< Type, Uncertain< ::CGAL::Sign > > {
+      public:
+        Uncertain< ::CGAL::Sign > operator()( const Type& x ) const {
+            return INTERN_INTERVAL_NT::sign( x );
+        }
+    };
+
+    class Is_positive
+      : public std::unary_function< Type, Uncertain<bool> > {
+      public:
+        Uncertain<bool> operator()( const Type& x ) const {
+          return INTERN_INTERVAL_NT::is_positive( x );
+        }
+    };
+
+    class Is_negative
+      : public std::unary_function< Type, Uncertain<bool> > {
+      public:
+        Uncertain<bool> operator()( const Type& x ) const {
+          return INTERN_INTERVAL_NT::is_negative( x );
+        }
+    };
+
+    class Compare
+      : public std::binary_function< Type, Type, Comparison_result > {
+      public:
+      Comparison_result operator()( const Type& x, const Type& y ) const {
+        return INTERN_INTERVAL_NT::compare( x, y );
+      }
+      CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT( Type,
+          Comparison_result )
+    };
+
+    class To_double
+      : public std::unary_function< Type, double > {
+      public:
+        double operator()( const Type& x ) const {
+            return INTERN_INTERVAL_NT::to_double( x );
+        }
+    };
+
+    class To_interval
+      : public std::unary_function< Type, std::pair< double, double > > {
+      public:
+        std::pair<double, double> operator()( const Type& x ) const {
+            return INTERN_INTERVAL_NT::to_interval( x );
+        }
+    };
+
+    class Is_finite
+      : public std::unary_function< Type, Boolean > {
+      public :
+        Boolean operator()( const Type& x ) const {
+          return CGAL_NTS is_finite( x.inf() ) && CGAL_NTS is_finite( x.sup() );
+        }
+    };
+
+};
+
+// Algebraic structure traits
+template< bool B >
+class Algebraic_structure_traits< Interval_nt<B> >
+  : public Algebraic_structure_traits_base< Interval_nt<B>,
+                                            Field_with_sqrt_tag >  {
+  public:
+    typedef Interval_nt<B>      Type;
+    typedef Tag_false           Is_exact;
+    typedef Tag_true            Is_numerical_sensitive;
+    typedef Uncertain<bool>     Boolean; 
+
+    class Is_zero
+      : public std::unary_function< Type, Boolean > {
+      public:
+        Boolean operator()( const Type& x ) const {
+          return INTERN_INTERVAL_NT::is_zero( x );
+        }
+    };
+
+    class Is_one
+      : public std::unary_function< Type, Boolean > {
+      public:
+        Boolean operator()( const Type& x ) const {
+          return INTERN_INTERVAL_NT::is_one( x );
+        }
+    };
+
+    class Square
+      : public std::unary_function< Type, Type > {
+      public:
+        Type operator()( const Type& x ) const {
+          return INTERN_INTERVAL_NT::square( x );
+        }
+    };
+
+    class Sqrt
+      : public std::unary_function< Type, Type > {
+      public:
+        Type operator()( const Type& x ) const {
+          return INTERN_INTERVAL_NT::sqrt( x );
+        }
+    };
+
+    struct Is_square
+        :public std::binary_function<Interval_nt<B>,Interval_nt<B>&,Boolean >
+    {
+        Boolean operator()(const Interval_nt<B>& x) const {
+            return INTERN_INTERVAL_NT::is_positive( x );
+        }
+
+        Boolean operator()(
+                const Interval_nt<B>& x,
+                Interval_nt<B>      & result) const {
+            Boolean is_positive = INTERN_INTERVAL_NT::is_positive( x );
+            if ( is_positive.inf() == true ){
+                typename Algebraic_structure_traits<Interval_nt<B> >::Sqrt sqrt;
+                result = sqrt(x);
+            }else{
+                typename Real_embeddable_traits<Interval_nt<B> >::Abs  abs;
+                typename Algebraic_structure_traits<Interval_nt<B> >::Sqrt sqrt;
+                result = sqrt(abs(x));
+            }
+            return is_positive;
+        }
+    };
+
+  class Divides
+    : public std::binary_function< Type, Type, Boolean > { 
+  public:
+    Boolean operator()( const Type& x, const Type&) const {
+      return ! Is_zero()(x);
+    } 
+    // second operator computing q
+    Boolean operator()( const Type& x, const Type& y, Type& q) const {
+      if (! Is_zero()(x) )
+        q  = y/x ;
+      return Boolean(true);
+    }
+  };
+  
+};
+
+
+// COERCION_TRAITS BEGIN
+template < class A, class B , int > struct Coercion_traits_for_level;
+template < class A, class B, class C> struct Coercion_traits_interval_nt;
+
+template<class A ,bool P >
+struct Coercion_traits_for_level<A,Interval_nt<P>,CTL_INTERVAL>
+    :public Coercion_traits_interval_nt<A,Interval_nt<P>,
+            typename Real_embeddable_traits<A>::Is_real_embeddable>{};
+
+template<class A , bool P>
+struct Coercion_traits_for_level<Interval_nt<P>,A,CTL_INTERVAL>
+    :public Coercion_traits_for_level<A,Interval_nt<P>, CTL_INTERVAL>{};
+
+template<class A , bool P >
+struct Coercion_traits_interval_nt<A, Interval_nt<P>,Tag_false>
+    :public Coercion_traits_for_level<A,Interval_nt<P>,0>{};
+
+template<class A , bool P>
+struct Coercion_traits_interval_nt<A, Interval_nt<P>, Tag_true>{
+    typedef Tag_true Are_explicit_interoperable;
+    typedef Tag_false Are_implicit_interoperable;
+    typedef Interval_nt<P> Type;
+    struct Cast {
+        typedef Interval_nt<P> result_type;
+        Interval_nt<P> inline operator()(const Interval_nt<P>& x ) const {
+            return x;
+        }
+        Interval_nt<P> inline operator()(const A& x ) const {
+            return typename Real_embeddable_traits<A>::To_interval()(x);
+        }
+    };
+};
+
+// COERCION_TRAITS END
+
+template< bool B >
+class Interval_traits< Interval_nt<B> >
+  : public internal::Interval_traits_base< Interval_nt<B> >  {
+public: 
+  typedef Interval_traits<Interval_nt<B> > Self; 
+  typedef Interval_nt<B> Interval; 
+  typedef double Bound; 
+  typedef CGAL::Tag_false With_empty_interval; 
+  typedef CGAL::Tag_true  Is_interval; 
+
+ struct Construct :public std::binary_function<Bound,Bound,Interval>{
+    Interval operator()( const Bound& l,const Bound& r) const {
+      CGAL_precondition( l < r ); 
+      return Interval(l,r);
+    }
+  };
+
+  struct Lower :public std::unary_function<Interval,Bound>{
+    Bound operator()( const Interval& a ) const {
+      return a.inf();
+    }
+  };
+
+  struct Upper :public std::unary_function<Interval,Bound>{
+    Bound operator()( const Interval& a ) const {
+      return a.sup();
+    }
+  };
+
+  struct Width :public std::unary_function<Interval,Bound>{
+    Bound operator()( const Interval& a ) const {
+      return width(a); 
+    }
+  };
+
+  struct Median :public std::unary_function<Interval,Bound>{
+    Bound operator()( const Interval& a ) const {
+      return (Lower()(a)+Upper()(a))/2.0;
+    }
+  };
+    
+  struct Norm :public std::unary_function<Interval,Bound>{
+    Bound operator()( const Interval& a ) const {
+      return magnitude(a);
+    }
+  };
+
+  struct Singleton :public std::unary_function<Interval,bool>{
+    bool operator()( const Interval& a ) const {
+      return Lower()(a) == Upper()(a);
+    }
+  };
+
+  struct Zero_in :public std::unary_function<Interval,bool>{
+    bool operator()( const Interval& a ) const {
+      return Lower()(a) <= 0  &&  0 <= Upper()(a);
+    }
+  };
+
+  struct In :public std::binary_function<Bound,Interval,bool>{
+    bool operator()( Bound x, const Interval& a ) const {
+      return Lower()(a) <= x && x <= Upper()(a);
+    }
+  };
+
+  struct Equal :public std::binary_function<Interval,Interval,bool>{
+    bool operator()( const Interval& a, const Interval& b ) const {
+      return a.is_same(b);
+    }
+  };
+    
+  struct Overlap :public std::binary_function<Interval,Interval,bool>{
+    bool operator()( const Interval& a, const Interval& b ) const {
+      return a.do_overlap(b);
+    }
+  };
+    
+  struct Subset :public std::binary_function<Interval,Interval,bool>{
+    bool operator()( const Interval& a, const Interval& b ) const {
+      return Lower()(b) <= Lower()(a) && Upper()(a) <= Upper()(b) ;  
+    }
+  };
+    
+  struct Proper_subset :public std::binary_function<Interval,Interval,bool>{
+    bool operator()( const Interval& a, const Interval& b ) const {
+      return Subset()(a,b) && ! Equal()(a,b); 
+    }
+  };
+    
+  struct Hull :public std::binary_function<Interval,Interval,Interval>{
+    Interval operator()( const Interval& a, const Interval& b ) const {
+      BOOST_USING_STD_MAX();
+      BOOST_USING_STD_MIN();
+      return Interval( 
+          std::make_pair(
+              min BOOST_PREVENT_MACRO_SUBSTITUTION (Lower()(a),b.inf()), 
+              max BOOST_PREVENT_MACRO_SUBSTITUTION (Upper()(a),b.sup())));
+    }
+  };
+    
+  
+//  struct Empty is Null_functor 
+  
+  struct Intersection :public std::binary_function<Interval,Interval,Interval>{
+    Interval operator()( const Interval& a, const Interval& b ) const {
+      BOOST_USING_STD_MAX();
+      BOOST_USING_STD_MIN();
+      Bound l(max BOOST_PREVENT_MACRO_SUBSTITUTION (Lower()(a),Lower()(b)));
+      Bound u(min BOOST_PREVENT_MACRO_SUBSTITUTION (Upper()(a),Upper()(b)));
+      if(u < l ) throw Exception_intersection_is_empty();
+      return Construct()(l,u);
+    }
+  };
+};
+
+} //namespace CGAL
+
+namespace Eigen {
+  template<class> struct NumTraits;
+  template<bool b> struct NumTraits<CGAL::Interval_nt<b> >
+  {
+    typedef CGAL::Interval_nt<b> Real;
+    typedef CGAL::Interval_nt<b> NonInteger;
+    typedef CGAL::Interval_nt<b> Nested;
+    typedef double Literal;
+
+    static inline Real epsilon() { return 0; }
+    static inline Real dummy_precision() { return 0; }
+
+    // Costs could depend on b.
+    enum {
+      IsInteger = 0,
+      IsSigned = 1,
+      IsComplex = 0,
+      RequireInitialization = 0,
+      ReadCost = 2,
+      AddCost = 2,
+      MulCost = 10
+    };
+  };
+}
+
+#endif // CGAL_INTERVAL_NT_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Interval_skip_list.h b/3rdparty/CGAL/include/CGAL/Interval_skip_list.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Interval_skip_list.h
rename to 3rdparty/CGAL/include/CGAL/Interval_skip_list.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Interval_skip_list_interval.h b/3rdparty/CGAL/include/CGAL/Interval_skip_list_interval.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Interval_skip_list_interval.h
rename to 3rdparty/CGAL/include/CGAL/Interval_skip_list_interval.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Interval_traits.h b/3rdparty/CGAL/include/CGAL/Interval_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Interval_traits.h
rename to 3rdparty/CGAL/include/CGAL/Interval_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Inverse_index.h b/3rdparty/CGAL/include/CGAL/Inverse_index.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Inverse_index.h
rename to 3rdparty/CGAL/include/CGAL/Inverse_index.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Is_a_predicate.h b/3rdparty/CGAL/include/CGAL/Is_a_predicate.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Is_a_predicate.h
rename to 3rdparty/CGAL/include/CGAL/Is_a_predicate.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Is_extended_kernel.h b/3rdparty/CGAL/include/CGAL/Is_extended_kernel.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Is_extended_kernel.h
rename to 3rdparty/CGAL/include/CGAL/Is_extended_kernel.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Iso_cuboid_3.h b/3rdparty/CGAL/include/CGAL/Iso_cuboid_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Iso_cuboid_3.h
rename to 3rdparty/CGAL/include/CGAL/Iso_cuboid_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Iso_rectangle_2.h b/3rdparty/CGAL/include/CGAL/Iso_rectangle_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Iso_rectangle_2.h
rename to 3rdparty/CGAL/include/CGAL/Iso_rectangle_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Iso_rectangle_2_Iso_rectangle_2_intersection.h b/3rdparty/CGAL/include/CGAL/Iso_rectangle_2_Iso_rectangle_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Iso_rectangle_2_Iso_rectangle_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Iso_rectangle_2_Iso_rectangle_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Iso_rectangle_2_Line_2_intersection.h b/3rdparty/CGAL/include/CGAL/Iso_rectangle_2_Line_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Iso_rectangle_2_Line_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Iso_rectangle_2_Line_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Iso_rectangle_2_Point_2_intersection.h b/3rdparty/CGAL/include/CGAL/Iso_rectangle_2_Point_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Iso_rectangle_2_Point_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Iso_rectangle_2_Point_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Iso_rectangle_2_Ray_2_intersection.h b/3rdparty/CGAL/include/CGAL/Iso_rectangle_2_Ray_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Iso_rectangle_2_Ray_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Iso_rectangle_2_Ray_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Iso_rectangle_2_Segment_2_intersection.h b/3rdparty/CGAL/include/CGAL/Iso_rectangle_2_Segment_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Iso_rectangle_2_Segment_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Iso_rectangle_2_Segment_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Iso_rectangle_d.h b/3rdparty/CGAL/include/CGAL/Iso_rectangle_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Iso_rectangle_d.h
rename to 3rdparty/CGAL/include/CGAL/Iso_rectangle_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Iterator_project.h b/3rdparty/CGAL/include/CGAL/Iterator_project.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Iterator_project.h
rename to 3rdparty/CGAL/include/CGAL/Iterator_project.h
diff --git a/3rdparty/CGAL/include/CGAL/Iterator_range.h b/3rdparty/CGAL/include/CGAL/Iterator_range.h
new file mode 100644
index 0000000..338b0b4
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Iterator_range.h
@@ -0,0 +1,115 @@
+// Copyright (c) 2014  GeometryFactory (France).  All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Andreas Fabri
+
+#ifndef CGAL_ITERATOR_RANGE_H
+#define CGAL_ITERATOR_RANGE_H
+
+#include <CGAL/tuple.h>
+#include <utility>
+#include <boost/foreach.hpp>
+
+namespace CGAL {
+
+  /*!
+\ingroup PkgStlExtension
+  /// `CGAL::Iterator_range` is a...
+  */
+  template <typename I>
+  class Iterator_range
+    : public std::pair<I,I>{
+    
+    typedef std::pair<I,I> Base;
+
+  public:
+
+    typedef I iterator;
+    typedef I const_iterator;
+
+    Iterator_range(I b, I e)
+      : Base(b,e)
+    {}
+
+
+    // Iterator_range(const Iterator_range& ip)
+    //   : Base(ip)
+    // {}
+
+    Iterator_range(const std::pair<I,I>& ip)
+      : Base(ip)
+    {}
+
+  I begin() const
+  {
+    return this->first;
+  }
+
+  I end() const
+  {
+    return this->second;
+  }
+
+  /// returns `std::distance(begin(), end())`
+  typename std::iterator_traits<I>::difference_type
+  size() const
+  {
+    return std::distance(begin(), end());
+  }
+
+  /// returns `std::distance(begin(), end())==0`
+  bool empty() const
+  {
+    return begin()==end();
+  }
+
+};
+
+  template <typename T>
+  Iterator_range<T>
+  make_range(const T& b, const T&e)
+  {
+    return Iterator_range<T>(b,e);
+  }
+
+  template <typename T>
+  Iterator_range<T>
+  make_range(const std::pair<T,T>& p)
+  {
+    return Iterator_range<T>(p.first,p.second);
+  }
+
+
+} // namespace CGAL
+
+// At global scope...
+
+  template<typename T>
+inline boost::mpl::true_ *
+  boost_foreach_is_lightweight_proxy( CGAL::Iterator_range<T> *&, boost::foreach::tag )
+{
+    return 0;
+}
+namespace boost { namespace foreach
+{
+    template<typename T>
+    struct is_lightweight_proxy< CGAL::Iterator_range<T> >
+      : mpl::true_
+    {
+    };
+}}
+#endif // CGAL_ITERATOR_RANGE_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Iterator_transform.h b/3rdparty/CGAL/include/CGAL/Iterator_transform.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Iterator_transform.h
rename to 3rdparty/CGAL/include/CGAL/Iterator_transform.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Join_input_iterator.h b/3rdparty/CGAL/include/CGAL/Join_input_iterator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Join_input_iterator.h
rename to 3rdparty/CGAL/include/CGAL/Join_input_iterator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/K_neighbor_search.h b/3rdparty/CGAL/include/CGAL/K_neighbor_search.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/K_neighbor_search.h
rename to 3rdparty/CGAL/include/CGAL/K_neighbor_search.h
diff --git a/3rdparty/CGAL/include/CGAL/Kd_tree.h b/3rdparty/CGAL/include/CGAL/Kd_tree.h
new file mode 100644
index 0000000..57c4b54
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Kd_tree.h
@@ -0,0 +1,472 @@
+// Copyright (c) 2002,2011,2014 Utrecht University (The Netherlands), Max-Planck-Institute Saarbruecken (Germany).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Hans Tangelder (<hanst at cs.uu.nl>),
+//               : Waqar Khan <wkhan at mpi-inf.mpg.de>
+
+#ifndef CGAL_KD_TREE_H
+#define CGAL_KD_TREE_H
+
+#include <CGAL/basic.h>
+#include <CGAL/assertions.h>
+#include <vector>
+
+#include <CGAL/algorithm.h>
+#include <CGAL/Kd_tree_node.h>
+#include <CGAL/Splitters.h>
+#include <CGAL/internal/Get_dimension_tag.h>
+
+#include <deque>
+#include <boost/container/deque.hpp>
+#include <boost/optional.hpp>
+
+#ifdef CGAL_HAS_THREADS
+#include <CGAL/mutex.h>
+#endif
+
+namespace CGAL {
+
+//template <class SearchTraits, class Splitter_=Median_of_rectangle<SearchTraits>, class UseExtendedNode = Tag_true >
+template <class SearchTraits, class Splitter_=Sliding_midpoint<SearchTraits>, class UseExtendedNode = Tag_true >
+class Kd_tree {
+
+public:
+  typedef SearchTraits Traits;
+  typedef Splitter_ Splitter;
+  typedef typename SearchTraits::Point_d Point_d;
+  typedef typename Splitter::Container Point_container;
+
+  typedef typename SearchTraits::FT FT;
+  typedef Kd_tree_node<SearchTraits, Splitter, UseExtendedNode > Node;
+  typedef Kd_tree_leaf_node<SearchTraits, Splitter, UseExtendedNode > Leaf_node;
+  typedef Kd_tree_internal_node<SearchTraits, Splitter, UseExtendedNode > Internal_node;
+  typedef Kd_tree<SearchTraits, Splitter> Tree;
+  typedef Kd_tree<SearchTraits, Splitter,UseExtendedNode> Self;
+
+  typedef Node* Node_handle;
+  typedef const Node* Node_const_handle;
+  typedef Leaf_node* Leaf_node_handle;
+  typedef const Leaf_node* Leaf_node_const_handle;
+  typedef Internal_node* Internal_node_handle;
+  typedef const Internal_node* Internal_node_const_handle;
+  typedef typename std::vector<const Point_d*>::const_iterator Point_d_iterator;
+  typedef typename std::vector<const Point_d*>::const_iterator Point_d_const_iterator;
+  typedef typename Splitter::Separator Separator;
+  typedef typename std::vector<Point_d>::const_iterator iterator;
+  typedef typename std::vector<Point_d>::const_iterator const_iterator;
+
+  typedef typename std::vector<Point_d>::size_type size_type;
+
+  typedef typename internal::Get_dimension_tag<SearchTraits>::Dimension D;
+
+private:
+  SearchTraits traits_;
+  Splitter split;
+
+
+  // wokaround for https://svn.boost.org/trac/boost/ticket/9332
+#if   (_MSC_VER == 1800) && (BOOST_VERSION == 105500)
+  std::deque<Internal_node> internal_nodes;
+  std::deque<Leaf_node> leaf_nodes;
+#else
+  boost::container::deque<Internal_node> internal_nodes;
+  boost::container::deque<Leaf_node> leaf_nodes;
+#endif
+
+  Node_handle tree_root;
+
+  Kd_tree_rectangle<FT,D>* bbox;
+  std::vector<Point_d> pts;
+
+  // Instead of storing the points in arrays in the Kd_tree_node
+  // we put all the data in a vector in the Kd_tree.
+  // and we only store an iterator range in the Kd_tree_node.
+  //
+  std::vector<const Point_d*> data;
+
+
+  #ifdef CGAL_HAS_THREADS
+  mutable CGAL_MUTEX building_mutex;//mutex used to protect const calls inducing build()
+  #endif
+  bool built_;
+
+  // protected copy constructor
+  Kd_tree(const Tree& tree)
+    : traits_(tree.traits_),built_(tree.built_)
+  {};
+
+
+  // Instead of the recursive construction of the tree in the class Kd_tree_node
+  // we do this in the tree class. The advantage is that we then can optimize
+  // the allocation of the nodes.
+
+  // The leaf node
+  Node_handle
+  create_leaf_node(Point_container& c)
+  {
+    Leaf_node node(true , static_cast<unsigned int>(c.size()));
+    std::ptrdiff_t tmp = c.begin() - data.begin();
+    node.data = pts.begin() + tmp;
+
+    leaf_nodes.push_back(node);
+    Leaf_node_handle nh = &leaf_nodes.back();
+
+   
+    return nh;
+  }
+
+
+  // The internal node
+
+  Node_handle
+  create_internal_node(Point_container& c, const Tag_true&)
+  {
+    return create_internal_node_use_extension(c);
+  }
+
+  Node_handle
+  create_internal_node(Point_container& c, const Tag_false&)
+  {
+    return create_internal_node(c);
+  }
+
+
+
+  // TODO: Similiar to the leaf_init function above, a part of the code should be
+  //       moved to a the class Kd_tree_node.
+  //       It is not proper yet, but the goal was to see if there is
+  //       a potential performance gain through the Compact_container
+  Node_handle
+  create_internal_node_use_extension(Point_container& c)
+  {
+    Internal_node node(false);
+    internal_nodes.push_back(node);
+    Internal_node_handle nh = &internal_nodes.back();
+
+    Separator sep;
+    Point_container c_low(c.dimension(),traits_);
+    split(sep, c, c_low);
+    nh->set_separator(sep);
+
+    int cd  = nh->cutting_dimension();
+    if(!c_low.empty()){
+      nh->lower_low_val = c_low.tight_bounding_box().min_coord(cd);
+      nh->lower_high_val = c_low.tight_bounding_box().max_coord(cd);
+    }
+    else{
+      nh->lower_low_val = nh->cutting_value();
+      nh->lower_high_val = nh->cutting_value();
+    }
+    if(!c.empty()){
+      nh->upper_low_val = c.tight_bounding_box().min_coord(cd);
+      nh->upper_high_val = c.tight_bounding_box().max_coord(cd);
+    }
+    else{
+      nh->upper_low_val = nh->cutting_value();
+      nh->upper_high_val = nh->cutting_value();
+    }
+
+    CGAL_assertion(nh->cutting_value() >= nh->lower_low_val);
+    CGAL_assertion(nh->cutting_value() <= nh->upper_high_val);
+
+    if (c_low.size() > split.bucket_size()){
+      nh->lower_ch = create_internal_node_use_extension(c_low);
+    }else{
+      nh->lower_ch = create_leaf_node(c_low);
+    }
+    if (c.size() > split.bucket_size()){
+      nh->upper_ch = create_internal_node_use_extension(c);
+    }else{
+      nh->upper_ch = create_leaf_node(c);
+    }
+
+    
+    
+
+    return nh;
+  }
+
+
+  // Note also that I duplicated the code to get rid if the if's for
+  // the boolean use_extension which was constant over the construction
+  Node_handle
+  create_internal_node(Point_container& c)
+  {
+    Internal_node node(false);
+    internal_nodes.push_back(node);
+    Internal_node_handle nh = &internal_nodes.back();
+    Separator sep;
+
+    Point_container c_low(c.dimension(),traits_);
+    split(sep, c, c_low);
+    nh->set_separator(sep);
+
+    if (c_low.size() > split.bucket_size()){
+      nh->lower_ch = create_internal_node(c_low);
+    }else{
+      nh->lower_ch = create_leaf_node(c_low);
+    }
+    if (c.size() > split.bucket_size()){
+      nh->upper_ch = create_internal_node(c);
+    }else{
+      nh->upper_ch = create_leaf_node(c);
+    }
+
+   
+
+    return nh;
+  }
+
+
+
+public:
+
+  Kd_tree(Splitter s = Splitter(),const SearchTraits traits=SearchTraits())
+    : traits_(traits),split(s), built_(false)
+  {}
+
+  template <class InputIterator>
+  Kd_tree(InputIterator first, InputIterator beyond,
+	  Splitter s = Splitter(),const SearchTraits traits=SearchTraits())
+    : traits_(traits),split(s), built_(false)
+  {
+    pts.insert(pts.end(), first, beyond);
+  }
+
+  bool empty() const {
+    return pts.empty();
+  }
+
+  void
+  build()
+  {
+    const Point_d& p = *pts.begin();
+    typename SearchTraits::Construct_cartesian_const_iterator_d ccci=traits_.construct_cartesian_const_iterator_d_object();
+    int dim = static_cast<int>(std::distance(ccci(p), ccci(p,0)));
+
+    data.reserve(pts.size());
+    for(unsigned int i = 0; i < pts.size(); i++){
+      data.push_back(&pts[i]);
+    }
+    Point_container c(dim, data.begin(), data.end(),traits_);
+    bbox = new Kd_tree_rectangle<FT,D>(c.bounding_box());
+    if (c.size() <= split.bucket_size()){
+      tree_root = create_leaf_node(c);
+    }else {
+      tree_root = create_internal_node(c, UseExtendedNode());
+    }
+
+    //Reorder vector for spatial locality
+    std::vector<Point_d> ptstmp;
+    ptstmp.resize(pts.size());
+    for (std::size_t i = 0; i < pts.size(); ++i){
+      ptstmp[i] = *data[i];
+    }
+    for(std::size_t i = 0; i < leaf_nodes.size(); ++i){
+      std::ptrdiff_t tmp = leaf_nodes[i].begin() - pts.begin();
+      leaf_nodes[i].data = ptstmp.begin() + tmp;
+    }
+    pts.swap(ptstmp);
+
+    data.clear();
+
+    built_ = true;
+  }
+
+private:
+  //any call to this function is for the moment not threadsafe
+  void const_build() const {
+    #ifdef CGAL_HAS_THREADS
+    //this ensure that build() will be called once
+    CGAL_SCOPED_LOCK(building_mutex);
+    if(!is_built())
+    #endif
+      const_cast<Self*>(this)->build(); //THIS IS NOT THREADSAFE
+  }
+public:
+
+  bool is_built() const
+  {
+    return built_;
+  }
+
+  void invalidate_built()
+  {
+    if(is_built()){
+      internal_nodes.clear();
+      leaf_nodes.clear();
+      data.clear();
+      delete bbox;
+      built_ = false;
+    }
+  }
+
+  void clear()
+  {
+    invalidate_built();
+    pts.clear();
+  }
+
+  void
+  insert(const Point_d& p)
+  {
+    invalidate_built();
+    pts.push_back(p);
+  }
+
+  template <class InputIterator>
+  void
+  insert(InputIterator first, InputIterator beyond)
+  {
+    invalidate_built();
+    pts.insert(pts.end(),first, beyond);
+  }
+
+  //For efficiency; reserve the size of the points vectors in advance (if the number of points is already known).
+  void reserve(size_t size)
+  {
+    pts.reserve(size);
+  }
+
+  //Get the capacity of the underlying points vector.
+  size_t capacity()
+  {
+    return pts.capacity();
+  }
+
+
+  template <class OutputIterator, class FuzzyQueryItem>
+  OutputIterator
+  search(OutputIterator it, const FuzzyQueryItem& q) const
+  {
+    if(! pts.empty()){
+
+      if(! is_built()){
+	const_build();
+      }
+      Kd_tree_rectangle<FT,D> b(*bbox);
+      return tree_root->search(it,q,b);
+    }
+    return it;
+  }
+
+
+  template <class FuzzyQueryItem>
+  boost::optional<Point_d>
+  search_any_point(const FuzzyQueryItem& q) const
+  {
+    if(! pts.empty()){
+
+      if(! is_built()){
+	const_build();
+      }
+      Kd_tree_rectangle<FT,D> b(*bbox);
+      return tree_root->search_any_point(q,b);
+    }
+    return boost::none;
+  }
+
+
+  ~Kd_tree() {
+    if(is_built()){
+      delete bbox;
+    }
+  }
+
+
+  const SearchTraits&
+  traits() const
+  {
+    return traits_;
+  }
+
+  Node_const_handle
+  root() const
+  {
+    if(! is_built()){
+      const_build();
+    }
+    return tree_root;
+  }
+
+  Node_handle
+  root()
+  {
+    if(! is_built()){
+      build();
+    }
+    return tree_root;
+  }
+
+  void
+  print() const
+  {
+    if(! is_built()){
+      const_build();
+    }
+    root()->print();
+  }
+
+  const Kd_tree_rectangle<FT,D>&
+  bounding_box() const
+  {
+    if(! is_built()){
+      const_build();
+    }
+    return *bbox;
+  }
+
+  const_iterator
+  begin() const
+  {
+    return pts.begin();
+  }
+
+  const_iterator
+  end() const
+  {
+    return pts.end();
+  }
+
+  size_type
+  size() const
+  {
+    return pts.size();
+  }
+
+  // Print statistics of the tree.
+  std::ostream&
+  statistics(std::ostream& s) const
+  {
+    if(! is_built()){
+      const_build();
+    }
+    s << "Tree statistics:" << std::endl;
+    s << "Number of items stored: "
+      << root()->num_items() << std::endl;
+    s << "Number of nodes: "
+      << root()->num_nodes() << std::endl;
+    s << " Tree depth: " << root()->depth() << std::endl;
+    return s;
+  }
+
+
+};
+
+} // namespace CGAL
+
+#endif // CGAL_KD_TREE_H
diff --git a/3rdparty/CGAL/include/CGAL/Kd_tree_node.h b/3rdparty/CGAL/include/CGAL/Kd_tree_node.h
new file mode 100644
index 0000000..a2fec1e
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Kd_tree_node.h
@@ -0,0 +1,567 @@
+// Copyright (c) 2002,2011  Utrecht University (The Netherlands).
+// 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
+// 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$
+// 
+//
+// Authors       : Hans Tangelder (<hanst at cs.uu.nl>)
+
+#ifndef CGAL_KD_TREE_NODE_H
+#define CGAL_KD_TREE_NODE_H
+
+
+#include <CGAL/Splitters.h>
+#include <CGAL/Compact_container.h>
+#include <boost/cstdint.hpp>
+
+namespace CGAL {
+
+  template <class SearchTraits, class Splitter, class UseExtendedNode> 
+  class Kd_tree;
+
+  template < class TreeTraits, class Splitter, class UseExtendedNode > 
+  class Kd_tree_node {
+
+     friend class Kd_tree<TreeTraits,Splitter,UseExtendedNode>;
+
+    typedef typename Kd_tree<TreeTraits,Splitter,UseExtendedNode>::Node_handle Node_handle;
+    typedef typename Kd_tree<TreeTraits,Splitter,UseExtendedNode>::Node_const_handle Node_const_handle;
+     typedef typename Kd_tree<TreeTraits,Splitter,UseExtendedNode>::Internal_node_handle Internal_node_handle;
+    typedef typename Kd_tree<TreeTraits,Splitter,UseExtendedNode>::Internal_node_const_handle Internal_node_const_handle;
+     typedef typename Kd_tree<TreeTraits,Splitter,UseExtendedNode>::Leaf_node_handle Leaf_node_handle;
+    typedef typename Kd_tree<TreeTraits,Splitter,UseExtendedNode>::Leaf_node_const_handle Leaf_node_const_handle;
+    typedef typename TreeTraits::Point_d Point_d;
+
+    typedef typename TreeTraits::FT FT;
+    typedef typename Kd_tree<TreeTraits,Splitter,UseExtendedNode>::Separator Separator;
+    typedef typename Kd_tree<TreeTraits,Splitter,UseExtendedNode>::Point_d_iterator Point_d_iterator;
+    typedef typename Kd_tree<TreeTraits,Splitter,UseExtendedNode>::iterator iterator;
+    typedef typename Kd_tree<TreeTraits,Splitter,UseExtendedNode>::D D;
+
+    bool leaf;
+
+  public : 
+    Kd_tree_node(bool leaf_)
+      :leaf(leaf_){}
+
+    bool is_leaf() const{
+      return leaf;
+    }
+
+    std::size_t 
+    num_items() const
+    {
+      if (is_leaf()){
+        Leaf_node_const_handle node = 
+          static_cast<Leaf_node_const_handle>(this);
+        return node->size();
+      }
+      else {
+        Internal_node_const_handle node = 
+          static_cast<Internal_node_const_handle>(this);
+	return node->lower()->num_items() + node->upper()->num_items();
+      }
+    }
+
+    std::size_t
+    num_nodes() const
+    {
+      if (is_leaf()) return 1;
+      else {
+        Internal_node_const_handle node = 
+          static_cast<Internal_node_const_handle>(this);
+	return node->lower()->num_nodes() + node->upper()->num_nodes();
+      }
+    }
+
+    int 
+    depth(const int current_max_depth) const
+    {
+      if (is_leaf()){
+	return current_max_depth;
+      }
+      else {
+        Internal_node_const_handle node = 
+          static_cast<Internal_node_const_handle>(this);
+        return 
+	     (std::max)( node->lower()->depth(current_max_depth + 1),
+			 node->upper()->depth(current_max_depth + 1));
+      }
+    }
+
+    int 
+    depth() const
+    {
+      return depth(1); 
+    }
+
+    template <class OutputIterator>
+    OutputIterator 
+    tree_items(OutputIterator it) const {
+      if (is_leaf()) {
+         Leaf_node_const_handle node = 
+          static_cast<Leaf_node_const_handle>(this);
+	 if (node->size()>0) 
+	    for (iterator i=node->begin(); i != node->end(); i++) 
+	      {*it=*i; ++it;} 
+	}
+      else {
+         Internal_node_const_handle node = 
+          static_cast<Internal_node_const_handle>(this);
+	  it=node->lower()->tree_items(it);  
+	  it=node->upper()->tree_items(it); 
+      }
+      return it;
+    }
+
+
+    boost::optional<Point_d>
+    any_tree_item() const {
+      boost::optional<Point_d> result = boost::none;
+      if (is_leaf()) {
+         Leaf_node_const_handle node =
+          static_cast<Leaf_node_const_handle>(this);
+	 if (node->size()>0){
+           return boost::make_optional(*(node->begin()));
+         }
+	}
+      else {
+         Internal_node_const_handle node =
+          static_cast<Internal_node_const_handle>(this);
+	  result = node->lower()->any_tree_item();
+          if(! result){
+            result = node->upper()->any_tree_item();
+          }
+      }
+      return result;
+    }
+
+
+     void 
+    indent(int d) const
+    {
+      for(int i = 0; i < d; i++){
+	std::cout << " ";
+      }
+    }
+
+
+    void 
+    print(int d = 0) const 
+    {
+      if (is_leaf()) {
+        Leaf_node_const_handle node = 
+          static_cast<Leaf_node_const_handle>(this);
+	indent(d);
+	std::cout << "leaf" << std::endl;
+	if (node->size()>0)
+	  for (iterator i=node->begin(); i != node->end(); i++)
+	  {indent(d);std::cout << *i << std::endl;}
+      }
+      else {
+        Internal_node_const_handle node = 
+          static_cast<Internal_node_const_handle>(this);
+	indent(d);
+	std::cout << "lower tree" << std::endl;
+	node->lower()->print(d+1);
+	indent(d);
+	std::cout << "separator: dim = " << node->cutting_dimension() << "  val = " << node->cutting_value() << std::endl;
+	indent(d);
+	std::cout << "upper tree" << std::endl;
+	node->upper()->print(d+1); 
+      }
+    }
+
+
+    template <class OutputIterator, class FuzzyQueryItem>
+    OutputIterator 
+    search(OutputIterator it, const FuzzyQueryItem& q,
+	   Kd_tree_rectangle<FT,D>& b) const
+    {
+      if (is_leaf()) { 
+        Leaf_node_const_handle node = 
+          static_cast<Leaf_node_const_handle>(this);
+	if (node->size()>0) 
+	  for (iterator i=node->begin(); i != node->end(); i++) 
+	    if (q.contains(*i)) 
+	      {*it++=*i;}
+      }
+      else {
+         Internal_node_const_handle node = 
+          static_cast<Internal_node_const_handle>(this);
+	// after splitting b denotes the lower part of b
+	Kd_tree_rectangle<FT,D> b_upper(b);
+	b.split(b_upper, node->cutting_dimension(),
+		node->cutting_value());
+                             
+	if (q.outer_range_contains(b)) 	
+	  it=node->lower()->tree_items(it);
+	else
+	  if (q.inner_range_intersects(b)) 
+	    it=node->lower()->search(it,q,b);
+	if  (q.outer_range_contains(b_upper))     
+	  it=node->upper()->tree_items(it);
+	else
+	  if (q.inner_range_intersects(b_upper)) 
+	    it=node->upper()->search(it,q,b_upper);
+      };
+      return it;				
+    }
+
+
+    template <class FuzzyQueryItem>
+    boost::optional<Point_d>
+    search_any_point(const FuzzyQueryItem& q,
+                     Kd_tree_rectangle<FT,D>& b) const
+    {
+      boost::optional<Point_d> result = boost::none;
+      if (is_leaf()) { 
+        Leaf_node_const_handle node = 
+          static_cast<Leaf_node_const_handle>(this);
+	if (node->size()>0) 
+	  for (iterator i=node->begin(); i != node->end(); i++) 
+	    if (q.contains(*i)) 
+	      { result = boost::make_optional(*i);}
+      }
+      else {
+         Internal_node_const_handle node = 
+          static_cast<Internal_node_const_handle>(this);
+	// after splitting b denotes the lower part of b
+	Kd_tree_rectangle<FT,D> b_upper(b);
+	b.split(b_upper, node->cutting_dimension(),
+		node->cutting_value());
+                             
+	if (q.outer_range_contains(b)){ 	
+          result = node->lower()->any_tree_item();
+	}else{
+	  if (q.inner_range_intersects(b)){ 
+	    result = node->lower()->search_any_point(q,b);
+          }
+        }
+        if(result){
+          return result;
+        }
+	if  (q.outer_range_contains(b_upper)){     
+	  result = node->upper()->any_tree_item();
+	}else{
+	  if (q.inner_range_intersects(b_upper)) 
+	    result = node->upper()->search_any_point(q,b_upper);
+        }
+      }
+      return result;				
+    }
+
+  };
+
+
+  template < class TreeTraits, class Splitter, class UseExtendedNode > 
+  class Kd_tree_leaf_node : public Kd_tree_node< TreeTraits, Splitter, UseExtendedNode >{
+
+    friend class Kd_tree<TreeTraits,Splitter,UseExtendedNode>;
+    
+    typedef typename Kd_tree<TreeTraits,Splitter,UseExtendedNode>::iterator iterator;
+    typedef Kd_tree_node< TreeTraits, Splitter, UseExtendedNode> Base;
+    typedef typename TreeTraits::Point_d Point_d;
+
+  private:
+    
+    // private variables for leaf nodes
+    boost::int32_t n; // denotes number of items in a leaf node
+    iterator data; // iterator to data in leaf node
+
+                    
+  public:
+		
+    // default constructor
+    Kd_tree_leaf_node() 
+    {}
+
+    Kd_tree_leaf_node(bool leaf_ ) 
+      : Base(leaf_)
+    {}
+
+    Kd_tree_leaf_node(bool leaf_,unsigned int n_ ) 
+      : Base(leaf_), n(n_)
+    {}
+
+    // members for all nodes
+   
+    // members for leaf nodes only
+    inline 
+    unsigned int 
+    size() const 
+    { 
+      return n;
+    }
+  
+    inline 
+    iterator
+    begin() const  
+    {
+      return data;
+    }
+
+    inline 
+    iterator 
+    end() const 
+    {
+      return data + n;
+    }
+ 
+  }; //leaf node
+
+
+
+  template < class TreeTraits, class Splitter, class UseExtendedNode> 
+  class Kd_tree_internal_node : public Kd_tree_node< TreeTraits, Splitter, UseExtendedNode >{
+
+    friend class Kd_tree<TreeTraits,Splitter,UseExtendedNode>;
+
+    typedef Kd_tree_node< TreeTraits, Splitter, UseExtendedNode> Base;
+    typedef typename Kd_tree<TreeTraits,Splitter,UseExtendedNode>::Node_handle Node_handle;
+    typedef typename Kd_tree<TreeTraits,Splitter,UseExtendedNode>::Node_const_handle Node_const_handle;
+
+    typedef typename TreeTraits::FT FT;
+    typedef typename Kd_tree<TreeTraits,Splitter,UseExtendedNode>::Separator Separator;
+
+  private:
+    
+       // private variables for internal nodes
+    boost::int32_t cut_dim;
+    FT cut_val;
+    Node_handle lower_ch, upper_ch;
+
+
+    // private variables for extended internal nodes
+    FT upper_low_val;
+    FT upper_high_val;
+    FT lower_low_val;
+    FT lower_high_val;
+
+                
+  public:
+
+    // default constructor
+    Kd_tree_internal_node() 
+    {}
+
+    Kd_tree_internal_node(bool leaf_) 
+      : Base(leaf_)
+    {}
+    
+    
+    // members for internal node and extended internal node
+
+    inline 
+    Node_const_handle 
+    lower() const 
+    {
+      return lower_ch; 
+    }
+
+    inline 
+    Node_const_handle 
+    upper() const 
+    {
+      return upper_ch; 
+    }
+
+    inline 
+    Node_handle 
+    lower()
+    {
+      return lower_ch; 
+    }
+
+    inline 
+    Node_handle 
+    upper()
+    {
+      return upper_ch; 
+    }
+  	
+    // inline Separator& separator() {return sep; }
+    // use instead
+    inline
+    void set_separator(Separator& sep){
+      cut_dim = sep.cutting_dimension();
+      cut_val = sep.cutting_value();
+    }
+  	
+    inline 
+    FT 
+    cutting_value() const 
+    {
+      return cut_val;
+    }
+  	
+    inline 
+    int 
+    cutting_dimension() const 
+    {
+      return cut_dim;
+    }
+
+    // members for extended internal node only
+    inline 
+    FT
+    upper_low_value() const
+    {
+      return upper_low_val;
+    }
+
+    inline
+    FT
+    upper_high_value() const
+    {
+      return upper_high_val;
+    }
+
+    inline
+    FT
+    lower_low_value() const
+    {
+      return lower_low_val;
+    }
+
+    inline
+    FT
+    lower_high_value() const
+    {
+      return lower_high_val;
+    }
+
+    /*Separator& 
+    separator() 
+    {
+      return Separator(cutting_dimension,cutting_value);
+    }*/
+	
+
+  };//internal node
+
+ template < class TreeTraits, class Splitter> 
+ class Kd_tree_internal_node<TreeTraits,Splitter,Tag_false> : public Kd_tree_node< TreeTraits, Splitter, Tag_false >{
+
+    friend class Kd_tree<TreeTraits,Splitter,Tag_false>;
+
+    typedef Kd_tree_node< TreeTraits, Splitter, Tag_false> Base;
+    typedef typename Kd_tree<TreeTraits,Splitter,Tag_false>::Node_handle Node_handle;
+    typedef typename Kd_tree<TreeTraits,Splitter,Tag_false>::Node_const_handle Node_const_handle;
+
+    typedef typename TreeTraits::FT FT;
+    typedef typename Kd_tree<TreeTraits,Splitter,Tag_false>::Separator Separator;
+
+  private:
+    
+       // private variables for internal nodes
+    boost::uint8_t cut_dim;
+    FT cut_val;
+
+    Node_handle lower_ch, upper_ch;
+                
+  public:
+
+    // default constructor
+    Kd_tree_internal_node() 
+    {}
+
+    Kd_tree_internal_node(bool leaf_) 
+      : Base(leaf_)
+    {}
+    
+    
+    // members for internal node and extended internal node
+
+    inline 
+    Node_const_handle 
+    lower() const 
+    {
+      return lower_ch; 
+    }
+
+    inline 
+    Node_const_handle 
+    upper() const 
+    {
+      return upper_ch; 
+    }
+
+    inline 
+    Node_handle 
+    lower()
+    {
+      return lower_ch; 
+    }
+
+    inline 
+    Node_handle 
+    upper()
+    {
+      return upper_ch; 
+    }
+  	
+    // inline Separator& separator() {return sep; }
+    // use instead
+
+    inline
+    void set_separator(Separator& sep){
+      cut_dim = sep.cutting_dimension();
+      cut_val = sep.cutting_value();
+    }
+  	
+    inline 
+    FT 
+    cutting_value() const 
+    {
+      return cut_val;
+    }
+  	
+    inline 
+    int 
+    cutting_dimension() const 
+    {
+      return cut_dim;
+    }
+
+    // members for extended internal node only
+    inline 
+    FT
+    low_value() const 
+    { 
+      return this->low_val;
+    }
+    
+    inline 
+    FT
+    high_value() const 
+    {
+      return this->high_val;
+    }
+       
+
+   /* Separator& 
+    separator() 
+    {
+      return Separator(cutting_dimension,cutting_value);
+    }*/
+	
+
+  };//internal node
+
+
+
+} // namespace CGAL
+#endif // CGAL_KDTREE_NODE_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kd_tree_rectangle.h b/3rdparty/CGAL/include/CGAL/Kd_tree_rectangle.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kd_tree_rectangle.h
rename to 3rdparty/CGAL/include/CGAL/Kd_tree_rectangle.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel/Dimension_utils.h b/3rdparty/CGAL/include/CGAL/Kernel/Dimension_utils.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel/Dimension_utils.h
rename to 3rdparty/CGAL/include/CGAL/Kernel/Dimension_utils.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel/Return_base_tag.h b/3rdparty/CGAL/include/CGAL/Kernel/Return_base_tag.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel/Return_base_tag.h
rename to 3rdparty/CGAL/include/CGAL/Kernel/Return_base_tag.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel/Same_uncertainty.h b/3rdparty/CGAL/include/CGAL/Kernel/Same_uncertainty.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel/Same_uncertainty.h
rename to 3rdparty/CGAL/include/CGAL/Kernel/Same_uncertainty.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel/Type_equality_wrapper.h b/3rdparty/CGAL/include/CGAL/Kernel/Type_equality_wrapper.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel/Type_equality_wrapper.h
rename to 3rdparty/CGAL/include/CGAL/Kernel/Type_equality_wrapper.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel/Type_mapper.h b/3rdparty/CGAL/include/CGAL/Kernel/Type_mapper.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel/Type_mapper.h
rename to 3rdparty/CGAL/include/CGAL/Kernel/Type_mapper.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel/Wutils.h b/3rdparty/CGAL/include/CGAL/Kernel/Wutils.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel/Wutils.h
rename to 3rdparty/CGAL/include/CGAL/Kernel/Wutils.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel/function_objects.h b/3rdparty/CGAL/include/CGAL/Kernel/function_objects.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel/function_objects.h
rename to 3rdparty/CGAL/include/CGAL/Kernel/function_objects.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel/global_functions.h b/3rdparty/CGAL/include/CGAL/Kernel/global_functions.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel/global_functions.h
rename to 3rdparty/CGAL/include/CGAL/Kernel/global_functions.h
diff --git a/3rdparty/CGAL/include/CGAL/Kernel/global_functions_2.h b/3rdparty/CGAL/include/CGAL/Kernel/global_functions_2.h
new file mode 100644
index 0000000..ea875eb
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Kernel/global_functions_2.h
@@ -0,0 +1,1034 @@
+// Copyright (c) 2003-2004  
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved. 
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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(s)     : Sylvain Pion
+ 
+#ifndef CGAL_KERNEL_GLOBAL_FUNCTIONS_2_H
+#define CGAL_KERNEL_GLOBAL_FUNCTIONS_2_H
+
+// Generic functions taking "user classes" as parameters, calling the
+// internal functions (in *_internal*.h, namespace internal) taking a kernel as
+// additional parameter, which themselves call the corresponding kernel
+// functors.
+
+#include <CGAL/user_classes.h>
+#include <CGAL/Kernel/global_functions_internal_2.h>
+#include <CGAL/Kernel/mpl.h>
+
+namespace CGAL {
+
+template < class K >
+typename K::Boolean
+operator==(const Point_2<K> &p, const Origin& o)
+{
+  return p == Point_2<K>(o);
+}
+
+template < class K >
+typename K::Boolean
+operator!=(const Point_2<K> &p, const Origin& o)
+{
+  return p != Point_2<K>(o);
+}
+
+template < class K >
+inline
+Angle
+angle(const Vector_2<K> &u,
+      const Vector_2<K> &v)
+{
+  return internal::angle(u, v, K());
+}
+
+template < class K >
+inline
+Angle
+angle(const Point_2<K> &p,
+      const Point_2<K> &q,
+      const Point_2<K> &r)
+{
+  return internal::angle(p, q, r, K());
+}
+
+template < class K >
+inline
+Angle
+angle(const Point_2<K> &p,
+      const Point_2<K> &q,
+      const Point_2<K> &r,
+      const Point_2<K> &s)
+{
+  return internal::angle(p, q, r, s, K());
+}
+
+template < class K >
+inline
+typename K::Boolean
+are_ordered_along_line(const Point_2<K> &p,
+                       const Point_2<K> &q,
+                       const Point_2<K> &r)
+{
+  return internal::are_ordered_along_line(p, q, r, K());
+}
+
+template < class K >
+inline
+typename K::Boolean
+are_strictly_ordered_along_line(const Point_2<K> &p,
+                                const Point_2<K> &q,
+                                const Point_2<K> &r)
+{
+  return internal::are_strictly_ordered_along_line(p, q, r, K());
+}
+
+template < class K >
+inline
+typename K::FT
+area(const Point_2<K> &p, const Point_2<K> &q, const Point_2<K> &r)
+{
+  return internal::area(p, q, r, K());
+}
+
+template < class K >
+inline
+typename K::Point_2
+barycenter(const Point_2<K> &p1, const typename K::FT& w1,
+           const Point_2<K> &p2)
+{
+  return internal::barycenter(p1, w1, p2, K());
+}
+
+template < class K >
+inline
+typename K::Point_2
+barycenter(const Point_2<K> &p1, const typename K::FT& w1,
+           const Point_2<K> &p2, const typename K::FT& w2)
+{
+  return internal::barycenter(p1, w1, p2, w2, K());
+}
+
+template < class K >
+inline
+typename K::Point_2
+barycenter(const Point_2<K> &p1, const typename K::FT& w1,
+           const Point_2<K> &p2, const typename K::FT& w2,
+           const Point_2<K> &p3)
+{
+  return internal::barycenter(p1, w1, p2, w2, p3, K());
+}
+
+template < class K >
+inline
+typename K::Point_2
+barycenter(const Point_2<K> &p1, const typename K::FT& w1,
+           const Point_2<K> &p2, const typename K::FT& w2,
+           const Point_2<K> &p3, const typename K::FT& w3)
+{
+  return internal::barycenter(p1, w1, p2, w2, p3, w3, K());
+}
+
+template < class K >
+inline
+typename K::Point_2
+barycenter(const Point_2<K> &p1, const typename K::FT& w1,
+           const Point_2<K> &p2, const typename K::FT& w2,
+           const Point_2<K> &p3, const typename K::FT& w3,
+           const Point_2<K> &p4)
+{
+  return internal::barycenter(p1, w1, p2, w2, p3, w3, p4, K());
+}
+
+template < class K >
+inline
+typename K::Point_2
+barycenter(const Point_2<K> &p1, const typename K::FT& w1,
+           const Point_2<K> &p2, const typename K::FT& w2,
+           const Point_2<K> &p3, const typename K::FT& w3,
+           const Point_2<K> &p4, const typename K::FT& w4)
+{
+  return internal::barycenter(p1, w1, p2, w2, p3, w3, p4, w4, K());
+}
+
+template <typename K>
+inline
+typename K::Line_2
+bisector(const Point_2<K> &p, const Point_2<K> &q)
+{
+  return internal::bisector(p, q, K());
+}
+
+template <typename K>
+inline
+typename K::Line_2
+bisector(const Line_2<K> &l1, const Line_2<K> &l2)
+{
+  return internal::bisector(l1, l2, K());
+}
+
+template < class K >
+inline
+typename K::Point_2
+centroid(const Point_2<K> &p,
+         const Point_2<K> &q,
+         const Point_2<K> &r)
+{
+  return internal::centroid(p, q, r, K());
+}
+
+template < class K >
+inline
+typename K::Point_2
+centroid(const Triangle_2<K> &t)
+{
+  return internal::centroid(t, K());
+}
+
+template < class K >
+inline
+typename K::Point_2
+centroid(const Point_2<K> &p,
+         const Point_2<K> &q,
+         const Point_2<K> &r,
+         const Point_2<K> &s)
+{
+  return internal::centroid(p, q, r, s, K());
+}
+
+template < class K >
+inline
+typename K::Point_2
+circumcenter(const Point_2<K> &p,
+             const Point_2<K> &q)
+{
+  return internal::circumcenter(p, q, K());
+}
+
+template < class K >
+inline
+typename K::Point_2
+circumcenter(const Point_2<K> &p,
+             const Point_2<K> &q,
+             const Point_2<K> &r)
+{
+  return internal::circumcenter(p, q, r, K());
+}
+
+template < class K >
+inline
+typename K::Point_2
+circumcenter(const Triangle_2<K> &t)
+{
+  return internal::circumcenter(t, K());
+}
+
+template < class K >
+inline
+typename K::Boolean
+collinear(const Point_2<K> &p, const Point_2<K> &q, const Point_2<K> &r)
+{
+  return internal::collinear(p, q, r, K());
+}
+
+template < class K >
+inline
+typename K::Boolean
+collinear_are_ordered_along_line(const Point_2<K> &p,
+                                 const Point_2<K> &q,
+                                 const Point_2<K> &r)
+{
+  return internal::collinear_are_ordered_along_line(p, q, r, K());
+}
+
+template < class K >
+inline
+typename K::Boolean
+collinear_are_strictly_ordered_along_line(const Point_2<K> &p,
+                                          const Point_2<K> &q,
+                                          const Point_2<K> &r)
+{
+  return internal::collinear_are_strictly_ordered_along_line(p, q, r, K());
+}
+
+template < typename K >
+inline
+typename K::Comparison_result
+compare_angle_with_x_axis(const Direction_2<K>& d1,
+                          const Direction_2<K>& d2)
+{
+  return internal::compare_angle_with_x_axis(d1, d2, K());
+}
+
+template <class K >
+inline
+typename K::Comparison_result
+compare_distance_to_point(const Point_2<K>& p,
+                          const Point_2<K>& q,
+                          const Point_2<K>& r)
+{
+  return internal::compare_distance_to_point(p, q, r, K());
+}
+
+template <class K >
+inline
+typename K::Comparison_result
+compare_squared_distance(const Point_2<K>& p,
+                         const Point_2<K>& q,
+                         const typename K::FT& d2)
+{
+  return internal::compare_squared_distance(p, q, d2, K());
+}
+
+template <class K>
+inline
+typename K::Comparison_result
+compare_signed_distance_to_line(const Point_2<K>& p,
+				const Point_2<K>& q,
+				const Point_2<K>& r,
+				const Point_2<K>& s)
+{
+  return internal::compare_signed_distance_to_line(p, q, r, s, K());
+}
+
+template <class K>
+inline
+typename K::Comparison_result
+compare_signed_distance_to_line(const Line_2<K>& l,
+				const Point_2<K>& p,
+				const Point_2<K>& q)
+{
+  return internal::compare_signed_distance_to_line(l, p, q, K());
+}
+
+/* FIXME : Undocumented, obsolete...
+template < class K >
+inline
+typename K::Comparison_result
+compare_lexicographically_xy(const Point_2<K> &p,
+                             const Point_2<K> &q)
+{
+  return K().compare_xy_2_object()(p, q);
+}
+*/
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_slopes(const Line_2<K> &l1, const Line_2<K> &l2)
+{
+  return internal::compare_slopes(l1, l2, K());
+}
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_slopes(const Segment_2<K> &s1, const Segment_2<K> &s2)
+{
+  return internal::compare_slopes(s1, s2, K());
+}
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_x(const Point_2<K> &p, const Point_2<K> &q)
+{
+  return internal::compare_x(p, q, K());
+}
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_x(const Point_2<K>& p,
+          const Line_2<K>& l1,
+          const Line_2<K>& l2)
+{
+  return internal::compare_x(p, l1, l2, K());
+}
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_x(const Line_2<K> &l,
+          const Line_2<K> &h1,
+          const Line_2<K> &h2)
+{
+  return internal::compare_x(l, h1, h2, K());
+}
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_x(const Line_2<K> &l1,
+          const Line_2<K> &h1,
+          const Line_2<K> &l2,
+          const Line_2<K> &h2)
+{
+  return internal::compare_x(l1, h1, l2, h2, K());
+}
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_x_at_y(const Point_2<K>& p, const Line_2<K>& h)
+{
+  return internal::compare_x_at_y(p, h, K());
+}
+
+/* Undocumented
+template < class K >
+inline
+typename K::Comparison_result
+compare_x_at_y(const Point_2<K>& p, const Segment_2<K>& s)
+{
+  return internal::compare_x_at_y(p, s, K());
+}
+*/
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_x_at_y(const Point_2<K> &p,
+               const Line_2<K> &h1,
+               const Line_2<K> &h2)
+{
+  return internal::compare_x_at_y(p, h1, h2, K());
+}
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_x_at_y(const Line_2<K> &l1,
+               const Line_2<K> &l2,
+               const Line_2<K> &h)
+{
+  return internal::compare_x_at_y(l1, l2, h, K());
+}
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_x_at_y(const Line_2<K> &l1,
+               const Line_2<K> &l2,
+               const Line_2<K> &h1,
+               const Line_2<K> &h2)
+{
+  return internal::compare_x_at_y(l1, l2, h1, h2, K());
+}
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_xy(const Point_2<K> &p, const Point_2<K> &q)
+{
+  return internal::compare_xy(p, q, K());
+}
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_lexicographically(const Point_2<K> &p, const Point_2<K> &q)
+{
+  return internal::compare_xy(p, q, K());
+}
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_y(const Point_2<K> &p, const Point_2<K> &q)
+{
+  return internal::compare_y(p, q, K());
+}
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_y(const Point_2<K> &p,
+          const Line_2<K> &l1,
+          const Line_2<K> &l2)
+{
+  return internal::compare_y(p, l1, l2, K());
+}
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_y(const Line_2<K> &l1,
+          const Line_2<K> &l2,
+          const Line_2<K> &h1,
+          const Line_2<K> &h2)
+{
+  return internal::compare_y(l1, l2, h1, h2, K());
+}
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_y(const Line_2<K> &l,
+          const Line_2<K> &h1,
+          const Line_2<K> &h2)
+{
+  return internal::compare_y(l, h1, h2, K());
+}
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_y_at_x(const Point_2<K> &p, const Segment_2<K> &s)
+{
+  return internal::compare_y_at_x(p, s, K());
+}
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_y_at_x(const Point_2<K> &p,
+               const Segment_2<K> &s1,
+               const Segment_2<K> &s2)
+{
+  return internal::compare_y_at_x(p, s1, s2, K());
+}
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_y_at_x(const Point_2<K> &p, const Line_2<K> &h)
+{
+  return internal::compare_y_at_x(p, h, K());
+}  
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_y_at_x(const Point_2<K> &p,
+               const Line_2<K> &h1,
+               const Line_2<K> &h2)
+{
+  return internal::compare_y_at_x(p, h1, h2, K());
+}
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_y_at_x(const Line_2<K> &l1,
+               const Line_2<K> &l2,
+               const Line_2<K> &h)
+{
+  return internal::compare_y_at_x(l1, l2, h, K());
+}
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_y_at_x(const Line_2<K> &l1,
+               const Line_2<K> &l2,
+               const Line_2<K> &h1,
+               const Line_2<K> &h2)
+{
+  return internal::compare_y_at_x(l1, l2, h1, h2, K());
+}
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_yx(const Point_2<K> &p, const Point_2<K> &q)
+{
+  return internal::compare_yx(p, q, K());
+}
+
+template < class K >
+inline
+typename K::FT
+determinant(const Vector_2<K> &v0, const Vector_2<K> &v1)
+{
+  return internal::determinant(v0, v1, K());
+}
+
+template <class K>
+inline
+typename K::Boolean
+has_larger_distance_to_point(const Point_2<K>& p,
+			     const Point_2<K>& q,
+			     const Point_2<K>& r)
+{
+  return internal::has_larger_distance_to_point(p, q, r, K());
+}
+
+template <class K>
+inline
+typename K::Boolean
+has_smaller_distance_to_point(const Point_2<K>& p,
+                              const Point_2<K>& q,
+                              const Point_2<K>& r)
+{
+  return internal::has_smaller_distance_to_point(p, q, r, K());
+}
+
+template <class K>
+inline
+typename K::Boolean
+has_smaller_signed_distance_to_line(const Line_2<K>& l,
+                                    const Point_2<K>& p,
+                                    const Point_2<K>& q)
+{
+  return internal::has_smaller_signed_distance_to_line(l, p, q, K());
+}
+
+template <class K>
+inline
+typename K::Boolean
+has_larger_signed_distance_to_line(const Line_2<K>& l,
+				   const Point_2<K>& p,
+				   const Point_2<K>& q)
+{
+  return internal::has_larger_signed_distance_to_line(l, p, q, K());
+}
+
+template <class K>
+inline
+typename K::Boolean
+has_larger_signed_distance_to_line(const Point_2<K>& p,
+				   const Point_2<K>& q,
+				   const Point_2<K>& r,
+				   const Point_2<K>& s)
+{
+  return internal::has_larger_signed_distance_to_line(p, q, r, s, K());
+}
+
+template <class K>
+inline
+typename K::Boolean
+has_smaller_signed_distance_to_line(const Point_2<K>& p,
+                                    const Point_2<K>& q,
+                                    const Point_2<K>& r,
+                                    const Point_2<K>& s)
+{
+  return internal::has_smaller_signed_distance_to_line(p, q, r, s, K());
+}
+
+template < class K >
+inline
+typename K::Boolean
+left_turn(const Point_2<K> &p, const Point_2<K> &q, const Point_2<K> &r)
+{
+  return internal::left_turn(p, q, r, K());
+}
+
+template < class K >
+inline
+typename K::Boolean
+less_x(const Point_2<K> &p, const Point_2<K> &q)
+{
+  return internal::less_x(p, q, K());
+}
+
+template < class K >
+inline
+typename K::Boolean
+less_y(const Point_2<K> &p, const Point_2<K> &q)
+{
+  return internal::less_y(p, q, K());
+}
+
+template < class K >
+inline
+typename K::Boolean
+lexicographically_xy_larger(const Point_2<K> &p, const Point_2<K> &q)
+{
+  return internal::lexicographically_xy_larger(p, q, K());
+}
+
+template < class K >
+inline
+typename K::Boolean
+lexicographically_xy_larger_or_equal(const Point_2<K> &p, const Point_2<K> &q)
+{
+  return internal::lexicographically_xy_larger_or_equal(p, q, K());
+}
+
+template < class K >
+inline
+typename K::Boolean
+lexicographically_xy_smaller(const Point_2<K> &p, const Point_2<K> &q)
+{
+  return internal::lexicographically_xy_smaller(p, q, K());
+}
+
+template < class K >
+inline
+typename K::Boolean
+lexicographically_xy_smaller_or_equal(const Point_2<K> &p,
+                                      const Point_2<K> &q)
+{
+  return internal::lexicographically_xy_smaller_or_equal(p, q, K());
+}
+
+template < class K >
+inline
+typename K::Boolean
+lexicographically_yx_smaller(const Point_2<K> &p, const Point_2<K> &q)
+{
+  return internal::lexicographically_yx_smaller(p, q, K());
+}
+
+template < class K >
+inline
+typename K::Boolean
+lexicographically_yx_smaller_or_equal(const Point_2<K> &p, const Point_2<K> &q)
+{
+  return internal::lexicographically_yx_smaller_or_equal(p, q, K());
+}
+
+// FIXME : Undocumented
+template < class K >
+inline
+typename K::Boolean
+lexicographically_yx_larger(const Point_2<K> &p, const Point_2<K> &q)
+{
+  return internal::lexicographically_yx_larger(p, q, K());
+}
+
+// FIXME : Undocumented
+template < class K >
+inline
+typename K::Boolean
+lexicographically_yx_larger_or_equal(const Point_2<K> &p, const Point_2<K> &q)
+{
+  return internal::lexicographically_yx_larger_or_equal(p, q, K());
+}
+
+template < class K >
+inline
+typename K::Point_2
+midpoint(const Point_2<K> &p, const Point_2<K> &q)
+{
+  return internal::midpoint(p, q, K());
+}
+
+template < class K >
+inline
+typename K::Point_2
+max_vertex(const Iso_rectangle_2<K> &ir)
+{
+  return internal::max_vertex(ir, K());
+}
+
+template < class K >
+inline
+typename K::Point_2
+min_vertex(const Iso_rectangle_2<K> &ir)
+{
+  return internal::min_vertex(ir, K());
+}
+
+// FIXME TODO : What do we do with the operators ?
+// They have no counter part with the kernel argument...
+template < class K >
+inline
+typename K::Boolean
+operator<(const Direction_2<K>& d1, const Direction_2<K>& d2)
+{ return compare_angle_with_x_axis(d1, d2) == SMALLER; }
+
+template < class K >
+inline
+typename K::Boolean
+operator>(const Direction_2<K>& d1, const Direction_2<K>& d2)
+{ return compare_angle_with_x_axis(d1, d2) == LARGER; }
+
+template < class K >
+inline
+typename K::Boolean
+operator>=(const Direction_2<K>& d1, const Direction_2<K>& d2)
+{ return compare_angle_with_x_axis(d1, d2) != SMALLER; }
+
+template < class K >
+inline
+typename K::Boolean
+operator<=(const Direction_2<K>& d1, const Direction_2<K>& d2)
+{ return compare_angle_with_x_axis(d1, d2) != LARGER; }
+
+template < class K >
+inline
+typename K::Boolean
+operator==(const Point_2<K>& p, const Point_2<K>& q)
+{ return K().equal_2_object()(p, q); }
+
+template < class K >
+inline
+typename K::Boolean
+operator!=(const Point_2<K>& p, const Point_2<K>& q)
+{ return ! (p == q); }
+
+template < class K >
+inline
+typename K::Boolean
+operator<(const Point_2<K>& p, const Point_2<K>& q)
+{ return K().less_xy_2_object()(p, q); }
+
+template < class K >
+inline
+typename K::Boolean
+operator>(const Point_2<K>& p, const Point_2<K>& q)
+{ return K().less_xy_2_object()(q, p); }
+
+template < class K >
+inline
+typename K::Boolean
+operator<=(const Point_2<K>& p, const Point_2<K>& q)
+{ return ! K().less_xy_2_object()(q, p); }
+
+template < class K >
+inline
+typename K::Boolean
+operator>=(const Point_2<K>& p, const Point_2<K>& q)
+{ return ! K().less_xy_2_object()(p, q); }
+
+template < class K >
+inline
+typename K::Boolean
+operator==(const Vector_2<K>& v, const Vector_2<K>& w)
+{ return K().equal_2_object()(v, w); }
+
+template < class K >
+inline
+typename K::Boolean
+operator!=(const Vector_2<K>& v, const Vector_2<K>& w)
+{ return ! (v == w); }
+
+template < class K >
+inline
+typename K::Vector_2
+operator*(const typename K::FT &c, const Vector_2<K> &w)
+{
+  return K().construct_scaled_vector_2_object()(w, c);
+}
+
+template < class K >
+inline
+typename K::Vector_2
+operator*(const Vector_2<K> &w, const typename K::FT &c)
+{
+  return K().construct_scaled_vector_2_object()(w, c);
+}
+
+template < class K >
+inline
+typename K::Vector_2
+operator*(const typename First_if_different<typename K::RT,
+                                            typename K::FT>::Type &c,
+          const Vector_2<K> &w)
+{
+  return K().construct_scaled_vector_2_object()(w, c);
+}
+
+template < class K >
+inline
+typename K::Vector_2
+operator*(const Vector_2<K> &w,
+          const typename First_if_different<typename K::RT,
+                                            typename K::FT>::Type &c)
+{
+  return K().construct_scaled_vector_2_object()(w, c);
+}
+
+template < class K >
+inline
+typename K::FT
+operator*(const Vector_2<K> &v, const Vector_2<K> &w)
+{
+  return K().compute_scalar_product_2_object()(v, w);
+}
+
+template < class K >
+inline
+typename K::Point_2
+operator+(const Point_2<K> &p, const Vector_2<K> &v)
+{
+  return K().construct_translated_point_2_object()(p, v);
+}
+
+template < class K >
+inline
+typename K::Point_2
+operator+(const Origin &o, const Vector_2<K> &v)
+{
+  return K().construct_translated_point_2_object()(o, v);
+}
+
+template < class K >
+inline
+typename K::Point_2
+operator-(const Point_2<K> &p, const Vector_2<K> &v)
+{
+  return K().construct_translated_point_2_object()
+                (p, K().construct_opposite_vector_2_object()(v));
+}
+
+template < class K >
+inline
+typename K::Point_2
+operator-(const Origin &o, const Vector_2<K> &v)
+{
+  return K().construct_translated_point_2_object()
+               (o, K().construct_opposite_vector_2_object()(v));
+}
+
+template < class K >
+inline
+typename K::Vector_2
+operator-(const Point_2<K> &p, const Point_2<K> &q)
+{
+  return K().construct_vector_2_object()(q, p);
+}
+
+template < class K >
+inline
+typename K::Vector_2
+operator-(const Point_2<K> &p, const Origin &o)
+{
+  return K().construct_vector_2_object()(o, p);
+}
+
+template < class K >
+inline
+typename K::Vector_2
+operator-(const Origin &o, const Point_2<K> &q)
+{
+  return K().construct_vector_2_object()(q, o);
+}
+
+template <typename K>
+inline
+typename K::Orientation
+orientation(const Point_2<K> &p, const Point_2<K> &q, const Point_2<K> &r)
+{
+  return internal::orientation(p, q, r, K());
+}
+
+template <typename K>
+inline
+typename K::Orientation
+orientation(const Vector_2<K> &u, const Vector_2<K> &v)
+{
+  return internal::orientation(u, v, K());
+}
+
+// parallel() functions are in global_functions.h
+
+template <class K>
+inline
+typename K::Line_2
+radical_line(const Circle_2<K> &s1,
+              const Circle_2<K> &s2)
+{
+  return K().construct_radical_line_2_object()(s1,s2);
+}
+
+template <typename K>
+inline
+typename K::Boolean
+right_turn(const Point_2<K> &p, const Point_2<K> &q, const Point_2<K> &r)
+{
+  return internal::right_turn(p, q, r, K());
+}
+
+template < class K >
+inline
+typename K::FT
+scalar_product(const Vector_2<K> &v, const Vector_2<K> &w)
+{
+  return K().compute_scalar_product_2_object()(v, w);
+}
+
+template <class K>
+inline
+typename K::Bounded_side
+side_of_bounded_circle(const Point_2<K> &p,
+                       const Point_2<K> &q,
+                       const Point_2<K> &r,
+                       const Point_2<K> &t)
+{
+  return internal::side_of_bounded_circle(p, q, r, t, K());
+}
+
+template <class K>
+inline
+typename K::Bounded_side
+side_of_bounded_circle(const Point_2<K> &p,
+                       const Point_2<K> &q,
+                       const Point_2<K> &r)
+{
+  return internal::side_of_bounded_circle(p, q, r, K());
+}
+
+template <class K>
+inline
+typename K::Oriented_side
+side_of_oriented_circle(const Point_2<K> &p,
+                        const Point_2<K> &q,
+                        const Point_2<K> &r,
+                        const Point_2<K> &t)
+{
+  return internal::side_of_oriented_circle(p, q, r, t, K());
+}
+
+template < class K >
+inline
+typename K::FT
+squared_radius(const Point_2<K> &p)
+{
+  return internal::squared_radius(p, K());
+}
+
+template < class K >
+inline
+typename K::FT
+squared_radius(const Point_2<K> &p, const Point_2<K> &q)
+{
+  return internal::squared_radius(p, q, K());
+}
+
+template < class K >
+CGAL_KERNEL_INLINE
+typename K::FT
+squared_radius(const Point_2<K>& p, const Point_2<K>& q, const Point_2<K>& r)
+{
+  return internal::squared_radius(p, q, r, K());
+}
+
+template < class K >
+inline
+typename K::Boolean
+x_equal(const Point_2<K> &p, const Point_2<K> &q)
+{
+  return internal::x_equal(p, q, K());
+}
+
+template < class K >
+inline
+typename K::Boolean
+y_equal(const Point_2<K> &p, const Point_2<K> &q)
+{
+  return internal::y_equal(p, q, K());
+}
+
+} //namespace CGAL
+
+#endif  // CGAL_KERNEL_GLOBAL_FUNCTIONS_2_H
diff --git a/3rdparty/CGAL/include/CGAL/Kernel/global_functions_3.h b/3rdparty/CGAL/include/CGAL/Kernel/global_functions_3.h
new file mode 100644
index 0000000..0a68e07
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Kernel/global_functions_3.h
@@ -0,0 +1,1134 @@
+// Copyright (c) 2003-2004  
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved. 
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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(s)     : Sylvain Pion
+ 
+#ifndef CGAL_KERNEL_GLOBAL_FUNCTIONS_3_H
+#define CGAL_KERNEL_GLOBAL_FUNCTIONS_3_H
+
+#include <CGAL/user_classes.h>
+#include <CGAL/Kernel/global_functions_internal_3.h>
+#include <CGAL/Kernel/mpl.h>
+
+// Generic functions calling the kernel functor.
+// See comments in CGAL/Kernel/global_functions_2.h.
+
+namespace CGAL {
+
+template <typename K>
+inline
+Angle
+angle(const Vector_3<K> &u, const Vector_3<K> &v)
+{
+  return internal::angle(u, v, K());
+}
+
+template <typename K>
+inline
+Angle
+angle(const Point_3<K> &p, const Point_3<K> &q, const Point_3<K> &r)
+{
+  return internal::angle(p, q, r, K());
+}
+
+template <typename K>
+inline
+Angle
+angle(const Point_3<K> &p, const Point_3<K> &q,
+      const Point_3<K> &r, const Point_3<K> &s)
+{
+  return internal::angle(p, q, r, s, K());
+}
+
+template < typename K >
+inline
+typename K::Boolean
+are_negative_oriented(const Point_3<K>& p, const Point_3<K>& q,
+                      const Point_3<K>& r, const Point_3<K>& s)
+{
+  return internal::are_negative_oriented(p, q, r, s, K());
+}
+
+template < class K >
+inline
+typename K::Boolean
+are_ordered_along_line(const Point_3<K> &p,
+                       const Point_3<K> &q,
+                       const Point_3<K> &r)
+{
+  return internal::are_ordered_along_line(p, q, r, K());
+}
+
+template < typename K >
+inline
+typename K::Boolean
+are_positive_oriented(const Point_3<K>& p, const Point_3<K>& q,
+                      const Point_3<K>& r, const Point_3<K>& s)
+{
+  return internal::are_positive_oriented(p, q, r, s, K());
+}
+
+template < class K >
+inline
+typename K::Boolean
+are_strictly_ordered_along_line(const Point_3<K> &p,
+                                const Point_3<K> &q,
+                                const Point_3<K> &r)
+{
+  return internal::are_strictly_ordered_along_line(p, q, r, K());
+}
+
+template < class K >
+inline
+typename K::Point_3
+barycenter(const Point_3<K> &p1, const typename K::FT& w1,
+           const Point_3<K> &p2)
+{
+  return internal::barycenter(p1, w1, p2, K());
+}
+
+template < class K >
+inline
+typename K::Point_3
+barycenter(const Point_3<K> &p1, const typename K::FT& w1,
+           const Point_3<K> &p2, const typename K::FT& w2)
+{
+  return internal::barycenter(p1, w1, p2, w2, K());
+}
+
+template < class K >
+inline
+typename K::Point_3
+barycenter(const Point_3<K> &p1, const typename K::FT& w1,
+           const Point_3<K> &p2, const typename K::FT& w2,
+           const Point_3<K> &p3)
+{
+  return internal::barycenter(p1, w1, p2, w2, p3, K());
+}
+
+template < class K >
+inline
+typename K::Point_3
+barycenter(const Point_3<K> &p1, const typename K::FT& w1,
+           const Point_3<K> &p2, const typename K::FT& w2,
+           const Point_3<K> &p3, const typename K::FT& w3)
+{
+  return internal::barycenter(p1, w1, p2, w2, p3, w3, K());
+}
+
+template < class K >
+inline
+typename K::Point_3
+barycenter(const Point_3<K> &p1, const typename K::FT& w1,
+           const Point_3<K> &p2, const typename K::FT& w2,
+           const Point_3<K> &p3, const typename K::FT& w3,
+           const Point_3<K> &p4)
+{
+  return internal::barycenter(p1, w1, p2, w2, p3, w3, p4, K());
+}
+
+template < class K >
+inline
+typename K::Point_3
+barycenter(const Point_3<K> &p1, const typename K::FT& w1,
+           const Point_3<K> &p2, const typename K::FT& w2,
+           const Point_3<K> &p3, const typename K::FT& w3,
+           const Point_3<K> &p4, const typename K::FT& w4)
+{
+  return internal::barycenter(p1, w1, p2, w2, p3, w3, p4, w4, K());
+}
+
+template <typename K>
+inline
+typename K::Plane_3
+bisector(const Point_3<K> &p, const Point_3<K> &q)
+{
+  return internal::bisector(p, q, K());
+}
+
+template <typename K>
+inline
+typename K::Plane_3
+bisector(const Plane_3<K> &h1, const Plane_3<K> &h2)
+{
+  return internal::bisector(h1, h2, K());
+}
+
+template < class K >
+inline
+Point_3<K>
+centroid(const Point_3<K> &p, const Point_3<K> &q,
+         const Point_3<K> &r, const Point_3<K> &s)
+{
+  return internal::centroid(p, q, r, s, K());
+}
+
+template < class K >
+inline
+Point_3<K>
+centroid(const Point_3<K> &p, const Point_3<K> &q, const Point_3<K> &r)
+{
+  return internal::centroid(p, q, r, K());
+}
+
+template < class K >
+inline
+Point_3<K>
+centroid(const Tetrahedron_3<K> &t)
+{
+  return internal::centroid(t, K());
+}
+
+template < class K >
+inline
+Point_3<K>
+centroid(const Triangle_3<K> &t)
+{
+  return internal::centroid(t, K());
+}
+
+template < class K >
+inline
+typename K::Point_3
+circumcenter(const Point_3<K> &p,
+             const Point_3<K> &q)
+{
+  return internal::circumcenter(p, q, K());
+}
+
+template < class K >
+inline
+typename K::Point_3
+circumcenter(const Point_3<K> &p,
+             const Point_3<K> &q,
+             const Point_3<K> &r)
+{
+  return internal::circumcenter(p, q, r, K());
+}
+
+template < class K >
+inline
+typename K::Point_3
+circumcenter(const Point_3<K> &p, const Point_3<K> &q,
+             const Point_3<K> &r, const Point_3<K> &s)
+{
+  return internal::circumcenter(p, q, r, s, K());
+}
+
+template < class K >
+inline
+typename K::Point_3
+circumcenter(const Tetrahedron_3<K> &t)
+{
+  return internal::circumcenter(t, K());
+}
+
+template < class K >
+inline
+typename K::Point_3
+circumcenter(const Triangle_3<K> &t)
+{
+  return internal::circumcenter(t, K());
+}
+
+template < class K >
+inline
+typename K::Boolean
+collinear(const Point_3<K> &p, const Point_3<K> &q, const Point_3<K> &r)
+{
+  return internal::collinear(p, q, r, K());
+}
+
+template < class K >
+inline
+typename K::Boolean
+collinear_are_ordered_along_line(const Point_3<K> &p,
+                                 const Point_3<K> &q,
+                                 const Point_3<K> &r)
+{
+  return internal::collinear_are_ordered_along_line(p, q, r, K());
+}
+
+template < class K >
+inline
+typename K::Boolean
+collinear_are_strictly_ordered_along_line(const Point_3<K> &p,
+                                          const Point_3<K> &q,
+                                          const Point_3<K> &r)
+{
+  return internal::collinear_are_strictly_ordered_along_line(p, q, r, K());
+}
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_dihedral_angle(const Point_3<K>& a1, const Point_3<K>& b1, 
+                       const Point_3<K>& c1, const Point_3<K>& d1, 
+                       const Point_3<K>& a2, const Point_3<K>& b2, 
+                       const Point_3<K>& c2, const Point_3<K>& d2)
+{
+  return internal::compare_dihedral_angle(a1, b1, c1, d1, a2, b2, c2, d2, K());
+}
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_dihedral_angle(const Point_3<K>& a1, const Point_3<K>& b1, 
+                       const Point_3<K>& c1, const Point_3<K>& d1, 
+                       const typename K::FT& cosine)
+{
+  return internal::compare_dihedral_angle(a1, b1, c1, d1, cosine, K());
+}
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_dihedral_angle(const Vector_3<K>& ab1, 
+                       const Vector_3<K>& ac1,
+                       const Vector_3<K>& ad1,
+                       const Vector_3<K>& ab2,
+                       const Vector_3<K>& ac2,
+                       const Vector_3<K>& ad2)
+{
+  return internal::compare_dihedral_angle(ab1, ac1, ad1, ab2, ac2, ad2, K());
+}
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_dihedral_angle(const Vector_3<K>& ab1, 
+                       const Vector_3<K>& ac1,
+                       const Vector_3<K>& ad1,
+                       const typename K::FT& cosine)
+{
+  return internal::compare_dihedral_angle(ab1, ac1, ad1, cosine, K());
+}
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_distance_to_point(const Point_3<K> &p,
+                          const Point_3<K> &q,
+                          const Point_3<K> &r)
+{
+  return internal::compare_distance_to_point(p, q, r, K());
+}
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_squared_distance(const Point_3<K> &p,
+                         const Point_3<K> &q,
+                         const typename K::FT &d2)
+{
+  return internal::compare_squared_distance(p, q, d2, K());
+}
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_squared_radius(const Point_3<K> &p,
+		       const typename K::FT &sr)
+{
+  return internal::compare_squared_radius(p, sr, K());
+}
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_squared_radius(const Point_3<K> &p,
+		       const Point_3<K> &q,
+		       const typename K::FT &sr)
+{
+  return internal::compare_squared_radius(p, q, sr, K());
+}
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_squared_radius(const Point_3<K> &p,
+		       const Point_3<K> &q,
+		       const Point_3<K> &r,
+		       const typename K::FT &sr)
+{
+  return internal::compare_squared_radius(p, q, r, sr, K());
+}
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_squared_radius(const Point_3<K> &p,
+		       const Point_3<K> &q,
+		       const Point_3<K> &r,
+		       const Point_3<K> &s,
+		       const typename K::FT &sr)
+{
+  return internal::compare_squared_radius(p, q, r, s, sr, K());
+}
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_lexicographically_xyz(const Point_3<K> &p,
+                              const Point_3<K> &q)
+{
+  return internal::compare_lexicographically_xyz(p, q, K());
+}
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_lexicographically(const Point_3<K> &p,
+                          const Point_3<K> &q)
+{
+    return internal::compare_lexicographically_xyz(p, q, K());
+}
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_signed_distance_to_plane(const Plane_3<K> &h,
+				 const Point_3<K> &p,
+				 const Point_3<K> &q)
+{ 
+  return internal::compare_signed_distance_to_plane(h, p, q, K());
+}
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_signed_distance_to_plane(const Point_3<K> &hp,
+				 const Point_3<K> &hq,
+				 const Point_3<K> &hr,
+				 const Point_3<K> &p,
+				 const Point_3<K> &q)
+{ 
+  return internal::compare_signed_distance_to_plane(hp, hq, hr, p, q, K());
+}
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_x(const Point_3<K> &p, const Point_3<K> &q)
+{ 
+  return internal::compare_x(p, q, K());
+}
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_y(const Point_3<K> &p, const Point_3<K> &q)
+{ 
+  return internal::compare_y(p, q, K());
+}
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_z(const Point_3<K> &p, const Point_3<K> &q)
+{ 
+  return internal::compare_z(p, q, K());
+}
+
+template < class K >
+inline
+typename K::Comparison_result
+compare_xyz(const Point_3<K> &p, const Point_3<K> &q)
+{ 
+  return internal::compare_xyz(p, q, K());
+}
+
+template < class K >
+inline
+typename K::Boolean
+coplanar(const Point_3<K> &p, const Point_3<K> &q,
+         const Point_3<K> &r, const Point_3<K> &s)
+{
+  return internal::coplanar(p, q, r, s, K());
+}
+
+
+template < class K >
+inline
+typename K::Orientation
+coplanar_orientation(const Point_3<K> &p,
+                     const Point_3<K> &q,
+                     const Point_3<K> &r,
+                     const Point_3<K> &s)
+{
+  return internal::coplanar_orientation(p, q, r, s, K());
+}
+
+template < class K >
+inline
+typename K::Orientation
+coplanar_orientation(const Point_3<K> &p,
+                     const Point_3<K> &q,
+                     const Point_3<K> &r)
+{
+  return internal::coplanar_orientation(p, q, r, K());
+}
+
+template < class K >
+inline
+typename K::Bounded_side
+coplanar_side_of_bounded_circle(const Point_3<K> &p,
+                                const Point_3<K> &q,
+                                const Point_3<K> &r,
+                                const Point_3<K> &t)
+{
+  return internal::coplanar_side_of_bounded_circle(p, q, r, t, K());
+}
+
+template < class K >
+inline
+typename K::Vector_3
+cross_product(const Vector_3<K> &v, const Vector_3<K> &w)
+{
+  return internal::cross_product(v, w, K());
+}
+
+template < class K >
+inline
+typename K::FT
+determinant(const Vector_3<K> &v0, const Vector_3<K> &v1,
+            const Vector_3<K> &v2)
+{
+  return internal::determinant(v0, v1, v2, K());
+}
+
+template < class K >
+inline
+typename K::Line_3
+equidistant_line(const Point_3<K> &p, const Point_3<K> &q, const Point_3<K> &r)
+{
+  return internal::equidistant_line(p, q, r, K());
+}
+
+template < class K >
+inline
+typename K::Boolean
+has_larger_distance_to_point(const Point_3<K> &p,
+			     const Point_3<K> &q,
+			     const Point_3<K> &r)
+{
+  return internal::has_larger_distance_to_point(p, q, r, K());
+}
+
+template < class K >
+inline
+typename K::Boolean
+has_larger_signed_distance_to_plane(const Point_3<K> &hp,
+				    const Point_3<K> &hq,
+				    const Point_3<K> &hr,
+				    const Point_3<K> &p,
+				    const Point_3<K> &q)
+{ 
+  return internal::has_larger_signed_distance_to_plane(hp, hq, hr, p, q, K());
+}
+
+template < class K >
+inline
+typename K::Boolean
+has_larger_signed_distance_to_plane(const Plane_3<K> &h,
+				    const Point_3<K> &p,
+				    const Point_3<K> &q)
+{ 
+  return internal::has_larger_signed_distance_to_plane(h, p, q, K());
+}
+
+template < class K >
+inline
+typename K::Boolean
+has_smaller_distance_to_point(const Point_3<K> &p,
+                              const Point_3<K> &q,
+                              const Point_3<K> &r)
+{
+  return internal::has_smaller_distance_to_point(p, q, r, K());
+}
+
+template < class K >
+inline
+typename K::Boolean
+has_smaller_signed_distance_to_plane(const Point_3<K> &hp,
+                                     const Point_3<K> &hq,
+                                     const Point_3<K> &hr,
+                                     const Point_3<K> &p,
+                                     const Point_3<K> &q)
+{ 
+  return internal::has_smaller_signed_distance_to_plane(hp, hq, hr, p, q, K());
+}
+
+template < class K >
+inline
+typename K::Boolean
+has_smaller_signed_distance_to_plane(const Plane_3<K> &h,
+                                     const Point_3<K> &p,
+                                     const Point_3<K> &q)
+{ 
+  return internal::has_smaller_signed_distance_to_plane(h, p, q, K());
+}
+
+template < class K >
+inline
+typename K::Boolean
+less_x(const Point_3<K> &p, const Point_3<K> &q)
+{ 
+  return internal::less_x(p, q, K());
+}
+
+template < class K >
+inline
+typename K::Boolean
+less_y(const Point_3<K> &p, const Point_3<K> &q)
+{ 
+  return internal::less_y(p, q, K());
+}
+
+template < class K >
+inline
+typename K::Boolean
+less_z(const Point_3<K> &p, const Point_3<K> &q)
+{ 
+  return internal::less_z(p, q, K());
+}
+
+template < class K >
+inline
+typename K::Boolean
+lexicographically_xyz_smaller(const Point_3<K> &p, const Point_3<K> &q)
+{
+  return internal::lexicographically_xyz_smaller(p, q, K());
+}
+
+template < class K >
+inline
+typename K::Boolean
+lexicographically_xyz_smaller_or_equal(const Point_3<K> &p,
+                                       const Point_3<K> &q)
+{
+  return internal::lexicographically_xyz_smaller_or_equal(p, q, K());
+}
+
+template < class K >
+inline
+typename K::Point_3
+midpoint(const Point_3<K> &p, const Point_3<K> &q)
+{
+  return internal::midpoint(p, q, K());
+}
+
+template < class K >
+inline
+typename K::Point_3
+max_vertex(const Iso_cuboid_3<K> &ic)
+{
+  return internal::max_vertex(ic, K());
+}
+
+template < class K >
+inline
+typename K::Point_3
+min_vertex(const Iso_cuboid_3<K> &ic)
+{
+  return internal::min_vertex(ic, K());
+}
+
+template < class K >
+inline
+typename K::Vector_3
+normal(const Point_3<K> &p, const Point_3<K> &q, const Point_3<K> &r)
+{
+  return internal::normal(p, q, r, K());
+}
+
+// FIXME TODO : what to do with the operators ?
+template < class K >
+inline
+typename K::Boolean
+operator==(const Point_3<K>& p, const Point_3<K>& q)
+{ return K().equal_3_object()(p, q); }
+
+template < class K >
+inline
+typename K::Boolean
+operator!=(const Point_3<K>& p, const Point_3<K>& q)
+{ return ! (p == q); }
+
+template < class K >
+inline
+typename K::Boolean
+operator==(const Point_3<K>& p, const Origin& o)
+{ return K().equal_3_object()(p, Point_3<K>(o)); }
+
+template < class K >
+inline
+typename K::Boolean
+operator!=(const Point_3<K>& p, const Origin& o)
+{ return ! (p == o); }
+
+template < class K >
+inline
+typename K::Boolean
+operator==(const Iso_cuboid_3<K>& p, const Iso_cuboid_3<K>& q)
+{ return K().equal_3_object()(p, q); }
+
+template < class K >
+inline
+typename K::Boolean
+operator!=(const Iso_cuboid_3<K>& p, const Iso_cuboid_3<K>& q)
+{ return ! (p == q); }
+
+template < class K >
+inline
+typename K::Boolean
+operator==(const Plane_3<K>& p, const Plane_3<K>& q)
+{ return K().equal_3_object()(p, q); }
+
+template < class K >
+inline
+typename K::Boolean
+operator!=(const Plane_3<K>& p, const Plane_3<K>& q)
+{ return ! (p == q); }
+
+template < class K >
+inline
+typename K::Boolean
+operator==(const Segment_3<K>& p, const Segment_3<K>& q)
+{ return K().equal_3_object()(p, q); }
+
+template < class K >
+inline
+typename K::Boolean
+operator!=(const Segment_3<K>& p, const Segment_3<K>& q)
+{ return ! (p == q); }
+
+template < class K >
+inline
+typename K::Boolean
+operator==(const Line_3<K>& p, const Line_3<K>& q)
+{ return K().equal_3_object()(p, q); }
+
+template < class K >
+inline
+typename K::Boolean
+operator!=(const Line_3<K>& p, const Line_3<K>& q)
+{ return ! (p == q); }
+
+template < class K >
+inline
+typename K::Boolean
+operator==(const Ray_3<K>& p, const Ray_3<K>& q)
+{ return K().equal_3_object()(p, q); }
+
+template < class K >
+inline
+typename K::Boolean
+operator!=(const Ray_3<K>& p, const Ray_3<K>& q)
+{ return ! (p == q); }
+
+template < class K >
+inline
+typename K::Boolean
+operator==(const Triangle_3<K>& p, const Triangle_3<K>& q)
+{ return K().equal_3_object()(p, q); }
+
+template < class K >
+inline
+typename K::Boolean
+operator!=(const Triangle_3<K>& p, const Triangle_3<K>& q)
+{ return ! (p == q); }
+
+template < class K >
+inline
+typename K::Boolean
+operator==(const Tetrahedron_3<K>& p, const Tetrahedron_3<K>& q)
+{ return K().equal_3_object()(p, q); }
+
+template < class K >
+inline
+typename K::Boolean
+operator!=(const Tetrahedron_3<K>& p, const Tetrahedron_3<K>& q)
+{ return ! (p == q); }
+
+template < class K >
+inline
+typename K::Boolean
+operator==(const Direction_3<K>& p, const Direction_3<K>& q)
+{ return K().equal_3_object()(p, q); }
+
+template < class K >
+inline
+typename K::Boolean
+operator!=(const Direction_3<K>& p, const Direction_3<K>& q)
+{ return ! (p == q); }
+
+template < class K >
+inline
+typename K::Boolean
+operator==(const Sphere_3<K>& p, const Sphere_3<K>& q)
+{ return K().equal_3_object()(p, q); }
+
+template < class K >
+inline
+typename K::Boolean
+operator!=(const Sphere_3<K>& p, const Sphere_3<K>& q)
+{ return ! (p == q); }
+
+template < class K >
+inline
+typename K::Boolean
+operator==(const Vector_3<K>& p, const Vector_3<K>& q)
+{ return K().equal_3_object()(p, q); }
+
+template < class K >
+inline
+typename K::Boolean
+operator!=(const Vector_3<K>& p, const Vector_3<K>& q)
+{ return ! (p == q); }
+
+template < class K >
+inline
+typename K::Boolean
+operator==(const Vector_3<K>& p, const Null_vector& o)
+{ return K().equal_3_object()(p, Vector_3<K>(o)); }
+
+template < class K >
+inline
+typename K::Boolean
+operator!=(const Vector_3<K>& p, const Null_vector& o)
+{ return ! (p == o); }
+
+
+template < class K >
+inline
+typename K::Boolean
+operator<(const Point_3<K>& p, const Point_3<K>& q)
+{ return K().less_xyz_3_object()(p, q); }
+
+template < class K >
+inline
+typename K::Boolean
+operator>(const Point_3<K>& p, const Point_3<K>& q)
+{ return K().less_xyz_3_object()(q, p); }
+
+template < class K >
+inline
+typename K::Boolean
+operator<=(const Point_3<K>& p, const Point_3<K>& q)
+{ return ! K().less_xyz_3_object()(q, p); }
+
+template < class K >
+inline
+typename K::Boolean
+operator>=(const Point_3<K>& p, const Point_3<K>& q)
+{ return ! K().less_xyz_3_object()(p, q); }
+
+template < class K >
+inline
+typename K::Vector_3
+operator*(const typename K::FT &c, const Vector_3<K> &w)
+{
+  return K().construct_scaled_vector_3_object()(w, c);
+}
+
+template < class K >
+inline
+typename K::Vector_3
+operator*(const Vector_3<K> &w, const typename K::FT &c)
+{
+  return K().construct_scaled_vector_3_object()(w, c);
+}
+
+template < class K >
+inline
+typename K::Vector_3
+operator*(const typename First_if_different<typename K::RT,
+                                            typename K::FT>::Type &c,
+          const Vector_3<K> &w)
+{
+  return K().construct_scaled_vector_3_object()(w, c);
+}
+
+template < class K >
+inline
+typename K::Vector_3
+operator*(const Vector_3<K> &w,
+          const typename First_if_different<typename K::RT,
+                                            typename K::FT>::Type &c)
+{
+  return K().construct_scaled_vector_3_object()(w, c);
+}
+
+template < class K >
+inline
+typename K::FT
+operator*(const Vector_3<K> &v, const Vector_3<K> &w)
+{
+  return K().compute_scalar_product_3_object()(v, w);
+}
+
+
+template < class K >
+inline
+typename K::Point_3
+operator+(const Point_3<K> &p, const Vector_3<K> &v)
+{
+  return K().construct_translated_point_3_object()(p, v);
+}
+
+template < class K >
+inline
+typename K::Point_3
+operator+(const Origin &o, const Vector_3<K> &v)
+{
+  return K().construct_translated_point_3_object()(o, v);
+}
+
+template < class K >
+inline
+typename K::Point_3
+operator-(const Point_3<K> &p, const Vector_3<K> &v)
+{
+  return K().construct_translated_point_3_object()
+               (p, K().construct_opposite_vector_3_object()(v));
+}
+
+template < class K >
+inline
+typename K::Point_3
+operator-(const Origin &o, const Vector_3<K> &v)
+{
+  return K().construct_translated_point_3_object()
+               (o, K().construct_opposite_vector_3_object()(v));
+}
+
+template < class K >
+inline
+typename K::Vector_3
+operator-(const Point_3<K> &p, const Point_3<K> &q)
+{
+  return K().construct_vector_3_object()(q, p);
+}
+
+template < class K >
+inline
+typename K::Vector_3
+operator-(const Point_3<K> &p, const Origin &o)
+{
+  return K().construct_vector_3_object()(o, p);
+}
+
+template < class K >
+inline
+typename K::Vector_3
+operator-(const Origin &o, const Point_3<K> &q)
+{
+  return K().construct_vector_3_object()(q, o);
+}
+
+template <class K >
+inline
+typename K::Orientation
+orientation(const Point_3<K> &p,
+            const Point_3<K> &q,
+            const Point_3<K> &r,
+            const Point_3<K> &s)
+{
+  return internal::orientation(p, q, r, s, K());
+}
+
+template <class K >
+inline
+typename K::Orientation
+orientation(const Vector_3<K> &u, const Vector_3<K> &v, const Vector_3<K> &w)
+{
+  return internal::orientation(u, v, w, K());
+}
+
+template <class K >
+inline
+typename K::Vector_3
+orthogonal_vector(const Point_3<K>& p,
+		  const Point_3<K>& q,
+		  const Point_3<K>& r)
+{
+  return internal::orthogonal_vector(p, q, r, K());
+}
+
+template <class K >
+inline
+typename K::Vector_3
+orthogonal_vector(const Plane_3<K>& p)
+{
+  return internal::orthogonal_vector(p, K());
+}
+
+// parallel() functions are in Kernel/global_functions.h
+
+template <class K>
+inline
+typename K::Plane_3
+radical_plane(const Sphere_3<K> &s1,
+              const Sphere_3<K> &s2)
+{
+  return K().construct_radical_plane_3_object()(s1,s2);
+}
+
+template < class K >
+inline
+typename K::FT
+scalar_product(const Vector_3<K> &v, const Vector_3<K> &w)
+{
+  return K().compute_scalar_product_3_object()(v, w);
+}
+
+template <class K >
+inline
+typename K::Bounded_side
+side_of_bounded_sphere(const Point_3<K> &p,
+                       const Point_3<K> &q,
+                       const Point_3<K> &test)
+{
+  return internal::side_of_bounded_sphere(p, q, test, K());
+}
+
+template <class K >
+inline
+typename K::Bounded_side
+side_of_bounded_sphere(const Point_3<K> &p,
+                       const Point_3<K> &q,
+                       const Point_3<K> &r,
+                       const Point_3<K> &test)
+{
+  return internal::side_of_bounded_sphere(p, q, r, test, K());
+}
+
+template <class K >
+inline
+typename K::Bounded_side
+side_of_bounded_sphere(const Point_3<K> &p,
+                       const Point_3<K> &q,
+                       const Point_3<K> &r,
+                       const Point_3<K> &s,
+                       const Point_3<K> &test)
+{
+  return internal::side_of_bounded_sphere(p, q, r, s, test, K());
+}
+
+template <class K >
+inline
+typename K::Oriented_side
+side_of_oriented_sphere(const Point_3<K> &p,
+                        const Point_3<K> &q,
+                        const Point_3<K> &r,
+                        const Point_3<K> &s,
+                        const Point_3<K> &test)
+{
+  return internal::side_of_oriented_sphere(p, q, r, s, test, K());
+}
+
+template <typename K>
+inline
+typename K::FT
+squared_area(const Point_3<K> &p, const Point_3<K> &q, const Point_3<K> &r)
+{
+  return internal::squared_area(p, q, r, K());
+}
+
+template < class K >
+inline
+typename K::FT
+squared_radius(const Point_3<K> &p, const Point_3<K> &q,
+	       const Point_3<K> &r, const Point_3<K> &s)
+{
+  return internal::squared_radius(p, q, r, s, K());
+}
+
+template < class K >
+inline
+typename K::FT
+squared_radius(const Point_3<K> &p, const Point_3<K> &q, const Point_3<K> &r)
+{
+  return internal::squared_radius(p, q, r, K());
+}
+
+template < class K >
+inline
+typename K::FT
+squared_radius(const Point_3<K> &p, const Point_3<K> &q)
+{
+  return internal::squared_radius(p, q, K());
+}
+
+template < class K >
+inline
+typename K::FT
+squared_radius(const Point_3<K> &p)
+{
+  return internal::squared_radius(p, K());
+}
+
+template < class K >
+inline
+typename K::Vector_3
+unit_normal(const Point_3<K> &p, const Point_3<K> &q, const Point_3<K> &r)
+{
+  return internal::unit_normal(p, q, r, K());
+}
+
+template < class K >
+inline
+typename K::FT
+volume(const Point_3<K> &p, const Point_3<K> &q,
+       const Point_3<K> &r, const Point_3<K> &s)
+{
+  return internal::volume(p, q, r, s, K());
+}
+
+template < class K >
+inline
+typename K::Boolean
+x_equal(const Point_3<K> &p, const Point_3<K> &q)
+{
+  return internal::x_equal(p, q, K());
+}
+
+template < class K >
+inline
+typename K::Boolean
+y_equal(const Point_3<K> &p, const Point_3<K> &q)
+{
+  return internal::y_equal(p, q, K());
+}
+
+template < class K >
+inline
+typename K::Boolean
+z_equal(const Point_3<K> &p, const Point_3<K> &q)
+{
+  return internal::z_equal(p, q, K());
+}
+
+} //namespace CGAL
+
+#endif  // CGAL_KERNEL_GLOBAL_FUNCTIONS_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel/global_functions_internal_2.h b/3rdparty/CGAL/include/CGAL/Kernel/global_functions_internal_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel/global_functions_internal_2.h
rename to 3rdparty/CGAL/include/CGAL/Kernel/global_functions_internal_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel/global_functions_internal_3.h b/3rdparty/CGAL/include/CGAL/Kernel/global_functions_internal_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel/global_functions_internal_3.h
rename to 3rdparty/CGAL/include/CGAL/Kernel/global_functions_internal_3.h
diff --git a/3rdparty/CGAL/include/CGAL/Kernel/interface_macros.h b/3rdparty/CGAL/include/CGAL/Kernel/interface_macros.h
new file mode 100644
index 0000000..e4769ba
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Kernel/interface_macros.h
@@ -0,0 +1,563 @@
+// Copyright (c) 2000-2004  
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved. 
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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(s)     : Herve Bronnimann, Sylvain Pion, Susan Hert
+
+// This file is intentionally not protected against re-inclusion.
+// It's aimed at being included from within a kernel traits class, this
+// way we share more code.
+
+// It is the responsability of the including file to correctly set the 2
+// macros CGAL_Kernel_pred, CGAL_Kernel_cons and CGAL_Kernel_obj.
+// And they are #undefed at the end of this file.
+
+#ifndef CGAL_Kernel_pred
+#  define CGAL_Kernel_pred(X, Y)
+#endif
+
+// Those predicates for which Simple_cartesian is guaranteed not to use
+// any division.
+#ifndef CGAL_Kernel_pred_RT
+#  define CGAL_Kernel_pred_RT(X, Y) CGAL_Kernel_pred(X, Y)
+#endif
+
+#ifndef CGAL_Kernel_cons
+#  define CGAL_Kernel_cons(X, Y)
+#endif
+
+#ifndef CGAL_Kernel_obj
+#  define CGAL_Kernel_obj(X)
+#endif
+
+CGAL_Kernel_obj(Point_2)
+CGAL_Kernel_obj(Vector_2)
+CGAL_Kernel_obj(Direction_2)
+CGAL_Kernel_obj(Segment_2)
+CGAL_Kernel_obj(Ray_2)
+CGAL_Kernel_obj(Line_2)
+CGAL_Kernel_obj(Triangle_2)
+CGAL_Kernel_obj(Iso_rectangle_2)
+CGAL_Kernel_obj(Circle_2)
+
+CGAL_Kernel_obj(Point_3)
+CGAL_Kernel_obj(Plane_3)
+CGAL_Kernel_obj(Vector_3)
+CGAL_Kernel_obj(Direction_3)
+CGAL_Kernel_obj(Segment_3)
+CGAL_Kernel_obj(Ray_3)
+CGAL_Kernel_obj(Line_3)
+CGAL_Kernel_obj(Triangle_3)
+CGAL_Kernel_obj(Tetrahedron_3)
+CGAL_Kernel_obj(Iso_cuboid_3)
+CGAL_Kernel_obj(Sphere_3)
+CGAL_Kernel_obj(Circle_3)
+
+
+CGAL_Kernel_pred(Angle_2,
+		 angle_2_object)
+CGAL_Kernel_pred(Angle_3,
+		 angle_3_object)
+CGAL_Kernel_pred(Are_ordered_along_line_2,
+		 are_ordered_along_line_2_object)
+CGAL_Kernel_pred(Are_ordered_along_line_3,
+		 are_ordered_along_line_3_object)
+CGAL_Kernel_pred(Are_parallel_2,
+		 are_parallel_2_object)
+CGAL_Kernel_pred(Are_parallel_3,
+		 are_parallel_3_object)
+CGAL_Kernel_pred(Are_strictly_ordered_along_line_2,
+		 are_strictly_ordered_along_line_2_object)
+CGAL_Kernel_pred(Are_strictly_ordered_along_line_3,
+		 are_strictly_ordered_along_line_3_object)
+CGAL_Kernel_cons(Assign_2,
+		 assign_2_object)
+CGAL_Kernel_cons(Assign_3,
+		 assign_3_object)
+CGAL_Kernel_pred(Bounded_side_2,
+		 bounded_side_2_object)
+CGAL_Kernel_pred(Bounded_side_3,
+		 bounded_side_3_object)
+CGAL_Kernel_pred(Collinear_are_ordered_along_line_2,
+		 collinear_are_ordered_along_line_2_object)
+CGAL_Kernel_pred(Collinear_are_ordered_along_line_3,
+		 collinear_are_ordered_along_line_3_object)
+CGAL_Kernel_pred(Collinear_are_strictly_ordered_along_line_2,
+		 collinear_are_strictly_ordered_along_line_2_object)
+CGAL_Kernel_pred(Collinear_are_strictly_ordered_along_line_3,
+		 collinear_are_strictly_ordered_along_line_3_object)
+CGAL_Kernel_pred(Collinear_has_on_2,
+		 collinear_has_on_2_object)
+CGAL_Kernel_pred(Collinear_2,
+		 collinear_2_object)
+CGAL_Kernel_pred(Collinear_3,
+		 collinear_3_object)
+CGAL_Kernel_pred(Compare_angle_with_x_axis_2,
+		 compare_angle_with_x_axis_2_object)
+CGAL_Kernel_pred(Compare_dihedral_angle_3,
+		 compare_dihedral_angle_3_object)
+CGAL_Kernel_pred(Compare_distance_2,
+		 compare_distance_2_object)
+CGAL_Kernel_pred_RT(Compare_distance_3,
+		    compare_distance_3_object)
+CGAL_Kernel_pred(Compare_slope_2,
+		 compare_slope_2_object)
+CGAL_Kernel_pred(Compare_squared_distance_2,
+		 compare_squared_distance_2_object)
+CGAL_Kernel_pred(Compare_squared_distance_3,
+		 compare_squared_distance_3_object)
+CGAL_Kernel_pred(Compare_squared_radius_3,
+		 compare_squared_radius_3_object)
+CGAL_Kernel_pred(Compare_x_at_y_2,
+		 compare_x_at_y_2_object)
+CGAL_Kernel_pred(Compare_xyz_3,
+		 compare_xyz_3_object)
+CGAL_Kernel_pred(Compare_xy_2,
+		 compare_xy_2_object)
+CGAL_Kernel_pred(Compare_xy_3,
+		 compare_xy_3_object)
+CGAL_Kernel_pred(Compare_x_2,
+		 compare_x_2_object)
+CGAL_Kernel_pred(Compare_x_3,
+		 compare_x_3_object)
+CGAL_Kernel_pred(Compare_y_at_x_2,
+		 compare_y_at_x_2_object)
+CGAL_Kernel_pred(Compare_y_2,
+		 compare_y_2_object)
+CGAL_Kernel_pred(Compare_y_3,
+		 compare_y_3_object)
+CGAL_Kernel_pred(Compare_yx_2,
+		 compare_yx_2_object)
+CGAL_Kernel_pred(Compare_z_3,
+		 compare_z_3_object)
+CGAL_Kernel_cons(Compute_a_2,
+		 compute_a_2_object)
+CGAL_Kernel_cons(Compute_a_3,
+		 compute_a_3_object)
+CGAL_Kernel_cons(Compute_b_2,
+		 compute_b_2_object)
+CGAL_Kernel_cons(Compute_b_3,
+		 compute_b_3_object)
+CGAL_Kernel_cons(Compute_c_2,
+		 compute_c_2_object)
+CGAL_Kernel_cons(Compute_c_3,
+		 compute_c_3_object)
+CGAL_Kernel_cons(Compute_d_3,
+		 compute_d_3_object)
+CGAL_Kernel_cons(Compute_approximate_area_3,
+                 compute_approximate_area_3_object)
+CGAL_Kernel_cons(Compute_approximate_squared_length_3,
+                 compute_approximate_squared_length_3_object)
+CGAL_Kernel_cons(Compute_area_2,
+		 compute_area_2_object)
+CGAL_Kernel_cons(Compute_area_3,
+		 compute_area_3_object)
+CGAL_Kernel_cons(Compute_area_divided_by_pi_3,
+		 compute_area_divided_by_pi_3_object)
+CGAL_Kernel_cons(Compute_determinant_2,
+		 compute_determinant_2_object)
+CGAL_Kernel_cons(Compute_determinant_3,
+		 compute_determinant_3_object)
+CGAL_Kernel_cons(Compute_scalar_product_2,
+		 compute_scalar_product_2_object)
+CGAL_Kernel_cons(Compute_scalar_product_3,
+		 compute_scalar_product_3_object)
+CGAL_Kernel_cons(Compute_squared_area_3,
+		 compute_squared_area_3_object)
+CGAL_Kernel_cons(Compute_squared_distance_2,
+		 compute_squared_distance_2_object)
+CGAL_Kernel_cons(Compute_squared_distance_3,
+		 compute_squared_distance_3_object)
+CGAL_Kernel_cons(Compute_squared_length_2,
+		 compute_squared_length_2_object)
+CGAL_Kernel_cons(Compute_squared_length_3,
+		 compute_squared_length_3_object)
+CGAL_Kernel_cons(Compute_squared_length_divided_by_pi_square_3,
+                 compute_squared_length_divided_by_pi_square_3_object)
+CGAL_Kernel_cons(Compute_squared_radius_2,
+		 compute_squared_radius_2_object)
+CGAL_Kernel_cons(Compute_squared_radius_3,
+		 compute_squared_radius_3_object)
+CGAL_Kernel_cons(Compute_volume_3,
+		 compute_volume_3_object)
+CGAL_Kernel_cons(Compute_x_2,
+		 compute_x_2_object)
+CGAL_Kernel_cons(Compute_x_3,
+		 compute_x_3_object)
+CGAL_Kernel_cons(Compute_y_2,
+		 compute_y_2_object)
+CGAL_Kernel_cons(Compute_y_3,
+		 compute_y_3_object)
+CGAL_Kernel_cons(Compute_z_3,
+		 compute_z_3_object)
+CGAL_Kernel_cons(Compute_dx_2,
+		 compute_dx_2_object)
+CGAL_Kernel_cons(Compute_dx_3,
+		 compute_dx_3_object)
+CGAL_Kernel_cons(Compute_dy_2,
+		 compute_dy_2_object)
+CGAL_Kernel_cons(Compute_dy_3,
+		 compute_dy_3_object)
+CGAL_Kernel_cons(Compute_dz_3,
+		 compute_dz_3_object)
+CGAL_Kernel_cons(Compute_hx_2,
+		 compute_hx_2_object)
+CGAL_Kernel_cons(Compute_hx_3,
+		 compute_hx_3_object)
+CGAL_Kernel_cons(Compute_hy_2,
+		 compute_hy_2_object)
+CGAL_Kernel_cons(Compute_hy_3,
+		 compute_hy_3_object)
+CGAL_Kernel_cons(Compute_hz_3,
+		 compute_hz_3_object)
+CGAL_Kernel_cons(Compute_hw_2,
+		 compute_hw_2_object)
+CGAL_Kernel_cons(Compute_hw_3,
+		 compute_hw_3_object)
+CGAL_Kernel_cons(Compute_x_at_y_2,
+		 compute_x_at_y_2_object)
+CGAL_Kernel_cons(Compute_y_at_x_2,
+		 compute_y_at_x_2_object)
+CGAL_Kernel_cons(Compute_xmin_2,
+		 compute_xmin_2_object)
+CGAL_Kernel_cons(Compute_xmax_2,
+		 compute_xmax_2_object)
+CGAL_Kernel_cons(Compute_ymin_2,
+		 compute_ymin_2_object)
+CGAL_Kernel_cons(Compute_ymax_2,
+		 compute_ymax_2_object)
+CGAL_Kernel_cons(Compute_xmin_3,
+		 compute_xmin_3_object)
+CGAL_Kernel_cons(Compute_xmax_3,
+		 compute_xmax_3_object)
+CGAL_Kernel_cons(Compute_ymin_3,
+		 compute_ymin_3_object)
+CGAL_Kernel_cons(Compute_ymax_3,
+		 compute_ymax_3_object)
+CGAL_Kernel_cons(Compute_zmin_3,
+		 compute_zmin_3_object)
+CGAL_Kernel_cons(Compute_zmax_3,
+		 compute_zmax_3_object)
+CGAL_Kernel_cons(Construct_barycenter_2,
+		 construct_barycenter_2_object)
+CGAL_Kernel_cons(Construct_barycenter_3,
+		 construct_barycenter_3_object)
+CGAL_Kernel_cons(Construct_base_vector_3,
+		 construct_base_vector_3_object)
+CGAL_Kernel_cons(Construct_bisector_2,
+		 construct_bisector_2_object)
+CGAL_Kernel_cons(Construct_bisector_3,
+		 construct_bisector_3_object)
+CGAL_Kernel_cons(Construct_center_2,
+		 construct_center_2_object)
+CGAL_Kernel_cons(Construct_center_3,
+		 construct_center_3_object)
+CGAL_Kernel_cons(Construct_centroid_2,
+		 construct_centroid_2_object)
+CGAL_Kernel_cons(Construct_centroid_3,
+		 construct_centroid_3_object)
+CGAL_Kernel_cons(Construct_circle_2,
+		 construct_circle_2_object)
+CGAL_Kernel_cons(Construct_circle_3,
+		 construct_circle_3_object)
+CGAL_Kernel_cons(Construct_circumcenter_2,
+		 construct_circumcenter_2_object)
+CGAL_Kernel_cons(Construct_circumcenter_3,
+		 construct_circumcenter_3_object)
+CGAL_Kernel_cons(Construct_cross_product_vector_3,
+		 construct_cross_product_vector_3_object)
+CGAL_Kernel_cons(Construct_direction_2,
+		 construct_direction_2_object)
+CGAL_Kernel_cons(Construct_direction_3,
+		 construct_direction_3_object)
+CGAL_Kernel_cons(Construct_equidistant_line_3,
+		 construct_equidistant_line_3_object)
+CGAL_Kernel_cons(Construct_iso_cuboid_3,
+		 construct_iso_cuboid_3_object)
+CGAL_Kernel_cons(Construct_iso_rectangle_2,
+		 construct_iso_rectangle_2_object)
+CGAL_Kernel_cons(Construct_lifted_point_3,
+		 construct_lifted_point_3_object)
+CGAL_Kernel_cons(Construct_line_2,
+		 construct_line_2_object)
+CGAL_Kernel_cons(Construct_line_3,
+		 construct_line_3_object)
+CGAL_Kernel_cons(Construct_midpoint_2,
+		 construct_midpoint_2_object)
+CGAL_Kernel_cons(Construct_midpoint_3,
+		 construct_midpoint_3_object)
+CGAL_Kernel_cons(Construct_min_vertex_2,
+                 construct_min_vertex_2_object)
+CGAL_Kernel_cons(Construct_max_vertex_2,
+                 construct_max_vertex_2_object)
+CGAL_Kernel_cons(Construct_min_vertex_3,
+                 construct_min_vertex_3_object)
+CGAL_Kernel_cons(Construct_max_vertex_3,
+                 construct_max_vertex_3_object)
+CGAL_Kernel_cons(Construct_normal_3,
+                 construct_normal_3_object)
+CGAL_Kernel_cons(Construct_object_2,
+                 construct_object_2_object)
+CGAL_Kernel_cons(Construct_object_3,
+                 construct_object_3_object)
+CGAL_Kernel_cons(Construct_opposite_circle_2,
+		 construct_opposite_circle_2_object)
+CGAL_Kernel_cons(Construct_opposite_direction_2,
+		 construct_opposite_direction_2_object)
+CGAL_Kernel_cons(Construct_opposite_direction_3,
+		 construct_opposite_direction_3_object)
+CGAL_Kernel_cons(Construct_opposite_line_2,
+		 construct_opposite_line_2_object)
+CGAL_Kernel_cons(Construct_opposite_line_3,
+		 construct_opposite_line_3_object)
+CGAL_Kernel_cons(Construct_opposite_plane_3,
+		 construct_opposite_plane_3_object)
+CGAL_Kernel_cons(Construct_opposite_ray_2,
+		 construct_opposite_ray_2_object)
+CGAL_Kernel_cons(Construct_opposite_ray_3,
+		 construct_opposite_ray_3_object)
+CGAL_Kernel_cons(Construct_opposite_segment_2,
+		 construct_opposite_segment_2_object)
+CGAL_Kernel_cons(Construct_opposite_segment_3,
+		 construct_opposite_segment_3_object)
+CGAL_Kernel_cons(Construct_opposite_sphere_3,
+		 construct_opposite_sphere_3_object)
+CGAL_Kernel_cons(Construct_opposite_triangle_2,
+		 construct_opposite_triangle_2_object)
+CGAL_Kernel_cons(Construct_opposite_vector_2,
+		 construct_opposite_vector_2_object)
+CGAL_Kernel_cons(Construct_difference_of_vectors_2,
+		 construct_difference_of_vectors_2_object)
+CGAL_Kernel_cons(Construct_difference_of_vectors_3,
+		 construct_difference_of_vectors_3_object)
+CGAL_Kernel_cons(Construct_sum_of_vectors_2,
+		 construct_sum_of_vectors_2_object)
+CGAL_Kernel_cons(Construct_sum_of_vectors_3,
+		 construct_sum_of_vectors_3_object)
+CGAL_Kernel_cons(Construct_opposite_vector_3,
+		 construct_opposite_vector_3_object)
+CGAL_Kernel_cons(Construct_orthogonal_vector_3,
+		 construct_orthogonal_vector_3_object)
+CGAL_Kernel_cons(Construct_perpendicular_direction_2,
+		 construct_perpendicular_direction_2_object)
+CGAL_Kernel_cons(Construct_perpendicular_line_2,
+		 construct_perpendicular_line_2_object)
+CGAL_Kernel_cons(Construct_perpendicular_line_3,
+		 construct_perpendicular_line_3_object)
+CGAL_Kernel_cons(Construct_perpendicular_plane_3,
+		 construct_perpendicular_plane_3_object)
+CGAL_Kernel_cons(Construct_perpendicular_vector_2,
+		 construct_perpendicular_vector_2_object)
+CGAL_Kernel_cons(Construct_plane_3,
+		 construct_plane_3_object)
+CGAL_Kernel_cons(Construct_point_on_2,
+		 construct_point_on_2_object)
+CGAL_Kernel_cons(Construct_point_on_3,
+		 construct_point_on_3_object)
+CGAL_Kernel_cons(Construct_point_2,
+		 construct_point_2_object)
+CGAL_Kernel_cons(Construct_point_3,
+		 construct_point_3_object)
+CGAL_Kernel_cons(Construct_projected_point_2,
+		 construct_projected_point_2_object)
+CGAL_Kernel_cons(Construct_projected_point_3,
+		 construct_projected_point_3_object)
+CGAL_Kernel_cons(Construct_projected_xy_point_2,
+		 construct_projected_xy_point_2_object)
+CGAL_Kernel_cons(Construct_radical_line_2,
+     construct_radical_line_2_object)		
+CGAL_Kernel_cons(Construct_radical_plane_3,
+                 construct_radical_plane_3_object)
+CGAL_Kernel_cons(Construct_ray_2,
+		 construct_ray_2_object)
+CGAL_Kernel_cons(Construct_ray_3,
+		 construct_ray_3_object)
+CGAL_Kernel_cons(Construct_scaled_vector_2,
+		 construct_scaled_vector_2_object)
+CGAL_Kernel_cons(Construct_divided_vector_2,
+		 construct_divided_vector_2_object)
+CGAL_Kernel_cons(Construct_divided_vector_3,
+		 construct_divided_vector_3_object)
+CGAL_Kernel_cons(Construct_scaled_vector_3,
+		 construct_scaled_vector_3_object)
+CGAL_Kernel_cons(Construct_second_point_2,
+		 construct_second_point_2_object)
+CGAL_Kernel_cons(Construct_second_point_3,
+		 construct_second_point_3_object)
+CGAL_Kernel_cons(Construct_segment_2,
+		 construct_segment_2_object)
+CGAL_Kernel_cons(Construct_segment_3,
+		 construct_segment_3_object)
+CGAL_Kernel_cons(Construct_source_2,
+		 construct_source_2_object)
+CGAL_Kernel_cons(Construct_source_3,
+		 construct_source_3_object)
+CGAL_Kernel_cons(Construct_sphere_3,
+		 construct_sphere_3_object)
+CGAL_Kernel_cons(Construct_supporting_plane_3,
+		 construct_supporting_plane_3_object)
+CGAL_Kernel_cons(Construct_target_2,
+		 construct_target_2_object)
+CGAL_Kernel_cons(Construct_target_3,
+		 construct_target_3_object)
+CGAL_Kernel_cons(Construct_tetrahedron_3,
+		 construct_tetrahedron_3_object)
+CGAL_Kernel_cons(Construct_translated_point_2,
+		 construct_translated_point_2_object)
+CGAL_Kernel_cons(Construct_translated_point_3,
+		 construct_translated_point_3_object)
+CGAL_Kernel_cons(Construct_triangle_2,
+		 construct_triangle_2_object)
+CGAL_Kernel_cons(Construct_triangle_3,
+		 construct_triangle_3_object)
+CGAL_Kernel_cons(Construct_unit_normal_3,
+                 construct_unit_normal_3_object)
+CGAL_Kernel_cons(Construct_vector_2,
+		 construct_vector_2_object)
+CGAL_Kernel_cons(Construct_vector_3,
+		 construct_vector_3_object)
+CGAL_Kernel_cons(Construct_vertex_2,
+		 construct_vertex_2_object)
+CGAL_Kernel_cons(Construct_vertex_3,
+		 construct_vertex_3_object)
+CGAL_Kernel_cons(Construct_bbox_2,
+		 construct_bbox_2_object)
+CGAL_Kernel_cons(Construct_bbox_3,
+		 construct_bbox_3_object)
+CGAL_Kernel_cons(Construct_cartesian_const_iterator_2,
+		 construct_cartesian_const_iterator_2_object)
+CGAL_Kernel_cons(Construct_cartesian_const_iterator_3,
+		 construct_cartesian_const_iterator_3_object)
+CGAL_Kernel_pred(Coplanar_orientation_3,
+		 coplanar_orientation_3_object)
+CGAL_Kernel_pred(Coplanar_side_of_bounded_circle_3,
+		 coplanar_side_of_bounded_circle_3_object)
+CGAL_Kernel_pred(Coplanar_3,
+		 coplanar_3_object)
+CGAL_Kernel_pred(Counterclockwise_in_between_2,
+		 counterclockwise_in_between_2_object)
+CGAL_Kernel_pred(Do_intersect_2,
+		 do_intersect_2_object)
+CGAL_Kernel_pred(Do_intersect_3,
+		 do_intersect_3_object)
+CGAL_Kernel_pred(Equal_xy_3,
+		 equal_xy_3_object)
+CGAL_Kernel_pred(Equal_x_2,
+		 equal_x_2_object)
+CGAL_Kernel_pred(Equal_x_3,
+		 equal_x_3_object)
+CGAL_Kernel_pred(Equal_y_2,
+		 equal_y_2_object)
+CGAL_Kernel_pred(Equal_y_3,
+		 equal_y_3_object)
+CGAL_Kernel_pred(Equal_z_3,
+		 equal_z_3_object)
+CGAL_Kernel_pred(Equal_2,
+		 equal_2_object)
+CGAL_Kernel_pred(Equal_3,
+		 equal_3_object)
+CGAL_Kernel_pred(Has_on_boundary_2,
+		 has_on_boundary_2_object)
+CGAL_Kernel_pred(Has_on_boundary_3,
+		 has_on_boundary_3_object)
+CGAL_Kernel_pred(Has_on_bounded_side_2,
+		 has_on_bounded_side_2_object)
+CGAL_Kernel_pred(Has_on_bounded_side_3,
+		 has_on_bounded_side_3_object)
+CGAL_Kernel_pred(Has_on_negative_side_2,
+		 has_on_negative_side_2_object)
+CGAL_Kernel_pred(Has_on_negative_side_3,
+		 has_on_negative_side_3_object)
+CGAL_Kernel_pred(Has_on_positive_side_2,
+		 has_on_positive_side_2_object)
+CGAL_Kernel_pred(Has_on_positive_side_3,
+		 has_on_positive_side_3_object)
+CGAL_Kernel_pred(Has_on_unbounded_side_2,
+		 has_on_unbounded_side_2_object)
+CGAL_Kernel_pred(Has_on_unbounded_side_3,
+		 has_on_unbounded_side_3_object)
+CGAL_Kernel_pred(Has_on_2,
+		 has_on_2_object)
+CGAL_Kernel_pred(Has_on_3,
+		 has_on_3_object)
+CGAL_Kernel_cons(Intersect_2,
+		 intersect_2_object)
+CGAL_Kernel_cons(Intersect_3,
+		 intersect_3_object)
+CGAL_Kernel_pred(Is_degenerate_2,
+		 is_degenerate_2_object)
+CGAL_Kernel_pred(Is_degenerate_3,
+		 is_degenerate_3_object)
+CGAL_Kernel_pred(Is_horizontal_2,
+		 is_horizontal_2_object)
+CGAL_Kernel_pred(Is_vertical_2,
+		 is_vertical_2_object)
+CGAL_Kernel_pred(Left_turn_2,
+                 left_turn_2_object)
+CGAL_Kernel_pred(Less_distance_to_point_2,
+                 less_distance_to_point_2_object)
+CGAL_Kernel_pred(Less_distance_to_point_3,
+                 less_distance_to_point_3_object)
+CGAL_Kernel_pred(Less_rotate_ccw_2,
+		 less_rotate_ccw_2_object)
+CGAL_Kernel_pred(Less_signed_distance_to_line_2,
+                 less_signed_distance_to_line_2_object)
+CGAL_Kernel_pred(Less_signed_distance_to_plane_3,
+		 less_signed_distance_to_plane_3_object)
+CGAL_Kernel_pred(Less_xyz_3,
+		 less_xyz_3_object)
+CGAL_Kernel_pred(Less_xy_2,
+		 less_xy_2_object)
+CGAL_Kernel_pred(Less_xy_3,
+		 less_xy_3_object)
+CGAL_Kernel_pred(Less_x_2,
+		 less_x_2_object)
+CGAL_Kernel_pred(Less_x_3,
+		 less_x_3_object)
+CGAL_Kernel_pred(Less_yx_2,
+		 less_yx_2_object)
+CGAL_Kernel_pred(Less_y_2,
+		 less_y_2_object)
+CGAL_Kernel_pred(Less_y_3,
+		 less_y_3_object)
+CGAL_Kernel_pred(Less_z_3,
+		 less_z_3_object)
+CGAL_Kernel_pred_RT(Orientation_2,
+		    orientation_2_object)
+CGAL_Kernel_pred_RT(Orientation_3,
+		    orientation_3_object)
+CGAL_Kernel_pred(Oriented_side_2,
+		 oriented_side_2_object)
+CGAL_Kernel_pred(Oriented_side_3,
+		 oriented_side_3_object)
+CGAL_Kernel_pred_RT(Side_of_bounded_circle_2,
+		    side_of_bounded_circle_2_object)
+CGAL_Kernel_pred_RT(Side_of_bounded_sphere_3,
+		    side_of_bounded_sphere_3_object)
+CGAL_Kernel_pred_RT(Side_of_oriented_circle_2,
+		    side_of_oriented_circle_2_object)
+CGAL_Kernel_pred_RT(Side_of_oriented_sphere_3,
+		    side_of_oriented_sphere_3_object)
+
+#undef CGAL_Kernel_pred_RT
+#undef CGAL_Kernel_pred
+#undef CGAL_Kernel_cons
+#undef CGAL_Kernel_obj
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel/mpl.h b/3rdparty/CGAL/include/CGAL/Kernel/mpl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel/mpl.h
rename to 3rdparty/CGAL/include/CGAL/Kernel/mpl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel/solve.h b/3rdparty/CGAL/include/CGAL/Kernel/solve.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel/solve.h
rename to 3rdparty/CGAL/include/CGAL/Kernel/solve.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_checker.h b/3rdparty/CGAL/include/CGAL/Kernel_checker.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_checker.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_checker.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Aff_transformationCd.h b/3rdparty/CGAL/include/CGAL/Kernel_d/Aff_transformationCd.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Aff_transformationCd.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/Aff_transformationCd.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Aff_transformationHd.h b/3rdparty/CGAL/include/CGAL/Kernel_d/Aff_transformationHd.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Aff_transformationHd.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/Aff_transformationHd.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Aff_transformation_d.h b/3rdparty/CGAL/include/CGAL/Kernel_d/Aff_transformation_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Aff_transformation_d.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/Aff_transformation_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Cartesian_const_iterator_d.h b/3rdparty/CGAL/include/CGAL/Kernel_d/Cartesian_const_iterator_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Cartesian_const_iterator_d.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/Cartesian_const_iterator_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Cartesian_converter_d.h b/3rdparty/CGAL/include/CGAL/Kernel_d/Cartesian_converter_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Cartesian_converter_d.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/Cartesian_converter_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/DirectionCd.h b/3rdparty/CGAL/include/CGAL/Kernel_d/DirectionCd.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/DirectionCd.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/DirectionCd.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/DirectionCd_impl.h b/3rdparty/CGAL/include/CGAL/Kernel_d/DirectionCd_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/DirectionCd_impl.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/DirectionCd_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/DirectionHd.h b/3rdparty/CGAL/include/CGAL/Kernel_d/DirectionHd.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/DirectionHd.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/DirectionHd.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/DirectionHd_impl.h b/3rdparty/CGAL/include/CGAL/Kernel_d/DirectionHd_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/DirectionHd_impl.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/DirectionHd_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Direction_d.h b/3rdparty/CGAL/include/CGAL/Kernel_d/Direction_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Direction_d.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/Direction_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/HyperplaneCd.h b/3rdparty/CGAL/include/CGAL/Kernel_d/HyperplaneCd.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/HyperplaneCd.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/HyperplaneCd.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/HyperplaneCd_impl.h b/3rdparty/CGAL/include/CGAL/Kernel_d/HyperplaneCd_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/HyperplaneCd_impl.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/HyperplaneCd_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/HyperplaneHd.h b/3rdparty/CGAL/include/CGAL/Kernel_d/HyperplaneHd.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/HyperplaneHd.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/HyperplaneHd.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/HyperplaneHd_impl.h b/3rdparty/CGAL/include/CGAL/Kernel_d/HyperplaneHd_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/HyperplaneHd_impl.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/HyperplaneHd_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Hyperplane_d.h b/3rdparty/CGAL/include/CGAL/Kernel_d/Hyperplane_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Hyperplane_d.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/Hyperplane_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Interface_classes.h b/3rdparty/CGAL/include/CGAL/Kernel_d/Interface_classes.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Interface_classes.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/Interface_classes.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Interval_linear_algebra.h b/3rdparty/CGAL/include/CGAL/Kernel_d/Interval_linear_algebra.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Interval_linear_algebra.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/Interval_linear_algebra.h
diff --git a/3rdparty/CGAL/include/CGAL/Kernel_d/Iso_box_d.h b/3rdparty/CGAL/include/CGAL/Kernel_d/Iso_box_d.h
new file mode 100644
index 0000000..687a09a
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Kernel_d/Iso_box_d.h
@@ -0,0 +1,410 @@
+// Copyright (c) 2002  
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved. 
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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$
+// 
+//
+// Authors       : Hans Tangelder <hanst at cs.uu.nl>, Michael Hoffmann
+
+#ifndef CGAL_ISO_BOX_D_H
+#define CGAL_ISO_BOX_D_H
+
+#include <CGAL/basic.h>
+#include <CGAL/Handle_for.h>
+#include <CGAL/representation_tags.h> 
+#include <CGAL/Dimension.h>
+#include <functional>
+#include <algorithm>
+#include <numeric>
+#include <cstddef>
+
+namespace CGAL {
+  
+  namespace Kernel_d {
+    struct Begin {};
+    struct End {};
+    struct Cartesian_end {};
+  } // namespace Kernel_d
+  
+  template < typename Point_, typename Functor_ >
+  struct Cartesian_iterator {
+    typedef Point_                                    Point;
+    typedef Functor_                                  Functor;
+    typedef typename Point::Cartesian_const_iterator  Iterator;
+    typedef Cartesian_iterator<Point,Functor>         Self;
+
+    typedef typename Functor::result_type  value_type;
+    typedef value_type&                    reference;
+    typedef value_type*                    pointer;
+    typedef std::ptrdiff_t                 difference_type;
+    typedef std::input_iterator_tag        iterator_category;
+      
+  protected:
+      
+    Iterator pb, qb;
+    Functor f;
+      
+  public:
+      
+    Cartesian_iterator(const Point& p, const Point& q, Kernel_d::Begin)
+      : pb(p.cartesian_begin()), qb(q.cartesian_begin())
+    {}
+    
+    Cartesian_iterator(const Point& p, const Point& q, Kernel_d::End)
+      : pb(p.cartesian_end()), qb(q.cartesian_end())
+    {}
+    
+    Cartesian_iterator(const Point& p, const Point& q, Kernel_d::Cartesian_end)
+      : pb(p.cartesian_end()), qb(q.cartesian_end())
+    {}
+    
+    Cartesian_iterator(const Point& p, const Point& q, const Functor& f_,
+		       Kernel_d::Begin) 
+      : pb(p.cartesian_begin()), qb(q.cartesian_begin()), f(f_) 
+    {}
+      
+    Cartesian_iterator(const Point& p, const Point& q, const Functor& f_,
+		       Kernel_d::End) 
+      : pb(p.cartesian_end()), qb(q.cartesian_end()), f(f_) 
+    {}
+      
+    Cartesian_iterator(const Point& p, const Point& q, const Functor& f_,
+		       Kernel_d::Cartesian_end) 
+      : pb(p.cartesian_end()), qb(q.cartesian_end()), f(f_) 
+    {}
+      
+    Self& operator++() { ++pb; ++qb; return *this; }
+      
+    Self operator++(int) {
+      Self tmp(*this);
+      ++(*this);
+      return tmp;
+    }
+    
+    value_type operator*()  const { return f(*pb, *qb); }
+    pointer    operator->() const { return &(**this); }
+      
+    const Functor& functor() const { return f; }
+    Iterator base_p() const { return pb; }
+    Iterator base_q() const { return qb; }
+  };
+  
+  template < typename Iterator, typename Functor > inline
+  bool operator==(const Cartesian_iterator<Iterator,Functor>& x, 
+		  const Cartesian_iterator<Iterator,Functor>& y)
+  {
+    return x.base_p() == y.base_p() && x.base_q() == y.base_q(); 
+  }
+  
+  template < typename Iterator, typename Functor > inline
+  bool operator!=(const Cartesian_iterator<Iterator,Functor>& x, 
+		  const Cartesian_iterator<Iterator,Functor>& y)
+  {
+    return ! (x == y);
+  }
+  
+  template < typename Point_, typename Functor_ >
+  struct Homogeneous_iterator {
+    typedef Point_                                      Point;
+    typedef Functor_                                    Functor;
+    typedef typename Point::Homogeneous_const_iterator  Iterator;
+    typedef Homogeneous_iterator<Point,Functor>         Self;
+
+    typedef typename Functor::result_type  value_type;
+    typedef value_type&                    reference;
+    typedef value_type*                    pointer;
+    typedef std::ptrdiff_t                 difference_type;
+    typedef std::input_iterator_tag        iterator_category;
+      
+  protected:
+      
+    Iterator pb, qb;
+    Functor f;
+    typedef typename Kernel_traits<Point>::Kernel::RT RT;
+    RT hp, hq; // homogenizing coordinates
+    
+  public:
+      
+    Homogeneous_iterator(const Point& p, const Point& q, Kernel_d::Begin)
+      : pb(p.homogeneous_begin()), qb(q.homogeneous_begin()),
+	hp(p.homogeneous(p.dimension())), hq(q.homogeneous(q.dimension()))
+    {}
+    
+    Homogeneous_iterator(const Point& p, const Point& q, Kernel_d::End)
+      : pb(p.homogeneous_end()), qb(q.homogeneous_end()),
+	hp(p.homogeneous(p.dimension())), hq(q.homogeneous(q.dimension()))
+    {}
+    
+    Homogeneous_iterator(const Point& p, const Point& q, 
+			 Kernel_d::Cartesian_end)
+      : pb(p.homogeneous_end()), qb(q.homogeneous_end()),
+	hp(p.homogeneous(p.dimension())), hq(q.homogeneous(q.dimension()))
+    {
+      --pb; --qb;
+    }
+    
+    Homogeneous_iterator(const Point& p, const Point& q, const Functor& f_,
+			 Kernel_d::Begin) 
+      : pb(p.homogeneous_begin()), qb(q.homogeneous_begin()), f(f_),
+	hp(p.homogeneous(p.dimension())), hq(q.homogeneous(q.dimension()))
+    {}
+    
+    Homogeneous_iterator(const Point& p, const Point& q, const Functor& f_,
+			 Kernel_d::End) 
+      : pb(p.homogeneous_end()), qb(q.homogeneous_end()), f(f_),
+	hp(p.homogeneous(p.dimension())), hq(q.homogeneous(q.dimension()))
+    {}
+      
+    Homogeneous_iterator(const Point& p, const Point& q, const Functor& f_,
+			 Kernel_d::Cartesian_end) 
+      : pb(p.homogeneous_end()), qb(q.homogeneous_end()), f(f_),
+	hp(p.homogeneous(p.dimension())), hq(q.homogeneous(q.dimension()))
+    {
+      --pb; --qb;
+    }
+      
+    Self& operator++() { ++pb; ++qb; return *this; }
+      
+    Self operator++(int) {
+      Self tmp(*this);
+      ++(*this);
+      return tmp;
+    }
+    
+    value_type operator*()  const { return f(*pb * hq, *qb * hp); }
+    pointer    operator->() const { return &(**this); }
+      
+    const Functor& functor() const { return f; }
+    Iterator base_p() const { return pb; }
+    Iterator base_q() const { return qb; }
+  };
+  
+  template < typename Iterator, typename Functor > inline
+  bool operator==(const Homogeneous_iterator<Iterator,Functor>& x, 
+		  const Homogeneous_iterator<Iterator,Functor>& y)
+  {
+    return x.base_p() == y.base_p() && x.base_q() == y.base_q(); 
+  }
+  
+  template < typename Iterator, typename Functor > inline
+  bool operator!=(const Homogeneous_iterator<Iterator,Functor>& x, 
+		  const Homogeneous_iterator<Iterator,Functor>& y)
+  {
+    return ! (x == y);
+  }
+  
+  template < typename Kernel_ > class Iso_box_d;
+  
+  namespace Kernel_d {
+
+    template < typename RepTag > struct Coordinate_iterator;
+    
+    template <> struct Coordinate_iterator<Cartesian_tag> {
+      template < typename Point, typename Functor > 
+      struct Iterator {
+	typedef Cartesian_iterator<Point,Functor>  type;
+      };
+    };
+    
+    template <> struct Coordinate_iterator<Homogeneous_tag> {
+      template < typename Point, typename Functor > 
+      struct Iterator {
+	typedef Homogeneous_iterator<Point,Functor>  type;
+      };
+    };
+
+    template < typename Kernel_ > 
+    struct Iso_box_d_rep {
+      typedef Kernel_                   Kernel;
+      friend class Iso_box_d<Kernel>;
+      
+    protected:
+
+      typedef typename Kernel::Point_d  Point_d;
+      Point_d lower, upper;
+
+    public:
+
+      Iso_box_d_rep() {}
+      
+      template < typename InputIteratorI, typename InputIteratorII >
+      Iso_box_d_rep(int dim,
+		    InputIteratorI b1, InputIteratorI e1,
+		    InputIteratorII b2, InputIteratorII e2)
+	: lower(dim, b1, e1), upper(dim, b2, e2)
+      {}
+      
+    };
+
+  } // namespace Kernel_d
+
+  template < typename Kernel_ > 
+  class Iso_box_d : public Handle_for< Kernel_d::Iso_box_d_rep<Kernel_> > 
+  { 
+
+  public:
+    typedef Kernel_                   Kernel;
+    typedef Kernel_                   R;
+    
+  protected:
+
+    typedef Kernel_d::Iso_box_d_rep<Kernel>  Rep;
+    typedef Handle_for<Rep>                  Base;
+    typedef Iso_box_d<Kernel>                Self;
+
+    using Base::ptr;
+
+    typedef typename Kernel::RT       RT;
+    typedef typename Kernel::FT       FT;
+    typedef typename Kernel::Point_d  Point_d;
+    typedef typename Kernel::Rep_tag  Rep_tag;
+   
+    typedef CGAL::Kernel_d::Coordinate_iterator<Rep_tag>           CIRT;
+    typedef typename CIRT::template Iterator<Point_d,Min<RT> >::type  MinIter;
+    typedef typename CIRT::template Iterator<Point_d,Max<RT> >::type  MaxIter;
+
+    typedef Kernel_d::Begin            Begin; 
+    typedef Kernel_d::End              End; 
+    typedef Kernel_d::Cartesian_end    Cartesian_end; 
+
+    RT volume_nominator() const
+    {
+      typedef typename CIRT::template Iterator<Point_d,std::minus<RT> >::type
+	      Iter;
+      Iter b(ptr()->upper, ptr()->lower, Begin());
+      Iter e(ptr()->upper, ptr()->lower, Cartesian_end());
+      return std::accumulate(b, e, RT(1), std::multiplies<RT>());
+    }
+    
+    RT volume_denominator() const
+    {
+      RT den = 
+	ptr()->lower.homogeneous(dimension()) * 
+	ptr()->upper.homogeneous(dimension());
+      RT prod = den;
+      for (int i = 1; i < dimension(); ++i)
+	prod *= den;
+      return prod;
+    }
+    
+    FT volume(Homogeneous_tag) const
+    { 
+      return FT(volume_nominator(), volume_denominator());
+    }
+    
+    FT volume(Cartesian_tag) const
+    { 
+      return volume_nominator();
+    }
+    
+public:
+
+    typedef CGAL::Dynamic_dimension_tag Ambient_dimension;
+    typedef CGAL::Dynamic_dimension_tag Feature_dimension;
+
+    Iso_box_d() {}
+    
+    Iso_box_d(const Point_d& p, const Point_d& q)
+      : Base(Rep(p.dimension(), 
+		 MinIter(p, q, Begin()), MinIter(p, q, End()),
+		 MaxIter(p, q, Begin()), MaxIter(p, q, End())))
+    { 
+      CGAL_precondition(p.dimension() == q.dimension());
+    }
+    
+    Bounded_side bounded_side(const Point_d& p) const
+    { 
+      CGAL_precondition(p.dimension() == dimension());
+      typedef typename CIRT::template Iterator<Point_d,Compare<RT> >::type
+	      Iter;
+      
+      Iter il(p, ptr()->lower, Begin());
+      Iter ilend(p, ptr()->lower, Cartesian_end());
+      Iter iu(p, ptr()->upper, Begin());
+      CGAL_assertion_code(Iter iuend(p, ptr()->upper, Cartesian_end()));
+      
+      for (; il != ilend; ++il, ++iu) {
+	CGAL_assertion(iu != iuend);
+	Comparison_result low = *il;
+	Comparison_result upp = *iu;
+	if (low == LARGER && upp == SMALLER) continue;
+	if (low == SMALLER || upp == LARGER) return ON_UNBOUNDED_SIDE;
+	return ON_BOUNDARY;
+      }
+      return ON_BOUNDED_SIDE;
+    }
+
+    bool has_on_bounded_side(const Point_d& p) const
+    { 
+      return (bounded_side(p)==ON_BOUNDED_SIDE);
+    } 
+
+    bool has_on_unbounded_side(const Point_d& p) const
+    {
+      return (bounded_side(p)==ON_UNBOUNDED_SIDE); 
+    } 
+
+    bool has_on_boundary(const Point_d& p) const
+    {
+      return (bounded_side(p)==ON_BOUNDARY); 
+    } 
+
+    int dimension() const { return ptr()->lower.dimension();}
+    
+    // FIXME!
+    FT min_coord(int i) const { return ptr()->lower[i]; }
+
+    FT max_coord(int i) const { return ptr()->upper[i]; }
+
+    const Point_d& min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return ptr()->lower; }
+
+    const Point_d& max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return ptr()->upper; }
+
+    FT volume() const { return volume(Rep_tag()); }
+    
+    bool is_degenerate() const
+    {
+      typedef typename CIRT::
+	      template Iterator<Point_d,std::equal_to<RT> >::type Iter;
+      // omit homogenizing coordinates
+      Iter e(ptr()->lower, ptr()->upper, Cartesian_end());
+      return 
+	e != std::find(Iter(ptr()->lower, ptr()->upper, Begin()), e, true);
+    }
+
+}; // end of class
+
+template < typename Kernel >
+inline bool
+operator==(const Iso_box_d<Kernel>& b1, const Iso_box_d<Kernel>& b2)
+{
+  CGAL_precondition(b1.dimension() == b2.dimension());
+  return (b1.min)() == (b2.min)() && (b1.max)() == (b2.max)();
+}
+
+template < typename Kernel >
+inline bool
+operator!=(const Iso_box_d<Kernel>& b1, const Iso_box_d<Kernel>& b2)
+{
+  return ! (b1 == b2); 
+}
+
+} // namespace CGAL
+
+#endif // CGAL_ISO_BOX_D_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Kernel_classesCd.h b/3rdparty/CGAL/include/CGAL/Kernel_d/Kernel_classesCd.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Kernel_classesCd.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/Kernel_classesCd.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Kernel_classesHd.h b/3rdparty/CGAL/include/CGAL/Kernel_d/Kernel_classesHd.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Kernel_classesHd.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/Kernel_classesHd.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Line_d.h b/3rdparty/CGAL/include/CGAL/Kernel_d/Line_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Line_d.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/Line_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Line_d_impl.h b/3rdparty/CGAL/include/CGAL/Kernel_d/Line_d_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Line_d_impl.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/Line_d_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Linear_algebraCd_impl.h b/3rdparty/CGAL/include/CGAL/Kernel_d/Linear_algebraCd_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Linear_algebraCd_impl.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/Linear_algebraCd_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Linear_algebraHd_impl.h b/3rdparty/CGAL/include/CGAL/Kernel_d/Linear_algebraHd_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Linear_algebraHd_impl.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/Linear_algebraHd_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Matrix__.h b/3rdparty/CGAL/include/CGAL/Kernel_d/Matrix__.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Matrix__.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/Matrix__.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Pair_d.h b/3rdparty/CGAL/include/CGAL/Kernel_d/Pair_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Pair_d.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/Pair_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/PointCd.h b/3rdparty/CGAL/include/CGAL/Kernel_d/PointCd.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/PointCd.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/PointCd.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/PointCd_impl.h b/3rdparty/CGAL/include/CGAL/Kernel_d/PointCd_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/PointCd_impl.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/PointCd_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/PointHd.h b/3rdparty/CGAL/include/CGAL/Kernel_d/PointHd.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/PointHd.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/PointHd.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/PointHd_impl.h b/3rdparty/CGAL/include/CGAL/Kernel_d/PointHd_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/PointHd_impl.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/PointHd_impl.h
diff --git a/3rdparty/CGAL/include/CGAL/Kernel_d/Point_d.h b/3rdparty/CGAL/include/CGAL/Kernel_d/Point_d.h
new file mode 100644
index 0000000..703a820
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Kernel_d/Point_d.h
@@ -0,0 +1,107 @@
+// Copyright (c) 2000,2001  
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved. 
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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(s)     : Michael Seel
+
+#ifndef CGAL_POINT_D_H
+#define CGAL_POINT_D_H
+
+#include <CGAL/Dimension.h>
+#include <CGAL/Origin.h>
+
+namespace CGAL {
+
+
+template <class pR>
+  class Direction_d;
+
+template <class pR>
+  class Vector_d;
+
+
+template <class pR>
+class Point_d : public pR::Point_d_base
+{ public:
+  typedef typename pR::Point_d_base Base;
+  typedef Point_d<pR>               Self;
+  typedef pR R;
+private:
+  typedef typename R::RT RT;
+  typedef typename R::FT FT;
+  typedef typename R::LA LA;
+public:
+
+  typedef CGAL::Dynamic_dimension_tag Ambient_dimension;
+  typedef CGAL::Dimension_tag<0>      Feature_dimension;
+    template < typename Kernel2 >
+	struct WithAnotherKernel
+	{
+	    typedef Point_d<Kernel2>  Type;
+	};
+
+  Point_d(int d=0) : Base(d) {}
+  Point_d(int d, const Origin &o) : Base(d,o) {}
+
+  Point_d(int a, int b, int c = 1) : 
+    Base(RT(a),RT(b),RT(c)) {} 
+  Point_d(const RT& a, const RT& b, const RT& c = 1) :
+    Base(a,b,c) {}  
+  Point_d(int a, int b, int c, int d) : 
+    Base(RT(a),RT(b),RT(c),RT(d)) {}
+  Point_d(const RT& a, const RT& b, const RT& c, const RT& d) :
+    Base(a,b,c,d) {}
+
+  template <class InputIterator>
+  Point_d (int d, InputIterator first, InputIterator last)
+    : Base (d, first, last) {}
+  template <class InputIterator>
+  Point_d(int d, InputIterator first, InputIterator last, const RT& D)
+    : Base (d, first, last, D) {}
+
+  Point_d(const Self &p) : Base(p) {}
+  Point_d(const Base& p) : Base(p) {}
+ 
+  Vector_d<R> operator-(const Origin& o) const 
+  { return Base::operator-(o); }
+  Vector_d<R> operator-(const Self& q) const
+  { return Base::operator-(q); }
+  Self operator+(const Vector_d<R>& v) const
+  { return Base::operator+(v); }
+  Self operator-(const Vector_d<R>& v) const
+  { return Base::operator-(v); }
+  Self& operator+=(const Vector_d<R>& v) 
+  { return static_cast<Self&>(Base::operator+=(v)); }
+  Self& operator-=(const Vector_d<R>& v)
+  { return static_cast<Self&>(Base::operator-=(v)); }
+  
+  inline bool operator<(const Self& q) const
+  { return R().less_lexicographically_d_object()(*this, q); }
+  inline bool operator>(const Self& q) const
+  { return R().less_lexicographically_d_object()(q, *this); }
+  inline bool operator<=(const Self& q) const
+  { return ! R().less_lexicographically_d_object()(q, *this); }
+  inline bool operator>=(const Self& q) const
+  { return ! R().less_lexicographically_d_object()(*this, q); }
+};
+
+} //namespace CGAL
+#endif //CGAL_POINT_D_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Ray_d.h b/3rdparty/CGAL/include/CGAL/Kernel_d/Ray_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Ray_d.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/Ray_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Segment_d.h b/3rdparty/CGAL/include/CGAL/Kernel_d/Segment_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Segment_d.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/Segment_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Sphere_d.h b/3rdparty/CGAL/include/CGAL/Kernel_d/Sphere_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Sphere_d.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/Sphere_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Tuple_d.h b/3rdparty/CGAL/include/CGAL/Kernel_d/Tuple_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Tuple_d.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/Tuple_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/VectorCd.h b/3rdparty/CGAL/include/CGAL/Kernel_d/VectorCd.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/VectorCd.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/VectorCd.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/VectorCd_impl.h b/3rdparty/CGAL/include/CGAL/Kernel_d/VectorCd_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/VectorCd_impl.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/VectorCd_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/VectorHd.h b/3rdparty/CGAL/include/CGAL/Kernel_d/VectorHd.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/VectorHd.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/VectorHd.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/VectorHd_impl.h b/3rdparty/CGAL/include/CGAL/Kernel_d/VectorHd_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/VectorHd_impl.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/VectorHd_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Vector__.h b/3rdparty/CGAL/include/CGAL/Kernel_d/Vector__.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Vector__.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/Vector__.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Vector_d.h b/3rdparty/CGAL/include/CGAL/Kernel_d/Vector_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/Vector_d.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/Vector_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/debug.h b/3rdparty/CGAL/include/CGAL/Kernel_d/debug.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/debug.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/debug.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/function_objects.h b/3rdparty/CGAL/include/CGAL/Kernel_d/function_objects.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/function_objects.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/function_objects.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/function_objectsCd.h b/3rdparty/CGAL/include/CGAL/Kernel_d/function_objectsCd.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/function_objectsCd.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/function_objectsCd.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/function_objectsHd.h b/3rdparty/CGAL/include/CGAL/Kernel_d/function_objectsHd.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/function_objectsHd.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/function_objectsHd.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/interface_macros_d.h b/3rdparty/CGAL/include/CGAL/Kernel_d/interface_macros_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/interface_macros_d.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/interface_macros_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/intersection_objectsCd.h b/3rdparty/CGAL/include/CGAL/Kernel_d/intersection_objectsCd.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/intersection_objectsCd.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/intersection_objectsCd.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/intersection_objectsHd.h b/3rdparty/CGAL/include/CGAL/Kernel_d/intersection_objectsHd.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/intersection_objectsHd.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/intersection_objectsHd.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/intersection_objects_d.h b/3rdparty/CGAL/include/CGAL/Kernel_d/intersection_objects_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/intersection_objects_d.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/intersection_objects_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_d/simple_objects.h b/3rdparty/CGAL/include/CGAL/Kernel_d/simple_objects.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_d/simple_objects.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_d/simple_objects.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_profiler.h b/3rdparty/CGAL/include/CGAL/Kernel_profiler.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_profiler.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_profiler.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kernel_traits.h b/3rdparty/CGAL/include/CGAL/Kernel_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kernel_traits.h
rename to 3rdparty/CGAL/include/CGAL/Kernel_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Active_objects_vector.h b/3rdparty/CGAL/include/CGAL/Kinetic/Active_objects_vector.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Active_objects_vector.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Active_objects_vector.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/CORE_Expr_exact_simulation_traits.h b/3rdparty/CGAL/include/CGAL/Kinetic/CORE_Expr_exact_simulation_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/CORE_Expr_exact_simulation_traits.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/CORE_Expr_exact_simulation_traits.h
diff --git a/3rdparty/CGAL/include/CGAL/Kinetic/Cartesian.h b/3rdparty/CGAL/include/CGAL/Kinetic/Cartesian.h
new file mode 100644
index 0000000..e1fd8d6
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Kinetic/Cartesian.h
@@ -0,0 +1,48 @@
+// Copyright (c) 2005  Stanford University (USA).
+// 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(s)     : Daniel Russel <drussel at alumni.princeton.edu>
+
+#ifndef CGAL_KINETIC_KINETIC_KERNEL_H
+#define CGAL_KINETIC_KINETIC_KERNEL_H
+#include <CGAL/Kinetic/basic.h>
+#include <CGAL/Kinetic/internal/Kernel/Cartesian_kinetic_kernel_base.h>
+
+namespace CGAL { namespace Kinetic {
+
+//! A kinetic kernel using cartesian coordinates
+/*!  It takes a PolynomialKernel as a template parameter. The
+  PolynomialKernel is used to define the Motion_function and the
+  Certificate_function.
+*/
+template <class Function_kernel_k>
+class Cartesian:
+  public internal::Cartesian_kinetic_kernel_base<Function_kernel_k,
+						 Cartesian<Function_kernel_k> >
+{
+  typedef internal::Cartesian_kinetic_kernel_base<Function_kernel_k,
+						  Cartesian<Function_kernel_k> > P;
+public:
+  //typedef Function_kernel_k Function_kernel;
+  Cartesian(Function_kernel_k pk): P(pk){}
+  Cartesian(){}
+};
+
+} } //namespace CGAL::Kinetic
+
+#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Certificate_generator.h b/3rdparty/CGAL/include/CGAL/Kinetic/Certificate_generator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Certificate_generator.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Certificate_generator.h
diff --git a/3rdparty/CGAL/include/CGAL/Kinetic/Default_instantaneous_kernel.h b/3rdparty/CGAL/include/CGAL/Kinetic/Default_instantaneous_kernel.h
new file mode 100644
index 0000000..9de459f
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Kinetic/Default_instantaneous_kernel.h
@@ -0,0 +1,388 @@
+// Copyright (c) 2005  Stanford University (USA).
+// 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(s)     : Daniel Russel <drussel at alumni.princeton.edu>
+
+#ifndef CGAL_CARTESIAN_DEFAULT_INSTANTANEOUS_KERNEL_H
+#define CGAL_CARTESIAN_DEFAULT_INSTANTANEOUS_KERNEL_H
+
+#include <CGAL/Kinetic/basic.h>
+#include <CGAL/Kinetic/internal/Instantaneous_adaptor.h>
+#include <CGAL/Simple_cartesian.h>
+#include <CGAL/Filtered_kernel.h>
+#include <map>
+#include <iostream>
+#include <CGAL/Kinetic/Ref_counted.h>
+#include <CGAL/Kinetic/internal/To_static.h>
+
+
+#define CGAL_MSA(Pred, pred, Arg, d) typedef Instantaneous_adaptor<typename Static_kernel::Pred##_##d, typename Kinetic_kernel::Pred##_##d, Rep, Arg> Pred##_##d; \
+  Pred##_##d pred##_##d##_object() const				\
+  {									\
+    typename Static_kernel::Pred##_##d sp= rep_->static_kernel().pred##_##d##_object();	\
+    typename Kinetic_kernel::Pred##_##d kp= rep_->kinetic_kernel().pred##_##d##_object();	\
+    return Pred##_##d(rep_, sp, kp);		\
+  }
+
+#define CGAL_TSO(name) typedef typename Static_kernel::name name
+
+namespace CGAL { namespace Kinetic {
+
+template <class CIK>
+class Default_instantaneous_kernel_rep: public Ref_counted<Default_instantaneous_kernel_rep<CIK> >
+{
+public:
+  typedef typename CIK::Traits Traits;
+  typedef typename Traits::Static_kernel Static_kernel;
+  typedef typename Traits::Kinetic_kernel Kinetic_kernel;
+
+  typedef typename Kinetic_kernel::Point_1::template Static_traits<Static_kernel> Static_traits_point_1;
+  typedef typename Kinetic_kernel::Point_2::template Static_traits<Static_kernel> Static_traits_point_2;
+  typedef typename Kinetic_kernel::Point_3::template Static_traits<Static_kernel> Static_traits_point_3;
+  typedef typename Kinetic_kernel::Weighted_point_3::template Static_traits<Static_kernel> Static_traits_weighted_point_3;
+
+  typedef typename Static_kernel::FT NT;
+  typedef typename CIK::Traits::Simulator::Time Time;
+
+  Default_instantaneous_kernel_rep(Traits tr): tr_(tr) {
+    initialized_=false;
+    time_is_nt_=false;
+  }
+  
+  template <class T>
+  void set_time(const T &t, bool limit) {
+    if (!initialized_) {
+      time_is_nt_=false;
+      time_=t;
+    } else {
+      if ((!time_is_nt_ && time_ != t) || time_is_nt_) {
+	time_is_nt_=false;
+	time_=t;
+	cache_1_.clear();
+	cache_2_.clear();
+	cache_3_.clear();
+      }
+    }
+    initialized_=true;
+    after_=limit;
+  }
+
+  void set_time(const NT &t, bool limit)
+  {
+ 
+    
+    if (initialized_ && ((time_is_nt_ && time_nt_ != t) || !time_is_nt_)) {
+      cache_1_.clear();
+      cache_2_.clear();
+      cache_3_.clear();
+    }
+    time_is_nt_=true;
+    time_nt_=t;
+    time_= Time(t);
+
+    initialized_=true;
+    after_=limit;
+  }
+
+  bool time_after() const {
+    return after_;
+  }
+
+  bool initialized() const {
+    return initialized_;
+  }
+  bool time_is_nt() const {
+    return time_is_nt_;
+  }
+
+  const NT & time_as_nt() const
+  {
+    CGAL_precondition(initialized_);
+    CGAL_precondition(time_is_nt());
+    return time_nt_;
+  }
+  
+  const Time &time() const
+  {
+    CGAL_precondition(initialized_);
+    return time_;
+  }
+  
+  void check_static_object() const {
+#ifndef NDEBUG
+    if (!initialized_) {
+      std::cerr << "The InstantaneousKernel (or one of its predicates) was\n";
+      std::cerr << "used without the time being set. This probably is the sign\n";
+      std::cerr << "of misusing it--specifically make sure you store a copy\n";
+      std::cerr << "from the SimulatorTraits and get predicates from it.\n";
+    }
+#endif
+    if (!time_is_nt()) {
+        std::cerr << "You can only compute static objects when the IK current\n";
+        std::cerr << "time is an FT, rather than a root.\n";
+	CGAL_error();
+    }
+  }
+
+  typedef typename CIK::Traits::Active_points_1_table::Data::template Static_traits<Static_kernel> Static_traits_1;
+
+  const typename Static_traits_1::Static_type&
+  static_object(typename CIK::Point_1 k) const {
+    check_static_object();
+    if (cache_1_.find(k) == cache_1_.end()) {
+      cache_1_[k]= Static_traits_1::to_static(tr_.active_points_1_table_handle()->at(k), 
+					      time_nt_, static_kernel());
+      //std::cout << "Point " << k << " is " << cache_1_[k] << std::endl;
+    }
+    return cache_1_[k];
+  }
+
+  typedef typename CIK::Traits::Active_points_2_table::Data::template Static_traits<Static_kernel> Static_traits_2;
+
+  const typename Static_traits_2::Static_type&
+  static_object(typename CIK::Point_2 k) const {
+    check_static_object();
+    if (cache_2_.find(k) == cache_2_.end()) {
+      cache_2_[k]= Static_traits_2::to_static(tr_.active_points_2_table_handle()->at(k), 
+					      time_nt_, static_kernel());
+    }
+    return cache_2_[k];
+  }
+
+  typedef typename CIK::Traits::Active_points_3_table::Data::template Static_traits<Static_kernel> Static_traits_3;
+
+  const typename Static_traits_3::Static_type&
+  static_object(typename CIK::Point_3 k) const {
+    check_static_object();
+    if (cache_3_.find(k) == cache_3_.end()) {
+      cache_3_[k]= Static_traits_3::to_static(tr_.active_points_3_table_handle()->at(k), 
+					      time_nt_, static_kernel());
+    }
+    return cache_3_[k];
+  }
+
+  /*const typename Static_kernel::Weighted_point_3&
+  static_object(typename CIK::Weighted_point_3 k) const {
+    check_static_object();
+    if (cache_w3_.find(k) == cache_w3_.end()) {
+      const typename Kinetic_kernel::Weighted_point_3 &wp= tr_.active_weighted_points_3_table_handle()->at(k);
+      cache_w3_[k]= typename Static_kernel::Weighted_point_2(Static_kernel::Point_2(wp.point().x()(time_),
+										    wp.point().y()(time_),
+										    wp.point().z()(time_)),
+							     wp.weight()(time_));
+    }
+    return cache_w3_[k];
+    }*/
+
+  const typename CIK::Traits::Active_points_1_table::Data&
+  kinetic_object(typename CIK::Point_1 k) const {
+    return tr_.active_points_1_table_handle()->at(k);
+    
+  }
+
+  const typename CIK::Traits::Active_points_2_table::Data&
+  kinetic_object(typename CIK::Point_2 k) const {
+    return tr_.active_points_2_table_handle()->at(k);
+  }
+
+  const typename CIK::Traits::Active_points_3_table::Data&
+  kinetic_object(typename CIK::Point_3 k) const {
+    return tr_.active_points_3_table_handle()->at(k);
+  }
+
+  
+  
+  const Static_kernel& static_kernel() const
+  {
+    return tr_.static_kernel_object();
+  }
+  
+  const Kinetic_kernel& kinetic_kernel() const
+  {
+    return tr_.kinetic_kernel_object();
+  }
+protected:
+  mutable bool initialized_;
+  bool time_is_nt_;
+  typename CIK::Traits tr_;
+  mutable std::map<typename CIK::Point_1,
+		   typename Static_traits_1::Static_type> cache_1_;
+  mutable std::map<typename CIK::Point_2,
+		   typename Static_traits_2::Static_type> cache_2_;
+  mutable std::map<typename CIK::Point_3,
+		   typename Static_traits_3::Static_type> cache_3_;
+  /*mutable std::map<typename CIK::Weighted_point_3,
+    typename Static_kernel::Weighted_point_3> cache_w3_;*/
+  NT time_nt_;
+  Time time_;
+  bool after_;
+};
+
+
+template <class Traitst >
+class Default_instantaneous_kernel
+{
+  typedef Default_instantaneous_kernel<Traitst> This;
+public:
+  typedef Traitst Traits;
+  typedef Default_instantaneous_kernel_rep< This>  Rep;
+  typedef typename Traits::Static_kernel Static_kernel;
+  typedef typename Traits::Kinetic_kernel Kinetic_kernel;
+  typedef typename Static_kernel::FT NT;
+  typedef typename Traits::Simulator::Time Time;
+
+  CGAL_static_assertion((boost::is_convertible<NT, Time>::value));
+  CGAL_static_assertion((boost::is_convertible<Time, typename Kinetic_kernel::Certificate::Time>::value));
+  CGAL_static_assertion((boost::is_convertible<typename Kinetic_kernel::Certificate::Time,
+  Time>::value));
+
+  Default_instantaneous_kernel(const Traits &tr):
+    rep_(new Rep(tr)) {
+  }
+  template <class N>
+  void set_time(const N &cur_time) const
+  {
+    rep_->set_time(cur_time, false);
+  }
+
+  void set_time(const Time &cur_time) const
+  {
+    rep_->set_time(cur_time, false);
+  }
+
+  template <class N>
+  void set_time_to_after(const N &cur_time) const
+  {
+    rep_->set_time(cur_time, true);
+  }
+
+  void set_time_to_after(const Time &cur_time) const
+  {
+    rep_->set_time(cur_time, true);
+  }
+ 
+  bool time_is_nt() const {
+    return rep_->time_is_nt();
+  }
+
+  const NT & time_as_nt() const
+  {
+    return rep_->time_as_nt();
+  }
+  
+  const Time & time() const
+  {
+   
+    return rep_->time();
+   
+  }
+
+  bool has_time() const {
+    return rep_->initialized();
+  }
+
+  typedef typename Static_kernel::RT RT;
+  typedef typename Static_kernel::FT FT;
+
+  typedef typename Traits::Active_points_1_table::Key Point_1;
+  typedef typename Traits::Active_points_2_table::Key Point_2;
+  typedef typename Traits::Active_points_3_table::Key Point_3;
+  //typedef typename Traits::Active_points_3_table::Key Bare_point;
+  //typedef typename Traits::Active_weighted_points_3_table::Key Weighted_point_3;
+
+  struct Current_coordinates {
+    Current_coordinates(typename Rep::Handle rep): rep_(rep){}
+   
+    const FT  & operator()(Point_1 k) const {
+      return rep_->static_object(k);
+    }
+    const typename Static_kernel::Point_2  & operator()(Point_2 k) const {
+      return rep_->static_object(k);
+    }
+    const typename Static_kernel::Point_3  & operator()(Point_3 k) const {
+      return rep_->static_object(k);
+    }
+    /*const typename Static_kernel::Weighted_point_3  & operator()(Weighted_point_3 k) const {
+      return rep_->static_object(k);
+      }*/
+    typename Rep::Handle rep_;
+  };
+
+  Current_coordinates current_coordinates_object() const {
+    return Current_coordinates(rep_);
+  }
+
+
+  template <class T>
+  class Compare_static {
+  public:
+    typedef CGAL::Comparison_result result_type;
+    typedef T first_argument_type;
+    typedef T second_argument_type;
+    result_type operator()(const T &a, const T&b) const {
+      return CGAL::compare(a,b);
+    }
+  };
+
+  typedef Instantaneous_adaptor<Compare_static<RT>, typename Kinetic_kernel::Compare_x_1, Rep, Point_1> Compare_x_1;
+  Compare_x_1 compare_x_1_object() const
+  {
+    Compare_static<NT> sp;
+    return Compare_x_1(rep_, sp, rep_->kinetic_kernel().compare_x_1_object());
+  }
+
+  CGAL_MSA(Side_of_oriented_circle,side_of_oriented_circle, Point_2, 2);
+  CGAL_MSA(Orientation,orientation, Point_2, 2);
+  CGAL_MSA(Compare_x, compare_x, Point_2, 2);
+  CGAL_MSA(Compare_y,compare_y, Point_2, 2);
+  /*CGAL_MSA(Compare_x, compare_x, Point_2, 2);
+    CGAL_MSA(Compare_y, compare_y, Point_2, 2);*/
+  CGAL_MSA(Compare_distance, compare_distance, Point_2, 2);
+  CGAL_MSA(Compare_distance, compare_distance, Point_3, 3);
+  CGAL_TSO(Segment_2);
+  CGAL_TSO(Triangle_2);
+
+  CGAL_MSA(Side_of_oriented_sphere,side_of_oriented_sphere, Point_3, 3);
+  CGAL_MSA(Orientation,orientation, Point_3, 3);
+  CGAL_MSA(Compare_x,compare_x, Point_3, 3);
+  CGAL_MSA(Compare_y,compare_y, Point_3, 3);
+  CGAL_MSA(Compare_z,compare_z, Point_3, 3);
+  CGAL_MSA(Compare_xyz,compare_xyz, Point_3, 3);
+  /*CGAL_MSA(Less_x, less_x, Point_3, 3);
+  CGAL_MSA(Less_y, less_y, Point_3, 3);
+  CGAL_MSA(Less_z, less_z, Point_3, 3);*/
+  CGAL_MSA(Coplanar_orientation, coplanar_orientation, Point_3, 3);
+  CGAL_MSA(Coplanar_side_of_bounded_circle, coplanar_side_of_bounded_circle, Point_3, 3);
+  //CGAL_MSA(Power_test,power_test, Weighted_point_3, 3);
+
+
+  
+  CGAL_TSO(Segment_3);
+  CGAL_TSO(Triangle_3);
+  CGAL_TSO(Tetrahedron_3);
+  CGAL_TSO(Line_3);
+  CGAL_TSO(Ray_3);
+  CGAL_TSO(Object_3);
+  CGAL_TSO(Plane_3);
+protected:
+  typename Rep::Handle rep_;
+};
+#undef CGAL_MSA
+#undef CGAL_TSO
+} } //namespace CGAL::Kinetic
+#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Default_simulator.h b/3rdparty/CGAL/include/CGAL/Kinetic/Default_simulator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Default_simulator.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Default_simulator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Delaunay_triangulation_2.h b/3rdparty/CGAL/include/CGAL/Kinetic/Delaunay_triangulation_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Delaunay_triangulation_2.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Delaunay_triangulation_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Delaunay_triangulation_3.h b/3rdparty/CGAL/include/CGAL/Kinetic/Delaunay_triangulation_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Delaunay_triangulation_3.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Delaunay_triangulation_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Delaunay_triangulation_cell_base_3.h b/3rdparty/CGAL/include/CGAL/Kinetic/Delaunay_triangulation_cell_base_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Delaunay_triangulation_cell_base_3.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Delaunay_triangulation_cell_base_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Delaunay_triangulation_default_traits_2.h b/3rdparty/CGAL/include/CGAL/Kinetic/Delaunay_triangulation_default_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Delaunay_triangulation_default_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Delaunay_triangulation_default_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Delaunay_triangulation_event_log_visitor_2.h b/3rdparty/CGAL/include/CGAL/Kinetic/Delaunay_triangulation_event_log_visitor_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Delaunay_triangulation_event_log_visitor_2.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Delaunay_triangulation_event_log_visitor_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Delaunay_triangulation_event_log_visitor_3.h b/3rdparty/CGAL/include/CGAL/Kinetic/Delaunay_triangulation_event_log_visitor_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Delaunay_triangulation_event_log_visitor_3.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Delaunay_triangulation_event_log_visitor_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Delaunay_triangulation_face_base_2.h b/3rdparty/CGAL/include/CGAL/Kinetic/Delaunay_triangulation_face_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Delaunay_triangulation_face_base_2.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Delaunay_triangulation_face_base_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Delaunay_triangulation_recent_edges_visitor_2.h b/3rdparty/CGAL/include/CGAL/Kinetic/Delaunay_triangulation_recent_edges_visitor_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Delaunay_triangulation_recent_edges_visitor_2.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Delaunay_triangulation_recent_edges_visitor_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Delaunay_triangulation_vertex_base_2.h b/3rdparty/CGAL/include/CGAL/Kinetic/Delaunay_triangulation_vertex_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Delaunay_triangulation_vertex_base_2.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Delaunay_triangulation_vertex_base_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Delaunay_triangulation_visitor_base_2.h b/3rdparty/CGAL/include/CGAL/Kinetic/Delaunay_triangulation_visitor_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Delaunay_triangulation_visitor_base_2.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Delaunay_triangulation_visitor_base_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Delaunay_triangulation_visitor_base_3.h b/3rdparty/CGAL/include/CGAL/Kinetic/Delaunay_triangulation_visitor_base_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Delaunay_triangulation_visitor_base_3.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Delaunay_triangulation_visitor_base_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Derivitive_filter_function_kernel.h b/3rdparty/CGAL/include/CGAL/Kinetic/Derivitive_filter_function_kernel.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Derivitive_filter_function_kernel.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Derivitive_filter_function_kernel.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Enclosing_box_2.h b/3rdparty/CGAL/include/CGAL/Kinetic/Enclosing_box_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Enclosing_box_2.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Enclosing_box_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Enclosing_box_3.h b/3rdparty/CGAL/include/CGAL/Kinetic/Enclosing_box_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Enclosing_box_3.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Enclosing_box_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Erase_event.h b/3rdparty/CGAL/include/CGAL/Kinetic/Erase_event.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Erase_event.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Erase_event.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Event_base.h b/3rdparty/CGAL/include/CGAL/Kinetic/Event_base.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Event_base.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Event_base.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Exact_simulation_traits.h b/3rdparty/CGAL/include/CGAL/Kinetic/Exact_simulation_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Exact_simulation_traits.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Exact_simulation_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Free_event_base.h b/3rdparty/CGAL/include/CGAL/Kinetic/Free_event_base.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Free_event_base.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Free_event_base.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Handle_degeneracy_function_kernel.h b/3rdparty/CGAL/include/CGAL/Kinetic/Handle_degeneracy_function_kernel.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Handle_degeneracy_function_kernel.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Handle_degeneracy_function_kernel.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Heap_pointer_event_queue.h b/3rdparty/CGAL/include/CGAL/Kinetic/Heap_pointer_event_queue.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Heap_pointer_event_queue.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Heap_pointer_event_queue.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Inexact_simulation_traits.h b/3rdparty/CGAL/include/CGAL/Kinetic/Inexact_simulation_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Inexact_simulation_traits.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Inexact_simulation_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Insert_event.h b/3rdparty/CGAL/include/CGAL/Kinetic/Insert_event.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Insert_event.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Insert_event.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Listener.h b/3rdparty/CGAL/include/CGAL/Kinetic/Listener.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Listener.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Listener.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Multi_listener.h b/3rdparty/CGAL/include/CGAL/Kinetic/Multi_listener.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Multi_listener.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Multi_listener.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Ref_counted.h b/3rdparty/CGAL/include/CGAL/Kinetic/Ref_counted.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Ref_counted.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Ref_counted.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Regular_triangulation_3.h b/3rdparty/CGAL/include/CGAL/Kinetic/Regular_triangulation_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Regular_triangulation_3.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Regular_triangulation_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Regular_triangulation_CORE_exact_simulation_traits.h b/3rdparty/CGAL/include/CGAL/Kinetic/Regular_triangulation_CORE_exact_simulation_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Regular_triangulation_CORE_exact_simulation_traits.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Regular_triangulation_CORE_exact_simulation_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Regular_triangulation_cell_base_3.h b/3rdparty/CGAL/include/CGAL/Kinetic/Regular_triangulation_cell_base_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Regular_triangulation_cell_base_3.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Regular_triangulation_cell_base_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Regular_triangulation_event_log_visitor_3.h b/3rdparty/CGAL/include/CGAL/Kinetic/Regular_triangulation_event_log_visitor_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Regular_triangulation_event_log_visitor_3.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Regular_triangulation_event_log_visitor_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Regular_triangulation_exact_simulation_traits.h b/3rdparty/CGAL/include/CGAL/Kinetic/Regular_triangulation_exact_simulation_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Regular_triangulation_exact_simulation_traits.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Regular_triangulation_exact_simulation_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Regular_triangulation_inexact_simulation_traits.h b/3rdparty/CGAL/include/CGAL/Kinetic/Regular_triangulation_inexact_simulation_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Regular_triangulation_inexact_simulation_traits.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Regular_triangulation_inexact_simulation_traits.h
diff --git a/3rdparty/CGAL/include/CGAL/Kinetic/Regular_triangulation_instantaneous_kernel.h b/3rdparty/CGAL/include/CGAL/Kinetic/Regular_triangulation_instantaneous_kernel.h
new file mode 100644
index 0000000..1cc2a7f
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Kinetic/Regular_triangulation_instantaneous_kernel.h
@@ -0,0 +1,81 @@
+// Copyright (c) 2005  Stanford University (USA).
+// 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(s)     : Daniel Russel <drussel at alumni.princeton.edu>
+
+#ifndef CGAL_CARTESIAN_REGULAR_INSTANTANEOUS_KERNEL_H
+#define CGAL_CARTESIAN_REGULAR_INSTANTANEOUS_KERNEL_H
+#include <CGAL/Kinetic/basic.h>
+#include <CGAL/Kinetic/Default_instantaneous_kernel.h>
+#include <CGAL/Simple_cartesian.h>
+#include <CGAL/Filtered_kernel.h>
+#include <map>
+#include <iostream>
+#include <CGAL/Kinetic/Ref_counted.h>
+#include <CGAL/Kinetic/internal/To_static.h>
+
+
+/*#define CGAL_MSA(Pred, pred, Arg, d) typedef Instantaneous_adaptor<typename Static_kernel::Pred##_##d, Current_coordinates, Arg> Pred##_##d; \
+  Pred##_##d pred##_##d##_object() const				\
+  {									\
+    typename Static_kernel::Pred##_##d sp= rep_->static_kernel().pred##_##d##_object();	\
+    return Pred##_##d(current_coordinates_object(), sp);		\
+    }*/
+
+/*#define CGAL_TSO(name) typedef typename Static_kernel::name name*/
+
+#define CGAL_MSA(Pred, pred, Arg, d) typedef Instantaneous_adaptor<typename P::Static_kernel::Pred##_##d, typename P::Kinetic_kernel::Pred##_##d, typename P::Rep, Arg> Pred##_##d; \
+  Pred##_##d pred##_##d##_object() const				\
+  {									\
+    typename P::Static_kernel::Pred##_##d sp= P::rep_->static_kernel().pred##_##d##_object(); \
+    typename P::Kinetic_kernel::Pred##_##d kp= P::rep_->kinetic_kernel().pred##_##d##_object(); \
+    return Pred##_##d(P::rep_, sp, kp);					\
+  }
+
+
+namespace CGAL { namespace Kinetic {
+
+
+template <class Traitst >
+class Regular_triangulation_instantaneous_kernel: public Default_instantaneous_kernel<Traitst>
+{
+  typedef Regular_triangulation_instantaneous_kernel<Traitst> This;
+public:
+  typedef Traitst Traits;
+  typedef Default_instantaneous_kernel<Traitst> P;
+
+  //using P::Time;
+  //using P::NT;
+
+  Regular_triangulation_instantaneous_kernel(const Traits &tr): P(tr) {
+  }
+
+  /*using typename P::Point_1;
+  using typename P::Point_2;
+  using typename P::Point_3;*/
+  typedef typename P::Point_3 Bare_point;
+  typedef typename P::Point_3 Weighted_point_3;
+  //typedef P::Static_kernel Static_kernel;
+
+  CGAL_MSA(Power_test,power_test, Weighted_point_3, 3);
+  CGAL_MSA(Equal, equal, Weighted_point_3, 3);
+};
+#undef CGAL_MSA
+
+} } //namespace CGAL::Kinetic
+#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Regular_triangulation_vertex_base_3.h b/3rdparty/CGAL/include/CGAL/Kinetic/Regular_triangulation_vertex_base_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Regular_triangulation_vertex_base_3.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Regular_triangulation_vertex_base_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Regular_triangulation_visitor_base_3.h b/3rdparty/CGAL/include/CGAL/Kinetic/Regular_triangulation_visitor_base_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Regular_triangulation_visitor_base_3.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Regular_triangulation_visitor_base_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Simulator_objects_listener.h b/3rdparty/CGAL/include/CGAL/Kinetic/Simulator_objects_listener.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Simulator_objects_listener.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Simulator_objects_listener.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Sort.h b/3rdparty/CGAL/include/CGAL/Kinetic/Sort.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Sort.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Sort.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Sort_event_log_visitor.h b/3rdparty/CGAL/include/CGAL/Kinetic/Sort_event_log_visitor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Sort_event_log_visitor.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Sort_event_log_visitor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Sort_visitor_base.h b/3rdparty/CGAL/include/CGAL/Kinetic/Sort_visitor_base.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Sort_visitor_base.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Sort_visitor_base.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/Two_list_pointer_event_queue.h b/3rdparty/CGAL/include/CGAL/Kinetic/Two_list_pointer_event_queue.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/Two_list_pointer_event_queue.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/Two_list_pointer_event_queue.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/basic.h b/3rdparty/CGAL/include/CGAL/Kinetic/basic.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/basic.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/basic.h
diff --git a/3rdparty/CGAL/include/CGAL/Kinetic/internal/Delaunay_triangulation_base_3.h b/3rdparty/CGAL/include/CGAL/Kinetic/internal/Delaunay_triangulation_base_3.h
new file mode 100644
index 0000000..a453190
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Kinetic/internal/Delaunay_triangulation_base_3.h
@@ -0,0 +1,1394 @@
+// Copyright (c) 2005  Stanford University (USA).
+// 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$ $Date$
+// 
+//
+// Author(s)     : Daniel Russel <drussel at alumni.princeton.edu>
+
+#ifndef CGAL_KINETIC_INTERNAL_DELAUNAY_BASE_3_H
+#define CGAL_KINETIC_INTERNAL_DELAUNAY_BASE_3_H
+
+#include <CGAL/Kinetic/basic.h>
+
+#include <CGAL/Kinetic/internal/Triangulation_helper_3.h>
+#include <CGAL/Kinetic/internal/triangulation_helpers_3.h>
+#include <CGAL/Kinetic/Event_base.h>
+
+// STL
+#include <map>
+#include <set>
+#include <iterator>
+#include <ostream>
+#include <iostream>
+
+//extern int too_late__;
+//extern int filtered__;
+
+namespace CGAL { namespace Kinetic { namespace internal {
+
+template <class KD, class RS>
+class Delaunay_event_base_3: public Event_base<KD*>
+{
+  typedef Event_base<KD*> P;
+public:
+  Delaunay_event_base_3(const RS &s,
+			KD *kdel):P(kdel), s_(s){
+  }
+  //! Default constructor
+  /*!  This really should not be used, but I need it for the
+    Simulator::event() call, due to the apparent gcc compiler bug.
+  */
+  Delaunay_event_base_3() {
+
+  }
+  void process() {
+    // for some reason VC insists that this be there
+    CGAL_assertion(0 && "Process called in Delaunay_event_base_3");
+  }
+  const RS& root_stack() const
+  {
+    return s_;
+  }
+  std::ostream& write(std::ostream &out) const
+  {
+    out << "Delaunay_event";
+    return out;
+  }
+  KD* kdel() const {
+    return P::kds();
+  }
+protected:
+  const RS s_;
+};
+
+/*template <class K, class R>
+std::ostream& operator<<(std::ostream &out, const Delaunay_event_base_3<K, R> &e)
+{
+  e.write(out);
+  return out;
+  }*/
+
+
+template <class KD, class RS>
+class Delaunay_3_edge_flip_event: public Delaunay_event_base_3<KD, RS>
+{
+public:
+  typedef Delaunay_event_base_3<KD, RS>   P;
+  Delaunay_3_edge_flip_event(const RS &s,
+			     const typename KD::Edge &e,
+			     KD *kdel):P(s, kdel), e_(e) {
+#ifndef NDEBUG
+    o_= edge_point(e_,0);
+    d_= edge_point(e_,1);
+#endif
+  }
+  void process() {
+    P::kdel()->flip(e_);
+  }
+
+  static typename KD::Point_key edge_point(const typename KD::Edge &e, int i) {
+    return vertex_of_edge(e, i)->point();
+  }
+
+  std::ostream& write(std::ostream &out) const
+  {
+    out << "Flip ";
+    internal::write_edge(e_, out);
+#if 0
+    out << "(" << o_ << d_<<")" << std::flush;
+    CGAL_postcondition(o_== vertex_of_edge(e_,static_cast<int>(0))->point());
+    CGAL_postcondition(d_== vertex_of_edge(e_,1)->point());
+#endif
+    return out;
+  }
+ 
+
+  void audit(typename KD::Event_key k) const {
+    if (e_.first->edge_label(e_.second,e_.third) != k) {
+      CGAL_ERROR("Mismatch, for label " << k << " had event " << e_.first->edge_label(e_.second,e_.third));
+    }
+    CGAL_assertion(e_.first->edge_label(e_.second,e_.third) == k);
+  }
+protected:
+  const typename KD::Edge e_;
+#ifndef NDEBUG
+  typename KD::Point_key o_, d_;
+#endif
+};
+
+/*template <class B, class C, class D>
+std::ostream& operator<<(std::ostream &out, const Delaunay_3_edge_flip_event<B, C, D> &e)
+{
+  e.write(out);
+  return out;
+  }*/
+
+
+template <class KD, class RS>
+class Delaunay_3_facet_flip_event:  public Delaunay_event_base_3<KD, RS>
+{
+public:
+  typedef Delaunay_event_base_3<KD, RS>   P;
+  Delaunay_3_facet_flip_event(const RS &s,
+			      const typename KD::Facet &e,
+			      KD *kdel):  P(s, kdel),e_(e) {
+#ifndef NDEBUG
+    a_= vertex_of_facet(e_,0)->point();
+    b_= vertex_of_facet(e_,1)->point();
+    c_= vertex_of_facet(e_,2)->point();
+#endif
+  }
+  void process() {
+    P::kdel()->flip(e_);
+  }
+  std::ostream& write(std::ostream &out) const
+  {
+    out << "Flip ";
+    write_facet(e_, out);
+#if 0
+    out << "(" << a_ << b_<<c_ << ")";
+    CGAL_postcondition(a_== vertex_of_facet(e_,0)->point());
+    CGAL_postcondition(b_== vertex_of_facet(e_,1)->point());
+    CGAL_postcondition(c_== vertex_of_facet(e_,2)->point());
+#endif
+    return out;
+  }
+ 
+  void audit(typename KD::Event_key k) const {
+    if (e_.first->facet_label(e_.second) != k) {
+      CGAL_ERROR("Mismatch, for label " << k << " had event " << e_.first->facet_label(e_.second));
+    }
+    CGAL_assertion(e_.first->facet_label(e_.second) == k);
+  }
+protected:
+  const typename KD::Facet e_;
+#ifndef NDEBUG
+  typename KD::Point_key a_, b_, c_;
+#endif
+};
+
+/*template <class T, class C, class D>
+std::ostream& operator<<(std::ostream &out, const Delaunay_3_facet_flip_event<T, C, D> &e)
+{
+  e.write(out);
+  return out;
+  }*/
+
+
+template <class TraitsT, class Visitor>
+class Delaunay_triangulation_base_3;
+
+template <class TraitsT, class Visitor>
+std::ostream &operator<<(std::ostream &out,
+			 const Delaunay_triangulation_base_3<TraitsT, Visitor> &dt);
+
+// Common base class for Delaunay and regular triangulations
+template <class TraitsT, class Visitor>
+class Delaunay_triangulation_base_3
+{
+public:
+  typedef Delaunay_triangulation_base_3<TraitsT, Visitor> This;
+
+  // KDS typedefs
+  typedef typename TraitsT::Simulator Simulator;
+  typedef typename TraitsT::Active_points_3_table Moving_object_table;
+  typedef typename TraitsT::Kinetic_kernel Kinetic_kernel;
+  typedef typename TraitsT::Instantaneous_kernel Instantaneous_kernel;
+  //typedef typename Simulator::Time Time;
+  typedef typename Moving_object_table::Key Point_key;
+  typedef typename Moving_object_table::Data Point;
+  typedef typename Simulator::Event_key Event_key;
+  typedef typename TraitsT::Side_of_oriented_sphere_3::result_type Certificate;
+  //typedef typename Simulator::NT NT;
+
+  // Delaunay typedefs
+  typedef Triangulation_helper_3<typename TraitsT::Triangulation> Tri;
+
+  // Triangulation members
+  typedef typename Tri::Facet Facet;
+  typedef typename Tri::Edge Edge;
+  typedef typename Tri::Facet_circulator Facet_circulator;
+  typedef typename Tri::Cell_circulator Cell_circulator;
+  typedef typename Tri::Finite_edges_iterator Finite_edges_iterator;
+  typedef typename Tri::Finite_facets_iterator Finite_facets_iterator;
+  typedef typename Tri::Edge_iterator Edge_iterator;
+  //typedef typename Tri::Facet_iterator Facet_iterator;
+  typedef typename Tri::Vertex_handle Vertex_handle;
+  typedef typename Tri::Cell_handle Cell_handle;
+  typedef typename Tri::All_cells_iterator All_cells_iterator;
+  typedef typename Tri::All_edges_iterator All_edges_iterator;
+  typedef typename Tri::All_facets_iterator All_facets_iterator;
+  typedef typename Tri::Finite_vertices_iterator Finite_vertices_iterator;
+
+  // accessory types
+  typedef typename TraitsT::Facet_flip Facet_flip_event;
+  typedef typename Facet_flip_event::P Event_base;
+  typedef typename TraitsT::Edge_flip Edge_flip_event;
+  typedef Tri Triangulation;
+
+  Delaunay_triangulation_base_3(TraitsT tr, Visitor v): tr_(tr),
+							triangulation_(tr.instantaneous_kernel_object()),
+							soc_(tr.side_of_oriented_sphere_3_object()),
+							o3_(tr.orientation_3_object()),
+							v_(v) {
+    if (0) print();
+    has_certificates_=false;
+  }
+
+  const TraitsT& simulation_traits_object() const {return tr_;}
+
+
+  const Visitor& visitor() const
+  {
+    return v_;
+  }
+  Visitor& visitor() {
+    return v_;
+  }
+
+  //! Just write the objects in order;
+  template <class Stream>
+  void write(Stream &out) const
+  {
+    //out << triangulation_;
+    for (All_cells_iterator cit= triangulation_.all_cells_begin(); cit != triangulation_.all_cells_end();
+	 ++cit) {
+      Cell_handle h= cit;
+      for (unsigned int i=0; i<4; ++i) {
+	out << h->vertex(i)->point() << " ";
+      }
+      out << "--";
+      for (unsigned int i=0; i<4; ++i) {
+	Facet f(h, i);
+	out << triangulation_.label(f) << " ";
+      }
+      out << std::endl;
+    }
+    for (All_edges_iterator eit = triangulation_.all_edges_begin(); eit != triangulation_.all_edges_end(); ++eit) {
+      triangulation_.write_labeled_edge(*eit, out);
+      if (is_degree_3(*eit)) {
+	//out << " " << triangulation_.label(*eit);
+      }
+      else {
+	if (has_event(*eit)) {
+	  out << " ?? " ;           //<< triangulation_.label(*eit);
+	}
+	//CGAL_assertion(triangulation_.label(*eit)== Event_key::null());
+      }
+      out << std::endl;
+    }
+    for (All_facets_iterator eit = triangulation_.all_facets_begin(); eit != triangulation_.all_facets_end(); ++eit) {
+      triangulation_.write_labeled_facet(*eit, out);
+      if (!has_degree_3_edge(*eit)) {
+	//out << " " << triangulation_.label(*eit);
+      }
+      else {
+	//CGAL_assertion(triangulation_.label(*eit)== Event_key::null());
+	if (has_event(*eit)) {
+	  out << " ?? ";            //<< triangulation_.label(*eit);
+	}
+      }
+      out << std::endl;
+    }
+  }
+  bool is_degree_3(const Edge &e) const {
+    return triangulation_.has_degree_3(e);
+  }
+
+  bool is_degree_4(Vertex_handle vh) const {
+    return triangulation_.degree(vh) == 4;
+  }
+
+  bool has_degree_3_edge(const Facet& f) const {
+    return triangulation_.has_degree_3(f);
+  }
+
+  bool has_degree_4_vertex(const Facet& f) const {
+    return is_degree_4(triangulation_.vertex(f,0))
+      || is_degree_4(triangulation_.vertex(f,1))
+      || is_degree_4(triangulation_.vertex(f,2));
+  }
+
+  bool has_degree_4_vertex(const Edge& f) const {
+    return is_degree_4(triangulation_.vertex(f,0))
+      || is_degree_4(triangulation_.vertex(f,1));
+  }
+
+  bool print() const
+  {
+    write(std::cout);
+    return true;
+  }
+
+  /*!
+    Delete all incident face and edge events (have to push edge events on to facets).
+    Insert point.
+    Set edges to never fails. Set outside facets.
+  */
+  /*Vertex_handle push_vertex(Point_key k, Cell_handle c) {
+    clean_cell(c);
+    v_.pre_insert_vertex(k, c);
+    // into max dim simplex?
+    Vertex_handle vh=triangulation_.tds().insert_in_cell( c);
+    vh->set_point(k);
+    set_vertex_handle(k, vh);
+    std::vector<Cell_handle> ics;
+    triangulation_.incident_cells(vh, std::back_insert_iterator<std::vector<Cell_handle> >(ics));
+    CGAL_postcondition(ics.size() == 4);
+    for (unsigned int j=0; j< ics.size(); ++j) {
+      Cell_handle cc= ics[j];
+      handle_new_cell(cc);
+    }
+    v_.post_insert_vertex(vh);
+    return vh;
+    }*/
+
+  Cell_handle pop_vertex(Vertex_handle v) {
+    v_.pre_remove_vertex(v);
+    CGAL_precondition(is_degree_4(v));
+    std::vector<Cell_handle> ics;
+    triangulation_.incident_cells(v, std::back_insert_iterator<std::vector<Cell_handle> >(ics));
+    Point_key k= v->point();
+    for (unsigned int j=0; j< ics.size(); ++j) {
+      clean_cell(ics[j]);
+    }
+   
+    set_vertex_handle(v->point(), NULL);
+
+    Cell_handle h= triangulation_.tds().remove_from_maximal_dimension_simplex(v);
+    handle_new_cell(h);
+    v_.post_remove_vertex(k);
+
+    return h;
+  }
+
+  void delete_vertex(Point_key) {
+    CGAL_error();
+  }
+
+
+  Vertex_handle change_vertex(Point_key k) {
+    if (!has_certificates()) return NULL;
+    //triangulation_.geom_traits().set_time(simulator()->current_time_as_nt());
+    std::vector<Cell_handle> incident_cells;
+    triangulation_.incident_cells(vertex_handle(k), back_inserter(incident_cells));
+    for (typename std::vector<Cell_handle>::iterator it= incident_cells.begin(); 
+	 it != incident_cells.end();
+	 ++it) {
+      clean_cell(*it);
+    }
+
+    for (typename std::vector<Cell_handle>::iterator it= incident_cells.begin();
+	 it != incident_cells.end(); ++it) {
+      handle_new_cell(*it);
+    }
+    v_.change_vertex(vertex_handle(k));
+    return vertex_handle(k);
+  }
+
+  /*typename Triangulation::Vertex_handle new_vertex_regular(Point_key k, Cell_handle h=NULL) {
+    CGAL_precondition(!has_certificates_);
+    typename Simulator::NT nt= simulator()->next_time_representable_as_nt();
+    CGAL_precondition(simulator()->current_time() == nt);
+    //simulator()->set_current_time(nt);
+    triangulation_.geom_traits().set_time(nt);
+    typename Triangulation::Vertex_handle vh= triangulation_.insert(k, h);
+    v_.create_vertex(vh);
+    return vh;
+    }*/
+
+  typename Triangulation::Vertex_handle insert(Point_key k) {
+    /* NT nt= simulator()->next_time_representable_as_nt();
+    simulator()->set_current_time(nt);
+    triangulation_.geom_traits().set_time(nt);*/
+    set_instantaneous_time();
+    //typename Simulator::NT nt= simulator()->next_time_representable_as_nt();
+    //simulator()->set_current_time(nt);
+    //std::cout << "Locating at time " << triangulation_.geom_traits().time() << std::endl;
+    Cell_handle h= triangulation_.locate(k);
+    /*if (h != Cell_handle() && h->vertex(0) != Vertex_handle()
+	       && h->vertex(1) != Vertex_handle()
+	       && h->vertex(2) != Vertex_handle()
+	       && h->vertex(3) != Vertex_handle()) {
+      std::cout << "Kinetic located in " << h->vertex(0)->point() << " "
+		<< h->vertex(1)->point() << " "
+		<< h->vertex(2)->point() << " "
+		<< h->vertex(3)->point() << std::endl;
+    } else {
+      std::cout << "Kinetic located outside hull" << std::endl;
+      }*/
+    return insert(k,h);
+  }
+
+  //!
+  /*!
+    Some old certificate edges will be lost, have to find all conflicts first.
+
+    An important problem case is the edges which were previously degree 3 but are no longer
+    after insertion. They can now be degree 4 and will have their certificate deleted properly.
+    However, this leaves a face with no certificate (the one or more not destroyed by the new vertex).
+
+    This occurs when a degree 3 edges has a facet added but none destroyed--i.e. a boundary edge
+    with degree 3.
+  */
+  typename Triangulation::Vertex_handle insert(Point_key k, Cell_handle h) {
+    //CGAL_precondition(h != NULL);
+
+    std::vector<Facet> bfacets;
+    std::vector<Cell_handle> cells;
+    std::vector<Facet> ifacets;
+    //typename Simulator::NT nt= simulator()->next_time_representable_as_nt();
+    //CGAL_precondition(simulator()->current_time() == nt);
+    //triangulation_.geom_traits().set_time(nt);
+    set_instantaneous_time();
+    CGAL_precondition(triangulation_.geom_traits().time() == simulator()->current_time());
+    Vertex_handle vh;
+    v_.pre_insert_vertex(k, h);
+    if (triangulation_.dimension() == 3) {
+      triangulation_.find_conflicts(k, h, back_inserter(bfacets), 
+				    back_inserter(cells),back_inserter(ifacets));
+      if (has_certificates_) {
+	for (unsigned int i=0; i < cells.size(); ++i) {
+	  clean_cell(cells[i]);
+	}
+      }
+      
+   
+      //! \todo replace by insert_in_hole
+
+      CGAL_LOG(Log::LOTS, "Inserting " << k << " at time " 
+		       << triangulation_.geom_traits().time() << "\n");
+      vh=triangulation_.insert_in_hole(k, cells.begin(), cells.end(), 
+						     bfacets.front().first, bfacets.front().second);
+    } else {
+      vh= triangulation_.insert(k,h);
+    }
+    set_vertex_handle(k,vh);
+    if (triangulation_.dimension() == 3 && vh != Vertex_handle()) {
+      change_vertex(k);
+    }
+    
+    CGAL_expensive_postcondition(audit_structure());
+    v_.post_insert_vertex(vh);
+    return vh;
+  }
+
+  bool has_certificates() const
+  {
+    return has_certificates_;
+  }
+
+  void set_instantaneous_time(bool after=false) const {
+    if (!triangulation_.geom_traits().has_time() || triangulation_.geom_traits().time() != simulator()->current_time()) {
+      typename Simulator::NT nt= simulator()->next_time_representable_as_nt();
+      
+      if (simulator()->current_time() == nt) {
+	if (after) {
+	  triangulation_.geom_traits().set_time_to_after(nt);
+	} else {
+	  triangulation_.geom_traits().set_time(nt);
+	}
+      } else {
+	CGAL_LOG(Log::SOME, "Warning, insertion of points at non-rational times is slow.\n");
+	if (after) {
+	  triangulation_.geom_traits().set_time_to_after(simulator()->current_time());
+	} else {
+	  triangulation_.geom_traits().set_time(simulator()->current_time());
+	}
+      }
+    }
+  }
+
+  void set_has_certificates(bool b) {
+    if (!has_certificates_ && b) {
+      if (triangulation().dimension() == 3) {
+	for (All_edges_iterator eit = triangulation_.all_edges_begin();
+	     eit != triangulation_.all_edges_end(); ++eit) {
+	  CGAL_assertion(!has_event(*eit));
+	}
+	for (All_facets_iterator eit = triangulation_.all_facets_begin();
+	     eit != triangulation_.all_facets_end(); ++eit) {
+	  CGAL_assertion(!has_event(*eit));
+	}
+	create_all_certificates();
+	has_certificates_=true;
+      }
+    } else if (has_certificates_ && !b) {
+      destroy_all_certificates();
+      has_certificates_=false;
+    }
+  }
+
+ void create_all_certificates() {
+    CGAL_precondition(!has_certificates_);
+ 
+    for (All_edges_iterator eit = triangulation_.all_edges_begin();
+	 eit != triangulation_.all_edges_end(); ++eit) {
+      if (is_degree_3(*eit) && !has_degree_4_vertex(*eit)) {
+	make_certificate(*eit);
+      }
+    }
+    for (All_facets_iterator eit = triangulation_.all_facets_begin();
+	 eit != triangulation_.all_facets_end(); ++eit) {
+      if (!has_degree_3_edge(*eit)) {
+	make_certificate(*eit);
+      }
+    }
+    for (All_cells_iterator cit= triangulation_.all_cells_begin(); 
+	 cit != triangulation_.all_cells_end(); ++cit) {
+      v_.create_cell(cit);
+    }
+  }
+
+
+  void destroy_all_certificates() {
+    //vhs_.clear();
+    CGAL_precondition(has_certificates_);
+    for (All_edges_iterator eit = triangulation_.all_edges_begin();
+	 eit != triangulation_.all_edges_end(); ++eit) {
+      Event_key k= triangulation_.label(*eit);
+      if ( k != Event_key() ) {
+	simulator()->delete_event(k);
+	triangulation_.set_label(*eit,Event_key());
+      }
+    }
+    for (All_facets_iterator eit = triangulation_.all_facets_begin();
+	 eit != triangulation_.all_facets_end(); ++eit) {
+      Event_key k= triangulation_.label(*eit);
+      if (k != Event_key() ) {
+	simulator()->delete_event(k);
+	triangulation_.set_label(*eit,Event_key());
+      }
+      //}
+    }
+    for (All_cells_iterator cit= triangulation_.all_cells_begin(); 
+	 cit != triangulation_.all_cells_end(); ++cit) {
+      v_.destroy_cell(cit);
+    }
+  }
+ 
+
+
+  Facet flip(const Edge &edge) {
+    v_.pre_edge_flip(edge);
+    
+    CGAL_LOG(Log::LOTS,"\n\nFlipping edge ");
+    CGAL_LOG(Log::LOTS,edge.first->vertex(edge.second)->point() << "--" 
+		     << edge.first->vertex(edge.third)->point() << std::endl);
+    CGAL_assertion(triangulation_.tds().is_edge(edge.first, edge.second, edge.third) || print());
+    if (has_degree_4_vertex(edge)) {
+      CGAL_LOG(Log::LOTS,"dropping edge since endpoint is degree 4\n ");
+      triangulation_.set_label(edge, simulator()->null_event());
+      return Facet();
+    }
+    CGAL_assertion(!has_degree_4_vertex(edge));
+
+    Vertex_handle poles[2];
+    poles[0]= edge.first->vertex(edge.second);
+    poles[1]= edge.first->vertex(edge.third);
+    int polesi[2];
+    polesi[0] = edge.first->index(poles[0]);
+    polesi[1]= edge.first->index(poles[1]);
+
+    typename Simulator::Event_key failed_key = triangulation_.label(edge);
+    CGAL_precondition(failed_key.is_valid());
+    Certificate ore= extract_root_stack(failed_key);
+   
+    Facet neighboring_facet= triangulation_.opposite(Facet(edge.first, polesi[0]));
+
+    triangulation_.set_label(edge, typename Simulator::Event_key());
+
+    // handle the cross edges to make sure that they are no longer edge flips
+    {
+      Cell_circulator cc= triangulation_.incident_cells(edge), ce= cc;
+      do {
+	Cell_handle h=cc;
+	clean_cell(h);
+      } while (++cc != ce);
+    }
+
+    triangulation_.tds().flip_flippable(edge);
+    CGAL_expensive_assertion(labeling_is_valid());
+    /*if (verbose){
+      write_labeled_state();
+      }*/
+
+    CGAL_assertion(triangulation_.tds().is_facet(neighboring_facet.first, neighboring_facet.second));
+    Facet internal_facet= triangulation_.opposite(neighboring_facet);
+
+    Cell_handle cells[2];
+    cells[1]= internal_facet.first;
+    polesi[1]= cells[1]->index(poles[1]);
+    cells[0]= cells[1]->neighbor(polesi[1]);
+    polesi[0]= cells[0]->index(poles[0]);
+
+    Facet middle_facet(cells[0], polesi[0]);
+    triangulation_.clear_cell_labels(middle_facet.first);
+    triangulation_.clear_cell_labels(triangulation_.opposite(middle_facet).first);
+
+    if (ore.will_fail()) {
+      typename Simulator::Time t= ore.failure_time();
+      ore.pop_failure_time();
+      typename Simulator::Event_key k= simulator()->new_event(t, 
+							      Facet_flip_event(ore, middle_facet, tr_.wrapper_handle()));
+      
+      triangulation_.set_label(middle_facet, k);
+    } else {
+      triangulation_.set_label(middle_facet, simulator()->null_event());
+    }
+
+    for (int c=0; c<2; ++c) {
+      handle_new_cell(cells[c]);
+    }
+
+    CGAL_postcondition(audit_structure());
+    v_.post_edge_flip(middle_facet);
+    return middle_facet;
+  }
+
+
+
+
+
+
+
+
+
+
+
+  Edge flip(const Facet &flip_facet) {
+    v_.pre_facet_flip(flip_facet);
+    Vertex_handle poles[2];
+    Facet other_flip_facet= triangulation_.opposite(flip_facet);
+    poles[0]= flip_facet.first->vertex(flip_facet.second);
+    poles[1]= other_flip_facet.first->vertex(other_flip_facet.second);
+    
+    CGAL_LOG(Log::LOTS,"\n\nFlipping facet ");
+    CGAL_LOG(Log::LOTS,flip_facet.first->vertex((flip_facet.second+1)%4)->point() << "--"
+		     << flip_facet.first->vertex((flip_facet.second+2)%4)->point() << "--"
+		     << flip_facet.first->vertex((flip_facet.second+3)%4)->point() << std::endl);
+    //triangulation_.write_labeled_facet(flip_facet, log_lots() );
+    CGAL_LOG(Log::LOTS," with poles " << poles[0]->point() << ", " << poles[1]->point());
+    CGAL_LOG(Log::LOTS,std::endl);
+    
+    CGAL_assertion(triangulation_.tds().is_facet(flip_facet.first, flip_facet.second) || print());
+
+    Event_key failed_key= triangulation_.label(flip_facet);
+    Certificate ore= extract_root_stack(failed_key);
+    if (ore.will_fail()) {
+      CGAL_LOG(Log::LOTS, "Next root of certificate is " << ore.failure_time() << std::endl);
+    } else {
+      CGAL_LOG(Log::LOTS, "Certificate will never fail" << std::endl);
+    }
+    triangulation_.set_label(flip_facet, Event_key());
+
+    //typename P::Event_key index= triangulation_.label(flip_facet);
+
+    Facet inside_facet(flip_facet.first, (flip_facet.second+1)%4);
+    Facet neighbor_facet= triangulation_.opposite(inside_facet);
+    Cell_handle cells[2]= {flip_facet.first, other_flip_facet.first};
+    CGAL_assertion(neighbor_facet.first != cells[0] && neighbor_facet.first != cells[1]);
+
+    // go around and change the handler for each edge if it is degree 3. Don't have to look off cell
+    for (int c=0; c<2; ++c) {
+      clean_cell(cells[c]);
+    }
+   
+   
+    triangulation_.tds().flip_flippable(flip_facet);
+
+    CGAL_assertion(triangulation_.tds().is_facet(neighbor_facet.first, neighbor_facet.second));
+
+    Facet a_facet= triangulation_.opposite(neighbor_facet);
+    Cell_handle a_cell= a_facet.first;
+
+    Edge central_edge(a_cell, a_cell->index(poles[0]), a_cell->index(poles[1]));
+
+    Cell_circulator cc= triangulation_.incident_cells(central_edge), ce=cc;
+    do {
+      triangulation_.clear_cell_labels(cc);
+    } while (++cc != ce);
+
+
+    if (ore.will_fail()) {
+      typename Simulator::Time t= ore.failure_time();
+      ore.pop_failure_time();
+      typename Simulator::Event_key k= simulator()->new_event(t, Edge_flip_event(ore, central_edge, tr_.wrapper_handle()));
+      triangulation_.set_label(central_edge, k);
+    } else {
+      triangulation_.set_label(central_edge, simulator()->null_event());
+    }
+    
+    CGAL_expensive_assertion(labeling_is_valid());
+
+    {
+      Cell_circulator cc= triangulation_.incident_cells(central_edge), ce=cc;
+      do {
+	handle_new_cell(cc);
+      } while (++cc != ce);
+    }
+
+    CGAL_postcondition(audit_structure());
+    v_.post_facet_flip(central_edge);
+    return central_edge;
+  }
+
+
+
+
+
+
+
+
+
+
+
+  void audit() const
+  {
+    CGAL_LOG(Log::SOME, "Verifying at time " << simulator()->audit_time() << ".\n");
+    set_instantaneous_time();
+    //CGAL_precondition(triangulation_.geom_traits().time()== simulator()->audit_time());
+    //triangulation_.geom_traits().set_time(simulator().rational_current_time());
+    audit_structure();
+    triangulation_.is_valid(true);
+  }
+
+
+
+
+
+
+
+
+
+  const Triangulation& triangulation() const
+  {
+    return triangulation_;
+  }
+
+  Triangulation& triangulation() {
+    return triangulation_;
+  }
+
+  const Moving_object_table* moving_object_table() const
+  {
+    return tr_.active_points_3_table_handle();
+  }
+
+  Simulator* simulator() {
+    return tr_.simulator_handle();
+  }
+
+  const Simulator* simulator() const
+  {
+    return tr_.simulator_handle();
+  }
+
+  const Point& point(Point_key k) const
+  {
+    return moving_object_table()->at(k);
+  }
+
+  Vertex_handle vertex_handle(Point_key k) const
+  {
+    if (k.is_valid() && k.index() < vhs_.size()) {
+      return vhs_[k.index()];
+    }
+    else {
+      return NULL;
+    }
+  }
+
+  void set_vertex_handle(Point_key k, Vertex_handle vh) {
+    CGAL_precondition(k != Point_key());
+    unsigned int bin= k.index();
+    while (vhs_.size() <= bin) {
+      vhs_.push_back(Vertex_handle(NULL));
+    }
+    /*if (vhs_.size() <=bin){
+      vhs_.resize(bin+1);
+      }*/
+    vhs_[k.index()]=vh;
+  }
+
+  typename TraitsT::Side_of_oriented_sphere_3 power_test_object() const
+  {
+    return soc_;
+  };
+  typename TraitsT::Orientation_3 orientation_object() const
+  {
+    return o3_;
+  }
+  Certificate extract_root_stack(Event_key k) const
+  {
+    //typename Simulator::Event_handle<Event_base> eh(simulator()->event(k, Event_base()));
+    //typename Simulator::Root_stack s= eh.pointer()->root_stack();
+    return simulator()->template event<Event_base>(k/*, Event_base()*/).root_stack();
+  }
+  /*
+    typename Simulator::Time extract_time(Event_key k) const {
+    return simulator()->event<Facet_flip_event::Base>(k)->time();
+    }*/
+
+
+
+  void make_certificate( const Edge &e,
+			 const typename Simulator::Time& st) {
+    CGAL_LOG(Log::LOTS, "making certificate for edge ");
+    CGAL_LOG_WRITE(Log::LOTS, triangulation_.write_edge(e, LOG_STREAM));
+    CGAL_LOG(Log::LOTS, std::endl);
+    CGAL_precondition(is_degree_3(e));
+    CGAL_precondition_code(Facet_circulator fc= triangulation_.incident_facets(e));
+    CGAL_precondition_code(Facet_circulator fe= fc);
+    CGAL_precondition_code(do {
+      );
+			   CGAL_precondition(!has_event(*fc));
+			   CGAL_precondition_code(++fc);
+			   CGAL_precondition_code(
+						  }while(fc != fe));
+
+    CGAL_precondition(is_degree_3(e));
+    CGAL_precondition(!has_degree_4_vertex(e));
+    CGAL_precondition(!has_event(e));
+    
+    Certificate s= root_stack(e, st);
+   
+    if (s.will_fail()) {
+      CGAL_LOG(Log::LOTS,"Failure time is " << s.failure_time() << std::endl);
+      typename Simulator::Time t= s.failure_time();
+      s.pop_failure_time();
+      if (s.will_fail()) {
+	CGAL_LOG(Log::LOTS, "Next root of this cert is " << s.failure_time() << std::endl);
+      }
+      typename Simulator::Event_key k=  simulator()->new_event(t, Edge_flip_event(s, e, tr_.wrapper_handle()));
+      triangulation_.set_label(e, k);
+    } else {
+      CGAL_LOG(Log::LOTS,"Certificate will not fail "<< std::endl);
+      triangulation_.set_label(e, simulator()->null_event());
+    }
+  }
+  void make_certificate( const Edge &e) {
+    make_certificate(e, simulation_traits_object().simulator_handle()->current_time());
+  }
+
+
+
+
+
+  void make_certificate( const Facet &e,
+			 const typename Simulator::Time &st) {
+    CGAL_precondition(!has_event(e));
+    CGAL_LOG(Log::LOTS, "making certificate for facet ");
+    CGAL_LOG_WRITE(Log::LOTS, triangulation_.write_facet(e, LOG_STREAM ));
+    //triangulation_.write_facet(e, log_lots());
+    CGAL_LOG(Log::LOTS,  std::endl);
+
+    CGAL_precondition(!has_degree_3_edge(e));
+    for (int i=0; i<3; ++i) {
+      CGAL_precondition(triangulation_.label(triangulation_.edge(e, i)) == Event_key());
+    }
+    Certificate s= root_stack(e, st);
+    if (s.will_fail()) {
+      typename Simulator::Time t= s.failure_time();
+      CGAL_LOG(Log::LOTS, "Failure time is " << t << std::endl);
+      s.pop_failure_time();
+      if (s.will_fail()) {
+	CGAL_LOG(Log::LOTS, "Next root of this cert is " << s.failure_time() << std::endl);
+      }
+      typename Simulator::Event_key k= simulator()->new_event(t, Facet_flip_event(s, e, tr_.wrapper_handle()));
+      triangulation_.set_label(e, k);
+    } else {
+      CGAL_LOG(Log::LOTS, "Certificate will not fail" << std::endl);
+      triangulation_.set_label(e, simulator()->null_event());
+    }
+  }
+
+   void make_certificate( const Facet &e) {
+     make_certificate(e,
+		      simulation_traits_object().simulator_handle()->current_time());
+   }
+
+ 
+
+  template <class Oit>
+  void point_keys(const Facet &f, Oit out) const
+  {
+    int hinf=-1;
+    for (unsigned int i=0; i<4; ++i) {
+      Point_key k= f.first->vertex(i)->point();
+      if (!k.is_valid()) {
+	hinf=i;
+	break;
+      }
+    }
+    if (hinf==-1) {
+      Point_key k= triangulation_.mirror_vertex(f.first, f.second)->point();
+      if ( ! k.is_valid() ) {
+	hinf=4;
+      }
+    }
+    if (hinf != -1) {
+      CGAL_LOG(Log::LOTS, "hinf is " << hinf << std::endl);
+      if (hinf ==4) {
+	for (unsigned int i=0; i<4; ++i) {
+	  Point_key k= f.first->vertex(i)->point();
+	  *out= k;
+	  ++out;
+	}
+	return;
+      }
+      else {
+	//Facet ff(f.first, hinf);
+	if (hinf%2!=0) {
+	  Point_key k= triangulation_.mirror_vertex(f.first, f.second)->point();
+	  *out= k;
+	  ++out;
+	}
+	for (int i=0; i<4; ++i) {
+	  // CGAL infinite cells seem to be misoriented
+	  if (i==hinf) continue;
+	  *out= f.first->vertex(i)->point();
+	  ++out;
+	}
+	if (hinf%2==0) {
+	  Point_key k= triangulation_.mirror_vertex(f.first, f.second)->point();
+	  *out= k;
+	  ++out;
+	}
+      }
+    }
+    else {
+      for (unsigned int i=0; i<4; ++i) {
+	Point_key k= f.first->vertex(i)->point();
+	*out= k;
+	++out;
+      }
+      Point_key k= triangulation_.mirror_vertex(f.first, f.second)->point();
+      *out= k;
+      ++out;
+    }
+  }
+
+
+
+
+private:
+  Certificate root_stack(const Edge &e, const typename Simulator::Time &st) const
+  {
+    return root_stack(*triangulation_.incident_facets(e), st);
+  }
+
+  
+
+  void make_no_events(const Edge &e) {
+    CGAL_precondition(triangulation_.has_degree_3(e));
+    Facet_circulator fc= triangulation_.incident_facets(e);
+    Facet_circulator fe= fc;
+    do {
+      if (has_event(*fc)) {
+	Event_key k= triangulation_.label(*fc);
+	simulator()->delete_event(k);
+	triangulation_.set_label(*fc, Event_key());
+      }
+    } while(++fc != fe);
+  }
+public:
+  Point_key replace_vertex(Vertex_handle vh, Point_key k) {
+    Point_key ok= vh->point();
+    vh->point()=k;
+    vhs_[ok.index()]= Vertex_handle();
+    vhs_[k.index()]= vh;
+    return ok;
+  }
+protected:
+  bool has_event(const Edge &e) const
+  {
+    return triangulation_.label(e) != Event_key();
+  }
+
+  bool has_event(const Facet &e) const
+  {
+    
+    return triangulation_.label(e) != Event_key();
+  }
+
+
+  void create_edge_flips(Vertex_handle v) {
+    CGAL_precondition(!is_degree_4(v));
+    std::vector<Cell_handle> ics;
+    triangulation().incident_cells(v, std::back_inserter(ics));
+    for (unsigned int i=0; i< ics.size(); ++i) {
+      int j=-1;// disable warning
+      CGAL_assertion_code(bool ret=)
+        ics[i]->has_vertex(v, j); // initializes j
+      CGAL_assertion(j != -1);
+      CGAL_assertion(ret);
+      for (int k=0; k<4 ; ++k) {
+	if (k==j) continue;
+	Edge e(ics[i], j, k);
+	if (is_degree_3(e) && !has_event(e) && !has_degree_4_vertex(e)) {
+	  // rather than make_certificate due to ordering dependencies
+	  make_edge_flip(e);
+	}
+      }
+    }
+  }
+
+  void suppress_edge_flips(Vertex_handle v) {
+    CGAL_precondition(is_degree_4(v));
+    std::vector<Cell_handle> ics;
+    triangulation().incident_cells(v, std::back_inserter(ics));
+    for (unsigned int i=0; i< ics.size(); ++i) {
+      int j=-1; // keep some dumb compiler happy
+      CGAL_assertion_code(bool ret=)
+        ics[i]->has_vertex(v, j);
+      CGAL_assertion(ret);
+      for (int k=0; k<4 ; ++k) {
+	if (k==j) continue;
+	Edge e(ics[i], j, k);
+	if (has_event(e)) {
+	  simulator()->delete_event(triangulation_.label(e));
+	  triangulation().set_label(e, Event_key());
+	}
+      }
+    }
+  }
+
+  void make_edge_flip(Edge &edge) {
+    CGAL_LOG(Log::LOTS, "Making edge flip ");
+    CGAL_LOG_WRITE(Log::LOTS, triangulation_.write_labeled_edge(edge, LOG_STREAM ));
+    CGAL_LOG(Log::LOTS,std::endl);
+    CGAL_assertion(triangulation_.has_degree_3(edge));
+    typename Simulator::Event_key k= typename Simulator::Event_key();
+    Facet_circulator fc= triangulation_.incident_facets(edge), fe=fc;
+    do {
+      if (has_event(*fc)) {
+	CGAL_assertion( k == Event_key() );
+	k=triangulation_.label(*fc);
+	triangulation_.set_label(*fc, typename Simulator::Event_key());
+	Event_key kk=change_to_edge_flip(edge, k);
+	triangulation_.set_label(edge, kk);
+	simulator()->audit_event(kk);
+	return;
+      }
+    } while (++fc != fe);
+
+
+    CGAL_LOG(Log::LOTS, "Making up edge event.\n");
+    make_certificate(edge);
+  }
+
+  void make_not_edge_flip(Edge &edge, Cell_handle h) {
+    if (true) {
+      CGAL_LOG(Log::LOTS, "Making edge ");
+      CGAL_LOG_WRITE(Log::LOTS, triangulation_.write_labeled_edge(edge, LOG_STREAM ));
+      CGAL_LOG(Log::LOTS, " not an edge flip.\n");
+    }
+    CGAL_assertion(is_degree_3(edge) || print());
+    typename Simulator::Event_key index = triangulation_.label(edge);
+    CGAL_precondition( index != Event_key() );
+
+    triangulation_.set_label(edge, typename Simulator::Event_key());
+
+    Cell_circulator fc=triangulation_.incident_cells(edge), pfc=fc, ef;
+    ++fc;
+    ef=fc;
+    do {
+      if( (h != fc) && ( h != pfc) ) {
+	for (unsigned int i=0; i< 4; ++i) {
+	  if (pfc->neighbor(i) == fc){
+	    Facet f(pfc, i);
+	    CGAL_precondition(!has_event(f));
+	    triangulation_.set_label(f, change_to_facet_flip(f, index));
+	    simulator()->audit_event(triangulation_.label(f));
+	  }
+	}
+      }
+      ++pfc; ++fc;
+    } while (ef != fc);
+  }
+
+  template <class C>
+  std::back_insert_iterator<C> back_inserter(C &c) const
+  {
+    return std::back_insert_iterator<C>(c);
+  }
+
+  bool contains(typename std::vector<Facet>::iterator beg,
+		typename std::vector<Facet>::iterator end, Facet f) {
+    Facet of = triangulation_.opposite(f);
+    for (; beg != end; ++beg) {
+      if (f.first == beg->first) {
+	if (f.second == beg->second) return true;
+      }
+      else if (of.first == beg->first) {
+	if (of.second == beg->second) return true;
+      }
+    }
+    return false;
+  }
+
+  bool labeling_is_valid() const
+  {
+    for (All_facets_iterator eit= triangulation_.all_facets_begin(); eit != triangulation_.all_facets_end();
+	 ++eit) {
+      Facet f= *eit;
+      Facet of= triangulation_.opposite(f);
+      if (triangulation_.label(f) != triangulation_.label(of)) {
+	triangulation_.write_labeled_facet(f, std::cerr);
+	std::cerr << " does not match ("<< triangulation_.label(f) << ", "
+		  << triangulation_.label(of) << ")\n";
+      }
+    }
+    for (All_edges_iterator eit= triangulation_.all_edges_begin(); eit != triangulation_.all_edges_end();
+	 ++eit) {
+      Edge e=*eit;
+      triangulation_.label(e);
+    }
+    return true;
+  }
+
+
+
+  bool audit_structure() const
+  {
+    if (triangulation_.dimension() != 3) return true;
+
+    std::set<Point_key> pks;
+    for (Finite_vertices_iterator eit = triangulation_.finite_vertices_begin();
+	  eit != triangulation_.finite_vertices_end(); ++eit) {
+      CGAL_assertion_code(Point_key k= eit->point());
+      CGAL_assertion(pks.find(k) == pks.end());
+      CGAL_assertion_code(pks.insert(k));
+    }
+    
+    if (!has_certificates()) {
+      for (All_edges_iterator eit = triangulation_.all_edges_begin();
+	   eit != triangulation_.all_edges_end(); ++eit) {
+	CGAL_assertion(!has_event(*eit));
+      }
+      for (All_facets_iterator eit = triangulation_.all_facets_begin();
+	   eit != triangulation_.all_facets_end(); ++eit) {
+	CGAL_assertion(!has_event(*eit));
+      }
+    } else {
+      CGAL_LOG(Log::SOME, "Auditing structure" << std::endl);
+      //print();
+      
+      for (All_edges_iterator eit = triangulation_.all_edges_begin();
+	   eit != triangulation_.all_edges_end(); ++eit) {
+	bool isd3= is_degree_3(*eit);
+	bool hd4= has_degree_4_vertex(*eit);
+	if (!isd3 || hd4) {
+	  if (has_event(*eit)) {
+	    std::cerr << "Edge should not have certificate ";
+	    triangulation_.write_labeled_edge(*eit, std::cerr);
+	    std::cerr << std::endl;
+	    simulator()->audit_event(triangulation_.label(*eit));
+	    CGAL_error();
+	  }
+	} else if ( isd3) {
+	  if (!has_event(*eit)) {
+	    std::cerr << "Edge should have certificate ";
+	    triangulation_.write_labeled_edge(*eit, std::cerr);
+	    std::cerr << std::endl;
+	    CGAL_error();
+	  } else {
+	    simulator()->audit_event(triangulation_.label(*eit));
+	  }
+	}
+      }
+
+      for (All_facets_iterator eit = triangulation_.all_facets_begin();
+	   eit != triangulation_.all_facets_end(); ++eit) {
+	bool hsd3= has_degree_3_edge(*eit);
+	bool hd4= has_degree_4_vertex(*eit);
+	if (hsd3 || hd4) {
+	  if (has_event(*eit)) {
+	    std::cerr << "Facet should not have certificate ";
+	    triangulation_.write_labeled_facet(*eit, std::cerr);
+	    std::cerr << std::endl;
+	    simulator()->audit_event(triangulation_.label(*eit));
+	    CGAL_error();
+	  }
+	} else {
+	  if (!has_event(*eit)) {
+	    std::cerr << "Facet should have certificate ";
+	    triangulation_.write_labeled_facet(*eit, std::cerr);
+	    std::cerr << std::endl;
+	    CGAL_error();
+	  } else {
+	    simulator()->audit_event(triangulation_.label(*eit));
+	  }
+	}
+      }
+    }
+    return true;
+  }
+
+  Event_key change_to_edge_flip(const Edge &e, Event_key k) {
+    if (k== simulator()->null_event()) return k;
+    Certificate s= extract_root_stack(k);
+    return simulator()->set_event(k, Edge_flip_event(s, e, tr_.wrapper_handle()));
+  }
+
+  Event_key change_to_facet_flip(const Facet &f, Event_key k) {
+    if (k== simulator()->null_event()) return k;
+    Certificate s= extract_root_stack(k);
+    return simulator()->set_event(k, Facet_flip_event(s, f, tr_.wrapper_handle()));
+  }
+
+  /*Moving_object_table* moving_object_table() {
+    return mpt_.pointer();
+    }*/
+
+public:
+  void clean_cell(Cell_handle h) {
+    CGAL_precondition(has_certificates_);
+    for (unsigned int i=0; i< 4; ++i) {
+      for (unsigned int j=0; j<i; ++j) {
+	Edge e(h, i, j);
+	if (has_event(e)) {
+	  make_not_edge_flip(e, h);
+	  //delete_event(triangulation_.label(e));
+	  //triangulation_.set_label(e, Event_key());
+	}
+      }
+    }
+    for (unsigned int i=0; i< 4; ++i) {
+      Facet f(h, i);
+      if (has_event(f)) {
+	simulator()->delete_event(triangulation_.label(f));
+	triangulation_.set_label(f, Event_key());
+      }
+    }
+    v_.destroy_cell(h);
+  }
+
+  void handle_new_cell(Cell_handle h) {
+    CGAL_precondition(has_certificates_);
+    for (unsigned int i=0; i<4; ++i) {
+      for (unsigned int j=0; j< i; ++j) {
+	Edge e(h, i, j);
+	if (is_degree_3(e) && !has_event(e) && !has_degree_4_vertex(e)) {
+	  make_edge_flip(e);
+	}
+      }
+      Facet f(h, i);
+      if (!has_event(f) && !has_degree_3_edge(f)) {
+	make_certificate(f);
+      }
+     
+    }
+    for (unsigned int i=0; i<4; ++i) {
+      Vertex_handle vh= h->vertex(i);
+      if (is_degree_4(vh)) {
+	suppress_edge_flips(vh);
+      } else {
+	create_edge_flips(vh);
+      }
+    }
+
+    v_.create_cell(h);
+  }
+protected:
+  void handle_changed_cell(Cell_handle) {
+    
+  }
+
+  Certificate root_stack(const Facet &f,
+			 const typename Simulator::Time &st) const
+  {
+    std::vector<Point_key> ids;
+    point_keys(f, back_inserter(ids));
+#ifndef NDEBUG
+    std::vector<Point_key> mids;
+    Facet of= triangulation_.opposite(f);
+    point_keys(of, back_inserter(mids));
+#endif
+#ifndef NDEBUG
+    CGAL_LOG(Log::LOTS, "Creating root_stack for points ");
+    for (typename std::vector<Point_key>::const_iterator cit= ids.begin(); cit != ids.end(); ++cit) {
+      CGAL_LOG(Log::LOTS, *cit);
+    }
+    CGAL_LOG(Log::LOTS, std::endl);
+#endif
+    bool is_const=true;
+    for (unsigned int i=0; i<ids.size(); ++i) {
+      if (!point(ids[i]).is_constant()) {
+	is_const=false;
+	break;
+      }
+    }
+    if (is_const) {
+      //typename Kinetic_kernel::Certificate_function cf(1.0);
+      return Certificate(); //simulator()->root_stack_object(cf);
+    }
+    else if (ids.size()==4) {
+      /*if (point(ids[0]).is_constant()){
+      // hack
+      std::swap(ids[0], ids[3]);
+      std::swap(ids[1], ids[2]);
+      }*/
+      return o3_(point(ids[0]),
+		 point(ids[1]),
+		 point(ids[2]),
+		 point(ids[3]),
+		 st,
+		 simulator()->end_time());
+    }
+    else {
+      CGAL_assertion(ids.size()==5);
+      /*if (point(ids[0]).is_constant()){
+      // hack for linear case
+      std::swap(ids[0], ids[4]);
+      std::swap(ids[1], ids[2]);
+      }*/
+      return soc_(point(ids[0]),
+		  point(ids[1]),
+		  point(ids[2]),
+		  point(ids[3]),
+		  point(ids[4]),
+		  st,
+		  simulator()->end_time());
+    }
+    // Some compilers give warnings without this
+    CGAL_postcondition(0);
+    return Certificate();
+    //return simulator()->root_stack_object(typename TraitsT::Simulator::Function_kernel::Function(0));
+  }
+
+  
+  TraitsT tr_;
+  Triangulation triangulation_;
+  std::vector<Vertex_handle> vhs_;
+  typename TraitsT::Side_of_oriented_sphere_3 soc_;
+  typename TraitsT::Orientation_3 o3_;
+  bool has_certificates_;
+  Visitor v_;
+};
+
+template <class TraitsT, class Visitor>
+inline std::ostream &operator<<(std::ostream &out,
+				const Delaunay_triangulation_base_3<TraitsT, Visitor> &dt)
+{
+  dt.write(out);
+  return out;
+}
+
+
+} } } //namespace CGAL::Kinetic::internal
+#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/Instantaneous_adaptor.h b/3rdparty/CGAL/include/CGAL/Kinetic/internal/Instantaneous_adaptor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/Instantaneous_adaptor.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/internal/Instantaneous_adaptor.h
diff --git a/3rdparty/CGAL/include/CGAL/Kinetic/internal/Kernel/Cartesian_kinetic_kernel_base.h b/3rdparty/CGAL/include/CGAL/Kinetic/internal/Kernel/Cartesian_kinetic_kernel_base.h
new file mode 100644
index 0000000..5aa6a9b
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Kinetic/internal/Kernel/Cartesian_kinetic_kernel_base.h
@@ -0,0 +1,259 @@
+// Copyright (c) 2005  Stanford University (USA).
+// 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(s)     : Daniel Russel <drussel at alumni.princeton.edu>
+
+#ifndef CGAL_KINETIC_INTERNAL_KERNEL_CARTESIAN_KINETIC_KERNEL_BASE_H
+#define CGAL_KINETIC_INTERNAL_KERNEL_CARTESIAN_KINETIC_KERNEL_BASE_H
+#include <CGAL/Kinetic/basic.h>
+#include <CGAL/Kinetic/internal/Kernel/Cartesian_moving_point_1.h>
+#include <CGAL/Kinetic/internal/Kernel/Cartesian_moving_point_2.h>
+#include <CGAL/Kinetic/internal/Kernel/Cartesian_moving_point_3.h>
+#include <CGAL/Kinetic/internal/Kernel/Cartesian_moving_weighted_point_3.h>
+#include <CGAL/Kinetic/internal/Kernel/cartesian_predicates_2.h>
+#include <CGAL/Kinetic/internal/Kernel/cartesian_predicates_3.h>
+#include <CGAL/Kinetic/internal/Kernel/Reverse_time.h>
+#include <CGAL/Kinetic/internal/Kernel/Delaunay_lifting.h>
+#include <CGAL/Kinetic/Certificate_generator.h>
+#include <CGAL/Kinetic/internal/Kernel/Certificate.h>
+#include <CGAL/Kinetic/internal/Kernel/Center.h>
+
+namespace CGAL { namespace Kinetic { namespace internal {
+
+//! A kinetic kernel using cartesian coordinates
+/*!
+  It takes a PolynomialKernel as a template parameter. The PolynomialKernel is used to define the Motion_function and the Certificate_function.
+*/
+template <class Function_kernel_k, class This>
+class Cartesian_kinetic_kernel_base
+{
+public:
+  typedef Cartesian_kinetic_kernel_base<Function_kernel_k, This> Base;
+  Cartesian_kinetic_kernel_base(Function_kernel_k pk): k_(pk){};
+  Cartesian_kinetic_kernel_base(){};
+
+  //! The type of function used to represent coordinates.
+  typedef typename Function_kernel_k::Function Motion_function;
+  //! The type of function used to represent the results of certificate 
+  typedef typename Function_kernel_k::Function Certificate_function;
+
+  typedef CGAL::Kinetic::internal::Certificate<Function_kernel_k> Certificate;
+
+  //! I am not sure if I want to expose this.
+  typedef Function_kernel_k Function_kernel;
+
+  //! A 1d Point
+  typedef Cartesian_moving_point_1<Motion_function> Point_1;
+
+  //! A 2d Point
+  typedef Cartesian_moving_point_2<Motion_function> Point_2;
+
+  //! A 3d Point
+  typedef Cartesian_moving_point_3<Motion_function> Point_3;
+
+  //! A 3d weighted Point
+  typedef Cartesian_moving_weighted_point_3<Motion_function> Weighted_point_3;
+
+  //! A 3d lifted Point
+  // typedef internal::Cartesian_moving_lifted_point_3<Motion_function> Moving_lifted_point_3;
+
+
+  struct Is_constant {
+    template <class T>
+    bool operator()(const T&t) const {
+      return t.is_constant();
+    }
+  };
+
+  Is_constant is_constant_object() const {
+    return Is_constant();
+  }
+
+  //! 2D orientation
+  /*!
+    Takes 3 Point_2.
+  */
+  typedef Certificate_generator<This, Cartesian_orientation_2<This> > Orientation_2;
+  Orientation_2 orientation_2_object() const
+  {
+    return Orientation_2(k_);
+  }
+  //! 3D orientation
+  /*!
+    Takes 4 Point_3.
+  */
+  typedef Certificate_generator<This, Cartesian_weighted_orientation_3<This> > Orientation_3;
+  Orientation_3 orientation_3_object() const
+  {
+    return Orientation_3(k_);
+  }
+
+  /*typedef  Cartesian_orientation_3<This> Orientation_3;
+  Orientation_3 orientation_3_object() const
+  {
+    return Orientation_3(k_);
+    }*/
+
+  //! The in_circle test.
+  typedef Certificate_generator<This, Cartesian_side_of_oriented_circle_2<This> > Side_of_oriented_circle_2;
+  Side_of_oriented_circle_2 side_of_oriented_circle_2_object() const
+  {
+    return Side_of_oriented_circle_2(k_);
+  }
+
+  //! The 3D in_circle test.
+  typedef Certificate_generator<This, Cartesian_side_of_oriented_sphere_3<This> > Side_of_oriented_sphere_3;
+  Side_of_oriented_sphere_3 side_of_oriented_sphere_3_object() const
+  {
+    return Side_of_oriented_sphere_3(k_);
+  }
+
+  //! The power test for weighted points.
+  typedef Certificate_generator<This, Cartesian_power_test_3<This> > Power_test_3;
+  Power_test_3 power_test_3_object() const
+  {
+    return Power_test_3(k_);
+  }
+
+  //! An orientation test for weighted points.
+  typedef Certificate_generator<This, Cartesian_weighted_orientation_3<This> > Weighted_orientation_3;
+  Weighted_orientation_3 weighted_orientation_3_object() const
+  {
+    return Weighted_orientation_3(k_);
+  }
+
+  /*typedef  Cartesian_weighted_orientation_3<This> Weighted_orientation_3;
+  Weighted_orientation_3 weighted_orientation_3_object() const
+  {
+    return Weighted_orientation_3();
+    }*/
+
+  template <class Arg>
+  struct Null_generator {
+    typedef Arg argument_type;
+    typedef Arg first_argument_type;
+    typedef Arg second_argument_type;
+    typedef Arg third_argument_type;
+    typedef Arg fourth_argument_type;
+    typedef Certificate_function result_type;
+    
+    template <class AT>
+    result_type operator()(const AT &) const {
+      CGAL_error();
+      return result_type(0);
+    }
+    template <class AT0, class AT1>
+    result_type operator()(const AT0 &, const AT1 &) const {
+      CGAL_error();
+      return result_type(0);
+    }
+    template <class AT0, class AT1, class AT2>
+    result_type operator()(const AT0 &, const AT1 &,
+			   const AT2 &) const {
+      CGAL_error();
+      return result_type(0);
+    }
+    template <class AT0, class AT1, class AT2, class AT3>
+    result_type operator()(const AT0 &, const AT1 &,
+			   const AT2 &, const AT3 &) const {
+      CGAL_error();
+      return result_type(0);
+    }
+
+  };
+
+  typedef Certificate_generator<This, Null_generator<Point_3> > Compare_xyz_3;
+  Compare_xyz_3 compare_xyz_3_object() const {return Compare_xyz_3();}
+
+  typedef Certificate_generator<This, Cartesian_equal_3<This> > Equal_3;
+  Equal_3 equal_3_object() const {return Equal_3();}
+
+
+  typedef Certificate_generator<This, Null_generator<Point_3> > Coplanar_orientation_3;
+  Coplanar_orientation_3 coplanar_orientation_3_object() const {return Coplanar_orientation_3();}
+
+  typedef Certificate_generator<This, Null_generator<Point_3> > Coplanar_side_of_bounded_circle_3;
+  Coplanar_side_of_bounded_circle_3 coplanar_side_of_bounded_circle_3_object() const {return Coplanar_side_of_bounded_circle_3();}
+  
+
+  //! Compare the x coordinates of two points
+  typedef Certificate_generator<This, Cartesian_compare_distance_2<This> > Compare_distance_2;
+  Compare_distance_2 compare_distance_2_object() const {return Compare_distance_2();}
+
+  //! Compare the x coordinates of two points
+  typedef Certificate_generator<This, Cartesian_compare_distance_3<This> > Compare_distance_3;
+  Compare_distance_3 compare_distance_3_object() const {return Compare_distance_3();}
+
+  //! Compare the x coordinates of two points
+  typedef Certificate_generator<This, Cartesian_less_x_1<This> > Compare_x_1;
+  Compare_x_1 compare_x_1_object() const {return Compare_x_1(k_);}
+
+  //! Compare the x coordinates of two points
+  typedef Certificate_generator<This, Cartesian_less_x_2<This> > Compare_x_2;
+  Compare_x_2 compare_x_2_object() const {return Compare_x_2(k_);}
+
+  //! Compare the y coordinate of two points
+  typedef Certificate_generator<This, Cartesian_less_y_2<This> > Compare_y_2;
+  Compare_y_2 compare_y_2_object() const {return Compare_y_2(k_);}
+
+  //! Compare the x coordinate of two points
+  typedef Certificate_generator<This, Cartesian_less_x_3<This> > Compare_x_3;
+  Compare_x_3 compare_x_3_object() const {return Compare_x_3(k_);}
+
+  //! Compare the y coordinate of two points
+  typedef Certificate_generator<This, Cartesian_less_y_3<This> > Compare_y_3;
+  Compare_y_3 compare_y_3_object() const {return Compare_y_3(k_);}
+
+  //! Compare the z coordinate of two points
+  typedef Certificate_generator<This, Cartesian_less_z_3<This> > Compare_z_3;
+  Compare_z_3 compare_z_3_object() const {return Compare_z_3(k_);}
+
+
+
+  //! computes the lifted coordinate under the lifting map
+  typedef Delaunay_lifting<This> Delaunay_lifting_3;
+  Delaunay_lifting_3 Delaunay_lifting_3_object() const
+  {
+    return Delaunay_lifting_3();
+  }
+  //! Finds the center of an object
+  typedef Center<This> Center_3;
+  Center_3 center_3_object() const
+  {
+    return Center_3();
+  }
+  //! Return the PolynomialKernel
+  const Function_kernel &function_kernel_object() const
+  {
+    return k_;
+  }
+
+  typedef internal::Reverse_time<This> Reverse_time;
+  Reverse_time reverse_time_object() const
+  {
+    return Reverse_time(k_.negate_variable_object());
+  }
+
+protected:
+  Function_kernel k_;
+};
+
+} } } //namespace CGAL::Kinetic::internal
+
+
+#endif
diff --git a/3rdparty/CGAL/include/CGAL/Kinetic/internal/Kernel/Cartesian_moving_lifted_point_3.h b/3rdparty/CGAL/include/CGAL/Kinetic/internal/Kernel/Cartesian_moving_lifted_point_3.h
new file mode 100644
index 0000000..ef0c66e
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Kinetic/internal/Kernel/Cartesian_moving_lifted_point_3.h
@@ -0,0 +1,136 @@
+// Copyright (c) 2005  Stanford University (USA).
+// 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(s)     : Daniel Russel <drussel at alumni.princeton.edu>
+
+#ifndef CGAL_KINETIC_CARTESIAN_WEIGHTED_MOVING_LIFTED_3_H_
+#define CGAL_KINETIC_CARTESIAN_WEIGHTED_MOVING_LIFTED_3_H_
+#include <CGAL/Kinetic/basic.h>
+#include <iostream>
+#include <CGAL/Kinetic/internal/Kernel/Cartesian_moving_point_3.h>
+
+namespace CGAL { namespace Kinetic { namespace internal {;
+
+template <class Coordinate_t>
+class Cartesian_moving_lifted_point_3
+{
+    protected:
+        typedef Cartesian_moving_lifted_point_3<Coordinate_t> This;
+        typedef Cartesian_moving_point_3<Coordinate_t> Point;
+    public:
+
+        typedef Point Bare_point;
+//typedef Static_point_t Static_point;
+
+//! The cartesian coordinate type
+        typedef Coordinate_t Coordinate;
+
+//! What should I do for this
+        typedef typename Coordinate::NT NT;
+
+//! initialize it from polys
+        Cartesian_moving_lifted_point_3(const Point &pt, const Coordinate &w): point_(pt), lifted_(w) {
+        }
+
+//! initialize it from a still point
+        template <class Static_point>
+            Cartesian_moving_lifted_point_3(const Static_point &pt): point_(pt.point()),
+        lifted_(pt.weight()) {
+        }
+
+//! null
+        Cartesian_moving_lifted_point_3(){}
+
+        const Point &point() const
+        {
+            return point_;
+        }
+
+        const Coordinate &lifted() const
+        {
+            return lifted_;
+        }
+
+        bool is_constant() const
+        {
+            if (lifted_.degree() >0) return false;
+            return point_.is_constant();
+        }
+
+        Coordinate weight() const
+        {
+//if (weight_==Coordinate()){
+//	weight_=
+            return point().x()*point().x()+ point().y()*point().y() + point().z()*point().z() - lifted_;
+//}
+//return weight_;
+        }
+
+//! Reverse the motion
+        template <class CV>
+            This negated_time(const CV &cv) const
+        {
+            This ret(point_.negated_time(cv), cv(lifted_));
+            return ret;
+        }
+
+        template <class SK>
+            struct Static_traits
+        {
+            typedef typename SK::Weighted_point Static_type;
+            static Static_type to_static(const This &o, const typename Coordinate_t::NT &t, const SK&) {
+                typename Coordinate_t::NT x=o.point().x()(t),
+                    y= o.point().y()(t),
+                    z= o.point().z()(t);
+                return Static_type(typename SK::Bare_point(x,y,z),
+                    CGAL::square(x)
+                    + CGAL::square(y)
+                    + CGAL::square(z)- o.lifted()(t));
+            }
+        };
+        template <class Converter>
+            struct Coordinate_converter
+        {
+            Coordinate_converter(const Converter &c): c_(c), pc_(c){}
+            typedef Cartesian_moving_weighted_point_3<typename Converter::argument_type> argument_type;
+            typedef Cartesian_moving_weighted_point_3<typename Converter::result_type> result_type;
+
+            result_type operator()(const argument_type &i) const
+            {
+                return result_type(pc_(i.point()), c_(i.lifted()));
+            }
+
+            Converter c_;
+            typename Bare_point::template Coordinate_converter<Converter> pc_;
+        };
+    protected:
+        Point point_;
+        Coordinate lifted_;
+// Coordinate weight_;
+};
+
+template <class Coordinate>
+std::ostream &operator<<(std::ostream &out, const Cartesian_moving_lifted_point_3<Coordinate> &point)
+{
+    out << point.point() << ", " <<  point.lifted();
+    return out;
+}
+
+
+} } } //namespace CGAL::Kinetic::internal;
+#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/Kernel/Cartesian_moving_orthosphere_3.h b/3rdparty/CGAL/include/CGAL/Kinetic/internal/Kernel/Cartesian_moving_orthosphere_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/Kernel/Cartesian_moving_orthosphere_3.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/internal/Kernel/Cartesian_moving_orthosphere_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/Kernel/Cartesian_moving_point_1.h b/3rdparty/CGAL/include/CGAL/Kinetic/internal/Kernel/Cartesian_moving_point_1.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/Kernel/Cartesian_moving_point_1.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/internal/Kernel/Cartesian_moving_point_1.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/Kernel/Cartesian_moving_point_2.h b/3rdparty/CGAL/include/CGAL/Kinetic/internal/Kernel/Cartesian_moving_point_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/Kernel/Cartesian_moving_point_2.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/internal/Kernel/Cartesian_moving_point_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/Kernel/Cartesian_moving_point_3.h b/3rdparty/CGAL/include/CGAL/Kinetic/internal/Kernel/Cartesian_moving_point_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/Kernel/Cartesian_moving_point_3.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/internal/Kernel/Cartesian_moving_point_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/Kernel/Cartesian_moving_weighted_point_3.h b/3rdparty/CGAL/include/CGAL/Kinetic/internal/Kernel/Cartesian_moving_weighted_point_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/Kernel/Cartesian_moving_weighted_point_3.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/internal/Kernel/Cartesian_moving_weighted_point_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/Kernel/Center.h b/3rdparty/CGAL/include/CGAL/Kinetic/internal/Kernel/Center.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/Kernel/Center.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/internal/Kernel/Center.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/Kernel/Certificate.h b/3rdparty/CGAL/include/CGAL/Kinetic/internal/Kernel/Certificate.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/Kernel/Certificate.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/internal/Kernel/Certificate.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/Kernel/Delaunay_lifted_lifting.h b/3rdparty/CGAL/include/CGAL/Kinetic/internal/Kernel/Delaunay_lifted_lifting.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/Kernel/Delaunay_lifted_lifting.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/internal/Kernel/Delaunay_lifted_lifting.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/Kernel/Delaunay_lifting.h b/3rdparty/CGAL/include/CGAL/Kinetic/internal/Kernel/Delaunay_lifting.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/Kernel/Delaunay_lifting.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/internal/Kernel/Delaunay_lifting.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/Kernel/Reverse_time.h b/3rdparty/CGAL/include/CGAL/Kinetic/internal/Kernel/Reverse_time.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/Kernel/Reverse_time.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/internal/Kernel/Reverse_time.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/Kernel/cartesian_predicates_2.h b/3rdparty/CGAL/include/CGAL/Kinetic/internal/Kernel/cartesian_predicates_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/Kernel/cartesian_predicates_2.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/internal/Kernel/cartesian_predicates_2.h
diff --git a/3rdparty/CGAL/include/CGAL/Kinetic/internal/Kernel/cartesian_predicates_3.h b/3rdparty/CGAL/include/CGAL/Kinetic/internal/Kernel/cartesian_predicates_3.h
new file mode 100644
index 0000000..b4e779d
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Kinetic/internal/Kernel/cartesian_predicates_3.h
@@ -0,0 +1,814 @@
+// Copyright (c) 2005  Stanford University (USA).
+// 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(s)     : Daniel Russel <drussel at alumni.princeton.edu>
+
+#ifndef CGAL_KINETIC_CARTESIAN_PREDICATES_3_H
+#define CGAL_KINETIC_CARTESIAN_PREDICATES_3_H
+#include <CGAL/Kinetic/basic.h>
+#include <CGAL/determinant.h>
+
+
+namespace CGAL { namespace Kinetic { namespace internal {
+
+
+
+template <class KK>
+struct Cartesian_side_of_oriented_sphere_3
+{
+  Cartesian_side_of_oriented_sphere_3(){}
+
+  typedef typename KK::Certificate_function result_type;
+  typedef typename KK::Point_3 first_argument_type;
+  typedef typename KK::Point_3 second_argument_type;
+  typedef typename KK::Point_3 third_argument_type;
+  typedef typename KK::Point_3 fourth_argument_type;
+  typedef typename KK::Point_3 fifth_argument_type;
+  result_type operator()(const first_argument_type &a,
+			 const second_argument_type &b,
+			 const third_argument_type &c,
+			 const fourth_argument_type &d,
+			 const fourth_argument_type &e)const
+  {
+    typedef typename KK::Motion_function FT;
+    // We translate the points so that T becomes the origin.
+    FT dpx = (a.x()) - (e.x());
+    FT dpy = (a.y()) - (e.y());
+    FT dpz = (a.z()) - (e.z());
+    FT dpt = dpx*dpx + dpy*dpy + dpz*dpz;
+    FT dqx = (b.x()) - (e.x());
+    FT dqy = (b.y()) - (e.y());
+    FT dqz = (b.z()) - (e.z());
+    FT dqt = dqx*dqx + dqy*dqy + dqz*dqz;
+    FT drx = (c.x()) - (e.x());
+    FT dry = (c.y()) - (e.y());
+    FT drz = (c.z()) - (e.z());
+    FT drt = drx*drx + dry*dry + drz*drz;
+    FT dsx = (d.x()) - (e.x());
+    FT dsy = (d.y()) - (e.y());
+    FT dsz = (d.z()) - (e.z());
+    FT dst = dsx*dsx + dsy*dsy + dsz*dsz;
+    FT ret= CGAL::determinant(dpx, dpy, dpz, dpt,
+				    dqx, dqy, dqz, dqt,
+				    drx, dry, drz, drt,
+				    dsx, dsy, dsz, dst);
+    /*  CGAL_KINETIC_MAPLE_LOG( << std::endl << std::endl;
+	CGAL_KINETIC_MAPLE_LOG( << "pt3\n";
+	CGAL_KINETIC_MAPLE_LOG( << "m:=matrix(5,5,[[";
+	CGAL_KINETIC_MAPLE_LOG(
+	<< a.x() << ", " << a.y() << ", " << a.z() << ", " << a.x()*a.x()+a.y()*a.y()+a.z()*a.z() << ", 1], ["
+	<< a.x() << ", " << b.y() << ", " << b.z() << ", " << b.x()*b.x()+b.y()*b.y()+b.z()*b.z() << ", 1], ["
+	<< c.x() << ", " << c.y() << ", " << c.z() << ", " << c.x()*c.x()+c.y()*c.y()+c.z()*c.z() << ", 1], ["
+	<< d.x() << ", " << d.y() << ", " << d.z() << ", " << d.x()*d.x()+d.y()*d.y()+d.z()*a.z() << ", 1], ["
+	<< e.x() << ", " << e.y() << ", " << e.z() << ", " << e.x()*e.x()+e.y()*e.y()+e.z()*e.z() << ", 1]]);\n";
+	CGAL_KINETIC_MAPLE_LOG( << "det(m)-( " << ret << ");\n";
+	::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << "m2:= matrix(4,4,[[";
+	::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << dpx << "," << dpy << "," << dpz << "," << dpt << "], [";
+	::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << dqx << "," << dqy << "," << dqz << "," << dqt << "], [";
+	::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << drx << "," << dry << "," << drz << "," << drt << "], [";
+	::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << dsx << "," << dsy << "," << dsz << "," << dst << "]]);\n";
+    */
+    return ret;
+  }
+};
+
+template <class KK>
+struct Cartesian_power_test_3
+{
+  typedef typename KK::Certificate_function result_type;
+  typedef typename KK::Weighted_point_3 first_argument_type;
+  typedef typename KK::Weighted_point_3 second_argument_type;
+  typedef typename KK::Weighted_point_3 third_argument_type;
+  typedef typename KK::Weighted_point_3 fourth_argument_type;
+  typedef typename KK::Weighted_point_3 fifth_argument_type;
+  Cartesian_power_test_3(){}
+  result_type operator()(const first_argument_type &a,
+			 const second_argument_type &b,
+			 const third_argument_type &c,
+			 const fourth_argument_type &d,
+			 const fourth_argument_type &e)const
+  {
+    typedef typename KK::Motion_function FT;
+    // We translate the points so that T becomes the origin.
+    FT dpx = (a.point().x()) - (e.point().x());
+    FT dpy = (a.point().y()) - (e.point().y());
+    FT dpz = (a.point().z()) - (e.point().z());
+    FT dpt = dpx*dpx + dpy*dpy
+      + dpz*dpz - (a.weight()) + (e.weight());
+    FT dqx = (b.point().x()) - (e.point().x());
+    FT dqy = (b.point().y()) - (e.point().y());
+    FT dqz = (b.point().z()) - (e.point().z());
+    FT dqt = dqx*dqx + dqy*dqy
+      + dqz*dqz - (b.weight()) + (e.weight());
+    FT drx = (c.point().x()) - (e.point().x());
+    FT dry = (c.point().y()) - (e.point().y());
+    FT drz = (c.point().z()) - (e.point().z());
+    FT drt = drx*drx + dry*dry
+      + drz*drz - (c.weight()) + (e.weight());
+    FT dsx = (d.point().x()) - (e.point().x());
+    FT dsy = (d.point().y()) - (e.point().y());
+    FT dsz = (d.point().z()) - (e.point().z());
+    FT dst = dsx*dsx + dsy*dsy
+      + dsz*dsz - (d.weight()) + (e.weight());
+
+    return ::CGAL::determinant(dpx, dpy, dpz, dpt,
+				     dqx, dqy, dqz, dqt,
+				     drx, dry, drz, drt,
+				     dsx, dsy, dsz, dst);
+  }
+
+ result_type operator()(const first_argument_type &,
+			const second_argument_type &,
+			const third_argument_type &,
+			const fourth_argument_type &)const
+  {
+    CGAL_error();
+    return result_type();
+  }
+  result_type operator()(const first_argument_type &,
+			 const second_argument_type &,
+			 const third_argument_type &)const
+  {
+    CGAL_error();
+    return result_type();
+  }
+  result_type operator()(const first_argument_type &,
+			 const second_argument_type &)const
+  {
+    CGAL_error();
+    return result_type();
+  }
+};
+
+// Works for unweighted points.
+template <class KK>
+struct Cartesian_lifted_power_test_3
+{
+  Cartesian_lifted_power_test_3(){}
+  typedef typename KK::Certificate_function result_type;
+  typedef typename KK::Weighted_point_3 first_argument_type;
+  typedef typename KK::Weighted_point_3 second_argument_type;
+  typedef typename KK::Weighted_point_3 third_argument_type;
+  typedef typename KK::Weighted_point_3 fourth_argument_type;
+  typedef typename KK::Weighted_point_3 fifth_argument_type;
+  result_type operator()(const first_argument_type &a,
+			 const second_argument_type &b,
+			 const third_argument_type &c,
+			 const fourth_argument_type &d,
+			 const fourth_argument_type &e)const
+  {
+    typedef typename KK::Motion_function FT;
+
+    FT dpx = (a.point().x()) - (e.point().x());
+    FT dpy = (a.point().y()) - (e.point().y());
+    FT dpz = (a.point().z()) - (e.point().z());
+    FT dpt = (a.lifted()) - (e.lifted());
+    FT dqx = (b.point().x()) - (e.point().x());
+    FT dqy = (b.point().y()) - (e.point().y());
+    FT dqz = (b.point().z()) - (e.point().z());
+    FT dqt = (b.lifted()) - (e.lifted());
+    FT drx = (c.point().x()) - (e.point().x());
+    FT dry = (c.point().y()) - (e.point().y());
+    FT drz = (c.point().z()) - (e.point().z());
+    FT drt = (c.lifted()) - (e.lifted());
+    FT dsx = (d.point().x()) - (e.point().x());
+    FT dsy = (d.point().y()) - (e.point().y());
+    FT dsz = (d.point().z()) - (e.point().z());
+    FT dst = (d.lifted()) - (e.lifted());
+
+    return CGAL::determinant(dpx, dpy, dpz, dpt,
+				   dqx, dqy, dqz, dqt,
+				   drx, dry, drz, drt,
+				   dsx, dsy, dsz, dst);
+  }
+};
+
+template <class KK>
+struct Cartesian_linear_lifted_power_test_3
+{
+  Cartesian_linear_lifted_power_test_3(){}
+  typedef typename KK::Certificate_function result_type;
+  typedef typename KK::Weighted_point_3 first_argument_type;
+  typedef typename KK::Weighted_point_3 second_argument_type;
+  typedef typename KK::Weighted_point_3 third_argument_type;
+  typedef typename KK::Weighted_point_3 fourth_argument_type;
+  typedef typename KK::Weighted_point_3 fifth_argument_type;
+  result_type operator()(first_argument_type a,
+			 second_argument_type b,
+			 third_argument_type c,
+			 fourth_argument_type d,
+			 fourth_argument_type e)const
+  {
+    typedef typename KK::Motion_function FT;
+    typedef typename FT::NT NT;
+    /*if (a.is_constant()){
+      std::swap(a,e);
+      std::swap(b,c);
+      }*/
+
+    //typedef typename RT::NT FT;
+    // We translate the points so that T becomes the origin.
+    FT safe_ret;
+
+    {
+      FT dpx = (a.point().x()) - (e.point().x());
+      FT dpy = (a.point().y()) - (e.point().y());
+      FT dpz = (a.point().z()) - (e.point().z());
+      FT dpt = (a.lifted()) - (e.lifted());
+      FT dqx = (b.point().x()) - (e.point().x());
+      FT dqy = (b.point().y()) - (e.point().y());
+      FT dqz = (b.point().z()) - (e.point().z());
+      FT dqt = (b.lifted()) - (e.lifted());
+      FT drx = (c.point().x()) - (e.point().x());
+      FT dry = (c.point().y()) - (e.point().y());
+      FT drz = (c.point().z()) - (e.point().z());
+      FT drt = (c.lifted()) - (e.lifted());
+      FT dsx = (d.point().x()) - (e.point().x());
+      FT dsy = (d.point().y()) - (e.point().y());
+      FT dsz = (d.point().z()) - (e.point().z());
+      FT dst = (d.lifted()) - (e.lifted());
+
+      safe_ret = CGAL::determinant(dpx, dpy, dpz, dpt,
+					 dqx, dqy, dqz, dqt,
+					 drx, dry, drz, drt,
+					 dsx, dsy, dsz, dst);
+    }
+    FT ret;
+    {
+      if (!b.is_constant()) {
+	std::swap(a,b);
+	std::swap(c,d);
+      }
+      else if (! c.is_constant()) {
+	std::swap(a,c);
+	std::swap(b,d);
+      }
+      else if (! d.is_constant()) {
+	std::swap(a,d);
+	std::swap(b,c);
+      }
+      else if (! e.is_constant()) {
+	std::swap(a,e);
+	std::swap(b,c);
+      }
+      CGAL_precondition(b.is_constant());
+      CGAL_precondition(c.is_constant());
+      CGAL_precondition(d.is_constant());
+      CGAL_precondition(e.is_constant());
+
+      FT a00 = a.point().x() - e.point().x();
+      FT a01 = a.point().y() - e.point().y();
+      FT a02 = a.point().z() - e.point().z();
+      FT a03 = a.lifted() - e.lifted();
+      NT a10 = b.point().x()[0] - e.point().x()[0];
+      NT a11 = b.point().y()[0] - e.point().y()[0];
+      NT a12 = b.point().z()[0] - e.point().z()[0];
+      NT a13 = b.lifted()[0] - e.lifted()[0];
+      NT a20 = c.point().x()[0] - e.point().x()[0];
+      NT a21 = c.point().y()[0] - e.point().y()[0];
+      NT a22 = c.point().z()[0] - e.point().z()[0];
+      NT a23 = c.lifted()[0] - e.lifted()[0];
+      NT a30 = d.point().x()[0] - e.point().x()[0];
+      NT a31 = d.point().y()[0] - e.point().y()[0];
+      NT a32 = d.point().z()[0] - e.point().z()[0];
+      NT a33 = d.lifted()[0] - e.lifted()[0];
+      // First ompute the det2x2
+      const FT m01 = a10*a01 - a00*a11;
+      const FT m02 = a20*a01 - a00*a21;
+      const FT m03 = a30*a01 - a00*a31;
+      const NT m12 = a20*a11 - a10*a21;
+      const NT m13 = a30*a11 - a10*a31;
+      const NT m23 = a30*a21 - a20*a31;
+      // Now compute the minors of rank 3
+      const FT m012 = m12*a02 - m02*a12 + m01*a22;
+      const FT m013 = m13*a02 - m03*a12 + m01*a32;
+      const FT m023 = m23*a02 - m03*a22 + m02*a32;
+      const NT m123 = m23*a12 - m13*a22 + m12*a32;
+      // Now compute the minors of rank 4
+      const FT m0123 = m123*a03 - m023*a13 + m013*a23 - m012*a33;
+      ret= m0123;
+    }
+    if (ret != safe_ret) {
+      ret.print();
+      safe_ret.print();
+      std::cout << a << std::endl;
+      std::cout << b << std::endl;
+      std::cout << c << std::endl;
+      std::cout << d << std::endl;
+      std::cout << e << std::endl;
+    }
+    CGAL_exactness_postcondition(ret==safe_ret);
+    return ret;
+  }
+};
+
+template <class Pt>
+typename Pt::Coordinate co3(const Pt &a, const Pt &b, const Pt &c, const Pt &d)
+{
+  //std::cout << "Computing orientation of matrix(4,4, [[" << a << ",1], [" << b << ",1], [" << c << ",1], [" << d << ",1]]);\n";
+  typedef typename Pt::Coordinate RT;
+
+  RT px= (a.x());
+  RT py= (a.y());
+  RT pz= (a.z());
+  RT qx= (b.x());
+  RT qy= (b.y());
+  RT qz= (b.z());
+  RT rx= (c.x());
+  RT ry= (c.y());
+  RT rz= (c.z());
+  RT sx= (d.x());
+  RT sy= (d.y());
+  RT sz= (d.z());
+  if (d.is_constant()) {
+    std::swap(px, sx);
+    std::swap(py, sy);
+    std::swap(pz, sz);
+    std::swap(rx, qx);
+    std::swap(ry, qy);
+    std::swap(rz, qz);
+  }
+
+  RT a00= qx-px;
+  RT a01= rx-px;
+  RT a02= sx-px;
+  RT a10= qy-py;
+  RT a11= ry-py;
+  RT a12= sy-py;
+  RT a20= qz-pz;
+  RT a21= rz-pz;
+  RT a22= sz-pz;
+  RT ret= CGAL::determinant(a00, a01, a02,
+				  a10, a11, a12,
+				  a20, a21, a22);
+  /*CGAL_LOG_MAPLE(std::endl << std::endl);
+    CGAL_LOG_MAPLE( "co3\n");
+    CGAL_LOG_MAPLE( "m:= matrix(4,4, [[1," << a.x()<<","<<a.y() <<","<<a.z() << "], [1," << b.x()<<","<<b.y()<<","<<b.z());
+    CGAL_LOG_MAPLE( "], [1," << c.x() <<","<<c.y()<<","<<c.z() << "], [1,");
+    CGAL_LOG_MAPLE( d.x() << ","<<d.y()<<","<<d.z() << "]]);"<< std::endl);
+    CGAL_LOG_MAPLE( "det(m)- (" << ret << ");" << std::endl);
+    CGAL_LOG_MAPLE( "m2:= matrix(3,3,[[,");
+    CGAL_LOG_MAPLE( a00 << "," << a01 << "," << a02 << "], [");
+    CGAL_LOG_MAPLE( a10 << "," << a11 << "," << a12 << "], [");
+    CGAL_LOG_MAPLE( a20 << "," << a21 << "," << a22 << "]]);");*/
+
+  //std::cout << "returning " << ret << std::endl;
+  return ret;
+}
+
+
+
+
+template <class KK>
+struct Cartesian_orientation_3
+{
+  Cartesian_orientation_3(){}
+
+  typedef typename KK::Certificate_function result_type;
+
+  typedef typename KK::Point_3 first_argument_type;
+  typedef typename KK::Point_3 second_argument_type;
+  typedef typename KK::Point_3 third_argument_type;
+  typedef typename KK::Point_3 fourth_argument_type;
+  result_type operator()(const first_argument_type &a,
+			 const second_argument_type &b,
+			 const third_argument_type &c,
+			 const fourth_argument_type &d) const
+  {
+    return co3(a, b, c, d);
+  }
+};
+
+template <class KK>
+struct Cartesian_weighted_orientation_3: public Cartesian_orientation_3<KK>
+{
+  Cartesian_weighted_orientation_3(){}
+  typedef typename KK::Certificate_function result_type;
+
+  typedef typename KK::Weighted_point_3 first_argument_type;
+  typedef typename KK::Weighted_point_3 second_argument_type;
+  typedef typename KK::Weighted_point_3 third_argument_type;
+  typedef typename KK::Weighted_point_3 fourth_argument_type;
+  template <class NWP>
+    result_type operator()(const NWP &a,
+			   const NWP &b,
+			   const NWP &c,
+			   const NWP &d) const {
+    return Cartesian_orientation_3<KK>::operator()(a,b,c,d);
+  }
+  result_type operator()(const first_argument_type &a,
+			 const second_argument_type &b,
+			 const third_argument_type &c,
+			 const fourth_argument_type &d) const
+  {
+    return co3(a.point(), b.point(), c.point(), d.point());
+  }
+
+};
+
+template <class KK>
+struct Cartesian_less_x_3
+{
+  Cartesian_less_x_3(){}
+  typedef typename KK::Certificate_function result_type;
+  typedef typename KK::Point_3 first_argument_type;
+  typedef typename KK::Point_3 second_argument_type;
+  result_type operator()(const first_argument_type &a,
+			 const second_argument_type &b) const
+  {
+    return a.x() - b.x();
+  }
+  typedef typename KK::Motion_function::NT NT;  
+  result_type operator()( const NT &c, const first_argument_type &a) const {
+    return result_type(c) - a.x();
+  }
+
+  result_type operator()(const second_argument_type &b, const NT &c ) const {
+    return b.x() - result_type(c);
+  }
+};
+
+template <class KK>
+struct Cartesian_less_y_3
+{
+  Cartesian_less_y_3(){}
+  typedef typename KK::Certificate_function result_type;
+
+  typedef typename KK::Point_3 first_argument_type;
+  typedef typename KK::Point_3 second_argument_type;
+  result_type operator()(const first_argument_type &a,
+			 const second_argument_type &b) const
+  {
+    return a.y() - b.y();
+  }
+  typedef typename KK::Motion_function::NT NT;  
+  result_type operator()(const NT &c, const first_argument_type &a) const {
+    return result_type(c) - a.y();
+  }
+
+  result_type operator()( const second_argument_type &b, const NT &c) const {
+    return b.y() - result_type(c);
+  }
+};
+
+template <class KK>
+struct Cartesian_less_z_3
+{
+  Cartesian_less_z_3(){}
+  typedef typename KK::Certificate_function result_type;
+
+  typedef typename KK::Point_3 first_argument_type;
+  typedef typename KK::Point_3 second_argument_type;
+  result_type operator()(const first_argument_type &a,
+			 const second_argument_type &b) const
+  {
+    return a.z() - b.z();
+  }
+  typedef typename KK::Motion_function::NT NT;  
+  result_type operator()(const NT &c, const first_argument_type &a) const {
+    return result_type(c) - a.z();
+  }
+
+  result_type operator()( const second_argument_type &b, const NT &c) const {
+    return b.z() - result_type(c);
+  }
+
+};
+
+
+template <class KK>
+struct Cartesian_equal_3
+{
+  Cartesian_equal_3(){}
+  typedef typename KK::Certificate_function result_type;
+
+  typedef typename KK::Point_3 first_argument_type;
+  typedef typename KK::Point_3 second_argument_type;
+  template <class AT>
+  result_type operator()(const AT &a,
+			 const AT &b) const
+  {
+    if (a==b) return result_type(1);
+    else return result_type(-1);
+  }
+ 
+
+ 
+};
+
+/*PREDICATE_2_BEGIN(Point_sphere_orientation_3){
+  return ;
+  }
+  PREDICATE_2_END(Cartesian_less_z_3);*/
+
+#if 0
+template <class Pt, class CC>
+typename CC::result_type co3(const Pt &a, const Pt &b, const Pt &c, const Pt &d, CC cc)
+{
+  //std::cout << "Computing orientation of matrix(4,4, [[" << a << ",1], [" << b << ",1], [" << c << ",1], [" << d << ",1]]);\n";
+  typedef typename CC::result_type RT;
+
+  RT px= cc(a.x());
+  RT py= cc(a.y());
+  RT pz= cc(a.z());
+  RT qx= cc(b.x());
+  RT qy= cc(b.y());
+  RT qz= cc(b.z());
+  RT rx= cc(c.x());
+  RT ry= cc(c.y());
+  RT rz= cc(c.z());
+  RT sx= cc(d.x());
+  RT sy= cc(d.y());
+  RT sz= cc(d.z());
+  if (d.is_constant()) {
+    std::swap(px, sx);
+    std::swap(py, sy);
+    std::swap(pz, sz);
+    std::swap(rx, qx);
+    std::swap(ry, qy);
+    std::swap(rz, qz);
+  }
+
+  RT a00= qx-px;
+  RT a01= rx-px;
+  RT a02= sx-px;
+  RT a10= qy-py;
+  RT a11= ry-py;
+  RT a12= sy-py;
+  RT a20= qz-pz;
+  RT a21= rz-pz;
+  RT a22= sz-pz;
+  RT ret= CGAL::determinant(a00, a01, a02,
+				  a10, a11, a12,
+				  a20, a21, a22);
+  CGAL::Kinetic::log()->stream(CGAL::KDS::Log::MAPLE) << std::endl << std::endl;
+  CGAL::Kinetic::log()->stream(CGAL::KDS::Log::MAPLE) << "co3\n";
+  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << "m:= matrix(4,4, [[1," << a.x()<<","<<a.y() <<","<<a.z() << "], [1," << b.x()<<","<<b.y()<<","<<b.z();
+  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << "], [1," << c.x() <<","<<c.y()<<","<<c.z() << "], [1,";
+  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << d.x() << ","<<d.y()<<","<<d.z() << "]]);"<< std::endl;
+  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << "det(m)- (" << ret << ");" << std::endl;
+  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << "m2:= matrix(3,3,[[,";
+  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << a00 << "," << a01 << "," << a02 << "], [";
+  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << a10 << "," << a11 << "," << a12 << "], [";
+  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << a20 << "," << a21 << "," << a22 << "]]);";
+
+  //std::cout << "returning " << ret << std::endl;
+  return ret;
+}
+
+
+template <class Pt, class CC>
+typename CC::result_type pt3(const Pt &a, const Pt &b, const Pt &c, const Pt &d, const Pt &e, CC cc)
+{
+  typedef typename CC::result_type FT;
+  //typedef typename RT::NT FT;
+  // We translate the points so that T becomes the origin.
+  FT dpx = cc(a.point().x()) - cc(e.point().x());
+  FT dpy = cc(a.point().y()) - cc(e.point().y());
+  FT dpz = cc(a.point().z()) - cc(e.point().z());
+  FT dpt = dpx*dpx + dpy*dpy
+    + dpz*dpz - cc(a.weight()) + cc(e.weight());
+  FT dqx = cc(b.point().x()) - cc(e.point().x());
+  FT dqy = cc(b.point().y()) - cc(e.point().y());
+  FT dqz = cc(b.point().z()) - cc(e.point().z());
+  FT dqt = dqx*dqx + dqy*dqy
+    + dqz*dqz - cc(b.weight()) + cc(e.weight());
+  FT drx = cc(c.point().x()) - cc(e.point().x());
+  FT dry = cc(c.point().y()) - cc(e.point().y());
+  FT drz = cc(c.point().z()) - cc(e.point().z());
+  FT drt = drx*drx + dry*dry
+    + drz*drz - cc(c.weight()) + cc(e.weight());
+  FT dsx = cc(d.point().x()) - cc(e.point().x());
+  FT dsy = cc(d.point().y()) - cc(e.point().y());
+  FT dsz = cc(d.point().z()) - cc(e.point().z());
+  FT dst = dsx*dsx + dsy*dsy
+    + dsz*dsz - cc(d.weight()) + cc(e.weight());
+
+  return CGAL::determinant(dpx, dpy, dpz, dpt,
+				 dqx, dqy, dqz, dqt,
+				 drx, dry, drz, drt,
+				 dsx, dsy, dsz, dst);
+}
+
+
+template <class C, class CC>
+typename CC::result_type pt3(const Cartesian_moving_point_3<C>  &a,
+			     const Cartesian_moving_point_3<C>  &b,
+			     const Cartesian_moving_point_3<C>  &c,
+			     const Cartesian_moving_point_3<C>  &d,
+			     const Cartesian_moving_point_3<C>  &e, CC cc)
+{
+  typedef typename CC::result_type FT;
+  //typedef typename RT::NT FT;
+  // We translate the points so that T becomes the origin.
+  FT dpx = cc(a.x()) - cc(e.x());
+  FT dpy = cc(a.y()) - cc(e.y());
+  FT dpz = cc(a.z()) - cc(e.z());
+  FT dpt = dpx*dpx + dpy*dpy + dpz*dpz;
+  FT dqx = cc(b.x()) - cc(e.x());
+  FT dqy = cc(b.y()) - cc(e.y());
+  FT dqz = cc(b.z()) - cc(e.z());
+  FT dqt = dqx*dqx + dqy*dqy + dqz*dqz;
+  FT drx = cc(c.x()) - cc(e.x());
+  FT dry = cc(c.y()) - cc(e.y());
+  FT drz = cc(c.z()) - cc(e.z());
+  FT drt = drx*drx + dry*dry + drz*drz;
+  FT dsx = cc(d.x()) - cc(e.x());
+  FT dsy = cc(d.y()) - cc(e.y());
+  FT dsz = cc(d.z()) - cc(e.z());
+  FT dst = dsx*dsx + dsy*dsy + dsz*dsz;
+  FT ret= CGAL::determinant(dpx, dpy, dpz, dpt,
+				  dqx, dqy, dqz, dqt,
+				  drx, dry, drz, drt,
+				  dsx, dsy, dsz, dst);
+  CGAL::Kinetic::log()->stream(CGAL::KDS::Log::MAPLE) << std::endl << std::endl;
+  CGAL::Kinetic::log()->stream(CGAL::KDS::Log::MAPLE) << "pt3\n";
+  CGAL::Kinetic::log()->stream(CGAL::KDS::Log::MAPLE) << "m:=matrix(5,5,[[";
+  CGAL::Kinetic::log()->stream(CGAL::KDS::Log::MAPLE)
+    << a.x() << ", " << a.y() << ", " << a.z() << ", " << a.x()*a.x()+a.y()*a.y()+a.z()*a.z() << ", 1], ["
+    << a.x() << ", " << b.y() << ", " << b.z() << ", " << b.x()*b.x()+b.y()*b.y()+b.z()*b.z() << ", 1], ["
+    << c.x() << ", " << c.y() << ", " << c.z() << ", " << c.x()*c.x()+c.y()*c.y()+c.z()*c.z() << ", 1], ["
+    << d.x() << ", " << d.y() << ", " << d.z() << ", " << d.x()*d.x()+d.y()*d.y()+d.z()*a.z() << ", 1], ["
+    << e.x() << ", " << e.y() << ", " << e.z() << ", " << e.x()*e.x()+e.y()*e.y()+e.z()*e.z() << ", 1]]);\n";
+  CGAL::Kinetic::log()->stream(CGAL::KDS::Log::MAPLE) << "det(m)-( " << ret << ");\n";
+  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << "m2:= matrix(4,4,[[";
+  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << dpx << "," << dpy << "," << dpz << "," << dpt << "], [";
+  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << dqx << "," << dqy << "," << dqz << "," << dqt << "], [";
+  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << drx << "," << dry << "," << drz << "," << drt << "], [";
+  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << dsx << "," << dsy << "," << dsz << "," << dst << "]]);\n";
+
+  return ret;
+}
+
+
+template <class NT, class CC>
+typename CC::result_type pt3(Cartesian_moving_lifted_point_3<CGAL::Polynomial::Linear_polynomial<NT> > a,
+			     Cartesian_moving_lifted_point_3<CGAL::Polynomial::Linear_polynomial<NT> > b,
+			     Cartesian_moving_lifted_point_3<CGAL::Polynomial::Linear_polynomial<NT> > c,
+			     Cartesian_moving_lifted_point_3<CGAL::Polynomial::Linear_polynomial<NT> > d,
+			     Cartesian_moving_lifted_point_3<CGAL::Polynomial::Linear_polynomial<NT> > e,
+			     CC cc)
+{
+  typedef typename CC::result_type FT;
+  bool flip=false;
+  bool warning_this_doesnt_really_work;
+  if (!e.is_constant()) {
+    flip=!flip;
+    std::swap(a,e);
+  }
+  else if (!d.is_constant()) {
+    flip=!flip;
+    std::swap(d,a);
+  }
+  else if (!c.is_constant()) {
+    std::swap(c,a);
+    flip=!flip;
+  }
+  else if (!b.is_constant()) {
+    std::swap(b,a);
+    flip=!flip;
+  }
+  /*  if (a.is_constant()){
+      std::swap(a,e);
+      std::swap(b,c);
+      }*/
+
+  //typedef typename RT::NT FT;
+  // We translate the points so that T becomes the origin.
+  //FT m[4][4];
+  FT a03 = cc(a.point().x()) - cc(e.point().x());
+  FT a13 = cc(a.point().y()) - cc(e.point().y());
+  FT a23 = cc(a.point().z()) - cc(e.point().z());
+  FT a33 = cc(a.lifted()) - cc(e.lifted());
+  FT a02 = cc(b.point().x()) - cc(e.point().x());
+  FT a12 = cc(b.point().y()) - cc(e.point().y());
+  FT a22 = cc(b.point().z()) - cc(e.point().z());
+  FT a32 = cc(b.lifted()) - cc(e.lifted());
+  FT a01 = cc(c.point().x()) - cc(e.point().x());
+  FT a11 = cc(c.point().y()) - cc(e.point().y());
+  FT a21 = cc(c.point().z()) - cc(e.point().z());
+  FT a31 = cc(c.lifted()) - cc(e.lifted());
+  FT a00 = cc(d.point().x()) - cc(e.point().x());
+  FT a10 = cc(d.point().y()) - cc(e.point().y());
+  FT a20 = cc(d.point().z()) - cc(e.point().z());
+  FT a30 = cc(d.lifted()) - cc(e.lifted());
+
+  FT ret;
+  {
+    // First compute the det2x2
+    const NT m01 = a10[0]*a01[0] - a00[0]*a11[0];
+    const NT m02 = a20[0]*a01[0] - a00[0]*a21[0];
+    const NT m03 = a30[0]*a01[0] - a00[0]*a31[0];
+    const NT m12 = a20[0]*a11[0] - a10[0]*a21[0];
+    const NT m13 = a30[0]*a11[0] - a10[0]*a31[0];
+    const NT m23 = a30[0]*a21[0] - a20[0]*a31[0];
+    // Now compute the minors of rank 3
+    const NT m012 = m12*a02[0] - m02*a12[0] + m01*a22[0];
+    const NT m013 = m13*a02[0] - m03*a12[0] + m01*a32[0];
+    const NT m023 = m23*a02[0] - m03*a22[0] + m02*a32[0];
+    const NT m123 = m23*a12[0] - m13*a22[0] + m12*a32[0];
+    // Now compute the minors of rank 4
+    const FT m0123 = m123*a03 - m023*a13 + m013*a23 - m012*a33;
+    ret= m0123;
+  }
+  if (flip) ret=-ret;
+  /*FT ret = CGAL::determinant(dpx, dpy, dpz, dpt,
+    dqx, dqy, dqz, dqt,
+    drx, dry, drz, drt,
+    dsx, dsy, dsz, dst);*/
+
+#if 0
+  CGAL::Kinetic::log()->stream(CGAL::KDS::Log::MAPLE) << std::endl << std::endl;
+  CGAL::Kinetic::log()->stream(CGAL::KDS::Log::MAPLE) << "pt3 lifted\n";
+  CGAL::Kinetic::log()->stream(CGAL::KDS::Log::MAPLE) << "m:=matrix(5,5,[[";
+  CGAL::Kinetic::log()->stream(CGAL::KDS::Log::MAPLE)
+    << a.point().x() << ", " << a.point().y() << ", " << a.point().z() << ", " << a.lifted() << ", 1], ["
+    << b.point().x() << ", " << b.point().y() << ", " << b.point().z() << ", " << b.lifted() << ", 1], ["
+    << c.point().x() << ", " << c.point().y() << ", " << c.point().z() << ", " << c.lifted() << ", 1], ["
+    << d.point().x() << ", " << d.point().y() << ", " << d.point().z() << ", " << d.lifted() << ", 1], ["
+    << e.point().x() << ", " << e.point().y() << ", " << e.point().z() << ", " << e.lifted() << ", 1]]);\n";
+  CGAL::Kinetic::log()->stream(CGAL::KDS::Log::MAPLE) << "det(m)-( " << ret << ");\n";
+  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << "m2:= matrix(4,4,[[";
+  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << dpx << "," << dpy << "," << dpz << "," << dpt << "], [";
+  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << dqx << "," << dqy << "," << dqz << "," << dqt << "], [";
+  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << drx << "," << dry << "," << drz << "," << drt << "], [";
+  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << dsx << "," << dsy << "," << dsz << "," << dst << "]]);\n";
+#endif
+  return ret;
+}
+
+
+template <class C, class CC>
+typename CC::result_type pt3(Cartesian_moving_lifted_point_3<C> a,
+			     Cartesian_moving_lifted_point_3<C> b,
+			     Cartesian_moving_lifted_point_3<C> c,
+			     const Cartesian_moving_lifted_point_3<C> &d,
+			     Cartesian_moving_lifted_point_3<C> e,
+			     CC cc)
+{
+  typedef typename CC::result_type FT;
+
+  if (a.is_constant()) {
+    std::swap(a,e);
+    std::swap(b,c);
+  }
+
+  //typedef typename RT::NT FT;
+  // We translate the points so that T becomes the origin.
+  FT dpx = cc(a.point().x()) - cc(e.point().x());
+  FT dpy = cc(a.point().y()) - cc(e.point().y());
+  FT dpz = cc(a.point().z()) - cc(e.point().z());
+  FT dpt = cc(a.lifted()) - cc(e.lifted());
+  FT dqx = cc(b.point().x()) - cc(e.point().x());
+  FT dqy = cc(b.point().y()) - cc(e.point().y());
+  FT dqz = cc(b.point().z()) - cc(e.point().z());
+  FT dqt = cc(b.lifted()) - cc(e.lifted());
+  FT drx = cc(c.point().x()) - cc(e.point().x());
+  FT dry = cc(c.point().y()) - cc(e.point().y());
+  FT drz = cc(c.point().z()) - cc(e.point().z());
+  FT drt = cc(c.lifted()) - cc(e.lifted());
+  FT dsx = cc(d.point().x()) - cc(e.point().x());
+  FT dsy = cc(d.point().y()) - cc(e.point().y());
+  FT dsz = cc(d.point().z()) - cc(e.point().z());
+  FT dst = cc(d.lifted()) - cc(e.lifted());
+
+  FT ret = CGAL::determinant(dpx, dpy, dpz, dpt,
+				   dqx, dqy, dqz, dqt,
+				   drx, dry, drz, drt,
+				   dsx, dsy, dsz, dst);
+  CGAL::Kinetic::log()->stream(CGAL::KDS::Log::MAPLE) << std::endl << std::endl;
+  CGAL::Kinetic::log()->stream(CGAL::KDS::Log::MAPLE) << "pt3 lifted\n";
+  CGAL::Kinetic::log()->stream(CGAL::KDS::Log::MAPLE) << "m:=matrix(5,5,[[";
+  CGAL::Kinetic::log()->stream(CGAL::KDS::Log::MAPLE)
+    << a.point().x() << ", " << a.point().y() << ", " << a.point().z() << ", " << a.lifted() << ", 1], ["
+    << b.point().x() << ", " << b.point().y() << ", " << b.point().z() << ", " << b.lifted() << ", 1], ["
+    << c.point().x() << ", " << c.point().y() << ", " << c.point().z() << ", " << c.lifted() << ", 1], ["
+    << d.point().x() << ", " << d.point().y() << ", " << d.point().z() << ", " << d.lifted() << ", 1], ["
+    << e.point().x() << ", " << e.point().y() << ", " << e.point().z() << ", " << e.lifted() << ", 1]]);\n";
+  CGAL::Kinetic::log()->stream(CGAL::KDS::Log::MAPLE) << "det(m)-( " << ret << ");\n";
+  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << "m2:= matrix(4,4,[[";
+  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << dpx << "," << dpy << "," << dpz << "," << dpt << "], [";
+  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << dqx << "," << dqy << "," << dqz << "," << dqt << "], [";
+  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << drx << "," << dry << "," << drz << "," << drt << "], [";
+  ::CGAL::Kinetic::log()->stream(::CGAL::KDS::Log::MAPLE) << dsx << "," << dsy << "," << dsz << "," << dst << "]]);\n";
+  return ret;
+}
+#endif
+
+} } } //namespace CGAL::Kinetic::internal
+#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/To_static.h b/3rdparty/CGAL/include/CGAL/Kinetic/internal/To_static.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/To_static.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/internal/To_static.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/Triangulation_helper_3.h b/3rdparty/CGAL/include/CGAL/Kinetic/internal/Triangulation_helper_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/Triangulation_helper_3.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/internal/Triangulation_helper_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/config.h b/3rdparty/CGAL/include/CGAL/Kinetic/internal/config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/config.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/internal/config.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/debug_counters.h b/3rdparty/CGAL/include/CGAL/Kinetic/internal/debug_counters.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/debug_counters.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/internal/debug_counters.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/debug_counters_impl.h b/3rdparty/CGAL/include/CGAL/Kinetic/internal/debug_counters_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/debug_counters_impl.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/internal/debug_counters_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/infinity_or_max.h b/3rdparty/CGAL/include/CGAL/Kinetic/internal/infinity_or_max.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/infinity_or_max.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/internal/infinity_or_max.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/tds_2_helpers.h b/3rdparty/CGAL/include/CGAL/Kinetic/internal/tds_2_helpers.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/tds_2_helpers.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/internal/tds_2_helpers.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/triangulation_helpers_3.h b/3rdparty/CGAL/include/CGAL/Kinetic/internal/triangulation_helpers_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/internal/triangulation_helpers_3.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/internal/triangulation_helpers_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Kinetic/listeners.h b/3rdparty/CGAL/include/CGAL/Kinetic/listeners.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Kinetic/listeners.h
rename to 3rdparty/CGAL/include/CGAL/Kinetic/listeners.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/LEDA_arithmetic_kernel.h b/3rdparty/CGAL/include/CGAL/LEDA_arithmetic_kernel.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/LEDA_arithmetic_kernel.h
rename to 3rdparty/CGAL/include/CGAL/LEDA_arithmetic_kernel.h
diff --git a/3rdparty/CGAL/include/CGAL/LEDA_basic.h b/3rdparty/CGAL/include/CGAL/LEDA_basic.h
new file mode 100644
index 0000000..df44b4d
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/LEDA_basic.h
@@ -0,0 +1,48 @@
+// Copyright (c) 1999  
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved. 
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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(s)     : Matthias Baesken
+
+
+
+#ifndef CGAL_LEDA_BASIC_H
+#define CGAL_LEDA_BASIC_H
+
+#include <CGAL/config.h>
+
+#ifdef CGAL_USE_LEDA
+// The following is needed for LEDA 4.4 due to min/max problems...
+#  define LEDA_NO_MIN_MAX_TEMPL
+
+#include <LEDA/system/basic.h>
+
+#ifdef LEDA_NAMESPACE
+#  define CGAL_LEDA_SCOPE  leda
+#else
+#  define CGAL_LEDA_SCOPE 
+#endif
+
+
+#endif
+
+
+#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/LSCM_parameterizer_3.h b/3rdparty/CGAL/include/CGAL/LSCM_parameterizer_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/LSCM_parameterizer_3.h
rename to 3rdparty/CGAL/include/CGAL/LSCM_parameterizer_3.h
diff --git a/3rdparty/CGAL/include/CGAL/Labeled_image_mesh_domain_3.h b/3rdparty/CGAL/include/CGAL/Labeled_image_mesh_domain_3.h
new file mode 100644
index 0000000..f7a62f5
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Labeled_image_mesh_domain_3.h
@@ -0,0 +1,157 @@
+// Copyright (c) 2009 INRIA Sophia-Antipolis (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
+// 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(s)     : Stephane Tayeb
+//
+//******************************************************************************
+// File Description :
+//
+//
+//******************************************************************************
+
+#ifndef CGAL_LABELED_IMAGE_MESH_DOMAIN_3_H
+#define CGAL_LABELED_IMAGE_MESH_DOMAIN_3_H
+
+
+#include <CGAL/Random.h>
+#include <CGAL/Labeled_mesh_domain_3.h>
+#include <CGAL/Mesh_3/Image_to_labeled_function_wrapper.h>
+#include <CGAL/Bbox_3.h>
+#include <CGAL/Default.h>
+
+namespace CGAL {
+
+/**
+ * @class Labeled_image_mesh_domain_3
+ *
+ *
+ */
+template<class Image,
+         class BGT,
+         typename Image_word_type_ = unsigned char,
+         typename Subdomain_index = int,
+         class Null_subdomain_index = Default,
+         class Wrapper_ = Default >
+class Labeled_image_mesh_domain_3
+: public Labeled_mesh_domain_3
+<typename Default::Get
+   <Wrapper_,
+    Mesh_3::Image_to_labeled_function_wrapper<Image, BGT,
+                                              Image_word_type_,
+                                              Subdomain_index>
+    >::type,
+ BGT,
+ Null_subdomain_index
+ >
+{
+public:
+  typedef Image_word_type_ Image_word_type;
+  typedef typename Default::Get
+    <Wrapper_,
+     Mesh_3::Image_to_labeled_function_wrapper<Image, BGT,
+                                               Image_word_type,
+                                               Subdomain_index>
+     >::type Wrapper;
+  typedef typename Default::Get<Null_subdomain_index,
+                                CGAL::Null_subdomain_index>::type Null;
+
+  typedef Labeled_mesh_domain_3<Wrapper, BGT, Null_subdomain_index> Base;
+
+  typedef typename Base::Sphere_3 Sphere_3;
+  typedef typename Base::FT FT;
+  typedef BGT Geom_traits;
+  typedef CGAL::Bbox_3 Bbox_3;
+  typedef CGAL::Identity<Subdomain_index> Identity;
+
+  /// Constructor
+  Labeled_image_mesh_domain_3(const Image& image,
+                              const FT& error_bound = FT(1e-3),
+                              Subdomain_index value_outside = 0,
+                              Null null = Null(),
+                              CGAL::Random* p_rng = NULL)
+    : Base(Wrapper(image, Identity(), value_outside),
+           compute_bounding_box(image),
+           error_bound,
+           null,
+           p_rng)
+  {}
+
+  Labeled_image_mesh_domain_3(const Image& image,
+                              const CGAL::Bbox_3& bbox,
+                              const FT& error_bound = FT(1e-3),
+                              Subdomain_index value_outside = 0,
+                              Null null = Null(),
+                              CGAL::Random* p_rng = NULL)
+    : Base(Wrapper(image, Identity(), value_outside),
+           bbox,
+           error_bound,
+           null,
+           p_rng)
+  {}
+
+  Labeled_image_mesh_domain_3(const Image& image,
+                              const FT error_bound,
+                              CGAL::Random* p_rng)
+    : Base(Wrapper(image),
+           compute_bounding_box(image),
+           error_bound,
+           Null(),
+           p_rng)
+  {}
+
+  Labeled_image_mesh_domain_3(const Image& image,
+                              const CGAL::Bbox_3& bbox,
+                              const FT error_bound,
+                              CGAL::Random* p_rng)
+    : Base(Wrapper(image),
+           bbox,
+           error_bound,
+           Null(),
+           p_rng)
+  {}
+
+  /// Destructor
+  virtual ~Labeled_image_mesh_domain_3() {}
+
+  using Base::bbox;
+
+private:
+  /// Returns a box enclosing image \c im
+  Bbox_3 compute_bounding_box(const Image& im) const
+  {
+    return Bbox_3(-1,-1,-1,
+                  double(im.xdim())*im.vx()+1,
+                  double(im.ydim())*im.vy()+1,
+                  double(im.zdim())*im.vz()+1);
+  }
+
+private:
+  // Disabled copy constructor & assignment operator
+  typedef Labeled_image_mesh_domain_3<Image, BGT> Self;
+  Labeled_image_mesh_domain_3(const Self& src);
+  Self& operator=(const Self& src);
+
+};  // end class Labeled_image_mesh_domain_3
+
+
+
+}  // end namespace CGAL
+
+
+
+#endif // CGAL_LABELED_IMAGE_MESH_DOMAIN_3_H
diff --git a/3rdparty/CGAL/include/CGAL/Labeled_mesh_domain_3.h b/3rdparty/CGAL/include/CGAL/Labeled_mesh_domain_3.h
new file mode 100644
index 0000000..f2fc440
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Labeled_mesh_domain_3.h
@@ -0,0 +1,721 @@
+// Copyright (c) 2009 INRIA Sophia-Antipolis (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
+// 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(s)     : Stéphane Tayeb, Aymeric PELLE
+//
+//******************************************************************************
+// File Description :
+// class Labeled_mesh_domain_3. See class description.
+//******************************************************************************
+
+#ifndef CGAL_LABELED_MESH_DOMAIN_3_H
+#define CGAL_LABELED_MESH_DOMAIN_3_H
+
+#include <CGAL/Mesh_3/config.h>
+
+#include <CGAL/Bbox_3.h>
+
+#include <CGAL/point_generators_3.h>
+#include <CGAL/Mesh_3/Creator_weighted_point_3.h>
+
+#include <boost/variant.hpp>
+#include <boost/format.hpp>
+#include <boost/optional.hpp>
+#include <CGAL/tuple.h>
+#include <CGAL/Origin.h>
+
+#include <CGAL/Default.h>
+
+#include <CGAL/internal/Mesh_3/Handle_IO_for_pair_of_int.h>
+
+namespace CGAL {
+
+struct Null_subdomain_index {
+  template <typename T>
+  bool operator()(const T& x) const { return 0 == x; }
+};
+
+/**
+ * \class Labeled_mesh_domain_3
+ *
+ * Function f must take his values into N.
+ * Let p be a Point.
+ *  - f(p)=0 means that p is outside domain.
+ *  - f(p)=a, a!=0 means that p is inside subdomain a.
+ *
+ *  Any boundary facet is labelled <a,b>, a<b, where a and b are the
+ *  tags of it's incident subdomain.
+ *  Thus, a boundary facet of the domain is labelled <0,b>, where b!=0.
+ */
+template<class Function, class BGT,
+         class Null_subdomain_index = Default >
+class Labeled_mesh_domain_3
+{
+  typedef typename Default::Get<Null_subdomain_index,
+                                CGAL::Null_subdomain_index>::type Null;
+public:
+  /// Geometric object types
+  typedef typename BGT::Point_3    Point_3;
+  typedef typename BGT::Segment_3  Segment_3;
+  typedef typename BGT::Ray_3      Ray_3;
+  typedef typename BGT::Line_3     Line_3;
+  typedef typename BGT::Vector_3   Vector_3;
+  typedef typename BGT::Sphere_3   Sphere_3;
+  typedef CGAL::Bbox_3             Bbox_3;
+
+protected:
+  typedef typename BGT::Iso_cuboid_3 Iso_cuboid_3;
+
+public:
+  // Kernel_traits compatibility
+  typedef BGT R;
+  // access Function type from inherited class
+  typedef Function Fct;
+
+  //-------------------------------------------------------
+  // Index Types
+  //-------------------------------------------------------
+  /// Type of indexes for cells of the input complex
+  typedef typename Function::return_type Subdomain_index;
+  typedef boost::optional<Subdomain_index> Subdomain;
+  /// Type of indexes for surface patch of the input complex
+  typedef std::pair<Subdomain_index, Subdomain_index> Surface_patch_index;
+  typedef boost::optional<Surface_patch_index> Surface_patch;
+  /// Type of indexes to characterize the lowest dimensional face of the input
+  /// complex on which a vertex lie
+  typedef boost::variant<Subdomain_index, Surface_patch_index> Index;
+  typedef CGAL::cpp11::tuple<Point_3,Index,int> Intersection;
+
+
+  typedef typename BGT::FT FT;
+  typedef BGT Geom_traits;
+
+  /**
+   * @brief Constructor
+   */
+  Labeled_mesh_domain_3(const Function& f,
+                        const Sphere_3& bounding_sphere,
+                        const FT& error_bound = FT(1e-3),
+                        Null null = Null(),
+                        CGAL::Random* p_rng = NULL);
+
+  Labeled_mesh_domain_3(const Function& f,
+                        const Bbox_3& bbox,
+                        const FT& error_bound = FT(1e-3),
+                        Null null = Null(),
+                        CGAL::Random* p_rng = NULL);
+
+  Labeled_mesh_domain_3(const Function& f,
+                        const Iso_cuboid_3& bbox,
+                        const FT& error_bound = FT(1e-3),
+                        Null null = Null(),
+                        CGAL::Random* p_rng = NULL);
+
+  Labeled_mesh_domain_3(const Function& f,
+                        const Sphere_3& bounding_sphere,
+                        const FT& error_bound,
+                        CGAL::Random* p_rng);
+
+  Labeled_mesh_domain_3(const Function& f,
+                        const Bbox_3& bbox,
+                        const FT& error_bound,
+                        CGAL::Random* p_rng);
+
+  Labeled_mesh_domain_3(const Function& f,
+                        const Iso_cuboid_3& bbox,
+                        const FT& error_bound,
+                        CGAL::Random* p_rng);
+  /// Destructor
+  virtual ~Labeled_mesh_domain_3()
+  {
+    if(delete_rng_)
+      delete p_rng_;
+  }
+
+
+  /**
+   * Constructs  a set of \ccc{n} points on the surface, and output them to
+   *  the output iterator \ccc{pts} whose value type is required to be
+   *  \ccc{std::pair<Points_3, Index>}.
+   */
+  struct Construct_initial_points
+  {
+    Construct_initial_points(const Labeled_mesh_domain_3& domain)
+      : r_domain_(domain) {}
+
+    template<class OutputIterator>
+    OutputIterator operator()(OutputIterator pts, const int n = 12) const;
+
+  private:
+    const Labeled_mesh_domain_3& r_domain_;
+  };
+
+  /// Returns Construct_initial_points object
+  Construct_initial_points construct_initial_points_object() const
+  {
+    return Construct_initial_points(*this);
+  }
+
+  /**
+   * Returns a bounding box of the domain
+   */
+  Bbox_3 bbox() const {
+    return bbox_.bbox();
+  }
+
+  /**
+   * Returns true if point~\ccc{p} is in the domain. If \ccc{p} is in the
+   *  domain, the parameter index is set to the index of the subdomain
+   *  including $p$. It is set to the default value otherwise.
+   */
+  struct Is_in_domain
+  {
+    Is_in_domain(const Labeled_mesh_domain_3& domain) : r_domain_(domain) {}
+
+    Subdomain operator()(const Point_3& p) const
+    {
+      // null(f(p)) means p is outside the domain
+      Subdomain_index index = (r_domain_.function_)(p);
+      if ( r_domain_.null(index) )
+        return Subdomain();
+      else
+        return Subdomain(index);
+    }
+  private:
+    const Labeled_mesh_domain_3& r_domain_;
+  };
+
+  /// Returns Is_in_domain object
+  Is_in_domain is_in_domain_object() const { return Is_in_domain(*this); }
+
+  /**
+   * Returns true is the element \ccc{type} intersect properly any of the
+   * surface patches describing the either the domain boundary or some
+   * subdomain boundary.
+   * \ccc{Type} is either \ccc{Segment_3}, \ccc{Ray_3} or \ccc{Line_3}.
+   * Parameter index is set to the index of the intersected surface patch
+   * if \ccc{true} is returned and to the default \ccc{Surface_patch_index}
+   * value otherwise.
+   */
+  struct Do_intersect_surface
+  {
+    Do_intersect_surface(const Labeled_mesh_domain_3& domain)
+      : r_domain_(domain) {}
+
+    Surface_patch operator()(const Segment_3& s) const
+    {
+      return this->operator()(s.source(), s.target());
+    }
+
+    Surface_patch operator()(const Ray_3& r) const
+    {
+      return clip_to_segment(r);
+    }
+
+    Surface_patch operator()(const Line_3& l) const
+    {
+      return clip_to_segment(l);
+    }
+
+  private:
+    /// Returns true if points \c a & \c b do not belong to the same subdomain
+    /// \c index is set to the surface index of subdomains f(a), f(b)
+    Surface_patch operator()(const Point_3& a, const Point_3& b) const
+    {
+      // If f(a) != f(b), then [a,b] intersects some surface. Here we consider
+      // [a,b] intersects surface_patch labelled <f(a),f(b)> (or <f(b),f(a)>).
+      // It may be false, further rafinement will improve precision
+      const Subdomain_index value_a = r_domain_.function_(a);
+      const Subdomain_index value_b = r_domain_.function_(b);
+
+      if ( value_a != value_b ) {
+        if( r_domain_.null(value_a) && r_domain_.null(value_b) )
+          return Surface_patch();
+        else
+          return Surface_patch(r_domain_.make_surface_index(value_a, value_b));
+      }
+      else
+        return Surface_patch();
+    }
+
+    /**
+     * Clips \c query to a segment \c s, and call operator()(s)
+     */
+    template<typename Query>
+    Surface_patch clip_to_segment(const Query& query) const
+    {
+      typename cpp11::result_of<typename BGT::Intersect_3(Query, Iso_cuboid_3)>::type
+        clipped = CGAL::intersection(query, r_domain_.bbox_);
+
+      if(clipped)
+#if CGAL_INTERSECTION_VERSION > 1
+        if(const Segment_3* s = boost::get<Segment_3>(&*clipped))
+          return this->operator()(*s);
+#else
+        if(const Segment_3* s = object_cast<Segment_3>(&clipped))
+          return this->operator()(*s);
+#endif
+        
+      return Surface_patch();
+    }
+
+  private:
+    const Labeled_mesh_domain_3& r_domain_;
+  };
+
+  /// Returns Do_intersect_surface object
+  Do_intersect_surface do_intersect_surface_object() const
+  {
+    return Do_intersect_surface(*this);
+  }
+
+  /**
+   * Returns a point in the intersection of the primitive \ccc{type}
+   * with some boundary surface.
+   * \ccc{Type1} is either \ccc{Segment_3}, \ccc{Ray_3} or \ccc{Line_3}.
+   * The integer \ccc{dimension} is set to the dimension of the lowest
+   * dimensional face in the input complex containing the returned point, and
+   * \ccc{index} is set to the index to be stored at a mesh vertex lying
+   * on this face.
+   */
+  struct Construct_intersection
+  {
+    Construct_intersection(const Labeled_mesh_domain_3& domain)
+      : r_domain_(domain) {}
+
+    Intersection operator()(const Segment_3& s) const
+    {
+#ifndef CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
+      CGAL_precondition(r_domain_.do_intersect_surface_object()(s));
+#endif // NOT CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
+      return this->operator()(s.source(),s.target());
+    }
+
+    Intersection operator()(const Ray_3& r) const
+    {
+      return clip_to_segment(r);
+    }
+
+    Intersection operator()(const Line_3& l) const
+    {
+      return clip_to_segment(l);
+    }
+
+  private:
+    /**
+     * Returns a point in the intersection of [a,b] with the surface
+     * \c a must be the source point, and \c b the out point. It's important
+     * because it drives bisection cuts.
+     * Indeed, the returned point is the first intersection from \c [a,b]
+     * with a subdomain surface.
+     */
+    Intersection operator()(const Point_3& a, const Point_3& b) const
+    {
+      // Functors
+      typename BGT::Compute_squared_distance_3 squared_distance =
+                                      BGT().compute_squared_distance_3_object();
+      typename BGT::Construct_midpoint_3 midpoint =
+                                      BGT().construct_midpoint_3_object();
+
+      // Non const points
+      Point_3 p1 = a;
+      Point_3 p2 = b;
+      Point_3 mid = midpoint(p1, p2);
+
+      // Cannot be const: those values are modified below.
+      Subdomain_index value_at_p1 = r_domain_.function_(p1);
+      Subdomain_index value_at_p2 = r_domain_.function_(p2);
+      Subdomain_index value_at_mid = r_domain_.function_(mid,true);
+
+      // If both extremities are in the same subdomain,
+      // there is no intersection.
+      // This should not happen...
+      if( value_at_p1 == value_at_p2 )
+      {
+        return Intersection();
+      }
+      if( r_domain_.null(value_at_p1) && r_domain_.null(value_at_p2) ) {
+        return Intersection();
+      }
+
+      // Else lets find a point (by bisection)
+      // Bisection ends when the point is near than error bound from surface
+      while(true)
+      {
+        // If the two points are enough close, then we return midpoint
+        if ( squared_distance(p1, p2) < r_domain_.squared_error_bound_ )
+        {
+          CGAL_assertion(value_at_p1 != value_at_p2 &&
+             ! ( r_domain_.null(value_at_p1) && r_domain_.null(value_at_p2) ) );
+          const Surface_patch_index sp_index =
+            r_domain_.make_surface_index(value_at_p1, value_at_p2);
+          const Index index = r_domain_.index_from_surface_patch_index(sp_index);
+          return Intersection(mid, index, 2);
+        }
+
+        // Else we must go on
+        // Here we consider that p1(a) is the source point. Thus, we keep p1 and
+        // change p2 if f(p1)!=f(p2).
+        // That allows us to find the first intersection from a of [a,b] with
+        // a surface.
+        if ( value_at_p1 != value_at_mid &&
+             ! ( r_domain_.null(value_at_p1) && r_domain_.null(value_at_mid) ) )
+        {
+          p2 = mid;
+          value_at_p2 = value_at_mid;
+        }
+        else
+        {
+          p1 = mid;
+          value_at_p1 = value_at_mid;
+        }
+
+        mid = midpoint(p1, p2);
+        value_at_mid = r_domain_.function_(mid,true);
+      }
+    }
+
+    /// Clips \c query to a segment \c s, and call operator()(s)
+    template<typename Query>
+    Intersection clip_to_segment(const Query& query) const
+    {
+      typename cpp11::result_of<typename BGT::Intersect_3(Query, Iso_cuboid_3)>::type
+        clipped = CGAL::intersection(query, r_domain_.bbox_);
+
+      if(clipped)
+#if CGAL_INTERSECTION_VERSION > 1
+        if(const Segment_3* s = boost::get<Segment_3>(&*clipped))
+          return this->operator()(*s);
+#else
+        if(const Segment_3* s = object_cast<Segment_3>(&clipped))
+          return this->operator()(*s);
+#endif
+      
+      return Intersection();
+    }
+
+  private:
+    const Labeled_mesh_domain_3& r_domain_;
+  };
+
+  /// Returns Construct_intersection object
+  Construct_intersection construct_intersection_object() const
+  {
+    return Construct_intersection(*this);
+  }
+
+  /**
+   * Returns the index to be stored in a vertex lying on the surface identified
+   * by \c index.
+   */
+  Index index_from_surface_patch_index(const Surface_patch_index& index) const
+  { return Index(index); }
+
+  /**
+   * Returns the index to be stored in a vertex lying in the subdomain
+   * identified by \c index.
+   */
+  Index index_from_subdomain_index(const Subdomain_index& index) const
+  { return Index(index); }
+
+  /**
+   * Returns the \c Surface_patch_index of the surface patch
+   * where lies a vertex with dimension 2 and index \c index.
+   */
+  Surface_patch_index surface_patch_index(const Index& index) const
+  { return boost::get<Surface_patch_index>(index); }
+
+  /**
+   * Returns the index of the subdomain containing a vertex
+   *  with dimension 3 and index \c index.
+   */
+  Subdomain_index subdomain_index(const Index& index) const
+  { return boost::get<Subdomain_index>(index); }
+  
+  // -----------------------------------
+  // Backward Compatibility
+  // -----------------------------------
+#ifndef CGAL_MESH_3_NO_DEPRECATED_SURFACE_INDEX
+  typedef Surface_patch_index   Surface_index;
+  
+  Index index_from_surface_index(const Surface_index& index) const
+  { return index_from_surface_patch_index(index); }
+  
+  Surface_index surface_index(const Index& index) const
+  { return surface_patch_index(index); }
+#endif // CGAL_MESH_3_NO_DEPRECATED_SURFACE_INDEX
+  // -----------------------------------
+  // End backward Compatibility
+  // -----------------------------------
+
+
+private:
+  /// Returns Surface_patch_index from \c i and \c j
+  Surface_patch_index make_surface_index(const Subdomain_index i,
+                                   const Subdomain_index j) const
+  {
+    if ( i < j ) return Surface_patch_index(i,j);
+    else return Surface_patch_index(j,i);
+  }
+
+  /// Returns squared error bound from \c bbox and \c error
+  FT squared_error_bound(const Iso_cuboid_3& bbox, const FT& error) const
+  {
+    typename BGT::Compute_squared_distance_3 squared_distance =
+                                    BGT().compute_squared_distance_3_object();
+    return squared_distance((bbox.min)(), (bbox.max)())*error*error/4;
+  }
+
+  /// Returns squared error bound from \c sphere and \c error
+  FT squared_error_bound(const Sphere_3& sphere, const FT& error) const
+  {
+    typename BGT::Compute_squared_radius_3 squared_radius =
+                                    BGT().compute_squared_radius_3_object();
+    return squared_radius(sphere)*error*error;
+  }
+
+  /// Returns the bounding sphere of an Iso_cuboid_3
+  Sphere_3 bounding_sphere(const Iso_cuboid_3& bbox) const
+  {
+    typename BGT::Construct_sphere_3 sphere = BGT().construct_sphere_3_object();
+    return sphere((bbox.min)(), (bbox.max)());
+  }
+
+  /// Returns and Iso_cuboid_3 from a Bbox_3
+  Iso_cuboid_3 iso_cuboid(const Bbox_3& bbox)
+  {
+    const Point_3 p_min(bbox.xmin(), bbox.ymin(), bbox.zmin());
+    const Point_3 p_max(bbox.xmax(), bbox.ymax(), bbox.zmax());
+
+    return Iso_cuboid_3(p_min,p_max);
+  }
+
+protected:
+  /// Returns bounding box
+  const Iso_cuboid_3& bounding_box() const { return bbox_; }
+
+private:
+  /// The function which answers subdomain queries
+  const Function function_;
+  /// The bounding box
+  const Iso_cuboid_3 bbox_;
+  /// The functor that decides which sub-domain indices correspond to the
+  /// outside of the domain.
+  Null null;
+  /// The random number generator used by Construct_initial_points
+  CGAL::Random* p_rng_;
+  bool delete_rng_;
+  /// Error bound relative to sphere radius
+  FT squared_error_bound_;
+
+
+private:
+  // Disabled copy constructor & assignment operator
+  typedef Labeled_mesh_domain_3<Function,BGT> Self;
+  Labeled_mesh_domain_3(const Self& src);
+  Self& operator=(const Self& src);
+
+};  // end class Labeled_mesh_domain_3
+
+
+
+
+//-------------------------------------------------------
+// Method implementation
+//-------------------------------------------------------
+template<class F, class BGT, class Null>
+Labeled_mesh_domain_3<F,BGT,Null>::Labeled_mesh_domain_3(
+                       const F& f,
+                       const Sphere_3& bounding_sphere,
+                       const FT& error_bound,
+                       Null null /* = Null() */,
+                       CGAL::Random* p_rng)
+: function_(f)
+, bbox_(iso_cuboid(bounding_sphere.bbox()))
+, null(null)
+, p_rng_(p_rng == 0 ? new CGAL::Random(0) : p_rng)
+, delete_rng_(p_rng == 0)
+, squared_error_bound_(squared_error_bound(bounding_sphere,error_bound))
+{
+}
+
+template<class F, class BGT, class Null>
+Labeled_mesh_domain_3<F,BGT,Null>::Labeled_mesh_domain_3(
+                       const F& f,
+                       const Bbox_3& bbox,
+                       const FT& error_bound,
+                       Null null /* = Null() */,
+                       CGAL::Random* p_rng)
+: function_(f)
+, bbox_(iso_cuboid(bbox))
+, null(null)
+, p_rng_(p_rng == 0 ? new CGAL::Random(0) : p_rng)
+, delete_rng_(p_rng == 0)
+, squared_error_bound_(squared_error_bound(bbox_,error_bound))
+{
+}
+
+template<class F, class BGT, class Null>
+Labeled_mesh_domain_3<F,BGT,Null>::Labeled_mesh_domain_3(
+                       const F& f,
+                       const Iso_cuboid_3& bbox,
+                       const FT& error_bound,
+                       Null null /* = Null() */,
+                       CGAL::Random* p_rng)
+: function_(f)
+, bbox_(bbox)
+, null(null)
+, p_rng_(p_rng == 0 ? new CGAL::Random(0) : p_rng)
+, delete_rng_(p_rng == 0)
+, squared_error_bound_(squared_error_bound(bbox_,error_bound))
+{
+}
+
+
+
+
+template<class F, class BGT, class Null>
+Labeled_mesh_domain_3<F,BGT,Null>::Labeled_mesh_domain_3(
+                       const F& f,
+                       const Sphere_3& bounding_sphere,
+                       const FT& error_bound,
+                       CGAL::Random* p_rng)
+: function_(f)
+, bbox_(iso_cuboid(bounding_sphere.bbox()))
+, null(Null())
+, p_rng_(p_rng == 0 ? new CGAL::Random(0) : p_rng)
+, delete_rng_(p_rng == 0)
+, squared_error_bound_(squared_error_bound(bounding_sphere,error_bound))
+{
+}
+
+template<class F, class BGT, class Null>
+Labeled_mesh_domain_3<F,BGT,Null>::Labeled_mesh_domain_3(
+                       const F& f,
+                       const Bbox_3& bbox,
+                       const FT& error_bound,
+                       CGAL::Random* p_rng)
+: function_(f)
+, bbox_(iso_cuboid(bbox))
+, null(Null())
+, p_rng_(p_rng == 0 ? new CGAL::Random(0) : p_rng)
+, delete_rng_(p_rng == 0)
+, squared_error_bound_(squared_error_bound(bbox_,error_bound))
+{
+}
+
+template<class F, class BGT, class Null>
+Labeled_mesh_domain_3<F,BGT,Null>::Labeled_mesh_domain_3(
+                       const F& f,
+                       const Iso_cuboid_3& bbox,
+                       const FT& error_bound,
+                       CGAL::Random* p_rng)
+: function_(f)
+, bbox_(bbox)
+, null(Null())
+, p_rng_(p_rng == 0 ? new CGAL::Random(0) : p_rng)
+, delete_rng_(p_rng == 0)
+, squared_error_bound_(squared_error_bound(bbox_,error_bound))
+{
+}
+
+
+template<class F, class BGT, class Null>
+template<class OutputIterator>
+OutputIterator
+Labeled_mesh_domain_3<F,BGT,Null>::Construct_initial_points::operator()(
+                                                    OutputIterator pts,
+                                                    const int nb_points) const
+{
+  // Create point_iterator on and in bounding_sphere
+  typedef Random_points_on_sphere_3<Point_3> Random_points_on_sphere_3;
+  typedef Random_points_in_sphere_3<Point_3> Random_points_in_sphere_3;
+
+
+  const FT squared_radius = BGT().compute_squared_radius_3_object()(
+      r_domain_.bounding_sphere(r_domain_.bbox_));
+
+  const double radius = std::sqrt(CGAL::to_double(squared_radius));
+
+  CGAL::Random& rng = *(r_domain_.p_rng_);
+  Random_points_on_sphere_3 random_point_on_sphere(radius, rng);
+  Random_points_in_sphere_3 random_point_in_sphere(radius, rng);
+
+  // Get some functors
+  typename BGT::Construct_segment_3 segment_3 =
+                              BGT().construct_segment_3_object();
+  typename BGT::Construct_vector_3 vector_3 =
+                              BGT().construct_vector_3_object();
+  typename BGT::Construct_translated_point_3 translate =
+                              BGT().construct_translated_point_3_object();
+  typename BGT::Construct_center_3 center = BGT().construct_center_3_object();
+
+  // Get translation from origin to sphere center
+  Point_3 center_pt = center(r_domain_.bounding_sphere(r_domain_.bbox_));
+  const Vector_3 sphere_translation = vector_3(CGAL::ORIGIN, center_pt);
+
+  // Create nb_point points
+  int n = nb_points;
+#ifdef CGAL_MESH_3_VERBOSE
+  std::cerr << "construct initial points:\n";
+#endif
+  while ( 0 != n )
+  {
+    // Get a random segment
+    const Point_3 random_point = translate(*random_point_on_sphere,
+                                           sphere_translation);
+    const Segment_3 random_seg = segment_3(center_pt, random_point);
+
+    // Add the intersection to the output if it exists
+    Surface_patch surface = r_domain_.do_intersect_surface_object()(random_seg);
+    if ( surface )
+    {
+      const Point_3 intersect_pt = CGAL::cpp11::get<0>(
+          r_domain_.construct_intersection_object()(random_seg));
+      *pts++ = std::make_pair(intersect_pt,
+                              r_domain_.index_from_surface_patch_index(*surface));
+      --n;
+
+#ifdef CGAL_MESH_3_VERBOSE
+      std::cerr << boost::format("\r             \r"
+                                 "%1%/%2% initial point(s) found...")
+                   % (nb_points - n)
+                   % nb_points;
+#endif
+    }
+    else
+    {
+      // Get a new random point into sphere as center of object
+      // It may be necessary if the center of the domain is empty, e.g. torus
+      // In general case, it is good for input point dispersion
+      ++random_point_in_sphere;
+      center_pt = translate(*random_point_in_sphere, sphere_translation);
+    }
+    ++random_point_on_sphere;
+  }
+
+#ifdef CGAL_MESH_3_VERBOSE
+  std::cerr << "\n";
+#endif
+  return pts;
+}
+
+
+}  // end namespace CGAL
+
+#endif // LABELLED_MESH_TRAITS_3_H_
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Lapack_svd.h b/3rdparty/CGAL/include/CGAL/Lapack_svd.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Lapack_svd.h
rename to 3rdparty/CGAL/include/CGAL/Lapack_svd.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Largest_empty_iso_rectangle_2.h b/3rdparty/CGAL/include/CGAL/Largest_empty_iso_rectangle_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Largest_empty_iso_rectangle_2.h
rename to 3rdparty/CGAL/include/CGAL/Largest_empty_iso_rectangle_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Lazy.h b/3rdparty/CGAL/include/CGAL/Lazy.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Lazy.h
rename to 3rdparty/CGAL/include/CGAL/Lazy.h
diff --git a/3rdparty/CGAL/include/CGAL/Lazy_exact_nt.h b/3rdparty/CGAL/include/CGAL/Lazy_exact_nt.h
new file mode 100644
index 0000000..7735084
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Lazy_exact_nt.h
@@ -0,0 +1,1448 @@
+// Copyright (c) 1999-2007  INRIA Sophia-Antipolis (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(s)     : Sylvain Pion
+
+#ifndef CGAL_LAZY_EXACT_NT_H
+#define CGAL_LAZY_EXACT_NT_H
+
+#define CGAL_int(T)    typename First_if_different<int,    T>::Type
+#define CGAL_double(T) typename First_if_different<double, T>::Type
+#define CGAL_To_interval(T) To_interval<T>
+
+
+#include <CGAL/number_type_basic.h>
+#include <CGAL/assertions.h>
+
+#include <boost/iterator/transform_iterator.hpp> // for Root_of functor
+#include <boost/operators.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/type_traits/is_arithmetic.hpp>
+#include <boost/utility/enable_if.hpp>
+
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/logical.hpp>
+
+#include <CGAL/Interval_nt.h>
+#include <CGAL/Handle.h>
+#include <CGAL/NT_converter.h>
+
+#include <CGAL/Profile_counter.h>
+#include <CGAL/Lazy.h>
+
+#include <CGAL/Sqrt_extension_fwd.h>
+#include <CGAL/Kernel/mpl.h>
+
+#include <CGAL/IO/io.h>
+
+
+/*
+ * This file contains the definition of the number type Lazy_exact_nt<ET>,
+ * where ET is an exact number type (must provide the exact operations needed).
+ *
+ * Lazy_exact_nt<ET> provides a DAG-based lazy evaluation, like LEDA's real,
+ * Core's Expr, LEA's lazy rationals...
+ *
+ * The values are first approximated using Interval_base.
+ * The exactness is provided when needed by ET.
+ *
+ * Lazy_exact_nt<ET> is just a handle to the abstract base class
+ * Lazy_exact_nt_rep which has pure virtual methods .approx() and .exact().
+ * From this class derives one class per operation, with one constructor.
+ *
+ * The DAG is managed by :
+ * - Handle and Rep.
+ * - virtual functions to denote the various operators (instead of an enum).
+ *
+ * Other packages with vaguely similar design : APU, MetaCGAL, LOOK.
+ */
+
+/*
+ * TODO :
+ * - Generalize it for constructions at the kernel level.
+ * - Add mixed operations with ET too ?
+ * - Interval refinement functionnality ?
+ * - Separate the handle and the representation(s) in 2 files (?)
+ *   maybe not a good idea, better if everything related to one operation is
+ *   close together.
+ * - Add a CT template parameter ?
+ * - Add a string constant to provide an expression string (a la MetaCGAL) ?
+ *   // virtual ostream operator<<() const = 0; // or string, like Core ?
+ * - Have a template-expression (?) thing that evaluates a temporary element,
+ *   and allocates stuff in memory only when really needs to convert to the
+ *   NT.  (cf gmp++, and maybe other things, Blitz++, Synaps...)
+ */
+
+/*
+ * Interface of the rep classes:
+ * - .approx()      returns Interval_nt<> (assumes rounding=nearest).
+ *                  [ only called from the handle, and declared in the base ]
+ * - .exact()       returns ET, if not already done, computes recursively
+ *
+ * - .rafine_approx()   ??
+ */
+
+namespace CGAL {
+
+template <class NT> class Lazy_exact_nt;
+
+
+#ifdef CGAL_LAZY_KERNEL_DEBUG
+template <typename ET>
+inline
+void
+print_dag(const Lazy_exact_nt<ET>& l, std::ostream& os, int level=0)
+{
+  l.print_dag(os, level);
+}
+#endif
+
+// Abstract base representation class for lazy numbers
+template <typename ET>
+struct Lazy_exact_nt_rep : public Lazy_exact_nt<ET>::Self_rep
+{
+  typedef typename Lazy_exact_nt<ET>::Self_rep  Base;
+
+  Lazy_exact_nt_rep (const Interval_nt<false> & i)
+      : Base(i) {}
+
+#ifdef CGAL_LAZY_KERNEL_DEBUG
+  void
+  print_dag(std::ostream& os, int level) const
+  {
+    this->print_at_et(os, level);
+  }
+#endif
+};
+
+// int constant
+template <typename ET>
+struct Lazy_exact_Int_Cst : public Lazy_exact_nt_rep<ET>
+{
+  Lazy_exact_Int_Cst (int i)
+      : Lazy_exact_nt_rep<ET>(double(i)) {}
+
+  void update_exact() const { this->et = new ET((int)this->approx().inf()); }
+};
+
+// double constant
+template <typename ET, typename X>
+struct Lazy_exact_Cst : public Lazy_exact_nt_rep<ET>
+{
+  Lazy_exact_Cst (X x)
+      : Lazy_exact_nt_rep<ET>(x), cste(x) {}
+
+  void update_exact() const { this->et = new ET(cste); }
+
+  private:
+  X cste;
+};
+
+// Exact constant
+template <typename ET>
+struct Lazy_exact_Ex_Cst : public Lazy_exact_nt_rep<ET>
+{
+  Lazy_exact_Ex_Cst (const ET & e)
+      : Lazy_exact_nt_rep<ET>(CGAL_NTS to_interval(e))
+  {
+    this->et = new ET(e);
+  }
+
+  void update_exact() const { CGAL_error(); }
+};
+
+// Construction from a Lazy_exact_nt<ET1> (which keeps the lazyness).
+template <typename ET, typename ET1>
+class Lazy_lazy_exact_Cst : public Lazy_exact_nt_rep<ET>
+{
+  mutable Lazy_exact_nt<ET1> l;
+
+public:
+
+  Lazy_lazy_exact_Cst (const Lazy_exact_nt<ET1> &x)
+      : Lazy_exact_nt_rep<ET>(x.approx()), l(x)
+  {
+    this->set_depth(l.depth() + 1);
+  }
+
+  void update_exact() const
+  {
+    this->et = new ET(l.exact());
+    this->at = l.approx();
+    prune_dag();
+  }
+
+  void prune_dag() const { l = Lazy_exact_nt<ET1>(); }
+};
+
+
+// Unary  operations: abs, sqrt, square.
+// Binary operations: +, -, *, /, min, max.
+
+// Base unary operation
+template <typename ET>
+struct Lazy_exact_unary : public Lazy_exact_nt_rep<ET>
+{
+  mutable Lazy_exact_nt<ET> op1;
+
+  Lazy_exact_unary (const Interval_nt<false> &i, const Lazy_exact_nt<ET> &a)
+      : Lazy_exact_nt_rep<ET>(i), op1(a)
+  {
+    this->set_depth(op1.depth() + 1);
+  }
+
+  void prune_dag() const { op1 = Lazy_exact_nt<ET>(); }
+
+#ifdef CGAL_LAZY_KERNEL_DEBUG
+  void
+  print_dag(std::ostream& os, int level) const
+  {
+    this->print_at_et(os, level);
+    if(this->is_lazy()){
+      msg(os, level, "Unary number operator:");
+      CGAL::print_dag(op1, os, level+1);
+    }
+  }
+#endif
+};
+
+// Base binary operation
+template <typename ET, typename ET1 = ET, typename ET2 = ET>
+struct Lazy_exact_binary : public Lazy_exact_nt_rep<ET>
+{
+  mutable Lazy_exact_nt<ET1> op1;
+  mutable Lazy_exact_nt<ET2> op2;
+
+  Lazy_exact_binary (const Interval_nt<false> &i,
+		     const Lazy_exact_nt<ET1> &a, const Lazy_exact_nt<ET2> &b)
+      : Lazy_exact_nt_rep<ET>(i), op1(a), op2(b)
+  {
+    this->set_depth((std::max)(op1.depth(), op2.depth()) + 1);
+  }
+
+  void prune_dag() const
+  {
+    op1 = Lazy_exact_nt<ET1>();
+    op2 = Lazy_exact_nt<ET2>();
+  }
+
+#ifdef CGAL_LAZY_KERNEL_DEBUG
+  void
+  print_dag(std::ostream& os, int level) const
+  {
+    this->print_at_et(os, level);
+    if(this->is_lazy()){
+      msg(os, level, "Binary number operator:");
+      CGAL::print_dag(op1, os, level+1);
+      CGAL::print_dag(op2, os, level+1);
+    }
+  }
+#endif
+};
+
+// Here we could use a template class for all operations (STL provides
+// function objects plus, minus, multiplies, divides...).  But it would require
+// a template template parameter, and GCC 2.95 seems to crash easily with them.
+
+// Macro for unary operations
+#define CGAL_LAZY_UNARY_OP(OP, NAME)                                     \
+template <typename ET>                                                   \
+struct NAME : public Lazy_exact_unary<ET>                                \
+{                                                                        \
+  typedef typename Lazy_exact_unary<ET>::AT::Protector P;                \
+  NAME (const Lazy_exact_nt<ET> &a)                                      \
+      : Lazy_exact_unary<ET>((P(), OP(a.approx())), a) {}                \
+                                                                         \
+  void update_exact() const                                              \
+  {                                                                      \
+    this->et = new ET(OP(this->op1.exact()));                            \
+    if (!this->approx().is_point())                                      \
+      this->at = CGAL_NTS to_interval(*(this->et));                      \
+    this->prune_dag();                                                   \
+   }                                                                     \
+};
+
+CGAL_LAZY_UNARY_OP(opposite,  Lazy_exact_Opp)
+CGAL_LAZY_UNARY_OP(CGAL_NTS abs,    Lazy_exact_Abs)
+CGAL_LAZY_UNARY_OP(CGAL_NTS square, Lazy_exact_Square)
+CGAL_LAZY_UNARY_OP(CGAL_NTS sqrt,   Lazy_exact_Sqrt)
+
+// A macro for +, -, * and /
+#define CGAL_LAZY_BINARY_OP(OP, NAME)                                    \
+template <typename ET, typename ET1 = ET, typename ET2 = ET>             \
+struct NAME : public Lazy_exact_binary<ET, ET1, ET2>                     \
+{                                                                        \
+  typedef typename Lazy_exact_binary<ET,ET1,ET2>::AT::Protector P;	 \
+  NAME (const Lazy_exact_nt<ET1> &a, const Lazy_exact_nt<ET2> &b)        \
+    : Lazy_exact_binary<ET, ET1, ET2>((P(), a.approx() OP b.approx()), a, b) {} \
+                                                                         \
+  void update_exact() const                                              \
+  {                                                                      \
+    this->et = new ET(this->op1.exact() OP this->op2.exact());           \
+    if (!this->approx().is_point())                                      \
+      this->at = CGAL_NTS to_interval(*(this->et));                      \
+    this->prune_dag();                                                   \
+   }                                                                     \
+};
+
+CGAL_LAZY_BINARY_OP(+, Lazy_exact_Add)
+CGAL_LAZY_BINARY_OP(-, Lazy_exact_Sub)
+CGAL_LAZY_BINARY_OP(*, Lazy_exact_Mul)
+CGAL_LAZY_BINARY_OP(/, Lazy_exact_Div)
+
+// Minimum
+template <typename ET>
+struct Lazy_exact_Min : public Lazy_exact_binary<ET>
+{
+  Lazy_exact_Min (const Lazy_exact_nt<ET> &a, const Lazy_exact_nt<ET> &b)
+    : Lazy_exact_binary<ET>((CGAL::min)(a.approx(), b.approx()), a, b) {}
+
+  void update_exact() const
+  {
+    this->et = new ET((CGAL::min)(this->op1.exact(), this->op2.exact()));
+    if (!this->approx().is_point()) 
+      this->at = CGAL_NTS to_interval(*(this->et));
+    this->prune_dag();
+  }
+};
+
+// Maximum
+template <typename ET>
+struct Lazy_exact_Max : public Lazy_exact_binary<ET>
+{
+  Lazy_exact_Max (const Lazy_exact_nt<ET> &a, const Lazy_exact_nt<ET> &b)
+    : Lazy_exact_binary<ET>((CGAL::max)(a.approx(), b.approx()), a, b) {}
+
+  void update_exact() const
+  {
+    this->et = new ET((CGAL::max)(this->op1.exact(), this->op2.exact()));
+    if (!this->approx().is_point()) 
+      this->at = CGAL_NTS to_interval(*(this->et));
+    this->prune_dag();
+  }
+};
+
+
+// The real number type, handle class
+template <typename ET_>
+class Lazy_exact_nt
+  : public Lazy<Interval_nt<false>, ET_, Lazy_exact_nt<ET_>, To_interval<ET_> >
+  , boost::ordered_euclidian_ring_operators2< Lazy_exact_nt<ET_>, int >
+  , boost::ordered_euclidian_ring_operators2< Lazy_exact_nt<ET_>, double >
+{
+public:
+
+  typedef Lazy_exact_nt<ET_> Self;
+  typedef Lazy<Interval_nt<false>, ET_, Self, To_interval<ET_> > Base;
+  typedef typename Base::Self_rep  Self_rep;
+
+  typedef typename Base::ET ET; // undocumented
+  typedef typename Base::AT AT; // undocumented
+
+  typedef typename Base::Exact_type        Exact_type;
+  typedef typename Base::Approximate_type  Approximate_type;
+
+public :
+
+  Lazy_exact_nt () {}
+
+  Lazy_exact_nt (Self_rep *r)
+    : Base(r) {}
+
+  // Also check that ET and AT are constructible from T?
+  template<class T>
+  Lazy_exact_nt (T i, typename boost::enable_if<boost::mpl::and_<
+      boost::mpl::or_<boost::is_arithmetic<T>, boost::is_enum<T> >,
+      boost::mpl::not_<boost::is_same<T,ET> > >,void*>::type=0)
+    : Base(new Lazy_exact_Cst<ET,T>(i)) {}
+
+  Lazy_exact_nt (const ET & e)
+    : Base(new Lazy_exact_Ex_Cst<ET>(e)){}
+
+  template <class ET1>
+  Lazy_exact_nt (const Lazy_exact_nt<ET1> &x,
+      typename boost::enable_if<is_implicit_convertible<ET1,ET>,int>::type=0)
+    : Base(new Lazy_lazy_exact_Cst<ET, ET1>(x)){}
+
+  template <class ET1>
+  explicit Lazy_exact_nt (const Lazy_exact_nt<ET1> &x,
+  typename boost::disable_if<is_implicit_convertible<ET1,ET>,int>::type=0)
+    : Base(new Lazy_lazy_exact_Cst<ET, ET1>(x)){}
+
+  Self operator+ () const
+  { return *this; }
+
+  Self operator- () const
+  { return new Lazy_exact_Opp<ET>(*this); }
+
+  Self & operator+=(const Self& b)
+  { return *this = new Lazy_exact_Add<ET>(*this, b); }
+
+  Self & operator-=(const Self& b)
+  { return *this = new Lazy_exact_Sub<ET>(*this, b); }
+
+  Self & operator*=(const Self& b)
+  { return *this = new Lazy_exact_Mul<ET>(*this, b); }
+
+  Self & operator/=(const Self& b)
+  {
+    CGAL_precondition(b != 0);
+    return *this = new Lazy_exact_Div<ET>(*this, b);
+  }
+
+  // Mixed operators. (could be optimized ?)
+  Self & operator+=(CGAL_int(ET) b)
+  { return *this = new Lazy_exact_Add<ET>(*this, b); }
+
+  Self & operator-=(CGAL_int(ET) b)
+  { return *this = new Lazy_exact_Sub<ET>(*this, b); }
+
+  Self & operator*=(CGAL_int(ET) b)
+  { return *this = new Lazy_exact_Mul<ET>(*this, b); }
+
+  Self & operator/=(CGAL_int(ET) b)
+  {
+    CGAL_precondition(b != 0);
+    return *this = new Lazy_exact_Div<ET>(*this, b);
+  }
+
+  Self & operator+=(CGAL_double(ET) b)
+  { return *this = new Lazy_exact_Add<ET>(*this, b); }
+
+  Self & operator-=(CGAL_double(ET) b)
+  { return *this = new Lazy_exact_Sub<ET>(*this, b); }
+
+  Self & operator*=(CGAL_double(ET) b)
+  { return *this = new Lazy_exact_Mul<ET>(*this, b); }
+
+  Self & operator/=(CGAL_double(ET) b)
+  {
+    CGAL_precondition(b != 0);
+    return *this = new Lazy_exact_Div<ET>(*this, b);
+  }
+
+  // % kills filtering
+  Self & operator%=(const Self& b)
+  {
+    CGAL_precondition(b != 0);
+    ET res = this->exact();
+    res %= b.exact();
+    return *this = Lazy_exact_nt<ET>(res);
+  }
+
+  Self & operator%=(int b)
+  {
+    CGAL_precondition(b != 0);
+    ET res = this->exact();
+    res %= b;
+    return *this = Lazy_exact_nt<ET>(res);
+  }
+
+  Interval_nt<true> interval() const
+  {
+    const Interval_nt<false>& i = this->approx();
+    return Interval_nt<true>(i.inf(), i.sup());
+  }
+
+  Interval_nt_advanced approx_adv() const
+  { return this->ptr()->approx(); }
+
+  static const double & get_relative_precision_of_to_double()
+  {
+      return relative_precision_of_to_double;
+  }
+
+  static void set_relative_precision_of_to_double(const double & d)
+  {
+      CGAL_assertion((0 < d) & (d < 1));
+      relative_precision_of_to_double = d;
+  }
+
+  bool identical(const Self& b) const
+  {
+      return ::CGAL::identical(
+              static_cast<const Handle &>(*this),
+              static_cast<const Handle &>(b));
+  }
+
+  template < typename T >
+  bool identical(const T&) const
+  { return false; }
+
+private:
+  static double relative_precision_of_to_double;
+};
+
+
+template <typename ET>
+double Lazy_exact_nt<ET>::relative_precision_of_to_double = 0.00001;
+
+
+template <typename ET1, typename ET2>
+bool
+operator<(const Lazy_exact_nt<ET1>& a, const Lazy_exact_nt<ET2>& b)
+{
+  CGAL_BRANCH_PROFILER(std::string(" failures/calls to   : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
+  if (a.identical(b))
+    return false;
+  Uncertain<bool> res = a.approx() < b.approx();
+  if (is_certain(res))
+    return get_certain(res);
+  CGAL_BRANCH_PROFILER_BRANCH(tmp);
+  return a.exact() < b.exact();
+}
+
+template <typename ET1, typename ET2>
+bool
+operator==(const Lazy_exact_nt<ET1>& a, const Lazy_exact_nt<ET2>& b)
+{
+  CGAL_BRANCH_PROFILER(std::string(" failures/calls to   : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
+  if (a.identical(b))
+    return true;
+  Uncertain<bool> res = a.approx() == b.approx();
+  if (is_certain(res))
+    return get_certain(res);
+  CGAL_BRANCH_PROFILER_BRANCH(tmp);
+  return a.exact() == b.exact();
+}
+
+template <typename ET1, typename ET2>
+inline
+bool
+operator>(const Lazy_exact_nt<ET1>& a, const Lazy_exact_nt<ET2>& b)
+{ return b < a; }
+
+template <typename ET1, typename ET2>
+inline
+bool
+operator>=(const Lazy_exact_nt<ET1>& a, const Lazy_exact_nt<ET2>& b)
+{ return ! (a < b); }
+
+template <typename ET1, typename ET2>
+inline
+bool
+operator<=(const Lazy_exact_nt<ET1>& a, const Lazy_exact_nt<ET2>& b)
+{ return b >= a; }
+
+template <typename ET1, typename ET2>
+inline
+bool
+operator!=(const Lazy_exact_nt<ET1>& a, const Lazy_exact_nt<ET2>& b)
+{ return ! (a == b); }
+
+
+template <typename ET>
+inline
+Lazy_exact_nt<ET>
+operator%(const Lazy_exact_nt<ET>& a, const Lazy_exact_nt<ET>& b)
+{
+  CGAL_PROFILER(std::string("calls to    : ") + std::string(CGAL_PRETTY_FUNCTION));
+  CGAL_precondition(b != 0);
+  return Lazy_exact_nt<ET>(a) %= b;
+}
+
+
+
+// Mixed operators with int.
+template <typename ET>
+bool
+operator<(const Lazy_exact_nt<ET>& a, int b)
+{
+  CGAL_BRANCH_PROFILER(std::string(" failures/calls to   : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
+  Uncertain<bool> res = a.approx() < b;
+  if (is_certain(res))
+    return res;
+  CGAL_BRANCH_PROFILER_BRANCH(tmp);
+  return a.exact() < b;
+}
+
+template <typename ET>
+bool
+operator>(const Lazy_exact_nt<ET>& a, int b)
+{
+  CGAL_BRANCH_PROFILER(std::string(" failures/calls to   : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
+  Uncertain<bool> res = b < a.approx();
+  if (is_certain(res))
+    return get_certain(res);
+  CGAL_BRANCH_PROFILER_BRANCH(tmp);
+  return b < a.exact();
+}
+
+template <typename ET>
+bool
+operator==(const Lazy_exact_nt<ET>& a, int b)
+{
+  CGAL_BRANCH_PROFILER(std::string(" failures/calls to   : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
+  Uncertain<bool> res = b == a.approx();
+  if (is_certain(res))
+    return get_certain(res);
+  CGAL_BRANCH_PROFILER_BRANCH(tmp);
+  return b == a.exact();
+}
+
+
+// Mixed operators with double.
+template <typename ET>
+bool
+operator<(const Lazy_exact_nt<ET>& a, double b)
+{
+  CGAL_BRANCH_PROFILER(std::string(" failures/calls to   : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
+  Uncertain<bool> res = a.approx() < b;
+  if (is_certain(res))
+    return res;
+  CGAL_BRANCH_PROFILER_BRANCH(tmp);
+  return a.exact() < b;
+}
+
+template <typename ET>
+bool
+operator>(const Lazy_exact_nt<ET>& a, double b)
+{
+  CGAL_BRANCH_PROFILER(std::string(" failures/calls to   : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
+  Uncertain<bool> res = b < a.approx();
+  if (is_certain(res))
+    return res;
+  CGAL_BRANCH_PROFILER_BRANCH(tmp);
+  return b < a.exact();
+}
+
+template <typename ET>
+bool
+operator==(const Lazy_exact_nt<ET>& a, double b)
+{
+  CGAL_BRANCH_PROFILER(std::string(" failures/calls to   : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
+  Uncertain<bool> res = b == a.approx();
+  if (is_certain(res))
+    return res;
+  CGAL_BRANCH_PROFILER_BRANCH(tmp);
+  return b == a.exact();
+}
+
+
+
+template <typename ET1, typename ET2>
+Lazy_exact_nt< typename Coercion_traits<ET1, ET2>::Type >
+operator+(const Lazy_exact_nt<ET1>& a, const Lazy_exact_nt<ET2>& b)
+{
+  CGAL_PROFILER(std::string("calls to    : ") + std::string(CGAL_PRETTY_FUNCTION));
+  return new Lazy_exact_Add<typename Coercion_traits<ET1, ET2>::Type,
+                            ET1, ET2>(a, b);
+}
+
+template <typename ET1, typename ET2>
+Lazy_exact_nt< typename Coercion_traits<ET1, ET2>::Type >
+operator-(const Lazy_exact_nt<ET1>& a, const Lazy_exact_nt<ET2>& b)
+{
+  CGAL_PROFILER(std::string("calls to    : ") + std::string(CGAL_PRETTY_FUNCTION));
+  return new Lazy_exact_Sub<typename Coercion_traits<ET1, ET2>::Type,
+                            ET1, ET2>(a, b);
+}
+
+template <typename ET1, typename ET2>
+Lazy_exact_nt< typename Coercion_traits<ET1, ET2>::Type >
+operator*(const Lazy_exact_nt<ET1>& a, const Lazy_exact_nt<ET2>& b)
+{
+  CGAL_PROFILER(std::string("calls to    : ") + std::string(CGAL_PRETTY_FUNCTION));
+  return new Lazy_exact_Mul<typename Coercion_traits<ET1, ET2>::Type,
+                            ET1, ET2>(a, b);
+}
+
+template <typename ET1, typename ET2>
+Lazy_exact_nt< typename Coercion_traits<ET1, ET2>::Type >
+operator/(const Lazy_exact_nt<ET1>& a, const Lazy_exact_nt<ET2>& b)
+{
+  CGAL_PROFILER(std::string("calls to    : ") + std::string(CGAL_PRETTY_FUNCTION));
+  CGAL_precondition(b != 0);
+  return new Lazy_exact_Div<typename Coercion_traits<ET1, ET2>::Type,
+                            ET1, ET2>(a, b);
+}
+
+//
+// Algebraic structure traits
+//
+
+namespace INTERN_LAZY_EXACT_NT {
+
+template< class NT, class Functor >
+struct Simplify_selector {
+  struct Simplify : public std::unary_function<NT&, void> {
+    void operator()( NT& ) const {
+      // TODO: In the old implementation the Simplify-functor was the default
+      //       (which does nothing). But this cannot be the correct way!?
+    }
+  };
+};
+
+template< class NT >
+struct Simplify_selector< NT, Null_functor > {
+  typedef Null_functor Simplify;
+};
+
+template< class NT, class Functor >
+struct Unit_part_selector {
+  struct Unit_part : public std::unary_function<NT, NT > {
+    NT operator()( const NT& x ) const {
+      return NT( CGAL_NTS unit_part( x.exact() ) );
+    }
+  };
+};
+
+template< class NT >
+struct Unit_part_selector< NT, Null_functor > {
+  typedef Null_functor Unit_part;
+};
+
+template< class NT, class Functor >
+struct Is_zero_selector {
+  struct Is_zero : public std::unary_function<NT, bool > {
+    bool operator()( const NT& x ) const {
+      return CGAL_NTS is_zero( x.exact() );
+    }
+  };
+};
+
+template< class NT >
+struct Is_zero_selector< NT, Null_functor > {
+  typedef Null_functor Is_zero;
+};
+
+template< class NT, class Functor >
+struct Is_one_selector {
+  struct Is_one : public std::unary_function<NT, bool > {
+    bool operator()( const NT& x ) const {
+      return CGAL_NTS is_one( x.exact() );
+    }
+  };
+};
+
+template< class NT >
+struct Is_one_selector< NT, Null_functor > {
+  typedef Null_functor Is_one;
+};
+
+template< class NT, class Functor >
+struct Square_selector {
+  struct Square : public std::unary_function<NT, NT > {
+    NT operator()( const NT& x ) const {
+      CGAL_PROFILER(std::string("calls to    : ") + std::string(CGAL_PRETTY_FUNCTION));
+      return new Lazy_exact_Square<typename NT::ET>(x);
+    }
+  };
+};
+
+template< class NT >
+struct Square_selector< NT, Null_functor > {
+  typedef Null_functor Square;
+};
+
+template< class NT, class Functor >
+struct Integral_division_selector {
+  struct Integral_division : public std::binary_function<NT, NT, NT > {
+    NT operator()( const NT& x, const NT& y ) const {
+      return NT( CGAL_NTS integral_division( x.exact(), y.exact() ) );
+    }
+
+    CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( NT )
+  };
+};
+
+template< class NT >
+struct Integral_division_selector< NT, Null_functor > {
+  typedef Null_functor Integral_division;
+};
+
+template< class NT, class Functor >
+struct Is_square_selector {
+  struct Is_square : public std::binary_function<NT, NT&, bool > {
+      bool operator()( const NT& x, NT& y ) const {
+          typename NT::ET y_et;
+          bool result = CGAL_NTS is_square( x.exact(), y_et );
+          y = NT(y_et);
+          return result;
+      }
+      bool operator()( const NT& x) const {
+          typename NT::ET y_et;
+          return CGAL_NTS is_square( x.exact(), y_et );
+      }
+  };
+};
+
+template< class NT >
+struct Is_square_selector< NT, Null_functor > {
+  typedef Null_functor Is_square;
+};
+
+
+template <class NT, class AlgebraicStructureTag>
+struct Sqrt_selector{
+    struct Sqrt : public std::unary_function<NT, NT > {
+        NT operator ()(const NT& x) const {
+          CGAL_PROFILER(std::string("calls to    : ") + std::string(CGAL_PRETTY_FUNCTION));
+          CGAL_precondition(x >= 0);
+          return new Lazy_exact_Sqrt<typename NT::ET>(x);
+        }
+    };
+};
+template <class NT>
+struct Sqrt_selector<NT,Null_functor> {
+    typedef Null_functor Sqrt;
+};
+
+template< class NT, class Functor >
+struct Kth_root_selector {
+  struct Kth_root : public std::binary_function<int, NT, NT > {
+    NT operator()( int k, const NT& x ) const {
+      return NT( CGAL_NTS kth_root( k, x.exact() ) );
+    }
+  };
+};
+
+template< class NT >
+struct Kth_root_selector< NT, Null_functor > {
+  typedef Null_functor Kth_root;
+};
+
+template< class NT, class Functor >
+struct Root_of_selector {
+  private:
+      struct Cast{
+        typedef typename NT::ET result_type;
+        result_type operator()(const NT& lazy_exact) const {
+          return lazy_exact.exact();
+        }
+      };
+
+  public:
+    struct Root_of {
+//      typedef typename Functor::Boundary Boundary;
+      typedef NT result_type;
+      template< class Input_iterator >
+      NT operator()( int k, Input_iterator begin, Input_iterator end ) const {
+       Cast cast;
+       return NT( typename Algebraic_structure_traits<typename NT::ET>::
+                                 Root_of()( k,
+                              ::boost::make_transform_iterator( begin, cast ),
+                              ::boost::make_transform_iterator( end, cast ) ) );
+      }
+
+    };
+};
+
+template< class NT >
+struct Root_of_selector< NT, Null_functor > {
+  typedef Null_functor Root_of;
+};
+
+template< class NT, class Functor >
+struct Gcd_selector {
+  struct Gcd : public std::binary_function<NT, NT, NT > {
+    NT operator()( const NT& x, const NT& y ) const {
+     CGAL_PROFILER(std::string("calls to    : ") + std::string(CGAL_PRETTY_FUNCTION));
+     return NT( CGAL_NTS gcd( x.exact(), y.exact() ) );
+    }
+
+    CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( NT )
+  };
+};
+
+template< class NT >
+struct Gcd_selector< NT, Null_functor > {
+  typedef Null_functor Gcd;
+};
+
+template< class NT, class Functor >
+struct Div_selector {
+  struct Div : public std::binary_function<NT, NT, NT > {
+    NT operator()( const NT& x, const NT& y ) const {
+      return NT( CGAL_NTS div( x.exact(), y.exact() ) );
+    }
+
+    CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( NT )
+
+  };
+};
+
+template< class NT >
+struct Div_selector< NT, Null_functor > {
+  typedef Null_functor Div;
+};
+
+template< class NT, class Functor >
+struct Inverse_selector {
+  struct Inverse  {
+    typedef NT result_type;
+    NT operator()( const NT& x ) const {
+      return NT( 1 ) / x ;
+    }
+  };
+};
+
+template< class NT >
+struct Inverse_selector< NT, Null_functor > {
+  typedef Null_functor Inverse;
+};
+
+template< class NT, class Functor >
+struct Mod_selector {
+  struct Mod : public std::binary_function<NT, NT, NT > {
+    NT operator()( const NT& x, const NT& y ) const {
+      return NT( CGAL_NTS mod( x.exact(), y.exact() ) );
+    }
+
+    CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( NT )
+
+  };
+};
+
+template< class NT >
+struct Mod_selector< NT, Null_functor > {
+  typedef Null_functor Mod;
+};
+
+template< class NT, class Functor >
+struct Div_mod_selector {
+  struct Div_mod {
+    typedef void result_type;
+    typedef NT   first_argument_type;
+    typedef NT   second_argument_type;
+    typedef NT&  third_argument_type;
+    typedef NT&  fourth_argument_type;
+
+    void operator()( const NT& x, const NT& y, NT& q, NT& r ) const {
+      typename NT::ET q_et;
+      typename NT::ET r_et;
+      CGAL_NTS div_mod( x.exact(), y.exact(), q_et, r_et );
+      q = NT( q_et );
+      r = NT( r_et );
+    }
+
+    template< class NT1, class NT2 >
+    void operator()( const NT1& x, const NT2& y,
+                     NT& q,
+                     NT& r ) const {
+      CGAL_static_assertion((::boost::is_same<
+        typename Coercion_traits< NT1, NT2 >::Type, NT
+                                              >::value));
+
+      typename Coercion_traits< NT1, NT2 >::Cast cast;
+      operator()( cast(x), cast(y), q, r );
+    }
+  };
+};
+
+template< class NT >
+struct Div_mod_selector< NT, Null_functor >{
+  typedef Null_functor Div_mod;
+};
+} // namespace INTERN_LAZY_EXACT_NT
+
+template <class ET>
+class Algebraic_structure_traits< Lazy_exact_nt<ET> >
+    :public Algebraic_structure_traits_base
+      < Lazy_exact_nt<ET>,
+       typename Algebraic_structure_traits<ET>::Algebraic_category >
+{
+private:
+    typedef Algebraic_structure_traits<ET> AST_ET;
+    typedef typename AST_ET::Algebraic_category ET_as_tag;
+public:
+    typedef typename AST_ET::Is_exact               Is_exact;
+    typedef typename AST_ET::Is_numerical_sensitive Is_numerical_sensitive;
+
+    typedef typename INTERN_LAZY_EXACT_NT::Simplify_selector
+    <Lazy_exact_nt<ET>, typename AST_ET::Simplify > ::Simplify Simplify;
+
+    typedef typename INTERN_LAZY_EXACT_NT::Unit_part_selector
+    <Lazy_exact_nt<ET>, typename AST_ET::Unit_part > ::Unit_part Unit_part;
+
+    typedef typename INTERN_LAZY_EXACT_NT::Is_zero_selector
+    <Lazy_exact_nt<ET>, typename AST_ET::Is_zero > ::Is_zero Is_zero;
+
+    typedef typename INTERN_LAZY_EXACT_NT::Is_one_selector
+    <Lazy_exact_nt<ET>, typename AST_ET::Is_one > ::Is_one Is_one;
+
+    typedef typename INTERN_LAZY_EXACT_NT::Square_selector
+    <Lazy_exact_nt<ET>, typename AST_ET::Square > ::Square Square;
+
+    typedef typename INTERN_LAZY_EXACT_NT::Integral_division_selector
+    <Lazy_exact_nt<ET>, typename AST_ET::Integral_division> ::Integral_division Integral_division;
+
+    typedef typename INTERN_LAZY_EXACT_NT::Is_square_selector
+    <Lazy_exact_nt<ET>, typename AST_ET::Is_square > ::Is_square Is_square;
+
+    typedef typename INTERN_LAZY_EXACT_NT::Sqrt_selector
+    <Lazy_exact_nt<ET>, typename AST_ET::Sqrt> ::Sqrt Sqrt;
+
+    typedef typename INTERN_LAZY_EXACT_NT::Kth_root_selector
+    <Lazy_exact_nt<ET>, typename AST_ET::Kth_root > ::Kth_root Kth_root;
+
+    typedef typename INTERN_LAZY_EXACT_NT::Root_of_selector
+    <Lazy_exact_nt<ET>, typename AST_ET::Root_of > ::Root_of Root_of;
+
+    typedef typename INTERN_LAZY_EXACT_NT::Gcd_selector
+    <Lazy_exact_nt<ET>, typename AST_ET::Gcd > ::Gcd Gcd;
+
+    typedef typename INTERN_LAZY_EXACT_NT::Div_selector
+    <Lazy_exact_nt<ET>, typename AST_ET::Div > ::Div Div;
+
+    typedef typename INTERN_LAZY_EXACT_NT::Mod_selector
+    <Lazy_exact_nt<ET>, typename AST_ET::Mod > ::Mod Mod;
+
+    typedef typename INTERN_LAZY_EXACT_NT::Div_mod_selector
+    <Lazy_exact_nt<ET>, typename AST_ET::Div_mod > ::Div_mod Div_mod;
+    
+    typedef typename INTERN_LAZY_EXACT_NT::Inverse_selector
+    <Lazy_exact_nt<ET>, typename AST_ET::Inverse > ::Inverse Inverse;    
+};
+
+
+
+//
+// Real embeddalbe traits
+//
+
+template < typename ET > class Real_embeddable_traits< Lazy_exact_nt<ET> >
+  : public INTERN_RET::Real_embeddable_traits_base< Lazy_exact_nt<ET> , CGAL::Tag_true > {
+
+  // Every type ET of Lazy_exact_nt<ET> has to be real embeddable.
+  CGAL_static_assertion((::boost::is_same< typename Real_embeddable_traits< ET >
+                                ::Is_real_embeddable, Tag_true >::value));
+
+  public:
+    typedef Lazy_exact_nt<ET> Type;
+
+    class Abs
+      : public std::unary_function< Type, Type > {
+      public:
+        Type operator()( const Type& a ) const {
+            CGAL_PROFILER(std::string("calls to    : ") + std::string(CGAL_PRETTY_FUNCTION));
+            return new Lazy_exact_Abs<ET>(a);
+        }
+    };
+
+    class Sgn
+      : public std::unary_function< Type, ::CGAL::Sign > {
+      public:
+        ::CGAL::Sign operator()( const Type& a ) const {
+            CGAL_BRANCH_PROFILER(std::string(" failures/calls to   : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
+            Uncertain< ::CGAL::Sign> res = CGAL_NTS sign(a.approx());
+            if (is_certain(res))
+                return get_certain(res);
+            CGAL_BRANCH_PROFILER_BRANCH(tmp);
+            return CGAL_NTS sign(a.exact());
+        }
+    };
+
+    class Compare
+      : public std::binary_function< Type, Type,
+                                Comparison_result > {
+      public:
+        Comparison_result operator()( const Type& a,
+                                            const Type& b ) const {
+            CGAL_BRANCH_PROFILER(std::string(" failures/calls to   : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
+            if (a.identical(b))
+                return EQUAL;
+            Uncertain<Comparison_result> res = CGAL_NTS compare(a.approx(), b.approx());
+            if (is_certain(res))
+                return get_certain(res);
+            CGAL_BRANCH_PROFILER_BRANCH(tmp);
+            return CGAL_NTS compare(a.exact(), b.exact());
+        }
+
+        CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT( Type,
+                                                      Comparison_result )
+
+    };
+
+    class To_double
+      : public std::unary_function< Type, double > {
+      public:
+        double operator()( const Type& a ) const {
+            CGAL_BRANCH_PROFILER(std::string(" failures/calls to   : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
+
+            const Interval_nt<false>& app = a.approx();
+            double r;
+            if (fit_in_double(app, r))
+                return r;
+
+            // If it's precise enough, then OK.
+            if (has_smaller_relative_precision(app,
+                 Lazy_exact_nt<ET>::get_relative_precision_of_to_double()))
+                return CGAL_NTS to_double(app);
+
+            CGAL_BRANCH_PROFILER_BRANCH(tmp);
+
+            // Otherwise we trigger exact computation first,
+            // which will refine the approximation.
+            a.exact();
+            return CGAL_NTS to_double(a.approx());
+        }
+    };
+
+    class To_interval
+      : public std::unary_function< Type, std::pair< double, double > > {
+      public:
+        std::pair<double, double> operator()( const Type& a ) const {
+            CGAL_PROFILER(std::string("calls to    : ") + std::string(CGAL_PRETTY_FUNCTION));
+            return a.approx().pair();
+        }
+    };
+
+    class Is_finite
+      : public std::unary_function< Type, bool > {
+      public:
+        bool operator()( const Type& x ) const {
+          return CGAL_NTS is_finite(x.approx()) || CGAL_NTS is_finite(x.exact());
+        }
+    };
+
+};
+
+template <class ET1, class ET2, class F>
+class Lazy_exact_nt_coercion_traits_base {
+public:
+    typedef Tag_false Are_explicit_interoperable;
+    typedef Tag_false Are_implicit_interoperable;
+    //typedef Null_type    Type
+    typedef Null_functor Cast;
+};
+
+template <class ET1, class ET2>
+class Lazy_exact_nt_coercion_traits_base < Lazy_exact_nt<ET1>, Lazy_exact_nt<ET2>, Tag_true >
+{
+    typedef Coercion_traits<ET1,ET2> CT;
+    typedef Lazy_exact_nt<ET1> A;
+    typedef Lazy_exact_nt<ET2> B;
+public:
+    typedef Lazy_exact_nt<typename CT::Type> Type;
+    typedef typename CT::Are_implicit_interoperable Are_explicit_interoperable;
+    typedef typename CT::Are_implicit_interoperable Are_implicit_interoperable;
+
+    class Cast{
+    private:
+        template <class T>
+        Type cast(const T& x) const{ return Type(x); }
+        Type cast(const Type& x) const{ return x; }
+    public:
+        typedef Type result_type;
+        Type operator()(const A& x) const { return cast(x);}
+        Type operator()(const B& x) const { return cast(x);}
+    };
+};
+
+
+CGAL_DEFINE_COERCION_TRAITS_FOR_SELF_TEM(Lazy_exact_nt<ET>, class ET)
+CGAL_DEFINE_COERCION_TRAITS_FROM_TO_TEM(ET,Lazy_exact_nt<ET>,class ET)
+
+template<class ET1, class ET2 >
+struct Coercion_traits< Lazy_exact_nt<ET1>, Lazy_exact_nt<ET2> >
+    :public Lazy_exact_nt_coercion_traits_base
+           <Lazy_exact_nt<ET1>, Lazy_exact_nt<ET2>,
+            typename Coercion_traits<ET1,ET2>::Are_implicit_interoperable>{};
+
+
+#define CGAL_COERCION_TRAITS_LAZY_EXACT(NTX)                            \
+    template<class ET>                                                  \
+    struct Coercion_traits< NTX, Lazy_exact_nt<ET> >{                   \
+    private:                                                            \
+        typedef Coercion_traits<NTX,ET> CT;                             \
+        typedef Lazy_exact_nt<ET> NT;                                   \
+    public:                                                             \
+        typedef typename CT::Are_explicit_interoperable                 \
+        Are_explicit_interoperable;                                     \
+        typedef typename CT::Are_implicit_interoperable                 \
+        Are_implicit_interoperable;                                     \
+    private:                                                            \
+        static const  bool interoperable                                \
+        =boost::is_same< Are_implicit_interoperable, Tag_false>::value; \
+    public:                                                             \
+        typedef typename boost::mpl::if_c <interoperable,Null_tag,NT>   \
+        ::type  Type;                                          \
+        typedef typename boost::mpl::if_c <interoperable, Null_functor, \
+    INTERN_CT::Cast_from_to<NTX,NT> >::type Cast;                       \
+    };                                                                  \
+                                                                        \
+    template<class ET>                                                  \
+    struct Coercion_traits< Lazy_exact_nt<ET>, NTX >                    \
+        :public Coercion_traits<NTX, Lazy_exact_nt<ET> >{};             \
+
+
+CGAL_COERCION_TRAITS_LAZY_EXACT(int)
+CGAL_COERCION_TRAITS_LAZY_EXACT(short)
+CGAL_COERCION_TRAITS_LAZY_EXACT(double)
+CGAL_COERCION_TRAITS_LAZY_EXACT(float)
+#undef CGAL_COERCION_TRAITS_LAZY_EXACT
+
+namespace INTERN_LAZY_EXACT_NT {
+
+template < typename NT, typename TAG  > class Fraction_traits_base;
+
+template < class ET >
+class Fraction_traits_base <Lazy_exact_nt<ET> , CGAL::Tag_false>
+    : public Fraction_traits<ET> {
+public:
+    typedef Lazy_exact_nt<ET>  Type;
+};
+
+template < class ET >
+class Fraction_traits_base <Lazy_exact_nt<ET> , CGAL::Tag_true>{
+    typedef Fraction_traits<ET> ETT;
+    typedef typename ETT::Numerator_type ET_numerator;
+    typedef typename ETT::Denominator_type ET_denominator;
+public:
+    typedef Lazy_exact_nt<ET>  Type;
+    typedef Tag_true Is_fraction;
+    typedef Lazy_exact_nt<ET_numerator> Numerator_type;
+    typedef Lazy_exact_nt<ET_denominator> Denominator_type;
+
+    struct Common_factor : std::binary_function<Denominator_type,Denominator_type,Denominator_type>{
+        Denominator_type operator()(const Denominator_type& a, const Denominator_type& b) const {
+            typename ETT::Common_factor common_factor;
+            return Denominator_type(common_factor(a.exact(),b.exact()));
+        }
+    };
+    struct Compose : std::binary_function<Type,Numerator_type,Denominator_type>{
+        Type operator()(const Numerator_type& n, const Denominator_type& d) const {
+            typename ETT::Compose compose;
+            return Type(compose(n.exact(),d.exact()));
+        }
+    };
+    struct Decompose {
+        typedef void result_type;
+        typedef Type first_argument_type;
+        typedef Numerator_type second_argument_type;
+        typedef Denominator_type third_argument_type;
+        void operator()(const Type& f, Numerator_type& n, Denominator_type& d) const {
+            typename ETT::Decompose decompose;
+            ET_numerator nn;
+            ET_denominator dd;
+            decompose(f.exact(),nn,dd);
+            n = Numerator_type(nn);
+            d = Denominator_type(dd);
+        }
+    };
+};
+} // namespace INTERN_LAZY_EXACT_NT
+
+
+template < class ET >
+class Fraction_traits< Lazy_exact_nt< ET > >
+    :public INTERN_LAZY_EXACT_NT::Fraction_traits_base<Lazy_exact_nt<ET>,
+            typename Fraction_traits<ET>::Is_fraction>
+{};
+
+template < class ET >
+struct Min <Lazy_exact_nt<ET> >
+    : public std::binary_function<Lazy_exact_nt<ET>,Lazy_exact_nt<ET>,Lazy_exact_nt<ET> > {
+
+    Lazy_exact_nt<ET> operator()( const Lazy_exact_nt<ET>& x, const Lazy_exact_nt<ET>& y) const
+    {
+      if (x.identical(y)){
+        return x;
+      }
+      Uncertain<bool> res = x.approx() < y.approx();
+      if(is_certain(res)){
+        return res.make_certain() ? x : y;
+      }
+      CGAL_PROFILER(std::string("calls to    : ") + std::string(CGAL_PRETTY_FUNCTION));
+      return new Lazy_exact_Min<ET>(x, y);
+    }
+};
+
+template < class ET >
+struct Max <Lazy_exact_nt<ET> >
+    : public std::binary_function<Lazy_exact_nt<ET>,Lazy_exact_nt<ET>,Lazy_exact_nt<ET> > {
+
+    Lazy_exact_nt<ET> operator()( const Lazy_exact_nt<ET>& x, const Lazy_exact_nt<ET>& y) const
+    {
+      if (x.identical(y)){
+        return x;
+      }
+      Uncertain<bool> res = x.approx() > y.approx();
+      if(is_certain(res)){
+        return  res.make_certain() ? x : y;
+      }
+        CGAL_PROFILER(std::string("calls to    : ") + std::string(CGAL_PRETTY_FUNCTION));
+        return new Lazy_exact_Max<ET>(x, y);
+    }
+};
+
+template<typename ET> inline 
+Lazy_exact_nt<ET> min BOOST_PREVENT_MACRO_SUBSTITUTION(
+const Lazy_exact_nt<ET> & x,
+const Lazy_exact_nt<ET> & y){
+  return CGAL::Min<Lazy_exact_nt<ET> > ()(x,y);
+}
+template<typename ET> inline 
+Lazy_exact_nt<ET> max BOOST_PREVENT_MACRO_SUBSTITUTION(
+const Lazy_exact_nt<ET> & x,
+const Lazy_exact_nt<ET> & y){
+  return CGAL::Max<Lazy_exact_nt<ET> > ()(x,y);
+}
+
+template <typename ET>
+std::ostream &
+operator<< (std::ostream & os, const Lazy_exact_nt<ET> & a)
+{ return os << CGAL_NTS to_double(a); }
+
+template <typename ET>
+std::istream &
+operator>> (std::istream & is, Lazy_exact_nt<ET> & a)
+{
+  ET e;
+  internal::read_float_or_quotient(is, e);
+  if (is)
+    a = e;
+  return is;
+}
+
+template< class ET >
+class Is_valid< Lazy_exact_nt<ET> >
+  : public std::unary_function< Lazy_exact_nt<ET>, bool > {
+  public :
+    bool operator()( const Lazy_exact_nt<ET>& x ) const {
+      return is_valid(x.approx());
+    }
+};
+
+template < typename ET >
+struct NT_converter < Lazy_exact_nt<ET>, ET >
+{
+  const ET& operator()(const Lazy_exact_nt<ET> &a) const
+  { return a.exact(); }
+};
+
+// Forward declaration to break inclusion cycle
+namespace internal {
+template<class>struct Exact_field_selector;
+template<class>struct Exact_ring_selector;
+}
+// Compiler can deduce ET from the first argument.
+template < typename ET >
+struct NT_converter < Lazy_exact_nt<ET>,
+  typename First_if_different<
+    typename internal::Exact_field_selector<ET>::Type,
+    ET>::Type>
+{
+  typename internal::Exact_field_selector<ET>::Type
+    operator()(const Lazy_exact_nt<ET> &a) const
+  { return NT_converter<ET,typename internal::Exact_field_selector<ET>::Type>()(a.exact()); }
+};
+
+template < typename ET >
+struct NT_converter < Lazy_exact_nt<ET>,
+  typename First_if_different<
+   typename First_if_different<
+    typename internal::Exact_ring_selector<ET>::Type,
+    ET>::Type,
+   typename internal::Exact_field_selector<ET>::Type>::Type>
+{
+  typename internal::Exact_ring_selector<ET>::Type operator()(const Lazy_exact_nt<ET> &a) const
+  { return NT_converter<ET,typename internal::Exact_ring_selector<ET>::Type>()(a.exact()); }
+};
+
+namespace internal {
+// Returns true if the value is representable by a double and to_double()
+// would return it.  False means "don't know" (the exact number type is not
+// queried).
+template < typename ET >
+inline bool
+fit_in_double(const Lazy_exact_nt<ET>& l, double& r)
+{ return fit_in_double(l.approx(), r); }
+
+} // namespace internal
+
+template <class NT_,class ROOT_, class ACDE_TAG_, class FP_TAG>
+void
+print(std::ostream &os, const CGAL::Lazy_exact_nt< Sqrt_extension<NT_,ROOT_,ACDE_TAG_,FP_TAG> > &r)
+{
+  print(os,r.exact());
+}
+
+namespace INTERN_LAZY_EXACT_NT {
+template< typename ET , typename Tag>
+class Modular_traits_base{
+public:
+  typedef Lazy_exact_nt<ET> NT;
+  typedef ::CGAL::Tag_false Is_modularizable;
+  typedef ::CGAL::Null_functor Residue_type;
+  typedef ::CGAL::Null_functor Modular_image;  
+  typedef ::CGAL::Null_functor Modular_image_representative;    
+};
+
+template< typename ET >
+class Modular_traits_base<ET, Tag_true>{
+  typedef Modular_traits<ET> MT_ET;
+public:
+  typedef Lazy_exact_nt<ET> NT;
+  typedef CGAL::Tag_true Is_modularizable;
+  typedef typename MT_ET::Residue_type Residue_type;
+
+  struct Modular_image{
+    Residue_type operator()(const NT& a){
+      typename MT_ET::Modular_image modular_image;
+      return modular_image(a.exact());
+    }
+  };
+  struct Modular_image_representative{
+    NT operator()(const Residue_type& x){
+      typename MT_ET::Modular_image_representative modular_image_representative;
+      return NT(modular_image_representative(x));
+    }
+  };    
+};
+} // namespace INTERN_LAZY_EXACT_NT
+
+template < typename ET > 
+class Modular_traits<Lazy_exact_nt<ET> >
+  :public INTERN_LAZY_EXACT_NT::Modular_traits_base
+<ET,typename Modular_traits<ET>::Is_modularizable>{};
+
+
+#undef CGAL_double
+#undef CGAL_int
+#undef CGAL_To_interval
+
+} //namespace CGAL
+
+namespace Eigen {
+  template<class> struct NumTraits;
+  template<typename ET> struct NumTraits<CGAL::Lazy_exact_nt<ET> >
+  {
+    typedef CGAL::Lazy_exact_nt<ET> Real;
+    // typedef CGAL::Lazy_exact_nt<ET> NonInteger;
+    typedef CGAL::Lazy_exact_nt<typename NumTraits<ET>::NonInteger> NonInteger;
+    typedef CGAL::Lazy_exact_nt<ET> Nested;
+    typedef CGAL::Lazy_exact_nt<ET> Literal;
+
+    static inline Real epsilon() { return 0; }
+    static inline Real dummy_precision() { return 0; }
+
+    enum {
+      IsInteger = NumTraits<ET>::IsInteger,
+      IsSigned = NumTraits<ET>::IsSigned,
+      IsComplex = NumTraits<ET>::IsComplex,
+      RequireInitialization = 1,
+      ReadCost = 8,
+      AddCost = 30,
+      MulCost = 30
+    };
+  };
+}
+
+#endif // CGAL_LAZY_EXACT_NT_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Lazy_kernel.h b/3rdparty/CGAL/include/CGAL/Lazy_kernel.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Lazy_kernel.h
rename to 3rdparty/CGAL/include/CGAL/Lazy_kernel.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Level_interval.h b/3rdparty/CGAL/include/CGAL/Level_interval.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Level_interval.h
rename to 3rdparty/CGAL/include/CGAL/Level_interval.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Lightweight_vector_3.h b/3rdparty/CGAL/include/CGAL/Lightweight_vector_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Lightweight_vector_3.h
rename to 3rdparty/CGAL/include/CGAL/Lightweight_vector_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Line_2.h b/3rdparty/CGAL/include/CGAL/Line_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Line_2.h
rename to 3rdparty/CGAL/include/CGAL/Line_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Line_2_Bbox_2_intersection.h b/3rdparty/CGAL/include/CGAL/Line_2_Bbox_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Line_2_Bbox_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Line_2_Bbox_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Line_2_Iso_rectangle_2_intersection.h b/3rdparty/CGAL/include/CGAL/Line_2_Iso_rectangle_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Line_2_Iso_rectangle_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Line_2_Iso_rectangle_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Line_2_Line_2_intersection.h b/3rdparty/CGAL/include/CGAL/Line_2_Line_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Line_2_Line_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Line_2_Line_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Line_2_Point_2_intersection.h b/3rdparty/CGAL/include/CGAL/Line_2_Point_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Line_2_Point_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Line_2_Point_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Line_2_Ray_2_intersection.h b/3rdparty/CGAL/include/CGAL/Line_2_Ray_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Line_2_Ray_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Line_2_Ray_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Line_2_Segment_2_intersection.h b/3rdparty/CGAL/include/CGAL/Line_2_Segment_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Line_2_Segment_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Line_2_Segment_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Line_2_Triangle_2_intersection.h b/3rdparty/CGAL/include/CGAL/Line_2_Triangle_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Line_2_Triangle_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Line_2_Triangle_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Line_3.h b/3rdparty/CGAL/include/CGAL/Line_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Line_3.h
rename to 3rdparty/CGAL/include/CGAL/Line_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Line_arc_2.h b/3rdparty/CGAL/include/CGAL/Line_arc_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Line_arc_2.h
rename to 3rdparty/CGAL/include/CGAL/Line_arc_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Line_arc_3.h b/3rdparty/CGAL/include/CGAL/Line_arc_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Line_arc_3.h
rename to 3rdparty/CGAL/include/CGAL/Line_arc_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Linear_algebraCd.h b/3rdparty/CGAL/include/CGAL/Linear_algebraCd.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Linear_algebraCd.h
rename to 3rdparty/CGAL/include/CGAL/Linear_algebraCd.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Linear_algebraHd.h b/3rdparty/CGAL/include/CGAL/Linear_algebraHd.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Linear_algebraHd.h
rename to 3rdparty/CGAL/include/CGAL/Linear_algebraHd.h
diff --git a/3rdparty/CGAL/include/CGAL/Linear_cell_complex.h b/3rdparty/CGAL/include/CGAL/Linear_cell_complex.h
new file mode 100644
index 0000000..7d9cca5
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Linear_cell_complex.h
@@ -0,0 +1,945 @@
+// Copyright (c) 2011 CNRS and LIRIS' Establishments (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Guillaume Damiand <guillaume.damiand at liris.cnrs.fr>
+//
+#ifndef CGAL_LINEAR_CELL_COMPLEX_H
+#define CGAL_LINEAR_CELL_COMPLEX_H 1
+
+#include <CGAL/Combinatorial_map.h>
+#include <CGAL/Combinatorial_map_constructors.h>
+#include <CGAL/Linear_cell_complex_operations.h>
+#include <CGAL/Linear_cell_complex_min_items.h>
+#include <CGAL/Linear_cell_complex_traits.h>
+#include <CGAL/Linear_cell_complex_storages.h>
+
+namespace CGAL {
+
+  /** @file Linear_cell_complex.h
+   * Definition of a linear cell complex, i.e. a combinatorial map with points
+   * associated to all vertices.
+   */
+
+  /**  Linear_cell_complex class.
+   * The Linear_cell_complex a nD object with linear geometry, ie
+   * an nD combinatorial map with point associated to each vertex.
+   */
+  template < unsigned int d_, unsigned int ambient_dim,
+             class Traits_,
+             class Items_,
+             class Alloc_,
+             template<unsigned int,class,class,class,class>
+             class CMap,
+             class Refs,
+             class Storage_>
+  class Linear_cell_complex_base:
+    public CMap<d_, Refs, Items_, Alloc_, Storage_>
+  {
+  public:
+    typedef Linear_cell_complex_base<d_, ambient_dim,
+                                Traits_, Items_, Alloc_, CMap,
+                                Refs, Storage_>  Self;
+    typedef CMap<d_, Refs, Items_, Alloc_, Storage_> Base;
+
+    typedef Traits_ Traits;
+    typedef Items_  Items;
+    typedef Alloc_  Alloc;
+    typedef Storage_ Storage;
+
+    static const unsigned int ambient_dimension = ambient_dim;
+    static const unsigned int dimension = Base::dimension;
+
+    typedef typename Storage::Dart_handle       Dart_handle;
+    typedef typename Storage::Dart_const_handle Dart_const_handle;
+    typedef typename Storage::Helper            Helper;
+
+    typedef typename Storage::Point  Point;
+    typedef typename Storage::Vector Vector;
+    typedef typename Storage::FT     FT;
+
+    typedef typename Base::Dart_range Dart_range;
+
+    /// Typedef for attributes
+    template<int i>
+    struct Attribute_type: public Base::template Attribute_type<i>
+    {};
+    template<int i>
+    struct Attribute_handle: public Base::template Attribute_handle<i>
+    {};
+    template<int i>
+    struct Attribute_const_handle:
+      public Base::template Attribute_const_handle<i>
+    {};
+    template<int i>
+    struct Attribute_range: public Base::template Attribute_range<i>
+    {};
+    template<int i>
+    struct Attribute_const_range:
+      public Base::template Attribute_const_range<i>
+    {};
+
+    typedef typename Base::template Attribute_type<0>::type Vertex_attribute;
+    typedef typename Base::template Attribute_handle<0>::type
+    Vertex_attribute_handle;
+    typedef typename Base::template Attribute_const_handle<0>::type
+    Vertex_attribute_const_handle;
+
+    typedef typename Base::template Attribute_range<0>::type
+    Vertex_attribute_range;
+    typedef typename Base::template Attribute_const_range<0>::type
+    Vertex_attribute_const_range;
+
+    typedef typename Base::size_type size_type;
+    typedef typename Base::Use_index Use_index;
+    typedef typename Base::Exception_no_more_available_mark
+    Exception_no_more_available_mark;
+
+    /// To use previous definition of create_dart methods.
+    using Base::create_dart;
+    using Base::beta;
+    using Base::is_free;
+    using Base::attribute;
+    using Base::null_handle;
+    using Base::point_of_vertex_attribute;
+
+    using Base::are_attributes_automatically_managed;
+    using Base::mark;
+    using Base::unmark;
+    using Base::free_mark;
+    using Base::get_new_mark;
+
+    using Base::insert_cell_0_in_cell_1;
+    using Base::insert_cell_0_in_cell_2;
+    using Base::insert_dangling_cell_1_in_cell_2;
+    using Base::insert_cell_1_in_cell_2;
+    using Base::insert_cell_2_in_cell_3;
+    
+    Linear_cell_complex_base() : Base()
+    {}
+
+    /** Copy the given linear cell complex into *this.
+     *  Note that both LCC can have different dimensions and/or non void attributes.
+     *  @param alcc the linear cell complex to copy.
+     *  @post *this is valid.
+     */
+    Linear_cell_complex_base(const Self & alcc)
+    { Base::template copy<Self>(alcc); }
+
+    template < class LCC2 >
+    Linear_cell_complex_base(const LCC2& alcc)
+    { Base::template copy<LCC2>(alcc);}
+
+    template < class LCC2, typename Converters >
+    Linear_cell_complex_base(const LCC2& alcc, Converters& converters)
+    { Base::template copy<LCC2, Converters>(alcc, converters);}
+
+    template < class LCC2, typename Converters, typename Pointconverter >
+    Linear_cell_complex_base(const LCC2& alcc, Converters& converters,
+                        const Pointconverter& pointconverter)
+    { Base::template copy<LCC2, Converters, Pointconverter>
+          (alcc, converters, pointconverter);}
+
+    /** Create a vertex attribute.
+     * @return an handle on the new attribute.
+     */
+#ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
+    template<typename ...Args>
+    Vertex_attribute_handle create_vertex_attribute(const Args&... args)
+    { return Base::template create_attribute<0>(args...); }
+#else
+    Vertex_attribute_handle create_vertex_attribute()
+    { return Base::template create_attribute<0>(); }
+
+    template<typename T1>
+    Vertex_attribute_handle create_vertex_attribute(const T1& t1)
+    { return Base::template create_attribute<0>(t1); }
+
+    template<typename T1, typename T2>
+    Vertex_attribute_handle create_vertex_attribute
+    (const T1& t1, const T2 &t2)
+    { return Base::template create_attribute<0>(t1, t2); }
+
+    template<typename T1, typename T2, typename T3>
+    Vertex_attribute_handle create_vertex_attribute
+    (const T1& t1, const T2 &t2, const T3 &t3)
+    { return Base::template create_attribute<0>(t1, t2, t3); }
+
+    template<typename T1, typename T2, typename T3, typename T4>
+    Vertex_attribute_handle create_vertex_attribute
+    (const T1& t1, const T2 &t2, const T3 &t3, const T4 &t4)
+    { return Base::template create_attribute<0>(t1, t2, t3, t4); }
+
+    template<typename T1, typename T2, typename T3, typename T4, typename T5>
+    Vertex_attribute_handle create_vertex_attribute
+    (const T1& t1, const T2 &t2, const T3 &t3, const T4 &t4,
+     const T5 &t5)
+    { return Base::template create_attribute<0>(t1, t2, t3, t4, t5); }
+
+    template<typename T1, typename T2, typename T3, typename T4, typename T5,
+             typename T6>
+    Vertex_attribute_handle create_vertex_attribute
+    (const T1& t1, const T2 &t2, const T3 &t3, const T4 &t4,
+     const T5 &t5, const T6 &t6)
+    { return Base::template create_attribute<0>(t1, t2, t3, t4, t5, t6); }
+
+    template<typename T1, typename T2, typename T3, typename T4, typename T5,
+             typename T6, typename T7>
+    Vertex_attribute_handle create_vertex_attribute
+    (const T1& t1, const T2 &t2, const T3 &t3, const T4 &t4,
+     const T5 &t5, const T6 &t6, const T7 &t7)
+    { return Base::template create_attribute<0>(t1, t2, t3, t4, t5, t6, t7); }
+
+  template<typename T1, typename T2, typename T3, typename T4, typename T5,
+             typename T6, typename T7, typename T8>
+    Vertex_attribute_handle create_vertex_attribute
+    (const T1& t1, const T2 &t2, const T3 &t3, const T4 &t4,
+     const T5 &t5, const T6 &t6, const T7 &t7, const T8 &t8)
+    { return Base::template create_attribute<0>(t1, t2, t3, t4, t5, t6, t7,
+                                                t8); }
+
+  template<typename T1, typename T2, typename T3, typename T4, typename T5,
+           typename T6, typename T7, typename T8, typename T9>
+  Vertex_attribute_handle create_vertex_attribute
+    (const T1& t1, const T2 &t2, const T3 &t3, const T4 &t4,
+     const T5 &t5, const T6 &t6, const T7 &t7, const T8 &t8, const T9 &t9)
+    { return Base::template create_attribute<0>(t1, t2, t3, t4, t5, t6, t7,
+                                                t8, t9); }
+#endif // CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
+
+    /**
+     * Create a new dart associated with an handle through an attribute.
+     * @param ahandle the point handle to associated with the dart.
+     * @return a Dart_handle on the new dart.
+     */
+    Dart_handle create_dart(Vertex_attribute_handle ahandle)
+    {
+      Dart_handle res = create_dart();
+      set_vertex_attribute_of_dart(res,ahandle);
+      return res;
+    }
+
+    /** Create a new dart associated with a point.
+     * @param apoint the point to associated with the dart.
+     * @return a Dart_handle on the new dart.
+     */
+    Dart_handle create_dart(const Point& apoint)
+    { return create_dart(create_vertex_attribute(apoint)); }
+
+    /** Erase a given vertex attribute.
+     * @param ahandle the handle to the vertex attribute to erase.
+     */
+    void erase_vertex_attribute(Vertex_attribute_handle ahandle)
+    { Base::template erase_attribute<0>(ahandle); }
+
+    /** Set the vertex attribute of the given dart.
+     * @param adart a dart.
+     * @param ah the attribute to set.
+     */
+    void set_vertex_attribute_of_dart(Dart_handle adart,
+                                      Vertex_attribute_handle ah)
+    {
+      return CGAL::internal::Set_i_attribute_of_dart_functor<Self, 0>::
+          run(this, adart,ah);
+    }
+
+    /** Set the vertex attribute of all the darts of the vertex.
+     * @param adart a dart of the vertex.
+     * @param ah the attribute to set.
+     */
+    void set_vertex_attribute(Dart_handle adart,
+                              Vertex_attribute_handle ah)
+    { return CGAL::Set_i_attribute_functor<Self, 0>::run(this, adart,ah); }
+
+    /// @return the Vertex_attribute_range for all vertex_attributes.
+    Vertex_attribute_range& vertex_attributes()
+    { return this->template attributes<0>(); }
+
+    /// @return the Vertex_attribute_const_range for all vertex_attributes.
+    Vertex_attribute_const_range& vertex_attributes() const
+    { return this->template attributes<0>(); }
+
+    /// @return the size of the vertex_attribute container.
+    typename Base::size_type number_of_vertex_attributes() const
+    { return Base::template number_of_attributes<0>(); }
+
+#ifdef CGAL_CMAP_DEPRECATED
+    static Vertex_attribute_handle vertex_attribute(Dart_handle adart)
+    {
+      CGAL_assertion(adart!=NULL);
+      return adart->template attribute<0>();
+    }
+   static Vertex_attribute_const_handle vertex_attribute(Dart_const_handle
+                                                          adart)
+    {
+      CGAL_assertion(adart!=NULL);
+      return adart->template attribute<0>();
+    }
+    static Point& point(Dart_handle adart)
+    {
+      CGAL_assertion(adart!=NULL && adart->template attribute<0>()!=NULL );
+      return adart->template attribute<0>()->point();
+    }
+    static const Point& point(Dart_const_handle adart)
+    {
+      CGAL_assertion(adart!=NULL && adart->template attribute<0>()!=NULL );
+      return adart->template attribute<0>()->point();
+    }
+#else
+    /// Get the vertex_attribute associated with a dart.
+    /// @param a dart
+    /// @return the vertex_attribute.
+    Vertex_attribute_handle vertex_attribute(Dart_handle adart)
+    { return this->template attribute<0>(adart); }
+
+    /// Get the vertex_attribute associated with a const dart.
+    /// @param a dart
+    /// @return the vertex_const_attribute.
+    Vertex_attribute_const_handle
+    vertex_attribute(Dart_const_handle adart) const
+    { return this->template attribute<0>(adart); }
+
+    /// Get the point associated with a dart.
+    /// @param a dart
+    /// @return the point.
+    Point& point(Dart_handle adart)
+    {
+      CGAL_assertion(this->template attribute<0>(adart)!=null_handle );
+      return point_of_vertex_attribute(this->template attribute<0>(adart));
+    }
+
+    /// Get the point associated with a const dart.
+    /// @param a dart
+    /// @return the point.
+    const Point& point(Dart_const_handle adart) const
+    {
+      CGAL_assertion(this->template attribute<0>(adart)!=null_handle );
+      return point_of_vertex_attribute(this->template attribute<0>(adart));
+    }
+#endif // CGAL_CMAP_DEPRECATED
+
+    // Temporary methods to allow to write lcc->temp_vertex_attribute
+    // even with the old method. Depending if CGAL_CMAP_DEPRECATED is defined or not
+    // call the static method or the new method. To remove when we remove the
+    // old code.
+    Vertex_attribute_handle temp_vertex_attribute(Dart_handle adart)
+    {return vertex_attribute(adart); }
+    Vertex_attribute_const_handle
+    temp_vertex_attribute(Dart_const_handle adart) const
+    {return vertex_attribute(adart); }
+
+    /** Test if the lcc is valid.
+     * A Linear_cell_complex is valid if it is a valid Combinatorial_map with
+     * an attribute associated to each dart.
+     * @return true iff the map is valid.
+     */
+    bool is_valid() const
+    {
+      bool valid = Base::is_valid();
+      for (typename Dart_range::const_iterator it(this->darts().begin()),
+             itend(this->darts().end()); valid && it != itend; ++it)
+      {
+        if ( vertex_attribute(it)==null_handle )
+        {
+          std::cerr << "Map not valid: dart "<<&(*it)
+                    <<" does not have a vertex."<< std::endl;
+          valid = false;
+        }
+      }
+      return valid;
+    }
+
+    /** validate the lcc
+     */
+    void correct_invalid_attributes()
+    {
+      // Copy of the code in CMap::correct_invalid_attributes() to avoid
+      // 2 iterations through the darts of the map.
+
+      std::vector<size_type> marks(dimension+1);
+      for ( unsigned int i=0; i<=dimension; ++i)
+        marks[i] = Base::INVALID_MARK;
+
+      Helper::template
+        Foreach_enabled_attributes<Reserve_mark_functor<Self> >::
+          run(this,&marks);
+
+      for ( typename Dart_range::iterator it(this->darts().begin()),
+             itend(this->darts().end()); it!=itend; ++it)
+      {
+        Helper::template Foreach_enabled_attributes
+          <internal::Correct_invalid_attributes_functor<Self> >::
+          run(this,it,&marks);
+
+        if ( vertex_attribute(it)==null_handle )
+        {
+          // If a dart don't have a 0-attribute, we create a Point at the origin
+          set_vertex_attribute(it, create_vertex_attribute(CGAL::ORIGIN));
+        }
+      }
+
+      for ( unsigned int i=0; i<=dimension; ++i)
+        if ( marks[i]!=Base::INVALID_MARK )
+        {
+          CGAL_assertion( this->is_whole_map_marked(marks[i]) );
+          free_mark(marks[i]);
+        }
+    }
+
+    /** test if the two given facets have the same geometry
+     * @return true iff the two facets have the same geometry.
+     */
+    bool are_facets_same_geometry(Dart_const_handle d1,
+                                  Dart_const_handle d2) const
+    {
+      typename Base::template Dart_of_orbit_range<1>::const_iterator
+        it1(*this,d1);
+      typename Base::template Dart_of_orbit_range<0>::const_iterator
+        it2(*this,d2);
+      bool samegeometry = true;
+      for ( ; samegeometry && it1.cont() && it2.cont(); ++it1, ++it2)
+      {
+        if ( this->other_extremity(it2)!=null_handle &&
+             point(it1)!=point(this->other_extremity(it2)) )
+          samegeometry = false;
+      }
+      if ( it1.cont() != it2.cont() ) samegeometry = false;
+      return samegeometry;
+    }
+
+    /// Sew3 the marked facets having same geometry
+    /// (a facet is considered marked if one of its dart is marked).
+    unsigned int sew3_same_facets(size_type AMark)
+    {
+      unsigned int res = 0;
+
+      std::map<Point, std::vector<Dart_handle> > one_dart_per_facet;
+      size_type mymark = get_new_mark();
+
+      // First we fill the std::map by one dart per facet, and by using
+      // the minimal point as index.
+      for (typename Dart_range::iterator it(this->darts().begin()),
+             itend(this->darts().end()); it!=itend; ++it )
+      {
+        if ( !this->is_marked(it, mymark) && this->is_marked(it, AMark) )
+        {
+          Point min_point=point(it);
+          Dart_handle min_dart = it;
+          this->mark(it, mymark);
+          typename Base::template
+            Dart_of_orbit_range<1>::iterator it2(*this,it);
+          ++it2;
+          for ( ; it2.cont(); ++it2 )
+          {
+            Point cur_point=point(it2);
+            this->mark(it2, mymark);
+            if ( cur_point < min_point )
+            {
+              min_point = cur_point;
+              min_dart = it2;
+            }
+          }
+          one_dart_per_facet[min_point].push_back(min_dart);
+        }
+        else
+          this->mark(it, mymark);
+      }
+
+      // Second we run through the map: candidates for sew3 have necessary the
+      // same minimal point.
+      typename std::map<Point, std::vector<Dart_handle> >::iterator
+        itmap=one_dart_per_facet.begin(),
+        itmapend=one_dart_per_facet.end();
+
+      for ( ; itmap!=itmapend; ++itmap )
+      {
+        for ( typename std::vector<Dart_handle>::iterator
+                it1=(itmap->second).begin(),
+                it1end=(itmap->second).end(); it1!=it1end; ++it1 )
+        {
+          typename std::vector<Dart_handle>::iterator it2=it1;
+          for ( ++it2; it2!= it1end; ++it2 )
+          {
+            if ( *it1!=*it2 && is_free(*it1, 3) &&
+                 is_free(*it2, 3) &&
+                 are_facets_same_geometry(*it1,beta(*it2, 0)) )
+            {
+              ++res;
+              this->template sew<3>(*it1,beta(*it2, 0));
+            }
+          }
+        }
+      }
+
+      CGAL_assertion( this->is_whole_map_marked(mymark) );
+      this->free_mark(mymark);
+      return res;
+    }
+
+    /// Sew3 the facets having same geometry
+    /// (all the facets of the map are considered)
+    unsigned int sew3_same_facets()
+    {
+      size_type mark = this->get_new_mark();
+      this->negate_mark(mark);
+      unsigned int res=sew3_same_facets(mark);
+      this->free_mark(mark);
+      return res;
+    }
+
+    /** Create an edge given 2 Vertex_attribute_handle.
+     * @param h0 the first vertex handle.
+     * @param h1 the second vertex handle.
+     * @return the dart of the new edge incident to h0.
+     */
+    Dart_handle make_segment(Vertex_attribute_handle h0,
+                             Vertex_attribute_handle h1)
+    {
+      Dart_handle d1 = this->make_edge();
+      set_vertex_attribute_of_dart(d1,h0);
+      set_vertex_attribute_of_dart(beta(d1, 2),h1);
+
+      return d1;
+    }
+
+    /** Create a segment given 2 points.
+     * @param p0 the first point.
+     * @param p1 the second point.
+     * @return the dart of the new segment incident to p0.
+     */
+    Dart_handle make_segment(const Point& p0,const Point& p1)
+    {
+      return make_segment(create_vertex_attribute(p0),
+                          create_vertex_attribute(p1));
+    }
+
+    /** Create a triangle given 3 Vertex_attribute_handle.
+     * @param h0 the first vertex handle.
+     * @param h1 the second vertex handle.
+     * @param h2 the third vertex handle.
+     * @return the dart of the new triangle incident to h0.
+     */
+    Dart_handle make_triangle(Vertex_attribute_handle h0,
+                              Vertex_attribute_handle h1,
+                              Vertex_attribute_handle h2)
+    {
+      Dart_handle d1 = this->make_combinatorial_polygon(3);
+
+      set_vertex_attribute_of_dart(d1,h0);
+      set_vertex_attribute_of_dart(beta(d1, 1),h1);
+      set_vertex_attribute_of_dart(beta(d1, 0),h2);
+
+      return d1;
+    }
+
+    /** Create a triangle given 3 points.
+     * @param p0 the first point.
+     * @param p1 the second point.
+     * @param p2 the third point.
+     * @return the dart of the new triangle incident to p0.
+     */
+    Dart_handle make_triangle(const Point& p0,
+                              const Point& p1,
+                              const Point& p2)
+    {
+      return make_triangle(create_vertex_attribute(p0),
+                           create_vertex_attribute(p1),
+                           create_vertex_attribute(p2));
+    }
+
+    /** Create a quadrangle given 4 Vertex_attribute_handle.
+     * @param h0 the first vertex handle.
+     * @param h1 the second vertex handle.
+     * @param h2 the third vertex handle.
+     * @param h3 the fourth vertex handle.
+     * @return the dart of the new quadrilateral incident to h0.
+     */
+    Dart_handle make_quadrangle(Vertex_attribute_handle h0,
+                                Vertex_attribute_handle h1,
+                                Vertex_attribute_handle h2,
+                                Vertex_attribute_handle h3)
+    {
+      Dart_handle d1 = this->make_combinatorial_polygon(4);
+
+      set_vertex_attribute_of_dart(d1,h0);
+      set_vertex_attribute_of_dart(beta(d1, 1),h1);
+      set_vertex_attribute_of_dart(beta(d1, 1, 1),h2);
+      set_vertex_attribute_of_dart(beta(d1, 0),h3);
+
+      return d1;
+    }
+
+    /** Create a quadrangle given 4 points.
+     * @param p0 the first point.
+     * @param p1 the second point.
+     * @param p2 the third point.
+     * @param p3 the fourth point.
+     * @return the dart of the new quadrangle incident to p0.
+     */
+    Dart_handle make_quadrangle(const Point& p0,
+                                const Point& p1,
+                                const Point& p2,
+                                const Point& p3)
+    {
+      return make_quadrangle(create_vertex_attribute(p0),
+                             create_vertex_attribute(p1),
+                             create_vertex_attribute(p2),
+                             create_vertex_attribute(p3));
+    }
+
+
+    /** Create a tetrahedron given 4 Vertex_attribute_handle.
+     * @param h0 the first vertex handle.
+     * @param h1 the second vertex handle.
+     * @param h2 the third vertex handle.
+     * @param h3 the fourth vertex handle.
+     * @return the dart of the new tetrahedron incident to h0 and to
+     *         facet h0,h1,h2.
+     */
+    Dart_handle make_tetrahedron(Vertex_attribute_handle h0,
+                                 Vertex_attribute_handle h1,
+                                 Vertex_attribute_handle h2,
+                                 Vertex_attribute_handle h3)
+    {
+      Dart_handle d1 = make_triangle(h0, h1, h2);
+      Dart_handle d2 = make_triangle(h1, h0, h3);
+      Dart_handle d3 = make_triangle(h1, h3, h2);
+      Dart_handle d4 = make_triangle(h3, h0, h2);
+
+      return this->make_combinatorial_tetrahedron(d1, d2, d3, d4);
+    }
+
+    /** Create a tetrahedron given 4 points.
+     * @param p0 the first point.
+     * @param p1 the second point.
+     * @param p2 the third point.
+     * @param p3 the fourth point.
+     * @return the dart of the new tetrahedron incident to p0 and to
+     *         facet p0,p1,p2.
+     */
+    Dart_handle make_tetrahedron(const Point& p0,
+                                 const Point& p1,
+                                 const Point& p2,
+                                 const Point& p3)
+    {
+      return make_tetrahedron(create_vertex_attribute(p0),
+                              create_vertex_attribute(p1),
+                              create_vertex_attribute(p2),
+                              create_vertex_attribute(p3));
+    }
+
+    /** Create an hexahedron given 8 Vertex_attribute_handle.
+     *    (8 vertices, 12 edges and 6 facets)
+     * \verbatim
+     *       4----7
+     *      /|   /|
+     *     5----6 |
+     *     | 3--|-2
+     *     |/   |/
+     *     0----1
+     * \endverbatim
+     * @param h0 the first vertex handle.
+     * @param h1 the second vertex handle.
+     * @param h2 the third vertex handle.
+     * @param h3 the fourth vertex handle.
+     * @param h4 the fifth vertex handle.
+     * @param h5 the sixth vertex handle.
+     * @param h6 the seventh vertex handle.
+     * @param h7 the height vertex handle.
+     * @return the dart of the new hexahedron incident to h0 and to
+     *         the facet (h0,h5,h6,h1).
+     */
+    Dart_handle make_hexahedron(Vertex_attribute_handle h0,
+                                Vertex_attribute_handle h1,
+                                Vertex_attribute_handle h2,
+                                Vertex_attribute_handle h3,
+                                Vertex_attribute_handle h4,
+                                Vertex_attribute_handle h5,
+                                Vertex_attribute_handle h6,
+                                Vertex_attribute_handle h7)
+    {
+      Dart_handle d1 = make_quadrangle(h0, h5, h6, h1);
+      Dart_handle d2 = make_quadrangle(h1, h6, h7, h2);
+      Dart_handle d3 = make_quadrangle(h2, h7, h4, h3);
+      Dart_handle d4 = make_quadrangle(h3, h4, h5, h0);
+      Dart_handle d5 = make_quadrangle(h0, h1, h2, h3);
+      Dart_handle d6 = make_quadrangle(h5, h4, h7, h6);
+
+      return this->make_combinatorial_hexahedron(d1, d2, d3, d4, d5, d6);
+    }
+
+    /** Create an hexahedron given 8 points.
+     * \verbatim
+     *       4----7
+     *      /|   /|
+     *     5----6 |
+     *     | 3--|-2
+     *     |/   |/
+     *     0----1
+     * \endverbatim
+     * @param p0 the first point.
+     * @param p1 the second point.
+     * @param p2 the third point.
+     * @param p3 the fourth point.
+     * @param p4 the fifth point.
+     * @param p5 the sixth point.
+     * @param p6 the seventh point.
+     * @param p7 the height point.
+     * @return the dart of the new hexahedron incident to p0
+     *         and to the facet (p0,p5,p6,p1).
+     */
+    Dart_handle make_hexahedron(const Point& p0,
+                                const Point& p1,
+                                const Point& p2,
+                                const Point& p3,
+                                const Point& p4,
+                                const Point& p5,
+                                const Point& p6,
+                                const Point& p7)
+    {
+      return make_hexahedron(create_vertex_attribute(p0),
+                             create_vertex_attribute(p1),
+                             create_vertex_attribute(p2),
+                             create_vertex_attribute(p3),
+                             create_vertex_attribute(p4),
+                             create_vertex_attribute(p5),
+                             create_vertex_attribute(p6),
+                             create_vertex_attribute(p7));
+    }
+
+    /** Compute the barycenter of a given cell.
+     * @param adart a dart incident to the cell.
+     * @param adim the dimension of the cell.
+     * @return the barycenter of the cell.
+     */
+    template<unsigned int i>
+    Point barycenter(Dart_const_handle adart) const
+    {
+      return CGAL::Barycenter_functor<Self, i>::run(*this, adart);
+    }
+
+    /** Insert a point in a given 1-cell.
+     * @param dh a dart handle to the 1-cell
+     * @param p the point to insert
+     * @param update_attributes a boolean to update the enabled attributes
+     * @return a dart handle to the new vertex containing p.
+     */
+    Dart_handle insert_point_in_cell_1(Dart_handle dh, const Point& p,
+                                       bool update_attributes)
+    {
+      return this->insert_cell_0_in_cell_1(dh,
+                                           create_vertex_attribute(p),
+                                           update_attributes);
+    }
+
+    /** Insert a point in a given 2-cell.
+     * @param dh a dart handle to the 2-cell
+     * @param p the point to insert
+     * @param update_attributes a boolean to update the enabled attributes
+     * @return a dart handle to the new vertex containing p.
+     */
+    Dart_handle insert_point_in_cell_2(Dart_handle dh, const Point& p,
+                                       bool update_attributes)
+    {
+      Vertex_attribute_handle v = create_vertex_attribute(p);
+
+      Dart_handle first = this->insert_cell_0_in_cell_2(dh, v, update_attributes);
+
+      if ( first==null_handle ) // If the triangulated facet was made of one dart
+        erase_vertex_attribute(v);
+
+#ifdef CGAL_CMAP_TEST_VALID_INSERTIONS
+      CGAL_assertion( is_valid() );
+#endif
+
+      return first;
+    }
+
+    /** Insert a point in a given i-cell.
+     * @param dh a dart handle to the i-cell
+     * @param p the point to insert
+     * @param update_attributes a boolean to update the enabled attributes
+     * @return a dart handle to the new vertex containing p.
+     */
+    template <unsigned int i>
+    Dart_handle insert_point_in_cell(Dart_handle dh, const Point& p,
+                                     bool update_attributes = true)
+    {
+      CGAL_static_assertion(1<=i && i<=2);
+      if (i==1) return insert_point_in_cell_1(dh, p, update_attributes);
+      return insert_point_in_cell_2(dh, p, update_attributes);
+    }
+
+    /** Insert a dangling edge in a given facet.
+     * @param dh a dart of the facet (!=NULL).
+     * @param p the coordinates of the new vertex.
+     * @param update_attributes a boolean to update the enabled attributes
+     * @return a dart of the new edge, incident to the new vertex.
+     */
+    Dart_handle insert_dangling_cell_1_in_cell_2(Dart_handle dh,
+                                                 const Point& p,
+                                                 bool update_attributes = true)
+    {
+      return this->insert_dangling_cell_1_in_cell_2
+          (dh, create_vertex_attribute(p), update_attributes);
+    }
+
+    /** Insert a point in a given i-cell.
+     * @param dh a dart handle to the i-cell
+     * @param p the point to insert
+     * @param update_attributes a boolean to update the enabled attributes
+     * @return a dart handle to the new vertex containing p.
+     */
+    template <unsigned int i>
+    Dart_handle insert_barycenter_in_cell(Dart_handle dh, bool update_attributes = true)
+    { return insert_point_in_cell<i>(dh, barycenter<i>(dh), update_attributes); }
+
+    /** Compute the dual of a Linear_cell_complex.
+     * @param alcc the lcc in which we build the dual of this lcc.
+     * @param adart a dart of the initial lcc, NULL by default.
+     * @return adart of the dual lcc, the dual of adart if adart!=NULL,
+     *         any dart otherwise.
+     * As soon as we don't modify this lcc and alcc lcc, we can iterate
+     * simultaneously through all the darts of the two lcc and we have
+     * each time of the iteration two "dual" darts.
+     */
+    Dart_handle dual_points_at_barycenter(Self & alcc, Dart_handle adart=null_handle)
+    {
+      Dart_handle res = Base::dual(alcc, adart);
+
+      // Now the lcc alcc is topologically correct, we just need to add
+      // its geometry to each vertex (the barycenter of the corresponding
+      // dim-cell in the initial map).
+      typename Dart_range::iterator it2 = alcc.darts().begin();
+      for (typename Dart_range::iterator it(this->darts().begin());
+           it!=this->darts().end(); ++it, ++it2)
+      {
+        if (vertex_attribute(it2)==null_handle)
+        {
+          alcc.set_vertex_attribute(it2, alcc.create_vertex_attribute
+                                    (barycenter<dimension>(it)));
+        }
+      }
+
+      return res;
+    }
+
+    /** Set the status of the managment of the attributes of the CMap
+     */
+    void set_update_attributes(bool newval)
+    {
+      if (this->automatic_attributes_management == false && newval == true)
+      {
+        // We need to recode this function because correct_invalid_attributes
+        // is not a virtual function.
+        correct_invalid_attributes();
+      }
+
+      this->automatic_attributes_management = newval;
+    }
+  };
+
+  // Linear_cell_complex using compact container with handle.
+  // No difference with class Linear_cell_complex_base except the default
+  // template parameters for Refs class.
+  template < unsigned int d_, unsigned int ambient_dim = d_,
+             class Traits_ = Linear_cell_complex_traits<ambient_dim>,
+             class Items_ = Linear_cell_complex_min_items<d_>,
+             class Alloc_ = CGAL_ALLOCATOR(int),
+             template<unsigned int,class,class,class,class>
+             class CMap = Combinatorial_map_base,
+             class Storage_ = Linear_cell_complex_storage_1<d_, ambient_dim,
+                                                            Traits_, Items_,
+                                                            Alloc_> >
+    class Linear_cell_complex: public Linear_cell_complex_base<d_,
+        ambient_dim, Traits_, Items_, Alloc_, CMap,
+        Linear_cell_complex<d_, ambient_dim,
+               Traits_, Items_, Alloc_, CMap, Storage_>,
+        Storage_>
+    {
+    public:
+      typedef Linear_cell_complex<d_, ambient_dim,
+                          Traits_, Items_, Alloc_, CMap, Storage_>  Self;
+
+      typedef Linear_cell_complex_base<d_, ambient_dim,
+                          Traits_, Items_, Alloc_, CMap, Self, Storage_> Base;
+
+      typedef Traits_ Traits;
+      typedef Items_  Items;
+      typedef Alloc_  Alloc;
+
+      static const unsigned int ambient_dimension = Base::ambient_dimension;
+      static const unsigned int dimension = Base::dimension;
+
+      typedef typename Base::Dart_handle       Dart_handle;
+      typedef typename Base::Dart_const_handle Dart_const_handle;
+      typedef typename Base::Helper            Helper;
+
+      typedef typename Base::Point  Point;
+      typedef typename Base::Vector Vector;
+      typedef typename Base::FT     FT;
+
+      typedef typename Base::Dart_range Dart_range;
+
+      typedef typename Base::template Attribute_type<0>::type Vertex_attribute;
+      typedef typename Base::template Attribute_handle<0>::type
+      Vertex_attribute_handle;
+      typedef typename Base::template Attribute_const_handle<0>::type
+      Vertex_attribute_const_handle;
+
+      typedef typename Base::template Attribute_range<0>::type
+      Vertex_attribute_range;
+      typedef typename Base::template Attribute_const_range<0>::type
+      Vertex_attribute_const_range;
+
+      typedef typename Base::size_type size_type;
+
+      typedef typename Base::Use_index Use_index;
+      typedef typename Base::Storage Storage;
+      typedef typename Base::Exception_no_more_available_mark
+      Exception_no_more_available_mark;
+
+      Linear_cell_complex() : Base()
+      {}
+
+      /** Copy the given linear cell complex into *this.
+       *  Note that both LCC can have different dimensions and/or non void attributes.
+       *  @param alcc the linear cell complex to copy.
+       *  @post *this is valid.
+       */
+      Linear_cell_complex(const Self & alcc) : Base()
+      { Base::template copy<Self>(alcc); }
+
+      template < class LCC2 >
+      Linear_cell_complex(const LCC2& alcc)
+      { Base::template copy<LCC2>(alcc);}
+
+      template < class LCC2, typename Converters >
+      Linear_cell_complex(const LCC2& alcc, Converters& converters)
+      { Base::template copy<LCC2, Converters>(alcc, converters);}
+
+      template < class LCC2, typename Converters, typename Pointconverter >
+      Linear_cell_complex(const LCC2& alcc, Converters& converters,
+                                    const Pointconverter& pointconverter)
+      { Base::template copy<LCC2, Converters, Pointconverter>
+            (alcc, converters, pointconverter);}
+
+    };
+
+} // namespace CGAL
+
+#endif // CGAL_LINEAR_CELL_COMPLEX_H //
+// EOF //
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Linear_cell_complex_constructors.h b/3rdparty/CGAL/include/CGAL/Linear_cell_complex_constructors.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Linear_cell_complex_constructors.h
rename to 3rdparty/CGAL/include/CGAL/Linear_cell_complex_constructors.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Linear_cell_complex_incremental_builder.h b/3rdparty/CGAL/include/CGAL/Linear_cell_complex_incremental_builder.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Linear_cell_complex_incremental_builder.h
rename to 3rdparty/CGAL/include/CGAL/Linear_cell_complex_incremental_builder.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Linear_cell_complex_min_items.h b/3rdparty/CGAL/include/CGAL/Linear_cell_complex_min_items.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Linear_cell_complex_min_items.h
rename to 3rdparty/CGAL/include/CGAL/Linear_cell_complex_min_items.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Linear_cell_complex_operations.h b/3rdparty/CGAL/include/CGAL/Linear_cell_complex_operations.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Linear_cell_complex_operations.h
rename to 3rdparty/CGAL/include/CGAL/Linear_cell_complex_operations.h
diff --git a/3rdparty/CGAL/include/CGAL/Linear_cell_complex_storages.h b/3rdparty/CGAL/include/CGAL/Linear_cell_complex_storages.h
new file mode 100644
index 0000000..071ce56
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Linear_cell_complex_storages.h
@@ -0,0 +1,450 @@
+// Copyright (c) 2013 CNRS and LIRIS' Establishments (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Guillaume Damiand <guillaume.damiand at liris.cnrs.fr>
+//
+#ifndef CGAL_LINEAR_CELL_COMPLEX_STORAGES_H
+#define CGAL_LINEAR_CELL_COMPLEX_STORAGES_H 1
+
+#include <CGAL/Combinatorial_map_storages.h>
+
+#include <boost/config.hpp>
+#if  (BOOST_GCC >= 40900)
+_Pragma("GCC diagnostic push")
+_Pragma("GCC diagnostic ignored \"-Warray-bounds\"")
+#endif
+
+namespace CGAL {
+
+  /** @file Linear_cell_complex_storages.h
+   * Definition of storages for dD Linear cell complex.
+   */
+
+  // Storage of darts with compact container, beta with handles
+  // Copy of Combinatorial_map_storage_1 and add new types related
+  // to geometry (not possible to inherith because we use Self type
+  // as template parameter of Dart_wrapper. If we inherit, Self is not
+  // the correct type.)
+  template<unsigned int d_, unsigned int ambient_dim,
+           class Traits_, class Items_, class Alloc_ >
+  class Linear_cell_complex_storage_1
+  {
+  public:
+    typedef typename Traits_::Point  Point;
+    typedef typename Traits_::Vector Vector;
+    typedef typename Traits_::FT     FT;
+
+    typedef Linear_cell_complex_storage_1<d_, ambient_dim, Traits_,
+    Items_, Alloc_> Self;
+    typedef CGAL::Tag_false Use_index;
+
+    typedef internal::Combinatorial_map_helper<Self> Helper;
+
+    typedef typename Items_::template Dart_wrapper<Self>  Dart_wrapper;
+    typedef typename Dart_wrapper::Dart                   Dart;
+    typedef typename Alloc_::template rebind<Dart>::other Dart_allocator;
+
+    typedef Compact_container<Dart,Dart_allocator>  Dart_container;
+
+    typedef typename Dart_container::iterator       Dart_handle;
+    typedef typename Dart_container::const_iterator Dart_const_handle;
+    typedef typename Dart_container::size_type      size_type;
+
+    typedef CGAL::Void* Null_handle_type;
+    static Null_handle_type null_handle;
+
+    typedef Items_ Items;
+    typedef Alloc_ Alloc;
+
+    template <typename T>
+    struct Container_for_attributes :
+        public Compact_container<T, typename Alloc_::template rebind<T>::other>
+    {};
+
+    /// Typedef for attributes
+    typedef typename Dart_wrapper::Attributes Attributes;
+
+    template<int i>
+    struct Attribute_type: public Helper::template Attribute_type<i>
+    {};
+    template<int i>
+    struct Attribute_handle: public Helper::template Attribute_handle<i>
+    {};
+    template<int i>
+    struct Attribute_const_handle:
+        public Helper::template Attribute_const_handle<i>
+    {};
+    template<int i>
+    struct Attribute_range: public Helper::template Attribute_range<i>
+    {};
+    template<int i>
+    struct Attribute_const_range:
+        public Helper::template Attribute_const_range<i>
+    {};
+
+    typedef typename Attribute_type<0>::type Vertex_attribute;
+    typedef typename Attribute_handle<0>::type Vertex_attribute_handle;
+    typedef typename Attribute_const_handle<0>::type
+    Vertex_attribute_const_handle;
+
+    typedef typename Attribute_range<0>::type Vertex_attribute_range;
+    typedef typename Attribute_const_range<0>::type
+    Vertex_attribute_const_range;
+
+    /// Number of marks
+    static const size_type NB_MARKS = 32;
+
+    /// The dimension of the combinatorial map.
+    static const unsigned int dimension = d_;
+
+    typedef Handle_hash_function Hash_function;
+
+    // Init
+    void init_storage()
+    {
+#ifdef CGAL_CMAP_DEPRECATED
+      // We must do this ony once, but problem because null_dart_handle
+      // is static !
+      if ( mnull_dart_container.empty() )
+#endif // CGAL_CMAP_DEPRECATED
+      { // emplace null_dart; initialized in Combinatorial_map class
+        null_dart_handle = mnull_dart_container.emplace();
+      }
+    }
+
+    /** Return if this dart is free for adimension.
+       * @param dh a dart handle
+       * @param i the dimension.
+       * @return true iff dh is linked with NULL for \em adimension.
+       */
+    template<unsigned int i>
+    bool is_free(Dart_const_handle dh) const
+    {
+      CGAL_assertion( dh!=NULL );
+      CGAL_assertion(i <= dimension);
+      return dh->mbeta[i]==null_dart_handle;
+    }
+    bool is_free(Dart_const_handle dh, unsigned int i) const
+    {
+      CGAL_assertion( dh!=NULL );
+      CGAL_assertion(i <= dimension);
+      return dh->mbeta[i]==null_dart_handle;
+    }
+
+    /// Set simultaneously all the marks of this dart to a given value.
+    void set_dart_marks(Dart_const_handle ADart,
+                        const std::bitset<NB_MARKS>& amarks) const
+    {
+      CGAL_assertion( ADart!=NULL );
+      ADart->set_marks(amarks);
+    }
+    /// Return all the marks of a dart.
+    std::bitset<NB_MARKS> get_dart_marks(Dart_const_handle ADart) const
+    {
+      CGAL_assertion( ADart!=NULL );
+      return ADart->get_marks();
+    }
+    /// Return the mark value of dart a given mark number.
+    bool get_dart_mark(Dart_const_handle ADart, size_type amark) const
+    {
+      CGAL_assertion( ADart!=NULL );
+      return ADart->get_mark(amark);
+    }
+
+    /// Set the mark of a given mark number to a given value.
+    void set_dart_mark(Dart_const_handle ADart, size_type amark, bool avalue) const
+    {
+      CGAL_assertion( ADart!=NULL );
+      ADart->set_mark(amark, avalue);
+    }
+
+    /// Flip the mark of a given mark number to a given value.
+    void flip_dart_mark(Dart_const_handle ADart, size_type amark) const
+    {
+      CGAL_assertion( ADart!=NULL );
+      ADart->flip_mark(amark);
+    }
+
+    // Access to beta maps
+    Dart_handle get_beta(Dart_handle ADart, int B1)
+    {
+      CGAL_assertion(ADart!=NULL && B1>=0 && B1<=(int)dimension);
+      return ADart->mbeta[B1];
+    }
+    Dart_const_handle get_beta(Dart_const_handle ADart, int B1) const
+    {
+      CGAL_assertion(ADart!=NULL && B1>=0 && B1<=(int)dimension);
+      return  ADart->mbeta[B1];
+    }
+    template<int B1>
+    Dart_handle get_beta(Dart_handle ADart)
+    {
+      CGAL_assertion(ADart!=NULL && B1>=0 && B1<=(int)dimension);
+      return  ADart->mbeta[B1];
+    }
+    template<int B1>
+    Dart_const_handle get_beta(Dart_const_handle ADart) const
+    {
+      CGAL_assertion(ADart!=NULL && B1>=0 && B1<=(int)dimension);
+      return  ADart->mbeta[B1];
+    }
+
+    // return a handle on the i-attribute
+    template<unsigned int i>
+    typename Attribute_handle<i>::type attribute(Dart_handle ADart)
+    {
+      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
+                       "attribute<i> called but i-attributes are disabled.");
+      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
+          (ADart->mattribute_handles);
+    }
+    template<unsigned int i>
+    typename Attribute_const_handle<i>::type
+    attribute(Dart_const_handle ADart) const
+    {
+      CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
+                       "attribute<i> called but i-attributes are disabled.");
+      return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
+          (ADart->mattribute_handles);
+    }
+
+    // get the attribute given its handle
+    template<unsigned int i>
+    typename Attribute_type<i>::type& get_attribute
+    (typename Attribute_handle<i>::type ah)
+    {
+      CGAL_assertion( ah!=NULL );
+      return *ah;
+    }
+    template<unsigned int i>
+    const typename Attribute_type<i>::type&
+    get_attribute(typename Attribute_const_handle<i>::type ah) const
+    {
+      CGAL_assertion( ah!=NULL );
+      return *ah;
+    }
+
+    Dart & get_dart(Dart_handle ah)
+    {
+      CGAL_assertion( ah!=NULL );
+      return *ah;
+    }
+    const Dart & get_dart(Dart_const_handle ah) const
+    {
+      CGAL_assertion( ah!=NULL );
+      return *ah;
+    }
+
+    // Get the dart of the given attribute
+    template<unsigned int i>
+    Dart_handle dart_of_attribute(typename Attribute_handle<i>::type ah)
+    {
+      CGAL_assertion( ah!=NULL );
+      return ah->dart();
+    }
+    template<unsigned int i>
+    Dart_const_handle dart_of_attribute
+    (typename Attribute_const_handle<i>::type ah) const
+    {
+      CGAL_assertion( ah!=NULL );
+      return ah->dart();
+    }
+
+    // Set the dart of the given attribute
+    template<unsigned int i>
+    void set_dart_of_attribute(typename Attribute_handle<i>::type ah,
+                               Dart_handle adart)
+    {
+      CGAL_assertion( ah!=NULL );
+      ah->set_dart(adart);
+    }
+
+    // Get the info of the given attribute
+    template<unsigned int i>
+    typename Attribute_type<i>::type::Info &
+    info_of_attribute(typename Attribute_handle<i>::type ah)
+    {
+      CGAL_assertion( ah!=NULL );
+      return ah->info();
+    }
+    template<unsigned int i>
+    const typename Attribute_type<i>::type::Info &
+    info_of_attribute(typename Attribute_const_handle<i>::type ah) const
+    {
+      CGAL_assertion( ah!=NULL );
+      return ah->info();
+    }
+
+    // Get the info of the given dart
+    template<unsigned int i>
+    typename Attribute_type<i>::type::Info & info(Dart_handle adart)
+    {
+      CGAL_assertion( adart!=NULL );
+      CGAL_assertion( attribute<i>(adart)!=NULL );
+      return info_of_attribute<i>(attribute<i>(adart));
+    }
+    template<unsigned int i>
+    const typename Attribute_type<i>::type::Info &
+    info(Dart_const_handle adart) const
+    {
+      CGAL_assertion( adart!=NULL );
+      CGAL_assertion( attribute<i>(adart)!=NULL );
+      return info_of_attribute<i>(attribute<i>(adart));
+    }
+
+    // Get the dart of the i-cell attribute associated with the given dart
+    template<unsigned int i>
+    Dart_handle & dart(Dart_handle adart)
+    {
+      CGAL_assertion( adart!=NULL );
+      CGAL_assertion( attribute<i>(adart)!=NULL );
+      return dart_of_attribute<i>(attribute<i>(adart));
+    }
+    template<unsigned int i>
+    Dart_const_handle dart(Dart_const_handle adart) const
+    {
+      CGAL_assertion( adart!=NULL );
+      CGAL_assertion( attribute<i>(adart)!=NULL );
+      return dart_of_attribute<i>(attribute<i>(adart));
+    }
+
+    // Get the dart of the given 0-attribute
+    Point & point_of_vertex_attribute(typename Attribute_handle<0>::type vh)
+    {
+      CGAL_assertion( vh!=NULL );
+      return get_attribute<0>(vh).point();
+    }
+
+    const Point & point_of_vertex_attribute
+    (typename Attribute_const_handle<0>::type vh) const
+    {
+      CGAL_assertion( vh!=NULL );
+      return get_attribute<0>(vh).point();
+    }
+
+    void display_dart(Dart_const_handle ADart) const
+    { std::cout<<&*ADart; }
+
+    template<unsigned int i>
+    void display_attribute(typename Attribute_const_handle<i>::type ah) const
+    { std::cout<<&*ah; }
+
+  protected:
+    // Set the handle on the i th attribute
+    template<unsigned int i>
+    void basic_set_dart_attribute(Dart_handle dh,
+                                  typename Attribute_handle<i>::type ah)
+    {
+      CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
+          (dh->mattribute_handles) = ah;
+    }
+
+    /** Link a dart with a given dart for a given dimension.
+       * @param adart the dart to link.
+       * @param adart2 the dart to link with.
+       * @param i the dimension.
+       */
+    template<unsigned int i>
+    void dart_link_beta(Dart_handle adart, Dart_handle adart2)
+    {
+      CGAL_assertion(i <= dimension);
+      CGAL_assertion(adart!=NULL && adart2!=NULL);
+      CGAL_assertion(adart!=null_dart_handle);
+      adart->mbeta[i] = adart2;
+    }
+    void dart_link_beta(Dart_handle adart, Dart_handle adart2, unsigned int i)
+    {
+      CGAL_assertion(i <= dimension);
+      CGAL_assertion(adart!=NULL && adart2!=NULL);
+      CGAL_assertion(adart!=null_dart_handle);
+      adart->mbeta[i] = adart2;
+    }
+
+    /** Unlink a dart for a given dimension.
+       * @param adart a dart.
+       * @param i the dimension.
+       */
+    template<unsigned int i>
+    void dart_unlink_beta(Dart_handle adart)
+    {
+      CGAL_assertion(adart!=NULL && i <= dimension);
+      adart->mbeta[i] = null_dart_handle;
+    }
+    void dart_unlink_beta(Dart_handle adart, unsigned int i)
+    {
+      CGAL_assertion(adart!=NULL && i <= dimension);
+      adart->mbeta[i] = null_dart_handle;
+    }
+
+  public:
+    /// Void dart. A dart d is i-free if beta_i(d)=null_dart_handle.
+#ifdef CGAL_CMAP_DEPRECATED
+    static
+#endif // CGAL_CMAP_DEPRECATED
+    Dart_handle null_dart_handle; // Todo Dart_const_handle ??
+
+  protected:
+    /// Dart container.
+    Dart_container mdarts;
+
+    /// Container for the null_dart_handle, static data member.
+#ifdef CGAL_CMAP_DEPRECATED
+    static
+#endif // CGAL_CMAP_DEPRECATED
+    Dart_container mnull_dart_container;
+
+    /// Tuple of attributes containers
+    typename Helper::Attribute_containers mattribute_containers;
+  };
+
+  /// null_handle
+  template <unsigned int d_, unsigned int ambient_dim,
+           class Traits_, class Items_, class Alloc_ >
+  typename Linear_cell_complex_storage_1<d_, ambient_dim, Traits_,
+                                         Items_, Alloc_>::Null_handle_type
+  Linear_cell_complex_storage_1<d_, ambient_dim, Traits_,
+                                Items_, Alloc_>::null_handle = NULL;
+
+#ifdef CGAL_CMAP_DEPRECATED
+  /// Allocation of static data members
+  /// mnull_dart_container
+  template <unsigned int d_, unsigned int ambient_dim,
+           class Traits_, class Items_, class Alloc_ >
+  typename Linear_cell_complex_storage_1<d_, ambient_dim, Traits_,
+                                         Items_, Alloc_>::Dart_container
+  Linear_cell_complex_storage_1<d_, ambient_dim, Traits_,
+                                         Items_, Alloc_>::mnull_dart_container;
+
+  /// null_dart_handle
+  template <unsigned int d_, unsigned int ambient_dim,
+           class Traits_, class Items_, class Alloc_ >
+  typename Linear_cell_complex_storage_1<d_, ambient_dim, Traits_,
+                                         Items_, Alloc_>::Dart_handle
+  Linear_cell_complex_storage_1<d_, ambient_dim, Traits_,
+                                         Items_, Alloc_>::null_dart_handle;
+  // =  mnull_dart_container.emplace( std::bitset<NB_MARKS>() );
+  // Does not work on windows => segfault
+  // Thus we initialize null_dart_handle in the Combinatorial_map constructor
+#endif // CGAL_CMAP_DEPRECATED
+
+} // namespace CGAL
+
+#if  (BOOST_GCC >= 40900)
+ _Pragma("GCC diagnostic pop")
+#endif
+#endif // CGAL_LINEAR_CELL_COMPLEX_STORAGES_H //
+// EOF //
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Linear_cell_complex_traits.h b/3rdparty/CGAL/include/CGAL/Linear_cell_complex_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Linear_cell_complex_traits.h
rename to 3rdparty/CGAL/include/CGAL/Linear_cell_complex_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Location_policy.h b/3rdparty/CGAL/include/CGAL/Location_policy.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Location_policy.h
rename to 3rdparty/CGAL/include/CGAL/Location_policy.h
diff --git a/3rdparty/CGAL/include/CGAL/MP_Float.h b/3rdparty/CGAL/include/CGAL/MP_Float.h
new file mode 100644
index 0000000..0b55d55
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/MP_Float.h
@@ -0,0 +1,913 @@
+// Copyright (c) 2001-2007  INRIA Sophia-Antipolis (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(s)     : Sylvain Pion
+
+#ifndef CGAL_MP_FLOAT_H
+#define CGAL_MP_FLOAT_H
+
+#include <CGAL/number_type_basic.h>
+#include <CGAL/Algebraic_structure_traits.h>
+#include <CGAL/Real_embeddable_traits.h>
+#include <CGAL/Coercion_traits.h>
+#include <CGAL/Quotient.h>
+#include <CGAL/Sqrt_extension.h>
+
+#include <CGAL/utils.h>
+
+#include <CGAL/Interval_nt.h>
+#include <iostream>
+#include <vector>
+#include <algorithm>
+
+// MP_Float : multiprecision scaled integers.
+
+// Some invariants on the internal representation :
+// - zero is represented by an empty vector, and whatever exp.
+// - no leading or trailing zero in the vector => unique
+
+// The main algorithms are :
+// - Addition/Subtraction
+// - Multiplication
+// - Integral division div(), gcd(), operator%().
+// - Comparison
+// - to_double() / to_interval()
+// - Construction from a double.
+// - IOs
+
+// TODO :
+// - The exponent really overflows sometimes -> make it multiprecision.
+// - Write a generic wrapper that adds an exponent to be used by MP integers.
+// - Karatsuba (or other) ?  Would be fun to implement at least.
+// - Division, sqrt... : different options :
+//   - nothing
+//   - convert to double, take approximation, compute over double, reconstruct
+
+namespace CGAL {
+
+class MP_Float;
+
+template < typename > class Quotient; // Needed for overloaded To_double
+
+namespace INTERN_MP_FLOAT {
+
+Comparison_result compare(const MP_Float&, const MP_Float&);
+
+MP_Float square(const MP_Float&);
+
+// to_double() returns, not the closest double, but a one bit error is allowed.
+// We guarantee : to_double(MP_Float(double d)) == d.
+
+double to_double(const MP_Float&);
+
+double to_double(const Quotient<MP_Float>&);
+
+std::pair<double,double> to_interval(const MP_Float &);
+
+std::pair<double,double> to_interval(const Quotient<MP_Float>&);
+
+MP_Float div(const MP_Float& n1, const MP_Float& n2);
+
+MP_Float gcd(const MP_Float& a, const MP_Float& b);
+  
+} //namespace INTERN_MP_FLOAT
+
+std::pair<double, int>
+to_double_exp(const MP_Float &b);
+
+// Returns (first * 2^second), an interval surrounding b.
+std::pair<std::pair<double, double>, int>
+to_interval_exp(const MP_Float &b);
+
+std::ostream &
+operator<< (std::ostream & os, const MP_Float &b);
+
+// This one is for debug.
+std::ostream &
+print (std::ostream & os, const MP_Float &b);
+
+std::istream &
+operator>> (std::istream & is, MP_Float &b);
+
+MP_Float operator+(const MP_Float &a, const MP_Float &b);
+
+MP_Float operator-(const MP_Float &a, const MP_Float &b);
+
+MP_Float operator*(const MP_Float &a, const MP_Float &b);
+
+MP_Float operator%(const MP_Float &a, const MP_Float &b);
+
+
+class MP_Float
+{
+public:
+  typedef short          limb;
+  typedef unsigned short unsigned_limb;
+  typedef int            limb2;
+  typedef double         exponent_type;
+
+  typedef std::vector<limb>  V;
+  typedef V::const_iterator  const_iterator;
+  typedef V::iterator        iterator;
+
+private:
+
+  void remove_leading_zeros()
+  {
+    while (!v.empty() && v.back() == 0)
+      v.pop_back();
+  }
+
+  void remove_trailing_zeros()
+  {
+    if (v.empty() || v.front() != 0)
+      return;
+
+    iterator i = v.begin();
+    for (++i; *i == 0; ++i)
+      ;
+    exp += static_cast<exponent_type>(i-v.begin());
+    v.erase(v.begin(), i);
+  }
+
+  // The constructors from float/double/long_double are factorized in the
+  // following template :
+  template < typename T >
+  void construct_from_builtin_fp_type(T d);
+
+public:
+#ifdef CGAL_ROOT_OF_2_ENABLE_HISTOGRAM_OF_NUMBER_OF_DIGIT_ON_THE_COMPLEX_CONSTRUCTOR
+    int tam() const { return v.size(); }
+#endif
+
+  // Splits a limb2 into 2 limbs (high and low).
+  static
+  void split(limb2 l, limb & high, limb & low)
+  {
+    const unsigned int sizeof_limb=8*sizeof(limb);
+    const limb2 mask = 0x0000ffff;
+   
+    //Note: For Integer type, if the destination type is signed, the value is unchanged 
+    //if it can be represented in the destination type)
+    low = static_cast<limb>(l & mask); //extract low bits from l
+    high= static_cast<limb>((l - low) >> sizeof_limb); //extract high bits from l
+    
+    CGAL_postcondition ( l == low + ( static_cast<limb2>(high) << sizeof_limb ) );
+  }
+
+  // Given a limb2, returns the higher limb.
+  static
+  limb higher_limb(limb2 l)
+  {
+      limb high, low;
+      split(l, high, low);
+      return high;
+  }
+
+  void canonicalize()
+  {
+    remove_leading_zeros();
+    remove_trailing_zeros();
+  }
+
+  MP_Float()
+      : exp(0)
+  {
+    CGAL_assertion(sizeof(limb2)==4); // so that the above 0x0000ffff is correct
+    CGAL_assertion(sizeof(limb2) == 2*sizeof(limb));
+    CGAL_assertion(v.empty());
+    // Creates zero.
+  }
+
+#if 0
+  // Causes ambiguities
+  MP_Float(limb i)
+  : v(1,i), exp(0)
+  {
+    remove_leading_zeros();
+  }
+#endif
+
+  MP_Float(limb2 i)
+  : v(2), exp(0)
+  {
+    split(i, v[1], v[0]);
+    canonicalize();
+  }
+
+  MP_Float(float d);
+
+  MP_Float(double d);
+
+  MP_Float(long double d);
+
+  MP_Float operator+() const {
+    return *this;
+  }
+
+  MP_Float operator-() const
+  {
+    return MP_Float() - *this;
+  }
+
+  MP_Float& operator+=(const MP_Float &a) { return *this = *this + a; }
+  MP_Float& operator-=(const MP_Float &a) { return *this = *this - a; }
+  MP_Float& operator*=(const MP_Float &a) { return *this = *this * a; }
+  MP_Float& operator%=(const MP_Float &a) { return *this = *this % a; }
+
+  exponent_type max_exp() const
+  {
+    return exponent_type(v.size()) + exp;
+  }
+
+  exponent_type min_exp() const
+  {
+    return exp;
+  }
+
+  limb of_exp(exponent_type i) const
+  {
+    if (i < exp || i >= max_exp())
+      return 0;
+    return v[static_cast<int>(i-exp)];
+  }
+
+  bool is_zero() const
+  {
+    return v.empty();
+  }
+
+  Sign sign() const
+  {
+    if (v.empty())
+      return ZERO;
+    if (v.back()>0)
+      return POSITIVE;
+    CGAL_assertion(v.back()<0);
+    return NEGATIVE;
+  }
+
+  void clear()
+  {
+    v.clear();
+    exp = 0;
+  }
+
+  void swap(MP_Float &m)
+  {
+    std::swap(v, m.v);
+    std::swap(exp, m.exp);
+  }
+
+  // Converts to a rational type (e.g. Gmpq).
+  template < typename T >
+  T to_rational() const
+  {
+    const unsigned log_limb = 8 * sizeof(MP_Float::limb);
+
+    if (is_zero())
+      return 0;
+
+    MP_Float::const_iterator i;
+    exponent_type exp2 = min_exp() * log_limb;
+    T res = 0;
+
+    for (i = v.begin(); i != v.end(); ++i)
+    {
+      res += T(std::ldexp(static_cast<double>(*i),static_cast<int>(exp2)));
+      exp2 += log_limb;
+    }
+
+    return res;
+  }
+
+  std::size_t size() const
+  {
+    return v.size();
+  }
+
+  // Returns a scaling factor (in limbs) which would be good to extract to get
+  // a value with an exponent close to 0.
+  exponent_type find_scale() const
+  {
+    return exp + exponent_type(v.size());
+  }
+
+  // Rescale the value by some factor (in limbs).  (substract the exponent)
+  void rescale(exponent_type scale)
+  {
+    if (v.size() != 0)
+      exp -= scale;
+  }
+
+  // Accessory function that finds the least significant bit set (its position).
+  static unsigned short 
+  lsb(limb l)
+  {
+    unsigned short nb = 0;
+    for (; (l&1)==0; ++nb, l=(limb)(l>>1) )
+      ;
+    return nb;
+  }
+
+  // This one is needed for normalizing gcd so that the mantissa is odd
+  // and non-negative, and the exponent is 0.
+  void gcd_normalize()
+  {
+    const unsigned log_limb = 8 * sizeof(MP_Float::limb);
+    if (is_zero())
+      return;
+    // First find how many least significant bits are 0 in the last digit.
+    unsigned short nb = lsb(v[0]);
+    if (nb != 0)
+      *this = *this * (1<<(log_limb-nb));
+    CGAL_assertion((v[0]&1) != 0);
+    exp=0;
+    if (sign() == NEGATIVE)
+      *this = - *this;
+  }
+
+  MP_Float unit_part() const
+  {
+    if (is_zero())
+      return 1;
+    MP_Float r = (sign() > 0) ? *this : - *this;
+    CGAL_assertion(r.v.begin() != r.v.end());
+    unsigned short nb = lsb(r.v[0]);
+    r.v.clear();
+    r.v.push_back((limb)(1<<nb));
+    return (sign() > 0) ? r : -r;
+  }
+
+  bool is_integer() const
+  {
+    return is_zero() || (exp >= 0);
+  }
+
+  V v;
+  exponent_type exp;
+};
+
+namespace internal{
+std::pair<MP_Float, MP_Float> // <quotient, remainder>
+division(const MP_Float & n, const MP_Float & d);
+} // namespace internal
+
+inline
+void swap(MP_Float &m, MP_Float &n)
+{ m.swap(n); }
+
+inline
+bool operator<(const MP_Float &a, const MP_Float &b)
+{ return INTERN_MP_FLOAT::compare(a, b) == SMALLER; }
+
+inline
+bool operator>(const MP_Float &a, const MP_Float &b)
+{ return b < a; }
+
+inline
+bool operator>=(const MP_Float &a, const MP_Float &b)
+{ return ! (a < b); }
+
+inline
+bool operator<=(const MP_Float &a, const MP_Float &b)
+{ return ! (a > b); }
+
+inline
+bool operator==(const MP_Float &a, const MP_Float &b)
+{ return (a.v == b.v) && (a.v.empty() || (a.exp == b.exp)); }
+
+inline
+bool operator!=(const MP_Float &a, const MP_Float &b)
+{ return ! (a == b); }
+
+MP_Float
+approximate_sqrt(const MP_Float &d);
+
+MP_Float
+approximate_division(const MP_Float &n, const MP_Float &d);
+
+
+
+// Algebraic structure traits specialization
+template <> class Algebraic_structure_traits< MP_Float >
+  : public Algebraic_structure_traits_base< MP_Float,
+                                            Unique_factorization_domain_tag
+	    // with some work on mod/div it could be Euclidean_ring_tag
+                                          >  {
+  public:
+
+    typedef Tag_true            Is_exact;
+    typedef Tag_true            Is_numerical_sensitive;
+
+    struct Unit_part
+      : public std::unary_function< Type , Type >
+    {
+      Type operator()(const Type &x) const {
+        return x.unit_part();
+      }
+    };
+
+    struct Integral_division
+        : public std::binary_function< Type,
+                                 Type,
+                                 Type > {
+    public:
+        Type operator()(
+                const Type& x,
+                const Type& y ) const {
+            std::pair<MP_Float, MP_Float> res = internal::division(x, y);
+            CGAL_assertion_msg(res.second == 0,
+                "exact_division() called with operands which do not divide");
+            return res.first;
+        }
+    };
+
+
+    class Square
+      : public std::unary_function< Type, Type > {
+      public:
+        Type operator()( const Type& x ) const {
+          return INTERN_MP_FLOAT::square(x);
+        }
+    };
+
+    class Gcd
+      : public std::binary_function< Type, Type,
+                                Type > {
+      public:
+        Type operator()( const Type& x,
+                                        const Type& y ) const {
+          return INTERN_MP_FLOAT::gcd( x, y );
+        }
+    };
+
+    class Div
+      : public std::binary_function< Type, Type,
+                                Type > {
+      public:
+        Type operator()( const Type& x,
+                                        const Type& y ) const {
+          return INTERN_MP_FLOAT::div( x, y );
+        }
+    };
+
+  typedef INTERN_AST::Mod_per_operator< Type > Mod;
+// Default implementation of Divides functor for unique factorization domains
+  // x divides y if gcd(y,x) equals x up to inverses 
+  class Divides 
+    : public std::binary_function<Type,Type,bool>{ 
+  public:
+    bool operator()( const Type& x,  const Type& y) const {  
+      return internal::division(y,x).second == 0 ;
+    }
+    // second operator computing q = x/y 
+    bool operator()( const Type& x,  const Type& y, Type& q) const {    
+      std::pair<Type,Type> qr = internal::division(y,x);
+      q=qr.first;
+      return qr.second == 0;
+      
+    }
+    CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT( Type , bool)
+  };
+};
+
+// Real embeddable traits
+template <> class Real_embeddable_traits< MP_Float >
+  : public INTERN_RET::Real_embeddable_traits_base< MP_Float , CGAL::Tag_true > {
+  public:
+
+    class Sgn
+      : public std::unary_function< Type, ::CGAL::Sign > {
+      public:
+        ::CGAL::Sign operator()( const Type& x ) const {
+          return x.sign();
+        }
+    };
+
+    class Compare
+      : public std::binary_function< Type, Type,
+                                Comparison_result > {
+      public:
+        Comparison_result operator()( const Type& x,
+                                            const Type& y ) const {
+          return INTERN_MP_FLOAT::compare( x, y );
+        }
+    };
+
+    class To_double
+      : public std::unary_function< Type, double > {
+      public:
+        double operator()( const Type& x ) const {
+          return INTERN_MP_FLOAT::to_double( x );
+        }
+    };
+
+    class To_interval
+      : public std::unary_function< Type, std::pair< double, double > > {
+      public:
+        std::pair<double, double> operator()( const Type& x ) const {
+          return INTERN_MP_FLOAT::to_interval( x );
+        }
+    };
+};
+
+
+
+namespace INTERN_MP_FLOAT{
+
+//Sqrt_extension internally uses Algebraic_structure_traits
+template <class ACDE_TAG_, class FP_TAG>  
+double
+to_double(const Sqrt_extension<MP_Float,MP_Float,ACDE_TAG_,FP_TAG> &x)
+{
+  typedef MP_Float RT;
+  typedef Quotient<RT> FT;
+  typedef CGAL::Rational_traits< FT > Rational;
+  Rational r;
+  const RT r1 = r.numerator(x.a0());
+  const RT d1 = r.denominator(x.a0());
+
+  if(x.is_rational()) {
+    std::pair<double, int> n = to_double_exp(r1);
+    std::pair<double, int> d = to_double_exp(d1);
+    double scale = std::ldexp(1.0, n.second - d.second);
+    return (n.first / d.first) * scale;
+  }
+
+  const RT r2 = r.numerator(x.a1());
+  const RT d2 = r.denominator(x.a1());
+  const RT r3 = r.numerator(x.root());
+  const RT d3 = r.denominator(x.root());
+
+  std::pair<double, int> n1 = to_double_exp(r1);
+  std::pair<double, int> v1 = to_double_exp(d1);
+  double scale1 = std::ldexp(1.0, n1.second - v1.second);
+
+  std::pair<double, int> n2 = to_double_exp(r2);
+  std::pair<double, int> v2 = to_double_exp(d2);
+  double scale2 = std::ldexp(1.0, n2.second - v2.second);
+
+  std::pair<double, int> n3 = to_double_exp(r3);
+  std::pair<double, int> v3 = to_double_exp(d3);
+  double scale3 = std::ldexp(1.0, n3.second - v3.second);
+
+  return ((n1.first / v1.first) * scale1) + 
+         ((n2.first / v2.first) * scale2) *
+         std::sqrt((n3.first / v3.first) * scale3);
+}
+
+} //namespace INTERN_MP_FLOAT
+
+
+namespace internal {
+// This compares the absolute values of the odd-mantissa.
+// (take the mantissas, get rid of all powers of 2, compare
+// the absolute values)
+inline
+Sign
+compare_bitlength(const MP_Float &a, const MP_Float &b)
+{
+  if (a.is_zero())
+    return b.is_zero() ? EQUAL : SMALLER;
+  if (b.is_zero())
+    return LARGER;
+
+  //Real_embeddable_traits<MP_Float>::Abs abs;
+
+  MP_Float aa = CGAL_NTS abs(a);
+  MP_Float bb = CGAL_NTS abs(b);
+
+  if (aa.size() > (bb.size() + 2)) return LARGER;
+  if (bb.size() > (aa.size() + 2)) return SMALLER;
+
+  // multiply by 2 till last bit is 1.
+  while (((aa.v[0]) & 1) == 0) // last bit is zero
+    aa = aa + aa;
+
+  while (((bb.v[0]) & 1) == 0) // last bit is zero
+    bb = bb + bb;
+
+  // sizes might have changed
+  if (aa.size() > bb.size()) return LARGER;
+  if (aa.size() < bb.size()) return SMALLER;
+
+  for (std::size_t i = aa.size(); i > 0; --i)
+  {
+    if (aa.v[i-1] > bb.v[i-1]) return LARGER;
+    if (aa.v[i-1] < bb.v[i-1]) return SMALLER;
+  }
+  return EQUAL;
+}
+
+inline // Move it to libCGAL once it's stable.
+std::pair<MP_Float, MP_Float> // <quotient, remainder>
+division(const MP_Float & n, const MP_Float & d)
+{
+  typedef MP_Float::exponent_type  exponent_type;
+
+  MP_Float remainder = n, divisor = d;
+
+  CGAL_precondition(divisor != 0);
+
+  // Rescale d to have a to_double() value with reasonnable exponent.
+  exponent_type scale_d = divisor.find_scale();
+  divisor.rescale(scale_d);
+  const double dd = INTERN_MP_FLOAT::to_double(divisor);
+
+  MP_Float res = 0;
+  exponent_type scale_remainder = 0;
+
+  bool first_time_smaller_than_divisor = true;
+
+  // School division algorithm.
+
+  while ( remainder != 0 )
+  {
+    // We have to rescale, since remainder can diminish towards 0.
+    exponent_type tmp_scale = remainder.find_scale();
+    remainder.rescale(tmp_scale);
+    res.rescale(tmp_scale);
+    scale_remainder += tmp_scale;
+
+    // Compute a double approximation of the quotient
+    // (imagine school division with base ~2^53).
+    double approx = INTERN_MP_FLOAT::to_double(remainder) / dd;
+    CGAL_assertion(approx != 0);
+    res += approx;
+    remainder -= approx * divisor;
+
+    if (remainder == 0)
+      break;
+
+    // Then we need to fix it up by checking if neighboring double values
+    // are closer to the exact result.
+    // There should not be too many iterations, because approx is only a few ulps
+    // away from the optimal.
+    // If we don't do the fixup, then spurious bits can be introduced, which
+    // will require an unbounded amount of additional iterations to be eliminated.
+
+    // The direction towards which we need to try to move from "approx".
+    double direction = (CGAL_NTS sign(remainder) == CGAL_NTS sign(dd))
+                     ?  std::numeric_limits<double>::infinity()
+                     : -std::numeric_limits<double>::infinity();
+
+    while (true)
+    {
+      const double approx2 = nextafter(approx, direction);
+      const double delta = approx2 - approx;
+      MP_Float new_remainder = remainder - delta * divisor;
+      if (CGAL_NTS abs(new_remainder) < CGAL_NTS abs(remainder)) {
+        remainder = new_remainder;
+        res += delta;
+        approx = approx2;
+      }
+      else {
+        break;
+      }
+    }
+
+    if (remainder == 0)
+      break;
+
+    // Test condition for non-exact division (with remainder).
+    if (compare_bitlength(remainder, divisor) == SMALLER)
+    {
+      if (! first_time_smaller_than_divisor)
+      {
+        // Scale back.
+        res.rescale(scale_d - scale_remainder);
+        remainder.rescale(- scale_remainder);
+        CGAL_postcondition(res * d  + remainder == n);
+        return std::make_pair(res, remainder);
+      }
+      first_time_smaller_than_divisor = false;
+    }
+  }
+
+  // Scale back the result.
+  res.rescale(scale_d - scale_remainder);
+  CGAL_postcondition(res * d == n);
+  return std::make_pair(res, MP_Float(0));
+}
+
+inline // Move it to libCGAL once it's stable.
+bool
+divides(const MP_Float & d, const MP_Float & n)
+{
+  return internal::division(n, d).second == 0;
+}
+
+} // namespace internal
+
+inline
+bool
+is_integer(const MP_Float &m)
+{
+  return m.is_integer();
+}
+
+
+
+inline
+MP_Float
+operator%(const MP_Float& n1, const MP_Float& n2)
+{
+  return internal::division(n1, n2).second;
+}
+
+
+// The namespace INTERN_MP_FLOAT contains global functions like square or sqrt
+// which collide with the global functor adapting functions provided by the new
+// AST/RET concept.
+//
+// TODO: IMHO, a better solution would be to put the INTERN_MP_FLOAT-functions
+//       into the MP_Float-class... But there is surely a reason why this is not
+//       the case..?
+
+
+namespace INTERN_MP_FLOAT {
+  inline
+  MP_Float
+  div(const MP_Float& n1, const MP_Float& n2)
+  {
+    return internal::division(n1, n2).first;
+  }
+
+  inline
+  MP_Float
+  gcd( const MP_Float& a, const MP_Float& b)
+  {
+    if (a == 0) {
+      if (b == 0)
+        return 0;
+      MP_Float tmp=b;
+      tmp.gcd_normalize();
+      return tmp;
+    }
+    if (b == 0) {
+      MP_Float tmp=a;
+      tmp.gcd_normalize();
+      return tmp;
+    }
+
+    MP_Float x = a, y = b;
+    while (true) {
+      x = x % y;
+      if (x == 0) {
+        CGAL_postcondition(internal::divides(y, a) & internal::divides(y, b));
+        y.gcd_normalize();
+        return y;
+      }
+      swap(x, y);
+    }
+  }
+
+} // INTERN_MP_FLOAT
+
+
+inline
+void
+simplify_quotient(MP_Float & numerator, MP_Float & denominator)
+{
+  // Currently only simplifies the two exponents.
+#if 0
+  // This better version causes problems as the I/O is changed for
+  // Quotient<MP_Float>, which then does not appear as rational 123/345,
+  // 1.23/3.45, this causes problems in the T2 test-suite (to be investigated).
+  numerator.exp -= denominator.exp
+                    + (MP_Float::exponent_type) denominator.v.size();
+  denominator.exp = - (MP_Float::exponent_type) denominator.v.size();
+#elif 1
+  numerator.exp -= denominator.exp;
+  denominator.exp = 0;
+#else
+  if (numerator != 0 && denominator != 0) {
+    numerator.exp -= denominator.exp;
+    denominator.exp = 0;
+    const MP_Float g = gcd(numerator, denominator);
+    numerator = integral_division(numerator, g);
+    denominator = integral_division(denominator, g);
+  }
+  numerator.exp -= denominator.exp;
+  denominator.exp = 0;
+#endif
+}
+
+inline void simplify_root_of_2(MP_Float &/*a*/, MP_Float &/*b*/, MP_Float&/*c*/) {
+#if 0
+  if(is_zero(a)) {
+  	simplify_quotient(b,c); return;
+  } else if(is_zero(b)) {
+  	simplify_quotient(a,c); return;
+  } else if(is_zero(c)) {
+  	simplify_quotient(a,b); return;
+  }
+  MP_Float::exponent_type va = a.exp +
+    (MP_Float::exponent_type) a.v.size();
+  MP_Float::exponent_type vb = b.exp +
+    (MP_Float::exponent_type) b.v.size();
+  MP_Float::exponent_type vc = c.exp +
+    (MP_Float::exponent_type) c.v.size();
+  MP_Float::exponent_type min = (std::min)((std::min)(va,vb),vc);
+  MP_Float::exponent_type max = (std::max)((std::max)(va,vb),vc);
+  MP_Float::exponent_type med = (min+max)/2.0;
+  a.exp -= med;
+  b.exp -= med;
+  c.exp -= med;
+#endif
+}
+
+namespace internal {
+  inline void simplify_3_exp(int &a, int &b, int &c) {
+    int min = (std::min)((std::min)(a,b),c);
+    int max = (std::max)((std::max)(a,b),c);
+    int med = (min+max)/2;
+    a -= med;
+    b -= med;
+    c -= med;
+  }
+}
+
+
+// specialization of to double functor
+template<>
+class Real_embeddable_traits< Quotient<MP_Float> >
+    : public INTERN_QUOTIENT::Real_embeddable_traits_quotient_base<
+Quotient<MP_Float> >{
+public:
+    struct To_double: public std::unary_function<Quotient<MP_Float>, double>{
+         inline
+         double operator()(const Quotient<MP_Float>& q) const {
+            return INTERN_MP_FLOAT::to_double(q);
+        }
+    };
+    struct To_interval
+        : public std::unary_function<Quotient<MP_Float>, std::pair<double,double> > {
+        inline
+        std::pair<double,double> operator()(const Quotient<MP_Float>& q) const {
+            return INTERN_MP_FLOAT::to_interval(q);
+        }
+    };
+};
+
+inline MP_Float min BOOST_PREVENT_MACRO_SUBSTITUTION(const MP_Float& x,const MP_Float& y){
+  return (x<=y)?x:y; 
+}
+inline MP_Float max BOOST_PREVENT_MACRO_SUBSTITUTION(const MP_Float& x,const MP_Float& y){
+  return (x>=y)?x:y; 
+}
+
+
+// Coercion_traits
+CGAL_DEFINE_COERCION_TRAITS_FOR_SELF(MP_Float)
+CGAL_DEFINE_COERCION_TRAITS_FROM_TO(int, MP_Float)
+
+
+} //namespace CGAL
+
+namespace Eigen {
+  template<class> struct NumTraits;
+  template<> struct NumTraits<CGAL::MP_Float>
+  {
+    typedef CGAL::MP_Float Real;
+    typedef CGAL::Quotient<CGAL::MP_Float> NonInteger;
+    typedef CGAL::MP_Float Nested;
+    typedef CGAL::MP_Float Literal;
+
+    static inline Real epsilon() { return 0; }
+    static inline Real dummy_precision() { return 0; }
+
+    enum {
+      IsInteger = 1, // Is this lie right?
+      IsSigned = 1,
+      IsComplex = 0,
+      RequireInitialization = 1,
+      ReadCost = 6,
+      AddCost = 40,
+      MulCost = 40
+    };
+  };
+}
+
+#include <CGAL/MP_Float_impl.h>
+
+//specialization for Get_arithmetic_kernel
+#include <CGAL/MP_Float_arithmetic_kernel.h>
+
+#endif // CGAL_MP_FLOAT_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/MP_Float_arithmetic_kernel.h b/3rdparty/CGAL/include/CGAL/MP_Float_arithmetic_kernel.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/MP_Float_arithmetic_kernel.h
rename to 3rdparty/CGAL/include/CGAL/MP_Float_arithmetic_kernel.h
diff --git a/3rdparty/CGAL/include/CGAL/MP_Float_impl.h b/3rdparty/CGAL/include/CGAL/MP_Float_impl.h
new file mode 100644
index 0000000..e47abdd
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/MP_Float_impl.h
@@ -0,0 +1,512 @@
+
+// Copyright (c) 2001-2006  INRIA Sophia-Antipolis (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(s)     : Sylvain Pion
+
+#ifndef CGAL_MP_FLOAT_IMPL_H
+#define CGAL_MP_FLOAT_IMPL_H
+
+#include <CGAL/basic.h>
+#include <CGAL/Quotient.h>
+#include <functional>
+#include <cmath>
+#include <CGAL/MP_Float.h>
+
+namespace CGAL {
+
+namespace INTERN_MP_FLOAT {
+const unsigned        log_limb         = 8 * sizeof(MP_Float::limb);
+const MP_Float::limb2 base             = 1 << log_limb;
+const MP_Float::V::size_type limbs_per_double = 2 + 53/log_limb;
+
+const double trunc_max = double(base)*(base/2-1)/double(base-1);
+const double trunc_min = double(-base)*(base/2)/double(base-1);
+} // namespace INTERN_MP_FLOAT
+
+// We face portability issues with the ISO C99 functions "nearbyint",
+// so I re-implement it for my need.
+template < typename T >
+inline 
+int my_nearbyint(const T& d)
+{
+  int z = int(d);
+  T frac = d - T(z);
+
+  CGAL_assertion(CGAL::abs(frac) < T(1.0));
+
+  if (frac > 0.5)
+    ++z;
+  else if (frac < -0.5)
+    --z;
+  else if (frac == 0.5 && (z&1) != 0) // NB: We also need the round-to-even rule.
+    ++z;
+  else if (frac == -0.5 && (z&1) != 0)
+    --z;
+
+  CGAL_assertion(CGAL::abs(T(z) - d) < T(0.5) ||
+                 (CGAL::abs(T(z) - d) == T(0.5) && ((z&1) == 0)));
+  return z;
+}
+
+
+template < typename T >
+inline
+void MP_Float::construct_from_builtin_fp_type(T d)
+{
+    if (d == 0)
+      return;
+
+    // Protection against rounding mode != nearest, and extended precision.
+    Set_ieee_double_precision P;
+
+    CGAL_assertion(is_finite(d));
+
+    // This is subtle, because ints are not symetric against 0.
+
+    // First, scale d, and adjust exp accordingly.
+    while (d <  INTERN_MP_FLOAT::trunc_min || d >  INTERN_MP_FLOAT::trunc_max) {
+      ++exp;
+      d /=  INTERN_MP_FLOAT::base;
+    }
+
+    while (d >=  INTERN_MP_FLOAT::trunc_min/ INTERN_MP_FLOAT::base && d <=  INTERN_MP_FLOAT::trunc_max/ INTERN_MP_FLOAT::base) {
+      --exp;
+      d *=  INTERN_MP_FLOAT::base;
+    }
+
+    // Then, compute the limbs.
+    // Put them in v (in reverse order temporarily).
+    T orig = d, sum = 0;
+    while (true) {
+      int r = my_nearbyint(d);
+      if (d-double(r) >= T( INTERN_MP_FLOAT::base/2-1)/( INTERN_MP_FLOAT::base-1))
+        ++r;
+      v.push_back(limb(r));
+      // We used to do simply "d -= v.back();", but when the most significant
+      // limb is 1 and the second is -32768, then it can happen that
+      // |d - v.back()| > |d|, hence a bit of precision can be lost.
+      //  Hence the need for sum/orig.
+      sum += v.back();
+      d = orig-sum;
+      if (d == 0)
+        break;
+      sum *=  INTERN_MP_FLOAT::base;
+      orig *=  INTERN_MP_FLOAT::base;
+      d *=  INTERN_MP_FLOAT::base;
+      --exp;
+    }
+
+    // Reverse v.
+    std::reverse(v.begin(), v.end());
+
+    CGAL_assertion(v.back() != 0);
+}
+
+inline
+MP_Float::MP_Float(float d):exp(0)
+{
+    construct_from_builtin_fp_type(d);
+    CGAL_expensive_assertion(CGAL::to_double(*this) == d);
+}
+
+inline
+MP_Float::MP_Float(double d):exp(0)
+{
+    construct_from_builtin_fp_type(d);
+    CGAL_expensive_assertion(CGAL::to_double(*this) == d);
+}
+
+inline
+MP_Float::MP_Float(long double d):exp(0)
+{
+    construct_from_builtin_fp_type(d);
+    // CGAL_expensive_assertion(CGAL::to_double(*this) == d);
+}
+
+inline
+Comparison_result
+INTERN_MP_FLOAT::compare (const MP_Float & a, const MP_Float & b)
+{
+  typedef MP_Float::exponent_type       exponent_type;
+  if (a.is_zero())
+    return (Comparison_result) - b.sign();
+  if (b.is_zero())
+    return (Comparison_result) a.sign();
+
+  for (exponent_type i = (std::max)(a.max_exp(), b.max_exp()) - 1;
+                    i >= (std::min)(a.min_exp(), b.min_exp()); i--)
+  {
+    if (a.of_exp(i) > b.of_exp(i))
+      return LARGER;
+    if (a.of_exp(i) < b.of_exp(i))
+      return SMALLER;
+  }
+  return EQUAL;
+}
+
+// Common code for operator+ and operator-.
+template <class BinOp>
+inline
+MP_Float
+Add_Sub(const MP_Float &a, const MP_Float &b, const BinOp &op)
+{
+  typedef MP_Float::exponent_type       exponent_type;
+  CGAL_assertion(!b.is_zero());
+
+  exponent_type min_exp, max_exp;
+
+  if (a.is_zero()) {
+    min_exp = b.min_exp();
+    max_exp = b.max_exp();
+  }
+  else {
+    min_exp = (std::min)(a.min_exp(), b.min_exp());
+    max_exp = (std::max)(a.max_exp(), b.max_exp());
+  }
+
+  MP_Float r;
+  r.exp = min_exp;
+  r.v.resize(static_cast<int>(max_exp - min_exp + 1)); // One more for carry.
+  r.v[0] = 0;
+  for(int i = 0; i < max_exp - min_exp; i++)
+  {
+    MP_Float::limb2 tmp = r.v[i] + op(a.of_exp(i+min_exp),
+                                      b.of_exp(i+min_exp));
+    MP_Float::split(tmp, r.v[i+1], r.v[i]);
+  }
+  r.canonicalize();
+  return r;
+}
+
+inline
+MP_Float
+operator+(const MP_Float &a, const MP_Float &b)
+{
+  if (a.is_zero())
+    return b;
+  if (b.is_zero())
+    return a;
+
+  return Add_Sub(a, b, std::plus<MP_Float::limb2>());
+}
+
+inline
+MP_Float
+operator-(const MP_Float &a, const MP_Float &b)
+{
+  if (b.is_zero())
+    return a;
+
+  return Add_Sub(a, b, std::minus<MP_Float::limb2>());
+}
+
+inline
+MP_Float
+operator*(const MP_Float &a, const MP_Float &b)
+{
+  if (a.is_zero() || b.is_zero())
+    return MP_Float();
+
+  // Disabled until square() is fixed.
+  // if (&a == &b)
+  //   return square(a);
+
+  MP_Float r;
+  r.exp = a.exp + b.exp;
+  CGAL_assertion_msg(CGAL::abs(r.exp) < (1<<30)*1.0*(1<<23),
+                     "Exponent overflow in MP_Float multiplication");
+  r.v.assign(a.v.size() + b.v.size(), 0);
+  for(unsigned i = 0; i < a.v.size(); ++i)
+  {
+    unsigned j;
+    MP_Float::limb carry = 0;
+    for(j = 0; j < b.v.size(); ++j)
+    {
+      MP_Float::limb2 tmp = carry + (MP_Float::limb2) r.v[i+j]
+                        + std::multiplies<MP_Float::limb2>()(a.v[i], b.v[j]);
+      MP_Float::split(tmp, carry, r.v[i+j]);
+    }
+    r.v[i+j] = carry;
+  }
+  r.canonicalize();
+  return r;
+}
+
+// Squaring simplifies things and is faster, so we specialize it.
+inline
+MP_Float
+INTERN_MP_FLOAT::square(const MP_Float &a)
+{
+  // There is a bug here (see test-case in test/NT/MP_Float.C).
+  // For now, I disable this small optimization.
+  // See also the comment code in operator*().
+  return a*a;
+#if 0
+  typedef MP_Float::limb limb;
+  typedef MP_Float::limb2 limb2;
+
+  if (a.is_zero())
+    return MP_Float();
+
+  MP_Float r;
+  r.exp = 2*a.exp;
+  r.v.assign(2*a.v.size(), 0);
+  for(unsigned i=0; i<a.v.size(); i++)
+  {
+    unsigned j;
+    limb2 carry = 0;
+    limb carry2 = 0;
+    for(j=0; j<i; j++)
+    {
+      // There is a risk of overflow here :(
+      // It can only happen when a.v[i] == a.v[j] == -2^15 (log_limb...)
+      limb2 tmp0 = std::multiplies<limb2>()(a.v[i], a.v[j]);
+      limb2 tmp1 = carry + (limb2) r.v[i+j] + tmp0;
+      limb2 tmp = tmp0 + tmp1;
+
+      limb tmpcarry;
+      MP_Float::split(tmp, tmpcarry, r.v[i+j]);
+      carry = tmpcarry + (limb2) carry2;
+
+      // Is there a more efficient way to handle this carry ?
+      if (tmp > 0 && tmp0 < 0 && tmp1 < 0)
+      {
+        // If my calculations are correct, this case should never happen.
+	CGAL_error();
+      }
+      else if (tmp < 0 && tmp0 > 0 && tmp1 > 0)
+        carry2 = 1;
+      else
+        carry2 = 0;
+    }
+    // last round for j=i :
+    limb2 tmp0 = carry + (limb2) r.v[i+i]
+                       + std::multiplies<limb2>()(a.v[i], a.v[i]);
+    MP_Float::split(tmp0, r.v[i+i+1], r.v[i+i]);
+    r.v[i+i+1] += carry2;
+  }
+  r.canonicalize();
+  return r;
+#endif
+}
+
+// Division by Newton (code by Valentina Marotta & Chee Yap) :
+/*
+Integer reciprocal(const Integer A, Integer k) {
+  Integer t, m, ld;
+  Integer e, X, X1, X2, A1;
+  if (k == 1)
+    return 2;
+
+  A1 = A >> k/2;   // k/2 most significant bits
+  X1 = reciprocal(A1, k/2);
+  // To avoid the adjustment :
+  Integer E = (1 << (2*k - 1)) - A*X1;
+  if (E > A)
+    X1 = X1 + 1;
+
+  e = 1 << 3*k/2; // 2^(3k/2)
+  X2 = X1*e - X1*X1*A;
+  X = X2 >> k-1;
+  return X;
+}
+*/
+
+inline
+MP_Float
+approximate_division(const MP_Float &a, const MP_Float &b)
+{
+  CGAL_assertion_msg(! b.is_zero(), " Division by zero");
+  return MP_Float(CGAL::to_double(a)/CGAL::to_double(b));
+}
+
+inline
+MP_Float
+approximate_sqrt(const MP_Float &d)
+{
+  return MP_Float(CGAL_NTS sqrt(CGAL::to_double(d)));
+}
+
+// Returns (first * 2^second), an approximation of b.
+inline
+std::pair<double, int>
+to_double_exp(const MP_Float &b)
+{
+  typedef MP_Float::exponent_type       exponent_type;
+  if (b.is_zero())
+    return std::make_pair(0.0, 0);
+
+  exponent_type exp = b.max_exp();
+  int steps = static_cast<int>((std::min)( INTERN_MP_FLOAT::limbs_per_double, b.v.size()));
+  double d_exp_1 = std::ldexp(1.0, - static_cast<int>( INTERN_MP_FLOAT::log_limb));
+  double d_exp   = 1.0;
+  double d = 0;
+
+  for (exponent_type i = exp - 1; i > exp - 1 - steps; i--) {
+    d_exp *= d_exp_1;
+    d += d_exp * b.of_exp(i);
+  }
+
+  CGAL_assertion_msg(CGAL::abs(exp* INTERN_MP_FLOAT::log_limb) < (1<<30)*2.0,
+                     "Exponent overflow in MP_Float to_double");
+
+  return std::make_pair(d, static_cast<int>(exp *  INTERN_MP_FLOAT::log_limb));
+}
+
+// Returns (first * 2^second), an interval surrounding b.
+inline
+std::pair<std::pair<double, double>, int>
+to_interval_exp(const MP_Float &b)
+{
+  typedef MP_Float::exponent_type       exponent_type;
+  if (b.is_zero())
+    return std::make_pair(std::pair<double, double>(0, 0), 0);
+
+  exponent_type exp = b.max_exp();
+  int steps = static_cast<int>((std::min)( INTERN_MP_FLOAT::limbs_per_double, b.v.size()));
+  double d_exp_1 = std::ldexp(1.0, - (int)  INTERN_MP_FLOAT::log_limb);
+  double d_exp   = 1.0;
+
+  Interval_nt_advanced::Protector P;
+  Interval_nt_advanced d = 0;
+
+  exponent_type i;
+  for (i = exp - 1; i > exp - 1 - steps; i--) {
+    d_exp *= d_exp_1;
+    if (d_exp == 0) // Take care of underflow.
+      d_exp = CGAL_IA_MIN_DOUBLE;
+    d += d_exp * b.of_exp(i);
+  }
+
+  if (i >= b.min_exp() && d.is_point()) {
+    if (b.of_exp(i) > 0)
+      d += Interval_nt_advanced(0, d_exp);
+    else if (b.of_exp(i) < 0)
+      d += Interval_nt_advanced(-d_exp, 0);
+    else
+      d += Interval_nt_advanced(-d_exp, d_exp);
+  }
+
+#ifdef CGAL_EXPENSIVE_ASSERTION // force it always in early debugging
+  if (d.is_point())
+    CGAL_assertion(MP_Float(d.inf()) == b);
+  else
+    CGAL_assertion(MP_Float(d.inf()) <= b & MP_Float(d.sup()) >= b);
+#endif
+
+  CGAL_assertion_msg(CGAL::abs(exp* INTERN_MP_FLOAT::log_limb) < (1<<30)*2.0,
+                     "Exponent overflow in MP_Float to_interval");
+  return std::make_pair(d.pair(), static_cast<int>(exp *  INTERN_MP_FLOAT::log_limb));
+}
+
+// to_double() returns, not the closest double, but a one bit error is allowed.
+// We guarantee : to_double(MP_Float(double d)) == d.
+inline
+double
+INTERN_MP_FLOAT::to_double(const MP_Float &b)
+{
+  std::pair<double, int> ap = to_double_exp(b);
+  return ap.first * std::ldexp(1.0, ap.second);
+}
+
+inline
+double
+INTERN_MP_FLOAT::to_double(const Quotient<MP_Float> &q)
+{
+    std::pair<double, int> n = to_double_exp(q.numerator());
+    std::pair<double, int> d = to_double_exp(q.denominator());
+    double scale = std::ldexp(1.0, n.second - d.second);
+    return (n.first / d.first) * scale;
+}
+
+// FIXME : This function deserves proper testing...
+inline
+std::pair<double,double>
+INTERN_MP_FLOAT::to_interval(const MP_Float &b)
+{
+  std::pair<std::pair<double, double>, int> ap = to_interval_exp(b);
+  return ldexp(Interval_nt<>(ap.first), ap.second).pair();
+}
+
+// FIXME : This function deserves proper testing...
+inline
+std::pair<double,double>
+INTERN_MP_FLOAT::to_interval(const Quotient<MP_Float> &q)
+{
+  std::pair<std::pair<double, double>, int> n = to_interval_exp(q.numerator());
+  std::pair<std::pair<double, double>, int> d = to_interval_exp(q.denominator());
+  CGAL_assertion_msg(CGAL::abs(1.0*n.second - d.second) < (1<<30)*2.0,
+                     "Exponent overflow in Quotient<MP_Float> to_interval");
+  return ldexp(Interval_nt<>(n.first) / Interval_nt<>(d.first),
+               n.second - d.second).pair();
+}
+
+inline
+std::ostream &
+operator<< (std::ostream & os, const MP_Float &b)
+{
+  os << CGAL::to_double(b);
+  return os;
+}
+
+inline
+std::ostream &
+print (std::ostream & os, const MP_Float &b)
+{
+  typedef MP_Float::exponent_type       exponent_type;
+  // Binary format would be nice and not hard to have too (useful ?).
+  if (b.is_zero())
+    return os << 0 << " [ double approx == " << 0.0 << " ]";
+
+  MP_Float::const_iterator i;
+  exponent_type exp = b.min_exp() *  INTERN_MP_FLOAT::log_limb;
+  double approx = 0; // only for giving an idea.
+
+  for (i = b.v.begin(); i != b.v.end(); i++)
+  {
+    os << ((*i > 0) ? " +" : " ") << *i;
+
+    if (exp != 0)
+      os << " * 2^" << exp;
+
+    approx += std::ldexp(static_cast<double>(*i),
+                                   static_cast<int>(exp));
+
+    exp +=  INTERN_MP_FLOAT::log_limb;
+  }
+
+  os << "  [ double approx == " << approx << " ]";
+
+  return os;
+}
+
+inline
+std::istream &
+operator>> (std::istream & is, MP_Float &b)
+{
+  double d;
+  is >> d;
+  if (is)
+    b = MP_Float(d);
+  return is;
+}
+
+} //namespace CGAL
+
+#endif // CGAL_MP_FLOAT_IMPL_H
diff --git a/3rdparty/CGAL/include/CGAL/Manhattan_distance_iso_box_point.h b/3rdparty/CGAL/include/CGAL/Manhattan_distance_iso_box_point.h
new file mode 100644
index 0000000..9ead32a
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Manhattan_distance_iso_box_point.h
@@ -0,0 +1,173 @@
+// Copyright (c) 2002,2011 Utrecht University (The Netherlands).
+// 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
+// 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(s)     : Hans Tangelder (<hanst at cs.uu.nl>)
+
+
+#ifndef CGAL_MANHATTAN_DISTANCE_ISO_BOX_POINT_H
+#define CGAL_MANHATTAN_DISTANCE_ISO_BOX_POINT_H
+
+#include <CGAL/result_of.h>
+#include <CGAL/Kd_tree_rectangle.h>
+#include <CGAL/internal/Get_dimension_tag.h>
+
+namespace CGAL {
+
+  template <class SearchTraits>
+  class Manhattan_distance_iso_box_point {
+    SearchTraits traits;
+  public:
+
+    typedef typename SearchTraits::Point_d Point_d;
+    typedef typename SearchTraits::Iso_box_d Iso_box_d;
+    typedef typename SearchTraits::FT    FT;
+    typedef Iso_box_d                  Query_item;
+    typedef typename internal::Get_dimension_tag<SearchTraits>::Dimension Dimension;
+    typedef typename CGAL::cpp11::result_of<typename SearchTraits::Construct_max_vertex_d(Query_item)>::type Max_vertex;
+    
+    Manhattan_distance_iso_box_point(const SearchTraits& traits_=SearchTraits()):traits(traits_) {}
+      
+    
+    // obsolete as we no longer store dimension Manhattan_distance_iso_box_point(const int d) : the_dimension(d) {}
+
+    inline FT transformed_distance(const Query_item& q, const Point_d& p) const {
+		FT distance = FT(0);
+		typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=
+                  traits.construct_cartesian_const_iterator_d_object();
+		typename SearchTraits::Construct_min_vertex_d construct_min_vertex;
+		typename SearchTraits::Construct_max_vertex_d construct_max_vertex;
+                Max_vertex maxv = construct_max_vertex(q);
+                typename SearchTraits::Cartesian_const_iterator_d qmaxit = construct_it(maxv),
+		  qe = construct_it(maxv,1), qminit = construct_it(construct_min_vertex(q)),
+		  pit = construct_it(p);
+		for (; qmaxit != qe; ++pit,++qmaxit,++qminit) {
+			if ((*pit)>(*qmaxit)) distance += 
+			(*pit)-(*qmaxit); 
+			else if ((*pit)<(*qminit)) distance += 
+			(*qminit)-(*pit);	
+		}
+        	return distance;
+    }
+
+
+    inline FT min_distance_to_rectangle(const Query_item& q,
+					      const Kd_tree_rectangle<FT,Dimension>& r) const {
+		FT distance = FT(0);
+		typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=
+                  traits.construct_cartesian_const_iterator_d_object();
+		typename SearchTraits::Construct_min_vertex_d construct_min_vertex;
+		typename SearchTraits::Construct_max_vertex_d construct_max_vertex;
+                Max_vertex maxv = construct_max_vertex(q);
+                typename SearchTraits::Cartesian_const_iterator_d qmaxit = construct_it(maxv),
+		  qe = construct_it(maxv,1), qminit = construct_it(construct_min_vertex(q));
+		for (unsigned int i = 0; qmaxit != qe; ++ qmaxit, ++qminit, ++i)  {
+			if (r.min_coord(i)>(*qmaxit)) 
+			  distance +=(r.min_coord(i)-(*qmaxit)); 
+			if (r.max_coord(i)<(*qminit)) 
+			  distance += ((*qminit)-r.max_coord(i));
+	        }
+		return distance;
+	}
+
+     inline FT min_distance_to_rectangle(const Query_item& q,
+					      const Kd_tree_rectangle<FT,Dimension>& r,std::vector<FT>& dists) const {
+		FT distance = FT(0);
+		typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=
+                  traits.construct_cartesian_const_iterator_d_object();
+		typename SearchTraits::Construct_min_vertex_d construct_min_vertex;
+		typename SearchTraits::Construct_max_vertex_d construct_max_vertex;
+                Max_vertex maxv = construct_max_vertex(q);
+                typename SearchTraits::Cartesian_const_iterator_d qmaxit = construct_it(maxv),
+		  qe = construct_it(maxv,1), qminit = construct_it(construct_min_vertex(q));
+		for (unsigned int i = 0; qmaxit != qe; ++ qmaxit, ++qminit, ++i)  {
+			if (r.min_coord(i)>(*qmaxit)) {
+                          dists[i]=(r.min_coord(i)-(*qmaxit)); 
+			  distance +=dists[i];
+                        }
+			if (r.max_coord(i)<(*qminit)) {
+                          dists[i]=((*qminit)-r.max_coord(i));
+			  distance += dists[i];
+                        }
+	        }
+		return distance;
+	}
+
+    inline 
+    FT 
+    max_distance_to_rectangle(const Query_item& q,
+			      const Kd_tree_rectangle<FT,Dimension>& r) const {
+      FT distance=FT(0);
+      typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=
+        traits.construct_cartesian_const_iterator_d_object();
+      typename SearchTraits::Construct_min_vertex_d construct_min_vertex;
+      typename SearchTraits::Construct_max_vertex_d construct_max_vertex;
+      Max_vertex maxv = construct_max_vertex(q);
+      typename SearchTraits::Cartesian_const_iterator_d qmaxit = construct_it(maxv),
+	qe = construct_it(maxv,1), qminit = construct_it(construct_min_vertex(q));
+      for (unsigned int i = 0; qmaxit != qe; ++ qmaxit, ++qminit, ++i)  {
+	if ( r.max_coord(i)-(*qminit) >(*qmaxit)-r.min_coord(i) )  
+	  distance += (r.max_coord(i)-(*qminit));
+	else 
+	  distance += ((*qmaxit)-r.min_coord(i));
+      }
+      return distance;
+    }
+
+     inline 
+    FT 
+    max_distance_to_rectangle(const Query_item& q,
+			      const Kd_tree_rectangle<FT,Dimension>& r,std::vector<FT>& dists) const {
+      FT distance=FT(0);
+      typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=
+        traits.construct_cartesian_const_iterator_d_object();
+      typename SearchTraits::Construct_min_vertex_d construct_min_vertex;
+      typename SearchTraits::Construct_max_vertex_d construct_max_vertex;
+      Max_vertex maxv = construct_max_vertex(q);
+      typename SearchTraits::Cartesian_const_iterator_d qmaxit = construct_it(maxv),
+	qe = construct_it(maxv,1), qminit = construct_it(construct_min_vertex(q));
+      for (unsigned int i = 0; qmaxit != qe; ++ qmaxit, ++qminit, ++i)  {
+	if ( r.max_coord(i)-(*qminit) >(*qmaxit)-r.min_coord(i) )  {
+          dists[i]=(r.max_coord(i)-(*qminit));
+	  distance += dists[i];
+        }
+	else {
+          dists[i]=((*qmaxit)-r.min_coord(i));
+	  distance += dists[i];
+        }
+      }
+      return distance;
+    }
+	
+  inline 
+  FT 
+  transformed_distance(FT d) const
+  {
+    return d;
+  }
+
+  inline 
+  FT 
+  inverse_of_transformed_distance(FT d) const
+  {
+    return d;
+  }
+
+}; // class Manhattan_distance_iso_box_point
+
+} // namespace CGAL
+#endif // MANHATTAN_DISTANCE_ISO_BOX_POINT_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Marching_tetrahedra_observer_default_3.h b/3rdparty/CGAL/include/CGAL/Marching_tetrahedra_observer_default_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Marching_tetrahedra_observer_default_3.h
rename to 3rdparty/CGAL/include/CGAL/Marching_tetrahedra_observer_default_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Marching_tetrahedra_traits_skin_surface_3.h b/3rdparty/CGAL/include/CGAL/Marching_tetrahedra_traits_skin_surface_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Marching_tetrahedra_traits_skin_surface_3.h
rename to 3rdparty/CGAL/include/CGAL/Marching_tetrahedra_traits_skin_surface_3.h
diff --git a/3rdparty/CGAL/include/CGAL/Mean_curvature_flow_skeletonization.h b/3rdparty/CGAL/include/CGAL/Mean_curvature_flow_skeletonization.h
new file mode 100644
index 0000000..3dc4afe
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Mean_curvature_flow_skeletonization.h
@@ -0,0 +1,1443 @@
+// Copyright (c) 2013  GeometryFactory (France). All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Xiang Gao <gaox at ethz.ch>
+//
+
+#ifndef CGAL_MEAN_CURVATURE_FLOW_SKELETONIZATION_H
+#define CGAL_MEAN_CURVATURE_FLOW_SKELETONIZATION_H
+
+#include <CGAL/trace.h>
+#include <CGAL/Timer.h>
+#include <CGAL/Default.h>
+
+#include <CGAL/Polyhedron_3.h>
+#include <CGAL/Polyhedron_items_with_id_3.h>
+#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
+#include <CGAL/boost/graph/copy_face_graph.h>
+
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/adjacency_list.hpp>
+#include <boost/graph/copy.hpp>
+#include <boost/unordered_map.hpp>
+#include <boost/property_map/property_map.hpp>
+
+#include <boost/iterator/transform_iterator.hpp>
+#include <boost/foreach.hpp>
+
+#include <CGAL/boost/graph/iterator.h>
+
+// Compute cotangent Laplacian
+#include <CGAL/Polygon_mesh_processing/Weights.h>
+
+// Compute the vertex normal
+#include <CGAL/Polygon_mesh_processing/compute_normal.h>
+
+// Simplification function
+#include <CGAL/boost/graph/Euler_operations.h>
+
+// Curve skeleton data structure
+#include <CGAL/internal/Surface_mesh_skeletonization/Curve_skeleton.h>
+
+// For Voronoi diagram
+#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
+#include <CGAL/Delaunay_triangulation_3.h>
+#include <CGAL/Triangulation_vertex_base_with_info_3.h>
+
+// For debugging macro
+#include <CGAL/internal/Surface_mesh_skeletonization/Debug.h>
+
+// Some helper functions
+#include <CGAL/Polygon_mesh_processing/measure.h>
+
+// For detect_degenarcy
+#include <CGAL/internal/Surface_mesh_skeletonization/Detect_degeneracy.h>
+
+// Inside mesh test
+#include <CGAL/Side_of_triangle_mesh.h>
+
+// Compute bounding box
+#include <CGAL/Bbox_3.h>
+
+#include <queue>
+
+// for default parameters
+#if defined(CGAL_EIGEN3_ENABLED)
+#include <CGAL/Eigen_solver_traits.h>  // for sparse linear system solver
+// #include <Eigen/CholmodSupport>
+#endif
+
+namespace CGAL {
+
+namespace internal{
+
+template < class Refs, class Point, class ID, class vertex_descriptor>
+struct Skel_HDS_vertex_type : public HalfedgeDS_vertex_max_base_with_id<Refs, Point, ID>
+{
+  typedef HalfedgeDS_vertex_max_base_with_id<Refs, Point, ID> Base;
+  Skel_HDS_vertex_type() : Base (), is_fixed(false)  {}
+  Skel_HDS_vertex_type( Point const& p) : Base(p), is_fixed(false) {}
+  std::vector<vertex_descriptor> vertices;
+  Point pole;
+  bool is_fixed;
+};
+
+template <class vertex_descriptor>
+struct Skel_polyhedron_items_3: CGAL::Polyhedron_items_with_id_3 {
+    template < class Refs, class Traits>
+    struct Vertex_wrapper {
+        typedef typename Traits::Point_3 Point;
+      typedef Skel_HDS_vertex_type< Refs, Point, std::size_t, vertex_descriptor> Vertex;
+    };
+};
+
+} //end of namespace internal
+
+
+/// \ingroup PkgMeanCurvatureSkeleton3
+/// Function object that enables to extract the mean curvature
+/// flow skeleton of a triangulated surface mesh.
+///
+/// The algorithm used takes as input a triangulated surface mesh and iteratively contracts the surface mesh
+/// following the mean curvature flow \cgalCite{tagliasacchi2012mean}. The intermediate contracted surface
+/// mesh is called the <em>meso-skeleton</em>.
+/// After each iteration, the meso-skeleton is locally remeshed using angle split and edge contraction.
+/// The process ends when the modification of the meso-skeleton between two iterations is small.
+///
+/// @tparam TriangleMesh
+///         a model of `FaceListGraph`
+///
+/// @tparam Traits
+///         a model of `MeanCurvatureSkeletonizationTraits`<br>
+///         <b>%Default:</b>
+/// \code
+///     CGAL::Kernel_traits<
+///       boost::property_traits<
+///          boost::property_map<TriangleMesh, CGAL::vertex_point_t>::type
+///        >::value_type
+///      >::Kernel
+/// \endcode
+///
+/// @tparam VertexPointMap
+///         a model of `ReadWritePropertyMap`
+///         with `boost::graph_traits<TriangleMesh>::%vertex_descriptor` as key and
+///         `Traits::Point_3` as value type.<br>
+///         <b>%Default:</b>
+/// \code
+///   boost::property_map<TriangleMesh, CGAL::vertex_point_t>::const_type.
+/// \endcode
+///
+/// @tparam SolverTraits_
+///         a model of `NormalEquationSparseLinearAlgebraTraits_d`.<br>
+///         <b>%Default:</b> If \ref thirdpartyEigen "Eigen" 3.2 (or greater) is available
+///         and `CGAL_EIGEN3_ENABLED` is defined, then an overload of `Eigen_solver_traits` is provided as default parameter:
+/// \code
+///      CGAL::Eigen_solver_traits<
+///        Eigen::SimplicialLDLT< Eigen::SparseMatrix<double> >
+///      >
+/// \endcode
+///
+/// @cond CGAL_DOCUMENT_INTERNAL
+/// @tparam Degeneracy_algorithm_tag
+///         tag for selecting the degeneracy detection algorithm
+/// @endcond
+template <class TriangleMesh,
+          class Traits_ = Default,
+          class VertexPointMap_ = Default,
+          class SolverTraits_ = Default>
+class Mean_curvature_flow_skeletonization
+{
+// Public types
+public:
+
+/// \name Types
+/// @{
+  // Template parameters
+  #ifndef DOXYGEN_RUNNING
+  typedef typename Default::Get<
+    VertexPointMap_,
+    typename boost::property_map<TriangleMesh, CGAL::vertex_point_t>::const_type
+  >::type VertexPointMap;
+
+  typedef typename Default::Get<
+    Traits_,
+    typename Kernel_traits<typename boost::property_traits<typename boost::property_map<TriangleMesh, CGAL::vertex_point_t>::type>::value_type>::Kernel
+  >::type Traits;
+  #endif
+
+  #ifndef DOXYGEN_RUNNING
+  typedef typename Default::Get<
+    SolverTraits_,
+  #if defined(CGAL_EIGEN3_ENABLED)
+      CGAL::Eigen_solver_traits<
+        Eigen::SimplicialLDLT< Eigen::SparseMatrix<double> >
+//        Eigen::CholmodDecomposition< Eigen::SparseMatrix<double> >
+      >
+  #else
+    SolverTraits_ // no parameter provided, and Eigen is not enabled: so don't compile!
+  #endif
+  >::type SolverTraits;
+  #endif
+
+  /// @cond CGAL_DOCUMENT_INTERNAL
+  typedef typename Traits::Point_3                                             Point;
+  typedef typename Traits::Vector_3                                             Vector;
+
+  typedef typename boost::graph_traits<TriangleMesh>::vertex_descriptor  Input_vertex_descriptor;
+  typedef CGAL::Polyhedron_3<Traits,internal::Skel_polyhedron_items_3<Input_vertex_descriptor> > mTriangleMesh;
+  typedef typename boost::property_map<mTriangleMesh, CGAL::vertex_point_t>::type mVertexPointMap;
+  typedef typename boost::property_map<mTriangleMesh, boost::vertex_index_t>::type VertexIndexMap;
+  typedef typename boost::property_map<mTriangleMesh, boost::halfedge_index_t>::type HalfedgeIndexMap;
+
+
+  struct Vmap {
+    Point point;
+    std::vector<Input_vertex_descriptor> vertices;
+  };
+  ///@endcond
+
+  /// The graph type representing the skeleton. The vertex property
+  /// `Vmap` is a struct with a member `point` of type `Traits::Point_3`
+  /// and a member `vertices` of type
+  /// `std::vector<boost::graph_traits<TriangleMesh>::%vertex_descriptor>`.
+  /// See  <a href="http://www.boost.org/doc/libs/release/libs/graph/doc/adjacency_list.html"><tt>the boost documentation</tt></a> page for more details
+  typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, Vmap> Skeleton;
+
+
+/// @}
+
+  // Repeat mTriangleMesh types
+  typedef typename boost::graph_traits<mTriangleMesh>::vertex_descriptor       vertex_descriptor;
+  typedef typename boost::graph_traits<mTriangleMesh>::halfedge_descriptor     halfedge_descriptor;
+  typedef typename boost::graph_traits<mTriangleMesh>::face_descriptor         face_descriptor;
+  typedef typename boost::graph_traits<mTriangleMesh>::vertex_iterator         vertex_iterator;
+  typedef typename boost::graph_traits<mTriangleMesh>::edge_descriptor         edge_descriptor;
+  typedef typename boost::graph_traits<mTriangleMesh>::edge_iterator           edge_iterator;
+
+  // Cotangent weight calculator
+  typedef internal::Cotangent_weight<mTriangleMesh,
+    typename boost::property_map<mTriangleMesh, vertex_point_t>::type,
+    internal::Cotangent_value_minimum_zero<mTriangleMesh,
+      typename boost::property_map<mTriangleMesh, vertex_point_t>::type,
+      internal::Cotangent_value_Meyer_secure<mTriangleMesh> > >                Weight_calculator;
+
+  typedef internal::Curve_skeleton<mTriangleMesh,
+                                   VertexIndexMap,
+                                   HalfedgeIndexMap,
+                                   mVertexPointMap>                            Curve_skeleton;
+
+  // Repeat Triangulation types
+  typedef CGAL::Exact_predicates_exact_constructions_kernel                    Exact_kernel;
+  typedef CGAL::Triangulation_vertex_base_with_info_3
+                                            <vertex_descriptor, Exact_kernel>  Vb;
+  typedef CGAL::Triangulation_data_structure_3<Vb>                             Tds;
+  typedef CGAL::Delaunay_triangulation_3<Exact_kernel, Tds>                    Delaunay;
+  typedef typename Delaunay::Point                                             Exact_point;
+  typedef typename Delaunay::Cell_handle                                       Cell_handle;
+  typedef typename Delaunay::Vertex_handle                                     TriVertex_handle;
+  typedef typename Delaunay::Finite_cells_iterator                             Finite_cells_iterator;
+
+// Data members
+private:
+
+  /** The meso-skeleton */
+  mTriangleMesh m_tmesh;
+
+  /** Storing indices of all vertices. */
+  VertexIndexMap m_vertex_id_pmap;
+  /** Storing indices of all edges. */
+  HalfedgeIndexMap m_hedge_id_pmap;
+  /** Storing the point for mTriangleMesh vertex_descriptor. */
+  mVertexPointMap m_tmesh_point_pmap;
+  /** Traits class. */
+  Traits m_traits;
+
+  /** Controling the velocity of movement and approximation quality. */
+  double m_omega_H;
+  /** Controling the smoothness of the medial approximation. */
+  double m_omega_P;
+  /** Edges with length less than `min_edge_length` will be collapsed. */
+  double m_min_edge_length;
+  /** Triangles with angle greater than `alpha_TH` will be split. */
+  double m_alpha_TH;
+  /** Value very close to zero. */
+  double m_zero_TH;
+  /** `contract_until_convergence` will stop if the change of area in one iteration
+   *  is less than `delta_area`. */
+  double m_delta_area;
+  /** Surface area of original surface mesh. */
+  double m_original_area;
+  /** Maximum number of iterations. */
+  std::size_t m_max_iterations;
+  /** Should the skeleton be medially centered? */
+  bool m_is_medially_centered;
+  /** Are poles computed? */
+  bool m_are_poles_computed;
+
+  /** Cotangent weight calculator. */
+  Weight_calculator m_weight_calculator;
+  /** Storing the weights for edges. */
+  std::vector<double> m_edge_weight;
+  /** The sparse solver. */
+  SolverTraits m_solver;
+
+  /** Assign a unique id to a new vertex. */
+  int m_vertex_id_count;
+  /** The maximum id for original surface. vertices with ids
+   *  greater than `m_max_id` are created during split,
+   *  thus will not be considered in correspondence tracking. */
+  int m_max_id;
+  /** Used when assembling the matrix. */
+  std::map<int, int> m_new_id;
+
+  /** The incident angle for a halfedge. */
+  std::vector<double> m_halfedge_angle;
+
+  /** The normal of surface points. */
+  std::vector<Vector> m_normals;
+
+
+// Private functions and classes
+
+struct Vertex_to_point{
+  mVertexPointMap ppmap;
+  Vertex_to_point(mVertexPointMap ppmap): ppmap(ppmap){}
+  typedef typename boost::property_traits<mVertexPointMap>::reference result_type;
+  result_type
+  operator()(vertex_descriptor vd) const{
+    return get(ppmap, vd);
+  }
+};
+
+double diagonal_length(const Bbox_3& bbox)
+{
+  double dx = bbox.xmax() - bbox.xmin();
+  double dy = bbox.ymax() - bbox.ymin();
+  double dz = bbox.zmax() - bbox.zmin();
+
+  double diag = dx * dx + dy * dy + dz * dz;
+  return std::sqrt(diag);
+}
+
+
+double init_min_edge_length()
+{
+  vertex_iterator vb, ve;
+  boost::tie(vb, ve) = vertices(m_tmesh);
+  Vertex_to_point v_to_p(m_tmesh_point_pmap);
+  Bbox_3 bbox = CGAL::bbox_3(boost::make_transform_iterator(vb, v_to_p),
+                             boost::make_transform_iterator(ve, v_to_p));
+  return 0.002 * diagonal_length(bbox);
+}
+
+std::size_t collapse_short_edges();
+// Public methods
+public:
+
+  /// \name Constructor
+  ///@{
+  #ifdef DOXYGEN_RUNNING
+  /**
+   * The constructor of a skeletonization object.
+   *
+   * The algorithm parameters are initialized such that:
+   * - `max_triangle_angle() == 110`
+   * - `quality_speed_tradeoff() == 0.1`
+   * - `medially_centered_speed_tradeoff() == 0.2`
+   * - `area_variation_factor() == 0.0001`
+   * - `max_iterations() == 500`
+   * - `is_medially_centered() == true`
+   * - `min_edge_length()` == 0.002 * the length of the diagonal of the bounding box of `tmesh`
+   *
+   * @pre `tmesh` is a triangulated surface mesh without borders and has exactly one connected component.
+   * @param tmesh
+   *        input triangulated surface mesh.
+   * @param vertex_point_map
+   *        property map which associates a point to each vertex of the graph.
+   * @param traits
+   *        an instance of the traits class.
+   */
+  Mean_curvature_flow_skeletonization(const TriangleMesh& tmesh,
+                                      VertexPointMap vertex_point_map = get(CGAL::vertex_point, tmesh),
+                                      Traits traits = Traits());
+
+  #else
+
+  Mean_curvature_flow_skeletonization(const TriangleMesh& tmesh,
+                                      VertexPointMap vertex_point_map,
+                                      const Traits& traits = Traits())
+    : m_traits(traits), m_weight_calculator(m_tmesh)
+  {
+    init(tmesh, vertex_point_map);
+  }
+
+  Mean_curvature_flow_skeletonization(const TriangleMesh& tmesh,
+                                      const Traits& traits = Traits())
+    : m_traits(traits), m_weight_calculator(m_tmesh)
+  {
+    init(tmesh);
+  }
+  #endif
+  /// @} Constructor
+
+  /// \name Local Remeshing Parameters
+  /// @{
+
+  /// During the local remeshing step, a triangle will be split
+  /// if it has an angle larger than `max_triangle_angle()`.
+  double max_triangle_angle()
+  {
+    return m_alpha_TH;
+  }
+
+  /// During the local remeshing step, an edge will be collapse
+  /// if it is length is less than `min_edge_length()`.
+  double min_edge_length()
+  {
+    return m_min_edge_length;
+  }
+
+ void set_max_triangle_angle(double value)
+  {
+    m_alpha_TH = value;
+  }
+
+  void set_min_edge_length(double value)
+  {
+    m_min_edge_length = value;
+  }
+  /// @}
+
+  /// \name Algorithm Termination Parameters
+  /// @{
+
+  /// Maximum number of iterations performed by `contract_until_convergence()`.
+  std::size_t max_iterations()
+  {
+    return m_max_iterations;
+  }
+
+  /// The convergence is considered to be reached if the variation of the area of
+  /// the meso-skeleton after one iteration is smaller than
+  /// `area_variation_factor()*original_area` where `original_area` is the area of the input
+  /// triangle mesh.
+  double area_variation_factor()
+  {
+    return m_delta_area;
+  }
+
+  void set_max_iterations(std::size_t value)
+  {
+    m_max_iterations = value;
+  }
+
+  void set_area_variation_factor(double value)
+  {
+    m_delta_area = value;
+  }
+  /// @}
+
+  /// \name Vertex Motion Parameters
+  /// @{
+
+  /// \cgalAdvancedBegin
+  /// Controls the velocity of movement and approximation quality:
+  /// decreasing this value makes the mean curvature flow based contraction converge
+  /// faster, but results in a skeleton of lower quality.
+  /// This parameter corresponds to \f$ w_H \f$ in the original publication.
+  /// \cgalAdvancedEnd
+  double quality_speed_tradeoff()
+  {
+    return m_omega_H;
+  }
+
+  /// If `true`, the meso-skeleton placement will be attracted by an approximation
+  /// of the medial axis of the mesh during the contraction steps, so will be the result skeleton.
+  // (an additional energy is used during the contraction using the Voronoi poles of the input triangulated mesh
+  // as attractors).
+  bool is_medially_centered()
+  {
+    return m_is_medially_centered;
+  }
+
+  /// \cgalAdvancedBegin
+  /// Controls the smoothness of the medial approximation:
+  /// increasing this value results in a (less smooth) skeleton closer
+  /// to the medial axis, as well as a lower convergence speed.
+  /// It is only used if `is_medially_centered()==true`.
+  /// This parameter corresponds to \f$ w_M \f$ in the original publication.
+  /// \cgalAdvancedEnd
+  double medially_centered_speed_tradeoff()
+  {
+    return m_omega_P;
+  }
+
+  void set_quality_speed_tradeoff(double value)
+  {
+    m_omega_H = value;
+  }
+
+  void set_is_medially_centered(bool value)
+  {
+    m_is_medially_centered = value;
+  }
+
+  void set_medially_centered_speed_tradeoff(double value)
+  {
+    m_omega_P = value;
+  }
+
+  /// \cond SKIP_FROM_MANUAL
+  void set_zero_TH(double value)
+  {
+    m_zero_TH = value;
+  }
+
+  double zero_TH()
+  {
+    return m_zero_TH;
+  }
+
+  /// \endcond
+
+  /// @cond CGAL_DOCUMENT_INTERNAL
+
+  /**
+   * Get the positions of fixed(degenerate) points.
+   *
+   * @param fixed_points
+   *        return the positions of fixed points
+   */
+  void fixed_points(std::vector<Point>& fixed_points)
+  {
+    fixed_points.clear();
+    BOOST_FOREACH(vertex_descriptor vd, vertices(m_tmesh))
+    {
+      if (vd->is_fixed)
+        fixed_points.push_back(get(m_tmesh_point_pmap, vd));
+    }
+  }
+
+  /**
+   * Get the positions of non-fixed(non-degenerate) points.
+   *
+   * @param non_fixed_points
+   *        return the positions of non-fixed points
+   */
+  void non_fixed_points(std::vector<Point>& non_fixed_points)
+  {
+    non_fixed_points.clear();
+    BOOST_FOREACH(vertex_descriptor vd, vertices(m_tmesh))
+    {
+      if (!vd->is_fixed)
+        non_fixed_points.push_back(get(m_tmesh_point_pmap, vd));
+    }
+  }
+
+  /**
+   * Get the Voronoi pole for the polygonal mesh.
+   *
+   * @param max_poles
+   *        for each surface mesh vertex, record its correspondent Voronoi pole position
+   */
+  void poles(std::vector<Point>& max_poles)
+  {
+    max_poles.resize(num_vertices(m_tmesh));
+    int cnt = 0;
+    BOOST_FOREACH(vertex_descriptor v, vertices(m_tmesh))
+    {
+      max_poles[cnt++] = v->pole;
+    }
+  }
+
+  /// @endcond
+
+  /// @} Setter and Getter
+
+  /// \name High Level Function
+  /// @{
+
+
+  /**
+   * Creates the curve skeleton: the input surface mesh is iteratively
+   * contracted until convergence, and then turned into a curve skeleton.
+   *
+   * This is equivalent to calling `contract_until_convergence()` and `convert_to_skeleton()`.
+
+   * @param skeleton
+   *        graph that will contain the skeleton of the input triangulated surface mesh.
+   *        For each vertex descriptor `vd` of `skeleton`, the corresponding point
+   *        and the set of input vertices that contracted to `vd` can be retrieved
+   *        using `skeleton[vd].point` and `skeleton[vd].vertices` respectively.
+   */
+  void operator()(Skeleton& skeleton)
+  {
+    contract_until_convergence();
+    convert_to_skeleton(skeleton);
+  }
+  /// @}
+
+  /// \name Low Level Functions
+  /// \cgalAdvancedBegin
+  /// The following functions enable the user to run the mean curvature flow skeletonization algorithm step by step.
+  /// \cgalAdvancedEnd
+  /// @{
+
+  /**
+   * Runs one contraction step following the mean curvature flow.
+   */
+  void contract_geometry()
+  {
+    MCFSKEL_DEBUG(std::cerr << "before contract geometry";)
+
+    update_vertex_id();
+
+    compute_edge_weight();
+
+  // AF: attention: num_vertices will not decrease for a Surface_mesh
+    int nver = static_cast<int>(num_vertices(m_tmesh));
+    int nrows;
+    if (m_is_medially_centered)
+    {
+      nrows = nver * 3;
+      if (!m_are_poles_computed)
+      {
+        compute_voronoi_pole();
+      }
+    }
+    else
+    {
+      nrows = nver * 2;
+    }
+    // Assemble linear system At * A * X = At * B
+    typename SolverTraits::Matrix A(nrows, nver);
+    assemble_LHS(A);
+
+    typename SolverTraits::Vector X(nver), Bx(nrows);
+    typename SolverTraits::Vector Y(nver), By(nrows);
+    typename SolverTraits::Vector Z(nver), Bz(nrows);
+    assemble_RHS(Bx, By, Bz);
+
+    MCFSKEL_DEBUG(std::cerr << "before solve\n";)
+
+    // solve "At * A * X = At * B".
+    m_solver.normal_equation_factor(A);
+    m_solver.normal_equation_solver(Bx, X);
+    m_solver.normal_equation_solver(By, Y);
+    m_solver.normal_equation_solver(Bz, Z);
+
+    MCFSKEL_DEBUG(std::cerr << "after solve\n";)
+
+    // copy to surface mesh
+    BOOST_FOREACH(vertex_descriptor vd, vertices(m_tmesh))
+    {
+      int id = static_cast<int>(get(m_vertex_id_pmap, vd));
+      int i = m_new_id[id];
+      Point p =  m_traits.construct_point_3_object()(X[i], Y[i], Z[i]);
+      put(m_tmesh_point_pmap, vd, p);
+    }
+
+    MCFSKEL_DEBUG(std::cerr << "leave contract geometry\n";)
+  }
+
+  /**
+   * Collapses edges of the meso-skeleton with length less than `min_edge_length()` and returns the number of edges collapsed.
+   */
+  std::size_t collapse_edges()
+  {
+    return collapse_short_edges();
+  }
+
+  /**
+   * Splits faces of the meso-skeleton having one angle greater than `max_triangle_angle()` and returns the number of faces split.
+   */
+  std::size_t split_faces()
+  {
+    MCFSKEL_DEBUG(std::cerr << "before split\n";)
+
+    std::size_t num_splits = 0;
+    while (true)
+    {
+      if (num_vertices(m_tmesh) <= 3)
+      {
+        break;
+      }
+      std::size_t cnt = split_flat_triangles();
+      if (cnt == 0)
+      {
+        break;
+      }
+      else
+      {
+        num_splits += cnt;
+      }
+    }
+
+    MCFSKEL_DEBUG(std::cerr << "after split\n";)
+
+    return num_splits;
+  }
+
+#ifndef DOXYGEN_RUNNING
+  /**
+   * Sequentially calls `collapse_edges()` and `split_faces()` and returns the number of edges collapsed and faces split.
+   */
+  std::size_t remesh()
+  {
+    MCFSKEL_DEBUG(std::cerr << "before collapse edges\n";)
+
+    std::size_t num_collapses = collapse_edges();
+    MCFSKEL_INFO(std::cerr << "collapse " << num_collapses << " edges.\n";)
+
+    std::size_t num_splits = split_faces();
+    MCFSKEL_INFO(std::cerr << "split " << num_splits << " edges.\n";)
+
+    return num_collapses + num_splits;
+  }
+#endif
+
+  /**
+   * Prevents degenerate vertices to move during the following contraction steps and returns the number of newly fixed vertices.
+   */
+  std::size_t detect_degeneracies()
+  {
+    return detect_degeneracies_in_disk();
+  }
+
+  /// Performs subsequent calls to `contract_geometry()`, `collapse_edges()`, `split_faces()` and `detect_degeneracies()`
+  void contract()
+  {
+    contract_geometry();
+    remesh();
+    detect_degeneracies();
+
+    MCFSKEL_DEBUG(print_edges();)
+
+    MCFSKEL_INFO(double area = CGAL::Polygon_mesh_processing::area(m_tmesh,
+      CGAL::Polygon_mesh_processing::parameters::vertex_point_map(m_tmesh_point_pmap));)
+    MCFSKEL_INFO(std::cout << "area " << area << "\n";)
+  }
+
+
+  /**
+   * Iteratively calls `contract()`
+   * until the change of surface area of the meso-skeleton after one iteration is smaller than
+   * `area_variation_factor()*original_area` where `original_area` is the area of the input triangle mesh,
+   * or if the maximum number of iterations has been reached.
+   */
+  void contract_until_convergence()
+  {
+    double last_area = 0;
+    std::size_t num_iteration = 0;
+    while (true)
+    {
+      MCFSKEL_INFO(std::cout << "iteration " << num_iteration + 1 << "\n";)
+
+      contract_geometry();
+      remesh();
+      detect_degeneracies();
+
+      double area = CGAL::Polygon_mesh_processing::area(m_tmesh,
+        CGAL::Polygon_mesh_processing::parameters::vertex_point_map(m_tmesh_point_pmap)
+        .geom_traits(m_traits));
+      double area_ratio = fabs(last_area - area) / m_original_area;
+
+      MCFSKEL_INFO(std::cout << "area " << area << "\n";)
+      MCFSKEL_INFO(std::cout << "|area - last_area| / original_area "
+                             << area_ratio << "\n";)
+
+      if (area_ratio < m_delta_area)
+      {
+        break;
+      }
+      last_area = area;
+
+      num_iteration++;
+      if (num_iteration >= m_max_iterations)
+      {
+        break;
+      }
+    }
+  }
+
+  /**
+   * Converts the contracted surface mesh to a skeleton curve.
+   * @tparam Skeleton
+   *         an instantiation of <A href="http://www.boost.org/libs/graph/doc/adjacency_list.html">`boost::adjacency_list`</a>
+   *         as a data structure for the skeleton curve.
+   * @param skeleton
+   *        graph that will contain the skeleton of `tmesh`. It should be empty before passed to the function.
+   */
+  void convert_to_skeleton(Skeleton& skeleton)
+  {
+    skeleton.clear();
+    Curve_skeleton skeletonization(m_tmesh, m_vertex_id_pmap, m_hedge_id_pmap, m_tmesh_point_pmap);
+    skeletonization.extract_skeleton(skeleton);
+  }
+
+  /// @} Public Algorithm API
+
+
+  /// \name Access to the Meso-Skeleton
+  /// @{
+
+  /// When using the low level API it is possible to access the intermediate
+  /// results of the skeletonization process, called meso-skeleton.
+  /// It is a triangulated surface mesh which is model of `FaceListGraph`.
+#ifdef DOXYGEN_RUNNING
+  typedef unspecified_type Meso_skeleton;
+#else
+  typedef mTriangleMesh Meso_skeleton;
+#endif
+  /// Reference to the collapsed triangulated surface mesh.
+  Meso_skeleton& meso_skeleton()
+  {
+    return m_tmesh;
+  }
+
+  /// @}
+
+private:
+
+  // --------------------------------------------------------------------------
+  // Initialization
+  // --------------------------------------------------------------------------
+
+  /// Initialize the parameters for Mean_curvature_flow_skeletonization
+  void init_args()
+  {
+    m_omega_H = 0.1;
+    m_omega_P = 0.2;
+    m_delta_area = 0.0001;
+    m_max_iterations = 500;
+    m_is_medially_centered = true;
+    m_min_edge_length =  init_min_edge_length();
+    m_alpha_TH = 110 * (CGAL_PI / 180.0);
+    m_zero_TH = 1e-7;
+  }
+
+  /// Initialize some global data structures such as vertex id.
+  void init(const TriangleMesh& tmesh)
+  {
+    copy_face_graph(tmesh, m_tmesh);
+
+    // copy input vertices to keep correspondence
+    typename boost::graph_traits<mTriangleMesh>::vertex_iterator vit=vertices(m_tmesh).first;
+    BOOST_FOREACH(Input_vertex_descriptor vd, vertices(tmesh) )
+      (*vit++)->vertices.push_back(vd);
+
+    //init indices
+    typedef typename boost::graph_traits<mTriangleMesh>::vertex_descriptor vertex_descriptor;
+    typedef typename boost::graph_traits<mTriangleMesh>::halfedge_descriptor halfedge_descriptor;
+    std::size_t i=0;
+    BOOST_FOREACH( vertex_descriptor vd, vertices(m_tmesh) )
+      vd->id()=i++;
+    i=0;
+    BOOST_FOREACH( halfedge_descriptor hd, halfedges(m_tmesh) )
+      hd->id()=i++;
+    m_hedge_id_pmap = get(boost::halfedge_index, m_tmesh);
+    m_vertex_id_pmap = get(boost::vertex_index, m_tmesh);
+      //, m_hedge_id_pmap(get(boost::halfedge_index, m_tmesh))
+    m_are_poles_computed = false;
+
+    m_original_area = CGAL::Polygon_mesh_processing::area(m_tmesh,
+      CGAL::Polygon_mesh_processing::parameters::vertex_point_map(m_tmesh_point_pmap)
+      .geom_traits(m_traits));
+
+    m_vertex_id_count = static_cast<int>(num_vertices(m_tmesh));
+    m_max_id = m_vertex_id_count;
+
+    if (m_is_medially_centered)
+      compute_voronoi_pole();
+
+    init_args();
+  }
+
+  // --------------------------------------------------------------------------
+  // Utilities
+  // --------------------------------------------------------------------------
+  double get_x(const Vector& v){ return m_traits.compute_x_3_object()(v); }
+  double get_y(const Vector& v){ return m_traits.compute_y_3_object()(v); }
+  double get_z(const Vector& v){ return m_traits.compute_z_3_object()(v); }
+  double get_x(const Point& v){ return m_traits.compute_x_3_object()(v); }
+  double get_y(const Point& v){ return m_traits.compute_y_3_object()(v); }
+  double get_z(const Point& v){ return m_traits.compute_z_3_object()(v); }
+  // --------------------------------------------------------------------------
+  // Contraction
+  // --------------------------------------------------------------------------
+
+  /// Compute cotangent weights of all edges.
+  void compute_edge_weight()
+  {
+    m_edge_weight.clear();
+    m_edge_weight.reserve(2 * num_edges(m_tmesh));
+    BOOST_FOREACH(halfedge_descriptor hd, halfedges(m_tmesh))
+    {
+      m_edge_weight.push_back(m_weight_calculator(hd));
+    }
+  }
+
+  /// Assemble the left hand side.
+  void assemble_LHS(typename SolverTraits::Matrix& A)
+  {
+    MCFSKEL_DEBUG(std::cerr << "start LHS\n";)
+
+    std::size_t nver = num_vertices(m_tmesh);
+
+    Side_of_triangle_mesh<mTriangleMesh, Traits> test_inside(m_tmesh);
+
+    BOOST_FOREACH(vertex_descriptor vd, vertices(m_tmesh))
+    {
+      int id = static_cast<int>(get(m_vertex_id_pmap, vd));
+
+      int i = m_new_id[id];
+      // if the vertex is fixed
+      if (vd->is_fixed)
+      {
+        A.set_coef(i + nver, i, 1.0 / m_zero_TH, true);
+      }
+      else
+      {
+        A.set_coef(i + nver, i, m_omega_H, true);
+        if (m_is_medially_centered)
+        {
+          if (id < m_max_id)
+          {
+            if (test_inside(vd->pole) == CGAL::ON_BOUNDED_SIDE)
+            {
+              A.set_coef(i + nver * 2, i, m_omega_P, true);
+            }
+          }
+        }
+      }
+    }
+
+    BOOST_FOREACH(vertex_descriptor vd, vertices(m_tmesh))
+    {
+      int id = static_cast<int>(get(m_vertex_id_pmap, vd));
+      int i = m_new_id[id];
+      double L = 1.0;
+      // if the vertex is fixed
+      if (vd->is_fixed)
+      {
+        L = 0;
+      }
+      double diagonal = 0;
+      BOOST_FOREACH(edge_descriptor ed, in_edges(vd, m_tmesh))
+      {
+        vertex_descriptor vj = source(ed, m_tmesh);
+        double wij = m_edge_weight[get(m_hedge_id_pmap, halfedge(ed, m_tmesh))] * 2.0;
+        int jd = static_cast<int>(get(m_vertex_id_pmap, vj));
+        int j = m_new_id[jd];
+        A.set_coef(i, j, wij * L, true);
+        diagonal += -wij;
+      }
+      A.set_coef(i, i, diagonal, true);
+    }
+
+    MCFSKEL_DEBUG(std::cerr << "end LHS\n";)
+  }
+
+  /// Assemble the right hand side.
+  void assemble_RHS(typename SolverTraits::Vector& Bx,
+                    typename SolverTraits::Vector& By,
+                    typename SolverTraits::Vector& Bz)
+  {
+    MCFSKEL_DEBUG(std::cerr << "start RHS\n";)
+
+    Side_of_triangle_mesh<mTriangleMesh, Traits> test_inside(m_tmesh);
+
+    // assemble right columns of linear system
+    int nver = static_cast<int>(num_vertices(m_tmesh));
+    for (int i = 0; i < nver; ++i)
+    {
+      Bx[i] = 0;
+      By[i] = 0;
+      Bz[i] = 0;
+    }
+
+    BOOST_FOREACH(vertex_descriptor vd, vertices(m_tmesh))
+    {
+      int id = static_cast<int>(get(m_vertex_id_pmap, vd));
+      int i = m_new_id[id];
+
+      double oh, op = 0.0;
+      if (vd->is_fixed)
+      {
+        oh = 1.0 / m_zero_TH;
+      }
+      else
+      {
+        oh = m_omega_H;
+        if (m_is_medially_centered)
+        {
+          if (id < m_max_id)
+          {
+            if (test_inside(vd->pole) == CGAL::ON_BOUNDED_SIDE)
+            {
+              op = m_omega_P;
+            }
+          }
+        }
+      }
+      Bx[i + nver] = get_x(get(m_tmesh_point_pmap, vd)) * oh;
+      By[i + nver] = get_y(get(m_tmesh_point_pmap, vd)) * oh;
+      Bz[i + nver] = get_z(get(m_tmesh_point_pmap, vd)) * oh;
+      if (m_is_medially_centered)
+      {
+        double x = get_x(vd->pole);
+        double y = get_y(vd->pole);
+        double z = get_z(vd->pole);
+        Bx[i + nver * 2] = x * op;
+        By[i + nver * 2] = y * op;
+        Bz[i + nver * 2] = z * op;
+      }
+    }
+
+    MCFSKEL_DEBUG(std::cerr << "end RHS\n";)
+  }
+
+  /// The order of vertex id is the same as the traverse order.
+  void update_vertex_id()
+  {
+    m_new_id.clear();
+    int cnt = 0;
+
+    BOOST_FOREACH(vertex_descriptor vd, vertices(m_tmesh))
+    {
+      int id = static_cast<int>(get(m_vertex_id_pmap, vd));
+      m_new_id[id] = cnt++;
+    }
+  }
+
+  // --------------------------------------------------------------------------
+  // Edge collapse
+  // --------------------------------------------------------------------------
+
+  /// Track correspondent original surface points during collapse.
+  void update_pole(vertex_descriptor v0, vertex_descriptor vkept)
+  {
+    if (m_is_medially_centered)
+    {
+      const Point& pole0 = v0->pole;
+      const Point& pole1 = vkept->pole;
+
+      Point p1 = get(m_tmesh_point_pmap, vkept);
+      double dis_to_pole0 = m_traits.compute_squared_distance_3_object()(pole0, p1);
+      double dis_to_pole1 = m_traits.compute_squared_distance_3_object()(pole1, p1);
+      if (dis_to_pole0 < dis_to_pole1)
+        vkept->pole = v0->pole;
+    }
+  }
+
+  bool edge_should_be_collapsed(edge_descriptor ed)
+  {
+    halfedge_descriptor h = halfedge(ed, m_tmesh);
+
+    vertex_descriptor vi = source(h, m_tmesh);
+    vertex_descriptor vj = target(h, m_tmesh);
+
+    // an edge cannot be collapsed if both vertices are degenerate.
+    if (vi->is_fixed && vj->is_fixed) return false;
+
+    double sq_edge_length = m_traits.compute_squared_distance_3_object()(
+                              get(m_tmesh_point_pmap, vi),
+                              get(m_tmesh_point_pmap, vj));
+    return sq_edge_length < m_min_edge_length * m_min_edge_length;
+  }
+
+  // --------------------------------------------------------------------------
+  // Triangle split
+  // --------------------------------------------------------------------------
+
+  /// Compute the incident angles for all the halfedges.
+  void compute_incident_angle()
+  {
+    m_halfedge_angle.clear();
+    int ne = 2 * static_cast<int>(num_edges(m_tmesh));
+    m_halfedge_angle.resize(ne, 0);
+
+    int idx = 0;
+    BOOST_FOREACH(halfedge_descriptor hd, halfedges(m_tmesh))
+    {
+      put(m_hedge_id_pmap, hd, idx++);
+    }
+
+    BOOST_FOREACH(halfedge_descriptor hd, halfedges(m_tmesh))
+    {
+      int e_id = static_cast<int>(get(m_hedge_id_pmap, hd));
+
+      if (is_border(hd, m_tmesh))
+      {
+        m_halfedge_angle[e_id] = -1;
+      }
+      else
+      {
+        vertex_descriptor vi = source(hd, m_tmesh);
+        vertex_descriptor vj = target(hd, m_tmesh);
+        halfedge_descriptor hd_next = next(hd, m_tmesh);
+        vertex_descriptor vk = target(hd_next, m_tmesh);
+        Point pi = get(m_tmesh_point_pmap, vi);
+        Point pj = get(m_tmesh_point_pmap, vj);
+        Point pk = get(m_tmesh_point_pmap, vk);
+
+        double dis2_ij = m_traits.compute_squared_distance_3_object()(pi, pj);
+        double dis2_ik = m_traits.compute_squared_distance_3_object()(pi, pk);
+        double dis2_jk = m_traits.compute_squared_distance_3_object()(pj, pk);
+        double dis_ij = std::sqrt(dis2_ij);
+        double dis_ik = std::sqrt(dis2_ik);
+        double dis_jk = std::sqrt(dis2_jk);
+
+        // A degenerate triangle will never undergo a split (but rather a collapse...)
+        if (dis_ij < m_zero_TH || dis_ik < m_zero_TH || dis_jk < m_zero_TH)
+        {
+          m_halfedge_angle[e_id] = -1;
+        }
+        else
+        {
+          m_halfedge_angle[e_id] =
+              acos((dis2_ik + dis2_jk - dis2_ij) / (2.0 * dis_ik * dis_jk));
+        }
+      }
+    }
+  }
+
+  void normalize(Vector& v)
+  {
+    CGAL::Polygon_mesh_processing::internal::normalize(v, m_traits);
+  }
+
+  /// Project the vertex `vk` to the line of `vs` and `vt`.
+  Point project_vertex(const vertex_descriptor vs,
+                       const vertex_descriptor vt,
+                       const vertex_descriptor vk,
+                       const vertex_descriptor vnew)
+  {
+    Point ps = get(m_tmesh_point_pmap, vs);
+    Point pt = get(m_tmesh_point_pmap, vt);
+    Point pk = get(m_tmesh_point_pmap, vk);
+    Vector vec_st = m_traits.construct_vector_3_object()(ps, pt);
+    Vector vec_sk = m_traits.construct_vector_3_object()(ps, pk);
+
+    normalize(vec_st);
+    double t = m_traits.compute_scalar_product_3_object()(vec_st,vec_sk);
+    Point st = m_traits.construct_point_3_object()( get_x(vec_st) * t, get_y(vec_st) * t, get_z(vec_st) * t);
+    Point pn = m_traits.construct_point_3_object()( get_x(ps) + get_x(st), get_y(ps) + get_y(st), get_z(ps) + get_z(st));
+
+    // project the pole
+    if (m_is_medially_centered)
+    {
+      const Point& pole_s = vs->pole;
+      const Point& pole_t = vt->pole;
+      Vector pole_st = m_traits.construct_vector_3_object()(pole_s, pole_t );
+      normalize(pole_st);
+      vnew->pole =  m_traits.construct_translated_point_3_object()(
+                        pole_s,
+                        m_traits.construct_scaled_vector_3_object()(pole_st, t)
+                     );
+    }
+    return pn;
+  }
+
+  /// Split triangles with an angle greater than `alpha_TH`.
+  std::size_t split_flat_triangles()
+  {
+    compute_incident_angle();
+
+    // collect edges that should be split because
+    // both opposite angle are larger than the
+    // threshold
+    std::vector<edge_descriptor> edges_to_split;
+    BOOST_FOREACH(edge_descriptor ed, edges(m_tmesh))
+    {
+      halfedge_descriptor ei = halfedge(ed, m_tmesh);
+      halfedge_descriptor ej = opposite(ei, m_tmesh);
+      int ei_id = static_cast<int>(get(m_hedge_id_pmap, ei));
+      int ej_id = static_cast<int>(get(m_hedge_id_pmap, ej));
+
+      double angle_i = m_halfedge_angle[ei_id];
+      double angle_j = m_halfedge_angle[ej_id];
+      if (angle_i >= m_alpha_TH && angle_j >= m_alpha_TH)
+        edges_to_split.push_back( ed );
+    }
+
+    // now split the edge
+    std::size_t cnt = 0;
+    BOOST_FOREACH(edge_descriptor ed, edges_to_split)
+    {
+      halfedge_descriptor ei = halfedge(ed, m_tmesh);
+      halfedge_descriptor ej = opposite(ei, m_tmesh);
+      int ei_id = static_cast<int>(get(m_hedge_id_pmap, ei));
+      int ej_id = static_cast<int>(get(m_hedge_id_pmap, ej));
+
+      vertex_descriptor vs = source(ei, m_tmesh);
+      vertex_descriptor vt = target(ei, m_tmesh);
+
+      double angle_i = m_halfedge_angle[ei_id];
+      double angle_j = m_halfedge_angle[ej_id];
+
+      halfedge_descriptor ek = next(angle_i > angle_j ? ei : ej, m_tmesh);
+      vertex_descriptor vk = target(ek, m_tmesh);
+
+      // split the edge
+      halfedge_descriptor en = m_tmesh.split_edge(ei);
+      // split the incident faces
+      Euler::split_face(en, next(ei,m_tmesh), m_tmesh);
+      if (! is_border(ej,m_tmesh))
+      {
+        Euler::split_face(ej, next(next(ej,m_tmesh),m_tmesh), m_tmesh);
+      }
+
+      // set id for new vertex
+      put(m_vertex_id_pmap, target(en,m_tmesh), m_vertex_id_count++);
+      Point pn = project_vertex(vs, vt, vk, target(en, m_tmesh));
+      // set point of new vertex
+      put(m_tmesh_point_pmap, target(en,m_tmesh), pn);
+      target(en,m_tmesh)->vertices.clear(); // do no copy the info
+      ++cnt;
+    }
+    return cnt;
+  }
+
+  // --------------------------------------------------------------------------
+  // Degeneracy detection
+  // --------------------------------------------------------------------------
+
+  /// Test degeneracy of a vertex by counting the euler characteristic of
+  /// its local neighborhood disk.
+  std::size_t detect_degeneracies_in_disk()
+  {
+    std::size_t num_fixed = 0;
+    BOOST_FOREACH(vertex_descriptor v, vertices(m_tmesh))
+    {
+      if (!v->is_fixed)
+      {
+        bool willbefixed = internal::is_vertex_degenerate(m_tmesh, m_tmesh_point_pmap,
+                                                          v, m_min_edge_length, m_traits);
+        if (willbefixed)
+        {
+          v->is_fixed=true;
+          ++num_fixed;
+        }
+      }
+    }
+
+    MCFSKEL_INFO(std::cerr << "fixed " << num_fixed << " vertices.\n";)
+
+    return num_fixed;
+  }
+
+  // --------------------------------------------------------------------------
+  // Voronoi pole
+  // --------------------------------------------------------------------------
+
+  /// Compute the Voronoi pole for surface vertices. The pole is the furthest
+  /// vertex in the Voronoi cell containing the given vertex.
+  void compute_voronoi_pole()
+  {
+    MCFSKEL_DEBUG(std::cout << "start compute_voronoi_pole\n";)
+    compute_vertex_normal();
+
+    std::vector<std::pair<Exact_point, vertex_descriptor> > points;
+    std::vector<std::vector<int> > point_to_pole(num_vertices(m_tmesh));
+
+    BOOST_FOREACH(vertex_descriptor v, vertices(m_tmesh))
+    {
+      const Point& input_pt = get(m_tmesh_point_pmap, v);
+      Exact_point tp(get_x(input_pt), get_y(input_pt), get_z(input_pt));
+      points.push_back(std::make_pair(tp, v));
+    }
+
+    Delaunay T(points.begin(), points.end());
+
+    Finite_cells_iterator cit;
+    int cell_id = 0;
+    std::vector<Point> cell_dual;
+    cell_dual.reserve(T.number_of_cells());
+    for (cit = T.finite_cells_begin(); cit != T.finite_cells_end(); ++cit)
+    {
+      Cell_handle cell = cit;
+      Exact_point point = T.dual(cell);
+      cell_dual.push_back(
+        m_traits.construct_point_3_object()(
+          to_double(point.x()),
+          to_double(point.y()),
+          to_double(point.z())
+        )
+      );
+      // each cell has 4 incident vertices
+      for (int i = 0; i < 4; ++i)
+      {
+        TriVertex_handle vt = cell->vertex(i);
+        std::size_t id = get(m_vertex_id_pmap, vt->info());
+        point_to_pole[id].push_back(cell_id);
+      }
+      ++cell_id;
+    }
+
+    typedef std::pair<Exact_point, vertex_descriptor> Pair_type;
+    BOOST_FOREACH(const Pair_type& p, points)
+    {
+      std::size_t vid = get(m_vertex_id_pmap, p.second);
+      Point surface_point = get(m_tmesh_point_pmap, p.second);
+
+      double max_neg_t = 1;
+      int max_neg_i = -1;
+
+      for (size_t j = 0; j < point_to_pole[vid].size(); ++j)
+      {
+        int pole_id = point_to_pole[vid][j];
+        Point cell_point = cell_dual[pole_id];
+        Vector vt = m_traits.construct_vector_3_object()(surface_point, cell_point);
+        Vector n = m_normals[vid];
+
+        double t = m_traits.compute_scalar_product_3_object()(vt, n);
+
+        // choose the one with maximum distance along the normal
+        if (t < 0 && t < max_neg_t)
+        {
+          max_neg_i = pole_id;
+          max_neg_t = t;
+        }
+      }
+
+      p.second->pole = cell_dual[max_neg_i];
+    }
+    m_are_poles_computed = true;
+  }
+
+  /// Compute an approximate vertex normal for all vertices.
+  void compute_vertex_normal()
+  {
+    namespace PMP = CGAL::Polygon_mesh_processing;
+
+    boost::unordered_map<face_descriptor, Vector> normals;
+    boost::associative_property_map<
+      boost::unordered_map<face_descriptor, Vector> > normals_pmap(normals);
+    PMP::compute_face_normals(m_tmesh, normals_pmap);
+
+    m_normals.resize(num_vertices(m_tmesh));
+
+    BOOST_FOREACH(vertex_descriptor v, vertices(m_tmesh))
+    {
+      int vid = static_cast<int>(get(m_vertex_id_pmap, v));
+      m_normals[vid] = PMP::compute_vertex_normal(v
+                          , m_tmesh
+                          , PMP::parameters::geom_traits(m_traits)
+                          .face_normal_map(normals_pmap));
+    }
+  }
+
+  // --------------------------------------------------------------------------
+  // Debug
+  // --------------------------------------------------------------------------
+
+  void print_edges()
+  {
+    std::map<halfedge_descriptor, bool> visited;
+
+    BOOST_FOREACH(halfedge_descriptor hd, halfedges(m_tmesh))
+    {
+      if (!visited[hd])
+      {
+        vertex_descriptor vi = source(hd, m_tmesh);
+        vertex_descriptor vj = target(hd, m_tmesh);
+        size_t vi_idx = get(m_vertex_id_pmap, vi);
+        size_t vj_idx = get(m_vertex_id_pmap, vj);
+        std::cout << vi_idx << " " << vj_idx << "\n";
+
+        visited[hd] = true;
+        visited[opposite(hd,m_tmesh)] = true;
+      }
+    }
+  }
+};
+
+template <class TriangleMesh,
+          class Traits_,
+          class VertexPointMap_,
+          class SolverTraits_>
+std::size_t Mean_curvature_flow_skeletonization<TriangleMesh, Traits_, VertexPointMap_, SolverTraits_>::collapse_short_edges()
+{
+  std::size_t cnt=0, prev_cnt=0;
+
+  std::set<edge_descriptor> edges_to_collapse, non_topologically_valid_collapses;
+
+  BOOST_FOREACH(edge_descriptor ed, edges(m_tmesh))
+    if ( edge_should_be_collapsed(ed) )
+      edges_to_collapse.insert(ed);
+
+  do{
+    prev_cnt=cnt;
+    while(!edges_to_collapse.empty())
+    {
+      edge_descriptor ed = *edges_to_collapse.begin();
+      edges_to_collapse.erase(edges_to_collapse.begin());
+
+      // skip the edge is it became long enough
+      if ( !edge_should_be_collapsed(ed) ) continue;
+
+      if ( !Euler::does_satisfy_link_condition(ed,m_tmesh) )
+      {
+        non_topologically_valid_collapses.insert(ed);
+        continue;
+      }
+
+      halfedge_descriptor h = halfedge(ed, m_tmesh);
+
+      vertex_descriptor vi = source(h, m_tmesh);
+      vertex_descriptor vj = target(h, m_tmesh);
+
+      Point p = m_traits.construct_midpoint_3_object()(
+                  get(vertex_point, m_tmesh, vi),
+                  get(vertex_point, m_tmesh, vj) );
+
+      // invalidate the edges that will be collapsed
+      edges_to_collapse.erase(edge(prev(h, m_tmesh), m_tmesh));
+      edges_to_collapse.erase(edge(prev(opposite(h, m_tmesh), m_tmesh), m_tmesh));
+
+      non_topologically_valid_collapses.erase(ed);
+      non_topologically_valid_collapses.erase(edge(prev(h, m_tmesh), m_tmesh));
+      non_topologically_valid_collapses.erase(edge(prev(opposite(h, m_tmesh), m_tmesh), m_tmesh));
+
+      // the mesh is closed, the target of h is always the one kept
+      put(m_tmesh_point_pmap, vj, p);
+      std::vector<Input_vertex_descriptor>& vec_kept = vj->vertices;
+      std::vector<Input_vertex_descriptor>& vec_removed = vi->vertices;
+      vec_kept.insert(vec_kept.end(), vec_removed.begin(), vec_removed.end());
+      if (vi->is_fixed) vj->is_fixed=true;
+      update_pole(vi, vj);
+
+      vertex_descriptor v = Euler::collapse_edge(ed, m_tmesh);
+
+      CGAL_assertion(vj==v);
+
+      BOOST_FOREACH(edge_descriptor oed, out_edges(v, m_tmesh))
+        if ( edge_should_be_collapsed(oed) ) edges_to_collapse.insert(oed);
+
+      ++cnt;
+    }
+    if (prev_cnt==cnt) break;
+    edges_to_collapse.swap(non_topologically_valid_collapses);
+  } while(!edges_to_collapse.empty());
+
+  return cnt;
+}
+
+
+} //namespace CGAL
+
+#endif // CGAL_MEAN_CURVATURE_FLOW_SKELETONIZATION_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mean_value_coordinates_parameterizer_3.h b/3rdparty/CGAL/include/CGAL/Mean_value_coordinates_parameterizer_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mean_value_coordinates_parameterizer_3.h
rename to 3rdparty/CGAL/include/CGAL/Mean_value_coordinates_parameterizer_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Memory_sizer.h b/3rdparty/CGAL/include/CGAL/Memory_sizer.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Memory_sizer.h
rename to 3rdparty/CGAL/include/CGAL/Memory_sizer.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_2/Clusters.h b/3rdparty/CGAL/include/CGAL/Mesh_2/Clusters.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_2/Clusters.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_2/Clusters.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_2/Do_not_refine_edges.h b/3rdparty/CGAL/include/CGAL/Mesh_2/Do_not_refine_edges.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_2/Do_not_refine_edges.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_2/Do_not_refine_edges.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_2/Face_badness.h b/3rdparty/CGAL/include/CGAL/Mesh_2/Face_badness.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_2/Face_badness.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_2/Face_badness.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_2/Lipschitz_sizing_field_2.h b/3rdparty/CGAL/include/CGAL/Mesh_2/Lipschitz_sizing_field_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_2/Lipschitz_sizing_field_2.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_2/Lipschitz_sizing_field_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_2/Lloyd_move_2.h b/3rdparty/CGAL/include/CGAL/Mesh_2/Lloyd_move_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_2/Lloyd_move_2.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_2/Lloyd_move_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_2/Mesh_global_optimizer_2.h b/3rdparty/CGAL/include/CGAL/Mesh_2/Mesh_global_optimizer_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_2/Mesh_global_optimizer_2.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_2/Mesh_global_optimizer_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_2/Mesh_sizing_field.h b/3rdparty/CGAL/include/CGAL/Mesh_2/Mesh_sizing_field.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_2/Mesh_sizing_field.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_2/Mesh_sizing_field.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_2/Output_stream.h b/3rdparty/CGAL/include/CGAL/Mesh_2/Output_stream.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_2/Output_stream.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_2/Output_stream.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_2/README b/3rdparty/CGAL/include/CGAL/Mesh_2/README
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_2/README
rename to 3rdparty/CGAL/include/CGAL/Mesh_2/README
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_2/Refine_edges.h b/3rdparty/CGAL/include/CGAL/Mesh_2/Refine_edges.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_2/Refine_edges.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_2/Refine_edges.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_2/Refine_edges_visitor.h b/3rdparty/CGAL/include/CGAL/Mesh_2/Refine_edges_visitor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_2/Refine_edges_visitor.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_2/Refine_edges_visitor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_2/Refine_edges_with_clusters.h b/3rdparty/CGAL/include/CGAL/Mesh_2/Refine_edges_with_clusters.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_2/Refine_edges_with_clusters.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_2/Refine_edges_with_clusters.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_2/Refine_faces.h b/3rdparty/CGAL/include/CGAL/Mesh_2/Refine_faces.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_2/Refine_faces.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_2/Refine_faces.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_2/Sizing_field_2.h b/3rdparty/CGAL/include/CGAL/Mesh_2/Sizing_field_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_2/Sizing_field_2.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_2/Sizing_field_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_2/Uniform_sizing_field_2.h b/3rdparty/CGAL/include/CGAL/Mesh_2/Uniform_sizing_field_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_2/Uniform_sizing_field_2.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_2/Uniform_sizing_field_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/C3T3_helpers.h b/3rdparty/CGAL/include/CGAL/Mesh_3/C3T3_helpers.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/C3T3_helpers.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/C3T3_helpers.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Cell_criteria_visitor_with_balls.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Cell_criteria_visitor_with_balls.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Cell_criteria_visitor_with_balls.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Cell_criteria_visitor_with_balls.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Concurrent_mesher_config.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Concurrent_mesher_config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Concurrent_mesher_config.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Concurrent_mesher_config.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Creator_weighted_point_3.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Creator_weighted_point_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Creator_weighted_point_3.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Creator_weighted_point_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Detect_features_in_polyhedra.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Detect_features_in_polyhedra.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Detect_features_in_polyhedra.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Detect_features_in_polyhedra.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Detect_features_in_polyhedra_fwd.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Detect_features_in_polyhedra_fwd.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Detect_features_in_polyhedra_fwd.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Detect_features_in_polyhedra_fwd.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Detect_polylines_in_polyhedra.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Detect_polylines_in_polyhedra.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Detect_polylines_in_polyhedra.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Detect_polylines_in_polyhedra.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Detect_polylines_in_polyhedra_fwd.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Detect_polylines_in_polyhedra_fwd.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Detect_polylines_in_polyhedra_fwd.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Detect_polylines_in_polyhedra_fwd.h
diff --git a/3rdparty/CGAL/include/CGAL/Mesh_3/Dump_c3t3.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Dump_c3t3.h
new file mode 100644
index 0000000..218b350
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Mesh_3/Dump_c3t3.h
@@ -0,0 +1,113 @@
+// Copyright (c) 2012  GeometryFactory Sarl (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
+// 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(s)     : Laurent Rineau
+
+#ifndef CGAL_MESH_3_DUMP_C3T3_H
+#define CGAL_MESH_3_DUMP_C3T3_H
+
+#include <string>
+#include <CGAL/Mesh_3/io_signature.h>
+#include <CGAL/Mesh_3/Mesh_complex_3_in_triangulation_3_base.h>
+#include <CGAL/is_streamable.h>
+#include <fstream>
+
+namespace CGAL {
+
+template <typename C3t3, 
+          bool is_streamable = 
+            is_streamable<typename C3t3::Triangulation::Vertex>::value &&
+            is_streamable<typename C3t3::Triangulation::Cell>::value
+            &&
+            (is_streamable<typename C3t3::Surface_patch_index>::value ||
+             Output_rep<typename C3t3::Surface_patch_index>::is_specialized)
+            &&
+            (is_streamable<typename C3t3::Subdomain_index>::value ||
+             Output_rep<typename C3t3::Subdomain_index>::is_specialized)
+          >
+struct Dump_c3t3 {
+  void dump_c3t3(const C3t3& c3t3, std::string prefix) const {
+    std::clog<<"======dump c3t3===== to: " << prefix << std::endl;
+    std::ofstream medit_file((prefix+".mesh").c_str());
+    medit_file.precision(17);
+    CGAL::output_to_medit(medit_file, c3t3, false, true);
+    medit_file.close();
+
+    std::string bin_filename = prefix;
+    bin_filename += ".binary.cgal";
+    std::ofstream bin_file(bin_filename.c_str(),
+                           std::ios_base::binary | std::ios_base::out);
+    std::string signature = CGAL::Get_io_signature<C3t3>()();
+    CGAL_assertion(signature != std::string());
+    bin_file << "binary CGAL c3t3 " << signature << "\n";
+    CGAL::set_binary_mode(bin_file);
+    bin_file << c3t3;
+  }
+}; // end struct template Dump_c3t3<C3t3, bool>
+
+template <typename C3t3>
+struct Dump_c3t3<C3t3, false> {
+  void dump_c3t3(const C3t3&, std::string) {
+    std::cerr << "Warning " << __FILE__ << ":" << __LINE__ << "\n"
+              << "  the c3t3 object of following type:\n"
+              << typeid(C3t3).name() << std::endl
+              << "  cannot be dumped because some types are not streamable:\n";
+    if(!is_streamable<typename C3t3::Triangulation::Vertex>::value) {
+      std::cerr << "     - C3t3::Triangulation::Vertex is not streamble\n";
+      std::cerr << "       "
+                << typeid(typename C3t3::Triangulation::Vertex).name()
+                << "\n";
+    }
+
+    if(!is_streamable<typename C3t3::Triangulation::Cell>::value) {
+      std::cerr << "     - C3t3::Triangulation::Cell is not streamble\n";
+      std::cerr << "       "
+                << typeid(typename C3t3::Triangulation::Cell).name()
+                << "\n";
+    }
+
+    if(!is_streamable<typename C3t3::Surface_patch_index>::value &&
+       !CGAL::Output_rep<typename C3t3::Surface_patch_index>::is_specialized)
+    {
+      std::cerr << "     - C3t3::Surface_patch_index is not streamable\n";
+      std::cerr << "       "
+                << typeid(typename C3t3::Surface_patch_index).name()
+                << "\n";
+    }
+    if(!is_streamable<typename C3t3::Subdomain_index>::value &&
+       !CGAL::Output_rep<typename C3t3::Subdomain_index>::is_specialized)
+    {
+      std::cerr << "     - C3t3::Subdomain_index is not streamable\n";      
+      std::cerr << "       "
+                << typeid(typename C3t3::Subdomain_index).name()
+                << "\n";
+    }
+  }
+}; // end struct template specialization Dump_c3t3<C3t3, false>
+
+template <typename C3t3>
+void dump_c3t3(const C3t3& c3t3, std::string prefix) {
+  if(!prefix.empty()) {
+    Dump_c3t3<C3t3> dump;
+    dump.dump_c3t3(c3t3, prefix);
+  }
+}
+
+} // end namespace CGAL
+
+#endif // CGAL_MESH_3_DUMP_C3T3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Facet_criteria_visitor_with_balls.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Facet_criteria_visitor_with_balls.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Facet_criteria_visitor_with_balls.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Facet_criteria_visitor_with_balls.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Facet_on_same_surface_criterion.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Facet_on_same_surface_criterion.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Facet_on_same_surface_criterion.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Facet_on_same_surface_criterion.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Has_features.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Has_features.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Has_features.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Has_features.h
diff --git a/3rdparty/CGAL/include/CGAL/Mesh_3/Image_to_labeled_function_wrapper.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Image_to_labeled_function_wrapper.h
new file mode 100644
index 0000000..87909d5
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Mesh_3/Image_to_labeled_function_wrapper.h
@@ -0,0 +1,152 @@
+// Copyright (c) 2009 INRIA Sophia-Antipolis (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
+// 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(s)     : Stéphane Tayeb
+//
+//******************************************************************************
+// File Description :
+// Image_to_labeled_function_wrapper declaration and implementation. See
+// class description.
+//******************************************************************************
+
+#ifndef CGAL_MESH_3_IMAGE_TO_LABELED_FUNCTION_WRAPPER_H
+#define CGAL_MESH_3_IMAGE_TO_LABELED_FUNCTION_WRAPPER_H
+
+#include <CGAL/Image_3.h>
+#include <CGAL/function_objects.h>
+
+
+namespace CGAL {
+
+namespace Mesh_3 {
+
+/**
+ * @class Image_to_labeled_function_wrapper
+ *
+ * Wraps a labeled image into a labeled function which takes his values into
+ * N. Uses trilinear interpolation.
+ * Note: Image has to be labeled with unsigned char
+ */
+template<class Image_,
+         class BGT,
+         typename Image_word_type = unsigned char,
+         typename Return_type = int,
+         typename Transform = Identity<Return_type>,
+         bool labeled_image = true,
+         bool use_trilinear_interpolation=true>
+class Image_to_labeled_function_wrapper
+{
+public:
+  // Types
+  typedef Return_type return_type;
+  typedef Image_word_type word_type;
+  typedef typename BGT::Point_3   Point_3;
+
+  /// Constructor
+  Image_to_labeled_function_wrapper(const Image_& image, 
+                                    const Transform& transform = Transform(),
+                                    const Return_type value_outside = 0)
+    : r_im_(image)
+    , transform(transform)
+    , value_outside(value_outside)
+  {
+  }
+
+  // Default copy constructor and assignment operator are ok
+
+  /// Destructor
+  ~Image_to_labeled_function_wrapper() {}
+
+  /**
+   * Returns an int corresponding to the label at point \c p
+   * @param p the input point
+   * @return the label at point \c p
+   */
+  return_type operator()(const Point_3& p, const bool = true) const
+  {
+    return eval(p,
+                CGAL::Boolean_tag<use_trilinear_interpolation>(),
+                CGAL::Boolean_tag<labeled_image>());
+  }
+
+private:
+  return_type eval(const Point_3& p,
+                   CGAL::Tag_true /*trilinear*/,
+                   CGAL::Tag_true /*labeled*/) const
+  {
+    return static_cast<return_type>(transform(
+      r_im_.template labellized_trilinear_interpolation<Image_word_type>(
+          CGAL::to_double(p.x()),
+          CGAL::to_double(p.y()),
+          CGAL::to_double(p.z()),
+          value_outside)));
+  }
+
+  return_type eval(const Point_3& p,
+                   CGAL::Tag_true /*trilinear*/,
+                   CGAL::Tag_false /*labeled*/) const
+  {
+    return transform(
+        r_im_.template trilinear_interpolation<Image_word_type, double>(
+          CGAL::to_double(p.x()),
+          CGAL::to_double(p.y()),
+          CGAL::to_double(p.z()),
+          value_outside));
+  }
+
+  template <typename Labeled_tag>
+  return_type eval(const Point_3& p,
+                   CGAL::Tag_false /*trilinear*/,
+                   Labeled_tag /*labeled*/) const
+  {
+    const std::ptrdiff_t px = static_cast<std::ptrdiff_t>(p.x()/r_im_.vx());
+    const std::ptrdiff_t py = static_cast<std::ptrdiff_t>(p.y()/r_im_.vy());
+    const std::ptrdiff_t pz = static_cast<std::ptrdiff_t>(p.z()/r_im_.vz());
+
+    const std::ptrdiff_t dimx = static_cast<std::ptrdiff_t>(r_im_.xdim());
+    const std::ptrdiff_t dimy = static_cast<std::ptrdiff_t>(r_im_.ydim());
+    const std::ptrdiff_t dimz = static_cast<std::ptrdiff_t>(r_im_.zdim());
+
+    if(px < 0 ||
+       py < 0 ||
+       pz < 0 ||
+       px+1 >= dimx ||
+       py+1 >= dimy ||
+       pz+1 >= dimz)
+    {
+      return 0;
+    }
+
+    const word_type* data = static_cast<const word_type*>(r_im_.data());
+    return static_cast<return_type>(transform(
+              data[pz*dimy*dimx + py*dimx + px]));
+  }
+
+  /// Labeled image to wrap
+  const Image_& r_im_;
+  const Transform transform;
+  const Return_type value_outside;
+
+};  // end class Image_to_labeled_function_wrapper
+
+
+}  // end namespace Mesh_3
+
+}  // end namespace CGAL
+
+#endif // CGAL_MESH_3_IMAGE_TO_LABELED_FUNCTION_WRAPPER_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Implicit_surface_mesher_visitor.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Implicit_surface_mesher_visitor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Implicit_surface_mesher_visitor.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Implicit_surface_mesher_visitor.h
diff --git a/3rdparty/CGAL/include/CGAL/Mesh_3/Implicit_to_labeled_function_wrapper.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Implicit_to_labeled_function_wrapper.h
new file mode 100644
index 0000000..c109b4e
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Mesh_3/Implicit_to_labeled_function_wrapper.h
@@ -0,0 +1,156 @@
+// Copyright (c) 2009 INRIA Sophia-Antipolis (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
+// 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(s)     : Stéphane Tayeb
+//
+//******************************************************************************
+// File Description :
+// Implicit_to_labeling_function_wrapper and
+// Implicit_vector_to_labeling_function_wrapper class declaration
+// and implementation.
+//
+// See classes description to have more information.
+//******************************************************************************
+
+#ifndef CGAL_MESH_3_IMPLICIT_TO_LABELED_FUNCTION_WRAPPER_H
+#define CGAL_MESH_3_IMPLICIT_TO_LABELED_FUNCTION_WRAPPER_H
+
+#if defined(BOOST_MSVC)
+#  pragma warning(push)
+#  pragma warning(disable:4180) // qualifier applied to function type has no meaning; ignored
+#endif
+
+#define CGAL_DEPRECATED_HEADER "<CGAL/Mesh_3/Implicit_to_labeled_function_wrapper.h>"
+#define CGAL_REPLACEMENT_HEADER "<CGAL/Implicit_to_labeling_function_wrapper.h>"
+#include <CGAL/internal/deprecation_warning.h>
+
+#include <vector>
+
+namespace CGAL {
+
+namespace Mesh_3 {
+
+#include <CGAL/config.h>
+
+/**
+ * @class Implicit_to_labeled_function_wrapper
+ *
+ * This class is designed to wrap an implicit function which describes a domain
+ * by [p is inside if f(p)<0] to a function which takes its values into {0,1}.
+ * f(p)=0 means that p is outside the domain.
+ */
+template<class Function_, class BGT>
+class Implicit_to_labeled_function_wrapper
+{
+public:
+  // Types
+  typedef int                     return_type;
+  typedef typename BGT::Point_3   Point_3;
+
+  /// Constructor
+  Implicit_to_labeled_function_wrapper(const Function_& f)
+    : r_f_(f) {}
+
+  // Default copy constructor and assignment operator are ok
+
+  /// Destructor
+  ~Implicit_to_labeled_function_wrapper() {}
+
+  /// Operator ()
+  return_type operator()(const Point_3& p, const bool = true) const
+  {
+    return ( (r_f_(p)<0) ? 1 : 0 );
+  }
+
+private:
+  /// Function to wrap
+  const Function_& r_f_;
+
+};  // end class Implicit_to_labeled_function_wrapper
+
+
+
+/**
+ * \deprecated
+ *
+ * @class Implicit_vector_to_labeled_function_wrapper
+ *
+ * Wraps a set of implicit function [f1,f2,...] to one function F which
+ * takes its values into N.
+ *
+ * Let p be a point.
+ * F(p) = 0b000000(f2(p)<0)(f1(p)<0)
+ *
+ * It can handle at most 8 functions.
+ */
+template<class Function_, class BGT>
+class Implicit_vector_to_labeled_function_wrapper
+{
+public:
+  // Types
+  typedef int                       return_type;
+  typedef std::vector<Function_*>   Function_vector;
+  typedef typename BGT::Point_3     Point_3;
+
+  /// Constructor
+  Implicit_vector_to_labeled_function_wrapper(const std::vector<Function_*>& v)
+    : function_vector_(v)
+  {
+    if ( v.size() > 8 )
+    {
+      CGAL_error_msg("We support at most 8 functions !");
+    }
+  }
+
+  // Default copy constructor and assignment operator are ok
+
+  /// Destructor
+  ~Implicit_vector_to_labeled_function_wrapper() {}
+
+  /// Operator ()
+  return_type operator()(const Point_3& p, const bool = true) const
+  {
+    const int nb_func = static_cast<int>(function_vector_.size());
+    char bits = 0;
+    for ( int i = 0 ; i < nb_func ; ++i )
+    {
+      // Insert value into bits : we compute fi(p) and insert result at
+      // bit i of bits
+      bits = char(bits | ( ((*function_vector_[i])(p) < 0) << i ));
+    }
+
+    return ( static_cast<return_type>(bits) );
+  }
+
+private:
+  /// Functions to wrap
+  const Function_vector function_vector_;
+
+};  // end class Implicit_to_labeled_function_wrapper
+
+}  // end namespace Mesh_3
+
+}  // end namespace CGAL
+
+
+
+#if defined(BOOST_MSVC)
+#  pragma warning(pop)
+#endif
+
+#endif // CGAL_MESH_3_IMPLICIT_TO_LABELED_FUNCTION_WRAPPER_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Labeled_mesh_domain_3.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Labeled_mesh_domain_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Labeled_mesh_domain_3.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Labeled_mesh_domain_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Lloyd_move.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Lloyd_move.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Lloyd_move.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Lloyd_move.h
diff --git a/3rdparty/CGAL/include/CGAL/Mesh_3/Mesh_complex_3_in_triangulation_3_base.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Mesh_complex_3_in_triangulation_3_base.h
new file mode 100644
index 0000000..9fa934e
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Mesh_3/Mesh_complex_3_in_triangulation_3_base.h
@@ -0,0 +1,981 @@
+// Copyright (c) 2003-2009  INRIA Sophia-Antipolis (France).
+// Copyright (c) 2013       GeometryFactory Sarl (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
+// 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(s)     : Laurent Rineau, Stéphane Tayeb
+//
+//******************************************************************************
+// File Description : Implements class Mesh_complex_3_in_triangulation_3.
+//******************************************************************************
+
+#ifndef CGAL_MESH_3_MESH_COMPLEX_3_IN_TRIANGULATION_3_BASE_H
+#define CGAL_MESH_3_MESH_COMPLEX_3_IN_TRIANGULATION_3_BASE_H
+
+#include <CGAL/Mesh_3/config.h>
+
+#include <CGAL/Mesh_3/utilities.h>
+#include <CGAL/iterator.h>
+#include <CGAL/IO/File_medit.h>
+#include <CGAL/IO/File_maya.h>
+#include <CGAL/Bbox_3.h>
+#include <iostream>
+#include <fstream>
+#include <CGAL/Mesh_3/io_signature.h>
+#include <CGAL/Union_find.h>
+
+#ifdef CGAL_LINKED_WITH_TBB
+  #include <tbb/atomic.h>
+#endif
+
+namespace CGAL {
+namespace Mesh_3 {
+
+  namespace details {
+
+    template <typename Tr>
+    class C3t3_helper_class
+    {
+    protected:
+      typedef typename Tr::Vertex_handle Vertex_handle;
+      typedef typename Tr::Cell_handle   Cell_handle;
+      typedef typename Tr::Facet         Facet;
+      typedef typename Tr::Edge          Edge;
+
+      typedef std::pair<Vertex_handle, Vertex_handle> Pair_of_vertices;
+
+      // computes and return an ordered pair of Vertex
+      Pair_of_vertices
+      make_ordered_pair(const Vertex_handle vh1, const Vertex_handle vh2) const {
+	if (vh1 < vh2) {
+	  return std::make_pair(vh1, vh2);
+	}
+	else {
+	  return std::make_pair(vh2, vh1);
+	}
+      }
+
+      // same from an Edge
+      Pair_of_vertices
+      make_ordered_pair(const Edge e) const {
+        return make_ordered_pair(e.first->vertex(e.second),
+                                 e.first->vertex(e.third));
+      }
+
+      Facet canonical_facet(Cell_handle c, int i) const {
+        Cell_handle c2 = c->neighbor(i);
+        return (c2 < c) ? std::make_pair(c2,c2->index(c)) : std::make_pair(c,i);
+      }
+
+    }; // end class template C3t3_helper_class
+
+  } // end namespace Mesh_3::details
+
+/**
+ * @class Mesh_complex_3_in_triangulation_3_base
+ * @brief A data-structure to represent and maintain a 3D complex embedded
+ * in a 3D triangulation.
+ */
+template<typename Tr, typename Concurrency_tag>
+class Mesh_complex_3_in_triangulation_3_base
+  : public details::C3t3_helper_class<Tr>
+{
+  typedef Mesh_complex_3_in_triangulation_3_base<Tr, Concurrency_tag> Self;
+  typedef details::C3t3_helper_class<Tr> Base;
+
+public:
+  // Triangulation types
+  typedef Tr                            Triangulation;
+  typedef typename Tr::Vertex_handle    Vertex_handle;
+  typedef typename Tr::Cell_handle      Cell_handle;
+  typedef typename Tr::Facet            Facet;
+  typedef typename Tr::Edge             Edge;
+  typedef typename Tr::size_type        size_type;
+
+  // Indices types
+  typedef typename Tr::Cell::Subdomain_index      Subdomain_index;
+  typedef typename Tr::Cell::Surface_patch_index  Surface_patch_index;
+  typedef typename Tr::Vertex::Index              Index;
+
+  enum Face_status{ NOT_IN_COMPLEX = 0,
+                    ISOLATED = 1, // - An ISOLATED edge is a marked edge,
+                                  //   without any incident facets.
+                    BOUNDARY,     // - An edge is on BOUNDARY if it has only
+                                  //   one incident facet.
+                                  // - A vertex is on BOUNDARY if all its
+                                  //   incident edges are REGULAR or on
+                                  //   BOUNDARY, at least one is on
+                                  //   BOUNDARY, and the incident facets
+                                  //   form only one connected component.
+                    REGULAR,      // - A facet that is in the complex is
+                                  //   REGULAR.
+                                  // - An edge is REGULAR if it has
+                                  //   exactly two incident facets.
+                                  // - A vertex is REGULAR if all it
+                                  //   incident edges are REGULAR, and the
+                                  //   incident facets form only one
+                                  //   connected component.
+                    SINGULAR};    // - SINGULAR is for all other cases.
+
+  //-------------------------------------------------------
+  // Constructors / Destructors
+  //-------------------------------------------------------
+  /**
+   * @brief Constructor
+   * Builds an empty 3D complex.
+   */
+  Mesh_complex_3_in_triangulation_3_base()
+    : Base()
+    , tr_()
+    , edge_facet_counter_() //TODO: parallel!
+    , manifold_info_initialized_(false) //TODO: parallel!
+  {
+    // We don't put it in the initialization list because
+    // tbb::atomic has no contructors
+    number_of_facets_ = 0;
+    number_of_cells_ = 0;
+  }
+
+  /// Copy constructor
+  Mesh_complex_3_in_triangulation_3_base(const Self& rhs)
+    : Base()
+    , tr_(rhs.tr_)
+    , edge_facet_counter_(rhs.edge_facet_counter_)
+    , manifold_info_initialized_(rhs.manifold_info_initialized_)
+  {
+    number_of_facets_ = rhs.number_of_facets_;
+    number_of_cells_ = rhs.number_of_cells_;
+  }
+
+  /// Destructor
+  ~Mesh_complex_3_in_triangulation_3_base() {}
+
+  void clear() {
+    number_of_cells_ = 0;
+    number_of_facets_ = 0;
+    clear_manifold_info();
+    tr_.clear();
+  }
+
+  /// Assignment operator
+  Self& operator=(Self rhs)
+  {
+    swap(rhs);
+    return *this;
+  }
+
+  /// Returns the reference to the triangulation
+  Triangulation& triangulation() { return tr_; }
+  /// Returns a const reference to the triangulation
+  const Triangulation& triangulation() const { return tr_; }
+
+
+  /// Adds facet \c facet to the 2D complex, with surface index \c index
+  void add_to_complex(const Facet& facet, const Surface_patch_index& index)
+  {
+    add_to_complex(facet.first, facet.second, index);
+  }
+
+  /// Adds facet(\c cell, \c i) to the 2D complex, with surface index \c index
+  void add_to_complex(const Cell_handle& cell,
+                      const int i,
+                      const Surface_patch_index& index);
+
+  /// Removes facet \c facet from 2D complex
+  void remove_from_complex(const Facet& facet);
+
+  /// Removes facet(\c cell, \c i) from 2D complex
+  void remove_from_complex(const Cell_handle& c, const int i) {
+    remove_from_complex(Facet(c, i));
+  }
+
+  /// Sets surface index of facet \c facet to \c index
+  void set_surface_patch_index(const Facet& f, const Surface_patch_index& index)
+  {
+    set_surface_patch_index(f.first, f.second, index);
+  }
+
+  /// Sets surface index of facet(\c cell, \c i) to \c index
+  void set_surface_patch_index(const Cell_handle& cell,
+                         const int i,
+                         const Surface_patch_index& index) const
+  {
+    cell->set_surface_patch_index(i, index);
+  }
+
+  /// Returns `NOT_IN_COMPLEX`, `BOUNDARY`, `REGULAR`, or `SINGULAR`,
+  /// depending on the number of incident facets in the complex, and the
+  /// number of connected components of its link
+  Face_status face_status(const Vertex_handle v) const
+  {
+    if(!manifold_info_initialized_) init_manifold_info();
+    const std::size_t n = v->cached_number_of_incident_facets();
+
+    if(n == 0) return NOT_IN_COMPLEX;
+
+    //test incident edges for REGULARITY and count BOUNDARY edges
+    typename std::vector<Edge> edges;
+    edges.reserve(64);
+    tr_.incident_edges(v, std::back_inserter(edges));
+    int number_of_boundary_incident_edges = 0; // could be a bool
+    for (typename std::vector<Edge>::iterator
+           eit=edges.begin(), end = edges.end();
+	 eit != end; eit++)
+    {
+      switch( face_status(*eit) )
+      {
+      case NOT_IN_COMPLEX: case REGULAR: break;
+      case BOUNDARY: ++number_of_boundary_incident_edges; break;
+      default :
+#ifdef CGAL_MESHES_DEBUG_REFINEMENT_POINTS
+        std::cerr << "singular edge...\n";
+        std::cerr << v->point() << std::endl;
+#endif // CGAL_MESHES_DEBUG_REFINEMENT_POINTS
+        return SINGULAR;
+      }
+    }
+
+    // From here all incident edges (in complex) are REGULAR or BOUNDARY.
+    const std::size_t nb_components = union_find_of_incident_facets(v);
+    if(nb_components > 1) {
+#ifdef CGAL_MESHES_DEBUG_REFINEMENT_POINTS
+      std::cerr << "singular vertex: nb_components=" << nb_components << std::endl;
+      std::cerr << v->point() << std::endl;
+#endif // CGAL_MESHES_DEBUG_REFINEMENT_POINTS
+      return SINGULAR;
+    }
+    else { // REGULAR OR BOUNDARY
+#ifdef CGAL_MESHES_DEBUG_REFINEMENT_POINTS
+      std::cerr << "regular or boundary: " << v->point() << std::endl;
+#endif // CGAL_MESHES_DEBUG_REFINEMENT_POINTS
+      if (number_of_boundary_incident_edges != 0)
+        return BOUNDARY;
+      else
+        return REGULAR;
+    }
+  }
+
+  /// This function should be called only when incident edges
+  /// are known to be REGULAR OR BOUNDARY
+  bool is_regular_or_boundary_for_vertices(Vertex_handle v) const {
+    return union_find_of_incident_facets(v) == 1;
+  }
+
+  /// Returns `NOT_IN_COMPLEX`, `BOUNDARY`, `REGULAR`, or `SINGULAR`,
+  /// depending on the number of incident facets in the complex
+  Face_status face_status(const Edge& edge) const
+  {
+    if(!manifold_info_initialized_) init_manifold_info();
+
+    switch(edge_facet_counter_[this->make_ordered_pair(edge)])
+    {
+    case 0: return NOT_IN_COMPLEX;
+    case 1: return BOUNDARY;
+    case 2: return REGULAR;
+    default: return SINGULAR;
+    }
+  }
+
+  /// Returns true if the vertex \c v has is incident to at least a facet
+  /// of the complex
+  bool has_incident_facets_in_complex(const Vertex_handle& v) const
+  {
+    if(!manifold_info_initialized_) init_manifold_info();
+    return v->cached_number_of_incident_facets() > 0;
+  }
+
+  /// Returns true if facet \c facet is in complex
+  bool is_in_complex(const Facet& facet) const
+  {
+    return is_in_complex(facet.first, facet.second);
+  }
+
+  /// Returns true if facet (\c cell, \c i) is in 2D complex
+  bool is_in_complex(const Cell_handle& cell, const int i) const
+  {
+    return ( cell->is_facet_on_surface(i) );
+  }
+
+  /// Returns surface index of facet \c f
+  Surface_patch_index surface_patch_index(const Facet& f) const
+  {
+    return surface_patch_index(f.first,f.second);
+  }
+
+  /// Returns surface index of facet(\c cell, \c i)
+  Surface_patch_index surface_patch_index(const Cell_handle& cell,
+                                          const int i) const
+  {
+    return cell->surface_patch_index(i);
+  }
+
+  /// Returns the number of surface facets of the mesh
+  size_type number_of_facets_in_complex() const { return number_of_facets_; }
+
+  /// Adds cell \c cell to the 3D complex, with subdomain index \c index
+  void add_to_complex(const Cell_handle& cell, const Subdomain_index& index)
+  {
+    CGAL_precondition( !( index == Subdomain_index() ) );
+
+    if ( ! is_in_complex(cell) )
+    {
+      set_subdomain_index(cell, index);
+      ++number_of_cells_;
+    }
+  }
+
+  /// Removes cell \c cell from the 3D complex
+  void remove_from_complex(const Cell_handle& cell)
+  {
+    if ( is_in_complex(cell) )
+    {
+      set_subdomain_index(cell, Subdomain_index());
+      --number_of_cells_;
+    }
+  }
+
+
+  /// Sets subdomain index of cell \c cell to \c index
+  void set_subdomain_index(const Cell_handle& cell,
+                           const Subdomain_index& index) const
+  {
+    cell->set_subdomain_index(index);
+  }
+
+  /// Sets index of vertex \c vertex to \c index
+  void set_index(const Vertex_handle& vertex, const Index& index) const
+  {
+    vertex->set_index(index);
+  }
+
+  /// Sets dimension of vertex \c vertex to \c dimension
+  void set_dimension(const Vertex_handle& vertex, int dimension) const
+  {
+    vertex->set_dimension(dimension);
+  }
+
+  /// Returns the number of cells which belongs to the 3D complex
+  size_type number_of_cells_in_complex() const
+  {
+    return number_of_cells_;
+  }
+
+  /// Returns \c true if cell \c cell belongs to the 3D complex
+  bool is_in_complex(const Cell_handle& cell) const
+  {
+    return !( subdomain_index(cell) == Subdomain_index() );
+  }
+
+  /// Returns the subdomain index of cell \c cell
+  Subdomain_index subdomain_index(const Cell_handle& cell) const
+  {
+    return cell->subdomain_index();
+  }
+
+  /// Returns the dimension of the lowest dimensional face of the input 3D
+  /// complex that contains the vertex
+  int in_dimension(const Vertex_handle& v) const { return v->in_dimension(); }
+
+  /// Returns the index of vertex \c v
+  Index index(const Vertex_handle& v) const { return v->index(); }
+
+  /// Outputs the mesh to medit
+  void output_to_medit(std::ostream& os,
+                       bool rebind = true,
+                       bool show_patches = false) const
+  {
+    // Call global function
+    CGAL::output_to_medit(os,*this,rebind,show_patches);
+  }
+  
+  /// Outputs the mesh to maya
+  void output_to_maya(std::ofstream& os,
+                      bool surfaceOnly = true) const
+  {
+    // Call global function
+    CGAL::output_to_maya(os,*this,surfaceOnly);
+  }
+
+  //-------------------------------------------------------
+  // Undocumented features
+  //-------------------------------------------------------
+  /**
+   * @brief insert \c [first,last[ in the triangulation (with dimension 2)
+   * @param first the iterator on the first point to insert
+   * @param last the iterator past the last point to insert
+   *
+   * InputIterator value type must be \c std::pair<Tr::Point,Index>
+   */
+  template <typename InputIterator>
+  void insert_surface_points(InputIterator first, InputIterator last)
+  {
+    while ( first != last )
+    {
+      Vertex_handle vertex = tr_.insert((*first).first);
+      vertex->set_index((*first).second);
+      vertex->set_dimension(2);
+      ++first;
+    }
+  }
+
+  /**
+   * @brief insert \c [first,last[ in the triangulation (with dimension 2 and
+   * index \c default_index)
+   * @param first the iterator on the first point to insert
+   * @param last the iterator past the last point to insert
+   * @param default_index the index to be used to insert points
+   *
+   * InputIterator value type must be \c Tr::Point
+   */
+  template <typename InputIterator>
+  void insert_surface_points(InputIterator first,
+                             InputIterator last,
+                             const Index& default_index)
+  {
+    while ( first != last )
+    {
+      Vertex_handle vertex = tr_.insert(*first);
+      vertex->set_index(default_index);
+      vertex->set_dimension(2);
+      ++first;
+    }
+  }
+
+  /// Swaps this & rhs
+  void swap(Self& rhs)
+  {
+    std::swap(rhs.number_of_facets_, number_of_facets_);
+    tr_.swap(rhs.tr_);
+    std::swap(rhs.number_of_cells_, number_of_cells_);
+  }
+
+  /// Returns bbox
+  Bbox_3 bbox() const;
+
+  void clear_cells_and_facets_from_c3t3() {
+    for(typename Tr::Finite_cells_iterator
+          cit = this->triangulation().finite_cells_begin(),
+          end = this->triangulation().finite_cells_end();
+        cit != end; ++cit)
+    {
+      set_subdomain_index(cit, Subdomain_index());
+    }
+    this->number_of_cells_ = 0;
+    for(typename Tr::Finite_facets_iterator
+          fit = this->triangulation().finite_facets_begin(),
+          end = this->triangulation().finite_facets_end();
+        fit != end; ++fit)
+    {
+      Facet facet = *fit;
+      Facet mirror = tr_.mirror_facet(facet);
+      set_surface_patch_index(facet.first, facet.second, Surface_patch_index());
+      set_surface_patch_index(mirror.first, mirror.second, Surface_patch_index());
+    }
+    this->number_of_facets_ = 0;
+    clear_manifold_info();
+  }
+
+  void clear_manifold_info() {
+    edge_facet_counter_.clear();
+    manifold_info_initialized_ = false;
+  }
+
+private:
+  void init_manifold_info() const {
+    for(typename Tr::All_vertices_iterator
+          vit = triangulation().finite_vertices_begin(),
+          end = triangulation().finite_vertices_end();
+        vit != end; ++vit)
+    {
+      vit->set_c2t3_cache(0, -1);
+    }
+
+    edge_facet_counter_.clear();
+
+    for(typename Tr::Finite_facets_iterator
+          fit = triangulation().finite_facets_begin(),
+          end = triangulation().finite_facets_end();
+        fit != end; ++fit)
+    {
+      if ( is_in_complex(*fit) ) {
+        const Cell_handle cell = fit->first;
+        const int i = fit->second;
+        for(int j = 0; j < 3; ++j)
+        {
+          const int edge_index_va = tr_.vertex_triple_index(i, j);
+          const int edge_index_vb = tr_.vertex_triple_index(i, (j == 2) ? 0 : (j+1));
+          const Vertex_handle edge_va = cell->vertex(edge_index_va);
+          const Vertex_handle edge_vb = cell->vertex(edge_index_vb);
+          ++edge_facet_counter_[this->make_ordered_pair(edge_va, edge_vb)];
+
+          const std::size_t n = edge_va->cached_number_of_incident_facets();
+          edge_va->set_c2t3_cache(n+1, -1);
+        }
+      }
+    }
+    manifold_info_initialized_ = true;
+  }
+
+  /// Extract the subset `F` of facets of the complex incident to `v` and
+  /// return the number of connected component of the adjacency graph of `F`.
+  std::size_t union_find_of_incident_facets(const Vertex_handle v) const
+  {
+    if( v->is_c2t3_cache_valid() )
+    {
+      const std::size_t n = v->cached_number_of_components();
+      if(n != std::size_t(-1)) return n;
+    }
+
+    Union_find<Facet> facets;
+    { // fill the union find
+      std::vector<Facet> non_filtered_facets;
+      tr_.incident_facets(v, std::back_inserter(non_filtered_facets));
+
+      for(typename std::vector<Facet>::iterator
+            fit = non_filtered_facets.begin(),
+            end = non_filtered_facets.end();
+          fit != end; ++fit)
+      {
+        if(is_in_complex(*fit)) facets.push_back(*fit);
+      }
+    }
+
+    typedef std::map<Vertex_handle,
+                     typename Union_find<Facet>::handle> Vertex_set_map;
+    typedef typename Vertex_set_map::iterator Vertex_set_map_iterator;
+
+    Vertex_set_map vsmap;
+
+    for(typename Union_find<Facet>::iterator
+          it = facets.begin(), end = facets.end();
+        it != end; ++it)
+    {
+      const Cell_handle& ch = (*it).first;
+      const int& i = (*it).second;
+      for(int j=0; j < 3; ++j) {
+	const Vertex_handle w = ch->vertex(tr_.vertex_triple_index(i,j));
+	if(w != v){
+	  Vertex_set_map_iterator vsm_it = vsmap.find(w);
+	  if(vsm_it != vsmap.end()){
+	    facets.unify_sets(vsm_it->second, it);
+	  } else {
+	    vsmap.insert(std::make_pair(w, it));
+	  }
+	}
+      }
+    }
+    const std::size_t nb_components = facets.number_of_sets();
+
+    const std::size_t n = v->cached_number_of_incident_facets();
+    v->set_c2t3_cache(n, nb_components);
+    return nb_components;
+  }
+  
+  //-------------------------------------------------------
+  // Traversal
+  //-------------------------------------------------------
+private:
+  typedef Mesh_3::internal::Iterator_not_in_complex<Self> Iterator_not_in_complex;
+
+  class Facet_iterator_not_in_complex
+  {
+    const Self* c3t3_;
+    Surface_patch_index index_; //need by SWIG: should be const Surface_patch_index
+  public:
+    Facet_iterator_not_in_complex(){} //need by SWIG
+    Facet_iterator_not_in_complex(const Self& c3t3,
+                                  const Surface_patch_index& index = Surface_patch_index())
+      : c3t3_(&c3t3)
+      , index_(index) { }
+
+    template <typename Iterator>
+    bool operator()(Iterator it) const
+    {
+      if ( index_ == Surface_patch_index() ) { return ! c3t3_->is_in_complex(*it); }
+      else { return !( c3t3_->surface_patch_index(*it) == index_ );  }
+    }
+  };
+
+  /**
+   * @class Cell_not_in_complex
+   * @brief A class to filter cells which do not belong to the complex
+   */
+  class Cell_not_in_complex
+  {
+    const Self* r_self_;
+    Subdomain_index index_;//needed by SWIG, should be const Subdomain_index
+  public:
+    Cell_not_in_complex(){}//needed by SWIG
+    Cell_not_in_complex(const Self& self,
+                        const Subdomain_index& index = Subdomain_index())
+      : r_self_(&self)
+      , index_(index) { }
+
+    bool operator()(Cell_handle ch) const
+    {
+      if ( index_ == Subdomain_index() ) { return !r_self_->is_in_complex(ch); }
+      else { return !( r_self_->subdomain_index(ch) == index_ ); }
+    }
+  }; // end class Cell_not_in_complex
+
+public:
+  /// Iterator type to visit the facets of the 2D complex.
+  typedef Filter_iterator<
+    typename Triangulation::Finite_facets_iterator,
+    Facet_iterator_not_in_complex >               Facets_in_complex_iterator;
+
+  /// Returns a Facets_in_complex_iterator to the first facet of the 2D complex
+  Facets_in_complex_iterator facets_in_complex_begin() const
+  {
+    return CGAL::filter_iterator(tr_.finite_facets_end(),
+                                 Facet_iterator_not_in_complex(*this),
+                                 tr_.finite_facets_begin());
+  }
+
+  /// Returns a Facets_in_complex_iterator to the first facet of the 2D complex
+  Facets_in_complex_iterator
+  facets_in_complex_begin(const Surface_patch_index& index) const
+  {
+    return CGAL::filter_iterator(tr_.finite_facets_end(),
+                                 Facet_iterator_not_in_complex(*this,index),
+                                 tr_.finite_facets_begin());
+  }
+
+  /// Returns past-the-end iterator on facet of the 2D complex
+  Facets_in_complex_iterator facets_in_complex_end(const Surface_patch_index = Surface_patch_index()) const
+  {
+    return CGAL::filter_iterator(tr_.finite_facets_end(),
+                                 Facet_iterator_not_in_complex(*this));
+  }
+
+  /**
+   * @class Cells_in_complex_iterator
+   * @brief Iterator type to visit the cells of triangulation belonging
+   * to the 3D complex
+   *
+   * This class is usefull to ensure that Cells_in_complex_iterator is convertible
+   * to Cell_handle
+   */
+  class Cells_in_complex_iterator :
+    public Filter_iterator<typename Triangulation::Finite_cells_iterator,
+                           Cell_not_in_complex>
+  {
+  private:
+    typedef typename Triangulation::Finite_cells_iterator Tr_iterator;
+    typedef Filter_iterator<typename Triangulation::Finite_cells_iterator,
+                            Cell_not_in_complex> Base;
+    typedef Cells_in_complex_iterator Self;
+
+  public:
+    Cells_in_complex_iterator() : Base() { }
+    Cells_in_complex_iterator(Base i) : Base(i) { }
+
+    Self& operator++() { Base::operator++(); return *this; }
+    Self& operator--() { Base::operator--(); return *this; }
+    Self operator++(int) { Self tmp(*this); ++(*this); return tmp; }
+    Self operator--(int) { Self tmp(*this); --(*this); return tmp; }
+
+    operator Cell_handle() const { return Cell_handle(this->base()); }
+  }; // end class Cells_in_complex_iterator
+
+
+  /// Returns a \c Cells_in_complex_iterator to the first cell of the 3D complex
+  Cells_in_complex_iterator cells_in_complex_begin() const
+  {
+    return CGAL::filter_iterator(tr_.finite_cells_end(),
+                                 Cell_not_in_complex(*this),
+                                 tr_.finite_cells_begin());
+  }
+
+  /// Returns a \c Cells_in_complex_iterator to the first cell of the 3D complex
+  Cells_in_complex_iterator
+  cells_in_complex_begin(const Subdomain_index& index) const
+  {
+    return CGAL::filter_iterator(tr_.finite_cells_end(),
+                                 Cell_not_in_complex(*this,index),
+                                 tr_.finite_cells_begin());
+  }
+
+  /// Returns the past-the-end iterator for the cells of the 3D complex
+  Cells_in_complex_iterator cells_in_complex_end() const
+  {
+    return CGAL::filter_iterator(tr_.finite_cells_end(),
+                                 Cell_not_in_complex(*this));
+  }
+
+  // -----------------------------------
+  // Backward Compatibility
+  // -----------------------------------
+#ifndef CGAL_MESH_3_NO_DEPRECATED_SURFACE_INDEX
+  typedef Surface_patch_index   Surface_index;
+
+  void set_surface_index(const Facet& f, const Surface_index& index)
+  { set_surface_patch_index(f, index); }
+
+  void set_surface_index(const Cell_handle& c, const int i, const Surface_index& index)
+  { set_surface_patch_index(c,i,index); }
+
+  Surface_index surface_index(const Facet& f) const
+  { return surface_patch_index(f); }
+
+  Surface_index surface_index(const Cell_handle& c, const int i) const
+  { return surface_patch_index(c,i); }
+#endif // CGAL_MESH_3_NO_DEPRECATED_SURFACE_INDEX
+
+#ifndef CGAL_MESH_3_NO_DEPRECATED_C3T3_ITERATORS
+  typedef Facets_in_complex_iterator  Facet_iterator;
+  typedef Cells_in_complex_iterator   Cell_iterator;
+
+  Facet_iterator facets_begin() const
+  { return facets_in_complex_begin(); }
+
+  Facet_iterator facets_end() const
+  { return facets_in_complex_end(); }
+
+  Cell_iterator cells_begin() const
+  { return cells_in_complex_begin(); }
+
+  Cell_iterator cells_end() const
+  { return cells_in_complex_end(); }
+#endif // CGAL_MESH_3_NO_DEPRECATED_C3T3_ITERATORS
+  // -----------------------------------
+  // End backward Compatibility
+  // -----------------------------------
+
+  size_type number_of_facets() const
+  { return number_of_facets_in_complex(); }
+
+  size_type number_of_cells() const
+  { return number_of_cells_in_complex(); }
+
+public:
+  template <typename Tr2, typename Ct2>
+  friend
+  std::istream &
+  operator>> (std::istream& is,
+              Mesh_complex_3_in_triangulation_3_base<Tr2,Ct2> &c3t3);
+
+  void rescan_after_load_of_triangulation();
+
+  static
+  std::string io_signature()
+  {
+    return
+      Get_io_signature<Tr>()();
+  }
+private:
+
+  // Sequential: non-atomic
+  // "dummy" is here to allow the specialization (see below)
+  // See http://groups.google.com/group/comp.lang.c++.moderated/browse_thread/thread/285ab1eec49e1cb6
+  template<typename Concurrency_tag2, typename dummy = void>
+  struct Number_of_elements
+  {
+    typedef size_type type;
+  };
+#ifdef CGAL_LINKED_WITH_TBB
+  // Parallel: atomic
+  template<typename dummy>
+  struct Number_of_elements<Parallel_tag, dummy>
+  {
+    typedef tbb::atomic<size_type> type;
+  };
+#endif // CGAL_LINKED_WITH_TBB
+
+  // Private date members
+  Triangulation tr_;
+
+  typedef typename Base::Pair_of_vertices Pair_of_vertices;
+  typedef std::map<Pair_of_vertices, int> Edge_facet_counter;
+
+  mutable Edge_facet_counter edge_facet_counter_;
+
+  typename Number_of_elements<Concurrency_tag>::type number_of_facets_;
+  typename Number_of_elements<Concurrency_tag>::type number_of_cells_;
+
+  mutable bool manifold_info_initialized_;
+};  // end class Mesh_complex_3_in_triangulation_3_base
+
+
+template <typename Tr, typename Ct>
+void
+Mesh_complex_3_in_triangulation_3_base<Tr,Ct>::add_to_complex(
+    const Cell_handle& cell,
+    const int i,
+    const Surface_patch_index& index)
+{
+  CGAL_precondition( !( index == Surface_patch_index() ) );
+
+  if ( ! is_in_complex(cell,i) )
+  {
+    Facet mirror = tr_.mirror_facet(std::make_pair(cell,i));
+    set_surface_patch_index(cell, i, index);
+    set_surface_patch_index(mirror.first, mirror.second, index);
+    ++number_of_facets_;
+    if(manifold_info_initialized_) {
+      for(int j = 0; j < 3; ++j)
+      {
+        int edge_index_va = tr_.vertex_triple_index(i, j);
+        int edge_index_vb = tr_.vertex_triple_index(i, (j == 2) ? 0 : (j+1));
+        Vertex_handle edge_va = cell->vertex(edge_index_va);
+        Vertex_handle edge_vb = cell->vertex(edge_index_vb);
+        ++edge_facet_counter_[this->make_ordered_pair(edge_va, edge_vb)];
+
+        const std::size_t n = edge_va->cached_number_of_incident_facets();
+        const std::size_t m = edge_va->cached_number_of_components();
+        edge_va->set_c2t3_cache(n+1, m);
+      }
+      const int dimension_plus_1 = tr_.dimension() + 1;
+      // update c2t3 for vertices of f
+      for (int j = 0; j < dimension_plus_1; j++) {
+        if (j != i) {
+#ifdef CGAL_MESHES_DEBUG_REFINEMENT_POINTS
+          if(cell->vertex(j)->is_c2t3_cache_valid())
+            std::cerr << "(" << cell->vertex(j)->point() << ")->invalidate_c2t3_cache()\n";
+#endif // CGAL_MESHES_DEBUG_REFINEMENT_POINTS
+          cell->vertex(j)->invalidate_c2t3_cache();
+        }
+      }
+    }
+  }
+}
+
+
+template <typename Tr, typename Ct>
+void
+Mesh_complex_3_in_triangulation_3_base<Tr,Ct>::remove_from_complex(const Facet& facet)
+{
+  if ( is_in_complex(facet) )
+  {
+    Facet mirror = tr_.mirror_facet(facet);
+    set_surface_patch_index(facet.first, facet.second, Surface_patch_index());
+    set_surface_patch_index(mirror.first, mirror.second, Surface_patch_index());
+    --number_of_facets_;
+    if(manifold_info_initialized_) {
+      const Cell_handle cell = facet.first;
+      const int i = facet.second;
+      for(int j = 0; j < 3; ++j)
+      {
+        const int edge_index_va = tr_.vertex_triple_index(i, j);
+        const int edge_index_vb = tr_.vertex_triple_index(i, (j == 2) ? 0 : (j+1));
+        const Vertex_handle edge_va = cell->vertex(edge_index_va);
+        const Vertex_handle edge_vb = cell->vertex(edge_index_vb);
+        --edge_facet_counter_[this->make_ordered_pair(edge_va, edge_vb)];
+
+        const std::size_t n = edge_va->cached_number_of_incident_facets();
+        CGAL_assertion(n>0);
+        const std::size_t m = edge_va->cached_number_of_components();
+        edge_va->set_c2t3_cache(n-1, m);
+      }
+      const int dimension_plus_1 = tr_.dimension() + 1;
+      // update c2t3 for vertices of f
+      for (int j = 0; j < dimension_plus_1; j++) {
+        if (j != facet.second) {
+#ifdef CGAL_MESHES_DEBUG_REFINEMENT_POINTS
+          if(cell->vertex(j)->is_c2t3_cache_valid())
+            std::cerr << "(" << cell->vertex(j)->point() << ")->invalidate_c2t3_cache()\n";
+#endif // CGAL_MESHES_DEBUG_REFINEMENT_POINTS
+          cell->vertex(j)->invalidate_c2t3_cache();
+        }
+      }
+    }
+  }
+}
+
+
+// -----------------------------------
+// Undocumented
+// -----------------------------------
+template <typename Tr, typename Ct>
+Bbox_3
+Mesh_complex_3_in_triangulation_3_base<Tr,Ct>::
+bbox() const
+{
+  if ( 0 == triangulation().number_of_vertices() )
+  {
+    return Bbox_3();
+  }
+
+  typename Tr::Finite_vertices_iterator vit = tr_.finite_vertices_begin();
+  Bbox_3 result = (vit++)->point().bbox();
+
+  for(typename Tr::Finite_vertices_iterator end = tr_.finite_vertices_end();
+      vit != end ; ++vit)
+  {
+    result = result + vit->point().bbox();
+  }
+
+  return result;
+}
+
+template <typename Tr, typename Ct>
+std::ostream &
+operator<< (std::ostream& os,
+            const Mesh_complex_3_in_triangulation_3_base<Tr,Ct> &c3t3)
+{
+  return os << c3t3.triangulation();
+}
+
+
+template <typename Tr, typename Ct>
+std::istream &
+operator>> (std::istream& is,
+            Mesh_complex_3_in_triangulation_3_base<Tr,Ct> &c3t3)
+{
+  c3t3.clear();
+  is >> c3t3.triangulation();
+
+  if(!is) {
+    c3t3.clear();
+    return is;
+  }
+
+  c3t3.rescan_after_load_of_triangulation();
+  return is;
+}
+
+template <typename Tr, typename Ct>
+void
+Mesh_complex_3_in_triangulation_3_base<Tr,Ct>::
+rescan_after_load_of_triangulation() {
+  this->number_of_facets_ = 0;
+  for(typename Tr::Finite_facets_iterator
+        fit = this->triangulation().finite_facets_begin(),
+        end = this->triangulation().finite_facets_end();
+      fit != end; ++fit)
+  {
+    if ( this->is_in_complex(*fit) ) {
+      ++this->number_of_facets_;
+    }
+  }
+
+  this->number_of_cells_ = 0;
+  for(typename Tr::Finite_cells_iterator
+        cit = this->triangulation().finite_cells_begin(),
+        end = this->triangulation().finite_cells_end();
+      cit != end; ++cit)
+  {
+    if ( this->is_in_complex(cit) ) {
+      ++this->number_of_cells_;
+    }
+  }
+}
+
+}  // end namespace Mesh_3
+}  // end namespace CGAL
+
+#endif // CGAL_MESH_3_MESH_COMPLEX_3_IN_TRIANGULATION_3_BASE_H
diff --git a/3rdparty/CGAL/include/CGAL/Mesh_3/Mesh_global_optimizer.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Mesh_global_optimizer.h
new file mode 100644
index 0000000..9b10e14
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Mesh_3/Mesh_global_optimizer.h
@@ -0,0 +1,1158 @@
+// Copyright (c) 2009 INRIA Sophia-Antipolis (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
+// 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(s)     : Stephane Tayeb
+//
+//******************************************************************************
+// File Description :
+//******************************************************************************
+
+#ifndef CGAL_MESH_3_MESH_GLOBAL_OPTIMIZER_H
+#define CGAL_MESH_3_MESH_GLOBAL_OPTIMIZER_H
+
+#include <CGAL/Mesh_3/config.h>
+
+#include <CGAL/Real_timer.h>
+#include <CGAL/Mesh_3/C3T3_helpers.h>
+#include <CGAL/Mesh_3/Triangulation_helpers.h>
+#include <CGAL/Origin.h>
+#include <CGAL/Mesh_optimization_return_code.h>
+#include <CGAL/Mesh_3/Null_global_optimizer_visitor.h>
+#include <CGAL/Prevent_deref.h>
+#include <CGAL/tuple.h>
+
+#include <CGAL/Mesh_3/Concurrent_mesher_config.h>
+
+#ifdef CGAL_MESH_3_PROFILING
+  #include <CGAL/Mesh_3/Profiling_tools.h>
+#endif
+
+#include <vector>
+#include <list>
+#include <limits>
+
+#include <boost/type_traits/is_convertible.hpp>
+
+#ifdef CGAL_LINKED_WITH_TBB
+# include <tbb/atomic.h>
+# include <tbb/parallel_do.h>
+# include <tbb/concurrent_vector.h>
+#endif
+
+namespace CGAL {
+
+namespace Mesh_3 {
+
+
+/************************************************
+// Class Mesh_global_optimizer_base
+// Two versions: sequential / parallel
+************************************************/
+
+// Sequential
+template <typename Tr, typename Concurrency_tag>
+class Mesh_global_optimizer_base
+{
+protected:
+  typedef typename Tr::Geom_traits                          Gt;
+  typedef typename Gt::FT                                   FT;
+  typedef typename Tr::Lock_data_structure                  Lock_data_structure;
+
+  typedef std::vector<cpp11::tuple<
+    typename Tr::Vertex_handle, typename Tr::Point, FT> >   Moves_vector;
+  typedef unsigned int                                      Nb_frozen_points_type ;
+
+  Mesh_global_optimizer_base(const Bbox_3 &, int)
+    : big_moves_size_(0) {}
+
+  void update_big_moves(const FT& new_sq_move)
+  {
+    if (big_moves_.size() < big_moves_size_ )
+      big_moves_.insert(new_sq_move);
+    else
+    {
+      FT smallest = *(big_moves_.begin());
+      if( new_sq_move > smallest )
+      {
+        big_moves_.erase(big_moves_.begin());
+        big_moves_.insert(new_sq_move);
+      }
+    }
+  }
+
+  void clear_big_moves()
+  {
+    big_moves_.clear();
+  }
+
+  Lock_data_structure *get_lock_data_structure() { return 0; }
+  void unlock_all_elements() {}
+
+protected:
+  std::size_t big_moves_size_;
+  std::multiset<FT> big_moves_;
+};
+
+#ifdef CGAL_LINKED_WITH_TBB
+// Parallel
+template <typename Tr>
+class Mesh_global_optimizer_base<Tr, Parallel_tag>
+{
+protected:
+  typedef typename Tr::Geom_traits                          Gt;
+  typedef typename Gt::FT                                   FT;
+  typedef typename Tr::Lock_data_structure                  Lock_data_structure;
+  typedef tbb::concurrent_vector<cpp11::tuple<
+    typename Tr::Vertex_handle, typename Tr::Point, FT> >   Moves_vector;
+  typedef tbb::atomic<unsigned int>                         Nb_frozen_points_type ;
+
+  Mesh_global_optimizer_base(const Bbox_3 &bbox, int num_grid_cells_per_axis)
+    : big_moves_size_(0)
+    , m_lock_ds(bbox, num_grid_cells_per_axis)
+  {
+    big_moves_current_size_ = 0;
+    big_moves_smallest_ = std::numeric_limits<FT>::max();
+  }
+
+  void update_big_moves(const FT& new_sq_move)
+  {
+    if (++big_moves_current_size_ <= big_moves_size_ )
+    {
+      tbb::mutex::scoped_lock lock(m_big_moves_mutex);
+      typename std::multiset<FT>::const_iterator it = big_moves_.insert(new_sq_move);
+
+      // New smallest move of all big moves?
+      if (it == big_moves_.begin())
+        big_moves_smallest_ = new_sq_move;
+    }
+    else
+    {
+      --big_moves_current_size_;
+
+      if( new_sq_move > big_moves_smallest_ )
+      {
+        tbb::mutex::scoped_lock lock(m_big_moves_mutex);
+        // Test it again since it may have been modified by another
+        // thread in the meantime
+        if( new_sq_move > big_moves_smallest_ )
+        {
+          big_moves_.erase(big_moves_.begin());
+          typename std::multiset<FT>::const_iterator it = big_moves_.insert(new_sq_move);
+
+          // New smallest move of all big moves?
+          if (it == big_moves_.begin())
+            big_moves_smallest_ = new_sq_move;
+        }
+      }
+    }
+  }
+
+  void clear_big_moves()
+  {
+    big_moves_current_size_ = 0;
+    big_moves_smallest_ = std::numeric_limits<FT>::max();
+    big_moves_.clear();
+  }
+
+  Lock_data_structure *get_lock_data_structure()
+  {
+    return &m_lock_ds;
+  }
+
+  void unlock_all_elements()
+  {
+    m_lock_ds.unlock_all_points_locked_by_this_thread();
+  }
+
+public:
+
+protected:
+  tbb::atomic<std::size_t>  big_moves_current_size_;
+  tbb::atomic<FT>           big_moves_smallest_;
+  std::size_t               big_moves_size_;
+  std::multiset<FT>         big_moves_;
+  tbb::mutex                m_big_moves_mutex;
+
+  /// Lock data structure
+  Lock_data_structure m_lock_ds;
+};
+#endif // CGAL_LINKED_WITH_TBB
+
+
+
+
+/************************************************
+// Class Mesh_global_optimizer
+************************************************/
+
+template <typename C3T3,
+          typename MeshDomain,
+          typename MoveFunction,
+          typename Visitor_ = Null_global_optimizer_visitor<C3T3> >
+class Mesh_global_optimizer
+: public Mesh_global_optimizer_base<typename C3T3::Triangulation, typename C3T3::Concurrency_tag>
+{
+  // Types
+  typedef typename C3T3::Concurrency_tag Concurrency_tag;
+
+  typedef Mesh_global_optimizer<C3T3, MeshDomain, MoveFunction, Visitor_> Self;
+  typedef Mesh_global_optimizer_base<
+    typename C3T3::Triangulation, typename C3T3::Concurrency_tag>         Base;
+
+  using Base::get_lock_data_structure;
+  using Base::big_moves_;
+  using Base::big_moves_size_;
+
+  typedef typename C3T3::Triangulation  Tr;
+  typedef typename Tr::Geom_traits      Gt;
+
+  typedef typename Tr::Point            Point_3;
+  typedef typename Tr::Cell_handle      Cell_handle;
+  typedef typename Tr::Vertex_handle    Vertex_handle;
+  typedef typename Tr::Edge             Edge;
+  typedef typename Tr::Vertex           Vertex;
+
+  typedef typename Gt::FT               FT;
+  typedef typename Gt::Vector_3         Vector_3;
+
+  typedef typename std::vector<Cell_handle>                 Cell_vector;
+  typedef typename std::vector<Vertex_handle>               Vertex_vector;
+  typedef typename std::set<Vertex_handle>                  Vertex_set;
+  typedef typename Base::Moves_vector                       Moves_vector;
+  typedef typename Base::Nb_frozen_points_type              Nb_frozen_points_type;
+
+#ifdef CGAL_INTRUSIVE_LIST
+  typedef Intrusive_list<Cell_handle>   Outdated_cell_set;
+#else
+  typedef std::set<Cell_handle>         Outdated_cell_set;
+#endif //CGAL_INTRUSIVE_LIST
+
+#ifdef CGAL_INTRUSIVE_LIST
+  typedef Intrusive_list<Vertex_handle>  Moving_vertices_set;
+#else
+  typedef Vertex_set Moving_vertices_set;
+#endif
+
+  typedef typename MoveFunction::Sizing_field Sizing_field;
+
+  typedef class C3T3_helpers<C3T3,MeshDomain> C3T3_helpers;
+
+  // Visitor class
+  // Should define:
+  //  - after_compute_moves()
+  //  - after_move_points()
+  //  - after_rebuild_restricted_delaunay()
+  //  - end_of_iteration(int iteration_number)
+  typedef Visitor_ Visitor;
+
+public:
+  /**
+   * Constructor
+   */
+  Mesh_global_optimizer(C3T3& c3t3,
+                        const MeshDomain& domain,
+                        const FT& freeze_ratio,
+                        const bool do_freeze,
+                        const FT& convergence_ratio,
+                        const MoveFunction move_function = MoveFunction());
+
+  /**
+   * Launch optimization process
+   *
+   * @param nb_interations maximum number of iterations
+   */
+  Mesh_optimization_return_code operator()(int nb_iterations,
+                                           Visitor v = Visitor());
+
+  /**
+  * collects all vertices of the triangulation in moving_vertices
+  * (even the frozen ones)
+  */
+  void collect_all_vertices(Moving_vertices_set& moving_vertices);
+
+  /// Time accessors
+  void set_time_limit(double time) { time_limit_ = time; }
+  double time_limit() const { return time_limit_; }
+
+private:
+  /**
+   * Returns moves for vertices of set \c moving_vertices
+   */
+  Moves_vector compute_moves(Moving_vertices_set& moving_vertices)
+{
+  typename Gt::Construct_translated_point_3 translate =
+    Gt().construct_translated_point_3_object();
+
+  // Store new position of points which have to move
+  Moves_vector moves;
+
+
+  moves.reserve(moving_vertices.size());
+
+  // reset worst_move list
+  this->clear_big_moves();
+
+#ifdef CGAL_MESH_3_PROFILING
+  std::cerr << "Computing moves...";
+  WallClockTimer t;
+#endif
+
+
+#ifdef CGAL_LINKED_WITH_TBB
+  // Parallel
+  if (boost::is_convertible<Concurrency_tag, Parallel_tag>::value)
+  {
+    tbb::concurrent_vector<Vertex_handle> vertices_not_moving_any_more;
+
+    // Get move for each moving vertex
+    tbb::parallel_do(
+      moving_vertices.begin(), moving_vertices.end(),
+      Compute_move<Self, Sizing_field, Moves_vector,
+                   typename Gt::Construct_translated_point_3>(
+        *this, sizing_field_, moves, do_freeze_, vertices_not_moving_any_more,
+        translate)
+    );
+
+    typename tbb::concurrent_vector<Vertex_handle>::const_iterator it
+      = vertices_not_moving_any_more.begin();
+    typename tbb::concurrent_vector<Vertex_handle>::const_iterator it_end
+      = vertices_not_moving_any_more.end();
+    for ( ; it != it_end ; ++it)
+    {
+      moving_vertices.erase(*it);
+    }
+  }
+  // Sequential
+  else
+#endif // CGAL_LINKED_WITH_TBB
+  {
+    // Get move for each moving vertex
+    typename Moving_vertices_set::iterator vit = moving_vertices.begin();
+    for ( ; vit != moving_vertices.end() ; )
+    {
+      Vertex_handle oldv = *vit;
+      ++vit;
+      Vector_3 move = compute_move(oldv);
+
+      if ( CGAL::NULL_VECTOR != move )
+      {
+        Point_3 new_position = translate(oldv->point(),move);
+        FT size = (Sizing_field::is_vertex_update_needed ?
+          sizing_field_(new_position, oldv) : 0);
+        moves.push_back(cpp11::make_tuple(oldv,new_position,size));
+      }
+      else // CGAL::NULL_VECTOR == move
+      {
+        if(do_freeze_)
+          moving_vertices.erase(oldv); // TODO: if non-intrusive,
+                                       // we can optimize since we have the iterator,
+                                       // don't forget to do "vit = mv.erase(vit)" instead ++vit
+      }
+
+      // Stop if time_limit_ is reached
+      if ( is_time_limit_reached() )
+        break;
+    }
+  }
+
+#ifdef CGAL_MESH_3_PROFILING
+  std::cerr << "done in " << t.elapsed() << " seconds." << std::endl;
+#endif
+
+  return moves;
+}
+
+
+  /**
+   * Returns the move for vertex \c v
+   * warning : this function should be called only on moving vertices
+   *           even for frozen vertices, it could return a non-zero vector
+   */
+  Vector_3 compute_move(const Vertex_handle& v);
+
+  /**
+   * Updates mesh using moves of \c moves vector. Updates moving_vertices with
+   * the new set of moving vertices after the move.
+   */
+  void update_mesh(const Moves_vector& moves,
+                   Moving_vertices_set& moving_vertices,
+                   Visitor& visitor);
+
+  /**
+   * Fill sizing field using sizes (avg circumradius) contained in tr_
+   */
+  void fill_sizing_field();
+
+  /**
+   * Returns true if convergence is reached
+   */
+  bool check_convergence() const;
+
+  /**
+   * Returns the average circumradius length of cells incident to \c v
+   */
+  FT average_circumradius_length(const Vertex_handle& v) const;
+
+  /**
+   * Returns the minimum cicumradius length of cells incident to \c v
+   */
+  FT min_circumradius_sq_length(const Vertex_handle& v, const Cell_vector& incident_cells) const;
+
+  /**
+   * Returns the squared circumradius length of cell \c cell
+   */
+  FT sq_circumradius_length(const Cell_handle& cell,
+                            const Vertex_handle& v) const;
+
+  /**
+   * Returns true if time_limit is reached
+   */
+  bool is_time_limit_reached() const
+  {
+    return ( (time_limit() > 0) && (running_time_.time() > time_limit()) );
+  }
+
+private:
+
+#ifdef CGAL_LINKED_WITH_TBB
+  // Functor for compute_moves function
+  template <typename MGO, typename Sizing_field_, typename Moves_vector_,
+            typename CTOP3>
+  class Compute_move
+  {
+    typedef tbb::concurrent_vector<Vertex_handle> Vertex_conc_vector;
+
+    MGO                  & m_mgo;
+    const Sizing_field_  & m_sizing_field;
+    Moves_vector_        & m_moves;
+    bool                   m_do_freeze;
+    Vertex_conc_vector   & m_vertices_not_moving_any_more;
+    const CTOP3          & m_translate;
+
+  public:
+    // Constructor
+    Compute_move(MGO &mgo, 
+                 const Sizing_field_ &sizing_field,
+                 Moves_vector_ &moves,
+                 bool do_freeze,
+                 Vertex_conc_vector & vertices_not_moving_any_more,
+                 const CTOP3 & translate)
+    : m_mgo(mgo),
+      m_sizing_field(sizing_field),
+      m_moves(moves),
+      m_do_freeze(do_freeze),
+      m_vertices_not_moving_any_more(vertices_not_moving_any_more),
+      m_translate(translate)
+    {}
+
+    // Constructor
+    Compute_move(const Compute_move &cm)
+    : m_mgo(cm.m_mgo), 
+      m_sizing_field(cm.m_sizing_field), 
+      m_moves(cm.m_moves),
+      m_do_freeze(cm.m_do_freeze),
+      m_vertices_not_moving_any_more(cm.m_vertices_not_moving_any_more),
+      m_translate(cm.m_translate)
+    {}
+
+    // operator()
+    void operator()(const Vertex_handle& oldv) const
+    {
+      Vector_3 move = m_mgo.compute_move(oldv);
+
+      if ( CGAL::NULL_VECTOR != move )
+      {
+        Point_3 new_position = m_translate(oldv->point(), move);
+        FT size = (MGO::Sizing_field::is_vertex_update_needed ?
+          m_sizing_field(new_position, oldv) : 0);
+        // typedef Triangulation_helpers<typename C3T3::Triangulation> Th;
+        //if( !Th().inside_protecting_balls(tr_, oldv, new_position))
+        //note : this is not happening for Lloyd and ODT so it's commented
+        //       maybe for a new global optimizer it should be de-commented
+        m_moves.push_back(cpp11::make_tuple(oldv, new_position, size));
+      }
+      else // CGAL::NULL_VECTOR == move
+      {
+        if(m_do_freeze)
+        {
+          m_vertices_not_moving_any_more.push_back(oldv);
+        }
+      }
+
+      if ( m_mgo.is_time_limit_reached() )
+        tbb::task::self().cancel_group_execution();
+    }
+  };
+
+  // Functor for fill_sizing_field function
+  template <typename MGO, typename Tr_, typename Local_list_>
+  class Compute_sizing_field_value
+  {
+    MGO                  & m_mgo;
+    Local_list_          & m_local_lists;
+
+  public:
+    // Constructor
+    Compute_sizing_field_value(MGO &mgo, 
+                               Local_list_ & local_lists)
+    : m_mgo(mgo),
+      m_local_lists(local_lists)
+    {}
+
+    // Constructor
+    Compute_sizing_field_value(const Compute_sizing_field_value &csfv)
+    : m_mgo(csfv.m_mgo), 
+      m_local_lists(csfv.m_local_lists)
+    {}
+
+    // operator()
+    void operator()(Vertex& v) const
+    {
+      Vertex_handle vh 
+        = Tr_::Triangulation_data_structure::Vertex_range::s_iterator_to(v);
+      m_local_lists.local().push_back(
+        std::make_pair(v.point(), m_mgo.average_circumradius_length(vh)));
+    }
+  };
+
+  // Functor for update_mesh function
+  template <typename MGO, typename Helper, typename Tr_, typename Moves_vector_,
+            typename Moving_vertices_set_, typename Outdated_cell_set_>
+  class Move_vertex
+  {
+    MGO                                  & m_mgo;
+    const Helper                         & m_helper;
+    const Moves_vector_                  & m_moves;
+    Moving_vertices_set_                 & m_moving_vertices;
+    Outdated_cell_set_                   & m_outdated_cells;
+  
+    typedef typename Tr_::Point            Point_3;
+    typedef typename Tr_::Vertex_handle    Vertex_handle;
+
+  public:
+    // Constructor
+    Move_vertex(MGO &mgo, const Helper &helper, const Moves_vector_ &moves,
+                Moving_vertices_set_ &moving_vertices,
+                Outdated_cell_set_ &outdated_cells)
+    : m_mgo(mgo), m_helper(helper), m_moves(moves), 
+      m_moving_vertices(moving_vertices), m_outdated_cells(outdated_cells)
+    {}
+
+    // Constructor
+    Move_vertex(const Move_vertex &mv)
+    : m_mgo(mv.m_mgo), m_helper(mv.m_helper), m_moves(mv.m_moves),
+      m_moving_vertices(mv.m_moving_vertices),
+      m_outdated_cells(mv.m_outdated_cells)
+    {}
+
+    // operator()
+    void operator()( const tbb::blocked_range<size_t>& r ) const
+    {
+      for( size_t i = r.begin() ; i != r.end() ; ++i)
+      {
+        const Vertex_handle& v = cpp11::get<0>(m_moves[i]);
+        const Point_3& new_position = cpp11::get<1>(m_moves[i]);
+        // Get size at new position
+        if ( MGO::Sizing_field::is_vertex_update_needed )
+        {
+          //FT size = sizing_field_(new_position,v);
+          FT size = cpp11::get<2>(m_moves[i]);
+
+          // Move point
+          bool could_lock_zone;
+          Vertex_handle new_v = m_helper.move_point(
+            v, new_position, m_outdated_cells, m_moving_vertices, &could_lock_zone);
+          while (could_lock_zone == false)
+          {
+            new_v = m_helper.move_point(
+              v, new_position, m_outdated_cells, m_moving_vertices, &could_lock_zone);
+          }
+
+          // Restore size in meshing_info data
+          new_v->set_meshing_info(size);
+        }
+        else // Move point
+        {
+          bool could_lock_zone;
+          do {
+            m_helper.move_point(
+              v, new_position, m_outdated_cells, m_moving_vertices, &could_lock_zone);
+          } while (!could_lock_zone);
+        }
+
+        m_mgo.unlock_all_elements();
+
+        // Stop if time_limit_ is reached, here we can't return without rebuilding
+        // restricted delaunay
+        if ( m_mgo.is_time_limit_reached() )
+        {
+          tbb::task::self().cancel_group_execution();
+          break;
+        }
+      }
+    }
+  };
+#endif // CGAL_LINKED_WITH_TBB
+
+  // -----------------------------------
+  // Private data
+  // -----------------------------------
+  C3T3& c3t3_;
+  Tr& tr_;
+  const MeshDomain& domain_;
+  FT sq_freeze_ratio_;
+  FT convergence_ratio_;
+  C3T3_helpers helper_;
+  MoveFunction move_function_;
+  Sizing_field sizing_field_;
+  double time_limit_;
+  CGAL::Real_timer running_time_;
+
+  bool do_freeze_;
+  mutable Nb_frozen_points_type nb_frozen_points_;
+
+#ifdef CGAL_MESH_3_OPTIMIZER_VERBOSE
+  mutable FT sum_moves_;
+#endif
+};
+
+
+template <typename C3T3, typename Md, typename Mf, typename V_>
+Mesh_global_optimizer<C3T3,Md,Mf,V_>::
+Mesh_global_optimizer(C3T3& c3t3,
+                      const Md& domain,
+                      const FT& freeze_ratio,
+                      const bool do_freeze,
+                      const FT& convergence_ratio,
+                      const Mf move_function)
+: Base(c3t3.bbox(),
+       Concurrent_mesher_config::get().locking_grid_num_cells_per_axis)
+, c3t3_(c3t3)
+, tr_(c3t3_.triangulation())
+, domain_(domain)
+, sq_freeze_ratio_(freeze_ratio*freeze_ratio)
+, convergence_ratio_(convergence_ratio)
+, helper_(c3t3_,domain_, get_lock_data_structure())
+, move_function_(move_function)
+, sizing_field_(c3t3.triangulation())
+, time_limit_(-1)
+, running_time_()
+
+, do_freeze_(do_freeze)
+
+#ifdef CGAL_MESH_3_OPTIMIZER_VERBOSE
+, sum_moves_(0)
+#endif // CGAL_MESH_3_OPTIMIZER_VERBOSE
+{
+  nb_frozen_points_ = 0; // We put it here in case it's an "atomic"
+
+  // If we're multi-thread
+  tr_.set_lock_data_structure(get_lock_data_structure());
+
+#ifdef CGAL_MESH_3_OPTIMIZER_VERBOSE
+  std::cerr << "Fill sizing field...";
+  CGAL::Real_timer timer;
+  timer.start();
+#endif
+
+  fill_sizing_field();
+
+#ifdef CGAL_MESH_3_OPTIMIZER_VERBOSE
+  std::cerr << "done (" << timer.time() << "s)\n";
+#endif
+}
+
+
+
+template <typename C3T3, typename Md, typename Mf, typename V_>
+Mesh_optimization_return_code
+Mesh_global_optimizer<C3T3,Md,Mf,V_>::
+operator()(int nb_iterations, Visitor visitor)
+{
+  running_time_.reset();
+  running_time_.start();
+
+#ifdef CGAL_MESH_3_PROFILING
+  WallClockTimer t;
+#endif
+
+  // Fill set containing moving vertices
+  // first, take them all
+#ifdef  CGAL_CONSTRUCT_INTRUSIVE_LIST_RANGE_CONSTRUCTOR
+  typedef CGAL::Prevent_deref<typename Tr::Finite_vertices_iterator> It;
+  Moving_vertices_set moving_vertices(It(tr_.finite_vertices_begin()),
+                                      It(tr_.finite_vertices_end()));
+#else
+  Moving_vertices_set moving_vertices;
+  collect_all_vertices(moving_vertices);
+#endif
+
+  std::size_t initial_vertices_nb = moving_vertices.size();
+#ifdef CGAL_MESH_3_OPTIMIZER_VERBOSE
+  double step_begin = running_time_.time();
+  std::cerr << "Running " << Mf::name() << "-smoothing ("
+    << initial_vertices_nb << " vertices)" << std::endl;
+#endif //CGAL_MESH_3_OPTIMIZER_VERBOSE
+
+  // Initialize big moves (stores the largest moves)
+  this->clear_big_moves();
+  big_moves_size_ =
+    (std::max)(std::size_t(1), std::size_t(moving_vertices.size()/500));
+
+  std::size_t nb_vertices_moved = -1;
+  bool convergence_stop = false;
+
+  // Iterate
+  int i = -1;
+  while ( ++i < nb_iterations && ! is_time_limit_reached() )
+  {
+    if(!do_freeze_)
+      nb_frozen_points_ = 0;
+    else
+      nb_vertices_moved = moving_vertices.size();
+
+    // Compute move for each vertex
+    Moves_vector moves = compute_moves(moving_vertices);
+    visitor.after_compute_moves();
+
+    //Pb with Freeze : sometimes a few vertices continue moving indefinitely
+    //if the nb of moving vertices is < 1% of total nb AND does not decrease
+    if(do_freeze_
+      && nb_vertices_moved < 0.005 * double(initial_vertices_nb)
+      && nb_vertices_moved == moving_vertices.size())
+    {
+      // we should stop because we are
+      // probably entering an infinite instable loop
+      convergence_stop = true;
+      break;
+    }
+
+    // Stop if time_limit is reached
+    if ( is_time_limit_reached() )
+      break;
+
+    // Update mesh with those moves
+    update_mesh(moves, moving_vertices, visitor);
+    visitor.end_of_iteration(i);
+
+#ifdef CGAL_MESH_3_OPTIMIZER_VERBOSE
+    std::size_t moving_vertices_size = moving_vertices.size();
+    std::cerr << boost::format("\r             \r"
+      "end iter.%1%, %2% / %3%, last step:%4$.2fs, step avg:%5$.2fs, avg big moves:%6$.3f ")
+    % (i+1)
+    % moving_vertices_size
+    % initial_vertices_nb
+    % (running_time_.time() - step_begin)
+    % (running_time_.time() / (i+1))
+    % sum_moves_;
+    step_begin = running_time_.time();
+#endif
+
+    if (do_freeze_ && nb_frozen_points_ == initial_vertices_nb )
+      break;
+
+    if(check_convergence())
+      break;
+  }
+#ifdef CGAL_MESH_3_OPTIMIZER_VERBOSE
+  std::cerr << std::endl;
+#endif
+
+  running_time_.stop();
+
+#ifdef CGAL_MESH_3_PROFILING
+  double optim_time = t.elapsed();
+# ifdef CGAL_MESH_3_EXPORT_PERFORMANCE_DATA
+  CGAL_MESH_3_SET_PERFORMANCE_DATA(std::string(Mf::name()) + "_optim_time", optim_time);
+# endif
+#endif
+
+#ifdef CGAL_MESH_3_OPTIMIZER_VERBOSE
+  if ( do_freeze_ && nb_frozen_points_ == initial_vertices_nb )
+    std::cerr << "All vertices frozen" << std::endl;
+  else if ( do_freeze_ && convergence_stop )
+    std::cerr << "Can't improve anymore" << std::endl;
+  else if ( is_time_limit_reached() )
+    std::cerr << "Time limit reached" << std::endl;
+  else if ( check_convergence() )
+    std::cerr << "Convergence reached" << std::endl;
+  else if( i >= nb_iterations )
+    std::cerr << "Max iteration number reached" << std::endl;
+
+  std::cerr << "Total optimization time: " << running_time_.time()
+            << "s" << std::endl << std::endl;
+#endif
+
+#ifdef CGAL_MESH_3_PROFILING
+  std::cerr << std::endl << "Total optimization 'wall-clock' time: "
+            << optim_time << "s" << std::endl;
+#endif
+
+  if ( do_freeze_ && nb_frozen_points_ == initial_vertices_nb )
+    return ALL_VERTICES_FROZEN;
+
+  else if ( do_freeze_ && convergence_stop )
+    return CANT_IMPROVE_ANYMORE;
+
+  else if ( is_time_limit_reached() )
+    return TIME_LIMIT_REACHED;
+
+  else if ( check_convergence() )
+    return CONVERGENCE_REACHED;
+
+  return MAX_ITERATION_NUMBER_REACHED;
+}
+
+template <typename C3T3, typename Md, typename Mf, typename V_>
+void
+Mesh_global_optimizer<C3T3,Md,Mf,V_>::
+collect_all_vertices(Moving_vertices_set& moving_vertices)
+{
+  typename Tr::Finite_vertices_iterator vit = tr_.finite_vertices_begin();
+  for(; vit != tr_.finite_vertices_end(); ++vit )
+    moving_vertices.insert(vit);
+}
+
+
+template <typename C3T3, typename Md, typename Mf, typename V_>
+typename Mesh_global_optimizer<C3T3,Md,Mf,V_>::Vector_3
+Mesh_global_optimizer<C3T3,Md,Mf,V_>::
+compute_move(const Vertex_handle& v)
+{
+  typename Gt::Compute_squared_length_3 sq_length =
+    Gt().compute_squared_length_3_object();
+
+  typename Gt::Construct_vector_3 vector =
+    Gt().construct_vector_3_object();
+
+  typename Gt::Construct_translated_point_3 translate =
+    Gt().construct_translated_point_3_object();
+
+  Cell_vector incident_cells;
+  incident_cells.reserve(64);
+#ifdef CGAL_LINKED_WITH_TBB
+  // Parallel
+  if (boost::is_convertible<Concurrency_tag, Parallel_tag>::value)
+  {
+    tr_.incident_cells_threadsafe(v, std::back_inserter(incident_cells));
+  }
+  else
+#endif //CGAL_LINKED_WITH_TBB
+  {
+    tr_.incident_cells(v, std::back_inserter(incident_cells));
+  }
+
+  // Get move from move function
+  Vector_3 move = move_function_(v, incident_cells, c3t3_, sizing_field_);
+
+  // Project surface vertex
+  if ( c3t3_.in_dimension(v) == 2 )
+  {
+    Point_3 new_position = translate(v->point(),move);
+    move = vector(v->point(), helper_.project_on_surface(new_position,v));
+  }
+
+  FT local_sq_size = min_circumradius_sq_length(v, incident_cells);
+  if ( FT(0) == local_sq_size )
+    return CGAL::NULL_VECTOR;
+
+  FT local_move_sq_ratio = sq_length(move) / local_sq_size;
+
+  // Move point only if displacement is big enough w.r.t local size
+  if ( local_move_sq_ratio < sq_freeze_ratio_ )
+  {
+    nb_frozen_points_++;
+    return CGAL::NULL_VECTOR;
+  }
+
+  // Update big moves
+  this->update_big_moves(local_move_sq_ratio);
+
+  return move;
+}
+
+
+template <typename C3T3, typename Md, typename Mf, typename V_>
+void
+Mesh_global_optimizer<C3T3,Md,Mf,V_>::
+update_mesh(const Moves_vector& moves,
+            Moving_vertices_set& moving_vertices,
+            Visitor& visitor)
+{
+  // Cells which have to be updated
+  Outdated_cell_set outdated_cells;
+
+#ifdef CGAL_MESH_3_PROFILING
+  std::cerr << "Moving vertices...";
+  WallClockTimer t;
+#endif
+
+#ifdef CGAL_LINKED_WITH_TBB
+  // Parallel
+  if (boost::is_convertible<Concurrency_tag, Parallel_tag>::value)
+  {
+    // Apply moves in triangulation
+    tbb::parallel_for(tbb::blocked_range<size_t>(0, moves.size()),
+      Move_vertex<
+        Self, C3T3_helpers, Tr, Moves_vector,
+        Moving_vertices_set, Outdated_cell_set>(
+          *this, helper_, moves, moving_vertices, outdated_cells)
+    );
+  }
+  // Sequential
+  else
+#endif // CGAL_LINKED_WITH_TBB
+  {
+    // Apply moves in triangulation
+    for ( typename Moves_vector::const_iterator it = moves.begin() ;
+         it != moves.end() ;
+         ++it )
+    {
+      const Vertex_handle& v = cpp11::get<0>(*it);
+      const Point_3& new_position = cpp11::get<1>(*it);
+      // Get size at new position
+      if ( Sizing_field::is_vertex_update_needed )
+      {
+        //FT size = sizing_field_(new_position,v);
+        FT size = cpp11::get<2>(*it);
+
+        // Move point
+        Vertex_handle new_v = helper_.move_point(v, new_position, outdated_cells, moving_vertices);
+
+        // Restore size in meshing_info data
+        new_v->set_meshing_info(size);
+      }
+      else // Move point
+      {
+        helper_.move_point(v, new_position, outdated_cells, moving_vertices);
+      }
+
+      // Stop if time_limit_ is reached, here we can't return without rebuilding
+      // restricted delaunay
+      if ( is_time_limit_reached() )
+        break;
+    }
+  }
+
+
+  visitor.after_move_points();
+
+#ifdef CGAL_MESH_3_PROFILING
+  std::cerr << "done in " << t.elapsed() << " seconds." << std::endl;
+#endif
+
+
+#ifdef CGAL_MESH_3_PROFILING
+  std::cerr << "Updating C3T3 (rebuilding restricted Delaunay)...";
+  t.reset();
+#endif
+
+  // Update c3t3
+#ifdef CGAL_INTRUSIVE_LIST
+  // AF:  rebuild_restricted_delaunay does more cell insertion/removal
+  //      which clashes with our inplace list
+  //      That's why we hand it in, and call clear() when we no longer need it
+  helper_.rebuild_restricted_delaunay(outdated_cells,
+                                      moving_vertices);
+#else
+  helper_.rebuild_restricted_delaunay(outdated_cells.begin(),
+                                      outdated_cells.end(),
+                                      moving_vertices);
+#endif
+
+  visitor.after_rebuild_restricted_delaunay();
+
+#ifdef CGAL_MESH_3_PROFILING
+  std::cerr << "Updating C3T3 done in " << t.elapsed() << " seconds." << std::endl;
+#endif
+
+}
+
+
+template <typename C3T3, typename Md, typename Mf, typename V_>
+void
+Mesh_global_optimizer<C3T3,Md,Mf,V_>::
+fill_sizing_field()
+{
+  std::map<Point_3,FT> value_map;
+
+#ifdef CGAL_LINKED_WITH_TBB
+  // Parallel
+  if (boost::is_convertible<Concurrency_tag, Parallel_tag>::value)
+  {
+    typedef tbb::enumerable_thread_specific<
+      std::vector< std::pair<Point_3, FT> > > Local_list;
+    Local_list local_lists;
+
+    tbb::parallel_do(
+      tr_.finite_vertices_begin(), tr_.finite_vertices_end(),
+      Compute_sizing_field_value<Self, Tr, Local_list>(*this, local_lists)
+    );
+
+    for(typename Local_list::iterator it_list = local_lists.begin() ;
+          it_list != local_lists.end() ;
+          ++it_list )
+    {
+      value_map.insert(it_list->begin(), it_list->end());
+    }
+  }
+  else
+#endif //CGAL_LINKED_WITH_TBB
+  {
+    // Fill map with local size
+    for(typename Tr::Finite_vertices_iterator vit = tr_.finite_vertices_begin();
+        vit != tr_.finite_vertices_end();
+        ++vit)
+    {
+      value_map.insert(std::make_pair(vit->point(),
+                                      average_circumradius_length(vit)));
+    }
+  }
+
+  // fill sizing field
+  sizing_field_.fill(value_map);
+}
+
+
+template <typename C3T3, typename Md, typename Mf, typename V_>
+bool
+Mesh_global_optimizer<C3T3,Md,Mf,V_>::
+check_convergence() const
+{
+  FT sum(0);
+  for( typename std::multiset<FT>::const_iterator
+       it = big_moves_.begin(), end = big_moves_.end() ; it != end ; ++it )
+  {
+    sum += CGAL::sqrt(*it);
+  }
+
+  FT average_move = sum/FT(big_moves_size_);/*even if set is not full, divide*/
+       /*by max size so that if only 1 point moves, it goes to 0*/
+#ifdef CGAL_MESH_3_OPTIMIZER_VERBOSE
+  sum_moves_ = average_move;
+#endif
+
+  return ( average_move < convergence_ratio_ );
+}
+
+
+template <typename C3T3, typename Md, typename Mf, typename V_>
+typename Mesh_global_optimizer<C3T3,Md,Mf,V_>::FT
+Mesh_global_optimizer<C3T3,Md,Mf,V_>::
+average_circumradius_length(const Vertex_handle& v) const
+{
+  Cell_vector incident_cells;
+  incident_cells.reserve(64);
+#ifdef CGAL_LINKED_WITH_TBB
+  // Parallel
+  if (boost::is_convertible<Concurrency_tag, Parallel_tag>::value)
+  {
+    tr_.incident_cells_threadsafe(v, std::back_inserter(incident_cells));
+  }
+  else
+#endif //CGAL_LINKED_WITH_TBB
+  {
+    tr_.incident_cells(v, std::back_inserter(incident_cells));
+  }
+
+  FT sum_len (0);
+  unsigned int nb = 0;
+
+  for ( typename Cell_vector::iterator cit = incident_cells.begin() ;
+       cit != incident_cells.end() ;
+       ++cit)
+  {
+    if ( c3t3_.is_in_complex(*cit) )
+    {
+      sum_len += CGAL::sqrt(sq_circumradius_length(*cit,v));
+      ++nb;
+    }
+  }
+
+  // nb == 0 could happen if there is an isolated point.
+  if ( 0 != nb )
+  {
+    return sum_len/nb;
+  }
+  else
+  {
+    // Use outside cells to compute size of point
+    for ( typename Cell_vector::iterator cit = incident_cells.begin() ;
+         cit != incident_cells.end() ;
+         ++cit)
+    {
+      if ( !tr_.is_infinite(*cit) )
+      {
+        sum_len += CGAL::sqrt(sq_circumradius_length(*cit,v));
+        ++nb;
+      }
+    }
+
+    CGAL_assertion(nb!=0);
+    CGAL_assertion(sum_len!=0);
+    return sum_len/nb;
+  }
+}
+
+
+template <typename C3T3, typename Md, typename Mf, typename V_>
+typename Mesh_global_optimizer<C3T3,Md,Mf,V_>::FT
+Mesh_global_optimizer<C3T3,Md,Mf,V_>::
+min_circumradius_sq_length(const Vertex_handle& v, const Cell_vector& incident_cells) const
+{
+  // Get first cell sq_circumradius_length
+  typename Cell_vector::const_iterator cit = incident_cells.begin();
+  while ( incident_cells.end() != cit && !c3t3_.is_in_complex(*cit) ) { ++cit; }
+
+  // if vertex is isolated ...
+  if ( incident_cells.end() == cit )
+    return FT(0);
+
+  // Initialize min
+  FT min_sq_len = sq_circumradius_length(*cit++,v);
+
+  // Find the minimum value
+  for ( ; cit != incident_cells.end() ; ++cit )
+  {
+    if ( !c3t3_.is_in_complex(*cit) )
+      continue;
+
+    min_sq_len = (std::min)(min_sq_len,sq_circumradius_length(*cit,v));
+  }
+
+  return min_sq_len;
+}
+
+
+template <typename C3T3, typename Md, typename Mf, typename V_>
+typename Mesh_global_optimizer<C3T3,Md,Mf,V_>::FT
+Mesh_global_optimizer<C3T3,Md,Mf,V_>::
+sq_circumradius_length(const Cell_handle& cell, const Vertex_handle& v) const
+{
+  typename Gt::Compute_squared_distance_3 sq_distance =
+    Gt().compute_squared_distance_3_object();
+
+  const Point_3 circumcenter = tr_.dual(cell);
+  return ( sq_distance(v->point(), circumcenter) );
+}
+
+} // end namespace Mesh_3
+
+} //namespace CGAL
+
+#endif // CGAL_MESH_3_MESH_GLOBAL_OPTIMIZER_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Mesh_sizing_field.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Mesh_sizing_field.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Mesh_sizing_field.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Mesh_sizing_field.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Mesh_surface_cell_base_3.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Mesh_surface_cell_base_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Mesh_surface_cell_base_3.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Mesh_surface_cell_base_3.h
diff --git a/3rdparty/CGAL/include/CGAL/Mesh_3/Mesher_3.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Mesher_3.h
new file mode 100644
index 0000000..7ebcc3d
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Mesh_3/Mesher_3.h
@@ -0,0 +1,700 @@
+// Copyright (c) 2009-2014 INRIA Sophia-Antipolis (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
+// 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(s)     : Laurent Rineau, Stephane Tayeb, Clement Jamin
+//
+//******************************************************************************
+// File Description :
+// Implements a mesher_3 with two mesher levels : one for facets and one for
+// tets.
+//******************************************************************************
+
+#ifndef CGAL_MESH_3_MESHER_3_H
+#define CGAL_MESH_3_MESHER_3_H
+
+#include <CGAL/Mesh_3/config.h>
+
+#include <CGAL/Mesh_3/Dump_c3t3.h>
+
+#include<CGAL/Mesh_3/Refine_facets_3.h>
+#include<CGAL/Mesh_3/Refine_facets_manifold_base.h>
+#include<CGAL/Mesh_3/Refine_cells_3.h>
+#include <CGAL/Mesh_3/Refine_tets_visitor.h>
+#include <CGAL/Mesher_level_visitors.h>
+#include <CGAL/Kernel_traits.h>
+
+#ifdef CGAL_MESH_3_USE_OLD_SURFACE_RESTRICTED_DELAUNAY_UPDATE
+#include <CGAL/Surface_mesher/Surface_mesher_visitor.h>
+#endif
+
+#include <CGAL/Mesh_3/Concurrent_mesher_config.h>
+#include <CGAL/Real_timer.h>
+
+#ifdef CGAL_MESH_3_PROFILING
+  #include <CGAL/Mesh_3/Profiling_tools.h>
+#endif
+
+#ifdef CGAL_LINKED_WITH_TBB
+#  if TBB_IMPLEMENT_CPP0X
+#   include <tbb/compat/thread>
+#  else
+#   include <thread>
+#  endif
+#endif
+
+#include <boost/format.hpp>
+#include <boost/type_traits/is_convertible.hpp>
+#include <string>
+
+namespace CGAL {
+namespace Mesh_3 {
+
+/************************************************
+// Class Mesher_3_base
+// Two versions: sequential / parallel
+************************************************/
+
+// Sequential
+template <typename Tr, typename Concurrency_tag>
+class Mesher_3_base
+{
+protected:
+  typedef typename Tr::Lock_data_structure Lock_data_structure;
+
+  Mesher_3_base(const Bbox_3 &, int) {}
+
+  Lock_data_structure *get_lock_data_structure() { return 0; }
+  WorksharingDataStructureType *get_worksharing_data_structure() { return 0; }
+  void set_bbox(const Bbox_3 &) {}
+};
+
+#ifdef CGAL_LINKED_WITH_TBB
+// Parallel
+template <typename Tr>
+class Mesher_3_base<Tr, Parallel_tag>
+{
+protected:
+  typedef typename Tr::Lock_data_structure Lock_data_structure;
+
+  Mesher_3_base(const Bbox_3 &bbox, int num_grid_cells_per_axis)
+  : m_lock_ds(bbox, num_grid_cells_per_axis),
+    m_worksharing_ds(bbox)
+  {}
+
+  Lock_data_structure *get_lock_data_structure()
+  {
+    return &m_lock_ds;
+  }
+  WorksharingDataStructureType *get_worksharing_data_structure()
+  {
+    return &m_worksharing_ds;
+  }
+
+  void set_bbox(const Bbox_3 &bbox)
+  {
+    m_lock_ds.set_bbox(bbox);
+    m_worksharing_ds.set_bbox(bbox);
+  }
+
+  /// Lock data structure
+  Lock_data_structure m_lock_ds;
+  /// Worksharing data structure
+  WorksharingDataStructureType m_worksharing_ds;
+};
+#endif // CGAL_LINKED_WITH_TBB
+
+
+/************************************************
+ *
+ * Mesher_3 class
+ *
+ ************************************************/
+
+template<class C3T3, class MeshCriteria, class MeshDomain>
+class Mesher_3
+: public Mesher_3_base<
+    typename C3T3::Triangulation,
+#ifdef CGAL_DEBUG_FORCE_SEQUENTIAL_MESH_REFINEMENT
+    Sequential_tag
+#else
+    typename C3T3::Concurrency_tag
+#endif
+  >
+{
+public:
+#ifdef CGAL_DEBUG_FORCE_SEQUENTIAL_MESH_REFINEMENT
+  typedef Sequential_tag                            Concurrency_tag;
+#else
+  typedef typename C3T3::Concurrency_tag            Concurrency_tag;
+#endif
+  typedef typename C3T3::Triangulation              Triangulation;
+  typedef typename Triangulation::Point             Point;
+  typedef typename Kernel_traits<Point>::Kernel     Kernel;
+  typedef typename Kernel::Vector_3                 Vector;
+  typedef typename MeshDomain::Index                Index;
+
+  // Self
+  typedef Mesher_3<C3T3, MeshCriteria, MeshDomain>      Self;
+#ifdef CGAL_DEBUG_FORCE_SEQUENTIAL_MESH_REFINEMENT
+  typedef Mesher_3_base<Triangulation, Sequential_tag> Base;
+#else
+  typedef Mesher_3_base<Triangulation, typename C3T3::Concurrency_tag> Base;
+#endif
+
+  using Base::get_lock_data_structure;
+
+  //-------------------------------------------------------
+  // Mesher_levels
+  //-------------------------------------------------------
+  // typedef Refine_facets_manifold_base<Rf_base>      Rf_manifold_base;
+
+  /// Facets mesher level
+  typedef Refine_facets_3<
+      Triangulation,
+      typename MeshCriteria::Facet_criteria,
+      MeshDomain,
+      C3T3,
+      Null_mesher_level,
+      Concurrency_tag,
+      Refine_facets_manifold_base
+    >                                               Facets_level;
+
+  /// Cells mesher level
+  typedef Refine_cells_3<
+      Triangulation,
+      typename MeshCriteria::Cell_criteria,
+      MeshDomain,
+      C3T3,
+      Facets_level,
+      Concurrency_tag>                              Cells_level;
+
+  //-------------------------------------------------------
+  // Visitors
+  //-------------------------------------------------------
+  /// Facets visitor : to update cells when refining surface
+  typedef tets::Refine_facets_visitor<
+      Triangulation,
+      Cells_level,
+      Null_mesh_visitor>                            Facets_visitor;
+
+#ifndef CGAL_MESH_3_USE_OLD_SURFACE_RESTRICTED_DELAUNAY_UPDATE
+  /// Cells visitor : it just need to know previous level
+  typedef Null_mesh_visitor_level<Facets_visitor>   Cells_visitor;
+#else
+  /// Cells visitor : to update surface (restore restricted Delaunay)
+  /// when refining cells
+  typedef Surface_mesher::Visitor<
+      Triangulation,
+      Facets_level,
+      Facets_visitor>                               Cells_visitor;
+#endif
+
+  /// Constructor
+  Mesher_3(C3T3&               c3t3,
+           const MeshDomain&   domain,
+           const MeshCriteria& criteria);
+
+  /// Destructor
+  ~Mesher_3() 
+  {
+    // The lock data structure is going to be destroyed
+    r_c3t3_.triangulation().set_lock_data_structure(NULL);
+  }
+
+  /// Launch mesh refinement
+  double refine_mesh(std::string dump_after_refine_surface_prefix = "");
+
+  /// Debug
+  std::string debug_info() const;
+  std::string debug_info_header() const;
+
+  // Step-by-step methods
+  void initialize();
+  void fix_c3t3();
+  void display_number_of_bad_elements();
+  void one_step();
+  bool is_algorithm_done();
+
+#ifdef CGAL_MESH_3_MESHER_STATUS_ACTIVATED
+  struct Mesher_status
+  {
+    std::size_t vertices, facet_queue, cells_queue;
+
+    Mesher_status(std::size_t v, std::size_t f, std::size_t c)
+     : vertices(v), facet_queue(f), cells_queue(c) {}
+  };
+
+  Mesher_status status() const;
+#endif
+
+private:
+  /// The oracle
+  const MeshDomain& r_oracle_;
+
+  /// Meshers
+  Null_mesher_level null_mesher_;
+  Facets_level facets_mesher_;
+  Cells_level cells_mesher_;
+
+  /// Visitors
+  Null_mesh_visitor null_visitor_;
+  Facets_visitor facets_visitor_;
+  Cells_visitor cells_visitor_;
+
+  /// The container of the resulting mesh
+  C3T3& r_c3t3_;
+
+private:
+  // Disabled copy constructor
+  Mesher_3(const Self& src);
+  // Disabled assignment operator
+  Self& operator=(const Self& src);
+
+};  // end class Mesher_3
+
+
+
+template<class C3T3, class MC, class MD>
+Mesher_3<C3T3,MC,MD>::Mesher_3(C3T3& c3t3,
+                               const MD& domain,
+                               const MC& criteria)
+: Base(c3t3.bbox(),
+       Concurrent_mesher_config::get().locking_grid_num_cells_per_axis)
+, r_oracle_(domain)
+, null_mesher_()
+, facets_mesher_(c3t3.triangulation(),
+                 criteria.facet_criteria_object(),
+                 domain,
+                 null_mesher_,
+                 c3t3)
+, cells_mesher_(c3t3.triangulation(),
+                criteria.cell_criteria_object(),
+                domain,
+                facets_mesher_,
+                c3t3)
+, null_visitor_()
+, facets_visitor_(&cells_mesher_, &null_visitor_)
+#ifndef CGAL_MESH_3_USE_OLD_SURFACE_RESTRICTED_DELAUNAY_UPDATE
+, cells_visitor_(facets_visitor_)
+#else
+, cells_visitor_(&facets_mesher_, &facets_visitor_)
+#endif
+, r_c3t3_(c3t3)
+{
+  facets_mesher_.set_lock_ds(this->get_lock_data_structure());
+  facets_mesher_.set_worksharing_ds(this->get_worksharing_data_structure());
+  cells_mesher_.set_lock_ds(this->get_lock_data_structure());
+  cells_mesher_.set_worksharing_ds(this->get_worksharing_data_structure());
+}
+
+
+
+template<class C3T3, class MC, class MD>
+double
+Mesher_3<C3T3,MC,MD>::refine_mesh(std::string dump_after_refine_surface_prefix)
+{
+  CGAL::Real_timer timer;
+  timer.start();
+  double elapsed_time = 0.;
+
+  // First surface mesh could modify c3t3 without notifying cells_mesher
+  // So we have to ensure that no old cell will be left in c3t3
+  // Second, the c3t3 object could have been corrupted since the last call
+  // to `refine_mesh`, for example by inserting new vertices in the
+  // triangulation.
+  r_c3t3_.clear_cells_and_facets_from_c3t3();
+
+#ifndef CGAL_MESH_3_VERBOSE
+  // Scan surface and refine it
+  initialize();
+
+#ifdef CGAL_MESH_3_PROFILING
+  std::cerr << "Refining facets..." << std::endl;
+  WallClockTimer t;
+#endif
+  facets_mesher_.refine(facets_visitor_);
+#ifdef CGAL_MESH_3_PROFILING
+  double facet_ref_time = t.elapsed();
+  std::cerr << "==== Facet refinement: " << facet_ref_time << " seconds ===="
+            << std::endl << std::endl;
+# ifdef CGAL_MESH_3_EXPORT_PERFORMANCE_DATA
+    // If it's parallel but the refinement is forced to sequential, we don't
+    // output the value
+#   ifndef CGAL_DEBUG_FORCE_SEQUENTIAL_MESH_REFINEMENT
+  CGAL_MESH_3_SET_PERFORMANCE_DATA("Facets_time", facet_ref_time);
+#   endif
+# endif
+#endif
+
+#if defined(CHECK_AND_DISPLAY_THE_NUMBER_OF_BAD_ELEMENTS_IN_THE_END)
+  std::cerr << std::endl
+    << "===============================================================" << std::endl
+    << "=== CHECK_AND_DISPLAY_THE_NUMBER_OF_BAD_ELEMENTS_IN_THE_END ===" << std::endl;
+  display_number_of_bad_elements();
+  std::cerr
+    << "==============================================================="
+    << std::endl << std::endl;
+#endif
+
+  // Then activate facet to surface visitor (surface could be
+  // refined again if it is encroached)
+  facets_visitor_.activate();
+
+  dump_c3t3(r_c3t3_, dump_after_refine_surface_prefix);
+
+  // Then scan volume and refine it
+  cells_mesher_.scan_triangulation();
+#ifdef CGAL_MESH_3_PROFILING
+  std::cerr << "Refining cells..." << std::endl;
+  t.reset();
+#endif
+  cells_mesher_.refine(cells_visitor_);
+#ifdef CGAL_MESH_3_PROFILING
+  double cell_ref_time = t.elapsed();
+  std::cerr << "==== Cell refinement: " << cell_ref_time << " seconds ===="
+            << std::endl << std::endl;
+# ifdef CGAL_MESH_3_EXPORT_PERFORMANCE_DATA
+    // If it's parallel but the refinement is forced to sequential, we don't
+    // output the value
+#   ifndef CGAL_DEBUG_FORCE_SEQUENTIAL_MESH_REFINEMENT
+  CGAL_MESH_3_SET_PERFORMANCE_DATA("Cells_refin_time", cell_ref_time);
+#   endif
+# endif
+#endif
+
+#if defined(CGAL_MESH_3_VERBOSE) || defined(CGAL_MESH_3_PROFILING)
+  std::cerr
+    << "Vertices: " << r_c3t3_.triangulation().number_of_vertices() << std::endl
+    << "Facets  : " << r_c3t3_.number_of_facets_in_complex() << std::endl
+    << "Tets    : " << r_c3t3_.number_of_cells_in_complex() << std::endl;
+#endif
+
+#else // ifdef CGAL_MESH_3_VERBOSE
+  std::cerr << "Start surface scan...";
+  initialize();
+  std::cerr << "end scan. [Bad facets:" << facets_mesher_.size() << "]";
+  std::cerr << std::endl << std::endl;
+  elapsed_time += timer.time();
+  timer.stop(); timer.reset(); timer.start();
+
+  const Triangulation& r_tr = r_c3t3_.triangulation();
+  int nbsteps = 0;
+
+  std::cerr << "Refining Surface...\n";
+  std::cerr << "Legend of the following line: "
+            << "(#vertices,#steps," << cells_mesher_.debug_info_header()
+            << ")\n";
+
+  std::cerr << "(" << r_tr.number_of_vertices() << ","
+            << nbsteps << "," << cells_mesher_.debug_info() << ")";
+
+  while ( ! facets_mesher_.is_algorithm_done() )
+  {
+    facets_mesher_.one_step(facets_visitor_);
+    std::cerr
+    << boost::format("\r             \r"
+                     "(%1%,%2%,%3%) (%|4$.1f| vertices/s)")
+    % r_tr.number_of_vertices()
+    % nbsteps % cells_mesher_.debug_info()
+    % (nbsteps / timer.time());
+    ++nbsteps;
+  }
+  std::cerr << std::endl;
+  std::cerr << "Total refining surface time: " << timer.time() << "s" << std::endl;
+  std::cerr << std::endl;
+
+  elapsed_time += timer.time();
+  timer.stop(); timer.reset(); timer.start();
+  nbsteps = 0;
+
+  facets_visitor_.activate();
+  dump_c3t3(r_c3t3_, dump_after_refine_surface_prefix);
+  std::cerr << "Start volume scan...";
+  cells_mesher_.scan_triangulation();
+  std::cerr << "end scan. [Bad tets:" << cells_mesher_.size() << "]";
+  std::cerr << std::endl << std::endl;
+  elapsed_time += timer.time();
+  timer.stop(); timer.reset(); timer.start();
+
+  std::cerr << "Refining...\n";
+  std::cerr << "Legend of the following line: "
+            << "(#vertices,#steps," << cells_mesher_.debug_info_header()
+            << ")\n";
+  std::cerr << "(" << r_tr.number_of_vertices() << ","
+            << nbsteps << "," << cells_mesher_.debug_info() << ")";
+
+  while ( ! cells_mesher_.is_algorithm_done() )
+  {
+    cells_mesher_.one_step(cells_visitor_);
+    std::cerr
+        << boost::format("\r             \r"
+                     "(%1%,%2%,%3%) (%|4$.1f| vertices/s)")
+        % r_tr.number_of_vertices()
+        % nbsteps % cells_mesher_.debug_info()
+        % (nbsteps / timer.time());
+    ++nbsteps;
+  }
+  std::cerr << std::endl;
+
+  std::cerr << "Total refining volume time: " << timer.time() << "s" << std::endl;
+  std::cerr << "Total refining time: " << timer.time()+elapsed_time << "s" << std::endl;
+  std::cerr << std::endl;
+#endif
+
+  timer.stop();
+  elapsed_time += timer.time();
+
+#if defined(CHECK_AND_DISPLAY_THE_NUMBER_OF_BAD_ELEMENTS_IN_THE_END) \
+ || defined(SHOW_REMAINING_BAD_ELEMENT_IN_RED)
+  std::cerr << std::endl
+    << "===============================================================" << std::endl
+    << "=== CHECK_AND_DISPLAY_THE_NUMBER_OF_BAD_ELEMENTS_IN_THE_END ===" << std::endl;
+  display_number_of_bad_elements();
+  std::cerr
+    << "==============================================================="
+    << std::endl << std::endl;
+#endif
+
+  return elapsed_time;
+}
+
+
+template<class C3T3, class MC, class MD>
+void
+Mesher_3<C3T3,MC,MD>::
+initialize()
+{
+#ifdef CGAL_MESH_3_PROFILING
+  std::cerr << "Initializing... ";
+  WallClockTimer t;
+#endif
+  //=====================================
+  // Bounding box estimation
+  //=====================================
+#if defined(CGAL_LINKED_WITH_TBB) || \
+    defined(CGAL_SEQUENTIAL_MESH_3_ADD_OUTSIDE_POINTS_ON_A_FAR_SPHERE)
+
+#ifndef CGAL_SEQUENTIAL_MESH_3_ADD_OUTSIDE_POINTS_ON_A_FAR_SPHERE
+  if(boost::is_convertible<Concurrency_tag, Parallel_tag>::value)
+#endif // If that macro is defined, then estimated_bbox must be initialized
+  {
+    Base::set_bbox(r_oracle_.bbox());
+  }
+#endif // CGAL_LINKED_WITH_TBB||"sequential use far sphere"
+
+  //========================================
+  // Initialization: parallel or sequential
+  //========================================
+
+#ifdef CGAL_LINKED_WITH_TBB
+  // Parallel
+  if (boost::is_convertible<Concurrency_tag, Parallel_tag>::value)
+  {
+    // we're not multi-thread, yet
+    r_c3t3_.triangulation().set_lock_data_structure(0);
+
+# ifndef CGAL_PARALLEL_MESH_3_DO_NOT_ADD_OUTSIDE_POINTS_ON_A_FAR_SPHERE
+
+    if (r_c3t3_.number_of_far_points() == 0 && r_c3t3_.number_of_facets() == 0)
+    {
+      const Bbox_3 &bbox = r_oracle_.bbox();
+
+      // Compute radius for far sphere
+      const double xdelta = bbox.xmax()-bbox.xmin();
+      const double ydelta = bbox.ymax()-bbox.ymin();
+      const double zdelta = bbox.zmax()-bbox.zmin();
+      const double radius = 5. * std::sqrt(xdelta*xdelta +
+                                           ydelta*ydelta +
+                                           zdelta*zdelta);
+      const Vector center(
+        bbox.xmin() + 0.5*xdelta,
+        bbox.ymin() + 0.5*ydelta,
+        bbox.zmin() + 0.5*zdelta);
+#  ifdef CGAL_CONCURRENT_MESH_3_VERBOSE
+      std::cerr << "Adding points on a far sphere (radius = " << radius <<")...";
+#  endif
+      Random_points_on_sphere_3<Point> random_point(radius);
+      const int NUM_PSEUDO_INFINITE_VERTICES = static_cast<int>(
+        float(tbb::task_scheduler_init::default_num_threads())
+        * Concurrent_mesher_config::get().num_pseudo_infinite_vertices_per_core);
+      for (int i = 0 ; i < NUM_PSEUDO_INFINITE_VERTICES ; ++i, ++random_point)
+        r_c3t3_.add_far_point(*random_point + center);
+    
+#  ifdef CGAL_CONCURRENT_MESH_3_VERBOSE
+      std::cerr << "done." << std::endl;
+#  endif
+    }
+# endif // CGAL_PARALLEL_MESH_3_DO_NOT_ADD_OUTSIDE_POINTS_ON_A_FAR_SPHERE
+
+#ifdef CGAL_MESH_3_PROFILING
+    double init_time = t.elapsed();
+    std::cerr << "done in " << init_time << " seconds." << std::endl;
+#endif
+
+    // Scan triangulation
+    facets_mesher_.scan_triangulation();
+
+    // From now on, we're multi-thread
+    r_c3t3_.triangulation().set_lock_data_structure(get_lock_data_structure());
+  }
+  // Sequential
+  else
+#endif // CGAL_LINKED_WITH_TBB
+  {
+#ifdef CGAL_SEQUENTIAL_MESH_3_ADD_OUTSIDE_POINTS_ON_A_FAR_SPHERE
+    if (r_c3t3_.number_of_far_points() == 0 && r_c3t3_.number_of_facets() == 0)
+    {
+      /*std::cerr << "A little bit of refinement... ";
+
+      // Start by a little bit of refinement to get a coarse mesh
+      // => Good approx of bounding box
+      const int NUM_VERTICES_OF_COARSE_MESH = 40;
+      facets_mesher_.refine_sequentially_up_to_N_vertices(
+        facets_visitor_, NUM_VERTICES_OF_COARSE_MESH);
+
+      std::cerr << "done." << std::endl;
+      std::cerr
+        << "Vertices: " << r_c3t3_.triangulation().number_of_vertices() << std::endl
+        << "Facets  : " << r_c3t3_.number_of_facets_in_complex() << std::endl
+        << "Tets    : " << r_c3t3_.number_of_cells_in_complex() << std::endl;*/
+
+      // Compute radius for far sphere
+      //const Bbox_3 &bbox = r_c3t3_.bbox();
+      CGAL_assertion(is_estimated_bbox_initialized);
+      const Bbox_3 &bbox = estimated_bbox;
+      const double xdelta = bbox.xmax()-bbox.xmin();
+      const double ydelta = bbox.ymax()-bbox.ymin();
+      const double zdelta = bbox.zmax()-bbox.zmin();
+      const double radius = 5. * std::sqrt(xdelta*xdelta +
+                                           ydelta*ydelta +
+                                           zdelta*zdelta);
+      const Vector center(
+        bbox.xmin() + 0.5*xdelta,
+        bbox.ymin() + 0.5*ydelta,
+        bbox.zmin() + 0.5*zdelta);
+# ifdef CGAL_MESH_3_VERBOSE
+      std::cerr << "Adding points on a far sphere (radius = " << radius << ")...";
+# endif
+      Random_points_on_sphere_3<Point> random_point(radius);
+      const int NUM_PSEUDO_INFINITE_VERTICES = 12*2;
+      for (int i = 0 ; i < NUM_PSEUDO_INFINITE_VERTICES ; ++i, ++random_point)
+        r_c3t3_.add_far_point(*random_point + center);
+# ifdef CGAL_MESH_3_VERBOSE
+      std::cerr << "done." << std::endl;
+# endif
+    }
+#endif // CGAL_SEQUENTIAL_MESH_3_ADD_OUTSIDE_POINTS_ON_A_FAR_SPHERE
+
+#ifdef CGAL_MESH_3_PROFILING
+    double init_time = t.elapsed();
+    std::cerr << "done in " << init_time << " seconds." << std::endl;
+#endif
+
+    // Scan triangulation
+    facets_mesher_.scan_triangulation();
+
+  }
+}
+
+
+template<class C3T3, class MC, class MD>
+void
+Mesher_3<C3T3,MC,MD>::
+fix_c3t3()
+{
+  if ( ! facets_visitor_.is_active() )
+  {
+    cells_mesher_.scan_triangulation();
+  }
+}
+
+
+template<class C3T3, class MC, class MD>
+void
+Mesher_3<C3T3,MC,MD>::
+display_number_of_bad_elements()
+{
+  int nf = facets_mesher_.number_of_bad_elements();
+  int nc = cells_mesher_.number_of_bad_elements();
+  std::cerr << "Bad facets: " << nf << " - Bad cells: " << nc << std::endl;
+}
+
+template<class C3T3, class MC, class MD>
+void
+Mesher_3<C3T3,MC,MD>::
+one_step()
+{
+  if ( ! facets_visitor_.is_active() )
+  {
+    facets_mesher_.one_step(facets_visitor_);
+
+    if ( facets_mesher_.is_algorithm_done() )
+    {
+      facets_visitor_.activate();
+      cells_mesher_.scan_triangulation();
+    }
+  }
+  else
+  {
+    cells_mesher_.one_step(cells_visitor_);
+  }
+}
+
+template<class C3T3, class MC, class MD>
+bool
+Mesher_3<C3T3,MC,MD>::
+is_algorithm_done()
+{
+  return cells_mesher_.is_algorithm_done();
+}
+
+
+#ifdef CGAL_MESH_3_MESHER_STATUS_ACTIVATED
+template<class C3T3, class MC, class MD>
+typename Mesher_3<C3T3,MC,MD>::Mesher_status
+Mesher_3<C3T3,MC,MD>::
+status() const
+{
+  return Mesher_status(r_c3t3_.triangulation().number_of_vertices(),
+                       facets_mesher_.queue_size(),
+                       cells_mesher_.queue_size());
+}
+#endif
+
+template<class C3T3, class MC, class MD>
+inline
+std::string
+Mesher_3<C3T3,MC,MD>::debug_info() const
+{
+  return cells_mesher_.debug_info();
+}
+
+template<class C3T3, class MC, class MD>
+inline
+std::string
+Mesher_3<C3T3,MC,MD>::debug_info_header() const
+{
+  return cells_mesher_.debug_info_header();
+}
+
+}  // end namespace Mesh_3
+
+}  // end namespace CGAL
+
+
+#endif // CGAL_MESH_3_MESHER_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Mesher_level.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Mesher_level.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Mesher_level.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Mesher_level.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Mesher_level_default_implementations.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Mesher_level_default_implementations.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Mesher_level_default_implementations.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Mesher_level_default_implementations.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Null_exuder_visitor.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Null_exuder_visitor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Null_exuder_visitor.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Null_exuder_visitor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Null_global_optimizer_visitor.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Null_global_optimizer_visitor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Null_global_optimizer_visitor.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Null_global_optimizer_visitor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Null_perturber_visitor.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Null_perturber_visitor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Null_perturber_visitor.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Null_perturber_visitor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Odt_move.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Odt_move.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Odt_move.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Odt_move.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Poisson_refine_cells_3.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Poisson_refine_cells_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Poisson_refine_cells_3.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Poisson_refine_cells_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Polyline_with_context.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Polyline_with_context.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Polyline_with_context.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Polyline_with_context.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Profile_counter.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Profile_counter.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Profile_counter.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Profile_counter.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Profiling_tools.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Profiling_tools.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Profiling_tools.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Profiling_tools.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Protect_edges_sizing_field.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Protect_edges_sizing_field.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Protect_edges_sizing_field.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Protect_edges_sizing_field.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Refine_cells_3.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Refine_cells_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Refine_cells_3.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Refine_cells_3.h
diff --git a/3rdparty/CGAL/include/CGAL/Mesh_3/Refine_facets_3.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Refine_facets_3.h
new file mode 100644
index 0000000..d23b771
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Mesh_3/Refine_facets_3.h
@@ -0,0 +1,1967 @@
+// Copyright (c) 2009 INRIA Sophia-Antipolis (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
+// 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(s)     : Laurent Rineau, Stéphane Tayeb
+//
+//******************************************************************************
+// File Description :
+// Implements a mesher level for facets.
+//******************************************************************************
+
+#ifndef CGAL_MESH_3_REFINE_FACETS_3_H
+#define CGAL_MESH_3_REFINE_FACETS_3_H
+
+#include <CGAL/Mesh_3/Mesher_level.h>
+#include <CGAL/Mesh_3/Mesher_level_default_implementations.h>
+#ifdef CGAL_LINKED_WITH_TBB
+  #include <tbb/tbb.h>
+#endif
+
+#include <CGAL/Meshes/Filtered_deque_container.h>
+#include <CGAL/Meshes/Filtered_multimap_container.h>
+#include <CGAL/Meshes/Double_map_container.h>
+
+#include <CGAL/Meshes/Triangulation_mesher_level_traits_3.h>
+
+#ifdef CGAL_MESH_3_PROFILING
+  #include <CGAL/Mesh_3/Profiling_tools.h>
+#endif
+
+#include <CGAL/Object.h>
+
+#include <boost/format.hpp>
+#include <boost/optional.hpp>
+#include <boost/mpl/has_xxx.hpp>
+#include <boost/mpl/if.hpp>
+#include <CGAL/tuple.h>
+#include <boost/type_traits/is_convertible.hpp>
+#include <sstream>
+
+namespace CGAL {
+
+namespace Mesh_3 {
+
+// Helper meta-programming functions, to allow backward compatibility.
+//
+//   - Has_Is_facet_bad and Had_Facet_badness are used to detect if a model
+//     of the MeshFacetCriteria_3 concept follows the specifications of
+//     CGAL-3.7 (with Facet_badness) or later (with Is_facet_bad).
+//
+//   - Then the meta-function Get_Is_facet_bad is used to get the actual
+//     type, either Facet_criteria::Facet_badness or
+//      Facet_criteria::Is_facet_bad.
+
+BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Has_Is_facet_bad, Is_facet_bad, true)
+BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Has_Facet_badness, Facet_badness, false)
+
+// template class, used when use_facet_badness = false
+template <typename Facet_criteria,
+          bool use_facet_badness = (!Has_Is_facet_bad<Facet_criteria>::value) &&
+                                    Has_Facet_badness<Facet_criteria>::value >
+struct Get_Is_facet_bad {
+  typedef typename Facet_criteria::Is_facet_bad Type;
+  typedef Type type; // compatibility with Boost
+};
+
+// partial specialization when use_facet_badness == true
+template <typename Facet_criteria>
+struct Get_Is_facet_bad<Facet_criteria, true> {
+  typedef typename Facet_criteria::Facet_badness Type;
+  typedef Type type;
+};
+
+  // Predicate to know if a facet in a refinement queue is a zombie
+  // A facet is a pair <cell, index of the opposite vertex>.
+  // A facet is a "zombie" if at least one of its two adjacent cells
+  // has been erased. We test it thanks to the "erase counter" which
+  // is inside each cell (incremented by the compact container).
+  // In the refinement queue, we store a tuple
+  // <facet1, facet1_erase counter, facet2, facet2_erase_counter>
+  // where facet2 = mirror_facet(facet1) and facetx_erase_counter is
+  // the erase_counter of facetx's cell when added to the queue>
+  template<typename Facet>
+  class Facet_to_refine_is_not_zombie
+  {
+  public:
+    Facet_to_refine_is_not_zombie() {}
+
+    bool operator()(const CGAL::cpp11::tuple<
+      Facet, unsigned int, Facet, unsigned int> &f) const
+    {
+#ifdef _DEBUG
+      int f1_current_erase_counter = CGAL::cpp11::get<0>(f).first->erase_counter();
+      int f1_saved_erase_counter = CGAL::cpp11::get<1>(f);
+      int f2_current_erase_counter = CGAL::cpp11::get<2>(f).first->erase_counter();
+      int f2_saved_erase_counter = CGAL::cpp11::get<3>(f);
+      //f1_current_erase_counter - f1_saved_erase_counter + f2_current_erase_counter - f2_saved_erase_counter == 1
+
+      /*if (f1_current_erase_counter - f1_saved_erase_counter + f2_current_erase_counter - f2_saved_erase_counter == 1)
+      {
+#ifdef CGAL_LINKED_WITH_TBB
+        tbb::queuing_mutex mut;
+        tbb::queuing_mutex::scoped_lock l(mut);
+#endif
+
+        std::stringstream sstr;
+        Facet facet = CGAL::cpp11::get<0>(f);
+        sstr << "Facet 1 { " << std::endl
+        << "  - " << *facet.first->vertex((facet.second+1)%4)  << std::endl
+        << "  - " << *facet.first->vertex((facet.second+2)%4)  << std::endl
+        << "  - " << *facet.first->vertex((facet.second+3)%4)  << std::endl
+        << "  - 4th vertex in cell: " << *facet.first->vertex(facet.second)  << std::endl
+        << "}" << std::endl;
+
+        facet = CGAL::cpp11::get<2>(f);
+        sstr << "Facet 2 { " << std::endl
+        << "  - " << *facet.first->vertex((facet.second+1)%4)  << std::endl
+        << "  - " << *facet.first->vertex((facet.second+2)%4)  << std::endl
+        << "  - " << *facet.first->vertex((facet.second+3)%4)  << std::endl
+        << "  - 4th vertex in cell: " << *facet.first->vertex(facet.second)  << std::endl
+        << "}" << std::endl;
+
+        std::string s = sstr.str();
+        //std::cerr << s << std::endl;
+      }*/
+#endif
+      return (CGAL::cpp11::get<0>(f).first->erase_counter() == CGAL::cpp11::get<1>(f)
+        && CGAL::cpp11::get<2>(f).first->erase_counter() == CGAL::cpp11::get<3>(f) );
+    }
+  };
+
+/************************************************
+// Class Refine_facets_3_handle_queue_base
+// Two versions: sequential / parallel
+************************************************/
+
+// Sequential
+template <typename Index, typename Facet, typename Concurrency_tag>
+class Refine_facets_3_handle_queue_base
+{
+protected:
+  Refine_facets_3_handle_queue_base() : m_last_vertex_index() {}
+
+  Index get_last_vertex_index() const
+  {
+    return m_last_vertex_index;
+  }
+
+  void set_last_vertex_index(Index i) const
+  {
+    m_last_vertex_index = i;
+  }
+
+#if defined(CGAL_MESH_3_USE_LAZY_SORTED_REFINEMENT_QUEUE) \
+ || defined(CGAL_MESH_3_USE_LAZY_UNSORTED_REFINEMENT_QUEUE)
+
+  CGAL::cpp11::tuple<Facet, unsigned int, Facet, unsigned int>
+  from_facet_to_refinement_queue_element(const Facet &facet,
+                                         const Facet &mirror) const
+  {
+    return CGAL::cpp11::make_tuple(
+      facet, facet.first->erase_counter(),
+      mirror, mirror.first->erase_counter());
+  }
+
+public:
+  template<typename Container_element>
+  Facet extract_element_from_container_value(const Container_element &e) const
+  {
+    // We get the first Facet inside the tuple
+    return CGAL::cpp11::get<0>(e);
+  }
+
+#else
+
+  Facet
+  from_facet_to_refinement_queue_element(const Facet &facet,
+                                         const Facet &mirror) const
+  {
+    // Returns canonical facet
+    return (facet < mirror) ? facet : mirror;
+  }
+
+public:
+  template<typename Container_element>
+  Facet extract_element_from_container_value(const Container_element &e) const
+  {
+    return e;
+  }
+
+#endif
+
+protected:
+  /// Stores index of vertex that may be inserted into triangulation
+  mutable Index m_last_vertex_index;
+};
+
+#ifdef CGAL_LINKED_WITH_TBB
+// Parallel
+template <typename Index, typename Facet>
+class Refine_facets_3_handle_queue_base<Index, Facet, Parallel_tag>
+{
+protected:
+  Refine_facets_3_handle_queue_base() : m_last_vertex_index(Index()) {}
+
+  Index get_last_vertex_index() const
+  {
+    return m_last_vertex_index.local();
+  }
+
+  void set_last_vertex_index(Index i) const
+  {
+    m_last_vertex_index.local() = i;
+  }
+
+  CGAL::cpp11::tuple<Facet, unsigned int, Facet, unsigned int>
+  from_facet_to_refinement_queue_element(const Facet &facet,
+                                         const Facet &mirror) const
+  {
+    return CGAL::cpp11::make_tuple(
+      facet, facet.first->erase_counter(),
+      mirror, mirror.first->erase_counter());
+  }
+
+public:
+  template<typename Container_element>
+  Facet extract_element_from_container_value(const Container_element &e) const
+  {
+    // We get the first Facet inside the tuple
+    return CGAL::cpp11::get<0>(e);
+  }
+
+protected:
+  /// Stores index of vertex that may be inserted into triangulation
+  mutable tbb::enumerable_thread_specific<Index> m_last_vertex_index;
+};
+#endif // CGAL_LINKED_WITH_TBB
+
+template<class Tr,
+         class Criteria,
+         class MeshDomain,
+         class Complex3InTriangulation3,
+         class Concurrency_tag,
+         class Container_
+         >
+class Refine_facets_3_base
+  : public Refine_facets_3_handle_queue_base<typename MeshDomain::Index,
+                                             typename Tr::Facet,
+                                             Concurrency_tag>
+  , public Container_
+{
+  typedef typename Tr::Point Point;
+  typedef typename Tr::Facet Facet;
+  typedef typename Tr::Vertex_handle Vertex_handle;
+  typedef typename Tr::Cell_handle Cell_handle;
+  typedef typename Triangulation_mesher_level_traits_3<Tr>::Zone Zone;
+
+  typedef typename Tr::Geom_traits Gt;
+  typedef typename Gt::Segment_3 Segment_3;
+  typedef typename Gt::Ray_3 Ray_3;
+  typedef typename Gt::Line_3 Line_3;
+
+public:
+  Refine_facets_3_base(Tr& tr, Complex3InTriangulation3& c3t3,
+                       const MeshDomain& oracle,
+                       const Criteria& criteria)
+    : r_tr_(tr)
+    , r_criteria_(criteria)
+    , r_oracle_(oracle)
+    , r_c3t3_(c3t3)
+  {}
+
+  void scan_triangulation_impl_amendement() const {}
+
+  /// Gets the point to insert from the element to refine
+  Point refinement_point_impl(const Facet& facet) const
+  {
+#ifdef CGAL_MESHES_DEBUG_REFINEMENT_POINTS
+    const Cell_handle c = facet.first;
+    const int i = facet.second;
+    std::cerr << "Facet ("
+              << c->vertex((i+1)&3)->point() << " , "
+              << c->vertex((i+2)&3)->point() << " , "
+              << c->vertex((i+3)&3)->point() << ") : refinement point is "
+              << get_facet_surface_center(facet) << std::endl;
+#endif
+    CGAL_assertion (this->is_facet_on_surface(facet));
+    this->set_last_vertex_index(get_facet_surface_center_index(facet));
+    return get_facet_surface_center(facet);
+  };
+
+  Facet get_next_element_impl()
+  {
+    return this->extract_element_from_container_value(
+      Container_::get_next_element_impl());
+  }
+
+  /// Job to do before insertion
+  void before_insertion_impl(const Facet& facet,
+                             const Point& point,
+                             Zone& zone);
+
+  /// Job to do after insertion
+  void after_insertion_impl(const Vertex_handle& v)
+  {
+    restore_restricted_Delaunay(v);
+  }
+
+  /// debug info: class name
+  std::string debug_info_class_name_impl() const
+  {
+    return "Refine_facets_3";
+  }
+
+  /// debug info
+  std::string debug_info() const
+  {
+    std::stringstream s;
+    s << Container_::size();
+    return s.str();
+  }
+
+  /// debug_info_header
+  std::string debug_info_header() const
+  {
+    return "#facets to refine";
+  }
+
+  std::string debug_info_element_impl(const Facet &facet) const
+  {
+    std::stringstream sstr;
+    sstr << "Facet { " << std::endl
+    << "  - " << *facet.first->vertex((facet.second+1)%4)  << std::endl
+    << "  - " << *facet.first->vertex((facet.second+2)%4)  << std::endl
+    << "  - " << *facet.first->vertex((facet.second+3)%4)  << std::endl
+    << "  - 4th vertex in cell: " << *facet.first->vertex(facet.second)  << std::endl
+    << "}" << std::endl;
+
+    return sstr.str();
+  }
+
+protected:
+
+  // Functor for scan_triangulation_impl function
+  template <typename Refine_facets_>
+  class Scan_facet
+  {
+    Refine_facets_ & m_refine_facets;
+
+    typedef typename Refine_facets_::Facet Facet;
+
+  public:
+    // Constructor
+    Scan_facet(Refine_facets_ & rf)
+    : m_refine_facets(rf)
+    {}
+
+    // Constructor
+    Scan_facet(const Scan_facet &sf)
+    : m_refine_facets(sf.m_refine_facets)
+    {}
+
+    // operator()
+    // f cannot be const, see treat_new_facet signature
+    void operator()( Facet f ) const
+    {
+      m_refine_facets.treat_new_facet(f);
+    }
+  };
+
+
+protected:
+  //-------------------------------------------------------
+  // Private types
+  //-------------------------------------------------------
+  typedef typename Criteria::Facet_quality Quality;
+  typedef typename Get_Is_facet_bad<Criteria>::Type Is_facet_bad;
+  typedef typename MeshDomain::Surface_patch_index Surface_patch_index;
+  typedef typename MeshDomain::Index Index;
+  typedef typename Gt::Bare_point Bare_point;
+
+  typedef typename boost::optional<
+    CGAL::cpp11::tuple<Surface_patch_index, Index, Point> >
+                                                      Facet_properties;
+
+
+  /// Returns canonical facet of facet
+  Facet canonical_facet(const Facet& facet) const
+  {
+    const Facet mirror = mirror_facet(facet);
+    return ( (facet < mirror)?facet:mirror );
+  }
+
+  /// Returns true if f has already been visited
+  bool is_facet_visited(const Facet& f) const
+  {
+    return f.first->is_facet_visited(f.second);
+  }
+
+  /// Sets facet f to visited
+  void set_facet_visited(Facet& f) const
+  {
+    f.first->set_facet_visited(f.second);
+  }
+
+  /// Sets facet f and it's mirror one surface center to point p
+  void set_facet_surface_center(const Facet& f,
+                                const Point& p,
+                                const Index& index) const
+  {
+    const Facet mirror = mirror_facet(f);
+
+    f.first->set_facet_surface_center(f.second, p);
+    mirror.first->set_facet_surface_center(mirror.second, p);
+
+    f.first->set_facet_surface_center_index(f.second,index);
+    mirror.first->set_facet_surface_center_index(mirror.second,index);
+  }
+
+  /// Returns facet surface center of \c f
+  Point get_facet_surface_center(const Facet& f) const
+  {
+    return f.first->get_facet_surface_center(f.second);
+  }
+
+  /// Returns index of surface center of facet \c f
+  Index get_facet_surface_center_index(const Facet& f) const
+  {
+    return f.first->get_facet_surface_center_index(f.second);
+  }
+
+  /// Sets \c f to surface facets, with index \c index
+  void set_facet_on_surface(const Facet& f,
+                            const Surface_patch_index& index)
+  {
+    r_c3t3_.add_to_complex(f, index);
+  }
+
+  /// Returns index of facet \c f
+  Surface_patch_index get_facet_surface_index(const Facet& f) const
+  {
+    return r_c3t3_.surface_patch_index(f.first, f.second);
+  }
+
+  /// Sets index and dimension of vertex \v
+  void set_vertex_properties(Vertex_handle& v, const Index& index)
+  {
+    r_c3t3_.set_index(v, index);
+    // Set dimension of v: v is on surface by construction, so dimension=2
+    v->set_dimension(2);
+  }
+
+  /// Compute the (exact) dual of a facet
+  void dual_segment(const Facet & f, Bare_point& p1, Bare_point& p2) const;
+
+  void dual_segment_exact(const Facet & f, Bare_point& p1, Bare_point& p2) const;
+
+  void dual_ray(const Facet & f, Ray_3& ray) const;
+
+  void dual_ray_exact(const Facet & f, Ray_3& ray) const;
+
+  /// Returns true if point encroaches facet
+  bool is_facet_encroached(const Facet& facet, const Point& point) const;
+
+  /// Returns whethere an encroached facet is refinable or not
+  bool is_encroached_facet_refinable(Facet& facet) const;
+
+  /// Insert facet into refinement queue
+  void insert_bad_facet(Facet& facet, const Quality& quality)
+  {
+    // Insert the facet and its mirror
+    this->add_bad_element(
+      this->from_facet_to_refinement_queue_element(facet, mirror_facet(facet)),
+      quality);
+  }
+
+  /// Insert encroached facet into refinement queue
+  void insert_encroached_facet_in_queue(Facet& facet)
+  {
+    insert_bad_facet(facet,Quality());
+  }
+
+protected:
+  /**
+   * Action to perform on a facet inside the conflict zone before insertion
+   * @return true if source_facet is the same as facet or mirror(facet)
+   */
+  bool before_insertion_handle_facet_in_conflict_zone(Facet& facet,
+                                                     const Facet& source_facet);
+
+  /**
+   * Action to perform on a facet on the boundary of the conflict zone
+   * before insertion
+   * @return true if source_facet is the same as facet or mirror(facet)
+   */
+  bool before_insertion_handle_facet_on_conflict_zone(Facet& facet,
+                                                      const Facet& source_facet)
+  {
+    // perform the same operations as for an internal facet
+    return before_insertion_handle_facet_in_conflict_zone(facet, source_facet);
+  }
+
+  /// Restore restricted Delaunay ; may be call by Cells_mesher visitor
+  void restore_restricted_Delaunay(const Vertex_handle& v);
+
+  /// Action to perform on a facet incident to the new vertex
+  void after_insertion_handle_incident_facet(Facet& facet);
+
+  /// Action to perform on a facet opposite to the new vertex
+  void after_insertion_handle_opposite_facet(Facet& facet)
+  {
+    // perform the same operations as for a facet incident to the new vertex
+    after_insertion_handle_incident_facet(facet);
+  }
+
+  /// Get mirror facet
+  Facet mirror_facet(const Facet& f) const { return r_tr_.mirror_facet(f); };
+
+  /// for debugging
+  std::string display_dual(Facet f) const
+  {
+    std::stringstream stream;
+    stream.precision(17);
+    Object dual = r_tr_.dual(f);
+
+    if ( const Segment_3* p_segment = object_cast<Segment_3>(&dual) ) {
+      stream << "Segment(" << p_segment->source()
+             << " , " << p_segment->target() << ")";
+    }
+    else if ( const Ray_3* p_ray = object_cast<Ray_3>(&dual) ) {
+      stream << "Ray(" << p_ray->point(0)
+             << " , " << p_ray->point(1)
+             << "), with vector (" << p_ray->to_vector() << ")";
+    }
+    else if ( const Line_3* p_line = object_cast<Line_3>(&dual) ) {
+      stream << "Line(point=" << p_line->point(0)
+             << " , vector=" << p_line->to_vector() << ")";
+    }
+    return stream.str();
+  }
+
+  /// Returns to if f is on surface
+  bool is_facet_on_surface(const Facet& f) const
+  {
+    return r_c3t3_.is_in_complex(f) ;
+  }
+
+  /// Removes \c f from surface facets
+  void remove_facet_from_surface(const Facet& f)
+  {
+    r_c3t3_.remove_from_complex(f);
+  }
+
+  /// Removes facet from refinement queue
+  // Sequential
+  void remove_bad_facet(const Facet& facet, Sequential_tag)
+  {
+    // If sequential AND NOT lazy, remove cell from refinement queue
+#if !defined(CGAL_MESH_3_USE_LAZY_SORTED_REFINEMENT_QUEUE) \
+ && !defined(CGAL_MESH_3_USE_LAZY_UNSORTED_REFINEMENT_QUEUE)
+    // Remove canonical facet
+    Facet canonical_facet = this->canonical_facet(facet);
+    this->remove_element(canonical_facet);
+#endif
+  }
+#ifdef CGAL_LINKED_WITH_TBB
+  /// Removes facet from refinement queue
+  // Parallel: it's always lazy, so do nothing
+  void remove_bad_facet(const Facet&, Parallel_tag) {}
+#endif // CGAL_LINKED_WITH_TBB
+
+  /// Sets facet f to not visited
+  void reset_facet_visited(Facet& f) const
+  {
+    f.first->reset_visited(f.second);
+  }
+
+  /// Computes facet properties and add facet to the refinement queue if needed
+  void treat_new_facet(Facet& facet);
+
+  /**
+   * Computes at once is_facet_on_surface and facet_surface_center.
+   * @param facet The input facet
+   * @return \c true if \c facet is on surface, \c false otherwise
+   */
+  void compute_facet_properties(const Facet& facet, Facet_properties& fp,
+                                bool force_exact = false ) const;
+
+protected:
+  /// The triangulation
+  Tr& r_tr_;
+  /// The facet criteria
+  const Criteria& r_criteria_;
+  /// The oracle
+  const MeshDomain& r_oracle_;
+  /// The mesh result
+  Complex3InTriangulation3& r_c3t3_;
+}; // end class template Refine_facets_3_base
+
+/************************************************
+// Class Refine_facets_3
+//
+// Template parameters should be models of
+// Tr         : MeshTriangulation_3
+// Criteria   : SurfaceMeshFacetsCriteria_3
+// MeshDomain : MeshTraits_3
+//
+// Implements a Mesher_level for facets
+************************************************/
+
+// TODO document Container_ requirements
+template<class Tr,
+         class Criteria,
+         class MeshDomain,
+         class Complex3InTriangulation3,
+         class Previous_level_,
+         class Concurrency_tag,
+         template<class Tr_, class Cr_, class MD_, class C3T3_2, class Ct_, class C_2>
+            class Base_ = Refine_facets_3_base,
+#ifdef CGAL_LINKED_WITH_TBB
+         class Container_ = typename boost::mpl::if_c // (parallel/sequential?)
+         <
+          boost::is_convertible<Concurrency_tag, Parallel_tag>::value,
+          // Parallel
+# ifdef CGAL_MESH_3_USE_LAZY_UNSORTED_REFINEMENT_QUEUE
+          Meshes::Filtered_deque_container
+# else
+          Meshes::Filtered_multimap_container
+# endif
+          <
+            CGAL::cpp11::tuple<typename Tr::Facet, unsigned int,
+                               typename Tr::Facet, unsigned int>,
+            typename Criteria::Facet_quality,
+            Facet_to_refine_is_not_zombie<typename Tr::Facet>,
+            Concurrency_tag
+          >,
+          // Sequential
+# ifdef CGAL_MESH_3_USE_LAZY_UNSORTED_REFINEMENT_QUEUE
+          Meshes::Filtered_deque_container
+          <
+            CGAL::cpp11::tuple<typename Tr::Facet, unsigned int,
+                               typename Tr::Facet, unsigned int>,
+            typename Criteria::Facet_quality,
+            Facet_to_refine_is_not_zombie<typename Tr::Facet>,
+            Concurrency_tag
+          >
+# elif defined(CGAL_MESH_3_USE_LAZY_SORTED_REFINEMENT_QUEUE)
+          Meshes::Filtered_multimap_container
+          <
+            CGAL::cpp11::tuple<typename Tr::Facet, unsigned int,
+                               typename Tr::Facet, unsigned int>,
+            typename Criteria::Facet_quality,
+            Facet_to_refine_is_not_zombie<typename Tr::Facet>,
+            Concurrency_tag
+          >
+# else
+          Meshes::Double_map_container<typename Tr::Facet,
+                                       typename Criteria::Facet_quality>
+# endif
+         >::type // boost::if (parallel/sequential)
+
+#else // !CGAL_LINKED_WITH_TBB
+
+         // Sequential
+         class Container_ =
+# ifdef CGAL_MESH_3_USE_LAZY_UNSORTED_REFINEMENT_QUEUE
+          Meshes::Filtered_deque_container
+          <
+            CGAL::cpp11::tuple<typename Tr::Facet, unsigned int,
+                               typename Tr::Facet, unsigned int>,
+            typename Criteria::Facet_quality,
+            Facet_to_refine_is_not_zombie<typename Tr::Facet>,
+            Concurrency_tag
+          >
+# elif defined(CGAL_MESH_3_USE_LAZY_SORTED_REFINEMENT_QUEUE)
+          Meshes::Filtered_multimap_container
+          <
+            CGAL::cpp11::tuple<typename Tr::Facet, unsigned int,
+                               typename Tr::Facet, unsigned int>,
+            typename Criteria::Facet_quality,
+            Facet_to_refine_is_not_zombie<typename Tr::Facet>,
+            Concurrency_tag
+          >
+# else
+          Meshes::Double_map_container<typename Tr::Facet,
+                                       typename Criteria::Facet_quality>
+# endif
+#endif // CGAL_LINKED_WITH_TBB
+>
+class Refine_facets_3
+: public Base_<Tr,
+               Criteria,
+               MeshDomain,
+               Complex3InTriangulation3,
+               Concurrency_tag,
+               Container_>
+, public Mesh_3::Mesher_level<Tr,
+                      Refine_facets_3<Tr,
+                                      Criteria,
+                                      MeshDomain,
+                                      Complex3InTriangulation3,
+                                      Previous_level_,
+                                      Concurrency_tag,
+                                      Base_,
+                                      Container_>,
+                      typename Tr::Facet,
+                      Previous_level_,
+                      Triangulation_mesher_level_traits_3<Tr>,
+                      Concurrency_tag >
+, public No_after_no_insertion
+, public No_before_conflicts
+{
+  // Self
+  typedef Refine_facets_3<Tr,
+                          Criteria,
+                          MeshDomain,
+                          Complex3InTriangulation3,
+                          Previous_level_,
+                          Concurrency_tag,
+                          Base_,
+                          Container_> Self;
+
+  typedef Base_<Tr,
+                Criteria,
+                MeshDomain,
+                Complex3InTriangulation3,
+                Concurrency_tag,
+                Container_> Rf_base;
+
+  typedef Rf_base Base;
+
+  typedef Mesher_level<Tr,
+                       Self,
+                       typename Tr::Facet,
+                       Previous_level_,
+                       Triangulation_mesher_level_traits_3<Tr>,
+                       Concurrency_tag >               Base_ML;
+
+  typedef typename Tr::Lock_data_structure Lock_data_structure;
+
+public:
+  using Base_ML::add_to_TLS_lists;
+  using Base_ML::splice_local_lists;
+
+  typedef Container_ Container; // Because we need it in Mesher_level
+  typedef typename Container::Element Container_element;
+  typedef typename Tr::Point Point;
+  typedef typename Tr::Facet Facet;
+  typedef typename Tr::Vertex_handle Vertex_handle;
+  typedef typename Triangulation_mesher_level_traits_3<Tr>::Zone Zone;
+  typedef Complex3InTriangulation3 C3T3;
+
+  /// Constructor
+  // For sequential
+  Refine_facets_3(Tr& triangulation,
+                  const Criteria& criteria,
+                  const MeshDomain& oracle,
+                  Previous_level_& previous,
+                  C3T3& c3t3);
+  // For parallel
+  Refine_facets_3(Tr& triangulation,
+                  const Criteria& criteria,
+                  const MeshDomain& oracle,
+                  Previous_level_& previous,
+                  C3T3& c3t3,
+                  Lock_data_structure *lock_ds,
+                  WorksharingDataStructureType *worksharing_ds);
+
+  /// Destructor
+  virtual ~Refine_facets_3() { }
+
+  /// Get a reference on triangulation
+  Tr& triangulation_ref_impl() { return this->r_tr_; }
+  const Tr& triangulation_ref_impl() const { return this->r_tr_; }
+
+  /// Initialization function
+  void scan_triangulation_impl();
+
+  int number_of_bad_elements_impl();
+
+  Point circumcenter_impl(const Facet& facet) const
+  {
+    return get_facet_surface_center(facet);
+  }
+
+  template <typename Mesh_visitor>
+  void before_next_element_refinement_in_superior_impl(Mesh_visitor visitor)
+  {
+    // Before refining any cell, we refine the facets in the local refinement
+    // queue
+    this->treat_local_refinement_queue(visitor);
+  }
+
+  void before_next_element_refinement_impl()
+  {
+  }
+
+  Facet get_next_local_element_impl()
+  {
+    return extract_element_from_container_value(
+      Container_::get_next_local_element_impl());
+  }
+
+  /// Tests if p encroaches facet from zone
+  // For sequential
+  Mesher_level_conflict_status
+  test_point_conflict_from_superior_impl(const Point& p, Zone& zone);
+
+  /// Tests if p encroaches facet from zone
+  // For parallel
+  template <typename Mesh_visitor>
+  Mesher_level_conflict_status
+  test_point_conflict_from_superior_impl(const Point& p, Zone& zone,
+                                         Mesh_visitor &visitor);
+
+  /// Useless here
+  Mesher_level_conflict_status private_test_point_conflict_impl(
+      const Point& p,
+      Zone& zone)
+  {
+    if( zone.locate_type == Tr::VERTEX )
+    {
+      std::stringstream sstr;
+      sstr << "(" << p << ") is already inserted on surface.\n";
+      CGAL_error_msg(sstr.str().c_str());
+      return CONFLICT_AND_ELEMENT_SHOULD_BE_DROPPED;
+    }
+    else
+      return NO_CONFLICT;
+  }
+
+  /// Returns the conflicts zone
+  Zone conflicts_zone_impl(const Point& point
+                           , const Facet& facet
+                           , bool &facet_is_in_its_cz);
+  Zone conflicts_zone_impl(const Point& point
+                           , const Facet& facet
+                           , bool &facet_is_in_its_cz
+                           , bool &could_lock_zone);
+
+  /// Insert p into triangulation
+  Vertex_handle insert_impl(const Point& p, const Zone& zone);
+
+  bool try_lock_element(const Facet &f, int lock_radius = 0) const
+  {
+    return this->triangulation().try_lock_facet(f, lock_radius);
+  }
+
+#ifdef CGAL_MESH_3_MESHER_STATUS_ACTIVATED
+  std::size_t queue_size() const { return this->size(); }
+#endif
+
+
+private:
+  // private types
+  typedef typename Tr::Cell_handle Cell_handle;
+  typedef typename MeshDomain::Surface_patch_index Surface_patch_index;
+  typedef typename MeshDomain::Index Index;
+  typedef typename Tr::Geom_traits Gt;
+  typedef typename Gt::Bare_point Bare_point;
+  typedef typename Gt::Ray_3 Ray_3;
+
+private:
+  // Disabled copy constructor
+  Refine_facets_3(const Self& src);
+  // Disabled assignment operator
+  Self& operator=(const Self& src);
+};  // end class Refine_facets_3
+
+
+
+
+// For sequential
+template<class Tr, class Cr, class MD, class C3T3_, class P_, class Ct, template<class Tr_, class Cr_, class MD_, class C3T3_2, class Ct_, class C_2> class B_, class C_>
+Refine_facets_3<Tr,Cr,MD,C3T3_,P_,Ct,B_,C_>::
+Refine_facets_3(Tr& triangulation,
+                const Cr& criteria,
+                const MD& oracle,
+                P_& previous,
+                C3T3& c3t3)
+  : Rf_base(triangulation, c3t3, oracle, criteria)
+  , Mesher_level<Tr, Self, Facet, P_,
+      Triangulation_mesher_level_traits_3<Tr>, Ct>(previous)
+  , No_after_no_insertion()
+  , No_before_conflicts()
+{
+
+}
+
+// For parallel
+template<class Tr, class Cr, class MD, class C3T3_, class P_, class Ct, template<class Tr_, class Cr_, class MD_, class C3T3_2, class Ct_, class C_2> class B_, class C_>
+Refine_facets_3<Tr,Cr,MD,C3T3_,P_,Ct,B_,C_>::
+Refine_facets_3(Tr& triangulation,
+                const Cr& criteria,
+                const MD& oracle,
+                P_& previous,
+                C3T3& c3t3,
+                Lock_data_structure *lock_ds,
+                WorksharingDataStructureType *worksharing_ds)
+  : Rf_base(triangulation, c3t3, oracle, criteria)
+  , Mesher_level<Tr, Self, Facet, P_,
+      Triangulation_mesher_level_traits_3<Tr>, Ct>(previous)
+  , No_after_no_insertion()
+  , No_before_conflicts()
+{
+  Base::set_lock_ds(lock_ds);
+  Base::set_worksharing_ds(worksharing_ds);
+}
+
+
+template<class Tr, class Cr, class MD, class C3T3_, class P_, class Ct, template<class Tr_, class Cr_, class MD_, class C3T3_2, class Ct_, class C_2> class B_, class C_>
+void
+Refine_facets_3<Tr,Cr,MD,C3T3_,P_,Ct,B_,C_>::
+scan_triangulation_impl()
+{
+  typedef typename Tr::Finite_facets_iterator Finite_facet_iterator;
+
+#ifdef CGAL_MESH_3_PROFILING
+  WallClockTimer t;
+#endif
+
+#ifdef CGAL_MESH_3_VERY_VERBOSE
+  std::cerr
+    << "Vertices: " << this->r_c3t3_.triangulation().number_of_vertices() << std::endl
+    << "Facets  : " << this->r_c3t3_.number_of_facets_in_complex() << std::endl
+    << "Tets    : " << this->r_c3t3_.number_of_cells_in_complex() << std::endl;
+#endif
+
+#ifdef CGAL_LINKED_WITH_TBB
+  // Parallel
+  if (boost::is_convertible<Ct, Parallel_tag>::value)
+  {
+# if defined(CGAL_MESH_3_VERBOSE) || defined(CGAL_MESH_3_PROFILING)
+    std::cerr << "Scanning triangulation for bad facets (in parallel) - "
+      "number of finite facets = "
+      << this->r_c3t3_.triangulation().number_of_finite_facets() << "..."
+      << std::endl;
+# endif
+    add_to_TLS_lists(true);
+
+    // PARALLEL_DO
+    tbb::parallel_do(
+      this->r_tr_.finite_facets_begin(), this->r_tr_.finite_facets_end(),
+      typename Rf_base::template Scan_facet<Self>(*this) 
+    );
+
+    splice_local_lists();
+    add_to_TLS_lists(false);
+  }
+  // Sequential
+  else
+#endif // CGAL_LINKED_WITH_TBB
+  {
+#if defined(CGAL_MESH_3_VERBOSE) || defined(CGAL_MESH_3_PROFILING)
+    std::cerr << "Scanning triangulation for bad facets (sequential) - "
+      "number of finite facets = "
+      << this->r_c3t3_.triangulation().number_of_finite_facets() << "..."
+      << std::endl;
+#endif
+    for(Finite_facet_iterator facet_it = this->r_tr_.finite_facets_begin();
+        facet_it != this->r_tr_.finite_facets_end();
+        ++facet_it)
+    {
+      // Cannot be const, see treat_new_facet signature
+      Facet facet = *facet_it;
+      /*std::cerr << "*" << *facet.first->vertex((facet.second+1)%4)  << std::endl
+          << "  " << *facet.first->vertex((facet.second+2)%4)  << std::endl
+          << "  " << *facet.first->vertex((facet.second+3)%4)  << std::endl;*/
+      this->treat_new_facet(facet);
+    }
+  }
+
+#ifdef CGAL_MESH_3_PROFILING
+  std::cerr << "==== Facet scan: " << t.elapsed() << " seconds ===="
+            << std::endl << std::endl;
+#endif
+
+#if defined(CGAL_MESH_3_VERBOSE) || defined(CGAL_MESH_3_PROFILING)
+  std::cerr << "Number of bad facets: " << C_::size() << std::endl;
+#endif
+
+#ifdef CGAL_MESH_3_PROFILING
+  std::cerr << "Refining... ";
+  Base_ML::m_timer.reset();
+#endif
+  Base::scan_triangulation_impl_amendement();
+}
+
+
+
+template<class Tr, class Cr, class MD, class C3T3_, class P_, class Ct, template<class Tr_, class Cr_, class MD_, class C3T3_2, class Ct_, class C_2> class B_, class C_>
+int
+Refine_facets_3<Tr,Cr,MD,C3T3_,P_,Ct,B_,C_>::
+number_of_bad_elements_impl()
+{
+  typedef typename Tr::Finite_facets_iterator Finite_facet_iterator;
+
+  int count = 0, count_num_bad_surface_facets = 0;
+  int num_internal_facets_that_should_be_on_surface = 0;
+#if defined(CGAL_MESH_3_VERBOSE) || defined(CGAL_MESH_3_PROFILING)
+  std::cerr << "Scanning triangulation for bad facets - "
+    "number of finite facets = "
+    << this->r_c3t3_.triangulation().number_of_finite_facets() << "...";
+#endif
+  int num_tested_facets = 0;
+  for(Finite_facet_iterator facet_it = this->r_tr_.finite_facets_begin();
+      facet_it != this->r_tr_.finite_facets_end();
+      ++facet_it)
+  {
+    Facet facet = *facet_it;
+    typename Rf_base::Facet_properties properties;
+    compute_facet_properties(facet, properties);
+
+#ifdef SHOW_REMAINING_BAD_ELEMENT_IN_RED
+    //facet.first->mark = 0;
+#endif
+
+    // On surface?
+    if ( properties )
+    {
+      // This facet should be on surface...
+      if (!this->is_facet_on_surface(facet))
+      {
+        std::cerr << "\n\n*** The facet f is on surface but is NOT MARKED ON SURFACE. " << std::endl;
+
+        Cell_handle c = facet.first;
+        int ind = facet.second;
+        Cell_handle mc = mirror_facet(facet).first;
+        int mind = mirror_facet(facet).second;
+
+#ifdef SHOW_REMAINING_BAD_ELEMENT_IN_RED
+        c->mark2 = ind;
+#endif
+
+        // c and mc are the cells adjacent to f
+        // browse each facet ff of c and mc, and mark it if it is "on surface"
+        int num_erroneous_surface_facets_in_c = 0;
+        int num_erroneous_surface_facets_in_mc = 0;
+        int num_real_surface_facets_in_c = 0;
+        int num_real_surface_facets_in_mc = 0;
+        for (int i = 0 ; i < 4 ; ++i)
+        {
+          if (i != ind)
+          {
+            const Facet f1(c, i);
+            if (this->is_facet_on_surface(f1))
+            {
+              std::cerr << "*** f1 is " << (this->r_criteria_(f1) ? "bad" : "good") << std::endl;
+
+#ifdef SHOW_REMAINING_BAD_ELEMENT_IN_RED
+              c->mark = i;
+#endif
+              typename Rf_base::Facet_properties properties;
+              compute_facet_properties(f1, properties);
+              if (properties)
+                ++num_real_surface_facets_in_c;
+              else
+                ++num_erroneous_surface_facets_in_c;
+            }
+          }
+          if (i != mind)
+          {
+            const Facet f2(c, i);
+            if (this->is_facet_on_surface(f2))
+            {
+              std::cerr << "*** f2 is " << (this->r_criteria_(f2) ? "bad" : "good") << std::endl;
+
+#ifdef SHOW_REMAINING_BAD_ELEMENT_IN_RED
+              mc->mark = i;
+#endif
+              typename Rf_base::Facet_properties properties;
+              this->compute_facet_properties(f2, properties);
+              if (properties)
+                ++num_real_surface_facets_in_mc;
+              else
+                ++num_erroneous_surface_facets_in_mc;
+            }
+          }
+        }
+
+        std::cerr
+          << "*** Num of erroneous surface facets in c: " << num_erroneous_surface_facets_in_c << std::endl
+          << "*** Num of erroneous surface facets in mc: " << num_erroneous_surface_facets_in_mc << std::endl
+          << "*** Num of real surface facets in c: " << num_real_surface_facets_in_c << std::endl
+          << "*** Num of real surface facets in mc: " << num_real_surface_facets_in_mc << std::endl;
+
+        const bool is_c_in_domain = this->r_oracle_.is_in_domain_object()(this->r_tr_.dual(c));
+        const bool is_mc_in_domain = this->r_oracle_.is_in_domain_object()(this->r_tr_.dual(mc));
+
+        std::cerr << "*** Is in complex? c is marked in domain: " << this->r_c3t3_.is_in_complex(c)
+          << " / c is really in domain: " << is_c_in_domain
+          << " / mc is marked in domain: " << this->r_c3t3_.is_in_complex(mc)
+          << " / mc is really in domain: " << is_mc_in_domain
+          << std::endl;
+
+
+        // ... if it's not, count it
+        ++num_internal_facets_that_should_be_on_surface;
+
+      }
+
+      const Surface_patch_index& surface_index = CGAL::cpp11::get<0>(*properties);
+      const Index& surface_center_index = CGAL::cpp11::get<1>(*properties);
+      const Point& surface_center = CGAL::cpp11::get<2>(*properties);
+
+      // Facet is on surface: set facet properties
+      //set_facet_surface_center(facet, surface_center, surface_center_index);
+      //set_facet_on_surface(facet, surface_index);
+
+      const typename Rf_base::Is_facet_bad is_facet_bad = this->r_criteria_(facet);
+      if ( is_facet_bad )
+      {
+        ++count;
+        if (this->is_facet_on_surface(facet))
+          ++count_num_bad_surface_facets;
+
+#ifdef SHOW_REMAINING_BAD_ELEMENT_IN_RED
+        //facet.first->mark = facet.second;
+#endif
+      }
+      ++ num_tested_facets;
+    }
+    // Not on surface?
+    else
+    {
+      // Facet is not on surface
+      //remove_facet_from_surface(facet);
+
+      // Marked on surface?
+      if (this->is_facet_on_surface(facet))
+      {
+        std::cerr << "************** The facet is marked on surface whereas it's not! **************" << std::endl;
+#ifdef SHOW_REMAINING_BAD_ELEMENT_IN_RED
+        facet.first->mark = facet.second;
+#endif
+      }
+    }
+  }
+
+  /*std::cerr << "done (" << num_internal_facets_that_should_be_on_surface
+    << " facets which were internal facets were added to the surface)." << std::endl;*/
+  std::cerr << "done (" << num_internal_facets_that_should_be_on_surface
+    << " facets that should be on surface are actually internal facets)." << std::endl;
+  std::cerr << std::endl << "Num_tested_facets = " << num_tested_facets << std::endl;
+  std::cerr << std::endl << "Num bad surface-marked facets = " << count_num_bad_surface_facets << std::endl;
+
+  return count;
+}
+
+// For sequential
+template<class Tr, class Cr, class MD, class C3T3_, class P_, class Ct, template<class Tr_, class Cr_, class MD_, class C3T3_2, class Ct_, class C_2> class B_, class C_>
+Mesher_level_conflict_status
+Refine_facets_3<Tr,Cr,MD,C3T3_,P_,Ct,B_,C_>::
+test_point_conflict_from_superior_impl(const Point& point, Zone& zone)
+{
+  typedef typename Zone::Facets_iterator Facet_iterator;
+
+  for (Facet_iterator facet_it = zone.internal_facets.begin();
+       facet_it != zone.internal_facets.end();
+       ++facet_it)
+  {
+    // surface facets which are internal facets of the conflict zone are
+    // encroached
+    if( this->is_facet_on_surface(*facet_it) )
+    {
+      if ( this->is_encroached_facet_refinable(*facet_it) )
+      {
+        this->insert_encroached_facet_in_queue(*facet_it);
+        return CONFLICT_BUT_ELEMENT_CAN_BE_RECONSIDERED;
+      }
+      else
+        return CONFLICT_AND_ELEMENT_SHOULD_BE_DROPPED;
+    }
+  }
+
+  for (Facet_iterator facet_it = zone.boundary_facets.begin();
+       facet_it != zone.boundary_facets.end();
+       ++facet_it)
+  {
+    if( this->is_facet_encroached(*facet_it, point) )
+    {
+      // Insert already existing surface facet into refinement queue
+      if ( this->is_encroached_facet_refinable(*facet_it) )
+      {
+        this->insert_encroached_facet_in_queue(*facet_it);
+        return CONFLICT_BUT_ELEMENT_CAN_BE_RECONSIDERED;
+      }
+      else
+        return CONFLICT_AND_ELEMENT_SHOULD_BE_DROPPED;
+    }
+  }
+
+  return NO_CONFLICT;
+}
+
+// For parallel
+template<class Tr, class Cr, class MD, class C3T3_, class P_, class Ct, template<class Tr_, class Cr_, class MD_, class C3T3_2, class Ct_, class C_2> class B_, class C_>
+template <typename Mesh_visitor>
+Mesher_level_conflict_status
+Refine_facets_3<Tr,Cr,MD,C3T3_,P_,Ct,B_,C_>::
+test_point_conflict_from_superior_impl(const Point& point, Zone& zone,
+                                       Mesh_visitor &visitor)
+{
+  typedef typename Zone::Facets_iterator Facet_iterator;
+
+  for (Facet_iterator facet_it = zone.internal_facets.begin();
+       facet_it != zone.internal_facets.end();
+       ++facet_it)
+  {
+    // surface facets which are internal facets of the conflict zone are
+    // encroached
+    if( this->is_facet_on_surface(*facet_it) )
+    {
+      if ( this->is_encroached_facet_refinable(*facet_it) )
+      {
+        // Even if it doesn't succeed, it will be tried again
+        this->try_to_refine_element(*facet_it, visitor);
+        return CONFLICT_BUT_ELEMENT_CAN_BE_RECONSIDERED;
+      }
+      else
+        return CONFLICT_AND_ELEMENT_SHOULD_BE_DROPPED;
+    }
+  }
+
+  for (Facet_iterator facet_it = zone.boundary_facets.begin();
+       facet_it != zone.boundary_facets.end();
+       ++facet_it)
+  {
+    if( this->is_facet_encroached(*facet_it, point) )
+    {
+      // Insert already existing surface facet into refinement queue
+      if ( this->is_encroached_facet_refinable(*facet_it) )
+      {
+        // Even if it doesn't succeed, it will be tried again
+        this->try_to_refine_element(*facet_it, visitor);
+        return CONFLICT_BUT_ELEMENT_CAN_BE_RECONSIDERED;
+      }
+      else
+        return CONFLICT_AND_ELEMENT_SHOULD_BE_DROPPED;
+    }
+  }
+
+  return NO_CONFLICT;
+}
+
+
+template<class Tr, class Cr, class MD, class C3T3_, class P_, class Ct, template<class Tr_, class Cr_, class MD_, class C3T3_2, class Ct_, class C_2> class B_, class C_>
+typename Refine_facets_3<Tr,Cr,MD,C3T3_,P_,Ct,B_,C_>::Zone
+Refine_facets_3<Tr,Cr,MD,C3T3_,P_,Ct,B_,C_>::
+conflicts_zone_impl(const Point& point
+                    , const Facet& facet
+                    , bool &facet_is_in_its_cz)
+{
+  Zone zone;
+
+  // TODO may be avoid the locate here
+  zone.cell = this->r_tr_.locate(point,
+                                 zone.locate_type,
+                                 zone.i,
+                                 zone.j,
+                                 facet.first);
+
+  if(zone.locate_type != Tr::VERTEX)
+  {
+    const Facet *p_facet = (facet == Facet() ? 0 : &facet);
+
+    this->r_tr_.find_conflicts(point,
+                               zone.cell,
+                               std::back_inserter(zone.boundary_facets),
+                               std::back_inserter(zone.cells),
+                               std::back_inserter(zone.internal_facets)
+                               , 0
+                               , p_facet
+                               , &facet_is_in_its_cz);
+
+    if (p_facet != 0 && !facet_is_in_its_cz)
+    {
+# ifdef CGAL_MESH_3_VERBOSE
+      std::cerr << "Info: the facet is not in the conflict zone of (" << point
+                << "). Switching to exact computation." << std::endl;
+# endif
+      
+      typename Rf_base::Facet_properties properties;
+      this->compute_facet_properties(facet, properties, /*force_exact=*/true);
+      if ( properties )
+      {
+        const Surface_patch_index& surface_index = CGAL::cpp11::get<0>(*properties);
+        const Index& surface_center_index = CGAL::cpp11::get<1>(*properties);
+        const Point& surface_center = CGAL::cpp11::get<2>(*properties);
+
+        // Facet is on surface: set facet properties
+        this->set_facet_surface_center(facet, surface_center, surface_center_index);
+        this->set_facet_on_surface(facet, surface_index);
+      }
+      else
+      {
+        // Facet is not on surface
+        this->remove_facet_from_surface(facet);
+	this->remove_bad_facet(facet, Ct());
+      }
+    }
+  }
+
+  return zone;
+}
+
+template<class Tr, class Cr, class MD, class C3T3_, class P_, class Ct, template<class Tr_, class Cr_, class MD_, class C3T3_2, class Ct_, class C_2> class B_, class C_>
+typename Refine_facets_3<Tr,Cr,MD,C3T3_,P_,Ct,B_,C_>::Zone
+Refine_facets_3<Tr,Cr,MD,C3T3_,P_,Ct,B_,C_>::
+conflicts_zone_impl(const Point& point
+                    , const Facet& facet
+                    , bool &facet_is_in_its_cz
+                    , bool &could_lock_zone)
+{
+  Zone zone;
+
+  // TODO may be avoid the locate here
+  zone.cell = this->r_tr_.locate(point,
+                                 zone.locate_type,
+                                 zone.i,
+                                 zone.j,
+                                 facet.first,
+                                 &could_lock_zone);
+
+  if(could_lock_zone && zone.locate_type != Tr::VERTEX)
+  {
+    const Facet *p_facet = (facet == Facet() ? 0 : &facet);
+
+    this->r_tr_.find_conflicts(point,
+                               zone.cell,
+                               std::back_inserter(zone.boundary_facets),
+                               std::back_inserter(zone.cells),
+                               std::back_inserter(zone.internal_facets)
+                               , &could_lock_zone
+                               , p_facet
+                               , &facet_is_in_its_cz);
+
+    if (could_lock_zone && p_facet != 0 && !facet_is_in_its_cz)
+    {
+#ifdef CGAL_MESH_3_VERBOSE
+      std::cerr << "Info: the facet is not in its conflict zone. "
+        "Switching to exact computation." << std::endl;
+#endif
+
+      typename Rf_base::Facet_properties properties;
+      this->compute_facet_properties(facet, properties, /*force_exact=*/true);
+      if ( properties )
+      {
+        const Surface_patch_index& surface_index = CGAL::cpp11::get<0>(*properties);
+        const Index& surface_center_index = CGAL::cpp11::get<1>(*properties);
+        const Point& surface_center = CGAL::cpp11::get<2>(*properties);
+
+        // Facet is on surface: set facet properties
+        this->set_facet_surface_center(facet, surface_center, surface_center_index);
+        this->set_facet_on_surface(facet, surface_index);
+      }
+      else
+      {
+        // Facet is not on surface
+        this->remove_facet_from_surface(facet);
+	this->remove_bad_facet(facet, Ct());
+      }
+    }
+  }
+
+  return zone;
+}
+
+
+template<class Tr, class Cr, class MD, class C3T3_, class Ct, class C_>
+void
+Refine_facets_3_base<Tr,Cr,MD,C3T3_,Ct,C_>::
+before_insertion_impl(const Facet& facet,
+                      const Point& point,
+                      Zone& zone)
+{
+  typedef typename Zone::Facets_iterator Facets_iterator;
+
+  bool source_facet_is_in_conflict = false;
+
+  /*std::cerr << "before_insertion_impl:" << std::endl
+    << "* " << *facet.first->vertex((facet.second+1)%4)  << std::endl
+    << "  " << *facet.first->vertex((facet.second+2)%4)  << std::endl
+    << "  " << *facet.first->vertex((facet.second+3)%4)  << std::endl;*/
+
+  // Iterate on conflict zone facets
+  for (Facets_iterator facet_it = zone.internal_facets.begin();
+       facet_it != zone.internal_facets.end();
+       ++facet_it)
+  {
+    if (before_insertion_handle_facet_in_conflict_zone(*facet_it, facet) )
+    {
+      source_facet_is_in_conflict = true;
+    }
+  }
+
+  for (Facets_iterator facet_it = zone.boundary_facets.begin() ;
+       facet_it != zone.boundary_facets.end() ;
+       ++facet_it)
+  {
+    if (before_insertion_handle_facet_on_conflict_zone(*facet_it, facet))
+    {
+      source_facet_is_in_conflict = true;
+    }
+  }
+
+  // source_facet == Facet() when this->before_insertion_impl is
+  // called from a Mesh_3 visitor.
+  if ( !source_facet_is_in_conflict && facet != Facet()  )
+  {
+    const Facet source_other_side = mirror_facet(facet);
+
+    using boost::io::group;
+    using std::setprecision;
+
+    std::stringstream error_msg;
+    error_msg <<
+      boost::format("Mesh_3 ERROR: "
+                    "A facet is not in conflict with its refinement point!\n"
+                    "Debugging informations:\n"
+                    "  Facet: (%1%, %2%) = (%6%, %7%, %8%)\n"
+                    "  Dual: %3%\n"
+                    "  Refinement point: %5%\n"
+                    "  Cells adjacent to facet:\n"
+                    "    ( %9% , %10% , %11% , %12% )\n"
+                    "    ( %13% , %14% , %15% , %16% )\n")
+      % group(setprecision(17), (&*facet.first))
+      % group(setprecision(17), facet.second)
+      % display_dual(facet)
+      % 0 // dummy: %4% no longer used
+      % group(setprecision(17), point)
+      % group(setprecision(17), facet.first->vertex((facet.second + 1)&3)->point())
+      % group(setprecision(17), facet.first->vertex((facet.second + 2)&3)->point())
+      % group(setprecision(17), facet.first->vertex((facet.second + 3)&3)->point())
+      % facet.first->vertex(0)->point()
+      % facet.first->vertex(1)->point()
+      % facet.first->vertex(2)->point()
+      % facet.first->vertex(3)->point()
+      % source_other_side.first->vertex(0)->point()
+      % source_other_side.first->vertex(1)->point()
+      % source_other_side.first->vertex(2)->point()
+      % source_other_side.first->vertex(3)->point();
+
+    CGAL_error_msg(error_msg.str().c_str());
+  }
+}
+
+
+
+template<class Tr, class Cr, class MD, class C3T3_, class P_, class Ct, template<class Tr_, class Cr_, class MD_, class C3T3_2, class Ct_, class C_2> class B_, class C_>
+typename Refine_facets_3<Tr,Cr,MD,C3T3_,P_,Ct,B_,C_>::Vertex_handle
+Refine_facets_3<Tr,Cr,MD,C3T3_,P_,Ct,B_,C_>::
+insert_impl(const Point& point,
+            const Zone& zone)
+{
+  if( zone.locate_type == Tr::VERTEX )
+  {
+    // TODO look at this
+    std::cerr<<"VERTEX\n";
+    return zone.cell->vertex(zone.i);
+  }
+
+  const Facet& facet = *(zone.boundary_facets.begin());
+
+  Vertex_handle v = this->r_tr_.insert_in_hole(point,
+                                               zone.cells.begin(),
+                                               zone.cells.end(),
+                                               facet.first,
+                                               facet.second);
+
+  // Set index and dimension of v
+  this->set_vertex_properties(v, Base::get_last_vertex_index());
+
+  return v;
+}
+
+
+
+template<class Tr, class Cr, class MD, class C3T3_, class Ct, class C_>
+void
+Refine_facets_3_base<Tr,Cr,MD,C3T3_,Ct,C_>::
+restore_restricted_Delaunay(const Vertex_handle& vertex)
+{
+  typedef std::vector<Cell_handle> Cell_handle_vector;
+  typedef typename Cell_handle_vector::iterator Cell_handle_vector_iterator;
+
+  // Update incident facets
+  Cell_handle_vector cells;
+  r_tr_.incident_cells(vertex, std::back_inserter(cells));
+
+  for(Cell_handle_vector_iterator cell_it = cells.begin();
+      cell_it != cells.end();
+      ++cell_it)
+  {
+    // Look at all four facets of the cell, starting with the
+    // facet opposite to the new vertex
+    int index = (*cell_it)->index(vertex);
+
+    Facet opposite_facet(*cell_it, index);
+    after_insertion_handle_opposite_facet(opposite_facet);
+
+    for (int i = 1; i <= 3; ++i)
+    {
+      Facet incident_facet(*cell_it, (index+i)&3);
+      after_insertion_handle_incident_facet(incident_facet);
+    }
+  }
+}
+
+//-------------------------------------------------------
+// Private methods
+//-------------------------------------------------------
+template<class Tr, class Cr, class MD, class C3T3_, class Ct, class C_>
+void
+Refine_facets_3_base<Tr,Cr,MD,C3T3_,Ct,C_>::
+treat_new_facet(Facet& facet)
+{
+  // Treat facet
+  Facet_properties properties;
+  compute_facet_properties(facet, properties);
+  if ( properties )
+  {
+    const Surface_patch_index& surface_index = CGAL::cpp11::get<0>(*properties);
+    const Index& surface_center_index = CGAL::cpp11::get<1>(*properties);
+    const Point& surface_center = CGAL::cpp11::get<2>(*properties);
+
+    // Facet is on surface: set facet properties
+    set_facet_surface_center(facet, surface_center, surface_center_index);
+    set_facet_on_surface(facet, surface_index);
+
+    // Insert facet into refinement queue if needed
+    const Is_facet_bad is_facet_bad = r_criteria_(facet);
+
+    if ( is_facet_bad )
+    {
+      insert_bad_facet(facet, *is_facet_bad);
+
+      /*std::cerr << "INSERT BAD FACET : " << std::endl
+        << "* " << *facet.first->vertex((facet.second+1)%4)  << std::endl
+        << "  " << *facet.first->vertex((facet.second+2)%4)  << std::endl
+        << "  " << *facet.first->vertex((facet.second+3)%4)  << std::endl
+        << "  Quality=" << is_facet_bad->second << std::endl;*/
+    }
+  }
+  else
+  {
+    // Facet is not on surface
+    this->remove_facet_from_surface(facet);
+  }
+
+  // Set facet visited
+  Facet mirror = mirror_facet(facet);
+  set_facet_visited(facet);
+  set_facet_visited(mirror);
+}
+
+template<class Tr, class Cr, class MD, class C3T3_, class Ct, class C_>
+void
+Refine_facets_3_base<Tr,Cr,MD,C3T3_,Ct,C_>::
+dual_segment(const Facet & facet, Bare_point& p, Bare_point& q) const
+{
+  Cell_handle c = facet.first;
+  int i = facet.second;
+  Cell_handle n = c->neighbor(i);
+  CGAL_assertion( ! r_tr_.is_infinite(c) && ! r_tr_.is_infinite(n) );
+  p = Gt().construct_weighted_circumcenter_3_object()(
+      c->vertex(0)->point(),
+      c->vertex(1)->point(),
+      c->vertex(2)->point(),
+      c->vertex(3)->point());
+  q = Gt().construct_weighted_circumcenter_3_object()(
+      n->vertex(0)->point(),
+      n->vertex(1)->point(),
+      n->vertex(2)->point(),
+      n->vertex(3)->point());
+}
+
+template<class Tr, class Cr, class MD, class C3T3_, class Ct, class C_>
+void
+Refine_facets_3_base<Tr,Cr,MD,C3T3_,Ct,C_>::
+dual_segment_exact(const Facet & facet, Bare_point& p, Bare_point& q) const
+{
+  Cell_handle c = facet.first;
+  int i = facet.second;
+  Cell_handle n = c->neighbor(i);
+  CGAL_assertion( ! r_tr_.is_infinite(c) && ! r_tr_.is_infinite(n) );
+  p = Gt().construct_weighted_circumcenter_3_object()(
+      c->vertex(0)->point(),
+      c->vertex(1)->point(),
+      c->vertex(2)->point(),
+      c->vertex(3)->point(),
+      true);
+  q = Gt().construct_weighted_circumcenter_3_object()(
+      n->vertex(0)->point(),
+      n->vertex(1)->point(),
+      n->vertex(2)->point(),
+      n->vertex(3)->point(),
+      true);
+}
+
+template<class Tr, class Cr, class MD, class C3T3_, class Ct, class C_>
+void
+Refine_facets_3_base<Tr,Cr,MD,C3T3_,Ct,C_>::
+dual_ray(const Facet & facet, Ray_3& ray) const
+{
+  Cell_handle c = facet.first;
+  int i = facet.second;
+  Cell_handle n = c->neighbor(i);
+  // either n or c is infinite
+  int in;
+  if ( r_tr_.is_infinite(c) )
+    in = n->index(c);
+  else {
+    n = c;
+    in = i;
+  }
+  // n now denotes a finite cell, either c or c->neighbor(i)
+  int ind[3] = {(in+1)&3,(in+2)&3,(in+3)&3};
+  if ( (in&1) == 1 )
+    std::swap(ind[0], ind[1]);
+  const Point& p = n->vertex(ind[0])->point();
+  const Point& q = n->vertex(ind[1])->point();
+  const Point& r = n->vertex(ind[2])->point();
+
+  typename Gt::Line_3 l = Gt().construct_perpendicular_line_3_object()
+    ( Gt().construct_plane_3_object()(p,q,r),
+      Gt().construct_weighted_circumcenter_3_object()(p,q,r) );
+
+ ray = Gt().construct_ray_3_object()(Gt().construct_weighted_circumcenter_3_object()(
+        n->vertex(0)->point(),
+        n->vertex(1)->point(),
+        n->vertex(2)->point(),
+        n->vertex(3)->point()), l);
+}
+
+template<class Tr, class Cr, class MD, class C3T3_, class Ct, class C_>
+void
+Refine_facets_3_base<Tr,Cr,MD,C3T3_,Ct,C_>::
+dual_ray_exact(const Facet & facet, Ray_3& ray) const
+{
+  Cell_handle c = facet.first;
+  int i = facet.second;
+  Cell_handle n = c->neighbor(i);
+  // either n or c is infinite
+  int in;
+  if ( r_tr_.is_infinite(c) )
+    in = n->index(c);
+  else {
+    n = c;
+    in = i;
+  }
+  // n now denotes a finite cell, either c or c->neighbor(i)
+  int ind[3] = {(in+1)&3,(in+2)&3,(in+3)&3};
+  if ( (in&1) == 1 )
+    std::swap(ind[0], ind[1]);
+  const Point& p = n->vertex(ind[0])->point();
+  const Point& q = n->vertex(ind[1])->point();
+  const Point& r = n->vertex(ind[2])->point();
+
+  typename Gt::Line_3 l = Gt().construct_perpendicular_line_3_object()
+    ( Gt().construct_plane_3_object()(p,q,r),
+      Gt().construct_weighted_circumcenter_3_object()(p,q,r) );
+
+ ray = Gt().construct_ray_3_object()(Gt().construct_weighted_circumcenter_3_object()(
+        n->vertex(0)->point(),
+        n->vertex(1)->point(),
+        n->vertex(2)->point(),
+        n->vertex(3)->point(),
+        true), l);
+}
+
+
+
+
+
+template<class Tr, class Cr, class MD, class C3T3_, class Ct, class C_>
+void
+Refine_facets_3_base<Tr,Cr,MD,C3T3_,Ct,C_>::
+compute_facet_properties(const Facet& facet,
+                         Facet_properties& fp,
+                         bool force_exact) const
+{
+  //-------------------------------------------------------
+  // Facet must be finite
+  //-------------------------------------------------------
+  CGAL_assertion( ! r_tr_.is_infinite(facet) );
+  CGAL_assertion( r_tr_.dimension() == 3 );
+
+  // types
+  typedef boost::optional<typename MD::Surface_patch_index> Surface_patch;
+  typedef typename MD::Intersection Intersection;
+
+  // Functor
+  typename Gt::Is_degenerate_3 is_degenerate = Gt().is_degenerate_3_object();
+  typename Gt::Compare_xyz_3 compare_xyz = Gt().compare_xyz_3_object();
+#ifndef CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
+  typename MD::Do_intersect_surface do_intersect_surface =
+      r_oracle_.do_intersect_surface_object();
+#endif // not CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
+
+
+ typedef typename Gt::Bare_point Bare_point;
+
+  Cell_handle c = facet.first;
+  int i = facet.second;
+  Cell_handle n = c->neighbor(i);
+  if ( ! r_tr_.is_infinite(c) && ! r_tr_.is_infinite(n) ){
+    // the dual is a segment
+    Bare_point p1, p2;
+    if(force_exact){
+      dual_segment_exact(facet, p1, p2);
+    } else {
+      dual_segment(facet, p1, p2);
+    }
+    if (p1 == p2) { fp = Facet_properties(); return; }
+
+    // Trick to have canonical vector : thus, we compute always the same
+    // intersection
+    Segment_3 segment = ( compare_xyz(p1,p2)== CGAL::SMALLER )
+      ? Segment_3(p1, p2)
+      : Segment_3(p2, p1);
+
+    // If facet is on surface, compute intersection point and return true
+#ifndef CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
+    Surface_patch surface = do_intersect_surface(segment);
+    if ( surface )
+#endif // not CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
+    {
+      typename MD::Construct_intersection construct_intersection =
+          r_oracle_.construct_intersection_object();
+
+      Intersection intersect = construct_intersection(segment);
+#ifdef CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
+      // In the following, CGAL::cpp11::get<2>(intersect) == 0 is a way to
+      // test "intersect == Intersection()" (aka empty intersection), but
+      // the later does not work.
+      Surface_patch surface =
+        (CGAL::cpp11::get<2>(intersect) == 0) ? Surface_patch() :
+        Surface_patch(
+          r_oracle_.surface_patch_index(CGAL::cpp11::get<1>(intersect)));
+      if(surface)
+#endif // CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
+      fp =  Facet_properties(CGAL::cpp11::make_tuple(*surface,
+                                    CGAL::cpp11::get<1>(intersect),
+                                    Point(CGAL::cpp11::get<0>(intersect))));
+    }
+  }
+  // If the dual is a ray
+  else
+  {
+    // If a facet is on the convex hull, and if its finite incident
+    // cell has a very big Delaunay ball, then the dual of the facet is
+    // a ray constructed with a point with very big coordinates, and a
+    // vector with small coordinates. Its can happen than the
+    // constructed ray is degenerate (the point(1) of the ray is
+    // point(0) plus a vector whose coordinates are epsilon).
+    Ray_3 ray;
+    if(force_exact){
+      dual_ray_exact(facet,ray);
+    } else {
+      dual_ray(facet,ray);
+    }
+    if (is_degenerate(ray)) { fp = Facet_properties(); return; }
+
+#ifndef CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
+    Surface_patch surface = do_intersect_surface(ray);
+    if ( surface )
+#endif // not CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
+    {
+      typename MD::Construct_intersection construct_intersection =
+          r_oracle_.construct_intersection_object();
+
+      Intersection intersect = construct_intersection(ray);
+#ifdef CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
+      Surface_patch surface =
+        (CGAL::cpp11::get<2>(intersect) == 0) ? Surface_patch() :
+        Surface_patch(
+          r_oracle_.surface_patch_index(CGAL::cpp11::get<1>(intersect)));
+      if(surface)
+#endif // CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
+      {
+        fp = Facet_properties(CGAL::cpp11::make_tuple(*surface,
+                                      CGAL::cpp11::get<1>(intersect),
+                                      Point(CGAL::cpp11::get<0>(intersect))));
+      }
+    }
+  }
+}
+
+
+template<class Tr, class Cr, class MD, class C3T3_, class Ct, class C_>
+bool
+Refine_facets_3_base<Tr,Cr,MD,C3T3_,Ct,C_>::
+is_facet_encroached(const Facet& facet,
+                    const Point& point) const
+{
+  if ( r_tr_.is_infinite(facet) || ! this->is_facet_on_surface(facet) )
+  {
+    return false;
+  }
+
+  typename Gt::Compare_power_distance_3 compare_distance =
+    r_tr_.geom_traits().compare_power_distance_3_object();
+
+  const Cell_handle& cell = facet.first;
+  const int& facet_index = facet.second;
+  const Point& center = get_facet_surface_center(facet);
+  const Point& reference_point = cell->vertex((facet_index+1)&3)->point();
+
+  // facet is encroached if the new point is near from center than
+  // one vertex of the facet
+  return ( compare_distance(center, reference_point, point) != CGAL::SMALLER );
+}
+
+template<class Tr, class Cr, class MD, class C3T3_, class Ct, class C_>
+bool
+Refine_facets_3_base<Tr,Cr,MD,C3T3_,Ct,C_>::
+is_encroached_facet_refinable(Facet& facet) const
+{
+  typedef typename Gt::Point_3 Point_3;
+  typedef typename Gt::FT      FT;
+
+  typename Gt::Compute_squared_radius_smallest_orthogonal_sphere_3 sq_radius =
+    Gt().compute_squared_radius_smallest_orthogonal_sphere_3_object();
+
+  typename Gt::Compare_weighted_squared_radius_3 compare =
+    Gt().compare_weighted_squared_radius_3_object();
+
+  const Cell_handle& c = facet.first;
+  const int& k = facet.second;
+
+  int k1 = (k+1)&3;
+  int k2 = (k+2)&3;
+  int k3 = (k+3)&3;
+
+  // Get number of weighted points, and ensure that they will be accessible
+  // using k1...ki, if i is the number of weighted points.
+  int wp_nb = 0;
+  if(c->vertex(k1)->point().weight() > FT(0))
+  {
+    ++wp_nb;
+  }
+
+  if(c->vertex(k2)->point().weight() > FT(0))
+  {
+    if ( 0 == wp_nb ) { std::swap(k1,k2); }
+    ++wp_nb;
+  }
+
+  if(c->vertex(k3)->point().weight() > FT(0))
+  {
+    if ( 0 == wp_nb ) { std::swap(k1,k3); }
+    if ( 1 == wp_nb ) { std::swap(k2,k3); }
+    ++wp_nb;
+  }
+
+  const Point_3& p1 = c->vertex(k1)->point();
+  const Point_3& p2 = c->vertex(k2)->point();
+  const Point_3& p3 = c->vertex(k3)->point();
+
+  const FT min_ratio (0.16); // (0.2*2)^2
+
+  // Check ratio
+  switch ( wp_nb )
+  {
+    case 1:
+    {
+      FT r = (std::max)(sq_radius(p1,p2),sq_radius(p1,p3));
+      if ( r < min_ratio*p1.weight() ) { return false; }
+      break;
+    }
+
+    case 2:
+    {
+      bool do_spheres_intersect = (compare(p1,p2,FT(0)) != CGAL::LARGER);
+      if ( do_spheres_intersect )
+      {
+        FT r13 = sq_radius(p1,p3) / p1.weight();
+        FT r23 = sq_radius(p2,p3) / p2.weight();
+        FT r = (std::max)(r13,r23);
+
+        if ( r < min_ratio ) { return false; }
+      }
+      break;
+    }
+
+    case 3:
+    {
+      bool do_spheres_intersect = (compare(p1,p2,p3,FT(0)) != CGAL::LARGER);
+      if ( do_spheres_intersect ) { return false; }
+      break;
+    }
+
+    default: break;
+  }
+
+  return true;
+}
+
+/**
+  * \c facet is an internal facet we are going to remove
+  * \c source_facet is the facet we want to refine by inserting a new point
+  */
+template<class Tr, class Cr, class MD, class C3T3_, class Ct, class C_>
+bool
+Refine_facets_3_base<Tr,Cr,MD,C3T3_,Ct,C_>::
+before_insertion_handle_facet_in_conflict_zone(Facet& facet,
+                                               const Facet& source_facet)
+{
+  Facet other_side = mirror_facet(facet);
+
+  // Is the facet on the surface of the complex
+  if ( this->is_facet_on_surface(facet) )
+  {
+    // Remove element (if needed - see remove_bad_facet implementation)
+    remove_bad_facet(facet, Ct());
+
+    // Remove facet from complex
+    remove_facet_from_surface(facet);
+
+    // Reset visited
+    reset_facet_visited(facet);
+    reset_facet_visited(other_side);
+  }
+
+  return ( (facet == source_facet) || (other_side == source_facet) );
+}
+
+
+
+template<class Tr, class Cr, class MD, class C3T3_, class Ct, class C_>
+void
+Refine_facets_3_base<Tr,Cr,MD,C3T3_,Ct,C_>::
+after_insertion_handle_incident_facet(Facet& facet)
+{
+  // If the facet is infinite or has been already visited,
+  // then there is nothing to do as for it or its edges
+  // Facet other_side = mirror_facet(facet);
+  if ( r_tr_.is_infinite(facet) || (is_facet_visited(facet)) ) // && is_facet_visited(other_side)) )
+  {
+    return;
+  }
+
+  treat_new_facet(facet);
+}
+
+
+}  // end namespace Mesh_3
+
+
+}  // end namespace CGAL
+
+#endif // CGAL_MESH_3_REFINE_FACETS_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Refine_facets_manifold_base.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Refine_facets_manifold_base.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Refine_facets_manifold_base.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Refine_facets_manifold_base.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Refine_tets_visitor.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Refine_tets_visitor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Refine_tets_visitor.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Refine_tets_visitor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Robust_intersection_kernel.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Robust_intersection_kernel.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Robust_intersection_kernel.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Robust_intersection_kernel.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Robust_intersection_traits_3.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Robust_intersection_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Robust_intersection_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Robust_intersection_traits_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Robust_weighted_circumcenter_filtered_traits_3.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Robust_weighted_circumcenter_filtered_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Robust_weighted_circumcenter_filtered_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Robust_weighted_circumcenter_filtered_traits_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Sizing_grid.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Sizing_grid.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Sizing_grid.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Sizing_grid.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Sliver_perturber.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Sliver_perturber.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Sliver_perturber.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Sliver_perturber.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Slivers_exuder.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Slivers_exuder.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Slivers_exuder.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Slivers_exuder.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Slivers_exuder_cell_attributes_traits.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Slivers_exuder_cell_attributes_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Slivers_exuder_cell_attributes_traits.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Slivers_exuder_cell_attributes_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Triangle_accessor_primitive.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Triangle_accessor_primitive.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Triangle_accessor_primitive.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Triangle_accessor_primitive.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Triangulation_helpers.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Triangulation_helpers.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Triangulation_helpers.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Triangulation_helpers.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Triangulation_sizing_field.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Triangulation_sizing_field.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Triangulation_sizing_field.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Triangulation_sizing_field.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Uniform_sizing_field.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Uniform_sizing_field.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Uniform_sizing_field.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Uniform_sizing_field.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Worksharing_data_structures.h b/3rdparty/CGAL/include/CGAL/Mesh_3/Worksharing_data_structures.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/Worksharing_data_structures.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/Worksharing_data_structures.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/config.h b/3rdparty/CGAL/include/CGAL/Mesh_3/config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/config.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/config.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/dihedral_angle_3.h b/3rdparty/CGAL/include/CGAL/Mesh_3/dihedral_angle_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/dihedral_angle_3.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/dihedral_angle_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/global_parameters.h b/3rdparty/CGAL/include/CGAL/Mesh_3/global_parameters.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/global_parameters.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/global_parameters.h
diff --git a/3rdparty/CGAL/include/CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h b/3rdparty/CGAL/include/CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h
new file mode 100644
index 0000000..db729c8
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h
@@ -0,0 +1,237 @@
+// Copyright (c) 2015,2016 GeometryFactory
+// 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
+// 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(s)     : Laurent Rineau
+
+#ifndef CGAL_MESH_3_INITIALIZE_TRIANGULATION_FROM_LABELED_IMAGE_H
+#define CGAL_MESH_3_INITIALIZE_TRIANGULATION_FROM_LABELED_IMAGE_H
+
+#include <CGAL/Mesh_3/search_for_connected_components_in_labeled_image.h>
+
+#include <iostream>
+#include <queue>
+#include <CGAL/Mesh_3/squared_distance_Point_3_Triangle_3.h>
+#include <CGAL/iterator.h>
+#include <CGAL/point_generators_3.h>
+#include <CGAL/Image_3.h>
+#include <CGAL/make_mesh_3.h>
+#include <boost/foreach.hpp>
+
+template <typename Point>
+struct Get_point
+{
+  const double vx, vy, vz;
+  Get_point(const CGAL::Image_3* image)
+    : vx(image->vx())
+    , vy(image->vy())
+    , vz(image->vz())
+  {}
+
+  Point operator()(const std::size_t i,
+                   const std::size_t j,
+                   const std::size_t k) const
+  {
+    return Point(double(i) * vx, double(j) * vy, double(k) * vz);
+  }
+};
+template<class C3T3, class MeshDomain, class MeshCriteria>
+void init_tr_from_labeled_image_call_init_features(C3T3&,
+                                                   const MeshDomain&,
+                                                   const MeshCriteria&,
+                                                   CGAL::Tag_false)
+{
+}
+template<class C3T3, class MeshDomain, class MeshCriteria>
+void init_tr_from_labeled_image_call_init_features(C3T3& c3t3,
+                                                   const MeshDomain& domain,
+                                                   const MeshCriteria& criteria,
+                                                   CGAL::Tag_true)
+{
+  CGAL::internal::Mesh_3::init_c3t3_with_features(c3t3,
+                                                  domain,
+                                                  criteria);
+  std::cout << c3t3.triangulation().number_of_vertices()
+            << " initial points on 1D-features" << std::endl;
+}
+
+
+template<class C3T3, class MeshDomain, class MeshCriteria,
+         typename Image_word_type>
+void initialize_triangulation_from_labeled_image(C3T3& c3t3,
+                                                 const MeshDomain&   domain,
+                                                 const CGAL::Image_3& image,
+                                                 const MeshCriteria& criteria,
+                                                 Image_word_type,
+                                                 bool protect_features = false
+                                                 )
+{
+  typedef typename C3T3::Triangulation       Tr;
+  typedef typename Tr::Point                 Weighted_point;
+  typedef typename Weighted_point::Point     Point_3;
+  typedef typename Tr::Segment               Segment_3;
+  typedef typename Tr::Geom_traits::Vector_3 Vector_3;
+  typedef typename Tr::Vertex_handle         Vertex_handle;
+  typedef typename Tr::Cell_handle           Cell_handle;
+
+  typedef Point_3 Point;
+  typedef MeshDomain Mesh_domain;
+
+  Tr& tr = c3t3.triangulation();
+
+  if(protect_features) {
+    init_tr_from_labeled_image_call_init_features
+      (c3t3, domain, criteria,
+       CGAL::internal::Mesh_3::Has_features<Mesh_domain>());
+  }
+
+  const double max_v = (std::max)((std::max)(image.vx(),
+                                             image.vy()),
+                                  image.vz());
+
+  typedef std::vector<std::pair<Point_3, std::size_t> > Seeds;
+  Seeds seeds;
+  Get_point<Point_3> get_point(&image);
+  std::cout << "Searching for connected components..." << std::endl;
+  CGAL::Identity<Image_word_type> no_transformation;
+  search_for_connected_components_in_labeled_image(image,
+                                                   std::back_inserter(seeds),
+                                                   CGAL::Emptyset_iterator(),
+                                                   no_transformation,
+                                                   get_point,
+                                                   Image_word_type());
+  std::cout << "  " << seeds.size() << " components were found." << std::endl;
+  std::cout << "Construct initial points..." << std::endl;
+  for(typename Seeds::const_iterator it = seeds.begin(), end = seeds.end();
+      it != end; ++it)
+  {
+    const double radius = double(it->second + 1)* max_v;
+    CGAL::Random_points_on_sphere_3<Point> points_on_sphere_3(radius);
+    typename Mesh_domain::Construct_intersection construct_intersection =
+      domain.construct_intersection_object();
+
+    std::vector<Vector_3> directions;
+    if(it->second < 2) {
+      // shoot in six directions
+      directions.push_back(Vector_3(-radius, 0, 0));
+      directions.push_back(Vector_3(+radius, 0, 0));
+      directions.push_back(Vector_3(0, -radius, 0));
+      directions.push_back(Vector_3(0, +radius, 0));
+      directions.push_back(Vector_3(0, 0, -radius));
+      directions.push_back(Vector_3(0, 0, +radius));
+    } else {
+      for(int i = 0; i < 20; ++i)
+      {
+        // shoot 20 random directions
+        directions.push_back(*points_on_sphere_3++ - CGAL::ORIGIN);
+      }
+    }
+
+    BOOST_FOREACH(const Vector_3& v, directions)
+    {
+      const Point test = it->first + v;
+      const typename Mesh_domain::Intersection intersect =
+        construct_intersection(Segment_3(it->first, test));
+      if (CGAL::cpp11::get<2>(intersect) != 0)
+      {
+        Point_3 pi = CGAL::cpp11::get<0>(intersect);
+
+        // This would cause trouble to optimizers
+        // check pi will not be hidden
+        typename Tr::Locate_type lt;
+        Cell_handle c;
+        int li, lj;
+        Cell_handle pi_cell = tr.locate(pi, lt, li, lj);
+        if(lt != Tr::OUTSIDE_AFFINE_HULL) {
+          switch (tr.dimension())
+          { //skip dimension 0
+          case 1:
+            if (tr.side_of_power_segment(pi_cell, pi, true) != CGAL::ON_BOUNDED_SIDE)
+              continue;
+            break;
+          case 2:
+            if (tr.side_of_power_circle(pi_cell, 3, pi, true) != CGAL::ON_BOUNDED_SIDE)
+              continue;
+            break;
+          case 3:
+            if (tr.side_of_power_sphere(pi_cell, pi, true) != CGAL::ON_BOUNDED_SIDE)
+              continue;
+          }
+        }
+
+        //check pi is not inside a protecting ball
+        std::vector<Vertex_handle> conflict_vertices;
+        if (tr.dimension() == 3)
+        {
+          tr.vertices_on_conflict_zone_boundary(pi, pi_cell
+            , std::back_inserter(conflict_vertices));
+        }
+        else
+        {
+          for (typename Tr::Finite_vertices_iterator vit = tr.finite_vertices_begin();
+               vit != tr.finite_vertices_end(); ++vit)
+          {
+            if (vit->point().weight() > 0.)
+              conflict_vertices.push_back(vit);
+          }
+        }
+        bool pi_inside_protecting_sphere = false;
+        BOOST_FOREACH(Vertex_handle cv, conflict_vertices)
+        {
+          if (cv->point().weight() == 0.)
+            continue;
+          if (CGAL::compare_squared_distance(pi, cv->point(), cv->point().weight())
+              != CGAL::LARGER)
+          {
+            pi_inside_protecting_sphere = true;
+            break;
+          }
+        }
+        if (pi_inside_protecting_sphere)
+          continue;
+        const typename Mesh_domain::Index index = CGAL::cpp11::get<1>(intersect);
+
+        /// The following lines show how to insert initial points in the
+        /// `c3t3` object. [insert initial points]
+        Vertex_handle v = tr.insert(pi);
+
+        // `v` could be null if `pi` is hidden by other vertices of `tr`.
+        CGAL_assertion(v != Vertex_handle());
+
+        c3t3.set_dimension(v, 2); // by construction, points are on surface
+        c3t3.set_index(v, index);
+        /// [insert initial points]
+      }
+      // else
+      // {
+      //   std::cerr <<
+      //     boost::format("Error. Segment (%1%, %2%) does not intersect the surface!\n")
+      //     % it->first % test;
+      // }
+    }
+  }
+  std::cout << "  " << tr.number_of_vertices() << " initial points." << std::endl;
+  if ( c3t3.triangulation().dimension() != 3 )
+  {
+    std::cout << "  not enough points: triangulation.dimension() == "
+              << c3t3.triangulation().dimension() << std::endl;
+    CGAL::internal::Mesh_3::init_c3t3(c3t3, domain, criteria, 20);
+    std::cout << "  -> " << tr.number_of_vertices() << " initial points." << std::endl;
+  }
+}
+
+#endif // CGAL_MESH_3_INITIALIZE_TRIANGULATION_FROM_LABELED_IMAGE_H
diff --git a/3rdparty/CGAL/include/CGAL/Mesh_3/io_signature.h b/3rdparty/CGAL/include/CGAL/Mesh_3/io_signature.h
new file mode 100644
index 0000000..944378c
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Mesh_3/io_signature.h
@@ -0,0 +1,275 @@
+// Copyright (c) 2006  INRIA Sophia-Antipolis (France).
+// Copyright (c) 2011  GeometryFactory Sarl (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
+// 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: https://scm.gforge.inria.fr/svn/cgal/branches/features/Mesh_3-experimental-GF/Mesh_3/include/CGAL/Mesh_3/io_signature.h $
+// $Id: io_signature.h 68587 2012-04-17 16:00:12Z lrineau $
+// 
+//
+// Author(s)     : Laurent RINEAU
+
+#ifndef CGAL_MESH_3_IO_SIGNATURE_H
+#define CGAL_MESH_3_IO_SIGNATURE_H
+#define CGAL_MESH_3_IO_H // the old include macro, tested by other files
+
+#include <CGAL/Point_3.h>
+#include <CGAL/Weighted_point.h>
+#include <CGAL/Delaunay_triangulation_3.h>
+#include <CGAL/Triangulation_vertex_base_3.h>
+#include <CGAL/Triangulation_vertex_base_with_info_3.h>
+#include <CGAL/Triangulation_cell_base_3.h>
+#include <CGAL/Triangulation_cell_base_with_info_3.h>
+#include <CGAL/Regular_triangulation_3.h>
+#include <CGAL/Regular_triangulation_cell_base_3.h>
+#include <boost/variant.hpp>
+#include <boost/tuple/tuple.hpp>
+#include <utility>
+
+namespace CGAL { 
+
+// SFINAE test
+template <typename T, typename U>
+class has_io_signature
+{
+private:
+	template <U> struct helper;
+	template <typename V> static char check(helper<&V::io_signature> *);
+	template <typename V> static char (&check(...))[2];
+
+public:
+	enum { value = (sizeof(check<T>(0)) == sizeof(char)) };
+};
+
+template <class T, bool has_io_signature>
+struct Get_io_signature_aux
+{
+  std::string operator() () const
+  {
+    return T::io_signature();
+  }
+}; // end struct template Get_io_signature_aux
+
+template <class T>
+struct Get_io_signature_aux<T, false>
+{
+  std::string operator()() const
+  {
+    return std::string();
+  }
+}; // end template partial specialization Get_io_signature_aux<T, false>
+
+
+template <class T>
+struct Get_io_signature
+  : public Get_io_signature_aux<
+  T,
+  (has_io_signature<T, std::string (T::*)() >::value ||
+   has_io_signature<T, std::string (T::*)() const >::value ||
+   has_io_signature<T, std::string (*)() >::value )  // signature for
+                                                     // static mem func
+  >
+{
+};
+
+template <>
+struct Get_io_signature<int>
+{
+  std::string operator()() {
+    return "i";
+  }
+};
+
+template <>
+struct Get_io_signature<unsigned int>
+{
+  std::string operator()() {
+    return "ui";
+  }
+};
+
+template <>
+struct Get_io_signature<double>
+{
+  std::string operator()() {
+    return "d";
+  }
+};
+
+template <typename T, typename U>
+struct Get_io_signature<boost::variant<T,U> >
+{
+    std::string operator()() {
+      return std::string("boost::variant<") +
+        Get_io_signature<T>()() + "," +
+        Get_io_signature<U>()() + ">";
+  }
+};
+
+template <typename T, typename U>
+struct Get_io_signature<std::pair<T,U> >
+{
+    std::string operator()() {
+      return std::string("std::pair<") +
+        Get_io_signature<T>()() + "," +
+        Get_io_signature<U>()() + ">";
+  }
+};
+
+template <typename T, typename U>
+struct Get_io_signature<boost::tuple<T,U> >
+{
+    std::string operator()() {
+      return std::string("std::pair<") +
+        Get_io_signature<T>()() + "," +
+        Get_io_signature<U>()() + ">";
+  }
+};
+
+template <typename T, typename U, typename V>
+struct Get_io_signature<boost::variant<T,U,V> >
+{
+    std::string operator()() {
+      return std::string("boost::variant<") +
+        Get_io_signature<T>()() + "," +
+        Get_io_signature<U>()() + "," +
+        Get_io_signature<V>()() + ">";
+  }
+};
+
+template <typename T, typename U, 
+          typename V, typename W>
+struct Get_io_signature<boost::variant<T,U,V,W> >
+{
+    std::string operator()() {
+      return std::string("boost::variant<") +
+        Get_io_signature<T>()() + "," +
+        Get_io_signature<U>()() + "," +
+        Get_io_signature<V>()() + "," +
+        Get_io_signature<W>()() + ">";
+  }
+};
+
+template <class Kernel>
+struct Get_io_signature<Point_3<Kernel> >
+{
+  std::string operator()() {
+    return "Point_3";
+  }
+};
+
+template <class Point, typename FT>
+struct Get_io_signature<Weighted_point<Point, FT> >
+{
+  std::string operator()() {
+    return std::string("Weighted_point<") + Get_io_signature<Point>()() + ">";
+  }
+};
+
+#ifdef CGAL_TRIANGULATION_3_H
+template <class Gt, class Vb, class Cb, class C_tag>
+struct
+Get_io_signature<Triangulation_3<Gt, Triangulation_data_structure_3<Vb, Cb, C_tag> > >
+{
+  typedef Triangulation_data_structure_3<Vb, Cb, C_tag> Tds;
+
+  std::string operator()() {
+    return std::string("Triangulation_3(") +
+      Get_io_signature<typename Gt::Point_3>()() +
+      ",Vb(" + Get_io_signature<typename Tds::Vertex>()() +
+      "),Cb(" + Get_io_signature<typename Tds::Cell>()() +
+      "))";
+  }
+};
+#endif
+
+#ifdef CGAL_DELAUNAY_TRIANGULATION_3_H
+template <class Gt, class Tds>
+struct 
+Get_io_signature<Delaunay_triangulation_3<Gt, Tds> >
+{
+  std::string operator()() {
+    return Get_io_signature<Triangulation_3<Gt, Tds> >()();
+  }
+};
+#endif
+
+#ifdef CGAL_REGULAR_TRIANGULATION_3_H
+template <class Gt, class Tds>
+struct
+Get_io_signature<Regular_triangulation_3<Gt, Tds> >
+{
+  std::string operator()() {
+    return Get_io_signature<Triangulation_3<Gt, Tds> >()();
+  }
+};
+#endif
+
+#ifdef CGAL_TRIANGULATION_VERTEX_BASE_3_H
+template <class Gt, class Vb>
+struct Get_io_signature<Triangulation_vertex_base_3<Gt, Vb> >
+{
+  std::string operator()() {
+    return "Tvb_3";
+  }
+};
+#endif
+
+#ifdef CGAL_TRIANGULATION_VERTEX_BASE_WITH_INFO_3_H
+template <class Info, class Gt, class Vb>
+struct
+Get_io_signature<Triangulation_vertex_base_with_info_3<Info, Gt, Vb> >
+{
+  std::string operator()() {
+    return Get_io_signature<Vb>()();
+  }
+};
+#endif
+
+#ifdef CGAL_TRIANGULATION_CELL_BASE_3_H
+template <class Gt, class Cb>
+struct
+Get_io_signature<Triangulation_cell_base_3<Gt, Cb> >
+{
+  std::string operator()() {
+    return "Tcb_3";
+  }
+};
+#endif
+
+#ifdef CGAL_TRIANGULATION_CELL_BASE_WITH_INFO_3_H
+template <class Info, class Gt, class Cb>
+struct
+Get_io_signature<Triangulation_cell_base_with_info_3<Info, Gt, Cb> >
+{
+  std::string operator()() {
+    return Get_io_signature<Cb>()();
+  }
+};
+#endif
+
+#ifdef CGAL_REGULAR_TRIANGULATION_CELL_BASE_3_H
+template <class Gt, class Cb, class Container>
+struct
+Get_io_signature<Regular_triangulation_cell_base_3<Gt, Cb, Container> >
+{
+  std::string operator()() {
+    return "RTcb_3";
+  }
+};
+#endif
+
+} // end namespace CGAL
+
+
+#endif // CGAL_MESH_3_IO_SIGNATURE_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/mesh_standard_cell_criteria.h b/3rdparty/CGAL/include/CGAL/Mesh_3/mesh_standard_cell_criteria.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/mesh_standard_cell_criteria.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/mesh_standard_cell_criteria.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/mesh_standard_criteria.h b/3rdparty/CGAL/include/CGAL/Mesh_3/mesh_standard_criteria.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/mesh_standard_criteria.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/mesh_standard_criteria.h
diff --git a/3rdparty/CGAL/include/CGAL/Mesh_3/mesh_standard_facet_criteria.h b/3rdparty/CGAL/include/CGAL/Mesh_3/mesh_standard_facet_criteria.h
new file mode 100644
index 0000000..8ae534b
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Mesh_3/mesh_standard_facet_criteria.h
@@ -0,0 +1,791 @@
+// Copyright (c) 2009 INRIA Sophia-Antipolis (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
+// 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(s)     : Stephane Tayeb
+//
+//******************************************************************************
+// File Description :
+//
+//******************************************************************************
+
+
+#ifndef CGAL_MESH_3_MESH_STANDARD_FACET_CRITERIA_H
+#define CGAL_MESH_3_MESH_STANDARD_FACET_CRITERIA_H
+
+#include <CGAL/Mesh_3/config.h>
+
+#include <CGAL/number_utils.h> // for to_double
+#include <CGAL/Mesh_3/mesh_standard_criteria.h>
+#include <cmath>
+
+
+namespace CGAL {
+
+namespace Mesh_3 {
+
+namespace details {
+
+  template<typename K>
+  inline
+  typename K::FT
+  min_3(const typename K::FT& a,
+        const typename K::FT& b,
+        const typename K::FT& c)
+  {
+    return (std::min)(a, (std::min)(b,c));
+  }
+
+} // end namespace details
+
+
+
+// Aspect_ratio Criterion class
+template <typename Tr, typename Visitor_>
+class Aspect_ratio_criterion :
+  public Mesh_3::Abstract_criterion<Tr, Visitor_>
+{
+private:
+  typedef typename Tr::Facet Facet;
+  typedef typename Tr::Geom_traits::FT FT;
+
+  typedef Mesh_3::Abstract_criterion<Tr,Visitor_> Base;
+  typedef typename Base::Quality Quality;
+  typedef typename Base::Badness Badness;
+
+  typedef Aspect_ratio_criterion<Tr,Visitor_> Self;
+
+public:
+  // Nb: the default bound of the criterion is such that the criterion
+  // is always fulfilled
+  Aspect_ratio_criterion(const FT angle_min = 0.)
+  { // TODO: document that FT must constructible from a double!
+    set_angle_min(angle_min);
+  }
+
+protected:
+  virtual void do_accept(Visitor_& v) const
+  {
+    v.visit(*this);
+  }
+
+  virtual Self* do_clone() const
+  {
+    // Call copy ctor on this
+    return new Self(*this);
+  }
+
+  void set_angle_min(const FT angle_min)
+  {
+    if(angle_min == FT(0))
+    {
+      B_ = 0;
+    }
+    else
+    {
+      B_ = std::sin (CGAL_PI * CGAL::to_double(angle_min) / 180);
+      B_ = B_ * B_;
+    }
+  }
+
+  virtual Badness do_is_bad (const Facet& f) const
+  {
+    CGAL_assertion (f.first->is_facet_on_surface(f.second));
+    CGAL_assertion (B_ != 0);
+
+    typedef typename Tr::Geom_traits Gt;
+    typedef typename Tr::Point Point_3;
+
+    const typename Gt::Construct_triangle_3 triangle =
+        Gt().construct_triangle_3_object();
+    const typename Gt::Compute_squared_distance_3 distance =
+        Gt().compute_squared_distance_3_object();
+    const typename Gt::Compute_squared_area_3 area =
+        Gt().compute_squared_area_3_object();
+
+    const Point_3& p1 = f.first->vertex((f.second+1)&3)->point();
+    const Point_3& p2 = f.first->vertex((f.second+2)&3)->point();
+    const Point_3& p3 = f.first->vertex((f.second+3)&3)->point();
+
+    const FT triangle_area = area(triangle(p1,p2,p3));
+
+    const FT d12 = distance(p1,p2);
+    const FT d13 = distance(p1,p3);
+    const FT d23 = distance(p2,p3);
+    const FT min_d123 = details::min_3<Gt>(d12,d13,d23);
+
+    const FT aspect_ratio = 4 * triangle_area * min_d123 / (d12*d13*d23);
+
+    CGAL_assertion (aspect_ratio >= 0 && aspect_ratio <= 1);
+
+    if ( aspect_ratio < B_ )
+    {
+#ifdef CGAL_MESH_3_DEBUG_FACET_CRITERIA
+      std::cerr << "Bad facet (angle criterion): aspect_ratio[" << aspect_ratio
+                << "] bound[" << B_ << "]" << std::endl;
+#endif
+      return Badness(Quality(aspect_ratio));
+    }
+    else
+      return Badness();
+  }
+
+private:
+  FT B_;
+
+};  // end Aspect_ratio_criterion
+
+
+// Curvature_adapted size Criterion class
+template <typename Tr, typename Visitor_>
+class Curvature_size_criterion :
+  public Mesh_3::Abstract_criterion<Tr, Visitor_>
+{};
+
+template <typename Tr, typename Visitor_>
+class Uniform_curvature_size_criterion :
+  public Curvature_size_criterion<Tr, Visitor_>
+{
+private:
+  typedef typename Tr::Facet Facet;
+  typedef typename Tr::Geom_traits::FT FT;
+
+  typedef Mesh_3::Abstract_criterion<Tr,Visitor_> Base;
+  typedef typename Base::Quality Quality;
+  typedef typename Base::Badness Badness;
+
+  typedef Uniform_curvature_size_criterion<Tr,Visitor_> Self;
+
+public:
+  // Nb: the default bound of the criterion is such that the criterion
+  // is always fulfilled
+  Uniform_curvature_size_criterion(const FT b = 0) : B_(b * b) {}
+
+protected:
+  virtual void do_accept(Visitor_& v) const
+  {
+    v.visit(*this);
+  }
+
+  virtual Self* do_clone() const
+  {
+    // Call copy ctor on this
+    return new Self(*this);
+  }
+
+  virtual Badness do_is_bad (const Facet& f) const
+  {
+    CGAL_assertion(f.first->is_facet_on_surface(f.second));
+    CGAL_assertion (B_ != 0);
+
+    typedef typename Tr::Geom_traits Gt;
+    typedef typename Tr::Point Point_3;
+
+    typename Gt::Compute_squared_distance_3 distance =
+        Gt().compute_squared_distance_3_object();
+    typename Gt::Construct_weighted_circumcenter_3 circumcenter =
+        Gt().construct_weighted_circumcenter_3_object();
+
+    const Point_3& p1 = f.first->vertex((f.second+1)&3)->point();
+    const Point_3& p2 = f.first->vertex((f.second+2)&3)->point();
+    const Point_3& p3 = f.first->vertex((f.second+3)&3)->point();
+
+    const Point_3 c = circumcenter(p1,p2,p3);
+
+    const FT sq_dist = distance(c, f.first->get_facet_surface_center(f.second));
+
+    if ( sq_dist > B_ )
+    {
+#ifdef CGAL_MESH_3_DEBUG_FACET_CRITERIA
+      std::cerr << "Bad facet (curvature size): sq_dist[" << sq_dist
+                << "] bound[" << B_ << "]\n";
+#endif
+      return Badness(Quality(B_/sq_dist));
+    }
+    else
+      return Badness();
+  }
+
+private:
+  FT B_;
+
+};  // end Uniform_curvature_size_criterion
+
+// Variable size Criterion class
+template <typename Tr, typename Visitor_, typename SizingField>
+class Variable_curvature_size_criterion :
+  public Curvature_size_criterion<Tr, Visitor_>
+{
+private:
+  typedef typename Tr::Facet            Facet;
+  typedef typename Tr::Geom_traits::FT  FT;
+  typedef typename Tr::Vertex::Index    Index;
+
+  typedef Mesh_3::Abstract_criterion<Tr,Visitor_> Base;
+  typedef typename Base::Quality Quality;
+  typedef typename Base::Badness Badness;
+
+  typedef Variable_curvature_size_criterion<Tr,Visitor_,SizingField> Self;
+  typedef SizingField Sizing_field;
+
+public:
+  // Nb: the default bound of the criterion is such that the criterion
+  // is always fulfilled
+  Variable_curvature_size_criterion(const Sizing_field& s) : size_(s) {}
+
+protected:
+  virtual void do_accept(Visitor_& v) const
+  {
+    v.visit(*this);
+  }
+
+  virtual Self* do_clone() const
+  {
+    // Call copy ctor on this
+    return new Self(*this);
+  }
+
+  virtual Badness do_is_bad (const Facet& f) const
+  {
+    CGAL_assertion (f.first->is_facet_on_surface(f.second));
+
+    typedef typename Tr::Geom_traits Gt;
+    typedef typename Tr::Point Point_3;
+
+    typename Gt::Compute_squared_distance_3 distance =
+        Gt().compute_squared_distance_3_object();
+    typename Gt::Construct_weighted_circumcenter_3 circumcenter =
+        Gt().construct_weighted_circumcenter_3_object();
+
+    const Point_3& p1 = f.first->vertex((f.second+1)&3)->point();
+    const Point_3& p2 = f.first->vertex((f.second+2)&3)->point();
+    const Point_3& p3 = f.first->vertex((f.second+3)&3)->point();
+
+    const Point_3 c = circumcenter(p1,p2,p3);
+    const Point_3& ball_center = f.first->get_facet_surface_center(f.second);
+
+    const FT sq_dist = distance(c, ball_center);
+
+    const Index& index = f.first->get_facet_surface_center_index(f.second);
+
+    const FT sq_bound = CGAL::square(size_(ball_center, 2, index));
+    CGAL_assertion(sq_bound > FT(0));
+
+    if ( sq_dist > sq_bound )
+    {
+#ifdef CGAL_MESH_3_DEBUG_FACET_CRITERIA
+      std::cerr << "Bad facet (curvature size): sq_dist[" << sq_dist
+      << "] bound[" << sq_bound << "]\n";
+#endif
+      return Badness(Quality(sq_bound/sq_dist));
+    }
+    else
+      return Badness();
+  }
+
+private:
+  Sizing_field size_;
+
+};  // end Variable_curvature_size_criterion
+
+// Size Criterion base class
+template < typename Tr, typename Visitor_ >
+class Facet_size_criterion :
+  public Mesh_3::Abstract_criterion<Tr, Visitor_>
+{
+};
+  
+// Variable size Criterion class
+template <typename Tr, typename Visitor_, typename SizingField>
+class Variable_size_criterion :
+  public Facet_size_criterion<Tr, Visitor_>
+{
+private:
+  typedef typename Tr::Facet            Facet;
+  typedef typename Tr::Geom_traits::FT  FT;
+  typedef typename Tr::Vertex::Index    Index;
+  
+  typedef Mesh_3::Abstract_criterion<Tr,Visitor_> Base;
+  typedef typename Base::Quality Quality;
+  typedef typename Base::Badness Badness;
+  
+  typedef Variable_size_criterion<Tr,Visitor_,SizingField> Self;
+  typedef SizingField Sizing_field;
+  
+public:
+  // Nb: the default bound of the criterion is such that the criterion
+  // is always fulfilled
+  Variable_size_criterion(const Sizing_field& s) : size_(s) {}
+  
+protected:
+  virtual void do_accept(Visitor_& v) const
+  {
+    v.visit(*this);
+  }
+  
+  virtual Self* do_clone() const
+  {
+    // Call copy ctor on this
+    return new Self(*this);
+  }
+  
+  virtual Badness do_is_bad (const Facet& f) const
+  {
+    CGAL_assertion (f.first->is_facet_on_surface(f.second));
+    
+    typedef typename Tr::Geom_traits Gt;
+    typedef typename Tr::Point Point_3;
+    
+    typename Gt::Compute_squared_distance_3 distance =
+      Gt().compute_squared_distance_3_object();
+    
+    const Point_3& p1 = f.first->vertex((f.second+1)&3)->point();
+    const Point_3& ball_center = f.first->get_facet_surface_center(f.second);
+    const Index& index = f.first->get_facet_surface_center_index(f.second);
+    
+    const FT sq_radius = distance(p1,ball_center);
+    const FT sq_bound = CGAL::square(size_(ball_center, 2, index));
+    CGAL_assertion(sq_bound > FT(0));
+    
+    if ( sq_radius > sq_bound )
+    {
+#ifdef CGAL_MESH_3_DEBUG_FACET_CRITERIA
+      std::cerr << "Bad facet (uniform size): sq_radius[" << sq_radius
+      << "] bound[" << sq_bound << "]\n";
+#endif
+      return Badness(Quality(sq_bound/sq_radius));
+    }
+    else
+      return Badness();
+  }
+  
+private:
+  Sizing_field size_;
+  
+};  // end Variable_size_criterion
+  
+  
+  
+// Uniform size Criterion class
+template <typename Tr, typename Visitor_>
+class Uniform_size_criterion :
+  public Facet_size_criterion<Tr, Visitor_>
+{
+private:
+  typedef typename Tr::Facet Facet;
+  typedef typename Tr::Geom_traits::FT FT;
+
+  typedef Mesh_3::Abstract_criterion<Tr,Visitor_> Base;
+  typedef typename Base::Quality Quality;
+  typedef typename Base::Badness Badness;
+
+  typedef Uniform_size_criterion<Tr,Visitor_> Self;
+  
+public:
+  // Nb: the default bound of the criterion is such that the criterion
+  // is always fulfilled
+  Uniform_size_criterion(const FT b = 1e20) : B_(b * b) {}
+
+protected:
+  virtual void do_accept(Visitor_& v) const
+  {
+    v.visit(*this);
+  }
+
+  virtual Self* do_clone() const
+  {
+    // Call copy ctor on this
+    return new Self(*this);
+  }
+
+  virtual Badness do_is_bad (const Facet& f) const
+  {
+    CGAL_assertion (f.first->is_facet_on_surface(f.second));
+    CGAL_assertion (B_ != 0);
+
+    typedef typename Tr::Geom_traits Gt;
+    typedef typename Tr::Point Point_3;
+
+    typename Gt::Compute_squared_distance_3 distance =
+        Gt().compute_squared_distance_3_object();
+
+    const Point_3& p1 = f.first->vertex((f.second+1)&3)->point();
+
+    const FT sq_radius = distance(
+        p1, f.first->get_facet_surface_center(f.second));
+
+    if ( sq_radius > B_ )
+    {
+#ifdef CGAL_MESH_3_DEBUG_FACET_CRITERIA
+      std::cerr << "Bad facet (uniform size): sq_radius[" << sq_radius
+                << "] bound[" << B_ << "]\n";
+#endif
+      return Badness(Quality(B_/sq_radius));
+    }
+    else
+      return Badness();
+  }
+
+private:
+  FT B_;
+
+};  // end Uniform_size_criterion
+
+
+
+template <typename Tr, typename Visitor_>
+class Facet_on_surface_criterion :
+  public Mesh_3::Abstract_criterion<Tr, Visitor_>
+{
+private:
+  typedef typename Tr::Facet Facet;
+
+  typedef Mesh_3::Abstract_criterion<Tr,Visitor_> Base;
+  typedef typename Base::Quality Quality;
+  typedef typename Base::Badness Badness;
+
+  typedef Facet_on_surface_criterion<Tr,Visitor_> Self;
+
+public:
+  /// Constructor
+  Facet_on_surface_criterion() {}
+  /// Destructor
+  ~Facet_on_surface_criterion() {}
+
+protected:
+  virtual void do_accept(Visitor_& v) const
+  {
+    v.visit(*this);
+  }
+
+  virtual Self* do_clone() const
+  {
+    // Call copy ctor on this
+    return new Self(*this);
+  }
+
+  virtual Badness do_is_bad (const Facet& f) const
+  {
+    typedef typename Tr::Vertex_handle Vertex_handle;
+    typedef typename Tr::Cell_handle Cell_handle;
+
+    const Cell_handle& ch = f.first;
+    const int i = f.second;
+    const Vertex_handle& v1 = ch->vertex((i+1)&3);
+    const Vertex_handle& v2 = ch->vertex((i+2)&3);
+    const Vertex_handle& v3 = ch->vertex((i+3)&3);
+
+    // Look if vertex are on surface
+    if ( (v1->in_dimension() > 2) ||
+         (v2->in_dimension() > 2) ||
+         (v3->in_dimension() > 2) )
+    {
+#ifdef CGAL_MESH_3_DEBUG_FACET_CRITERIA
+      std::cerr << "Bad facet (on surface criterion)" << std::endl;
+#endif
+      return Badness(Quality(1));
+    }
+    else
+      return Badness();
+  }
+}; // end class Facet_on_surface_criterion
+
+  
+template <typename Tr, typename Visitor_>
+class Facet_on_same_surface_criterion :
+public Mesh_3::Abstract_criterion<Tr, Visitor_>
+{
+private:
+  typedef typename Tr::Facet Facet;
+  
+  typedef Mesh_3::Abstract_criterion<Tr,Visitor_> Base;
+  typedef typename Base::Quality Quality;
+  typedef typename Base::Badness Badness;
+  
+  typedef Facet_on_same_surface_criterion<Tr,Visitor_> Self;
+  
+public:
+  /// Constructor
+  Facet_on_same_surface_criterion() {}
+  /// Destructor
+  virtual ~Facet_on_same_surface_criterion() {}
+
+protected:
+  virtual void do_accept(Visitor_& v) const
+  {
+    v.visit(*this);
+  }
+  
+  virtual Self* do_clone() const
+  {
+    // Call copy ctor on this
+    return new Self(*this);
+  }
+  
+  virtual Badness do_is_bad (const Facet& f) const
+  {
+    typedef typename Tr::Vertex_handle  Vertex_handle;
+    typedef typename Tr::Cell_handle    Cell_handle;
+    typedef typename Tr::Vertex::Index  Index;
+    
+    const Cell_handle& ch = f.first;
+    const int& i = f.second;
+    
+    const Vertex_handle& v1 = ch->vertex((i+1)&3);
+    const Vertex_handle& v2 = ch->vertex((i+2)&3);
+    const Vertex_handle& v3 = ch->vertex((i+3)&3);
+    
+    Index index = Index();
+    bool is_index_initialized = false;
+    
+    if ( v1->in_dimension() == 2 )
+    { 
+      index = v1->index();
+      is_index_initialized = true;
+    }
+    
+    if ( v2->in_dimension() == 2 )
+    {
+      if ( is_index_initialized )
+      {
+        if ( !(v2->index() == index) )
+        {
+          return Badness(Quality(1));
+        }
+      }
+      else
+      {
+        index = v2->index();
+        is_index_initialized = true;        
+      }
+    }
+    
+    if ( v3->in_dimension() == 2 )
+    {
+      if ( is_index_initialized && !(v3->index() == index) )
+      {
+        return Badness(Quality(1));
+      } 
+    }
+    
+    return  Badness();			
+  }
+  
+}; // end class Facet_on_same_surface_criterion
+
+
+
+template <typename Tr>
+class Facet_criterion_visitor
+  : public Mesh_3::Criterion_visitor<Tr, typename Tr::Facet>
+{
+  typedef Mesh_3::Criterion_visitor<Tr, typename Tr::Facet> Base;
+  typedef Facet_criterion_visitor<Tr> Self;
+
+public:
+  typedef Mesh_3::Abstract_criterion<Tr, Self> Criterion;
+  typedef typename Base::Quality Facet_quality;
+  typedef typename Base::Badness Facet_badness;
+  typedef typename Base::Handle Handle;
+  typedef Handle Facet;
+
+  // Constructor
+  Facet_criterion_visitor(const Facet& f)
+    : Base(f) {}
+
+  // Destructor
+  ~Facet_criterion_visitor() {}
+
+  void visit(const Criterion& criterion)
+  {
+    Base::do_visit(criterion);
+  }
+
+};  // end class Facet_criterion_visitor
+  
+  
+  
+template <typename Tr>
+class Facet_criterion_visitor_with_features
+  : public Mesh_3::Criterion_visitor<Tr, typename Tr::Facet>
+{
+  typedef Mesh_3::Criterion_visitor<Tr, typename Tr::Facet> Base;
+  typedef Facet_criterion_visitor_with_features<Tr> Self;
+  
+  typedef Mesh_3::Abstract_criterion<Tr, Self>                Criterion;
+  typedef Mesh_3::Curvature_size_criterion<Tr, Self>          Curvature_size_criterion;
+  typedef Mesh_3::Aspect_ratio_criterion<Tr, Self>            Aspect_ratio_criterion;
+  typedef Mesh_3::Facet_on_surface_criterion<Tr, Self>        Facet_on_surface_criterion;
+  typedef Mesh_3::Facet_size_criterion<Tr, Self>              Facet_size_criterion;
+  typedef Mesh_3::Facet_on_same_surface_criterion<Tr, Self>   Facet_on_same_surface_criterion;
+
+  typedef typename Tr::Geom_traits  Gt;
+  typedef typename Gt::FT           FT;
+
+public:  
+  typedef typename Base::Quality  Facet_quality;
+  typedef typename Base::Badness  Facet_badness;
+  typedef typename Base::Handle   Handle;
+  typedef Handle                  Facet;
+  
+  // Constructor
+  Facet_criterion_visitor_with_features(const Facet& fh)
+    : Base(fh)
+    , wp_nb_(0)
+    , do_spheres_intersect_(false)
+    , ratio_(0.)
+    , approx_ratio_(0.1*0.1*4.)
+    , angle_ratio_(0.5*0.5*4.)
+    , size_ratio_(0.4*0.4*4.)
+  {
+    typedef typename Tr::Point        Point_3;
+    typedef typename Tr::Cell_handle  Cell_handle;
+    
+    typename Gt::Compare_weighted_squared_radius_3 compare =
+      Gt().compare_weighted_squared_radius_3_object();
+    
+    typename Gt::Compute_squared_radius_smallest_orthogonal_sphere_3 sq_radius =
+      Gt().compute_squared_radius_smallest_orthogonal_sphere_3_object();
+
+    const Cell_handle& c = fh.first;
+    const int& k = fh.second;
+    
+    int k1 = (k+1)&3;
+    int k2 = (k+2)&3;
+    int k3 = (k+3)&3;
+    
+    // Get number of weighted points, and ensure that they will be accessible
+    // using k1...ki, if i is the number of weighted points.
+    if(c->vertex(k1)->point().weight() > FT(0))
+    { 
+      ++wp_nb_;
+    }
+    
+    if(c->vertex(k2)->point().weight() > FT(0))
+    { 
+      if ( 0 == wp_nb_ ) { std::swap(k1,k2); }
+      ++wp_nb_;
+    }
+    
+    if(c->vertex(k3)->point().weight() > FT(0))
+    { 
+      if ( 0 == wp_nb_ ) { std::swap(k1,k3); }
+      if ( 1 == wp_nb_ ) { std::swap(k2,k3); }
+      ++wp_nb_;
+    }
+    
+    const Point_3& p1 = c->vertex(k1)->point();
+    const Point_3& p2 = c->vertex(k2)->point();
+    const Point_3& p3 = c->vertex(k3)->point();
+    
+    // Compute ratio
+    switch ( wp_nb_ )
+    {
+      case 1:
+      {
+        FT r = (std::max)(sq_radius(p1,p2),sq_radius(p1,p3));
+        ratio_ = r / p1.weight();
+        break;
+      }
+        
+      case 2:
+      {
+        FT r13 = sq_radius(p1,p3) / p1.weight();
+        FT r23 = sq_radius(p2,p3) / p2.weight();
+        ratio_ = (std::max)(r13, r23);
+        
+        do_spheres_intersect_ = (compare(p1,p2,FT(0)) != CGAL::LARGER);
+        break;
+      }
+
+      case 3:
+      {
+        do_spheres_intersect_ = (compare(p1,p2,p3,FT(0)) != CGAL::LARGER);
+        break;
+      }  
+      
+      default: break;
+    }
+  }
+  
+  // Destructor
+  ~Facet_criterion_visitor_with_features() {}
+
+  // visit functions
+  void visit(const Criterion& criterion)
+  {
+    if ( 3 == wp_nb_ && do_spheres_intersect_ )
+    { 
+      Base::increment_counter();
+      return;
+    }
+    
+    Base::do_visit(criterion);
+  }
+  
+  void visit(const Curvature_size_criterion& criterion)
+  {
+    if (   ratio_ < approx_ratio_
+        && (do_spheres_intersect_ || 1 == wp_nb_ ) )
+    {
+      Base::increment_counter();
+      return;
+    }
+    
+    Base::do_visit(criterion);
+  }
+  
+  void visit(const Aspect_ratio_criterion& criterion)
+  {
+    if (   ratio_ < angle_ratio_
+        && (do_spheres_intersect_ || 1 == wp_nb_) )
+    {
+      Base::increment_counter();
+      return;
+    }
+    
+    Base::do_visit(criterion);
+  }
+  
+  void visit(const Facet_size_criterion& criterion)
+  {
+    if (   ratio_ < size_ratio_
+        && (do_spheres_intersect_ || 1 == wp_nb_) )
+    {
+      Base::increment_counter();
+      return;
+    }
+    
+    Base::do_visit(criterion);
+  }
+  
+private:
+  int wp_nb_;
+  bool do_spheres_intersect_;
+  FT ratio_;
+  FT approx_ratio_;
+  FT angle_ratio_;
+  FT size_ratio_;
+  
+};  // end class Facet_criterion_visitor
+  
+
+}  // end namespace Mesh_3
+
+}  // end namespace CGAL
+
+#endif // CGAL_MESH_3_MESH_STANDARD_FACET_CRITERIA_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/min_dihedral_angle.h b/3rdparty/CGAL/include/CGAL/Mesh_3/min_dihedral_angle.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/min_dihedral_angle.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/min_dihedral_angle.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/parameters_defaults.h b/3rdparty/CGAL/include/CGAL/Mesh_3/parameters_defaults.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/parameters_defaults.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/parameters_defaults.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/polyhedral_to_labeled_function_wrapper.h b/3rdparty/CGAL/include/CGAL/Mesh_3/polyhedral_to_labeled_function_wrapper.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/polyhedral_to_labeled_function_wrapper.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/polyhedral_to_labeled_function_wrapper.h
diff --git a/3rdparty/CGAL/include/CGAL/Mesh_3/polylines_to_protect.h b/3rdparty/CGAL/include/CGAL/Mesh_3/polylines_to_protect.h
new file mode 100644
index 0000000..ca83aaf
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Mesh_3/polylines_to_protect.h
@@ -0,0 +1,608 @@
+// Copyright (c) 2015,2016 GeometryFactory
+// 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
+// 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(s)     : Laurent Rineau
+
+#ifndef CGAL_MESH_3_POLYLINES_TO_PROTECT_H
+#define CGAL_MESH_3_POLYLINES_TO_PROTECT_H
+
+#include <vector>
+#include <map>
+#include <utility> // std::swap
+#include <CGAL/tuple.h>
+#include <CGAL/Image_3.h>
+#include <CGAL/boost/graph/split_graph_into_polylines.h>
+#include <CGAL/internal/Mesh_3/Graph_manipulations.h>
+#include <boost/graph/adjacency_list.hpp>
+#include <CGAL/Labeled_image_mesh_domain_3.h> // for
+                                              // CGAL::Null_subdomain_index
+#include <boost/utility.hpp> // for boost::prior
+#include <boost/foreach.hpp>
+
+#include <CGAL/Search_traits_3.h>
+#include <CGAL/Orthogonal_incremental_neighbor_search.h>
+
+namespace CGAL {
+
+namespace Mesh_3{
+template<typename P, typename G>
+struct Polyline_visitor
+{
+  std::vector<std::vector<P> >& polylines;
+  G& graph;
+  Polyline_visitor(typename std::vector<std::vector<P> >& lines, G& p_graph)
+    : polylines(lines), graph(p_graph)
+  {}
+
+  void start_new_polyline()
+  {
+    std::vector<P> V;
+    polylines.push_back(V);
+  }
+
+  void add_node(typename boost::graph_traits<G>::vertex_descriptor vd)
+  {
+    std::vector<P>& polyline = polylines.back();
+    polyline.push_back(graph[vd]);
+  }
+
+  void end_polyline()
+  {
+    // ignore degenerated polylines
+    if(polylines.back().size() < 2)
+      polylines.resize(polylines.size() - 1);
+  }
+};
+}//namespace Mesh_3
+
+// this function is overloaded for when `PolylineInputIterator` is `int`.
+template <typename K,
+          typename Graph,
+          typename PolylineInputIterator>
+void snap_graph_vertices(Graph& graph,
+                         const double vx, const double vy, const double vz,
+                         PolylineInputIterator existing_polylines_begin,
+                         PolylineInputIterator existing_polylines_end,
+                         K)
+{
+  const double dist_bound = (std::min)(vx,
+                                       (std::min)(vy, vz)) / 256;
+  const double sq_dist_bound = dist_bound * dist_bound;
+
+  typedef CGAL::Search_traits_3<K> Tree_traits;
+  typedef CGAL::Orthogonal_incremental_neighbor_search<Tree_traits> NN_search;
+  typedef typename NN_search::Tree Tree;
+
+  Tree tree;
+  // insert the extremities of the polylines in the kd-tree
+  for(PolylineInputIterator poly_it = existing_polylines_begin;
+      poly_it != existing_polylines_end; ++poly_it)
+  {
+    if(poly_it->begin() != poly_it->end()) {
+      tree.insert(*poly_it->begin());
+      if(boost::next(poly_it->begin()) != poly_it->end()) {
+        tree.insert(*boost::prior(poly_it->end()));
+      }
+    }
+  }
+  if(tree.size() == 0) return;
+
+  BOOST_FOREACH(typename boost::graph_traits<Graph>::vertex_descriptor v,
+                vertices(graph))
+  {
+    const typename K::Point_3 p = graph[v];
+    NN_search nn(tree, p);
+    CGAL_assertion(nn.begin() != nn.end());
+    if(squared_distance(nn.begin()->first, p) < sq_dist_bound) {
+      graph[v] = nn.begin()->first;
+    }
+  }
+}
+
+template <typename K,
+          typename Graph>
+void snap_graph_vertices(Graph&, double, double, double, int, int, K)
+{}
+
+template <typename P,
+          typename Image_word_type,
+          typename Null_subdomain_index,
+          typename PolylineInputIterator>
+void
+polylines_to_protect(const CGAL::Image_3& cgal_image,
+                     const double vx, const double vy, const double vz,
+                     std::vector<std::vector<P> >& polylines,
+                     Image_word_type*,
+                     Null_subdomain_index null,
+                     PolylineInputIterator existing_polylines_begin,
+                     PolylineInputIterator existing_polylines_end)
+{
+  typedef typename Kernel_traits<P>::Kernel K;
+  typedef P Point_3;
+  typedef boost::adjacency_list<boost::setS, boost::setS, boost::undirectedS, Point_3> Graph;
+  typedef typename boost::graph_traits<Graph>::vertex_descriptor vertex_descriptor;
+  // typedef typename boost::graph_traits<Graph>::edge_iterator edge_iterator;
+
+  const int xdim = static_cast<int>(cgal_image.xdim());
+  const int ydim = static_cast<int>(cgal_image.ydim());
+  const int zdim = static_cast<int>(cgal_image.zdim());
+
+  const int image_dims[3] = { xdim, ydim, zdim };
+
+  Graph graph;
+  internal::Mesh_3::Graph_manipulations<Graph, Point_3> g_manip(graph);
+
+  std::size_t
+    case4 = 0, // 4 colors
+    case211 = 0, case121 = 0, // 3 colors
+    case31 = 0, case22 = 0, // 2 colors
+    case1 = 0; // 1 color
+
+  for(int axis = 0; axis < 3; ++axis)
+  {
+    for(int i = 0; i < xdim; i+= (axis == 0 ? (xdim-1) : 1 ) )
+      for(int j = 0; j < ydim; j+= (axis == 1 ? (ydim-1) : 1 ) )
+        for(int k = 0; k < zdim; k+= (axis == 2 ? (zdim-1) : 1 ) )
+        {
+
+          using CGAL::cpp11::array;
+          using CGAL::cpp11::tuple;
+          using CGAL::cpp11::get;
+
+          typedef array<int, 3> Pixel;
+
+          Pixel pix00 = {{i  , j  , k  }},
+            pix10 = pix00, pix01 = pix00, pix11 = pix00;
+
+          const int axis_xx = (axis + 1) % 3;
+          const int axis_yy = (axis + 2) % 3;
+
+          ++pix10[axis_xx];
+          ++pix11[axis_xx]; ++pix11[axis_yy];
+          ++pix01[axis_yy];
+          if(pix11[0] >= xdim || pix11[1] >= ydim || pix11[2] >= zdim) {
+            // we have gone too far
+            continue;
+          }
+          typedef tuple<Pixel, Point_3, Image_word_type> Enriched_pixel;
+
+          array<array<Enriched_pixel, 2>, 2> square =
+            {{ {{ Enriched_pixel(pix00, Point_3(), Image_word_type()),
+                  Enriched_pixel(pix01, Point_3(), Image_word_type()) }},
+               {{ Enriched_pixel(pix10, Point_3(), Image_word_type()),
+                  Enriched_pixel(pix11, Point_3(), Image_word_type()) }} }};
+
+          std::map<Image_word_type, int> pixel_values_set;
+          for(int ii = 0; ii < 2; ++ii)
+            for(int jj = 0; jj < 2; ++jj)
+            {
+              const Pixel& pixel = get<0>(square[ii][jj]);
+              double x = pixel[0] * vx;
+              double y = pixel[1] * vy;
+              double z = pixel[2] * vz;
+              get<1>(square[ii][jj]) = Point_3(x, y, z);
+              get<2>(square[ii][jj]) = static_cast<Image_word_type>(cgal_image.value(pixel[0],
+                                                                                     pixel[1],
+                                                                                     pixel[2]));
+              ++pixel_values_set[get<2>(square[ii][jj])];
+            }
+          const Point_3& p00 = get<1>(square[0][0]);
+          const Point_3& p10 = get<1>(square[1][0]);
+          const Point_3& p01 = get<1>(square[0][1]);
+          const Point_3& p11 = get<1>(square[1][1]);
+
+          bool out00 = null(get<2>(square[0][0]));
+          bool out10 = null(get<2>(square[1][0]));
+          bool out01 = null(get<2>(square[0][1]));
+          bool out11 = null(get<2>(square[1][1]));
+
+          //
+          // Protect the edges of the cube
+          //
+          if(pix00[axis_xx] == 0 &&
+             ! ( out00 && out01 ) )
+          {
+            g_manip.try_add_edge(g_manip.get_vertex(p00),
+                                 g_manip.get_vertex(p01));
+          }
+          if(pix11[axis_xx] == image_dims[axis_xx]-1 &&
+             ! ( out10 && out11 ) )
+          {
+            g_manip.try_add_edge(g_manip.get_vertex(p10),
+                                 g_manip.get_vertex(p11));
+          }
+          if(pix00[axis_yy] == 0 &&
+             ! ( out00 && out10 ) )
+          {
+            g_manip.try_add_edge(g_manip.get_vertex(p00),
+                                 g_manip.get_vertex(p10));
+          }
+          if(pix11[axis_yy] == image_dims[axis_yy]-1 &&
+             ! ( out01 && out11 ) )
+          {
+            g_manip.try_add_edge(g_manip.get_vertex(p01),
+                                 g_manip.get_vertex(p11));
+          }
+
+          //
+          // Protect lines inside the square
+          //
+          switch(pixel_values_set.size()) {
+          case 4: {
+            CGAL_assertion(get<2>(square[0][0]) != get<2>(square[0][1]));
+            CGAL_assertion(get<2>(square[0][0]) != get<2>(square[1][0]));
+            CGAL_assertion(get<2>(square[0][0]) != get<2>(square[1][1]));
+            CGAL_assertion(get<2>(square[1][0]) != get<2>(square[1][1]));
+            CGAL_assertion(get<2>(square[0][1]) != get<2>(square[1][1]));
+            CGAL_assertion(get<2>(square[0][1]) != get<2>(square[1][0]));
+case_4:
+            // case 4 or case 2-2
+            ++case4;
+            vertex_descriptor left   = g_manip.split(p00, p01, out00, out01);
+            vertex_descriptor right  = g_manip.split(p10, p11, out10, out11);
+            vertex_descriptor top    = g_manip.split(p01, p11, out01, out11);
+            vertex_descriptor bottom = g_manip.split(p00, p10, out00, out10);
+            vertex_descriptor vmid   = g_manip.get_vertex(midpoint(p00, p11));
+            g_manip.try_add_edge(left   , vmid);
+            g_manip.try_add_edge(right  , vmid);
+            g_manip.try_add_edge(top    , vmid);
+            g_manip.try_add_edge(bottom , vmid);
+          }
+            break;
+          case 3: {
+            if(get<2>(square[0][0]) == get<2>(square[1][1])) {
+              // Diagonal, but the wrong one.
+              // Vertical swap
+              std::swap(square[0][1], square[0][0]); std::swap(out01, out00);
+              std::swap(square[1][1], square[1][0]); std::swap(out11, out10);
+            }
+            if(get<2>(square[0][1]) == get<2>(square[1][0])) {
+              // diagonal case 1-2-1
+              CGAL_assertion(get<2>(square[0][1]) == get<2>(square[1][0]));
+              CGAL_assertion(get<2>(square[1][1]) != get<2>(square[0][0]));
+              CGAL_assertion(get<2>(square[0][1]) != get<2>(square[0][0]));
+              CGAL_assertion(get<2>(square[0][1]) != get<2>(square[1][1]));
+              ++case121;
+              vertex_descriptor left   = g_manip.split(p00, p01, out00, out01);
+              vertex_descriptor right  = g_manip.split(p10, p11, out10, out11);
+              vertex_descriptor top    = g_manip.split(p01, p11, out01, out11);
+              vertex_descriptor bottom = g_manip.split(p00, p10, out00, out10);
+
+              vertex_descriptor old_left = left;
+              vertex_descriptor old_right = right;
+              vertex_descriptor v_int_left, v_int_right;
+
+              // approximate the arcs by 10 segments
+              //   -> 9 intermediate vertices
+              for(double x = 0.05; x < 0.5; x+= 0.05)
+              {
+                const Point_3 inter_left =
+                  p00
+                  +      x                * (p10 - p00)  // x
+                  + ((1.-2.*x)/(2.-3.*x)) * (p01 - p00); // y
+                const Point_3 inter_right =
+                  p11
+                  +      x                * (p01 - p11)  // x
+                  + ((1.-2.*x)/(2.-3.*x)) * (p10 - p11); // y
+                v_int_left  = g_manip.get_vertex(inter_left);
+                v_int_right = g_manip.get_vertex(inter_right);
+                g_manip.try_add_edge(old_left,  v_int_left);
+                g_manip.try_add_edge(old_right, v_int_right);
+                old_left = v_int_left;
+                old_right = v_int_right;
+              }
+              g_manip.try_add_edge(v_int_left,  bottom);
+              g_manip.try_add_edge(v_int_right, top);
+            } else {
+              // case 2-1-1
+              if(get<2>(square[0][0]) == get<2>(square[1][0])) {
+                // Diagonal swap
+                std::swap(square[0][1], square[1][0]); std::swap(out01, out10);
+              } else
+              if(get<2>(square[0][1]) == get<2>(square[1][1])) {
+                // The other diagonal swap
+                std::swap(square[0][0], square[1][1]); std::swap(out00, out11);
+              } else
+              if(get<2>(square[1][0]) == get<2>(square[1][1])) {
+                // Vertical swap
+                std::swap(square[0][0], square[1][0]); std::swap(out00, out10);
+                std::swap(square[0][1], square[1][1]); std::swap(out01, out11);
+              }
+              CGAL_assertion(get<2>(square[0][0]) == get<2>(square[0][1]));
+              CGAL_assertion(get<2>(square[0][0]) != get<2>(square[1][0]));
+              CGAL_assertion(get<2>(square[0][0]) != get<2>(square[1][1]));
+              CGAL_assertion(get<2>(square[1][0]) != get<2>(square[1][1]));
+              ++case211;
+              Point_3 midleft =  midpoint(p00, p01);
+              Point_3 midright = midpoint(p10, p11);
+              Point_3 inter = midleft + (2./3)*(midright-midleft);
+              vertex_descriptor v_inter = g_manip.get_vertex(inter);
+              vertex_descriptor right  = g_manip.split(p10, p11, out10, out11);
+              vertex_descriptor top    = g_manip.split(p01, p11, out01, out11);
+              vertex_descriptor bottom = g_manip.split(p00, p10, out00, out10);
+
+              vertex_descriptor old_top = top;
+              vertex_descriptor old_bottom = bottom;
+              vertex_descriptor v_int_top, v_int_bottom;
+
+              // approximate the arcs by 10 segments
+              //   -> 9 intermediate vertices
+              for(double x = 0.51666; x < 0.66; x+= 0.016666)
+              {
+                const Point_3 inter_top =
+                  p00
+                  +      x         * (p10 - p00)  // x
+                  + ((1./x) - 1.)  * (p01 - p00); // y
+                const Point_3 inter_bottom =
+                  p00
+                  +      x         * (p10 - p00)  // x
+                  + (2.-(1./x))    * (p01 - p00); // y
+                v_int_top    = g_manip.get_vertex(inter_top);
+                v_int_bottom = g_manip.get_vertex(inter_bottom);
+                g_manip.try_add_edge(old_top,    v_int_top);
+                g_manip.try_add_edge(old_bottom, v_int_bottom);
+                old_top = v_int_top;
+                old_bottom = v_int_bottom;
+              }
+
+              g_manip.try_add_edge(v_int_bottom,    v_inter);
+              g_manip.try_add_edge(v_int_top, v_inter);
+              g_manip.try_add_edge(right,  v_inter);
+            } // end case 2-1-1
+          } // end `case 3:`
+            break;
+          case 2: {
+            if(pixel_values_set.begin()->second ==
+               pixel_values_set.rbegin()->second)
+            {
+              // Case of two colors with two pixels each.
+
+              if(get<2>(square[0][0])==get<2>(square[1][0])) {
+                // case 2-2, diagonal swap
+                std::swap(square[0][1], square[1][0]); std::swap(out01, out10);
+                CGAL_assertion(get<2>(square[0][0])==get<2>(square[0][1]));
+              }
+              if(get<2>(square[1][0])==get<2>(square[1][1])) {
+                // case 2-2, vertical swap
+                std::swap(square[0][1], square[1][1]); std::swap(out01, out11);
+                std::swap(square[0][0], square[1][0]); std::swap(out00, out10);
+                CGAL_assertion(get<2>(square[0][0])==get<2>(square[0][1]));
+              }
+              if(get<2>(square[0][1])==get<2>(square[1][1])) {
+                // case 2-2, diagonal swap
+                std::swap(square[0][0], square[1][1]); std::swap(out00, out11);
+                CGAL_assertion(get<2>(square[0][0])==get<2>(square[0][1]));
+              }
+
+              if(get<2>(square[0][0])==get<2>(square[0][1])) {
+                // vertical case 2-2
+                ++case22;
+                CGAL_assertion(get<2>(square[1][0])==get<2>(square[1][1]));
+                CGAL_assertion(get<2>(square[1][0])!=get<2>(square[0][1]));
+                vertex_descriptor top    = g_manip.split(p01, p11, out01, out11);
+                vertex_descriptor bottom = g_manip.split(p00, p10, out00, out10);
+                g_manip.try_add_edge(top, bottom);
+              } else {
+                // Else diagonal case case 2-2
+                // Same as the case with 4 colors
+                CGAL_assertion(get<2>(square[0][0])==get<2>(square[1][1]));
+                CGAL_assertion(get<2>(square[1][0])==get<2>(square[0][1]));
+                CGAL_assertion(get<2>(square[0][0])!=get<2>(square[0][1]));
+                goto case_4;
+              }
+            }
+            else {
+              // case of two colors with one pixel green and three red
+              Image_word_type value_alone;
+              if(pixel_values_set.begin()->second == 1) {
+                value_alone = pixel_values_set.begin()->first;
+              } else {
+                CGAL_assertion(pixel_values_set.begin()->second == 3);
+                CGAL_assertion(pixel_values_set.rbegin()->second ==1);
+                value_alone = pixel_values_set.rbegin()->first;
+              }
+              if(get<2>(square[0][1]) == value_alone) {
+                // central symmetry
+                std::swap(square[0][1], square[1][0]); std::swap(out01, out10);
+                std::swap(square[0][0], square[1][1]); std::swap(out00, out11);
+                CGAL_assertion(get<2>(square[1][0]) == value_alone);
+              }
+              if(get<2>(square[1][1]) == value_alone) {
+                // vertical swap
+                std::swap(square[0][0], square[0][1]); std::swap(out00, out01);
+                std::swap(square[1][0], square[1][1]); std::swap(out10, out11);
+                CGAL_assertion(get<2>(square[1][0]) == value_alone);
+              }
+              if(get<2>(square[0][0]) == value_alone) {
+                // horizontal swap
+                std::swap(square[0][1], square[1][1]); std::swap(out01, out11);
+                std::swap(square[0][0], square[1][0]); std::swap(out00, out10);
+                CGAL_assertion(get<2>(square[1][0]) == value_alone);
+              }
+              ++case31;
+              CGAL_assertion(get<2>(square[1][0]) == value_alone);
+              CGAL_assertion(get<2>(square[1][0]) != get<2>(square[0][0]));
+              CGAL_assertion(get<2>(square[1][1]) == get<2>(square[0][0]));
+              CGAL_assertion(get<2>(square[0][1]) == get<2>(square[0][0]));
+              vertex_descriptor bottom = g_manip.split(p00, p10, out00, out10);
+              vertex_descriptor old = bottom;
+
+              vertex_descriptor v_int;
+              for(double x = 0.55; x < 1.; x+= 0.05)
+              {
+                const Point_3 inter =
+                  p00
+                  +      x         * (p10 - p00)  // x
+                  + (1.-1./(2.*x)) * (p01 - p00); // y
+                v_int = g_manip.get_vertex(inter);
+                g_manip.try_add_edge(old, v_int);
+                old = v_int;
+              }
+
+              vertex_descriptor right  = g_manip.split(p10, p11, out10, out11);
+              g_manip.try_add_edge(v_int, right);
+            }
+          }
+            break;
+          default: // case 1
+            ++case1;
+            // nothing to do
+            break;
+          }
+        }
+  }
+  // std::cerr << "case 4:     " << case4 << std::endl;
+  // std::cerr << "case 2-1-1: " << case211 << std::endl;
+  // std::cerr << "case 1-2-1: " << case121 << std::endl;
+  // std::cerr << "case 3-1:   " << case31 << std::endl;
+  // std::cerr << "case 2-2:   " << case22 << std::endl;
+  // std::cerr << "case 1:     " << case1 << std::endl;
+
+  const std::ptrdiff_t nb_facets =
+    case4 + case211 + case121 + case31 + case22 + case1;
+  const std::ptrdiff_t expected_nb_facets =
+    2*((xdim-1)*(ydim-1) + (ydim-1)*(zdim-1) + (xdim-1)*(zdim-1));
+
+  // std::cerr << "nb of facets:           " << nb_facets << std::endl
+  //           << " expected nb of facets: " << expected_nb_facets << std::endl;
+
+  CGAL_assertion(nb_facets == expected_nb_facets);
+  CGAL_USE(nb_facets); CGAL_USE(expected_nb_facets);
+
+  snap_graph_vertices(graph,
+                      vx, vy, vz,
+                      existing_polylines_begin, existing_polylines_end,
+                      K());
+
+  Mesh_3::Polyline_visitor<Point_3, Graph> visitor(polylines, graph);
+  split_graph_into_polylines(graph, visitor);
+}
+
+template <typename P,
+          typename PolylineInputIterator>
+void
+polylines_to_protect(std::vector<std::vector<P> >& polylines,
+                     PolylineInputIterator existing_polylines_begin,
+                     PolylineInputIterator existing_polylines_end)
+{
+  typedef P Point_3;
+  typedef boost::adjacency_list<boost::setS, boost::setS, boost::undirectedS, Point_3> Graph;
+  typedef typename boost::graph_traits<Graph>::vertex_descriptor vertex_descriptor;
+  typedef typename std::iterator_traits<PolylineInputIterator>::value_type Polyline;
+
+  Graph graph;
+  internal::Mesh_3::Graph_manipulations<Graph, Point_3> g_manip(graph);
+
+  for (PolylineInputIterator poly_it = existing_polylines_begin;
+       poly_it != existing_polylines_end; ++poly_it)
+  {
+    Polyline polyline = *poly_it;
+    if (polyline.size() < 2)
+      continue;
+
+    typename Polyline::iterator pit = polyline.begin();
+    while (boost::next(pit) != polyline.end())
+    {
+      vertex_descriptor v = g_manip.get_vertex(*pit);
+      vertex_descriptor w = g_manip.get_vertex(*boost::next(pit));
+      g_manip.try_add_edge(v, w);
+      ++pit;
+    }
+  }
+
+  Mesh_3::Polyline_visitor<Point_3, Graph> visitor(polylines, graph);
+  split_graph_into_polylines(graph, visitor);
+}
+
+template <typename P, typename Image_word_type, typename Null_subdomain_index>
+void
+polylines_to_protect(const CGAL::Image_3& cgal_image,
+                     std::vector<std::vector<P> >& polylines,
+                     Image_word_type* word_type,
+                     Null_subdomain_index null)
+{
+  polylines_to_protect<P>
+    (cgal_image,
+     cgal_image.vx(), cgal_image.vy(),cgal_image.vz(),
+     polylines,
+     word_type,
+     null,
+     0,
+     0);
+}
+
+template <typename P, typename Image_word_type>
+void
+polylines_to_protect(const CGAL::Image_3& cgal_image,
+                     std::vector<std::vector<P> >& polylines)
+{
+  polylines_to_protect<P>
+    (cgal_image,
+     cgal_image.vx(), cgal_image.vy(),cgal_image.vz(),
+     polylines,
+     (Image_word_type*)0,
+     CGAL::Null_subdomain_index(),
+     0,
+     0);
+}
+
+
+template <typename P,
+          typename Image_word_type,
+          typename PolylineInputIterator>
+void
+polylines_to_protect(const CGAL::Image_3& cgal_image,
+                     std::vector<std::vector<P> >& polylines,
+                     PolylineInputIterator existing_polylines_begin,
+                     PolylineInputIterator existing_polylines_end)
+{
+  polylines_to_protect<P>
+    (cgal_image,
+     cgal_image.vx(), cgal_image.vy(),cgal_image.vz(),
+     polylines,
+     (Image_word_type*)0,
+     CGAL::Null_subdomain_index(),
+     existing_polylines_begin,
+     existing_polylines_end);
+}
+
+template <typename P,
+          typename Image_word_type,
+          typename Null_subdomain_index,
+          typename PolylineInputIterator>
+void
+polylines_to_protect(const CGAL::Image_3& cgal_image,
+                     std::vector<std::vector<P> >& polylines,
+                     Image_word_type* word_type,
+                     Null_subdomain_index null,
+                     PolylineInputIterator existing_polylines_begin,
+                     PolylineInputIterator existing_polylines_end)
+{
+  polylines_to_protect<P>
+    (cgal_image,
+     cgal_image.vx(), cgal_image.vy(),cgal_image.vz(),
+     polylines,
+     word_type,
+     null,
+     existing_polylines_begin,
+     existing_polylines_end);
+}
+
+} // namespace CGAL
+
+#endif // CGAL_MESH_3_POLYLINES_TO_PROTECT_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/radius_ratio.h b/3rdparty/CGAL/include/CGAL/Mesh_3/radius_ratio.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/radius_ratio.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/radius_ratio.h
diff --git a/3rdparty/CGAL/include/CGAL/Mesh_3/search_for_connected_components_in_labeled_image.h b/3rdparty/CGAL/include/CGAL/Mesh_3/search_for_connected_components_in_labeled_image.h
new file mode 100644
index 0000000..205d0e8
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Mesh_3/search_for_connected_components_in_labeled_image.h
@@ -0,0 +1,249 @@
+// Copyright (c) 2015,2016 GeometryFactory
+// 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
+// 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(s)     : Laurent Rineau
+
+#ifndef CGAL_MESH_3_SEARCH_FOR_CONNECTED_COMPONENTS_IN_LABELED_IMAGE_H
+#define CGAL_MESH_3_SEARCH_FOR_CONNECTED_COMPONENTS_IN_LABELED_IMAGE_H
+
+#include <CGAL/Image_3.h>
+#include <cstdlib>
+#include <vector>
+#include <queue>
+#include <utility>
+#include <algorithm>
+#include <boost/container/deque.hpp>
+#include <boost/multi_array.hpp>
+#include <boost/tuple/tuple.hpp>
+#include <boost/tuple/tuple_comparison.hpp>
+#include <boost/cstdint.hpp>
+#ifdef CGAL_MESH_3_SEARCH_FOR_CONNECTED_COMPONENTS_IN_LABELED_IMAGE_VERBOSE
+#  include <iostream>
+#  include <boost/format.hpp>
+#endif // CGAL_MESH_3_SEARCH_FOR_CONNECTED_COMPONENTS_IN_LABELED_IMAGE_VERBOSE
+template <typename PointsOutputIterator,
+	  typename DomainsOutputIterator,
+	  typename TransformOperator,
+          typename Construct_point,
+          typename Image_word_type>
+void
+search_for_connected_components_in_labeled_image(const CGAL::Image_3& image,
+                                                 PointsOutputIterator it,
+                                                 DomainsOutputIterator dom_it,
+                                                 TransformOperator transform,
+                                                 Construct_point point,
+                                                 Image_word_type)
+{
+  const std::size_t nx = image.xdim();
+  const std::size_t ny = image.ydim();
+  const std::size_t nz = image.zdim();
+  const std::size_t size = nx * ny * nz;
+
+  typedef boost::uint16_t uint;
+
+  if(nx > 65535 || ny > 65535 || nz > 65535)
+  {
+    CGAL_error_msg("The dimensions of the image must be lower than 2^16");
+  }
+
+  typedef typename TransformOperator::result_type Label;
+
+  std::vector<bool> visited(size, false);
+  std::vector<bool> second_pass(size, false);
+  typedef boost::tuple<uint, uint, uint, uint> Indices;
+  typedef std::queue<Indices, boost::container::deque<Indices> > Indices_queue;
+  typedef std::vector<Indices>  Border_vector;
+
+#ifdef CGAL_MESH_3_SEARCH_FOR_CONNECTED_COMPONENTS_IN_LABELED_IMAGE_VERBOSE
+  int number_of_connected_components = 0;
+#endif // CGAL_MESH_3_SEARCH_FOR_CONNECTED_COMPONENTS_IN_LABELED_IMAGE_VERBOSE
+  std::size_t voxel_index = 0;
+  for(uint k=0; k<nz; k++)
+    for(uint j=0; j<ny; j++)
+      for(uint i=0; i<nx; i++)
+      {
+        using CGAL::IMAGEIO::static_evaluate;
+
+        if(visited[voxel_index] | second_pass[voxel_index]) {
+          ++voxel_index;
+          continue;
+        }
+        const Label current_label =
+          transform(static_evaluate<Image_word_type>(image.image(),
+                                                     voxel_index));
+	*dom_it++ = current_label;
+        if(current_label == Label()) {
+          visited[voxel_index] = true;
+          second_pass[voxel_index] = true;
+          ++voxel_index;
+          continue;
+        }
+
+#ifdef CGAL_MESH_3_SEARCH_FOR_CONNECTED_COMPONENTS_IN_LABELED_IMAGE_VERBOSE
+        // if we reach here, (i, j, k) is a new connected component
+        ++number_of_connected_components;
+        std::cerr << boost::format("Found new connected component (#%5%) "
+                                   "at voxel (%1%, %2%, %3%), value=%4%, volume id=%6%\n")
+          % i % j % k
+          % (long)static_evaluate<Image_word_type>(image.image(), i, j, k)
+          % number_of_connected_components
+          % (int)current_label;
+#endif // CGAL_MESH_3_SEARCH_FOR_CONNECTED_COMPONENTS_IN_LABELED_IMAGE_VERBOSE
+
+        int nb_voxels = 0;
+
+        Indices_queue queue;
+        Indices indices(i, j ,k, 0);
+        queue.push(indices);
+
+        Border_vector border;
+
+        /*
+         * First pass is a BFS to retrieve all the connected component, and
+         * its border.
+         * Second pass is a BFS initialized with all voxel of the border.
+         * The last voxel of that BFS is used as the seed.
+         */
+        int pass = 1; // pass will be equal to 2 in second pass
+
+        Indices bbox_min = indices;
+        Indices bbox_max = indices;
+
+        while(!queue.empty()) // walk through the connected component
+        {
+          Indices indices = queue.front();
+          queue.pop();
+
+          // warning: those indices i, j and k are local to the while loop
+          const uint i = boost::get<0>(indices);
+          const uint j = boost::get<1>(indices);
+          const uint k = boost::get<2>(indices);
+          const uint depth = boost::get<3>(indices);
+
+          const size_t offset = i + nx * (j + ny * k);
+          const int m = (visited[offset] ? 1 : 0) + (second_pass[offset] ? 2 : 0);
+          if(m < pass)
+          {
+            if(pass == 1 )
+            {
+              visited[offset] = true;
+              second_pass[offset] = false;
+              ++nb_voxels;
+              boost::get<0>(bbox_min) = (std::min)(i, boost::get<0>(bbox_min));
+              boost::get<0>(bbox_max) = (std::max)(i, boost::get<0>(bbox_max));
+              boost::get<1>(bbox_min) = (std::min)(j, boost::get<1>(bbox_min));
+              boost::get<1>(bbox_max) = (std::max)(j, boost::get<1>(bbox_max));
+              boost::get<2>(bbox_min) = (std::min)(k, boost::get<2>(bbox_min));
+              boost::get<2>(bbox_max) = (std::max)(k, boost::get<2>(bbox_max));
+            } else
+            {
+              CGAL_assertion(pass == 2);
+              visited[offset] = false;
+              second_pass[offset] = true;
+            }
+
+            static const int neighbors_offset[6][3] = { { +1,  0,  0 },
+                                                        { -1,  0,  0 },
+                                                        {  0, +1,  0 },
+                                                        {  0, -1,  0 },
+                                                        {  0,  0, +1 },
+                                                        {  0,  0, -1 } };
+            bool voxel_is_on_border = false;
+
+            // Visit neighbors.
+            // (i_n, j_n, k_n) are indices of neighbors.
+            for(int n = 0; n < 6; ++n)
+            {
+              const ptrdiff_t i_n = i + neighbors_offset[n][0];
+              const ptrdiff_t j_n = j + neighbors_offset[n][1];
+              const ptrdiff_t k_n = k + neighbors_offset[n][2];
+              if(i_n < 0 || i_n >= static_cast<ptrdiff_t>(nx) ||
+                 j_n < 0 || j_n >= static_cast<ptrdiff_t>(ny) ||
+                 k_n < 0 || k_n >= static_cast<ptrdiff_t>(nz))
+              {
+                voxel_is_on_border = true;
+                continue;
+              }
+              else
+              {
+                const std::size_t offset_n = i_n + nx * (j_n + k_n * ny);
+                if(transform(static_evaluate<Image_word_type>(image.image(),
+                                                              offset_n))
+                   == current_label)
+                {
+                  const int m_n = (visited[offset_n] ? 1 : 0) +
+                    (second_pass[offset_n] ? 2 : 0);
+                  if(m_n < pass) {
+                    Indices indices(uint(i_n), uint(j_n), uint(k_n), uint(depth+1));
+                    queue.push(indices);
+                  }
+                }
+                else
+                  voxel_is_on_border = true;
+              }
+            } // end for neighbors
+
+            if(pass == 1 && voxel_is_on_border)
+              border.push_back(indices);
+          } // end if voxel not already visited
+
+          if(queue.empty()) {
+            if(pass == 1)
+            { // End of first pass. Begin second pass with the voxels of
+              // the border.
+              for(typename Border_vector::const_iterator
+                    border_it = border.begin(), border_end = border.end();
+                  border_it != border_end; ++border_it)
+                queue.push(*border_it);
+              pass = 2;
+            }
+            else // end of second pass, return the last visited voxel
+            {
+// 	      if(nb_voxels >= 100)
+	      {
+		*it++ = std::make_pair(point(i, j, k),
+                                       depth+1);
+#if CGAL_MESH_3_SEARCH_FOR_CONNECTED_COMPONENTS_IN_LABELED_IMAGE_VERBOSE > 1
+		std::cerr << boost::format("Found seed %5%, which is voxel "
+                                           "(%1%, %2%, %3%), value=%4%\n")
+		  % i % j % k
+                  % (long)static_evaluate<Image_word_type>(image.image(), i, j, k)
+                  % point(i, j, k);
+#endif // CGAL_MESH_3_SEARCH_FOR_CONNECTED_COMPONENTS_IN_LABELED_IMAGE_VERBOSE>1
+	      }
+            }
+          } // end if queue.empty()
+        } // end while !queue.empty() (with local indices i, j, k)
+#ifdef CGAL_MESH_3_SEARCH_FOR_CONNECTED_COMPONENTS_IN_LABELED_IMAGE_VERBOSE
+        std::cerr
+          << boost::format("There was %1% voxel(s) in that component.\n"
+                           "The bounding box is (%2% %3% %4%, %5% %6% %7%).\n"
+                           "%8% voxel(s) on border\n")
+          % nb_voxels
+          % boost::get<0>(bbox_min) % boost::get<1>(bbox_min)
+          % boost::get<2>(bbox_min)
+          % boost::get<0>(bbox_max) % boost::get<1>(bbox_max)
+          % boost::get<2>(bbox_max)
+          % border.size();
+#endif // CGAL_MESH_3_SEARCH_FOR_CONNECTED_COMPONENTS_IN_LABELED_IMAGE_VERBOSE
+
+        ++voxel_index;
+      } // end for i,j,k
+} // end function search_for_connected_components_in_labeled_image()
+
+#endif // CGAL_MESH_3_SEARCH_FOR_CONNECTED_COMPONENTS_IN_LABELED_IMAGE_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/sliver_criteria.h b/3rdparty/CGAL/include/CGAL/Mesh_3/sliver_criteria.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/sliver_criteria.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/sliver_criteria.h
diff --git a/3rdparty/CGAL/include/CGAL/Mesh_3/squared_distance_Point_3_Triangle_3.h b/3rdparty/CGAL/include/CGAL/Mesh_3/squared_distance_Point_3_Triangle_3.h
new file mode 100644
index 0000000..8f494a5
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Mesh_3/squared_distance_Point_3_Triangle_3.h
@@ -0,0 +1,27 @@
+// Copyright (c) 2010,2012 GeometryFactory Sarl (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
+// 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(s)     : Laurent Rineau
+//
+
+#ifndef CGAL_SQUARED_DISTANCE_POINT_3_TRIANGLE_3_H
+#define CGAL_SQUARED_DISTANCE_POINT_3_TRIANGLE_3_H
+
+#include <CGAL/squared_distance_3_2.h>
+
+#endif // CGAL_SQUARED_DISTANCE_POINT_3_TRIANGLE_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/utilities.h b/3rdparty/CGAL/include/CGAL/Mesh_3/utilities.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/utilities.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/utilities.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_3/vertex_perturbation.h b/3rdparty/CGAL/include/CGAL/Mesh_3/vertex_perturbation.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_3/vertex_perturbation.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_3/vertex_perturbation.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_cell_base_3.h b/3rdparty/CGAL/include/CGAL/Mesh_cell_base_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_cell_base_3.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_cell_base_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_cell_criteria_3.h b/3rdparty/CGAL/include/CGAL/Mesh_cell_criteria_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_cell_criteria_3.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_cell_criteria_3.h
diff --git a/3rdparty/CGAL/include/CGAL/Mesh_complex_3_in_triangulation_3.h b/3rdparty/CGAL/include/CGAL/Mesh_complex_3_in_triangulation_3.h
new file mode 100644
index 0000000..ebcffb5
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Mesh_complex_3_in_triangulation_3.h
@@ -0,0 +1,774 @@
+// Copyright (c) 2009-2014 INRIA Sophia-Antipolis (France).
+// Copyright (c) 2010-2013 GeometryFactory Sarl (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
+// 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(s)     : Stephane Tayeb, Clement Jamin
+//
+//******************************************************************************
+// File Description :
+//******************************************************************************
+
+#ifndef CGAL_MESH_COMPLEX_3_IN_TRIANGULATION_3_H
+#define CGAL_MESH_COMPLEX_3_IN_TRIANGULATION_3_H
+
+
+#include <CGAL/iterator.h>
+
+#include <CGAL/Mesh_3/utilities.h>
+#include <CGAL/Mesh_3/Mesh_complex_3_in_triangulation_3_base.h>
+
+#include <map>
+#include <boost/bimap/bimap.hpp>
+#include <boost/bimap/multiset_of.hpp>
+#include <boost/iterator/transform_iterator.hpp>
+#include <boost/iterator/iterator_adaptor.hpp>
+#include <boost/mpl/if.hpp>
+#include <CGAL/internal/Mesh_3/Boundary_of_subdomain_of_complex_3_in_triangulation_3_to_off.h>
+
+namespace CGAL {
+
+
+template <typename Tr,
+          typename CornerIndex = int,
+          typename CurveSegmentIndex = int>
+class Mesh_complex_3_in_triangulation_3 :
+  public Mesh_3::Mesh_complex_3_in_triangulation_3_base<
+    Tr, typename Tr::Concurrency_tag>
+{
+public:
+  typedef typename Tr::Concurrency_tag                   Concurrency_tag;
+
+private:
+  typedef Mesh_complex_3_in_triangulation_3<
+    Tr,CornerIndex,CurveSegmentIndex>                             Self;
+  typedef Mesh_3::Mesh_complex_3_in_triangulation_3_base<
+                                          Tr,Concurrency_tag>     Base;
+
+public:
+  typedef typename Base::size_type                        size_type;
+  
+  typedef typename Tr::Point                              Point;
+  typedef typename Base::Edge                             Edge;
+  typedef typename Base::Facet                            Facet;
+  typedef typename Base::Vertex_handle                    Vertex_handle;
+  typedef typename Base::Cell_handle                      Cell_handle;
+  typedef CornerIndex                                     Corner_index;
+  typedef CurveSegmentIndex                               Curve_segment_index;
+
+  typedef typename Base::Triangulation                    Triangulation;
+  typedef typename Base::Subdomain_index                  Subdomain_index;
+
+  using Base::surface_patch_index;
+
+private:
+  // Type to store the edges:
+  //  - a set of std::pair<Vertex_handle,Vertex_handle> (ordered at insertion)
+  //  - which allows fast lookup from one Vertex_handle
+  //  - each element of the set has an associated info (Curve_segment_index) value
+  typedef boost::bimaps::bimap<
+    boost::bimaps::multiset_of<Vertex_handle>,
+    boost::bimaps::multiset_of<Vertex_handle>,
+    boost::bimaps::set_of_relation<>,
+    boost::bimaps::with_info<Curve_segment_index> >   Edge_map;
+
+  typedef typename Edge_map::value_type               Internal_edge;
+
+  // Type to store the corners
+  typedef std::map<Vertex_handle,Corner_index>        Corner_map;
+  // Type to store far vertices
+  typedef std::vector<Vertex_handle>                  Far_vertices_vec;
+
+public:
+  /**
+   * Constructor
+   */
+  Mesh_complex_3_in_triangulation_3()
+    : Base()
+    , edges_()
+    , corners_() {}
+
+  /**
+   * Copy constructor
+   */
+  Mesh_complex_3_in_triangulation_3(const Self& rhs);
+
+  /**
+   * Destructor
+   */
+  virtual ~Mesh_complex_3_in_triangulation_3() {}
+
+  /**
+   * Assignement operator
+   */
+  Self& operator=(Self rhs)
+  {
+    swap(rhs);
+    return *this;
+  }
+
+  /**
+   * Swaps this & rhs
+   */
+  void swap(Self& rhs)
+  {
+    Base::swap(rhs);
+    edges_.swap(rhs.edges_);
+    corners_.swap(rhs.corners_);
+    far_vertices_.swap(rhs.far_vertices_);
+  }
+
+  /**
+   * Clears data of c3t3
+   */
+  void clear()
+  {
+    Base::clear();
+    edges_.clear();
+    corners_.clear();
+  }
+
+  /// Import Base functions
+  using Base::is_in_complex;
+  using Base::add_to_complex;
+  using Base::remove_from_complex;
+  using Base::triangulation;
+  using Base::set_surface_patch_index;
+    
+
+
+  /**
+   * Add edge e to complex, with Curve_segment_index index
+   */
+  void add_to_complex(const Edge& e,
+                      const Curve_segment_index& index)
+  {
+    add_to_complex(e.first->vertex(e.second),
+                   e.first->vertex(e.third),
+                   index);
+  }
+
+  /**
+   * Add edge (v1,v2) to complex, with Curve_segment_index index
+   */
+  void add_to_complex(const Vertex_handle& v1,
+                      const Vertex_handle& v2,
+                      const Curve_segment_index& index)
+  {
+    add_to_complex(make_internal_edge(v1,v2), index);
+  }
+
+  /**
+   * Mark vertex \c v as a corner of the complex
+   */
+  void add_to_complex(const Vertex_handle& v, const Corner_index& index)
+  {
+    v->set_dimension(0);
+    corners_.insert(std::make_pair(v,index));
+  }
+
+  /**
+   * Remove edge \c e from complex
+   */
+  void remove_from_complex(const Edge& e)
+  {
+    remove_from_complex(e.first->vertex(e.second), e.first->vertex(e.third));
+  }
+
+  /**
+   * Remove edge (v1,v2) from complex
+   */
+  void remove_from_complex(const Vertex_handle& v1, const Vertex_handle& v2)
+  {
+    remove_from_complex(make_internal_edge(v1,v2));
+  }
+
+  /**
+   * Remove vertex \c v from complex
+   */
+  void remove_from_complex(const Vertex_handle& v)
+  {
+    corners_.erase(v);
+    v->set_dimension(-1);
+  }
+
+  std::size_t number_of_far_points() const
+  {
+    return far_vertices_.size();
+  }
+
+  void add_far_point(const Point &p)
+  {
+    far_vertices_.push_back(triangulation().insert(p));
+  }
+  
+  void add_far_point(Vertex_handle vh)
+  {
+    far_vertices_.push_back(vh);
+  }
+
+  void remove_far_points()
+  {
+    Triangulation &tr = triangulation();
+    //triangulation().remove(far_vertices_.begin(), far_vertices_.end());
+    typename Far_vertices_vec::const_iterator it = far_vertices_.begin();
+    typename Far_vertices_vec::const_iterator it_end = far_vertices_.end();
+    for ( ; it != it_end ; ++it)
+    {
+      std::vector<Cell_handle> new_cells;
+      new_cells.reserve(32);
+      tr.remove_and_give_new_cells(*it, std::back_inserter(new_cells));
+
+      typename std::vector<Cell_handle>::iterator nc_it = new_cells.begin();
+      typename std::vector<Cell_handle>::iterator nc_it_end = new_cells.end();
+      for ( ; nc_it != nc_it_end ; ++nc_it)
+      {
+        Cell_handle c = *nc_it;
+        for (int i = 0 ; i < 4 ; ++i)
+        {
+          Facet mirror_facet = tr.mirror_facet(std::make_pair(c, i));
+          if (is_in_complex(mirror_facet))
+          {
+            set_surface_patch_index(c, i, 
+                                    surface_patch_index(mirror_facet));
+            c->set_facet_surface_center(i,
+              mirror_facet.first->get_facet_surface_center(mirror_facet.second));
+          }
+        }
+        /*int i_inf;
+        if (c->has_vertex(tr.infinite_vertex(), i_inf))
+        {
+          Facet mirror_facet = tr.mirror_facet(std::make_pair(c, i_inf));
+          if (is_in_complex(mirror_facet))
+          {
+            set_surface_patch_index(c, i_inf, 
+                                    surface_patch_index(mirror_facet));
+          }
+        }*/
+      }
+    }
+    far_vertices_.clear();
+  }
+
+  /**
+   * Returns the number of edges of c3t3
+   */
+  size_type number_of_edges_in_complex() const
+  {
+    return edges_.size();
+  }
+  size_type number_of_edges() const
+  {
+    return edges_.size();
+  }
+
+  /**
+   * Returns the number of corners of c3t3
+   */
+  size_type number_of_vertices_in_complex() const
+  {
+    return corners_.size();
+  }
+
+  void rescan_after_load_of_triangulation();
+
+  /**
+   * Returns true if edge \c e is in complex
+   */
+  bool is_in_complex(const Edge& e) const
+  {
+    return is_in_complex(e.first->vertex(e.second), e.first->vertex(e.third));
+  }
+
+  /**
+   * Returns true if edge (v1,v2) is in C3T3
+   */
+  bool is_in_complex(const Vertex_handle& v1, const Vertex_handle& v2) const
+  {
+    return is_in_complex(make_internal_edge(v1,v2));
+  }
+
+  /**
+   * Returns true if \c v is a 0-dimensionnal feature in the c3t3
+   */
+  bool is_in_complex(const Vertex_handle& v) const
+  {
+    return (corners_.find(v) != corners_.end());
+  }
+
+  /**
+   * Returns Curve_segment_index of edge \c e
+   */
+  Curve_segment_index curve_segment_index(const Edge& e) const
+  {
+    return curve_segment_index(e.first->vertex(e.second),
+                               e.first->vertex(e.third));
+  }
+
+  /**
+   * Returns Curve_segment_index of edge \c (v1,v2)
+   */
+  Curve_segment_index curve_segment_index(const Vertex_handle& v1,
+                                          const Vertex_handle& v2) const
+  {
+    return curve_index(make_internal_edge(v1,v2));
+  }
+
+  /**
+   * Returns Corner_index of vertex \c v
+   */
+  Corner_index corner_index(const Vertex_handle& v) const
+  {
+    typename Corner_map::const_iterator it = corners_.find(v);
+    if ( corners_.end() != it ) { return it->second; }
+    return Corner_index();
+  }
+
+  /**
+   * Outputs the outer boundary of the entire domain with facets oriented outward.
+   */
+  std::ostream& output_boundary_to_off(std::ostream& out) const
+  {
+    internal::output_boundary_of_c3t3_to_off(*this, 0, out, false);
+    return out;
+  }
+
+  /**
+   * Outputs the outer boundary of the selected subdomain with facets oriented outward.
+   */
+  std::ostream& output_boundary_to_off(std::ostream& out, Subdomain_index subdomain) const
+  {
+    output_boundary_of_c3t3_to_off(*this, subdomain, out);
+    return out;
+  }
+
+  /**
+   * Outputs the surface facets with a consistent orientation at the interface of two subdomains.
+   */
+  std::ostream& output_facets_in_complex_to_off(std::ostream& out) const
+  {
+    internal::output_facets_in_complex_to_off(*this, out);
+    return out;
+  }
+
+  /**
+   * Fills \c out with incident edges (1-dimensional features of \c v.
+   * OutputIterator value type is std::pair<Vertex_handle,Curve_segment_index>
+   * \pre v->in_dimension() < 2
+   */
+  template <typename OutputIterator>
+  OutputIterator
+  adjacent_vertices_in_complex(const Vertex_handle& v, OutputIterator out) const;
+
+  // -----------------------------------
+  // Undocumented
+  // -----------------------------------
+
+  /**
+   * Returns true if c3t3 is valid
+   */
+  bool is_valid(bool verbose = false) const;
+
+  // -----------------------------------
+  // Complex traversal
+  // -----------------------------------
+private:
+  class Edge_iterator_not_in_complex
+  {
+    const Self& c3t3_;
+    const Curve_segment_index index_;
+  public:
+    Edge_iterator_not_in_complex(const Self& c3t3,
+                                 const Curve_segment_index& index = Curve_segment_index())
+    : c3t3_(c3t3)
+    , index_(index) { }
+
+    template <typename Iterator>
+    bool operator()(Iterator it) const
+    {
+      if ( index_ == Curve_segment_index() ) { return ! c3t3_.is_in_complex(*it); }
+      else { return c3t3_.curve_segment_index(*it) != index_;  }
+    }
+  };
+
+  class Vertex_iterator_not_in_complex
+  {
+    const Self& c3t3_;
+    const Corner_index index_;
+  public:
+    Vertex_iterator_not_in_complex(const Self& c3t3,
+                                   const Corner_index& index = Corner_index())
+    : c3t3_(c3t3)
+    , index_(index) { }
+
+    template <typename ItMap>
+    bool operator()(const ItMap it) const
+    {
+      if ( index_ == Corner_index() ) { return false; }
+      else { return it->second != index_;  }
+    }
+  };
+
+  // Filtered iterator
+  typedef Filter_iterator<
+    typename Corner_map::const_iterator,
+    Vertex_iterator_not_in_complex >            Vertex_map_filter_iterator;
+
+  // Iterator type to get the first element of pair
+  typedef boost::transform_iterator <
+    Mesh_3::internal::First_of<typename Vertex_map_filter_iterator::value_type>,
+    Vertex_map_filter_iterator >                Vertex_map_iterator_first;
+
+  // Iterator type to remove a level of referencing
+  class Vertex_map_iterator_first_dereference
+    : public boost::iterator_adaptor <
+        Vertex_map_iterator_first_dereference,
+        Vertex_map_iterator_first,
+        typename Vertex_map_iterator_first::value_type::value_type,
+        boost::use_default,
+        typename Vertex_map_iterator_first::value_type::reference >
+  {
+    typedef Vertex_map_iterator_first_dereference Self;
+    typedef boost::iterator_adaptor <
+        Vertex_map_iterator_first_dereference,
+        Vertex_map_iterator_first,
+        typename Vertex_map_iterator_first::value_type::value_type,
+        boost::use_default,
+        typename Vertex_map_iterator_first::value_type::reference > iterator_adaptor_;
+  public:
+    typedef typename  Vertex_map_iterator_first::reference  pointer;
+    typedef typename iterator_adaptor_::reference           reference;
+
+    Vertex_map_iterator_first_dereference() : Self::iterator_adaptor_() { }
+
+    template < typename Iterator >
+    Vertex_map_iterator_first_dereference(Iterator i)
+      : Self::iterator_adaptor_(typename Self::iterator_adaptor_::base_type(i))
+    { }
+
+    pointer operator->() const { return *(this->base()); }
+    reference operator*() const { return **(this->base()); }
+
+    operator Vertex_handle() { return Vertex_handle(*(this->base())); }
+  };
+
+public:
+  /// Iterator type to visit the edges of the 1D complex.
+  typedef Filter_iterator<
+    typename Triangulation::Finite_edges_iterator,
+    Edge_iterator_not_in_complex >          Edges_in_complex_iterator;
+
+  /// Returns a Facets_in_complex_iterator to the first facet of the 1D complex
+  Edges_in_complex_iterator edges_in_complex_begin() const
+  {
+    return CGAL::filter_iterator(this->triangulation().finite_edges_end(),
+                                 Edge_iterator_not_in_complex(*this),
+                                 this->triangulation().finite_edges_begin());
+  }
+
+  /// Returns a Facets_in_complex_iterator to the first facet of the 1D complex
+  Edges_in_complex_iterator
+  edges_in_complex_begin(const Curve_segment_index& index) const
+  {
+    return CGAL::filter_iterator(this->triangulation().finite_edges_end(),
+                                 Edge_iterator_not_in_complex(*this,index),
+                                 this->triangulation().finite_edges_begin());
+  }
+
+  /// Returns past-the-end iterator on facet of the 1D complex
+  Edges_in_complex_iterator edges_in_complex_end(const Curve_segment_index& = Curve_segment_index()) const
+  {
+    return CGAL::filter_iterator(this->triangulation().finite_edges_end(),
+                                 Edge_iterator_not_in_complex(*this));
+  }
+
+  /// Iterator type to visit the edges of the 0D complex.
+  typedef Vertex_map_iterator_first_dereference Vertices_in_complex_iterator;
+
+  /// Returns a Vertices_in_complex_iterator to the first vertex of the 0D complex
+  Vertices_in_complex_iterator vertices_in_complex_begin() const
+  {
+    return CGAL::filter_iterator(corners_.end(),
+                                 Vertex_iterator_not_in_complex(*this),
+                                 corners_.begin());
+  }
+
+  /// Returns a Vertices_in_complex_iterator to the first vertex of the 0D complex
+  Vertices_in_complex_iterator
+  vertices_in_complex_begin(const Corner_index& index) const
+  {
+    return CGAL::filter_iterator(corners_.end(),
+                                 Vertex_iterator_not_in_complex(*this,index),
+                                 corners_.begin());
+  }
+
+  /// Returns past-the-end iterator on facet of the 0D complex
+  Vertices_in_complex_iterator vertices_in_complex_end() const
+  {
+    return CGAL::filter_iterator(corners_.end(),
+                                 Vertex_iterator_not_in_complex(*this));
+  }
+
+
+private:
+  /**
+   * Creates an Internal_edge object (i.e a pair of ordered Vertex_handle)
+   */
+  Internal_edge make_internal_edge(const Vertex_handle& v1,
+                                   const Vertex_handle& v2) const
+  {
+    if ( v1 < v2 ) { return Internal_edge(v1,v2); }
+    else { return Internal_edge(v2,v1); }
+  }
+
+  /**
+   * Returns true if \c edge is in C3T3
+   */
+  bool is_in_complex(const Internal_edge& edge) const
+  {
+    return (curve_index(edge) != Curve_segment_index() );
+  }
+
+  /**
+   * Add edge \c edge to complex, with Curve_segment_index index
+   */
+  void add_to_complex(const Internal_edge& edge, const Curve_segment_index& index)
+  {
+    CGAL_precondition(!is_in_complex(edge));
+#ifdef CGAL_MESH_3_PROTECTION_DEBUG
+    std::cerr << "Add edge ( " << edge.left->point()
+              << " , " << edge.right->point() << " ), curve_index=" << index
+              << " to c3t3.\n";
+#endif // CGAL_MESH_3_PROTECTION_DEBUG
+    std::pair<typename Edge_map::iterator, bool> it = edges_.insert(edge);
+    it.first->info = index;
+  }
+
+  /**
+   * Remove edge \c edge from complex
+   */
+  void remove_from_complex(const Internal_edge& edge)
+  {
+    edges_.erase(edge);
+  }
+
+  /**
+   * Returns Curve_segment_index of edge \c edge
+   */
+  Curve_segment_index curve_index(const Internal_edge& edge) const
+  {
+    typename Edge_map::const_iterator it = edges_.find(edge);
+    if ( edges_.end() != it ) { return it->info; }
+    return Curve_segment_index();
+  }
+
+private:
+  Edge_map edges_;
+  Corner_map corners_;
+  Far_vertices_vec far_vertices_;
+};
+
+
+template <typename Tr, typename CI_, typename CSI_>
+Mesh_complex_3_in_triangulation_3<Tr,CI_,CSI_>::
+Mesh_complex_3_in_triangulation_3(const Self& rhs)
+  : Base(rhs)
+  , edges_()
+  , corners_()
+{
+  // Copy edges
+  for ( typename Edge_map::const_iterator it = rhs.edges_.begin(),
+       end = rhs.edges_.end() ; it != end ; ++it )
+  {
+    const Vertex_handle& va = it->right;
+    const Vertex_handle& vb = it->left;
+
+    Vertex_handle new_va;
+    this->triangulation().is_vertex(va->point(), new_va);
+
+    Vertex_handle new_vb;
+    this->triangulation().is_vertex(vb->point(), new_vb);
+
+    this->add_to_complex(make_internal_edge(new_va,new_vb), it->info);
+  }
+
+  // Copy corners
+  for ( typename Corner_map::const_iterator it = rhs.corners_.begin(),
+       end = rhs.corners_.end() ; it != end ; ++it )
+  {
+    Vertex_handle new_v;
+    this->triangulation().is_vertex(it->first->point(), new_v);
+    this->add_to_complex(new_v, it->second);
+  }
+
+  // Parse vertices to identify far vertices
+  if (rhs.far_vertices_.size() > 0)
+  {
+    Triangulation &tr = triangulation();
+    typename Tr::Finite_vertices_iterator vit = tr.finite_vertices_begin();
+    for(typename Tr::Finite_vertices_iterator end = tr.finite_vertices_end();
+        vit != end ; ++vit)
+    {
+      if (vit->in_dimension() == -1)
+        far_vertices_.push_back(vit);
+    }
+    CGAL_assertion(far_vertices_.size() == rhs.far_vertices_.size());
+  }
+}
+
+
+template <typename Tr, typename CI_, typename CSI_>
+template <typename OutputIterator>
+OutputIterator
+Mesh_complex_3_in_triangulation_3<Tr,CI_,CSI_>::
+adjacent_vertices_in_complex(const Vertex_handle& v, OutputIterator out) const
+{
+  CGAL_precondition(v->in_dimension() < 2);
+
+  typedef typename Edge_map::right_const_iterator Rcit;
+  typedef typename Edge_map::left_const_iterator Lcit;
+
+  // Add edges containing v is on the left
+  std::pair<Rcit,Rcit> range_right = edges_.right.equal_range(v);
+  for ( Rcit rit = range_right.first ; rit != range_right.second ; ++rit )
+  {
+    *out++ = std::make_pair(rit->second, rit->info);
+  }
+
+  // Add edges containing v on the right
+  std::pair<Lcit,Lcit> range_left = edges_.left.equal_range(v);
+  for ( Lcit lit = range_left.first ; lit != range_left.second ; ++lit )
+  {
+    *out++ = std::make_pair(lit->second, lit->info);
+  }
+
+  return out;
+}
+
+
+template <typename Tr, typename CI_, typename CSI_>
+bool
+Mesh_complex_3_in_triangulation_3<Tr,CI_,CSI_>::
+is_valid(bool verbose) const
+{
+  typedef typename Tr::Point::Point    Bare_point;
+  typedef typename Tr::Point::Weight   Weight;
+  typedef Weight FT;
+
+  std::map<Vertex_handle, int> vertex_map;
+
+  // Fill map counting neighbor number for each vertex of an edge
+  for ( typename Edge_map::const_iterator it = edges_.begin(),
+       end = edges_.end() ; it != end ; ++it )
+  {
+    const Vertex_handle& v1 = it->right;
+    if ( vertex_map.find(v1) == vertex_map.end() ) { vertex_map[v1] = 1; }
+    else { vertex_map[v1] += 1; }
+
+    const Vertex_handle& v2 = it->left;
+    if ( vertex_map.find(v2) == vertex_map.end() ) { vertex_map[v2] = 1; }
+    else { vertex_map[v2] += 1; }
+  }
+
+  // Verify that each vertex has 2 neighbors if it's not a corner
+  for ( typename std::map<Vertex_handle, int>::iterator vit = vertex_map.begin(),
+       vend = vertex_map.end() ; vit != vend ; ++vit )
+  {
+    if ( vit->first->in_dimension() != 0 && vit->second != 2 )
+    {
+      if(verbose)
+        std::cerr << "Validity error: vertex " << (void*)(&*vit->first)
+                  << " (" << vit->first->point() << ") "
+                  << "is not a corner (dimension " << vit->first->in_dimension()
+                  << ") but has " << vit->second << " neighbor(s)!\n";
+      return false;
+    }
+  }
+
+  // Verify that balls of each edge intersect
+  for ( typename Edge_map::const_iterator it = edges_.begin(),
+       end = edges_.end() ; it != end ; ++it )
+  {
+    const Bare_point& p = it->right->point().point();
+    const Bare_point& q = it->left->point().point();
+
+    typename Tr::Geom_traits::Construct_sphere_3 sphere =
+      this->triangulation().geom_traits().construct_sphere_3_object();
+
+    typename Tr::Geom_traits::Do_intersect_3 do_intersect =
+      this->triangulation().geom_traits().do_intersect_3_object();
+
+    const FT& sq_rp = it->right->point().weight();
+    const FT& sq_rq = it->left->point().weight();
+
+    if ( ! do_intersect(sphere(p, sq_rp), sphere(q, sq_rq)) )
+    {
+      std::cerr << "Point p[" << p << "], dim=" << it->right->in_dimension()
+                << " and q[" << q << "], dim=" << it->left->in_dimension()
+                << " form an edge but do not intersect !\n";
+      return false;
+    }
+  }
+
+  return true;
+}
+
+template <typename Tr, typename CI_, typename CSI_>
+void
+Mesh_complex_3_in_triangulation_3<Tr,CI_,CSI_>::
+rescan_after_load_of_triangulation() {
+  corners_.clear();
+  for(typename Tr::Finite_vertices_iterator
+        vit = this->triangulation().finite_vertices_begin(),
+        end = this->triangulation().finite_vertices_end();
+      vit != end; ++vit)
+  {
+    if ( vit->in_dimension() == 0 ) {
+      add_to_complex(vit, Corner_index(1));
+    }
+  }
+  Base::rescan_after_load_of_triangulation();
+}
+
+template <typename Tr, typename CI_, typename CSI_>
+std::ostream &
+operator<< (std::ostream& os,
+            const Mesh_complex_3_in_triangulation_3<Tr,CI_,CSI_> &c3t3)
+{
+  // TODO: implement edge saving
+  typedef typename Mesh_complex_3_in_triangulation_3<Tr,CI_,CSI_>::Concurrency_tag Concurrency_tag;
+  return os << static_cast<
+    const Mesh_3::Mesh_complex_3_in_triangulation_3_base<Tr, Concurrency_tag>&>(c3t3);
+}
+
+
+template <typename Tr, typename CI_, typename CSI_>
+std::istream &
+operator>> (std::istream& is,
+            Mesh_complex_3_in_triangulation_3<Tr,CI_,CSI_> &c3t3)
+{
+  // TODO: implement edge loading
+  typedef typename Mesh_complex_3_in_triangulation_3<Tr,CI_,CSI_>::Concurrency_tag Concurrency_tag;
+  is >> static_cast<
+    Mesh_3::Mesh_complex_3_in_triangulation_3_base<Tr, Concurrency_tag>&>(c3t3);
+  c3t3.rescan_after_load_of_triangulation();
+  return is;
+}
+
+} //namespace CGAL
+
+#endif // CGAL_MESH_COMPLEX_3_IN_TRIANGULATION_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_constant_domain_field_3.h b/3rdparty/CGAL/include/CGAL/Mesh_constant_domain_field_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_constant_domain_field_3.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_constant_domain_field_3.h
diff --git a/3rdparty/CGAL/include/CGAL/Mesh_criteria_3.h b/3rdparty/CGAL/include/CGAL/Mesh_criteria_3.h
new file mode 100644
index 0000000..d373026
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Mesh_criteria_3.h
@@ -0,0 +1,193 @@
+// Copyright (c) 2009 INRIA Sophia-Antipolis (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
+// 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(s)     : Stéphane Tayeb
+//
+//******************************************************************************
+// File Description :
+// Implements default meshing criteria to drive Mesh_3 process
+//******************************************************************************
+
+
+#ifndef CGAL_MESH_CRITERIA_3_H
+#define CGAL_MESH_CRITERIA_3_H
+
+#include <CGAL/Mesh_3/config.h>
+#include <CGAL/Mesh_3/global_parameters.h>
+#include <CGAL/Mesh_edge_criteria_3.h>
+#include <CGAL/Mesh_facet_criteria_3.h>
+#include <CGAL/Mesh_cell_criteria_3.h>
+#include <cfloat> // for the macro DBL_MAX
+namespace CGAL {
+  
+namespace parameters {
+
+// see <CGAL/config.h>
+CGAL_PRAGMA_DIAG_PUSH
+// see <CGAL/Mesh_3/config.h>
+CGAL_MESH_3_IGNORE_BOOST_PARAMETER_NAME_WARNINGS
+
+  BOOST_PARAMETER_NAME( (edge_size, tag) edge_size_ )
+  BOOST_PARAMETER_NAME( (edge_sizing_field, tag) edge_sizing_field_ )
+  BOOST_PARAMETER_NAME( (facet_angle, tag) facet_angle_ )
+  BOOST_PARAMETER_NAME( (facet_size, tag) facet_size_ )
+  BOOST_PARAMETER_NAME( (facet_sizing_field, tag) facet_sizing_field_ )
+  BOOST_PARAMETER_NAME( (facet_distance, tag) facet_distance_ )
+  BOOST_PARAMETER_NAME( (facet_topology, tag) facet_topology_ )
+  BOOST_PARAMETER_NAME( (cell_radius_edge, tag) cell_radius_edge_ )
+  BOOST_PARAMETER_NAME( (cell_radius_edge_ratio, tag) cell_radius_edge_ratio_ )
+  BOOST_PARAMETER_NAME( (cell_size, tag) cell_size_ )
+  BOOST_PARAMETER_NAME( (cell_sizing_field, tag) cell_sizing_field_ )
+  BOOST_PARAMETER_NAME( (sizing_field, tag) sizing_field_ )
+
+CGAL_PRAGMA_DIAG_POP
+
+} // end namespace parameters
+  
+namespace internal {
+  
+// Class Mesh_criteria_3_impl
+template < typename Tr,
+           typename EdgeCriteria,
+           typename FacetCriteria,
+           typename CellCriteria >
+class Mesh_criteria_3_impl
+{
+  typedef typename Tr::Geom_traits::FT FT;
+  
+public:
+  typedef EdgeCriteria      Edge_criteria;
+  typedef FacetCriteria     Facet_criteria;
+  typedef CellCriteria      Cell_criteria;
+  
+  // Constructor
+  Mesh_criteria_3_impl(const Facet_criteria& facet_criteria,
+                       const Cell_criteria& cell_criteria)
+    : edge_criteria_(0)
+    , facet_criteria_(facet_criteria)
+    , cell_criteria_(cell_criteria)
+  { }
+  
+  // Constructor
+  Mesh_criteria_3_impl(const Edge_criteria& edge_criteria,
+                       const Facet_criteria& facet_criteria,
+                       const Cell_criteria& cell_criteria)
+    : edge_criteria_(edge_criteria)
+    , facet_criteria_(facet_criteria)
+    , cell_criteria_(cell_criteria)
+  { }
+  
+  // This template constructor is not instantiated when named parameters
+  // are not used, so Facet_criteria and Cell_criteria construction from FT
+  // is not a problem
+  template <class ArgumentPack>
+  Mesh_criteria_3_impl(const ArgumentPack& args)
+    : edge_criteria_(args[parameters::edge_size
+                          | args[parameters::edge_sizing_field
+                                 | args[parameters::sizing_field | FT(DBL_MAX)] ] ])
+    , facet_criteria_(args[parameters::facet_angle | FT(0)],
+                      args[parameters::facet_size
+                           | args[parameters::facet_sizing_field
+                                  | args[parameters::sizing_field | FT(0)] ] ],
+                      args[parameters::facet_distance | FT(0)],
+                      args[parameters::facet_topology | CGAL::FACET_VERTICES_ON_SURFACE])
+    , cell_criteria_(args[parameters::cell_radius_edge_ratio
+                          | args[parameters::cell_radius_edge | FT(0)] ],
+                     args[parameters::cell_size
+                          | args[parameters::cell_sizing_field
+                                 | args[parameters::sizing_field | FT(0)] ] ])
+  { }
+
+#ifndef CGAL_NO_DEPRECATED_CODE  
+  const Edge_criteria& edge_criteria() const { return edge_criteria_; }
+  const Facet_criteria& facet_criteria() const { return facet_criteria_; }
+  const Cell_criteria& cell_criteria() const { return cell_criteria_; }
+#endif
+
+  const Edge_criteria& edge_criteria_object() const { return edge_criteria_; }
+  const Facet_criteria& facet_criteria_object() const { return facet_criteria_; }
+  const Cell_criteria& cell_criteria_object() const { return cell_criteria_; }
+  
+private:
+  Edge_criteria edge_criteria_;
+  Facet_criteria facet_criteria_;
+  Cell_criteria cell_criteria_;
+  
+};  // end class Mesh_criteria_3_impl  
+
+} // end namespace internal
+  
+  
+  
+// Class Mesh_criteria_3
+// Provides default mesh criteria to drive Mesh_3 process
+template <typename Tr,
+          typename EdgeCriteria = Mesh_edge_criteria_3<Tr>,
+          typename FacetCriteria = Mesh_facet_criteria_3<Tr>,
+          typename CellCriteria = Mesh_cell_criteria_3<Tr> >
+class Mesh_criteria_3
+  : public internal::Mesh_criteria_3_impl< Tr,
+                                           EdgeCriteria,
+                                           FacetCriteria,
+                                           CellCriteria >
+{
+  typedef internal::Mesh_criteria_3_impl< Tr,
+                                          EdgeCriteria,
+                                          FacetCriteria,
+                                          CellCriteria>   Base;
+  
+public:
+  typedef typename Base::Edge_criteria    Edge_criteria;
+  typedef typename Base::Facet_criteria   Facet_criteria;
+  typedef typename Base::Cell_criteria    Cell_criteria;
+  
+  // Constructor
+  Mesh_criteria_3(const Facet_criteria& facet_criteria,
+                  const Cell_criteria& cell_criteria)
+    : Base(facet_criteria,
+           cell_criteria) {}
+  
+  // Constructor
+  Mesh_criteria_3(const Edge_criteria& edge_criteria,
+                  const Facet_criteria& facet_criteria,
+                  const Cell_criteria& cell_criteria)
+    : Base(edge_criteria,
+           facet_criteria,
+           cell_criteria) {}
+  
+  // For convenient constructor call (see examples)
+  BOOST_PARAMETER_CONSTRUCTOR(Mesh_criteria_3, (Base), parameters::tag,
+                              (optional (edge_size_,*)
+                                        (edge_sizing_field_,*)
+                                        (facet_angle_,*)
+                                        (facet_size_,*)
+                                        (facet_sizing_field_,*)
+                                        (facet_distance_,*)
+                                        (facet_topology_,*)
+                                        (cell_radius_edge_,*)
+                                        (cell_size_,*)
+                                        (cell_sizing_field_,*)
+                                        (sizing_field_,*)
+                              ))
+  
+};  // end class Mesh_criteria_3
+
+}  // end namespace CGAL
+
+
+#endif // CGAL_MESH_CRITERIA_3_H
diff --git a/3rdparty/CGAL/include/CGAL/Mesh_domain_with_polyline_features_3.h b/3rdparty/CGAL/include/CGAL/Mesh_domain_with_polyline_features_3.h
new file mode 100644
index 0000000..8fe36aa
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Mesh_domain_with_polyline_features_3.h
@@ -0,0 +1,1096 @@
+// Copyright (c) 2009-2010 INRIA Sophia-Antipolis (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
+// 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(s)     : Stéphane Tayeb, Laurent Rineau
+//
+//******************************************************************************
+// File Description :
+//
+//******************************************************************************
+
+#ifndef CGAL_MESH_DOMAIN_WITH_POLYLINE_FEATURES_3_H
+#define CGAL_MESH_DOMAIN_WITH_POLYLINE_FEATURES_3_H
+
+#include <CGAL/iterator.h>
+#include <CGAL/enum.h>
+#include <CGAL/number_utils.h>
+#include <CGAL/AABB_tree.h>
+#include <CGAL/AABB_traits.h>
+#include <CGAL/is_streamable.h>
+
+#include <vector>
+#include <set>
+#include <map>
+#include <boost/next_prior.hpp> // for boost::prior and boost::next
+#include <boost/variant.hpp>
+#include <boost/foreach.hpp>
+
+namespace CGAL {
+
+
+namespace internal {
+namespace Mesh_3 {
+
+template <typename Kernel>
+class Polyline
+{
+  typedef typename Kernel::Point_3  Point_3;
+  typedef typename Kernel::Segment_3 Segment_3;
+  typedef typename Kernel::FT       FT;
+
+  typedef std::vector<Point_3>      Data;
+
+public:
+  typedef typename Data::const_iterator const_iterator;
+
+  Polyline() {}
+  ~Polyline() {}
+
+  /// Add a point at the end of the polyline
+  void add_point(const Point_3& p)
+  {
+    if( points_.empty() || p != end_point() ) {
+      points_.push_back(p);
+    }
+  }
+
+  /// Returns the starting point of the polyline
+  const Point_3& start_point() const
+  {
+    CGAL_assertion( ! points_.empty() );
+    return points_.front();
+  }
+
+  /// Returns the ending point of the polyline
+  const Point_3& end_point() const
+  {
+    CGAL_assertion( ! points_.empty() );
+    return points_.back();
+  }
+
+  /// Returns true if the polyline is not degenerated
+  bool is_valid() const
+  {
+    return points_.size() > 1;
+  }
+
+  /// Returns true if polyline is a cycle
+  bool is_cycle() const
+  {
+    return start_point() == end_point();
+  }
+
+  /// Returns the length of the polyline
+  FT length() const
+  {
+    //TODO: cache result
+    FT result (0);
+    const_iterator it = points_.begin();
+    const_iterator previous = it++;
+
+    for ( const_iterator end = points_.end() ; it != end ; ++it, ++previous )
+    {
+      result += distance(*previous,*it);
+    }
+
+    return result;
+  }
+
+  /// Returns signed geodesic distance between \c p and \c q
+  FT geodesic_distance(const Point_3& p, const Point_3& q,
+                       bool /*treat_cycle*/=true) const
+  {
+    CGAL_precondition(is_valid());
+
+    // Locate p & q on polyline
+    const_iterator pit = locate(p);
+    const_iterator qit = locate(q,false);
+
+    // Compute geodesic distance
+    FT result = (pit <= qit) ? geodesic_distance(p,q,pit,qit)
+                             : -geodesic_distance(q,p,qit,pit);
+
+    // Treat cycles: return a positive value
+    if ( is_cycle() && (p==q || result < FT(0)) )
+    {
+      result = length() + result;
+    }
+
+    return result;
+  }
+
+
+  /// Returns a point at geodesic distance \c distance from p along the
+  /// polyline. The polyline is oriented from starting point to end point.
+  /// The distance could be negative.
+  Point_3 point_at(const Point_3& p, FT distance) const
+  {
+    // use first point of the polyline instead of p
+    distance += geodesic_distance(start_point(),p,false);
+
+    // If polyline is a cycle, ensure that distance is given from start_point()
+    if ( is_cycle() )
+    {
+      if ( distance < FT(0) ) { distance += length(); }
+      else if ( distance > length() ) { distance -= length(); }
+    }
+
+    CGAL_assertion( distance >= FT(0) );
+    CGAL_assertion( distance <= length() );
+
+    // Initialize iterators
+    const_iterator pit = points_.begin();
+    const_iterator previous = pit++;
+
+    // Iterate to find which segment contains the point we want to construct
+    FT segment_length = this->distance(*previous,*pit);
+    while ( distance > segment_length )
+    {
+      distance -= segment_length;
+
+      // Increment iterators and update length
+      ++previous;
+      ++pit;
+
+      if (pit == points_.end())
+        return *previous;
+
+      segment_length = this->distance(*previous,*pit);
+    }
+
+    // return point at distance from current segment source
+    typedef typename Kernel::Vector_3 Vector_3;
+    Vector_3 v (*previous, *pit);
+
+    return (*previous) + (distance / CGAL::sqrt(v.squared_length())) * v;
+  }
+
+  bool are_ordered_along(const Point_3& p, const Point_3& q) const
+  {
+    CGAL_precondition(!is_cycle());
+
+    // Locate p & q on polyline
+    const_iterator pit = locate(p);
+    const_iterator qit = locate(q,true);
+
+    // Points are not located on the same segment
+    if ( pit != qit ) { return (pit <= qit); }
+
+    // pit == qit, then we have to sort p&q along (pit,pit+1)
+    return ( compare_distance(*pit,p,q) != CGAL::LARGER );
+  }
+
+private:
+  const_iterator first_segment_source() const
+  {
+    CGAL_precondition(is_valid());
+    return points_.begin();
+  }
+
+  const_iterator last_segment_source() const
+  {
+    CGAL_precondition(is_valid());
+    return (points_.end() - 2);
+  }
+
+  FT geodesic_distance(const Point_3& p, const Point_3& q,
+                       const_iterator pit, const_iterator qit) const
+  {
+    CGAL_precondition(std::distance(pit,qit) >= 0);
+
+    // If p and q are in the same segment of the polyline
+    if ( pit == qit )
+    {
+      FT result = distance(p,q);
+
+      // Find the closest point to *pit
+      if ( compare_distance(*pit,p,q) != CGAL::LARGER )
+      { return result; }
+      else
+      { return -result; }
+    }
+
+    // p is inside [pit,pit+1], pit+1 != qit, q is inside [qit,qit+1]
+    FT result = distance(p,*(pit+1));
+    result += distance(*qit,q);
+
+    // Add segments between pit+1 and qit to result
+    for ( const_iterator it = (pit+1) ; it != qit ; ++it )
+    {
+      result += distance(*it,*(it+1));
+    }
+
+    return result;
+  }
+
+  /// Returns an iterator on the starting point of the segment of the
+  /// polyline which contains p
+  /// if end_point_first is true, then --end is returned instead of begin
+  /// if p is the starting point of a cycle.
+  const_iterator locate(const Point_3& p, bool end_point_first=false) const
+  {
+    CGAL_precondition(is_valid());
+
+    // First look if p is one of the points of the polyline
+    const_iterator result = std::find(points_.begin(), points_.end(), p);
+    if ( result != points_.end() )
+    {
+      if ( result != points_.begin() )
+      { return --result; }
+      else
+      {
+        // Treat cycles
+        if ( end_point_first && p == end_point() )
+        { return last_segment_source(); }
+        else
+        { return result; }
+      }
+    }
+
+    CGAL_assertion(result == points_.end());
+
+    // Get result by projecting p on the polyline
+    const_iterator it = points_.begin();
+    const_iterator previous = it;
+    Segment_3 nearest_segment;
+    const_iterator nearest_vertex = it;
+    result = nearest_vertex;
+    bool nearest_is_a_segment = false;
+
+    while ( ++it != points_.end() )
+    {
+      Segment_3 seg (*previous, *it);
+
+      if(nearest_is_a_segment)
+      {
+        if(compare_distance(p, seg, nearest_segment) == CGAL::SMALLER)
+        {
+          nearest_segment = seg;
+          result = previous;
+        }
+        if(compare_distance(p, *it, nearest_segment) == CGAL::SMALLER)
+        {
+          nearest_vertex = it;
+          nearest_is_a_segment = false;
+          result = it;
+        }
+      }
+      else {
+        if(compare_distance(p, *it, *nearest_vertex) == CGAL::SMALLER)
+        {
+          nearest_vertex = it;
+          result = it;
+        }
+        if(compare_distance(p, seg, *nearest_vertex) == CGAL::SMALLER)
+        {
+          nearest_segment = seg;
+          nearest_is_a_segment = true;
+          result = previous;
+        }
+      }
+      previous = it;
+    } // end the while loop on the vertices of the polyline
+
+
+    if(result == points_.begin()) {
+      return (end_point_first && !nearest_is_a_segment) ? last_segment_source() : points_.begin();
+    } else {
+      return result;
+    }
+  }
+
+  // FT squared_distance(const Point_3& p, const Point_3& q) const
+  // {
+  //   typename Kernel::Compute_squared_distance_3 sq_distance =
+  //     Kernel().compute_squared_distance_3_object();
+  //   return sq_distance(p,q);
+  // }
+
+  FT distance(const Point_3& p, const Point_3& q) const
+  {
+    return CGAL::sqrt(squared_distance(p, q));
+  }
+
+  Angle angle(const Point_3& p,
+              const Point_3& angle_vertex_point,
+              const Point_3& q) const
+  {
+    typename Kernel::Angle_3 compute_angle =  Kernel().angle_3_object();
+    return compute_angle(p,angle_vertex_point,q);
+  }
+
+  template <typename T1, typename T2>
+  CGAL::Sign compare_distance(const Point_3& p,
+                              const T1& obj1,
+                              const T2& obj2) const
+  {
+    typename Kernel::Compare_distance_3 compare_distance =
+      Kernel().compare_distance_3_object();
+    return compare_distance(p,obj1,obj2);
+  }
+
+public:
+  Data points_;
+}; // end class Polyline
+
+
+template <typename Gt, typename MapIterator>
+struct Mesh_domain_segment_of_curve_primitive{
+  typedef typename std::iterator_traits<MapIterator>::value_type Map_value_type;
+  typedef typename Map_value_type::first_type Curve_id;
+  typedef typename Map_value_type::second_type Polyline;
+
+  typedef std::pair<MapIterator,
+                    typename Polyline::const_iterator> Id;
+
+  typedef typename std::iterator_traits<
+    typename Polyline::const_iterator>::value_type Point;
+
+  typedef typename Gt::Segment_3 Datum;
+
+  Id id_;
+
+  Mesh_domain_segment_of_curve_primitive(Id id) : id_(id) {}
+
+  const Id& id() const { return id_; }
+
+  const Point& reference_point() const {
+    return *(id_.second);
+  }
+
+  Datum datum() const {
+    return Datum(*id_.second, *(id_.second+1));
+  }
+}; // end Mesh_domain_segment_of_curve_primitive
+
+template <typename MDwPF, bool patch_id_is_streamable>
+struct Display_incidences_to_patches_aux {
+  template <typename Container>
+  void operator()(std::ostream& os, typename MDwPF::Curve_segment_index id,
+                  const Container&) const;
+};
+
+template <typename MDwPF> //specialization when patch_id_is_streamable == false
+struct Display_incidences_to_patches_aux<MDwPF, false> {
+  template <typename Container>
+  void operator()(std::ostream& os,
+                  typename MDwPF::Curve_segment_index id,
+                  const Container&) const;
+};
+
+template <typename MDwPF, bool curve_id_is_streamable>
+struct Display_incidences_to_curves_aux {
+  template <typename Container>
+  void operator()(std::ostream& os, typename MDwPF::Curve_segment_index id,
+                  const Container&) const;
+};
+
+template <typename MDwPF> //specialization when curve_id_is_streamable == false
+struct Display_incidences_to_curves_aux<MDwPF, false> {
+  template <typename Container>
+  void operator()(std::ostream& os, typename MDwPF::Curve_segment_index id,
+                  const Container&) const;
+};
+
+} // end of namespace CGAL::internal::Mesh_3
+} // end of namespace CGAL::internal
+
+
+
+
+
+/**
+ * @class Mesh_domain_with_polyline_features_3
+ *
+ *
+ */
+template < typename MeshDomain >
+class Mesh_domain_with_polyline_features_3
+  : public MeshDomain
+{
+  typedef MeshDomain Base;
+
+public:
+  // Index types
+  typedef typename Base::Index    Index;
+
+  typedef typename Base::Surface_patch_index
+                                  Surface_patch_index;
+
+  typedef int                     Curve_segment_index;
+  typedef int                     Corner_index;
+
+  typedef typename Base::R         Gt;
+  typedef Gt                       R;
+  typedef typename Base::Point_3   Point_3;
+  typedef typename Gt::FT          FT;
+
+  typedef CGAL::Tag_true           Has_features;
+
+
+#ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
+  template <typename ... T>
+  Mesh_domain_with_polyline_features_3(const T& ...t)
+    : Base(t...)
+    , current_corner_index_(1)
+    , current_curve_index_(1)
+    , curves_aabb_tree_is_built(false) {}
+#else
+  /// Constructors
+  /// Call the base class constructor
+  Mesh_domain_with_polyline_features_3()
+    : Base()
+    , current_corner_index_(1)
+    , current_curve_index_(1)
+    , curves_aabb_tree_is_built(false) {}
+
+  template <typename T1>
+  Mesh_domain_with_polyline_features_3(const T1& o1)
+    : Base(o1)
+    , current_corner_index_(1)
+    , current_curve_index_(1)
+    , curves_aabb_tree_is_built(false) {}
+
+  template <typename T1, typename T2>
+  Mesh_domain_with_polyline_features_3(const T1& o1, const T2& o2)
+    : Base(o1, o2)
+    , current_corner_index_(1)
+    , current_curve_index_(1)
+    , curves_aabb_tree_is_built(false) {}
+
+  template <typename T1, typename T2, typename T3>
+  Mesh_domain_with_polyline_features_3(const T1& o1, const T2& o2,
+                                       const T3& o3)
+    : Base(o1, o2, o3)
+    , current_corner_index_(1)
+    , current_curve_index_(1)
+    , curves_aabb_tree_is_built(false) {}
+
+  template <typename T1, typename T2, typename T3, typename T4>
+  Mesh_domain_with_polyline_features_3(const T1& o1, const T2& o2,
+                                       const T3& o3, const T4& o4)
+    : Base(o1, o2, o3, o4)
+    , current_corner_index_(1)
+    , current_curve_index_(1)
+    , curves_aabb_tree_is_built(false) {}
+#endif
+
+  /// Destructor
+  ~Mesh_domain_with_polyline_features_3() {}
+
+  /// OutputIterator value type is std::pair<Corner_index, Point_3>
+  template <typename OutputIterator>
+  OutputIterator get_corners(OutputIterator out) const;
+
+  /// OutputIterator value type is CGAL::cpp11::tuple<Curve_segment_index,
+  /// std::pair<Point_3,Index>, std::pair<Point_3,Index> >
+  template <typename OutputIterator>
+  OutputIterator get_curve_segments(OutputIterator out) const;
+
+  /// Returns the geodesic distance between points p and q of curve
+  /// \c curve_index
+  FT geodesic_distance(const Point_3& p, const Point_3& q,
+                       const Curve_segment_index& curve_index) const;
+
+  /// Construct a point on curve \c curve_index at geodesic distance \c distance
+  /// of \c starting_point
+  Point_3
+  construct_point_on_curve_segment(const Point_3& starting_point,
+                                   const Curve_segment_index& curve_index,
+                                   FT distance) const;
+
+  /// Returns the sign of the orientation of p,q,r along curve segment
+  /// of index \c index
+  CGAL::Sign distance_sign_along_cycle(const Point_3& p,
+                                       const Point_3& q,
+                                       const Point_3& r,
+                                       const Curve_segment_index& index) const;
+
+  /// Returns true if curve \c curve_index is a cycle
+  bool is_cycle(const Point_3&, const Curve_segment_index& index) const;
+
+  /// Returns an Index from a Curve_segment_index
+  Index index_from_curve_segment_index(const Curve_segment_index& index) const
+  { return Index(index); }
+
+  /// Returns an Curve_segment_index from an Index
+  Curve_segment_index curve_segment_index(const Index& index) const
+  { return boost::get<Curve_segment_index>(index); }
+
+  /// Returns an Index from a Corner_index
+  Index index_from_corner_index(const Corner_index& index) const
+  { return Index(index); }
+
+  /// Returns an Corner_index from an Index
+  Corner_index corner_index(const Index& index) const
+  { return boost::get<Corner_index>(index); }
+
+  /// Insert a bunch of edges into domain
+  ///   + InputIterator type should have begin() and end() function
+  ///   + InputIterator::iterator value type must be Point_3
+  //    + IndicesOutputIterator is an output iterator of value_type equal
+  ///   to Curve_segment_index
+  template <typename InputIterator, typename IndicesOutputIterator>
+  IndicesOutputIterator
+  add_features(InputIterator first, InputIterator last,
+               IndicesOutputIterator out /*= CGAL::Emptyset_iterator()*/);
+
+  template <typename InputIterator, typename IndicesOutputIterator>
+  IndicesOutputIterator
+  add_features_with_context(InputIterator first, InputIterator last,
+                            IndicesOutputIterator out /*=
+                                                        CGAL::Emptyset_iterator()*/);
+
+  template <typename IndicesOutputIterator>
+  IndicesOutputIterator
+  get_incidences(Curve_segment_index id, IndicesOutputIterator out) const;
+
+  template <typename IndicesOutputIterator>
+  IndicesOutputIterator
+  get_corner_incidences(Curve_segment_index id, IndicesOutputIterator out) const;
+
+  typedef std::set<Surface_patch_index> Surface_patch_index_set;
+
+  const Surface_patch_index_set&
+  get_incidences(Curve_segment_index id) const;
+
+  void display_corner_incidences(std::ostream& os, Corner_index id);
+
+  template <typename InputIterator>
+  void
+  add_features(InputIterator first, InputIterator last)
+  { add_features(first, last, CGAL::Emptyset_iterator()); }
+
+  /// Insert one edge into domain
+  /// InputIterator value type is Point_3
+  template <typename InputIterator>
+  Curve_segment_index insert_edge(InputIterator first, InputIterator last);
+
+private:
+  void register_corner(const Point_3& p, const Curve_segment_index& index);
+  void compute_corners_incidences();
+
+  /// Returns the sign of the geodesic distance between \c p and \c q
+  /// Precondition: index is not a cycle
+  CGAL::Sign distance_sign(const Point_3& p, const Point_3& q,
+                           const Curve_segment_index& index) const;
+
+  /// Returns Index associated to p (p must be the coordinates of a corner
+  /// point)
+  Index point_corner_index(const Point_3& p) const;
+
+private:
+  typedef std::map<Point_3,Corner_index> Corners;
+
+  typedef internal::Mesh_3::Polyline<Gt> Polyline;
+  typedef std::map<Curve_segment_index, Polyline> Edges;
+  typedef std::map<Curve_segment_index, Surface_patch_index_set > Edges_incidences;
+  typedef std::map<Corner_index, std::set<Curve_segment_index> > Corners_tmp_incidences;
+  typedef std::map<Corner_index, Surface_patch_index_set > Corners_incidences;
+
+  typedef internal::Mesh_3::Mesh_domain_segment_of_curve_primitive<
+    Gt,
+    typename Edges::const_iterator> Curves_primitives;
+
+  typedef CGAL::AABB_traits<Gt,
+                            Curves_primitives> AABB_curves_traits;
+
+  Corners corners_;
+  Corners_tmp_incidences corners_tmp_incidences_;
+  Corner_index current_corner_index_;
+  Corners_incidences corners_incidences_;
+
+  Edges edges_;
+  Curve_segment_index current_curve_index_;
+  Edges_incidences edges_incidences_;
+
+public:
+  typedef CGAL::AABB_tree<AABB_curves_traits> Curves_AABB_tree;
+
+private:
+  mutable Curves_AABB_tree curves_aabb_tree_;
+  mutable bool curves_aabb_tree_is_built;
+
+public:
+  const Curves_AABB_tree& curves_aabb_tree() const {
+    if(!curves_aabb_tree_is_built) build_curves_aabb_tree();
+    return curves_aabb_tree_;
+  }
+
+  void build_curves_aabb_tree() const {
+    std::cerr << "Building curves AABB tree...\n";
+    curves_aabb_tree_.clear();
+    for(typename Edges::const_iterator
+          edges_it = edges_.begin(),
+          edges_end = edges_.end();
+        edges_it != edges_end; ++edges_it)
+    {
+      const Polyline& polyline = edges_it->second;
+      for(typename Polyline::const_iterator
+            pit = polyline.points_.begin(),
+            end = polyline.points_.end() - 1;
+          pit != end; ++pit)
+      {
+        curves_aabb_tree_.insert(std::make_pair(edges_it, pit));
+      }
+    }
+    curves_aabb_tree_.build();
+    curves_aabb_tree_is_built = true;
+  } // end build_curves_aabb_tree()
+
+private:
+  // Disabled copy constructor & assignment operator
+  typedef Mesh_domain_with_polyline_features_3 Self;
+  Mesh_domain_with_polyline_features_3(const Self& src);
+  Self& operator=(const Self& src);
+
+};  // end class Mesh_domain_with_polyline_features_3
+
+
+
+template <class MD_>
+template <typename OutputIterator>
+OutputIterator
+Mesh_domain_with_polyline_features_3<MD_>::
+get_corners(OutputIterator out) const
+{
+  for ( typename Corners::const_iterator
+       cit = corners_.begin(), end = corners_.end() ; cit != end ; ++cit )
+  {
+    *out++ = std::make_pair(cit->second,cit->first);
+  }
+
+  return out;
+}
+
+template <class MD_>
+template <typename OutputIterator>
+OutputIterator
+Mesh_domain_with_polyline_features_3<MD_>::
+get_curve_segments(OutputIterator out) const
+{
+  for ( typename Edges::const_iterator
+       eit = edges_.begin(), end = edges_.end() ; eit != end ; ++eit )
+  {
+    CGAL_assertion( eit->second.is_valid() );
+
+    const Point_3& p = eit->second.start_point();
+    const Point_3& q = eit->second.end_point();
+
+    Index p_index, q_index;
+    if ( ! eit->second.is_cycle() )
+    {
+      p_index = point_corner_index(p);
+      q_index = point_corner_index(q);
+    }
+    else
+    {
+      p_index = index_from_curve_segment_index(eit->first);
+      q_index = p_index;
+    }
+
+    *out++ = CGAL::cpp11::make_tuple(eit->first,
+                                     std::make_pair(p,p_index),
+                                     std::make_pair(q,q_index));
+  }
+
+  return out;
+}
+
+
+template <class MD_>
+typename Mesh_domain_with_polyline_features_3<MD_>::Index
+Mesh_domain_with_polyline_features_3<MD_>::
+point_corner_index(const Point_3& p) const
+{
+  typename Corners::const_iterator p_index_it = corners_.find(p);
+  if ( p_index_it == corners_.end() )
+  {
+    CGAL_assertion(false);
+    return Index();
+  }
+
+  return p_index_it->second;
+}
+
+
+template <class MD_>
+typename Mesh_domain_with_polyline_features_3<MD_>::FT
+Mesh_domain_with_polyline_features_3<MD_>::
+geodesic_distance(const Point_3& p, const Point_3& q,
+                  const Curve_segment_index& curve_index) const
+{
+  // Get corresponding polyline
+  typename Edges::const_iterator eit = edges_.find(curve_index);
+  CGAL_assertion(eit != edges_.end());
+
+  // Compute geodesic_distance
+  return eit->second.geodesic_distance(p,q);
+}
+
+
+template <class MD_>
+typename Mesh_domain_with_polyline_features_3<MD_>::Point_3
+Mesh_domain_with_polyline_features_3<MD_>::
+construct_point_on_curve_segment(const Point_3& starting_point,
+                                 const Curve_segment_index& curve_index,
+                                 FT distance) const
+{
+  // Get corresponding polyline
+  typename Edges::const_iterator eit = edges_.find(curve_index);
+  CGAL_assertion(eit != edges_.end());
+
+  // Return point at geodesic_distance distance from starting_point
+  return eit->second.point_at(starting_point,distance);
+}
+
+
+
+template <class MD_>
+template <typename InputIterator, typename IndicesOutputIterator>
+IndicesOutputIterator
+Mesh_domain_with_polyline_features_3<MD_>::
+add_features(InputIterator first, InputIterator last,
+             IndicesOutputIterator indices_out)
+{
+  // Insert one edge for each element
+  while ( first != last )
+  {
+    *indices_out++ = insert_edge(first->begin(), first->end());
+    ++first;
+  }
+  compute_corners_incidences();
+  return indices_out;
+}
+
+template <class MD_>
+template <typename InputIterator, typename IndicesOutputIterator>
+IndicesOutputIterator
+Mesh_domain_with_polyline_features_3<MD_>::
+add_features_with_context(InputIterator first, InputIterator last,
+                          IndicesOutputIterator indices_out)
+{
+  // Insert one edge for each element
+  for( ; first != last ; ++first )
+  {
+    Curve_segment_index curve_id =
+      insert_edge(first->polyline_content.begin(), first->polyline_content.end());
+    edges_incidences_[curve_id] = first->context.adjacent_patches_ids;
+    *indices_out++ = curve_id;
+  }
+  compute_corners_incidences();
+  return indices_out;
+}
+
+template <class MD_>
+template <typename IndicesOutputIterator>
+IndicesOutputIterator
+Mesh_domain_with_polyline_features_3<MD_>::
+get_incidences(Curve_segment_index id,
+               IndicesOutputIterator indices_out) const
+{
+  typename Edges_incidences::const_iterator it = edges_incidences_.find(id);
+
+  if(it == edges_incidences_.end()) return indices_out;
+
+  const Surface_patch_index_set& incidences = it->second;
+
+  return std::copy(incidences.begin(), incidences.end(), indices_out);
+}
+
+template <class MD_>
+template <typename IndicesOutputIterator>
+IndicesOutputIterator
+Mesh_domain_with_polyline_features_3<MD_>::
+get_corner_incidences(Corner_index id,
+                      IndicesOutputIterator indices_out) const
+{
+  typename Corners_incidences::const_iterator it = corners_incidences_.find(id);
+  const Surface_patch_index_set& incidences = it->second;
+  return std::copy(incidences.begin(), incidences.end(), indices_out);
+}
+
+namespace internal { namespace Mesh_3 {
+
+template <typename MDwPF_, bool curve_id_is_streamable>
+// here 'curve_id_is_streamable' is true
+template <typename Container2>
+void
+Display_incidences_to_curves_aux<MDwPF_,curve_id_is_streamable>::
+operator()(std::ostream& os, typename MDwPF_::Curve_segment_index id,
+           const Container2& corners_tmp_incidences_of_id) const
+{
+  os << "Corner #" << id << " is incident to the following curves: {";
+  BOOST_FOREACH(typename MDwPF_::Curve_segment_index curve_index,
+                corners_tmp_incidences_of_id)
+  {
+    os << " " << curve_index;
+  }
+  os << " }\n";
+}
+
+template <class MDwPF_>
+// here 'curve_id_is_streamable' is false
+template <typename Container2>
+void
+Display_incidences_to_curves_aux<MDwPF_,false>::
+operator()(std::ostream& os, typename MDwPF_::Curve_segment_index id,
+           const Container2& corners_tmp_incidences_of_id) const
+{
+  os << "Corner #" << id << " is incident to "
+     << corners_tmp_incidences_of_id .size()
+     << " curve(s).\n";
+}
+
+template <typename MDwPF_, bool patch_id_is_streamable>
+// here 'patch_id_is_streamable' is true
+template <typename Container>
+void
+Display_incidences_to_patches_aux<MDwPF_,patch_id_is_streamable>::
+operator()(std::ostream& os, typename MDwPF_::Curve_segment_index id,
+           const Container& corners_incidences_of_id) const
+{
+  os << "Corner #" << id << " is incident to the following patches: {";
+  BOOST_FOREACH(typename MDwPF_::Surface_patch_index i,
+                corners_incidences_of_id)
+  {
+    os << " " << i;
+  }
+  os << " }\n";
+}
+
+template <class MDwPF_>
+// here 'patch_id_is_streamable' is false
+template <typename Container>
+void
+Display_incidences_to_patches_aux<MDwPF_,false>::
+operator()(std::ostream& os, typename MDwPF_::Curve_segment_index id,
+           const Container& corners_incidences_id) const
+{
+  os << "Corner #" << id << " is incident to "
+     << corners_incidences_id.size()
+     << " surface patch(es).\n";
+}
+
+}} // end namespaces internal::Mesh_3:: and internal::
+
+template <class MD_>
+void
+Mesh_domain_with_polyline_features_3<MD_>::
+display_corner_incidences(std::ostream& os, Corner_index id)
+{
+  typedef Mesh_domain_with_polyline_features_3<MD_> Mdwpf;
+  typedef is_streamable<Surface_patch_index> i_s_spi;
+  typedef is_streamable<Curve_segment_index> i_s_csi;
+
+  using namespace internal::Mesh_3;
+  typedef Display_incidences_to_curves_aux<Mdwpf,i_s_csi::value> D_i_t_c;
+  typedef Display_incidences_to_patches_aux<Mdwpf,i_s_spi::value> D_i_t_p;
+  D_i_t_c()(os, id, corners_tmp_incidences_[id]);
+  D_i_t_p()(os, id, corners_incidences_[id]);
+}
+
+template <class MD_>
+void
+Mesh_domain_with_polyline_features_3<MD_>::
+compute_corners_incidences()
+{
+  for(typename Corners::iterator
+        cit = corners_.begin(), end = corners_.end();
+      cit != end; /* the loop variable is incremented in the  body */)
+  {
+    const Corner_index id = cit->second;
+
+    const typename Corners_tmp_incidences::mapped_type&
+      corner_tmp_incidences = corners_tmp_incidences_[id];
+
+    // If the corner is incident to only one curve, and that curve is a
+    // cycle, then remove the corner from the set.
+    if(corner_tmp_incidences.size() == 1 &&
+       is_cycle(Point_3(), *corner_tmp_incidences.begin()))
+    {
+      typename Corners::iterator to_erase = cit;
+      ++cit;
+      corners_.erase(to_erase);
+      continue;
+    }
+
+    Surface_patch_index_set& incidences = corners_incidences_[id];
+    // That should be an empty set.
+
+    BOOST_FOREACH(Curve_segment_index curve_index, corner_tmp_incidences)
+    {
+      get_incidences(curve_index,
+                     std::inserter(incidences,
+                                   incidences.begin()));
+    }
+#ifdef CGAL_MESH_3_PROTECTION_DEBUG
+    display_corner_incidences(std::cerr, id);
+#endif // CGAL_MESH_3_PROTECTION_DEBUG
+
+    // increment the loop variable
+    ++cit;
+  }
+}
+
+template <class MD_>
+const typename Mesh_domain_with_polyline_features_3<MD_>::Surface_patch_index_set&
+Mesh_domain_with_polyline_features_3<MD_>::
+get_incidences(Curve_segment_index id) const
+{
+  typename Edges_incidences::const_iterator it = edges_incidences_.find(id);
+  return it->second;
+}
+
+template <class MD_>
+void
+Mesh_domain_with_polyline_features_3<MD_>::
+register_corner(const Point_3& p, const Curve_segment_index& curve_index)
+{
+
+  typename Corners::iterator cit = corners_.lower_bound(p);
+
+  // If the corner already exists, returns...
+  if(cit != corners_.end() && !(corners_.key_comp()(p, cit->first))) {
+    corners_tmp_incidences_[cit->second].insert(curve_index);
+    return;
+  }
+
+  // ...else insert it!
+
+  const Corner_index index = current_corner_index_;
+  ++current_corner_index_;
+
+  corners_.insert(cit, std::make_pair(p, index));
+  corners_tmp_incidences_[index].insert(curve_index);
+}
+
+template <class MD_>
+template <typename InputIterator>
+typename Mesh_domain_with_polyline_features_3<MD_>::Curve_segment_index
+Mesh_domain_with_polyline_features_3<MD_>::
+insert_edge(InputIterator first, InputIterator last)
+{
+  CGAL_assertion(std::distance(first,last) > 1);
+
+  const Curve_segment_index curve_index = current_curve_index_++;
+
+  // Fill corners
+  //
+  // For a cycle, the "first" point of the cycle is registered as a
+  // corner. If at the end, during the call to
+  // 'compute_corners_incidences()', that corner is incident only to a
+  // cycle, then it will be removed from the set of corners.
+  register_corner(*first, curve_index);
+  if ( *first != *boost::prior(last) )
+  {
+    register_corner(*boost::prior(last), curve_index);
+  }
+
+  // Create a new polyline
+  std::pair<typename Edges::iterator,bool> insertion =
+    edges_.insert(std::make_pair(curve_index,Polyline()));
+
+  // Fill polyline with data
+  while ( first != last )
+  {
+    insertion.first->second.add_point(*first++);
+  }
+  return curve_index;
+}
+
+
+template <class MD_>
+CGAL::Sign
+Mesh_domain_with_polyline_features_3<MD_>::
+distance_sign(const Point_3& p, const Point_3& q,
+              const Curve_segment_index& index) const
+{
+  typename Edges::const_iterator eit = edges_.find(index);
+  CGAL_assertion(eit != edges_.end());
+  CGAL_precondition( ! eit->second.is_cycle() );
+
+  if ( p == q )
+    return CGAL::ZERO;
+  else if ( eit->second.are_ordered_along(p,q) )
+    return CGAL::POSITIVE;
+  else
+    return CGAL::NEGATIVE;
+}
+
+template <class MD_>
+CGAL::Sign
+Mesh_domain_with_polyline_features_3<MD_>::
+distance_sign_along_cycle(const Point_3& p,
+                          const Point_3& q,
+                          const Point_3& r,
+                          const Curve_segment_index& index) const
+{
+  // Find edge
+  typename Edges::const_iterator eit = edges_.find(index);
+  CGAL_assertion(eit != edges_.end());
+
+  // If eit is not a cycle, then the orientation corresponds to the sign
+  // of the distance
+  if ( ! eit->second.is_cycle() )
+  {
+    return distance_sign(p,r,index);
+  }
+
+  // If p and r are the same point, it correspond to a complete loop on a cycle
+  if ( p == r ) { return CGAL::POSITIVE; }
+
+  // We are on a cycle without any clue (p==q). Return the shortest path as
+  // orientation.
+  if ( p == q )
+  {
+    FT pr = eit->second.geodesic_distance(p,r);
+    FT rp = eit->second.geodesic_distance(r,p);
+    if ( pr < rp ) { return CGAL::POSITIVE; }
+    else { return CGAL::NEGATIVE; }
+  }
+
+  // If pq or pr is negative, edge is not a cycle, thus geodesic_distance
+  // gives the answer.
+  FT pq = eit->second.geodesic_distance(p,q);
+  FT pr = eit->second.geodesic_distance(p,r);
+  CGAL_assertion(pq > FT(0));
+  CGAL_assertion(pr > FT(0));
+
+  // Compare pq and pr
+  if ( pq <= pr ) { return CGAL::POSITIVE; }
+  else { return CGAL::NEGATIVE; }
+}
+
+template <class MD_>
+bool
+Mesh_domain_with_polyline_features_3<MD_>::
+is_cycle(const Point_3&, const Curve_segment_index& index) const
+{
+  // Find edge
+  typename Edges::const_iterator eit = edges_.find(index);
+  CGAL_assertion(eit != edges_.end());
+
+  return eit->second.is_cycle();
+}
+
+
+} //namespace CGAL
+
+
+#endif // CGAL_MESH_DOMAIN_WITH_POLYLINE_FEATURES_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_edge_criteria_3.h b/3rdparty/CGAL/include/CGAL/Mesh_edge_criteria_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_edge_criteria_3.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_edge_criteria_3.h
diff --git a/3rdparty/CGAL/include/CGAL/Mesh_facet_criteria_3.h b/3rdparty/CGAL/include/CGAL/Mesh_facet_criteria_3.h
new file mode 100644
index 0000000..41c5d29
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Mesh_facet_criteria_3.h
@@ -0,0 +1,233 @@
+// Copyright (c) 2009 INRIA Sophia-Antipolis (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
+// 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(s)     : Stéphane Tayeb
+//
+//******************************************************************************
+// File Description :
+// Mesh_facet_criteria_3 class.
+//******************************************************************************
+
+#ifndef CGAL_MESH_FACET_CRITERIA_3_H
+#define CGAL_MESH_FACET_CRITERIA_3_H
+
+#include <CGAL/Mesh_3/mesh_standard_facet_criteria.h>
+#include <CGAL/Mesh_facet_topology.h>
+
+namespace CGAL {
+  
+template<typename Tr,
+         typename Visitor_ = Mesh_3::Facet_criterion_visitor_with_features<Tr> >
+class Mesh_facet_criteria_3
+{
+public:
+  typedef Visitor_ Visitor;
+  typedef typename Visitor::Facet_quality Facet_quality;
+  typedef typename Visitor::Facet_badness Facet_badness;
+  
+private:
+  typedef Mesh_3::Criteria<Tr,Visitor> Criteria;
+  typedef Mesh_3::Abstract_criterion<Tr,Visitor> Abstract_criterion;
+
+  typedef typename Tr::Facet Facet;
+  typedef typename Tr::Geom_traits::FT FT;
+
+  typedef Mesh_facet_criteria_3<Tr> Self;
+
+public:
+  typedef CGAL::Tag_true Has_manifold_criterion;
+
+  /**
+   * @brief Constructor
+   */
+  Mesh_facet_criteria_3(const FT& angle_bound,
+                        const FT& radius_bound,
+                        const FT& distance_bound,
+                        const Mesh_facet_topology topology =
+                          FACET_VERTICES_ON_SURFACE)
+  {
+    if ( FT(0) != angle_bound )
+      init_aspect(angle_bound);
+    
+    if ( FT(0) != radius_bound )
+      init_radius_bound(radius_bound);
+    
+    if ( FT(0) != distance_bound )
+      init_distance_bound(distance_bound);
+    
+    init_topo(topology);
+  }
+
+  // Nb: SFINAE (dummy) to avoid wrong matches with built-in numerical types
+  // as int.
+  template < typename Sizing_field >
+  Mesh_facet_criteria_3(const FT& angle_bound,
+                        const Sizing_field& radius_bound,
+                        const FT& distance_bound,
+                        const Mesh_facet_topology topology = 
+                          FACET_VERTICES_ON_SURFACE,
+                        typename Sizing_field::FT /*dummy*/ = 0)
+  {
+    if ( FT(0) != angle_bound )
+      init_aspect(angle_bound);
+    
+    init_radius_field(radius_bound);
+    
+    if ( FT(0) != distance_bound )
+      init_distance_bound(distance_bound);
+    
+    init_topo(topology);  
+  }
+  
+  // Nb: SFINAE (dummy) to avoid wrong matches with built-in numerical types
+  // as int.
+  template < typename Sizing_field >
+  Mesh_facet_criteria_3(const FT& angle_bound,
+                        const FT& radius_bound,
+                        const Sizing_field& distance_bound,
+                        const Mesh_facet_topology topology =
+                          FACET_VERTICES_ON_SURFACE,
+                        typename Sizing_field::FT /*dummy*/ = 0)
+  {
+    if ( FT(0) != angle_bound )
+      init_aspect(angle_bound);
+
+    if ( FT(0) != radius_bound )
+      init_radius_bound(radius_bound);
+
+    init_distance_field(distance_bound);
+
+    init_topo(topology);
+  }
+
+  // Nb: SFINAE (dummy) to avoid wrong matches with built-in numerical types
+  // as int.
+  template < typename Sizing_field, typename Sizing_field2 >
+  Mesh_facet_criteria_3(const FT& angle_bound,
+                        const Sizing_field & radius_bound,
+                        const Sizing_field2& distance_bound,
+                        const Mesh_facet_topology topology =
+                          FACET_VERTICES_ON_SURFACE,
+                        typename Sizing_field::FT /*dummy*/ = 0,
+                        typename Sizing_field2::FT /*dummy*/ = 0)
+  {
+    if ( FT(0) != angle_bound )
+      init_aspect(angle_bound);
+
+    init_radius_field(radius_bound);
+
+    init_distance_field(distance_bound);
+
+    init_topo(topology);
+  }
+
+/// Destructor
+  ~Mesh_facet_criteria_3() { }
+
+   /**
+   * @brief returns the badness of facet \c facet
+   * @param facet the facet
+   * @return the badness of \c facet
+   */
+  Facet_badness operator()(const Facet& facet) const
+  {
+    return criteria_(facet);
+  }
+  
+  void add(Abstract_criterion* criterion)
+  {
+    criteria_.add(criterion);
+  }
+
+  Mesh_facet_topology topology() const {
+    return topology_;
+  }
+
+private:
+  void init_aspect(const FT& angle_bound)
+  {
+    typedef Mesh_3::Aspect_ratio_criterion<Tr,Visitor> Aspect_criterion;
+    criteria_.add(new Aspect_criterion(angle_bound));
+  }
+  
+  void init_radius_bound(const FT& radius_bound)
+  {
+    typedef Mesh_3::Uniform_size_criterion<Tr,Visitor> Uniform_size_criterion;
+    criteria_.add(new Uniform_size_criterion(radius_bound));
+  }
+  
+  template <typename Sizing_field>
+  void init_radius_field(const Sizing_field& radius_bound)
+  {
+    typedef Mesh_3::Variable_size_criterion<Tr,Visitor,Sizing_field> Variable_size_criterion;
+    criteria_.add(new Variable_size_criterion(radius_bound));
+  }
+  
+  void init_distance_bound(const FT& distance_bound)
+  {
+    typedef Mesh_3::Uniform_curvature_size_criterion<Tr,Visitor> Criterion;
+    criteria_.add(new Criterion(distance_bound));
+  }
+  
+  template <typename Sizing_field>
+  void init_distance_field(const Sizing_field& distance_bound)
+  {
+    typedef Mesh_3::Variable_curvature_size_criterion<Tr,
+                                                      Visitor,
+                                                      Sizing_field> Criterion;
+    criteria_.add(new Criterion(distance_bound));
+  }
+  
+  void init_topo(const Mesh_facet_topology topology)
+  {
+    topology_ = topology;
+    switch ( topology % MANIFOLD )
+    {
+      case FACET_VERTICES_ON_SURFACE:
+      {
+        typedef Mesh_3::Facet_on_surface_criterion<Tr,Visitor> On_surface_criterion;
+        criteria_.add(new On_surface_criterion());
+        break;
+      }
+        
+      case FACET_VERTICES_ON_SAME_SURFACE_PATCH:
+      {
+        typedef Mesh_3::Facet_on_same_surface_criterion<Tr,Visitor> Same_surface_criterion;
+        criteria_.add(new Same_surface_criterion());
+        break;
+      }
+      
+      case FACET_VERTICES_ON_SAME_SURFACE_PATCH_WITH_ADJACENCY_CHECK:
+      {
+        // @TODO: Implement adjacency check !
+        typedef Mesh_3::Facet_on_same_surface_criterion<Tr,Visitor> Same_surface_criterion;
+        criteria_.add(new Same_surface_criterion());
+        break;
+      }
+    }
+  }
+  
+private:
+  Criteria criteria_;
+  Mesh_facet_topology topology_;
+};  // end class Mesh_facet_criteria_3
+
+}  // end namespace CGAL
+
+
+#endif // CGAL_MESH_FACET_CRITERIA_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_facet_topology.h b/3rdparty/CGAL/include/CGAL/Mesh_facet_topology.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_facet_topology.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_facet_topology.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_optimization_return_code.h b/3rdparty/CGAL/include/CGAL/Mesh_optimization_return_code.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_optimization_return_code.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_optimization_return_code.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesh_polyhedron_3.h b/3rdparty/CGAL/include/CGAL/Mesh_polyhedron_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesh_polyhedron_3.h
rename to 3rdparty/CGAL/include/CGAL/Mesh_polyhedron_3.h
diff --git a/3rdparty/CGAL/include/CGAL/Mesh_triangulation_3.h b/3rdparty/CGAL/include/CGAL/Mesh_triangulation_3.h
new file mode 100644
index 0000000..e4f02e4
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Mesh_triangulation_3.h
@@ -0,0 +1,121 @@
+// Copyright (c) 2006-2009 INRIA Sophia-Antipolis (France).
+// Copyright (c) 2011      GeometryFactory Sarl (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
+// 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(s)     : Laurent Rineau, Stephane Tayeb
+
+
+#ifndef CGAL_MESH_TRIANGULATION_3_H
+#define CGAL_MESH_TRIANGULATION_3_H
+
+#include <CGAL/Mesh_3/config.h>
+
+#include <CGAL/Kernel_traits.h>
+
+#include <CGAL/Regular_triangulation_3.h>
+#include <CGAL/Regular_triangulation_euclidean_traits_3.h>
+#include <CGAL/Mesh_3/Robust_weighted_circumcenter_filtered_traits_3.h>
+
+#include <CGAL/Mesh_vertex_base_3.h>
+#include <CGAL/Compact_mesh_cell_base_3.h>
+
+namespace CGAL {
+  
+  namespace details {
+    
+    template<typename K>
+    struct Mesh_geom_traits_generator
+    {
+    private:
+      typedef Robust_weighted_circumcenter_filtered_traits_3<K>
+        Geom_traits;
+      
+    public:
+      typedef Geom_traits type;
+      typedef type Type;
+    };  // end struct Mesh_geom_traits_generator
+    
+  }  // end namespace details
+  
+  
+// Struct Mesh_triangulation_3
+//
+template<class MD,
+         class K_ = Default,
+         class Concurrency_tag = Sequential_tag,
+         class Vertex_base_ = Default,
+         class Cell_base_   = Default>
+struct Mesh_triangulation_3;
+
+// Sequential version (default)
+template<class MD, class K_, class Concurrency_tag,
+         class Vertex_base_, class Cell_base_>
+struct Mesh_triangulation_3
+{
+private:
+  typedef typename Default::Get<K_, typename Kernel_traits<MD>::Kernel>::type K;
+
+  typedef typename details::Mesh_geom_traits_generator<K>::type Geom_traits;
+
+  typedef typename Default::Get<
+    Vertex_base_, 
+    Mesh_vertex_base_3<Geom_traits, MD> >::type                 Vertex_base;
+  typedef typename Default::Get<
+    Cell_base_, 
+    Compact_mesh_cell_base_3<Geom_traits, MD> >::type           Cell_base;
+
+  typedef Triangulation_data_structure_3<Vertex_base,Cell_base> Tds;
+  typedef Regular_triangulation_3<Geom_traits, Tds>             Triangulation;
+
+public:
+  typedef Triangulation type;
+  typedef type Type;
+};  // end struct Mesh_triangulation_3
+
+#ifdef CGAL_LINKED_WITH_TBB
+// Parallel version (specialization)
+//
+template<class MD, class K_,
+         class Vertex_base_, class Cell_base_>
+struct Mesh_triangulation_3<MD, K_, Parallel_tag, Vertex_base_, Cell_base_>
+{
+private:
+  typedef typename Default::Get<K_, typename Kernel_traits<MD>::Kernel>::type K;
+
+  typedef typename details::Mesh_geom_traits_generator<K>::type Geom_traits;
+
+  typedef typename Default::Get<
+    Vertex_base_, 
+    Mesh_vertex_base_3<Geom_traits, MD> >::type                 Vertex_base;
+  typedef typename Default::Get<
+    Cell_base_, 
+    Compact_mesh_cell_base_3<Geom_traits, MD> >::type           Cell_base;
+
+  typedef Triangulation_data_structure_3<
+    Vertex_base, Cell_base, Parallel_tag>                       Tds;
+  typedef Regular_triangulation_3<Geom_traits, Tds>             Triangulation;
+
+public:
+  typedef Triangulation type;
+  typedef type Type;
+};  // end struct Mesh_triangulation_3
+#endif // CGAL_LINKED_WITH_TBB
+
+}  // end namespace CGAL
+
+#endif // CGAL_MESH_TRIANGULATION_3_H
diff --git a/3rdparty/CGAL/include/CGAL/Mesh_vertex_base_3.h b/3rdparty/CGAL/include/CGAL/Mesh_vertex_base_3.h
new file mode 100644
index 0000000..5e1fdb1
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Mesh_vertex_base_3.h
@@ -0,0 +1,313 @@
+// Copyright (c) 2009 INRIA Sophia-Antipolis (France).
+// Copyright (c) 2011 GeometryFactory Sarl (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
+// 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: https://scm.gforge.inria.fr/svn/cgal/branches/features/Mesh_3-experimental-GF/Mesh_3/include/CGAL/Mesh_vertex_base_3.h $
+// $Id: Mesh_vertex_base_3.h 69674 2012-06-18 09:34:06Z jtournoi $
+//
+//
+// Author(s)     : Stéphane Tayeb, Andreas Fabri
+//
+//******************************************************************************
+// File Description :
+//
+//
+//******************************************************************************
+
+
+#ifndef CGAL_COMPACT_MESH_VERTEX_BASE_3_H
+#define CGAL_COMPACT_MESH_VERTEX_BASE_3_H
+
+#include <CGAL/Triangulation_vertex_base_3.h>
+#include <CGAL/internal/Mesh_3/get_index.h>
+#include <CGAL/Mesh_3/io_signature.h>
+#include <CGAL/Has_timestamp.h>
+#include <CGAL/tags.h>
+
+namespace CGAL {
+  
+// Without erase counter
+template <typename Concurrency_tag>
+class Mesh_vertex_base_3_base
+{
+#if defined(CGAL_MESH_3_USE_LAZY_SORTED_REFINEMENT_QUEUE) \
+ || defined(CGAL_MESH_3_USE_LAZY_UNSORTED_REFINEMENT_QUEUE)
+
+public:
+  // Erase counter (cf. Compact_container)
+  unsigned int erase_counter() const
+  {
+    return this->m_erase_counter;
+  }
+  void set_erase_counter(unsigned int c)
+  {
+    this->m_erase_counter = c;
+  }
+  void increment_erase_counter()
+  {
+    ++this->m_erase_counter;
+  }
+  
+protected:
+  typedef unsigned int              Erase_counter_type;
+  Erase_counter_type                m_erase_counter;
+#endif
+};
+
+#ifdef CGAL_LINKED_WITH_TBB
+// Specialized version (parallel)
+template <>
+class Mesh_vertex_base_3_base<Parallel_tag>
+{
+public:
+  
+  // Erase counter (cf. Compact_container)
+  unsigned int erase_counter() const
+  {
+    return this->m_erase_counter;
+  }
+  void set_erase_counter(unsigned int c)
+  {
+    this->m_erase_counter = c;
+  }
+  void increment_erase_counter()
+  {
+    ++this->m_erase_counter;
+  }
+  
+protected:
+  typedef tbb::atomic<unsigned int> Erase_counter_type;
+  Erase_counter_type                m_erase_counter;
+
+};
+#endif // CGAL_LINKED_WITH_TBB
+
+// Class Mesh_vertex_base_3
+// Vertex base class used in 3D meshing process.
+// Adds information to Vb about the localization of the vertex in regards
+// to the 3D input complex.
+template<class GT,
+         class MD,
+         class Vb = Triangulation_vertex_base_3<GT> >
+class Mesh_vertex_base_3
+: public Vb,
+  public Mesh_vertex_base_3_base<
+    typename Vb::Triangulation_data_structure::Concurrency_tag>
+{
+public:
+  typedef Vb Cmvb3_base;
+  typedef typename Vb::Vertex_handle  Vertex_handle;
+
+  // To get correct vertex type in TDS
+  template < class TDS3 >
+  struct Rebind_TDS {
+    typedef typename Vb::template Rebind_TDS<TDS3>::Other Vb3;
+    typedef Mesh_vertex_base_3 <GT, MD, Vb3> Other;
+  };
+
+  // Types
+  typedef typename MD::Index                      Index;
+  typedef typename GT::FT                         FT;
+
+  // Constructor
+  Mesh_vertex_base_3()
+    : Vb()
+    , number_of_incident_facets_(0)
+    , number_of_components_(0)
+    , index_()
+    , meshing_info_(0)
+    , dimension_(-1)
+    , cache_validity(false)
+#ifdef CGAL_INTRUSIVE_LIST
+    , next_intrusive_()
+    , previous_intrusive_()
+#endif //CGAL_INTRUSIVE_LIST
+    , time_stamp_(-1)
+  {}
+
+  // Default copy constructor and assignment operator are ok
+
+  // Returns the dimension of the lowest dimensional face of the input 3D
+  // complex that contains the vertex
+  int in_dimension() const {
+    if(dimension_ < -1) return -2-dimension_;
+    else return dimension_; 
+  }
+
+  // Sets the dimension of the lowest dimensional face of the input 3D complex
+  // that contains the vertex
+  void set_dimension(const int dimension) {
+    CGAL_assertion(dimension < 4);
+    dimension_ = short(dimension);
+  }
+
+  // Tells if the vertex is marked as a special protecting ball
+  bool is_special() const { return dimension_ < -1; }
+
+  // Marks or unmarks the vertex as a special protecting ball
+  void set_special(bool special = true) {
+    if(special != (dimension_ < -1) )
+      dimension_ = short(-2-dimension_);
+  }
+
+  // Returns the index of the lowest dimensional face of the input 3D complex
+  // that contains the vertex
+  Index index() const { return index_; }
+
+  // Sets the index of the lowest dimensional face of the input 3D complex
+  // that contains the vertex
+  void set_index(const Index& index) { index_ = index; }
+
+  // Accessors to meshing_info private data
+  const FT& meshing_info() const { return meshing_info_; }
+  void set_meshing_info(const FT& value) { meshing_info_ = value; }
+
+#ifdef CGAL_INTRUSIVE_LIST
+  Vertex_handle next_intrusive() const { return next_intrusive_; }
+  void set_next_intrusive(Vertex_handle v)
+  { 
+    next_intrusive_ = v;
+  }
+
+  Vertex_handle previous_intrusive() const { return previous_intrusive_; }
+  void set_previous_intrusive(Vertex_handle v)
+  {
+    previous_intrusive_ = v; 
+  }
+#endif
+
+  /// For the determinism of Compact_container iterators
+  ///@{
+  typedef Tag_true Has_timestamp;
+
+  std::size_t time_stamp() const {
+    return time_stamp_;
+  }
+  void set_time_stamp(const std::size_t& ts) {
+    time_stamp_ = ts;
+  }
+  ///@}
+
+  bool is_c2t3_cache_valid() const {
+    return cache_validity;
+  }
+
+  void invalidate_c2t3_cache()
+  {
+    cache_validity = false;
+  }
+
+  void set_c2t3_cache(const std::size_t i, const std::size_t j)
+  {
+    number_of_incident_facets_ = i;
+    number_of_components_ = j;
+    cache_validity = true;
+  }
+
+  std::size_t cached_number_of_incident_facets() const
+  {
+    return number_of_incident_facets_;
+  }
+    
+  std::size_t cached_number_of_components() const
+  {
+    return number_of_components_;
+  }
+
+  static
+  std::string io_signature()
+  {
+    return 
+      Get_io_signature<Vb>()() + "+" +
+      Get_io_signature<int>()() + "+" +
+      Get_io_signature<Index>()();
+  }
+private:
+
+  std::size_t number_of_incident_facets_;
+  std::size_t number_of_components_; // number of components in the adjacency
+  // graph of incident facets (in complex)
+
+
+  // Index of the lowest dimensional face of the input 3D complex
+  // that contains me
+  Index index_;
+  // Stores info needed by optimizers
+  FT meshing_info_;
+
+  // Dimension of the lowest dimensional face of the input 3D complex
+  // that contains me. Negative values are a marker for special vertices.
+  short dimension_;
+  bool cache_validity;
+#ifdef CGAL_INTRUSIVE_LIST
+  Vertex_handle next_intrusive_;
+  Vertex_handle previous_intrusive_;
+#endif
+  std::size_t time_stamp_;
+
+};  // end class Mesh_vertex_base_3
+
+template<class GT,
+         class MD,
+         class Vb>
+inline
+std::istream&
+operator>>(std::istream &is, Mesh_vertex_base_3<GT,MD,Vb>& v)
+{
+  typedef Mesh_vertex_base_3<GT,MD,Vb> Vertex;
+  typedef typename Vertex::Cmvb3_base Cmvb3_base;
+  is >> static_cast<Cmvb3_base&>(v);
+  int dimension;
+  if(is_ascii(is)) {
+    is >> dimension;
+
+  } else {
+    CGAL::read(is, dimension);
+  }
+  v.set_dimension(dimension);
+  CGAL_assertion(v.in_dimension() >= -1);
+  CGAL_assertion(v.in_dimension() < 4);
+  typename Vertex::Index index =
+    internal::Mesh_3::Read_mesh_domain_index<MD>()(v.in_dimension(), is);
+  v.set_index(index);
+  return is;
+}
+
+template<class GT,
+         class MD,
+         class Vb>
+inline
+std::ostream&
+operator<<(std::ostream &os, const Mesh_vertex_base_3<GT,MD,Vb>& v)
+{
+  typedef Mesh_vertex_base_3<GT,MD,Vb> Vertex;
+  typedef typename Vertex::Cmvb3_base Cmvb3_base;
+  os << static_cast<const Cmvb3_base&>(v);
+  if(is_ascii(os)) {
+    os << " " << v.in_dimension()
+       << " ";
+  } else {
+    CGAL::write(os, v.in_dimension());
+  }
+  internal::Mesh_3::Write_mesh_domain_index<MD>()(os, 
+                                                  v.in_dimension(),
+                                                  v.index());
+  return os;
+}
+
+}  // end namespace CGAL
+
+
+
+#endif // CGAL_COMPACT_MESH_VERTEX_BASE_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesher_level.h b/3rdparty/CGAL/include/CGAL/Mesher_level.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesher_level.h
rename to 3rdparty/CGAL/include/CGAL/Mesher_level.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesher_level_default_implementations.h b/3rdparty/CGAL/include/CGAL/Mesher_level_default_implementations.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesher_level_default_implementations.h
rename to 3rdparty/CGAL/include/CGAL/Mesher_level_default_implementations.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Mesher_level_visitors.h b/3rdparty/CGAL/include/CGAL/Mesher_level_visitors.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Mesher_level_visitors.h
rename to 3rdparty/CGAL/include/CGAL/Mesher_level_visitors.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Meshes/Double_map_container.h b/3rdparty/CGAL/include/CGAL/Meshes/Double_map_container.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Meshes/Double_map_container.h
rename to 3rdparty/CGAL/include/CGAL/Meshes/Double_map_container.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Meshes/Filtered_deque_container.h b/3rdparty/CGAL/include/CGAL/Meshes/Filtered_deque_container.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Meshes/Filtered_deque_container.h
rename to 3rdparty/CGAL/include/CGAL/Meshes/Filtered_deque_container.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Meshes/Filtered_multimap_container.h b/3rdparty/CGAL/include/CGAL/Meshes/Filtered_multimap_container.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Meshes/Filtered_multimap_container.h
rename to 3rdparty/CGAL/include/CGAL/Meshes/Filtered_multimap_container.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Meshes/Filtered_queue_container.h b/3rdparty/CGAL/include/CGAL/Meshes/Filtered_queue_container.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Meshes/Filtered_queue_container.h
rename to 3rdparty/CGAL/include/CGAL/Meshes/Filtered_queue_container.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Meshes/Simple_map_container.h b/3rdparty/CGAL/include/CGAL/Meshes/Simple_map_container.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Meshes/Simple_map_container.h
rename to 3rdparty/CGAL/include/CGAL/Meshes/Simple_map_container.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Meshes/Simple_queue_container.h b/3rdparty/CGAL/include/CGAL/Meshes/Simple_queue_container.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Meshes/Simple_queue_container.h
rename to 3rdparty/CGAL/include/CGAL/Meshes/Simple_queue_container.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Meshes/Simple_set_container.h b/3rdparty/CGAL/include/CGAL/Meshes/Simple_set_container.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Meshes/Simple_set_container.h
rename to 3rdparty/CGAL/include/CGAL/Meshes/Simple_set_container.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Meshes/Triangulation_mesher_level_traits_2.h b/3rdparty/CGAL/include/CGAL/Meshes/Triangulation_mesher_level_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Meshes/Triangulation_mesher_level_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Meshes/Triangulation_mesher_level_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Meshes/Triangulation_mesher_level_traits_3.h b/3rdparty/CGAL/include/CGAL/Meshes/Triangulation_mesher_level_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Meshes/Triangulation_mesher_level_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/Meshes/Triangulation_mesher_level_traits_3.h
diff --git a/3rdparty/CGAL/include/CGAL/Min_annulus_d.h b/3rdparty/CGAL/include/CGAL/Min_annulus_d.h
new file mode 100644
index 0000000..b3475d5
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Min_annulus_d.h
@@ -0,0 +1,883 @@
+// Copyright (c) 1997-2001  ETH Zurich (Switzerland).
+// 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
+// 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(s)     : Sven Schoenherr <sven at inf.ethz.ch>
+
+#ifndef CGAL_MIN_ANNULUS_D_H
+#define CGAL_MIN_ANNULUS_D_H
+
+#ifdef _MSC_VER
+# pragma warning(push)
+# pragma warning(disable: 4244) // conversion warning in Boost iterator_adaptor
+#endif
+
+// includes
+// --------
+#include <CGAL/Optimisation/basic.h>
+#include <CGAL/function_objects.h>
+#include <CGAL/QP_options.h>
+#include <CGAL/QP_solver/QP_solver.h>
+#include <CGAL/QP_solver/functors.h>
+#include <CGAL/QP_solver/QP_full_filtered_pricing.h>
+#include <CGAL/QP_solver/QP_full_exact_pricing.h>
+#include <CGAL/boost/iterator/counting_iterator.hpp>
+#include <boost/iterator/transform_iterator.hpp>
+#include <boost/functional.hpp>
+
+// here is how it works. We have d+2 variables: 
+// R (big radius), r (small radius), c (center). The problem is
+//
+// min R^2 - r^2 
+// s.t. ||p - c||^2 >= r^2   for all p
+//      ||p - c||^2 <= R^2   for all p
+//
+// This looks nonlinear, but we can in fact make the substitutions
+// u = R^2 - c^Tc, v = r^2 - c^Tc and get the following equivalent
+// linear program:
+//
+// min u - v
+// s.t. p^Tp - 2p^Tc >= v  for all p
+//      p^Tp - 2p^Tc <= u  for all p
+// 
+// or 
+//
+// max  v - u
+// s.t. v     + 2p_1c_1 + 2p_2c_2 + ...  + 2p_dc_d <=  p^Tp for all p
+//        - u - 2p_1c_1 - 2p_2c_2 - ...  - 2p_dc_d <= -p^Tp for all p
+//
+// When we introduce a dual variable x_p for every constraint in the first
+// set and a dual variable y_p for every constraint in the second set,
+// we obtain the following dual program:
+//
+// min \sum_p x_p p^Tp -  \sum_p y_p p^Tp
+// s.t.
+//    2\sum_p x_p p    - 2\sum_p y_p p     =  0
+//     \sum_p x_p                          =  1  (constraint for v)
+//                     -  \sum_p y_p       = -1  (constraint for u)
+//                                               x_p >= 0  for all p        
+//                                               y_p >= 0  for all p 
+//
+// in the following functors, the ordering of the constraints is as above; 
+// the indices of the variables are: x_p_j <-> 2 * j, y_p_j <-> 2 * j + 1 
+// we also make the substitutions x'_p = x_p / h_p^2, y'_p = y_p / h_p^2
+// where h_p is the homogenizing coordinate of p, in order to allow
+// homogeneous points. This, however, means that the computed annulus is
+// not necessarily correct. If P is a set of homogeneous points, 
+//     P = { (p_0,...,p_{d-1}, h_p) }, 
+// then we always get a *feasible* annulus for the point set 
+//     P' = { (p_0*h_p,...,p_{d-1}*h_p, h_p*h_p) }. 
+// If the type NT is inexact, this annulus might not even be optimal, since
+// the objective function involves terms p^Tp that might not be exactly
+// computed -> document all this!!!
+
+namespace CGAL {
+
+namespace MA_detail {
+
+  // functor for a fixed column of A
+  template <class NT, class Iterator>
+  class A_column : public std::unary_function <int, NT>
+  {
+  public:
+    typedef NT result_type;
+    A_column()
+    {}
+  
+    A_column (int j, int d, Iterator it)
+      : j_ (j), d_ (d), it_ (it), h_p (*(it+d)), nt_0_ (0), nt_2_ (2)
+    {}
+
+    result_type operator() (int i) const
+    {
+      if (j_ % 2 == 0) {
+	// column for x_p
+	if (i < d_) return  *(it_ + i) * h_p * nt_2_;  
+	if (i == d_) return h_p * h_p;  
+	return nt_0_;
+      } else {
+	// column for y_p
+	if (i < d_) return  -(*(it_ + i)) * h_p * nt_2_;
+	if (i == d_+1) return -h_p * h_p;
+	return nt_0_;
+      }
+    }
+    
+  private:
+    int j_;                  // column number
+    int d_;                  // dimension
+    Iterator it_;            // the iterator through the column's point
+    NT h_p;                  // the homogenizing coordinate of p
+    NT nt_0_;
+    NT nt_2_; 
+  };
+  
+  // functor for matrix A
+  template <class NT, class Access_coordinate_begin_d,
+	    class Point_iterator >
+  class A_matrix : public std::unary_function
+  <int, boost::transform_iterator <A_column
+    <NT, typename Access_coordinate_begin_d::Coordinate_iterator>, 
+				   boost::counting_iterator<int> > >
+  { 
+    typedef typename MA_detail::A_column
+    <NT, typename Access_coordinate_begin_d::Coordinate_iterator> A_column;
+  public:
+    typedef boost::transform_iterator
+    <A_column, boost::counting_iterator<int> > result_type;
+    
+    A_matrix ()
+    {}
+
+    A_matrix (int d, 
+	      const Access_coordinate_begin_d& da_coord,
+	      Point_iterator P) 
+      : d_ (d), da_coord_ (da_coord), P_ (P)
+    {}
+
+    result_type operator () (int j) const
+    { 
+      return result_type
+	(0, A_column (j, d_, da_coord_ (*(P_+j/2)))); 
+    }
+
+  private:
+    int d_;                  // dimension
+    Access_coordinate_begin_d da_coord_; // data accessor
+    Point_iterator P_;       // point set P
+  };
+
+  // The functor necessary to realize access to b
+  template <class NT>
+  class B_vector : public std::unary_function<int, NT>
+  {
+  public:
+    typedef NT result_type;
+    B_vector()
+    {}
+
+    B_vector (int d)
+      : d_ (d), nt_0_ (0), nt_1_ (1)
+    {}
+
+    result_type operator() (int i) const
+    {
+      if (i == d_) return nt_1_;
+      if (i == d_+1) return -nt_1_;
+      return nt_0_;
+    }
+
+  private:
+    int d_;
+    NT nt_0_;
+    NT nt_1_;
+  };
+
+}
+
+// Class interfaces
+// ================
+template < class Traits_ >
+class Min_annulus_d {
+public:
+  // self
+  typedef  Traits_                    Traits;
+  typedef  Min_annulus_d<Traits>      Self;
+
+  // types from the traits class
+  typedef  typename Traits::Point_d   Point;
+
+  typedef  typename Traits::Rep_tag   Rep_tag;
+
+  typedef  typename Traits::RT        RT;
+  typedef  typename Traits::FT        FT;
+
+  typedef  typename Traits::Access_dimension_d
+  Access_dimension_d;
+  typedef  typename Traits::Access_coordinates_begin_d
+  Access_coordinates_begin_d;
+
+  typedef  typename Traits::Construct_point_d
+  Construct_point_d;
+
+  typedef  typename Traits::ET        ET;
+  typedef  typename Traits::NT        NT;
+
+  // public types 
+  typedef  std::vector<Point>         Point_vector;
+  typedef  typename Point_vector::const_iterator
+  Point_iterator;
+
+private:  
+  // QP solver iterator types
+  typedef MA_detail::A_matrix <NT, Access_coordinates_begin_d,
+			       Point_iterator> A_matrix;
+  typedef boost::transform_iterator
+  <A_matrix,  
+   boost::counting_iterator<int> >   A_iterator;
+
+  typedef MA_detail::B_vector <NT> B_vector;
+  typedef  boost::transform_iterator
+  <B_vector,
+    boost::counting_iterator<int> >  B_iterator;
+
+  typedef CGAL::Const_oneset_iterator<CGAL::Comparison_result> R_iterator;  
+ 
+  typedef  std::vector<NT>                                     C_vector; 
+  typedef  typename C_vector::const_iterator                   C_iterator; 
+
+  // Program type
+  typedef CGAL::Nonnegative_linear_program_from_iterators
+  <A_iterator, B_iterator, R_iterator, C_iterator> LP;
+
+  // Tags
+  typedef QP_solver_impl::QP_tags <Tag_true, Tag_true> QP_tags;
+
+  // Solver types
+  typedef  CGAL::QP_solver <LP, ET, QP_tags > Solver;
+
+  typedef  typename Solver::Pricing_strategy Pricing_strategy;
+
+  // types from the QP solver
+  typedef  typename Solver::Basic_variable_index_iterator
+  Basic_variable_index_iterator;
+    
+  // private types
+  typedef  std::vector<ET>            ET_vector;
+    
+  typedef  QP_access_by_index
+  <typename std::vector<Point>::const_iterator, int> Point_by_index;
+    
+  typedef  boost::binder2nd< std::divides<int> >
+  Divide;
+    
+  typedef  std::vector<int>           Index_vector;
+    
+  typedef  std::vector<NT>            NT_vector;
+  typedef  std::vector<NT_vector>     NT_matrix;
+    
+
+public:
+  // public types
+    
+  typedef  CGAL::Join_input_iterator_1<
+    Basic_variable_index_iterator,
+    CGAL::Unary_compose_1<Point_by_index,Divide> >
+  Support_point_iterator;
+    
+    
+  typedef  typename Index_vector::const_iterator IVCI;
+  typedef  CGAL::Join_input_iterator_1<
+    IVCI, Point_by_index >
+  Inner_support_point_iterator;
+  typedef  CGAL::Join_input_iterator_1<
+    IVCI, Point_by_index >
+  Outer_support_point_iterator;
+
+  typedef IVCI Inner_support_point_index_iterator;
+  typedef IVCI Outer_support_point_index_iterator;
+    
+  typedef  typename ET_vector::const_iterator
+  Coordinate_iterator;
+    
+
+  // creation
+  Min_annulus_d( const Traits&  traits  = Traits())
+    : tco( traits), da_coord(tco.access_coordinates_begin_d_object()),
+      d( -1), solver(0){}
+    
+  template < class InputIterator >
+  Min_annulus_d( InputIterator  first,
+		 InputIterator  last,
+		 const Traits&  traits = Traits())
+    : tco( traits), da_coord(tco.access_coordinates_begin_d_object()), 
+      solver(0) {
+    set( first, last);
+  }
+
+  ~Min_annulus_d() {
+    if (solver)
+      delete solver;
+  }
+    
+  // access to point set
+  int  ambient_dimension( ) const { return d; }
+    
+  int  number_of_points( ) const { return static_cast<int>(points.size()); }
+    
+  Point_iterator  points_begin( ) const { return points.begin(); }
+  Point_iterator  points_end  ( ) const { return points.end  (); }
+    
+  // access to support points
+  int
+  number_of_support_points( ) const
+  { return number_of_points() < 2 ?
+      number_of_points() :
+    solver->number_of_basic_variables(); }
+    
+  Support_point_iterator
+  support_points_begin() const {
+    CGAL_optimisation_assertion_msg(number_of_points() >= 2,
+				    "support_points_begin: not enough points");
+    return Support_point_iterator(
+				  solver->basic_original_variable_indices_begin(),
+				  CGAL::compose1_1(
+						   Point_by_index( points.begin()),
+						   boost::bind2nd( std::divides<int>(), 2)));
+  }
+    
+  Support_point_iterator
+  support_points_end() const {
+    CGAL_optimisation_assertion_msg(number_of_points() >= 2,
+				    "support_points_begin: not enough points");
+    return Support_point_iterator(
+				  solver->basic_original_variable_indices_end(),
+				  CGAL::compose1_1(
+						   Point_by_index( points.begin()),
+						   boost::bind2nd( std::divides<int>(), 2)));
+  }
+    
+  int  number_of_inner_support_points() const { return static_cast<int>(inner_indices.size());}
+  int  number_of_outer_support_points() const { return static_cast<int>(outer_indices.size());}
+    
+  Inner_support_point_iterator
+  inner_support_points_begin() const
+  { return Inner_support_point_iterator(
+					inner_indices.begin(),
+					Point_by_index( points.begin())); }
+    
+  Inner_support_point_iterator
+  inner_support_points_end() const
+  { return Inner_support_point_iterator(
+					inner_indices.end(),
+					Point_by_index( points.begin())); }
+    
+  Outer_support_point_iterator
+  outer_support_points_begin() const
+  { return Outer_support_point_iterator(
+					outer_indices.begin(),
+					Point_by_index( points.begin())); }
+    
+  Outer_support_point_iterator
+  outer_support_points_end() const
+  { return Outer_support_point_iterator(
+					outer_indices.end(),
+					Point_by_index( points.begin())); }
+
+  Inner_support_point_index_iterator
+  inner_support_points_indices_begin() const
+  { return inner_indices.begin(); }
+    
+  Inner_support_point_index_iterator
+  inner_support_points_indices_end() const
+  { return inner_indices.end(); }
+
+  Outer_support_point_index_iterator
+  outer_support_points_indices_begin() const
+  { return outer_indices.begin(); }
+
+  Outer_support_point_index_iterator
+  outer_support_points_indices_end() const
+  { return outer_indices.end(); }
+
+
+  // access to center (rational representation)
+  Coordinate_iterator
+  center_coordinates_begin( ) const { return center_coords.begin(); }
+    
+  Coordinate_iterator
+  center_coordinates_end  ( ) const { return center_coords.end  (); }
+    
+  // access to squared radii (rational representation)
+  ET  squared_inner_radius_numerator( ) const { return sqr_i_rad_numer; }
+  ET  squared_outer_radius_numerator( ) const { return sqr_o_rad_numer; }
+  ET  squared_radii_denominator     ( ) const { return sqr_rad_denom; }
+    
+  // access to center and squared radii
+  // NOTE: an implicit conversion from ET to RT must be available!
+  Point
+  center( ) const
+  { CGAL_optimisation_precondition( ! is_empty());
+  return tco.construct_point_d_object()( ambient_dimension(),
+					 center_coordinates_begin(),
+					 center_coordinates_end()); }
+    
+  FT
+  squared_inner_radius( ) const
+  { CGAL_optimisation_precondition( ! is_empty());
+  return FT( squared_inner_radius_numerator()) /
+    FT( squared_radii_denominator()); }
+    
+  FT
+  squared_outer_radius( ) const
+  { CGAL_optimisation_precondition( ! is_empty());
+  return FT( squared_outer_radius_numerator()) /
+    FT( squared_radii_denominator()); }
+    
+  // predicates
+  CGAL::Bounded_side
+  bounded_side( const Point& p) const
+  { CGAL_optimisation_precondition(
+				   is_empty() || tco.access_dimension_d_object()( p) == d);
+  ET sqr_d = sqr_dist( p);
+  ET h_p_sqr = da_coord(p)[d] * da_coord(p)[d];
+  return CGAL::Bounded_side
+    (CGAL_NTS sign( sqr_d - h_p_sqr * sqr_i_rad_numer)
+     * CGAL_NTS sign( h_p_sqr * sqr_o_rad_numer - sqr_d)); }
+    
+  bool
+  has_on_bounded_side( const Point& p) const
+  { CGAL_optimisation_precondition(
+				   is_empty() || tco.access_dimension_d_object()( p) == d);
+  ET sqr_d = sqr_dist( p);
+  ET h_p_sqr = da_coord(p)[d] * da_coord(p)[d];
+  return ( ( h_p_sqr * sqr_i_rad_numer < sqr_d) && 
+	   ( sqr_d < h_p_sqr * sqr_o_rad_numer)); }
+    
+  bool
+  has_on_boundary( const Point& p) const
+  { CGAL_optimisation_precondition(
+				   is_empty() || tco.access_dimension_d_object()( p) == d);
+  ET sqr_d = sqr_dist( p);
+  ET h_p_sqr = da_coord(p)[d] * da_coord(p)[d];
+  return (( sqr_d == h_p_sqr * sqr_i_rad_numer) || 
+	  ( sqr_d == h_p_sqr * sqr_o_rad_numer));}
+    
+  bool
+  has_on_unbounded_side( const Point& p) const
+  { CGAL_optimisation_precondition(
+				   is_empty() || tco.access_dimension_d_object()( p) == d);
+  ET sqr_d = sqr_dist( p);
+  ET h_p_sqr = da_coord(p)[d] * da_coord(p)[d];
+  return ( ( sqr_d < h_p_sqr * sqr_i_rad_numer) || 
+	   ( h_p_sqr * sqr_o_rad_numer < sqr_d)); }
+    
+  bool  is_empty     ( ) const { return number_of_points() == 0; }
+  bool  is_degenerate( ) const
+  { return ! CGAL_NTS is_positive( sqr_o_rad_numer); }
+    
+  // modifiers
+  template < class InputIterator >
+  void
+  set( InputIterator first, InputIterator last)
+  { if ( points.size() > 0) points.erase( points.begin(), points.end());
+  std::copy( first, last, std::back_inserter( points));
+  set_dimension();
+  CGAL_optimisation_precondition_msg( check_dimension(),
+				      "Not all points have the same dimension.");
+  compute_min_annulus(); }
+    
+  void
+  insert( const Point& p)
+  { if ( is_empty()) d = tco.access_dimension_d_object()( p);
+  CGAL_optimisation_precondition(
+				 tco.access_dimension_d_object()( p) == d);
+  points.push_back( p);
+  compute_min_annulus(); }
+    
+  template < class InputIterator >
+  void
+  insert( InputIterator first, InputIterator last)
+  { CGAL_optimisation_precondition_code( std::size_t old_n = points.size());
+  points.insert( points.end(), first, last);
+  set_dimension();
+  CGAL_optimisation_precondition_msg( check_dimension( old_n),
+				      "Not all points have the same dimension.");
+  compute_min_annulus(); }
+    
+  void
+  clear( )
+  { points.erase( points.begin(), points.end());
+  compute_min_annulus(); }
+    
+  // validity check
+  bool  is_valid( bool verbose = false, int level = 0) const;
+    
+  // traits class access
+  const Traits&  traits( ) const { return tco; }
+    
+
+private:
+    
+  Traits                   tco;       // traits class object
+  Access_coordinates_begin_d da_coord; // data accessor
+    
+  Point_vector             points;    // input points
+  int                      d;         // dimension of input points
+    
+  ET_vector                center_coords;     // center of small.encl.annulus
+    
+  ET                       sqr_i_rad_numer;   // squared inner radius of
+  ET                       sqr_o_rad_numer;   // ---"--- outer ----"----
+  ET                       sqr_rad_denom;     // smallest enclosing annulus
+    
+  Solver                   *solver;    // linear programming solver
+     
+  Index_vector             inner_indices;
+  Index_vector             outer_indices;
+    
+  NT_matrix                a_matrix;  // matrix `A' of dual LP
+  NT_vector                b_vector;  // vector `b' of dual LP
+  NT_vector                c_vector;  // vector `c' of dual LP
+    
+private:
+  // squared distance to center * h_p^2 * c_d^2 
+  ET sqr_dist_exact( const Point& p) const
+  {
+    ET result(0);
+    typename Access_coordinates_begin_d::Coordinate_iterator 
+      p_it (da_coord ( p));     // this is p * h_p
+    ET c_d = center_coords[d];
+    ET h_p = p_it[d];
+    for (int i=0; i<d; ++i) {
+      ET x = 
+	c_d * ET(p_it[i]) -      /* this is c_d *    p_i * h_p */
+	h_p * center_coords[i]   /* this is h_p *    c_i * c_d */ ;
+      result += x * x;
+    }
+    return result;
+  }
+
+  // the function above computes sqr_dist as ||p-c||^2 
+  // (endowed with a factor of c_d^2 * h_p^2)
+  // but we know that c was computed from (possibly slightly wrong)
+  // data if NT is inexact; in order to compensate for this, let
+  // us instead compute sqr_dist as p^Tp - 2c^Tp + c^Tc, where we use
+  // the (potentially wrong) values of p^Tp and p that went into the
+  // linear program; this will give us correct containment / on_boundary 
+  // checks also in the inexact-NT case.
+  ET sqr_dist( const Point& p) const
+  {
+    ET result(0), two(2);
+    NT pTp(0); // computed over input type, possibly slightly wrong
+    ET cTc(0); 
+    ET two_pTc(0);
+    typename Access_coordinates_begin_d::Coordinate_iterator 
+      p_it (da_coord ( p));     // this is p * h_p
+    NT h_p = p_it[d]; // input type!
+    for (int i=0; i<d; ++i) {
+      NT p_i (p_it[i]);  // input type!
+      pTp += p_i * p_i;  // p_i^2 * h_p^2 
+      cTc += center_coords[i] * center_coords[i]; // c_i^2 * c_d^2
+      two_pTc += 
+	// 2 * c_i * c_d * p_i * h_p^2  
+	2 * center_coords[i] * ET(h_p * p_i); 
+    } 
+    ET c_d = center_coords[d];
+    result = 
+      ET(pTp) * c_d * c_d +      
+      cTc * ET (h_p * h_p) +
+      - two_pTc * c_d;
+    return result;
+  }
+    
+  // set dimension of input points
+  void
+  set_dimension( )
+  { d = ( points.size() == 0 ? -1 :
+	  tco.access_dimension_d_object()( points[ 0])); }
+    
+  // check dimension of input points
+  bool
+  check_dimension( std::size_t  offset = 0)
+  { return ( std::find_if( points.begin()+offset, points.end(),
+			   CGAL::compose1_1( boost::bind2nd(
+							  std::not_equal_to<int>(), d),
+					     tco.access_dimension_d_object()))
+	     == points.end()); }
+    
+  // compute smallest enclosing annulus
+  void
+  compute_min_annulus( )
+  {
+    // clear inner and outer support points
+    inner_indices.erase( inner_indices.begin(), inner_indices.end());
+    outer_indices.erase( outer_indices.begin(), outer_indices.end());
+    
+    if ( is_empty()) {
+      center_coords.resize( 1);
+      sqr_i_rad_numer = -ET( 1);
+      sqr_o_rad_numer = -ET( 1);
+      return;
+    }
+    
+    if ( number_of_points() == 1) {
+      inner_indices.push_back( 0);
+      outer_indices.push_back( 0);
+      center_coords.resize( d+1);
+      std::copy( da_coord( points[ 0]),
+		 da_coord( points[ 0])+d+1,
+		 center_coords.begin());
+      sqr_i_rad_numer = ET( 0);
+      sqr_o_rad_numer = ET( 0);
+      sqr_rad_denom   = ET( 1);
+      return;
+    }
+    
+    // set up vector c and solve dual LP
+    // the ordering of the constraints is as above; the ordering
+    // of the variables is: z_p_j <-> 2 * j, y_p_j <-> 2 * j + 1 
+    c_vector.resize( 2*points.size());
+    for ( int j = 0; j < number_of_points(); ++j) {
+      typename Traits::Access_coordinates_begin_d::Coordinate_iterator
+	coord_it = da_coord( points[j]);
+      NT  sum = 0;
+      for ( int i = 0; i < d; ++i) {
+	sum += NT( coord_it[ i])*NT( coord_it[ i]);
+      }
+      c_vector[ 2*j  ] =  sum;
+      c_vector[ 2*j+1] = -sum;
+    }
+        
+    LP lp (2*static_cast<int>(points.size()), d+2, 
+	   A_iterator ( boost::counting_iterator<int>(0), 
+			A_matrix (d, da_coord, points.begin())),
+	   B_iterator ( boost::counting_iterator<int>(0), 
+			B_vector (d)), 
+	   R_iterator (CGAL::EQUAL), 
+	   c_vector.begin());
+    
+    Quadratic_program_options options;
+    options.set_pricing_strategy(pricing_strategy(NT()));
+    delete solver;
+    solver = new Solver(lp, options);
+    CGAL_optimisation_assertion(solver->status() == QP_OPTIMAL);
+ 
+    // compute center and squared radius
+    ET sqr_sum = 0;
+    center_coords.resize( ambient_dimension()+1);
+    for ( int i = 0; i < d; ++i) {
+      center_coords[ i] = -solver->dual_variable( i);
+      sqr_sum += center_coords[ i] * center_coords[ i];
+    }
+    center_coords[ d] = solver->variables_common_denominator();
+    sqr_i_rad_numer = sqr_sum
+      - solver->dual_variable( d  )*center_coords[ d];
+    sqr_o_rad_numer = sqr_sum
+      - solver->dual_variable( d+1)*center_coords[ d];
+    sqr_rad_denom   = center_coords[ d] * center_coords[ d];
+        
+    // split up support points
+    for ( int i = 0; i < solver->number_of_basic_original_variables(); ++i) {
+      int index = solver->basic_original_variable_indices_begin()[ i];
+      if ( index % 2 == 0) {
+	inner_indices.push_back( index/2);
+      } else {
+	outer_indices.push_back( index/2);
+      }
+    }
+  }
+  
+  template < class NT >
+  Quadratic_program_pricing_strategy pricing_strategy( NT) {
+    return QP_PARTIAL_FILTERED_DANTZIG;
+  }
+  
+  Quadratic_program_pricing_strategy pricing_strategy( ET) {
+    return QP_PARTIAL_DANTZIG;
+  }
+ 
+    
+};
+
+// Function declarations
+// =====================
+// I/O operators
+template < class Traits_ >
+std::ostream&
+operator << ( std::ostream& os, const Min_annulus_d<Traits_>& min_annulus);
+
+template < class Traits_ >
+std::istream&
+operator >> ( std::istream& is,       Min_annulus_d<Traits_>& min_annulus);
+
+// ============================================================================
+
+// Class implementation
+// ====================
+
+// validity check
+template < class Traits_ >
+bool
+Min_annulus_d<Traits_>::
+is_valid( bool verbose, int level) const
+{
+  using namespace std;
+
+  CGAL::Verbose_ostream verr( verbose);
+  verr << "CGAL::Min_annulus_d<Traits>::" << endl;
+  verr << "is_valid( true, " << level << "):" << endl;
+  verr << "  |P| = " << number_of_points()
+       << ", |S| = " << number_of_support_points() << endl;
+
+  // containment check (a)
+  // ---------------------
+  verr << "  (a) containment check..." << flush;
+    
+  Point_iterator  point_it = points_begin();
+  for ( ; point_it != points_end(); ++point_it) {
+    if ( has_on_unbounded_side( *point_it))
+      return CGAL::_optimisation_is_valid_fail( verr,
+						"annulus does not contain all points");
+  }
+    
+  verr << "passed." << endl;
+
+  // support set check (b)
+  // ---------------------
+  verr << "  (b) support set check..." << flush;
+    
+  // all inner support points on inner boundary?
+  Inner_support_point_iterator  i_pt_it = inner_support_points_begin();
+  for ( ; i_pt_it != inner_support_points_end(); ++i_pt_it) {
+    ET h_p_sqr = da_coord (*i_pt_it)[d] * da_coord (*i_pt_it)[d];
+    if ( sqr_dist( *i_pt_it) != h_p_sqr * sqr_i_rad_numer)
+      return CGAL::_optimisation_is_valid_fail( verr,
+						"annulus does not have all inner support points on its inner boundary");
+  }
+    
+  // all outer support points on outer boundary?
+  Outer_support_point_iterator  o_pt_it = outer_support_points_begin();
+  for ( ; o_pt_it != outer_support_points_end(); ++o_pt_it) {
+    ET h_p_sqr = da_coord (*o_pt_it)[d] * da_coord (*o_pt_it)[d];
+    if ( sqr_dist( *o_pt_it) != h_p_sqr * sqr_o_rad_numer)
+      return CGAL::_optimisation_is_valid_fail( verr,
+						"annulus does not have all outer support points on its outer boundary");
+  }
+  /*
+  // center strictly in convex hull of support points?
+  typename Solver::Basic_variable_numerator_iterator
+  num_it = solver.basic_variables_numerator_begin();
+  for ( ; num_it != solver.basic_variables_numerator_end(); ++num_it) {
+  if ( ! (    CGAL_NTS is_positive( *num_it)
+  && *num_it <= solver.variables_common_denominator()))
+  return CGAL::_optimisation_is_valid_fail( verr,
+  "center does not lie strictly in convex hull of support points");
+  }
+  */
+    
+  verr << "passed." << endl;
+
+  verr << "  object is valid!" << endl;
+  return( true);
+}
+
+// output operator
+template < class Traits_ >
+std::ostream&
+operator << ( std::ostream& os,
+              const Min_annulus_d<Traits_>& min_annulus)
+{
+  using namespace std;
+
+  typedef  typename Min_annulus_d<Traits_>::Point  Point;
+  typedef  ostream_iterator<Point>       Os_it;
+  typedef  typename Traits_::ET          ET;
+  typedef  ostream_iterator<ET>          Et_it;
+
+  switch ( CGAL::get_mode( os)) {
+
+  case CGAL::IO::PRETTY:
+    os << "CGAL::Min_annulus_d( |P| = "
+       << min_annulus.number_of_points() << ", |S| = "
+       << min_annulus.number_of_inner_support_points() << '+'
+       << min_annulus.number_of_outer_support_points() << endl;
+    os << "  P = {" << endl;
+    os << "    ";
+    copy( min_annulus.points_begin(), min_annulus.points_end(),
+	  Os_it( os, ",\n    "));
+    os << "}" << endl;
+    os << "  S_i = {" << endl;
+    os << "    ";
+    copy( min_annulus.inner_support_points_begin(),
+	  min_annulus.inner_support_points_end(),
+	  Os_it( os, ",\n    "));
+    os << "}" << endl;
+    os << "  S_o = {" << endl;
+    os << "    ";
+    copy( min_annulus.outer_support_points_begin(),
+	  min_annulus.outer_support_points_end(),
+	  Os_it( os, ",\n    "));
+    os << "}" << endl;
+    os << "  center = ( ";
+    copy( min_annulus.center_coordinates_begin(),
+	  min_annulus.center_coordinates_end(),
+	  Et_it( os, " "));
+    os << ")" << endl;
+    os << "  squared inner radius = "
+       << min_annulus.squared_inner_radius_numerator() << " / "
+       << min_annulus.squared_radii_denominator() << endl;
+    os << "  squared outer radius = "
+       << min_annulus.squared_outer_radius_numerator() << " / "
+       << min_annulus.squared_radii_denominator() << endl;
+    break;
+
+  case CGAL::IO::ASCII:
+    copy( min_annulus.points_begin(), min_annulus.points_end(),
+	  Os_it( os, "\n"));
+    break;
+
+  case CGAL::IO::BINARY:
+    copy( min_annulus.points_begin(), min_annulus.points_end(),
+	  Os_it( os));
+    break;
+
+  default:
+    CGAL_optimisation_assertion_msg( false,
+				     "CGAL::get_mode( os) invalid!");
+    break; }
+
+  return( os);
+}
+
+// input operator
+template < class Traits_ >
+std::istream&
+operator >> ( std::istream& is, CGAL::Min_annulus_d<Traits_>& min_annulus)
+{
+  using namespace std;
+
+  switch ( CGAL::get_mode( is)) {
+
+  case CGAL::IO::PRETTY:
+    cerr << endl;
+    cerr << "Stream must be in ascii or binary mode" << endl;
+    break;
+
+  case CGAL::IO::ASCII:
+  case CGAL::IO::BINARY:
+    typedef  typename CGAL::Min_annulus_d<Traits_>::Point  Point;
+    typedef  istream_iterator<Point>             Is_it;
+    min_annulus.set( Is_it( is), Is_it());
+    break;
+
+  default:
+    CGAL_optimisation_assertion_msg( false, "CGAL::IO::mode invalid!");
+    break; }
+
+  return( is);
+}
+
+} //namespace CGAL
+
+#ifdef _MSC_VER
+# pragma warning(pop)
+#endif
+
+#endif // CGAL_MIN_ANNULUS_D_H
+
+// ===== EOF ==================================================================
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Min_circle_2.h b/3rdparty/CGAL/include/CGAL/Min_circle_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Min_circle_2.h
rename to 3rdparty/CGAL/include/CGAL/Min_circle_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Min_circle_2/Min_circle_2_adapterC2.h b/3rdparty/CGAL/include/CGAL/Min_circle_2/Min_circle_2_adapterC2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Min_circle_2/Min_circle_2_adapterC2.h
rename to 3rdparty/CGAL/include/CGAL/Min_circle_2/Min_circle_2_adapterC2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Min_circle_2/Min_circle_2_adapterH2.h b/3rdparty/CGAL/include/CGAL/Min_circle_2/Min_circle_2_adapterH2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Min_circle_2/Min_circle_2_adapterH2.h
rename to 3rdparty/CGAL/include/CGAL/Min_circle_2/Min_circle_2_adapterH2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Min_circle_2/Min_circle_2_impl.h b/3rdparty/CGAL/include/CGAL/Min_circle_2/Min_circle_2_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Min_circle_2/Min_circle_2_impl.h
rename to 3rdparty/CGAL/include/CGAL/Min_circle_2/Min_circle_2_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Min_circle_2/Optimisation_circle_2.h b/3rdparty/CGAL/include/CGAL/Min_circle_2/Optimisation_circle_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Min_circle_2/Optimisation_circle_2.h
rename to 3rdparty/CGAL/include/CGAL/Min_circle_2/Optimisation_circle_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Min_circle_2/Optimisation_circle_2_impl.h b/3rdparty/CGAL/include/CGAL/Min_circle_2/Optimisation_circle_2_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Min_circle_2/Optimisation_circle_2_impl.h
rename to 3rdparty/CGAL/include/CGAL/Min_circle_2/Optimisation_circle_2_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Min_circle_2_traits_2.h b/3rdparty/CGAL/include/CGAL/Min_circle_2_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Min_circle_2_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Min_circle_2_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Min_ellipse_2.h b/3rdparty/CGAL/include/CGAL/Min_ellipse_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Min_ellipse_2.h
rename to 3rdparty/CGAL/include/CGAL/Min_ellipse_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Min_ellipse_2/Min_ellipse_2_adapterC2.h b/3rdparty/CGAL/include/CGAL/Min_ellipse_2/Min_ellipse_2_adapterC2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Min_ellipse_2/Min_ellipse_2_adapterC2.h
rename to 3rdparty/CGAL/include/CGAL/Min_ellipse_2/Min_ellipse_2_adapterC2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Min_ellipse_2/Min_ellipse_2_adapterH2.h b/3rdparty/CGAL/include/CGAL/Min_ellipse_2/Min_ellipse_2_adapterH2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Min_ellipse_2/Min_ellipse_2_adapterH2.h
rename to 3rdparty/CGAL/include/CGAL/Min_ellipse_2/Min_ellipse_2_adapterH2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Min_ellipse_2/Min_ellipse_2_impl.h b/3rdparty/CGAL/include/CGAL/Min_ellipse_2/Min_ellipse_2_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Min_ellipse_2/Min_ellipse_2_impl.h
rename to 3rdparty/CGAL/include/CGAL/Min_ellipse_2/Min_ellipse_2_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Min_ellipse_2/Optimisation_ellipse_2.h b/3rdparty/CGAL/include/CGAL/Min_ellipse_2/Optimisation_ellipse_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Min_ellipse_2/Optimisation_ellipse_2.h
rename to 3rdparty/CGAL/include/CGAL/Min_ellipse_2/Optimisation_ellipse_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Min_ellipse_2/Optimisation_ellipse_2_impl.h b/3rdparty/CGAL/include/CGAL/Min_ellipse_2/Optimisation_ellipse_2_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Min_ellipse_2/Optimisation_ellipse_2_impl.h
rename to 3rdparty/CGAL/include/CGAL/Min_ellipse_2/Optimisation_ellipse_2_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Min_ellipse_2_traits_2.h b/3rdparty/CGAL/include/CGAL/Min_ellipse_2_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Min_ellipse_2_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Min_ellipse_2_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Min_quadrilateral_traits_2.h b/3rdparty/CGAL/include/CGAL/Min_quadrilateral_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Min_quadrilateral_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Min_quadrilateral_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Min_sphere_annulus_d_traits_2.h b/3rdparty/CGAL/include/CGAL/Min_sphere_annulus_d_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Min_sphere_annulus_d_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Min_sphere_annulus_d_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Min_sphere_annulus_d_traits_3.h b/3rdparty/CGAL/include/CGAL/Min_sphere_annulus_d_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Min_sphere_annulus_d_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/Min_sphere_annulus_d_traits_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Min_sphere_annulus_d_traits_d.h b/3rdparty/CGAL/include/CGAL/Min_sphere_annulus_d_traits_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Min_sphere_annulus_d_traits_d.h
rename to 3rdparty/CGAL/include/CGAL/Min_sphere_annulus_d_traits_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Min_sphere_d.h b/3rdparty/CGAL/include/CGAL/Min_sphere_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Min_sphere_d.h
rename to 3rdparty/CGAL/include/CGAL/Min_sphere_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Min_sphere_d/Min_sphere_d_impl.h b/3rdparty/CGAL/include/CGAL/Min_sphere_d/Min_sphere_d_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Min_sphere_d/Min_sphere_d_impl.h
rename to 3rdparty/CGAL/include/CGAL/Min_sphere_d/Min_sphere_d_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Min_sphere_d/Optimisation_sphere_d.h b/3rdparty/CGAL/include/CGAL/Min_sphere_d/Optimisation_sphere_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Min_sphere_d/Optimisation_sphere_d.h
rename to 3rdparty/CGAL/include/CGAL/Min_sphere_d/Optimisation_sphere_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Min_sphere_of_points_d_traits_2.h b/3rdparty/CGAL/include/CGAL/Min_sphere_of_points_d_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Min_sphere_of_points_d_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Min_sphere_of_points_d_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Min_sphere_of_points_d_traits_3.h b/3rdparty/CGAL/include/CGAL/Min_sphere_of_points_d_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Min_sphere_of_points_d_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/Min_sphere_of_points_d_traits_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Min_sphere_of_points_d_traits_d.h b/3rdparty/CGAL/include/CGAL/Min_sphere_of_points_d_traits_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Min_sphere_of_points_d_traits_d.h
rename to 3rdparty/CGAL/include/CGAL/Min_sphere_of_points_d_traits_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Min_sphere_of_spheres_d.h b/3rdparty/CGAL/include/CGAL/Min_sphere_of_spheres_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Min_sphere_of_spheres_d.h
rename to 3rdparty/CGAL/include/CGAL/Min_sphere_of_spheres_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Min_sphere_of_spheres_d/Min_sphere_of_spheres_d_configure.h b/3rdparty/CGAL/include/CGAL/Min_sphere_of_spheres_d/Min_sphere_of_spheres_d_configure.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Min_sphere_of_spheres_d/Min_sphere_of_spheres_d_configure.h
rename to 3rdparty/CGAL/include/CGAL/Min_sphere_of_spheres_d/Min_sphere_of_spheres_d_configure.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Min_sphere_of_spheres_d/Min_sphere_of_spheres_d_impl.h b/3rdparty/CGAL/include/CGAL/Min_sphere_of_spheres_d/Min_sphere_of_spheres_d_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Min_sphere_of_spheres_d/Min_sphere_of_spheres_d_impl.h
rename to 3rdparty/CGAL/include/CGAL/Min_sphere_of_spheres_d/Min_sphere_of_spheres_d_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Min_sphere_of_spheres_d/Min_sphere_of_spheres_d_pair.h b/3rdparty/CGAL/include/CGAL/Min_sphere_of_spheres_d/Min_sphere_of_spheres_d_pair.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Min_sphere_of_spheres_d/Min_sphere_of_spheres_d_pair.h
rename to 3rdparty/CGAL/include/CGAL/Min_sphere_of_spheres_d/Min_sphere_of_spheres_d_pair.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Min_sphere_of_spheres_d/Min_sphere_of_spheres_d_pivot_impl.h b/3rdparty/CGAL/include/CGAL/Min_sphere_of_spheres_d/Min_sphere_of_spheres_d_pivot_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Min_sphere_of_spheres_d/Min_sphere_of_spheres_d_pivot_impl.h
rename to 3rdparty/CGAL/include/CGAL/Min_sphere_of_spheres_d/Min_sphere_of_spheres_d_pivot_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Min_sphere_of_spheres_d/Min_sphere_of_spheres_d_support_set.h b/3rdparty/CGAL/include/CGAL/Min_sphere_of_spheres_d/Min_sphere_of_spheres_d_support_set.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Min_sphere_of_spheres_d/Min_sphere_of_spheres_d_support_set.h
rename to 3rdparty/CGAL/include/CGAL/Min_sphere_of_spheres_d/Min_sphere_of_spheres_d_support_set.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Min_sphere_of_spheres_d/Min_sphere_of_spheres_d_support_set_impl.h b/3rdparty/CGAL/include/CGAL/Min_sphere_of_spheres_d/Min_sphere_of_spheres_d_support_set_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Min_sphere_of_spheres_d/Min_sphere_of_spheres_d_support_set_impl.h
rename to 3rdparty/CGAL/include/CGAL/Min_sphere_of_spheres_d/Min_sphere_of_spheres_d_support_set_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Min_sphere_of_spheres_d_traits_2.h b/3rdparty/CGAL/include/CGAL/Min_sphere_of_spheres_d_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Min_sphere_of_spheres_d_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Min_sphere_of_spheres_d_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Min_sphere_of_spheres_d_traits_3.h b/3rdparty/CGAL/include/CGAL/Min_sphere_of_spheres_d_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Min_sphere_of_spheres_d_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/Min_sphere_of_spheres_d_traits_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Min_sphere_of_spheres_d_traits_d.h b/3rdparty/CGAL/include/CGAL/Min_sphere_of_spheres_d_traits_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Min_sphere_of_spheres_d_traits_d.h
rename to 3rdparty/CGAL/include/CGAL/Min_sphere_of_spheres_d_traits_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Minimum_enclosing_quadrilateral_traits_2.h b/3rdparty/CGAL/include/CGAL/Minimum_enclosing_quadrilateral_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Minimum_enclosing_quadrilateral_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Minimum_enclosing_quadrilateral_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/AABB_collision_detector_2.h b/3rdparty/CGAL/include/CGAL/Minkowski_sum_2/AABB_collision_detector_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/AABB_collision_detector_2.h
rename to 3rdparty/CGAL/include/CGAL/Minkowski_sum_2/AABB_collision_detector_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/AABB_node_with_join.h b/3rdparty/CGAL/include/CGAL/Minkowski_sum_2/AABB_node_with_join.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/AABB_node_with_join.h
rename to 3rdparty/CGAL/include/CGAL/Minkowski_sum_2/AABB_node_with_join.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/AABB_segment_2_primitive.h b/3rdparty/CGAL/include/CGAL/Minkowski_sum_2/AABB_segment_2_primitive.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/AABB_segment_2_primitive.h
rename to 3rdparty/CGAL/include/CGAL/Minkowski_sum_2/AABB_segment_2_primitive.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/AABB_traits_2.h b/3rdparty/CGAL/include/CGAL/Minkowski_sum_2/AABB_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/AABB_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Minkowski_sum_2/AABB_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/AABB_traversal_traits_with_join.h b/3rdparty/CGAL/include/CGAL/Minkowski_sum_2/AABB_traversal_traits_with_join.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/AABB_traversal_traits_with_join.h
rename to 3rdparty/CGAL/include/CGAL/Minkowski_sum_2/AABB_traversal_traits_with_join.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/AABB_tree_with_join.h b/3rdparty/CGAL/include/CGAL/Minkowski_sum_2/AABB_tree_with_join.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/AABB_tree_with_join.h
rename to 3rdparty/CGAL/include/CGAL/Minkowski_sum_2/AABB_tree_with_join.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/Approx_offset_base_2.h b/3rdparty/CGAL/include/CGAL/Minkowski_sum_2/Approx_offset_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/Approx_offset_base_2.h
rename to 3rdparty/CGAL/include/CGAL/Minkowski_sum_2/Approx_offset_base_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/Arr_labeled_traits_2.h b/3rdparty/CGAL/include/CGAL/Minkowski_sum_2/Arr_labeled_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/Arr_labeled_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Minkowski_sum_2/Arr_labeled_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/Decomposition_strategy_adapter.h b/3rdparty/CGAL/include/CGAL/Minkowski_sum_2/Decomposition_strategy_adapter.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/Decomposition_strategy_adapter.h
rename to 3rdparty/CGAL/include/CGAL/Minkowski_sum_2/Decomposition_strategy_adapter.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/Exact_offset_base_2.h b/3rdparty/CGAL/include/CGAL/Minkowski_sum_2/Exact_offset_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/Exact_offset_base_2.h
rename to 3rdparty/CGAL/include/CGAL/Minkowski_sum_2/Exact_offset_base_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/Hole_filter_2.h b/3rdparty/CGAL/include/CGAL/Minkowski_sum_2/Hole_filter_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/Hole_filter_2.h
rename to 3rdparty/CGAL/include/CGAL/Minkowski_sum_2/Hole_filter_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/Labels.h b/3rdparty/CGAL/include/CGAL/Minkowski_sum_2/Labels.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/Labels.h
rename to 3rdparty/CGAL/include/CGAL/Minkowski_sum_2/Labels.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/Minkowski_sum_by_reduced_convolution_2.h b/3rdparty/CGAL/include/CGAL/Minkowski_sum_2/Minkowski_sum_by_reduced_convolution_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/Minkowski_sum_by_reduced_convolution_2.h
rename to 3rdparty/CGAL/include/CGAL/Minkowski_sum_2/Minkowski_sum_by_reduced_convolution_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/Minkowski_sum_conv_2.h b/3rdparty/CGAL/include/CGAL/Minkowski_sum_2/Minkowski_sum_conv_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/Minkowski_sum_conv_2.h
rename to 3rdparty/CGAL/include/CGAL/Minkowski_sum_2/Minkowski_sum_conv_2.h
diff --git a/3rdparty/CGAL/include/CGAL/Minkowski_sum_2/Minkowski_sum_decomp_2.h b/3rdparty/CGAL/include/CGAL/Minkowski_sum_2/Minkowski_sum_decomp_2.h
new file mode 100644
index 0000000..f917b0c
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Minkowski_sum_2/Minkowski_sum_decomp_2.h
@@ -0,0 +1,451 @@
+// Copyright (c) 2006  Tel-Aviv University (Israel).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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.
+//
+// Author(s)     : Ron Wein   <wein_r at yahoo.com>
+
+#ifndef CGAL_MINKOWSKI_SUM_DECOMP_2_H
+#define CGAL_MINKOWSKI_SUM_DECOMP_2_H
+
+#include <CGAL/Arr_segment_traits_2.h>
+#include <CGAL/Polygon_with_holes_2.h>
+
+#include <CGAL/Boolean_set_operations_2.h>
+#include <CGAL/General_polygon_set_2.h>
+#include <CGAL/Gps_segment_traits_2.h>
+#include <list>
+
+namespace CGAL {
+
+/*! \class
+ * A class for computing the Minkowski sum of two polygons based on their
+ * decomposition to convex sub-polygons, taking the pairwise sums and
+ * computing the union of the sub-sums.
+ */
+
+template <typename DecompStrategy1_, typename DecompStrategy2_,
+          typename Container_>
+class Minkowski_sum_by_decomposition_2 {
+public:
+  typedef DecompStrategy1_                              Decomposition_strategy1;
+  typedef DecompStrategy2_                              Decomposition_strategy2;
+  typedef Container_                                    Container;
+
+  typedef typename Decomposition_strategy1::Polygon_2    Polygon_2;
+
+  typedef typename Decomposition_strategy1::Kernel       Kernel;
+  typedef CGAL::Arr_segment_traits_2<Kernel>             Arr_segment_traits;
+  typedef CGAL::Gps_segment_traits_2<Kernel, Container, Arr_segment_traits>
+                                                         Traits_2;
+  typedef CGAL::General_polygon_set_2<Traits_2>          General_polygon_set_2;
+  typedef CGAL::Polygon_with_holes_2<Kernel,Container>   Polygon_with_holes_2;
+  typedef typename General_polygon_set_2::Arrangement_2  Arrangement_2;
+
+private:
+  // Kernel types:
+  typedef typename Kernel::Point_2                       Point_2;
+  typedef typename Kernel::Vector_2                      Vector_2;
+  typedef typename Kernel::Direction_2                   Direction_2;
+
+  // Kernel functors:
+  typedef typename Kernel::Compare_angle_with_x_axis_2   Compare_angle_2;
+  typedef typename Kernel::Construct_translated_point_2  Translate_point_2;
+  typedef typename Kernel::Construct_vector_2            Construct_vector_2;
+  typedef typename Kernel::Construct_direction_2         Construct_direction_2;
+  typedef typename Kernel::Compare_x_2                   Compare_x_2;
+  typedef typename Kernel::Compare_y_2                   Compare_y_2;
+  typedef typename Kernel::Compare_xy_2                  Compare_xy_2;
+
+  // Polygon-related types:
+  typedef typename Polygon_2::Vertex_circulator          Vertex_circulator;
+  typedef std::list<Polygon_2>                           Polygons_list;
+  typedef typename Polygons_list::iterator               Polygons_iterator;
+
+  typedef std::list<Polygon_with_holes_2>
+    Polygon_with_holes_list;
+
+  // Data members:
+  const Decomposition_strategy1* m_decomposition_strategy1;
+  const Decomposition_strategy2* m_decomposition_strategy2;
+  bool m_own_strategy1;   // inidicates whether the stategy should be freed up.
+  bool m_own_strategy2;   // inidicates whether the stategy should be freed up.
+
+  const Traits_2* m_traits;
+  bool m_own_traits;      // inidicates whether the kernel should be freed up.
+
+  Compare_angle_2         f_compare_angle;
+  Translate_point_2       f_add;
+  Construct_vector_2      f_vector;
+  Construct_direction_2   f_direction;
+  Compare_x_2             f_compare_x;
+  Compare_y_2             f_compare_y;
+  Compare_xy_2            f_compare_xy;
+
+public:
+  //! Default constructor.
+  Minkowski_sum_by_decomposition_2() :
+    m_decomposition_strategy1(NULL),
+    m_decomposition_strategy2(NULL),
+    m_own_strategy1(false),
+    m_own_strategy2(false),
+    m_traits(NULL),
+    m_own_traits(false)
+  { init(); }
+
+  //! Constructor.
+  Minkowski_sum_by_decomposition_2(const Decomposition_strategy1& strategy1,
+                                   const Decomposition_strategy2& strategy2,
+                                   const Traits_2& traits) :
+    m_decomposition_strategy1(&strategy1),
+    m_decomposition_strategy2(&strategy2),
+    m_own_strategy1(false),
+    m_own_strategy2(false),
+    m_traits(&traits),
+    m_own_traits(false)
+  { init(); }
+
+  //! Constructor.
+  Minkowski_sum_by_decomposition_2(const Decomposition_strategy1& strategy1,
+                                   const Decomposition_strategy2& strategy2) :
+    m_decomposition_strategy1(&strategy1),
+    m_decomposition_strategy2(&strategy2),
+    m_own_strategy1(false),
+    m_own_strategy2(false),
+    m_traits(NULL),
+    m_own_traits(false)
+  { init(); }
+
+  //! Constructor.
+  Minkowski_sum_by_decomposition_2(const Traits_2& traits) :
+    m_decomposition_strategy1(NULL),
+    m_decomposition_strategy2(NULL),
+    m_own_strategy1(false),
+    m_own_strategy2(false),
+    m_traits(&traits),
+    m_own_traits(false)
+  { init(); }
+
+  /*! Destructor */
+  ~Minkowski_sum_by_decomposition_2()
+  {
+    if (m_own_traits) {
+      if (m_traits != NULL) {
+        delete m_traits;
+        m_traits = NULL;
+      }
+      m_own_traits = false;
+    }
+
+    if (m_own_strategy1) {
+      if (m_decomposition_strategy1 != NULL) {
+        delete m_decomposition_strategy1;
+        m_decomposition_strategy1 = NULL;
+      }
+      m_own_strategy1 = false;
+    }
+
+    if (m_own_strategy2) {
+      if (m_decomposition_strategy2 != NULL) {
+        delete m_decomposition_strategy2;
+        m_decomposition_strategy2 = NULL;
+      }
+      m_own_strategy2 = false;
+    }
+  }
+
+  //! Initialize
+  void init()
+  {
+    // Allocate the traits if not provided.
+    if (m_traits == NULL) {
+      m_traits = new Traits_2;
+      m_own_traits = true;
+    }
+    // Allocate the strategy if not provided.
+    if (m_decomposition_strategy1 == NULL) {
+      m_decomposition_strategy1 = new Decomposition_strategy1;
+      m_own_strategy1 = true;
+    }
+    if (m_decomposition_strategy2 == NULL) {
+      m_decomposition_strategy2 = new Decomposition_strategy2;
+      m_own_strategy2 = true;
+    }
+
+    // Obtain kernel functors.
+    const Kernel* kernel = m_traits;
+    f_compare_angle = kernel->compare_angle_with_x_axis_2_object();
+    f_add = kernel->construct_translated_point_2_object();
+    f_vector = kernel->construct_vector_2_object();
+    f_direction = kernel->construct_direction_2_object();
+    f_compare_x = kernel->compare_x_2_object();
+    f_compare_y = kernel->compare_y_2_object();
+    f_compare_xy = kernel->compare_xy_2_object();
+  }
+
+  /*!
+   * Obtain the traits
+   * \return the traits
+   */
+  const Traits_2* traits() const { return m_traits; }
+
+  /*!
+   * Obtain the decomposition strategy
+   * \return the decomposition strategy
+   */
+  const Decomposition_strategy1* decomposition_strategy1() const
+  { return m_decomposition_strategy1; }
+
+  const Decomposition_strategy2* decomposition_strategy2() const
+  { return m_decomposition_strategy2; }
+
+  /*!
+   * Compute the Minkowski sum of two simple polygons.
+   * \param pgn1 The first polygon.
+   * \param pgn2 The second polygon.
+   * \pre Both input polygons are simple.
+   * \return The resulting polygon with holes, representing the sum.
+   */
+  Polygon_with_holes_2
+  operator()(const Polygon_2& pgn1, const Polygon_2& pgn2) const
+  {
+    CGAL_precondition(pgn1.is_simple());
+    CGAL_precondition(pgn2.is_simple());
+
+    // Decompose both input polygons to convex sub-polygons.
+    Polygons_list sub_pgns1;
+    Polygons_list sub_pgns2;
+
+    (*m_decomposition_strategy1)(pgn1, std::back_inserter(sub_pgns1));
+    (*m_decomposition_strategy2)(pgn2, std::back_inserter(sub_pgns2));
+
+    return operator()(sub_pgns1.begin(), sub_pgns1.end(),
+                      sub_pgns2.begin(), sub_pgns2.end());
+  }
+
+  /*!
+   * Compute the Minkowski sum of two polygon-with-holes.
+   * \param pgn1 The first polygon.
+   * \param pgn2 The second polygon.
+   * \pre Both input polygons are simple.
+   * \return The resulting polygon with holes, representing the sum.
+   */
+  Polygon_with_holes_2
+  operator()(const Polygon_with_holes_2& pgn1,
+             const Polygon_with_holes_2& pgn2) const
+  {
+    // Decompose both input polygons to convex sub-polygons.
+    Polygons_list sub_pgns1;
+    Polygons_list sub_pgns2;
+
+    (*m_decomposition_strategy1)(pgn1, std::back_inserter(sub_pgns1));
+    (*m_decomposition_strategy2)(pgn2, std::back_inserter(sub_pgns2));
+
+    return operator()(sub_pgns1.begin(), sub_pgns1.end(),
+                      sub_pgns2.begin(), sub_pgns2.end());
+  }
+
+  /*!
+   * Compute the Minkowski sum of a simple polygon and a polygon-with-holes.
+   * \param pgn1 The simple polygon.
+   * \param pgn2 The polygon with holes.
+   * \pre Both input polygons are simple.
+   * \return The resulting polygon with holes, representing the sum.
+   */
+  Polygon_with_holes_2
+  operator()(const Polygon_2& pgn1, const Polygon_with_holes_2& pgn2) const
+  {
+    CGAL_precondition(pgn1.is_simple());
+
+    // Decompose both input polygons to convex sub-polygons.
+    Polygons_list sub_pgns1;
+    Polygons_list sub_pgns2;
+
+    (*m_decomposition_strategy1)(pgn1, std::back_inserter(sub_pgns1));
+    (*m_decomposition_strategy2)(pgn2, std::back_inserter(sub_pgns2));
+
+    return operator()(sub_pgns1.begin(), sub_pgns1.end(),
+                      sub_pgns2.begin(), sub_pgns2.end());
+  }
+
+  /*! Compute the union of the pairwise Minkowski sum of two sets of
+   * convex polygons.
+   * \param begin1 the iterator to the begin element of the first set.
+   * \param end1 the iterator to the past-the-end element of the first set.
+   * \param begin2 the iterator to the begin element of the second set.
+   * \param end2 the iterator to the past-the-end element of the second set.
+   */
+  template <class InputIterator1, class InputIterator2>
+  Polygon_with_holes_2 operator()(InputIterator1 begin1, InputIterator1 end1,
+                                  InputIterator2 begin2, InputIterator1 end2)
+    const
+  {
+    Polygons_list sub_sum_polygons;
+
+    // Compute the sub-sums of all pairs of sub-polygons.
+    for (InputIterator1 curr1 = begin1; curr1 != end1; ++curr1) {
+      for (InputIterator2 curr2 = begin2; curr2 != end2; ++curr2) {
+        // Compute the sum of the current pair of convex sub-polygons.
+        Polygon_2 sub_sum;
+        _compute_sum_of_convex(*curr1, *curr2, sub_sum);
+        sub_sum_polygons.push_back(sub_sum);
+      }
+    }
+
+    General_polygon_set_2 gps(*m_traits);
+    gps.join(sub_sum_polygons.begin(), sub_sum_polygons.end());
+
+    Arrangement_2& arr = gps.arrangement();
+    simplify(arr);
+
+    Polygon_with_holes_list sum;
+    gps.polygons_with_holes(std::back_inserter(sum));
+    CGAL_assertion(sum.size() == 1);
+    return (*(sum.begin()));
+  }
+
+private:
+  /*! Merge mergable edges
+   * \param arr (in) The underlying arrangement.
+   */
+  void simplify(Arrangement_2& arr) const
+  {
+    typename Arrangement_2::Vertex_iterator vit = arr.vertices_begin();
+    while (vit != arr.vertices_end()) {
+      typename Arrangement_2::Vertex_iterator curr = vit++;
+      if (curr->degree() != 2) continue;
+      typename Arrangement_2::Halfedge_around_vertex_circulator eit =
+        curr->incident_halfedges();
+      const typename Arrangement_2::Geometry_traits_2* traits =
+        arr.geometry_traits();
+      if (traits->are_mergeable_2_object()(eit->curve(), eit->next()->curve()))
+      {
+        typename Arrangement_2::Geometry_traits_2::X_monotone_curve_2 c;
+        traits->merge_2_object()(eit->curve(), eit->next()->curve(), c);
+        arr.merge_edge(eit, eit->next(), c);
+      }
+    }
+  }
+
+  /*!
+   * Compute the Minkowski sum of two convex polygons.
+   * \param pgn1 The first convex polygon.
+   * \param pgn2 The second convex polygon.
+   * \param sub_sum Output: Polygon which is the sub sum of the two convex
+   *        polygons
+   */
+  void _compute_sum_of_convex(const Polygon_2& pgn1,
+                              const Polygon_2& pgn2,
+                              Polygon_2& sub_sum) const
+  {
+    // Find the bottom-left vertex in both polygons.
+    Vertex_circulator first1, curr1, next1;
+    Vertex_circulator bottom_left1;
+    Comparison_result res;
+    bottom_left1 = curr1 = first1 = pgn1.vertices_circulator();
+    ++curr1;
+    while (curr1 != first1) {
+      res = f_compare_y(*curr1, *bottom_left1);
+      if ((res == SMALLER) ||
+          ((res == EQUAL) && (f_compare_x(*curr1, *bottom_left1) == SMALLER)))
+      {
+        bottom_left1 = curr1;
+      }
+      ++curr1;
+    }
+
+    // Find the bottom-left vertex in both polygons.
+    Vertex_circulator         first2, curr2, next2;
+    Vertex_circulator         bottom_left2;
+
+    bottom_left2 = curr2 = first2 = pgn2.vertices_circulator();
+    ++curr2;
+    while (curr2 != first2) {
+      res = f_compare_y(*curr2, *bottom_left2);
+      if ((res == SMALLER) ||
+          ((res == EQUAL) && (f_compare_x(*curr2, *bottom_left2) == SMALLER)))
+      {
+        bottom_left2 = curr2;
+      }
+      ++curr2;
+    }
+
+    // Start from the bottom-left vertices.
+    next1 = curr1 = bottom_left1;
+    ++next1;
+    next2 = curr2 = bottom_left2;
+    ++next2;
+
+    // Compute the Minkowski sum.
+    Point_2 first_pt;
+    Point_2 curr_pt;
+    Point_2 prev_pt;
+    bool is_first = true;
+    bool inc1, inc2;
+    bool moved_on1 = false;
+    bool moved_on2 = false;
+
+    do {
+      // Compute the sum of the two current vertices (we actually translate
+      // the point curr1 by a vector equivalent to the point curr2).
+      curr_pt = f_add(*curr1, f_vector(CGAL::ORIGIN, *curr2));
+
+      if (is_first) {
+        // This is the first point we have computed.
+        first_pt = prev_pt = curr_pt;
+        is_first = false;
+        sub_sum.push_back(first_pt);
+      }
+      else {
+        // Add a segment from the previously summed point to the current one.
+        res = f_compare_xy(prev_pt, curr_pt);
+        CGAL_assertion (res != EQUAL);
+        prev_pt = curr_pt;
+        sub_sum.push_back(curr_pt);
+      }
+
+      // Compare the angles the current edges form with the x-axis.
+      res = f_compare_angle(f_direction(f_vector(*curr1, *next1)),
+                            f_direction(f_vector(*curr2, *next2)));
+
+      // Proceed to the next vertex according to the result.
+      inc1 = (res != LARGER);
+      inc2 = (res != SMALLER);
+
+      if (inc1 && moved_on1 && (curr1 == bottom_left1)) {
+        inc1 = false;
+        inc2 = true;
+      }
+
+      if (inc2 && moved_on2 && (curr2 == bottom_left2)) {
+        inc1 = true;
+        inc2 = false;
+      }
+
+      if (inc1) {
+        curr1 = next1;
+        ++next1;
+        moved_on1 = true;
+      }
+
+      if (inc2) {
+        curr2 = next2;
+        ++next2;
+         moved_on2 = true;
+     }
+    } while ((curr1 != bottom_left1) || (curr2 != bottom_left2));
+  }
+};
+
+} //namespace CGAL
+
+#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/Offset_conv_2.h b/3rdparty/CGAL/include/CGAL/Minkowski_sum_2/Offset_conv_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/Offset_conv_2.h
rename to 3rdparty/CGAL/include/CGAL/Minkowski_sum_2/Offset_conv_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/Offset_decomp_2.h b/3rdparty/CGAL/include/CGAL/Minkowski_sum_2/Offset_decomp_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/Offset_decomp_2.h
rename to 3rdparty/CGAL/include/CGAL/Minkowski_sum_2/Offset_decomp_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/Polygon_convex_decomposition.h b/3rdparty/CGAL/include/CGAL/Minkowski_sum_2/Polygon_convex_decomposition.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/Polygon_convex_decomposition.h
rename to 3rdparty/CGAL/include/CGAL/Minkowski_sum_2/Polygon_convex_decomposition.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/Union_of_curve_cycles_2.h b/3rdparty/CGAL/include/CGAL/Minkowski_sum_2/Union_of_curve_cycles_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/Union_of_curve_cycles_2.h
rename to 3rdparty/CGAL/include/CGAL/Minkowski_sum_2/Union_of_curve_cycles_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/Union_of_cycles_2.h b/3rdparty/CGAL/include/CGAL/Minkowski_sum_2/Union_of_cycles_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/Union_of_cycles_2.h
rename to 3rdparty/CGAL/include/CGAL/Minkowski_sum_2/Union_of_cycles_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/Union_of_segment_cycles_2.h b/3rdparty/CGAL/include/CGAL/Minkowski_sum_2/Union_of_segment_cycles_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_2/Union_of_segment_cycles_2.h
rename to 3rdparty/CGAL/include/CGAL/Minkowski_sum_2/Union_of_segment_cycles_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_3/Gaussian_map.h b/3rdparty/CGAL/include/CGAL/Minkowski_sum_3/Gaussian_map.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_3/Gaussian_map.h
rename to 3rdparty/CGAL/include/CGAL/Minkowski_sum_3/Gaussian_map.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_3/Gaussian_map_to_nef_3.h b/3rdparty/CGAL/include/CGAL/Minkowski_sum_3/Gaussian_map_to_nef_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_3/Gaussian_map_to_nef_3.h
rename to 3rdparty/CGAL/include/CGAL/Minkowski_sum_3/Gaussian_map_to_nef_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_3/PointMark.h b/3rdparty/CGAL/include/CGAL/Minkowski_sum_3/PointMark.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_3/PointMark.h
rename to 3rdparty/CGAL/include/CGAL/Minkowski_sum_3/PointMark.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_3/bipartite_nary_union_sorted_combined.h b/3rdparty/CGAL/include/CGAL/Minkowski_sum_3/bipartite_nary_union_sorted_combined.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Minkowski_sum_3/bipartite_nary_union_sorted_combined.h
rename to 3rdparty/CGAL/include/CGAL/Minkowski_sum_3/bipartite_nary_union_sorted_combined.h
diff --git a/3rdparty/CGAL/include/CGAL/Modifiable_priority_queue.h b/3rdparty/CGAL/include/CGAL/Modifiable_priority_queue.h
new file mode 100644
index 0000000..066531c
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Modifiable_priority_queue.h
@@ -0,0 +1,134 @@
+// Copyright (c) 2006-2011  GeometryFactory (France). All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Fernando Cacciola <fernando.cacciola at geometryfactory.com>
+//
+#ifndef CGAL_MODIFIABLE_PRIORITY_QUEUE_H
+#define CGAL_MODIFIABLE_PRIORITY_QUEUE_H
+
+#include <climits> // Neeeded by the following Boost header for CHAR_BIT.
+#include <boost/optional.hpp>
+#ifdef CGAL_SURFACE_MESH_SIMPLIFICATION_USE_RELAXED_HEAP
+#include <boost/pending/relaxed_heap.hpp>
+#else
+#include <CGAL/internal/boost/mutable_queue.hpp>
+
+
+namespace CGAL {
+  namespace internal {
+template <class IndexedType, 
+          class RandomAccessContainer = std::vector<IndexedType>, 
+          class Comp = std::less<typename RandomAccessContainer::value_type>,
+          class ID = ::boost::identity_property_map >
+class mutable_queue_with_remove : public internal::boost_::mutable_queue<IndexedType,RandomAccessContainer,Comp,ID>
+{
+  typedef internal::boost_::mutable_queue<IndexedType,RandomAccessContainer,Comp,ID> Base;
+public:
+  typedef typename Base::size_type size_type;
+  typedef typename Base::Node Node;
+
+  mutable_queue_with_remove(size_type n, const Comp& x=Comp(), const ID& _id=ID()) : Base(n,x,_id,true) 
+  {}
+
+  void remove(const IndexedType& x){
+    //first place element at the top
+    size_type current_pos = this->index_array[ get(this->id, x) ];
+    this->c[current_pos] = x;
+
+    Node node(this->c.begin(), this->c.end(), this->c.begin()+current_pos, this->id);
+    while (node.has_parent())
+      node.swap(node.parent(), this->index_array);
+    //then pop it
+    this->pop();
+  }
+  
+  bool contains(const IndexedType& x) const {
+    return this->index_array[ get(this->id, x) ] !=this->index_array.size();
+  }
+};
+
+} } //namespace CGAL::internal
+#endif //CGAL_SURFACE_MESH_SIMPLIFICATION_USE_RELAXED_HEAP
+
+namespace CGAL {
+
+template <class IndexedType_ 
+         ,class Compare_ = std::less<IndexedType_>
+         ,class ID_      = boost::identity_property_map
+         >
+class Modifiable_priority_queue
+{
+public:
+
+  typedef Modifiable_priority_queue Self;
+  
+  typedef IndexedType_ IndexedType ;
+  typedef Compare_     Compare;
+  typedef ID_          ID ;
+  
+  #ifdef CGAL_SURFACE_MESH_SIMPLIFICATION_USE_RELAXED_HEAP
+  typedef boost::relaxed_heap<IndexedType,Compare,ID> Heap;
+  #else
+  typedef  internal::mutable_queue_with_remove<IndexedType,std::vector<IndexedType>,Compare,ID> Heap;
+  #endif //CGAL_SURFACE_MESH_SIMPLIFICATION_USE_RELAXED_HEAP
+  typedef typename Heap::value_type value_type;
+  typedef typename Heap::size_type  size_type;
+  
+  typedef bool handle ;
+  
+public:
+
+  Modifiable_priority_queue( size_type largest_ID, Compare const& c, ID const& id ) : mHeap(largest_ID,c,id) {}
+  
+  handle push ( value_type const& v ) { mHeap.push(v) ; return handle(true) ; }
+  
+  handle update ( value_type const& v, handle h ) { mHeap.update(v); return h ; }
+  
+  handle erase ( value_type const& v, handle  ) { mHeap.remove(v); return null_handle() ; }
+  handle erase ( value_type const& v  ) { mHeap.remove(v); return null_handle() ; }
+
+  value_type top() const { return mHeap.top() ; }
+  
+  void pop() { mHeap.pop(); }
+  
+  bool empty() const { return mHeap.empty() ; }
+
+  bool contains ( value_type const& v ) { return mHeap.contains(v) ; }
+
+  boost::optional<value_type> extract_top()
+  {
+    boost::optional<value_type> r ;
+    if ( !empty() )
+    {
+      value_type v = top();
+      pop();
+      r = boost::optional<value_type>(v) ;
+    }  
+    return r ;
+  }
+  
+  static handle null_handle() { return handle(false); }
+  
+private:
+
+  Heap mHeap ;  
+    
+} ;
+
+} //namespace CGAL
+
+#endif
+ 
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Modifier_base.h b/3rdparty/CGAL/include/CGAL/Modifier_base.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Modifier_base.h
rename to 3rdparty/CGAL/include/CGAL/Modifier_base.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Modular_arithmetic/Residue_type.h b/3rdparty/CGAL/include/CGAL/Modular_arithmetic/Residue_type.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Modular_arithmetic/Residue_type.h
rename to 3rdparty/CGAL/include/CGAL/Modular_arithmetic/Residue_type.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Modular_traits.h b/3rdparty/CGAL/include/CGAL/Modular_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Modular_traits.h
rename to 3rdparty/CGAL/include/CGAL/Modular_traits.h
diff --git a/3rdparty/CGAL/include/CGAL/Monge_via_jet_fitting.h b/3rdparty/CGAL/include/CGAL/Monge_via_jet_fitting.h
new file mode 100644
index 0000000..4f16701
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Monge_via_jet_fitting.h
@@ -0,0 +1,784 @@
+// Copyright (c) 2007  INRIA Sophia-Antipolis (France), INRIA Lorraine LORIA.
+// 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
+// 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(s)     : Marc Pouget and Frédéric Cazals
+#ifndef CGAL_MONGE_VIA_JET_FITTING_H_
+#define CGAL_MONGE_VIA_JET_FITTING_H_
+
+#include <CGAL/Simple_cartesian.h>
+#include <CGAL/circulator.h>
+#include <CGAL/Linear_algebraCd.h>
+#include <CGAL/Cartesian_converter.h>
+#include <CGAL/Default_diagonalize_traits.h>
+#include <math.h>
+#include <utility>
+#ifdef CGAL_EIGEN3_ENABLED
+#include <CGAL/Eigen_svd.h>
+#else
+#ifdef CGAL_LAPACK_ENABLED
+#include <CGAL/Lapack_svd.h>
+#endif
+#endif
+
+namespace CGAL {
+
+inline
+unsigned int fact(unsigned int n){
+  unsigned int i, p=1;
+  for(i=2; i<=n; i++) p *= i;
+  return p;
+}
+
+////////////////////// CLASS Monge_via_jet_fitting ////////////////////////
+#ifdef CGAL_EIGEN3_ENABLED
+template < class DataKernel, class LocalKernel = Simple_cartesian<double>, class SvdTraits = Eigen_svd >
+#else
+#ifdef CGAL_LAPACK_ENABLED
+template < class DataKernel, class LocalKernel = Simple_cartesian<double>, class SvdTraits = Lapack_svd>  
+#else
+template < class DataKernel, class LocalKernel, class SvdTraits >  
+#endif
+#endif
+  class Monge_via_jet_fitting {
+ public:
+//////////////////////begin nested CLASS Monge_form ///////////////////
+class Monge_form {
+ public: 
+  typedef typename DataKernel::FT        FT;
+  typedef typename DataKernel::Point_3   Point_3;
+  typedef typename DataKernel::Vector_3  Vector_3;
+ protected:
+  //point on the fitted surface where diff quantities are computed
+  Point_3 m_origin_pt;
+  //the monge trihedron (d1,d2,n) is orthonormal direct
+  Vector_3 m_d1;   //maximal ppal dir
+  Vector_3 m_d2;   //minimal ppal dir
+  Vector_3 m_n;    //normal direction
+  //coeff = (k1, k2, //ppal curv
+  //         b0, b1, b2, b3, //third order
+  //         c0, c1, c2, c3, c4) //fourth order
+  //     if (degree==1) no coeff needed
+  std::vector<FT> m_coefficients;
+  
+public:
+  //constructor
+  Monge_form() {
+    m_origin_pt  = Point_3(0.,0.,0.); 
+    m_d1 = Vector_3(0.,0.,0.);
+    m_d2 = Vector_3(0.,0.,0.);
+    m_n = Vector_3(0.,0.,0.);
+    m_coefficients = std::vector<FT>();
+  }
+  ~Monge_form() {}
+  //access
+  const Point_3 origin() const { return m_origin_pt; }
+  Point_3& origin() { return m_origin_pt; }
+  const Vector_3 maximal_principal_direction() const { return m_d1; }
+  Vector_3& maximal_principal_direction() { return m_d1; }
+  const Vector_3 minimal_principal_direction() const { return m_d2; }
+  Vector_3& minimal_principal_direction() { return m_d2; }
+  const Vector_3 normal_direction() const { return m_n; }
+  Vector_3& normal_direction() { return m_n; }
+  const std::vector<FT> coefficients() const { return m_coefficients; }
+  std::vector<FT>& coefficients() { return m_coefficients; }
+
+  const FT principal_curvatures(size_t i) const {
+    CGAL_precondition( (i == 0 || i == 1) && coefficients().size() >=2 );
+    return coefficients()[i]; }
+  const FT third_order_coefficients(size_t i) const {
+    CGAL_precondition( i <= 3 && coefficients().size() >=6 );
+    return coefficients()[i+2]; }
+  const FT fourth_order_coefficients(size_t i) const {
+    CGAL_precondition( i <= 4 && coefficients().size() >=11 );
+    return coefficients()[i+6]; }
+ 
+  //if d>=2, number of coeffs = (d+1)(d+2)/2 -4. 
+  //we remove cst, linear and the xy coeff which vanish
+  void set_up(std::size_t degree);
+  //switch min-max ppal curv/dir wrt a given normal orientation.
+  // if given_normal.monge_normal < 0 then change the orientation
+  // if z=g(x,y) in the basis (d1,d2,n) then in the basis (d2,d1,-n)
+  // z=h(x,y)=-g(y,x)
+  void comply_wrt_given_normal(const Vector_3& given_normal);
+  void dump_verbose(std::ostream& out_stream) const;
+  void dump_4ogl(std::ostream& out_stream, const FT scale);
+};
+//////////////////////end nested CLASS Monge_form /////////////////////
+
+//continue main class Monge_via_jet_fitting ////////
+ public:
+ typedef  DataKernel   Data_kernel;
+ typedef  LocalKernel  Local_kernel;
+ 
+ //used to convert number types, points and vectors back and forth
+ typedef NT_converter<typename Local_kernel::FT, typename  Data_kernel::FT> L2D_NTconverter;
+ Cartesian_converter<Data_kernel, Local_kernel> D2L_converter; 
+ Cartesian_converter<Local_kernel, Data_kernel> L2D_converter; 
+  
+ typedef typename Local_kernel::FT       FT;
+ typedef typename Local_kernel::Point_3  Point_3;
+ typedef typename Local_kernel::Vector_3 Vector_3;
+ typedef CGAL::Aff_transformation_3<Local_kernel> Aff_transformation;
+
+ typedef typename Data_kernel::FT       DFT;
+
+ typedef typename SvdTraits::Vector LAVector;
+ typedef typename SvdTraits::Matrix LAMatrix;
+ 
+
+ public:
+ Monge_via_jet_fitting(); 
+ template <class InputIterator>
+ Monge_form operator()(InputIterator begin, InputIterator end,  
+		       size_t d, size_t dprime);
+ const FT condition_number() const {return condition_nb;}
+ const std::pair<FT, Vector_3> pca_basis(size_t i) const {
+   CGAL_precondition( i<3 );
+   return m_pca_basis[i];}
+ 
+ protected:
+ int deg;
+ int deg_monge;
+  int nb_d_jet_coeff;
+  int nb_input_pts;
+  FT preconditionning;
+  CGAL::Sqrt<FT> Lsqrt;
+  FT condition_nb;
+  
+  std::vector< std::pair<FT, Vector_3> > m_pca_basis;
+
+  //translate_p0 changes the origin of the world to p0 the first point 
+  //  of the input data points
+  //change_world2fitting (coord of a vector in world) = coord of this 
+  //  vector in fitting. The matrix tranform has as lines the coord of
+  //  the basis vectors of fitting in the world coord. 
+  //idem for change_fitting2monge
+  Aff_transformation translate_p0, change_world2fitting,
+    change_fitting2monge;
+
+  //eigen val and vect stored in m_pca_basis
+  // change_world2fitting is computed 
+ template <class InputIterator>
+  void compute_PCA(InputIterator begin, InputIterator end); 
+
+  //Coordinates of input points are computed in the fitting basis with 
+  //  p0 as origin.
+  //Preconditionning is computed, M and Z are filled
+ template <class InputIterator>
+  void fill_matrix(InputIterator begin, InputIterator end,
+		   std::size_t d, LAMatrix& M, LAVector& Z);
+  //A is computed, solving MA=Z in the ls sense, the solution A is stored in Z
+  //Preconditionning is needed
+  void solve_linear_system(LAMatrix &M, LAVector& Z);
+  
+  //Classical differential geometric calculus
+  //change_fitting2monge is computed
+  //if deg_monge =1 only 1st order info
+  //if deg_monge >= 2 2nd order info are computed
+  void compute_Monge_basis(const FT* A, Monge_form& monge_form);
+
+  //if deg_monge >=3 then 3rd (and 4th) order info are computed
+  void compute_Monge_coefficients(FT* A, std::size_t dprime, 
+				  Monge_form& monge_form);
+
+  //for a trihedron (v1,v2,v3) switches v1 to -v1 if det(v1,v2,v3) < 0
+  void switch_to_direct_orientation(Vector_3& v1, const Vector_3& v2,
+				   const Vector_3& v3);
+
+    friend
+    std::ostream&
+    operator<<(std::ostream& out_stream, 
+	       const typename Monge_via_jet_fitting<DataKernel, LocalKernel, SvdTraits>::Monge_form& monge){
+      monge.dump_verbose(out_stream);
+      return out_stream;
+    }
+};
+
+//-------------------------------------------------------------------
+// Implementation
+//------------------------------------------------------------------
+
+// Implementation nested Monge_form //////////////////////////////
+//template <class DataKernel>
+template < class DataKernel, class LocalKernel, class SvdTraits>  
+  void Monge_via_jet_fitting<DataKernel, LocalKernel, SvdTraits>::
+  Monge_form::
+set_up(std::size_t degree) {
+  if ( degree >= 2 ) std::fill_n(back_inserter(m_coefficients),
+				 (degree+1)*(degree+2)/2-4, 0.);
+}
+
+
+template < class DataKernel, class LocalKernel, class SvdTraits>  
+void Monge_via_jet_fitting<DataKernel, LocalKernel, SvdTraits>::Monge_form::
+comply_wrt_given_normal(const Vector_3& given_normal)
+{
+  if ( given_normal*this->normal_direction() < 0 )
+    {
+      normal_direction() = -normal_direction();
+      std::swap(maximal_principal_direction(), minimal_principal_direction());
+      if ( coefficients().size() >= 2) 
+	std::swap(coefficients()[0],coefficients()[1]);
+      if ( coefficients().size() >= 6) {
+	std::swap(coefficients()[2],coefficients()[5]);
+	std::swap(coefficients()[3],coefficients()[4]);}
+      if ( coefficients().size() >= 11) {
+	std::swap(coefficients()[6],coefficients()[10]);
+	std::swap(coefficients()[7],coefficients()[9]);}
+      typename std::vector<FT>::iterator itb = coefficients().begin(),
+	ite = coefficients().end();
+      for (;itb!=ite;itb++) { *itb = -(*itb); }
+    }
+}
+
+template < class DataKernel, class LocalKernel, class SvdTraits>  
+void Monge_via_jet_fitting<DataKernel, LocalKernel, SvdTraits>::Monge_form::
+dump_verbose(std::ostream& out_stream) const
+{
+  out_stream << "origin : " << origin() << std::endl
+	     << "n : " << normal_direction() << std::endl;
+  if ( coefficients().size() >= 2) 
+    out_stream << "d1 : " << maximal_principal_direction() << std::endl 
+	       << "d2 : " << minimal_principal_direction() << std::endl
+	       << "k1 : " << coefficients()[0] << std::endl 
+	       << "k2 : " << coefficients()[1] << std::endl;	      
+  if ( coefficients().size() >= 6) 
+    out_stream << "b0 : " << coefficients()[2] << std::endl 
+	       << "b1 : " << coefficients()[3] << std::endl
+ 	       << "b2 : " << coefficients()[4] << std::endl
+ 	       << "b3 : " << coefficients()[5] << std::endl;
+  if ( coefficients().size() >= 11) 
+    out_stream << "c0 : " << coefficients()[6] << std::endl 
+	       << "c1 : " << coefficients()[7] << std::endl
+ 	       << "c2 : " << coefficients()[8] << std::endl
+ 	       << "c3 : " << coefficients()[9] << std::endl 
+ 	       << "c4 : " << coefficients()[10] << std::endl
+	       << std::endl; 
+}
+
+template < class DataKernel, class LocalKernel, class SvdTraits>  
+void Monge_via_jet_fitting<DataKernel, LocalKernel, SvdTraits>::Monge_form::
+dump_4ogl(std::ostream& out_stream, const FT scale)
+{
+  CGAL_precondition( coefficients().size() >= 2 );
+  out_stream << origin()  << " "
+	     << maximal_principal_direction() * scale << " "
+	     << minimal_principal_direction() * scale << " "
+	     << coefficients()[0] << " "
+	     << coefficients()[1] << " "
+	     << std::endl;
+}
+//////////////////////////////////////////////////////////////
+// Implementation main Monge_via_jet_fiting
+
+template < class DataKernel, class LocalKernel, class SvdTraits>  
+  Monge_via_jet_fitting<DataKernel, LocalKernel, SvdTraits>::
+  Monge_via_jet_fitting()
+{
+  m_pca_basis = std::vector< std::pair<FT, Vector_3> >(3);
+} 
+
+template < class DataKernel, class LocalKernel, class SvdTraits> 
+template <class InputIterator>
+  typename  Monge_via_jet_fitting<DataKernel, LocalKernel, SvdTraits>::Monge_form
+  Monge_via_jet_fitting<DataKernel, LocalKernel, SvdTraits>::
+  operator()(InputIterator begin, InputIterator end, 
+	     size_t d, size_t dprime)
+{
+  // precondition: on the degrees, jet and monge
+  CGAL_precondition( (d >=1) && (dprime >= 1) 
+		     && (dprime <= 4) && (dprime <= d) );
+  this->deg = static_cast<int>(d);
+  this->deg_monge = static_cast<int>(dprime);
+  this->nb_d_jet_coeff = static_cast<int>((d+1)*(d+2)/2);
+  this->nb_input_pts = static_cast<int>(end - begin);
+  // precondition: solvable ls system
+  CGAL_precondition( nb_input_pts >= nb_d_jet_coeff );
+
+  //Initialize
+  Monge_form monge_form;
+  monge_form.set_up(dprime);
+  //for the system MA=Z
+  LAMatrix M(nb_input_pts, nb_d_jet_coeff);
+  LAVector Z(nb_input_pts);
+
+  compute_PCA(begin, end);
+  fill_matrix(begin, end, d, M, Z);//with precond
+  solve_linear_system(M, Z);  //correct with precond
+  compute_Monge_basis(Z.vector(), monge_form);
+  if ( dprime >= 3) compute_Monge_coefficients(Z.vector(), dprime, monge_form);
+  return monge_form;
+}
+
+template < class DataKernel, class LocalKernel, class SvdTraits>  
+template <class InputIterator>
+void Monge_via_jet_fitting<DataKernel, LocalKernel, SvdTraits>::
+compute_PCA(InputIterator begin, InputIterator end)
+{
+  int n = this->nb_input_pts;
+  FT x, y, z,
+    sumX = 0., sumY = 0., sumZ = 0.,
+    sumX2 = 0., sumY2 = 0., sumZ2 = 0.,
+    sumXY = 0., sumXZ = 0., sumYZ = 0., 
+    xx, yy, zz, xy, xz, yz;
+  
+  for (; begin != end; begin++)
+    {
+      Point_3 lp = D2L_converter(*begin);
+      x = lp.x();
+      y = lp.y();
+      z = lp.z();   
+      sumX += x / n;
+      sumY += y / n;
+      sumZ += z / n;
+      sumX2 += x * x / n;
+      sumY2 += y * y / n;
+      sumZ2 += z * z / n;
+      sumXY += x * y / n;
+      sumXZ += x * z / n;
+      sumYZ += y * z / n;
+    }
+  xx = sumX2 - sumX * sumX;
+  yy = sumY2 - sumY * sumY;
+  zz = sumZ2 - sumZ * sumZ;
+  xy = sumXY - sumX * sumY;
+  xz = sumXZ - sumX * sumZ;
+  yz = sumYZ - sumY * sumZ;
+
+  // assemble covariance matrix as a
+  // semi-definite matrix. 
+  // Matrix numbering:
+  // 0 1 2
+  //   3 4
+  //     5
+  CGAL::cpp11::array<FT, 6> covariance = {{ xx,xy,xz,yy,yz,zz }};
+  CGAL::cpp11::array<FT, 3> eigen_values = {{ 0., 0., 0. }};
+  CGAL::cpp11::array<FT, 9> eigen_vectors = {{ 0., 0., 0. }};
+
+  // solve for eigenvalues and eigenvectors.
+  // eigen values are sorted in ascending order, 
+  // eigen vectors are sorted in accordance.
+  CGAL::Default_diagonalize_traits<FT,3>::diagonalize_selfadjoint_covariance_matrix
+    (covariance, eigen_values, eigen_vectors);
+
+  //store in m_pca_basis
+  for (int i=0; i<3; i++)
+    {
+      m_pca_basis[i].first =  eigen_values[2-i];
+    }
+
+  Vector_3 v1(eigen_vectors[6],eigen_vectors[7],eigen_vectors[8]);
+  m_pca_basis[0].second = v1;
+  Vector_3 v2(eigen_vectors[3],eigen_vectors[4],eigen_vectors[5]);
+  m_pca_basis[1].second = v2;
+  Vector_3 v3(eigen_vectors[0],eigen_vectors[1],eigen_vectors[2]);
+  m_pca_basis[2].second = v3;
+  switch_to_direct_orientation(m_pca_basis[0].second,
+			       m_pca_basis[1].second,
+			       m_pca_basis[2].second);
+ 
+  //Store the change of basis W->F
+  Aff_transformation 
+    change_basis (m_pca_basis[0].second[0], m_pca_basis[0].second[1], m_pca_basis[0].second[2], 
+		  m_pca_basis[1].second[0], m_pca_basis[1].second[1], m_pca_basis[1].second[2],
+		  m_pca_basis[2].second[0], m_pca_basis[2].second[1], m_pca_basis[2].second[2]);
+
+   this->change_world2fitting = change_basis; 
+}
+
+template < class DataKernel, class LocalKernel, class SvdTraits>  
+template <class InputIterator>
+void Monge_via_jet_fitting<DataKernel, LocalKernel, SvdTraits>::
+fill_matrix(InputIterator begin, InputIterator end,
+	    std::size_t d, LAMatrix &M, LAVector& Z)
+{
+  //origin of fitting coord system = first input data point
+  Point_3 point0 = D2L_converter(*begin);
+  //transform coordinates of sample points with a
+  //translation ($-p$) and multiplication by $ P_{W\rightarrow F}$.
+  Point_3 orig(0.,0.,0.);
+  Vector_3 v_point0_orig(orig - point0);
+  Aff_transformation transl(CGAL::TRANSLATION, v_point0_orig);
+  this->translate_p0 = transl;
+  Aff_transformation transf_points = this->change_world2fitting *
+    this->translate_p0;
+  
+  //compute and store transformed points
+  std::vector<Point_3> pts_in_fitting_basis;
+  pts_in_fitting_basis.reserve(this->nb_input_pts);
+  CGAL_For_all(begin,end){
+    Point_3 cur_pt = transf_points(D2L_converter(*begin));
+    pts_in_fitting_basis.push_back(cur_pt);
+  }
+  
+  //Compute preconditionning
+  FT precond = 0.;
+  typename std::vector<Point_3>::iterator itb = pts_in_fitting_basis.begin(),
+    ite = pts_in_fitting_basis.end();
+  CGAL_For_all(itb,ite) precond += CGAL::abs(itb->x()) + CGAL::abs(itb->y());
+  precond /= 2*this->nb_input_pts;
+  this->preconditionning = precond;
+  //fill matrices M and Z
+  itb = pts_in_fitting_basis.begin();
+  int line_count = 0;
+  FT x, y;
+  CGAL_For_all(itb,ite) {
+    x = itb->x();
+    y = itb->y();
+    //  Z[line_count] = itb->z();
+    Z.set(line_count,itb->z());
+    for (std::size_t k=0; k <= d; k++) {
+      for (std::size_t i=0; i<=k; i++) {
+        M.set(line_count, k*(k+1)/2+i,
+              std::pow(x,static_cast<int>(k-i))
+              * std::pow(y,static_cast<int>(i))
+              /( fact(static_cast<unsigned int>(i)) *
+                 fact(static_cast<unsigned int>(k-i))
+                 *std::pow(this->preconditionning,static_cast<int>(k))));
+      }
+    }
+    line_count++;
+  }
+}
+
+template < class DataKernel, class LocalKernel, class SvdTraits>  
+void Monge_via_jet_fitting<DataKernel, LocalKernel, SvdTraits>::
+solve_linear_system(LAMatrix &M, LAVector& Z)
+{
+  condition_nb = SvdTraits::solve(M, Z); 
+  for (int k=0; k <= this->deg; k++) for (int i=0; i<=k; i++)
+    // Z[k*(k+1)/2+i] /= std::pow(this->preconditionning,k);
+    Z.set( k*(k+1)/2+i, Z(k*(k+1)/2+i) / std::pow(this->preconditionning,k) );
+}
+
+template < class DataKernel, class LocalKernel, class SvdTraits>   
+void Monge_via_jet_fitting<DataKernel, LocalKernel, SvdTraits>::
+compute_Monge_basis(const FT* A, Monge_form& monge_form)
+{
+  // only 1st order info.
+  if ( this->deg_monge == 1 ) {  
+    Point_3 orig_monge(0., 0., A[0]);
+    Vector_3  normal(-A[1], -A[2], 1.);
+    FT norm2 = normal * normal;
+    normal = normal / Lsqrt(norm2);
+    monge_form.origin() = L2D_converter(
+      (this->translate_p0.inverse() * 
+       this->change_world2fitting.inverse()) (orig_monge) );
+    monge_form.normal_direction() = L2D_converter(this->change_world2fitting.inverse()(normal));
+  }
+  // else (deg_monge >= 2) then 2nd order info are computed
+  else {
+  //bi-index to uni-index conversion : A(i,j)=A[(i+j)(i+j+1)/2+j]
+  Point_3 orig_monge(0., 0., A[0]);
+  //normal = Xu crossprod Xv
+  Vector_3 Xu(1.,0.,A[1]), Xv(0.,1.,A[2]), normal(-A[1], -A[2], 1.);
+  FT norm2 = normal * normal;
+  normal = normal / Lsqrt(norm2);
+
+  //Surface in fitting_basis : X(u,v)=(u,v,J_A(u,v))
+  //in the basis Xu=(1,0,A[1]), Xv=(0,1,A[2]), Weingarten=-I^{-1}II
+  //first fond form I=(e,f,f,g)
+  //                 =(Xu.Xu, Xu.Xv, Xu.Xv, Xv.Xv)
+  //second fond form II=(l,m,m,n)/norm2^(1/2)
+  //                   =(n.Xuu, n.Xuv, n.Xuv, n.Xvv)
+  //ppal curv are the opposite of the eigenvalues of Weingarten or the
+  //  eigenvalues of weingarten = -Weingarten = I^{-1}II
+  typedef typename CGAL::Linear_algebraCd<FT>::Matrix Matrix;
+
+  FT e = 1+A[1]*A[1], f = A[1]*A[2], g = 1+A[2]*A[2],
+    l = A[3], m = A[4], n = A[5];
+  Matrix  weingarten(2,2,0.);
+  weingarten(0,0) = (g*l-f*m)/ (Lsqrt(norm2)*norm2);
+  weingarten(0,1) = (g*m-f*n)/ (Lsqrt(norm2)*norm2);
+  weingarten(1,0) = (e*m-f*l)/ (Lsqrt(norm2)*norm2);
+  weingarten(1,1) = (e*n-f*m)/ (Lsqrt(norm2)*norm2);
+  // Y, Z are normalized GramSchmidt of Xu, Xv
+  // Xu->Y=Xu/||Xu||;
+  // Xv->Z=Xv-(Xu.Xv)Xu/||Xu||^2;
+  // Z-> Z/||Z||
+  Vector_3 Y, Z;
+  FT normXu = Lsqrt( Xu*Xu );
+  Y = Xu / normXu;
+  FT XudotXv = Xu * Xv;
+  Z = Xv - XudotXv * Xu / (normXu*normXu);
+  FT normZ = Lsqrt( Z*Z );
+  Z = Z / normZ;
+  Matrix change_XuXv2YZ(2,2,0.);
+  change_XuXv2YZ(0,0) = 1 / normXu;
+  change_XuXv2YZ(0,1) = -XudotXv / (normXu * normXu * normZ);
+  change_XuXv2YZ(1,0) = 0;
+  change_XuXv2YZ(1,1) = 1 / normZ;
+  FT det = 0.;
+  Matrix inv = CGAL::Linear_algebraCd<FT>::inverse ( change_XuXv2YZ, det );
+  //in the new orthonormal basis (Y,Z) of the tangent plane :
+  weingarten = inv *(1/det) * weingarten * change_XuXv2YZ;
+  
+  // diagonalization of weingarten
+  CGAL::cpp11::array<FT,3> W = {{ weingarten(0,0), weingarten(1,0), weingarten(1,1) }};
+  CGAL::cpp11::array<FT,2> eval = {{ 0., 0. }};
+  CGAL::cpp11::array<FT,4> evec = {{ 0., 0., 0., 0. }};
+
+  //eval in increasing order
+  CGAL::Default_diagonalize_traits<FT,2>::diagonalize_selfadjoint_covariance_matrix
+    (W, eval, evec);
+
+  Vector_3 d_max = evec[2]*Y + evec[3]*Z,
+    d_min = evec[0]*Y + evec[1]*Z;
+
+  switch_to_direct_orientation(d_max, d_min, normal);
+  Aff_transformation change_basis (d_max[0], d_max[1], d_max[2], 
+				   d_min[0], d_min[1], d_min[2],
+				   normal[0], normal[1], normal[2]);
+  this->change_fitting2monge = change_basis;
+
+  //store the monge basis origin and vectors with their world coord
+  //store ppal curv
+  monge_form.origin() = L2D_converter(
+    (this->translate_p0.inverse() * 
+     this->change_world2fitting.inverse()) (orig_monge ));
+  monge_form.maximal_principal_direction() = L2D_converter(this->change_world2fitting.inverse()(d_max));
+  monge_form.minimal_principal_direction() = L2D_converter(this->change_world2fitting.inverse()(d_min));
+  monge_form.normal_direction()  = L2D_converter(this->change_world2fitting.inverse()(normal));
+  monge_form.coefficients()[0] = L2D_NTconverter()(eval[1]);
+  monge_form.coefficients()[1] = L2D_NTconverter()(eval[0]);
+  }
+  //end else
+}
+
+template < class DataKernel, class LocalKernel, class SvdTraits>  
+void Monge_via_jet_fitting<DataKernel, LocalKernel, SvdTraits>::
+compute_Monge_coefficients(FT* A, std::size_t dprime, 
+			   Monge_form& monge_form)
+{
+  //One has the equation w=J_A(u,v) of the fitted surface S 
+  // in the fitting_basis
+  //Substituing (u,v,w)=change_fitting2monge^{-1}(x,y,z)
+  //One has the equation f(x,y,z)=0 on this surface S in the monge
+  //  basis
+  //The monge form of the surface at the origin is the bivariate fct
+  //   g(x,y) s.t. f(x,y,g(x,y))=0
+  //voir les calculs Maple dans monge.mws
+  //Notations are f123= d^3f/dxdydz
+  //              g(x,y)=sum (gij x^i y^j/ i!j!) with 
+  //              g00=g10=g01=g11=0, g20=kmax, g02=kmin
+  //
+  //g(x,y)= 1/2*(k1x^2 +k2y^2) 
+  //       +1/6*(b0x^3 +3b1x^2y +3b2xy^2 +b3y^3) 
+  //       +1/24*(c0x^4 +4c1x^3y +6c2x^2y^2 +4c3xy^3 +c4y^4)
+  //       +...
+  // p stores change_fitting2monge^{-1}=change_fitting2monge^{T}
+  FT p[3][3];
+  p[0][0] = this->change_fitting2monge.m(0,0);
+  p[1][0] = this->change_fitting2monge.m(0,1);
+  p[2][0] = this->change_fitting2monge.m(0,2);
+  p[0][1] = this->change_fitting2monge.m(1,0);
+  p[1][1] = this->change_fitting2monge.m(1,1);
+  p[2][1] = this->change_fitting2monge.m(1,2);
+  p[0][2] = this->change_fitting2monge.m(2,0);
+  p[1][2] = this->change_fitting2monge.m(2,1);
+  p[2][2] = this->change_fitting2monge.m(2,2);
+
+  // formula are designed for w=sum( Aij ui vj), but we have J_A = sum( Aij/i!j! ui vj)
+  for (int k=0; k <= this->deg; k++) for (int i=0; i<=k; i++)
+    A[k*(k+1)/2+i] /= fact(k-i)*fact(i);//this is A(k-i;i)
+
+/*   //debug */
+/*   std::cout << "coeff of A" << std::endl */
+/* 	    << A[0] << " "<< A[1] << " "<< A[2] << std::endl */
+/* 	    << A[3] << " "<< A[4] << " "<< A[5] << std::endl */
+/* 	    << A[6] << " "<< A[7] << " "<< A[8] << " "<< A[9]<< std::endl */
+/* 	    << A[10] << " "<< A[11] << " "<< A[12] << " "<< A[13]<< " " << A[14] << std::endl; */
+
+
+
+  //     note f1 = f2 = f12 = 0 
+  //     FT f1 = A[1] * p[0][0] + A[2] * p[1][0] - p[2][0];
+  //     FT f2 = A[2] * p[1][1] + A[1] * p[0][1] - p[2][1];
+  //     FT f12 = 
+  //     2 * A[3] * p[0][0] * p[0][1]
+  //     + 2 * A[5] * p[1][0] * p[1][1]
+  //     + A[4] * p[0][1] * p[1][0] 
+  //     + A[4] * p[0][0] * p[1][1];
+  //         -f11 / f3 = kmax
+  //         -f22 / f3 = kmin 
+ 
+  FT f3 = A[1] * p[0][2] + A[2] * p[1][2] - p[2][2];
+  FT f11 =
+    2 * A[4] * p[0][0] * p[1][0]
+    + 2 * A[5] * p[1][0] * p[1][0]
+    + 2 * A[3] * p[0][0] * p[0][0];
+  FT f13 =
+    A[4] * p[0][0] * p[1][2]
+    + A[4] * p[0][2] * p[1][0]
+    + 2 * A[5] * p[1][0] * p[1][2]
+    + 2 * A[3] * p[0][0] * p[0][2];
+  FT f22 =
+    2 * A[4] * p[0][1] * p[1][1]
+    + 2 * A[5] * p[1][1] * p[1][1]
+    + 2 * A[3] * p[0][1] * p[0][1];
+  FT f23 =
+    A[4] * p[0][1] * p[1][2]
+    + 2 * A[5] * p[1][1] * p[1][2]
+    + A[4] * p[0][2] * p[1][1]
+    + 2 * A[3] * p[0][1] * p[0][2];
+  FT f33 =
+    2 * A[5] * p[1][2] * p[1][2]
+    + 2 * A[3] * p[0][2] * p[0][2]
+    + 2 * A[4] * p[0][2] * p[1][2];
+  FT f111 =
+    6 * A[8] * p[0][0] * p[1][0] * p[1][0]
+    + 6 * A[7] * p[0][0] * p[0][0] * p[1][0]
+    + 6 * A[6] * p[0][0] * p[0][0] * p[0][0]
+    + 6 * A[9] * p[1][0] * p[1][0] * p[1][0];
+  FT f222 =
+    6 * A[7] * p[0][1] * p[0][1] * p[1][1]
+    + 6 * A[8] * p[0][1] * p[1][1] * p[1][1]
+    + 6 * A[9] * p[1][1] * p[1][1] * p[1][1]
+    + 6 * A[6] * p[0][1] * p[0][1] * p[0][1];
+  FT f112 =
+    2 * A[7] * p[0][0] * p[0][0] * p[1][1]
+    + 6 * A[6] * p[0][0] * p[0][0] * p[0][1]
+    + 2 * A[8] * p[0][1] * p[1][0] * p[1][0]
+    + 4 * A[8] * p[0][0] * p[1][0] * p[1][1]
+    + 6 * A[9] * p[1][0] * p[1][0] * p[1][1]
+    + 4 * A[7] * p[0][0] * p[0][1] * p[1][0];
+  FT f122 =
+    4 * A[8] * p[0][1] * p[1][0] * p[1][1]
+    + 2 * A[8] * p[0][0] * p[1][1] * p[1][1]
+    + 6 * A[6] * p[0][0] * p[0][1] * p[0][1]
+    + 2 * A[7] * p[0][1] * p[0][1] * p[1][0]
+    + 4 * A[7] * p[0][0] * p[0][1] * p[1][1]
+    + 6 * A[9] * p[1][0] * p[1][1] * p[1][1];
+  FT f113 = 
+    6*A[6]*p[0][0]*p[0][0]*p[0][2]
+    +6*A[9]*p[1][0]*p[1][0]*p[1][2]
+    +2*A[7]*p[0][0]*p[0][0]*p[1][2]
+    +2*A[8]*p[0][2]*p[1][0]*p[1][0]
+    +4*A[7]*p[0][0]*p[0][2]*p[1][0]
+    +4*A[8]*p[0][0]*p[1][0]*p[1][2];
+  FT f223 = 
+    2*A[8]*p[0][2]*p[1][1]*p[1][1]
+    +6*A[6]*p[0][1]*p[0][1]*p[0][2]
+    +6*A[9]*p[1][1]*p[1][1]*p[1][2]
+    +2*A[7]*p[0][1]*p[0][1]*p[1][2]
+    +4*A[7]*p[0][1]*p[0][2]*p[1][1]
+    +4*A[8]*p[0][1]*p[1][1]*p[1][2];
+  FT f123 = 
+    2*A[8]*p[0][2]*p[1][0]*p[1][1]
+    +2*A[7]*p[0][0]*p[0][1]*p[1][2]
+    +2*A[7]*p[0][0]*p[0][2]*p[1][1]
+    +6*A[9]*p[1][0]*p[1][1]*p[1][2]
+    +2*A[7]*p[0][1]*p[0][2]*p[1][0]
+    +6*A[6]*p[0][0]*p[0][1]*p[0][2]
+    +2*A[8]*p[0][0]*p[1][1]*p[1][2]
+    +2*A[8]*p[0][1]*p[1][0]*p[1][2];
+
+  FT b0 = 1/(f3*f3)*(-f111*f3+3*f13*f11);
+  FT b1 = 1/(f3*f3)*(-f112*f3+f23*f11);
+  FT b2 = 1/(f3*f3)*(-f122*f3+f13*f22);
+  FT b3 = -1/(f3*f3)*(f222*f3-3*f23*f22);
+  
+  monge_form.coefficients()[2] = L2D_NTconverter()(b0);
+  monge_form.coefficients()[3] = L2D_NTconverter()(b1);
+  monge_form.coefficients()[4] = L2D_NTconverter()(b2);
+  monge_form.coefficients()[5] = L2D_NTconverter()(b3);
+
+  if ( dprime == 4 )
+    {
+      FT f1111 = 
+	24*A[13]*p[0][0]*p[1][0]*p[1][0]*p[1][0]
+	+24*A[12]*p[0][0]*p[0][0]*p[1][0]*p[1][0]
+	+24*A[11]*p[0][0]*p[0][0]*p[0][0]*p[1][0]
+	+24*A[14]*p[1][0]*p[1][0]*p[1][0]*p[1][0]
+	+24*A[10]*p[0][0]*p[0][0]*p[0][0]*p[0][0];
+      FT f1112 = 
+	6*A[13]*p[0][1]*p[1][0]*p[1][0]*p[1][0]
+	+18*A[13]*p[0][0]*p[1][0]*p[1][0]*p[1][1]
+	+24*A[10]*p[0][0]*p[0][0]*p[0][0]*p[0][1]
+	+12*A[12]*p[0][0]*p[0][1]*p[1][0]*p[1][0]
+	+18*A[11]*p[0][0]*p[0][0]*p[0][1]*p[1][0]
+	+24*A[14]*p[1][0]*p[1][0]*p[1][0]*p[1][1]
+	+6*A[11]*p[0][0]*p[0][0]*p[0][0]*p[1][1]
+	+12*A[12]*p[0][0]*p[0][0]*p[1][0]*p[1][1];
+      FT f1122 = 
+	12*A[11]*p[0][0]*p[0][0]*p[0][1]*p[1][1]
+	+12*A[13]*p[0][0]*p[1][0]*p[1][1]*p[1][1]
+	+12*A[13]*p[0][1]*p[1][0]*p[1][0]*p[1][1]
+	+16*A[12]*p[0][0]*p[0][1]*p[1][0]*p[1][1]
+	+12*A[11]*p[0][0]*p[0][1]*p[0][1]*p[1][0]
+	+24*A[10]*p[0][0]*p[0][0]*p[0][1]*p[0][1]
+	+4*A[12]*p[0][1]*p[0][1]*p[1][0]*p[1][0]
+	+4*A[12]*p[0][0]*p[0][0]*p[1][1]*p[1][1]
+	+24*A[14]*p[1][0]*p[1][0]*p[1][1]*p[1][1];
+      FT f1222 = 
+	6*A[13]*p[0][0]*p[1][1]*p[1][1]*p[1][1]
+	+24*A[10]*p[0][0]*p[0][1]*p[0][1]*p[0][1]
+	+24*A[14]*p[1][0]*p[1][1]*p[1][1]*p[1][1]
+	+6*A[11]*p[0][1]*p[0][1]*p[0][1]*p[1][0]
+	+18*A[11]*p[0][0]*p[0][1]*p[0][1]*p[1][1]
+	+12*A[12]*p[0][0]*p[0][1]*p[1][1]*p[1][1]
+	+12*A[12]*p[0][1]*p[0][1]*p[1][0]*p[1][1]
+	+18*A[13]*p[0][1]*p[1][0]*p[1][1]*p[1][1];
+      FT f2222 =
+	24*A[13]*p[0][1]*p[1][1]*p[1][1]*p[1][1]
+	+24*A[11]*p[0][1]*p[0][1]*p[0][1]*p[1][1]
+	+24*A[12]*p[0][1]*p[0][1]*p[1][1]*p[1][1]
+	+24*A[10]*p[0][1]*p[0][1]*p[0][1]*p[0][1]
+	+24*A[14]*p[1][1]*p[1][1]*p[1][1]*p[1][1];
+
+      FT c0 =
+	-1/(f3*f3*f3)*(f1111*(f3*f3)-4*f13*f3*f111+12*f13*f13*f11-6*f113*f3*f11+3*f33*f11*f11);
+      FT c1 =
+	1/(f3*f3*f3)*(f23*f3*f111+3*f3*f123*f11+3*f13*f3*f112-f1112*(f3*f3)-6*f13*f23*f11); 
+      FT c2 =
+	1/(f3*f3*f3)*(-f33*f22*f11+f113*f3*f22+2*f13*f3*f122-2*f13*f13*f22+f223*f3*f11+2*f23*f3*f112-2*f23*f23*f11-f1122*(f3*f3)); 
+      FT c3 =
+	1/(f3*f3*f3)*(-f1222*(f3*f3)-6*f13*f23*f22+3*f123*f3*f22+f13*f3*f222+3*f23*f3*f122); 
+      FT c4 =
+	-1/(f3*f3*f3)*(f2222*(f3*f3)+3*f33*f22*f22-6*f223*f3*f22-4*f23*f3*f222+12*f23*f23*f22) ; 
+      
+      monge_form.coefficients()[6] = L2D_NTconverter()(c0);
+      monge_form.coefficients()[7] = L2D_NTconverter()(c1);
+      monge_form.coefficients()[8] = L2D_NTconverter()(c2);
+      monge_form.coefficients()[9] = L2D_NTconverter()(c3);
+      monge_form.coefficients()[10] = L2D_NTconverter()(c4);
+    }
+}
+
+template < class DataKernel, class LocalKernel, class SvdTraits>  
+void Monge_via_jet_fitting<DataKernel, LocalKernel, SvdTraits>::
+switch_to_direct_orientation(Vector_3& v1, const Vector_3& v2,
+			    const Vector_3& v3) 
+{
+  if (CGAL::orientation (v1, v2, v3) == CGAL::NEGATIVE)
+    v1 = -v1;
+}
+
+
+// template < class DataKernel, class LocalKernel, class SvdTraits>  
+// inline
+// std::ostream&
+// operator<<(std::ostream& out_stream, 
+// 	  const typename Monge_via_jet_fitting<DataKernel, LocalKernel, SvdTraits>::Monge_form& monge)
+// {
+//   monge.dump_verbose(out_stream);
+//   return out_stream;
+// }
+
+} //namespace CGAL
+
+#endif //CGAL_MONGE_VIA_JET_FITTING_H_
diff --git a/3rdparty/CGAL/include/CGAL/Mpzf.h b/3rdparty/CGAL/include/CGAL/Mpzf.h
new file mode 100644
index 0000000..8d64547
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Mpzf.h
@@ -0,0 +1,1164 @@
+// Copyright (c) 2013
+// INRIA Saclay - Ile de France (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.
+//
+// Author(s)	:  Marc Glisse
+
+#ifndef CGAL_MPZF_H
+#define CGAL_MPZF_H
+#include <cstdlib>
+#include <algorithm>
+#include <climits>
+#include <vector>
+#include <math.h>
+#include <cmath>
+#include <iostream>
+#include <stdexcept>
+#ifdef CGAL_USE_GMPXX
+# include <CGAL/gmpxx.h>
+#else
+# include <CGAL/gmp.h>
+#endif
+#include <CGAL/enum.h>
+#include <CGAL/Interval_nt.h>
+#include <CGAL/Gmpz.h>
+#include <CGAL/Gmpq.h>
+//#include <CGAL/Gmpzf.h>
+
+#include <CGAL/Coercion_traits.h>
+
+// The following is currently assumed in several places. I hope I am not
+// making too many other assumptions.
+// * limbs are 64 bits
+// * if using gcc, sizeof(long long)==8
+// * mpn_neg(_n) exists
+// * IEEE double
+// * not too fancy endianness
+#if !defined(CGAL_DO_NOT_USE_MPZF) \
+    && __GNU_MP_VERSION * 10 + __GNU_MP_VERSION_MINOR >= 43 \
+    && GMP_NUMB_BITS == 64
+#define CGAL_HAS_MPZF 1
+
+// GMP-4.3.* has a different name for mpn_neg.
+#ifndef mpn_neg
+#define mpn_neg mpn_neg_n
+#endif
+// GMP-4.3.0 is missing mpn_sqr.
+#ifndef mpn_sqr
+#define mpn_sqr(dest,a,n) mpn_mul_n(dest,a,a,n)
+#endif
+// GMP before 5.0 doesn't provide mpn_copyi.
+#ifndef mpn_copyi
+#define mpn_copyi(dst, src, siz) std::copy((src), (src)+(siz), (dst))
+#endif
+
+#include <boost/cstdint.hpp>
+
+#ifdef _MSC_VER
+#include <intrin.h>
+#pragma intrinsic(_BitScanForward64)
+#pragma intrinsic(_BitScanReverse64)
+#endif
+
+#ifdef __xlC__
+#include <builtins.h>
+#endif
+
+#include <CGAL/assertions.h>
+#include <boost/config.hpp>
+#include <boost/detail/workaround.hpp>
+#include <boost/version.hpp>
+
+#if defined(BOOST_MSVC)
+#  pragma warning(push)
+#  pragma warning(disable:4146 4244 4267 4800)
+     // warning on - applied on unsigned number
+     // conversion with loss of data
+     // conversion with loss of data
+     // int to bool performance
+#endif
+
+
+/*
+#ifdef CGAL_MPZF_NO_USE_CACHE
+# ifdef CGAL_MPZF_USE_CACHE
+#  undef CGAL_MPZF_USE_CACHE
+# endif
+#else
+# if !defined(CGAL_MPZF_USE_CACHE) \
+     && defined(CGAL_HAS_THREADS) \
+     && !defined(CGAL_I_PROMISE_I_WONT_USE_MANY_THREADS)
+#  define CGAL_MPZF_USE_CACHE 1
+# endif
+#endif
+*/
+#define CGAL_MPZF_USE_CACHE 1
+
+// On a dataset provided by Andreas, replacing Gmpq with this type in
+// Epick reduced the running time of the construction of a Delaunay
+// triangulation by a factor larger than 6
+
+#if !defined(CGAL_HAS_THREADS)
+#define CGAL_MPZF_THREAD_LOCAL
+#define CGAL_MPZF_TLS
+#elif defined(CGAL_CAN_USE_CXX11_THREAD_LOCAL)
+#define CGAL_MPZF_THREAD_LOCAL thread_local
+#define CGAL_MPZF_TLS thread_local
+#elif defined(_MSC_VER)
+#define CGAL_MPZF_THREAD_LOCAL __declspec(thread)
+#define CGAL_MPZF_TLS
+#else
+#define CGAL_MPZF_THREAD_LOCAL __thread
+#define CGAL_MPZF_TLS
+// Too bad for the others
+#endif
+namespace CGAL {
+namespace Mpzf_impl {
+// Warning: these pools aren't generic at all!
+
+// Not thread-safe
+template <class T, class = void> struct pool1 {
+  static T pop() { T ret = data.back(); data.pop_back(); return ret; }
+  static void push(T t) { data.push_back(t); }
+  static bool empty() { return data.empty(); }
+  static const int extra = 0;
+  private:
+  // thread_local would be fine, but not __declspec(thread) and for most
+  // compilers not __thread, since data is not POD.
+  static std::vector<T> data;
+};
+template <class T, class D> std::vector<T> pool1<T,D>::data;
+
+// Use an intrusive single-linked list instead (allocate one more limb and use
+// it to store the pointer to next), the difference isn't that noticable (still
+// the list wins).  Neither is thread-safe (both can be with threadlocal, and
+// the list can be with an atomic compare-exchange (never tried)).  With gcc,
+// TLS has a large effect on classes with constructor/destructor, but is free
+// for a simple pointer.  The slowdown is because of PR55812.
+
+// Leaks at thread destruction
+template <class T, class = void> struct pool2 {
+  static T pop() { T ret = data(); data() = ptr(data()); return ret; }
+  static void push(T t) { ptr(t) = data(); data() = t; }
+  static bool empty() { return data() == 0; }
+  static const int extra = 1; // TODO: handle the case where a pointer is larger than a mp_limb_t
+  private:
+  CGAL_static_assertion(sizeof(T) >= sizeof(T*));
+  static T& data () {
+    static CGAL_MPZF_TLS T data_ = 0;
+    return data_;
+  }
+  static T& ptr(T t) { t -= extra+1; return *reinterpret_cast<T*>(t); }
+};
+
+#if defined(CGAL_CAN_USE_CXX11_THREAD_LOCAL)
+template <class T, class = void> struct pool3 {
+  static T pop() { T ret = data(); data() = ptr(data()); return ret; }
+  static void push(T t) { ptr(t) = data(); data() = t; }
+  static bool empty() { return data() == 0; }
+  static const int extra = 1; // TODO: handle the case where a pointer is larger than a mp_limb_t
+  private:
+  CGAL_static_assertion(sizeof(T) >= sizeof(T*));
+  struct cleaner {
+    T data_ = 0;
+    ~cleaner(){
+      // Deallocate everything. As an alternative, we could store it in a
+      // global location, for re-use by a later thread.
+      while (!empty())
+	delete[] (pop() - (extra + 1));
+    }
+  };
+  static T& data () {
+    static thread_local cleaner obj;
+    return obj.data_;
+  }
+  static T& ptr(T t) { t -= extra+1; return *reinterpret_cast<T*>(t); }
+};
+#endif
+
+// No caching
+template <class T, class = void> struct no_pool {
+  static T pop() { throw "Shouldn't be here!"; }
+  static void push(T t) { delete [] (t - (extra+1)); }
+  static bool empty() { return true; }
+  static const int extra = 0;
+};
+
+// Only used with an argument known not to be 0.
+inline int ctz (boost::uint64_t x) {
+#if defined(_MSC_VER)
+  unsigned long ret;
+  _BitScanForward64(&ret, x);
+  return (int)ret;
+#elif defined(__xlC__)
+  return __cnttz8 (x);
+#else
+  // Assume long long is 64 bits
+  return __builtin_ctzll (x);
+#endif
+}
+inline int clz (boost::uint64_t x) {
+#if defined(_MSC_VER)
+  unsigned long ret;
+  _BitScanReverse64(&ret, x);
+  return 63 - (int)ret;
+#elif defined(__xlC__)
+  // Macro supposedly not defined on z/OS.
+  return __cntlz8 (x);
+#else
+  return __builtin_clzll (x);
+#endif
+}
+
+// In C++11, std::fill_n returns a pointer to the end, but in C++03,
+// it returns void.
+inline mp_limb_t* fill_n_ptr(mp_limb_t* p, int n, int c) {
+#if __cplusplus >= 201103L
+  return std::fill_n (p, n, c);
+#else
+  mp_limb_t* q = p + n;
+  std::fill (p, q, c);
+  //std::fill_n (p, n, c);
+  //memset (p, sizeof(mp_limb_t)*n, c);
+  return q;
+#endif
+}
+} // namespace Mpzf_impl
+
+#undef CGAL_MPZF_THREAD_LOCAL
+#undef CGAL_MPZF_TLS
+
+// TODO:
+// * make data==0 a valid state for number 0. Incompatible with the cache. I
+//   tried, and it doesn't seem to help (may even hurt a bit).
+struct Mpzf {
+  private:
+#ifdef CGAL_MPZF_USE_CACHE
+  // More experiments to determine the best value would be good. It likely
+  // depends on the usage. Note that pool2 is fast enough that a conditional
+  // cache slows it down. A purely static cache (crash if it isn't large
+  // enough) still wins by about 11% on the Delaunay_3 construction, but is
+  // more complicated to handle.
+  // Evaluating a polynomial in double will never require more than roughly
+  // (2100*degree) bits, or (33*degree) mp_limb_t, which is very small. I
+  // checked by including an array of 150 limbs in every Mpzf (that's where
+  // the 11% number comes from).
+  // BONUS: doing that is thread-safe!
+  static const unsigned int cache_size = 8;
+#endif
+//#if !defined(CGAL_HAS_THREADS) || defined(CGAL_I_PROMISE_I_WONT_USE_MANY_THREADS)
+//  typedef Mpzf_impl::pool2<mp_limb_t*,Mpzf> pool;
+//#elif defined(CGAL_CAN_USE_CXX11_THREAD_LOCAL)
+//  typedef Mpzf_impl::pool3<mp_limb_t*,Mpzf> pool;
+//#else
+  typedef Mpzf_impl::no_pool<mp_limb_t*,Mpzf> pool;
+//#endif
+
+  mp_limb_t* data_; /* data_[0] is never 0 (except possibly for 0). */
+  inline mp_limb_t*& data() { return data_; };
+  inline mp_limb_t const* data() const { return data_; };
+
+#ifdef CGAL_MPZF_USE_CACHE
+  mp_limb_t cache[cache_size + 1];
+#endif
+  int size; /* Number of relevant limbs in data_. */
+  int exp; /* The number is data_ (an integer) * 2 ^ (64 * exp). */
+  typedef int Exponent_type;
+  typedef int Size_type;
+
+  struct allocate{};
+  struct noalloc{};
+
+  void init(unsigned mini=2){
+#ifdef CGAL_MPZF_USE_CACHE
+    if (mini <= cache_size) {
+      cache[0] = cache_size;
+      data() = cache + 1;
+      return;
+    }
+#endif
+    if(!pool::empty()){
+      data() = pool::pop();
+      if(data()[-1] >= mini) return; // TODO: when mini==2, no need to check
+      delete[] (data() - (pool::extra+1)); // too small, useless
+    }
+    if(mini<2) mini=2;
+    data() = (new mp_limb_t[mini+(pool::extra+1)]) + (pool::extra+1);
+    data()[-1] = mini;
+  }
+  void clear(){
+    while(*--data()==0); // in case we skipped final zeroes
+#ifdef CGAL_MPZF_USE_CACHE
+    if (data() == cache) return;
+#endif
+    ++data();
+    pool::push(data());
+  }
+
+  Mpzf(noalloc){}
+  Mpzf(allocate,int i) { init(i); }
+
+  public:
+
+  static void clear_pool () {
+    while (!pool::empty())
+      delete[] (pool::pop() - (pool::extra + 1));
+  }
+
+  ~Mpzf(){
+    clear();
+  }
+  Mpzf(): size(0), exp(0) {
+    init();
+  }
+  Mpzf& operator=(Mpzf const& x){
+    unsigned asize=std::abs(x.size);
+    if(asize==0) { exp=0; size=0; return *this; }
+    if(this==&x) return *this;
+    while(*--data()==0); // factor that code somewhere?
+    if(*data()<asize){
+#ifdef CGAL_MPZF_USE_CACHE
+      if (data() != cache)
+#endif
+	delete[] (data() - pool::extra);
+      init(asize);
+    } else ++data();
+    size=x.size;
+    exp=x.exp;
+    mpn_copyi(data(),x.data(),asize);
+    return *this;
+  }
+  Mpzf(Mpzf const& x){
+    int asize=std::abs(x.size);
+    init(asize);
+    size=x.size;
+    exp=x.exp;
+    if(size!=0) mpn_copyi(data(),x.data(),asize);
+  }
+#if !defined(CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE) \
+    && !defined(CGAL_MPZF_USE_CACHE)
+  Mpzf(Mpzf&& x):data_(x.data()),size(x.size),exp(x.exp){
+    x.init(); // yes, that's a shame...
+    x.size = 0;
+    x.exp = 0;
+  }
+  Mpzf& operator=(Mpzf&& x){
+    std::swap(size,x.size);
+    exp = x.exp;
+    std::swap(data(),x.data());
+    return *this;
+  }
+  friend Mpzf operator-(Mpzf&& x){
+    Mpzf ret = std::move(x);
+    ret.size = -ret.size;
+    return ret;
+  }
+#endif
+  Mpzf(int i) : exp(0) {
+    // assume that int is smaller than mp_limb_t
+    init();
+    if      (i == 0)    { size = 0; }
+    else if (i >  0)    { size = 1; data()[0] = i; }
+    else /* (i <  0) */ { size =-1; data()[0] = -(mp_limb_t)i; }
+    // cast to mp_limb_t because -INT_MIN is undefined
+  }
+  Mpzf(unsigned int i) : exp(0) {
+    // assume that int is smaller than mp_limb_t
+    init();
+    if      (i == 0)    { size = 0; }
+    else /* (i >  0) */ { size = 1; data()[0] = i; }
+  }
+  Mpzf(long i) : exp(0) {
+    // assume that long is smaller than mp_limb_t
+    init();
+    if      (i == 0)    { size = 0; }
+    else if (i >  0)    { size = 1; data()[0] = i; }
+    else /* (i <  0) */ { size =-1; data()[0] = -(mp_limb_t)i; }
+    // cast to mp_limb_t because -LONG_MIN is undefined
+  }
+  Mpzf(unsigned long i) : exp(0) {
+    // assume that long is smaller than mp_limb_t
+    init();
+    if      (i == 0)    { size = 0; }
+    else /* (i >  0) */ { size = 1; data()[0] = i; }
+  }
+  Mpzf(double d){
+    init();
+    using boost::uint64_t;
+    union {
+#ifdef CGAL_LITTLE_ENDIAN
+      struct { uint64_t man:52; uint64_t exp:11; uint64_t sig:1; } s;
+#else /* CGAL_BIG_ENDIAN */
+      //WARNING: untested!
+      struct { uint64_t sig:1; uint64_t exp:11; uint64_t man:52; } s;
+#endif
+      double d;
+    } u;
+    u.d = d;
+    uint64_t m;
+    uint64_t dexp = u.s.exp;
+    CGAL_assertion_msg(dexp != 2047, "Creating an Mpzf from infinity or NaN.");
+    if (dexp == 0) {
+      if (d == 0) { size=0; exp=0; return; }
+      else { // denormal number
+	m = u.s.man;
+	++dexp;
+      }
+    } else {
+      m = (1LL<<52) | u.s.man;
+    }
+    int e1 = (int)dexp+13;
+    // FIXME: make it more general! But not slower...
+    CGAL_static_assertion(GMP_NUMB_BITS == 64);
+    int e2 = e1 % 64;
+    exp = e1 / 64 - 17;
+    // 52+1023+13==17*64 ?
+#if 0
+    // This seems very slightly faster
+    if(Mpzf_impl::ctz(m)+e2>=64){
+      data()[0] = m >> (64-e2);
+      size = 1;
+      ++exp;
+    }else{
+      data()[0] = m << e2;
+      if(e2>11){ // Wrong test for denormals
+	data()[1] = m >> (64-e2);
+	size = 2;
+      } else {
+	size = 1;
+      }
+    }
+#else
+    mp_limb_t d0 = (m << e2) & GMP_NUMB_MASK;
+    mp_limb_t d1 = 0;
+    if (e2 != 0) // shifting by 64 is UB
+      d1 = m >> (GMP_NUMB_BITS - e2);
+    if (d0 == 0) {
+      data()[0] = d1;
+      size = 1;
+      ++exp;
+    }
+    else {
+      data()[0] = d0;
+      if (d1 == 0) {
+	size = 1;
+      }
+      else {
+	data()[1] = d1;
+	size = 2;
+      }
+    }
+#endif
+    if(u.s.sig) size=-size;
+    //CGAL_assertion(to_double()==IA_force_to_double(d));
+  }
+
+#ifdef CGAL_USE_GMPXX
+  Mpzf(mpz_class const&z){
+    init_from_mpz_t(z.get_mpz_t());
+  }
+#endif
+  Mpzf(Gmpz const&z){
+    init_from_mpz_t(z.mpz());
+  }
+  void init_from_mpz_t(mpz_t const z){
+    exp=Exponent_type(mpz_scan1(z,0)/GMP_NUMB_BITS);
+    size=Size_type(mpz_size(z)-exp);
+    init(size);
+    mpn_copyi(data(),z->_mp_d+exp,size);
+  }
+
+#if 0
+  // For debug purposes only
+  void print()const{
+    //std::cout << "size: " << size << std::endl;
+    if(size==0) { std::cout << "zero\n"; return; }
+    if(size<0) std::cout << "- ";
+    int asize = std::abs(size);
+    std::cout << std::hex;
+    while(--asize>=0) { std::cout << data()[asize] << ' '; }
+    std::cout << std::dec << "exp " << exp << ' ';
+    std::cout << std::dec << "size " << size << ' ';
+    asize = std::abs(size);
+    std::cout << "double: " << std::ldexp((double)data()[asize-1],64*(exp+asize-1))*((size<0)?-1:1) << '\n';
+  }
+#endif
+
+  friend int Mpzf_abscmp(Mpzf const&a, Mpzf const&b){
+    int asize=std::abs(a.size);
+    int bsize=std::abs(b.size);
+    // size==0 should mean exp==-infinity, like with double.
+    // Since it doesn't, test for it explicitly.
+    if (bsize == 0) return asize;
+    if (asize == 0) return -1;
+    int ah=asize+a.exp;
+    int bh=bsize+b.exp;
+    if(ah!=bh) return ah-bh;
+    int minsize=(std::min)(asize,bsize);
+    const mp_limb_t* adata=a.data()+(asize-1);
+    const mp_limb_t* bdata=b.data()+(bsize-1);
+    for(int i=0;i<minsize;++i,--adata,--bdata){
+      const mp_limb_t aa=*adata;
+      const mp_limb_t bb=*bdata;
+      if(aa!=bb) return (aa<bb)?-1:1;
+    }
+    return asize-bsize; // this assumes that we get rid of trailing zeros...
+  }
+  friend int Mpzf_cmp (Mpzf const&a, Mpzf const&b){
+    if ((a.size ^ b.size) < 0) return (a.size < 0) ? -1 : 1;
+    int res = Mpzf_abscmp(a, b);
+    return (a.size < 0) ? -res : res;
+  }
+  friend bool operator<(Mpzf const&a, Mpzf const&b){
+    if((a.size ^ b.size) < 0) return a.size < 0;
+    return ((a.size < 0) ? Mpzf_abscmp(b, a) : Mpzf_abscmp(a, b)) < 0;
+  }
+  friend bool operator>(Mpzf const&a, Mpzf const&b){
+    return b<a;
+  }
+  friend bool operator>=(Mpzf const&a, Mpzf const&b){
+    return !(a<b);
+  }
+  friend bool operator<=(Mpzf const&a, Mpzf const&b){
+    return !(a>b);
+  }
+  friend bool operator==(Mpzf const&a, Mpzf const&b){
+    if (a.exp != b.exp || a.size != b.size) return false;
+    if (a.size == 0) return true;
+    return mpn_cmp(a.data(), b.data(), std::abs(a.size)) == 0;
+  }
+  friend bool operator!=(Mpzf const&a, Mpzf const&b){
+    return !(a==b);
+  }
+  private:
+  static Mpzf aors(Mpzf const&a, Mpzf const&b, int bsize){
+    Mpzf res=noalloc();
+    if(bsize==0){
+      int size=std::abs(a.size);
+      res.init(size);
+      res.exp=a.exp;
+      res.size=a.size;
+      if(size!=0) mpn_copyi(res.data(),a.data(),size);
+      return res;
+    }
+    int asize=a.size;
+    if(asize==0){
+      int size=std::abs(bsize);
+      res.init(size);
+      res.exp=b.exp;
+      res.size=bsize;
+      mpn_copyi(res.data(),b.data(),size);
+      return res;
+    }
+    if((asize^bsize)>=0){
+      // Addition
+      int absasize=std::abs(asize);
+      int absbsize=std::abs(bsize);
+      const mp_limb_t* adata=a.data();
+      const mp_limb_t* bdata=b.data();
+      int aexp=a.exp;
+      int bexp=b.exp;
+      if(aexp<bexp){ res.exp=a.exp; aexp=0; bexp=b.exp-a.exp; }
+      else { res.exp=b.exp; aexp=a.exp-b.exp; bexp=0; }
+      res.init((std::max)(absasize+aexp,absbsize+bexp)+1);
+      mp_limb_t* rdata=res.data();
+      res.size=0;
+      // TODO: if aexp>0, swap a and b so we don't repeat the code.
+      if(0<bexp){
+	if(absasize<=bexp){ // no overlap
+	  mpn_copyi(rdata, adata, absasize);
+	  rdata+=absasize;
+	  rdata=Mpzf_impl::fill_n_ptr(rdata,bexp-absasize,0);
+	  mpn_copyi(rdata, bdata, absbsize);
+	  res.size=absbsize+bexp;
+	  if(bsize<0) res.size=-res.size;
+	  return res;
+	} else {
+	  mpn_copyi(rdata, adata, bexp);
+	  adata+=bexp;
+	  absasize-=bexp;
+	  rdata+=bexp;
+	  res.size=bexp;
+	}
+      }
+      else if(0<aexp){
+	if(absbsize<=aexp){ // no overlap
+	  mpn_copyi(rdata, bdata, absbsize);
+	  rdata+=absbsize;
+	  rdata=Mpzf_impl::fill_n_ptr(rdata,aexp-absbsize,0);
+	  mpn_copyi(rdata, adata, absasize);
+	  res.size=absasize+aexp;
+	  if(asize<0) res.size=-res.size;
+	  return res;
+	} else {
+	  mpn_copyi(rdata, bdata, aexp);
+	  bdata+=aexp;
+	  absbsize-=aexp;
+	  rdata+=aexp;
+	  res.size=aexp;
+	}
+      }
+      if(absasize>=absbsize){
+	mp_limb_t carry=mpn_add(rdata,adata,absasize,bdata,absbsize);
+	res.size+=absasize;
+	if(carry!=0){
+	  res.size++;
+	  rdata[absasize]=carry;
+	}
+      } else {
+	mp_limb_t carry=mpn_add(rdata,bdata,absbsize,adata,absasize);
+	res.size+=absbsize;
+	if(carry!=0){
+	  res.size++;
+	  rdata[absbsize]=carry;
+	}
+      }
+      // unnecessary if a.exp != b.exp
+      while(/*res.size>0&&*/res.data()[0]==0){--res.size;++res.data();++res.exp;}
+      if(bsize<0) res.size=-res.size;
+    } else {
+      // Subtraction
+      const Mpzf *x, *y;
+      int xsize=a.size;
+      int ysize=bsize;
+      int cmp=Mpzf_abscmp(a,b);
+      if(cmp==0){ res.init(); res.size=0; res.exp=0; return res; }
+      if(cmp<0) { x=&b; y=&a; std::swap(xsize, ysize); }
+      else { x=&a; y=&b; }
+      int absxsize=std::abs(xsize);
+      int absysize=std::abs(ysize);
+      const mp_limb_t* xdata=x->data();
+      const mp_limb_t* ydata=y->data();
+      int xexp=x->exp;
+      int yexp=y->exp;
+      if(xexp<yexp){ res.exp=xexp; yexp-=xexp; xexp=0; }
+      else { res.exp=yexp; xexp-=yexp; yexp=0; }
+      res.init((std::max)(absxsize+xexp,absysize+yexp)+1);
+      mp_limb_t* rdata=res.data();
+      res.size=0;
+      bool carry1=false;
+      if(0<yexp){ // must have overlap since x is larger
+	mpn_copyi(rdata, xdata, yexp);
+	xdata+=yexp;
+	absxsize-=yexp;
+	rdata+=yexp;
+	res.size=yexp;
+      }
+      else if(0<xexp){
+	if(absysize<=xexp){ // no overlap
+	  mpn_neg(rdata, ydata, absysize); // assert that it returns 1
+	  rdata+=absysize;
+	  rdata=Mpzf_impl::fill_n_ptr(rdata,xexp-absysize,-1);
+	  mpn_sub_1(rdata, xdata, absxsize, 1);
+	  res.size=absxsize+xexp;
+	  if(res.data()[res.size-1]==0) --res.size;
+	  if(xsize<0) res.size=-res.size;
+	  return res;
+	} else {
+	  mpn_neg(rdata, ydata, xexp); // assert that it returns 1
+	  ydata+=xexp;
+	  absysize-=xexp;
+	  rdata+=xexp;
+	  res.size=xexp;
+	  carry1=true; // assumes no trailing zeros
+	}
+      }
+      CGAL_assertion_code( mp_limb_t carry= )
+	mpn_sub(rdata, xdata, absxsize, ydata, absysize);
+      if(carry1)
+	CGAL_assertion_code( carry+= )
+	  mpn_sub_1(rdata, rdata, absxsize, 1);
+      CGAL_assertion(carry==0);
+      res.size+=absxsize;
+      while(/*res.size>0&&*/res.data()[res.size-1]==0) --res.size;
+      while(/*res.size>0&&*/res.data()[0]==0){--res.size;++res.data();++res.exp;}
+      if(xsize<0) res.size=-res.size;
+    }
+    return res;
+  }
+
+  public:
+  friend Mpzf operator+(Mpzf const&a, Mpzf const&b){
+    return aors(a,b,b.size);
+  }
+
+  friend Mpzf operator-(Mpzf const&a, Mpzf const&b){
+    return aors(a,b,-b.size);
+  }
+
+  friend Mpzf operator*(Mpzf const&a, Mpzf const&b){
+    int asize=std::abs(a.size);
+    int bsize=std::abs(b.size);
+    int siz=asize+bsize;
+    Mpzf res(allocate(),siz);
+    if(asize==0||bsize==0){res.exp=0;res.size=0;return res;}
+    res.exp=a.exp+b.exp;
+    mp_limb_t high;
+    if(asize>=bsize)
+      high = mpn_mul(res.data(),a.data(),asize,b.data(),bsize);
+    else
+      high = mpn_mul(res.data(),b.data(),bsize,a.data(),asize);
+    if(high==0) --siz;
+    if(res.data()[0]==0) { ++res.data(); ++res.exp; --siz; }
+    res.size=((a.size^b.size)>=0)?siz:-siz;
+    return res;
+  }
+
+  friend Mpzf Mpzf_square(Mpzf const&a){
+    int asize=std::abs(a.size);
+    int siz=2*asize;
+    Mpzf res(allocate(),siz);
+    res.exp=2*a.exp;
+    if(asize==0){res.size=0;return res;}
+    mpn_sqr(res.data(),a.data(),asize);
+    mp_limb_t high = res.data()[siz-1];
+    if(high==0) --siz;
+    if(res.data()[0]==0) { ++res.data(); ++res.exp; --siz; }
+    res.size=siz;
+    return res;
+  }
+
+  friend Mpzf operator/(Mpzf const&a, Mpzf const&b){
+    // FIXME: Untested
+    int asize=std::abs(a.size);
+    int bsize=std::abs(b.size);
+    int siz=asize+2-bsize;
+    Mpzf res(allocate(),asize+2);
+    if(bsize==0){throw std::range_error("Division by zero");}
+    if(asize==0){res.exp=0;res.size=0;return res;}
+    res.size=siz;
+    res.exp=a.exp-b.exp;
+    const mp_limb_t *adata = a.data();
+    const mp_limb_t *bdata = b.data();
+    mp_limb_t *qp = res.data();
+    mp_limb_t *rp = qp + siz;
+    if(Mpzf_impl::ctz(adata[0]) >= Mpzf_impl::ctz(bdata[0])){ // Easy case
+      --res.size;
+      mpn_tdiv_qr(qp, rp, 0, adata, asize, bdata, bsize);
+      CGAL_assertion_code(
+	  for (int i=0; i<bsize; ++i)
+	    if (rp[i] != 0) throw std::logic_error("non exact Mpzf division");
+      )
+    }
+    else if(adata[-1]==0){ // We are lucky
+      --adata; ++asize; --res.exp;
+      mpn_tdiv_qr(qp, rp, 0, adata, asize, bdata, bsize);
+      CGAL_assertion_code(
+	  for (int i=0; i<bsize; ++i)
+	    if (rp[i] != 0) throw std::logic_error("non exact Mpzf division");
+      )
+    }
+    else{
+      --res.exp;
+      Mpzf a2(allocate(),asize+1);
+      a2.data()[0]=0;
+      mpn_copyi(a2.data()+1,a.data(),asize);
+      // No need to complete a2, we just want the buffer.
+      //a2.size=(a.size<0)?(a.size-1):(a.size+1);
+      //a2.exp = a.exp-1;
+      mpn_tdiv_qr(qp, rp, 0, a2.data(), asize+1, bdata, bsize);
+      CGAL_assertion_code(
+	  for (int i=0; i<bsize; ++i)
+	    if (rp[i] != 0) throw std::logic_error("non exact Mpzf division");
+      )
+    }
+    while(/*res.size>0&&*/res.data()[res.size-1]==0) --res.size;
+    //while(/*res.size>0&&*/res.data()[0]==0){--res.size;++res.data();++res.exp;}
+    if((a.size^b.size)<0) res.size=-res.size;
+    return res;
+  }
+
+  friend Mpzf Mpzf_gcd(Mpzf const&a, Mpzf const&b){
+    // FIXME: Untested
+    if (a.size == 0) return b;
+    if (b.size == 0) return a;
+    int asize=std::abs(a.size);
+    int bsize=std::abs(b.size);
+    int atz=Mpzf_impl::ctz(a.data()[0]);
+    int btz=Mpzf_impl::ctz(b.data()[0]);
+    int rtz=(std::min)(atz,btz);
+    Mpzf tmp(allocate(), asize);
+    Mpzf res(allocate(), bsize);
+    if (atz != 0) {
+      mpn_rshift(tmp.data(), a.data(), asize, atz);
+      if(tmp.data()[asize-1]==0) --asize;
+    }
+    else { mpn_copyi(tmp.data(), a.data(), asize); }
+    if (btz != 0) {
+      mpn_rshift(res.data(), b.data(), bsize, btz);
+      if(res.data()[bsize-1]==0) --bsize;
+    }
+    else { mpn_copyi(res.data(), b.data(), bsize); }
+    res.exp = 0; // Pick b.exp? or the average? 0 helps return 1 more often.
+    if (asize < bsize)
+      res.size = Size_type(mpn_gcd(res.data(), res.data(), bsize, tmp.data(), asize));
+    else
+      res.size = Size_type(mpn_gcd(res.data(), tmp.data(), asize, res.data(), bsize));
+    if(rtz!=0) {
+      mp_limb_t c = mpn_lshift(res.data(), res.data(), res.size, rtz);
+      if(c) { res.data()[res.size]=c; ++res.size; }
+    }
+    return res;
+  }
+
+  friend bool Mpzf_is_square(Mpzf const&x){
+    if (x.size < 0) return false;
+    if (x.size == 0) return true;
+    // Assume that GMP_NUMB_BITS is even.
+    return mpn_perfect_square_p (x.data(), x.size);
+  }
+
+  friend Mpzf Mpzf_sqrt(Mpzf const&x){
+    // FIXME: Untested
+    if (x.size < 0) throw std::range_error("Sqrt of negative number");
+    if (x.size == 0) return 0;
+    if (x.exp % 2 == 0) {
+      Mpzf res(allocate(), (x.size + 1) / 2);
+      res.exp = x.exp / 2;
+      res.size = (x.size + 1) / 2;
+      CGAL_assertion_code(mp_size_t rem=)
+      mpn_sqrtrem(res.data(), 0, x.data(), x.size);
+      CGAL_assertion(rem==0);
+      return res;
+    }
+    else if (x.data()[-1] == 0) {
+      Mpzf res(allocate(), (x.size + 2) / 2);
+      res.exp = (x.exp - 1) / 2;
+      res.size = (x.size + 2) / 2;
+      CGAL_assertion_code(mp_size_t rem=)
+      mpn_sqrtrem(res.data(), 0, x.data()-1, x.size+1);
+      CGAL_assertion(rem==0);
+      return res;
+    }
+    else {
+      Mpzf res(allocate(), (x.size + 2) / 2);
+      res.exp = (x.exp - 1) / 2;
+      res.size = (x.size + 2) / 2;
+      CGAL_assertion_code(mp_size_t rem=)
+      mpn_sqrtrem(res.data(), 0, x.data(), x.size);
+      CGAL_assertion(rem==0);
+      mpn_lshift(res.data(), res.data(), res.size, GMP_NUMB_BITS / 2);
+      return res;
+    }
+  }
+
+  friend Mpzf operator-(Mpzf const&x){
+    Mpzf ret = x;
+    ret.size = -ret.size;
+    return ret;
+  }
+  Mpzf& operator+=(Mpzf const&x){ *this=*this+x; return *this; }
+  Mpzf& operator-=(Mpzf const&x){ *this=*this-x; return *this; }
+  Mpzf& operator*=(Mpzf const&x){ *this=*this*x; return *this; }
+  Mpzf& operator/=(Mpzf const&x){ *this=*this/x; return *this; }
+
+  bool is_canonical () const {
+    if (size == 0) return true;
+    if (data()[0] == 0) return false;
+    if (data()[std::abs(size)-1] == 0) return false;
+    return true;
+  }
+
+  bool is_zero () const {
+    return size==0;
+  }
+
+  bool is_one () const {
+    return exp==0 && size==1 && data()[0]==1;
+  }
+
+  CGAL::Sign sign () const { return CGAL::sign(size); }
+
+  double to_double () const {
+    // Assumes GMP_NUMB_BITS == 64
+    using std::ldexp;
+    if(size==0) return 0;
+    int asize = std::abs(size);
+    mp_limb_t top = data()[asize-1];
+    double dtop = (double)top;
+    if(top >= (1LL<<53) || asize == 1) /* ok */ ;
+    else { dtop += (double)data()[asize-2] * ldexp(1.,-GMP_NUMB_BITS); }
+    return ldexp( (size<0) ? -dtop : dtop, (asize-1+exp) * GMP_NUMB_BITS);
+  }
+
+  std::pair<double, double> to_interval () const {
+    // Assumes GMP_NUMB_BITS == 64
+    if (size == 0) return std::make_pair(0., 0.);
+    double dl, dh;
+    int asize = std::abs(size);
+    int e = 64 * (asize - 1 + exp);
+    mp_limb_t x = data()[asize-1];
+    int lz = Mpzf_impl::clz(x);
+    if (lz <= 11) {
+      if (lz != 11) {
+	e += (11 - lz);
+	x >>= (11 - lz);
+      }
+      dl = double(x);
+      dh = double(x + 1);
+      // Check for the few cases where dh=x works (asize==1 and the evicted
+      // bits from x were 0s)
+    }
+    else if (asize == 1) {
+      dl = dh = double(x); // conversion is exact
+    }
+    else {
+      mp_limb_t y = data()[asize-2];
+      e -= (lz - 11);
+      x <<= (lz - 11);
+      y >>= (75 - lz);
+      x |= y;
+      dl = double(x);
+      dh = double(x + 1);
+      // Check for the few cases where dh=x works (asize==2 and the evicted
+      // bits from y were 0s)
+    }
+    typedef Interval_nt<> IA;
+    IA res (dl, dh);
+    res = ldexp (res, e);
+    if (size < 0) res = -res;
+    return CGAL::to_interval(res);
+    // Use ldexp(Interval_nt,int) to delegate the hard thinking
+    // about over/underflow.
+  }
+
+#ifdef CGAL_USE_GMPXX
+#ifndef CGAL_CFG_NO_CPP0X_EXPLICIT_CONVERSION_OPERATORS
+  explicit
+#endif
+  operator mpq_class () const {
+    mpq_class q;
+    export_to_mpq_t(q.get_mpq_t());
+    return q;
+  }
+#endif
+
+#ifndef CGAL_CFG_NO_CPP0X_EXPLICIT_CONVERSION_OPERATORS
+  explicit
+#endif
+  operator Gmpq () const {
+    Gmpq q;
+    export_to_mpq_t(q.mpq());
+    return q;
+  }
+  void export_to_mpq_t(mpq_t q) const {
+    /* q must be 0/1 before this call */
+    CGAL_precondition(mpq_cmp_ui(q,0,1)==0);
+    if (size != 0) {
+      mpz_import (mpq_numref (q),
+		  std::abs(size),
+		  -1, // data()[0] is the least significant part
+		  sizeof(mp_limb_t),
+		  0, // native endianness inside mp_limb_t
+		  GMP_NAIL_BITS, // should be 0
+		  data());
+      if (exp > 0)
+	mpq_mul_2exp(q, q, (sizeof(mp_limb_t) * CHAR_BIT *  exp));
+      else if (exp < 0)
+	mpq_div_2exp(q, q, (sizeof(mp_limb_t) * CHAR_BIT * -exp));
+
+      if (size < 0)
+	mpq_neg(q,q);
+    }
+  }
+#if 0
+#ifndef CGAL_CFG_NO_CPP0X_EXPLICIT_CONVERSION_OPERATORS
+  explicit
+#endif
+// This makes Mpzf==int ambiguous
+  operator Gmpzf () const {
+    mpz_t z;
+    z->_mp_d=const_cast<mp_limb_t*>(data());
+    z->_mp_size=size;
+    Gmpzf m(z);
+// Only works for a very limited range of exponents
+    Gmpzf e(std::ldexp(1.,GMP_NUMB_BITS*exp));
+    return m*e;
+  }
+#endif
+
+  friend void simplify_quotient(Mpzf& a, Mpzf& b){
+    // Avoid quotient(2^huge_a/2^huge_b)
+    a.exp -= b.exp;
+    b.exp = 0;
+    // Simplify with gcd?
+  }
+};
+
+// Copied from Gmpzf, not sure that's the best thing to do.
+inline
+std::ostream& operator<< (std::ostream& os, const Mpzf& a)
+{
+    return os << a.to_double();
+}
+
+inline
+std::istream& operator>> (std::istream& is, Mpzf& a)
+{
+  double d;
+  is >> d;
+  if (is)
+    a = d;
+  return is;
+}
+
+
+  template <> struct Algebraic_structure_traits< Mpzf >
+    : public Algebraic_structure_traits_base< Mpzf, Integral_domain_without_division_tag >  {
+      typedef Tag_true            Is_exact;
+      typedef Tag_false            Is_numerical_sensitive;
+
+      struct Is_zero
+	: public std::unary_function< Type, bool > {
+	  bool operator()( const Type& x ) const {
+	    return x.is_zero();
+	  }
+	};
+
+      struct Is_one
+	: public std::unary_function< Type, bool > {
+	  bool operator()( const Type& x ) const {
+	    return x.is_one();
+	  }
+	};
+
+      struct Gcd
+	: public std::binary_function< Type, Type, Type > {
+	  Type operator()(
+	      const Type& x,
+	      const Type& y ) const {
+	    return Mpzf_gcd(x, y);
+	  }
+	};
+
+      struct Square
+	: public std::unary_function< Type, Type > {
+	  Type operator()( const Type& x ) const {
+	    return Mpzf_square(x);
+	  }
+	};
+
+      struct Integral_division
+	: public std::binary_function< Type, Type, Type > {
+	  Type operator()(
+	      const Type& x,
+	      const Type& y ) const {
+	    return x / y;
+	  }
+	};
+
+      struct Sqrt
+	: public std::unary_function< Type, Type > {
+	  Type operator()( const Type& x) const {
+	    return Mpzf_sqrt(x);
+	  }
+	};
+
+      struct Is_square
+	: public std::binary_function< Type, Type&, bool > {
+	  bool operator()( const Type& x, Type& y ) const {
+	    // TODO: avoid doing 2 calls.
+	    if (!Mpzf_is_square(x)) return false;
+	    y = Mpzf_sqrt(x);
+	    return true;
+	  }
+	  bool operator()( const Type& x) const {
+	    return Mpzf_is_square(x);
+	  }
+	};
+
+    };
+  template <> struct Real_embeddable_traits< Mpzf >
+    : public INTERN_RET::Real_embeddable_traits_base< Mpzf , CGAL::Tag_true > {
+      struct Sgn
+	: public std::unary_function< Type, ::CGAL::Sign > {
+	  ::CGAL::Sign operator()( const Type& x ) const {
+	    return x.sign();
+	  }
+	};
+
+      struct To_double
+	: public std::unary_function< Type, double > {
+	    double operator()( const Type& x ) const {
+	      return x.to_double();
+	    }
+	};
+
+      struct Compare
+	: public std::binary_function< Type, Type, Comparison_result > {
+	    Comparison_result operator()(
+		const Type& x,
+		const Type& y ) const {
+	      return CGAL::sign(Mpzf_cmp(x,y));
+	    }
+	};
+
+      struct To_interval
+	: public std::unary_function< Type, std::pair< double, double > > {
+	    std::pair<double, double> operator()( const Type& x ) const {
+	      return x.to_interval();
+	    }
+	};
+
+    };
+
+CGAL_DEFINE_COERCION_TRAITS_FOR_SELF(Mpzf)
+CGAL_DEFINE_COERCION_TRAITS_FROM_TO(short    ,Mpzf)
+CGAL_DEFINE_COERCION_TRAITS_FROM_TO(int      ,Mpzf)
+CGAL_DEFINE_COERCION_TRAITS_FROM_TO(long     ,Mpzf)
+CGAL_DEFINE_COERCION_TRAITS_FROM_TO(float    ,Mpzf)
+CGAL_DEFINE_COERCION_TRAITS_FROM_TO(double   ,Mpzf)
+CGAL_DEFINE_COERCION_TRAITS_FROM_TO(Gmpz     ,Mpzf)
+#ifdef CGAL_USE_GMPXX
+CGAL_DEFINE_COERCION_TRAITS_FROM_TO(mpz_class,Mpzf)
+#endif
+
+}
+
+/* There isn't much Eigen can do with such a type,
+ * mostly this is here for IsInteger to protect people.
+ */
+namespace Eigen {
+  template<class> struct NumTraits;
+  template<> struct NumTraits<CGAL::Mpzf>
+  {
+    typedef CGAL::Mpzf Real;
+    /* Should this be Quotient<Mpzf>? Gmpq?  */
+    typedef CGAL::Mpzf NonInteger;
+    typedef CGAL::Mpzf Nested;
+    typedef CGAL::Mpzf Literal;
+
+    static inline Real epsilon() { return 0; }
+    static inline Real dummy_precision() { return 0; }
+
+    enum {
+      /* Only exact divisions are supported, close enough to an integer.
+       * This way we get compilation failures instead of runtime.  */
+      IsInteger = 1,
+      IsSigned = 1,
+      IsComplex = 0,
+      RequireInitialization = 1,
+      ReadCost = 6,
+      AddCost = 30,
+      MulCost = 50
+    };
+  };
+}
+
+#if defined(BOOST_MSVC)
+#  pragma warning(pop)
+#endif
+
+#endif // GMP_NUMB_BITS == 64
+#endif // CGAL_MPZF_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Multi_surface_3.h b/3rdparty/CGAL/include/CGAL/Multi_surface_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Multi_surface_3.h
rename to 3rdparty/CGAL/include/CGAL/Multi_surface_3.h
diff --git a/3rdparty/CGAL/include/CGAL/Multiscale_sort.h b/3rdparty/CGAL/include/CGAL/Multiscale_sort.h
new file mode 100644
index 0000000..e0ecd6f
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Multiscale_sort.h
@@ -0,0 +1,58 @@
+// Copyright (c) 2007  INRIA Sophia-Antipolis (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(s)     : Christophe Delage
+
+#ifndef CGAL_MULTISCALE_SORT_H
+#define CGAL_MULTISCALE_SORT_H
+
+#include <CGAL/basic.h>
+#include <iterator>
+#include <cstddef>
+
+namespace CGAL {
+
+template <class Sort>
+class Multiscale_sort
+{
+    Sort _sort;
+    std::ptrdiff_t _threshold;
+    double _ratio;
+
+public:
+    Multiscale_sort (const Sort &sort = Sort(), std::ptrdiff_t threshold = 1, double ratio = 0.5)
+        : _sort (sort), _threshold (threshold), _ratio (ratio)
+    {
+        CGAL_precondition (0. <= ratio && ratio <= 1.);
+    }
+
+    template <class RandomAccessIterator>
+    void operator() (RandomAccessIterator begin, RandomAccessIterator end) const
+    {
+	typedef typename std::iterator_traits<RandomAccessIterator>::difference_type difference_type;
+        RandomAccessIterator middle = begin;
+        if (end - begin >= _threshold) {
+            middle = begin + difference_type (double(end - begin) * _ratio);
+            this->operator() (begin, middle);
+        }
+        _sort (middle, end);
+    }
+};
+
+} // namespace CGAL
+
+#endif // CGAL_MULTISCALE_SORT_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Multiset.h b/3rdparty/CGAL/include/CGAL/Multiset.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Multiset.h
rename to 3rdparty/CGAL/include/CGAL/Multiset.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NT_converter.h b/3rdparty/CGAL/include/CGAL/NT_converter.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NT_converter.h
rename to 3rdparty/CGAL/include/CGAL/NT_converter.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/N_step_adaptor.h b/3rdparty/CGAL/include/CGAL/N_step_adaptor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/N_step_adaptor.h
rename to 3rdparty/CGAL/include/CGAL/N_step_adaptor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/N_step_adaptor_derived.h b/3rdparty/CGAL/include/CGAL/N_step_adaptor_derived.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/N_step_adaptor_derived.h
rename to 3rdparty/CGAL/include/CGAL/N_step_adaptor_derived.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Needs_parens_as_product.h b/3rdparty/CGAL/include/CGAL/Needs_parens_as_product.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Needs_parens_as_product.h
rename to 3rdparty/CGAL/include/CGAL/Needs_parens_as_product.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_2/Bounding_box_2.h b/3rdparty/CGAL/include/CGAL/Nef_2/Bounding_box_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_2/Bounding_box_2.h
rename to 3rdparty/CGAL/include/CGAL/Nef_2/Bounding_box_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_2/Constrained_triang_traits.h b/3rdparty/CGAL/include/CGAL/Nef_2/Constrained_triang_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_2/Constrained_triang_traits.h
rename to 3rdparty/CGAL/include/CGAL/Nef_2/Constrained_triang_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_2/HDS_items.h b/3rdparty/CGAL/include/CGAL/Nef_2/HDS_items.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_2/HDS_items.h
rename to 3rdparty/CGAL/include/CGAL/Nef_2/HDS_items.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_2/Line_to_epoint.h b/3rdparty/CGAL/include/CGAL/Nef_2/Line_to_epoint.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_2/Line_to_epoint.h
rename to 3rdparty/CGAL/include/CGAL/Nef_2/Line_to_epoint.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_2/Object_handle.h b/3rdparty/CGAL/include/CGAL/Nef_2/Object_handle.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_2/Object_handle.h
rename to 3rdparty/CGAL/include/CGAL/Nef_2/Object_handle.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_2/Object_index.h b/3rdparty/CGAL/include/CGAL/Nef_2/Object_index.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_2/Object_index.h
rename to 3rdparty/CGAL/include/CGAL/Nef_2/Object_index.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_2/PM_checker.h b/3rdparty/CGAL/include/CGAL/Nef_2/PM_checker.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_2/PM_checker.h
rename to 3rdparty/CGAL/include/CGAL/Nef_2/PM_checker.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_2/PM_const_decorator.h b/3rdparty/CGAL/include/CGAL/Nef_2/PM_const_decorator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_2/PM_const_decorator.h
rename to 3rdparty/CGAL/include/CGAL/Nef_2/PM_const_decorator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_2/PM_decorator.h b/3rdparty/CGAL/include/CGAL/Nef_2/PM_decorator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_2/PM_decorator.h
rename to 3rdparty/CGAL/include/CGAL/Nef_2/PM_decorator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_2/PM_explorer.h b/3rdparty/CGAL/include/CGAL/Nef_2/PM_explorer.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_2/PM_explorer.h
rename to 3rdparty/CGAL/include/CGAL/Nef_2/PM_explorer.h
diff --git a/3rdparty/CGAL/include/CGAL/Nef_2/PM_io_parser.h b/3rdparty/CGAL/include/CGAL/Nef_2/PM_io_parser.h
new file mode 100644
index 0000000..85cc0ef
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Nef_2/PM_io_parser.h
@@ -0,0 +1,403 @@
+// Copyright (c) 1997-2000  Max-Planck-Institute Saarbruecken (Germany).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Michael Seel <seel at mpi-sb.mpg.de>
+
+#ifndef CGAL_PM_IO_PARSER_H
+#define CGAL_PM_IO_PARSER_H
+
+#include <CGAL/Nef_2/PM_decorator.h>
+#include <CGAL/Nef_2/Object_index.h>
+#include <vector>
+
+namespace CGAL {
+
+/*{\Moptions outfile=PM_io_parser.man }*/
+/*{\Manpage {PM_io_parser}{PMDEC}{IO of plane maps}{IO}}*/
+
+/*{\Mdefinition An instance |\Mvar| of the data type |\Mname| is a
+decorator to provide input and output of a plane map.  |\Mtype| is
+generic with respect to the |PMDEC| parameter.  |PMDEC| has to be a
+decorator model of our |PM_decorator| concept.}*/
+
+/*{\Mgeneralization PM_decorator}*/
+
+template <typename PMDEC>
+class PM_io_parser : public PMDEC
+{
+  typedef PMDEC                     Base;
+  typedef typename PMDEC::Plane_map Plane_map;
+  typedef typename PMDEC::Point     Point;
+  typedef typename PMDEC::Mark      Mark;
+
+  typedef typename PMDEC::Vertex_iterator   Vertex_iterator;
+  typedef typename PMDEC::Halfedge_iterator Halfedge_iterator;
+  typedef typename PMDEC::Face_iterator     Face_iterator;
+  typedef typename PMDEC::Vertex_handle     Vertex_handle;
+  typedef typename PMDEC::Halfedge_handle   Halfedge_handle;
+  typedef typename PMDEC::Face_handle       Face_handle;
+
+  using Base::clear;
+  using Base::vertices_begin;
+  using Base::vertices_end;
+  using Base::halfedges_begin;
+  using Base::halfedges_end;
+  using Base::faces_begin;
+  using Base::faces_end;
+  using Base::number_of_vertices;
+  using Base::number_of_halfedges;
+  using Base::number_of_faces;
+  using Base::new_vertex;
+  using Base::new_face;
+  using Base::new_halfedge_pair_without_vertices;
+  using Base::is_isolated;
+  using Base::face;
+  using Base::mark;
+  using Base::point;
+  using Base::twin;
+  using Base::previous;
+  using Base::next;
+  using Base::source;
+  using Base::target;
+  using Base::out_edges;
+  using Base::halfedge;
+
+  std::istream& in;
+  std::ostream& out;
+  bool verbose;
+  // a reference to the IO object
+  CGAL::Object_index<Vertex_handle>   VI;
+  CGAL::Object_index<Halfedge_handle> EI;
+  CGAL::Object_index<Face_handle>     FI;
+  std::vector<Vertex_handle>    Vertex_of;
+  std::vector<Halfedge_handle>  Halfedge_of;
+  std::vector<Face_handle>      Face_of;
+  // object mapping for input
+  std::size_t vn,en,fn,i;
+  // the number of objects
+
+
+  void print_vertex(Vertex_handle) const;
+  void print_hedge(Halfedge_handle) const;
+  void print_face(Face_handle) const;
+
+  bool read_vertex(Vertex_handle);
+  bool read_hedge(Halfedge_handle);
+  bool read_face(Face_handle);
+
+  void debug_vertex(Vertex_handle) const;
+  void debug_hedge(Halfedge_handle) const;
+
+public:
+/*{\Mcreation 3}*/
+PM_io_parser(std::istream& is, Plane_map& H)
+/*{\Mcreate creates an instance |\Mvar| of type |\Mname|
+   to input |H| from |is|.}*/
+    : Base(H), in(is), out(std::cout), verbose(0), vn(0), en(0), fn(0)
+        { this->clear(); }
+
+
+PM_io_parser(std::ostream& os, const Plane_map& H)
+/*{\Mcreate creates an instance |\Mvar| of type |\Mname|
+to output |H| to |os|.}*/
+: Base(const_cast<Plane_map&>(H)), in(std::cin), out(os), 
+  VI(Base::vertices_begin(), Base::vertices_end(),'v'),
+  EI(Base::halfedges_begin(),Base::halfedges_end(),'e'),
+  FI(Base::faces_begin(),Base::faces_end(),'f'),
+  vn(Base::number_of_vertices()), 
+  en(Base::number_of_halfedges()), 
+  fn(Base::number_of_faces())
+{ verbose = (get_mode(out) != CGAL::IO::ASCII &&
+             get_mode(out) != CGAL::IO::BINARY);
+}
+
+
+PM_io_parser(std::ostream& os, const PMDEC& D)
+: Base(D), in(std::cin), out(os), 
+  VI(Base::vertices_begin(),Base::vertices_end(),'v'),
+  EI(Base::halfedges_begin(),Base::halfedges_end(),'e'),
+  FI(Base::faces_begin(),Base::faces_end(),'f'),
+  vn(Base::number_of_vertices()), 
+  en(Base::number_of_halfedges()), 
+  fn(Base::number_of_faces())
+{ verbose = (get_mode(out) != CGAL::IO::ASCII &&
+             get_mode(out) != CGAL::IO::BINARY);
+}
+
+
+/*{\Moperations 2 3}*/
+
+bool check_sep(const char* sep);
+
+void print() const;
+/*{\Mop prints |H| to |os|.}*/
+void read();
+/*{\Mop reads |H| from |is|.}*/
+void debug() const;
+std::string index(Vertex_handle v) const { return VI(v,verbose); }
+std::string index(Halfedge_handle e) const { return EI(e,verbose); }
+std::string index(Face_handle f) const { return FI(f,verbose); }
+
+static void dump(const PMDEC& D, std::ostream& os = std::cerr);
+/*{\Mstatic prints the plane map decorated by |D| to |os|.}*/
+
+}; // PM_io_parser<PMDEC>
+
+
+//-----------------------------------------------------------------------------
+// OUTPUT AND INPUT:
+//-----------------------------------------------------------------------------
+
+template <typename PMDEC>
+bool PM_io_parser<PMDEC>::check_sep(const char* sep)
+{
+  char c; 
+  do in.get(c); while (isspace(c));
+  while (*sep != '\0') { 
+    if (*sep != c) {
+      in.putback(c);
+      return false;
+    }
+    ++sep; in.get(c);
+  }
+  in.putback(c);
+  return true;  
+}
+
+template <typename PMDEC>
+void PM_io_parser<PMDEC>::print_vertex(Vertex_handle v) const
+{
+  // syntax: index { isolated incident_object, mark, point }
+  out << index(v) << " { ";
+  if ( is_isolated(v) ) out << "1 " << index(face(v));
+  else                  out << "0 " << index(v->halfedge());
+  out  << ", " << mark(v) << ", " << point(v) <<  "}\n";
+}
+
+template <typename PMDEC>
+bool PM_io_parser<PMDEC>::read_vertex(Vertex_handle v)
+{ 
+  // precondition: nodes exist
+  // syntax: index { mark, point, isolated object }
+  int n; bool iso; int f; Mark m; Point p; 
+  if ( !(in >> n) ||
+       !check_sep("{") ||
+       !(in >> iso) ||
+       !(in >> f) ||
+       !check_sep(",") ||
+       !(in >> m) ||
+       !check_sep(",") ||
+       !(in >> p) ||
+       !check_sep("}") ) return false;
+ 
+  if (iso) v->set_face(Face_of[f]);
+  else     v->set_halfedge(Halfedge_of[f]);
+  mark(v) = m; point(v) = p;
+  return true; 
+}
+
+template <typename PMDEC>
+void PM_io_parser<PMDEC>::print_hedge(Halfedge_handle e) const
+{ // syntax: index { opposite, prev, next, vertex, face, mark }
+  out << index(e) << " { "
+      << index(twin(e)) << ", " 
+      << index(previous(e)) << ", " << index(next(e)) << ", "
+      << index(target(e)) << ", " <<   index(face(e)) << ", "
+      << mark(e) << " }\n";
+}
+
+template <typename PMDEC>
+bool PM_io_parser<PMDEC>::read_hedge(Halfedge_handle e)
+{ // syntax: index { opposite, prev, next, vertex, face, mark }
+  int n, eo, epr, ene, v, f; bool m; 
+  if ( !(in >> n) ||
+       !check_sep("{") ||
+       !(in >> eo) || !check_sep(",") ||
+       !(in >> epr) || !check_sep(",") ||
+       !(in >> ene) || !check_sep(",") ||
+       !(in >> v) || !check_sep(",") ||
+       !(in >> f) || !check_sep(",") ||
+       !(in >> m) || !check_sep("}") )
+    return false;
+  CGAL_assertion_msg 
+     (eo >= 0 || (std::size_t) eo < en || epr >= 0 || (std::size_t) epr < en || ene >= 0 || (std::size_t) ene < en ||
+      v >= 0 || (std::size_t) v < vn || f >= 0 || (std::size_t) f < fn ,
+      "wrong index in read_hedge");
+  
+  // precond: objects exist!
+  CGAL_assertion(EI[e->opposite()]);
+  e->set_prev(Halfedge_of[epr]);
+  e->set_next(Halfedge_of[ene]);
+  e->set_vertex(Vertex_of[v]);
+  e->set_face(Face_of[f]);
+  mark(e) = m;
+  return true;
+}
+
+
+template <typename PMDEC>
+void PM_io_parser<PMDEC>::print_face(Face_handle f) const
+{ // syntax: index { halfedge, fclist, ivlist, mark }
+  out << index(f) << " { " << index(halfedge(f)) << ", ";
+  typedef typename std::list<Halfedge_handle>::iterator lhiterator;
+  lhiterator hit, hend = f->fc_end();
+  for(hit = f->fc_begin(); hit!=hend; ++hit) 
+    out << index(*hit) << ' ';
+  out << ", ";
+  typedef typename std::list<Vertex_handle>::iterator lviterator;
+  lviterator vit, vend = f->iv_end();
+  for(vit = f->iv_begin(); vit!=vend; ++vit) 
+    out << index(*vit) << ' ';
+  out << ", " << mark(f) << " }\n";
+}
+
+template <typename PMDEC>
+bool PM_io_parser<PMDEC>::read_face(Face_handle f)
+{ // syntax: index { halfedge, fclist, ivlist, mark }
+  int n, ei, vi; Mark m;
+  if ( !(in >> n) || !check_sep("{") ) return false;
+  if ( !(in >> ei) || !check_sep(",") ) return false;
+  if (ei >= 0) f->set_halfedge(Halfedge_of[ei]);
+  while (in >> ei) { 
+    CGAL_assertion_msg(ei >= 0 && (std::size_t) ei < en, "wrong index in face cycle list.");
+    f->store_fc(Halfedge_of[ei]);
+  } in.clear();
+  if (!check_sep(",")) { return false; }
+  while (in >> vi) { 
+    CGAL_assertion_msg(vi >= 0 && (std::size_t) vi < vn, "wrong index in iso vertex list.");
+    f->store_iv(Vertex_of[vi]);
+  } in.clear();
+  if (!check_sep(",") || !(in >> m) || !check_sep("}") ) 
+    return false;
+  mark(f) = m;
+  return true;
+}
+
+template <typename PMDEC>
+void PM_io_parser<PMDEC>::print() const
+{
+  out << "Plane_map_2" << std::endl;
+  out << "vertices "  << vn << std::endl;
+  out << "halfedges " << en << std::endl;
+  out << "faces "     << fn << std::endl;
+  if (verbose) 
+    out << "/* index { isolated ? face : halfedge, mark, point } */" 
+        << std::endl;
+  Vertex_iterator vit, vend = this->vertices_end();
+  for(vit = this->vertices_begin(); vit!=vend; ++vit) print_vertex(vit);
+  if (verbose) 
+    out << "/* index { opposite, prev, next, vertex, face, mark } */" 
+        << std::endl;
+  Halfedge_iterator eit, eend = this->halfedges_end();
+  for(eit = this->halfedges_begin(); eit!=eend; ++eit) print_hedge(eit);
+  if (verbose) 
+    out << "/* index { halfedge, fclist, ivlist, mark } */" 
+        << std::endl;
+  Face_iterator fit, fend = this->faces_end();
+  for(fit = this->faces_begin(); fit!=fend; ++fit) print_face(fit);
+  out.flush();
+  if (verbose) debug();
+}
+
+template <typename PMDEC>
+void PM_io_parser<PMDEC>::read() 
+{
+  if ( !check_sep("Plane_map_2") )  
+    CGAL_error_msg("PM_io_parser::read: no embedded_PM header.");
+  if ( !(check_sep("vertices") && (in >> vn)) ) 
+    CGAL_error_msg("PM_io_parser::read: wrong node line.");
+  if ( !(check_sep("halfedges") && (in >> en) && (en%2==0)) )
+    CGAL_error_msg("PM_io_parser::read: wrong edge line.");
+  if ( !(check_sep("faces") && (in >> fn)) )
+    CGAL_error_msg("PM_io_parser::read: wrong face line.");
+
+  Vertex_of.resize(vn);
+  Halfedge_of.resize(en);
+  Face_of.resize(fn);
+
+  for(i=0; i<vn; i++)  Vertex_of[i] =   this->new_vertex();
+  for(i=0; i<en; i++) 
+    if (i%2==0) Halfedge_of[i] = this->new_halfedge_pair_without_vertices();
+    else Halfedge_of[i] = twin(Halfedge_of[i-1]);
+  for(i=0; i<fn; i++)  Face_of[i] =     this->new_face();
+
+  for(i=0; i<vn; i++) {
+    if (!read_vertex(Vertex_of[i]))
+      CGAL_error_msg("PM_io_parser::read: error in node line");
+  }
+  for(i=0; i<en; i++) {
+    if (!read_hedge(Halfedge_of[i]))
+      CGAL_error_msg("PM_io_parser::read: error in halfedge\
+      line");
+  }
+  for(i=0; i<fn; i++) {
+    if (!read_face(Face_of[i]))
+      CGAL_error_msg("PM_io_parser::read: error in face line");
+  }
+}
+
+//-----------------------------------------------------------------------------
+// VERBOSE OUTPUT:
+// note that we output the index of the objects which is stored in them
+// this is NOT the member index as produced by the forall loops
+//-----------------------------------------------------------------------------
+
+template <typename PMDEC>
+void PM_io_parser<PMDEC>::debug_vertex(Vertex_handle v) const
+{ 
+  out << index(v) << "[" << mark(v) << "," << point(v) << "]" 
+      << std::endl; 
+}
+
+template <typename PMDEC>
+void PM_io_parser<PMDEC>::debug_hedge(Halfedge_handle e) const
+{ 
+  out << index(e)
+      << "(" << index(source(e)) << "," << index(target(e)) << ") "
+      << index(face(e)) << " " << index(twin(e))
+      << " ["<< mark(e) << "]" <<" "<<&*(face(e)) << std::endl;
+}
+
+
+template <typename PMDEC>
+void PM_io_parser<PMDEC>::debug() const
+{ 
+  out << "\nDEBUG Plane_map\n"
+      << "Vertices:  " << this->number_of_vertices() << "\n"
+      << "Halfedges: " << this->number_of_halfedges() << "\n";
+  Vertex_iterator vit,vend = this->vertices_end(); 
+  for( vit = this->vertices_begin(); vit != vend; ++vit ) {
+    if ( is_isolated(vit) ) continue;
+    typename Base::Halfedge_around_vertex_circulator
+      hcirc = out_edges(vit), hend = hcirc;
+    debug_vertex(vit);
+    CGAL_For_all(hcirc,hend) { out << "  "; debug_hedge(hcirc); }
+  }
+  out << std::endl;
+}
+
+template <typename PMDEC>
+void PM_io_parser<PMDEC>::dump(const PMDEC& D, std::ostream& os)
+{ PM_io_parser<PMDEC> Out(os,D);
+  Out.print();
+}
+
+
+
+} //namespace CGAL
+#endif //CGAL_PM_IO_PARSER_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_2/PM_overlayer.h b/3rdparty/CGAL/include/CGAL/Nef_2/PM_overlayer.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_2/PM_overlayer.h
rename to 3rdparty/CGAL/include/CGAL/Nef_2/PM_overlayer.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_2/PM_persistent_PL.h b/3rdparty/CGAL/include/CGAL/Nef_2/PM_persistent_PL.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_2/PM_persistent_PL.h
rename to 3rdparty/CGAL/include/CGAL/Nef_2/PM_persistent_PL.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_2/PM_point_locator.h b/3rdparty/CGAL/include/CGAL/Nef_2/PM_point_locator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_2/PM_point_locator.h
rename to 3rdparty/CGAL/include/CGAL/Nef_2/PM_point_locator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_2/Polynomial.h b/3rdparty/CGAL/include/CGAL/Nef_2/Polynomial.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_2/Polynomial.h
rename to 3rdparty/CGAL/include/CGAL/Nef_2/Polynomial.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_2/Polynomial_impl.h b/3rdparty/CGAL/include/CGAL/Nef_2/Polynomial_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_2/Polynomial_impl.h
rename to 3rdparty/CGAL/include/CGAL/Nef_2/Polynomial_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_2/Segment_overlay_traits.h b/3rdparty/CGAL/include/CGAL/Nef_2/Segment_overlay_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_2/Segment_overlay_traits.h
rename to 3rdparty/CGAL/include/CGAL/Nef_2/Segment_overlay_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_2/debug.h b/3rdparty/CGAL/include/CGAL/Nef_2/debug.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_2/debug.h
rename to 3rdparty/CGAL/include/CGAL/Nef_2/debug.h
diff --git a/3rdparty/CGAL/include/CGAL/Nef_2/gen_point_location.h b/3rdparty/CGAL/include/CGAL/Nef_2/gen_point_location.h
new file mode 100644
index 0000000..b51c9b9
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Nef_2/gen_point_location.h
@@ -0,0 +1,606 @@
+// Copyright (c) 1997-2000  Max-Planck-Institute Saarbruecken (Germany).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Michael Seel <seel at mpi-sb.mpg.de>
+
+
+#ifndef CGAL_NEF_2_GEN_POINT_LOCATION_H
+#define CGAL_NEF_2_GEN_POINT_LOCATION_H
+
+#include <CGAL/LEDA_basic.h>
+#include <LEDA/core/pp_dictionary.h>
+#include <sstream>
+#include <string>
+#include <list>
+#include <vector>
+#include <map>
+#ifdef CGAL_I_DO_WANT_TO_USE_GENINFO
+#include <CGAL/Nef_2/geninfo.h>
+#else
+#include <boost/any.hpp>
+#endif
+
+
+#undef CGAL_NEF_DEBUG
+#define CGAL_NEF_DEBUG 17
+#include <CGAL/Nef_2/debug.h>
+
+// #define CHECKING_OFF
+
+// for dictionary
+template <class Node>
+inline std::ostream& operator<<(std::ostream& o, const std::list<Node>& n) 
+{ return o; }
+
+/*{\Manpage {GenericLocation}{Node, Edge}
+{Return Type for Planar Point Location}{L}}*/
+
+template <class Node, class Edge>
+class GenericLocation {
+/*{\Mdefinition
+  An instance of the data type |\Mtype| is used as return value for planar 
+  point location. It can store a node or an edge of a graph or the special
+  value |nil| which is used to signal that no node or edge could be found.
+}*/
+  #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO
+  typedef void*  GenPtr;
+  #else
+  typedef boost::any GenPtr;
+  #endif
+public:
+/*{\Mtypes}*/ 
+  enum Type { NIL, NODE, EDGE };
+  /*{\Menum This enumeration allows to specify the 3 basic types of the 
+     values that a |\Mtype| can represent.}*/
+
+  /*{\Mcreation}*/ 
+    GenericLocation()       { init(); }
+    /*{\Mcreate creates a |\Mtype| and initializes with the value |nil|.}*/
+    GenericLocation(Node n) { init(n); }
+    /*{\Mcreate creates a |\Mtype| and initializes with the node |n|.}*/
+    GenericLocation(Edge e) { init(e); }
+    /*{\Mcreate creates a |\Mtype| and initializes with the edge |e|.}*/
+
+    ~GenericLocation() { clear(); }
+
+    GenericLocation(const GenericLocation<Node, Edge>& L) { assign(L); }
+    GenericLocation<Node, Edge>& operator=(
+      const GenericLocation<Node, Edge>& L)
+    { clear(); assign(L); return *this; }
+
+  /*{\Moperations}*/
+    operator const Node&() const
+    {
+  #if !defined(CHECKING_OFF)
+      if (type != NODE) 
+        CGAL_LEDA_SCOPE::error_handler(1, "Location: not convertible to node");
+  #endif
+      #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO
+      return geninfo<Node>::const_access(value);
+      #else
+      return 
+        *boost::any_cast<Node>(&value);
+      #endif
+    }
+    /*{\Mconversion converts |\Mvar| into a node.\\
+       \precond |\Mvar| represents a node.}*/
+
+    operator const Edge&() const
+    { 
+  #if !defined(CHECKING_OFF)
+      if (type != EDGE) 
+        CGAL_LEDA_SCOPE::error_handler(1, "Location: not convertible to edge");
+  #endif
+      #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO
+      return geninfo<Edge>::const_access(value);
+      #else
+      return 
+        *boost::any_cast<Edge>(&value);
+      #endif
+    }
+    /*{\Mconversion converts |\Mvar| into an edge.\\
+       \precond |\Mvar| represents an edge.}*/
+
+    GenericLocation<Node, Edge>& operator=(Node n)
+    { clear(); init(n); return *this; }
+    /*{\Mbinop makes |\Mvar| represent the node |n|.}*/
+
+    GenericLocation<Node, Edge>& operator=(Edge e)
+    { clear(); init(e); return *this; }
+    /*{\Mbinop makes |\Mvar| represent the edge |e|.}*/
+
+    Type get_type() const { return type; }
+    /*{\Mop returns the type of the value contained in |\Mvar|.}*/
+
+    bool is_nil()  const { return type == NIL; }
+    /*{\Mop returns |true| iff |\Mvar| represents the value |nil|.}*/
+
+    bool is_node() const { return type == NODE; }
+    /*{\Mop returns |true| iff |\Mvar| represents a node.}*/
+
+    bool is_edge() const { return type == EDGE; }
+    /*{\Mop returns |true| iff |\Mvar| represents an edge.}*/
+
+  private:
+    void init() { type = NIL; }
+    void init(Node n) 
+    { type = NODE; 
+      #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO
+      geninfo<Node>::create(value); 
+      geninfo<Node>::access(value) = n;
+      #else
+      value=n;
+      #endif
+    }
+    void init(Edge e) 
+    { type = EDGE; 
+      #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO
+      geninfo<Edge>::create(value); 
+      geninfo<Edge>::access(value) = e;
+      #else
+      value=e;
+      #endif
+    }
+
+    void clear()
+    { 
+      switch(type) {
+      #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO
+       case NODE: geninfo<Node>::clear(value); break;
+       case EDGE: geninfo<Edge>::clear(value); break;
+      #else
+       case NODE: value=boost::any(); break;
+       case EDGE: value=boost::any(); break;
+      #endif
+       case NIL: break;
+      }
+    }
+
+    void assign(const GenericLocation<Node, Edge>& L)
+    { 
+      type = L.type;
+      switch(type) {
+       case NODE: 
+        #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO
+         geninfo<Node>::access(value) = geninfo<Node>::const_access(L.value);
+        #else
+         *boost_any_cast<Node>(&value) = boost::any_cast<Node>(L.value);
+        #endif
+         break;
+       case EDGE: 
+        #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO
+         geninfo<Edge>::access(value) = geninfo<Edge>::const_access(L.value);
+        #else
+         *boost::any_cast<Edge>(&value) = boost::any_cast<Edge>(L.value);
+        #endif
+         break;
+       case NIL: break;
+      }
+    }
+
+  public:
+    typedef GenericLocation<Node, Edge> self;
+
+
+private:
+  Type   type;
+  GenPtr value;
+};
+
+/*{\Mimplementation
+  The data type |\Mtype| is implemented as a union of the types |Node| and 
+  |Edge|. There is only constant time and space overhead.
+}*/
+template <class Node, class Edge>
+inline
+bool 
+operator==(const GenericLocation<Node, Edge>& L1, 
+           const GenericLocation<Node, Edge>& L2)
+{ 
+  if (L1.get_type() != L2.get_type()) return false;
+  switch (L1.get_type()) {
+   case GenericLocation<Node, Edge>::NIL:  return true;
+   case GenericLocation<Node, Edge>::NODE: return Node(L1) == Node(L2);
+   case GenericLocation<Node, Edge>::EDGE: return Edge(L1) == Edge(L2);
+  }
+}
+
+template <class Node, class Edge>
+inline
+bool 
+operator!=(const GenericLocation<Node, Edge>& L1, 
+           const GenericLocation<Node, Edge>& L2)
+{ return ! (L1==L2); }
+
+template <class Node, class Edge>
+std::ostream& operator<<(std::ostream& o, 
+                         const GenericLocation<Node, Edge>& L)
+{
+  switch (L.get_type()) {
+   case GenericLocation<Node, Edge>::NIL:  return o<<"nil";
+   case GenericLocation<Node, Edge>::NODE: return o<<"node("<<&*Node(L)<<')';
+   case GenericLocation<Node, Edge>::EDGE: return o<<"edge("<<&*Edge(L)<<')';
+  }
+  return o;
+}
+
+template <class Node, class Edge>
+std::istream& operator>>(std::istream& i, GenericLocation<Node, Edge>&)
+{ return i; }
+template <class XCoord, class PredLessThanX, class Sweepline>
+class GenericXStructure {
+public:
+  typedef std::vector<XCoord>    Array_Coordinates;
+  typedef std::vector<Sweepline> Array_Sweeplines;
+  typedef typename Array_Coordinates::const_iterator Coord_iterator;
+  typedef typename Array_Sweeplines::const_iterator  Sweepline_iterator;
+private:
+  int stops;
+  PredLessThanX     LtX;
+  Array_Coordinates Coordinates;
+  Array_Sweeplines  SweepLines;
+  // SweepLines[0] is EmptyLine;
+public:
+  GenericXStructure() { clear(); }
+  GenericXStructure(int n, const PredLessThanX& cmp) { init(n, cmp); }
+  ~GenericXStructure() { clear(); }
+
+  void init(int n, const PredLessThanX& cmp)
+  { CGAL_NEF_TRACEN("XSinit "<<n); 
+    LtX = cmp;
+    Coordinates = Array_Coordinates(n);
+    SweepLines =  Array_Sweeplines(2*n+1);
+    stops = 0;
+  }
+
+  void clear()
+  { Coordinates.clear();
+    SweepLines.clear();
+    stops = 0;
+  }
+
+  void insertLines(const XCoord& X, 
+                   const Sweepline& atX, const Sweepline& inXplus)
+  { CGAL_NEF_TRACEN("XSinsert "<<X); 
+    Coordinates[stops]    = X;
+    SweepLines[2*stops+1]   = atX;
+    SweepLines[2*stops+2] = inXplus;
+    ++stops;
+  }
+
+  Sweepline_iterator getLineAt(const XCoord& X) const
+  { CGAL_NEF_TRACEN("XSgetLineAt "<<X);
+    Sweepline_iterator sit = SweepLines.begin(); // EmptyLine
+    if ( LtX(X,*Coordinates.begin()) ) {
+      CGAL_NEF_TRACEN("infinity first");
+      return sit; // ]-infinity, x0[
+    }
+    Coord_iterator stopit = std::lower_bound (
+        Coordinates.begin(),Coordinates.end(),X,LtX);
+    /* determines stopit maximal such that 
+       \forall j \in [begin,stopit) : *j < X
+       as a consequence now: *stopit >= X */
+    bool found_exact = false;
+    if ( LtX(X,*stopit) ) --stopit;  // X <  *stopit
+    else found_exact = true;         // X >= *stopit
+      
+    CGAL_NEF_TRACEN("stopit "<<*stopit);
+    int offset = stopit-Coordinates.begin();
+    return found_exact ? 
+      SweepLines.begin() + (2*offset+1) :
+      SweepLines.begin() + (2*offset+2);
+  }
+
+  Sweepline_iterator begin() const { return SweepLines.begin(); }
+  Sweepline_iterator end() const { return SweepLines.end();}
+
+};
+/*{\Manpage {PointLocator} {PLocTraits} {Planar Point Location} {PL}}*/
+
+template <class PLocTraits>
+class PointLocator {
+/*{\Mdefinition
+   An instance |\Mvar| of the parameterized data type |\Mtype| can be used
+   to perform point location queries in the two-dimensional plane.
+   Every non-empty instance |\Mvar| is associated with an embedded planar 
+   graph |G|, which has to remain unchanged while it is referenced by |PL|.\\
+   A location query for a point |p| returns the first object (node or edge)
+   of |G| which is intersected by the straight ray starting in |p| and going
+   vertically downwards/upwards.
+   If the ray does not intersect any node or edge of |G|, then |nil| is 
+   returned.\\
+   The class |\Mtype| is generic, it is parameterized with a traits class 
+   |PLocTraits| which widely controls its behaviour.
+   The traits may even change the return type of a query and its semantics.
+   There are predined traits classes for the LEDA graph types, which are
+   described below in a seperate section.
+}*/
+public:
+  // copied types from PLocTraits
+  typedef typename PLocTraits::Point             Point;
+  typedef typename PLocTraits::XCoord            XCoord;
+  typedef typename PLocTraits::PredLessThanX     PredLessThanX;
+
+  typedef typename PLocTraits::Graph             Graph;
+  typedef typename PLocTraits::Node              Node;
+  typedef typename PLocTraits::Edge              Edge;
+  typedef typename PLocTraits::NodeIterator      NodeIterator;
+  typedef typename PLocTraits::IncEdgeIterator   IncEdgeIterator;
+
+  typedef typename PLocTraits::Curve             Curve;
+  typedef typename PLocTraits::PredCompareCurves PredCompareCurves;
+
+  typedef typename PLocTraits::QueryResult       QueryResult;
+
+/*{\Mtypes}*/
+  // define additional types 
+  typedef GenericLocation<Node, Edge> Location;
+  /*{\Mtypedef usual return value for the point loaction.}*/
+
+  enum Direction { downwards, upwards};
+  /*{\Menum used to specify the direction for the point location.}*/
+
+  typedef CGAL_LEDA_SCOPE::pp_dictionary<Curve, Location, PredCompareCurves>   
+                                                              Sweepline;
+  typedef GenericXStructure<XCoord, PredLessThanX, Sweepline> XStructure;
+  typedef typename Sweepline::item                            SL_item;
+  typedef typename XStructure::Sweepline_iterator Sweepline_iterator;
+  /*{\Mcreation}*/ 
+  PointLocator() { clear(); }
+  /*{\Mcreate creates an empty |\Mtype|.}*/
+
+  PointLocator(const Graph& G, const PLocTraits& PLT = PLocTraits()) : 
+   traits(PLT) { init(G); }
+  /*{\Mcreate creates a |\Mtype| for the graph |G| and the traits |PLT|.}*/
+     
+  /*{\Moperations}*/
+  void clear() { X_Structure.clear(); traits.clear(); }
+  /*{\Mop makes |\Mvar| empty.}*/
+
+
+  void init(const Graph& G, const PLocTraits& PLT) { traits = PLT; init(G); }
+  /*{\Mop makes |\Mvar| a |\Mtype| for the graph |G| and the traits |PLT|.}*/
+
+  void init(const Graph& G);
+  /*{\Mop makes |\Mvar| a |\Mtype| for the graph |G|.}*/
+
+
+  QueryResult locate(const Point& p, const Direction dir) const
+  { return dir == downwards ? locate_down(p) : locate_up(p); }
+  /*{\Mop locates the point |p| in the direction |dir|.}*/
+
+  QueryResult locate_down(const Point& p) const;
+  /*{\Mop locates the point |p| vertically downwards.}*/
+
+  QueryResult locate_up(const Point& p) const;
+  /*{\Mop locates the point |p| vertically upwards.}*/
+
+  Location location(Sweepline_iterator S, SL_item it) const
+  { return (it == nil ? Location() : S->inf(it)); }
+
+  std::string str(const Sweepline& S) const
+  { std::ostringstream os; os << "Sweepline:\n";
+    SL_item it;
+    forall_items(it,S) {  os << "  " << S.key(it) << std::endl; }
+    return os.str();
+  }
+
+
+private:
+  PLocTraits traits;
+  XStructure X_Structure;
+
+};
+
+template <class PLocTraits>
+void
+PointLocator<PLocTraits>::init(const Graph& G)
+{
+  traits.sweep_begin(G);
+  PredLessThanX LtX = traits.getLessThanX();
+  typedef std::map<XCoord, std::list<Node>, PredLessThanX> dictionary;
+  typedef typename dictionary::iterator dic_iterator;
+  dictionary stops(LtX);
+  // Note: X_Structure, Sweepline, and stops copy compare object
+
+  NodeIterator ni = traits.Nodes_begin(G), beyond = traits.Nodes_end(G);
+  for(; ni != beyond; ++ni) {
+    XCoord currentX = traits.getXCoord(G, ni);
+    stops[currentX].push_front(traits.toNode(ni));
+  }
+
+  Sweepline SL(traits.getCompareCurves());
+  X_Structure.init(stops.size(), LtX);
+  dic_iterator stop;
+  for(stop = stops.begin(); stop != stops.end(); ++stop) {
+    std::list<Node>& NodesOnSL = stop->second;
+    traits.sweep_moveto(traits.getXCoord(G, *NodesOnSL.begin()));
+      std::list<Edge> EmergingEdges, VerticalEdges;
+
+      // explore the nodes on SL
+      typename std::list<Node>::iterator cur_node;
+      for(cur_node = NodesOnSL.begin(); 
+          cur_node != NodesOnSL.end(); ++cur_node) {
+        IncEdgeIterator ei     = traits.IncEdges_begin(G, *cur_node);
+        IncEdgeIterator beyond = traits.IncEdges_end(G, *cur_node);
+          CGAL_NEF_TRACEN("NODE: "<<(*cur_node)->point());
+        for(; ei != beyond; ++ei) { 
+          switch (traits.ClassifyEdge(G, traits.toEdge(ei), *cur_node)) {
+            case PLocTraits::StartingNonVertical: 
+              EmergingEdges.push_front(traits.toEdge(ei)); break;
+            case PLocTraits::StartingVertical:    
+              VerticalEdges.push_front(traits.toEdge(ei)); break;
+            case PLocTraits::EndingNonVertical:
+              SL.del(traits.makeCurve(G, traits.toEdge(ei))); break;
+            case PLocTraits::EndingVertical: break;
+          }
+        }
+      }
+
+      // compute SL_at_X
+
+      typename std::list<Edge>::iterator cur_edge;
+      for(cur_edge=VerticalEdges.begin(); 
+          cur_edge!=VerticalEdges.end(); ++cur_edge) 
+        SL.insert(traits.makeCurve(G, *cur_edge), Location(*cur_edge));
+      for(cur_node=NodesOnSL.begin();
+          cur_node!=NodesOnSL.end(); ++cur_node)
+        SL.insert(traits.makeCurve(G, *cur_node), Location(*cur_node));
+      Sweepline SL_at_X = SL;
+
+      // compute SL_in_X_plus
+
+      for(cur_edge=VerticalEdges.begin(); 
+          cur_edge!=VerticalEdges.end(); ++cur_edge)
+        SL.del(traits.makeCurve(G, *cur_edge));
+      for(cur_node=NodesOnSL.begin();
+          cur_node!=NodesOnSL.end(); ++cur_node)
+        SL.del(traits.makeCurve(G, *cur_node));
+
+      for(cur_edge=EmergingEdges.begin();
+          cur_edge!=EmergingEdges.end(); ++cur_edge) 
+        SL.insert(traits.makeCurve(G, *cur_edge), Location(*cur_edge));
+
+    X_Structure.insertLines(traits.getXCoord(G, *NodesOnSL.begin()), 
+                            SL_at_X, SL);
+  }
+
+  traits.sweep_end();
+}
+
+template <class PLocTraits>
+typename PointLocator<PLocTraits>::QueryResult
+PointLocator<PLocTraits>::
+locate_down(const typename PLocTraits::Point& p) const
+{
+  Sweepline_iterator line_at_x = X_Structure.getLineAt(traits.getXCoord(p)),
+                     line_plus = line_at_x;
+  CGAL_NEF_TRACEN("locate_down "<<str(*line_at_x));
+  Curve p_curve = traits.makeCurve(p);
+  PredCompareCurves cmp = traits.getCompareCurves();
+  SL_item it = line_at_x->locate_pred(p_curve), it_plus(0);
+  if ( it && line_at_x->inf(it).is_node() &&
+       cmp(p_curve, line_at_x->key(it))!=0 ) {
+    // p hit a feature exactly
+    line_plus = line_at_x+1;
+    if ( line_plus != X_Structure.end() )
+      it_plus = line_plus->locate_pred(p_curve);
+  }
+  return traits.PostProcess(location(line_at_x,it),
+                            location(line_plus,it_plus),p);
+}
+
+template <class PLocTraits>
+typename PointLocator<PLocTraits>::QueryResult
+PointLocator<PLocTraits>::locate_up(const typename PLocTraits::Point& p) const
+{
+  Sweepline_iterator line_at_x = 
+    X_Structure.getLineAt(traits.getXCoord(p)), line_plus;
+  Curve p_curve = traits.makeCurve(p);
+  PredCompareCurves cmp = traits.getCompareCurves();
+  SL_item it = line_at_x->locate_succ(p_curve), it_plus(0);
+  if ( it && line_at_x->inf(it).is_node() &&
+       cmp(p_curve, line_at_x->key(it))!=0 ) {
+    // p hit a feature exactly
+    line_plus = line_at_x+1;
+    if ( line_plus != X_Structure.end() )
+      it_plus = line_plus->locate_succ(p_curve);
+  }
+  return traits.PostProcess(location(line_at_x,it),
+                            location(line_plus,it_plus), p);
+}
+
+/*{\Mimplementation
+  The implementation of the data type |\Mtype| is based on partially 
+  persistent binary search trees.
+  The expected space requirement is $O(k)$ where $k$ is the sum of the number 
+  of nodes and the number of edges in the graph $G$.
+  The expected time needed for construction and the operation |init| is 
+  $O(k \cdot \log k)$, for the |locate|-operations it is $O(\log k)$. The
+  operation |clear| runs in $O(k)$.
+}*/
+/*{\Mtext
+  \headerline{\arabic{manctr}. Predefined traits classes}
+  \stepcounter{manctr}
+  All predefined traits classes have in common that the return type of a query 
+  is the type |Location|.
+  The embedding of the given graph |G| is a straight-line embedding, so that
+  it is totally determined by the position of the nodes of |G|.
+  Such a position is specified by a |Point| which can be one of the LEDA point
+  types |point| or |rat_point|. The positions can be specified implicitly by 
+  the node attribute of a parameterized graph (e.g. |GRAPH<Point,...>|) or 
+  explicitly by a |node_array<Point>|. In case of explicit specification a
+  |node_array| with the positions of the nodes can be passed to the constructor
+  of the traits class.
+  Further, the point location processes for maps and for standard graphs differ
+  slightly. As a map is a bidirected graph where each edge knows its reversal,
+  the traits classes for maps can ensure the following property:
+  If the result of a query for point |p| is an edge |e| (not containing |p|),
+  then |e| bounds the face of |G| which contains |p|, i.e. |p| lies to the
+  left of |e|.\\
+  Here comes a list of the predefined traits classes:\\[-5.5ex]
+  \begin{itemize}
+  \item |PLocTraits<Graph>|: standard traits for implicitly specified node 
+    positions\\
+    |Graph| can be |GRAPH<Point,...>| (standard graph) or 
+    |PLANAR_MAP<Point,...,...>| (map).
+  \item |PLocTraits_NodeArray<Graph,Point>|: std. traits for explicitly 
+    specified node positions\\
+    |Graph| can be |graph| (standard graph) or |planar_map| (map).
+  \item |PLocTraits_Map<Graph>| and |PLocTraits_Map_NodeArray<Graph,Point>|:\\
+    The parameter |Graph| can be |GRAPH<Point,...>| and |graph| respectively.
+    These traits classes assume that the given graphs are maps.
+  \item |PLocTraits< GRAPH<Circle,Point> >|: traits class for closest-site 
+    voronoi diagrams
+  \end{itemize}
+  Note that a traits class instantiated with |Graph| can also handle graph 
+  types which are derived from |Graph|. Thus |PLocTraits< graph<Point,T> >| 
+  can be used for graphs of type |ugraph<Point,T>| for example.
+}*/
+/*{\Mexample
+First we show an example where the node positions are given implicitly
+as node attributes:
+\begin{verbatim}
+  typedef PointLocator< PLocTraits< GRAPH<Point, int> > > PLocator1;
+  typedef PLocator1::Location Location;
+
+  UGRAPH<Point, int> G;
+  ... // construct G
+
+  PLocator1 PL1(G);
+  Point p = ...; // compute p
+  Location L1 = PL1.locate_down(p);
+\end{verbatim}
+
+The second example shows how a |node_array| can be used to determine the
+node positions:
+\begin{verbatim}
+  typedef PLocTraits_NodeArray<planar_map,Point> PLocTraits2;
+  typedef PointLocator<PLocTraits2> PLocator2;
+
+  planar_map pm;
+  node_array<Point> na;
+  ... // construct pm and na
+
+  PLocator2 PL2(pm, PLocTraits2(na));
+  Point q = ...; // compute q
+  Location L2 = PL2.locate_up(q);
+\end{verbatim}
+}*/
+
+#endif // GEN_POINT_LOCATION_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_2/geninfo.h b/3rdparty/CGAL/include/CGAL/Nef_2/geninfo.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_2/geninfo.h
rename to 3rdparty/CGAL/include/CGAL/Nef_2/geninfo.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_2/iterator_tools.h b/3rdparty/CGAL/include/CGAL/Nef_2/iterator_tools.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_2/iterator_tools.h
rename to 3rdparty/CGAL/include/CGAL/Nef_2/iterator_tools.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/Binary_operation.h b/3rdparty/CGAL/include/CGAL/Nef_3/Binary_operation.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/Binary_operation.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/Binary_operation.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/Bounding_box_3.h b/3rdparty/CGAL/include/CGAL/Nef_3/Bounding_box_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/Bounding_box_3.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/Bounding_box_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/Combine_with_halfspace.h b/3rdparty/CGAL/include/CGAL/Nef_3/Combine_with_halfspace.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/Combine_with_halfspace.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/Combine_with_halfspace.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/Default_items.h b/3rdparty/CGAL/include/CGAL/Nef_3/Default_items.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/Default_items.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/Default_items.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/Edge_edge_overlay.h b/3rdparty/CGAL/include/CGAL/Nef_3/Edge_edge_overlay.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/Edge_edge_overlay.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/Edge_edge_overlay.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xy_3.h b/3rdparty/CGAL/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xy_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xy_3.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xy_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xz_3.h b/3rdparty/CGAL/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xz_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xz_3.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xz_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_yz_3.h b/3rdparty/CGAL/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_yz_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_yz_3.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_yz_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/Halfedge.h b/3rdparty/CGAL/include/CGAL/Nef_3/Halfedge.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/Halfedge.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/Halfedge.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/Halffacet.h b/3rdparty/CGAL/include/CGAL/Nef_3/Halffacet.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/Halffacet.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/Halffacet.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/ID_support_handler.h b/3rdparty/CGAL/include/CGAL/Nef_3/ID_support_handler.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/ID_support_handler.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/ID_support_handler.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/Infimaximal_box.h b/3rdparty/CGAL/include/CGAL/Nef_3/Infimaximal_box.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/Infimaximal_box.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/Infimaximal_box.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/K3_tree.h b/3rdparty/CGAL/include/CGAL/Nef_3/K3_tree.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/K3_tree.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/K3_tree.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/Mark_bounded_volumes.h b/3rdparty/CGAL/include/CGAL/Nef_3/Mark_bounded_volumes.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/Mark_bounded_volumes.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/Mark_bounded_volumes.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/Nef_box.h b/3rdparty/CGAL/include/CGAL/Nef_3/Nef_box.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/Nef_box.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/Nef_box.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/OGL_helper.h b/3rdparty/CGAL/include/CGAL/Nef_3/OGL_helper.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/OGL_helper.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/OGL_helper.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/Pluecker_line_3.h b/3rdparty/CGAL/include/CGAL/Nef_3/Pluecker_line_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/Pluecker_line_3.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/Pluecker_line_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/SFace.h b/3rdparty/CGAL/include/CGAL/Nef_3/SFace.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/SFace.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/SFace.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/SHalfedge.h b/3rdparty/CGAL/include/CGAL/Nef_3/SHalfedge.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/SHalfedge.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/SHalfedge.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/SHalfloop.h b/3rdparty/CGAL/include/CGAL/Nef_3/SHalfloop.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/SHalfloop.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/SHalfloop.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/SM_visualizor.h b/3rdparty/CGAL/include/CGAL/Nef_3/SM_visualizor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/SM_visualizor.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/SM_visualizor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_FM_decorator.h b/3rdparty/CGAL/include/CGAL/Nef_3/SNC_FM_decorator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_FM_decorator.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/SNC_FM_decorator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_SM_explorer.h b/3rdparty/CGAL/include/CGAL/Nef_3/SNC_SM_explorer.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_SM_explorer.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/SNC_SM_explorer.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_SM_overlayer.h b/3rdparty/CGAL/include/CGAL/Nef_3/SNC_SM_overlayer.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_SM_overlayer.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/SNC_SM_overlayer.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_SM_visualizor.h b/3rdparty/CGAL/include/CGAL/Nef_3/SNC_SM_visualizor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_SM_visualizor.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/SNC_SM_visualizor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_const_decorator.h b/3rdparty/CGAL/include/CGAL/Nef_3/SNC_const_decorator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_const_decorator.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/SNC_const_decorator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_constructor.h b/3rdparty/CGAL/include/CGAL/Nef_3/SNC_constructor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_constructor.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/SNC_constructor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_decorator.h b/3rdparty/CGAL/include/CGAL/Nef_3/SNC_decorator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_decorator.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/SNC_decorator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_decorator_traits.h b/3rdparty/CGAL/include/CGAL/Nef_3/SNC_decorator_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_decorator_traits.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/SNC_decorator_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_external_structure.h b/3rdparty/CGAL/include/CGAL/Nef_3/SNC_external_structure.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_external_structure.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/SNC_external_structure.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_indexed_items.h b/3rdparty/CGAL/include/CGAL/Nef_3/SNC_indexed_items.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_indexed_items.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/SNC_indexed_items.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_intersection.h b/3rdparty/CGAL/include/CGAL/Nef_3/SNC_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/SNC_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_io_parser.h b/3rdparty/CGAL/include/CGAL/Nef_3/SNC_io_parser.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_io_parser.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/SNC_io_parser.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_items.h b/3rdparty/CGAL/include/CGAL/Nef_3/SNC_items.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_items.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/SNC_items.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_iteration.h b/3rdparty/CGAL/include/CGAL/Nef_3/SNC_iteration.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_iteration.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/SNC_iteration.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_k3_tree_traits.h b/3rdparty/CGAL/include/CGAL/Nef_3/SNC_k3_tree_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_k3_tree_traits.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/SNC_k3_tree_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_list.h b/3rdparty/CGAL/include/CGAL/Nef_3/SNC_list.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_list.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/SNC_list.h
diff --git a/3rdparty/CGAL/include/CGAL/Nef_3/SNC_point_locator.h b/3rdparty/CGAL/include/CGAL/Nef_3/SNC_point_locator.h
new file mode 100644
index 0000000..6e5bee8
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Nef_3/SNC_point_locator.h
@@ -0,0 +1,1378 @@
+// Copyright (c) 1997-2000  Max-Planck-Institute Saarbruecken (Germany).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Miguel Granados <granados at mpi-sb.mpg.de>
+
+#ifndef CGAL_NEF_SNC_POINT_LOCATOR_H
+#define CGAL_NEF_SNC_POINT_LOCATOR_H
+
+#include <CGAL/basic.h>
+#include <CGAL/Nef_3/SNC_intersection.h>
+#include <CGAL/Nef_3/SNC_k3_tree_traits.h>
+#include <CGAL/Nef_3/K3_tree.h>
+#include <CGAL/Unique_hash_map.h>
+#include <CGAL/Timer.h>
+#include <cstring> // for std::strcpy
+
+#ifdef CGAL_NEF3_TRIANGULATE_FACETS
+#include <CGAL/Constrained_triangulation_2.h>
+#include <CGAL/Triangulation_data_structure_2.h>
+#include <CGAL/Projection_traits_xy_3.h>
+#include <CGAL/Projection_traits_yz_3.h>
+#include <CGAL/Projection_traits_xz_3.h>
+#include <CGAL/Constrained_triangulation_face_base_2.h>
+#endif
+
+#undef CGAL_NEF_DEBUG
+#define CGAL_NEF_DEBUG 509
+#include <CGAL/Nef_2/debug.h>
+
+#undef _CGAL_NEF_TRACEN
+#define _CGAL_NEF_TRACEN(msg) CGAL_NEF_TRACEN( "SNC_point_locator: " << msg)
+
+// TODO: find out the proper CGAL replacement for this macro and remove it
+#define CGAL_for_each( i, C) for( i = C.begin(); i != C.end(); ++i)
+
+// #define CGAL_NEF_TIMER(instruction) instruction
+#define CGAL_NEF_TIMER(instruction)
+
+// #define CGAL_NEF_CLOG(t) std::clog <<" "<<t<<std::endl; std::clog.flush()
+#define CGAL_NEF_CLOG(t)
+
+namespace CGAL {
+
+template <typename SNC_decorator>
+class SNC_point_locator
+{
+ public:
+  class Intersection_call_back;
+  typedef SNC_decorator Base;
+  typedef SNC_point_locator<SNC_decorator> Self;
+  typedef typename SNC_decorator::Decorator_traits Decorator_traits;
+  typedef typename SNC_decorator::SNC_structure SNC_structure;
+protected:
+  char version_[64];
+  // time for construction, point location, ray shooting and intersection test
+  mutable Timer ct_t, pl_t, rs_t, it_t; 
+
+public: 
+  typedef typename SNC_structure::Object_handle Object_handle;
+
+  typedef typename SNC_structure::Point_3 Point_3;
+  typedef typename SNC_structure::Segment_3 Segment_3;
+  typedef typename SNC_structure::Ray_3 Ray_3;
+  typedef typename SNC_structure::Vector_3 Vector_3;
+  typedef typename SNC_structure::Aff_transformation_3 
+                                  Aff_transformation_3;
+
+  typedef typename Decorator_traits::Vertex_handle Vertex_handle;
+  typedef typename Decorator_traits::Halfedge_handle Halfedge_handle;
+  typedef typename Decorator_traits::Halffacet_handle Halffacet_handle;
+  typedef typename Decorator_traits::Volume_handle Volume_handle;
+  typedef typename Decorator_traits::Vertex_iterator Vertex_iterator;
+  typedef typename Decorator_traits::Halfedge_iterator Halfedge_iterator;
+  typedef typename Decorator_traits::Halffacet_iterator Halffacet_iterator;
+
+
+  const char* version() { return version_; }
+
+  virtual Object_handle locate(const Point_3& p) const = 0;
+
+  virtual Object_handle shoot(const Ray_3& s, int mask=255) const = 0;
+
+  virtual void intersect_with_edges( Halfedge_handle edge,
+                                     const Intersection_call_back& call_back) 
+    const = 0;
+
+  virtual void intersect_with_facets( Halfedge_handle edge,
+                                      const Intersection_call_back& call_back)
+    const = 0;
+
+  virtual void intersect_with_edges_and_facets( Halfedge_handle edge,
+	const Intersection_call_back& call_back) const = 0;
+
+  class Intersection_call_back 
+  {
+  public:
+    virtual void operator()( Halfedge_handle edge, Object_handle object, 
+                             const Point_3& intersection_point) const = 0;
+    
+    virtual ~Intersection_call_back() {}
+  };
+
+  virtual void initialize(SNC_structure* W) = 0;
+
+  virtual Self* clone() const = 0;
+
+  virtual void transform(const Aff_transformation_3& t) = 0;
+
+  //virtual bool update( Unique_hash_map<Vertex_handle, bool>& V, 
+  //                   Unique_hash_map<Halfedge_handle, bool>& E, 
+  //                   Unique_hash_map<Halffacet_handle, bool>& F) = 0;
+
+  virtual void add_facet(Halffacet_handle) {}
+
+  virtual void add_edge(Halfedge_handle) {}
+
+  virtual void add_vertex(Vertex_handle) {}
+
+  virtual ~SNC_point_locator() {
+    CGAL_NEF_CLOG("");
+    CGAL_NEF_CLOG("construction_time:  "<<ct_t.time());
+    CGAL_NEF_CLOG("pointlocation_time: "<<pl_t.time());
+    CGAL_NEF_CLOG("rayshooting_time:   "<<rs_t.time());
+    CGAL_NEF_CLOG("intersection_time:  "<<it_t.time());
+    // warning: the total time showed here could be actually larger
+    // that the real time used by this class, since point location
+    // and intersection test use the ray shooter and so the same time 
+    // could be account to more than one timer
+    CGAL_NEF_CLOG("pltotal_time:       "<<
+      ct_t.time()+pl_t.time()+rs_t.time()+it_t.time());
+  };
+};
+
+template <typename SNC_decorator>
+class SNC_point_locator_by_spatial_subdivision : 
+  public SNC_point_locator<SNC_decorator>,
+  public SNC_decorator
+{ 
+  typedef SNC_decorator Base;
+  typedef CGAL::SNC_point_locator<SNC_decorator> SNC_point_locator;
+  typedef CGAL::SNC_point_locator_by_spatial_subdivision<SNC_decorator> Self;
+  typedef typename SNC_decorator::SNC_structure SNC_structure;
+  typedef typename SNC_decorator::Decorator_traits Decorator_traits;
+  typedef typename Decorator_traits::SM_decorator SM_decorator;
+  typedef CGAL::SNC_intersection<SNC_structure> SNC_intersection;
+  typedef typename SNC_decorator::SM_point_locator SM_point_locator;
+  typedef typename SNC_decorator::Kernel Kernel;
+
+public:
+  typedef typename CGAL::SNC_k3_tree_traits<SNC_decorator> K3_tree_traits;
+
+  typedef typename CGAL::K3_tree<K3_tree_traits> K3_tree;
+  typedef K3_tree SNC_candidate_provider;
+  
+  typedef typename SNC_structure::Object_handle Object_handle;
+ #ifdef CGAL_NEF3_TRIANGULATE_FACETS
+  typedef typename Decorator_traits::Halffacet_triangle_handle 
+                                     Halffacet_triangle_handle;
+#endif
+#ifdef CGAL_NEF3_FACET_WITH_BOX
+  typedef typename SNC_structure::Partial_facet Partial_facet;
+#endif
+  typedef typename SNC_structure::Point_3 Point_3;
+  typedef typename SNC_structure::Plane_3 Plane_3;
+  typedef typename SNC_structure::Segment_3 Segment_3;
+  typedef typename SNC_structure::Ray_3 Ray_3;
+  typedef typename SNC_structure::Vector_3 Vector_3;
+  typedef typename SNC_structure::Triangle_3 Triangle_3;
+  typedef typename SNC_structure::Aff_transformation_3 
+                                  Aff_transformation_3;
+
+  typedef typename SNC_structure::Infi_box Infi_box;
+
+  typedef typename Decorator_traits::Vertex_handle Vertex_handle;
+  typedef typename Decorator_traits::Halfedge_handle Halfedge_handle;
+  typedef typename Decorator_traits::Halffacet_handle Halffacet_handle;
+  typedef typename Decorator_traits::SHalfedge_handle SHalfedge_handle;
+  typedef typename Decorator_traits::SFace_handle SFace_handle;
+  typedef typename Decorator_traits::Vertex_iterator Vertex_iterator;
+  typedef typename Decorator_traits::Halfedge_iterator Halfedge_iterator;
+  typedef typename Decorator_traits::Halffacet_iterator Halffacet_iterator;
+  typedef typename Decorator_traits::Volume_handle Volume_handle;
+
+  typedef typename Decorator_traits::Halffacet_cycle_iterator 
+                                     Halffacet_cycle_iterator;
+  typedef typename Decorator_traits::SHalfedge_around_facet_circulator 
+	                             SHalfedge_around_facet_circulator;
+
+  typedef typename SNC_candidate_provider::Object_list Object_list;
+  typedef typename Object_list::iterator Object_list_iterator;
+  typedef typename SNC_candidate_provider::Objects_along_ray Objects_along_ray;
+  typedef typename Objects_along_ray::Iterator Objects_along_ray_iterator;
+
+  //  typedef typename SNC_candidate_provider::Objects_around_box Objects_around_box;
+
+  using Base::get_visible_facet;
+public:
+  SNC_point_locator_by_spatial_subdivision() : 
+    initialized(false), candidate_provider(0) {}
+
+#ifdef CGAL_NEF3_TRIANGULATE_FACETS	
+  template<typename Kernel>
+  class Triangulation_handler {
+
+    typedef typename CGAL::Triangulation_vertex_base_2<Kernel>               Vb;
+    typedef typename CGAL::Constrained_triangulation_face_base_2<Kernel>     Fb;
+    typedef typename CGAL::Triangulation_data_structure_2<Vb,Fb>             TDS;
+    typedef typename CGAL::No_intersection_tag                               Itag;
+    typedef typename CGAL::Constrained_triangulation_2<Kernel,TDS,Itag>      CT;
+
+    typedef typename CT::Face_handle           Face_handle;
+    typedef typename CT::Finite_faces_iterator Finite_face_iterator;
+    typedef typename CT::Edge                  Edge;
+
+    CT ct;
+    CGAL::Unique_hash_map<Face_handle, bool> visited;
+    Finite_face_iterator fi;
+
+  public:
+    template<typename Halffacet_handle>
+    Triangulation_handler(Halffacet_handle f) : visited(false) {
+
+      Halffacet_cycle_iterator fci;
+      for(fci=f->facet_cycles_begin(); fci!=f->facet_cycles_end(); ++fci) {
+	if(fci.is_shalfedge()) {
+          SHalfedge_around_facet_circulator sfc(fci), send(sfc);
+	  CGAL_For_all(sfc,send) {
+            CGAL_NEF_TRACEN("  insert constraint" << sfc->source()->source()->point()
+	                     << "->" << sfc->source()->twin()->source()->point());
+	    ct.insert_constraint(sfc->source()->source()->point(),
+	                         sfc->source()->twin()->source()->point());
+          }
+        }
+      }
+      CGAL_assertion(ct.is_valid());
+
+      CGAL_NEF_TRACEN("number of finite triangles " << ct.number_of_faces());
+
+      typename CT::Face_handle infinite = ct.infinite_face();
+      typename CT::Vertex_handle ctv = infinite->vertex(1);
+      if(ct.is_infinite(ctv)) ctv = infinite->vertex(2);
+      CGAL_assertion(!ct.is_infinite(ctv));
+
+      typename CT::Face_handle opposite;
+      typename CT::Face_circulator vc(ctv,infinite);
+      do { opposite = vc++;
+      } while(!ct.is_constrained(CT::Edge(vc,vc->index(opposite))));
+      typename CT::Face_handle first = vc;
+
+      CGAL_assertion(!ct.is_infinite(first));
+      traverse_triangulation(first, first->index(opposite));
+
+      /*
+      for(fi = ct.finite_faces_begin(); fi != ct.finite_faces_end(); ++fi)
+        CGAL_NEF_TRACEN("  finite face " 
+	  << Triangle_3(fi->vertex(0)->point(), fi->vertex(1)->point(), fi->vertex(2)->point())
+	   << "was visited " << visited[fi]);
+      */
+
+      fi = ct.finite_faces_begin();
+    }
+
+    void traverse_triangulation(Face_handle f, int parent) {
+      visited[f] = true;
+      if(!ct.is_constrained(Edge(f,ct.cw(parent))) && !visited[f->neighbor(ct.cw(parent))]) {
+	Face_handle child(f->neighbor(ct.cw(parent)));
+	traverse_triangulation(child, child->index(f));
+      } 
+      if(!ct.is_constrained(Edge(f,ct.ccw(parent))) && !visited[f->neighbor(ct.ccw(parent))]) {
+	Face_handle child(f->neighbor(ct.ccw(parent)));
+	traverse_triangulation(child, child->index(f));
+      } 
+    } 
+ 
+    template<typename Triangle_3>
+    bool get_next_triangle(Triangle_3& tr) {
+      while(fi != ct.finite_faces_end() && visited[fi] == false) ++fi;
+      if(fi == ct.finite_faces_end()) return false;
+      tr = Triangle_3(fi->vertex(0)->point(), fi->vertex(1)->point(), fi->vertex(2)->point());
+      ++fi;
+      return true;
+    }
+  };
+#endif
+
+  virtual void initialize(SNC_structure* W) {
+#ifdef CGAL_NEF_LIST_OF_TRIANGLES
+    this->set_snc(*W);
+    candidate_provider = new SNC_candidate_provider(W);
+#else // CGAL_NEF_LIST_OF_TRIANGLES
+    CGAL_NEF_TIMER(ct_t.start());
+    std::strcpy( this->version_, "Point Locator by Spatial Subdivision (tm)");
+#ifdef CGAL_NEF3_TRIANGULATE_FACETS
+    CGAL_NEF_CLOG(version()<<" (with triangulated facets)");
+#else
+    CGAL_NEF_CLOG(version());
+#endif
+    CGAL_assertion( W != NULL);
+//    (Base) *this = SNC_decorator(*W);
+    this->set_snc(*W);
+    Object_list objects;
+    Vertex_iterator v;
+    Halfedge_iterator e;
+    Halffacet_iterator f;
+    CGAL_forall_vertices( v, *this->sncp())
+      objects.push_back(make_object(Vertex_handle(v)));
+    typename Object_list::difference_type v_end = objects.size();
+    CGAL_forall_edges( e, *this->sncp())
+      objects.push_back(make_object(Halfedge_handle(e)));
+    CGAL_forall_facets( f, *this->sncp()) {
+#ifdef CGAL_NEF3_TRIANGULATE_FACETS
+
+#ifndef CGAL_NEF3_TRIANGULATION_MINIMUM
+#define CGAL_NEF3_TRIANGULATION_MINIMUM 25
+#endif
+
+      Halffacet_cycle_iterator fci = f->facet_cycles_begin();
+      CGAL_assertion(fci.is_shalfedge());
+      SHalfedge_around_facet_circulator safc(fci), send(safc);
+      int length = 0;
+      int stop = CGAL_NEF3_TRIANGULATION_MINIMUM;
+      while(++length < stop && ++safc != send);
+      if(length >= stop) {
+
+	CGAL_NEF_TRACEN("triangulate facet " << f->plane());
+      
+	typedef typename CGAL::Projection_traits_xy_3<Kernel>       XY;
+	typedef typename CGAL::Projection_traits_yz_3<Kernel>       YZ;
+	typedef typename CGAL::Projection_traits_xz_3<Kernel>       XZ;
+	
+	Triangle_3 tr;
+	
+	Vector_3 orth = f->plane().orthogonal_vector();
+	int c = CGAL::abs(orth[0]) > CGAL::abs(orth[1]) ? 0 : 1;
+	c = CGAL::abs(orth[2]) > CGAL::abs(orth[c]) ? 2 : c;
+	
+	if(c == 0) {
+	  Triangulation_handler<YZ> th(f);
+	  while(th.get_next_triangle(tr)) {
+	    Halffacet_triangle_handle th( f, tr);
+	    objects.push_back(make_object(th));
+	    CGAL_NEF_TRACEN("add triangle " << tr);
+	  }
+	} else if(c == 1) {
+	  Triangulation_handler<XZ> th(f);
+	  while(th.get_next_triangle(tr)) {
+	    Halffacet_triangle_handle th( f, tr);
+	    objects.push_back(make_object(th));
+	    CGAL_NEF_TRACEN("add triangle " << tr);
+	  }
+	} else if(c == 2) {
+	  Triangulation_handler<XY> th(f);
+	  while(th.get_next_triangle(tr)) {
+	    Halffacet_triangle_handle th( f, tr);
+	    objects.push_back(make_object(th));
+	    CGAL_NEF_TRACEN("add triangle " << tr);
+	  }
+	} else
+	  CGAL_error_msg( "wrong value");
+      } else {
+        CGAL_NEF_TRACEN("add facet " << f->plane());
+        objects.push_back(make_object(Halffacet_handle(f)));
+      }
+#elif defined CGAL_NEF3_FACET_WITH_BOX
+#ifndef CGAL_NEF3_PARTITION_MINIMUM
+#define CGAL_NEF3_PARTITION_MINIMUM 6
+#endif
+      Halffacet_cycle_iterator fci = f->facet_cycles_begin();
+      CGAL_assertion(fci.is_shalfedge());
+      SHalfedge_around_facet_circulator safc(fci), send(safc);
+      int length = 0;
+      int stop = CGAL_NEF3_PARTITION_MINIMUM;
+      while(++length < stop && ++safc != send);
+      if(length >= stop) {
+	CGAL_NEF_TRACEN("use Partial facets ");
+	Partial_facet pf(f);
+	objects.push_back(make_object(pf));
+      } else {
+        objects.push_back(make_object(Halffacet_handle(f)));
+      }
+#else
+      objects.push_back(make_object(Halffacet_handle(f)));
+#endif
+    }
+    if(initialized)
+      delete candidate_provider;
+
+    Object_list_iterator oli=objects.begin()+v_end;
+    candidate_provider = new SNC_candidate_provider(objects,oli);
+
+    // CGAL_NEF_TRACEN(*candidate_provider);
+    CGAL_NEF_TIMER(ct_t.stop());
+#endif // CGAL_NEF_LIST_OF_TRIANGLES
+    initialized = true;
+  }
+
+  virtual Self* clone() const { 
+    return new Self; 
+  }
+
+  virtual void transform(const Aff_transformation_3& t) {
+    candidate_provider->transform(t);
+  }
+
+  virtual bool update( Unique_hash_map<Vertex_handle, bool>& V, 
+                       Unique_hash_map<Halfedge_handle, bool>& E, 
+                       Unique_hash_map<Halffacet_handle, bool>& F) {
+    CGAL_NEF_TIMER(ct_t.start());
+    CGAL_assertion( initialized);
+    bool updated = candidate_provider->update( V, E, F);
+    CGAL_NEF_TIMER(ct_t.stop());
+    return updated;
+  }
+
+  virtual ~SNC_point_locator_by_spatial_subdivision() {
+    CGAL_warning(initialized || 
+		 candidate_provider == 0); // required?
+    if(initialized)
+      delete candidate_provider;
+  }
+
+  /*
+  template <typename Box>
+  bool point_in_box(const Box& box, const Point_3& p) {
+    if(p.x() < box.min_coord(0)) return true;
+    if(p.x() > box.max_coord(0)) return true;
+    if(p.y() < box.min_coord(1)) return true;
+    if(p.y() > box.max_coord(1)) return true;
+    if(p.z() < box.min_coord(2)) return true;
+    if(p.z() > box.max_coord(2)) return true;
+    return false;
+  }
+
+  template <typename Box>
+  bool in_range(const Box& box) const {
+    Vertex_handle v;
+    Halfedge_handle e;
+    Halffacet_handle f;
+
+    Objects_around_box oab;
+    typename Objects_around_box::Iterator 
+      objects_iterator(oab.begin());
+    for( ; objects_iterator != oab.end(); ++objects_iterator) {
+      Object_list candidates = *objects_iterator;
+      Object_list_iterator o;
+      CGAL_for_each( o, candidates) {
+	if(CGAL::assign(v, *o)) {
+	  if(point_in_box(box, v->point()))
+	    return true;
+	} else if(CGAL::assign(e, *o)) {
+	  Point_3 ip;
+	  Point_3 pmin(box.min_coord(0), box.min_coord(1), box.min_coord(2));
+	  Point_3 pmax(box.max_coord(0), box.max_coord(1), box.max_coord(2));
+	  Segment_3 seg(e->source()->point(),
+			e->twin()->source()->point());
+
+	  Plane_3 pl(pmin, Vector_3(1,0,0));
+	  Object o = intersection(pl, seg);
+	  if(CGAL::assign(ip,o) && point_in_box(box, ip))
+	    return true;
+	  pl = Plane_3(pmin, Vector_3(0,1,0));
+	  o = intersection(pl, seg);
+	  if(CGAL::assign(ip,o) && point_in_box(box, ip))
+	    return true;
+	  pl = Plane_3(pmin, Vector_3(0,0,1));
+	  o = intersection(pl, seg);
+	  if(CGAL::assign(ip,o) && point_in_box(box, ip))
+	    return true;
+	  pl = Plane_3(pmax, Vector_3(1,0,0));
+	  o = intersection(pl, seg);
+	  if(CGAL::assign(ip,o) && point_in_box(box, ip))
+	    return true;
+	  pl = Plane_3(pmax, Vector_3(0,1,0));
+	  o = intersection(pl, seg);
+	  if(CGAL::assign(ip,o) && point_in_box(box, ip))
+	    return true;
+	  pl = Plane_3(pmax, Vector_3(0,0,1));
+	  o = intersection(pl, seg);
+	  if(CGAL::assign(ip,o) && point_in_box(box, ip))
+	    return true;
+	} else if(CGAL::assign(f, *o)) {
+	  Segment_3 seg(Point_3(box.min_coord(0), box.min_coord(1), box.min_coord(2)),
+			Point_3(box.min_coord(0), box.min_coord(1), box.max_coord(2)));
+	  if(is.does_intersect_internally(seg, f))
+	    return true;
+	  seg = Segment_3(Point_3(box.max_coord(0), box.min_coord(1), box.min_coord(2)),
+			  Point_3(box.max_coord(0), box.min_coord(1), box.max_coord(2)));
+	  if(is.does_intersect_internally(seg, f))
+	    return true;
+	  seg = Segment_3(Point_3(box.min_coord(0), box.max_coord(1), box.min_coord(2)),
+			  Point_3(box.min_coord(0), box.max_coord(1), box.max_coord(2)));
+	  if(is.does_intersect_internally(seg, f))
+	    return true;
+	  seg = Segment_3(Point_3(box.max_coord(0), box.max_coord(1), box.min_coord(2)),
+			  Point_3(box.max_coord(0), box.max_coord(1), box.max_coord(2)));
+	  if(is.does_intersect_internally(seg, f))
+	    return true;
+
+	  seg = Segment_3(Point_3(box.min_coord(0), box.min_coord(1), box.min_coord(2)),
+			  Point_3(box.min_coord(0), box.max_coord(1), box.min_coord(2)));
+	  if(is.does_intersect_internally(seg, f))
+	    return true;
+	  seg = Segment_3(Point_3(box.max_coord(0), box.min_coord(1), box.min_coord(2)),
+			  Point_3(box.max_coord(0), box.max_coord(1), box.min_coord(2)));
+	  if(is.does_intersect_internally(seg, f))
+	    return true;
+	  seg = Segment_3(Point_3(box.min_coord(0), box.min_coord(1), box.max_coord(2)),
+			  Point_3(box.min_coord(0), box.max_coord(1), box.max_coord(2)));
+	  if(is.does_intersect_internally(seg, f))
+	    return true;
+	  seg = Segment_3(Point_3(box.max_coord(0), box.min_coord(1), box.max_coord(2)),
+			  Point_3(box.max_coord(0), box.max_coord(1), box.max_coord(2)));
+	  if(is.does_intersect_internally(seg, f))
+	    return true;
+
+	  seg = Segment_3(Point_3(box.min_coord(0), box.min_coord(1), box.min_coord(2)),
+			  Point_3(box.max_coord(0), box.min_coord(1), box.min_coord(2)));
+	  if(is.does_intersect_internally(seg, f))
+	    return true;
+	  seg = Segment_3(Point_3(box.min_coord(0), box.max_coord(1), box.min_coord(2)),
+			  Point_3(box.max_coord(0), box.max_coord(1), box.min_coord(2)));
+	  if(is.does_intersect_internally(seg, f))
+	    return true;
+	  seg = Segment_3(Point_3(box.min_coord(0), box.min_coord(1), box.max_coord(2)),
+			  Point_3(box.max_coord(0), box.min_coord(1), box.max_coord(2)));
+	  if(is.does_intersect_internally(seg, f))
+	    return true;
+	  seg = Segment_3(Point_3(box.min_coord(0), box.max_coord(1), box.max_coord(2)),
+			  Point_3(box.max_coord(0), box.max_coord(1), box.max_coord(2)));
+	  if(is.does_intersect_internally(seg, f))
+	    return true;
+
+	} else
+	  CGAL_assertion_msg(false, "wrong handle");
+      }
+    }
+    return false;
+  }
+  */
+
+  virtual Object_handle shoot(const Ray_3& ray, int mask=255) const {
+    CGAL_NEF_TIMER(rs_t.start());
+    CGAL_assertion( initialized);
+    _CGAL_NEF_TRACEN( "shooting: "<<ray);
+    Object_handle result;
+    Vertex_handle v;
+    Halfedge_handle e;
+    Halffacet_handle f;
+#ifdef CGAL_NEF3_TRIANGULATE_FACETS
+    Halffacet_triangle_handle t;
+#endif
+#ifdef CGAL_NEF3_FACET_WITH_BOX
+    Partial_facet pf;
+#endif
+    bool hit = false;
+    Point_3 eor; // 'end of ray', the latest ray's hit point
+    Objects_along_ray objects = candidate_provider->objects_along_ray(ray);
+    Objects_along_ray_iterator objects_iterator = objects.begin();
+    while( !hit && objects_iterator != objects.end()) {
+      Object_list candidates = *objects_iterator;
+      Object_list_iterator o;
+      CGAL_for_each( o, candidates) {
+        if( CGAL::assign( v, *o) && ((mask&1) != 0)) {
+          _CGAL_NEF_TRACEN("trying vertex on "<<v->point());
+          if( ray.source() != v->point() && ray.has_on(v->point())) {
+            _CGAL_NEF_TRACEN("the ray intersects the vertex");
+            _CGAL_NEF_TRACEN("prev. intersection? "<<hit);
+            CGAL_assertion_code
+	      (if( hit)_CGAL_NEF_TRACEN("prev. intersection on "<<eor));
+            if( hit && !Segment_3( ray.source(), eor).has_on(v->point()))
+              continue;
+            eor = v->point();
+            result = make_object(v);
+            hit = true;
+            _CGAL_NEF_TRACEN("the vertex becomes the new hit object");
+          }
+        }
+        else if( CGAL::assign( e, *o) && ((mask&2) != 0)) {
+          Point_3 q;
+          _CGAL_NEF_TRACEN("trying edge on "<< Segment_3(e->source()->point(),e->twin()->source()->point()));
+          if( is.does_intersect_internally( ray, Segment_3(e->source()->point(),
+                                                           e->twin()->source()->point()), q)) {
+            _CGAL_NEF_TRACEN("ray intersects edge on "<<q);
+            _CGAL_NEF_TRACEN("prev. intersection? "<<hit);
+            CGAL_assertion_code
+	      (if( hit) _CGAL_NEF_TRACEN("prev. intersection on "<<eor));
+            if( hit && !has_smaller_distance_to_point( ray.source(), q, eor))
+              continue;
+            _CGAL_NEF_TRACEN("is the intersection point on the current cell? "<<
+                    candidate_provider->is_point_on_cell( q, objects_iterator));
+            if( !candidate_provider->is_point_on_cell( q, objects_iterator))
+                continue;
+            eor = q; 
+            result = make_object(e);
+            hit = true;
+            _CGAL_NEF_TRACEN("the edge becomes the new hit object");
+          }
+        }
+        else if( CGAL::assign( f, *o) && ((mask&4) != 0)) {
+          Point_3 q;
+          _CGAL_NEF_TRACEN("trying facet with on plane "<<f->plane()<<
+                  " with point on "<<f->plane().point());
+          if( is.does_intersect_internally( ray, f, q, true) ) {
+            _CGAL_NEF_TRACEN("ray intersects facet on "<<q);
+            _CGAL_NEF_TRACEN("prev. intersection? "<<hit);
+            if( hit) { _CGAL_NEF_TRACEN("prev. intersection on "<<eor); }
+            if( hit && !has_smaller_distance_to_point( ray.source(), q, eor))
+	      continue;
+            _CGAL_NEF_TRACEN("is the intersection point on the current cell? "<<
+                    candidate_provider->is_point_on_cell( q, objects_iterator));
+            if( !candidate_provider->is_point_on_cell( q, objects_iterator))
+	      continue;
+            eor = q;
+            result = make_object(f);
+            hit = true; 
+            _CGAL_NEF_TRACEN("the facet becomes the new hit object");
+          }
+        }
+#ifdef CGAL_NEF3_FACET_WITH_BOX
+	else if( CGAL::assign(pf, *o) && ((mask&4) != 0)) {
+	  CGAL_NEF_TRACEN("new ray shooting");
+          Point_3 q;
+          if( is.does_intersect_internally( ray, pf, q) ) {
+            if( hit && !has_smaller_distance_to_point( ray.source(), q, eor))
+	      continue;
+            if( !candidate_provider->is_point_on_cell( q, objects_iterator))
+	      continue;
+            eor = q;
+            result = make_object(pf.f);
+            hit = true; 
+          }
+	}
+#endif
+#ifdef CGAL_NEF3_TRIANGULATE_FACETS
+        else if( CGAL::assign( t, *o) && ((mask&8) != 0)) {
+          Point_3 q;
+          Triangle_3 tr = t.get_triangle();
+          _CGAL_NEF_TRACEN("trying triangle "<<tr);
+          if( is.does_intersect( ray, tr, q) && normalized(q) != ray.source()) {
+            _CGAL_NEF_TRACEN("ray intersect triangle on "<< normalized(q));
+            _CGAL_NEF_TRACEN("prev. intersection? "<<hit);
+            if( hit) _CGAL_NEF_TRACEN("prev. intersection on "<< normalized(eor));
+            if( hit && !has_smaller_distance_to_point( ray.source(), q, eor))
+              continue;
+            _CGAL_NEF_TRACEN("is the intersection point on the boundary of the facet? "<<
+                    is.does_contain_on_boundary( t, q));
+            if( is.does_contain_on_boundary( t, q))
+              continue;
+            _CGAL_NEF_TRACEN("is the intersection point on the current cell? "<<
+                    candidate_provider->is_point_on_cell(q,objects_iterator));
+            if( !candidate_provider->is_point_on_cell( q, objects_iterator))
+                continue;
+            eor = q;
+            result = make_object(Halffacet_handle(t));
+            hit = true; 
+            _CGAL_NEF_TRACEN("the facet becomes the new hit object");
+          }
+        }
+#endif
+        else if((mask&15) == 15)
+          CGAL_error_msg( "wrong handle");
+      }
+      if(!hit)
+        ++objects_iterator;
+    }
+    CGAL_NEF_TIMER(rs_t.stop());
+    return result;
+  }
+
+  virtual Object_handle locate( const Point_3& p) const {
+    if(Infi_box::extended_kernel()) {
+    CGAL_NEF_TIMER(pl_t.start());
+    CGAL_assertion( initialized);
+    _CGAL_NEF_TRACEN( "locate "<<p);
+    Object_handle result;
+    Vertex_handle v;
+    Halfedge_handle e;
+    Halffacet_handle f;
+#ifdef CGAL_NEF3_TRIANGULATE_FACETS
+    Halffacet_triangle_handle t;
+#endif
+#ifdef CGAL_NEF3_FACET_WITH_BOX
+    Partial_facet pf;
+#endif
+    Object_list candidates = candidate_provider->objects_around_point(p);
+    Object_list_iterator o = candidates.begin();
+    bool found = false;
+    while( !found && o != candidates.end()) {
+      if( CGAL::assign( v, *o)) {
+        if ( p == v->point()) {
+          _CGAL_NEF_TRACEN("found on vertex "<<v->point());
+          result = make_object(v);
+          found = true;
+        }
+      }
+      else if( CGAL::assign( e, *o)) {
+        if ( is.does_contain_internally(Segment_3(e->source()->point(),e->twin()->source()->point()), p) ) {
+          _CGAL_NEF_TRACEN("found on edge "<<Segment_3(e->source()->point(),e->twin()->source()->point()));
+          result = make_object(e);
+          found = true;
+        }
+      }
+      else if( CGAL::assign( f, *o)) {
+        if (is.does_contain_internally( f, p) ) {
+          _CGAL_NEF_TRACEN("found on facet...");
+          result = make_object(f);
+          found = true;
+        }
+      }
+#ifdef CGAL_NEF3_TRIANGULATE_FACETS
+      else if( CGAL::assign( t, *o)) {
+        Triangle_3 tr = t.get_triangle();
+        if( tr.has_on(p)) {
+          _CGAL_NEF_TRACEN("found on triangle "<<tr);
+	  if(is.does_contain_on_boundary( t, p)) {
+	    _CGAL_NEF_TRACEN("but located on the facet's boundary");
+	    continue;
+	  }
+          result = make_object(Halffacet_handle(t));
+	  found = true;
+        }
+      }
+#endif
+#ifdef CGAL_NEF3_FACET_WITH_BOX 
+      else if( CGAL::assign(pf, *o)) {
+	CGAL_NEF_TRACEN("new locate ");
+        if ( is.does_contain_internally( pf, p) ) {
+          _CGAL_NEF_TRACEN("found on partial facet...");
+          result = make_object(pf.f);
+          found = true;
+        }
+      }
+#endif
+      o++;
+    }
+    if( !found) {
+      _CGAL_NEF_TRACEN("point not found in 2-skeleton");
+      _CGAL_NEF_TRACEN("shooting ray to determine the volume");
+      Ray_3 r( p, Vector_3( -1, 0, 0));
+      result = make_object(determine_volume(r));
+    }    CGAL_NEF_TIMER(pl_t.start());
+    CGAL_NEF_TIMER(pl_t.stop());
+    return result;
+
+
+  } else {   // standard kernel
+
+
+    CGAL_assertion( initialized);
+    _CGAL_NEF_TRACEN( "locate "<<p);
+    typename SNC_structure::FT min_distance;
+    typename SNC_structure::FT tmp_distance;
+    Object_handle result;
+    Vertex_handle v;
+    Halfedge_handle e;
+    Halffacet_handle f;
+#ifdef CGAL_NEF3_TRIANGULATE_FACETS
+    Halffacet_triangle_handle t;
+#endif
+#ifdef CGAL_NEF3_FACET_WITH_BOX
+    Partial_facet pf;
+#endif
+    Object_list candidates = candidate_provider->objects_around_point(p);
+    Object_list_iterator o = candidates.begin();
+
+    if(candidates.empty())
+      return make_object(Base(*this).volumes_begin());
+
+    CGAL::assign(v,*o);
+    CGAL_assertion(CGAL::assign(v,*o));
+    if(p==v->point())
+      return make_object(v);
+
+    min_distance = CGAL::squared_distance(v->point(),p);
+    result = make_object(v);
+    ++o;
+    while(o!=candidates.end() && CGAL::assign(v,*o)) {
+      if ( p == v->point()) {
+        _CGAL_NEF_TRACEN("found on vertex "<<v->point());
+        return make_object(v);
+      }
+      tmp_distance = CGAL::squared_distance(v->point(),p);
+      if(tmp_distance < min_distance) {
+	result = make_object(v);
+        min_distance = tmp_distance;
+      }
+      ++o;
+    }     
+
+    CGAL::assign(v, result);
+    Segment_3 s(p,v->point());
+    // bool first = true;
+    Point_3 ip;
+
+    /*
+    // TODO: das geht effizienter
+    Object_list_iterator of(o);
+    while(of != candidates.end() && assign(e, *of)) ++of;
+    
+    typename SNC_structure::SHalfedge_iterator sei;
+    for(sei=v->shalfedges_begin(); sei!=v->shalfedges_end(); ++sei){      
+      if(sei->is_twin()) continue;
+      Halffacet_handle fout = sei->facet();
+      if(fout->is_twin()) fout = fout->twin();
+      Object_list_iterator ofc(of); 
+      for(;ofc!=candidates.end();++ofc) {
+	if(CGAL::assign(f,*ofc)) {
+	  if(f == fout->twin())
+	    std::cerr << "shit" << std::endl;
+	  if(f == fout) {
+	    Object_list_iterator oe(ofc);
+	    --ofc;
+	    candidates.erase(oe);
+	  }
+	}
+      }
+    }
+    */
+    for(;o!=candidates.end();++o) {
+      if( CGAL::assign( e, *o)) {
+	//	if(first && 
+	//	   (e->source() == v  || e->twin()->source() == v)) continue;
+	Segment_3 ss(e->source()->point(),e->twin()->source()->point());
+	CGAL_NEF_TRACEN("test edge " << e->source()->point() << "->" << e->twin()->source()->point());
+	  if(is.does_contain_internally(ss, p) ) {
+	_CGAL_NEF_TRACEN("found on edge "<< ss);
+          return make_object(e);
+        }
+	if(is.does_intersect_internally(s, ss, ip)) {
+	  // first = false;
+	  s = Segment_3(p, normalized(ip));
+	  result = make_object(e);
+        }
+
+      } else 
+      if( CGAL::assign( f, *o)) {
+	CGAL_NEF_TRACEN("test facet " << f->plane());
+        if (is.does_contain_internally(f,p) ) {
+          _CGAL_NEF_TRACEN("found on facet...");
+          return make_object(f);
+        }
+        if( is.does_intersect_internally(s,f,ip)) {
+          s = Segment_3(p, normalized(ip));
+	  result = make_object(f);
+        }
+#ifdef CGAL_NEF3_FACET_WITH_BOX
+      } else if( CGAL::assign(pf, *o)) {
+	CGAL_NEF_TRACEN("new locate ");
+	if ( is.does_contain_internally( pf, p) ) {
+	  _CGAL_NEF_TRACEN("found on partial facet...");
+	  return make_object(pf.f);
+	}
+        if( is.does_intersect_internally(s,pf,ip)) {	
+          s = Segment_3(p, normalized(ip));
+	  result = make_object(pf.f);
+        }
+#endif
+#ifdef CGAL_NEF3_TRIANGULATE_FACETS
+      } else if( CGAL::assign(t, *o)) {
+        CGAL_NEF_TRACEN("test triangle of facet " << t->plane());
+        Triangle_3 tr = t.get_triangle();
+        CGAL_NEF_TRACEN("trying triangle "<<tr);	
+	if(tr.has_on(p)) {
+	  f = t;
+	  return make_object(f);
+        }
+        if( is.does_intersect( s, tr, ip)) {
+	  CGAL_assertion(!is.does_contain_on_boundary( t, ip));
+          s = Segment_3(p, normalized(ip));
+	  result = make_object(t);
+        }
+#endif
+      } 
+      else CGAL_error_msg( "wrong handle type");
+    }
+
+    CGAL_warning("altered code in SNC_point_locator");
+    /*
+      Halffacet_iterator fc;
+      CGAL_forall_facets(fc, *this->sncp()) {
+	CGAL_assertion(!is.does_intersect_internally(s,f,ip));
+      }
+      
+      Halfedge_iterator ec;
+      CGAL_forall_edges(ec, *this->sncp()) {
+	Segment_3 ss(ec->source()->point(), ec->twin()->source()->point());
+	CGAL_assertion(!is.does_intersect_internally(s,ss,ip));
+      }
+
+      Vertex_iterator vc;
+      CGAL_forall_vertices(vc, *this->sncp()) {
+	std::cerr << "test vertex " << vc->point() << std::endl;
+	CGAL_assertion(vc->point() == s.target() || !s.has_on(vc->point()));
+      }
+    */
+
+    if( CGAL::assign( v, result)) {
+      _CGAL_NEF_TRACEN("vertex hit, obtaining volume..." << v->point());
+
+      CGAL_warning("altered code in SNC_point_locator");
+      SM_point_locator L(&*v);
+      //      Object_handle so = L.locate(s.source()-s.target(), true);
+      Object_handle so = L.locate(s.source()-s.target());
+      SFace_handle sf;
+      if(CGAL::assign(sf,so))
+        return make_object(sf->volume());
+      CGAL_error_msg( "wrong handle type");
+      return Object_handle();
+/*
+      SHalfedge_handle se;
+      CGAL_assertion(CGAL::assign(se,so));
+      CGAL_NEF_TRACEN("intersect segment " << s << " with edges");
+      for(;ox!=candidates.end();++ox) {
+	if(!CGAL::assign(e,*ox)) continue;
+	CGAL_NEF_TRACEN("test edge " << e->source()->point() << "->" << e->twin()->source()->point());
+	if(is.does_intersect_internally(s,Segment_3(e->source()->point(),e->twin()->source()->point()),ip)) {
+	  s = Segment_3(p, normalized(ip));
+	  result = make_object(e);
+        }
+      }
+      CGAL_assertion(CGAL::assign(e,result));
+      CGAL::assign(e,result);
+      f = get_visible_facet(e, Ray_3(p, s.target()));	
+      if( f != Halffacet_handle())
+	return f->incident_volume();
+      SM_decorator SD(&*v); // now, the vertex has no incident facets
+      CGAL_assertion( SD.number_of_sfaces() == 1);
+      return SD.sfaces_begin()->volume();      
+*/
+    } else if( CGAL::assign( f, result)) {
+      _CGAL_NEF_TRACEN("facet hit, obtaining volume...");
+      if(f->plane().oriented_side(p) == ON_NEGATIVE_SIDE)
+	f = f->twin();
+      return make_object(f->incident_volume());
+#ifdef CGAL_NEF3_FACET_WITH_BOX
+    } else if( CGAL::assign(pf, *o)) {
+      CGAL_error_msg( "should not be executed");
+      Halffacet_handle f = pf.f;
+      if(f->plane().oriented_side(p) == ON_NEGATIVE_SIDE)
+	f = f->twin();
+      return make_object(f->incident_volume()); 
+#endif
+#ifdef CGAL_NEF3_TRIANGULATE_FACETS
+    } else if( CGAL::assign(t, result)) {
+      f = t;
+      _CGAL_NEF_TRACEN("facet hit, obtaining volume...");
+      if(f->plane().oriented_side(p) == ON_NEGATIVE_SIDE)
+	f = f->twin();
+      return make_object(f->incident_volume());
+#endif
+    } else if( CGAL::assign(e, result)) {
+      SM_decorator SD(&*e->source());
+      if( SD.is_isolated(e))
+        return make_object(e->incident_sface()->volume());	
+      return make_object(get_visible_facet(e,Ray_3(s.source(),s.to_vector()))->incident_volume());
+    }
+    CGAL_error_msg( "wrong handle type");
+    return Object_handle();
+  }
+  }
+
+  virtual void intersect_with_edges_and_facets( Halfedge_handle e0,
+	const typename SNC_point_locator::Intersection_call_back& call_back) const {
+
+    CGAL_NEF_TIMER(it_t.start());
+    CGAL_assertion( initialized);
+    _CGAL_NEF_TRACEN( "intersecting edge: "<<&*e0<<' '<<Segment_3(e0->source()->point(),
+                                                         e0->twin()->source()->point()));
+
+#ifdef CGAL_NEF3_TRIANGULATE_FACETS
+    Unique_hash_map< Halffacet_triangle_handle, bool> f_mark(false);
+#endif // CGAL_NEF3_TRIANGULATE_FACETS
+
+    Segment_3 s(Segment_3(e0->source()->point(),e0->twin()->source()->point()));
+    Vertex_handle v;
+    Halfedge_handle e;
+    Halffacet_handle f;
+#ifdef CGAL_NEF3_TRIANGULATE_FACETS
+    Halffacet_triangle_handle t;
+#endif
+#ifdef CGAL_NEF3_FACET_WITH_BOX
+    Partial_facet pf;
+#endif
+    Object_list_iterator o;
+    Object_list objects = candidate_provider->objects_around_segment(s);
+    CGAL_for_each( o, objects) {
+      if( CGAL::assign( v, *o)) {
+        /* do nothing */
+      }
+      else if( CGAL::assign( e, *o)) {
+
+#ifdef CGAL_NEF3_DUMP_STATISTICS
+      ++number_of_intersection_candidates;
+#endif
+
+        Point_3 q;
+        if( is.does_intersect_internally( s, Segment_3(e->source()->point(),
+	                                               e->twin()->source()->point()), q)) {
+          q = normalized(q);
+          call_back( e0, make_object(Halfedge_handle(e)), q);
+          _CGAL_NEF_TRACEN("edge intersects edge "<<' '<<&*e<< Segment_3(e->source()->point(),
+                                                                e->twin()->source()->point())<<" on "<<q);
+        }
+      }
+      else if( CGAL::assign( f, *o)) {
+#ifdef CGAL_NEF3_DUMP_STATISTICS
+      ++number_of_intersection_candidates;
+#endif
+
+        Point_3 q;
+        if( is.does_intersect_internally( s, f, q) ) {
+          q = normalized(q);
+          call_back( e0, make_object(Halffacet_handle(f)), q);
+          _CGAL_NEF_TRACEN("edge intersects facet on plane "<<f->plane()<<" on "<<q);
+        }
+      }
+#ifdef CGAL_NEF3_FACET_WITH_BOX
+	else if( CGAL::assign(pf, *o)) {
+	  CGAL_error_msg( "not implemented yet");
+	}
+#endif
+#ifdef CGAL_NEF3_TRIANGULATE_FACETS
+      else if( CGAL::assign( t, *o)) {
+        Point_3 q;
+        Triangle_3 tr = t.get_triangle();
+
+	if( f_mark[t])
+	  continue;
+	_CGAL_NEF_TRACEN("trying with triangle "<<tr);
+        if( is.does_intersect( s, tr, q) &&
+            !is.does_contain_on_boundary( t, q)) {
+          q = normalized(q);
+          call_back( e0, make_object(Halffacet_handle(t)), q);
+          _CGAL_NEF_TRACEN("edge intersects facet triangle on plane "<<t->plane()<<" on "<<q);
+	  f_mark[t] = true;
+        }
+      }
+#endif // CGAL_NEF3_TRIANGULATE_FACETS
+      else
+        CGAL_error_msg( "wrong handle");
+    }
+    CGAL_NEF_TIMER(it_t.stop());
+  }
+
+  virtual void intersect_with_edges( Halfedge_handle e0,
+    const typename SNC_point_locator::Intersection_call_back& call_back) const {
+    CGAL_NEF_TIMER(it_t.start());
+    CGAL_assertion( initialized);
+    _CGAL_NEF_TRACEN( "intersecting edge: "<<&*e0<<' '<<Segment_3(e0->source()->point(),
+                                                         e0->twin()->source()->point()));
+    Segment_3 s(Segment_3(e0->source()->point(),e0->twin()->source()->point()));
+    Vertex_handle v;
+    Halfedge_handle e;
+    Halffacet_handle f;
+#ifdef CGAL_NEF3_TRIANGULATE_FACETS
+    Halffacet_triangle_handle t;
+#endif
+#ifdef CGAL_NEF3_FACET_WITH_BOX
+    Partial_facet pf;
+#endif
+    Object_list_iterator o;
+    Object_list objects = candidate_provider->objects_around_segment(s);
+    CGAL_for_each( o, objects) {
+      if( CGAL::assign( v, *o)) {
+        /* do nothing */
+      }
+      else if( CGAL::assign( e, *o)) {
+
+#ifdef CGAL_NEF3_DUMP_STATISTICS
+      ++number_of_intersection_candidates;
+#endif
+
+        Point_3 q;
+        if( is.does_intersect_internally( s, Segment_3(e->source()->point(),
+	                                               e->twin()->source()->point()), q)) {
+          q = normalized(q);
+          call_back( e0, make_object(Halfedge_handle(e)), q);
+          _CGAL_NEF_TRACEN("edge intersects edge "<<' '<<&*e<< Segment_3(e->source()->point(),
+                                                                e->twin()->source()->point())<<" on "<<q);
+        }
+      }
+      else if( CGAL::assign( f, *o)) {
+        /* do nothing */
+      }
+#ifdef CGAL_NEF3_FACET_WITH_BOX
+	else if( CGAL::assign(pf, *o)) {
+	  CGAL_error_msg( "not implemented yet");
+	}
+#endif
+#ifdef CGAL_NEF3_TRIANGULATE_FACETS
+      else if( CGAL::assign( t, *o)) {
+        /* do nothing */
+      }
+#endif
+      else
+        CGAL_error_msg( "wrong handle");
+    }
+    CGAL_NEF_TIMER(it_t.stop());
+  }
+
+  virtual void intersect_with_facets( Halfedge_handle e0, 
+    const typename SNC_point_locator::Intersection_call_back& call_back) const {
+    CGAL_NEF_TIMER(it_t.start());
+    CGAL_assertion( initialized);
+    _CGAL_NEF_TRACEN( "intersecting edge: "<< Segment_3(e0->source()->point(),
+                                               e0->twin()->source()->point()));
+#ifdef CGAL_NEF3_TRIANGULATE_FACETS
+    Unique_hash_map< Halffacet_triangle_handle, bool> f_mark(false);
+#endif // CGAL_NEF3_TRIANGULATE_FACETS
+    Segment_3 s(Segment_3(e0->source()->point(),e0->twin()->source()->point()));
+    Vertex_handle v;
+    Halfedge_handle e;
+    Halffacet_handle f;
+#ifdef CGAL_NEF3_FACET_WITH_BOX
+    Partial_facet pf;
+#endif
+#ifdef CGAL_NEF3_TRIANGULATE_FACETS
+    Halffacet_triangle_handle t;
+#endif
+    Object_list_iterator o;
+    Object_list objects = candidate_provider->objects_around_segment(s);
+    CGAL_for_each( o, objects) {
+      if( CGAL::assign( v, *o)) {
+        /* do nothing */
+      }
+      else if( CGAL::assign( e, *o)) {
+        /* do nothing */
+      }
+      else if( CGAL::assign( f, *o)) {
+
+#ifdef CGAL_NEF3_DUMP_STATISTICS
+      ++number_of_intersection_candidates;
+#endif
+
+        Point_3 q;
+        if( is.does_intersect_internally( s, f, q) ) {
+          q = normalized(q);
+          call_back( e0, make_object(Halffacet_handle(f)), q);
+          _CGAL_NEF_TRACEN("edge intersects facet on plane "<<f->plane()<<" on "<<q);
+        }
+      }
+#ifdef CGAL_NEF3_FACET_WITH_BOX
+      else if( CGAL::assign(pf, *o)) {
+	CGAL_error_msg( "not implemented yet");
+      }
+#endif
+#ifdef CGAL_NEF3_TRIANGULATE_FACETS
+      else if( CGAL::assign( t, *o)) {
+        Point_3 q;
+        Triangle_3 tr = t.get_triangle();
+	if( f_mark[t])
+	  continue;
+	_CGAL_NEF_TRACEN("trying with triangle "<<tr);
+        if( is.does_intersect( s, tr, q) &&
+            !is.does_contain_on_boundary( t, q)) {
+          q = normalized(q);
+          call_back( e0, make_object(Halffacet_handle(t)), q);
+          _CGAL_NEF_TRACEN("edge intersects facet triangle on plane "<<t->plane()<<" on "<<q);
+	  f_mark[t] = true;
+        }
+      }
+#endif // CGAL_NEF3_TRIANGULATE_FACETS
+      else
+        CGAL_error_msg( "wrong handle");
+    }
+    CGAL_NEF_TIMER(it_t.stop());
+  }
+
+private:
+  Volume_handle determine_volume( const Ray_3& ray) const {
+    Halffacet_handle f_below;
+    Object_handle o = shoot(ray);
+    Vertex_handle v;
+    Halfedge_handle e;
+    Halffacet_handle f;
+    if( CGAL::assign( v, o)) {
+      _CGAL_NEF_TRACEN("vertex hit, obtaining volume...");
+      f_below = get_visible_facet( v, ray);
+      if( f_below != Halffacet_handle())
+        return f_below->incident_volume();
+      SM_decorator SD(&*v); // now, the vertex has no incident facets
+      CGAL_assertion( SD.number_of_sfaces() == 1);
+      return SD.sfaces_begin()->volume();
+    }
+    else if( CGAL::assign( e, o)) {
+      _CGAL_NEF_TRACEN("edge hit, obtaining volume...");
+      f_below = get_visible_facet( e, ray);
+      if( f_below != Halffacet_handle())
+        return f_below->incident_volume();
+      CGAL_assertion_code(SM_decorator SD(&*e->source())); // now, the edge has no incident facets
+      CGAL_assertion(SD.is_isolated(e));
+      return e->incident_sface()->volume();
+    }
+    else if( CGAL::assign( f, o)) {
+      _CGAL_NEF_TRACEN("facet hit, obtaining volume...");
+      f_below = get_visible_facet(f, ray);
+      CGAL_assertion( f_below != Halffacet_handle());
+      return f_below->incident_volume();
+    }
+    return Base(*this).volumes_begin(); // TODO: Comment this hack!
+  }
+
+public:
+  void add_facet(Halffacet_handle f) {
+    candidate_provider->add_facet(f);
+  }
+
+  void add_edge(Halfedge_handle e) {
+    candidate_provider->add_edge(e);	
+  }
+
+  void add_vertex(Vertex_handle v) {
+    candidate_provider->add_vertex(v);
+  }
+
+private:
+  bool initialized;
+  SNC_candidate_provider* candidate_provider;
+  SNC_intersection is;
+#ifdef CGAL_NEF3_TRIANGULATE_FACETS
+  std::list<Halffacet_triangle_handle> triangulation;
+#endif
+};
+
+#ifdef CGAL_NEF3_POINT_LOCATOR_NAIVE
+template <typename SNC_decorator>
+class SNC_point_locator_naive : 
+  public SNC_ray_shooter<SNC_decorator>, 
+  public SNC_point_locator<SNC_decorator>
+{
+  typedef typename SNC_decorator::SNC_structure SNC_structure;
+  typedef SNC_ray_shooter<SNC_decorator> Base;
+  typedef SNC_point_locator_naive<SNC_decorator> Self;
+  typedef SNC_point_locator<SNC_decorator> SNC_point_locator;
+  typedef CGAL::SNC_intersection<SNC_structure> SNC_intersection;
+  typedef typename SNC_decorator::Decorator_traits Decorator_traits;
+  typedef typename Decorator_traits::SM_decorator SM_decorator;
+
+public:
+  typedef typename SNC_decorator::Object_handle Object_handle;
+  typedef typename SNC_decorator::Point_3 Point_3;
+  typedef typename SNC_decorator::Segment_3 Segment_3;
+  typedef typename SNC_decorator::Ray_3 Ray_3;
+  typedef typename SNC_structure::Aff_transformation_3 
+                                  Aff_transformation_3;
+
+  typedef typename Decorator_traits::Vertex_handle Vertex_handle;
+  typedef typename Decorator_traits::Halfedge_handle Halfedge_handle;
+  typedef typename Decorator_traits::Halffacet_handle Halffacet_handle;
+  typedef typename Decorator_traits::Volume_handle Volume_handle;
+  typedef typename Decorator_traits::Vertex_iterator Vertex_iterator;
+  typedef typename Decorator_traits::Halfedge_iterator Halfedge_iterator;
+  typedef typename Decorator_traits::Halffacet_iterator Halffacet_iterator;
+
+public:
+  SNC_point_locator_naive() : initialized(false) {}
+  virtual void initialize(SNC_structure* W) { 
+    CGAL_NEF_TIMER(ct_t.start());
+    std::strcpy(this->version_, "Naive Point Locator (tm)");
+    CGAL_NEF_CLOG(version());
+    CGAL_assertion( W != NULL);
+    Base::initialize(W); 
+    initialized = true;
+    CGAL_NEF_TIMER(ct_t.stop());
+  }
+
+  virtual Self* clone() const { 
+    return new Self; 
+  }
+
+  virtual bool update( Unique_hash_map<Vertex_handle, bool>& V, 
+                       Unique_hash_map<Halfedge_handle, bool>& E, 
+                       Unique_hash_map<Halffacet_handle, bool>& F) {
+    CGAL_NEF_TIMER(ct_t.start());
+    CGAL_assertion( initialized);
+    CGAL_NEF_TIMER(ct_t.stop());
+    return false;
+  }
+
+  virtual ~SNC_point_locator_naive() {}
+
+  virtual Object_handle locate(const Point_3& p) const {
+    CGAL_NEF_TIMER(pl_t.start());
+    CGAL_assertion( initialized);
+    CGAL_NEF_TIMER(pl_t.stop());
+    return Base::locate(p);
+  }
+
+  virtual Object_handle shoot(const Ray_3& r, int mask=0) const {
+    CGAL_NEF_TIMER(rs_t.start());
+    CGAL_assertion( initialized);
+    CGAL_NEF_TIMER(rs_t.stop());
+    return Base::shoot(r);
+  }
+
+  virtual void transform(const Aff_transformation_3& aff) {}
+
+  virtual void intersect_with_edges_and_facets(Halfedge_handle e0,
+    const typename SNC_point_locator::Intersection_call_back& call_back) const {
+	intersect_with_edges(e0,call_back);
+	intersect_with_facets(e0,call_back);
+  }
+
+  virtual void intersect_with_edges( Halfedge_handle e0, 
+    const typename SNC_point_locator::Intersection_call_back& call_back) const {
+    CGAL_NEF_TIMER(it_t.start());
+    CGAL_assertion( initialized);
+    CGAL_NEF_TRACEN( "intersecting edge: "<< Segment_3(e0->source()->point(),
+                                              e0->twin()->source()->point()));
+    SNC_intersection is(*this->sncp());
+    Segment_3 s(Segment_3(e0->source()->point(),e0->twin()->source()->point()));
+    Halfedge_iterator e;
+    CGAL_forall_edges( e, *this->sncp()) {
+
+#ifdef CGAL_NEF3_DUMP_STATISTICS
+      ++number_of_intersection_candidates;
+#endif
+
+      Point_3 q;
+      if( is.does_intersect_internally( s, Segment_3(e->source()->point(),
+                                                     e->twin()->source()->point()), q)) {
+        q = normalized(q);
+        CGAL_NEF_TRACEN("edge intersects edge "<< Segment_3(e->source()->point(),
+                                                   e->twin()->source()->point()) <<" on "<<q);
+        call_back( e0, make_object(e), q);
+      }
+    }
+    CGAL_NEF_TIMER(it_t.stop());
+  }
+
+  virtual void intersect_with_facets( Halfedge_handle e0, 
+    const typename SNC_point_locator::Intersection_call_back& call_back) const {
+    CGAL_NEF_TIMER(it_t.start());
+    CGAL_assertion( initialized);
+    CGAL_NEF_TRACEN( "intersecting edge: "<< Segment_3(e0->source()->point(),
+                                              e0->twin()->source()->point()));
+    SNC_intersection is(*this->sncp());
+    Segment_3 s(Segment_3(e0->source()->point(),
+                          e0->twin()->source()->point()));
+    Halffacet_iterator f;
+    CGAL_forall_facets( f, *this->sncp()) {
+
+#ifdef CGAL_NEF3_DUMP_STATISTICS
+      ++number_of_intersection_candidates;
+#endif
+
+      Point_3 q;
+      if( is.does_intersect_internally( s, f, q) ) {
+        q = normalized(q);
+        CGAL_NEF_TRACEN("edge intersects facet on plane "<<f->plane()<<" on "<<q);
+        call_back( e0, make_object(f), q);
+      }
+    }
+    CGAL_NEF_TIMER(it_t.stop());
+  }
+
+private:
+  bool initialized;
+};
+#endif
+
+} //namespace CGAL
+#endif // CGAL_NEF_SNC_POINT_LOCATOR_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_simplify.h b/3rdparty/CGAL/include/CGAL/Nef_3/SNC_simplify.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_simplify.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/SNC_simplify.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_sphere_map.h b/3rdparty/CGAL/include/CGAL/Nef_3/SNC_sphere_map.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_sphere_map.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/SNC_sphere_map.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_structure.h b/3rdparty/CGAL/include/CGAL/Nef_3/SNC_structure.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/SNC_structure.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/SNC_structure.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/Vertex.h b/3rdparty/CGAL/include/CGAL/Nef_3/Vertex.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/Vertex.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/Vertex.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/Volume.h b/3rdparty/CGAL/include/CGAL/Nef_3/Volume.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/Volume.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/Volume.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/binop_intersection_tests.h b/3rdparty/CGAL/include/CGAL/Nef_3/binop_intersection_tests.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/binop_intersection_tests.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/binop_intersection_tests.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/bounded_side_3.h b/3rdparty/CGAL/include/CGAL/Nef_3/bounded_side_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/bounded_side_3.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/bounded_side_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/polyhedron_3_to_nef_3.h b/3rdparty/CGAL/include/CGAL/Nef_3/polyhedron_3_to_nef_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/polyhedron_3_to_nef_3.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/polyhedron_3_to_nef_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/quotient_coordinates_to_homogeneous_point.h b/3rdparty/CGAL/include/CGAL/Nef_3/quotient_coordinates_to_homogeneous_point.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/quotient_coordinates_to_homogeneous_point.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/quotient_coordinates_to_homogeneous_point.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/shell_to_nef_3.h b/3rdparty/CGAL/include/CGAL/Nef_3/shell_to_nef_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/shell_to_nef_3.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/shell_to_nef_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_3/vertex_cycle_to_nef_3.h b/3rdparty/CGAL/include/CGAL/Nef_3/vertex_cycle_to_nef_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_3/vertex_cycle_to_nef_3.h
rename to 3rdparty/CGAL/include/CGAL/Nef_3/vertex_cycle_to_nef_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_S2/Generic_handle_map.h b/3rdparty/CGAL/include/CGAL/Nef_S2/Generic_handle_map.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_S2/Generic_handle_map.h
rename to 3rdparty/CGAL/include/CGAL/Nef_S2/Generic_handle_map.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_S2/Normalizing.h b/3rdparty/CGAL/include/CGAL/Nef_S2/Normalizing.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_S2/Normalizing.h
rename to 3rdparty/CGAL/include/CGAL/Nef_S2/Normalizing.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_S2/OGL_base_object.h b/3rdparty/CGAL/include/CGAL/Nef_S2/OGL_base_object.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_S2/OGL_base_object.h
rename to 3rdparty/CGAL/include/CGAL/Nef_S2/OGL_base_object.h
diff --git a/3rdparty/CGAL/include/CGAL/Nef_S2/SM_checker.h b/3rdparty/CGAL/include/CGAL/Nef_S2/SM_checker.h
new file mode 100644
index 0000000..148a4c2
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Nef_S2/SM_checker.h
@@ -0,0 +1,257 @@
+// Copyright (c) 1997-2002  Max-Planck-Institute Saarbruecken (Germany).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Michael Seel  <seel at mpi-sb.mpg.de>
+
+#ifndef CGAL_SM_CHECKER_H
+#define CGAL_SM_CHECKER_H
+
+#include <CGAL/basic.h>
+#include <CGAL/Nef_S2/SM_const_decorator.h>
+
+#define CGAL_USING(t) typedef typename Base::t t
+namespace CGAL {
+
+/*{\Moptions outfile=SM_checker.man }*/
+/*{\Manpage {SM_checker}{PMCDEC,GEOM}{Plane map checking}{}}*/
+
+/*{\Mdefinition An instance |\Mvar| of the data type |\Mname| is a
+decorator to check the structure of a plane map. It is generic with
+respect to two template concepts.  |PMCDEC| has to be a decorator
+model of our |SM_const_decorator| concept. |GEOM| has to be a model of
+our geometry kernel concept.}*/
+
+/*{\Mgeneralization SM_const_decorator}*/
+
+template <typename PMCDEC, typename GEOM> 
+class SM_checker : public PMCDEC
+{ typedef PMCDEC Base;
+  const GEOM& K;
+public:
+/*{\Mtypes 3}*/
+typedef PMCDEC  SM_const_decorator;
+/*{\Mtypemember equals |PMCDEC|. Add link to PMCDEC concept.}*/
+typedef typename PMCDEC::Plane_map Plane_map;
+/*{\Mtypemember equals |PMCDEC::Plane_map|, the underlying plane map type.}*/
+typedef GEOM Geometry;
+/*{\Mtypemember equals |GEOM|. Add link to GEOM concept.\\
+\precond |Geometry::Point_2| equals |Plane_map::Point|. }*/
+
+typedef typename GEOM::Point_2     Point;
+typedef typename GEOM::Direction_2 Direction;
+
+CGAL_USING(Vertex_const_handle);
+CGAL_USING(SEdge_handle);
+CGAL_USING(Vertex_const_iterator);
+CGAL_USING(Halfedge_const_iterator);
+CGAL_USING(Halfedge_around_vertex_const_circulator);
+CGAL_USING(Halfedge_around_face_const_circulator);
+/*{\Mtext Iterators, handles, and circulators are inherited from 
+|SM_const_decorator|.}*/
+
+/*{\Mcreation 3}*/
+SM_checker(Plane_map& P, const Geometry& k = Geometry()) : 
+  Base(P), K(k) {}
+/*{\Mcreate constructs a plane map checker working on |P| with
+geometric predicates used from |k|.}*/
+
+SM_checker(const Base& D, const Geometry& k = Geometry()) : 
+  Base(D), K(k) {}
+
+
+/*{\Moperations 2 }*/
+Direction direction(Halfedge_const_handle e) const
+{ return K.construct_direction(
+    point(source(e)),point(target(e))); }
+
+bool is_forward(Halfedge_const_handle e) const
+{ return K.compare_xy(point(source(e)),point(target(e)))<0; }
+
+void check_order_preserving_embedding(Vertex_const_handle v) const;
+/*{\Mop checks if the embedding of the targets of the edges in
+the adjacency list |A(v)| is counter-clockwise order-preserving with 
+respect to the order of the edges in |A(v)|.}*/
+
+void check_order_preserving_embedding() const;
+/*{\Mop checks if the embedding of all vertices of |P| is 
+counter-clockwise order-preserving with respect to the adjacency
+list ordering of all vertices.}*/
+
+void check_forward_prefix_condition(Vertex_const_handle v) const;
+/*{\Mop checks the forward prefix property of the adjacency
+list of |v|.}*/
+
+Halfedge_const_iterator
+check_boundary_is_clockwise_weakly_polygon() const;
+/*{\Mop checks if the outer face cycle of |P| is a clockwise weakly polygon and
+returns a halfedge on the boundary. \precond |P| is a connected graph.
+}*/
+
+void check_is_triangulation() const;
+/*{\Mop checks if |P| is a triangulation.}*/
+
+}; // SM_checker<PMCDEC,GEOM>
+
+
+template <typename PMCDEC, typename GEOM>
+void SM_checker<PMCDEC,GEOM>::
+check_order_preserving_embedding(Vertex_const_handle v) const
+{
+  std::ostrstream error_status;
+  CGAL::set_pretty_mode ( error_status );
+  Halfedge_const_handle ef = first_out_edge(v) ,e=ef,en,enn;
+  error_status << "check_order_preserving_embedding\n";
+  error_status << "vertex " << PV(v) << endl;
+  if ( e != Halfedge_const_handle() ) {
+    while ( true ) {
+      en = cyclic_adj_succ(e);
+      enn = cyclic_adj_succ(en);
+      if (en == ef) break;
+      error_status << "  -> " << point(target(e));
+      error_status << " " << point(target(en)) << " ";
+      error_status << " " << point(target(enn)) << endl;
+      if ( !K.strictly_ordered_ccw(direction(e),direction(en),
+                                   direction(enn)) ||
+           !K.strictly_ordered_ccw(direction(e),direction(en),
+                                   direction(ef)) ) {
+        error_status << "ccw order violate!" << endl << '\0';
+        CGAL_error_msg(error_status.str());
+      }
+      e = en;
+    }
+  }
+  error_status.freeze(0);  
+}
+
+template <typename PMCDEC, typename GEOM>
+void SM_checker<PMCDEC,GEOM>::
+check_forward_prefix_condition(Vertex_const_handle v) const
+{ Halfedge_const_handle ef = first_out_edge(v);
+  if ( ef == Halfedge_const_handle() ) return;
+  Halfedge_const_handle el = cyclic_adj_pred(ef);
+  bool is_left_turn = K.left_turn(point(v),
+                                point(target(ef)),
+                                point(target(el)));
+  bool el_forward = is_forward(el);
+  bool ef_forward = is_forward(ef);
+  CGAL_assertion_msg( (ef == el ||
+                       ef_forward && !el_forward ||
+                       ef_forward &&  el_forward && is_left_turn ||
+                       !ef_forward && !el_forward && is_left_turn) ,
+  "check_forward_prefix_condition: first backward, last forward\n");
+}
+
+template <typename PMCDEC, typename GEOM>
+void SM_checker<PMCDEC,GEOM>::
+check_order_preserving_embedding() const
+{
+  Vertex_const_iterator vit;
+  for (vit = vertices_begin(); vit != vertices_end(); ++vit) {
+    check_order_preserving_embedding(vit);
+    check_forward_prefix_condition(vit);
+  }
+}
+
+
+template <typename PMCDEC, typename GEOM>
+typename SM_checker<PMCDEC,GEOM>::Halfedge_const_iterator
+SM_checker<PMCDEC,GEOM>::
+check_boundary_is_clockwise_weakly_polygon() const
+{
+  Vertex_const_iterator vit, v_min;
+  for (vit = v_min = vertices_begin() ; vit != vertices_end(); ++vit) 
+    if ( K.compare_xy(point(vit), point(v_min))<0 ) v_min = vit;
+  CGAL_assertion_msg(!is_isolated(v_min),"Minimal vertex not connected.");
+  Sphere_point p_min = point(v_min);
+
+  // determine boundary edge incident to v_min: 
+  Halfedge_const_handle e_boundary_at_v_min = first_out_edge(v_min);
+  // all out edges are forward oriented due to minimality
+  Halfedge_around_vertex_const_circulator 
+    hvit(e_boundary_at_v_min), hend(hvit);
+  do {
+    --hvit;
+    Sphere_point p1 = point(target(e_boundary_at_v_min));
+    Sphere_point p2 = point(target(hvit));
+    if ( K.orientation(p_min,p1,p2) > 0 ) { // left_turn
+      e_boundary_at_v_min = hvit;
+      break;
+    }
+  } while (hvit != hend);
+  // now e_boundary_at_v_min is highest starting edge in bundle!!
+
+  int winding_around_globally=0;
+  Halfedge_around_face_const_circulator
+    hfit(e_boundary_at_v_min),hstart(hfit);
+  Halfedge_const_handle e_prev = next(e_boundary_at_v_min);
+  /* we run counterclockwise around the outer face cycle and allow only
+     position where the direction vector of an edge gets smaller again */
+  Direction d_prev = direction(e_prev);
+  CGAL_For_all_backwards(hstart,hfit) {
+    Direction d_curr = direction(hfit);
+    if ( d_curr < d_prev ) ++winding_around_globally;
+    d_prev = d_curr;
+  }
+  CGAL_assertion(winding_around_globally == 1);
+  return e_boundary_at_v_min;
+}
+
+template <typename PMCDEC, typename GEOM>
+void SM_checker<PMCDEC,GEOM>::
+check_is_triangulation() const
+{
+  Halfedge_const_iterator eb;
+  check_integrity_and_topological_planarity(false);
+  CGAL_assertion(number_of_connected_components() == 1);
+  check_order_preserving_embedding();
+  eb = check_boundary_is_clockwise_weakly_polygon();
+
+  CGAL::Hash_map< Halfedge_const_iterator, bool> on_boundary(false);
+  Halfedge_around_face_const_circulator hit(eb), hend(hit);
+  std::ostrstream error_status;
+  CGAL::set_pretty_mode ( error_status );
+  error_status << "check_is_triangulation\n";
+  error_status << "on boundary:\n";
+  CGAL_For_all(hit,hend) {
+    error_status << "  " << PE(hit) << endl;
+    on_boundary[hit]=true;
+  }
+  Halfedge_const_iterator eit;
+  for( eit = halfedges_begin(); eit != halfedges_end(); ++eit) {
+    if (on_boundary[eit]) continue;
+    hit = hend = eit; 
+    int edges_in_face_cycle=0;
+    CGAL_For_all(hit,hend) {
+      error_status << PE(hit);
+      ++edges_in_face_cycle;
+    }
+    CGAL_assertion_msg(edges_in_face_cycle==3,error_status.str());
+  }
+  error_status.freeze(0);
+}
+
+
+/*\subsection{Plane map input and output}
+The input and output is mainly triggered by an IO Decorator which
+has the control over the IO format and does some basic parsing when
+reading input.*/
+
+} //namespace CGAL
+
+#undef CGAL_USING
+#endif // CGAL_SM_CHECKER_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_S2/SM_const_decorator.h b/3rdparty/CGAL/include/CGAL/Nef_S2/SM_const_decorator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_S2/SM_const_decorator.h
rename to 3rdparty/CGAL/include/CGAL/Nef_S2/SM_const_decorator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_S2/SM_constrained_triang_traits.h b/3rdparty/CGAL/include/CGAL/Nef_S2/SM_constrained_triang_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_S2/SM_constrained_triang_traits.h
rename to 3rdparty/CGAL/include/CGAL/Nef_S2/SM_constrained_triang_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_S2/SM_decorator.h b/3rdparty/CGAL/include/CGAL/Nef_S2/SM_decorator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_S2/SM_decorator.h
rename to 3rdparty/CGAL/include/CGAL/Nef_S2/SM_decorator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_S2/SM_decorator_traits.h b/3rdparty/CGAL/include/CGAL/Nef_S2/SM_decorator_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_S2/SM_decorator_traits.h
rename to 3rdparty/CGAL/include/CGAL/Nef_S2/SM_decorator_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_S2/SM_io_parser.h b/3rdparty/CGAL/include/CGAL/Nef_S2/SM_io_parser.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_S2/SM_io_parser.h
rename to 3rdparty/CGAL/include/CGAL/Nef_S2/SM_io_parser.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_S2/SM_items.h b/3rdparty/CGAL/include/CGAL/Nef_S2/SM_items.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_S2/SM_items.h
rename to 3rdparty/CGAL/include/CGAL/Nef_S2/SM_items.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_S2/SM_iteration.h b/3rdparty/CGAL/include/CGAL/Nef_S2/SM_iteration.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_S2/SM_iteration.h
rename to 3rdparty/CGAL/include/CGAL/Nef_S2/SM_iteration.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_S2/SM_list.h b/3rdparty/CGAL/include/CGAL/Nef_S2/SM_list.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_S2/SM_list.h
rename to 3rdparty/CGAL/include/CGAL/Nef_S2/SM_list.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_S2/SM_overlayer.h b/3rdparty/CGAL/include/CGAL/Nef_S2/SM_overlayer.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_S2/SM_overlayer.h
rename to 3rdparty/CGAL/include/CGAL/Nef_S2/SM_overlayer.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_S2/SM_point_locator.h b/3rdparty/CGAL/include/CGAL/Nef_S2/SM_point_locator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_S2/SM_point_locator.h
rename to 3rdparty/CGAL/include/CGAL/Nef_S2/SM_point_locator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_S2/SM_triangulator.h b/3rdparty/CGAL/include/CGAL/Nef_S2/SM_triangulator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_S2/SM_triangulator.h
rename to 3rdparty/CGAL/include/CGAL/Nef_S2/SM_triangulator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_S2/SM_visualizor.h b/3rdparty/CGAL/include/CGAL/Nef_S2/SM_visualizor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_S2/SM_visualizor.h
rename to 3rdparty/CGAL/include/CGAL/Nef_S2/SM_visualizor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_S2/Sphere_circle.h b/3rdparty/CGAL/include/CGAL/Nef_S2/Sphere_circle.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_S2/Sphere_circle.h
rename to 3rdparty/CGAL/include/CGAL/Nef_S2/Sphere_circle.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_S2/Sphere_direction.h b/3rdparty/CGAL/include/CGAL/Nef_S2/Sphere_direction.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_S2/Sphere_direction.h
rename to 3rdparty/CGAL/include/CGAL/Nef_S2/Sphere_direction.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_S2/Sphere_geometry.h b/3rdparty/CGAL/include/CGAL/Nef_S2/Sphere_geometry.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_S2/Sphere_geometry.h
rename to 3rdparty/CGAL/include/CGAL/Nef_S2/Sphere_geometry.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_S2/Sphere_geometry_OGL.h b/3rdparty/CGAL/include/CGAL/Nef_S2/Sphere_geometry_OGL.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_S2/Sphere_geometry_OGL.h
rename to 3rdparty/CGAL/include/CGAL/Nef_S2/Sphere_geometry_OGL.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_S2/Sphere_map.h b/3rdparty/CGAL/include/CGAL/Nef_S2/Sphere_map.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_S2/Sphere_map.h
rename to 3rdparty/CGAL/include/CGAL/Nef_S2/Sphere_map.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_S2/Sphere_point.h b/3rdparty/CGAL/include/CGAL/Nef_S2/Sphere_point.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_S2/Sphere_point.h
rename to 3rdparty/CGAL/include/CGAL/Nef_S2/Sphere_point.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_S2/Sphere_segment.h b/3rdparty/CGAL/include/CGAL/Nef_S2/Sphere_segment.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_S2/Sphere_segment.h
rename to 3rdparty/CGAL/include/CGAL/Nef_S2/Sphere_segment.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_S2/Sphere_triangle.h b/3rdparty/CGAL/include/CGAL/Nef_S2/Sphere_triangle.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_S2/Sphere_triangle.h
rename to 3rdparty/CGAL/include/CGAL/Nef_S2/Sphere_triangle.h
diff --git a/3rdparty/CGAL/include/CGAL/Nef_S2/leda_sphere_map.h b/3rdparty/CGAL/include/CGAL/Nef_S2/leda_sphere_map.h
new file mode 100644
index 0000000..ea3edcc
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Nef_S2/leda_sphere_map.h
@@ -0,0 +1,268 @@
+// Copyright (c) 1997-2002  Max-Planck-Institute Saarbruecken (Germany).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Michael Seel  <seel at mpi-sb.mpg.de>
+
+#ifndef CGAL_LEDA_SPHERE_MAP_H
+#define CGAL_LEDA_SPHERE_MAP_H
+
+#include <CGAL/generic_sweep.h>
+#include <CGAL/Nef_2/Segment_overlay_traits.h>
+#include <CGAL/Nef_S2/Sphere_geometry.h>
+#include <LEDA/graph/graph.h>
+#include <LEDA/graph/graph_misc.h>
+
+#undef CGAL_NEF_DEBUG
+#define CGAL_NEF_DEBUG 211
+#include <CGAL/Nef_2/debug.h>
+
+template <typename R, typename ITERATOR>
+class leda_graph_decorator { 
+public:
+  typedef leda_node      Vertex_handle;
+  typedef leda_edge      Halfedge_handle;
+  typedef CGAL::Sphere_point<R>   Point_2;
+  typedef CGAL::Sphere_segment<R> Segment_2;
+  typedef GRAPH< Point_2, Segment_2 >     Graph;
+  typedef leda_node_map<Halfedge_handle>  Below_map;
+
+  Graph&      G;
+  Below_map&  M;
+
+leda_graph_decorator(Graph& Gi, Below_map& Mi) : G(Gi), M(Mi) {}
+
+Vertex_handle new_vertex(const Point_2& p)
+{ return G.new_node(p); }
+
+void link_as_target_and_append(Vertex_handle v, Halfedge_handle e)
+{ Halfedge_handle erev = G.reversal(e);
+  G.move_edge(e,G.cyclic_adj_pred(e,G.source(e)),v);
+  G.move_edge(erev,v,G.target(erev));
+}
+
+Halfedge_handle new_halfedge_pair_at_source(Vertex_handle v)
+{ Halfedge_handle e_res,e_rev, e_first = G.first_adj_edge(v);
+  if ( e_first == nil ) {
+    e_res = G.new_edge(v,v);
+    e_rev = G.new_edge(v,v);
+  } else {
+    e_res = G.new_edge(e_first,v,LEDA::before);
+    e_rev = G.new_edge(e_first,v,LEDA::before);
+  }
+  G.set_reversal(e_res,e_rev);
+  return e_res;
+}
+
+void supporting_segment(Halfedge_handle e, ITERATOR it)
+{ G[e] = *it; }
+
+void halfedge_below(Vertex_handle v, Halfedge_handle e)
+{ M[v] = e; }
+
+void trivial_segment(Vertex_handle v, ITERATOR it) {}
+void starting_segment(Vertex_handle v, ITERATOR it) {}
+void passing_segment(Vertex_handle v, ITERATOR it) {}
+void ending_segment(Vertex_handle v, ITERATOR it) {}
+
+
+}; // leda_graph_decorator
+
+
+template <typename R>
+class leda_sphere_map_overlayer {
+
+  typedef std::pair<leda_edge,leda_edge> edge_pair;
+  typedef CGAL::Sphere_point<R>   SPoint_2;
+  typedef CGAL::Sphere_segment<R> SSegment_2;
+  typedef CGAL::Plane_3<R>        Plane_3;
+  typedef GRAPH<SPoint_2,SSegment_2> Sphere_map;
+
+  Sphere_map G;
+  leda_node_map<leda_edge>   E;
+
+public:
+
+leda_sphere_map_overlayer() : G(),E(G) {}
+
+const Sphere_map& sphere_map() const { return G; }
+
+template <typename Iterator>
+void subdivide(Iterator start, Iterator end)
+/* subdivision is done in phases
+   - first we partition all segments into the pieces in the
+     closed postive xy-halfspace and into the pieces in the
+     negative xy-halfspace
+   - we sweep both halfspheres separate. Note that the boundary
+     carries the same topology
+   - we unify the graphs embedded into both halfspheres at
+     the boundary.
+*/
+{
+typedef leda_graph_decorator<R,Iterator> leda_graph_output;
+typedef CGAL::Positive_halfsphere_geometry<R> PH_geometry;
+typedef CGAL::Segment_overlay_traits< 
+          Iterator, leda_graph_output, PH_geometry>  PHS_traits;
+typedef CGAL::generic_sweep<PHS_traits> Positive_halfsphere_sweep;
+
+typedef CGAL::Negative_halfsphere_geometry<R> NH_geometry;
+typedef CGAL::Segment_overlay_traits< 
+          Iterator, leda_graph_output, NH_geometry> NHS_traits;
+typedef CGAL::generic_sweep<NHS_traits> Negative_halfsphere_sweep;
+
+  std::list<SSegment_2> Lp,Lm;
+  partition_xy( start, end, Lp , +1);
+  partition_xy( start, end, Lm , -1);
+  // both lists initialized with four quarter segments
+  // supporting the xy-equator thereby separating the 
+  // two halfspheres 
+  // all other segments in the range are split into their
+  // connected components with respect to the xy-plane.
+
+  leda_node v1,v2;
+  leda_graph_output O(G,E);
+  typedef typename PHS_traits::INPUT Input_range;
+  Positive_halfsphere_sweep SP(Input_range(Lp.begin(),Lp.end()),O);
+  SP.sweep();
+  CGAL_NEF_TRACEN("POS SWEEP\n"<<(dump(std::cerr),""));
+  v1=G.first_node(); v2=G.last_node();
+  Negative_halfsphere_sweep SM(Input_range(Lm.begin(),Lm.end()),O);
+  SM.sweep();
+  CGAL_NEF_TRACEN("NEG SWEEP\n"<<(dump(std::cerr),""));
+  v2 = G.succ_node(v2);
+  // now two CCs of sphere graph calculated
+  // v1 = first node of CC in positive xy-sphere
+  // v2 = first node of CC in negative xy-sphere
+
+  merging_halfspheres(v1,v2);
+  clean_trivial_sface_cycles();
+  if (!Is_Plane_Map(G)) error_handler(1,"Sphere map: embedding wrong.");
+  compute_faces();
+}
+
+void merge_nodes(leda_edge e1, leda_edge e2) 
+// e1 and e2 are two edges of the xy equator such that
+// e1 is part of the positive xy-sphere bounding outer face
+// e2 is part of the negative xy-sphere bounding outer face
+// e1 and e2 are oppositely oriented 
+// the outer faces are left of the edges
+// the edges are embedded orderpreserving ccw
+// then the following code merges the edges of A(target(e2))
+// to A(source(e1)) preserving the embedding
+// afterwards source(e1) carries all edges, target(e2) is isolated
+{
+  leda_node v = source(e1);
+  leda_edge e_pos = e1;
+  leda_edge e = G.reversal(e2), er = e2;
+  leda_edge e_end = e;
+  do {
+    leda_edge e_next = G.cyclic_adj_succ(e);
+    G.move_edge(e,e_pos,target(e));
+    G.move_edge(er,er,v);
+    e_pos = e;
+    e = e_next; er = G.reversal(e);
+  } while ( e != e_end );
+}
+
+void merging_halfspheres(leda_node v1, leda_node v2)
+// v1 and v2 are the definite nodes of both CCs
+// where the negative y-axis pierces the sphere.
+// the faces are left of edges
+// edges are embedded orderpreserving ccw
+{
+  CGAL_NEF_TRACEN("Merging Halfspheres");  
+  leda_edge e1,e2,e3,e4,e1n,e2n;
+  forall_sadj_edges(e1,v1) 
+    if ( G[target(e1)].hz()==0 && G[target(e1)].hx()<0 ) break;
+  forall_sadj_edges(e2,v2) 
+    if ( G[target(e2)].hz()==0 && G[target(e2)].hx()>0 ) break;
+  e3 = G.face_cycle_pred(e1);
+  e4 = e2; e2 = G.face_cycle_pred(e2);
+  while ( e1 != e3 || e2 != e4 ) {
+      CGAL_NEF_TRACEN(G[source(e1)]<<" "<< G[target(e2)]);
+    e1n = G.face_cycle_succ(e1); e2n = G.face_cycle_pred(e2);
+    merge_nodes(e1,e2);
+    e1 = e1n; e2 = e2n;
+  }
+}
+
+
+void clean_trivial_sface_cycles() 
+// removes trivial face cycles at equator
+// removes isolated vertices stemming from
+// equator unification
+{
+  leda_edge_map<bool> known(G,false);
+  leda_list<leda_edge> L;
+  leda_list<edge_pair> Lr;
+  leda_edge e;
+  forall_sedges(e,G) {
+    if (known[e]) continue;
+    leda_edge en = G.face_cycle_succ(e);
+    if ( G.face_cycle_succ(en) != e ) 
+      continue;
+    // e in trivial face cycle
+    L.append(e); L.append(en);
+    CGAL_NEF_TRACEN("tivial cycle "<<G[source(e)]<<G[target(e)]);
+    known[e] = known[en] = true;
+    leda_edge er = G.reversal(e);
+    leda_edge enr = G.reversal(en);
+    Lr.append(edge_pair(er,enr));
+  }
+  edge_pair ep;
+  forall(ep,Lr) G.set_reversal(ep.first,ep.second);
+  G.del_edges(L);
+  leda_node v;
+  forall_snodes(v,G) if ( G.outdeg(v)==0 ) G.del_node(v);
+}
+
+void compute_faces()
+{
+  G.compute_faces();
+  leda_face f;
+  leda_edge e;
+  forall_sfaces(f,G) {
+    CGAL_NEF_TRACEN("FACE:");
+    forall_sface_edges(e,f) 
+      CGAL_NEF_TRACEN("  "<<SSegment_2(G[source(e)],G[target(e)]));
+  }
+}
+
+void dump(std::ostream& os, leda_node v, bool nl=true) const
+{  os << " ["<<::index(v)<<"] "<<G[v]; 
+   if (nl) os << std::endl; }
+
+void dump(std::ostream& os) const
+{
+  leda_node v;
+  leda_edge e;
+  forall_snodes(v,G) {
+    dump(os,v);
+    forall_sadj_edges(e,v) {
+      os << "   ->";
+      dump(os,target(e),false);
+      os <<" ["<<G[e]<<" ]\n";
+    }
+  }
+    
+}
+
+
+}; // leda_sphere_map_overlayer<R>
+
+
+#endif //CGAL_LEDA_SPHERE_MAP_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_S2/sphere_predicates.h b/3rdparty/CGAL/include/CGAL/Nef_S2/sphere_predicates.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_S2/sphere_predicates.h
rename to 3rdparty/CGAL/include/CGAL/Nef_S2/sphere_predicates.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_nary_intersection_3.h b/3rdparty/CGAL/include/CGAL/Nef_nary_intersection_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_nary_intersection_3.h
rename to 3rdparty/CGAL/include/CGAL/Nef_nary_intersection_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_nary_union_3.h b/3rdparty/CGAL/include/CGAL/Nef_nary_union_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_nary_union_3.h
rename to 3rdparty/CGAL/include/CGAL/Nef_nary_union_3.h
diff --git a/3rdparty/CGAL/include/CGAL/Nef_polyhedron_2.h b/3rdparty/CGAL/include/CGAL/Nef_polyhedron_2.h
new file mode 100644
index 0000000..a5de5aa
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Nef_polyhedron_2.h
@@ -0,0 +1,1136 @@
+// Copyright (c) 1997-2000  Max-Planck-Institute Saarbruecken (Germany).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Michael Seel <seel at mpi-sb.mpg.de>
+
+#ifndef CGAL_NEF_POLYHEDRON_2_H
+#define CGAL_NEF_POLYHEDRON_2_H
+
+#if defined(BOOST_MSVC)
+#  pragma warning(push)
+#  pragma warning(disable:4800) // complaint about performance in std::map where we can't do anything
+#endif                          
+
+
+#include <CGAL/basic.h>
+#include <CGAL/Handle_for.h>
+#include <CGAL/Nef_2/HDS_items.h>
+#include <CGAL/HalfedgeDS_default.h>
+
+#include <CGAL/Is_extended_kernel.h>
+#include <CGAL/Nef_2/PM_explorer.h>
+#include <CGAL/Nef_2/PM_decorator.h>
+#include <CGAL/Nef_2/PM_io_parser.h>
+#include <CGAL/Nef_2/PM_overlayer.h>
+#include <CGAL/Nef_2/PM_point_locator.h>
+#include <CGAL/Nef_2/Bounding_box_2.h>
+#include <vector>
+#include <list>
+
+#include <boost/random/linear_congruential.hpp>
+#include <boost/random/uniform_real.hpp>
+#include <boost/random/variate_generator.hpp>
+
+#undef CGAL_NEF_DEBUG
+#define CGAL_NEF_DEBUG 11
+#include <CGAL/Nef_2/debug.h>
+
+namespace CGAL {
+
+template <typename T, typename I, typename M> class Nef_polyhedron_2;
+template <typename T, typename I, typename M> class Nef_polyhedron_2_rep;
+
+template <typename T, typename I, typename M>
+std::ostream& operator<<(std::ostream&, const Nef_polyhedron_2<T,I,M>&); 
+
+template <typename T, typename I, typename M>
+std::istream& operator>>(std::istream&, Nef_polyhedron_2<T,I,M>&);
+
+template <typename T, typename Items, typename Mark_>
+class Nef_polyhedron_2_rep 
+{ 
+  typedef Nef_polyhedron_2_rep<T,Items,Mark_> Self;
+  friend class Nef_polyhedron_2<T,Items,Mark_>;
+
+  struct HDS_traits {
+    typedef typename T::Point_2 Point;
+    typedef Mark_                Mark;
+  };
+
+public: // gcc-3.3 otherwise claims that Decorator in Polyhedron_2 is private
+  typedef CGAL_HALFEDGEDS_DEFAULT<HDS_traits,Items> Plane_map;
+  typedef CGAL::PM_const_decorator<Plane_map>           Const_decorator;
+  typedef CGAL::PM_decorator<Plane_map>                 Decorator;
+  typedef CGAL::PM_naive_point_locator<Decorator,T>     Slocator;
+  typedef CGAL::PM_point_locator<Decorator,T>           Locator;
+  typedef CGAL::PM_overlayer<Decorator,T>               Overlayer;
+
+private:
+
+  Plane_map pm_; 
+  Locator* pl_;
+  
+  void init_locator() 
+  { 
+    if ( !pl_ ) 
+      pl_ = new Locator(pm_); 
+  }
+
+  void clear_locator() 
+  { 
+    if ( pl_ ) { 
+      delete pl_; 
+      pl_=0; 
+    } 
+  }
+
+public:
+  Nef_polyhedron_2_rep() 
+    : pm_(), pl_(0) 
+  {}
+
+  Nef_polyhedron_2_rep(const Self& ) 
+    : pm_(), pl_(0) 
+  {}
+
+  ~Nef_polyhedron_2_rep() 
+  { 
+    pm_.clear(); 
+    clear_locator(); 
+  }
+};
+
+/*{\Moptions print_title=yes }*/ 
+/*{\Manpage {Nef_polyhedron_2}{T}{Nef Polyhedra in the Plane}{N}}*/
+
+/*{\Mdefinition
+An instance of data type |\Mname| is a subset of the plane that is
+the result of forming complements and intersections starting from a
+finite set |H| of half-spaces. |\Mtype| is closed under all binary set
+operations |intersection|, |union|, |difference|, |complement| and
+under the topological operations |boundary|, |closure|, and
+|interior|.
+
+The template parameter |T| is specified via an extended kernel
+concept. |T| must be a model of the concept |ExtendedKernelTraits_2|.
+}*/
+
+template <typename T, typename Items_=HDS_items, typename Mark_=bool>
+class Nef_polyhedron_2 
+  : public Handle_for< Nef_polyhedron_2_rep<T,Items_,Mark_> >
+{ 
+public:
+typedef T Extended_kernel;
+static  T EK; // static extended kernel
+
+  /*{\Mtypes 7}*/
+  typedef Mark_ Mark;
+  /*{\Xtypemember marking set membership or exclusion.}*/
+  typedef Items_ Items;
+  typedef Nef_polyhedron_2<T,Items,Mark> Self;
+  typedef Handle_for< Nef_polyhedron_2_rep<T,Items,Mark> > Base;
+  typedef typename T::Point_2   Extended_point;
+  typedef typename T::Segment_2 Extended_segment;
+
+  typedef typename T::Standard_line_2 Line;
+  /*{\Mtypemember the oriented lines modeling half-planes}*/
+  typedef typename T::Standard_point_2 Point;
+  /*{\Mtypemember the affine points of the plane.}*/
+  typedef typename T::Standard_direction_2 Direction;
+  /*{\Mtypemember directions in our plane.}*/
+  typedef typename T::Standard_aff_transformation_2  Aff_transformation;
+  /*{\Mtypemember affine transformations of the plane.}*/
+
+
+  // types for choosing the right constructor
+  struct Polylines {};
+  struct Polygons {};
+
+  typedef Polylines Polylines_tag;
+  typedef Polygons Polygons_tag;
+
+  enum Operation { JOIN=0 };
+
+  enum Boundary { EXCLUDED=0, INCLUDED=1 };
+  /*{\Menum construction selection.}*/
+
+  enum Content { EMPTY=0, COMPLETE=1 };
+  /*{\Menum construction selection}*/
+
+  static const Polylines POLYLINES;
+  static const Polygons POLYGONS;
+protected:
+  struct AND { bool operator()(bool b1, bool b2)  const { return b1&&b2; }  };
+  struct OR { bool operator()(bool b1, bool b2)   const { return b1||b2; }  };
+  struct DIFF { bool operator()(bool b1, bool b2) const { return b1&&!b2; } };
+  struct XOR { bool operator()(bool b1, bool b2)  const 
+                                           { return (b1&&!b2)||(!b1&&b2); } };
+
+  typedef Nef_polyhedron_2_rep<T,Items,Mark>           Nef_rep;
+  typedef typename Nef_rep::Plane_map       Plane_map;
+  typedef typename Nef_rep::Decorator       Decorator;
+  typedef typename Nef_rep::Const_decorator Const_decorator;
+  typedef typename Nef_rep::Overlayer       Overlayer;
+  //typedef typename Nef_rep::T               Transformer;
+  typedef typename Nef_rep::Slocator        Slocator;
+  typedef typename Nef_rep::Locator         Locator;
+
+  using Base::ptr;
+  using Base::is_shared;
+
+  Plane_map& pm() { return ptr()->pm_; } 
+  const Plane_map& pm() const { return ptr()->pm_; } 
+
+  friend std::ostream& operator<< <>
+      (std::ostream& os, const Nef_polyhedron_2<T,Items,Mark>& NP);
+  friend std::istream& operator>> <>
+      (std::istream& is, Nef_polyhedron_2<T,Items,Mark>& NP);
+
+  typedef typename Decorator::Vertex_handle         Vertex_handle;
+  typedef typename Decorator::Halfedge_handle       Halfedge_handle;
+  typedef typename Decorator::Face_handle           Face_handle;
+  typedef typename Decorator::Vertex_const_handle   Vertex_const_handle;
+  typedef typename Decorator::Halfedge_const_handle Halfedge_const_handle;
+  typedef typename Decorator::Face_const_handle     Face_const_handle;
+
+  typedef typename Decorator::Vertex_iterator       Vertex_iterator;
+  typedef typename Decorator::Halfedge_iterator     Halfedge_iterator;
+  typedef typename Decorator::Face_iterator         Face_iterator;
+  typedef typename Const_decorator::Vertex_const_iterator   
+                                                    Vertex_const_iterator;
+  typedef typename Const_decorator::Halfedge_const_iterator 
+                                                    Halfedge_const_iterator;
+  typedef typename Const_decorator::Face_const_iterator     
+                                                    Face_const_iterator;
+
+  typedef Bounding_box_2<typename Is_extended_kernel<Extended_kernel>::value_type, 
+                         Extended_kernel> Box_2;
+
+  struct Except_frame_box_edges {
+    Decorator D_; 
+    Face_handle f_;
+
+    Except_frame_box_edges(Plane_map& P) 
+      : D_(P), f_(D_.faces_begin()) 
+    {}
+    
+    bool 
+    operator()(Halfedge_handle e, const Tag_true& ) const
+    { 
+      return D_.face(e)==f_ || D_.face(D_.twin(e))==f_; 
+    }
+
+    bool 
+    operator()(Halfedge_handle /*e*/, const Tag_false& ) const
+    { 
+      return false;
+    }
+    bool
+    operator()(Halfedge_handle e) const
+    {
+      return this->operator()(e, typename Is_extended_kernel<Extended_kernel>::value_type());
+    }
+
+  };
+
+  friend struct Except_frame_box_edges;
+
+  typedef std::list<Extended_segment>      ES_list;
+  typedef typename ES_list::const_iterator ES_iterator;
+
+  void fill_with_frame_segs(ES_list& L, const Tag_true& ) const
+  /*{\Xop fills the list with the four segments which span our frame,
+     the convex hull of SW,SE,NW,NE.}*/
+  { L.push_back(Extended_segment(EK.SW(),EK.NW()));
+    L.push_back(Extended_segment(EK.SW(),EK.SE()));
+    L.push_back(Extended_segment(EK.NW(),EK.NE()));
+    L.push_back(Extended_segment(EK.SE(),EK.NE()));
+  }
+
+  void fill_with_frame_segs(ES_list& , const Tag_false& ) const
+  {}
+
+  void fill_with_frame_segs(ES_list& L) const
+  { 
+
+    fill_with_frame_segs(L, typename Is_extended_kernel<Extended_kernel>::value_type());
+  }
+
+  struct Link_to_iterator {
+    const Decorator& D;
+    Halfedge_handle _e;
+    Vertex_handle   _v;
+    ES_iterator     _it;
+    Mark            _m;
+    Link_to_iterator(const Decorator& d, ES_iterator it, Mark m) : 
+      D(d), _e(), _v(), _it(it), _m(m) {}
+
+    void supporting_segment(Halfedge_handle e, ES_iterator it) 
+    {
+      if ( it == _it )
+        _e = e;
+      D.mark(e) = _m; 
+    }
+    void trivial_segment(Vertex_handle v, ES_iterator it) 
+    {
+      if ( it == _it )
+        _v = v;
+      D.mark(v) = _m;
+    }
+    void starting_segment(Vertex_handle v, ES_iterator) 
+    { D.mark(v) = _m; }
+    void passing_segment(Vertex_handle v, ES_iterator) 
+    { D.mark(v) = _m; }
+    void ending_segment(Vertex_handle v, ES_iterator) 
+    { D.mark(v) = _m; }
+
+  };
+
+  template<typename IT>
+  struct From_intersecting_polygons {
+
+    Unique_hash_map<Halfedge_handle,IT>& halfedge2iterator;
+
+    From_intersecting_polygons(Unique_hash_map<Halfedge_handle,IT>& e2i) 
+      : halfedge2iterator(e2i) {}
+
+    void supporting_segment(Halfedge_handle e, IT it) 
+    { 
+      halfedge2iterator[e->opposite()] = 
+	halfedge2iterator[e] = it; e->mark() = true;}      
+
+    void trivial_segment(Vertex_handle v, IT) 
+    { v->mark() = true; }
+    void starting_segment(Vertex_handle v, IT) 
+    { v->mark() = true; }
+    void passing_segment(Vertex_handle v, IT) 
+    { v->mark() = true; }
+    void ending_segment(Vertex_handle v, IT) 
+    { v->mark() = true; }
+  };  
+
+  friend struct Link_to_iterator;
+
+  void clear_outer_face_cycle_marks(const Tag_true&) 
+  { // unset all frame marks
+    Decorator D(pm());
+    Face_iterator f = D.faces_begin(); 
+    D.mark(f) = false;
+    Halfedge_handle e = D.holes_begin(f);
+    D.set_marks_in_face_cycle(e, false);
+  }
+
+  void clear_outer_face_cycle_marks(const Tag_false&)
+  {}
+
+  void clear_outer_face_cycle_marks()
+  {
+    clear_outer_face_cycle_marks(typename Is_extended_kernel<Extended_kernel>::value_type());
+  }
+
+public:
+  /*{\Mcreation 3}*/
+  Nef_polyhedron_2(Content plane = EMPTY) : Base(Nef_rep())
+  /*{\Mcreate creates an instance |\Mvar| of type |\Mname|
+  and initializes it to the empty set if |plane == EMPTY|
+  and to the whole plane if |plane == COMPLETE|.}*/
+  {
+    ES_list L;
+    fill_with_frame_segs(L);
+    Overlayer D(pm());
+    Link_to_iterator I(D, --L.end(), false);
+    D.create(L.begin(),L.end(),I);
+    D.mark(--D.faces_end()) = bool(plane);
+  }
+
+
+  Nef_polyhedron_2(const Line& l, Boundary line = INCLUDED) : Base(Nef_rep())
+  /*{\Mcreate creates a Nef polyhedron |\Mvar| containing the half-plane
+  left of |l| including |l| if |line==INCLUDED|, excluding |l| if 
+  |line==EXCLUDED|.}*/  
+  {   CGAL_NEF_TRACEN("Nconstruction from line "<<l);
+    ES_list L;
+    fill_with_frame_segs(L);
+    if(check_tag(typename Is_extended_kernel<Extended_kernel>::value_type())) {
+      Extended_point ep1 = EK.construct_opposite_point(l);
+      Extended_point ep2 = EK.construct_point(l);
+      L.push_back(EK.construct_segment(ep1,ep2));
+    }
+    Overlayer D(pm());
+    Link_to_iterator I(D, --L.end(), false);
+    D.create(L.begin(),L.end(),I);
+    if(check_tag(typename Is_extended_kernel<Extended_kernel>::value_type())) {
+      CGAL_assertion( I._e != Halfedge_handle() );
+      Halfedge_handle el = I._e;
+      if ( D.point(D.target(el)) != EK.target(L.back()) )
+	el = D.twin(el);
+      D.mark(D.face(el)) = true;
+      D.mark(el) = bool(line);
+    } else {
+      D.mark(--D.faces_end()) = bool(EMPTY);
+      std::cerr << "Constructor not available with standard kernel. "
+                   " Returned empty polygon!" << std::endl;
+    }
+  }
+
+
+  template <class Forward_iterator>
+  Nef_polyhedron_2(Forward_iterator it, Forward_iterator end,
+    Boundary b = INCLUDED) : Base(Nef_rep())
+  /*{\Mcreate creates a Nef polyhedron |\Mvar| from the simple polygon
+  |P| spanned by the list of points in the iterator range |[it,end)| and
+  including its boundary if |b = INCLUDED| and excluding the boundary
+  otherwise. |Forward_iterator| has to be an iterator with value type
+  |Point|. This construction expects that |P| is simple. The degenerate
+  cases where |P| contains no point, one point or spans just one segment
+  (two points) are correctly handled. In all degenerate cases there's
+  only one unbounded face adjacent to the degenerate polygon. If |b ==
+  INCLUDED| then |\Mvar| is just the boundary. If |b == EXCLUDED| then
+  |\Mvar| is the whole plane without the boundary.}*/
+  { 
+    ES_list L;
+    fill_with_frame_segs(L);
+    bool empty = false;  
+    if (it != end) 
+      {
+        Extended_point ef, ep = ef = EK.construct_point(*it);
+        Forward_iterator itl=it; ++itl;
+        if (itl == end) // case only one point
+          L.push_back(EK.construct_segment(ep,ep));
+        else { // at least one segment
+          while( itl != end ) {
+            Extended_point en = EK.construct_point(*itl);
+            L.push_back(EK.construct_segment(ep,en));
+            ep = en; ++itl;
+          }
+          L.push_back(EK.construct_segment(ep,ef));
+        }
+      }
+
+    else empty = true;
+    Overlayer D(pm());
+    Link_to_iterator I(D, --L.end(), true);
+    D.create(L.begin(),L.end(),I);
+    if ( empty ) {
+      D.mark(--D.faces_end()) = !bool(b); return; }
+    CGAL_assertion( I._e != Halfedge_handle() || I._v != Vertex_handle() );
+
+    if ( EK.is_degenerate(L.back()) ) {
+      // its a point
+      CGAL_assertion(I._v != Vertex_handle());
+      D.mark(D.face(I._v)) = !bool(b); D.mark(I._v) = b;
+    } else {
+      // at least one segment
+      Halfedge_handle el = I._e;
+      if ( D.point(D.target(el)) != EK.target(L.back()) )
+	el = D.twin(el);  
+      D.set_marks_in_face_cycle(el,bool(b));
+      unsigned int n = 
+        check_tag(typename Is_extended_kernel<Extended_kernel>::value_type()) ? 2 : 1;
+      if ( D.number_of_faces() > n ) D.mark(D.face(el)) = true;
+      else                           D.mark(D.face(el)) = !bool(b);
+    }
+
+    clear_outer_face_cycle_marks();
+  }
+
+  // The constructor which takes an iterator range of polygons
+  template <class Forward_iterator>
+  Nef_polyhedron_2(Forward_iterator pit, Forward_iterator pend,	      
+		   Polygons, Operation op = JOIN) : Base(Nef_rep()) { 
+
+    CGAL_assertion(op==JOIN);
+
+    typedef typename std::iterator_traits<Forward_iterator>::value_type
+      iterator_pair;
+    typedef typename iterator_pair::first_type point_iterator;
+    point_iterator it, itl, end;
+
+    ES_list L;
+
+    fill_with_frame_segs(L);
+    for(;pit != pend; ++pit) {
+      it = pit->first;
+      end = pit->second;
+      if (it != end) {
+        Extended_point ef, ep = ef = EK.construct_point(*it);
+        itl=it; ++itl;
+        if (itl == end) // case only one point
+          L.push_back(EK.construct_segment(ep,ep));
+        else { // at least one segment
+          while( itl != end ) {
+            Extended_point en = EK.construct_point(*itl);
+            L.push_back(EK.construct_segment(ep,en));
+            ep = en; ++itl;
+          }
+          L.push_back(EK.construct_segment(ep,ef));
+        }
+      }
+    }
+
+    Overlayer D(pm());
+    Unique_hash_map<Halfedge_handle,ES_iterator> e2i;
+    From_intersecting_polygons<ES_iterator> fip(e2i);
+    D.create(L.begin(),L.end(),fip);
+
+    Face_handle outer_face;
+    if(check_tag(typename Is_extended_kernel<Extended_kernel>::value_type()))
+      outer_face = ++D.faces_begin();
+    else
+      outer_face = D.faces_begin();
+    Halfedge_handle e;
+    for(e=D.halfedges_begin(); e!=D.halfedges_end(); ++e) {
+      if(&*e < &*(D.twin(e)) && EK.is_standard(D.source(e)->point())) {
+	ES_iterator eit = e2i[e];
+	if(lexicographically_xy_smaller(EK.standard_point(eit->source()),
+					EK.standard_point(eit->target()))) {
+	  if(lexicographically_xy_smaller(EK.standard_point(D.source(D.twin(e))->point()),
+					  EK.standard_point(D.source(e)->point())))
+	    e = D.twin(e);
+	} else
+	  if(lexicographically_xy_smaller(EK.standard_point(D.source(e)->point()),
+					  EK.standard_point(D.source(D.twin(e))->point())))
+	    e = D.twin(e);
+	if(D.face(e) != outer_face)
+	  D.mark(D.face(e)) = true;
+      }
+    }
+    
+    D.simplify(Except_frame_box_edges(pm()));
+    clear_outer_face_cycle_marks();
+  }
+
+
+  // The constructor which takes an iterator range of polylines
+  template <class Forward_iterator>
+  Nef_polyhedron_2(Forward_iterator pit, Forward_iterator pend,	      
+		   Polylines) : Base(Nef_rep()) { 
+
+    typedef typename std::iterator_traits<Forward_iterator>::value_type 
+      iterator_pair;
+    typedef typename iterator_pair::first_type point_iterator;
+    point_iterator it, itl, end;
+
+    ES_list L;
+
+    fill_with_frame_segs(L);
+    for(;pit != pend; ++pit) {
+      it = pit->first;
+      end = pit->second;
+      if (it != end) {
+        Extended_point ep  = EK.construct_point(*it);
+        itl=it; ++itl;
+        if (itl == end) // case only one point
+          L.push_back(EK.construct_segment(ep,ep));
+        else { // at least one segment
+          while( itl != end ) {
+            Extended_point en = EK.construct_point(*itl);
+            L.push_back(EK.construct_segment(ep,en));
+            ep = en;
+	    ++itl;
+          }
+        }
+      }
+    }
+
+    Overlayer D(pm());
+    Link_to_iterator I(D, --L.end(), true);
+    D.create(L.begin(),L.end(),I, Overlayer::POLYLINE);
+    
+    clear_outer_face_cycle_marks();
+  }
+
+  Nef_polyhedron_2(const Nef_polyhedron_2<T,Items,Mark>& N1) : Base(N1) {}
+  Nef_polyhedron_2& operator=(const Nef_polyhedron_2<T,Items,Mark>& N1)
+  { Base::operator=(N1); return (*this); }
+  ~Nef_polyhedron_2() {}
+
+
+
+  template <class Forward_iterator>
+  Nef_polyhedron_2(Forward_iterator first, Forward_iterator beyond, 
+    double p) : Base(Nef_rep())
+  /*{\Xcreate creates a random Nef polyhedron from the arrangement of
+  the set of lines |S = set[first,beyond)|. The cells of the arrangement
+  are selected uniformly at random with probability $p$. \precond $0 < p
+  < 1$.}*/
+  { CGAL_assertion(0<p && p<1);
+    ES_list L; fill_with_frame_segs(L);
+    while ( first != beyond ) {
+      Extended_point ep1 = EK.construct_opposite_point(*first);
+      Extended_point ep2 = EK.construct_point(*first);
+      L.push_back(EK.construct_segment(ep1,ep2)); ++first;
+    }
+    Overlayer D(pm());
+    Link_to_iterator I(D, --L.end(), false);
+    D.create(L.begin(),L.end(),I);
+
+    boost::rand48 rng;
+    boost::uniform_real<> dist(0,1);
+    boost::variate_generator<boost::rand48&, boost::uniform_real<> > get_double(rng,dist);
+
+    Vertex_iterator v; Halfedge_iterator e; Face_iterator f;
+    for (v = D.vertices_begin(); v != D.vertices_end(); ++v)
+      D.mark(v) = ( get_double() < p ? true : false );
+    for (e = D.halfedges_begin(); e != D.halfedges_end(); ++(++e))
+      D.mark(e) = ( get_double() < p ? true : false );
+    for (f = D.faces_begin(); f != D.faces_end(); ++f)
+      D.mark(f) = ( get_double() < p ? true : false );
+    D.simplify(Except_frame_box_edges(pm()));
+    clear_outer_face_cycle_marks(); 
+  }
+
+
+
+  protected:
+  Nef_polyhedron_2(const Plane_map& H, bool clone=true) : Base(Nef_rep()) 
+  /*{\Xcreate makes |\Mvar| a new object.  If |clone==true| then the
+  underlying structure of |H| is copied into |\Mvar|.}*/
+  { if (clone) {
+      Decorator D(pm()); // a decorator working on the rep plane map
+      D.clone(H);        // cloning H into pm()
+    }
+  }
+  void clone_rep() { *this = Nef_polyhedron_2<T,Items,Mark>(pm()); }
+
+  /*{\Moperations 4 3 }*/
+  public:
+
+  void clear(Content plane = EMPTY)
+  { *this = Nef_polyhedron_2(plane); }
+  /*{\Mop makes |\Mvar| the empty set if |plane == EMPTY| and the
+  full plane if |plane == COMPLETE|.}*/
+
+  bool is_empty() const
+  /*{\Mop returns true if |\Mvar| is empty, false otherwise.}*/
+  { Const_decorator D(pm());
+    Face_const_iterator f = D.faces_begin();
+    if(check_tag(typename Is_extended_kernel<Extended_kernel>::
+		 value_type()))
+      return (D.number_of_vertices()==4 &&
+	      D.number_of_edges()==4 &&
+	      D.number_of_faces()==2 &&
+	      D.mark(++f) == false);
+    else
+      return (D.number_of_vertices()==0 &&
+	      D.number_of_edges()==0 &&
+	      D.number_of_faces()==1 &&
+		D.mark(f) == false);    
+  }
+
+  bool is_plane() const
+  /*{\Mop returns true if |\Mvar| is the whole plane, false otherwise.}*/
+  { Const_decorator D(pm());
+    Face_const_iterator f = D.faces_begin();
+    if(check_tag(typename Is_extended_kernel<Extended_kernel>::
+         value_type()))
+      return (D.number_of_vertices()==4 &&
+              D.number_of_edges()==4 &&
+              D.number_of_faces()==2 &&
+              D.mark(++f) == true);
+    else
+      return (D.number_of_vertices()==0 &&
+          D.number_of_edges()==0 &&
+          D.number_of_faces()==1 &&
+          D.mark(f) == true);
+  }
+
+  void extract_complement()
+  { CGAL_NEF_TRACEN("extract complement");
+  if ( this->is_shared() ) {
+	  clone_rep();
+  }
+    Overlayer D(pm());
+    Vertex_iterator v, vend = D.vertices_end();
+    for(v = D.vertices_begin(); v != vend; ++v)      D.mark(v) = !D.mark(v);
+    Halfedge_iterator e, eend = D.halfedges_end();
+    for(e = D.halfedges_begin(); e != eend; ++(++e)) D.mark(e) = !D.mark(e);
+    Face_iterator f, fend = D.faces_end();
+    for(f = D.faces_begin(); f != fend; ++f)         D.mark(f) = !D.mark(f);
+    clear_outer_face_cycle_marks();
+  }
+
+  void extract_interior()
+  { CGAL_NEF_TRACEN("extract interior");
+    if ( this->is_shared() ) clone_rep();
+    Overlayer D(pm());
+    Vertex_iterator v, vend = D.vertices_end();
+    for(v = D.vertices_begin(); v != vend; ++v)      D.mark(v) = false;
+    Halfedge_iterator e, eend = D.halfedges_end();
+    for(e = D.halfedges_begin(); e != eend; ++(++e)) D.mark(e) = false;
+    D.simplify(Except_frame_box_edges(pm()));
+  }
+
+
+  void extract_boundary()
+  { CGAL_NEF_TRACEN("extract boundary");
+    if ( this->is_shared() ) clone_rep();
+    Overlayer D(pm());
+    Vertex_iterator v, vend = D.vertices_end();
+    for(v = D.vertices_begin(); v != vend; ++v)      D.mark(v) = true;
+    Halfedge_iterator e, eend = D.halfedges_end();
+    for(e = D.halfedges_begin(); e != eend; ++(++e)) D.mark(e) = true;
+    Face_iterator f, fend = D.faces_end();
+    for(f = D.faces_begin(); f != fend; ++f)         D.mark(f) = false;
+    clear_outer_face_cycle_marks();
+    D.simplify(Except_frame_box_edges(pm()));
+  }
+
+  void extract_closure()
+  /*{\Xop converts |\Mvar| to its closure. }*/
+  { CGAL_NEF_TRACEN("extract closure");
+    extract_complement();
+    extract_interior();
+    extract_complement();
+  }
+
+  void extract_regularization()
+  /*{\Xop converts |\Mvar| to its regularization. }*/
+  { CGAL_NEF_TRACEN("extract regularization");
+    extract_interior();
+    extract_closure();
+  }
+
+  /*{\Mtext \headerline{Constructive Operations}}*/
+
+  Nef_polyhedron_2<T,Items,Mark> complement() const
+  /*{\Mop returns the complement of |\Mvar| in the plane.}*/
+  { Nef_polyhedron_2<T,Items,Mark> res = *this;
+    res.extract_complement();
+    return res;
+  }
+
+
+  Nef_polyhedron_2<T,Items,Mark> interior() const
+  /*{\Mop returns the interior of |\Mvar|.}*/
+  { Nef_polyhedron_2<T,Items,Mark> res = *this;
+    res.extract_interior();
+    return res;
+  }
+
+  Nef_polyhedron_2<T,Items,Mark> closure() const
+  /*{\Mop returns the closure of |\Mvar|.}*/
+  { Nef_polyhedron_2<T,Items,Mark> res = *this;
+    res.extract_closure();
+    return res;
+  }
+
+  Nef_polyhedron_2<T,Items,Mark> boundary() const
+  /*{\Mop returns the boundary of |\Mvar|.}*/
+  { Nef_polyhedron_2<T,Items,Mark> res = *this;
+    res.extract_boundary();
+    return res;
+  }
+
+  Nef_polyhedron_2<T,Items,Mark> regularization() const
+  /*{\Mop returns the regularized polyhedron (closure of interior).}*/
+  { Nef_polyhedron_2<T,Items,Mark> res = *this;
+    res.extract_regularization();
+    return res;
+  }
+
+
+  Nef_polyhedron_2<T,Items,Mark> intersection(const Nef_polyhedron_2<T,Items,Mark>& N1) const
+  /*{\Mop returns |\Mvar| $\cap$ |N1|. }*/
+  { Nef_polyhedron_2<T,Items,Mark> res(pm(),false); // empty, no frame
+    Overlayer D(res.pm());
+    D.subdivide(pm(),N1.pm());
+    AND _and; D.select(_and);
+    res.clear_outer_face_cycle_marks();
+    D.simplify(Except_frame_box_edges(res.pm()));
+    return res;
+  }
+
+
+  Nef_polyhedron_2<T,Items,Mark> join(const Nef_polyhedron_2<T,Items,Mark>& N1) const
+  /*{\Mop returns |\Mvar| $\cup$ |N1|. }*/
+  { Nef_polyhedron_2<T,Items,Mark> res(pm(),false); // empty, no frame
+    Overlayer D(res.pm());
+    D.subdivide(pm(),N1.pm());
+    OR _or; D.select(_or);
+    res.clear_outer_face_cycle_marks();
+    D.simplify(Except_frame_box_edges(res.pm()));
+    return res;
+  }
+
+  Nef_polyhedron_2<T,Items,Mark> difference(const Nef_polyhedron_2<T,Items,Mark>& N1) const
+  /*{\Mop returns |\Mvar| $-$ |N1|. }*/
+  { Nef_polyhedron_2<T,Items,Mark> res(pm(),false); // empty, no frame
+    Overlayer D(res.pm());
+    D.subdivide(pm(),N1.pm());
+    DIFF _diff; D.select(_diff);
+    res.clear_outer_face_cycle_marks();
+    D.simplify(Except_frame_box_edges(res.pm()));
+    return res;
+  }    
+
+  Nef_polyhedron_2<T,Items,Mark> symmetric_difference(
+    const Nef_polyhedron_2<T,Items,Mark>& N1) const
+  /*{\Mop returns the symmectric difference |\Mvar - T| $\cup$ 
+          |T - \Mvar|. }*/
+  { Nef_polyhedron_2<T,Items,Mark> res(pm(),false); // empty, no frame
+    Overlayer D(res.pm());
+    D.subdivide(pm(),N1.pm());
+    XOR _xor; D.select(_xor);
+    res.clear_outer_face_cycle_marks();
+    D.simplify(Except_frame_box_edges(res.pm()));
+    return res;
+  }
+
+  #if 0
+  Nef_polyhedron_2<T,Items,Mark> transform(const Aff_transformation& t) const
+  /*{\Mop returns $t(|\Mvar|)$.}*/
+  { Nef_polyhedron_2<T,Items,Mark> res(pm()); // cloned
+    Transformer PMT(res.pm());
+    PMT.transform(t);
+    return res;
+  }
+  #endif
+
+
+  /*{\Mtext Additionally there are operators |*,+,-,^,!| which
+  implement the binary operations \emph{intersection}, \emph{union},
+  \emph{difference}, \emph{symmetric difference}, and the unary
+  operation \emph{complement} respectively. There are also the
+  corresponding modification operations |*=,+=,-=,^=|.}*/
+
+  Nef_polyhedron_2<T,Items,Mark>  operator*(const Nef_polyhedron_2<T,Items,Mark>& N1) const
+  { return intersection(N1); }
+
+  Nef_polyhedron_2<T,Items,Mark>  operator+(const Nef_polyhedron_2<T,Items,Mark>& N1) const
+  { return join(N1); }
+
+  Nef_polyhedron_2<T,Items,Mark>  operator-(const Nef_polyhedron_2<T,Items,Mark>& N1) const
+  { return difference(N1); }
+
+  Nef_polyhedron_2<T,Items,Mark>  operator^(const Nef_polyhedron_2<T,Items,Mark>& N1) const
+  { return symmetric_difference(N1); }
+
+  Nef_polyhedron_2<T,Items,Mark>  operator!() const
+  { return complement(); }
+   
+  Nef_polyhedron_2<T,Items,Mark>& operator*=(const Nef_polyhedron_2<T,Items,Mark>& N1)
+  { *this = intersection(N1); return *this; }
+
+  Nef_polyhedron_2<T,Items,Mark>& operator+=(const Nef_polyhedron_2<T,Items,Mark>& N1)
+  { *this = join(N1); return *this; }
+
+  Nef_polyhedron_2<T,Items,Mark>& operator-=(const Nef_polyhedron_2<T,Items,Mark>& N1)
+  { *this = difference(N1); return *this; }
+
+  Nef_polyhedron_2<T,Items,Mark>& operator^=(const Nef_polyhedron_2<T,Items,Mark>& N1)
+  { *this = symmetric_difference(N1); return *this; }
+
+  /*{\Mtext There are also comparison operations like |<,<=,>,>=,==,!=|
+  which implement the relations subset, subset or equal, superset, superset
+  or equal, equality, inequality, respectively.}*/
+
+  bool operator==(const Nef_polyhedron_2<T,Items,Mark>& N1) const
+  { return symmetric_difference(N1).is_empty(); }
+
+  bool operator!=(const Nef_polyhedron_2<T,Items,Mark>& N1) const
+  { return !operator==(N1); }  
+
+  bool operator<=(const Nef_polyhedron_2<T,Items,Mark>& N1) const
+  { return difference(N1).is_empty(); } 
+
+  bool operator<(const Nef_polyhedron_2<T,Items,Mark>& N1) const
+  { return difference(N1).is_empty() && !N1.difference(*this).is_empty(); } 
+
+  bool operator>=(const Nef_polyhedron_2<T,Items,Mark>& N1) const
+  { return N1.difference(*this).is_empty(); } 
+
+  bool operator>(const Nef_polyhedron_2<T,Items,Mark>& N1) const   
+  { return N1.difference(*this).is_empty() && !difference(N1).is_empty(); } 
+
+
+  /*{\Mtext \headerline{Exploration - Point location - Ray shooting}
+  As Nef polyhedra are the result of forming complements 
+  and intersections starting from a set |H| of half-spaces that are
+  defined by oriented lines in the plane, they can be represented by
+  an attributed plane map $M = (V,E,F)$. For topological queries
+  within |M| the following types and operations allow exploration
+  access to this structure.}*/
+
+  /*{\Mtypes 3}*/
+  typedef Const_decorator Topological_explorer;
+
+  typedef CGAL::PM_explorer<Const_decorator,T> Explorer;
+  /*{\Mtypemember a decorator to examine the underlying plane map. 
+  See the manual page of |Explorer|.}*/
+
+  typedef typename Locator::Object_handle Object_handle;
+  /*{\Mtypemember a generic handle to an object of the underlying
+  plane map. The kind of object |(vertex, halfedge, face)| can 
+  be determined and the object can be assigned to a corresponding
+  handle by the three functions:\\
+  |bool assign(Vertex_const_handle& h, Object_handle)|\\
+  |bool assign(Halfedge_const_handle& h, Object_handle)|\\
+  |bool assign(Face_const_handle& h, Object_handle)|\\
+  where each function returns |true| iff the assignment to
+  |h| was done.}*/
+
+  enum Location_mode { DEFAULT, NAIVE, LMWT };
+  /*{\Menum selection flag for the point location mode.}*/
+
+
+  /*{\Moperations 3 1 }*/
+
+  void init_locator() const 
+  { const_cast<Self*>(this)->ptr()->init_locator(); }
+  const Locator& locator() const 
+  { CGAL_assertion(ptr()->pl_); return *(ptr()->pl_); }
+
+
+  bool contains(Object_handle h) const
+  /*{\Mop  returns true iff the object |h| is contained in the set
+  represented by |\Mvar|.}*/
+  { Slocator PL(pm()); return PL.mark(h); }
+
+  bool contained_in_boundary(Object_handle h) const
+  /*{\Mop  returns true iff the object |h| is contained in the $1$-skeleton
+  of |\Mvar|.}*/
+  { Vertex_const_handle v;
+    Halfedge_const_handle e;
+    return  ( CGAL::assign(v,h) || CGAL::assign(e,h) );
+  }
+
+  Object_handle locate(const Point& p, Location_mode m = DEFAULT) const
+  /*{\Mop  returns a generic handle |h| to an object (face, halfedge, vertex) 
+  of the underlying plane map that contains the point |p| in its relative 
+  interior. The point |p| is contained in the set represented by |\Mvar| if 
+  |\Mvar.contains(h)| is true. The location mode flag |m| allows one to choose
+  between different point location strategies.}*/
+  { 
+    if (m == DEFAULT || m == LMWT) {
+      init_locator();
+      Extended_point ep = EK.construct_point(p);
+      return locator().locate(ep);
+    } else if (m == NAIVE) {
+      Slocator PL(pm(),EK);
+      Extended_segment s(EK.construct_point(p),
+			 PL.point(PL.vertices_begin()));
+      return PL.locate(s); 
+    }
+    CGAL_error_msg("location mode not implemented.");
+    return Object_handle();
+  }
+
+  struct INSET {
+    const Const_decorator& D;
+    INSET(const Const_decorator& Di) : D(Di) {}
+    bool operator()(Vertex_const_handle v) const { return D.mark(v); }
+    bool operator()(Halfedge_const_handle e) const { return D.mark(e); }
+    bool operator()(Face_const_handle f) const { return D.mark(f); }
+  };
+
+  friend struct INSET;
+
+  Object_handle ray_shoot(const Point& p, const Direction& d, 
+                          Location_mode m = DEFAULT) const
+  /*{\Mop returns a handle |h| with |\Mvar.contains(h)| that can be
+  converted to a |Vertex_/Halfedge_/Face_const_handle| as described
+  above. The object returned is intersected by the ray starting in |p|
+  with direction |d| and has minimal distance to |p|.  The operation
+  returns the null handle |NULL| if the ray shoot along |d| does not hit
+  any object |h| of |\Mvar| with |\Mvar.contains(h)|. The location mode
+  flag |m| allows one to choose between different point location
+  strategies.}*/
+  { 
+    Extended_point ep, eq;
+    if(!check_tag(typename Is_extended_kernel<Extended_kernel>::value_type())) {
+      Const_decorator D(pm());
+      Box_2 b(D.vertices_begin(), D.vertices_end());
+      ep = EK.construct_point(p);
+      eq = b.intersection_ray_bbox(p,d);
+    } else {
+      ep = EK.construct_point(p);
+      eq = EK.construct_point(p,d);      
+    }
+      
+    if (m == DEFAULT || m == LMWT) {
+      init_locator();
+      return locator().ray_shoot(EK.construct_segment(ep,eq),
+                                 INSET(locator())); 
+    } else if (m == NAIVE) {
+      Slocator PL(pm(),EK);
+      return PL.ray_shoot(EK.construct_segment(ep,eq),INSET(PL));
+    }
+    CGAL_error_msg("location mode not implemented.");
+    return Object_handle();
+  }
+
+  struct INSKEL {
+    bool operator()(Vertex_const_handle) const { return true; }
+    bool operator()(Halfedge_const_handle) const { return true; }
+    bool operator()(Face_const_handle) const { return false; }
+  };
+
+  Object_handle ray_shoot_to_boundary(const Point& p, const Direction& d, 
+                Location_mode m = DEFAULT) const
+  /*{\Mop returns a handle |h| that can be converted to a
+  |Vertex_/Halfedge_const_handle| as described above. The object
+  returned is part of the $1$-skeleton of |\Mvar|, intersected by the
+  ray starting in |p| with direction |d| and has minimal distance to
+  |p|.  The operation returns the null handle |NULL| if the ray shoot
+  along |d| does not hit any $1$-skeleton object |h| of |\Mvar|. The
+  location mode flag |m| allows one to choose between different point
+  location strategies.}*/
+  { 
+    Extended_point ep, eq;
+    if(!check_tag(typename Is_extended_kernel<Extended_kernel>::value_type())) {
+      Const_decorator D(pm());
+      Box_2 b(D.vertices_begin(), D.vertices_end());
+      ep = EK.construct_point(p);
+      eq = b.intersection_ray_bbox(p,d);
+    } else {
+      ep = EK.construct_point(p);
+      eq = EK.construct_point(p,d);      
+    }
+      
+    if (m == DEFAULT || m == LMWT) {
+      init_locator();
+      return locator().ray_shoot(EK.construct_segment(ep,eq),
+                                 INSKEL()); 
+    } else if (m == NAIVE) {
+      Slocator PL(pm(),EK);
+      return PL.ray_shoot(EK.construct_segment(ep,eq),INSKEL());
+    }
+    CGAL_error_msg("location mode not implemented.");
+    return Object_handle();
+  }
+
+
+  Explorer explorer() const { return Explorer(pm(),EK); }
+  /*{\Mop returns a decorator object which allows read-only access of
+  the underlying plane map. See the manual page |Explorer| for its 
+  usage.}*/
+
+
+  /*{\Mimplementation Nef polyhedra are implemented on top of a halfedge
+  data structure and use linear space in the number of vertices, edges
+  and facets.  Operations like |empty| take constant time. The
+  operations |clear|, |complement|, |interior|, |closure|, |boundary|,
+  |regularization|, input and output take linear time. All binary set
+  operations and comparison operations take time $O(n \log n)$ where $n$
+  is the size of the output plus the size of the input.
+
+  The point location and ray shooting operations are implemented in
+  two flavors. The |NAIVE| operations run in linear query time without
+  any preprocessing, the |DEFAULT| operations (equals |LMWT|) run in
+  sub-linear query time, but preprocessing is triggered with the first
+  operation. Preprocessing takes time $O(N^2)$, the sub-linear point
+  location time is either logarithmic when LEDA's persistent
+  dictionaries are present or if not then the point location time is
+  worst-case linear, but experiments show often sublinear runtimes.  Ray
+  shooting equals point location plus a walk in the constrained
+  triangulation overlayed on the plane map representation. The cost of
+  the walk is proportional to the number of triangles passed in
+  direction |d| until an obstacle is met. In a minimum weight
+  triangulation of the obstacles (the plane map representing the
+  polyhedron) the theory provides a $O(\sqrt{n})$ bound for the number
+  of steps. Our locally minimum weight triangulation approximates the
+  minimum weight triangulation only heuristically (the calculation of
+  the minimum weight triangulation is conjectured to be NP hard). Thus
+  we have no runtime guarantee but a strong experimental motivation for
+  its approximation.}*/
+
+  /*{\Mexample Nef polyhedra are parameterized by a so-called extended
+  geometric kernel. There are three kernels, one based on a homogeneous
+  representation of extended points called |Extended_homogeneous<RT>|
+  where |RT| is a ring type providing additionally a |gcd| operation and
+  one based on a cartesian representation of extended points called
+  |Extended_cartesian<NT>| where |NT| is a field type, and finally
+  |Filtered_extended_homogeneous<RT>| (an optimized version of the
+  first).
+
+  The member types of |Nef_polyhedron_2< Extended_homogeneous<NT> >|
+  map to corresponding types of the CGAL geometry kernel
+  (e.g. |Nef_polyhedron::Line| equals
+  |CGAL::Homogeneous<leda_integer>::Line_2| in the example below).
+  \begin{Mverb}
+  #include <CGAL/basic.h>
+  #include <CGAL/leda_integer.h>
+  #include <CGAL/Extended_homogeneous.h>
+  #include <CGAL/Nef_polyhedron_2.h>
+
+  using namespace CGAL;
+  typedef  Extended_homogeneous<leda_integer> Extended_kernel;
+  typedef  Nef_polyhedron_2<Extended_kernel>  Nef_polyhedron;
+  typedef  Nef_polyhedron::Line               Line;
+
+  int main()
+  {
+    Nef_polyhedron N1(Line(1,0,0));
+    Nef_polyhedron N2(Line(0,1,0), Nef_polyhedron::EXCLUDED);
+    Nef_polyhedron N3 = N1 * N2; // line (*)
+    return 0;
+  }
+  \end{Mverb}
+  After line (*) |N3| is the intersection of |N1| and |N2|.}*/
+
+
+}; // end of Nef_polyhedron_2
+
+template <typename T, typename Items, typename Mark>
+T Nef_polyhedron_2<T,Items,Mark>::EK;
+
+
+template <typename T, typename Items, typename Mark>
+const typename Nef_polyhedron_2<T,Items,Mark>::Polygons Nef_polyhedron_2<T,Items,Mark>::POLYGONS = typename Nef_polyhedron_2<T,Items,Mark>::Polygons();
+
+template <typename T, typename Items, typename Mark>
+const typename Nef_polyhedron_2<T,Items,Mark>::Polylines Nef_polyhedron_2<T,Items,Mark>::POLYLINES = typename Nef_polyhedron_2<T,Items,Mark>::Polylines();
+
+template <typename T, typename Items, typename Mark>
+std::ostream& operator<<
+ (std::ostream& os, const Nef_polyhedron_2<T,Items,Mark>& NP)
+{
+  os << "Nef_polyhedron_2<" << NP.EK.output_identifier() << ">\n";
+  typedef typename Nef_polyhedron_2<T,Items,Mark>::Decorator Decorator;
+  CGAL::PM_io_parser<Decorator> O(os, NP.pm()); O.print();
+  return os;
+}
+
+template <typename T, typename Items, typename Mark>
+std::istream& operator>>
+  (std::istream& is, Nef_polyhedron_2<T,Items,Mark>& NP)
+{
+  typedef typename Nef_polyhedron_2<T,Items,Mark>::Decorator Decorator;
+  CGAL::PM_io_parser<Decorator> I(is, NP.pm()); 
+  if (I.check_sep("Nef_polyhedron_2<") &&
+      I.check_sep(NP.EK.output_identifier()) &&
+      I.check_sep(">")) I.read();
+  else {
+    std::cerr << "Nef_polyhedron_2 input corrupted." << std::endl;
+    NP = Nef_polyhedron_2<T,Items,Mark>();
+  }
+  typename Nef_polyhedron_2<T,Items,Mark>::Topological_explorer D(NP.explorer());
+  D.check_integrity_and_topological_planarity();
+  return is;
+}
+
+
+
+} //namespace CGAL
+
+#if defined(BOOST_MSVC)
+#  pragma warning(pop)
+#endif
+
+#endif //CGAL_NEF_POLYHEDRON_2_H
diff --git a/3rdparty/CGAL/include/CGAL/Nef_polyhedron_3.h b/3rdparty/CGAL/include/CGAL/Nef_polyhedron_3.h
new file mode 100644
index 0000000..9f3c59b
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Nef_polyhedron_3.h
@@ -0,0 +1,2104 @@
+// Copyright (c) 1997-2002,2005 Max-Planck-Institute Saarbruecken (Germany).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Michael Seel    <seel at mpi-sb.mpg.de>
+//                 Miguel Granados <granados at mpi-sb.mpg.de>
+//                 Susan Hert      <hert at mpi-sb.mpg.de>
+//                 Lutz Kettner    <kettner at mpi-sb.mpg.de>
+//                 Ralf Osbild     <osbild at mpi-sb.mpg.de>
+//                 Peter Hachenberger <hachenberger at mpi-sb.mpg.de>
+#ifndef CGAL_NEF_POLYHEDRON_3_H
+#define CGAL_NEF_POLYHEDRON_3_H
+
+#include <CGAL/basic.h>
+#include <CGAL/Handle_for.h>
+#include <CGAL/Nef_3/Default_items.h>
+#include <CGAL/Nef_3/SNC_structure.h>
+#include <CGAL/Nef_3/SNC_decorator.h>
+#include <CGAL/Nef_3/SNC_const_decorator.h>
+#include <CGAL/Nef_3/SNC_constructor.h>
+#include <CGAL/Nef_3/SNC_external_structure.h>
+#include <CGAL/Nef_3/Combine_with_halfspace.h>
+#ifdef CGAL_NEF_VISUAL_HULL
+#include <CGAL/Nef_3/Binary_operation_vs.h>
+#else
+#include <CGAL/Nef_3/Binary_operation.h>
+#endif
+#include <CGAL/Nef_S2/SM_decorator.h>
+#include <CGAL/Nef_S2/SM_const_decorator.h>
+#include <CGAL/Nef_3/SNC_SM_overlayer.h>
+#include <CGAL/Nef_S2/SM_point_locator.h>
+#include <CGAL/Nef_3/SNC_SM_explorer.h>
+#include <CGAL/Nef_polyhedron_S2.h>
+#include <CGAL/Modifier_base.h>
+#include <CGAL/Nef_3/Mark_bounded_volumes.h>
+
+#include <CGAL/IO/Verbose_ostream.h>
+#include <CGAL/Nef_3/polyhedron_3_to_nef_3.h>
+#include <CGAL/Nef_3/shell_to_nef_3.h>
+#include <CGAL/Polyhedron_incremental_builder_3.h>
+#include <CGAL/Polyhedron_3.h>
+#include <CGAL/Nef_3/SNC_point_locator.h>
+#include <CGAL/assertions.h>
+
+#include <CGAL/Constrained_triangulation_2.h>
+#include <CGAL/Triangulation_data_structure_2.h>
+#include <CGAL/Projection_traits_xy_3.h>
+#include <CGAL/Projection_traits_yz_3.h>
+#include <CGAL/Projection_traits_xz_3.h>
+#include <CGAL/Constrained_triangulation_face_base_2.h>
+#include <list>
+
+// RO: includes for "vertex cycle to Nef" constructor
+#include <CGAL/Nef_3/vertex_cycle_to_nef_3.h>
+#include <CGAL/Vector_3.h>
+#include <CGAL/normal_vector_newell_3.h>
+
+#ifdef CGAL_NEF_VISUAL_HULL
+#include <CGAL/Nef_3/Modifying_binary_operation_vs.h>
+#endif
+
+#undef CGAL_NEF_DEBUG
+#define CGAL_NEF_DEBUG 11
+#include <CGAL/Nef_2/debug.h>
+
+namespace CGAL {
+
+template <typename K, typename I, typename M> class Nef_polyhedron_3;
+template <typename K, typename I, typename M> class Nef_polyhedron_3_rep;
+
+template <typename K, typename I, typename M>
+std::ostream& operator<<(std::ostream& os, Nef_polyhedron_3<K,I,M>& NP);
+
+template <typename K, typename I, typename M>
+std::istream& operator>>(std::istream& os, Nef_polyhedron_3<K,I,M>& NP);
+
+
+template <typename K, typename I, typename M>
+class Nef_polyhedron_3_rep 
+{ 
+  typedef Nef_polyhedron_3_rep<K,I,M>                  Self;
+  friend class Nef_polyhedron_3<K,I,M>;
+ public:
+  typedef CGAL::SNC_structure<K,I,M>                      SNC_structure;
+  typedef CGAL::SNC_decorator<SNC_structure>              SNC_decorator;
+  typedef CGAL::SNC_const_decorator<SNC_structure>        SNC_const_decorator;
+  typedef CGAL::Binary_operation<SNC_structure>           Binary_operation;
+  typedef CGAL::SNC_constructor<I, SNC_structure>         SNC_constructor;
+  typedef CGAL::SNC_external_structure<I, SNC_structure>  SNC_external_structure;
+  typedef CGAL::SNC_point_locator<SNC_decorator> SNC_point_locator;
+  typedef CGAL::SNC_simplify<I, SNC_structure>            SNC_simplify;
+  typedef CGAL::SNC_point_locator_by_spatial_subdivision<SNC_decorator> SNC_point_locator_default;
+
+  typedef typename SNC_structure::Sphere_map       Sphere_map;
+  typedef CGAL::SM_decorator<Sphere_map>           SM_decorator;
+  typedef CGAL::SM_const_decorator<Sphere_map>     SM_const_decorator;
+  typedef CGAL::SNC_SM_overlayer<I, SM_decorator>  SM_overlayer;
+  typedef CGAL::SM_point_locator<SNC_structure>    SM_point_locator;
+
+ private:
+  SNC_structure snc_;
+  SNC_point_locator* pl_;
+  
+ public:
+  Nef_polyhedron_3_rep() : snc_(), pl_() {}
+  ~Nef_polyhedron_3_rep() { 
+    CGAL_NEF_TRACEN( "Nef_polyhedron_3_rep: destroying SNC structure "<<&snc_<<
+	    ", point locator "<<pl_);
+    snc_.clear(); 
+    delete pl_; 
+  }
+};
+
+/*{\Manpage {Nef_polyhedron_3} {T} {Nef Polyhedra in Space}{N}}*/
+
+/*{\Mdefinition
+An instance of data type |\Mname| is a subset of 3-space which is the
+result of forming complements and intersections starting from a set |H| of
+halfspaces. |\Mtype| is closed under all binary set opertions |intersection|,
+|union|, |difference|, |complement| and under the topological operations
+|boundary|, |closure|, and |interior|.}*/
+
+template <typename Kernel_, typename Items_ = typename CGAL::Default_items<Kernel_>::Items, typename Mark_ = bool>
+class Nef_polyhedron_3 : public CGAL::Handle_for< Nef_polyhedron_3_rep<Kernel_, Items_, Mark_> >, 
+			 public SNC_const_decorator<SNC_structure<Kernel_,Items_,Mark_> >
+{ 
+ public:
+  /*{\Mtypes 7}*/  
+  
+  typedef Kernel_                                     Kernel;
+  typedef Kernel_                                     Traits;
+  typedef Items_                                      Items;
+  typedef Mark_                                       Mark;
+  typedef Nef_polyhedron_3<Kernel, Items, Mark>       Self;
+  typedef Nef_polyhedron_3<Kernel, Items, Mark>       Nef_polyhedron;
+  typedef Handle_for< Nef_polyhedron_3_rep<Kernel, Items, Mark> >   Base;
+  typedef typename Kernel::Point_3                    Point_3;
+  typedef typename Kernel::Plane_3                    Plane_3;
+  typedef typename Kernel::Vector_3                   Vector_3;
+  typedef typename Kernel::Segment_3                  Segment_3;
+  typedef typename Kernel::Aff_transformation_3       Aff_transformation_3;
+
+#ifndef _MSC_VER
+  // VC++ has a problem to digest the following typedef,
+  // and does not need the using statements -- AF
+  // The left and right part of these typedefs have the same name. It is
+  // very important to qualify the left part with the CGAL:: namespace, no
+  // to confuse g++. -- Laurent Rineau, 2010/09/13
+  typedef CGAL::SNC_structure<Kernel,Items,Mark> SNC_structure;
+  typedef CGAL::SNC_const_decorator<SNC_structure> SNC_const_decorator;
+  using SNC_const_decorator::set_snc;
+  using SNC_const_decorator::is_standard;
+  using SNC_const_decorator::is_bounded;
+#endif
+
+  struct Polylines_tag {};
+  struct Points_tag {};
+
+  enum Boundary { EXCLUDED=0, INCLUDED=1 };
+  /*{\Menum construction selection.}*/
+
+  typedef enum { EMPTY=0, COMPLETE=1 } Content;
+  /*{\Menum construction selection}*/
+
+  typedef enum { DEFAULT, NAIVE, WALKING, SPATIAL_SUBDIVISION  } Location_mode;
+  /*{\Menum selection flag for the point location mode.}*/
+
+protected: 
+  struct AND {
+    Mark operator()(const Mark& b1, const Mark& b2, bool /* inverted */ =false)const 
+    { return b1&&b2; } 
+  };
+
+  struct OR {
+    Mark operator()(const Mark& b1, const Mark& b2, bool /* inverted */ =false) const
+    { return b1||b2; } 
+  };
+
+  struct DIFF {
+    Mark operator()(const Mark& b1, const Mark& b2, bool inverted=false) const 
+    { return (inverted) ? !b1&&b2  :  b1&&!b2 ; }
+  };
+
+  struct XOR {
+    Mark operator()(const Mark& b1, const Mark& b2, bool /* inverted */ =false) const 
+    { return (b1&&!b2)||(!b1&&b2); } 
+  };
+
+ public:
+  typedef Nef_polyhedron_3_rep<Kernel,Items, Mark>    Nef_rep;
+
+  typedef typename Nef_rep::SM_decorator        SM_decorator;
+  typedef typename Nef_rep::SM_const_decorator  SM_const_decorator;
+ protected:
+  typedef typename Nef_rep::SNC_decorator       SNC_decorator;
+  typedef typename Nef_rep::SNC_constructor     SNC_constructor;
+  typedef typename Nef_rep::SNC_external_structure SNC_external_structure;
+  typedef typename Nef_rep::Binary_operation    Binary_operation;
+  typedef typename Nef_rep::SNC_point_locator   SNC_point_locator;
+  typedef typename Nef_rep::SNC_point_locator_default
+    SNC_point_locator_default;
+  typedef CGAL::Combine_with_halfspace<SNC_structure, SNC_point_locator> 
+          Combine_with_halfspace;
+public:
+ enum Intersection_mode { 
+	 CLOSED_HALFSPACE = Combine_with_halfspace::CLOSED_HALFSPACE, 
+     OPEN_HALFSPACE = Combine_with_halfspace::OPEN_HALFSPACE, 
+     PLANE_ONLY = Combine_with_halfspace::PLANE_ONLY};
+
+protected: 
+  typedef typename Nef_rep::SM_overlayer        SM_overlayer;
+  typedef typename Nef_rep::SM_point_locator    SM_point_locator;
+  typedef typename Nef_rep::SNC_simplify        SNC_simplify;
+
+ typedef typename Nef_rep::Sphere_map                Sphere_map;
+ public:
+ typedef CGAL::Nef_polyhedron_S2<Kernel,Items,Mark,Sphere_map> Nef_polyhedron_S2;
+ protected:
+
+  SNC_structure& snc() { return this->ptr()->snc_; } 
+  const SNC_structure& snc() const { return this->ptr()->snc_; } 
+
+  SNC_point_locator*& pl() { return this->ptr()->pl_; }
+  const SNC_point_locator* pl() const { return this->ptr()->pl_; }
+
+  friend std::ostream& operator<< <>
+      (std::ostream& os, Nef_polyhedron_3<Kernel,Items, Mark>& NP);
+  friend std::istream& operator>> <>
+      (std::istream& is, Nef_polyhedron_3<Kernel,Items, Mark>& NP);
+
+  typedef typename SNC_decorator::Vertex_handle    Vertex_handle;
+  typedef typename SNC_decorator::Halfedge_handle  Halfedge_handle;
+  typedef typename SNC_decorator::Halffacet_handle
+                                                   Halffacet_handle;
+  typedef typename SNC_decorator::Volume_handle    Volume_handle;
+
+ public:
+  typedef typename SNC_structure::Sphere_point                 Sphere_point;
+  typedef typename SNC_structure::Sphere_segment               Sphere_segment;
+  typedef typename SNC_structure::Sphere_circle                Sphere_circle;
+  typedef typename SNC_structure::Vertex_base                  Vertex;
+  typedef typename SNC_structure::Halfedge_base                Halfedge;
+  typedef typename SNC_structure::Halffacet_base               Halffacet;
+  typedef typename SNC_structure::Volume_base                  Volume;
+  typedef typename SNC_structure::Vertex_const_handle          Vertex_const_handle;
+  typedef typename SNC_structure::Halfedge_const_handle        Halfedge_const_handle;
+  typedef typename SNC_structure::Halffacet_const_handle       Halffacet_const_handle;
+  typedef typename SNC_structure::Volume_const_handle          Volume_const_handle;
+  typedef typename SNC_structure::SHalfedge_around_svertex_circulator 
+                                  SHalfedge_around_svertex_circulator;
+  typedef typename SNC_structure::SHalfedge_around_svertex_const_circulator 
+                                  SHalfedge_around_svertex_const_circulator;
+  typedef typename SNC_structure::SHalfedge_around_facet_circulator 
+                                  SHalfedge_around_facet_circulator;
+  typedef typename SNC_structure::SHalfedge_around_facet_const_circulator 
+                                  SHalfedge_around_facet_const_circulator;
+  typedef typename SNC_structure::SHalfedge_around_sface_const_circulator 
+                                  SHalfedge_around_sface_const_circulator;
+  typedef typename SNC_structure::Halffacet_cycle_const_iterator     
+                                  Halffacet_cycle_const_iterator;
+  typedef typename SNC_structure::Halffacet_cycle_iterator     
+                                  Halffacet_cycle_iterator;
+  typedef typename SNC_structure::Infi_box                     Infi_box;
+  typedef typename SNC_structure::Size_type Size_type;
+  typedef Size_type                         size_type;
+
+  typedef typename Kernel::RT                       RT;
+
+ public:
+  typedef typename SM_decorator::SVertex_handle    SVertex_handle;
+  typedef typename SM_decorator::SHalfedge_handle  SHalfedge_handle;
+  typedef typename SM_decorator::SFace_handle      SFace_handle;
+  typedef typename SM_decorator::SVertex_const_handle
+                                                   SVertex_const_handle;
+  typedef typename SM_decorator::SHalfedge_const_handle
+                                                   SHalfedge_const_handle;
+  typedef typename SM_decorator::SHalfloop_const_handle
+                                                   SHalfloop_const_handle;
+  typedef typename SM_decorator::SFace_const_handle
+                                                   SFace_const_handle;
+  typedef typename SNC_decorator::Vertex_iterator  Vertex_iterator;
+  typedef typename SNC_decorator::Halfedge_iterator
+                                                   Halfedge_iterator;
+  typedef typename SNC_decorator::Halffacet_iterator
+                                                   Halffacet_iterator;
+  typedef typename SNC_structure::Shell_entry_iterator
+                                                   Shell_entry_iterator;
+  typedef typename SNC_decorator::Volume_iterator  Volume_iterator;
+  typedef typename SNC_structure::Vertex_const_iterator
+                                                    Vertex_const_iterator;
+  typedef typename SNC_structure::Halfedge_const_iterator 
+                                                   Halfedge_const_iterator;
+  typedef typename SNC_structure::Halffacet_const_iterator     
+                                                   Halffacet_const_iterator;
+  typedef typename SNC_structure::Volume_const_iterator     
+                                                   Volume_const_iterator;
+  typedef typename SNC_structure::Shell_entry_const_iterator
+                                                   Shell_entry_const_iterator;
+  typedef typename SM_decorator::SVertex_iterator  SVertex_iterator;
+  typedef typename SM_decorator::SHalfedge_iterator
+                                                   SHalfedge_iterator;
+  typedef typename SM_decorator::SHalfloop_iterator
+                                                   SHalfloop_iterator;
+  typedef typename SM_decorator::SFace_iterator    SFace_iterator;
+  typedef typename SM_decorator::SVertex_const_iterator
+                                                   SVertex_const_iterator;
+  typedef typename SM_decorator::SHalfedge_const_iterator 
+                                                   SHalfedge_const_iterator;
+  typedef typename SM_decorator::SHalfloop_const_iterator 
+                                                   SHalfloop_const_iterator;
+  typedef typename SM_decorator::SFace_const_iterator     
+                                                   SFace_const_iterator;
+  typedef typename SNC_decorator::SFace_cycle_const_iterator     
+                                                   SFace_cycle_const_iterator;
+
+  typedef typename SNC_decorator::Association  Association;
+
+
+ protected: 
+  void initialize_infibox_vertices(Content space) {
+    SNC_constructor C(snc()); 
+    Infi_box::initialize_infibox_vertices(C, space == COMPLETE);
+  }
+
+  void check_h_for_intersection_of_12_cube_edges_and_add_vertices
+  (const Plane_3& p);
+  void create_intersection_vertex_of_h_and_e();
+  void init_cube_vertices_depending_on_h(const Plane_3& p);
+  void add_h_to_local_view_of_v();
+  
+ public:
+  void build_external_structure() {
+    SNC_external_structure es(snc(), pl());
+    es.build_external_structure();
+  }
+
+ public:
+  /*{\Mcreation 3}*/
+
+  Nef_polyhedron_3( Content space = EMPTY);
+		   
+  /*{\Mcreate creates an instance |\Mvar| of type |\Mname|
+  and initializes it to the empty set if |space == EMPTY|
+  and to the whole space if |space == COMPLETE|.}*/
+
+  explicit Nef_polyhedron_3(const Plane_3& p, Boundary b = INCLUDED);
+  /*{\Mcreate creates a Nef polyhedron |\Mvar| containing the
+  halfspace on the negative side of |p| including |p| if |b==INCLUDED|,
+  excluding |p| if |b==EXCLUDED|.}*/
+
+  Nef_polyhedron_3(const Nef_polyhedron_3<Kernel,Items, Mark>& N1) 
+ : Base(N1) , SNC_const_decorator() {
+    set_snc(snc());
+  } 
+
+  Nef_polyhedron_3& operator=(const Nef_polyhedron_3<Kernel,Items, Mark>& N1) { 
+    Base::operator=(N1);
+    set_snc(snc());
+    return (*this); 
+  }
+
+  ~Nef_polyhedron_3() { 
+    CGAL_NEF_TRACEN("~Nef_polyhedron_3: destructor called for snc "<<&snc()<<
+	   ", pl "<<pl());
+  }
+
+   // RO: "vertex cycle to Nef" constructor (main part)
+   // II input iterator; KN kernel of normal (may differ from Nef kernel)
+   template <class II, class KN>
+   Nef_polyhedron_3 (II v_first, II v_last,
+                    const CGAL::Vector_3<KN> &normal, bool verb = false)
+   {  CGAL_NEF_TRACEN("construction from vertex cycle (main part)");
+
+      // project and triangulate vertices,
+      // convert result to Nef_polyhedron
+      CGAL_precondition (!CGAL::is_empty_range (v_first, v_last));
+      bool is_nef = vertex_cycle_to_nef_3<Nef_polyhedron> (snc(),
+         v_first, v_last, normal, verb);
+      if (is_nef)
+      {
+	 // TO DO:
+	 // Wie kann der eigene point_locator pl() eingebunden werden?
+	 // Wie kann der Konstruktor umgangen werden?
+         typedef CGAL::SNC_point_locator_by_spatial_subdivision
+            <CGAL::SNC_decorator<SNC_structure> >    Point_locator;
+
+         Point_locator Pl;
+         SNC_external_structure es(snc(), &Pl);
+         es.build_external_structure();
+         *this = Nef_polyhedron(snc(), &Pl);
+      }
+      else
+      {  *this = Nef_polyhedron();
+      }
+      set_snc (snc());
+      CGAL_expensive_postcondition (is_valid());
+   }
+
+   // RO: "vertex cycle to Nef" constructor (normal computation)
+   template <class II>
+   Nef_polyhedron_3 (II v_first, II v_last, bool verb = false)
+   {  CGAL_NEF_TRACEN("construction from vertex cycle (normal computation)");
+
+      // compute normal vector
+      CGAL_precondition (!CGAL::is_empty_range (v_first, v_last));
+      CGAL::Vector_3<typename II::value_type::R> normal;
+      normal_vector_newell_3 (v_first, v_last, normal);
+
+      // call "main" constructor
+      *this = Nef_polyhedron_3 (v_first, v_last, normal, verb);
+      set_snc (snc());
+   }
+  
+ template<typename Items, typename SNC_structure>
+ class Sphere_map_creator {
+   typedef typename SNC_structure::SM_decorator     SM_decorator;
+   typedef typename SNC_structure::Vertex_handle    Vertex_handle;
+   typedef typename SNC_structure::SVertex_handle   SVertex_handle;
+   typedef typename SNC_structure::SFace_handle     SFace_handle;
+   typedef typename SNC_structure::Sphere_point     Sphere_point;
+   
+   public:
+   Sphere_map_creator() {}
+   
+   template<typename point_iterator>
+   void create_end_sphere_map(SNC_structure& snc,
+			      point_iterator cur,
+			      point_iterator prev) {
+     Vertex_handle v(snc.new_vertex(*cur, true));
+     SM_decorator SM(&*v);
+     SVertex_handle sv(v->new_svertex(Sphere_point(ORIGIN+(*prev-*cur)),
+				      true));
+     SFace_handle sf(v->new_sface());
+     SM.link_as_isolated_vertex(sv,sf);
+   }
+   
+   template<typename point_iterator>
+   void create_sphere_map(SNC_structure& snc,
+			  point_iterator cur,
+			  point_iterator prev,
+			  point_iterator next) {
+     Vertex_handle v(snc.new_vertex(*cur, true));
+     SM_decorator SM(&*v);
+     SVertex_handle sv1(v->new_svertex(Sphere_point(ORIGIN+(*prev-*cur)),
+				       true));
+     SVertex_handle sv2(v->new_svertex(Sphere_point(ORIGIN+(*next-*cur)),
+				       true));      
+     SFace_handle sf(v->new_sface());
+     SM.link_as_isolated_vertex(sv1,sf);
+     SM.link_as_isolated_vertex(sv2,sf);
+   }
+ };
+ 
+ template<typename SNC_structure>
+ class Sphere_map_creator<CGAL::SNC_indexed_items, SNC_structure> {
+   typedef typename SNC_structure::SM_decorator     SM_decorator;
+   typedef typename SNC_structure::Vertex_handle    Vertex_handle;
+   typedef typename SNC_structure::SVertex_handle   SVertex_handle;
+   typedef typename SNC_structure::SFace_handle     SFace_handle;
+   typedef typename SNC_structure::Sphere_point     Sphere_point;
+   
+   bool first;
+   int index;
+ public:
+   Sphere_map_creator() : first(true), index(0) {}
+     
+     template<typename point_iterator>
+       void create_end_sphere_map(SNC_structure& snc,
+				  point_iterator cur,
+				  point_iterator prev) {
+       Vertex_handle v(snc.new_vertex(*cur, true));
+       SM_decorator SM(&*v);
+       SVertex_handle sv(v->new_svertex(Sphere_point(ORIGIN+(*prev-*cur)),
+					true));
+       SFace_handle sf(v->new_sface());
+       SM.link_as_isolated_vertex(sv,sf);
+       if(first) {
+	 sv->set_index();
+	 index = sv->get_index();
+	 first = false;
+       } else
+	 sv->set_index(index);
+     }
+     
+     template<typename point_iterator>
+       void create_sphere_map(SNC_structure& snc,
+			      point_iterator cur,
+			      point_iterator prev,
+			      point_iterator next) {
+       Vertex_handle v(snc.new_vertex(*cur, true));
+       SM_decorator SM(&*v);
+       SVertex_handle sv1(v->new_svertex(Sphere_point(ORIGIN+(*prev-*cur)),
+					 true));
+       SVertex_handle sv2(v->new_svertex(Sphere_point(ORIGIN+(*next-*cur)),
+					 true));      
+       SFace_handle sf(v->new_sface());
+       SM.link_as_isolated_vertex(sv1,sf);
+       SM.link_as_isolated_vertex(sv2,sf);
+       sv1->set_index(index);
+       sv2->set_index();
+       index = sv2->get_index();
+     }
+ };
+ 
+ template <typename InputIterator>
+ Nef_polyhedron_3(InputIterator begin, InputIterator end, Polylines_tag) {
+   typedef typename std::iterator_traits<InputIterator>::value_type
+     point_iterator_pair;
+   typedef typename point_iterator_pair::first_type
+     point_iterator;
+
+   empty_rep();
+   set_snc(snc());
+   initialize_infibox_vertices(EMPTY);
+
+   point_iterator pbegin, pend, pnext, pprev;
+   Sphere_map_creator<Items, SNC_structure> smc;
+   for(;begin != end; ++begin) {
+     pend = begin->second;
+     pprev = pnext = pbegin = begin->first;
+     ++pnext;
+     CGAL_assertion(pnext != pend);
+     smc.create_end_sphere_map(snc(),pbegin,pnext);
+     for(++pbegin,++pnext; pnext!=pend; ++pbegin,++pprev,++pnext)
+       smc.create_sphere_map(snc(),pbegin,pprev,pnext);
+     smc.create_end_sphere_map(snc(),pbegin,pprev);
+   }
+   build_external_structure();
+   simplify();
+ }
+
+ explicit
+ Nef_polyhedron_3(const Segment_3& s) {
+   empty_rep();
+   set_snc(snc());
+   initialize_infibox_vertices(EMPTY);
+
+   Sphere_map_creator<Items, SNC_structure> smc;
+   std::vector<Point_3> endpoints(2);
+   endpoints[0]=s.source();
+   endpoints[1]=s.target();
+   smc.create_end_sphere_map(snc(),&endpoints[0],&endpoints[1]);
+   smc.create_end_sphere_map(snc(),&endpoints[1],&endpoints[0]);
+
+   build_external_structure();
+   simplify();
+ }
+
+ template <typename InputIterator>
+ Nef_polyhedron_3(InputIterator begin, InputIterator end, Points_tag) {
+   empty_rep();
+   set_snc(snc());
+   initialize_infibox_vertices(EMPTY);
+
+   for(InputIterator it=begin; it!=end;++it)
+   {
+     Vertex_handle v(snc().new_vertex(*it, true));
+     SM_decorator SM(&*v);
+     v->new_sface();
+   }
+   build_external_structure();
+   simplify();
+ }
+
+ explicit
+ Nef_polyhedron_3(const Point_3& p) {
+   empty_rep();
+   set_snc(snc());
+   initialize_infibox_vertices(EMPTY);
+
+   Vertex_handle v(snc().new_vertex(p, true));
+   SM_decorator SM(&*v);
+   v->new_sface();
+
+   build_external_structure();
+   simplify();
+ }
+
+ template <class T1, class T2,
+           template <class T31, class T32, class T33>
+           class T3, class T4 >
+ Nef_polyhedron_3( CGAL::Polyhedron_3<T1,T2,T3,T4>& P) {
+    CGAL_NEF_TRACEN("construction from Polyhedron_3");
+    SNC_structure rsnc;
+    *this = Nef_polyhedron_3(rsnc, new SNC_point_locator_default, false);
+    initialize_infibox_vertices(EMPTY);
+    polyhedron_3_to_nef_3
+      <CGAL::Polyhedron_3<T1,T2,T3,T4>, SNC_structure>( P, snc());
+    build_external_structure();
+    simplify();
+    CGAL::Mark_bounded_volumes<Nef_polyhedron_3> mbv(true);
+    delegate(mbv);
+    set_snc(snc());
+  }
+  
+ Nef_polyhedron_3(const Nef_polyhedron& N, 
+		  SFace_const_iterator sf) 
+ {
+   SNC_structure rsnc;
+   *this = Nef_polyhedron_3(rsnc, new SNC_point_locator_default, false);
+   initialize_infibox_vertices(EMPTY);
+   shell_to_nef_3(N, sf, snc());
+   build_external_structure();
+   simplify();
+   CGAL::Mark_bounded_volumes<Nef_polyhedron_3> mbv(true);
+   delegate(mbv);
+   set_snc(snc());
+ }
+
+
+ protected: 
+
+  template<typename Kernel>
+  class Triangulation_handler2 {
+
+    typedef typename CGAL::Triangulation_vertex_base_2<Kernel>               Vb;
+    typedef typename CGAL::Constrained_triangulation_face_base_2<Kernel>     Fb;
+    typedef typename CGAL::Triangulation_data_structure_2<Vb,Fb>             TDS;
+    typedef typename CGAL::Constrained_triangulation_2<Kernel,TDS>           CT;
+
+    typedef typename CT::Face_handle           Face_handle;
+    typedef typename CT::Vertex_handle         CTVertex_handle;
+    typedef typename CT::Finite_faces_iterator Finite_face_iterator;
+    typedef typename CT::Edge                  Edge;
+
+    CT ct;
+    CGAL::Unique_hash_map<Face_handle, bool> visited;
+    CGAL::Unique_hash_map<CTVertex_handle, Vertex_const_handle> ctv2v;
+    Finite_face_iterator fi;
+    Plane_3 supporting_plane;
+
+  public:
+    Triangulation_handler2(Halffacet_const_handle f) : 
+      visited(false), supporting_plane(f->plane()) {
+
+      Halffacet_cycle_const_iterator fci;
+      for(fci=f->facet_cycles_begin(); fci!=f->facet_cycles_end(); ++fci) {
+	if(fci.is_shalfedge()) {
+          SHalfedge_around_facet_const_circulator sfc(fci), send(sfc);
+	  CGAL_For_all(sfc,send) {
+            CGAL_NEF_TRACEN("  insert point" << sfc->source()->source()->point());
+	    CTVertex_handle ctv = ct.insert(sfc->source()->source()->point());
+	    ctv2v[ctv] = sfc->source()->source();
+          }
+        }
+      }
+
+      for(fci=f->facet_cycles_begin(); fci!=f->facet_cycles_end(); ++fci) {
+	if(fci.is_shalfedge()) {
+          SHalfedge_around_facet_const_circulator sfc(fci), send(sfc);
+	  CGAL_For_all(sfc,send) {
+            CGAL_NEF_TRACEN("  insert constraint" << sfc->source()->source()->point()
+	                     << "->" << sfc->source()->twin()->source()->point());
+	    ct.insert_constraint(sfc->source()->source()->point(),
+	                         sfc->source()->twin()->source()->point());
+          }
+        }
+      }
+      CGAL_assertion(ct.is_valid());
+
+      CGAL_NEF_TRACEN("number of finite triangles " << ct.number_of_faces());
+
+      typename CT::Face_handle infinite = ct.infinite_face();
+      typename CT::Vertex_handle ctv = infinite->vertex(1);
+      if(ct.is_infinite(ctv)) ctv = infinite->vertex(2);
+      CGAL_assertion(!ct.is_infinite(ctv));
+
+      typename CT::Face_handle opposite;
+      typename CT::Face_circulator vc(ctv,infinite);
+      do { opposite = vc++;
+      } while(!ct.is_constrained(typename CT::Edge(vc,vc->index(opposite))));
+      typename CT::Face_handle first = vc;
+
+      CGAL_assertion(!ct.is_infinite(first));
+      traverse_triangulation(first, first->index(opposite));
+
+      fi = ct.finite_faces_begin();
+    }
+
+    void traverse_triangulation(Face_handle f, int parent) {
+      visited[f] = true;
+      if(!ct.is_constrained(Edge(f,ct.cw(parent))) && !visited[f->neighbor(ct.cw(parent))]) {
+	Face_handle child(f->neighbor(ct.cw(parent)));
+	traverse_triangulation(child, child->index(f));
+      } 
+      if(!ct.is_constrained(Edge(f,ct.ccw(parent))) && !visited[f->neighbor(ct.ccw(parent))]) {
+	Face_handle child(f->neighbor(ct.ccw(parent)));
+	traverse_triangulation(child, child->index(f));
+      } 
+    } 
+ 
+    template<typename Triangle_3>
+    bool get_next_triangle(Triangle_3& tr) {
+      while(fi != ct.finite_faces_end() && visited[fi] == false) ++fi;
+      if(fi == ct.finite_faces_end()) return false;
+      tr = Triangle_3(fi->vertex(0)->point(), fi->vertex(1)->point(), fi->vertex(2)->point());
+      ++fi;
+      return true;
+    }
+
+    bool same_orientation(Plane_3 p1) const {
+      if(p1.a() != 0)
+	return CGAL::sign(p1.a()) == CGAL::sign(supporting_plane.a());
+      if(p1.b() != 0)
+	return CGAL::sign(p1.b()) == CGAL::sign(supporting_plane.b());
+      return CGAL::sign(p1.c()) == CGAL::sign(supporting_plane.c());
+    }
+
+    template<typename PIB, typename Index>
+    void handle_triangles(PIB& pib, Index& VI) {
+      while(fi != ct.finite_faces_end() && visited[fi] == false) ++fi;
+      while(fi != ct.finite_faces_end()) {
+	Plane_3 plane(fi->vertex(0)->point(),
+		      fi->vertex(1)->point(),
+		      fi->vertex(2)->point());
+	pib.begin_facet();
+	if(same_orientation(plane)) {
+	  pib.add_vertex_to_facet(VI[ctv2v[fi->vertex(0)]]);
+	  pib.add_vertex_to_facet(VI[ctv2v[fi->vertex(1)]]);
+	  pib.add_vertex_to_facet(VI[ctv2v[fi->vertex(2)]]);
+	} else {
+	  pib.add_vertex_to_facet(VI[ctv2v[fi->vertex(0)]]);
+	  pib.add_vertex_to_facet(VI[ctv2v[fi->vertex(2)]]);
+	  pib.add_vertex_to_facet(VI[ctv2v[fi->vertex(1)]]);
+	}
+	pib.end_facet();
+	do {
+	  ++fi;
+	} while(fi != ct.finite_faces_end() && visited[fi] == false);
+      }
+    }
+  };
+ 
+  template <class HDS>
+  class Build_polyhedron : public CGAL::Modifier_base<HDS> {
+    
+    class Visitor {
+
+      typedef typename CGAL::Projection_traits_xy_3<Kernel>       XY;
+      typedef typename CGAL::Projection_traits_yz_3<Kernel>       YZ;
+      typedef typename CGAL::Projection_traits_xz_3<Kernel>       XZ;
+
+      const Object_index<Vertex_const_iterator>& VI;
+      Polyhedron_incremental_builder_3<HDS>& B;
+      const SNC_const_decorator& D;
+      
+    public:
+      Visitor(Polyhedron_incremental_builder_3<HDS>& BB,
+	      const SNC_const_decorator& sd,
+	      Object_index<Vertex_const_iterator>& vi) : VI(vi), B(BB), D(sd){}
+
+      void visit(Halffacet_const_handle opposite_facet) {
+
+	CGAL_NEF_TRACEN("Build_polyhedron: visit facet " << opposite_facet->plane());
+ 
+	CGAL_assertion(Infi_box::is_standard(opposite_facet->plane()));
+	
+	SHalfedge_const_handle se;
+	Halffacet_cycle_const_iterator fc;
+     	
+	Halffacet_const_handle f = opposite_facet->twin();
+
+	SHalfedge_around_facet_const_circulator 
+	  sfc1(f->facet_cycles_begin()), sfc2(sfc1);
+	
+	if(++f->facet_cycles_begin() != f->facet_cycles_end() ||
+	   ++(++(++sfc1)) != sfc2) {
+	  Vector_3 orth = f->plane().orthogonal_vector();
+	  int c = CGAL::abs(orth[0]) > CGAL::abs(orth[1]) ? 0 : 1;
+	  c = CGAL::abs(orth[2]) > CGAL::abs(orth[c]) ? 2 : c;
+	  
+	  if(c == 0) {
+	    Triangulation_handler2<YZ> th(f);
+	    th.handle_triangles(B, VI);
+	  } else if(c == 1) {
+	    Triangulation_handler2<XZ> th(f);
+	    th.handle_triangles(B, VI);
+	  } else if(c == 2) {
+	    Triangulation_handler2<XY> th(f);
+	    th.handle_triangles(B, VI);
+	  } else
+	    CGAL_error_msg( "wrong value");
+
+	} else {
+
+	  B.begin_facet();
+	  fc = f->facet_cycles_begin();
+	  se = SHalfedge_const_handle(fc);
+	  CGAL_assertion(se!=0);
+	  SHalfedge_around_facet_const_circulator hc_start(se);
+	  SHalfedge_around_facet_const_circulator hc_end(hc_start);
+	  CGAL_For_all(hc_start,hc_end) {
+	    CGAL_NEF_TRACEN("   add vertex " << hc_start->source()->center_vertex()->point());
+	    B.add_vertex_to_facet(VI[hc_start->source()->center_vertex()]);
+	  }
+	  B.end_facet();
+	}
+      }
+
+      void visit(SFace_const_handle) {}
+      void visit(Halfedge_const_handle) {}
+      void visit(Vertex_const_handle) {}
+      void visit(SHalfedge_const_handle) {}
+      void visit(SHalfloop_const_handle) {}
+    };
+
+  public:
+
+    const SNC_const_decorator& scd;
+    Object_index<Vertex_const_iterator> VI;
+
+    Build_polyhedron(const SNC_const_decorator& s) : 
+      scd(s), VI(s.vertices_begin(),s.vertices_end(),'V') {}
+    
+    void operator()( HDS& hds) {
+
+      Polyhedron_incremental_builder_3<HDS> B(hds, true);
+
+      int skip_volumes;
+      if(Infi_box::extended_kernel()) {
+	B.begin_surface(scd.number_of_vertices()-8, 
+			scd.number_of_facets()-6,
+			scd.number_of_edges()-12);
+	skip_volumes = 2;
+      }
+      else {
+	B.begin_surface(scd.number_of_vertices(), 
+			2*scd.number_of_vertices()-4,
+			3*scd.number_of_vertices()-6);
+	skip_volumes = 1;
+      }
+      
+      int vertex_index = 0;
+      Vertex_const_iterator v;
+      CGAL_forall_vertices(v,scd) {
+	if(Infi_box::is_standard(v->point())) {
+	  VI[v]=vertex_index++;
+	  B.add_vertex(v->point());
+	}
+      }     
+      
+      Visitor V(B,scd,VI);
+      Volume_const_handle c;
+      CGAL_forall_volumes(c,scd)
+	if(skip_volumes-- <= 0)
+	  scd.visit_shell_objects(SFace_const_handle(c->shells_begin()),V);
+      B.end_surface();
+      if ( B.error() ) B.rollback();
+    }
+
+  };
+
+  template <class HDS>
+  class Build_polyhedron2 : public CGAL::Modifier_base<HDS> {
+    
+    class Find_holes {
+
+      Unique_hash_map<Vertex_const_handle, bool>& omit_vertex;
+      int nov, nof;
+
+    public:
+      Find_holes(Unique_hash_map<Vertex_const_handle, bool>& omit_vertex_) 
+	: omit_vertex(omit_vertex_), nov(0), nof(0) {}
+
+      void visit(Halffacet_const_handle f) {
+	++nof;
+	Halffacet_cycle_const_iterator fc = f->facet_cycles_begin();
+	for(++fc; fc != f->facet_cycles_end(); ++fc) {
+	  if(fc.is_shalfedge()) {
+	    --nof;
+	    SHalfedge_around_facet_const_circulator 
+	      sfc(fc), send(sfc);
+	    CGAL_For_all(sfc, send) {
+	      omit_vertex[sfc->source()->source()] = true;
+	      --nov;
+	    }
+	  } else if(fc.is_shalfloop()) {
+	    SHalfloop_const_handle sl(fc);
+	    omit_vertex[sl->incident_sface()->center_vertex()];
+	    --nov;
+	  } else
+	    CGAL_error_msg( "wrong handle type");
+	}
+      }
+
+      void visit(Vertex_const_handle) { ++nov; }
+      void visit(SFace_const_handle) {}
+      void visit(Halfedge_const_handle) {}
+      void visit(SHalfedge_const_handle) {}
+      void visit(SHalfloop_const_handle) {}
+
+      int number_of_vertices() const {
+	return nov;
+      }
+
+      int number_of_facets() const {
+	return nof;
+      }
+    };
+
+    class Add_vertices {
+      
+      Polyhedron_incremental_builder_3<HDS>& B;
+      Unique_hash_map<Vertex_const_handle, bool>& omit_vertex;
+      Object_index<Vertex_const_iterator>& VI;      
+      int vertex_index;
+
+    public:
+      Add_vertices(Polyhedron_incremental_builder_3<HDS>& B_,
+		   Unique_hash_map<Vertex_const_handle, bool>& omit_vertex_,
+		   Object_index<Vertex_const_iterator>& VI_) 
+	: B(B_), omit_vertex(omit_vertex_), VI(VI_), vertex_index(0) {}
+	
+      void visit(Vertex_const_handle v) {
+	if(omit_vertex[v]) return;
+	VI[v]=vertex_index++;
+	B.add_vertex(v->point());
+      }
+
+      void visit(Halffacet_const_handle) {}
+      void visit(SFace_const_handle) {}
+      void visit(Halfedge_const_handle) {}
+      void visit(SHalfedge_const_handle) {}
+      void visit(SHalfloop_const_handle) {}
+
+    };
+
+    class Visitor {
+
+      const Object_index<Vertex_const_iterator>& VI;
+      Polyhedron_incremental_builder_3<HDS>& B;
+      const Unique_hash_map<Vertex_const_handle, bool>& omit_vertex;
+      SNC_const_decorator& D;
+      
+    public:
+      Visitor(Polyhedron_incremental_builder_3<HDS>& BB,
+	      const Unique_hash_map<Vertex_const_handle, bool>& omit_vertex_,
+	      SNC_const_decorator& sd,
+	      Object_index<Vertex_const_iterator>& vi) 
+	: VI(vi), B(BB), omit_vertex(omit_vertex_), D(sd){}
+
+      void visit(Halffacet_const_handle opposite_facet) {
+
+	CGAL_NEF_TRACEN("Build_polyhedron: visit facet " << opposite_facet->plane());
+ 
+	CGAL_assertion(Infi_box::is_standard(opposite_facet->plane()));
+	
+	SHalfedge_const_handle se;
+	Halffacet_cycle_const_iterator fc;
+     	
+	Halffacet_const_handle f = opposite_facet->twin();
+
+	fc = f->facet_cycles_begin();
+	se = SHalfedge_const_handle(fc);
+	CGAL_assertion(se!=0);
+	if(omit_vertex[se->source()->source()]) return;
+	B.begin_facet();
+	SHalfedge_around_facet_const_circulator hc_start(se);
+	SHalfedge_around_facet_const_circulator hc_end(hc_start);
+	CGAL_For_all(hc_start,hc_end) {
+	  CGAL_NEF_TRACEN("   add vertex " << hc_start->source()->center_vertex()->point());
+	  B.add_vertex_to_facet(VI[hc_start->source()->center_vertex()]);
+	}
+	B.end_facet();
+      }
+
+      void visit(SFace_const_handle) {}
+      void visit(Halfedge_const_handle) {}
+      void visit(Vertex_const_handle) {}
+      void visit(SHalfedge_const_handle) {}
+      void visit(SHalfloop_const_handle) {}
+    };
+
+  public:
+
+    SFace_const_handle sf;
+    SNC_const_decorator& scd;
+    Object_index<Vertex_const_iterator> VI;
+    Unique_hash_map<Vertex_const_handle, bool> omit_vertex;
+
+    Build_polyhedron2(SFace_const_handle sf_, SNC_const_decorator& s) : 
+      sf(sf_), scd(s), VI(s.vertices_begin(),s.vertices_end(),'V'), 
+      omit_vertex(false) {}
+    
+      void operator()(HDS& hds) {
+
+      Polyhedron_incremental_builder_3<HDS> B(hds, true);
+      
+      Find_holes F(omit_vertex);
+      scd.visit_shell_objects(sf, F);
+
+      B.begin_surface(F.number_of_vertices(), 
+		      F.number_of_facets(),
+		      F.number_of_vertices()+F.number_of_facets()-2);
+
+      Add_vertices A(B,omit_vertex, VI);
+      scd.visit_shell_objects(sf, A);
+
+      Visitor V(B,omit_vertex, scd,VI);
+      scd.visit_shell_objects(sf, V);
+      B.end_surface();
+      if ( B.error() ) B.rollback();
+    }
+
+  };
+
+
+ public:
+ void delegate( Modifier_base<SNC_structure>& modifier, 
+		bool compute_external = false, 
+		bool do_simplify = true) {
+
+   // calls the `operator()' of the `modifier'. Precondition: The
+   // `modifier' returns a consistent representation.
+   if( this->is_shared()) clone_rep();
+   modifier(snc());
+   if(compute_external) {
+     SNC_external_structure es(snc());
+     es.clear_external_structure();
+     
+     build_external_structure();
+   }
+   if(do_simplify)
+     simplify();
+   CGAL_expensive_postcondition( is_valid());
+ }
+
+ struct SNC_and_PL {
+   SNC_structure* sncp;
+   SNC_point_locator* pl;
+
+   SNC_and_PL(SNC_structure* s, SNC_point_locator* p) : sncp(s), pl(p) {}
+ };
+
+ void delegate( Modifier_base<SNC_and_PL>& modifier, 
+		bool compute_external = false,
+		bool do_simplify = false) {
+   // calls the `operator()' of the `modifier'. Precondition: The
+   // `modifier' returns a consistent representation.
+   if( this->is_shared()) clone_rep();
+   SNC_and_PL sncpl(&snc(),pl());
+   modifier(sncpl);
+   pl() = sncpl.pl;
+   if(compute_external) {
+     SNC_external_structure es(snc());
+     es.clear_external_structure();
+     build_external_structure();
+   }
+   if(do_simplify)
+     simplify();
+   CGAL_expensive_postcondition( is_valid());
+ }
+ 
+ public:
+
+ template<typename Polyhedron>
+ void convert_to_Polyhedron(Polyhedron& P) const {
+   convert_to_polyhedron(P);
+ }
+
+ template<typename Polyhedron>
+ void convert_to_polyhedron(Polyhedron& P) const {
+   typedef typename Polyhedron::HalfedgeDS HalfedgeDS;
+   CGAL_precondition(is_simple());
+   P.clear();
+   Build_polyhedron<HalfedgeDS> bp(*this);    
+   P.delegate(bp);
+ }
+
+ template<typename Polyhedron>
+ void convert_inner_shell_to_polyhedron(SFace_const_iterator sf, Polyhedron& P) {
+   typedef typename Polyhedron::HalfedgeDS HalfedgeDS;
+   P.clear();
+   Build_polyhedron2<HalfedgeDS> bp(sf, *this);
+   P.delegate(bp);
+ }
+
+  bool is_valid( bool verb = false, int level = 0) {
+    // checks the combinatorial consistency.
+    Verbose_ostream verr(verb);
+    verr << "begin CGAL::Nef_polyhedron_3<...>::is_valid( verb=true, "
+      "level = " << level << "):" << std::endl;
+
+    SNC_decorator D(snc());
+    bool valid = D.is_valid(verb, level);
+    verr << "end of CGAL::Nef_polyhedron_3<...>::is_valid(): structure is "
+	 << ( valid ? "valid." : "NOT VALID.") << std::endl;
+    return valid;
+  }
+
+  bool is_simple() const {
+
+    Halfedge_const_iterator e;
+    CGAL_forall_edges(e,snc())
+      if(!is_edge_2manifold(e))
+	return false;
+
+    CGAL_NEF_TRACEN("there is no edge with non-manifold situation");
+
+    Vertex_const_iterator v;
+    CGAL_forall_vertices(v,snc())
+      if(!is_vertex_2manifold(v))
+	return false;
+
+    CGAL_NEF_TRACEN("there is no vertex with non-manifold situation");
+/*
+    Halffacet_iterator f;
+    CGAL_forall_halffacets(f,snc())
+      if(!is_facet_simple(f))
+	return false;
+
+    CGAL_NEF_TRACEN("there are no holes");
+*/
+    return true;
+  }
+ 
+ bool is_convex() const {
+   
+   Vertex_const_iterator v;
+   CGAL_forall_vertices(v, *this) {
+
+     SM_const_decorator SD(&*v);
+     if(std::distance(SD.sfaces_begin(),SD.sfaces_end())!=2)
+       return false;
+
+     if(!Infi_box::is_standard(v->point())) continue;
+
+     SFace_const_iterator sf;
+     CGAL_forall_sfaces(sf,SD) {
+       if(sf->volume() == Infi_box::getNirvana(snc())) continue;
+       if(std::distance(sf->sface_cycles_begin(),sf->sface_cycles_end())!=1)
+	 return false;
+       SFace_cycle_const_iterator sfi(sf->sface_cycles_begin());
+       if(!sfi.is_shalfedge())
+	 return false;
+       SHalfedge_const_handle se(sf->sface_cycles_begin());
+       SHalfedge_around_sface_const_circulator sec(se),send(sec);
+       CGAL_For_all(sec,send)
+	 if(spherical_orientation(sec->source()->point(),
+				  sec->snext()->source()->point(),
+				  sec->snext()->snext()->source()->point())<0) {
+	   std::cerr << "vertex at " << v->point() << " is not convex" << std::endl;
+	   return false;
+	 }
+     }
+   }
+   return true;
+ }
+
+ private:  
+  bool is_edge_2manifold(const Halfedge_const_handle& e) const {
+
+    SM_decorator SD;
+    SHalfedge_around_svertex_const_circulator c(SD.first_out_edge(e)), c2(c);
+
+    if(c == 0) {
+      CGAL_assertion(circulator_size(c) !=2);
+      return false;
+    }
+
+    if(++c == c2){
+      CGAL_assertion(circulator_size(c) !=2);
+      return false;
+    }
+
+    if(++c != c2) { 
+      CGAL_assertion(circulator_size(c) !=2);
+      return false;
+    }
+    
+    CGAL_assertion(circulator_size(c) == 2);
+    return true;
+  }
+ 
+  bool is_vertex_2manifold(const Vertex_const_handle& v) const {
+     
+    SFace_const_iterator sfi(v->sfaces_begin());
+    if (++sfi != v->sfaces_last())
+      return false;
+
+    return true;
+  }
+
+  bool is_facet_simple(const Halffacet_const_handle& f) const {
+    
+    bool found_first = false;
+    Halffacet_cycle_const_iterator it; 
+    CGAL_forall_facet_cycles_of(it,f)
+      if (found_first || !it.is_shalfedge())
+	return false;
+      else
+	found_first = true;
+   
+    return true;
+  }
+
+ public:
+ 
+  void clear(Content space = EMPTY)
+    { *this = Nef_polyhedron_3(space); }
+  /*{\Mop makes |\Mvar| the empty set if |space == EMPTY| and the
+  full space if |space == COMPLETE|.}*/
+
+ bool is_empty() const {
+   /*{\Mop returns true if |\Mvar| is empty, false otherwise.}*/
+   if(Infi_box::extended_kernel()) 
+     return this->number_of_vertices() == 8 &&
+            this->number_of_edges() == 12 &&
+            this->number_of_facets() == 6 &&
+            this->number_of_volumes() == 2 &&
+            (++this->volumes_begin())->mark() == false;
+
+   else 
+     return this->number_of_vertices() == 0 &&
+            this->number_of_edges() == 0 &&
+            this->number_of_facets() == 0 &&
+            this->number_of_volumes() == 1 &&
+            (this->volumes_begin())->mark() == false;
+  }
+
+ bool is_space() const {
+  /*{\Mop returns true if |\Mvar| is the whole space, false otherwise.}*/
+   if(Infi_box::extended_kernel()) 
+     return this->number_of_vertices() == 8 &&
+            this->number_of_edges() == 12 &&
+            this->number_of_facets() == 6 &&
+            this->number_of_volumes() == 2 &&
+            (++this->volumes_begin())->mark() == true;
+
+   else 
+     return this->number_of_vertices() == 0 &&
+            this->number_of_edges() == 0 &&
+            this->number_of_facets() == 0 &&
+            this->number_of_volumes() == 1 &&
+            (this->volumes_begin())->mark() == true;
+  }
+
+  /*{\Xtext \headerline{Destructive Operations}}*/
+
+ protected:
+  void clone_rep() { *this = Nef_polyhedron_3<Kernel,Items, Mark>(snc(), pl()); }
+  void empty_rep() { 
+    SNC_structure rsnc;
+    delete pl();
+    *this = Nef_polyhedron_3<Kernel,Items, Mark>(rsnc, new SNC_point_locator_default,false);
+  }
+
+ public:
+  Nef_polyhedron_3( const SNC_structure& W, 
+		    SNC_point_locator* _pl = new SNC_point_locator_default,
+		    bool clone_pl = true,
+		    bool clone_snc = true);
+  /*{\Xcreate makes |\Mvar| a new object.  If |cloneit==true| then the
+  underlying structure of |W| is copied into |\Mvar|.}*/
+  // TODO: granados: define behavior when clone=false
+
+  /*{\Moperations 4 3 }*/
+
+  void simplify() {
+    SNC_simplify simp(snc());
+    bool simplified = simp.simplify();
+    CGAL_NEF_TRACEN( "simplify(): structure simplified? "<<simplified);
+    
+    if( simplified) {
+#ifdef CGAL_NEF3_UPDATE_K3TREE_AFTER_SIMPLIFICATION
+      /*debug*/ snc().print_statistics();
+      Unique_hash_map<Vertex_handle, bool> 
+	V(false, snc().number_of_vertices());
+      Unique_hash_map<Halfedge_handle, bool> 
+	E(false, snc().number_of_halfedges());
+      Unique_hash_map<Halffacet_handle, bool> 
+	F(false, snc().number_of_halffacets());
+      Vertex_iterator v;
+      Halfedge_iterator e;
+      Halffacet_iterator f;
+      CGAL_forall_vertices( v, snc()) V[Vertex_handle(v)] = true;
+      CGAL_forall_halfedges( e, snc()) E[Halfedge_handle(e)] = true;
+      CGAL_forall_halffacets( f, snc()) F[Halffacet_handle(f)] = true;
+      bool updated = pl()->update( V, E, F);
+      CGAL_NEF_TRACEN("simplify(): point locator structure updated? " << updated);
+#else
+      SNC_point_locator* old_pl = pl();
+      pl() = pl()->clone();
+      pl()->initialize(&snc());
+      delete old_pl;
+#endif
+    }
+  }
+
+ public:
+  Nef_polyhedron_S2 get_sphere_map(Vertex_const_handle v) const {
+    return Nef_polyhedron_S2(*v);
+  }
+
+  void extract_complement();
+  /*{\Xop converts |\Mvar| to its complement. }*/
+  void extract_interior();
+  /*{\Xop converts |\Mvar| to its interior. }*/
+  void extract_boundary();
+  /*{\Xop converts |\Mvar| to its boundary. }*/
+
+  void extract_closure()
+  /*{\Xop converts |\Mvar| to its closure. }*/
+  { CGAL_NEF_TRACEN("extract closure");
+    if( this->is_shared()) clone_rep();
+    extract_complement();
+    extract_interior();
+    extract_complement();
+  }
+
+  void extract_regularization()
+  /*{\Xop converts |\Mvar| to its regularization. }*/
+  { CGAL_NEF_TRACEN("extract regularization");
+    if( this->is_shared()) clone_rep();
+    extract_interior();
+    extract_closure();
+  }
+
+  /*{\Mtext \headerline{Constructive Operations}}*/
+
+  Nef_polyhedron_3<Kernel,Items, Mark> complement() const
+  /*{\Mop returns the complement of |\Mvar| in the plane. }*/
+  { Nef_polyhedron_3<Kernel,Items, Mark> res = *this;
+    res.extract_complement();
+    return res;
+  }
+
+  Nef_polyhedron_3<Kernel,Items, Mark> interior() const
+  /*{\Mop    returns the interior of |\Mvar|. }*/
+  { Nef_polyhedron_3<Kernel,Items, Mark> res = *this;
+    res.extract_interior();
+    return res;
+  }
+
+  Nef_polyhedron_3<Kernel,Items, Mark> closure() const
+  /*{\Mop returns the closure of |\Mvar|. }*/
+  { Nef_polyhedron_3<Kernel,Items, Mark> res = *this;
+    res.extract_closure();
+    return res;
+  }
+
+  Nef_polyhedron_3<Kernel,Items, Mark> boundary() const
+  /*{\Mop returns the boundary of |\Mvar|. }*/
+  { Nef_polyhedron_3<Kernel,Items, Mark> res = *this;
+    res.extract_boundary();
+    return res;
+  }
+
+  Nef_polyhedron_3<Kernel,Items, Mark> regularization() const
+  /*{\Mop    returns the regularized polyhedron (closure of 
+    the interior).}*/
+  { Nef_polyhedron_3<Kernel,Items, Mark> res = *this;
+    res.extract_regularization();
+    return res;
+  }
+
+  Nef_polyhedron_3<Kernel,Items, Mark>
+  intersection(const Nef_polyhedron_3<Kernel,Items, Mark>& N1) const
+    /*{\Mop returns |\Mvar| $\cap$ |N1|. }*/ {
+    CGAL_NEF_TRACEN(" intersection between nef3 "<<&*this<<" and "<<&N1);
+    AND _and;
+    SNC_structure rsnc;
+    Nef_polyhedron_3<Kernel,Items, Mark> res(rsnc, new SNC_point_locator_default, false);
+    Binary_operation bo( res.snc());
+    bo(res.pl(), snc(), pl(), N1.snc(), N1.pl(), _and);
+    return res;
+  }
+
+  Nef_polyhedron_3<Kernel,Items, Mark>
+   intersection(const Plane_3& plane, 
+		Intersection_mode im) const {
+    AND _and;
+    SNC_structure rsnc;
+    Nef_polyhedron_3<Kernel,Items, Mark> res(rsnc, new SNC_point_locator_default, false);
+    Combine_with_halfspace cwh(res.snc(), res.pl());
+    cwh.combine_with_halfspace(snc(), plane, _and, 
+							   static_cast<typename Combine_with_halfspace::Intersection_mode>(im));
+    return res;
+  }
+
+  Nef_polyhedron_3<Kernel,Items, Mark> 
+  join(const Nef_polyhedron_3<Kernel,Items, Mark>& N1) const
+  /*{\Mop returns |\Mvar| $\cup$ |N1|. }*/ { 
+    CGAL_NEF_TRACEN(" join between nef3 "<<&*this<<" and "<<&N1);
+    OR _or;
+    //CGAL::binop_intersection_tests_allpairs<SNC_decorator, OR> tests_impl;
+    SNC_structure rsnc;
+    Nef_polyhedron_3<Kernel,Items, Mark> res(rsnc, new SNC_point_locator_default, false);
+    Binary_operation bo(res.snc());
+    bo(res.pl(), snc(), pl(), N1.snc(), N1.pl(), _or);
+    return res;
+  }
+
+  Nef_polyhedron_3<Kernel,Items, Mark> 
+  difference(const Nef_polyhedron_3<Kernel,Items, Mark>& N1) const
+  /*{\Mop returns |\Mvar| $-$ |N1|. }*/ { 
+    CGAL_NEF_TRACEN(" difference between nef3 "<<&*this<<" and "<<&N1);
+    DIFF _diff;
+    //CGAL::binop_intersection_tests_allpairs<SNC_decorator, DIFF> tests_impl;
+    SNC_structure rsnc;
+    Nef_polyhedron_3<Kernel,Items, Mark> res(rsnc, new SNC_point_locator_default, false);
+    Binary_operation bo(res.snc());
+    bo(res.pl(), snc(), pl(), N1.snc(), N1.pl(), _diff);
+    return res;
+  }    
+
+  Nef_polyhedron_3<Kernel,Items, Mark> 
+  symmetric_difference(const Nef_polyhedron_3<Kernel,Items, Mark>& N1) const
+  /*{\Mop returns the symmectric difference |\Mvar - T| $\cup$ 
+          |T - \Mvar|. }*/ {
+    CGAL_NEF_TRACEN(" symmetic difference between nef3 "<<&*this<<" and "<<&N1);
+    XOR _xor;
+    //CGAL::binop_intersection_tests_allpairs<SNC_decorator, XOR> tests_impl;
+    SNC_structure rsnc;
+    Nef_polyhedron_3<Kernel,Items, Mark> res(rsnc, new SNC_point_locator_default, false);
+    Binary_operation bo(res.snc());
+    bo(res.pl(), snc(), pl(), N1.snc(), N1.pl(), _xor);
+    return res;
+  }
+
+
+  /*{\Mtext Additionally there are operators |*,+,-,^,!| which
+  implement the binary operations \emph{intersection}, \emph{union},
+  \emph{difference}, \emph{symmetric difference}, and the unary
+  operation \emph{complement}. There are also the corresponding
+  modification operations |*=,+=,-=,^=|.}*/
+
+  Nef_polyhedron_3<Kernel,Items, Mark>  operator*(const Nef_polyhedron_3<Kernel,Items, Mark>& N1) const 
+  { return intersection(N1); }
+
+  Nef_polyhedron_3<Kernel,Items, Mark>  operator+(const Nef_polyhedron_3<Kernel,Items, Mark>& N1) const
+  { return join(N1); }
+
+  Nef_polyhedron_3<Kernel,Items, Mark>  operator-(const Nef_polyhedron_3<Kernel,Items, Mark>& N1) const
+  { return difference(N1); }
+
+  Nef_polyhedron_3<Kernel,Items, Mark>  operator^(const Nef_polyhedron_3<Kernel,Items, Mark>& N1) const
+  { return symmetric_difference(N1); }
+
+  Nef_polyhedron_3<Kernel,Items, Mark>  operator!() const
+  { return complement(); }
+   
+  Nef_polyhedron_3<Kernel,Items, Mark>& operator*=(const Nef_polyhedron_3<Kernel,Items, Mark>& N1)
+  { 
+#ifdef CGAL_NEF_VISUAL_HULL
+    CGAL_NEF_SETDTHREAD(19*43*71);
+    std::cerr << "visual hull code " << std::endl;
+    std::cerr << *this << std::endl;
+    std::cerr << const_cast<Nef_polyhedron&>(N1) << std::endl;
+    AND _and;
+    typename CGAL::Modifying_binary_operation<SNC_structure> 
+      mbo(this->snc());
+    mbo(const_cast<SNC_structure&>(N1.snc()), N1.pl(), pl(), _and);
+    return *this;
+#else
+    *this = intersection(N1); return *this; 
+#endif
+  }
+
+  Nef_polyhedron_3<Kernel,Items, Mark>& operator+=(const Nef_polyhedron_3<Kernel,Items, Mark>& N1)
+  { *this = join(N1); return *this; }
+
+  Nef_polyhedron_3<Kernel,Items, Mark>& operator-=(const Nef_polyhedron_3<Kernel,Items, Mark>& N1)
+  { *this = difference(N1); return *this; }
+
+  Nef_polyhedron_3<Kernel,Items, Mark>& operator^=(const Nef_polyhedron_3<Kernel,Items, Mark>& N1)
+  { *this = symmetric_difference(N1); return *this; }
+
+  /*{\Mtext There are also comparison operations like |<,<=,>,>=,==,!=|
+  which implement the relations subset, subset or equal, superset, superset
+  or equal, equality, inequality.}*/
+
+  bool operator==(const Nef_polyhedron_3<Kernel,Items, Mark>& N1) const
+  { CGAL_NEF_TRACEN(" equality comparision between nef3 "<<&*this<<" and "<<&N1);
+    return symmetric_difference(N1).is_empty(); }
+
+  bool operator!=(const Nef_polyhedron_3<Kernel,Items, Mark>& N1) const
+  { CGAL_NEF_TRACEN(" inequality comparision between nef3 "<<&*this<<" and "<<&N1);
+    return !operator==(N1); }  
+
+  bool operator<(const Nef_polyhedron_3<Kernel,Items, Mark>& N1) const
+  { return !N1.difference(*this).is_empty() && difference(N1).is_empty(); } 
+
+  bool operator>(const Nef_polyhedron_3<Kernel,Items, Mark>& N1) const
+  { return difference(*this).is_empty() && !difference(N1).is_empty(); } 
+
+  bool operator<=(const Nef_polyhedron_3<Kernel,Items, Mark>& N1) const
+  { return difference(N1).is_empty(); } 
+
+  bool operator>=(const Nef_polyhedron_3<Kernel,Items, Mark>& N1) const
+  { return N1.difference(*this).is_empty(); } 
+
+
+ bool is_90degree_rotation(const Aff_transformation_3& aff) const {
+   if(aff.hm(0,3) != 0) return false;
+   if(aff.hm(1,3) != 0) return false;
+   if(aff.hm(2,3) != 0) return false;
+   if(CGAL_NTS abs(aff.hm(0,0)) + 
+      CGAL_NTS abs(aff.hm(0,1)) + 
+      CGAL_NTS abs(aff.hm(0,2)) != aff.hm(3,3)) return false;
+   if(CGAL_NTS abs(aff.hm(1,0)) + 
+      CGAL_NTS abs(aff.hm(1,1)) + 
+      CGAL_NTS abs(aff.hm(1,2)) != aff.hm(3,3)) return false;
+   if(CGAL_NTS abs(aff.hm(2,0)) + 
+      CGAL_NTS abs(aff.hm(2,1)) + 
+      CGAL_NTS abs(aff.hm(2,2)) != aff.hm(3,3)) return false;
+   if(CGAL_NTS abs(aff.hm(0,0)) + 
+      CGAL_NTS abs(aff.hm(1,0)) + 
+      CGAL_NTS abs(aff.hm(2,0)) != aff.hm(3,3)) return false;
+   if(CGAL_NTS abs(aff.hm(0,1)) + 
+      CGAL_NTS abs(aff.hm(1,1)) + 
+      CGAL_NTS abs(aff.hm(2,1)) != aff.hm(3,3)) return false;
+   if(CGAL_NTS abs(aff.hm(0,2)) + 
+      CGAL_NTS abs(aff.hm(1,2)) + 
+      CGAL_NTS abs(aff.hm(2,2)) != aff.hm(3,3)) return false;
+   return true;
+ }
+
+ bool is_scaling(const Aff_transformation_3& aff) const {
+   if(aff.hm(0,3) != 0) return false;
+   if(aff.hm(1,3) != 0) return false;
+   if(aff.hm(2,3) != 0) return false;   
+   if(aff.hm(0,1) != 0) return false;
+   if(aff.hm(0,2) != 0) return false;
+   if(aff.hm(1,0) != 0) return false;   
+   if(aff.hm(1,2) != 0) return false;
+   if(aff.hm(2,0) != 0) return false;
+   if(aff.hm(2,1) != 0) return false;
+   if(aff.hm(0,0) != aff.hm(1,1)) return false;
+   if(aff.hm(0,0) != aff.hm(2,2)) return false;
+   return true;
+ }
+
+ void change_orientation(bool full = false) {
+
+   Halffacet_handle ftemp;
+   Volume_handle vtemp;
+   SVertex_handle svtemp;
+   SHalfedge_handle setemp;
+   SFace_handle sftemp;
+
+   SVertex_iterator sv;
+   CGAL_forall_svertices(sv, snc()) {
+     if (!sv->is_isolated())
+      sv->out_sedge() = sv->out_sedge()->twin();
+   }
+
+   SHalfedge_iterator se;
+   CGAL_forall_shalfedges(se, snc()) {
+     if(se->is_twin()) {
+       svtemp = se->source();
+       se->source() = se->twin()->source();
+       se->twin()->source() = svtemp;
+
+       if(full) {
+	 ftemp = se->facet();
+	 se->facet() = se->twin()->facet();
+	 se->twin()->facet() = ftemp;
+       }
+       //       sftemp = se->incident_sface();
+       //       se->incident_sface() = se->twin()->incident_sface();
+       //       se->twin()->incident_sface() = sftemp;
+     }
+       
+     setemp = se->sprev();
+     se->sprev() = se->snext();
+     se->snext() = setemp;
+
+     se->circle() = se->circle().opposite();
+
+     if(full) {
+       setemp = se->prev();
+       se->prev() = se->next();
+       se->next() = setemp;
+     }
+   }
+
+   if(full) {
+     Halffacet_iterator f;
+     CGAL_forall_facets(f, snc()) {
+       vtemp  = f->incident_volume();
+       f->incident_volume() = f->twin()->incident_volume();
+       f->twin()->incident_volume() = vtemp;
+       Halffacet_cycle_iterator fc(f->facet_cycles_begin()),
+	 fct(f->twin()->facet_cycles_begin());
+       while(fc!=f->facet_cycles_end()) {
+	 CGAL_assertion(fct!=f->twin()->facet_cycles_end());
+	 if(fc.is_shalfedge()) {
+	   CGAL_assertion(fct.is_shalfedge());
+	   setemp = fc;
+	   *fc = *fct;
+	   *fct = make_object(setemp);
+	 }
+	 ++fc;
+	 ++fct;
+       }
+     }
+   
+     CGAL_forall_halffacets(f, snc()) {
+       Halffacet_cycle_iterator fc(f->facet_cycles_begin());
+       for(;fc!=f->facet_cycles_end();++fc) {
+	 if(fc.is_shalfedge()) {
+	   setemp = fc;
+	   SHalfedge_around_facet_circulator hfc(setemp),hend(hfc);
+	   ++hfc;
+	   CGAL_For_all(hfc,hend) {
+	     if ( CGAL::lexicographically_xyz_smaller(hfc->source()->source()->point(),
+						      setemp->source()->source()->point()))
+	       setemp = hfc;
+	   }
+	   *fc = make_object(setemp);
+	 }
+       }
+     }
+   }
+ }
+
+  void transform( const Aff_transformation_3& aff) {
+    
+    if( this->is_shared())
+      clone_rep();
+    // only linear transform for the origin-centered sphere maps
+    Aff_transformation_3 linear( aff.hm(0,0), aff.hm(0,1), aff.hm(0,2),
+				 aff.hm(1,0), aff.hm(1,1), aff.hm(1,2),
+				 aff.hm(2,0), aff.hm(2,1), aff.hm(2,2),
+				 aff.hm(3,3));
+    
+    SNC_constructor cstr(snc());
+    
+    std::list<Vertex_handle> vertex_list;
+    std::list<Vertex_handle> corner_list;
+    std::list<Vertex_handle> delete_list;
+    typename std::list<Vertex_handle>::iterator li;
+    typename std::list<Vertex_handle>::iterator li2;
+
+    bool ninety = is_90degree_rotation(aff);
+    bool scale = is_scaling(aff);
+
+    Vertex_iterator vi;
+    CGAL_forall_vertices( vi, snc()) {
+      
+      CGAL_NEF_TRACEN("transform vertex ");
+      if(scale) {
+	if(is_standard(vi))
+	  vi->point() = vi->point().transform( aff);
+	else if(!Infi_box::is_infibox_corner(vi->point())) {
+	  vi->point() = normalized(Infi_box::normalize_transformed_vertex(vi->point().transform(aff)));
+	}
+      } else if (!is_standard(vi) && !ninety) {
+	if(Infi_box::is_infibox_corner(vi->point()))
+	  corner_list.push_back(vi);
+	vertex_list.push_back(vi);
+      } else {
+	vi->point() = vi->point().transform( aff);
+	SM_decorator sdeco(&*vi);
+	sdeco.transform( linear);
+      }
+    }
+
+    if(!this->is_bounded() && !ninety && !scale) {
+      Halffacet_iterator fi;
+      CGAL_forall_facets(fi, snc()) {
+	if(!is_standard(fi) || is_bounded(fi)) continue;
+	Plane_3 pt = fi->plane();
+	pt = pt.transform(aff);
+	std::list<Point_3> points(Infi_box::find_points_of_box_with_plane(cstr,pt));
+	std::list<Vertex_handle> newVertices;
+	newVertices = Infi_box::create_vertices_on_infibox(cstr,
+							   pt, points, fi->mark(), 
+							   fi->twin()->incident_volume()->mark(), 
+							   fi->incident_volume()->mark());
+
+	for(li = newVertices.begin(); li != newVertices.end(); ++li) {
+	  if(Infi_box::is_infibox_corner((*li)->point())) {
+	    li2 = corner_list.begin();
+	    while(li2 != corner_list.end() && (*li2)->point() != (*li)->point()) ++li2;
+	    CGAL_assertion(li2 != corner_list.end());
+	    delete_list.push_back(*li2);
+	    *li2 = *li;
+	  }
+	}
+      }
+      
+      for(li = vertex_list.begin(); li != vertex_list.end();++li) {
+	SM_decorator SD(&**li);
+	if(Infi_box::is_complex_facet_infibox_intersection(**li)) {
+	  Halffacet_handle hf[2];
+	  int i=0;
+	  SHalfedge_iterator sei;
+	  CGAL_forall_sedges(sei,SD) {
+	    if(!Infi_box::is_sedge_on_infibox(sei)) {
+	      hf[i] = sei->facet();
+	      if(hf[i]->is_twin()) hf[i] = hf[i]->twin();
+	      ++i;
+	    }
+	    if(i>1)
+	      break;
+	  }
+	}
+      }
+
+      Association A;
+      SNC_external_structure es(snc());
+      es.clear_external_structure();
+      for(li = vertex_list.begin(); li != vertex_list.end();++li){
+	if(Infi_box::is_complex_facet_infibox_intersection(**li)) {
+	  Vertex_handle v2;
+	  Vertex_handle v1 = cstr.create_for_infibox_overlay(*li);
+	  v1->point() = normalized(Infi_box::normalize_transformed_vertex((*li)->point().transform(aff)));
+	  SM_decorator sdeco(&*v1);
+	  sdeco.transform(linear);	    
+	  switch(Infi_box::type_of_infibox_point(v1->point())) {
+	  case 1: 
+	    v2 = cstr.create_from_point_on_infibox_facet(v1->point()); 
+	    break;
+	  case 2: 
+	    v2 = cstr.create_from_point_on_infibox_edge(v1->point());
+	    break;
+	  case 3: 
+	    v2 = cstr.create_from_point_on_infibox_vertex(v1->point());
+	    li2 = corner_list.begin();
+	    while(li2 != corner_list.end() && (*li2)->point() != v2->point()) ++li2;
+	    if(li2 != corner_list.end())
+	      delete_list.push_back(*li2);
+	    break;
+	  default: CGAL_error_msg( "wrong value");
+	  }
+	  Vertex_handle v = snc().new_vertex(v1->point(), (*li)->mark());
+	  SM_overlayer O(&*v);
+	  O.subdivide(&*v1, &*v2, A);
+	  AND _and;
+	  O.select(_and);
+	  O.simplify(A);
+	  snc().delete_vertex(v1);
+	  snc().delete_vertex(v2);
+	}
+	
+	if(Infi_box::is_infibox_corner((*li)->point())) {
+	  SM_decorator SD(&**li);
+	  if(SD.number_of_svertices() < 4)
+	    continue;
+	  li2 = corner_list.begin();
+	  while(li2 != corner_list.end() && (*li2)->point() != (*li)->point()) ++li2;
+	  CGAL_assertion(li2 != corner_list.end());
+	  if(*li == *li2) {
+	    delete_list.push_back(*li2);
+	    *li2 = cstr.create_from_point_on_infibox_vertex((*li)->point());
+	  }
+	} else 
+	  snc().delete_vertex(*li);	  
+      }
+
+      for(li = delete_list.begin(); li != delete_list.end(); ++li)
+	snc().delete_vertex(*li);
+
+      if(!aff.is_even())
+	change_orientation();
+
+      while(cstr.erase_redundant_vertices()) ;
+      cstr.correct_infibox_sedge_marks();
+
+      build_external_structure();
+      cstr.correct_infibox_sface_marks();
+
+      // are the upcoming lines necessary? 
+      SNC_point_locator* old_pl = pl();
+      pl() = pl()->clone();
+      pl()->initialize(&snc());
+      delete old_pl;   
+
+    } else {
+      Halffacet_iterator fi;
+      CGAL_forall_halffacets(fi,snc()) {
+	if(is_standard(fi) || ninety) {
+	  fi->plane() = fi->plane().transform( aff);
+#ifdef CGAL_NEF3_FACET_WITH_BOX 
+	  typedef typename Halffacet::Box Box;
+	  bool first = true;
+	  Halffacet_cycle_iterator cycle_it = fi->facet_cycles_begin();
+	  if( cycle_it.is_shalfedge() ) {
+	    SHalfedge_iterator edge_it(cycle_it);
+	    SHalfedge_around_facet_circulator
+	      start( edge_it ), end( edge_it );
+	    CGAL_For_all( start, end ) {
+	      const Point_3& p = start->source()->source()->point();
+	      typename Kernel::FT q[3];
+	      q[0] = p.x();
+	      q[1] = p.y();
+	      q[2] = p.z();
+	      if(first) {
+		fi->b = Box(q,q);
+		first = false;
+	      } else
+		fi->b.extend(q);
+	    }
+	  } else
+	    CGAL_error_msg( "is facet first cycle a SHalfloop?"); 
+#endif
+	}
+      }    
+
+      if(!aff.is_even())
+	change_orientation(true);
+
+      if(aff.homogeneous(0,1) != 0 ||
+	 aff.homogeneous(0,2) != 0 ||
+	 aff.homogeneous(1,0) != 0 ||
+	 aff.homogeneous(1,2) != 0 ||
+	 aff.homogeneous(2,0) != 0 ||
+	 aff.homogeneous(2,1) != 0 ||
+	 aff.homogeneous(0,0) != aff.homogeneous(1,1) ||
+	 aff.homogeneous(0,0) != aff.homogeneous(2,2) ||
+	 !this->is_bounded()) {
+	   SNC_point_locator* old_pl = pl();
+	   pl() = pl()->clone();
+	   pl()->initialize(&snc());
+	   delete old_pl;   
+	 }
+      else pl()->transform(aff); 
+    }
+
+    SNC_constructor C(snc());
+    C.assign_indices(); 
+  }
+  
+  /*{\Mtext \headerline{Exploration}
+  As Nef polyhedra are the result of forming complements 
+  and intersections starting from a set |H| of halfspaces which are
+  defined by oriented planes in three space. The corresponding 
+  structure is represented by an extended wuerzburg structure 
+  $W = (V,E,F,C)$. For topological queries within |W| the following 
+  types and operations allow exploration access to this structure.}*/
+
+  /*{\Mtypes 3}*/
+    
+    typedef CGAL::SNC_SM_explorer<SM_const_decorator>  SM_explorer;
+
+    SM_explorer SMexplorer(Vertex_const_handle v) const { 
+      SM_const_decorator SMCD(&*v);
+      return SM_explorer(SMCD); 
+    }
+
+  typedef typename SNC_structure::Object_list Object_list;
+  typedef typename SNC_structure::Object_handle Object_handle;
+  /*{\Mtypemember a generic handle to an object of the underlying
+  plane map. The kind of object |(vertex, halfedge, face)| can 
+  be determined and the object can be assigned to a corresponding
+  handle by the three functions:\\
+  |bool assign(Vertex_const_handle& h, Object_handle)|\\
+  |bool assign(Edge_const_handle& h, Object_handle)|\\
+  |bool assign(Facet_const_handle& h, Object_handle)|\\
+  |bool assign(Volume_const_handle& h, Object_handle)|\\
+  where each function returns |true| iff the assignment to
+  |h| was done.}*/
+
+  /*{\Moperations 3 1 }*/
+
+  bool contains(Object_handle /*h*/) const
+  /*{\Mop  returns true iff the object |h| is contained in the set
+  represented by |\Mvar|.}*/
+    // { SNC_point_locator PL(snc()); return PL.mark(h);} 
+    { CGAL_error_msg( "not implemented."); return false;}
+
+  bool contained_in_boundary(Object_handle h) const
+  /*{\Mop  returns true iff the object |h| is contained in the $2$-skeleton
+  of |\Mvar|.}*/
+  { Vertex_const_handle v;
+    Halfedge_const_handle e;
+    Halffacet_const_handle f;
+    return  ( assign(v,h) || assign(e,h) || assign(f,h) );
+  }
+
+  Object_handle locate(const Point_3& p) const
+  /*{\Mop  returns a generic handle |h| to an object (vertex, edge, facet,
+  volume) of the underlying SNC which contains the point |p| in its relative 
+  interior. The point |p| is contained in the set represented by |\Mvar| if 
+  |\Mvar.contains(h)| is true.}*/ {
+    CGAL_NEF_TRACEN( "locating point...");
+    CGAL_assertion( pl() != NULL);
+
+    Object_handle o = pl()->locate(p);
+    
+    Vertex_handle v;
+    Halfedge_handle e;
+    Halffacet_handle f;
+    Volume_handle c;
+    if(assign(v,o)) return make_object(Vertex_const_handle(v));
+    if(assign(e,o)) return make_object(Halfedge_const_handle(e));
+    if(assign(f,o)) return make_object(Halffacet_const_handle(f));
+    if(assign(c,o)) return make_object(Volume_const_handle(c));
+
+    return Object_handle();
+  }
+
+  /*{\Mimplementation Nef polyhedra are implemented on top of an
+  extended Wuerzburg structure data structure (EWS) and use linear
+  space in the number of vertices, edges and facets.  Operations like
+  empty take constant time. The operations clear, complement, interior,
+  closure, boundary, regularization, input and output take linear
+  time. All binary set operations and comparison operations take time
+  $O(N^2)$ where $N$ is the size of the output plus the size of the
+  input.
+
+  The point location operations run in linear query time without any 
+  preprocessing.}*/
+
+  /*{\Mexample Nef polyhedra are parameterized by a so called extended
+  geometric kernel. There's currently only one such kernel based on a
+  homogeneous representation of extended points called
+  |Extended_homogeneous<NT>|.  The kernel is parameterized by a
+  multiprecision integer type. The member types of |Nef_polyhedron_3<
+  Extended_homogeneous_3<NT> >| map to corresponding types of the CGAL
+  geometry kernel (e.g. |Nef_polyhedron::Plane_3| equals
+  |CGAL::Homogeneous<leda_integer>::Plane_3| in the example below).
+  \begin{Mverb}
+  #include <CGAL/basic.h>
+  #include <CGAL/leda_integer.h>
+  #include <CGAL/Extended_homogeneous.h>
+  #include <CGAL/Nef_polyhedron_3.h>
+
+  using namespace CGAL;
+  typedef  Extended_homogeneous<leda_integer>   Extended_kernel;
+  typedef  Nef_polyhedron_3<Extended_kernel>    Nef_polyhedron;
+  typedef  Nef_polyhedron::Plane_3              Plane_3;
+
+  int main()
+  {
+    Nef_polyhedron N1(Plane_3(1,0,0,0));
+    Nef_polyhedron N2(Plane_3(0,1,0,0), Nef_polyhedron::EXCLUDED);
+    Nef_polyhedron N3 = N1 * N2; // line (*)
+    return 0;
+  }
+  \end{Mverb}
+  After line (*) |N3| is the intersection of |N1| and |N2|.}*/
+
+  std::size_t bytes() {
+    // bytes used for the Nef_polyhedron_3.
+    return sizeof(Self) + (snc().bytes() - sizeof(SNC_structure));
+  }
+
+  std::size_t bytes_reduced() {
+    // bytes used for the Nef_polyhedron_3.
+    std::cout << sizeof(Self) + (snc().bytes_reduced2() - sizeof(SNC_structure)) << std::endl;
+    return sizeof(Self) + (snc().bytes_reduced() - sizeof(SNC_structure));
+  }
+
+}; // end of Nef_polyhedron_3
+
+template <typename Kernel, typename Items, typename Mark>
+Nef_polyhedron_3<Kernel,Items, Mark>::
+Nef_polyhedron_3( Content space) {
+  CGAL_NEF_TRACEN("construction from empty or space.");
+  empty_rep();
+  set_snc(snc());
+  if(Infi_box::extended_kernel()) {
+    initialize_infibox_vertices(space);
+    build_external_structure();
+  } else {
+    build_external_structure();
+    snc().volumes_begin()->mark() = (space == COMPLETE) ? 1 : 0;
+  }
+}
+
+template <typename Kernel, typename Items, typename Mark>
+Nef_polyhedron_3<Kernel,Items, Mark>::
+Nef_polyhedron_3(const Plane_3& h, Boundary b) {
+  CGAL_NEF_TRACEN("construction from plane "<<h);
+  empty_rep();
+  set_snc(snc());
+  SNC_constructor C(snc());
+  Infi_box::create_vertices_of_box_with_plane(C,h,(b==INCLUDED));
+  build_external_structure();
+  /*
+  if(Infi_box::extended_kernel()) {
+    SNC_structure snc1, snc2;
+    SNC_point_locator* pl1 = new SNC_point_locator_default; 
+    SNC_point_locator* pl2 = new SNC_point_locator_default; 
+
+    SNC_constructor c1(snc1); 
+    Infi_box::initialize_infibox_vertices(c1, true);
+    SNC_external_structure es1(snc1, pl1);
+    es1.build_external_structure();
+
+    SNC_constructor c2(snc2);
+    c2.create_vertices_for_halfspace(h, b);
+    SNC_external_structure es2(snc2, pl2);
+    es2.pair_up_halfedges();
+    es2.link_shalfedges_to_facet_cycles();
+    c2.create_facets_and_volumes_of_halfspace(h);
+    pl2->initialize(&snc2);
+
+    AND _and;
+    Binary_operation bo(snc());
+    bo(pl(), snc1, pl1, snc2, pl2, _and);
+    
+    delete pl1;
+    delete pl2;
+  } else
+    CGAL_error_msg
+      ("Constructor is only available with extended kernels");
+  */
+}
+ 
+template <typename Kernel, typename Items, typename Mark>
+Nef_polyhedron_3<Kernel,Items, Mark>::
+Nef_polyhedron_3( const SNC_structure& W, SNC_point_locator* _pl, 
+		  bool clone_pl,
+		  bool clone_snc) {
+  CGAL_assertion( clone_snc == true || clone_pl == false);
+  // TODO: granados: define behavior when clone=false
+  //  CGAL_NEF_TRACEN("construction from an existing SNC structure (clone="<<clone<<")"); 
+
+  this->copy_on_write();
+  if(clone_snc) {
+    snc() = W;
+    set_snc(snc());
+  }
+  if(clone_pl) {
+    pl() = _pl->clone();
+    pl()->initialize(&snc());
+  } 
+  else
+    pl() = _pl;
+}
+
+template <typename Kernel, typename Items, typename Mark>
+void
+Nef_polyhedron_3<Kernel,Items, Mark>::
+extract_complement() {
+  CGAL_NEF_TRACEN("extract complement");
+  if( this->is_shared()) clone_rep();
+  SNC_decorator D(snc());
+  Vertex_iterator v;
+  CGAL_forall_vertices(v,D){
+    v->mark() = !v->mark(); 
+    SM_decorator SM(&*v);
+    SM.extract_complement();
+  }
+
+  Halffacet_iterator f;
+  CGAL_forall_halffacets(f,D) f->mark() = !f->mark(); 
+ 
+  Volume_iterator c;
+  CGAL_forall_volumes(c,D) 
+    //    if(!(Infi_box::extended_kernel && c==D.volumes_begin()))
+      c->mark() = !c->mark();
+}
+
+template <typename Kernel, typename Items, typename Mark>
+void
+Nef_polyhedron_3<Kernel,Items, Mark>::
+extract_interior() {
+  CGAL_NEF_TRACEN("extract interior");
+  if (this->is_shared()) clone_rep();
+  SNC_decorator D(snc());
+  Vertex_iterator v;
+  CGAL_forall_vertices(v,D){
+    v->mark() = false;
+    SM_decorator SM(&*v);
+    SM.extract_interior();
+  }
+  Halffacet_iterator f;
+  CGAL_forall_halffacets(f,D) f->mark() = false;
+
+  simplify();
+}
+
+template <typename Kernel, typename Items, typename Mark>
+void
+Nef_polyhedron_3<Kernel,Items, Mark>::
+extract_boundary() {
+  CGAL_NEF_TRACEN("extract boundary");
+  if (this->is_shared()) clone_rep();
+  SNC_decorator D(snc());
+  Vertex_iterator v;
+  CGAL_forall_vertices(v,D) {
+    v->mark() = true;
+    SM_decorator SM(&*v);
+    SM.extract_boundary();
+  }
+  Halffacet_iterator f;
+  CGAL_forall_halffacets(f,D) f->mark() = true;
+  Volume_iterator c;
+  CGAL_forall_volumes(c,D) c->mark() = false;
+  simplify();
+}
+
+} //namespace CGAL
+
+#endif //CGAL_NEF_POLYHEDRON_3_H
diff --git a/3rdparty/CGAL/include/CGAL/Nef_polyhedron_S2.h b/3rdparty/CGAL/include/CGAL/Nef_polyhedron_S2.h
new file mode 100644
index 0000000..4c45c9f
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Nef_polyhedron_S2.h
@@ -0,0 +1,734 @@
+// Copyright (c) 1997-2000  Max-Planck-Institute Saarbruecken (Germany).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Michael Seel       <seel at mpi-sb.mpg.de>
+//                 Peter Hachenberger <hachenberger at mpi-sb.mpg.de>
+
+#ifndef CGAL_NEF_POLYHEDRON_S2_H
+#define CGAL_NEF_POLYHEDRON_S2_H
+
+#if defined(BOOST_MSVC)
+#  pragma warning(push)
+#  pragma warning(disable:4800) // complaint about performance in std::map where we can't do anything
+#endif
+
+#include <CGAL/basic.h>
+#include <CGAL/Handle_for.h>
+#include <CGAL/Nef_S2/SM_items.h>
+#include <CGAL/Nef_S2/Sphere_map.h>
+#include <CGAL/Nef_S2/SM_decorator.h>
+#include <CGAL/Nef_S2/SM_io_parser.h>
+#include <CGAL/Nef_S2/SM_point_locator.h>
+#include <CGAL/Nef_S2/SM_overlayer.h>
+#include <CGAL/Modifier_base.h>
+
+#include <vector>
+#include <list>
+
+#include <boost/random/linear_congruential.hpp>
+#include <boost/random/uniform_real.hpp>
+#include <boost/random/variate_generator.hpp>
+
+#undef CGAL_NEF_DEBUG
+#define CGAL_NEF_DEBUG 53
+#include <CGAL/Nef_2/debug.h>
+
+namespace CGAL {
+
+template <typename K, typename I, typename Mk, typename M> class Nef_polyhedron_S2;
+template <typename K, typename I, typename Mk, typename M> class Nef_polyhedron_S2_rep;
+template <typename K, typename I, typename Mk> class Nef_polyhedron_3;
+class SNC_items;
+
+template <typename K, typename I, typename Mk, typename M>
+std::ostream& operator<<(std::ostream&, const Nef_polyhedron_S2<K,I,Mk,M>&); 
+template <typename K, typename I, typename Mk, typename M>
+std::istream& operator>>(std::istream&, Nef_polyhedron_S2<K,I,Mk,M>&);
+
+
+template <typename K, typename I, typename Mk, typename M>
+class Nef_polyhedron_S2_rep { 
+
+  typedef Nef_polyhedron_S2_rep<K,I,Mk,M>        Self;
+  friend class Nef_polyhedron_S2<K,I,Mk,M>;
+
+ public:
+  typedef CGAL::Sphere_geometry<K>                     Sphere_kernel;
+  typedef Mk                                           Mark;
+  typedef M                                            Sphere_map;
+  typedef CGAL::SM_const_decorator<Sphere_map>         Const_decorator;
+  typedef CGAL::SM_decorator<Sphere_map>               Decorator;
+  typedef CGAL::SM_overlayer<Decorator>                Overlayer;
+  typedef CGAL::SM_point_locator<Const_decorator>      Locator;
+
+ private:
+  Sphere_map sm_; 
+  
+public:
+  Nef_polyhedron_S2_rep() : sm_() {}
+  Nef_polyhedron_S2_rep(const Self&) : sm_() {}
+  ~Nef_polyhedron_S2_rep() { sm_.clear(); }
+};
+
+/*{\Moptions print_title=yes }*/ 
+/*{\Manpage {Nef_polyhedron_S2}{K}
+{Nef Polyhedra in the sphere surface}{N}}*/
+
+/*{\Mdefinition An instance of data type |\Mname| is a subset of $S_2$
+that is the result of forming complements and intersections starting
+from a finite set |H| of half-spaces. |\Mtype| is closed under all
+binary set operations |intersection|, |union|, |difference|,
+|complement| and under the topological operations |boundary|,
+|closure|, and |interior|.
+
+The template parameter |Kernel| is specified via a kernel concept. 
+|Kernel| must be a model of the concept |NefSphereKernelTraits_2|.
+}*/
+
+template <typename Kernel_, typename Items_ = SM_items, typename Mark_ = bool,  
+	  typename Map_ = Sphere_map<Sphere_geometry<Kernel_>,Items_, Mark_> >
+class Nef_polyhedron_S2 : public Handle_for< Nef_polyhedron_S2_rep<Kernel_,Items_,Mark_,Map_> >, 
+			  public Nef_polyhedron_S2_rep<Kernel_,Items_,Mark_,Map_>::Const_decorator { 
+  
+  using Nef_polyhedron_S2_rep<Kernel_,Items_,Mark_,Map_>::Const_decorator::set_sm;
+
+public:
+  /*{\Mtypes 7}*/
+  typedef Items_                                              Items;
+  typedef Kernel_                                             Kernel;
+  typedef Map_                                                Sphere_map;
+  typedef Mark_                                               Mark;
+  typedef Nef_polyhedron_S2<Kernel,Items,Mark,Sphere_map>     Self;
+  typedef Nef_polyhedron_S2_rep<Kernel,Items,Mark,Sphere_map> Rep;
+  typedef Handle_for< Nef_polyhedron_S2_rep<Kernel,Items,Mark,Sphere_map> >  Base;
+  typedef typename Rep::Sphere_kernel                         Sphere_kernel;
+//  typedef typename Rep::Sphere_map                            Sphere_map;
+
+  typedef typename Sphere_kernel::Sphere_point   Sphere_point;
+  /*{\Mtypemember points in the sphere surface.}*/
+
+  typedef typename Sphere_kernel::Sphere_segment Sphere_segment;
+  /*{\Mtypemember segments in the sphere surface.}*/
+
+  typedef typename Sphere_kernel::Sphere_circle  Sphere_circle;
+  /*{\Mtypemember oriented great circles modeling spherical half-spaces}*/
+
+  typedef typename Sphere_kernel::Sphere_direction Sphere_direction;
+
+
+//  typedef typename Rep::Mark Mark;
+  /*{\Xtypemember marking set membership or exclusion.}*/
+
+  enum Boundary { EXCLUDED=0, INCLUDED=1 };
+  /*{\Menum construction selection.}*/
+
+  enum Content { EMPTY=0, COMPLETE=1 };
+  /*{\Menum construction selection}*/
+
+  const Sphere_map& sphere_map() const { return this->ptr()->sm_; }
+protected:
+  Sphere_map& sphere_map() { return this->ptr()->sm_; } 
+
+  struct AND { bool operator()(const Mark& b1, const Mark& b2)  const { return b1&&b2; }  };
+  struct OR { bool operator()(const Mark& b1, const Mark& b2)   const { return b1||b2; }  };
+  struct DIFF { bool operator()(const Mark& b1, const Mark& b2) const { return b1&&!b2; } };
+  struct XOR { bool operator()(const Mark& b1, const Mark& b2)  const 
+               { return (b1&&!b2)||(!b1&&b2); } };   
+
+  typedef Nef_polyhedron_S2_rep<Kernel,Items,Mark,Sphere_map>  Nef_rep;
+  typedef typename Nef_rep::Decorator                     Decorator;
+public:
+  typedef typename Nef_rep::Const_decorator               Const_decorator;
+protected:
+  typedef typename Nef_rep::Overlayer                     Overlayer;
+  typedef typename Nef_rep::Locator                       Locator;
+
+  friend std::ostream& operator<< <>
+      (std::ostream& os, const Self& NP);
+  friend std::istream& operator>> <>
+      (std::istream& is, Self& NP);
+
+public:
+  typedef typename Decorator::SVertex_handle         SVertex_handle;
+  typedef typename Decorator::SHalfedge_handle       SHalfedge_handle;
+  typedef typename Decorator::SHalfloop_handle       SHalfloop_handle;
+  typedef typename Decorator::SFace_handle           SFace_handle;
+
+  typedef typename Sphere_map::SVertex_base          SVertex;
+  typedef typename Sphere_map::SHalfedge_base        SHalfedge;
+  typedef typename Sphere_map::SHalfloop             SHalfloop;
+  typedef typename Sphere_map::SFace_base            SFace;
+
+  typedef typename Decorator::SVertex_const_handle   SVertex_const_handle;
+  typedef typename Decorator::SHalfedge_const_handle SHalfedge_const_handle;
+  typedef typename Decorator::SHalfloop_const_handle SHalfloop_const_handle;
+  typedef typename Decorator::SFace_const_handle     SFace_const_handle;
+
+  typedef typename Decorator::SVertex_iterator       SVertex_iterator;
+  typedef typename Decorator::SHalfedge_iterator     SHalfedge_iterator;
+  typedef typename Decorator::SHalfloop_iterator     SHalfloop_iterator;
+  typedef typename Decorator::SFace_iterator         SFace_iterator;
+
+  typedef typename Const_decorator::SVertex_const_iterator   
+                                                    SVertex_const_iterator;
+  typedef typename Const_decorator::SHalfedge_const_iterator 
+                                                    SHalfedge_const_iterator;
+  typedef typename Const_decorator::SHalfloop_const_iterator 
+                                                    SHalfloop_const_iterator;
+  typedef typename Const_decorator::SFace_const_iterator     
+                                                    SFace_const_iterator;
+  typedef typename Const_decorator::Size_type Size_type;
+  typedef Size_type size_type;
+  
+  typedef std::list<Sphere_segment>  SS_list;
+  typedef typename SS_list::const_iterator SS_iterator;
+
+  friend class Nef_polyhedron_3<Kernel, SNC_items, Mark>;
+
+public:
+  /*{\Mcreation 3}*/
+
+  Nef_polyhedron_S2(Content sphere = EMPTY) : Base(Nef_rep())
+  /*{\Mcreate creates an instance |\Mvar| of type |\Mname|
+  and initializes it to the empty set if |sphere == EMPTY|
+  and to the whole sphere if |sphere == COMPLETE|.}*/
+  {
+    set_sm(&sphere_map());
+    Decorator D(&sphere_map());
+    SFace_handle sf=D.new_sface();
+    sf->mark() = bool(sphere);
+  }
+
+
+  Nef_polyhedron_S2(const Sphere_circle& c, 
+		    Boundary circle = INCLUDED) : Base(Nef_rep()) {
+  /*{\Mcreate creates a Nef polyhedron |\Mvar| containing the half-sphere
+  left of |c| including |c| if |circle==INCLUDED|, excluding |c| if 
+  |circle==EXCLUDED|.}*/  
+    
+    set_sm(&sphere_map());
+    CGAL_NEF_TRACEN("Nef_polyhedron_S2(): construction from circle "<<c);
+    Decorator D(&sphere_map());
+    Overlayer O(&sphere_map()); 
+    O.create(c);
+    SHalfloop_handle h = D.shalfloop();
+    if ( h->circle() != c ) h = h->twin();
+    h->incident_sface()->mark() = true;
+    h->mark() = h->twin()->mark() = bool(circle);
+  }
+
+
+  template <class Forward_iterator>
+  Nef_polyhedron_S2(Forward_iterator first, Forward_iterator beyond,
+    Boundary b = INCLUDED) : Base(Nef_rep())
+  /*{\Mcreate creates a Nef polyhedron |\Mvar| from the set of sphere
+    segments in the iterator range |[first,beyond)|. If the set of sphere
+    segments is a simple polygon that separates the sphere surface
+    into two regions, then the polygonal region that is left of the
+    segment |*first| is selected. The polygonal region includes its
+    boundary if |b = INCLUDED| and excludes the boundary
+    otherwise. |Forward_iterator| has to be an iterator with value
+    type |Sphere_segment|.}*/
+  { CGAL_NEF_TRACEN("Nef_polyhedron_S2(): creation from segment range");
+    CGAL_assertion(first!=beyond);
+    set_sm(&sphere_map());
+    Overlayer D(&sphere_map());
+    Sphere_segment s = *first;
+    D.create_from_segments(first,beyond);
+    SHalfedge_iterator e;
+    CGAL_forall_shalfedges(e,D) {
+      Sphere_circle c(e->circle());
+      if ( c == s.sphere_circle() ) break;
+    }
+    if ( e != SHalfedge_iterator() ) {
+      if ( e->circle() != s.sphere_circle() ) e = e->twin();
+      CGAL_assertion( e->circle() == s.sphere_circle() );
+      D.set_marks_in_face_cycle(e,bool(b));
+      if ( D.number_of_sfaces() > 2 ) e->incident_sface()->mark() = true;
+      else                            e->incident_sface()->mark() = !bool(b);
+      return;
+    }
+    D.simplify();
+  }
+
+  Nef_polyhedron_S2(const Self& N1) : Base(N1), Const_decorator() {
+    set_sm(&sphere_map());
+  }
+  Nef_polyhedron_S2& operator=(const Self& N1)
+  { Base::operator=(N1); set_sm(&sphere_map()); return (*this); }
+  ~Nef_polyhedron_S2() {}
+
+  template <class Forward_iterator>
+  Nef_polyhedron_S2(Forward_iterator first, Forward_iterator beyond, 
+    double p) : Base(Nef_rep())
+  /*{\Xcreate creates a random Nef polyhedron from the arrangement of
+  the set of circles |S = set[first,beyond)|. The cells of the arrangement
+  are selected uniformly at random with probability $p$. \precond $0 < p
+  < 1$.}*/
+  { CGAL_assertion(0<=p && p<=1);
+    CGAL_assertion(first!=beyond);
+    set_sm(&sphere_map());
+    Overlayer D(&sphere_map());
+    D.create_from_circles(first, beyond); D.simplify();
+
+    boost::rand48 rng;
+    boost::uniform_real<> dist(0,1);
+    boost::variate_generator<boost::rand48&, boost::uniform_real<> > get_double(rng,dist);
+
+    SVertex_iterator v; SHalfedge_iterator e; SFace_iterator f;
+    CGAL_forall_svertices(v,D)
+      v->mark() = ( get_double() < p ? true : false );
+    CGAL_forall_shalfedges(e,D)
+      e->mark() = ( get_double() < p ? true : false );
+    CGAL_forall_sfaces(f,D)
+      f->mark() = ( get_double() < p ? true : false );
+    D.simplify();
+  }
+
+ void delegate( Modifier_base<Sphere_map>& modifier) {
+   // calls the `operator()' of the `modifier'. Precondition: The
+   // `modifier' returns a consistent representation.
+   modifier(sphere_map());
+   //   CGAL_expensive_postcondition( is_valid());
+ }
+
+//protected:
+  Nef_polyhedron_S2(const Sphere_map& H, bool clone=true) : Base(Nef_rep()) 
+  /*{\Xcreate makes |\Mvar| a new object.  If |clone==true| then the
+  underlying structure of |H| is copied into |\Mvar|.}*/
+{ 
+    if(clone)
+      this->ptr()->sm_ = H; 
+    set_sm(&sphere_map());
+  }
+  
+  void clone_rep() { *this = Self(sphere_map()); }
+
+  /*{\Moperations 4 3 }*/
+  public:
+
+  void clear(Content plane = EMPTY)
+  { *this = Nef_polyhedron_S2(plane); }
+  /*{\Mop makes |\Mvar| the empty set if |plane == EMPTY| and the
+  full plane if |plane == COMPLETE|.}*/
+
+  bool is_empty() const
+  /*{\Mop returns true if |\Mvar| is empty, false otherwise.}*/
+  { Const_decorator D(&sphere_map());
+    CGAL_NEF_TRACEN("is_empty()"<<*this);
+    SFace_const_iterator f = D.sfaces_begin();
+    return (D.number_of_svertices()==0 &&
+            D.number_of_sedges()==0 &&
+            D.number_of_sloops()==0 &&
+            D.number_of_sfaces()==1 &&
+            f->mark() == false);
+  }
+
+  bool is_plane() const
+  /*{\Mop returns true if |\Mvar| is the whole plane, false otherwise.}*/
+  { Const_decorator D(&sphere_map());
+    SFace_const_iterator f = D.sfaces_begin();
+    return (D.number_of_svertices()==0 &&
+            D.number_of_sedges()==0 &&
+            D.number_of_sloops()==0 &&
+            D.number_of_sfaces()==1 &&
+            f->mark() == true);
+  }
+
+  void extract_complement()
+  { CGAL_NEF_TRACEN("extract complement");
+    if ( this->is_shared() ) clone_rep();
+    Overlayer D(&sphere_map());
+    SVertex_iterator v;
+    SHalfedge_iterator e;
+    SFace_iterator f;
+    CGAL_forall_svertices(v,D) v->mark() = !v->mark();
+    CGAL_forall_sedges(e,D) e->mark() = !e->mark();
+    CGAL_forall_sfaces(f,D) f->mark() = !f->mark();
+    
+    if ( D.has_shalfloop() )
+      D.shalfloop()->mark() = 
+	D.shalfloop()->twin()->mark() = 
+	!D.shalfloop()->mark();
+  }
+
+  void extract_interior()
+  { CGAL_NEF_TRACEN("extract interior");
+    if ( this->is_shared() ) clone_rep();
+    Overlayer D(&sphere_map());
+    SVertex_iterator v;
+    SHalfedge_iterator e;
+    CGAL_forall_svertices(v,D) v->mark() = false;
+    CGAL_forall_sedges(e,D) e->mark() = false;
+    if ( D.has_sloop() ) D.shalfloop()->mark() = false;
+    D.simplify();
+  }
+
+
+  void extract_boundary()
+  { CGAL_NEF_TRACEN("extract boundary");
+    if ( this->is_shared() ) clone_rep();
+    Overlayer D(&sphere_map());
+    SVertex_iterator v;
+    SHalfedge_iterator e;
+    SFace_iterator f;
+    CGAL_forall_svertices(v,D) v->mark() = true;
+    CGAL_forall_sedges(e,D)    e->mark() = true;
+    CGAL_forall_sfaces(f,D)    f->mark() = false;
+    if ( D.has_sloop() )       D.shalfloop()->mark() = D.shalfoop()->twin() = true;
+    D.simplify();
+  }
+
+  void extract_closure()
+  /*{\Xop converts |\Mvar| to its closure. }*/
+  { CGAL_NEF_TRACEN("extract closure");
+    extract_complement();
+    extract_interior();
+    extract_complement();
+  }
+
+  void extract_regularization()
+  /*{\Xop converts |\Mvar| to its regularization. }*/
+  { CGAL_NEF_TRACEN("extract regularization");
+    extract_interior();
+    extract_closure();
+  }
+
+  /*{\Mtext \headerline{Constructive Operations}}*/
+
+  Self complement() const
+  /*{\Mop returns the complement of |\Mvar| in the plane.}*/
+  { Self res = *this;
+    res.extract_complement();
+    return res;
+  }
+
+
+  Self interior() const
+  /*{\Mop returns the interior of |\Mvar|.}*/
+  { Self res = *this;
+    res.extract_interior();
+    return res;
+  }
+
+  Self closure() const
+  /*{\Mop returns the closure of |\Mvar|.}*/
+  { Self res = *this;
+    res.extract_closure();
+    return res;
+  }
+
+  Self boundary() const
+  /*{\Mop returns the boundary of |\Mvar|.}*/
+  { Self res = *this;
+    res.extract_boundary();
+    return res;
+  }
+
+  Self regularization() const
+  /*{\Mop returns the regularized polyhedron (closure of interior).}*/
+  { Self res = *this;
+    res.extract_regularization();
+    return res;
+  }
+
+
+  Self intersection(const Self& N1) const
+  /*{\Mop returns |\Mvar| $\cap$ |N1|. }*/
+  { Self res(sphere_map(),false); // empty
+    Overlayer D(&res.sphere_map());
+    D.subdivide(&sphere_map(),&N1.sphere_map());
+    AND _and; D.select(_and); D.simplify();
+    return res;
+  }
+
+
+  Self join(const Self& N1) const
+  /*{\Mop returns |\Mvar| $\cup$ |N1|. }*/
+  { Self res(sphere_map(),false); // empty
+    Overlayer D(&res.sphere_map());
+    D.subdivide(&sphere_map(),&N1.sphere_map());
+    OR _or; D.select(_or); D.simplify();
+    return res;
+  }
+
+  Self difference(const Self& N1) const
+  /*{\Mop returns |\Mvar| $-$ |N1|. }*/
+  { Self res(sphere_map(),false); // empty
+    Overlayer D(&res.sphere_map());
+    D.subdivide(&sphere_map(),&N1.sphere_map());
+    DIFF _diff; D.select(_diff); D.simplify();
+    return res;
+  }    
+
+  Self symmetric_difference(
+    const Self& N1) const
+  /*{\Mop returns the symmectric difference |\Mvar - T| $\cup$ 
+          |T - \Mvar|. }*/
+  { Self res(sphere_map(),false); // empty
+    Overlayer D(&res.sphere_map());
+    D.subdivide(&sphere_map(),&N1.sphere_map());
+    XOR _xor; D.select(_xor); D.simplify();
+    return res;
+  }
+
+  /*{\Mtext Additionally there are operators |*,+,-,^,!| which
+  implement the binary operations \emph{intersection}, \emph{union},
+  \emph{difference}, \emph{symmetric difference}, and the unary
+  operation \emph{complement} respectively. There are also the
+  corresponding modification operations |*=,+=,-=,^=|.}*/
+
+  Self  operator*(const Self& N1) const
+  { return intersection(N1); }
+
+  Self  operator+(const Self& N1) const
+  { return join(N1); }
+
+  Self  operator-(const Self& N1) const
+  { return difference(N1); }
+
+  Self  operator^(const Self& N1) const
+  { return symmetric_difference(N1); }
+
+  Self  operator!() const
+  { return complement(); }
+   
+  Self& operator*=(const Self& N1)
+  { *this = intersection(N1); return *this; }
+
+  Self& operator+=(const Self& N1)
+  { *this = join(N1); return *this; }
+
+  Self& operator-=(const Self& N1)
+  { *this = difference(N1); return *this; }
+
+  Self& operator^=(const Self& N1)
+  { *this = symmetric_difference(N1); return *this; }
+
+  /*{\Mtext There are also comparison operations like |<,<=,>,>=,==,!=|
+  which implement the relations subset, subset or equal, superset, superset
+  or equal, equality, inequality, respectively.}*/
+
+  bool operator==(const Self& N1) const
+  { return symmetric_difference(N1).is_empty(); }
+
+  bool operator!=(const Self& N1) const
+  { return !operator==(N1); }  
+
+  bool operator<=(const Self& N1) const
+  { return difference(N1).is_empty(); } 
+
+  bool operator<(const Self& N1) const
+  { return difference(N1).is_empty() && !N1.difference(*this).is_empty(); } 
+
+  bool operator>=(const Self& N1) const
+  { return N1.difference(*this).is_empty(); } 
+
+  bool operator>(const Self& N1) const   
+  { return N1.difference(*this).is_empty() && !difference(N1).is_empty(); } 
+
+
+  /*{\Mtext \headerline{Exploration - Point location - Ray shooting}
+  As Nef polyhedra are the result of forming complements 
+  and intersections starting from a set |H| of half-spaces that are
+  defined by oriented lines in the plane, they can be represented by
+  an attributed plane map $M = (V,E,F)$. For topological queries
+  within |M| the following types and operations allow exploration
+  access to this structure.}*/
+
+  /*{\Mtypes 3}*/
+  typedef Const_decorator Topological_explorer;
+
+  typedef Const_decorator Explorer;
+  /*{\Mtypemember a decorator to examine the underlying plane map. 
+  See the manual page of |Explorer|.}*/
+
+  typedef typename Locator::Object_handle Object_handle;
+  /*{\Mtypemember a generic handle to an object of the underlying
+  plane map. The kind of object |(vertex, halfedge, face)| can 
+  be determined and the object can be assigned to a corresponding
+  handle by the three functions:\\
+  |bool assign(SVertex_const_handle& h, Object_handle)|\\
+  |bool assign(SHalfedge_const_handle& h, Object_handle)|\\
+  |bool assign(SFace_const_handle& h, Object_handle)|\\
+  where each function returns |true| iff the assignment to
+  |h| was done.}*/
+
+
+  /*{\Moperations 3 1 }*/
+
+  bool contains(Object_handle h) const
+  /*{\Mop  returns true iff the object |h| is contained in the set
+  represented by |\Mvar|.}*/
+  { Locator PL(&sphere_map()); return PL.mark(h); }
+
+  bool contained_in_boundary(Object_handle h) const
+  /*{\Mop  returns true iff the object |h| is contained in the $1$-skeleton
+  of |\Mvar|.}*/
+  { SVertex_const_handle v;
+    SHalfedge_const_handle e;
+    return  ( CGAL::assign(v,h) || CGAL::assign(e,h) );
+  }
+
+
+  Object_handle locate(const Sphere_point& p) const
+  /*{\Mop  returns a generic handle |h| to an object (face, halfedge, vertex) 
+  of the underlying plane map that contains the point |p| in its relative 
+  interior. The point |p| is contained in the set represented by |\Mvar| if 
+  |\Mvar.contains(h)| is true. The location mode flag |m| allows one to choose
+  between different point location strategies.}*/
+  { 
+    Locator PL(&sphere_map());
+    return PL.locate(p); 
+  }
+
+  struct INSET {
+    const Const_decorator& D;
+    INSET(const Const_decorator& Di) : D(Di) {}
+    bool operator()(SVertex_const_handle v) const { return v->mark(); }
+    bool operator()(SHalfedge_const_handle e) const { return e->mark(); }
+    bool operator()(SHalfloop_const_handle l) const { return l->mark(); }
+    bool operator()(SFace_const_handle f) const { return f->mark(); }
+  };
+
+  Object_handle ray_shoot(const Sphere_point& p, 
+			  const Sphere_direction& d) const
+  /*{\Mop returns a handle |h| with |\Mvar.contains(h)| that can be
+  converted to a |SVertex_/SHalfedge_/SFace_const_handle| as described
+  above. The object returned is intersected by the ray starting in |p|
+  with direction |d| and has minimal distance to |p|.  The operation
+  returns the null handle |NULL| if the ray shoot along |d| does not hit
+  any object |h| of |\Mvar| with |\Mvar.contains(h)|.}*/
+  { 
+    Locator PL(&sphere_map());
+    return PL.ray_shoot(p,d,INSET(PL));
+  }
+
+  struct INSKEL {
+    bool operator()(SVertex_const_handle) const { return true; }
+    bool operator()(SHalfedge_const_handle) const { return true; }
+    bool operator()(SHalfloop_const_handle) const { return true; }
+    bool operator()(SFace_const_handle) const { return false; }
+  };
+
+  Object_handle ray_shoot_to_boundary(const Sphere_point& p, 
+				      const Sphere_direction& d) const
+  /*{\Mop returns a handle |h| that can be converted to a
+  |SVertex_/SHalfedge_const_handle| as described above. The object
+  returned is part of the $1$-skeleton of |\Mvar|, intersected by the
+  ray starting in |p| with direction |d| and has minimal distance to
+  |p|.  The operation returns the null handle |NULL| if the ray shoot
+  along |d| does not hit any $1$-skeleton object |h| of |\Mvar|. The
+  location mode flag |m| allows one to choose between different point
+  location strategies.}*/
+  { 
+    Locator PL(&sphere_map());
+    return PL.ray_shoot(p,d,INSKEL());
+  }
+
+
+  //  Explorer explorer() const 
+  /*{\Mop returns a decorator object which allows read-only access of
+  the underlying plane map. See the manual page |Explorer| for its 
+  usage.}*/
+  //  { return Explorer(const_cast<Sphere_map*>(&sphere_map())); }
+
+  /*{\Mtext\headerline{Input and Output}
+  A Nef polyhedron |\Mvar| can be visualized in an open GL window. The 
+  output operator is defined in the file 
+  |CGAL/IO/Nef_\-poly\-hedron_2_\-Win\-dow_\-stream.h|.
+  }*/
+
+  /*{\Mimplementation Nef polyhedra are implemented on top of a halfedge
+  data structure and use linear space in the number of vertices, edges
+  and facets.  Operations like |empty| take constant time. The
+  operations |clear|, |complement|, |interior|, |closure|, |boundary|,
+  |regularization|, input and output take linear time. All binary set
+  operations and comparison operations take time $O(n \log n)$ where $n$
+  is the size of the output plus the size of the input.
+
+  The point location and ray shooting operations are implemented in
+  the naive way. The operations run in linear query time without
+  any preprocessing.}*/
+
+  /*{\Mexample Nef polyhedra are parameterized by a standard CGAL
+  kernel. 
+
+  \begin{Mverb}
+  #include <CGAL/Homogeneous.h>
+  #include <CGAL/leda_integer.h>
+  #include <CGAL/Nef_polyhedron_S2.h>
+
+  using namespace CGAL;
+  typedef  Homogeneous<leda_integer>   Kernel;
+  typedef  SM_items<Kernel, bool>      SM_items;
+  typedef  Nef_polyhedron_S2<SM_items> Nef_polyhedron;
+  typedef  Nef_polyhedron::Sphere_circle Sphere_circle;
+
+  int main()
+  {
+    Nef_polyhedron N1(Sphere_circle(1,0,0));
+    Nef_polyhedron N2(Sphere_circle(0,1,0), Nef_polyhedron::EXCLUDED);
+    Nef_polyhedron N3 = N1 * N2; // line (*)
+    return 0;
+  }
+  \end{Mverb}
+  After line (*) |N3| is the intersection of |N1| and |N2|.}*/
+
+
+}; // end of Nef_polyhedron_S2
+
+template <typename Kernel,typename Items,typename Mark, typename Sphere_map>
+std::ostream& operator<<
+ (std::ostream& os, const Nef_polyhedron_S2<Kernel,Items,Mark,Sphere_map>& NP)
+{
+  os << "Nef_polyhedron_S2\n";
+  typedef typename Nef_polyhedron_S2<Kernel,Items,Mark,Sphere_map>::Explorer Decorator;
+  CGAL::SM_io_parser<Decorator> O(os, Decorator(&NP.sphere_map())); 
+  O.print();
+  return os;
+}
+
+template <typename Kernel,typename Items, typename Mark, typename Sphere_map>
+std::istream& operator>>
+  (std::istream& is, Nef_polyhedron_S2<Kernel,Items,Mark,Sphere_map>& NP)
+{
+  typedef typename Nef_polyhedron_S2<Kernel,Items,Mark,Sphere_map>::Decorator Decorator;
+  CGAL::SM_io_parser<Decorator> I(is, Decorator(&NP.sphere_map())); 
+  //  if ( I.check_sep("Nef_polyhedron_S2") ) 
+  I.read();
+  /*
+  else {
+    std::cerr << "Nef_polyhedron_S2 input corrupted." << std::endl;
+    NP = Nef_polyhedron_S2<Kernel,Items,Mark,Sphere_map>();
+  }
+  */
+  /*
+  typename Nef_polyhedron_S2<Kernel,Items,Mark,Sphere_map>::Topological_explorer D(NP.explorer());
+  D.check_integrity_and_topological_planarity();
+  */
+  return is;
+}
+
+
+#if defined(BOOST_MSVC)
+#  pragma warning(pop)
+#endif
+
+} //namespace CGAL
+#endif //CGAL_NEF_POLYHEDRON_S2_H
diff --git a/3rdparty/CGAL/include/CGAL/Nef_polynomial.h b/3rdparty/CGAL/include/CGAL/Nef_polynomial.h
new file mode 100644
index 0000000..cf57ef9
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Nef_polynomial.h
@@ -0,0 +1,285 @@
+// Copyright (c) 1997-2000  Max-Planck-Institute Saarbruecken (Germany).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Michael Seel <seel at mpi-sb.mpg.de>
+
+#ifndef CGAL_NEF_POLYNOMIAL_H
+#define CGAL_NEF_POLYNOMIAL_H
+
+#include <CGAL/Nef_2/Polynomial.h>
+#include <cstddef>
+#undef CGAL_NEF_DEBUG
+#define CGAL_NEF_DEBUG 3
+#include <CGAL/Nef_2/debug.h>
+#include <vector>
+
+#include <CGAL/Kernel/mpl.h>
+
+#include <boost/operators.hpp>
+
+namespace CGAL {
+
+#define CGAL_int(T)    typename First_if_different<int,    T>::Type
+#define CGAL_double(T) typename First_if_different<double, T>::Type
+
+template <class NT> 
+class Nef_polynomial
+  : boost::ordered_field_operators1< Nef_polynomial<NT>
+  , boost::ordered_field_operators2< Nef_polynomial<NT>, int
+  > >
+  , public Nef::Polynomial<NT>
+{
+  typedef typename CGAL::Nef::Polynomial<NT>  Base;
+  typedef typename Base::size_type       size_type;
+
+ protected:
+  Nef_polynomial(size_type s) : Base(s) {}
+
+ public:
+  Nef_polynomial() : Base() {}
+  Nef_polynomial(const NT& a0) : Base(a0) {}
+  Nef_polynomial(const NT& a0, const NT& a1) : Base(a0,a1) {}
+  Nef_polynomial(const NT& a0, const NT& a1, const NT& a2) : Base(a0,a1,a2) {}
+
+  template <class Fwd_iterator>
+  Nef_polynomial(std::pair<Fwd_iterator, Fwd_iterator> poly) : Base(poly) {}
+
+  Nef_polynomial(CGAL_double(NT) n) : Base(n) {}
+  Nef_polynomial(CGAL_double(NT) n1, CGAL_double(NT) n2) : Base(n1, n2) {}
+  Nef_polynomial(CGAL_int(NT) n) : Base(NT(n)) {}
+  Nef_polynomial(CGAL_int(NT) n1, CGAL_int(NT) n2) : Base(n1,n2) {}
+
+  Nef_polynomial(const Base& p) : Base(p) {}
+
+  Base & polynomial() { return static_cast<Base&>(*this); }
+  const Base & polynomial() const  { return static_cast<const Base&>(*this); }
+
+    static NT& infi_maximal_value() {
+      static NT R_ = 1;
+      return R_;
+    }
+};
+
+template <class NT> 
+inline
+Nef_polynomial<NT> operator+(const Nef_polynomial<NT> &a)
+{
+  return a;
+}
+
+template <class NT> 
+inline
+Nef_polynomial<NT> operator-(const Nef_polynomial<NT> &a)
+{
+  return - a.polynomial();
+}
+
+template <class NT> 
+inline
+bool operator<(const Nef_polynomial<NT> &a, const Nef_polynomial<NT> &b)
+{
+  return a.polynomial() < b.polynomial();
+}
+
+template <class NT> 
+inline
+bool operator==(const Nef_polynomial<NT> &a, const Nef_polynomial<NT> &b)
+{
+  return a.polynomial() == b.polynomial();
+}
+
+template <class NT> 
+inline
+bool operator==(const Nef_polynomial<NT> &a, int b)
+{
+  return a.polynomial() == b;
+}
+
+template <class NT> 
+inline
+bool operator<(const Nef_polynomial<NT> &a, int b)
+{
+  return a.polynomial() < b;
+}
+
+template <class NT> 
+inline
+bool operator>(const Nef_polynomial<NT> &a, int b)
+{
+  return a.polynomial() > b;
+}
+
+
+#undef CGAL_double
+#undef CGAL_int
+
+
+// TODO: integral_division to get it an UniqueFactorizationDomain
+// TODO: div / mod  for EuclideanRing
+template <class NT> class Algebraic_structure_traits< Nef_polynomial<NT> >
+    : public Algebraic_structure_traits_base
+             < Nef_polynomial<NT>, CGAL::Integral_domain_without_division_tag> 
+{
+    typedef Algebraic_structure_traits<NT> AST_NT;
+public:
+    typedef Nef_polynomial<NT> Type;
+    typedef typename AST_NT::Is_exact            Is_exact;
+    typedef Tag_false                            Is_numerical_sensitive;                                                           
+    class Integral_division
+        : public std::binary_function< Type, Type,
+                                Type > {
+    public:
+        Type operator()( const Type& x,
+                const Type& y ) const {
+	  Type result = x / y;
+	  CGAL_postcondition_msg(result * y == x, "exact_division failed\n");
+	  return result;
+        }
+    };
+
+    class Gcd 
+      : public std::binary_function< Type, Type, Type > {
+    public:
+        Type operator()( const Type& x, const Type& y ) const {
+            // By definition gcd(0,0) == 0
+          if( x == Type(0) && y == Type(0) )
+            return Type(0);
+            
+          return CGAL::Nef::gcd( x, y );
+        }
+        CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( Type )
+    };
+};
+
+template <class NT> class Real_embeddable_traits< Nef_polynomial<NT> > 
+  : public INTERN_RET::Real_embeddable_traits_base< Nef_polynomial<NT> , CGAL::Tag_true > {
+  public:
+    typedef Nef_polynomial<NT> Type;
+    class Abs 
+        : public std::unary_function< Type, Type> {
+    public:
+        Type inline operator()( const Type& x ) const {
+            return (CGAL::Nef::sign( x ) == CGAL::NEGATIVE)? -x : x;
+        }        
+    };
+
+    class Sgn 
+      : public std::unary_function< Type, CGAL::Sign > {
+      public:
+        CGAL::Sign inline operator()( const Type& x ) const {
+            return CGAL::Nef::sign( x );
+        }        
+    };
+    
+    class Compare 
+      : public std::binary_function< Type, Type,
+                                CGAL::Comparison_result > {
+      public:
+        CGAL::Comparison_result inline operator()( 
+                const Type& x, 
+                const Type& y ) const {
+            return (CGAL::Comparison_result) CGAL::Nef::sign( x - y );
+        }
+    };
+    
+    class To_double 
+      : public std::unary_function< Type, double > {
+      public:
+        double inline operator()( const Type& p ) const {
+            return CGAL::to_double(
+                    p.eval_at(Nef_polynomial<NT>::infi_maximal_value()));
+        }
+    };
+    
+    class To_interval 
+      : public std::unary_function< Type, std::pair< double, double > > {
+      public:
+        std::pair<double, double> operator()( const Type& p ) const {
+            return CGAL::to_interval(p.eval_at(Nef_polynomial<NT>::infi_maximal_value()));
+        }
+    };
+};
+
+template <typename NT>
+inline Nef_polynomial<NT> min BOOST_PREVENT_MACRO_SUBSTITUTION
+(const Nef_polynomial<NT>& x,const Nef_polynomial<NT>& y){
+  return (x<=y)?x:y; 
+}
+
+template <typename NT>
+inline Nef_polynomial<NT> max BOOST_PREVENT_MACRO_SUBSTITUTION
+(const Nef_polynomial<NT>& x,const Nef_polynomial<NT>& y){
+  return (x>=y)?x:y; 
+}
+
+template <typename NT>
+class Fraction_traits<Nef_polynomial<NT> > {
+public:
+    typedef Nef_polynomial<NT> Type;
+    typedef Fraction_traits<NT> Base_traits;
+    typedef typename Base_traits::Is_fraction Is_fraction;
+    typedef CGAL::Nef_polynomial<typename Base_traits::Numerator_type>
+      Numerator_type;
+    typedef typename Base_traits::Denominator_type Denominator_type;
+    //TODO:    typedef Base_traits::Common_factor Common_factor;
+    class Decompose {
+    public:
+        typedef Type first_argument_type;
+        typedef Numerator_type second_argument_type;
+        typedef Denominator_type third_argument_type;
+        void operator () (const first_argument_type& rat, 
+			  second_argument_type& num,
+			  third_argument_type& den) {
+	  typename Base_traits::Decompose decompose;
+	  third_argument_type num0;
+	  third_argument_type num1;
+	  third_argument_type den1;
+	  third_argument_type den0;
+	  decompose(rat[0], num0, den0);
+	  if(rat.degree() > 0) {
+	    decompose(rat[1], num1, den1);
+	    // TODO	    den = den1/gcd(den0, den1)*den0;
+	    den = den1*den0;
+	    num = Numerator_type(num0*den1, num1*den0);
+	  } else {
+	    den = den0;
+	    num = Numerator_type(num0);
+	  }
+        }
+    };
+    class Compose {
+    public:
+        typedef Numerator_type first_argument_type;
+        typedef Denominator_type second_argument_type;
+        typedef Type result_type;
+        result_type operator () (const first_argument_type& num,
+				 const second_argument_type& den) {
+	  typename Base_traits::Compose compose;
+	  if(num.degree() == 0)
+	    return result_type(compose(num[0],den));
+	  else
+	    return result_type(compose(num[0],den),
+			       compose(num[1],den));
+        }
+    };
+};
+
+
+} //namespace CGAL
+
+#endif  // CGAL_NEF_POLYNOMIAL_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nef_polynomial_fwd.h b/3rdparty/CGAL/include/CGAL/Nef_polynomial_fwd.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nef_polynomial_fwd.h
rename to 3rdparty/CGAL/include/CGAL/Nef_polynomial_fwd.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Nested_iterator.h b/3rdparty/CGAL/include/CGAL/Nested_iterator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Nested_iterator.h
rename to 3rdparty/CGAL/include/CGAL/Nested_iterator.h
diff --git a/3rdparty/CGAL/include/CGAL/NewKernel_d/Cartesian_LA_base.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Cartesian_LA_base.h
new file mode 100644
index 0000000..00755ea
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/NewKernel_d/Cartesian_LA_base.h
@@ -0,0 +1,176 @@
+// Copyright (c) 2014
+// INRIA Saclay-Ile de France (France)
+//
+// 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(s)     : Marc Glisse
+
+#ifndef CGAL_KERNEL_D_CARTESIAN_LA_BASE_H
+#define CGAL_KERNEL_D_CARTESIAN_LA_BASE_H
+
+#include <CGAL/basic.h>
+#include <CGAL/Origin.h>
+#include <boost/type_traits/integral_constant.hpp>
+#include <CGAL/representation_tags.h>
+#include <CGAL/NewKernel_d/functor_tags.h>
+#include <CGAL/Uncertain.h>
+#include <CGAL/typeset.h>
+#include <CGAL/NewKernel_d/Dimension_base.h>
+#include <CGAL/NewKernel_d/Cartesian_LA_functors.h>
+#include <CGAL/NewKernel_d/Vector/array.h>
+#include <CGAL/NewKernel_d/Vector/vector.h>
+#include <CGAL/NewKernel_d/Vector/mix.h>
+#ifdef CGAL_EIGEN3_ENABLED
+#include <CGAL/NewKernel_d/LA_eigen/LA.h>
+#else
+#error Eigen3 is required
+#endif
+
+namespace CGAL {
+
+template < typename FT_, typename Dim_,
+#if 1
+	 typename Vec_=Mix_vector<Array_vector<FT_, Dim_>,
+				  Vector_vector<FT_, Dim_>,
+				  FT_, Dim_>,
+#elif 0
+	 typename Vec_=Array_vector<FT_, Dim_>,
+#elif 0
+	 typename Vec_=Vector_vector<FT_, Dim_>,
+#else
+	 // Dangerous because of alignment. Ok on x86_64 without AVX.
+	 typename Vec_=LA_eigen<FT_, Dim_>,
+#endif
+	 typename LA_=LA_eigen<FT_,Dim_> >
+  /* Default LA to Vec or to LA_eigen? */
+struct Cartesian_LA_base_d : public Dimension_base<Dim_>
+{
+    typedef Cartesian_LA_base_d<FT_,Dim_>               Self;
+    typedef Cartesian_tag                               Rep_tag;
+    typedef Cartesian_tag                               Kernel_tag;
+    typedef Dim_              Default_ambient_dimension;
+    typedef Dim_              Max_ambient_dimension;
+    typedef Dim_              Dimension;
+    typedef LA_               LA;
+    template <class> struct Ambient_dimension { typedef Dim_ type; };
+
+    typedef Vec_     LA_vector;
+    typedef typename LA_vector::Vector Point;
+    typedef typename LA_vector::Vector Vector;
+    typedef typename LA_vector::Vector Vector_;
+    typedef typename LA_vector::Construct_vector Constructor;
+    typedef typename LA_vector::Vector_const_iterator Point_cartesian_const_iterator;
+    typedef typename LA_vector::Vector_const_iterator Vector_cartesian_const_iterator;
+
+    template<class, class=void> struct Type {};
+    template<class D> struct Type< Point_tag, D> { typedef Vector_ type; };
+    template<class D> struct Type<Vector_tag, D> { typedef Vector_ type; };
+    template<class D> struct Type<    FT_tag, D> { typedef     FT_ type; };
+    template<class D> struct Type<    RT_tag, D> { typedef     FT_ type; };
+
+    typedef typeset<Point_tag>
+      ::add<Vector_tag>::type
+    // FIXME: These have nothing to do here.
+      ::add<Segment_tag>::type
+      ::add<Hyperplane_tag>::type
+      ::add<Sphere_tag>::type
+      Object_list;
+
+    typedef typeset< Point_cartesian_const_iterator_tag>::type
+      ::add<Vector_cartesian_const_iterator_tag>::type
+      Iterator_list;
+
+    template<class, class=void, class=boost::integral_constant<int,0> > struct Functor {
+	    typedef Null_functor type;
+    };
+    template<class D> struct Functor<Construct_ttag<Vector_tag>,D> {
+	    typedef CartesianDVectorBase::Construct_LA_vector<Self,Null_vector> type;
+    };
+    template<class D> struct Functor<Construct_ttag<Point_tag>,D> {
+	    typedef CartesianDVectorBase::Construct_LA_vector<Self,Origin> type;
+    };
+    template<class D> struct Functor<Construct_ttag<Point_cartesian_const_iterator_tag>,D> {
+	    typedef CartesianDVectorBase::Construct_cartesian_const_iterator<Self> type;
+    };
+    template<class D> struct Functor<Construct_ttag<Vector_cartesian_const_iterator_tag>,D> {
+	    typedef CartesianDVectorBase::Construct_cartesian_const_iterator<Self> type;
+    };
+    template<class D> struct Functor<Sum_of_vectors_tag,D,
+      boost::integral_constant<int,!LA_vector::template Property<Has_vector_plus_minus_tag>::value> > {
+	    typedef CartesianDVectorBase::Sum_of_vectors<Self> type;
+    };
+    template<class D> struct Functor<Difference_of_vectors_tag,D,
+      boost::integral_constant<int,!LA_vector::template Property<Has_vector_plus_minus_tag>::value> > {
+	    typedef CartesianDVectorBase::Difference_of_vectors<Self> type;
+    };
+    template<class D> struct Functor<Opposite_vector_tag,D,
+      boost::integral_constant<int,!LA_vector::template Property<Has_vector_plus_minus_tag>::value> > {
+	    typedef CartesianDVectorBase::Opposite_vector<Self> type;
+    };
+    template<class D> struct Functor<Midpoint_tag,D,
+      boost::integral_constant<int,
+	   !LA_vector::template Property<Has_vector_plus_minus_tag>::value
+	|| !LA_vector::template Property<Has_vector_scalar_ops_tag>::value> > {
+	    typedef CartesianDVectorBase::Midpoint<Self> type;
+    };
+    template<class D> struct Functor<Compute_point_cartesian_coordinate_tag,D> {
+	    typedef CartesianDVectorBase::Compute_cartesian_coordinate<Self> type;
+    };
+    template<class D> struct Functor<Compute_vector_cartesian_coordinate_tag,D> {
+	    typedef CartesianDVectorBase::Compute_cartesian_coordinate<Self> type;
+    };
+    template<class D> struct Functor<Point_dimension_tag,D> {
+	    typedef CartesianDVectorBase::PV_dimension<Self> type;
+    };
+    template<class D> struct Functor<Vector_dimension_tag,D> {
+	    typedef CartesianDVectorBase::PV_dimension<Self> type;
+    };
+    template<class D> struct Functor<Orientation_of_vectors_tag,D,
+      boost::integral_constant<int,!LA_vector::template Property<Has_determinant_of_iterator_to_vectors_tag>::value> > {
+	    typedef CartesianDVectorBase::Orientation_of_vectors<Self> type;
+    };
+    template<class D> struct Functor<Orientation_of_points_tag,D,
+      boost::integral_constant<int,!LA_vector::template Property<Has_determinant_of_iterator_to_points_tag>::value> > {
+	    typedef CartesianDVectorBase::Orientation_of_points<Self> type;
+    };
+    template<class D> struct Functor<Scalar_product_tag,D,
+      boost::integral_constant<int,!LA_vector::template Property<Has_dot_product_tag>::value> > {
+	    typedef CartesianDVectorBase::Scalar_product<Self> type;
+    };
+    template<class D> struct Functor<Squared_distance_to_origin_tag,D,
+      boost::integral_constant<int,!LA_vector::template Property<Stores_squared_norm_tag>::value> > {
+	    typedef CartesianDVectorBase::Squared_distance_to_origin_stored<Self> type;
+    };
+    // Use integral_constant<int,2> in case of failure, to distinguish from the previous one.
+    template<class D> struct Functor<Squared_distance_to_origin_tag,D,
+      boost::integral_constant<int,
+	(LA_vector::template Property<Stores_squared_norm_tag>::value
+	 || !LA_vector::template Property<Has_dot_product_tag>::value)*2> > {
+	    typedef CartesianDVectorBase::Squared_distance_to_origin_via_dotprod<Self> type;
+    };
+    template<class D> struct Functor<Point_to_vector_tag,D> {
+	    typedef CartesianDVectorBase::Identity_functor<Self> type;
+    };
+    template<class D> struct Functor<Vector_to_point_tag,D> {
+	    typedef CartesianDVectorBase::Identity_functor<Self> type;
+    };
+
+    CGAL_CONSTEXPR Cartesian_LA_base_d(){}
+    CGAL_CONSTEXPR Cartesian_LA_base_d(int d):Dimension_base<Dim_>(d){}
+};
+
+} //namespace CGAL
+
+#endif // CGAL_KERNEL_D_CARTESIAN_LA_BASE_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Cartesian_LA_functors.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Cartesian_LA_functors.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Cartesian_LA_functors.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Cartesian_LA_functors.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Cartesian_base.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Cartesian_base.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Cartesian_base.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Cartesian_base.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Cartesian_change_FT.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Cartesian_change_FT.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Cartesian_change_FT.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Cartesian_change_FT.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Cartesian_complete.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Cartesian_complete.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Cartesian_complete.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Cartesian_complete.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Cartesian_filter_K.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Cartesian_filter_K.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Cartesian_filter_K.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Cartesian_filter_K.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Cartesian_filter_NT.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Cartesian_filter_NT.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Cartesian_filter_NT.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Cartesian_filter_NT.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Cartesian_per_dimension.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Cartesian_per_dimension.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Cartesian_per_dimension.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Cartesian_per_dimension.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Cartesian_static_filters.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Cartesian_static_filters.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Cartesian_static_filters.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Cartesian_static_filters.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Coaffine.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Coaffine.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Coaffine.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Coaffine.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Define_kernel_types.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Define_kernel_types.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Define_kernel_types.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Define_kernel_types.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Dimension_base.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Dimension_base.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Dimension_base.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Dimension_base.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Filtered_predicate2.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Filtered_predicate2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Filtered_predicate2.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Filtered_predicate2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/KernelD_converter.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/KernelD_converter.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/KernelD_converter.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/KernelD_converter.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Kernel_2_interface.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Kernel_2_interface.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Kernel_2_interface.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Kernel_2_interface.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Kernel_3_interface.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Kernel_3_interface.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Kernel_3_interface.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Kernel_3_interface.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Kernel_d_interface.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Kernel_d_interface.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Kernel_d_interface.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Kernel_d_interface.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Kernel_object_converter.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Kernel_object_converter.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Kernel_object_converter.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Kernel_object_converter.h
diff --git a/3rdparty/CGAL/include/CGAL/NewKernel_d/LA_eigen/LA.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/LA_eigen/LA.h
new file mode 100644
index 0000000..ddbdc37
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/NewKernel_d/LA_eigen/LA.h
@@ -0,0 +1,175 @@
+// Copyright (c) 2014
+// INRIA Saclay-Ile de France (France)
+//
+// 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(s)     : Marc Glisse
+
+#ifndef CGAL_LA_EIGEN_H
+#define CGAL_LA_EIGEN_H
+#include <CGAL/config.h>
+#ifndef CGAL_EIGEN3_ENABLED
+#error Requires Eigen
+#endif
+#include <boost/type_traits/is_arithmetic.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <CGAL/Dimension.h>
+#include <Eigen/Dense>
+#include <CGAL/NewKernel_d/LA_eigen/constructors.h>
+#include <CGAL/iterator_from_indices.h>
+
+namespace CGAL {
+
+//FIXME: where could we use Matrix_base instead of Matrix?
+// Dim_ real dimension
+// Max_dim_ upper bound on the dimension
+template<class NT_,class Dim_,class Max_dim_=Dim_> struct LA_eigen {
+	typedef NT_ NT;
+	typedef Dim_ Dimension;
+	typedef Max_dim_ Max_dimension;
+	enum { dimension = Eigen_dimension<Dimension>::value };
+	enum { max_dimension = Eigen_dimension<Max_dimension>::value };
+	template< class D2, class D3=D2 >
+	struct Rebind_dimension {
+	  typedef LA_eigen< NT, D2, D3 > Other;
+	};
+	template<class,class=void> struct Property : boost::false_type {};
+	template<class D> struct Property<Has_vector_plus_minus_tag,D> : boost::true_type {};
+	template<class D> struct Property<Has_vector_scalar_ops_tag,D> : boost::true_type {};
+	template<class D> struct Property<Has_dot_product_tag,D> : boost::true_type {};
+
+	typedef Eigen::Matrix<NT,Eigen_dimension<Dim_>::value,1,Eigen::ColMajor|Eigen::AutoAlign,Eigen_dimension<Max_dim_>::value,1> Vector;
+	typedef Eigen::Matrix<NT,Eigen::Dynamic,1> Dynamic_vector;
+	typedef Construct_eigen<Vector> Construct_vector;
+
+#if (EIGEN_WORLD_VERSION>=3)
+	typedef NT const* Vector_const_iterator;
+#else
+	typedef Iterator_from_indices<const type,const NT
+#ifndef CGAL_CXX11
+	  ,NT
+#endif
+	  > Vector_const_iterator;
+#endif
+
+	template<class Vec_>static Vector_const_iterator vector_begin(Vec_ const&a){
+#if (EIGEN_WORLD_VERSION>=3)
+	  return &a[0];
+#else
+	  return Vector_const_iterator(a,0);
+#endif
+	}
+
+	template<class Vec_>static Vector_const_iterator vector_end(Vec_ const&a){
+#if (EIGEN_WORLD_VERSION>=3)
+	  // FIXME: Isn't that dangerous if a is an expression and not a concrete vector?
+	  return &a[0]+a.size();
+#else
+	  return Vector_const_iterator(a,a.size());
+#endif
+	}
+
+	typedef Eigen::Matrix<NT,dimension,dimension,Eigen::ColMajor|Eigen::AutoAlign,max_dimension,max_dimension> Square_matrix;
+	typedef Eigen::Matrix<NT,dimension,Eigen::Dynamic,Eigen::ColMajor|Eigen::AutoAlign,max_dimension,Eigen::Dynamic> Dynamic_matrix;
+		//TODO: don't pass on the values of Max_* for an expensive NT
+                // typedef ... Constructor
+                // typedef ... Accessor
+#if 0
+	private:
+	template <class T> class Canonicalize_vector {
+		typedef typename Dimension_eigen<T::SizeAtCompileTime>::type S1;
+		typedef typename Dimension_eigen<T::MaxSizeAtCompileTime>::type S2;
+		public:
+		typedef typename Vector<S1,S2>::type type;
+	};
+	public:
+#endif
+
+	template<class Vec_>static int size_of_vector(Vec_ const&v){
+		return (int)v.size();
+	}
+
+	template<class Vec_>static NT dot_product(Vec_ const&a,Vec_ const&b){
+		return a.dot(b);
+	}
+
+	template<class Vec_> static int rows(Vec_ const&v) {
+		return (int)v.rows();
+	}
+	template<class Vec_> static int columns(Vec_ const&v) {
+		return (int)v.cols();
+	}
+
+	template<class Mat_> static NT determinant(Mat_ const&m,bool=false){
+		return m.determinant();
+	}
+
+	template<class Mat_> static typename
+	Same_uncertainty_nt<CGAL::Sign, NT>::type
+	sign_of_determinant(Mat_ const&m,bool=false)
+	{
+		return CGAL::sign(m.determinant());
+	}
+
+	template<class Mat_> static int rank(Mat_ const&m){
+		// return m.rank();
+		// This one uses sqrt so cannot be used with Gmpq
+		// TODO: use different algo for different NT?
+		// Eigen::ColPivHouseholderQR<Mat_> decomp(m);
+		Eigen::FullPivLU<Mat_> decomp(m);
+		// decomp.setThreshold(0);
+		return static_cast<int>(decomp.rank());
+	}
+
+	// m*a==b
+	template<class DV, class DM, class V>
+	static void solve(DV&a, DM const&m, V const& b){
+		//a = m.colPivHouseholderQr().solve(b);
+		a = m.fullPivLu().solve(b);
+	}
+	template<class DV, class DM, class V>
+	static bool solve_and_check(DV&a, DM const&m, V const& b){
+		//a = m.colPivHouseholderQr().solve(b);
+		a = m.fullPivLu().solve(b);
+		return b.isApprox(m*a);
+	}
+
+	static Dynamic_matrix basis(Dynamic_matrix const&m){
+		return m.fullPivLu().image(m);
+	}
+
+	template<class Vec1,class Vec2> static Vector homogeneous_add(Vec1 const&a,Vec2 const&b){
+		//TODO: use compile-time size when available
+		int d=a.size();
+		Vector v(d);
+		v << b[d-1]*a.topRows(d-1)+a[d-1]*b.topRows(d-1), a[d-1]*b[d-1];
+		return v;
+	}
+
+	template<class Vec1,class Vec2> static Vector homogeneous_sub(Vec1 const&a,Vec2 const&b){
+		int d=a.size();
+		Vector v(d);
+		v << b[d-1]*a.topRows(d-1)-a[d-1]*b.topRows(d-1), a[d-1]*b[d-1];
+		return v;
+	}
+
+	template<class Vec1,class Vec2> static std::pair<NT,NT> homogeneous_dot_product(Vec1 const&a,Vec2 const&b){
+		int d=a.size();
+		return make_pair(a.topRows(d-1).dot(b.topRows(d-1)), a[d-1]*b[d-1]);
+	}
+
+};
+}
+#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/LA_eigen/constructors.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/LA_eigen/constructors.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/LA_eigen/constructors.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/LA_eigen/constructors.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Lazy_cartesian.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Lazy_cartesian.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Lazy_cartesian.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Lazy_cartesian.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Types/Aff_transformation.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Types/Aff_transformation.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Types/Aff_transformation.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Types/Aff_transformation.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Types/Hyperplane.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Types/Hyperplane.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Types/Hyperplane.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Types/Hyperplane.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Types/Iso_box.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Types/Iso_box.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Types/Iso_box.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Types/Iso_box.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Types/Line.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Types/Line.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Types/Line.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Types/Line.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Types/Ray.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Types/Ray.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Types/Ray.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Types/Ray.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Types/Segment.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Types/Segment.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Types/Segment.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Types/Segment.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Types/Sphere.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Types/Sphere.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Types/Sphere.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Types/Sphere.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Vector/array.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Vector/array.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Vector/array.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Vector/array.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Vector/avx4.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Vector/avx4.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Vector/avx4.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Vector/avx4.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Vector/determinant_of_iterator_to_points_from_iterator_to_vectors.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Vector/determinant_of_iterator_to_points_from_iterator_to_vectors.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Vector/determinant_of_iterator_to_points_from_iterator_to_vectors.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Vector/determinant_of_iterator_to_points_from_iterator_to_vectors.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Vector/determinant_of_iterator_to_points_from_points.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Vector/determinant_of_iterator_to_points_from_points.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Vector/determinant_of_iterator_to_points_from_points.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Vector/determinant_of_iterator_to_points_from_points.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Vector/determinant_of_iterator_to_vectors_from_vectors.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Vector/determinant_of_iterator_to_vectors_from_vectors.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Vector/determinant_of_iterator_to_vectors_from_vectors.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Vector/determinant_of_iterator_to_vectors_from_vectors.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Vector/determinant_of_points_from_vectors.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Vector/determinant_of_points_from_vectors.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Vector/determinant_of_points_from_vectors.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Vector/determinant_of_points_from_vectors.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Vector/determinant_of_vectors_small_dim.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Vector/determinant_of_vectors_small_dim.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Vector/determinant_of_vectors_small_dim.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Vector/determinant_of_vectors_small_dim.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Vector/determinant_of_vectors_small_dim_internal.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Vector/determinant_of_vectors_small_dim_internal.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Vector/determinant_of_vectors_small_dim_internal.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Vector/determinant_of_vectors_small_dim_internal.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Vector/mix.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Vector/mix.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Vector/mix.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Vector/mix.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Vector/sse2.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Vector/sse2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Vector/sse2.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Vector/sse2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Vector/v2int.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Vector/v2int.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Vector/v2int.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Vector/v2int.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Vector/vector.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Vector/vector.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Vector/vector.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Vector/vector.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Wrapper/Cartesian_wrap.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Wrapper/Cartesian_wrap.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Wrapper/Cartesian_wrap.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Wrapper/Cartesian_wrap.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Wrapper/Hyperplane_d.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Wrapper/Hyperplane_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Wrapper/Hyperplane_d.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Wrapper/Hyperplane_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Wrapper/Point_d.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Wrapper/Point_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Wrapper/Point_d.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Wrapper/Point_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Wrapper/Ref_count_obj.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Wrapper/Ref_count_obj.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Wrapper/Ref_count_obj.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Wrapper/Ref_count_obj.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Wrapper/Segment_d.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Wrapper/Segment_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Wrapper/Segment_d.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Wrapper/Segment_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Wrapper/Sphere_d.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Wrapper/Sphere_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Wrapper/Sphere_d.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Wrapper/Sphere_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Wrapper/Vector_d.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/Wrapper/Vector_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/Wrapper/Vector_d.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/Wrapper/Vector_d.h
diff --git a/3rdparty/CGAL/include/CGAL/NewKernel_d/function_objects_cartesian.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/function_objects_cartesian.h
new file mode 100644
index 0000000..aa073d8
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/NewKernel_d/function_objects_cartesian.h
@@ -0,0 +1,1301 @@
+// Copyright (c) 2014
+// INRIA Saclay-Ile de France (France)
+//
+// 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(s)     : Marc Glisse
+
+#ifndef CGAL_KERNEL_D_FUNCTION_OBJECTS_CARTESIAN_H
+#define CGAL_KERNEL_D_FUNCTION_OBJECTS_CARTESIAN_H
+
+#include <CGAL/NewKernel_d/utils.h>
+#include <CGAL/Dimension.h>
+#include <CGAL/Uncertain.h>
+#include <CGAL/NewKernel_d/store_kernel.h>
+#include <CGAL/is_iterator.h>
+#include <CGAL/iterator_from_indices.h>
+#include <CGAL/number_utils.h>
+#include <CGAL/Kernel/Return_base_tag.h>
+#include <CGAL/transforming_iterator.h>
+#include <CGAL/transforming_pair_iterator.h>
+#include <CGAL/NewKernel_d/functor_tags.h>
+#include <CGAL/NewKernel_d/functor_properties.h>
+#include <CGAL/predicates/sign_of_determinant.h>
+#include <functional>
+#ifdef CGAL_CXX11
+#include <initializer_list>
+#endif
+
+namespace CGAL {
+namespace CartesianDKernelFunctors {
+namespace internal {
+template<class,int> struct Dimension_at_most { enum { value = false }; };
+template<int a,int b> struct Dimension_at_most<Dimension_tag<a>,b> {
+	enum { value = (a <= b) };
+};
+}
+
+template<class R_,class D_=typename R_::Default_ambient_dimension,bool=internal::Dimension_at_most<D_,6>::value> struct Orientation_of_points : private Store_kernel<R_> {
+	CGAL_FUNCTOR_INIT_STORE(Orientation_of_points)
+	typedef R_ R;
+	typedef typename Get_type<R, Point_tag>::type Point;
+	typedef typename Get_type<R, Orientation_tag>::type result_type;
+	typedef typename R::LA::Square_matrix Matrix;
+
+	template<class Iter>
+	result_type operator()(Iter f, Iter e)const{
+		typename Get_functor<R, Compute_point_cartesian_coordinate_tag>::type c(this->kernel());
+		typename Get_functor<R, Point_dimension_tag>::type pd(this->kernel());
+		Point const& p0=*f++;
+		int d=pd(p0);
+		Matrix m(d,d);
+		// FIXME: this writes the vector coordinates in lines ? check all the other uses in this file, this may be wrong for some.
+		for(int i=0;f!=e;++f,++i) {
+		  Point const& p=*f;
+		  for(int j=0;j<d;++j){
+		    m(i,j)=c(p,j)-c(p0,j);
+		    // should we cache the coordinates of p0 in case they are computed?
+		  }
+		}
+		return R::LA::sign_of_determinant(CGAL_MOVE(m));
+	}
+
+#ifdef CGAL_CXX11
+	// Since the dimension is at least 2, there are at least 3 points and no ambiguity with iterators.
+	// template <class...U,class=typename std::enable_if<std::is_same<Dimension_tag<sizeof...(U)-1>,typename R::Default_ambient_dimension>::value>::type>
+	template <class...U,class=typename std::enable_if<(sizeof...(U)>=3)>::type>
+	result_type operator()(U&&...u) const {
+		return operator()({std::forward<U>(u)...});
+	}
+
+	template <class P>
+	result_type operator()(std::initializer_list<P> l) const {
+		return operator()(l.begin(),l.end());
+	}
+#else
+	//should we make it template to avoid instantiation for wrong dim?
+	//or iterate outside the class?
+#define CGAL_VAR(Z,J,I) m(I,J)=c(p##I,J)-c(x,J);
+#define CGAL_VAR2(Z,I,N) BOOST_PP_REPEAT(N,CGAL_VAR,I)
+#define CGAL_CODE(Z,N,_) \
+	result_type operator()(Point const&x, BOOST_PP_ENUM_PARAMS(N,Point const&p)) const { \
+		typename Get_functor<R, Compute_point_cartesian_coordinate_tag>::type c(this->kernel()); \
+		Matrix m(N,N); \
+		BOOST_PP_REPEAT(N,CGAL_VAR2,N) \
+		return R::LA::sign_of_determinant(CGAL_MOVE(m)); \
+	}
+
+BOOST_PP_REPEAT_FROM_TO(7, 10, CGAL_CODE, _ )
+	// No need to do it for <=6, since that uses a different code path
+#undef CGAL_CODE
+#undef CGAL_VAR2
+#undef CGAL_VAR
+#endif
+};
+
+#ifdef CGAL_CXX11
+template<class R_,int d> struct Orientation_of_points<R_,Dimension_tag<d>,true> : private Store_kernel<R_> {
+	CGAL_FUNCTOR_INIT_STORE(Orientation_of_points)
+	typedef R_ R;
+	typedef typename Get_type<R, RT_tag>::type RT;
+	typedef typename Get_type<R, Point_tag>::type Point;
+	typedef typename Get_type<R, Orientation_tag>::type result_type;
+	template<class>struct Help;
+	template<int...I>struct Help<Indices<I...> > {
+		template<class C,class P,class T> result_type operator()(C const&c,P const&x,T&&t)const{
+			return sign_of_determinant<RT>(c(std::get<I/d>(t),I%d)-c(x,I%d)...);
+		}
+	};
+	template<class P0,class...P> result_type operator()(P0 const&x,P&&...p)const{
+		static_assert(d==sizeof...(P),"Wrong number of arguments");
+		typename Get_functor<R, Compute_point_cartesian_coordinate_tag>::type c(this->kernel());
+		return Help<typename N_increasing_indices<d*d>::type>()(c,x,std::forward_as_tuple(std::forward<P>(p)...));
+	}
+
+
+	template<int N,class Iter,class...U> result_type help2(Dimension_tag<N>, Iter f, Iter const&e, U&&...u)const{
+		auto const&p=*f;
+		return help2(Dimension_tag<N-1>(),++f,e,std::forward<U>(u)...,p);
+	}
+	template<class Iter,class...U> result_type help2(Dimension_tag<0>, Iter CGAL_assertion_code(f), Iter const& CGAL_assertion_code(e), U&&...u)const{
+		CGAL_assertion(f==e);
+		return operator()(std::forward<U>(u)...);
+	}
+	template<class Iter>
+	result_type operator()(Iter f, Iter e)const{
+		return help2(Dimension_tag<d+1>(),f,e);
+	}
+};
+#else
+#define CGAL_VAR(Z,J,I) c(p##I,J)-x##J
+#define CGAL_VAR2(Z,I,N) BOOST_PP_ENUM(N,CGAL_VAR,I)
+#define CGAL_VAR3(Z,N,_) Point const&p##N=*++f;
+#define CGAL_VAR4(Z,N,_) RT const&x##N=c(x,N);
+#define CGAL_CODE(Z,N,_) \
+template<class R_> struct Orientation_of_points<R_,Dimension_tag<N>,true> : private Store_kernel<R_> { \
+	CGAL_FUNCTOR_INIT_STORE(Orientation_of_points) \
+	typedef R_ R; \
+	typedef typename Get_type<R, RT_tag>::type RT; \
+	typedef typename Get_type<R, Point_tag>::type Point; \
+	typedef typename Get_type<R, Orientation_tag>::type result_type; \
+	result_type operator()(Point const&x, BOOST_PP_ENUM_PARAMS(N,Point const&p)) const { \
+		typename Get_functor<R, Compute_point_cartesian_coordinate_tag>::type c(this->kernel()); \
+		BOOST_PP_REPEAT(N,CGAL_VAR4,) \
+		return sign_of_determinant<RT>(BOOST_PP_ENUM(N,CGAL_VAR2,N)); \
+	} \
+	template<class Iter> \
+	result_type operator()(Iter f, Iter CGAL_assertion_code(e))const{ \
+		Point const&x=*f; \
+		BOOST_PP_REPEAT(N,CGAL_VAR3,) \
+		CGAL_assertion(++f==e); \
+		return operator()(x,BOOST_PP_ENUM_PARAMS(N,p)); \
+	} \
+};
+
+	BOOST_PP_REPEAT_FROM_TO(2, 7, CGAL_CODE, _ )
+#undef CGAL_CODE
+#undef CGAL_VAR4
+#undef CGAL_VAR3
+#undef CGAL_VAR2
+#undef CGAL_VAR
+
+#endif
+
+template<class R_> struct Orientation_of_points<R_,Dimension_tag<1>,true> : private Store_kernel<R_> {
+	CGAL_FUNCTOR_INIT_STORE(Orientation_of_points)
+	typedef R_ R;
+	typedef typename Get_type<R, RT_tag>::type RT;
+	typedef typename Get_type<R, Point_tag>::type Point;
+	typedef typename Get_type<R, Orientation_tag>::type result_type;
+	result_type operator()(Point const&x, Point const&y) const {
+		typename Get_functor<R, Compute_point_cartesian_coordinate_tag>::type c(this->kernel());
+		// No sign_of_determinant(RT) :-(
+		return CGAL::compare(c(y,0),c(x,0));
+	}
+	template<class Iter>
+	result_type operator()(Iter f, Iter CGAL_assertion_code(e))const{
+		Point const&x=*f;
+		Point const&y=*++f;
+		CGAL_assertion(++f==e);
+		return operator()(x,y);
+	}
+};
+}
+
+CGAL_KD_DEFAULT_FUNCTOR(Orientation_of_points_tag,(CartesianDKernelFunctors::Orientation_of_points<K>),(Point_tag),(Point_dimension_tag,Compute_point_cartesian_coordinate_tag));
+
+namespace CartesianDKernelFunctors {
+template<class R_> struct Orientation_of_vectors : private Store_kernel<R_> {
+	CGAL_FUNCTOR_INIT_STORE(Orientation_of_vectors)
+	typedef R_ R;
+	typedef typename Get_type<R, Vector_tag>::type Vector;
+	typedef typename Get_type<R, Orientation_tag>::type result_type;
+	typedef typename R::LA::Square_matrix Matrix;
+
+	template<class Iter>
+	result_type operator()(Iter f, Iter e)const{
+		typename Get_functor<R, Compute_vector_cartesian_coordinate_tag>::type c(this->kernel());
+		typename Get_functor<R, Point_dimension_tag>::type vd(this->kernel());
+		// FIXME: Uh? Using it on a vector ?!
+		Vector const& v0=*f;
+		int d=vd(v0);
+		Matrix m(d,d);
+		for(int j=0;j<d;++j){
+			m(0,j)=c(v0,j);
+		}
+		for(int i=1;++f!=e;++i) {
+			Vector const& v=*f;
+		for(int j=0;j<d;++j){
+			m(i,j)=c(v,j);
+		}
+		}
+		return R::LA::sign_of_determinant(CGAL_MOVE(m));
+	}
+
+#ifdef CGAL_CXX11
+	template <class...U,class=typename std::enable_if<(sizeof...(U)>=3)>::type>
+	result_type operator()(U&&...u) const {
+		return operator()({std::forward<U>(u)...});
+	}
+
+	template <class V>
+	result_type operator()(std::initializer_list<V> l) const {
+		return operator()(l.begin(),l.end());
+	}
+#else
+	//TODO
+#endif
+};
+}
+
+CGAL_KD_DEFAULT_FUNCTOR(Orientation_of_vectors_tag,(CartesianDKernelFunctors::Orientation_of_vectors<K>),(Vector_tag),(Point_dimension_tag,Compute_vector_cartesian_coordinate_tag));
+
+namespace CartesianDKernelFunctors {
+template<class R_> struct Linear_rank : private Store_kernel<R_> {
+	CGAL_FUNCTOR_INIT_STORE(Linear_rank)
+	typedef R_ R;
+	typedef typename Get_type<R, Vector_tag>::type Vector;
+	// Computing a sensible Uncertain<int> is not worth it
+	typedef int result_type;
+	typedef typename R::LA::Dynamic_matrix Matrix;
+
+	template<class Iter>
+	result_type operator()(Iter f, Iter e)const{
+		typename Get_functor<R, Compute_vector_cartesian_coordinate_tag>::type c(this->kernel());
+		typename Get_functor<R, Point_dimension_tag>::type vd(this->kernel());
+		std::ptrdiff_t n=std::distance(f,e);
+		if (n==0) return 0;
+		Vector const& v0 = *f;
+		// FIXME: Uh? Using it on a vector ?!
+		int d=vd(v0);
+		Matrix m(d,n);
+		for(int j=0;j<d;++j){
+		  m(j,0)=c(v0,j);
+		}
+		for(int i=1; ++f!=e; ++i){
+		  Vector const& v = *f;
+		  for(int j=0;j<d;++j){
+		    m(j,i)=c(v,j);
+		  }
+		}
+		return R::LA::rank(CGAL_MOVE(m));
+	}
+};
+}
+
+CGAL_KD_DEFAULT_FUNCTOR(Linear_rank_tag,(CartesianDKernelFunctors::Linear_rank<K>),(Vector_tag),(Point_dimension_tag,Compute_vector_cartesian_coordinate_tag));
+
+namespace CartesianDKernelFunctors {
+template<class R_> struct Linearly_independent : private Store_kernel<R_> {
+	CGAL_FUNCTOR_INIT_STORE(Linearly_independent)
+	typedef R_ R;
+	typedef typename Get_type<R, Bool_tag>::type result_type;
+
+	template<class Iter>
+	result_type operator()(Iter f, Iter e)const{
+		typename Get_functor<R, Point_dimension_tag>::type vd(this->kernel());
+		std::ptrdiff_t n=std::distance(f,e);
+		// FIXME: Uh? Using it on a vector ?!
+		int d=vd(*f);
+		if (n>d) return false;
+		typename Get_functor<R, Linear_rank_tag>::type lr(this->kernel());
+		return lr(f,e) == n;
+	}
+};
+}
+
+CGAL_KD_DEFAULT_FUNCTOR(Linearly_independent_tag,(CartesianDKernelFunctors::Linearly_independent<K>),(Vector_tag),(Point_dimension_tag,Linear_rank_tag));
+
+namespace CartesianDKernelFunctors {
+template<class R_> struct Contained_in_linear_hull : private Store_kernel<R_> {
+	CGAL_FUNCTOR_INIT_STORE(Contained_in_linear_hull)
+	typedef R_ R;
+	typedef typename Get_type<R, Vector_tag>::type Vector;
+	// Computing a sensible Uncertain<bool> is not worth it
+	typedef bool result_type;
+	typedef typename R::LA::Dynamic_matrix Matrix;
+
+	template<class Iter,class V>
+	result_type operator()(Iter f, Iter e,V const&w)const{
+		typename Get_functor<R, Compute_vector_cartesian_coordinate_tag>::type c(this->kernel());
+		typename Get_functor<R, Point_dimension_tag>::type vd(this->kernel());
+		std::ptrdiff_t n=std::distance(f,e);
+		if (n==0) return false;
+		// FIXME: Uh? Using it on a vector ?!
+		int d=vd(w);
+		Matrix m(d,n+1);
+		for(int i=0; f!=e; ++f,++i){
+		  Vector const& v = *f;
+		  for(int j=0;j<d;++j){
+		    m(j,i)=c(v,j);
+		  }
+		}
+		for(int j=0;j<d;++j){
+		  m(j,n)=c(w,j);
+		}
+		int r1 = R::LA::rank(m);
+		// FIXME: Don't use eigen directly, go through an interface in LA...
+		m.conservativeResize(Eigen::NoChange, n);
+		int r2 = R::LA::rank(CGAL_MOVE(m));
+		return r1 == r2;
+		// TODO: This is very very far from optimal...
+	}
+};
+}
+
+CGAL_KD_DEFAULT_FUNCTOR(Contained_in_linear_hull_tag,(CartesianDKernelFunctors::Contained_in_linear_hull<K>),(Vector_tag),(Point_dimension_tag,Compute_vector_cartesian_coordinate_tag));
+
+namespace CartesianDKernelFunctors {
+template<class R_> struct Affine_rank : private Store_kernel<R_> {
+	CGAL_FUNCTOR_INIT_STORE(Affine_rank)
+	typedef R_ R;
+	typedef typename Get_type<R, Point_tag>::type Point;
+	// Computing a sensible Uncertain<int> is not worth it
+	typedef int result_type;
+	typedef typename R::LA::Dynamic_matrix Matrix;
+
+	template<class Iter>
+	result_type operator()(Iter f, Iter e)const{
+		typename Get_functor<R, Compute_point_cartesian_coordinate_tag>::type c(this->kernel());
+		typename Get_functor<R, Point_dimension_tag>::type pd(this->kernel());
+		int n=(int)std::distance(f,e);
+		if (--n<=0) return n;
+		Point const& p0 = *f;
+		int d=pd(p0);
+		Matrix m(d,n);
+		for(int i=0; ++f!=e; ++i){
+		  Point const& p = *f;
+		  for(int j=0;j<d;++j){
+		    m(j,i)=c(p,j)-c(p0,j);
+		    // TODO: cache p0[j] in case it is computed?
+		  }
+		}
+		return R::LA::rank(CGAL_MOVE(m));
+	}
+};
+}
+
+CGAL_KD_DEFAULT_FUNCTOR(Affine_rank_tag,(CartesianDKernelFunctors::Affine_rank<K>),(Point_tag),(Point_dimension_tag,Compute_point_cartesian_coordinate_tag));
+
+namespace CartesianDKernelFunctors {
+template<class R_> struct Affinely_independent : private Store_kernel<R_> {
+	CGAL_FUNCTOR_INIT_STORE(Affinely_independent)
+	typedef R_ R;
+	typedef typename Get_type<R, Bool_tag>::type result_type;
+
+	template<class Iter>
+	result_type operator()(Iter f, Iter e)const{
+		typename Get_functor<R, Point_dimension_tag>::type pd(this->kernel());
+		std::ptrdiff_t n=std::distance(f,e);
+		int d=pd(*f);
+		if (--n>d) return false;
+		typename Get_functor<R, Affine_rank_tag>::type ar(this->kernel());
+		return ar(f,e) == n;
+	}
+};
+}
+
+CGAL_KD_DEFAULT_FUNCTOR(Affinely_independent_tag,(CartesianDKernelFunctors::Affinely_independent<K>),(Point_tag),(Point_dimension_tag,Affine_rank_tag));
+
+namespace CartesianDKernelFunctors {
+template<class R_> struct Contained_in_simplex : private Store_kernel<R_> {
+	CGAL_FUNCTOR_INIT_STORE(Contained_in_simplex)
+	typedef R_ R;
+	typedef typename Get_type<R, Point_tag>::type Point;
+	// Computing a sensible Uncertain<*> is not worth it
+	// typedef typename Get_type<R, Boolean_tag>::type result_type;
+	typedef bool result_type;
+	typedef typename Increment_dimension<typename R::Default_ambient_dimension>::type D1;
+	typedef typename Increment_dimension<typename R::Max_ambient_dimension>::type D2;
+	typedef typename R::LA::template Rebind_dimension<D1,D2>::Other LA;
+	typedef typename LA::Dynamic_matrix Matrix;
+	typedef typename LA::Dynamic_vector DynVec;
+	typedef typename LA::Vector Vec;
+
+	template<class Iter, class P>
+	result_type operator()(Iter f, Iter e, P const&q)const{
+		typename Get_functor<R, Compute_point_cartesian_coordinate_tag>::type c(this->kernel());
+		typename Get_functor<R, Point_dimension_tag>::type pd(this->kernel());
+		std::ptrdiff_t n=std::distance(f,e);
+		if (n==0) return false;
+		int d=pd(q);
+		Matrix m(d+1,n);
+		DynVec a(n);
+		// FIXME: Should use the proper vector constructor (Iterator_and_last)
+		Vec b(d+1);
+		for(int j=0;j<d;++j) b[j]=c(q,j);
+		b[d]=1;
+
+		for(int i=0; f!=e; ++i,++f){
+		  Point const& p = *f;
+		  for(int j=0;j<d;++j){
+		    m(j,i)=c(p,j);
+		  }
+		  m(d,i)=1;
+		}
+		// If the simplex has full dimension, there must be a solution, only the signs need to be checked.
+		if (n == d+1)
+		  LA::solve(a,CGAL_MOVE(m),CGAL_MOVE(b));
+		else if (!LA::solve_and_check(a,CGAL_MOVE(m),CGAL_MOVE(b)))
+		  return false;
+		for(int i=0;i<n;++i){
+		  if (a[i]<0) return false;
+		}
+		return true;
+	}
+};
+}
+
+CGAL_KD_DEFAULT_FUNCTOR(Contained_in_simplex_tag,(CartesianDKernelFunctors::Contained_in_simplex<K>),(Point_tag),(Point_dimension_tag,Compute_point_cartesian_coordinate_tag));
+
+namespace CartesianDKernelFunctors {
+  namespace internal {
+    template<class Ref_>
+    struct Matrix_col_access {
+      typedef Ref_ result_type;
+      int col;
+      Matrix_col_access(int r):col(r){}
+      template<class Mat> Ref_ operator()(Mat const& m, std::ptrdiff_t row)const{
+	return m(row,col);
+      }
+    };
+  }
+template<class R_> struct Linear_base : private Store_kernel<R_> {
+	CGAL_FUNCTOR_INIT_STORE(Linear_base)
+	typedef R_ R;
+	typedef typename Get_type<R, Vector_tag>::type Vector;
+	typedef typename Get_type<R, FT_tag>::type FT;
+	typedef void result_type;
+	typedef typename R::LA::Dynamic_matrix Matrix;
+
+	template<class Iter, class Oter>
+	result_type operator()(Iter f, Iter e, Oter&o)const{
+		typename Get_functor<R, Compute_vector_cartesian_coordinate_tag>::type c(this->kernel());
+		typename Get_functor<R, Point_dimension_tag>::type vd(this->kernel());
+		typename Get_functor<R, Construct_ttag<Vector_tag> >::type cv(this->kernel());
+		std::ptrdiff_t n=std::distance(f,e);
+		if (n==0) return;
+		Vector const& v0 = *f;
+		// FIXME: Uh? Using it on a vector ?!
+		int d=vd(v0);
+		Matrix m(d,n);
+		for(int j=0;j<d;++j){
+		  m(0,j)=c(v0,j);
+		}
+		for(int i=1; ++f!=e; ++i){
+		  Vector const& v = *f;
+		  for(int j=0;j<d;++j){
+		    m(i,j)=c(v,j);
+		  }
+		}
+		Matrix b = R::LA::basis(CGAL_MOVE(m));
+		for(int i=0; i < R::LA::columns(b); ++i){
+		  //*o++ = Vector(b.col(i));
+		  typedef
+#ifdef CGAL_CXX11
+		    decltype(std::declval<const Matrix>()(0,0))
+#else
+		    FT
+#endif
+		    Ref;
+		  typedef Iterator_from_indices<Matrix, FT, Ref,
+			  internal::Matrix_col_access<Ref> > IFI;
+		  *o++ = cv(IFI(b,0,i),IFI(b,d,i));
+		}
+	}
+};
+}
+
+CGAL_KD_DEFAULT_FUNCTOR(Linear_base_tag,(CartesianDKernelFunctors::Linear_base<K>),(Vector_tag),(Point_dimension_tag,Compute_vector_cartesian_coordinate_tag));
+
+#if 0
+namespace CartesianDKernelFunctors {
+template<class R_,bool=boost::is_same<typename R_::Point,typename R_::Vector>::value> struct Orientation : private Store_kernel<R_> {
+	CGAL_FUNCTOR_INIT_STORE(Orientation)
+	typedef R_ R;
+	typedef typename Get_type<R, Vector_tag>::type Vector;
+	typedef typename Get_type<R, Point_tag>::type Point;
+	typedef typename Get_type<R, Orientation_tag>::type result_type;
+	typedef typename Get_functor<R, Orientation_of_points_tag>::type OP;
+	typedef typename Get_functor<R, Orientation_of_vectors_tag>::type OV;
+
+	//FIXME!!!
+	//when Point and Vector are distinct types, the dispatch should be made
+	//in a way that doesn't instantiate a conversion from Point to Vector
+	template<class Iter>
+	result_type operator()(Iter const&f, Iter const& e)const{
+		typename Get_functor<R, Point_dimension_tag>::type pd(this->kernel());
+		typename std::iterator_traits<Iter>::difference_type d=std::distance(f,e);
+		int dim=pd(*f); // BAD
+		if(d==dim) return OV(this->kernel())(f,e);
+		CGAL_assertion(d==dim+1);
+		return OP(this->kernel())(f,e);
+	}
+	//TODO: version that takes objects directly instead of iterators
+};
+
+template<class R_> struct Orientation<R_,false> : private Store_kernel<R_> {
+	CGAL_FUNCTOR_INIT_STORE(Orientation)
+	typedef R_ R;
+	typedef typename Get_type<R, Vector_tag>::type Vector;
+	typedef typename Get_type<R, Point_tag>::type Point;
+	typedef typename Get_type<R, Orientation_tag>::type result_type;
+	typedef typename Get_functor<R, Orientation_of_points_tag>::type OP;
+	typedef typename Get_functor<R, Orientation_of_vectors_tag>::type OV;
+	typedef typename R::LA::Square_matrix Matrix;
+
+	//FIXME!!!
+	//when Point and Vector are distinct types, the dispatch should be made
+	//in a way that doesn't instantiate a conversion from Point to Vector
+	template<class Iter>
+	typename boost::enable_if<is_iterator_to<Iter,Point>,result_type>::type
+	operator()(Iter const&f, Iter const& e)const{
+		return OP(this->kernel())(f,e);
+	}
+	template<class Iter>
+	typename boost::enable_if<is_iterator_to<Iter,Vector>,result_type>::type
+	operator()(Iter const&f, Iter const& e)const{
+		return OV(this->kernel())(f,e);
+	}
+	//TODO: version that takes objects directly instead of iterators
+};
+}
+#endif
+
+namespace CartesianDKernelFunctors {
+template<class R_> struct Side_of_oriented_sphere : private Store_kernel<R_> {
+	CGAL_FUNCTOR_INIT_STORE(Side_of_oriented_sphere)
+	typedef R_ R;
+	typedef typename Get_type<R, RT_tag>::type RT;
+	typedef typename Get_type<R, Point_tag>::type Point;
+	typedef typename Get_type<R, Oriented_side_tag>::type result_type;
+	typedef typename Increment_dimension<typename R::Default_ambient_dimension>::type D1;
+	typedef typename Increment_dimension<typename R::Max_ambient_dimension>::type D2;
+	typedef typename R::LA::template Rebind_dimension<D1,D2>::Other LA;
+	typedef typename LA::Square_matrix Matrix;
+
+	template<class Iter>
+	result_type operator()(Iter f, Iter const& e)const{
+	  Point const& p0=*f++; // *--e ?
+	  return this->operator()(f,e,p0);
+	}
+
+	template<class Iter>
+	result_type operator()(Iter f, Iter const& e, Point const& p0) const {
+	  typedef typename Get_functor<R, Squared_distance_to_origin_tag>::type Sqdo;
+	  typename Get_functor<R, Compute_point_cartesian_coordinate_tag>::type c(this->kernel());
+	  typename Get_functor<R, Point_dimension_tag>::type pd(this->kernel());
+
+	  int d=pd(p0);
+	  Matrix m(d+1,d+1);
+	  if(CGAL::Is_stored<Sqdo>::value) {
+	    Sqdo sqdo(this->kernel());
+	    for(int i=0;f!=e;++f,++i) {
+	      Point const& p=*f;
+	      for(int j=0;j<d;++j){
+		RT const& x=c(p,j);
+		m(i,j)=x-c(p0,j);
+	      }
+	      m(i,d) = sqdo(p) - sqdo(p0);
+	    }
+	  } else {
+	    for(int i=0;f!=e;++f,++i) {
+	      Point const& p=*f;
+	      m(i,d) = 0;
+	      for(int j=0;j<d;++j){
+		RT const& x=c(p,j);
+		m(i,j)=x-c(p0,j);
+		m(i,d)+=CGAL::square(m(i,j));
+	      }
+	    }
+	  }
+	  if(d%2)
+	    return -LA::sign_of_determinant(CGAL_MOVE(m));
+	  else
+	    return LA::sign_of_determinant(CGAL_MOVE(m));
+	}
+
+#ifdef CGAL_CXX11
+	template <class...U,class=typename std::enable_if<(sizeof...(U)>=4)>::type>
+	result_type operator()(U&&...u) const {
+		return operator()({std::forward<U>(u)...});
+	}
+
+	template <class P>
+	result_type operator()(std::initializer_list<P> l) const {
+		return operator()(l.begin(),l.end());
+	}
+#else
+	//TODO
+#endif
+};
+}
+
+CGAL_KD_DEFAULT_FUNCTOR(Side_of_oriented_sphere_tag,(CartesianDKernelFunctors::Side_of_oriented_sphere<K>),(Point_tag),(Point_dimension_tag,Squared_distance_to_origin_tag,Compute_point_cartesian_coordinate_tag));
+
+namespace CartesianDKernelFunctors {
+template <class R_> struct Construct_circumcenter : Store_kernel<R_> {
+  CGAL_FUNCTOR_INIT_STORE(Construct_circumcenter)
+  typedef typename Get_type<R_, Point_tag>::type Point;
+  typedef Point result_type;
+  typedef typename Get_type<R_, FT_tag>::type FT;
+  template <class Iter>
+  result_type operator()(Iter f, Iter e)const{
+    typedef typename Get_type<R_, Point_tag>::type      Point;
+    typedef typename R_::LA LA;
+    typename Get_functor<R_, Compute_point_cartesian_coordinate_tag>::type c(this->kernel());
+    typename Get_functor<R_, Construct_ttag<Point_tag> >::type cp(this->kernel());
+    typename Get_functor<R_, Point_dimension_tag>::type pd(this->kernel());
+    typename Get_functor<R_, Squared_distance_to_origin_tag>::type sdo(this->kernel());
+
+    Point const& p0=*f;
+    int d = pd(p0);
+    if (d+1 == std::distance(f,e))
+    {
+      // 2*(x-y).c == x^2-y^2
+      typedef typename LA::Square_matrix Matrix;
+      typedef typename LA::Vector Vec;
+      typedef typename LA::Construct_vector CVec;
+      FT const& n0 = sdo(p0);
+      Matrix m(d,d);
+      Vec b = typename CVec::Dimension()(d);
+      // Write the point coordinates in lines.
+      int i;
+      for(i=0; ++f!=e; ++i) {
+	Point const& p=*f;
+	for(int j=0;j<d;++j) {
+	  m(i,j)=2*(c(p,j)-c(p0,j));
+	  b[i] = sdo(p) - n0;
+	}
+      }
+      CGAL_assertion (i == d);
+      Vec res = typename CVec::Dimension()(d);;
+      //std::cout << "Mat: " << m << "\n Vec: " << one << std::endl;
+      LA::solve(res, CGAL_MOVE(m), CGAL_MOVE(b));
+      //std::cout << "Sol: " << res << std::endl;
+      return cp(d,LA::vector_begin(res),LA::vector_end(res));
+    }
+    else
+    {
+      /*
+       * Matrix P=(p1, p2, ...) (each point as a column)
+       * Matrix Q=2*t(p2-p1,p3-p1, ...) (each vector as a line)
+       * Matrix M: QP, adding a line of 1 at the top
+       * Vector B: (1, p2^2-p1^2, p3^2-p1^2, ...)
+       * Solve ML=B, the center of the sphere is PL
+       *
+       * It would likely be faster to write P then transpose, multiply,
+       * etc instead of doing it by hand.
+       */
+      // TODO: check for degenerate cases?
+
+      typedef typename R_::Max_ambient_dimension D2;
+      typedef typename R_::LA::template Rebind_dimension<Dynamic_dimension_tag,D2>::Other LAd;
+      typedef typename LAd::Square_matrix Matrix;
+      typedef typename LAd::Vector Vec;
+      typename Get_functor<R_, Scalar_product_tag>::type sp(this->kernel());
+      int k=static_cast<int>(std::distance(f,e));
+      Matrix m(k,k);
+      Vec b(k);
+      Vec l(k);
+      int j,i=0;
+      for(Iter f2=f;f2!=e;++f2,++i){
+	b(i)=m(i,i)=sdo(*f2);
+	j=0;
+	for(Iter f3=f;f3!=e;++f3,++j){
+	  m(j,i)=m(i,j)=sp(*f2,*f3);
+	}
+      }
+      for(i=1;i<k;++i){
+	b(i)-=b(0);
+	for(j=0;j<k;++j){
+	  m(i,j)=2*(m(i,j)-m(0,j));
+	}
+      }
+      for(j=0;j<k;++j) m(0,j)=1;
+      b(0)=1;
+
+      LAd::solve(l,CGAL_MOVE(m),CGAL_MOVE(b));
+
+      typename LA::Vector center=typename LA::Construct_vector::Dimension()(d);
+      for(i=0;i<d;++i) center(i)=0;
+      j=0;
+      for(Iter f2=f;f2!=e;++f2,++j){
+	for(i=0;i<d;++i){
+	  center(i)+=l(j)*c(*f2,i);
+	}
+      }
+
+      return cp(LA::vector_begin(center),LA::vector_end(center));
+    }
+  }
+};
+}
+
+CGAL_KD_DEFAULT_FUNCTOR(Construct_circumcenter_tag,(CartesianDKernelFunctors::Construct_circumcenter<K>),(Point_tag),(Construct_ttag<Point_tag>,Compute_point_cartesian_coordinate_tag,Scalar_product_tag,Squared_distance_to_origin_tag,Point_dimension_tag));
+
+namespace CartesianDKernelFunctors {
+template <class R_> struct Squared_circumradius : Store_kernel<R_> {
+  CGAL_FUNCTOR_INIT_STORE(Squared_circumradius)
+  typedef typename Get_type<R_, FT_tag>::type result_type;
+  template <class Iter>
+  result_type operator()(Iter f, Iter e)const{
+    typename Get_functor<R_, Construct_circumcenter_tag>::type cc(this->kernel());
+    typename Get_functor<R_, Squared_distance_tag>::type sd(this->kernel());
+    return sd(cc(f, e), *f);
+  }
+};
+}
+
+CGAL_KD_DEFAULT_FUNCTOR(Squared_circumradius_tag,(CartesianDKernelFunctors::Squared_circumradius<K>),(Point_tag),(Construct_circumcenter_tag,Squared_distance_tag));
+
+namespace CartesianDKernelFunctors {
+// TODO: implement it directly, it should be at least as fast as Side_of_oriented_sphere.
+template<class R_> struct Side_of_bounded_sphere : private Store_kernel<R_> {
+	CGAL_FUNCTOR_INIT_STORE(Side_of_bounded_sphere)
+	typedef R_ R;
+	typedef typename Get_type<R, Point_tag>::type Point;
+	typedef typename Get_type<R, Bounded_side_tag>::type result_type;
+
+	template<class Iter>
+	result_type operator()(Iter f, Iter const& e) const {
+	  Point const& p0 = *f++; // *--e ?
+	  typename Get_functor<R, Point_dimension_tag>::type pd(this->kernel());
+	  //FIXME: Doesn't work for non-full dimension.
+	  CGAL_assertion (std::distance(f,e) == pd(p0)+1);
+	  return operator() (f, e, p0);
+	}
+
+	template<class Iter>
+	result_type operator()(Iter const& f, Iter const& e, Point const& p0) const {
+	  typename Get_functor<R, Side_of_oriented_sphere_tag>::type sos (this->kernel());
+	  typename Get_functor<R, Orientation_of_points_tag>::type op (this->kernel());
+	  // enum_cast is not very generic, but since this function isn't supposed to remain like this...
+	  return enum_cast<Bounded_side> (sos (f, e, p0) * op (f, e));
+	}
+
+#ifdef CGAL_CXX11
+	template <class...U,class=typename std::enable_if<(sizeof...(U)>=4)>::type>
+	result_type operator()(U&&...u) const {
+		return operator()({std::forward<U>(u)...});
+	}
+
+	template <class P>
+	result_type operator()(std::initializer_list<P> l) const {
+		return operator()(l.begin(),l.end());
+	}
+#else
+	//TODO
+#endif
+};
+}
+
+CGAL_KD_DEFAULT_FUNCTOR(Side_of_bounded_sphere_tag,(CartesianDKernelFunctors::Side_of_bounded_sphere<K>),(Point_tag),(Side_of_oriented_sphere_tag,Orientation_of_points_tag));
+
+namespace CartesianDKernelFunctors {
+template<class R_> struct Side_of_bounded_circumsphere : private Store_kernel<R_> {
+	CGAL_FUNCTOR_INIT_STORE(Side_of_bounded_circumsphere)
+	typedef typename Get_type<R_, Bounded_side_tag>::type result_type;
+
+	template<class Iter, class P>
+	result_type operator()(Iter f, Iter const& e, P const& p0) const {
+	  // TODO: Special case when the dimension is full.
+	  typename Get_functor<R_, Construct_circumcenter_tag>::type cc(this->kernel());
+	  typename Get_functor<R_, Compare_distance_tag>::type cd(this->kernel());
+
+	  return enum_cast<Bounded_side>(cd(cc(f, e), *f, p0));
+	}
+};
+}
+
+CGAL_KD_DEFAULT_FUNCTOR(Side_of_bounded_circumsphere_tag,(CartesianDKernelFunctors::Side_of_bounded_circumsphere<K>),(Point_tag),(Squared_distance_tag,Construct_circumcenter_tag));
+
+namespace CartesianDKernelFunctors {
+template<class R_> struct Point_to_vector : private Store_kernel<R_> {
+	CGAL_FUNCTOR_INIT_STORE(Point_to_vector)
+	typedef R_ R;
+	typedef typename Get_type<R, RT_tag>::type RT;
+	typedef typename Get_type<R, Vector_tag>::type Vector;
+	typedef typename Get_type<R, Point_tag>::type Point;
+	typedef typename Get_functor<R, Construct_ttag<Vector_tag> >::type CV;
+	typedef typename Get_functor<R, Construct_ttag<Point_cartesian_const_iterator_tag> >::type CI;
+	typedef Vector result_type;
+	typedef Point argument_type;
+	result_type operator()(argument_type const&v)const{
+		CI ci(this->kernel());
+		return CV(this->kernel())(ci(v,Begin_tag()),ci(v,End_tag()));
+	}
+};
+}
+
+CGAL_KD_DEFAULT_FUNCTOR(Point_to_vector_tag,(CartesianDKernelFunctors::Point_to_vector<K>),(Point_tag,Vector_tag),(Construct_ttag<Vector_tag>, Construct_ttag<Point_cartesian_const_iterator_tag>));
+
+namespace CartesianDKernelFunctors {
+template<class R_> struct Vector_to_point : private Store_kernel<R_> {
+	CGAL_FUNCTOR_INIT_STORE(Vector_to_point)
+	typedef R_ R;
+	typedef typename Get_type<R, RT_tag>::type RT;
+	typedef typename Get_type<R, Vector_tag>::type Vector;
+	typedef typename Get_type<R, Point_tag>::type Point;
+	typedef typename Get_functor<R, Construct_ttag<Point_tag> >::type CP;
+	typedef typename Get_functor<R, Construct_ttag<Vector_cartesian_const_iterator_tag> >::type CI;
+	typedef Point result_type;
+	typedef Vector argument_type;
+	result_type operator()(argument_type const&v)const{
+		CI ci(this->kernel());
+		return CP(this->kernel())(ci(v,Begin_tag()),ci(v,End_tag()));
+	}
+};
+}
+
+CGAL_KD_DEFAULT_FUNCTOR(Vector_to_point_tag,(CartesianDKernelFunctors::Vector_to_point<K>),(Point_tag,Vector_tag),(Construct_ttag<Point_tag>, Construct_ttag<Vector_cartesian_const_iterator_tag>));
+
+namespace CartesianDKernelFunctors {
+template<class R_> struct Opposite_vector : private Store_kernel<R_> {
+	CGAL_FUNCTOR_INIT_STORE(Opposite_vector)
+	typedef R_ R;
+	typedef typename Get_type<R, RT_tag>::type RT;
+	typedef typename Get_type<R, Vector_tag>::type Vector;
+	typedef typename Get_functor<R, Construct_ttag<Vector_tag> >::type CV;
+	typedef typename Get_functor<R, Construct_ttag<Vector_cartesian_const_iterator_tag> >::type CI;
+	typedef Vector result_type;
+	typedef Vector argument_type;
+	result_type operator()(Vector const&v)const{
+		CI ci(this->kernel());
+		return CV(this->kernel())(make_transforming_iterator(ci(v,Begin_tag()),std::negate<RT>()),make_transforming_iterator(ci(v,End_tag()),std::negate<RT>()));
+	}
+};
+}
+
+CGAL_KD_DEFAULT_FUNCTOR(Opposite_vector_tag,(CartesianDKernelFunctors::Opposite_vector<K>),(Vector_tag),(Construct_ttag<Vector_tag>, Construct_ttag<Vector_cartesian_const_iterator_tag>));
+
+namespace CartesianDKernelFunctors {
+template<class R_> struct Scaled_vector : private Store_kernel<R_> {
+	CGAL_FUNCTOR_INIT_STORE(Scaled_vector)
+	typedef R_ R;
+	typedef typename Get_type<R, FT_tag>::type FT;
+	typedef typename Get_type<R, Vector_tag>::type Vector;
+	typedef typename Get_functor<R, Construct_ttag<Vector_tag> >::type CV;
+	typedef typename Get_functor<R, Construct_ttag<Vector_cartesian_const_iterator_tag> >::type CI;
+	typedef Vector result_type;
+	typedef Vector first_argument_type;
+	typedef FT second_argument_type;
+	result_type operator()(Vector const&v,FT const& s)const{
+		CI ci(this->kernel());
+		return CV(this->kernel())(make_transforming_iterator(ci(v,Begin_tag()),Scale<FT>(s)),make_transforming_iterator(ci(v,End_tag()),Scale<FT>(s)));
+	}
+};
+}
+
+CGAL_KD_DEFAULT_FUNCTOR(Scaled_vector_tag,(CartesianDKernelFunctors::Scaled_vector<K>),(Vector_tag),(Construct_ttag<Vector_tag>, Construct_ttag<Vector_cartesian_const_iterator_tag>));
+
+namespace CartesianDKernelFunctors {
+template<class R_> struct Sum_of_vectors : private Store_kernel<R_> {
+	CGAL_FUNCTOR_INIT_STORE(Sum_of_vectors)
+	typedef R_ R;
+	typedef typename Get_type<R, RT_tag>::type RT;
+	typedef typename Get_type<R, Vector_tag>::type Vector;
+	typedef typename Get_functor<R, Construct_ttag<Vector_tag> >::type CV;
+	typedef typename Get_functor<R, Construct_ttag<Vector_cartesian_const_iterator_tag> >::type CI;
+	typedef Vector result_type;
+	typedef Vector first_argument_type;
+	typedef Vector second_argument_type;
+	result_type operator()(Vector const&a, Vector const&b)const{
+		CI ci(this->kernel());
+		return CV(this->kernel())(make_transforming_pair_iterator(ci(a,Begin_tag()),ci(b,Begin_tag()),std::plus<RT>()),make_transforming_pair_iterator(ci(a,End_tag()),ci(b,End_tag()),std::plus<RT>()));
+	}
+};
+}
+
+CGAL_KD_DEFAULT_FUNCTOR(Sum_of_vectors_tag,(CartesianDKernelFunctors::Sum_of_vectors<K>),(Vector_tag),(Construct_ttag<Vector_tag>, Construct_ttag<Vector_cartesian_const_iterator_tag>));
+
+namespace CartesianDKernelFunctors {
+template<class R_> struct Difference_of_vectors : private Store_kernel<R_> {
+	CGAL_FUNCTOR_INIT_STORE(Difference_of_vectors)
+	typedef R_ R;
+	typedef typename Get_type<R, RT_tag>::type RT;
+	typedef typename Get_type<R, Vector_tag>::type Vector;
+	typedef typename Get_functor<R, Construct_ttag<Vector_tag> >::type CV;
+	typedef typename Get_functor<R, Construct_ttag<Vector_cartesian_const_iterator_tag> >::type CI;
+	typedef Vector result_type;
+	typedef Vector first_argument_type;
+	typedef Vector second_argument_type;
+	result_type operator()(Vector const&a, Vector const&b)const{
+		CI ci(this->kernel());
+		return CV(this->kernel())(make_transforming_pair_iterator(ci(a,Begin_tag()),ci(b,Begin_tag()),std::minus<RT>()),make_transforming_pair_iterator(ci(a,End_tag()),ci(b,End_tag()),std::minus<RT>()));
+	}
+};
+}
+
+CGAL_KD_DEFAULT_FUNCTOR(Difference_of_vectors_tag,(CartesianDKernelFunctors::Difference_of_vectors<K>),(Vector_tag),(Construct_ttag<Vector_tag>, Construct_ttag<Vector_cartesian_const_iterator_tag>));
+
+namespace CartesianDKernelFunctors {
+template<class R_> struct Translated_point : private Store_kernel<R_> {
+	CGAL_FUNCTOR_INIT_STORE(Translated_point)
+	typedef R_ R;
+	typedef typename Get_type<R, RT_tag>::type RT;
+	typedef typename Get_type<R, Vector_tag>::type Vector;
+	typedef typename Get_type<R, Point_tag>::type Point;
+	typedef typename Get_functor<R, Construct_ttag<Point_tag> >::type CP;
+	typedef typename Get_functor<R, Construct_ttag<Vector_cartesian_const_iterator_tag> >::type CVI;
+	typedef typename Get_functor<R, Construct_ttag<Point_cartesian_const_iterator_tag> >::type CPI;
+	typedef Point  result_type;
+	typedef Point  first_argument_type;
+	typedef Vector second_argument_type;
+	result_type operator()(Point const&a, Vector const&b)const{
+		CVI cvi(this->kernel());
+		CPI cpi(this->kernel());
+		return CP(this->kernel())(make_transforming_pair_iterator(cpi(a,Begin_tag()),cvi(b,Begin_tag()),std::plus<RT>()),make_transforming_pair_iterator(cpi(a,End_tag()),cvi(b,End_tag()),std::plus<RT>()));
+	}
+};
+}
+
+CGAL_KD_DEFAULT_FUNCTOR(Translated_point_tag,(CartesianDKernelFunctors::Translated_point<K>),(Point_tag, Vector_tag),(Construct_ttag<Point_tag>, Construct_ttag<Vector_cartesian_const_iterator_tag>, Construct_ttag<Point_cartesian_const_iterator_tag>));
+
+namespace CartesianDKernelFunctors {
+template<class R_> struct Difference_of_points : private Store_kernel<R_> {
+	CGAL_FUNCTOR_INIT_STORE(Difference_of_points)
+	typedef R_ R;
+	typedef typename Get_type<R, RT_tag>::type RT;
+	typedef typename Get_type<R, Point_tag>::type Point;
+	typedef typename Get_type<R, Vector_tag>::type Vector;
+	typedef typename Get_functor<R, Construct_ttag<Vector_tag> >::type CV;
+	typedef typename Get_functor<R, Construct_ttag<Point_cartesian_const_iterator_tag> >::type CI;
+	typedef Vector result_type;
+	typedef Point first_argument_type;
+	typedef Point second_argument_type;
+	result_type operator()(Point const&a, Point const&b)const{
+		CI ci(this->kernel());
+		return CV(this->kernel())(make_transforming_pair_iterator(ci(a,Begin_tag()),ci(b,Begin_tag()),std::minus<RT>()),make_transforming_pair_iterator(ci(a,End_tag()),ci(b,End_tag()),std::minus<RT>()));
+	}
+};
+}
+
+CGAL_KD_DEFAULT_FUNCTOR(Difference_of_points_tag,(CartesianDKernelFunctors::Difference_of_points<K>),(Point_tag, Vector_tag),(Construct_ttag<Vector_tag>, Construct_ttag<Point_cartesian_const_iterator_tag>));
+
+namespace CartesianDKernelFunctors {
+template<class R_> struct Midpoint : private Store_kernel<R_> {
+	CGAL_FUNCTOR_INIT_STORE(Midpoint)
+	typedef R_ R;
+	typedef typename Get_type<R, FT_tag>::type FT;
+	typedef typename Get_type<R, RT_tag>::type RT;
+	typedef typename Get_type<R, Point_tag>::type Point;
+	typedef typename Get_functor<R, Construct_ttag<Point_tag> >::type CP;
+	typedef typename Get_functor<R, Construct_ttag<Point_cartesian_const_iterator_tag> >::type CI;
+	typedef Point result_type;
+	typedef Point first_argument_type;
+	typedef Point second_argument_type;
+	// There is a division, but it will be cast to RT afterwards anyway, so maybe we could use RT.
+	struct Average : std::binary_function<FT,RT,FT> {
+		FT operator()(FT const&a, RT const&b)const{
+			return (a+b)/2;
+		}
+	};
+	result_type operator()(Point const&a, Point const&b)const{
+		CI ci(this->kernel());
+		//Divide<FT,int> half(2);
+		//return CP(this->kernel())(make_transforming_iterator(make_transforming_pair_iterator(ci.begin(a),ci.begin(b),std::plus<FT>()),half),make_transforming_iterator(make_transforming_pair_iterator(ci.end(a),ci.end(b),std::plus<FT>()),half));
+		return CP(this->kernel())(make_transforming_pair_iterator(ci(a,Begin_tag()),ci(b,Begin_tag()),Average()),make_transforming_pair_iterator(ci(a,End_tag()),ci(b,End_tag()),Average()));
+	}
+};
+}
+
+CGAL_KD_DEFAULT_FUNCTOR(Midpoint_tag,(CartesianDKernelFunctors::Midpoint<K>),(Point_tag),(Construct_ttag<Point_tag>, Construct_ttag<Point_cartesian_const_iterator_tag>));
+
+namespace CartesianDKernelFunctors {
+template<class R_> struct Squared_length : private Store_kernel<R_> {
+	CGAL_FUNCTOR_INIT_STORE(Squared_length)
+	typedef R_ R;
+	typedef typename Get_type<R, RT_tag>::type RT;
+	typedef typename Get_type<R, Vector_tag>::type Vector;
+	typedef typename Get_functor<R, Construct_ttag<Vector_cartesian_const_iterator_tag> >::type CI;
+	typedef RT result_type;
+	typedef Vector argument_type;
+	result_type operator()(Vector const&a)const{
+		CI ci(this->kernel());
+		typename Algebraic_structure_traits<RT>::Square f;
+		// TODO: avoid this RT(0)+...
+		return std::accumulate(make_transforming_iterator(ci(a,Begin_tag()),f),make_transforming_iterator(ci(a,End_tag()),f),RT(0));
+	}
+};
+}
+
+CGAL_KD_DEFAULT_FUNCTOR(Squared_length_tag,(CartesianDKernelFunctors::Squared_length<K>),(Vector_tag),(Construct_ttag<Vector_cartesian_const_iterator_tag>));
+
+namespace CartesianDKernelFunctors {
+template<class R_> struct Squared_distance_to_origin : private Store_kernel<R_> {
+	CGAL_FUNCTOR_INIT_STORE(Squared_distance_to_origin)
+	typedef R_ R;
+	typedef typename Get_type<R, RT_tag>::type RT;
+	typedef typename Get_type<R, Point_tag>::type Point;
+	typedef typename Get_functor<R, Construct_ttag<Point_cartesian_const_iterator_tag> >::type CI;
+	typedef RT result_type;
+	typedef Point argument_type;
+	result_type operator()(Point const&a)const{
+		CI ci(this->kernel());
+		typename Algebraic_structure_traits<RT>::Square f;
+		// TODO: avoid this RT(0)+...
+		return std::accumulate(make_transforming_iterator(ci(a,Begin_tag()),f),make_transforming_iterator(ci(a,End_tag()),f),RT(0));
+	}
+};
+}
+
+CGAL_KD_DEFAULT_FUNCTOR(Squared_distance_to_origin_tag,(CartesianDKernelFunctors::Squared_distance_to_origin<K>),(Point_tag),(Construct_ttag<Point_cartesian_const_iterator_tag>));
+
+namespace CartesianDKernelFunctors {
+template<class R_> struct Squared_distance : private Store_kernel<R_> {
+	CGAL_FUNCTOR_INIT_STORE(Squared_distance)
+	typedef R_ R;
+	typedef typename Get_type<R, RT_tag>::type RT;
+	typedef typename Get_type<R, Point_tag>::type Point;
+	typedef typename Get_functor<R, Construct_ttag<Point_cartesian_const_iterator_tag> >::type CI;
+	typedef RT result_type;
+	typedef Point first_argument_type;
+	typedef Point second_argument_type;
+	struct Sq_diff : std::binary_function<RT,RT,RT> {
+		RT operator()(RT const&a, RT const&b)const{
+			return CGAL::square(a-b);
+		}
+	};
+	result_type operator()(Point const&a, Point const&b)const{
+		CI ci(this->kernel());
+		Sq_diff f;
+		// TODO: avoid this RT(0)+...
+		return std::accumulate(make_transforming_pair_iterator(ci(a,Begin_tag()),ci(b,Begin_tag()),f),make_transforming_pair_iterator(ci(a,End_tag()),ci(b,End_tag()),f),RT(0));
+	}
+};
+}
+
+CGAL_KD_DEFAULT_FUNCTOR(Squared_distance_tag,(CartesianDKernelFunctors::Squared_distance<K>),(Point_tag),(Construct_ttag<Point_cartesian_const_iterator_tag>));
+
+namespace CartesianDKernelFunctors {
+template<class R_> struct Scalar_product : private Store_kernel<R_> {
+  CGAL_FUNCTOR_INIT_STORE(Scalar_product)
+  typedef R_ R;
+  typedef typename Get_type<R, RT_tag>::type RT;
+  typedef typename Get_type<R, Vector_tag>::type Vector;
+  typedef typename Get_functor<R, Construct_ttag<Vector_cartesian_const_iterator_tag> >::type CI;
+  typedef RT result_type;
+  typedef Vector first_argument_type;
+  typedef Vector second_argument_type;
+  result_type operator()(Vector const&a, Vector const&b)const{
+    CI ci(this->kernel());
+    std::multiplies<RT> f;
+    // TODO: avoid this RT(0)+...
+    return std::accumulate(
+	make_transforming_pair_iterator(ci(a,Begin_tag()),ci(b,Begin_tag()),f),
+	make_transforming_pair_iterator(ci(a,  End_tag()),ci(b,  End_tag()),f),
+	RT(0));
+  }
+};
+}
+
+CGAL_KD_DEFAULT_FUNCTOR(Scalar_product_tag,(CartesianDKernelFunctors::Scalar_product<K>),(Vector_tag),(Construct_ttag<Vector_cartesian_const_iterator_tag>));
+
+namespace CartesianDKernelFunctors {
+template<class R_> struct Compare_distance : private Store_kernel<R_> {
+	CGAL_FUNCTOR_INIT_STORE(Compare_distance)
+	typedef R_ R;
+	typedef typename Get_type<R, Point_tag>::type Point;
+	typedef typename Get_functor<R, Squared_distance_tag>::type CSD;
+	typedef typename Get_type<R, Comparison_result_tag>::type result_type;
+	typedef Point first_argument_type;
+	typedef Point second_argument_type;
+	typedef Point third_argument_type; // why am I doing this already?
+	typedef Point fourth_argument_type;
+	result_type operator()(Point const&a, Point const&b, Point const&c)const{
+		CSD csd(this->kernel());
+		return CGAL_NTS compare(csd(a,b),csd(a,c));
+	}
+	result_type operator()(Point const&a, Point const&b, Point const&c, Point const&d)const{
+		CSD csd(this->kernel());
+		return CGAL_NTS compare(csd(a,b),csd(c,d));
+	}
+};
+}
+
+CGAL_KD_DEFAULT_FUNCTOR(Compare_distance_tag,(CartesianDKernelFunctors::Compare_distance<K>),(Point_tag),(Squared_distance_tag));
+
+namespace CartesianDKernelFunctors {
+template<class R_> struct Less_point_cartesian_coordinate : private Store_kernel<R_> {
+	CGAL_FUNCTOR_INIT_STORE(Less_point_cartesian_coordinate)
+	typedef R_ R;
+	typedef typename Get_type<R, Bool_tag>::type result_type;
+	typedef typename Get_functor<R, Compute_point_cartesian_coordinate_tag>::type Cc;
+	// TODO: This is_exact thing should be reengineered.
+	// the goal is to have a way to tell: don't filter this
+	typedef typename CGAL::Is_exact<Cc> Is_exact;
+
+	template<class V,class W,class I>
+	result_type operator()(V const&a, W const&b, I i)const{
+		Cc c(this->kernel());
+		return c(a,i)<c(b,i);
+	}
+};
+}
+
+CGAL_KD_DEFAULT_FUNCTOR(Less_point_cartesian_coordinate_tag,(CartesianDKernelFunctors::Less_point_cartesian_coordinate<K>),(),(Compute_point_cartesian_coordinate_tag));
+
+namespace CartesianDKernelFunctors {
+template<class R_> struct Compare_point_cartesian_coordinate : private Store_kernel<R_> {
+	CGAL_FUNCTOR_INIT_STORE(Compare_point_cartesian_coordinate)
+	typedef R_ R;
+	typedef typename Get_type<R, Comparison_result_tag>::type result_type;
+	typedef typename Get_functor<R, Compute_point_cartesian_coordinate_tag>::type Cc;
+	// TODO: This is_exact thing should be reengineered.
+	// the goal is to have a way to tell: don't filter this
+	typedef typename CGAL::Is_exact<Cc> Is_exact;
+
+	template<class V,class W,class I>
+	result_type operator()(V const&a, W const&b, I i)const{
+		Cc c(this->kernel());
+		return CGAL_NTS compare(c(a,i),c(b,i));
+	}
+};
+}
+
+CGAL_KD_DEFAULT_FUNCTOR(Compare_point_cartesian_coordinate_tag,(CartesianDKernelFunctors::Compare_point_cartesian_coordinate<K>),(),(Compute_point_cartesian_coordinate_tag));
+
+namespace CartesianDKernelFunctors {
+template<class R_> struct Compare_lexicographically : private Store_kernel<R_> {
+	CGAL_FUNCTOR_INIT_STORE(Compare_lexicographically)
+	typedef R_ R;
+	typedef typename Get_type<R, Comparison_result_tag>::type result_type;
+	typedef typename Get_functor<R, Construct_ttag<Point_cartesian_const_iterator_tag> >::type CI;
+	// TODO: This is_exact thing should be reengineered.
+	// the goal is to have a way to tell: don't filter this
+	typedef typename CGAL::Is_exact<CI> Is_exact;
+
+	template<class V,class W>
+	result_type operator()(V const&a, W const&b)const{
+		CI c(this->kernel());
+#ifdef CGAL_CXX11
+		auto
+#else
+		typename CI::result_type
+#endif
+		a_begin=c(a,Begin_tag()),
+		b_begin=c(b,Begin_tag()),
+		a_end=c(a,End_tag());
+		result_type res;
+		// can't we do slightly better for Uncertain<*> ?
+		// after res=...; if(is_uncertain(res))return indeterminate<result_type>();
+		do res=CGAL_NTS compare(*a_begin++,*b_begin++);
+		while(a_begin!=a_end && res==EQUAL);
+		return res;
+	}
+};
+}
+
+CGAL_KD_DEFAULT_FUNCTOR(Compare_lexicographically_tag,(CartesianDKernelFunctors::Compare_lexicographically<K>),(),(Construct_ttag<Point_cartesian_const_iterator_tag>));
+
+namespace CartesianDKernelFunctors {
+template<class R_> struct Less_lexicographically : private Store_kernel<R_> {
+	CGAL_FUNCTOR_INIT_STORE(Less_lexicographically)
+	typedef R_ R;
+	typedef typename Get_type<R, Bool_tag>::type result_type;
+	typedef typename Get_functor<R, Compare_lexicographically_tag>::type CL;
+	typedef typename CGAL::Is_exact<CL> Is_exact;
+
+	template <class V, class W>
+	result_type operator() (V const&a, W const&b) const {
+		CL c (this->kernel());
+		return c(a,b) < 0;
+	}
+};
+}
+
+CGAL_KD_DEFAULT_FUNCTOR(Less_lexicographically_tag,(CartesianDKernelFunctors::Less_lexicographically<K>),(),(Compare_lexicographically_tag));
+
+namespace CartesianDKernelFunctors {
+template<class R_> struct Less_or_equal_lexicographically : private Store_kernel<R_> {
+	CGAL_FUNCTOR_INIT_STORE(Less_or_equal_lexicographically)
+	typedef R_ R;
+	typedef typename Get_type<R, Bool_tag>::type result_type;
+	typedef typename Get_functor<R, Compare_lexicographically_tag>::type CL;
+	typedef typename CGAL::Is_exact<CL> Is_exact;
+
+	template <class V, class W>
+	result_type operator() (V const&a, W const&b) const {
+		CL c (this->kernel());
+		return c(a,b) <= 0;
+	}
+};
+}
+
+CGAL_KD_DEFAULT_FUNCTOR(Less_or_equal_lexicographically_tag,(CartesianDKernelFunctors::Less_or_equal_lexicographically<K>),(),(Compare_lexicographically_tag));
+
+namespace CartesianDKernelFunctors {
+template<class R_> struct Equal_points : private Store_kernel<R_> {
+	CGAL_FUNCTOR_INIT_STORE(Equal_points)
+	typedef R_ R;
+	typedef typename Get_type<R, Bool_tag>::type result_type;
+	typedef typename Get_functor<R, Construct_ttag<Point_cartesian_const_iterator_tag> >::type CI;
+	// TODO: This is_exact thing should be reengineered.
+	// the goal is to have a way to tell: don't filter this
+	typedef typename CGAL::Is_exact<CI> Is_exact;
+
+	template<class V,class W>
+	result_type operator()(V const&a, W const&b)const{
+		CI c(this->kernel());
+#ifdef CGAL_CXX11
+		auto
+#else
+		typename CI::result_type
+#endif
+		a_begin=c(a,Begin_tag()),
+		b_begin=c(b,Begin_tag()),
+		a_end=c(a,End_tag());
+		result_type res = true;
+		// Is using CGAL::possibly for Uncertain really an optimization?
+		do res = res & (*a_begin++ == *b_begin++);
+		while(a_begin!=a_end && possibly(res));
+		return res;
+	}
+};
+}
+
+CGAL_KD_DEFAULT_FUNCTOR(Equal_points_tag,(CartesianDKernelFunctors::Equal_points<K>),(),(Construct_ttag<Point_cartesian_const_iterator_tag>));
+
+namespace CartesianDKernelFunctors {
+template<class R_> struct Oriented_side : private Store_kernel<R_> {
+	CGAL_FUNCTOR_INIT_STORE(Oriented_side)
+	typedef R_ R;
+	typedef typename Get_type<R, Oriented_side_tag>::type result_type;
+	typedef typename Get_type<R, Point_tag>::type Point;
+	typedef typename Get_type<R, Hyperplane_tag>::type Hyperplane;
+	typedef typename Get_type<R, Sphere_tag>::type Sphere;
+	typedef typename Get_functor<R, Value_at_tag>::type VA;
+	typedef typename Get_functor<R, Hyperplane_translation_tag>::type HT;
+	typedef typename Get_functor<R, Squared_distance_tag>::type SD;
+	typedef typename Get_functor<R, Squared_radius_tag>::type SR;
+	typedef typename Get_functor<R, Center_of_sphere_tag>::type CS;
+
+	result_type operator()(Hyperplane const&h, Point const&p)const{
+		HT ht(this->kernel());
+		VA va(this->kernel());
+		return CGAL::compare(va(h,p),ht(h));
+	}
+	result_type operator()(Sphere const&s, Point const&p)const{
+		SD sd(this->kernel());
+		SR sr(this->kernel());
+		CS cs(this->kernel());
+		return CGAL::compare(sd(cs(s),p),sr(s));
+	}
+};
+}
+
+CGAL_KD_DEFAULT_FUNCTOR(Oriented_side_tag,(CartesianDKernelFunctors::Oriented_side<K>),(Point_tag,Sphere_tag,Hyperplane_tag),(Value_at_tag,Hyperplane_translation_tag,Squared_distance_tag,Squared_radius_tag,Center_of_sphere_tag));
+
+namespace CartesianDKernelFunctors {
+template<class R_> struct Has_on_positive_side : private Store_kernel<R_> {
+	CGAL_FUNCTOR_INIT_STORE(Has_on_positive_side)
+	typedef R_ R;
+	typedef typename Get_type<R, Bool_tag>::type result_type;
+	typedef typename Get_functor<R, Oriented_side_tag>::type OS;
+
+	template <class Obj, class Pt>
+	result_type operator()(Obj const&o, Pt const&p)const{
+		OS os(this->kernel());
+		return os(o,p) == ON_POSITIVE_SIDE;
+	}
+};
+}
+
+CGAL_KD_DEFAULT_FUNCTOR(Has_on_positive_side_tag,(CartesianDKernelFunctors::Has_on_positive_side<K>),(),(Oriented_side_tag));
+
+}
+#include <CGAL/NewKernel_d/Coaffine.h>
+#endif // CGAL_KERNEL_D_FUNCTION_OBJECTS_CARTESIAN_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/functor_properties.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/functor_properties.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/functor_properties.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/functor_properties.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/functor_tags.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/functor_tags.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/functor_tags.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/functor_tags.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/static_int.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/static_int.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/static_int.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/static_int.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/store_kernel.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/store_kernel.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/store_kernel.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/store_kernel.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/utils.h b/3rdparty/CGAL/include/CGAL/NewKernel_d/utils.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/NewKernel_d/utils.h
rename to 3rdparty/CGAL/include/CGAL/NewKernel_d/utils.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Null_matrix.h b/3rdparty/CGAL/include/CGAL/Null_matrix.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Null_matrix.h
rename to 3rdparty/CGAL/include/CGAL/Null_matrix.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Number_type_checker.h b/3rdparty/CGAL/include/CGAL/Number_type_checker.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Number_type_checker.h
rename to 3rdparty/CGAL/include/CGAL/Number_type_checker.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Number_types/internal_functions_comparison_root_of_2.h b/3rdparty/CGAL/include/CGAL/Number_types/internal_functions_comparison_root_of_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Number_types/internal_functions_comparison_root_of_2.h
rename to 3rdparty/CGAL/include/CGAL/Number_types/internal_functions_comparison_root_of_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/OFF_to_nef_3.h b/3rdparty/CGAL/include/CGAL/OFF_to_nef_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/OFF_to_nef_3.h
rename to 3rdparty/CGAL/include/CGAL/OFF_to_nef_3.h
diff --git a/3rdparty/CGAL/include/CGAL/OTR_2/Cost.h b/3rdparty/CGAL/include/CGAL/OTR_2/Cost.h
new file mode 100644
index 0000000..0417579
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/OTR_2/Cost.h
@@ -0,0 +1,110 @@
+// Copyright (c) 2014  INRIA Sophia-Antipolis (France), INRIA Lorraine LORIA.
+// 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
+// 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(s)     : Fernando de Goes, Pierre Alliez, Ivo Vigan, Clément Jamin
+
+#ifndef CGAL_OTR2_COST_H_
+#define CGAL_OTR2_COST_H_
+
+#include <algorithm>
+
+namespace CGAL {
+namespace OTR_2 {
+
+template <class FT>
+class Cost
+{
+private:
+  FT m_norm;
+  FT m_tang;
+  FT m_max_norm;
+  FT m_max_tang;
+
+public:
+  Cost()
+  : m_norm(0),
+    m_tang(0),
+    m_max_norm(0),
+    m_max_tang(0)
+  {}
+
+  Cost(const FT norm, const FT tang)
+  : m_norm(norm),
+    m_tang(tang),
+    m_max_norm(norm),
+    m_max_tang(tang)
+  {}
+
+  ~Cost() {}
+
+  Cost& operator= (const Cost& cost)
+  {
+    m_norm = cost.norm();
+    m_tang = cost.tang();
+    m_max_norm = cost.max_norm();
+    m_max_tang = cost.max_tang();
+    return *this;
+  }
+
+  const FT norm() const { return m_norm; }
+
+  const FT tang() const { return m_tang; }
+
+  const FT max_norm() const { return m_max_norm; }
+
+  const FT max_tang() const { return m_max_tang; }
+
+  FT finalize(const FT alpha = FT(0.5)) const
+  {
+    return FT(2) * (alpha * m_norm + (FT(1) - alpha) * m_tang);
+  }
+
+  void divide(const FT ratio)
+  {
+    CGAL_assertion(ratio != FT(0));
+    m_norm /= ratio;
+    m_tang /= ratio;
+  }
+
+  void add(const Cost& cost, const FT mass = FT(1))
+  {
+    m_norm += mass * cost.norm();
+    m_tang += mass * cost.tang();
+  }
+
+  void reset_max()
+  {
+    m_max_norm = FT(0);
+    m_max_tang = FT(0);
+  }
+
+  void update_max(const Cost& cost)
+  {
+    m_max_norm = (std::max)(m_max_norm, cost.max_norm());
+    m_max_tang = (std::max)(m_max_tang, cost.max_tang());
+  }
+
+  void compute_max(const FT norm, const FT tang)
+  {
+    m_max_norm = (std::max)(m_max_norm, norm);
+    m_max_tang = (std::max)(m_max_tang, tang);
+  }
+};
+
+} } // namespaces
+
+#endif // CGAL_OTR2_COST_H_
diff --git a/3rdparty/CGAL/include/CGAL/OTR_2/Reconstruction_edge_2.h b/3rdparty/CGAL/include/CGAL/OTR_2/Reconstruction_edge_2.h
new file mode 100644
index 0000000..1a30911
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/OTR_2/Reconstruction_edge_2.h
@@ -0,0 +1,144 @@
+// Copyright (c) 2014  INRIA Sophia-Antipolis (France), INRIA Lorraine LORIA.
+// 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
+// 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(s)     : Fernando de Goes, Pierre Alliez, Ivo Vigan, Clément Jamin
+
+#ifndef CGAL_RECONSTRUCTION_EDGE_2_H_
+#define CGAL_RECONSTRUCTION_EDGE_2_H_
+
+namespace CGAL {
+namespace OTR_2 {
+
+template<class FT, class Edge, class Vertex_handle, class Face_handle>
+class Reconstruction_edge_2 {
+protected:
+  Edge m_edge;
+  Vertex_handle m_source;
+  Vertex_handle m_target;
+
+  FT m_before_cost;
+  FT m_after_cost;
+
+public:
+  Reconstruction_edge_2() 
+  : m_edge(Face_handle(), 0),
+    m_before_cost(0),
+    m_after_cost(0)
+  {}
+
+  Reconstruction_edge_2(const Reconstruction_edge_2& pedge) 
+  : m_edge(pedge.edge()),
+    m_source(pedge.source()),
+    m_target(pedge.target()),
+    m_before_cost(pedge.before()),
+    m_after_cost(pedge.after())
+  {}
+
+  Reconstruction_edge_2(const Edge& edge, const FT before, const FT after)
+  : m_edge(edge),
+    m_before_cost(before),
+    m_after_cost(after)
+  {
+    get_vertices();
+  }
+
+  Reconstruction_edge_2(const Edge& edge, const FT priority = FT(0))
+  : m_edge(edge),
+    m_before_cost(0),
+    m_after_cost(priority)
+  {
+    get_vertices(); 
+  }
+
+  Reconstruction_edge_2(Vertex_handle source, Vertex_handle target)
+  : m_edge(Face_handle(), 0),
+    m_source(source),
+    m_target(target),
+    m_before_cost(0),
+    m_after_cost(0)
+  {}
+
+  Reconstruction_edge_2& operator= (const Reconstruction_edge_2& pedge)
+  {
+    m_edge = pedge.edge();
+    m_source = pedge.source();
+    m_target = pedge.target();
+    m_before_cost = pedge.before();
+    m_after_cost = pedge.after();
+
+    return *this;
+  }
+
+  bool operator== (const Reconstruction_edge_2& pedge) const
+  {
+    return (m_source->id() == pedge.source()->id()
+      && m_target->id() == pedge.target()->id());
+  }
+
+  bool operator< (const Reconstruction_edge_2& pedge) const 
+  {
+    if (m_source->id() < pedge.source()->id())
+      return true;
+    if (m_source->id() > pedge.source()->id())
+      return false;
+    if (m_target->id() < pedge.target()->id())
+      return true;
+    return false;
+  }
+
+  const Edge& edge() const
+  {
+    return m_edge;
+  }
+
+  const Vertex_handle& source() const
+  {
+    return m_source;
+  }
+
+  const Vertex_handle& target() const
+  {
+    return m_target;
+  }
+
+  const FT before() const
+  {
+    return m_before_cost;
+  }
+
+  const FT after() const
+  {
+    return m_after_cost;
+  }
+
+  const FT priority() const
+  {
+    return after() - before();
+  }
+
+protected:
+  void get_vertices()
+  {
+    int index = m_edge.second;
+    m_source = m_edge.first->vertex((index + 1) % 3);
+    m_target = m_edge.first->vertex((index + 2) % 3);
+  }
+};
+
+} } // namespace
+
+#endif // CGAL_RECONSTRUCTION_EDGE_2_H_
diff --git a/3rdparty/CGAL/include/CGAL/OTR_2/Reconstruction_face_base_2.h b/3rdparty/CGAL/include/CGAL/OTR_2/Reconstruction_face_base_2.h
new file mode 100644
index 0000000..fe3fd39
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/OTR_2/Reconstruction_face_base_2.h
@@ -0,0 +1,266 @@
+// Copyright (c) 2014  INRIA Sophia-Antipolis (France), INRIA Lorraine LORIA.
+// 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
+// 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(s)     : Fernando de Goes, Pierre Alliez, Ivo Vigan, Clément Jamin
+
+#ifndef CGAL_RECONSTRUCTION_FACE_BASE_2_H_
+#define CGAL_RECONSTRUCTION_FACE_BASE_2_H_
+
+#include <CGAL/OTR_2/Cost.h>
+#include <CGAL/OTR_2/Sample.h>
+#include <CGAL/Triangulation_face_base_2.h>
+
+#include <vector>
+
+/// \cond SKIP_IN_MANUAL
+
+namespace CGAL {
+namespace OTR_2 {
+
+/// The Reconstruction_face_base_2 class is the default
+/// vertex class of the Reconstruction_face_base_2 class.
+///
+/// - Each vertex stores a CSample as well as the corresponding relocated point
+///
+/// @param Traits_  Traits class
+/// @param Vb       Vertex base class, model of TriangulationFaceBase_2.
+template < class Traits_, class Fb = Triangulation_face_base_2<Traits_> >
+class Reconstruction_face_base_2 : public Fb
+{
+public:
+  typedef Fb                            Base;
+  typedef typename Base::Vertex_handle  Vertex_handle;
+  typedef typename Base::Face_handle    Face_handle;
+
+  template < typename TDS2 >
+  struct Rebind_TDS 
+  {
+    typedef typename Base::template Rebind_TDS<TDS2>::Other   Fb2;
+    typedef Reconstruction_face_base_2<Traits_,Fb2>           Other;
+  };
+
+  typedef typename Traits_::FT    FT;
+  typedef OTR_2::Cost<FT>          Cost_;
+  typedef OTR_2::Sample<Traits_>   Sample_;
+  typedef std::vector<Sample_*>   Sample_vector;
+
+private:
+  Sample_vector m_samples[3];
+  FT m_mass[3];
+
+  Cost_ m_cost0[3];
+  Cost_ m_cost1[3];
+  int   m_plan[3];
+
+  FT m_relevance[3];
+
+public:
+  Reconstruction_face_base_2()
+  {
+    init();
+  }
+
+  Reconstruction_face_base_2(
+    Vertex_handle v1, Vertex_handle v2, Vertex_handle v3)
+  : Base(v1, v2, v3)
+  {
+    init();
+  }
+
+  Reconstruction_face_base_2(
+    Vertex_handle v1, Vertex_handle v2, Vertex_handle v3,
+    Face_handle f1, Face_handle f2, Face_handle f3)
+  : Base(v1, v2, v3, f1, f2, f3)
+  {
+    init();
+  }
+
+  Reconstruction_face_base_2(Face_handle f)
+  : Base(f)
+  {
+    m_samples[0] = f->samples(0);
+    m_samples[1] = f->samples(1);
+    m_samples[2] = f->samples(2);
+
+    m_mass[0] = f->mass(0);
+    m_mass[1] = f->mass(1);
+    m_mass[2] = f->mass(2);
+
+    m_cost0[0] = f->vertex_cost(0);
+    m_cost0[1] = f->vertex_cost(1);
+    m_cost0[2] = f->vertex_cost(2);
+
+    m_cost1[0] = f->edge_cost(0);
+    m_cost1[1] = f->edge_cost(1);
+    m_cost1[2] = f->edge_cost(2);
+
+    m_plan[0] = f->plan(0);
+    m_plan[1] = f->plan(1);
+    m_plan[2] = f->plan(2);
+
+    m_relevance[0] = f->relevance(0);
+    m_relevance[1] = f->relevance(1);
+    m_relevance[2] = f->relevance(2);
+  }
+
+  ~Reconstruction_face_base_2()
+  {
+    clean_all_samples();
+  }
+
+  void init()
+  {
+    m_mass[0] = FT(0);
+    m_mass[1] = FT(0);
+    m_mass[2] = FT(0);
+
+    m_cost0[0] = Cost_();
+    m_cost0[1] = Cost_();
+    m_cost0[2] = Cost_();
+
+    m_cost1[0] = Cost_();
+    m_cost1[1] = Cost_();
+    m_cost1[2] = Cost_();
+
+    m_plan[0] = 0;
+    m_plan[1] = 0;
+    m_plan[2] = 0;
+
+    m_relevance[0] = 0;
+    m_relevance[1] = 0;
+    m_relevance[2] = 0;
+
+  }
+
+  int plan(int edge) const { return m_plan[edge]; }
+  int& plan(int edge) { return m_plan[edge]; }
+
+  const FT& mass(int edge) const { return m_mass[edge]; }
+  FT& mass(int edge) { return m_mass[edge]; }
+
+  const Cost_& vertex_cost(int edge) const { return m_cost0[edge]; }
+  Cost_& vertex_cost(int edge) { return m_cost0[edge]; }
+
+  const Cost_& edge_cost(int edge) const { return m_cost1[edge]; }
+  Cost_& edge_cost(int edge) { return m_cost1[edge]; }
+
+  const FT& relevance(int edge) const { return m_relevance[edge]; }
+  FT& relevance(int edge) { return m_relevance[edge]; }
+
+
+  const Cost_& cost(int edge) const
+  {
+    if (plan(edge) == 0) 
+      return vertex_cost(edge);
+    return edge_cost(edge);
+  }
+
+  bool ghost(int edge) const
+  {
+    if (mass(edge) == FT(0))
+      return true;
+    if (plan(edge) == 0)
+      return true;
+    return false;
+  }
+
+  const Sample_vector& samples(int edge) const { return m_samples[edge]; }
+  Sample_vector& samples(int edge) { return m_samples[edge]; }
+
+  void add_sample(int edge, Sample_* sample)
+  {
+    m_samples[edge].push_back(sample);
+  }
+
+  void clean_samples(int edge)
+  {
+    m_samples[edge].clear();
+  }
+
+  void clean_all_samples()
+  {
+    for (int i = 0; i < 3; ++i)
+      clean_samples(i);
+  }
+};
+
+//---------------STRUCT LESS FACE_HANDLE---------------------
+template <class T>
+struct less_Face_handle
+{
+  void get_vertices_id(const T& face, int& a, int& b, int& c) const
+  {
+    a = face->vertex(0)->id();
+    b = face->vertex(1)->id();
+    c = face->vertex(2)->id();
+  }
+
+  bool operator() (const T& a, const T& b) const
+  {
+    int a0, a1, a2;
+    get_vertices_id(a, a0, a1, a2);
+
+    int b0, b1, b2;
+    get_vertices_id(b, b0, b1, b2);
+
+    if (a0 < b0) return true;
+    if (a0 > b0) return false;
+
+    if (a1 < b1) return true;
+    if (a1 > b1) return false;
+
+    if (a2 < b2) return true;
+
+    return false;
+  }
+};
+
+
+//---------------STRUCT LESS EDGE---------------------
+template <class T>
+struct less_Edge
+{
+  void get_vertices_id(const T& a, int& i, int& j) const
+  {
+    i = a.first->vertex( (a.second+1)%3 )->id();
+    j = a.first->vertex( (a.second+2)%3 )->id();
+    if (i > j) std::swap(i, j);
+  }
+
+  bool operator() (const T& a, const T& b) const
+  {
+    int a0, a1;
+    get_vertices_id(a, a0, a1);
+
+    int b0, b1;
+    get_vertices_id(b, b0, b1);
+
+    if (a0 < b0) return true;
+    if (a0 > b0) return false;
+    if (a1 < b1) return true;
+
+    return false;
+  }
+
+
+  /// \endcond
+
+};
+
+} } //end namespace
+
+#endif // CGAL_RECONSTRUCTION_FACE_BASE_2_H_
diff --git a/3rdparty/CGAL/include/CGAL/OTR_2/Reconstruction_triangulation_2.h b/3rdparty/CGAL/include/CGAL/OTR_2/Reconstruction_triangulation_2.h
new file mode 100644
index 0000000..1c1b5d6
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/OTR_2/Reconstruction_triangulation_2.h
@@ -0,0 +1,1124 @@
+// Copyright (c) 2014  INRIA Sophia-Antipolis (France), INRIA Lorraine LORIA.
+// 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
+// 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(s)     : Fernando de Goes, Pierre Alliez, Ivo Vigan, Clément Jamin
+
+#ifndef CGAL_RECONSTRUCTION_TRIANGULATION_2_H
+#define CGAL_RECONSTRUCTION_TRIANGULATION_2_H
+
+// local
+#include <CGAL/OTR_2/Sample.h>
+#include <CGAL/OTR_2/Reconstruction_edge_2.h>
+#include <CGAL/OTR_2/Cost.h>
+#include <CGAL/OTR_2/Reconstruction_vertex_base_2.h>
+#include <CGAL/OTR_2/Reconstruction_face_base_2.h>
+
+// CGAL
+#include <CGAL/basic.h>
+#include <CGAL/Random.h>
+#include <CGAL/intersections.h>
+#include <CGAL/Delaunay_triangulation_2.h>
+
+// boost
+#include <boost/multi_index/mem_fun.hpp>
+#include <boost/multi_index_container.hpp>
+#include <boost/multi_index/ordered_index.hpp>
+#include <boost/multi_index/identity.hpp>
+#include <boost/multi_index/member.hpp>
+#include <boost/container/deque.hpp>
+#include <boost/optional.hpp>
+
+// STL
+#include <map>
+#include <set>
+#include <vector>
+#include <queue>
+#include <iostream>
+
+#define CGAL_EPS   1e-15
+
+namespace CGAL {
+namespace OTR_2 {
+
+/// \internal
+///  The Reconstruction_triangulation_2 class
+///  provides the reconstruction simplex as well as the transportation plan.
+/// - Each vertex stores a normal vector.
+/// - A vertex a Sample which got assigned to it by the transportation plan,
+///   well as the corresponding relocated Point (of type Traits_::Point_2).
+/// - In order to solve a linear system over the triangulation, a vertex may be constrained
+///   or not (i.e. may contribute to the right or left member of the linear system),
+///   and has a unique index.
+/// The vertex class must derive from Reconstruction_vertex_base_3.
+///
+///  @param Traits_   The traits class
+///  @param Tds       Model of TriangulationDataStructure_2.
+///  The vertex class must derive from Reconstruction_vertex_base_2.
+///  The face   class must derive from Reconstruction_face_base_2.
+template<
+  class Traits_,
+  class Tds_ = Triangulation_data_structure_2<
+  Reconstruction_vertex_base_2<Traits_>,
+  Reconstruction_face_base_2<Traits_> > >
+class Reconstruction_triangulation_2
+  : public Delaunay_triangulation_2<Traits_, Tds_> 
+{
+public:
+
+  typedef Delaunay_triangulation_2<Traits_, Tds_> Base;
+
+  typedef typename Traits_::FT FT;
+  typedef typename Traits_::Point_2 Point;
+  typedef typename Traits_::Vector_2 Vector;
+  typedef typename Traits_::Line_2 Line;
+  typedef typename Traits_::Segment_2 Segment;
+  typedef typename Traits_::Triangle_2 Triangle;
+
+  typedef typename Base::Vertex Vertex;
+  typedef typename Base::Vertex_handle Vertex_handle;
+  typedef typename Base::Vertex_iterator Vertex_iterator;
+  typedef typename Base::Vertex_circulator Vertex_circulator;
+  typedef typename Base::Finite_vertices_iterator Finite_vertices_iterator;
+
+  typedef typename Base::Edge Edge;
+  typedef typename Base::Edge_circulator Edge_circulator;
+  typedef typename Base::Finite_edges_iterator Finite_edges_iterator;
+
+  typedef typename Base::Face_handle Face_handle;
+  typedef typename Base::Face_circulator Face_circulator;
+  typedef typename Base::Finite_faces_iterator Finite_faces_iterator;
+
+  typedef std::map<Vertex_handle, Vertex_handle,
+      less_Vertex_handle<Vertex_handle> > Vertex_handle_map;
+  typedef std::map<Face_handle, Face_handle, 
+                   less_Face_handle<Face_handle> > Face_handle_map;
+
+  typedef std::set<Vertex_handle, 
+                   less_Vertex_handle<Vertex_handle> > Vertex_handle_set;
+  typedef std::set<Edge, less_Edge<Edge> > Edge_set;
+
+  typedef std::vector<Edge> Edge_vector;
+
+  typedef OTR_2::Cost<FT> Cost_;
+  typedef OTR_2::Sample<Traits_> Sample_;
+  typedef std::vector<Sample_*> Sample_vector;
+  typedef typename Sample_vector::const_iterator Sample_vector_const_iterator;
+
+  typedef OTR_2::Sample_with_priority<Sample_> PSample;
+  typedef std::priority_queue<PSample, boost::container::deque<PSample>,
+      OTR_2::greater_priority<PSample> > SQueue;
+
+  typedef Reconstruction_edge_2<FT, Edge, 
+                                Vertex_handle, Face_handle> Rec_edge_2;
+
+  using Base::geom_traits;
+
+  typedef boost::multi_index_container<
+      Rec_edge_2,
+      boost::multi_index::indexed_by<
+      // sort by Rec_edge_2::operator<
+      boost::multi_index::ordered_unique< boost::multi_index::identity<
+      Rec_edge_2 > > ,
+      // sort by Rec_edge_2::priority()
+      boost::multi_index::ordered_non_unique<
+      boost::multi_index::const_mem_fun<
+      Rec_edge_2,const FT,&Rec_edge_2::priority> >
+  >
+  > MultiIndex;
+
+  FT m_factor; // ghost vs solid
+
+
+public:
+  Reconstruction_triangulation_2(Traits_ traits = Traits_())
+  : Base(traits), m_factor(1.)
+  {
+  }
+
+  ~Reconstruction_triangulation_2() {
+  }
+
+  FT& ghost_factor() {
+    return m_factor;
+  }
+
+  FT ghost_factor() const {
+    return m_factor;
+  }
+
+  Edge random_finite_edge() const {
+    static CGAL::Random rng;
+    std::size_t nbf = Base::number_of_faces();
+    int offset = rng.get_int(0, static_cast<int>(nbf - 1));
+    Finite_faces_iterator fi = Base::finite_faces_begin();
+    for (int i = 0; i < offset; i++)
+      fi++;
+    Face_handle face = fi;
+    int index = rng.get_int(0, 40) % 3;
+    return Edge(face, index);
+  }
+
+  // ACCESS //
+
+  Vertex_handle source_vertex(const Edge& edge) const {
+    return edge.first->vertex(Base::ccw(edge.second));
+  }
+
+  Vertex_handle target_vertex(const Edge& edge) const {
+    return edge.first->vertex(Base::cw(edge.second));
+  }
+
+  Vertex_handle opposite_vertex(const Edge& edge) const {
+    return edge.first->vertex(edge.second);
+  }
+
+  bool is_pinned(const Edge& edge) const {
+    Vertex_handle s = source_vertex(edge);
+    if (s->pinned())
+      return true;
+    return false;
+  }
+
+  Edge twin_edge(const Edge& edge) const {
+    Face_handle f = edge.first;
+    Vertex_handle v = source_vertex(edge);
+    Face_handle nf = f->neighbor(edge.second);
+    return Edge(nf, Base::ccw(nf->index(v)));
+  }
+
+  Edge next_edge(const Edge& edge) const {
+    Face_handle f = edge.first;
+    int index = Base::ccw(edge.second);
+    return Edge(f, index);
+  }
+
+  Edge prev_edge(const Edge& edge) const {
+    Face_handle f = edge.first;
+    int index = Base::cw(edge.second);
+    return Edge(f, index);
+  }
+
+  FT get_length(const Edge& edge) const {
+    Segment segment = get_segment(edge);
+    return CGAL::approximate_sqrt(segment.squared_length());
+  }
+
+  Segment get_segment(const Edge& edge) const {
+    const Point& ps = source_vertex(edge)->point();
+    const Point& pt = target_vertex(edge)->point();
+    return geom_traits().construct_segment_2_object()(ps, pt);
+  }
+
+  Triangle get_triangle(Face_handle face) const {
+    Vertex_handle v0 = face->vertex(0);
+    Vertex_handle v1 = face->vertex(1);
+    Vertex_handle v2 = face->vertex(2);
+    return geom_traits().construct_triangle_2_object()(
+      v0->point(), v1->point(), v2->point());
+  }
+
+  // GET LINK //
+
+  void get_vertices_from_edge_link(const Edge& edge,
+      Vertex_handle_set& vertices) const {
+    vertices.insert(opposite_vertex(edge));
+    vertices.insert(opposite_vertex(twin_edge(edge)));
+  }
+
+  void get_vertices_from_vertex_link(Vertex_handle vertex,
+      Vertex_handle_set& vertices) const {
+    Vertex_circulator vcirc = Base::incident_vertices(vertex);
+    Vertex_circulator vend = vcirc;
+    CGAL_For_all(vcirc, vend)
+    {
+      Vertex_handle v = vcirc;
+      vertices.insert(v);
+    }
+  }
+
+  // boundary of star(vertex)
+  // 'outward' chooses the orientation of the boundary
+  void get_edges_from_star_minus_link(Vertex_handle vertex, Edge_vector& hull,
+      bool outward = false) const {
+    Face_circulator fcirc = Base::incident_faces(vertex);
+    Face_circulator fend = fcirc;
+    CGAL_For_all(fcirc, fend)
+    {
+      Face_handle face = fcirc;
+      int index = face->index(vertex);
+      Edge edge(face, index);
+      if (outward)
+        edge = twin_edge(edge);
+      hull.push_back(edge);
+    }
+  }
+
+  // ATTRIBUTES //
+
+  bool is_ghost(const Edge& edge) const {
+    return edge.first->ghost(edge.second);
+  }
+
+  int get_plan(const Edge& edge) const {
+    return edge.first->plan(edge.second);
+  }
+
+  void set_plan(const Edge& edge, int simplex) const {
+    edge.first->plan(edge.second) = simplex;
+  }
+
+  FT get_mass(const Edge& edge) const {
+    return edge.first->mass(edge.second);
+  }
+
+  void set_mass(const Edge& edge, const FT mass) const {
+    edge.first->mass(edge.second) = mass;
+  }
+
+  const Cost_& get_cost(const Edge& edge) const {
+    return edge.first->cost(edge.second);
+  }
+
+  void set_vertex_cost(const Edge& edge, const Cost_& cost) const {
+    edge.first->vertex_cost(edge.second) = cost;
+  }
+
+  void set_edge_cost(const Edge& edge, const Cost_& cost) const {
+    edge.first->edge_cost(edge.second) = cost;
+  }
+
+  FT get_vertex_minus_edge_cost(const Edge& edge) const {
+    const Cost_& vcost = edge.first->vertex_cost(edge.second);
+    const Cost_& ecost = edge.first->edge_cost(edge.second);
+    return vcost.finalize() - m_factor * ecost.finalize();
+  }
+
+  FT get_vertex_over_edge_cost(const Edge& edge) const {
+    FT vvalue = edge.first->vertex_cost(edge.second).finalize();
+    FT evalue = edge.first->edge_cost(edge.second).finalize();
+    if (evalue == vvalue)
+      return FT(1) / m_factor;
+    return vvalue / (m_factor * evalue);
+  }
+
+  FT get_edge_relevance(const Edge& edge) const {
+    FT M = get_mass(edge);
+    if (M == FT(0))
+      return FT(0);
+
+    FT L = get_length(edge);
+    FT cost = get_cost(edge).finalize();
+    return M * L * L / cost;
+  }
+
+  FT get_density(const Edge& edge) const {
+    FT length = get_length(edge);
+    FT mass = get_mass(edge);
+    return (mass / length);
+  }
+
+  unsigned int nb_samples(const Edge& edge) const {
+    Edge twin = twin_edge(edge);
+    return edge.first->samples(edge.second).size()
+      + twin.first->samples(twin.second).size();
+  }
+
+  void collect_samples_from_edge(
+    const Edge& edge, Sample_vector& samples) const 
+  {
+    const Sample_vector& edge_samples = edge.first->samples(edge.second);
+    samples.insert(samples.end(), edge_samples.begin(), edge_samples.end());
+  }
+
+  void collect_samples_from_vertex(
+    Vertex_handle vertex, Sample_vector& samples, bool cleanup) const 
+  {
+    Face_circulator fcirc = Base::incident_faces(vertex);
+    Face_circulator fend = fcirc;
+    CGAL_For_all(fcirc, fend)
+    {
+      Face_handle face = fcirc;
+      int index = face->index(vertex);
+
+      Edge edge(face, index);
+      collect_samples_from_edge(edge, samples);
+
+      Edge next = next_edge(edge);
+      collect_samples_from_edge(next, samples);
+
+      Edge prev = prev_edge(edge);
+      collect_samples_from_edge(prev, samples);
+
+      if (cleanup)
+        face->clean_all_samples();
+    }
+    Sample_* sample = vertex->sample();
+    if (sample)
+      samples.push_back(sample);
+    if (cleanup)
+      vertex->set_sample(NULL);
+  }
+
+  void collect_all_samples(Sample_vector& samples) const {
+    for (Finite_edges_iterator ei = Base::finite_edges_begin();
+        ei != Base::finite_edges_end(); ++ei) {
+      Edge edge = *ei;
+      Edge twin = twin_edge(edge);
+      collect_samples_from_edge(edge, samples);
+      collect_samples_from_edge(twin, samples);
+    }
+    for (Finite_vertices_iterator vi = Base::finite_vertices_begin();
+        vi != Base::finite_vertices_end(); ++vi) {
+      Vertex_handle v = vi;
+      Sample_* sample = v->sample();
+      if (sample)
+        samples.push_back(sample);
+    }
+  }
+
+  void cleanup_assignments() {
+    for (Finite_faces_iterator fi = Base::finite_faces_begin();
+        fi != Base::finite_faces_end(); ++fi) {
+      fi->clean_all_samples();
+    }
+    for (Finite_vertices_iterator vi = Base::finite_vertices_begin();
+        vi != Base::finite_vertices_end(); ++vi) {
+      vi->set_sample(NULL);
+    }
+  }
+
+  // COST //
+
+  Cost_ compute_total_cost() const {
+    Cost_ sum;
+    for (Finite_edges_iterator ei = Base::finite_edges_begin();
+        ei != Base::finite_edges_end(); ++ei) {
+      Edge edge = *ei;
+      const Cost_& cost = get_cost(edge);
+      sum.update_max(cost);
+      sum.add(cost);
+    }
+    return sum;
+  }
+
+  Cost_ compute_cost_around_vertex(Vertex_handle vertex) const {
+    Cost_ inner;
+    Cost_ outer;
+    Face_circulator fcirc = Base::incident_faces(vertex);
+    Face_circulator fend = fcirc;
+    CGAL_For_all(fcirc, fend)
+    {
+      Face_handle face = fcirc;
+      int index = face->index(vertex);
+
+      Edge edge(face, index);
+      Cost_ cost = get_cost(edge);
+      outer.update_max(cost);
+      outer.add(cost);
+
+      edge = next_edge(edge);
+      cost = get_cost(edge);
+      inner.update_max(cost);
+      inner.add(cost);
+
+      edge = next_edge(edge);
+      cost = get_cost(edge);
+      inner.update_max(cost);
+      inner.add(cost);
+    }
+    inner.divide(2.0);
+
+    Cost_ sum;
+    sum.add(inner);
+    sum.add(outer);
+    sum.update_max(inner);
+    sum.update_max(outer);
+    return sum;
+  }
+
+  void reset_all_costs() {
+    for (Finite_edges_iterator ei = Base::finite_edges_begin();
+        ei != Base::finite_edges_end(); ++ei) {
+      Edge edge = *ei;
+      update_cost(edge);
+    }
+  }
+
+  void update_cost(const Edge& edge) {
+    compute_mass(edge);
+    compute_edge_cost(edge);
+    compute_vertex_cost(edge);
+    select_plan(edge);
+  }
+
+  void compute_mass(const Edge& edge) const {
+    FT mass = 0;
+
+    typename Sample_vector::const_iterator it;
+    const Sample_vector& samples0 = edge.first->samples(edge.second);
+    for (it = samples0.begin(); it != samples0.end(); ++it) {
+      Sample_* sample = *it;
+      mass += sample->mass();
+    }
+
+    Edge twin = twin_edge(edge);
+    const Sample_vector& samples1 = twin.first->samples(twin.second);
+    for (it = samples1.begin(); it != samples1.end(); ++it) {
+      Sample_* sample = *it;
+      mass += sample->mass();
+    }
+
+    set_mass(edge, mass);
+    set_mass(twin, mass);
+  }
+
+  void select_plan(const Edge& edge) const {
+    // transport plan:
+    // 0 - to vertex
+    // 1 - to edge
+
+    int plan = 0;
+    FT diff = get_vertex_minus_edge_cost(edge);
+    if (diff >= 0.0)
+      plan = 1;
+
+    Edge twin = twin_edge(edge);
+    set_plan(edge, plan);
+    set_plan(twin, plan);
+  }
+
+  void compute_edge_cost(const Edge& edge) const {
+    SQueue squeue;
+    FT M = get_mass(edge);
+    FT L = get_length(edge);
+    sort_samples_from_edge(edge, squeue);
+    Cost_ cost = compute_cost_from_squeue(squeue, M, L);
+
+    Edge twin = twin_edge(edge);
+    set_edge_cost(edge, cost);
+    set_edge_cost(twin, cost);
+  }
+
+  void sort_samples_from_edge(const Edge& edge, SQueue& squeue) const {
+    typename Sample_vector::const_iterator it;
+    const Sample_vector& samples0 = edge.first->samples(edge.second);
+    for (it = samples0.begin(); it != samples0.end(); ++it) {
+      Sample_* sample = *it;
+      squeue.push(PSample(sample, sample->coordinate()));
+    }
+
+    Edge twin = twin_edge(edge);
+    const Sample_vector& samples1 = twin.first->samples(twin.second);
+    for (it = samples1.begin(); it != samples1.end(); ++it) {
+      Sample_* sample = *it;
+      squeue.push(PSample(sample, 1.0 - sample->coordinate()));
+    }
+  }
+
+  Cost_ compute_cost_from_squeue(SQueue& squeue, const FT M, const FT L) const
+  {
+    if (squeue.empty())
+      return Cost_();
+    if (M == FT(0))
+      return Cost_();
+
+    Cost_ sum;
+    FT start = 0;
+    FT coef = L / M;
+    while (!squeue.empty()) {
+      PSample psample = squeue.top();
+      squeue.pop();
+
+      FT mass = psample.sample()->mass();
+      FT coord = psample.priority() * L;
+      FT bin = mass * coef;
+      FT center = start + FT(0.5) * bin;
+      FT pos = coord - center;
+
+      FT norm2 = psample.sample()->distance2();
+      FT tang2 = bin * bin / 12 + pos * pos;
+
+      sum.add(Cost_(norm2, tang2), mass);
+      sum.compute_max(norm2, tang2);
+
+      start += bin;
+    }
+    return sum;
+  }
+
+  void compute_vertex_cost(const Edge& edge) const {
+    Edge twin = twin_edge(edge);
+    const Point& ps = source_vertex(edge)->point();
+    const Point& pt = target_vertex(edge)->point();
+
+    Sample_vector samples;
+    collect_samples_from_edge(edge, samples);
+    collect_samples_from_edge(twin, samples);
+
+    Cost_ sum;
+    for (Sample_vector_const_iterator it = samples.begin();
+        it != samples.end(); ++it) {
+      Sample_* sample = *it;
+      FT mass = sample->mass();
+      const Point& query = sample->point();
+
+      FT Ds = geom_traits().compute_squared_distance_2_object()(query, ps);
+      FT Dt = geom_traits().compute_squared_distance_2_object()(query, pt);
+      FT dist2 = ((std::min))(Ds, Dt);
+
+      FT norm2 = sample->distance2();
+      FT tang2 = dist2 - norm2;
+
+      sum.add(Cost_(norm2, tang2), mass);
+      sum.compute_max(norm2, tang2);
+    }
+    set_vertex_cost(edge, sum);
+    set_vertex_cost(twin, sum);
+  }
+
+  // SAMPLE //
+
+  template<class Iterator> // value_type = Sample_*
+  void assign_samples(Iterator begin, Iterator end) {
+    for (Iterator it = begin; it != end; ++it) {
+      Sample_* sample = *it;
+      assign_sample(sample);
+    }
+  }
+
+  template<class Iterator> // value_type = Sample_*
+  void assign_samples_brute_force(Iterator begin, Iterator end) {
+    for (Iterator it = begin; it != end; ++it) {
+      Sample_* sample = *it;
+      assign_sample_brute_force(sample);
+    }
+  }
+
+  bool assign_sample(Sample_* sample) {
+    const Point& point = sample->point();
+    Face_handle face = Base::locate(point);
+
+    if (face == Face_handle() || Base::is_infinite(face)) {
+      //std::cout << "free bird" << std::endl;
+      return false;
+    }
+
+    Vertex_handle vertex = find_nearest_vertex(point, face);
+    if (vertex != Vertex_handle()) {
+      assign_sample_to_vertex(sample, vertex);
+      return true;
+    }
+
+    Edge edge = find_nearest_edge(point, face);
+    assign_sample_to_edge(sample, edge);
+    return true;
+  }
+
+  bool assign_sample_brute_force(Sample_* sample) {
+    const Point& point = sample->point();
+    Face_handle nearest_face = Face_handle();
+    for (Finite_faces_iterator fi = Base::finite_faces_begin();
+        fi != Base::finite_faces_end(); ++fi) {
+      Face_handle face = fi;
+      if (face_has_point(face, point)) {
+        nearest_face = face;
+        break;
+      }
+    }
+
+    if (nearest_face == Face_handle()) {
+      //std::cout << "free bird" << std::endl;
+      return false;
+    }
+
+    Vertex_handle vertex = find_nearest_vertex(point, nearest_face);
+    if (vertex != Vertex_handle()) {
+      assign_sample_to_vertex(sample, vertex);
+      return true;
+    }
+
+    Edge edge = find_nearest_edge(point, nearest_face);
+    assign_sample_to_edge(sample, edge);
+    return true;
+  }
+
+  bool face_has_point(Face_handle face, const Point& query) const {
+    for (int i = 0; i < 3; ++i) {
+      Edge edge(face, i);
+      const Point& ps = source_vertex(edge)->point();
+      const Point& pt = target_vertex(edge)->point();
+      if (!compute_triangle_ccw(ps, pt, query))
+        return false;
+    }
+    return true;
+  }
+
+  Vertex_handle find_nearest_vertex(const Point& point, Face_handle face) const
+  {
+    for (int i = 0; i < 3; ++i) {
+      Vertex_handle vi = face->vertex(i);
+      const Point& pi = vi->point();
+      if (pi == point)
+        return vi;
+    }
+    return Vertex_handle();
+  }
+
+  Edge find_nearest_edge(const Point& point, Face_handle face) const {
+    Edge nearest(face, 0);
+    FT min_dist2 = compute_distance2(point, get_segment(nearest));
+    for (int i = 1; i < 3; ++i) {
+      Edge edge(face, i);
+      Segment segment = get_segment(edge);
+      FT dist2 = compute_distance2(point, segment);
+      if (dist2 < min_dist2) {
+        min_dist2 = dist2;
+        nearest = edge;
+      }
+    }
+
+    return nearest;
+  }
+
+  void assign_sample_to_vertex(Sample_* sample, Vertex_handle vertex) const {
+    /*if (vertex->sample()) {
+      std::cout << "assign to vertex: vertex already has sample"
+          << std::endl;
+    }*/
+
+    sample->distance2() = FT(0);
+    sample->coordinate() = FT(0);
+    vertex->set_sample(sample);
+  }
+
+  void assign_sample_to_edge(Sample_* sample, const Edge& edge) const {
+    Segment segment = get_segment(edge);
+    const Point& query = sample->point();
+    sample->distance2() = compute_distance2(query, segment);
+    sample->coordinate() = compute_coordinate(query, segment);
+    edge.first->add_sample(edge.second, sample);
+  }
+
+  FT compute_distance2(const Point& query, const Segment& segment) const {
+
+    if (geom_traits().orientation_2_object()(segment.source(), segment.target(), query) == COLLINEAR)
+      return FT(0);
+
+    Line line = geom_traits().construct_line_2_object()(segment);
+    return geom_traits().compute_squared_distance_2_object()(query, line);
+  }
+
+  FT compute_coordinate(const Point& q, const Segment& segment) const {
+    const Point& p0 = segment.source();
+    const Point& p1 = segment.target();
+    Vector p0p1 = geom_traits().construct_vector_2_object()(p0, p1);
+    Vector p0q  = geom_traits().construct_vector_2_object()(p0, q);
+    
+    FT t = geom_traits().compute_scalar_product_2_object()(p0q, p0p1)
+         / geom_traits().compute_scalar_product_2_object()(p0p1, p0p1);
+    return t; // [0,1]
+  }
+
+  // SIGNED DISTANCE //
+
+  // signed distance from line(a,b) to point t
+  FT signed_distance(Vertex_handle a, Vertex_handle b,
+      Vertex_handle t) const {
+    const Point& pa = a->point();
+    const Point& pb = b->point();
+    const Point& pt = t->point();
+    return compute_signed_distance(pa, pb, pt);
+  }
+
+  // signed distance from line(a,b) to point t
+  FT compute_signed_distance(
+    const Point& pa, const Point& pb, const Point& pt) const
+  {
+    if (pt == pa)
+      return FT(0);
+    if (pt == pb)
+      return FT(0);
+    if (pa == pb)
+      return CGAL::approximate_sqrt(geom_traits().compute_squared_distance_2_object()(pa, pt));
+
+    Vector vab = geom_traits().construct_vector_2_object()(pa, pb);
+    // Normalize vab
+    vab = geom_traits().construct_scaled_vector_2_object()(
+      vab,
+      FT(1) / CGAL::approximate_sqrt(geom_traits().compute_squared_length_2_object()(vab)));
+    Vector vab90 = geom_traits().construct_vector_2_object()(-vab.y(), vab.x());
+    Vector vat = geom_traits().construct_vector_2_object()(pa, pt);
+    return geom_traits().compute_scalar_product_2_object()(vat, vab90);
+  }
+
+  // signed distance from t to the intersection of line(a,b) and line(t,s)
+  // the pair::first is false if sign==-1 and true otherwise
+  std::pair<bool,boost::optional<FT> >
+  signed_distance_from_intersection(Vertex_handle a, Vertex_handle b,
+      Vertex_handle t, Vertex_handle s) const {
+    const Point& pa = a->point();
+    const Point& pb = b->point();
+    const Point& pt = t->point();
+    const Point& ps = s->point();
+    return compute_signed_distance_from_intersection(pa, pb, pt, ps);
+  }
+
+  // signed distance from t to the intersection of line(a,b) and line(t,s)
+  // the pair::first is false if sign==-1 and true otherwise
+  std::pair<bool,boost::optional<FT> >
+  compute_signed_distance_from_intersection(
+    const Point& pa, const Point& pb, const Point& pt, const Point& ps) const
+  {
+    FT Dabt = compute_signed_distance(pa, pb, pt);
+    if (Dabt == FT(0))
+      return std::make_pair(true,boost::make_optional(FT(0)));
+
+    Line lab = geom_traits().construct_line_2_object()(
+      pa, geom_traits().construct_vector_2_object()(pa, pb));
+    Line lts = geom_traits().construct_line_2_object()(
+      pt, geom_traits().construct_vector_2_object()(pt, ps));
+
+    boost::optional<FT> Dqt;
+    typename CGAL::cpp11::result_of<typename Traits_::Intersect_2(Line, Line)>::type
+      result = intersection(lab, lts);
+    if (result)
+    {
+      const Point* iq = boost::get<Point>(&(*result));
+      if (iq)
+        Dqt = CGAL::approximate_sqrt(geom_traits().compute_squared_distance_2_object()(*iq, pt));
+    }
+
+    return std::make_pair( (Dabt < FT(0) ? false : true) ,Dqt );
+  }
+
+  bool is_triangle_ccw(Vertex_handle a, Vertex_handle b, Vertex_handle c) const
+  {
+    const Point& pa = a->point();
+    const Point& pb = b->point();
+    const Point& pc = c->point();
+    return compute_triangle_ccw(pa, pb, pc);
+  }
+
+  bool compute_triangle_ccw(
+    const Point& pa, const Point& pb, const Point& pc) const
+  {
+    return geom_traits().orientation_2_object()(pa,pb,pc) != RIGHT_TURN;
+  }
+
+  // COMBINATORIAL TESTS //
+
+  // (a,b) is cyclic if (a,b,c) and (a,c,b) exist
+  bool is_edge_cyclic(const Edge& edge) const {
+    Vertex_handle f = opposite_vertex(edge);
+    Vertex_handle b = opposite_vertex(twin_edge(edge));
+    return (f == b);
+  }
+
+  // b from (a,b) is cyclic if (a,b,c) and (b,a,c) exist
+  bool is_target_cyclic(const Edge& edge) const {
+    if (!is_edge_cyclic(edge))
+      return false;
+
+    Edge twin = twin_edge(edge);
+    Edge prev = prev_edge(twin);
+    Face_handle fp = prev.first->neighbor(prev.second);
+    Face_handle ft = twin.first->neighbor(twin.second);
+    return (fp == ft);
+  }
+
+  bool is_flippable(const Edge& edge) const {
+    Edge twin = twin_edge(edge);
+    if (Base::is_infinite(twin.first))
+      return false;
+    if (Base::is_infinite(edge.first))
+      return false;
+
+    Vertex_handle vs = source_vertex(edge);
+    Vertex_handle vt = target_vertex(edge);
+    Vertex_handle vf = opposite_vertex(edge);
+    Vertex_handle vb = opposite_vertex(twin);
+
+    return is_triangle_ccw(vs, vb, vf) && is_triangle_ccw(vt, vf, vb);
+  }
+
+  bool is_collapsible(const Edge& edge) const {
+    return check_link_test(edge) && check_kernel_test(edge);
+  }
+
+  bool check_link_test(const Edge& edge) const {
+    Vertex_handle s = source_vertex(edge);
+    Vertex_handle t = target_vertex(edge);
+
+    if (s == t)
+      return false;
+    typename Vertex_handle_set::const_iterator it;
+
+    Vertex_handle_set svertices;
+    get_vertices_from_vertex_link(s, svertices);
+
+    Vertex_handle_set tvertices;
+    get_vertices_from_vertex_link(t, tvertices);
+
+    // link(s) inter link(t)
+    Vertex_handle_set ivertices;
+    for (it = svertices.begin(); it != svertices.end(); ++it) {
+      Vertex_handle v = *it;
+      if (tvertices.find(v) != tvertices.end())
+        ivertices.insert(v);
+    }
+
+    Vertex_handle_set evertices;
+    get_vertices_from_edge_link(edge, evertices);
+
+    // link(edge) =? link(s) inter link(t)
+    if (evertices.size() != ivertices.size())
+      return false;
+
+    for (it = evertices.begin(); it != evertices.end(); ++it) {
+      Vertex_handle v = *it;
+      if (ivertices.find(v) == ivertices.end())
+        return false;
+    }
+    return true;
+  }
+
+  bool check_kernel_test(const Edge& edge) const {
+    Vertex_handle s = source_vertex(edge);
+    Vertex_handle t = target_vertex(edge);
+
+    Edge_vector hull;
+    hull.reserve(16);
+    get_edges_from_star_minus_link(s, hull);
+    return is_in_kernel(t->point(), hull.begin(), hull.end());
+  }
+
+  template<class Iterator> // value_type = Edge
+  bool is_in_kernel(const Point& query, Iterator begin, Iterator end) const {
+    for (Iterator it = begin; it != end; ++it) {
+      Edge edge = *it;
+      const Point& pa = source_vertex(edge)->point();
+      const Point& pb = target_vertex(edge)->point();
+      if (!compute_triangle_ccw(pa, pb, query))
+        return false;
+    }
+    return true;
+  }
+
+  // COLLAPSE //
+
+  // (s,a,b) + (s,b,c) -> (s,a,c) + (a,b,c)
+  // st = (source,target) from 'make_collapsible'
+  // return (a,c)
+  Edge flip(const Edge& sb, Edge& st, int /*verbose*/ = 0) {
+    Vertex_handle t = target_vertex(st);
+
+    Edge sc = twin_edge(prev_edge(sb));
+    Base::tds().flip(sb.first, sb.second);
+    Edge ac = prev_edge(twin_edge(sc));
+
+    Vertex_handle a = source_vertex(ac);
+    if (a == t)
+      st = prev_edge(ac);
+
+    return ac;
+  }
+
+  void collapse(const Edge& edge, int /*verbose*/ = 0) {
+    if (is_edge_cyclic(edge)) {
+      collapse_cyclic_edge(edge);
+      return;
+    }
+
+    Edge twin = twin_edge(edge);
+    Base::tds().join_vertices(twin);
+  }
+
+  // (a,b,c) + (c,b,a) + (a,c,i) + (c,a,j) ->
+  // (a,c,i) + (c,a,j)
+  void collapse_cyclic_edge(const Edge& bc, int verbose = 0) {
+    if (verbose > 1)
+      std::cout << "collapse_cyclic_edge ... ";
+
+    Edge cb = twin_edge(bc);
+    Face_handle abc = bc.first;
+    Face_handle cba = cb.first;
+
+    Vertex_handle b = source_vertex(bc);
+    Vertex_handle c = target_vertex(bc);
+    Vertex_handle a = opposite_vertex(bc);
+
+    Edge ac = twin_edge(next_edge(bc));
+    Edge ca = twin_edge(prev_edge(cb));
+
+    a->set_face(ac.first);
+    c->set_face(ca.first);
+    ac.first->set_neighbor(ac.second, ca.first);
+    ca.first->set_neighbor(ca.second, ac.first);
+
+    this->delete_face(abc);
+    this->delete_face(cba);
+    this->delete_vertex(b);
+
+    if (verbose > 1)
+      std::cout << "done" << std::endl;
+  }
+
+  void print_edge(Rec_edge_2 edge) const {
+    int i = ((edge).edge()).second;
+    Point a = ((edge).edge()).first->vertex((i+1)%3)->point();
+    Point b = ((edge).edge()).first->vertex((i+2)%3)->point();
+    std::cout <<"( " << (edge).priority()  <<  ") ( " << a << " , " << b << " )" << std::endl;
+  }
+
+  bool is_p_infinity(const std::pair<bool,boost::optional<FT> >& p) const
+  {
+    return p.first && p.second==boost::none;
+  }
+
+  bool is_m_infinity(const std::pair<bool,boost::optional<FT> >& p) const
+  {
+    return !p.first && p.second==boost::none;
+  }
+
+  bool is_infinity(const std::pair<bool,boost::optional<FT> >& p) const
+  {
+    return p.second==boost::none;
+  }
+
+  std::pair<bool,boost::optional<FT> > m_infinity() const
+  {
+    return std::pair<bool,boost::optional<FT> >(false,boost::optional<FT>());
+  }
+
+  template <class Iterator> // value_type = Edge
+  bool make_collapsible(Edge& edge, Iterator begin, Iterator end, int verbose = 0)
+  {
+    Vertex_handle source = source_vertex(edge);
+    Vertex_handle target = target_vertex(edge);
+
+    MultiIndex multi_ind;
+    for (Iterator it = begin; it != end; ++it)
+    {
+      Edge ab = twin_edge(*it);
+      Vertex_handle a = source_vertex(ab);
+      Vertex_handle b = target_vertex(ab);
+      std::pair<bool,boost::optional<FT> > D = signed_distance_from_intersection(a, b, target, source);
+      if (!D.first ) {
+        CGAL_assertion(D.second!=boost::none);
+        multi_ind.insert(Rec_edge_2(ab, *D.second));
+      }
+    }
+
+    int nb_flips = 0;
+    while (!multi_ind.empty())
+    {
+      Rec_edge_2 pedge = *(multi_ind.template get<1>()).begin();
+      FT Dbc = pedge.priority();
+      Edge bc = pedge.edge();
+      (multi_ind.template get<0>()).erase(pedge);
+
+      Edge sb = prev_edge(bc);
+      Edge ab = prev_edge(twin_edge(sb));
+      Edge sc = twin_edge(next_edge(bc));
+      Edge cd = next_edge(sc);
+
+      Vertex_handle a = source_vertex(ab);
+      Vertex_handle b = source_vertex(bc);
+      Vertex_handle c = target_vertex(bc);
+      Vertex_handle d = target_vertex(cd);
+
+      std::pair<bool,boost::optional<FT> > Dac=m_infinity();
+      if (a != c && is_triangle_ccw(a, b, c))
+        Dac = signed_distance_from_intersection(a, c, target, source);
+
+      std::pair<bool,boost::optional<FT> > Dbd=m_infinity();
+      if (b != d && is_triangle_ccw(b, c, d))
+        Dbd = signed_distance_from_intersection(b, d, target, source);
+
+      if ( is_m_infinity(Dac) && is_m_infinity(Dbd) )
+      {
+        if (verbose > 1)
+          std::cerr << "--- No flips available ---"  << std::endl;
+        return false;
+      }
+
+      FT value = Dbc <= 0 ? 1 : 2*Dbc; // value used if Dbd or Dac are +infinity
+      if ( !is_infinity(Dac) )
+      {
+        if ( !is_infinity(Dbd))
+          value = (std::max)(*Dac.second * (Dac.first?1:-1),
+                             *Dbd.second * (Dbd.first?1:-1) );
+        else
+          if ( !is_p_infinity(Dbd) )
+            value = *Dac.second * (Dac.first?1:-1);
+      }
+      else
+        if ( !is_infinity(Dbd) && !is_p_infinity(Dac))
+          value = *Dbd.second * (Dbd.first?1:-1);
+
+      // if ( max(Dac,Dbd)+CGAL_EPS < Dbc )
+      if (value + CGAL_EPS < Dbc)
+      {
+			/*
+        std::cerr.precision(10);
+        std::cerr << "--- Flip makes kernel worse ---" << std::endl;
+        std::cerr << Dac << " or " << Dbd << " vs " << Dbc << std::endl;
+        std::cerr << "a: " << a->point() << std::endl;
+        std::cerr << "b: " << b->point() << std::endl;
+        std::cerr << "c: " << c->point() << std::endl;
+        std::cerr << "d: " << d->point() << std::endl;
+        std::cerr << "t: " << target->point() << std::endl;
+        std::cerr << "diff = " << Dbc - (std::max)(Dac, Dbd) << std::endl;
+				*/
+        return false;
+      }
+
+      // if (Dac > Dbd)
+      if (is_p_infinity(Dac) || is_m_infinity(Dbd) ||
+          (!is_p_infinity(Dbd) && !is_m_infinity(Dac)
+           && *Dac.second * (Dac.first?1:-1) > *Dbd.second * (Dbd.first?1:-1)))
+      {
+        (multi_ind.template get<0>()).erase(Rec_edge_2(ab));
+
+        Edge ac = flip(sb, edge, verbose);
+        if (!Dac.first) {
+          multi_ind.insert(Rec_edge_2(ac, - *Dac.second));
+        }
+      }
+      else
+      {
+        (multi_ind.template get<0>()).erase(Rec_edge_2(cd));
+        Edge bd = flip(sc, edge, verbose);
+        if (!Dbd.first) {
+          multi_ind.insert(Rec_edge_2(bd, - *Dbd.second));
+        }
+      }
+      nb_flips++;
+    }
+
+    if (verbose > 1)
+      std::cerr  << "Nb flips: "  << nb_flips << std::endl;
+
+    return true;
+  }
+};
+
+} } //namespace CGAL
+
+#undef CGAL_EPS
+
+#endif // CGAL_RECONSTRUCTION_TRIANGULATION_2_H
diff --git a/3rdparty/CGAL/include/CGAL/OTR_2/Reconstruction_vertex_base_2.h b/3rdparty/CGAL/include/CGAL/OTR_2/Reconstruction_vertex_base_2.h
new file mode 100644
index 0000000..b99b012
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/OTR_2/Reconstruction_vertex_base_2.h
@@ -0,0 +1,134 @@
+// Copyright (c) 2014  INRIA Sophia-Antipolis (France), INRIA Lorraine LORIA.
+// 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
+// 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(s)     : Fernando de Goes, Pierre Alliez, Ivo Vigan, Clément Jamin
+
+#ifndef CGAL_RECONSTRUCTION_VERTEX_BASE_2_H_
+#define CGAL_RECONSTRUCTION_VERTEX_BASE_2_H_
+
+#include <CGAL/Triangulation_vertex_base_2.h>
+#include <CGAL/OTR_2/Sample.h>
+
+namespace CGAL {
+namespace OTR_2 {
+
+/// The Reconstruction_vertex_base_2 class is the default
+/// vertex class of the Reconstruction_triangulation_2 class.
+///
+/// - Each vertex stores a Sample as well as the corresponding relocated point.
+///
+/// @param Traits_  Geometric traits class
+/// @param Vb       Vertex base class, model of TriangulationVertexBase_2.
+template < class Traits_, class Vb = Triangulation_vertex_base_2<Traits_> >
+class Reconstruction_vertex_base_2 : public Vb
+{
+
+  /// \cond SKIP_IN_MANUAL
+
+public:
+  typedef Vb Base;
+  typedef typename Traits_::FT        FT;
+  typedef OTR_2::Sample<Traits_>       Sample_;
+  typedef typename Traits_::Point_2   Point;
+  typedef typename Base::Face_handle  Face_handle;
+
+  template < typename TDS2 >
+  struct Rebind_TDS {
+    typedef typename Base::template Rebind_TDS<TDS2>::Other Vb2;
+    typedef Reconstruction_vertex_base_2<Traits_,Vb2> Other;
+  };
+
+private:
+  int       m_id;
+  bool      m_pinned;
+  Sample_*  m_sample;
+  Point     m_relocated;
+  FT        m_relevance;
+
+
+public:
+  Reconstruction_vertex_base_2()
+  : Base(),
+    m_id(-1),
+    m_pinned(false),
+    m_sample(NULL),
+    m_relevance(0)
+{
+}
+
+  Reconstruction_vertex_base_2(const Point & p)
+  : Base(p),
+    m_id(-1),
+    m_pinned(false),
+    m_sample(NULL),
+    m_relevance(0)
+  {
+  }
+
+  Reconstruction_vertex_base_2(Face_handle f)
+  : Base(f),
+    m_id(-1),
+    m_pinned(false),
+    m_sample(NULL),
+    m_relevance(0)
+  {
+  }
+
+  Reconstruction_vertex_base_2(const Point & p, Face_handle f)
+  : Base(p, f),
+    m_id(-1),
+    m_pinned(false),
+    m_sample(NULL),
+    m_relevance(0)
+  {
+  }
+
+  ~Reconstruction_vertex_base_2() { }
+
+  int  id() const { return m_id; }
+  int& id() { return m_id; }
+
+  bool  pinned() const { return m_pinned; }
+  bool& pinned() { return m_pinned; }
+
+  FT relevance() const { return m_relevance; }
+  void set_relevance(FT relevance) { m_relevance = relevance; }
+
+  Sample_* sample() const { return m_sample; }
+  void set_sample(Sample_* sample) { m_sample = sample; }
+
+  const Point& relocated() const { return m_relocated; }
+  Point& relocated() { return m_relocated; }
+
+  bool  has_sample_assigned() const { return sample() != NULL; }
+};
+//---------------STRUCT LESS VERTEX_HANDLE---------------------
+template <class T>
+struct less_Vertex_handle
+{
+  bool operator() (const T& a, const T& b) const
+  {
+    return (a->id() < b->id());
+  }
+};
+
+
+/// \endcond
+
+} } //end namespaces
+
+#endif // CGAL_RECONSTRUCTION_VERTEX_BASE_2_H_
diff --git a/3rdparty/CGAL-4.8/include/CGAL/OTR_2/Sample.h b/3rdparty/CGAL/include/CGAL/OTR_2/Sample.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/OTR_2/Sample.h
rename to 3rdparty/CGAL/include/CGAL/OTR_2/Sample.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Object.h b/3rdparty/CGAL/include/CGAL/Object.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Object.h
rename to 3rdparty/CGAL/include/CGAL/Object.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/OpenNL/bicgstab.h b/3rdparty/CGAL/include/CGAL/OpenNL/bicgstab.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/OpenNL/bicgstab.h
rename to 3rdparty/CGAL/include/CGAL/OpenNL/bicgstab.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/OpenNL/blas.h b/3rdparty/CGAL/include/CGAL/OpenNL/blas.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/OpenNL/blas.h
rename to 3rdparty/CGAL/include/CGAL/OpenNL/blas.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/OpenNL/conjugate_gradient.h b/3rdparty/CGAL/include/CGAL/OpenNL/conjugate_gradient.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/OpenNL/conjugate_gradient.h
rename to 3rdparty/CGAL/include/CGAL/OpenNL/conjugate_gradient.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/OpenNL/full_vector.h b/3rdparty/CGAL/include/CGAL/OpenNL/full_vector.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/OpenNL/full_vector.h
rename to 3rdparty/CGAL/include/CGAL/OpenNL/full_vector.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/OpenNL/linear_solver.h b/3rdparty/CGAL/include/CGAL/OpenNL/linear_solver.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/OpenNL/linear_solver.h
rename to 3rdparty/CGAL/include/CGAL/OpenNL/linear_solver.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/OpenNL/preconditioner.h b/3rdparty/CGAL/include/CGAL/OpenNL/preconditioner.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/OpenNL/preconditioner.h
rename to 3rdparty/CGAL/include/CGAL/OpenNL/preconditioner.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/OpenNL/sparse_matrix.h b/3rdparty/CGAL/include/CGAL/OpenNL/sparse_matrix.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/OpenNL/sparse_matrix.h
rename to 3rdparty/CGAL/include/CGAL/OpenNL/sparse_matrix.h
diff --git a/3rdparty/CGAL/include/CGAL/Optimal_transportation_reconstruction_2.h b/3rdparty/CGAL/include/CGAL/Optimal_transportation_reconstruction_2.h
new file mode 100644
index 0000000..534f5d7
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Optimal_transportation_reconstruction_2.h
@@ -0,0 +1,1770 @@
+// Copyright (c) 2014  INRIA Sophia-Antipolis (France), INRIA Lorraine LORIA.
+// 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
+// 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(s)     : Fernando de Goes, Pierre Alliez, Ivo Vigan, Clément Jamin
+
+#ifndef CGAL_OPTIMAL_TRANSPORTATION_RECONSTRUCTION_2_H_
+#define CGAL_OPTIMAL_TRANSPORTATION_RECONSTRUCTION_2_H_
+
+#include <CGAL/OTR_2/Reconstruction_triangulation_2.h>
+#include <CGAL/OTR_2/Reconstruction_edge_2.h>
+
+#include <CGAL/property_map.h>
+#include <CGAL/Real_timer.h>
+#include <CGAL/Random.h>
+
+#include <iterator>
+#include <iostream>
+#include <vector>
+#include <list>
+#include <algorithm>
+#include <utility>      // std::pair
+
+#include <boost/multi_index_container.hpp>
+#include <boost/multi_index/mem_fun.hpp>
+#include <boost/multi_index/ordered_index.hpp>
+#include <boost/multi_index/identity.hpp>
+#include <boost/iterator/transform_iterator.hpp>
+#include <boost/type_traits/is_float.hpp>
+
+namespace CGAL {
+
+
+/*!
+\ingroup PkgOptimalTransportationReconstruction2Classes
+
+This class provides a means to reconstruct a 1-dimensional shape from a set of 2D points with masses.
+The algorithm computes an initial 2D Delaunay triangulation from the input points, 
+and performs a simplification of the triangulation by performing half edge collapses, edge flips and vertex relocations.
+
+The edges are either processed in the order imposed by an priority queue, or
+in an order based on random selection of edge collapse operators.
+As the exhaustive priority queue guarantees a higher quality it is the default.
+The user can switch to the other method, for example for an initial
+simplification round, by calling `set_random_sample_size()`.
+
+By default edge flip operators are applied to ensure that every edge of the 
+triangulation are candidate to be collapsed, while preserving a valid embedding
+of the triangulation. This option can be disabled by calling
+\link set_use_flip() `set_use_flip(false)`\endlink to reduce the running times.
+
+By default the vertices are not relocated after each half edge collapse.
+This option can be changed by setting the number of vertex relocation steps
+performed between two edge collapse operators.
+
+The simplification is performed by calling either 
+\link run_until() `run_until(n)`\endlink or \link run() `run(steps)`\endlink.
+The former simplifies the triangulation until n points remain, while the latter
+stops after `steps` edge collapse operators have been performed.
+Furthermore, we can relocate the vertices by calling `relocate_all_points()`.
+
+\tparam Traits a model of the concept `OptimalTransportationReconstructionTraits_2`.
+
+\tparam PointPMap a model of `ReadablePropertyMap` with value type `Traits::Point_2`.
+        Defaults to <a href="http://www.boost.org/doc/libs/release/libs/property_map/doc/identity_property_map.html">`boost::typed_identity_property_map<Traits::Point_2>`</a> 
+        (for the case the input is points without mass).
+
+\tparam MassPMap a model of `ReadablePropertyMap` with value type `Traits::FT`
+        Defaults to <a href="http://www.boost.org/doc/libs/release/libs/property_map/doc/static_property_map.html">`boost::static_property_map<Traits::FT>`</a> 
+        (for the case the input is points without mass).
+
+ */
+template<
+  class Traits,
+  class PointPMap = boost::typed_identity_property_map <typename Traits::Point_2>,
+  class MassPMap  = boost::static_property_map <typename Traits::FT> >
+class Optimal_transportation_reconstruction_2
+{
+public:
+
+  /// \name Types
+  /// @{
+  /*!
+        Number type.
+   */
+  typedef typename Traits::FT FT;
+
+  /*!
+        Point type.
+   */
+  typedef typename Traits::Point_2 Point;
+
+  /*!
+        Segment type.
+  */
+  typedef typename Traits::Segment_2 Segment;
+
+  /// \cond SKIP_IN_MANUAL
+  /*!
+        Vector type.
+   */
+  typedef typename Traits::Vector_2 Vector;
+
+  typedef typename std::pair<Point, FT> PointMassPair;
+  typedef typename std::vector<PointMassPair> PointMassList;
+
+
+  /*!
+    The Output simplex.
+   */
+  typedef OTR_2::Reconstruction_triangulation_2<Traits>  Triangulation;
+
+  typedef typename Triangulation::Vertex                Vertex;
+  typedef typename Triangulation::Vertex_handle         Vertex_handle;
+  typedef typename Triangulation::Vertex_iterator       Vertex_iterator;
+  typedef typename Triangulation::Vertex_circulator     Vertex_circulator;
+  typedef typename Triangulation::Finite_vertices_iterator
+                                                        Finite_vertices_iterator;
+
+  typedef typename Triangulation::Edge                  Edge;
+  typedef typename Triangulation::Edge_circulator       Edge_circulator;
+  typedef typename Triangulation::Finite_edges_iterator Finite_edges_iterator;
+
+  typedef typename Triangulation::Face_handle           Face_handle;
+  typedef typename Triangulation::Face_circulator       Face_circulator;
+  typedef typename Triangulation::Finite_faces_iterator Finite_faces_iterator;
+
+  typedef typename Triangulation::Vertex_handle_map     Vertex_handle_map;
+  typedef typename Triangulation::Face_handle_map       Face_handle_map;
+
+  typedef typename Triangulation::Vertex_handle_set     Vertex_handle_set;
+  typedef typename Triangulation::Edge_set              Edge_set;
+
+  typedef typename Triangulation::Edge_vector           Edge_vector;
+  typedef std::list<Edge>                               Edge_list;
+
+  typedef typename Triangulation::Cost_                 Cost_;
+  typedef typename Triangulation::Sample_               Sample_;
+  typedef typename Triangulation::Sample_vector         Sample_vector;
+  typedef typename Triangulation::Sample_vector_const_iterator
+                                                        Sample_vector_const_iterator;
+
+  typedef typename Triangulation::PSample               PSample;
+  typedef typename Triangulation::SQueue                SQueue;
+
+  typedef typename Triangulation::Rec_edge_2            Rec_edge_2;
+
+  typedef typename Triangulation::MultiIndex            MultiIndex;
+
+  /// @}
+
+protected:
+  Triangulation m_dt;
+  Traits const& m_traits;
+  MultiIndex m_mindex;
+  int m_ignore;
+  int m_verbose;
+  std::size_t m_mchoice;  // # Edges
+  bool m_use_flip;
+  FT m_alpha; // [0, 1]
+  FT m_ghost; // ghost vs solid
+  unsigned int m_relocation; // # relocations
+
+  PointPMap point_pmap;
+  MassPMap  mass_pmap;
+
+  /// \endcond
+
+public:
+
+  /// \name Initialization
+  /// @{
+
+  /*!
+  Constructor of the optimal transportation reconstruction class. 
+  It builds an initial simplicial complex 
+  for a given range of point-mass pairs.
+
+  \tparam InputRange is a model of `Range` with forward iterators, 
+          providing input points and point masses through the 
+          `PointPMap` and `MassPMap` property maps.
+
+  \param input_range  Range of input data.
+  \param point_map    A `ReadablePropertyMap` used to access the input points.
+  \param mass_map     A `ReadablePropertyMap` used to access the input 
+                      points' masses.
+  \param sample_size  If `sample_size != 0`, the size of the random sample 
+                      which replaces the exhaustive priority queue.
+  \param use_flip     If `true` the edge flipping procedure is used to ensure 
+                      that every edge can be made collapsible.
+  \param relocation   The number of point relocations that are performed 
+                      between two edge collapses.
+  \param verbose      Controls how much console output is produced by 
+                      the algorithm. The values are 0, 1, or > 1.
+  \param traits       The traits class.
+   */
+  template <class InputRange>
+  Optimal_transportation_reconstruction_2(
+    const InputRange& input_range,
+    PointPMap point_map = PointPMap(),
+    MassPMap  mass_map = MassPMap(1),
+    std::size_t sample_size = 0,
+    bool use_flip = true,
+    unsigned int relocation = 2,
+    int verbose = 0,
+    Traits traits = Traits())
+  : m_dt(traits),
+    m_traits(m_dt.geom_traits()),
+    m_ignore(0), 
+    m_verbose(verbose),
+    m_mchoice(sample_size),
+    m_use_flip(use_flip),
+    m_alpha(0.5),
+    m_ghost(1.0),
+    m_relocation(relocation),
+    point_pmap(point_map),
+    mass_pmap(mass_map)
+  {
+    initialize(input_range.begin(), input_range.end());
+  }
+
+  /// @}
+
+  /// \name Settting Parameters
+  /// @{
+  /*!
+          If `sample_size == 0`, the simplification is performed using an exhaustive priority queue.
+          If `sample_size` is stricly positive the simplification is performed using a
+          multiple choice approach, ie, a best-choice selection in a random sample of 
+          edge collapse operators, of size `sample_size`. A typical value for the sample
+          size is 15, but this value must be enlarged when targeting a very coarse simplification.
+          \param sample_size If `sample_size != 0`, the size of the random sample replaces the priority queue.
+   */
+  void set_random_sample_size(std::size_t sample_size) {
+    m_mchoice = sample_size;
+  }
+
+  /*!
+        Determines how much console output the algorithm generates.
+        If set to a value larger than 0
+        details about the reconstruction process are written to `std::cerr`.
+
+        \param verbose The verbosity level.
+   */
+  void set_verbose(int verbose) {
+    m_verbose = verbose;
+  }
+
+
+  
+
+  /*!
+        The use_flip parameter determines whether the edge flipping procedure
+        is used for the half-edge collapse. 
+   */
+  void set_use_flip(const bool use_flip) {
+    m_use_flip = use_flip;
+  }
+
+
+  /*!
+        Sets the number of vertex relocations
+        that are performed between two edge collapses.
+   */
+  void set_relocation(unsigned int relocation) {
+    m_relocation = relocation;
+  }
+
+  /// \cond SKIP_IN_MANUAL
+  unsigned int relocation() const {
+    return m_relocation;
+  }
+  /// \endcond
+
+
+  /*!
+  \param relevance The relevance threshold used for filtering the edges.
+  An edge is relevant from the approximation point of view
+  if it is long, covers a large mass (or equivalently the
+  number of points when all masses are equal), and has a
+  small transport cost. This notion is defined as 
+  \f$ m(e) * |e|^2 / cost(e) \f$, where \f$ m(e) \f$ 
+  denotes the mass of the points approximated by the edge,
+  \f$ |e| \f$ denotes the edge length and \f$ cost(e) \f$
+  its approximation error.
+  As the cost is defined by mass time squared distance the
+  relevance is unitless.
+
+  The default value is 1, so that all edges receiving some mass
+  are considered relevant.
+  Setting a large relevance value is used to get robustness to a
+  large amount of outliers.
+   */
+  void set_relevance(const FT relevance) {
+    m_ghost = relevance;
+    m_dt.ghost_factor() = m_ghost;
+  }
+
+
+  /// \cond SKIP_IN_MANUAL
+  FT ghost() {
+    return m_ghost;
+  }
+
+  /// @}
+
+  /// \cond SKIP_IN_MANUAL
+
+  Optimal_transportation_reconstruction_2()
+  : m_traits(m_dt.geom_traits())
+  {
+    initialize_parameters();
+  }
+
+
+  ~Optimal_transportation_reconstruction_2() {
+    clear();
+  }
+
+  void initialize_parameters() {
+    m_verbose = 0;
+    m_mchoice = 0;
+    m_use_flip = true;
+    m_alpha = FT(0.5);
+    m_ghost = FT(1);
+    m_relocation = 0;
+
+    m_ignore = 0;
+  }
+
+  //Function if one wants to create a Optimal_transportation_reconstruction_2
+  //without yet specifying the input in the constructor.
+  template <class InputIterator>
+  void initialize(
+    InputIterator start_itr,
+    InputIterator beyond_itr,
+    PointPMap point_map,
+    MassPMap  mass_map)
+  {
+    point_pmap = point_map;
+    mass_pmap  = mass_map;
+
+    initialize(start_itr, beyond_itr);
+  }
+
+
+  template <class InputIterator>
+  void initialize(InputIterator start, InputIterator beyond) {
+
+    clear();
+    Property_map_to_unary_function<PointPMap> get_point(point_pmap);
+
+    Bbox_2 bbox = bbox_2(
+      boost::make_transform_iterator(start,get_point),
+      boost::make_transform_iterator(beyond,get_point));
+
+    insert_loose_bbox(bbox);
+    init(start, beyond);
+
+    std::vector<Sample_*> m_samples;
+    for (InputIterator it = start; it != beyond; it++) {
+      Point point = get(point_pmap, *it);
+      FT    mass  = get( mass_pmap, *it);
+      Sample_* s = new Sample_(point, mass);
+      m_samples.push_back(s);
+    }
+    assign_samples(m_samples.begin(), m_samples.end());
+  }
+
+  template <class InputIterator>
+  void initialize_with_custom_vertices(InputIterator samples_start,
+                                       InputIterator samples_beyond,
+                                       InputIterator vertices_start,
+                                       InputIterator vertices_beyond,
+                                       PointPMap point_map,
+                                       MassPMap  mass_map) {
+    point_pmap = point_map;
+    mass_pmap  = mass_map;
+    clear();
+    Property_map_to_unary_function<PointPMap> get_point(point_pmap);
+
+    Bbox_2 bbox = bbox_2(
+      boost::make_transform_iterator(samples_start,get_point),
+      boost::make_transform_iterator(samples_beyond,get_point));
+
+    insert_loose_bbox(bbox);
+    init(vertices_start, vertices_beyond);
+
+    std::vector<Sample_*> m_samples;
+    for (InputIterator it = samples_start; it != samples_beyond; it++) {
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
+      Point point = get(point_pmap, it);
+      FT    mass  = get( mass_pmap, it);
+#else
+      Point point = get(point_pmap, *it);
+      FT    mass  = get( mass_pmap, *it);
+#endif
+      Sample_* s = new Sample_(point, mass);
+      m_samples.push_back(s);
+    }
+    assign_samples(m_samples.begin(), m_samples.end());
+  }
+
+
+  template <class Vector>
+  Vector random_vec(const FT scale) const
+  {
+    FT dx = -scale + get_default_random().get_double() * 2* scale;
+    FT dy = -scale + get_default_random().get_double() * 2* scale;
+    return m_traits.construct_vector_2_object()(dx, dy);
+  }
+
+  void clear() {
+    Sample_vector samples;
+    m_dt.collect_all_samples(samples);
+    // Deallocate samples
+    for (Sample_vector_const_iterator s_it = samples.begin();
+        s_it != samples.end(); ++s_it)
+    {
+      delete *s_it;
+    }
+  }
+
+
+  // INIT //
+  void insert_loose_bbox(const Bbox_2& bbox) {
+    CGAL::Real_timer timer;
+    if (m_verbose > 0)
+      std::cerr << "insert loose bbox...";
+
+    double dl = (std::max)((bbox.xmax()-bbox.xmin()) / 2.,
+                           (bbox.ymax()-bbox.ymin()) / 2.);
+
+    timer.start();
+    int nb = static_cast<int>(m_dt.number_of_vertices());
+    typename Traits::Construct_point_2 point_2
+      = m_traits.construct_point_2_object();
+    insert_point(point_2(bbox.xmin()-dl, bbox.ymin()-dl), true, nb++);
+    insert_point(point_2(bbox.xmin()-dl, bbox.ymax()+dl), true, nb++);
+    insert_point(point_2(bbox.xmax()+dl, bbox.ymax()+dl), true, nb++);
+    insert_point(point_2(bbox.xmax()+dl, bbox.ymin()-dl), true, nb++);
+
+    if (m_verbose > 0)
+      std::cerr << "done (" << nb << " vertices, "
+                << timer.time() << " s)" << std::endl;
+  }
+
+  template<class Iterator>  // value_type = Point*
+  void init(Iterator begin, Iterator beyond) {
+    CGAL::Real_timer timer;
+    if (m_verbose > 0)
+      std::cerr << "init...";
+
+    timer.start();
+    int nb = static_cast<int>(m_dt.number_of_vertices());
+    m_dt.infinite_vertex()->pinned() = true;
+    for (Iterator it = begin; it != beyond; it++) {
+      Point point = get(point_pmap, *it);
+      insert_point(point, false, nb++);
+    }
+
+    if (m_verbose > 0)
+      std::cerr << "done (" << nb << " vertices, "
+                << timer.time() << " s)"
+                << std::endl;
+  }
+
+private:
+  Vertex_handle insert_point(
+    const Point& point, const bool pinned, const int id) 
+  {
+    Vertex_handle v = m_dt.insert(point);
+    v->pinned() = pinned;
+    v->id() = id;
+    return v;
+  }
+public:
+
+  // ASSIGNMENT //
+
+  void cleanup_assignments() {
+    m_dt.cleanup_assignments();
+  }
+
+  template<class Iterator>  // value_type = Sample_*
+  void assign_samples(Iterator begin, Iterator end) {
+    CGAL::Real_timer timer;
+    if (m_verbose > 0)
+      std::cerr << "assign samples...";
+
+    timer.start();
+    m_dt.assign_samples(begin, end);
+    m_dt.reset_all_costs();
+
+    if (m_verbose > 0)
+      std::cerr << "done (" << timer.time() << " s)" << std::endl;
+  }
+
+  void reassign_samples() {
+    Sample_vector samples;
+    m_dt.collect_all_samples(samples);
+    m_dt.cleanup_assignments();
+    m_dt.assign_samples(samples.begin(), samples.end());
+    m_dt.reset_all_costs();
+  }
+
+  void reassign_samples_around_vertex(Vertex_handle vertex) {
+    Sample_vector samples;
+    m_dt.collect_samples_from_vertex(vertex, samples, true);
+    m_dt.assign_samples(samples.begin(), samples.end());
+
+    Edge_vector hull;
+    m_dt.get_edges_from_star_minus_link(vertex, hull, true);
+    update_cost(hull.begin(), hull.end());
+  }
+
+
+  bool do_collapse(Edge edge) {
+    Vertex_handle s = m_dt.source_vertex(edge);
+    Vertex_handle t = m_dt.target_vertex(edge);
+
+    if (m_verbose > 1) {
+      std::cerr << std::endl << "do collapse ("
+          << s->id() << "->" << t->id() << ") ... " << std::endl;
+    }
+
+    Sample_vector samples;
+    m_dt.collect_samples_from_vertex(s, samples, true);
+
+    Edge_vector hull;
+    m_dt.get_edges_from_star_minus_link(s, hull, true);
+
+    if (m_mchoice == 0)
+      remove_stencil_from_pqueue(hull.begin(), hull.end());
+
+    if (m_use_flip)
+      m_dt.make_collapsible(edge, hull.begin(), hull.end(), m_verbose);
+
+    // debug test
+    bool ok = m_dt.check_kernel_test(edge);
+    if (!ok) {
+      if (m_verbose > 1)
+        std::cerr << "do_collapse: kernel test failed: " << std::endl;
+      return false;
+    }
+    //
+
+    m_dt.collapse(edge, m_verbose);
+
+    m_dt.assign_samples(samples.begin(), samples.end());
+
+    update_cost(hull.begin(), hull.end());
+
+    if (m_mchoice == 0)
+      push_stencil_to_pqueue(hull.begin(), hull.end());
+
+    for (unsigned int i = 0; i < m_relocation; ++i) {
+      relocate_one_ring(hull.begin(), hull.end());
+    }
+
+    if (m_verbose > 1) {
+      std::cerr << "done" << std::endl;
+    }
+
+    return true;
+  }
+
+  bool simulate_collapse(const Edge& edge, Cost_& cost) {
+    bool ok;
+    Vertex_handle s = m_dt.source_vertex(edge);
+    Vertex_handle t = m_dt.target_vertex(edge);
+
+    if (m_verbose > 1) {
+      std::cerr << "simulate collapse ("
+        << s->id() << "->" << t->id() << ") ... " << std::endl;
+    }
+
+    Triangulation copy;
+    Edge copy_edge = copy_star(edge, copy);
+    Vertex_handle copy_source = copy.source_vertex(copy_edge);
+
+    if (m_use_flip) {
+      Edge_vector copy_hull;
+      copy.get_edges_from_star_minus_link(copy_source, copy_hull, true);
+      ok = copy.make_collapsible(copy_edge, copy_hull.begin(),
+          copy_hull.end(), m_verbose);
+      if (!ok) {
+        // std::cerr << "simulation: failed (make collapsible)" << std::endl;
+        return false;
+      }
+    }
+
+    ok = copy.check_kernel_test(copy_edge);
+    if (!ok) {
+      std::cerr << "simulation: failed (kernel test)" << std::endl;
+      return false;
+    }
+
+    copy.collapse(copy_edge, m_verbose);
+
+    Sample_vector samples;
+    m_dt.collect_samples_from_vertex(s, samples, false);
+
+    backup_samples(samples.begin(), samples.end());
+    copy.assign_samples_brute_force(samples.begin(), samples.end());
+    copy.reset_all_costs();
+    cost = copy.compute_total_cost();
+    restore_samples(samples.begin(), samples.end());
+
+    if (m_verbose > 1) {
+      std::cerr << "done" << std::endl;
+    }
+
+    return true;
+  }
+
+  template<class Iterator> // value_type = Sample_*
+  void backup_samples(Iterator begin, Iterator end) const {
+    for (Iterator it = begin; it != end; ++it) {
+      Sample_* sample = *it;
+      sample->backup();
+    }
+  }
+
+  template<class Iterator> // value_type = Sample_*
+  void restore_samples(Iterator begin, Iterator end) const {
+    for (Iterator it = begin; it != end; ++it) {
+      Sample_* sample = *it;
+      sample->restore();
+    }
+  }
+
+  // PEDGE //
+
+  bool decimate() {
+    bool ok;
+    Rec_edge_2 pedge;
+    ok = pick_edge(m_mchoice, pedge);
+    if (!ok)
+      return false;
+
+    ok = do_collapse(pedge.edge());
+    if (!ok)
+      return false;
+    return true;
+  }
+
+  bool create_pedge(const Edge& edge, Rec_edge_2& pedge) {
+    Cost_ after_cost;
+    bool ok = simulate_collapse(edge, after_cost);
+    if (!ok)
+      return false;
+
+    Vertex_handle source = m_dt.source_vertex(edge);
+    Cost_ before_cost = m_dt.compute_cost_around_vertex(source);
+
+    FT before = before_cost.finalize(m_alpha);
+    FT after = after_cost.finalize(m_alpha);
+    pedge = Rec_edge_2(edge, before, after);
+    return true;
+  }
+
+
+  // COST //
+
+  void init_cost() {
+    m_dt.reset_all_costs();
+  }
+
+  template<class Iterator> // value_type = Edge
+  void update_cost(Iterator begin, Iterator end) {
+    Edge_vector edges;
+    collect_cost_stencil(m_dt, begin, end, edges);
+
+    typename Edge_vector::iterator ei;
+    for (ei = edges.begin(); ei != edges.end(); ++ei) {
+      Edge edge = *ei;
+      m_dt.update_cost(edge);
+    }
+  }
+
+  template<class Iterator> // value_type = Edge
+  void collect_cost_stencil(
+    const Triangulation& mesh, Iterator begin, Iterator end, 
+    Edge_vector& edges) const
+  {
+    Edge_set done;
+    Edge_list fifo;
+    for (Iterator it = begin; it != end; ++it) {
+      Edge edge = *it;
+      fifo.push_back(edge);
+      done.insert(edge);
+    }
+
+    while (!fifo.empty()) {
+      Edge edge = fifo.front();
+      fifo.pop_front();
+
+      edge = mesh.twin_edge(edge);
+      edges.push_back(edge);
+
+      Edge next = mesh.next_edge(edge);
+      if (done.insert(next).second)
+        fifo.push_back(next);
+
+      Edge prev = mesh.prev_edge(edge);
+      if (done.insert(prev).second)
+        fifo.push_back(prev);
+    }
+  }
+
+  // PQUEUE (MCHOICE or EXHAUSTIVE) //
+
+  bool pick_edge(std::size_t nb, Rec_edge_2& best_pedge) {
+    if (m_dt.number_of_faces() < 2)
+      return false;
+
+    std::size_t ne = 2 * m_dt.tds().number_of_edges();
+    if (nb > ne)
+      nb = ne;
+
+    bool ok;
+    if (nb == 0) {
+      ok = pick_edge_from_pqueue(best_pedge);
+      return ok;
+    }
+    m_mindex.clear();
+
+    if (nb == ne) {
+      ok = pick_edge_brute_force(best_pedge);
+      return ok;
+    }
+
+    ok = pick_edge_randomly(nb, best_pedge);
+    return ok;
+  }
+
+  bool pick_edge_from_pqueue(Rec_edge_2& best_pedge) {
+    if (m_mindex.empty())
+      populate_pqueue();
+    if (m_mindex.empty())
+      return false;
+    best_pedge = *(m_mindex.template get<1>()).begin();
+    (m_mindex.template get<0>()).erase(best_pedge);
+    return true;
+  }
+
+  bool pick_edge_brute_force(Rec_edge_2& best_pedge) {
+    MultiIndex mindex;
+    Finite_edges_iterator ei;
+    for (ei = m_dt.finite_edges_begin(); ei != m_dt.finite_edges_end();
+        ++ei) {
+      Edge edge = *ei;
+      push_to_mindex(edge, mindex);
+
+      edge = m_dt.twin_edge(edge);
+      push_to_mindex(edge, mindex);
+    }
+    if (mindex.empty())
+      return false;
+    best_pedge = *(mindex.template get<1>()).begin();
+    return true;
+  }
+
+  bool pick_edge_randomly(std::size_t nb, Rec_edge_2& best_pedge) {
+    MultiIndex mindex;
+    for (std::size_t i = 0; i < nb; ++i) {
+      Rec_edge_2 pedge;
+      if (random_pedge(pedge))
+        mindex.insert(pedge);
+    }
+    if (mindex.empty())
+      return false;
+    best_pedge = *(mindex.template get<1>()).begin();
+    return true;
+  }
+
+  void populate_pqueue() {
+    Finite_edges_iterator ei;
+    for (ei = m_dt.finite_edges_begin(); ei != m_dt.finite_edges_end();
+        ++ei) {
+      Edge edge = *ei;
+      push_to_mindex(edge, m_mindex);
+
+      edge = m_dt.twin_edge(edge);
+      push_to_mindex(edge, m_mindex);
+    }
+  }
+
+
+  bool push_to_mindex(const Edge& edge, MultiIndex& mindex) {
+    if (m_dt.is_pinned(edge))
+      return false;
+    if (m_dt.is_target_cyclic(edge))
+      return false;
+
+    Rec_edge_2 pedge;
+    bool ok = create_pedge(edge, pedge);
+    if (!ok)
+      return false;
+    mindex.insert(pedge);
+    return true;
+  }
+
+
+
+  bool random_pedge(Rec_edge_2& pedge) {
+    for (unsigned i = 0; i < 10; ++i) {
+      Edge edge = m_dt.random_finite_edge();
+      if (m_dt.is_pinned(edge))
+        continue;
+      if (m_dt.is_target_cyclic(edge))
+        continue;
+      bool ok = create_pedge(edge, pedge);
+      if (ok)
+        return true;
+    }
+    return false;
+  }
+
+  template<class Iterator> // value_type = Edge
+  void remove_stencil_from_pqueue(Iterator begin, Iterator end) 
+  {
+    if (m_mindex.empty())
+      return;
+
+    Edge_vector edges;
+    collect_pqueue_stencil(m_dt, begin, end, edges);
+
+    typename Edge_vector::const_iterator ei;
+    for (ei = edges.begin(); ei != edges.end(); ++ei) {
+      Edge edge = *ei;
+      (m_mindex.template get<0>()).erase(Rec_edge_2(edge));
+    }
+  }
+
+  template<class Iterator> // value_type = Edge
+  void push_stencil_to_pqueue(Iterator begin, Iterator end) {
+    Edge_vector edges;
+    collect_pqueue_stencil(m_dt, begin, end, edges);
+
+    typename Edge_vector::const_iterator ei;
+    for (ei = edges.begin(); ei != edges.end(); ++ei) {
+      Edge edge = *ei;
+      push_to_mindex(edge, m_mindex);
+    }
+  }
+
+  template<class Iterator> // value_type = Edge
+  void collect_pqueue_stencil(
+    const Triangulation& mesh, Iterator begin, Iterator end, 
+    Edge_vector& edges) const
+  {
+    Vertex_handle_set vertex_set;
+    for (Iterator it = begin; it != end; ++it) {
+      Edge edge = *it;
+      Edge twin = mesh.twin_edge(edge);
+
+      Vertex_handle s = mesh.source_vertex(edge);
+      if (!s->pinned())
+        vertex_set.insert(s);
+
+      Vertex_handle t = mesh.target_vertex(edge);
+      if (!t->pinned())
+        vertex_set.insert(t);
+
+      Vertex_handle f = mesh.opposite_vertex(edge);
+      if (!f->pinned())
+        vertex_set.insert(f);
+
+      Vertex_handle b = mesh.opposite_vertex(twin);
+      if (!b->pinned())
+        vertex_set.insert(b);
+    }
+
+    typename Vertex_handle_set::const_iterator vi;
+    for (vi = vertex_set.begin(); vi != vertex_set.end(); ++vi) {
+      Vertex_handle v = *vi;
+      Edge_circulator ecirc = mesh.incident_edges(v);
+      Edge_circulator eend = ecirc;
+      CGAL_For_all(ecirc, eend)
+      {
+        Edge edge = *ecirc;
+        if (mesh.source_vertex(edge) != v)
+          edge = mesh.twin_edge(edge);
+        edges.push_back(edge);
+      }
+    }
+  }
+
+  // COPY STAR //
+
+  // edge must not be pinned or have cyclic target
+  Edge copy_star(const Edge& edge, Triangulation& copy) {
+    copy.tds().set_dimension(2);
+    copy.infinite_vertex()->pinned() = true;
+
+    // copy vertices
+    Vertex_handle_map cvmap;
+
+    Vertex_handle s = m_dt.source_vertex(edge);
+    CGAL_assertion(s != m_dt.infinite_vertex() );
+
+    Vertex_handle cs = copy.tds().create_vertex();
+    cvmap[s] = copy_vertex(s, cs);
+
+    Vertex_circulator vcirc = m_dt.incident_vertices(s);
+    Vertex_circulator vend = vcirc;
+    CGAL_For_all(vcirc, vend)
+    {
+      Vertex_handle v = vcirc;
+      CGAL_assertion(v!=m_dt.infinite_vertex());
+      if (cvmap.find(v) == cvmap.end()) {
+        Vertex_handle cv = copy.tds().create_vertex();
+        cvmap[v] = copy_vertex(v, cv);
+      }
+    }
+
+    // copy faces
+    Face_handle_map cfmap;
+    Face_circulator fcirc = m_dt.incident_faces(s);
+    Face_circulator fend = fcirc;
+    CGAL_For_all(fcirc, fend)
+    {
+      Face_handle f = fcirc;
+      Face_handle cf = copy.tds().create_face();
+      cfmap[f] = copy_face(f, cf, cvmap);
+    }
+
+    // set neighbors
+    fcirc = m_dt.incident_faces(s);
+    fend = fcirc;
+    CGAL_For_all(fcirc, fend)
+    {
+      Face_handle f = fcirc;
+      copy_neighbors(f, s, cvmap, cfmap);
+    }
+
+    // make copy homeomorphic to S^2
+    close_copy_mesh(cs, copy);
+
+    // copy samples surrounding star
+    copy_samples(s, cs, cfmap, copy);
+
+    // get copy of edge
+    Edge copy_edge = get_copy_edge(edge, cvmap, cfmap);
+    return copy_edge;
+  }
+
+  Vertex_handle copy_vertex(Vertex_handle v0, Vertex_handle v1) const {
+    v1->id() = v0->id();
+    v1->set_point(v0->point());
+    v1->pinned() = v0->pinned();
+    v1->set_sample(v0->sample());
+    return v1;
+  }
+
+  Face_handle copy_face(
+    Face_handle f0, Face_handle f1, Vertex_handle_map& vmap) const 
+  {
+    for (unsigned i = 0; i < 3; ++i) {
+      Vertex_handle v0i = f0->vertex(i);
+      Vertex_handle v1i = vmap[v0i];
+      f1->set_vertex(i, v1i);
+      v1i->set_face(f1);
+    }
+    return f1;
+  }
+
+  void copy_neighbors(
+    Face_handle f, Vertex_handle v, Vertex_handle_map& vmap,
+    Face_handle_map& fmap) const
+  {
+    int i = f->index(v);
+    Face_handle cf = fmap[f];
+    Vertex_handle cv = vmap[v];
+
+    if (fmap.find(f->neighbor(i)) != fmap.end()) {
+      Face_handle fi = f->neighbor(i);
+      Face_handle cfi = fmap[fi];
+      cf->set_neighbor(i, cfi);
+    }
+
+    for (unsigned j = 0; j < 2; ++j) {
+      i = (i + 1) % 3;
+      Face_handle fi = f->neighbor(i);
+      Face_handle cfi = fmap[fi];
+      cf->set_neighbor(i, cfi);
+    }
+  }
+
+  void close_copy_mesh(Vertex_handle vertex, Triangulation& copy) const {
+    std::vector<Face_handle> outer_faces;
+
+    Face_circulator fcirc = copy.incident_faces(vertex);
+    Face_circulator fend = fcirc;
+    CGAL_For_all(fcirc, fend)
+    {
+      Face_handle face = fcirc;
+      int i = face->index(vertex);
+
+      if (face->neighbor(i) != Face_handle())
+        continue;
+
+      Vertex_handle v1 = face->vertex((i + 1) % 3);
+      Vertex_handle v2 = face->vertex((i + 2) % 3);
+
+      Face_handle outer = copy.tds().create_face();
+      outer->set_vertex(0, copy.infinite_vertex());
+      outer->set_vertex(1, v2);
+      outer->set_vertex(2, v1);
+
+      face->set_neighbor(i, outer);
+      outer->set_neighbor(0, face);
+
+      outer_faces.push_back(outer);
+    }
+
+    for (unsigned i = 0; i < outer_faces.size(); ++i) {
+      unsigned j = (i + 1) % outer_faces.size();
+      outer_faces[i]->set_neighbor(2, outer_faces[j]);
+      outer_faces[j]->set_neighbor(1, outer_faces[i]);
+    }
+
+    if (!outer_faces.empty())
+      copy.infinite_vertex()->set_face(outer_faces[0]);
+  }
+
+  void copy_samples(
+    Vertex_handle vertex, Vertex_handle copy_vertex,
+    Face_handle_map& fmap, Triangulation& copy) const
+  {
+    Face_circulator fcirc = m_dt.incident_faces(vertex);
+    Face_circulator fend = fcirc;
+    CGAL_For_all(fcirc, fend)
+    {
+      Face_handle face = fcirc;
+      int index = face->index(vertex);
+      Edge twin = m_dt.twin_edge(Edge(face, index));
+
+      Face_handle copy_face = fmap[face];
+      index = copy_face->index(copy_vertex);
+      Edge copy_twin = copy.twin_edge(Edge(copy_face, index));
+
+      Sample_vector samples;
+      m_dt.collect_samples_from_edge(twin, samples);
+      copy_twin.first->samples(copy_twin.second) = samples;
+    }
+    copy_vertex->set_sample(NULL);
+  }
+
+  Edge get_copy_edge(
+    const Edge& edge, Vertex_handle_map& vmap, Face_handle_map& fmap) const 
+  {
+    Face_handle f = edge.first;
+    Vertex_handle v = f->vertex(edge.second);
+
+    Face_handle cf = fmap[f];
+    Vertex_handle cv = vmap[v];
+
+    return Edge(cf, cf->index(cv));
+  }
+
+  // RELOCATION //
+
+  void relocate_one_vertex(Vertex_handle vertex) {
+    std::swap(vertex->point(), vertex->relocated());
+    reassign_samples_around_vertex(vertex);
+  }
+
+  template<class Iterator> // value_type = Edge
+      void relocate_one_ring(Iterator begin, Iterator end) {
+    Vertex_handle_set vertices;
+    for (Iterator it = begin; it != end; ++it) {
+      Edge edge = *it;
+      vertices.insert(m_dt.source_vertex(edge));
+      vertices.insert(m_dt.target_vertex(edge));
+    }
+
+    typename Vertex_handle_set::const_iterator vi;
+    for (vi = vertices.begin(); vi != vertices.end(); ++vi) {
+      Vertex_handle v = *vi;
+      if (v->pinned())
+        continue;
+      v->relocated() = compute_relocation(v);
+    }
+
+    for (vi = vertices.begin(); vi != vertices.end(); ++vi) {
+      Vertex_handle v = *vi;
+      if (v->pinned())
+        continue;
+      if (v->point() == v->relocated())
+        continue;
+
+      Edge_vector hull;
+      m_dt.get_edges_from_star_minus_link(v, hull, false);
+      bool ok = m_dt.is_in_kernel(v->relocated(), hull.begin(),
+          hull.end());
+
+      if (ok) {
+        // do relocation
+        FT norm_bef = m_dt.compute_cost_around_vertex(v).norm();
+        relocate_one_vertex(v);
+        FT norm_aft = m_dt.compute_cost_around_vertex(v).norm();
+
+        if (norm_bef < norm_aft) {
+          // undo relocation
+          relocate_one_vertex(v);
+        } else if (m_mchoice == 0) {
+          // update queue
+          hull.clear();
+          m_dt.get_edges_from_star_minus_link(v, hull, true);
+          remove_stencil_from_pqueue(hull.begin(), hull.end());
+          push_stencil_to_pqueue(hull.begin(), hull.end());
+        }
+      }
+    }
+  }
+
+  /// \endcond
+
+
+  /// \cond SKIP_IN_MANUAL
+  Vector compute_gradient(Vertex_handle vertex) const {
+    Vector grad = m_traits.construct_vector_2_object()(FT(0), FT(0));
+    Edge_circulator ecirc = m_dt.incident_edges(vertex);
+    Edge_circulator eend = ecirc;
+    CGAL_For_all(ecirc, eend)
+    {
+      Edge edge = *ecirc;
+      if (m_dt.source_vertex(edge) != vertex)
+        edge = m_dt.twin_edge(edge);
+
+      if (m_dt.get_plan(edge) == 0)
+        grad = m_traits.construct_sum_of_vectors_2_object()(
+          grad, compute_gradient_for_plan0(edge));
+      else
+        grad = m_traits.construct_sum_of_vectors_2_object()(
+          grad, compute_gradient_for_plan1(edge));
+    }
+    return grad;
+  }
+
+  // If the underlying number type used is not a floating point base
+  // number type (like a multiprecision), the coordinates of the points
+  // will increase a lot due to the relocation step. These functions
+  // simply turn a relocated point to a rounded to double version.
+  void relocate_on_the_double_grid(Point&, boost::true_type) const
+  {}
+  void relocate_on_the_double_grid(Point& p, boost::false_type) const
+  {
+    double x=to_double(m_traits.compute_x_2_object()(p));
+    double y=to_double(m_traits.compute_y_2_object()(p));
+    p=m_traits.construct_point_2_object()(FT(x),FT(y));
+  }
+  void relocate_on_the_double_grid(Point& p) const
+  {
+    relocate_on_the_double_grid(p,
+      typename boost::is_float<typename Traits::FT>::type());
+  }
+
+  Point compute_relocation(Vertex_handle vertex) const {
+    FT coef = FT(0);
+    Vector rhs = m_traits.construct_vector_2_object()(FT(0), FT(0));
+
+    Edge_circulator ecirc = m_dt.incident_edges(vertex);
+    Edge_circulator eend = ecirc;
+    CGAL_For_all(ecirc, eend)
+    {
+      Edge edge = *ecirc;
+      if (m_dt.source_vertex(edge) != vertex)
+        edge = m_dt.twin_edge(edge);
+
+      if (m_dt.get_plan(edge) == 0)
+        compute_relocation_for_plan0(edge, coef, rhs);
+      else
+        compute_relocation_for_plan1(edge, coef, rhs);
+    }
+    compute_relocation_for_vertex(vertex, coef, rhs);
+
+    if (coef == FT(0))
+      return vertex->point();
+
+    Point res = m_traits.construct_translated_point_2_object()(
+      CGAL::ORIGIN,
+      m_traits.construct_scaled_vector_2_object()(rhs, FT(1) / coef));
+    relocate_on_the_double_grid(res);
+    return res;
+  }
+
+  void compute_relocation_for_vertex(
+    Vertex_handle vertex, FT& coef, Vector& rhs) const
+  {
+    Sample_* sample = vertex->sample();
+    if (sample) {
+      const FT m = sample->mass();
+      const Point& ps = sample->point();
+      rhs = m_traits.construct_sum_of_vectors_2_object()(rhs, 
+        m_traits.construct_scaled_vector_2_object()(
+          m_traits.construct_vector_2_object()(CGAL::ORIGIN, ps), m));
+      coef += m;
+    }
+  }
+
+  Vector compute_gradient_for_plan0(const Edge& edge) const {
+    Edge twin = m_dt.twin_edge(edge);
+    const Point& pa = m_dt.source_vertex(edge)->point();
+    const Point& pb = m_dt.target_vertex(edge)->point();
+
+    Sample_vector samples;
+    m_dt.collect_samples_from_edge(edge, samples);
+    m_dt.collect_samples_from_edge(twin, samples);
+
+    Vector grad = m_traits.construct_vector_2_object()(FT(0), FT(0));
+    Sample_vector_const_iterator it;
+    for (it = samples.begin(); it != samples.end(); ++it) {
+      Sample_* sample = *it;
+      const FT m = sample->mass();
+      const Point& ps = sample->point();
+
+      FT Da = m_traits.compute_squared_distance_2_object()(ps, pa);
+      FT Db = m_traits.compute_squared_distance_2_object()(ps, pb);
+      if (Da < Db)
+        grad = m_traits.construct_sum_of_vectors_2_object()(
+          grad,
+          m_traits.construct_scaled_vector_2_object()(
+            m_traits.construct_vector_2_object()(ps, pa), m));
+    }
+    return grad;
+  }
+
+  void compute_relocation_for_plan0(
+    const Edge& edge, FT& coef, Vector& rhs) const 
+  {
+    Edge twin = m_dt.twin_edge(edge);
+    const Point& pa = m_dt.source_vertex(edge)->point();
+    const Point& pb = m_dt.target_vertex(edge)->point();
+
+    Sample_vector samples;
+    m_dt.collect_samples_from_edge(edge, samples);
+    m_dt.collect_samples_from_edge(twin, samples);
+
+    Sample_vector_const_iterator it;
+    for (it = samples.begin(); it != samples.end(); ++it) {
+      Sample_* sample = *it;
+      const FT m = sample->mass();
+      const Point& ps = sample->point();
+
+      FT Da = m_traits.compute_squared_distance_2_object()(ps, pa);
+      FT Db = m_traits.compute_squared_distance_2_object()(ps, pb);
+
+      if (Da < Db) {
+        rhs = m_traits.construct_sum_of_vectors_2_object()(rhs, 
+          m_traits.construct_scaled_vector_2_object()(
+            m_traits.construct_vector_2_object()(CGAL::ORIGIN, ps), m));
+        coef += m;
+      }
+    }
+  }
+
+  Vector compute_gradient_for_plan1(const Edge& edge) const {
+    //FT M = m_dt.get_mass(edge);
+    const Point& pa = m_dt.source_vertex(edge)->point();
+    const Point& pb = m_dt.target_vertex(edge)->point();
+
+    SQueue queue;
+    m_dt.sort_samples_from_edge(edge, queue);
+
+    //FT start = FT(0);
+    Vector grad = m_traits.construct_vector_2_object()(FT(0), FT(0));
+    while (!queue.empty()) {
+      PSample psample = queue.top();
+      queue.pop();
+
+      const FT m = psample.sample()->mass();
+      const Point& ps = psample.sample()->point();
+
+      // normal + tangnetial
+      const FT coord = psample.priority();
+      Point pf = m_traits.construct_translated_point_2_object()(
+        CGAL::ORIGIN,
+        m_traits.construct_sum_of_vectors_2_object()(
+          m_traits.construct_scaled_vector_2_object()(
+            m_traits.construct_vector_2_object()(CGAL::ORIGIN, pa), 
+            1.0 - coord),
+          m_traits.construct_scaled_vector_2_object()(
+            m_traits.construct_vector_2_object()(CGAL::ORIGIN, pb), 
+            coord)));
+      grad = m_traits.construct_sum_of_vectors_2_object()(
+        grad,
+        m_traits.construct_scaled_vector_2_object()(
+          m_traits.construct_vector_2_object()(ps, pf), m * (1.0 - coord)));
+
+      /*
+      // only normal
+      FT bin = m/M;
+      FT center = start + 0.5*bin;
+      Point pc = CGAL::ORIGIN + (1.0-center)*(pa - CGAL::ORIGIN) + center*(pb - CGAL::ORIGIN);
+      start += bin;
+      grad = grad + m*(bin*bin/12.0)*(pa - pb);
+      grad = grad + m*(1.0-center)*(pc - pf);
+      */
+    }
+    return grad;
+  }
+
+  void compute_relocation_for_plan1(
+    const Edge& edge, FT& coef, Vector& rhs) const 
+  {
+    //FT M = m_dt.get_mass(edge);
+    const Point& pb = m_dt.target_vertex(edge)->point();
+
+    SQueue queue;
+    m_dt.sort_samples_from_edge(edge, queue);
+
+    //FT start = FT(0);
+    while (!queue.empty()) {
+      PSample psample = queue.top();
+      queue.pop();
+
+      const FT m = psample.sample()->mass();
+      const Point& ps = psample.sample()->point();
+
+      const FT coord = psample.priority();
+      const FT one_minus_coord = 1.0 - coord;
+
+      // normal + tangential
+      coef += m * one_minus_coord * one_minus_coord;
+      rhs = m_traits.construct_sum_of_vectors_2_object()(
+        rhs,
+        m_traits.construct_scaled_vector_2_object()(
+          m_traits.construct_sum_of_vectors_2_object()(
+            m_traits.construct_vector_2_object()(CGAL::ORIGIN, ps),
+            m_traits.construct_scaled_vector_2_object()(
+              m_traits.construct_vector_2_object()(CGAL::ORIGIN, pb), -coord)),
+          m * one_minus_coord));
+
+      /*
+      // only normal
+      FT bin = m/M;
+      FT center = start + 0.5*bin;
+      Point pc = CGAL::ORIGIN + (1.0-center)*(pa - CGAL::ORIGIN) + center*(pb - CGAL::ORIGIN);
+      start += bin;
+      grad = grad + m*(bin*bin/12.0)*(pa - pb);
+      grad = grad + m*(1.0-center)*(pc - pf);
+       */
+
+      /*
+      // only normal
+      FT bin = m/M;
+      FT center = start + 0.5*bin;
+      FT one_minus_center = 1.0 - center;
+      start += bin;
+
+      coef += m*bin*bin/12.0;
+      rhs = rhs + m*(bin*bin/12.0)*(pb - CGAL::ORIGIN);
+
+      coef += m*one_minus_center*(coord - center);
+      rhs = rhs + m*one_minus_center*(coord - center)*(pb - CGAL::ORIGIN);
+       */
+    }
+  }
+
+  void print_stats_debug() const
+  {
+    int nb_solid = 0;
+    int nb_ghost = 0;
+    for (Finite_edges_iterator ei = m_dt.finite_edges_begin();
+        ei != m_dt.finite_edges_end(); ++ei)
+    {
+      Edge edge = *ei;
+      if (m_dt.is_ghost(edge))
+        nb_ghost++;
+      else
+        nb_solid++;
+    }
+
+    std::cerr << "STATS" << std::endl;
+    std::cerr << "# vertices : " << m_dt.number_of_vertices()-4 << std::endl;
+    std::cerr << "# isolated vertices : " << number_of_isolated_vertices() << std::endl;
+    std::cerr << "# triangles: " << m_dt.number_of_faces() << std::endl;
+    std::cerr << "# edges: " << m_dt.tds().number_of_edges() << std::endl;
+    std::cerr << "# solid: " << nb_solid << std::endl;
+    std::cerr << "# ghost: " << nb_ghost << std::endl;
+  }
+
+
+  /*!
+    Returns the number of vertices present in the reconstructed triangulation.
+   */
+  std::size_t number_of_vertices() const {
+    return m_dt.number_of_vertices() - 4;
+
+  }
+
+  /*!
+    Returns the number of isolated vertices present in the reconstructed triangulation.
+  */
+  int number_of_isolated_vertices () const
+  {
+    int nb_isolated = 0;
+    for (Vertex_iterator vi = m_dt.vertices_begin();
+         vi != m_dt.vertices_end(); ++vi)
+      {
+        if (!((*vi).has_sample_assigned()))
+          continue;
+
+        typename Triangulation::Edge_circulator start = m_dt.incident_edges(vi);
+        typename Triangulation::Edge_circulator cur   = start;
+
+        do {
+          if (!m_dt.is_ghost(*cur)) {
+            ++nb_isolated;
+            break;
+          }
+          ++cur;
+        } while (cur != start);
+      }
+    return nb_isolated;
+  }
+
+  /*!
+    Returns the number of (solid) edges present in the reconstructed triangulation.
+   */
+  int number_of_edges() const {
+    int nb_solid = 0;
+    for (Finite_edges_iterator ei = m_dt.finite_edges_begin();
+         ei != m_dt.finite_edges_end(); ++ei)
+    {
+      Edge edge = *ei;
+      if (m_dt.is_ghost(edge))
+        continue;
+      nb_solid++;
+    }
+    return nb_solid;
+  }
+
+
+  /*!
+    Returns the cost of the (solid) edges present in the 
+    reconstructed triangulation.
+   */
+  FT total_edge_cost() const {
+    FT total_cost = 0;
+    for (Finite_edges_iterator ei = m_dt.finite_edges_begin();
+         ei != m_dt.finite_edges_end(); ++ei) 
+    {
+      Edge edge = *ei;
+      if (m_dt.is_ghost(edge))
+        continue;
+
+      total_cost += m_dt.get_cost(edge).finalize();
+    }
+    return total_cost;
+  }
+
+  /// \endcond
+
+
+  /// \name Simplification 
+  /// You can freely mix calls of the following functions. 
+  /// @{
+  /*!
+    Computes a shape consisting of `np` points, reconstructing the input
+    points.
+    \param np The number of points which will be present in the output.
+    \return `true` if the number of points `np` was reached, `false`
+    if the algorithm was prematurely ended because no more edge
+    collapse was possible.
+   */
+  bool run_until(std::size_t np) {
+    CGAL::Real_timer timer;
+    if (m_verbose > 0)
+      std::cerr << "reconstruct until " << np << " V";
+
+    timer.start();
+    std::size_t N = np + 4;
+    std::size_t performed = 0;
+    while (m_dt.number_of_vertices() > N) {
+      bool ok = decimate();
+      if (!ok)
+        break;
+      performed++;
+    }
+
+    if (m_verbose)
+      std::cerr << " done" << " (" << performed
+                << " iters, " << m_dt.number_of_vertices() - 4 << " V "
+                << timer.time() << " s)"
+                << std::endl;
+    
+    return (m_dt.number_of_vertices() <= N);
+  }
+
+  /*!
+    Computes a shape, reconstructing the input, by performing `steps`
+    edge collapse operators on the output simplex.
+    \param steps The number of edge collapse operators to be performed.
+    \return `true` if the required number of steps was performed,
+    `false` if the algorithm was prematurely ended because no more
+    edge collapse was possible.
+   */
+  bool run(const unsigned steps) {
+    CGAL::Real_timer timer;
+    if (m_verbose > 0)
+      std::cerr << "reconstruct " << steps;
+
+    timer.start();
+    unsigned performed = 0;
+    for (unsigned i = 0; i < steps; ++i) {
+      bool ok = decimate();
+      if (!ok)
+        break;
+      performed++;
+    }
+
+    if (m_verbose > 0)
+      std::cerr << " done" << " (" << performed << "/"
+                << steps << " iters, " << m_dt.number_of_vertices() - 4
+                << " V, " << timer.time() << " s)"
+                << std::endl;
+    return (performed == steps);
+  }
+
+
+  /*!
+    Since noise and missing data may prevent the reconstructed shape to have sharp corners well located, the algorithm offers the possibility to automatically relocate points after each edge collapse. The new location of the points is chosen such that the fitting of the output segments to the input points is improved. 
+   */
+  void relocate_all_points() {
+    CGAL::Real_timer timer;
+    if (m_verbose > 0)
+      std::cerr << "relocate all points" << "...";
+
+    timer.start();
+    m_mindex.clear(); // pqueue must be recomputed
+
+    for (Finite_vertices_iterator v = m_dt.finite_vertices_begin();
+        v != m_dt.finite_vertices_end(); ++v) {
+      if (v->pinned())
+        continue;
+      v->relocated() = compute_relocation(v);
+    }
+
+    for (Finite_vertices_iterator v = m_dt.finite_vertices_begin();
+        v != m_dt.finite_vertices_end(); ++v) {
+      if (v->pinned())
+        continue;
+      if (v->point() == v->relocated())
+        continue;
+
+      Edge_vector hull;
+      m_dt.get_edges_from_star_minus_link(v, hull, false);
+      bool ok = m_dt.is_in_kernel(v->relocated(), hull.begin(),
+          hull.end());
+
+      if (ok) {
+        // do relocation
+        FT norm_bef = m_dt.compute_cost_around_vertex(v).norm();
+        relocate_one_vertex(v);
+        FT norm_aft = m_dt.compute_cost_around_vertex(v).norm();
+
+        // undo relocation
+        if (norm_bef < norm_aft)
+          relocate_one_vertex(v);
+      }
+    }
+
+    if (m_verbose > 0)
+      std::cerr << "done" << " (" << timer.time() << " s)" << std::endl;
+  }
+
+  /// @}
+
+  /// \name Output
+  /// @{
+
+  /*!
+    Writes the points and segments of the output simplex in an indexed format into output iterators.
+        \tparam PointOutputIterator An output iterator with value type 
+                \link Optimal_transportation_reconstruction_2::Point Point \endlink.
+        \tparam IndexOutputIterator An output iterator with value type 
+                `std::size_t`.
+        \tparam IndexPairOutputIterator An output iterator with value type 
+                `std::pair<std::size_t, std::size_t>`.
+
+        \param points The output iterator for all points.
+        \param isolated_points The output iterator for the indices of isolated points.
+        \param segments The output iterator for the pairs of segment indices.
+   */
+  template <
+    typename PointOutputIterator,
+    typename IndexOutputIterator,
+    typename IndexPairOutputIterator>
+  CGAL::cpp11::tuple<
+    PointOutputIterator, 
+    IndexOutputIterator,
+    IndexPairOutputIterator>
+  indexed_output(
+    PointOutputIterator points,
+    IndexOutputIterator isolated_points,
+    IndexPairOutputIterator segments) const
+  {
+    std::vector<Point> isolated_points_;
+    std::vector<Segment> edges;
+
+    list_output (
+        std::back_inserter(isolated_points_), std::back_inserter(edges));
+
+    // vertices_of_edges
+    std::set<Point> edge_vertices;
+    for (typename std::vector<Segment>::iterator it = edges.begin();
+        it != edges.end(); it++) {
+
+      Point a = (*it).source();
+      Point b = (*it).target();
+
+      edge_vertices.insert(a);
+      edge_vertices.insert(b);
+    }
+
+    std::size_t count_points = 0;
+    for (typename std::set<Point>::iterator it = edge_vertices.begin();
+        it != edge_vertices.end(); it++) {
+
+      *points++ = *it;
+      ++count_points;
+    }
+
+    for (typename std::vector<Point>::iterator it = isolated_points_.begin();
+        it != isolated_points_.end(); it++) {
+
+      *isolated_points++ = count_points;
+      *points++ = *it;
+      ++count_points;
+    }
+
+    for (typename std::vector<Segment>::iterator it = edges.begin();
+        it != edges.end(); it++) {
+
+      Point const& a = it->source();
+      Point const& b = it->target();
+
+      typename std::set<Point>::iterator it_a = edge_vertices.find(a);
+      typename std::set<Point>::iterator it_b = edge_vertices.find(b);
+
+      std::size_t pos_a = std::distance(edge_vertices.begin(), it_a);
+      std::size_t pos_b = std::distance(edge_vertices.begin(), it_b);
+
+      *segments++ = std::make_pair(pos_a, pos_b);
+    }
+
+    return CGAL::cpp11::make_tuple(points, isolated_points, segments);
+  }
+
+  /*!
+     Returns the solid edges and vertices present after the reconstruction
+     process finished.
+
+    \details It takes two output iterators, one for storing the
+    isolated points and one for storing the edges of the reconstructed shape.
+
+    \tparam PointOutputIterator An output iterator with value type 
+            \link Optimal_transportation_reconstruction_2::Point Point \endlink.
+    \tparam SegmentOutputIterator An output iterator with value type 
+            \link Optimal_transportation_reconstruction_2::Segment Segment \endlink.
+   */
+  template<class PointOutputIterator, class SegmentOutputIterator>
+  void list_output (PointOutputIterator v_it, SegmentOutputIterator e_it) const
+  {
+    for (Vertex_iterator vi = m_dt.vertices_begin();
+         vi != m_dt.vertices_end(); ++vi)
+    {
+      bool incident_edges_have_sample = false;
+      typename Triangulation::Edge_circulator start = m_dt.incident_edges(vi);
+      typename Triangulation::Edge_circulator cur   = start;
+
+      do {
+        if (!m_dt.is_ghost(*cur)) {
+          incident_edges_have_sample = true;
+          break;
+        }
+        ++cur;
+      } while (cur != start);
+
+      if (!incident_edges_have_sample) {
+        if ((*vi).has_sample_assigned()) {
+          Point p = (*vi).point();
+          *v_it = p;
+          v_it++;
+        }
+      }
+    }
+
+    for (Finite_edges_iterator ei = m_dt.finite_edges_begin(); ei != m_dt.finite_edges_end(); ++ei)
+    {
+      Edge edge = *ei;
+      if (m_dt.is_ghost(edge))
+        continue;
+
+      int index = edge.second;
+      Vertex_handle source = edge.first->vertex( (index+1)%3 );
+      Vertex_handle target = edge.first->vertex( (index+2)%3 );
+
+      Segment s = m_traits.construct_segment_2_object()(
+        source->point(), target->point());
+      *e_it = s;
+      e_it++;
+    }
+  }
+  /// \endcond
+
+
+  /// \cond SKIP_IN_MANUAL
+  void extract_tds_output(Triangulation& rt2) const {
+    rt2 = m_dt;
+    //mark vertices
+    for (Vertex_iterator vi = rt2.vertices_begin();
+        vi != rt2.vertices_end(); ++vi)
+    {
+      bool incident_edges_have_sample = false;
+      typename Triangulation::Edge_circulator start = rt2.incident_edges(vi);
+      typename Triangulation::Edge_circulator cur = start;
+
+      do {
+        if (!rt2.is_ghost(*cur)) {
+          incident_edges_have_sample = true;
+          break;
+        }
+        ++cur;
+      } while (cur != start);
+
+      if (!incident_edges_have_sample) {
+        if ((*vi).has_sample_assigned())
+          (*vi).set_relevance(1);
+      }
+    }
+
+    // mark edges
+    for (Finite_edges_iterator ei = rt2.finite_edges_begin(); ei != rt2.finite_edges_end(); ++ei)
+    {
+      Edge edge = *ei;
+      FT relevance = 0;
+      if (!rt2.is_ghost(edge)) {
+        relevance = rt2.get_edge_relevance(edge); // >= 0
+      }
+      edge.first->relevance(edge.second) = relevance;
+    }
+  }
+
+
+  /// \endcond
+  /// @}
+
+};
+} // namespace
+
+#endif // CGAL_OPTIMAL_TRANSPORTATION_RECONSTRUCTION_2_H_
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Optimisation/Access_coordinates_begin_2.h b/3rdparty/CGAL/include/CGAL/Optimisation/Access_coordinates_begin_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Optimisation/Access_coordinates_begin_2.h
rename to 3rdparty/CGAL/include/CGAL/Optimisation/Access_coordinates_begin_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Optimisation/Access_coordinates_begin_3.h b/3rdparty/CGAL/include/CGAL/Optimisation/Access_coordinates_begin_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Optimisation/Access_coordinates_begin_3.h
rename to 3rdparty/CGAL/include/CGAL/Optimisation/Access_coordinates_begin_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Optimisation/Access_coordinates_begin_d.h b/3rdparty/CGAL/include/CGAL/Optimisation/Access_coordinates_begin_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Optimisation/Access_coordinates_begin_d.h
rename to 3rdparty/CGAL/include/CGAL/Optimisation/Access_coordinates_begin_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Optimisation/Access_dimension_2.h b/3rdparty/CGAL/include/CGAL/Optimisation/Access_dimension_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Optimisation/Access_dimension_2.h
rename to 3rdparty/CGAL/include/CGAL/Optimisation/Access_dimension_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Optimisation/Access_dimension_3.h b/3rdparty/CGAL/include/CGAL/Optimisation/Access_dimension_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Optimisation/Access_dimension_3.h
rename to 3rdparty/CGAL/include/CGAL/Optimisation/Access_dimension_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Optimisation/Access_dimension_d.h b/3rdparty/CGAL/include/CGAL/Optimisation/Access_dimension_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Optimisation/Access_dimension_d.h
rename to 3rdparty/CGAL/include/CGAL/Optimisation/Access_dimension_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Optimisation/Construct_point_2.h b/3rdparty/CGAL/include/CGAL/Optimisation/Construct_point_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Optimisation/Construct_point_2.h
rename to 3rdparty/CGAL/include/CGAL/Optimisation/Construct_point_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Optimisation/Construct_point_3.h b/3rdparty/CGAL/include/CGAL/Optimisation/Construct_point_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Optimisation/Construct_point_3.h
rename to 3rdparty/CGAL/include/CGAL/Optimisation/Construct_point_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Optimisation/Construct_point_d.h b/3rdparty/CGAL/include/CGAL/Optimisation/Construct_point_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Optimisation/Construct_point_d.h
rename to 3rdparty/CGAL/include/CGAL/Optimisation/Construct_point_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Optimisation/assertions.h b/3rdparty/CGAL/include/CGAL/Optimisation/assertions.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Optimisation/assertions.h
rename to 3rdparty/CGAL/include/CGAL/Optimisation/assertions.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Optimisation/basic.h b/3rdparty/CGAL/include/CGAL/Optimisation/basic.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Optimisation/basic.h
rename to 3rdparty/CGAL/include/CGAL/Optimisation/basic.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Optimisation/debug.h b/3rdparty/CGAL/include/CGAL/Optimisation/debug.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Optimisation/debug.h
rename to 3rdparty/CGAL/include/CGAL/Optimisation/debug.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Optimisation_d_traits_2.h b/3rdparty/CGAL/include/CGAL/Optimisation_d_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Optimisation_d_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Optimisation_d_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Optimisation_d_traits_3.h b/3rdparty/CGAL/include/CGAL/Optimisation_d_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Optimisation_d_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/Optimisation_d_traits_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Optimisation_d_traits_d.h b/3rdparty/CGAL/include/CGAL/Optimisation_d_traits_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Optimisation_d_traits_d.h
rename to 3rdparty/CGAL/include/CGAL/Optimisation_d_traits_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Orientation_Linf_2.h b/3rdparty/CGAL/include/CGAL/Orientation_Linf_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Orientation_Linf_2.h
rename to 3rdparty/CGAL/include/CGAL/Orientation_Linf_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Origin.h b/3rdparty/CGAL/include/CGAL/Origin.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Origin.h
rename to 3rdparty/CGAL/include/CGAL/Origin.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Origin_impl.h b/3rdparty/CGAL/include/CGAL/Origin_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Origin_impl.h
rename to 3rdparty/CGAL/include/CGAL/Origin_impl.h
diff --git a/3rdparty/CGAL/include/CGAL/Orthogonal_incremental_neighbor_search.h b/3rdparty/CGAL/include/CGAL/Orthogonal_incremental_neighbor_search.h
new file mode 100644
index 0000000..13eca80
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Orthogonal_incremental_neighbor_search.h
@@ -0,0 +1,620 @@
+// Copyright (c) 2002,2011 Utrecht University (The Netherlands).
+// 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
+// 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(s)     : Hans Tangelder (<hanst at cs.uu.nl>)
+
+#ifndef CGAL_ORTHOGONAL_INCREMENTAL_NEIGHBOR_SEARCH
+#define CGAL_ORTHOGONAL_INCREMENTAL_NEIGHBOR_SEARCH
+
+#include <cstring>
+#include <list>
+#include <queue>
+#include <memory>
+#include <CGAL/Kd_tree.h>
+#include <CGAL/Euclidean_distance.h>
+#include <CGAL/tuple.h>
+
+namespace CGAL {
+
+  template <class SearchTraits, 
+            class Distance_= typename internal::Spatial_searching_default_distance<SearchTraits>::type,
+            class Splitter_ = Sliding_midpoint<SearchTraits>,
+            class Tree_= Kd_tree<SearchTraits, Splitter_, Tag_true> >
+  class Orthogonal_incremental_neighbor_search {
+
+  public:
+    typedef Splitter_ Splitter;
+    typedef Tree_  Tree;
+    typedef Distance_ Distance;
+    typedef typename SearchTraits::Point_d Point_d;
+    typedef typename Distance::Query_item Query_item;
+    typedef typename SearchTraits::FT FT;
+    typedef typename Tree::Point_d_iterator Point_d_iterator;
+    typedef typename Tree::Node_const_handle Node_const_handle;
+
+    typedef std::pair<Point_d,FT> Point_with_transformed_distance;
+    typedef CGAL::cpp11::tuple<Node_const_handle,FT,std::vector<FT> > Node_with_distance;
+    typedef std::vector<Node_with_distance*> Node_with_distance_vector;
+    typedef std::vector<Point_with_transformed_distance*> Point_with_transformed_distance_vector;
+
+    template<class T>
+    struct Object_wrapper
+    {   
+      T object;
+      Object_wrapper(const T& t):object(t){}
+      const T& operator* () const { return object; }
+      const T* operator-> () const { return &object; }
+    };
+
+    class Iterator_implementation {
+      SearchTraits traits;
+    public:
+
+      int number_of_neighbours_computed;
+      int number_of_internal_nodes_visited;
+      int number_of_leaf_nodes_visited;
+      int number_of_items_visited;
+
+    private:
+
+      typedef std::vector<FT> Distance_vector;
+    
+      Distance_vector dists;
+
+      Distance Orthogonal_distance_instance;
+    
+      FT multiplication_factor;
+
+      Query_item query_point;
+
+      FT distance_to_root;
+
+      bool search_nearest_neighbour;
+
+      FT rd;
+
+
+      class Priority_higher {
+      public:
+
+        bool search_nearest;
+
+        Priority_higher(bool search_the_nearest_neighbour) 
+	  : search_nearest(search_the_nearest_neighbour)
+	{} 
+
+        //highest priority is smallest distance
+        bool 
+	operator() (Node_with_distance* n1, Node_with_distance* n2) const
+	{
+	  return (search_nearest) ? (CGAL::cpp11::get<1>(*n1) > CGAL::cpp11::get<1>(*n2)) : (CGAL::cpp11::get<1>(*n2) > CGAL::cpp11::get<1>(*n1));
+        }
+      };
+
+      class Distance_smaller {
+
+      public:
+
+        bool search_nearest;
+
+        Distance_smaller(bool search_the_nearest_neighbour) 
+	  : search_nearest(search_the_nearest_neighbour)
+	{}
+
+        //highest priority is smallest distance
+        bool operator() (Point_with_transformed_distance* p1, Point_with_transformed_distance* p2) const
+	{
+	  return (search_nearest) ? (p1->second > p2->second) : (p2->second > p1->second);
+        }
+      };
+
+
+      std::priority_queue<Node_with_distance*, Node_with_distance_vector,
+	                  Priority_higher> PriorityQueue;
+
+    public:
+      std::priority_queue<Point_with_transformed_distance*, Point_with_transformed_distance_vector,
+	                  Distance_smaller> Item_PriorityQueue;
+
+
+    public:
+
+      int reference_count;
+
+    
+
+      // constructor
+      Iterator_implementation(const Tree& tree,const Query_item& q, const Distance& tr,
+			      FT Eps=FT(0.0), bool search_nearest=true)
+	: traits(tree.traits()),number_of_neighbours_computed(0), number_of_internal_nodes_visited(0), 
+	number_of_leaf_nodes_visited(0), number_of_items_visited(0),
+	Orthogonal_distance_instance(tr), multiplication_factor(Orthogonal_distance_instance.transformed_distance(FT(1.0)+Eps)), 
+	query_point(q), search_nearest_neighbour(search_nearest), 
+	PriorityQueue(Priority_higher(search_nearest)), Item_PriorityQueue(Distance_smaller(search_nearest)),
+	reference_count(1)
+	  
+	  
+      {
+        if (tree.empty()) return;
+
+        typename SearchTraits::Construct_cartesian_const_iterator_d ccci=traits.construct_cartesian_const_iterator_d_object();
+        int dim = static_cast<int>(std::distance(ccci(q), ccci(q,0)));
+
+        dists.resize(dim);
+        for(int i=0 ; i<dim ; ++i){
+          dists[i] = 0;
+        }
+        
+        if (search_nearest){ 
+	  distance_to_root=
+	    Orthogonal_distance_instance.min_distance_to_rectangle(q, tree.bounding_box(),dists);
+          Node_with_distance *The_Root = new Node_with_distance(tree.root(),
+							        distance_to_root, dists);
+          PriorityQueue.push(The_Root);
+
+          // rd is the distance of the top of the priority queue to q
+          rd=CGAL::cpp11::get<1>(*The_Root);
+          Compute_the_next_nearest_neighbour();
+        }
+         else{
+           distance_to_root=
+   	 Orthogonal_distance_instance.max_distance_to_rectangle(q,
+						tree.bounding_box(), dists);
+           Node_with_distance *The_Root = new Node_with_distance(tree.root(),
+                                                                 distance_to_root, dists);
+        PriorityQueue.push(The_Root);
+
+        // rd is the distance of the top of the priority queue to q
+        rd=CGAL::cpp11::get<1>(*The_Root);
+        Compute_the_next_furthest_neighbour();
+         }
+
+        
+      }
+
+      // * operator
+      const Point_with_transformed_distance& 
+      operator* () const 
+      {
+	return *(Item_PriorityQueue.top());
+      }
+
+      // prefix operator
+      Iterator_implementation& 
+      operator++() 
+      {
+        Delete_the_current_item_top();
+        if(search_nearest_neighbour)
+          Compute_the_next_nearest_neighbour();
+        else
+          Compute_the_next_furthest_neighbour();
+        return *this;
+      }
+
+      // postfix operator
+      Object_wrapper<Point_with_transformed_distance>
+      operator++(int) 
+      {
+        Object_wrapper<Point_with_transformed_distance> result( *(Item_PriorityQueue.top()) );
+        ++*this;
+        return result;
+      }
+
+      // Print statistics of the general priority search process.
+      std::ostream& 
+      statistics (std::ostream& s) const {
+    	s << "Orthogonal priority search statistics:" 
+	  << std::endl;
+    	s << "Number of internal nodes visited:" 
+	  << number_of_internal_nodes_visited << std::endl;
+    	s << "Number of leaf nodes visited:" 
+	  << number_of_leaf_nodes_visited << std::endl;
+    	s << "Number of items visited:" 
+	  << number_of_items_visited << std::endl;
+        s << "Number of neighbours computed:" 
+	  << number_of_neighbours_computed << std::endl;
+        return s;
+      }
+
+
+      //destructor
+      ~Iterator_implementation() 
+      {
+	while (!PriorityQueue.empty()) {
+	  Node_with_distance* The_top=PriorityQueue.top();
+	  PriorityQueue.pop();
+	  delete The_top;
+	}
+	while (!Item_PriorityQueue.empty()) {
+	  Point_with_transformed_distance* The_top=Item_PriorityQueue.top();
+	  Item_PriorityQueue.pop();
+	  delete The_top;
+        }
+      }
+
+    private:
+
+      void 
+      Delete_the_current_item_top() 
+      {
+        Point_with_transformed_distance* The_item_top=Item_PriorityQueue.top();
+        Item_PriorityQueue.pop();
+        delete The_item_top;
+      }
+
+      void 
+      Compute_the_next_nearest_neighbour() 
+      {
+        // compute the next item
+        bool next_neighbour_found=false;
+        if (!(Item_PriorityQueue.empty())) {
+	    next_neighbour_found=
+	      (multiplication_factor*rd > Item_PriorityQueue.top()->second);
+        }
+	typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object();
+	typename SearchTraits::Cartesian_const_iterator_d query_point_it = construct_it(query_point);
+        // otherwise browse the tree further
+        while ((!next_neighbour_found) && (!PriorityQueue.empty())) {
+	  Node_with_distance* The_node_top=PriorityQueue.top();
+	  Node_const_handle N= CGAL::cpp11::get<0>(*The_node_top);
+          dists = CGAL::cpp11::get<2>(*The_node_top);
+	  PriorityQueue.pop();
+	  delete The_node_top;
+	  FT copy_rd=rd;
+	  while (!(N->is_leaf())) { // compute new distance
+            typename Tree::Internal_node_const_handle node =
+            static_cast<typename Tree::Internal_node_const_handle>(N);
+	    number_of_internal_nodes_visited++;
+	    int new_cut_dim=node->cutting_dimension();
+	    FT new_rd,dst = dists[new_cut_dim];
+	    FT val = *(query_point_it + new_cut_dim);
+            FT diff1 = val - node->upper_low_value();
+            FT diff2 = val - node->lower_high_value();
+	    if (diff1 + diff2 < FT(0.0)) {
+              new_rd=
+		Orthogonal_distance_instance.new_distance(copy_rd,dst,diff1,new_cut_dim);
+                
+	      CGAL_assertion(new_rd >= copy_rd);
+                dists[new_cut_dim] = diff1;
+                Node_with_distance *Upper_Child =
+		  new Node_with_distance(node->upper(), new_rd, dists);
+		PriorityQueue.push(Upper_Child);
+                dists[new_cut_dim] = dst;
+		N=node->lower();
+
+	    }
+	    else { // compute new distance
+	      new_rd=Orthogonal_distance_instance.new_distance(copy_rd,dst,diff2,new_cut_dim);  
+	      CGAL_assertion(new_rd >= copy_rd);
+                dists[new_cut_dim] = diff2;
+		Node_with_distance *Lower_Child =
+		  new Node_with_distance(node->lower(), new_rd, dists);
+		PriorityQueue.push(Lower_Child);
+                dists[new_cut_dim] = dst;
+		N=node->upper();
+	    }
+	  }
+	  // n is a leaf
+          typename Tree::Leaf_node_const_handle node =
+            static_cast<typename Tree::Leaf_node_const_handle>(N);
+	  number_of_leaf_nodes_visited++;
+	  if (node->size() > 0) {
+	    for (typename Tree::iterator it=node->begin(); it != node->end(); it++) {
+	      number_of_items_visited++;
+	      FT distance_to_query_point=
+		Orthogonal_distance_instance.transformed_distance(query_point,*it);
+	      Point_with_transformed_distance *NN_Candidate=
+		new Point_with_transformed_distance(*it,distance_to_query_point);
+	      Item_PriorityQueue.push(NN_Candidate);
+	    }
+	    // old top of PriorityQueue has been processed,
+	    // hence update rd
+                
+	    if (!(PriorityQueue.empty()))  {
+	      rd = CGAL::cpp11::get<1>(*PriorityQueue.top());
+		next_neighbour_found =
+                  (multiplication_factor*rd > 
+		   Item_PriorityQueue.top()->second);
+	    }
+	    else // priority queue empty => last neighbour found
+	      {
+		next_neighbour_found=true;
+	      }
+
+	    number_of_neighbours_computed++;
+	  }
+        }   // next_neighbour_found or priority queue is empty
+        // in the latter case also the item priority quee is empty
+      }
+
+
+      void 
+      Compute_the_next_furthest_neighbour() 
+      {
+        // compute the next item
+        bool next_neighbour_found=false;
+        if (!(Item_PriorityQueue.empty())) {
+	    next_neighbour_found=
+	      (rd < multiplication_factor*Item_PriorityQueue.top()->second);
+        }
+	typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object();
+	typename SearchTraits::Cartesian_const_iterator_d query_point_it = construct_it(query_point);
+        // otherwise browse the tree further
+        while ((!next_neighbour_found) && (!PriorityQueue.empty())) {
+	  Node_with_distance* The_node_top=PriorityQueue.top();
+	  Node_const_handle N= CGAL::cpp11::get<0>(*The_node_top);
+          dists = CGAL::cpp11::get<2>(*The_node_top);
+	  PriorityQueue.pop();
+	  delete The_node_top;
+	  FT copy_rd=rd;
+	  while (!(N->is_leaf())) { // compute new distance
+            typename Tree::Internal_node_const_handle node =
+              static_cast<typename Tree::Internal_node_const_handle>(N);
+	    number_of_internal_nodes_visited++;
+	    int new_cut_dim=node->cutting_dimension();
+	    FT new_rd,dst = dists[new_cut_dim];
+	    FT val = *(query_point_it + new_cut_dim);
+            FT diff1 = val - node->upper_low_value();
+            FT diff2 = val - node->lower_high_value();
+	    if (diff1 + diff2 < FT(0.0)) {
+              diff1 = val - node->upper_high_value();
+              new_rd=
+		Orthogonal_distance_instance.new_distance(copy_rd,dst,diff1,new_cut_dim);
+		Node_with_distance *Lower_Child =
+		  new Node_with_distance(node->lower(), copy_rd, dists);
+		PriorityQueue.push(Lower_Child);
+		N=node->upper();
+                dists[new_cut_dim] = diff1;
+		copy_rd=new_rd;
+
+	    }
+	    else { // compute new distance
+              diff2 = val - node->lower_low_value();
+	      new_rd=Orthogonal_distance_instance.new_distance(copy_rd,dst,diff2,new_cut_dim);  
+		Node_with_distance *Upper_Child =
+		  new Node_with_distance(node->upper(), copy_rd, dists);
+		PriorityQueue.push(Upper_Child);
+		N=node->lower();
+                dists[new_cut_dim] = diff2;
+		copy_rd=new_rd;
+	    }
+	  }
+	  // n is a leaf
+          typename Tree::Leaf_node_const_handle node =
+            static_cast<typename Tree::Leaf_node_const_handle>(N);
+	  number_of_leaf_nodes_visited++;
+	  if (node->size() > 0) {
+	    for (typename Tree::iterator it=node->begin(); it != node->end(); it++) {
+	      number_of_items_visited++;
+	      FT distance_to_query_point=
+		Orthogonal_distance_instance.transformed_distance(query_point,*it);
+	      Point_with_transformed_distance *NN_Candidate=
+		new Point_with_transformed_distance(*it,distance_to_query_point);
+	      Item_PriorityQueue.push(NN_Candidate);
+	    }
+	    // old top of PriorityQueue has been processed,
+	    // hence update rd
+                
+	    if (!(PriorityQueue.empty()))  {
+	      rd = CGAL::cpp11::get<1>(*PriorityQueue.top());
+		next_neighbour_found =
+                  (multiplication_factor*rd < 
+		   Item_PriorityQueue.top()->second);
+	    }
+	    else // priority queue empty => last neighbour found
+	      {
+		next_neighbour_found=true;
+	      }
+
+	    number_of_neighbours_computed++;
+	  }
+        }   // next_neighbour_found or priority queue is empty
+        // in the latter case also the item priority quee is empty
+      }
+    }; // class Iterator_implementaion
+  
+
+
+
+
+
+
+    
+
+  public:
+    class iterator;
+    typedef iterator const_iterator;
+
+    // constructor
+    Orthogonal_incremental_neighbor_search(const Tree& tree,  
+					   const Query_item& q, FT Eps = FT(0.0), 
+					   bool search_nearest=true, const Distance& tr=Distance())
+      : m_tree(tree),m_query(q),m_dist(tr),m_Eps(Eps),m_search_nearest(search_nearest)
+    {}
+
+    iterator 
+    begin() const
+    {
+      return iterator(m_tree,m_query,m_dist,m_Eps,m_search_nearest);
+    }
+
+    iterator 
+    end() const
+    {
+      return iterator();
+    }
+
+    std::ostream& 
+    statistics(std::ostream& s) 
+    {
+      begin()->statistics(s);
+      return s;
+    }
+
+
+
+
+    class iterator {
+
+    public:
+
+      typedef std::input_iterator_tag iterator_category;
+      typedef Point_with_transformed_distance       value_type;
+      typedef Point_with_transformed_distance*      pointer;
+      typedef const Point_with_transformed_distance&      reference;
+      typedef std::size_t               size_type;
+      typedef std::ptrdiff_t            difference_type;
+      typedef int distance_type;
+
+      //class Iterator_implementation;
+      Iterator_implementation *Ptr_implementation;
+
+
+    public:
+
+      // default constructor
+      iterator() 
+      : Ptr_implementation(0)
+      {}
+
+      int 
+      the_number_of_items_visited() 
+      {
+        return Ptr_implementation->number_of_items_visited;
+      }
+
+      // constructor
+      iterator(const Tree& tree,const Query_item& q, const Distance& tr=Distance(), FT eps=FT(0.0), 
+	       bool search_nearest=true)
+	: Ptr_implementation(new Iterator_implementation(tree, q, tr, eps, search_nearest))
+	{}
+
+      // copy constructor
+      iterator(const iterator& Iter) 
+      {
+        Ptr_implementation = Iter.Ptr_implementation;
+        if (Ptr_implementation != 0) Ptr_implementation->reference_count++;
+      }
+
+      iterator& operator=(const iterator& Iter)
+      {
+        if (Ptr_implementation != Iter.Ptr_implementation){
+          if (Ptr_implementation != 0 && --(Ptr_implementation->reference_count)==0) {
+              delete Ptr_implementation;
+          }
+          Ptr_implementation = Iter.Ptr_implementation;
+          if (Ptr_implementation != 0) Ptr_implementation->reference_count++;
+        }
+        return *this;
+      }      
+      
+      
+      const Point_with_transformed_distance& 
+      operator* () const 
+      {
+	return *(*Ptr_implementation);
+      }
+      
+      // -> operator
+      const Point_with_transformed_distance*
+      operator-> () const 
+      {
+	return &*(*Ptr_implementation);
+      }
+
+      // prefix operator
+      iterator& 
+      operator++() 
+      {
+        ++(*Ptr_implementation);
+        return *this;
+      }
+
+      // postfix operator
+      Object_wrapper<Point_with_transformed_distance>
+      operator++(int) 
+      {
+	return (*Ptr_implementation)++;
+      }
+
+
+      bool 
+      operator==(const iterator& It) const 
+      {
+        if (
+	    ((Ptr_implementation == 0) || 
+	     Ptr_implementation->Item_PriorityQueue.empty()) &&
+	    ((It.Ptr_implementation == 0) ||  
+	     It.Ptr_implementation->Item_PriorityQueue.empty())
+	    )
+	  return true;
+        // else
+        return (Ptr_implementation == It.Ptr_implementation);
+      }
+
+      bool 
+      operator!=(const iterator& It) const 
+      {
+        return !(*this == It);
+      }
+
+      std::ostream& 
+      statistics (std::ostream& s) 
+      {
+    	Ptr_implementation->statistics(s);
+        return s;
+      }
+
+      ~iterator() 
+      {
+        if (Ptr_implementation != 0) {
+	  Ptr_implementation->reference_count--;
+	  if (Ptr_implementation->reference_count==0) {
+	    delete Ptr_implementation;
+	    Ptr_implementation = 0;
+	  }
+        }
+      }
+
+
+    }; // class iterator
+
+    //data members
+    const Tree& m_tree;
+    Query_item m_query;
+    Distance m_dist;
+    FT m_Eps; 
+    bool m_search_nearest;
+  }; // class 
+
+  template <class Traits, class Query_item, class Distance>
+  void swap (typename Orthogonal_incremental_neighbor_search<Traits, 
+	     Query_item, Distance>::iterator& x,
+	     typename Orthogonal_incremental_neighbor_search<Traits, 
+	     Query_item, Distance>::iterator& y) 
+  {
+    typename Orthogonal_incremental_neighbor_search<Traits, 
+      Query_item, Distance>::iterator::Iterator_implementation
+      *tmp = x.Ptr_implementation;
+    x.Ptr_implementation  = y.Ptr_implementation;
+    y.Ptr_implementation = tmp;
+  }
+
+} // namespace CGAL
+
+#endif // CGAL_ORTHOGONAL_INCREMENTAL_NEIGHBOR_SEARCH_H
diff --git a/3rdparty/CGAL/include/CGAL/Orthogonal_k_neighbor_search.h b/3rdparty/CGAL/include/CGAL/Orthogonal_k_neighbor_search.h
new file mode 100644
index 0000000..308d293
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Orthogonal_k_neighbor_search.h
@@ -0,0 +1,193 @@
+// Copyright (c) 2002,2011 Utrecht University (The Netherlands).
+// 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
+// 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(s)     : Gael Guennebaud (gael.guennebaud at inria.fr), Hans Tangelder (<hanst at cs.uu.nl>)
+
+#ifndef CGAL_ORTHOGONAL_K_NEIGHBOR_SEARCH_H
+#define CGAL_ORTHOGONAL_K_NEIGHBOR_SEARCH_H
+
+#include <CGAL/internal/K_neighbor_search.h>
+
+namespace CGAL {
+
+template <class SearchTraits, 
+          class Distance= typename internal::Spatial_searching_default_distance<SearchTraits>::type,
+          class Splitter= Sliding_midpoint<SearchTraits> ,
+          class Tree= Kd_tree<SearchTraits, Splitter, Tag_true> >
+class Orthogonal_k_neighbor_search: public internal::K_neighbor_search<SearchTraits,Distance,Splitter,Tree> {
+  typedef  internal::K_neighbor_search<SearchTraits,Distance,Splitter,Tree> Base;
+
+  typename SearchTraits::Cartesian_const_iterator_d query_object_it;
+  
+  std::vector<typename Base::FT> dists;
+public:
+  typedef typename Base::FT FT;
+
+
+  Orthogonal_k_neighbor_search(const Tree& tree, const typename Base::Query_item& q,  
+                               unsigned int k=1, FT Eps=FT(0.0), bool Search_nearest=true, const Distance& d=Distance(),bool sorted=true)
+    : Base(q,k,Eps,Search_nearest,d) 
+  {
+    if (tree.empty()) return;
+
+    typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=tree.traits().construct_cartesian_const_iterator_d_object();
+    query_object_it = construct_it(this->query_object);
+
+    int dim = static_cast<int>(std::distance(query_object_it, construct_it(this->query_object,0)));
+
+    dists.resize(dim);
+    for(int i=0;i<dim;i++)
+        dists[i]=0;
+
+    FT distance_to_root;
+    if (this->search_nearest){ 
+      distance_to_root = this->distance_instance.min_distance_to_rectangle(q, tree.bounding_box(),dists);
+      compute_nearest_neighbors_orthogonally(tree.root(), distance_to_root);
+    }
+    else {
+      distance_to_root = this->distance_instance.max_distance_to_rectangle(q, tree.bounding_box(),dists);
+      compute_furthest_neighbors_orthogonally(tree.root(), distance_to_root);
+    }
+
+    
+      
+          
+      
+    if (sorted) this->queue.sort();
+  }
+private:
+
+  void compute_nearest_neighbors_orthogonally(typename Base::Node_const_handle N, FT rd)
+  {
+    if (!(N->is_leaf())) 
+    {
+      typename Tree::Internal_node_const_handle node =
+        static_cast<typename Tree::Internal_node_const_handle>(N);
+      this->number_of_internal_nodes_visited++;
+      int new_cut_dim=node->cutting_dimension();
+      typename Base::Node_const_handle bestChild, otherChild;
+      FT new_off;
+      FT val = *(query_object_it + new_cut_dim);
+      FT diff1 = val - node->upper_low_value();
+      FT diff2 = val - node->lower_high_value();
+      if ( (diff1 + diff2 <  FT(0.0)) ) 
+      {
+          new_off = diff1;
+          bestChild = node->lower();
+          otherChild = node->upper();                      
+      }
+      else // compute new distance
+      {
+          new_off= diff2;
+          bestChild = node->upper();
+          otherChild = node->lower();
+      }
+      compute_nearest_neighbors_orthogonally(bestChild, rd);
+      FT dst=dists[new_cut_dim];
+      FT new_rd = this->distance_instance.new_distance(rd,dst,new_off,new_cut_dim);
+      dists[new_cut_dim]=new_off;
+        if (this->branch_nearest(new_rd)) 
+        {
+          compute_nearest_neighbors_orthogonally(otherChild, new_rd);
+        }
+      dists[new_cut_dim]=dst;
+    }
+    else
+    {
+      // n is a leaf
+      typename Tree::Leaf_node_const_handle node =
+        static_cast<typename Tree::Leaf_node_const_handle>(N);
+      this->number_of_leaf_nodes_visited++;
+      bool full = this->queue.full();
+      FT worst_dist = this->queue.top().second;
+      if (node->size() > 0)
+      {
+        for (typename Tree::iterator it=node->begin(); it != node->end(); it++) 
+        {
+          this->number_of_items_visited++;
+          FT distance_to_query_object=
+            this->distance_instance.transformed_distance(this->query_object,*it);
+          
+          if(!full || distance_to_query_object < worst_dist)
+            this->queue.insert(std::make_pair(&(*it),distance_to_query_object));
+        }
+      }
+    }
+  }    
+
+   void compute_furthest_neighbors_orthogonally(typename Base::Node_const_handle N, FT rd)
+  {
+    if (!(N->is_leaf())) 
+    {
+      typename Tree::Internal_node_const_handle node = 
+        static_cast<typename Tree::Internal_node_const_handle>(N);
+      this->number_of_internal_nodes_visited++;
+      int new_cut_dim=node->cutting_dimension();
+      typename Base::Node_const_handle bestChild, otherChild;
+      FT new_off;
+      FT val = *(query_object_it + new_cut_dim);
+      FT diff1 = val - node->lower_high_value();
+      FT diff2 = val - node->upper_low_value();
+      if ( (diff1 + diff2 >= FT(0.0)) ) 
+      {
+          new_off = 2*val < node->upper_low_value()+node->upper_high_value() ?
+                    val - node->upper_high_value():
+                    val - node->upper_low_value();
+          bestChild = node->lower();
+          otherChild = node->upper();
+      }
+      else // compute new distance
+      {
+          new_off = 2*val < node->lower_low_value()+node->lower_high_value() ?
+                    val - node->lower_high_value():
+                    val - node->lower_low_value();
+          bestChild = node->upper();
+          otherChild = node->lower();
+      }
+      compute_furthest_neighbors_orthogonally(bestChild,rd);
+      FT dst=dists[new_cut_dim];
+      FT new_rd = this->distance_instance.new_distance(rd,dst,new_off,new_cut_dim);
+      dists[new_cut_dim]=new_off;
+        if (this->branch_furthest(new_rd)) 
+          compute_furthest_neighbors_orthogonally(otherChild, new_rd);
+      dists[new_cut_dim]=dst;
+    }
+    else
+    {
+      // n is a leaf
+      typename Tree::Leaf_node_const_handle node = 
+        static_cast<typename Tree::Leaf_node_const_handle>(N);
+      this->number_of_leaf_nodes_visited++;
+      if (node->size() > 0)
+      {
+        for (typename Tree::iterator it=node->begin(); it != node->end(); it++) 
+        {
+          this->number_of_items_visited++;
+          FT distance_to_query_object=
+            this->distance_instance.transformed_distance(this->query_object,*it);
+          this->queue.insert(std::make_pair(&(*it),distance_to_query_object));
+        }
+      }
+    }
+  }    
+  
+}; // class 
+
+} // namespace CGAL
+
+#endif  // CGAL_ORTHOGONAL_K_NEIGHBOR_SEARCH_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/PCA_util.h b/3rdparty/CGAL/include/CGAL/PCA_util.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/PCA_util.h
rename to 3rdparty/CGAL/include/CGAL/PCA_util.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Parabola_2.h b/3rdparty/CGAL/include/CGAL/Parabola_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Parabola_2.h
rename to 3rdparty/CGAL/include/CGAL/Parabola_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Parabola_segment_2.h b/3rdparty/CGAL/include/CGAL/Parabola_segment_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Parabola_segment_2.h
rename to 3rdparty/CGAL/include/CGAL/Parabola_segment_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Param_mesh_patch_circulators.h b/3rdparty/CGAL/include/CGAL/Param_mesh_patch_circulators.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Param_mesh_patch_circulators.h
rename to 3rdparty/CGAL/include/CGAL/Param_mesh_patch_circulators.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Param_mesh_patch_iterators.h b/3rdparty/CGAL/include/CGAL/Param_mesh_patch_iterators.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Param_mesh_patch_iterators.h
rename to 3rdparty/CGAL/include/CGAL/Param_mesh_patch_iterators.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Param_mesh_patch_vertex.h b/3rdparty/CGAL/include/CGAL/Param_mesh_patch_vertex.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Param_mesh_patch_vertex.h
rename to 3rdparty/CGAL/include/CGAL/Param_mesh_patch_vertex.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Parameterization_mesh_feature_extractor.h b/3rdparty/CGAL/include/CGAL/Parameterization_mesh_feature_extractor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Parameterization_mesh_feature_extractor.h
rename to 3rdparty/CGAL/include/CGAL/Parameterization_mesh_feature_extractor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Parameterization_mesh_patch_3.h b/3rdparty/CGAL/include/CGAL/Parameterization_mesh_patch_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Parameterization_mesh_patch_3.h
rename to 3rdparty/CGAL/include/CGAL/Parameterization_mesh_patch_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Parameterization_polyhedron_adaptor_3.h b/3rdparty/CGAL/include/CGAL/Parameterization_polyhedron_adaptor_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Parameterization_polyhedron_adaptor_3.h
rename to 3rdparty/CGAL/include/CGAL/Parameterization_polyhedron_adaptor_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Parameterizer_traits_3.h b/3rdparty/CGAL/include/CGAL/Parameterizer_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Parameterizer_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/Parameterizer_traits_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Partition_2/Circulator_pair.h b/3rdparty/CGAL/include/CGAL/Partition_2/Circulator_pair.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Partition_2/Circulator_pair.h
rename to 3rdparty/CGAL/include/CGAL/Partition_2/Circulator_pair.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Partition_2/Indirect_edge_compare.h b/3rdparty/CGAL/include/CGAL/Partition_2/Indirect_edge_compare.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Partition_2/Indirect_edge_compare.h
rename to 3rdparty/CGAL/include/CGAL/Partition_2/Indirect_edge_compare.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Partition_2/Indirect_less_xy_2.h b/3rdparty/CGAL/include/CGAL/Partition_2/Indirect_less_xy_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Partition_2/Indirect_less_xy_2.h
rename to 3rdparty/CGAL/include/CGAL/Partition_2/Indirect_less_xy_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Partition_2/Indirect_not_less_yx_2.h b/3rdparty/CGAL/include/CGAL/Partition_2/Indirect_not_less_yx_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Partition_2/Indirect_not_less_yx_2.h
rename to 3rdparty/CGAL/include/CGAL/Partition_2/Indirect_not_less_yx_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Partition_2/Iterator_list.h b/3rdparty/CGAL/include/CGAL/Partition_2/Iterator_list.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Partition_2/Iterator_list.h
rename to 3rdparty/CGAL/include/CGAL/Partition_2/Iterator_list.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Partition_2/Matrix.h b/3rdparty/CGAL/include/CGAL/Partition_2/Matrix.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Partition_2/Matrix.h
rename to 3rdparty/CGAL/include/CGAL/Partition_2/Matrix.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Partition_2/Partition_opt_cvx_diagonal_list.h b/3rdparty/CGAL/include/CGAL/Partition_2/Partition_opt_cvx_diagonal_list.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Partition_2/Partition_opt_cvx_diagonal_list.h
rename to 3rdparty/CGAL/include/CGAL/Partition_2/Partition_opt_cvx_diagonal_list.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Partition_2/Partition_opt_cvx_edge.h b/3rdparty/CGAL/include/CGAL/Partition_2/Partition_opt_cvx_edge.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Partition_2/Partition_opt_cvx_edge.h
rename to 3rdparty/CGAL/include/CGAL/Partition_2/Partition_opt_cvx_edge.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Partition_2/Partition_opt_cvx_vertex.h b/3rdparty/CGAL/include/CGAL/Partition_2/Partition_opt_cvx_vertex.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Partition_2/Partition_opt_cvx_vertex.h
rename to 3rdparty/CGAL/include/CGAL/Partition_2/Partition_opt_cvx_vertex.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Partition_2/Partition_traits_2_base.h b/3rdparty/CGAL/include/CGAL/Partition_2/Partition_traits_2_base.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Partition_2/Partition_traits_2_base.h
rename to 3rdparty/CGAL/include/CGAL/Partition_2/Partition_traits_2_base.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Partition_2/Partition_vertex_map.h b/3rdparty/CGAL/include/CGAL/Partition_2/Partition_vertex_map.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Partition_2/Partition_vertex_map.h
rename to 3rdparty/CGAL/include/CGAL/Partition_2/Partition_vertex_map.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Partition_2/Partitioned_polygon_2.h b/3rdparty/CGAL/include/CGAL/Partition_2/Partitioned_polygon_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Partition_2/Partitioned_polygon_2.h
rename to 3rdparty/CGAL/include/CGAL/Partition_2/Partitioned_polygon_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Partition_2/Point_pair_less_xy_2.h b/3rdparty/CGAL/include/CGAL/Partition_2/Point_pair_less_xy_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Partition_2/Point_pair_less_xy_2.h
rename to 3rdparty/CGAL/include/CGAL/Partition_2/Point_pair_less_xy_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Partition_2/Rotation_tree_2.h b/3rdparty/CGAL/include/CGAL/Partition_2/Rotation_tree_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Partition_2/Rotation_tree_2.h
rename to 3rdparty/CGAL/include/CGAL/Partition_2/Rotation_tree_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Partition_2/Rotation_tree_2_impl.h b/3rdparty/CGAL/include/CGAL/Partition_2/Rotation_tree_2_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Partition_2/Rotation_tree_2_impl.h
rename to 3rdparty/CGAL/include/CGAL/Partition_2/Rotation_tree_2_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Partition_2/Rotation_tree_node_2.h b/3rdparty/CGAL/include/CGAL/Partition_2/Rotation_tree_node_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Partition_2/Rotation_tree_node_2.h
rename to 3rdparty/CGAL/include/CGAL/Partition_2/Rotation_tree_node_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Partition_2/Segment_less_yx_2.h b/3rdparty/CGAL/include/CGAL/Partition_2/Segment_less_yx_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Partition_2/Segment_less_yx_2.h
rename to 3rdparty/CGAL/include/CGAL/Partition_2/Segment_less_yx_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Partition_2/Triangulation_indirect_traits_2.h b/3rdparty/CGAL/include/CGAL/Partition_2/Triangulation_indirect_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Partition_2/Triangulation_indirect_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Partition_2/Triangulation_indirect_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Partition_2/Turn_reverser.h b/3rdparty/CGAL/include/CGAL/Partition_2/Turn_reverser.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Partition_2/Turn_reverser.h
rename to 3rdparty/CGAL/include/CGAL/Partition_2/Turn_reverser.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Partition_2/Vertex_visibility_graph_2.h b/3rdparty/CGAL/include/CGAL/Partition_2/Vertex_visibility_graph_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Partition_2/Vertex_visibility_graph_2.h
rename to 3rdparty/CGAL/include/CGAL/Partition_2/Vertex_visibility_graph_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Partition_2/Vertex_visibility_graph_2_impl.h b/3rdparty/CGAL/include/CGAL/Partition_2/Vertex_visibility_graph_2_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Partition_2/Vertex_visibility_graph_2_impl.h
rename to 3rdparty/CGAL/include/CGAL/Partition_2/Vertex_visibility_graph_2_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Partition_2/is_degenerate_polygon_2.h b/3rdparty/CGAL/include/CGAL/Partition_2/is_degenerate_polygon_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Partition_2/is_degenerate_polygon_2.h
rename to 3rdparty/CGAL/include/CGAL/Partition_2/is_degenerate_polygon_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Partition_2/partition_approx_convex_2.h b/3rdparty/CGAL/include/CGAL/Partition_2/partition_approx_convex_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Partition_2/partition_approx_convex_2.h
rename to 3rdparty/CGAL/include/CGAL/Partition_2/partition_approx_convex_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Partition_2/partition_assertions.h b/3rdparty/CGAL/include/CGAL/Partition_2/partition_assertions.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Partition_2/partition_assertions.h
rename to 3rdparty/CGAL/include/CGAL/Partition_2/partition_assertions.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Partition_2/partition_greene_approx_convex_2.h b/3rdparty/CGAL/include/CGAL/Partition_2/partition_greene_approx_convex_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Partition_2/partition_greene_approx_convex_2.h
rename to 3rdparty/CGAL/include/CGAL/Partition_2/partition_greene_approx_convex_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Partition_2/partition_optimal_convex_2.h b/3rdparty/CGAL/include/CGAL/Partition_2/partition_optimal_convex_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Partition_2/partition_optimal_convex_2.h
rename to 3rdparty/CGAL/include/CGAL/Partition_2/partition_optimal_convex_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Partition_2/partition_y_monotone_2.h b/3rdparty/CGAL/include/CGAL/Partition_2/partition_y_monotone_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Partition_2/partition_y_monotone_2.h
rename to 3rdparty/CGAL/include/CGAL/Partition_2/partition_y_monotone_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Partition_is_valid_traits_2.h b/3rdparty/CGAL/include/CGAL/Partition_is_valid_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Partition_is_valid_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Partition_is_valid_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Partition_traits_2.h b/3rdparty/CGAL/include/CGAL/Partition_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Partition_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Partition_traits_2.h
diff --git a/3rdparty/CGAL/include/CGAL/Periodic_2_Delaunay_triangulation_2.h b/3rdparty/CGAL/include/CGAL/Periodic_2_Delaunay_triangulation_2.h
new file mode 100644
index 0000000..ef93464
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Periodic_2_Delaunay_triangulation_2.h
@@ -0,0 +1,5379 @@
+// Copyright (c) 1997-2013 INRIA Sophia-Antipolis (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
+// 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(s)     : Nico Kruithof <Nico at nghk.nl>
+
+#ifndef CGAL_PERIODIC_2_DELAUNAY_TRIANGULATION_2_H
+#define CGAL_PERIODIC_2_DELAUNAY_TRIANGULATION_2_H
+
+#include <CGAL/Periodic_2_triangulation_2.h>
+#include <CGAL/iterator.h>
+
+#ifndef CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
+#include <CGAL/Spatial_sort_traits_adapter_2.h>
+#include <CGAL/internal/info_check.h>
+
+#include <boost/iterator/zip_iterator.hpp>
+#include <boost/mpl/and.hpp>
+#endif //CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
+
+
+namespace CGAL
+{
+
+template <
+class Gt,
+      class Tds = Triangulation_data_structure_2 <
+      Periodic_2_triangulation_vertex_base_2<Gt>,
+      Periodic_2_triangulation_face_base_2<Gt> > >
+class Periodic_2_Delaunay_triangulation_2 : public Periodic_2_triangulation_2<Gt, Tds>
+{
+  typedef Periodic_2_Delaunay_triangulation_2<Gt, Tds>          Self;
+public:
+  typedef Periodic_2_triangulation_2<Gt, Tds>                   Triangulation;
+
+public:
+  typedef Tds                                  Triangulation_data_structure;
+  typedef Gt                                   Geom_traits;
+
+  typedef typename Gt::Periodic_2_offset_2     Offset;
+  typedef typename Gt::Iso_rectangle_2         Iso_rectangle;
+  typedef array<int, 2>                        Covering_sheets;
+
+  typedef typename Gt::FT                      FT;
+  typedef typename Gt::Point_2                 Point;
+  typedef typename Gt::Segment_2               Segment;
+  typedef typename Gt::Triangle_2              Triangle;
+
+  typedef std::pair<Point, Offset>              Periodic_point;
+  typedef array< std::pair<Point, Offset>, 2>   Periodic_segment;
+  typedef array< std::pair<Point, Offset>, 3>   Periodic_triangle;
+  typedef array< std::pair<Point, Offset>, 4>   Periodic_tetrahedron;
+
+  typedef typename Triangulation::size_type             size_type;
+  typedef typename Triangulation::Locate_type           Locate_type;
+  typedef typename Triangulation::Face_handle           Face_handle;
+  typedef typename Triangulation::Vertex_handle         Vertex_handle;
+  typedef typename Triangulation::Edge                  Edge;
+  typedef typename Triangulation::Edge_circulator       Edge_circulator;
+  typedef typename Triangulation::Face_circulator       Face_circulator;
+  typedef typename Triangulation::Vertex_circulator     Vertex_circulator;
+  typedef typename Triangulation::Finite_edges_iterator Finite_edges_iterator;
+  typedef typename Triangulation::Finite_faces_iterator Finite_faces_iterator;
+  typedef typename Triangulation::Finite_vertices_iterator
+  Finite_vertices_iterator;
+  typedef typename Triangulation::All_faces_iterator    All_faces_iterator;
+
+  typedef typename Triangulation::Edge_iterator    Edge_iterator;
+  typedef typename Triangulation::Face_iterator    Face_iterator;
+  typedef typename Triangulation::Vertex_iterator Vertex_iterator;
+
+
+public:
+#ifndef CGAL_CFG_USING_BASE_MEMBER_BUG_2
+  using Triangulation::empty;
+  using Triangulation::cw;
+  using Triangulation::ccw;
+  using Triangulation::tds;
+  using Triangulation::geom_traits;
+  using Triangulation::create_face;
+  using Triangulation::is_infinite;
+  using Triangulation::get_offset;
+  using Triangulation::set_offsets;
+  using Triangulation::int_to_off;
+  using Triangulation::is_1_cover;
+  using Triangulation::dimension;
+  using Triangulation::number_of_vertices;
+  using Triangulation::faces_begin;
+  using Triangulation::finite_edges_begin;
+  using Triangulation::finite_edges_end;
+  using Triangulation::get_neighbor_offset;
+  using Triangulation::combine_offsets;
+  using Triangulation::locate;
+  using Triangulation::number_of_sheets;
+  using Triangulation::orientation;
+  using Triangulation::side_of_oriented_circle;
+  using Triangulation::remove_degree_init;
+  using Triangulation::insert_too_long_edge;
+  using Triangulation::incident_faces;
+#endif
+
+  /// \name Constructors
+  // \{
+  /// Constructor
+  Periodic_2_Delaunay_triangulation_2(const Iso_rectangle & domain = Iso_rectangle(0, 0, 1, 1),
+                                      const Gt& gt = Gt())
+    : Periodic_2_triangulation_2<Gt, Tds>(domain, gt) {}
+
+  /// Copy constructor
+  Periodic_2_Delaunay_triangulation_2(
+    const Periodic_2_Delaunay_triangulation_2<Gt, Tds> &tr)
+    : Periodic_2_triangulation_2<Gt, Tds>(tr)
+  {
+    CGAL_triangulation_postcondition( is_valid(true) );
+  }
+
+  /// Constructor with insertion of points
+  template < class InputIterator >
+  Periodic_2_Delaunay_triangulation_2(InputIterator first, InputIterator last,
+                                      const Iso_rectangle & domain = Iso_rectangle(0, 0, 1, 1),
+                                      const Gt& gt = Gt())
+    : Periodic_2_triangulation_2<Gt, Tds>(domain, gt)
+  {
+    insert(first, last);
+  }
+
+  // \}
+
+  /// \name Insertion-Removal
+  // \{
+  Vertex_handle insert(const Point  &p,
+                       Face_handle start = Face_handle() );
+  Vertex_handle insert(const Point& p,
+                       Locate_type lt,
+                       Face_handle loc, int li );
+
+
+  /// Inserts a point in the triangulation.
+  Vertex_handle push_back(const Point &p);
+
+#ifndef CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
+  template < class InputIterator >
+  std::ptrdiff_t
+  insert(InputIterator first, InputIterator last,
+         bool is_large_point_set = true,
+         typename boost::enable_if <
+         boost::is_convertible <
+         typename std::iterator_traits<InputIterator>::value_type,
+         Point
+         > >::type* = NULL)
+#else
+  template < class InputIterator >
+  std::ptrdiff_t
+  insert(InputIterator first, InputIterator last, bool is_large_point_set = true)
+#endif //CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO 
+  {
+    if (first == last) return 0;
+
+    size_type n = number_of_vertices();
+
+    // The heuristic discards the existing triangulation so it can only be
+    // applied to empty triangulations.
+    if (n != 0) is_large_point_set = false;
+
+    std::set<Vertex_handle> dummy_points;
+    std::vector<Point> points(first, last);
+    typename std::vector<Point>::iterator pbegin = points.begin();
+
+    if (is_large_point_set)
+      {
+        std::vector<Vertex_handle> tmp_dummy_points = this->insert_dummy_points();
+        std::copy(tmp_dummy_points.begin(), tmp_dummy_points.end(),
+                  std::inserter(dummy_points, dummy_points.begin()));
+      }
+    else
+      {
+        std::random_shuffle (points.begin(), points.end());
+        pbegin = points.begin();
+
+        // The empty triangulation is a 1-cover by definition, insert at least one point
+        insert(*pbegin);
+        ++pbegin;
+        while (!is_1_cover())
+          {
+            if (pbegin == points.end())
+              return number_of_vertices() - n;
+            insert(*pbegin);
+            ++pbegin;
+          }
+      }
+
+    CGAL_assertion(is_1_cover());
+
+    // Insert the points
+    spatial_sort (pbegin, points.end(), geom_traits());
+
+    Face_handle f;
+    Locate_type lt;
+    int li;
+
+    for (typename std::vector<Point>::const_iterator p = pbegin, end = points.end();
+         p != end; ++p)
+      {
+        f = locate(*p, lt, li, f);
+
+        if (lt == Triangulation::VERTEX)
+          {
+            dummy_points.erase(f->vertex(li));
+          }
+        else
+          {
+            insert(*p, lt, f, li);
+          }
+      }
+
+    if (is_large_point_set)
+      {
+        for (typename std::set<Vertex_handle>::const_iterator it = dummy_points.begin();
+             it != dummy_points.end(); ++it)
+          {
+            remove(*it);
+          }
+      }
+
+    return number_of_vertices() - n;
+  }
+#ifndef CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
+private:
+  //top stands for tuple-or-pair
+  template <class Info>
+  const Point& top_get_first(const std::pair<Point, Info>& pair) const
+  {
+    return pair.first;
+  }
+  template <class Info>
+  const Info& top_get_second(const std::pair<Point, Info>& pair) const
+  {
+    return pair.second;
+  }
+  template <class Info>
+  const Point& top_get_first(const boost::tuple<Point, Info>& tuple) const
+  {
+    return boost::get<0>(tuple);
+  }
+  template <class Info>
+  const Info& top_get_second(const boost::tuple<Point, Info>& tuple) const
+  {
+    return boost::get<1>(tuple);
+  }
+
+  template <class Tuple_or_pair, class InputIterator>
+  std::ptrdiff_t insert_with_info(InputIterator first, InputIterator last, bool is_large_point_set)
+  {
+    if (first == last) return 0;
+
+    std::vector<std::size_t> indices;
+    std::vector<Point> points;
+    std::vector<typename Tds::Vertex::Info> infos;
+    std::size_t index = 0;
+    for (InputIterator it = first; it != last; ++it)
+      {
+        Tuple_or_pair value = *it;
+        points.push_back( top_get_first(value)  );
+        infos.push_back ( top_get_second(value) );
+        indices.push_back(index++);
+      }
+
+    typedef typename Pointer_property_map<Point>::type Pmap;
+    typedef Spatial_sort_traits_adapter_2<Geom_traits, Pmap> Search_traits;
+
+    size_type n = number_of_vertices();
+
+    // The heuristic discards the existing triangulation so it can only be
+    // applied to empty triangulations.
+    if (n != 0) is_large_point_set = false;
+
+    std::set<Vertex_handle> dummy_points;
+    typename std::vector<std::size_t>::iterator pbegin = indices.begin();
+
+    if (is_large_point_set)
+      {
+        std::vector<Vertex_handle> tmp_dummy_points = this->insert_dummy_points();
+        std::copy(tmp_dummy_points.begin(), tmp_dummy_points.end(),
+                  std::inserter(dummy_points, dummy_points.begin()));
+      }
+    else
+      {
+        std::random_shuffle(indices.begin(), indices.end());
+        pbegin = indices.begin();
+
+        Vertex_handle v_new;
+
+        // The empty triangulation is a 1-cover by definition, insert at least one point
+        v_new = insert(points[*pbegin]);
+        v_new->info() = infos[*pbegin];
+        ++pbegin;
+
+        while (!is_1_cover())
+          {
+            if (pbegin == indices.end())
+              return number_of_vertices() - n;
+            v_new = insert(points[*pbegin]);
+            v_new->info() = infos[*pbegin];
+            ++pbegin;
+          }
+      }
+
+    CGAL_assertion(is_1_cover());
+
+    // Insert the points
+    spatial_sort(indices.begin(),
+                 indices.end(),
+                 Search_traits(make_property_map(points), geom_traits()));
+
+    Face_handle f;
+    Locate_type lt;
+    int li;
+
+    Face_handle hint;
+    for (typename std::vector<std::size_t>::const_iterator it = pbegin, end = indices.end();
+         it != end; ++it)
+      {
+        f = locate(points[*it], lt, li, f);
+
+        if (lt == Triangulation::VERTEX)
+          {
+            // Always copy the info, it might be a dummy vertex
+            f->vertex(li)->info() = infos[*it];
+            dummy_points.erase(f->vertex(li));
+          }
+        else
+          {
+            Vertex_handle v_new = insert(points[*it], lt, f, li);
+            v_new->info() = infos[*it];
+          }
+      }
+
+    if (is_large_point_set)
+      {
+        for (typename std::set<Vertex_handle>::const_iterator it = dummy_points.begin();
+             it != dummy_points.end(); ++it)
+          {
+            remove(*it);
+          }
+      }
+
+    return number_of_vertices() - n;
+  }
+
+
+public:
+
+  template < class InputIterator >
+  std::ptrdiff_t
+  insert( InputIterator first,
+          InputIterator last,
+          bool is_large_point_set = true,
+          typename boost::enable_if <
+          boost::is_convertible <
+          typename std::iterator_traits<InputIterator>::value_type,
+          std::pair<Point, typename internal::Info_check<typename Tds::Vertex>::type>
+          > >::type* = NULL
+        )
+  {
+    return insert_with_info< std::pair<Point, typename internal::Info_check<typename Tds::Vertex>::type> >(first, last, is_large_point_set);
+  }
+
+  template <class  InputIterator_1, class InputIterator_2>
+  std::ptrdiff_t
+  insert( boost::zip_iterator< boost::tuple<InputIterator_1, InputIterator_2> > first,
+          boost::zip_iterator< boost::tuple<InputIterator_1, InputIterator_2> > last,
+          bool is_large_point_set = true,
+          typename boost::enable_if <
+          boost::mpl::and_ <
+          boost::is_convertible< typename std::iterator_traits<InputIterator_1>::value_type, Point >,
+          boost::is_convertible< typename std::iterator_traits<InputIterator_2>::value_type, typename internal::Info_check<typename Tds::Vertex>::type >
+          > >::type* = NULL)
+  {
+    return insert_with_info< boost::tuple<Point, typename internal::Info_check<typename Tds::Vertex>::type> >(first, last, is_large_point_set);
+  }
+#endif //CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
+
+  void  remove(Vertex_handle v );
+  // \}
+
+  /// \name Displacement
+  // \{
+
+  Vertex_handle move_if_no_collision(Vertex_handle v, const Point &p);
+  Vertex_handle move_point(Vertex_handle v, const Point &p);
+  // \}
+
+  /// \name Check - Query
+  // \{
+  /// Returns the vertex closest to p, the point location will start from f
+  Vertex_handle
+  nearest_vertex(const Point& p, Face_handle f = Face_handle()) const;
+
+  template <class OutputItFaces, class OutputItBoundaryEdges>
+  std::pair<OutputItFaces, OutputItBoundaryEdges>
+  get_conflicts_and_boundary(const Point  &p,
+                             OutputItFaces fit,
+                             OutputItBoundaryEdges eit,
+                             Face_handle start = Face_handle()) const
+  {
+    CGAL_triangulation_precondition( dimension() == 2);
+    int li;
+    Locate_type lt;
+    Face_handle fh = locate(p, lt, li, start);
+    switch(lt)
+      {
+        //case Triangulation::EMPTY:
+      case Triangulation::VERTEX:
+        return std::make_pair(fit, eit);
+      case Triangulation::FACE:
+      case Triangulation::EDGE:
+      case Triangulation::EMPTY:
+        *fit++ = fh; //put fh in OutputItFaces
+        std::pair<OutputItFaces, OutputItBoundaryEdges> pit = std::make_pair(fit, eit);
+        pit = propagate_conflicts(p, fh, 0, pit);
+        pit = propagate_conflicts(p, fh, 1, pit);
+        pit = propagate_conflicts(p, fh, 2, pit);
+        return pit;
+      }
+    CGAL_triangulation_assertion(false);
+    return std::make_pair(fit, eit);
+  }
+
+  template <class OutputItFaces>
+  OutputItFaces
+  get_conflicts (const Point  &p,
+                 OutputItFaces fit,
+                 Face_handle start = Face_handle()) const
+  {
+    std::pair<OutputItFaces, Emptyset_iterator> pp =
+      get_conflicts_and_boundary(p, fit, Emptyset_iterator(), start);
+    return pp.first;
+  }
+
+  template <class OutputItBoundaryEdges>
+  OutputItBoundaryEdges
+  get_boundary_of_conflicts(const Point  &p,
+                            OutputItBoundaryEdges eit,
+                            Face_handle start = Face_handle()) const
+  {
+    std::pair<Emptyset_iterator, OutputItBoundaryEdges> pp =
+      get_conflicts_and_boundary(p, Emptyset_iterator(), eit, start);
+    return pp.second;
+  }
+  // \}
+
+
+  /// \name Dual
+  // \{
+  /// Returns the dual of f, which is the circumcenter of f.
+  Point dual(Face_handle f) const;
+  /// Returns the dual of e, which is always a segment in the periodic triangulation.
+  Segment dual(const Edge &e) const ;
+  /// Returns the dual of the edge pointed to by ec.
+  Segment dual(const Edge_circulator& ec) const;
+  /// Returns the dual of the edge pointed to by ei.
+  Segment dual(const Edge_iterator& ei) const;
+
+  template < class Stream>
+  Stream& draw_dual(Stream & ps)
+  {
+    Finite_edges_iterator eit = finite_edges_begin();
+    for (; eit != finite_edges_end(); ++eit)
+      {
+        ps << dual(eit);
+      }
+    return ps;
+  }
+  // \}
+
+  /// \name Checking
+  // \{
+  bool is_valid(bool verbose = false, int level = 0) const;
+
+  /// Checks whether f->vertex(i) lies outside the circumcircle of the face nb
+  inline bool locally_Delaunay(const Face_handle &f, int i, const Face_handle &nb);
+  // \}
+
+private:
+  /// Not in the documentation
+  inline void restore_Delaunay(Vertex_handle v);
+
+#ifndef CGAL_DT2_USE_RECURSIVE_PROPAGATING_FLIP
+  void non_recursive_propagating_flip(Face_handle f, int i);
+  void propagating_flip(const Face_handle& f, int i, int depth = 0);
+#else
+  void propagating_flip(const Face_handle& f, int i);
+#endif
+
+  // auxilliary functions for remove
+  // returns false if we first need to convert to a 9-cover before the vertex can be removed
+  bool remove_single_vertex(Vertex_handle v, const Offset &v_o);
+  void remove_degree_triangulate(Vertex_handle v, std::vector<Face_handle> &f,
+                                 std::vector<Vertex_handle> &w,
+                                 std::vector<int> &i, int d);
+  void remove_degree_triangulate(Vertex_handle v, std::vector<Face_handle> &f,
+                                 std::vector<Vertex_handle> &w, std::vector<Offset> &offset_w,
+                                 std::vector<int> &i, int d);
+  void remove_degree_d(Vertex_handle v, std::vector<Face_handle> &f,
+                       std::vector<Vertex_handle> &w,
+                       std::vector<int> &i, int d);
+  void remove_degree_d(Vertex_handle v, std::vector<Face_handle> &f,
+                       std::vector<Vertex_handle> &w, std::vector<Offset> &offset_w,
+                       std::vector<int> &i, int d);
+  /// Assumes that all offsets are (0,0)
+  void fill_hole_delaunay(std::list<Edge> & hole);
+  /// Fill hole over a periodic boundary
+  void fill_hole_delaunay(std::list<Edge> & hole,
+                          std::map<Vertex_handle, Offset> &vertex_offsets);
+
+  void remove_degree3(Vertex_handle v, std::vector<Face_handle> &f,
+                      std::vector<Vertex_handle> &w,
+                      std::vector<int> &i);
+  void remove_degree3(Vertex_handle v, std::vector<Face_handle> &f,
+                      std::vector<Vertex_handle> &w, std::vector<Offset> &o,
+                      std::vector<int> &i);
+  void remove_degree4(Vertex_handle v, std::vector<Face_handle> &f,
+                      std::vector<Vertex_handle> &w, std::vector<Offset> &o,
+                      std::vector<int> &i);
+  void remove_degree4(Vertex_handle v, std::vector<Face_handle> &f,
+                      std::vector<Vertex_handle> &w,
+                      std::vector<int> &i);
+  void remove_degree5(Vertex_handle v, std::vector<Face_handle> &f,
+                      std::vector<Vertex_handle> &w,
+                      std::vector<int> &i);
+  void remove_degree5(Vertex_handle v, std::vector<Face_handle> &f,
+                      std::vector<Vertex_handle> &w, std::vector<Offset> &o,
+                      std::vector<int> &i);
+  void remove_degree5_star   (Vertex_handle &v,
+                              Face_handle & , Face_handle & , Face_handle & , Face_handle & , Face_handle & ,
+                              Vertex_handle&, Vertex_handle&, Vertex_handle&, Vertex_handle&, Vertex_handle&,
+                              int           , int           , int           , int           , int );
+  void remove_degree5_star   (Vertex_handle &v,
+                              Face_handle & , Face_handle & , Face_handle & , Face_handle & , Face_handle & ,
+                              Vertex_handle&, Vertex_handle&, Vertex_handle&, Vertex_handle&, Vertex_handle&,
+                              Offset&, Offset&, Offset&, Offset&, Offset&,
+                              int           , int           , int           , int           , int );
+  void remove_degree6(Vertex_handle v, std::vector<Face_handle> &f,
+                      std::vector<Vertex_handle> &w,
+                      std::vector<int> &i);
+  void remove_degree6(Vertex_handle v, std::vector<Face_handle> &f,
+                      std::vector<Vertex_handle> &w, std::vector<Offset> &o,
+                      std::vector<int> &i);
+  void remove_degree6_star   (Vertex_handle &v,
+                              Face_handle & , Face_handle & , Face_handle & ,
+                              Face_handle & , Face_handle & , Face_handle & ,
+                              Vertex_handle&, Vertex_handle&, Vertex_handle&,
+                              Vertex_handle&, Vertex_handle&, Vertex_handle&,
+                              int           , int           , int           ,
+                              int           , int           , int );
+  void remove_degree6_star   (Vertex_handle &v,
+                              Face_handle & , Face_handle & , Face_handle & ,
+                              Face_handle & , Face_handle & , Face_handle & ,
+                              Vertex_handle&, Vertex_handle&, Vertex_handle&,
+                              Vertex_handle&, Vertex_handle&, Vertex_handle&,
+                              Offset&, Offset&, Offset&,
+                              Offset&, Offset&, Offset&,
+                              int           , int           , int           ,
+                              int           , int           , int );
+  void remove_degree6_N      (Vertex_handle &v,
+                              Face_handle & , Face_handle & , Face_handle & ,
+                              Face_handle & , Face_handle & , Face_handle & ,
+                              Vertex_handle&, Vertex_handle&, Vertex_handle&,
+                              Vertex_handle&, Vertex_handle&, Vertex_handle&,
+                              int           , int           , int           ,
+                              int           , int           , int  );
+  void remove_degree6_N      (Vertex_handle &v,
+                              Face_handle & , Face_handle & , Face_handle & ,
+                              Face_handle & , Face_handle & , Face_handle & ,
+                              Vertex_handle&, Vertex_handle&, Vertex_handle&,
+                              Vertex_handle&, Vertex_handle&, Vertex_handle&,
+                              Offset&, Offset&, Offset&,
+                              Offset&, Offset&, Offset&,
+                              int           , int           , int           ,
+                              int           , int           , int  );
+  void remove_degree6_antiN  (Vertex_handle &v,
+                              Face_handle & , Face_handle & , Face_handle & ,
+                              Face_handle & , Face_handle & , Face_handle & ,
+                              Vertex_handle&, Vertex_handle&, Vertex_handle&,
+                              Vertex_handle&, Vertex_handle&, Vertex_handle&,
+                              int           , int           , int           ,
+                              int           , int           , int  );
+  void remove_degree6_antiN  (Vertex_handle &v,
+                              Face_handle & , Face_handle & , Face_handle & ,
+                              Face_handle & , Face_handle & , Face_handle & ,
+                              Vertex_handle&, Vertex_handle&, Vertex_handle&,
+                              Vertex_handle&, Vertex_handle&, Vertex_handle&,
+                              Offset&, Offset&, Offset&,
+                              Offset&, Offset&, Offset&,
+                              int           , int           , int           ,
+                              int           , int           , int  );
+  void remove_degree6_diamond(Vertex_handle &v,
+                              Face_handle & , Face_handle & , Face_handle & ,
+                              Face_handle & , Face_handle & , Face_handle & ,
+                              Vertex_handle&, Vertex_handle&, Vertex_handle&,
+                              Vertex_handle&, Vertex_handle&, Vertex_handle&,
+                              int           , int           , int           ,
+                              int           , int           , int  );
+  void remove_degree6_diamond(Vertex_handle &v,
+                              Face_handle & , Face_handle & , Face_handle & ,
+                              Face_handle & , Face_handle & , Face_handle & ,
+                              Vertex_handle&, Vertex_handle&, Vertex_handle&,
+                              Vertex_handle&, Vertex_handle&, Vertex_handle&,
+                              Offset&, Offset&, Offset&,
+                              Offset&, Offset&, Offset&,
+                              int           , int           , int           ,
+                              int           , int           , int  );
+  void remove_degree7(Vertex_handle v, std::vector<Face_handle> &f,
+                      std::vector<Vertex_handle> &w,
+                      std::vector<int> &i);
+  void remove_degree7(Vertex_handle v, std::vector<Face_handle> &f,
+                      std::vector<Vertex_handle> &w, std::vector<Offset> &o,
+                      std::vector<int> &i);
+
+  void rotate7(int j, std::vector<Vertex_handle> &w,
+               std::vector<Face_handle> &f,
+               std::vector<int> &i);
+  void rotate7(int j, std::vector<Vertex_handle> &w,
+               std::vector<Face_handle> &f, std::vector<Offset> &o,
+               std::vector<int> &i);
+  /// Returns whether the simplicity criterion is satisfied
+  void get_offset_degree7(std::vector<Offset> &in_o, int out_o[]);
+  void remove_degree7_star      (Vertex_handle&, int, std::vector<Face_handle> &f,
+                                 std::vector<Vertex_handle> &w, std::vector<int> &i);
+  void remove_degree7_star      (Vertex_handle&, int, std::vector<Face_handle> &f,
+                                 std::vector<Vertex_handle> &w, std::vector<Offset> &o, std::vector<int> &i);
+  void remove_degree7_zigzag    (Vertex_handle&, int, std::vector<Face_handle> &f,
+                                 std::vector<Vertex_handle> &w, std::vector<int> &i);
+  void remove_degree7_zigzag    (Vertex_handle&, int, std::vector<Face_handle> &f,
+                                 std::vector<Vertex_handle> &w, std::vector<Offset> &o, std::vector<int> &i);
+  void remove_degree7_leftdelta (Vertex_handle&, int, std::vector<Face_handle> &f,
+                                 std::vector<Vertex_handle> &w, std::vector<int> &i);
+  void remove_degree7_leftdelta (Vertex_handle&, int, std::vector<Face_handle> &f,
+                                 std::vector<Vertex_handle> &w, std::vector<Offset> &o, std::vector<int> &i);
+  void remove_degree7_rightdelta(Vertex_handle&, int, std::vector<Face_handle> &f,
+                                 std::vector<Vertex_handle> &w, std::vector<int> &i);
+  void remove_degree7_rightdelta(Vertex_handle&, int, std::vector<Face_handle> &f,
+                                 std::vector<Vertex_handle> &w, std::vector<Offset> &o, std::vector<int> &i);
+  void remove_degree7_leftfan   (Vertex_handle&, int, std::vector<Face_handle> &f,
+                                 std::vector<Vertex_handle> &w, std::vector<int> &i);
+  void remove_degree7_leftfan   (Vertex_handle&, int, std::vector<Face_handle> &f,
+                                 std::vector<Vertex_handle> &w, std::vector<Offset> &o, std::vector<int> &i);
+  void remove_degree7_rightfan  (Vertex_handle&, int, std::vector<Face_handle> &f,
+                                 std::vector<Vertex_handle> &w, std::vector<int> &i);
+  void remove_degree7_rightfan  (Vertex_handle&, int, std::vector<Face_handle> &f,
+                                 std::vector<Vertex_handle> &w, std::vector<Offset> &o, std::vector<int> &i);
+
+  bool incircle(int x, int j, int k, int l, std::vector<Face_handle> &,
+                std::vector<Vertex_handle> &w, std::vector<int> &)
+  {
+
+    return side_of_oriented_circle(w[j]->point(), w[k]->point(), w[l]->point(), w[x]->point(),
+                                   true) ==  ON_POSITIVE_SIDE;
+  }
+  bool incircle(int x, int j, int k, int l, std::vector<Face_handle> &,
+                std::vector<Vertex_handle> &w, std::vector<Offset> &o, std::vector<int> &)
+  {
+
+    return side_of_oriented_circle(w[j]->point(), w[k]->point(), w[l]->point(), w[x]->point(),
+                                   o[j], o[k], o[l], o[x],
+                                   true) ==  ON_POSITIVE_SIDE;
+  }
+
+// end of auxilliary functions for remove
+
+
+
+
+  Vertex_handle nearest_vertex_2D(const Point& p, Face_handle f) const;
+
+  void  look_nearest_neighbor(const Point& p,
+                              Face_handle f,
+                              int i,
+                              Vertex_handle& nn) const;
+
+  template <class OutputItFaces, class OutputItBoundaryEdges>
+  std::pair<OutputItFaces, OutputItBoundaryEdges>
+  propagate_conflicts (const Point  &p,
+                       Face_handle fh,
+                       int i,
+                       std::pair<OutputItFaces, OutputItBoundaryEdges>
+                       pit)  const
+  {
+    Face_handle fn = fh->neighbor(i);
+    if (! test_conflict(p, fn))
+      {
+        *(pit.second)++ = Edge(fn, fn->index(fh));
+      }
+    else
+      {
+        *(pit.first)++ = fn;
+        int j = fn->index(fh);
+        pit = propagate_conflicts(p, fn, ccw(j), pit);
+        pit = propagate_conflicts(p, fn, cw(j), pit);
+      }
+    return pit;
+  }
+
+  bool test_conflict(const Point &p, Face_handle fh) const
+  {
+    return side_of_oriented_circle(fh, p, true) ==  ON_POSITIVE_SIDE;
+  }
+};
+
+template < class Gt, class Tds >
+bool
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+is_valid(bool verbose, int level) const
+{
+  // Check the parent
+  bool result = Periodic_2_triangulation_2<Gt, Tds>::is_valid(verbose, level);
+
+  // Check in_sphere:
+  if (dimension() == 2)
+    {
+      const Point *p[4];
+      Offset off[4];
+      for (Face_iterator fit = faces_begin();
+           fit != this->faces_end(); ++fit)
+        {
+          for (int i = 0; i < 3; i++)
+            {
+              p[i] = &fit->vertex(i)->point();
+              off[i] = get_offset(fit, i);
+            }
+
+          /// Check whether the vertices of the neighbor lie outside the circumcircle of the face
+          for (int i = 0; i < 3; ++i)
+            {
+              p[3]   = &fit->vertex(i)->point();
+              off[3] = combine_offsets(get_offset(fit, i), get_neighbor_offset(fit, i));
+
+              result &= ON_POSITIVE_SIDE !=
+                        side_of_oriented_circle(*p[0], *p[1], *p[2], *p[3],
+                                                off[0], off[1], off[2], off[3],
+                                                false);
+              CGAL_triangulation_assertion(result);
+            }
+        }
+    }
+
+  return result;
+}
+
+template < class Gt, class Tds >
+typename Periodic_2_Delaunay_triangulation_2<Gt, Tds>::Vertex_handle
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+nearest_vertex(const Point  &p, Face_handle f) const
+{
+  switch (dimension())
+    {
+    case 0:
+      return Vertex_handle();
+      //break;
+    case 2:
+      return nearest_vertex_2D(p, f);
+      //break;
+    }
+  return Vertex_handle();
+}
+
+template < class Gt, class Tds >
+typename Periodic_2_Delaunay_triangulation_2<Gt, Tds>::Vertex_handle
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+nearest_vertex_2D(const Point& p, Face_handle f) const
+{
+  CGAL_triangulation_precondition(dimension() == 2);
+  f = locate(p, f);
+
+  typename Geom_traits::Compare_distance_2 compare_distance =
+    geom_traits().compare_distance_2_object();
+  Vertex_handle nn =  f->vertex(0);
+  if (compare_distance(p, f->vertex(1)->point(), nn->point()) == SMALLER)
+    nn = f->vertex(1);
+  if (compare_distance(p, f->vertex(2)->point(), nn->point()) == SMALLER)
+    nn = f->vertex(2);
+
+  look_nearest_neighbor(p, f, 0, nn);
+  look_nearest_neighbor(p, f, 1, nn);
+  look_nearest_neighbor(p, f, 2, nn);
+
+  return nn;
+}
+
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+look_nearest_neighbor(const Point& p,
+                      Face_handle f,
+                      int i,
+                      Vertex_handle& nn) const
+{
+  Face_handle  ni = f->neighbor(i);
+  if ( this->side_of_oriented_circle(ni, p, true) != ON_POSITIVE_SIDE )
+    return;
+
+  typename Geom_traits::Compare_distance_2 compare_distance =
+    geom_traits().compare_distance_2_object();
+  i = ni->index(f);
+  if (compare_distance(p, ni->vertex(i)->point(), nn->point()) == SMALLER)
+    nn = ni->vertex(i);
+
+  // recursive exploration of triangles whose circumcircle contains p
+  look_nearest_neighbor(p, ni, ccw(i), nn);
+  look_nearest_neighbor(p, ni, cw(i), nn);
+}
+
+//DUALITY
+template<class Gt, class Tds>
+inline
+typename Periodic_2_Delaunay_triangulation_2<Gt, Tds>::Point
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+dual (Face_handle f) const
+{
+  CGAL_triangulation_precondition (dimension() == 2);
+  return Triangulation::circumcenter(f);
+}
+
+
+template < class Gt, class Tds >
+inline typename Gt::Segment_2
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+dual(const Edge &e) const
+{
+  // dimension==2
+  Face_handle nb = e.first->neighbor(e.second);
+  Point p0 = dual(e.first);
+  Point p1 = dual(nb);
+  Offset o = combine_offsets( Offset(), get_neighbor_offset(e.first, e.second));
+  Segment s = geom_traits().construct_segment_2_object()(p0, p1, o, Offset());
+
+  return s;
+}
+
+template < class Gt, class Tds >
+inline typename Gt::Segment_2
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+dual(const Edge_circulator& ec) const
+{
+  return dual(*ec);
+}
+template < class Gt, class Tds >
+inline typename Gt::Segment_2
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+dual(const Edge_iterator& ei) const
+{
+  return dual(*ei);
+}
+
+///////////////////////////////////////////////////////////////
+//  INSERT
+
+template < class Gt, class Tds >
+inline
+typename Periodic_2_Delaunay_triangulation_2<Gt, Tds>::Vertex_handle
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+insert(const Point  &p,  Face_handle start)
+{
+  CGAL_triangulation_assertion((this->domain().xmin() <= p.x()) &&
+                               (p.x() < this->domain().xmax()));
+  CGAL_triangulation_assertion((this->domain().ymin() <= p.y()) &&
+                               (p.y() < this->domain().ymax()));
+
+  if (empty())
+    {
+      return this->insert_first(p);
+    }
+
+  if (start == Face_handle())
+    {
+      start = this->faces_begin();
+    }
+
+  Locate_type lt;
+  int li;
+  Face_handle loc = locate (p, lt, li, start);
+
+  /// Call the insert function with the located simplex
+  return insert(p, lt, loc, li);
+}
+
+template < class Gt, class Tds >
+inline
+typename Periodic_2_Delaunay_triangulation_2<Gt, Tds>::Vertex_handle
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+push_back(const Point &p)
+{
+  return insert(p);
+}
+
+template < class Gt, class Tds >
+inline
+typename Periodic_2_Delaunay_triangulation_2<Gt, Tds>::Vertex_handle
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+insert(const Point  &p, Locate_type lt, Face_handle loc, int li)
+{
+  Vertex_handle vh = Triangulation::insert(p, lt, loc, li);
+
+  if (lt != Triangulation::VERTEX)
+    {
+      restore_Delaunay(vh);
+
+      if (!is_1_cover())
+        {
+          typename Triangulation::Virtual_vertex_reverse_map_it vertices_it =
+            this->virtual_vertices_reverse().find(vh);
+          CGAL_triangulation_assertion(vertices_it != this->virtual_vertices_reverse().end());
+          const std::vector<Vertex_handle> &virtual_vertices = vertices_it->second;
+          for (size_t i = 0; i < virtual_vertices.size(); ++i)
+            {
+              restore_Delaunay(virtual_vertices[i]);
+            }
+
+          this->try_to_convert_to_one_cover();
+          if (is_1_cover())
+            {
+              CGAL_triangulation_assertion(is_valid());
+            }
+        }
+    }
+
+  return vh;
+}
+
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+restore_Delaunay(Vertex_handle v)
+{
+  Face_handle f = v->face();
+  Face_handle next;
+  int i;
+  Face_handle start(f);
+  do
+    {
+      i = f->index(v);
+      next = f->neighbor(ccw(i));  // turn ccw around v
+      propagating_flip(f, i);
+      f = next;
+    }
+  while(next != start);
+}
+
+
+#ifndef CGAL_DT2_USE_RECURSIVE_PROPAGATING_FLIP
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+non_recursive_propagating_flip(Face_handle f , int i)
+{
+  std::stack<Edge> edges;
+  const Vertex_handle& vp = f->vertex(i);
+  edges.push(Edge(f, i));
+
+  while(! edges.empty())
+    {
+      const Edge& e = edges.top();
+      f = e.first;
+      i = e.second;
+      const Face_handle& n = f->neighbor(i);
+
+      if (locally_Delaunay(f, i, n))
+        {
+          edges.pop();
+          continue;
+        }
+      this->flip_single_edge(f, i);
+      // As we haven't popped it, we don't have to push it
+      edges.push(Edge(n, n->index(vp)));
+    }
+}
+
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+propagating_flip(const Face_handle& f, int i, int depth)
+{
+#ifdef CGAL_DT2_IMMEDIATELY_NON_RECURSIVE_PROPAGATING_FLIP
+  non_recursive_propagating_flip(f, i);
+#else
+  int max_depth = 100;
+  if(depth == max_depth)
+    {
+      non_recursive_propagating_flip(f, i);
+      return;
+    }
+  Face_handle n = f->neighbor(i);
+
+  if (locally_Delaunay(f, i, n))
+    return;
+
+  this->flip_single_edge(f, i);
+  propagating_flip(f, i, depth + 1);
+  i = n->index(f->vertex(i));
+  propagating_flip(n, i, depth + 1);
+#endif
+}
+#else
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+propagating_flip(Face_handle& f, int i)
+{
+  Face_handle nb = f->neighbor(i);
+
+  if (locally_Delaunay(f, nb))
+    return;
+
+  this->flip_single_edge(f, i);
+  propagating_flip(f, i);
+  i = nb->index(f->vertex(i));
+  propagating_flip(nb, i);
+}
+#endif
+
+template < class Gt, class Tds >
+bool
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+locally_Delaunay(const Face_handle &f, int i, const Face_handle &nb)
+{
+  CGAL_BRANCH_PROFILER("locally_Delaunay(), simplicity check failures", tmp);
+
+  bool simplicity_criterion = is_1_cover() && f->has_zero_offsets() && nb->has_zero_offsets();
+
+  const Point *p[4];
+  for (int index = 0; index < 3; ++index)
+    {
+      p[index]   = &nb->vertex(index)->point();
+    }
+  p[3]   = &f->vertex(i)->point();
+
+  Oriented_side os;
+  if (simplicity_criterion)
+    {
+      // No periodic offsets
+      os = side_of_oriented_circle(*p[0], *p[1], *p[2], *p[3], true);
+    }
+  else
+    {
+      CGAL_BRANCH_PROFILER_BRANCH(tmp);
+
+      Offset off[4];
+
+      for (int index = 0; index < 3; ++index)
+        {
+          off[index] = get_offset(nb, index);
+        }
+      off[3] = combine_offsets(get_offset(f, i), get_neighbor_offset(f, i));
+
+      os = side_of_oriented_circle(*p[0], *p[1], *p[2], *p[3],
+                                   off[0], off[1], off[2], off[3], true);
+    }
+
+  return (ON_POSITIVE_SIDE != os);
+}
+
+///////////////////////////////////////////////////////////////
+//  REMOVE    see INRIA RResearch Report 7104
+
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+remove(Vertex_handle v)
+{
+  // Make sure we have the original vertex
+  CGAL_assertion(v == this->get_original_vertex(v));
+
+  CGAL_triangulation_precondition(v != Vertex_handle());
+  CGAL_triangulation_precondition(dimension() == 2);
+
+  if ( this->number_of_vertices() == 1)
+    {
+      // Last vertex
+      Triangulation::remove_first(v);
+      return;
+    }
+
+  if (!remove_single_vertex(v, Offset()))
+    {
+      // The vertex was not removed as we need to revert to the 9-cover first
+      this->convert_to_9_sheeted_covering();
+
+      remove_single_vertex(v, Offset());
+    }
+
+  if (!is_1_cover())
+    {
+      CGAL_assertion(this->virtual_vertices_reverse().find(v) != this->virtual_vertices_reverse().end());
+
+      const std::vector<Vertex_handle> &virtual_copies = this->virtual_vertices_reverse().find(v)->second;
+      for (int i = 0; i < 8; ++i)
+        {
+          remove_single_vertex(virtual_copies[i], Offset((i + 1) / 3, (i + 1) % 3));
+        }
+
+      this->remove_from_virtual_copies(v);
+    }
+}
+
+template < class Gt, class Tds >
+bool
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+remove_single_vertex(Vertex_handle v, const Offset &v_o)
+{
+  static int maxd = 30;
+  static std::vector<Face_handle> f(maxd);
+  static std::vector<int> i(maxd);
+  static std::vector<Vertex_handle> w(maxd);
+  static std::vector<Offset> offset_w(maxd);
+  int d;
+  bool simplicity_criterion;
+
+  if (remove_degree_init(v, v_o, f, w, offset_w, i, d, maxd, simplicity_criterion))
+    {
+      if (is_1_cover())
+        {
+          // Don't delete if the hole is too big and the triangulation is a 1-cover
+          return false;
+        }
+    }
+
+  if (simplicity_criterion)
+    remove_degree_triangulate(v, f, w, i, d);
+  else
+    remove_degree_triangulate(v, f, w, offset_w, i, d);
+
+  this->delete_vertex(v);
+
+  return true;
+}
+
+
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+remove_degree_triangulate(Vertex_handle v,
+                          std::vector<Face_handle> &f,
+                          std::vector<Vertex_handle> &w,
+                          std::vector<int> &i, int d)
+{
+  // degree: 3: 1%, 4: 9%, 5: 23%, 6: 35%, 7: 19%, r: 10%
+
+  switch (d)
+    {
+    case 3:
+      remove_degree3(v, f, w, i);
+      break;
+    case 4:
+      remove_degree4(v, f, w, i);
+      break;
+    case 5:
+      remove_degree5(v, f, w, i);
+      break;
+    case 6:
+      remove_degree6(v, f, w, i);
+      break;
+    case 7:
+      remove_degree7(v, f, w, i);
+      break;
+    default:
+      remove_degree_d(v, f, w, i, d);
+      break;
+    }
+}
+
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+remove_degree_triangulate(Vertex_handle v,
+                          std::vector<Face_handle> &f,
+                          std::vector<Vertex_handle> &w,
+                          std::vector<Offset> &offset_w,
+                          std::vector<int> &i, int d)
+{
+  // degree: 3: 1%, 4: 9%, 5: 23%, 6: 35%, 7: 19%, r: 10%
+
+  // Remove all the edges that are too long.
+  // This only needs to be done when the simplicity condition is not
+  // met because the simplicity condition implies is_1_cover(), hence
+  // no too long edges.
+  this->remove_too_long_edges_in_star(v);
+
+  switch (d)
+    {
+    case 3:
+      remove_degree3(v, f, w, offset_w, i);
+      break;
+    case 4:
+      remove_degree4(v, f, w, offset_w, i);
+      break;
+    case 5:
+      remove_degree5(v, f, w, offset_w, i);
+      break;
+    case 6:
+      remove_degree6(v, f, w, offset_w, i);
+      break;
+    case 7:
+      remove_degree7(v, f, w, offset_w, i);
+      break;
+    default:
+      remove_degree_d(v, f, w, offset_w, i, d);
+      break;
+    }
+}
+
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+remove_degree_d(Vertex_handle v, std::vector<Face_handle> &,
+                std::vector<Vertex_handle> &,
+                std::vector<int> &, int)
+{
+  std::list<Edge> hole;
+  this->make_hole(v, hole);
+
+  fill_hole_delaunay(hole);
+
+  return;
+}
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+remove_degree_d(Vertex_handle v, std::vector<Face_handle> &,
+                std::vector<Vertex_handle> &w, std::vector<Offset> &offset_w,
+                std::vector<int> &, int d)
+{
+  std::list<Edge> hole;
+  this->make_hole(v, hole);
+
+  std::map<Vertex_handle, Offset> vertex_offsets;
+  for (int idx = 0; idx < d; ++idx)
+    {
+      vertex_offsets[w[idx]] = offset_w[idx];
+    }
+
+  fill_hole_delaunay(hole, vertex_offsets);
+
+  return;
+}
+
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+remove_degree3(Vertex_handle, std::vector<Face_handle> &f,
+               std::vector<Vertex_handle> &,
+               std::vector<int> &i)
+{
+  // modify the triangulation
+  Face_handle nn = f[1]->neighbor( i[1] );
+  tds().set_adjacency(f[0], ccw(i[0]) , nn , nn->index(f[1])  );
+  nn = f[2]->neighbor( i[2] );
+  tds().set_adjacency(f[0], cw(i[0]) , nn , nn->index(f[2])  );
+  f[0]->set_vertex  (            i[0] , f[1]->vertex( cw(i[1]) ) );
+
+  // clean container
+  tds().delete_face(f[1]);
+  tds().delete_face(f[2]);
+
+  this->set_offsets(f[0], 0, 0, 0);
+
+  return;
+}
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+remove_degree3(Vertex_handle, std::vector<Face_handle> &f,
+               std::vector<Vertex_handle> &, std::vector<Offset> &o,
+               std::vector<int> &i)
+{
+  // modify the triangulation
+  Face_handle nn = f[1]->neighbor( i[1] );
+  tds().set_adjacency(f[0], ccw(i[0]) , nn , nn->index(f[1])  );
+  nn = f[2]->neighbor( i[2] );
+  tds().set_adjacency(f[0], cw(i[0]) , nn , nn->index(f[2])  );
+  f[0]->set_vertex  (            i[0] , f[1]->vertex( cw(i[1]) ) );
+
+  // clean container
+  tds().delete_face(f[1]);
+  tds().delete_face(f[2]);
+
+  Offset oo[3];
+  oo[    i[0] ] = o[2];
+  oo[ cw(i[0])] = o[1];
+  oo[ccw(i[0])] = o[0];
+
+  if (oo[0].x() < 0 || oo[1].x() < 0 || oo[2].x() < 0)
+    {
+      Offset o(number_of_sheets()[0], 0);
+      oo[0] += o;
+      oo[1] += o;
+      oo[2] += o;
+    }
+  if (oo[0].y() < 0 || oo[1].y() < 0 || oo[2].y() < 0)
+    {
+      Offset o(0, number_of_sheets()[1]);
+      oo[0] += o;
+      oo[1] += o;
+      oo[2] += o;
+    }
+  this->set_offsets(f[0],
+                    (oo[0].x() >= number_of_sheets()[0] ? 2 : 0) + (oo[0].y() >= number_of_sheets()[1] ? 1 : 0),
+                    (oo[1].x() >= number_of_sheets()[0] ? 2 : 0) + (oo[1].y() >= number_of_sheets()[1] ? 1 : 0),
+                    (oo[2].x() >= number_of_sheets()[0] ? 2 : 0) + (oo[2].y() >= number_of_sheets()[1] ? 1 : 0));
+
+  return;
+}
+
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+remove_degree4(Vertex_handle, std::vector<Face_handle> &f,
+               std::vector<Vertex_handle> &w,
+               std::vector<int> &i )
+{
+  // removing a degree 4 vertex
+
+  Face_handle nn;
+
+  if ( !incircle(2, 0, 1, 3, f, w, i) )
+    {
+      // diagonal 1 3
+      f[0]->set_vertex( i[0], w[3] ); //w0 w1 w3
+      f[1]->set_vertex( i[1], w[3] ); //w1 w2 w3
+      nn = f[3]->neighbor( i[3] );
+      tds().set_adjacency(f[0], cw(i[0]) , nn , nn->index(f[3])  );
+      nn = f[2]->neighbor( i[2] );
+      tds().set_adjacency(f[1], ccw(i[1]) , nn , nn->index(f[2]) );
+      // clean container
+      tds().delete_face(f[2]);
+      tds().delete_face(f[3]);
+
+      f[0]->set_offsets(0, 0, 0);
+      f[1]->set_offsets(0, 0, 0);
+
+      insert_too_long_edge(f[0], ccw(i[0]));
+    }
+  else
+    {
+      // diagonal 0 2
+      f[0]->set_vertex( i[0], w[2]); //w0 w1 w2
+      f[3]->set_vertex( i[3], w[2]); //w3 w0 w2
+      nn = f[1]->neighbor( i[1] );
+      tds().set_adjacency(f[0], ccw(i[0]) , nn , nn->index(f[1])  );
+      nn = f[2]->neighbor( i[2] );
+      tds().set_adjacency(f[3], cw(i[3]) , nn , nn->index(f[2])  );
+      // clean container
+      tds().delete_face(f[1]);
+      tds().delete_face(f[2]);
+
+      f[0]->set_offsets(0, 0, 0);
+      f[3]->set_offsets(0, 0, 0);
+    }
+}
+
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+remove_degree4(Vertex_handle, std::vector<Face_handle> &f,
+               std::vector<Vertex_handle> &w, std::vector<Offset> &o,
+               std::vector<int> &i )
+{
+  // removing a degree 4 vertex
+
+  Face_handle nn;
+
+  int oo[4];
+  if ((o[0] == o[1]) && (o[0] == o[2]) && (o[0] == o[3]))
+    {
+      for (int i = 0; i < 4; ++i) oo[i] = 0;
+    }
+  else
+    {
+      Covering_sheets cover = number_of_sheets();
+      if ((o[0].x() < 0) || (o[1].x() < 0) || (o[2].x() < 0) || (o[3].x() < 0))
+        for (int i = 0; i < 4; ++i)
+          o[i] += Offset(cover[0], 0);
+
+      if ((o[0].y() < 0) || (o[1].y() < 0) || (o[2].y() < 0) || (o[3].y() < 0))
+        for (int i = 0; i < 4; ++i)
+          o[i] += Offset(0, cover[1]);
+
+      for (int i = 0; i < 4; ++i)
+        {
+          oo[i] = (o[i].x() >= cover[0] ? 2 : 0) + (o[i].y() >= cover[1] ? 1 : 0);
+        }
+    }
+
+  if ( !incircle(2, 0, 1, 3, f, w, o, i) )
+    {
+      // diagonal 1 3
+      f[0]->set_vertex( i[0], w[3] ); //w0 w1 w3
+      f[1]->set_vertex( i[1], w[3] ); //w1 w2 w3
+      nn = f[3]->neighbor( i[3] );
+      tds().set_adjacency(f[0], cw(i[0]) , nn , nn->index(f[3])  );
+      nn = f[2]->neighbor( i[2] );
+      tds().set_adjacency(f[1], ccw(i[1]) , nn , nn->index(f[2]) );
+      // clean container
+      tds().delete_face(f[2]);
+      tds().delete_face(f[3]);
+
+      int o_face[3];
+      o_face[i[0]]      = oo[3];
+      o_face[ccw(i[0])] = oo[0];
+      o_face[ cw(i[0])] = oo[1];
+      this->set_offsets(f[0], o_face[0], o_face[1], o_face[2]);
+      o_face[i[1]]      = oo[3];
+      o_face[ccw(i[1])] = oo[1];
+      o_face[ cw(i[1])] = oo[2];
+      this->set_offsets(f[1], o_face[0], o_face[1], o_face[2]);
+
+      insert_too_long_edge(f[0], ccw(i[0]));
+    }
+  else
+    {
+      // diagonal 0 2
+      f[0]->set_vertex( i[0], w[2]); //w0 w1 w2
+      f[3]->set_vertex( i[3], w[2]); //w3 w0 w2
+      nn = f[1]->neighbor( i[1] );
+      tds().set_adjacency(f[0], ccw(i[0]) , nn , nn->index(f[1])  );
+      nn = f[2]->neighbor( i[2] );
+      tds().set_adjacency(f[3], cw(i[3]) , nn , nn->index(f[2])  );
+      // clean container
+      tds().delete_face(f[1]);
+      tds().delete_face(f[2]);
+
+      int o_face[3];
+      o_face[i[0]]      = oo[2];
+      o_face[ccw(i[0])] = oo[0];
+      o_face[ cw(i[0])] = oo[1];
+      this->set_offsets(f[0], o_face[0], o_face[1], o_face[2]);
+      o_face[i[3]]      = oo[2];
+      o_face[ccw(i[3])] = oo[3];
+      o_face[ cw(i[3])] = oo[0];
+      this->set_offsets(f[3], o_face[0], o_face[1], o_face[2]);
+
+      insert_too_long_edge(f[3], ccw(i[3]));
+    }
+}
+
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+remove_degree5(Vertex_handle v, std::vector<Face_handle> &f,
+               std::vector<Vertex_handle> &w,
+               std::vector<int> &i)
+{
+  // removing a degree 5 vertex
+  this->remove_too_long_edges_in_star(v);
+
+  if (incircle(3, 0, 1, 2, f, w, i))
+    {
+      if (incircle(4, 0, 1, 3, f, w, i))
+        {
+          if (incircle(4, 1, 2, 3, f, w, i))
+            {
+              // star from 4
+              remove_degree5_star(v, f[4], f[0], f[1], f[2], f[3],
+                                  w[4], w[0], w[1], w[2], w[3],
+                                  i[4], i[0], i[1], i[2], i[3]);
+            }
+          else
+            {
+              //star from 1
+              remove_degree5_star(v, f[1], f[2], f[3], f[4], f[0],
+                                  w[1], w[2], w[3], w[4], w[0],
+                                  i[1], i[2], i[3], i[4], i[0]);
+
+
+            }
+        }
+      else
+        {
+          // star from 3
+          remove_degree5_star(v, f[3], f[4], f[0], f[1], f[2],
+                              w[3], w[4], w[0], w[1], w[2],
+                              i[3], i[4], i[0], i[1], i[2]);
+        }
+    }
+  else
+    {
+      if (incircle(4, 2, 3, 0, f, w, i))
+        {
+          if (incircle(4, 0, 1, 2, f, w, i))
+            {
+              // star from 4
+              remove_degree5_star(v, f[4], f[0], f[1], f[2], f[3],
+                                  w[4], w[0], w[1], w[2], w[3],
+                                  i[4], i[0], i[1], i[2], i[3]);
+            }
+          else
+            {
+              //star from 2
+              remove_degree5_star(v, f[2], f[3], f[4], f[0], f[1],
+                                  w[2], w[3], w[4], w[0], w[1],
+                                  i[2], i[3], i[4], i[0], i[1]);
+            }
+        }
+      else
+        {
+          // star from 0
+          remove_degree5_star(v, f[0], f[1], f[2], f[3], f[4],
+                              w[0], w[1], w[2], w[3], w[4],
+                              i[0], i[1], i[2], i[3], i[4]);
+        }
+    }
+  return;
+}
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+remove_degree5(Vertex_handle v, std::vector<Face_handle> &f,
+               std::vector<Vertex_handle> &w, std::vector<Offset> &o,
+               std::vector<int> &i)
+{
+  // removing a degree 5 vertex
+  this->remove_too_long_edges_in_star(v);
+
+  if (incircle(3, 0, 1, 2, f, w, o, i))
+    {
+      if (incircle(4, 0, 1, 3, f, w, o, i))
+        {
+          if (incircle(4, 1, 2, 3, f, w, o, i))
+            {
+              // star from 4
+              remove_degree5_star(v, f[4], f[0], f[1], f[2], f[3],
+                                  w[4], w[0], w[1], w[2], w[3],
+                                  o[4], o[0], o[1], o[2], o[3],
+                                  i[4], i[0], i[1], i[2], i[3]);
+            }
+          else
+            {
+              //star from 1
+              remove_degree5_star(v, f[1], f[2], f[3], f[4], f[0],
+                                  w[1], w[2], w[3], w[4], w[0],
+                                  o[1], o[2], o[3], o[4], o[0],
+                                  i[1], i[2], i[3], i[4], i[0]);
+
+
+            }
+        }
+      else
+        {
+          // star from 3
+          remove_degree5_star(v, f[3], f[4], f[0], f[1], f[2],
+                              w[3], w[4], w[0], w[1], w[2],
+                              o[3], o[4], o[0], o[1], o[2],
+                              i[3], i[4], i[0], i[1], i[2]);
+        }
+    }
+  else
+    {
+      if (incircle(4, 2, 3, 0, f, w, o, i))
+        {
+          if (incircle(4, 0, 1, 2, f, w, o, i))
+            {
+              // star from 4
+              remove_degree5_star(v, f[4], f[0], f[1], f[2], f[3],
+                                  w[4], w[0], w[1], w[2], w[3],
+                                  o[4], o[0], o[1], o[2], o[3],
+                                  i[4], i[0], i[1], i[2], i[3]);
+            }
+          else
+            {
+              //star from 2
+              remove_degree5_star(v, f[2], f[3], f[4], f[0], f[1],
+                                  w[2], w[3], w[4], w[0], w[1],
+                                  o[2], o[3], o[4], o[0], o[1],
+                                  i[2], i[3], i[4], i[0], i[1]);
+            }
+        }
+      else
+        {
+          // star from 0
+          remove_degree5_star(v, f[0], f[1], f[2], f[3], f[4],
+                              w[0], w[1], w[2], w[3], w[4],
+                              o[0], o[1], o[2], o[3], o[4],
+                              i[0], i[1], i[2], i[3], i[4]);
+        }
+    }
+  return;
+}
+
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::remove_degree5_star
+(Vertex_handle &,
+ Face_handle &f0, Face_handle &f1, Face_handle &f2, Face_handle &f3, Face_handle &f4,
+ Vertex_handle &v0, Vertex_handle &, Vertex_handle &, Vertex_handle &, Vertex_handle &,
+ int i0, int i1, int i2, int i3, int i4 )
+{
+  // removing a degree 5 vertex, starring from v0
+  Face_handle nn;
+  f1->set_vertex( i1, v0) ;  // f1 = v1v2v0
+  f2->set_vertex( i2, v0) ;  // f2 = v2v3v0
+  f3->set_vertex( i3, v0) ;  // f3 = v3v4v0
+
+  nn = f0->neighbor( i0 );
+  tds().set_adjacency(f1, cw(i1) , nn , nn->index(f0) );
+  nn = f4->neighbor( i4 );
+  tds().set_adjacency(f3, ccw(i3) , nn , nn->index(f4) );
+  tds().delete_face(f0);
+  tds().delete_face(f4);
+
+  f1->set_offsets(0, 0, 0);
+  f2->set_offsets(0, 0, 0);
+  f3->set_offsets(0, 0, 0);
+}
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::remove_degree5_star
+(Vertex_handle &,
+ Face_handle &f0, Face_handle &f1, Face_handle &f2, Face_handle &f3, Face_handle &f4,
+ Vertex_handle &v0, Vertex_handle &, Vertex_handle &, Vertex_handle &, Vertex_handle &,
+ Offset &o0, Offset &o1, Offset &o2, Offset &o3, Offset &o4,
+ int i0, int i1, int i2, int i3, int i4 )
+{
+  // removing a degree 5 vertex, starring from v0
+  Face_handle nn;
+  f1->set_vertex( i1, v0) ;  // f1 = v1v2v0
+  f2->set_vertex( i2, v0) ;  // f2 = v2v3v0
+  f3->set_vertex( i3, v0) ;  // f3 = v3v4v0
+
+  nn = f0->neighbor( i0 );
+  tds().set_adjacency(f1, cw(i1) , nn , nn->index(f0) );
+  nn = f4->neighbor( i4 );
+  tds().set_adjacency(f3, ccw(i3) , nn , nn->index(f4) );
+  tds().delete_face(f0);
+  tds().delete_face(f4);
+
+  if (o0.x() < 0 || o1.x() < 0 || o2.x() < 0 || o3.x() < 0 || o4.x() < 0)
+    {
+      o0 += Offset(number_of_sheets()[0], 0);
+      o1 += Offset(number_of_sheets()[0], 0);
+      o2 += Offset(number_of_sheets()[0], 0);
+      o3 += Offset(number_of_sheets()[0], 0);
+      o4 += Offset(number_of_sheets()[0], 0);
+    }
+  if (o0.y() < 0 || o1.y() < 0 || o2.y() < 0 || o3.y() < 0 || o4.y() < 0)
+    {
+      o0 += Offset(0, number_of_sheets()[1]);
+      o1 += Offset(0, number_of_sheets()[1]);
+      o2 += Offset(0, number_of_sheets()[1]);
+      o3 += Offset(0, number_of_sheets()[1]);
+      o4 += Offset(0, number_of_sheets()[1]);
+    }
+  int oo0 = (o0.x() >= number_of_sheets()[0] ? 2 : 0) + (o0.y() >= number_of_sheets()[1] ? 1 : 0);
+  int oo1 = (o1.x() >= number_of_sheets()[0] ? 2 : 0) + (o1.y() >= number_of_sheets()[1] ? 1 : 0);
+  int oo2 = (o2.x() >= number_of_sheets()[0] ? 2 : 0) + (o2.y() >= number_of_sheets()[1] ? 1 : 0);
+  int oo3 = (o3.x() >= number_of_sheets()[0] ? 2 : 0) + (o3.y() >= number_of_sheets()[1] ? 1 : 0);
+  int oo4 = (o4.x() >= number_of_sheets()[0] ? 2 : 0) + (o4.y() >= number_of_sheets()[1] ? 1 : 0);
+
+  int oo[3];
+  oo[i1]      = oo0;
+  oo[ccw(i1)] = oo1;
+  oo[ cw(i1)] = oo2;
+  this->set_offsets(f1, oo[0], oo[1], oo[2]);
+  oo[i2]      = oo0;
+  oo[ccw(i2)] = oo2;
+  oo[ cw(i2)] = oo3;
+  this->set_offsets(f2, oo[0], oo[1], oo[2]);
+  oo[i3]      = oo0;
+  oo[ccw(i3)] = oo3;
+  oo[ cw(i3)] = oo4;
+  this->set_offsets(f3, oo[0], oo[1], oo[2]);
+
+  //insert_too_long_edges_in_star(f1->vertex(i1));
+  insert_too_long_edge(f1, ccw(i1));
+  insert_too_long_edge(f2, ccw(i2));
+}
+
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+remove_degree6(Vertex_handle v, std::vector<Face_handle> &f,
+               std::vector<Vertex_handle> &w,
+               std::vector<int> &i)
+{
+  if(incircle(1, 2, 3, 0, f, w, i))
+    {
+      if(incircle(4, 2, 3, 5, f, w, i))
+        {
+          if(incircle(1, 2, 3, 4, f, w, i))
+            {
+              if(incircle(4, 0, 1, 3, f, w, i))
+                {
+                  if(incircle(5, 0, 1, 4, f, w, i))
+                    {
+                      remove_degree6_star(v,
+                                          f[1], f[2], f[3], f[4], f[5], f[0],
+                                          w[1], w[2], w[3], w[4], w[5], w[0],
+                                          i[1], i[2], i[3], i[4], i[5], i[0]);
+                    }
+                  else
+                    {
+                      remove_degree6_N(v,
+                                       f[1], f[2], f[3], f[4], f[5], f[0],
+                                       w[1], w[2], w[3], w[4], w[5], w[0],
+                                       i[1], i[2], i[3], i[4], i[5], i[0]);
+                    }
+                }
+              else
+                {
+                  remove_degree6_antiN(v,
+                                       f[0], f[1], f[2], f[3], f[4], f[5],
+                                       w[0], w[1], w[2], w[3], w[4], w[5],
+                                       i[0], i[1], i[2], i[3], i[4], i[5]);
+                }
+            }
+          else
+            {
+              if(incircle(5, 1, 2, 4, f, w, i))
+                {
+                  remove_degree6_N(v, f[2], f[3], f[4], f[5], f[0], f[1],
+                                   w[2], w[3], w[4], w[5], w[0], w[1],
+                                   i[2], i[3], i[4], i[5], i[0], i[1]);
+                }
+              else
+                {
+                  if(incircle(5, 0, 1, 4, f, w, i))
+                    {
+                      remove_degree6_antiN(v,
+                                           f[1], f[2], f[3], f[4], f[5], f[0],
+                                           w[1], w[2], w[3], w[4], w[5], w[0],
+                                           i[1], i[2], i[3], i[4], i[5], i[0]);
+                    }
+                  else
+                    {
+                      remove_degree6_star(v, f[4], f[5], f[0], f[1], f[2], f[3],
+                                          w[4], w[5], w[0], w[1], w[2], w[3],
+                                          i[4], i[5], i[0], i[1], i[2], i[3]);
+                    }
+                }
+            }
+        }
+      else
+        {
+          if(incircle(1, 2, 3, 5, f, w, i))
+            {
+              if(incircle(1, 3, 4, 5, f, w, i))
+                {
+                  if(incircle(4, 0, 1, 3, f, w, i))
+                    {
+                      if(incircle(5, 0, 1, 4, f, w, i))
+                        {
+                          remove_degree6_star(v, f[1], f[2], f[3], f[4], f[5], f[0],
+                                              w[1], w[2], w[3], w[4], w[5], w[0],
+                                              i[1], i[2], i[3], i[4], i[5], i[0]);
+                        }
+                      else
+                        {
+                          remove_degree6_N(v, f[1], f[2], f[3], f[4], f[5], f[0],
+                                           w[1], w[2], w[3], w[4], w[5], w[0],
+                                           i[1], i[2], i[3], i[4], i[5], i[0]);
+                        }
+                    }
+                  else
+                    {
+                      remove_degree6_antiN(v, f[0], f[1], f[2], f[3], f[4], f[5],
+                                           w[0], w[1], w[2], w[3], w[4], w[5],
+                                           i[0], i[1], i[2], i[3], i[4], i[5]);
+                    }
+                }
+              else
+                {
+                  if(incircle(5, 0, 1, 3, f, w, i))
+                    {
+                      remove_degree6_diamond(v, f[1], f[2], f[3], f[4], f[5], f[0],
+                                             w[1], w[2], w[3], w[4], w[5], w[0],
+                                             i[1], i[2], i[3], i[4], i[5], i[0]);
+                    }
+                  else
+                    {
+                      if(incircle(4, 5, 0, 3, f, w, i))
+                        {
+                          remove_degree6_antiN(v, f[0], f[1], f[2], f[3], f[4], f[5],
+                                               w[0], w[1], w[2], w[3], w[4], w[5],
+                                               i[0], i[1], i[2], i[3], i[4], i[5]);
+                        }
+                      else
+                        {
+                          remove_degree6_star(v, f[3], f[4], f[5], f[0], f[1], f[2],
+                                              w[3], w[4], w[5], w[0], w[1], w[2],
+                                              i[3], i[4], i[5], i[0], i[1], i[2]);
+                        }
+                    }
+                }
+            }
+          else
+            {
+              remove_degree6_star(v, f[5], f[0], f[1], f[2], f[3], f[4],
+                                  w[5], w[0], w[1], w[2], w[3], w[4],
+                                  i[5], i[0], i[1], i[2], i[3], i[4]);
+            }
+        }
+    }
+  else
+    {
+      if(incircle(4, 2, 3, 5, f, w, i))
+        {
+          if(incircle(4, 2, 3, 0, f, w, i))
+            {
+              if(incircle(4, 0, 1, 2, f, w, i))
+                {
+                  if(incircle(4, 1, 2, 5, f, w, i))
+                    {
+                      if(incircle(4, 0, 1, 5, f, w, i))
+                        {
+                          remove_degree6_star(v, f[4], f[5], f[0], f[1], f[2], f[3],
+                                              w[4], w[5], w[0], w[1], w[2], w[3],
+                                              i[4], i[5], i[0], i[1], i[2], i[3]);
+                        }
+                      else
+                        {
+                          remove_degree6_antiN(v, f[1], f[2], f[3], f[4], f[5], f[0],
+                                               w[1], w[2], w[3], w[4], w[5], w[0],
+                                               i[1], i[2], i[3], i[4], i[5], i[0]);
+                        }
+                    }
+                  else
+                    {
+                      remove_degree6_N(v, f[2], f[3], f[4], f[5], f[0], f[1],
+                                       w[2], w[3], w[4], w[5], w[0], w[1],
+                                       i[2], i[3], i[4], i[5], i[0], i[1]);
+                    }
+                }
+              else
+                {
+                  if(incircle(4, 5, 0, 2, f, w, i))
+                    {
+                      remove_degree6_diamond(v, f[0], f[1], f[2], f[3], f[4], f[5],
+                                             w[0], w[1], w[2], w[3], w[4], w[5],
+                                             i[0], i[1], i[2], i[3], i[4], i[5]);
+                    }
+                  else
+                    {
+                      if(incircle(5, 0, 1, 2, f, w, i))
+                        {
+                          remove_degree6_N(v, f[2], f[3], f[4], f[5], f[0], f[1],
+                                           w[2], w[3], w[4], w[5], w[0], w[1],
+                                           i[2], i[3], i[4], i[5], i[0], i[1]);
+                        }
+                      else
+                        {
+                          remove_degree6_star(v, f[2], f[3], f[4], f[5], f[0], f[1],
+                                              w[2], w[3], w[4], w[5], w[0], w[1],
+                                              i[2], i[3], i[4], i[5], i[0], i[1]);
+                        }
+                    }
+                }
+            }
+          else
+            {
+              remove_degree6_star(v, f[0], f[1], f[2], f[3], f[4], f[5],
+                                  w[0], w[1], w[2], w[3], w[4], w[5],
+                                  i[0], i[1], i[2], i[3], i[4], i[5]);
+            }
+        }
+      else
+        {
+          if(incircle(5, 2, 3, 0, f, w, i))
+            {
+              if(incircle(5, 0, 1, 2, f, w, i))
+                {
+                  remove_degree6_star(v, f[5], f[0], f[1], f[2], f[3], f[4],
+                                      w[5], w[0], w[1], w[2], w[3], w[4],
+                                      i[5], i[0], i[1], i[2], i[3], i[4]);
+                }
+              else
+                {
+                  remove_degree6_antiN(v, f[2], f[3], f[4], f[5], f[0], f[1],
+                                       w[2], w[3], w[4], w[5], w[0], w[1],
+                                       i[2], i[3], i[4], i[5], i[0], i[1]);
+                }
+            }
+          else
+            {
+              if(incircle(4, 5, 0, 3, f, w, i))
+                {
+                  remove_degree6_star(v, f[0], f[1], f[2], f[3], f[4], f[5],
+                                      w[0], w[1], w[2], w[3], w[4], w[5],
+                                      i[0], i[1], i[2], i[3], i[4], i[5]);
+                }
+              else
+                {
+                  remove_degree6_N(v, f[0], f[1], f[2], f[3], f[4], f[5],
+                                   w[0], w[1], w[2], w[3], w[4], w[5],
+                                   i[0], i[1], i[2], i[3], i[4], i[5]);
+                }
+            }
+        }
+    }
+}
+
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+remove_degree6(Vertex_handle v, std::vector<Face_handle> &f,
+               std::vector<Vertex_handle> &w, std::vector<Offset> &o,
+               std::vector<int> &i)
+{
+  // removing a degree 6 vertex
+  this->remove_too_long_edges_in_star(v);
+
+  if(incircle(1, 2, 3, 0, f, w, o, i))
+    {
+      if(incircle(4, 2, 3, 5, f, w, o, i))
+        {
+          if(incircle(1, 2, 3, 4, f, w, o, i))
+            {
+              if(incircle(4, 0, 1, 3, f, w, o, i))
+                {
+                  if(incircle(5, 0, 1, 4, f, w, o, i))
+                    {
+                      remove_degree6_star(v,
+                                          f[1], f[2], f[3], f[4], f[5], f[0],
+                                          w[1], w[2], w[3], w[4], w[5], w[0],
+                                          o[1], o[2], o[3], o[4], o[5], o[0],
+                                          i[1], i[2], i[3], i[4], i[5], i[0]);
+                    }
+                  else
+                    {
+                      remove_degree6_N(v,
+                                       f[1], f[2], f[3], f[4], f[5], f[0],
+                                       w[1], w[2], w[3], w[4], w[5], w[0],
+                                       o[1], o[2], o[3], o[4], o[5], o[0],
+                                       i[1], i[2], i[3], i[4], i[5], i[0]);
+                    }
+                }
+              else
+                {
+                  remove_degree6_antiN(v,
+                                       f[0], f[1], f[2], f[3], f[4], f[5],
+                                       w[0], w[1], w[2], w[3], w[4], w[5],
+                                       o[0], o[1], o[2], o[3], o[4], o[5],
+                                       i[0], i[1], i[2], i[3], i[4], i[5]);
+                }
+            }
+          else
+            {
+              if(incircle(5, 1, 2, 4, f, w, o, i))
+                {
+                  remove_degree6_N(v, f[2], f[3], f[4], f[5], f[0], f[1],
+                                   w[2], w[3], w[4], w[5], w[0], w[1],
+                                   o[2], o[3], o[4], o[5], o[0], o[1],
+                                   i[2], i[3], i[4], i[5], i[0], i[1]);
+                }
+              else
+                {
+                  if(incircle(5, 0, 1, 4, f, w, o, i))
+                    {
+                      remove_degree6_antiN(v,
+                                           f[1], f[2], f[3], f[4], f[5], f[0],
+                                           w[1], w[2], w[3], w[4], w[5], w[0],
+                                           o[1], o[2], o[3], o[4], o[5], o[0],
+                                           i[1], i[2], i[3], i[4], i[5], i[0]);
+                    }
+                  else
+                    {
+                      remove_degree6_star(v, f[4], f[5], f[0], f[1], f[2], f[3],
+                                          w[4], w[5], w[0], w[1], w[2], w[3],
+                                          o[4], o[5], o[0], o[1], o[2], o[3],
+                                          i[4], i[5], i[0], i[1], i[2], i[3]);
+                    }
+                }
+            }
+        }
+      else
+        {
+          if(incircle(1, 2, 3, 5, f, w, o, i))
+            {
+              if(incircle(1, 3, 4, 5, f, w, o, i))
+                {
+                  if(incircle(4, 0, 1, 3, f, w, o, i))
+                    {
+                      if(incircle(5, 0, 1, 4, f, w, o, i))
+                        {
+                          remove_degree6_star(v, f[1], f[2], f[3], f[4], f[5], f[0],
+                                              w[1], w[2], w[3], w[4], w[5], w[0],
+                                              o[1], o[2], o[3], o[4], o[5], o[0],
+                                              i[1], i[2], i[3], i[4], i[5], i[0]);
+                        }
+                      else
+                        {
+                          remove_degree6_N(v, f[1], f[2], f[3], f[4], f[5], f[0],
+                                           w[1], w[2], w[3], w[4], w[5], w[0],
+                                           o[1], o[2], o[3], o[4], o[5], o[0],
+                                           i[1], i[2], i[3], i[4], i[5], i[0]);
+                        }
+                    }
+                  else
+                    {
+                      remove_degree6_antiN(v, f[0], f[1], f[2], f[3], f[4], f[5],
+                                           w[0], w[1], w[2], w[3], w[4], w[5],
+                                           o[0], o[1], o[2], o[3], o[4], o[5],
+                                           i[0], i[1], i[2], i[3], i[4], i[5]);
+                    }
+                }
+              else
+                {
+                  if(incircle(5, 0, 1, 3, f, w, o, i))
+                    {
+                      remove_degree6_diamond(v, f[1], f[2], f[3], f[4], f[5], f[0],
+                                             w[1], w[2], w[3], w[4], w[5], w[0],
+                                             o[1], o[2], o[3], o[4], o[5], o[0],
+                                             i[1], i[2], i[3], i[4], i[5], i[0]);
+                    }
+                  else
+                    {
+                      if(incircle(4, 5, 0, 3, f, w, o, i))
+                        {
+                          remove_degree6_antiN(v, f[0], f[1], f[2], f[3], f[4], f[5],
+                                               w[0], w[1], w[2], w[3], w[4], w[5],
+                                               o[0], o[1], o[2], o[3], o[4], o[5],
+                                               i[0], i[1], i[2], i[3], i[4], i[5]);
+                        }
+                      else
+                        {
+                          remove_degree6_star(v, f[3], f[4], f[5], f[0], f[1], f[2],
+                                              w[3], w[4], w[5], w[0], w[1], w[2],
+                                              o[3], o[4], o[5], o[0], o[1], o[2],
+                                              i[3], i[4], i[5], i[0], i[1], i[2]);
+                        }
+                    }
+                }
+            }
+          else
+            {
+              remove_degree6_star(v, f[5], f[0], f[1], f[2], f[3], f[4],
+                                  w[5], w[0], w[1], w[2], w[3], w[4],
+                                  o[5], o[0], o[1], o[2], o[3], o[4],
+                                  i[5], i[0], i[1], i[2], i[3], i[4]);
+            }
+        }
+    }
+  else
+    {
+      if(incircle(4, 2, 3, 5, f, w, o, i))
+        {
+          if(incircle(4, 2, 3, 0, f, w, o, i))
+            {
+              if(incircle(4, 0, 1, 2, f, w, o, i))
+                {
+                  if(incircle(4, 1, 2, 5, f, w, o, i))
+                    {
+                      if(incircle(4, 0, 1, 5, f, w, o, i))
+                        {
+                          remove_degree6_star(v, f[4], f[5], f[0], f[1], f[2], f[3],
+                                              w[4], w[5], w[0], w[1], w[2], w[3],
+                                              o[4], o[5], o[0], o[1], o[2], o[3],
+                                              i[4], i[5], i[0], i[1], i[2], i[3]);
+                        }
+                      else
+                        {
+                          remove_degree6_antiN(v, f[1], f[2], f[3], f[4], f[5], f[0],
+                                               w[1], w[2], w[3], w[4], w[5], w[0],
+                                               o[1], o[2], o[3], o[4], o[5], o[0],
+                                               i[1], i[2], i[3], i[4], i[5], i[0]);
+                        }
+                    }
+                  else
+                    {
+                      remove_degree6_N(v, f[2], f[3], f[4], f[5], f[0], f[1],
+                                       w[2], w[3], w[4], w[5], w[0], w[1],
+                                       o[2], o[3], o[4], o[5], o[0], o[1],
+                                       i[2], i[3], i[4], i[5], i[0], i[1]);
+                    }
+                }
+              else
+                {
+                  if(incircle(4, 5, 0, 2, f, w, o, i))
+                    {
+                      remove_degree6_diamond(v, f[0], f[1], f[2], f[3], f[4], f[5],
+                                             w[0], w[1], w[2], w[3], w[4], w[5],
+                                             o[0], o[1], o[2], o[3], o[4], o[5],
+                                             i[0], i[1], i[2], i[3], i[4], i[5]);
+                    }
+                  else
+                    {
+                      if(incircle(5, 0, 1, 2, f, w, o, i))
+                        {
+                          remove_degree6_N(v, f[2], f[3], f[4], f[5], f[0], f[1],
+                                           w[2], w[3], w[4], w[5], w[0], w[1],
+                                           o[2], o[3], o[4], o[5], o[0], o[1],
+                                           i[2], i[3], i[4], i[5], i[0], i[1]);
+                        }
+                      else
+                        {
+                          remove_degree6_star(v, f[2], f[3], f[4], f[5], f[0], f[1],
+                                              w[2], w[3], w[4], w[5], w[0], w[1],
+                                              o[2], o[3], o[4], o[5], o[0], o[1],
+                                              i[2], i[3], i[4], i[5], i[0], i[1]);
+                        }
+                    }
+                }
+            }
+          else
+            {
+              remove_degree6_star(v, f[0], f[1], f[2], f[3], f[4], f[5],
+                                  w[0], w[1], w[2], w[3], w[4], w[5],
+                                  o[0], o[1], o[2], o[3], o[4], o[5],
+                                  i[0], i[1], i[2], i[3], i[4], i[5]);
+            }
+        }
+      else
+        {
+          if(incircle(5, 2, 3, 0, f, w, o, i))
+            {
+              if(incircle(5, 0, 1, 2, f, w, o, i))
+                {
+                  remove_degree6_star(v, f[5], f[0], f[1], f[2], f[3], f[4],
+                                      w[5], w[0], w[1], w[2], w[3], w[4],
+                                      o[5], o[0], o[1], o[2], o[3], o[4],
+                                      i[5], i[0], i[1], i[2], i[3], i[4]);
+                }
+              else
+                {
+                  remove_degree6_antiN(v, f[2], f[3], f[4], f[5], f[0], f[1],
+                                       w[2], w[3], w[4], w[5], w[0], w[1],
+                                       o[2], o[3], o[4], o[5], o[0], o[1],
+                                       i[2], i[3], i[4], i[5], i[0], i[1]);
+                }
+            }
+          else
+            {
+              if(incircle(4, 5, 0, 3, f, w, o, i))
+                {
+                  remove_degree6_star(v, f[0], f[1], f[2], f[3], f[4], f[5],
+                                      w[0], w[1], w[2], w[3], w[4], w[5],
+                                      o[0], o[1], o[2], o[3], o[4], o[5],
+                                      i[0], i[1], i[2], i[3], i[4], i[5]);
+                }
+              else
+                {
+                  remove_degree6_N(v, f[0], f[1], f[2], f[3], f[4], f[5],
+                                   w[0], w[1], w[2], w[3], w[4], w[5],
+                                   o[0], o[1], o[2], o[3], o[4], o[5],
+                                   i[0], i[1], i[2], i[3], i[4], i[5]);
+                }
+            }
+        }
+    }
+}
+
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::remove_degree6_star
+(Vertex_handle &,
+ Face_handle &  f0, Face_handle &  f1, Face_handle &  f2,
+ Face_handle &  f3, Face_handle &  f4, Face_handle &  f5,
+ Vertex_handle &v0, Vertex_handle &, Vertex_handle &,
+ Vertex_handle &, Vertex_handle &, Vertex_handle &,
+ int i0, int i1, int i2, int i3, int i4, int i5 )
+{
+  // removing a degree 6 vertex, staring from v0
+  Face_handle nn;
+  f1->set_vertex( i1, v0) ;  // f1 = v1v2v0
+  f2->set_vertex( i2, v0) ;  // f2 = v2v3v0
+  f3->set_vertex( i3, v0) ;  // f3 = v3v4v0
+  f4->set_vertex( i4, v0) ;  // f4 = v4v5v0
+  nn = f0->neighbor( i0 );
+  tds().set_adjacency(f1, cw(i1), nn, nn->index(f0));
+  nn = f5->neighbor( i5 );
+  tds().set_adjacency(f4, ccw(i4), nn,  nn->index(f5));
+  tds().delete_face(f0);
+  tds().delete_face(f5);
+
+  f1->set_offsets(0, 0, 0);
+  f2->set_offsets(0, 0, 0);
+  f3->set_offsets(0, 0, 0);
+  f4->set_offsets(0, 0, 0);
+}
+
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::remove_degree6_star
+(Vertex_handle &v,
+ Face_handle &  f0, Face_handle &  f1, Face_handle &  f2,
+ Face_handle &  f3, Face_handle &  f4, Face_handle &  f5,
+ Vertex_handle &v0, Vertex_handle &v1, Vertex_handle &v2,
+ Vertex_handle &v3, Vertex_handle &v4, Vertex_handle &v5,
+ Offset &o0, Offset &o1, Offset &o2,
+ Offset &o3, Offset &o4, Offset &o5,
+ int i0, int i1, int i2, int i3, int i4, int i5 )
+{
+  // removing a degree 6 vertex, staring from v0
+  remove_degree6_star(v,
+                      f0, f1, f2, f3, f4, f5,
+                      v0, v1, v2, v3, v4, v5,
+                      i0, i1, i2, i3, i4, i5);
+
+  if (o0.x() < 0 || o1.x() < 0 || o2.x() < 0 || o3.x() < 0 || o4.x() < 0 || o5.x() < 0)
+    {
+      o0 += Offset(number_of_sheets()[0], 0);
+      o1 += Offset(number_of_sheets()[0], 0);
+      o2 += Offset(number_of_sheets()[0], 0);
+      o3 += Offset(number_of_sheets()[0], 0);
+      o4 += Offset(number_of_sheets()[0], 0);
+      o5 += Offset(number_of_sheets()[0], 0);
+    }
+  if (o0.y() < 0 || o1.y() < 0 || o2.y() < 0 || o3.y() < 0 || o4.y() < 0 || o5.y() < 0)
+    {
+      o0 += Offset(0, number_of_sheets()[1]);
+      o1 += Offset(0, number_of_sheets()[1]);
+      o2 += Offset(0, number_of_sheets()[1]);
+      o3 += Offset(0, number_of_sheets()[1]);
+      o4 += Offset(0, number_of_sheets()[1]);
+      o5 += Offset(0, number_of_sheets()[1]);
+    }
+  int oo0 = (o0.x() >= number_of_sheets()[0] ? 2 : 0) + (o0.y() >= number_of_sheets()[1] ? 1 : 0);
+  int oo1 = (o1.x() >= number_of_sheets()[0] ? 2 : 0) + (o1.y() >= number_of_sheets()[1] ? 1 : 0);
+  int oo2 = (o2.x() >= number_of_sheets()[0] ? 2 : 0) + (o2.y() >= number_of_sheets()[1] ? 1 : 0);
+  int oo3 = (o3.x() >= number_of_sheets()[0] ? 2 : 0) + (o3.y() >= number_of_sheets()[1] ? 1 : 0);
+  int oo4 = (o4.x() >= number_of_sheets()[0] ? 2 : 0) + (o4.y() >= number_of_sheets()[1] ? 1 : 0);
+  int oo5 = (o5.x() >= number_of_sheets()[0] ? 2 : 0) + (o5.y() >= number_of_sheets()[1] ? 1 : 0);
+
+  int oo[3];
+  oo[i1]      = oo0;
+  oo[ccw(i1)] = oo1;
+  oo[ cw(i1)] = oo2;
+  this->set_offsets(f1, oo[0], oo[1], oo[2]);
+  oo[i2]      = oo0;
+  oo[ccw(i2)] = oo2;
+  oo[ cw(i2)] = oo3;
+  this->set_offsets(f2, oo[0], oo[1], oo[2]);
+  oo[i3]      = oo0;
+  oo[ccw(i3)] = oo3;
+  oo[ cw(i3)] = oo4;
+  this->set_offsets(f3, oo[0], oo[1], oo[2]);
+  oo[i4]      = oo0;
+  oo[ccw(i4)] = oo4;
+  oo[ cw(i4)] = oo5;
+  this->set_offsets(f4, oo[0], oo[1], oo[2]);
+
+  insert_too_long_edge(f1, ccw(i1));
+  insert_too_long_edge(f2, ccw(i2));
+  insert_too_long_edge(f3, ccw(i3));
+}
+
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::remove_degree6_N
+(
+  Vertex_handle &,
+  Face_handle &  f0, Face_handle &  f1, Face_handle &  f2,
+  Face_handle &  f3, Face_handle &  f4, Face_handle &  f5,
+  Vertex_handle &v0, Vertex_handle &, Vertex_handle &,
+  Vertex_handle &v3, Vertex_handle &, Vertex_handle &,
+  int i0, int i1, int i2, int i3, int i4, int i5 )
+{
+  // removing a degree 6 vertex, N configuration with diagonal v0v3
+  Face_handle nn;
+  f1->set_vertex( i1, v0) ;  // f1 = v1v2v0
+  f2->set_vertex( i2, v0) ;  // f2 = v2v3v0
+  f4->set_vertex( i4, v3) ;  // f4 = v4v5v3
+  f5->set_vertex( i5, v3) ;  // f5 = v5v0v3
+  nn = f0->neighbor( i0 );
+  tds().set_adjacency(f1, cw(i1) , nn , nn->index(f0)  );
+  nn = f3->neighbor( i3 );
+  tds().set_adjacency(f4, cw(i4) , nn, nn->index(f3) );
+  tds().set_adjacency(f2, ccw(i2) , f5 , ccw(i5)  );
+  tds().delete_face(f0);
+  tds().delete_face(f3);
+
+  f1->set_offsets(0, 0, 0);
+  f2->set_offsets(0, 0, 0);
+  f4->set_offsets(0, 0, 0);
+  f5->set_offsets(0, 0, 0);
+}
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::remove_degree6_N
+(
+  Vertex_handle &v,
+  Face_handle &  f0, Face_handle &  f1, Face_handle &  f2,
+  Face_handle &  f3, Face_handle &  f4, Face_handle &  f5,
+  Vertex_handle &v0, Vertex_handle &v1, Vertex_handle &v2,
+  Vertex_handle &v3, Vertex_handle &v4, Vertex_handle &v5,
+  Offset &o0, Offset &o1, Offset &o2,
+  Offset &o3, Offset &o4, Offset &o5,
+  int i0, int i1, int i2, int i3, int i4, int i5 )
+{
+  // removing a degree 6 vertex, N configuration with diagonal v0v3
+
+  remove_degree6_N(v,
+                   f0, f1, f2, f3, f4, f5,
+                   v0, v1, v2, v3, v4, v5,
+                   i0, i1, i2, i3, i4, i5);
+
+  if (o0.x() < 0 || o1.x() < 0 || o2.x() < 0 || o3.x() < 0 || o4.x() < 0 || o5.x() < 0)
+    {
+      o0 += Offset(number_of_sheets()[0], 0);
+      o1 += Offset(number_of_sheets()[0], 0);
+      o2 += Offset(number_of_sheets()[0], 0);
+      o3 += Offset(number_of_sheets()[0], 0);
+      o4 += Offset(number_of_sheets()[0], 0);
+      o5 += Offset(number_of_sheets()[0], 0);
+    }
+  if (o0.y() < 0 || o1.y() < 0 || o2.y() < 0 || o3.y() < 0 || o4.y() < 0 || o5.y() < 0)
+    {
+      o0 += Offset(0, number_of_sheets()[1]);
+      o1 += Offset(0, number_of_sheets()[1]);
+      o2 += Offset(0, number_of_sheets()[1]);
+      o3 += Offset(0, number_of_sheets()[1]);
+      o4 += Offset(0, number_of_sheets()[1]);
+      o5 += Offset(0, number_of_sheets()[1]);
+    }
+  int oo0 = (o0.x() >= number_of_sheets()[0] ? 2 : 0) + (o0.y() >= number_of_sheets()[1] ? 1 : 0);
+  int oo1 = (o1.x() >= number_of_sheets()[0] ? 2 : 0) + (o1.y() >= number_of_sheets()[1] ? 1 : 0);
+  int oo2 = (o2.x() >= number_of_sheets()[0] ? 2 : 0) + (o2.y() >= number_of_sheets()[1] ? 1 : 0);
+  int oo3 = (o3.x() >= number_of_sheets()[0] ? 2 : 0) + (o3.y() >= number_of_sheets()[1] ? 1 : 0);
+  int oo4 = (o4.x() >= number_of_sheets()[0] ? 2 : 0) + (o4.y() >= number_of_sheets()[1] ? 1 : 0);
+  int oo5 = (o5.x() >= number_of_sheets()[0] ? 2 : 0) + (o5.y() >= number_of_sheets()[1] ? 1 : 0);
+
+  int oo[3];
+  oo[i1]      = oo0;
+  oo[ccw(i1)] = oo1;
+  oo[ cw(i1)] = oo2;
+  this->set_offsets(f1, oo[0], oo[1], oo[2]);
+  oo[i2]      = oo0;
+  oo[ccw(i2)] = oo2;
+  oo[ cw(i2)] = oo3;
+  this->set_offsets(f2, oo[0], oo[1], oo[2]);
+  oo[i4]      = oo3;
+  oo[ccw(i4)] = oo4;
+  oo[ cw(i4)] = oo5;
+  this->set_offsets(f4, oo[0], oo[1], oo[2]);
+  oo[i5]      = oo3;
+  oo[ccw(i5)] = oo5;
+  oo[ cw(i5)] = oo0;
+  this->set_offsets(f5, oo[0], oo[1], oo[2]);
+
+  insert_too_long_edge(f1, ccw(i1));
+  insert_too_long_edge(f2, ccw(i2));
+  insert_too_long_edge(f4, ccw(i4));
+  insert_too_long_edge(f5, ccw(i5));
+}
+
+
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::remove_degree6_antiN
+(
+  Vertex_handle &,
+  Face_handle &  f0, Face_handle &  f1, Face_handle &  f2,
+  Face_handle &  f3, Face_handle &  f4, Face_handle &  f5,
+  Vertex_handle &v0, Vertex_handle &, Vertex_handle &,
+  Vertex_handle &v3, Vertex_handle &, Vertex_handle &,
+  int i0, int i1, int i2, int i3, int i4, int i5 )
+{
+  // removing a degree 6 vertex, antiN configuration with diagonal v0v3
+  Face_handle nn;
+  f0->set_vertex( i0, v3) ;  // f0 = v0v1v3
+  f1->set_vertex( i1, v3) ;  // f1 = v1v2v3
+  f3->set_vertex( i3, v0) ;  // f3 = v3v4v0
+  f4->set_vertex( i4, v0) ;  // f4 = v4v5v0
+  nn = f2->neighbor( i2 );
+  tds().set_adjacency(f1, ccw(i1) , nn , nn->index(f2)  );
+  nn = f5->neighbor( i5 );
+  tds().set_adjacency(f4, ccw(i4) , nn , nn->index(f5) );
+  tds().set_adjacency(f0, cw(i0) , f3, cw(i3) );
+  tds().delete_face(f2);
+  tds().delete_face(f5);
+
+  f0->set_offsets(0, 0, 0);
+  f1->set_offsets(0, 0, 0);
+  f3->set_offsets(0, 0, 0);
+  f4->set_offsets(0, 0, 0);
+}
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::remove_degree6_antiN
+(
+  Vertex_handle &v,
+  Face_handle &  f0, Face_handle &  f1, Face_handle &  f2,
+  Face_handle &  f3, Face_handle &  f4, Face_handle &  f5,
+  Vertex_handle &v0, Vertex_handle &v1, Vertex_handle &v2,
+  Vertex_handle &v3, Vertex_handle &v4, Vertex_handle &v5,
+  Offset &o0, Offset &o1, Offset &o2,
+  Offset &o3, Offset &o4, Offset &o5,
+  int i0, int i1, int i2, int i3, int i4, int i5 )
+{
+  // removing a degree 6 vertex, antiN configuration with diagonal v0v3
+  remove_degree6_antiN(v,
+                       f0, f1, f2, f3, f4, f5,
+                       v0, v1, v2, v3, v4, v5,
+                       i0, i1, i2, i3, i4, i5);
+
+  if (o0.x() < 0 || o1.x() < 0 || o2.x() < 0 || o3.x() < 0 || o4.x() < 0 || o5.x() < 0)
+    {
+      o0 += Offset(number_of_sheets()[0], 0);
+      o1 += Offset(number_of_sheets()[0], 0);
+      o2 += Offset(number_of_sheets()[0], 0);
+      o3 += Offset(number_of_sheets()[0], 0);
+      o4 += Offset(number_of_sheets()[0], 0);
+      o5 += Offset(number_of_sheets()[0], 0);
+    }
+  if (o0.y() < 0 || o1.y() < 0 || o2.y() < 0 || o3.y() < 0 || o4.y() < 0 || o5.y() < 0)
+    {
+      o0 += Offset(0, number_of_sheets()[1]);
+      o1 += Offset(0, number_of_sheets()[1]);
+      o2 += Offset(0, number_of_sheets()[1]);
+      o3 += Offset(0, number_of_sheets()[1]);
+      o4 += Offset(0, number_of_sheets()[1]);
+      o5 += Offset(0, number_of_sheets()[1]);
+    }
+  int oo0 = (o0.x() >= number_of_sheets()[0] ? 2 : 0) + (o0.y() >= number_of_sheets()[1] ? 1 : 0);
+  int oo1 = (o1.x() >= number_of_sheets()[0] ? 2 : 0) + (o1.y() >= number_of_sheets()[1] ? 1 : 0);
+  int oo2 = (o2.x() >= number_of_sheets()[0] ? 2 : 0) + (o2.y() >= number_of_sheets()[1] ? 1 : 0);
+  int oo3 = (o3.x() >= number_of_sheets()[0] ? 2 : 0) + (o3.y() >= number_of_sheets()[1] ? 1 : 0);
+  int oo4 = (o4.x() >= number_of_sheets()[0] ? 2 : 0) + (o4.y() >= number_of_sheets()[1] ? 1 : 0);
+  int oo5 = (o5.x() >= number_of_sheets()[0] ? 2 : 0) + (o5.y() >= number_of_sheets()[1] ? 1 : 0);
+
+  int oo[3];
+  oo[i0]      = oo3;
+  oo[ccw(i0)] = oo0;
+  oo[ cw(i0)] = oo1;
+  this->set_offsets(f0, oo[0], oo[1], oo[2]);
+  oo[i1]      = oo3;
+  oo[ccw(i1)] = oo1;
+  oo[ cw(i1)] = oo2;
+  this->set_offsets(f1, oo[0], oo[1], oo[2]);
+  oo[i3]      = oo0;
+  oo[ccw(i3)] = oo3;
+  oo[ cw(i3)] = oo4;
+  this->set_offsets(f3, oo[0], oo[1], oo[2]);
+  oo[i4]      = oo0;
+  oo[ccw(i4)] = oo4;
+  oo[ cw(i4)] = oo5;
+  this->set_offsets(f4, oo[0], oo[1], oo[2]);
+
+  insert_too_long_edge(f0, ccw(i0));
+  insert_too_long_edge(f0,  cw(i0));
+  insert_too_long_edge(f3, ccw(i3));
+}
+
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::remove_degree6_diamond
+(
+  Vertex_handle &,
+  Face_handle &  f0, Face_handle &  f1, Face_handle &  f2,
+  Face_handle &  f3, Face_handle &  f4, Face_handle &  f5,
+  Vertex_handle &v0, Vertex_handle &, Vertex_handle &v2,
+  Vertex_handle &, Vertex_handle &v4, Vertex_handle &,
+  int i0, int i1, int i2, int i3, int i4, int i5 )
+{
+  // removing a degree 6 vertex, with chords v0v2 v2v4 v4v0
+  Face_handle nn;
+  f0->set_vertex( i0, v2) ;  // f0 = v0v1v2
+  f2->set_vertex( i2, v4) ;  // f2 = v2v3v4
+  f4->set_vertex( i4, v0) ;  // f4 = v4v5v0
+  f1->set_vertex( i1, v4) ;
+  f1->set_vertex( ccw(i1), v0) ;  // f1 = v0v2v4
+  nn = f1->neighbor( i1 );
+  tds().set_adjacency(f0, ccw(i0) , nn , nn->index(f1) );
+  nn = f3->neighbor( i3 );
+  tds().set_adjacency(f2, ccw(i2) , nn , nn->index(f3) );
+  nn = f5->neighbor( i5 );
+  tds().set_adjacency(f4, ccw(i4) , nn , nn->index(f5) );
+  tds().set_adjacency(f0, cw(i0) , f1 , i1  );
+  tds().set_adjacency(f4, cw(i4) , f1 , cw(i1) );
+
+  tds().delete_face(f3);
+  tds().delete_face(f5);
+
+
+  f0->set_offsets(0, 0, 0);
+  f1->set_offsets(0, 0, 0);
+  f2->set_offsets(0, 0, 0);
+  f4->set_offsets(0, 0, 0);
+}
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::remove_degree6_diamond
+(
+  Vertex_handle &v,
+  Face_handle &  f0, Face_handle &  f1, Face_handle &  f2,
+  Face_handle &  f3, Face_handle &  f4, Face_handle &  f5,
+  Vertex_handle &v0, Vertex_handle &v1, Vertex_handle &v2,
+  Vertex_handle &v3, Vertex_handle &v4, Vertex_handle &v5,
+  Offset &o0, Offset &o1, Offset &o2,
+  Offset &o3, Offset &o4, Offset &o5,
+  int i0, int i1, int i2, int i3, int i4, int i5 )
+{
+  // removing a degree 6 vertex, with chords v0v2 v2v4 v4v0
+  remove_degree6_diamond(v,
+                         f0, f1, f2, f3, f4, f5,
+                         v0, v1, v2, v3, v4, v5,
+                         i0, i1, i2, i3, i4, i5);
+
+  if (o0.x() < 0 || o1.x() < 0 || o2.x() < 0 || o3.x() < 0 || o4.x() < 0 || o5.x() < 0)
+    {
+      o0 += Offset(number_of_sheets()[0], 0);
+      o1 += Offset(number_of_sheets()[0], 0);
+      o2 += Offset(number_of_sheets()[0], 0);
+      o3 += Offset(number_of_sheets()[0], 0);
+      o4 += Offset(number_of_sheets()[0], 0);
+      o5 += Offset(number_of_sheets()[0], 0);
+    }
+  if (o0.y() < 0 || o1.y() < 0 || o2.y() < 0 || o3.y() < 0 || o4.y() < 0 || o5.y() < 0)
+    {
+      o0 += Offset(0, number_of_sheets()[1]);
+      o1 += Offset(0, number_of_sheets()[1]);
+      o2 += Offset(0, number_of_sheets()[1]);
+      o3 += Offset(0, number_of_sheets()[1]);
+      o4 += Offset(0, number_of_sheets()[1]);
+      o5 += Offset(0, number_of_sheets()[1]);
+    }
+  int oo0 = (o0.x() >= number_of_sheets()[0] ? 2 : 0) + (o0.y() >= number_of_sheets()[1] ? 1 : 0);
+  int oo1 = (o1.x() >= number_of_sheets()[0] ? 2 : 0) + (o1.y() >= number_of_sheets()[1] ? 1 : 0);
+  int oo2 = (o2.x() >= number_of_sheets()[0] ? 2 : 0) + (o2.y() >= number_of_sheets()[1] ? 1 : 0);
+  int oo3 = (o3.x() >= number_of_sheets()[0] ? 2 : 0) + (o3.y() >= number_of_sheets()[1] ? 1 : 0);
+  int oo4 = (o4.x() >= number_of_sheets()[0] ? 2 : 0) + (o4.y() >= number_of_sheets()[1] ? 1 : 0);
+  int oo5 = (o5.x() >= number_of_sheets()[0] ? 2 : 0) + (o5.y() >= number_of_sheets()[1] ? 1 : 0);
+
+  int oo[3];
+  oo[i0]      = oo2;
+  oo[ccw(i0)] = oo0;
+  oo[ cw(i0)] = oo1;
+  this->set_offsets(f0, oo[0], oo[1], oo[2]);
+  oo[i2]      = oo4;
+  oo[ccw(i2)] = oo2;
+  oo[ cw(i2)] = oo3;
+  this->set_offsets(f2, oo[0], oo[1], oo[2]);
+  oo[i4]      = oo0;
+  oo[ccw(i4)] = oo4;
+  oo[ cw(i4)] = oo5;
+  this->set_offsets(f4, oo[0], oo[1], oo[2]);
+  oo[i1]      = oo4;
+  oo[ccw(i1)] = oo0;
+  oo[ cw(i1)] = oo2;
+  this->set_offsets(f1, oo[0], oo[1], oo[2]);
+
+  insert_too_long_edge(f1, 0);
+  insert_too_long_edge(f1, 1);
+  insert_too_long_edge(f1, 2);
+}
+
+
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+remove_degree7(Vertex_handle v, std::vector<Face_handle> &f,
+               std::vector<Vertex_handle> &w,
+               std::vector<int> &i)
+{
+  // removing a degree 7 vertex
+
+  if (incircle(2, 0, 1, 3, f, w, i)) // sweeping from above
+    {
+      if (incircle(2, 3, 4, 0, f, w, i))
+        {
+          if (incircle(5, 3, 4, 6, f, w, i))
+            {
+              if (incircle(5, 3, 4, 2, f, w, i))
+                {
+                  if (incircle(6, 2, 3, 5, f, w, i))
+                    {
+                      if (incircle(6, 0, 1, 2, f, w, i))
+                        {
+                          remove_degree7_leftfan(v,  6  , f, w, i);
+                        }
+                      else
+                        {
+                          remove_degree7_zigzag(v,  6  , f, w, i);
+                        }
+                    }
+                  else
+                    {
+                      if (incircle(5, 0, 1, 2, f, w, i))
+                        {
+                          if (incircle(6, 1, 2, 5, f, w, i))
+                            {
+                              remove_degree7_zigzag(v, 2   , f, w, i);
+                            }
+                          else
+                            {
+                              if (incircle(6, 0, 1, 5, f, w, i))
+                                {
+                                  remove_degree7_rightfan(v, 5   , f, w, i);
+                                }
+                              else
+                                {
+                                  remove_degree7_star(v,  5  , f, w, i);
+                                }
+                            }
+                        }
+                      else
+                        {
+                          if (incircle(2, 5, 6, 0, f, w, i))
+                            {
+                              if (incircle(6, 0, 1, 2, f, w, i))
+                                {
+                                  remove_degree7_zigzag(v,  2  , f, w, i);
+                                }
+                              else
+                                {
+                                  remove_degree7_rightfan(v,  2  , f, w, i);
+                                }
+                            }
+                          else
+                            {
+                              remove_degree7_rightdelta(v,  5  , f, w, i);
+                            }
+                        }
+                    }
+                }
+              else
+                {
+                  if (incircle(4, 0, 1, 2, f, w, i))
+                    {
+                      if (incircle(5, 1, 2, 4, f, w, i))
+                        {
+                          if (incircle(6, 1, 2, 5, f, w, i))
+                            {
+                              remove_degree7_leftfan(v,  2  , f, w, i);
+                            }
+                          else
+                            {
+                              if (incircle(6, 0, 1, 5, f, w, i))
+                                {
+                                  remove_degree7_zigzag(v,  5  , f, w, i);
+                                }
+                              else
+                                {
+                                  remove_degree7_leftfan(v,  5  , f, w, i);
+                                }
+                            }
+                        }
+                      else
+                        {
+                          if (incircle(5, 0, 1, 4, f, w, i))
+                            {
+                              if (incircle(6, 0, 1, 5, f, w, i))
+                                {
+                                  remove_degree7_rightfan(v,  1  , f, w, i);
+                                }
+                              else
+                                {
+                                  remove_degree7_zigzag(v,  1  , f, w, i);
+                                }
+                            }
+                          else
+                            {
+                              remove_degree7_rightfan(v,  4  , f, w, i);
+                            }
+                        }
+                    }
+                  else
+                    {
+                      if (incircle(2, 4, 5, 0, f, w, i))
+                        {
+                          if (incircle(5, 0, 1, 2, f, w, i))
+                            {
+                              if (incircle(6, 1, 2, 5, f, w, i))
+                                {
+                                  remove_degree7_leftfan(v,  2  , f, w, i);
+                                }
+                              else
+                                {
+                                  if (incircle(6, 0, 1, 5, f, w, i))
+                                    {
+                                      remove_degree7_zigzag(v,  5  , f, w, i);
+                                    }
+                                  else
+                                    {
+                                      remove_degree7_leftfan(v,  5  , f, w, i);
+                                    }
+                                }
+                            }
+                          else
+                            {
+                              if (incircle(2, 5, 6, 0, f, w, i))
+                                {
+                                  if (incircle(6, 0, 1, 2, f, w, i))
+                                    {
+                                      remove_degree7_leftfan(v,  2  , f, w, i);
+                                    }
+                                  else
+                                    {
+                                      remove_degree7_star(v,  2  , f, w, i);
+                                    }
+                                }
+                              else
+                                {
+                                  remove_degree7_leftdelta(v,  2  , f, w, i);
+                                }
+                            }
+                        }
+                      else
+                        {
+                          remove_degree7_rightdelta(v,  0  , f, w, i);
+                        }
+                    }
+                }
+            }
+          else
+            {
+              if (incircle(6, 3, 4, 2, f, w, i))
+                {
+                  if (incircle(6, 0, 1, 2, f, w, i))
+                    {
+                      remove_degree7_star(v,  6  , f, w, i);
+                    }
+                  else
+                    {
+                      remove_degree7_rightfan(v,  6  , f, w, i);
+                    }
+                }
+              else
+                {
+                  if (incircle(4, 0, 1, 2, f, w, i))
+                    {
+                      if (incircle(2, 4, 5, 6, f, w, i))
+                        {
+                          if (incircle(5, 1, 2, 4, f, w, i))
+                            {
+                              if (incircle(6, 1, 2, 5, f, w, i))
+                                {
+                                  remove_degree7_leftfan(v,  2  , f, w, i);
+                                }
+                              else
+                                {
+                                  if (incircle(6, 0, 1, 5, f, w, i))
+                                    {
+                                      remove_degree7_zigzag(v,  5  , f, w, i);
+                                    }
+                                  else
+                                    {
+                                      remove_degree7_leftfan(v,  5  , f, w, i);
+                                    }
+                                }
+                            }
+                          else
+                            {
+                              if (incircle(5, 0, 1, 4, f, w, i))
+                                {
+                                  if (incircle(6, 0, 1, 5, f, w, i))
+                                    {
+                                      remove_degree7_rightfan(v,  1  , f, w, i);
+                                    }
+                                  else
+                                    {
+                                      remove_degree7_zigzag(v,  1  , f, w, i);
+                                    }
+                                }
+                              else
+                                {
+                                  remove_degree7_rightfan(v,  4  , f, w, i);
+                                }
+                            }
+                        }
+                      else
+                        {
+                          if (incircle(6, 1, 2, 4, f, w, i))
+                            {
+                              remove_degree7_leftdelta(v,  6  , f, w, i);
+                            }
+                          else
+                            {
+                              if (incircle(1, 4, 5, 6, f, w, i))
+                                {
+                                  if (incircle(1, 4, 5, 0, f, w, i))
+                                    {
+                                      if (incircle(6, 0, 1, 5, f, w, i))
+                                        {
+                                          remove_degree7_rightfan(v,  1  , f, w, i);
+                                        }
+                                      else
+                                        {
+                                          remove_degree7_zigzag(v,  1  , f, w, i);
+                                        }
+                                    }
+                                  else
+                                    {
+                                      remove_degree7_rightfan(v,  4  , f, w, i);
+                                    }
+                                }
+                              else
+                                {
+                                  if (incircle(6, 0, 1, 4, f, w, i))
+                                    {
+                                      remove_degree7_rightdelta(v,  4  , f, w, i);
+                                    }
+                                  else
+                                    {
+                                      if (incircle(6, 4, 5, 0, f, w, i))
+                                        {
+                                          remove_degree7_star(v,  4  , f, w, i);
+                                        }
+                                      else
+                                        {
+                                          remove_degree7_rightfan(v,  4  , f, w, i);
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+                  else
+                    {
+                      if (incircle(2, 4, 5, 6, f, w, i))
+                        {
+                          if (incircle(2, 4, 5, 0, f, w, i))
+                            {
+                              if (incircle(5, 0, 1, 2, f, w, i))
+                                {
+                                  if (incircle(6, 1, 2, 5, f, w, i))
+                                    {
+                                      remove_degree7_leftfan(v,  2  , f, w, i);
+                                    }
+                                  else
+                                    {
+                                      if (incircle(6, 0, 1, 5, f, w, i))
+                                        {
+                                          remove_degree7_zigzag(v,  5  , f, w, i);
+                                        }
+                                      else
+                                        {
+                                          remove_degree7_leftfan(v,  5  , f, w, i);
+                                        }
+                                    }
+                                }
+                              else
+                                {
+                                  if (incircle(2, 5, 6, 0, f, w, i))
+                                    {
+                                      if (incircle(6, 0, 1, 2, f, w, i))
+                                        {
+                                          remove_degree7_leftfan(v,  2  , f, w, i);
+                                        }
+                                      else
+                                        {
+                                          remove_degree7_star(v,  2  , f, w, i);
+                                        }
+                                    }
+                                  else
+                                    {
+                                      remove_degree7_leftdelta(v,  2  , f, w, i);
+                                    }
+                                }
+                            }
+                          else
+                            {
+                              remove_degree7_rightdelta(v,  0  , f, w, i);
+                            }
+                        }
+                      else
+                        {
+                          if (incircle(2, 6, 0, 4, f, w, i))
+                            {
+                              if (incircle(6, 0, 1, 2, f, w, i))
+                                {
+                                  remove_degree7_leftdelta(v,  6  , f, w, i);
+                                }
+                              else
+                                {
+                                  remove_degree7_rightdelta(v,  2  , f, w, i);
+                                }
+                            }
+                          else
+                            {
+                              if (incircle(6, 4, 5, 0, f, w, i))
+                                {
+                                  remove_degree7_leftdelta(v,  4  , f, w, i);
+                                }
+                              else
+                                {
+                                  remove_degree7_rightdelta(v,  0  , f, w, i);
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+      else
+        {
+          if (incircle(5, 3, 4, 6, f, w, i))
+            {
+              if (incircle(5, 3, 4, 0, f, w, i))
+                {
+                  if (incircle(5, 2, 3, 0, f, w, i))
+                    {
+                      if (incircle(6, 2, 3, 5, f, w, i))
+                        {
+                          if (incircle(6, 0, 1, 2, f, w, i))
+                            {
+                              remove_degree7_leftfan(v,  6  , f, w, i);
+                            }
+                          else
+                            {
+                              remove_degree7_zigzag(v,  6  , f, w, i);
+                            }
+                        }
+                      else if (incircle(5, 0, 1, 2, f, w, i))
+                        {
+                          if (incircle(6, 1, 2, 5, f, w, i))
+                            {
+                              remove_degree7_zigzag(v,  2  , f, w, i);
+                            }
+                          else
+                            {
+                              if (incircle(6, 0, 1, 5, f, w, i))
+                                {
+                                  remove_degree7_rightfan(v,  5  , f, w, i);
+                                }
+                              else
+                                {
+                                  remove_degree7_star(v,  5  , f, w, i);
+                                }
+                            }
+                        }
+                      else
+                        {
+                          if (incircle(2, 5, 6, 0, f, w, i))
+                            {
+                              if (incircle(6, 0, 1, 2, f, w, i))
+                                {
+                                  remove_degree7_zigzag(v,  2  , f, w, i);
+                                }
+                              else
+                                {
+                                  remove_degree7_rightfan(v,  2  , f, w, i);
+                                }
+                            }
+                          else
+                            {
+                              remove_degree7_rightdelta(v,  5  , f, w, i);
+                            }
+                        }
+                    }
+                  else
+                    {
+                      if (incircle(3, 5, 6, 0, f, w, i))
+                        {
+                          if (incircle(6, 2, 3, 0, f, w, i))
+                            {
+                              if (incircle(6, 0, 1, 2, f, w, i))
+                                {
+                                  remove_degree7_leftfan(v,  6  , f, w, i);
+                                }
+                              else
+                                {
+                                  remove_degree7_zigzag(v,  6  , f, w, i);
+                                }
+                            }
+                          else
+                            {
+                              remove_degree7_leftfan(v,  3  , f, w, i);
+                            }
+                        }
+                      else
+                        {
+                          remove_degree7_leftdelta(v,  0  , f, w, i);
+                        }
+                    }
+                }
+              else
+                {
+                  remove_degree7_star(v,  0  , f, w, i);
+                }
+            }
+          else
+            {
+              if (incircle(6, 3, 4, 0, f, w, i))
+                {
+                  if (incircle(6, 2, 3, 0, f, w, i))
+                    {
+                      if (incircle(6, 0, 1, 2, f, w, i))
+                        {
+                          remove_degree7_star(v,  6  , f, w, i);
+                        }
+                      else
+                        {
+                          remove_degree7_rightfan(v,  6  , f, w, i);
+                        }
+                    }
+                  else
+                    {
+                      remove_degree7_zigzag(v,  3  , f, w, i);
+                    }
+                }
+              else
+                {
+                  if (incircle(6, 4, 5, 0, f, w, i))
+                    {
+                      remove_degree7_leftfan(v,  0  , f, w, i);
+                    }
+                  else
+                    {
+                      remove_degree7_star(v,  0  , f, w, i);
+                    }
+                }
+            }
+        }
+    }
+  else    //sweeping from below
+    {
+      if (incircle(1, 6, 0, 3, f, w, i))
+        {
+          if (incircle(5, 6, 0, 4, f, w, i))
+            {
+              if (incircle(5, 6, 0, 1, f, w, i))
+                {
+                  if (incircle(4, 0, 1, 5, f, w, i))
+                    {
+                      if (incircle(4, 2, 3, 1, f, w, i))
+                        {
+                          remove_degree7_rightfan(v,  4  , f, w, i);
+                        }
+                      else
+                        {
+                          remove_degree7_zigzag(v,  4  , f, w, i);
+                        }
+                    }
+                  else
+                    {
+                      if (incircle(5, 2, 3, 1, f, w, i))
+                        {
+                          if (incircle(4, 1, 2, 5, f, w, i))
+                            {
+                              remove_degree7_zigzag(v, 1   , f, w, i);
+                            }
+                          else
+                            {
+                              if (incircle(4, 2, 3, 5, f, w, i))
+                                {
+                                  remove_degree7_leftfan(v, 5   , f, w, i);
+                                }
+                              else
+                                {
+                                  remove_degree7_star(v,  5  , f, w, i);
+                                }
+                            }
+                        }
+                      else
+                        {
+                          if (incircle(1, 4, 5, 3, f, w, i))
+                            {
+                              if (incircle(4, 2, 3, 1, f, w, i))
+                                {
+                                  remove_degree7_zigzag(v,  1  , f, w, i);
+                                }
+                              else
+                                {
+                                  remove_degree7_leftfan(v,  1  , f, w, i);
+                                }
+                            }
+                          else
+                            {
+                              remove_degree7_leftdelta(v,  5  , f, w, i);
+                            }
+                        }
+                    }
+                }
+              else
+                {
+                  if (incircle(6, 2, 3, 1, f, w, i))
+                    {
+                      if (incircle(5, 1, 2, 6, f, w, i))
+                        {
+                          if (incircle(4, 1, 2, 5, f, w, i))
+                            {
+                              remove_degree7_rightfan(v,  1  , f, w, i);
+                            }
+                          else
+                            {
+                              if (incircle(4, 2, 3, 5, f, w, i))
+                                {
+                                  remove_degree7_zigzag(v,  5  , f, w, i);
+                                }
+                              else
+                                {
+                                  remove_degree7_rightfan(v,  5  , f, w, i);
+                                }
+                            }
+                        }
+                      else
+                        {
+                          if (incircle(5, 2, 3, 6, f, w, i))
+                            {
+                              if (incircle(4, 2, 3, 5, f, w, i))
+                                {
+                                  remove_degree7_leftfan(v,  2  , f, w, i);
+                                }
+                              else
+                                {
+                                  remove_degree7_zigzag(v,  2  , f, w, i);
+                                }
+                            }
+                          else
+                            {
+                              remove_degree7_leftfan(v,  6  , f, w, i);
+                            }
+                        }
+                    }
+                  else
+                    {
+                      if (incircle(1, 5, 6, 3, f, w, i))
+                        {
+                          if (incircle(5, 2, 3, 1, f, w, i))
+                            {
+                              if (incircle(4, 1, 2, 5, f, w, i))
+                                {
+                                  remove_degree7_rightfan(v,  1  , f, w, i);
+                                }
+                              else
+                                {
+                                  if (incircle(4, 2, 3, 5, f, w, i))
+                                    {
+                                      remove_degree7_zigzag(v,  5  , f, w, i);
+                                    }
+                                  else
+                                    {
+                                      remove_degree7_rightfan(v,  5  , f, w, i);
+                                    }
+                                }
+                            }
+                          else
+                            {
+                              if (incircle(1, 4, 5, 3, f, w, i))
+                                {
+                                  if (incircle(4, 2, 3, 1, f, w, i))
+                                    {
+                                      remove_degree7_rightfan(v,  1  , f, w, i);
+                                    }
+                                  else
+                                    {
+                                      remove_degree7_star(v,  1  , f, w, i);
+                                    }
+                                }
+                              else
+                                {
+                                  remove_degree7_rightdelta(v,  1  , f, w, i);
+                                }
+                            }
+                        }
+                      else
+                        {
+                          remove_degree7_leftdelta(v,  3  , f, w, i);
+                        }
+                    }
+                }
+            }
+          else
+            {
+              if (incircle(4, 6, 0, 1, f, w, i))
+                {
+                  if (incircle(4, 2, 3, 1, f, w, i))
+                    {
+                      remove_degree7_star(v,  4  , f, w, i);
+                    }
+                  else
+                    {
+                      remove_degree7_leftfan(v,  4  , f, w, i);
+                    }
+                }
+              else
+                {
+                  if (incircle(6, 2, 3, 1, f, w, i))
+                    {
+                      if (incircle(1, 5, 6, 4, f, w, i))
+                        {
+                          if (incircle(5, 1, 2, 6, f, w, i))
+                            {
+                              if (incircle(4, 1, 2, 5, f, w, i))
+                                {
+                                  remove_degree7_rightfan(v,  1  , f, w, i);
+                                }
+                              else
+                                {
+                                  if (incircle(4, 2, 3, 5, f, w, i))
+                                    {
+                                      remove_degree7_zigzag(v,  5  , f, w, i);
+                                    }
+                                  else
+                                    {
+                                      remove_degree7_rightfan(v,  5  , f, w, i);
+                                    }
+                                }
+                            }
+                          else
+                            {
+                              if (incircle(5, 2, 3, 6, f, w, i))
+                                {
+                                  if (incircle(4, 2, 3, 5, f, w, i))
+                                    {
+                                      remove_degree7_leftfan(v,  2  , f, w, i);
+                                    }
+                                  else
+                                    {
+                                      remove_degree7_zigzag(v,  2  , f, w, i);
+                                    }
+                                }
+                              else
+                                {
+                                  remove_degree7_leftfan(v,  6  , f, w, i);
+                                }
+                            }
+                        }
+                      else
+                        {
+                          if (incircle(4, 1, 2, 6, f, w, i))
+                            {
+                              remove_degree7_rightdelta(v,  4  , f, w, i);
+                            }
+                          else
+                            {
+                              if (incircle(2, 5, 6, 4, f, w, i))
+                                {
+                                  if (incircle(2, 5, 6, 3, f, w, i))
+                                    {
+                                      if (incircle(4, 2, 3, 5, f, w, i))
+                                        {
+                                          remove_degree7_leftfan(v,  2  , f, w, i);
+                                        }
+                                      else
+                                        {
+                                          remove_degree7_zigzag(v,  2  , f, w, i);
+                                        }
+                                    }
+                                  else
+                                    {
+                                      remove_degree7_leftfan(v,  6  , f, w, i);
+                                    }
+                                }
+                              else
+                                {
+                                  if (incircle(4, 2, 3, 6, f, w, i))
+                                    {
+                                      remove_degree7_leftdelta(v,  6  , f, w, i);
+                                    }
+                                  else
+                                    {
+                                      if (incircle(4, 5, 6, 3, f, w, i))
+                                        {
+                                          remove_degree7_star(v,  6  , f, w, i);
+                                        }
+                                      else
+                                        {
+                                          remove_degree7_leftfan(v,  6  , f, w, i);
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+                  else
+                    {
+                      if (incircle(1, 5, 6, 4, f, w, i))
+                        {
+                          if (incircle(1, 5, 6, 3, f, w, i))
+                            {
+                              if (incircle(5, 2, 3, 1, f, w, i))
+                                {
+                                  if (incircle(4, 1, 2, 5, f, w, i))
+                                    {
+                                      remove_degree7_rightfan(v,  1  , f, w, i);
+                                    }
+                                  else
+                                    {
+                                      if (incircle(4, 2, 3, 5, f, w, i))
+                                        {
+                                          remove_degree7_zigzag(v,  5  , f, w, i);
+                                        }
+                                      else
+                                        {
+                                          remove_degree7_rightfan(v,  5  , f, w, i);
+                                        }
+                                    }
+                                }
+                              else
+                                {
+                                  if (incircle(1, 4, 5, 3, f, w, i))
+                                    {
+                                      if (incircle(4, 2, 3, 1, f, w, i))
+                                        {
+                                          remove_degree7_rightfan(v,  1  , f, w, i);
+                                        }
+                                      else
+                                        {
+                                          remove_degree7_star(v,  1  , f, w, i);
+                                        }
+                                    }
+                                  else
+                                    {
+                                      remove_degree7_rightdelta(v,  1  , f, w, i);
+                                    }
+                                }
+                            }
+                          else
+                            {
+                              remove_degree7_leftdelta(v,  3  , f, w, i);
+                            }
+                        }
+                      else
+                        {
+                          if (incircle(1, 3, 4, 6, f, w, i))
+                            {
+                              if (incircle(4, 2, 3, 1, f, w, i))
+                                {
+                                  remove_degree7_rightdelta(v,  4  , f, w, i);
+                                }
+                              else
+                                {
+                                  remove_degree7_leftdelta(v,  1  , f, w, i);
+                                }
+                            }
+                          else
+                            {
+                              if (incircle(4, 5, 6, 3, f, w, i))
+                                {
+                                  remove_degree7_rightdelta(v,  6  , f, w, i);
+                                }
+                              else
+                                {
+                                  remove_degree7_leftdelta(v,  3  , f, w, i);
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+      else
+        {
+          if (incircle(5, 6, 0, 4, f, w, i))
+            {
+              if (incircle(5, 6, 0, 3, f, w, i))
+                {
+                  if (incircle(5, 0, 1, 3, f, w, i))
+                    {
+                      if (incircle(4, 0, 1, 5, f, w, i))
+                        {
+                          if (incircle(4, 2, 3, 1, f, w, i))
+                            {
+                              remove_degree7_rightfan(v,  4  , f, w, i);
+                            }
+                          else
+                            {
+                              remove_degree7_zigzag(v,  4  , f, w, i);
+                            }
+                        }
+                      else if (incircle(5, 2, 3, 1, f, w, i))
+                        {
+                          if (incircle(4, 1, 2, 5, f, w, i))
+                            {
+                              remove_degree7_zigzag(v,  1  , f, w, i);
+                            }
+                          else
+                            {
+                              if (incircle(4, 2, 3, 5, f, w, i))
+                                {
+                                  remove_degree7_leftfan(v,  5  , f, w, i);
+                                }
+                              else
+                                {
+                                  remove_degree7_star(v,  5  , f, w, i);
+                                }
+                            }
+                        }
+                      else
+                        {
+                          if (incircle(1, 4, 5, 3, f, w, i))
+                            {
+                              if (incircle(4, 2, 3, 1, f, w, i))
+                                {
+                                  remove_degree7_zigzag(v,  1  , f, w, i);
+                                }
+                              else
+                                {
+                                  remove_degree7_leftfan(v,  1  , f, w, i);
+                                }
+                            }
+                          else
+                            {
+                              remove_degree7_leftdelta(v,  5  , f, w, i);
+                            }
+                        }
+                    }
+                  else
+                    {
+                      if (! incircle(3, 4, 5, 0, f, w, i))
+                        {
+                          if (incircle(4, 0, 1, 3, f, w, i))
+                            {
+                              if (incircle(4, 2, 3, 1, f, w, i))
+                                {
+                                  remove_degree7_rightfan(v,  4  , f, w, i);
+                                }
+                              else
+                                {
+                                  remove_degree7_zigzag(v,  4  , f, w, i);
+                                }
+                            }
+                          else
+                            {
+                              remove_degree7_rightfan(v,  0  , f, w, i);
+                            }
+                        }
+                      else
+                        {
+                          remove_degree7_rightdelta(v,  3  , f, w, i);
+                        }
+                    }
+                }
+              else
+                {
+                  remove_degree7_star(v,  3  , f, w, i);
+                }
+            }
+          else
+            {
+              if (incircle(4, 6, 0, 3, f, w, i))
+                {
+                  if (incircle(4, 0, 1, 3, f, w, i))
+                    {
+                      if (incircle(4, 2, 3, 1, f, w, i))
+                        {
+                          remove_degree7_star(v,  4  , f, w, i);
+                        }
+                      else
+                        {
+                          remove_degree7_leftfan(v,  4  , f, w, i);
+                        }
+                    }
+                  else
+                    {
+                      remove_degree7_zigzag(v,  0  , f, w, i);
+                    }
+                }
+              else
+                {
+                  if (incircle(4, 5, 6, 3, f, w, i))
+                    {
+                      remove_degree7_rightfan(v,  3  , f, w, i);
+                    }
+                  else
+                    {
+                      remove_degree7_star(v,  3  , f, w, i);
+                    }
+                }
+            }
+        }
+    }
+}
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+remove_degree7(Vertex_handle v, std::vector<Face_handle> &f,
+               std::vector<Vertex_handle> &w, std::vector<Offset> &o,
+               std::vector<int> &i)
+{
+  // removing a degree 7 vertex
+
+  if (incircle(2, 0, 1, 3, f, w, o, i)) // sweeping from above
+    {
+      if (incircle(2, 3, 4, 0, f, w, o, i))
+        {
+          if (incircle(5, 3, 4, 6, f, w, o, i))
+            {
+              if (incircle(5, 3, 4, 2, f, w, o, i))
+                {
+                  if (incircle(6, 2, 3, 5, f, w, o, i))
+                    {
+                      if (incircle(6, 0, 1, 2, f, w, o, i))
+                        {
+                          remove_degree7_leftfan(v,  6  , f, w, o, i);
+                        }
+                      else
+                        {
+                          remove_degree7_zigzag(v,  6  , f, w, o, i);
+                        }
+                    }
+                  else
+                    {
+                      if (incircle(5, 0, 1, 2, f, w, o, i))
+                        {
+                          if (incircle(6, 1, 2, 5, f, w, o, i))
+                            {
+                              remove_degree7_zigzag(v, 2   , f, w, o, i);
+                            }
+                          else
+                            {
+                              if (incircle(6, 0, 1, 5, f, w, o, i))
+                                {
+                                  remove_degree7_rightfan(v, 5   , f, w, o, i);
+                                }
+                              else
+                                {
+                                  remove_degree7_star(v,  5  , f, w, o, i);
+                                }
+                            }
+                        }
+                      else
+                        {
+                          if (incircle(2, 5, 6, 0, f, w, o, i))
+                            {
+                              if (incircle(6, 0, 1, 2, f, w, o, i))
+                                {
+                                  remove_degree7_zigzag(v,  2  , f, w, o, i);
+                                }
+                              else
+                                {
+                                  remove_degree7_rightfan(v,  2  , f, w, o, i);
+                                }
+                            }
+                          else
+                            {
+                              remove_degree7_rightdelta(v,  5  , f, w, o, i);
+                            }
+                        }
+                    }
+                }
+              else
+                {
+                  if (incircle(4, 0, 1, 2, f, w, o, i))
+                    {
+                      if (incircle(5, 1, 2, 4, f, w, o, i))
+                        {
+                          if (incircle(6, 1, 2, 5, f, w, o, i))
+                            {
+                              remove_degree7_leftfan(v,  2  , f, w, o, i);
+                            }
+                          else
+                            {
+                              if (incircle(6, 0, 1, 5, f, w, o, i))
+                                {
+                                  remove_degree7_zigzag(v,  5  , f, w, o, i);
+                                }
+                              else
+                                {
+                                  remove_degree7_leftfan(v,  5  , f, w, o, i);
+                                }
+                            }
+                        }
+                      else
+                        {
+                          if (incircle(5, 0, 1, 4, f, w, o, i))
+                            {
+                              if (incircle(6, 0, 1, 5, f, w, o, i))
+                                {
+                                  remove_degree7_rightfan(v,  1  , f, w, o, i);
+                                }
+                              else
+                                {
+                                  remove_degree7_zigzag(v,  1  , f, w, o, i);
+                                }
+                            }
+                          else
+                            {
+                              remove_degree7_rightfan(v,  4  , f, w, o, i);
+                            }
+                        }
+                    }
+                  else
+                    {
+                      if (incircle(2, 4, 5, 0, f, w, o, i))
+                        {
+                          if (incircle(5, 0, 1, 2, f, w, o, i))
+                            {
+                              if (incircle(6, 1, 2, 5, f, w, o, i))
+                                {
+                                  remove_degree7_leftfan(v,  2  , f, w, o, i);
+                                }
+                              else
+                                {
+                                  if (incircle(6, 0, 1, 5, f, w, o, i))
+                                    {
+                                      remove_degree7_zigzag(v,  5  , f, w, o, i);
+                                    }
+                                  else
+                                    {
+                                      remove_degree7_leftfan(v,  5  , f, w, o, i);
+                                    }
+                                }
+                            }
+                          else
+                            {
+                              if (incircle(2, 5, 6, 0, f, w, o, i))
+                                {
+                                  if (incircle(6, 0, 1, 2, f, w, o, i))
+                                    {
+                                      remove_degree7_leftfan(v,  2  , f, w, o, i);
+                                    }
+                                  else
+                                    {
+                                      remove_degree7_star(v,  2  , f, w, o, i);
+                                    }
+                                }
+                              else
+                                {
+                                  remove_degree7_leftdelta(v,  2  , f, w, o, i);
+                                }
+                            }
+                        }
+                      else
+                        {
+                          remove_degree7_rightdelta(v,  0  , f, w, o, i);
+                        }
+                    }
+                }
+            }
+          else
+            {
+              if (incircle(6, 3, 4, 2, f, w, o, i))
+                {
+                  if (incircle(6, 0, 1, 2, f, w, o, i))
+                    {
+                      remove_degree7_star(v,  6  , f, w, o, i);
+                    }
+                  else
+                    {
+                      remove_degree7_rightfan(v,  6  , f, w, o, i);
+                    }
+                }
+              else
+                {
+                  if (incircle(4, 0, 1, 2, f, w, o, i))
+                    {
+                      if (incircle(2, 4, 5, 6, f, w, o, i))
+                        {
+                          if (incircle(5, 1, 2, 4, f, w, o, i))
+                            {
+                              if (incircle(6, 1, 2, 5, f, w, o, i))
+                                {
+                                  remove_degree7_leftfan(v,  2  , f, w, o, i);
+                                }
+                              else
+                                {
+                                  if (incircle(6, 0, 1, 5, f, w, o, i))
+                                    {
+                                      remove_degree7_zigzag(v,  5  , f, w, o, i);
+                                    }
+                                  else
+                                    {
+                                      remove_degree7_leftfan(v,  5  , f, w, o, i);
+                                    }
+                                }
+                            }
+                          else
+                            {
+                              if (incircle(5, 0, 1, 4, f, w, o, i))
+                                {
+                                  if (incircle(6, 0, 1, 5, f, w, o, i))
+                                    {
+                                      remove_degree7_rightfan(v,  1  , f, w, o, i);
+                                    }
+                                  else
+                                    {
+                                      remove_degree7_zigzag(v,  1  , f, w, o, i);
+                                    }
+                                }
+                              else
+                                {
+                                  remove_degree7_rightfan(v,  4  , f, w, o, i);
+                                }
+                            }
+                        }
+                      else
+                        {
+                          if (incircle(6, 1, 2, 4, f, w, o, i))
+                            {
+                              remove_degree7_leftdelta(v,  6  , f, w, o, i);
+                            }
+                          else
+                            {
+                              if (incircle(1, 4, 5, 6, f, w, o, i))
+                                {
+                                  if (incircle(1, 4, 5, 0, f, w, o, i))
+                                    {
+                                      if (incircle(6, 0, 1, 5, f, w, o, i))
+                                        {
+                                          remove_degree7_rightfan(v,  1  , f, w, o, i);
+                                        }
+                                      else
+                                        {
+                                          remove_degree7_zigzag(v,  1  , f, w, o, i);
+                                        }
+                                    }
+                                  else
+                                    {
+                                      remove_degree7_rightfan(v,  4  , f, w, o, i);
+                                    }
+                                }
+                              else
+                                {
+                                  if (incircle(6, 0, 1, 4, f, w, o, i))
+                                    {
+                                      remove_degree7_rightdelta(v,  4  , f, w, o, i);
+                                    }
+                                  else
+                                    {
+                                      if (incircle(6, 4, 5, 0, f, w, o, i))
+                                        {
+                                          remove_degree7_star(v,  4  , f, w, o, i);
+                                        }
+                                      else
+                                        {
+                                          remove_degree7_rightfan(v,  4  , f, w, o, i);
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+                  else
+                    {
+                      if (incircle(2, 4, 5, 6, f, w, o, i))
+                        {
+                          if (incircle(2, 4, 5, 0, f, w, o, i))
+                            {
+                              if (incircle(5, 0, 1, 2, f, w, o, i))
+                                {
+                                  if (incircle(6, 1, 2, 5, f, w, o, i))
+                                    {
+                                      remove_degree7_leftfan(v,  2  , f, w, o, i);
+                                    }
+                                  else
+                                    {
+                                      if (incircle(6, 0, 1, 5, f, w, o, i))
+                                        {
+                                          remove_degree7_zigzag(v,  5  , f, w, o, i);
+                                        }
+                                      else
+                                        {
+                                          remove_degree7_leftfan(v,  5  , f, w, o, i);
+                                        }
+                                    }
+                                }
+                              else
+                                {
+                                  if (incircle(2, 5, 6, 0, f, w, o, i))
+                                    {
+                                      if (incircle(6, 0, 1, 2, f, w, o, i))
+                                        {
+                                          remove_degree7_leftfan(v,  2  , f, w, o, i);
+                                        }
+                                      else
+                                        {
+                                          remove_degree7_star(v,  2  , f, w, o, i);
+                                        }
+                                    }
+                                  else
+                                    {
+                                      remove_degree7_leftdelta(v,  2  , f, w, o, i);
+                                    }
+                                }
+                            }
+                          else
+                            {
+                              remove_degree7_rightdelta(v,  0  , f, w, o, i);
+                            }
+                        }
+                      else
+                        {
+                          if (incircle(2, 6, 0, 4, f, w, o, i))
+                            {
+                              if (incircle(6, 0, 1, 2, f, w, o, i))
+                                {
+                                  remove_degree7_leftdelta(v,  6  , f, w, o, i);
+                                }
+                              else
+                                {
+                                  remove_degree7_rightdelta(v,  2  , f, w, o, i);
+                                }
+                            }
+                          else
+                            {
+                              if (incircle(6, 4, 5, 0, f, w, o, i))
+                                {
+                                  remove_degree7_leftdelta(v,  4  , f, w, o, i);
+                                }
+                              else
+                                {
+                                  remove_degree7_rightdelta(v,  0  , f, w, o, i);
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+      else
+        {
+          if (incircle(5, 3, 4, 6, f, w, o, i))
+            {
+              if (incircle(5, 3, 4, 0, f, w, o, i))
+                {
+                  if (incircle(5, 2, 3, 0, f, w, o, i))
+                    {
+                      if (incircle(6, 2, 3, 5, f, w, o, i))
+                        {
+                          if (incircle(6, 0, 1, 2, f, w, o, i))
+                            {
+                              remove_degree7_leftfan(v,  6  , f, w, o, i);
+                            }
+                          else
+                            {
+                              remove_degree7_zigzag(v,  6  , f, w, o, i);
+                            }
+                        }
+                      else if (incircle(5, 0, 1, 2, f, w, o, i))
+                        {
+                          if (incircle(6, 1, 2, 5, f, w, o, i))
+                            {
+                              remove_degree7_zigzag(v,  2  , f, w, o, i);
+                            }
+                          else
+                            {
+                              if (incircle(6, 0, 1, 5, f, w, o, i))
+                                {
+                                  remove_degree7_rightfan(v,  5  , f, w, o, i);
+                                }
+                              else
+                                {
+                                  remove_degree7_star(v,  5  , f, w, o, i);
+                                }
+                            }
+                        }
+                      else
+                        {
+                          if (incircle(2, 5, 6, 0, f, w, o, i))
+                            {
+                              if (incircle(6, 0, 1, 2, f, w, o, i))
+                                {
+                                  remove_degree7_zigzag(v,  2  , f, w, o, i);
+                                }
+                              else
+                                {
+                                  remove_degree7_rightfan(v,  2  , f, w, o, i);
+                                }
+                            }
+                          else
+                            {
+                              remove_degree7_rightdelta(v,  5  , f, w, o, i);
+                            }
+                        }
+                    }
+                  else
+                    {
+                      if (incircle(3, 5, 6, 0, f, w, o, i))
+                        {
+                          if (incircle(6, 2, 3, 0, f, w, o, i))
+                            {
+                              if (incircle(6, 0, 1, 2, f, w, o, i))
+                                {
+                                  remove_degree7_leftfan(v,  6  , f, w, o, i);
+                                }
+                              else
+                                {
+                                  remove_degree7_zigzag(v,  6  , f, w, o, i);
+                                }
+                            }
+                          else
+                            {
+                              remove_degree7_leftfan(v,  3  , f, w, o, i);
+                            }
+                        }
+                      else
+                        {
+                          remove_degree7_leftdelta(v,  0  , f, w, o, i);
+                        }
+                    }
+                }
+              else
+                {
+                  remove_degree7_star(v,  0  , f, w, o, i);
+                }
+            }
+          else
+            {
+              if (incircle(6, 3, 4, 0, f, w, o, i))
+                {
+                  if (incircle(6, 2, 3, 0, f, w, o, i))
+                    {
+                      if (incircle(6, 0, 1, 2, f, w, o, i))
+                        {
+                          remove_degree7_star(v,  6  , f, w, o, i);
+                        }
+                      else
+                        {
+                          remove_degree7_rightfan(v,  6  , f, w, o, i);
+                        }
+                    }
+                  else
+                    {
+                      remove_degree7_zigzag(v,  3  , f, w, o, i);
+                    }
+                }
+              else
+                {
+                  if (incircle(6, 4, 5, 0, f, w, o, i))
+                    {
+                      remove_degree7_leftfan(v,  0  , f, w, o, i);
+                    }
+                  else
+                    {
+                      remove_degree7_star(v,  0  , f, w, o, i);
+                    }
+                }
+            }
+        }
+    }
+  else    //sweeping from below
+    {
+      if (incircle(1, 6, 0, 3, f, w, o, i))
+        {
+          if (incircle(5, 6, 0, 4, f, w, o, i))
+            {
+              if (incircle(5, 6, 0, 1, f, w, o, i))
+                {
+                  if (incircle(4, 0, 1, 5, f, w, o, i))
+                    {
+                      if (incircle(4, 2, 3, 1, f, w, o, i))
+                        {
+                          remove_degree7_rightfan(v,  4  , f, w, o, i);
+                        }
+                      else
+                        {
+                          remove_degree7_zigzag(v,  4  , f, w, o, i);
+                        }
+                    }
+                  else
+                    {
+                      if (incircle(5, 2, 3, 1, f, w, o, i))
+                        {
+                          if (incircle(4, 1, 2, 5, f, w, o, i))
+                            {
+                              remove_degree7_zigzag(v, 1   , f, w, o, i);
+                            }
+                          else
+                            {
+                              if (incircle(4, 2, 3, 5, f, w, o, i))
+                                {
+                                  remove_degree7_leftfan(v, 5   , f, w, o, i);
+                                }
+                              else
+                                {
+                                  remove_degree7_star(v,  5  , f, w, o, i);
+                                }
+                            }
+                        }
+                      else
+                        {
+                          if (incircle(1, 4, 5, 3, f, w, o, i))
+                            {
+                              if (incircle(4, 2, 3, 1, f, w, o, i))
+                                {
+                                  remove_degree7_zigzag(v,  1  , f, w, o, i);
+                                }
+                              else
+                                {
+                                  remove_degree7_leftfan(v,  1  , f, w, o, i);
+                                }
+                            }
+                          else
+                            {
+                              remove_degree7_leftdelta(v,  5  , f, w, o, i);
+                            }
+                        }
+                    }
+                }
+              else
+                {
+                  if (incircle(6, 2, 3, 1, f, w, o, i))
+                    {
+                      if (incircle(5, 1, 2, 6, f, w, o, i))
+                        {
+                          if (incircle(4, 1, 2, 5, f, w, o, i))
+                            {
+                              remove_degree7_rightfan(v,  1  , f, w, o, i);
+                            }
+                          else
+                            {
+                              if (incircle(4, 2, 3, 5, f, w, o, i))
+                                {
+                                  remove_degree7_zigzag(v,  5  , f, w, o, i);
+                                }
+                              else
+                                {
+                                  remove_degree7_rightfan(v,  5  , f, w, o, i);
+                                }
+                            }
+                        }
+                      else
+                        {
+                          if (incircle(5, 2, 3, 6, f, w, o, i))
+                            {
+                              if (incircle(4, 2, 3, 5, f, w, o, i))
+                                {
+                                  remove_degree7_leftfan(v,  2  , f, w, o, i);
+                                }
+                              else
+                                {
+                                  remove_degree7_zigzag(v,  2  , f, w, o, i);
+                                }
+                            }
+                          else
+                            {
+                              remove_degree7_leftfan(v,  6  , f, w, o, i);
+                            }
+                        }
+                    }
+                  else
+                    {
+                      if (incircle(1, 5, 6, 3, f, w, o, i))
+                        {
+                          if (incircle(5, 2, 3, 1, f, w, o, i))
+                            {
+                              if (incircle(4, 1, 2, 5, f, w, o, i))
+                                {
+                                  remove_degree7_rightfan(v,  1  , f, w, o, i);
+                                }
+                              else
+                                {
+                                  if (incircle(4, 2, 3, 5, f, w, o, i))
+                                    {
+                                      remove_degree7_zigzag(v,  5  , f, w, o, i);
+                                    }
+                                  else
+                                    {
+                                      remove_degree7_rightfan(v,  5  , f, w, o, i);
+                                    }
+                                }
+                            }
+                          else
+                            {
+                              if (incircle(1, 4, 5, 3, f, w, o, i))
+                                {
+                                  if (incircle(4, 2, 3, 1, f, w, o, i))
+                                    {
+                                      remove_degree7_rightfan(v,  1  , f, w, o, i);
+                                    }
+                                  else
+                                    {
+                                      remove_degree7_star(v,  1  , f, w, o, i);
+                                    }
+                                }
+                              else
+                                {
+                                  remove_degree7_rightdelta(v,  1  , f, w, o, i);
+                                }
+                            }
+                        }
+                      else
+                        {
+                          remove_degree7_leftdelta(v,  3  , f, w, o, i);
+                        }
+                    }
+                }
+            }
+          else
+            {
+              if (incircle(4, 6, 0, 1, f, w, o, i))
+                {
+                  if (incircle(4, 2, 3, 1, f, w, o, i))
+                    {
+                      remove_degree7_star(v,  4  , f, w, o, i);
+                    }
+                  else
+                    {
+                      remove_degree7_leftfan(v,  4  , f, w, o, i);
+                    }
+                }
+              else
+                {
+                  if (incircle(6, 2, 3, 1, f, w, o, i))
+                    {
+                      if (incircle(1, 5, 6, 4, f, w, o, i))
+                        {
+                          if (incircle(5, 1, 2, 6, f, w, o, i))
+                            {
+                              if (incircle(4, 1, 2, 5, f, w, o, i))
+                                {
+                                  remove_degree7_rightfan(v,  1  , f, w, o, i);
+                                }
+                              else
+                                {
+                                  if (incircle(4, 2, 3, 5, f, w, o, i))
+                                    {
+                                      remove_degree7_zigzag(v,  5  , f, w, o, i);
+                                    }
+                                  else
+                                    {
+                                      remove_degree7_rightfan(v,  5  , f, w, o, i);
+                                    }
+                                }
+                            }
+                          else
+                            {
+                              if (incircle(5, 2, 3, 6, f, w, o, i))
+                                {
+                                  if (incircle(4, 2, 3, 5, f, w, o, i))
+                                    {
+                                      remove_degree7_leftfan(v,  2  , f, w, o, i);
+                                    }
+                                  else
+                                    {
+                                      remove_degree7_zigzag(v,  2  , f, w, o, i);
+                                    }
+                                }
+                              else
+                                {
+                                  remove_degree7_leftfan(v,  6  , f, w, o, i);
+                                }
+                            }
+                        }
+                      else
+                        {
+                          if (incircle(4, 1, 2, 6, f, w, o, i))
+                            {
+                              remove_degree7_rightdelta(v,  4  , f, w, o, i);
+                            }
+                          else
+                            {
+                              if (incircle(2, 5, 6, 4, f, w, o, i))
+                                {
+                                  if (incircle(2, 5, 6, 3, f, w, o, i))
+                                    {
+                                      if (incircle(4, 2, 3, 5, f, w, o, i))
+                                        {
+                                          remove_degree7_leftfan(v,  2  , f, w, o, i);
+                                        }
+                                      else
+                                        {
+                                          remove_degree7_zigzag(v,  2  , f, w, o, i);
+                                        }
+                                    }
+                                  else
+                                    {
+                                      remove_degree7_leftfan(v,  6  , f, w, o, i);
+                                    }
+                                }
+                              else
+                                {
+                                  if (incircle(4, 2, 3, 6, f, w, o, i))
+                                    {
+                                      remove_degree7_leftdelta(v,  6  , f, w, o, i);
+                                    }
+                                  else
+                                    {
+                                      if (incircle(4, 5, 6, 3, f, w, o, i))
+                                        {
+                                          remove_degree7_star(v,  6  , f, w, o, i);
+                                        }
+                                      else
+                                        {
+                                          remove_degree7_leftfan(v,  6  , f, w, o, i);
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+                  else
+                    {
+                      if (incircle(1, 5, 6, 4, f, w, o, i))
+                        {
+                          if (incircle(1, 5, 6, 3, f, w, o, i))
+                            {
+                              if (incircle(5, 2, 3, 1, f, w, o, i))
+                                {
+                                  if (incircle(4, 1, 2, 5, f, w, o, i))
+                                    {
+                                      remove_degree7_rightfan(v,  1  , f, w, o, i);
+                                    }
+                                  else
+                                    {
+                                      if (incircle(4, 2, 3, 5, f, w, o, i))
+                                        {
+                                          remove_degree7_zigzag(v,  5  , f, w, o, i);
+                                        }
+                                      else
+                                        {
+                                          remove_degree7_rightfan(v,  5  , f, w, o, i);
+                                        }
+                                    }
+                                }
+                              else
+                                {
+                                  if (incircle(1, 4, 5, 3, f, w, o, i))
+                                    {
+                                      if (incircle(4, 2, 3, 1, f, w, o, i))
+                                        {
+                                          remove_degree7_rightfan(v,  1  , f, w, o, i);
+                                        }
+                                      else
+                                        {
+                                          remove_degree7_star(v,  1  , f, w, o, i);
+                                        }
+                                    }
+                                  else
+                                    {
+                                      remove_degree7_rightdelta(v,  1  , f, w, o, i);
+                                    }
+                                }
+                            }
+                          else
+                            {
+                              remove_degree7_leftdelta(v,  3  , f, w, o, i);
+                            }
+                        }
+                      else
+                        {
+                          if (incircle(1, 3, 4, 6, f, w, o, i))
+                            {
+                              if (incircle(4, 2, 3, 1, f, w, o, i))
+                                {
+                                  remove_degree7_rightdelta(v,  4  , f, w, o, i);
+                                }
+                              else
+                                {
+                                  remove_degree7_leftdelta(v,  1  , f, w, o, i);
+                                }
+                            }
+                          else
+                            {
+                              if (incircle(4, 5, 6, 3, f, w, o, i))
+                                {
+                                  remove_degree7_rightdelta(v,  6  , f, w, o, i);
+                                }
+                              else
+                                {
+                                  remove_degree7_leftdelta(v,  3  , f, w, o, i);
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+      else
+        {
+          if (incircle(5, 6, 0, 4, f, w, o, i))
+            {
+              if (incircle(5, 6, 0, 3, f, w, o, i))
+                {
+                  if (incircle(5, 0, 1, 3, f, w, o, i))
+                    {
+                      if (incircle(4, 0, 1, 5, f, w, o, i))
+                        {
+                          if (incircle(4, 2, 3, 1, f, w, o, i))
+                            {
+                              remove_degree7_rightfan(v,  4  , f, w, o, i);
+                            }
+                          else
+                            {
+                              remove_degree7_zigzag(v,  4  , f, w, o, i);
+                            }
+                        }
+                      else if (incircle(5, 2, 3, 1, f, w, o, i))
+                        {
+                          if (incircle(4, 1, 2, 5, f, w, o, i))
+                            {
+                              remove_degree7_zigzag(v,  1  , f, w, o, i);
+                            }
+                          else
+                            {
+                              if (incircle(4, 2, 3, 5, f, w, o, i))
+                                {
+                                  remove_degree7_leftfan(v,  5  , f, w, o, i);
+                                }
+                              else
+                                {
+                                  remove_degree7_star(v,  5  , f, w, o, i);
+                                }
+                            }
+                        }
+                      else
+                        {
+                          if (incircle(1, 4, 5, 3, f, w, o, i))
+                            {
+                              if (incircle(4, 2, 3, 1, f, w, o, i))
+                                {
+                                  remove_degree7_zigzag(v,  1  , f, w, o, i);
+                                }
+                              else
+                                {
+                                  remove_degree7_leftfan(v,  1  , f, w, o, i);
+                                }
+                            }
+                          else
+                            {
+                              remove_degree7_leftdelta(v,  5  , f, w, o, i);
+                            }
+                        }
+                    }
+                  else
+                    {
+                      if (! incircle(3, 4, 5, 0, f, w, o, i))
+                        {
+                          if (incircle(4, 0, 1, 3, f, w, o, i))
+                            {
+                              if (incircle(4, 2, 3, 1, f, w, o, i))
+                                {
+                                  remove_degree7_rightfan(v,  4  , f, w, o, i);
+                                }
+                              else
+                                {
+                                  remove_degree7_zigzag(v,  4  , f, w, o, i);
+                                }
+                            }
+                          else
+                            {
+                              remove_degree7_rightfan(v,  0  , f, w, o, i);
+                            }
+                        }
+                      else
+                        {
+                          remove_degree7_rightdelta(v,  3  , f, w, o, i);
+                        }
+                    }
+                }
+              else
+                {
+                  remove_degree7_star(v,  3  , f, w, o, i);
+                }
+            }
+          else
+            {
+              if (incircle(4, 6, 0, 3, f, w, o, i))
+                {
+                  if (incircle(4, 0, 1, 3, f, w, o, i))
+                    {
+                      if (incircle(4, 2, 3, 1, f, w, o, i))
+                        {
+                          remove_degree7_star(v,  4  , f, w, o, i);
+                        }
+                      else
+                        {
+                          remove_degree7_leftfan(v,  4  , f, w, o, i);
+                        }
+                    }
+                  else
+                    {
+                      remove_degree7_zigzag(v,  0  , f, w, o, i);
+                    }
+                }
+              else
+                {
+                  if (incircle(4, 5, 6, 3, f, w, o, i))
+                    {
+                      remove_degree7_rightfan(v,  3  , f, w, o, i);
+                    }
+                  else
+                    {
+                      remove_degree7_star(v,  3  , f, w, o, i);
+                    }
+                }
+            }
+        }
+    }
+}
+
+
+
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+rotate7(int j,  std::vector<Vertex_handle> &w,
+        std::vector<Face_handle> &f, std::vector<int> &i)
+{
+  if (j == 0) return;
+  Face_handle ff = f[0];
+  int ii = i[0], k = 0, kk = (6 * j) % 7;
+  Vertex_handle ww = w[0];
+  for (int jj = 0; k != kk; jj = k) // 7 is prime
+    {
+      k = (jj + j) % 7;
+      w[jj] = w[k];
+      f[jj] = f[k];
+      i[jj] = i[k];
+    }
+  w[kk] = ww;
+  f[kk] = ff;
+  i[kk] = ii;
+}
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+rotate7(int j,  std::vector<Vertex_handle> &w,
+        std::vector<Face_handle> &f, std::vector<Offset> &o, std::vector<int> &i)
+{
+  if (j == 0) return;
+  Face_handle ff = f[0];
+  int ii = i[0], k = 0, kk = (6 * j) % 7;
+  Vertex_handle ww = w[0];
+  Offset oo = o[0];
+  for (int jj = 0; k != kk; jj = k) // 7 is prime
+    {
+      k = (jj + j) % 7;
+      w[jj] = w[k];
+      f[jj] = f[k];
+      o[jj] = o[k];
+      i[jj] = i[k];
+    }
+  w[kk] = ww;
+  f[kk] = ff;
+  o[kk] = oo;
+  i[kk] = ii;
+}
+
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+get_offset_degree7(std::vector<Offset> &in_o, int out_o[])
+{
+  bool add[2];
+
+  add[0] = add[1] = false;
+
+  for (int cnt = 0; cnt < 7; ++cnt)
+    {
+      add[0] |= in_o[cnt].x() < 0;
+      add[1] |= in_o[cnt].y() < 0;
+    }
+
+  Covering_sheets c = number_of_sheets();
+  if (add[0] || add[1])
+    {
+      const Offset oo = Offset(add[0] ? c[0] : 0, add[1] ? c[1] : 0);
+      for (int i = 0; i < 7; ++i) in_o[i] += oo;
+    }
+
+  for (int cnt = 0; cnt < 7; ++cnt)
+    out_o[cnt] = (in_o[cnt].x() >= c[0] ? 2 : 0) + (in_o[cnt].y() >= c[1] ? 1 : 0);
+}
+
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+remove_degree7_star   (Vertex_handle &, int j,
+                       std::vector<Face_handle> &f, std::vector<Vertex_handle> &w, std::vector<int> &i)
+{
+  // removing a degree 7 vertex, staring from w[j]
+  rotate7(j, w, f, i);
+
+  Face_handle nn;
+  f[1]->set_vertex( i[1], w[0]) ;  // f1 = w1w2w0
+  f[2]->set_vertex( i[2], w[0]) ;  // f2 = w2w3w0
+  f[3]->set_vertex( i[3], w[0]) ;  // f3 = w3w4w0
+  f[4]->set_vertex( i[4], w[0]) ;  // f4 = w4w5w0
+  f[5]->set_vertex( i[5], w[0]) ;  // f5 = w5w6w0
+
+  nn = f[0]->neighbor( i[0] );
+  tds().set_adjacency(f[1], cw(i[1]) , nn , nn->index(f[0])  );
+  nn = f[6]->neighbor( i[6] );
+  tds().set_adjacency(f[5], ccw(i[5]) , nn , nn->index(f[6]) );
+  tds().delete_face(f[0]);
+  tds().delete_face(f[6]);
+
+
+  f[1]->set_offsets(0, 0, 0);
+  f[2]->set_offsets(0, 0, 0);
+  f[3]->set_offsets(0, 0, 0);
+  f[4]->set_offsets(0, 0, 0);
+  f[5]->set_offsets(0, 0, 0);
+}
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+remove_degree7_star   (Vertex_handle &v, int j,
+                       std::vector<Face_handle> &f, std::vector<Vertex_handle> &w, std::vector<Offset> &o, std::vector<int> &i)
+{
+  // removing a degree 7 vertex, staring from w[j]
+
+  // Rotate the offset as well
+  rotate7(j, w, f, o, i);
+  remove_degree7_star(v, /* !! */ 0, f, w, i);
+
+  int oo[7];
+  get_offset_degree7(o, oo);
+  int o_face[3];
+  int ii;
+  ii = i[1];
+  o_face[ii] = oo[0];
+  o_face[ccw(ii)] = oo[1];
+  o_face[ cw(ii)] = oo[2];
+  this->set_offsets(f[1], o_face[0], o_face[1], o_face[2]);
+  ii = i[2];
+  o_face[ii] = oo[0];
+  o_face[ccw(ii)] = oo[2];
+  o_face[ cw(ii)] = oo[3];
+  this->set_offsets(f[2], o_face[0], o_face[1], o_face[2]);
+  ii = i[3];
+  o_face[ii] = oo[0];
+  o_face[ccw(ii)] = oo[3];
+  o_face[ cw(ii)] = oo[4];
+  this->set_offsets(f[3], o_face[0], o_face[1], o_face[2]);
+  ii = i[4];
+  o_face[ii] = oo[0];
+  o_face[ccw(ii)] = oo[4];
+  o_face[ cw(ii)] = oo[5];
+  this->set_offsets(f[4], o_face[0], o_face[1], o_face[2]);
+  ii = i[5];
+  o_face[ii] = oo[0];
+  o_face[ccw(ii)] = oo[5];
+  o_face[ cw(ii)] = oo[6];
+  this->set_offsets(f[5], o_face[0], o_face[1], o_face[2]);
+
+  insert_too_long_edge(f[1], ccw(i[1]));
+  insert_too_long_edge(f[2], ccw(i[2]));
+  insert_too_long_edge(f[3], ccw(i[3]));
+  insert_too_long_edge(f[4], ccw(i[4]));
+}
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+remove_degree7_zigzag (Vertex_handle &, int j,
+                       std::vector<Face_handle> &f, std::vector<Vertex_handle> &w, std::vector<int> &i)
+{
+  // removing a degree 7 vertex, zigzag, w[j] = middle point
+  rotate7(j, w, f, i);
+
+  Face_handle nn;
+  f[1]->set_vertex(    i[1] , w[3]) ;  // f1 = w1w2w3
+  f[2]->set_vertex(ccw(i[2]), w[1]) ;
+  f[2]->set_vertex(    i[2] , w[0]) ;  // f2 = w1w3w0
+  f[3]->set_vertex(    i[3] , w[0]) ;  // f3 = w3w4w0
+  f[4]->set_vertex( cw(i[4]), w[6]) ;
+  f[4]->set_vertex(    i[4] , w[0]) ;  // f4 = w4w6w0
+  f[5]->set_vertex(    i[5] , w[4]) ;  // f5 = w5w6w4
+
+  nn = f[2]->neighbor( i[2] );
+  tds().set_adjacency(f[1], ccw(i[1]) , nn, nn->index(f[2]) );
+  nn = f[0]->neighbor( i[0] );
+  tds().set_adjacency(f[2], cw(i[2]) , nn , nn->index(f[0]) );
+  nn = f[6]->neighbor( i[6] );
+  tds().set_adjacency(f[4], ccw(i[4]) , nn , nn->index(f[6])  );
+  nn = f[4]->neighbor( i[4] );
+  tds().set_adjacency(f[5], cw(i[5]) , nn , nn->index(f[4])  );
+  tds().set_adjacency(f[1], cw(i[1]) , f[2] , i[2]   );
+  tds().set_adjacency(f[4], i[4]  , f[5] , ccw(i[5])  );
+
+  tds().delete_face(f[0]);
+  tds().delete_face(f[6]);
+
+
+  f[1]->set_offsets(0, 0, 0);
+  f[2]->set_offsets(0, 0, 0);
+  f[3]->set_offsets(0, 0, 0);
+  f[4]->set_offsets(0, 0, 0);
+  f[5]->set_offsets(0, 0, 0);
+}
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+remove_degree7_zigzag (Vertex_handle &v, int j,
+                       std::vector<Face_handle> &f, std::vector<Vertex_handle> &w, std::vector<Offset> &o, std::vector<int> &i)
+{
+  // removing a degree 7 vertex, zigzag, w[j] = middle point
+
+  // Rotate the offset as well
+  rotate7(j, w, f, o, i);
+  remove_degree7_zigzag(v, /* !! */ 0, f, w, i);
+
+  int oo[7];
+  get_offset_degree7(o, oo);
+  int o_face[3];
+  int ii;
+  ii = i[1];
+  o_face[ii] = oo[3];
+  o_face[ccw(ii)] = oo[1];
+  o_face[ cw(ii)] = oo[2];
+  this->set_offsets(f[1], o_face[0], o_face[1], o_face[2]);
+  ii = i[2];
+  o_face[ii] = oo[0];
+  o_face[ccw(ii)] = oo[1];
+  o_face[ cw(ii)] = oo[3];
+  this->set_offsets(f[2], o_face[0], o_face[1], o_face[2]);
+  ii = i[3];
+  o_face[ii] = oo[0];
+  o_face[ccw(ii)] = oo[3];
+  o_face[ cw(ii)] = oo[4];
+  this->set_offsets(f[3], o_face[0], o_face[1], o_face[2]);
+  ii = i[4];
+  o_face[ii] = oo[0];
+  o_face[ccw(ii)] = oo[4];
+  o_face[ cw(ii)] = oo[6];
+  this->set_offsets(f[4], o_face[0], o_face[1], o_face[2]);
+  ii = i[5];
+  o_face[ii] = oo[4];
+  o_face[ccw(ii)] = oo[5];
+  o_face[ cw(ii)] = oo[6];
+  this->set_offsets(f[5], o_face[0], o_face[1], o_face[2]);
+
+  insert_too_long_edge(f[1],  cw(i[1]));
+  insert_too_long_edge(f[2], ccw(i[2]));
+  insert_too_long_edge(f[3], ccw(i[3]));
+  insert_too_long_edge(f[4],     i[4]);
+}
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+remove_degree7_leftdelta(Vertex_handle &, int j,
+                         std::vector<Face_handle> &f, std::vector<Vertex_handle> &w, std::vector<int> &i)
+{
+  // removing a degree 7 vertex, left delta from w[j]
+  rotate7(j, w, f, i);
+
+  Face_handle nn;
+  f[1]->set_vertex(    i[1] , w[0]) ;  // f1 = w1w2w0
+  f[2]->set_vertex(    i[2] , w[0]) ;  // f2 = w2w3w0
+  f[3]->set_vertex( cw(i[3]), w[5]) ;
+  f[3]->set_vertex(    i[3] , w[0]) ;  // f3 = w3w5w0
+  f[4]->set_vertex(    i[4] , w[3]) ;  // f4 = w4w5w3
+  f[5]->set_vertex(    i[5] , w[0]) ;  // f5 = w5w6w0
+
+  nn = f[0]->neighbor( i[0] );
+  tds().set_adjacency(f[1], cw(i[1]) , nn , nn->index(f[0])  );
+  nn = f[3]->neighbor( i[3] );
+  tds().set_adjacency(f[4], cw(i[4]) , nn , nn->index(f[3]) );
+  nn = f[6]->neighbor( i[6] );
+  tds().set_adjacency(f[5], ccw(i[5]) , nn , nn->index(f[6])  );
+  tds().set_adjacency(f[3], i[3]  , f[4] , ccw(i[4])  );
+  tds().set_adjacency(f[3], ccw(i[3]) , f[5] ,  cw(i[5]) );
+
+  tds().delete_face(f[0]);
+  tds().delete_face(f[6]);
+
+  f[1]->set_offsets(0, 0, 0);
+  f[2]->set_offsets(0, 0, 0);
+  f[3]->set_offsets(0, 0, 0);
+  f[4]->set_offsets(0, 0, 0);
+  f[5]->set_offsets(0, 0, 0);
+}
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+remove_degree7_leftdelta(Vertex_handle &v, int j,
+                         std::vector<Face_handle> &f, std::vector<Vertex_handle> &w, std::vector<Offset> &o, std::vector<int> &i)
+{
+  // removing a degree 7 vertex, left delta from w[j]
+
+  // Rotate the offset as well
+  rotate7(j, w, f, o, i);
+  remove_degree7_leftdelta(v, /* !! */ 0, f, w, i);
+
+  int oo[7];
+  get_offset_degree7(o, oo);
+
+  int o_face[3];
+  int ii;
+  ii = i[1];
+  o_face[ii] = oo[0];
+  o_face[ccw(ii)] = oo[1];
+  o_face[ cw(ii)] = oo[2];
+  this->set_offsets(f[1], o_face[0], o_face[1], o_face[2]);
+  ii = i[2];
+  o_face[ii] = oo[0];
+  o_face[ccw(ii)] = oo[2];
+  o_face[ cw(ii)] = oo[3];
+  this->set_offsets(f[2], o_face[0], o_face[1], o_face[2]);
+  ii = i[3];
+  o_face[ii] = oo[0];
+  o_face[ccw(ii)] = oo[3];
+  o_face[ cw(ii)] = oo[5];
+  this->set_offsets(f[3], o_face[0], o_face[1], o_face[2]);
+  ii = i[4];
+  o_face[ii] = oo[3];
+  o_face[ccw(ii)] = oo[4];
+  o_face[ cw(ii)] = oo[5];
+  this->set_offsets(f[4], o_face[0], o_face[1], o_face[2]);
+  ii = i[5];
+  o_face[ii] = oo[0];
+  o_face[ccw(ii)] = oo[5];
+  o_face[ cw(ii)] = oo[6];
+  this->set_offsets(f[5], o_face[0], o_face[1], o_face[2]);
+
+  insert_too_long_edge(f[1], ccw(i[1]));
+  insert_too_long_edge(f[2], ccw(i[2]));
+  insert_too_long_edge(f[3],     i[3]);
+  insert_too_long_edge(f[3], ccw(i[3]));
+}
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+remove_degree7_rightdelta(Vertex_handle &, int j,
+                          std::vector<Face_handle> &f, std::vector<Vertex_handle> &w, std::vector<int> &i)
+{
+  // removing a degree 7 vertex, right delta from w[j]
+  rotate7(j, w, f, i);
+
+  Face_handle nn;
+  f[1]->set_vertex(    i[1] , w[0]) ;  // f1 = w1w2w0
+  f[2]->set_vertex(    i[2] , w[4]) ;  // f2 = w2w3w4
+  f[3]->set_vertex(ccw(i[3]), w[2]) ;
+  f[3]->set_vertex(    i[3] , w[0]) ;  // f3 = w2w4w0
+  f[4]->set_vertex(    i[4] , w[0]) ;  // f4 = w4w5w0
+  f[5]->set_vertex(    i[5] , w[0]) ;  // f5 = w5w6w0
+
+  nn = f[0]->neighbor( i[0] );
+  tds().set_adjacency(f[1], cw(i[1]) , nn , nn->index(f[0]) );
+  nn = f[3]->neighbor( i[3] );
+  tds().set_adjacency(f[2], ccw(i[2]) , nn, nn->index(f[3]) );
+  nn = f[6]->neighbor( i[6] );
+  tds().set_adjacency(f[5], ccw(i[5]) , nn , nn->index(f[6]) );
+  tds().set_adjacency(f[1], ccw(i[1]) , f[3], cw(i[3])  );
+  tds().set_adjacency(f[3], i[3]  , f[2], cw(i[2]) );
+
+  tds().delete_face(f[0]);
+  tds().delete_face(f[6]);
+
+  f[1]->set_offsets(0, 0, 0);
+  f[2]->set_offsets(0, 0, 0);
+  f[3]->set_offsets(0, 0, 0);
+  f[4]->set_offsets(0, 0, 0);
+  f[5]->set_offsets(0, 0, 0);
+}
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+remove_degree7_rightdelta(Vertex_handle &v, int j,
+                          std::vector<Face_handle> &f, std::vector<Vertex_handle> &w, std::vector<Offset> &o, std::vector<int> &i)
+{
+  // removing a degree 7 vertex, right delta from w[j]
+
+  // Rotate the offset as well
+  rotate7(j, w, f, o, i);
+  remove_degree7_rightdelta(v, /* !! */ 0, f, w, i);
+
+  int oo[7];
+  get_offset_degree7(o, oo);
+  int o_face[3];
+  int ii;
+  ii = i[1];
+  o_face[ii] = oo[0];
+  o_face[ccw(ii)] = oo[1];
+  o_face[ cw(ii)] = oo[2];
+  this->set_offsets(f[1], o_face[0], o_face[1], o_face[2]);
+  ii = i[2];
+  o_face[ii] = oo[4];
+  o_face[ccw(ii)] = oo[2];
+  o_face[ cw(ii)] = oo[3];
+  this->set_offsets(f[2], o_face[0], o_face[1], o_face[2]);
+  ii = i[3];
+  o_face[ii] = oo[0];
+  o_face[ccw(ii)] = oo[2];
+  o_face[ cw(ii)] = oo[4];
+  this->set_offsets(f[3], o_face[0], o_face[1], o_face[2]);
+  ii = i[4];
+  o_face[ii] = oo[0];
+  o_face[ccw(ii)] = oo[4];
+  o_face[ cw(ii)] = oo[5];
+  this->set_offsets(f[4], o_face[0], o_face[1], o_face[2]);
+  ii = i[5];
+  o_face[ii] = oo[0];
+  o_face[ccw(ii)] = oo[5];
+  o_face[ cw(ii)] = oo[6];
+  this->set_offsets(f[5], o_face[0], o_face[1], o_face[2]);
+
+  insert_too_long_edge(f[1], ccw(i[1]));
+  insert_too_long_edge(f[2],  cw(i[2]));
+  insert_too_long_edge(f[3], ccw(i[3]));
+  insert_too_long_edge(f[4], ccw(i[4]));
+}
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+remove_degree7_leftfan(Vertex_handle &, int j,
+                       std::vector<Face_handle> &f, std::vector<Vertex_handle> &w, std::vector<int> &i)
+{
+  // removing a degree 7 vertex, left fan from w[j]
+  rotate7(j, w, f, i);
+
+  Face_handle nn;
+  f[1]->set_vertex(    i[1] , w[0]) ;  // f1 = w1w2w0
+  f[2]->set_vertex(    i[2] , w[0]) ;  // f2 = w2w3w0
+  f[3]->set_vertex(    i[3] , w[0]) ;  // f3 = w3w4w0
+  f[4]->set_vertex(    i[4] , w[6]) ;  // f4 = w4w5w6
+  f[6]->set_vertex(    i[6] , w[4]) ;  // f6 = w6w0w4
+
+  nn = f[0]->neighbor( i[0] );
+  tds().set_adjacency(f[1], cw(i[1]) , nn, nn->index(f[0]) );
+  nn = f[5]->neighbor( i[5] );
+  tds().set_adjacency(f[4], ccw(i[4]) , nn, nn->index(f[5]) );
+  tds().set_adjacency(f[3], ccw(i[3]) , f[6], ccw(i[6]) );
+  tds().set_adjacency(f[6], cw(i[6]) , f[4], cw(i[4]) );
+
+  tds().delete_face(f[0]);
+  tds().delete_face(f[5]);
+
+  f[1]->set_offsets(0, 0, 0);
+  f[2]->set_offsets(0, 0, 0);
+  f[3]->set_offsets(0, 0, 0);
+  f[4]->set_offsets(0, 0, 0);
+  f[6]->set_offsets(0, 0, 0);
+}
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+remove_degree7_leftfan(Vertex_handle &v, int j,
+                       std::vector<Face_handle> &f, std::vector<Vertex_handle> &w, std::vector<Offset> &o, std::vector<int> &i)
+{
+  // removing a degree 7 vertex, left fan from w[j]
+
+  // Rotate the offset as well
+  rotate7(j, w, f, o, i);
+  remove_degree7_leftfan(v, /* !! */ 0, f, w, i);
+
+  int oo[7];
+  get_offset_degree7(o, oo);
+
+  int o_face[3];
+  int ii;
+  ii = i[1];
+  o_face[ii] = oo[0];
+  o_face[ccw(ii)] = oo[1];
+  o_face[ cw(ii)] = oo[2];
+  this->set_offsets(f[1], o_face[0], o_face[1], o_face[2]);
+  ii = i[2];
+  o_face[ii] = oo[0];
+  o_face[ccw(ii)] = oo[2];
+  o_face[ cw(ii)] = oo[3];
+  this->set_offsets(f[2], o_face[0], o_face[1], o_face[2]);
+  ii = i[3];
+  o_face[ii] = oo[0];
+  o_face[ccw(ii)] = oo[3];
+  o_face[ cw(ii)] = oo[4];
+  this->set_offsets(f[3], o_face[0], o_face[1], o_face[2]);
+  ii = i[4];
+  o_face[ii] = oo[6];
+  o_face[ccw(ii)] = oo[4];
+  o_face[ cw(ii)] = oo[5];
+  this->set_offsets(f[4], o_face[0], o_face[1], o_face[2]);
+  ii = i[6];
+  o_face[ii] = oo[4];
+  o_face[ccw(ii)] = oo[6];
+  o_face[ cw(ii)] = oo[0];
+  this->set_offsets(f[6], o_face[0], o_face[1], o_face[2]);
+
+  insert_too_long_edge(f[1], ccw(i[1]));
+  insert_too_long_edge(f[2], ccw(i[2]));
+  insert_too_long_edge(f[3], ccw(i[3]));
+  insert_too_long_edge(f[4],  cw(i[4]));
+}
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+remove_degree7_rightfan(Vertex_handle &, int j,
+                        std::vector<Face_handle> &f, std::vector<Vertex_handle> &w, std::vector<int> &i)
+{
+  // removing a degree 7 vertex, right fan from w[j]
+  rotate7(j, w, f, i);
+
+  Face_handle nn;
+  f[0]->set_vertex(    i[0] , w[3]) ;  // f0 = w0w1w3
+  f[2]->set_vertex(    i[2] , w[1]) ;  // f2 = w2w3w1
+  f[3]->set_vertex(    i[3] , w[0]) ;  // f3 = w3w4w0
+  f[4]->set_vertex(    i[4] , w[0]) ;  // f4 = w4w5w0
+  f[5]->set_vertex(    i[5] , w[0]) ;  // f5 = w5w6w0
+
+  nn = f[1]->neighbor( i[1] );
+  tds().set_adjacency(f[2], cw(i[2]) , nn, nn->index(f[1]) );
+  nn = f[6]->neighbor( i[6] );
+  tds().set_adjacency(f[5], ccw(i[5]) , nn, nn->index(f[6]) );
+  tds().set_adjacency(f[2], ccw(i[2]) , f[0], ccw(i[0])  );
+  tds().set_adjacency(f[0], cw(i[0]) , f[3] , cw(i[3]) );
+
+  tds().delete_face(f[1]);
+  tds().delete_face(f[6]);
+
+  f[0]->set_offsets(0, 0, 0);
+  f[2]->set_offsets(0, 0, 0);
+  f[3]->set_offsets(0, 0, 0);
+  f[4]->set_offsets(0, 0, 0);
+  f[5]->set_offsets(0, 0, 0);
+}
+template < class Gt, class Tds >
+void
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+remove_degree7_rightfan(Vertex_handle &v, int j,
+                        std::vector<Face_handle> &f, std::vector<Vertex_handle> &w, std::vector<Offset> &o, std::vector<int> &i)
+{
+  // removing a degree 7 vertex, right fan from w[j]
+
+  // Rotate the offset as well
+  rotate7(j, w, f, o, i);
+  remove_degree7_rightfan(v, /* !! */ 0, f, w, i);
+
+  int oo[7];
+  get_offset_degree7(o, oo);
+  int o_face[3];
+  int ii;
+  ii = i[0];
+  o_face[ii] = oo[3];
+  o_face[ccw(ii)] = oo[0];
+  o_face[ cw(ii)] = oo[1];
+  this->set_offsets(f[0], o_face[0], o_face[1], o_face[2]);
+  ii = i[2];
+  o_face[ii] = oo[1];
+  o_face[ccw(ii)] = oo[2];
+  o_face[ cw(ii)] = oo[3];
+  this->set_offsets(f[2], o_face[0], o_face[1], o_face[2]);
+  ii = i[3];
+  o_face[ii] = oo[0];
+  o_face[ccw(ii)] = oo[3];
+  o_face[ cw(ii)] = oo[4];
+  this->set_offsets(f[3], o_face[0], o_face[1], o_face[2]);
+  ii = i[4];
+  o_face[ii] = oo[0];
+  o_face[ccw(ii)] = oo[4];
+  o_face[ cw(ii)] = oo[5];
+  this->set_offsets(f[4], o_face[0], o_face[1], o_face[2]);
+  ii = i[5];
+  o_face[ii] = oo[0];
+  o_face[ccw(ii)] = oo[5];
+  o_face[ cw(ii)] = oo[6];
+  this->set_offsets(f[5], o_face[0], o_face[1], o_face[2]);
+
+  insert_too_long_edge(f[0], ccw(i[0]));
+  insert_too_long_edge(f[0],  cw(i[0]));
+  insert_too_long_edge(f[3], ccw(i[3]));
+  insert_too_long_edge(f[4], ccw(i[4]));
+}
+
+
+
+
+///////////////////////////////////////////////////////////////
+//  DISPLACEMENT
+
+template <class Gt, class Tds >
+typename Periodic_2_Delaunay_triangulation_2<Gt, Tds>::Vertex_handle
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+move_if_no_collision(Vertex_handle v, const Point &p)
+{
+  Locate_type lt;
+  int li;
+  Vertex_handle inserted;
+  Face_handle loc = locate(p, lt, li, v->face());
+
+  if (lt == Triangulation::VERTEX)
+    return v;
+  else
+    /// This can be optimized by checking whether we can move v->point() to p
+    return insert(p, lt, loc, li);
+}
+
+template <class Gt, class Tds >
+typename Periodic_2_Delaunay_triangulation_2<Gt, Tds>::Vertex_handle
+Periodic_2_Delaunay_triangulation_2<Gt, Tds>::
+move_point(Vertex_handle v, const Point &p)
+{
+  if(v->point() == p) return v;
+  Vertex_handle w = move_if_no_collision(v, p);
+  if(w != v)
+    {
+      remove(v);
+      return w;
+    }
+  return v;
+}
+
+template<class Gt, class Tds>
+void Periodic_2_Delaunay_triangulation_2<Gt, Tds>::fill_hole_delaunay(std::list<Edge> & first_hole)
+{
+  typedef std::list<Edge> Hole;
+  typedef std::list<Hole> Hole_list;
+
+  Face_handle  f, ff, fn;
+  int i, ii, in;
+  Hole_list hole_list;
+  Hole hole;
+
+  hole_list.push_front(first_hole);
+
+  while( ! hole_list.empty())
+    {
+      hole = hole_list.front();
+      hole_list.pop_front();
+      typename Hole::iterator hit = hole.begin();
+
+      // if the hole has only three edges, create the triangle
+      if (hole.size() == 3)
+        {
+          hit = hole.begin();
+          f = (*hit).first;
+          i = (*hit).second;
+          ff = (* ++hit).first;
+          ii = (*hit).second;
+          fn = (* ++hit).first;
+          in = (*hit).second;
+          Face_handle newf = create_face(f, i, ff, ii, fn, in);
+          newf->set_offsets(0, 0, 0);
+
+          continue;
+        }
+
+      // else find an edge with two finite vertices
+      // on the hole boundary
+      // and the new triangle adjacent to that edge
+      //  cut the hole and push it back
+
+      // take the first neighboring face and pop it;
+      ff = (hole.front()).first;
+      ii = (hole.front()).second;
+      hole.pop_front();
+
+      Vertex_handle v0 = ff->vertex(cw(ii));
+      Vertex_handle v1 = ff->vertex(ccw(ii));
+      Vertex_handle v2 = Vertex_handle();
+      Vertex_handle v3 = Vertex_handle();
+      const Point& p0 = v0->point();
+      const Point& p1 = v1->point();
+
+      typename Hole::iterator hdone = hole.end();
+      hit =  hole.begin();
+      typename Hole::iterator cut_after(hit);
+
+      // if tested vertex is c with respect to the vertex opposite
+      // to NULL neighbor,
+      // stop at the before last face;
+      hdone--;
+      while( hit != hdone)
+        {
+          fn = (*hit).first;
+          in = (*hit).second;
+          Vertex_handle vv = fn->vertex(ccw(in));
+
+          const Point &p = vv->point();
+          Orientation orient = orientation(p0, p1, p);
+
+          if (orient == COUNTERCLOCKWISE)
+            {
+              if (v2 == Vertex_handle())
+                {
+                  v2 = vv;
+                  v3 = vv;
+                  cut_after = hit;
+                }
+              else
+                {
+                  Oriented_side side = side_of_oriented_circle(p0, p1, v3->point(), p, true);
+                  if (side == ON_POSITIVE_SIDE)
+                    {
+                      v2 = vv;
+                      v3 = vv;
+                      cut_after = hit;
+                    }
+                }
+            }
+
+          ++hit;
+        }
+
+      // create new triangle and update adjacency relations
+      Face_handle newf;
+
+      //update the hole and push back in the Hole_List stack
+      // if v2 belongs to the neighbor following or preceding *f
+      // the hole remain a single hole
+      // otherwise it is split in two holes
+
+      fn = (hole.front()).first;
+      in = (hole.front()).second;
+      if (fn->has_vertex(v2, i) && i == fn->ccw(in))
+        {
+          newf = create_face(ff, ii, fn, in);
+
+          newf->set_offsets(0, 0, 0);
+
+          hole.pop_front();
+          hole.push_front(Edge(newf, 1));
+          hole_list.push_front(hole);
+        }
+      else
+        {
+          fn = (hole.back()).first;
+          in = (hole.back()).second;
+          if (fn->has_vertex(v2, i) && i == fn->cw(in))
+            {
+              newf = create_face(fn, in, ff, ii);
+              newf->set_offsets(0, 0, 0);
+
+              hole.pop_back();
+              hole.push_back(Edge(newf, 1));
+              hole_list.push_front(hole);
+            }
+          else
+            {
+              // split the hole in two holes
+              CGAL_assertion(v2 != Vertex_handle());
+              newf = create_face(ff, ii, v2);
+              newf->set_offsets(0, 0, 0);
+
+              Hole new_hole;
+              ++cut_after;
+              while( hole.begin() != cut_after )
+                {
+                  new_hole.push_back(hole.front());
+                  hole.pop_front();
+                }
+
+              hole.push_front(Edge( newf, 1));
+              new_hole.push_front(Edge( newf, 0));
+              hole_list.push_front(hole);
+              hole_list.push_front(new_hole);
+            }
+        }
+    }
+}
+
+template<class Gt, class Tds>
+void Periodic_2_Delaunay_triangulation_2<Gt, Tds>::fill_hole_delaunay(
+  std::list<Edge> & first_hole,
+  std::map<Vertex_handle, Offset> &vertex_offsets)
+{
+  typedef std::list<Edge> Hole;
+  typedef std::list<Hole> Hole_list;
+
+  Face_handle  f, ff, fn;
+  int i, ii, in;
+  Hole_list hole_list;
+  Hole hole;
+
+  hole_list.push_front(first_hole);
+
+  while( ! hole_list.empty())
+    {
+      hole = hole_list.front();
+      hole_list.pop_front();
+      typename Hole::iterator hit = hole.begin();
+
+      // if the hole has only three edges, create the triangle
+      if (hole.size() == 3)
+        {
+          hit = hole.begin();
+          f = (*hit).first;
+          i = (*hit).second;
+          ff = (* ++hit).first;
+          ii = (*hit).second;
+          fn = (* ++hit).first;
+          in = (*hit).second;
+          Face_handle newf = create_face(f, i, ff, ii, fn, in);
+          Offset oo0(vertex_offsets[newf->vertex(0)]);
+          Offset oo1(vertex_offsets[newf->vertex(1)]);
+          Offset oo2(vertex_offsets[newf->vertex(2)]);
+          if (oo0.x() < 0 || oo1.x() < 0 || oo2.x() < 0)
+            {
+              oo0 += Offset(number_of_sheets()[0], 0);
+              oo1 += Offset(number_of_sheets()[0], 0);
+              oo2 += Offset(number_of_sheets()[0], 0);
+            }
+          if (oo0.y() < 0 || oo1.y() < 0 || oo2.y() < 0)
+            {
+              oo0 += Offset(0, number_of_sheets()[1]);
+              oo1 += Offset(0, number_of_sheets()[1]);
+              oo2 += Offset(0, number_of_sheets()[1]);
+            }
+          set_offsets(newf,
+                      (oo0.x() >= number_of_sheets()[0] ? 2 : 0) + (oo0.y() >= number_of_sheets()[1] ? 1 : 0),
+                      (oo1.x() >= number_of_sheets()[0] ? 2 : 0) + (oo1.y() >= number_of_sheets()[1] ? 1 : 0),
+                      (oo2.x() >= number_of_sheets()[0] ? 2 : 0) + (oo2.y() >= number_of_sheets()[1] ? 1 : 0));
+
+          insert_too_long_edge(newf, 0);
+          insert_too_long_edge(newf, 1);
+          insert_too_long_edge(newf, 2);
+
+          continue;
+        }
+
+      // else find an edge with two finite vertices
+      // on the hole boundary
+      // and the new triangle adjacent to that edge
+      //  cut the hole and push it back
+
+      // take the first neighboring face and pop it;
+      ff = (hole.front()).first;
+      ii = (hole.front()).second;
+      hole.pop_front();
+
+      Vertex_handle v0 = ff->vertex(cw(ii));
+      Vertex_handle v1 = ff->vertex(ccw(ii));
+      Vertex_handle v2 = Vertex_handle();
+      Vertex_handle v3 = Vertex_handle();
+      const Point& p0 = v0->point();
+      const Point& p1 = v1->point();
+      const Offset o0 = vertex_offsets[v0];
+      const Offset o1 = vertex_offsets[v1];
+      bool simplicity_criterion = (o0 == o1);
+
+      typename Hole::iterator hdone = hole.end();
+      hit =  hole.begin();
+      typename Hole::iterator cut_after(hit);
+
+      // if tested vertex is c with respect to the vertex opposite
+      // to NULL neighbor,
+      // stop at the before last face;
+      hdone--;
+      while( hit != hdone)
+        {
+          fn = (*hit).first;
+          in = (*hit).second;
+          Vertex_handle vv = fn->vertex(ccw(in));
+
+          const Point &p = vv->point();
+          CGAL_assertion(vertex_offsets.find(vv) != vertex_offsets.end());
+          const Offset o = vertex_offsets[vv];
+          Orientation orient;
+          simplicity_criterion &= (o == o0);
+          if (simplicity_criterion)
+            orient = orientation(p0, p1, p);
+          else
+            orient = orientation(p0, p1, p, o0, o1, o);
+
+          if (orient == COUNTERCLOCKWISE)
+            {
+              if (v2 == Vertex_handle())
+                {
+                  v2 = vv;
+                  v3 = vv;
+                  cut_after = hit;
+                }
+              else
+                {
+                  Offset o3 = vertex_offsets[v3];
+                  Oriented_side side;
+                  if (simplicity_criterion && (o3 == o0))
+                    side = side_of_oriented_circle(p0, p1, v3->point(), p,
+                                                   true);
+                  else
+                    side = side_of_oriented_circle(p0, p1, v3->point(), p,
+                                                   o0, o1, o3, o,
+                                                   true);
+                  if (side == ON_POSITIVE_SIDE)
+                    {
+                      v2 = vv;
+                      v3 = vv;
+                      cut_after = hit;
+                    }
+                }
+            }
+
+          ++hit;
+        }
+
+      // create new triangle and update adjacency relations
+      Face_handle newf;
+
+      //update the hole and push back in the Hole_List stack
+      // if v2 belongs to the neighbor following or preceding *f
+      // the hole remain a single hole
+      // otherwise it is split in two holes
+
+      fn = (hole.front()).first;
+      in = (hole.front()).second;
+      if (fn->has_vertex(v2, i) && i == fn->ccw(in))
+        {
+          newf = create_face(ff, ii, fn, in);
+
+          Offset oo0 = o0;
+          Offset oo1 = o1;
+          Offset oo2 = vertex_offsets[v2];
+          if (oo0.x() < 0 || oo1.x() < 0 || oo2.x() < 0)
+            {
+              oo0 += Offset(number_of_sheets()[0], 0);
+              oo1 += Offset(number_of_sheets()[0], 0);
+              oo2 += Offset(number_of_sheets()[0], 0);
+            }
+          if (oo0.y() < 0 || oo1.y() < 0 || oo2.y() < 0)
+            {
+              oo0 += Offset(0, number_of_sheets()[1]);
+              oo1 += Offset(0, number_of_sheets()[1]);
+              oo2 += Offset(0, number_of_sheets()[1]);
+            }
+          set_offsets(newf,
+                      (oo0.x() >= number_of_sheets()[0] ? 2 : 0) + (oo0.y() >= number_of_sheets()[1] ? 1 : 0),
+                      (oo1.x() >= number_of_sheets()[0] ? 2 : 0) + (oo1.y() >= number_of_sheets()[1] ? 1 : 0),
+                      (oo2.x() >= number_of_sheets()[0] ? 2 : 0) + (oo2.y() >= number_of_sheets()[1] ? 1 : 0));
+          // set_offsets(newf, o0, o1, o2);
+          insert_too_long_edge(newf, 0);
+          insert_too_long_edge(newf, 1);
+
+          hole.pop_front();
+          hole.push_front(Edge(newf, 1));
+          hole_list.push_front(hole);
+        }
+      else
+        {
+          fn = (hole.back()).first;
+          in = (hole.back()).second;
+          if (fn->has_vertex(v2, i) && i == fn->cw(in))
+            {
+              newf = create_face(fn, in, ff, ii);
+              Offset oo0 = o0;
+              Offset oo1 = o1;
+              Offset oo2 = vertex_offsets[v2];
+              if (oo0.x() < 0 || oo1.x() < 0 || oo2.x() < 0)
+                {
+                  oo0 += Offset(number_of_sheets()[0], 0);
+                  oo1 += Offset(number_of_sheets()[0], 0);
+                  oo2 += Offset(number_of_sheets()[0], 0);
+                }
+              if (oo0.y() < 0 || oo1.y() < 0 || oo2.y() < 0)
+                {
+                  oo0 += Offset(0, number_of_sheets()[1]);
+                  oo1 += Offset(0, number_of_sheets()[1]);
+                  oo2 += Offset(0, number_of_sheets()[1]);
+                }
+              set_offsets(newf,
+                          (oo2.x() >= number_of_sheets()[0] ? 2 : 0) + (oo2.y() >= number_of_sheets()[1] ? 1 : 0),
+                          (oo0.x() >= number_of_sheets()[0] ? 2 : 0) + (oo0.y() >= number_of_sheets()[1] ? 1 : 0),
+                          (oo1.x() >= number_of_sheets()[0] ? 2 : 0) + (oo1.y() >= number_of_sheets()[1] ? 1 : 0));
+              insert_too_long_edge(newf, 1);
+              insert_too_long_edge(newf, 2);
+              hole.pop_back();
+              hole.push_back(Edge(newf, 1));
+              hole_list.push_front(hole);
+            }
+          else
+            {
+              // split the hole in two holes
+              CGAL_assertion(v2 != Vertex_handle());
+              newf = create_face(ff, ii, v2);
+              Offset oo0 = o0;
+              Offset oo1 = o1;
+              Offset oo2 = vertex_offsets[v2];
+              if (oo0.x() < 0 || oo1.x() < 0 || oo2.x() < 0)
+                {
+                  oo0 += Offset(number_of_sheets()[0], 0);
+                  oo1 += Offset(number_of_sheets()[0], 0);
+                  oo2 += Offset(number_of_sheets()[0], 0);
+                }
+              if (oo0.y() < 0 || oo1.y() < 0 || oo2.y() < 0)
+                {
+                  oo0 += Offset(0, number_of_sheets()[1]);
+                  oo1 += Offset(0, number_of_sheets()[1]);
+                  oo2 += Offset(0, number_of_sheets()[1]);
+                }
+              set_offsets(newf,
+                          (oo0.x() >= number_of_sheets()[0] ? 2 : 0) + (oo0.y() >= number_of_sheets()[1] ? 1 : 0),
+                          (oo1.x() >= number_of_sheets()[0] ? 2 : 0) + (oo1.y() >= number_of_sheets()[1] ? 1 : 0),
+                          (oo2.x() >= number_of_sheets()[0] ? 2 : 0) + (oo2.y() >= number_of_sheets()[1] ? 1 : 0));
+
+
+              // set_offsets(newf, o0, o1, o2);
+              insert_too_long_edge(newf, 0);
+              insert_too_long_edge(newf, 1);
+
+              Hole new_hole;
+              ++cut_after;
+              while( hole.begin() != cut_after )
+                {
+                  new_hole.push_back(hole.front());
+                  hole.pop_front();
+                }
+
+              hole.push_front(Edge( newf, 1));
+              new_hole.push_front(Edge( newf, 0));
+              hole_list.push_front(hole);
+              hole_list.push_front(new_hole);
+            }
+        }
+    }
+}
+} //namespace CGAL
+
+#endif // CGAL_PERIODIC_2_DELAUNAY_TRIANGULATION_2_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Periodic_2_Delaunay_triangulation_traits_2.h b/3rdparty/CGAL/include/CGAL/Periodic_2_Delaunay_triangulation_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Periodic_2_Delaunay_triangulation_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Periodic_2_Delaunay_triangulation_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Periodic_2_offset_2.h b/3rdparty/CGAL/include/CGAL/Periodic_2_offset_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Periodic_2_offset_2.h
rename to 3rdparty/CGAL/include/CGAL/Periodic_2_offset_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Periodic_2_triangulation_2.h b/3rdparty/CGAL/include/CGAL/Periodic_2_triangulation_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Periodic_2_triangulation_2.h
rename to 3rdparty/CGAL/include/CGAL/Periodic_2_triangulation_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Periodic_2_triangulation_dummy_12.h b/3rdparty/CGAL/include/CGAL/Periodic_2_triangulation_dummy_12.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Periodic_2_triangulation_dummy_12.h
rename to 3rdparty/CGAL/include/CGAL/Periodic_2_triangulation_dummy_12.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Periodic_2_triangulation_face_base_2.h b/3rdparty/CGAL/include/CGAL/Periodic_2_triangulation_face_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Periodic_2_triangulation_face_base_2.h
rename to 3rdparty/CGAL/include/CGAL/Periodic_2_triangulation_face_base_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Periodic_2_triangulation_filtered_traits_2.h b/3rdparty/CGAL/include/CGAL/Periodic_2_triangulation_filtered_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Periodic_2_triangulation_filtered_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Periodic_2_triangulation_filtered_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Periodic_2_triangulation_hierarchy_2.h b/3rdparty/CGAL/include/CGAL/Periodic_2_triangulation_hierarchy_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Periodic_2_triangulation_hierarchy_2.h
rename to 3rdparty/CGAL/include/CGAL/Periodic_2_triangulation_hierarchy_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Periodic_2_triangulation_hierarchy_vertex_base_2.h b/3rdparty/CGAL/include/CGAL/Periodic_2_triangulation_hierarchy_vertex_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Periodic_2_triangulation_hierarchy_vertex_base_2.h
rename to 3rdparty/CGAL/include/CGAL/Periodic_2_triangulation_hierarchy_vertex_base_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Periodic_2_triangulation_iterators_2.h b/3rdparty/CGAL/include/CGAL/Periodic_2_triangulation_iterators_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Periodic_2_triangulation_iterators_2.h
rename to 3rdparty/CGAL/include/CGAL/Periodic_2_triangulation_iterators_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Periodic_2_triangulation_statically_filtered_traits_2.h b/3rdparty/CGAL/include/CGAL/Periodic_2_triangulation_statically_filtered_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Periodic_2_triangulation_statically_filtered_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Periodic_2_triangulation_statically_filtered_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Periodic_2_triangulation_traits_2.h b/3rdparty/CGAL/include/CGAL/Periodic_2_triangulation_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Periodic_2_triangulation_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Periodic_2_triangulation_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Periodic_2_triangulation_vertex_base_2.h b/3rdparty/CGAL/include/CGAL/Periodic_2_triangulation_vertex_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Periodic_2_triangulation_vertex_base_2.h
rename to 3rdparty/CGAL/include/CGAL/Periodic_2_triangulation_vertex_base_2.h
diff --git a/3rdparty/CGAL/include/CGAL/Periodic_3_Delaunay_triangulation_3.h b/3rdparty/CGAL/include/CGAL/Periodic_3_Delaunay_triangulation_3.h
new file mode 100644
index 0000000..ae7a857
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Periodic_3_Delaunay_triangulation_3.h
@@ -0,0 +1,1241 @@
+// Copyright (c) 1999-2004,2006-2009   INRIA Sophia-Antipolis (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
+// 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(s)     : Monique Teillaud <Monique.Teillaud at sophia.inria.fr>
+//                 Sylvain Pion <Sylvain.Pion at sophia.inria.fr>
+//                 Andreas Fabri <Andreas.Fabri at sophia.inria.fr>
+//                 Nico Kruithof <Nico.Kruithof at sophia.inria.fr>
+//                 Manuel Caroli <Manuel.Caroli at sophia.inria.fr>
+
+
+#ifndef CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_3_H
+#define CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_3_H
+
+#include <CGAL/Periodic_3_triangulation_3.h>
+#include <CGAL/spatial_sort.h>
+
+// Needed by remove to fill the hole.
+#include <CGAL/internal/Periodic_3_triangulation_remove_traits_3.h>
+#include <CGAL/Delaunay_triangulation_3.h>
+
+namespace CGAL {
+
+template < class Gt,
+            class Tds = Triangulation_data_structure_3 <
+              Triangulation_vertex_base_3<
+		Gt, Periodic_3_triangulation_ds_vertex_base_3<>
+	      >,
+              Triangulation_cell_base_3<
+                Gt, Periodic_3_triangulation_ds_cell_base_3<>
+              >
+            >
+          >
+class Periodic_3_Delaunay_triangulation_3 :
+    public Periodic_3_triangulation_3<Gt,Tds>
+{
+  typedef Periodic_3_Delaunay_triangulation_3<Gt,Tds>          Self;
+public:
+  typedef Periodic_3_triangulation_3<Gt,Tds>                   Base;
+
+public:
+  /** @name Template parameter types */ //@{
+  typedef Gt                                    Geometric_traits;
+  typedef Tds                                   Triangulation_data_structure;
+  //@}
+
+  ///Compatibility typedef:
+  typedef Geometric_traits                      Geom_traits;
+  typedef typename Gt::FT                       FT;
+
+  typedef typename Gt::Point_3                  Point;
+  typedef typename Gt::Segment_3                Segment;
+  typedef typename Gt::Triangle_3               Triangle;
+  typedef typename Gt::Tetrahedron_3            Tetrahedron;
+
+  typedef typename Base::Periodic_point         Periodic_point;
+  typedef typename Base::Periodic_segment       Periodic_segment;
+  typedef typename Base::Periodic_triangle      Periodic_triangle;
+  typedef typename Base::Periodic_tetrahedron   Periodic_tetrahedron;
+
+  typedef typename Base::Cell_handle            Cell_handle;
+  typedef typename Base::Vertex_handle          Vertex_handle;
+
+  typedef typename Base::Cell                   Cell;
+  typedef typename Base::Vertex                 Vertex;
+  typedef typename Base::Facet                  Facet;
+  typedef typename Base::Edge                   Edge;
+
+  typedef typename Base::Cell_circulator        Cell_circulator;
+  typedef typename Base::Facet_circulator       Facet_circulator;
+  typedef typename Base::Cell_iterator          Cell_iterator;
+  typedef typename Base::Facet_iterator         Facet_iterator;
+  typedef typename Base::Edge_iterator          Edge_iterator;
+  typedef typename Base::Vertex_iterator        Vertex_iterator;
+
+  typedef typename Base::All_cells_iterator     All_cells_iterator;
+  typedef typename Base::All_facets_iterator    All_facets_iterator;
+  typedef typename Base::All_edges_iterator     All_edges_iterator;
+  typedef typename Base::All_vertices_iterator  All_vertices_iterator;
+
+  typedef typename Base::size_type              size_type;
+  typedef typename Base::difference_type        difference_type;
+
+  typedef typename Base::Locate_type            Locate_type;
+  typedef typename Base::Iterator_type          Iterator_type;
+
+  typedef typename Base::Offset                 Offset;
+  typedef typename Base::Iso_cuboid             Iso_cuboid;
+  typedef typename Base::Covering_sheets        Covering_sheets;
+  //@}
+
+#ifndef CGAL_CFG_USING_BASE_MEMBER_BUG_2
+  using Base::cw;
+  using Base::ccw;
+  using Base::domain;
+  using Base::geom_traits;
+  using Base::int_to_off;
+  using Base::number_of_sheets;
+  using Base::number_of_vertices;
+  using Base::number_of_edges;
+  using Base::number_of_facets;
+  using Base::number_of_cells;
+  using Base::cells_begin;
+  using Base::cells_end;
+  using Base::vertices_begin;
+  using Base::vertices_end;
+  using Base::facets_begin;
+  using Base::facets_end;
+  using Base::tds;
+  using Base::next_around_edge;
+  using Base::vertex_triple_index;
+  using Base::mirror_vertex;
+  using Base::orientation;
+  using Base::insert_dummy_points;
+  using Base::swap;
+  using Base::is_1_cover;
+  using Base::is_virtual;
+  using Base::point;
+#endif
+
+  // For strict-ansi compliance
+  using Base::adjacent_vertices;
+  using Base::combine_offsets;
+  using Base::get_offset;
+  using Base::get_original_vertex;
+  using Base::get_location_offset;
+  using Base::get_neighbor_offset;
+  using Base::incident_edges;
+  using Base::incident_facets;
+  using Base::incident_cells;
+  using Base::is_valid_conflict;
+  using Base::locate;
+  using Base::periodic_point;
+  using Base::segment;
+
+public:
+  /** @name Creation */ //@{
+  Periodic_3_Delaunay_triangulation_3(
+      const Iso_cuboid& domain = Iso_cuboid(0,0,0,1,1,1),
+      const Geometric_traits& gt = Geometric_traits())
+    : Base(domain, gt) {}
+
+  // copy constructor duplicates vertices and cells
+  Periodic_3_Delaunay_triangulation_3(
+      const Periodic_3_Delaunay_triangulation_3& tr) : Base(tr) { 
+    CGAL_triangulation_expensive_postcondition( is_valid() );  
+  }
+
+  template < typename InputIterator >
+  Periodic_3_Delaunay_triangulation_3(InputIterator first, InputIterator last,
+      const Iso_cuboid& domain = Iso_cuboid(0,0,0,1,1,1),
+      const Geometric_traits& gt = Geometric_traits() )
+    : Base(domain, gt) {
+    insert(first, last);
+  }
+  //@}
+
+  /** @name Insertion */ //@{
+  Vertex_handle insert(const Point & p, Cell_handle start = Cell_handle()) {
+    Conflict_tester tester(p, this);
+    Point_hider hider;
+    return Base::insert_in_conflict(p, start, tester, hider);
+  }
+
+  Vertex_handle insert(const Point & p, Locate_type lt, Cell_handle c,
+      int li, int lj) {
+    Conflict_tester tester(p, this);
+    Point_hider hider;
+    return Base::insert_in_conflict(p,lt,c,li,lj, tester,hider);
+  }
+
+  template < class InputIterator >
+  std::ptrdiff_t insert(InputIterator first, InputIterator last,
+      bool is_large_point_set = false) {
+    if (first == last) return 0;
+    size_type n = number_of_vertices();
+    // The heuristic discards the existing triangulation so it can only be
+    // applied to empty triangulations.
+    if (n!=0) is_large_point_set = false;
+
+    std::vector<Point> points(first, last);
+    std::random_shuffle (points.begin(), points.end());
+    Cell_handle hint;
+    std::vector<Vertex_handle> dummy_points, double_vertices;
+    typename std::vector<Point>::iterator pbegin = points.begin();
+    if (is_large_point_set)
+      dummy_points = insert_dummy_points();
+    else while (!is_1_cover()) {
+	insert(*pbegin);
+	++pbegin;
+	if (pbegin == points.end()) return number_of_vertices() - n;
+      }
+
+    // Use Geom_traits::K for efficiency: spatial_sort creates a lot
+    // of copies of the traits but does not need the domain that is
+    // stored in it.
+    spatial_sort (pbegin, points.end(), typename Geom_traits::K());
+
+    Conflict_tester tester(*pbegin,this);
+    Point_hider hider;
+    double_vertices = Base::insert_in_conflict(
+	points.begin(),points.end(),hint,tester,hider); 
+   
+    if (is_large_point_set) {
+      typedef CGAL::Periodic_3_triangulation_remove_traits_3< Gt > P3removeT;
+      typedef CGAL::Delaunay_triangulation_3< P3removeT > DT;
+      typedef Vertex_remover< DT > Remover;
+      P3removeT remove_traits(domain());
+      DT dt(remove_traits);
+      Remover remover(this,dt);
+      Conflict_tester t(this);
+      for (unsigned int i=0; i<dummy_points.size(); i++) {
+	if (std::find(double_vertices.begin(), double_vertices.end(),
+		dummy_points[i]) == double_vertices.end())
+	  Base::remove(dummy_points[i],remover,t);
+      }
+    }
+
+    return number_of_vertices() - n;
+  }
+  //@}
+
+  /** @name Point moving */ //@{
+  Vertex_handle move_point(Vertex_handle v, const Point & p);
+  //@}
+
+public:
+  /** @name Removal */ //@{
+  void remove(Vertex_handle v);
+
+  template < typename InputIterator >
+  std::ptrdiff_t remove(InputIterator first, InputIterator beyond) {
+    std::size_t n = number_of_vertices();
+    while (first != beyond) {
+      remove(*first);
+      ++first;
+    }
+    return n - number_of_vertices();
+  }
+  //@}
+
+public:
+  /** @name Wrapping the traits */ //@{
+  Oriented_side side_of_oriented_sphere(const Point &p, const Point &q,
+      const Point &r, const Point &s, const Point &t) const {
+    return geom_traits().side_of_oriented_sphere_3_object()(p,q,r,s,t);
+  }
+  Oriented_side side_of_oriented_sphere(const Point &p, const Point &q,
+      const Point &r, const Point &s, const Point &t, const Offset &o_p,
+      const Offset &o_q, const Offset &o_r, const Offset &o_s,
+      const Offset &o_t) const {
+    return geom_traits().side_of_oriented_sphere_3_object()(
+	p,q,r,s,t,o_p,o_q,o_r,o_s,o_t);
+  }
+  Comparison_result compare_distance(const Point &p, const Point &q,
+      const Point &r) const {
+      return geom_traits().compare_distance_3_object()(p, q, r);
+  }
+  Comparison_result compare_distance(const Point &p, const Point &q,
+      const Point &r, const Offset &o_p, const Offset &o_q,
+      const Offset &o_r) const {
+    return geom_traits().compare_distance_3_object()(p, q, r, o_p, o_q, o_r);
+  }
+  //@}
+
+private:
+  /** @name Query helpers */ //@{
+  Bounded_side _side_of_sphere(const Cell_handle& c, const Point& p,
+      const Offset & offset = Offset(), bool perturb = false) const;
+
+  Offset get_min_dist_offset(const Point & p, const Offset & o,
+      const Vertex_handle vh) const;
+  //@}
+
+public:
+  /** @name Queries */ //@{
+  Bounded_side side_of_sphere(const Cell_handle& c, const Point& p,
+      const Offset & offset = Offset(), bool perturb = false) const{
+    Bounded_side bs = ON_UNBOUNDED_SIDE;
+    int i=0;
+    // TODO: optimize which copies to check depending on the offsets in
+    // the cell.
+    while (bs == ON_UNBOUNDED_SIDE && i<8) {
+      bs= _side_of_sphere(c,p,combine_offsets(offset,int_to_off(i)),perturb);
+      i++;
+    }
+    return bs;
+  }
+
+  Vertex_handle nearest_vertex(const Point& p,
+      Cell_handle c = Cell_handle()) const;
+  Vertex_handle nearest_vertex_in_cell(const Cell_handle& c,
+      const Point & p, const Offset & offset = Offset()) const;
+
+  /// Undocumented wrapper for find_conflicts.
+  template <class OutputIteratorBoundaryFacets, class OutputIteratorCells>
+  std::pair<OutputIteratorBoundaryFacets, OutputIteratorCells>
+  find_conflicts(const Point &p, Cell_handle c,
+      OutputIteratorBoundaryFacets bfit, OutputIteratorCells cit) const {
+    Triple<OutputIteratorBoundaryFacets,OutputIteratorCells,Emptyset_iterator>
+    t = find_conflicts(p, c, bfit, cit, Emptyset_iterator());
+    return std::make_pair(t.first, t.second);
+  }
+
+  template <class OutputIteratorBoundaryFacets, class OutputIteratorCells,
+            class OutputIteratorInternalFacets>
+  Triple<OutputIteratorBoundaryFacets, OutputIteratorCells,
+         OutputIteratorInternalFacets>
+  find_conflicts(const Point &p, Cell_handle c,
+      OutputIteratorBoundaryFacets bfit, OutputIteratorCells cit,
+      OutputIteratorInternalFacets ifit) const;
+  
+  /// Returns the vertices on the boundary of the conflict hole.
+  template <class OutputIterator>
+  OutputIterator vertices_in_conflict(const Point&p, Cell_handle c,
+      OutputIterator res) const;
+
+  bool is_Gabriel(const Cell_handle c, int i) const;
+  bool is_Gabriel(const Cell_handle c, int i, int j) const;
+  bool is_Gabriel(const Facet& f)const {
+    return is_Gabriel(f.first, f.second);
+  }
+  bool is_Gabriel(const Edge& e) const {
+    return is_Gabriel(e.first, e.second, e.third);
+  }
+  //@}
+  
+private:
+  /** @name Voronoi diagram helpers */ //@{
+  bool is_canonical(const Periodic_segment &ps) const {
+    if (number_of_sheets() == make_array(1,1,1)) return true;
+    Offset o0 = ps.at(0).second;
+    Offset o1 = ps.at(1).second;
+    Offset cumm_off((std::min)(o0.x(),o1.x()),(std::min)(o0.y(),o1.y()),
+	(std::min)(o0.z(),o1.z()));
+    return (cumm_off == Offset(0,0,0));
+  }
+  //@}
+public:
+  Periodic_point periodic_circumcenter(Cell_handle c) const {
+    CGAL_triangulation_precondition(c != Cell_handle());
+    Point v = geom_traits().construct_circumcenter_3_object()(
+        c->vertex(0)->point(), c->vertex(1)->point(),
+	c->vertex(2)->point(), c->vertex(3)->point(),
+        get_offset(c,0), get_offset(c,1),
+	get_offset(c,2), get_offset(c,3));
+
+    // check that v lies within the domain. If not: translate
+    Iso_cuboid dom = domain();
+    if (   !(v.x() < dom.xmin()) && v.x()<dom.xmax()
+	&& !(v.y() < dom.ymin()) && v.y()<dom.ymax()
+	&& !(v.z() < dom.zmin()) && v.z()<dom.zmax() )
+      return std::make_pair(v,Offset());
+
+    int ox=-1, oy=-1, oz=-1;
+    if (v.x() < dom.xmin()) ox = 1;
+    else if (v.x() < dom.xmax()) ox = 0;
+    if (v.y() < dom.ymin()) oy = 1;
+    else if (v.y() < dom.ymax()) oy = 0;
+    if (v.z() < dom.zmin()) oz = 1;
+    else if (v.z() < dom.zmax()) oz = 0;
+    Offset transl_offx(0,0,0);
+    Offset transl_offy(0,0,0);
+    Offset transl_offz(0,0,0);
+    Point dv(v);
+
+    // Find the right offset such that the translation will yield a
+    // point inside the original domain.
+    while ( dv.x() < dom.xmin() || !(dv.x() < dom.xmax()) ) {
+      transl_offx.x() = transl_offx.x() + ox;
+      dv = point(std::make_pair(v,transl_offx));
+    }
+    while ( dv.y() < dom.ymin() || !(dv.y() < dom.ymax()) ) {
+      transl_offy.y() = transl_offy.y() + oy;
+      dv = point(std::make_pair(v,transl_offy));
+    }
+    while ( dv.z() < dom.zmin() || !(dv.z() < dom.zmax()) ) {
+      transl_offz.z() = transl_offz.z() + oz;
+      dv = point(std::make_pair(v,transl_offz));
+    }
+
+    Offset transl_off(transl_offx.x(),transl_offy.y(),transl_offz.z());
+    Periodic_point ppv(std::make_pair(v,transl_off));
+
+    CGAL_triangulation_assertion_code(Point rv(point(ppv));)
+    CGAL_triangulation_assertion( !(rv.x() < dom.xmin()) && rv.x() < dom.xmax() );
+    CGAL_triangulation_assertion( !(rv.y() < dom.ymin()) && rv.y() < dom.ymax() );
+    CGAL_triangulation_assertion( !(rv.z() < dom.zmin()) && rv.z() < dom.zmax() );
+    return ppv;
+  }
+
+private:
+bool is_canonical(const Facet &f) const {
+  if (number_of_sheets() == make_array(1,1,1)) return true;
+  Offset cell_off0 = int_to_off(f.first->offset((f.second+1)&3));
+  Offset cell_off1 = int_to_off(f.first->offset((f.second+2)&3));
+  Offset cell_off2 = int_to_off(f.first->offset((f.second+3)&3));
+  Offset diff_off((cell_off0.x() == 1 
+	  && cell_off1.x() == 1 
+	  && cell_off2.x() == 1)?-1:0,
+      (cell_off0.y() == 1 
+	  && cell_off1.y() == 1
+	  && cell_off2.y() == 1)?-1:0,
+      (cell_off0.z() == 1 
+	  && cell_off1.z() == 1
+	  && cell_off2.z() == 1)?-1:0);
+  Offset off0 = combine_offsets(get_offset(f.first, (f.second+1)&3),
+      diff_off);
+  Offset off1 = combine_offsets(get_offset(f.first, (f.second+2)&3),
+      diff_off);
+  Offset off2 = combine_offsets(get_offset(f.first, (f.second+3)&3),
+      diff_off);
+  
+  // If there is one offset with entries larger than 1 then we are
+  // talking about a vertex that is too far away from the original
+  // domain to belong to a canonical triangle.
+  if (off0.x() > 1) return false;
+  if (off0.y() > 1) return false;
+  if (off0.z() > 1) return false;
+  if (off1.x() > 1) return false;
+  if (off1.y() > 1) return false;
+  if (off1.z() > 1) return false;
+  if (off2.x() > 1) return false;
+  if (off2.y() > 1) return false;
+  if (off2.z() > 1) return false;
+  
+  // If there is one direction of space for which all offsets are
+  // non-zero then the edge is not canonical because we can
+  // take the copy closer towards the origin in that direction.
+  int offx = off0.x() & off1.x() & off2.x();
+  int offy = off0.y() & off1.y() & off2.y();
+  int offz = off0.z() & off1.z() & off2.z();
+  
+  return (offx == 0 && offy == 0 && offz == 0);
+}
+  
+  bool canonical_dual_segment(Cell_handle c, int i, Periodic_segment& ps) const {
+    CGAL_triangulation_precondition(c != Cell_handle());
+    Offset off = get_neighbor_offset(c,i,c->neighbor(i));
+    Periodic_point p1 = periodic_circumcenter(c);
+    Periodic_point p2 = periodic_circumcenter(c->neighbor(i));
+    Offset o1 = -p1.second;
+    Offset o2 = combine_offsets(-p2.second,-off);
+    Offset cumm_off((std::min)(o1.x(),o2.x()),
+	(std::min)(o1.y(),o2.y()),(std::min)(o1.z(),o2.z()));
+    const std::pair<Point,Offset> pp1 = std::make_pair(point(p1), o1-cumm_off);
+    const std::pair<Point,Offset> pp2 = std::make_pair(point(p2), o2-cumm_off);
+    ps = make_array(pp1,pp2);
+    return (cumm_off == Offset(0,0,0));
+  }
+
+public:
+  /** @name Voronoi diagram */ //@{
+  Point dual(Cell_handle c) const {
+    return point(periodic_circumcenter(c));
+  }
+  Periodic_segment dual(const Facet & f) const {
+    return dual( f.first, f.second );
+  }
+  Periodic_segment dual(Cell_handle c, int i) const{
+    Periodic_segment ps;
+    canonical_dual_segment(c,i,ps);
+    return ps;
+  }
+
+  template <class OutputIterator>
+  OutputIterator dual(const Edge & e, OutputIterator points) const {
+    return dual(e.first, e.second, e.third, points);
+  }
+
+  template <class OutputIterator>
+  OutputIterator dual(Cell_handle c, int i, int j,
+      OutputIterator points) const {
+    Cell_circulator cstart = incident_cells(c, i, j);
+
+    Offset offv = periodic_point(c,i).second;
+    Vertex_handle v = c->vertex(i);
+
+    Cell_circulator ccit = cstart;
+    do {
+      Point dual_orig = periodic_circumcenter(ccit).first;
+      int idx = ccit->index(v);
+      Offset off = periodic_point(ccit,idx).second;
+      Point dual = point(std::make_pair(dual_orig,-off+offv));
+      *points++ = dual;
+      ++ccit;
+    } while (ccit != cstart);
+    return points;
+  }
+
+  template <class OutputIterator>
+  OutputIterator dual(Vertex_handle v, OutputIterator points) const {
+    std::vector<Cell_handle> cells;
+    incident_cells(v,std::back_inserter(cells));
+
+    for (unsigned int i=0; i<cells.size() ; i++) {
+      Point dual_orig = periodic_circumcenter(cells[i]).first;
+      int idx = cells[i]->index(v);
+      Offset off = periodic_point(cells[i],idx).second;
+      Point dual = point(std::make_pair(dual_orig,-off));
+      *points++ = dual;
+    }
+    return points;
+  }
+
+  template <class Stream>
+  Stream& draw_dual(Stream& os) const {
+    CGAL_triangulation_assertion_code( unsigned int i = 0; )
+    for (Facet_iterator fit = facets_begin(), end = facets_end();
+	 fit != end; ++fit) {
+      if (!is_canonical(*fit)) continue;
+      Periodic_segment pso = dual(*fit);
+      Segment so = segment(pso);
+      CGAL_triangulation_assertion_code ( ++i; )
+	os << so.source()<<' '<<so.target()<<' ';
+    }
+    CGAL_triangulation_assertion( i == number_of_facets() );
+    return os;
+  }
+
+  /// Volume computations
+
+  // Note: Polygon area computation requires to evaluate square roots
+  // and thus cannot be done without changing the Traits concept.
+
+  FT dual_volume(Vertex_handle v) const {
+    std::list<Edge> edges;
+    incident_edges(v, std::back_inserter(edges));
+
+    FT vol(0);
+    for (typename std::list<Edge>::iterator eit = edges.begin() ; 
+	 eit != edges.end() ; ++eit) {
+
+      // compute the dual of the edge *eit but handle the translations
+      // with respect to the dual of v. That is why we cannot use one
+      // of the existing dual functions here.
+      Facet_circulator fstart = incident_facets(*eit);
+      Facet_circulator fcit = fstart;
+      std::vector<Point> pts;
+      do {
+	// TODO: possible speed-up by caching the circumcenters
+	Point dual_orig = periodic_circumcenter(fcit->first).first;
+	int idx = fcit->first->index(v);
+	Offset off = periodic_point(fcit->first,idx).second;
+	pts.push_back(point(std::make_pair(dual_orig,-off)));
+	++fcit;
+      } while (fcit != fstart);
+
+      Point orig(0,0,0);
+      for (unsigned int i=1 ; i<pts.size()-1 ; i++) 
+	vol += Tetrahedron(orig,pts[0],pts[i],pts[i+1]).volume();
+    }
+    return vol;
+  }
+
+  /// Centroid computations
+
+  // Note: Centroid computation for polygons requires to evaluate
+  // square roots and thus cannot be done without changing the
+  // Traits concept.
+
+  // TODO: reuse the centroid computation from the PCA package
+  Point dual_centroid(Vertex_handle v) const {
+    std::list<Edge> edges;
+    incident_edges(v, std::back_inserter(edges));
+
+    FT vol(0);
+    FT x(0), y(0), z(0);
+    for (typename std::list<Edge>::iterator eit = edges.begin() ; 
+	 eit != edges.end() ; ++eit) {
+
+      // compute the dual of the edge *eit but handle the translations
+      // with respect to the dual of v. That is why we cannot use one
+      // of the existing dual functions here.
+      Facet_circulator fstart = incident_facets(*eit);
+      Facet_circulator fcit = fstart;
+      std::vector<Point> pts;
+      do {
+	// TODO: possible speed-up by caching the circumcenters
+	Point dual_orig = periodic_circumcenter(fcit->first).first;
+	int idx = fcit->first->index(v);
+	Offset off = periodic_point(fcit->first,idx).second;
+	pts.push_back(point(std::make_pair(dual_orig,-off)));
+	++fcit;
+      } while (fcit != fstart);
+
+      Point orig(0,0,0);
+      FT tetvol;
+      for (unsigned int i=1 ; i<pts.size()-1 ; i++) {
+	tetvol = Tetrahedron(orig,pts[0],pts[i],pts[i+1]).volume();
+	x += (pts[0].x() + pts[i].x() + pts[i+1].x()) * tetvol;
+	y += (pts[0].y() + pts[i].y() + pts[i+1].y()) * tetvol;
+	z += (pts[0].z() + pts[i].z() + pts[i+1].z()) * tetvol;
+	vol += tetvol;
+      }
+    }
+    x /= ( 4 * vol );
+    y /= ( 4 * vol );
+    z /= ( 4 * vol );
+
+    Iso_cuboid d = domain();
+    x = (x < d.xmin() ? x+d.xmax()-d.xmin() 
+	: (x >= d.xmax() ? x-d.xmax()+d.xmin() : x));
+    y = (y < d.ymin() ? y+d.ymax()-d.ymin() 
+	: (y >= d.ymax() ? y-d.ymax()+d.ymin() : y));
+    z = (z < d.zmin() ? z+d.zmax()-d.zmin() 
+	: (z >= d.zmax() ? z-d.zmax()+d.zmin() : z));
+
+    CGAL_triangulation_postcondition((d.xmin()<=x)&&(x<d.xmax()));
+    CGAL_triangulation_postcondition((d.ymin()<=y)&&(y<d.ymax()));
+    CGAL_triangulation_postcondition((d.zmin()<=z)&&(z<d.zmax()));
+
+    return Point(x,y,z);
+  }
+  //@}
+  
+  /** @name Checking */ //@{
+  bool is_valid(bool verbose = false, int level = 0) const;
+  bool is_valid(Cell_handle c, bool verbose = false, int level = 0) const;
+  //@}
+
+protected:
+  // Protected, because inheritors(e.g. periodic triangulation for meshing) 
+  // of the class Periodic_3_Delaunay_triangulation_3 use this class
+  class Conflict_tester;
+private:
+  class Point_hider;
+
+#ifndef CGAL_CFG_OUTOFLINE_TEMPLATE_MEMBER_DEFINITION_BUG
+  template <class TriangulationR3> struct Vertex_remover;
+#else
+  template <class TriangulationR3>
+  struct Vertex_remover
+  {
+    typedef TriangulationR3      Triangulation_R3;
+    
+    typedef typename std::vector<Point>::iterator Hidden_points_iterator;
+    
+    typedef Triple < Vertex_handle, Vertex_handle, Vertex_handle > Vertex_triple;
+    
+    typedef typename Triangulation_R3::Triangulation_data_structure TDSE;
+    typedef typename Triangulation_R3::Cell_handle        CellE_handle;
+    typedef typename Triangulation_R3::Vertex_handle      VertexE_handle;
+    typedef typename Triangulation_R3::Facet              FacetE;
+    typedef typename Triangulation_R3::Finite_cells_iterator Finite_cellsE_iterator;
+    
+    typedef Triple< VertexE_handle, VertexE_handle, VertexE_handle >
+      VertexE_triple;
+    
+    typedef std::map<Vertex_triple,Facet> Vertex_triple_Facet_map;
+    typedef std::map<Vertex_triple, FacetE> Vertex_triple_FacetE_map;
+    typedef typename Vertex_triple_FacetE_map::iterator
+    Vertex_triple_FacetE_map_it;
+    
+  Vertex_remover(const Self *t, Triangulation_R3 &tmp_) : _t(t),tmp(tmp_) {}
+    
+    const Self *_t;
+    Triangulation_R3 &tmp;
+    
+    void add_hidden_points(Cell_handle) {
+      std::copy (hidden_points_begin(), hidden_points_end(), 
+		 std::back_inserter(hidden));
+    }
+    
+    Hidden_points_iterator hidden_points_begin() {
+      return hidden.begin();
+    }
+    Hidden_points_iterator hidden_points_end() {
+      return hidden.end();
+    }
+    //private:
+    // The removal of v may un-hide some points,
+    // Space functions output them.
+    std::vector<Point> hidden;
+  };
+#endif //CGAL_CFG_OUTOFLINE_TEMPLATE_MEMBER_DEFINITION_BUG
+
+  // unused and undocumented types and functions required to be
+  // compatible to Alpha_shape_3
+public:
+  typedef Cell_iterator   Finite_cells_iterator;
+  typedef Facet_iterator  Finite_facets_iterator;
+  typedef Edge_iterator   Finite_edges_iterator;
+  typedef Vertex_iterator Finite_vertices_iterator;
+
+  int dimension() const { return 3; }
+  template < class T >
+  bool is_infinite(const T&, int = 0, int = 0) const { return false; }
+  size_type number_of_finite_cells() const { return number_of_cells(); }
+  size_type number_of_finite_facets() const { return number_of_facets(); }
+  size_type number_of_finite_edges() const { return number_of_edges(); }
+  size_type number_of_finite_vertices() const { return number_of_vertices(); }
+};
+
+template < class GT, class Tds >
+typename Periodic_3_Delaunay_triangulation_3<GT,Tds>::Vertex_handle
+Periodic_3_Delaunay_triangulation_3<GT,Tds>::nearest_vertex(const Point& p,
+    Cell_handle start) const {
+  if (number_of_vertices() == 0)
+    return Vertex_handle();
+
+  Locate_type lt;
+  int li, lj;
+  Cell_handle c = locate(p, lt, li, lj, start);
+  if (lt == Base::VERTEX) return c->vertex(li);
+  const Conflict_tester tester(p, this);
+  Offset o = combine_offsets(Offset(),get_location_offset(tester,c));
+
+  // - start with the closest vertex from the located cell.
+  // - repeatedly take the nearest of its incident vertices if any
+  // - if not, we're done.
+  Vertex_handle nearest = nearest_vertex_in_cell(c, p, o);
+  std::vector<Vertex_handle> vs;
+  vs.reserve(32);
+  while (true) {
+    Vertex_handle tmp = nearest;
+    Offset tmp_off = get_min_dist_offset(p,o,tmp);
+    adjacent_vertices(nearest, std::back_inserter(vs));
+    for (typename std::vector<Vertex_handle>::const_iterator
+	   vsit = vs.begin(); vsit != vs.end(); ++vsit)
+      tmp = (compare_distance(p,tmp->point(),(*vsit)->point(),
+	      o,tmp_off,get_min_dist_offset(p,o,*vsit))
+	  == SMALLER) ? tmp : *vsit;
+    if (tmp == nearest)
+      break;
+    vs.clear();
+    nearest = tmp;
+  }
+
+  return get_original_vertex(nearest);
+}
+
+// just trying the eight possibilities
+template < class GT, class Tds >
+typename Periodic_3_Delaunay_triangulation_3<GT,Tds>::Offset
+Periodic_3_Delaunay_triangulation_3<GT,Tds>::get_min_dist_offset(
+    const Point & p, const Offset & o, const Vertex_handle vh) const {
+  Offset mdo = get_offset(vh);
+  Offset min_off = Offset(0,0,0);
+  min_off = (compare_distance(p,vh->point(),vh->point(),
+	  o,combine_offsets(mdo,min_off),combine_offsets(mdo,Offset(0,0,1)))
+      == SMALLER ? min_off : Offset(0,0,1) );
+  min_off = (compare_distance(p,vh->point(),vh->point(),
+	  o,combine_offsets(mdo,min_off),combine_offsets(mdo,Offset(0,1,0)))
+      == SMALLER ? min_off : Offset(0,1,0) );
+  min_off = (compare_distance(p,vh->point(),vh->point(),
+	  o,combine_offsets(mdo,min_off),combine_offsets(mdo,Offset(0,1,1)))
+      == SMALLER ? min_off : Offset(0,1,1) );
+  min_off = (compare_distance(p,vh->point(),vh->point(),
+	  o,combine_offsets(mdo,min_off),combine_offsets(mdo,Offset(1,0,0)))
+      == SMALLER ? min_off : Offset(1,0,0) );
+  min_off = (compare_distance(p,vh->point(),vh->point(),
+	  o,combine_offsets(mdo,min_off),combine_offsets(mdo,Offset(1,0,1)))
+      == SMALLER ? min_off : Offset(1,0,1) );
+  min_off = (compare_distance(p,vh->point(),vh->point(),
+	  o,combine_offsets(mdo,min_off),combine_offsets(mdo,Offset(1,1,0)))
+      == SMALLER ? min_off : Offset(1,1,0) );
+  min_off = (compare_distance(p,vh->point(),vh->point(),
+	  o,combine_offsets(mdo,min_off),combine_offsets(mdo,Offset(1,1,1)))
+      == SMALLER ? min_off : Offset(1,1,1) );
+  return combine_offsets(mdo,min_off);
+}
+
+/// Returns the finite vertex of the cell c which is the closest to p.
+template < class GT, class Tds >
+typename Periodic_3_Delaunay_triangulation_3<GT,Tds>::Vertex_handle
+Periodic_3_Delaunay_triangulation_3<GT,Tds>::nearest_vertex_in_cell(
+    const Cell_handle& c, const Point & p, const Offset & o) const {
+  CGAL_triangulation_precondition(number_of_vertices() != 0);
+  Vertex_handle nearest = c->vertex(0);
+  for (int i=1 ; i<4 ; i++) {
+    nearest = (compare_distance(p,nearest->point(),c->vertex(i)->point(),
+	    o,get_offset(c,c->index(nearest)),get_offset(c,i)) == SMALLER) ?
+      nearest : c->vertex(i);
+  }
+  return nearest;
+}
+
+// ############################################################################
+
+// TODO: reintroduce the commented lines.
+template < class Gt, class Tds >
+typename Periodic_3_Delaunay_triangulation_3<Gt,Tds>::Vertex_handle
+Periodic_3_Delaunay_triangulation_3<Gt,Tds>::
+move_point(Vertex_handle v, const Point & p) {
+  CGAL_triangulation_expensive_precondition(is_vertex(v));
+  // Remember an incident vertex to restart
+  // the point location after the removal.
+  // Cell_handle c = v->cell();
+  //Vertex_handle old_neighbor = c->vertex(c->index(v) == 0 ? 1 : 0);
+  //  CGAL_triangulation_assertion(old_neighbor != v);
+
+  remove(v);
+
+  if (number_of_vertices() == 0)
+    return insert(p);
+  return insert(p);//, old_neighbor->cell());
+}
+
+template < class Gt, class Tds >
+void Periodic_3_Delaunay_triangulation_3<Gt,Tds>::remove(Vertex_handle v)
+{
+  typedef CGAL::Periodic_3_triangulation_remove_traits_3< Gt > P3removeT;
+  typedef CGAL::Delaunay_triangulation_3< P3removeT >
+    Euclidean_triangulation;
+  typedef Vertex_remover< Euclidean_triangulation > Remover;
+  P3removeT remove_traits(domain());
+  Euclidean_triangulation tmp(remove_traits);
+  Remover remover(this, tmp);
+  Conflict_tester ct(this);
+
+  Base::remove(v, remover, ct);
+  CGAL_triangulation_expensive_assertion(is_valid());
+}
+
+template < class Gt, class Tds >
+template <class OutputIteratorBoundaryFacets, class OutputIteratorCells,
+          class OutputIteratorInternalFacets>
+Triple<OutputIteratorBoundaryFacets, OutputIteratorCells,
+       OutputIteratorInternalFacets>
+Periodic_3_Delaunay_triangulation_3<Gt,Tds>::find_conflicts( const Point
+&p,
+    Cell_handle c, OutputIteratorBoundaryFacets bfit,
+    OutputIteratorCells cit, OutputIteratorInternalFacets ifit) const {
+  CGAL_triangulation_precondition(number_of_vertices() != 0);
+
+  std::vector<Facet> facets;
+  facets.reserve(64);
+  std::vector<Cell_handle> cells;
+  cells.reserve(32);
+
+  Conflict_tester tester(p, this);
+  Triple<typename std::back_insert_iterator<std::vector<Facet> >,
+         typename std::back_insert_iterator<std::vector<Cell_handle> >,
+         OutputIteratorInternalFacets> tit = Base::find_conflicts(c, tester,
+              make_triple(std::back_inserter(facets),
+                      std::back_inserter(cells), ifit));
+  ifit = tit.third;
+
+  // Reset the conflict flag on the boundary.
+  for(typename std::vector<Facet>::iterator fit=facets.begin();
+  fit != facets.end(); ++fit) {
+    fit->first->neighbor(fit->second)->tds_data().clear();
+    *bfit++ = *fit;
+  }
+
+  // Reset the conflict flag in the conflict cells.
+  for(typename std::vector<Cell_handle>::iterator ccit=cells.begin();
+      ccit != cells.end(); ++ccit) {
+    (*ccit)->tds_data().clear();
+    *cit++ = *ccit;
+  }
+
+  for (typename std::vector<Vertex_handle>::iterator
+	 voit = this->v_offsets.begin();
+       voit != this->v_offsets.end() ; ++voit) {
+    (*voit)->clear_offset();
+  }
+  this->v_offsets.clear();
+
+  return make_triple(bfit, cit, ifit);
+}
+
+template < class Gt, class Tds >
+template <class OutputIterator>
+OutputIterator
+Periodic_3_Delaunay_triangulation_3<Gt,Tds>::vertices_in_conflict(
+    const Point&p, Cell_handle c, OutputIterator res) const {
+  if (number_of_vertices() == 0) return res;
+
+  // Get the facets on the boundary of the hole.
+  std::vector<Facet> facets;
+  find_conflicts(p, c, std::back_inserter(facets), Emptyset_iterator());
+  
+  // Then extract uniquely the vertices.
+  std::set<Vertex_handle> vertices;
+  for (typename std::vector<Facet>::const_iterator i = facets.begin();
+       i != facets.end(); ++i) {
+    vertices.insert(i->first->vertex((i->second+1)&3));
+    vertices.insert(i->first->vertex((i->second+2)&3));
+    vertices.insert(i->first->vertex((i->second+3)&3));
+  }
+  
+  return std::copy(vertices.begin(), vertices.end(), res);
+}
+
+template < class Gt, class Tds >
+Bounded_side Periodic_3_Delaunay_triangulation_3<Gt,Tds>::
+_side_of_sphere(const Cell_handle &c, const Point &q,
+    const Offset &offset, bool perturb ) const {
+
+  Point p0 = c->vertex(0)->point(),
+        p1 = c->vertex(1)->point(),
+        p2 = c->vertex(2)->point(),
+        p3 = c->vertex(3)->point();
+  Offset o0 = this->get_offset(c,0),
+        o1 = this->get_offset(c,1),
+        o2 = this->get_offset(c,2),
+        o3 = this->get_offset(c,3),
+        oq = offset;
+
+  Oriented_side os = ON_NEGATIVE_SIDE;
+  os= side_of_oriented_sphere(p0, p1, p2, p3, q, o0, o1, o2, o3, oq);
+
+  if (os != ON_ORIENTED_BOUNDARY || !perturb)
+    return (Bounded_side) os;
+
+  //We are now in a degenerate case => we do a symbolic perturbation. 
+  // We sort the points lexicographically.
+  Periodic_point pts[5] = {std::make_pair(p0,o0), std::make_pair(p1,o1),
+			   std::make_pair(p2,o2), std::make_pair(p3,o3),
+			   std::make_pair(q,oq)};
+  const Periodic_point *points[5] ={&pts[0],&pts[1],&pts[2],&pts[3],&pts[4]};
+
+  std::sort(points, points+5,
+      typename Base::template Perturbation_order<
+	  typename Gt::Compare_xyz_3 >(
+	  geom_traits().compare_xyz_3_object() ) );
+  // We successively look whether the leading monomial, then 2nd monomial
+  // of the determinant has non null coefficient.
+  // 2 iterations are enough (cf paper)
+  for (int i=4; i>2; --i) {
+    if (points[i] == &pts[4]) {
+      CGAL_triangulation_assertion(orientation(p0, p1, p2, p3, o0, o1, o2, o3)
+          == POSITIVE);
+      // since p0 p1 p2 p3 are non coplanar and positively oriented
+      return ON_UNBOUNDED_SIDE;
+    }
+    Orientation o;
+    if (points[i] == &pts[3] && 
+        (o = orientation(p0, p1, p2, q, o0, o1, o2, oq)) != COPLANAR ) {
+      return (Bounded_side) o;
+    }
+    if (points[i] == &pts[2] && 
+        (o = orientation(p0, p1, q, p3, o0, o1, oq, o3)) != COPLANAR ) {
+      return (Bounded_side) o;
+    }
+    if (points[i] == &pts[1] && 
+        (o = orientation(p0, q, p2, p3, o0, oq, o2, o3)) != COPLANAR ) {
+      return (Bounded_side) o;
+    }
+    if (points[i] == &pts[0] && 
+        (o = orientation(q, p1, p2 ,p3, oq, o1, o2, o3)) != COPLANAR ) {
+      return (Bounded_side) o;
+    }
+  }
+
+  CGAL_triangulation_assertion(false);
+  return ON_UNBOUNDED_SIDE;
+}
+
+template < class Gt, class Tds >
+bool Periodic_3_Delaunay_triangulation_3<Gt,Tds>::
+is_Gabriel(const Cell_handle c, int i) const {
+  CGAL_triangulation_precondition(number_of_vertices() != 0);
+  typename Geom_traits::Side_of_bounded_sphere_3
+    side_of_bounded_sphere =
+    geom_traits().side_of_bounded_sphere_3_object();
+
+  if (side_of_bounded_sphere (
+          c->vertex(vertex_triple_index(i,0))->point(),
+	  c->vertex(vertex_triple_index(i,1))->point(),
+	  c->vertex(vertex_triple_index(i,2))->point(),
+          c->vertex(i)->point(),
+          get_offset(c,vertex_triple_index(i,0)),
+          get_offset(c,vertex_triple_index(i,1)),
+          get_offset(c,vertex_triple_index(i,2)),
+          get_offset(c,i) ) == ON_BOUNDED_SIDE ) return false;
+  Cell_handle neighbor = c->neighbor(i);
+  int in = neighbor->index(c);
+
+  if (side_of_bounded_sphere(
+          neighbor->vertex(vertex_triple_index(in,0))->point(),
+	  neighbor->vertex(vertex_triple_index(in,1))->point(),
+	  neighbor->vertex(vertex_triple_index(in,2))->point(),
+          neighbor->vertex(in)->point(),
+          get_offset(neighbor,vertex_triple_index(in,0)),
+          get_offset(neighbor,vertex_triple_index(in,1)),
+          get_offset(neighbor,vertex_triple_index(in,2)),
+          get_offset(neighbor, in) ) == ON_BOUNDED_SIDE )
+    return false;
+  
+  return true;
+}
+
+template < class Gt, class Tds >
+bool Periodic_3_Delaunay_triangulation_3<Gt,Tds>::
+is_Gabriel(const Cell_handle c, int i, int j) const {
+  typename Geom_traits::Side_of_bounded_sphere_3
+    side_of_bounded_sphere =
+    geom_traits().side_of_bounded_sphere_3_object();
+
+  Facet_circulator fcirc = incident_facets(c,i,j),
+    fdone(fcirc);
+  Vertex_handle v1 = c->vertex(i);
+  Vertex_handle v2 = c->vertex(j);
+  do {
+    // test whether the vertex of cc opposite to *fcirc
+    // is inside the sphere defined by the edge e = (s, i,j)
+    // It is necessary to fetch the offsets from the current cell.
+    Cell_handle cc = fcirc->first;
+    int i1 = cc->index(v1);
+    int i2 = cc->index(v2);
+    int i3 = fcirc->second;
+    Offset off1 = int_to_off(cc->offset(i1));
+    Offset off2 = int_to_off(cc->offset(i2));
+    Offset off3 = int_to_off(cc->offset(i3));
+    if (side_of_bounded_sphere(
+	    v1->point(), v2->point(), cc->vertex(fcirc->second)->point(),
+	    off1, off2, off3) == ON_BOUNDED_SIDE ) return false;
+  } while(++fcirc != fdone);
+  return true;
+}
+
+template < class Gt, class Tds >
+bool
+Periodic_3_Delaunay_triangulation_3<Gt,Tds>::
+is_valid(bool verbose, int level) const
+{ 
+  if (!Base::is_valid(verbose, level)) {
+    if (verbose)
+      std::cerr << "Delaunay: invalid base" << std::endl;
+    return false;
+  }
+
+  Conflict_tester tester(this);
+  if (!is_valid_conflict(tester, verbose, level)) {
+    if (verbose)
+      std::cerr << "Delaunay: conflict problems" << std::endl;
+    return false;
+  }
+
+  if (verbose)
+    std::cerr << "Delaunay valid triangulation" << std::endl;
+  return true;
+}
+
+template < class GT, class TDS >
+bool
+Periodic_3_Delaunay_triangulation_3<GT,TDS>::
+is_valid(Cell_handle ch, bool verbose, int level) const {
+  bool error = false;
+  if (!Base::is_valid(ch, verbose, level)) {
+    error = true;
+    if (verbose) {
+      std::cerr << "geometrically invalid cell" << std::endl;
+      for (int i=0; i<4; i++ )
+	std::cerr << ch->vertex(i)->point() << ", ";
+      std::cerr << std::endl;
+    }
+  }
+  for (Vertex_iterator vit = vertices_begin(); vit != vertices_end(); ++ vit) {
+    for (int i=-1; i<=1; i++)
+      for (int j=-1; j<=1; j++)
+	for (int k=-1; k<=1; k++) {
+	  if (periodic_point(ch,0) == std::make_pair(periodic_point(vit).first,
+		  periodic_point(vit).second+Offset(i,j,k))
+	  || periodic_point(ch,1) == std::make_pair(periodic_point(vit).first,
+		  periodic_point(vit).second+Offset(i,j,k))
+          || periodic_point(ch,2) == std::make_pair(periodic_point(vit).first,
+		  periodic_point(vit).second+Offset(i,j,k))
+	  || periodic_point(ch,3) == std::make_pair(periodic_point(vit).first,
+                  periodic_point(vit).second+Offset(i,j,k)) )
+	    continue;
+	  if (_side_of_sphere(ch, periodic_point(vit).first,
+		  periodic_point(vit).second+Offset(i,j,k),true)
+	      != ON_UNBOUNDED_SIDE) {
+	    error = true;
+	    if (verbose) {
+	      std::cerr << "Delaunay invalid cell" << std::endl;
+	      for (int i=0; i<4; i++ ) {
+		Periodic_point pp = periodic_point(ch,i);
+		std::cerr <<"("<<pp.first <<","<<pp.second<< "), ";
+	      }
+	      std::cerr << std::endl;
+	    }
+	  }
+	}
+  }
+  return !error;
+}
+
+template < class GT, class Tds >
+class Periodic_3_Delaunay_triangulation_3<GT,Tds>::Conflict_tester
+{
+  // stores a pointer to the triangulation,
+  // a point, and an offset
+  const Self *t;
+  Point p;
+  // stores the offset of a point in 27-cover
+  mutable Offset o;
+
+public:
+  /// Constructor
+  Conflict_tester(const Self *_t) : t(_t), p(Point()) {}
+  Conflict_tester(const Point &pt, const Self *_t) : t(_t), p(pt) { }
+  
+  /** The functor
+    *
+    * gives true if the circumcircle of c contains p
+    */
+  bool operator()(const Cell_handle c, const Offset &off) const {
+    return (t->_side_of_sphere(c, p, t->combine_offsets(o, off), true)
+        == ON_BOUNDED_SIDE);
+  }
+
+  bool operator()(const Cell_handle c, const Point& pt,
+      const Offset &off) const {
+    return (t->_side_of_sphere(c, pt, o + off, true) == ON_BOUNDED_SIDE);
+  }
+  
+  int compare_weight(Point, Point) const
+  {
+    return 0;
+  }
+  
+  bool test_initial_cell(Cell_handle c, const Offset &off) const
+  {
+    if (!(operator()(c, off)))
+      CGAL_triangulation_assertion(false);
+    return true;
+  }
+  
+  void set_point(const Point &_p) {
+    p = _p;
+  }
+
+  void set_offset(const Offset &off) const {
+    o = off;
+  }
+  
+  const Offset &get_offset() const {
+    return o;
+  }
+  
+  const Point &point() const {
+    return p;
+  }
+  
+};
+
+template < class GT, class Tds>
+class Periodic_3_Delaunay_triangulation_3<GT,Tds>::Point_hider
+{
+public:
+  Point_hider() {}
+
+  template <class InputIterator>
+  inline void set_vertices(InputIterator, InputIterator) const {}
+  inline void reinsert_vertices(Vertex_handle ) {}
+  inline Vertex_handle replace_vertex(Cell_handle c, int index,
+                                      const Point &) {
+    return c->vertex(index);
+  }
+  inline void hide_point(Cell_handle, const Point &) {}
+
+  inline void hide(Point &, Cell_handle ) const {
+    CGAL_triangulation_assertion(false);
+  }
+
+  inline void do_hide(const Point &, Cell_handle ) const {
+    CGAL_triangulation_assertion(false);
+  }
+  template < class Tester > 
+  inline bool replace_vertex(const Point &, Vertex_handle ,
+      const Tester &) const {
+    return true;
+  }
+  template <class Conflict_tester>
+  inline void hide_points(Vertex_handle,
+      const Conflict_tester &) {
+    // No points to hide in the Delaunay triangulation.
+  }
+
+};
+
+#ifndef CGAL_CFG_OUTOFLINE_TEMPLATE_MEMBER_DEFINITION_BUG 
+template <class GT, class Tds>
+template <class TriangulationR3>
+struct Periodic_3_Delaunay_triangulation_3<GT,Tds>::Vertex_remover
+{
+  typedef TriangulationR3      Triangulation_R3;
+  
+  typedef typename std::vector<Point>::iterator Hidden_points_iterator;
+  
+  typedef Triple < Vertex_handle, Vertex_handle, Vertex_handle > Vertex_triple;
+  
+  typedef typename Triangulation_R3::Triangulation_data_structure TDSE;
+  typedef typename Triangulation_R3::Cell_handle        CellE_handle;
+  typedef typename Triangulation_R3::Vertex_handle      VertexE_handle;
+  typedef typename Triangulation_R3::Facet              FacetE;
+  typedef typename Triangulation_R3::Finite_cells_iterator Finite_cellsE_iterator;
+    
+  typedef Triple< VertexE_handle, VertexE_handle, VertexE_handle >
+  VertexE_triple;
+  
+  typedef std::map<Vertex_triple,Facet> Vertex_triple_Facet_map;
+  typedef std::map<Vertex_triple, FacetE> Vertex_triple_FacetE_map;
+  typedef typename Vertex_triple_FacetE_map::iterator
+  Vertex_triple_FacetE_map_it;
+  
+  Vertex_remover(const Self *t, Triangulation_R3 &tmp_) : _t(t),tmp(tmp_) {}
+    
+  const Self *_t;
+  Triangulation_R3 &tmp;
+    
+  void add_hidden_points(Cell_handle) {
+    std::copy (hidden_points_begin(), hidden_points_end(), 
+	std::back_inserter(hidden));
+  }
+  
+  Hidden_points_iterator hidden_points_begin() {
+    return hidden.begin();
+  }
+  Hidden_points_iterator hidden_points_end() {
+    return hidden.end();
+  }
+  //private:
+  // The removal of v may un-hide some points,
+  // Space functions output them.
+  std::vector<Point> hidden;
+};
+#endif //CGAL_CFG_OUTOFLINE_TEMPLATE_MEMBER_DEFINITION_BUG
+
+} //namespace CGAL
+
+#endif // CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_3_H
diff --git a/3rdparty/CGAL/include/CGAL/Periodic_3_Delaunay_triangulation_filtered_traits_3.h b/3rdparty/CGAL/include/CGAL/Periodic_3_Delaunay_triangulation_filtered_traits_3.h
new file mode 100644
index 0000000..5700f2c
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Periodic_3_Delaunay_triangulation_filtered_traits_3.h
@@ -0,0 +1,33 @@
+// Copyright (c) 2004,2006-2009   INRIA Sophia-Antipolis (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
+// 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(s)     : Sylvain Pion <Sylvain.Pion at sophia.inria.fr>
+//                 Nico Kruithof <Nico.Kruithof at sophia.inria.fr>
+//                 Manuel Caroli <Manuel.Caroli at sophia.inria.fr>
+
+
+#ifndef CGAL_PERIODIC_3_TRIANGULATION_FILTERED_TRAITS_3_H
+#define CGAL_PERIODIC_3_TRIANGULATION_FILTERED_TRAITS_3_H
+
+#define CGAL_DEPRECATED_HEADER "<CGAL/Periodic_3_Delaunay_triangulation_filtered_traits_3.h>"
+#define CGAL_REPLACEMENT_HEADER "<CGAL/Periodic_3_Delaunay_triangulation_traits_3.h>"
+#include <CGAL/internal/deprecation_warning.h>
+
+#include <CGAL/internal/Periodic_3_Delaunay_triangulation_filtered_traits_3.h>
+
+#endif // CGAL_PERIODIC_3_TRIANGULATION_FILTERED_TRAITS_3_H
diff --git a/3rdparty/CGAL/include/CGAL/Periodic_3_Delaunay_triangulation_traits_3.h b/3rdparty/CGAL/include/CGAL/Periodic_3_Delaunay_triangulation_traits_3.h
new file mode 100644
index 0000000..cab4c0e
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Periodic_3_Delaunay_triangulation_traits_3.h
@@ -0,0 +1,145 @@
+// Copyright (c) 2006-2009   INRIA Sophia-Antipolis (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
+// 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(s)     : Nico Kruithof <Nico.Kruithof at sophia.inria.fr>
+//                 Manuel Caroli <Manuel.Caroli at sophia.inria.fr>
+
+#ifndef CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_TRAITS_3_H
+#define CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_TRAITS_3_H
+
+#include <CGAL/basic.h>
+#include <CGAL/Periodic_3_offset_3.h>
+#include <CGAL/Traits_with_offsets_adaptor.h>
+#include <CGAL/Periodic_3_construct_point_3.h>
+#include <CGAL/triangulation_assertions.h>
+#include <CGAL/internal/Has_boolean_tags.h>
+#include <CGAL/Periodic_3_triangulation_traits_3.h>
+
+
+namespace CGAL { 
+
+template < class Kernel, class Off = typename CGAL::Periodic_3_offset_3 >
+class Periodic_3_Delaunay_triangulation_traits_base_3
+  : public Periodic_3_triangulation_traits_base_3<Kernel, Off>
+{
+public:
+  typedef Kernel                                                 K;
+  typedef Off                                                    Offset;
+  typedef Periodic_3_triangulation_traits_base_3<K, Offset>               Base;
+  typedef Periodic_3_Delaunay_triangulation_traits_base_3< K, Offset >    Self;
+
+  typedef typename Base::RT                   RT;
+  typedef typename Base::FT                   FT;
+  typedef typename Base::Point_3              Point_3;
+  typedef typename Base::Vector_3             Vector_3;
+  typedef typename Base::Periodic_3_offset_3  Periodic_3_offset_3;
+  typedef typename Base::Iso_cuboid_3         Iso_cuboid_3;
+
+  // The next typedef is there for backward compatibility
+  // Some users take their point type from the traits class.
+  // Before this type was Point
+  typedef Point_3 Point;
+
+  typedef typename Base::Segment_3         Segment_3;
+  typedef typename Base::Triangle_3        Triangle_3;
+  typedef typename Base::Tetrahedron_3     Tetrahedron_3;
+
+  // Delaunay specific predicates
+  typedef Traits_with_offsets_adaptor<Self,
+				      typename K::Side_of_oriented_sphere_3>
+      Side_of_oriented_sphere_3;
+  typedef Traits_with_offsets_adaptor<Self, typename K::Compare_distance_3>
+      Compare_distance_3;
+   typedef Traits_with_offsets_adaptor<Self,
+ 				      typename K::Side_of_bounded_sphere_3>
+       Side_of_bounded_sphere_3;
+
+  // Degenerate dimension predicates
+  typedef Traits_with_offsets_adaptor<Self, typename K::Coplanar_orientation_3>
+      Coplanar_orientation_3;
+  typedef Traits_with_offsets_adaptor<Self,
+              typename K::Coplanar_side_of_bounded_circle_3>
+      Coplanar_side_of_bounded_circle_3;
+
+  // Delaunay specific constructions
+  typedef Traits_with_offsets_adaptor<Self,
+				      typename K::Construct_circumcenter_3>
+      Construct_circumcenter_3;
+
+  // Operations
+  Side_of_oriented_sphere_3
+  side_of_oriented_sphere_3_object() const {
+    return Side_of_oriented_sphere_3(&this->_domain);
+  }
+  Compare_distance_3
+  compare_distance_3_object() const {
+    return Compare_distance_3(&this->_domain);
+  }
+  Side_of_bounded_sphere_3
+  side_of_bounded_sphere_3_object() const {
+    return Side_of_bounded_sphere_3(&this->_domain);
+  }
+  Coplanar_orientation_3
+  coplanar_orientation_3_object() const {
+    return Coplanar_orientation_3(&this->_domain);
+  }
+  Coplanar_side_of_bounded_circle_3
+  coplanar_side_of_bounded_circle_3_object() const {
+    return Coplanar_side_of_bounded_circle_3(&this->_domain);
+  }
+  Construct_circumcenter_3
+  construct_circumcenter_3_object() const {
+    return Construct_circumcenter_3(&this->_domain);
+  }
+};
+
+template < typename K,
+           typename Off = CGAL::Periodic_3_offset_3,
+           bool Has_filtered_predicates = internal::Has_filtered_predicates<K>::value >
+class Periodic_3_Delaunay_triangulation_traits_3;
+
+} //namespace CGAL
+
+// Partial specialization for kernels with filtered predicates
+#include <CGAL/internal/Periodic_3_Delaunay_triangulation_filtered_traits_3.h>
+
+namespace CGAL {
+
+// This declaration is needed to break the cyclic dependency.
+template < typename K, typename Off, bool Has_static_filters >
+class Periodic_3_Delaunay_triangulation_filtered_traits_3;
+
+template < class K, class Off>
+class Periodic_3_Delaunay_triangulation_traits_3<K, Off, false>
+  : public Periodic_3_Delaunay_triangulation_traits_base_3<K, Off>
+{
+public:
+  typedef K Kernel;
+};
+
+template < typename K, typename Off >
+class Periodic_3_Delaunay_triangulation_traits_3 <K, Off, true>
+  : public Periodic_3_Delaunay_triangulation_filtered_traits_3 < K, Off, internal::Has_static_filters<K>::value >
+{
+public:
+  typedef K Kernel;
+};
+
+} //namespace CGAL
+
+#endif // CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_TRAITS_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Periodic_3_construct_point_3.h b/3rdparty/CGAL/include/CGAL/Periodic_3_construct_point_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Periodic_3_construct_point_3.h
rename to 3rdparty/CGAL/include/CGAL/Periodic_3_construct_point_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Periodic_3_offset_3.h b/3rdparty/CGAL/include/CGAL/Periodic_3_offset_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Periodic_3_offset_3.h
rename to 3rdparty/CGAL/include/CGAL/Periodic_3_offset_3.h
diff --git a/3rdparty/CGAL/include/CGAL/Periodic_3_triangulation_3.h b/3rdparty/CGAL/include/CGAL/Periodic_3_triangulation_3.h
new file mode 100644
index 0000000..7e07efe
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Periodic_3_triangulation_3.h
@@ -0,0 +1,4141 @@
+// Copyright (c) 1999-2003,2006-2009   INRIA Sophia-Antipolis (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
+// 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(s)     : Monique Teillaud <Monique.Teillaud at sophia.inria.fr>
+//                 Sylvain Pion <Sylvain.Pion at sophia.inria.fr>
+//                 Nico Kruithof <Nico.Kruithof at sophia.inria.fr>
+//                 Manuel Caroli <Manuel.Caroli at sophia.inria.fr>
+
+#ifndef CGAL_PERIODIC_3_TRIANGULATION_3_H
+#define CGAL_PERIODIC_3_TRIANGULATION_3_H
+
+#include <CGAL/basic.h>
+
+#include <iostream>
+#include <algorithm>
+#include <cmath>
+#include <functional>
+#include <list>
+
+#include <boost/tuple/tuple.hpp>
+#include <boost/random/linear_congruential.hpp>
+#include <boost/random/uniform_smallint.hpp>
+#include <boost/random/variate_generator.hpp>
+
+#include <CGAL/triangulation_assertions.h>
+#include <CGAL/use.h>
+
+#include <CGAL/Triangulation_data_structure_3.h>
+#include <CGAL/Periodic_3_triangulation_ds_cell_base_3.h>
+#include <CGAL/Periodic_3_triangulation_ds_vertex_base_3.h>
+#include <CGAL/Triangulation_cell_base_3.h>
+#include <CGAL/Triangulation_vertex_base_3.h>
+
+#include <CGAL/Periodic_3_triangulation_iterators_3.h>
+
+#include <CGAL/Unique_hash_map.h>
+
+#include <CGAL/internal/Exact_type_selector.h>
+#include <CGAL/NT_converter.h>
+
+#ifndef CGAL_NO_STRUCTURAL_FILTERING
+#include <CGAL/Triangulation_structural_filtering_traits.h>
+#include <CGAL/determinant.h>
+#endif // no CGAL_NO_STRUCTURAL_FILTERING
+
+namespace CGAL {
+
+template < class GT, class TDS > class Periodic_3_triangulation_3;
+
+template < class GT, class TDS > std::istream& operator>> 
+    (std::istream& is, Periodic_3_triangulation_3<GT,TDS> &tr);
+template < class GT, class TDS > std::ostream& operator<< 
+    (std::ostream& os, const Periodic_3_triangulation_3<GT,TDS> &tr);
+
+#ifndef CGAL_NO_STRUCTURAL_FILTERING
+namespace internal {
+// structural filtering is performed only for EPIC
+struct Periodic_structural_filtering_3_tag {};
+struct No_periodic_structural_filtering_3_tag {};
+
+template <bool filter>
+struct Periodic_structural_filtering_selector_3 {
+#ifdef FORCE_STRUCTURAL_FILTERING
+  typedef Periodic_structural_filtering_3_tag  Tag;
+#else
+  typedef No_periodic_structural_filtering_3_tag  Tag;
+#endif
+};
+
+template <>
+struct Periodic_structural_filtering_selector_3<true> {
+  typedef Periodic_structural_filtering_3_tag  Tag;
+};
+}
+#endif // no CGAL_NO_STRUCTURAL_FILTERING
+
+/**\class Periodic_3_triangulation_3
+ * 
+ * \brief Implements functionality for computing in periodic space.
+ *
+ * There are several things that are special to computing in $\mathbb{T}^3$
+ * such as
+ * - periodicity --> offsets
+ * - no infinite vertex
+ * - no degenerate dimensions
+ * All functions that are affected can be found in this class. In case it is
+ * necessary to provide different implementations for Delaunay and regular
+ * triangulation, we work with visitors. 
+ */
+
+template < class GT,
+            class TDS = Triangulation_data_structure_3 <
+	      Triangulation_vertex_base_3<
+		GT, Periodic_3_triangulation_ds_vertex_base_3<>
+		>,
+              Triangulation_cell_base_3<
+                GT, Periodic_3_triangulation_ds_cell_base_3<>
+              >
+            >
+          >
+class Periodic_3_triangulation_3 
+  : public Triangulation_utils_3
+{
+  friend std::istream& operator>> <>
+  (std::istream& is, Periodic_3_triangulation_3<GT, TDS> &tr);
+
+  typedef Periodic_3_triangulation_3<GT,TDS>   Self;
+
+public:
+  typedef GT                                   Geometric_traits;
+  typedef TDS                                  Triangulation_data_structure;
+
+  typedef typename GT::Periodic_3_offset_3     Offset;
+  typedef typename GT::Iso_cuboid_3            Iso_cuboid;
+  typedef array<int, 3>                        Covering_sheets;
+  
+  typedef typename GT::Point_3                 Point;
+  typedef typename GT::Segment_3               Segment;
+  typedef typename GT::Triangle_3              Triangle;
+  typedef typename GT::Tetrahedron_3           Tetrahedron;
+
+  typedef std::pair<Point,Offset>              Periodic_point;
+  typedef array< std::pair<Point,Offset>, 2>   Periodic_segment;
+  typedef array< std::pair<Point,Offset>, 3>   Periodic_triangle;
+  typedef array< std::pair<Point,Offset>, 4>   Periodic_tetrahedron;
+
+  typedef typename TDS::Vertex                 Vertex;
+  typedef typename TDS::Cell                   Cell;
+  typedef typename TDS::Facet                  Facet;
+  typedef typename TDS::Edge                   Edge;
+
+  typedef typename TDS::Vertex_handle          Vertex_handle;
+  typedef typename TDS::Cell_handle            Cell_handle;
+  
+  typedef typename TDS::size_type              size_type;
+  typedef typename TDS::difference_type        difference_type;
+
+  typedef typename TDS::Cell_iterator          Cell_iterator;
+  typedef typename TDS::Facet_iterator         Facet_iterator;
+  typedef typename TDS::Edge_iterator          Edge_iterator;
+  typedef typename TDS::Vertex_iterator        Vertex_iterator;
+
+  typedef typename TDS::Cell_circulator        Cell_circulator;
+  typedef typename TDS::Facet_circulator       Facet_circulator;
+
+  typedef Cell_iterator                        All_cells_iterator;
+  typedef Facet_iterator                       All_facets_iterator;
+  typedef Edge_iterator                        All_edges_iterator;
+  typedef Vertex_iterator                      All_vertices_iterator;
+  typedef Periodic_3_triangulation_unique_vertex_iterator_3<Self>
+                                               Unique_vertex_iterator;
+
+private:
+  typedef typename GT::FT                      FT;
+  typedef std::pair< Vertex_handle, Offset >   Virtual_vertex;
+  typedef std::map<Vertex_handle, Virtual_vertex>
+                                               Virtual_vertex_map;
+  typedef typename Virtual_vertex_map::const_iterator
+                                               Virtual_vertex_map_it;
+  typedef std::map<Vertex_handle, std::vector<Vertex_handle > >
+                                               Virtual_vertex_reverse_map;
+  typedef typename Virtual_vertex_reverse_map::const_iterator
+                                               Virtual_vertex_reverse_map_it;
+  typedef Triple< Vertex_handle, Vertex_handle, Vertex_handle >
+                                               Vertex_triple;
+
+public:
+  typedef Periodic_3_triangulation_tetrahedron_iterator_3<Self>
+                                               Periodic_tetrahedron_iterator;
+  typedef Periodic_3_triangulation_triangle_iterator_3<Self>
+                                               Periodic_triangle_iterator;
+  typedef Periodic_3_triangulation_segment_iterator_3<Self>
+                                               Periodic_segment_iterator;
+  typedef Periodic_3_triangulation_point_iterator_3<Self>
+                                               Periodic_point_iterator;
+
+  typedef Point                                value_type;
+  typedef const value_type&                    const_reference;
+
+  typedef Tag_false Weighted_tag;
+
+public:
+  enum Iterator_type {
+    STORED=0,
+    UNIQUE, //1
+    STORED_COVER_DOMAIN, //2
+    UNIQUE_COVER_DOMAIN };//3
+
+  enum Locate_type {
+    VERTEX=0, 
+    EDGE, //1
+    FACET, //2
+    CELL, //3
+    EMPTY , //4
+    OUTSIDE_CONVEX_HULL, // unused, for compatibility with Alpha_shape_3
+    OUTSIDE_AFFINE_HULL }; // unused, for compatibility with Alpha_shape_3
+
+private:
+  Geometric_traits  _gt;
+  Triangulation_data_structure _tds; 
+  Iso_cuboid _domain;
+  /// This threshold should be chosen such that if all edges are shorter,
+  /// we can be sure that there are no self-edges anymore.
+  FT edge_length_threshold;
+  
+  /// This adjacency list stores all edges that are longer than
+  /// edge_length_threshold.
+  std::map< Vertex_handle, std::list<Vertex_handle> > too_long_edges;
+  unsigned int too_long_edge_counter;
+  
+  /// map of offsets for periodic copies of vertices
+  Virtual_vertex_map virtual_vertices;
+  Virtual_vertex_reverse_map  virtual_vertices_reverse;
+
+protected:
+  /// v_offsets temporarily stores all the vertices on the border of a
+  /// conflict region.
+  mutable std::vector<Vertex_handle> v_offsets;
+
+private:
+  /// Determines if we currently compute in 3-cover or 1-cover.
+  Covering_sheets _cover;
+
+public:
+  /** @name Creation */ //@{
+  Periodic_3_triangulation_3(
+      const Iso_cuboid & domain = Iso_cuboid(0,0,0,1,1,1),
+      const Geometric_traits & gt = Geometric_traits())
+    : _gt(gt), _tds(), _domain(domain), too_long_edge_counter(0) {
+    _gt.set_domain(_domain);
+    typedef typename internal::Exact_field_selector<FT>::Type EFT;
+    typedef NT_converter<FT,EFT> NTC;
+    CGAL_USE_TYPE(NTC);
+    CGAL_triangulation_precondition_code( NTC ntc; )
+    CGAL_triangulation_precondition(ntc(_domain.xmax())-ntc(_domain.xmin())
+	== ntc(_domain.ymax())-ntc(_domain.ymin()));
+    CGAL_triangulation_precondition(ntc(_domain.ymax())-ntc(_domain.ymin())
+	== ntc(_domain.zmax())-ntc(_domain.zmin()));
+    CGAL_triangulation_precondition(ntc(_domain.zmax())-ntc(_domain.zmin())
+	== ntc(_domain.xmax())-ntc(_domain.xmin()));
+    _cover = make_array(3,3,3);
+    init_tds();
+    edge_length_threshold = FT(0.166) * (_domain.xmax()-_domain.xmin())
+                                      * (_domain.xmax()-_domain.xmin());
+  }
+
+private:
+  // Copy constructor helpers
+  class Finder;
+  void copy_multiple_covering(const Periodic_3_triangulation_3 & tr);
+public:
+  // Copy constructor duplicates vertices and cells
+  Periodic_3_triangulation_3(const Periodic_3_triangulation_3 & tr)
+    : _gt(tr.geom_traits()),
+      _domain(tr._domain),
+      edge_length_threshold(tr.edge_length_threshold),
+      _cover(tr._cover) {
+    if (is_1_cover()) {
+      _tds = tr.tds();
+    } else {
+      copy_multiple_covering(tr);
+    }
+    CGAL_triangulation_expensive_postcondition(*this == tr);
+  }
+  
+  /** @name Assignment */ //@{
+  Periodic_3_triangulation_3 & operator=(Periodic_3_triangulation_3 tr) {
+    swap(tr);
+    return *this;
+  }
+  
+  void swap(Periodic_3_triangulation_3 &tr) {
+    std::swap(tr._gt, _gt);
+    _tds.swap(tr._tds);
+    std::swap(_domain,tr._domain);
+    std::swap(edge_length_threshold,tr.edge_length_threshold);
+    std::swap(too_long_edges,tr.too_long_edges);
+    std::swap(too_long_edge_counter,tr.too_long_edge_counter);
+    std::swap(virtual_vertices,tr.virtual_vertices);
+    std::swap(virtual_vertices_reverse,tr.virtual_vertices_reverse);
+    std::swap(_cover, tr._cover);
+  }
+
+  /// Clears the triangulation and initializes it again.
+  void clear() {
+    _tds.clear();
+    init_tds();
+    too_long_edges.clear();
+    too_long_edge_counter = 0;
+    virtual_vertices.clear();
+    virtual_vertices_reverse.clear();
+    _cover = make_array(3,3,3);
+    v_offsets.clear();
+  }
+  //@}
+
+private:
+  /// Initializes the triangulation data structure
+  void init_tds() {
+    _tds.set_dimension(-2);
+    v_offsets.reserve(48);
+  }
+
+public:
+  /** @name Access functions */ //@{
+  const Geometric_traits& geom_traits() const { return _gt; }
+  const TDS & tds() const { return _tds; }
+  TDS & tds() { return _tds; }
+
+  const Iso_cuboid & domain() const { return _domain; }
+  // TODO: Documentation and tests
+  void set_domain(const Iso_cuboid & domain) {
+    clear();
+    _domain = domain;
+    _gt.set_domain(domain);
+    edge_length_threshold = FT(0.166) * (_domain.xmax()-_domain.xmin())
+                                      * (_domain.xmax()-_domain.xmin());
+  }
+
+  const Covering_sheets & number_of_sheets() const { return _cover; }
+  const std::pair<Vertex_handle, Offset> original_vertex(
+      const Vertex_handle v) const {
+    return (virtual_vertices.find(v) == virtual_vertices.end()) ?
+      std::make_pair(v,Offset()) : virtual_vertices.find(v)->second;
+  }
+  const std::vector<Vertex_handle>& periodic_copies(
+      const Vertex_handle v) const {
+    CGAL_triangulation_precondition(number_of_sheets() != make_array(1,1,1) );
+    CGAL_triangulation_precondition(
+	virtual_vertices.find(v) == virtual_vertices.end());
+    CGAL_triangulation_assertion(
+	virtual_vertices_reverse.find(v) != virtual_vertices_reverse.end());
+    return virtual_vertices_reverse.find(v)->second;
+  }
+
+  bool is_extensible_triangulation_in_1_sheet_h1() const;
+  bool is_extensible_triangulation_in_1_sheet_h2() const;
+  bool is_triangulation_in_1_sheet() const;
+
+  void convert_to_1_sheeted_covering();
+  void convert_to_27_sheeted_covering();
+
+  size_type number_of_cells() const {
+    if (is_1_cover()) return _tds.number_of_cells();
+    else return _tds.number_of_cells()/27;
+  }
+  size_type number_of_facets() const {
+    if (is_1_cover()) return _tds.number_of_facets();
+    else return _tds.number_of_facets()/27;
+  }
+  size_type number_of_edges() const {
+    if (is_1_cover()) return _tds.number_of_edges();
+    else return _tds.number_of_edges()/27;
+  }
+  size_type number_of_vertices() const {
+    if (is_1_cover()) return _tds.number_of_vertices();
+    else return _tds.number_of_vertices()/27;
+  }
+
+  size_type number_of_stored_cells() const {
+    return _tds.number_of_cells();
+  }
+  size_type number_of_stored_facets() const {
+    return _tds.number_of_facets();
+  }
+  size_type number_of_stored_edges() const {
+    return _tds.number_of_edges();
+  }
+  size_type number_of_stored_vertices() const {
+    return _tds.number_of_vertices();
+  }
+
+protected:
+  bool is_1_cover() const {
+    bool flag;
+    flag = ((_cover[0] == 1) && (_cover[1] == 1) && (_cover[2] == 1));
+    return flag;
+  }
+
+public:
+  bool is_virtual(Vertex_handle v) {
+    if (is_1_cover()) return false;
+    return (virtual_vertices.find(v) != virtual_vertices.end());
+  }
+
+public:
+  // Offset converters
+  int off_to_int(const Offset & off) const {
+    CGAL_triangulation_assertion( off.x()==0 || off.x() ==1 );
+    CGAL_triangulation_assertion( off.y()==0 || off.y() ==1 );
+    CGAL_triangulation_assertion( off.z()==0 || off.z() ==1 );
+    int i = ((off.x()&1)<<2) + ((off.y()&1)<<1) + ((off.z()&1));
+    return i;
+  }
+  Offset int_to_off(int i) const {
+    return Offset((i>>2)&1,(i>>1)&1,i&1);
+  }
+
+
+  void set_offsets(Cell_handle c, int o0,int o1,int o2,int o3) {
+    int off0[3] = {(o0>>2)&1,(o0>>1)&1,(o0&1)};
+    int off1[3] = {(o1>>2)&1,(o1>>1)&1,(o1&1)};
+    int off2[3] = {(o2>>2)&1,(o2>>1)&1,(o2&1)};
+    int off3[3] = {(o3>>2)&1,(o3>>1)&1,(o3&1)};
+    for (int i=0; i<3; i++) {
+      int min_off = (std::min)((std::min)(off0[i],off1[i]),
+			       (std::min)(off2[i],off3[i]));
+      if (min_off != 0) {
+	off0[i] -= min_off; off1[i] -= min_off;
+	off2[i] -= min_off; off3[i] -= min_off;
+      }
+    }
+    o0 = ((off0[0]&1)<<2)+((off0[1]&1)<<1)+(off0[2]&1);
+    o1 = ((off1[0]&1)<<2)+((off1[1]&1)<<1)+(off1[2]&1);
+    o2 = ((off2[0]&1)<<2)+((off2[1]&1)<<1)+(off2[2]&1);
+    o3 = ((off3[0]&1)<<2)+((off3[1]&1)<<1)+(off3[2]&1);
+    c->set_offsets(o0,o1,o2,o3);
+  }
+ 
+  template <class Offset> 
+  void set_offsets(Cell_handle c, Offset o0,Offset o1,Offset o2,Offset o3) {
+    int off0[3] = {o0.x(),o0.y(),o0.z()};
+    int off1[3] = {o1.x(),o1.y(),o1.z()};
+    int off2[3] = {o2.x(),o2.y(),o2.z()};
+    int off3[3] = {o3.x(),o3.y(),o3.z()};
+    for (int i=0; i<3; i++) {
+      int min_off = (std::min)((std::min)(off0[i],off1[i]),
+			       (std::min)(off2[i],off3[i]));
+      if (min_off != 0) {
+	off0[i] -= min_off; off1[i] -= min_off;
+	off2[i] -= min_off; off3[i] -= min_off;
+      }
+    }
+
+    CGAL_triangulation_assertion((std::min)((std::min)(off0[0],off1[0]),
+			      (std::min)(off2[0],off3[0])) == 0);
+    CGAL_triangulation_assertion((std::min)((std::min)(off0[1],off1[1]),
+			      (std::min)(off2[1],off3[1])) == 0);
+    CGAL_triangulation_assertion((std::min)((std::min)(off0[2],off1[2]),
+			      (std::min)(off2[2],off3[2])) == 0);
+    CGAL_triangulation_assertion((0 <= off0[0]) && (off0[0] < 2));
+    CGAL_triangulation_assertion((0 <= off1[0]) && (off1[0] < 2));
+    CGAL_triangulation_assertion((0 <= off2[0]) && (off2[0] < 2));
+    CGAL_triangulation_assertion((0 <= off3[0]) && (off3[0] < 2));
+    CGAL_triangulation_assertion((0 <= off0[1]) && (off0[1] < 2));
+    CGAL_triangulation_assertion((0 <= off1[1]) && (off1[1] < 2));
+    CGAL_triangulation_assertion((0 <= off2[1]) && (off2[1] < 2));
+    CGAL_triangulation_assertion((0 <= off3[1]) && (off3[1] < 2));
+    CGAL_triangulation_assertion((0 <= off0[2]) && (off0[2] < 2));
+    CGAL_triangulation_assertion((0 <= off1[2]) && (off1[2] < 2));
+    CGAL_triangulation_assertion((0 <= off2[2]) && (off2[2] < 2));
+    CGAL_triangulation_assertion((0 <= off3[2]) && (off3[2] < 2));
+
+    int o0i = ((off0[0]&1)<<2)+((off0[1]&1)<<1)+(off0[2]&1);
+    int o1i = ((off1[0]&1)<<2)+((off1[1]&1)<<1)+(off1[2]&1);
+    int o2i = ((off2[0]&1)<<2)+((off2[1]&1)<<1)+(off2[2]&1);
+    int o3i = ((off3[0]&1)<<2)+((off3[1]&1)<<1)+(off3[2]&1);
+    c->set_offsets(o0i,o1i,o2i,o3i);
+  }
+
+public:
+  /** @name Wrapping the traits */ //@{
+  Comparison_result compare_xyz(const Point &p1, const Point &p2) const {
+    return geom_traits().compare_xyz_3_object()(p1,p2);
+  }
+  Comparison_result compare_xyz(const Point &p1, const Point&p2,
+      const Offset &o1, const Offset &o2) const {
+    return geom_traits().compare_xyz_3_object()(p1,p2,o1,o2);
+  }
+
+  Orientation orientation(
+      const Point &p1, const Point &p2, const Point &p3, const Point &p4)
+      const {
+    return geom_traits().orientation_3_object()(p1,p2,p3,p4);
+  }
+  Orientation orientation(
+      const Point &p1, const Point &p2, const Point &p3, const Point &p4,
+      const Offset &o1, const Offset &o2, const Offset &o3, const Offset &o4)
+      const {
+    return geom_traits().orientation_3_object()(p1,p2,p3,p4,o1,o2,o3,o4);
+  }
+
+  bool equal(const Point &p1, const Point &p2) const {
+    return compare_xyz(p1,p2) == EQUAL;
+  }
+  bool equal(const Point &p1, const Point &p2,
+      const Offset &o1, const Offset &o2) const {
+    return compare_xyz(p1,p2,o1,o2) == EQUAL;
+  }
+
+  bool coplanar(
+      const Point &p1, const Point &p2, const Point &p3, const Point &p4)
+      const {
+    return orientation(p1,p2,p3,p4) == COPLANAR;
+  }
+  bool coplanar(
+      const Point &p1, const Point &p2, const Point &p3, const Point &p4,
+      const Offset &o1, const Offset &o2, const Offset &o3, const Offset &o4)
+      const {
+    return orientation(p1,p2,p3,p4,o1,o2,o3,o4) == COPLANAR;
+  }
+
+  Periodic_tetrahedron construct_periodic_3_tetrahedron(
+      const Point &p1, const Point &p2, const Point &p3, const Point &p4)
+      const {
+    return make_array(std::make_pair(p1,Offset()), std::make_pair(p2,Offset()),
+	std::make_pair(p3,Offset()), std::make_pair(p4,Offset()));
+  }
+  Periodic_tetrahedron construct_periodic_3_tetrahedron(
+      const Point &p1, const Point &p2, const Point &p3, const Point &p4,
+      const Offset &o1, const Offset &o2, const Offset &o3, const Offset &o4)
+      const {
+    return make_array(std::make_pair(p1,o1), std::make_pair(p2,o2),
+	std::make_pair(p3,o3), std::make_pair(p4,o4));
+  }
+
+  Periodic_triangle construct_periodic_3_triangle(
+      const Point &p1, const Point &p2, const Point &p3) const {
+    return make_array(std::make_pair(p1,Offset()),
+	std::make_pair(p2,Offset()), std::make_pair(p3,Offset()));
+  }
+  Periodic_triangle construct_periodic_3_triangle(
+      const Point &p1, const Point &p2, const Point &p3,
+      const Offset &o1, const Offset &o2, const Offset &o3) const {
+    return make_array(std::make_pair(p1,o1), std::make_pair(p2,o2),
+	std::make_pair(p3,o3));
+  }
+
+  Periodic_segment construct_periodic_3_segment(
+      const Point &p1, const Point &p2) const {
+    return make_array(std::make_pair(p1,Offset()), std::make_pair(p2,Offset()));
+  }
+  Periodic_segment construct_periodic_3_segment(
+      const Point &p1, const Point &p2,
+      const Offset &o1, const Offset &o2) const {
+    return make_array(std::make_pair(p1,o1), std::make_pair(p2,o2));
+  }
+
+  Tetrahedron construct_tetrahedron(
+      const Point &p1, const Point &p2, const Point &p3, const Point &p4)
+      const {
+    return geom_traits().construct_tetrahedron_3_object()(p1,p2,p3,p4);
+  }
+  Tetrahedron construct_tetrahedron(
+      const Point &p1, const Point &p2, const Point &p3, const Point &p4,
+      const Offset &o1, const Offset &o2, const Offset &o3, const Offset &o4)
+      const {
+    return geom_traits().construct_tetrahedron_3_object()(p1,p2,p3,p4,
+	o1,o2,o3,o4);
+  }
+  Tetrahedron construct_tetrahedron(const Periodic_tetrahedron& tet) {
+    return construct_tetrahedron(
+	tet[0].first, tet[1].first, tet[2].first, tet[3].first,
+	tet[0].second, tet[1].second, tet[2].second, tet[3].second);
+  }
+
+  Triangle construct_triangle(
+      const Point &p1, const Point &p2, const Point &p3) const {
+    return geom_traits().construct_triangle_3_object()(p1,p2,p3);
+  }
+  Triangle construct_triangle(
+      const Point &p1, const Point &p2, const Point &p3,
+      const Offset &o1, const Offset &o2, const Offset &o3) const {
+    return geom_traits().construct_triangle_3_object()(p1,p2,p3,o1,o2,o3);
+  }
+  Triangle construct_triangle(const Periodic_triangle& tri) {
+    return construct_triangle(tri[0].first, tri[1].first, tri[2].first,
+       tri[0].second, tri[1].second, tri[2].second);
+  }
+
+  Segment construct_segment(const Point &p1, const Point &p2) const {
+    return geom_traits().construct_segment_3_object()(p1, p2);
+  }
+  Segment construct_segment(const Point &p1, const Point &p2,
+    const Offset &o1, const Offset &o2) const {
+    return geom_traits().construct_segment_3_object()(p1,p2,o1,o2);
+  }
+  Segment construct_segment(const Periodic_segment& seg) const {
+    return construct_segment(seg[0].first, seg[1].first,
+	seg[0].second, seg[1].second);
+  }
+
+  Point construct_point(const Point& p, const Offset &o) const {
+    return geom_traits().construct_point_3_object()(p,o);
+  }
+  Point construct_point(const Periodic_point& pp) const {
+    return construct_point(pp.first, pp.second);
+  }
+  //@}
+
+public:
+  /** @name Geometric access functions */ //@{
+  Periodic_point periodic_point( const Vertex_handle v ) const {
+    if (is_1_cover()) return std::make_pair(v->point(), Offset(0,0,0));
+    Virtual_vertex_map_it it = virtual_vertices.find(v);
+    if (it == virtual_vertices.end()) {
+      // if v is not contained in virtual_vertices, then it is in the
+      // original domain.
+      return std::make_pair(v->point(), Offset(0,0,0));
+    } else {
+      // otherwise it has to be looked up as well as its offset.
+      return std::make_pair(it->second.first->point(), it->second.second);
+    }
+  }
+  Periodic_point periodic_point( const Cell_handle c, int i) const {
+    if (is_1_cover()) return std::make_pair(c->vertex(i)->point(),
+					    int_to_off(c->offset(i)));
+    Virtual_vertex_map_it it = virtual_vertices.find(c->vertex(i));
+    if (it == virtual_vertices.end()) {
+      // if c->vertex(i) is not contained in virtual_vertices, then it
+      // is in the original domain.
+      return std::make_pair(c->vertex(i)->point(), 
+	  combine_offsets(Offset(),int_to_off(c->offset(i))) );
+    } else {
+      // otherwise it has to be looked up as well as its offset.
+      return std::make_pair(it->second.first->point(),
+	  combine_offsets(it->second.second, int_to_off(c->offset(i))) );
+    }
+  }
+
+  Periodic_segment periodic_segment(const Cell_handle c, int i, int j) const {
+    CGAL_triangulation_precondition( i != j );
+    CGAL_triangulation_precondition( number_of_vertices() != 0 );
+    CGAL_triangulation_precondition( i >= 0 && i <= 3 
+        && j >= 0 && j <= 3 );
+    return make_array( std::make_pair(c->vertex(i)->point(),
+				      get_offset(c,i)),
+		       std::make_pair(c->vertex(j)->point(),
+				      get_offset(c,j)) );
+  }
+  Periodic_segment periodic_segment(const Edge & e) const {
+    return periodic_segment(e.first,e.second,e.third);
+  }
+
+  Periodic_triangle periodic_triangle(const Cell_handle c, int i) const;
+  Periodic_triangle periodic_triangle(const Facet & f) const {
+    return periodic_triangle(f.first, f.second);
+  }
+
+  Periodic_tetrahedron periodic_tetrahedron(const Cell_handle c) const {
+    CGAL_triangulation_precondition( number_of_vertices() != 0 );
+    return make_array(
+        std::make_pair(c->vertex(0)->point(), get_offset(c,0)),
+	std::make_pair(c->vertex(1)->point(), get_offset(c,1)),
+        std::make_pair(c->vertex(2)->point(), get_offset(c,2)),
+	std::make_pair(c->vertex(3)->point(), get_offset(c,3)) );
+  }
+
+  Point point(const Periodic_point & pp) const {
+    return construct_point(pp.first, pp.second);
+  }
+  Segment segment(const Periodic_segment & ps) const {
+    return construct_segment(ps[0].first,ps[1].first,ps[0].second,ps[1].second);
+  }
+  Triangle triangle(const Periodic_triangle & pt) const {
+    return construct_triangle(pt[0].first, pt[1].first, pt[2].first,
+			      pt[0].second,pt[1].second,pt[2].second);
+  }
+  Tetrahedron tetrahedron(const Periodic_tetrahedron & pt) const {
+    return construct_tetrahedron(pt[0].first, pt[1].first,
+				 pt[2].first, pt[3].first,
+				 pt[0].second,pt[1].second,
+				 pt[2].second,pt[3].second);
+  }
+  // @}
+
+  /** @name Queries */ //@{
+  bool is_vertex(const Point & p, Vertex_handle & v) const;
+
+  bool is_vertex(Vertex_handle v) const {
+    return _tds.is_vertex(v);
+  }
+  bool is_edge(Vertex_handle u, Vertex_handle v,
+      Cell_handle & c, int & i, int & j) const {
+    return _tds.is_edge(u, v, c, i, j);
+  }
+  bool is_edge(Vertex_handle u, const Offset & off_u,
+	       Vertex_handle v, const Offset & off_v,
+      Cell_handle & c, int & i, int & j) const {
+    if (!_tds.is_edge(u,v,c,i,j)) return false;
+    if ((get_offset(c,i) == off_u) && (get_offset(c,j) == off_v))
+      return true;
+    // it might be that different cells containing (u,v) yield
+    // different offsets, which forces us to test for all possibilities.
+    else {
+      Cell_circulator ccirc = incident_cells(c,i,j,c);
+      while (++ccirc != c) {
+	i = ccirc->index(u);
+	j = ccirc->index(v);
+	if ((get_offset(ccirc,i) == off_u) && (get_offset(ccirc,j) == off_v)) {
+	  c = ccirc;
+	  return true;
+	}
+      }
+      return false;
+    }
+  }
+  bool is_facet(Vertex_handle u, Vertex_handle v, Vertex_handle w,
+      Cell_handle & c, int & i, int & j, int & k) const {
+    return _tds.is_facet(u, v, w, c, i, j, k);
+  }
+  bool is_facet(Vertex_handle u, const Offset & off_u,
+		Vertex_handle v, const Offset & off_v,
+		Vertex_handle w, const Offset & off_w,
+      Cell_handle & c, int & i, int & j, int & k) const {
+    if (!_tds.is_facet(u,v,w,c,i,j,k)) return false;
+    if ((get_offset(c,i) == off_u)
+	&& (get_offset(c,j) == off_v)
+	&& (get_offset(c,k) == off_w) )
+      return true;
+    // it might be that c and c->neighbor(l) yield different offsets
+    // which forces us to test for both possibilities.
+    else {
+      int l = 6-i-j-k;
+      c = c->neighbor(l);
+      i = c->index(u);
+      j = c->index(v);
+      k = c->index(w);      
+      return ((get_offset(c,i) == off_u)
+	  && (get_offset(c,j) == off_v)
+	  && (get_offset(c,k) == off_w) );
+    }
+  }
+  bool is_cell(Cell_handle c) const {
+    return _tds.is_cell(c);
+  }
+  bool is_cell(Vertex_handle u, Vertex_handle v,
+      Vertex_handle w, Vertex_handle t,
+      Cell_handle & c, int & i, int & j, int & k, int & l) const {
+    return _tds.is_cell(u, v, w, t, c, i, j, k, l);
+  }
+  bool is_cell(Vertex_handle u, Vertex_handle v, Vertex_handle w,
+      Vertex_handle t, Cell_handle & c) const {
+    int i,j,k,l;
+    return _tds.is_cell(u, v, w, t, c, i, j, k, l);
+  }
+  bool is_cell(Vertex_handle u, const Offset & off_u,
+	       Vertex_handle v, const Offset & off_v,
+	       Vertex_handle w, const Offset & off_w,
+	       Vertex_handle t, const Offset & off_t,
+      Cell_handle & c, int & i, int & j, int & k, int & l) const {
+    if (!_tds.is_cell(u,v,w,t,c,i,j,k,l)) return false;
+    return ((get_offset(c,i) == off_u)
+	    && (get_offset(c,j) == off_v)
+	    && (get_offset(c,k) == off_w)
+	    && (get_offset(c,l) == off_t) );
+    return false;
+  }
+  bool is_cell(Vertex_handle u, const Offset & off_u,
+	       Vertex_handle v, const Offset & off_v,
+	       Vertex_handle w, const Offset & off_w,
+	       Vertex_handle t, const Offset & off_t,
+	       Cell_handle & c) const {
+    int i, j, k, l;
+    return is_cell(u,off_u,v,off_v,w,off_w,t,off_t,c,i,j,k,l);
+  }
+
+  bool has_vertex(const Facet & f, Vertex_handle v, int & j) const {
+    return _tds.has_vertex(f.first, f.second, v, j);
+  }
+  bool has_vertex(Cell_handle c, int i, Vertex_handle v, int & j) const {
+    return _tds.has_vertex(c, i, v, j);
+  }
+  bool has_vertex(const Facet & f, Vertex_handle v) const {
+    return _tds.has_vertex(f.first, f.second, v);
+  }
+  bool has_vertex(Cell_handle c, int i, Vertex_handle v) const {
+    return _tds.has_vertex(c, i, v);
+  }
+  
+  bool are_equal(Cell_handle c, int i, Cell_handle n, int j) const {
+    return _tds.are_equal(c, i, n, j);
+  }
+  bool are_equal(const Facet & f, const Facet & g) const {
+    return _tds.are_equal(f.first, f.second, g.first, g.second);
+  }
+  bool are_equal(const Facet & f, Cell_handle n, int j) const {
+    return _tds.are_equal(f.first, f.second, n, j);
+  }
+  //@}
+
+#ifdef CGAL_NO_STRUCTURAL_FILTERING
+  Cell_handle
+  periodic_locate(const Point & p, const Offset &o_p,
+	 Locate_type & lt, int & li, int & lj,
+	 Cell_handle start = Cell_handle()) const;
+#else // no CGAL_NO_STRUCTURAL_FILTERING
+#  ifndef CGAL_PT3_STRUCTURAL_FILTERING_MAX_VISITED_CELLS
+#    define CGAL_PT3_STRUCTURAL_FILTERING_MAX_VISITED_CELLS 2500
+#  endif // no CGAL_PT3_STRUCTURAL_FILTERING_MAX_VISITED_CELLS
+
+public:
+  Cell_handle
+  inexact_periodic_locate(const Point& p, const Offset &o_p,
+                 Cell_handle start = Cell_handle(),
+                 int max_num_cells = CGAL_PT3_STRUCTURAL_FILTERING_MAX_VISITED_CELLS) const;
+protected:
+  Cell_handle
+  exact_periodic_locate(const Point& p, const Offset &o_p,
+               Locate_type& lt,
+               int& li, int & lj,
+               Cell_handle start) const;
+
+  Cell_handle
+  generic_periodic_locate(const Point& p, const Offset &o_p,
+                 Locate_type& lt,
+                 int& li, int & lj,
+                 Cell_handle start,
+                 internal::Periodic_structural_filtering_3_tag) const {
+    return exact_periodic_locate(p, o_p, lt, li, lj, inexact_periodic_locate(p, o_p, start));
+  }
+
+  Cell_handle
+  generic_periodic_locate(const Point& p, const Offset &o_p,
+                 Locate_type& lt,
+                 int& li, int & lj,
+                 Cell_handle start,
+                 internal::No_periodic_structural_filtering_3_tag) const {
+    return exact_periodic_locate(p, o_p, lt, li, lj, start);
+  }
+
+  Orientation
+  inexact_orientation(const Point &p, const Point &q,
+                      const Point &r, const Point &s) const
+  {
+    const double px = to_double(p.x());
+    const double py = to_double(p.y());
+    const double pz = to_double(p.z());
+    const double qx = to_double(q.x());
+    const double qy = to_double(q.y());
+    const double qz = to_double(q.z());
+    const double rx = to_double(r.x());
+    const double ry = to_double(r.y());
+    const double rz = to_double(r.z());
+    const double sx = to_double(s.x());
+    const double sy = to_double(s.y());
+    const double sz = to_double(s.z());
+
+    const double pqx = qx - px;
+    const double pqy = qy - py;
+    const double pqz = qz - pz;
+    const double prx = rx - px;
+    const double pry = ry - py;
+    const double prz = rz - pz;
+    const double psx = sx - px;
+    const double psy = sy - py;
+    const double psz = sz - pz;
+
+    const double det = determinant(pqx, pqy, pqz,
+                                   prx, pry, prz,
+                                   psx, psy, psz);
+    if (det > 0) return POSITIVE;
+    if (det < 0) return NEGATIVE;
+    return ZERO;
+  }
+
+  Orientation
+  inexact_orientation(const Point &p, const Point &q,
+                      const Point &r, const Point &s,
+                      const Offset& o_p, const Offset& o_q,
+                      const Offset& o_r, const Offset& o_s) const
+  {
+    return inexact_orientation(construct_point(p, o_p),
+        construct_point(q, o_q),
+        construct_point(r, o_r),
+        construct_point(s, o_s));
+  }
+
+public:
+
+  Cell_handle
+  periodic_locate(const Point & p, const Offset &o_p,
+         Locate_type & lt, int & li, int & lj,
+         Cell_handle start = Cell_handle()) const
+  {
+    typedef Triangulation_structural_filtering_traits<Geometric_traits> TSFT;
+    typedef typename internal::Periodic_structural_filtering_selector_3<
+      TSFT::Use_structural_filtering_tag::value >::Tag Should_filter_tag;
+
+    return generic_periodic_locate(p, o_p, lt, li, lj, start, Should_filter_tag());
+  }
+
+  Cell_handle
+  inexact_locate(const Point& p,
+                 Cell_handle start = Cell_handle(),
+                 int max_num_cells = CGAL_PT3_STRUCTURAL_FILTERING_MAX_VISITED_CELLS) const
+  {
+	  return inexact_periodic_locate(p, Offset(), start, max_num_cells);
+  }
+#endif // no CGAL_NO_STRUCTURAL_FILTERING
+
+protected:
+  /** @name Location helpers */ //@{
+//  Cell_handle periodic_locate(const Point & p, const Offset &o_p,
+//    Locate_type & lt, int & li, int & lj, Cell_handle start) const;
+
+  Bounded_side side_of_cell(const Point & p, const Offset &off,
+      Cell_handle c, Locate_type & lt, int & i, int & j) const;
+  //@}
+  
+public:
+  /** @name Point Location */ //@{
+  /** Wrapper function for locate if only the request point is given.
+    */
+  Cell_handle locate(const Point & p, Cell_handle start=Cell_handle()) const {
+    Locate_type lt;
+    int li, lj;
+    return locate( p, lt, li, lj, start);
+  }
+  
+  /** Wrapper function calling locate with an empty offset if there was no
+    * offset given.
+    */
+  Cell_handle locate(const Point & p, Locate_type & lt, int & li, int & lj,
+      Cell_handle start = Cell_handle()) const {
+    return periodic_locate(p, Offset(), lt, li, lj, start);
+  }
+
+  Bounded_side side_of_cell(const Point & p,
+      Cell_handle c, Locate_type & lt, int & i, int & j) const {
+    if (number_of_vertices() == 0) {
+      lt = EMPTY;
+      return ON_UNBOUNDED_SIDE;
+    }
+    return side_of_cell(p,Offset(),c,lt,i,j);
+  }
+  //@}
+
+private:
+  /** @name Insertion helpers */ //@{
+  template <class CellIt>
+  void insert_too_long_edges(Vertex_handle v,
+      const CellIt begin, const CellIt end);
+
+  template <class CellIt>
+  void delete_too_long_edges(const CellIt begin, const CellIt end);
+
+  template < class Conflict_tester, class Point_hider >
+  Vertex_handle periodic_insert(const Point& p, const Offset& o, Locate_type lt,
+      Cell_handle c, const Conflict_tester &tester,
+      Point_hider &hider, Vertex_handle vh = Vertex_handle());
+
+  template <class Point_iterator, class Offset_iterator>
+  void periodic_sort(Point_iterator /*p_begin*/, Point_iterator /*p_end*/,
+                     Offset_iterator /*o_begin*/, Offset_iterator /*o_end*/) const {
+    std::cout << "Periodic_sort not yet implemented" << std::endl;
+  }
+
+  Vertex_handle create_initial_triangulation(const Point &p);
+public:
+  std::vector<Vertex_handle> insert_dummy_points();
+  
+protected:
+  // this is needed for compatibility reasons
+  template <class Conflict_test, class OutputIteratorBoundaryFacets,
+      class OutputIteratorCells, class OutputIteratorInternalFacets>
+  Triple<OutputIteratorBoundaryFacets, OutputIteratorCells,
+         OutputIteratorInternalFacets>
+  find_conflicts(Cell_handle c,
+      const Conflict_test &tester,
+      Triple<OutputIteratorBoundaryFacets, OutputIteratorCells,
+      OutputIteratorInternalFacets> it) const {
+    Offset off = get_location_offset(tester, c);
+    return find_conflicts(c,off,tester,it);
+  }
+
+  template <class Conflict_test, class OutputIteratorBoundaryFacets,
+      class OutputIteratorCells, class OutputIteratorInternalFacets>
+  Triple<OutputIteratorBoundaryFacets, OutputIteratorCells,
+         OutputIteratorInternalFacets>
+  find_conflicts(Cell_handle c, const Offset &current_off,
+      const Conflict_test &tester,
+      Triple<OutputIteratorBoundaryFacets, OutputIteratorCells,
+      OutputIteratorInternalFacets> it) const;
+  //@}
+  
+protected:
+  // COMMON INSERTION for DELAUNAY and REGULAR TRIANGULATION
+  template < class Conflict_tester, class Point_hider >
+  Vertex_handle insert_in_conflict(const Point & p, Cell_handle start,
+      const Conflict_tester &tester, Point_hider &hider) {
+    Locate_type lt = Locate_type();
+    int li=0, lj=0;
+    Cell_handle c = periodic_locate(p, Offset(), lt, li, lj, start);
+    return insert_in_conflict(p,lt,c,li,lj,tester,hider);
+  }
+
+  template < class Conflict_tester, class Point_hider >
+  Vertex_handle insert_in_conflict(const Point & p, Locate_type lt,
+    Cell_handle c, int li, int lj, const Conflict_tester &tester,
+    Point_hider &hider);
+
+  template < class InputIterator, class Conflict_tester,
+      class Point_hider>
+  std::vector<Vertex_handle> insert_in_conflict(
+      InputIterator begin, InputIterator end, Cell_handle start,
+      Conflict_tester &tester, Point_hider &hider) {
+    Vertex_handle new_vertex;
+    std::vector<Vertex_handle> double_vertices;
+    Locate_type lt = Locate_type();
+    int li=0, lj=0;
+    CGAL_triangulation_assertion_code( Locate_type lta = Locate_type(); )
+    CGAL_triangulation_assertion_code( int ia = 0; )
+    CGAL_triangulation_assertion_code( int ja = 0; )
+    Cell_handle hint;
+    while (begin!=end) {
+      tester.set_point(*begin);
+      hint = periodic_locate(*begin, Offset(), lt, li, lj, start);
+      CGAL_triangulation_assertion_code( if (number_of_vertices() != 0) { );
+	CGAL_triangulation_assertion(side_of_cell(
+		*begin,Offset(), hint, lta, ia, ja) != ON_UNBOUNDED_SIDE);
+	CGAL_triangulation_assertion(lta == lt);
+	CGAL_triangulation_assertion(ia == li);
+	CGAL_triangulation_assertion(ja == lj);
+      CGAL_triangulation_assertion_code( } );
+
+      new_vertex = insert_in_conflict(*begin,lt,hint,li,lj,tester,hider);
+      if (lt == VERTEX) double_vertices.push_back(new_vertex);
+      start = new_vertex->cell();
+      begin++;
+    }
+    return double_vertices;
+  }
+  //@}
+
+private:
+  /** @name Removal helpers */ //@{
+  Vertex_triple make_vertex_triple(const Facet& f) const {
+    Cell_handle ch = f.first;
+    int i = f.second;
+    return Vertex_triple(ch->vertex(vertex_triple_index(i,0)),
+        ch->vertex(vertex_triple_index(i,1)),
+        ch->vertex(vertex_triple_index(i,2))); 
+  }
+
+  void make_canonical(Vertex_triple& t) const;
+
+  void make_hole(Vertex_handle v, std::map<Vertex_triple,Facet> &outer_map,
+      std::vector<Cell_handle> &hole);
+
+  template < class PointRemover >
+  void periodic_remove(Vertex_handle v, PointRemover &remover); 
+  //@}
+  
+protected:
+  /** @name Removal */ //@{
+  template < class PointRemover, class CT >
+  void remove(Vertex_handle v, PointRemover &remover, CT &ct);
+  //@}
+
+public:
+  /** @name Traversal */ //@{
+  Cell_iterator cells_begin() const {
+    return _tds.cells_begin();
+  }
+  Cell_iterator cells_end() const {
+    return _tds.cells_end();
+  }
+
+  Vertex_iterator vertices_begin() const {
+    return _tds.vertices_begin();
+  }
+  Vertex_iterator vertices_end() const {
+    return _tds.vertices_end();
+  }
+
+  Edge_iterator edges_begin() const {
+    return _tds.edges_begin();
+  }
+  Edge_iterator edges_end() const {
+    return _tds.edges_end();
+  }
+
+  Facet_iterator facets_begin() const {
+    return _tds.facets_begin();
+  }
+  Facet_iterator facets_end() const {
+    return _tds.facets_end();
+  }
+
+  Cell_iterator finite_cells_begin() const {
+    return _tds.cells_begin();
+  }
+  Cell_iterator finite_cells_end() const {
+    return _tds.cells_end();
+  }
+
+  Vertex_iterator finite_vertices_begin() const {
+    return _tds.vertices_begin();
+  }
+  Vertex_iterator finite_vertices_end() const {
+    return _tds.vertices_end();
+  }
+
+  Edge_iterator finite_edges_begin() const {
+    return _tds.edges_begin();
+  }
+  Edge_iterator finite_edges_end() const {
+    return _tds.edges_end();
+  }
+
+  Facet_iterator finite_facets_begin() const {
+    return _tds.facets_begin();
+  }
+  Facet_iterator finite_facets_end() const {
+    return _tds.facets_end();
+  }
+
+  All_cells_iterator all_cells_begin() const {
+    return _tds.cells_begin();
+  }
+  All_cells_iterator all_cells_end() const {
+    return _tds.cells_end();
+  }
+
+  All_vertices_iterator all_vertices_begin() const {
+    return _tds.vertices_begin();
+  }
+  All_vertices_iterator all_vertices_end() const {
+    return _tds.vertices_end();
+  }
+
+  All_edges_iterator all_edges_begin() const {
+    return _tds.edges_begin();
+  }
+  All_edges_iterator all_edges_end() const {
+    return _tds.edges_end();
+  }
+
+  All_facets_iterator all_facets_begin() const {
+    return _tds.facets_begin();
+  }
+  All_facets_iterator all_facets_end() const {
+    return _tds.facets_end();
+  }
+  
+  Unique_vertex_iterator unique_vertices_begin() const {
+    return CGAL::filter_iterator(vertices_end(), Domain_tester<Self>(this),
+	                         vertices_begin());
+  }
+  Unique_vertex_iterator unique_vertices_end() const {
+    return CGAL::filter_iterator(vertices_end(), Domain_tester<Self>(this));
+  }
+
+  // Geometric iterators
+  Periodic_tetrahedron_iterator periodic_tetrahedra_begin(
+      Iterator_type it = STORED) const {
+    return Periodic_tetrahedron_iterator(this, it);
+  }
+  Periodic_tetrahedron_iterator periodic_tetrahedra_end(
+      Iterator_type it = STORED) const {
+    return Periodic_tetrahedron_iterator(this, 1, it);
+  }
+
+  Periodic_triangle_iterator periodic_triangles_begin(
+      Iterator_type it = STORED) const {
+    return Periodic_triangle_iterator(this, it);
+  }
+  Periodic_triangle_iterator periodic_triangles_end(
+      Iterator_type it = STORED) const {
+    return Periodic_triangle_iterator(this, 1, it);
+  }
+
+  Periodic_segment_iterator periodic_segments_begin(
+      Iterator_type it = STORED) const {
+    return Periodic_segment_iterator(this, it);
+  }
+  Periodic_segment_iterator periodic_segments_end(
+      Iterator_type it = STORED) const {
+    return Periodic_segment_iterator(this, 1, it);
+  }
+
+  Periodic_point_iterator periodic_points_begin(
+      Iterator_type it = STORED) const {
+    return Periodic_point_iterator(this, it);
+  }
+  Periodic_point_iterator periodic_points_end(
+      Iterator_type it = STORED) const  {
+    return Periodic_point_iterator(this, 1, it);
+  }
+
+  // Circulators
+  Cell_circulator incident_cells(const Edge & e) const {
+    return _tds.incident_cells(e);
+  }
+  Cell_circulator incident_cells(Cell_handle c, int i, int j) const {
+    return _tds.incident_cells(c, i, j);
+  }
+  Cell_circulator incident_cells(const Edge & e, Cell_handle start) const {
+    return _tds.incident_cells(e, start);
+  }
+  Cell_circulator incident_cells(Cell_handle c, int i, int j, 
+      Cell_handle start) const {
+    return _tds.incident_cells(c, i, j, start);
+  }
+
+  Facet_circulator incident_facets(const Edge & e) const {
+    return _tds.incident_facets(e);
+  }
+  Facet_circulator incident_facets(Cell_handle c, int i, int j) const {
+    return _tds.incident_facets(c, i, j);
+  }
+  Facet_circulator incident_facets(const Edge & e, const Facet & start) const {
+    return _tds.incident_facets(e, start);
+  }
+  Facet_circulator incident_facets(Cell_handle c, int i, int j, 
+      const Facet & start) const {
+    return _tds.incident_facets(c, i, j, start);
+  }
+  Facet_circulator incident_facets(const Edge & e,
+      Cell_handle start, int f) const {
+    return _tds.incident_facets(e, start, f);
+  }
+  Facet_circulator incident_facets(Cell_handle c, int i, int j, 
+      Cell_handle start, int f) const {
+    return _tds.incident_facets(c, i, j, start, f);
+  }
+
+  // around a vertex
+  template <class OutputIterator>
+  OutputIterator incident_cells(Vertex_handle v, OutputIterator cells) const {
+    return _tds.incident_cells(v, cells);
+  }
+
+  template <class OutputIterator>
+  OutputIterator incident_facets(Vertex_handle v, OutputIterator facets) const {
+    return _tds.incident_facets(v, facets);
+  }
+
+  template <class OutputIterator>
+  OutputIterator incident_edges(
+      Vertex_handle v, OutputIterator edges) const {
+    return _tds.incident_edges(v, edges);
+  }
+
+  template <class OutputIterator>
+  OutputIterator adjacent_vertices(
+      Vertex_handle v, OutputIterator vertices) const {
+    return _tds.adjacent_vertices(v, vertices);
+  }
+
+  //deprecated, don't use anymore
+  template <class OutputIterator>
+  OutputIterator incident_vertices(
+      Vertex_handle v, OutputIterator vertices) const {
+    return _tds.adjacent_vertices(v, vertices);
+  }
+
+  size_type degree(Vertex_handle v) const {
+    return _tds.degree(v);
+  }
+
+  // Functions forwarded from TDS.
+  int mirror_index(Cell_handle c, int i) const {
+    return _tds.mirror_index(c, i);
+  }
+
+  Vertex_handle mirror_vertex(Cell_handle c, int i) const {
+    return _tds.mirror_vertex(c, i);
+  }
+
+  Facet mirror_facet(Facet f) const {
+    return _tds.mirror_facet(f);
+  }
+  //@}
+  
+private:
+  /** @name Checking helpers */ //@{
+  /// calls has_self_edges for every cell of the triangulation
+  bool has_self_edges() const {
+    Cell_iterator it;
+    for ( it = all_cells_begin(); it != all_cells_end(); ++it )
+      if (has_self_edges(it)) return true;
+    return false;
+  }
+  bool has_self_edges(Cell_handle c) const;
+  //@}
+  
+public:
+  /** @name Checking */ //@{
+  bool is_valid(bool verbose = false, int level = 0) const;
+  bool is_valid(Cell_handle c, bool verbose = false, int level = 0) const;
+protected:
+  template <class ConflictTester>
+  bool is_valid_conflict(ConflictTester &tester, bool verbose = false,
+      int level = 0) const;
+  //@}
+
+protected:
+  /** @name Functors */ //@{
+  template < class Cmp >
+  class Perturbation_order;
+  //@}
+
+public:
+  // undocumented access functions
+  Offset get_offset(Cell_handle ch, int i) const {
+    if (is_1_cover()) return int_to_off(ch->offset(i));
+    Virtual_vertex_map_it it = virtual_vertices.find(ch->vertex(i));
+    if (it != virtual_vertices.end())
+      return combine_offsets(it->second.second, int_to_off(ch->offset(i)));
+    else return combine_offsets(Offset(), int_to_off(ch->offset(i)));
+  }
+  Offset get_offset(Vertex_handle vh) const {
+    if (is_1_cover()) return Offset();
+    Virtual_vertex_map_it it = virtual_vertices.find(vh);
+    if (it != virtual_vertices.end()) return it->second.second;
+    else return Offset();
+  }
+  Vertex_handle get_original_vertex(Vertex_handle vh) const {
+    if (is_1_cover()) return vh;
+    Virtual_vertex_map_it it = virtual_vertices.find(vh);
+    if (it != virtual_vertices.end()) return it->second.first;
+    else return vh;
+  }
+  Offset combine_offsets(const Offset& o_c, const Offset& o_t) const {
+    Offset o_ct(_cover[0]*o_t.x(),_cover[1]*o_t.y(),_cover[2]*o_t.z());
+    return o_c + o_ct;
+  }
+
+  // These functions give the pair (vertex, offset) that corresponds to the
+  // i-th vertex of cell ch or vertex vh, respectively.
+  void get_vertex(Cell_handle ch, int i, Vertex_handle &vh, Offset &off) const;
+  void get_vertex(Vertex_handle vh_i, Vertex_handle &vh, Offset &off) const;
+
+protected:
+  // Auxiliary functions
+  int find_too_long_edges(std::map<Vertex_handle,
+      std::list<Vertex_handle> >& edges) const;
+  Cell_handle get_cell(const Vertex_handle* vh) const;
+  template<class Conflict_tester>
+  Offset get_location_offset(const Conflict_tester& tester,
+	  Cell_handle c) const;
+
+  Offset get_neighbor_offset(Cell_handle ch, int i, Cell_handle nb) const;
+  
+  /** @name Friends */ //@{
+  friend class Perturbation_order<typename GT::Compare_xyz_3>;
+  friend std::istream& operator>> <>
+      (std::istream& is, Periodic_3_triangulation_3<GT,TDS> &tr);
+  friend std::ostream& operator<< <>
+      (std::ostream& os, const Periodic_3_triangulation_3<GT,TDS> &tr);
+  //@}
+
+  // unused and undocumented function required to be compatible to
+  // Alpha_shape_3
+public:
+  Point point(Cell_handle c, int idx) const {
+    //    if (is_1_cover())
+      return point(periodic_point(c,idx));
+
+    Offset vec_off[4];
+    for (int i=0 ; i<4 ; i++) vec_off[i] = periodic_point(c,i).second;
+    int ox = vec_off[0].x();
+    int oy = vec_off[0].y();
+    int oz = vec_off[0].z();
+    for (int i=1 ; i<4 ; i++) {
+      ox = (std::min)(ox,vec_off[i].x());
+      oy = (std::min)(oy,vec_off[i].y());
+      oz = (std::min)(oz,vec_off[i].z());
+    }
+    Offset diff_off(-ox,-oy,-oz);
+    if (diff_off.is_null()) return point(periodic_point(c,idx));
+
+    for (unsigned int i=0 ; i<4 ; i++) vec_off[i] += diff_off;
+    Vertex_handle canonic_vh[4];
+    for (int i=0 ; i<4 ; i++) {
+      Virtual_vertex_map_it vvmit = virtual_vertices.find(c->vertex(i));
+      Vertex_handle orig_vh;
+      if (vvmit == virtual_vertices.end()) orig_vh = c->vertex(i);
+      else orig_vh = vvmit->second.first;
+      if (vec_off[i].is_null()) canonic_vh[i] = orig_vh;
+      else {
+	CGAL_assertion(virtual_vertices_reverse.find(orig_vh)
+	    != virtual_vertices_reverse.end());
+	canonic_vh[i] = virtual_vertices_reverse.find(orig_vh)
+	  ->second[9*vec_off[i][0]+3*vec_off[i][1]+vec_off[i][2]-1];
+      }
+    }
+    
+    std::vector<Cell_handle> cells;
+    incident_cells(canonic_vh[0], std::back_inserter(cells));
+    for (unsigned int i=0 ; i<cells.size() ; i++) {
+      CGAL_assertion(cells[i]->has_vertex(canonic_vh[0]));
+      if (cells[i]->has_vertex(canonic_vh[1])
+	  && cells[i]->has_vertex(canonic_vh[2])
+	  && cells[i]->has_vertex(canonic_vh[3]) )
+	return point(periodic_point(cells[i],cells[i]->index(canonic_vh[idx])));
+    }
+    CGAL_assertion(false);
+  return Point();
+  }
+};
+
+template < class GT, class TDS >
+inline void
+Periodic_3_triangulation_3<GT,TDS>::
+copy_multiple_covering(const Periodic_3_triangulation_3<GT,TDS> & tr) {  
+  // Write the respective offsets in the vertices to make them
+  // automatically copy with the tds.
+  for (Vertex_iterator vit = tr.vertices_begin() ;
+       vit != tr.vertices_end() ; ++vit) {
+    vit->set_offset(tr.get_offset(vit));
+  }
+  // copy the tds
+  _tds = tr.tds();
+  // make a list of all vertices that belong to the original
+  // domain and initialize the basic structure of
+  // virtual_vertices_reverse
+  std::list<Vertex_handle> vlist;
+  for (Vertex_iterator vit = vertices_begin() ;
+       vit != vertices_end() ; ++vit) {
+    if (vit->offset() == Offset()) {
+      vlist.push_back(vit);
+      virtual_vertices_reverse.insert(
+	  std::make_pair(vit,std::vector<Vertex_handle>(26)));
+      CGAL_triangulation_assertion(virtual_vertices_reverse.find(vit)
+	  ->second.size() == 26);
+    }
+  }     
+  // Iterate over all vertices that are not in the original domain
+  // and construct the respective entries to virtual_vertices and
+  // virtual_vertices_reverse
+  for (Vertex_iterator vit2 = vertices_begin() ;
+       vit2 != vertices_end() ; ++vit2) {
+    if (vit2->offset() != Offset()) {
+      //TODO: use some binding, maybe boost instead of the Finder.
+      typename std::list<Vertex_handle>::iterator vlist_it
+	= std::find_if(vlist.begin(), vlist.end(),
+		       Finder(this,vit2->point()));
+      Offset off = vit2->offset();
+      virtual_vertices.insert(std::make_pair(vit2,
+					     std::make_pair(*vlist_it,off)));
+      virtual_vertices_reverse.find(*vlist_it)
+	->second[9*off[0]+3*off[1]+off[2]-1]=vit2;
+      CGAL_triangulation_assertion(get_offset(vit2) == off);
+    }
+  }
+  // Cleanup vertex offsets
+  for (Vertex_iterator vit = vertices_begin() ;
+       vit != vertices_end() ; ++vit)
+    vit->clear_offset();
+  for (Vertex_iterator vit = tr.vertices_begin() ;
+       vit != tr.vertices_end() ; ++vit)
+    vit->clear_offset();
+  // Build up the too_long_edges container
+  too_long_edge_counter = 0;
+  too_long_edges.clear();
+  for (Vertex_iterator vit = vertices_begin() ;
+       vit != vertices_end() ; ++vit) 
+    too_long_edges[vit] = std::list<Vertex_handle>();
+  std::pair<Vertex_handle, Vertex_handle> edge_to_add;
+  Point p1,p2;
+  int i,j;
+  for (Edge_iterator eit = edges_begin() ;
+       eit != edges_end() ; ++eit) {
+    if (&*(eit->first->vertex(eit->second))
+	< &*(eit->first->vertex(eit->third))) {
+      i = eit->second; j = eit->third;
+    } else {
+      i = eit->third; j = eit->second;
+    }
+    edge_to_add = std::make_pair(eit->first->vertex(i),
+				 eit->first->vertex(j));
+    p1 = construct_point(eit->first->vertex(i)->point(),
+	get_offset(eit->first, i));
+    p2 = construct_point(eit->first->vertex(j)->point(),
+	get_offset(eit->first, j));
+    Vertex_handle v_no = eit->first->vertex(i);
+    if (squared_distance(p1,p2) > edge_length_threshold) {
+      CGAL_triangulation_assertion(
+	  find(too_long_edges[v_no].begin(),
+	       too_long_edges[v_no].end(),
+	       edge_to_add.second) == too_long_edges[v_no].end());
+      too_long_edges[v_no].push_back(edge_to_add.second);
+      too_long_edge_counter++;
+    }
+  }
+}
+
+template < class GT, class TDS >
+inline bool
+Periodic_3_triangulation_3<GT,TDS>::
+is_extensible_triangulation_in_1_sheet_h1() const {
+  if (!is_1_cover()) {
+    if (too_long_edge_counter == 0) return true;
+    else return false;
+  } else {
+    typename Geometric_traits::FT longest_edge_squared_length(0);
+    Segment s;
+    for (Periodic_segment_iterator psit = periodic_segments_begin(UNIQUE);
+ 	 psit != periodic_segments_end(UNIQUE) ; ++psit) {
+      s = construct_segment(*psit);
+      longest_edge_squared_length = (std::max)(longest_edge_squared_length,
+	  s.squared_length());
+    }
+    return (longest_edge_squared_length < edge_length_threshold);
+  }
+}
+
+template < class GT, class TDS >
+inline bool
+Periodic_3_triangulation_3<GT,TDS>::
+is_extensible_triangulation_in_1_sheet_h2() const {
+  typedef typename Geometric_traits::Construct_circumcenter_3
+    Construct_circumcenter;
+  typedef typename Geometric_traits::FT FT;
+  Construct_circumcenter construct_circumcenter
+    = _gt.construct_circumcenter_3_object();
+  for (Periodic_tetrahedron_iterator tit = periodic_tetrahedra_begin(UNIQUE) ;
+       tit != periodic_tetrahedra_end(UNIQUE) ; ++tit) {
+    Point cc = construct_circumcenter(
+	tit->at(0).first, tit->at(1).first,
+	tit->at(2).first, tit->at(3).first,
+	tit->at(0).second, tit->at(1).second,
+	tit->at(2).second, tit->at(3).second);
+
+    if ( !(FT(16)*squared_distance(cc,point(tit->at(0)))
+	    < (_domain.xmax()-_domain.xmin())*(_domain.xmax()-_domain.xmin())) )
+      return false;
+  }
+  return true;
+}
+
+template < class GT, class TDS >
+inline bool
+Periodic_3_triangulation_3<GT,TDS>::
+is_triangulation_in_1_sheet() const {
+  if (is_1_cover()) return true;
+  for (Vertex_iterator vit = vertices_begin(); vit != vertices_end(); ++vit) {
+    if (virtual_vertices.find(vit) == virtual_vertices.end()) continue;
+    std::vector<Vertex_handle> nb_v;
+    std::set<Vertex_handle> nb_v_odom;
+    Vertex_handle vh;
+    Offset off;
+    adjacent_vertices(vit, std::back_inserter(nb_v));
+    for (unsigned int i=0; i<nb_v.size(); i++) {
+      get_vertex(nb_v[i],vh,off);
+      nb_v_odom.insert(vh);
+    }
+    if (nb_v.size() != nb_v_odom.size()) 
+      return false;
+  }
+  return true;
+}
+
+template < class GT, class TDS >
+inline bool
+Periodic_3_triangulation_3<GT,TDS>::
+is_vertex(const Point & p, Vertex_handle & v) const
+{
+  Locate_type lt;
+  int li, lj;
+  Cell_handle c = locate( p, lt, li, lj );
+  if ( lt != VERTEX )
+    return false;
+  v = c->vertex(li);
+  return true;
+}
+
+template < class GT, class TDS >
+inline void
+Periodic_3_triangulation_3<GT,TDS>::
+make_canonical(Vertex_triple& t) const
+{
+  int i = (&*(t.first) < &*(t.second))? 0 : 1;
+  if(i==0) {
+    i = (&*(t.first) < &*(t.third))? 0 : 2;
+  } else {
+    i = (&*(t.second) < &*(t.third))? 1 : 2;
+  }
+  Vertex_handle tmp; 
+  switch(i){
+  case 0: return;
+  case 1:
+    tmp = t.first;
+    t.first = t.second;
+    t.second = t.third;
+    t.third = tmp;
+    return;
+  default:
+    tmp = t.first;
+    t.first = t.third;
+    t.third = t.second;
+    t.second = tmp;
+  }
+}
+
+template < class GT, class TDS >
+inline typename Periodic_3_triangulation_3<GT,TDS>::Periodic_triangle
+Periodic_3_triangulation_3<GT,TDS>::
+periodic_triangle(const Cell_handle c, int i) const
+{ 
+  CGAL_triangulation_precondition( number_of_vertices() != 0 );
+  CGAL_triangulation_precondition( i >= 0 && i <= 3 );
+  if ( (i&1)==0 ) 
+    return make_array(std::make_pair(c->vertex( (i+2)&3 )->point(),
+				     get_offset(c,(i+2)&3)),
+		      std::make_pair(c->vertex( (i+1)&3 )->point(),
+				     get_offset(c,(i+1)&3)),
+		      std::make_pair(c->vertex( (i+3)&3 )->point(),
+				     get_offset(c,(i+3)&3)) );
+  return make_array(std::make_pair(c->vertex( (i+1)&3 )->point(),
+				   get_offset(c,(i+1)&3)),
+		    std::make_pair(c->vertex( (i+2)&3 )->point(),
+				   get_offset(c,(i+2)&3)),
+		    std::make_pair(c->vertex( (i+3)&3 )->point(),
+				   get_offset(c,(i+3)&3)) );
+}
+
+/** Assumes a point, an offset, and a cell to start from.
+  * Gives the locate type and the simplex (cell and indices) containing p.
+  *
+  * Performs a remembering stochastic walk if the triangulation is not empty.
+  * After the walk the type of the simplex containing p is determined.
+  *
+  * returns the cell p lies in
+  * starts at cell "start"
+  * returns a cell Cell_handel if lt == CELL
+  * returns a facet (Cell_handle,li) if lt == FACET
+  * returns an edge (Cell_handle,li,lj) if lt == EDGE
+  * returns a vertex (Cell_handle,li) if lt == VERTEX
+  */
+template < class GT, class TDS >
+inline typename Periodic_3_triangulation_3<GT,TDS>::Cell_handle
+Periodic_3_triangulation_3<GT,TDS>::
+#ifdef CGAL_NO_STRUCTURAL_FILTERING
+periodic_locate
+#else
+exact_periodic_locate
+#endif
+(const Point & p, const Offset &o_p,
+    Locate_type & lt, int & li, int & lj, Cell_handle start) const {
+  int cumm_off = 0;
+  Offset off_query = o_p;
+  if (number_of_vertices() == 0) {
+    lt = EMPTY;
+    return Cell_handle();
+  }
+  CGAL_triangulation_assertion(number_of_vertices() != 0);
+
+  if (start == Cell_handle()) {
+    start = cells_begin();
+  }
+
+  cumm_off = start->offset(0) | start->offset(1)
+    | start->offset(2) | start->offset(3);
+  if (is_1_cover() && cumm_off != 0) {
+    if (((cumm_off & 4) == 4) && (FT(2)*p.x()<(_domain.xmax()+_domain.xmin())))
+      off_query += Offset(1,0,0);
+    if (((cumm_off & 2) == 2) && (FT(2)*p.y()<(_domain.ymax()+_domain.ymin())))
+      off_query += Offset(0,1,0);
+    if (((cumm_off & 1) == 1) && (FT(2)*p.z()<(_domain.zmax()+_domain.zmin())))
+      off_query += Offset(0,0,1);
+  }
+
+  CGAL_triangulation_postcondition(start!=Cell_handle());
+  CGAL_triangulation_assertion(start->neighbor(0)->neighbor(
+      start->neighbor(0)->index(start))==start);
+  CGAL_triangulation_assertion(start->neighbor(1)->neighbor(
+      start->neighbor(1)->index(start))==start);
+  CGAL_triangulation_assertion(start->neighbor(2)->neighbor(
+      start->neighbor(2)->index(start))==start);
+  CGAL_triangulation_assertion(start->neighbor(3)->neighbor(
+      start->neighbor(3)->index(start))==start);
+
+  // We implement the remembering visibility/stochastic walk.
+  
+  // Remembers the previous cell to avoid useless orientation tests.
+  Cell_handle previous = Cell_handle();
+  Cell_handle c = start;
+  
+  // Stores the results of the 4 orientation tests.  It will be used
+  // at the end to decide if p lies on a face/edge/vertex/interior.
+  Orientation o[4];
+  
+  boost::rand48 rng;      
+  boost::uniform_smallint<> four(0, 3);
+  boost::variate_generator<boost::rand48&, boost::uniform_smallint<> > die4(rng, four);
+
+  
+  // Now treat the cell c.
+try_next_cell:
+  // For the remembering stochastic walk,
+  // we need to start trying with a random index :
+  int i = die4();
+  // For the remembering visibility walk (Delaunay only), we don't :
+  // int i = 0;
+
+  cumm_off =
+    c->offset(0) | c->offset(1) | c->offset(2) | c->offset(3);
+
+  bool simplicity_criterion = (cumm_off == 0) && (off_query.is_null());
+
+  // We know that the 4 vertices of c are positively oriented.
+  // So, in order to test if p is seen outside from one of c's facets,
+  // we just replace the corresponding point by p in the orientation
+  // test.  We do this using the arrays below.
+
+  Offset off[4];
+  const Point* pts[4] = { &(c->vertex(0)->point()),
+      &(c->vertex(1)->point()),
+      &(c->vertex(2)->point()),
+      &(c->vertex(3)->point()) };
+
+  if (!simplicity_criterion && is_1_cover() ) {
+    for (int i=0; i<4; i++) {
+      off[i] = int_to_off(c->offset(i));
+    }
+  }
+  
+  if (!is_1_cover()) {
+    // Just fetch the vertices of c as points with offsets
+    for (int i=0; i<4; i++) {
+      pts[i] = &(c->vertex(i)->point());
+      off[i] = get_offset(c,i);
+    }
+  }
+  
+  for (int j=0; j != 4; ++j, i = (i+1)&3) {
+    Cell_handle next = c->neighbor(i);
+    if (previous == next) {
+      o[i] = POSITIVE;
+      continue;
+    }
+    
+    CGAL_triangulation_assertion(next->neighbor(next->index(c)) == c);
+    
+    // We temporarily put p at i's place in pts.
+    const Point* backup = pts[i];
+    pts[i] = &p;
+    
+    if (simplicity_criterion && is_1_cover() ) {
+      o[i] = orientation(*pts[0], *pts[1], *pts[2], *pts[3]);
+      
+      if ( o[i] != NEGATIVE ) {
+        pts[i] = backup;
+        continue;
+      }
+    }
+    else {
+      Offset backup_off;
+      
+      backup_off = off[i];
+      off[i] = off_query;
+      o[i] = orientation(*pts[0], *pts[1], *pts[2], *pts[3],
+          off[0], off[1], off[2], off[3]);
+
+      if ( o[i] != NEGATIVE ) {
+        pts[i] = backup;
+        off[i] = backup_off;
+        continue;
+      }
+    }
+
+    // Test whether we need to adapt the offset of the query point.
+    // This means, if we get out of the current cover.
+    off_query = combine_offsets(off_query, get_neighbor_offset(c,i,next));
+    previous = c;
+    c = next;
+    goto try_next_cell;
+  }
+
+  
+  // Ok, now we have found the cell. It remains to find the dimension of the
+  // intersected simplex.
+  // now p is in c or on its boundary
+  int sum = ( o[0] == COPLANAR )
+    + ( o[1] == COPLANAR )
+    + ( o[2] == COPLANAR )
+    + ( o[3] == COPLANAR );
+  switch (sum) {
+  case 0:
+      lt = CELL;
+      break;
+  case 1:
+      lt = FACET;
+      li = ( o[0] == COPLANAR ) ? 0 :
+          ( o[1] == COPLANAR ) ? 1 :
+          ( o[2] == COPLANAR ) ? 2 : 3;
+      break;
+  case 2:
+    lt = EDGE;
+    li = ( o[0] != COPLANAR ) ? 0 :
+        ( o[1] != COPLANAR ) ? 1 : 2;
+    lj = ( o[li+1] != COPLANAR ) ? li+1 :
+        ( o[li+2] != COPLANAR ) ? li+2 : li+3;
+    break;
+  case 3:
+    lt = VERTEX;
+    li = ( o[0] != COPLANAR ) ? 0 :
+        ( o[1] != COPLANAR ) ? 1 :
+        ( o[2] != COPLANAR ) ? 2 : 3;
+    break;
+  default:
+    // Vertex can not lie on four facets
+    CGAL_triangulation_assertion(false);
+  }
+  return c;
+}
+
+
+#ifndef CGAL_NO_STRUCTURAL_FILTERING
+template < class GT, class TDS >
+typename Periodic_3_triangulation_3<GT,TDS>::Cell_handle
+Periodic_3_triangulation_3<GT,TDS>::
+inexact_periodic_locate(const Point& p, const Offset& o_p,
+               Cell_handle start,
+               int n_of_turns) const
+{
+	int cumm_off = 0;
+	Offset off_query = o_p;
+	if (number_of_vertices() == 0) {
+		return Cell_handle();
+	}
+	CGAL_triangulation_assertion(number_of_vertices() != 0);
+
+	if (start == Cell_handle()) {
+		start = cells_begin();
+	}
+
+	cumm_off = start->offset(0) | start->offset(1)
+	    		| start->offset(2) | start->offset(3);
+	if (is_1_cover() && cumm_off != 0) {
+		if (((cumm_off & 4) == 4) && (FT(2)*p.x()<(_domain.xmax()+_domain.xmin())))
+			off_query += Offset(1,0,0);
+		if (((cumm_off & 2) == 2) && (FT(2)*p.y()<(_domain.ymax()+_domain.ymin())))
+			off_query += Offset(0,1,0);
+		if (((cumm_off & 1) == 1) && (FT(2)*p.z()<(_domain.zmax()+_domain.zmin())))
+			off_query += Offset(0,0,1);
+	}
+
+	CGAL_triangulation_postcondition(start!=Cell_handle());
+	CGAL_triangulation_assertion(start->neighbor(0)->neighbor(
+			start->neighbor(0)->index(start))==start);
+	CGAL_triangulation_assertion(start->neighbor(1)->neighbor(
+			start->neighbor(1)->index(start))==start);
+	CGAL_triangulation_assertion(start->neighbor(2)->neighbor(
+			start->neighbor(2)->index(start))==start);
+	CGAL_triangulation_assertion(start->neighbor(3)->neighbor(
+			start->neighbor(3)->index(start))==start);
+
+	// We implement the remembering visibility/stochastic walk.
+
+	// Remembers the previous cell to avoid useless orientation tests.
+	Cell_handle previous = Cell_handle();
+	Cell_handle c = start;
+
+	// Now treat the cell c.
+try_next_cell:
+  --n_of_turns;
+	cumm_off =
+			c->offset(0) | c->offset(1) | c->offset(2) | c->offset(3);
+
+	bool simplicity_criterion = (cumm_off == 0) && (off_query.is_null());
+
+	// We know that the 4 vertices of c are positively oriented.
+	// So, in order to test if p is seen outside from one of c's facets,
+	// we just replace the corresponding point by p in the orientation
+	// test.  We do this using the arrays below.
+
+	Offset off[4];
+	const Point* pts[4] = { &(c->vertex(0)->point()),
+			&(c->vertex(1)->point()),
+			&(c->vertex(2)->point()),
+			&(c->vertex(3)->point()) };
+
+	if (!simplicity_criterion && is_1_cover() ) {
+		for (int i=0; i<4; i++) {
+			off[i] = int_to_off(c->offset(i));
+		}
+	}
+
+	if (!is_1_cover()) {
+		// Just fetch the vertices of c as points with offsets
+		for (int i=0; i<4; i++) {
+			pts[i] = &(c->vertex(i)->point());
+			off[i] = get_offset(c,i);
+		}
+	}
+
+	for (int i=0; i != 4; ++i) {
+		Cell_handle next = c->neighbor(i);
+		if (previous == next) {
+			continue;
+		}
+
+		// We temporarily put p at i's place in pts.
+		const Point* backup = pts[i];
+		pts[i] = &p;
+
+		if (simplicity_criterion && is_1_cover() ) {
+			if ( inexact_orientation(*pts[0], *pts[1], *pts[2], *pts[3]) != NEGATIVE ) {
+				pts[i] = backup;
+				continue;
+			}
+		}
+		else {
+			Offset backup_off;
+
+			backup_off = off[i];
+			off[i] = off_query;
+
+			if ( inexact_orientation(*pts[0], *pts[1], *pts[2], *pts[3],
+					off[0], off[1], off[2], off[3]) != NEGATIVE ) {
+				pts[i] = backup;
+				off[i] = backup_off;
+				continue;
+			}
+		}
+
+		// Test whether we need to adapt the offset of the query point.
+		// This means, if we get out of the current cover.
+		off_query = combine_offsets(off_query, get_neighbor_offset(c,i,next));
+		previous = c;
+		c = next;
+		if (n_of_turns)
+		  goto try_next_cell;
+	}
+
+	return c;
+}
+#endif
+
+
+/**
+ * returns
+ * ON_BOUNDED_SIDE if p inside the cell
+ * (for an infinite cell this means that p lies strictly in the half space
+ * limited by its finite facet)
+ * ON_BOUNDARY if p on the boundary of the cell
+ * (for an infinite cell this means that p lies on the *finite* facet)
+ * ON_UNBOUNDED_SIDE if p lies outside the cell
+ * (for an infinite cell this means that p is not in the preceding
+ * two cases)
+ * 
+ * lt has a meaning only when ON_BOUNDED_SIDE or ON_BOUNDARY
+ */
+// TODO: currently off is not used. It could probably be optimized
+// using off.
+template < class GT, class TDS >
+inline Bounded_side Periodic_3_triangulation_3<GT,TDS>::side_of_cell(
+    const Point & q, const Offset &off, Cell_handle c,
+    Locate_type & lt, int & i, int & j) const
+{
+  CGAL_triangulation_precondition( number_of_vertices() != 0 );
+
+  Orientation o0,o1,o2,o3;
+  o0 = o1 = o2 = o3 = ZERO;
+
+  int cumm_off = c->offset(0) | c->offset(1) | c->offset(2) | c->offset(3);
+  if ((cumm_off == 0) && (is_1_cover())) {
+    CGAL_triangulation_assertion(off == Offset());
+    const Point &p0  = c->vertex(0)->point();
+    const Point &p1  = c->vertex(1)->point();
+    const Point &p2  = c->vertex(2)->point();
+    const Point &p3  = c->vertex(3)->point();
+  
+    if (((o0 = orientation(q ,p1,p2,p3)) == NEGATIVE) ||
+        ((o1 = orientation(p0,q ,p2,p3)) == NEGATIVE) ||
+        ((o2 = orientation(p0,p1,q ,p3)) == NEGATIVE) ||
+        ((o3 = orientation(p0,p1,p2,q )) == NEGATIVE) ) {
+      return ON_UNBOUNDED_SIDE;
+    }
+  } else { // Special case for the periodic space.
+    Offset off_q;
+    Offset offs[4];
+    const Point *p[4];
+    for (int i=0; i<4; i++) {
+      p[i] = &(c->vertex(i)->point());
+      offs[i] = get_offset(c,i);
+    }
+    CGAL_triangulation_assertion(orientation(*p[0], *p[1], *p[2], *p[3],
+        offs[0], offs[1], offs[2], offs[3]) == POSITIVE);
+    bool found=false;
+    for (int i=0; (i<8)&&(!found); i++) {
+      if ((cumm_off | ((~i)&7)) == 7) {
+        o0 = o1 = o2 = o3 = NEGATIVE;
+        off_q = combine_offsets(off, int_to_off(i));
+
+        if (((o0 = orientation(      q,  *p[1],  *p[2],  *p[3], 
+                off_q  ,offs[1],offs[2],offs[3])) != NEGATIVE)&&
+            ((o1 = orientation(  *p[0],      q,  *p[2],  *p[3], 
+                offs[0],  off_q,offs[2],offs[3])) != NEGATIVE)&&
+            ((o2 = orientation(  *p[0],  *p[1],      q,  *p[3], 
+                offs[0],offs[1],  off_q,offs[3])) != NEGATIVE)&&
+            ((o3 = orientation(  *p[0],  *p[1],  *p[2],      q, 
+                offs[0],offs[1],offs[2],  off_q)) != NEGATIVE)) {
+          found = true;
+        }
+      }
+    }
+    if (!found) return ON_UNBOUNDED_SIDE;
+  }
+
+  // now all the oi's are >=0
+  // sum gives the number of facets p lies on
+  int sum = ( (o0 == ZERO) ? 1 : 0 ) 
+    + ( (o1 == ZERO) ? 1 : 0 ) 
+    + ( (o2 == ZERO) ? 1 : 0 ) 
+    + ( (o3 == ZERO) ? 1 : 0 );
+
+  switch (sum) {
+  case 0:
+    {
+      lt = CELL;
+      return ON_BOUNDED_SIDE;
+    }
+  case 1:
+    {
+      lt = FACET;
+      // i = index such that p lies on facet(i)
+      i = ( o0 == ZERO ) ? 0 :
+      ( o1 == ZERO ) ? 1 :
+      ( o2 == ZERO ) ? 2 :
+      3;
+      return ON_BOUNDARY;
+    }
+  case 2:
+    {
+      lt = EDGE;
+      // i = smallest index such that p does not lie on facet(i)
+      // i must be < 3 since p lies on 2 facets
+      i = ( o0 == POSITIVE ) ? 0 :
+      ( o1 == POSITIVE ) ? 1 :
+      2;
+      // j = larger index such that p not on facet(j)
+      // j must be > 0 since p lies on 2 facets
+      j = ( o3 == POSITIVE ) ? 3 :
+      ( o2 == POSITIVE ) ? 2 :
+      1;
+      return ON_BOUNDARY;
+    }
+  case 3:
+    {
+      lt = VERTEX;
+      // i = index such that p does not lie on facet(i)
+      i = ( o0 == POSITIVE ) ? 0 :
+      ( o1 == POSITIVE ) ? 1 :
+      ( o2 == POSITIVE ) ? 2 :
+      3;
+      return ON_BOUNDARY;
+    }
+  default:
+    {
+      // impossible : cannot be on 4 facets for a real tetrahedron
+      CGAL_triangulation_assertion(false);
+      return ON_BOUNDARY;
+    }
+  }
+} // side_of_cell
+
+template< class GT, class TDS >
+template< class CellIt >
+inline void Periodic_3_triangulation_3<GT,TDS>::
+    insert_too_long_edges(Vertex_handle v,
+        const CellIt begin, const CellIt end) {
+  CGAL_triangulation_precondition(number_of_vertices() != 0);
+  // add newly added edges to too_long_edges, if necessary.
+  Point p1,p2;
+  Offset omin;
+  std::pair< Vertex_handle, Vertex_handle > edge_to_add;
+  std::pair< Offset, Offset > edge_to_add_off;
+  std::list<Vertex_handle> empty_list;
+  too_long_edges[v] = empty_list;
+  // Iterate over all cells of the new star.
+  for (CellIt it = begin ; it != end ; ++it) {
+    // Consider all possible vertex pairs.
+    for (int k=0; k<4 ; k++) {
+    for (int j=0; j<4 ; j++) {
+      if (j==k) continue;
+      if (&*((*it)->vertex(j)) > &*((*it)->vertex(k))) continue;
+      // make the offsets canonical (wrt. to some notion)
+      // add to too_long_edges, if not yet added and if "too long"
+      CGAL_triangulation_precondition(
+	  &*((*it)->vertex(j))< &*((*it)->vertex(k)));
+
+      edge_to_add = std::make_pair((*it)->vertex(j), (*it)->vertex(k));
+      
+      p1 = construct_point((*it)->vertex(j)->point(), get_offset(*it, j));
+      p2 = construct_point((*it)->vertex(k)->point(), get_offset(*it, k));
+
+      if ((squared_distance(p1,p2) > edge_length_threshold)
+          && (find(too_long_edges[(*it)->vertex(j)].begin(),
+		  too_long_edges[(*it)->vertex(j)].end(),
+		  edge_to_add.second)
+	      == too_long_edges[(*it)->vertex(j)].end())
+      ){
+        too_long_edges[(*it)->vertex(j)].push_back(edge_to_add.second);
+        too_long_edge_counter++;
+      }
+    } }
+  }
+}
+
+template < class GT, class TDS >
+template < class CellIt >
+inline void Periodic_3_triangulation_3<GT,TDS>::
+    delete_too_long_edges(const CellIt begin, const CellIt end) {
+  std::pair< Vertex_handle, Vertex_handle > edge_to_delete, edge_to_delete2;
+  typename std::list< Vertex_handle >::iterator sit;
+  // Iterate over all cells that are in the star. That means that those cells
+  // are going to be deleted. Therefore, all of them have to be deleted from
+  // too_long_edges, if they are contained in it.
+  for (CellIt it = begin ; it != end ; ++it) {
+    for (int j=0; j<4 ; j++) {
+      for (int k=0; k<4; k++) {
+        if (&*((*it)->vertex(j)) < &*((*it)->vertex(k))) {
+          edge_to_delete = std::make_pair((*it)->vertex(j),(*it)->vertex(k));
+        } else {
+          edge_to_delete = std::make_pair((*it)->vertex(k),(*it)->vertex(j));
+        }
+        Vertex_handle v_no = edge_to_delete.first;
+        sit = find(too_long_edges[v_no].begin(),
+            too_long_edges[v_no].end(),
+            edge_to_delete.second);
+        if (sit != too_long_edges[v_no].end()) {
+          too_long_edges[v_no].erase(sit);
+          too_long_edge_counter--;
+        }
+      }
+    }
+  }
+}
+
+/*! \brief Insert point.
+*
+* Inserts the point p into the triangulation. It assumes that
+* the cell c containing p is already known.
+*
+* Implementation:
+* - some precondition checking
+* - find and mark conflicting cells --> find_conflicts
+* Conflicting cells are stored in the vector cells.
+* - backup hidden points
+* - Delete the edges of the marked cells from too_long_edges
+* - Insert the new vertex in the hole obtained by removing the
+*   conflicting cells (star-approach) --> _tds._insert_in_hole 
+* - find out about offsets
+* - Insert the newly added edges that are "too long"
+*   to too_long_edges
+* - reinsert hidden points
+*/
+template < class GT, class TDS >
+template < class Conflict_tester, class Point_hider >
+inline typename Periodic_3_triangulation_3<GT,TDS>::Vertex_handle
+Periodic_3_triangulation_3<GT,TDS>::periodic_insert(
+    const Point & p, const Offset& o,
+    Locate_type lt, Cell_handle c, const Conflict_tester &tester,
+    Point_hider &hider, Vertex_handle vh)
+{
+  Vertex_handle v;
+  CGAL_triangulation_assertion(number_of_vertices() != 0);
+  CGAL_triangulation_precondition_code(
+      Locate_type lt_assert; int i_assert; int j_assert;);
+  CGAL_triangulation_assertion(side_of_cell(tester.point(),o, c,
+      lt_assert, i_assert, j_assert) != ON_UNBOUNDED_SIDE);
+
+  tester.set_offset(o);
+
+  // This only holds for Delaunay
+  CGAL_triangulation_assertion(lt != VERTEX);
+  CGAL_USE(lt);
+
+  // Choose the periodic copy of tester.point() that is inside c.
+  Offset current_off = get_location_offset(tester, c);
+
+  CGAL_triangulation_assertion(side_of_cell(tester.point(),
+      combine_offsets(o,current_off),c,lt_assert,i_assert,j_assert)
+      != ON_UNBOUNDED_SIDE);
+  // If the new point is not in conflict with its cell, it is hidden.
+  if (!tester.test_initial_cell(c, current_off)) {
+    hider.hide_point(c,p);
+    return Vertex_handle();
+  }
+  // Ok, we really insert the point now.
+  // First, find the conflict region.
+  std::vector<Cell_handle> cells;
+  cells.reserve(32);
+
+  Facet facet;
+
+  find_conflicts(c, current_off, tester,
+      make_triple(Oneset_iterator<Facet>(facet),
+      std::back_inserter(cells),
+      Emptyset_iterator()));
+
+  // Remember the points that are hidden by the conflicting cells,
+  // as they will be deleted during the insertion.
+  hider.set_vertices(cells.begin(), cells.end());
+  
+  if (!is_1_cover())
+    delete_too_long_edges(cells.begin(), cells.end());
+  
+  // Insertion. Attention: facets[0].first MUST be in conflict!
+  // Compute the star and put it into the data structure.
+  // Store the new cells from the star in nbs.
+  v = _tds._insert_in_hole(cells.begin(), cells.end(),
+      facet.first, facet.second);
+  v->set_point(p);
+
+  //TODO: this could be done within the _insert_in_hole without losing any
+  //time because each cell is visited in any case.
+  //- Do timings to argue to modify _insert_in_conflicts if need be
+  //- Find the modified _insert_in_hole in the branch svn history of TDS
+  std::vector<Cell_handle> nbs;
+  incident_cells(v, std::back_inserter(nbs));
+  // For all neighbors of the newly added vertex v: fetch their offsets from
+  // the tester and reset them in the triangulation data structure.
+  for (typename std::vector<Cell_handle>::iterator cit = nbs.begin();
+      cit != nbs.end(); cit++) {
+    Offset off[4];
+    for (int i=0 ; i<4 ; i++) {
+      off[i] = (*cit)->vertex(i)->offset();
+    }
+    set_offsets(*cit, off[0], off[1], off[2], off[3]);
+  }
+  
+  for (typename std::vector<Vertex_handle>::iterator voit = v_offsets.begin();
+      voit != v_offsets.end() ; ++voit) {
+    (*voit)->clear_offset();
+  }
+  v_offsets.clear();
+
+  if (vh != Vertex_handle()) {
+    virtual_vertices[v] = Virtual_vertex(vh,o);
+    virtual_vertices_reverse[vh].push_back(v);
+  }
+
+  if (!is_1_cover())
+    insert_too_long_edges(v, nbs.begin(), nbs.end());
+
+  // Store the hidden points in their new cells.
+  hider.reinsert_vertices(v);
+  return v;
+}
+
+/** Inserts the first point to a triangulation.
+  *
+  * With inserting the first point the 3-sheeted covering is constructed.
+  * So first, the 27 vertices are inserted and are added to virtual_vertices
+  * Then 6*27 cells are created.
+  * Then all links are set.
+ */
+template < class GT, class TDS >
+inline typename Periodic_3_triangulation_3<GT,TDS>::Vertex_handle
+Periodic_3_triangulation_3<GT,TDS>::create_initial_triangulation(
+    const Point &p) {
+  /// Virtual vertices, one per periodic domain
+  Vertex_handle vir_vertices[3][3][3];
+  /// Virtual cells, 6 per periodic domain
+  Cell_handle cells[3][3][3][6];
+
+  // Initialise vertices:
+  vir_vertices[0][0][0] = _tds.create_vertex();
+  vir_vertices[0][0][0]->set_point(p);
+  virtual_vertices_reverse[vir_vertices[0][0][0]] =
+std::vector<Vertex_handle>();
+  for (int i=0; i<_cover[0]; i++) {
+    for (int j=0; j<_cover[1]; j++) {
+      for (int k=0; k<_cover[2]; k++) {
+        if ((i!=0)||(j!=0)||(k!=0)) {
+          // Initialise virtual vertices out of the domain for debugging
+          vir_vertices[i][j][k] =
+            _tds.create_vertex();
+          vir_vertices[i][j][k]->set_point(p); //+Offset(i,j,k));
+          virtual_vertices[vir_vertices[i][j][k]] =
+            Virtual_vertex(vir_vertices[0][0][0], Offset(i,j,k));
+          virtual_vertices_reverse[vir_vertices[0][0][0]].push_back(
+            vir_vertices[i][j][k]);
+        }
+        CGAL_triangulation_assertion(vir_vertices[i][j][k] != Vertex_handle());
+        CGAL_triangulation_assertion(vir_vertices[0][0][0]->point() == p);
+      }
+    }
+  }
+
+  // Create cells:
+  for (int i=0; i<_cover[0]; i++) {
+    for (int j=0; j<_cover[1]; j++) {
+      for (int k=0; k<_cover[2]; k++) {
+        for (int l=0; l<6; l++) {
+          // 6 cells per 'cube'
+          cells[i][j][k][l] = _tds.create_cell();
+          for (int n=0; n<4; n++)
+            CGAL_triangulation_assertion(cells[i][j][k][l] != Cell_handle());
+        }
+      }
+    }
+  }
+  // set vertex and neighbor information
+  // index to the right vertex: [number of cells][vertex][offset]
+  int vertex_ind[6][4][3] = {
+    { {0, 0, 0},  {0, 1, 0},  {0, 0, 1},  {1, 0, 0} },
+    { {1, 1, 0},  {0, 1, 1},  {1, 0, 1},  {1, 1, 1} },
+    { {1, 0, 0},  {0, 1, 1},  {0, 1, 0},  {0, 0, 1} },
+    { {1, 0, 0},  {0, 1, 1},  {0, 0, 1},  {1, 0, 1} },
+    { {1, 0, 0},  {0, 1, 1},  {1, 0, 1},  {1, 1, 0} },
+    { {1, 0, 0},  {0, 1, 1},  {1, 1, 0},  {0, 1, 0} }
+  };
+  int neighb_ind[6][4][4] = {
+    { { 0, 0, 0, 2},  { 0,-1, 0, 5},  { 0, 0,-1, 3},  {-1, 0, 0, 4} },
+    { { 0, 0, 1, 5},  { 1, 0, 0, 2},  { 0, 1, 0, 3},  { 0, 0, 0, 4} },
+    { {-1, 0, 0, 1},  { 0, 0, 0, 0},  { 0, 0, 0, 3},  { 0, 0, 0, 5} },
+    { { 0, 0, 1, 0},  { 0,-1, 0, 1},  { 0, 0, 0, 4},  { 0, 0, 0, 2} },
+    { { 0, 0, 0, 1},  { 1, 0, 0, 0},  { 0, 0, 0, 5},  { 0, 0, 0, 3} },
+    { { 0, 1, 0, 0},  { 0, 0,-1, 1},  { 0, 0, 0, 2},  { 0, 0, 0, 4} }
+  };
+  for (int i=0; i<_cover[0]; i++) {
+    for (int j=0; j<_cover[1]; j++) {
+      for (int k=0; k<_cover[2]; k++) {
+        int offset = 
+          (i==_cover[0]-1 ? 4 : 0) | 
+	  (j==_cover[1]-1 ? 2 : 0) | 
+	  (k==_cover[2]-1 ? 1 : 0);
+        for (int l=0; l<6; l++) {
+          // cell 0:
+          cells[i][j][k][l]->set_vertices(
+              vir_vertices
+                [(i+vertex_ind[l][0][0])%_cover[0]]
+                [(j+vertex_ind[l][0][1])%_cover[1]]
+                [(k+vertex_ind[l][0][2])%_cover[2]],
+              vir_vertices
+                [(i+vertex_ind[l][1][0])%_cover[0]]
+                [(j+vertex_ind[l][1][1])%_cover[1]]
+                [(k+vertex_ind[l][1][2])%_cover[2]],
+              vir_vertices
+                [(i+vertex_ind[l][2][0])%_cover[0]]
+                [(j+vertex_ind[l][2][1])%_cover[1]]
+                [(k+vertex_ind[l][2][2])%_cover[2]],
+              vir_vertices
+                [(i+vertex_ind[l][3][0])%_cover[0]]
+                [(j+vertex_ind[l][3][1])%_cover[1]]
+                [(k+vertex_ind[l][3][2])%_cover[2]]);
+          set_offsets(cells[i][j][k][l],
+              offset & (vertex_ind[l][0][0]*4 +
+                        vertex_ind[l][0][1]*2 +
+                        vertex_ind[l][0][2]*1),
+              offset & (vertex_ind[l][1][0]*4 +
+                        vertex_ind[l][1][1]*2 +
+                        vertex_ind[l][1][2]*1),
+              offset & (vertex_ind[l][2][0]*4 +
+                        vertex_ind[l][2][1]*2 +
+                        vertex_ind[l][2][2]*1),
+              offset & (vertex_ind[l][3][0]*4 +
+                        vertex_ind[l][3][1]*2 +
+                        vertex_ind[l][3][2]*1));
+          cells[i][j][k][l]->set_neighbors(
+              cells [(i+_cover[0]+neighb_ind[l][0][0])%_cover[0]]
+                    [(j+_cover[1]+neighb_ind[l][0][1])%_cover[1]]
+                    [(k+_cover[2]+neighb_ind[l][0][2])%_cover[2]]
+                    [         neighb_ind[l][0][3]       ],
+              cells [(i+_cover[0]+neighb_ind[l][1][0])%_cover[0]]
+                    [(j+_cover[1]+neighb_ind[l][1][1])%_cover[1]]
+                    [(k+_cover[2]+neighb_ind[l][1][2])%_cover[2]]
+                    [         neighb_ind[l][1][3]       ],
+              cells [(i+_cover[0]+neighb_ind[l][2][0])%_cover[0]]
+                    [(j+_cover[1]+neighb_ind[l][2][1])%_cover[1]]
+                    [(k+_cover[2]+neighb_ind[l][2][2])%_cover[2]]
+                    [         neighb_ind[l][2][3]       ],
+              cells [(i+_cover[0]+neighb_ind[l][3][0])%_cover[0]]
+                    [(j+_cover[1]+neighb_ind[l][3][1])%_cover[1]]
+                    [(k+_cover[2]+neighb_ind[l][3][2])%_cover[2]]
+                    [         neighb_ind[l][3][3]       ]
+          );
+        }
+      }
+    }
+  }
+  // set pointers from the vertices to incident cells.
+  for (int i=0; i<_cover[0]; i++) {
+    for (int j=0; j<_cover[1]; j++) {
+      for (int k=0; k<_cover[2]; k++) {
+        vir_vertices[i][j][k]->set_cell(cells[i][j][k][0]);
+      }
+    }
+  }
+  
+  _tds.set_dimension(3);
+
+  // create the base for too_long_edges;
+  CGAL_triangulation_assertion( too_long_edges.empty() );
+  CGAL_triangulation_assertion(too_long_edge_counter == 0);
+
+  for (Vertex_iterator vit = vertices_begin() ;
+       vit !=vertices_end() ; ++vit )
+    too_long_edges[vit] = std::list<Vertex_handle>();;
+
+  std::vector<Cell_handle> temp_inc_cells;
+  for (Vertex_iterator vit = vertices_begin() ;
+       vit !=vertices_end() ; ++vit ) {
+    temp_inc_cells.clear();
+    incident_cells(vit, std::back_inserter(temp_inc_cells));
+    for (unsigned int i=0 ; i<temp_inc_cells.size() ; i++) {
+      int k = temp_inc_cells[i]->index(vit);
+      for (int j=0; j<4 ; j++) {
+        if (j==k) continue;
+        if (&*vit > &*(temp_inc_cells[i]->vertex(j))) continue;
+        if ((find(too_long_edges[vit].begin(),
+                  too_long_edges[vit].end(),
+            temp_inc_cells[i]->vertex(j)) ==
+		too_long_edges[vit].end())
+        ){
+	  too_long_edges[vit].push_back(temp_inc_cells[i]->vertex(j));
+          too_long_edge_counter++;
+        }
+      }
+    }
+  }
+  return vir_vertices[0][0][0];
+}
+
+#include <CGAL/Periodic_3_triangulation_dummy_36.h>
+
+/** finds all cells that are in conflict with the currently added point
+  * (stored in tester).
+  *
+  * The result will be a hole of which the following data is returned:
+  * - boundary facets
+  * - cells
+  * - internal facets.
+  *
+  * c is the current cell, which must be in conflict.
+  * tester is the function object that tests if a cell is in conflict.
+  */
+template <class GT, class TDS>
+template <class Conflict_test,
+	  class OutputIteratorBoundaryFacets,
+          class OutputIteratorCells,
+	  class OutputIteratorInternalFacets>
+Triple<OutputIteratorBoundaryFacets,
+       OutputIteratorCells,
+       OutputIteratorInternalFacets>
+Periodic_3_triangulation_3<GT,TDS>::
+find_conflicts(Cell_handle d, const Offset &current_off,
+    const Conflict_test &tester,
+    Triple<OutputIteratorBoundaryFacets,
+    OutputIteratorCells,
+    OutputIteratorInternalFacets> it) const {
+  CGAL_triangulation_precondition( number_of_vertices() != 0 );
+  CGAL_triangulation_precondition( tester(d, current_off) );
+
+  std::stack<std::pair<Cell_handle, Offset> > cell_stack;
+  cell_stack.push(std::make_pair(d,current_off));
+  d->tds_data().mark_in_conflict();  
+  *it.second++ = d;
+
+  do {
+    Cell_handle c = cell_stack.top().first;
+    Offset current_off2 = cell_stack.top().second;
+    cell_stack.pop();
+
+    for (int i=0; i< 4; ++i) {
+      Cell_handle test = c->neighbor(i);
+      if (test->tds_data().is_in_conflict()) {
+	if (c < test) {
+	  *it.third++ = Facet(c, i); // Internal facet.
+	}
+	continue; // test was already in conflict.
+      }
+      if (test->tds_data().is_clear()) {
+	Offset o_test = current_off2 + get_neighbor_offset(c, i, test);
+	if (tester(test,o_test)) {
+	  if (c < test)
+	    *it.third++ = Facet(c, i); // Internal facet.
+	  
+	  cell_stack.push(std::make_pair(test,o_test));
+	  test->tds_data().mark_in_conflict();
+	  *it.second++ = test;
+	  continue;
+	}
+	test->tds_data().mark_on_boundary(); // test is on the boundary.
+      }
+      *it.first++ = Facet(c, i);
+      for (int j = 0 ; j<4 ; j++){
+	if (j==i) continue;
+	if (!c->vertex(j)->get_offset_flag()) {
+	  c->vertex(j)->set_offset(int_to_off(c->offset(j))-current_off2);
+	  v_offsets.push_back(c->vertex(j));
+	}
+      }
+    }
+  } while (!cell_stack.empty());
+  return it;
+}
+
+/*! \brief Insert point into triangulation.
+ *
+ * Inserts the point p into the triangulation. It expects
+ * - a cell to start the point location
+ * - a testing function to determine cells in conflict
+ * - a testing function to determine if a vertex is hidden.
+ *
+ * Implementation:
+ * - If the triangulation is empty call a special function
+ * (create_initial_triangulation) to construct the basic
+ * triangulation.
+ * - Run point location to get the cell c containing point p.
+ * - Call periodic_insert to insert p into the 3-cover.
+ * - Also insert the eight periodic copies of p.
+ */
+template < class GT, class TDS >
+template < class Conflict_tester, class Point_hider >
+inline typename Periodic_3_triangulation_3<GT,TDS>::Vertex_handle
+Periodic_3_triangulation_3<GT,TDS>::insert_in_conflict(const Point & p,
+    Locate_type lt, Cell_handle c, int li, int lj,
+    const Conflict_tester &tester, Point_hider &hider) {
+
+  CGAL_triangulation_assertion((_domain.xmin() <= p.x())
+      && (p.x() < _domain.xmax()));
+  CGAL_triangulation_assertion((_domain.ymin() <= p.y())
+      && (p.y() < _domain.ymax()));
+  CGAL_triangulation_assertion((_domain.zmin() <= p.z()) 
+      && (p.z() < _domain.zmax()));
+
+  if (number_of_vertices() == 0) {
+    return create_initial_triangulation(p);
+  }
+
+  if ((lt == VERTEX) &&
+      (tester.compare_weight(c->vertex(li)->point(),p)==0) ) {
+    return c->vertex(li);
+  }
+
+  Vertex_handle vstart;
+  if (!is_1_cover()) {
+    Virtual_vertex_map_it vvmit = virtual_vertices.find(c->vertex(0));
+    if (vvmit == virtual_vertices.end())
+      vstart = c->vertex(0);
+    else
+      vstart = vvmit->second.first;
+    CGAL_triangulation_assertion(virtual_vertices.find(vstart)
+	==virtual_vertices.end());
+    CGAL_triangulation_assertion(virtual_vertices_reverse.find(vstart)
+        != virtual_vertices_reverse.end());
+  }
+  CGAL_triangulation_assertion( number_of_vertices() != 0 );
+  CGAL_triangulation_expensive_assertion(is_valid());
+  Vertex_handle vh = periodic_insert(p, Offset(), lt, c, tester, hider);
+  if (is_1_cover()) {
+    return vh;
+  }
+  
+  for (Cell_iterator it = all_cells_begin() ;
+      it != all_cells_end() ; it++){
+    CGAL_triangulation_assertion(it->neighbor(0)->neighbor(
+        it->neighbor(0)->index(it))==it);
+    CGAL_triangulation_assertion(it->neighbor(1)->neighbor(
+        it->neighbor(1)->index(it))==it);
+    CGAL_triangulation_assertion(it->neighbor(2)->neighbor(
+        it->neighbor(2)->index(it))==it);
+    CGAL_triangulation_assertion(it->neighbor(3)->neighbor(
+        it->neighbor(3)->index(it))==it);
+  }
+
+  std::vector<Vertex_handle> start_vertices
+      = virtual_vertices_reverse.find(vstart)->second;
+  Cell_handle start;
+  virtual_vertices_reverse[vh] = std::vector<Vertex_handle>();
+  // insert 26 periodic copies
+  for (int i=0; i<_cover[0]; i++) {
+    for (int j=0; j<_cover[1]; j++) {
+      for (int k=0; k<_cover[2]; k++) {
+        if ((i!=0)||(j!=0)||(k!=0)) {
+          start = start_vertices[i*9+j*3+k-1]->cell();
+          c = periodic_locate(p, Offset(i,j,k), lt, li, lj, start);
+          periodic_insert(p, Offset(i,j,k), lt, c, tester, hider,vh);
+        }
+      }
+    }
+  }
+  CGAL_triangulation_expensive_assertion(is_valid());
+
+  // Fall back to 1-cover if the criterion that the longest edge is shorter
+  // than sqrt(0.166) is fulfilled.
+  if ( too_long_edge_counter == 0 ) {
+    CGAL_triangulation_expensive_assertion(is_valid());
+    convert_to_1_sheeted_covering();
+    CGAL_triangulation_expensive_assertion( is_valid() );
+  }
+  return vh;
+}
+
+/// tests if two vertices of one cell are just periodic copies of each other
+template < class GT, class TDS >
+inline bool Periodic_3_triangulation_3<GT,TDS>::has_self_edges(Cell_handle c) const {
+  CGAL_triangulation_assertion((c->vertex(0) != c->vertex(1)) || 
+      (c->offset(0) != c->offset(1)));
+  CGAL_triangulation_assertion((c->vertex(0) != c->vertex(2)) || 
+      (c->offset(0) != c->offset(2)));
+  CGAL_triangulation_assertion((c->vertex(0) != c->vertex(3)) || 
+      (c->offset(0) != c->offset(3)));
+  CGAL_triangulation_assertion((c->vertex(1) != c->vertex(2)) || 
+      (c->offset(1) != c->offset(2)));
+  CGAL_triangulation_assertion((c->vertex(1) != c->vertex(3)) || 
+      (c->offset(1) != c->offset(3)));
+  CGAL_triangulation_assertion((c->vertex(2) != c->vertex(3)) || 
+      (c->offset(2) != c->offset(3)));
+  return ((c->vertex(0) == c->vertex(1)) ||
+      (c->vertex(0) == c->vertex(2)) ||
+      (c->vertex(0) == c->vertex(3)) ||
+      (c->vertex(1) == c->vertex(2)) ||
+      (c->vertex(1) == c->vertex(3)) ||
+      (c->vertex(2) == c->vertex(3)));
+}
+
+/*! \brief Tests if the triangulation is valid.
+ *
+ * A triangulation is valid if
+ * - A cell is not its own neighbor.
+ * - A cell has no two equal neighbors
+ * - A cell has no two equal vertex-offset pairs
+ * - A cell is positively oriented.
+ * - The point of a neighbor of cell c that does not belong to c is not inside
+ *   the circumcircle of c.
+ */
+template < class GT, class TDS >
+bool
+Periodic_3_triangulation_3<GT,TDS>::
+is_valid(bool verbose, int level) const {
+  bool error = false;
+  for (Cell_iterator cit = cells_begin();
+       cit != cells_end(); ++cit) {
+    for (int i=0; i<4; i++) {
+      CGAL_triangulation_assertion(cit != cit->neighbor(i));
+      for (int j=i+1; j<4; j++) {
+        CGAL_triangulation_assertion(cit->neighbor(i) != cit->neighbor(j));
+        CGAL_triangulation_assertion(cit->vertex(i) != cit->vertex(j));
+      }
+    }
+    // Check positive orientation:
+    const Point *p[4]; Offset off[4];
+    for (int i=0; i<4; i++) {
+      p[i] = &cit->vertex(i)->point();
+      off[i] = get_offset(cit,i);
+    }
+    if (orientation(*p[0], *p[1], *p[2], *p[3],
+                   off[0], off[1], off[2], off[3]) != POSITIVE) {
+      if (verbose) {
+	std::cerr<<"Periodic_3_triangulation_3: wrong orientation:"<<std::endl;
+	std::cerr<<off[0]<<'\t'<<*p[0]<<'\n'
+		 <<off[1]<<'\t'<<*p[1]<<'\n'
+		 <<off[2]<<'\t'<<*p[2]<<'\n'
+		 <<off[3]<<'\t'<<*p[3]<<std::endl;
+      }
+      error = true;
+    }
+  }
+
+  if (!has_self_edges()) {
+    if (! _tds.is_valid(verbose, level) ) {
+      return false;
+    }
+  }
+
+  return !error;
+}
+
+template < class GT, class TDS >
+bool Periodic_3_triangulation_3<GT,TDS>::is_valid(Cell_handle ch,
+    bool verbose, int level) const {
+  if ( ! _tds.is_valid(ch,verbose,level) )
+    return false;
+  bool error = false;
+  const Point *p[4]; Offset off[4];
+  for (int i=0; i<4; i++) {
+    p[i] = &ch->vertex(i)->point();
+    off[i] = get_offset(ch,i);
+  }
+  if (orientation(*p[0], *p[1], *p[2], *p[3], 
+		  off[0], off[1], off[2], off[3]) != POSITIVE) {
+    error = true;
+  }
+  
+  return !error;
+}
+
+template < class GT, class TDS >
+template < class ConflictTester >
+bool Periodic_3_triangulation_3<GT,TDS>::
+is_valid_conflict(ConflictTester &tester, bool verbose, int level) const {
+  Cell_iterator it;
+  for ( it = cells_begin(); it != cells_end(); ++it ) {
+    is_valid(it, verbose, level);
+    for (int i=0; i<4; i++ ) {
+      Offset o_nb = get_neighbor_offset(it,i,it->neighbor(i));
+      Offset o_vt = get_offset(it->neighbor(i),
+				      it->neighbor(i)->index(it));
+      if (tester(it,
+		 it->neighbor(i)->vertex(it->neighbor(i)->index(it))->point(),
+		 o_vt-o_nb)) {
+        if (verbose)
+          std::cerr << "non-empty sphere: "
+              <<it->vertex(0)->point()<<'\t'
+              <<it->vertex(1)->point()<<'\t'
+              <<it->vertex(2)->point()<<'\t'
+              <<it->vertex(3)->point()<<'\n'
+	      <<it->neighbor(i)->vertex(it->neighbor(i)->index(it))->point()
+              <<'\t'<<o_vt-o_nb
+              << std::endl;
+        return false;
+      }
+    }
+  }
+  return true;
+}
+
+template < class GT, class TDS >
+inline void Periodic_3_triangulation_3<GT,TDS>::make_hole(Vertex_handle v, 
+    std::map<Vertex_triple,Facet> &outer_map, std::vector<Cell_handle> &hole) {
+  
+  //CGAL_triangulation_precondition( all_vertices_begin()++ 
+  //    != all_vertices_end() );
+  
+  incident_cells(v, std::back_inserter(hole));
+
+  for (typename std::vector<Cell_handle>::iterator cit = hole.begin();
+       cit != hole.end(); ++cit) {
+    int indv = (*cit)->index(v);
+    Cell_handle opp_cit = (*cit)->neighbor( indv );
+    Facet f(opp_cit, opp_cit->index(*cit)); 
+    Vertex_triple vt = make_vertex_triple(f);
+    make_canonical(vt);
+    outer_map[vt] = f;
+    for (int i=0; i<4; i++)
+      if ( i != indv )
+        (*cit)->vertex(i)->set_cell(opp_cit);
+  }
+}
+
+/*! \brief Remove a vertex from the triangulation.
+ *
+ * Removes vertex v from the triangulation.
+ */
+template < class GT, class TDS >
+template < class PointRemover, class Conflict_tester>
+inline void Periodic_3_triangulation_3<GT,TDS>::remove(Vertex_handle v,
+    PointRemover &r, Conflict_tester &t) {
+  CGAL_expensive_precondition(is_vertex(v));
+  std::vector<Vertex_handle> vhrem;
+  if (!is_1_cover()) {
+    if (number_of_vertices() == 1) {
+      clear();
+      return;
+    }
+    Virtual_vertex_map_it vvmit = virtual_vertices.find(v);
+    if (vvmit != virtual_vertices.end()) v = vvmit->second.first;
+    CGAL_triangulation_assertion(virtual_vertices_reverse.find(v)
+        != virtual_vertices_reverse.end());
+    vhrem = virtual_vertices_reverse.find(v)->second;
+    virtual_vertices_reverse.erase(v);
+    CGAL_triangulation_assertion(vhrem.size()==26);
+    for (int i=0 ; i<26 ; i++) {
+      periodic_remove(vhrem[i],r);
+      virtual_vertices.erase(vhrem[i]);
+      CGAL_triangulation_expensive_assertion(is_valid());
+    }
+    periodic_remove(v,r);
+  } else {
+    periodic_remove(v,r);
+    if (!is_1_cover()) remove(v,r,t);
+  }
+  
+}
+
+/*! \brief Remove a vertex from the triangulation.
+ *
+ * Removes vertex v from the triangulation.
+ * It expects a reference to an instance of a PointRemover.
+ * 
+ * Implementation:
+ * - Compute the hole, that is, all cells incident to v. Cells outside of
+ *   this hole are not affected by the deletion of v.
+ * - Triangulate the hole. This is done computing the triangulation
+ *   in Euclidean space for the points on the border of the hole.
+ * - Sew this triangulation into the hole.
+ * - Test for all newly added edges, whether they are shorter than the
+ *   edge_length_threshold. If not, convert to 3-cover.
+ */
+template < class GT, class TDS >
+template < class PointRemover >
+inline void Periodic_3_triangulation_3<GT,TDS>::periodic_remove(Vertex_handle v,
+    PointRemover &remover) {
+
+  // Construct the set of vertex triples on the boundary
+  // with the facet just behind
+  typedef std::map<Vertex_triple,Facet> Vertex_triple_Facet_map;
+  typedef PointRemover Point_remover;
+  typedef typename Point_remover::CellE_handle    CellE_handle;
+  typedef typename Point_remover::VertexE_handle  VertexE_handle;
+  typedef typename Point_remover::FacetE          FacetE;
+  typedef typename Point_remover::VertexE_triple  VertexE_triple;
+  typedef typename Point_remover::Finite_cellsE_iterator
+      Finite_cellsE_iterator;
+  typedef typename Point_remover::Vertex_triple_FacetE_map
+      Vertex_triple_FacetE_map;
+
+  // First compute the hole and its boundary vertices.
+  std::vector<Cell_handle> hole;
+  hole.reserve(64);
+  Vertex_triple_Facet_map outer_map;
+  Vertex_triple_FacetE_map inner_map;
+
+  make_hole(v, outer_map, hole);
+
+  CGAL_triangulation_assertion(outer_map.size()==hole.size());
+  CGAL_triangulation_assertion(remover.hidden_points_begin() == 
+      remover.hidden_points_end());
+
+  if (!is_1_cover()) {
+    delete_too_long_edges(hole.begin(), hole.end());
+  }
+  
+  // Output the hidden points.
+  for (typename std::vector<Cell_handle>::iterator
+      hi = hole.begin(), hend = hole.end(); hi != hend; ++hi)
+  {
+    remover.add_hidden_points(*hi);
+  }
+
+  // Build up the map between Vertices on the boundary and offsets
+  // collect all vertices on the boundary
+  std::vector<Vertex_handle> vertices;
+  vertices.reserve(64);
+
+  // The set is needed to ensure that each vertex is inserted only once.
+  std::set<Vertex_handle> tmp_vertices;
+  // The map connects vertices to offsets in the hole
+  std::map<Vertex_handle, Offset> vh_off_map;
+
+  for(typename std::vector<Cell_handle>::iterator cit = hole.begin();
+      cit != hole.end(); ++cit)
+  {
+    // Put all incident vertices in tmp_vertices.
+    for (int j=0; j<4; ++j){
+      if ((*cit)->vertex(j) != v){
+        tmp_vertices.insert((*cit)->vertex(j));
+        vh_off_map[(*cit)->vertex(j)] = int_to_off((*cit)->offset(j))
+            - int_to_off((*cit)->offset((*cit)->index(v)));
+      }
+    }
+  }
+
+  // Now output the vertices.
+  std::copy(tmp_vertices.begin(), tmp_vertices.end(),
+      std::back_inserter(vertices));
+
+  // create a Delaunay/Regular triangulation of the points on the boundary
+  // in Euclidean space and make a map from the vertices in remover.tmp
+  // towards the vertices in *this
+  
+  Unique_hash_map<VertexE_handle,Vertex_handle> vmap;
+  CellE_handle ch;
+  remover.tmp.clear();
+  
+  for(unsigned int i=0; i < vertices.size(); i++){
+    typedef typename Point_remover::Triangulation_R3::Point TRPoint;
+    CGAL_triangulation_assertion(get_offset(vertices[i])
+	+ combine_offsets(Offset(), vh_off_map[vertices[i]])
+	== combine_offsets(get_offset(vertices[i]),vh_off_map[vertices[i]]));
+    TRPoint trp = std::make_pair(vertices[i]->point(),
+	combine_offsets( get_offset(vertices[i]), vh_off_map[vertices[i]]) );
+    VertexE_handle vh = remover.tmp.insert(trp, ch);
+    vmap[vh] = vertices[i];
+    CGAL_triangulation_assertion(vmap.is_defined(vh));
+  }
+  CGAL_triangulation_assertion(remover.tmp.number_of_vertices() != 0);
+
+  // Construct the set of vertex triples of tmp
+  // We reorient the vertex triple so that it matches those from outer_map
+  // Also note that we use the vertices of *this, not of tmp
+  for(Finite_cellsE_iterator it = remover.tmp.finite_cells_begin();
+      it != remover.tmp.finite_cells_end();
+      ++it){
+    VertexE_triple vt_aux;
+    for(int i=0; i < 4; i++){
+      FacetE f = std::pair<CellE_handle,int>(it,i);
+      vt_aux = VertexE_triple(
+          f.first->vertex(vertex_triple_index(f.second,0)),
+          f.first->vertex(vertex_triple_index(f.second,1)),
+          f.first->vertex(vertex_triple_index(f.second,2)));
+      if (vmap.is_defined(vt_aux.first)
+          && vmap.is_defined(vt_aux.second)
+          && vmap.is_defined(vt_aux.third) ) {
+        Vertex_triple vt(vmap[vt_aux.first],vmap[vt_aux.third],
+            vmap[vt_aux.second]);
+        make_canonical(vt);
+        inner_map[vt]= f;
+      }
+    }
+  }
+
+  // A structure for storing the new neighboring relations
+  typedef boost::tuple<Cell_handle, int, Cell_handle> Neighbor_relation;
+  std::vector<Neighbor_relation> nr_vec;
+  std::vector<Cell_handle> new_cells;
+
+  // Grow inside the hole, by extending the surface
+  while(! outer_map.empty()){
+    typename Vertex_triple_Facet_map::iterator oit = outer_map.begin();
+    
+    typename Vertex_triple_Facet_map::value_type o_vt_f_pair = *oit;
+    Cell_handle o_ch = o_vt_f_pair.second.first;
+    unsigned int o_i = o_vt_f_pair.second.second;
+    
+    typename Vertex_triple_FacetE_map::iterator iit =
+        inner_map.find(o_vt_f_pair.first);
+    
+    CGAL_triangulation_assertion(iit != inner_map.end());
+    typename Vertex_triple_FacetE_map::value_type i_vt_f_pair = *iit;
+    CellE_handle i_ch = i_vt_f_pair.second.first;
+    unsigned int i_i = i_vt_f_pair.second.second;
+    
+    // create a new cell to glue to the outer surface
+    Cell_handle new_ch = _tds.create_cell();
+    new_cells.push_back(new_ch);
+    new_ch->set_vertices(vmap[i_ch->vertex(0)], vmap[i_ch->vertex(1)],
+                        vmap[i_ch->vertex(2)], vmap[i_ch->vertex(3)]);
+    set_offsets(new_ch, vh_off_map[vmap[i_ch->vertex(0)]],
+                        vh_off_map[vmap[i_ch->vertex(1)]],
+                        vh_off_map[vmap[i_ch->vertex(2)]],
+                        vh_off_map[vmap[i_ch->vertex(3)]]);
+    
+    // Update the edge length management
+    for( int i=0 ; i < 4 ; i++ ) {
+      for (int j=0 ; j < 4 ; j++) {
+        if (j==i) continue;
+        if (&*(new_ch->vertex(i)) > &*(new_ch->vertex(j))) continue;
+
+	Point p1 = construct_point(new_ch->vertex(i)->point(),
+	    get_offset(new_ch, i));
+	Point p2 = construct_point(new_ch->vertex(j)->point(),
+	    get_offset(new_ch, j));
+        Vertex_handle v_no = new_ch->vertex(i);
+
+        if (squared_distance(p1,p2) > edge_length_threshold) {
+	  // If the cell does not fulfill the edge-length criterion
+	  // revert all changes to the triangulation and transform it
+	  // to a triangulation in the needed covering space.
+          if (is_1_cover()) {
+	    _tds.delete_cells(new_cells.begin(), new_cells.end());
+	    convert_to_27_sheeted_covering();
+            return;
+          }
+          else if (find(too_long_edges[v_no].begin(),
+			too_long_edges[v_no].end(),
+			new_ch->vertex(j))
+		   == too_long_edges[v_no].end()) {
+            too_long_edges[v_no].push_back(new_ch->vertex(j));
+            too_long_edge_counter++;
+          }
+        }
+      }
+    }
+
+    // The neighboring relation needs to be stored temporarily in
+    // nr_vec. It cannot be applied directly because then we could not
+    // easily cancel the removing process if a cell is encountered
+    // that does not obey the edge-length criterion.
+    nr_vec.push_back(boost::make_tuple(o_ch,o_i,new_ch));
+    nr_vec.push_back(boost::make_tuple(new_ch,i_i,o_ch));
+
+    // for the other faces check, if they can also be glued
+    for(unsigned int i = 0; i < 4; i++){
+      if(i != i_i){
+	Facet f = std::pair<Cell_handle,int>(new_ch,i);
+        Vertex_triple vt = make_vertex_triple(f);
+        make_canonical(vt);
+        std::swap(vt.second,vt.third);
+        typename Vertex_triple_Facet_map::iterator oit2 = outer_map.find(vt);
+        if(oit2 == outer_map.end()){
+          std::swap(vt.second,vt.third);
+          outer_map[vt]= f;
+        } else {
+        // glue the faces
+          typename Vertex_triple_Facet_map::value_type o_vt_f_pair2 = *oit2;
+          Cell_handle o_ch2 = o_vt_f_pair2.second.first;
+          int o_i2 = o_vt_f_pair2.second.second;
+	  nr_vec.push_back(boost::make_tuple(o_ch2,o_i2,new_ch));
+	  nr_vec.push_back(boost::make_tuple(new_ch,i,o_ch2));
+          outer_map.erase(oit2);
+        }
+      }
+    }
+    outer_map.erase(oit);
+  }
+
+  // finally set the neighboring relations
+  for (unsigned int i=0 ; i<nr_vec.size() ; i++) {
+    nr_vec[i].template get<0>()->set_neighbor(nr_vec[i].template get<1>(),nr_vec[i].template get<2>());
+  }
+  
+  _tds.delete_vertex(v);
+  _tds.delete_cells(hole.begin(), hole.end());
+  CGAL_triangulation_expensive_assertion(is_valid());
+}
+
+// ############################################################################
+// ############################################################################
+// ############################################################################
+template < class GT, class TDS >
+template < class Cmp >
+class Periodic_3_triangulation_3<GT, TDS>::Perturbation_order {
+
+  typedef GT Geometric_traits;
+  typedef typename Geometric_traits::Point_3 Point;
+  typedef typename Geometric_traits::Compare_xyz_3 Compare_xyz_3;
+  typedef typename Periodic_3_triangulation_3<GT, TDS>::Periodic_point
+      Periodic_point;
+  
+  Cmp _cmp;
+
+public:
+  Perturbation_order(const Cmp & cmp) : _cmp(cmp) {}
+
+  bool operator()(const Periodic_point *p, const Periodic_point *q) const {
+    return (_cmp(p->first, q->first, p->second, q->second) == SMALLER);
+  }
+};
+
+// ############################################################################
+// ############################################################################
+// ############################################################################
+
+/** \brief Delete each redundant cell and the not anymore needed data
+ *  structures.
+ * 
+ *  This function consists of four iterations over all cells and one
+ *  iteration over all vertices:
+ *  1. cell iteration: mark all cells that are to delete
+ *  2. cell iteration: redirect neighbors of remaining cells
+ *  3. cell iteration: redirect vertices of remaining cells
+ *  4. cell iteration: delete all cells marked in the 1. iteration
+ *  Vertex iteration: delete all vertices outside the original domain.
+ */
+template < class GT, class TDS >
+inline void 
+Periodic_3_triangulation_3<GT,TDS>::convert_to_1_sheeted_covering() {
+  // ###################################################################
+  // ### First cell iteration ##########################################
+  // ###################################################################
+  {
+    if (is_1_cover()) return;
+    bool to_delete, has_simplifiable_offset;
+    Virtual_vertex_map_it vvmit;
+    // First iteration over all cells: Mark the cells that are to delete.
+    // Cells are to delete if they cannot be translated anymore in the
+    // direction of one of the axes without yielding negative offsets.
+    for( Cell_iterator it = all_cells_begin() ;
+    it != all_cells_end() ; ++it ) {
+      to_delete = false;
+      // for all directions in 3D Space
+      for( int j=0 ; j<3 ; j++ ) {
+        has_simplifiable_offset = true;
+        // for all vertices of cell it
+        for( int i=0 ; i<4 ; i++ ) {
+          vvmit = virtual_vertices.find(it->vertex(i));
+          // if it->vertex(i) lies inside the original domain:
+          if (vvmit == virtual_vertices.end()) {
+            // the cell cannot be moved any more because if we did, then
+            // it->vertex(i) will get at least one negative offset.
+            has_simplifiable_offset = false;
+            // if it->vertex(i) lies outside the original domain:
+          } else {
+            // The cell can certainly be deleted if the offset contains a 2
+            to_delete = to_delete
+                || (vvmit->second.second[j] == 2) ;
+            // The cell can be moved into one direction only if the offset of
+            // all for vertices is >=1 for this direction. Since we already
+            // tested for 2 it is sufficient to test here for 1.
+            has_simplifiable_offset = has_simplifiable_offset
+                && (vvmit->second.second[j] == 1) ;
+          }
+        } 
+        // if the offset can be simplified, i.e. the cell can be moved, then
+        // it can be deleted.
+        if (has_simplifiable_offset)
+          to_delete = true;
+      }
+      // Mark all cells that are to delete. They cannot be deleted yet,
+      // because neighboring information still needs to be extracted.
+      if (to_delete) {
+        it->set_additional_flag(1);
+      }
+    }
+  }
+
+  // ###################################################################
+  // ### Second cell iteration #########################################
+  // ###################################################################
+  {
+    Vertex_handle vert[4], nbv[4];
+    Offset off[4];
+    Cell_handle nb, new_neighbor;
+    std::vector<Triple<Cell_handle, int, Cell_handle> > new_neighbor_relations;
+
+    // Second iteration over all cells: redirect neighbors where necessary
+    for (Cell_iterator it = all_cells_begin() ;
+        it != all_cells_end() ; ++it) {
+      // Skip all cells that are to delete.
+      if (it->get_additional_flag() == 1) continue;
+      
+      // Redirect neighbors: Only neighbors that are marked by the
+      // additional_flag have to be substituted by one of their periodic
+      // copies. The unmarked neighbors stay the same.
+      for ( int i = 0 ; i < 4 ; i++ ) {
+        if ( it->neighbor(i)->get_additional_flag() != 1 ) continue;
+        
+        nb = it->neighbor(i);
+        
+        for ( int j = 0 ; j < 4 ; j++ ) {
+          off[j] = Offset();
+          get_vertex( nb, j, vert[j], off[j]);
+        }
+        int x,y,z;
+        x = (std::min) ( (std::min) ( off[0][0], off[1][0] ),
+            (std::min) ( off[2][0], off[3][0] ) );
+        y = (std::min) ( (std::min) ( off[0][1], off[1][1] ),
+            (std::min) ( off[2][1], off[3][1] ) );
+        z = (std::min) ( (std::min) ( off[0][2], off[1][2] ),
+            (std::min) ( off[2][2], off[3][2] ) );
+        
+        // The vector from nb to the "original" periodic copy of nb, that is
+        // the copy that will not be deleted.
+        Offset difference_offset(x,y,z);
+        CGAL_triangulation_assertion( !difference_offset.is_null() );
+        
+        // We now have to find the "original" periodic copy of nb from
+        // its vertices. Therefore, we first have to find the vertices.
+        for ( int j = 0 ; j < 4 ; j++ ) {
+          CGAL_triangulation_assertion( (off[j]-difference_offset)[0] >= 0);
+          CGAL_triangulation_assertion( (off[j]-difference_offset)[1] >= 0);
+          CGAL_triangulation_assertion( (off[j]-difference_offset)[2] >= 0);
+          CGAL_triangulation_assertion( (off[j]-difference_offset)[0] < 3);
+          CGAL_triangulation_assertion( (off[j]-difference_offset)[1] < 3);
+          CGAL_triangulation_assertion( (off[j]-difference_offset)[2] < 3);
+          
+          // find the Vertex_handles of the vertices of the "original"
+          // periodic copy of nb. If the vertex is inside the original
+          // domain, there is nothing to do
+          if ( (off[j]-difference_offset).is_null() ) {
+            nbv[j] = vert[j];
+            // If the vertex is outside the original domain, we have to search
+            // in virtual_vertices in the "wrong" direction. That means, we
+            // cannot use virtual_vertices.find but have to use
+            // virtual_vertices_reverse.
+          } else {
+            Offset nbo = off[j]-difference_offset;
+            nbv[j] = virtual_vertices_reverse.find(vert[j])
+              ->second[nbo[0]*9+nbo[1]*3+nbo[2]-1];
+          }
+        }
+        // Find the new neighbor by its 4 vertices
+        new_neighbor = get_cell( nbv );
+        
+        // Store the new neighbor relation. This cannot be applied yet because
+        // it would disturb the functioning of get_cell( ... )
+        new_neighbor_relations.push_back(make_triple(it, i, new_neighbor));
+      }
+    }
+    // Apply the new neighbor relations now.
+    for (unsigned int i=0 ; i<new_neighbor_relations.size() ; i++){
+      new_neighbor_relations[i].first->set_neighbor(
+          new_neighbor_relations[i].second,
+          new_neighbor_relations[i].third);
+    }
+  }
+  
+  // ###################################################################
+  // ### Third cell iteration ##########################################
+  // ###################################################################
+  {
+    Vertex_handle vert[4];
+    Offset off[4];
+    // Third iteration over all cells: redirect vertices where necessary
+    for (Cell_iterator it = all_cells_begin() ;
+        it != all_cells_end() ; ++it) {
+      // Skip all cells that are marked to delete
+      if (it->get_additional_flag() == 1) continue;
+      // Find the corresponding vertices of it in the original domain
+      // and set them as new vertices of it.
+      for ( int i = 0 ; i < 4 ; i++ ) {
+        off[i] = Offset();
+        get_vertex( it, i, vert[i], off[i]);
+        it->set_vertex( i, vert[i]);
+        CGAL_triangulation_assertion(vert[i]->point()[0] < _domain.xmax());
+        CGAL_triangulation_assertion(vert[i]->point()[1] < _domain.ymax());
+        CGAL_triangulation_assertion(vert[i]->point()[2] < _domain.zmax());
+        CGAL_triangulation_assertion(vert[i]->point()[0] >= _domain.xmin());
+        CGAL_triangulation_assertion(vert[i]->point()[1] >= _domain.ymin());
+        CGAL_triangulation_assertion(vert[i]->point()[2] >= _domain.zmin());
+        
+        // redirect also the cell pointer of the vertex.
+        it->vertex(i)->set_cell(it);
+      }
+      // Set the offsets.
+      set_offsets(it, off[0], off[1], off[2], off[3] );
+      CGAL_triangulation_assertion( int_to_off(it->offset(0)) == off[0] );
+      CGAL_triangulation_assertion( int_to_off(it->offset(1)) == off[1] );
+      CGAL_triangulation_assertion( int_to_off(it->offset(2)) == off[2] );
+      CGAL_triangulation_assertion( int_to_off(it->offset(3)) == off[3] );
+    }
+  }
+  
+  // ###################################################################
+  // ### Fourth cell iteration #########################################
+  // ###################################################################
+  {
+    // Delete the marked cells.
+    std::vector<Cell_handle> cells_to_delete;
+    for ( Cell_iterator cit = all_cells_begin() ;
+    cit != all_cells_end() ; ++cit ) {
+      if ( cit->get_additional_flag() == 1 )
+        cells_to_delete.push_back( cit );
+    }
+    _tds.delete_cells(cells_to_delete.begin(), cells_to_delete.end());
+  }
+  
+  // ###################################################################
+  // ### Vertex iteration ##############################################
+  // ###################################################################
+  {
+    // Delete all the vertices in virtual_vertices, that is all vertices
+    // outside the original domain.
+    std::vector<Vertex_handle> vertices_to_delete;
+    for ( Vertex_iterator vit = all_vertices_begin() ;
+	  vit != all_vertices_end() ; ++vit ) {
+      if ( virtual_vertices.count( vit ) != 0 ) {
+        CGAL_triangulation_assertion( virtual_vertices.count( vit ) == 1 );
+        vertices_to_delete.push_back( vit ) ;
+      }
+    }
+    _tds.delete_vertices(vertices_to_delete.begin(), vertices_to_delete.end());
+  }
+  _cover = make_array(1,1,1);
+  virtual_vertices.clear();
+  virtual_vertices_reverse.clear();
+}
+
+template < class GT, class TDS >
+inline void
+Periodic_3_triangulation_3<GT,TDS>::convert_to_27_sheeted_covering() {
+  if (_cover == make_array(3,3,3)) return;
+  CGAL_triangulation_precondition(is_1_cover());
+
+  // Create 27 copies of each vertex and write virtual_vertices and
+  // virtual_vertices_reverse
+  std::list<Vertex_handle> original_vertices;
+  // try to use std::copy instead of the following loop.
+  for (Vertex_iterator vit = vertices_begin() ; vit != vertices_end() ; ++vit)
+    original_vertices.push_back(vit);
+  for (typename std::list<Vertex_handle>::iterator vit
+	 = original_vertices.begin() ; vit != original_vertices.end() ; ++vit) {
+    Vertex_handle v_cp;
+    std::vector<Vertex_handle> copies;
+    for (int i=0; i<3; i++)
+      for (int j=0; j<3; j++)
+	for (int k=0; k<3; k++) {
+	  if (i==0 && j==0 && k==0) continue;
+	  v_cp = _tds.create_vertex(*vit);
+	  copies.push_back(v_cp);
+	  virtual_vertices.insert(std::make_pair(v_cp,
+	      std::make_pair(*vit,Offset(i,j,k))));
+	}
+    virtual_vertices_reverse.insert(std::make_pair(*vit,copies));
+  }
+
+  // Create 27 copies of each cell from the respective copies of the
+  // vertices and write virtual_cells and virtual_cells_reverse.
+  typedef std::map<Cell_handle, std::pair<Cell_handle, Offset> >
+    Virtual_cell_map;
+  typedef std::map<Cell_handle, std::vector<Cell_handle > >
+    Virtual_cell_reverse_map;
+  typedef typename Virtual_cell_reverse_map::const_iterator VCRMIT;
+
+  Virtual_cell_map virtual_cells;
+  Virtual_cell_reverse_map virtual_cells_reverse;
+  
+  std::list<Cell_handle> original_cells;
+  for (Cell_iterator cit = cells_begin() ; cit != cells_end() ; ++cit)
+    original_cells.push_back(cit);
+
+  // Store vertex offsets in a separate data structure
+  std::list< Offset > off_v;
+  for (typename std::list<Vertex_handle>::iterator vit
+	 = original_vertices.begin() ; vit != original_vertices.end() ; ++vit) {
+    Cell_handle ccc = (*vit)->cell();
+    int v_index = ccc->index(*vit);
+    off_v.push_back(int_to_off(ccc->offset(v_index)));
+  }
+
+  // Store neighboring offsets in a separate data structure
+  std::list< array<Offset,4> > off_nb;
+  for (typename std::list<Cell_handle>::iterator cit = original_cells.begin() ;
+       cit != original_cells.end() ; ++cit) {
+    array<Offset,4> off_nb_c;
+    for (int i=0; i<4; i++){
+      Cell_handle ccc = *cit;
+      Cell_handle nnn = ccc->neighbor(i);
+      off_nb_c[i] = get_neighbor_offset(ccc,i,nnn);
+    }
+    off_nb.push_back(off_nb_c);
+  }
+
+  // Create copies of cells
+  for (typename std::list<Cell_handle>::iterator cit = original_cells.begin() ;
+       cit != original_cells.end() ; ++cit) {
+    Cell_handle c_cp;
+    Vertex_handle v0,v1,v2,v3;
+    std::vector<Cell_handle> copies;
+    Virtual_vertex_reverse_map_it vvrmit[4];
+    Offset vvoff[4];
+    for (int i=0; i<4; i++) {
+	vvrmit[i] = virtual_vertices_reverse.find((*cit)->vertex(i));
+	CGAL_triangulation_assertion(
+	    vvrmit[i] != virtual_vertices_reverse.end());
+	vvoff[i] = int_to_off((*cit)->offset(i));
+    }
+    Vertex_handle vvh[4];
+    for (int n=0; n<26; n++) {
+      for (int i=0; i<4; i++) {
+	// Decomposition of n into an offset (nx,ny,nz):
+	// nx = (n+1)/9, ny = ((n+1)/3)%3, nz = (n+1)%3
+	int o_i = ((n+1)/9+vvoff[i].x()+3)%3;
+	int o_j = ((n+1)/3+vvoff[i].y()+3)%3;
+	int o_k = ((n+1)+vvoff[i].z()+3)%3;
+	int n_c = 9*o_i+3*o_j+o_k-1;
+	CGAL_triangulation_assertion(n_c >= -1);
+	if (n_c == -1) vvh[i] = (*cit)->vertex(i);
+	else           vvh[i] = vvrmit[i]->second[n_c];
+      }
+      c_cp = _tds.create_cell(vvh[0], vvh[1], vvh[2], vvh[3]);
+      copies.push_back(c_cp);
+    }
+    virtual_cells_reverse.insert(std::make_pair(*cit,copies));
+  }
+
+  // Set new vertices of boundary cells of the original domain.
+  for (typename std::list<Cell_handle>::iterator cit = original_cells.begin() ;
+       cit != original_cells.end() ; ++cit) {
+    for (int i=0; i<4; i++) {
+      Virtual_vertex_reverse_map_it vvrmit
+	= virtual_vertices_reverse.find((*cit)->vertex(i));
+      CGAL_triangulation_assertion(vvrmit != virtual_vertices_reverse.end());
+      Offset vvoff = int_to_off((*cit)->offset(i));
+      if (!vvoff.is_null()) {
+	int n_c = 9*vvoff.x()+3*vvoff.y()+vvoff.z()-1;
+	CGAL_triangulation_assertion(n_c >= 0);
+	CGAL_triangulation_assertion(static_cast<unsigned int>(n_c) 
+	    < vvrmit->second.size());
+	(*cit)->set_vertex(i,vvrmit->second[n_c]);
+      }
+    }
+  }
+
+  // Set neighboring relations of cell copies
+  typename std::list< array<Offset,4> >::iterator oit = off_nb.begin() ; 
+  for (typename std::list<Cell_handle>::iterator cit = original_cells.begin();
+       cit != original_cells.end() ; ++cit, ++oit) {
+    CGAL_triangulation_assertion( oit != off_nb.end() );
+    VCRMIT c_cp = virtual_cells_reverse.find(*cit);
+    CGAL_triangulation_assertion(c_cp != virtual_cells_reverse.end());
+    for (int i=0; i<4; i++) {
+      Cell_handle cit_nb = (*cit)->neighbor(i);
+      VCRMIT c_cp_nb = virtual_cells_reverse.find(cit_nb);
+      CGAL_triangulation_assertion(c_cp_nb != virtual_cells_reverse.end());
+      Offset nboff = (*oit)[i];
+      for (int n=0; n<26; n++) {
+	int n_nb;
+ 	if (nboff.is_null()) n_nb = n;
+ 	else {
+ 	  int o_i = ((n+1)/9-nboff.x()+3)%3;
+ 	  int o_j = ((n+1)/3-nboff.y()+3)%3;
+ 	  int o_k = (n+1-nboff.z()+3)%3;
+ 	  n_nb = 9*o_i+3*o_j+o_k-1;
+ 	}
+	if (n_nb == -1) {
+	  CGAL_triangulation_assertion(cit_nb->has_vertex(
+		  c_cp->second[n]->vertex((i+1)%4)) );
+	  CGAL_triangulation_assertion(cit_nb->has_vertex(
+		  c_cp->second[n]->vertex((i+2)%4)) );
+	  CGAL_triangulation_assertion(cit_nb->has_vertex(
+		  c_cp->second[n]->vertex((i+3)%4)) );
+	  c_cp->second[n]->set_neighbor(i,cit_nb);
+	}
+	else {
+	  CGAL_triangulation_assertion(n_nb >= 0);
+	  CGAL_triangulation_assertion(static_cast<unsigned int>(n_nb)
+	      <= c_cp_nb->second.size());
+	  CGAL_triangulation_assertion(c_cp_nb->second[n_nb]
+			 ->has_vertex(c_cp->second[n]->vertex((i+1)%4)) );
+	  CGAL_triangulation_assertion(c_cp_nb->second[n_nb]
+			 ->has_vertex(c_cp->second[n]->vertex((i+2)%4)) );
+	  CGAL_triangulation_assertion(c_cp_nb->second[n_nb]
+			 ->has_vertex(c_cp->second[n]->vertex((i+3)%4)) );
+	  c_cp->second[n]->set_neighbor(i,c_cp_nb->second[n_nb]);
+	}
+      }
+    }
+  }
+
+  // Set neighboring relations of original cells
+  oit = off_nb.begin();
+  for (typename std::list<Cell_handle>::iterator cit = original_cells.begin();
+       cit != original_cells.end() ; ++cit, ++oit) {
+    CGAL_triangulation_assertion( oit != off_nb.end() );
+    for (int i=0; i<4; i++) {
+      Offset nboff = (*oit)[i];
+      if (!nboff.is_null()) {
+	Cell_handle cit_nb = (*cit)->neighbor(i);
+	VCRMIT c_cp_nb = virtual_cells_reverse.find(cit_nb);
+	CGAL_triangulation_assertion(c_cp_nb != virtual_cells_reverse.end());
+	int o_i = (3-nboff.x())%3;
+	int o_j = (3-nboff.y())%3;
+	int o_k = (3-nboff.z())%3;
+	int n_nb = 9*o_i+3*o_j+o_k-1;
+	CGAL_triangulation_assertion(n_nb >= 0);
+	CGAL_triangulation_assertion(static_cast<unsigned int>(n_nb)
+	    <= c_cp_nb->second.size());
+	CGAL_triangulation_assertion(c_cp_nb->second[n_nb]
+		       ->has_vertex((*cit)->vertex((i+1)%4)) );
+	CGAL_triangulation_assertion(c_cp_nb->second[n_nb]
+		       ->has_vertex((*cit)->vertex((i+2)%4)) );
+	CGAL_triangulation_assertion(c_cp_nb->second[n_nb]
+		       ->has_vertex((*cit)->vertex((i+3)%4)) );
+	(*cit)->set_neighbor(i,c_cp_nb->second[n_nb]);
+      }
+    }
+  }
+
+  // Set incident cells 
+  for (Cell_iterator cit = cells_begin() ; cit != cells_end() ; ++cit) {
+    for (int i=0 ; i<4 ; i++) {
+      cit->vertex(i)->set_cell(cit);
+    }
+  }
+
+  // Set offsets where necessary
+  for (typename std::list<Cell_handle>::iterator cit = original_cells.begin() ;
+       cit != original_cells.end() ; ++cit) {
+    VCRMIT c_cp = virtual_cells_reverse.find(*cit);
+    CGAL_triangulation_assertion( c_cp != virtual_cells_reverse.end());
+    Offset off[4];
+    for (int i=0; i<4; i++)
+      off[i] = int_to_off((*cit)->offset(i));
+    if (off[0].is_null() && off[1].is_null()
+	&& off[2].is_null() && off[3].is_null()) continue;
+    for (int n=0; n<26; n++) {
+      Offset off_cp[4];
+      int o_i = (n+1)/9;
+      int o_j = ((n+1)/3)%3;
+      int o_k = (n+1)%3;
+      if (o_i!=2 && o_j!=2 && o_k !=2) continue;
+      for (int i=0; i<4; i++) {
+	off_cp[i] = Offset((o_i==2)?off[i].x():0,
+			   (o_j==2)?off[i].y():0,
+			   (o_k==2)?off[i].z():0);
+	CGAL_triangulation_assertion(off_cp[i].x() == 0 || off_cp[i].x() == 1);
+	CGAL_triangulation_assertion(off_cp[i].y() == 0 || off_cp[i].y() == 1);
+	CGAL_triangulation_assertion(off_cp[i].z() == 0 || off_cp[i].z() == 1);
+      }
+      set_offsets(c_cp->second[n],off_cp[0],off_cp[1],off_cp[2],off_cp[3]);
+    }
+  }
+
+  // Iterate over all original cells and reset offsets.
+  for (typename std::list<Cell_handle>::iterator cit = original_cells.begin() ;
+       cit != original_cells.end() ; ++cit) {
+    //This statement does not seem to have any effect
+    set_offsets(*cit, 0,0,0,0);
+    CGAL_triangulation_assertion((*cit)->offset(0) == 0);
+    CGAL_triangulation_assertion((*cit)->offset(1) == 0);
+    CGAL_triangulation_assertion((*cit)->offset(2) == 0);
+    CGAL_triangulation_assertion((*cit)->offset(3) == 0);
+  }
+
+  _cover = make_array(3,3,3);
+  CGAL_triangulation_expensive_assertion(is_valid());
+
+  // Set up too long edges data structure
+  int i=0;
+  for (Vertex_iterator vit = vertices_begin(); vit != vertices_end(); ++vit) {
+    too_long_edges[vit] = std::list<Vertex_handle>();
+    ++i;
+  }
+  too_long_edge_counter = find_too_long_edges(too_long_edges);
+}
+
+// iterate over all edges and store the ones that are longer than
+// edge_length_threshold in edges. Return the number of too long edges.
+template < class GT, class TDS >
+inline int
+Periodic_3_triangulation_3<GT,TDS>::find_too_long_edges(
+    std::map<Vertex_handle, std::list<Vertex_handle> >& edges)
+const {
+  Point p1, p2;
+  int counter = 0;
+  Vertex_handle v_no,vh;
+  for (Edge_iterator eit = edges_begin();
+       eit != edges_end() ; eit++) {
+    p1 = construct_point(eit->first->vertex(eit->second)->point(),
+	get_offset(eit->first, eit->second));
+    p2 = construct_point(eit->first->vertex(eit->third)->point(),
+	get_offset(eit->first, eit->third));
+    if (squared_distance(p1,p2) > edge_length_threshold) {
+      if (&*(eit->first->vertex(eit->second)) <
+	  &*(eit->first->vertex(eit->third))) {
+	v_no = eit->first->vertex(eit->second);
+	vh = eit->first->vertex(eit->third);
+      } else {
+	v_no = eit->first->vertex(eit->third);
+	vh = eit->first->vertex(eit->second);
+      }
+      edges[v_no].push_back(vh);
+      counter++;
+    }
+  }
+  return counter;
+}
+
+template < class GT, class TDS >
+class Periodic_3_triangulation_3<GT,TDS>::Finder {
+  const Self* _t;
+  const Point & _p;
+public:
+  Finder(const Self* t, const Point &p) : _t(t), _p(p) {}
+  bool operator()(const Vertex_handle v) {
+    return _t->equal(v->point(), _p);
+  }
+};
+
+/** Find the cell that consists of the four given vertices
+ *
+ *  Iterates over all cells and compare the four vertices of each cell
+ *  with the four vertices in vh.
+ */
+template < class GT, class TDS >
+inline typename Periodic_3_triangulation_3<GT,TDS>::Cell_handle
+Periodic_3_triangulation_3<GT,TDS>::get_cell(const Vertex_handle* vh) const {
+  bool contains_v[4];
+  std::vector<Cell_handle> cells;
+  incident_cells(vh[3],std::back_inserter(cells));
+  for ( typename std::vector<Cell_handle>::iterator it = cells.begin();
+       it != cells.end(); it++ ) {
+    CGAL_triangulation_assertion(
+	(*it)->vertex(0) == vh[3] || (*it)->vertex(1) == vh[3]
+      ||(*it)->vertex(2) == vh[3] || (*it)->vertex(3) == vh[3]) ;
+    for ( int j=0 ; j<3 ; j++ ) {
+      contains_v[j] = false;
+      contains_v[j] = ( (*it)->vertex(0) == vh[j] )
+          || ( (*it)->vertex(1) == vh[j] )
+          || ( (*it)->vertex(2) == vh[j] )
+          || ( (*it)->vertex(3) == vh[j] );
+    }
+    if (contains_v[0] && contains_v[1] && contains_v[2]) {
+      return (*it);
+    }
+  }
+  CGAL_triangulation_assertion(false);
+  return Cell_handle();
+}
+
+/*! \brief Get the offset of tester.point() such that 
+ * this point is in conflict with c w.r.t tester.get_offset().
+ *
+ * Implementation: Just try all eight possibilities.
+ */
+template < class GT, class TDS >
+template < class Conflict_tester >
+inline typename Periodic_3_triangulation_3<GT,TDS>::Offset
+Periodic_3_triangulation_3<GT,TDS>::get_location_offset(
+    const Conflict_tester& tester, Cell_handle c) const {
+  CGAL_triangulation_precondition( number_of_vertices() != 0 );
+
+  //  CGAL_triangulation_precondition_code(Locate_type lt; int i; int j;);
+  //  CGAL_triangulation_precondition(side_of_cell(q,o,c,lt,i,j)
+  //      != ON_UNBOUNDED_SIDE);
+
+  int cumm_off = c->offset(0) | c->offset(1) | c->offset(2) | c->offset(3);
+  if (cumm_off == 0) {
+    // default case:
+    return Offset();
+  } else {
+    // Main idea seems to just test all possibilities.
+    for (int i=0; i<8; i++) {
+      if (((cumm_off | (~i))&7) == 7) {
+		  if (tester(c,int_to_off(i))) {
+			return int_to_off(i);
+        }
+      }
+    }
+  }
+  CGAL_triangulation_assertion(false);
+  return Offset();
+}
+
+/** Get the offset between the origins of the internal offset coordinate
+  * systems of two neighboring cells with respect from ch to nb.
+  *
+  * - Find two corresponding vertices from each cell
+  * - Return the difference of their offsets.
+  */
+template < class GT, class TDS >
+inline typename Periodic_3_triangulation_3<GT,TDS>::Offset
+Periodic_3_triangulation_3<GT,TDS>::get_neighbor_offset(
+    Cell_handle ch, int i, Cell_handle nb) const {
+  // Redundance in the signature!
+  CGAL_triangulation_precondition(ch->neighbor(i) == nb);
+  CGAL_triangulation_precondition(nb->neighbor(nb->index(ch)) == ch);
+  
+  Vertex_handle vertex_ch;
+  int index_ch, index_nb;
+  // ensure that vertex_ch \in nb and vertex_nb \in ch
+  index_ch = (i==0? 1 : 0);
+  vertex_ch = ch->vertex(index_ch);
+  index_nb = nb->index(vertex_ch);
+
+  return int_to_off(nb->offset(index_nb)) - int_to_off(ch->offset(index_ch));
+}
+
+/**
+ * - ch->offset(i) is an bit triple encapsulated in an integer. Each bit
+ *   represents the offset in one direction --> 2-cover!
+ * - it_to_off(int) decodes this again.
+ * - Finally the offset vector is multiplied by cover.
+ *   So if we are working in 3-cover we translate it to the neighboring
+ *   3-cover and not only to the neighboring domain.
+ */
+template < class GT, class TDS >
+inline void Periodic_3_triangulation_3<GT, TDS>::get_vertex(
+    Cell_handle ch, int i, Vertex_handle &vh, Offset &off) const {
+
+  off = combine_offsets(Offset(),int_to_off(ch->offset(i)));
+  vh = ch->vertex(i);
+  
+  if (is_1_cover()) return;
+  Vertex_handle vh_i = vh;
+  get_vertex(vh_i, vh, off);
+  return;
+}
+
+template < class GT, class TDS >
+inline void Periodic_3_triangulation_3<GT, TDS>::get_vertex(
+    Vertex_handle vh_i, Vertex_handle &vh, Offset &off) const {
+  
+  Virtual_vertex_map_it it = virtual_vertices.find(vh_i);
+
+  if (it == virtual_vertices.end()) {
+    // if ch->vertex(i) is not contained in virtual_vertices, then it is in
+    // the original domain.
+    vh = vh_i;
+    CGAL_triangulation_assertion(vh != Vertex_handle());
+  } else {
+    // otherwise it has to be looked up as well as its offset.
+    vh = it->second.first;
+    off += it->second.second;
+    CGAL_triangulation_assertion(vh->point().x() < _domain.xmax());
+    CGAL_triangulation_assertion(vh->point().y() < _domain.ymax());
+    CGAL_triangulation_assertion(vh->point().z() < _domain.zmax());
+    CGAL_triangulation_assertion(vh->point().x() >= _domain.xmin());
+    CGAL_triangulation_assertion(vh->point().y() >= _domain.ymin());
+    CGAL_triangulation_assertion(vh->point().z() >= _domain.zmin());
+  }
+}
+
+template < class GT, class TDS >
+std::istream & 
+operator>> (std::istream& is, Periodic_3_triangulation_3<GT,TDS> &tr)
+  // reads
+  // the current covering that guarantees the triangulation to be a
+  //     simplicial complex
+  // the number of vertices
+  // the non combinatorial information on vertices (points in case of 1-sheeted
+  //     covering, point-offset pairs otherwise)
+  //     ALL PERIODIC COPIES OF ONE VERTEX MUST BE STORED CONSECUTIVELY
+  // the number of cells
+  // the cells by the indices of their vertices in the preceding list
+  // of vertices, plus the non combinatorial information on each cell
+  // the neighbors of each cell by their index in the preceding list of cells
+{
+  CGAL_triangulation_precondition(is.good());
+
+  typedef Periodic_3_triangulation_3<GT,TDS>       Triangulation;
+  typedef typename GT::FT FT;
+  typedef typename Triangulation::size_type             size_type;
+  typedef typename Triangulation::Vertex_handle         Vertex_handle;
+  typedef typename Triangulation::Cell_handle           Cell_handle;
+  typedef typename Triangulation::Offset                Offset;
+  typedef typename Triangulation::Iso_cuboid            Iso_cuboid;
+
+  tr.clear();
+
+  Iso_cuboid domain(0,0,0,1,1,1);
+  int cx=0, cy=0, cz=0;
+  size_type n=0;
+
+  if (is_ascii(is)) {
+    is >> domain;
+    is >> cx >> cy >> cz;
+    is >> n;
+  }
+  else {
+    is >> domain;
+    read(is,cx);
+    read(is,cy);
+    read(is,cz);
+    read(is,n);
+  }
+ 
+  CGAL_triangulation_assertion((n/(cx*cy*cz))*cx*cy*cz == n);
+
+  tr.tds().set_dimension((n==0?-2:3));
+  tr._domain = domain;
+  tr._gt.set_domain(domain);
+  tr._cover = make_array(cx,cy,cz);
+
+  if ( n==0 ) return is;
+
+  std::vector< Vertex_handle > V(n);
+
+  if (cx==1 && cy==1 && cz==1) {
+    for (std::size_t i=0; i < n; i++) {
+      V[i] = tr.tds().create_vertex();
+      is >> *V[i];
+    }
+  } else {
+    Vertex_handle v,w;
+    std::vector<Vertex_handle> vv;
+    Offset off;
+    for (std::size_t i=0; i < n; i++) {
+      v = tr.tds().create_vertex();
+      V[i] = v;
+      is >> *V[i] >> off;
+      vv.clear();
+      for (int j=1; j<cx*cy*cz; j++) {
+        i++;
+        w = tr.tds().create_vertex();
+        V[i] = w;
+        is >> *V[i] >> off;
+        vv.push_back(w);
+        tr.virtual_vertices[w]=std::make_pair(v,off);
+      }
+      tr.virtual_vertices_reverse[v]=vv;
+    }
+  }
+  
+  std::vector< Cell_handle > C;
+  std::size_t m;
+  tr._tds.read_cells(is, V, m, C);
+
+  // read offsets
+  int off[4] = {0,0,0,0};
+  for (std::size_t j=0 ; j < m; j++) {
+    if (is_ascii(is))
+      is >> off[0] >> off[1] >> off[2] >> off[3];
+    else {
+      read(is,off[0]);
+      read(is,off[1]);
+      read(is,off[2]);
+      read(is,off[3]);
+    }
+    tr.set_offsets(C[j],off[0],off[1],off[2],off[3]);
+  }
+  
+  // read potential other information
+  for (std::size_t j=0 ; j < m; j++)
+    is >> *(C[j]);
+
+  typedef typename Triangulation::Vertex_iterator VI;
+
+  int i=0;
+  for (VI vi = tr.vertices_begin();
+      vi != tr.vertices_end(); ++vi) {
+    tr.too_long_edges[vi]=std::list<Vertex_handle>();
+    ++i;
+  }
+
+  tr.edge_length_threshold = FT(0.166) * (tr._domain.xmax()-tr._domain.xmin())
+                                       * (tr._domain.xmax()-tr._domain.xmin());
+  tr.too_long_edge_counter = tr.find_too_long_edges(tr.too_long_edges);
+
+  CGAL_triangulation_expensive_assertion( tr.is_valid() );
+  return is;
+}
+    
+template < class GT, class TDS >
+std::ostream & 
+operator<< (std::ostream& os,const Periodic_3_triangulation_3<GT,TDS> &tr)
+// writes :
+// the number of vertices
+// the domain as six coordinates: xmin ymin zmin xmax ymax zmax
+// the current covering that guarantees the triangulation to be a
+//     simplicial complex
+// the non combinatorial information on vertices (points in case of 1-sheeted
+//     covering, point-offset pairs otherwise)
+//     ALL PERIODIC COPIES OF ONE VERTEX MUST BE STORED CONSECUTIVELY
+// the number of cells
+// the cells by the indices of their vertices in the preceding list
+// of vertices, plus the non combinatorial information on each cell
+// the neighbors of each cell by their index in the preceding list of cells
+{
+  typedef Periodic_3_triangulation_3<GT,TDS>       Triangulation;
+  typedef typename Triangulation::size_type        size_type;
+  typedef typename Triangulation::Vertex_handle    Vertex_handle;
+  typedef typename Triangulation::Vertex_iterator  Vertex_iterator;
+  typedef typename Triangulation::Cell_handle      Cell_handle;
+  typedef typename Triangulation::Cell_iterator    Cell_iterator;
+  typedef typename Triangulation::Covering_sheets  Covering_sheets;
+  typedef typename Triangulation::Offset           Offset;
+  typedef typename Triangulation::Virtual_vertex_map_it Virtual_vertex_map_it;
+  typedef typename Triangulation::Iso_cuboid       Iso_cuboid;
+
+  // outputs dimension, domain and number of vertices
+  Iso_cuboid domain = tr.domain();
+  Covering_sheets cover = tr.number_of_sheets();
+  size_type n = tr.number_of_vertices();
+
+  if (is_ascii(os))
+    os << domain << std::endl
+       << cover[0] << " " << cover[1] << " " << cover[2] << std::endl
+       << n*cover[0]*cover[1]*cover[2] << std::endl;       
+  else {
+    os << domain;
+    write(os,cover[0]);
+    write(os,cover[1]);
+    write(os,cover[2]);
+    write(os,n*cover[0]*cover[1]*cover[2]);
+  }
+
+  if (n == 0)
+    return os;
+ 
+  // write the vertices
+  Unique_hash_map<Vertex_handle, std::size_t > V;
+  std::size_t i=0;
+  if (tr.is_1_cover()) {
+    for (Vertex_iterator it=tr.vertices_begin(); it!=tr.vertices_end(); ++it) {
+      V[it] = i++;
+      os << it->point();
+      if (is_ascii(os))
+        os << std::endl;
+    }
+  } else {
+    Virtual_vertex_map_it vit, vvit;
+    std::vector<Vertex_handle> vv;
+    for (Vertex_iterator it=tr.vertices_begin(); it!=tr.vertices_end(); ++it) {
+      vit = tr.virtual_vertices.find(it);
+      if (vit != tr.virtual_vertices.end()) continue;
+      V[it]=i++;
+      if (is_ascii(os))
+        os << it->point() << std::endl
+           << Offset(0,0,0) << std::endl;
+      else os << it->point() << Offset(0,0,0);
+      CGAL_triangulation_assertion(tr.virtual_vertices_reverse.find(it)
+          != tr.virtual_vertices_reverse.end());
+      vv = tr.virtual_vertices_reverse.find(it)->second;
+      CGAL_triangulation_assertion(vv.size() == 26);
+      for (std::size_t j=0; j<vv.size(); j++) {
+        vvit = tr.virtual_vertices.find(vv[j]);
+        CGAL_triangulation_assertion(vvit != tr.virtual_vertices.end());
+        V[vv[j]] = i++;
+        if (is_ascii(os))
+          os << vv[j]->point() << std::endl
+             << vvit->second.second << std::endl;
+        else os << vv[j]->point() << vvit->second.second;
+      }
+    }
+  }
+  CGAL_triangulation_postcondition(i==tr._cover[0]*tr._cover[1]*tr._cover[2]*n);
+  
+  // asks the tds for the combinatorial information
+  tr.tds().print_cells(os, V);
+  
+  // write offsets
+  //for (unsigned int i=0 ; i<tr.number_of_cells() ; i++) {
+  for (Cell_iterator it=tr.cells_begin(); it!=tr.cells_end(); ++it) {
+    //Cell_handle ch = std::find(tr.cells_begin(), tr.cells_end(), i);
+    Cell_handle ch(it);
+    for (int j=0; j<4; j++) {
+      if(is_ascii(os)) {
+	os << ch->offset(j);
+        if ( j==3 )
+          os << std::endl;
+        else
+          os << ' ';
+      }
+      else write(os,ch->offset(j));
+    }
+  }
+  
+  // write the non combinatorial information on the cells
+  // using the << operator of Cell
+  // works because the iterator of the tds traverses the cells in the
+  // same order as the iterator of the triangulation
+  if(tr.number_of_vertices() != 0) {
+      for(Cell_iterator it=tr.cells_begin(); it != tr.cells_end(); ++it) {
+    os << *it; // other information
+    if(is_ascii(os))
+      os << std::endl;
+    }
+  }
+  return os ;
+}
+
+namespace internal {
+
+  /// Internal function used by operator==.
+  // This function tests and registers the 4 neighbors of c1/c2,
+  // and performs a bfs traversal
+  // Returns false if an inequality has been found.
+  //TODO: introduce offsets
+  template <class GT, class TDS1, class TDS2>
+  bool
+  test_next(const Periodic_3_triangulation_3<GT, TDS1> &t1,
+            const Periodic_3_triangulation_3<GT, TDS2> & /* needed_for_deducing_TDS2 */,
+            typename Periodic_3_triangulation_3<GT, TDS1>::Cell_handle c1,
+            typename Periodic_3_triangulation_3<GT, TDS2>::Cell_handle c2,
+            std::map<typename Periodic_3_triangulation_3<GT, TDS1>::Cell_handle,
+            typename Periodic_3_triangulation_3<GT, TDS2>::Cell_handle> &Cmap,
+            std::map<typename Periodic_3_triangulation_3<GT, TDS1>::Vertex_handle,
+            typename Periodic_3_triangulation_3<GT, TDS2>::Vertex_handle> &Vmap)
+  {  
+    typedef Periodic_3_triangulation_3<GT, TDS1> Tr1;
+    typedef Periodic_3_triangulation_3<GT, TDS2> Tr2;
+    typedef typename Tr1::Vertex_handle  Vertex_handle1;
+    typedef typename Tr1::Cell_handle    Cell_handle1;
+    typedef typename Tr2::Vertex_handle  Vertex_handle2;
+    typedef typename Tr2::Cell_handle    Cell_handle2;
+    typedef typename std::map<Cell_handle1, Cell_handle2>::const_iterator  Cit;
+    typedef typename std::map<Vertex_handle1, Vertex_handle2>::const_iterator Vit;
+
+    std::vector<std::pair<Cell_handle1, Cell_handle2> > queue;
+    queue.push_back(std::make_pair(c1,c2));
+    
+    while(! queue.empty()){
+      boost::tie(c1,c2) = queue.back();
+      queue.pop_back();
+  
+      // Precondition: c1, c2 have been registered as well as their 4 vertices.
+      CGAL_triangulation_precondition(t1.number_of_vertices() != 0);
+      CGAL_triangulation_precondition(Cmap[c1] == c2);
+      CGAL_triangulation_precondition(Vmap.find(c1->vertex(0)) != Vmap.end());
+      CGAL_triangulation_precondition(Vmap.find(c1->vertex(1)) != Vmap.end());
+      CGAL_triangulation_precondition(Vmap.find(c1->vertex(2)) != Vmap.end());
+      CGAL_triangulation_precondition(Vmap.find(c1->vertex(3)) != Vmap.end());
+      
+
+      for (int i=0; i <= 3; ++i) {
+        Cell_handle1 n1 = c1->neighbor(i);
+        Cit cit = Cmap.find(n1);
+        Vertex_handle1 v1 = c1->vertex(i);
+        Vertex_handle2 v2 = Vmap[v1];
+        Cell_handle2 n2 = c2->neighbor(c2->index(v2));
+        if (cit != Cmap.end()) {
+          // n1 was already registered.
+          if (cit->second != n2)
+            return false;
+          continue;
+        }
+        // n1 has not yet been registered.
+        // We check that the new vertices match geometrically.
+        // And we register them.
+        Vertex_handle1 vn1 = n1->vertex(n1->index(c1));
+        Vertex_handle2 vn2 = n2->vertex(n2->index(c2));
+        Vit vit = Vmap.find(vn1);
+        if (vit != Vmap.end()) {
+          // vn1 already registered
+          if (vit->second != vn2)
+            return false;
+        }
+        else {
+          if (t1.geom_traits().compare_xyz_3_object()(vn1->point(),
+                                                      vn2->point()) != 0)
+            return false;
+          
+          // We register vn1/vn2.
+          Vmap.insert(std::make_pair(vn1, vn2));
+        }
+        
+        // We register n1/n2.
+        Cmap.insert(std::make_pair(n1, n2));
+        queue.push_back(std::make_pair(n1, n2));
+      }
+    }
+    return true;
+  }
+
+} // namespace internal
+
+
+template < class GT, class TDS1, class TDS2  >
+bool
+operator==(const Periodic_3_triangulation_3<GT,TDS1> &t1,
+     const Periodic_3_triangulation_3<GT,TDS2> &t2)
+{
+  typedef typename Periodic_3_triangulation_3<GT,TDS1>::Vertex_handle
+      Vertex_handle1;
+  typedef typename Periodic_3_triangulation_3<GT,TDS1>::Cell_handle  
+      Cell_handle1;
+  typedef typename Periodic_3_triangulation_3<GT,TDS2>::Vertex_handle
+      Vertex_handle2;
+  typedef typename Periodic_3_triangulation_3<GT,TDS2>::Vertex_handle
+      Vertex_iterator2;
+  typedef typename Periodic_3_triangulation_3<GT,TDS2>::Cell_handle
+      Cell_handle2;
+  
+  typedef typename Periodic_3_triangulation_3<GT,TDS1>::Point      Point;
+  typedef typename Periodic_3_triangulation_3<GT,TDS1>::Offset     Offset;
+
+  // typedef typename Periodic_3_triangulation_3<GT,TDS1>
+  //     ::Geometric_traits::Compare_xyz_3                       Compare_xyz_3;
+  // Compare_xyz_3 cmp1 = t1.geom_traits().compare_xyz_3_object();
+  // Compare_xyz_3 cmp2 = t2.geom_traits().compare_xyz_3_object();
+  
+  // Some quick checks.
+  if (   t1.domain()           != t2.domain()
+      || t1.number_of_sheets() != t2.number_of_sheets())
+    return false;
+
+  if (   t1.number_of_vertices() != t2.number_of_vertices()
+      || t1.number_of_cells() != t2.number_of_cells())
+    return false;
+
+  // Special case for empty triangulations
+  if (t1.number_of_vertices() == 0)
+    return true;
+
+  // We will store the mapping between the 2 triangulations vertices and
+  // cells in 2 maps.
+  std::map<Vertex_handle1, Vertex_handle2> Vmap;
+  std::map<Cell_handle1, Cell_handle2> Cmap;
+
+  // find a common point
+  Vertex_handle1 v1 = static_cast<Vertex_handle1>(t1.vertices_begin());
+  Vertex_handle2 iv2;
+  for (Vertex_iterator2 vit2 = t2.vertices_begin() ;
+      vit2 != t2.vertices_end(); ++vit2) {
+    if (!t1.equal(vit2->point(), v1->point(),
+		  t2.get_offset(vit2), t1.get_offset(v1)))
+      continue;
+    iv2 = static_cast<Vertex_handle2>(vit2);
+    break;
+  }
+  if (iv2 == Vertex_handle2())
+    return false;
+  Vmap.insert(std::make_pair(v1, iv2));
+
+  // We pick one cell of t1, and try to match it against the
+  // cells of t2.
+  Cell_handle1 c = v1->cell();
+  Vertex_handle1 v2 = c->vertex((c->index(v1)+1)%4);
+  Vertex_handle1 v3 = c->vertex((c->index(v1)+2)%4);
+  Vertex_handle1 v4 = c->vertex((c->index(v1)+3)%4);
+  Point p2 = v2->point();
+  Point p3 = v3->point();
+  Point p4 = v4->point();
+  Offset o2 = t1.get_offset(v2);
+  Offset o3 = t1.get_offset(v3);
+  Offset o4 = t1.get_offset(v4);
+
+  std::vector<Cell_handle2> ics;
+  t2.incident_cells(iv2, std::back_inserter(ics));
+  for (typename std::vector<Cell_handle2>::const_iterator cit = ics.begin();
+       cit != ics.end(); ++cit) {
+    int inf = (*cit)->index(iv2);
+
+    if (t1.equal(p2, (*cit)->vertex((inf+1)%4)->point(),
+	      o2, t2.get_offset((*cit)->vertex((inf+1)%4))))
+      Vmap.insert(std::make_pair(v2, (*cit)->vertex((inf+1)%4)));
+    else if (t1.equal(p2, (*cit)->vertex((inf+2)%4)->point(),
+	      o2, t2.get_offset((*cit)->vertex((inf+2)%4))))
+      Vmap.insert(std::make_pair(v2, (*cit)->vertex((inf+2)%4)));
+    else if (t1.equal(p2, (*cit)->vertex((inf+3)%4)->point(),
+	      o2, t2.get_offset((*cit)->vertex((inf+3)%4))))
+      Vmap.insert(std::make_pair(v2, (*cit)->vertex((inf+3)%4)));
+    else
+      continue; // None matched v2.
+
+    if (t1.equal(p3, (*cit)->vertex((inf+1)%4)->point(),
+	      o3, t2.get_offset((*cit)->vertex((inf+1)%4))))
+      Vmap.insert(std::make_pair(v3, (*cit)->vertex((inf+1)%4)));
+    else if (t1.equal(p3, (*cit)->vertex((inf+2)%4)->point(),
+	      o3, t2.get_offset((*cit)->vertex((inf+2)%4))))
+      Vmap.insert(std::make_pair(v3, (*cit)->vertex((inf+2)%4)));
+    else if (t1.equal(p3, (*cit)->vertex((inf+3)%4)->point(),
+	      o3, t2.get_offset((*cit)->vertex((inf+3)%4))))
+      Vmap.insert(std::make_pair(v3, (*cit)->vertex((inf+3)%4)));
+    else
+      continue; // None matched v3.
+
+    if (t1.equal(p4, (*cit)->vertex((inf+1)%4)->point(),
+	      o4, t2.get_offset((*cit)->vertex((inf+1)%4))))
+      Vmap.insert(std::make_pair(v4,(*cit)->vertex((inf+1)%4)));
+    else if (t1.equal(p4, (*cit)->vertex((inf+2)%4)->point(),
+	      o4, t2.get_offset((*cit)->vertex((inf+2)%4))))
+      Vmap.insert(std::make_pair(v4,(*cit)->vertex((inf+2)%4)));
+    else if (t1.equal(p4, (*cit)->vertex((inf+3)%4)->point(),
+	      o4, t2.get_offset((*cit)->vertex((inf+3)%4))))
+      Vmap.insert(std::make_pair(v4,(*cit)->vertex((inf+3)%4)));
+    else
+      continue; // None matched v4.
+
+    // Found it !
+    Cmap.insert(std::make_pair(c, *cit));
+    break;
+  }
+
+  if (Cmap.size() == 0)
+    return false;
+
+  // We now have one cell, we need to compare in a bfs graph traversal
+  return internal::test_next(t1, t2, Cmap.begin()->first, Cmap.begin()->second, Cmap, Vmap);
+}
+
+template < class GT, class TDS1, class TDS2 >
+inline
+bool
+operator!=(const Periodic_3_triangulation_3<GT,TDS1> &t1,
+    const Periodic_3_triangulation_3<GT,TDS2> &t2)
+{
+  return ! (t1 == t2);
+}
+
+} //namespace CGAL
+
+#endif // CGAL_PERIODIC_3_TRIANGULATION_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Periodic_3_triangulation_ds_cell_base_3.h b/3rdparty/CGAL/include/CGAL/Periodic_3_triangulation_ds_cell_base_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Periodic_3_triangulation_ds_cell_base_3.h
rename to 3rdparty/CGAL/include/CGAL/Periodic_3_triangulation_ds_cell_base_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Periodic_3_triangulation_ds_vertex_base_3.h b/3rdparty/CGAL/include/CGAL/Periodic_3_triangulation_ds_vertex_base_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Periodic_3_triangulation_ds_vertex_base_3.h
rename to 3rdparty/CGAL/include/CGAL/Periodic_3_triangulation_ds_vertex_base_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Periodic_3_triangulation_dummy_36.h b/3rdparty/CGAL/include/CGAL/Periodic_3_triangulation_dummy_36.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Periodic_3_triangulation_dummy_36.h
rename to 3rdparty/CGAL/include/CGAL/Periodic_3_triangulation_dummy_36.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Periodic_3_triangulation_hierarchy_3.h b/3rdparty/CGAL/include/CGAL/Periodic_3_triangulation_hierarchy_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Periodic_3_triangulation_hierarchy_3.h
rename to 3rdparty/CGAL/include/CGAL/Periodic_3_triangulation_hierarchy_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Periodic_3_triangulation_iterators_3.h b/3rdparty/CGAL/include/CGAL/Periodic_3_triangulation_iterators_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Periodic_3_triangulation_iterators_3.h
rename to 3rdparty/CGAL/include/CGAL/Periodic_3_triangulation_iterators_3.h
diff --git a/3rdparty/CGAL/include/CGAL/Periodic_3_triangulation_traits_3.h b/3rdparty/CGAL/include/CGAL/Periodic_3_triangulation_traits_3.h
new file mode 100644
index 0000000..94be44d
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Periodic_3_triangulation_traits_3.h
@@ -0,0 +1,152 @@
+// Copyright (c) 2006-2009   INRIA Sophia-Antipolis (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
+// 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(s)     : Nico Kruithof <Nico.Kruithof at sophia.inria.fr>
+//                 Manuel Caroli <Manuel.Caroli at sophia.inria.fr>
+
+#ifndef CGAL_PERIODIC_3_TRIANGULATION_TRAITS_3_H
+#define CGAL_PERIODIC_3_TRIANGULATION_TRAITS_3_H
+
+#include <CGAL/basic.h>
+#include <CGAL/Periodic_3_offset_3.h>
+#include <CGAL/Periodic_3_construct_point_3.h>
+#include <CGAL/triangulation_assertions.h>
+#include <CGAL/Traits_with_offsets_adaptor.h>
+#include <CGAL/internal/Has_boolean_tags.h>
+
+namespace CGAL { 
+
+template < class Kernel, class Off = typename CGAL::Periodic_3_offset_3 >
+class Periodic_3_triangulation_traits_base_3
+  : public Kernel
+{
+public:
+  typedef Kernel                                                 K;
+  typedef Off                                                    Offset;
+  typedef Periodic_3_triangulation_traits_base_3< K, Offset >    Self;  
+
+  typedef typename K::RT                RT;
+  typedef typename K::FT                FT;
+  typedef typename K::Point_3           Point_3;
+  typedef typename K::Vector_3          Vector_3;
+  typedef Offset                        Periodic_3_offset_3;
+  typedef typename K::Iso_cuboid_3      Iso_cuboid_3;
+
+  // The next typedef is there for backward compatibility
+  // Some users take their point type from the traits class.
+  // Before this type was Point
+  typedef Point_3 Point;
+
+  typedef typename K::Segment_3         Segment_3;
+  typedef typename K::Triangle_3        Triangle_3;
+  typedef typename K::Tetrahedron_3     Tetrahedron_3;
+
+  // Triangulation predicates
+  typedef Traits_with_offsets_adaptor<Self, typename K::Compare_xyz_3>
+      Compare_xyz_3;
+  typedef Traits_with_offsets_adaptor<Self, typename K::Orientation_3>
+      Orientation_3;
+  
+  // Triangulation constructions
+  typedef Periodic_3_construct_point_3<Self, typename K::Construct_point_3>
+      Construct_point_3;
+  typedef Traits_with_offsets_adaptor<Self, typename K::Construct_segment_3>
+      Construct_segment_3;
+  typedef Traits_with_offsets_adaptor<Self, typename K::Construct_triangle_3>
+      Construct_triangle_3;
+  typedef Traits_with_offsets_adaptor<Self, typename K::Construct_tetrahedron_3>
+      Construct_tetrahedron_3;
+
+  // Access
+  void set_domain(const Iso_cuboid_3& domain) {
+    _domain = domain;
+  }
+  
+  Iso_cuboid_3 get_domain() const {
+    return _domain;
+  }
+
+  // Operations
+  Compare_xyz_3
+  compare_xyz_3_object() const {
+    return Compare_xyz_3(&_domain);
+  }
+  Orientation_3
+  orientation_3_object() const {
+    return Orientation_3(&_domain);
+  }
+  Construct_point_3
+  construct_point_3_object() const {
+    return Construct_point_3(_domain);
+  }
+  Construct_segment_3
+  construct_segment_3_object() const {
+    return Construct_segment_3(&_domain);
+  }
+  Construct_triangle_3
+  construct_triangle_3_object() const {
+    return Construct_triangle_3(&_domain);
+  }
+  Construct_tetrahedron_3
+  construct_tetrahedron_3_object() const {
+    return Construct_tetrahedron_3(&_domain);
+  }
+
+protected:
+  Iso_cuboid_3 _domain;
+};
+
+
+template < typename K, typename Off = CGAL::Periodic_3_offset_3, bool Has_filtered_predicates = internal::Has_filtered_predicates<K>::value >
+class Periodic_3_triangulation_traits_3;
+
+} //namespace CGAL
+
+#include <CGAL/internal/Periodic_3_triangulation_filtered_traits_3.h>
+
+namespace CGAL {
+// This declaration is needed to break the cyclic dependency.
+template < typename K, typename Off, bool Has_static_filters >
+class Periodic_3_triangulation_filtered_traits_3;
+
+template < class K, class Off, bool Has_filtered_predicates >
+class Periodic_3_triangulation_traits_3
+  : public Periodic_3_triangulation_traits_base_3<K, Off>
+{
+};
+
+template < typename K, typename Off >
+class Periodic_3_triangulation_traits_3 < K, Off, true>
+  : public Periodic_3_triangulation_filtered_traits_3 < K, Off, internal::Has_static_filters<K>::value >
+{
+public:
+  typedef K Kernel;
+};
+
+} //namespace CGAL
+
+#include <CGAL/Periodic_3_Delaunay_triangulation_traits_3.h>
+
+
+namespace CGAL
+{
+template < typename K, typename Off, bool Has_filtered_predicates >
+class Periodic_3_Delaunay_triangulation_traits_3;
+}
+
+#endif // CGAL_PERIODIC_3_TRIANGULATION_TRAITS_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Plane_3.h b/3rdparty/CGAL/include/CGAL/Plane_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Plane_3.h
rename to 3rdparty/CGAL/include/CGAL/Plane_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Plane_separator.h b/3rdparty/CGAL/include/CGAL/Plane_separator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Plane_separator.h
rename to 3rdparty/CGAL/include/CGAL/Plane_separator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Point_2.h b/3rdparty/CGAL/include/CGAL/Point_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Point_2.h
rename to 3rdparty/CGAL/include/CGAL/Point_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Point_2_Iso_rectangle_2_intersection.h b/3rdparty/CGAL/include/CGAL/Point_2_Iso_rectangle_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Point_2_Iso_rectangle_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Point_2_Iso_rectangle_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Point_2_Line_2_intersection.h b/3rdparty/CGAL/include/CGAL/Point_2_Line_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Point_2_Line_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Point_2_Line_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Point_2_Point_2_intersection.h b/3rdparty/CGAL/include/CGAL/Point_2_Point_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Point_2_Point_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Point_2_Point_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Point_2_Ray_2_intersection.h b/3rdparty/CGAL/include/CGAL/Point_2_Ray_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Point_2_Ray_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Point_2_Ray_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Point_2_Segment_2_intersection.h b/3rdparty/CGAL/include/CGAL/Point_2_Segment_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Point_2_Segment_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Point_2_Segment_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Point_2_Triangle_2_intersection.h b/3rdparty/CGAL/include/CGAL/Point_2_Triangle_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Point_2_Triangle_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Point_2_Triangle_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Point_3.h b/3rdparty/CGAL/include/CGAL/Point_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Point_3.h
rename to 3rdparty/CGAL/include/CGAL/Point_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Point_container.h b/3rdparty/CGAL/include/CGAL/Point_container.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Point_container.h
rename to 3rdparty/CGAL/include/CGAL/Point_container.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Point_set_2.h b/3rdparty/CGAL/include/CGAL/Point_set_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Point_set_2.h
rename to 3rdparty/CGAL/include/CGAL/Point_set_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Point_traits.h b/3rdparty/CGAL/include/CGAL/Point_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Point_traits.h
rename to 3rdparty/CGAL/include/CGAL/Point_traits.h
diff --git a/3rdparty/CGAL/include/CGAL/Point_with_normal_3.h b/3rdparty/CGAL/include/CGAL/Point_with_normal_3.h
new file mode 100644
index 0000000..6738847
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Point_with_normal_3.h
@@ -0,0 +1,172 @@
+// Copyright (c) 2007-2009  INRIA (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
+// 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(s)     : Laurent Saboret, Pierre Alliez
+
+#ifndef CGAL_POINT_WITH_NORMAL_3_H
+#define CGAL_POINT_WITH_NORMAL_3_H
+
+#include <CGAL/Point_3.h>
+#include <CGAL/Vector_3.h>
+#include <CGAL/Origin.h>
+#include <CGAL/value_type_traits.h>
+#include <CGAL/property_map.h>
+
+
+namespace CGAL {
+
+/// \cond SKIP_IN_MANUAL
+  
+/// The Point_with_normal_3 class represents a 3D point with:
+/// - a position,
+/// - a normal (oriented).
+///
+/// @heading Parameters:
+/// @param Gt       Geometric traits class.
+
+template<class Gt>
+class Point_with_normal_3 : public Gt::Point_3
+{
+// Private types
+private:
+
+  typedef typename Gt::Point_3  Base;
+
+// Public types
+public:
+
+    typedef Gt Geom_traits; ///< Geometric traits class
+    typedef typename Geom_traits::FT FT;
+    typedef typename Geom_traits::RT RT;
+    typedef typename Geom_traits::Point_3  Point;  ///< typedef to Geom_traits::Point_3
+    typedef typename Geom_traits::Vector_3 Vector; ///< typedef to Geom_traits::Vector_3
+
+// Public methods
+public:
+
+    /// Point is (0,0,0) by default.
+    /// Normal is (0,0,0) by default.
+    Point_with_normal_3(const Origin& o = ORIGIN)
+    : Base(o)
+    {
+    }
+    Point_with_normal_3(FT x, FT y, FT z,
+                        const Vector& normal = NULL_VECTOR)
+    : Base(x,y,z),
+      m_normal(normal)
+    {
+    }
+    Point_with_normal_3(RT hx, RT hy, RT hz, RT hw,
+                        const Vector& normal = NULL_VECTOR)
+    : Base(hx,hy,hz,hw),
+      m_normal(normal)
+    {
+    }
+    Point_with_normal_3(const Point& point,
+                        const Vector& normal = NULL_VECTOR)
+    : Base(point),
+      m_normal(normal)
+    {
+    }
+
+    /// Copy constructor
+    Point_with_normal_3(const Point_with_normal_3& pwn)
+    : Base(pwn),
+      m_normal(pwn.normal())
+    {
+    }
+    template <class K>
+    Point_with_normal_3(const Point_with_normal_3<K>& pwn)
+    : Base(pwn),
+      m_normal(pwn.normal())
+    {
+    }
+    /// Operator =()
+    Point_with_normal_3& operator=(const Point_with_normal_3& pwn)
+    {
+      Base::operator=(pwn);
+      m_normal = pwn.normal();
+      return *this;
+    }
+
+    /// Gets/sets position.
+    const Point& position() const { return *this; }
+    Point&       position()       { return *this; }
+
+    /// Gets/sets normal.
+    const Vector& normal() const { return m_normal; }
+    Vector&       normal()       { return m_normal; }
+
+// Data
+private:
+
+    Vector  m_normal;
+};
+
+
+//=========================================================================
+
+
+/// Property map that accesses the normal vector from a Point_with_normal_3 object
+///
+/// @heading Is Model for the Concepts:
+/// \cgalModels `LvaluePropertyMap`
+///
+/// @heading Parameters:
+/// @param Gt Geometric traits class.
+
+template <class Gt>
+struct Normal_of_point_with_normal_pmap
+{
+  typedef Point_with_normal_3<Gt> Point_with_normal; ///< Position + normal
+  typedef typename Gt::Vector_3 Vector; /// normal
+
+  typedef Point_with_normal key_type;
+  typedef Vector value_type;
+  typedef const value_type& reference;
+  typedef boost::lvalue_property_map_tag category;
+
+  /// Access a property map element
+  value_type& operator[](key_type& pwn) const { return pwn.normal(); }
+
+  typedef Normal_of_point_with_normal_pmap<Gt> Self;
+  /// \name Put/get free functions
+  /// @{
+  friend reference get(const Self&,const key_type& k) {return k.normal();}
+  friend void put(const Self&,key_type& k, const value_type& v) {k.normal()=v;}
+  /// @};}
+};
+
+/// Free function to create a Normal_of_point_with_normal_pmap property map.
+///
+/// @relates Normal_of_point_with_normal_pmap
+
+template <class Point_with_normal> // Point_with_normal type
+Normal_of_point_with_normal_pmap<
+  typename CGAL::Kernel_traits<Point_with_normal>::Kernel>
+  make_normal_of_point_with_normal_pmap(Point_with_normal)
+{
+  return Normal_of_point_with_normal_pmap<typename CGAL::Kernel_traits<Point_with_normal>::Kernel>();
+}
+
+/// \endcond
+
+} //namespace CGAL
+
+
+#endif //CGAL_POINT_WITH_NORMAL_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Point_with_psc_localisation.h b/3rdparty/CGAL/include/CGAL/Point_with_psc_localisation.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Point_with_psc_localisation.h
rename to 3rdparty/CGAL/include/CGAL/Point_with_psc_localisation.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Point_with_surface_index.h b/3rdparty/CGAL/include/CGAL/Point_with_surface_index.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Point_with_surface_index.h
rename to 3rdparty/CGAL/include/CGAL/Point_with_surface_index.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Point_with_surface_index_geom_traits.h b/3rdparty/CGAL/include/CGAL/Point_with_surface_index_geom_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Point_with_surface_index_geom_traits.h
rename to 3rdparty/CGAL/include/CGAL/Point_with_surface_index_geom_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Poisson_implicit_surface_3.h b/3rdparty/CGAL/include/CGAL/Poisson_implicit_surface_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Poisson_implicit_surface_3.h
rename to 3rdparty/CGAL/include/CGAL/Poisson_implicit_surface_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Poisson_mesh_cell_criteria_3.h b/3rdparty/CGAL/include/CGAL/Poisson_mesh_cell_criteria_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Poisson_mesh_cell_criteria_3.h
rename to 3rdparty/CGAL/include/CGAL/Poisson_mesh_cell_criteria_3.h
diff --git a/3rdparty/CGAL/include/CGAL/Poisson_reconstruction_function.h b/3rdparty/CGAL/include/CGAL/Poisson_reconstruction_function.h
new file mode 100644
index 0000000..762bac7
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Poisson_reconstruction_function.h
@@ -0,0 +1,1218 @@
+// Copyright (c) 2007-09  INRIA (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
+// 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(s)     : Laurent Saboret, Pierre Alliez
+
+#ifndef CGAL_POISSON_RECONSTRUCTION_FUNCTION_H
+#define CGAL_POISSON_RECONSTRUCTION_FUNCTION_H
+
+#ifndef CGAL_DIV_NORMALIZED
+#  ifndef CGAL_DIV_NON_NORMALIZED
+#    define CGAL_DIV_NON_NORMALIZED 1
+#  endif
+#endif
+
+#include <vector>
+#include <deque>
+#include <algorithm>
+#include <cmath>
+#include <iterator>
+
+#include <CGAL/trace.h>
+#include <CGAL/Reconstruction_triangulation_3.h>
+#include <CGAL/spatial_sort.h>
+#ifdef CGAL_EIGEN3_ENABLED
+#include <CGAL/Eigen_solver_traits.h>
+#else
+#endif
+#include <CGAL/centroid.h>
+#include <CGAL/property_map.h>
+#include <CGAL/surface_reconstruction_points_assertions.h>
+#include <CGAL/poisson_refine_triangulation.h>
+#include <CGAL/Robust_circumcenter_filtered_traits_3.h>
+#include <CGAL/compute_average_spacing.h>
+#include <CGAL/Timer.h>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/array.hpp>
+#include <boost/type_traits/is_convertible.hpp>
+#include <boost/utility/enable_if.hpp>
+
+/*! 
+  \file Poisson_reconstruction_function.h
+*/
+
+namespace CGAL {
+
+  namespace internal {
+template <class RT>
+bool
+invert(
+       const RT& a0,  const RT& a1,  const RT& a2,
+       const RT& a3,  const RT& a4,  const RT& a5,
+       const RT& a6,  const RT& a7,  const RT& a8,
+       RT& i0,   RT& i1,   RT& i2,
+       RT& i3,   RT& i4,   RT& i5,
+       RT& i6,   RT& i7,   RT& i8)
+{
+    // Compute the adjoint.
+    i0 = a4*a8 - a5*a7;
+    i1 = a2*a7 - a1*a8;
+    i2 = a1*a5 - a2*a4;
+    i3 = a5*a6 - a3*a8;
+    i4 = a0*a8 - a2*a6;
+    i5 = a2*a3 - a0*a5;
+    i6 = a3*a7 - a4*a6;
+    i7 = a1*a6 - a0*a7;
+    i8 = a0*a4 - a1*a3;
+
+    RT det = a0*i0 + a1*i3 + a2*i6;
+
+    if(det != 0) {
+      RT idet = (RT(1.0))/det;
+      i0 *= idet;
+      i1 *= idet;
+      i2 *= idet;
+      i3 *= idet;
+      i4 *= idet;
+      i5 *= idet;
+      i6 *= idet;
+      i7 *= idet;
+      i8 *= idet;
+      return true;
+    }
+
+    return false;
+}
+
+  }
+
+
+/// \cond SKIP_IN_MANUAL
+struct Poisson_visitor {
+  void before_insertion() const
+  {}
+};
+
+struct Poisson_skip_vertices { 
+  double ratio;
+  Random& m_random;
+  Poisson_skip_vertices(const double ratio, Random& random)
+    : ratio(ratio), m_random(random) {}
+
+  template <typename Iterator>
+  bool operator()(Iterator) const {
+    return m_random.get_double() < ratio;
+  }
+};
+
+// Given f1 and f2, two sizing fields, that functor wrapper returns
+//   max(f1, f2*f2)
+// The wrapper stores only pointers to the two functors.
+template <typename F1, typename F2>
+struct Special_wrapper_of_two_functions_keep_pointers {
+  F1 *f1;
+  F2 *f2;
+  Special_wrapper_of_two_functions_keep_pointers(F1* f1, F2* f2) 
+    : f1(f1), f2(f2) {}
+
+  template <typename X>
+  double operator()(const X& x) const {
+    return (std::max)((*f1)(x), CGAL::square((*f2)(x)));
+  }
+
+  template <typename X>
+  double operator()(const X& x) {
+    return (std::max)((*f1)(x), CGAL::square((*f2)(x)));
+  }
+}; // end struct Special_wrapper_of_two_functions_keep_pointers<F1, F2>
+/// \endcond 
+
+
+/*!
+\ingroup PkgPoissonSurfaceReconstruction
+
+\brief Implementation of the Poisson Surface Reconstruction method.
+  
+Given a set of 3D points with oriented normals sampled on the boundary
+of a 3D solid, the Poisson Surface Reconstruction method \cgalCite{Kazhdan06} 
+solves for an approximate indicator function of the inferred
+solid, whose gradient best matches the input normals. The output
+scalar function, represented in an adaptive octree, is then
+iso-contoured using an adaptive marching cubes.
+
+`Poisson_reconstruction_function` implements a variant of this
+algorithm which solves for a piecewise linear function on a 3D
+Delaunay triangulation instead of an adaptive octree.
+
+\tparam Gt Geometric traits class. 
+
+\cgalModels `ImplicitFunction`
+
+*/
+template <class Gt>
+class Poisson_reconstruction_function
+{
+// Public types
+public:
+
+  /// \name Types 
+  /// @{
+
+  typedef Gt Geom_traits; ///< Geometric traits class
+  /// \cond SKIP_IN_MANUAL
+  typedef Reconstruction_triangulation_3<Robust_circumcenter_filtered_traits_3<Gt> >
+                                                   Triangulation;
+  /// \endcond
+  typedef typename Triangulation::Cell_handle   Cell_handle;
+
+  // Geometric types
+  typedef typename Geom_traits::FT FT; ///< number type.
+  typedef typename Geom_traits::Point_3 Point; ///< point type.
+  typedef typename Geom_traits::Vector_3 Vector; ///< vector type.
+  typedef typename Geom_traits::Sphere_3 Sphere; 
+
+  /// @}
+
+// Private types
+private:
+
+  // Internal 3D triangulation, of type Reconstruction_triangulation_3.
+  // Note: poisson_refine_triangulation() requires a robust circumcenter computation.
+
+  // Repeat Triangulation types
+  typedef typename Triangulation::Triangulation_data_structure Triangulation_data_structure;
+  typedef typename Geom_traits::Ray_3 Ray;
+  typedef typename Geom_traits::Plane_3 Plane;
+  typedef typename Geom_traits::Segment_3 Segment;
+  typedef typename Geom_traits::Triangle_3 Triangle;
+  typedef typename Geom_traits::Tetrahedron_3 Tetrahedron;
+  typedef typename Triangulation::Vertex_handle Vertex_handle;
+  typedef typename Triangulation::Cell   Cell;
+  typedef typename Triangulation::Vertex Vertex;
+  typedef typename Triangulation::Facet  Facet;
+  typedef typename Triangulation::Edge   Edge;
+  typedef typename Triangulation::Cell_circulator  Cell_circulator;
+  typedef typename Triangulation::Facet_circulator Facet_circulator;
+  typedef typename Triangulation::Cell_iterator    Cell_iterator;
+  typedef typename Triangulation::Facet_iterator   Facet_iterator;
+  typedef typename Triangulation::Edge_iterator    Edge_iterator;
+  typedef typename Triangulation::Vertex_iterator  Vertex_iterator;
+  typedef typename Triangulation::Point_iterator   Point_iterator;
+  typedef typename Triangulation::Finite_vertices_iterator Finite_vertices_iterator;
+  typedef typename Triangulation::Finite_cells_iterator    Finite_cells_iterator;
+  typedef typename Triangulation::Finite_facets_iterator   Finite_facets_iterator;
+  typedef typename Triangulation::Finite_edges_iterator    Finite_edges_iterator;
+  typedef typename Triangulation::All_cells_iterator       All_cells_iterator;
+  typedef typename Triangulation::Locate_type Locate_type;
+
+// Data members.
+// Warning: the Surface Mesh Generation package makes copies of implicit functions,
+// thus this class must be lightweight and stateless.
+private:
+
+  // operator() is pre-computed on vertices of *m_tr by solving
+  // the Poisson equation Laplacian(f) = divergent(normals field).
+  boost::shared_ptr<Triangulation> m_tr;
+
+  mutable boost::shared_ptr<std::vector<boost::array<double,9> > > m_Bary;
+  mutable std::vector<Point> Dual;
+  mutable std::vector<Vector> Normal;
+
+  // contouring and meshing
+  Point m_sink; // Point with the minimum value of operator()
+  mutable Cell_handle m_hint; // last cell found = hint for next search
+
+  FT average_spacing;
+
+
+  /// function to be used for the different constructors available that are
+  /// doing the same thing but with default template parameters
+  template <typename InputIterator,
+            typename PointPMap,
+            typename NormalPMap,
+            typename Visitor
+  >
+  void forward_constructor(
+    InputIterator first,
+    InputIterator beyond,
+    PointPMap point_pmap,
+    NormalPMap normal_pmap,
+    Visitor visitor)
+  {
+    CGAL::Timer task_timer; task_timer.start();
+    CGAL_TRACE_STREAM << "Creates Poisson triangulation...\n";
+
+    // Inserts points in triangulation
+    m_tr->insert(
+      first,beyond,
+      point_pmap,
+      normal_pmap,
+      visitor);
+
+    // Prints status
+    CGAL_TRACE_STREAM << "Creates Poisson triangulation: " << task_timer.time() << " seconds, "
+                                                           << std::endl;
+  }
+
+
+// Public methods
+public:
+
+  /// \name Creation 
+  /// @{
+
+
+  /*! 
+    Creates a Poisson implicit function from the  range of points `[first, beyond)`. 
+
+    \tparam InputIterator iterator over input points. 
+
+    \tparam PointPMap is a model of `ReadablePropertyMap` with
+      a `value_type = Point`.  It can be omitted if `InputIterator`
+      `value_type` is convertible to `Point`. 
+    
+    \tparam NormalPMap is a model of `ReadablePropertyMap`
+      with a `value_type = Vector`.
+  */ 
+  template <typename InputIterator,
+            typename PointPMap,
+            typename NormalPMap
+  >
+  Poisson_reconstruction_function(
+    InputIterator first,  ///< iterator over the first input point.
+    InputIterator beyond, ///< past-the-end iterator over the input points.
+    PointPMap point_pmap, ///< property map: `value_type of InputIterator` -> `Point` (the position of an input point).
+    NormalPMap normal_pmap ///< property map: `value_type of InputIterator` -> `Vector` (the *oriented* normal of an input point).
+  )
+    : m_tr(new Triangulation), m_Bary(new std::vector<boost::array<double,9> > )
+    , average_spacing(CGAL::compute_average_spacing<CGAL::Sequential_tag>(first, beyond, point_pmap, 6))
+  {
+    forward_constructor(first, beyond, point_pmap, normal_pmap, Poisson_visitor());
+  }
+
+  /// \cond SKIP_IN_MANUAL
+  template <typename InputIterator,
+            typename PointPMap,
+            typename NormalPMap,
+            typename Visitor
+  >
+  Poisson_reconstruction_function(
+    InputIterator first,  ///< iterator over the first input point.
+    InputIterator beyond, ///< past-the-end iterator over the input points.
+    PointPMap point_pmap, ///< property map: `value_type of InputIterator` -> `Point` (the position of an input point).
+    NormalPMap normal_pmap, ///< property map: `value_type of InputIterator` -> `Vector` (the *oriented* normal of an input point).
+    Visitor visitor)
+    : m_tr(new Triangulation), m_Bary(new std::vector<boost::array<double,9> > )
+    , average_spacing(CGAL::compute_average_spacing<CGAL::Sequential_tag>(first, beyond, point_pmap, 6))
+  {
+    forward_constructor(first, beyond, point_pmap, normal_pmap, visitor);
+  }
+
+  // This variant creates a default point property map = Identity_property_map and Visitor=Poisson_visitor
+  template <typename InputIterator,
+            typename NormalPMap
+  >
+  Poisson_reconstruction_function(
+    InputIterator first,  ///< iterator over the first input point.
+    InputIterator beyond, ///< past-the-end iterator over the input points.
+    NormalPMap normal_pmap, ///< property map: `value_type of InputIterator` -> `Vector` (the *oriented* normal of an input point).
+    typename boost::enable_if<
+      boost::is_convertible<typename std::iterator_traits<InputIterator>::value_type, Point>
+    >::type* = 0
+  )
+  : m_tr(new Triangulation), m_Bary(new std::vector<boost::array<double,9> > )
+  , average_spacing(CGAL::compute_average_spacing<CGAL::Sequential_tag>(first, beyond, 6))
+  {
+    forward_constructor(first, beyond, 
+      make_identity_property_map(
+      typename std::iterator_traits<InputIterator>::value_type()),
+      normal_pmap, Poisson_visitor());
+    CGAL::Timer task_timer; task_timer.start();
+  }
+  /// \endcond
+
+  /// @}
+
+  /// \name Operations
+  /// @{
+
+  /// Returns a sphere bounding the inferred surface.
+  Sphere bounding_sphere() const
+  {
+    return m_tr->bounding_sphere();
+  }
+  
+  /// \cond SKIP_IN_MANUAL
+  const Triangulation& tr() const {
+    return *m_tr;
+  }
+  
+  // This variant requires all parameters.
+  template <class SparseLinearAlgebraTraits_d,
+            class Visitor>
+  bool compute_implicit_function(
+                                 SparseLinearAlgebraTraits_d solver,// = SparseLinearAlgebraTraits_d(),
+                                 Visitor visitor,
+                                 double approximation_ratio = 0,
+                                 double average_spacing_ratio = 5) 
+  {
+    CGAL::Timer task_timer; task_timer.start();
+    CGAL_TRACE_STREAM << "Delaunay refinement...\n";
+
+    // Delaunay refinement
+    const FT radius_edge_ratio_bound = 2.5;
+    const unsigned int max_vertices = (unsigned int)1e7; // max 10M vertices
+    const FT enlarge_ratio = 1.5;
+    const FT radius = sqrt(bounding_sphere().squared_radius()); // get triangulation's radius
+    const FT cell_radius_bound = radius/5.; // large
+
+    internal::Poisson::Constant_sizing_field<Triangulation> sizing_field(CGAL::square(cell_radius_bound));
+
+    std::vector<int> NB; 
+
+    NB.push_back( delaunay_refinement(radius_edge_ratio_bound,sizing_field,max_vertices,enlarge_ratio));
+
+    while(m_tr->insert_fraction(visitor)){
+
+      NB.push_back( delaunay_refinement(radius_edge_ratio_bound,sizing_field,max_vertices,enlarge_ratio));
+    }
+
+    if(approximation_ratio > 0. && 
+       approximation_ratio * std::distance(m_tr->input_points_begin(),
+                                           m_tr->input_points_end()) > 20) {
+
+      // Add a pass of Delaunay refinement.
+      //
+      // In that pass, the sizing field, of the refinement process of the
+      // triangulation, is based on the result of a poisson function with a
+      // sample of the input points. The ratio is 'approximation_ratio'.
+      //
+      // For optimization reasons, the cell criteria of the refinement
+      // process uses two sizing fields:
+      //
+      //   - the minimum of the square of 'coarse_poisson_function' and the
+      // square of the constant field equal to 'average_spacing',
+      //
+      //   - a second sizing field that is constant, and equal to:
+      //
+      //         average_spacing*average_spacing_ratio
+      //
+      // If a given cell is smaller than the constant second sizing field,
+      // then the cell is considered as small enough, and the first sizing
+      // field, more costly, is not evaluated.
+
+      typedef Filter_iterator<typename Triangulation::Input_point_iterator,
+                              Poisson_skip_vertices> Some_points_iterator;
+      //make it deterministic
+      Random random(0);
+      Poisson_skip_vertices skip(1.-approximation_ratio,random);
+      
+      CGAL_TRACE_STREAM << "SPECIAL PASS that uses an approximation of the result (approximation ratio: "
+                << approximation_ratio << ")" << std::endl;
+      CGAL::Timer approximation_timer; approximation_timer.start();
+
+      CGAL::Timer sizing_field_timer; sizing_field_timer.start();
+      Poisson_reconstruction_function<Geom_traits> 
+        coarse_poisson_function(Some_points_iterator(m_tr->input_points_end(),
+                                                     skip,
+                                                     m_tr->input_points_begin()),
+                                Some_points_iterator(m_tr->input_points_end(),
+                                                     skip),
+                                Normal_of_point_with_normal_pmap<Geom_traits>() );
+      coarse_poisson_function.compute_implicit_function(solver, Poisson_visitor(),
+                                                        0.);
+      internal::Poisson::Constant_sizing_field<Triangulation> 
+        min_sizing_field(CGAL::square(average_spacing));
+      internal::Poisson::Constant_sizing_field<Triangulation> 
+        sizing_field_ok(CGAL::square(average_spacing*average_spacing_ratio));
+
+      Special_wrapper_of_two_functions_keep_pointers<
+        internal::Poisson::Constant_sizing_field<Triangulation>,
+        Poisson_reconstruction_function<Geom_traits> > sizing_field2(&min_sizing_field,
+                                                                     &coarse_poisson_function);
+        
+      sizing_field_timer.stop();
+      std::cerr << "Construction time of the sizing field: " << sizing_field_timer.time() 
+                << " seconds" << std::endl;
+
+      NB.push_back( delaunay_refinement(radius_edge_ratio_bound,
+                                        sizing_field2,
+                                        max_vertices,
+                                        enlarge_ratio,
+                                        sizing_field_ok) );
+      approximation_timer.stop();
+      CGAL_TRACE_STREAM << "SPECIAL PASS END (" << approximation_timer.time() <<  " seconds)" << std::endl;
+    }
+
+    
+    // Prints status
+    CGAL_TRACE_STREAM << "Delaunay refinement: " << "added ";
+    for(std::size_t i = 0; i < NB.size()-1; i++){
+      CGAL_TRACE_STREAM << NB[i] << " + "; 
+    } 
+    CGAL_TRACE_STREAM << NB.back() << " Steiner points, "
+                      << task_timer.time() << " seconds, "
+                      << std::endl;
+    task_timer.reset();
+
+#ifdef CGAL_DIV_NON_NORMALIZED
+    CGAL_TRACE_STREAM << "Solve Poisson equation with non-normalized divergence...\n";
+#else
+    CGAL_TRACE_STREAM << "Solve Poisson equation with normalized divergence...\n";
+#endif
+
+    // Computes the Poisson indicator function operator()
+    // at each vertex of the triangulation.
+    double lambda = 0.1;
+    if ( ! solve_poisson(solver, lambda) )
+    {
+      std::cerr << "Error: cannot solve Poisson equation" << std::endl;
+      return false;
+    }
+
+    // Shift and orient operator() such that:
+    // - operator() = 0 on the input points,
+    // - operator() < 0 inside the surface.
+    set_contouring_value(median_value_at_input_vertices());
+
+    // Prints status
+    CGAL_TRACE_STREAM << "Solve Poisson equation: " << task_timer.time() << " seconds, "
+                                                    << std::endl;
+    task_timer.reset();
+
+    return true;
+  }
+  /// \endcond
+
+  /*!
+    This function must be called after the
+    insertion of oriented points. It computes the piecewise linear scalar
+    function operator() by: applying Delaunay refinement, solving for
+    operator() at each vertex of the triangulation with a sparse linear
+    solver, and shifting and orienting operator() such that it is 0 at all
+    input points and negative inside the inferred surface.
+
+    \tparam SparseLinearAlgebraTraits_d Symmetric definite positive sparse linear solver.
+    If \ref thirdpartyEigen "Eigen" 3.1 (or greater) is available and `CGAL_EIGEN3_ENABLED`
+    is defined, an overload with \link Eigen_solver_traits <tt>Eigen_solver_traits<Eigen::ConjugateGradient<Eigen_sparse_symmetric_matrix<double>::EigenType> ></tt> \endlink
+    as default solver is provided.
+  
+    \param solver sparse linear solver.
+    \param smoother_hole_filling controls if the Delaunay refinement is done for the input points, or for an approximation of the surface obtained from a first pass of the algorithm on a sample of the points.
+
+    \return `false` if the linear solver fails. 
+  */ 
+  template <class SparseLinearAlgebraTraits_d>
+  bool compute_implicit_function(SparseLinearAlgebraTraits_d solver, bool smoother_hole_filling = false)
+  {
+    if (smoother_hole_filling)
+      return compute_implicit_function<SparseLinearAlgebraTraits_d,Poisson_visitor>(solver,Poisson_visitor(),0.02,5);
+    else
+      return compute_implicit_function<SparseLinearAlgebraTraits_d,Poisson_visitor>(solver,Poisson_visitor());
+  }
+
+  /// \cond SKIP_IN_MANUAL
+#ifdef CGAL_EIGEN3_ENABLED
+  // This variant provides the default sparse linear traits class = Eigen_solver_traits.
+  bool compute_implicit_function(bool smoother_hole_filling = false)
+  {
+    typedef Eigen_solver_traits<Eigen::ConjugateGradient<Eigen_sparse_symmetric_matrix<double>::EigenType> > Solver;
+    return compute_implicit_function<Solver>(Solver(), smoother_hole_filling);
+  }
+#endif
+
+  boost::tuple<FT, Cell_handle, bool> special_func(const Point& p) const
+  {
+    m_hint = m_tr->locate(p  ,m_hint  ); // no hint when we use hierarchy
+
+    if(m_tr->is_infinite(m_hint)) {
+      int i = m_hint->index(m_tr->infinite_vertex());
+      return boost::make_tuple(m_hint->vertex((i+1)&3)->f(),
+                               m_hint, true);
+    }
+
+    FT a,b,c,d;
+    barycentric_coordinates(p,m_hint,a,b,c,d);
+    return boost::make_tuple(a * m_hint->vertex(0)->f() +
+                             b * m_hint->vertex(1)->f() +
+                             c * m_hint->vertex(2)->f() +
+                             d * m_hint->vertex(3)->f(),
+                             m_hint, false);
+  }
+  /// \endcond
+
+  /*! 
+    `ImplicitFunction` interface: evaluates the implicit function at a 
+    given 3D query point. The function `compute_implicit_function()` must be 
+    called before the first call to `operator()`. 
+  */ 
+  FT operator()(const Point& p) const
+  {
+    m_hint = m_tr->locate(p ,m_hint); 
+
+    if(m_tr->is_infinite(m_hint)) {
+      int i = m_hint->index(m_tr->infinite_vertex());
+      return m_hint->vertex((i+1)&3)->f();
+    }
+
+    FT a,b,c,d;
+    barycentric_coordinates(p,m_hint,a,b,c,d);
+    return a * m_hint->vertex(0)->f() +
+           b * m_hint->vertex(1)->f() +
+           c * m_hint->vertex(2)->f() +
+           d * m_hint->vertex(3)->f();
+  }
+  
+  /// \cond SKIP_IN_MANUAL
+  void initialize_cell_indices()
+  {
+    int i=0;
+    for(Finite_cells_iterator fcit = m_tr->finite_cells_begin();
+        fcit != m_tr->finite_cells_end();
+        ++fcit){
+      fcit->info()= i++;
+    }
+  }
+
+  void initialize_barycenters() const
+  {
+    m_Bary->resize(m_tr->number_of_cells());
+
+    for(std::size_t i=0; i< m_Bary->size();i++){
+      (*m_Bary)[i][0]=-1;
+    }
+  }
+
+  void initialize_cell_normals() const
+  {
+    Normal.resize(m_tr->number_of_cells());
+    int i = 0;
+    int N = 0;
+    for(Finite_cells_iterator fcit = m_tr->finite_cells_begin();
+        fcit != m_tr->finite_cells_end();
+        ++fcit){
+      Normal[i] = cell_normal(fcit);
+      if(Normal[i] == NULL_VECTOR){
+        N++;
+      }
+      ++i;
+    }
+    std::cerr << N << " out of " << i << " cells have NULL_VECTOR as normal" << std::endl;
+  }
+
+  void initialize_duals() const
+  {
+    Dual.resize(m_tr->number_of_cells());    
+    int i = 0;
+    for(Finite_cells_iterator fcit = m_tr->finite_cells_begin();
+        fcit != m_tr->finite_cells_end();
+        ++fcit){
+      Dual[i++] = m_tr->dual(fcit);
+    }
+  }
+
+  void clear_duals() const
+  {
+    Dual.clear();
+  }
+
+  void clear_normals() const
+  {
+    Normal.clear();
+  }
+
+  void initialize_matrix_entry(Cell_handle ch) const
+  {
+    boost::array<double,9> & entry = (*m_Bary)[ch->info()];
+    const Point& pa = ch->vertex(0)->point();
+    const Point& pb = ch->vertex(1)->point();
+    const Point& pc = ch->vertex(2)->point();
+    const Point& pd = ch->vertex(3)->point();
+    
+    Vector va = pa - pd;
+    Vector vb = pb - pd;
+    Vector vc = pc - pd;
+    
+    internal::invert(va.x(), va.y(), va.z(),
+           vb.x(), vb.y(), vb.z(),
+           vc.x(), vc.y(), vc.z(),
+           entry[0],entry[1],entry[2],entry[3],entry[4],entry[5],entry[6],entry[7],entry[8]);
+  }
+  /// \endcond
+  
+  /// Returns a point located inside the inferred surface.
+  Point get_inner_point() const
+  {
+    // Gets point / the implicit function is minimum
+    return m_sink;
+  }
+
+  /// @}
+
+// Private methods:
+private:
+
+  /// Delaunay refinement (break bad tetrahedra, where
+  /// bad means badly shaped or too big). The normal of
+  /// Steiner points is set to zero.
+  /// Returns the number of vertices inserted.
+
+  template <typename Sizing_field>
+  unsigned int delaunay_refinement(FT radius_edge_ratio_bound, ///< radius edge ratio bound (ignored if zero)
+                                   Sizing_field sizing_field, ///< cell radius bound (ignored if zero)
+                                   unsigned int max_vertices, ///< number of vertices bound
+                                   FT enlarge_ratio) ///< bounding box enlarge ratio
+  {
+    return delaunay_refinement(radius_edge_ratio_bound,
+                               sizing_field,
+                               max_vertices,
+                               enlarge_ratio,
+                               internal::Poisson::Constant_sizing_field<Triangulation>());
+  }
+
+  template <typename Sizing_field, 
+            typename Second_sizing_field>
+  unsigned int delaunay_refinement(FT radius_edge_ratio_bound, ///< radius edge ratio bound (ignored if zero)
+                                   Sizing_field sizing_field, ///< cell radius bound (ignored if zero)
+                                   unsigned int max_vertices, ///< number of vertices bound
+                                   FT enlarge_ratio, ///< bounding box enlarge ratio
+                                   Second_sizing_field second_sizing_field)
+  {
+    Sphere elarged_bsphere = enlarged_bounding_sphere(enlarge_ratio);
+    unsigned int nb_vertices_added = poisson_refine_triangulation(*m_tr,radius_edge_ratio_bound,sizing_field,second_sizing_field,max_vertices,elarged_bsphere);
+
+    return nb_vertices_added;
+  }
+
+  /// Poisson reconstruction.
+  /// Returns false on error.
+  ///
+  /// @commentheading Template parameters:
+  /// @param SparseLinearAlgebraTraits_d Symmetric definite positive sparse linear solver.
+  template <class SparseLinearAlgebraTraits_d>
+  bool solve_poisson(
+    SparseLinearAlgebraTraits_d solver, ///< sparse linear solver
+    double lambda)
+  {
+    CGAL_TRACE("Calls solve_poisson()\n");
+
+    double time_init = clock();
+
+    double duration_assembly = 0.0;
+    double duration_solve = 0.0;
+
+
+    initialize_cell_indices();
+    initialize_barycenters();
+
+    // get #variables
+    constrain_one_vertex_on_convex_hull();
+    m_tr->index_unconstrained_vertices();
+    unsigned int nb_variables = static_cast<unsigned int>(m_tr->number_of_vertices()-1);
+
+    CGAL_TRACE("  Number of variables: %ld\n", (long)(nb_variables));
+
+    // Assemble linear system A*X=B
+    typename SparseLinearAlgebraTraits_d::Matrix A(nb_variables); // matrix is symmetric definite positive
+    typename SparseLinearAlgebraTraits_d::Vector X(nb_variables), B(nb_variables);
+
+    initialize_duals();
+#ifndef CGAL_DIV_NON_NORMALIZED
+    initialize_cell_normals();
+#endif
+    Finite_vertices_iterator v, e;
+    for(v = m_tr->finite_vertices_begin(),
+        e = m_tr->finite_vertices_end();
+        v != e;
+        ++v)
+    {
+      if(!m_tr->is_constrained(v)) {
+#ifdef CGAL_DIV_NON_NORMALIZED
+        B[v->index()] = div(v); // rhs -> divergent
+#else // not defined(CGAL_DIV_NORMALIZED)
+        B[v->index()] = div_normalized(v); // rhs -> divergent
+#endif // not defined(CGAL_DIV_NORMALIZED)
+        assemble_poisson_row<SparseLinearAlgebraTraits_d>(A,v,B,lambda);
+      }
+    }
+
+    clear_duals();
+    clear_normals();
+    duration_assembly = (clock() - time_init)/CLOCKS_PER_SEC;
+    CGAL_TRACE("  Creates matrix: done (%.2lf s)\n", duration_assembly);
+
+    CGAL_TRACE("  Solve sparse linear system...\n");
+
+    // Solve "A*X = B". On success, solution is (1/D) * X.
+    time_init = clock();
+    double D;
+    if(!solver.linear_solver(A, B, X, D))
+      return false;
+    CGAL_surface_reconstruction_points_assertion(D == 1.0);
+    duration_solve = (clock() - time_init)/CLOCKS_PER_SEC;
+
+    CGAL_TRACE("  Solve sparse linear system: done (%.2lf s)\n", duration_solve);
+
+    // copy function's values to vertices
+    unsigned int index = 0;
+    for (v = m_tr->finite_vertices_begin(), e = m_tr->finite_vertices_end(); v!= e; ++v)
+      if(!m_tr->is_constrained(v))
+        v->f() = X[index++];
+
+    CGAL_TRACE("End of solve_poisson()\n");
+
+    return true;
+  }
+
+  /// Shift and orient the implicit function such that:
+  /// - the implicit function = 0 for points / f() = contouring_value,
+  /// - the implicit function < 0 inside the surface.
+  ///
+  /// Returns the minimum value of the implicit function.
+  FT set_contouring_value(FT contouring_value)
+  {
+    // median value set to 0.0
+    shift_f(-contouring_value);
+
+     // Check value on convex hull (should be positive): if more than
+    // half the vertices of the convex hull are negative, we flip the
+    // sign (this is particularly useful if the surface is open, then
+    // it is closed using the smallest part of the sphere).
+    std::vector<Vertex_handle> convex_hull;
+    m_tr->adjacent_vertices (m_tr->infinite_vertex (),
+			     std::back_inserter (convex_hull));
+    unsigned int nb_negative = 0;
+    for (std::size_t i = 0; i < convex_hull.size (); ++ i)
+      if (convex_hull[i]->f() < 0.0)
+        ++ nb_negative;
+    
+    if(nb_negative > convex_hull.size () / 2)
+      flip_f();
+
+    // Update m_sink
+    FT sink_value = find_sink();
+    return sink_value;
+  }
+
+
+/// Gets median value of the implicit function over input vertices.
+  FT median_value_at_input_vertices() const
+  {
+    std::deque<FT> values;
+    Finite_vertices_iterator v, e;
+    for(v = m_tr->finite_vertices_begin(),
+        e= m_tr->finite_vertices_end();
+        v != e; 
+        v++)
+      if(v->type() == Triangulation::INPUT)
+        values.push_back(v->f());
+
+    std::size_t size = values.size();
+    if(size == 0)
+    {
+      std::cerr << "Contouring: no input points\n";
+      return 0.0;
+    }
+
+    std::sort(values.begin(),values.end());
+    std::size_t index = size/2;
+    // return values[size/2];
+    return 0.5 * (values[index] + values[index+1]); // avoids singular cases
+  }
+
+  void barycentric_coordinates(const Point& p,
+                               Cell_handle cell,
+                               FT& a,
+                               FT& b,
+                               FT& c,
+                               FT& d) const
+  {
+
+    //    const Point& pa = cell->vertex(0)->point();
+    // const Point& pb = cell->vertex(1)->point();
+    // const Point& pc = cell->vertex(2)->point();
+    const Point& pd = cell->vertex(3)->point();
+#if 1
+    //Vector va = pa - pd;
+    //Vector vb = pb - pd;
+    //Vector vc = pc - pd;
+    Vector vp = p - pd;
+
+    //FT i00, i01, i02, i10, i11, i12, i20, i21, i22;
+    //internal::invert(va.x(), va.y(), va.z(),
+    //       vb.x(), vb.y(), vb.z(),
+    //       vc.x(), vc.y(), vc.z(),
+    //       i00, i01, i02, i10, i11, i12, i20, i21, i22);
+    const boost::array<double,9> & i = (*m_Bary)[cell->info()];
+    if(i[0]==-1){
+      initialize_matrix_entry(cell);
+    }
+    //    UsedBary[cell->info()] = true;
+    a = i[0] * vp.x() + i[3] * vp.y() + i[6] * vp.z();
+    b = i[1] * vp.x() + i[4] * vp.y() + i[7] * vp.z();
+    c = i[2] * vp.x() + i[5] * vp.y() + i[8] * vp.z();
+    d = 1 - ( a + b + c);
+#else
+    FT v = volume(pa,pb,pc,pd);
+    a = std::fabs(volume(pb,pc,pd,p) / v);
+    b = std::fabs(volume(pa,pc,pd,p) / v);
+    c = std::fabs(volume(pb,pa,pd,p) / v);
+    d = std::fabs(volume(pb,pc,pa,p) / v);
+
+    std::cerr << "_________________________________\n";
+    std::cerr << aa << "  " << bb << "  " << cc << "  " << dd << std::endl;
+    std::cerr << a << "  " << b << "  " << c << "  " << d << std::endl;
+
+#endif
+  }
+
+  FT find_sink()
+  {
+    m_sink = CGAL::ORIGIN;
+    FT min_f = 1e38;
+    Finite_vertices_iterator v, e;
+    for(v = m_tr->finite_vertices_begin(),
+        e= m_tr->finite_vertices_end();
+        v != e;
+        v++)
+    {
+      if(v->f() < min_f)
+      {
+        m_sink = v->point();
+        min_f = v->f();
+      }
+    }
+    return min_f;
+  }
+
+  void shift_f(const FT shift)
+  {
+    Finite_vertices_iterator v, e;
+    for(v = m_tr->finite_vertices_begin(),
+        e = m_tr->finite_vertices_end();
+        v!= e;
+        v++)
+      v->f() += shift;
+  }
+
+  void flip_f()
+  {
+    Finite_vertices_iterator v, e;
+    for(v = m_tr->finite_vertices_begin(),
+          e = m_tr->finite_vertices_end();
+        v != e;
+        v++)
+      v->f() = -v->f();
+  }
+
+  Vertex_handle any_vertex_on_convex_hull()
+  {
+    Cell_handle ch = m_tr->infinite_vertex()->cell();
+    return  ch->vertex( (ch->index( m_tr->infinite_vertex())+1)%4);
+  }
+
+
+  void constrain_one_vertex_on_convex_hull(const FT value = 0.0)
+  {
+    Vertex_handle v = any_vertex_on_convex_hull();
+    m_tr->constrain(v);
+    v->f() = value;
+  }
+
+  // TODO: Some entities are computed too often
+  // - nn and area should not be computed for the face and its opposite face
+  // 
+  // divergent
+  FT div_normalized(Vertex_handle v)
+  {
+    std::vector<Cell_handle> cells;
+    cells.reserve(32);
+    m_tr->incident_cells(v,std::back_inserter(cells));
+  
+    FT div = 0;
+    typename std::vector<Cell_handle>::iterator it;
+    for(it = cells.begin(); it != cells.end(); it++)
+    {
+      Cell_handle cell = *it;
+      if(m_tr->is_infinite(cell))
+        continue;
+
+      // compute average normal per cell
+      Vector n = get_cell_normal(cell);
+
+      // zero normal - no need to compute anything else
+      if(n == CGAL::NULL_VECTOR)
+        continue;
+
+
+      // compute n'
+      int index = cell->index(v);
+      const Point& x = cell->vertex(index)->point();
+      const Point& a = cell->vertex((index+1)%4)->point();
+      const Point& b = cell->vertex((index+2)%4)->point();
+      const Point& c = cell->vertex((index+3)%4)->point();
+      Vector nn = (index%2==0) ? CGAL::cross_product(b-a,c-a) : CGAL::cross_product(c-a,b-a);
+      nn = nn / std::sqrt(nn*nn); // normalize
+      Vector p = a - x;
+      Vector q = b - x;
+      Vector r = c - x;
+      FT p_n = std::sqrt(p*p);
+      FT q_n = std::sqrt(q*q);
+      FT r_n = std::sqrt(r*r);
+      FT solid_angle = p*(CGAL::cross_product(q,r));
+      solid_angle = std::abs(solid_angle / (p_n*q_n*r_n + (p*q)*r_n + (q*r)*p_n + (r*p)*q_n));
+
+      FT area = std::sqrt(squared_area(a,b,c));
+      FT length = p_n + q_n + r_n;
+      div += n * nn * area / length ;
+    }
+    return div * FT(3.0);
+  }
+
+  FT div(Vertex_handle v)
+  {
+    std::vector<Cell_handle> cells;
+    cells.reserve(32);
+    m_tr->incident_cells(v,std::back_inserter(cells));
+  
+    FT div = 0.0;
+    typename std::vector<Cell_handle>::iterator it;
+    for(it = cells.begin(); it != cells.end(); it++)
+    {
+      Cell_handle cell = *it;
+      if(m_tr->is_infinite(cell))
+        continue;
+      
+      const int index = cell->index(v);
+      const Point& a = cell->vertex(m_tr->vertex_triple_index(index, 0))->point();
+      const Point& b = cell->vertex(m_tr->vertex_triple_index(index, 1))->point();
+      const Point& c = cell->vertex(m_tr->vertex_triple_index(index, 2))->point();
+      const Vector nn = CGAL::cross_product(b-a,c-a);
+
+      div+= nn * (//v->normal() + 
+                  cell->vertex((index+1)%4)->normal() +
+                  cell->vertex((index+2)%4)->normal() +
+                  cell->vertex((index+3)%4)->normal());
+    }
+    return div;
+  }
+
+  Vector get_cell_normal(Cell_handle cell)
+  {
+    return Normal[cell->info()];
+  }
+
+  Vector cell_normal(Cell_handle cell) const
+  {
+    const Vector& n0 = cell->vertex(0)->normal();
+    const Vector& n1 = cell->vertex(1)->normal();
+    const Vector& n2 = cell->vertex(2)->normal();
+    const Vector& n3 = cell->vertex(3)->normal();
+    Vector n = n0 + n1 + n2 + n3;
+    if(n != NULL_VECTOR){
+      FT sq_norm = n*n;
+      if(sq_norm != 0.0){
+        return n / std::sqrt(sq_norm); // normalize
+      }
+    }
+    return NULL_VECTOR;
+  }
+
+  // cotan formula as area(voronoi face) / len(primal edge)
+  FT cotan_geometric(Edge& edge)
+  {
+    Cell_handle cell = edge.first;
+    Vertex_handle vi = cell->vertex(edge.second);
+    Vertex_handle vj = cell->vertex(edge.third);
+
+    // primal edge
+    const Point& pi = vi->point();
+    const Point& pj = vj->point();
+    Vector primal = pj - pi;
+    FT len_primal = std::sqrt(primal * primal);
+    return area_voronoi_face(edge) / len_primal;
+  }
+
+  // spin around edge
+  // return area(voronoi face)
+  FT area_voronoi_face(Edge& edge)
+  {
+    // circulate around edge
+    Cell_circulator circ = m_tr->incident_cells(edge);
+    Cell_circulator done = circ;
+    std::vector<Point> voronoi_points;
+    voronoi_points.reserve(9);
+    do
+    {
+      Cell_handle cell = circ;
+      if(!m_tr->is_infinite(cell))
+        voronoi_points.push_back(Dual[cell->info()]);
+      else // one infinite tet, switch to another calculation
+        return area_voronoi_face_boundary(edge);
+      circ++;
+    }
+    while(circ != done);
+
+    if(voronoi_points.size() < 3)
+    {
+      CGAL_surface_reconstruction_points_assertion(false);
+      return 0.0;
+    }
+
+    // sum up areas
+    FT area = 0.0;
+    const Point& a = voronoi_points[0];
+    std::size_t nb_triangles = voronoi_points.size() - 1;
+    for(std::size_t i=1;i<nb_triangles;i++)
+    {
+      const Point& b = voronoi_points[i];
+      const Point& c = voronoi_points[i+1];
+      area += std::sqrt(squared_area(a,b,c));
+    }
+    return area;
+  }
+
+  // approximate area when a cell is infinite
+  FT area_voronoi_face_boundary(Edge& edge)
+  {
+    FT area = 0.0;
+    Vertex_handle vi = edge.first->vertex(edge.second);
+    Vertex_handle vj = edge.first->vertex(edge.third);
+
+    const Point& pi = vi->point();
+    const Point& pj = vj->point();
+    Point m = CGAL::midpoint(pi,pj);
+
+    // circulate around each incident cell
+    Cell_circulator circ = m_tr->incident_cells(edge);
+    Cell_circulator done = circ;
+    do
+    {
+      Cell_handle cell = circ;
+      if(!m_tr->is_infinite(cell))
+      {
+        // circumcenter of cell
+        Point c = Dual[cell->info()];
+        Tetrahedron tet = m_tr->tetrahedron(cell);
+
+        int i = cell->index(vi);
+        int j = cell->index(vj);
+        int k =  Triangulation_utils_3::next_around_edge(i,j);
+        int l =  Triangulation_utils_3::next_around_edge(j,i);
+
+        Vertex_handle vk = cell->vertex(k);
+        Vertex_handle vl = cell->vertex(l);
+
+        const Point& pk = vk->point();
+        const Point& pl = vl->point();
+
+        // if circumcenter is outside tet
+        // pick barycenter instead
+        if(tet.has_on_unbounded_side(c))
+        {
+          Point cell_points[4] = {pi,pj,pk,pl};
+          c = CGAL::centroid(cell_points, cell_points+4);
+        }
+
+        Point ck = CGAL::circumcenter(pi,pj,pk);
+        Point cl = CGAL::circumcenter(pi,pj,pl);
+
+        area += std::sqrt(squared_area(m,c,ck));
+        area += std::sqrt(squared_area(m,c,cl));
+      }
+      circ++;
+    }
+    while(circ != done);
+    return area;
+  }
+
+  /// Assemble vi's row of the linear system A*X=B
+  ///
+  /// @commentheading Template parameters:
+  /// @param SparseLinearAlgebraTraits_d Symmetric definite positive sparse linear solver.
+  template <class SparseLinearAlgebraTraits_d>
+  void assemble_poisson_row(typename SparseLinearAlgebraTraits_d::Matrix& A,
+                            Vertex_handle vi,
+                            typename SparseLinearAlgebraTraits_d::Vector& B,
+                            double lambda)
+  {
+    // for each vertex vj neighbor of vi
+    std::vector<Edge> edges;
+    m_tr->incident_edges(vi,std::back_inserter(edges));
+
+    double diagonal = 0.0;
+
+    for(typename std::vector<Edge>::iterator it = edges.begin();
+        it != edges.end();
+        it++)
+      {
+        Vertex_handle vj = it->first->vertex(it->third);
+        if(vj == vi){
+          vj = it->first->vertex(it->second);
+        }
+        if(m_tr->is_infinite(vj))
+          continue;
+
+        // get corresponding edge
+        Edge edge( it->first, it->first->index(vi), it->first->index(vj));
+        if(vi->index() < vj->index()){
+          std::swap(edge.second,  edge.third);
+        }
+
+        double cij = cotan_geometric(edge);
+
+        if(m_tr->is_constrained(vj)){
+          if(! is_valid(vj->f())){
+            std::cerr << "vj->f() = " << vj->f() << " is not valid" << std::endl;
+          }
+          B[vi->index()] -= cij * vj->f(); // change rhs
+          if(! is_valid( B[vi->index()])){
+            std::cerr << " B[vi->index()] = " <<  B[vi->index()] << " is not valid" << std::endl;
+          }
+
+        } else {
+          if(! is_valid(cij)){
+            std::cerr << "cij = " << cij << " is not valid" << std::endl;
+          }
+          A.set_coef(vi->index(),vj->index(), -cij, true /*new*/); // off-diagonal coefficient
+        }
+
+        diagonal += cij;
+      }
+    // diagonal coefficient
+    if (vi->type() == Triangulation::INPUT){
+      A.set_coef(vi->index(),vi->index(), diagonal + lambda, true /*new*/) ;
+    } else{
+      A.set_coef(vi->index(),vi->index(), diagonal, true /*new*/);
+    }
+  }
+  
+
+  /// Computes enlarged geometric bounding sphere of the embedded triangulation.
+  Sphere enlarged_bounding_sphere(FT ratio) const
+  {
+    Sphere bsphere = bounding_sphere(); // triangulation's bounding sphere
+    return Sphere(bsphere.center(), bsphere.squared_radius() * ratio*ratio);
+  }
+
+}; // end of Poisson_reconstruction_function
+
+
+} //namespace CGAL
+
+#endif // CGAL_POISSON_RECONSTRUCTION_FUNCTION_H
diff --git a/3rdparty/CGAL/include/CGAL/Polychain_2.h b/3rdparty/CGAL/include/CGAL/Polychain_2.h
new file mode 100644
index 0000000..6ec4a82
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polychain_2.h
@@ -0,0 +1,859 @@
+// Copyright (c) 2015  Università della Svizzera italiana.
+// 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
+// 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(s)     : Panagiotis Cheilaris, Sandeep Kumar Dey, Evanthia Papadopoulou
+//philaris at gmail.com, sandeep.kr.dey at gmail.com, evanthia.papadopoulou at usi.ch
+
+#ifndef CGAL_POLYCHAIN_2_H
+#define CGAL_POLYCHAIN_2_H
+
+#include <CGAL/basic.h>
+#include <CGAL/Polygon_2.h>
+#include <CGAL/intersections.h>
+
+
+// Polychainsegment_2
+
+namespace CGAL {
+
+namespace Qt {
+  template <typename K> class PainterOstream;
+}
+
+template <class Traits_P, class Container_P
+        = std::vector<typename Traits_P::Point_2> >
+class Polychainsegment_2 : public Polygon_2<Traits_P, Container_P> {
+
+  public:
+    typedef Traits_P Traits;
+    typedef Polygon_2<Traits_P, Container_P> Base;
+
+    // constructors
+
+    Polychainsegment_2() : Base() {}
+
+    Polychainsegment_2(
+        const Polychainsegment_2<Traits_P,Container_P>& pc)
+      : Base((Base) pc) {}
+
+    template <class InputIterator>
+    Polychainsegment_2(InputIterator first, InputIterator last,
+                       Traits p_traits = Traits())
+        : Base(first, last, p_traits)  {}
+
+
+    template< class K >
+    void draw(CGAL::Qt::PainterOstream<K>& stream) const {
+      typedef typename K::Segment_2 K_Segment_2;
+      typedef typename Polychainsegment_2<
+                        Traits_P,Container_P>::Vertex_const_iterator
+              VI;
+
+      if (this->size() > 1) {
+        VI source = this->vertices_begin();
+        VI target = source+1;
+        for( ; target!=this->vertices_end(); ++source, ++target)
+        {
+          stream << K_Segment_2(*source, *target);
+        }
+      }
+    }
+
+    template< class Stream >
+    void draw(Stream & str) const
+    {
+      typedef typename Traits_P::Segment_2 Segment_2;
+      typedef typename Polychainsegment_2<
+                        Traits_P,Container_P>::Vertex_const_iterator
+              VI;
+      if (this->size() > 1) {
+        VI source = this->vertices_begin();
+        VI target = source+1;
+        for( ; target!=this->vertices_end(); ++source, ++target)
+        {
+          str << Segment_2(*source, *target);
+        }
+      }
+    }
+
+} ;
+
+
+
+
+template <class Traits_P, class Container_P>
+std::ostream&
+operator<<(std::ostream &os,
+           const Polychainsegment_2<Traits_P,Container_P>& p)
+{
+  typename Polychainsegment_2<Traits_P,Container_P>
+              ::Vertex_const_iterator
+           i;
+
+  switch(get_mode(os)) {
+    case IO::ASCII :
+      os << p.size() << ' ';
+      for (i = p.vertices_begin(); i != p.vertices_end(); ++i) {
+        os << *i << ' ';
+      }
+      return os;
+
+    case IO::BINARY :
+      os << p.size();
+      for (i = p.vertices_begin(); i != p.vertices_end(); ++i) {
+        os << *i;
+      }
+      return os;
+
+    default:
+      os << "Polychainsegment_2(" << std::endl;
+      for (i = p.vertices_begin(); i != p.vertices_end(); ++i) {
+        os << "  " << *i << std::endl;
+      }
+      os << ")" << std::endl;
+      return os;
+  }
+}
+
+
+
+
+
+/* the following not allowed in some compilers: */
+/*
+template< class Stream,
+          class Traits_P,
+          class Container_P = std::vector<typename Traits_P::Point_2>
+        >
+inline
+Stream& operator<<(Stream &s,
+                   const Polychainsegment_2 <Traits_P, Container_P> &P)
+{
+  P.draw(s);
+  return s;
+}
+*/
+
+
+/* instead, we use overloading */
+
+/*
+template< class Stream,
+          class Traits_P
+        >
+inline
+Stream& operator<<(Stream &s,
+                   const Polychainsegment_2 <Traits_P> &P)
+{
+  P.draw(s);
+  return s;
+}
+
+
+template< class Stream,
+          class Traits_P,
+          class Container_P
+        >
+inline
+Stream& operator<<(Stream &s,
+                   const Polychainsegment_2 <Traits_P, Container_P> &P)
+{
+  P.draw(s);
+  return s;
+}
+*/
+
+
+
+// Polychainray_2
+
+template <class Traits_P, class Container_P
+        = std::vector<typename Traits_P::Point_2> >
+class Polychainray_2 :
+  public Polychainsegment_2<Traits_P, Container_P> {
+
+public:
+    typedef Traits_P Traits;
+
+private:
+    typedef typename Traits_P::Direction_2 OutgoingDirection;
+    typedef Polychainsegment_2<Traits_P, Container_P> Base;
+
+    OutgoingDirection outgoing;
+
+public:
+
+    // constructors
+
+    Polychainray_2(): Base(), outgoing() {}
+
+    Polychainray_2(const Polychainray_2<Traits_P,Container_P>& pcr)
+      : Base((Base) pcr), outgoing(pcr.outgoing) {}
+
+    template <class InputIterator>
+    Polychainray_2(InputIterator first, InputIterator last,
+	           OutgoingDirection d,
+              Traits p_traits = Traits())
+        : Base(first, last, p_traits), outgoing(d)
+    {
+    }
+
+
+    // get_outgoing
+
+    OutgoingDirection get_outgoing() const {
+	return outgoing;
+    }
+
+
+    // drawing
+
+    template< class K >
+    void draw(CGAL::Qt::PainterOstream<K>& stream) const {
+      typedef typename K::Segment_2 K_Segment_2;
+      typedef typename K::Ray_2 K_Ray_2;
+      typedef typename
+	  Polychainray_2<Traits_P,Container_P>::Vertex_const_iterator VI;
+
+      CGAL_assertion( this->size() > 0 );
+
+      VI source = this->vertices_begin();
+      if (this->size() > 1) {
+        VI target = source+1;
+        for( ; target!=this->vertices_end(); ++source, ++target)
+        {
+          stream << K_Segment_2(*source, *target);
+        }
+      }
+      // now source contains the last point;
+      // draw outgoing ray from this point
+      stream << K_Ray_2(*source, this->get_outgoing());
+    }
+
+    template< class Stream >
+    void draw(Stream & stream) const {
+      typedef typename Traits_P::Segment_2 Segment_2;
+      typedef typename Traits_P::Ray_2 Ray_2;
+      typedef typename
+	  Polychainray_2<Traits_P,Container_P>::Vertex_const_iterator VI;
+
+      CGAL_assertion( this->size() > 0 );
+
+      VI source = this->vertices_begin();
+      if (this->size() > 1) {
+        VI target = source+1;
+        for( ; target!=this->vertices_end(); ++source, ++target)
+        {
+          stream << Segment_2(*source, *target);
+        }
+      }
+      // now source contains the last point;
+      // draw outgoing ray from this point
+      stream << Ray_2(*source, this->get_outgoing());
+    }
+
+
+} ;
+
+
+template <class Traits_P, class Container_P>
+std::ostream&
+operator<<(std::ostream &os,
+           const Polychainray_2<Traits_P,Container_P>& p)
+{
+  typename Polychainray_2<Traits_P,Container_P>::Vertex_const_iterator i;
+
+  switch(get_mode(os)) {
+    case IO::ASCII :
+      os << p.size() << ' ';
+      for (i = p.vertices_begin(); i != p.vertices_end(); ++i) {
+        os << *i << ' ';
+      }
+      os << ", dout=" << p.get_outgoing() << ' ';
+      return os;
+
+    case IO::BINARY :
+      os << p.size();
+      for (i = p.vertices_begin(); i != p.vertices_end(); ++i) {
+        os << *i;
+      }
+      os << p.get_outgoing();
+      return os;
+
+    default:
+      os << "Polychainray_2(" << std::endl;
+      for (i = p.vertices_begin(); i != p.vertices_end(); ++i) {
+        os << "  " << *i << std::endl;
+      }
+      os << "dout=" << p.get_outgoing() << std::endl;
+      os << ")" << std::endl;
+      return os;
+  }
+}
+
+
+
+
+
+/*
+template< class Stream,
+          class Traits_P
+        >
+inline
+Stream& operator<<(Stream &s,
+                   const Polychainray_2 <Traits_P> &P)
+{
+  P.draw(s);
+  return s;
+}
+
+
+template< class Stream,
+          class Traits_P,
+          class Container_P
+        >
+inline
+Stream& operator<<(Stream &s,
+                   const Polychainray_2 <Traits_P, Container_P> &P)
+{
+  P.draw(s);
+  return s;
+}
+*/
+
+
+
+// Polychainline_2
+
+template <class Traits_P, class Container_P
+        = std::vector<typename Traits_P::Point_2> >
+class Polychainline_2 : public Polychainray_2<Traits_P, Container_P> {
+
+public:
+
+private:
+    typedef Traits_P Traits;
+    typedef typename Traits_P::Direction_2 IncomingDirection;
+    typedef typename Traits_P::Direction_2 OutgoingDirection;
+    typedef typename Traits_P::Line_2      Line_2;
+    typedef typename Traits_P::Ray_2       Ray_2;
+    typedef typename Traits_P::Segment_2   Segment_2;
+    typedef typename Traits_P::Point_2     Point_2;
+    typedef Polychainray_2<Traits_P, Container_P>  Base;
+    typedef Polychainline_2<Traits_P, Container_P> Self;
+
+    IncomingDirection incoming;
+    bool is_line_optimization;
+
+public:
+
+    // constructors
+
+    Polychainline_2() : Base(), incoming(),
+      is_line_optimization(false)
+    {}
+
+    Polychainline_2(const Self& pcl)
+      : Base((Base) pcl), incoming(pcl.incoming),
+        is_line_optimization(pcl.is_line_optimization)
+    {}
+
+    template <class InputIterator>
+    Polychainline_2(IncomingDirection dinc,
+	            InputIterator first, InputIterator last,
+	            OutgoingDirection dout,
+                    Traits p_traits = Traits())
+        : Base(first, last, dout, p_traits), incoming(dinc),
+          is_line_optimization(false)
+    {
+    }
+
+    void set_line_optimization() {
+      CGAL_assertion(this->size() == 1);
+      CGAL_assertion(this->incoming == - this->get_outgoing());
+      is_line_optimization = true;
+    }
+
+    // get_incoming
+
+    IncomingDirection get_incoming() const {
+	return incoming;
+    }
+
+
+    // unary minus operator
+    // that reverses the orientation of the polychainline
+
+    Self
+    operator-() const {
+      // first reverse list of points of polychainline
+
+      std::vector<typename Traits_P::Point_2> reverse;
+
+      unsigned int npts = this->size();
+
+      CGAL_SDG_DEBUG(std::cout << "pcl_reverse npts="
+          << npts << std::endl;);
+
+      reverse.resize(npts);
+
+      //std::reverse_copy(this->vertices_begin(),
+      //                  this->vertices_end(),
+      //                  reverse);
+
+      typedef typename Polychainline_2<
+                        Traits_P,Container_P>::Vertex_const_iterator
+              VI;
+
+      unsigned int i = npts - 1;
+
+      for (VI vi = this->vertices_begin();
+              vi != this->vertices_end();
+              ++vi)
+      {
+        //CGAL_SDG_DEBUG(std::cout << "debug pcl_reverse setting at " << i
+        //          << " value " << *vi << std::endl;);
+        reverse[i] = *vi;
+        --i;
+      }
+
+
+      // then also swap incoming and outgoing directions
+
+      //return Self(this->get_outgoing(),
+      //            reverse.begin(),
+      //            reverse.end(),
+      //            this->get_incoming());
+
+      Self pclreverse(this->get_outgoing(),
+                      reverse.begin(),
+                      reverse.end(),
+                      this->get_incoming());
+
+      if (is_line_optimization) {
+        pclreverse.set_line_optimization();
+      }
+
+      return pclreverse;
+    }
+
+    // line_first_intersection_point_with
+    typename Traits_P::Point_2
+    line_first_intersection_point_with(
+        const Polychainline_2<Traits_P,Container_P>& pcl)
+    {
+      CGAL_assertion(is_line_optimization);
+      Line_2 line((*this)[0], this->get_outgoing());
+
+      typedef typename
+	  Polychainline_2<Traits_P,Container_P>::
+                     Vertex_const_iterator
+          VI;
+
+      CGAL::Object result;
+
+      VI sourcepcl  = pcl.vertices_begin();
+      Ray_2 rayincpcl (*sourcepcl,  pcl.get_incoming());
+      result = CGAL::intersection(line, rayincpcl);
+      if (const Point_2 *ipoint = CGAL::object_cast<Point_2>(&result)) {
+        return *ipoint;
+      }
+
+      if (pcl.size() > 1) {
+        VI targetpcl = sourcepcl+1;
+        for( ;
+            targetpcl != pcl.vertices_end();
+            ++sourcepcl, ++targetpcl)
+        {
+          Segment_2 testseg(*sourcepcl, *targetpcl);
+          result = CGAL::intersection(line, testseg);
+          if (const Point_2 *ipoint = CGAL::object_cast<Point_2>(&result)) {
+            return *ipoint;
+          }
+        }
+      }
+      Ray_2 rayoutpcl(*sourcepcl, pcl.get_outgoing());
+      result = CGAL::intersection(line, rayoutpcl);
+      if (const Point_2 *ipoint = CGAL::object_cast<Point_2>(&result)) {
+        return *ipoint;
+      }
+
+      CGAL_SDG_DEBUG(std::cout
+          << "debug error: no intersection found for "
+          << "this=" << *this << " pcl=" << pcl << std::endl;);
+
+      CGAL_assertion(false);
+
+      return Point_2();
+
+    } // end of line_first_intersection_point_with
+
+    // first_intersection_point_with
+    typename Traits_P::Point_2
+    first_intersection_point_with(
+        const Polychainline_2<Traits_P,Container_P>& pcl)
+    {
+      // for every piece of object,
+      // try intersecting with every piece of pcl
+
+      CGAL_SDG_DEBUG(std::cout
+          << "debug first_intersection entering this="
+          << *this << " pcl=" << pcl << std::endl;);
+
+      typedef typename
+	  Polychainline_2<Traits_P,Container_P>::
+                     Vertex_const_iterator
+          VI;
+
+      typedef typename std::vector<typename Traits_P::Segment_2>::
+               const_iterator SI;
+
+      CGAL_assertion( this->size() > 0 );
+      CGAL_assertion( pcl.size() > 0 );
+
+      if (this->is_line_optimization) {
+        return line_first_intersection_point_with(pcl);
+      }
+
+#if 0
+      CGAL_SDG_DEBUG(std::cout << "debug first_intersection "
+          << "creating empty vectors" << std::endl;);
+#endif
+
+      // create two empty vectors for storing the segments
+      std::vector<Segment_2> segmentsthis;
+      std::vector<Segment_2> segmentspcl;
+
+      VI sourcethis = this->vertices_begin();
+      Ray_2 rayincthis(*sourcethis, this->get_incoming());
+      if (this->size() > 1) {
+        VI targetthis = sourcethis+1;
+        for( ;
+            targetthis != this->vertices_end();
+            ++sourcethis, ++targetthis)
+        {
+          segmentsthis.push_back(Segment_2(*sourcethis, *targetthis));
+        }
+      }
+      Ray_2 rayoutthis(*sourcethis, this->get_outgoing());
+
+      CGAL_assertion(this->size() == (segmentsthis.size() + 1));
+
+#if 0
+      CGAL_SDG_DEBUG(std::cout << "debug first_intersection "
+                     << "segmentsthis computed" << std::endl;);
+#endif
+
+
+      VI sourcepcl  = pcl.vertices_begin();
+      Ray_2 rayincpcl (*sourcepcl,  pcl.get_incoming());
+      if (pcl.size() > 1) {
+        VI targetpcl = sourcepcl+1;
+        for( ;
+            targetpcl != pcl.vertices_end();
+            ++sourcepcl, ++targetpcl)
+        {
+          segmentspcl.push_back(Segment_2(*sourcepcl, *targetpcl));
+        }
+      }
+      Ray_2 rayoutpcl(*sourcepcl, pcl.get_outgoing());
+
+      CGAL_assertion(pcl.size() == (segmentspcl.size() + 1));
+
+#if 0
+      CGAL_SDG_DEBUG(std::cout << "debug first_intersection "
+                     << "segmentspcl computed" << std::endl;);
+#endif
+
+
+      CGAL::Object result;
+
+#if 0
+      CGAL_SDG_DEBUG(std::cout << "debug first_intersection "
+                    << "trying rayincthis with pcl" << std::endl;);
+#endif
+
+#if 0
+      CGAL_SDG_DEBUG(std::cout << "debug first_intersection "
+                << "trying ray " << rayincthis
+                     << " with ray " << rayincpcl << std::endl;);
+#endif
+
+      result = CGAL::intersection(rayincthis, rayincpcl);
+      if (const Point_2 *ipoint = CGAL::object_cast<Point_2>(&result)) {
+        return *ipoint;
+      }
+
+      for (SI sipcl = segmentspcl.begin();
+              sipcl != segmentspcl.end();
+              ++sipcl) {
+#if 0
+        CGAL_SDG_DEBUG(std::cout << "debug first_intersection "
+                << "trying ray " << rayincthis
+                       << " with segment " << *sipcl << std::endl;);
+#endif
+
+        result = CGAL::intersection(rayincthis, *sipcl);
+        if (const Point_2 *ipoint = CGAL::object_cast<Point_2>(&result)) {
+          return *ipoint;
+        }
+      }
+
+#if 0
+      CGAL_SDG_DEBUG(std::cout << "debug first_intersection "
+                << "trying ray " << rayincthis
+                     << " with ray " << rayoutpcl << std::endl;);
+#endif
+
+      result = CGAL::intersection(rayincthis, rayoutpcl);
+      if (const Point_2 *ipoint = CGAL::object_cast<Point_2>(&result)) {
+        return *ipoint;
+      }
+
+#if 0
+      CGAL_SDG_DEBUG(std::cout << "debug first_intersection "
+                     << "trying segmentsthis with pcl" << std::endl;);
+#endif
+
+      for (SI sithis = segmentsthis.begin();
+              sithis != segmentsthis.end();
+              ++sithis) {
+
+#if 0
+        CGAL_SDG_DEBUG(std::cout << "debug first_intersection "
+                << "trying segment " << *sithis
+                       << " with ray " << rayincpcl << std::endl;);
+#endif
+
+        result = CGAL::intersection(*sithis, rayincpcl);
+        if (const Point_2 *ipoint = CGAL::object_cast<Point_2>(&result)) {
+          return *ipoint;
+        }
+
+        for (SI sipcl = segmentspcl.begin();
+            sipcl != segmentspcl.end();
+            ++sipcl) {
+#if 0
+          CGAL_SDG_DEBUG(std::cout << "debug first_intersection "
+                << "trying segment " << *sithis
+                         << " with segment " << *sipcl << std::endl;);
+#endif
+
+          result = CGAL::intersection(*sithis, *sipcl);
+          if (const Point_2 *ipoint = CGAL::object_cast<Point_2>(&result))
+          {
+            return *ipoint;
+          }
+        }
+
+#if 0
+        CGAL_SDG_DEBUG(std::cout << "debug first_intersection "
+            << "trying segment " << *sithis
+            << " with ray " << rayoutpcl << std::endl;);
+#endif
+
+        result = CGAL::intersection(*sithis, rayoutpcl);
+        if (const Point_2 *ipoint = CGAL::object_cast<Point_2>(&result)) {
+          return *ipoint;
+        }
+
+      }
+
+#if 0
+      CGAL_SDG_DEBUG(std::cout << "debug first_intersection "
+                     << "trying rayoutthis with pcl" << std::endl;);
+#endif
+
+#if 0
+      CGAL_SDG_DEBUG(std::cout << "debug first_intersection "
+                << "trying ray " << rayoutthis
+                     << " with ray " << rayincpcl << std::endl;);
+#endif
+
+      result = CGAL::intersection(rayoutthis, rayincpcl);
+      if (const Point_2 *ipoint = CGAL::object_cast<Point_2>(&result)) {
+        return *ipoint;
+      }
+
+      for (SI sipcl = segmentspcl.begin();
+              sipcl != segmentspcl.end();
+              ++sipcl) {
+#if 0
+        CGAL_SDG_DEBUG(std::cout << "debug first_intersection "
+                << "trying ray " << rayoutthis
+                       << " with segment " << *sipcl << std::endl;);
+#endif
+
+        result = CGAL::intersection(rayoutthis, *sipcl);
+        if (const Point_2 *ipoint = CGAL::object_cast<Point_2>(&result)) {
+          return *ipoint;
+        }
+      }
+
+#if 0
+      CGAL_SDG_DEBUG(std::cout << "debug first_intersection "
+                << "trying ray " << rayoutthis
+                     << " with ray " << rayoutpcl << std::endl;);
+#endif
+
+      result = CGAL::intersection(rayoutthis, rayoutpcl);
+      if (const Point_2 *ipoint = CGAL::object_cast<Point_2>(&result)) {
+        return *ipoint;
+      }
+
+      CGAL_SDG_DEBUG(std::cout
+          << "debug error: no intersection found for "
+          << "this=" << *this << " pcl=" << pcl << std::endl;);
+
+      CGAL_assertion(false);
+
+      // philaris: added to avoid complaining from some compilers
+
+      return Point_2();
+
+    }
+
+
+    // drawing
+
+    template< class K >
+    void draw(CGAL::Qt::PainterOstream<K>& stream) const {
+      typedef typename K::Segment_2 K_Segment_2;
+      typedef typename K::Ray_2 K_Ray_2;
+      typedef typename
+	  Polychainline_2<Traits_P,Container_P>::Vertex_const_iterator VI;
+
+      CGAL_assertion( this->size() > 0 );
+
+      VI source = this->vertices_begin();
+
+      // draw outgoing ray from first point
+      stream << K_Ray_2(*source, this->get_incoming());
+
+      if (this->size() > 1) {
+        VI target = source+1;
+        for( ; target!=this->vertices_end(); ++source, ++target)
+        {
+          stream << K_Segment_2(*source, *target);
+        }
+      }
+
+      // now source contains the last point;
+      // draw outgoing ray from this point
+      stream << K_Ray_2(*source, this->get_outgoing());
+    }
+
+    template< class Stream >
+    void draw(Stream & stream) const {
+      typedef typename
+	  Polychainline_2<Traits_P,Container_P>::Vertex_const_iterator VI;
+
+      CGAL_assertion( this->size() > 0 );
+
+      VI source = this->vertices_begin();
+
+      // draw outgoing ray from first point
+      stream << Ray_2(*source, this->get_incoming());
+
+      if (this->size() > 1) {
+        VI target = source+1;
+        for( ; target!=this->vertices_end(); ++source, ++target)
+        {
+          stream << Segment_2(*source, *target);
+        }
+      }
+
+      // now source contains the last point;
+      // draw outgoing ray from this point
+      stream << Ray_2(*source, this->get_outgoing());
+    }
+
+} ;
+
+
+
+template <class Traits_P, class Container_P>
+std::ostream&
+operator<<(std::ostream &os,
+           const Polychainline_2<Traits_P,Container_P>& p)
+{
+  typename Polychainline_2<Traits_P,Container_P>::Vertex_const_iterator i;
+
+  switch(get_mode(os)) {
+    case IO::ASCII :
+      os << p.size() << ' ';
+      os << ", dinc=" << p.get_incoming() << ", ";
+      for (i = p.vertices_begin(); i != p.vertices_end(); ++i) {
+        os << *i << ' ';
+      }
+      os << ", dout=" << p.get_outgoing() << ' ';
+      return os;
+
+    case IO::BINARY :
+      os << p.size();
+      os << p.get_incoming();
+      for (i = p.vertices_begin(); i != p.vertices_end(); ++i) {
+        os << *i;
+      }
+      os << p.get_outgoing();
+      return os;
+
+    default:
+      os << "Polychainline_2(" << std::endl;
+      os << "dinc=" << p.get_incoming() << std::endl;
+      for (i = p.vertices_begin(); i != p.vertices_end(); ++i) {
+        os << "  " << *i << std::endl;
+      }
+      os << "dout=" << p.get_outgoing() << std::endl;
+      os << ")" << std::endl;
+      return os;
+  }
+}
+
+
+/*
+template< class Stream,
+          class Traits_P
+        >
+inline
+Stream& operator<<(Stream &s,
+                   const Polychainline_2 <Traits_P> &P)
+{
+  P.draw(s);
+  return s;
+}
+
+
+template< class Stream,
+          class Traits_P,
+          class Container_P
+        >
+inline
+Stream& operator<<(Stream &s,
+                   const Polychainline_2 <Traits_P, Container_P> &P)
+{
+  P.draw(s);
+  return s;
+}
+*/
+
+
+
+} //namespace CGAL
+
+#endif // CGAL_POLYCHAIN_2_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_2.h b/3rdparty/CGAL/include/CGAL/Polygon_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polygon_2.h
rename to 3rdparty/CGAL/include/CGAL/Polygon_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_2/Polygon_2_algorithms_impl.h b/3rdparty/CGAL/include/CGAL/Polygon_2/Polygon_2_algorithms_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polygon_2/Polygon_2_algorithms_impl.h
rename to 3rdparty/CGAL/include/CGAL/Polygon_2/Polygon_2_algorithms_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_2/Polygon_2_edge_circulator.h b/3rdparty/CGAL/include/CGAL/Polygon_2/Polygon_2_edge_circulator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polygon_2/Polygon_2_edge_circulator.h
rename to 3rdparty/CGAL/include/CGAL/Polygon_2/Polygon_2_edge_circulator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_2/Polygon_2_edge_iterator.h b/3rdparty/CGAL/include/CGAL/Polygon_2/Polygon_2_edge_iterator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polygon_2/Polygon_2_edge_iterator.h
rename to 3rdparty/CGAL/include/CGAL/Polygon_2/Polygon_2_edge_iterator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_2/Polygon_2_impl.h b/3rdparty/CGAL/include/CGAL/Polygon_2/Polygon_2_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polygon_2/Polygon_2_impl.h
rename to 3rdparty/CGAL/include/CGAL/Polygon_2/Polygon_2_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_2/Polygon_2_simplicity.h b/3rdparty/CGAL/include/CGAL/Polygon_2/Polygon_2_simplicity.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polygon_2/Polygon_2_simplicity.h
rename to 3rdparty/CGAL/include/CGAL/Polygon_2/Polygon_2_simplicity.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_2/Polygon_2_vertex_circulator.h b/3rdparty/CGAL/include/CGAL/Polygon_2/Polygon_2_vertex_circulator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polygon_2/Polygon_2_vertex_circulator.h
rename to 3rdparty/CGAL/include/CGAL/Polygon_2/Polygon_2_vertex_circulator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_2/polygon_assertions.h b/3rdparty/CGAL/include/CGAL/Polygon_2/polygon_assertions.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polygon_2/polygon_assertions.h
rename to 3rdparty/CGAL/include/CGAL/Polygon_2/polygon_assertions.h
diff --git a/3rdparty/CGAL/include/CGAL/Polygon_2_algorithms.h b/3rdparty/CGAL/include/CGAL/Polygon_2_algorithms.h
new file mode 100644
index 0000000..9cffa52
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polygon_2_algorithms.h
@@ -0,0 +1,466 @@
+// Copyright (c) 1997  
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved. 
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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(s)     : Wieger Wesselink <wieger at cs.ruu.nl>
+
+/*!
+  \file Polygon_2_algorithms.h
+*/
+
+#ifndef CGAL_POLYGON_2_ALGORITHMS_H
+#define CGAL_POLYGON_2_ALGORITHMS_H
+
+#include <CGAL/basic.h>
+#include <CGAL/enum.h>
+#include <CGAL/Bbox_2.h>
+#include <CGAL/Polygon_2/polygon_assertions.h>
+
+/// 
+namespace CGAL {
+
+//-----------------------------------------------------------------------//
+//                  algorithms for sequences of 2D points
+//-----------------------------------------------------------------------//
+
+
+/// \addtogroup PkgPolygon2Functions
+/// @{
+
+/// Returns an iterator to the leftmost point from the range
+/// `[first,last)`. In case of a tie, the point
+/// with the smallest `y`-coordinate is taken.
+///
+/// \tparam Traits is a model of the concept `PolygonTraits_2`.
+/// 	  Only the members `Less_xy_2` and
+/// 	  `less_xy_2_object()` are used.
+/// \tparam ForwardIterator must have `Traits::Point_2` as value type.
+///
+///
+/// \sa `CGAL::right_vertex_2()`
+/// \sa `CGAL::top_vertex_2()`
+/// \sa `CGAL::bottom_vertex_2()`
+/// \sa `CGAL::Polygon_2`
+template <class ForwardIterator, class PolygonTraits>
+ForwardIterator left_vertex_2(ForwardIterator first,
+			      ForwardIterator last,
+			      const PolygonTraits& traits);
+
+/// Returns an iterator to the rightmost point from the range
+/// `[first,last)`. In case of a tie, the point
+/// with the largest `y`-coordinate is taken.
+/// 
+/// \tparam Traits is a model of the concept
+/// 	  `PolygonTraits_2`.
+/// 	  In fact, only the members `Less_xy_2` and
+/// 	  `less_xy_2_object()` are used.
+/// \tparam ForwardIterator must have`Traits::Point_2` as value type.
+///
+/// 
+/// \sa `CGAL::left_vertex_2()`
+/// \sa `CGAL::top_vertex_2()`
+/// \sa `CGAL::bottom_vertex_2()`
+/// \sa `CGAL::Polygon_2`
+template <class ForwardIterator, class PolygonTraits>
+ForwardIterator right_vertex_2(ForwardIterator first,
+			       ForwardIterator last,
+			       const PolygonTraits& traits);
+
+/// Returns an iterator to the topmost point from the range
+/// `[first,last)`. In case of a tie, the point
+/// with the largest `x`-coordinate is taken.
+///
+/// \tparam Traits is a model of the concept
+/// 	  `PolygonTraits_2`.
+/// 	  Only the members `Less_yx_2` and
+/// 	  `less_yx_2_object()` are used.
+/// \tparam ForwardIterator must have `Traits::Point_2` as value type.
+/// 
+/// \sa `CGAL::left_vertex_2()`
+/// \sa `CGAL::right_vertex_2()`
+/// \sa `CGAL::bottom_vertex_2()`
+/// \sa `CGAL::Polygon_2`
+template <class ForwardIterator, class PolygonTraits>
+ForwardIterator top_vertex_2(ForwardIterator first,
+			     ForwardIterator last,
+			     const PolygonTraits& traits);
+
+/// Returns an iterator to the bottommost point from the range
+/// `[first,last)`. In case of a tie, the point
+/// with the smallest `x`-coordinate is taken.
+///
+/// \tparam Traits is a model of the concept
+/// 	  `PolygonTraits_2`.
+/// 	  Only the members `Less_yx_2` and
+/// 	  `less_yx_2_object()` are used.
+/// \tparam ForwardIterator must have `Traits::Point_2` as value type.
+/// 
+/// \sa `CGAL::left_vertex_2()`
+/// \sa `CGAL::right_vertex_2()`
+/// \sa `CGAL::top_vertex_2()`
+/// \sa `CGAL::Polygon_2`
+/// \sa `PolygonTraits_2`
+template <class ForwardIterator, class PolygonTraits>
+ForwardIterator bottom_vertex_2(ForwardIterator first,
+				ForwardIterator last,
+				const PolygonTraits& traits);
+
+/// Computes the signed area of the polygon defined by the range of points
+/// `[first,last)`. The area is returned in the parameter
+/// `result`. The sign is positive for counterclockwise polygons, negative for
+/// clockwise polygons. If the polygon is not simple, the area is not well defined.
+/// The functionality is also available by the `polygon_area_2()` function, which
+/// returns the area instead of taking it as a parameter.
+/// 
+/// \tparam Traits is a model of the concept
+/// 	  `PolygonTraits_2`.
+/// 	  Only the following members of this traits class are used:
+///   - `Compute_area_2` : Computes the signed area of the
+/// 	    oriented triangle defined by 3 `Point_2` passed as arguments.
+///   - `FT`
+///   - `compute_area_2_object()`
+/// \tparam ForwardIterator must have `Traits::Point_2` as value type.
+/// 
+/// \sa `CGAL::polygon_area_2()`
+/// \sa `PolygonTraits_2`
+/// \sa `CGAL::orientation_2()`
+/// \sa `CGAL::Polygon_2`
+template <class ForwardIterator, class PolygonTraits>
+void 
+area_2( ForwardIterator first, ForwardIterator last,
+   	typename PolygonTraits::FT &result,
+        const PolygonTraits& traits)
+{
+  typedef typename PolygonTraits::FT FT;
+   result = FT(0);
+   // check if the polygon is empty
+   if (first == last) return;
+   ForwardIterator second = first; ++second;
+   // check if the polygon has only one point
+   if (second == last) return;
+   typename PolygonTraits::Compute_area_2 compute_area_2 =
+            traits.compute_area_2_object();
+   ForwardIterator third = second;
+   while (++third != last) {
+	result = result + compute_area_2(*first, *second, *third);
+	second = third;
+   }
+}
+
+/// Computes the signed area of the polygon defined by the range of points
+/// `[first,last)`.
+/// The sign is positive for counterclockwise polygons, negative for
+/// clockwise polygons. If the polygon is not simple, the area is not well defined.
+/// 
+/// \tparam Traits is a model of the concept `PolygonTraits_2`. Only the following members of this traits class are used:
+///   - `Compute_area_2` : Computes the signed area of the
+/// 	    oriented triangle defined by 3 `Point_2` passed as arguments.
+///   - `FT`
+///   - `compute_area_2_object`
+/// \tparam ForwardIterator must have `Traits::Point_2` as value type.
+/// 
+/// 
+/// \sa `PolygonTraits_2 `
+/// \sa `CGAL::orientation_2()`
+/// \sa `CGAL::Polygon_2 `
+template <class ForwardIterator, class PolygonTraits>
+typename PolygonTraits::FT 
+polygon_area_2( ForwardIterator first, ForwardIterator last,
+		const PolygonTraits& traits)
+{
+   typedef typename PolygonTraits::FT FT;
+   FT result = FT(0);
+   // check if the polygon is empty
+   if (first == last) return result;
+   ForwardIterator second = first; ++second;
+   // check if the polygon has only one point
+   if (second == last) return result;
+   typename PolygonTraits::Compute_area_2 compute_area_2 =
+            traits.compute_area_2_object();
+   ForwardIterator third = second;
+   while (++third != last) {
+	result = result + compute_area_2(*first, *second, *third);
+	second = third;
+   }
+   return result;
+}
+
+/// Checks if the polygon is convex.
+/// 
+/// \tparam Traits is a model of the concept
+/// 	  `PolygonTraits_2`.
+/// 	  Only the following members of this traits class are used:
+///   - `Less_xy_2`
+///   - `Orientation_2`
+///   - `less_xy_2_object`
+///   - `orientation_2_object`
+/// \tparam ForwardIterator must have `PolygonTraits::Point_2` as value type.
+///
+/// \sa `PolygonTraits_2 `
+/// \sa `CGAL::Polygon_2 `
+template <class ForwardIterator, class PolygonTraits>
+bool is_convex_2(ForwardIterator first,
+		 ForwardIterator last,
+		 const PolygonTraits& traits);
+
+/// Checks if the polygon defined by the
+/// iterator range `[first,last)` is simple, that is, if the edges 
+/// do not intersect, except consecutive edges in their common vertex.
+/// 
+/// \tparam Traits is a model of the concept
+/// 	  `PolygonTraits_2`.
+/// 	  Only the following members of this traits class are used:
+///   - `Point_2`
+///   - `Less_xy_2`
+///   - `Orientation_2`
+///   - `less_xy_2_object()`
+///   - `orientation_2_object()`
+/// \tparam ForwardIterator must have `PolygonTraits::Point_2` as value type.
+/// 
+/// ### Implementation##
+/// 
+/// The simplicity test is implemented by means of a plane sweep algorithm.
+/// The algorithm is quite robust when used with inexact number types.
+/// The running time is `O(n log n)`, where n is the number of vertices of the
+/// polygon.
+/// 
+/// \sa `PolygonTraits_2`
+/// \sa `CGAL::Polygon_2`
+template <class ForwardIterator, class PolygonTraits>
+bool is_simple_2(ForwardIterator first,
+		 ForwardIterator last,
+		 const PolygonTraits& traits);
+
+// In the following two functions we would like to use Traits::Point_2
+// instead of Point, but this is not allowed by g++ 2.7.2.
+///
+/// Computes on which side of a polygon a point lies.
+/// \tparam Traits is a model of the concept
+/// 	  `PolygonTraits_2`.
+/// 	  Only the following members of this traits class are used:
+///   - `Less_xy_2`
+///   - `Compare_x_2`
+///   - `Compare_y_2`
+///   - `Orientation_2`
+///   - `less_xy_2_object()`
+///   - `compare_x_2_object()`
+///   - `compare_y_2_object()`
+///   - `orientation_2_object()`
+/// \tparam ForwardIterator must have `PolygonTraits::Point_2` as value type.
+///
+/// \sa `PolygonTraits_2`
+/// \sa `CGAL::bounded_side_2()`
+/// \sa `CGAL::is_simple_2()`
+/// \sa `CGAL::Polygon_2`
+/// \sa `Oriented_side`
+template <class ForwardIterator, class Point, class Traits>
+Oriented_side oriented_side_2(ForwardIterator first,
+			      ForwardIterator last,
+			      const Point& point,
+			      const Traits& traits);
+
+/// Computes if a point lies inside a polygon.
+/// The polygon is defined by the sequence of points `[first,last)`.
+/// Being inside is defined by the odd-even rule. If we take a ray starting at the
+/// point and extending to infinity (in any direction), we count the number of
+/// intersections. If this number is odd, the point is inside, otherwise it is
+/// outside. If the point is on a polygon edge, a special value is returned.  A
+/// simple polygon divides the plane in an unbounded and a bounded region.
+/// According to the definition points in the bounded region are inside the polygon.
+/// 
+/// 
+/// \tparam Traits is a model of the concept
+/// 	  `PolygonTraits_2`.
+/// 	  Only the following members of this traits class are used:
+///   - `Compare_x_2`
+///   - `Compare_y_2`
+///   - `Orientation_2`
+///   - `compare_x_2_object()`
+///   - `compare_y_2_object()`
+///   - `orientation_2_object()`
+/// \tparam ForwardIterator must have `Traits::Point_2` as value type.
+/// 
+/// ### Implementation ###
+/// 
+/// The running time is linear in the number of vertices of the polygon.
+/// A horizontal ray is taken to count the number of intersections.
+/// Special care is taken that the result is correct even if there are degeneracies
+/// (if the ray passes through a vertex).
+///
+/// 
+/// \sa `PolygonTraits_2`
+/// \sa `CGAL::oriented_side_2()`
+/// \sa `CGAL::Polygon_2 `
+/// \sa `CGAL::Bounded_side`
+template <class ForwardIterator, class Point, class PolygonTraits>
+Bounded_side bounded_side_2(ForwardIterator first,
+			    ForwardIterator last,
+			    const Point& point,
+			    const PolygonTraits& traits);
+
+/// Computes if a polygon is clockwise or counterclockwise oriented.
+/// \pre `is_simple_2(first, last, traits);`
+/// 
+/// \tparam Traits is a model of the concept
+/// 	  `PolygonTraits_2`.
+/// 	  Only the following members of this traits class are used:
+///   - `Less_xy_2`
+///   - `less_xy_2_object()`
+///   - `orientation_2_object()`
+/// \tparam ForwardIterator must have`Traits::Point_2` as value type.
+/// 
+/// 
+/// 
+/// \sa `PolygonTraits_2`
+/// \sa `CGAL::is_simple_2()`
+/// \sa `CGAL::Polygon_2`
+/// \sa `CGAL::Orientation_2`
+template <class ForwardIterator, class Traits>
+Orientation orientation_2(ForwardIterator first,
+			  ForwardIterator last,
+			  const Traits& traits);
+
+/// @}
+
+//-----------------------------------------------------------------------//
+//                         implementation
+//-----------------------------------------------------------------------//
+
+template <class ForwardIterator>
+inline
+ForwardIterator left_vertex_2(ForwardIterator first,
+			      ForwardIterator last)
+{  
+  typedef typename Kernel_traits<
+    typename std::iterator_traits<ForwardIterator>::value_type>::Kernel K; 
+  return left_vertex_2(first, last, K());
+}
+
+
+template <class ForwardIterator>
+inline
+ForwardIterator right_vertex_2(ForwardIterator first,
+			       ForwardIterator last)
+{ 
+  typedef typename Kernel_traits<
+    typename std::iterator_traits<ForwardIterator>::value_type>::Kernel K; 
+  return right_vertex_2(first, last, K());
+}
+
+
+template <class ForwardIterator>
+inline
+ForwardIterator top_vertex_2(ForwardIterator first,
+			     ForwardIterator last)
+{
+  typedef typename Kernel_traits<
+    typename std::iterator_traits<ForwardIterator>::value_type>::Kernel K; 
+  return top_vertex_2(first, last, K());
+}
+
+
+template <class ForwardIterator>
+inline
+ForwardIterator bottom_vertex_2(ForwardIterator first,
+				ForwardIterator last)
+{
+  typedef typename Kernel_traits<
+    typename std::iterator_traits<ForwardIterator>::value_type>::Kernel K; 
+  return bottom_vertex_2(first, last, K());
+}
+
+template <class ForwardIterator, class Numbertype>
+inline
+void area_2(ForwardIterator first,
+	    ForwardIterator last,
+	    Numbertype& result)
+{
+  typedef typename Kernel_traits<
+    typename std::iterator_traits<ForwardIterator>::value_type>::Kernel K; 
+  area_2(first, last, result, K());
+}
+
+
+
+template <class ForwardIterator>
+inline
+bool is_convex_2(ForwardIterator first,
+		 ForwardIterator last)
+{
+  typedef typename Kernel_traits<
+    typename std::iterator_traits<ForwardIterator>::value_type>::Kernel K; 
+  return is_convex_2(first, last, K());
+}
+
+
+
+template <class ForwardIterator>
+inline
+bool is_simple_2(ForwardIterator first,
+		 ForwardIterator last)
+{
+  typedef typename Kernel_traits<
+    typename std::iterator_traits<ForwardIterator>::value_type>::Kernel K; 
+  return is_simple_2(first, last, K());
+}
+
+template <class ForwardIterator>
+inline
+Oriented_side oriented_side_2(
+  ForwardIterator first,
+  ForwardIterator last,
+  const typename std::iterator_traits<ForwardIterator>::value_type& point)
+{
+  typedef typename Kernel_traits<
+    typename std::iterator_traits<ForwardIterator>::value_type>::Kernel K; 
+  return oriented_side_2(first, last, point, K());
+}
+
+
+template <class ForwardIterator>
+inline
+Bounded_side bounded_side_2(
+  ForwardIterator first,
+  ForwardIterator last,
+  const typename std::iterator_traits<ForwardIterator>::value_type& point)
+{
+  typedef typename Kernel_traits<
+    typename std::iterator_traits<ForwardIterator>::value_type>::Kernel K; 
+  return bounded_side_2(first, last, point, K());
+}
+
+
+
+template <class ForwardIterator>
+inline
+Orientation orientation_2(ForwardIterator first,
+			  ForwardIterator last)
+{
+  typedef typename Kernel_traits<
+    typename std::iterator_traits<ForwardIterator>::value_type>::Kernel K; 
+  return orientation_2(first, last, K());
+}
+
+} //namespace CGAL
+
+#include <CGAL/Polygon_2/Polygon_2_algorithms_impl.h>
+
+#endif // CGAL_POLYGON_2_ALGORITHMS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_convex_decomposition_2.h b/3rdparty/CGAL/include/CGAL/Polygon_convex_decomposition_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polygon_convex_decomposition_2.h
rename to 3rdparty/CGAL/include/CGAL/Polygon_convex_decomposition_2.h
diff --git a/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/Weights.h b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/Weights.h
new file mode 100644
index 0000000..8545341
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/Weights.h
@@ -0,0 +1,766 @@
+// Copyright (c) 2015 GeometryFactory (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Yin Xu, Andreas Fabri and Ilker O. Yaz
+
+#ifndef CGAL_PMP_WEIGHTS_H
+#define CGAL_PMP_WEIGHTS_H
+/// @cond CGAL_DOCUMENT_INTERNAL
+
+#include <CGAL/boost/graph/helpers.h>
+#include <CGAL/Kernel/global_functions_3.h>
+#include <CGAL/property_map.h>
+
+namespace CGAL {
+namespace internal {
+
+// Returns the cotangent value of half angle v0 v1 v2
+// using formula in -[Meyer02] Discrete Differential-Geometry Operators for- page 19
+// The potential problem with previous one (Cotangent_value) is that it does not produce symmetric results
+// (i.e. for v0, v1, v2 and v2, v1, v0 returned cot weights can be slightly different)
+// This one provides stable results.
+template<class PolygonMesh>
+struct Cotangent_value_Meyer_impl
+{
+  typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
+
+  template <class VertexPointMap>
+  double operator()(vertex_descriptor v0, vertex_descriptor v1, vertex_descriptor v2, const VertexPointMap& ppmap)
+  {
+    typedef typename Kernel_traits<
+      typename boost::property_traits<VertexPointMap>::value_type >::Kernel::Vector_3 Vector;
+    
+    Vector a = get(ppmap, v0) - get(ppmap, v1);
+    Vector b = get(ppmap, v2) - get(ppmap, v1);
+    
+    double dot_ab = to_double(a*b);
+    // rewritten for safer fp arithmetic
+    //double dot_aa = a.squared_length();
+    //double dot_bb = b.squared_length();
+    //double divider = CGAL::sqrt( dot_aa * dot_bb - dot_ab * dot_ab );
+
+    Vector cross_ab = CGAL::cross_product(a, b);
+    double divider = to_double(CGAL::approximate_sqrt(cross_ab*cross_ab));
+
+    if(divider == 0 /*|| divider != divider*/) 
+    {
+      CGAL::collinear(get(ppmap, v0), get(ppmap, v1), get(ppmap, v2)) ? 
+        CGAL_warning(!"Infinite Cotangent value with degenerate triangle!") :
+        CGAL_warning(!"Infinite Cotangent value due to floating point arithmetic!");
+      
+
+      return dot_ab > 0 ? (std::numeric_limits<double>::max)() :
+                         -(std::numeric_limits<double>::max)();
+    }
+    
+    return dot_ab / divider;
+  }
+};
+
+// Same as above but with a different API
+template<class PolygonMesh
+  , class VertexPointMap = typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::type>
+class Cotangent_value_Meyer
+{
+protected:
+  typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
+  typedef VertexPointMap Point_property_map;
+  typedef typename boost::property_traits<Point_property_map>::value_type Point;
+  typedef typename Kernel_traits<Point>::Kernel::Vector_3  Vector;
+
+  PolygonMesh& pmesh_;
+  Point_property_map ppmap;
+
+public:
+  
+  Cotangent_value_Meyer(PolygonMesh& pmesh_, VertexPointMap vpmap_)
+    : pmesh_(pmesh_)
+    , ppmap(vpmap_)
+  {}
+
+  PolygonMesh& pmesh()
+  {
+    return pmesh_;
+  }
+
+  double operator()(vertex_descriptor v0, vertex_descriptor v1, vertex_descriptor v2)
+  {
+    return Cotangent_value_Meyer_impl<PolygonMesh>()(v0,v1,v2,ppmap);
+  }
+};
+
+
+// imported from skeletonization
+template<class PolygonMesh,
+         class VertexPointMap =
+          typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::type>
+class Cotangent_value_Meyer_secure
+{
+  typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
+  typedef VertexPointMap Point_property_map;
+  typedef typename boost::property_traits<Point_property_map>::value_type Point;
+  typedef typename Kernel_traits<Point>::Kernel::Vector_3  Vector;
+
+  PolygonMesh& pmesh_;
+  Point_property_map ppmap;
+
+public:
+  
+  Cotangent_value_Meyer_secure(PolygonMesh& pmesh_, VertexPointMap vpmap_)
+    : pmesh_(pmesh_)
+    , ppmap(vpmap_)
+  {}
+
+  PolygonMesh& pmesh()
+  {
+    return pmesh_;
+  }
+
+  double operator()(vertex_descriptor v0, vertex_descriptor v1, vertex_descriptor v2)
+  {
+    Vector a = get(ppmap, v0) - get(ppmap, v1);
+    Vector b = get(ppmap, v2) - get(ppmap, v1);
+    
+    double dot_ab = a*b;
+    double dot_aa = a.squared_length();
+    double dot_bb = b.squared_length();
+    double lb = -0.999, ub = 0.999;
+    double cosine = dot_ab / CGAL::sqrt(dot_aa) / CGAL::sqrt(dot_bb);
+    cosine = (cosine < lb) ? lb : cosine;
+    cosine = (cosine > ub) ? ub : cosine;
+    double sine = std::sqrt(1.0 - cosine * cosine);
+    return cosine / sine;
+  }
+};
+
+// Returns the cotangent value of half angle v0 v1 v2 by clamping between [1, 89] degrees
+// as suggested by -[Friedel] Unconstrained Spherical Parameterization-
+template<class PolygonMesh
+  , class VertexPointMap = typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::type
+  , class CotangentValue = Cotangent_value_Meyer<PolygonMesh, VertexPointMap> >
+class Cotangent_value_clamped : CotangentValue
+{
+  Cotangent_value_clamped()
+  {}
+public:
+
+  Cotangent_value_clamped(PolygonMesh& pmesh_, VertexPointMap vpmap_)
+    : CotangentValue(pmesh_, vpmap_)
+  {}
+
+  PolygonMesh& pmesh()
+  {
+    return CotangentValue::pmesh();
+  }
+
+  typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
+
+  double operator()(vertex_descriptor v0, vertex_descriptor v1, vertex_descriptor v2)
+  {
+    const double cot_1 = 57.289962;
+    const double cot_89 = 0.017455;
+    double value = CotangentValue::operator()(v0, v1, v2);
+    return (std::max)(cot_89, (std::min)(value, cot_1));
+  }
+};
+
+template<class PolygonMesh
+  , class VertexPointMap = typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::type
+  , class CotangentValue = Cotangent_value_Meyer<PolygonMesh, VertexPointMap> >
+class Cotangent_value_clamped_2 : CotangentValue
+{
+  Cotangent_value_clamped_2()
+  {}
+
+public:
+
+  Cotangent_value_clamped_2(PolygonMesh& pmesh_, VertexPointMap vpmap_)
+    : CotangentValue(pmesh_, vpmap_)
+  {}
+
+  PolygonMesh& pmesh()
+  {
+    return CotangentValue::pmesh();
+  }
+
+  typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
+
+  double operator()(vertex_descriptor v0, vertex_descriptor v1, vertex_descriptor v2)
+  {
+    const double cot_5 = 5.671282;
+    const double cot_175 = -cot_5;
+    double value = CotangentValue::operator()(v0, v1, v2);
+    return (std::max)(cot_175, (std::min)(value, cot_5));
+  }
+};
+
+template<class PolygonMesh
+  , class VertexPointMap = typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::type
+  , class CotangentValue = Cotangent_value_Meyer<PolygonMesh, VertexPointMap> >
+class Cotangent_value_minimum_zero : CotangentValue
+{
+  Cotangent_value_minimum_zero()
+  {}
+public:
+  Cotangent_value_minimum_zero(PolygonMesh& pmesh_, VertexPointMap vpmap_)
+    : CotangentValue(pmesh_, vpmap_)
+  {}
+
+  PolygonMesh& pmesh()
+  {
+    return CotangentValue::pmesh();
+  }
+
+  typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
+
+  double operator()(vertex_descriptor v0, vertex_descriptor v1, vertex_descriptor v2)
+  {
+    double value = CotangentValue::operator()(v0, v1, v2);
+    return (std::max)(0.0, value);
+  }
+};
+
+template<class PolygonMesh,
+         class CotangentValue = Cotangent_value_Meyer_impl<PolygonMesh> >
+struct Cotangent_value_minimum_zero_impl : CotangentValue
+{
+  typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
+
+  template <class VertexPointMap>
+  double operator()(vertex_descriptor v0, vertex_descriptor v1, vertex_descriptor v2, const VertexPointMap& ppmap)
+  {
+    double value = CotangentValue::operator()(v0, v1, v2,ppmap);
+    return (std::max)(0.0, value);
+  }
+};
+
+template<class PolygonMesh
+    , class VertexPointMap = typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::type
+    , class CotangentValue
+           = Cotangent_value_Meyer<PolygonMesh, VertexPointMap> >
+class Voronoi_area : CotangentValue
+{
+  //Voronoi_area()
+  //{}
+  
+public:
+  Voronoi_area(PolygonMesh& pmesh_, VertexPointMap vpmap_)
+    : CotangentValue(pmesh_, vpmap_)
+  {}
+
+  //Voronoi_area(PolygonMesh& pmesh_)
+  //  : CotangentValue(pmesh_, get(CGAL::vertex_point, pmesh_))
+  //{}
+
+  PolygonMesh& pmesh()
+  {
+    return CotangentValue::pmesh();
+  }
+
+  typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
+  typedef typename boost::graph_traits<PolygonMesh>::in_edge_iterator in_edge_iterator;
+  typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor halfedge_descriptor;
+
+  typedef VertexPointMap Point_property_map;
+  typedef typename boost::property_traits<Point_property_map>::value_type Point;
+  typedef typename Kernel_traits<Point>::Kernel::Vector_3  Vector;
+
+  double operator()(vertex_descriptor v0) {
+
+    //return 1.0;
+    double voronoi_area = 0.0;
+    BOOST_FOREACH(halfedge_descriptor he,
+                  halfedges_around_target( halfedge(v0,pmesh()), pmesh()) )
+    {
+      if( is_border(he,pmesh()) ) { continue; }
+
+      CGAL_assertion(CGAL::is_triangle_mesh(pmesh()));
+      CGAL_assertion( v0 == target(he, pmesh()) );
+      vertex_descriptor v1 = source(he, pmesh());
+      vertex_descriptor v_op = target(next(he, pmesh()), pmesh());
+
+      const Point& v0_p = get(this->ppmap, v0);
+      const Point& v1_p = get(this->ppmap, v1);
+      const Point& v_op_p = get(this->ppmap, v_op);
+
+      // (?) check if there is a better way to predicate triangle is obtuse or not
+      CGAL::Angle angle0 = CGAL::angle(v1_p, v0_p, v_op_p);
+      CGAL::Angle angle1 = CGAL::angle(v_op_p, v1_p, v0_p);
+      CGAL::Angle angle_op = CGAL::angle(v0_p, v_op_p, v1_p);
+
+      bool obtuse = (angle0 == CGAL::OBTUSE) || (angle1 == CGAL::OBTUSE) || (angle_op == CGAL::OBTUSE);
+
+      if(!obtuse) {
+        double cot_v1 = CotangentValue::operator()(v_op, v1, v0);
+        double cot_v_op = CotangentValue::operator()(v0, v_op, v1);
+
+        double term1 = cot_v1   * to_double((v_op_p - v0_p).squared_length());
+        double term2 = cot_v_op * to_double((v1_p  - v0_p).squared_length());
+        voronoi_area += (1.0 / 8.0) * (term1 + term2);
+      }
+      else {
+        double area_t = to_double(CGAL::approximate_sqrt(squared_area(v0_p, v1_p, v_op_p)));
+        if(angle0 == CGAL::OBTUSE) {
+          voronoi_area += area_t / 2.0;
+        }
+        else {
+          voronoi_area += area_t / 4.0;
+        }
+      }
+    }
+    CGAL_warning(voronoi_area != 0 && "Zero voronoi area!");
+    return voronoi_area;
+  }
+};
+// Returns the cotangent value of half angle v0 v1 v2 by dividing the triangle area
+// as suggested by -[Mullen08] Spectral Conformal Parameterization-
+template<class PolygonMesh
+  , class VertexPointMap = typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::type
+  , class CotangentValue = Cotangent_value_Meyer<PolygonMesh, VertexPointMap> >
+class Cotangent_value_area_weighted : CotangentValue
+{
+  Cotangent_value_area_weighted()
+  {}
+
+public:
+
+  Cotangent_value_area_weighted(PolygonMesh& pmesh_, VertexPointMap vpmap_)
+    : CotangentValue(pmesh_, vpmap_)
+  {}
+
+  PolygonMesh& pmesh()
+  {
+    return CotangentValue::pmesh();
+  }
+
+  typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
+
+  double operator()(vertex_descriptor v0, vertex_descriptor v1, vertex_descriptor v2)
+  {
+    return CotangentValue::operator()(v0, v1, v2)
+      / CGAL::sqrt(squared_area(v0->point(), v1->point(), v2->point()));
+  }
+};
+/////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////// Edge Weight Calculators ///////////////////////////////////
+// Cotangent weight calculator 
+// Cotangent_value:               as suggested by -[Sorkine07] ARAP Surface Modeling-
+// Cotangent_value_area_weighted: as suggested by -[Mullen08] Spectral Conformal Parameterization-
+template< class PolygonMesh,
+          class CotangentValue = Cotangent_value_minimum_zero_impl<PolygonMesh> >
+struct Cotangent_weight_impl : CotangentValue
+{
+  typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor   halfedge_descriptor;
+  typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
+
+  // Returns the cotangent weight of specified halfedge_descriptor
+  // Edge orientation is trivial
+  template<class VertexPointMap>
+  double operator()(halfedge_descriptor he, PolygonMesh& pmesh, const VertexPointMap& ppmap)
+  {
+    vertex_descriptor v0 = target(he, pmesh);
+    vertex_descriptor v1 = source(he, pmesh);
+     // Only one triangle for border edges
+    if (is_border_edge(he, pmesh))
+     {
+       
+       halfedge_descriptor he_cw = opposite( next(he, pmesh) , pmesh );
+       vertex_descriptor v2 = source(he_cw, pmesh);
+       if (is_border_edge(he_cw, pmesh) )
+       {
+         halfedge_descriptor he_ccw = prev( opposite(he, pmesh) , pmesh );
+         v2 = source(he_ccw, pmesh);
+       }
+       return ( CotangentValue::operator()(v0, v2, v1, ppmap)/2.0 );
+     }
+     else
+     {
+       halfedge_descriptor he_cw = opposite( next(he, pmesh) , pmesh );
+       vertex_descriptor v2 = source(he_cw, pmesh);     
+       halfedge_descriptor he_ccw = prev( opposite(he, pmesh) , pmesh );
+       vertex_descriptor v3 = source(he_ccw, pmesh);
+
+        return ( CotangentValue::operator()(v0, v2, v1, ppmap)/2.0 +
+                 CotangentValue::operator()(v0, v3, v1, ppmap)/2.0 );
+     }
+  }
+};
+
+template<class PolygonMesh
+  , class VertexPointMap = typename boost::property_map<PolygonMesh, vertex_point_t>::type
+  , class CotangentValue
+           = Cotangent_value_minimum_zero<PolygonMesh, VertexPointMap> >
+class Cotangent_weight : CotangentValue
+{
+  Cotangent_weight()
+  {}
+
+public:
+  Cotangent_weight(PolygonMesh& pmesh_, VertexPointMap vpmap_)
+    : CotangentValue(pmesh_, vpmap_)
+  {}
+
+  Cotangent_weight(PolygonMesh& pmesh_)
+    : CotangentValue(pmesh_, get(CGAL::vertex_point, pmesh_))
+  {}
+
+  PolygonMesh& pmesh()
+  {
+    return CotangentValue::pmesh();
+  }
+
+  typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor   halfedge_descriptor;
+  typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
+
+  typedef typename boost::property_map<PolygonMesh,vertex_point_t>::type Point_property_map;
+  typedef typename boost::property_traits<Point_property_map>::value_type Point;
+  typedef typename Kernel_traits<Point>::Kernel::Vector_3  Vector;
+
+  // Returns the cotangent weight of specified halfedge_descriptor
+  // Edge orientation is trivial
+  double operator()(halfedge_descriptor he)
+  {
+    vertex_descriptor v0 = target(he, pmesh());
+    vertex_descriptor v1 = source(he, pmesh());
+     // Only one triangle for border edges
+    if (is_border_edge(he, pmesh()))
+     {
+       
+       halfedge_descriptor he_cw = opposite( next(he, pmesh()) , pmesh() );
+       vertex_descriptor v2 = source(he_cw, pmesh());
+       if (is_border_edge(he_cw, pmesh()) )
+       {
+         halfedge_descriptor he_ccw = prev( opposite(he, pmesh()) , pmesh() );
+         v2 = source(he_ccw, pmesh());
+       }
+       return ( CotangentValue::operator()(v0, v2, v1)/2.0 );
+     }
+     else
+     {
+       halfedge_descriptor he_cw = opposite( next(he, pmesh()) , pmesh() );
+       vertex_descriptor v2 = source(he_cw, pmesh());     
+       halfedge_descriptor he_ccw = prev( opposite(he, pmesh()) , pmesh() );
+       vertex_descriptor v3 = source(he_ccw, pmesh());
+
+        return ( CotangentValue::operator()(v0, v2, v1)/2.0 + CotangentValue::operator()(v0, v3, v1)/2.0 );
+     }
+  }
+};
+
+// Single cotangent from -[Chao10] Simple Geometric Model for Elastic Deformation
+template<class PolygonMesh,
+         class CotangentValue = Cotangent_value_Meyer_impl<PolygonMesh> >
+struct Single_cotangent_weight_impl : CotangentValue
+{
+  typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor   halfedge_descriptor;
+  typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
+
+  // Returns the cotangent of the opposite angle of the edge
+  // 0 for border edges (which does not have an opposite angle)
+  template <class VertexPointMap>
+  double operator()(halfedge_descriptor he, PolygonMesh& pmesh, const VertexPointMap& ppmap)
+  {
+    if(is_border(he, pmesh)) { return 0.0;}
+     
+    vertex_descriptor v0 = target(he, pmesh);
+    vertex_descriptor v1 = source(he, pmesh);
+
+    vertex_descriptor v_op = target(next(he, pmesh), pmesh);
+     return CotangentValue::operator()(v0, v_op, v1, ppmap);
+  }
+};
+
+template<class PolygonMesh
+  , class VertexPointMap = typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::type
+  , class CotangentValue = Cotangent_value_Meyer<PolygonMesh, VertexPointMap> >
+class Single_cotangent_weight : CotangentValue
+{
+  Single_cotangent_weight()
+  {}
+public:
+  Single_cotangent_weight(PolygonMesh& pmesh_, VertexPointMap vpmap_)
+    : CotangentValue(pmesh_, vpmap_)
+  {}
+
+  PolygonMesh& pmesh()
+  {
+    return CotangentValue::pmesh();
+  }
+
+  typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor   halfedge_descriptor;
+  typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
+
+  typedef typename boost::property_map<PolygonMesh,vertex_point_t>::type Point_property_map;
+  typedef typename boost::property_traits<Point_property_map>::value_type Point;
+  typedef typename Kernel_traits<Point>::Kernel::Vector_3  Vector;
+
+  // Returns the cotangent of the opposite angle of the edge
+  // 0 for border edges (which does not have an opposite angle)
+  double operator()(halfedge_descriptor he)
+  {
+    if(is_border(he, pmesh())) { return 0.0;}
+     
+    vertex_descriptor v0 = target(he, pmesh());
+    vertex_descriptor v1 = source(he, pmesh());
+
+    vertex_descriptor v_op = target(next(he, pmesh()), pmesh());
+     return CotangentValue::operator()(v0, v_op, v1);
+  }
+};
+
+// Mean value calculator described in -[Floater04] Mean Value Coordinates-
+template<class PolygonMesh
+       , class VertexPointMap = typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::type>
+class Mean_value_weight
+{
+  //Mean_value_weight()
+  //{}
+
+  PolygonMesh& pmesh_;
+  VertexPointMap vpmap_;
+
+public:
+  Mean_value_weight(PolygonMesh& pmesh_, VertexPointMap vpmap)
+    : pmesh_(pmesh_), vpmap_(vpmap)
+  {}
+
+  PolygonMesh& pmesh()
+  {
+    return pmesh_;
+  }
+
+  typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor  halfedge_descriptor;
+  typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor    vertex_descriptor;
+
+  typedef VertexPointMap Point_property_map;
+  typedef typename boost::property_traits<Point_property_map>::value_type Point;
+  typedef typename Kernel_traits<Point>::Kernel::Vector_3  Vector;
+
+  // Returns the mean-value coordinate of specified halfedge_descriptor
+  // Returns different value for different edge orientation (which is a normal behaivour according to formula)
+  double operator()(halfedge_descriptor he)
+  {
+    vertex_descriptor v0 = target(he, pmesh());
+    vertex_descriptor v1 = source(he, pmesh());
+    Vector vec = v0->point() - v1->point();
+    double norm = CGAL::sqrt( vec.squared_length() );
+
+    // Only one triangle for border edges
+    if ( is_border_edge(he, pmesh()) )
+    {
+      halfedge_descriptor he_cw = opposite( next(he, pmesh()) , pmesh() );
+      vertex_descriptor v2 = source(he_cw, pmesh());
+      if ( is_border_edge(he_cw, pmesh()) )
+      {
+        halfedge_descriptor he_ccw = prev( opposite(he, pmesh()) , pmesh() );
+        v2 = source(he_ccw, pmesh());
+      }
+
+      return ( half_tan_value_2(v1, v0, v2)/norm);
+    }
+    else
+    {
+      halfedge_descriptor he_cw = opposite( next(he, pmesh()) , pmesh() );
+      vertex_descriptor v2 = source(he_cw, pmesh());     
+      halfedge_descriptor he_ccw = prev( opposite(he, pmesh()) , pmesh() );
+      vertex_descriptor v3 = source(he_ccw, pmesh());
+
+      return ( half_tan_value_2(v1, v0, v2)/norm + half_tan_value_2(v1, v0, v3)/norm);
+    }
+  }
+
+private:
+  // Returns the tangent value of half angle v0_v1_v2/2
+  double half_tan_value(vertex_descriptor v0, vertex_descriptor v1, vertex_descriptor v2)
+  {
+    Vector vec0 = v1->point() - v2->point();
+    Vector vec1 = v2->point() - v0->point();
+    Vector vec2 = v0->point() - v1->point();
+    double e0_square = vec0.squared_length();
+    double e1_square = vec1.squared_length();
+    double e2_square = vec2.squared_length();
+    double e0 = CGAL::sqrt(e0_square);
+    double e2 = CGAL::sqrt(e2_square);
+    double cos_angle = ( e0_square + e2_square - e1_square ) / 2.0 / e0 / e2;
+    cos_angle = (std::max)(-1.0, (std::min)(1.0, cos_angle)); // clamp into [-1, 1]
+    double angle = acos(cos_angle);
+    
+    return ( tan(angle/2.0) );
+  }
+
+  // My deviation built on Meyer_02
+  double half_tan_value_2(vertex_descriptor v0, vertex_descriptor v1, vertex_descriptor v2)
+  {
+    Vector a = v0->point() - v1->point();
+    Vector b = v2->point() - v1->point();
+    double dot_ab = a[0]*b[0] + a[1]*b[1] + a[2]*b[2];
+    double dot_aa = a.squared_length();
+    double dot_bb = b.squared_length();
+    double dot_aa_bb = dot_aa * dot_bb;
+
+    double cos_rep = dot_ab;
+    double sin_rep = CGAL::sqrt(dot_aa_bb  - dot_ab * dot_ab);
+    double normalizer = CGAL::sqrt(dot_aa_bb); // |a|*|b|
+
+    return (normalizer - cos_rep) / sin_rep; // formula from [Floater04] page 4
+                                             // tan(Q/2) = (1 - cos(Q)) / sin(Q)
+  }
+};
+
+template< class PolygonMesh, 
+          class PrimaryWeight = Cotangent_weight<PolygonMesh>,
+          class SecondaryWeight = Mean_value_weight<PolygonMesh> >
+class Hybrid_weight : public PrimaryWeight, SecondaryWeight
+{
+  PrimaryWeight primary;
+  SecondaryWeight secondary;
+
+  Hybrid_weight()
+  {}
+
+public:
+  Hybrid_weight(PolygonMesh& pmesh_)
+    : primary(pmesh_), secondary(pmesh_)
+  {}
+
+  PolygonMesh& pmesh()
+  {
+    return primary.pmesh();
+  }
+
+  typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor   halfedge_descriptor;
+
+  double operator()(halfedge_descriptor he)
+  {
+    double weight = primary(he);
+    //if(weight < 0) { std::cout << "Negative weight" << std::endl; }
+    return (weight >= 0) ? weight : secondary(he);
+  }
+};
+
+// Trivial uniform weights (created for test purposes)
+template<class PolygonMesh>
+class Uniform_weight
+{
+public:
+  typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor   halfedge_descriptor;
+
+  double operator()(halfedge_descriptor /*e*/)
+  { return 1.0; }
+};
+
+////////////////////////////////////////////////////////////////////////////
+//                              FAIRING                                   //
+template<class PolygonMesh>
+class Scale_dependent_weight_fairing
+{
+  PolygonMesh& pmesh_;
+public:
+  Scale_dependent_weight_fairing(PolygonMesh& pmesh_)
+    : pmesh_(pmesh_)
+  {}
+
+  PolygonMesh& pmesh()
+  {
+    return pmesh_;
+  }
+
+  typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor   halfedge_descriptor;
+  typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
+
+  typedef typename boost::property_map<PolygonMesh,vertex_point_t>::type Point_property_map;
+  typedef typename boost::property_traits<Point_property_map>::value_type Point;
+  typedef typename Kernel_traits<Point>::Kernel::Vector_3  Vector;
+
+  double w_i(vertex_descriptor /*v_i*/) { return 1.0; }
+
+  double w_ij(halfedge_descriptor he)
+  {
+    Vector v = target(he, pmesh())->point() - source(he, pmesh())->point();
+    double divider = CGAL::sqrt(v.squared_length());
+    if(divider == 0.0) {
+      CGAL_warning(!"Scale dependent weight - zero length edge.");
+      return (std::numeric_limits<double>::max)();
+    }
+    return 1.0 / divider;
+  }
+};
+
+template<class PolygonMesh
+  , class VertexPointMap = typename boost::property_map<PolygonMesh, vertex_point_t>::type
+>
+class Cotangent_weight_with_voronoi_area_fairing
+{
+  typedef PolygonMesh PM;
+  typedef VertexPointMap VPMap;
+  Voronoi_area<PM, VPMap> voronoi_functor;
+  Cotangent_weight<PM, VPMap, Cotangent_value_Meyer<PM, VPMap> > cotangent_functor;
+
+public:
+  Cotangent_weight_with_voronoi_area_fairing(PM& pmesh_)
+    : voronoi_functor(pmesh_, get(CGAL::vertex_point, pmesh_))
+    , cotangent_functor(pmesh_, get(CGAL::vertex_point, pmesh_))
+  {}
+
+  Cotangent_weight_with_voronoi_area_fairing(PM& pmesh_, VPMap vpmap_)
+    : voronoi_functor(pmesh_, vpmap_)
+    , cotangent_functor(pmesh_, vpmap_)
+  {}
+
+  PM& pmesh()
+  {
+    return voronoi_functor.pmesh();
+  }
+
+  typedef typename boost::graph_traits<PM>::halfedge_descriptor   halfedge_descriptor;
+  typedef typename boost::graph_traits<PM>::vertex_descriptor vertex_descriptor;
+
+  double w_i(vertex_descriptor v_i)
+  {
+    return 0.5 / voronoi_functor(v_i);
+  }
+
+  double w_ij(halfedge_descriptor he) {
+
+    return cotangent_functor(he) * 2.0;
+  }
+};
+
+template<class PolygonMesh>
+class Uniform_weight_fairing
+{
+public:
+  typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor halfedge_descriptor;
+  typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
+
+  Uniform_weight_fairing(PolygonMesh&)
+  {}
+
+  double w_ij(halfedge_descriptor /*e*/) { return 1.0; }
+
+  double w_i(vertex_descriptor /*v_i*/) { return 1.0; }
+};
+////////////////////////////////////////////////////////////////////////////
+
+}//namespace internal
+
+
+}//namespace CGAL
+/// @endcond
+#endif //CGAL_PMP_WEIGHTS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/bbox.h b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/bbox.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/bbox.h
rename to 3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/bbox.h
diff --git a/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/border.h b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/border.h
new file mode 100644
index 0000000..5f0f4ac
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/border.h
@@ -0,0 +1,217 @@
+// Copyright (c) 2015 GeometryFactory (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Jane Tournois
+
+#ifndef CGAL_POLYGON_MESH_PROCESSING_GET_BORDER_H
+#define CGAL_POLYGON_MESH_PROCESSING_GET_BORDER_H
+
+#include <boost/graph/graph_traits.hpp>
+#include <boost/foreach.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+#include <CGAL/Polygon_mesh_processing/internal/named_function_params.h>
+#include <CGAL/Polygon_mesh_processing/internal/named_params_helper.h>
+
+#include <set>
+
+namespace CGAL{
+namespace Polygon_mesh_processing {
+
+  namespace internal
+  {
+    template<typename PM
+           , typename FaceRange
+           , typename HalfedgeOutputIterator>
+    HalfedgeOutputIterator border_halfedges_impl(const FaceRange& faces
+                                               , HalfedgeOutputIterator out
+                                               , const PM& pmesh)
+    {
+      typedef typename boost::graph_traits<PM>::halfedge_descriptor halfedge_descriptor;
+      typedef typename boost::graph_traits<PM>::face_descriptor     face_descriptor;
+
+      //collect halfedges that appear only once
+      // the bool is true if the halfedge stored is the one of the face,
+      // false if it is its opposite
+      std::map<halfedge_descriptor, bool> border;
+      BOOST_FOREACH(face_descriptor f, faces)
+      {
+        BOOST_FOREACH(halfedge_descriptor h,
+          halfedges_around_face(halfedge(f, pmesh), pmesh))
+        {
+          //halfedge_descriptor is model of `LessThanComparable`
+          bool from_face = (h < opposite(h, pmesh));
+          halfedge_descriptor he = from_face
+            ? h
+            : opposite(h, pmesh);
+          if (border.find(he) != border.end())
+            border.erase(he); //even number of appearances
+          else
+            border.insert(std::make_pair(he, from_face));//odd number of appearances
+        }
+      }
+      //copy them in out
+      typedef typename std::map<halfedge_descriptor, bool>::value_type HD_bool;
+      BOOST_FOREACH(const HD_bool& hd, border)
+      {
+        if (hd.second)
+          *out++ = hd.first;
+        else
+          *out++ = opposite(hd.first, pmesh);
+      }
+      return out;
+    }
+
+    template<typename PM
+           , typename FaceRange
+           , typename FaceIndexMap
+           , typename HalfedgeOutputIterator>
+    HalfedgeOutputIterator border_halfedges_impl(const FaceRange& faces
+                                               , const FaceIndexMap& fmap
+                                               , HalfedgeOutputIterator out
+                                               , const PM& pmesh)
+    {
+      typedef typename boost::graph_traits<PM>::halfedge_descriptor halfedge_descriptor;
+      typedef typename boost::graph_traits<PM>::face_descriptor     face_descriptor;
+
+      std::vector<bool> present(num_faces(pmesh), false);
+      BOOST_FOREACH(face_descriptor fd, faces)
+        present[get(fmap, fd)] = true;
+
+      BOOST_FOREACH(face_descriptor fd, faces)
+        BOOST_FOREACH(halfedge_descriptor hd,
+                      halfedges_around_face(halfedge(fd, pmesh), pmesh))
+       {
+         halfedge_descriptor opp=opposite(hd, pmesh);
+         if (is_border(opp, pmesh) || !present[get(fmap,face(opp,pmesh))])
+           *out++ = opp;
+       }
+
+      return out;
+    }
+
+    struct Dummy_PM
+    {
+    public:
+      typedef bool vertex_property_type;
+    };
+
+  }//end namespace internal
+
+  /*!
+  \ingroup PkgPolygonMeshProcessing
+  * collects the border of a surface patch
+  * defined as a face range. The border is "seen from inside" the patch,
+  * i.e. the collected halfedges are
+  * the ones that belong to the input faces.
+  *
+  * @tparam PolygonMesh model of `HalfedgeGraph`. If `PolygonMesh
+  *  `has an internal property map
+  *  for `CGAL::face_index_t`, then it should be initialized
+  * @tparam FaceRange range of
+       `boost::graph_traits<PolygonMesh>::%face_descriptor`, model of `Range`.
+        Its iterator type is `InputIterator`.
+  * @tparam HalfedgeOutputIterator model of `OutputIterator`
+     holding `boost::graph_traits<PolygonMesh>::%halfedge_descriptor`
+     for patch border
+  * @tparam NamedParameters a sequence of \ref namedparameters
+  *
+  * @param pmesh the polygon mesh to which `faces` belong
+  * @param faces the range of faces defining the patch
+  *              around which the border is collected
+  * @param out the output iterator that collects halfedges that form the border
+  *            of `faces`, seen from inside the surface patch
+  * @param np optional sequence of \ref namedparameters among
+     the ones listed below
+
+  * \cgalNamedParamsBegin
+      \cgalParamBegin{face_index_map} a property map containing the index of each face of `pmesh` \cgalParamEnd
+    \cgalNamedParamsEnd
+  *
+  * @returns `out`
+  */
+  template<typename PolygonMesh
+         , typename FaceRange
+         , typename HalfedgeOutputIterator
+         , typename NamedParameters>
+  HalfedgeOutputIterator border_halfedges(const FaceRange& faces
+                                  , const PolygonMesh& pmesh
+                                  , HalfedgeOutputIterator out
+                                  , const NamedParameters& np)
+  {
+    typedef PolygonMesh PM;
+    typedef typename GetFaceIndexMap<PM, NamedParameters>::type           FIMap;
+    typedef typename boost::property_map<typename internal::Dummy_PM,
+                                              CGAL::face_index_t>::type   Unset_FIMap;
+
+    if (boost::is_same<FIMap, Unset_FIMap>::value || faces.size() == 1)
+    {
+      //face index map is not given in named parameters, nor as an internal property map
+      return internal::border_halfedges_impl(faces, out, pmesh);
+    }
+
+    //face index map given as a named parameter, or as an internal property map
+    FIMap fim = choose_param(get_param(np, face_index),
+                             get(CGAL::face_index, pmesh));
+
+    //make a minimal check that it's properly initialized :
+    //if the 2 first faces have the same id, we know the property map is not initialized
+    if (boost::is_same<typename GetFaceIndexMap<PM, NamedParameters>::Is_internal_map,
+                       boost::true_type>::value)
+    {
+      typename boost::range_iterator<const FaceRange>::type it = boost::const_begin(faces);
+      if (get(fim, *it++) == get(fim, *it))
+      {
+        std::cerr << "WARNING : the internal property map for CGAL::face_index_t" << std::endl
+                  << "          is not properly initialized." << std::endl
+                  << "          Initialize it before calling border_halfedges()" << std::endl;
+      }
+    }
+
+    return internal::border_halfedges_impl(faces, fim, out, pmesh);
+  }
+
+  template<typename PolygonMesh
+         , typename HalfedgeOutputIterator>
+  HalfedgeOutputIterator border_halfedges(const PolygonMesh& pmesh
+                                        , HalfedgeOutputIterator out)
+  {
+    typedef PolygonMesh PM;
+    typedef typename boost::graph_traits<PM>::halfedge_descriptor halfedge_descriptor;
+    BOOST_FOREACH(halfedge_descriptor hd, halfedges(pmesh))
+      if (is_border(hd, pmesh))
+        *out++ = hd;
+    return out;
+  }
+
+  template<typename PolygonMesh
+         , typename FaceRange
+         , typename HalfedgeOutputIterator>
+  HalfedgeOutputIterator border_halfedges(const FaceRange& faces
+                                        , const PolygonMesh& pmesh
+                                        , HalfedgeOutputIterator out)
+  {
+    return border_halfedges(faces, pmesh, out,
+      CGAL::Polygon_mesh_processing::parameters::all_default());
+  }
+
+}
+} // end of namespace CGAL::Polygon_mesh_processing
+
+
+#endif //CGAL_POLYGON_MESH_PROCESSING_GET_BORDER_H
diff --git a/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/compute_normal.h b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/compute_normal.h
new file mode 100644
index 0000000..f4ef8cc
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/compute_normal.h
@@ -0,0 +1,409 @@
+// Copyright (c) 2015 GeometryFactory (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Jane Tournois
+
+
+#ifndef CGAL_POLYGON_MESH_PROCESSING_COMPUTE_NORMAL_H
+#define CGAL_POLYGON_MESH_PROCESSING_COMPUTE_NORMAL_H
+
+#include <CGAL/boost/graph/helpers.h>
+#include <CGAL/boost/graph/properties.h>
+#include <boost/graph/graph_traits.hpp>
+#include <CGAL/Origin.h>
+#include <CGAL/Kernel/global_functions_3.h>
+#include <CGAL/Kernel_traits.h>
+
+#include <CGAL/Polygon_mesh_processing/internal/named_function_params.h>
+#include <CGAL/Polygon_mesh_processing/internal/named_params_helper.h>
+
+#include <boost/type_traits.hpp>
+
+namespace CGAL{
+
+namespace Polygon_mesh_processing{
+
+namespace internal {
+
+  template <class GT>
+  void normalize(typename GT::Vector_3& v, const GT& traits)
+  {
+    typename GT::FT norm = CGAL::approximate_sqrt(
+        traits.compute_squared_length_3_object()(v));
+    v = traits.construct_divided_vector_3_object()(v, norm);
+  }
+
+  template<typename Point
+         , typename GT>
+  typename GT::Vector_3
+  triangle_normal(const Point& p0, const Point& p1, const Point& p2
+                , const GT& traits)
+  {
+    typename GT::Vector_3 n = traits.construct_cross_product_vector_3_object()(
+      traits.construct_vector_3_object()(p1, p2),
+      traits.construct_vector_3_object()(p1, p0));
+
+    //cross-product(AB, AC)'s norm is the area of the parallelogram 
+    //formed by these 2 vectors.
+    //the triangle's area is half of it
+    return traits.construct_scaled_vector_3_object()(n, 0.5);
+  }
+}
+
+template<typename Point, typename PM, typename VertexPointMap, typename Vector
+       , typename GT>
+void sum_normals(const PM& pmesh,
+                 typename boost::graph_traits<PM>::face_descriptor f,
+                 VertexPointMap vpmap,
+                 Vector& sum,
+                 const GT& traits)
+{
+  typedef typename boost::graph_traits<PM>::vertex_descriptor   vertex_descriptor;
+  typedef typename boost::graph_traits<PM>::halfedge_descriptor halfedge_descriptor;
+
+  halfedge_descriptor he = halfedge(f, pmesh);
+  vertex_descriptor v = source(he, pmesh);
+  const Point& pv = get(vpmap, v);
+  while (v != target(next(he, pmesh), pmesh))
+  {
+    const Point& pvn  = get(vpmap, target(he, pmesh));
+    const Point& pvnn = get(vpmap, target(next(he, pmesh), pmesh));
+
+    Vector n = internal::triangle_normal(pv, pvn, pvnn, traits);
+    sum = traits.construct_sum_of_vectors_3_object()(sum, n);
+
+    he = next(he, pmesh);
+  }
+}
+
+
+/**
+* \ingroup PMP_normal_grp
+* computes the outward unit vector normal to face `f`.
+* @tparam PolygonMesh a model of `FaceGraph` that has an internal property map
+*         for `CGAL::vertex_point_t`
+* @tparam NamedParameters a sequence of \ref namedparameters
+*
+* @param f the face on which the normal is computed
+* @param pmesh the polygon mesh containing `f`
+* @param np optional sequence of \ref namedparameters among the ones listed below
+*
+* \cgalNamedParamsBegin
+*    \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh` \cgalParamEnd
+*    \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `Kernel`\cgalParamEnd
+* \cgalNamedParamsEnd
+*
+* @return the computed normal. The return type is a 3D vector type. It is
+* either deduced from the `geom_traits` \ref namedparameters if provided,
+* or from the geometric traits class deduced from the point property map
+* of `pmesh`.
+*
+* \warning This function involves a square root computation.
+* If `Kernel::FT` does not have a `sqrt()` operation, the square root computation
+* will be done approximately.
+*/
+template <typename PolygonMesh, typename NamedParameters>
+#ifdef DOXYGEN_RUNNING
+Vector_3
+#else
+typename GetGeomTraits<PolygonMesh, NamedParameters>::type::Vector_3
+#endif
+compute_face_normal(typename boost::graph_traits<PolygonMesh>::face_descriptor f
+                    , const PolygonMesh& pmesh
+                    , const NamedParameters& np)
+{
+  typedef typename GetGeomTraits<PolygonMesh, NamedParameters>::type GT;
+  typedef typename GT::Point_3 Point;
+  typedef typename GT::Vector_3 Vector;
+
+  using boost::choose_param;
+  using boost::get_param;
+  using boost::choose_const_pmap;
+
+  GT traits = choose_param(get_param(np, CGAL::geom_traits), GT());
+
+  Vector normal = traits.construct_vector_3_object()(CGAL::NULL_VECTOR);
+  sum_normals<Point>(pmesh, f
+    , choose_const_pmap(get_param(np, CGAL::vertex_point), pmesh, CGAL::vertex_point)
+    , normal
+    , traits);
+
+  if (!typename GT::Equal_3()(normal, CGAL::NULL_VECTOR))
+    internal::normalize(normal, traits);
+
+  return normal;
+}
+
+/**
+* \ingroup PMP_normal_grp
+* computes the outward unit vector normal for all faces of the polygon mesh.
+* @tparam PolygonMesh a model of `FaceGraph` that has an internal property map
+*         for `CGAL::vertex_point_t`
+* @tparam FaceNormalMap a model of `WritablePropertyMap` with
+    `boost::graph_traits<PolygonMesh>::%face_descriptor` as key type and
+    `Kernel::Vector_3` as value type.
+*
+* @param pmesh the polygon mesh
+* @param fnm the property map in which the normals are written
+* @param np optional sequence of \ref namedparameters among the ones listed below
+*
+* \cgalNamedParamsBegin
+*    \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh` \cgalParamEnd
+*    \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `Kernel`\cgalParamEnd
+* \cgalNamedParamsEnd
+*
+* \warning This function involves a square root computation.
+* If `Kernel::FT` does not have a `sqrt()` operation, the square root computation
+* will be done approximately.
+*/
+template <typename PolygonMesh
+          , typename FaceNormalMap
+          , typename NamedParameters>
+void
+compute_face_normals(const PolygonMesh& pmesh
+                   , FaceNormalMap fnm
+                   , const NamedParameters& np)
+{
+  typedef typename GetGeomTraits<PolygonMesh,NamedParameters>::type Kernel;
+
+  typename boost::graph_traits<PolygonMesh>::face_descriptor f;
+  BOOST_FOREACH(f, faces(pmesh)){
+    typename Kernel::Vector_3 vec = compute_face_normal(f, pmesh, np);
+    put(fnm, f, vec);
+  }
+}
+
+/**
+* \ingroup PMP_normal_grp
+* computes the unit normal at vertex `v` as the average of the normals of incident faces.
+* @tparam PolygonMesh a model of `FaceGraph` that has an internal property map
+*         for `CGAL::vertex_point_t`
+*
+* @param v the vertex at which the normal is computed
+* @param pmesh the polygon mesh containing `v`
+* @param np optional sequence of \ref namedparameters among the ones listed below
+*
+* \cgalNamedParamsBegin
+*    \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh` \cgalParamEnd
+*    \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `Kernel`\cgalParamEnd
+* \cgalNamedParamsEnd
+*
+* @return the computed normal. The return type is a 3D vector type. It is
+* either deduced from the `geom_traits` \ref namedparameters if provided,
+* or the geometric traits class deduced from the point property map
+* of `pmesh`.
+*
+* \warning This function involves a square root computation.
+* If `Kernel::FT` does not have a `sqrt()` operation, the square root computation
+* will be done approximately.
+*/
+template<typename PolygonMesh, typename NamedParameters>
+#ifdef DOXYGEN_RUNNING
+Vector_3
+#else
+typename GetGeomTraits<PolygonMesh, NamedParameters>::type::Vector_3
+#endif
+compute_vertex_normal(typename boost::graph_traits<PolygonMesh>::vertex_descriptor v,
+                      const PolygonMesh& pmesh,
+                      const NamedParameters& np
+                      )
+{
+  using boost::choose_param;
+
+  typedef typename GetGeomTraits<PolygonMesh, NamedParameters>::type GT;
+  typedef typename GT::Vector_3 Vector;
+  GT traits = choose_param(get_param(np, CGAL::geom_traits), GT());
+
+  typedef typename GetFaceNormalMap<PolygonMesh, NamedParameters>::NoMap DefaultMap;
+  typedef typename boost::lookup_named_param_def <
+    CGAL::face_normal_t,
+    NamedParameters,
+    DefaultMap> ::type FaceNormalMap;
+  FaceNormalMap fnmap = choose_param(get_param(np, face_normal), DefaultMap());
+  bool fnmap_valid
+    = !boost::is_same<FaceNormalMap,
+                      DefaultMap
+                     >::value;
+
+  typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor halfedge_descriptor;
+
+  Vector normal = traits.construct_vector_3_object()(CGAL::NULL_VECTOR);
+
+  halfedge_descriptor he = halfedge(v, pmesh);
+  // handle isolated vertices
+  if (he==boost::graph_traits<PolygonMesh>::null_halfedge()) return normal;
+  halfedge_descriptor end = he;
+  do
+  {
+    if (!is_border(he, pmesh))
+    {
+      Vector n = fnmap_valid ? get(fnmap, face(he, pmesh))
+                             : compute_face_normal(face(he, pmesh), pmesh, np);
+      normal = traits.construct_sum_of_vectors_3_object()(normal, n);
+    }
+    he = opposite(next(he, pmesh), pmesh);
+  } while (he != end);
+
+  if ( ! typename GT::Equal_3()(normal, CGAL::NULL_VECTOR))
+    internal::normalize(normal, traits);
+  return normal;
+}
+
+/**
+* \ingroup PMP_normal_grp
+* computes the outward unit vector normal for all vertices of the polygon mesh.
+* @tparam PolygonMesh a model of `FaceListGraph` that has an internal property map
+*         for `CGAL::vertex_point_t`
+* @tparam VertexNormalMap a model of `WritablePropertyMap` with
+    `boost::graph_traits<PolygonMesh>::%vertex_descriptor` as key type and
+    the return type of `compute_vertex_normal()` as value type.
+*
+* @param pmesh the polygon mesh
+* @param vnm the property map in which the normals are written
+* @param np optional sequence of \ref namedparameters among the ones listed below
+*
+* \cgalNamedParamsBegin
+*    \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh` \cgalParamEnd
+*    \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `Kernel`\cgalParamEnd
+* \cgalNamedParamsEnd
+*
+* \warning This function involves a square root computation.
+* If `Kernel::FT` does not have a `sqrt()` operation, the square root computation
+* will be done approximately.
+*/
+template <typename PolygonMesh
+          , typename VertexNormalMap
+          , typename NamedParameters
+          >
+void
+compute_vertex_normals(const PolygonMesh& pmesh
+                      , VertexNormalMap vnm
+                      , const NamedParameters& np
+                      )
+{
+  typedef typename GetGeomTraits<PolygonMesh,NamedParameters>::type Kernel;
+
+  typename boost::graph_traits<PolygonMesh>::vertex_descriptor v;
+  BOOST_FOREACH(v, vertices(pmesh)){
+    typename Kernel::Vector_3 vec = compute_vertex_normal(v, pmesh, np);
+    put(vnm, v, vec);
+  }
+}
+
+/**
+* \ingroup PMP_normal_grp
+* computes the outward unit vector normal for all vertices and faces of the polygon mesh.
+* @tparam PolygonMesh a model of `FaceListGraph` that has an internal property map
+*         for `CGAL::vertex_point_t`
+* @tparam VertexNormalMap a model of `WritablePropertyMap` with
+    `boost::graph_traits<PolygonMesh>::%vertex_descriptor` as key type and
+    `Kernel::Vector_3` as value type.
+* @tparam FaceNormalMap a model of `ReadWritePropertyMap` with
+    `boost::graph_traits<PolygonMesh>::%face_descriptor` as key type and
+    `Kernel::Vector_3` as value type.
+*
+* @param pmesh the polygon mesh
+* @param vnm the property map in which the vertex normals are written
+* @param fnm the property map in which the face normals are written
+* @param np optional sequence of \ref namedparameters among the ones listed below
+*
+* \cgalNamedParamsBegin
+*    \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh` \cgalParamEnd
+*    \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `Kernel`\cgalParamEnd
+* \cgalNamedParamsEnd
+*
+* \warning This function involves a square root computation.
+* If `Kernel::FT` does not have a `sqrt()` operation, the square root computation
+* will be done approximately.
+*/
+template <typename PolygonMesh
+          , typename VertexNormalMap
+          , typename FaceNormalMap
+          , typename NamedParameters
+          >
+void
+compute_normals(const PolygonMesh& pmesh
+                , VertexNormalMap vnm
+                , FaceNormalMap fnm
+                , const NamedParameters& np
+                )
+{
+  compute_face_normals(pmesh, fnm, np);
+  compute_vertex_normals(pmesh, vnm, np.face_normal_map(fnm));
+}
+
+///\cond SKIP_IN_MANUAL
+// compute_vertex_normal overloads
+template <typename PolygonMesh>
+typename CGAL::Kernel_traits< typename property_map_value<PolygonMesh, CGAL::vertex_point_t>::type>::Kernel::Vector_3
+compute_vertex_normal(
+  typename boost::graph_traits<PolygonMesh>::vertex_descriptor v,
+  const PolygonMesh& pmesh)
+{
+  return compute_vertex_normal(v, pmesh,
+    CGAL::Polygon_mesh_processing::parameters::all_default());
+}
+
+// compute_vertex_normals overloads
+template <typename PolygonMesh, typename VertexNormalMap>
+void
+compute_vertex_normals(const PolygonMesh& pmesh,
+                      VertexNormalMap vnm)
+{
+  compute_vertex_normals(pmesh, vnm,
+    CGAL::Polygon_mesh_processing::parameters::all_default());
+}
+
+// compute_face_normal overload
+template <typename PolygonMesh>
+typename CGAL::Kernel_traits < typename property_map_value<PolygonMesh, CGAL::vertex_point_t>::type>::Kernel::Vector_3
+compute_face_normal(
+  typename boost::graph_traits<PolygonMesh>::face_descriptor f,
+  const PolygonMesh& pmesh)
+{
+  return compute_face_normal(f, pmesh,
+    CGAL::Polygon_mesh_processing::parameters::all_default());
+}
+
+// compute_face_normals overload
+template <typename PolygonMesh, typename FaceNormalMap>
+void
+compute_face_normals(const PolygonMesh& pmesh, FaceNormalMap fnm)
+{
+  compute_face_normals(pmesh, fnm,
+    CGAL::Polygon_mesh_processing::parameters::all_default());
+}
+
+// compute_normals overload
+template <typename PolygonMesh, typename VertexNormalMap, typename FaceNormalMap>
+void
+compute_normals(const PolygonMesh& pmesh,
+                VertexNormalMap vnm,
+                FaceNormalMap fnm)
+{
+  compute_normals(pmesh, vnm, fnm,
+    CGAL::Polygon_mesh_processing::parameters::all_default());
+}
+
+/// \endcond
+
+}
+
+} // end of namespace CGAL::Polygon_mesh_processing
+
+#endif // CGAL_POLYGON_MESH_PROCESSING_COMPUTE_NORMAL_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/connected_components.h b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/connected_components.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/connected_components.h
rename to 3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/connected_components.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/distance.h b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/distance.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/distance.h
rename to 3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/distance.h
diff --git a/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/fair.h b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/fair.h
new file mode 100644
index 0000000..4af36f9
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/fair.h
@@ -0,0 +1,167 @@
+// Copyright (c) 2015 GeometryFactory (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Ilker O. Yaz
+
+#ifndef CGAL_POLYGON_MESH_PROCESSING_FAIR_H
+#define CGAL_POLYGON_MESH_PROCESSING_FAIR_H
+
+#include <CGAL/Polygon_mesh_processing/internal/fair_impl.h>
+#include <CGAL/Polygon_mesh_processing/internal/named_function_params.h>
+#include <CGAL/Polygon_mesh_processing/internal/named_params_helper.h>
+
+#if defined(CGAL_EIGEN3_ENABLED)
+#include <CGAL/Eigen_solver_traits.h>  // for sparse linear system solver
+#endif
+
+#include <boost/type_traits/is_same.hpp>
+
+namespace CGAL {
+
+namespace Polygon_mesh_processing {
+
+namespace internal {
+  // use non-default weight calculator and non-default solver
+  // WeightCalculator a model of `FairWeightCalculator`, can be omitted to use default Cotangent weights
+  // weight_calculator a function object to calculate weights, defaults to Cotangent weights and can be omitted
+  template<typename SparseLinearSolver,
+           typename WeightCalculator,
+           typename TriangleMesh,
+           typename VertexRange,
+           typename VertexPointMap>
+  bool fair(TriangleMesh& tmesh,
+    const VertexRange& vertices,
+    SparseLinearSolver solver,
+    WeightCalculator weight_calculator,
+    unsigned int continuity,
+    VertexPointMap vpmap)
+  {
+    CGAL::Polygon_mesh_processing::internal::Fair_Polyhedron_3
+       <TriangleMesh, SparseLinearSolver, WeightCalculator, VertexPointMap>
+       fair_functor(tmesh, vpmap, weight_calculator);
+    return fair_functor.fair(vertices, solver, continuity);
+  }
+
+} //end namespace internal
+
+  /*!
+  \ingroup PMP_meshing_grp
+  @brief fairs a region on a triangle mesh.
+  The points of the selected vertices are
+  relocated to yield an as-smooth-as-possible surface patch,
+  based on solving a linear bi-Laplacian system with boundary constraints,
+  described in \cgalCite{Botsch2008OnLinearVariational}.
+  The optional parameter `fairing_continuity` gives the ability to control the tangential
+  continuity C<sup>\a n</sup> of the output mesh.
+
+  The region described by `vertices` might contain multiple disconnected components.
+  Note that the mesh connectivity is not altered in any way,
+  only vertex locations get updated.
+
+  Fairing might fail if fixed vertices, which are used as boundary conditions,
+  do not suffice to solve constructed linear system.
+
+  Note that if the vertex range to which fairing is applied contains all the vertices of the triangle mesh,
+  fairing does not fail, but the mesh gets shrinked to `CGAL::ORIGIN`.
+
+  @tparam TriangleMesh a model of `FaceGraph` and `MutableFaceGraph`
+          that has an internal property map for `CGAL::vertex_point_t`
+  @tparam VertexRange a range of vertex descriptors of `TriangleMesh`, model of `Range`.
+          Its iterator type is `InputIterator`.
+  @tparam NamedParameters a sequence of \ref namedparameters
+
+  @param tmesh the triangle mesh with patches to be faired
+  @param vertices the vertices of the patches to be faired (the positions of only those vertices will be changed)
+  @param np optional sequence of \ref namedparameters among the ones listed below
+
+  \cgalNamedParamsBegin
+    \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `tmesh` \cgalParamEnd
+    \cgalParamBegin{fairing_continuity} tangential continuity of the output surface patch. The larger `fairing_continuity` gets, the more fixed vertices are required \cgalParamEnd
+    \cgalParamBegin{sparse_linear_solver} an instance of the sparse linear solver used for fairing \cgalParamEnd
+  \cgalNamedParamsEnd
+  
+  @return `true` if fairing is successful, otherwise no vertices are relocated
+
+  @pre `is_triangle_mesh(tmesh)`
+
+  @warning This function involves linear algebra, that is computed using a non-exact floating-point arithmetic.
+
+  @todo accuracy of solvers are not good, for example when there is no boundary condition pre_factor should fail, but it does not.
+  */
+  template<typename TriangleMesh,
+           typename VertexRange,
+           typename NamedParameters>
+  bool fair(TriangleMesh& tmesh,
+            const VertexRange& vertices,
+            const NamedParameters& np)
+  {
+    using boost::get_param;
+    using boost::choose_param;
+
+    CGAL_precondition(is_triangle_mesh(tmesh));
+
+#if defined(CGAL_EIGEN3_ENABLED)
+  #if EIGEN_VERSION_AT_LEAST(3,2,0)
+    typedef CGAL::Eigen_solver_traits<Eigen::SparseLU<
+      CGAL::Eigen_sparse_matrix<double>::EigenType, Eigen::COLAMDOrdering<int> >  >
+      Default_solver;
+  #else
+    typedef bool Default_solver;//compilation should crash
+      //if no solver is provided and Eigen version < 3.2
+  #endif
+#else
+    typedef bool Default_solver;//compilation should crash
+      //if no solver is provided and Eigen version < 3.2
+#endif
+
+#if defined(CGAL_EIGEN3_ENABLED)
+    CGAL_static_assertion_msg(
+      (!boost::is_same<typename GetSolver<NamedParameters, Default_solver>::type, bool>::value) || EIGEN_VERSION_AT_LEAST(3, 2, 0),
+      "The function `fair` requires Eigen3 version 3.2 or later.");
+#else
+    CGAL_static_assertion_msg(
+      (!boost::is_same<typename GetSolver<NamedParameters, Default_solver>::type, bool>::value),
+      "The function `fair` requires Eigen3 version 3.2 or later.");
+#endif
+
+    typedef typename GetVertexPointMap < TriangleMesh, NamedParameters>::type VPMap;
+    typedef CGAL::internal::Cotangent_weight_with_voronoi_area_fairing<TriangleMesh, VPMap>
+      Default_Weight_calculator;
+
+    VPMap vpmap_ = choose_param(get_param(np, vertex_point), get(CGAL::vertex_point, tmesh));
+
+    return internal::fair(tmesh, vertices,
+      choose_param(get_param(np, sparse_linear_solver), Default_solver()),
+      choose_param(get_param(np, weight_calculator), Default_Weight_calculator(tmesh, vpmap_)),
+      choose_param(get_param(np, fairing_continuity), 1),
+      vpmap_
+      );
+  }
+
+  template<typename TriangleMesh, typename VertexRange>
+  bool fair(TriangleMesh& tmesh, const VertexRange& vertices)
+  {
+    return fair(tmesh, vertices,
+      CGAL::Polygon_mesh_processing::parameters::all_default());
+  }
+
+} //end namespace Polygon_mesh_processing
+
+} //end namespace CGAL
+
+#endif //CGAL_POLYGON_MESH_PROCESSING_FAIR_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polygon_mesh.h b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polygon_mesh.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polygon_mesh.h
rename to 3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polygon_mesh.h
diff --git a/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h
new file mode 100644
index 0000000..24ba820
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h
@@ -0,0 +1,1236 @@
+// Copyright (c) 2015 GeometryFactory (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Ilker O. Yaz
+
+#ifndef CGAL_HOLE_FILLING_TRIANGULATE_HOLE_POLYLINE_H
+#define CGAL_HOLE_FILLING_TRIANGULATE_HOLE_POLYLINE_H
+
+#include <CGAL/Mesh_3/dihedral_angle_3.h>
+#include <CGAL/value_type_traits.h>
+#include <CGAL/Delaunay_triangulation_3.h>
+#include <CGAL/Triangulation_vertex_base_with_info_3.h>
+#include <CGAL/iterator.h>
+#include <CGAL/trace.h>
+#include <CGAL/use.h>
+
+#include <vector>
+#include <stack>
+#include <map>
+
+#include <boost/iterator/transform_iterator.hpp>
+#include <boost/unordered_set.hpp>
+
+namespace CGAL {
+namespace internal {
+
+/************************************************************************
+ * Lookup tables
+ ************************************************************************/
+// Wrapper around vector
+template<class T>
+class Lookup_table {
+public:
+  Lookup_table(int n, const T& t) : n(n), table(n*n, t) { }
+  void put(int i, int j, const T& t) {
+    CGAL_assertion(bound_check(i,j));
+    table[i*n + j] = t;
+  }
+  const T& get(int i, int j) const {
+    CGAL_assertion(bound_check(i,j));
+    return table[i*n + j];
+  }
+
+  int n;
+private:
+  bool bound_check(int i, int j) const {
+    CGAL_assertion(i >= 0 && i < n);
+    CGAL_assertion(j >= 0 && j < n);
+    CGAL_assertion(i < j); 
+    CGAL_USE(i);
+    CGAL_USE(j);
+    // previous implementation was based on directly vector and i supposed to be always smaller than j.
+    // this check actually can be removed and i =min(i,j) j = max(i,j) can be used for reflexive access 
+    return true;
+  }
+  std::vector<T> table;
+};
+
+// Wrapper around map, where if i,j is not found a default value is returned,
+// and if default value inserted i,j erased.
+template<class T>
+class Lookup_table_map {
+public:
+  Lookup_table_map(int n, const T& default_) : n(n), default_(default_) { }
+
+  void put(int i, int j, const T& t) {
+    CGAL_assertion(bound_check(i,j));
+    
+    if(t == default_) {
+      table.erase(std::make_pair(i,j));
+      return;
+    }
+    
+    std::pair<typename Map::iterator, bool> inserted = table.insert(std::make_pair(std::make_pair(i,j), t));
+    if(!inserted.second) { inserted.first->second = t;}
+  }
+  const T& get(int i, int j) const {
+    CGAL_assertion(bound_check(i,j));
+    typename Map::const_iterator ij = table.find(std::make_pair(i,j));
+    if(ij != table.end()) {
+      return ij->second;
+    }
+    return default_;
+  }
+
+  void set_range_to_default(int b, int e/*inclusive*/) {
+    // given a range b-e erase each entity which falls into b-e
+    // example: given range 2-6, entries need to be deleted  2-3, 2-4, 2-5, 2-6
+    //                                                            3-4, 3-5, 3-6
+    //                                                                 4-5, 4-6
+    //                                                                      5-6
+    typename Map::iterator it;
+    if(b == 0) { it = table.begin(); }
+    else       { 
+      it = table.upper_bound(std::make_pair(b-1, n)); // to find first entry where entry.first == b
+    }
+
+    while(it != table.end() && it->first.first != e) {
+      if(it->first.second <= e) 
+      { table.erase(it++); }
+      else 
+      { ++it; }
+    }
+  }
+
+  int n;
+private:
+  typedef std::map<std::pair<int,int>, T> Map;
+  bool bound_check(int i, int j) const {
+    CGAL_assertion(i >= 0 && i < n);
+    CGAL_assertion(j >= 0 && j < n);
+    CGAL_assertion(i < j);
+    CGAL_USE(i);
+    CGAL_USE(j);
+    return true;
+  }
+  Map table;
+  T default_;
+};
+
+/************************************************************************
+ * Is_valid classes (to be used in Weight_calculator)
+ ************************************************************************/
+struct Is_valid_existing_edges
+{
+  typedef std::vector<std::pair<int, int> > Edge_container;
+  
+  Is_valid_existing_edges(Edge_container& existing_edges) 
+    : existing_edges(existing_edges)
+  {
+    std::sort(existing_edges.begin(), existing_edges.end());
+#ifndef CGAL_NDEBUG
+    // all pairs need to be satisfy pair.first < pair.second
+    for(Edge_container::iterator it = existing_edges.begin(); it != existing_edges.end(); ++it) {
+      CGAL_assertion(it->first < it->second);
+    }
+#endif
+  }
+
+  template<class Point_3>
+  bool operator()(const std::vector<Point_3>&,
+                  int v0, int v1, int v2) const 
+  {
+    CGAL_assertion(v0 < v1 && v1 < v2);
+
+    if(v0 + 1 != v1 && // border edges can not be inside existing_edges, so no need to check
+       std::binary_search(existing_edges.begin(), existing_edges.end(), std::make_pair(v0,v1)) )
+    { return false; }
+
+    if(v1 + 1 != v2 &&
+      std::binary_search(existing_edges.begin(), existing_edges.end(), std::make_pair(v1,v2)) )
+    { return false; }
+    
+    if(std::binary_search(existing_edges.begin(), existing_edges.end(), std::make_pair(v2,v0)) )
+    { return false; }
+
+    return true;
+  }
+
+  Edge_container& existing_edges;
+};
+
+struct Is_not_degenerate_triangle
+{
+  template<class Point_3>
+  bool operator()(const std::vector<Point_3>& P,
+                  int v0, int v1, int v2) const 
+  {
+    return !CGAL::collinear(P[v0], P[v1], P[v2]);
+  }
+};
+
+// Combine above two
+struct Is_valid_existing_edges_and_degenerate_triangle
+{
+  Is_valid_existing_edges_and_degenerate_triangle(Is_valid_existing_edges::Edge_container& edges)
+    : is_valid_edges(edges) { }
+
+  template<class Point_3>
+  bool operator()(const std::vector<Point_3>& P,
+                  int v0, int v1, int v2) const 
+  {
+    return Is_not_degenerate_triangle()(P,v0,v1,v2)
+                      && is_valid_edges(P,v0,v1,v2);
+  }
+
+  Is_valid_existing_edges is_valid_edges;
+};
+
+/************************************************************************
+ * Weights
+ ************************************************************************/
+
+// First minimizes the worst dihedral angle between patch triangles, then the total surface area as a tiebreaker.
+class Weight_min_max_dihedral_and_area 
+{
+  template<class Weight_, class IsValid>
+  friend struct Weight_calculator;
+
+  template<class Weight_>
+  friend class Weight_incomplete;
+
+public:
+  // these two should not be used (used in test code)
+  std::pair<double,double> w;
+  Weight_min_max_dihedral_and_area(double angle, double area) : w(angle, area) { }
+
+// below required by Weight concept
+private:
+  template<class Point_3, class LookupTable>
+  Weight_min_max_dihedral_and_area(const std::vector<Point_3>& P, 
+                                   const std::vector<Point_3>& Q, 
+                                   int i, int j, int k, 
+                                   const LookupTable& lambda)
+  {
+    CGAL_assertion(i < j);
+    CGAL_assertion(j < k);
+    int n = static_cast<int>(P.size()) -1; // because the first and last point are equal
+    
+    // The CGAL::dihedral angle is measured between the oriented triangles, that is it goes from [-pi, pi]
+    // What we need is the angle between the normals of the triangles between [0, pi]
+    double ang_max = 0;
+
+    // Test each edge
+    int vertices[] = {i, j, k};
+    for(int e = 0; e < 3; ++e) 
+    {
+      int v0      = vertices[e];
+      int v1      = vertices[(e+1)%3];
+      int v_other = vertices[(e+2)%3];
+      double angle = 0;
+      // check whether the edge is border
+      if( (v0 + 1 == v1 || (v0 == n-1 && v1 == 0) ) && !Q.empty() ) {
+        angle = 180 - CGAL::abs( 
+           to_double(CGAL::Mesh_3::dihedral_angle(P[v0],P[v1],P[v_other],Q[v0])) );
+      }
+      else {
+        if(e == 2) { continue; }
+        if(lambda.get(v0, v1) != -1){
+          const Point_3& p01 = P[lambda.get(v0, v1)];
+          angle = 180 - CGAL::abs( 
+            to_double(CGAL::Mesh_3::dihedral_angle(P[v0],P[v1],P[v_other],p01)) );
+        }
+      }
+      ang_max = (std::max)(ang_max, angle);
+    }
+   
+    w = std::make_pair(ang_max, to_double(CGAL::approximate_sqrt(CGAL::squared_area(P[i],P[j],P[k]))));
+  }
+
+public:
+  Weight_min_max_dihedral_and_area operator+(const Weight_min_max_dihedral_and_area& w2) const 
+  {
+    CGAL_assertion((*this) != NOT_VALID());
+    CGAL_assertion(w2 != NOT_VALID());
+
+    return Weight_min_max_dihedral_and_area((std::max)(w.first, w2.w.first), w.second + w2.w.second);
+  }
+
+  bool operator<(const Weight_min_max_dihedral_and_area& w2) const
+  {
+    CGAL_assertion((*this) != NOT_VALID());
+    CGAL_assertion(w2 != NOT_VALID());
+
+    if(w.first == w2.w.first)
+    { return w.second < w2.w.second; }
+    return w.first < w2.w.first;
+  }
+
+  bool operator==(const Weight_min_max_dihedral_and_area& w2) const 
+  { return w.first == w2.w.first && w.second == w2.w.second; }
+
+  bool operator!=(const Weight_min_max_dihedral_and_area& w2) const 
+  { return !(*this == w2); }
+
+  static const Weight_min_max_dihedral_and_area DEFAULT() // rule: x + DEFAULT() == x
+  { return Weight_min_max_dihedral_and_area(0,0); }
+  static const Weight_min_max_dihedral_and_area NOT_VALID() 
+  { return Weight_min_max_dihedral_and_area(-1,-1); }
+
+  friend std::ostream& operator<<(std::ostream& out, const Weight_min_max_dihedral_and_area& w) {
+    out << "Max dihedral: " << w.w.first << ", Total area: " << w.w.second;
+    return out;
+  }
+};
+
+// For proof of concept. Tested weakly.
+class Weight_total_edge {
+  template<class Weight_, class IsValid>
+  friend struct Weight_calculator;
+
+private:
+  double total_length;
+
+  Weight_total_edge(double total_length = 0) : total_length(total_length) { }
+
+  template<class Point_3, class LookupTable>
+  Weight_total_edge(const std::vector<Point_3>& P, 
+                    const std::vector<Point_3>&, 
+                    int i, int j, int k, 
+                    const LookupTable&)
+    : total_length(0)
+  {
+    CGAL_assertion(i < j);
+    CGAL_assertion(j < k);
+    int n = P.size() -1; // because the first and last point are equal
+
+    // Test each edge
+    int vertices[] = {i, j, k};
+    for(int e = 0; e < 3; ++e) 
+    {
+      int v0      = vertices[e];
+      int v1      = vertices[(e+1)%3];
+        
+      // check whether the edge is border
+      bool border = (v0 + 1 == v1) || (v0 == n-1 && v1 == 0);
+      if(!border) {
+        total_length += CGAL::sqrt(CGAL::squared_distance(P[v0],P[v1]));
+      }
+    }
+  }
+
+public:
+  Weight_total_edge operator+(const Weight_total_edge& w2) const 
+  {
+    CGAL_assertion((*this) != NOT_VALID());
+    CGAL_assertion(w2 != NOT_VALID());
+    return Weight_total_edge(total_length + w2.total_length);
+  }
+
+  bool operator<(const Weight_total_edge& w2) const
+  { 
+    CGAL_assertion((*this) != NOT_VALID());
+    CGAL_assertion(w2 != NOT_VALID());
+    return total_length < w2.total_length; 
+  }
+
+  bool operator==(const Weight_total_edge& w2) const 
+  { return total_length == w2.total_length; }
+  bool operator!=(const Weight_total_edge& w2) const 
+  { return !(*this == w2); }
+
+  static const Weight_total_edge DEFAULT() { return Weight_total_edge(0); } // rule: x + DEFAULT() == x
+  static const Weight_total_edge NOT_VALID() { return Weight_total_edge(-1); }
+  friend std::ostream& operator<<(std::ostream& out, const Weight_total_edge& w) {
+    out << "Total edge length : " << w.total_length;
+    return out;
+  }
+};
+
+// Weights for incomplete patches. It maximize patch size, then ActualWeight as a tiebreaker.
+template<class ActualWeight>
+class Weight_incomplete
+{
+  template<class Weight_, class IsValid>
+  friend struct Weight_calculator;
+
+private:
+  template<class Point_3, class LookupTable>
+  Weight_incomplete(const std::vector<Point_3>& P, 
+    const std::vector<Point_3>& Q, 
+    int i, int j, int k, 
+    const LookupTable& lambda)
+    : weight(P,Q,i,j,k,lambda), patch_size(1)
+  { }
+
+  Weight_incomplete(const ActualWeight& weight, int patch_size) 
+    : weight(weight), patch_size(patch_size)
+  { }
+
+public:
+  Weight_incomplete operator+(const Weight_incomplete& w2) const 
+  {
+    CGAL_assertion((*this) != NOT_VALID());
+    CGAL_assertion(w2 != NOT_VALID());
+
+    return Weight_incomplete(weight + w2.weight, patch_size + w2.patch_size);
+  }
+
+  bool operator<(const Weight_incomplete& w2) const
+  {
+    CGAL_assertion((*this) != NOT_VALID());
+    CGAL_assertion(w2 != NOT_VALID());
+
+    if(patch_size == w2.patch_size) {
+      return weight < w2.weight;
+    }
+    return patch_size > w2.patch_size; // if patch size is larger, then the weight is smaller
+  }
+
+  bool operator==(const Weight_incomplete& w2) const 
+  { return weight == w2.weight && patch_size == w2.patch_size; }
+
+  bool operator!=(const Weight_incomplete& w2) const 
+  { return !(*this == w2); }
+
+  static const Weight_incomplete DEFAULT() // rule: x + DEFAULT() == x
+  { return Weight_incomplete(ActualWeight::DEFAULT(), 0); }
+  static const Weight_incomplete NOT_VALID()
+  { return Weight_incomplete(ActualWeight::NOT_VALID(), 0); }
+
+  friend std::ostream& operator<<(std::ostream& out, const Weight_incomplete& w) {
+    out << "Patch size: " << w.patch_size << ", Actual weight: " << w.weight;
+    return out;
+  }
+
+  ActualWeight weight;
+  int patch_size;
+};
+
+// Weight calculator class is both responsible from calculating weights, and checking validity of triangle
+template<class Weight_, class IsValid>
+struct Weight_calculator 
+{
+  typedef Weight_ Weight;
+  Weight_calculator(const IsValid& is_valid = IsValid()) : is_valid(is_valid) { }
+
+  template<class Point_3, class LookupTable>
+  Weight operator()(const std::vector<Point_3>& P, 
+    const std::vector<Point_3>& Q, 
+    int i, int j, int k, 
+    const LookupTable& lambda) const 
+  {
+    if( !is_valid(P,i,j,k) ) 
+    { return Weight::NOT_VALID(); }
+    return Weight(P, Q, i,j,k, lambda);
+  }
+
+  IsValid is_valid;
+};
+/************************************************************************
+ * Tracer
+ ************************************************************************/
+// It can produce a patch from both complete and incomplete lambda
+template<class OutputIteratorValueType, class OutputIteratorPatch, class OutputIteratorHole>
+struct Tracer_polyline_incomplete {
+  Tracer_polyline_incomplete(OutputIteratorPatch out, OutputIteratorHole out_hole) 
+    : out(out), out_hole(out_hole)
+  { }
+
+  template <class LookupTable>
+  void
+  operator()(const LookupTable& lambda, int v0, int v1)
+  {
+    CGAL_assertion_code( const int n = lambda.n; )
+    std::stack<std::pair<int, int> > ranges;
+    ranges.push(std::make_pair(v0, v1));
+
+    while(!ranges.empty()) {
+      std::pair<int, int> r = ranges.top(); 
+      ranges.pop();
+      CGAL_assertion(r.first >= 0 && r.first < n);
+      CGAL_assertion(r.second >= 0 && r.second < n);
+
+      if(r.first + 1 == r.second) { continue; }
+
+      int la = lambda.get(r.first, r.second);
+      if(la == -1) {
+        *out_hole++ = std::make_pair(r.first, r.second);
+        continue;
+      }
+
+      CGAL_assertion(la >= 0 && la < n);
+      CGAL_assertion(r.first < la && r.second > la);
+      *out++ = OutputIteratorValueType(r.first, la, r.second);
+
+      ranges.push(std::make_pair(r.first, la));
+      ranges.push(std::make_pair(la, r.second));
+    }
+  }
+
+  OutputIteratorPatch out;
+  OutputIteratorHole  out_hole;
+};
+
+/************************************************************************
+ * Triangulate hole with support of 3D Triangulation
+ ************************************************************************/
+
+// to support incident_facets(Edge e) function for both dimension 2 and 3
+template<unsigned int Dimension, class Triangulator>
+struct Incident_facet_circulator;
+
+template<class Triangulator>
+struct Incident_facet_circulator_base 
+{
+  typedef typename Triangulator::Facet         Facet;
+  typedef typename Triangulator::Edge          Edge;
+  typedef typename Triangulator::Cell_handle   Cell_handle;
+
+  struct Edge_wrapper {
+    Edge_wrapper(Edge e) : e(e) { }
+
+    int vertex_first()
+    { return (std::min)(e.first->vertex(e.second)->info(), e.first->vertex(e.third)->info()); }
+    int vertex_second()
+    { return (std::max)(e.first->vertex(e.second)->info(), e.first->vertex(e.third)->info()); }
+    
+    Edge e;
+  };
+
+  // Finds the other vertex than e.v0 and e.v1 in facet f
+  // Note that this may return infinite vertex
+  int get_third(Facet f, Edge e) {
+    int v0_info = e.first->vertex(e.second)->info();
+    int v1_info = e.first->vertex(e.third )->info();
+    // warning: it should be designed to handle dimension 2 (e.g. f.first->vertex(3)->info() will crash)
+    for(int i = 0; i < 4; ++i) {
+      if(i == f.second) { continue; } // skip the vertex which is not on `f`
+      int f3 = f.first->vertex(i)->info();
+      if(f3 != v0_info && f3 != v1_info) {
+        return f3; 
+      }
+    }
+    CGAL_assertion(false);
+    return -1;
+  }
+
+  Edge_wrapper edge_first(Facet f, Edge e) {
+    int v0_info = (std::min)(e.first->vertex(e.second)->info(),
+                             e.first->vertex(e.third)->info());
+    return Edge(f.first, 
+                get_vertex_index(f.first, v0_info) , 
+                get_vertex_index(f.first, get_third(f,e)));
+  }
+
+  Edge_wrapper edge_second(Facet f, Edge e) {
+    int v1_info = (std::max)(e.first->vertex(e.second)->info(),
+                             e.first->vertex(e.third)->info());
+    return Edge(f.first,
+                get_vertex_index(f.first, v1_info),
+                get_vertex_index(f.first, get_third(f,e)));
+  }
+
+  int get_vertex_index(Cell_handle ch, int info) {
+    // warning: it should be designed to handle dimension 2 (e.g. f.first->vertex(3)->info() will crash)
+    for(int i = 0; i < 4; ++i) {
+      int v = ch->vertex(i)->info();
+      if(v == info) { return i; }
+    }
+    CGAL_assertion(false);
+    return -1;
+  }
+};
+
+// Use the fact that an edge can be incident to 2 facets in dimension 2
+// and all valid facets (which contains finite + infinite vertices but not the NULL vertex) are
+// pointed by index 3 in cells
+template<class Triangulator>
+struct Incident_facet_circulator<2, Triangulator>
+  : Incident_facet_circulator_base<Triangulator>
+{
+  typedef typename Triangulator::Facet         Facet;
+  typedef typename Triangulator::Edge          Edge;
+  typedef typename Triangulator::Triangulation Triangulation;
+  typedef typename Incident_facet_circulator_base<Triangulator>::Edge_wrapper Edge_wrapper;
+
+  Incident_facet_circulator(Edge_wrapper ew, const Triangulation&)
+    : f1( Facet(ew.e.first, 3) ),
+      f2( Facet(ew.e.first->neighbor(3 - ew.e.second - ew.e.third), 3) ),
+      it(f1), e(ew.e)
+  {
+     CGAL_assertion(f1 != f2);
+     CGAL_assertion(e.second < 3 && e.third < 3);
+  }
+  Incident_facet_circulator& operator++() {
+    it = it == f1 ? f2 : f1;
+    return *this;
+  }
+  operator bool() const { return it != f1; }
+
+  int get_third()
+  { return Incident_facet_circulator_base<Triangulator>::get_third(it, e); }
+  Edge_wrapper edge_first() 
+  { return Incident_facet_circulator_base<Triangulator>::edge_first(it, e); }
+  Edge_wrapper edge_second() 
+  { return Incident_facet_circulator_base<Triangulator>::edge_second(it, e); }
+
+  Facet f1, f2, it;
+  Edge e;
+};
+
+// Just a wrapper around Facet_circulator
+template<class Triangulator>
+struct Incident_facet_circulator<3, Triangulator>
+  : Incident_facet_circulator_base<Triangulator>
+{
+  typedef typename Triangulator::Facet            Facet;
+  typedef typename Triangulator::Edge             Edge;
+  typedef typename Triangulator::Triangulation    Triangulation;
+  typedef typename Triangulator::Facet_circulator Facet_circulator;
+  typedef typename Incident_facet_circulator_base<Triangulator>::Edge_wrapper Edge_wrapper;
+
+  Incident_facet_circulator(Edge_wrapper ew, const Triangulation& tr)
+    : it(tr.incident_facets(ew.e)), end(it), e(ew.e)
+  { }
+  Incident_facet_circulator& operator++() {
+    ++it;
+    return *this;
+  }
+  operator bool() const { return it != end; }
+  
+  int get_third() 
+  { return Incident_facet_circulator_base<Triangulator>::get_third(*it, e); }
+  Edge_wrapper edge_first() 
+  { return Incident_facet_circulator_base<Triangulator>::edge_first(*it, e); }
+  Edge_wrapper edge_second() 
+  { return Incident_facet_circulator_base<Triangulator>::edge_second(*it, e); }
+
+  Facet_circulator it;
+  Facet_circulator end;
+  Edge e;
+};
+
+// Another DS for search space, which can be used in triangulate_DT
+// It is useful for extending the search space of 3D Triangulation by appending new triangles
+struct Edge_graph 
+{
+  struct Edge_comp {
+    bool operator()(std::pair<int, int> p0, std::pair<int, int> p1) const {
+      if(p0.first > p0.second) { std::swap(p0.first, p0.second); }
+      if(p1.first > p1.second) { std::swap(p1.first, p1.second); }
+      return p0 < p1;
+    }
+  };
+
+  typedef boost::unordered_set<int> Vertex_container;
+  // contains edges as key, and each edge contains set of third vertices which denote neighbor facets to that edge
+  typedef std::map<std::pair<int, int>, Vertex_container, Edge_comp> Graph;
+
+  struct Edge_wrapper {
+    Edge_wrapper(std::pair<int, int> e) : e(e) { }
+
+    int vertex_first()  const { return (std::min)(e.first, e.second); }
+    int vertex_second() const { return (std::max)(e.first, e.second); }
+    std::pair<int, int> e;
+  };
+
+  struct Incident_facet_circulator
+  {
+    Incident_facet_circulator(Edge_wrapper ew, const Edge_graph& tr)
+    {
+      Graph::const_iterator it_e = tr.graph.find(ew.e);
+      CGAL_assertion(it_e != tr.graph.end());
+      it = it_e->second.begin();
+      end = it_e->second.end();
+      e = ew.e;
+    }
+    Incident_facet_circulator& operator++() {
+      ++it;
+      return *this;
+    }
+    operator bool() const { return it != end; }
+
+    int get_third() const { return *it; }
+    Edge_wrapper edge_first()  const { return std::make_pair(Edge_wrapper(e).vertex_first(), *it); }
+    Edge_wrapper edge_second() const { return std::make_pair(Edge_wrapper(e).vertex_second(), *it); }
+
+    Vertex_container::const_iterator it;
+    Vertex_container::const_iterator end;
+    std::pair<int, int> e;
+  };
+
+  template<class IncidentFacetCirculator, class Triangulation>
+  void init(const Triangulation& tr, const std::vector<bool>& edge_exist)
+  {
+    typedef typename Triangulation::Finite_edges_iterator Finite_edges_iterator;
+
+    n = static_cast<int>(edge_exist.size());
+    for(Finite_edges_iterator eb = tr.finite_edges_begin(); eb != tr.finite_edges_end(); ++eb) 
+    {
+      int v0 = eb->first->vertex(eb->second)->info();
+      int v1 = eb->first->vertex(eb->third )->info();
+      Vertex_container& e_neighs = graph[std::make_pair(v0, v1)];
+
+      IncidentFacetCirculator fb(*eb, tr);
+      do {
+        int v2 = fb.get_third();
+        if(v2 == -1) { continue; }
+        e_neighs.insert(v2);
+      } while(++fb);
+    }
+
+    for(int i = 0; i < n; ++i) {
+      if(edge_exist[i]) { continue; }
+      int v0 = i == n-1 ? 0   : i;
+      int v1 = i == n-1 ? n-1 : i+1;
+      add_all_possible_to_edge(std::make_pair(v0, v1));
+    }
+  }
+
+  void add_all_possible_to_edge(std::pair<int, int> e) {
+    Vertex_container& e_neighs = graph[e];
+    for(int i = 0; i < n; ++i) {
+      if(i == e.first || i == e.second) { continue; }
+      e_neighs.insert(i);
+      graph[std::make_pair(i, e.first)].insert(e.second);
+      graph[std::make_pair(i, e.second)].insert(e.first);
+    }
+  }
+
+  Graph graph;
+  int n;
+};
+
+template<
+  class Kernel,
+  class Tracer,
+  class WeightCalculator,
+  template <class> class LookupTable = Lookup_table
+>
+class Triangulate_hole_polyline;
+
+// By default Lookup_table_map is used, since Lookup_table requires n*n mem.
+// Performance decrease is nearly 2x (for n = 10,000, for larger n Lookup_table just goes out of mem) 
+template<
+  class Kernel,
+  class Tracer,
+  class WeightCalculator,
+  template <class> class LookupTable = Lookup_table_map
+>
+class Triangulate_hole_polyline_DT 
+{
+  struct Auto_count {
+    typedef std::pair<typename Kernel::Point_3, int> result_type;
+
+    Auto_count(int count = 0) : count(count)  { }
+    result_type operator()(const typename Kernel::Point_3& p) const
+    { return std::make_pair(p, count++); }
+    mutable int count;
+  };
+
+public:
+  typedef typename WeightCalculator::Weight                   Weight;
+  typedef typename Kernel::Point_3                            Point_3;
+  typedef std::vector<Point_3>                                Polyline_3;
+
+  typedef Triangulation_vertex_base_with_info_3<int, Kernel>  VB_with_id;
+  typedef Triangulation_data_structure_3<VB_with_id>          TDS;
+  typedef Delaunay_triangulation_3<Kernel, TDS>               Triangulation;
+
+  typedef typename Triangulation::Finite_edges_iterator       Finite_edges_iterator;
+  typedef typename Triangulation::Facet_circulator            Facet_circulator;
+  typedef typename Triangulation::Cell_handle                 Cell_handle;
+  typedef typename Triangulation::Vertex_handle               Vertex_handle;
+  typedef typename Triangulation::Edge                        Edge;
+  typedef typename Triangulation::Facet                       Facet;
+
+  typedef Incident_facet_circulator<2, Triangulate_hole_polyline_DT> IFC_2;
+  typedef Incident_facet_circulator<3, Triangulate_hole_polyline_DT> IFC_3;
+
+  Weight operator()(const Polyline_3& P, 
+                    const Polyline_3& Q,
+                    Tracer& tracer,
+                    const WeightCalculator& WC) const
+  {
+    CGAL_assertion(P.front() == P.back());
+    CGAL_assertion(Q.empty() || (Q.front() == Q.back()));
+    CGAL_assertion(Q.empty() || (P.size() == Q.size()));
+
+    int n = static_cast<int>(P.size())-1; // because the first and last point are equal
+    Triangulation tr;
+    std::vector<bool> edge_exist;
+    std::pair<int, int> range(0, n-1);
+    boost::tuple<boost::optional<Edge>, bool, bool> res = construct_3D_triangulation(P, range, tr, edge_exist);
+    if(!res.template get<2>()) {
+      #ifndef CGAL_TEST_SUITE
+      CGAL_warning(!"Returning no output. Dimension of 3D Triangulation is below 2!");
+      #else
+      std::cerr << "W: Returning no output. Dimension of 3D Triangulation is below 2!\n";
+      #endif
+      return Weight::NOT_VALID();
+    }
+
+    // all border edges inside 3D Triangulation
+    if(boost::get<1>(res)) {
+      LookupTable<Weight> W(n, Weight::DEFAULT()); // do not forget that these default values are not changed for [i, i+1]
+      LookupTable<int>    lambda(n,-1);
+
+      typename Incident_facet_circulator_base<Triangulate_hole_polyline_DT>::Edge_wrapper
+        e_start(*boost::get<0>(res)); 
+      if(tr.dimension() == 3) {
+        triangulate_DT<IFC_3>(P, Q, W, lambda, e_start, tr, WC, false);
+      }
+      else {
+        CGAL_assertion(tr.dimension() == 2);
+        triangulate_DT<IFC_2>(P, Q, W, lambda, e_start, tr, WC, false);
+      }
+
+      if(W.get(0, n-1) == Weight::NOT_VALID()) {
+        #ifndef CGAL_TEST_SUITE
+        CGAL_warning(!"Returning no output. No possible triangulation is found!");
+        #else
+        std::cerr << "W: Returning no output. No possible triangulation is found!\n";
+        #endif
+        return Weight::NOT_VALID();
+      }
+
+      tracer(lambda, 0, n-1);
+      return W.get(0,n-1);
+    }
+    
+    // How to handle missing border edges
+    #if 1
+    return fill_by_extra_triangles(tr, edge_exist, P, Q, tracer, WC);
+    #else
+    // This approach produce better patches when used with Weight_incomplete 
+    // (which should be arranged in internal::triangulate_hole_Polyhedron, triangulate_polyline)
+    return fill_by_incomplete_patches(tr, res.get<0>(), edge_exist, P, Q, tracer, WC);
+    #endif
+  }
+
+private:
+
+  /************************************************************************
+  * Main algorithm which construct a minimum patch top-down searching through the space of tr
+  *
+  * + Edge_DT should have:
+  *   - vertex_first() vertex_second() functions where vertex_first() always returns vertex with smaller id
+  * + IncidentFacetCirculator should have:
+  *   - constructor with Edge_DT and Triangulation_DT
+  *   - pre-increment, conversion to bool
+  *   - get_third() returning the third vertex of facet pointed by circulator
+  *   - edge_first() and edge_second() neighbor edges to get_third() vertex
+  ************************************************************************/
+  template<class IncidentFacetCirculator, class Edge_DT, class Triangulation_DT>
+  void triangulate_DT(const Polyline_3& P, 
+                      const Polyline_3& Q, 
+                      LookupTable<Weight>& W, 
+                      LookupTable<int>& lambda, 
+                      Edge_DT e,
+                      const Triangulation_DT& tr,
+                      const WeightCalculator& WC,
+                      const bool produce_incomplete) const
+  {
+    /**********************************************************************
+     *  + Default W value is Weight::DEFAULT(), default lambda value is -1.
+     *  + DEFAULT() is used to check whether the region (v0-v1) is processed.
+     *  + If a range v0-v1 does not contains any possible triangulation, then W[v0,v1] = NOT_VALID() and lambda[v0,v1] = -1
+     *  + Note that w + DEFAULT() == w must hold
+     */
+    int v0 = e.vertex_first();
+    int v1 = e.vertex_second();
+    CGAL_assertion(v0 < v1);  // vertex_first() should always return vertex with smaller index
+    CGAL_assertion(v0 != -1); // edge can not be incident to infinite vertex
+
+    if( v0 + 1 == v1 || // border edge - should not check v0 = 0, v1 = n-1, because it is the initial edge where the algorithm starts
+        W.get(v0, v1) != Weight::DEFAULT() ) // the range is previously processed
+    { return; }
+
+    int m_min = -1;
+    Weight w_min = Weight::NOT_VALID();
+
+    IncidentFacetCirculator fb(e, tr);
+    do {
+      int v2 = fb.get_third();
+      if(v2 < v0 || v2 > v1) { continue; } // this will also skip infinite vertex
+
+      if(WC(P,Q, v0,v2,v1, lambda) == Weight::NOT_VALID())
+      { continue; } // computed weight in here is not correct weight
+                    // since max dih angle requires neighbor ranges to be already computed. It is just for checking validity.
+      
+      Weight w = Weight::DEFAULT();
+
+      Edge_DT e0 = fb.edge_first(); // edge v0-v2
+      CGAL_assertion(e0.vertex_first() == v0 && e0.vertex_second() == v2);
+      triangulate_DT<IncidentFacetCirculator>(P, Q, W, lambda, e0, tr, WC, produce_incomplete); // region v0-v2
+      const Weight& we0 = W.get(v0, v2);
+
+      if(!produce_incomplete && we0 == Weight::NOT_VALID()) 
+      { continue; } // not producing incomplete patches and failed to fill sub-range v0-v2, so no reason to proceed
+      if(we0 != Weight::NOT_VALID()) // to not consider we0 if it is NOT_VALID (it is valid when produce_incomplete = true)
+      { w = w + we0; }
+
+      Edge_DT e1 = fb.edge_second(); // edge v2-v1
+      CGAL_assertion(e1.vertex_first() == v2 && e1.vertex_second() == v1);
+      triangulate_DT<IncidentFacetCirculator>(P, Q, W, lambda, e1, tr, WC, produce_incomplete); // region v2-v1
+      const Weight& we1 = W.get(v2, v1);
+
+      if(!produce_incomplete && we1 == Weight::NOT_VALID()) 
+      { continue; }
+      if(we1 != Weight::NOT_VALID()) // to not consider we1 if it is NOT_VALID (it is valid when produce_incomplete = true)
+      { w = w + we1; }
+
+      w = w + WC(P,Q, v0,v2,v1, lambda);
+      if(m_min == -1 || w < w_min){
+        w_min = w;
+        m_min = v2;
+      }
+    } while(++fb);
+
+    // can be m_min = -1 and w_min = NOT_VALID which means no possible triangulation between v0-v1
+    W.put(v0,v1, w_min);
+    lambda.put(v0,v1, m_min);
+  }
+
+  // returns [h.first-h.second edge, true if all edges inside 3D triangulation, true if tr.dimension() >= 2]
+  boost::tuple<boost::optional<Edge>, bool, bool>
+  construct_3D_triangulation(const Polyline_3& P,
+                             std::pair<int,int> h,
+                             Triangulation& tr,
+                             std::vector<bool>& edge_exist) const 
+  {
+    // construct 3D tr with P[h.first], P[h.second] also assign ids from h.first to h.second
+    boost::optional<Edge> e;
+    int n_border = h.second - h.first + 1;
+    tr.insert(boost::make_transform_iterator(boost::next(P.begin(), h.first), Auto_count(h.first)),
+              boost::make_transform_iterator(boost::next(P.begin(), h.second +1), Auto_count(h.first)));
+    tr.infinite_vertex()->info() = -1;
+
+    if(tr.dimension() < 2) { return boost::make_tuple(e, false, false); }
+
+    // check whether all edges are included in DT, and get v0-vn-1 edge
+    edge_exist.assign(n_border, false);
+    int nb_exists = 0;
+    Finite_edges_iterator v_first_v_second_edge; // range.first - range.second edge
+    for(Finite_edges_iterator eb = tr.finite_edges_begin();
+        eb != tr.finite_edges_end();
+        ++eb) 
+    {
+      int v0_id = eb->first->vertex(eb->second)->info();
+      int v1_id = eb->first->vertex(eb->third )->info();
+      if(v0_id > v1_id) { std::swap(v0_id, v1_id); }
+
+      // to start from v0 vn-1 edge
+      if(v0_id == h.first && v1_id == h.second) { v_first_v_second_edge = eb; }
+
+      // check whether the edge is border edge
+      int border_id = -1;
+      if(v0_id + 1 == v1_id)                         { border_id = v0_id; }
+      else if(v0_id == h.first && v1_id == h.second) { border_id = v1_id; }
+
+      if(border_id != -1 && !edge_exist[border_id - h.first]) {
+        ++nb_exists;
+        edge_exist[border_id - h.first] = true;
+      }
+    }
+    CGAL_assertion(n_border >= nb_exists);
+
+    bool is_3D_T_complete = (nb_exists == n_border);
+    if(edge_exist[n_border-1]) { e = *v_first_v_second_edge; }
+    return boost::make_tuple(e, is_3D_T_complete, true);
+  }
+
+  /************************************************************************
+  * Try to construct hole part by part.
+  *
+  * What need to be improved:
+  *  + if 3D triangulation does not contain the start-edge (edge between v0 vn-1) we directly switch to all space. 
+  *  + when switched to all-space, we use map based lookup tables.
+  ************************************************************************/
+  Weight fill_by_incomplete_patches(Triangulation& tr,
+                                    boost::optional<Edge> start_edge,
+                                    std::vector<bool>& edge_exist,
+                                    const Polyline_3& P, 
+                                    const Polyline_3& Q,
+                                    Tracer& tracer,
+                                    const WeightCalculator& WC) const
+  {
+    typedef std::pair<int, int> Range;
+    typedef std::back_insert_iterator<std::vector<Range> > Output_hole_iterator;
+    typedef Tracer_polyline_incomplete<boost::tuple<int, int, int>, Emptyset_iterator, Output_hole_iterator> Remaining_holes_tracer;
+    
+    std::vector<Range> remaining_holes;
+    
+    int n_all = P.size()-1;// because the first point and last point are equal
+    remaining_holes.push_back(Range(0, n_all-1)); // corresponds to start_edge 
+
+    LookupTable<Weight> W(n_all, Weight::DEFAULT()); // do not forget that these default values are not changed for [i, i+1]
+    LookupTable<int>    lambda(n_all,-1);
+
+    while(true) {
+      Range h = remaining_holes.back();
+      remaining_holes.pop_back();
+     
+      if(start_edge) {
+        typename IFC_3::Edge_wrapper e(*start_edge);
+        CGAL_assertion(h.first == e.vertex_first() && 
+                       h.second == e.vertex_second()); 
+      }
+
+      if(!start_edge) {
+        // switch to brute force 
+        Triangulate_hole_polyline<Kernel, Tracer, WeightCalculator, LookupTable> all_space;
+        all_space.triangulate_all(P, Q, WC, std::make_pair(h.first, h.second), W, lambda);
+        if(W.get(h.first, h.second) == Weight::NOT_VALID()) {
+          CGAL_warning(!"Returning no output. Filling hole with incomplete patches is not successful!");
+          return Weight::NOT_VALID();
+        }
+      }
+      else {
+        // run the algorithm
+        typename IFC_3::Edge_wrapper e(*start_edge);
+        if(tr.dimension() == 3) 
+        {
+          triangulate_DT<IFC_3>(P, Q, W, lambda, e, tr, WC, true);
+        }
+        else {
+          CGAL_assertion(tr.dimension() == 2);
+          triangulate_DT<IFC_2>(P, Q, W, lambda, e, tr, WC, true);
+        }
+        // check whether there is any improvement (at least we should construct one triangle)
+        if(W.get(h.first, h.second) == Weight::NOT_VALID()) {
+          // switch to brute force 
+          Triangulate_hole_polyline<Kernel, Tracer, WeightCalculator, LookupTable> all_space;
+          all_space.triangulate_all(P, Q, WC, std::make_pair(h.first, h.second), W, lambda);
+          if(W.get(h.first, h.second) == Weight::NOT_VALID()) {
+            CGAL_warning(!"Returning no output. Filling hole with incomplete patches is not successful!");
+            return Weight::NOT_VALID();
+          }
+        }
+        // gather remaining holes
+        Remaining_holes_tracer hole_tracer((Emptyset_iterator()), (Output_hole_iterator(remaining_holes)));
+        hole_tracer(lambda, e.vertex_first(), e.vertex_second());
+      }
+
+      if(remaining_holes.empty()) { break; }
+      // construct tr for next coming hole
+      h = remaining_holes.back();
+      tr.clear();
+      boost::tuple<boost::optional<Edge>, bool, bool> res = construct_3D_triangulation(P, h, tr, edge_exist);
+      if(!boost::get<0>(res)) {
+        CGAL_warning(!"Returning no output. Filling hole with incomplete patches is not successful!");
+        return Weight::NOT_VALID();
+      }
+      start_edge = *boost::get<0>(res);
+      // clear related regions in W, lambda for next coming hole
+      W.set_range_to_default(h.first, h.second);
+      lambda.set_range_to_default(h.first, h.second);
+    }
+    tracer(lambda, 0, n_all-1);
+
+    // W.get(0, n_all -1) is not correct weight (since we do not update weights while we are filling remaining holes), 
+    // we need to recalculate it
+    std::stack<std::pair<int, int> > ranges;
+    ranges.push(std::make_pair(0, n_all-1));
+    Weight total_weight = Weight::DEFAULT();
+    while(!ranges.empty()) {
+      std::pair<int, int> r = ranges.top(); 
+      ranges.pop();
+      if(r.first + 1 == r.second) { continue; }
+      int la = lambda.get(r.first, r.second);
+      total_weight = total_weight + WC(P,Q, r.first,la,r.second, lambda);
+      ranges.push(std::make_pair(r.first, la));
+      ranges.push(std::make_pair(la, r.second));
+    }
+    return total_weight;
+  }
+  
+  /************************************************************************
+   * This approach extends the search space by adding extra triangles.
+   *
+   * + Initial search space is 3D Triangulation.
+   * + For each border edge which is not inside 3DT, we add all possible triangles containing that edge to the search space.
+   *   Example: say border edge [4-5] is not found in 3DT, then triangles = { [0,4,5] [1,4,5] [2,4,5] ... [ n-1,4,5] } 
+   *   are added to the search space.
+   *
+   * I guess this approach does not make the search space complete, since there are some cases that it still returns no patch.
+   ************************************************************************/
+  Weight fill_by_extra_triangles(const Triangulation& tr, 
+                                 const std::vector<bool>& edge_exist,
+                                 const Polyline_3& P, 
+                                 const Polyline_3& Q,
+                                 Tracer& tracer,
+                                 const WeightCalculator& WC) const
+  {
+    int n = static_cast<int>(edge_exist.size());
+    LookupTable<Weight> W(n, Weight::DEFAULT()); // do not forget that these default values are not changed for [i, i+1]
+    LookupTable<int>    lambda(n,-1);
+
+    Edge_graph edge_graph;
+
+    if(tr.dimension() == 3) 
+    { edge_graph.init<IFC_3>(tr, edge_exist); }
+    else 
+    { edge_graph.init<IFC_2>(tr, edge_exist); }
+
+    Edge_graph::Edge_wrapper e_start(std::make_pair(0, n-1));
+    triangulate_DT<Edge_graph::Incident_facet_circulator>
+      (P, Q, W, lambda, e_start, edge_graph, WC, false);
+    
+    if(W.get(0, n-1) == Weight::NOT_VALID()) {
+      #ifndef CGAL_TEST_SUITE
+      CGAL_warning(!"Returning no output. Filling hole with extra triangles is not successful!");
+      #else
+      std::cerr << "W: Returning no output. Filling hole with extra triangles is not successful!\n";
+      #endif
+      return Weight::NOT_VALID();
+    }
+
+    tracer(lambda, 0, n-1);
+    return W.get(0, n-1);
+  }
+}; // End of Triangulate_hole_polyline_DT
+
+/************************************************************************
+ * Triangulate hole by using all search space
+ ************************************************************************/
+template<
+  class Kernel,
+  class Tracer,
+  class WeightCalculator,
+  template <class> class LookupTable
+>
+class Triangulate_hole_polyline {
+public:
+  typedef typename WeightCalculator::Weight  Weight;
+  typedef typename Kernel::Point_3           Point_3;
+  typedef std::vector<Point_3>               Polyline_3;
+
+  Weight operator()(const Polyline_3& P,
+                    const Polyline_3& Q,
+                    Tracer& tracer,
+                    const WeightCalculator& WC) const
+  {
+    CGAL_assertion(P.front() == P.back());
+    CGAL_assertion(Q.empty() || (Q.front() == Q.back()));
+    CGAL_assertion(Q.empty() || (P.size() == Q.size()));
+    
+    int n = static_cast<int>(P.size()) - 1;                       // because the first and last point are equal
+    LookupTable<Weight> W(n,Weight::DEFAULT()); // do not forget that these default values are not changed for [i, i+1]
+    LookupTable<int>    lambda(n,-1);
+    
+    triangulate_all(P, Q, WC, std::make_pair(0,n-1), W, lambda);
+
+    if(W.get(0,n-1) == Weight::NOT_VALID()) {
+      #ifndef CGAL_TEST_SUITE
+      CGAL_warning(!"Returning no output. No possible triangulation is found!");
+      #else
+      std::cerr << "W: Returning no output. No possible triangulation is found!\n";
+      #endif
+      return Weight::NOT_VALID();
+    }
+
+    tracer(lambda, 0, n-1);
+    return W.get(0,n-1);
+  }
+
+  void triangulate_all(const Polyline_3& P,
+                       const Polyline_3& Q,
+                       const WeightCalculator& WC,
+                       std::pair<int, int> range,
+                       LookupTable<Weight>& W, 
+                       LookupTable<int>& lambda) const
+  {
+    for(int j = 2; j<= range.second; ++j) {              // determines range (2 - 3 - 4 )
+      for(int i=range.first; i<= range.second-j; ++i) {  // iterates over ranges and find min triangulation in those ranges 
+        int k = i+j;                                     // like [0-2, 1-3, 2-4, ...], [0-3, 1-4, 2-5, ...]
+
+        int m_min = -1;
+        Weight w_min = Weight::NOT_VALID();
+        // i is the range start (e.g. 1) k is the range end (e.g. 5) -> [1-5]. Now subdivide the region [1-5] with m -> 2,3,4
+        for(int m = i+1; m<k; ++m) { 
+          // now the regions i-m and m-k might be valid(constructed) patches,
+          if( W.get(i,m) == Weight::NOT_VALID() || W.get(m,k) == Weight::NOT_VALID() ) 
+          { continue; }
+
+          const Weight& w_imk = WC(P,Q,i,m,k, lambda);
+          if(w_imk == Weight::NOT_VALID()) 
+          { continue; }
+
+          const Weight& w = W.get(i,m) + W.get(m,k) + w_imk;
+          if(m_min == -1 || w < w_min) {
+            w_min = w;
+            m_min = m;
+          }
+        }
+
+        // can be m_min = -1 and w_min = NOT_VALID which means no possible triangulation between i-k
+        W.put(i,k,w_min);
+        lambda.put(i,k, m_min);
+      }
+    }
+  }
+};
+
+/***********************************************************************************
+ * Internal entry point for both polyline and Polyhedron_3 triangulation functions
+ ***********************************************************************************/
+template <
+  typename PointRange1,
+  typename PointRange2,
+  typename Tracer,
+  typename WeightCalculator,
+  typename Kernel
+>
+typename WeightCalculator::Weight
+triangulate_hole_polyline(const PointRange1& points,
+                          const PointRange2& third_points,
+                          Tracer& tracer,
+                          const WeightCalculator& WC,
+                          bool use_delaunay_triangulation,
+                          const Kernel&)
+{
+  typedef Kernel        K;
+  typedef typename K::Point_3    Point_3;
+  typedef CGAL::internal::Triangulate_hole_polyline_DT<K, Tracer, WeightCalculator> Fill_DT;
+  typedef CGAL::internal::Triangulate_hole_polyline<K, Tracer, WeightCalculator>    Fill;
+
+  std::vector<Point_3> P(boost::begin(points), boost::end(points));
+  std::vector<Point_3> Q(boost::begin(third_points), boost::end(third_points));
+
+  if(P.front() != P.back()){
+    P.push_back(P.front());
+    if( !Q.empty() && P.size() > Q.size()) {
+      Q.push_back(Q.front());
+    }
+  }
+
+  typename WeightCalculator::Weight w = use_delaunay_triangulation ?
+    Fill_DT().operator()(P,Q,tracer,WC) :
+    Fill().operator()(P,Q,tracer,WC);
+  CGAL_TRACE_STREAM << w << std::endl;
+  return w;
+}
+
+} // namespace internal
+
+} // namespace CGAL
+
+#endif // CGAL_HOLE_FILLING_TRIANGULATE_HOLE_POLYLINE_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/do_not_use_DT3.h b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/do_not_use_DT3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/do_not_use_DT3.h
rename to 3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/do_not_use_DT3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/experimental/experimental_code.h b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/experimental/experimental_code.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/experimental/experimental_code.h
rename to 3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/experimental/experimental_code.h
diff --git a/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/AABB_filtered_projection_traits.h b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/AABB_filtered_projection_traits.h
new file mode 100644
index 0000000..ea6e6bc
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/AABB_filtered_projection_traits.h
@@ -0,0 +1,134 @@
+// Copyright (c) 2008-2009  INRIA Sophia-Antipolis (France), ETH Zurich (Switzerland).
+// Copyright (c) 2010  GeometryFactory Sarl (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
+// 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(s) : Camille Wormser, Pierre Alliez, Stephane Tayeb, Laurent Rineau
+//
+// File adapted from <CGAL/internal/AABB_tree/AABB_traversal_traits.h>
+//
+
+#ifndef CGAL_AABB_FILTERED_PROJECTION_TRAITS_H
+#define CGAL_AABB_FILTERED_PROJECTION_TRAITS_H
+
+#include <CGAL/property_map.h>
+
+#include <CGAL/AABB_tree.h>
+#include <CGAL/internal/AABB_tree/AABB_node.h>
+#include <CGAL/internal/AABB_tree/Primitive_helper.h>
+
+namespace CGAL {
+namespace Polygon_mesh_processing {
+namespace internal {
+
+/**
+ * @class Projection_traits
+ */
+template <typename AABBTraits,
+          typename IndexPropertyMap,
+          bool keep = false>
+class Filtered_projection_traits
+{
+  typedef typename AABBTraits::FT FT;
+  typedef typename AABBTraits::Point_3 Point_3;
+  typedef typename AABBTraits::Primitive Primitive;
+  typedef typename AABBTraits::Bounding_box Bounding_box;
+  typedef typename AABBTraits::Primitive::Id Primitive_id;
+  typedef typename AABBTraits::Point_and_primitive_id Point_and_primitive_id;
+  typedef typename AABBTraits::Object_and_primitive_id Object_and_primitive_id;
+  typedef ::CGAL::AABB_node<AABBTraits> Node;
+  typedef typename ::CGAL::AABB_tree<AABBTraits>::size_type size_type;
+
+  typedef typename boost::property_traits<IndexPropertyMap>::value_type Index_type;
+
+  typedef std::set<typename boost::remove_const<Index_type>::type> Set_of_indices;
+
+public:
+  template <typename IndexToIgnoreIterator>
+  Filtered_projection_traits(IndexToIgnoreIterator begin,
+                             IndexToIgnoreIterator end,
+                             const AABBTraits& aabb_traits,
+                             IndexPropertyMap index_map = IndexPropertyMap())
+    : m_closest_point_initialized(false),
+      set_of_indices(begin, end),
+      aabb_traits(aabb_traits),
+      index_map(index_map)
+  {
+  }
+
+  Filtered_projection_traits(Index_type index,
+                             const AABBTraits& aabb_traits,
+                             IndexPropertyMap index_map = IndexPropertyMap())
+    : m_closest_point_initialized(false),
+      set_of_indices(),
+      aabb_traits(aabb_traits),
+      index_map(index_map)
+  {
+    set_of_indices.insert(index);
+  }
+
+  bool go_further() const { return true; }
+
+  void intersection(const Point_3& query, const Primitive& primitive)
+  {
+    const Index_type& id = get(index_map, primitive.id());
+
+    if(keep != (set_of_indices.count(id) > 0)) return;
+    if(!m_closest_point_initialized) {
+      typedef CGAL::internal::Primitive_helper<AABBTraits> Helper;
+      m_closest_point = Helper::get_reference_point(primitive, aabb_traits);
+      m_closest_primitive = primitive.id();
+      m_closest_point_initialized = true;
+    }
+    Point_3 new_closest_point = aabb_traits.closest_point_object()
+      (query, primitive, m_closest_point);
+    if(new_closest_point != m_closest_point)
+    {
+      m_closest_primitive = primitive.id();
+      m_closest_point = new_closest_point; // this effectively shrinks the sphere
+    }
+  }
+
+  bool do_intersect(const Point_3& query, const Node& node) const
+  {
+    if(!m_closest_point_initialized) return true;
+    return AABBTraits().compare_distance_object()
+      (query, node.bbox(), m_closest_point) == CGAL::SMALLER;
+  }
+
+  bool found() { return m_closest_point_initialized; };
+
+  Point_3 closest_point() const { return m_closest_point; }
+  Point_and_primitive_id closest_point_and_primitive() const
+  {
+    return Point_and_primitive_id(m_closest_point, m_closest_primitive);
+  }
+
+private:
+  Point_3 m_closest_point;
+  typename Primitive::Id m_closest_primitive;
+  bool m_closest_point_initialized;
+  Set_of_indices set_of_indices;
+  const AABBTraits& aabb_traits;
+  IndexPropertyMap index_map;
+}; // end Filtered_projection_traits
+
+} // end namespace internal
+} // end namespace Polygon_mesh_processing
+} // end namespace CGAL
+
+#endif // CGAL_MESH_3_AABB_FILTERED_PROJECTION_TRAITS_H
diff --git a/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h
new file mode 100644
index 0000000..547d481
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h
@@ -0,0 +1,1750 @@
+// Copyright (c) 2015 GeometryFactory (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Jane Tournois
+
+#ifndef CGAL_POLYGON_MESH_PROCESSING_REMESH_IMPL_H
+#define CGAL_POLYGON_MESH_PROCESSING_REMESH_IMPL_H
+
+#include <CGAL/Polygon_mesh_processing/compute_normal.h>
+#include <CGAL/Polygon_mesh_processing/border.h>
+#include <CGAL/Polygon_mesh_processing/repair.h>
+#include <CGAL/Polygon_mesh_processing/measure.h>
+#include <CGAL/Polygon_mesh_processing/connected_components.h>
+
+#include <CGAL/AABB_tree.h>
+#include <CGAL/AABB_traits.h>
+#include <CGAL/AABB_triangle_primitive.h>
+
+#include <CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/AABB_filtered_projection_traits.h>
+
+#include <CGAL/property_map.h>
+#include <CGAL/iterator.h>
+#include <CGAL/boost/graph/Euler_operations.h>
+#include <boost/graph/graph_traits.hpp>
+#include <boost/foreach.hpp>
+
+#include <boost/bimap.hpp>
+#include <boost/bimap/multiset_of.hpp>
+#include <boost/bimap/set_of.hpp>
+#include <boost/range.hpp>
+#include <boost/unordered_map.hpp>
+#include <boost/unordered_set.hpp>
+#include <boost/shared_ptr.hpp>
+
+#include <map>
+#include <list>
+#include <vector>
+#include <iterator>
+#include <fstream>
+
+#ifdef CGAL_PMP_REMESHING_DEBUG
+#include <CGAL/Polygon_mesh_processing/self_intersections.h>
+#define CGAL_DUMP_REMESHING_STEPS
+#define CGAL_PMP_REMESHING_VERBOSE_PROGRESS
+#endif
+
+#ifdef CGAL_PMP_REMESHING_VERY_VERBOSE
+#define CGAL_PMP_REMESHING_VERBOSE
+#define CGAL_PMP_REMESHING_VERBOSE_PROGRESS
+#endif
+
+#ifdef CGAL_PMP_REMESHING_VERBOSE_PROGRESS
+#define CGAL_PMP_REMESHING_VERBOSE
+#endif
+
+
+namespace CGAL {
+
+namespace PMP = Polygon_mesh_processing;
+
+namespace Polygon_mesh_processing {
+namespace internal {
+
+  enum Halfedge_status {
+    PATCH,       //h and hopp belong to the patch to be remeshed
+    PATCH_BORDER,//h belongs to the patch, hopp is MESH
+    MESH,        //h and hopp belong to the mesh, not the patch
+    MESH_BORDER  //h belongs to the mesh, face(hopp, pmesh) == null_face()
+  };
+
+  // A property map
+  template<typename Descriptor>
+  struct No_constraint_pmap
+  {
+  public:
+    typedef Descriptor                          key_type;
+    typedef bool                                value_type;
+    typedef value_type&                         reference;
+    typedef boost::read_write_property_map_tag  category;
+
+    friend bool get(const No_constraint_pmap& , const key_type& ) {
+      return false;
+    }
+    friend void put(No_constraint_pmap& , const key_type& , const bool ) {}
+  };
+
+  template <typename PM, typename FaceRange>
+  struct Border_constraint_pmap
+  {
+    typedef typename boost::graph_traits<PM>::halfedge_descriptor halfedge_descriptor;
+    typedef typename boost::graph_traits<PM>::edge_descriptor edge_descriptor;
+
+    boost::shared_ptr< std::set<edge_descriptor> > border_edges_ptr;
+    const PM* pmesh_ptr_;
+
+  public:
+    typedef edge_descriptor                     key_type;
+    typedef bool                                value_type;
+    typedef value_type&                         reference;
+    typedef boost::read_write_property_map_tag  category;
+
+    Border_constraint_pmap()
+      : border_edges_ptr(new std::set<edge_descriptor>() )
+      , pmesh_ptr_(NULL)
+    {}
+    Border_constraint_pmap(const PM& pmesh, const FaceRange& faces)
+      : border_edges_ptr(new std::set<edge_descriptor>() )
+      , pmesh_ptr_(&pmesh)
+    {
+      std::vector<halfedge_descriptor> border;
+      PMP::border_halfedges(faces, *pmesh_ptr_, std::back_inserter(border));
+
+      BOOST_FOREACH(halfedge_descriptor h, border)
+        border_edges_ptr->insert(edge(h, *pmesh_ptr_));
+    }
+
+    friend bool get(const Border_constraint_pmap<PM, FaceRange>& map,
+                    const edge_descriptor& e)
+    {
+      CGAL_assertion(map.pmesh_ptr_!=NULL);
+      return map.border_edges_ptr->count(e)!=0;
+    }
+
+    friend void put(Border_constraint_pmap<PM, FaceRange>& map,
+                    const edge_descriptor& e,
+                    const bool is)
+    {
+      CGAL_assertion(map.pmesh_ptr_ != NULL);
+      if (is)
+        map.border_edges_ptr->insert(e);
+      else
+        map.border_edges_ptr->erase(e);
+    }
+  };
+
+  template <typename PM,
+            typename EdgeIsConstrainedMap>
+  struct Connected_components_pmap
+  {
+    typedef typename boost::graph_traits<PM>::face_descriptor   face_descriptor;
+    typedef std::size_t                                         Patch_id;
+    typedef Connected_components_pmap<PM, EdgeIsConstrainedMap> CCMap;
+
+    boost::unordered_map<face_descriptor, Patch_id> patch_ids_map;
+
+  public:
+    typedef face_descriptor                     key_type;
+    typedef Patch_id                            value_type;
+    typedef Patch_id&                           reference;
+    typedef boost::read_write_property_map_tag  category;
+
+    Connected_components_pmap()
+      : patch_ids_map()
+    {}
+    Connected_components_pmap(const PM& pmesh, EdgeIsConstrainedMap ecmap)
+      : patch_ids_map()
+    {
+      PMP::connected_components(pmesh,
+        boost::make_assoc_property_map(patch_ids_map),
+        PMP::parameters::edge_is_constrained_map(ecmap));
+    }
+
+    friend value_type get(const CCMap& m, const key_type& f)
+    {
+      CGAL_assertion(!m.patch_ids_map.empty());
+      CGAL_assertion(m.patch_ids_map.find(f) != m.patch_ids_map.end());
+
+      return m.patch_ids_map.at(f);
+    }
+    friend void put(CCMap& m, const key_type& f, const value_type i)
+    {
+      if (m.patch_ids_map.find(f) == m.patch_ids_map.end())
+        m.patch_ids_map.insert(std::make_pair(f, i));
+      else
+        m.patch_ids_map[f] = i;
+    }
+  };
+
+  template<typename PM,
+           typename EdgeConstraintMap,
+           typename VertexPointMap>
+  bool constraints_are_short_enough(const PM& pmesh,
+                                    EdgeConstraintMap ecmap,
+                                    VertexPointMap vpmap,
+                                    const double& high)
+  {
+    double sqh = high*high;
+    typedef typename boost::graph_traits<PM>::halfedge_descriptor halfedge_descriptor;
+    typedef typename boost::graph_traits<PM>::edge_descriptor     edge_descriptor;
+    BOOST_FOREACH(edge_descriptor e, edges(pmesh))
+    {
+      if (get(ecmap, e))
+      {
+        halfedge_descriptor h = halfedge(e, pmesh);
+        if (sqh < CGAL::squared_distance(get(vpmap, source(h, pmesh)),
+                                         get(vpmap, target(h, pmesh))))
+        {
+          return false;
+        }
+      }
+    }
+    return true;
+  }
+
+  template<typename PolygonMesh
+         , typename VertexPointMap
+         , typename GeomTraits
+         , typename EdgeIsConstrainedMap = No_constraint_pmap<
+              typename boost::graph_traits<PolygonMesh>::edge_descriptor>
+         , typename VertexIsConstrainedMap = No_constraint_pmap<
+              typename boost::graph_traits<PolygonMesh>::vertex_descriptor>
+         , typename FacePatchMap = Connected_components_pmap<
+              PolygonMesh, EdgeIsConstrainedMap>
+  >
+  class Incremental_remesher
+  {
+    typedef PolygonMesh PM;
+    typedef typename boost::graph_traits<PM>::halfedge_descriptor halfedge_descriptor;
+    typedef typename boost::graph_traits<PM>::edge_descriptor     edge_descriptor;
+    typedef typename boost::graph_traits<PM>::vertex_descriptor   vertex_descriptor;
+    typedef typename boost::graph_traits<PM>::face_descriptor     face_descriptor;
+
+    typedef typename GeomTraits::Point_3    Point;
+    typedef typename GeomTraits::Vector_3   Vector_3;
+    typedef typename GeomTraits::Plane_3    Plane_3;
+    typedef typename GeomTraits::Triangle_3 Triangle_3;
+
+    typedef Incremental_remesher<PM, VertexPointMap
+                               , GeomTraits
+                               , EdgeIsConstrainedMap
+                               , VertexIsConstrainedMap
+                               , FacePatchMap
+                               > Self;
+
+  private:
+    typedef typename boost::property_traits<FacePatchMap>::value_type Patch_id;
+    typedef std::vector<Triangle_3>                      Triangle_list;
+    typedef std::vector<Patch_id>                        Patch_id_list;
+
+    typedef CGAL::AABB_triangle_primitive<GeomTraits,
+                     typename Triangle_list::iterator>    AABB_primitive;
+    typedef CGAL::AABB_traits<GeomTraits, AABB_primitive> AABB_traits;
+    typedef CGAL::AABB_tree<AABB_traits>                  AABB_tree;
+
+  public:
+    Incremental_remesher(PolygonMesh& pmesh
+                       , VertexPointMap& vpmap
+                       , const bool protect_constraints
+                       , EdgeIsConstrainedMap ecmap
+                       , VertexIsConstrainedMap vcmap
+                       , FacePatchMap fpmap
+                       , const bool own_tree = true)//built by the remesher
+      : mesh_(pmesh)
+      , vpmap_(vpmap)
+      , own_tree_(own_tree)
+      , input_triangles_()
+      , input_patch_ids_()
+      , halfedge_status_map_()
+      , protect_constraints_(protect_constraints)
+      , patch_ids_map_(fpmap)
+      , ecmap_(ecmap)
+      , vcmap_(vcmap)
+    {
+      CGAL_assertion(CGAL::is_triangle_mesh(mesh_));
+    }
+
+    ~Incremental_remesher()
+    {
+      if (own_tree_)
+        delete tree_ptr_;
+    }
+    
+    template<typename FaceRange>
+    void init_remeshing(const FaceRange& face_range)
+    {
+      tag_halfedges_status(face_range); //called first
+
+      BOOST_FOREACH(face_descriptor f, face_range)
+      {
+        input_triangles_.push_back(triangle(f));
+        input_patch_ids_.push_back(get_patch_id(f));
+      }
+      CGAL_assertion(input_triangles_.size() == input_patch_ids_.size());
+
+      tree_ptr_ = new AABB_tree(input_triangles_.begin(),
+                                input_triangles_.end());
+      tree_ptr_->accelerate_distance_queries();
+    }
+
+    // split edges of edge_range that have their length > high
+    template<typename EdgeRange>
+    void split_long_edges(const EdgeRange& edge_range,
+                          const double& high)
+    {
+      typedef boost::bimap<
+        boost::bimaps::set_of<halfedge_descriptor>,
+        boost::bimaps::multiset_of<double, std::greater<double> > >  Boost_bimap;
+      typedef typename Boost_bimap::value_type                       long_edge;
+
+#ifdef CGAL_PMP_REMESHING_VERBOSE
+      std::cout << "Split long edges (" << high << ")...";
+      std::cout.flush();
+#endif
+      double sq_high = high*high;
+
+      //collect long edges
+      Boost_bimap long_edges;
+      BOOST_FOREACH(edge_descriptor e, edge_range)
+      {
+        double sqlen = sqlength(e);
+        if (sqlen > sq_high)
+        {
+          long_edges.insert(long_edge(halfedge(e, mesh_), sqlen));
+          put(ecmap_, e, false);
+        }
+        else
+          put(ecmap_, e, true);
+      }
+
+      //split long edges
+      unsigned int nb_splits = 0;
+      while (!long_edges.empty())
+      {
+        //the edge with longest length
+        typename Boost_bimap::right_map::iterator eit = long_edges.right.begin();
+        halfedge_descriptor he = eit->second;
+        double sqlen = eit->first;
+        long_edges.right.erase(eit);
+
+        //split edge
+        Point refinement_point = this->midpoint(he);
+        halfedge_descriptor hnew = CGAL::Euler::split_edge(he, mesh_);
+        CGAL_assertion(he == next(hnew, mesh_));
+        ++nb_splits;
+
+        //move refinement point
+        vertex_descriptor vnew = target(hnew, mesh_);
+        put(vpmap_, vnew, refinement_point);
+#ifdef CGAL_PMP_REMESHING_VERY_VERBOSE
+        std::cout << "   refinement point : " << refinement_point << std::endl;
+#endif
+
+        //check sub-edges
+        double sqlen_new = 0.25 * sqlen;
+        if (sqlen_new > sq_high)
+        {
+          //if it was more than twice the "long" threshold, insert them
+          long_edges.insert(long_edge(hnew, sqlen_new));
+          long_edges.insert(long_edge(next(hnew, mesh_), sqlen_new));
+        }
+        else
+        {
+          put(ecmap_, edge(hnew, mesh_), true);
+          put(ecmap_, edge(next(hnew, mesh_), mesh_), true);
+        }
+
+        //insert new edges to keep triangular faces, and update long_edges
+        if (!is_border(hnew, mesh_))
+        {
+          CGAL::Euler::split_face(hnew, next(next(hnew, mesh_), mesh_), mesh_);
+        }
+
+        //do it again on the other side if we're not on boundary
+        halfedge_descriptor hnew_opp = opposite(hnew, mesh_);
+        if (!is_border(hnew_opp, mesh_))
+        {
+          CGAL::Euler::split_face(prev(hnew_opp, mesh_), next(hnew_opp, mesh_), mesh_);
+        }
+      }
+#ifdef CGAL_PMP_REMESHING_VERBOSE
+      std::cout << " done (" << nb_splits << " splits)." << std::endl;
+#endif
+#ifdef CGAL_DUMP_REMESHING_STEPS
+      dump("0-border_split.off");
+#endif
+    }
+
+    // PMP book :
+    // "visits all edges of the mesh
+    //if an edge is longer than the given threshold `high`, the edge
+    //is split at its midpoint and the two adjacent triangles are bisected (2-4 split)"
+    void split_long_edges(const double& high)
+    {
+      typedef boost::bimap<
+        boost::bimaps::set_of<halfedge_descriptor>,
+        boost::bimaps::multiset_of<double, std::greater<double> > >  Boost_bimap;
+      typedef typename Boost_bimap::value_type                       long_edge;
+
+#ifdef CGAL_PMP_REMESHING_VERBOSE
+      std::cout << "Split long edges (" << high << ")..." << std::endl;
+#endif
+      double sq_high = high*high;
+
+      //collect long edges
+      Boost_bimap long_edges;
+      BOOST_FOREACH(edge_descriptor e, edges(mesh_))
+      {
+        if (!is_split_allowed(e))
+          continue;
+        double sqlen = sqlength(e);
+        if(sqlen > sq_high)
+          long_edges.insert(long_edge(halfedge(e, mesh_), sqlen));
+      }
+
+      //split long edges
+      unsigned int nb_splits = 0;
+      while (!long_edges.empty())
+      {
+        //the edge with longest length
+        typename Boost_bimap::right_map::iterator eit = long_edges.right.begin();
+        halfedge_descriptor he = eit->second;
+        double sqlen = eit->first;
+        long_edges.right.erase(eit);
+
+#ifdef CGAL_PMP_REMESHING_VERBOSE_PROGRESS
+        std::cout << "\r\t(" << long_edges.left.size() << " long edges, ";
+        std::cout << nb_splits << " splits)";
+        std::cout.flush();
+#endif
+
+        if (protect_constraints_ && !is_longest_on_faces(edge(he, mesh_)))
+          continue;
+
+        //collect patch_ids
+        Patch_id patch_id = get_patch_id(face(he, mesh_));
+        Patch_id patch_id_opp = get_patch_id(face(opposite(he, mesh_), mesh_));
+
+        //split edge
+        Point refinement_point = this->midpoint(he);
+        halfedge_descriptor hnew = CGAL::Euler::split_edge(he, mesh_);
+        CGAL_assertion(he == next(hnew, mesh_));
+        ++nb_splits;
+
+        //move refinement point
+        vertex_descriptor vnew = target(hnew, mesh_);
+        put(vpmap_, vnew, refinement_point);
+#ifdef CGAL_PMP_REMESHING_VERY_VERBOSE
+        std::cout << "   Refinement point : " << refinement_point << std::endl;
+#endif
+
+        //after splitting
+        halfedge_descriptor hnew_opp = opposite(hnew, mesh_);
+        halfedge_added(hnew, status(he));
+        halfedge_added(hnew_opp, status(opposite(he, mesh_)));
+
+        //check sub-edges
+        double sqlen_new = 0.25 * sqlen;
+        if (sqlen_new > sq_high)
+        {
+          //if it was more than twice the "long" threshold, insert them
+          long_edges.insert(long_edge(hnew,              sqlen_new));
+          long_edges.insert(long_edge(next(hnew, mesh_), sqlen_new));
+        }
+
+        //insert new edges to keep triangular faces, and update long_edges
+        if (!is_on_border(hnew))
+        {
+          halfedge_descriptor hnew2 = CGAL::Euler::split_face(hnew,
+                                                              next(next(hnew, mesh_), mesh_),
+                                                              mesh_);
+          Halfedge_status snew = (is_on_patch(hnew) || is_on_patch_border(hnew))
+            ? PATCH
+            : MESH;
+          halfedge_added(hnew2,                  snew);
+          halfedge_added(opposite(hnew2, mesh_), snew);
+          set_patch_id(face(hnew2, mesh_), patch_id);
+          set_patch_id(face(opposite(hnew2, mesh_), mesh_), patch_id);
+
+          if (snew == PATCH)
+          {
+            double sql = sqlength(hnew2);
+            if (sql > sq_high)
+              long_edges.insert(long_edge(hnew2, sql));
+          }
+        }
+
+        //do it again on the other side if we're not on boundary
+        if (!is_on_border(hnew_opp))
+        {
+          halfedge_descriptor hnew2 = CGAL::Euler::split_face(prev(hnew_opp, mesh_),
+                                                              next(hnew_opp, mesh_),
+                                                              mesh_);
+          Halfedge_status snew = (is_on_patch(hnew_opp) || is_on_patch_border(hnew_opp))
+             ? PATCH
+            : MESH;
+          halfedge_added(hnew2,                  snew);
+          halfedge_added(opposite(hnew2, mesh_), snew);
+          set_patch_id(face(hnew2, mesh_), patch_id_opp);
+          set_patch_id(face(opposite(hnew2, mesh_), mesh_), patch_id_opp);
+
+          if (snew == PATCH)
+          {
+            double sql = sqlength(hnew2);
+            if (sql > sq_high)
+              long_edges.insert(long_edge(hnew2, sql));
+          }
+        }
+      }
+#ifdef CGAL_PMP_REMESHING_VERBOSE
+      std::cout << " done ("<< nb_splits << " splits)." << std::endl;
+#endif
+
+#ifdef CGAL_PMP_REMESHING_DEBUG
+      CGAL_expensive_assertion(is_triangle_mesh(mesh_));
+      debug_status_map();
+      debug_self_intersections();
+#endif
+
+#ifdef CGAL_DUMP_REMESHING_STEPS
+      dump("1-edge_split.off");
+#endif
+    }
+
+    // PMP book :
+    // "collapses and thus removes all edges that are shorter than a
+    // threshold `low`. [...] testing before each collapse whether the collapse
+    // would produce an edge that is longer than `high`"
+    void collapse_short_edges(const double& low, const double& high)
+    {
+      typedef boost::bimap<
+        boost::bimaps::set_of<halfedge_descriptor>,
+        boost::bimaps::multiset_of<double, std::less<double> > >  Boost_bimap;
+      typedef typename Boost_bimap::value_type                    short_edge;
+
+#ifdef CGAL_PMP_REMESHING_VERBOSE
+      std::cout << "Collapse short edges (" << low << ", " << high << ")..."
+                << std::endl;
+#endif
+      double sq_low = low*low;
+      double sq_high = high*high;
+
+      Boost_bimap short_edges;
+      BOOST_FOREACH(edge_descriptor e, edges(mesh_))
+      {
+        if (!is_collapse_allowed(e))
+          continue;
+        double sqlen = sqlength(e);
+        if (sqlen < sq_low)
+          short_edges.insert(short_edge(halfedge(e, mesh_), sqlen));
+      }
+
+      unsigned int nb_collapses = 0;
+      while (!short_edges.empty())
+      {
+        //the edge with shortest length
+        typename Boost_bimap::right_map::iterator eit = short_edges.right.begin();
+        halfedge_descriptor he = eit->second;
+        short_edges.right.erase(eit);
+
+#ifdef CGAL_PMP_REMESHING_VERBOSE_PROGRESS
+        std::cout << "\r\t(" << short_edges.left.size() << " short edges, ";
+        std::cout << nb_collapses << " collapses)";
+        std::cout.flush();
+#endif
+
+        edge_descriptor e = edge(he, mesh_);
+        if (!is_collapse_allowed(e))
+          continue; //situation could have changed since it was added to the bimap
+
+        //handle the boundary case :
+        //a PATCH_BORDER edge can be collapsed,
+        //and an edge incident to PATCH_BORDER can be collapsed,
+        //but only if the boundary vertex is kept,
+        //so re-insert opposite(he) to collapse it
+        if (!is_on_patch(he))
+        {
+          CGAL_assertion(!protect_constraints_);//is_collapse_allowed returned false
+          if (is_on_border(he) || is_on_mesh(he))
+          {
+            he = opposite(he, mesh_); //he now is PATCH_BORDER
+            CGAL_assertion(is_on_patch_border(he));
+          }
+        }//end if(not on PATCH)
+
+        //let's try to collapse he into vb
+        vertex_descriptor va = source(he, mesh_);
+        vertex_descriptor vb = target(he, mesh_);
+
+        if (is_on_patch_border(va) && !is_on_patch_border(vb))
+        {
+          he = opposite(he, mesh_);
+          va = source(he, mesh_);
+          vb = target(he, mesh_);
+          CGAL_assertion(is_on_patch_border(vb) && !is_on_patch_border(va));
+        }
+        else if (is_on_patch(va) && is_on_patch(vb))
+        {
+          if(!collapse_does_not_invert_face(he))
+          {
+            if (collapse_does_not_invert_face(opposite(he, mesh_)))
+            {
+              he = opposite(he, mesh_);
+              va = source(he, mesh_);
+              vb = target(he, mesh_);
+            }
+            else
+              continue;//both directions invert a face
+          }
+          CGAL_assertion(collapse_does_not_invert_face(he));
+        }
+
+        CGAL_assertion(is_collapse_allowed(e));
+
+        if (degree(va, mesh_) < 3
+          || degree(vb, mesh_) < 3
+          || !CGAL::Euler::does_satisfy_link_condition(e, mesh_))//necessary to collapse
+          continue;
+
+        //check that collapse would not create an edge with length > high
+        //iterate on vertices va_i of the one-ring of va
+        bool collapse_ok = true;
+        BOOST_FOREACH(halfedge_descriptor ha, halfedges_around_target(va, mesh_))
+        {
+          vertex_descriptor va_i = source(ha, mesh_);
+          if (sqlength(vb, va_i) > sq_high)
+          {
+            collapse_ok = false;
+            break;
+          }
+        }
+        //before collapsing va into vb, check that it does not break a corner
+        //if it is allowed, perform the collapse
+        if (collapse_ok && !is_constrained(va) && !is_corner(va))
+        {
+          //"collapse va into vb along e"
+          // remove edges incident to va and vb, because their lengths will change
+          BOOST_FOREACH(halfedge_descriptor ha, halfedges_around_target(va, mesh_))
+          {
+            short_edges.left.erase(ha);
+            short_edges.left.erase(opposite(ha, mesh_));
+          }
+          BOOST_FOREACH(halfedge_descriptor hb, halfedges_around_target(vb, mesh_))
+          {
+            short_edges.left.erase(hb);
+            short_edges.left.erase(opposite(hb, mesh_));
+          }
+
+          //before collapse
+          bool mesh_border_case     = is_on_border(opposite(he, mesh_));
+          halfedge_descriptor ep_p  = prev(opposite(he, mesh_), mesh_);
+          halfedge_descriptor epo_p = opposite(ep_p, mesh_);
+          halfedge_descriptor en    = next(he, mesh_);
+          halfedge_descriptor en_p  = next(opposite(he, mesh_), mesh_);
+          Halfedge_status s_ep_p    = status(ep_p);
+          Halfedge_status s_epo_p   = status(epo_p);
+          Halfedge_status s_ep      = status(prev(he, mesh_));
+          Halfedge_status s_epo     = status(opposite(prev(he, mesh_), mesh_));
+
+          // merge halfedge_status to keep the more important on both sides
+          //do it before collapse is performed to be sure everything is valid
+          merge_status(en, s_epo, s_ep);
+          if (!mesh_border_case)
+            merge_status(en_p, s_epo_p, s_ep_p);
+
+          if (!mesh_border_case)
+            halfedge_and_opp_removed(prev(opposite(he, mesh_), mesh_));
+          halfedge_and_opp_removed(he);
+          halfedge_and_opp_removed(prev(he, mesh_));
+
+          //constrained case
+          bool constrained_case = is_constrained(va) || is_constrained(vb);
+          if (constrained_case)
+          {
+            CGAL_assertion(is_constrained(va) ^ is_constrained(vb));//XOR
+            set_constrained(va, false);
+            set_constrained(vb, false);
+          }
+
+          //perform collapse
+          Point target_point = get(vpmap_, vb);
+          vertex_descriptor vkept = CGAL::Euler::collapse_edge(e, mesh_);
+          put(vpmap_, vkept, target_point);
+          ++nb_collapses;
+
+          //fix constrained case
+          if (constrained_case)//we have made sure that collapse goes to constrained vertex
+            set_constrained(vkept, true);
+
+          fix_degenerate_faces(vkept, short_edges, sq_low);
+
+#ifdef CGAL_PMP_REMESHING_DEBUG
+          debug_status_map();
+          CGAL_assertion(!incident_to_degenerate(halfedge(vkept, mesh_)));
+#endif
+
+          //insert new/remaining short edges
+          BOOST_FOREACH(halfedge_descriptor ht, halfedges_around_target(vkept, mesh_))
+          {
+            if (!is_collapse_allowed(edge(ht, mesh_)))
+              continue;
+            double sqlen = sqlength(ht);
+            if (sqlen < sq_low)
+              short_edges.insert(short_edge(ht, sqlen));
+          }
+        }//end if(collapse_ok)
+      }
+
+#ifdef CGAL_PMP_REMESHING_VERBOSE
+      std::cout << " done (" << nb_collapses << " collapses)." << std::endl;
+#endif
+
+#ifdef CGAL_DUMP_REMESHING_STEPS
+      dump("2-edge_collapse.off");
+#endif
+
+#ifdef CGAL_PMP_REMESHING_DEBUG
+      CGAL_expensive_assertion(is_triangle_mesh(mesh_));
+      debug_status_map();
+      debug_self_intersections();
+      CGAL_assertion(0 == PMP::remove_degenerate_faces(mesh_,
+        PMP::parameters::vertex_point_map(vpmap_).geom_traits(GeomTraits())));
+#endif
+    }
+
+    // PMP book :
+    // "equalizes the vertex valences by flipping edges.
+    // The target valence is 6 and 4 for interior and boundary vertices, resp.
+    // The algo. tentatively flips each edge `e` and checks whether the deviation
+    // to the target valences decreases. If not, the edge is flipped back"
+    void equalize_valences()
+    {
+#ifdef CGAL_PMP_REMESHING_VERBOSE
+      std::cout << "Equalize valences..." << std::endl;
+#endif
+      unsigned int nb_flips = 0;
+      BOOST_FOREACH(edge_descriptor e, edges(mesh_))
+      {
+        //only the patch edges are allowed to be flipped
+        if (!is_flip_allowed(e))
+          continue;
+
+        halfedge_descriptor he = halfedge(e, mesh_);
+        vertex_descriptor va = source(he, mesh_);
+        vertex_descriptor vb = target(he, mesh_);
+        vertex_descriptor vc = target(next(he, mesh_), mesh_);
+        vertex_descriptor vd = target(next(opposite(he, mesh_), mesh_), mesh_);
+
+        int deviation_pre = CGAL::abs(valence(va) - target_valence(va))
+                          + CGAL::abs(valence(vb) - target_valence(vb))
+                          + CGAL::abs(valence(vc) - target_valence(vc))
+                          + CGAL::abs(valence(vd) - target_valence(vd));
+
+        CGAL_assertion_code(Halfedge_status s1 = status(he));
+        CGAL_assertion_code(Halfedge_status s1o = status(opposite(he, mesh_)));
+
+        Patch_id pid = get_patch_id(face(he, mesh_));
+
+        CGAL::Euler::flip_edge(he, mesh_);
+        ++nb_flips;
+
+#ifdef CGAL_PMP_REMESHING_VERBOSE_PROGRESS
+        std::cout << "\r\t(" << nb_flips << " flips)";
+        std::cout.flush();
+#endif
+        CGAL_assertion_code(Halfedge_status s2 = status(he));
+        CGAL_assertion_code(Halfedge_status s2o = status(opposite(he, mesh_)));
+        CGAL_assertion(s1 == s2   && s1 == PATCH);
+        CGAL_assertion(s1o == s2o && s1o == PATCH);
+        CGAL_assertion(!is_border(he, mesh_));
+
+        CGAL_assertion(
+             (vc == target(he, mesh_) && vd == source(he, mesh_))
+          || (vd == target(he, mesh_) && vc == source(he, mesh_)));
+
+        int deviation_post = CGAL::abs(valence(va) - target_valence(va))
+                          + CGAL::abs(valence(vb) - target_valence(vb))
+                          + CGAL::abs(valence(vc) - target_valence(vc))
+                          + CGAL::abs(valence(vd) - target_valence(vd));
+
+        //check that mesh does not become non-triangle,
+        //nor has inverted faces
+        if (deviation_pre <= deviation_post
+          || !check_normals(he)
+          || incident_to_degenerate(he)
+          || incident_to_degenerate(opposite(he, mesh_))
+          || !is_on_triangle(he)
+          || !is_on_triangle(opposite(he, mesh_))
+          || !check_normals(target(he, mesh_))
+          || !check_normals(source(he, mesh_)))
+        {
+          CGAL::Euler::flip_edge(he, mesh_);
+          --nb_flips;
+
+          CGAL_assertion_code(Halfedge_status s3 = status(he));
+          CGAL_assertion(s1 == s3);
+          CGAL_assertion(!is_border(he, mesh_));
+          CGAL_assertion(
+               (va == source(he, mesh_) && vb == target(he, mesh_))
+            || (vb == source(he, mesh_) && va == target(he, mesh_)));
+        }
+
+        set_patch_id(face(he, mesh_), pid);
+        set_patch_id(face(opposite(he, mesh_), mesh_), pid);
+      }
+
+#ifdef CGAL_PMP_REMESHING_VERBOSE
+      std::cout << "\r\tdone ("<< nb_flips << " flips)" << std::endl;
+#endif
+
+#ifdef CGAL_PMP_REMESHING_DEBUG
+      debug_status_map();
+      CGAL_assertion(0 == PMP::remove_degenerate_faces(mesh_
+                            , PMP::parameters::vertex_point_map(vpmap_)
+                            .geom_traits(GeomTraits())));
+      debug_self_intersections();
+#endif
+
+#ifdef CGAL_DUMP_REMESHING_STEPS
+      dump("3-edge_flips.off");
+#endif
+    }
+
+    // PMP book :
+    // "applies an iterative smoothing filter to the mesh.
+    // The vertex movement has to be constrained to the vertex tangent plane [...]
+    // smoothing algorithm with uniform Laplacian weights"
+    void tangential_relaxation(const bool relax_constraints/*1d smoothing*/
+                             , const unsigned int nb_iterations)
+    {
+      //todo : move border vertices along 1-dimensional features
+#ifdef CGAL_PMP_REMESHING_VERBOSE
+      std::cout << "Tangential relaxation (" << nb_iterations << " iter.)...";
+      std::cout << std::endl;
+#endif
+      for (unsigned int nit = 0; nit < nb_iterations; ++nit)
+      {
+#ifdef CGAL_PMP_REMESHING_VERBOSE_PROGRESS
+        std::cout << "\r\t(iteration " << (nit + 1) << " / ";
+        std::cout << nb_iterations << ") ";
+        std::cout.flush();
+#endif
+      //todo : use boost::vector_property_map to improve computing time
+      typedef std::map<vertex_descriptor, Vector_3> VNormalsMap;
+      VNormalsMap vnormals;
+      boost::associative_property_map<VNormalsMap> propmap_normals(vnormals);
+      std::map<vertex_descriptor, Point> barycenters;
+
+      // at each vertex, compute vertex normal
+      // at each vertex, compute barycenter of neighbors
+      BOOST_FOREACH(vertex_descriptor v, vertices(mesh_))
+      {
+        if (is_on_patch(v) && !is_constrained(v))
+        {
+        Vector_3 vn = PMP::compute_vertex_normal(v, mesh_
+                            , PMP::parameters::vertex_point_map(vpmap_)
+                            .geom_traits(GeomTraits()));
+        put(propmap_normals, v, vn);
+
+          Vector_3 move = CGAL::NULL_VECTOR;
+          unsigned int star_size = 0;
+          BOOST_FOREACH(halfedge_descriptor h, halfedges_around_target(v, mesh_))
+          {
+            move = move + Vector_3(get(vpmap_, v), get(vpmap_, source(h, mesh_)));
+            ++star_size;
+          }
+          CGAL_assertion(star_size > 0);
+          move = (1. / (double)star_size) * move;
+
+          barycenters[v] = get(vpmap_, v) + move;
+        }
+        else if (relax_constraints
+              && !protect_constraints_
+              && is_on_patch_border(v)
+              && !is_corner(v)
+              && !is_constrained(v))
+        {
+          put(propmap_normals, v, CGAL::NULL_VECTOR);
+
+          std::vector<halfedge_descriptor> border_halfedges;
+          BOOST_FOREACH(halfedge_descriptor h, halfedges_around_target(v, mesh_))
+          {
+            if (is_on_patch_border(h) || is_on_patch_border(opposite(h, mesh_)))
+              border_halfedges.push_back(h);
+          }
+          if (border_halfedges.size() == 2)//others are corner cases
+          {
+            vertex_descriptor ph0 = source(border_halfedges[0], mesh_);
+            vertex_descriptor ph1 = source(border_halfedges[1], mesh_);
+            double dot = to_double(Vector_3(get(vpmap_, v), get(vpmap_, ph0))
+                                   * Vector_3(get(vpmap_, v), get(vpmap_, ph1)));
+            //check squared cosine is < 0.25 (~120 degrees)
+            if (0.25 < dot / (sqlength(border_halfedges[0]) * sqlength(border_halfedges[0])))
+              barycenters[v] = CGAL::midpoint(midpoint(border_halfedges[0]),
+                                              midpoint(border_halfedges[1]));
+          }
+        }
+      }
+
+      // compute moves
+      typedef typename std::map<vertex_descriptor, Point>::value_type VP_pair;
+      std::map<vertex_descriptor, Point> new_locations;
+      BOOST_FOREACH(const VP_pair& vp, barycenters)
+      {
+        vertex_descriptor v = vp.first;
+        Point pv = get(vpmap_, v);
+        Vector_3 nv = boost::get(propmap_normals, v);
+        Point qv = vp.second; //barycenter at v
+
+        new_locations[v] = qv + (nv * Vector_3(qv, pv)) * nv;
+      }
+
+      // perform moves
+      BOOST_FOREACH(const VP_pair& vp, new_locations)
+      {
+        put(vpmap_, vp.first, vp.second);
+      }
+
+      CGAL_assertion(is_valid(mesh_));
+      CGAL_assertion(is_triangle_mesh(mesh_));
+      }//end for loop (nit == nb_iterations)
+
+#ifdef CGAL_PMP_REMESHING_DEBUG
+      debug_self_intersections();
+#endif
+#ifdef CGAL_PMP_REMESHING_VERBOSE
+      std::cout << "done." << std::endl;
+#endif
+#ifdef CGAL_DUMP_REMESHING_STEPS
+      dump("4-relaxation.off");
+#endif
+    }
+
+    // PMP book :
+    // "maps the vertices back to the surface"
+    void project_to_surface()
+    {
+      //todo : handle the case of boundary vertices
+#ifdef CGAL_PMP_REMESHING_VERBOSE
+      std::cout << "Project to surface...";
+      std::cout.flush();
+#endif
+
+      BOOST_FOREACH(vertex_descriptor v, vertices(mesh_))
+      {
+        if (is_constrained(v) || !is_on_patch(v))
+          continue;
+        //note if v is constrained, it has not moved
+
+        Patch_id_property_map pid_pmap(*this);
+        internal::Filtered_projection_traits<typename AABB_tree::AABB_traits,
+                                             Patch_id_property_map,
+                                             true> /* keep primitives with matching IDs */
+        projection_traits(
+          get_patch_id(face(halfedge(v, mesh_), mesh_)),
+          tree_ptr_->traits(),
+          pid_pmap
+          );
+        tree_ptr_->traversal(get(vpmap_, v), projection_traits);
+        CGAL_assertion(projection_traits.found());
+        Point proj = projection_traits.closest_point();
+        put(vpmap_, v, proj);
+      }
+      CGAL_assertion(is_valid(mesh_));
+      CGAL_assertion(is_triangle_mesh(mesh_));
+#ifdef CGAL_PMP_REMESHING_DEBUG
+      debug_self_intersections();
+#endif
+#ifdef CGAL_PMP_REMESHING_VERBOSE
+      std::cout << "done." << std::endl;
+#endif
+
+#ifdef CGAL_DUMP_REMESHING_STEPS
+      dump("5-project.off");
+#endif
+    }
+
+private:
+  Patch_id get_patch_id(const face_descriptor& f) const
+  {
+    if (f == boost::graph_traits<PM>::null_face())
+      return Patch_id();
+    return get(patch_ids_map_, f);
+  }
+
+  void set_patch_id(const face_descriptor& f, const Patch_id& i)
+  {
+    put(patch_ids_map_, f, i);
+  }
+
+  struct Patch_id_property_map
+  {
+    typedef boost::readable_property_map_tag     category;
+    typedef Patch_id                             value_type;
+    typedef Patch_id&                            reference;
+    typedef typename Triangle_list::const_iterator key_type;
+
+    const Self* remesher_ptr_;
+
+    Patch_id_property_map()
+      : remesher_ptr_(NULL) {}
+    Patch_id_property_map(const Self& remesher)
+      : remesher_ptr_(&remesher) {}
+
+    friend Patch_id get(const Patch_id_property_map& m, key_type tr_it)
+    {
+      //tr_it is an iterator from triangles_
+      std::size_t id_in_vec = std::distance(
+        m.remesher_ptr_->input_triangles().begin(), tr_it);
+
+      CGAL_assertion(0 <= id_in_vec);
+      CGAL_assertion(id_in_vec < m.remesher_ptr_->input_patch_ids().size());
+      CGAL_assertion(*tr_it == m.remesher_ptr_->input_triangles()[id_in_vec]);
+
+      return m.remesher_ptr_->input_patch_ids()[id_in_vec];
+    }
+  };
+
+  private:
+    Triangle_3 triangle(face_descriptor f) const
+    {
+      halfedge_descriptor h = halfedge(f, mesh_);
+      vertex_descriptor v1  = target(h, mesh_);
+      vertex_descriptor v2  = target(next(h, mesh_), mesh_);
+      vertex_descriptor v3  = target(next(next(h, mesh_), mesh_), mesh_);
+      return Triangle_3(get(vpmap_, v1), get(vpmap_, v2), get(vpmap_, v3));
+    }
+
+    double sqlength(const vertex_descriptor& v1,
+                    const vertex_descriptor& v2) const
+    {
+      return to_double(CGAL::squared_distance(get(vpmap_, v1), get(vpmap_, v2)));
+    }
+
+    double sqlength(const halfedge_descriptor& h) const
+    {
+      vertex_descriptor v1 = target(h, mesh_);
+      vertex_descriptor v2 = source(h, mesh_);
+      return sqlength(v1, v2);
+    }
+
+    double sqlength(const edge_descriptor& e) const
+    {
+      return sqlength(halfedge(e, mesh_));
+    }
+
+    Point midpoint(const halfedge_descriptor& he) const
+    {
+      Point p1 = get(vpmap_, target(he, mesh_));
+      Point p2 = get(vpmap_, source(he, mesh_));
+      return CGAL::midpoint(p1, p2);
+    }
+
+    void dump(const char* filename) const
+    {
+      std::ofstream out(filename);
+      out << mesh_;
+      out.close();
+    }
+
+    int valence(const vertex_descriptor& v) const
+    {
+      return static_cast<int>(degree(v, mesh_));
+    }
+
+    int target_valence(const vertex_descriptor& v) const
+    {
+      return (is_border(v, mesh_)) ? 4 : 6;
+    }
+
+    bool is_on_triangle(const halfedge_descriptor& h) const
+    {
+      return h == next(next(next(h, mesh_), mesh_), mesh_);
+    }
+
+    bool is_longest_on_faces(const edge_descriptor& e) const
+    {
+      halfedge_descriptor h = halfedge(e, mesh_);
+      halfedge_descriptor hopp = opposite(h, mesh_);
+
+      //check whether h is the longest edge in its associated face
+      //overwise refinement will go for an endless loop
+      double sqh = sqlength(h);
+      return sqh >= sqlength(next(h, mesh_))
+          && sqh >= sqlength(next(next(h, mesh_), mesh_))
+          //do the same for hopp
+          && sqh >= sqlength(next(hopp, mesh_))
+          && sqh >= sqlength(next(next(hopp, mesh_), mesh_));
+    }
+
+    bool is_constrained(const edge_descriptor& e) const
+    {
+      return is_on_border(e) || is_on_patch_border(e);
+    }
+
+    bool is_split_allowed(const edge_descriptor& e) const
+    {
+      halfedge_descriptor h = halfedge(e, mesh_);
+      halfedge_descriptor hopp = opposite(h, mesh_);
+
+      if (protect_constraints_ && is_constrained(e))
+        return false;
+      else //allow splitting constraints
+      {
+        if (is_on_mesh(h) && is_on_mesh(hopp))
+          return false;
+        else if (is_on_mesh(h) && is_on_border(hopp))
+          return false;
+        else if (is_on_mesh(hopp) && is_on_border(h))
+          return false;
+        else
+          return true;
+      }
+    }
+
+    bool is_collapse_allowed(const edge_descriptor& e) const
+    {
+      halfedge_descriptor he = halfedge(e, mesh_);
+      halfedge_descriptor hopp = opposite(he, mesh_);
+
+      if (protect_constraints_ && is_constrained(e))
+        return false;
+      if (is_on_patch(he)) //hopp is also on patch
+      {
+        if (is_on_patch_border(target(he, mesh_)) && is_on_patch_border(source(he, mesh_)))
+          return false;//collapse would induce pinching the selection
+        else
+          return is_collapse_allowed(he) && is_collapse_allowed(hopp);
+      }
+      else if (is_on_patch_border(he))
+        return is_collapse_allowed_on_patch_border(he);
+      else if (is_on_patch_border(hopp))
+        return is_collapse_allowed_on_patch_border(hopp);
+      return false;
+    }
+
+    bool is_collapse_allowed(const halfedge_descriptor& he) const
+    {
+      halfedge_descriptor hopp = opposite(he, mesh_);
+
+      if (is_on_patch_border(next(he, mesh_)) && is_on_patch_border(prev(he, mesh_)))
+        return false;//too many cases to be handled
+      if (is_on_patch_border(next(hopp, mesh_)) && is_on_patch_border(prev(hopp, mesh_)))
+        return false;//too many cases to be handled
+      else if (is_on_patch_border(next(he, mesh_)))
+      {
+        //avoid generation of degenerate faces, and self-intersections
+        if (source(he, mesh_) ==
+          target(next(next_on_patch_border(next(he, mesh_)), mesh_), mesh_))
+          return false;
+      }
+      else if (is_on_patch_border(prev(hopp, mesh_)))
+      {
+        //avoid generation of degenerate faces, and self-intersections
+        if (target(hopp, mesh_) ==
+          source(prev(prev_on_patch_border(prev(hopp, mesh_)), mesh_), mesh_))
+          return false;
+      }
+      return true;
+    }
+
+    bool is_collapse_allowed_on_patch_border(const halfedge_descriptor& h) const
+    {
+      CGAL_precondition(is_on_patch_border(h));
+      halfedge_descriptor hopp = opposite(h, mesh_);
+
+      if (is_on_patch_border(next(h, mesh_)) && is_on_patch_border(prev(h, mesh_)))
+        return false;
+
+      if (is_on_patch_border(hopp))
+      {
+        if (is_on_patch_border(next(hopp, mesh_)) && is_on_patch_border(prev(hopp, mesh_)))
+          return false;
+        else
+          return true;
+      }
+      CGAL_assertion(is_on_mesh(hopp) || is_on_border(hopp));
+      return true;//we already checked we're not pinching a hole in the patch
+    }
+
+    bool is_flip_allowed(const edge_descriptor& e) const
+    {
+      return is_flip_allowed(halfedge(e, mesh_))
+          && is_flip_allowed(opposite(halfedge(e, mesh_), mesh_));
+    }
+
+    bool is_flip_allowed(const halfedge_descriptor& h) const
+    {
+      if (!is_on_patch(h))
+        return false;
+      if (!is_on_patch_border(target(h, mesh_)))
+        return true;
+      if ( is_on_patch_border(next(h, mesh_))
+        && is_on_patch_border(prev(opposite(h, mesh_), mesh_)))
+        return false;
+      return true;
+    }
+
+    halfedge_descriptor next_on_patch_border(const halfedge_descriptor& h) const
+    {
+      CGAL_precondition(is_on_patch_border(h));
+      CGAL_assertion_code(const Patch_id& pid = get_patch_id(face(h, mesh_)));
+
+      halfedge_descriptor end = opposite(h, mesh_);
+      halfedge_descriptor nxt = next(h, mesh_);
+      do
+      {
+        if (is_on_patch_border(nxt))
+        { 
+          CGAL_assertion(get_patch_id(face(nxt, mesh_)) == pid);
+          return nxt;
+        }
+        nxt = next(opposite(nxt, mesh_), mesh_);
+      }
+      while (end != nxt);
+
+      CGAL_assertion(is_on_patch_border(end));
+      CGAL_assertion(get_patch_id(face(nxt, mesh_)) == pid);
+      return end;
+    }
+
+    halfedge_descriptor prev_on_patch_border(const halfedge_descriptor& h) const
+    {
+      CGAL_precondition(is_on_patch_border(h));
+      CGAL_assertion_code(const Patch_id& pid = get_patch_id(face(h, mesh_)));
+
+      halfedge_descriptor end = opposite(h, mesh_);
+      halfedge_descriptor prv = prev(h, mesh_);
+      do
+      {
+        if (is_on_patch_border(prv))
+        {
+          CGAL_assertion(get_patch_id(face(prv, mesh_)) == pid);
+          return prv;
+        }
+        prv = prev(opposite(prv, mesh_), mesh_);
+      }
+      while (end != prv);
+
+      CGAL_assertion(is_on_patch_border(end));
+      CGAL_assertion(get_patch_id(face(prv, mesh_)) == pid);
+      return end;
+    }
+
+    bool collapse_does_not_invert_face(const halfedge_descriptor& h) const
+    {
+      vertex_descriptor vs = source(h, mesh_);
+      vertex_descriptor vt = target(h, mesh_);
+      
+      //backup source point
+      Point ps = get(vpmap_, vs);
+      //move source at target
+      put(vpmap_, vs, get(vpmap_, vt));
+
+      //collect normals to faces around vs AND vt
+      //vertices are at the same location, but connectivity is still be same,
+      //with plenty of degenerate triangles (which are common to both stars)
+      std::vector<Vector_3> normals;
+      BOOST_FOREACH(halfedge_descriptor hd,
+                    halfedges_around_target(h, mesh_))
+      {
+        Vector_3 n = compute_normal(face(hd, mesh_));
+        //n can be 0 in the splitting step because we remove degenerate faces
+        //only at the end of the splitting step
+        if(n != CGAL::NULL_VECTOR)
+          normals.push_back(n);
+      }
+      BOOST_FOREACH(halfedge_descriptor hd,
+                    halfedges_around_target(opposite(h, mesh_), mesh_))
+      {
+        Vector_3 n = compute_normal(face(hd, mesh_));
+        if(n != CGAL::NULL_VECTOR)
+          normals.push_back(n);
+      }
+
+      //check all normals have same orientation
+      bool res = true;
+      for(std::size_t i = 1; i < normals.size(); ++i)/*start at 1 on purpose*/
+      {
+        if (normals[i-1] * normals[i] <= 0.)
+        {
+          res = false;
+          break;
+        }
+      }
+      //restore position
+      put(vpmap_, vs, ps);
+      return res;
+    }
+
+    bool is_constrained(const vertex_descriptor& v) const
+    {
+      return get(vcmap_, v);
+    }
+    void set_constrained(const vertex_descriptor& v, const bool b)
+    {
+      put(vcmap_, v, b);
+    }
+
+    bool is_corner(const vertex_descriptor& v) const
+    {
+      unsigned int nb_incident_features = 0;
+      BOOST_FOREACH(halfedge_descriptor h, halfedges_around_target(v, mesh_))
+      {
+        if (is_on_border(h) || is_on_patch_border(h))
+          ++nb_incident_features;
+        if (nb_incident_features > 2)
+          return true;
+      }
+      return false;
+    }
+
+    Vector_3 compute_normal(const face_descriptor& f) const
+    {
+      halfedge_descriptor hd = halfedge(f, mesh_);
+      typename GeomTraits::Triangle_3
+        tr(get(vpmap_, target(hd, mesh_)),
+           get(vpmap_, target(next(hd, mesh_), mesh_)),
+           get(vpmap_, target(next(next(hd, mesh_), mesh_), mesh_)));
+
+      if (tr.is_degenerate())
+        return CGAL::NULL_VECTOR;
+      else
+        return PMP::compute_face_normal(f, mesh_);
+    }
+
+    template<typename FaceRange>
+    void tag_halfedges_status(const FaceRange& face_range)
+    {
+      //tag MESH,        //h and hopp belong to the mesh, not the patch
+      //tag MESH_BORDER  //h belongs to the mesh, face(hopp, pmesh) == null_face()
+      BOOST_FOREACH(halfedge_descriptor h, halfedges(mesh_))
+      {
+        //being part of the border of the mesh is predominant
+        if (is_border(h, mesh_))
+          set_status(h, MESH_BORDER); //erase previous value if exists
+      }
+
+      //tag PATCH,       //h and hopp belong to the patch to be remeshed
+      BOOST_FOREACH(face_descriptor f, face_range)
+      {
+        BOOST_FOREACH(halfedge_descriptor h,
+                      halfedges_around_face(halfedge(f, mesh_), mesh_))
+        {
+          set_status(h, PATCH);
+        }
+      }
+
+      internal::Border_constraint_pmap<PM, FaceRange> border_map(mesh_, face_range);
+      //override the border of PATCH
+      //tag PATCH_BORDER,//h belongs to the patch, hopp doesn't
+      BOOST_FOREACH(edge_descriptor e, edges(mesh_))
+      {
+        if (get(ecmap_, e)
+          || get(border_map, e)
+          || get_patch_id(face(halfedge(e, mesh_), mesh_))
+              != get_patch_id(face(opposite(halfedge(e, mesh_), mesh_), mesh_)))
+        {
+          //deal with h and hopp for borders that are sharp edges to be preserved
+          halfedge_descriptor h = halfedge(e, mesh_);
+          if (status(h) == PATCH)
+            set_status(h, PATCH_BORDER);
+
+          halfedge_descriptor hopp = opposite(h, mesh_);
+          if (status(hopp) == PATCH)
+            set_status(hopp, PATCH_BORDER);
+        }
+      }
+    }
+
+    Halfedge_status status(const halfedge_descriptor& h) const
+    {
+      typename boost::unordered_map <
+        halfedge_descriptor, Halfedge_status >::const_iterator
+          it = halfedge_status_map_.find(h);
+      if (it == halfedge_status_map_.end())
+        return MESH;
+      return it->second;
+    }
+
+    void set_status(const halfedge_descriptor& h,
+                    const Halfedge_status& s)
+    {
+      if (s == MESH)
+        halfedge_status_map_.erase(h);
+      else
+        halfedge_status_map_[h] = s;
+    }
+
+    void merge_status(const halfedge_descriptor& en,
+                      const Halfedge_status& s_epo,
+                      const Halfedge_status& s_ep)
+    {
+      //get missing data
+      halfedge_descriptor eno = opposite(en, mesh_);
+      Halfedge_status s_eno = status(eno);
+
+      if (s_epo == MESH_BORDER && s_eno == MESH_BORDER)
+        return;
+
+      if(s_epo == MESH_BORDER
+        || s_ep == MESH_BORDER
+        || s_epo == PATCH_BORDER
+        || s_ep == PATCH_BORDER)
+      {
+        set_status(en, s_epo);
+        set_status(eno, s_ep);
+      }
+      // else keep current status for en and eno
+    }
+
+    template<typename Bimap>
+    void fix_degenerate_faces(const vertex_descriptor& v,
+                              Bimap& short_edges,
+                              const double& sq_low)
+    {
+      CGAL_assertion_code(std::size_t nb_done = 0);
+      boost::unordered_set<halfedge_descriptor> degenerate_faces;
+      BOOST_FOREACH(halfedge_descriptor h,
+                    halfedges_around_target(halfedge(v, mesh_), mesh_))
+      {
+        if (is_border(h, mesh_))
+          continue;
+        if (PMP::is_degenerated(h, mesh_, vpmap_, GeomTraits()))
+          degenerate_faces.insert(h);
+      }
+      while(!degenerate_faces.empty())
+      {
+        halfedge_descriptor h = *(degenerate_faces.begin());
+        degenerate_faces.erase(degenerate_faces.begin());
+
+        if (!PMP::is_degenerated(h, mesh_, vpmap_, GeomTraits()))
+          //this can happen when flipping h has consequences further in the mesh
+          continue;
+
+        //check that opposite is not also degenerate
+        if (degenerate_faces.find(opposite(h, mesh_)) != degenerate_faces.end())
+          degenerate_faces.erase(opposite(h, mesh_));
+
+        if(is_border(h, mesh_))
+          continue;
+
+        BOOST_FOREACH(halfedge_descriptor hf,
+                      halfedges_around_face(h, mesh_))
+        {
+          vertex_descriptor vc = target(hf, mesh_);
+          vertex_descriptor va = target(next(hf, mesh_), mesh_);
+          vertex_descriptor vb = target(next(next(hf, mesh_), mesh_), mesh_);
+          Vector_3 ab(get(vpmap_,va), get(vpmap_,vb));
+          Vector_3 ac(get(vpmap_,va), get(vpmap_,vc));
+          if (ab * ac < 0)
+          {
+            halfedge_descriptor hfo = opposite(hf, mesh_);
+            halfedge_descriptor h_ab = prev(hf, mesh_);
+            halfedge_descriptor h_ca = next(hf, mesh_);
+
+            short_edges.left.erase(hf);
+            short_edges.left.erase(hfo);
+
+            CGAL::Euler::flip_edge(hf, mesh_);
+            CGAL_assertion_code(++nb_done);
+
+            //update halfedge_status_map_
+            set_status(h_ab, merge_status(h_ab, hf, hfo));
+            set_status(h_ca, merge_status(h_ca, hf, hfo));
+            if (is_on_patch(h_ca) || is_on_patch_border(h_ca))
+            {
+              set_status(hf, PATCH);
+              set_status(hfo, PATCH);
+            }
+#ifdef CGAL_PMP_REMESHING_DEBUG
+            debug_status_map();
+#endif
+
+            //insert new edges in 'short_edges'
+            if (is_collapse_allowed(edge(hf, mesh_)))
+            {
+              double sqlen = sqlength(hf);
+              if (sqlen < sq_low)
+                short_edges.insert(typename Bimap::value_type(hf, sqlen));
+            }
+
+            if (!is_border(hf, mesh_)
+              && PMP::is_degenerated(hf, mesh_, vpmap_, GeomTraits()))
+              degenerate_faces.insert(hf);
+            if (!is_border(hfo, mesh_)
+              && PMP::is_degenerated(hfo, mesh_, vpmap_, GeomTraits()))
+              degenerate_faces.insert(hfo);
+
+            break;
+          }
+        }
+      }
+#ifdef CGAL_PMP_REMESHING_DEBUG
+      debug_status_map();
+#endif
+    }
+
+    bool incident_to_degenerate(const halfedge_descriptor& he)
+    {
+      BOOST_FOREACH(halfedge_descriptor h,
+                    halfedges_around_target(he, mesh_))
+      {
+        if (is_border(h, mesh_))
+          continue;
+        if (PMP::is_degenerated(h, mesh_, vpmap_, GeomTraits()))
+          return true;
+      }
+      return false;
+    }
+
+    Halfedge_status merge_status(const halfedge_descriptor& h1,
+      const halfedge_descriptor& h2,
+      const halfedge_descriptor& h3)
+    {
+      Halfedge_status s1 = status(h1);
+      if (s1 == MESH_BORDER) return s1;
+      Halfedge_status s2 = status(h2);
+      if (s2 == MESH_BORDER) return s2;
+      Halfedge_status s3 = status(h3);
+      if (s3 == MESH_BORDER) return s3;
+      else if (s1 == PATCH_BORDER) return s1;
+      else if (s2 == PATCH_BORDER) return s2;
+      else if (s3 == PATCH_BORDER) return s3;
+
+      CGAL_assertion(s1 == s2 && s1 == s3);
+      return s1;
+    }
+
+    bool is_on_patch(const halfedge_descriptor& h) const
+    {
+      bool res =(status(h) == PATCH);
+      CGAL_assertion(res == (status(opposite(h, mesh_)) == PATCH));
+      return res;
+    }
+
+    bool is_on_patch(const face_descriptor& f) const
+    {
+      BOOST_FOREACH(halfedge_descriptor h,
+                    halfedges_around_face(halfedge(f, mesh_), mesh_))
+      {
+        if (is_on_patch(h) || is_on_patch_border(h))
+          return true;
+      }
+      return false;
+    }
+
+    bool is_on_patch(const vertex_descriptor& v) const
+    {
+      BOOST_FOREACH(halfedge_descriptor h,
+                    halfedges_around_target(v, mesh_))
+      {
+        if (!is_on_patch(h))
+          return false;
+      }
+      return true;
+    }
+
+public:
+    bool is_on_patch_border(const halfedge_descriptor& h) const
+    {
+      bool res = (status(h) == PATCH_BORDER);
+      if (res)
+      {
+        CGAL_assertion_code(Halfedge_status hs = status(opposite(h, mesh_)));
+        CGAL_assertion(hs == MESH_BORDER
+                    || hs == MESH
+                    || hs == PATCH_BORDER);//when 2 incident patches are remeshed
+      }
+      return res;
+    }
+    bool is_on_patch_border(const edge_descriptor& e) const
+    {
+      return is_on_patch_border(halfedge(e,mesh_))
+          || is_on_patch_border(opposite(halfedge(e, mesh_), mesh_));
+    }
+    bool is_on_patch_border(const vertex_descriptor& v) const
+    {
+      BOOST_FOREACH(halfedge_descriptor h, halfedges_around_target(v, mesh_))
+      {
+        if (is_on_patch_border(h) || is_on_patch_border(opposite(h, mesh_)))
+          return true;
+      }
+      return false;
+    }
+
+    bool is_on_border(const halfedge_descriptor& h) const
+    {
+      bool res = (status(h) == MESH_BORDER);
+      CGAL_assertion(res == is_border(h, mesh_));
+      CGAL_assertion(res == is_border(next(h, mesh_), mesh_));
+      return res;
+    }
+
+    bool is_on_border(const edge_descriptor& e) const
+    {
+      return is_on_border(halfedge(e, mesh_))
+          || is_on_border(opposite(halfedge(e, mesh_), mesh_));
+    }
+
+    bool is_on_mesh(const halfedge_descriptor& h) const
+    {
+      return status(h) == MESH;
+    }
+
+private:
+    void halfedge_added(const halfedge_descriptor& h,
+                        const Halfedge_status& s)
+    {
+      halfedge_status_map_.insert(std::make_pair(h, s));
+    }
+
+    void halfedge_and_opp_removed(const halfedge_descriptor& h)
+    {
+      halfedge_status_map_.erase(h);
+      halfedge_status_map_.erase(opposite(h, mesh_));
+    }
+
+    std::size_t nb_valid_halfedges() const
+    {
+      return static_cast<std::size_t>(
+        std::distance(halfedges(mesh_).first, halfedges(mesh_).second));
+    }
+
+    void debug_status_map() const
+    {
+      unsigned int nb_border = 0;
+      unsigned int nb_mesh = 0;
+      unsigned int nb_patch = 0;
+      unsigned int nb_patch_border = 0;
+
+      typedef typename boost::unordered_map <
+        halfedge_descriptor, Halfedge_status>::value_type
+          HD_pair;
+      BOOST_FOREACH(const HD_pair& hs, halfedge_status_map_)
+      {
+        if(is_on_patch(hs.first))              nb_patch++;
+        else if(is_on_patch_border(hs.first))  nb_patch_border++;
+        else if(is_on_mesh(hs.first))          nb_mesh++;
+        else if(is_on_border(hs.first))        nb_border++;
+        else CGAL_assertion(false);
+      }
+    }
+
+#ifdef CGAL_PMP_REMESHING_DEBUG
+    void debug_self_intersections() const
+    {
+      std::cout << "Test self intersections...";
+      std::vector<std::pair<face_descriptor, face_descriptor> > facets;
+      PMP::self_intersections(
+        mesh_,
+        std::back_inserter(facets),
+        PMP::parameters::vertex_point_map(vpmap_));
+      //CGAL_assertion(facets.empty());
+      std::cout << "done ("<< facets.size() <<" facets)." << std::endl;
+    }
+
+    void debug_self_intersections(const vertex_descriptor& v) const
+    {
+      std::cout << "Test self intersections...";
+      std::vector<std::pair<face_descriptor, face_descriptor> > facets;
+      PMP::self_intersections(
+        faces_around_target(halfedge(v, mesh_), mesh_),
+        mesh_,
+        std::back_inserter(facets),
+        PMP::parameters::vertex_point_map(vpmap_));
+      //CGAL_assertion(facets.empty());
+      std::cout << "done ("<< facets.size() <<" facets)." << std::endl;
+    }
+#endif
+
+    //warning : when v is on a sharp edge (angle <= 90 deg)
+    // which is not constrained (it's not mandatory)
+    //this test will return false, though normals are correct
+    bool check_normals(const vertex_descriptor& v) const
+    {
+      if (!is_on_patch(v))
+        return true;//not much to say if we are on a boundary/sharp edge
+
+      std::vector<Vector_3> normals;
+      BOOST_FOREACH(halfedge_descriptor hd,
+                    halfedges_around_target(halfedge(v, mesh_), mesh_))
+      {
+        Vector_3 n = compute_normal(face(hd, mesh_));
+        normals.push_back(n);
+        CGAL_assertion(n != CGAL::NULL_VECTOR);
+      }
+      //check all normals have same orientation
+      for (std::size_t i = 1; i < normals.size(); ++i)/*start at 1 on purpose*/
+      {
+        double dot = to_double(normals[i - 1] * normals[i]);
+        if(dot <= 0.)
+          return false;
+      }
+      return true;
+    }
+
+    bool check_normals(const halfedge_descriptor& h) const
+    {
+      if (!is_on_patch(h))
+        return true;//nothing to say
+      Vector_3 n = compute_normal(face(h, mesh_));
+      Vector_3 no = compute_normal(face(opposite(h, mesh_), mesh_));
+      return n * no > 0.;
+    }
+
+  public:
+    const Triangle_list& input_triangles() const {
+      return input_triangles_;
+    }
+
+    const Patch_id_list& input_patch_ids() const {
+      return input_patch_ids_;
+    }
+
+    void update_constraints_property_map()
+    {
+      BOOST_FOREACH(edge_descriptor e, edges(mesh_))
+      {
+        if (is_on_patch_border(halfedge(e, mesh_))
+          || is_on_patch_border(opposite(halfedge(e, mesh_), mesh_)))
+          put(ecmap_, e, true);
+        else
+          put(ecmap_, e, false);
+      }
+    }
+
+  private:
+    PolygonMesh& mesh_;
+    VertexPointMap& vpmap_;
+    const AABB_tree* tree_ptr_;
+    bool own_tree_;
+    Triangle_list input_triangles_;
+    Patch_id_list input_patch_ids_;
+    boost::unordered_map<halfedge_descriptor, Halfedge_status> halfedge_status_map_;
+    bool protect_constraints_;
+    FacePatchMap patch_ids_map_;
+    EdgeIsConstrainedMap ecmap_;
+    VertexIsConstrainedMap vcmap_;
+
+  };//end class Incremental_remesher
+}//end namespace internal
+}//end namespace Polygon_mesh_processing
+}//end namespace CGAL
+
+#endif //CGAL_POLYGON_MESH_PROCESSING_REMESH_IMPL_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/internal/Polygon_mesh_slicer/Axis_parallel_plane_traits.h b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/internal/Polygon_mesh_slicer/Axis_parallel_plane_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/internal/Polygon_mesh_slicer/Axis_parallel_plane_traits.h
rename to 3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/internal/Polygon_mesh_slicer/Axis_parallel_plane_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/internal/Polygon_mesh_slicer/Traversal_traits.h b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/internal/Polygon_mesh_slicer/Traversal_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/internal/Polygon_mesh_slicer/Traversal_traits.h
rename to 3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/internal/Polygon_mesh_slicer/Traversal_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/internal/Side_of_triangle_mesh/AABB_triangle_accessor_3_primitive.h b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/internal/Side_of_triangle_mesh/AABB_triangle_accessor_3_primitive.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/internal/Side_of_triangle_mesh/AABB_triangle_accessor_3_primitive.h
rename to 3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/internal/Side_of_triangle_mesh/AABB_triangle_accessor_3_primitive.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/internal/Side_of_triangle_mesh/Point_inside_vertical_ray_cast.h b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/internal/Side_of_triangle_mesh/Point_inside_vertical_ray_cast.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/internal/Side_of_triangle_mesh/Point_inside_vertical_ray_cast.h
rename to 3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/internal/Side_of_triangle_mesh/Point_inside_vertical_ray_cast.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/internal/Side_of_triangle_mesh/Ray_3_Triangle_3_traversal_traits.h b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/internal/Side_of_triangle_mesh/Ray_3_Triangle_3_traversal_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/internal/Side_of_triangle_mesh/Ray_3_Triangle_3_traversal_traits.h
rename to 3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/internal/Side_of_triangle_mesh/Ray_3_Triangle_3_traversal_traits.h
diff --git a/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/internal/fair_impl.h b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/internal/fair_impl.h
new file mode 100644
index 0000000..bb2e8b2
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/internal/fair_impl.h
@@ -0,0 +1,203 @@
+// Copyright (c) 2015 GeometryFactory (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Jane Tournois
+
+#ifndef CGAL_POLYGON_MESH_PROCESSING_FAIR_POLYHEDRON_3_H
+#define CGAL_POLYGON_MESH_PROCESSING_FAIR_POLYHEDRON_3_H
+
+#include <map>
+#include <set>
+#include <CGAL/assertions.h>
+#include <CGAL/Polygon_mesh_processing/Weights.h>
+#include <CGAL/Timer.h>
+#include <CGAL/trace.h>
+#include <iterator>
+
+namespace CGAL {
+
+namespace Polygon_mesh_processing {
+
+namespace internal {
+
+// [On Linear Variational Surface Deformation Methods-2008]
+template<class PolygonMesh,
+         class SparseLinearSolver,
+         class WeightCalculator,
+         class VertexPointMap>
+class Fair_Polyhedron_3 {
+  // typedefs
+  typedef typename VertexPointMap::value_type Point_3;
+  typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
+  typedef  Halfedge_around_target_circulator<PolygonMesh>  Halfedge_around_vertex_circulator;
+
+  typedef SparseLinearSolver Sparse_linear_solver;
+  typedef typename Sparse_linear_solver::Matrix Solver_matrix;
+  typedef typename Sparse_linear_solver::Vector Solver_vector;
+
+// members
+  PolygonMesh& pmesh;
+  WeightCalculator weight_calculator;
+  VertexPointMap ppmap;
+
+public:
+  Fair_Polyhedron_3(PolygonMesh& pmesh
+      , VertexPointMap vpmap
+      , WeightCalculator weight_calculator)
+    : pmesh(pmesh)
+    , weight_calculator(weight_calculator)
+    , ppmap(vpmap)
+  { }
+  
+private:
+  double sum_weight(vertex_descriptor v) {
+  double weight = 0;
+  Halfedge_around_vertex_circulator circ(halfedge(v,pmesh),pmesh), done(circ);
+  do {
+    weight += weight_calculator.w_ij(*circ);
+    } while(++circ != done);
+    return weight;
+  }
+
+  // recursively computes a row (use depth parameter to compute L, L^2, L^3)
+  // Equation 6 in [On Linear Variational Surface Deformation Methods]
+  void compute_row(
+    vertex_descriptor v,
+    int row_id,                            // which row to insert in [ frees stay left-hand side ]
+    Solver_matrix& matrix, 
+    double& x, double& y, double& z,               // constants transfered to right-hand side
+    double multiplier,
+    const std::map<vertex_descriptor, std::size_t>& vertex_id_map,
+    unsigned int depth)
+  {
+    if(depth == 0) {
+      typename std::map<vertex_descriptor, std::size_t>::const_iterator vertex_id_it = vertex_id_map.find(v);
+      if(vertex_id_it != vertex_id_map.end()) {
+        int col_id = static_cast<int>(vertex_id_it->second);
+        matrix.add_coef(row_id, col_id, multiplier);
+      }
+      else { 
+        typename boost::property_traits<VertexPointMap>::reference p = ppmap[v];
+        x += multiplier * - to_double(p.x());
+        y += multiplier * - to_double(p.y());
+        z += multiplier * - to_double(p.z());
+      }
+    }
+    else {
+      double w_i = weight_calculator.w_i(v);
+
+      Halfedge_around_vertex_circulator circ(halfedge(v,pmesh),pmesh), done(circ);
+      do {
+        double w_i_w_ij = w_i * weight_calculator.w_ij(*circ) ;
+
+        vertex_descriptor nv = target(opposite(*circ,pmesh),pmesh);
+        compute_row(nv, row_id, matrix, x, y, z, -w_i_w_ij*multiplier, vertex_id_map, depth-1);
+      } while(++circ != done);
+
+      double w_i_w_ij_sum = w_i * sum_weight(v);
+      compute_row(v, row_id, matrix, x, y, z, w_i_w_ij_sum*multiplier, vertex_id_map, depth-1);
+    }
+  }
+
+public:
+  template<class VertexRange>
+  bool fair(const VertexRange& vertices
+    , SparseLinearSolver solver
+    , unsigned int fc)
+  {
+    int depth = static_cast<int>(fc) + 1;
+    if(depth < 0 || depth > 3) {
+      CGAL_warning(!"Continuity should be between 0 and 2 inclusively!");
+      return false; 
+    }
+
+    std::set<vertex_descriptor> interior_vertices(boost::begin(vertices),
+                                                  boost::end(vertices));
+    if(interior_vertices.empty()) { return true; }
+
+    CGAL::Timer timer; timer.start();
+    const std::size_t nb_vertices = interior_vertices.size();
+    Solver_vector X(nb_vertices), Bx(nb_vertices);
+    Solver_vector Y(nb_vertices), By(nb_vertices);
+    Solver_vector Z(nb_vertices), Bz(nb_vertices);
+
+    std::map<vertex_descriptor, std::size_t> vertex_id_map;
+    std::size_t id = 0;
+    BOOST_FOREACH(vertex_descriptor vd, interior_vertices)
+    {
+      if( !vertex_id_map.insert(std::make_pair(vd, id)).second ) {
+        CGAL_warning(!"Duplicate vertex is found!");
+        return false;
+      }
+      ++id;
+    }
+
+    Solver_matrix A(nb_vertices);
+
+    BOOST_FOREACH(vertex_descriptor vd, interior_vertices)
+    {
+      int v_id = static_cast<int>(vertex_id_map[vd]);
+      compute_row(vd, v_id, A, Bx[v_id], By[v_id], Bz[v_id], 1, vertex_id_map, depth);
+    }
+    CGAL_TRACE_STREAM << "**Timer** System construction: " << timer.time() << std::endl; timer.reset();
+
+    // factorize
+    double D;
+    bool prefactor_ok = solver.factor(A, D);
+    if(!prefactor_ok) {
+      CGAL_warning(!"pre_factor failed!");
+      return false;
+    }
+    CGAL_TRACE_STREAM << "**Timer** System factorization: " << timer.time() << std::endl; timer.reset();
+
+    // solve
+    bool is_all_solved = solver.linear_solver(Bx, X) && solver.linear_solver(By, Y) && solver.linear_solver(Bz, Z);
+    if(!is_all_solved) {
+      CGAL_warning(!"linear_solver failed!"); 
+      return false; 
+    }
+    CGAL_TRACE_STREAM << "**Timer** System solver: " << timer.time() << std::endl; timer.reset();
+
+    
+    /* This relative error is to large for cases that the results are not good */ 
+    /*
+    double rel_err_x = (A.eigen_object()*X - Bx).norm() / Bx.norm();
+    double rel_err_y = (A.eigen_object()*Y - By).norm() / By.norm();
+    double rel_err_z = (A.eigen_object()*Z - Bz).norm() / Bz.norm();
+    CGAL_TRACE_STREAM << "rel error: " << rel_err_x 
+                                << " " << rel_err_y
+                                << " " << rel_err_z << std::endl;
+                                */
+
+    // update 
+    id = 0;
+    BOOST_FOREACH(vertex_descriptor vd, interior_vertices)
+    {
+      put(ppmap, vd, Point_3(X[id], Y[id], Z[id]));
+      ++id;
+    }
+    return true;
+  }
+};
+
+}//namespace internal
+
+}//namespace Polygon_mesh_processing
+
+}//namespace CGAL
+#endif //CGAL_POLYGON_MESH_PROCESSING_FAIR_POLYHEDRON_3_H
diff --git a/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/internal/named_function_params.h b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/internal/named_function_params.h
new file mode 100644
index 0000000..6695d9e
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/internal/named_function_params.h
@@ -0,0 +1,423 @@
+// Copyright (c) 2015 GeometryFactory (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Jane Tournois
+
+#ifndef CGAL_PMP_BGL_NAMED_FUNCTION_PARAMS_H
+#define CGAL_PMP_BGL_NAMED_FUNCTION_PARAMS_H
+
+#include <CGAL/boost/graph/named_function_params.h>
+
+#define CGAL_PMP_NP_TEMPLATE_PARAMETERS T, typename Tag, typename Base
+#define CGAL_PMP_NP_CLASS CGAL::pmp_bgl_named_params<T,Tag,Base>
+
+namespace CGAL{
+
+  enum density_control_factor_t     { density_control_factor      };
+  enum use_delaunay_triangulation_t { use_delaunay_triangulation  };
+  enum fairing_continuity_t         { fairing_continuity };
+  enum sparse_linear_solver_t       { sparse_linear_solver };
+  enum geom_traits_t                { geom_traits };
+  enum number_of_iterations_t       { number_of_iterations };
+  enum number_of_relaxation_steps_t { number_of_relaxation_steps };
+  enum protect_constraints_t        { protect_constraints };
+  enum relax_constraints_t          { relax_constraints };
+  enum vertex_is_constrained_t      { vertex_is_constrained };
+  enum face_patch_t                 { face_patch };
+
+  //to be documented
+  enum face_normal_t                { face_normal };
+
+  //internal
+  enum weight_calculator_t          { weight_calculator };
+  enum all_default_t                { all_default };
+
+  struct named_params_base {};
+
+  template <typename T, typename Tag, typename Base = boost::no_property>
+  struct pmp_bgl_named_params
+    : CGAL::cgal_bgl_named_params<T, Tag, Base>
+    , CGAL::named_params_base
+  {
+    typedef CGAL::cgal_bgl_named_params<T, Tag, Base> base;
+    typedef pmp_bgl_named_params self;
+
+    pmp_bgl_named_params(T v = T()) : base(v) {}
+    pmp_bgl_named_params(T v, const Base& b) : base(v, b) {}
+
+    pmp_bgl_named_params<bool, all_default_t, self>
+    all_default() const
+    {
+      typedef pmp_bgl_named_params<bool, all_default_t, self> Params;
+      return Params(*this);
+    }
+
+    template <typename Double>
+    pmp_bgl_named_params<Double, density_control_factor_t, self>
+    density_control_factor(const Double& d) const
+    {
+      typedef pmp_bgl_named_params<Double, density_control_factor_t, self> Params;
+      return Params(d, *this);
+    }
+
+    template <typename Boolean>
+    pmp_bgl_named_params<Boolean, use_delaunay_triangulation_t, self>
+    use_delaunay_triangulation(const Boolean b) const
+    {
+      typedef pmp_bgl_named_params<Boolean, use_delaunay_triangulation_t, self> Params;
+      return Params(b, *this);
+    }
+
+    template <typename UnsignedInt>
+    pmp_bgl_named_params<UnsignedInt, fairing_continuity_t, self>
+    fairing_continuity(const UnsignedInt& ui) const
+    {
+      typedef pmp_bgl_named_params<UnsignedInt, fairing_continuity_t, self> Params;
+      return Params(ui, *this);
+    }
+
+    template<typename Solver>
+    pmp_bgl_named_params<Solver, sparse_linear_solver_t, self>
+    sparse_linear_solver(const Solver& s) const
+    {
+      typedef pmp_bgl_named_params<Solver, sparse_linear_solver_t, self> Params;
+      return Params(s, *this);
+    }
+
+    template<typename WeightCalc>
+    pmp_bgl_named_params<WeightCalc, weight_calculator_t, self>
+    weight_calculator(const WeightCalc& w) const
+    {
+      typedef pmp_bgl_named_params<WeightCalc, weight_calculator_t, self> Params;
+      return Params(w, *this);
+    }
+
+    template <typename FaceNormalMap>
+    pmp_bgl_named_params<FaceNormalMap, face_normal_t, self>
+    face_normal_map(const FaceNormalMap& m) const
+    {
+      typedef pmp_bgl_named_params<FaceNormalMap, face_normal_t, self> Params;
+      return Params(m, *this);
+    }
+
+    //overload
+    template <typename PointMap>
+    pmp_bgl_named_params<PointMap, boost::vertex_point_t, self>
+    vertex_point_map(const PointMap& p) const
+    {
+      typedef pmp_bgl_named_params<PointMap, boost::vertex_point_t, self> Params;
+      return Params(p, *this);
+    }
+
+    template<typename K>
+    pmp_bgl_named_params<K, geom_traits_t, self>
+    geom_traits(const K& k) const
+    {
+      typedef pmp_bgl_named_params<K, geom_traits_t, self> Params;
+      return Params(k, *this);
+    }
+
+    template<typename NT>
+    pmp_bgl_named_params<NT, number_of_iterations_t, self>
+    number_of_iterations(const NT& n) const
+    {
+      typedef pmp_bgl_named_params<NT, number_of_iterations_t, self> Params;
+      return Params(n, *this);
+    }
+
+    template<typename NT>
+    pmp_bgl_named_params<NT, number_of_relaxation_steps_t, self>
+    number_of_relaxation_steps(const NT& n) const
+    {
+      typedef pmp_bgl_named_params<NT, number_of_relaxation_steps_t, self> Params;
+      return Params(n, *this);
+    }
+
+    template<typename Boolean>
+    pmp_bgl_named_params<Boolean, protect_constraints_t, self>
+    protect_constraints(const Boolean b) const
+    {
+      typedef pmp_bgl_named_params<Boolean, protect_constraints_t, self> Params;
+      return Params(b, *this);
+    }
+
+    template<typename Boolean>
+    pmp_bgl_named_params<Boolean, relax_constraints_t, self>
+    relax_constraints(const Boolean b) const
+    {
+      typedef pmp_bgl_named_params<Boolean, relax_constraints_t, self> Params;
+      return Params(b, *this);
+    }
+
+    template <typename VertexIsConstrained>
+    pmp_bgl_named_params<VertexIsConstrained, vertex_is_constrained_t, self>
+    vertex_is_constrained_map(const VertexIsConstrained& vm) const
+    {
+      typedef pmp_bgl_named_params<VertexIsConstrained, vertex_is_constrained_t, self> Params;
+      return Params(vm, *this);
+    }
+
+    template <typename FacetPatch>
+    pmp_bgl_named_params<FacetPatch, face_patch_t, self>
+    face_patch_map(const FacetPatch& fp) const
+    {
+      typedef pmp_bgl_named_params<FacetPatch, face_patch_t, self> Params;
+      return Params(fp, *this);
+    }
+
+    //overload
+    template <typename EdgeIsConstrained>
+    pmp_bgl_named_params<EdgeIsConstrained, edge_is_constrained_t, self>
+    edge_is_constrained_map(const EdgeIsConstrained& em) const
+    {
+      typedef pmp_bgl_named_params<EdgeIsConstrained, edge_is_constrained_t, self> Params;
+      return Params(em, *this);
+    }
+
+    template <typename EdgeIsConstrainedParams>
+    pmp_bgl_named_params<EdgeIsConstrainedParams, edge_is_constrained_params_t, self>
+    edge_is_constrained_map_params(const EdgeIsConstrainedParams& em) const
+    {
+      typedef pmp_bgl_named_params<EdgeIsConstrainedParams,
+                                   edge_is_constrained_params_t, self> Params;
+      return Params(em, *this);
+    }
+
+    //overload
+    template <typename IndexMap>
+    pmp_bgl_named_params<IndexMap, boost::face_index_t, self>
+    face_index_map(const IndexMap& p) const
+    {
+      typedef pmp_bgl_named_params<IndexMap, boost::face_index_t, self> Params;
+      return Params(p, *this);
+    }
+
+    //overload
+    template <typename IndexMap>
+    pmp_bgl_named_params<IndexMap, boost::vertex_index_t, self>
+    vertex_index_map(const IndexMap& p) const
+    {
+      typedef pmp_bgl_named_params<IndexMap, boost::vertex_index_t, self> Params;
+      return Params(p, *this);
+    }
+
+  };
+
+namespace Polygon_mesh_processing{
+
+namespace parameters{
+
+  pmp_bgl_named_params<bool, all_default_t>
+  inline all_default()
+  {
+    typedef pmp_bgl_named_params<bool, all_default_t> Params;
+    return Params();
+  }
+
+  template <typename Double>
+  pmp_bgl_named_params<Double, density_control_factor_t>
+  density_control_factor(const Double& d)
+  {
+    typedef pmp_bgl_named_params<Double, density_control_factor_t> Params;
+    return Params(d);
+  }
+
+  template <typename Boolean>
+  pmp_bgl_named_params<Boolean, use_delaunay_triangulation_t>
+  use_delaunay_triangulation(const Boolean b)
+  {
+    typedef pmp_bgl_named_params<Boolean, use_delaunay_triangulation_t> Params;
+    return Params(b);
+  }
+
+  template <typename UnsignedInt>
+  pmp_bgl_named_params<UnsignedInt, fairing_continuity_t>
+  fairing_continuity(const UnsignedInt& ui)
+  {
+    typedef pmp_bgl_named_params<UnsignedInt, fairing_continuity_t> Params;
+    return Params(ui);
+  }
+
+  template<typename Solver>
+  pmp_bgl_named_params<Solver, sparse_linear_solver_t>
+  sparse_linear_solver(const Solver& s)
+  {
+    typedef pmp_bgl_named_params<Solver, sparse_linear_solver_t> Params;
+    return Params(s);
+  }
+
+  template<typename WeightCalc>
+  pmp_bgl_named_params<WeightCalc, weight_calculator_t>
+  weight_calculator(const WeightCalc& w)
+  {
+    typedef pmp_bgl_named_params<WeightCalc, weight_calculator_t> Params;
+    return Params(w);
+  }
+
+  template <typename FaceNormalMap>
+  pmp_bgl_named_params<FaceNormalMap, face_normal_t>
+  face_normal_map(const FaceNormalMap& m)
+  {
+    typedef pmp_bgl_named_params<FaceNormalMap, face_normal_t> Params;
+    return Params(m);
+  }
+
+  //overload
+  template <typename PointMap>
+  pmp_bgl_named_params<PointMap, boost::vertex_point_t>
+  vertex_point_map(const PointMap& p)
+  {
+    typedef pmp_bgl_named_params<PointMap, boost::vertex_point_t> Params;
+    return Params(p);
+  }
+
+  template<typename K>
+  pmp_bgl_named_params<K, geom_traits_t>
+  geom_traits(const K& k)
+  {
+    typedef pmp_bgl_named_params<K, geom_traits_t> Params;
+    return Params(k);
+  }
+
+  template<typename NT>
+  pmp_bgl_named_params<NT, number_of_iterations_t>
+    number_of_iterations(const NT& n)
+  {
+    typedef pmp_bgl_named_params<NT, number_of_iterations_t> Params;
+    return Params(n);
+  }
+
+  template<typename NT>
+  pmp_bgl_named_params<NT, number_of_relaxation_steps_t>
+  number_of_relaxation_steps(const NT& n)
+  {
+    typedef pmp_bgl_named_params<NT, number_of_relaxation_steps_t> Params;
+    return Params(n);
+  }
+
+  template <typename Boolean>
+  pmp_bgl_named_params<Boolean, protect_constraints_t>
+  protect_constraints(const Boolean b)
+  {
+    typedef pmp_bgl_named_params<Boolean, protect_constraints_t> Params;
+    return Params(b);
+  }
+
+  template<typename Boolean>
+  pmp_bgl_named_params<Boolean, relax_constraints_t>
+  relax_constraints(const Boolean b)
+  {
+    typedef pmp_bgl_named_params<Boolean, relax_constraints_t> Params;
+    return Params(b);
+  }
+
+  template <typename VertexIsConstrained>
+  pmp_bgl_named_params<VertexIsConstrained, vertex_is_constrained_t>
+  vertex_is_constrained_map(const VertexIsConstrained& vm)
+  {
+    typedef pmp_bgl_named_params<VertexIsConstrained, vertex_is_constrained_t> Params;
+    return Params(vm);
+  }
+
+  template <typename FacetPatch>
+  pmp_bgl_named_params<FacetPatch, face_patch_t>
+  face_patch_map(const FacetPatch& fp)
+  {
+    typedef pmp_bgl_named_params<FacetPatch, face_patch_t> Params;
+    return Params(fp);
+  }
+
+  //overload
+  template <typename EdgeIsConstrained>
+  pmp_bgl_named_params<EdgeIsConstrained, edge_is_constrained_t>
+  edge_is_constrained_map(const EdgeIsConstrained& em)
+  {
+    typedef pmp_bgl_named_params<EdgeIsConstrained, edge_is_constrained_t> Params;
+    return Params(em);
+  }
+
+  //overload
+  template <typename EdgeIsConstrainedParams>
+  pmp_bgl_named_params<EdgeIsConstrainedParams, edge_is_constrained_params_t>
+  edge_is_constrained_map_params(const EdgeIsConstrainedParams& em)
+  {
+    typedef pmp_bgl_named_params<EdgeIsConstrainedParams,
+                                 edge_is_constrained_params_t> Params;
+    return Params(em);
+  }
+
+  //overload
+  template <typename IndexMap>
+  pmp_bgl_named_params<IndexMap, boost::face_index_t>
+  face_index_map(IndexMap const& p)
+  {
+    typedef pmp_bgl_named_params<IndexMap, boost::face_index_t> Params;
+    return Params(p);
+  }
+
+  //overload
+  template <typename IndexMap>
+  pmp_bgl_named_params<IndexMap, boost::vertex_index_t>
+  vertex_index_map(const IndexMap& p)
+  {
+    typedef pmp_bgl_named_params<IndexMap, boost::vertex_index_t> Params;
+    return Params(p);
+  }
+
+} //namespace parameters
+} //namespace Polygon_mesh_processing
+
+#if BOOST_VERSION < 105100
+  template <class Tag1, class Tag2, class T1, class Base>
+  inline
+  typename boost::property_value< pmp_bgl_named_params<T1,Tag1,Base>, Tag2>::type
+  get_param(const pmp_bgl_named_params<T1,Tag1,Base>& p, Tag2 tag2)
+  {
+    enum { match = boost::detail::same_property<Tag1,Tag2>::value };
+    typedef typename
+      boost::property_value< pmp_bgl_named_params<T1,Tag1,Base>, Tag2>::type T2;
+    T2* t2 = 0;
+    typedef boost::detail::property_value_dispatch<match> Dispatcher;
+    return Dispatcher::const_get_value(p, t2, tag2);
+  }
+#endif
+
+} //namespace CGAL
+
+// partial specializations hate inheritance and we need to repeat
+// those here. this is rather fragile.
+namespace boost {
+  template <typename T, typename Tag, typename Base, typename Def>
+  struct lookup_named_param_def<Tag, CGAL::pmp_bgl_named_params<T, Tag, Base>, Def> {
+    typedef T type;
+    static const type& get(const bgl_named_params<T, Tag, Base>& p, const Def&) {
+      return p.m_value;
+    }
+  };
+
+  template <typename Tag1, typename T, typename Tag, typename Base, typename Def>
+  struct lookup_named_param_def<Tag1, CGAL::pmp_bgl_named_params<T, Tag, Base>, Def> {
+    typedef typename lookup_named_param_def<Tag1, Base, Def>::type type;
+    static const type& get(const bgl_named_params<T, Tag, Base>& p, const Def& def) {
+      return lookup_named_param_def<Tag1, Base, Def>::get(p.m_base, def);
+    }
+  };
+} // boost
+
+
+#endif //CGAL_PMP_BGL_NAMED_FUNCTION_PARAMS_H
diff --git a/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/internal/named_params_helper.h b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/internal/named_params_helper.h
new file mode 100644
index 0000000..0abff9f
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/internal/named_params_helper.h
@@ -0,0 +1,141 @@
+// Copyright (c) 2015 GeometryFactory (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Jane Tournois
+
+#ifndef CGAL_NAMED_PARAMETERS_HELPERS_H
+#define CGAL_NAMED_PARAMETERS_HELPERS_H
+
+#include <CGAL/Kernel_traits.h>
+#include <CGAL/Polygon_mesh_processing/internal/named_function_params.h>
+
+#include <CGAL/property_map.h>
+
+// shortcut for accessing the value type of the property map
+template <class Graph, class Property>
+class property_map_value {
+  typedef typename boost::property_map<Graph, Property>::const_type PMap;
+public:
+  typedef typename boost::property_traits<PMap>::value_type type;
+};
+
+template<typename PolygonMesh>
+class GetK
+{
+  typedef typename property_map_value<PolygonMesh,
+    boost::vertex_point_t>::type
+    Point;
+public:
+  typedef typename CGAL::Kernel_traits<Point>::Kernel Kernel;
+};
+
+template<typename PolygonMesh, typename NamedParameters>
+class GetGeomTraits
+{
+  typedef typename GetK<PolygonMesh>::Kernel DefaultKernel;
+public:
+  typedef typename boost::lookup_named_param_def <
+    CGAL::geom_traits_t,
+    NamedParameters,
+    DefaultKernel
+  > ::type  type;
+};
+
+template<typename PolygonMesh, typename NamedParameters>
+class GetVertexPointMap
+{
+  typedef typename boost::property_map<PolygonMesh, boost::vertex_point_t>::const_type
+    DefaultVPMap_const;
+  typedef typename boost::property_map<PolygonMesh, boost::vertex_point_t>::type
+    DefaultVPMap;
+public:
+  typedef typename boost::lookup_named_param_def<
+    boost::vertex_point_t,
+    NamedParameters,
+    DefaultVPMap
+  > ::type  type;
+  typedef typename boost::lookup_named_param_def<
+    boost::vertex_point_t,
+    NamedParameters,
+    DefaultVPMap_const
+  > ::type  const_type;
+};
+
+template<typename PolygonMesh, typename NamedParameters>
+class GetFaceIndexMap
+{
+  typedef typename boost::property_map < PolygonMesh, boost::face_index_t>::type DefaultMap;
+public:
+  typedef typename boost::lookup_named_param_def <
+    boost::face_index_t,
+    NamedParameters,
+    DefaultMap
+  > ::type  type;
+  typedef typename boost::is_same<type, DefaultMap>::type Is_internal_map;
+};
+
+template<typename PolygonMesh, typename NamedParameters>
+class GetVertexIndexMap
+{
+  typedef typename boost::property_map < PolygonMesh, boost::vertex_index_t>::type DefaultMap;
+public:
+  typedef typename boost::lookup_named_param_def <
+    boost::vertex_index_t,
+    NamedParameters,
+    DefaultMap
+  > ::type  type;
+};
+
+template<typename PolygonMesh, typename NamedParameters>
+class GetFaceNormalMap
+{
+  struct DummyNormalPmap
+  {
+    typedef typename boost::graph_traits<PolygonMesh>::face_descriptor key_type;
+    typedef typename GetGeomTraits<PolygonMesh, NamedParameters>::type::Vector_3 value_type;
+    typedef value_type reference;
+    typedef boost::readable_property_map_tag category;
+
+    typedef DummyNormalPmap Self;
+    friend reference get(const Self&, const key_type&) { return CGAL::NULL_VECTOR; }
+  };
+
+public:
+  typedef DummyNormalPmap NoMap;
+  typedef typename boost::lookup_named_param_def <
+    CGAL::face_normal_t,
+    NamedParameters,
+    DummyNormalPmap//default
+  > ::type  type;
+};
+
+template<typename NamedParameters, typename DefaultSolver>
+class GetSolver
+{
+public:
+  typedef typename boost::lookup_named_param_def <
+    CGAL::sparse_linear_solver_t,
+    NamedParameters,
+    DefaultSolver
+  > ::type type;
+};
+
+
+
+#endif //CGAL_NAMED_PARAMETERS_HELPERS_H
+
diff --git a/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/internal/refine_impl.h b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/internal/refine_impl.h
new file mode 100644
index 0000000..27ded6d
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/internal/refine_impl.h
@@ -0,0 +1,335 @@
+// Copyright (c) 2015 GeometryFactory (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Jane Tournois
+
+#ifndef CGAL_POLYGON_MESH_PROCESSING_REFINE_POLYHEDRON_3_H
+#define CGAL_POLYGON_MESH_PROCESSING_REFINE_POLYHEDRON_3_H
+
+#include <cmath>
+#include <map>
+#include <set>
+#include <list>
+
+#include <CGAL/assertions.h>
+#include <CGAL/trace.h>
+#include <CGAL/Timer.h>
+#include <CGAL/squared_distance_3.h>
+#include <CGAL/Kernel/global_functions_3.h>
+#include <CGAL/boost/graph/iterator.h>
+#include <CGAL/boost/graph/Euler_operations.h>
+#include <CGAL/boost/graph/properties.h>
+#include <CGAL/property_map.h>
+
+namespace CGAL {
+
+namespace Polygon_mesh_processing {
+
+namespace internal {
+
+template<class PolygonMesh, class VertexPointMap>
+class Refine_Polyhedron_3 {
+//// typedefs
+  typedef typename boost::property_traits<VertexPointMap>::value_type     Point_3;
+  typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor    vertex_descriptor;
+  typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor  halfedge_descriptor;
+  typedef typename boost::graph_traits<PolygonMesh>::face_descriptor      face_descriptor;
+
+  typedef Halfedge_around_face_circulator<PolygonMesh>    Halfedge_around_facet_circulator;
+  typedef Halfedge_around_target_circulator<PolygonMesh>  Halfedge_around_vertex_circulator;
+
+private:
+  PolygonMesh& pmesh;
+  VertexPointMap vpmap;
+  
+  bool flippable(halfedge_descriptor h) {
+    // this check is added so that edge flip does not break manifoldness
+    // it might happen when there is an edge where flip_edge(h) will be placed (i.e. two edges collide after flip)
+    vertex_descriptor v_tip_0 = target(next(h,pmesh),pmesh);
+    vertex_descriptor v_tip_1 = target(next(opposite(h,pmesh),pmesh),pmesh);
+    Halfedge_around_vertex_circulator v_cir(next(h,pmesh), pmesh), v_end(v_cir);
+    do {
+      if(target(opposite(*v_cir, pmesh),pmesh) == v_tip_1) { return false; }
+    } while(++v_cir != v_end);
+    
+    // also eliminate collinear triangle generation
+    if( CGAL::collinear(vpmap[v_tip_0], vpmap[v_tip_1], vpmap[target(h, pmesh)]) ||
+        CGAL::collinear(vpmap[v_tip_0], vpmap[v_tip_1], vpmap[target(opposite(h, pmesh),pmesh)]) ) {
+      return false;
+    }
+
+    return true;
+  }
+
+  bool relax(halfedge_descriptor h)
+  {
+    const Point_3& p = vpmap[target(h,pmesh)];
+    const Point_3& q = vpmap[target(opposite(h,pmesh),pmesh)];
+    const Point_3& r = vpmap[target(next(h,pmesh),pmesh)];
+    const Point_3& s = vpmap[target(next(opposite(h,pmesh),pmesh),pmesh)];
+    if( (CGAL::ON_UNBOUNDED_SIDE  != CGAL::side_of_bounded_sphere(p,q,r,s)) ||
+        (CGAL::ON_UNBOUNDED_SIDE  != CGAL::side_of_bounded_sphere(p,q,s,r)) )
+    {
+      if(flippable(h)) {
+        Euler::flip_edge(h,pmesh);
+        return true;
+      }
+    }
+    return false;
+  }
+
+  template<class VertexOutputIterator,
+           class FaceOutputIterator,
+           class FaceRange>
+  bool subdivide(const FaceRange& faces,
+                 const std::set<halfedge_descriptor>& border_edges,
+                 std::map<vertex_descriptor, double>& scale_attribute, 
+                 VertexOutputIterator& vertex_out,
+                 FaceOutputIterator& facet_out,
+                 std::vector<face_descriptor>& new_faces,
+                 double alpha)
+  {
+    BOOST_FOREACH(face_descriptor fd, faces)
+    {
+      CGAL_assertion(fd  != boost::graph_traits<PolygonMesh>::null_face());
+
+      vertex_descriptor vi = target(halfedge(fd,pmesh),pmesh);
+      vertex_descriptor vj = target(next(halfedge(fd,pmesh),pmesh),pmesh);
+      vertex_descriptor vk = target(prev(halfedge(fd,pmesh),pmesh),pmesh);
+      Point_3 c = CGAL::centroid(vpmap[vi], vpmap[vj], vpmap[vk]);
+      double sac  = (scale_attribute[vi] + scale_attribute[vj] + scale_attribute[vk])/3.0;
+      double dist_c_vi = to_double(CGAL::approximate_sqrt(CGAL::squared_distance(c,vpmap[vi])));
+      double dist_c_vj = to_double(CGAL::approximate_sqrt(CGAL::squared_distance(c, vpmap[vj])));
+      double dist_c_vk = to_double(CGAL::approximate_sqrt(CGAL::squared_distance(c, vpmap[vk])));
+      if((alpha * dist_c_vi > sac) &&
+         (alpha * dist_c_vj > sac) &&
+         (alpha * dist_c_vk > sac) &&
+         (alpha * dist_c_vi > scale_attribute[vi]) &&
+         (alpha * dist_c_vj > scale_attribute[vj]) &&
+         (alpha * dist_c_vk > scale_attribute[vk]))
+      {
+        halfedge_descriptor h = Euler::add_center_vertex(halfedge(fd,pmesh),pmesh);
+        put(vpmap, target(h,pmesh), c);
+          scale_attribute[target(h,pmesh)] = sac;
+          *vertex_out++ = target(h,pmesh);
+
+          // collect 2 new facets for next round 
+          face_descriptor h1 = face(opposite(next(h,pmesh),pmesh),pmesh);
+          face_descriptor h2 = face(opposite(h,pmesh),pmesh);
+          new_faces.push_back(h1); new_faces.push_back(h2);
+          *facet_out++ = h1;    *facet_out++ = h2;
+          // relax edges of the  patching mesh 
+          halfedge_descriptor e_ij = prev(h,pmesh);
+          halfedge_descriptor e_ik = next(opposite(h,pmesh),pmesh);
+          halfedge_descriptor e_jk = prev(opposite(next(h,pmesh),pmesh),pmesh);
+
+          if(border_edges.find(e_ij) == border_edges.end()){
+            relax(e_ij);
+          }
+          if(border_edges.find(e_ik) == border_edges.end()){
+            relax(e_ik);
+          }
+          if(border_edges.find(e_jk) == border_edges.end()){
+            relax(e_jk);
+          }
+      }
+    }
+    return !new_faces.empty();
+  }
+
+  template<typename FaceRange>
+  bool relax(const FaceRange& faces,
+             const std::vector<face_descriptor>& new_faces,
+             const std::set<halfedge_descriptor>& border_edges)
+  {
+    int flips = 0;
+    std::list<halfedge_descriptor> interior_edges;
+    std::set<halfedge_descriptor> included_map; 
+
+    collect_interior_edges(faces, border_edges, interior_edges, included_map);
+    collect_interior_edges(new_faces, border_edges, interior_edges, included_map);
+
+    CGAL_TRACE_STREAM << "Test " << interior_edges.size() << " edges " << std::endl;
+    //do not just use std::set (included_map) for iteration, the order effects the output (we like to make it deterministic)
+    BOOST_FOREACH(halfedge_descriptor h, interior_edges)
+    {
+      if (relax(h)) {
+        ++flips;
+      }
+    }
+
+    CGAL_TRACE_STREAM << "|flips| = " << flips << std::endl;
+    return flips > 0;
+  }
+
+  template<typename FaceRange>
+  void collect_interior_edges(const FaceRange& faces,
+        const std::set<halfedge_descriptor>& border_edges,
+        std::list<halfedge_descriptor>& interior_edges,
+        std::set<halfedge_descriptor>& included_map)
+  {
+    BOOST_FOREACH(face_descriptor fd, faces)
+    {
+      Halfedge_around_face_circulator<PolygonMesh> circ(halfedge(fd, pmesh), pmesh), done(circ);
+      do {
+        halfedge_descriptor h = *circ;
+        if (border_edges.find(h) == border_edges.end()){
+          // do not remove included_map and use if(&*h < &*oh) { interior_edges.push_back(h) } 
+          // which will change the order of edges from run to run
+          halfedge_descriptor oh = opposite(h, pmesh);
+          halfedge_descriptor h_rep = (h < oh) ? h : oh; // AF: was &*h < &*oh
+          if (included_map.insert(h_rep).second) {
+            interior_edges.push_back(h_rep);
+          }
+        }
+      } while (++circ != done);
+    }
+  }
+
+  double average_length(vertex_descriptor vh,
+                        const std::set<face_descriptor>& interior_map, 
+                        bool accept_internal_facets)
+  {
+    const Point_3& vp = vpmap[vh]; 
+    Halfedge_around_target_circulator<PolygonMesh> circ(halfedge(vh,pmesh),pmesh), done(circ);
+    int deg = 0;
+    double sum = 0;
+    do {
+      face_descriptor f(face(*circ,pmesh)), f_op(face(opposite(*circ,pmesh),pmesh));
+
+      if(!accept_internal_facets) {
+        if(interior_map.find(f) != interior_map.end() && interior_map.find(f_op) != interior_map.end())
+        { continue; } // which means current edge is an interior edge and should not be included in scale attribute calculation
+      }
+
+      const Point_3& vq = vpmap[target(opposite(*circ,pmesh),pmesh)];
+      sum += to_double(CGAL::approximate_sqrt(CGAL::squared_distance(vp, vq)));
+      ++deg;
+    } while(++circ != done);
+
+    CGAL_assertion(deg != 0); // this might happen when accept_internal_facets = false but there is
+    return sum/deg;
+  }
+
+  template<typename FaceRange>
+  void calculate_scale_attribute(const FaceRange& faces,
+                                 const std::set<face_descriptor>& interior_map,
+                                 std::map<vertex_descriptor, double>& scale_attribute,
+                                 bool accept_internal_facets) 
+  {
+    BOOST_FOREACH(face_descriptor fd, faces)
+    {
+      Halfedge_around_face_circulator<PolygonMesh> circ(halfedge(fd,pmesh),pmesh), done(circ);
+      do {
+        vertex_descriptor v = target(*circ,pmesh);
+        std::pair<typename std::map<vertex_descriptor, double>::iterator, bool> v_insert 
+          = scale_attribute.insert(std::make_pair(v, 0));
+        if(!v_insert.second) { continue; } // already calculated
+        v_insert.first->second = average_length(v, interior_map, accept_internal_facets);
+      } while(++circ != done);
+    }
+  }
+
+  template<typename FaceRange>
+  bool contain_internal_facets(const FaceRange& faces,
+                               const std::set<face_descriptor>& interior_map) const
+  {
+    BOOST_FOREACH(face_descriptor fd, faces)
+    {
+      Halfedge_around_face_circulator<PolygonMesh> circ(halfedge(fd,pmesh),pmesh), done(circ);
+      do {
+        Halfedge_around_target_circulator<PolygonMesh> circ_v(*circ,pmesh), done_v(circ_v);
+        bool internal_v = true;
+        do {
+          face_descriptor f(face(*circ,pmesh)), f_op(face(opposite(*circ_v,pmesh),pmesh));
+
+          if(interior_map.find(f) == interior_map.end() || interior_map.find(f_op) == interior_map.end()) {
+            internal_v = false;
+            break;
+          } 
+        } while(++circ_v != done_v);
+
+        if(internal_v) { return true; }
+      } while(++circ != done);
+    }
+    return false;
+  }
+
+public:
+  Refine_Polyhedron_3(PolygonMesh& pmesh
+                    , VertexPointMap vpmap_)
+    : pmesh(pmesh)
+    , vpmap(vpmap_)
+  {}
+
+  template<class FaceRange, class FacetOutputIterator, class VertexOutputIterator>
+  void refine(const FaceRange& faces,
+              FacetOutputIterator& facet_out,
+              VertexOutputIterator& vertex_out,
+              double alpha)
+  {
+      // do not use just std::set, the order effects the output (for the same input we want to get same output)
+    std::set<face_descriptor> interior_map(boost::begin(faces), boost::end(faces));
+
+    // store boundary edges - to be used in relax 
+    std::set<halfedge_descriptor> border_edges;
+    BOOST_FOREACH(face_descriptor f, faces)
+    {
+      Halfedge_around_face_circulator<PolygonMesh> circ(halfedge(f,pmesh),pmesh), done(circ);
+      do {
+        if(interior_map.find(face(opposite(*circ,pmesh),pmesh)) == interior_map.end()) {
+          border_edges.insert(*circ);
+        }
+      } while(++circ != done);
+    }
+
+    // check whether there is any need to accept internal facets
+    bool accept_internal_facets = contain_internal_facets(faces, interior_map);
+    std::map<vertex_descriptor, double> scale_attribute;
+    calculate_scale_attribute(faces, interior_map, scale_attribute, accept_internal_facets);
+
+    std::vector<face_descriptor> all_faces(boost::begin(faces), boost::end(faces));
+    CGAL::Timer total_timer; total_timer.start();
+    for(int i = 0; i < 10; ++i)
+    {
+      std::vector<face_descriptor> new_faces;
+      CGAL::Timer timer; timer.start();
+      bool is_subdivided = subdivide(all_faces, border_edges, scale_attribute, vertex_out, facet_out, new_faces, alpha);
+      CGAL_TRACE_STREAM << "**Timer** subdivide() :" << timer.time() << std::endl; timer.reset();
+      if(!is_subdivided)
+        break;
+
+      bool is_relaxed = relax(faces, new_faces, border_edges);
+      CGAL_TRACE_STREAM << "**Timer** relax() :" << timer.time() << std::endl;
+      if(!is_relaxed)
+        break;
+      all_faces.insert(all_faces.end(), new_faces.begin(), new_faces.end());
+    }
+
+    CGAL_TRACE_STREAM << "**Timer** TOTAL: " << total_timer.time() << std::endl;
+  }
+
+}; //end class Refine_Polyhedron_3
+
+}//namespace internal
+
+}//namespace Polygon_mesh_processing
+
+}//namespace CGAL
+
+#endif //CGAL_POLYGON_MESH_PROCESSING_REFINE_POLYHEDRON_3_H
diff --git a/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/measure.h b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/measure.h
new file mode 100644
index 0000000..3457888
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/measure.h
@@ -0,0 +1,451 @@
+// Copyright (c) 2015 GeometryFactory (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Andreas Fabri
+
+#ifndef CGAL_POLYGON_MESH_PROCESSING_MEASURE_H
+#define CGAL_POLYGON_MESH_PROCESSING_MEASURE_H
+
+#include <CGAL/boost/graph/iterator.h>
+#include <CGAL/boost/graph/helpers.h>
+#include <CGAL/boost/graph/properties.h>
+#include <boost/graph/graph_traits.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/identity.hpp>
+#include <boost/type_traits/is_base_of.hpp>
+
+#include <CGAL/Polygon_mesh_processing/internal/named_function_params.h>
+#include <CGAL/Polygon_mesh_processing/internal/named_params_helper.h>
+
+#ifdef DOXYGEN_RUNNING
+#define CGAL_PMP_NP_TEMPLATE_PARAMETERS NamedParameters
+#define CGAL_PMP_NP_CLASS NamedParameters
+#endif
+
+namespace CGAL {
+
+namespace Polygon_mesh_processing {
+
+  /**
+  * \ingroup measure_grp
+  * computes the length of an edge of a given polygon mesh.
+  * The edge is given by one of its halfedges, or the edge itself.
+  *
+  * @tparam PolygonMesh a model of `HalfedgeGraph` that has an internal property map
+  *         for `CGAL::vertex_point_t`
+  * @tparam NamedParameters a sequence of \ref namedparameters
+  *
+  * @param h one halfedge of the edge to compute the length
+  * @param pmesh the polygon mesh to which `h` belongs
+  * @param np optional sequence of \ref namedparameters among the ones listed below
+  *
+  * \cgalNamedParamsBegin
+  *    \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh` \cgalParamEnd
+  *    \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `Kernel`\cgalParamEnd
+  * \cgalNamedParamsEnd
+  *
+  * @return the length of `h`. The return type `FT` is a number type. It is
+  * either deduced from the `geom_traits` \ref namedparameters if provided,
+  * or the geometric traits class deduced from the point property map
+  * of `pmesh`.
+  *
+  * \warning This function involves a square root computation.
+  * If `FT` does not have a `sqrt()` operation, the square root computation
+  * will be done approximately.
+  *
+  * @sa `face_border_length()`
+  */
+  template<typename PolygonMesh,
+           typename NamedParameters>
+#ifdef DOXYGEN_RUNNING
+  FT
+#else
+  typename GetGeomTraits<PolygonMesh, NamedParameters>::type::FT
+#endif
+  edge_length(typename boost::graph_traits<PolygonMesh>::halfedge_descriptor h
+              , const PolygonMesh& pmesh
+              , const NamedParameters& np)
+  {
+    using boost::choose_const_pmap;
+    using boost::get_param;
+
+    typename GetVertexPointMap<PolygonMesh, NamedParameters>::const_type
+    vpm = choose_const_pmap(get_param(np, CGAL::vertex_point),
+                            pmesh,
+                            CGAL::vertex_point);
+
+    return CGAL::approximate_sqrt(CGAL::squared_distance(get(vpm, source(h, pmesh)),
+                                                         get(vpm, target(h, pmesh))));
+  }
+
+  template<typename PolygonMesh>
+  typename CGAL::Kernel_traits<typename property_map_value<PolygonMesh,
+    CGAL::vertex_point_t>::type>::Kernel::FT
+  edge_length(typename boost::graph_traits<PolygonMesh>::halfedge_descriptor h
+            , const PolygonMesh& pmesh)
+  {
+    return edge_length(h, pmesh,
+      CGAL::Polygon_mesh_processing::parameters::all_default());
+  }
+  // edge overloads
+  template<typename PolygonMesh,
+           typename NamedParameters>
+  typename GetGeomTraits<PolygonMesh, NamedParameters>::type::FT
+  edge_length(typename boost::graph_traits<PolygonMesh>::edge_descriptor e
+              , const PolygonMesh& pmesh
+              , const NamedParameters& np)
+  {
+    return edge_length(halfedge(e,pmesh), pmesh, np);
+  }
+
+  template<typename PolygonMesh>
+  typename CGAL::Kernel_traits<typename property_map_value<PolygonMesh,
+    CGAL::vertex_point_t>::type>::Kernel::FT
+  edge_length(typename boost::graph_traits<PolygonMesh>::edge_descriptor e
+            , const PolygonMesh& pmesh)
+  {
+    return edge_length(halfedge(e,pmesh), pmesh);
+  }
+
+  /**
+  * \ingroup measure_grp
+  * computes the length of the border polyline
+  * that contains a given halfedge.
+  *
+  * @tparam PolygonMesh a model of `HalfedgeGraph` that has an internal property map
+  *         for `CGAL::vertex_point_t`
+  * @tparam NamedParameters a sequence of \ref namedparameters
+  *
+  * @param h a halfedge of the border polyline of which the length is computed
+  * @param pmesh the polygon mesh to which `h` belongs
+  * @param np optional sequence of \ref namedparameters among the ones listed below
+  *
+  * \cgalNamedParamsBegin
+  *    \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh` \cgalParamEnd
+*    \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `Kernel`\cgalParamEnd
+  * \cgalNamedParamsEnd
+  *
+  * @return the length of the sequence of border edges of `face(h, pmesh)`.
+  * The return type `FT` is a number type. It is
+  * either deduced from the `geom_traits` \ref namedparameters if provided,
+  * or the geometric traits class deduced from the point property map
+  * of `pmesh`.
+  *
+  * \warning This function involves a square root computation.
+  * If `Kernel::FT` does not have a `sqrt()` operation, the square root computation
+  * will be done approximately.
+  *
+  * @sa `edge_length()`
+  */
+  template<typename PolygonMesh,
+           typename NamedParameters>
+#ifdef DOXYGEN_RUNNING
+   FT
+#else
+  typename GetGeomTraits<PolygonMesh, NamedParameters>::type::FT
+#endif
+  face_border_length(
+              typename boost::graph_traits<PolygonMesh>::halfedge_descriptor h
+              , const PolygonMesh& pmesh
+              , const NamedParameters& np)
+  {
+    typename GetGeomTraits<PolygonMesh, NamedParameters>::type::FT result = 0.;
+    BOOST_FOREACH(typename boost::graph_traits<PolygonMesh>::halfedge_descriptor haf,
+                  halfedges_around_face(h, pmesh))
+    {
+      result += edge_length(haf, pmesh, np);
+      exact(result);
+    }
+    return result;
+  }
+
+  template<typename PolygonMesh>
+  typename CGAL::Kernel_traits<typename property_map_value<PolygonMesh,
+    CGAL::vertex_point_t>::type>::Kernel::FT
+  face_border_length(
+              typename boost::graph_traits<PolygonMesh>::halfedge_descriptor h
+              , const PolygonMesh& pmesh)
+  {
+    return face_border_length(h, pmesh,
+      CGAL::Polygon_mesh_processing::parameters::all_default());
+  }
+
+
+  /**
+  * \ingroup measure_grp
+  * computes the area of a face of a given
+  * triangulated surface mesh.
+  *
+  * @tparam TriangleMesh a model of `HalfedgeGraph` that has an internal property map
+  *         for `CGAL::vertex_point_t`
+  * @tparam NamedParameters a sequence of \ref namedparameters
+  *
+  * @param f the face of which the area is computed
+  * @param tmesh the triangulated surface mesh to which `f` belongs
+  * @param np optional sequence of \ref namedparameters among the ones listed below
+  *
+  * \cgalNamedParamsBegin
+  *    \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh` \cgalParamEnd
+  *  \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `Kernel`\cgalParamEnd
+  * \cgalNamedParamsEnd
+  *
+  *@pre `f != boost::graph_traits<TriangleMesh>::%null_face()`
+  *
+  * @return the area of `f`.
+  * The return type `FT` is a number type. It is
+  * either deduced from the `geom_traits` \ref namedparameters if provided,
+  * or the geometric traits class deduced from the point property map
+  * of `tmesh`.
+  *
+  * @sa `area()`
+  */
+  template<typename TriangleMesh,
+           typename CGAL_PMP_NP_TEMPLATE_PARAMETERS>
+#ifdef DOXYGEN_RUNNING
+  FT
+#else
+  typename GetGeomTraits<TriangleMesh, CGAL_PMP_NP_CLASS>::type::FT
+#endif
+  face_area(typename boost::graph_traits<TriangleMesh>::face_descriptor f
+            , const TriangleMesh& tmesh
+            , const CGAL_PMP_NP_CLASS& np)
+  {
+    using boost::choose_const_pmap;
+    using boost::get_param;
+
+    CGAL_precondition(boost::graph_traits<TriangleMesh>::null_face() != f);
+
+    typename GetVertexPointMap<TriangleMesh, CGAL_PMP_NP_CLASS>::const_type
+    vpm = choose_const_pmap(get_param(np, CGAL::vertex_point),
+                            tmesh,
+                            CGAL::vertex_point);
+
+    typedef typename boost::graph_traits<TriangleMesh>::halfedge_descriptor halfedge_descriptor;
+    halfedge_descriptor hd = halfedge(f, tmesh);
+    halfedge_descriptor nhd = next(hd, tmesh);
+
+    typename GetGeomTraits<TriangleMesh, CGAL_PMP_NP_CLASS>::type traits;
+
+    return approximate_sqrt(
+             traits.compute_squared_area_3_object()(get(vpm, source(hd, tmesh)),
+                                                    get(vpm, target(hd, tmesh)),
+                                                    get(vpm, target(nhd, tmesh))));
+  }
+
+  template<typename TriangleMesh>
+  typename CGAL::Kernel_traits<typename property_map_value<TriangleMesh,
+    CGAL::vertex_point_t>::type>::Kernel::FT
+  face_area(typename boost::graph_traits<TriangleMesh>::face_descriptor f
+            , const TriangleMesh& tmesh)
+  {
+    return face_area(f, tmesh,
+      CGAL::Polygon_mesh_processing::parameters::all_default());
+  }
+
+  /**
+  * \ingroup measure_grp
+  * computes the area of a range of faces of a given
+  * triangulated surface mesh.
+  *
+  * @tparam FaceRange range of `boost::graph_traits<PolygonMesh>::%face_descriptor`,
+          model of `Range`.
+          Its iterator type is `InputIterator`.
+  * @tparam TriangleMesh a model of `HalfedgeGraph` that has an internal property map
+  *         for `CGAL::vertex_point_t`
+  * @tparam NamedParameters a sequence of \ref namedparameters
+  *
+  * @param face_range the range of faces of which the area is computed
+  * @param tmesh the triangulated surface mesh to which the faces of `face_range` belong
+  * @param np optional sequence of \ref namedparameters among the ones listed below
+  *
+  * \cgalNamedParamsBegin
+  *    \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh` \cgalParamEnd
+  *  \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `Kernel` \cgalParamEnd
+  * \cgalNamedParamsEnd
+  *
+  * @return sum of face areas of `faces`.
+  * The return type `FT` is a number type. It is
+  * either deduced from the `geom_traits` \ref namedparameters if provided,
+  * or the geometric traits class deduced from the point property map
+  * of `tmesh`.
+  *
+  * \warning This function involves a square root computation.
+  * If `Kernel::FT` does not have a `sqrt()` operation, the square root computation
+  * will be done approximately.
+  *
+  * @sa `face_area()`
+  */
+  template<typename FaceRange,
+           typename TriangleMesh,
+           typename CGAL_PMP_NP_TEMPLATE_PARAMETERS>
+#ifdef DOXYGEN_RUNNING
+  FT
+#else
+  typename GetGeomTraits<TriangleMesh, CGAL_PMP_NP_CLASS>::type::FT
+#endif
+  area(FaceRange face_range
+     , const TriangleMesh& tmesh
+     , const CGAL_PMP_NP_CLASS& np)
+  {
+    typedef typename boost::graph_traits<TriangleMesh>::face_descriptor face_descriptor;
+    typename GetGeomTraits<TriangleMesh, CGAL_PMP_NP_CLASS>::type::FT result = 0.;
+    BOOST_FOREACH(face_descriptor f, face_range)
+    {
+      result += face_area(f, tmesh, np);
+      exact(result);
+    }
+    return result;
+  }
+
+  template<typename FaceRange, typename TriangleMesh>
+  typename CGAL::Kernel_traits<
+    typename boost::mpl::eval_if<
+      boost::is_base_of<CGAL::named_params_base, TriangleMesh>,
+      boost::mpl::identity<TriangleMesh>,
+      property_map_value<TriangleMesh, CGAL::vertex_point_t>
+    >::type
+  >::Kernel::FT
+  area(FaceRange face_range, const TriangleMesh& tmesh)
+  {
+    return area(face_range, tmesh,
+                CGAL::Polygon_mesh_processing::parameters::all_default());
+  }
+
+  /**
+  * \ingroup measure_grp
+  * computes the surface area of a triangulated surface mesh.
+  *
+  * @tparam TriangleMesh a model of `HalfedgeGraph` that has an internal property map
+  *         for `CGAL::vertex_point_t`
+  * @tparam NamedParameters a sequence of \ref namedparameters
+  *
+  * @param tmesh the triangulated surface mesh
+  * @param np optional sequence of \ref namedparameters among the ones listed below
+  *
+  * \cgalNamedParamsBegin
+  *    \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh` \cgalParamEnd
+  *  \cgalParamBegin{geom_traits}an instance of a geometric traits class, model of `Kernel`\cgalParamEnd
+  * \cgalNamedParamsEnd
+  *
+  * @return the surface area of `tmesh`.
+  * The return type `FT` is a number type. It is
+  * either deduced from the `geom_traits` \ref namedparameters if provided,
+  * or the geometric traits class deduced from the point property map
+  * of `tmesh`.
+  *
+  * \warning This function involves a square root computation.
+  * If `Kernel::FT` does not have a `sqrt()` operation, the square root computation
+  * will be done approximately.
+  *
+  * @sa `face_area()`
+  */
+  template<typename TriangleMesh
+         , typename CGAL_PMP_NP_TEMPLATE_PARAMETERS>
+#ifdef DOXYGEN_RUNNING
+  FT
+#else
+  typename GetGeomTraits<TriangleMesh, CGAL_PMP_NP_CLASS>::type::FT
+#endif
+  area(const TriangleMesh& tmesh, const CGAL_PMP_NP_CLASS& np)
+  {
+    return area(faces(tmesh), tmesh, np);
+  }
+
+  template<typename TriangleMesh>
+  typename CGAL::Kernel_traits<typename property_map_value<TriangleMesh,
+    CGAL::vertex_point_t>::type>::Kernel::FT
+  area(const TriangleMesh& tmesh)
+  {
+    return area(faces(tmesh), tmesh
+      , CGAL::Polygon_mesh_processing::parameters::all_default());
+  }
+
+  /**
+  * \ingroup measure_grp
+  * computes the volume of the domain bounded by
+  * a closed triangulated surface mesh.
+  *
+  * @tparam TriangleMesh a model of `HalfedgeGraph` that has an internal property map
+  *         for `CGAL::vertex_point_t`
+  * @tparam NamedParameters a sequence of \ref namedparameters
+  *
+  * @param tmesh the closed triangulated surface mesh bounding the volume
+  * @param np optional sequence of \ref namedparameters among the ones listed below
+  *
+  * @pre `tmesh` is closed
+  *
+  * \cgalNamedParamsBegin
+  *  \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh` \cgalParamEnd
+  *  \cgalParamBegin{geom_traits}an instance of a geometric traits class, model of `Kernel`\cgalParamEnd
+  * \cgalNamedParamsEnd
+  *
+  * @return the volume bounded by `tmesh`.
+  * The return type `FT` is a number type. It is
+  * either deduced from the `geom_traits` \ref namedparameters if provided,
+  * or the geometric traits class deduced from the point property map
+  * of `tmesh`.
+  */
+  template<typename TriangleMesh
+         , typename CGAL_PMP_NP_TEMPLATE_PARAMETERS>
+#ifdef DOXYGEN_RUNNING
+  FT
+#else
+  typename GetGeomTraits<TriangleMesh, CGAL_PMP_NP_CLASS>::type::FT
+#endif
+  volume(const TriangleMesh& tmesh, const CGAL_PMP_NP_CLASS& np)
+  {
+    CGAL_assertion(is_triangle_mesh(tmesh));
+    CGAL_assertion(is_closed(tmesh));
+
+    using boost::choose_const_pmap;
+    using boost::get_param;
+
+    typename GetVertexPointMap<TriangleMesh, CGAL_PMP_NP_CLASS>::const_type
+      vpm = choose_const_pmap(get_param(np, CGAL::vertex_point),
+                              tmesh,
+                              CGAL::vertex_point);
+    typename GetGeomTraits<TriangleMesh, CGAL_PMP_NP_CLASS>::type::Point_3
+      origin(0, 0, 0);
+
+    typedef typename boost::graph_traits<TriangleMesh>::face_descriptor face_descriptor;
+
+    typename GetGeomTraits<TriangleMesh, CGAL_PMP_NP_CLASS>::type::FT volume = 0.;
+    BOOST_FOREACH(face_descriptor f, faces(tmesh))
+    {
+      volume += CGAL::volume(origin,
+        get(vpm, target(halfedge(f, tmesh), tmesh)),
+        get(vpm, target(next(halfedge(f, tmesh), tmesh), tmesh)),
+        get(vpm, target(prev(halfedge(f, tmesh), tmesh), tmesh)));
+      exact(volume);
+    }
+    return volume;
+  }
+
+  template<typename TriangleMesh>
+  typename CGAL::Kernel_traits<typename property_map_value<TriangleMesh,
+    CGAL::vertex_point_t>::type>::Kernel::FT
+  volume(const TriangleMesh& tmesh)
+  {
+    return volume(tmesh,
+      CGAL::Polygon_mesh_processing::parameters::all_default());
+  }
+
+}
+}
+
+#endif // CGAL_POLYGON_MESH_PROCESSING_MEASURE_H
diff --git a/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/orient_polygon_soup.h b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/orient_polygon_soup.h
new file mode 100644
index 0000000..e1c29f4
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/orient_polygon_soup.h
@@ -0,0 +1,488 @@
+// Copyright (c) 2009-2015 GeometryFactory (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Laurent Rineau and Sebastien Loriot
+
+
+#ifndef CGAL_POLYGON_MESH_PROCESSING_ORIENT_POLYGON_SOUP
+#define CGAL_POLYGON_MESH_PROCESSING_ORIENT_POLYGON_SOUP
+
+#include <CGAL/tuple.h>
+#include <CGAL/array.h>
+#include <CGAL/assertions.h>
+#include <boost/foreach.hpp>
+
+#include <set>
+#include <map>
+#include <stack>
+#include <vector>
+#include <algorithm>
+#include <iostream>
+
+namespace CGAL {
+
+namespace Polygon_mesh_processing {
+
+namespace internal {
+
+template<class PointRange, class PolygonRange>
+struct Polygon_soup_orienter
+{
+  typedef typename PointRange::value_type                               Point_3;
+  typedef typename PolygonRange::value_type                           Polygon_3;
+/// Index types
+  typedef typename std::iterator_traits<
+            typename Polygon_3::iterator >::value_type                     V_ID;
+  typedef typename std::vector<Polygon_3>::size_type                       P_ID;
+//  typedef int                                                             CC_ID;
+  typedef std::pair<V_ID, V_ID>                                       V_ID_pair;
+/// Container types
+  typedef PointRange                                                     Points;
+  typedef PolygonRange                                                 Polygons;
+  typedef std::map<V_ID_pair, std::set<P_ID> >                         Edge_map;
+  typedef typename Edge_map::iterator                         Edge_map_iterator;
+  typedef std::set<V_ID_pair>                                      Marked_edges;
+
+/// Data members
+  Points& points;             //< the set of input points
+  Polygons& polygons;         //< the set of input polygons
+  Edge_map edges;             //< the set of edges of the input polygons
+  Marked_edges marked_edges;  //< the set of singular edges or edges incident
+                              //<   to non-compatible orientation polygons
+
+  /// for each polygon referenced by its position in `polygons`, indicates
+  /// the connected component it belongs too after orientation.
+//  std::vector< CC_ID > polygon_cc_id;
+
+/// Utility functions
+  static V_ID_pair canonical_edge(V_ID i, V_ID j)
+  {
+    return i<j ? V_ID_pair(i,j):V_ID_pair(j,i);
+  }
+
+  static bool is_edge_marked(V_ID i, V_ID j, Marked_edges& marked_edges)
+  {
+    return marked_edges.count(canonical_edge(i,j)) > 0;
+  }
+
+  static void set_edge_marked(V_ID i, V_ID j, Marked_edges& marked_edges)
+  {
+    marked_edges.insert(canonical_edge(i,j));
+  }
+
+  static cpp11::array<V_ID,3>
+  get_neighbor_vertices(V_ID v_id, P_ID polygon_index, const Polygons& polygons)
+  {
+    std::size_t nbv = polygons[polygon_index].size(), pvid=0;
+    for (; pvid!=nbv; ++pvid)
+      if (v_id==polygons[polygon_index][pvid]) break;
+    CGAL_assertion( pvid!=nbv );
+    V_ID prev = polygons[polygon_index][ (pvid+nbv-1)%nbv ];
+    V_ID next = polygons[polygon_index][ (pvid+1)%nbv ];
+    return make_array(prev,v_id,next);
+  }
+
+  static std::pair<V_ID,P_ID>
+  next_cw_vertex_around_source(V_ID src, V_ID tgt, const Polygons& polygons, Edge_map& edges, Marked_edges& marked_edges)
+  {
+    typedef std::pair<V_ID,P_ID> VID_and_PID;
+    if ( is_edge_marked(src,tgt,marked_edges) ) return VID_and_PID(src,300612);
+    Edge_map_iterator em_it=edges.find(V_ID_pair(tgt, src));
+    if ( em_it==edges.end() ) return VID_and_PID(src,300612);// the vertex is on the border
+    CGAL_assertion(em_it->second.size()==1);
+    P_ID p_id = *(em_it->second.begin());
+    return VID_and_PID(get_neighbor_vertices(src, p_id, polygons)[2], p_id);
+  }
+
+  static std::pair<V_ID,P_ID>
+  next_ccw_vertex_around_target(V_ID src, V_ID tgt, const Polygons& polygons, Edge_map& edges, Marked_edges& marked_edges)
+  {
+    typedef std::pair<V_ID,P_ID> VID_and_PID;
+    if ( is_edge_marked(src,tgt,marked_edges) ) return VID_and_PID(tgt,300612);
+    Edge_map_iterator em_it=edges.find(V_ID_pair(tgt, src));
+    if ( em_it==edges.end() ) return VID_and_PID(tgt,300612);// the vertex is on the border
+    CGAL_assertion(em_it->second.size()==1);
+    P_ID p_id = *(em_it->second.begin());
+    return VID_and_PID(get_neighbor_vertices(tgt, p_id, polygons)[0], p_id);
+  }
+
+  void inverse_orientation(const std::size_t index) {
+    std::reverse(polygons[index].begin(), polygons[index].end());
+  }
+
+  void replace_vertex_index_in_polygon(
+    std::size_t polygon_id,
+    V_ID old_index,
+    V_ID new_index)
+  {
+    BOOST_FOREACH(V_ID& i, polygons[polygon_id])
+      if( i==old_index )
+        i=new_index;
+  }
+
+/// Functions filling containers
+  static void fill_incident_polygons_per_vertex(
+    const Polygons& polygons,
+    std::vector< std::vector<P_ID> >& incident_polygons_per_vertex)
+  {
+    P_ID nb_polygons=polygons.size();
+    for(P_ID ip=0; ip<nb_polygons; ++ip)
+    {
+      BOOST_FOREACH(V_ID iv, polygons[ip])
+        incident_polygons_per_vertex[iv].push_back(ip);
+    }
+  }
+
+  Polygon_soup_orienter(Points& points, Polygons& polygons)
+    : points(points), polygons(polygons)
+  {}
+
+//filling containers
+  static void fill_edge_map(Edge_map& edges, Marked_edges& marked_edges, const Polygons& polygons) {
+    // Fill edges
+    edges.clear();
+    for (P_ID i = 0; i < polygons.size(); ++i)
+    {
+      const P_ID size = polygons[i].size();
+      for (P_ID j = 0; j < size; ++j) {
+        V_ID i0 = polygons[i][j];
+        V_ID i1 = polygons[i][(j + 1) % size];
+        edges[V_ID_pair(i0, i1)].insert(i);
+      }
+    }
+
+    // Fill non-manifold edges
+    marked_edges.clear();
+    for (P_ID i = 0; i < polygons.size(); ++i)
+    {
+      const P_ID size = polygons[i].size();
+      for (P_ID j = 0; j < size; ++j) {
+        V_ID i0 = polygons[i][j];
+        V_ID i1 = polygons[i][(j + 1) % size];
+
+        std::size_t nb_edges = 0;
+        Edge_map_iterator em_it = edges.find(V_ID_pair(i0, i1));
+        if (em_it != edges.end()) nb_edges += em_it->second.size();
+        em_it = edges.find(V_ID_pair(i1, i0));
+        if (em_it != edges.end()) nb_edges += em_it->second.size();
+
+        if (nb_edges > 2) set_edge_marked(i0, i1, marked_edges);
+      }
+    }
+  }
+
+  void fill_edge_map()
+  {
+    fill_edge_map(edges, marked_edges, polygons);
+  }
+
+  /// We try to orient polygon consistently by walking in the dual graph, from
+  /// a not yet re-oriented polygon.
+  /// We have an edge between two polygons if they share an edge, and this edge
+  /// is shared by exactly two polygons. While walking along an edge, we reorient
+  /// the polygon we walked in if its orientation is not compatible with the one
+  /// we come from.
+  /// If the polygon was already marked as oriented, then we cut the dual edge
+  /// in the graph and the primal edge is marked.
+  /// At the same time, we assign an id to each polygon in the same connected
+  /// componenet of the dual graph.
+  void orient()
+  {
+    std::vector<bool> oriented;
+    std::stack<std::size_t> stack;
+//    polygon_cc_id.resize(polygons.size(), -1);
+
+    // We first consider all polygons as non-oriented
+    oriented.resize(polygons.size());
+
+    P_ID polygon_index = 0;
+
+//    CC_ID current_cc_index=-1;
+    while (polygon_index != polygons.size())
+    {
+      // We look for the first polygon not already oriented
+      while ( polygon_index != polygons.size() && oriented[polygon_index] ) {
+        ++polygon_index;
+      }
+      if(polygon_index == polygons.size()) break;
+
+//      ++ current_cc_index; // visit a new connected component
+
+      // we visit the connected component by crossing edges manifold edges
+      oriented[polygon_index] = true;
+      stack.push(polygon_index);
+      while(! stack.empty() )
+      {
+        const P_ID to_be_oriented_index = stack.top();
+        stack.pop();
+
+//        CGAL_assertion(polygon_cc_id[to_be_oriented_index]==-1);
+//        polygon_cc_id[to_be_oriented_index]=current_cc_index;
+
+        const P_ID size = polygons[to_be_oriented_index].size();
+        for(P_ID ih = 0 ; ih < size ; ++ih) {
+          P_ID ihp1 = (ih+1)%size;
+          const V_ID i1 = polygons[to_be_oriented_index][ih];
+          const V_ID i2 = polygons[to_be_oriented_index][ihp1];
+
+          if( is_edge_marked(i1,i2,marked_edges) ) continue;
+
+          // edge (i1,i2)
+          Edge_map_iterator it_same_orient = edges.find(V_ID_pair(i1, i2));
+          // edges (i2,i1)
+          Edge_map_iterator it_other_orient = edges.find(V_ID_pair(i2, i1));
+
+          CGAL_assertion(it_same_orient != edges.end());
+          CGAL_assertion(it_other_orient == edges.end() ||
+                         it_other_orient->second.size()==1);
+
+          if (it_same_orient->second.size() > 1)
+          {
+            CGAL_assertion(it_other_orient == edges.end());
+            // one neighbor but with the same orientation
+            P_ID index = *(it_same_orient->second.begin());
+            if(index == to_be_oriented_index)
+              index = *(++it_same_orient->second.begin());
+            if(oriented[index])
+            {
+              // polygon already oriented but its orientation is not compatible ---> mark the edge and continue
+              set_edge_marked(i1,i2,marked_edges);
+              continue; // next edge
+            }
+
+            // reverse the orientation
+            const P_ID size = polygons[index].size();
+            for(P_ID j = 0; j < size; ++j) {
+              V_ID i0 = polygons[index][j];
+              V_ID i1 = polygons[index][(j+1)%size];
+              Edge_map_iterator em_it = edges.find(V_ID_pair(i0, i1));
+              CGAL_assertion_code(const bool r = )
+                em_it->second.erase(index)
+              CGAL_assertion_code(!= 0);
+              CGAL_assertion(r);
+              if ( em_it->second.empty() ) edges.erase(em_it);
+            }
+            inverse_orientation(index);
+            for(P_ID j = 0; j < size; ++j) {
+              V_ID i0 = polygons[index][j];
+              V_ID i1 = polygons[index][(j+1)%size];
+              edges[V_ID_pair(i0, i1)].insert(index);
+            }
+            // "inverse the orientation of polygon #index
+            oriented[index] = true;
+            stack.push(index);
+          }
+          else{
+            if( it_other_orient != edges.end() ){
+              CGAL_assertion(it_same_orient->second.size() == 1);
+              CGAL_assertion(it_other_orient->second.size() == 1);
+              // one polygon, same orientation
+              const P_ID index = *(it_other_orient->second.begin());
+              if(oriented[index]) continue; //nothing todo already processed and correctly oriented
+              oriented[index] = true;
+              // "keep the orientation of polygon #index
+              stack.push(index);
+            }
+          }
+        } // end for on all edges of one
+      } // end while loop on the polygons of the connected component
+    } // end while loop on all non-oriented polygons remaining
+  }
+
+  /// A vertex is said to be singular if its link is neither a cycle nor a chain,
+  /// but several cycles and chains.
+  /// For each such vertex v, we consider each set of polygons incident to v
+  /// and sharing a non-marked edge incident to v. A copy of v is assigned to
+  /// each but one set of incident polygons.
+  void duplicate_singular_vertices()
+  {
+    // for each vertex, indicates the list of polygon containing it
+    std::vector< std::vector<P_ID> > incident_polygons_per_vertex(points.size());
+    fill_incident_polygons_per_vertex(polygons, incident_polygons_per_vertex);
+    std::vector< std::pair<V_ID, std::vector<P_ID> > > vertices_to_duplicate;
+
+    V_ID nbv = static_cast<V_ID>( points.size() );
+    for (V_ID v_id = 0; v_id < nbv; ++v_id)
+    {
+      const std::vector< P_ID >& incident_polygons = incident_polygons_per_vertex[v_id];
+
+      if ( incident_polygons.empty() ) continue; //isolated vertex
+      std::set<P_ID> visited_polygons;
+
+      bool first_pass = true;
+      BOOST_FOREACH(P_ID p_id, incident_polygons)
+      {
+        if ( !visited_polygons.insert(p_id).second ) continue; // already visited
+
+        if (!first_pass)
+        {
+          vertices_to_duplicate.push_back(std::pair<V_ID, std::vector<P_ID> >());
+          vertices_to_duplicate.back().first=v_id;
+        }
+
+        const cpp11::array<V_ID,3>& neighbors = get_neighbor_vertices(v_id,p_id,polygons);
+
+        V_ID next = neighbors[2];
+
+        if( !first_pass)
+          vertices_to_duplicate.back().second.push_back(p_id);
+
+        do{
+          P_ID other_p_id;
+          cpp11::tie(next, other_p_id) = next_cw_vertex_around_source(v_id, next, polygons, edges, marked_edges);
+          if (next==v_id) break;
+          visited_polygons.insert(other_p_id);
+          if( !first_pass)
+            vertices_to_duplicate.back().second.push_back(other_p_id);
+        }
+        while(next!=neighbors[0]);
+
+        if (next==v_id){
+          /// turn the otherway round
+          next = neighbors[0];
+          do{
+            P_ID other_p_id;
+            cpp11::tie(next, other_p_id) = next_ccw_vertex_around_target(next, v_id, polygons, edges, marked_edges);
+            if (next==v_id) break;
+            visited_polygons.insert(other_p_id);
+            if( !first_pass)
+              vertices_to_duplicate.back().second.push_back(other_p_id);
+          }
+          while(true);
+        }
+        first_pass=false;
+      }
+    }
+
+    /// now duplicate the vertices
+    typedef std::pair<V_ID, std::vector<P_ID> > V_ID_and_Polygon_ids;
+    BOOST_FOREACH(const V_ID_and_Polygon_ids& vid_and_pids, vertices_to_duplicate)
+    {
+      V_ID new_index = static_cast<V_ID>(points.size());
+      points.push_back( points[vid_and_pids.first] );
+      BOOST_FOREACH(P_ID polygon_id, vid_and_pids.second)
+        replace_vertex_index_in_polygon(polygon_id, vid_and_pids.first, new_index);
+    }
+  }
+
+  static bool has_singular_vertices(
+    std::size_t nb_points,
+    const Polygons& polygons,
+    Edge_map& edges,
+    Marked_edges& marked_edges)
+  {
+    // for each vertex, indicates the list of polygon containing it
+    std::vector< std::vector<P_ID> > incident_polygons_per_vertex(nb_points);
+    fill_incident_polygons_per_vertex(polygons, incident_polygons_per_vertex);
+
+    V_ID nbv = static_cast<V_ID>( nb_points );
+    for (V_ID v_id = 0; v_id < nbv; ++v_id)
+    {
+      const std::vector< P_ID >& incident_polygons = incident_polygons_per_vertex[v_id];
+
+      if ( incident_polygons.empty() ) continue; //isolated vertex
+      std::set<P_ID> visited_polygons;
+
+      bool first_pass = true;
+      BOOST_FOREACH(P_ID p_id, incident_polygons)
+      {
+        if ( !visited_polygons.insert(p_id).second ) continue; // already visited
+
+        if (!first_pass)
+          return false; //there will be duplicate vertices
+
+        const cpp11::array<V_ID,3>& neighbors = get_neighbor_vertices(v_id,p_id,polygons);
+
+        V_ID next = neighbors[2];
+
+        do{
+          P_ID other_p_id;
+          cpp11::tie(next, other_p_id) = next_cw_vertex_around_source(v_id, next, polygons, edges, marked_edges);
+          if (next==v_id) break;
+          visited_polygons.insert(other_p_id);
+        }
+        while(next!=neighbors[0]);
+
+        if (next==v_id){
+          /// turn the otherway round
+          next = neighbors[0];
+          do{
+            P_ID other_p_id;
+            cpp11::tie(next, other_p_id) = next_ccw_vertex_around_target(next, v_id, polygons, edges, marked_edges);
+            if (next==v_id) break;
+            visited_polygons.insert(other_p_id);
+          }
+          while(true);
+        }
+        first_pass=false;
+      }
+    }
+    return true;
+  }
+};
+} // namespace internal
+
+/**
+ * \ingroup PMP_repairing_grp
+ * tries to consistently orient a soup of polygons in 3D space.
+ * When it is not possible to produce a combinatorial manifold surface,
+ * some points are duplicated.
+ * Because a polygon soup does not have any connectivity (each point
+ * has as many occurences as the number of polygons it belongs to),
+ * duplicating one point (or a pair of points)
+ * amounts to duplicate the polygon to which it belongs.
+ *
+ * These points are either an endpoint of an edge incident to more
+ * than two polygons, an endpoint of an edge between 
+ * two polygons with incompatible orientations (during the re-orientation process),
+ * or more generally a point \a p at which the intersection
+ * of an infinitesimally small ball centered at \a p
+ * with the polygons incident to it is not a topological disk.
+ *
+ * The algorithm is described in \cgalCite{gueziec2001cutting}.
+ *
+ * @tparam PointRange a model of the concepts `RandomAccessContainer`
+ * and `BackInsertionSequence` whose value type is the point type
+ * @tparam PolygonRange a model of the concept `RandomAccessContainer`
+ * whose value_type is a model of the concept `RandomAccessContainer`
+ * whose value_type is `std::size_t`.
+ *
+ * @param points points of the soup of polygons. Some points might be pushed back to resolve
+ *               non-manifold or non-orientability issues.
+ * @param polygons each element in the vector describes a polygon using the index of the points in `points`.
+ *                 If needed the order of the indices of a polygon might be reversed.
+ * @return `true`  if the orientation operation succeded.
+ * @return `false` if some points were duplicated, thus producing a self-intersecting polyhedron.
+ *
+ */
+template <class PointRange, class PolygonRange>
+bool orient_polygon_soup(PointRange& points,
+                         PolygonRange& polygons)
+{
+  std::size_t inital_nb_pts = points.size();
+  internal::Polygon_soup_orienter<PointRange, PolygonRange> orienter(points, polygons);
+  orienter.fill_edge_map();
+  orienter.orient();
+  orienter.duplicate_singular_vertices();
+
+  return inital_nb_pts==points.size();
+}
+
+} }//end namespace CGAL::Polygon_mesh_processing
+
+#endif // CGAL_POLYGON_MESH_PROCESSING_ORIENT_POLYGON_SOUP
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/orientation.h b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/orientation.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/orientation.h
rename to 3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/orientation.h
diff --git a/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h
new file mode 100644
index 0000000..016abfc
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h
@@ -0,0 +1,206 @@
+// Copyright (c) 2009-2013 GeometryFactory (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Laurent Rineau and Ilker O. Yaz
+
+#ifndef CGAL_POLYGON_MESH_PROCESSING_POLYGON_SOUP_TO_POLYGON_MESH
+#define CGAL_POLYGON_MESH_PROCESSING_POLYGON_SOUP_TO_POLYGON_MESH
+
+#include <CGAL/IO/generic_print_polyhedron.h>
+#include <CGAL/Polyhedron_incremental_builder_3.h>
+#include <CGAL/boost/graph/Euler_operations.h>
+#include <CGAL/property_map.h>
+#include <CGAL/Polygon_mesh_processing/orient_polygon_soup.h>
+#include <CGAL/algorithm.h>
+#include <set>
+
+#include <boost/range/size.hpp>
+#include <boost/range/value_type.hpp>
+#include <boost/range/reference.hpp>
+
+namespace CGAL
+{
+namespace Polygon_mesh_processing
+{
+namespace internal
+{
+template <typename PM
+        , typename Point
+        , typename Polygon>
+class Polygon_soup_to_polygon_mesh
+{
+  const std::vector<Point>& _points;
+  const std::vector<Polygon>& _polygons;
+
+  typedef typename boost::property_map<PM, CGAL::vertex_point_t>::type Vpmap;
+  typedef typename boost::property_traits<Vpmap>::value_type Point_3;
+
+  typedef typename boost::graph_traits<PM>::vertex_descriptor vertex_descriptor;
+  typedef typename boost::graph_traits<PM>::halfedge_descriptor halfedge_descriptor;
+  typedef typename boost::graph_traits<PM>::face_descriptor face_descriptor;
+
+public:
+  /**
+  * The constructor for modifier object.
+  * @param points points of the soup of polygons.
+  * @param polygons each element in the vector describes a polygon using the index of the points in the vector.
+  */
+  Polygon_soup_to_polygon_mesh(const std::vector<Point>& points,
+                               const std::vector<Polygon>& polygons)
+    : _points(points),
+      _polygons(polygons)
+  { }
+
+  void operator()(PM& pmesh)
+  {
+    Vpmap vpmap = get(CGAL::vertex_point, pmesh);
+
+    std::vector<vertex_descriptor> vertices(_points.size());
+    for (std::size_t i = 0, end = _points.size(); i < end; ++i)
+    {
+      Point_3 pi(_points[i][0], _points[i][1], _points[i][2]);
+      vertices[i] = add_vertex(pmesh);
+      put(vpmap, vertices[i], pi);
+    }
+
+    for (std::size_t i = 0, end = _polygons.size(); i < end; ++i)
+    {
+      const Polygon& polygon = _polygons[i];
+      const std::size_t size = polygon.size();
+
+      std::vector<vertex_descriptor> vr(size); //vertex range
+      vr.resize(size);
+      for (std::size_t j = 0; j < size; ++j)
+        vr[j] = vertices[polygon[j] ];
+
+      CGAL_assertion_code(face_descriptor fd = )
+      CGAL::Euler::add_face(vr, pmesh);
+      CGAL_assertion(fd != boost::graph_traits<PM>::null_face());
+    }
+  }
+};
+}//end namespace internal
+
+
+  /**
+   * \ingroup PMP_repairing_grp
+   *
+   * returns `true` if the soup of polygons defines a valid polygon
+   * mesh that can be handled by
+   * `CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh()`.
+   * It checks that each edge has at most two incident faces and such an edge
+   * is visited in opposite direction along the two face boundaries,
+   * no polygon has twice the same vertex,
+   * and the polygon soup describes a manifold surface.
+   * This function does not require a range of points as an argument
+   * since the check is purely topological. To each vertex of the mesh
+   * is associated an index that is used in the description of the
+   * boundaries of the polygons provided in `polygons`.
+   *
+   * @tparam PolygonRange a model of the concept `RandomAccessContainer`
+   * whose value_type is a model of the concept `RandomAccessContainer`
+   * whose value_type is `std::size_t`.
+   *
+   * @param polygons each element in the range describes a polygon
+   * using the indices of the vertices.
+   *
+   * @sa `orient_polygon_soup()`
+   */
+  template<class PolygonRange>
+  bool is_polygon_soup_a_polygon_mesh(const PolygonRange& polygons)
+  {
+    typedef typename boost::range_value<
+      typename boost::range_value<
+        PolygonRange>::type >::type V_ID;
+    typedef typename boost::range_value<
+      PolygonRange>::type           Polygon;
+
+    //check there is no duplicated ordered edge, and
+    //check there is no polygon with twice the same vertex
+    std::set< std::pair<V_ID, V_ID> > edge_set;
+    V_ID max_id=0;
+    BOOST_FOREACH(const Polygon& polygon, polygons)
+    {
+      std::size_t nb_edges = boost::size(polygon);
+      if (nb_edges<3) return false;
+
+      std::set<V_ID> polygon_vertices;
+      V_ID prev= *cpp11::prev(boost::end(polygon));
+      BOOST_FOREACH(V_ID id, polygon)
+      {
+        if (max_id<id) max_id=id;
+        if (! edge_set.insert(std::pair<V_ID, V_ID>(prev,id)).second )
+          return false;
+        else
+          prev=id;
+
+        if (!polygon_vertices.insert(id).second)
+          return false;//vertex met twice in the same polygon
+      }
+    }
+
+    //check manifoldness
+    typedef std::vector<V_ID> PointRange;
+    typedef internal::Polygon_soup_orienter<PointRange, PolygonRange> Orienter;
+    typename Orienter::Edge_map edges;
+    typename Orienter::Marked_edges marked_edges;
+    Orienter::fill_edge_map(edges, marked_edges, polygons);
+    //returns false if duplication is necessary
+    return Orienter::has_singular_vertices(static_cast<std::size_t>(max_id+1),polygons,edges,marked_edges);
+  }
+
+  /**
+  * \ingroup PMP_repairing_grp
+  * builds a polygon mesh from a soup of polygons.
+  * @pre the input polygon soup describes a consistently oriented
+  * polygon mesh.
+  *
+  * @tparam PolygonMesh a model of `MutableFaceGraph` with an internal point property map
+  * @tparam Point a point type that has an operator `[]` to access coordinates
+  * @tparam Polygon a `std::vector<std::size_t>` containing the indices
+  *         of the points of the face
+  *
+  * @param points points of the soup of polygons
+  * @param polygons each element in the vector describes a polygon using the index of the points in `points`
+  * @param out the polygon mesh to be built
+  *
+  * @pre `CGAL::Polygon_mesh_processing::is_polygon_soup_a_polygon_mesh(polygons)`
+  *
+  * \sa `CGAL::Polygon_mesh_processing::orient_polygon_soup()`
+  * \sa `CGAL::Polygon_mesh_processing::is_polygon_soup_a_polygon_mesh()`
+  *
+  */
+  template<class PolygonMesh, class Point, class Polygon>
+  void polygon_soup_to_polygon_mesh(
+    const std::vector<Point>& points,
+    const std::vector<Polygon>& polygons,
+    PolygonMesh& out)
+  {
+    CGAL_precondition_msg(is_polygon_soup_a_polygon_mesh(polygons),
+                          "Input soup needs to be a polygon mesh!");
+
+    internal::Polygon_soup_to_polygon_mesh<PolygonMesh, Point, Polygon>
+      converter(points, polygons);
+    converter(out);
+  }
+
+}//end namespace Polygon_mesh_processing
+
+}// end namespace CGAL
+
+#endif // CGAL_POLYGON_MESH_PROCESSING_POLYGON_SOUP_TO_POLYGON_MESH
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/refine.h b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/refine.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/refine.h
rename to 3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/refine.h
diff --git a/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/remesh.h b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/remesh.h
new file mode 100644
index 0000000..8db99ec
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/remesh.h
@@ -0,0 +1,346 @@
+// Copyright (c) 2015 GeometryFactory (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Jane Tournois
+
+#ifndef CGAL_POLYGON_MESH_PROCESSING_REMESH_H
+#define CGAL_POLYGON_MESH_PROCESSING_REMESH_H
+
+#include <CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h>
+
+#include <CGAL/Polygon_mesh_processing/internal/named_function_params.h>
+#include <CGAL/Polygon_mesh_processing/internal/named_params_helper.h>
+
+#ifdef CGAL_PMP_REMESHING_VERBOSE
+#include <CGAL/Timer.h>
+#endif
+
+namespace CGAL {
+
+namespace Polygon_mesh_processing {
+
+/*!
+* \ingroup PMP_meshing_grp
+* @brief remeshes a triangulated region of a polygon mesh.
+* This operation sequentially performs edge splits, edge collapses,
+* edge flips, tangential relaxation and projection to the initial surface
+* to generate a smooth mesh with a prescribed edge length.
+*
+* @tparam PolygonMesh model of `MutableFaceGraph` that 
+*         has an internal property map for `CGAL::vertex_point_t`.
+*         The descriptor types `boost::graph_traits<PolygonMesh>::%face_descriptor`
+*         and `boost::graph_traits<PolygonMesh>::%halfedge_descriptor` must be
+*         models of `Hashable`.
+*         If `PolygonMesh `has an internal property map for `CGAL::face_index_t`,
+*         then it should be initialized
+* @tparam FaceRange range of `boost::graph_traits<PolygonMesh>::%face_descriptor`,
+          model of `Range`. Its iterator type is `InputIterator`.
+* @tparam NamedParameters a sequence of \ref namedparameters
+*
+* @param pmesh a polygon mesh with triangulated surface patches to be remeshed
+* @param faces the range of triangular faces defining one or several surface patches to be remeshed
+* @param target_edge_length the edge length that is targetted in the remeshed patch
+* @param np optional sequence of \ref namedparameters among the ones listed below
+*
+* @pre if constraints protection is activated, the constrained edges should
+* not be longer than 4/3*`target_edge_length`
+*
+* \cgalNamedParamsBegin
+*  \cgalParamBegin{geom_traits} a geometric traits class instance, model of `Kernel`.
+*    Exact constructions kernels are not supported by this function.
+*  \cgalParamEnd
+*  \cgalParamBegin{vertex_point_map} the property map with the points associated
+*    to the vertices of `pmesh`. Instance of a class model of `ReadWritePropertyMap`.
+*  \cgalParamEnd
+*  \cgalParamBegin{number_of_iterations} the number of iterations for the
+*    sequence of atomic operations performed (listed in the above description)
+*  \cgalParamEnd
+*  \cgalParamBegin{edge_is_constrained_map} a property map containing the
+*    constrained-or-not status of each edge of `pmesh`. A constrained edge can be splitted
+*    or collapsed, but not flipped, nor its endpoints moved by smoothing.
+*    Note that patch boundary edges (i.e. incident to only one face in the range)
+*    are always considered as constrained edges.
+*  \cgalParamEnd
+*  \cgalParamBegin{vertex_is_constrained_map} a property map containing the
+*    constrained-or-not status of each vertex of `pmesh`. A constrained vertex
+*    cannot be modified at all during remeshing
+*  \cgalParamEnd
+*  \cgalParamBegin{protect_constraints} If `true`, the edges set as constrained
+*     in `edge_is_constrained_map` (or by default the boundary edges)
+*     are not splitted nor collapsed during remeshing.
+*     Note that around constrained edges that have their length higher than
+*     twice `target_edge_length`, remeshing will fail to provide
+*     good quality results. It can even fail to terminate because of cascading vertex
+*     insertions.
+*  \cgalParamEnd
+*  \cgalParamBegin{face_patch_map} a property map with the patch id's associated to the
+     faces of `faces`. Instance of a class model of `ReadWritePropertyMap`. It gets
+     updated during the remeshing process while new faces are created.
+*  \cgalParamEnd
+*  \cgalParamBegin{number_of_relaxation_steps} the number of iterations of tangential
+*    relaxation that are performed at each iteration of the remeshing process
+*  \cgalParamEnd
+*  \cgalParamBegin{relax_constraints} If `true`, the end vertices of the edges set as
+*    constrained in `edge_is_constrained_map` and boundary edges move along the
+*    constrained polylines they belong to.
+*  \cgalParamEnd
+* \cgalNamedParamsEnd
+*
+* @sa `split_long_edges()`
+*
+*@todo add possibility to provide a functor that projects to a prescribed surface
+*@todo Deal with exact constructions Kernel. The only thing that makes sense is to
+*      guarantee that the output vertices are exactly on the input surface.
+*      To do so, we can do every construction in `double`, and use an exact process for
+*      projection. For each vertex, the `AABB_tree` would be used in an inexact manner
+*      to find the triangle on which projection has to be done. Then, use
+*      `CGAL::intersection(triangle, line)` in the exact constructions kernel to
+*      get a point which is exactly on the surface.
+*
+*/
+template<typename PolygonMesh
+       , typename FaceRange
+       , typename NamedParameters>
+void isotropic_remeshing(const FaceRange& faces
+                       , const double& target_edge_length
+                       , PolygonMesh& pmesh
+                       , const NamedParameters& np)
+{
+  typedef PolygonMesh PM;
+  typedef typename boost::graph_traits<PM>::vertex_descriptor vertex_descriptor;
+  using boost::choose_pmap;
+  using boost::get_param;
+  using boost::choose_param;
+
+#ifdef CGAL_PMP_REMESHING_VERBOSE
+  std::cout << std::endl;
+  CGAL::Timer t;
+  std::cout << "Remeshing parameters...";
+  std::cout.flush();
+  t.start();
+#endif
+
+  typedef typename GetGeomTraits<PM, NamedParameters>::type GT;
+
+  typedef typename GetVertexPointMap<PM, NamedParameters>::type VPMap;
+  VPMap vpmap = choose_pmap(get_param(np, boost::vertex_point),
+                            pmesh,
+                            boost::vertex_point);
+
+  typedef typename boost::lookup_named_param_def <
+      CGAL::edge_is_constrained_t,
+      NamedParameters,
+      internal::Border_constraint_pmap<PM, FaceRange>//default
+    > ::type ECMap;
+  ECMap ecmap = (boost::is_same<ECMap, internal::Border_constraint_pmap<PM, FaceRange> >::value)
+     //avoid constructing the Border_constraint_pmap if it's not used
+    ? choose_param(get_param(np, edge_is_constrained)
+                 , internal::Border_constraint_pmap<PM, FaceRange>(pmesh, faces))
+    : choose_param(get_param(np, edge_is_constrained)
+                 , internal::Border_constraint_pmap<PM, FaceRange>());
+
+  typedef typename boost::lookup_named_param_def <
+      CGAL::vertex_is_constrained_t,
+      NamedParameters,
+      internal::No_constraint_pmap<vertex_descriptor>//default
+    > ::type VCMap;
+  VCMap vcmap = choose_param(get_param(np, vertex_is_constrained),
+                             internal::No_constraint_pmap<vertex_descriptor>());
+
+  typedef typename boost::lookup_named_param_def <
+      CGAL::face_patch_t,
+      NamedParameters,
+      internal::Connected_components_pmap<PM, ECMap>//default
+    > ::type FPMap;
+  FPMap fpmap = (boost::is_same<FPMap, internal::Connected_components_pmap<PM, ECMap> >::value)
+    ? choose_param(get_param(np, face_patch),
+                   internal::Connected_components_pmap<PM, ECMap>(pmesh, ecmap))
+    : choose_param(get_param(np, face_patch),
+                   internal::Connected_components_pmap<PM, ECMap>());//do not compute cc's
+
+  double low = 4. / 5. * target_edge_length;
+  double high = 4. / 3. * target_edge_length;
+
+  bool protect = choose_param(get_param(np, protect_constraints), false);
+  if(protect)
+  {
+    std::string msg("Isotropic remeshing : protect_constraints cannot be set to");
+    msg.append(" true with constraints larger than 4/3 * target_edge_length.");
+    msg.append(" Remeshing aborted.");
+    CGAL_precondition_msg(
+      internal::constraints_are_short_enough(pmesh, ecmap, vpmap, high),
+      msg.c_str());
+  }
+
+#ifdef CGAL_PMP_REMESHING_VERBOSE
+  t.stop();
+  std::cout << "\rRemeshing parameters done ("<< t.time() <<" sec)" << std::endl;
+  std::cout << "Remesher construction...";
+  std::cout.flush();
+  t.reset(); t.start();
+#endif
+
+  typename internal::Incremental_remesher<PM, VPMap, GT, ECMap, VCMap, FPMap>
+    remesher(pmesh, vpmap, protect, ecmap, vcmap, fpmap);
+  remesher.init_remeshing(faces);
+
+#ifdef CGAL_PMP_REMESHING_VERBOSE
+  t.stop();
+  std::cout << " done ("<< t.time() <<" sec)." << std::endl;
+#endif
+
+  unsigned int nb_iterations = choose_param(get_param(np, number_of_iterations), 1);
+  bool smoothing_1d = choose_param(get_param(np, relax_constraints), false);
+  unsigned int nb_laplacian = choose_param(get_param(np, number_of_relaxation_steps), 1);
+
+#ifdef CGAL_PMP_REMESHING_VERBOSE
+  std::cout << std::endl;
+  std::cout << "Remeshing (size = " << target_edge_length;
+  std::cout << ", #iter = " << nb_iterations << ")..." << std::endl;
+  t.reset(); t.start();
+#endif
+
+  for (unsigned int i = 0; i < nb_iterations; ++i)
+  {
+#ifdef CGAL_PMP_REMESHING_VERBOSE
+    std::cout << " * Iteration " << (i + 1) << " *" << std::endl;
+#endif
+
+    remesher.split_long_edges(high);
+    remesher.collapse_short_edges(low, high);
+    remesher.equalize_valences();
+    remesher.tangential_relaxation(smoothing_1d, nb_laplacian);
+    remesher.project_to_surface();
+
+#ifdef CGAL_PMP_REMESHING_VERBOSE
+    std::cout << std::endl;
+#endif
+  }
+
+  remesher.update_constraints_property_map();
+
+#ifdef CGAL_PMP_REMESHING_VERBOSE
+  t.stop();
+  std::cout << "Remeshing done (size = " << target_edge_length;
+  std::cout << ", #iter = " << nb_iterations;
+  std::cout << ", " << t.time() << " sec )." << std::endl;
+#endif
+}
+
+template<typename PolygonMesh
+       , typename FaceRange>
+void isotropic_remeshing(
+    const FaceRange& faces
+  , const double& target_edge_length
+  , PolygonMesh& pmesh)
+{
+  isotropic_remeshing(
+    faces,
+    target_edge_length,
+    pmesh,
+    parameters::all_default());
+}
+
+/*!
+* \ingroup PMP_meshing_grp
+* @brief splits the edges listed in `edges` into sub-edges
+* that are not longer than the given threshold `max_length`.
+*
+* Note this function is useful to split constrained edges before
+* calling `isotropic_remeshing()` with protection of constraints
+* activated (to match the constrained edge length required by the
+* remeshing algorithm to be guaranteed to terminate)
+*
+* @tparam PolygonMesh model of `MutableFaceGraph` that
+*         has an internal property map for `CGAL::vertex_point_t`.
+* @tparam EdgeRange range of `boost::graph_traits<PolygonMesh>::%edge_descriptor`,
+*   model of `Range`. Its iterator type is `InputIterator`.
+* @tparam NamedParameters a sequence of \ref namedparameters
+*
+* @param pmesh a polygon mesh
+* @param edges the range of edges to be split if they are longer than given threshold
+* @param max_length the edge length above which an edge from `edges` is split
+*        into to sub-edges
+* @param np optional \ref namedparameters described below
+
+* \cgalNamedParamsBegin
+*  \cgalParamBegin{vertex_point_map} the property map with the points associated
+*    to the vertices of `pmesh`. Instance of a class model of `ReadWritePropertyMap`.
+*  \cgalParamEnd
+* \cgalNamedParamsEnd
+*
+* @sa `isotropic_remeshing()`
+*
+*/
+template<typename PolygonMesh
+       , typename EdgeRange
+       , typename NamedParameters>
+void split_long_edges(const EdgeRange& edges
+                    , const double& max_length
+                    , PolygonMesh& pmesh
+                    , const NamedParameters& np)
+{
+  typedef PolygonMesh PM;
+  typedef typename boost::graph_traits<PM>::edge_descriptor edge_descriptor;
+  typedef typename boost::graph_traits<PM>::vertex_descriptor vertex_descriptor;
+  using boost::choose_pmap;
+  using boost::choose_param;
+  using boost::get_param;
+
+  typedef typename GetGeomTraits<PM, NamedParameters>::type GT;
+  typedef typename GetVertexPointMap<PM, NamedParameters>::type VPMap;
+  VPMap vpmap = choose_pmap(get_param(np, boost::vertex_point),
+                            pmesh,
+                            boost::vertex_point);
+
+  typedef typename boost::lookup_named_param_def <
+        CGAL::edge_is_constrained_t,
+        NamedParameters,
+        internal::No_constraint_pmap<edge_descriptor>//default
+      > ::type ECMap;
+  ECMap ecmap = choose_param(get_param(np, edge_is_constrained),
+                             internal::No_constraint_pmap<edge_descriptor>());
+  
+  typename internal::Incremental_remesher<PM, VPMap, GT, ECMap,
+    internal::No_constraint_pmap<vertex_descriptor>,
+    internal::Connected_components_pmap<PM, ECMap>
+  >
+    remesher(pmesh, vpmap, false/*protect constraints*/
+           , ecmap
+           , internal::No_constraint_pmap<vertex_descriptor>()
+           , internal::Connected_components_pmap<PM, ECMap>()
+           , false/*need aabb_tree*/);
+
+  remesher.split_long_edges(edges, max_length);
+}
+
+template<typename PolygonMesh, typename EdgeRange>
+void split_long_edges(const EdgeRange& edges
+                    , const double& max_length
+                    , PolygonMesh& pmesh)
+{
+  split_long_edges(edges,
+    max_length,
+    pmesh,
+    parameters::all_default());
+}
+
+} //end namespace Polygon_mesh_processing
+} //end namespace CGAL
+
+#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/repair.h b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/repair.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/repair.h
rename to 3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/repair.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/self_intersections.h b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/self_intersections.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/self_intersections.h
rename to 3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/self_intersections.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/stitch_borders.h b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/stitch_borders.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_processing/stitch_borders.h
rename to 3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/stitch_borders.h
diff --git a/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/triangulate_faces.h b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/triangulate_faces.h
new file mode 100644
index 0000000..76687bf
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/triangulate_faces.h
@@ -0,0 +1,433 @@
+// Copyright (c) 2010-2011  GeometryFactory Sarl (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
+// 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(s)     : Laurent Rineau
+
+#ifndef CGAL_POLYGON_MESH_PROCESSING_TRIANGULATE_FACES_H
+#define CGAL_POLYGON_MESH_PROCESSING_TRIANGULATE_FACES_H
+
+#include <CGAL/HalfedgeDS_decorator.h>
+#include <CGAL/boost/graph/helpers.h>
+#include <CGAL/boost/graph/Euler_operations.h>
+
+#include <CGAL/Triangulation_vertex_base_with_info_2.h>
+#include <CGAL/Triangulation_face_base_with_info_2.h>
+#include <CGAL/Constrained_Delaunay_triangulation_2.h>
+#include <CGAL/Triangulation_2_projection_traits_3.h>
+
+#include <CGAL/Polygon_mesh_processing/compute_normal.h>
+#include <CGAL/Polygon_mesh_processing/internal/named_function_params.h>
+#include <CGAL/Polygon_mesh_processing/internal/named_params_helper.h>
+
+#include <boost/range/size.hpp>
+#include <boost/foreach.hpp>
+
+#include <queue>
+#include <vector>
+#include <utility>
+
+namespace CGAL {
+
+namespace Polygon_mesh_processing {
+
+namespace internal {
+
+template <class PM
+          , typename VertexPointMap
+          , typename Kernel>
+class Triangulate_modifier
+{
+  typedef Kernel Traits;
+
+  typedef typename boost::graph_traits<PM>::vertex_descriptor vertex_descriptor;
+  typedef typename boost::graph_traits<PM>::halfedge_descriptor halfedge_descriptor;
+  typedef typename boost::graph_traits<PM>::face_descriptor face_descriptor;
+  typedef typename boost::graph_traits<PM>::edge_descriptor edge_descriptor;
+  typedef typename Kernel::Point_3 Point;
+
+  typedef CGAL::Triangulation_2_projection_traits_3<Traits>   P_traits;
+
+  typedef CGAL::Triangulation_vertex_base_with_info_2<halfedge_descriptor,
+                                                      P_traits>        Vb;
+
+  struct Face_info {
+    typename boost::graph_traits<PM>::halfedge_descriptor e[3];
+    bool is_external;
+  };
+
+  typedef CGAL::Triangulation_face_base_with_info_2<Face_info,
+                                                    P_traits>          Fb1;
+  typedef CGAL::Constrained_triangulation_face_base_2<P_traits, Fb1>   Fb;
+  typedef CGAL::Triangulation_data_structure_2<Vb,Fb>                  TDS;
+  typedef CGAL::Exact_intersections_tag                                Itag;
+  typedef CGAL::Constrained_Delaunay_triangulation_2<P_traits,
+                                                     TDS,
+                                                     Itag>             CDT;
+
+  typedef typename boost::property_traits<VertexPointMap>::reference Point_ref;
+  VertexPointMap _vpmap;
+
+public:
+  Triangulate_modifier(VertexPointMap vpmap)
+    : _vpmap(vpmap)
+  {
+  }
+
+  bool is_external(typename CDT::Face_handle fh) const {
+    return fh->info().is_external;
+  }
+
+  bool triangulate_face(face_descriptor f, PM& pmesh)
+  {
+    typedef typename Traits::FT FT;
+    typename Traits::Vector_3 normal =
+      Polygon_mesh_processing::compute_face_normal(f, pmesh);
+    if(normal == typename Traits::Vector_3(0,0,0))
+      return false;
+    std::size_t original_size = CGAL::halfedges_around_face(halfedge(f, pmesh), pmesh).size();
+    if(original_size == 4)
+    {
+      halfedge_descriptor v0, v1, v2, v3;
+      v0 = halfedge(f, pmesh);
+      Point_ref p0 = _vpmap[target(v0, pmesh)];
+      v1 = next(v0, pmesh);
+      Point_ref p1 = _vpmap[target(v1, pmesh)];
+      v2 = next(v1, pmesh);
+      Point_ref p2 = _vpmap[target(v2, pmesh)];
+      v3 = next(v2, pmesh);
+      Point_ref p3 = _vpmap[target(v3, pmesh)];
+
+      /* Chooses the diagonal that will split the quad in two triangles that maximize
+       * the scalar product of of the un-normalized normals of the two triangles.
+       * The lengths of the un-normalized normals (computed using cross-products of two vectors)
+       *  are proportional to the area of the triangles.
+       * Maximize the scalar product of the two normals will avoid skinny triangles,
+       * and will also taken into account the cosine of the angle between the two normals.
+       * In particular, if the two triangles are oriented in different directions,
+       * the scalar product will be negative.
+       */
+      FT p1p3 = CGAL::cross_product(p2-p1,p3-p2) * CGAL::cross_product(p0-p3,p1-p0);
+      FT p0p2 = CGAL::cross_product(p1-p0,p1-p2) * CGAL::cross_product(p3-p2,p3-p0);
+      if(p0p2>p1p3)
+      {
+        CGAL::Euler::split_face(v0, v2, pmesh);
+      }
+      else
+      {
+        CGAL::Euler::split_face(v1, v3, pmesh);
+      }
+    }
+    else
+    {
+      P_traits cdt_traits(normal);
+      CDT cdt(cdt_traits);
+
+      // Halfedge_around_facet_circulator
+      typedef typename CDT::Vertex_handle Tr_Vertex_handle;
+      halfedge_descriptor start = halfedge(f, pmesh);
+      halfedge_descriptor h = start;
+      Tr_Vertex_handle previous, first;
+      do
+      {
+        Tr_Vertex_handle vh = cdt.insert(_vpmap[target(h, pmesh)]);
+        if (first == Tr_Vertex_handle()) {
+          first = vh;
+        }
+        vh->info() = h;
+        if(previous != Tr_Vertex_handle() && previous != vh) {
+          cdt.insert_constraint(previous, vh);
+        }
+        previous = vh;
+        h = next(h, pmesh);
+
+      } while( h != start );
+      cdt.insert_constraint(previous, first);
+
+      // sets mark is_external
+      for(typename CDT::All_faces_iterator fit = cdt.all_faces_begin(),
+            end = cdt.all_faces_end();
+          fit != end; ++fit)
+      {
+        fit->info().is_external = false;
+      }
+      std::queue<typename CDT::Face_handle> face_queue;
+      face_queue.push(cdt.infinite_vertex()->face());
+      while(! face_queue.empty() )
+      {
+        typename CDT::Face_handle fh = face_queue.front();
+        face_queue.pop();
+
+        if(fh->info().is_external)
+          continue;
+
+        fh->info().is_external = true;
+        for(int i = 0; i <3; ++i)
+        {
+          if(!cdt.is_constrained(typename CDT::Edge(fh, i)))
+          {
+            face_queue.push(fh->neighbor(i));
+          }
+        }
+      }
+
+      if(cdt.dimension() != 2 ||
+         cdt.number_of_vertices() != original_size)
+        return false;
+
+
+      // then modify the polyhedron
+      // make_hole. (see comment in function body)
+      this->make_hole(halfedge(f, pmesh), pmesh);
+
+      for(typename CDT::Finite_edges_iterator eit = cdt.finite_edges_begin(),
+            end = cdt.finite_edges_end();
+          eit != end; ++eit)
+      {
+        typename CDT::Face_handle fh = eit->first;
+        const int index = eit->second;
+        typename CDT::Face_handle opposite_fh = fh->neighbor(eit->second);
+        const int opposite_index = opposite_fh->index(fh);
+
+        const Tr_Vertex_handle va = fh->vertex(cdt. cw(index));
+        const Tr_Vertex_handle vb = fh->vertex(cdt.ccw(index));
+
+        if( ! (is_external(fh) && is_external(opposite_fh))//not both fh are external
+            && ! cdt.is_constrained(*eit) )                  //and edge is not constrained
+        {
+          // strictly internal edge
+          halfedge_descriptor hnew = halfedge(add_edge(pmesh), pmesh),
+            hnewopp = opposite(hnew, pmesh);
+
+          fh->info().e[index] = hnew;
+          opposite_fh->info().e[opposite_index] = hnewopp;
+
+          set_target(hnew,    target(va->info(), pmesh), pmesh);
+          set_target(hnewopp, target(vb->info(), pmesh), pmesh);
+        }
+        if( cdt.is_constrained(*eit) ) //edge is constrained
+        {
+          if(!is_external(fh)) {
+            fh->info().e[index] = va->info();
+          }
+          if(!is_external(opposite_fh)) {
+            opposite_fh->info().e[opposite_index] = vb->info();
+          }
+        }
+      }
+      for(typename CDT::Finite_faces_iterator fit = cdt.finite_faces_begin(),
+            end = cdt.finite_faces_end();
+          fit != end; ++fit)
+      {
+        if(!is_external(fit))
+        {
+          halfedge_descriptor h0 = fit->info().e[0];
+          halfedge_descriptor h1 = fit->info().e[1];
+          halfedge_descriptor h2 = fit->info().e[2];
+          CGAL_assertion(h0 != halfedge_descriptor());
+          CGAL_assertion(h1 != halfedge_descriptor());
+          CGAL_assertion(h2 != halfedge_descriptor());
+
+          set_next(h0, h1, pmesh);
+          set_next(h1, h2, pmesh);
+          set_next(h2, h0, pmesh);
+
+          Euler::fill_hole(h0, pmesh);
+        }
+      }
+    }
+    return true;
+  }
+
+  template<typename FaceRange>
+  bool operator()(FaceRange face_range, PM& pmesh)
+  {
+   bool result = true;
+    // One need to store facet handles into a vector, because the list of
+    // facets of the polyhedron will be modified during the loop, and
+    // that invalidates the range [facets_begin(), facets_end()[.
+    std::vector<face_descriptor> facets;
+    facets.reserve(std::distance(boost::begin(face_range), boost::end(face_range)));
+
+    //only consider non-triangular faces
+    BOOST_FOREACH(face_descriptor fit, face_range)
+      if ( next( next( halfedge(fit, pmesh), pmesh), pmesh)
+        !=       prev( halfedge(fit, pmesh), pmesh) )
+        facets.push_back(fit);
+
+    // Iterates on the vector of face descriptors
+    BOOST_FOREACH(face_descriptor f, facets)
+    {
+     if(!this->triangulate_face(f, pmesh))
+       result = false;
+    }
+    return result;
+  }
+
+  void make_hole(halfedge_descriptor h, PM& pmesh)
+  {
+    //we are not using Euler::make_hole because it has a precondition
+    //that the hole is not made on the boundary of the mesh
+    //here we allow making a hole on the boundary, and the pair(s) of
+    //halfedges that become border-border are fixed by the connectivity
+    //setting made in operator()
+    CGAL_assertion(!is_border(h, pmesh));
+    face_descriptor fd = face(h, pmesh);
+
+    BOOST_FOREACH(halfedge_descriptor hd, halfedges_around_face(h, pmesh))
+    {
+      CGAL::internal::set_border(hd, pmesh);
+    }
+    remove_face(fd, pmesh);
+  }
+
+
+}; // end class Triangulate_modifier
+
+}//end namespace internal
+
+/**
+* \ingroup PMP_meshing_grp
+* triangulates a single face of a polygon mesh. This function depends on the package \ref PkgTriangulation2Summary
+* @tparam PolygonMesh a model of `FaceListGraph` and `MutableFaceGraph`
+*         that has an internal property map for `boost::vertex_point_t`
+* @tparam NamedParameters a sequence of \ref namedparameters
+*
+* @param f face to be triangulated
+* @param pmesh the polygon mesh to which the face to be triangulated belongs
+* @param np optional sequence of \ref namedparameters among the ones listed below
+*
+*
+* \cgalNamedParamsBegin
+*    \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh` \cgalParamEnd
+*    \cgalParamBegin{geom_traits} a geometric traits class instance \cgalParamEnd
+* \cgalNamedParamsEnd
+*
+* @return `true` if the face has been triangulated.
+*/
+template<typename PolygonMesh, typename NamedParameters>
+bool  triangulate_face(typename boost::graph_traits<PolygonMesh>::face_descriptor f,
+                      PolygonMesh& pmesh,
+                      const NamedParameters& np)
+{
+  using boost::choose_const_pmap;
+  using boost::get_param;
+
+  //VertexPointMap
+  typedef typename GetVertexPointMap<PolygonMesh, NamedParameters>::type VPMap;
+  VPMap vpmap = choose_pmap(get_param(np, boost::vertex_point),
+                            pmesh,
+                            boost::vertex_point);
+  //Kernel
+  typedef typename GetGeomTraits<PolygonMesh, NamedParameters>::type Kernel;
+
+  internal::Triangulate_modifier<PolygonMesh, VPMap, Kernel> modifier(vpmap);
+  return modifier.triangulate_face(f, pmesh);
+}
+
+template<typename PolygonMesh>
+bool triangulate_face(typename boost::graph_traits<PolygonMesh>::face_descriptor f,
+                      PolygonMesh& pmesh)
+{
+  return triangulate_face(f, pmesh, CGAL::Polygon_mesh_processing::parameters::all_default());
+}
+
+/**
+* \ingroup PMP_meshing_grp
+* triangulates given faces of a polygon mesh. This function depends on the package \ref PkgTriangulation2Summary
+*
+* @tparam FaceRange range of `boost::graph_traits<PolygonMesh>::%face_descriptor`,
+          model of `Range`.
+          Its iterator type is `InputIterator`.
+* @tparam PolygonMesh a model of `FaceListGraph` and `MutableFaceGraph`
+*         that has an internal property map for `boost::vertex_point_t`
+* @tparam NamedParameters a sequence of \ref namedparameters
+*
+* @param face_range the range of faces to be triangulated
+* @param pmesh the polygon mesh to be triangulated
+* @param np optional sequence of \ref namedparameters among the ones listed below
+*
+* \cgalNamedParamsBegin
+*    \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh` \cgalParamEnd
+*    \cgalParamBegin{geom_traits} a geometric traits class instance \cgalParamEnd
+* \cgalNamedParamsEnd
+*
+* @return `true` if all the faces have been triangulated.
+* @see triangulate_face()
+*/
+template <typename FaceRange, typename PolygonMesh, typename NamedParameters>
+bool triangulate_faces(FaceRange face_range,
+                       PolygonMesh& pmesh,
+                       const NamedParameters& np)
+{
+  using boost::choose_const_pmap;
+  using boost::get_param;
+
+  //VertexPointMap
+  typedef typename GetVertexPointMap<PolygonMesh, NamedParameters>::type VPMap;
+  VPMap vpmap = choose_pmap(get_param(np, boost::vertex_point),
+                            pmesh,
+                            boost::vertex_point);
+  //Kernel
+  typedef typename GetGeomTraits<PolygonMesh, NamedParameters>::type Kernel;
+
+  internal::Triangulate_modifier<PolygonMesh, VPMap, Kernel> modifier(vpmap);
+  return modifier(face_range, pmesh);
+}
+
+template <typename FaceRange, typename PolygonMesh>
+bool triangulate_faces(FaceRange face_range, PolygonMesh& pmesh)
+{
+  return triangulate_faces(face_range, pmesh, CGAL::Polygon_mesh_processing::parameters::all_default());
+}
+
+/**
+* \ingroup PMP_meshing_grp
+* triangulates all faces of a polygon mesh. This function depends on the package \ref PkgTriangulation2Summary
+* @tparam PolygonMesh a model of `FaceListGraph` and `MutableFaceGraph`
+*         that has an internal property map for `boost::vertex_point_t`
+* @tparam NamedParameters a sequence of \ref namedparameters
+*
+* @param pmesh the polygon mesh to be triangulated
+* @param np optional sequence of \ref namedparameters among the ones listed below
+*
+* \cgalNamedParamsBegin
+*    \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh` \cgalParamEnd
+*    \cgalParamBegin{geom_traits} a geometric traits class instance \cgalParamEnd
+* \cgalNamedParamsEnd
+*
+* @return `true` if all the faces have been triangulated.
+* @see triangulate_face()
+*/
+template <typename PolygonMesh, typename NamedParameters>
+bool  triangulate_faces(PolygonMesh& pmesh,
+                       const NamedParameters& np)
+{
+  return triangulate_faces(faces(pmesh), pmesh, np);
+}
+
+template <typename PolygonMesh>
+bool triangulate_faces(PolygonMesh& pmesh)
+{
+  return triangulate_faces(faces(pmesh), pmesh, CGAL::Polygon_mesh_processing::parameters::all_default());
+}
+
+} // end namespace Polygon_mesh_processing
+
+} // end namespace CGAL
+
+#endif // CGAL_POLYGON_MESH_PROCESSING_TRIANGULATE_FACES_H
diff --git a/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/triangulate_hole.h b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/triangulate_hole.h
new file mode 100644
index 0000000..f03f7d1
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polygon_mesh_processing/triangulate_hole.h
@@ -0,0 +1,407 @@
+// Copyright (c) 2015 GeometryFactory (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Ilker O. Yaz
+
+#ifndef CGAL_POLYGON_MESH_PROCESSING_TRIANGULATE_HOLE_H
+#define CGAL_POLYGON_MESH_PROCESSING_TRIANGULATE_HOLE_H
+
+#include <CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polygon_mesh.h>
+#include <CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h>
+#include <CGAL/Polygon_mesh_processing/refine.h>
+#include <CGAL/Polygon_mesh_processing/fair.h>
+
+#include <CGAL/Polygon_mesh_processing/internal/named_function_params.h>
+#include <CGAL/Polygon_mesh_processing/internal/named_params_helper.h>
+
+#include <CGAL/boost/graph/helpers.h>
+
+#include <boost/tuple/tuple.hpp>
+
+#include <vector>
+
+namespace CGAL {
+
+namespace Polygon_mesh_processing {
+
+  /*!
+  \ingroup hole_filling_grp
+  triangulates a hole in a polygon mesh.
+  The hole must not contain any non-manifold vertex,
+  nor self-intersections.
+  The patch generated does not introduce non-manifold edges nor degenerate triangles.
+  If a hole cannot be triangulated, `pmesh` is not modified and nothing is recorded in `out`.
+
+  @tparam PolygonMesh a model of `MutableFaceGraph`
+          that has an internal property map for `CGAL::vertex_point_t`
+  @tparam OutputIterator a model of `OutputIterator`
+    holding `boost::graph_traits<PolygonMesh>::%face_descriptor` for patch faces.
+  @tparam NamedParameters a sequence of \ref namedparameters
+
+  @param pmesh polygon mesh containing the hole
+  @param border_halfedge a border halfedge incident to the hole
+  @param out iterator over patch faces
+  @param np optional sequence of \ref namedparameters among the ones listed below
+
+  \cgalNamedParamsBegin
+     \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh` \cgalParamEnd
+     \cgalParamBegin{use_delaunay_triangulation} if `true`, use the Delaunay triangulation facet search space \cgalParamEnd
+     \cgalParamBegin{geom_traits} a geometric traits class instance \cgalParamEnd
+  \cgalNamedParamsEnd
+
+  @return `out`
+
+  \todo handle islands
+  @todo Replace border_halfedge by a range of border halfedges.
+        The first one would describe the hole,
+        the other ones would describe the islands.
+  @todo Then, insert the holes vertices in the set of possibilities
+        for connecting vertices together
+  @todo handle the case where an island is reduced to a point
+  */  
+  template<typename PolygonMesh,
+           typename OutputIterator,
+           typename NamedParameters>
+  OutputIterator
+  triangulate_hole(PolygonMesh& pmesh,
+              typename boost::graph_traits<PolygonMesh>::halfedge_descriptor border_halfedge,
+              OutputIterator out,
+              const NamedParameters& np)
+  {
+    using boost::choose_param;
+    using boost::get_param;
+
+    bool use_dt3 =
+#ifdef CGAL_HOLE_FILLING_DO_NOT_USE_DT3
+      false;
+#else
+      choose_param(get_param(np, use_delaunay_triangulation), true);
+#endif
+
+    CGAL_precondition(face(border_halfedge, pmesh) == boost::graph_traits<PolygonMesh>::null_face());
+
+    return internal::triangulate_hole_polygon_mesh(pmesh,
+      border_halfedge,
+      out,
+      choose_param(get_param(np, vertex_point), get(CGAL::vertex_point, pmesh)),
+      use_dt3,
+      choose_param(get_param(np, geom_traits), typename GetGeomTraits<PolygonMesh,NamedParameters>::type()))
+      .first;
+  }
+
+  template<typename PolygonMesh, typename OutputIterator>
+  OutputIterator
+    triangulate_hole(PolygonMesh& pmesh,
+      typename boost::graph_traits<PolygonMesh>::halfedge_descriptor border_halfedge,
+      OutputIterator out)
+  {
+    return triangulate_hole(pmesh, border_halfedge, out,
+      CGAL::Polygon_mesh_processing::parameters::all_default());
+  }
+
+  template<typename PM, typename VertexRange>
+  void test_in_edges(const PM& pmesh, const VertexRange& patch)
+  {
+    BOOST_FOREACH(typename boost::graph_traits<PM>::vertex_descriptor v0, patch)
+    {
+      typename boost::graph_traits<PM>::in_edge_iterator e, e_end;
+      for (boost::tie(e, e_end) = in_edges(v0, pmesh); e != e_end; e++)
+      {
+        typename boost::graph_traits<PM>::halfedge_descriptor he = halfedge(*e, pmesh);
+        if (is_border(he, pmesh)) { continue; }
+
+        CGAL_assertion(v0 == target(he, pmesh) || v0 == source(he, pmesh));
+      }
+    }
+  }
+
+  /*!
+  \ingroup  hole_filling_grp
+  @brief triangulates and refines a hole in a polygon mesh.
+
+  @tparam PolygonMesh must be model of `MutableFaceGraph`
+          that has an internal property map for `CGAL::vertex_point_t`
+  @tparam FacetOutputIterator model of `OutputIterator`
+     holding `boost::graph_traits<PolygonMesh>::%face_descriptor` for patch faces.
+  @tparam VertexOutputIterator model of `OutputIterator`
+     holding `boost::graph_traits<PolygonMesh>::%vertex_descriptor` for patch vertices.
+  @tparam NamedParameters a sequence of \ref namedparameters
+
+  @param pmesh polygon mesh which has the hole
+  @param border_halfedge a border halfedge incident to the hole
+  @param face_out output iterator over patch faces
+  @param vertex_out output iterator over patch vertices without including the boundary
+  @param np optional sequence of \ref namedparameters among the ones listed below
+
+  \cgalNamedParamsBegin
+     \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh` \cgalParamEnd
+     \cgalParamBegin{density_control_factor} factor to control density of the ouput mesh, where larger values cause denser refinements, as in `refine()` \cgalParamEnd
+     \cgalParamBegin{use_delaunay_triangulation} if `true`, use the Delaunay triangulation facet search space \cgalParamEnd
+     \cgalParamBegin{geom_traits} a geometric traits class instance \cgalParamEnd
+  \cgalNamedParamsEnd
+
+  @return pair of `face_out` and `vertex_out`
+
+  \sa CGAL::Polygon_mesh_processing::triangulate_hole()
+  \sa CGAL::Polygon_mesh_processing::refine()
+
+  \todo handle islands
+  */
+  template<typename PolygonMesh,
+           typename FaceOutputIterator,
+           typename VertexOutputIterator,
+           typename NamedParameters>
+  std::pair<FaceOutputIterator, VertexOutputIterator>
+    triangulate_and_refine_hole(PolygonMesh& pmesh,
+      typename boost::graph_traits<PolygonMesh>::halfedge_descriptor border_halfedge,
+      FaceOutputIterator face_out,
+      VertexOutputIterator vertex_out,
+      const NamedParameters& np)
+  {
+    std::vector<typename boost::graph_traits<PolygonMesh>::face_descriptor> patch;
+    triangulate_hole(pmesh, border_halfedge, std::back_inserter(patch), np);
+    face_out = std::copy(patch.begin(), patch.end(), face_out);
+
+    test_in_edges(pmesh, vertices(pmesh));
+
+    return refine(pmesh, patch, face_out, vertex_out, np);
+  }
+
+  template<typename PolygonMesh,
+           typename FaceOutputIterator,
+           typename VertexOutputIterator>
+  std::pair<FaceOutputIterator, VertexOutputIterator>
+    triangulate_and_refine_hole(PolygonMesh& pmesh,
+       typename boost::graph_traits<PolygonMesh>::halfedge_descriptor border_halfedge,
+       FaceOutputIterator face_out,
+       VertexOutputIterator vertex_out)
+  {
+    return triangulate_and_refine_hole(pmesh, border_halfedge,
+      face_out, vertex_out,
+      CGAL::Polygon_mesh_processing::parameters::all_default());
+  }
+
+  /*!
+  \ingroup  hole_filling_grp
+  @brief triangulates, refines and fairs a hole in a polygon mesh.
+
+  @tparam PolygonMesh a model of `MutableFaceGraph`
+          that has an internal property map for `CGAL::vertex_point_t`
+  @tparam FaceOutputIterator model of `OutputIterator`
+      holding `boost::graph_traits<PolygonMesh>::%face_descriptor` for patch faces
+  @tparam VertexOutputIterator model of `OutputIterator`
+      holding `boost::graph_traits<PolygonMesh>::%vertex_descriptor` for patch vertices
+  @tparam NamedParameters a sequence of \ref namedparameters
+
+  @param pmesh polygon mesh which has the hole
+  @param border_halfedge a border halfedge incident to the hole
+  @param face_out output iterator over patch faces
+  @param vertex_out output iterator over patch vertices without including the boundary
+  @param np optional sequence of \ref namedparameters among the ones listed below
+
+  \cgalNamedParamsBegin
+     \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh` \cgalParamEnd
+     \cgalParamBegin{use_delaunay_triangulation} if `true`, use the Delaunay triangulation facet search space \cgalParamEnd
+     \cgalParamBegin{density_control_factor} factor to control density of the ouput mesh, where larger values cause denser refinements, as in `refine()` \cgalParamEnd
+     \cgalParamBegin{fairing_continuity} tangential continuity of the output surface patch \cgalParamEnd
+     \cgalParamBegin{sparse_linear_solver} an instance of the sparse linear solver used for fairing \cgalParamEnd
+     \cgalParamBegin{geom_traits} a geometric traits class instance \cgalParamEnd
+  \cgalNamedParamsEnd
+
+  @return tuple of
+  - `bool`: `true` if fairing is successful
+  - `face_out`
+  - `vertex_out`
+
+  \sa CGAL::Polygon_mesh_processing::triangulate_hole()
+  \sa CGAL::Polygon_mesh_processing::refine()
+  \sa CGAL::Polygon_mesh_processing::fair()
+
+  \todo handle islands
+  */
+  template<typename PolygonMesh,
+           typename FaceOutputIterator,
+           typename VertexOutputIterator,
+           typename NamedParameters>
+  CGAL::cpp11::tuple<bool, FaceOutputIterator, VertexOutputIterator>
+  triangulate_refine_and_fair_hole(PolygonMesh& pmesh,
+    typename boost::graph_traits<PolygonMesh>::halfedge_descriptor border_halfedge,
+    FaceOutputIterator face_out,
+    VertexOutputIterator vertex_out,
+    const NamedParameters& np)
+  {
+    std::vector<typename boost::graph_traits<PolygonMesh>::vertex_descriptor> patch;
+
+    CGAL_assertion(CGAL::is_triangle_mesh(pmesh));
+
+    face_out = triangulate_and_refine_hole
+      (pmesh, border_halfedge, face_out, std::back_inserter(patch), np).first;
+
+    CGAL_assertion(CGAL::is_triangle_mesh(pmesh));
+
+    test_in_edges(pmesh, patch);
+
+    bool fair_success = fair(pmesh, patch, np);
+
+    vertex_out = std::copy(patch.begin(), patch.end(), vertex_out);
+    return CGAL::cpp11::make_tuple(fair_success, face_out, vertex_out);
+  }
+
+  template<typename PolygonMesh,
+           typename FaceOutputIterator,
+           typename VertexOutputIterator>
+  CGAL::cpp11::tuple<bool, FaceOutputIterator, VertexOutputIterator>
+  triangulate_refine_and_fair_hole(PolygonMesh& pmesh,
+        typename boost::graph_traits<PolygonMesh>::halfedge_descriptor border_halfedge,
+        FaceOutputIterator face_out,
+        VertexOutputIterator vertex_out)
+  {
+    return triangulate_refine_and_fair_hole(pmesh, border_halfedge,
+      face_out, vertex_out,
+      CGAL::Polygon_mesh_processing::parameters::all_default());
+  }
+
+  /*!
+  \ingroup  hole_filling_grp
+  creates triangles to fill the hole defined by points in the range `points`.
+  Triangles are recorded into `out` using the indices of the input points in the range `points`.
+  Note that no degenerate triangles will be produced.
+  If no triangulation can be found, then nothing is recorded in `out`.
+
+  If faces incident to the polyline outside the hole are known,
+  it is recommended to use this function.
+  The point range `third_points` indicates for each pair of consecutive points in the range `points`,
+  the third point of the face this segment is incident to. It influences the choice
+  of the best triangulation while avoiding overfolding.
+
+  Note that the ranges `points` and `third_points` may or may not contain duplicated first point at the end of sequence.
+
+  @pre `third_points.size() == points.size()`
+
+  @tparam PointRange range of points, model of `Range`.
+    Its iterator type is `InputIterator`.
+  @tparam OutputIterator model of `OutputIterator`, to collect patch faces.
+     A specialization for `CGAL::value_type_traits<OutputIterator>` must be available,
+     and the corresponding value type `type` must have
+     a constructor `type(int p0, int p1, int p2)` available.
+     The indices correspond to the ones of input points in `points`.
+  @tparam NamedParameters a sequence of \ref namedparameters
+
+  @param points the range of input points
+  @param third_points the range of third points
+  @param out iterator over output patch triangles, described by indices of points
+             in `points`
+  @param np optional sequence of \ref namedparameters among the ones listed below
+
+  \cgalNamedParamsBegin
+     \cgalParamBegin{use_delaunay_triangulation} if `true`, use the Delaunay triangulation facet search space \cgalParamEnd
+     \cgalParamBegin{geom_traits} a geometric traits class instance \cgalParamEnd
+  \cgalNamedParamsEnd
+
+  \todo handle islands
+  */
+  template <typename PointRange1,
+            typename PointRange2,
+            typename OutputIterator,
+            typename NamedParameters>
+  OutputIterator
+  triangulate_hole_polyline(const PointRange1& points,
+                            const PointRange2& third_points,
+                            OutputIterator out,
+                            const NamedParameters& np)
+  {
+    using boost::choose_param;
+    using boost::get_param;
+
+    bool use_dt3 =
+#ifdef CGAL_HOLE_FILLING_DO_NOT_USE_DT3
+      false;
+#else
+      choose_param(get_param(np, use_delaunay_triangulation), true);
+#endif
+
+    typedef CGAL::internal::Weight_min_max_dihedral_and_area      Weight;
+    typedef CGAL::internal::Weight_calculator<Weight,
+                  CGAL::internal::Is_not_degenerate_triangle>  WC;
+    typedef std::vector<std::pair<int, int> > Holes;
+    typedef std::back_insert_iterator<Holes>  Holes_out;
+
+    Holes holes;//just to check there is no holes left
+
+    typedef typename value_type_traits<OutputIterator>::type OutputIteratorValueType;
+    CGAL::internal::Tracer_polyline_incomplete<OutputIteratorValueType, OutputIterator, Holes_out>
+      tracer(out, Holes_out(holes));
+    
+    typedef typename PointRange1::iterator InIterator;
+    typedef typename std::iterator_traits<InIterator>::value_type Point;
+
+    triangulate_hole_polyline(points, third_points, tracer, WC(),
+      use_dt3,
+      choose_param(get_param(np, CGAL::geom_traits),
+        typename CGAL::Kernel_traits<Point>::Kernel()));
+
+    CGAL_assertion(holes.empty());
+    return tracer.out;
+  }
+
+  template <typename PointRange1,
+            typename PointRange2,
+            typename OutputIterator>
+  OutputIterator
+  triangulate_hole_polyline(const PointRange1& points,
+                            const PointRange2& third_points,
+                            OutputIterator out)
+  {
+    return triangulate_hole_polyline(points, third_points, out,
+      CGAL::Polygon_mesh_processing::parameters::all_default());
+  }
+
+  /*!
+  \ingroup  hole_filling_grp
+  same as above but the range of third points is omitted. They are not
+  taken into account in the cost computation that leads the hole filling. 
+*/
+  template <typename PointRange,
+            typename OutputIterator,
+            typename CGAL_PMP_NP_TEMPLATE_PARAMETERS>
+  OutputIterator
+  triangulate_hole_polyline(const PointRange& points,
+                            OutputIterator out,
+                            const CGAL_PMP_NP_CLASS& np)
+  {
+    typedef typename std::iterator_traits<
+      typename PointRange::iterator>::value_type Point;
+    std::vector< Point > third_points;
+    return triangulate_hole_polyline(points, third_points, out, np);
+  }
+
+  template <typename PointRange,
+            typename OutputIterator>
+  OutputIterator
+  triangulate_hole_polyline(const PointRange& points,
+                            OutputIterator out)
+  {
+    return triangulate_hole_polyline(points, out,
+      CGAL::Polygon_mesh_processing::parameters::all_default());
+  }
+
+} //end namespace Polygon_mesh_processing
+
+} //end namespace CGAL
+
+#endif //CGAL_POLYGON_MESH_PROCESSING_TRIANGULATE_HOLE_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_slicer.h b/3rdparty/CGAL/include/CGAL/Polygon_mesh_slicer.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polygon_mesh_slicer.h
rename to 3rdparty/CGAL/include/CGAL/Polygon_mesh_slicer.h
diff --git a/3rdparty/CGAL/include/CGAL/Polygon_nop_decomposition_2.h b/3rdparty/CGAL/include/CGAL/Polygon_nop_decomposition_2.h
new file mode 100644
index 0000000..2e2dc6d
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polygon_nop_decomposition_2.h
@@ -0,0 +1,43 @@
+// Copyright (c) 2013  Tel-Aviv University (Israel).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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.
+//
+// Author(s) : Efi Fogel   <efifogel at gmail.com>
+
+#ifndef CGAL_POLYGON_NOP_DECOMPOSITION_2_H
+#define CGAL_POLYGON_NOP_DECOMPOSITION_2_H
+
+#include <CGAL/Polygon_2.h>
+
+namespace CGAL {
+
+/*! \class
+ * Nop decomposition strategy.
+ * Used for polygons that are already convex.
+ */
+template <typename Kernel_,
+          typename Container_ = std::vector<typename Kernel_::Point_2> >
+class Polygon_nop_decomposition_2 {
+public:
+  typedef Kernel_                                        Kernel;
+  typedef Container_                                     Container;
+  typedef CGAL::Polygon_2<Kernel, Container>             Polygon_2;
+
+  template <typename OutputIterator_>
+  OutputIterator_ operator()(const Polygon_2& pgn, OutputIterator_ oi) const
+  { *oi++ = pgn; return oi; }
+};
+
+} //namespace CGAL
+
+#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_offset_builder_2.h b/3rdparty/CGAL/include/CGAL/Polygon_offset_builder_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polygon_offset_builder_2.h
rename to 3rdparty/CGAL/include/CGAL/Polygon_offset_builder_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_offset_builder_traits_2.h b/3rdparty/CGAL/include/CGAL/Polygon_offset_builder_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polygon_offset_builder_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Polygon_offset_builder_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_set_2.h b/3rdparty/CGAL/include/CGAL/Polygon_set_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polygon_set_2.h
rename to 3rdparty/CGAL/include/CGAL/Polygon_set_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_traits_2.h b/3rdparty/CGAL/include/CGAL/Polygon_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polygon_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Polygon_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_triangulation_decomposition_2.h b/3rdparty/CGAL/include/CGAL/Polygon_triangulation_decomposition_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polygon_triangulation_decomposition_2.h
rename to 3rdparty/CGAL/include/CGAL/Polygon_triangulation_decomposition_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polygon_vertical_decomposition_2.h b/3rdparty/CGAL/include/CGAL/Polygon_vertical_decomposition_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polygon_vertical_decomposition_2.h
rename to 3rdparty/CGAL/include/CGAL/Polygon_vertical_decomposition_2.h
diff --git a/3rdparty/CGAL/include/CGAL/Polygon_with_holes_2.h b/3rdparty/CGAL/include/CGAL/Polygon_with_holes_2.h
new file mode 100644
index 0000000..64a9f2b
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polygon_with_holes_2.h
@@ -0,0 +1,227 @@
+// Copyright (c) 2005  Tel-Aviv University (Israel).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Baruch Zukerman <baruchzu at post.tau.ac.il>
+
+#ifndef CGAL_POLYGON_WITH_HOLES_2_H
+#define CGAL_POLYGON_WITH_HOLES_2_H
+
+#include <CGAL/Polygon_2.h>
+#include <CGAL/General_polygon_with_holes_2.h>
+#include <vector>
+#include <algorithm>
+
+namespace CGAL {
+
+template <class Kernel,
+          class Containter = std::vector<typename Kernel::Point_2> >
+class Polygon_with_holes_2 : 
+  public General_polygon_with_holes_2<CGAL::Polygon_2<Kernel, Containter> >
+{
+public:
+
+  typedef CGAL::Polygon_2<Kernel, Containter>        Polygon_2;
+  typedef General_polygon_with_holes_2<Polygon_2>    Base;
+  typedef typename Base::Hole_const_iterator         Hole_const_iterator;
+  typedef typename Base::Size                        Size;
+
+  /*! Default constructor. */
+  Polygon_with_holes_2 () : 
+    Base()
+  {}
+
+  /*! Constructor from the base class. */
+  Polygon_with_holes_2 (const Base& base) : 
+    Base (base)
+  {}
+
+  /*! Constructor from a polygon. */
+  explicit Polygon_with_holes_2 (const Polygon_2& pgn_boundary) : 
+    Base (pgn_boundary)
+  {}
+
+  /*! Constructor from a polygon (outer boundary) and hole polygons. */
+  template <class HolesInputIterator>
+  Polygon_with_holes_2 (const Polygon_2& pgn_boundary,
+                        HolesInputIterator h_begin,
+                        HolesInputIterator h_end) : 
+    Base (pgn_boundary, h_begin, h_end)
+  {}
+
+  /*! Obtain the bounding box of the polygon with holes */
+  Bbox_2 bbox() const { return this->outer_boundary().bbox(); }  
+};
+
+//-----------------------------------------------------------------------//
+//                          operator<<
+//-----------------------------------------------------------------------//
+
+template <class Kernel_, class Container_>
+std::ostream& operator<<(std::ostream &os,
+                         const Polygon_with_holes_2<Kernel_, Container_>& p)
+{
+  typename Polygon_with_holes_2<Kernel_,Container_>::Hole_const_iterator i;
+
+  switch(get_mode(os)) {
+    case IO::ASCII :
+      os << p.outer_boundary() << ' ' << p.number_of_holes()<<' ';
+      for (i = p.holes_begin(); i != p.holes_end(); ++i) {
+        os << *i << ' ';
+      }
+      return os;
+
+    case IO::BINARY :
+       os << p.outer_boundary() << p.number_of_holes();
+      for (i = p.holes_begin(); i != p.holes_end(); ++i) {
+        os << *i ;
+      }
+      return os;
+
+    default:
+      os << "Polygon_with_holes_2(" << std::endl;
+      if(p.is_unbounded())
+        os << "No outer bounary" << std::endl;
+      else
+      {
+        os << "Boundary(" << std::endl;
+        os << p.outer_boundary() << std::endl;
+      }
+
+      os << "Holes" << std::endl;
+      os << p.number_of_holes()<<std::endl;
+      for (i = p.holes_begin(); i != p.holes_end(); ++i) {
+        os <<" "<< *i << std::endl;
+      }
+
+      os << ")" << std::endl;
+      return os;
+  }
+}
+
+//-----------------------------------------------------------------------//
+//                          operator>>
+//-----------------------------------------------------------------------//
+
+template <class Kernel_, class Container_>
+std::istream &operator>>(std::istream &is,
+                         Polygon_with_holes_2<Kernel_, Container_>& p)
+{
+  typedef CGAL::Polygon_2<Kernel_, Container_> Polygon_2;
+  p.clear();
+  is >> p.outer_boundary();
+
+  unsigned int n; // number of holes;
+  is >> n;
+  if(is)
+  {
+     for (unsigned int i=0; i<n; i++)
+     {
+       Polygon_2 hole;
+       is >> hole;
+       p.add_hole(hole);
+     }
+  }
+
+  return is;
+}
+
+
+//-----------------------------------------------------------------------//
+//                          operator==
+//-----------------------------------------------------------------------//
+template <class Kernel_, class Container_>
+bool operator==(const Polygon_with_holes_2<Kernel_, Container_>& p1,
+                const Polygon_with_holes_2<Kernel_, Container_>& p2)
+{
+  typedef typename 
+    Polygon_with_holes_2<Kernel_, Container_>::Hole_const_iterator HCI;
+  typedef CGAL::Polygon_2<Kernel_, Container_> Polygon_2;
+  if(&p1 == &p2)
+    return (true);
+
+  if(p1.number_of_holes() != p2.number_of_holes())
+    return (false);
+
+  if(p1.outer_boundary() != p2.outer_boundary())
+    return (false);
+
+  std::list<Polygon_2> tmp_list(p2.holes_begin(), p2.holes_end());
+
+  HCI i = p1.holes_begin();
+  for(; i!= p1.holes_end(); ++i)
+  {
+    typename std::list<Polygon_2>::iterator j =
+      (std::find(tmp_list.begin(), tmp_list.end(), *i));
+
+    if(j == tmp_list.end())
+      return (false);
+
+    tmp_list.erase(j);
+  }
+
+
+  CGAL_assertion(tmp_list.empty());
+  return (true);
+}
+
+//-----------------------------------------------------------------------//
+//                          operator!=
+//-----------------------------------------------------------------------//
+template <class Kernel_, class Container_>
+inline bool operator!=(const Polygon_with_holes_2<Kernel_, Container_>& p1,
+                       const Polygon_with_holes_2<Kernel_, Container_>& p2)
+{
+  return (!(p1==p2));
+}
+
+//-----------------------------------------------------------------------//
+//                          operator==
+//-----------------------------------------------------------------------//
+template <class Kernel_, class Container_>
+bool operator==(const Polygon_with_holes_2<Kernel_, Container_>& p1,
+                const Polygon_2<Kernel_, Container_>& p2)
+{
+  return (p1.outer_boundary() == p2  &&  !p1.number_of_holes());
+}
+
+template <class Kernel_, class Container_>
+inline bool operator==(const Polygon_2<Kernel_, Container_>& p1,
+                       const Polygon_with_holes_2<Kernel_, Container_>& p2)
+{
+  return (p2 == p1);
+}
+
+template <class Kernel_, class Container_>
+inline bool operator!=(const Polygon_with_holes_2<Kernel_, Container_>& p1,
+                       const Polygon_2<Kernel_, Container_>& p2)
+{
+  return (!(p1==p2));
+}
+
+template <class Kernel_, class Container_>
+inline bool operator!=(const Polygon_2<Kernel_, Container_>& p1,
+                       const Polygon_with_holes_2<Kernel_, Container_>& p2)
+{
+  return (!(p1==p2));
+}
+
+
+
+} //namespace CGAL
+
+#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/PolyhedralSurf_neighbors.h b/3rdparty/CGAL/include/CGAL/PolyhedralSurf_neighbors.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/PolyhedralSurf_neighbors.h
rename to 3rdparty/CGAL/include/CGAL/PolyhedralSurf_neighbors.h
diff --git a/3rdparty/CGAL/include/CGAL/Polyhedral_mesh_domain_3.h b/3rdparty/CGAL/include/CGAL/Polyhedral_mesh_domain_3.h
new file mode 100644
index 0000000..4aa7f03
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polyhedral_mesh_domain_3.h
@@ -0,0 +1,808 @@
+// Copyright (c) 2009 INRIA Sophia-Antipolis (France).
+// Copyright (c) 2011 GeometryFactory Sarl (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
+// 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(s)     : Stéphane Tayeb
+//
+//******************************************************************************
+// File Description :
+//
+//******************************************************************************
+
+#ifndef CGAL_POLYHEDRAL_MESH_DOMAIN_3_H
+#define CGAL_POLYHEDRAL_MESH_DOMAIN_3_H
+
+#include <CGAL/Polygon_mesh_processing/internal/Side_of_triangle_mesh/Point_inside_vertical_ray_cast.h>
+
+#include <CGAL/Mesh_3/global_parameters.h>
+#include <CGAL/Mesh_3/Robust_intersection_traits_3.h>
+#include <CGAL/Mesh_3/Triangle_accessor_primitive.h>
+#include <CGAL/Triangle_accessor_3.h>
+#include <CGAL/AABB_tree.h>
+#include <CGAL/AABB_traits.h>
+#include <sstream>
+
+#include <CGAL/Random.h>
+#include <CGAL/point_generators_3.h>
+#include <CGAL/Mesh_3/Creator_weighted_point_3.h>
+#include <CGAL/Mesh_3/Profile_counter.h>
+
+#include <boost/optional.hpp>
+#include <boost/none.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/mpl/vector.hpp>
+#include <boost/mpl/contains.hpp>
+#include <CGAL/tuple.h>
+#include <boost/format.hpp>
+#include <boost/variant.hpp>
+#include <boost/math/special_functions/round.hpp>
+
+#ifdef CGAL_LINKED_WITH_TBB
+# include <tbb/enumerable_thread_specific.h>
+#endif
+
+// To handle I/O for Surface_patch_index if that is a pair of `int` (the
+// default)
+#include <CGAL/internal/Mesh_3/Handle_IO_for_pair_of_int.h>
+
+namespace CGAL {
+
+namespace Mesh_3 {
+
+namespace details {
+
+inline
+double
+max_length(const Bbox_3& b)
+{
+  return (std::max)(b.xmax()-b.xmin(),
+                    (std::max)(b.ymax()-b.ymin(),b.zmax()-b.zmin()) );
+}
+
+
+// -----------------------------------
+// Surface_patch_index_generator
+// To use patch_id enclosed in AABB_primitives or not
+// -----------------------------------
+template < typename Subdomain_index, typename Polyhedron, typename Tag >
+struct Surface_patch_index_generator
+{
+  typedef std::pair<Subdomain_index,Subdomain_index>  Surface_patch_index;
+  typedef Surface_patch_index                         type;
+
+  template < typename Primitive_id >
+  Surface_patch_index operator()(const Primitive_id&)
+  { return Surface_patch_index(0,1); }
+};
+
+template < typename Subdomain_index, typename Polyhedron >
+struct Surface_patch_index_generator<Subdomain_index, Polyhedron, CGAL::Tag_true>
+{
+  typedef typename Polyhedron::Face::Patch_id Surface_patch_index;
+  typedef Surface_patch_index   type;
+
+  template < typename Primitive_id >
+  Surface_patch_index operator()(const Primitive_id& primitive_id)
+  { return primitive_id->patch_id(); }
+};
+
+
+// -----------------------------------
+// Index_generator
+// Don't use boost::variant if types are the same type
+// -----------------------------------
+template < typename Subdomain_index, typename Surface_patch_index >
+struct Index_generator
+{
+  typedef boost::variant<Subdomain_index,Surface_patch_index> Index;
+  typedef Index                                         type;
+};
+
+template < typename T >
+struct Index_generator<T, T>
+{
+  typedef T       Index;
+  typedef Index   type;
+};
+
+// -----------------------------------
+// Geometric traits generator
+// -----------------------------------
+template < typename Gt,
+           typename Use_exact_intersection_construction_tag >
+struct IGT_generator {};
+
+template < typename Gt >
+struct IGT_generator<Gt,CGAL::Tag_true>
+{
+#ifdef CGAL_MESH_3_NEW_ROBUST_INTERSECTION_TRAITS
+  typedef CGAL::Mesh_3::Robust_intersection_traits_3_new<Gt> type;
+#else // NOT CGAL_MESH_3_NEW_ROBUST_INTERSECTION_TRAITS
+  typedef CGAL::Mesh_3::Robust_intersection_traits_3<Gt> type;
+#endif // NOT CGAL_MESH_3_NEW_ROBUST_INTERSECTION_TRAITS
+  typedef type Type;
+};
+
+template < typename Gt >
+struct IGT_generator<Gt,CGAL::Tag_false>
+{
+  typedef Gt type;
+  typedef type Type;
+};
+
+}  // end namespace details
+
+}  // end namespace Mesh_3
+
+
+/**
+ * @class Polyhedral_mesh_domain_3
+ *
+ *
+ */
+template<class Polyhedron,
+         class IGT_,
+         class TriangleAccessor=Triangle_accessor_3<Polyhedron,IGT_>,
+         class Use_patch_id_tag=Tag_false,
+         class Use_exact_intersection_construction_tag = CGAL::Tag_true>
+class Polyhedral_mesh_domain_3
+{
+  typedef typename Mesh_3::details::IGT_generator<
+    IGT_,Use_exact_intersection_construction_tag>::type IGT;
+
+public:
+  /// Geometric object types
+  typedef typename IGT::Point_3    Point_3;
+  typedef typename IGT::Segment_3  Segment_3;
+  typedef typename IGT::Ray_3      Ray_3;
+  typedef typename IGT::Line_3     Line_3;
+  typedef typename IGT::Vector_3   Vector_3;
+  typedef typename IGT::Sphere_3   Sphere_3;
+
+  //-------------------------------------------------------
+  // Index Types
+  //-------------------------------------------------------
+  /// Type of indexes for cells of the input complex
+  typedef int Subdomain_index;
+  typedef boost::optional<Subdomain_index> Subdomain;
+  /// Type of indexes for surface patch of the input complex
+  typedef typename Mesh_3::details::Surface_patch_index_generator<
+    Subdomain_index,Polyhedron,Use_patch_id_tag>::type    Surface_patch_index;
+  typedef boost::optional<Surface_patch_index>            Surface_patch;
+  /// Type of indexes to characterize the lowest dimensional face of the input
+  /// complex on which a vertex lie
+  typedef typename Mesh_3::details::Index_generator<
+    Subdomain_index, Surface_patch_index>::type           Index;
+
+  typedef CGAL::cpp11::tuple<Point_3,Index,int> Intersection;
+
+
+  typedef typename IGT::FT         FT;
+
+  // Kernel_traits compatibility
+  typedef IGT R;
+
+private:
+  typedef Mesh_3::Triangle_accessor_primitive<
+    TriangleAccessor, IGT>                              AABB_primitive;
+  typedef class AABB_traits<IGT,AABB_primitive>         AABB_traits;
+  typedef class AABB_tree<AABB_traits>                  AABB_tree_;
+private:
+  typedef typename AABB_tree_::Primitive_id              AABB_primitive_id;
+  typedef typename AABB_tree_::Primitive Primitive;
+  typedef typename AABB_traits::Bounding_box            Bounding_box;
+
+public:
+
+  /// Default constructor
+  Polyhedral_mesh_domain_3()
+    : tree_()
+    , bounding_tree_(&tree_)
+    , p_rng_(NULL)
+    , delete_rng_(true)
+  {
+    p_rng_ = new CGAL::Random(0);
+  }
+
+  /**
+   * @brief Constructor. Contruction from a polyhedral surface
+   * @param polyhedron the polyhedron describing the polyhedral surface
+   */
+  Polyhedral_mesh_domain_3(const Polyhedron& p,
+                           CGAL::Random* p_rng = NULL)
+    : tree_(TriangleAccessor().triangles_begin(p),
+            TriangleAccessor().triangles_end(p))
+    , bounding_tree_(&tree_) // the bounding tree is tree_
+    , p_rng_(p_rng)
+    , delete_rng_(false)
+  {
+    if(!p.is_pure_triangle()) {
+      std::cerr << "Your input polyhedron must be triangulated!\n";
+      CGAL_error_msg("Your input polyhedron must be triangulated!");
+    }
+    if(!p_rng_)
+    {
+      p_rng_ = new CGAL::Random(0);
+      delete_rng_ = true;
+    }
+  }
+
+  Polyhedral_mesh_domain_3(const Polyhedron& p,
+                           const Polyhedron& bounding_polyhedron,
+                           CGAL::Random* p_rng = NULL)
+    : tree_(TriangleAccessor().triangles_begin(p),
+            TriangleAccessor().triangles_end(p))
+    , bounding_tree_(new AABB_tree_(TriangleAccessor().triangles_begin(bounding_polyhedron),
+                                    TriangleAccessor().triangles_end(bounding_polyhedron)))
+    , p_rng_(p_rng)
+    , delete_rng_(false)
+  {
+    tree_.insert(TriangleAccessor().triangles_begin(bounding_polyhedron),
+                 TriangleAccessor().triangles_end(bounding_polyhedron));
+    tree_.build();
+    bounding_tree_->build();
+    if(!p_rng_)
+    {
+      p_rng_ = new CGAL::Random(0);
+      delete_rng_ = true;
+    }
+  }
+
+  /**
+   * Constructor.
+   *
+   * Constructor from a sequence of polyhedral surfaces, and a bounding
+   * polyhedral surface.
+   *
+   * @param InputPolyhedraPtrIterator must an iterator of a sequence of
+   * pointers to polyhedra
+   *
+   * @param bounding_polyhedron reference to the bounding surface
+   */
+  template <typename InputPolyhedraPtrIterator>
+  Polyhedral_mesh_domain_3(InputPolyhedraPtrIterator begin,
+                           InputPolyhedraPtrIterator end,
+                           const Polyhedron& bounding_polyhedron,
+                           CGAL::Random* p_rng = NULL)
+    : p_rng_(p_rng)
+    , delete_rng_(false)
+  {
+    if(begin != end) {
+      for(; begin != end; ++begin) {
+        tree_.insert(TriangleAccessor().triangles_begin(**begin),
+                     TriangleAccessor().triangles_end(**begin));
+      }
+      tree_.insert(TriangleAccessor().triangles_begin(bounding_polyhedron),
+                   TriangleAccessor().triangles_end(bounding_polyhedron));
+      tree_.build();
+      bounding_tree_ =
+        bounding_polyhedron.empty() ?
+        0 :
+        new AABB_tree_(TriangleAccessor().triangles_begin(bounding_polyhedron),
+                       TriangleAccessor().triangles_end(bounding_polyhedron));
+      if(!bounding_polyhedron.empty()) {
+        bounding_tree_->build();
+      }
+    }
+    else {
+      tree_.rebuild(TriangleAccessor().triangles_begin(bounding_polyhedron),
+                    TriangleAccessor().triangles_end(bounding_polyhedron));
+      bounding_tree_ = &tree_;
+    }
+    if(!p_rng_)
+    {
+      p_rng_ = new CGAL::Random(0);
+      delete_rng_ = true;
+    }
+  }
+
+  /**
+   * Constructor.
+   *
+   * Constructor from a sequence of polyhedral surfaces, without bounding
+   * surface. The domain will always answer false to "is_in_domain"
+   * queries.
+   *
+   * @param InputPolyhedraPtrIterator must an iterator of a sequence of
+   * pointers to polyhedra
+   */
+  template <typename InputPolyhedraPtrIterator>
+  Polyhedral_mesh_domain_3(InputPolyhedraPtrIterator begin,
+                           InputPolyhedraPtrIterator end,
+                           CGAL::Random* p_rng = NULL)
+    : p_rng_(p_rng)
+    , delete_rng_(false)
+  {
+    if(begin != end) {
+      for(; begin != end; ++begin) {
+        tree_.insert(TriangleAccessor().triangles_begin(**begin),
+                     TriangleAccessor().triangles_end(**begin));
+      }
+      tree_.build();
+    }
+    bounding_tree_ = 0;
+    if(!p_rng_)
+    {
+      p_rng_ = new CGAL::Random(0);
+      delete_rng_ = true;
+    }
+  }
+
+  /// Destructor
+  ~Polyhedral_mesh_domain_3() {
+    if(bounding_tree_ != 0 && bounding_tree_ != &tree_) {
+      delete bounding_tree_;
+    }
+    if(delete_rng_)
+      delete p_rng_;
+  }
+
+  /**
+   * Constructs  a set of \ccc{n} points on the surface, and output them to
+   *  the output iterator \ccc{pts} whose value type is required to be
+   *  \ccc{std::pair<Points_3, Index>}.
+   */
+  struct Construct_initial_points
+  {
+    Construct_initial_points(const Polyhedral_mesh_domain_3& domain)
+      : r_domain_(domain) {}
+
+    template<class OutputIterator>
+    OutputIterator operator()(OutputIterator pts, const int n = 8) const;
+
+  private:
+    const Polyhedral_mesh_domain_3& r_domain_;
+  };
+
+  Construct_initial_points construct_initial_points_object() const
+  {
+    return Construct_initial_points(*this);
+  }
+
+
+  /**
+   * Returns a bounding box of the domain
+   */
+  Bbox_3 bbox() const {
+    return tree_.bbox();
+  }
+
+
+  /**
+   * Returns true if point~\ccc{p} is in the domain. If \ccc{p} is in the
+   *  domain, the parameter index is set to the index of the subdomain
+   *  including $p$. It is set to the default value otherwise.
+   */
+  struct Is_in_domain
+  {
+    Is_in_domain(const Polyhedral_mesh_domain_3& domain)
+      : r_domain_(domain) {}
+
+    Subdomain operator()(const Point_3& p) const;
+  private:
+    const Polyhedral_mesh_domain_3& r_domain_;
+  };
+
+  Is_in_domain is_in_domain_object() const { return Is_in_domain(*this); }
+
+  Point_3 project_on_surface(const Point_3& p) const
+  {
+    return tree_.closest_point(p);
+  }
+
+  /// Allowed query types
+  typedef boost::mpl::vector<Segment_3, Ray_3, Line_3> Allowed_query_types;
+
+  /**
+   * Returns true is the element \ccc{type} intersect properly any of the
+   * surface patches describing the either the domain boundary or some
+   * subdomain boundary.
+   * \ccc{Type} is either \ccc{Segment_3}, \ccc{Ray_3} or \ccc{Line_3}.
+   * Parameter index is set to the index of the intersected surface patch
+   * if \ccc{true} is returned and to the default \ccc{Surface_patch_index}
+   * value otherwise.
+   */
+  struct Do_intersect_surface
+  {
+    Do_intersect_surface(const Polyhedral_mesh_domain_3& domain)
+      : r_domain_(domain) {}
+
+    template <typename Query>
+    typename boost::enable_if<typename boost::mpl::contains<Allowed_query_types,
+                                                            Query>::type,
+                              Surface_patch>::type
+    operator()(const Query& q) const
+    {
+      CGAL_MESH_3_PROFILER(std::string("Mesh_3 profiler: ") + std::string(CGAL_PRETTY_FUNCTION));
+
+      boost::optional<AABB_primitive_id> primitive_id = r_domain_.tree_.any_intersected_primitive(q);
+      if ( primitive_id )
+      {
+        r_domain_.cache_primitive(q, *primitive_id);
+        return Surface_patch(r_domain_.make_surface_index(*primitive_id));
+      } else {
+        return Surface_patch();
+      }
+    }
+
+  private:
+    const Polyhedral_mesh_domain_3& r_domain_;
+  };
+
+  Do_intersect_surface do_intersect_surface_object() const
+  {
+    return Do_intersect_surface(*this);
+  }
+
+  /**
+   * Returns a point in the intersection of the primitive \ccc{type}
+   * with some boundary surface.
+   * \ccc{Type1} is either \ccc{Segment_3}, \ccc{Ray_3} or \ccc{Line_3}.
+   * The integer \ccc{dimension} is set to the dimension of the lowest
+   * dimensional face in the input complex containing the returned point, and
+   * \ccc{index} is set to the index to be stored at a mesh vertex lying
+   * on this face.
+   */
+  struct Construct_intersection
+  {
+    Construct_intersection(const Polyhedral_mesh_domain_3& domain)
+      : r_domain_(domain) {}
+
+    template <typename Query>
+    typename boost::enable_if<typename boost::mpl::contains<Allowed_query_types,
+                                                            Query>::type,
+                              Intersection>::type
+    operator()(const Query& q) const
+    {
+      CGAL_MESH_3_PROFILER(std::string("Mesh_3 profiler: ") + std::string(CGAL_PRETTY_FUNCTION));
+      typedef typename AABB_tree_::template Intersection_and_primitive_id<Query>::Type
+        Intersection_and_primitive_id;
+      typedef boost::optional<Intersection_and_primitive_id> AABB_intersection;
+      typedef Point_3 Bare_point;
+
+      AABB_intersection intersection;
+#ifndef CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
+      if(r_domain_.query_is_cached(q))
+      {
+        const AABB_primitive_id primitive_id = r_domain_.cached_primitive_id();
+        typename cpp11::result_of<
+          typename IGT::Intersect_3(typename Primitive::Datum, Query)>::type o
+            = IGT().intersect_3_object()(Primitive(primitive_id).datum(),q);
+        intersection = o ?
+          Intersection_and_primitive_id(*o, primitive_id) :
+          AABB_intersection();
+      } else
+#endif // not CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
+      {
+#ifndef CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
+        CGAL_precondition(r_domain_.do_intersect_surface_object()(q));
+#endif // NOT CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
+
+        intersection = r_domain_.tree_.any_intersection(q);
+      }
+      if ( intersection )
+      {
+        // Get primitive
+        AABB_primitive_id primitive_id = intersection->second;
+
+        // intersection may be either a point or a segment
+#if CGAL_INTERSECTION_VERSION > 1
+        if ( const Bare_point* p_intersect_pt =
+             boost::get<Bare_point>( &(intersection->first) ) )
+#else
+        if ( const Bare_point* p_intersect_pt =
+             object_cast<Bare_point>( &(intersection->first) ) )
+#endif
+        {
+          return Intersection(*p_intersect_pt,
+                              r_domain_.index_from_surface_patch_index(
+                                r_domain_.make_surface_index(primitive_id)),
+                              2);
+        }
+#if CGAL_INTERSECTION_VERSION > 1
+        else if ( const Segment_3* p_intersect_seg =
+                  boost::get<Segment_3>(&(intersection->first)))
+#else
+        else if ( const Segment_3* p_intersect_seg =
+                  object_cast<Segment_3>(&(intersection->first)))
+#endif
+        {
+          CGAL_MESH_3_PROFILER("Mesh_3 profiler: Intersection is a segment");
+
+          return Intersection(p_intersect_seg->source(),
+                              r_domain_.index_from_surface_patch_index(
+                                r_domain_.make_surface_index(primitive_id)),
+                              2);
+        }
+        else {
+#ifndef CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
+          std::stringstream stream;
+          stream.precision(17);
+          set_pretty_mode(stream);
+          stream <<
+            "Mesh_3 error : AABB_tree any_intersection result is "
+            "not a point nor a segment\n";
+          if(intersection->first.empty()) {
+            stream <<  "The intersection is empty!";
+          } else {
+            stream <<  "The intersection typeinfo name is ";
+            stream <<  intersection->first.type().name();
+          }
+          stream << "\nThe query was: ";
+          stream << q << std::endl;
+          stream << "The intersecting primitive in the AABB tree was: "
+                 << AABB_primitive(intersection->second).datum() << std::endl;
+          CGAL_error_msg(stream.str().c_str());
+#endif // not CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
+        }
+      }
+
+      // Should not happen
+      // unless CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3 is defined
+      return Intersection();
+    }
+
+  private:
+    const Polyhedral_mesh_domain_3& r_domain_;
+  };
+
+  Construct_intersection construct_intersection_object() const
+  {
+    return Construct_intersection(*this);
+  }
+
+
+  /**
+   * Returns the index to be stored in a vertex lying on the surface identified
+   * by \c index.
+   */
+  Index index_from_surface_patch_index(const Surface_patch_index& index) const
+  { return Index(index); }
+
+  /**
+   * Returns the index to be stored in a vertex lying in the subdomain
+   * identified by \c index.
+   */
+  Index index_from_subdomain_index(const Subdomain_index& index) const
+  { return Index(index); }
+
+  /**
+   * Returns the \c Surface_patch_index of the surface patch
+   * where lies a vertex with dimension 2 and index \c index.
+   */
+  Surface_patch_index surface_patch_index(const Index& index) const
+  { return boost::get<Surface_patch_index>(index); }
+
+  /**
+   * Returns the index of the subdomain containing a vertex
+   *  with dimension 3 and index \c index.
+   */
+  Subdomain_index subdomain_index(const Index& index) const
+  { return boost::get<Subdomain_index>(index); }
+
+  // -----------------------------------
+  // Backward Compatibility
+  // -----------------------------------
+#ifndef CGAL_MESH_3_NO_DEPRECATED_SURFACE_INDEX
+  typedef Surface_patch_index   Surface_index;
+
+  Index index_from_surface_index(const Surface_index& index) const
+  { return index_from_surface_patch_index(index); }
+
+  Surface_index surface_index(const Index& index) const
+  { return surface_patch_index(index); }
+#endif // CGAL_MESH_3_NO_DEPRECATED_SURFACE_INDEX
+  // -----------------------------------
+  // End backward Compatibility
+  // -----------------------------------
+
+public:
+  Surface_patch_index make_surface_index(
+    const AABB_primitive_id& primitive_id = AABB_primitive_id() ) const
+  {
+    Mesh_3::details::Surface_patch_index_generator<Subdomain_index,
+                                                   Polyhedron,
+                                                   Use_patch_id_tag> generator;
+
+    return generator(primitive_id);
+  }
+
+  // Undocumented function, used to implement a sizing field that
+  // computes lfs using this AABB tree. That avoids to rebuild the same
+  // tree.
+  typedef AABB_tree_ AABB_tree;
+  const AABB_tree& aabb_tree() const {
+    return tree_;
+  }
+
+protected:
+  void add_primitives(const Polyhedron& p)
+  {
+    tree_.insert(TriangleAccessor().triangles_begin(p),
+                 TriangleAccessor().triangles_end(p));
+
+    tree_.build();
+  }
+
+private:
+  /// The AABB tree: intersection detection and more
+  AABB_tree_ tree_;
+
+  AABB_tree_* bounding_tree_;
+
+  // cache queries and intersected primitive
+  typedef typename boost::make_variant_over<Allowed_query_types>::type Cached_query;
+  struct Query_cache
+  {
+    Query_cache() : has_cache(false) {}
+    bool has_cache;
+    Cached_query cached_query;
+    AABB_primitive_id cached_primitive_id;
+  };
+#ifdef CGAL_LINKED_WITH_TBB
+  mutable tbb::enumerable_thread_specific<Query_cache> query_cache;
+#else
+  mutable Query_cache query_cache;
+#endif
+
+  //random number generator for Construct_initial_points
+  CGAL::Random* p_rng_;
+  bool delete_rng_;
+
+public:
+
+  template <typename Query>
+  void cache_primitive(const Query& q,
+                       const AABB_primitive_id id) const
+  {
+#ifdef CGAL_LINKED_WITH_TBB
+    Query_cache &qc = query_cache.local();
+    qc.cached_query = Cached_query(q);
+    qc.has_cache = true;
+    qc.cached_primitive_id = id;
+#else
+    query_cache.cached_query = Cached_query(q);
+    query_cache.has_cache = true;
+    query_cache.cached_primitive_id = id;
+#endif
+  }
+
+  template <typename Query>
+  bool query_is_cached(const Query& q) const {
+#ifdef CGAL_LINKED_WITH_TBB
+    Query_cache &qc = query_cache.local();
+    return qc.has_cache && (qc.cached_query == Cached_query(q));
+#else
+    return query_cache.has_cache 
+      && (query_cache.cached_query == Cached_query(q));
+#endif
+  }
+
+  AABB_primitive_id cached_primitive_id() const {
+#ifdef CGAL_LINKED_WITH_TBB
+    return query_cache.local().cached_primitive_id;
+#else
+    return query_cache.cached_primitive_id;
+#endif
+  }
+
+  void set_random_generator(CGAL::Random* p_rng)
+  {
+    if(delete_rng_) delete p_rng_;
+    if(!p_rng)
+    {
+      p_rng_ = new CGAL::Random(0);
+      delete_rng_ = true;
+    }
+    else {
+      p_rng_ = p_rng;
+      delete_rng_ = false;
+    }
+  }
+
+private:
+  // Disabled copy constructor & assignment operator
+  typedef Polyhedral_mesh_domain_3 Self;
+  Polyhedral_mesh_domain_3(const Self& src);
+  Self& operator=(const Self& src);
+
+};  // end class Polyhedral_mesh_domain_3
+
+
+
+
+
+template<typename P_, typename IGT_, typename TA,
+         typename Tag, typename E_tag_>
+template<class OutputIterator>
+OutputIterator
+Polyhedral_mesh_domain_3<P_,IGT_,TA,Tag,E_tag_>::
+Construct_initial_points::operator()(OutputIterator pts,
+                                     const int n) const
+{
+  typename IGT::Construct_ray_3 ray = IGT().construct_ray_3_object();
+  typename IGT::Construct_vector_3 vector = IGT().construct_vector_3_object();
+
+  const Bounding_box bbox = r_domain_.tree_.bbox();
+  const Point_3 center( FT( (bbox.xmin() + bbox.xmax()) / 2),
+                        FT( (bbox.ymin() + bbox.ymax()) / 2),
+                        FT( (bbox.zmin() + bbox.zmax()) / 2) );
+
+  CGAL::Random& rng = *(r_domain_.p_rng_);
+  Random_points_on_sphere_3<Point_3> random_point(1., rng);
+
+  int i = n;
+# ifdef CGAL_MESH_3_VERBOSE
+  std::cerr << "construct initial points:" << std::endl;
+# endif
+  // Point construction by ray shooting from the center of the enclosing bbox
+  while ( i > 0 )
+  {
+    const Ray_3 ray_shot = ray(center, vector(CGAL::ORIGIN,*random_point));
+
+#ifdef CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
+    Intersection intersection = r_domain_.construct_intersection_object()(ray_shot);
+    if(CGAL::cpp0x::get<2>(intersection) != 0) {
+#else
+    if(r_domain_.do_intersect_surface_object()(ray_shot)) {
+      Intersection intersection = r_domain_.construct_intersection_object()(ray_shot);
+#endif
+      *pts++ = std::make_pair(CGAL::cpp0x::get<0>(intersection),
+                              CGAL::cpp0x::get<1>(intersection));
+
+      --i;
+
+#ifdef CGAL_MESH_3_VERBOSE
+      std::cerr << boost::format("\r             \r"
+                                 "%1%/%2% initial point(s) found...")
+        % (n - i)
+        % n;
+# endif
+    }
+    ++random_point;
+  }
+
+#ifdef CGAL_MESH_3_VERBOSE
+  std::cerr << std::endl;
+#endif
+  return pts;
+}
+
+
+template<typename P_, typename IGT_, typename TA,
+         typename Tag, typename E_tag_>
+typename Polyhedral_mesh_domain_3<P_,IGT_,TA,Tag,E_tag_>::Subdomain
+Polyhedral_mesh_domain_3<P_,IGT_,TA,Tag,E_tag_>::
+Is_in_domain::operator()(const Point_3& p) const
+{
+  if(r_domain_.bounding_tree_ == 0) return Subdomain();
+
+  internal::Point_inside_vertical_ray_cast<IGT_, AABB_tree_> inside_functor;
+  Bounded_side side = inside_functor(p, *(r_domain_.bounding_tree_));
+
+  if(side == CGAL::ON_UNBOUNDED_SIDE) { return Subdomain(); }
+  else { return Subdomain(Subdomain_index(1)); } // case ON_BOUNDARY && ON_BOUNDED_SIDE
+}
+
+
+
+
+}  // end namespace CGAL
+
+
+#endif // POLYHEDRAL_MESH_TRAITS_3_H_
diff --git a/3rdparty/CGAL/include/CGAL/Polyhedral_mesh_domain_with_features_3.h b/3rdparty/CGAL/include/CGAL/Polyhedral_mesh_domain_with_features_3.h
new file mode 100644
index 0000000..e1cbe81
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polyhedral_mesh_domain_with_features_3.h
@@ -0,0 +1,351 @@
+// Copyright (c) 2009-2010 INRIA Sophia-Antipolis (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
+// 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(s)     : Stéphane Tayeb
+//
+//******************************************************************************
+// File Description :
+//
+//******************************************************************************
+
+#ifndef CGAL_POLYHEDRAL_MESH_DOMAIN_WITH_FEATURES_3_H
+#define CGAL_POLYHEDRAL_MESH_DOMAIN_WITH_FEATURES_3_H
+
+#include <CGAL/Mesh_3/config.h>
+
+#include <CGAL/Random.h>
+#include <CGAL/Polyhedral_mesh_domain_3.h>
+#include <CGAL/Mesh_domain_with_polyline_features_3.h>
+#include <CGAL/Mesh_polyhedron_3.h>
+
+#include <CGAL/Mesh_3/Detect_polylines_in_polyhedra.h>
+#include <CGAL/Mesh_3/Polyline_with_context.h>
+#include <CGAL/Mesh_3/Detect_features_in_polyhedra.h>
+
+#include <CGAL/enum.h>
+#include <CGAL/IO/Polyhedron_iostream.h>
+#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
+#include <CGAL/boost/graph/helpers.h>
+
+#include <boost/iterator/transform_iterator.hpp>
+#include <boost/foreach.hpp>
+
+#include <string>
+#include <vector>
+#include <fstream>
+
+
+namespace CGAL {
+
+/**
+ * @class Polyhedral_mesh_domain_with_features_3
+ *
+ *
+ */
+template < class IGT_,
+           class Polyhedron_ = typename Mesh_polyhedron_3<IGT_>::type,
+           class TriangleAccessor=Triangle_accessor_3<Polyhedron_,IGT_>,
+           class Use_patch_id_tag = Tag_true,
+           class Use_exact_intersection_construction_tag = Tag_true >
+class Polyhedral_mesh_domain_with_features_3
+  : public Mesh_domain_with_polyline_features_3<
+      Polyhedral_mesh_domain_3< Polyhedron_,
+                                IGT_,
+                                TriangleAccessor,
+                                Use_patch_id_tag,
+                                Use_exact_intersection_construction_tag > >
+{
+  typedef Mesh_domain_with_polyline_features_3<
+    Polyhedral_mesh_domain_3<
+      Polyhedron_, IGT_, TriangleAccessor,
+      Use_patch_id_tag, Use_exact_intersection_construction_tag > > Base;
+
+public:
+  typedef Polyhedron_ Polyhedron;
+
+  // Index types
+  typedef typename Base::Index                Index;
+  typedef typename Base::Corner_index         Corner_index;
+  typedef typename Base::Curve_segment_index  Curve_segment_index;
+  typedef typename Base::Surface_patch_index  Surface_patch_index;
+  typedef typename Base::Subdomain_index      Subdomain_index;
+  
+  // Backward compatibility
+#ifndef CGAL_MESH_3_NO_DEPRECATED_SURFACE_INDEX
+  typedef Surface_patch_index                 Surface_index;
+#endif // CGAL_MESH_3_NO_DEPRECATED_SURFACE_INDEX
+
+  typedef typename Base::R         R;
+  typedef typename Base::Point_3   Point_3;
+  typedef typename Base::FT        FT;
+  
+  typedef CGAL::Tag_true           Has_features;
+
+  /// Constructors
+  Polyhedral_mesh_domain_with_features_3(const Polyhedron& p,
+    CGAL::Random* p_rng = NULL);
+  Polyhedral_mesh_domain_with_features_3(const std::string& filename,
+    CGAL::Random* p_rng = NULL);
+
+  // The following is needed, because otherwise, when a "const char*" is
+  // passed, the constructors templates are a better match, than the
+  // constructor with `std::string`.
+  Polyhedral_mesh_domain_with_features_3(const char* filename,
+    CGAL::Random* p_rng = NULL);
+
+  // Inherited constructors
+  template <typename T2>
+  Polyhedral_mesh_domain_with_features_3(const Polyhedron& p,
+                                         const T2& b,
+                                         CGAL::Random* p_rng = NULL)
+    : Base(p, b)
+    , borders_detected_(false)
+  {
+    poly_.resize(1);
+    poly_[0] = p;
+    this->set_random_generator(p_rng);
+  }
+
+  template <typename InputPolyhedraPtrIterator>
+  Polyhedral_mesh_domain_with_features_3(InputPolyhedraPtrIterator begin,
+                                         InputPolyhedraPtrIterator end,
+                                         CGAL::Random* p_rng = NULL)
+    : Base(begin, end)
+    , borders_detected_(false)
+  {
+    if (begin != end) {
+      for (; begin != end; ++begin)
+        poly_.push_back(**begin);
+    }
+    else
+      poly_.push_back(**begin);
+    this->set_random_generator(p_rng);
+  }
+
+  template <typename InputPolyhedraPtrIterator>
+  Polyhedral_mesh_domain_with_features_3(InputPolyhedraPtrIterator begin,
+                                         InputPolyhedraPtrIterator end,
+                                         const Polyhedron& bounding_polyhedron,
+                                         CGAL::Random* p_rng = NULL)
+    : Base(begin, end, bounding_polyhedron)
+    , borders_detected_(false)
+  {
+    if (begin != end) {
+      for (; begin != end; ++begin)
+        poly_.push_back(**begin);
+    }
+    else
+      poly_.push_back(**begin);
+    this->set_random_generator(p_rng);
+  }
+
+  /// Destructor
+  ~Polyhedral_mesh_domain_with_features_3() {}
+
+  /// Detect features
+  void initialize_ts(Polyhedron& p);
+
+  void detect_features(FT angle_in_degree, std::vector<Polyhedron>& p);
+  void detect_features(FT angle_in_degree = FT(60)) { detect_features(angle_in_degree, poly_); }
+
+  void detect_borders(const std::vector<Polyhedron>& p);
+  void detect_borders() { detect_borders(poly_); };
+
+private:
+  std::vector<Polyhedron> poly_;
+  bool borders_detected_;
+
+public:
+  const Polyhedron& polyhedron() const
+  {
+    if (poly_.size() != 1)
+    {
+      std::cerr << "Unexpected number of polyhedrons! " << poly_.size() << std::endl;
+    }
+    return poly_[0];
+  }
+
+private:
+  // Disabled copy constructor & assignment operator
+  typedef Polyhedral_mesh_domain_with_features_3 Self;
+  Polyhedral_mesh_domain_with_features_3(const Self& src);
+  Self& operator=(const Self& src);
+
+};  // end class Polyhedral_mesh_domain_with_features_3
+
+
+template < typename GT_, typename P_, typename TA_,
+           typename Tag_, typename E_tag_>
+Polyhedral_mesh_domain_with_features_3<GT_,P_,TA_,Tag_,E_tag_>::
+Polyhedral_mesh_domain_with_features_3(const Polyhedron& p,
+                                       CGAL::Random* p_rng)
+  : Base()
+  , borders_detected_(false)
+{
+  poly_.resize(1);
+  poly_[0] = p;
+  this->add_primitives(poly_[0]);
+  this->set_random_generator(p_rng);
+}
+
+template < typename GT_, typename P_, typename TA_,
+           typename Tag_, typename E_tag_>
+Polyhedral_mesh_domain_with_features_3<GT_,P_,TA_,Tag_,E_tag_>::
+Polyhedral_mesh_domain_with_features_3(const char* filename,
+                                       CGAL::Random* p_rng)
+  : Base()
+  , borders_detected_(false)
+{
+  // Create input polyhedron
+  std::ifstream input(filename);
+  poly_.resize(1);
+  input >> poly_[0];
+  this->add_primitives(poly_[0]);
+  this->set_random_generator(p_rng);
+}
+
+template < typename GT_, typename P_, typename TA_,
+           typename Tag_, typename E_tag_>
+Polyhedral_mesh_domain_with_features_3<GT_,P_,TA_,Tag_,E_tag_>::
+Polyhedral_mesh_domain_with_features_3(const std::string& filename,
+                                       CGAL::Random* p_rng)
+  : Base()
+  , borders_detected_(false)
+{
+  // Create input polyhedron
+  std::ifstream input(filename.c_str());
+  poly_.resize(1);
+  input >> poly_[0];
+  this->add_primitives(poly_[0]);
+  this->set_random_generator(p_rng);
+}
+
+
+template < typename GT_, typename P_, typename TA_,
+           typename Tag_, typename E_tag_>
+void
+Polyhedral_mesh_domain_with_features_3<GT_,P_,TA_,Tag_,E_tag_>::
+initialize_ts(Polyhedron& p)
+{
+  std::size_t ts = 0;
+  for(typename Polyhedron::Vertex_iterator v = p.vertices_begin(),
+      end = p.vertices_end() ; v != end ; ++v)
+  {
+    v->set_time_stamp(ts++);
+  }
+  for(typename Polyhedron::Facet_iterator fit = p.facets_begin(),
+       end = p.facets_end() ; fit != end ; ++fit )
+  {
+    fit->set_time_stamp(ts++);
+  }
+  for(typename Polyhedron::Halfedge_iterator hit = p.halfedges_begin(),
+       end = p.halfedges_end() ; hit != end ; ++hit )
+  {
+    hit->set_time_stamp(ts++);
+  }
+}
+
+
+template < typename GT_, typename P_, typename TA_,
+           typename Tag_, typename E_tag_>
+void
+Polyhedral_mesh_domain_with_features_3<GT_,P_,TA_,Tag_,E_tag_>::
+detect_features(FT angle_in_degree, std::vector<Polyhedron>& poly)
+{
+  CGAL_assertion(!borders_detected_);
+  if (borders_detected_)
+    return;//prevent from not-terminating
+
+  for (std::size_t i = 0; i < poly.size(); ++i)
+  {
+  Polyhedron& p = poly[i];
+  initialize_ts(p);
+
+  // Get sharp features
+  Mesh_3::detect_features(p,angle_in_degree);
+  
+  // Get polylines
+  typedef std::vector<Point_3> Bare_polyline;
+  typedef Mesh_3::Polyline_with_context<Surface_patch_index, Curve_segment_index,
+    Bare_polyline > Polyline;
+  
+  std::vector<Polyline> polylines;
+  typedef std::back_insert_iterator<std::vector<Polyline> > Output_iterator;
+
+  Mesh_3::detect_polylines<Polyhedron,Polyline,Output_iterator>(
+    &p, std::back_inserter(polylines));
+    
+  // Insert polylines in domain
+  Mesh_3::Extract_bare_polyline<Polyline> extractor;
+  
+  this->add_features(
+    boost::make_transform_iterator(polylines.begin(),extractor),
+    boost::make_transform_iterator(polylines.end(),extractor));
+  }
+
+  borders_detected_ = true;/*done by Mesh_3::detect_features*/
+}
+
+
+template < typename GT_, typename P_, typename TA_,
+           typename Tag_, typename E_tag_>
+void
+Polyhedral_mesh_domain_with_features_3<GT_,P_,TA_,Tag_,E_tag_>::
+detect_borders(const std::vector<Polyhedron>& poly)
+{
+  if (borders_detected_)
+    return;//border detection has already been done
+
+  typedef std::vector<Point_3> Polyline;
+  typedef std::vector<Polyline>Polylines;
+
+  Polylines polylines;
+  Polyline empty;
+  typedef typename boost::graph_traits<Polyhedron>::halfedge_descriptor halfedge_descriptor;
+
+
+  for (std::size_t i = 0; i < poly.size(); ++i)
+  {
+    const Polyhedron& p = poly[i];
+  std::set<halfedge_descriptor> visited;
+  BOOST_FOREACH(halfedge_descriptor h, halfedges(p)){
+    if(visited.find(h) == visited.end()){
+      if(is_border(h,p)){
+        polylines.push_back(empty);
+        Polyline&  polyline = polylines.back();
+        polyline.push_back(source(h,p)->point());
+        BOOST_FOREACH(halfedge_descriptor h,halfedges_around_face(h,p)){
+          polyline.push_back(target(h,p)->point());
+          visited.insert(h);
+        }
+      } else {
+        visited.insert(h);
+      }
+    }
+  }
+  }
+
+  this->add_features(polylines.begin(), polylines.end());
+  borders_detected_ = true;
+}
+
+
+} //namespace CGAL
+
+
+#endif // CGAL_POLYHEDRAL_MESH_DOMAIN_WITH_FEATURES_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polyhedron_3.h b/3rdparty/CGAL/include/CGAL/Polyhedron_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polyhedron_3.h
rename to 3rdparty/CGAL/include/CGAL/Polyhedron_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polyhedron_copy_3.h b/3rdparty/CGAL/include/CGAL/Polyhedron_copy_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polyhedron_copy_3.h
rename to 3rdparty/CGAL/include/CGAL/Polyhedron_copy_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polyhedron_decorator_3.h b/3rdparty/CGAL/include/CGAL/Polyhedron_decorator_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polyhedron_decorator_3.h
rename to 3rdparty/CGAL/include/CGAL/Polyhedron_decorator_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polyhedron_incremental_builder_3.h b/3rdparty/CGAL/include/CGAL/Polyhedron_incremental_builder_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polyhedron_incremental_builder_3.h
rename to 3rdparty/CGAL/include/CGAL/Polyhedron_incremental_builder_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polyhedron_items_3.h b/3rdparty/CGAL/include/CGAL/Polyhedron_items_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polyhedron_items_3.h
rename to 3rdparty/CGAL/include/CGAL/Polyhedron_items_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polyhedron_items_with_id_3.h b/3rdparty/CGAL/include/CGAL/Polyhedron_items_with_id_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polyhedron_items_with_id_3.h
rename to 3rdparty/CGAL/include/CGAL/Polyhedron_items_with_id_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polyhedron_min_items_3.h b/3rdparty/CGAL/include/CGAL/Polyhedron_min_items_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polyhedron_min_items_3.h
rename to 3rdparty/CGAL/include/CGAL/Polyhedron_min_items_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polyhedron_traits_3.h b/3rdparty/CGAL/include/CGAL/Polyhedron_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polyhedron_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/Polyhedron_traits_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polyhedron_traits_with_normals_3.h b/3rdparty/CGAL/include/CGAL/Polyhedron_traits_with_normals_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polyhedron_traits_with_normals_3.h
rename to 3rdparty/CGAL/include/CGAL/Polyhedron_traits_with_normals_3.h
diff --git a/3rdparty/CGAL/include/CGAL/Polyline_constraint_hierarchy_2.h b/3rdparty/CGAL/include/CGAL/Polyline_constraint_hierarchy_2.h
new file mode 100644
index 0000000..aa6cf4c
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polyline_constraint_hierarchy_2.h
@@ -0,0 +1,1181 @@
+// Copyright (c) 2012  INRIA Sophia-Antipolis (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
+// 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(s)     : Andreas Fabri, Olivier Billet, Mariette Yvinec
+
+#ifndef CGAL_POLYLINE_CONSTRAINT_HIERARCHY_2_H
+#define CGAL_POLYLINE_CONSTRAINT_HIERARCHY_2_H
+
+#include <CGAL/basic.h>
+#include <utility>
+#include <map>
+#include <set> 
+#include <list> 
+#include <CGAL/Skiplist.h>
+#include <CGAL/Iterator_project.h>
+#include <CGAL/triangulation_assertions.h>
+
+namespace CGAL {
+
+// T               is expected to be Vertex_handle
+// Compare         is a comparison operator for type T
+// Data            is intended to store info on a Vertex
+template <class T, class Compare, class Data>
+class Polyline_constraint_hierarchy_2
+{
+public:
+  typedef Data                                    Point;
+  typedef T                                       Vertex_handle;
+  typedef std::pair<T, T>                         Edge;
+  typedef std::pair<T, T>                         Constraint;
+  typedef std::pair<T, T>                         Subconstraint;
+
+private:
+  class Node {
+  public:
+    explicit Node(Vertex_handle vh, bool input = false)
+      : vertex_(vh), point_(vh->point()), id(-1), input(input)
+    {}
+    Point& point() { return point_; }
+    const Point& point() const { return point_; }
+    Vertex_handle vertex() const { return vertex_; }
+  private:
+    Vertex_handle vertex_;
+    Point point_;
+  public:
+    int id;
+    bool input;
+  };
+
+  typedef CGAL::Skiplist<Node>  Vertex_list;
+  typedef std::list<Constraint> Constraint_list;
+
+public:
+  // the base line is always 
+  class Point_it 
+    : public boost::iterator_adaptor<
+    Point_it
+    , typename Vertex_list::all_iterator 
+    , Point
+    >
+  {
+  public:
+    Point_it() : Vertex_it::iterator_adaptor_() {}
+    Point_it(typename Vertex_list::all_iterator it) : Point_it::iterator_adaptor_(it) {}
+  private:
+    friend class boost::iterator_core_access;
+    Point& dereference() const { return this->base()->point(); }
+  };
+
+  // only nodes with a vertex_handle that is still in the triangulation
+  class Vertex_it 
+    : public boost::iterator_adaptor<
+    Vertex_it
+    , typename Vertex_list::skip_iterator 
+    , Vertex_handle
+    , boost::use_default
+    , Vertex_handle>
+  {
+  public:
+    Vertex_it() : Vertex_it::iterator_adaptor_() {}
+    Vertex_it(typename Vertex_list::skip_iterator it) : Vertex_it::iterator_adaptor_(it) {}
+    operator Point_it() const { return Point_it(this->base()); }
+    bool& input() { return this->base()->input; }
+  private:
+    friend class boost::iterator_core_access;
+    Vertex_handle dereference() const { return this->base()->vertex(); }
+  };
+
+  typedef typename Constraint_list::iterator Constraint_it;
+
+  struct Constraint_id {
+    Vertex_list* second;
+
+    Constraint_id(): second(NULL) {}
+
+    Constraint_id(Vertex_list* vl)
+      : second(vl)
+    {}
+
+    Vertex_list* vl_ptr() const {return second;}
+
+    operator std::pair<std::pair<Vertex_handle, Vertex_handle>,Vertex_list*>()
+    { 
+      if (second!=NULL){
+        return std::make_pair(std::make_pair(second->front().vertex(),
+                                             second->back().vertex()),second);
+      } 
+      return std::make_pair(std::make_pair(Vertex_handle(),Vertex_handle()),second);
+    }
+
+    bool operator == (const Constraint_id& other) const
+    {
+      return second == other.second;
+    }
+    bool operator != (const Constraint_id& other) const
+    {
+      return second != other.second;
+    }
+
+    bool operator<(const Constraint_id& other) const{
+      return second < other.second;
+    }
+  };
+
+  class Pair_compare {
+    Compare comp;
+
+  public:
+    Pair_compare(const Compare& comp) : comp(comp) {}
+
+    bool operator()(const Edge& e1, const Edge& e2) const {
+      if(comp(e1.first, e2.first)) {
+        return true;
+      } else if((! comp(e2.first, e1.first)) && //  !less(e1,e2) && !less(e2,e1) == equal
+                comp(e1.second, e2.second)) {
+        return true;
+      } else {
+        return false;
+      }
+    }
+  };
+
+  class Context {
+    friend class Polyline_constraint_hierarchy_2<T,Compare,Data>;
+  private:
+    Vertex_list*    enclosing;
+    Vertex_it       pos;
+  public:
+    Context() : enclosing(NULL) {}
+
+    Context(const Context& hc)
+      : enclosing(hc.enclosing), pos(hc.pos)
+    {}
+
+    Vertex_it    vertices_begin() { return enclosing->skip_begin();}
+    Vertex_it    current() {return pos;}
+    Vertex_it    vertices_end() {return enclosing->skip_end();}
+    Constraint_id  id() { return enclosing; }
+    std::size_t    number_of_vertices() const {return enclosing->skip_size(); }
+  };                                           
+
+  typedef std::list<Context>              Context_list;
+  typedef typename Context_list::iterator Context_iterator;
+
+  typedef std::set<Constraint_id>           Constraint_set;
+  typedef std::map<Edge, Context_list*,
+		   Pair_compare>            Sc_to_c_map;
+  typedef typename Constraint_set::iterator C_iterator;
+  typedef typename Sc_to_c_map::const_iterator    Sc_iterator;
+  typedef Sc_iterator Subconstraint_iterator;
+  
+private:
+  // data for the 1d hierarchy
+  Compare          comp;
+  Constraint_set   constraint_set;
+  Sc_to_c_map      sc_to_c_map;
+  std::map<std::pair<Vertex_handle, Vertex_handle>,
+	   Constraint_id,
+	   Pair_compare> constraint_map;
+  
+public:
+  Polyline_constraint_hierarchy_2(const Compare& comp)
+    : comp(comp)
+    , sc_to_c_map(Pair_compare(comp))
+    , constraint_map(Pair_compare(comp))
+  { }
+  Polyline_constraint_hierarchy_2(const Polyline_constraint_hierarchy_2& ch); 
+  ~Polyline_constraint_hierarchy_2(){ clear();}
+  void clear();
+  Polyline_constraint_hierarchy_2& operator=(const Polyline_constraint_hierarchy_2& ch);
+
+  // Query 
+  bool is_subconstrained_edge(T va, T vb) const;
+  bool is_constrained_edge(T va, T vb) const;
+  bool is_constrained_vertex(T v) const;
+
+  Vertex_it vertices_in_constraint_begin(Constraint_id cid) const
+  { return cid.vl_ptr()->skip_begin(); }
+  Vertex_it vertices_in_constraint_end(Constraint_id cid) const
+  { return cid.vl_ptr()->skip_end(); }
+
+  Vertex_it vertices_in_constraint_begin(Vertex_handle va, Vertex_handle vb) const
+  { Constraint_id cid = constraint_map.find(make_edge(va,vb))->second;
+    return cid.vl_ptr()->skip_begin(); }
+
+  Vertex_it vertices_in_constraint_end(Vertex_handle va, Vertex_handle vb) const
+  { Constraint_id cid = constraint_map.find(make_edge(va,vb))->second;
+    return cid.vl_ptr()->skip_end(); }
+
+  Point_it points_in_constraint_begin(Constraint_id cid) const
+  { return cid.vl_ptr()->all_begin(); }
+  Point_it points_in_constraint_end(Constraint_id cid) const
+  { return cid.vl_ptr()->all_end(); }
+
+  bool enclosing_constraint(Edge he, Constraint& hc) const;
+  bool enclosing_constraint(T  vaa, T  vbb, T& va, T& vb) const;
+  bool enclosing_constraints(T vaa, T  vbb,  Constraint_list& hcl) const;
+  bool next_along_sc(T va, T vb, T& w) const;
+  void oriented_end(T va, T vb, T& vc) const;
+
+  Context context(T va, T vb);
+  std::size_t number_of_enclosing_constraints(T va, T vb) const;
+  Context_iterator contexts_begin(T va, T vb) const;
+  Context_iterator contexts_end(T va, T vb) const;
+  std::size_t number_of_constraints() const  { return constraint_set.size();}
+  std::size_t number_of_subconstraints()const {return sc_to_c_map.size();}
+  
+
+  // insert/remove
+  void add_Steiner(T va, T vb, T vx);
+  Vertex_list* insert_constraint(T va, T vb);
+  void append_constraint(Constraint_id cid, T va, T vb);
+  void swap(Constraint_id first, Constraint_id second);
+  void remove_constraint(Constraint_id cid);
+
+  void remove_constraint(Vertex_handle va, Vertex_handle vb)
+  {
+    remove_constraint(constraint_map[make_edge(va,vb)]);
+  }
+
+  void split_constraint(T va, T vb, T vc);
+
+  void simplify(Vertex_it u,
+                Vertex_it v,
+                Vertex_it w);
+
+  std::size_t remove_points_without_corresponding_vertex(Constraint_id);
+  std::size_t remove_points_without_corresponding_vertex();
+
+  Constraint_id concatenate(Constraint_id first, Constraint_id second);
+  Constraint_id concatenate2(Constraint_id first, Constraint_id second);
+  Constraint_id split(Constraint_id first, Vertex_it vcit);
+  Constraint_id split2(Constraint_id first, Vertex_it vcit);
+
+  void remove_Steiner(T v, T va, T vb);
+
+  // iterators
+
+  Subconstraint_iterator subconstraint_begin() const
+  { 
+    return sc_to_c_map.begin(); 
+  }
+
+  Subconstraint_iterator subconstraint_end() const
+  { 
+    return sc_to_c_map.end();   
+  }
+
+  Sc_iterator sc_begin() const{ return sc_to_c_map.begin(); }
+  Sc_iterator sc_end()   const{ return sc_to_c_map.end();   }
+  C_iterator  c_begin()  const{ return constraint_set.begin(); }
+  C_iterator  c_end()    const{ return constraint_set.end();   }
+  
+  // Helper functions
+  void copy(const Polyline_constraint_hierarchy_2& ch);
+  void copy(const Polyline_constraint_hierarchy_2& ch, std::map<Vertex_handle,Vertex_handle>& vmap);
+  void swap(Polyline_constraint_hierarchy_2& ch);
+
+private: 
+  Edge      make_edge(T va, T vb) const;
+  Vertex_it get_pos(T va, T vb) const;
+  bool      get_contexts(T va, T vb, 
+			 Context_iterator& ctxt, 
+			 Context_iterator& past) const;
+
+  bool      get_contexts(T va, T vb, Context_list*&) const;
+
+  //to_debug
+public:
+  void   print() const;
+};
+
+template <class T, class Compare, class Data>
+Polyline_constraint_hierarchy_2<T,Compare,Data>::
+Polyline_constraint_hierarchy_2(const Polyline_constraint_hierarchy_2& ch)
+  : comp(ch.comp)
+  , sc_to_c_map(Pair_compare(comp))
+  , constraint_map(Pair_compare(comp))
+{
+  copy(ch);
+}
+
+template <class T, class Compare, class Data>
+Polyline_constraint_hierarchy_2<T,Compare,Data>&
+Polyline_constraint_hierarchy_2<T,Compare,Data>::
+operator=(const Polyline_constraint_hierarchy_2& ch){
+  copy(ch);
+  return *this;
+}
+
+template <class T, class Compare, class Data>
+void
+Polyline_constraint_hierarchy_2<T,Compare,Data>::
+copy(const Polyline_constraint_hierarchy_2& ch1)
+{
+  // create a identity transfer vertex map
+  std::map<Node, Node>  vmap;
+  C_iterator cit1 = ch1.c_begin();
+  for( ; cit1 != ch1.c_end(); ++cit1) {
+    Vertex_it vit = cit1->second->begin();
+    for( ; vit != cit1->second->end(); ++vit) {
+      vmap[*vit] = *vit;
+    }
+  }
+  copy(ch1, vmap);
+}
+
+template <class T, class Compare, class Data>
+void
+Polyline_constraint_hierarchy_2<T,Compare,Data>::
+copy(const Polyline_constraint_hierarchy_2& ch1, std::map<Vertex_handle,Vertex_handle>& vmap)
+  // copy with a transfer vertex map
+{
+  std::map<Vertex_list*,Vertex_list*> vlmap;
+  clear();
+  // copy constraint_set
+  C_iterator cit1 = ch1.c_begin();
+  for( ; cit1 != ch1.c_end(); ++cit1) {
+    Vertex_list* hvl1 = cit1->vl_ptr();
+    Vertex_list* hvl2 = new Vertex_list;
+    vlmap[hvl1] = hvl2;
+    Vertex_it vit = hvl1->skip_begin(), end = hvl1->skip_end();
+    for( ; vit != end; ++vit) hvl2->push_back(Node(vmap[*vit]));
+    constraint_set.insert(hvl2);
+  }
+  // copy sc_to_c_map
+  Sc_iterator scit1 = ch1.sc_begin();
+  for( ; scit1 != ch1.sc_end(); ++scit1) {
+    //vertices of the subconstraints
+    Vertex_handle uu2 = vmap[scit1->first.first];
+    Vertex_handle vv2 = vmap[scit1->first.second];
+    Context_list* hcl1  = scit1->second;
+    Context_list* hcl2  = new Context_list;
+    Context_iterator cit1 = hcl1->begin();
+    for( ; cit1 != hcl1->end(); ++cit1){
+      // vertices of the enclosing constraints
+      Context ctxt2;
+      ctxt2.enclosing = vlmap[cit1->enclosing];
+      ctxt2.pos = ctxt2.enclosing->skip_begin();
+      Vertex_it aux = cit1->enclosing->skip_begin();
+      while( aux != cit1->pos) {
+	++aux;
+	++ctxt2.pos;
+      }
+      hcl2->push_back(ctxt2);
+    }
+    sc_to_c_map[make_edge(uu2,vv2)] = hcl2;
+  }
+
+  comp = ch1.comp;
+  return;
+}
+
+
+template <class T, class Compare, class Data>
+void
+Polyline_constraint_hierarchy_2<T,Compare,Data>::
+swap(Polyline_constraint_hierarchy_2& ch)
+{
+  constraint_set.swap(ch.constraint_set);
+  sc_to_c_map.swap(ch.sc_to_c_map);
+}
+
+
+/*
+template <class T, class Compare, class Data>
+bool Polyline_constraint_hierarchy_2<T,Compare,Data>::
+is_constrained_edge(T va, T vb) const
+{
+  return( c_to_sc_map.find(make_edge(va, vb)) != c_to_sc_map.end() );
+}
+*/
+
+template <class T, class Compare, class Data>
+bool Polyline_constraint_hierarchy_2<T,Compare,Data>::
+is_subconstrained_edge(T va, T vb) const
+{
+  return( sc_to_c_map.find(make_edge(va, vb)) != sc_to_c_map.end() );
+}
+
+
+// af: obsolete
+template <class T, class Compare, class Data>
+bool Polyline_constraint_hierarchy_2<T,Compare,Data>::
+enclosing_constraint(Edge he, Constraint& hc) const
+{
+  Context_iterator hcit, past;
+  if ( !get_contexts(he.first,he.second, hcit ,past)) return false;
+  hc = make_edge(hcit->enclosing->front(), hcit->enclosing->back());
+  return true;
+}
+
+
+// used by Constrained_triangulation_plus_2::intersect with Exact_intersection_tag
+template <class T, class Compare, class Data>
+bool Polyline_constraint_hierarchy_2<T,Compare,Data>::
+enclosing_constraint(T  vaa, T  vbb, T& va, T& vb) const
+{
+  Context_iterator hcit, past;
+  if ( !get_contexts(vaa,vbb, hcit ,past)) return false;
+  // va = hcit->enclosing->front().vertex();
+  // vb = hcit->enclosing->back().vertex();
+  // Vertex_list* vl = hcit->enclosing;
+  Vertex_it pos = hcit->pos;
+  if(vaa != *pos){
+    std::swap(vaa,vbb);
+  }
+  while(!pos.input()){
+    --pos;
+  }
+  va = *pos;
+  pos = hcit->pos;
+  ++pos;
+  CGAL_triangulation_assertion(vbb == *pos);
+  while(!pos.input()){
+    ++pos;
+  }
+  vb = *pos;
+  return true;
+}
+
+// af: obsolete
+template <class T, class Compare, class Data>
+bool Polyline_constraint_hierarchy_2<T,Compare,Data>::
+enclosing_constraints(T vaa, T vbb , Constraint_list& hcl) const
+{
+  Context_iterator hcit, past;
+  if ( !get_contexts(vaa,vbb, hcit ,past)) return false;
+  for (; hcit!=past; hcit++) {
+    hcl.push_back(make_edge(hcit->enclosing->front(), 
+			    hcit->enclosing->back())); 
+  }
+  return true;
+}
+
+template <class T, class Compare, class Data>
+typename Polyline_constraint_hierarchy_2<T,Compare,Data>::Context
+Polyline_constraint_hierarchy_2<T,Compare,Data>::
+context(T va, T vb)
+{
+  Context_iterator hcit, past;
+  if(!get_contexts(va,vb, hcit ,past)) CGAL_triangulation_assertion(false);
+  return *hcit;
+}
+
+template <class T, class Compare, class Data>
+std::size_t 
+Polyline_constraint_hierarchy_2<T,Compare,Data>::
+number_of_enclosing_constraints(T va, T vb) const
+{
+  Context_list* hcl = NULL;
+  CGAL_triangulation_assertion_code( bool found = ) get_contexts(va,vb,hcl);
+  CGAL_triangulation_assertion(found);
+  return hcl->size();
+}
+
+template <class T, class Compare, class Data>
+typename Polyline_constraint_hierarchy_2<T,Compare,Data>::Context_iterator
+Polyline_constraint_hierarchy_2<T,Compare,Data>::
+contexts_begin(T va, T vb) const
+{
+   Context_iterator first, last;
+   if( !get_contexts(va,vb,first,last))  CGAL_triangulation_assertion(false);
+   return first;
+}
+
+template <class T, class Compare, class Data>
+typename Polyline_constraint_hierarchy_2<T,Compare,Data>::Context_iterator
+Polyline_constraint_hierarchy_2<T,Compare,Data>::
+contexts_end(T va, T vb) const
+{   
+   Context_iterator first, last;
+   if( !get_contexts(va,vb,first,last))  CGAL_triangulation_assertion(false);
+   return last;
+} 
+
+template <class T, class Compare, class Data>
+void
+Polyline_constraint_hierarchy_2<T,Compare,Data>::
+swap(Constraint_id first, Constraint_id second){
+    // We have to look at all subconstraints
+  for(Vertex_it it = first.vl_ptr()->skip_begin(), succ = it, end = first.vl_ptr()->skip_end(); 
+      ++succ != end; 
+      ++it){
+    typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ));
+    CGAL_triangulation_assertion(scit != sc_to_c_map.end());
+    Context_list* hcl = scit->second;
+
+    // and replace the context of the constraint
+    for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
+      if(ctit->enclosing == first.vl_ptr()){
+	ctit->enclosing = 0;
+	break;
+      }
+    }
+  }
+    // We have to look at all subconstraints
+  for(Vertex_it it = second.vl_ptr()->skip_begin(), succ = it, end = second.vl_ptr()->skip_end(); 
+      ++succ != end; 
+      ++it){
+    typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ));
+    CGAL_triangulation_assertion(scit != sc_to_c_map.end());
+    Context_list* hcl = scit->second;
+
+    // and replace the context of the constraint
+    for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
+      if(ctit->enclosing == second.vl_ptr()){
+	ctit->enclosing = first.vl_ptr();
+	break;
+      }
+    }
+  }   
+  // We have to look at all subconstraints
+  for(Vertex_it it = first.vl_ptr()->skip_begin(), succ = it, end = first.vl_ptr()->skip_end(); 
+      ++succ != end; 
+      ++it){
+    typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ));
+    CGAL_triangulation_assertion(scit != sc_to_c_map.end());
+    Context_list* hcl = scit->second;
+
+    // and replace the context of the constraint
+    for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
+      if(ctit->enclosing == 0){
+	ctit->enclosing = second.vl_ptr();
+	break;
+      }
+    }
+  }
+  first.vl_ptr()->swap(*second.vl_ptr());
+}
+
+
+template <class T, class Compare, class Data>
+void
+Polyline_constraint_hierarchy_2<T,Compare,Data>::
+remove_constraint(Constraint_id cid){
+  constraint_set.erase(cid);
+  
+  // We have to look at all subconstraints
+  for(Vertex_it it = cid.vl_ptr()->skip_begin(), succ = it, end = cid.vl_ptr()->skip_end(); 
+      ++succ != end; 
+      ++it){
+    typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ));
+    CGAL_triangulation_assertion(scit != sc_to_c_map.end());
+    Context_list* hcl = scit->second;
+
+    // and remove the context of the constraint
+    for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
+      if(ctit->enclosing == cid.vl_ptr()){
+	    hcl->erase(ctit);
+		break;
+      }
+    }
+    // If the constraint passes several times through the same subconstraint,
+    // the above loop maybe removes them in the wrong order
+
+    // If this was the only context in the list, delete the context list
+    if(hcl->empty()){
+      sc_to_c_map.erase(scit);
+      delete hcl;
+    }
+  }
+  delete cid.vl_ptr();
+}
+
+
+// This function removes vertex v from the polyline constraint
+// It only works for one polyline passing through v
+// and for the case that the constrained edge u,w has no intersections
+template <class T, class Compare, class Data>
+void Polyline_constraint_hierarchy_2<T,Compare,Data>::simplify(Vertex_it uc,
+                                                       Vertex_it vc,
+                                                       Vertex_it wc)
+
+{
+  Vertex_handle u = *uc, v = *vc, w = *wc;
+  typename Sc_to_c_map::iterator uv_sc_iter = sc_to_c_map.find(make_edge(u, v));
+  CGAL_assertion_msg( uv_sc_iter != sc_to_c_map.end(), "not a subconstraint" );
+  Context_list*  uv_hcl = uv_sc_iter->second;
+  CGAL_assertion_msg((u == w) || (uv_hcl->size() == 1), "more than one constraint passing through the subconstraint" );
+
+  if(*(uv_hcl->front().current()) != u) {
+    std::swap(u,w);
+    uv_sc_iter = sc_to_c_map.find(make_edge(u, v));
+    CGAL_assertion_msg( uv_sc_iter != sc_to_c_map.end(), "not a subconstraint" );
+    uv_hcl = (*uv_sc_iter).second;
+    CGAL_assertion_msg((u == w) || (uv_hcl->size() == 1), "more than one constraint passing through the subconstraint" );
+  }
+  // now u,v, and w are ordered along the polyline constraint
+  if(vc.input()){
+    uc.input() = true;
+    wc.input() = true;
+  }
+  typename Sc_to_c_map::iterator vw_sc_iter = sc_to_c_map.find(make_edge(v, w));
+  CGAL_assertion_msg( vw_sc_iter != sc_to_c_map.end(), "not a subconstraint" );
+  Context_list*  vw_hcl = vw_sc_iter->second;
+    CGAL_assertion_msg((u == w) || (vw_hcl->size() == 1), "more than one constraint passing through the subconstraint" );
+ 
+  Vertex_list* vertex_list = uv_hcl->front().id().vl_ptr();
+  CGAL_assertion_msg(vertex_list  == vw_hcl->front().id().vl_ptr(), "subconstraints from different polyline constraints" );
+  // Remove the list item which points to v
+  vertex_list->skip(vc.base());
+  
+  if(u != w){
+    // Remove the entries for [u,v] and [v,w]
+    sc_to_c_map.erase(uv_sc_iter);
+    sc_to_c_map.erase(vw_sc_iter);
+    delete vw_hcl;
+    // reuse other context list
+    sc_to_c_map[make_edge(u,w)] = uv_hcl;
+  }else{
+    sc_to_c_map.erase(uv_sc_iter);
+    delete vw_hcl;
+  }
+}
+
+
+template <class T, class Compare, class Data>
+std::size_t
+Polyline_constraint_hierarchy_2<T,Compare,Data>::remove_points_without_corresponding_vertex(Constraint_id cid)
+{
+  std::size_t n = 0;
+  for(Point_it it = points_in_constraint_begin(cid); 
+      it != points_in_constraint_end(cid); ++it) { 
+    if(cid.vl_ptr()->is_skipped(it.base())) {
+      it = cid.vl_ptr()->erase(it.base());
+      ++n;
+    }
+  }
+  return n;
+}
+
+template <class T, class Compare, class Data>
+std::size_t
+Polyline_constraint_hierarchy_2<T,Compare,Data>::remove_points_without_corresponding_vertex()
+{
+  std::size_t n = 0;
+  for(C_iterator it = constraint_set.begin(); it!= constraint_set.end(); ++it){
+    n+= remove_points_without_corresponding_vertex(*it);
+  }
+  return n;
+}
+
+
+template <class T, class Compare, class Data>
+typename Polyline_constraint_hierarchy_2<T,Compare,Data>::Constraint_id
+Polyline_constraint_hierarchy_2<T,Compare,Data>::concatenate(Constraint_id first, Constraint_id second)
+{
+  constraint_set.erase(first);
+  constraint_set.erase(second);
+  // We have to look at all subconstraints
+  for(Vertex_it it = second.vl_ptr()->skip_begin(), succ = it, end = second.vl_ptr()->skip_end(); 
+      ++succ != end; 
+      ++it){
+    typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ));
+    CGAL_triangulation_assertion(scit != sc_to_c_map.end());
+    Context_list* hcl = scit->second;
+
+    // and replace the context of the constraint
+    for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
+      if(ctit->enclosing == second.vl_ptr()){
+	ctit->enclosing = first.vl_ptr();
+	break;
+      }
+    }
+  }
+  // now we really concatenate the vertex lists
+  // Note that all iterators pointing into second remain valid.
+  // This concerns user code, as well as  the data member "pos" of the Context class
+  first.vl_ptr()->pop_back(); // because it is the same as second.front()
+  Vertex_it back_it = first.vl_ptr()->skip_end();
+  --back_it;
+  first.vl_ptr()->splice(first.vl_ptr()->skip_end(), *(second.vl_ptr()), second.vl_ptr()->skip_begin(), second.vl_ptr()->skip_end());
+
+  // Note that for VC8 with iterator debugging the iterators pointing into second
+  // are NOT valid      So we have to update them
+  for(Vertex_it it = back_it, succ = it, end = first.vl_ptr()->skip_end(); 
+      ++succ != end; 
+      ++it){
+    typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ));
+    CGAL_triangulation_assertion(scit != sc_to_c_map.end());
+    Context_list* hcl = scit->second;
+
+    // and update pos in the context of the constraint
+    for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
+      if(ctit->enclosing == first.vl_ptr()){
+	ctit->pos = it;
+	break;
+      }
+    }
+    }
+  constraint_set.insert(first);
+
+  delete second.vl_ptr();
+  return first;
+}
+
+template <class T, class Compare, class Data>
+typename Polyline_constraint_hierarchy_2<T,Compare,Data>::Constraint_id
+Polyline_constraint_hierarchy_2<T,Compare,Data>::concatenate2(Constraint_id first, Constraint_id second)
+{  
+  constraint_set.erase(first);
+  constraint_set.erase(second);
+  // We have to look at all subconstraints
+  for(Vertex_it it = first.vl_ptr()->skip_begin(), succ = it, end = first.vl_ptr()->skip_end(); 
+      ++succ != end; 
+      ++it){
+    typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ));
+    CGAL_triangulation_assertion(scit != sc_to_c_map.end());
+    Context_list* hcl = scit->second;
+
+    // and replace the context of the constraint
+    for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
+      if(ctit->enclosing == first.vl_ptr()){
+	ctit->enclosing = second.vl_ptr();
+	break;
+      }
+    }
+  }
+  // now we really concatenate the vertex lists
+  // Note that all iterators pointing into second remain valid.
+  first.vl_ptr()->pop_back(); // because it is the same as second.front()
+  Vertex_it back_it = first.vl_ptr()->skip_end();
+  --back_it;
+  second.vl_ptr()->splice(second.vl_ptr()->skip_begin(), *(first.vl_ptr()), first.vl_ptr()->skip_begin(), first.vl_ptr()->skip_end());
+
+  // Note that for VC8 with iterator debugging the iterators pointing into second
+  // are NOT valid      So we have to update them
+  for(Vertex_it it = back_it, succ = it, end = first.vl_ptr()->skip_end(); 
+      ++succ != end; 
+      ++it){
+    typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ));
+    CGAL_triangulation_assertion(scit != sc_to_c_map.end());
+    Context_list* hcl = scit->second;
+
+    // and update pos in the context of the constraint
+    for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
+      if(ctit->enclosing == second.vl_ptr()){
+	ctit->pos = it;
+	break;
+      }
+    }
+  }
+  constraint_set.insert(second);
+
+  delete first.vl_ptr();
+  return second.vl_ptr();
+}
+
+
+  // split a constraint in two constraints, so that vcit becomes the first
+  // vertex of the new constraint
+  // returns the new constraint 
+template <class T, class Compare, class Data>
+typename Polyline_constraint_hierarchy_2<T,Compare,Data>::Constraint_id
+Polyline_constraint_hierarchy_2<T,Compare,Data>::split(Constraint_id first, Vertex_it vcit)
+{
+  constraint_set.erase(first);
+  Vertex_list* second = new Vertex_list;
+  second->splice(second->skip_end(), *(first.vl_ptr()), vcit.base(), first.vl_ptr()->skip_end());
+  first.vl_ptr()->push_back(second->front()); // Duplicate the common vertex
+  Vertex_it vit = second->skip_begin();
+  vit.input() = true;
+  vit = first.vl_ptr()->skip_end();
+  --vit;
+  vit.input() = true;
+  constraint_set.insert(first);
+  constraint_set.insert(second);
+ // We have to look at all subconstraints
+  for(Vertex_it it = second->skip_begin(), succ = it, end = second->skip_end(); 
+      ++succ != end; 
+      ++it){
+    typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ));
+    CGAL_triangulation_assertion(scit != sc_to_c_map.end());
+    Context_list* hcl = scit->second;
+
+    // and replace the context of the constraint
+    for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
+      if(ctit->enclosing == first.vl_ptr()){
+	ctit->enclosing = second;
+	break;
+      }
+    }
+  }
+  return second;
+}
+
+template <class T, class Compare, class Data>
+typename Polyline_constraint_hierarchy_2<T,Compare,Data>::Constraint_id
+Polyline_constraint_hierarchy_2<T,Compare,Data>::split2(Constraint_id first, Vertex_it vcit)
+{
+  constraint_set.erase(first);
+  Vertex_list* second = new Vertex_list;
+  second->splice(second->skip_end(), *first.vl_ptr(), first.vl_ptr()->skip_begin(), vcit.base());
+  second->push_back(first.vl_ptr()->front()); // Duplicate the common vertex
+  Vertex_it vit = second->skip_end();
+  --vit;
+  vit.input() = true;
+  vit = first.vl_ptr()->skip_begin();
+  vit.input() = true;
+  constraint_set.insert(first);
+  constraint_set.insert(second);
+ // We have to look at all subconstraints
+  for(Vertex_it it = second->skip_begin(), succ = it, end = second->skip_end(); 
+      ++succ != end; 
+      ++it){
+    typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ));
+    CGAL_triangulation_assertion(scit != sc_to_c_map.end());
+    Context_list* hcl = scit->second;
+
+    // and replace the context of the constraint
+    for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
+      if(ctit->enclosing == first.vl_ptr()){
+	ctit->enclosing = second;
+	break;
+      }
+    }
+  }
+  return second;
+}
+
+
+/*
+when a constraint is inserted,
+it is, at first, both  a constraint and a subconstraint
+ */
+template <class T, class Compare, class Data>
+typename Polyline_constraint_hierarchy_2<T,Compare,Data>::Vertex_list*
+Polyline_constraint_hierarchy_2<T,Compare,Data>::
+insert_constraint(T va, T vb){
+  Edge        he = make_edge(va, vb);
+  Vertex_list*  children = new Vertex_list; 
+  Context_list* fathers;
+
+  typename Sc_to_c_map::iterator scit = sc_to_c_map.find(he);
+  if(scit == sc_to_c_map.end()){
+    fathers = new Context_list;
+    sc_to_c_map.insert(std::make_pair(he,fathers));
+  } else {
+    fathers = scit->second;
+  }
+
+  children->push_front(Node(va, true));  // was he.first
+  children->push_back(Node(vb, true));   // was he.second
+  constraint_set.insert(children);
+  Context ctxt;
+  ctxt.enclosing = children;
+  ctxt.pos     = children->skip_begin();
+  fathers->push_front(ctxt);
+
+  constraint_map[he] = children;
+  return children;
+}
+
+
+template <class T, class Compare, class Data>
+void
+Polyline_constraint_hierarchy_2<T,Compare,Data>::
+append_constraint(Constraint_id cid, T va, T vb){
+  Edge        he = make_edge(va, vb);
+  Context_list* fathers;
+
+  typename Sc_to_c_map::iterator scit = sc_to_c_map.find(he);
+  if(scit == sc_to_c_map.end()){
+    fathers = new Context_list;
+    sc_to_c_map.insert(std::make_pair(he,fathers));
+  } else {
+    fathers = scit->second;
+  }
+
+  typename Vertex_list::skip_iterator bit = cid.vl_ptr()->skip_end();
+  --bit;
+  cid.vl_ptr()->push_back(Node(vb, true));
+  Context ctxt;
+  ctxt.enclosing = cid.vl_ptr();
+  ctxt.pos     = bit;
+  fathers->push_front(ctxt);
+}
+
+
+template <class T, class Compare, class Data>
+void Polyline_constraint_hierarchy_2<T,Compare,Data>::
+clear()
+{
+  C_iterator cit;
+  Sc_iterator scit;
+  // clean and delete vertices lists
+  for(cit=constraint_set.begin(); cit != constraint_set.end();  cit++){
+    cit->vl_ptr()->clear();
+    delete cit->vl_ptr();
+  }
+  // clean and delete context lists
+  for(scit=sc_to_c_map.begin(); scit != sc_to_c_map.end(); scit++){
+    (*scit).second->clear();
+    delete (*scit).second;
+  }
+  sc_to_c_map.clear();
+  constraint_set.clear();
+  constraint_map.clear();
+}
+
+
+template <class T, class Compare, class Data>
+bool Polyline_constraint_hierarchy_2<T,Compare,Data>::
+next_along_sc(T va, T vb, T& w) const
+{
+  // find the next vertex after vb along any enclosing constrained
+  // return false if there is no ....
+  Context_iterator  ctxtit, past;
+  if(!get_contexts(va, vb, ctxtit, past)) CGAL_triangulation_assertion(false);
+
+  Vertex_it pos;
+  for( ; ctxtit != past; ctxtit++){
+    pos = ctxtit->pos;
+    if((*pos)==va) {
+      ++pos; ++pos;
+      if (pos != ctxtit->enclosing->end()) {  w=(*pos); return true;}
+    }
+    else {
+      if (pos != ctxtit->enclosing->begin()) {--pos; w=(*pos); return true;}
+    }
+  }
+  return false;
+}
+
+
+
+/*
+  Attention, le point v DOIT etre un point de Steiner,
+  et les segments va,v et v,vb sont des sous contraintes.
+*/
+template <class T, class Compare, class Data>
+void Polyline_constraint_hierarchy_2<T,Compare,Data>::
+remove_Steiner(T v, T va, T vb)
+{
+  // remove a Steiner point
+  CGAL_precondition(!is_constrained_vertex(v));
+ 
+  Context_list*  hcl1;
+  Context_list*  hcl2;
+  if(!get_contexts(va,v,hcl1)) CGAL_triangulation_assertion(false);
+  if(!get_contexts(v,vb,hcl2)) CGAL_triangulation_assertion(false);
+
+  Vertex_it      pos;
+  for(Context_iterator ctit=hcl1->begin(); ctit != hcl1->end(); ctit++){
+    pos = ctit->pos;
+    if((*pos)==va) pos++;
+    pos = ctit->enclosing->erase(pos);
+    ctit->pos = --pos;
+  }
+
+  sc_to_c_map.erase(make_edge(va,v));
+  sc_to_c_map.erase(make_edge(v,vb));
+  delete hcl2;
+  sc_to_c_map.insert(std::make_pair(make_edge(va,vb),hcl1));
+}
+
+
+
+/*
+  same as add_Steiner
+  precondition : va,vb est une souscontrainte. 
+*/
+template <class T, class Compare, class Data>
+void Polyline_constraint_hierarchy_2<T,Compare,Data>::
+split_constraint(T va, T vb, T vc){
+  add_Steiner(va, vb, vc);
+}
+
+
+template <class T, class Compare, class Data>
+void 
+Polyline_constraint_hierarchy_2<T,Compare,Data>::
+add_Steiner(T va, T vb, T vc){
+  Context_list* hcl=NULL;
+  if(!get_contexts(va,vb,hcl)) CGAL_triangulation_assertion(false);
+
+  Context_list* hcl2 = new  Context_list;
+
+  Vertex_it      pos;
+  Context  ctxt;
+  for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
+    // insert vc in enclosing constraint
+    pos = ctit->current();
+    ++pos;
+    pos = ctit->enclosing->insert(pos.base(), Node(vc));
+    --pos;
+    
+    // set ctxt to the context of (vc,vb)
+    // change *ctit in hcl to the context of (va,vc)
+    // add ctxt to hcl2 list
+    ctxt.enclosing = ctit->enclosing;  
+    if(*pos == va) {
+      ctit->pos = pos;
+      ctxt.pos = ++pos;
+    }
+    else { //(*pos)==vb
+      ctxt.pos = pos;
+      ctit->pos = ++pos;
+    }
+    hcl2->push_back(ctxt);
+  }
+
+  Context_list* hcl3;
+  if (get_contexts(va,vc,hcl3)) { // (va,vc) is already a subconstraint
+    hcl3->splice(hcl3->end(), *hcl);
+    delete hcl;
+  }
+  else   sc_to_c_map.insert(std::make_pair(make_edge(va,vc), hcl));
+
+  if (get_contexts(vc,vb,hcl3)) {// (vc,vb) is already a subconstraint
+    hcl3->splice(hcl3->end(),*hcl2);
+
+    delete hcl2;
+  }
+  else  sc_to_c_map.insert(std::make_pair(make_edge(vc,vb), hcl2));
+    
+  
+  sc_to_c_map.erase(make_edge(va,vb));
+  return;
+}
+
+
+template <class T, class Compare, class Data>
+inline
+typename Polyline_constraint_hierarchy_2<T,Compare,Data>::Edge
+Polyline_constraint_hierarchy_2<T,Compare,Data>::
+make_edge(T va, T vb) const
+{
+  return comp(va, vb) ? Edge(va,vb) : Edge(vb,va);
+}
+
+template <class T, class Compare, class Data>
+inline
+bool
+Polyline_constraint_hierarchy_2<T,Compare,Data>::
+get_contexts(T va, T vb, Context_list* & hcl) const
+{
+  Sc_iterator sc_iter = sc_to_c_map.find(make_edge(va,vb));
+  if( sc_iter == sc_to_c_map.end() )    return(false);
+  hcl = (*sc_iter).second;
+  return true;
+}
+
+template <class T, class Compare, class Data>
+inline
+bool
+Polyline_constraint_hierarchy_2<T,Compare,Data>::
+get_contexts(T va, T vb, 
+	     Context_iterator& ctxt, 
+	     Context_iterator& past) const
+{
+  Context_list* hcl;
+  if (!get_contexts(va,vb,hcl)) return false;
+  ctxt = hcl->begin();
+  past = hcl->end();
+  return true;    
+}
+
+
+
+template <class T, class Compare, class Data>
+inline
+typename Polyline_constraint_hierarchy_2<T,Compare,Data>::Vertex_it
+Polyline_constraint_hierarchy_2<T,Compare,Data>::
+get_pos(T va, T vb) const
+  //return pos in the first context
+{
+    return (*sc_to_c_map.find(make_edge(va,vb))).second->begin().pos;
+}
+
+template <class T, class Compare, class Data>
+void
+Polyline_constraint_hierarchy_2<T,Compare,Data>::
+oriented_end(T va, T vb, T& vc) const
+{
+  Context_iterator ctxt, past;
+  if(!get_contexts(va,vb, ctxt, past) ) CGAL_triangulation_assertion(false);
+  if(*(ctxt->pos) == va)
+    vc = ctxt->enclosing->back();
+  else
+    vc = ctxt->enclosing->front();
+}
+
+
+template <class T, class Compare, class Data>
+void
+Polyline_constraint_hierarchy_2<T,Compare,Data>::
+print() const
+{ 
+  C_iterator hcit;
+  std::map<T,int>  vertex_num;
+  int num = 0;
+  for(hcit = c_begin(); hcit != c_end();  hcit++) {
+    Constraint_id cid = (*hcit);
+    Vertex_it vit =cid.vl_ptr()->skip_begin(), end = cid.vl_ptr()->skip_end();
+    for (;vit != end; vit++){
+      num ++;
+      vertex_num.insert(std::make_pair((*vit), num));
+    }
+  }
+//  typename std::map<T,int>::iterator vnit = vertex_num.begin();
+//  for(; vnit != vertex_num.end(); vnit++) {
+//    vnit->second = ++num;
+//    std::cerr << "vertex num " << num  << " " << vnit->first->point()
+//	      << std::endl;
+//  }
+
+  C_iterator cit=c_begin();
+  Sc_iterator scit=sc_begin();
+
+  for(; cit != c_end();  cit++){
+    std::cout << std::endl ;
+    std::cout << "constraint " ;
+    std::cout << cit->vl_ptr();
+    std::cout << "  subconstraints " ;
+    Vertex_it vit = (*cit).vl_ptr()->skip_begin(), end = (*cit).vl_ptr()->skip_end();
+    for(; vit != end; vit++){
+      std::cout << vertex_num[*vit]  <<" ";
+    }
+    vit = (*cit).vl_ptr()->skip_begin(), end = (*cit).vl_ptr()->skip_end();
+    for(; vit != end; vit++){
+      std::cout << (*vit)->point()  <<" ";
+    }
+  }
+  std::cout << std::endl ;
+  for(;scit != sc_end(); scit++){
+    std::cout << "subconstraint " ;
+    std::cout << vertex_num[scit->first.first] << " " 
+	      << vertex_num[scit->first.second];
+    Context_iterator cb, ce;
+    get_contexts(scit->first.first, scit->first.second, cb, ce);
+    
+    std::cout << "  enclosing " ;
+    for(; cb != ce; cb++) { 
+      std::cout << cb->id().vl_ptr();
+      std::cout <<  "   " ;
+    }
+    std::cout << std::endl ;
+  }
+  return; 
+}
+
+
+} //namespace CGAL
+#endif // CGAL_POLYLINE_CONSTRAINT_HIERARCHY_2_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polyline_simplification_2/Hybrid_squared_distance_cost.h b/3rdparty/CGAL/include/CGAL/Polyline_simplification_2/Hybrid_squared_distance_cost.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polyline_simplification_2/Hybrid_squared_distance_cost.h
rename to 3rdparty/CGAL/include/CGAL/Polyline_simplification_2/Hybrid_squared_distance_cost.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polyline_simplification_2/Scaled_squared_distance_cost.h b/3rdparty/CGAL/include/CGAL/Polyline_simplification_2/Scaled_squared_distance_cost.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polyline_simplification_2/Scaled_squared_distance_cost.h
rename to 3rdparty/CGAL/include/CGAL/Polyline_simplification_2/Scaled_squared_distance_cost.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polyline_simplification_2/Squared_distance_cost.h b/3rdparty/CGAL/include/CGAL/Polyline_simplification_2/Squared_distance_cost.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polyline_simplification_2/Squared_distance_cost.h
rename to 3rdparty/CGAL/include/CGAL/Polyline_simplification_2/Squared_distance_cost.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polyline_simplification_2/Stop_above_cost_threshold.h b/3rdparty/CGAL/include/CGAL/Polyline_simplification_2/Stop_above_cost_threshold.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polyline_simplification_2/Stop_above_cost_threshold.h
rename to 3rdparty/CGAL/include/CGAL/Polyline_simplification_2/Stop_above_cost_threshold.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polyline_simplification_2/Stop_below_count_ratio_threshold.h b/3rdparty/CGAL/include/CGAL/Polyline_simplification_2/Stop_below_count_ratio_threshold.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polyline_simplification_2/Stop_below_count_ratio_threshold.h
rename to 3rdparty/CGAL/include/CGAL/Polyline_simplification_2/Stop_below_count_ratio_threshold.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polyline_simplification_2/Stop_below_count_threshold.h b/3rdparty/CGAL/include/CGAL/Polyline_simplification_2/Stop_below_count_threshold.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polyline_simplification_2/Stop_below_count_threshold.h
rename to 3rdparty/CGAL/include/CGAL/Polyline_simplification_2/Stop_below_count_threshold.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polyline_simplification_2/Vertex_base_2.h b/3rdparty/CGAL/include/CGAL/Polyline_simplification_2/Vertex_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polyline_simplification_2/Vertex_base_2.h
rename to 3rdparty/CGAL/include/CGAL/Polyline_simplification_2/Vertex_base_2.h
diff --git a/3rdparty/CGAL/include/CGAL/Polyline_simplification_2/simplify.h b/3rdparty/CGAL/include/CGAL/Polyline_simplification_2/simplify.h
new file mode 100644
index 0000000..9b6a400
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polyline_simplification_2/simplify.h
@@ -0,0 +1,484 @@
+// Copyright (c) 2012 Geometry Factory. All rights reserved.
+// 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
+// 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(s)     : Andreas Fabri
+//
+#ifndef CGAL_POLYLINE_SIMPLIFICATION_2_SIMPLIFY_H
+#define CGAL_POLYLINE_SIMPLIFICATION_2_SIMPLIFY_H
+
+#include <list>
+
+#include <CGAL/Polyline_simplification_2/Vertex_base_2.h>
+#include <CGAL/Polyline_simplification_2/Squared_distance_cost.h>
+#include <CGAL/Polyline_simplification_2/Scaled_squared_distance_cost.h>
+#include <CGAL/Polyline_simplification_2/Hybrid_squared_distance_cost.h>
+#include <CGAL/Polyline_simplification_2/Stop_below_count_ratio_threshold.h>
+#include <CGAL/Polyline_simplification_2/Stop_below_count_threshold.h>
+#include <CGAL/Polyline_simplification_2/Stop_above_cost_threshold.h>
+#include <CGAL/Modifiable_priority_queue.h>
+#include <CGAL/algorithm.h>
+
+// Needed for Polygon_2
+
+#include <CGAL/Constrained_Delaunay_triangulation_2.h>
+#include <CGAL/Constrained_triangulation_plus_2.h>
+#include <list>
+
+
+namespace CGAL {
+
+#ifndef DOXYGEN_RUNNING
+
+template < class CDT >
+class Constrained_triangulation_plus_2;
+
+
+template <class PolygonTraits_2, class Container>
+class Polygon_2;
+
+#endif
+
+namespace Polyline_simplification_2 {
+
+template <typename PCT, typename CostFunction, typename StopFunction>
+class Polyline_simplification_2
+{
+public:
+
+  typedef typename PCT::Point Point;
+  typedef typename PCT::Constraint_id Constraint_id;
+  typedef typename PCT::Constraint_iterator Constraint_iterator;
+  typedef typename PCT::Vertices_in_constraint_iterator Vertices_in_constraint_iterator;
+  //typedef typename PCT::Points_in_constraint_iterator Points_in_constraint_iterator;
+  typedef typename PCT::Vertex_handle Vertex_handle;
+  typedef typename PCT::Vertex_circulator Vertex_circulator;
+
+  typedef typename PCT::Geom_traits::FT FT;
+  
+  PCT& pct;
+  CostFunction cost;
+  StopFunction stop;
+  std::size_t pct_initial_number_of_vertices, number_of_unremovable_vertices;
+
+  
+  struct Compare_cost 
+  { 
+    bool operator() ( Vertices_in_constraint_iterator const& x, 
+                      Vertices_in_constraint_iterator const& y ) const 
+    { 
+      return (*x)->cost() < (*y)->cost(); 
+    }
+  } ;
+  
+  struct Id_map : public boost::put_get_helper<std::size_t, Id_map>
+  { 
+    typedef boost::readable_property_map_tag category;
+    typedef std::size_t                      value_type;
+    typedef value_type                       reference;
+    typedef Vertices_in_constraint_iterator  key_type;
+    
+    reference operator[] ( key_type const& x ) const { return x.base()->id ; }
+  } ;
+  
+  typedef CGAL::Modifiable_priority_queue<Vertices_in_constraint_iterator,Compare_cost,Id_map> MPQ ;
+  
+  MPQ* mpq;
+
+  Polyline_simplification_2(PCT& pct, CostFunction cost, StopFunction stop)
+    : pct(pct), cost(cost), stop(stop), pct_initial_number_of_vertices(pct.number_of_vertices()), number_of_unremovable_vertices(0)
+  {
+    int m = initialize_indices();
+    initialize_unremovable();
+    Compare_cost cc;
+    Id_map idm;
+    mpq =  new MPQ(m, cc, idm);
+    initialize_costs();
+  }
+
+  Polyline_simplification_2(PCT& pct, Constraint_id cid, CostFunction cost, StopFunction stop)
+    : pct(pct), cost(cost), stop(stop), pct_initial_number_of_vertices(pct.number_of_vertices()), number_of_unremovable_vertices(0)
+  {
+    int m = initialize_indices(cid);
+    initialize_unremovable();
+    Compare_cost cc;
+    Id_map idm;
+    mpq =  new MPQ(m, cc, idm);
+    initialize_costs(cid);
+  }
+
+
+
+  ~Polyline_simplification_2()
+  {
+    delete mpq;
+  }
+
+  void initialize_unremovable()
+  {
+    std::set<Vertex_handle> vertices;
+    Constraint_iterator cit = pct.constraints_begin(), e = pct.constraints_end();
+    for(; cit!=e; ++cit){
+      Constraint_id cid = *cit;
+      Vertices_in_constraint_iterator it = pct.vertices_in_constraint_begin(cid);
+      (*it)->set_removable(false);
+      for(; it != pct.vertices_in_constraint_end(cid); ++it){
+        if(vertices.find(*it) != vertices.end()){
+          (*it)->set_removable(false);
+        } else {
+          vertices.insert(*it);
+        }
+      }
+      it = boost::prior(it);
+      (*it)->set_removable(false);
+    }
+  }
+
+  // For all polyline constraints we compute the cost of all unremovable and not removed vertices
+  int
+  initialize_costs(Constraint_id cid)
+  {
+    int n=0;
+    for(Vertices_in_constraint_iterator it = pct.vertices_in_constraint_begin(cid);
+        it != pct.vertices_in_constraint_end(cid);
+        ++it){
+      if((*it)->is_removable()){
+        boost::optional<FT> dist = cost(pct, it);
+        if(dist){
+          (*it)->set_cost(*dist);
+          (*mpq).push(it);
+          ++n;
+        } else {
+          // no need to set the costs as this vertex is not in the priority queue
+        } 
+      }
+    }
+    return n;
+  }  
+  
+  void
+  initialize_costs()
+  {
+    int n=0;
+    Constraint_iterator cit = pct.constraints_begin(), e = pct.constraints_end();
+    for(; cit!=e; ++cit){
+      n+= initialize_costs(*cit);
+    }
+  }
+
+  bool
+  is_removable(Vertices_in_constraint_iterator it)
+  {
+    typedef typename PCT::Geom_traits Geom_traits;
+    if(! (*it)->is_removable()) {
+      return false;
+    }
+    
+    Vertex_handle vh = *it;
+    Vertices_in_constraint_iterator u = boost::prior(it);
+    Vertex_handle uh = *u;
+    Vertices_in_constraint_iterator w = boost::next(it);
+    Vertex_handle wh = *w;
+    
+    typename Geom_traits::Orientation_2 orientation_2 = pct.geom_traits().orientation_2_object();
+    CGAL::Orientation o = orientation_2(uh->point(), vh->point(), wh->point());
+    if(o == CGAL::COLLINEAR){
+      return true;
+    }
+    if(o == CGAL::LEFT_TURN){
+      std::swap(uh,wh);
+    }
+    
+    // uh, vh, wh perform a right turn 
+    const Point& up = uh->point();
+    const Point& wp = wh->point();
+    Vertex_circulator circ = pct.incident_vertices(vh);
+    while(circ != uh){
+      ++circ;
+    }
+    ++circ;
+    if(circ == wh){
+      typename PCT::Edge e;
+      CGAL_assertion_code( bool b = ) pct.is_edge(uh,wh,e.first,e.second);
+      CGAL_assertion(b);
+      return ! pct.is_constrained(e);
+    }
+    while(circ != wh){
+      o = orientation_2(up, circ->point(), wp);
+      if(orientation_2(up, wp, circ->point()) != CGAL::RIGHT_TURN){
+        return false;
+      }
+      ++circ;
+    }
+    return true;
+  }
+
+
+  int
+  initialize_indices(Constraint_id cid, int id = 0)
+  {
+    for(Vertices_in_constraint_iterator it = pct.vertices_in_constraint_begin(cid);
+        it != pct.vertices_in_constraint_end(cid);
+        ++it){
+      it.base()->id = id++;
+    }
+    return id;
+  }
+  
+  int
+  initialize_indices()
+  {
+    int id = 0;
+    Constraint_iterator b = pct.constraints_begin(), e = pct.constraints_end();
+    for(; b!=e; ++b){
+      id = initialize_indices(*b, id);
+    }
+    return id;
+  }
+  
+bool
+operator()()
+{
+  if((*mpq).empty()){
+      return false;
+    }
+  Vertices_in_constraint_iterator v = (*mpq).top();
+  (*mpq).pop();
+  if(stop(pct, *v, (*v)->cost(), pct_initial_number_of_vertices, pct.number_of_vertices())){
+    return false;
+  }
+  if(is_removable(v)){
+    Vertices_in_constraint_iterator u = boost::prior(v), w = boost::next(v);
+    pct.simplify(v);
+    
+    if((*u)->is_removable()){
+      boost::optional<FT> dist = cost(pct, u);
+      if(! dist){
+        // cost is undefined
+        if( mpq->contains(u) ){
+          mpq->erase(u);
+        }
+      } else {
+        (*u)->set_cost(*dist);
+        if(mpq->contains(u)){
+          mpq->update(u, true);
+        }
+        else{
+          mpq->push(u);
+        }
+      }
+    }
+    
+    if((*w)->is_removable()){
+      boost::optional<FT> dist = cost(pct, w);
+      if(! dist){
+        // cost is undefined
+        if( mpq->contains(w) ){
+          mpq->erase(w);
+        }
+      } else {
+        (*w)->set_cost(*dist);
+        if(mpq->contains(w)){
+          mpq->update(w, true);
+        }
+        else{
+          mpq->push(w);
+        }
+
+      }
+    }
+  } else {
+    ++number_of_unremovable_vertices;
+  }
+  return true;
+}
+
+  std::size_t
+  number_of_removed_vertices() const
+  {
+    return pct_initial_number_of_vertices - pct.number_of_vertices();
+  }
+
+  };
+
+/*!
+\ingroup  PkgPolylineSimplification2Functions
+
+Simplifies a single polygon.
+
+\tparam Traits must be a model of `ConstrainedDelaunayTriangulationTraits_2`
+\tparam CostFunction must be a model of `PolylineSimplificationCostFunction`.
+\tparam StopFunction must be a model of `PolylineSimplificationStopPredicate`
+
+\attention Any \cgal kernel can be used for `Traits`, but as the traits
+class is used for internally using a constrained Delaunay triangulation,
+it should be a kernel with at least exact predicates.
+*/
+template <class Traits, class Container, class CostFunction, class StopFunction>
+                  CGAL::Polygon_2<Traits,Container>
+                  simplify(const CGAL::Polygon_2<Traits,Container>& polygon,
+                           CostFunction cost,
+                           StopFunction stop)
+{
+  typedef Traits K;
+  typedef typename K::Point_2 Point_2;
+
+  typedef Vertex_base_2< K > Vb;
+  typedef CGAL::Constrained_triangulation_face_base_2<K> Fb;
+  typedef CGAL::Triangulation_data_structure_2<Vb,Fb> TDS;
+  typedef CGAL::Constrained_Delaunay_triangulation_2<K, TDS,typename internal::Itag<K>::type>  CDT;
+  typedef CGAL::Constrained_triangulation_plus_2<CDT>       PCT;
+  typedef typename PCT::Constraint_id Constraint_id;
+  typedef typename PCT::Vertices_in_constraint_iterator Vertices_in_constraint_iterator;
+
+  PCT pct;
+
+  Constraint_id cid = pct.insert_constraint(polygon);
+
+  Polyline_simplification_2<PCT, CostFunction, StopFunction> simplifier(pct, cost, stop);
+  while(simplifier()){}
+
+  CGAL::Polygon_2<Traits,Container> result;
+  Vertices_in_constraint_iterator beg = pct.vertices_in_constraint_begin(cid);
+  Vertices_in_constraint_iterator end = pct.vertices_in_constraint_end(cid);
+  for(; beg!=end;){
+    Point_2 p = (*beg)->point();
+    ++beg;
+    if(beg!=end){
+      result.push_back(p);
+    }
+  }
+  return result;
+}
+
+/*!
+\ingroup  PkgPolylineSimplification2Functions
+
+Simplifies an open or closed polyline given as an iterator range of 2D \cgal points.
+
+\tparam PointIterator must be an iterator with value type `CGAL::Kernel::Point_2`.
+\tparam CostFunction must be a model of `PolylineSimplificationCostFunction`
+\tparam StopFunction must be a model of `PolylineSimplificationStopPredicate`
+\tparam PointOutputIterator must be an output iterator to which `CGAL::Kernel::Point_2` can be assigned.
+*/
+  template <class PointIterator, class CostFunction, class StopFunction, class PointOutputIterator>
+  PointOutputIterator
+  simplify(PointIterator b, PointIterator e,
+           CostFunction cost,
+           StopFunction stop,
+           PointOutputIterator out,
+           bool close = false)
+{
+  typedef typename std::iterator_traits<PointIterator>::value_type Point_2;
+  typedef typename CGAL::Kernel_traits<Point_2>::type K;
+  typedef Vertex_base_2< K > Vb;
+  typedef CGAL::Constrained_triangulation_face_base_2<K> Fb;
+  typedef CGAL::Triangulation_data_structure_2<Vb,Fb> TDS;
+  typedef CGAL::Constrained_Delaunay_triangulation_2<K, TDS,typename internal::Itag<K>::type > CDT;
+  typedef CGAL::Constrained_triangulation_plus_2<CDT>       PCT;
+  typedef typename PCT::Constraint_id Constraint_id;
+  typedef typename PCT::Vertices_in_constraint_iterator Vertices_in_constraint_iterator;
+
+  PCT pct;
+
+  Constraint_id cid = pct.insert_constraint(b,e, close);
+
+  Polyline_simplification_2<PCT, CostFunction, StopFunction> simplifier(pct, cost, stop);
+  while(simplifier()){}
+
+  Vertices_in_constraint_iterator beg = pct.vertices_in_constraint_begin(cid);
+  Vertices_in_constraint_iterator end = pct.vertices_in_constraint_end(cid);
+  for(; beg!=end;){
+    Point_2 p = (*beg)->point();
+    ++beg;
+    if((!close) || (beg!=end)){
+      *out++ = p;
+    }
+  }
+  return out;
+}
+
+
+/*!
+\ingroup  PkgPolylineSimplification2Functions
+
+Simplifies a single polyline in a triangulation with polylines as constraints. 
+
+\param ct The underlying constrained Delaunay triangulation which embeds the polyline constraints
+\param cid The constraint identifier of the polyline constraint to simplify
+\param cost The cost function
+\param stop The stop function
+\param remove_points  If `true` the function \link CGAL::Constrained_triangulation_plus_2::remove_points_without_corresponding_vertex() `ct.remove_points_without_corresponding_vertex()` \endlink is called.
+\returns the number of removed vertices
+\tparam CDT  must be `CGAL::Constrained_triangulation_plus_2` with a vertex type that
+is model of  `PolylineSimplificationVertexBase_2`.
+\tparam CostFunction must be a model of `PolylineSimplificationCostFunction`
+\tparam StopFunction must be a model of `PolylineSimplificationStopPredicate`
+*/
+template <class CDT, class CostFunction, class StopFunction>
+std::size_t
+simplify(CGAL::Constrained_triangulation_plus_2<CDT>& ct,
+         typename CGAL::Constrained_triangulation_plus_2<CDT>::Constraint_id cid,
+         CostFunction cost,
+         StopFunction stop,
+         bool remove_points = true)
+{
+  typedef CGAL::Constrained_triangulation_plus_2<CDT> PCT;
+  Polyline_simplification_2<PCT, CostFunction, StopFunction> simplifier(ct, cid, cost, stop);
+
+  while(simplifier()){}
+  if(remove_points){
+    ct.remove_points_without_corresponding_vertex(cid);
+  }
+  return simplifier.number_of_removed_vertices();
+}
+
+/*!
+\ingroup  PkgPolylineSimplification2Functions
+Simplifies all polylines in a triangulation with polylines as constraints.
+\param ct The underlying constrained Delaunay triangulation which embeds the polyline constraints
+\param cost The cost function
+\param stop The stop function
+\param remove_points If `true` the function \link CGAL::Constrained_triangulation_plus_2::remove_points_without_corresponding_vertex() `ct.remove_points_without_corresponding_vertex()`\endlink is called.
+\returns the number of removed vertices
+\tparam CDT  must be `CGAL::Constrained_triangulation_plus_2` with a vertex type that
+is model of  `PolylineSimplificationVertexBase_2`.
+\tparam CostFunction must be a model of `PolylineSimplificationCostFunction`
+\tparam StopFunction must be a model of `PolylineSimplificationStopPredicate`
+*/
+
+template <class CDT, class CostFunction, class StopFunction>
+std::size_t
+simplify(CGAL::Constrained_triangulation_plus_2<CDT>& ct,
+         CostFunction cost,
+         StopFunction stop,
+         bool remove_points = true)
+{
+  typedef CGAL::Constrained_triangulation_plus_2<CDT> PCT;
+  Polyline_simplification_2<PCT, CostFunction, StopFunction> simplifier(ct, cost, stop);
+
+  while(simplifier()){}
+  if(remove_points){
+    ct.remove_points_without_corresponding_vertex();
+  }
+  return simplifier.number_of_removed_vertices();
+}
+
+
+
+} // namespace polyline_simplification_2
+} // namespace CGAL 
+#endif
diff --git a/3rdparty/CGAL/include/CGAL/Polynomial.h b/3rdparty/CGAL/include/CGAL/Polynomial.h
new file mode 100644
index 0000000..9fd3cfe
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polynomial.h
@@ -0,0 +1,75 @@
+// Copyright (c) 2008 Max-Planck-Institute Saarbruecken (Germany).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Arno Eigenwillig <arno at mpi-inf.mpg.de>
+//                 Michael Seel <seel at mpi-inf.mpg.de>
+//                 Michael Hemmer <hemmer at informatik.uni-mainz.de> 
+// ============================================================================
+
+// TODO: The comments are all original EXACUS comments and aren't adapted. So
+//         they may be wrong now.
+
+/*! \file CGAL/Polynomial.h
+ *  \brief Defines class CGAL::Polynomial.
+ *  
+ *  Polynomials in one variable (or more, by recursion)
+ */
+
+#ifndef CGAL_POLYNOMIAL_H
+#define CGAL_POLYNOMIAL_H
+
+#include <cstdarg>
+#include <cctype>
+#include <vector>
+#include <iostream>
+#include <CGAL/basic.h>
+#include <CGAL/Handle_with_policy.h>
+#include <boost/iterator/transform_iterator.hpp>
+#include <boost/mpl/if.hpp>
+#include <CGAL/Flattening_iterator.h>
+
+#include <CGAL/Exponent_vector.h>
+
+#include <CGAL/assertions.h>
+
+#ifdef CGAL_USE_LEDA
+#  include <LEDA/core/array.h>
+#endif // CGAL_USE_LEDA
+
+#include <CGAL/Polynomial/fwd.h>
+#include <CGAL/Polynomial/Polynomial_type.h>
+#include <CGAL/Polynomial_traits_d.h>
+#include <CGAL/Polynomial/Algebraic_structure_traits.h>
+#include <CGAL/Polynomial/Real_embeddable_traits.h>
+#include <CGAL/Polynomial/Fraction_traits.h>
+#include <CGAL/Polynomial/Scalar_factor_traits.h>
+#include <CGAL/Polynomial/Modular_traits.h>
+#include <CGAL/Polynomial/Coercion_traits.h>
+#include <CGAL/Polynomial/Chinese_remainder_traits.h>
+#include <CGAL/Polynomial/Get_arithmetic_kernel.h>
+
+// TODO: Are these still includes necessary?
+#include <CGAL/Polynomial/polynomial_gcd.h> // used above for Algebraic_structure_traits<Poly...>::Gcd
+#include <CGAL/Polynomial/prs_resultant.h>  // for compatibility
+
+#include <CGAL/Polynomial_traits_d.h>
+#include <CGAL/polynomial_utils.h>
+
+#endif  // CGAL_POLYNOMIAL_H
+
+// EOF
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/Algebraic_structure_traits.h b/3rdparty/CGAL/include/CGAL/Polynomial/Algebraic_structure_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/Algebraic_structure_traits.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/Algebraic_structure_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/CORE_Expr_root_stack.h b/3rdparty/CGAL/include/CGAL/Polynomial/CORE_Expr_root_stack.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/CORE_Expr_root_stack.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/CORE_Expr_root_stack.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/CORE_kernel.h b/3rdparty/CGAL/include/CGAL/Polynomial/CORE_kernel.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/CORE_kernel.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/CORE_kernel.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/Cached_extended_euclidean_algorithm.h b/3rdparty/CGAL/include/CGAL/Polynomial/Cached_extended_euclidean_algorithm.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/Cached_extended_euclidean_algorithm.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/Cached_extended_euclidean_algorithm.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/Chinese_remainder_traits.h b/3rdparty/CGAL/include/CGAL/Polynomial/Chinese_remainder_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/Chinese_remainder_traits.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/Chinese_remainder_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/Coercion_traits.h b/3rdparty/CGAL/include/CGAL/Polynomial/Coercion_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/Coercion_traits.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/Coercion_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/Degree.h b/3rdparty/CGAL/include/CGAL/Polynomial/Degree.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/Degree.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/Degree.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/Fixed_polynomial.h b/3rdparty/CGAL/include/CGAL/Polynomial/Fixed_polynomial.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/Fixed_polynomial.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/Fixed_polynomial.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/Fraction_traits.h b/3rdparty/CGAL/include/CGAL/Polynomial/Fraction_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/Fraction_traits.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/Fraction_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/Get_arithmetic_kernel.h b/3rdparty/CGAL/include/CGAL/Polynomial/Get_arithmetic_kernel.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/Get_arithmetic_kernel.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/Get_arithmetic_kernel.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/Interpolator.h b/3rdparty/CGAL/include/CGAL/Polynomial/Interpolator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/Interpolator.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/Interpolator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/Interval_polynomial.h b/3rdparty/CGAL/include/CGAL/Polynomial/Interval_polynomial.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/Interval_polynomial.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/Interval_polynomial.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/Kernel.h b/3rdparty/CGAL/include/CGAL/Polynomial/Kernel.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/Kernel.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/Kernel.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/Modular_traits.h b/3rdparty/CGAL/include/CGAL/Polynomial/Modular_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/Modular_traits.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/Modular_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/Monomial_representation.h b/3rdparty/CGAL/include/CGAL/Polynomial/Monomial_representation.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/Monomial_representation.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/Monomial_representation.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/Numeric_root_stack.h b/3rdparty/CGAL/include/CGAL/Polynomial/Numeric_root_stack.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/Numeric_root_stack.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/Numeric_root_stack.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/Polynomial.h b/3rdparty/CGAL/include/CGAL/Polynomial/Polynomial.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/Polynomial.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/Polynomial.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/Polynomial_type.h b/3rdparty/CGAL/include/CGAL/Polynomial/Polynomial_type.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/Polynomial_type.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/Polynomial_type.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/Real_embeddable_traits.h b/3rdparty/CGAL/include/CGAL/Polynomial/Real_embeddable_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/Real_embeddable_traits.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/Real_embeddable_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/Root_stack_default_traits.h b/3rdparty/CGAL/include/CGAL/Polynomial/Root_stack_default_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/Root_stack_default_traits.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/Root_stack_default_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/Scalar_factor_traits.h b/3rdparty/CGAL/include/CGAL/Polynomial/Scalar_factor_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/Scalar_factor_traits.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/Scalar_factor_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/Sturm_root_stack.h b/3rdparty/CGAL/include/CGAL/Polynomial/Sturm_root_stack.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/Sturm_root_stack.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/Sturm_root_stack.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/Sturm_root_stack_traits.h b/3rdparty/CGAL/include/CGAL/Polynomial/Sturm_root_stack_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/Sturm_root_stack_traits.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/Sturm_root_stack_traits.h
diff --git a/3rdparty/CGAL/include/CGAL/Polynomial/basic.h b/3rdparty/CGAL/include/CGAL/Polynomial/basic.h
new file mode 100644
index 0000000..22f2106
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polynomial/basic.h
@@ -0,0 +1,208 @@
+// Copyright (c) 2005  Stanford University (USA).
+// 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(s)     : Daniel Russel <drussel at alumni.princeton.edu>
+
+#ifndef CGAL_POLYNOMIAL_BASIC_H
+#define CGAL_POLYNOMIAL_BASIC_H
+
+#include <CGAL/Polynomial/internal/config.h>
+#include <CGAL/Polynomial/internal/Statistics.h>
+#include <CGAL/assertions.h>
+/*!
+
+  \file CGAL/Polynomial/basic.h The file which defines the basic
+  things needed throught the module.  All other headers should include
+  this first.
+
+*/
+
+#ifdef CGAL_USE_GMP
+#ifndef CGAL_POLYNOMIAL_USE_CGAL
+#define CGAL_POLYNOMIAL_USE_CGAL
+#endif
+#endif
+
+#include <CGAL/Polynomial/internal/macros.h>
+
+#ifdef CGAL_POLYNOMIAL_USE_CGAL
+/*
+  When CGAL is present
+*/
+#include <CGAL/basic.h>
+
+#ifdef CGAL_USE_GMP
+#include <CGAL/Gmpq.h>
+namespace CGAL { namespace POLYNOMIAL {
+typedef CGAL::Gmpq Default_field_nt;
+} } //namespace CGAL::POLYNOMIAL
+#else
+#include <CGAL/MP_Float.h>
+#include <CGAL/Quotient.h>
+namespace CGAL { namespace POLYNOMIAL {
+typedef CGAL::Quotient<CGAL::MP_Float> Default_field_nt;
+} } //namespace CGAL::POLYNOMIAL
+#endif
+
+namespace CGAL { namespace POLYNOMIAL {
+
+/*typedef CGAL::Sign Sign;
+static const Sign ZERO= CGAL::ZERO;
+static const Sign POSITIVE= CGAL::POSITIVE;
+static const Sign NEGATIVE= CGAL::NEGATIVE;*/
+/*typedef int Comparison_result;
+static const int EQUAL= CGAL::EQUAL;
+static const int SMALLER= CGAL::SMALLER;
+static const int LARGER = CGAL::LARGER;*/
+static const int UNKNOWN = -3;
+typedef int Order;
+static const int STRICTLY_BELOW = -3;
+static const int BELOW=-2;
+static const int CONTAINED=-1;
+static const int CONTAINS=1;
+static const int ABOVE=2;
+static const int STRICTLY_ABOVE=3;
+//typedef enum Sign {ZERO=CGAL::ZERO, POSITIVE=CGAL::POSITIVE, NEGATIVE=CGAL::NEGATIVE} Sign;
+
+//typedef CGAL::Comparison_result Comparison_result;
+
+/*template <class NT>
+Sign sign(const NT &nt)
+{
+    return CGAL::sign(nt);
+    }*/
+
+
+/*typedef ::CGAL::Integral_domain_without_division_tag             Integral_domain_without_division_tag;
+typedef ::CGAL::Euclidean_ring_tag   Euclidean_ring_tag;
+typedef ::CGAL::Field_tag            Field_tag;
+typedef ::CGAL::Field_with_sqrt_tag       Field_with_sqrt_tag;*/
+
+} } //namespace CGAL::POLYNOMIAL
+
+#define CGAL_POLYNOMIAL_TO_DOUBLE(d) CGAL::to_double(d)
+
+#define CGAL_POLYNOMIAL_TO_INTERVAL(d) CGAL::to_interval(d)
+
+#else
+/*
+  When no CGAL is present
+*/
+
+namespace CGAL { namespace POLYNOMIAL {
+
+typedef int Sign;
+static const int ZERO =0;
+static const int POSITIVE=1;
+static const int NEGATIVE=-1;
+typedef int Comparison_result;
+static const int EQUAL= 0;
+static const int SMALLER= -1;
+static const int LARGER = 1;
+
+template <class NT>
+Sign sign(const NT &nt)
+{
+    if (nt >0) return POSITIVE;
+    else if (nt <0) return NEGATIVE;
+    else return ZERO;
+}
+
+
+struct Integral_domain_without_division_tag {};
+struct Euclidean_ring_tag {};
+struct Field_tag {};
+struct Field_with_sqrt_tag {};
+
+} } //namespace CGAL::POLYNOMIAL
+#endif
+
+#include <limits>
+
+/*
+  Shared
+*/
+
+namespace CGAL { namespace POLYNOMIAL {
+
+//! Used for signs when filtering is involved
+typedef enum Extended_sign
+{
+    EXTENDED_NEGATIVE=NEGATIVE, EXTENDED_ZERO=ZERO,
+    EXTENDED_POSITIVE=POSITIVE, EXTENDED_UNKNOWN=2
+} Extended_sign;
+
+//! Calculate the extened sign of a number.
+/*!  For a regular number, the extened sign is teh same as the sign.
+
+There is a specializated version for filtering included in
+  CGAL/Polynomial/Tools/interval_arithmetic.h
+*/
+template <class NT>
+inline Extended_sign extended_sign(const NT &nt)
+{
+  // for VC
+  switch(CGAL::sign(nt)) {
+        case ZERO: return EXTENDED_ZERO;
+        case POSITIVE: return EXTENDED_POSITIVE;
+        default: return EXTENDED_NEGATIVE;
+    };
+}
+
+
+template <class Rt>
+inline Rt infinity()
+{
+  //CGAL_static_assertion(std::numeric_limits<Rt>::is_specialized);
+    if (std::numeric_limits<Rt>::has_infinity) return std::numeric_limits<Rt>::infinity();
+    else return (std::numeric_limits<Rt>::max)();
+}
+
+
+} } //namespace CGAL::POLYNOMIAL
+
+/*!  \namespace CGAL::POLYNOMIAL This is the namespace where all the
+  directly exposed members of the framework are defined.
+
+  \todo put specialized templates first in header
+
+  \todo wrapper support for boost::interval
+
+  \namespace CGAL::POLYNOMIAL::internal The classes in this namespace
+  should not be accessed directly by the users of the
+  library. However, many of them are exposed in other ways (for
+example as members of a kernel), so things need to be documented.
+
+\namespace CGAL We don't put much in CGAL. Just to_double,
+to_interval, sign and a couple of other methods.
+*/
+
+/*
+namespace CGAL { namespace POLYNOMIAL {
+
+//!\todo are these needed? The tags in the polynomial NS?
+struct Descartes_tag {};
+struct Sturm_tag {};
+struct Bezier_tag {};
+
+} } //namespace CGAL::POLYNOMIAL
+*/
+
+#include <limits>
+
+#endif // CGAL_POLYNOMIAL_BASIC_H
diff --git a/3rdparty/CGAL/include/CGAL/Polynomial/bezout_matrix.h b/3rdparty/CGAL/include/CGAL/Polynomial/bezout_matrix.h
new file mode 100644
index 0000000..165fd7c
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polynomial/bezout_matrix.h
@@ -0,0 +1,614 @@
+// Copyright (c) 2008 Max-Planck-Institute Saarbruecken (Germany)
+//
+// 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(s)     : Michael Hemmer
+//
+// ============================================================================
+
+// TODO: The comments are all original EXACUS comments and aren't adapted. So
+//         they may be wrong now.
+
+#ifndef CGAL_POLYNOMIAL_BEZOUT_MATRIX_H
+#define CGAL_POLYNOMIAL_BEZOUT_MATRIX_H
+
+#include <algorithm>
+
+#include <CGAL/basic.h>
+#include <CGAL/Polynomial_traits_d.h>
+#include <CGAL/Polynomial/determinant.h>
+#include <CGAL/use.h>
+
+#include <vector>
+
+namespace CGAL {
+
+namespace internal {
+
+/*! \ingroup CGAL_resultant_matrix
+ *  \brief construct hybrid Bezout matrix of two polynomials
+ *
+ *  If \c sub=0 ,  this function returns the hybrid Bezout matrix 
+ *  of \c f and \c g.
+ *  The hybrid Bezout matrix of two polynomials \e f and \e g
+ *  (seen as polynomials in one variable) is a
+ *  square matrix of size max(deg(<I>f</I>), deg(<I>g</I>)) whose entries
+ *  are expressions in the polynomials' coefficients.
+ *  Its determinant is the resultant of \e f and \e g, maybe up to sign.
+ *  The function computes the same matrix as the Maple command 
+ *  <I>BezoutMatrix</I>.
+ *
+ *  If \c sub>0 , this function returns the matrix obtained by chopping
+ *  off the \c sub topmost rows and the \c sub rightmost columns.
+ *  Its determinant is the <I>sub</I>-th (scalar) subresultant
+ *  of \e f and \e g, maybe up to sign.
+ *
+ *  If specified, \c sub must be less than the degrees of both \e f and \e g.
+ *
+ *  See also \c CGAL::hybrid_bezout_subresultant() and \c CGAL::sylvester_matrix() .
+ *
+ *  A formal definition of the hybrid Bezout matrix and a proof for the
+ *  subresultant property can be found in:
+ *
+ *  Gema M.Diaz-Toca, Laureano Gonzalez-Vega: Various New Expressions for
+ *  Subresultants and Their Applications. AAECC 15, 233-266 (2004)
+ *
+ */
+template <typename Polynomial_traits_d>
+typename internal::Simple_matrix< typename Polynomial_traits_d::Coefficient_type >
+hybrid_bezout_matrix(typename Polynomial_traits_d::Polynomial_d f, 
+                     typename Polynomial_traits_d::Polynomial_d g, 
+                     int sub = 0)
+{
+
+    typedef typename Polynomial_traits_d::Polynomial_d Polynomial;
+    typedef typename Polynomial_traits_d::Coefficient_type NT;
+    typename Polynomial_traits_d::Degree degree;
+    typename CGAL::Algebraic_structure_traits<Polynomial>::Is_zero is_zero;
+    typename Polynomial_traits_d::Get_coefficient coeff;
+
+    typedef typename internal::Simple_matrix<NT> Matrix;
+
+    int n = degree(f);
+    int m = degree(g);
+    CGAL_precondition((n >= 0) && !is_zero(f));
+    CGAL_precondition((m >= 0) && !is_zero(g));
+    CGAL_precondition(n > sub || sub == 0);
+    CGAL_precondition(m > sub || sub == 0);
+
+    int i, j, k, l;
+    NT  s;
+
+    if (m > n) {
+        std::swap(f, g);
+        std::swap(m, n);
+    }
+
+    Matrix B(n-sub);
+
+    for (i = 1+sub; i <= m; i++) {
+        for (j = 1; j <= n-sub; j++) {
+            s = NT(0);
+            for (k = 0; k <= i-1; k++) {
+                l = n+i-j-k;
+                if ((l <= n) and (l >= n-(m-i))) {
+                    s += coeff(f,l) * coeff(g,k);
+                }
+            }
+            for (k = 0; k <= n-(m-i+1); k++) {
+                l = n+i-j-k;
+                if ((l <= m) and (l >= i)) {
+                    s -= coeff(f,k) * coeff(g,l);
+                }
+            }
+            B[i-sub-1][j-1] = s;
+        }
+    }
+    for (i = std::max(m+1, 1+sub); i <= n; i++) {
+        for (j = i-m; j <= std::min(i, n-sub); j++) {
+            B[i-sub-1][j-1] = coeff(g,i-j);
+        }
+    }
+
+    return B; // g++ 3.1+ has NRVO, so this should not be too expensive
+}
+
+/*! \ingroup CGAL_resultant_matrix
+ *  \brief construct the symmetric Bezout matrix of two polynomials
+ *
+ *  This function returns the (symmetric) Bezout matrix of \c f and \c g.
+ *  The Bezout matrix of two polynomials \e f and \e g
+ *  (seen as polynomials in one variable) is a
+ *  square matrix of size max(deg(<I>f</I>), deg(<I>g</I>)) whose entries
+ *  are expressions in the polynomials' coefficients.
+ *  Its determinant is the resultant of \e f and \e g, maybe up to sign.
+ *
+ */
+template <typename Polynomial_traits_d>
+typename internal::Simple_matrix<typename Polynomial_traits_d::Coefficient_type>
+symmetric_bezout_matrix
+    (typename Polynomial_traits_d::Polynomial_d f, 
+     typename Polynomial_traits_d::Polynomial_d g, 
+     int sub = 0)
+{
+
+    
+
+  // Note: The algorithm is taken from:
+  // Chionh, Zhang, Goldman: Fast Computation of the Bezout and Dixon Resultant
+  // Matrices. J.Symbolic Computation 33, 13-29 (2002)
+    
+    typedef typename Polynomial_traits_d::Polynomial_d Polynomial;
+    typedef typename Polynomial_traits_d::Coefficient_type NT;
+    typename Polynomial_traits_d::Degree degree;
+    CGAL_assertion_code(typename CGAL::Algebraic_structure_traits<Polynomial>::Is_zero is_zero;)
+    CGAL_USE_TYPE(Polynomial);
+    typename Polynomial_traits_d::Get_coefficient coeff;
+
+    typedef typename internal::Simple_matrix<NT> Matrix;
+
+    int n = degree(f);
+    int m = degree(g);
+    CGAL_precondition((n >= 0) && !is_zero(f));
+    CGAL_precondition((m >= 0) && !is_zero(g));
+
+    int i,j,stop;
+
+    NT sum1,sum2;
+
+    if (m > n) {
+        std::swap(f, g);
+        std::swap(m, n);
+    }
+
+    CGAL_precondition((sub>=0) && sub < n);
+
+    int d = n - sub;
+
+    Matrix B(d);
+
+    // 1st step: Initialisation
+    for(i=0;i<d;i++) {
+      for(j=i;j<d;j++) {
+        sum1 = ((j+sub)+1>m) ? NT(0) : -coeff(f,i+sub)*coeff(g,(j+sub)+1);
+	sum2 =  ((i+sub)>m)  ? NT(0) :  coeff(g,i+sub)*coeff(f,(j+sub)+1);
+	B[i][j]=sum1+sum2;
+      }
+    }
+
+    // 2nd Step: Recursion adding
+    
+    // First, set up the first line correctly
+    for(i=0;i<d-1;i++) {
+      stop = (sub<d-1-i) ? sub : d-i-1;
+      for(j=1;j<=stop;j++) {
+          sum1 = ((i+sub+j)+1>m) ? NT(0) 
+                                 : -coeff(f,sub-j)*coeff(g,(i+sub+j)+1);
+          sum2 =  ((sub-j)>m)    ? NT(0) 
+                                 : coeff(g,sub-j)*coeff(f,(i+sub+j)+1);
+	
+	B[0][i]+=sum1+sum2;
+      }
+    }
+    // Now, compute the rest
+    for(i=1;i<d-1;i++) {
+      for(j=i;j<d-1;j++) {
+	B[i][j]+=B[i-1][j+1];
+      }
+    }
+
+    
+   //3rd Step: Exploit symmetry
+    for(i=1;i<d;i++) {
+      for(j=0;j<i;j++) {
+	B[i][j]=B[j][i];
+      }
+    }
+    
+    return B;
+}
+    
+
+
+/*! \ingroup CGAL_resultant_matrix
+ *  \brief compute (sub)resultant as Bezout matrix determinant
+ *
+ *  This function returns the determinant of the matrix returned
+ *  by <TT>hybrid_bezout_matrix(f, g, sub)</TT>  which is the
+ *  resultant of \c f and \c g, maybe up to sign;
+ *  or rather the <I>sub</I>-th (scalar) subresultant, if a non-zero third
+ *  argument is given.
+ *
+ *  If specified, \c sub must be less than the degrees of both \e f and \e g.
+ *
+ *  This function might be faster than \c CGAL::Polynomial<..>::resultant() ,
+ *  which computes the resultant from a subresultant remainder sequence.
+ *  See also \c CGAL::sylvester_subresultant().
+ */
+template <class Polynomial_traits_d>
+typename Polynomial_traits_d::Coefficient_type hybrid_bezout_subresultant(
+        typename Polynomial_traits_d::Polynomial_d f, 
+        typename Polynomial_traits_d::Polynomial_d g, 
+        int sub = 0
+) { 
+
+    typedef typename Polynomial_traits_d::Polynomial_d Polynomial;
+    typedef typename Polynomial_traits_d::Coefficient_type NT;
+    typename Polynomial_traits_d::Degree degree;
+    typename CGAL::Algebraic_structure_traits<Polynomial>::Is_zero is_zero;
+    
+    typedef internal::Simple_matrix<NT> Matrix;
+
+    CGAL_precondition((degree(f) >= 0));
+    CGAL_precondition((degree(g) >= 0));
+    
+    if (is_zero(f) || is_zero(g)) return NT(0);
+    
+    Matrix S = hybrid_bezout_matrix<Polynomial_traits_d>(f, g, sub);
+    CGAL_assertion(S.row_dimension() == S.column_dimension());
+    if (S.row_dimension() == 0) {
+        return NT(1);
+    } else {
+        return internal::determinant(S);
+    }
+}
+
+// Transforms the minors of the symmetric bezout matrix into the subresultant.
+// Needs the appropriate power of the leading coedfficient of f and the
+// degrees of f and g
+template<class InputIterator,class OutputIterator,class NT>
+void symmetric_minors_to_subresultants(InputIterator in,
+                                       OutputIterator out,
+                                       NT divisor,
+                                       int n,
+                                       int m,
+                                       bool swapped) {
+  
+    typename CGAL::Algebraic_structure_traits<NT>::Integral_division idiv;
+    
+    for(int i=0;i<m;i++) {
+      bool negate = ((n-m+i+1) & 2)>>1; // (n-m+i+1)==2 or 3 mod 4
+      negate=negate ^ (swapped & ((n-m+i+1)*(i+1)));  
+      //...XOR (swapped AND (n-m+i+1)* (i+1) is odd) 
+      
+      *out = idiv(*in,  negate ? -divisor : divisor);
+      in++;
+      out++;
+    }
+}
+
+
+/*! \ingroup CGAL_resultant_matrix
+ * \brief compute the principal subresultant coefficients as minors 
+ * of the symmetric Bezout matrix.
+ *
+ * Returns the sequence sres<sub>0</sub>,..,sres<sub>m</sub>, where 
+ * sres<sub>i</sub> denotes the ith principal subresultant coefficient
+ *
+ * The function uses an extension of the Berkowitz method to compute the
+ * determinant
+ * See also \c CGAL::minors_berkowitz
+ */
+template<class Polynomial_traits_d,class OutputIterator>
+OutputIterator symmetric_bezout_subresultants(
+	   typename Polynomial_traits_d::Polynomial_d f, 
+           typename Polynomial_traits_d::Polynomial_d g,
+           OutputIterator sres)
+{
+
+    typedef typename Polynomial_traits_d::Polynomial_d Polynomial;
+    typedef typename Polynomial_traits_d::Coefficient_type NT;
+    typename Polynomial_traits_d::Degree degree;
+    typename CGAL::Algebraic_structure_traits<Polynomial>::Is_zero is_zero;
+    typename Polynomial_traits_d::Leading_coefficient lcoeff;
+
+    typedef typename internal::Simple_matrix<NT> Matrix;
+    
+    int n = degree(f);
+    int m = degree(g);
+    
+    bool swapped=false;
+
+    if(n < m) {
+      std::swap(f,g);
+      std::swap(n,m);
+      swapped=true;
+      
+    }
+
+    Matrix B = symmetric_bezout_matrix<Polynomial_traits_d>(f,g);
+    
+    // Compute a_0^{n-m}
+
+    NT divisor=ipower(lcoeff(f),n-m);
+    
+    std::vector<NT> minors;
+    minors_berkowitz(B,std::back_inserter(minors),n,m);
+    CGAL::internal::symmetric_minors_to_subresultants(minors.begin(),sres,
+                                                   divisor,n,m,swapped);
+    
+    return sres; 
+  }
+
+/* 
+ * Return a modified version of the hybrid bezout matrix such that the minors
+ * from the last k rows and columns give the subresultants
+ */
+template<class Polynomial_traits_d>
+typename internal::Simple_matrix<typename Polynomial_traits_d::Coefficient_type>
+modified_hybrid_bezout_matrix
+    (typename Polynomial_traits_d::Polynomial_d f,
+     typename Polynomial_traits_d::Polynomial_d g) {
+
+    typedef typename Polynomial_traits_d::Coefficient_type NT;
+
+    typedef typename internal::Simple_matrix<NT> Matrix;
+    
+    typename Polynomial_traits_d::Degree degree;
+
+    int n = degree(f);
+    int m = degree(g);
+    
+    int i,j;
+
+    bool negate, swapped=false;
+
+    if(n < m) {
+      std::swap(f,g); //(*)
+      std::swap(n,m);
+      swapped=true;
+    }
+    
+    Matrix B = CGAL::internal::hybrid_bezout_matrix<Polynomial_traits_d>(f,g);
+
+
+    // swap columns
+    i=0;
+    while(i<n-i-1) {
+      B.swap_columns(i,n-i-1); // (**)
+      i++;
+    }
+    for(i=0;i<n;i++) { 
+      negate=(n-i-1) & 1; // Negate every second column because of (**)
+      negate=negate ^ (swapped & (n-m+1)); // XOR negate everything because of(*)
+      if(negate) {
+	for(j=0;j<n;j++) {
+	  B[j][i] *= -1;
+	}
+      }
+    }
+    return B;
+}
+
+/*! \ingroup CGAL_resultant_matrix
+ * \brief compute the principal subresultant coefficients as minors 
+ * of the hybrid Bezout matrix.
+ *
+ * Returns the sequence sres<sub>0</sub>,...,sres<sub>m</sub>$, where 
+ * sres<sub>i</sub> denotes the ith principal subresultant coefficient
+ *
+ * The function uses an extension of the Berkowitz method to compute the
+ * determinant
+ * See also \c CGAL::minors_berkowitz
+ */
+template<class Polynomial_traits_d,class OutputIterator>
+OutputIterator hybrid_bezout_subresultants(
+	   typename Polynomial_traits_d::Polynomial_d f, 
+           typename Polynomial_traits_d::Polynomial_d g,
+           OutputIterator sres) 
+  {
+
+    typedef typename Polynomial_traits_d::Coefficient_type NT;
+    typename Polynomial_traits_d::Degree degree;
+
+    typedef typename internal::Simple_matrix<NT> Matrix;
+    
+    int n = degree(f);
+    int m = degree(g);
+
+    Matrix B = CGAL::internal::modified_hybrid_bezout_matrix<Polynomial_traits_d>
+        (f,g);
+
+    if(n<m) {
+      std::swap(n,m);
+    }
+
+    return minors_berkowitz(B,sres,n,m);
+  }
+
+
+  // Swap entry A_ij with A_(n-i)(n-j) for square matrix A of dimension n
+  template<class NT>
+    void swap_entries(typename internal::Simple_matrix<NT> & A) {
+    CGAL_precondition(A.row_dimension()==A.column_dimension());
+    int n = A.row_dimension();
+    int i=0;
+    while(i<n-i-1) {
+        A.swap_rows(i,n-i-1); 
+        A.swap_columns(i,n-i-1); 
+        i++;
+    }
+  }
+  
+  // Produce S-matrix with the given matrix and integers.
+  template<class NT,class InputIterator>
+    typename internal::Simple_matrix<NT> s_matrix(
+	      const typename internal::Simple_matrix<NT>& B,
+	      InputIterator num,int size)
+    {
+      typename internal::Simple_matrix<NT> S(size);
+      CGAL_precondition_code(int n = B.row_dimension();)
+      CGAL_precondition(n==(int)B.column_dimension());
+      int curr_num;
+      bool negate;
+      
+      for(int i=0;i<size;i++) {
+	curr_num=(*num);
+	num++;
+	negate = curr_num<0;
+	if(curr_num<0) {
+	  curr_num=-curr_num;
+	}
+	for(int j=0;j<size;j++) {
+	  
+	  S[j][i]=negate ? -B[j][curr_num-1] : B[j][curr_num-1];
+	  
+	}
+      }
+      return S;
+    }
+  
+  // Produces the integer sequence for the S-matrix, where c is the first entry
+  // of the sequence, s the number of desired diagonals and n the dimension 
+  // of the base matrix
+  template<class OutputIterator>
+    OutputIterator s_matrix_integer_sequence(OutputIterator it,
+					      int c,int s,int n) {
+    CGAL_precondition(0<s);
+    CGAL_precondition(s<=n);
+    // c is interpreted modulo s wrt to the representants {1,..,s}
+    c=c%s;
+    if(c==0) {
+      c=s;
+    }
+    
+    int i, p=0, q=c;
+    while(q<=n) {
+      *it = q;
+      it++;
+      for(i=p+1;i<q;i++) {
+	*it = -i;
+	it++;
+      }
+      p = q;
+      q = q+s;
+    }
+    return it;
+  }
+
+/*! \ingroup CGAL_resultant_matrix
+ * \brief computes the coefficients of the polynomial subresultant sequence 
+ *
+ * Returns an upper triangular matrix <I>A</I> such that A<sub>i,j</sub> is
+ * the coefficient of <I>x<sup>j-1</sup></I> in the <I>i</I>th polynomial
+ * subresultant. In particular, the main diagonal contains the scalar
+ * subresultants.
+ * 
+ * If \c d > 0 is specified, only the first \c d diagonals of <I>A</I> are 
+ * computed. In particular, setting \c d to one yields exactly the same
+ * result as applying \c hybrid_subresultants or \c symmetric_subresultants
+ * (except the different output format). 
+ *
+ * These coefficients are computed as special minors of the hybrid Bezout matrix.
+ * See also \c CGAL::minors_berkowitz
+ */
+template<typename Polynomial_traits_d>
+typename internal::Simple_matrix<typename Polynomial_traits_d::Coefficient_type> 
+polynomial_subresultant_matrix(typename Polynomial_traits_d::Polynomial_d f,
+			       typename Polynomial_traits_d::Polynomial_d g,
+                               int d=0) {
+
+    typedef typename Polynomial_traits_d::Coefficient_type NT;
+    typename Polynomial_traits_d::Degree degree;
+    typename Polynomial_traits_d::Leading_coefficient lcoeff;
+
+    int n = degree(f);
+    int m = degree(g);
+
+    CGAL_precondition(n>=0);
+    CGAL_precondition(m>=0);
+    CGAL_precondition(d>=0);
+
+    typedef internal::Simple_matrix<NT> Matrix;
+   
+    bool swapped=false;
+
+    if(n < m) {
+      std::swap(f,g);
+      std::swap(n,m);
+      swapped=true;
+    }
+
+    if(d==0) {
+      d=m;
+    };
+
+
+    Matrix B = CGAL::internal::symmetric_bezout_matrix<Polynomial_traits_d>(f,g);
+
+    // For easier notation, we swap all entries:
+    internal::swap_entries<NT>(B);
+    
+    // Compute the S-matrices and collect the minors
+    std::vector<Matrix> s_mat(m);
+    std::vector<std::vector<NT> > coeffs(d);
+    for(int i = 1; i<=d;i++) {
+      std::vector<int> intseq;
+      internal::s_matrix_integer_sequence(std::back_inserter(intseq),i,d,n);
+
+      Matrix S = internal::s_matrix<NT>(B,intseq.begin(),(int)intseq.size());
+      internal::swap_entries<NT>(S);
+      //std::cout << S << std::endl;
+      int Sdim = S.row_dimension();
+      int number_of_minors=(Sdim < m) ? Sdim : Sdim; 
+      
+      internal::minors_berkowitz(S,std::back_inserter(coeffs[i-1]),
+			    Sdim,number_of_minors);
+
+    }
+
+    // Now, rearrange the minors in the matrix
+
+    Matrix Ret(m,m,NT(0));
+
+    for(int i = 0; i < d; i++) {
+      for(int j = 0;j < m-i ; j++) {
+	int s_index=(n-m+j+i+1)%d;
+	if(s_index==0) {
+	  s_index=d;
+	}
+	s_index--;
+	Ret[j][j+i]=coeffs[s_index][n-m+j];
+	
+      }
+    }
+
+    typename CGAL::Algebraic_structure_traits<NT>::Integral_division idiv;
+
+    NT divisor = ipower(lcoeff(f),n-m); 
+
+    int bit_mask = swapped ? 1 : 0;
+    // Divide through the divisor and set the correct sign
+    for(int i=0;i<m;i++) {
+      for(int j = i;j<m;j++) {
+	int negate = ((n-m+i+1) & 2)>>1; // (n-m+i+1)==2 or 3 mod 4
+	negate^=(bit_mask & ((n-m+i+1)*(i+1)));
+	//...XOR (swapped AND (n-m+i+1)* (i+1) is odd) 
+	Ret[i][j] = idiv(Ret[i][j],  negate>0 ? -divisor : divisor);
+      }
+    }
+
+    return Ret;
+}
+
+}
+
+} //namespace CGAL
+
+
+
+#endif // CGAL_POLYNOMIAL_BEZOUT_MATRIX_H
+// EOF
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/determinant.h b/3rdparty/CGAL/include/CGAL/Polynomial/determinant.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/determinant.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/determinant.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/fwd.h b/3rdparty/CGAL/include/CGAL/Polynomial/fwd.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/fwd.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/fwd.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/hgdelta_update.h b/3rdparty/CGAL/include/CGAL/Polynomial/hgdelta_update.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/hgdelta_update.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/hgdelta_update.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Alternation_counter.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Alternation_counter.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Alternation_counter.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Alternation_counter.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/CORE_polynomial.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/CORE_polynomial.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/CORE_polynomial.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/CORE_polynomial.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Descartes_root_count.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Descartes_root_count.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Descartes_root_count.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Descartes_root_count.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Double_with_infinity.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Double_with_infinity.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Double_with_infinity.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Double_with_infinity.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_function.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_function.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_function.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_function.h
diff --git a/3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_kernel.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_kernel.h
new file mode 100644
index 0000000..11a97cb
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_kernel.h
@@ -0,0 +1,111 @@
+// Copyright (c) 2005  Stanford University (USA).
+// 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(s)     : Daniel Russel <drussel at alumni.princeton.edu>
+
+#ifndef CGAL_POLYNOMIAL_FILTERED_POLYNOMIAL_KERNEL_H
+#define CGAL_POLYNOMIAL_FILTERED_POLYNOMIAL_KERNEL_H
+
+#include <CGAL/Polynomial/basic.h>
+#include <CGAL/Polynomial/internal/Filtered_rational/Filtered_rational_traits.h>
+#include <CGAL/Polynomial/internal/Filtered_kernel/Filtered_sign_at.h>
+#include <CGAL/Polynomial/internal/Filtered_kernel/Filtered_root_multiplicity.h>
+#include <CGAL/Polynomial/internal/Kernel/Root_container.h>
+#include <CGAL/Polynomial/internal/Kernel/Is_even_multiplicity.h>
+#include <CGAL/Polynomial/internal/Kernel/Is_rational.h>
+#include <CGAL/Polynomial/internal/Kernel/To_rational.h>
+
+namespace CGAL { namespace POLYNOMIAL {
+
+//! A filtered polynomial kernel.
+/*!
+ */
+template < class Traits_t, class RE>
+class Filtered_kernel: public internal::Filtered_rational_traits<Traits_t>
+{
+    typedef Filtered_kernel< Traits_t, RE > This;
+    typedef internal::Filtered_rational_traits<Traits_t> P;
+    public:
+        typedef RE Root_stack;
+        typedef typename RE::Root Root;
+        typedef typename P::Function Function;
+        typedef typename Function::NT NT;
+        typedef typename Root_stack::Traits Root_stack_traits;
+
+        Filtered_kernel(const Root_stack_traits &tr = Root_stack_traits()): ret_(tr){}
+
+        typedef typename internal::Filtered_sign_at<This> Sign_at;
+        Sign_at sign_at_object(const Function &p) const
+        {
+            return Sign_at(p, *this);
+        }
+
+        typedef internal::Filtered_root_multiplicity<This> Multiplicity;
+        Multiplicity multiplicity_object(const Function &p0) const
+        {
+            return Multiplicity(p0, *this);
+        }
+
+        typedef internal::Is_even_multiplicity<This> Is_even_multiplicity;
+        Is_even_multiplicity is_even_multiplicity_object(const Function &) const
+        {
+            return Is_even_multiplicity();
+        }
+
+        typedef internal::Is_rational<This> Is_rational;
+        Is_rational is_rational_object() const
+        {
+            return Is_rational();
+        }
+
+        typedef internal::To_rational<This> To_rational;
+        To_rational to_rational_object() const
+        {
+            return To_rational();
+        }
+
+//! Return a container for roots in an interval
+/*!
+  \todo make sure that the iterator has all the right types.
+*/
+        typedef internal::Root_container<This> Root_container;
+        friend class internal::Root_container<This>;
+        Root_container root_container_object(const typename P::Function &f,
+            const Root &lb=-Root::infinity(),
+            const Root &ub= Root::infinity()) const
+        {
+            return Root_container(f, lb, ub, *this);
+        }
+
+        Root_stack root_stack_object(const typename P::Function &f,
+            const Root &lb=-Root::infinity(),
+            const Root &ub= Root::infinity()) const
+        {
+            return Root_stack(f, lb, ub, root_stack_traits_object());
+        }
+
+        Root_stack_traits root_stack_traits_object() const
+        {
+            return ret_;
+        }
+    protected:
+        Root_stack_traits ret_;
+};
+
+} } //namespace CGAL::POLYNOMIAL
+#endif
diff --git a/3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_kernel/Filtered_Descartes_has_root.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_kernel/Filtered_Descartes_has_root.h
new file mode 100644
index 0000000..5016fb8
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_kernel/Filtered_Descartes_has_root.h
@@ -0,0 +1,56 @@
+// Copyright (c) 2005  Stanford University (USA).
+// 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(s)     : Daniel Russel <drussel at alumni.princeton.edu>
+
+#ifndef CGAL_POLYNOMIAL_FILTERED_DESCARTES_HAS_ROOT_H
+#define CGAL_POLYNOMIAL_FILTERED_DESCARTES_HAS_ROOT_H
+#include <CGAL/Polynomial/basic.h>
+#include <CGAL/Polynomial/internal/Filtered_kernel/Filtered_Descartes_root_counter.h>
+
+namespace CGAL { namespace POLYNOMIAL { namespace internal {;
+
+template <class Kernel>
+class Filtered_Descartes_has_root
+{
+    public:
+        Filtered_Descartes_has_root(){}
+
+        Filtered_Descartes_has_root(const typename Kernel::Function &fh, Kernel k= Kernel()): h_(fh), kernel_(k) {
+        }
+
+        ~Filtered_Descartes_has_root() {
+        }
+
+        typedef bool result_type;
+
+        template <class NTT>
+            result_type operator()(const NTT &begin, const NTT &end,
+            POLYNOMIAL_NS::Sign=POLYNOMIAL_NS::ZERO,
+            POLYNOMIAL_NS::Sign=POLYNOMIAL_NS::ZERO) const
+        {
+            return filtered_Descartes_root_counter(h_, begin, end, false, kernel_)!= 0;
+        }
+
+    protected:
+        typename Kernel::Function h_;
+        Kernel kernel_;
+};
+
+} } } //namespace CGAL::POLYNOMIAL::internal;
+#endif
diff --git a/3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_kernel/Filtered_Descartes_root_counter.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_kernel/Filtered_Descartes_root_counter.h
new file mode 100644
index 0000000..3f3a176
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_kernel/Filtered_Descartes_root_counter.h
@@ -0,0 +1,158 @@
+// Copyright (c) 2005  Stanford University (USA).
+// 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(s)     : Daniel Russel <drussel at alumni.princeton.edu>
+
+#ifndef CGAL_POLYNOMIAL_FILTERED_DESCARTES_ROOT_COUNTER_H
+#define CGAL_POLYNOMIAL_FILTERED_DESCARTES_ROOT_COUNTER_H
+
+#include <CGAL/Polynomial/basic.h>
+
+#include <CGAL/Polynomial/internal/Alternation_counter.h>
+#include <CGAL/Polynomial/internal/interval_arithmetic.h>
+
+namespace CGAL { namespace POLYNOMIAL { namespace internal {;
+
+//! A class for computing filtered exact and approximate descartes root bounds.
+/*!
+  This can be used in two modes, first, just used filtering to perform an exact
+  descartes root bound faster. The second will return as soon as it can figure
+  out that there is a root in the interval.  This second mode can then return
+  the value SOME for the number roots meaning there is some unknown number
+  greater than 0 (at most).
+
+  A descartes root bound if performed exact computes whether there are 0, 1 or
+  an odd number or an even number of roots. The presence of an odd number of
+  roots can be more quickly determined by looking at the signs of the ends of
+  the interval (assuming they are non-zero). This bound does not do this
+optimization since the values can probably be cached by the calling function
+(since a pair of intervals share an endpoint).
+
+The filtering is used in a variety of ways. First, calculation are initially
+performed using intervals. If no exact answer is required and there is at
+least one definite alternation in the signs of the interval coefficients, then
+SOME is returned. If the intervals do not result in sufficient information
+begin computed, then the calculations fall back to repeating the process with
+an exact number type. Only ring operations are used, so any exact number type
+is fine.
+
+I think I should be able to return more exact bounds even if the intervals are
+not clear on their sign.  For example:
++?- the value of the ? does not matter
++?+ there are 0 or 2 from the ?, so the parity is still known
++??+ there are at most 1, so this is useless
++??- there are at most 3, so this is useless.
+*/
+
+template <class BNT, class Kernel>
+unsigned int filtered_Descartes_root_counter(const typename Kernel::Function &fh,
+const BNT &begin,
+const BNT &end,
+bool need_exact,
+Kernel k)
+{
+    typename Kernel::Interval_kernel::NT bi, ei;
+    typename Kernel::Interval_kernel::Function fim;
+    POLYNOMIAL_NS::Alternation_counter<typename Kernel::Interval_kernel::NT> ac;
+    {
+        Interval_arithmetic_guard iag;
+
+        if (fh.interval_function().is_constant()) {
+//std::cerr << "Why are you solving constant function?\n";
+            return 0;
+        }
+
+        bi= k.interval_function_converter_object().nt_converter()(begin);
+        ei= k.interval_function_converter_object().nt_converter()(end);
+
+//! Could add their optimization here if shift is positive
+        fim = k.interval_kernel_object().map_interval_to_positive_object(fh.interval_function())( bi, ei);
+
+        for (int i=0; i<= fim.degree(); ++i) {
+            ac.push_back(fim[i]);
+            if (!need_exact && ac.number_of_alternations() >0) {
+//std::cout << "Quick out in root count.\n";
+                return 1;
+            }
+        }
+    }
+
+    if (!ac.is_uncertain()) {
+/*std::cout << "No uncertainty in root count: " << fh << " [" << begin << ", " << end << "] is "
+  << ac.number_of_alternations() << "\n";*/
+        return ac.number_of_alternations();
+    }
+    else {
+/*if (ac.number_of_alternations() >0 && !ac.parity_uncertain()){
+  if (ac.number_of_alternations() %2==0) return Descartes_root_count::even();
+  else return Descartes_root_count::odd();
+  } else*/
+//typename CGAL::NT_converter<BNT, typename Kernel::Exact_kernel::Function::NT> ec;
+
+        typename Kernel::Exact_function_converter efc= k.exact_function_converter_object();
+        typename Kernel::Exact_kernel::NT be= efc.nt_converter()(begin);
+        typename Kernel::Exact_kernel::NT ee= efc.nt_converter()(end);
+        typename Kernel::Exact_kernel ek=k.exact_kernel_object();
+
+        typename Kernel::Exact_kernel::Function fem= ek.map_interval_to_positive_object(fh.exact_function())(be, ee);
+
+        POLYNOMIAL_NS::Alternation_counter<typename Kernel::Exact_kernel::NT> ac;
+        for (int i=0; i<= fem.degree(); ++i) {
+            ac.push_back(fem[i]);
+        }
+//std::cout << "Exact return in root count.\n";
+        return ac.number_of_alternations();
+    }
+}
+
+
+template <class Kernel>
+class Filtered_Descartes_root_counter
+{
+    public:
+        Filtered_Descartes_root_counter(){}
+
+        Filtered_Descartes_root_counter(const typename Kernel::Function &fh, Kernel k= Kernel()): h_(fh), kernel_(k) {
+        }
+
+        ~Filtered_Descartes_root_counter() {
+        }
+
+        typedef unsigned int result_type;
+
+        template <class NTT>
+            result_type operator()(const NTT &begin, const NTT &end,
+            POLYNOMIAL_NS::Sign,
+            POLYNOMIAL_NS::Sign) const
+        {
+            return filtered_Descartes_root_counter(h_, begin, end, true, kernel_);
+        }
+
+        template <class NTT>
+            result_type operator()(const NTT &begin, const NTT &end) const
+        {
+            return filtered_Descartes_root_counter(h_, begin, end, true, kernel_);
+        }
+
+    protected:
+        typename Kernel::Function h_;
+        Kernel kernel_;
+};
+
+} } } //namespace CGAL::POLYNOMIAL::internal;
+#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_kernel/Filtered_are_negations.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_kernel/Filtered_are_negations.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_kernel/Filtered_are_negations.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_kernel/Filtered_are_negations.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_kernel/Filtered_root_bound_evaluator.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_kernel/Filtered_root_bound_evaluator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_kernel/Filtered_root_bound_evaluator.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_kernel/Filtered_root_bound_evaluator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_kernel/Filtered_root_multiplicity.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_kernel/Filtered_root_multiplicity.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_kernel/Filtered_root_multiplicity.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_kernel/Filtered_root_multiplicity.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_kernel/Filtered_sign_at.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_kernel/Filtered_sign_at.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_kernel/Filtered_sign_at.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_kernel/Filtered_sign_at.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_number.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_number.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_number.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_number.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_rational/Construct_filtered_function.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_rational/Construct_filtered_function.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_rational/Construct_filtered_function.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_rational/Construct_filtered_function.h
diff --git a/3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_Descartes_has_root.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_Descartes_has_root.h
new file mode 100644
index 0000000..b4aff7b
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_Descartes_has_root.h
@@ -0,0 +1,56 @@
+// Copyright (c) 2005  Stanford University (USA).
+// 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(s)     : Daniel Russel <drussel at alumni.princeton.edu>
+
+#ifndef CGAL_POLYNOMIAL_FILTERED_DESCARTES_HAS_ROOT_H
+#define CGAL_POLYNOMIAL_FILTERED_DESCARTES_HAS_ROOT_H
+#include <CGAL/Polynomial/basic.h>
+#include <CGAL/Polynomial/internal/Filtered_rational/Filtered_Descartes_root_counter.h>
+
+namespace CGAL { namespace POLYNOMIAL { namespace internal {;
+
+template <class Kernel>
+class Filtered_Descartes_has_root
+{
+    public:
+        Filtered_Descartes_has_root(){}
+
+        Filtered_Descartes_has_root(const typename Kernel::Function &fh, Kernel k= Kernel()): h_(fh), kernel_(k) {
+        }
+
+        ~Filtered_Descartes_has_root() {
+        }
+
+        typedef bool result_type;
+
+        template <class NTT>
+            result_type operator()(const NTT &begin, const NTT &end,
+            POLYNOMIAL_NS::Sign=POLYNOMIAL_NS::ZERO,
+            POLYNOMIAL_NS::Sign=POLYNOMIAL_NS::ZERO) const
+        {
+            return filtered_Descartes_root_counter(h_, begin, end, false, kernel_)!= 0;
+        }
+
+    protected:
+        typename Kernel::Function h_;
+        Kernel kernel_;
+};
+
+} } } //namespace CGAL::POLYNOMIAL::internal;
+#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_Descartes_root_counter.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_Descartes_root_counter.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_Descartes_root_counter.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_Descartes_root_counter.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_Sturm_sequence.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_Sturm_sequence.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_Sturm_sequence.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_Sturm_sequence.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_are_negations.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_are_negations.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_are_negations.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_are_negations.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_rational_multiplicity.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_rational_multiplicity.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_rational_multiplicity.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_rational_multiplicity.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_rational_sign_above_rational.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_rational_sign_above_rational.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_rational_sign_above_rational.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_rational_sign_above_rational.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_rational_traits.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_rational_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_rational_traits.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_rational_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_root_bound_evaluator.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_root_bound_evaluator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_root_bound_evaluator.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_root_bound_evaluator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_sign_Sturm_sequence.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_sign_Sturm_sequence.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_sign_Sturm_sequence.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_sign_Sturm_sequence.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_sign_at_rational.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_sign_at_rational.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_sign_at_rational.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_sign_at_rational.h
diff --git a/3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_standard_sequence.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_standard_sequence.h
new file mode 100644
index 0000000..54f0140
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Filtered_rational/Filtered_standard_sequence.h
@@ -0,0 +1,151 @@
+// Copyright (c) 2005  Stanford University (USA).
+// 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(s)     : Daniel Russel <drussel at alumni.princeton.edu>
+
+#ifndef CGAL_FILTERED_STANDARD_SEQUENCE_H
+#define CGAL_FILTERED_STANDARD_SEQUENCE_H
+
+#include <CGAL/Polynomial/basic.h>
+#include <CGAL/Polynomial/internal/Filtered_rational/Filtered_Sturm_sequence.h>
+
+namespace CGAL { namespace POLYNOMIAL { namespace internal {
+
+template<class Traits>
+class Filtered_standard_sequence
+: public Filtered_Sturm_sequence<Traits>
+{
+    protected:
+        typedef Filtered_Sturm_sequence<Traits> P;
+        typedef typename P::SP                SP;
+        typedef typename P::EP                EP;
+        typedef typename P::FH   FH;
+
+    public:
+        typedef SP                  Storage_function;
+        typedef EP                  Exact_function;
+        typedef FH                  Function_handle;
+//typedef typename P::Method_tag                 Method_tag;
+
+    protected:
+        typedef typename P::Interval_nt  Interval_nt;
+        typedef typename P::Exact_nt     Exact_nt;
+
+        typedef typename P::Interval_function  Interval_function;
+
+        typedef typename P::ISturm  ISturm;
+        typedef typename P::ESturm     ESturm;
+
+        typedef typename P::Exact_to_interval_function_converter
+            Exact_to_interval_function_converter;
+
+    protected:
+
+        virtual void compute_exact() const
+        {
+            if ( this->know_exact ) { return; }
+
+            Exact_function eq = P::tr_.exact_traits_object().differentiate_object()(P::fhp.exact_function());
+            this->eseq = P::tr_.exact_traits_object().Sturm_sequence_object(P::fhp.exact_function(), eq);
+            P::update_interval_Sturm_sequence();
+            this->know_exact = true;
+        }
+
+        void initialize() {
+            FPU_CW_t backup = FPU_get_and_set_cw(CGAL_FE_UPWARD);
+
+            Interval_function iq = P::tr_.interval_traits_object().differentiate_object()(P::fhp.interval_function());
+            this->iseq = P::tr_.interval_traits_object().Sturm_sequence_object(P::fhp.interval_function(), iq);
+
+            FPU_set_cw(backup);
+
+            this->know_exact = false;
+
+#if 1
+            bool need_exact = false;
+            for (int i = P::iseq.size()-1; i >= 0; i--) {
+                bool is_zero = true;
+                for (int j = 0; j <= P::iseq[i].degree(); j++) {
+                    if ( !CGAL::is_finite(P::iseq[i][j]) ) {
+                        need_exact = true;
+                        break;
+                    }
+                    if ( P::iseq[i][j].inf() != 0 || P::iseq[i][j].sup() != 0 ) {
+                        is_zero = false;
+                    }
+                }
+                if ( is_zero ) {
+                    need_exact = true;
+                    break;
+                }
+            }
+
+            if ( !need_exact ) {
+                P::know_exact = false;
+                return;
+            }
+
+            compute_exact();
+#endif
+        }
+
+    public:
+//===============
+// CONSTRUCTORS
+//===============
+        Filtered_standard_sequence() {}
+
+        Filtered_standard_sequence(const Function_handle& fh, const Traits &tr):
+        P(fh, Function_handle(0), tr, false) {
+//this->fhp = fh;
+            initialize();
+        }
+
+        virtual ~Filtered_standard_sequence() {}
+
+        const Interval_function& interval(int i) const  { return P::iseq[i]; }
+        const Exact_function&    exact(int i)    const
+        {
+            if ( !this->know_exact ) {
+                compute_exact();
+            }
+            return P::eseq[i];
+        }
+
+    public:
+
+        template<class T>
+            unsigned int
+            number_of_real_roots(const T& a, const T& b) const
+        {
+            CGAL_precondition( b >= a );
+
+            unsigned int Va = sign_variations(a);
+            if ( Va == 0 ) { return 0; }
+
+            unsigned int Vb = sign_variations(b);
+
+            CGAL_assertion( Va > Vb );
+
+            return Va - Vb;
+        }
+
+};
+
+} } } //namespace CGAL::POLYNOMIAL::internal
+#endif                                            // CGAL_FILTERED_STANDARD_SEQUENCE_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Fixed_polynomial_impl.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Fixed_polynomial_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Fixed_polynomial_impl.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Fixed_polynomial_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/GSL_numeric_solver.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/GSL_numeric_solver.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/GSL_numeric_solver.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/GSL_numeric_solver.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Isolating_interval.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Isolating_interval.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Isolating_interval.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Isolating_interval.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/JAMA_numeric_solvers_impl.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/JAMA_numeric_solvers_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/JAMA_numeric_solvers_impl.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/JAMA_numeric_solvers_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Kernel/Is_even_multiplicity.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Kernel/Is_even_multiplicity.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Kernel/Is_even_multiplicity.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Kernel/Is_even_multiplicity.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Kernel/Is_rational.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Kernel/Is_rational.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Kernel/Is_rational.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Kernel/Is_rational.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Kernel/Isolating_interval.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Kernel/Isolating_interval.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Kernel/Isolating_interval.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Kernel/Isolating_interval.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Kernel/Lower_bound_root.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Kernel/Lower_bound_root.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Kernel/Lower_bound_root.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Kernel/Lower_bound_root.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Kernel/Multiplicity.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Kernel/Multiplicity.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Kernel/Multiplicity.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Kernel/Multiplicity.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Kernel/Rational_between_roots.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Kernel/Rational_between_roots.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Kernel/Rational_between_roots.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Kernel/Rational_between_roots.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Kernel/Root_container.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Kernel/Root_container.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Kernel/Root_container.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Kernel/Root_container.h
diff --git a/3rdparty/CGAL/include/CGAL/Polynomial/internal/Kernel/Sign_above.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Kernel/Sign_above.h
new file mode 100644
index 0000000..7c2d1b3
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Kernel/Sign_above.h
@@ -0,0 +1,91 @@
+// Copyright (c) 2005  Stanford University (USA).
+// 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(s)     : Daniel Russel <drussel at alumni.princeton.edu>
+
+#ifndef CGAL_POLYNOMIAL_INTERNAL_AFTER_AT_ROOT_H
+#define CGAL_POLYNOMIAL_INTERNAL_AFTER_AT_ROOT_H
+
+#include <CGAL/Polynomial/basic.h>
+#include <CGAL/Polynomial/internal/Rational/Evaluate_polynomial.h>
+#include <CGAL/Polynomial/internal/Rational/Sign_above_rational.h>
+
+namespace CGAL { namespace POLYNOMIAL { namespace internal {
+
+//! Compute the sign after a root.
+/*!
+  This has specializations for Explicit_roots.
+*/
+template <class RNT, class K>
+class Sign_above: Sign_above_rational<K>
+{
+  typedef typename K::Function Poly;
+  typedef Sign_above_rational<K> P;
+public:
+  Sign_above( K k):P(k) {
+  }
+  Sign_above(){}
+
+#if defined(_MSC_VER) && ( _MSC_VER >= 1800 )
+  // == VC12 == Visual Studio 2013
+  template<typename... Args>
+  auto operator()(Args&&... args) ->
+      decltype(P::operator()(std::forward<Args>(args)...))
+  {
+    return P::operator()(std::forward<Args>(args)...);
+  }
+#else
+  using P::operator();
+#endif
+
+  typedef CGAL::Sign result_type;
+  typedef Poly first_argument_type;
+  typedef typename K::Root second_argument_type;
+ typename P::result_type operator()(const first_argument_type &f,
+                                    const second_argument_type &v) const
+  {
+    CGAL_Polynomial_expensive_precondition(k_.sign_at_root_object(p_)(v)==CGAL::ZERO);
+    return eval(f, v);
+  }
+
+protected:
+
+  template <class R>
+  CGAL::Sign eval(const Poly &p, const R &r) const
+  {
+    double ub= CGAL::to_interval(r).second+.00001;
+    if (ub== CGAL::to_interval(r).second) ub= ub*2;
+    typename K::Root_stack rc=  k_.root_stack_object(p, r, ub);
+    while (true) {
+      if (rc.empty()) {
+	return k_.sign_at_object()(p,typename Poly::NT(ub));
+      } else if (rc.top() != r) {
+	typename K::Root rr=rc.top();
+	typename K::Sign_between_roots sb= k_.sign_between_roots_object();
+	return sb(p, r, rr);
+      } else {
+	rc.pop();
+      }
+    }
+  }
+  K k_;
+};
+
+
+} } } //namespace CGAL::POLYNOMIAL::internal
+#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Kernel/Sign_at.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Kernel/Sign_at.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Kernel/Sign_at.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Kernel/Sign_at.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Kernel/Sign_below.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Kernel/Sign_below.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Kernel/Sign_below.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Kernel/Sign_below.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Kernel/Sign_between_roots.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Kernel/Sign_between_roots.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Kernel/Sign_between_roots.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Kernel/Sign_between_roots.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Kernel/To_rational.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Kernel/To_rational.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Kernel/To_rational.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Kernel/To_rational.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Kernel/predicate_template.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Kernel/predicate_template.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Kernel/predicate_template.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Kernel/predicate_template.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Polynomial_impl.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Polynomial_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Polynomial_impl.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Polynomial_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Are_negations.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Are_negations.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Are_negations.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Are_negations.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Bezier_root_counter.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Bezier_root_counter.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Bezier_root_counter.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Bezier_root_counter.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Compare_isolated_roots_in_interval.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Compare_isolated_roots_in_interval.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Compare_isolated_roots_in_interval.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Compare_isolated_roots_in_interval.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Construct_function.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Construct_function.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Construct_function.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Construct_function.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Derivative.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Derivative.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Derivative.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Derivative.h
diff --git a/3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Descartes_has_root.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Descartes_has_root.h
new file mode 100644
index 0000000..f43bae7
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Descartes_has_root.h
@@ -0,0 +1,70 @@
+// Copyright (c) 2005  Stanford University (USA).
+// 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(s)     : Daniel Russel <drussel at alumni.princeton.edu>
+
+#ifndef CGAL_POLYNOMIAL_DESCARTES_HAS_ROOT_H
+#define CGAL_POLYNOMIAL_DESCARTES_HAS_ROOT_H
+
+#include <CGAL/Polynomial/basic.h>
+#include <CGAL/Polynomial/internal/Alternation_counter.h>
+
+namespace CGAL { namespace POLYNOMIAL { namespace internal {;
+
+template <class Kernel>
+class Descartes_has_root
+{
+    public:
+        Descartes_has_root(const typename Kernel::Function &f,
+        Kernel k= Kernel()): map_(k.map_rational_interval_to_positive_object(f)) {
+
+        }
+
+        typedef bool result_type;
+        typedef typename Kernel::Function::NT first_argument_type;
+        typedef typename Kernel::Function::NT second_argument_type;
+
+//! Note, the result is an upper bound
+/*!
+  Bezier root counter needs the sign version of the function. This is added to make the two compatible.
+*/
+        template <class NTT>
+            result_type operator()(const NTT &lb, const NTT &ub,
+            POLYNOMIAL_NS::Sign, POLYNOMIAL_NS::Sign) const
+        {
+            return operator()(lb,ub);
+        }
+        template <class NTT>
+            result_type operator()(const NTT &lb, const NTT &ub) const
+        {
+            typename Kernel::Function mf= map_(lb, ub);
+
+            typename POLYNOMIAL_NS::Alternation_counter<first_argument_type> ac;
+            for (int i=0; i<= mf.degree(); ++i) {
+                ac.push_back(mf[i]);
+                if (ac.number_of_alternations() >0) return true;
+
+            }
+//std::cout << "Num alternations is " << ac.number_of_alternations() << std::endl;
+            return false;
+        }
+    protected:
+        typename Kernel::Map_rational_interval_to_positive map_;
+};
+} } } //namespace CGAL::POLYNOMIAL::internal;
+#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Descartes_root_counter.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Descartes_root_counter.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Descartes_root_counter.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Descartes_root_counter.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Euclidean_Sturm_sequence.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Euclidean_Sturm_sequence.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Euclidean_Sturm_sequence.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Euclidean_Sturm_sequence.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Evaluate_polynomial.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Evaluate_polynomial.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Evaluate_polynomial.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Evaluate_polynomial.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Invert_variable.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Invert_variable.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Invert_variable.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Invert_variable.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Map_rational_interval_to_positive.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Map_rational_interval_to_positive.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Map_rational_interval_to_positive.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Map_rational_interval_to_positive.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Monic_Sturm_sequence.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Monic_Sturm_sequence.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Monic_Sturm_sequence.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Monic_Sturm_sequence.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Negate_variable.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Negate_variable.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Negate_variable.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Negate_variable.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Primitive_part_Sturm_sequence.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Primitive_part_Sturm_sequence.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Primitive_part_Sturm_sequence.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Primitive_part_Sturm_sequence.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Pseudo_quotient.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Pseudo_quotient.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Pseudo_quotient.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Pseudo_quotient.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Pseudo_remainder.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Pseudo_remainder.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Pseudo_remainder.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Pseudo_remainder.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Quotient.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Quotient.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Quotient.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Quotient.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Quotient_remainder.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Quotient_remainder.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Quotient_remainder.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Quotient_remainder.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Rational_multiplicity.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Rational_multiplicity.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Rational_multiplicity.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Rational_multiplicity.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Rational_traits_base.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Rational_traits_base.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Rational_traits_base.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Rational_traits_base.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Rational_translate_zero.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Rational_translate_zero.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Rational_translate_zero.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Rational_translate_zero.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Reduced_Sturm_sequence.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Reduced_Sturm_sequence.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Reduced_Sturm_sequence.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Reduced_Sturm_sequence.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Remainder.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Remainder.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Remainder.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Remainder.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Root_bound_evaluator.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Root_bound_evaluator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Root_bound_evaluator.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Root_bound_evaluator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Shift_power.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Shift_power.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Shift_power.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Shift_power.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Sign_Sturm_sequence.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Sign_Sturm_sequence.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Sign_Sturm_sequence.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Sign_Sturm_sequence.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Sign_above_rational.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Sign_above_rational.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Sign_above_rational.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Sign_above_rational.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Sign_at_rational.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Sign_at_rational.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Sign_at_rational.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Sign_at_rational.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Sign_below_rational.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Sign_below_rational.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Sign_below_rational.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Sign_below_rational.h
diff --git a/3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Standard_sequence.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Standard_sequence.h
new file mode 100644
index 0000000..f02748f
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Standard_sequence.h
@@ -0,0 +1,94 @@
+// Copyright (c) 2005  Stanford University (USA).
+// 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(s)     : Daniel Russel <drussel at alumni.princeton.edu>
+
+#ifndef CGAL_STANDARD_SEQUENCE_H
+#define CGAL_STANDARD_SEQUENCE_H
+
+
+namespace CGAL { namespace POLYNOMIAL { namespace internal {
+
+template<class Sturm_sequence_t>
+class Standard_sequence : public Sturm_sequence_t
+{
+    public:
+        typedef Sturm_sequence_t                        Sturm_sequence;
+        typedef typename Sturm_sequence::Kernel         Kernel;
+        typedef typename Sturm_sequence::Polynomial     Polynomial;
+
+        typedef typename Polynomial::NT                 NT;
+
+    protected:
+        typedef Sturm_sequence                          Base;
+
+    public:
+        Standard_sequence() : Base() {}
+        Standard_sequence(const Polynomial& p, const Kernel& k=Kernel())
+            : Base(p, k.differentiate_object()(p), k) {}
+
+    protected:
+        template<class NTRep>
+            unsigned int number_of_real_roots_base(const NTRep& a,
+            const NTRep& b) const
+        {
+            CGAL_precondition( b >= a );
+
+            unsigned int Va = sign_variations(a);
+            if ( Va == 0 ) { return 0; }
+
+            unsigned int Vb = sign_variations(b);
+
+//CGAL_assertion( Va > Vb );
+
+            return Va - Vb;
+        }
+
+    public:
+        template<class T>
+            unsigned int
+            number_of_real_roots(const T& a, const T& b) const
+        {
+            return number_of_real_roots_base(a, b);
+        }
+
+};
+
+#if 0
+template<class Kernel, class Ret, class M = CGAL::Integral_domain_without_division_tag>
+class Standard_sequence_k
+: public Sturm_sequence_k<Kernel, Ret,M>
+{
+//public:
+    typedef Sturm_sequence_k<Kernel, Ret,M> Parent;
+    typedef typename Parent::Polynomial                                       Polynomial;
+//typedef M                                       Method_tag;
+
+    typedef typename Parent::NT                 NT;
+
+//protected:
+
+    public:
+        Standard_sequence_k() : Parent() {}
+        Standard_sequence_k(const Polynomial& p)
+            : Parent(p, p.derivative()) {}
+};
+#endif
+
+} } } //namespace CGAL::POLYNOMIAL::internal
+#endif                                            // CGAL_STANDARD_SEQUENCE_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Sturm_root_counter.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Sturm_root_counter.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Sturm_root_counter.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Sturm_root_counter.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Sturm_sequence.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Sturm_sequence.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Sturm_sequence.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Sturm_sequence.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Sturm_sequence_base.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Sturm_sequence_base.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Sturm_sequence_base.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Sturm_sequence_base.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Subresultant_Sturm_sequence.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Subresultant_Sturm_sequence.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Rational/Subresultant_Sturm_sequence.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Rational/Subresultant_Sturm_sequence.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Root_stack_traits_base.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Root_stack_traits_base.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Root_stack_traits_base.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Root_stack_traits_base.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Sign_variations_counter.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Sign_variations_counter.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Sign_variations_counter.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Sign_variations_counter.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Simple_interval_root.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Simple_interval_root.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Simple_interval_root.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Simple_interval_root.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Statistics.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Statistics.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Statistics.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Statistics.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Sturm_isolating_interval.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Sturm_isolating_interval.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/Sturm_isolating_interval.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/Sturm_isolating_interval.h
diff --git a/3rdparty/CGAL/include/CGAL/Polynomial/internal/Sturm_root_rep.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Sturm_root_rep.h
new file mode 100644
index 0000000..206e353
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Sturm_root_rep.h
@@ -0,0 +1,1048 @@
+// Copyright (c) 2005  Stanford University (USA).
+// 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(s)     : Daniel Russel <drussel at alumni.princeton.edu>
+
+#ifndef CGAL_POLYNOMIAL_STURM_ROOT_REP_H
+#define CGAL_POLYNOMIAL_STURM_ROOT_REP_H
+
+#include <CGAL/Polynomial/basic.h>
+#include <CGAL/Polynomial/internal/Rational/Sign_Sturm_sequence.h>
+#include <limits>
+#include <cfloat>
+
+
+
+namespace CGAL { namespace POLYNOMIAL { namespace internal {
+
+//==================
+// the Root class
+//==================
+template<class Solver_t, class Interval_t>
+class Sturm_root_rep
+{
+public:
+  typedef Solver_t                            Solver;
+  typedef Interval_t                          Interval;
+  typedef typename Solver::Traits             Traits;
+
+  //  typedef typename Solver::Exact_nt           Exact_nt;
+  //  typedef typename Solver::Storage_function   Storage_function;
+  //  typedef typename Solver::Exact_function     Exact_function;
+  typedef typename Solver::Method_tag         Method_tag;
+
+  //  typedef typename Solver::Function_handle    Function_handle;
+  typedef typename Solver::Standard_sequence  Standard_sequence;
+
+  typedef typename Solver::Polynomial         Polynomial;
+  typedef typename Solver::NT                 NT;
+  typedef typename Solver::Sign_at            Sign_at;
+  typedef NT                                  Exact_nt;
+
+  typedef Sturm_root_rep<Solver,Interval>  Self;
+
+  class Sign_at_functor
+  {
+  public:
+    typedef Sign result_type;
+
+    Sign_at_functor(const Self* outer) : outer(outer) {}
+
+    template<class T>
+    result_type operator()(const T& x) const
+    {
+      Sign s1 = outer->sseq.sign_at(x, 0);
+      Sign s2 = outer->sseq.sign_at_gcd(x);
+
+      CGAL_assertion( s1 == CGAL::ZERO || s2 != CGAL::ZERO );
+      return s1 * s2;
+    }
+
+  private:
+    const Self* outer;
+  };
+
+  typedef typename Traits::Sign_Sturm_sequence   Sign_Sturm_sequence;
+
+protected:
+  typedef std::pair<Interval,Interval>               Interval_pair;
+
+public:
+  //==========================================
+  // METHODS FOR COMPUTING THE MULTIPLICITY
+  //==========================================
+
+  bool is_rational() const
+  {
+    return is_exact();
+  }
+
+  NT to_rational() const
+  {
+    CGAL_Polynomial_precondition( is_rational() );
+    return ivl.lower_bound();
+  }
+
+  bool is_exact() const
+  {
+    return ivl.is_singular();
+  }
+
+  // computes the multiplicity using the interval number type;
+  // if computation was successful the method sets success to true;
+  // if computation was not possible the method sets success to
+  // false;
+
+  void compute_multiplicity() const
+  {
+    CGAL_precondition( multiplicity_ == 0 );
+
+    if ( p_.degree() == 1 ) {
+      multiplicity_ = 1;
+      return;
+    }
+
+    if ( is_exact() ) {
+      compute_multiplicity_exact();
+    }
+    else {
+      compute_multiplicity_interval();
+    }
+  }
+
+  void compute_multiplicity_exact() const
+  {
+    Polynomial q = p_;
+
+    while ( true ) {
+      multiplicity_++;
+      q = tr_.differentiate_object()(q);
+
+      if ( q.is_zero() ) { break; }
+
+      Sign_at  sign_at_q(q);
+      Sign s = ivl.apply_to_endpoint(sign_at_q, Interval::LOWER);
+      if ( s != CGAL::ZERO ) {
+	break;
+      }
+    }
+  }
+
+  void compute_multiplicity_interval() const
+  {
+    bool is_even_multiplicity_ = is_even_multiplicity();
+
+    typename Traits::Differentiate differentiate =
+      tr_.differentiate_object();
+
+    Polynomial q = p_;
+    bool first_time = true;
+    while ( true ) {
+      if ( first_time ) {
+	first_time = false;
+	if ( !is_even_multiplicity_ ) {
+	  multiplicity_++;
+	  q = differentiate(q);
+	}
+	else {
+	  multiplicity_ += 2;
+	  q = differentiate( differentiate(q) );
+	}
+      }
+      else {
+	multiplicity_ += 2;
+	q = differentiate( differentiate(q) );
+      }
+
+      if ( q.degree() <= 0 ) { break; }
+
+      Sign_Sturm_sequence sign_sturm =
+	tr_.sign_Sturm_sequence_object(p_, q);
+
+      int sign = ivl.apply_to_interval(sign_sturm);
+
+      if ( sign != 0 ) { break; }
+    }
+  }
+
+  //===========================================
+  // HELPER METHODS FOR UPDATING THE VALUES
+  // ASSOCIATED WITH THE INTERVAL
+  //===========================================
+
+  void set_lower(const typename Interval::NT& l,
+		 const Sign& s_l) const
+  {
+    ivl.set_lower(l);
+    s_lower = s_l;
+  }
+
+  void set_upper(const typename Interval::NT& u,
+		 const Sign& s_u) const
+  {
+    ivl.set_upper(u);
+    s_upper = s_u;
+  }
+
+  void set_interval(const typename Interval::NT& x) const
+  {
+    ivl.set_lower(x);
+    ivl.set_upper(x);
+    s_lower = s_upper = CGAL::ZERO;
+  }
+
+
+
+  template <class This>
+  Comparison_result
+  compare_finite(const This &r, bool subdiv=true) const {
+    // consider the cases that the root is known exactly;
+    // this is equivalent to saying that the two endpoints for the
+    // interval containing the root are the same;
+    // moreover if the two interval endpoints are not the same we
+    // make sure that the interval endpoints are not roots.
+    // this will make life easier afterwards.
+
+    if ( is_exact() ) {
+      //	std::cout << "first is exact" << std::endl;
+      if ( r.is_exact() ) {
+	//	  std::cout << "second is exact" << std::endl;
+	return CGAL::compare( lower_bound(), r.lower_bound() );
+      }
+      else {
+	if ( upper_bound() <= r.lower_bound() ) {
+	  return CGAL::SMALLER;
+	}
+	else if ( lower_bound() >= r.upper_bound() ) {
+	  return CGAL::LARGER;
+	} else if ( upper_bound() > r.lower_bound() &&
+                    lower_bound() < r.upper_bound() ) {
+	  Sign s_r_lb = r.sign_lower();
+	  {
+	    Sign s_r_ub = r.sign_upper();
+	    CGAL_assertion( s_r_lb != CGAL::ZERO && s_r_ub != CGAL::ZERO );
+	    if(0) s_r_ub= CGAL::ZERO;
+	  }
+
+	  Sign s_at_r = r.sign_at( *this, Interval::LOWER );
+
+	  if ( s_at_r == CGAL::ZERO ) { return CGAL::EQUAL; }
+	  return ( s_at_r == s_r_lb ) ? CGAL::SMALLER : CGAL::LARGER;
+	}
+      }
+    }
+    else if ( r.is_exact() ) {
+
+      // we have already checked the case that this root is also
+      // known exactly
+      //	std::cout << "second is exact" << std::endl;
+      if ( upper_bound() <= r.lower_bound() ) {
+	//	  std::cout << "this.upper bound <= other.lower bound" << std::endl;
+	return CGAL::SMALLER;
+      }
+      else if ( lower_bound() >= r.upper_bound() ) {
+	//	  std::cout << "this.lower bound >= other.upper bound" << std::endl;
+	return CGAL::LARGER;
+      } else if (  upper_bound() > r.lower_bound() &&
+		   lower_bound() < r.upper_bound() ) {
+	//	   std::cout << "other in interval of this" << std::endl;
+	Sign s_ub = sign_upper();
+	{
+	  Sign s_lb = sign_lower();
+	  CGAL_assertion( s_lb != CGAL::ZERO && s_ub != CGAL::ZERO );
+	  if(0) s_lb= CGAL::ZERO;
+	}
+
+	Sign s_at_this = sign_at( r, Interval::LOWER );
+
+	if ( s_at_this == CGAL::ZERO ) { return CGAL::EQUAL; }
+	return ( s_ub == s_at_this ) ? CGAL::SMALLER : CGAL::LARGER;
+      }
+    }
+    else {
+      // now the roots are in the interior of interval
+      // check if the interiors of the intervals are disjoint
+      //	std::cout << "both not exact" << std::endl;
+      //	int prec = std::cout.precision();
+      //	std::cout.precision(16);
+      //	std::cout << "this:  " << lower_bound() << " " << upper_bound()
+      //		  << std::endl;
+      //	std::cout << "other: " << r.lower_bound() << " "
+      //		  << r.upper_bound() << std::endl;
+      //	std::cout.precision(prec);
+
+      if ( upper_bound() <= r.lower_bound() ) {
+	//	  std::cout << "this.upper bound <= other.lower bound" << std::endl;
+	return CGAL::SMALLER;
+      }
+      else if ( lower_bound() >= r.upper_bound() ) {
+	//	  std::cout << "this.lower bound >= other.upper bound" << std::endl;
+	return CGAL::LARGER;
+      } else {
+	if (subdiv) {
+	  int count=0;
+	  while ( upper_bound() > r.lower_bound() &&
+		  lower_bound() < r.upper_bound() ) {
+	    subdivide();
+	    ++count;
+	    if (count==4) break;
+	    //	  std::cout << "intersecting intervals" << std::endl;
+	  }
+	  return compare_finite(r, false);
+	} else {
+	  return compare_intersecting(r);
+	}
+      }
+    }
+
+    bool this_line_should_not_have_been_reached = false;
+    CGAL_assertion( this_line_should_not_have_been_reached );
+    if (0) this_line_should_not_have_been_reached= false;
+    return CGAL::EQUAL;
+  }
+  
+
+  //===========================================
+  // HELPER METHODS FOR COMPARISON OPERATORS
+  //===========================================
+  template<class This>
+  Comparison_result compare(const This& r) const
+  {
+    // check against positive and negative infinity
+    if (idx == -2) {
+      if ( r.idx == -2 ) { return CGAL::EQUAL; }
+      return CGAL::SMALLER;
+    }
+    if (idx == -1) {
+      if ( r.idx == -1 ) { return CGAL::EQUAL; }
+      return CGAL::LARGER;
+    }
+    if (r.idx == -2) {
+      // I have already checked if both are negative infinity
+      return CGAL::LARGER;
+    }
+    if (r.idx == -1) {
+      // I have already checked if both are positive infinity
+      return CGAL::SMALLER;
+    }
+    return compare_finite(r);
+  }
+
+  
+  //--------------------------------------------------------------
+
+
+  template<class This>
+  Comparison_result
+  compare_intersecting(const This& r) const
+  {
+    // in this method we know that the intervals are not
+    // trivial, are intersecting and that the endpoints are not
+    // roots
+
+    // Case 1: the intervals have common left endpoint
+    if ( lower_bound() == r.lower_bound() ) {
+      if ( upper_bound() > r.upper_bound() ) {
+	Sign s = sign_at( r, Interval::UPPER );
+
+	if ( s == CGAL::ZERO ) {
+	  // the root of this is equal to the upper bound of r
+	  //	    set_interval( r, Interval::UPPER );
+	  set_interval( r.upper_bound() );
+	  return CGAL::LARGER;
+	}
+	else {
+	  if ( s == sign_lower() ) {
+	    return CGAL::LARGER;
+	  }
+	  else {
+	    //	      set_upper( r, Interval::UPPER, s );
+	    set_upper( r.upper_bound(), s );
+	    return compare_same_interval(r);
+	  }
+	}
+      }
+      else if ( r.upper_bound() > upper_bound() ) {
+	const This* new_this = static_cast<const This*>(this);
+	return opposite(r.compare_intersecting( *new_this ));
+      }
+      else if ( upper_bound() == r.upper_bound() ) {
+	return compare_same_interval(r);
+      }
+    }
+
+    // Case 2: the intervals have common right endpoint
+    if ( upper_bound() == r.upper_bound() ) {
+      if ( lower_bound() < r.lower_bound() ) {
+	Sign s = sign_at( r, Interval::LOWER );
+	if ( s == CGAL::ZERO ) {
+	  // the root of this is equal to the lower bound of r
+	  //	    set_interval( r, Interval::LOWER );
+	  set_interval( r.lower_bound() );
+	  return CGAL::SMALLER;
+	}
+	else {
+	  if ( s == sign_upper() ) {
+	    return CGAL::SMALLER;
+	  }
+	  else {
+	    //	      set_lower( r, Interval::LOWER, s );
+	    set_lower( r.lower_bound(), s );
+	    return compare_same_interval(r);
+	  }
+	}
+      }
+      else if ( r.lower_bound() < lower_bound() ) {
+	const This* new_this = static_cast<const This*>(this);
+	return opposite(r.compare_intersecting( *new_this ));
+      }
+      else if ( lower_bound() == r.lower_bound() ) {
+	return compare_same_interval(r);
+      }
+    }
+
+    // Case 3: the upper bound of r is an interior point of the
+    //         interval of this and the lower bound of r is before
+    //         the lower bound of this
+    if ( lower_bound() > r.lower_bound() &&
+	 upper_bound() > r.upper_bound() ) {
+
+      Sign s_this_at_r = r.sign_at( *this, Interval::LOWER );
+      if ( s_this_at_r == CGAL::ZERO ) {
+	//	  r.set_interval( *this, Interval::LOWER );
+	r.set_interval( lower_bound() );
+	return CGAL::LARGER;
+      }
+
+      Sign s_r_at_this = sign_at( r, Interval::UPPER );
+      if ( s_r_at_this == CGAL::ZERO ) {
+	//	  set_interval( r, Interval::UPPER );
+	set_interval( r.upper_bound() );
+	return CGAL::SMALLER;
+      }
+
+      if ( s_r_at_this != CGAL::ZERO && s_this_at_r != CGAL::ZERO ) {
+
+	if ( s_this_at_r != r.sign_lower() ) {
+	  //	    r.set_upper( *this, Interval::LOWER, s_this_at_r );
+	  r.set_upper( lower_bound(), s_this_at_r );
+	  return CGAL::LARGER;
+	}
+
+	if ( s_r_at_this != sign_upper() ) {
+	  //	    set_lower( r, Interval::UPPER, s_r_at_this );
+	  set_lower( r.upper_bound(), s_r_at_this );
+	  return CGAL::LARGER;
+	}
+
+	//	  set_upper( r, Interval::UPPER, s_r_at_this );
+	//	  r.set_lower( *this, Interval::LOWER, s_this_at_r );
+	set_upper( r.upper_bound(), s_r_at_this );
+	r.set_lower( lower_bound(), s_this_at_r );
+
+	return compare_same_interval(r);
+      }
+    }
+
+    // Case 4: the upper bound of this is an interior point of the
+    //         interval of r and the lower bound of this is before
+    //         the lower bound of r
+    if ( lower_bound() < r.lower_bound() &&
+	 upper_bound() < r.upper_bound() ) {
+      const This* new_this = static_cast<const This*>(this);
+      return opposite(r.compare_intersecting( *new_this ));
+    }
+
+    // Case 5: the interval of r is contained in the interval of
+    //         this
+    if ( lower_bound() < r.lower_bound() &&
+	 upper_bound() > r.upper_bound() ) {
+
+      Sign s_rl_at_this = sign_at( r, Interval::LOWER );
+      if ( s_rl_at_this == CGAL::ZERO ) {
+	//	  set_interval( r, Interval::LOWER );
+	set_interval( r.lower_bound() );
+	return CGAL::SMALLER;
+      }
+
+      Sign s_ru_at_this = sign_at( r, Interval::UPPER );
+      if ( s_ru_at_this == CGAL::ZERO ) {
+	//	  set_interval( r, Interval::UPPER );
+	set_interval( r.upper_bound() );
+	return CGAL::LARGER;
+      }
+
+      Sign s_l = sign_lower();
+      if ( s_l != s_rl_at_this ) {
+	//	  set_upper( r, Interval::LOWER, s_rl_at_this );
+	set_upper( r.lower_bound(), s_rl_at_this );
+	return CGAL::SMALLER;
+      }
+
+      Sign s_u = sign_upper();
+      if ( s_u != s_ru_at_this ) {
+	//	  set_lower( r, Interval::UPPER, s_ru_at_this );
+	set_lower( r.upper_bound(), s_ru_at_this );
+	return CGAL::LARGER;
+      }
+
+      if ( s_rl_at_this != CGAL::ZERO &&
+	   s_ru_at_this != CGAL::ZERO   ) {
+	//	  set_lower( r, Interval::LOWER, s_rl_at_this );
+	//	  set_upper( r, Interval::UPPER, s_ru_at_this );
+	set_lower( r.lower_bound(), s_rl_at_this );
+	set_upper( r.upper_bound(), s_ru_at_this );
+
+	return compare_same_interval(r);
+      }
+    }
+
+    // Case 6: the interval of this is contained in
+    //         the interval of r
+    if ( lower_bound() > r.lower_bound() &&
+	 upper_bound() < r.upper_bound() ) {
+      const This* new_this = static_cast<const This*>(this);
+      return opposite(r.compare_intersecting( *new_this ));
+    }
+
+    CGAL_postcondition_msg(0, "This line should not have been reached.\n");
+    //bool this_line_should_not_have_been_reached = false;
+    //CGAL_assertion( this_line_should_not_have_been_reached );
+
+    return CGAL::EQUAL;
+  }                                         // end-compare_intersecting
+
+  //--------------------------------------------------------------
+  void subdivide() const
+  {
+    if (!refined_) {
+      refined_=true;
+      //std::cout << "Refining " << *this << " " << std::endl;
+    }
+
+
+    Interval_pair ivl_pair = ivl.split();
+    Interval first_half  = ivl_pair.first;
+    Interval second_half = ivl_pair.second;
+
+    Sign_at_functor sign_at_f(this);
+
+    Sign s_mid =
+      first_half.apply_to_endpoint( sign_at_f, Interval::UPPER );
+
+    if ( s_mid == CGAL::ZERO ) {
+      ivl = first_half.endpoint_interval( Interval::UPPER );
+      return;
+    }
+
+    if ( s_mid == sign_upper() ) {
+      ivl = first_half;
+    }
+    else {
+      ivl = second_half;
+    }
+  }
+
+  
+
+  template<class Child>
+  Polynomial compute_simple(Field_tag, const Child&) const
+  {
+    Polynomial gcd = sseq.exact( sseq.exact_size() - 1 );
+    return p_ / gcd;
+  }
+
+  /*Polynomial compute_simple(Integral_domain_without_division_tag, const Self&) const
+    {
+    Polynomial gcd = sseq[sseq.size() - 1];
+    return tr_.pseudo_quotient_object()(p_, gcd);
+    }*/
+  
+  Polynomial compute_simple(Field_tag, const Self&) const
+  {
+    Polynomial gcd = sseq[sseq.size() - 1];
+    return tr_.quotient_object()(p_, gcd);
+  }
+
+  template<class This>
+  Comparison_result
+  //    compare_same_interval(const Self& r) const
+  compare_same_interval(const This& r) const
+  {
+    CGAL_precondition( lower_bound() == r.lower_bound() );
+    CGAL_precondition( upper_bound() == r.upper_bound() );
+
+    // here I have to do some subdivisions...
+
+    Method_tag mtag;
+    Sign_Sturm_sequence seq
+      = tr_.sign_Sturm_sequence_object(r.compute_simple(mtag, r),
+				       compute_simple(mtag, r) );
+
+    int sign_of_r_at_this;
+
+    sign_of_r_at_this =
+      seq.sum_of_signs(lower_bound(), upper_bound());
+
+    if ( sign_of_r_at_this == 0 ) { return CGAL::EQUAL; }
+
+    Sign s_r;
+    if ( sign_of_r_at_this < 0 ) {
+      s_r = CGAL::NEGATIVE;
+    }
+    else {
+      s_r = CGAL::POSITIVE;
+    }
+
+    Sign s_l = sign_lower();
+
+    return ( s_r != s_l ) ? CGAL::SMALLER : CGAL::LARGER;
+  }
+
+  //===================
+  // SIGNS EVALUATORS
+  //===================
+  Sign sign_lower() const
+  {
+    return s_lower;
+  }
+
+  Sign sign_upper() const
+  {
+    return s_upper;
+  }
+
+  template<class This>
+  Sign sign_at(const This& r, typename Interval::Endpoint b) const
+  {
+    Sign_at_functor sign_at_f(this);
+
+    return r.ivl.apply_to_endpoint(sign_at_f, b);
+  }
+
+public:
+  //==================================
+  // POSITIVE AND NEGATIVE INFINITY
+  //==================================
+  static Self infinity(const Traits& tr = Traits()) {
+    return Self(-1, 0, tr);
+  }
+
+  //================
+  // CONSTRUCTORS
+  //================
+protected:
+  Sturm_root_rep(int i, int, const Traits& tr)
+    : idx(i), ivl(), p_(), sseq(), s_lower(CGAL::ZERO),
+      s_upper(CGAL::ZERO), multiplicity_(0), tr_(tr), refined_(false)  {}
+
+public:
+  Sturm_root_rep(const Traits& tr = Traits())
+    : idx(-1), ivl(), p_(), sseq(), s_lower(CGAL::ZERO),
+      s_upper(CGAL::ZERO), multiplicity_(0), tr_(tr), refined_(false)  {}
+  //-------
+  template<class T>
+  Sturm_root_rep(const T& a, const Traits& tr = Traits())
+    : idx(1), ivl(a), p_(), sseq(), s_lower(CGAL::ZERO),
+      s_upper(CGAL::ZERO), multiplicity_(0), tr_(tr), refined_(false)  {}
+  //-------
+  Sturm_root_rep(const Interval& ivl,
+		 const Polynomial& p,
+		 const Standard_sequence& sseq, int idx,
+		 const Traits& tr)
+    : idx(idx), ivl(ivl), p_(p), sseq(sseq),
+      s_lower(CGAL::ZERO), s_upper(CGAL::ZERO), multiplicity_(0),
+      tr_(tr), refined_(false) {
+    //++sturm_created__;
+    Sign_at_functor sign_at_p(this);
+    s_lower = apply(sign_at_p, ivl.lower_bound());
+    s_upper = apply(sign_at_p, ivl.upper_bound());
+
+    //      s_lower = sign_at( *this, Interval::LOWER );
+    //      s_upper = sign_at( *this, Interval::UPPER );
+  }
+  //-------
+  Sturm_root_rep(const Self& other)
+    : idx(other.idx), ivl(), p_(other.p_), sseq(other.sseq),
+      s_lower(other.s_lower),   s_upper(other.s_upper),
+      multiplicity_(other.multiplicity_), tr_(other.tr_), refined_(other.refined_){
+    if ( other.idx >= 1 ) {
+      ivl = other.ivl;
+    }
+  }
+
+  //=======================
+  // ASSIGNMENT OPERATOR
+  //=======================
+  const Self& operator=(const Self& other) {
+    if ( &other == this ) { return *this; }
+    idx = other.idx;
+    p_ = other.p_;
+    sseq = other.sseq;
+    s_lower = other.s_lower;
+    s_upper = other.s_upper;
+    multiplicity_ = other.multiplicity_;
+    tr_ = other.tr_;
+
+    if ( idx >= 1 ) {
+      ivl = other.ivl;
+    }
+    return *this;
+  }
+
+  //=========================
+  // COMPARISON OPERATORS
+  //=========================
+  bool operator!=(const Self& r) const
+  {
+    return compare(r) != CGAL::EQUAL;
+  }
+
+  bool operator==(const Self& r) const
+  {
+    return compare(r) == CGAL::EQUAL;
+  }
+
+  bool operator<=(const Self& r) const
+  {
+    return compare(r) != CGAL::LARGER;
+  }
+
+  bool operator>=(const Self& r) const
+  {
+    return compare(r) != CGAL::SMALLER;
+  }
+
+  bool operator>(const Self& r) const
+  {
+    return compare(r) == CGAL::LARGER;
+  }
+
+  bool operator<(const Self& r) const
+  {
+    return compare(r) == CGAL::SMALLER;
+  }
+
+  Self operator-() const
+  {
+    if ( idx == -1 ) {
+      return Self(-2, 0, tr_);
+    }
+    else if ( idx == -2 ) {
+      return Self(-1,0, tr_);
+    }
+    else if (idx == 1) {
+      // HACK by Daniel
+      return Self(-ivl, tr_);
+    }
+    else {
+
+      Interval m_ivl = -ivl;
+      Polynomial m_p = tr_.negate_variable_object()(p_);
+      Standard_sequence m_sseq= tr_.standard_sequence_object(m_p);
+
+      Self m_root(m_ivl, m_p, m_sseq, idx, tr_);
+
+      m_root.multiplicity_ = multiplicity_;
+
+      return m_root;
+    }
+  }
+
+  //===========================
+  // THE MULTIPLICITY METHOD
+  //===========================
+  unsigned int multiplicity() const
+  {
+    if ( idx < 0 ) { return 0; }
+    if ( multiplicity_ == 0 ) {
+      compute_multiplicity();
+    }last_zero_=false;
+    if (multiplicity_%2==0) return multiplicity_/2;
+    else return multiplicity_;
+  }
+
+  //====================
+  // THE PARITY METHOD
+  //====================
+  bool is_even_multiplicity() const
+  {
+    return false;
+    /*if ( idx < 0 ) { return false; }
+
+    if ( is_exact() ) {
+      return (multiplicity() % 2 == 0);
+    }
+    else {
+      Sign_at_functor sign_at_f(this);
+
+      Sign sl = apply(sign_at_f, ivl.lower_bound());
+      Sign su = apply(sign_at_f, ivl.upper_bound());
+      return (sl == su);
+      }*/
+  }
+
+  //==========================
+  // ACCESS TO THE INTERVAL
+  //==========================
+  typename Interval::NT lower_bound() const { 
+    CGAL_precondition(idx >= 0);
+    return ivl.lower_bound(); }
+  typename Interval::NT upper_bound() const { 
+    CGAL_precondition(idx >= 0);
+    return ivl.upper_bound(); }
+  Interval    interval()    const { return ivl; }
+  int         index()       const { return idx; }
+  const Polynomial&     polynomial() const { return p_; }
+  //    Polynomial  simple_polynomial() const { return p; }
+
+public:
+  //======================
+  // CONVERTOR TO double
+  //======================
+  double compute_double(double acc = 1e-10) const
+  {
+    if (idx < 0) {
+      double inf=std::numeric_limits<double>::has_infinity? std::numeric_limits<double>::infinity() : (std::numeric_limits<double>::max)();
+      if ( idx == -1 ){
+	return inf;
+      } else return -inf;
+    }
+    /*if ( idx == -2 ) {
+      return -DBL_MAX * DBL_MAX;
+      }*/
+
+    if ( is_exact() ) {
+      return CGAL_POLYNOMIAL_TO_DOUBLE(lower_bound());
+    }
+
+    Exact_nt xacc(acc);
+
+
+    while ( ivl.approximate_width() > acc ) {
+      subdivide();
+      /*if (!refined_) {
+	++sturm_refined__;
+	refined_=true;
+	std::cout << "Refining " << *this << " to compute double " << std::endl;
+	}*/
+      if ( is_exact() ) { break; }
+    }
+
+    return CGAL_POLYNOMIAL_TO_DOUBLE( lower_bound() );
+  }
+
+  const std::pair<NT, NT>& isolating_interval() const {
+    CGAL_precondition(idx >=0);
+    return ivl.to_pair();
+  }
+
+  //========================
+  // CONVERTOR TO interval
+  //========================
+  std::pair<double,double> compute_interval() const
+  {
+    if (*this == infinity()){ 
+      return std::make_pair(std::numeric_limits<double>::infinity(),
+			    std::numeric_limits<double>::infinity());
+    }
+    else if (*this == -infinity()) {
+      return std::make_pair(-std::numeric_limits<double>::infinity(),
+			    -std::numeric_limits<double>::infinity());
+    } else {
+      compute_double();
+	    
+      std::pair<double,double> i_low =
+	CGAL_POLYNOMIAL_TO_INTERVAL(ivl.lower_bound());
+      std::pair<double,double> i_high =
+	CGAL_POLYNOMIAL_TO_INTERVAL(ivl.upper_bound());
+	    
+      return std::pair<double,double>(i_low.first, i_high.second);
+    }
+  }
+
+  //================
+  // STREAM WRITER
+  //================
+  template<class Stream>
+  Stream& write(Stream& os) const
+  {
+    if ( idx == -2 ) {
+      os << "-inf";
+    }
+    else if ( idx == -1 ) {
+      os << "inf";
+    }
+    else {
+      os << "{" << ivl << ", " << idx << "}";
+    }
+    if (idx != -2 && idx != -1) {
+      Self copy = *this;
+      os << " = " << copy.compute_double();
+    }
+    return os;
+  }
+
+protected:
+  bool is_up_;
+  int  
+  int                    idx;
+  mutable Interval       ivl;
+  Polynomial             p_;
+  Standard_sequence      sseq;
+  mutable Sign           s_lower, s_upper;
+  mutable unsigned int   multiplicity_;
+  Traits                 tr_;
+  mutable bool refined_;
+};
+
+template<class Stream, class S, class I>
+Stream&
+operator<<(Stream& os, const Sturm_root_rep<S,I>& r)
+{
+  return r.write(os);
+}
+
+/*template<class S, class I>
+  std::pair<double,double>
+  to_interval(const Sturm_root_rep<S,I>& r)
+  {
+  return r.compute_interval();
+  }*/
+
+} } } //namespace CGAL::POLYNOMIAL::internal
+
+namespace CGAL {
+
+/*template<class S, class I>
+  double
+  to_double(const CGAL_POLYNOMIAL_NS::internal::Sturm_root_rep<S,I>& r)
+  {
+  return r.compute_double();
+  }
+
+
+  template<class S, class I>
+  std::pair<double,double>
+  to_interval(const CGAL_POLYNOMIAL_NS::internal::Sturm_root_rep<S,I>& r)
+  {
+  return r.compute_interval();
+  }*/
+
+
+template <class T, class I>
+class Real_embeddable_traits< CGAL::POLYNOMIAL::internal::Sturm_root_rep<T,I> > 
+  : public INTERN_RET::Real_embeddable_traits_base< CGAL::POLYNOMIAL::internal::Sturm_root_rep<T,I> , Tag_true > {
+public:
+  typedef CGAL::POLYNOMIAL::internal::Sturm_root_rep<T,I>  Type;
+  class Abs 
+    : public std::unary_function< Type, Type > {
+  public:
+    Type operator()( const Type& x ) const {
+      if (x < Type(0)) return -x;
+      else return x;
+    }
+  };
+    
+  class Sgn 
+    : public std::unary_function< Type, ::CGAL::Sign > {
+  public:
+    ::CGAL::Sign operator()( const Type& x ) const {
+      return static_cast<CGAL::Sign>(x.compare(0));
+    }        
+  };
+    
+  class Compare 
+    : public std::binary_function< Type, Type,
+			      Comparison_result > {
+  public:
+    Comparison_result operator()( const Type& x, 
+				  const Type& y ) const {
+      return x.compare(y);
+    }
+        
+    CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT( Type,
+							 Comparison_result )
+        
+      };
+    
+  class To_double 
+    : public std::unary_function< Type, double > {
+  public:
+    double operator()( const Type& x ) const {
+      // this call is required to get reasonable values for the double
+      // approximation
+      return x.compute_double();
+    }
+  };
+    
+  class To_interval 
+    : public std::unary_function< Type, std::pair< double, double > > {
+  public:
+    std::pair<double, double> operator()( const Type& x ) const {
+
+      return x.compute_interval();
+    }          
+  };
+};
+
+
+} //namespace CGAL
+
+namespace std
+{
+  template <class S, class I>
+  class numeric_limits<CGAL_POLYNOMIAL_NS::internal::Sturm_root_rep<S,I> >:
+    public numeric_limits<typename CGAL_POLYNOMIAL_NS::internal::Sturm_root_rep<S,I>::NT >
+  {
+  public:
+    typedef numeric_limits<typename CGAL_POLYNOMIAL_NS::internal::Sturm_root_rep<S,I>::NT > P;
+    typedef CGAL_POLYNOMIAL_NS::internal::Sturm_root_rep<S,I> T;
+    static const bool is_specialized = true;
+    static T min BOOST_PREVENT_MACRO_SUBSTITUTION () throw() {return T((P::min)());}
+    static T max BOOST_PREVENT_MACRO_SUBSTITUTION () throw() {return T((P::max)());}
+    /*static const int digits =0;
+      static const int digits10 =0;
+      static const bool is_signed = true;
+      static const bool is_integer = false;
+      static const bool is_exact = true;
+      static const int radix =0;
+      static T epsilon() throw(){return T(0);}
+      static T round_error() throw(){return T(0);}
+      static const int min_exponent=0;
+      static const int min_exponent10=0;
+      static const int max_exponent=0;
+      static const int max_exponent10=0;*/
+    static const bool has_infinity=true;
+    /*static const bool has_quiet_NaN = false;
+      static const bool has_signaling_NaN= false;
+      static const float_denorm_style has_denorm= denorm_absent;
+      static const bool has_denorm_loss = false;
+    */
+    static T infinity() throw() {return T::infinity();}
+    /*static T quiet_NaN() throw(){return T(0);}
+      static T denorm_min() throw() {return T(0);}
+      static const bool is_iec559=false;
+      static const bool is_bounded =false;
+      static const bool is_modulo= false;
+      static const bool traps = false;
+      static const bool tinyness_before =false;
+      static const float_round_style round_stype = round_toward_zero;*/
+  };
+};
+#endif                                            // CGAL_POLYNOMIAL_STURM_ROOT_REP_H
diff --git a/3rdparty/CGAL/include/CGAL/Polynomial/internal/Turkowski_numeric_solvers_impl.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Turkowski_numeric_solvers_impl.h
new file mode 100644
index 0000000..0bdabdf
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polynomial/internal/Turkowski_numeric_solvers_impl.h
@@ -0,0 +1,467 @@
+// Copyright (c) 2005  Stanford University (USA).
+// 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(s)     : Daniel Russel <drussel at alumni.princeton.edu>
+
+#ifdef CGAL_HEADER_ONLY
+#define CGAL_INLINE_FUNCTION inline
+#else
+#define CGAL_INLINE_FUNCTION
+#endif
+
+#include <CGAL/Polynomial/internal/numeric_solvers_support.h>
+#include <CGAL/Polynomial/internal/numeric_solvers.h>
+
+/*#ifdef _MSC_VER
+#pragma warning(disable:1572)
+#endif*/
+
+
+//#include "numeric_solvers_support.C"
+
+// Taken from http://www.worldserver.com/turk/opensource/
+
+/* Copyright (C) 1978-1999 Ken Turkowski. <turk_at_computer.org>
+ *
+ * All rights reserved.
+ *
+ * Warranty Information
+ *  Even though I have reviewed this software, I make no warranty
+ *  or representation, either express or implied, with respect to this
+ *  software, its quality, accuracy, merchantability, or fitness for a
+ *  particular purpose.  As a result, this software is provided "as is,"
+ *  and you, its user, are assuming the entire risk as to its quality
+ *  and accuracy.
+ *
+ * This code may be used and freely distributed as long as it includes
+ * this copyright notice and the above warranty information.
+ */
+
+#include <cmath>
+#include <iomanip>
+
+namespace CGAL { namespace POLYNOMIAL { namespace internal {
+
+# define FLOAT double
+
+static const unsigned int MAXN= 55;
+//# define PARAMFLOAT double_t
+
+/*******************************************************************************
+ * FindCubicRoots
+ *
+ *	Solve:
+ *		coeff[3] * x^3 + coeff[2] * x^2 + coeff[1] * x + coeff[0] = 0
+ *
+ *	returns:
+ *		3 - 3 real roots
+ *		1 - 1 real root (2 complex conjugate)
+ *******************************************************************************/
+
+static long
+FindCubicRoots(const FLOAT coeff[4], FLOAT x[3])
+{
+  FLOAT a1 = coeff[2] / coeff[3];
+  FLOAT a2 = coeff[1] / coeff[3];
+  FLOAT a3 = coeff[0] / coeff[3];
+
+  double Q = (a1 * a1 - 3 * a2) / 9;
+  double R = (2 * a1 * a1 * a1 - 9 * a1 * a2 + 27 * a3) / 54;
+  double Qcubed = Q * Q * Q;
+  double d = Qcubed - R * R;
+
+  /* Three real roots */
+  if (d >= 0) {
+    double theta = std::acos(R / std::sqrt(Qcubed));
+    double sqrtQ = std::sqrt(Q);
+    x[0] = -2 * sqrtQ * std::cos( theta           / 3) - a1 / 3;
+    x[1] = -2 * sqrtQ * std::cos((theta + 2 * CGAL_PI) / 3) - a1 / 3;
+    x[2] = -2 * sqrtQ * std::cos((theta + 4 * CGAL_PI) / 3) - a1 / 3;
+    return (3);
+  }
+
+  /* One real root */
+  else {
+    double e = std::pow(std::sqrt(-d) + ::CGAL::abs(R), 1. / 3.);
+    if (R > 0)
+      e = -e;
+    x[0] = (e + Q / e) - a1 / 3.;
+    return (1);
+  }
+}
+
+
+/*******************************************************************************
+ * FindPolynomialRoots
+ *
+ * The Bairstow and Newton correction formulae are used for a simultaneous
+ * linear and quadratic iterated synthetic division.  The coefficients of
+ * a polynomial of degree n are given as a[i] (i=0,i,..., n) where a[0] is
+ * the constant term.  The coefficients are scaled by dividing them by
+ * their geometric mean.  The Bairstow or Newton iteration method will
+ * nearly always converge to the number of figures carried, fig, either to
+ * root values or to their reciprocals.  If the simultaneous Newton and
+ * Bairstow iteration fails to converge on root values or their
+ * reciprocals in maxiter iterations, the convergence requirement will be
+ * successively reduced by one decimal figure.  This program anticipates
+ * and protects against loss of significance in the quadratic synthetic
+ * division.  (Refer to "On Programming the Numerical Solution of
+ * Polynomial Equations," by K. W. Ellenberger, Commun. ACM 3 (Dec. 1960),
+ * 644-647.)  The real and imaginary part of each root is stated as u[i]
+ * and v[i], respectively, together with the corresponding constant,
+ * conv[i], used in the convergence test.  This program has been used
+ * successfully for over a year on the Bendix G15-D (Intercard System) and
+ * has recently been coded for the IBM 709 (Fortran system).
+ *
+ * ACM algorithm #30 - Numerical Solution of the Polynomial Equation
+ * K. W. Ellenberger
+ * Missle Division, North American Aviation, Downey, California
+ * Converted to C, modified, optimized, and structured by
+ * Ken Turkowski
+ * CADLINC, Inc., Palo Alto, California
+ *******************************************************************************/
+
+static void
+FindPolynomialRoots(
+		    const FLOAT     *a,                               /* Coefficients */
+		    FLOAT           *u,                               /* Real component of each root */
+		    FLOAT           *v,                               /* Imaginary component of each root */
+		    FLOAT           *conv,                            /* Convergence constant associated with each root */
+		    long            n,                                /* Degree of polynomial (order-1) */
+		    long            maxiter,                          /* Maximum number of iterations */
+		    long            fig                               /* The number of decimal figures to be computed */
+		    )
+{
+  int number_of_ITERATE=0;
+  int number_of_INIT=0;
+  CGAL_precondition(static_cast<unsigned int>(fig) < MAXN);
+  long i;
+  long j;
+  FLOAT h[MAXN + 3], b[MAXN + 3], c[MAXN + 3], d[MAXN + 3], e[MAXN + 3];
+  /* [-2 : n] */
+  FLOAT K, ps, qs, pt, qt, s, rev, r= std::numeric_limits<double>::infinity();
+  int t;
+  FLOAT p=std::numeric_limits<double>::infinity(), q=std::numeric_limits<double>::infinity();
+
+  /* Zero elements with negative indices */
+  b[2 + -1] = b[2 + -2] =
+    c[2 + -1] = c[2 + -2] =
+    d[2 + -1] = d[2 + -2] =
+    e[2 + -1] = e[2 + -2] =
+    h[2 + -1] = h[2 + -2] = 0.0;
+
+  /* Copy polynomial coefficients to working storage */
+  for (j = n; j >= 0; j--)
+    h[2 + j] = *a++;                          /* Note reversal of coefficients */
+
+  t = 1;
+  K = std::pow(10.0, (double)(fig));            /* Relative accuracy */
+
+  for (; h[2 + n] == 0.0; n--) {                /* Look for zero high-order coeff. */
+    *u++ = 0.0;
+    *v++ = 0.0;
+    *conv++ = K;
+  }
+
+ INIT:
+  ++number_of_INIT;
+  if (number_of_INIT > 1000) {
+    std::cerr << "Too many INITs" << std::flush;
+    return;
+  }
+
+  if (n == 0)
+    return;
+
+  ps = qs = pt = qt = s = 0.0;
+  rev = 1.0;
+  K = std::pow(10.0, (double)(fig));
+
+  if (n == 1) {
+    r = -h[2 + 1] / h[2 + 0];
+    goto LINEAR;
+  }
+
+  for (j = n; j >= 0; j--)                      /* Find geometric mean of coeff's */
+    if (h[2 + j] != 0.0)
+      s += std::log( ::CGAL::abs(h[2 + j]));
+  s = std::exp(s / double(n + 1));
+
+  for (j = n; j >= 0; j--)                      /* Normalize coeff's by mean */
+    h[2 + j] /= s;
+
+  if ( ::CGAL::abs(h[2 + 1] / h[2 + 0]) < ::CGAL::abs(h[2 + n - 1] / h[2 + n])) {
+  REVERSE:
+    t = -t;
+    for (j = (n - 1) / 2; j >= 0; j--) {
+      s = h[2 + j];
+      h[2 + j] = h[2 + n - j];
+      h[2 + n - j] = s;
+    }
+  }
+  if (qs != 0.0) {
+    p = ps;
+    q = qs;
+  }
+  else {
+    if (h[2 + n - 2] == 0.0) {
+      q = 1.0;
+      p = -2.0;
+    }
+    else {
+      q = h[2 + n] / h[2 + n - 2];
+      p = (h[2 + n - 1] - q * h[2 + n - 3]) / h[2 + n - 2];
+    }
+    if (n == 2)
+      goto QADRTIC;
+    r = 0.0;
+  }
+ ITERATE:
+  ++number_of_ITERATE;
+  if (number_of_ITERATE > 1000) {
+    std::cerr << "Too many ITERATEs" << std::flush;
+    return;
+  }
+  for (i = maxiter; i > 0; i--) {
+
+    for (j = 0; j <= n; j++) {                /* BAIRSTOW */
+      b[2 + j] = h[2 + j] - p * b[2 + j - 1] - q * b[2 + j - 2];
+      c[2 + j] = b[2 + j] - p * c[2 + j - 1] - q * c[2 + j - 2];
+    }
+    if ((h[2 + n - 1] != 0.0) && (b[2 + n - 1] != 0.0)) {
+      if ( ::CGAL::abs(h[2 + n - 1] / b[2 + n - 1]) >= K) {
+	b[2 + n] = h[2 + n] - q * b[2 + n - 2];
+      }
+      if (b[2 + n] == 0.0)
+	goto QADRTIC;
+      if (K < ::CGAL::abs(h[2 + n] / b[2 + n]))
+	goto QADRTIC;
+    }
+
+    for (j = 0; j <= n; j++) {                /* NEWTON */
+      /* Calculate polynomial at r */
+      d[2 + j] = h[2 + j] + r * d[2 + j - 1];
+      /* Calculate derivative at r */
+      e[2 + j] = d[2 + j] + r * e[2 + j - 1];
+    }
+    if (d[2 + n] == 0.0)
+      goto LINEAR;
+    if (K < ::CGAL::abs(h[2 + n] / d[2 + n]))
+      goto LINEAR;
+
+    c[2 + n - 1] = -p * c[2 + n - 2] - q * c[2 + n - 3];
+    s = c[2 + n - 2] * c[2 + n - 2] - c[2 + n - 1] * c[2 + n - 3];
+    if (s == 0.0) {
+      p -= 2.0;
+      q *= (q + 1.0);
+    }
+    else {
+      p += (b[2 + n - 1] * c[2 + n - 2] - b[2 + n] * c[2 + n - 3]) / s;
+      q += (-b[2 + n - 1] * c[2 + n - 1] + b[2 + n] * c[2 + n - 2]) / s;
+    }
+    if (e[2 + n - 1] == 0.0)
+      r -= 1.0;                             /* Minimum step */
+    else
+      r -= d[2 + n] / e[2 + n - 1];         /* Newton's iteration */
+  }
+  ps = pt;
+  qs = qt;
+  pt = p;
+  qt = q;
+  if (rev < 0.0)
+    K /= 10.0;
+  rev = -rev;
+  goto REVERSE;
+
+ LINEAR:
+  if (t < 0)
+    r = 1.0 / r;
+  n--;
+  *u++ = r;
+  *v++ = 0.0;
+  *conv++ = K;
+
+  for (j = n; j >= 0; j--) {                    /* Polynomial deflation by lin-nomial */
+    if ((d[2 + j] != 0.0) && ( ::CGAL::abs(h[2 + j] / d[2 + j]) < K))
+      h[2 + j] = d[2 + j];
+    else
+      h[2 + j] = 0.0;
+  }
+
+  if (n == 0)
+    return;
+  goto ITERATE;
+
+ QADRTIC:
+  if (t < 0) {
+    p /= q;
+    q = 1.0 / q;
+  }
+  n -= 2;
+
+  if (0.0 < (q - (p * p / 4.0))) {              /* Two complex roots */
+    *(u + 1) = *u = -p / 2.0;
+    u += 2;
+    s = sqrt(q - (p * p / 4.0));
+    *v++ = s;
+    *v++ = -s;
+  }                                             /* Two real roots */
+  else {
+    s = std::sqrt(((p * p / 4.0)) - q);
+    if (p < 0.0)
+      *u++ = -p / 2.0 + s;
+    else
+      *u++ = -p / 2.0 - s;
+    *u = q / u[-1];
+    ++u;                                      // moved from lhs of before
+    *v++ = 0.0;
+    *v++ = 0.0;
+  }
+  *conv++ = K;
+  *conv++ = K;
+
+  for (j = n; j >= 0; j--) {                    /* Polynomial deflation by quadratic */
+    if ((b[2 + j] != 0.0) && ( ::CGAL::abs(h[2 + j] / b[2 + j]) < K))
+      h[2 + j] = b[2 + j];
+    else
+      h[2 + j] = 0.0;
+  }
+  goto INIT;
+}
+
+
+#undef MAXN
+
+template <bool CLEAN>
+static void Turkowski_polynomial_compute_roots_t(const double *begin, 
+						 const double *end,
+						 double lb, double ub,
+						 std::vector<double> &roots)
+{
+  std::size_t numc= end-begin;
+  double rp[MAXN];
+  double cp[MAXN];
+  double cc[MAXN];
+
+  /*for (unsigned int i=0; i< numc; ++i){
+    rp[i]= std::numeric_limits<double>::infinity();
+    }*/
+
+  for (unsigned int i=0; i< MAXN; ++i){
+    cc[i]=std::numeric_limits<double>::infinity();
+    rp[i]=std::numeric_limits<double>::infinity();
+    cc[i]=std::numeric_limits<double>::infinity();
+  }
+
+  FindPolynomialRoots(begin, rp, cp, cc, static_cast<long>(numc)-1, 10*static_cast<long>(numc), 40);
+
+  /*if (CLEAN) {
+    lb-= .000005;
+    }*/
+  double last= -std::numeric_limits<double>::infinity();
+  for (std::size_t i=0; i< numc-1; ++i) {
+    /* std::cout << "Trying " <<  rp[i] << "+" << std::setprecision(10) <<  cp[i] << "i "
+       << cc[i] << "\n";*/
+    if (cc[i] > 10000 && root_is_good(rp[i], cp[i], lb, ub)) {
+      roots.push_back(rp[i]);
+      /*std::cout << "Good was " <<  rp[i] << "+" <<std::setprecision(10) <<  cp[i] << "i "
+	<< cc[i] << "\n";*/
+    } else if (CLEAN && root_is_good(rp[i], cp[i], last, ub) && last < rp[i] && rp[i] <= lb) {
+      last= rp[i];
+    }
+    /*else {
+      std::cout << "Rejected " << rp[i] << "+" << cp[i] << "i\n";
+      }*/
+  }
+  std::sort(roots.begin(), roots.end(), std::greater<double>());
+  
+  if (CLEAN) filter_solver_roots(begin, end, lb, ub, last, roots);
+}
+
+CGAL_INLINE_FUNCTION
+void Turkowski_polynomial_compute_roots(const double *begin, const double *end, 
+					double lb, double ub, 
+					std::vector<double> &roots)
+{
+
+  std::ptrdiff_t degree= end-begin-1;
+  switch( degree) {
+  case -1:
+  case 0:
+    break;
+  case 1:
+    compute_linear_roots(begin,end, lb, ub, roots);
+    break;
+  case 2:
+    compute_quadratic_roots(begin, end, lb, ub, roots);
+    break;
+  case 3:
+    {
+      double rd[3];
+      long numr= FindCubicRoots(begin, rd);
+      for (long i=numr-1; i>=0; --i) {
+	if (rd[i] >= lb && rd[i] < ub) roots.push_back(rd[i]);
+      }
+      std::sort(roots.begin(), roots.end(), std::greater<double>());
+      break;
+    }
+  default:
+    Turkowski_polynomial_compute_roots_t<false>(begin, end, lb, ub, roots);
+
+  }
+
+}
+
+CGAL_INLINE_FUNCTION
+void Turkowski_polynomial_compute_cleaned_roots(const double *begin, const double *end, 
+						double lb, double ub,
+						std::vector<double> &roots)
+{
+  std::ptrdiff_t degree= end-begin-1;
+  switch( degree) {
+  case -1:
+  case 0:
+    break;
+  case 1:
+    compute_linear_cleaned_roots(begin,end, lb, ub, roots);
+    break;
+  case 2:
+    compute_quadratic_cleaned_roots(begin, end, lb, ub, roots);
+    break;
+  case 3:
+    {
+      double rd[3];
+      long numr= FindCubicRoots(begin, rd);
+      double last=-std::numeric_limits<double>::infinity();
+      for (long i=numr-1; i>=0; --i) {
+	if (rd[i]< ub && rd[i] >= lb) roots.push_back(rd[i]);
+	if (rd[i] < lb && rd[i] > last){
+	  last=rd[i];
+	}
+      }
+      std::sort(roots.begin(), roots.end(), std::greater<double>());
+      filter_solver_roots(begin, end, lb, ub, last, roots);
+      break;
+    }
+  default:
+    Turkowski_polynomial_compute_roots_t<true>(begin, end, lb, ub, roots);
+  }
+}
+
+
+} } } //namespace CGAL::POLYNOMIAL::internal
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/config.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/config.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/config.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/filtered_function_leaf_nodes.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/filtered_function_leaf_nodes.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/filtered_function_leaf_nodes.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/filtered_function_leaf_nodes.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/filtered_function_node_bases.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/filtered_function_node_bases.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/filtered_function_node_bases.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/filtered_function_node_bases.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/filtered_function_operation_nodes.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/filtered_function_operation_nodes.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/filtered_function_operation_nodes.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/filtered_function_operation_nodes.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/interval_arithmetic.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/interval_arithmetic.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/interval_arithmetic.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/interval_arithmetic.h
diff --git a/3rdparty/CGAL/include/CGAL/Polynomial/internal/macros.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/macros.h
new file mode 100644
index 0000000..de7d728
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polynomial/internal/macros.h
@@ -0,0 +1,72 @@
+// Copyright (c) 2005  Stanford University (USA).
+// 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(s)     : Daniel Russel <drussel at alumni.princeton.edu>
+
+#ifndef CGAL_POLYNOMIAL_INTERNAL_MACROS_H
+#define CGAL_POLYNOMIAL_INTERNAL_MACROS_H
+
+#include <CGAL/Polynomial/internal/config.h>
+
+#ifdef CGAL_POLYNOMIAL_USE_CGAL
+/*
+  When CGAL is present
+*/
+#include <CGAL/basic.h>
+
+#define CGAL_POLYNOMIAL_NS CGAL::POLYNOMIAL
+#define CGAL_Polynomial_assertion(x) CGAL_assertion(x)
+#define CGAL_Polynomial_assertion_code(x) CGAL_assertion_code(x)
+#define CGAL_Polynomial_precondition(x) CGAL_precondition(x)
+#define CGAL_Polynomial_precondition_code(x) CGAL_precondition_code(x)
+#define CGAL_Polynomial_postcondition(x) CGAL_postcondition(x)
+#ifdef CGAL_POLYNOMIAL_CHECK_EXPENSIVE
+#define CGAL_Polynomial_expensive_precondition(x) CGAL_expensive_precondition(x)
+#define CGAL_Polynomial_expensive_assertion(x) CGAL_expensive_assertion(x)
+#define CGAL_Polynomial_expensive_postcondition(x) CGAL_expensive_postcondition(x)
+#else
+#define CGAL_Polynomial_expensive_precondition(x)
+#define CGAL_Polynomial_expensive_assertion(x)
+#define CGAL_Polynomial_expensive_postcondition(x)
+#endif
+#define CGAL_Polynomial_exactness_assertion(x) CGAL_exactness_assertion(x)
+#define CGAL_Polynomial_exactness_postcondition(x) CGAL_exactness_postcondition(x)
+#define CGAL_Polynomial_exactness_precondition(x) CGAL_exactness_precondition(x)
+
+#else
+/*
+  When no CGAL is present
+*/
+
+#define POLYNOMIAL_NS Polynomial
+
+#include <cassert>
+
+#define CGAL_Polynomial_assertion(x) CGAL_assertion(x)
+// This does not work
+#define CGAL_Polynomial_assertion_code(x) x
+#define CGAL_Polynomial_precondition(x) CGAL_assertion(x)
+#define CGAL_Polynomial_postcondition(x) CGAL_assertion(x)
+#define CGAL_Polynomial_expensive_precondition(x)
+#define CGAL_Polynomial_expensive_assertion(x)
+#define CGAL_Polynomial_expensive_postcondition(x)
+#define CGAL_Polynomial_exactness_postcondition(x)
+#define CGAL_Polynomial_exactness_precondition(x)
+#endif
+
+#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/nt_converters.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/nt_converters.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/nt_converters.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/nt_converters.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/numeric_solvers.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/numeric_solvers.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/numeric_solvers.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/numeric_solvers.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/numeric_solvers_impl.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/numeric_solvers_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/numeric_solvers_impl.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/numeric_solvers_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/numeric_solvers_support.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/numeric_solvers_support.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/numeric_solvers_support.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/numeric_solvers_support.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/numeric_solvers_support_impl.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/numeric_solvers_support_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/numeric_solvers_support_impl.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/numeric_solvers_support_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/polynomial_generators.h b/3rdparty/CGAL/include/CGAL/Polynomial/internal/polynomial_generators.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/internal/polynomial_generators.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/internal/polynomial_generators.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/misc.h b/3rdparty/CGAL/include/CGAL/Polynomial/misc.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/misc.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/misc.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/modular_filter.h b/3rdparty/CGAL/include/CGAL/Polynomial/modular_filter.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/modular_filter.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/modular_filter.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/modular_gcd.h b/3rdparty/CGAL/include/CGAL/Polynomial/modular_gcd.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/modular_gcd.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/modular_gcd.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/modular_gcd_utcf_algorithm_M.h b/3rdparty/CGAL/include/CGAL/Polynomial/modular_gcd_utcf_algorithm_M.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/modular_gcd_utcf_algorithm_M.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/modular_gcd_utcf_algorithm_M.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/modular_gcd_utcf_dfai.h b/3rdparty/CGAL/include/CGAL/Polynomial/modular_gcd_utcf_dfai.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/modular_gcd_utcf_dfai.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/modular_gcd_utcf_dfai.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/modular_gcd_utils.h b/3rdparty/CGAL/include/CGAL/Polynomial/modular_gcd_utils.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/modular_gcd_utils.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/modular_gcd_utils.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/polynomial_converters.h b/3rdparty/CGAL/include/CGAL/Polynomial/polynomial_converters.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/polynomial_converters.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/polynomial_converters.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/polynomial_gcd.h b/3rdparty/CGAL/include/CGAL/Polynomial/polynomial_gcd.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/polynomial_gcd.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/polynomial_gcd.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/polynomial_gcd_implementations.h b/3rdparty/CGAL/include/CGAL/Polynomial/polynomial_gcd_implementations.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/polynomial_gcd_implementations.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/polynomial_gcd_implementations.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/polynomial_gcd_ntl.h b/3rdparty/CGAL/include/CGAL/Polynomial/polynomial_gcd_ntl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/polynomial_gcd_ntl.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/polynomial_gcd_ntl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/prs_resultant.h b/3rdparty/CGAL/include/CGAL/Polynomial/prs_resultant.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/prs_resultant.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/prs_resultant.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/resultant.h b/3rdparty/CGAL/include/CGAL/Polynomial/resultant.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/resultant.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/resultant.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/square_free_factorize.h b/3rdparty/CGAL/include/CGAL/Polynomial/square_free_factorize.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/square_free_factorize.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/square_free_factorize.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/sturm_habicht_sequence.h b/3rdparty/CGAL/include/CGAL/Polynomial/sturm_habicht_sequence.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/sturm_habicht_sequence.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/sturm_habicht_sequence.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial/subresultants.h b/3rdparty/CGAL/include/CGAL/Polynomial/subresultants.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial/subresultants.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial/subresultants.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial_traits_d.h b/3rdparty/CGAL/include/CGAL/Polynomial_traits_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial_traits_d.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial_traits_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomial_type_generator.h b/3rdparty/CGAL/include/CGAL/Polynomial_type_generator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomial_type_generator.h
rename to 3rdparty/CGAL/include/CGAL/Polynomial_type_generator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomials_1_2.h b/3rdparty/CGAL/include/CGAL/Polynomials_1_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomials_1_2.h
rename to 3rdparty/CGAL/include/CGAL/Polynomials_1_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomials_1_3.h b/3rdparty/CGAL/include/CGAL/Polynomials_1_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomials_1_3.h
rename to 3rdparty/CGAL/include/CGAL/Polynomials_1_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomials_2_2.h b/3rdparty/CGAL/include/CGAL/Polynomials_2_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomials_2_2.h
rename to 3rdparty/CGAL/include/CGAL/Polynomials_2_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomials_2_3.h b/3rdparty/CGAL/include/CGAL/Polynomials_2_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomials_2_3.h
rename to 3rdparty/CGAL/include/CGAL/Polynomials_2_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polynomials_for_line_3.h b/3rdparty/CGAL/include/CGAL/Polynomials_for_line_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polynomials_for_line_3.h
rename to 3rdparty/CGAL/include/CGAL/Polynomials_for_line_3.h
diff --git a/3rdparty/CGAL/include/CGAL/Polytope_distance_d.h b/3rdparty/CGAL/include/CGAL/Polytope_distance_d.h
new file mode 100644
index 0000000..48d593f
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Polytope_distance_d.h
@@ -0,0 +1,942 @@
+// Copyright (c) 1997-2001  ETH Zurich (Switzerland).
+// 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
+// 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(s)     : Sven Schoenherr <sven at inf.ethz.ch>
+
+#ifndef CGAL_POLYTOPE_DISTANCE_D_H
+#define CGAL_POLYTOPE_DISTANCE_D_H
+
+#ifdef _MSC_VER
+# pragma warning(push)
+# pragma warning(disable: 4244) // conversion warning in Boost iterator_adaptor
+#endif
+
+// includes
+// --------
+#include <CGAL/Optimisation/basic.h>
+#include <CGAL/function_objects.h>
+#include <boost/functional.hpp>
+
+#include <CGAL/QP_options.h>
+#include <CGAL/QP_solver/QP_solver.h>
+#include <CGAL/QP_models.h>
+#include <CGAL/QP_solver/functors.h>
+#include <CGAL/QP_solver/QP_full_filtered_pricing.h>
+#include <CGAL/QP_solver/QP_full_exact_pricing.h>
+
+namespace CGAL {
+
+// To determine the polytope distance, we set up the following QP:
+// 
+// We let v-w be nonnegative vectors such that
+// v-w = p-q, where p and q are the points that realize the
+// optimal distance. That way, we obtain a nonnegative QP
+// 
+//
+//min (v-w)^T(w-v)
+//     v-w - \sum x_i p_i + \sum y_j q_j    = 0
+//           \sum x_i                       = 1
+//                           \sum y_j       = 1
+//     v, w, x, y >= 0
+
+namespace PD_detail {
+  // The functors necessary to realize access to A
+  // 
+  // A has the form
+  //    I  -I    -P    Q
+  //    0   0     1    0
+  //    0   0     0    1
+  // where  I and -I are blocks of size d*d, and the 0's and 1's are
+  // rows vectors of 0's and 1's 
+  //
+  // we have one functor for a fixed column, and one functor for the
+  // whole matrix
+
+  // functor for a fixed column of A
+  template <class NT, class Iterator>
+  class A_column : public std::unary_function <int, NT>
+  {
+  public:
+    typedef NT result_type;
+    A_column()
+    {}
+  
+    A_column (int j, int d, bool in_p, Iterator it)
+      : j_ (j), d_ (d), in_p_ (in_p), it_ (it), nt_0_ (0), nt_1_ (1)
+    {}
+
+    result_type operator() (int i) const
+    {
+      if (j_ < d_) {
+	// column for v
+	return (i == j_ ? nt_1_ : nt_0_);
+      }
+      if (j_ < 2*d_) {
+	// column for w
+	return (i == j_-d_ ? -nt_1_ : nt_0_);
+      }
+      // point column
+      if (in_p_) {
+	// column for P
+	if (i < d_) return -(*(it_ + i));
+	if (i == d_) return *(it_ + d_); // homogenizing coordinate
+	return nt_0_;
+      } else {
+	// column for Q
+	if (i < d_) return (*(it_ + i));
+	if (i == d_+1) return *(it_ + d_); // homogenizing coordinate
+	return nt_0_;
+      }
+      // never get here
+    }
+    
+  private:
+    int j_;                  // column number
+    int d_;                  // dimension
+    bool in_p_;              // point in P ?
+    Iterator it_;            // the iterator through the column's point
+    NT nt_0_;
+    NT nt_1_; 
+  };
+  
+  // functor for matrix A
+  template <class NT, class Access_coordinate_begin_d,
+	    class Point_iterator >
+  class A_matrix : public std::unary_function
+  <int, boost::transform_iterator <A_column
+    <NT, typename Access_coordinate_begin_d::Coordinate_iterator>, 
+				   boost::counting_iterator<int> > >
+  { 
+    typedef PD_detail::A_column
+    <NT, typename Access_coordinate_begin_d::Coordinate_iterator> A_column;
+  public:
+    typedef  boost::transform_iterator
+    <A_column, boost::counting_iterator<int> > result_type;
+    
+    A_matrix ()
+    {}
+
+    A_matrix (int d, 
+	      Access_coordinate_begin_d da_coord,
+	      Point_iterator P, 
+	      int r, 
+	      Point_iterator Q) 
+      : d_ (d), da_coord_ (da_coord), P_ (P), r_ (r), Q_ (Q)
+    {}
+
+    result_type operator () (int j) const
+    { 
+      if (j < 2*d_) {
+	// column of v or w
+	return result_type
+	  (0, A_column (j, d_, false  /*dummy*/, 
+			da_coord_ (*P_) /*dummy*/));
+      }
+      if (j < 2*d_+r_) {
+	// column of P
+	return result_type
+	  (0, A_column (j , d_, true, da_coord_ (*(P_+(j-2*d_)))));
+      }
+      // column of Q
+      return result_type
+	(0, A_column (j, d_, false, da_coord_ (*(Q_+(j-2*d_-r_))))); 
+    }
+
+  private:
+    int d_;                  // dimension
+    Access_coordinate_begin_d da_coord_; // data accessor
+    Point_iterator P_;       // point set P
+    int r_;                  // size of point set P
+    Point_iterator Q_;       // point set Q
+  };
+
+  // The functor necessary to realize access to b
+  // b has the form
+  // 0
+  // 0
+  // 1  (row d)
+  // 1  (row d+1)
+
+  template <class NT>
+  class B_vector : public std::unary_function<int, NT>
+  {
+  public:
+    typedef NT result_type;
+    B_vector()
+    {}
+
+    B_vector (int d)
+      : d_ (d), nt_0_ (0), nt_1_ (1)
+    {}
+
+    result_type operator() (int i) const
+    {
+      return ( (i == d_ || i == d_+1) ? nt_1_ : nt_0_);
+    }
+
+  private:
+    int d_;
+    NT nt_0_;
+    NT nt_1_;
+  };
+
+
+  // The functors necessary to realize access to D
+  // 
+  // D has the form
+  //   I  -I    0
+  //  -I   I    0
+  //   0   0    0
+  // where all I and -I are blocks of size d*d
+  //
+  // we have one functor for a fixed row, and one functor for the
+  // whole matrix
+
+  // functor for a fixed row of D; note that we have to return 2D in
+  // order to please the QP_solver
+  template <class NT> 
+  class D_row : public std::unary_function <int, NT> 
+  {
+  public:
+    typedef NT result_type;
+    D_row () 
+    {}
+    D_row (int i, int d) 
+      : i_ (i), d_ (d), nt_0_ (0), nt_2_ (2)
+    {}
+    
+    result_type operator () (int j) const
+    {
+      if (j < d_) {
+	//  I ( 1 iff i = j)
+	// -I (-1 iff i = j + d)
+	//  0
+	if (i_ == j) return nt_2_;
+	if (i_ == j + d_) return -nt_2_;
+	return nt_0_;
+      }
+      if (j < 2*d_) {
+	// -I (-1 iff i = j - d)
+	//  I ( 1 iff i = j)
+	//  0
+	if (i_ == j - d_) return -nt_2_;
+	if (i_ == j) return nt_2_;
+	return nt_0_;
+      }
+      // 0
+      // 0
+      // 0
+      return nt_0_;
+    }
+  private:
+    int i_; // row number
+    int d_; // dimension
+    NT nt_0_;
+    NT nt_2_;
+  };
+
+  // functor for matrix D
+  template <class NT>
+  class D_matrix : public std::unary_function
+  <int, boost::transform_iterator<D_row<NT>,
+				  boost::counting_iterator<int> > >
+  { 
+  public:
+    typedef boost::transform_iterator<D_row<NT>,
+	    boost::counting_iterator<int> > result_type; 
+    D_matrix ()
+    {}
+    D_matrix (int d)
+      :  d_ (d)
+    {}
+
+    result_type operator()(int i) const 
+    {
+      return result_type (0, D_row<NT>(i, d_));
+    }
+
+  private:
+    int d_; // dimension
+  };
+}
+
+// Class interfaces
+// ================
+template < class Traits_ >
+class Polytope_distance_d {
+public:
+  // self
+  typedef  Traits_                    Traits;
+  typedef  Polytope_distance_d<Traits>
+  Self;
+
+  // types from the traits class
+  typedef  typename Traits::Point_d   Point;
+
+  typedef  typename Traits::Rep_tag   Rep_tag;
+
+  typedef  typename Traits::RT        RT;
+  typedef  typename Traits::FT        FT;
+
+  typedef  typename Traits::Access_dimension_d
+  Access_dimension_d;
+  typedef  typename Traits::Access_coordinates_begin_d
+  Access_coordinates_begin_d;
+
+  typedef  typename Traits::Construct_point_d
+  Construct_point_d;
+
+  typedef  typename Traits::ET        ET;
+  typedef  typename Traits::NT        NT; 
+
+private:
+  // private types
+  typedef  std::vector<Point>         Point_vector;
+  typedef  std::vector<ET>            ET_vector;
+    
+  typedef  QP_access_by_index
+  <typename std::vector<Point>::const_iterator, int> Point_by_index;
+    
+  typedef  std::vector<NT>            NT_vector;
+  typedef  std::vector<NT_vector>     NT_matrix;
+  
+  typedef  std::vector<int>           Index_vector;
+public:    
+  // public types
+  typedef  typename Point_vector::const_iterator
+  Point_iterator;
+    
+  typedef typename Index_vector::const_iterator IVCI;
+  typedef CGAL::Join_input_iterator_1< IVCI, Point_by_index >
+  Support_point_iterator;
+
+  typedef typename Index_vector::const_iterator
+  Support_point_index_iterator;
+    
+  typedef  typename ET_vector::const_iterator
+  Coordinate_iterator;
+
+private:
+  
+  // QP solver iterator types
+  typedef PD_detail::A_matrix <NT, Access_coordinates_begin_d,
+			       Point_iterator> A_matrix;
+  typedef boost::transform_iterator<
+    A_matrix, boost::counting_iterator<int> > A_iterator;
+
+  typedef PD_detail::B_vector <NT> B_vector;
+  typedef boost::transform_iterator<
+    B_vector, boost::counting_iterator<int> > B_iterator;
+
+  typedef CGAL::Const_oneset_iterator<CGAL::Comparison_result> R_iterator;  
+  typedef CGAL::Const_oneset_iterator<NT> C_iterator; 
+
+  typedef PD_detail::D_matrix <NT> D_matrix;
+  typedef boost::transform_iterator <
+    D_matrix, boost::counting_iterator<int> > D_iterator;
+
+  // Program type
+  typedef CGAL::Nonnegative_quadratic_program_from_iterators
+      <A_iterator, B_iterator, R_iterator, D_iterator, C_iterator> QP;
+
+  // Tags
+  typedef QP_solver_impl::QP_tags <Tag_false, Tag_true> QP_tags;
+
+  // Solver types
+  typedef  CGAL::QP_solver <QP, ET, QP_tags > Solver;
+
+  typedef  typename Solver::Pricing_strategy Pricing_strategy;
+
+public:    
+
+  // creation
+  Polytope_distance_d( const Traits&  traits  = Traits())
+    : nt_0(0), nt_1(1),
+      tco( traits), da_coord (tco.access_coordinates_begin_d_object()),
+      d( -1), solver(0) 
+  {}
+    
+  template < class InputIterator1, class InputIterator2 >
+  Polytope_distance_d( InputIterator1 p_first,
+		       InputIterator1 p_last,
+		       InputIterator2 q_first,
+		       InputIterator2 q_last,
+		       const Traits&  traits = Traits())
+    : nt_0(0), nt_1(1), 
+      tco( traits), da_coord (tco.access_coordinates_begin_d_object()),
+      solver(0)
+  {
+    set( p_first, p_last, q_first, q_last);
+  }
+
+  ~Polytope_distance_d() {    
+    if (solver)
+      delete solver;
+  }
+
+  // access to point sets
+  int  ambient_dimension( ) const { return d; }
+    
+  int  number_of_points( ) const { return static_cast<int>(p_points.size()+q_points.size());}
+    
+  int  number_of_points_p( ) const { return static_cast<int>(p_points.size()); }
+  int  number_of_points_q( ) const { return static_cast<int>(q_points.size()); }
+    
+  Point_iterator  points_p_begin( ) const { return p_points.begin(); }
+  Point_iterator  points_p_end  ( ) const { return p_points.end  (); }
+    
+  Point_iterator  points_q_begin( ) const { return q_points.begin(); }
+  Point_iterator  points_q_end  ( ) const { return q_points.end  (); }
+    
+  // access to support points
+  int
+  number_of_support_points( ) const
+  { return is_finite() ? 
+      static_cast<int>(p_support_indices.size()+q_support_indices.size()) : 0; }
+    
+  int  number_of_support_points_p() const { return static_cast<int>(p_support_indices.size());}
+  int  number_of_support_points_q() const { return static_cast<int>(q_support_indices.size());}
+    
+  Support_point_iterator
+  support_points_p_begin() const
+  { return Support_point_iterator(
+				  p_support_indices.begin(),
+				  Point_by_index( p_points.begin())); }
+    
+  Support_point_iterator
+  support_points_p_end() const
+  { return Support_point_iterator(
+				  is_finite() ? p_support_indices.end()
+				  : p_support_indices.begin(),
+				  Point_by_index( p_points.begin())); }
+    
+  Support_point_iterator
+  support_points_q_begin() const
+  { return Support_point_iterator(
+				  q_support_indices.begin(),
+				  Point_by_index( q_points.begin())); }
+    
+  Support_point_iterator
+  support_points_q_end() const
+  { return Support_point_iterator(
+				  is_finite() ? q_support_indices.end()
+				  : q_support_indices.begin(),
+				  Point_by_index( q_points.begin())); }
+
+  Support_point_index_iterator
+  support_points_p_indices_begin() const
+  { return p_support_indices.begin(); }
+    
+  Support_point_index_iterator
+  support_points_p_indices_end() const
+  { return p_support_indices.end(); }
+
+  Support_point_index_iterator
+  support_points_q_indices_begin() const
+  { return q_support_indices.begin(); }
+
+  Support_point_index_iterator
+  support_points_q_indices_end() const
+  { return q_support_indices.end(); }
+    
+  // access to realizing points (rational representation)
+  Coordinate_iterator
+  realizing_point_p_coordinates_begin( ) const { return p_coords.begin(); }
+    
+  Coordinate_iterator
+  realizing_point_p_coordinates_end  ( ) const { return p_coords.end  (); }
+    
+  Coordinate_iterator
+  realizing_point_q_coordinates_begin( ) const { return q_coords.begin(); }
+    
+  Coordinate_iterator
+  realizing_point_q_coordinates_end  ( ) const { return q_coords.end  (); }
+    
+  // access to squared distance (rational representation)
+  ET  squared_distance_numerator  ( ) const
+  { return solver->solution_numerator(); }
+    
+  ET  squared_distance_denominator( ) const
+  { return solver->solution_denominator(); }
+    
+  // access to realizing points and squared distance
+  // NOTE: an implicit conversion from ET to RT must be available!
+  Point
+  realizing_point_p( ) const
+  { CGAL_optimisation_precondition( is_finite());
+  return tco.construct_point_d_object()
+    ( ambient_dimension(),
+      realizing_point_p_coordinates_begin(),
+      realizing_point_p_coordinates_end  ()); }
+    
+  Point
+  realizing_point_q( ) const
+  { CGAL_optimisation_precondition( is_finite());
+  return tco.construct_point_d_object()
+    ( ambient_dimension(),
+      realizing_point_q_coordinates_begin(),
+      realizing_point_q_coordinates_end  ()); }
+    
+  FT
+  squared_distance( ) const
+  { 
+    return FT( squared_distance_numerator  ()) /
+      FT( squared_distance_denominator()); }
+    
+  bool  is_finite( ) const
+  { return ( number_of_points_p() > 0) && ( number_of_points_q() > 0); }
+    
+  bool  is_zero( ) const
+  { return CGAL_NTS is_zero( squared_distance_numerator()); }
+    
+  bool  is_degenerate( ) const { return ( ! is_finite()); }
+    
+  // modifiers
+  template < class InputIterator1, class InputIterator2 >
+  void
+  set( InputIterator1 p_first, InputIterator1 p_last,
+       InputIterator2 q_first, InputIterator2 q_last)
+  { 
+    p_points.clear();
+    q_points.clear();
+    std::copy( p_first, p_last, std::back_inserter( p_points));
+    std::copy( q_first, q_last, std::back_inserter( q_points));
+    set_dimension();
+    CGAL_optimisation_precondition_msg
+      (check_dimension( p_points.begin(), p_points.end())
+       && check_dimension( q_points.begin(), q_points.end()),
+       "Not all points have the same dimension.");
+
+    compute_distance(); 
+  }
+    
+  template < class InputIterator >
+  void
+  set_p( InputIterator p_first, InputIterator p_last)
+  { 
+    p_points.clear();
+    std::copy( p_first, p_last, std::back_inserter( p_points));
+    set_dimension();
+    CGAL_optimisation_precondition_msg
+      (check_dimension( p_points.begin(), p_points.end()),
+       "Not all points have the same dimension.");
+
+    compute_distance(); 
+  }
+    
+  template < class InputIterator >
+  void
+  set_q( InputIterator q_first, InputIterator q_last)
+  {
+    q_points.clear();
+    std::copy( q_first, q_last, std::back_inserter( q_points));
+    set_dimension();
+    CGAL_optimisation_precondition_msg
+      (check_dimension( q_points.begin(), q_points.end()),
+       "Not all points have the same dimension.");
+  
+    compute_distance(); 
+  }
+    
+  void
+  insert_p( const Point& p)
+  { 
+    CGAL_optimisation_precondition
+      ( ( ! is_finite()) ||
+	( tco.access_dimension_d_object()( p) == d));
+    p_points.push_back( p);
+    set_dimension(); // it might no longer be -1 
+    compute_distance(); 
+  }
+    
+  void
+  insert_q( const Point& q)
+  { 
+    CGAL_optimisation_precondition
+      ( ( ! is_finite()) ||
+	( tco.access_dimension_d_object()( q) == d));
+    q_points.push_back( q); 
+    set_dimension(); // it might no longer be -1 
+    compute_distance(); 
+  }
+    
+  template < class InputIterator1, class InputIterator2 >
+  void
+  insert( InputIterator1 p_first, InputIterator1 p_last,
+	  InputIterator2 q_first, InputIterator2 q_last)
+  { 
+    CGAL_optimisation_precondition_code(int old_r = static_cast<int>(p_points.size()));
+    CGAL_optimisation_precondition_code(int old_s = static_cast<int>(q_points.size()));
+    p_points.insert( p_points.end(), p_first, p_last);
+    q_points.insert( q_points.end(), q_first, q_last);
+    set_dimension();
+    CGAL_optimisation_precondition_msg
+      (check_dimension( p_points.begin()+old_r, p_points.end())
+       && check_dimension( q_points.begin()+old_s, q_points.end()),
+       "Not all points have the same dimension.");
+    compute_distance(); 
+  }
+    
+  template < class InputIterator >
+  void
+  insert_p( InputIterator p_first, InputIterator p_last)
+  { 
+    CGAL_optimisation_precondition_code(int old_r = static_cast<int>(p_points.size()));
+    p_points.insert( p_points.end(), p_first, p_last);
+    set_dimension();
+    CGAL_optimisation_precondition_msg
+      (check_dimension( p_points.begin()+old_r, p_points.end()),
+       "Not all points have the same dimension.");
+    compute_distance(); 
+  }
+    
+  template < class InputIterator >
+  void
+  insert_q( InputIterator q_first, InputIterator q_last)
+  { 
+    CGAL_optimisation_precondition_code( int old_s = static_cast<int>(q_points.size()));
+    q_points.insert( q_points.end(), q_first, q_last);
+    set_dimension();
+    CGAL_optimisation_precondition_msg
+      (check_dimension( q_points.begin()+old_s, q_points.end()),
+       "Not all points have the same dimension.");
+    compute_distance(); 
+  }
+    
+  void
+  clear( )
+  { 
+    p_points.clear();
+    q_points.clear();
+    compute_distance(); 
+  }
+    
+  // validity check
+  bool  is_valid( bool verbose = false, int level = 0) const;
+    
+  // traits class access
+  const Traits&  traits( ) const { return tco; }
+    
+
+private:
+  NT nt_0;
+  NT nt_1;
+
+  Traits                     tco;        // traits class object
+  Access_coordinates_begin_d da_coord;   // data accessor object
+    
+  Point_vector             p_points;  // points of P
+  Point_vector             q_points;  // points of Q
+  int                      d;         // dimension of input points
+    
+  ET_vector                p_coords;          // realizing point of P
+  ET_vector                q_coords;          // realizing point of Q
+    
+  Solver                   *solver;    // quadratic programming solver
+    
+  Index_vector             p_support_indices;
+  Index_vector             q_support_indices;
+    
+private:    
+  // set dimension of input points
+  void
+  set_dimension( )
+  { 
+    d = ( p_points.size() > 0 ?
+	  tco.access_dimension_d_object()( p_points[ 0]) :
+	  q_points.size() > 0 ?
+	  tco.access_dimension_d_object()( q_points[ 0]) :
+	  -1); 
+  }
+    
+  // check dimension of input points
+  template < class InputIterator >
+  bool
+  check_dimension( InputIterator first, InputIterator last)
+  { return ( std::find_if
+	     ( first, last,
+	       CGAL::compose1_1
+	       ( boost::bind2nd(std::not_equal_to<int>(), d),
+		 tco.access_dimension_d_object()))
+	     == last); }
+    
+  // compute (squared) distance
+  void
+  compute_distance( )
+  {
+    // clear support points
+    p_support_indices.clear();
+    q_support_indices.clear();
+    if ( ( p_points.size() == 0) || ( q_points.size() == 0)) return;
+        
+    // construct program
+    int n = 2 * d + static_cast<int>(p_points.size() + q_points.size());
+    int m = d + 2;
+    CGAL_optimisation_precondition (p_points.size() > 0);
+    QP qp (n, m, 
+	   A_iterator 
+	   (boost::counting_iterator<int>(0), 
+	    A_matrix (d, da_coord, p_points.begin(), static_cast<int>(p_points.size()), 
+			 q_points.begin())),
+	   B_iterator (boost::counting_iterator<int>(0), B_vector (d)), 
+	   R_iterator (CGAL::EQUAL), 
+	   D_iterator (boost::counting_iterator<int>(0), D_matrix (d)),
+	   C_iterator (nt_0));
+
+    delete solver;
+    Quadratic_program_options options;
+    options.set_pricing_strategy(pricing_strategy(NT()));
+    solver = new Solver(qp, options);
+    CGAL_optimisation_assertion(solver->status() == QP_OPTIMAL);
+    // compute support and realizing points
+    ET  et_0 = 0;
+    int r = static_cast<int>(p_points.size());
+    p_coords.resize( ambient_dimension()+1);
+    q_coords.resize( ambient_dimension()+1);
+    std::fill( p_coords.begin(), p_coords.end(), et_0);
+    std::fill( q_coords.begin(), q_coords.end(), et_0);
+    for (int i = 0; i < solver->number_of_basic_original_variables(); ++i) {
+      ET  value = solver->basic_original_variables_numerator_begin()[ i];
+      int index = solver->basic_original_variable_indices_begin()[ i];
+      if (index < 2*d) continue; // v or w variable
+      if (index < 2*d + r) {
+	// a point of p
+	for ( int j = 0; j < d; ++j) {
+	  p_coords[ j]
+	    += value * ET(da_coord (p_points[ index-2*d ])[ j]);
+	}
+	p_support_indices.push_back( index-2*d);
+      } else {
+	// a point of q
+	for ( int j = 0; j < d; ++j) {
+	  q_coords[ j]
+	    += value * ET(da_coord (q_points[ index-2*d-r])[ j]);
+	}
+	q_support_indices.push_back( index-2*d-r);
+      }
+    }
+    p_coords[ d] = q_coords[ d] = solver->variables_common_denominator();
+  }
+    
+  template < class NT >
+  Quadratic_program_pricing_strategy pricing_strategy( NT) {
+    return QP_PARTIAL_FILTERED_DANTZIG;
+  }
+  
+  Quadratic_program_pricing_strategy pricing_strategy( ET) {
+    return QP_PARTIAL_DANTZIG;
+  }
+    
+};
+
+// Function declarations
+// =====================
+// output operator
+template < class Traits_ >
+std::ostream&
+operator << ( std::ostream& os,
+              const Polytope_distance_d<Traits_>& poly_dist);
+
+
+// ============================================================================
+
+// Class implementation
+// ====================
+
+// validity check
+template < class Traits_ >
+bool
+Polytope_distance_d<Traits_>::
+is_valid( bool verbose, int level) const
+{
+  using namespace std;
+
+  CGAL::Verbose_ostream verr( verbose);
+  verr << "CGAL::Polytope_distance_d<Traits>::" << endl;
+  verr << "is_valid( true, " << level << "):" << endl;
+  verr << "  |P+Q| = " << number_of_points_p()
+       <<          '+' << number_of_points_q()
+       <<   ", |S| = " << number_of_support_points_p()
+       <<          '+' << number_of_support_points_q() << endl;
+
+  if ( is_finite()) {
+
+    // compute normal vector
+    ET_vector  normal( d), diff( d);
+    ET  et_0 = 0, den = p_coords[d];
+    CGAL_optimisation_assertion (den > et_0);
+    CGAL_optimisation_assertion (den == q_coords[d]);
+    int i, j;
+    for ( j = 0; j < d; ++j) normal[ j] = p_coords[ j] - q_coords[ j];
+
+    // check correctness of computed squared distance
+    verr << "  checking squared_distance..." << flush;
+    ET sqr_dist_num (0);
+    for ( j = 0; j < d; ++j)
+      sqr_dist_num += normal[ j] * normal[ j];
+    ET sqr_dist_den = 
+      p_coords[ d] * p_coords[ d];
+    if (sqr_dist_num * squared_distance_denominator() !=
+	sqr_dist_den * squared_distance_numerator())
+      return CGAL::_optimisation_is_valid_fail
+	( verr, "realizing points don't have correct squared distance");
+
+
+    // check P
+    // -------
+    verr << "  checking P..." << flush;
+        
+    // check point set
+    for ( i = 0; i < number_of_points_p(); ++i) {
+      for ( j = 0; j < d; ++j) {
+	// compute (a positive multiple of) p^* - p_i
+	diff[ j] = 
+	  ET(da_coord(p_points[ i])[d]) * p_coords[ j] - 
+	  den * ET(da_coord( p_points[ i])[ j]);
+      }
+      if ( std::inner_product( diff.begin(), diff.end(),
+			       normal.begin(), et_0) > et_0)
+	return CGAL::_optimisation_is_valid_fail
+	  ( verr, "polytope P is not separated by its hyperplane");
+    }
+        
+    verr << "passed." << endl;
+
+    // check Q
+    // -------
+    verr << "  checking Q..." << flush;
+        
+    // check point set
+    for ( i = 0; i < number_of_points_q(); ++i) {
+      for ( j = 0; j < d; ++j) {
+	// compute (a positive multiple of) q^* - q_i
+	diff[ j] = 
+	  ET(da_coord(q_points[ i])[d]) * q_coords[ j] - 
+	  den * ET(da_coord( q_points[ i])[ j]);
+      }
+      if ( std::inner_product( diff.begin(), diff.end(),
+			       normal.begin(), et_0) < et_0)
+	return CGAL::_optimisation_is_valid_fail
+	  ( verr, "polytope Q is not separated by its hyperplane");
+    }
+        
+    verr << "passed." << endl;
+  }
+
+  verr << "  object is valid!" << endl;
+  return( true);
+}
+
+// output operator
+template < class Traits_ >
+std::ostream&
+operator << ( std::ostream& os,
+              const Polytope_distance_d<Traits_>& poly_dist)
+{
+  using namespace std;
+
+  typedef  typename Polytope_distance_d<Traits_>::Point  Point;
+  typedef  ostream_iterator<Point>       Os_it;
+  typedef  typename Traits_::ET          ET;
+  typedef  ostream_iterator<ET>          Et_it;
+
+  switch ( CGAL::get_mode( os)) {
+
+  case CGAL::IO::PRETTY:
+    os << "CGAL::Polytope_distance_d( |P+Q| = "
+       << poly_dist.number_of_points_p() << '+'
+       << poly_dist.number_of_points_q() << ", |S| = "
+       << poly_dist.number_of_support_points_p() << '+'
+       << poly_dist.number_of_support_points_q() << endl;
+    os << "  P = {" << endl;
+    os << "    ";
+    copy( poly_dist.points_p_begin(), poly_dist.points_p_end(),
+	  Os_it( os, ",\n    "));
+    os << "}" << endl;
+    os << "  Q = {" << endl;
+    os << "    ";
+    copy( poly_dist.points_q_begin(), poly_dist.points_q_end(),
+	  Os_it( os, ",\n    "));
+    os << "}" << endl;
+    os << "  S_P = {" << endl;
+    os << "    ";
+    copy( poly_dist.support_points_p_begin(),
+	  poly_dist.support_points_p_end(),
+	  Os_it( os, ",\n    "));
+    os << "}" << endl;
+    os << "  S_Q = {" << endl;
+    os << "    ";
+    copy( poly_dist.support_points_q_begin(),
+	  poly_dist.support_points_q_end(),
+	  Os_it( os, ",\n    "));
+    os << "}" << endl;
+    os << "  p = ( ";
+    copy( poly_dist.realizing_point_p_coordinates_begin(),
+	  poly_dist.realizing_point_p_coordinates_end(),
+	  Et_it( os, " "));
+    os << ")" << endl;
+    os << "  q = ( ";
+    copy( poly_dist.realizing_point_q_coordinates_begin(),
+	  poly_dist.realizing_point_q_coordinates_end(),
+	  Et_it( os, " "));
+    os << ")" << endl;
+    os << "  squared distance = "
+       << poly_dist.squared_distance_numerator() << " / "
+       << poly_dist.squared_distance_denominator() << endl;
+    break;
+
+  case CGAL::IO::ASCII:
+    os << poly_dist.number_of_points_p() << endl;
+    copy( poly_dist.points_p_begin(),
+	  poly_dist.points_p_end(),
+	  Os_it( os, "\n"));
+    os << poly_dist.number_of_points_q() << endl;
+    copy( poly_dist.points_q_begin(),
+	  poly_dist.points_q_end(),
+	  Os_it( os, "\n"));
+    break;
+
+  case CGAL::IO::BINARY:
+    os << poly_dist.number_of_points_p() << endl;
+    copy( poly_dist.points_p_begin(),
+	  poly_dist.points_p_end(),
+	  Os_it( os));
+    os << poly_dist.number_of_points_q() << endl;
+    copy( poly_dist.points_q_begin(),
+	  poly_dist.points_q_end(),
+	  Os_it( os));
+    break;
+
+  default:
+    CGAL_optimisation_assertion_msg( false,
+				     "CGAL::get_mode( os) invalid!");
+    break; }
+
+  return( os);
+}
+
+
+} //namespace CGAL
+
+#ifdef _MSC_VER
+# pragma warning(pop)
+#endif
+
+#endif // CGAL_POLYTOPE_DISTANCE_D_H
+
+// ===== EOF ==================================================================
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polytope_distance_d_traits_2.h b/3rdparty/CGAL/include/CGAL/Polytope_distance_d_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polytope_distance_d_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Polytope_distance_d_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polytope_distance_d_traits_3.h b/3rdparty/CGAL/include/CGAL/Polytope_distance_d_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polytope_distance_d_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/Polytope_distance_d_traits_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Polytope_distance_d_traits_d.h b/3rdparty/CGAL/include/CGAL/Polytope_distance_d_traits_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Polytope_distance_d_traits_d.h
rename to 3rdparty/CGAL/include/CGAL/Polytope_distance_d_traits_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Prevent_deref.h b/3rdparty/CGAL/include/CGAL/Prevent_deref.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Prevent_deref.h
rename to 3rdparty/CGAL/include/CGAL/Prevent_deref.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Profile_counter.h b/3rdparty/CGAL/include/CGAL/Profile_counter.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Profile_counter.h
rename to 3rdparty/CGAL/include/CGAL/Profile_counter.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Profile_timer.h b/3rdparty/CGAL/include/CGAL/Profile_timer.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Profile_timer.h
rename to 3rdparty/CGAL/include/CGAL/Profile_timer.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Projection_traits_xy_3.h b/3rdparty/CGAL/include/CGAL/Projection_traits_xy_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Projection_traits_xy_3.h
rename to 3rdparty/CGAL/include/CGAL/Projection_traits_xy_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Projection_traits_xz_3.h b/3rdparty/CGAL/include/CGAL/Projection_traits_xz_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Projection_traits_xz_3.h
rename to 3rdparty/CGAL/include/CGAL/Projection_traits_xz_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Projection_traits_yz_3.h b/3rdparty/CGAL/include/CGAL/Projection_traits_yz_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Projection_traits_yz_3.h
rename to 3rdparty/CGAL/include/CGAL/Projection_traits_yz_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/QP_functions.h b/3rdparty/CGAL/include/CGAL/QP_functions.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/QP_functions.h
rename to 3rdparty/CGAL/include/CGAL/QP_functions.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/QP_models.h b/3rdparty/CGAL/include/CGAL/QP_models.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/QP_models.h
rename to 3rdparty/CGAL/include/CGAL/QP_models.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/QP_options.h b/3rdparty/CGAL/include/CGAL/QP_options.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/QP_options.h
rename to 3rdparty/CGAL/include/CGAL/QP_options.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/QP_solution.h b/3rdparty/CGAL/include/CGAL/QP_solution.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/QP_solution.h
rename to 3rdparty/CGAL/include/CGAL/QP_solution.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/QP_solver/Initialization.h b/3rdparty/CGAL/include/CGAL/QP_solver/Initialization.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/QP_solver/Initialization.h
rename to 3rdparty/CGAL/include/CGAL/QP_solver/Initialization.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/QP_solver/QP__filtered_base.h b/3rdparty/CGAL/include/CGAL/QP_solver/QP__filtered_base.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/QP_solver/QP__filtered_base.h
rename to 3rdparty/CGAL/include/CGAL/QP_solver/QP__filtered_base.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/QP_solver/QP__filtered_base_impl.h b/3rdparty/CGAL/include/CGAL/QP_solver/QP__filtered_base_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/QP_solver/QP__filtered_base_impl.h
rename to 3rdparty/CGAL/include/CGAL/QP_solver/QP__filtered_base_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/QP_solver/QP__partial_base.h b/3rdparty/CGAL/include/CGAL/QP_solver/QP__partial_base.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/QP_solver/QP__partial_base.h
rename to 3rdparty/CGAL/include/CGAL/QP_solver/QP__partial_base.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/QP_solver/QP_basis_inverse.h b/3rdparty/CGAL/include/CGAL/QP_solver/QP_basis_inverse.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/QP_solver/QP_basis_inverse.h
rename to 3rdparty/CGAL/include/CGAL/QP_solver/QP_basis_inverse.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/QP_solver/QP_basis_inverse_impl.h b/3rdparty/CGAL/include/CGAL/QP_solver/QP_basis_inverse_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/QP_solver/QP_basis_inverse_impl.h
rename to 3rdparty/CGAL/include/CGAL/QP_solver/QP_basis_inverse_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/QP_solver/QP_exact_bland_pricing.h b/3rdparty/CGAL/include/CGAL/QP_solver/QP_exact_bland_pricing.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/QP_solver/QP_exact_bland_pricing.h
rename to 3rdparty/CGAL/include/CGAL/QP_solver/QP_exact_bland_pricing.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/QP_solver/QP_full_exact_pricing.h b/3rdparty/CGAL/include/CGAL/QP_solver/QP_full_exact_pricing.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/QP_solver/QP_full_exact_pricing.h
rename to 3rdparty/CGAL/include/CGAL/QP_solver/QP_full_exact_pricing.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/QP_solver/QP_full_filtered_pricing.h b/3rdparty/CGAL/include/CGAL/QP_solver/QP_full_filtered_pricing.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/QP_solver/QP_full_filtered_pricing.h
rename to 3rdparty/CGAL/include/CGAL/QP_solver/QP_full_filtered_pricing.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/QP_solver/QP_functions_impl.h b/3rdparty/CGAL/include/CGAL/QP_solver/QP_functions_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/QP_solver/QP_functions_impl.h
rename to 3rdparty/CGAL/include/CGAL/QP_solver/QP_functions_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/QP_solver/QP_partial_exact_pricing.h b/3rdparty/CGAL/include/CGAL/QP_solver/QP_partial_exact_pricing.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/QP_solver/QP_partial_exact_pricing.h
rename to 3rdparty/CGAL/include/CGAL/QP_solver/QP_partial_exact_pricing.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/QP_solver/QP_partial_filtered_pricing.h b/3rdparty/CGAL/include/CGAL/QP_solver/QP_partial_filtered_pricing.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/QP_solver/QP_partial_filtered_pricing.h
rename to 3rdparty/CGAL/include/CGAL/QP_solver/QP_partial_filtered_pricing.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/QP_solver/QP_pricing_strategy.h b/3rdparty/CGAL/include/CGAL/QP_solver/QP_pricing_strategy.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/QP_solver/QP_pricing_strategy.h
rename to 3rdparty/CGAL/include/CGAL/QP_solver/QP_pricing_strategy.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/QP_solver/QP_solution_impl.h b/3rdparty/CGAL/include/CGAL/QP_solver/QP_solution_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/QP_solver/QP_solution_impl.h
rename to 3rdparty/CGAL/include/CGAL/QP_solver/QP_solution_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/QP_solver/QP_solver.h b/3rdparty/CGAL/include/CGAL/QP_solver/QP_solver.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/QP_solver/QP_solver.h
rename to 3rdparty/CGAL/include/CGAL/QP_solver/QP_solver.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/QP_solver/QP_solver_bounds_impl.h b/3rdparty/CGAL/include/CGAL/QP_solver/QP_solver_bounds_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/QP_solver/QP_solver_bounds_impl.h
rename to 3rdparty/CGAL/include/CGAL/QP_solver/QP_solver_bounds_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/QP_solver/QP_solver_impl.h b/3rdparty/CGAL/include/CGAL/QP_solver/QP_solver_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/QP_solver/QP_solver_impl.h
rename to 3rdparty/CGAL/include/CGAL/QP_solver/QP_solver_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/QP_solver/QP_solver_nonstandardform_impl.h b/3rdparty/CGAL/include/CGAL/QP_solver/QP_solver_nonstandardform_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/QP_solver/QP_solver_nonstandardform_impl.h
rename to 3rdparty/CGAL/include/CGAL/QP_solver/QP_solver_nonstandardform_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/QP_solver/Unbounded_direction.h b/3rdparty/CGAL/include/CGAL/QP_solver/Unbounded_direction.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/QP_solver/Unbounded_direction.h
rename to 3rdparty/CGAL/include/CGAL/QP_solver/Unbounded_direction.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/QP_solver/assertions.h b/3rdparty/CGAL/include/CGAL/QP_solver/assertions.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/QP_solver/assertions.h
rename to 3rdparty/CGAL/include/CGAL/QP_solver/assertions.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/QP_solver/basic.h b/3rdparty/CGAL/include/CGAL/QP_solver/basic.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/QP_solver/basic.h
rename to 3rdparty/CGAL/include/CGAL/QP_solver/basic.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/QP_solver/debug.h b/3rdparty/CGAL/include/CGAL/QP_solver/debug.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/QP_solver/debug.h
rename to 3rdparty/CGAL/include/CGAL/QP_solver/debug.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/QP_solver/functors.h b/3rdparty/CGAL/include/CGAL/QP_solver/functors.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/QP_solver/functors.h
rename to 3rdparty/CGAL/include/CGAL/QP_solver/functors.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/AlphaShapeGraphicsItem.h b/3rdparty/CGAL/include/CGAL/Qt/AlphaShapeGraphicsItem.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/AlphaShapeGraphicsItem.h
rename to 3rdparty/CGAL/include/CGAL/Qt/AlphaShapeGraphicsItem.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/ApolloniusGraphGraphicsItem.h b/3rdparty/CGAL/include/CGAL/Qt/ApolloniusGraphGraphicsItem.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/ApolloniusGraphGraphicsItem.h
rename to 3rdparty/CGAL/include/CGAL/Qt/ApolloniusGraphGraphicsItem.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/CGAL_Qt_config.h b/3rdparty/CGAL/include/CGAL/Qt/CGAL_Qt_config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/CGAL_Qt_config.h
rename to 3rdparty/CGAL/include/CGAL/Qt/CGAL_Qt_config.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/CircularArcGraphicsItem.h b/3rdparty/CGAL/include/CGAL/Qt/CircularArcGraphicsItem.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/CircularArcGraphicsItem.h
rename to 3rdparty/CGAL/include/CGAL/Qt/CircularArcGraphicsItem.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/ConstrainedTriangulationGraphicsItem.h b/3rdparty/CGAL/include/CGAL/Qt/ConstrainedTriangulationGraphicsItem.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/ConstrainedTriangulationGraphicsItem.h
rename to 3rdparty/CGAL/include/CGAL/Qt/ConstrainedTriangulationGraphicsItem.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/Converter.h b/3rdparty/CGAL/include/CGAL/Qt/Converter.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/Converter.h
rename to 3rdparty/CGAL/include/CGAL/Qt/Converter.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/CreateOpenGLContext.h b/3rdparty/CGAL/include/CGAL/Qt/CreateOpenGLContext.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/CreateOpenGLContext.h
rename to 3rdparty/CGAL/include/CGAL/Qt/CreateOpenGLContext.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/DelaunayMeshTriangulationGraphicsItem.h b/3rdparty/CGAL/include/CGAL/Qt/DelaunayMeshTriangulationGraphicsItem.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/DelaunayMeshTriangulationGraphicsItem.h
rename to 3rdparty/CGAL/include/CGAL/Qt/DelaunayMeshTriangulationGraphicsItem.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/DemosMainWindow.h b/3rdparty/CGAL/include/CGAL/Qt/DemosMainWindow.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/DemosMainWindow.h
rename to 3rdparty/CGAL/include/CGAL/Qt/DemosMainWindow.h
diff --git a/3rdparty/CGAL/include/CGAL/Qt/DemosMainWindow_impl.h b/3rdparty/CGAL/include/CGAL/Qt/DemosMainWindow_impl.h
new file mode 100644
index 0000000..3c035ec
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Qt/DemosMainWindow_impl.h
@@ -0,0 +1,474 @@
+// Copyright (c) 2008  GeometryFactory Sarl (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
+// 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(s)     : Andreas Fabri <Andreas.Fabri at geometryfactory.com>
+//                 Laurent Rineau <Laurent.Rineau at geometryfactory.com>
+   
+#ifdef CGAL_HEADER_ONLY
+#define CGAL_INLINE_FUNCTION inline
+#else
+#define CGAL_INLINE_FUNCTION
+#endif
+
+#include <CGAL/Qt/GraphicsViewNavigation.h>
+#include <QApplication>
+#include <QLabel>
+#include <QFile>
+#include <QFileDialog>
+#include <QFileInfo>
+#include <QMenu>
+#include <QMenuBar>
+#include <QAction>
+#include <QMessageBox>
+#include <QStatusBar>
+#include <QGraphicsView>
+#include <QGLWidget>
+#include <QTextStream>
+#include <QSettings>
+#include <QUrl>
+#include <QDesktopWidget>
+#include <QRegExp>
+#include <QSvgGenerator>
+#include <QtCore>
+#include <QtOpenGL>
+
+#include <CGAL/config.h> // needed to get CGAL_VERSION_STR
+#include <CGAL/Qt/DemosMainWindow.h>
+#include <iostream>
+
+namespace CGAL {
+namespace Qt {
+
+CGAL_INLINE_FUNCTION
+DemosMainWindow::DemosMainWindow(QWidget * parent, ::Qt::WindowFlags flags)
+  : QMainWindow(parent, flags),
+    maxNumRecentFiles(10),
+    recentFileActs(maxNumRecentFiles)
+{
+  // prepare the QLabel xycoord for inclusion in the statusBar()
+  xycoord = new QLabel(" -0.00000 , -0.00000 ", this);
+  xycoord->setAlignment(::Qt::AlignHCenter);
+  xycoord->setMinimumSize(xycoord->sizeHint());
+  xycoord->clear();
+
+  actionUse_OpenGL = new QAction(this);
+  actionUse_OpenGL->setObjectName("actionUse_OpenGL");
+  actionUse_OpenGL->setCheckable(true);
+  actionUse_OpenGL->setText(tr("Use &OpenGL"));
+  actionUse_OpenGL->setStatusTip(tr("Make Qt use OpenGL to display the graphical items, instead of its native painting system."));
+  actionUse_OpenGL->setShortcut(tr("Ctrl+G"));
+
+  actionUse_Antialiasing = new QAction(this);
+  actionUse_Antialiasing->setObjectName("actionUse_Antialiasing");
+  actionUse_Antialiasing->setCheckable(true);
+  actionUse_Antialiasing->setText(tr("Use &anti-aliasing"));
+  actionUse_Antialiasing->setStatusTip(tr("Make Qt use anti-aliasing when displaying the graphical items."));
+  actionUse_Antialiasing->setShortcut(tr("Ctrl+A"));
+
+  actionAboutCGAL = new QAction(this);
+  actionAboutCGAL->setObjectName("actionAboutCGAL");
+  actionAboutCGAL->setText(tr("About &CGAL..."));
+
+  actionAbout = new QAction(this);
+  actionAbout->setObjectName("actionAbout");
+  actionAbout->setText(tr("&About..."));
+
+  setAcceptDrops(true);
+}
+
+CGAL_INLINE_FUNCTION
+DemosMainWindow::~DemosMainWindow()
+{
+}
+
+CGAL_INLINE_FUNCTION
+void 
+DemosMainWindow::dragEnterEvent(QDragEnterEvent *event)
+{
+  if (event->mimeData()->hasFormat("text/uri-list"))
+    event->acceptProposedAction();
+}
+
+CGAL_INLINE_FUNCTION
+void 
+DemosMainWindow::dropEvent(QDropEvent *event)
+{
+  Q_FOREACH(QUrl url, event->mimeData()->urls()) {
+    QString filename = url.toLocalFile();
+    this->open(filename);
+  }
+  event->acceptProposedAction();
+}
+
+CGAL_INLINE_FUNCTION
+void
+DemosMainWindow::addNavigation(QGraphicsView* graphicsView)
+{
+  navigation = new CGAL::Qt::GraphicsViewNavigation();
+  graphicsView->viewport()->installEventFilter(navigation);
+  graphicsView->installEventFilter(navigation);
+  QObject::connect(navigation, SIGNAL(mouseCoordinates(QString)),
+		   xycoord, SLOT(setText(QString)));
+  view = graphicsView;
+}
+
+CGAL_INLINE_FUNCTION
+void
+DemosMainWindow::setupStatusBar()
+{
+  this->statusBar()->addWidget(new QLabel(this), 1);
+  this->statusBar()->addWidget(xycoord, 0);
+}
+
+CGAL_INLINE_FUNCTION
+void
+DemosMainWindow::setupOptionsMenu(QMenu* menuOptions)
+{
+  // search for the Options menu
+  if(!menuOptions) {
+    menuOptions = getMenu("menuOptions", tr("&Options"));
+  }
+
+  // if not found, then create it
+  if(!menuOptions) {
+    menuOptions = new QMenu(this->menuBar());
+    menuOptions->setTitle(tr("&Options"));
+    this->menuBar()->addAction(menuOptions->menuAction());
+    menuOptions->setObjectName("menuOptions");
+  }
+
+  if(!menuOptions->isEmpty()) {
+    menuOptions->addSeparator();
+  }
+  menuOptions->addAction(actionUse_OpenGL);
+  menuOptions->addAction(actionUse_Antialiasing);
+  connect(actionUse_Antialiasing, SIGNAL(toggled(bool)),
+          this, SLOT(setUseAntialiasing(bool)));
+  connect(actionUse_OpenGL, SIGNAL(toggled(bool)),
+          this, SLOT(setUseOpenGL(bool)));
+  actionUse_Antialiasing->setChecked(true);
+}
+
+CGAL_INLINE_FUNCTION
+void
+DemosMainWindow::setupExportSVG(QAction* action, QGraphicsView* view)
+{
+  this->view = view;
+  connect(action, SIGNAL(triggered(bool)),
+	  this, SLOT(exportSVG()));
+}
+
+CGAL_INLINE_FUNCTION
+void DemosMainWindow::exportSVG()
+{
+  QString fileName = QFileDialog::getSaveFileName(this,
+						  tr("Export to SVG"),
+						  ".",
+						  tr("SVG (*.svg)\n"));
+
+  QSvgGenerator svg;
+  svg.setFileName(fileName);
+
+  svg.setSize(this->view->size());
+  svg.setViewBox(this->view->sceneRect());
+  svg.setTitle(tr("%1 drawing").arg(qApp->applicationName()));
+  svg.setDescription(tr("Generated using %1").arg(qApp->applicationName()));
+
+  QPainter painter;
+  painter.begin(&svg);
+  this->view->render(&painter);
+  painter.end();
+}
+
+CGAL_INLINE_FUNCTION
+void
+DemosMainWindow::setUseAntialiasing(bool checked)
+{
+  view->setRenderHint(QPainter::Antialiasing, checked);
+  view->setRenderHint(QPainter::HighQualityAntialiasing, checked);
+
+  statusBar()->showMessage(tr("Antialiasing %1activated").arg(checked?"":"de-"),
+                           1000);
+}
+
+CGAL_INLINE_FUNCTION
+void
+DemosMainWindow::setUseOpenGL(bool checked)
+{ 
+  if(checked) {
+    QGLWidget* new_viewport = new QGLWidget;
+
+    // Setup the format to allow antialiasing with OpenGL:
+    // one need to activate the SampleBuffers, if the graphic driver allows
+    // this.
+    QGLFormat glformat = new_viewport->format();
+    glformat.setOption(QGL::SampleBuffers);
+    new_viewport->setFormat(glformat);
+
+    view->setViewport(new_viewport);
+  }
+  else {
+    view->setViewport(new QWidget);
+  }
+  statusBar()->showMessage(tr("OpenGL %1activated").arg(checked?"":"de-"),
+                           1000);
+  view->viewport()->installEventFilter(navigation);
+  view->setFocus();
+}
+
+CGAL_INLINE_FUNCTION
+QMenu* 
+DemosMainWindow::getMenu(QString objectName, QString title)
+{
+  QMenu* menu = NULL;
+
+  QString title2 = title;
+  title2.remove('&');
+  // search if a menu has objectName()==objectName
+  menu = this->findChild<QMenu*>(objectName);
+
+  // then search if a menu has title()==title
+  if(menu) {
+    return menu;
+  } else {
+    Q_FOREACH(menu, this->findChildren<QMenu*>()) {
+      if(menu->title() == title ||
+         menu->title() == title2) {
+        return menu;
+      }
+    }
+  }
+  return NULL;
+}
+
+CGAL_INLINE_FUNCTION
+void 
+DemosMainWindow::popupAboutBox(QString title, QString html_resource_name)
+{
+  QFile about_CGAL(html_resource_name);
+  about_CGAL.open(QIODevice::ReadOnly);
+  QString about_CGAL_txt = QTextStream(&about_CGAL).readAll();
+#ifdef CGAL_VERSION_STR
+  QString cgal_version(CGAL_VERSION_STR);
+#  ifdef CGAL_FAKE_PUBLIC_RELEASE
+  cgal_version.replace(QRegExp("-Ic?.*"), "");
+#  endif
+  about_CGAL_txt.replace("<!--CGAL_VERSION-->",
+                         QString(" (version %1)")
+                         .arg(cgal_version));
+#endif
+  QMessageBox mb(QMessageBox::NoIcon,
+                 title,
+                 about_CGAL_txt,
+                 QMessageBox::Ok,
+                 this);
+
+  QLabel* mb_label = mb.findChild<QLabel*>("qt_msgbox_label");
+  if(mb_label) {
+    mb_label->setTextInteractionFlags(mb_label->textInteractionFlags() | 
+                                      ::Qt::LinksAccessibleByMouse | 
+                                      ::Qt::LinksAccessibleByKeyboard);
+  }
+  else {
+    std::cerr << "Cannot find child \"qt_msgbox_label\" in QMessageBox\n"
+              << "  with Qt version " << QT_VERSION_STR << "!\n";
+  }
+  mb.exec();
+}
+
+CGAL_INLINE_FUNCTION
+QMenu* DemosMainWindow::getHelpMenu()
+{
+  QMenu* menuHelp = getMenu("menuHelp", tr("&Help"));
+  if(!menuHelp) {
+    menuHelp = new QMenu(this->menuBar());
+    menuHelp->setTitle(tr("&Help"));
+    this->menuBar()->addAction(menuHelp->menuAction());
+    menuHelp->setObjectName("menuHelp");
+  }
+  return menuHelp;
+}
+
+CGAL_INLINE_FUNCTION
+void 
+DemosMainWindow::addAboutCGAL(QMenu* menuHelp)
+{
+  if(!menuHelp) {
+    menuHelp = getHelpMenu();
+  }
+  menuHelp->addAction(actionAboutCGAL);
+
+  connect(actionAboutCGAL, SIGNAL(triggered()),
+          this, SLOT(popupAboutCGAL()));
+}
+
+CGAL_INLINE_FUNCTION
+void 
+DemosMainWindow::addAboutDemo(QString htmlResourceName, QMenu* menuHelp)
+{
+  if(!menuHelp) {
+    menuHelp = getHelpMenu();
+  }
+  menuHelp->addAction(actionAbout);
+  aboutHtmlResource = htmlResourceName;
+
+  connect(actionAbout, SIGNAL(triggered()),
+          this, SLOT(popupAboutDemo()));
+}
+
+CGAL_INLINE_FUNCTION
+void
+DemosMainWindow::popupAboutCGAL()
+{
+  popupAboutBox(tr("About CGAL..."),
+                ":/cgal/help/about_CGAL.html");
+}
+
+CGAL_INLINE_FUNCTION
+void
+DemosMainWindow::popupAboutDemo()
+{
+  popupAboutBox(tr("About the demo..."),
+                aboutHtmlResource);
+}
+
+CGAL_INLINE_FUNCTION
+void
+DemosMainWindow::setMaxNumberOfRecentFiles(const unsigned int i)
+{
+  maxNumRecentFiles = i;
+  recentFileActs.resize(maxNumRecentFiles);
+}
+
+CGAL_INLINE_FUNCTION
+unsigned int 
+DemosMainWindow::maxNumberOfRecentFiles() const
+{
+  return maxNumRecentFiles;
+}
+
+CGAL_INLINE_FUNCTION
+void 
+DemosMainWindow::openRecentFile_aux()
+{
+  QAction *action = qobject_cast<QAction *>(sender());
+  if (action)
+    Q_EMIT openRecentFile(action->data().toString());
+}
+
+CGAL_INLINE_FUNCTION
+void 
+DemosMainWindow::addToRecentFiles(QString fileName)
+{
+  QSettings settings;
+  QStringList files = settings.value("recentFileList").toStringList();
+  files.removeAll(fileName);
+  files.prepend(fileName);
+  while (files.size() > (int)maxNumberOfRecentFiles())
+    files.removeLast();
+
+  settings.setValue("recentFileList", files);
+
+  updateRecentFileActions();
+}
+
+CGAL_INLINE_FUNCTION
+void
+DemosMainWindow::addRecentFiles(QMenu* menu, QAction* insertBeforeAction)
+{
+  if(!insertBeforeAction) {
+    recentFilesSeparator = menu->addSeparator();
+  }
+
+  for (unsigned int i = 0; i < maxNumberOfRecentFiles(); ++i) {
+    recentFileActs[i] = new QAction(this);
+    recentFileActs[i]->setVisible(false);
+    connect(recentFileActs[i], SIGNAL(triggered()),
+            this, SLOT(openRecentFile_aux()));
+    if(insertBeforeAction)
+      menu->insertAction(insertBeforeAction, recentFileActs[i]);
+    else
+      menu->addAction(recentFileActs[i]);
+  }
+
+  if(insertBeforeAction) {
+    recentFilesSeparator = menu->insertSeparator(insertBeforeAction);
+  }
+
+  recentFilesSeparator->setVisible(false);
+
+  updateRecentFileActions();
+}
+
+CGAL_INLINE_FUNCTION
+void 
+DemosMainWindow::updateRecentFileActions()
+{
+  QSettings settings;
+  QStringList files = settings.value("recentFileList").toStringList();
+
+  int numRecentFiles = qMin(files.size(), (int)this->maxNumberOfRecentFiles());
+  
+  for (int i = 0; i < numRecentFiles; ++i) {
+    QString strippedName = QFileInfo(files[i]).fileName();
+    QString text = tr("&%1 %2").arg(i).arg(strippedName);
+    recentFileActs[i]->setText(text);
+    recentFileActs[i]->setData(files[i]);
+    recentFileActs[i]->setVisible(true);
+  }
+  for (unsigned int j = numRecentFiles; j < maxNumberOfRecentFiles(); ++j)
+    recentFileActs[j]->setVisible(false);
+  
+  recentFilesSeparator->setVisible(numRecentFiles > 0);
+}
+
+CGAL_INLINE_FUNCTION
+void DemosMainWindow::writeState(QString groupname)
+{
+  QSettings settings;
+
+  settings.beginGroup(groupname);
+  settings.setValue("size", size());
+  settings.setValue("pos", pos());
+  settings.setValue("state", saveState());
+  settings.endGroup();
+}
+
+CGAL_INLINE_FUNCTION
+void DemosMainWindow::readState(QString groupname, Options /*what_to_save*/)
+{
+  QSettings settings;
+  
+  settings.beginGroup(groupname);
+  resize(settings.value("size", this->size()).toSize());
+
+  QDesktopWidget* desktop = qApp->desktop();
+  QPoint pos = settings.value("pos", this->pos()).toPoint();
+  if(desktop->availableGeometry(pos).contains(pos)) {
+    move(pos);
+  }
+  QByteArray mainWindowState = settings.value("state").toByteArray();
+  if(!mainWindowState.isNull()) {
+    this->restoreState(mainWindowState);
+  }
+  settings.endGroup();
+}
+
+
+} // namespace Qt
+} // namespace CGAL
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/GraphicsItem.h b/3rdparty/CGAL/include/CGAL/Qt/GraphicsItem.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/GraphicsItem.h
rename to 3rdparty/CGAL/include/CGAL/Qt/GraphicsItem.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/GraphicsViewCircleInput.h b/3rdparty/CGAL/include/CGAL/Qt/GraphicsViewCircleInput.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/GraphicsViewCircleInput.h
rename to 3rdparty/CGAL/include/CGAL/Qt/GraphicsViewCircleInput.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/GraphicsViewCircularArcInput.h b/3rdparty/CGAL/include/CGAL/Qt/GraphicsViewCircularArcInput.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/GraphicsViewCircularArcInput.h
rename to 3rdparty/CGAL/include/CGAL/Qt/GraphicsViewCircularArcInput.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/GraphicsViewInput.h b/3rdparty/CGAL/include/CGAL/Qt/GraphicsViewInput.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/GraphicsViewInput.h
rename to 3rdparty/CGAL/include/CGAL/Qt/GraphicsViewInput.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/GraphicsViewIsoRectangleInput.h b/3rdparty/CGAL/include/CGAL/Qt/GraphicsViewIsoRectangleInput.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/GraphicsViewIsoRectangleInput.h
rename to 3rdparty/CGAL/include/CGAL/Qt/GraphicsViewIsoRectangleInput.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/GraphicsViewLineInput.h b/3rdparty/CGAL/include/CGAL/Qt/GraphicsViewLineInput.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/GraphicsViewLineInput.h
rename to 3rdparty/CGAL/include/CGAL/Qt/GraphicsViewLineInput.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/GraphicsViewNavigation.h b/3rdparty/CGAL/include/CGAL/Qt/GraphicsViewNavigation.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/GraphicsViewNavigation.h
rename to 3rdparty/CGAL/include/CGAL/Qt/GraphicsViewNavigation.h
diff --git a/3rdparty/CGAL/include/CGAL/Qt/GraphicsViewNavigation_impl.h b/3rdparty/CGAL/include/CGAL/Qt/GraphicsViewNavigation_impl.h
new file mode 100644
index 0000000..09d8149
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Qt/GraphicsViewNavigation_impl.h
@@ -0,0 +1,351 @@
+// Copyright (c) 2008  GeometryFactory Sarl (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
+// 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(s)     : Andreas Fabri <Andreas.Fabri at geometryfactory.com>
+//                 Laurent Rineau <Laurent.Rineau at geometryfactory.com>
+   
+#ifdef CGAL_HEADER_ONLY
+#define CGAL_INLINE_FUNCTION inline
+#else
+#define CGAL_INLINE_FUNCTION
+#endif
+
+#include <CGAL/Qt/GraphicsViewNavigation.h>
+#include <CGAL/Qt/utility.h> // for mapToScene(QGraphicsView*, QRect)
+#include <cmath>
+#include <iostream>
+#include <boost/format.hpp>
+
+#include <QEvent>
+#include <QMouseEvent>
+#include <QWheelEvent>
+#include <QGraphicsView>
+#include <QGraphicsScene>
+#include <QGraphicsRectItem>
+#include <QFlags>
+#include <QScrollBar>
+
+namespace CGAL {
+namespace Qt {
+
+  CGAL_INLINE_FUNCTION
+  GraphicsViewNavigation::GraphicsViewNavigation()
+    : rectItem(new QGraphicsRectItem),
+      dragging(false)
+  {
+    QColor rect_color(250, 221, 0);
+    rect_color.setAlpha(50);
+    rectItem->setBrush(rect_color);
+    rect_color.setAlpha(255);
+    rectItem->setPen(QPen(rect_color, 0, ::Qt::DashLine));
+    rectItem->hide();
+    rectItem->setZValue(10000);
+  }
+
+  CGAL_INLINE_FUNCTION
+  GraphicsViewNavigation::~GraphicsViewNavigation()
+  {
+    delete rectItem;
+  }
+
+  CGAL_INLINE_FUNCTION
+  bool 
+  GraphicsViewNavigation::eventFilter(QObject *obj, QEvent *event)
+  {
+    QGraphicsView* v = qobject_cast<QGraphicsView*>(obj);
+    if(v == NULL) {
+      QWidget* viewport = qobject_cast<QWidget*>(obj);
+      if(viewport == NULL) {
+        return false;
+      }
+      v = qobject_cast<QGraphicsView*>(viewport->parent());
+      if(v == NULL) {
+        return false;
+      }
+    }
+    switch(event->type()) 
+    {
+    case QEvent::KeyPress: {
+      QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
+      int offset = 10;
+      if( (keyEvent->modifiers() & ::Qt::ShiftModifier)
+          || (keyEvent->modifiers() & ::Qt::ControlModifier) ) {
+        offset = 20;
+      }
+      switch (keyEvent->key()) {
+      case ::Qt::Key_Up:
+        translateView(v, 0, -offset);
+        break;
+      case ::Qt::Key_Down:
+        translateView(v, 0, offset);
+        break;
+      case ::Qt::Key_Left:
+        translateView(v, -offset, 0);
+        break;
+      case ::Qt::Key_Right:
+        translateView(v, offset, 0);
+        break;
+      case ::Qt::Key_PageUp:
+        v->rotate(-6);
+        break;
+      case ::Qt::Key_PageDown:
+        v->rotate(6);
+        break;
+      case ::Qt::Key_Plus:
+        scaleView(v, 1.2);
+        break;
+      case ::Qt::Key_Minus:
+        scaleView(v, 1 / 1.2);
+        break;
+      case ::Qt::Key_Control:
+        cursor_backup = v->cursor();
+        v->setCursor(::Qt::CrossCursor);
+      default:
+        return false;
+      }
+      //         display_parameters();
+      return true;
+      break;
+    } // end case KeyPress
+    case QEvent::KeyRelease: {
+      QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
+      if(keyEvent->key() == ::Qt::Key_Control) {
+        if(rectItem->isVisible() ) {
+          dragging = false;
+          v->scene()->removeItem(rectItem);
+          rectItem->hide();
+        }
+        v->setCursor(cursor_backup);
+        return true;
+      }
+      return false;
+      break;
+    } // end case KeyRelease
+    case QEvent::Wheel: {
+      QWheelEvent *wheelEvent = static_cast<QWheelEvent*>(event);
+      if(wheelEvent->orientation() != ::Qt::Vertical) {
+        return false;
+      }
+      double zoom_ratio = 240.0;
+      if( (wheelEvent->modifiers() & ::Qt::ShiftModifier)
+          || (wheelEvent->modifiers() & ::Qt::ControlModifier) ) {
+        zoom_ratio = 120.0;
+      }
+      scaleView(v, pow((double)2, -wheelEvent->delta() / zoom_ratio));
+
+      //         display_parameters();
+      return true;
+      break;
+    } // end case Wheel
+    case QEvent::MouseButtonPress: {
+      QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
+      if( (mouseEvent->modifiers() == (::Qt::ControlModifier | ::Qt::ShiftModifier))
+          && mouseEvent->button() == ::Qt::RightButton )
+      {
+        QPoint offset = mouseEvent->pos() - v->viewport()->rect().center();
+        translateView(v, offset.x(), offset.y());
+        return true;
+      }
+      else if( mouseEvent->modifiers() == ::Qt::ControlModifier ) {
+        if(mouseEvent->button() == ::Qt::LeftButton) {
+          rect_first_point = v->mapToScene(mouseEvent->pos());
+          rectItem->setRect(QRectF(rect_first_point, QSizeF(0.,0.)));
+          rectItem->show();
+          v->scene()->addItem(rectItem);
+          return true;
+        }
+        else if( mouseEvent->button() == ::Qt::RightButton) {
+          dragging = true;
+          dragging_start = v->mapToScene(mouseEvent->pos());
+          v->setCursor(::Qt::ClosedHandCursor);
+          return true;
+        }
+      }
+      return false;
+      break;
+    } // end case MouseRelease
+    case QEvent::MouseMove: {
+      QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
+      QPointF pos = v->mapToScene(mouseEvent->pos());
+      QString xy = QString(" ") + QString::number(pos.x(),'g', 6) + " , " + QString::number(pos.y(),'g', 6) + " ";
+      Q_EMIT mouseCoordinates(xy);
+      if(rectItem->isVisible()) {
+	QPointF size = v->mapToScene(mouseEvent->pos());
+	size = size - rect_first_point;
+        rectItem->setRect(rect_first_point.x(),
+			  rect_first_point.y(),
+			  size.x(),
+			  size.y());
+      }
+      if( dragging )
+      {
+//         std::cerr << boost::format("mouseMove: globalpos=(%1%, %2%)\n"
+//                                    "           pos=(%3%, %4%)\n"
+//                                    "           sender=%5% (class %6%), parent class %7%\n")
+//           % mouseEvent->globalPos().x()
+//           % mouseEvent->globalPos().y()
+//           % mouseEvent->pos().x()
+//           % mouseEvent->pos().y()
+//           % (&*obj)
+//           % obj->metaObject()->className()
+//           % obj->parent()->metaObject()->className();
+
+//         drag_to(mouseEvent->pos());
+      }
+      break;
+    } // end MouseMove
+    case QEvent::MouseButtonRelease: {
+      QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
+      if(rectItem->isVisible() && mouseEvent->button() == ::Qt::LeftButton){
+        v->setSceneRect(v->sceneRect() | rectItem->rect());
+        v->fitInView(rectItem->rect(), ::Qt::KeepAspectRatio);
+        v->scene()->removeItem(rectItem);
+        rectItem->hide();
+        return true;
+      }
+      else if(  mouseEvent->button() == ::Qt::RightButton ) {
+        if(dragging) {
+          dragging = false;
+          drag_to(v, mouseEvent->pos());
+          v->setCursor(cursor_backup);
+          return true;
+        }
+      }
+      return false;
+      break;
+    } // end MouseRelease
+    default:
+      return false;
+    } // end switch
+    return false;
+  }
+
+
+  CGAL_INLINE_FUNCTION
+  void 
+  GraphicsViewNavigation::scaleView(QGraphicsView* v, qreal scaleFactor)
+  {
+    QPointF center = v->mapToScene(v->viewport()->rect().center());
+//     qreal factor = v->matrix().scale(scaleFactor, scaleFactor).mapRect(QRectF(0, 0, 1, 1)).width();
+    //if (factor < 0.001 || factor > 2000)
+    //    return;
+
+    v->scale(scaleFactor, scaleFactor);
+    QPoint offset = v->mapFromScene(center) - v->viewport()->rect().center();
+    translateView(v, offset.x(), offset.y());
+  }
+
+  CGAL_INLINE_FUNCTION
+  void GraphicsViewNavigation::drag_to(QGraphicsView* v, QPoint new_pos)
+  {
+    QPoint dragging_start_in_view = v->mapFromScene(dragging_start);
+    QPoint offset = new_pos - dragging_start_in_view;
+//     std::cerr << boost::format("drag_to: origin=(%1%, %2%)\n"
+//                                "         offset=(%3%, %4%)\n")
+//       % dragging_start_in_view.x() % dragging_start_in_view.y()
+//       % offset.x() % offset.y();
+    translateView(v, -offset.x(), -offset.y());
+    dragging_start_in_view = v->mapFromScene(dragging_start);
+//     std::cerr << boost::format("         after=(%1%, %2%)\n")
+//       % dragging_start_in_view.x() % dragging_start_in_view.y();
+  }
+
+  CGAL_INLINE_FUNCTION
+  void GraphicsViewNavigation::translateView(QGraphicsView* v, int dx,  int dy)
+  {
+    if( dx == 0 && dy == 0 ) {
+      return;
+    }
+
+    int horizontalScrollBarValue = v->horizontalScrollBar()->value();
+    int verticalScrollBarValue = v->verticalScrollBar()->value();
+
+    if( (horizontalScrollBarValue + dx <= 
+         v->horizontalScrollBar()->maximum()) &&
+        (horizontalScrollBarValue + dx >=
+         v->horizontalScrollBar()->minimum()) &&
+        (verticalScrollBarValue + dy <= 
+         v->verticalScrollBar()->maximum()) &&
+        (verticalScrollBarValue + dy >=
+         v->verticalScrollBar()->minimum()) )
+    {
+      v->horizontalScrollBar()->setValue(horizontalScrollBarValue + dx);
+      v->verticalScrollBar()->setValue(verticalScrollBarValue + dy);
+    }
+    else
+    {
+      QRect vp_rect = v->viewport()->rect();
+      QPointF new_center = v->mapToScene(vp_rect.center() + QPoint(dx, dy));
+      vp_rect |= vp_rect.translated(dx, dy);
+      QRectF rect = mapToScene(v, vp_rect);
+      v->setSceneRect(v->sceneRect() | rect);
+      v->centerOn(new_center);
+
+      // QGraphicsView::centerOn makes rounding errors.
+      // The following two "if" make them unnoticable when dx==0 or dy==0.
+      if(dx == 0) {
+        v->horizontalScrollBar()->setValue(horizontalScrollBarValue);
+      }
+      if(dy == 0) {
+        v->verticalScrollBar()->setValue(verticalScrollBarValue);
+      }
+    }
+//     display_parameters();
+  }
+
+  CGAL_INLINE_FUNCTION
+  void GraphicsViewNavigation::display_parameters(QGraphicsView* v)
+  {
+    std::cerr << 
+      boost::format("matrix translation=(%1%, %2%)\n"
+                    "       rotation=(%3% - %4% )\n"
+                    "                (%5% - %6% )\n")
+      % v->matrix().dx()
+      % v->matrix().dy()
+      % v->matrix().m11()
+      % v->matrix().m12()
+      % v->matrix().m21()
+      % v->matrix().m22();
+
+    QRect vp_rect = v->viewport()->rect();
+    QPoint vp_top_left = vp_rect.topLeft();
+    QPoint vp_bottom_right = vp_rect.bottomRight();
+    QPointF top_left = v->mapToScene(vp_top_left);
+    QPointF bottom_right = v->mapToScene(vp_bottom_right);
+
+    std::cerr <<
+      boost::format("view=(%1% - %2%) x (%3% - %4%)\n")
+      % top_left.x() % bottom_right.x()
+      % top_left.y() % bottom_right.y();
+    std::cerr <<
+      boost::format("viewport=(%1% - %2%) x (%3% - %4%)\n")
+      % vp_top_left.x() % vp_bottom_right.x()
+      % vp_top_left.y() % vp_bottom_right.y();
+    std::cerr <<
+      boost::format("scrollbars=(%1% <= %2% <= %3%) x (%4% <= %5% <= %6%)\n")
+      % v->horizontalScrollBar()->minimum() 
+      % v->horizontalScrollBar()->value()
+      % v->horizontalScrollBar()->maximum()
+      % v->verticalScrollBar()->minimum() 
+      % v->verticalScrollBar()->value()
+      % v->verticalScrollBar()->maximum();
+  }
+
+} // namespace Qt
+} // namespace CGAL
+
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/GraphicsViewPointInput.h b/3rdparty/CGAL/include/CGAL/Qt/GraphicsViewPointInput.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/GraphicsViewPointInput.h
rename to 3rdparty/CGAL/include/CGAL/Qt/GraphicsViewPointInput.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/GraphicsViewPolygonWithHolesInput.h b/3rdparty/CGAL/include/CGAL/Qt/GraphicsViewPolygonWithHolesInput.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/GraphicsViewPolygonWithHolesInput.h
rename to 3rdparty/CGAL/include/CGAL/Qt/GraphicsViewPolygonWithHolesInput.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/GraphicsViewPolylineInput.h b/3rdparty/CGAL/include/CGAL/Qt/GraphicsViewPolylineInput.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/GraphicsViewPolylineInput.h
rename to 3rdparty/CGAL/include/CGAL/Qt/GraphicsViewPolylineInput.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/GraphicsViewPolylineInput_impl.h b/3rdparty/CGAL/include/CGAL/Qt/GraphicsViewPolylineInput_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/GraphicsViewPolylineInput_impl.h
rename to 3rdparty/CGAL/include/CGAL/Qt/GraphicsViewPolylineInput_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/LineGraphicsItem.h b/3rdparty/CGAL/include/CGAL/Qt/LineGraphicsItem.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/LineGraphicsItem.h
rename to 3rdparty/CGAL/include/CGAL/Qt/LineGraphicsItem.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/PainterOstream.h b/3rdparty/CGAL/include/CGAL/Qt/PainterOstream.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/PainterOstream.h
rename to 3rdparty/CGAL/include/CGAL/Qt/PainterOstream.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/PointsGraphicsItem.h b/3rdparty/CGAL/include/CGAL/Qt/PointsGraphicsItem.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/PointsGraphicsItem.h
rename to 3rdparty/CGAL/include/CGAL/Qt/PointsGraphicsItem.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/PointsInKdTreeGraphicsItem.h b/3rdparty/CGAL/include/CGAL/Qt/PointsInKdTreeGraphicsItem.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/PointsInKdTreeGraphicsItem.h
rename to 3rdparty/CGAL/include/CGAL/Qt/PointsInKdTreeGraphicsItem.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/PolygonGraphicsItem.h b/3rdparty/CGAL/include/CGAL/Qt/PolygonGraphicsItem.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/PolygonGraphicsItem.h
rename to 3rdparty/CGAL/include/CGAL/Qt/PolygonGraphicsItem.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/PolygonWithHolesGraphicsItem.h b/3rdparty/CGAL/include/CGAL/Qt/PolygonWithHolesGraphicsItem.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/PolygonWithHolesGraphicsItem.h
rename to 3rdparty/CGAL/include/CGAL/Qt/PolygonWithHolesGraphicsItem.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/PolylinesGraphicsItem.h b/3rdparty/CGAL/include/CGAL/Qt/PolylinesGraphicsItem.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/PolylinesGraphicsItem.h
rename to 3rdparty/CGAL/include/CGAL/Qt/PolylinesGraphicsItem.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/PowerdiagramGraphicsItem.h b/3rdparty/CGAL/include/CGAL/Qt/PowerdiagramGraphicsItem.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/PowerdiagramGraphicsItem.h
rename to 3rdparty/CGAL/include/CGAL/Qt/PowerdiagramGraphicsItem.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/RegularGridGraphicsItem.h b/3rdparty/CGAL/include/CGAL/Qt/RegularGridGraphicsItem.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/RegularGridGraphicsItem.h
rename to 3rdparty/CGAL/include/CGAL/Qt/RegularGridGraphicsItem.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/RegularGridVectorFieldGraphicsItem.h b/3rdparty/CGAL/include/CGAL/Qt/RegularGridVectorFieldGraphicsItem.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/RegularGridVectorFieldGraphicsItem.h
rename to 3rdparty/CGAL/include/CGAL/Qt/RegularGridVectorFieldGraphicsItem.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/RegularTriangulationGraphicsItem.h b/3rdparty/CGAL/include/CGAL/Qt/RegularTriangulationGraphicsItem.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/RegularTriangulationGraphicsItem.h
rename to 3rdparty/CGAL/include/CGAL/Qt/RegularTriangulationGraphicsItem.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/SegmentDelaunayGraphGraphicsItem.h b/3rdparty/CGAL/include/CGAL/Qt/SegmentDelaunayGraphGraphicsItem.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/SegmentDelaunayGraphGraphicsItem.h
rename to 3rdparty/CGAL/include/CGAL/Qt/SegmentDelaunayGraphGraphicsItem.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/SegmentDelaunayGraphLinfGraphicsItem.h b/3rdparty/CGAL/include/CGAL/Qt/SegmentDelaunayGraphLinfGraphicsItem.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/SegmentDelaunayGraphLinfGraphicsItem.h
rename to 3rdparty/CGAL/include/CGAL/Qt/SegmentDelaunayGraphLinfGraphicsItem.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/SegmentsGraphicsItem.h b/3rdparty/CGAL/include/CGAL/Qt/SegmentsGraphicsItem.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/SegmentsGraphicsItem.h
rename to 3rdparty/CGAL/include/CGAL/Qt/SegmentsGraphicsItem.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/StreamLinesGraphicsItem.h b/3rdparty/CGAL/include/CGAL/Qt/StreamLinesGraphicsItem.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/StreamLinesGraphicsItem.h
rename to 3rdparty/CGAL/include/CGAL/Qt/StreamLinesGraphicsItem.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/TriangulationGraphicsItem.h b/3rdparty/CGAL/include/CGAL/Qt/TriangulationGraphicsItem.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/TriangulationGraphicsItem.h
rename to 3rdparty/CGAL/include/CGAL/Qt/TriangulationGraphicsItem.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/VoronoiGraphicsItem.h b/3rdparty/CGAL/include/CGAL/Qt/VoronoiGraphicsItem.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/VoronoiGraphicsItem.h
rename to 3rdparty/CGAL/include/CGAL/Qt/VoronoiGraphicsItem.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/debug.h b/3rdparty/CGAL/include/CGAL/Qt/debug.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/debug.h
rename to 3rdparty/CGAL/include/CGAL/Qt/debug.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/debug_impl.h b/3rdparty/CGAL/include/CGAL/Qt/debug_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/debug_impl.h
rename to 3rdparty/CGAL/include/CGAL/Qt/debug_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/resources.h b/3rdparty/CGAL/include/CGAL/Qt/resources.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/resources.h
rename to 3rdparty/CGAL/include/CGAL/Qt/resources.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/resources_impl.h b/3rdparty/CGAL/include/CGAL/Qt/resources_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/resources_impl.h
rename to 3rdparty/CGAL/include/CGAL/Qt/resources_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/utility.h b/3rdparty/CGAL/include/CGAL/Qt/utility.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/utility.h
rename to 3rdparty/CGAL/include/CGAL/Qt/utility.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Qt/utility_impl.h b/3rdparty/CGAL/include/CGAL/Qt/utility_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Qt/utility_impl.h
rename to 3rdparty/CGAL/include/CGAL/Qt/utility_impl.h
diff --git a/3rdparty/CGAL/include/CGAL/Quotient.h b/3rdparty/CGAL/include/CGAL/Quotient.h
new file mode 100644
index 0000000..2617ac9
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Quotient.h
@@ -0,0 +1,879 @@
+// Copyright (c) 1999-2007  
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved. 
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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(s)     : Stefan Schirra, Sylvain Pion, Michael Hemmer
+
+// The template class Quotient<NT> is based on the LEDA class
+// leda_rational written by Stefan Naeher and Christian Uhrig.
+// It is basically a templated version with restricted functionality
+// of the version of rational in LEDA release 3.3.
+// The modification was done by Stefan.Schirra at mpi-sb.mpg.de
+
+// The include is done before the protect macro on purpose, because
+// of a cyclic dependency.
+
+#include <CGAL/number_type_basic.h>
+
+#ifndef CGAL_QUOTIENT_H
+#define CGAL_QUOTIENT_H
+
+#include <utility>
+#include <istream>
+
+#include <CGAL/Interval_nt.h>
+#include <CGAL/Kernel/mpl.h>
+
+#include <boost/operators.hpp>
+
+namespace CGAL {
+
+#define CGAL_int(T)    typename First_if_different<int,    T>::Type
+#define CGAL_double(T) typename First_if_different<double, T>::Type
+
+// Simplify the quotient numerator/denominator.
+// Currently the default template doesn't do anything.
+// This function is not documented as a number type requirement for now.
+template < typename NT >
+inline void
+simplify_quotient(NT &, NT &) {}
+
+// This one should be replaced by some functor or tag.
+// Meanwhile, the class is specialized for Gmpz, mpz_class, leda_integer.
+template < typename NT >
+struct Split_double
+{
+  void operator()(double d, NT &num, NT &den) const
+  {
+    num = NT(d);
+    den = 1;
+  }
+};
+
+
+template <class NT_>
+class Quotient
+  : boost::ordered_field_operators1< Quotient<NT_>
+  , boost::ordered_field_operators2< Quotient<NT_>, NT_
+  , boost::ordered_field_operators2< Quotient<NT_>, CGAL_int(NT_)
+  , boost::ordered_field_operators2< Quotient<NT_>, CGAL_double(NT_)
+    > > > >
+{
+ public:
+  typedef NT_        NT;
+
+  Quotient()
+    : num(0), den(1) {}
+
+  Quotient(const NT& n)
+    : num(n), den(1) {}
+
+  Quotient(const CGAL_double(NT) & n)
+  { Split_double<NT>()(n, num, den); }
+
+  Quotient(const CGAL_int(NT) & n)
+    : num(n), den(1) {}
+
+  template <class T>
+  explicit Quotient(const T& n) : num(n), den(1) {}
+
+  template <class T>
+  Quotient(const Quotient<T>& n) : num(n.numerator()), den(n.denominator()) {}
+
+  Quotient& operator=(const NT & n)
+  {
+    num = n;
+    den = 1;
+    return *this;
+  }
+
+  Quotient& operator=(const CGAL_double(NT) & n)
+  {
+    Split_double<NT>()(n, num, den);
+    return *this;
+  }
+
+  Quotient& operator=(const CGAL_int(NT) & n)
+  {
+    num = n;
+    den = 1;
+    return *this;
+  }
+
+#ifdef CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE
+
+  template <class T1, class T2>
+  Quotient(const T1& n, const T2& d) : num(n), den(d)
+  { CGAL_precondition( d != 0 ); }
+
+#else
+  template <class T1, class T2>
+  Quotient(T1 && n, T2 && d)
+     : num(std::forward<T1>(n)), den(std::forward<T2>(d))
+  { CGAL_postcondition( den != 0 ); }
+
+  Quotient(NT && n)
+    : num(std::move(n)), den(1) {}
+
+  Quotient& operator=(NT && n)
+  {
+    num = std::move(n);
+    den = 1;
+    return *this;
+  }
+#endif
+
+  Quotient<NT>& operator+= (const Quotient<NT>& r);
+  Quotient<NT>& operator-= (const Quotient<NT>& r);
+  Quotient<NT>& operator*= (const Quotient<NT>& r);
+  Quotient<NT>& operator/= (const Quotient<NT>& r);
+  Quotient<NT>& operator+= (const NT& r);
+  Quotient<NT>& operator-= (const NT& r);
+  Quotient<NT>& operator*= (const NT& r);
+  Quotient<NT>& operator/= (const NT& r);
+  Quotient<NT>& operator+= (const CGAL_int(NT)& r);
+  Quotient<NT>& operator-= (const CGAL_int(NT)& r);
+  Quotient<NT>& operator*= (const CGAL_int(NT)& r);
+  Quotient<NT>& operator/= (const CGAL_int(NT)& r);
+  Quotient<NT>& operator+= (const CGAL_double(NT)& r);
+  Quotient<NT>& operator-= (const CGAL_double(NT)& r);
+  Quotient<NT>& operator*= (const CGAL_double(NT)& r);
+  Quotient<NT>& operator/= (const CGAL_double(NT)& r);
+
+  Quotient<NT>&    normalize();
+
+  const NT&   numerator()   const { return num; }
+  const NT&   denominator() const { return den; }
+
+  void swap(Quotient &q)
+  {
+    using std::swap;
+    swap(num, q.num);
+    swap(den, q.den);
+  }
+
+#ifdef CGAL_ROOT_OF_2_ENABLE_HISTOGRAM_OF_NUMBER_OF_DIGIT_ON_THE_COMPLEX_CONSTRUCTOR
+  int tam() const { return std::max(num.tam(), den.tam()); }
+#endif
+
+ public:
+  NT   num;
+  NT   den;
+};
+
+template <class NT>
+inline
+void swap(Quotient<NT> &p, Quotient<NT> &q)
+{
+  p.swap(q);
+}
+
+template <class NT>
+CGAL_MEDIUM_INLINE
+Quotient<NT>&
+Quotient<NT>::normalize()
+{
+  if (num == den)
+  {
+      num = den = 1;
+      return *this;
+  }
+  if (-num == den)
+  {
+      num = -1;
+      den = 1;
+      return *this;
+  }
+  NT ggt = CGAL_NTS gcd(num, den);
+  if (ggt != 1 )
+  {
+      num = CGAL::integral_division(num, ggt);
+      den = CGAL::integral_division(den, ggt);
+  }
+  return *this;
+}
+
+template <class NT>
+CGAL_MEDIUM_INLINE
+Quotient<NT>&
+Quotient<NT>::operator+= (const Quotient<NT>& r)
+{
+    num = num * r.den + r.num * den;
+    den *= r.den;
+    simplify_quotient(num, den);
+    return *this;
+}
+
+template <class NT>
+CGAL_MEDIUM_INLINE
+Quotient<NT>&
+Quotient<NT>::operator-= (const Quotient<NT>& r)
+{
+    num = num * r.den - r.num * den;
+    den *= r.den;
+    simplify_quotient(num, den);
+    return *this;
+}
+
+template <class NT>
+CGAL_MEDIUM_INLINE
+Quotient<NT>&
+Quotient<NT>::operator*= (const Quotient<NT>& r)
+{
+    num *= r.num;
+    den *= r.den;
+    simplify_quotient(num, den);
+    return *this;
+}
+
+template <class NT>
+CGAL_MEDIUM_INLINE
+Quotient<NT>&
+Quotient<NT>::operator/= (const Quotient<NT>& r)
+{
+    CGAL_precondition( r.num != 0 );
+    num *= r.den;
+    den *= r.num;
+    simplify_quotient(num, den);
+    return *this;
+}
+
+template <class NT>
+CGAL_MEDIUM_INLINE
+Quotient<NT>&
+Quotient<NT>::operator+= (const NT& r)
+{
+    num += r * den;
+    return *this;
+}
+
+template <class NT>
+CGAL_MEDIUM_INLINE
+Quotient<NT>&
+Quotient<NT>::operator-= (const NT& r)
+{
+    num -= r * den;
+    return *this;
+}
+
+template <class NT>
+CGAL_MEDIUM_INLINE
+Quotient<NT>&
+Quotient<NT>::operator*= (const NT& r)
+{
+    num *= r;
+    return *this;
+}
+
+template <class NT>
+CGAL_MEDIUM_INLINE
+Quotient<NT>&
+Quotient<NT>::operator/= (const NT& r)
+{
+    CGAL_precondition( r != 0 );
+    den *= r;
+    return *this;
+}
+
+template <class NT>
+CGAL_MEDIUM_INLINE
+Quotient<NT>&
+Quotient<NT>::operator+= (const CGAL_int(NT)& r)
+{
+    num += r * den;
+    return *this;
+}
+
+template <class NT>
+CGAL_MEDIUM_INLINE
+Quotient<NT>&
+Quotient<NT>::operator-= (const CGAL_int(NT)& r)
+{
+    num -= r * den;
+    return *this;
+}
+
+template <class NT>
+CGAL_MEDIUM_INLINE
+Quotient<NT>&
+Quotient<NT>::operator*= (const CGAL_int(NT)& r)
+{
+    num *= r;
+    return *this;
+}
+
+template <class NT>
+CGAL_MEDIUM_INLINE
+Quotient<NT>&
+Quotient<NT>::operator/= (const CGAL_int(NT)& r)
+{
+    CGAL_precondition( r != 0 );
+    den *= r;
+    return *this;
+}
+
+template <class NT>
+CGAL_MEDIUM_INLINE
+Quotient<NT>&
+Quotient<NT>::operator+= (const CGAL_double(NT)& r)
+{
+  //num += r * den; 
+  NT r_num, r_den; 
+  Split_double<NT>()(r,r_num,r_den);
+  num = num*r_den + r_num*den;
+  den *=r_den; 
+  return *this;
+}
+
+template <class NT>
+CGAL_MEDIUM_INLINE
+Quotient<NT>&
+Quotient<NT>::operator-= (const CGAL_double(NT)& r)
+{
+  //num -= r * den;
+  NT r_num, r_den; 
+  Split_double<NT>()(r,r_num,r_den);
+  num =  num*r_den - r_num*den;
+  den *= r_den; 
+  return *this;
+}
+
+template <class NT>
+CGAL_MEDIUM_INLINE
+Quotient<NT>&
+Quotient<NT>::operator*= (const CGAL_double(NT)& r)
+{
+  // num *= r;
+  
+  NT r_num, r_den; 
+  Split_double<NT>()(r,r_num,r_den);
+  num *= r_num;
+  den *= r_den; 
+  return *this;
+}
+
+template <class NT>
+CGAL_MEDIUM_INLINE
+Quotient<NT>&
+Quotient<NT>::operator/= (const CGAL_double(NT)& r)
+{
+  CGAL_precondition( r != 0 );
+  NT r_num, r_den; 
+  Split_double<NT>()(r,r_num,r_den);
+  num *= r_den;
+  den *= r_num; 
+  return *this;
+}
+
+template <class NT>
+CGAL_MEDIUM_INLINE
+Comparison_result
+quotient_cmp(const Quotient<NT>& x, const Quotient<NT>& y)
+{
+    // No assumptions on the sign of  den  are made
+
+    // code assumes that SMALLER == - 1;
+    CGAL_precondition( SMALLER == static_cast<Comparison_result>(-1) );
+
+    int xsign = CGAL_NTS sign(x.num) * CGAL_NTS sign(x.den) ;
+    int ysign = CGAL_NTS sign(y.num) * CGAL_NTS sign(y.den) ;
+    if (xsign == 0) return static_cast<Comparison_result>(-ysign);
+    if (ysign == 0) return static_cast<Comparison_result>(xsign);
+    // now (x != 0) && (y != 0)
+    int diff = xsign - ysign;
+    if (diff == 0)
+    {
+        int msign = CGAL_NTS sign(x.den) * CGAL_NTS sign(y.den);
+        NT leftop  = x.num * y.den * msign;
+        NT rightop = y.num * x.den * msign;
+        return CGAL_NTS compare(leftop, rightop);
+    }
+    else
+    {
+        return (xsign < ysign) ? SMALLER : LARGER;
+    }
+}
+
+
+template <class NT>
+std::ostream&
+operator<<(std::ostream& s, const Quotient<NT>& r)
+{
+   return s << r.numerator() << '/' << r.denominator();
+}
+
+template <class NT>
+std::istream&
+operator>>(std::istream& in, Quotient<NT>& r)
+{
+  /* format  num/den  or simply  num  */
+
+  NT num,den=1;
+  in >> num;
+  if(!in) return in;
+  std::istream::sentry s(in); // skip whitespace
+  if(in.peek()!='/'){
+	  if(!in.good()){
+		  in.clear(std::ios_base::eofbit);
+		  // unlikely to be some other reason?
+	  }
+  } else {
+	  char c;
+	  in.get(c); // remove the '/'
+	  in >> den;
+	  if(!in) return in;
+  }
+  r=Quotient<NT>(num,den);
+  return in;
+}
+
+template< class NT >
+inline
+Quotient<NT>
+operator+( const Quotient<NT>& x ) {
+  return Quotient<NT>(x);
+}
+
+template <class NT>
+inline
+Quotient<NT>
+operator-(const Quotient<NT>& x)
+{ return Quotient<NT>(-x.num,x.den); }
+
+
+template <class NT>
+CGAL_MEDIUM_INLINE
+NT
+quotient_truncation(const Quotient<NT>& r)
+{ return (r.num / r.den); }
+
+
+
+template <class NT>
+CGAL_MEDIUM_INLINE
+bool
+operator==(const Quotient<NT>& x, const Quotient<NT>& y)
+{ return x.num * y.den == x.den * y.num; }
+
+template <class NT>
+CGAL_MEDIUM_INLINE
+bool
+operator==(const Quotient<NT>& x, const NT& y)
+{ return x.den * y == x.num; }
+
+template <class NT>
+inline
+bool
+operator==(const Quotient<NT>& x, const CGAL_int(NT) & y)
+{ return x.den * y == x.num; }
+
+template <class NT>
+inline
+bool
+operator==(const Quotient<NT>& x, const CGAL_double(NT) & y)
+{ return x.den * y == x.num; }
+
+
+
+template <class NT>
+CGAL_MEDIUM_INLINE
+bool
+operator<(const Quotient<NT>& x, const Quotient<NT>& y)
+{
+  return quotient_cmp(x,y) == SMALLER;
+}
+
+template <class NT>
+CGAL_MEDIUM_INLINE
+bool
+operator<(const Quotient<NT>& x, const NT& y)
+{
+  return quotient_cmp(x,Quotient<NT>(y)) == SMALLER;
+}
+
+template <class NT>
+CGAL_MEDIUM_INLINE
+bool
+operator<(const Quotient<NT>& x, const CGAL_int(NT)& y)
+{
+  return quotient_cmp(x,Quotient<NT>(y)) == SMALLER;
+}
+
+template <class NT>
+CGAL_MEDIUM_INLINE
+bool
+operator<(const Quotient<NT>& x, const CGAL_double(NT)& y)
+{
+  return quotient_cmp(x,Quotient<NT>(y)) == SMALLER;
+}
+
+
+template <class NT>
+inline
+bool
+operator>(const Quotient<NT>& x, const NT& y)
+{ return quotient_cmp(x,Quotient<NT>(y)) == LARGER; }
+
+template <class NT>
+inline
+bool
+operator>(const Quotient<NT>& x, const CGAL_int(NT)& y)
+{ return quotient_cmp(x, Quotient<NT>(y)) == LARGER; }
+
+template <class NT>
+inline
+bool
+operator>(const Quotient<NT>& x, const CGAL_double(NT)& y)
+{ return quotient_cmp(x, Quotient<NT>(y)) == LARGER; }
+
+
+template< class NT >
+class Is_valid< Quotient<NT> >
+  : public std::unary_function< Quotient<NT>, bool > {
+  public :
+    bool operator()( const Quotient<NT>& x ) const {
+      return is_valid(x.num) && is_valid(x.den);
+    }
+};
+
+
+template <class NT>
+inline
+const NT&
+denominator(const Quotient<NT>& q)
+{ return q.den ; }
+
+template <class NT>
+inline
+const NT&
+numerator(const Quotient<NT>& q)
+{ return q.num ; }
+
+// The min/max are functions are needed since LEDA defines template
+// min/max functions which clash with std::min/max with ADL.
+template <class NT>
+inline
+const Quotient<NT>&
+min
+BOOST_PREVENT_MACRO_SUBSTITUTION
+(const Quotient<NT>& p, const Quotient<NT>& q)
+{
+  return (std::min)(p, q);
+}
+template <class NT>
+inline
+const Quotient<NT>&
+max
+BOOST_PREVENT_MACRO_SUBSTITUTION
+(const Quotient<NT>& p, const Quotient<NT>& q)
+{
+  return (std::max)(p, q);
+}
+
+/*
+template <class NT>
+NT
+gcd(const NT&, const NT&)
+{ return NT(1); }
+*/
+
+#undef CGAL_double
+#undef CGAL_int
+
+//
+// Algebraic structure traits
+//
+namespace INTERN_QUOTIENT {
+  template< class NT, class Sqrt_functor >
+  class Sqrt_selector {
+    public:
+      class Sqrt
+        : public std::unary_function< NT, NT > {
+        public:
+          NT operator()( const NT& x ) const {
+            CGAL_precondition(x > 0);
+            return NT(CGAL_NTS sqrt(x.numerator()*x.denominator()),
+                      x.denominator());
+          }
+      };
+  };
+
+  template< class NT >
+  class Sqrt_selector< NT, Null_functor > {
+    public:
+      typedef Null_functor Sqrt;
+  };
+
+// TODO: Algebraic_category could be Field_with_sqrt_tag, if NT
+//       is INEXACT (because Sqrt can be inexact) and has a Sqrt-functor.
+template<class NT> class Algebraic_structure_traits_quotient_base;
+
+template< class NT > class Algebraic_structure_traits_quotient_base< Quotient<NT> >
+  : public Algebraic_structure_traits_base< Quotient<NT>, Field_tag >  {
+
+public:
+    typedef Quotient<NT> Type;
+
+    typedef typename Algebraic_structure_traits<NT>::Is_exact        Is_exact;
+    typedef Tag_false Is_numerical_sensitive;
+
+
+
+    class Is_square
+        : public std::binary_function< Quotient<NT>, Quotient<NT>&, bool > {
+    public:
+        bool operator()( Quotient<NT> x, Quotient<NT>& y ) const {
+            NT x_num, x_den, y_num, y_den;
+            x.normalize();
+            x_num = x.numerator();
+            x_den = x.denominator();
+
+            typename Algebraic_structure_traits<NT>::Is_square is_square;
+            bool num_is_square = is_square(x_num,y_num);
+            bool den_is_square = is_square(x_den,y_den);
+            y= Quotient<NT>(y_num,y_den);
+            return num_is_square && den_is_square;
+        }
+        bool operator()(Quotient<NT> x) const {
+            x.normalize();
+            typename Algebraic_structure_traits<NT>::Is_square is_square;
+            return is_square(x.numerator())&&is_square(x.denominator());
+        }
+
+    };
+
+    typedef typename boost::mpl::if_c<
+        !boost::is_same< typename Algebraic_structure_traits<NT>::Sqrt,
+                         Null_functor >::value,
+         typename INTERN_QUOTIENT::Sqrt_selector< Type,
+                                                  Is_exact >::Sqrt,
+         Null_functor
+                            >::type Sqrt;
+
+    class Simplify
+      : public std::unary_function< Type&, void > {
+      public:
+        void operator()( Type& x) const {
+            x.normalize();
+        }
+    };
+};
+
+
+template<class NT> class Real_embeddable_traits_quotient_base;
+// Real embeddable traits
+template < class NT > class Real_embeddable_traits_quotient_base< Quotient<NT> >
+  : public INTERN_RET::Real_embeddable_traits_base< Quotient<NT>,
+                  typename Real_embeddable_traits< NT >::Is_real_embeddable > {
+  public:
+    typedef Quotient<NT> Type;
+
+    class Compare
+      : public std::binary_function< Type, Type,
+                                Comparison_result > {
+      public:
+        Comparison_result operator()( const Type& x,
+                                            const Type& y ) const {
+          return quotient_cmp(x, y);
+        }
+    };
+
+    class To_double
+      : public std::unary_function< Type, double > {
+      public:
+        double operator()( const Type& x ) const {
+        // Original global function was marked with an TODO!!
+          if (x.num == 0 )
+            return 0;
+
+          double nd = CGAL_NTS to_double( x.num );
+
+          if (x.den == 1 )
+            return nd;
+
+          double dd = CGAL_NTS to_double( x.den );
+
+          if ( CGAL_NTS is_finite( x.den ) && CGAL_NTS is_finite( x.num ) )
+            return nd/dd;
+
+          if ( CGAL_NTS abs(x.num) > CGAL_NTS abs(x.den) )
+          {
+              NT  nt_div = x.num / x.den;
+              double divd = CGAL_NTS to_double(nt_div);
+              if ( divd >= std::ldexp(1.0,53) )
+              { return divd; }
+          }
+          if ( CGAL_NTS abs(x.num) < CGAL_NTS abs(x.den) )
+          { return 1.0 / CGAL_NTS to_double( NT(1) / x ); }
+
+          return nd/dd;
+        }
+    };
+
+    class To_interval
+      : public std::unary_function< Type, std::pair< double, double > > {
+      public:
+        std::pair<double, double> operator()( const Type& x ) const {
+          Interval_nt<> quot =
+                          Interval_nt<>(CGAL_NTS to_interval(x.numerator())) /
+                          Interval_nt<>(CGAL_NTS to_interval(x.denominator()));
+          return std::make_pair(quot.inf(), quot.sup());
+        }
+    };
+
+    class Is_finite
+      : public std::unary_function< Type, bool > {
+      public:
+        bool operator()( const Type& x ) const {
+          return CGAL_NTS is_finite(x.num) && CGAL_NTS is_finite(x.den);
+        }
+    };
+};
+} // namespace INTERN_QUOTIENT
+
+template< class NT > class Algebraic_structure_traits< Quotient<NT> >
+    : public INTERN_QUOTIENT::Algebraic_structure_traits_quotient_base<
+Quotient<NT> >{};
+
+template< class NT > class Real_embeddable_traits< Quotient<NT> >
+    : public INTERN_QUOTIENT::Real_embeddable_traits_quotient_base<
+Quotient<NT> >{};
+
+
+// self coercion
+CGAL_DEFINE_COERCION_TRAITS_FOR_SELF_TEM( Quotient<NT>, class NT)
+
+// from int to Quotient
+template <class NT>
+struct Coercion_traits<typename First_if_different<int, NT>::Type,Quotient<NT> >
+{
+    typedef Tag_true  Are_explicit_interoperable;
+    typedef Tag_true  Are_implicit_interoperable;
+    typedef Quotient<NT> Type;
+    struct Cast{
+        typedef Type result_type;
+        Type operator()(const Quotient<NT>& x)   const { return x;}
+        Type operator()(
+                const typename First_if_different<int, NT>::Type& x) const {
+            return Type(x);}
+    };
+};
+template <class NT>
+struct Coercion_traits<Quotient<NT>,typename First_if_different<int, NT>::Type>
+    :public Coercion_traits<typename First_if_different<int, NT>::Type,
+Quotient<NT> >{};
+
+// from double to Quotient
+template <class NT>
+struct Coercion_traits<typename First_if_different<double, NT>::Type,
+Quotient<NT> >{
+    typedef Tag_true  Are_explicit_interoperable;
+    typedef Tag_true  Are_implicit_interoperable;
+    typedef Quotient<NT> Type;
+    struct Cast{
+        typedef Type result_type;
+        Type operator()(const Quotient<NT>& x)   const { return x;}
+        Type operator()(
+                const typename First_if_different<double, NT>::Type& x) const {
+            return Type(x);}
+    };
+};
+template <class NT>
+struct Coercion_traits<Quotient<NT>,
+typename First_if_different<double, NT>::Type>
+    :public Coercion_traits<typename First_if_different<double, NT>::Type,
+Quotient<NT> >
+{};
+
+// from NT to Quotient
+CGAL_DEFINE_COERCION_TRAITS_FROM_TO_TEM ( NT, Quotient<NT>, class NT)
+
+/*! \ingroup NiX_Fraction_traits_spec
+ *  \brief Specialization of Fraction_traits for Quotient<NT>
+ */
+template <class NT>
+class Fraction_traits< Quotient<NT> > {
+public:
+    typedef Quotient<NT> Type;
+    typedef ::CGAL::Tag_true Is_fraction;
+    typedef NT Numerator_type;
+    typedef Numerator_type Denominator_type;
+
+    //TODO: check whether Numerator_type has a GCD.
+    //will use Scalar_factor from Scalar_factor_traits (not implemented yet)
+    //for more details see EXACUS:NumeriX/include/NiX/Scalar_factor_traits.h
+    typedef typename Algebraic_structure_traits< Numerator_type >::Gcd Common_factor;
+
+    class Decompose {
+    public:
+        typedef Type first_argument_type;
+        typedef Numerator_type& second_argument_type;
+        typedef Numerator_type& third_argument_type;
+        void operator () (
+                const Type& rat,
+                Numerator_type& num,
+                Numerator_type& den) {
+            num = rat.numerator();
+            den = rat.denominator();
+        }
+    };
+
+    class Compose {
+    public:
+        typedef Numerator_type first_argument_type;
+        typedef Numerator_type second_argument_type;
+        typedef Type result_type;
+        Type operator ()(
+                const Numerator_type& num ,
+                const Numerator_type& den ) {
+            Type result(num, den);
+            return result;
+        }
+    };
+};
+
+} //namespace CGAL
+
+namespace Eigen {
+  template<class> struct NumTraits;
+  template<class NT> struct NumTraits<CGAL::Quotient<NT> >
+  {
+    typedef CGAL::Quotient<NT> Real;
+    typedef CGAL::Quotient<NT> NonInteger;
+    typedef CGAL::Quotient<NT> Nested;
+    typedef CGAL::Quotient<NT> Literal;
+
+    static inline Real epsilon() { return NumTraits<NT>::epsilon(); }
+    static inline Real dummy_precision() { return NumTraits<NT>::dummy_precision(); }
+
+    enum {
+      IsInteger = 0,
+      IsSigned = 1,
+      IsComplex = 0,
+      RequireInitialization = NumTraits<NT>::RequireInitialization,
+      ReadCost = 2*NumTraits<NT>::ReadCost,
+      AddCost = 150,
+      MulCost = 100
+    };
+  };
+}
+
+#endif  // CGAL_QUOTIENT_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Quotient_fwd.h b/3rdparty/CGAL/include/CGAL/Quotient_fwd.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Quotient_fwd.h
rename to 3rdparty/CGAL/include/CGAL/Quotient_fwd.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/RS/Gmpfr_make_unique.h b/3rdparty/CGAL/include/CGAL/RS/Gmpfr_make_unique.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/RS/Gmpfr_make_unique.h
rename to 3rdparty/CGAL/include/CGAL/RS/Gmpfr_make_unique.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/RS/ak_1.h b/3rdparty/CGAL/include/CGAL/RS/ak_1.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/RS/ak_1.h
rename to 3rdparty/CGAL/include/CGAL/RS/ak_1.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/RS/ak_z_1.h b/3rdparty/CGAL/include/CGAL/RS/ak_z_1.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/RS/ak_z_1.h
rename to 3rdparty/CGAL/include/CGAL/RS/ak_z_1.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/RS/algebraic_1.h b/3rdparty/CGAL/include/CGAL/RS/algebraic_1.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/RS/algebraic_1.h
rename to 3rdparty/CGAL/include/CGAL/RS/algebraic_1.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/RS/algebraic_z_1.h b/3rdparty/CGAL/include/CGAL/RS/algebraic_z_1.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/RS/algebraic_z_1.h
rename to 3rdparty/CGAL/include/CGAL/RS/algebraic_z_1.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/RS/bisection_refiner_1.h b/3rdparty/CGAL/include/CGAL/RS/bisection_refiner_1.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/RS/bisection_refiner_1.h
rename to 3rdparty/CGAL/include/CGAL/RS/bisection_refiner_1.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/RS/comparator_1.h b/3rdparty/CGAL/include/CGAL/RS/comparator_1.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/RS/comparator_1.h
rename to 3rdparty/CGAL/include/CGAL/RS/comparator_1.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/RS/dyadic.h b/3rdparty/CGAL/include/CGAL/RS/dyadic.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/RS/dyadic.h
rename to 3rdparty/CGAL/include/CGAL/RS/dyadic.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/RS/exact_signat_1.h b/3rdparty/CGAL/include/CGAL/RS/exact_signat_1.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/RS/exact_signat_1.h
rename to 3rdparty/CGAL/include/CGAL/RS/exact_signat_1.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/RS/functors_1.h b/3rdparty/CGAL/include/CGAL/RS/functors_1.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/RS/functors_1.h
rename to 3rdparty/CGAL/include/CGAL/RS/functors_1.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/RS/functors_z_1.h b/3rdparty/CGAL/include/CGAL/RS/functors_z_1.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/RS/functors_z_1.h
rename to 3rdparty/CGAL/include/CGAL/RS/functors_z_1.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/RS/polynomial_converter_1.h b/3rdparty/CGAL/include/CGAL/RS/polynomial_converter_1.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/RS/polynomial_converter_1.h
rename to 3rdparty/CGAL/include/CGAL/RS/polynomial_converter_1.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/RS/rs23_k_isolator_1.h b/3rdparty/CGAL/include/CGAL/RS/rs23_k_isolator_1.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/RS/rs23_k_isolator_1.h
rename to 3rdparty/CGAL/include/CGAL/RS/rs23_k_isolator_1.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/RS/rs2_calls.h b/3rdparty/CGAL/include/CGAL/RS/rs2_calls.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/RS/rs2_calls.h
rename to 3rdparty/CGAL/include/CGAL/RS/rs2_calls.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/RS/rs2_isolator_1.h b/3rdparty/CGAL/include/CGAL/RS/rs2_isolator_1.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/RS/rs2_isolator_1.h
rename to 3rdparty/CGAL/include/CGAL/RS/rs2_isolator_1.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/RS/rs3_k_refiner_1.h b/3rdparty/CGAL/include/CGAL/RS/rs3_k_refiner_1.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/RS/rs3_k_refiner_1.h
rename to 3rdparty/CGAL/include/CGAL/RS/rs3_k_refiner_1.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/RS/rs3_refiner_1.h b/3rdparty/CGAL/include/CGAL/RS/rs3_refiner_1.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/RS/rs3_refiner_1.h
rename to 3rdparty/CGAL/include/CGAL/RS/rs3_refiner_1.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/RS/signat_1.h b/3rdparty/CGAL/include/CGAL/RS/signat_1.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/RS/signat_1.h
rename to 3rdparty/CGAL/include/CGAL/RS/signat_1.h
diff --git a/3rdparty/CGAL/include/CGAL/Random.h b/3rdparty/CGAL/include/CGAL/Random.h
new file mode 100644
index 0000000..a48da28
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Random.h
@@ -0,0 +1,260 @@
+// Copyright (c) 1997-2001  
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved. 
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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(s)     : Sven Schoenherr <sven at inf.ethz.ch>, Sylvain Pion, Andreas Fabri
+
+#ifndef CGAL_RANDOM_H
+#define CGAL_RANDOM_H
+
+#include <string>
+#include <utility>
+#include <CGAL/basic.h>
+
+#if defined(BOOST_MSVC)
+#  pragma warning(push)
+#  pragma warning(disable:4244)
+#endif
+#include <boost/random/uniform_smallint.hpp>
+#if defined(BOOST_MSVC)
+#  pragma warning(pop)
+#endif
+#include <boost/random/linear_congruential.hpp>
+#include <boost/random/uniform_int.hpp>
+#include <boost/random/uniform_real.hpp>
+#include <boost/random/uniform_01.hpp>
+#include <boost/random/variate_generator.hpp>
+
+namespace CGAL {
+
+class Random {
+public:
+  // types
+  
+  struct State {
+    std::string rng;
+    unsigned int random_value, val, seed;
+    
+    State()
+    {}
+    
+    State(std::string rng, 
+          unsigned int random_value, 
+          unsigned int val, 
+          unsigned int seed)
+      : rng(rng), random_value(random_value), val(val), seed(seed)
+    {}
+  };
+  // creation
+  CGAL_EXPORT Random( );
+  CGAL_EXPORT Random( unsigned int  seed);
+  
+  // seed
+  CGAL_EXPORT unsigned int get_seed ( ) const;
+    
+  // operations
+  bool get_bool( )
+  {
+    return( static_cast< bool>( rng() & 1));
+  }
+
+
+  template <typename IntType>
+  IntType
+  uniform_smallint(IntType lower, IntType upper)
+  {
+    // uniform_smallint has a closed interval, CGAL a halfopen
+    boost::uniform_smallint<IntType> dist(lower,upper-1);
+    boost::variate_generator<boost::rand48&, boost::uniform_smallint<IntType> > generator(rng,dist);
+    
+    return generator();
+  }
+
+  template <typename IntType>
+  IntType
+  uniform_smallint(IntType lower)
+  {
+    return uniform_smallint<IntType>(lower,9);
+  }
+
+  template <typename IntType>
+  IntType
+  uniform_smallint()
+  {
+    return uniform_smallint<IntType>(0,9);
+  }
+
+  template <typename IntType>
+  IntType
+  uniform_int(IntType lower, IntType upper)
+  {
+    // uniform_int has a closed interval, CGAL a halfopen
+    boost::uniform_int<IntType> dist(lower,upper);
+    boost::variate_generator<boost::rand48&, boost::uniform_int<IntType> > generator(rng,dist);
+    
+    return generator();
+  }
+
+
+  template <typename IntType>
+  IntType
+  uniform_int(IntType lower)
+  {
+    return uniform_int<IntType>(lower,9);
+  }
+
+  template <typename IntType>
+  IntType
+  uniform_int()
+  {
+    return uniform_int<IntType>(0,9);
+  }
+ 
+
+  
+  template <typename IntType>
+  IntType
+  operator () (IntType upper)
+  {
+    return uniform_int<IntType>(0, upper-1);
+  }
+ 
+  int
+  get_int(int lower, int upper)
+  {
+    return uniform_int<int>(lower,upper-1);
+  }
+
+
+  template <typename RealType>
+  RealType
+  uniform_real( RealType lower, RealType upper)
+  {
+    // uniform_real as well as CGAL have a halfopen interval
+    boost::uniform_real<RealType> dist(lower,upper);
+    boost::variate_generator<boost::rand48&, boost::uniform_real<RealType> > generator(rng,dist);
+    
+    return generator();
+  }
+
+
+  template <typename RealType>
+  RealType
+  uniform_real( RealType lower)
+  {
+    return uniform_real<RealType>(lower, 1.0);
+  }
+
+
+  template <typename RealType>
+  RealType
+  uniform_real()
+  {
+    return uniform_real<RealType>(0.0, 1.0);
+  }
+
+
+  template <typename RealType>
+  RealType
+  uniform_01()
+  {
+    // uniform_01 as well as CGAL have a halfopen interval
+    boost::uniform_01<RealType> dist;
+    boost::variate_generator<boost::rand48&, boost::uniform_01<RealType> > generator(rng,dist);
+    
+    return generator();
+  }
+
+
+  double
+  get_double( double lower = 0.0, double upper = 1.0)
+  {
+    return uniform_real<double>(lower, upper);
+  }
+
+    // state 
+    CGAL_EXPORT void save_state( State& state) const;
+    CGAL_EXPORT void restore_state( const State& state);
+
+    // Computes a random int value smaller than 2^b.
+    // It's supposed to be fast, useful for randomized algorithms.
+    // The distribution is not perfectly flat, but this is a sacrifice against
+    // efficiency.
+    template <int b>
+    int get_bits()
+    {
+	CGAL_assertion(0<b && b<16);
+        if (val == 0) {
+            random_value = (421U * random_value + 2073U) % 32749U;
+            val = random_value;
+        }
+        int ret = val & ((1<<b)-1);
+        val >>= 1; // Shifting by b would be slightly better, but is slower.
+        return ret;
+    }
+
+    
+  bool    operator==(Random rd) const
+  {
+    return (rng == rd.rng) 
+      && (random_value == rd.random_value)
+      && (val == rd.val)
+      && (seed == rd.seed);
+  }
+
+  private:
+    // data members
+    unsigned int random_value; // Current 15 bits random value.
+    unsigned int val; // random_value shifted by used bits.
+    unsigned int seed; 
+    boost::rand48 rng;
+};
+
+#ifdef CGAL_HEADER_ONLY
+
+inline Random& get_default_random()
+{
+  static Random default_random;
+  return default_random;
+}
+
+#ifndef CGAL_NO_DEPRECATED_CODE
+  namespace { CGAL_DEPRECATED_UNUSED CGAL::Random& default_random = get_default_random(); }
+#endif // CGAL_NO_DEPRECATED_CODE
+
+#else // CGAL_HEADER_ONLY
+
+// Global variables
+// ================
+CGAL_EXPORT extern Random default_random;
+
+inline Random& get_default_random()
+{ return default_random; }
+
+#endif // CGAL_HEADER_ONLY
+
+} //namespace CGAL
+
+#ifdef CGAL_HEADER_ONLY
+#include <CGAL/Random_impl.h>
+#endif // CGAL_HEADER_ONLY
+
+#endif // CGAL_RANDOM_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Random_access_adaptor.h b/3rdparty/CGAL/include/CGAL/Random_access_adaptor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Random_access_adaptor.h
rename to 3rdparty/CGAL/include/CGAL/Random_access_adaptor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Random_access_value_adaptor.h b/3rdparty/CGAL/include/CGAL/Random_access_value_adaptor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Random_access_value_adaptor.h
rename to 3rdparty/CGAL/include/CGAL/Random_access_value_adaptor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Random_convex_hull_traits_2.h b/3rdparty/CGAL/include/CGAL/Random_convex_hull_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Random_convex_hull_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Random_convex_hull_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Random_convex_set_traits_2.h b/3rdparty/CGAL/include/CGAL/Random_convex_set_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Random_convex_set_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Random_convex_set_traits_2.h
diff --git a/3rdparty/CGAL/include/CGAL/Random_impl.h b/3rdparty/CGAL/include/CGAL/Random_impl.h
new file mode 100644
index 0000000..0f3825e
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Random_impl.h
@@ -0,0 +1,100 @@
+// Copyright (c) 1997-2001
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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(s)     : Sven Schönherr <sven at inf.ethz.ch>
+
+#ifdef CGAL_HEADER_ONLY
+#define CGAL_INLINE_FUNCTION inline
+#else
+#define CGAL_INLINE_FUNCTION
+#endif
+
+#include <ctime>
+#include <sstream>
+
+namespace CGAL {
+
+// Class implementation (continued)
+// ================================
+
+// constructors
+CGAL_INLINE_FUNCTION
+Random::
+Random( )
+    :  val(0)
+{
+    // get system's time
+    std::time_t s;
+    std::time( &s);
+    seed = (unsigned int)s;
+#if (defined( CGAL_TEST_SUITE ) || defined( CGAL_PRINT_SEED )) && !defined(CGAL_HEADER_ONLY)
+    // In header only, the following line  generates __gnu_cxx::recursive_init_error
+    if(this == & get_default_random()){
+      std::cerr << "CGAL::get_default_random()::get_seed() = " << seed << std::endl;
+    }
+#endif
+    // initialize random numbers generator
+    rng.seed(static_cast<boost::int32_t>(seed));
+    random_value = get_int(0, 1<<15);
+}
+
+CGAL_INLINE_FUNCTION
+Random::
+Random( unsigned int  seed)
+    : val(0), seed(seed)
+{
+    // initialize random numbers generator
+    rng.seed(static_cast<boost::int32_t>(seed));
+    random_value = get_int(0, 1<<15);
+}
+
+
+// seed
+CGAL_INLINE_FUNCTION
+unsigned int
+Random::get_seed () const
+{
+  return seed;
+}
+
+// state
+CGAL_INLINE_FUNCTION
+void
+Random::save_state( Random::State& state) const
+{
+  std::ostringstream os;
+  os << rng;
+  state = Random::State(os.str(),random_value, val, seed);
+}
+
+CGAL_INLINE_FUNCTION
+void
+Random::restore_state( const Random::State& state)
+{
+  std::istringstream is(state.rng);
+  is >> rng;
+  random_value = state.random_value;
+  val = state.val;
+  seed = state.seed;
+}
+
+} //namespace CGAL
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Random_polygon_2_sweep.h b/3rdparty/CGAL/include/CGAL/Random_polygon_2_sweep.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Random_polygon_2_sweep.h
rename to 3rdparty/CGAL/include/CGAL/Random_polygon_2_sweep.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Random_polygon_traits_2.h b/3rdparty/CGAL/include/CGAL/Random_polygon_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Random_polygon_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Random_polygon_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Range_segment_tree_traits.h b/3rdparty/CGAL/include/CGAL/Range_segment_tree_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Range_segment_tree_traits.h
rename to 3rdparty/CGAL/include/CGAL/Range_segment_tree_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Range_tree_d.h b/3rdparty/CGAL/include/CGAL/Range_tree_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Range_tree_d.h
rename to 3rdparty/CGAL/include/CGAL/Range_tree_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Range_tree_k.h b/3rdparty/CGAL/include/CGAL/Range_tree_k.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Range_tree_k.h
rename to 3rdparty/CGAL/include/CGAL/Range_tree_k.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Rational_traits.h b/3rdparty/CGAL/include/CGAL/Rational_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Rational_traits.h
rename to 3rdparty/CGAL/include/CGAL/Rational_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Ray_2.h b/3rdparty/CGAL/include/CGAL/Ray_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Ray_2.h
rename to 3rdparty/CGAL/include/CGAL/Ray_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Ray_2_Bbox_2_intersection.h b/3rdparty/CGAL/include/CGAL/Ray_2_Bbox_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Ray_2_Bbox_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Ray_2_Bbox_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Ray_2_Bbox_2_intersection_impl.h b/3rdparty/CGAL/include/CGAL/Ray_2_Bbox_2_intersection_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Ray_2_Bbox_2_intersection_impl.h
rename to 3rdparty/CGAL/include/CGAL/Ray_2_Bbox_2_intersection_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Ray_2_Iso_rectangle_2_intersection.h b/3rdparty/CGAL/include/CGAL/Ray_2_Iso_rectangle_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Ray_2_Iso_rectangle_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Ray_2_Iso_rectangle_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Ray_2_Line_2_intersection.h b/3rdparty/CGAL/include/CGAL/Ray_2_Line_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Ray_2_Line_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Ray_2_Line_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Ray_2_Point_2_intersection.h b/3rdparty/CGAL/include/CGAL/Ray_2_Point_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Ray_2_Point_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Ray_2_Point_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Ray_2_Ray_2_intersection.h b/3rdparty/CGAL/include/CGAL/Ray_2_Ray_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Ray_2_Ray_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Ray_2_Ray_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Ray_2_Segment_2_intersection.h b/3rdparty/CGAL/include/CGAL/Ray_2_Segment_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Ray_2_Segment_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Ray_2_Segment_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Ray_2_Triangle_2_intersection.h b/3rdparty/CGAL/include/CGAL/Ray_2_Triangle_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Ray_2_Triangle_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Ray_2_Triangle_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Ray_3.h b/3rdparty/CGAL/include/CGAL/Ray_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Ray_3.h
rename to 3rdparty/CGAL/include/CGAL/Ray_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Real_embeddable_traits.h b/3rdparty/CGAL/include/CGAL/Real_embeddable_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Real_embeddable_traits.h
rename to 3rdparty/CGAL/include/CGAL/Real_embeddable_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Real_timer.h b/3rdparty/CGAL/include/CGAL/Real_timer.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Real_timer.h
rename to 3rdparty/CGAL/include/CGAL/Real_timer.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Real_timer_impl.h b/3rdparty/CGAL/include/CGAL/Real_timer_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Real_timer_impl.h
rename to 3rdparty/CGAL/include/CGAL/Real_timer_impl.h
diff --git a/3rdparty/CGAL/include/CGAL/Reconstruction_triangulation_3.h b/3rdparty/CGAL/include/CGAL/Reconstruction_triangulation_3.h
new file mode 100644
index 0000000..0de409d
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Reconstruction_triangulation_3.h
@@ -0,0 +1,506 @@
+// Copyright (c) 2007  INRIA (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
+// 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(s)     : Laurent Saboret, Pierre Alliez
+
+
+#ifndef CGAL_IMPLICIT_FCT_DELAUNAY_TRIANGULATION_H
+#define CGAL_IMPLICIT_FCT_DELAUNAY_TRIANGULATION_H
+
+#include <CGAL/Point_with_normal_3.h>
+#include <CGAL/Lightweight_vector_3.h>
+#include <CGAL/property_map.h>
+#include <CGAL/surface_reconstruction_points_assertions.h>
+
+#include <CGAL/Delaunay_triangulation_3.h>
+#include <CGAL/Triangulation_cell_base_with_info_3.h>
+#include <CGAL/Min_sphere_of_spheres_d.h>
+#include <CGAL/Min_sphere_of_points_d_traits_3.h>
+#include <CGAL/centroid.h>
+
+#include <boost/random/random_number_generator.hpp>
+#include <boost/random/linear_congruential.hpp>
+
+#include <vector>
+#include <iterator>
+
+namespace CGAL {
+
+/// \internal
+/// The Reconstruction_vertex_base_3 class is the default
+/// vertex class of the Reconstruction_triangulation_3 class.
+///
+/// It provides the interface requested by the Poisson_reconstruction_function class:
+/// - Each vertex stores a normal vector.
+/// - A vertex is either an input point or a Steiner point added by Delaunay refinement.
+/// - In order to solve a linear system over the triangulation, a vertex may be constrained
+///   or not (i.e. may contribute to the right or left member of the linear system),
+///   and has a unique index.
+///
+/// @param Gt   Geometric traits class / Point_3 is a typedef to Point_with_normal_3.
+/// @param Cb   Vertex base class, model of TriangulationVertexBase_3.
+
+template < typename Gt,
+           typename Vb = Triangulation_vertex_base_3<Gt> >
+class Reconstruction_vertex_base_3 : public Vb
+{
+// Public types
+public:
+
+  /// Geometric traits class / Point_3 is a typedef to Point_with_normal_3.
+  typedef Gt Geom_traits;
+
+  // Repeat Triangulation_vertex_base_3 public types
+  /// \cond SKIP_IN_MANUAL
+  typedef typename Vb::Cell_handle Cell_handle;
+  template < typename TDS2 >
+  struct Rebind_TDS {
+    typedef typename Vb::template Rebind_TDS<TDS2>::Other                       Vb2;
+    typedef Reconstruction_vertex_base_3<Geom_traits, Vb2> Other;
+  };
+  /// \endcond
+
+  // Geometric types
+  typedef typename Geom_traits::FT FT;
+  typedef typename Geom_traits::Vector_3 Vector;           ///< typedef to Vector_3
+  typedef typename Geom_traits::Point_3 Point;             ///< typedef to Point_with_normal_3
+  typedef typename Geom_traits::Point_3 Point_with_normal; ///< typedef to Point_with_normal_3
+
+// data members
+private:
+
+  // TODO: reduce memory footprint
+  FT m_f; // value of the implicit function // float precise enough?
+  bool m_constrained; // is vertex constrained? // combine constrained and type
+  unsigned char m_type; // INPUT or STEINER
+  unsigned int m_index; // index in matrix (to be stored outside)
+
+// Public methods
+public:
+
+  Reconstruction_vertex_base_3()
+    : Vb(), m_f(FT(0.0)), m_type(0), m_index(0)
+  {}
+
+  Reconstruction_vertex_base_3(const Point_with_normal& p)
+    : Vb(p), m_f(FT(0.0)), m_type(0), m_index(0)
+  {}
+
+  Reconstruction_vertex_base_3(const Point_with_normal& p, Cell_handle c)
+    : Vb(p,c), m_f(FT(0.0)), m_type(0), m_index(0)
+  {}
+
+  Reconstruction_vertex_base_3(Cell_handle c)
+    : Vb(c), m_f(FT(0.0)), m_type(0), m_index(0)
+  {}
+
+
+  /// Gets/sets the value of the implicit function.
+  /// Default value is 0.0.
+  FT  f() const { return m_f; }
+  FT& f()       { return m_f; }
+
+  /// Gets/sets the type = INPUT or STEINER.
+  unsigned char  type() const { return m_type; }
+  unsigned char& type()       { return m_type; }
+
+  /// Gets/sets the index in matrix.
+  unsigned int  index() const { return m_index; }
+  unsigned int& index()       { return m_index; }
+
+  /// Gets/sets normal vector.
+  /// Default value is null vector.
+  const Vector& normal() const { return this->point().normal(); }
+  Vector&       normal()       { return this->point().normal(); }
+
+// Private methods
+private:
+
+    /// Copy constructor and operator =() are not implemented.
+    Reconstruction_vertex_base_3(const Reconstruction_vertex_base_3& toCopy);
+    Reconstruction_vertex_base_3& operator =(const Reconstruction_vertex_base_3& toCopy);
+
+}; // end of Reconstruction_vertex_base_3
+
+
+/// \internal
+/// Helper class:
+/// Reconstruction_triangulation_default_geom_traits_3
+/// changes in a geometric traits class the Point_3 type to
+/// Point_with_normal_3<BaseGt>.
+///
+/// @param BaseGt   Geometric traits class.
+template <class BaseGt>
+struct Reconstruction_triangulation_default_geom_traits_3 : public BaseGt
+{
+  typedef Point_with_normal_3<BaseGt> Point_3;
+};
+
+
+/// \internal
+/// The Reconstruction_triangulation_3 class
+/// provides the interface requested by the Poisson_reconstruction_function class:
+/// - Each vertex stores a normal vector.
+/// - A vertex is either an input point or a Steiner point added by Delaunay refinement.
+/// - In order to solve a linear system over the triangulation, a vertex may be constrained
+///   or not (i.e. may contribute to the right or left member of the linear system),
+///   and has a unique index.
+/// The vertex class must derive from Reconstruction_vertex_base_3.
+///
+/// @param BaseGt   Geometric traits class.
+/// @param Gt       Geometric traits class / Point_3 is a typedef to Point_with_normal_3<BaseGt>.
+/// @param Tds      Model of TriangulationDataStructure_3. The vertex class
+///                 must derive from Reconstruction_vertex_base_3.
+
+template <class BaseGt,
+          class Gt = Reconstruction_triangulation_default_geom_traits_3<BaseGt>,
+          class Tds_ = Triangulation_data_structure_3<Reconstruction_vertex_base_3<Gt>, Triangulation_cell_base_with_info_3<int,Gt> > >
+class Reconstruction_triangulation_3 : public Delaunay_triangulation_3<Gt,Tds_>
+{
+// Private types
+private:
+
+  // Base class
+  typedef Delaunay_triangulation_3<Gt,Tds_>  Base;
+
+  // Auxiliary class to build an iterator over input points.
+  class Is_steiner_point
+  {
+  public:
+      typedef typename Base::Finite_vertices_iterator Finite_vertices_iterator;
+
+      bool operator()(const Finite_vertices_iterator& v) const
+      {
+        return (v->type() == Reconstruction_triangulation_3::STEINER);
+      }
+  };
+
+// Public types
+public:
+
+  /// Geometric traits class / Point_3 is a typedef to Point_with_normal_3<BaseGt>.
+  typedef Gt  Geom_traits;
+
+  // Repeat base class' types
+  /// \cond SKIP_IN_MANUAL
+  typedef Tds_ Triangulation_data_structure;
+  typedef typename Base::Segment      Segment;
+  typedef typename Base::Triangle     Triangle;
+  typedef typename Base::Tetrahedron  Tetrahedron;
+  typedef typename Base::Line         Line;
+  typedef typename Base::Ray          Ray;
+  typedef typename Base::Object       Object;
+  typedef typename Base::Cell_handle   Cell_handle;
+  typedef typename Base::Vertex_handle Vertex_handle;
+  typedef typename Base::Cell   Cell;
+  typedef typename Base::Vertex Vertex;
+  typedef typename Base::Facet  Facet;
+  typedef typename Base::Edge   Edge;
+  typedef typename Base::Cell_circulator  Cell_circulator;
+  typedef typename Base::Facet_circulator Facet_circulator;
+  typedef typename Base::Cell_iterator    Cell_iterator;
+  typedef typename Base::Facet_iterator   Facet_iterator;
+  typedef typename Base::Edge_iterator    Edge_iterator;
+  typedef typename Base::Vertex_iterator  Vertex_iterator;
+  typedef typename Base::Point_iterator Point_iterator;
+  typedef typename Base::Finite_vertices_iterator Finite_vertices_iterator;
+  typedef typename Base::Finite_cells_iterator    Finite_cells_iterator;
+  typedef typename Base::Finite_facets_iterator   Finite_facets_iterator;
+  typedef typename Base::Finite_edges_iterator    Finite_edges_iterator;
+  typedef typename Base::All_cells_iterator       All_cells_iterator;
+  typedef typename Base::All_vertices_iterator       All_vertices_iterator;
+  typedef typename Base::Locate_type Locate_type;
+  /// \endcond
+
+  // Geometric types
+  typedef typename Geom_traits::FT FT;
+  typedef typename Geom_traits::Vector_3 Vector; ///< typedef to Vector_3<BaseGt>
+  typedef typename Geom_traits::Point_3 Point;  ///< typedef to Point_with_normal_3<BaseGt>
+  typedef typename Geom_traits::Point_3 Point_with_normal; ///< Point_with_normal_3<BaseGt>
+  typedef typename Geom_traits::Sphere_3 Sphere;
+
+  /// Point type
+  enum Point_type {
+    INPUT=0,    ///< Input point.
+    STEINER=1   ///< Steiner point created by Delaunay refinement.
+  };
+
+  /// Iterator over input vertices.
+  typedef Filter_iterator<Finite_vertices_iterator, Is_steiner_point>
+                                                    Input_vertices_iterator;
+
+  /// Iterator over input points.
+  typedef Iterator_project<Input_vertices_iterator,
+                           Project_point<Vertex> >  Input_point_iterator;
+
+  mutable Sphere sphere;
+  std::vector<Point_with_normal> points;
+  std::size_t fraction;
+  std::list<double> fractions;
+  Vertex_handle constrained_vertex;
+
+
+public:
+
+  /// Default constructor.
+  Reconstruction_triangulation_3()
+  {}
+
+  ~Reconstruction_triangulation_3()
+  {}
+
+  // Default copy constructor and operator =() are fine.
+
+  // Repeat base class' public methods used below
+  /// \cond SKIP_IN_MANUAL
+  using Base::points_begin;
+  using Base::points_end;
+  using Base::number_of_vertices;
+  using Base::finite_vertices_begin;
+  using Base::finite_vertices_end;
+  using Base::all_vertices_begin;
+  using Base::all_vertices_end;
+
+  using Base::geom_traits;
+  /// \endcond
+
+  /// Gets first iterator over input vertices.
+  Input_vertices_iterator input_vertices_begin() const
+  {
+      return Input_vertices_iterator(finite_vertices_end(), Is_steiner_point(),
+                                     finite_vertices_begin());
+  }
+  /// Gets past-the-end iterator over input vertices.
+  Input_vertices_iterator input_vertices_end() const
+  {
+      return Input_vertices_iterator(finite_vertices_end(), Is_steiner_point());
+  }
+
+  /// Gets iterator over the first input point.
+  Input_point_iterator input_points_begin() const
+  {
+      return Input_point_iterator(input_vertices_begin());
+  }
+  /// Gets past-the-end iterator over the input points.
+  Input_point_iterator input_points_end() const
+  {
+      return Input_point_iterator(input_vertices_end());
+  }
+
+  /// Gets the bounding sphere of input points.
+
+
+  Sphere bounding_sphere() const
+  {
+    return sphere;
+  }
+
+  void initialize_bounding_sphere() const
+  {
+    typedef Min_sphere_of_points_d_traits_3<Gt,FT> Traits;
+    typedef Min_sphere_of_spheres_d<Traits> Min_sphere;
+   
+    // Computes min sphere
+    Min_sphere ms(points.begin(),points.end());
+
+    typename Min_sphere::Cartesian_const_iterator coord = ms.center_cartesian_begin();
+    FT cx = *coord++;
+    FT cy = *coord++;
+    FT cz = *coord;
+
+    sphere = Sphere(Point(cx,cy,cz), ms.radius()*ms.radius());
+  }
+
+  /// Insert point in the triangulation.
+  /// Default type is INPUT.
+  template <typename Visitor>
+  Vertex_handle insert(const Point_with_normal& p,
+                       Point_type type,// = INPUT,
+                       Cell_handle start,// = Cell_handle(),
+                       Visitor visitor)
+  {
+
+    if(type == INPUT){
+      visitor.before_insertion();
+    }
+    if(this->dimension() < 3){
+      Vertex_handle v = Base::insert(p, start);
+      v->type() = type;
+      return v;
+    }
+    typename Base::Locate_type lt;
+    int li, lj;
+    Cell_handle ch = Base::locate(p, lt, li, lj, start);
+
+    Vertex_handle v = Base::insert(p, lt, ch, li, lj);
+    v->type() = type;
+    return v;
+    
+  }
+
+  /// Insert the [first, beyond) range of points in the triangulation using a spatial sort.
+  /// Default type is INPUT.
+  ///
+  /// @commentheading Template Parameters:
+  /// @param InputIterator iterator over input points.
+  /// @param PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3.
+  ///        It can be omitted if InputIterator value_type is convertible to Point_3.
+  /// @param NormalPMap is a model of `ReadablePropertyMap` with a value_type = Vector_3.
+  ///
+  /// @return the number of inserted points.
+
+  // This variant requires all parameters.
+  template <typename InputIterator,
+            typename PointPMap,
+            typename NormalPMap,
+            typename Visitor
+  >
+  int insert(
+    InputIterator first,  ///< iterator over the first input point.
+    InputIterator beyond, ///< past-the-end iterator over the input points.
+    PointPMap point_pmap, ///< property map: `value_type of InputIterator` -> `Point_3` (the position of an input point).
+    NormalPMap normal_pmap, ///< property map: `value_type of InputIterator` -> `Vector_3` (the *oriented* normal of an input point).
+    Visitor visitor)
+  {
+    if(! points.empty()){
+      std::cerr << "WARNING: not all points inserted yet" << std::endl;
+    }
+    // Convert input points to Point_with_normal_3
+    //std::vector<Point_with_normal> points;
+    for (InputIterator it = first; it != beyond; ++it)
+    {
+      Point_with_normal pwn(get(point_pmap,*it), get(normal_pmap,*it));
+      points.push_back(pwn);
+    }
+    std::size_t n = points.size();
+
+    initialize_bounding_sphere();
+
+    boost::rand48 random;
+    boost::random_number_generator<boost::rand48> rng(random);
+    std::random_shuffle (points.begin(), points.end(), rng);
+    fraction = 0;
+
+    fractions.clear();
+    fractions.push_back(1.0);
+    
+    double m = static_cast<double>(n);
+    
+    while(m > 500){
+      m /= 2;
+      fractions.push_front(m/n);
+    }
+    
+    insert_fraction(visitor);
+    return 0;
+  }
+
+  template <typename Visitor>
+  bool insert_fraction(Visitor visitor)
+  {
+    if(fractions.empty()){
+      points.clear();
+      return false;
+    }
+    double frac = fractions.front();
+    fractions.pop_front();
+    std::size_t more = (std::size_t)(points.size() * frac) - fraction;
+    if((fraction+more) > points.size()){
+      more = points.size() - fraction;
+    }
+    Cell_handle hint;
+    spatial_sort (points.begin()+fraction, points.begin()+fraction+more, geom_traits());
+    for (typename std::vector<Point_with_normal>::const_iterator p = points.begin()+fraction;
+         p != points.begin()+fraction+more; ++p)
+    {
+      Vertex_handle v = insert(*p, INPUT, hint, visitor);
+      hint = v->cell();
+    }
+    fraction += more;
+    return true;
+  }
+
+  /// \cond SKIP_IN_MANUAL
+  // This variant creates a default point property map = Identity_property_map.
+  template <typename InputIterator,
+            typename NormalPMap,
+            typename Visitor
+  >
+  int insert(
+    InputIterator first,  ///< iterator over the first input point.
+    InputIterator beyond, ///< past-the-end iterator over the input points.
+    NormalPMap normal_pmap, ///< property map: `value_type of InputIterator` -> `Vector_3` (the *oriented* normal of an input point).
+    Visitor visitor)
+  {
+    return insert(
+      first,beyond,
+      make_identity_property_map(
+      typename std::iterator_traits<InputIterator>::value_type()),
+      normal_pmap,
+      visitor);
+  }
+  /// \endcond
+
+  /// Delaunay refinement callback:
+  /// insert STEINER point in the triangulation.
+  template <class CellIt>
+  Vertex_handle
+  insert_in_hole(const Point_with_normal& p, CellIt cell_begin, CellIt cell_end,
+	         Cell_handle begin, int i,
+                 Point_type type = STEINER)
+  {
+      Vertex_handle v = Base::insert_in_hole(p, cell_begin, cell_end, begin, i);
+      v->type() = type;
+      return v;
+  }
+
+  /// Index unconstrained vertices following the order of Finite_vertices_iterator.
+  /// @return the number of unconstrained vertices.
+  unsigned int index_unconstrained_vertices()
+  {
+    unsigned int index = 0;
+    for (Finite_vertices_iterator v = finite_vertices_begin(),
+         e = finite_vertices_end();
+         v!= e;
+         ++v)
+    {
+      if(! is_constrained(v))
+        v->index() = index++;
+    }
+    return index;
+  }
+
+  /// Is vertex constrained, i.e.
+  /// does it contribute to the right or left member of the linear system?
+
+  bool is_constrained(Vertex_handle v) const
+  {
+    return v == constrained_vertex;
+  }
+
+  void constrain(Vertex_handle v)
+  {
+    constrained_vertex = v;
+  }
+  
+
+}; // end of Reconstruction_triangulation_3
+
+} //namespace CGAL
+
+#endif // CGAL_IMPLICIT_FCT_DELAUNAY_TRIANGULATION_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Rectangular_p_center_traits_2.h b/3rdparty/CGAL/include/CGAL/Rectangular_p_center_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Rectangular_p_center_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Rectangular_p_center_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Referenced_argument.h b/3rdparty/CGAL/include/CGAL/Referenced_argument.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Referenced_argument.h
rename to 3rdparty/CGAL/include/CGAL/Referenced_argument.h
diff --git a/3rdparty/CGAL/include/CGAL/Regular_complex_d.h b/3rdparty/CGAL/include/CGAL/Regular_complex_d.h
new file mode 100644
index 0000000..0cea6f6
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Regular_complex_d.h
@@ -0,0 +1,732 @@
+// Copyright (c) 1997-2000  Max-Planck-Institute Saarbruecken (Germany).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Michael Seel <seel at mpi-sb.mpg.de>
+//---------------------------------------------------------------------
+// file generated by notangle from regl_complex.lw
+// please debug or modify LEDA web file
+// mails and bugs: Michael.Seel at mpi-sb.mpg.de
+// based on LEDA architecture by S. Naeher, C. Uhrig
+// coding: K. Mehlhorn, M. Seel
+// debugging and templatization: M. Seel
+//---------------------------------------------------------------------
+
+#ifndef CGAL_REGULAR_COMPLEX_D_H
+#define CGAL_REGULAR_COMPLEX_D_H
+#define CGAL_DEPRECATED_HEADER "<CGAL/Regular_complex_d.h>"
+#define CGAL_REPLACEMENT_HEADER "the Triangulation package (see http://doc.cgal.org/latest/Triangulation)"
+#include <CGAL/internal/deprecation_warning.h>
+
+#include <CGAL/basic.h>
+#include <CGAL/Iterator_project.h>
+#include <CGAL/Compact_container.h>
+#include <vector>
+#include <list>
+#include <cstddef>
+
+#include <CGAL/Kernel_d/debug.h>
+
+#ifdef CGAL_USE_LEDA
+#include <LEDA/system/memory.h>
+#endif
+
+namespace CGAL {
+
+template <class R> class RC_simplex_d;
+template <class R> class RC_vertex_d;
+template <class R> class Regular_complex_d;
+template <class R> class Convex_hull_d;
+
+#define forall_rc_vertices(x,RC)\
+for(x = (RC).vertices_begin(); x != (RC).vertices_end(); ++x) 
+#define forall_rc_simplices(x,RC)\
+for(x = (RC).simplices_begin(); x != (RC).simplices_end(); ++x) 
+
+
+template <class Refs>
+class RC_vertex_d 
+
+{ typedef RC_vertex_d<Refs> Self;
+  typedef typename Refs::Point_d Point_d;
+  typedef typename Refs::Vertex_handle Vertex_handle;
+  typedef typename Refs::Simplex_handle Simplex_handle;
+  typedef typename Refs::R R;
+  friend class Regular_complex_d<R>;
+  friend class Convex_hull_d<R>;
+  friend class RC_simplex_d<Refs>;
+  Simplex_handle s_;
+  int            index_;
+  Point_d        point_;
+
+  void set_simplex(Simplex_handle s) { s_=s; }
+  void set_index(int i) { index_=i; }
+  void set_point(const Point_d& p) { point_=p; }
+
+public:
+  RC_vertex_d(Simplex_handle s, int i, const Point_d& p) :
+    s_(s), index_(i), point_(p) {}
+  RC_vertex_d(const Point_d& p) : point_(p), pp(NULL) {}
+  RC_vertex_d() :  s_(), index_(-42), pp(NULL) {}
+  // beware that ass_point was initialized here by nil_point
+  ~RC_vertex_d() {}
+
+  Simplex_handle simplex() const { return s_; }
+  int index() const { return index_; }
+  const Point_d& point() const { return point_; }
+
+  void* pp;
+  void*   for_compact_container() const { return pp; }
+  void* & for_compact_container()       { return pp; }
+
+#ifdef CGAL_USE_LEDA
+  LEDA_MEMORY(RC_vertex_d)
+#endif
+};
+
+
+template <class Refs>
+class RC_simplex_d 
+{ typedef RC_simplex_d<Refs>  Self;
+  typedef typename Refs::Point_d Point_d;
+  typedef typename Refs::Vertex_handle Vertex_handle;
+  typedef typename Refs::Simplex_handle Simplex_handle;
+  typedef typename Refs::R R;
+  friend class Regular_complex_d<R>;
+  friend class Convex_hull_d<R>;
+protected:
+  std::vector<Vertex_handle>   vertices;    // array of vertices
+  std::vector<Simplex_handle>  neighbors;   // opposite simplices
+  std::vector<int>             opposite_vertices; 
+                               // indices of opposite vertices
+
+  //------ only for convex hulls ------------------
+  typedef typename R::Hyperplane_d Hyperplane_d;
+  Hyperplane_d h_base;   // hyperplane supporting base facet
+  bool         visited_; // visited mark when traversing
+  //------ only for convex hulls ------------------
+
+  Vertex_handle  vertex(int i) const { return vertices[i]; }
+  Simplex_handle neighbor(int i) const { return neighbors[i]; }
+  int opposite_vertex_index(int i) const { return opposite_vertices[i]; }
+
+  void set_vertex(int i, Vertex_handle v) { vertices[i] = v; }
+  void set_neighbor(int i, Simplex_handle s) { neighbors[i]=s; }
+  void set_opposite_vertex_index(int i, int index) 
+  { opposite_vertices[i]=index; }
+
+  //------ only for convex hulls ------------------
+  Hyperplane_d hyperplane_of_base_facet() const { return h_base; }
+  void set_hyperplane_of_base_facet(const Hyperplane_d& h) { h_base = h; }
+  bool& visited() { return visited_; }
+  //------ only for convex hulls ------------------
+
+public:
+  typedef typename std::vector<Vertex_handle>::const_iterator 
+          VIV_iterator;
+  struct Point_from_VIV_iterator {
+    typedef Vertex_handle argument_type;
+    typedef Point_d      result_type;
+    result_type& operator()(argument_type& x) const 
+    { return x->point(); }
+    const result_type& operator()(const argument_type& x) const 
+    { return x->point(); }
+  };
+
+  typedef CGAL::Iterator_project<VIV_iterator,Point_from_VIV_iterator,
+    const Point_d&, const Point_d*> Point_const_iterator;
+
+  Point_const_iterator points_begin() const 
+  { return Point_const_iterator(vertices.begin()); }
+  Point_const_iterator points_end() const 
+  { return Point_const_iterator(vertices.end()); }
+
+  void* pp;
+  void*   for_compact_container() const { return pp; }
+  void* & for_compact_container()       { return pp; }
+
+  #if 0
+  struct Point_const_iterator {
+    typedef Point_const_iterator self;
+    typedef std::random_access_iterator_tag iterator_category;
+    typedef const Point_d&                  value_type;
+    typedef std::ptrdiff_t                  difference_type;
+    typedef const Point_d*                  pointer;
+    typedef const Point_d&                  reference;
+
+    typedef typename std::vector<Vertex_handle>::const_iterator 
+      ra_vertex_iterator;
+
+    Point_const_iterator() : _it() {}
+    Point_const_iterator(ra_vertex_iterator it) : _it(it) {}
+      
+    value_type operator*() const { return (*_it)->point(); }
+    pointer operator->() const { return &(operator*()); }
+
+    self& operator++() { ++_it; return *this; }
+    self  operator++(int) { self tmp = *this; ++_it; return tmp; }
+    self& operator--() { --_it; return *this; }
+    self  operator--(int) { self tmp = *this; --_it; return tmp; }
+
+    self& operator+=(difference_type i) { _it+=i; return *this; }
+    self& operator-=(difference_type i) { _it-=i; return *this; }
+    self operator+(difference_type i) const 
+    { self tmp=*this; tmp+=i; return tmp; }
+    self operator-(difference_type i) const 
+    { self tmp=*this; tmp-=i; return tmp; }
+
+    difference_type operator-(self x) const { return _it-x._it; }
+    reference operator[](difference_type i) { return *(*this + i); }
+
+    bool operator==(const self& x) const { return _it==x._it; }
+    bool operator!=(const self& x) const { return ! (*this==x); }
+    bool operator<(self x) const { (x - *this) > 0; }
+
+    private:
+      ra_vertex_iterator _it;  
+  }; // Point_const_iterator
+
+  Point_const_iterator points_begin() const 
+  { return Point_const_iterator(vertices.begin()); }
+  Point_const_iterator points_end() const 
+  { return Point_const_iterator(vertices.end()); }
+
+  #endif
+          
+
+  RC_simplex_d() : pp(NULL) {}
+  RC_simplex_d(int dmax) : 
+    vertices(dmax+1), neighbors(dmax+1), opposite_vertices(dmax+1), pp(NULL)
+  { for (int i = 0; i <= dmax; i++) { 
+      neighbors[i] = Simplex_handle(); 
+      vertices[i] = Vertex_handle(); 
+      opposite_vertices[i] = -1;
+    }
+    visited_ = false;
+  }
+  ~RC_simplex_d() {} 
+
+  void print(std::ostream& O=std::cout) const
+  {
+    O << "RC_simplex_d {" ;
+    for(int i=0;i < int(vertices.size());++i) {
+      Vertex_handle v = vertices[i];
+      if ( v != Vertex_handle() ) O << v->point();
+      else O << "(nil)";
+    }
+    O << "}";
+  }
+
+#ifdef CGAL_USE_LEDA
+  LEDA_MEMORY(RC_simplex_d) 
+#endif
+
+}; 
+
+template <typename R>
+std::ostream& operator<<(std::ostream& O, const RC_simplex_d<R>& s)
+{ s.print(O); return O; }
+
+
+/*{\Manpage {Regular_complex_d}{R}{Regular Simplicial Complex}{C}}*/
+/*{\Mdefinition 
+
+An instance |\Mvar| of type |\Mname| is a regular abstract or concrete
+simplicial complex. An abstract simplicial complex is a family |\Mvar|
+of subsets of some set $V$, called the vertex set of the complex,
+which is closed under the subset relation, i.e., if a set $s$ belongs
+to the family then all its subsets do. A set $s$ of cardinality $k +
+1$ is called a $k$-simplex and $k$ is called its dimension.  If $s$ is
+a subset of $t$ then $s$ is called a subsimplex or face of $t$. A
+vertex $v$ is called incident to a simplex $s$ if $v$ is an element of
+$s$.  A simplex is called \emph{maximal} if it is not a face of any
+simplex in |\Mvar|. Two simplices of dimension $k$ are called
+neighbors if they share $k-1$ vertices. A complex is connected if its
+set of maximal simplices forms a connected set under the neighboring
+relation.  A simplicial complex is called \emph{regular} if all
+maximal simplices in the complex have the same dimension and if the
+complex is connected.  
+
+A concrete simplicial complex is an abstract simplicial complex in
+which a point in some ambient space is associated with each vertex.
+We use |dim| to denote the dimension of ambient space.  Simplices are
+now interpreted geometrically as sets of points in ambient space,
+namely as the convex hulls of (the points associated with) their
+vertices. A $0$-simplex is a point, a $1$-simplex is a line segment, a
+$2$-simplex is a triangle, a $3$-simplex is a tetrahedron,
+etc.. \emph{The simplices is a concrete simplicial complex must
+satisfy the additional conditions that the points associated with the
+vertices of any simplex are affinely independet and that the
+intersection of any two simplices is a face of both.} We will write
+simplicial complex instead of concrete simplicial complex in the
+sequel.
+
+All maximal simplices in a regular simplicial complex have the same
+dimension, which we denote |dcur|.  For each maximal
+simplex\cgalFootnote{we drop the adjective maximal in the sequel} in
+|\Mvar| there is an item of type |RC_simplex_d| and for each vertex
+there is an item of type |rc_vertex|.  Each maximal simplex has |1+dcur| 
+vertices indexed from $0$ to |dcur|. For any simplex $s$ and any
+index $i$, |C.vertex_of(s,i)| returns the $i$-th vertex of $s$. There
+may or may not be a simplex $t$ opposite to (the vertex with index)
+$i$, i.e., a maximal simplex $t$ having
+\{|C.vertex_of(s,0)|,|C.vertex_of(s,1)|,\ldots,
+|C.vertex_of(s,dcur)|\} - \{|C.vertex_of(s,i)|\} in its vertex
+set.  The function |C.opposite(s,i)| returns $t$ if it exists and
+returns |nil| otherwise. If $t$ exists then $s$ and $t$ share |dcur|
+vertices, namely all but vertex $i$ of $s$ and vertex
+|C.opposite_vertex(s,i)| of $t$. Assume that $t = |C.opposite(s,i)|$
+exists and let |j = C.opposite_vertex(s,i)|. Then |s = C.opposite(t,j)| 
+and |i = C.opposite_vertex(t,j)| and
+\begin{eqnarray*}
+\lefteqn{\{|C.vertex_of(s,0)|,|C.vertex_of(s,1)|,\ldots,
+|C.vertex_of(s,dcur)|\} - \{|C.vertex_of(s,i)|\} =} \\ & &
+\{|C.vertex_of(t,0)|,|C.vertex_of(t,1)|,\ldots,|C.vertex_of(t,dcur)|\}
+- \{|C.vertex_of(t,j)|\}.  \end{eqnarray*} In general, a
+vertex belongs to many simplices. For an |rc_vertex| $v$,
+the functions |C.simplex(v)| and |C.index(v)| return a pair $(s,i)$
+such that |v = C.vertex_of(s,i)|.
+
+The class |regl_complex| has a static member |nil_point| of type
+|Point_d|. This point is different (= not indentical) from any user
+defined point and is the point associated with every vertex of an
+abstract simplicial complex. It simulates the use of |nil| to denote
+an undefined object.
+
+Regular complexes are designed as the base class for triangulations of
+convex hulls and Delaunay triangulations in higher dimensional
+space. We have not used them yet for any other purpose. Regular
+complexes are built by constructing vertices and simplices, by
+assigning positions to vertices and vertices to simplices, and by
+establishing neighbor relations. The update operations do not check
+whether the data structure built actually encodes a simplicial
+complex.  The class provides a function |is_valid()| that performs a
+partial check whether the data structure encodes a simplicial
+complex. It is not checked whether two simplices intersect without
+sharing a face.
+}*/
+
+template <class R_>
+class Regular_complex_d
+{ 
+typedef Regular_complex_d<R_> Self;
+public:
+/*{\Mtypes 4}*/
+typedef R_ R;
+
+typedef RC_vertex_d<Self> Vertex;
+
+  typedef CGAL::Compact_container<Vertex> Vertex_list;
+
+typedef typename Vertex_list::iterator       Vertex_handle;
+/*{\Mtypemember the handle type for vertices of the complex.}*/
+typedef typename Vertex_list::const_iterator Vertex_const_handle;
+
+typedef typename Vertex_list::iterator       Vertex_iterator;
+/*{\Mtypemember the iterator type for vertices of the complex.}*/
+typedef typename Vertex_list::const_iterator Vertex_const_iterator;
+
+typedef RC_simplex_d<Self> Simplex;
+typedef CGAL::Compact_container<Simplex>    Simplex_list;
+
+typedef typename Simplex_list::iterator       Simplex_handle;
+/*{\Mtypemember the handle type for simplices of the complex.}*/
+typedef typename Simplex_list::const_iterator Simplex_const_handle;
+
+typedef typename Simplex_list::iterator       Simplex_iterator;
+/*{\Mtypemember the iterator type for simplices of the complex.}*/
+typedef typename Simplex_list::const_iterator Simplex_const_iterator;
+
+typedef typename R::Point_d Point_d;
+
+protected:
+  const R& Kernel_;
+  int dcur; // dimension of the current complex
+  int dmax; // dimension of ambient space
+
+  Vertex_list  vertices_; // list of all vertices
+  Simplex_list simplices_; // list of all simplices
+
+/* the default copy constructor and assignment operator for class
+   regl_complex work incorrectly; it is therefore good practice to
+   either implement them correctly or to make them inaccessible. We do
+   the latter. */
+
+private:
+
+  Regular_complex_d(const Regular_complex_d<R>& ); 
+  Regular_complex_d& operator=(const Regular_complex_d<R>& ); 
+
+  void clean_dynamic_memory()
+  { 
+    vertices_.clear();
+    simplices_.clear();
+}
+
+public:
+
+/*{\Mcreation}*/
+
+Regular_complex_d(int d = 2, const R& Kernel = R()) 
+/*{\Mcreate creates an instance |\Mvar| of type |\Mtype|. The
+dimension of the underlying space is $d$ and |\Mvar| is initialized to
+the empty regular complex.  Thus |dcur| equals $-1$. The traits class
+|R| specifies the models of all types and the implementations of
+all geometric primitives used by the regular complex class. The
+|Kernel| parameter allows you to carry fixed geometric information
+into the data type. For the default kernel traits |Homogeneous_d|
+the default construction of |Kernel| is enough.
+
+In the following we use further template parameters like the point
+type |Point_d=R::Point_d|.  At this point, it suffices to say that
+|Point_d| represents points in $d$-space. The complete specification of
+the traits class is to be found at the end of this manual page.}*/
+ : Kernel_(Kernel) { dmax = d; dcur = -1; }
+
+
+~Regular_complex_d() { clean_dynamic_memory(); }
+
+/* In the destructor for |Regular_complex_d|, we have to release the
+   storage which was allocated for the simplices and the vertices. */
+
+/*{\Mtext The data type |\Mtype| offers neither copy constructor nor 
+          assignment operator.}*/
+
+/*{\Moperations 3 3}*/
+/*{\Mtext \headerline{Access Operations}}*/
+
+int dimension() const { return dmax; }
+/*{\Mop returns the dimension of ambient space}*/
+
+int current_dimension() const { return dcur; }
+/*{\Mop returns the current dimension of the simplices in the
+complex.}*/
+
+Vertex_handle vertex(Simplex_handle s, int i) const 
+/*{\Mop returns the $i$-th vertex of $s$.\\
+\precond $0 \leq i \leq |current_dimension|$. }*/
+{ CGAL_assertion(0<=i&&i<=dcur);
+  return s->vertex(i); }
+
+Vertex_const_handle vertex(Simplex_const_handle s, int i) const 
+{ CGAL_assertion(0<=i&&i<=dcur);
+  return s->vertex(i); }
+
+Point_d associated_point(Vertex_handle v) const 
+/*{\Mop returns the point associated with vertex |v|.}*/
+{ return v->point(); }
+
+Point_d associated_point(Vertex_const_handle v) const 
+{ return v->point(); }
+
+
+int index(Vertex_handle v) const 
+/*{\Mop returns the index of $v$ in |C.simplex(v)|.}*/
+{ return v->index(); }
+
+int index(Vertex_const_handle v) const 
+{ return v->index(); }
+
+
+Simplex_handle simplex(Vertex_handle v) const 
+/*{\Mop returns a simplex of which $v$ is a vertex. Note that this
+simplex is not unique. }*/
+{ return v->simplex(); } 
+
+Simplex_const_handle simplex(Vertex_const_handle v) const 
+{ return v->simplex(); } 
+
+Point_d associated_point(Simplex_handle s, int i) const
+/*{\Mop same as |C.associated_point(C.vertex(s,i))|.}*/
+{ return associated_point(vertex(s,i)); }
+
+Point_d associated_point(Simplex_const_handle s, int i) const
+{ return associated_point(vertex(s,i)); }
+
+Simplex_handle opposite_simplex(Simplex_handle s,int i) const 
+/*{\Mop returns the simplex opposite to the $i$-th vertex of $s$
+(|Simplex_handle()| is there is no such simplex).\\ \precond $0 \leq i \leq |dcur|$. }*/
+{ CGAL_assertion(0<=i&&i<=dcur);
+  return s->neighbor(i); }
+
+Simplex_const_handle opposite_simplex(Simplex_const_handle s,int i) const 
+{ CGAL_assertion(0<=i&&i<=dcur);
+  return s->neighbor(i); }
+
+int index_of_opposite_vertex(Simplex_handle s, int i) const
+{ CGAL_assertion(0<=i&&i<=dcur);
+  return s->opposite_vertex_index(i); }
+/*{\Mop returns the index of the vertex opposite to the $i$-th vertex
+of $s$. \precond $0 \leq i \leq |dcur|$ and there is a
+simplex opposite to the $i$-th vertex of $s$.}*/
+
+int index_of_opposite_vertex(Simplex_const_handle s, int i) const
+{ CGAL_assertion(0<=i&&i<=dcur);
+  return s->opposite_vertex_index(i); }
+
+
+
+/*{\Mtext \headerline{Update Operations}
+
+We give operations that allow to update a regular complex. They have
+to be used with care as they may invalidate the data structure.}*/
+
+void clear(int d = 0)
+/*{\Mop reinitializes |\Mvar| to the empty complex in dimension |dim|.}*/
+{ clean_dynamic_memory();
+  dmax = d; dcur = -1; 
+}
+
+void set_current_dimension(int d) { dcur = d; }
+/*{\Mop sets |dcur| to |d|. }*/
+
+Simplex_handle new_simplex() 
+/*{\Mop adds a new simplex to |\Mvar| and returns it. The new simplex
+has no vertices yet.}*/
+{ 
+  Simplex s(dmax);
+  Simplex_handle  h = simplices_.insert(s);
+  return h;
+}
+
+Vertex_handle  new_vertex() 
+/*{\Mop adds a new vertex to |\Mvar| and returns it. The new vertex
+        has no associated simplex nor index yet. The associated point
+        is the point |Regular_complex_d::nil_point| which is a static
+        member of class |Regular_complex_d.|}*/
+{ 
+  Vertex v(nil_point);
+  Vertex_handle h = vertices_.insert(v);
+  return h; 
+}
+
+Vertex_handle  new_vertex(const Point_d& p) 
+/*{\Mop adds a new vertex to |\Mvar| and returns it. The new vertex
+        has |p| as the associated point, but is has no associated
+        simplex nor index yet.}*/
+{ 
+  Vertex v(p);
+  Vertex_handle h = vertices_.insert(v);
+  return h;
+}
+
+void associate_vertex_with_simplex(Simplex_handle s, int i, Vertex_handle v)
+/*{\Mop sets the $i$-th vertex of |s| to |v| and records this fact in
+$v$. The latter occurs only if $v$ is non-nil.}*/
+{ s -> set_vertex(i,v);
+  if ( v != Vertex_handle() ) { 
+    v -> set_simplex(s); v -> set_index(i);
+  }
+}
+
+void associate_point_with_vertex(Vertex_handle v, const Point_d& p)
+/*{\Mop sets the point associated with $v$ to $p$.}*/
+{ v -> set_point(p); }
+
+void set_neighbor(Simplex_handle s, int i, Simplex_handle s1, int j)
+/*{\Mop sets the neihbor opposite to vertex $i$ of |s| to |s1| and
+        records vertex $j$ of |s1| as the vertex opposite to $i$.}*/
+{ s  -> set_neighbor(i,s1);
+  s1 -> set_neighbor(j,s);
+  s  -> set_opposite_vertex_index(i,j);
+  s1 -> set_opposite_vertex_index(j,i);
+}
+
+void check_topology() const;
+/*{\Mop Partially checks whether |\Mvar| is an abstract simplicial
+complex. This function terminates without error if each vertex is a
+vertex of the simplex of which it claims to be a vertex, if the
+vertices of all simplices are pairwise distinct, if the neighbor
+relationship is symmetric, and if neighboring simplices share exactly
+|dcur| vertices.  It returns an error message if one of these
+conditions is violated.  Note that it is not checked whether simplices
+that share |dcur| vertices are neighbors in the data structure.}*/
+
+void check_topology_and_geometry() const;
+/*{\Mop In addition to the above, this function checks whether all
+vertices have an associated point different from
+|Regular_complex_d::nil_point| and whether the points associated with the
+vertices of any simplex are affinely independent. It returns an error
+message otherwise.  Note that it is not checked whether the
+intersection of any two simplices is a facet of both.}*/
+
+
+typedef size_t Size_type;
+
+Size_type number_of_vertices() const  { return this->vertices_.size();}
+Size_type number_of_simplices() const  { return this->simplices_.size();}
+
+void print_statistics(std::ostream& os = std::cout) const
+{ 
+  os << "Regular_complex_d - statistic" << std::endl;
+  os << "number of vertices = " << number_of_vertices() << std::endl;
+  os << "number of simplices = " << number_of_simplices() << std::endl;
+}
+
+/*{\Mtext \headerline{Lists and Iterators}
+\setopdims{4.5cm}{3.5cm}}*/
+
+/*{\Mtext The following operation pairs return iterator ranges in
+the style of STL.}*/
+
+Vertex_iterator vertices_begin() { return vertices_.begin(); }
+/*{\Mop the first vertex of |\Mvar|.}*/
+Vertex_iterator vertices_end()   { return vertices_.end(); }
+/*{\Mop the beyond vertex of |\Mvar|.}*/
+Simplex_iterator simplices_begin() { return simplices_.begin(); }
+/*{\Mop the first simplex of |\Mvar|.}*/
+Simplex_iterator simplices_end()   { return simplices_.end(); }
+/*{\Mop the beyond simplex of |\Mvar|.}*/
+
+Vertex_const_iterator vertices_begin() const { return vertices_.begin(); }
+Vertex_const_iterator vertices_end()   const { return vertices_.end(); }
+Simplex_const_iterator simplices_begin() const { return simplices_.begin(); }
+Simplex_const_iterator simplices_end()   const { return simplices_.end(); }
+
+std::list<Simplex_handle> all_simplices()
+/*{\Mop returns the set of all maximal simplices in |\Mvar|.}*/
+{ std::list<Simplex_handle> res; Simplex_iterator it;
+  forall_rc_simplices(it,*this) res.push_back(it);
+  return res; }
+
+std::list<Simplex_const_handle> all_simplices() const 
+{ std::list<Simplex_const_handle> res; Simplex_const_iterator it;
+  forall_rc_simplices(it,*this) res.push_back(it);
+  return res; }
+
+std::list<Vertex_handle> all_vertices()
+/*{\Mop returns the set of all vertices in |\Mvar|.}*/
+{ std::list<Vertex_handle> res; Vertex_iterator it;
+  forall_rc_vertices(it,*this) res.push_back(it);
+  return res; }
+
+std::list<Vertex_const_handle> all_vertices() const 
+{ std::list<Vertex_const_handle> res; Vertex_const_iterator it;
+  forall_rc_vertices(it,*this) res.push_back(it);
+  return res; }
+
+
+
+const R& kernel() const { return Kernel_; }
+static Point_d nil_point;
+
+}; // Regular_complex_d<R>
+
+// init static member:
+template <class R> 
+typename Regular_complex_d<R>::Point_d Regular_complex_d<R>::nil_point;
+
+
+template <class R>
+void Regular_complex_d<R>::check_topology() const
+{ 
+  Simplex_const_handle s,t; 
+  Vertex_const_handle v;
+  int i,j,k; 
+  if (dcur == -1) {
+    if (!vertices_.empty() || !simplices_.empty() ) 
+      CGAL_error_msg(      "check_topology: dcur is -1 but there are vertices or simplices");
+  }
+
+  forall_rc_vertices(v,*this) {
+    if ( v != vertex(simplex(v),index(v)) )
+      CGAL_error_msg(      "check_topology: vertex-simplex relationship corrupted");
+  }
+
+  forall_rc_simplices(s,*this) {
+    for(i = 0; i <= dcur; i++) {
+      for (j = i + 1; j <= dcur; j++) {
+        if (vertex(s,i) == vertex(s,j))
+          CGAL_error_msg(          "check_topology: a simplex with two equal vertices"); 
+      }
+    }
+  }
+
+  forall_rc_simplices(s,*this) {
+    for(i = 0; i <= dcur; i++) {
+      if ((t = opposite_simplex(s,i)) != Simplex_const_handle()) { 
+        int l = index_of_opposite_vertex(s,i); 
+        if (s != opposite_simplex(t,l) || 
+            i != index_of_opposite_vertex(t,l))
+          CGAL_error_msg(          "check_topology: neighbor relation is not symmetric"); 
+
+        for (j = 0; j <= dcur; j++) {
+          if (j != i) {
+            // j must also occur as a vertex of t
+            for (k = 0; k <= dcur && 
+                   ( vertex(s,j) != vertex(t,k) || k == l); k++) {}
+            if (k > dcur) 
+              CGAL_error_msg(              "check_topology: too few shared vertices."); 
+          }
+        }
+      }
+    }
+  }
+}
+
+template <class R>
+void Regular_complex_d<R>::check_topology_and_geometry() const
+{ 
+  check_topology();
+  Vertex_const_handle v;
+  forall_rc_vertices(v,*this) {
+    if ( v == Vertex_const_handle() || 
+         associated_point(v).identical(Regular_complex_d<R>::nil_point) )
+      CGAL_error_msg("check_topology_and_geometry: \
+      vertex with nil_point or no associated point.");
+  }
+
+  typename R::Affinely_independent_d affinely_independent =
+    kernel().affinely_independent_d_object();
+  Simplex_const_handle s;
+  forall_rc_simplices(s,*this) {
+    std::vector<Point_d> A(dcur + 1);
+    for (int i = 0; i <= dcur; i++) 
+      A[i] = associated_point(s,i);
+    if ( !affinely_independent(A.begin(),A.end()) )
+      CGAL_error_msg("check_topology_and_geometry: \
+      corners of some simplex are not affinely independent");
+  }
+}
+
+
+/*{\Mtext 
+\headerline{Iteration Statements}
+
+{\bf forall\_rc\_simplices}($s,C$)       
+$\{$ ``the simplices of $C$ are successively assigned to $s$'' $\}$
+
+{\bf forall\_rc\_vertices}($v,C$)       
+$\{$ ``the vertices of $C$ are successively assigned to $v$'' $\}$
+
+}*/
+
+/*{\Mimplementation Each simplex stores its vertices, the adjacent
+simplices, and the opposite vertices in arrays. The space requirement
+for a simplex is $3 * |dim| * 4$ Bytes for the contents of the arrays
+plus the actual space for the points plus the constant space overhead
+for the arrays (see the manual pages for arrays).
+
+The class |Regular_complex_d| needs constant space plus space for a list of
+simplices (which is about 12 bytes per simplex). The total space
+requirement is therefore about $12(|dim| + 2)$ bytes times the number
+of simplices.  }*/
+
+
+
+} //namespace CGAL
+#endif // CGAL_REGULAR_COMPLEX_D_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Regular_grid_2.h b/3rdparty/CGAL/include/CGAL/Regular_grid_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Regular_grid_2.h
rename to 3rdparty/CGAL/include/CGAL/Regular_grid_2.h
diff --git a/3rdparty/CGAL/include/CGAL/Regular_triangulation_2.h b/3rdparty/CGAL/include/CGAL/Regular_triangulation_2.h
new file mode 100644
index 0000000..4ecaeb9
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Regular_triangulation_2.h
@@ -0,0 +1,2240 @@
+// Copyright (c) 1997  INRIA Sophia-Antipolis (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
+// 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(s)     : Frederic Fichel, Mariette Yvinec, Julia Floetotto
+
+#ifndef CGAL_REGULAR_TRIANGULATION_2_H
+#define CGAL_REGULAR_TRIANGULATION_2_H
+
+#include <CGAL/Triangulation_2.h>
+#include <CGAL/Regular_triangulation_face_base_2.h>
+#include <CGAL/Regular_triangulation_vertex_base_2.h>
+#include <CGAL/utility.h>
+
+#include <boost/bind.hpp>
+
+#ifndef CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
+#include <CGAL/Spatial_sort_traits_adapter_2.h>
+#include <CGAL/internal/info_check.h>
+
+#include <boost/iterator/zip_iterator.hpp>
+#include <boost/mpl/and.hpp>
+#endif //CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
+
+namespace CGAL { 
+
+template < typename K_ >
+struct Weighted_point_mapper_2 
+  :   public K_ 
+{
+  typedef typename K_::Weighted_point_2 Point_2;
+
+  Weighted_point_mapper_2() {}
+  Weighted_point_mapper_2(const K_& k) : K_(k) {}
+};
+
+template < class Gt, 
+           class Tds  = Triangulation_data_structure_2 <
+                        Regular_triangulation_vertex_base_2<Gt>,
+		        Regular_triangulation_face_base_2<Gt> > >
+class Regular_triangulation_2 
+  : public Triangulation_2<Weighted_point_mapper_2<Gt>,Tds>
+{
+  typedef Regular_triangulation_2<Gt, Tds>                         Self;
+  typedef Triangulation_2<Weighted_point_mapper_2<Gt>,Tds>         Base;
+public:
+  typedef Tds                                  Triangulation_data_structure;
+  typedef Gt                                   Geom_traits;
+  typedef typename Gt::Point_2                 Bare_point;
+  typedef typename Gt::Weighted_point_2        Weighted_point;
+  typedef typename Gt::Weight                  Weight;
+
+  typedef typename Base::size_type             size_type;
+  typedef typename Base::Face_handle           Face_handle;
+  typedef typename Base::Vertex_handle         Vertex_handle;
+  typedef typename Base::Vertex                Vertex;
+  typedef typename Base::Edge                  Edge;
+  typedef typename Base::Locate_type           Locate_type;
+  typedef typename Base::Face_circulator       Face_circulator;
+  typedef typename Base::Edge_circulator       Edge_circulator;
+  typedef typename Base::Vertex_circulator     Vertex_circulator;
+  typedef typename Base::Finite_edges_iterator Finite_edges_iterator;
+  typedef typename Base::All_edges_iterator    All_edges_iterator;
+  typedef typename Base::Finite_faces_iterator Finite_faces_iterator;
+  typedef typename Base::All_faces_iterator    All_faces_iterator;
+  typedef typename Base::Face::Vertex_list     Vertex_list;
+  typedef typename Vertex_list::iterator       Vertex_list_iterator;
+
+#ifndef CGAL_CFG_USING_BASE_MEMBER_BUG_2
+  using Base::cw;
+  using Base::ccw;
+  using Base::dimension;
+  using Base::geom_traits;
+  using Base::infinite_vertex;
+  using Base::create_face;
+  using Base::number_of_faces;
+  using Base::all_faces_begin;
+  using Base::all_faces_end;
+  using Base::all_edges_begin;
+  using Base::all_edges_end;
+  using Base::finite_faces_begin;
+  using Base::finite_faces_end;
+  using Base::finite_edges_begin;
+  using Base::finite_edges_end;
+  using Base::OUTSIDE_AFFINE_HULL;
+  using Base::VERTEX;
+  using Base::FACE;
+  using Base::EDGE;
+  using Base::OUTSIDE_CONVEX_HULL;
+  using Base::orientation;
+  using Base::locate;
+  using Base::incident_faces;
+  using Base::is_infinite;
+  using Base::degree;
+  using Base::delete_vertex;
+  using Base::incident_vertices;
+  using Base::make_hole;
+  using Base::mirror_index;
+  using Base::show_vertex;
+  using Base::test_dim_down;
+#endif
+
+private:
+  typedef std::list<Face_handle>      Faces_around_stack; 
+
+  class Hidden_tester {
+  public:
+    bool operator()(const typename Base::All_vertices_iterator&  it){
+      return it->is_hidden();
+     }
+    bool operator()(const typename Base::Finite_vertices_iterator&  it){
+      return it->is_hidden();
+    }
+  };
+
+  class Unhidden_tester {
+  public:
+    bool operator()(const typename Base::Finite_vertices_iterator&  it){
+      return ! it->is_hidden();
+    }
+  };
+
+  typedef typename Base::All_vertices_iterator     All_vib;
+  typedef typename Base::Finite_vertices_iterator  Finite_vib;
+
+public:
+  // We derive in order to add a conversion to handle.
+  class All_vertices_iterator :
+    public Filter_iterator<All_vib, Hidden_tester> {
+    typedef Filter_iterator<All_vib, Hidden_tester> Base;
+    typedef All_vertices_iterator                     Self;
+     public:
+    All_vertices_iterator() : Base() {}
+    All_vertices_iterator(const Base &b) : Base(b) {}
+    Self & operator++() { Base::operator++(); return *this; }
+    Self & operator--() { Base::operator--(); return *this; }
+    Self operator++(int) { Self tmp(*this); ++(*this); return tmp; }
+    Self operator--(int) { Self tmp(*this); --(*this); return tmp; }
+    operator Vertex_handle() const { return Base::base(); } 
+  };
+
+  class Finite_vertices_iterator :
+    public Filter_iterator<Finite_vib, Hidden_tester> {
+    typedef Filter_iterator<Finite_vib, Hidden_tester> Base; 
+    typedef Finite_vertices_iterator                          Self;
+  public:
+    Finite_vertices_iterator() : Base() {}
+    Finite_vertices_iterator(const Base &b) : Base(b) {}
+    Self & operator++() { Base::operator++(); return *this; }
+    Self & operator--() { Base::operator--(); return *this; }
+    Self operator++(int) { Self tmp(*this); ++(*this); return tmp; }
+    Self operator--(int) { Self tmp(*this); --(*this); return tmp; }
+    operator Vertex_handle() const { return Base::base(); }
+ };
+
+  class Hidden_vertices_iterator :
+    public Filter_iterator<Finite_vib, Unhidden_tester> {
+    typedef Filter_iterator<Finite_vib, Unhidden_tester> Base; 
+    typedef Hidden_vertices_iterator                     Self;
+  public:
+    Hidden_vertices_iterator() : Base() {}
+    Hidden_vertices_iterator(const Base &b) : Base(b) {}
+    Self & operator++() { Base::operator++(); return *this; }
+    Self & operator--() { Base::operator--(); return *this; }
+    Self operator++(int) { Self tmp(*this); ++(*this); return tmp; }
+    Self operator--(int) { Self tmp(*this); --(*this); return tmp; }
+    operator Vertex_handle() const { return Base::base(); }
+ };
+
+ //for backward compatibility
+  typedef Finite_faces_iterator                Face_iterator;
+  typedef Finite_edges_iterator                Edge_iterator;
+  typedef Finite_vertices_iterator             Vertex_iterator;
+
+ //Tag to distinguish Delaunay from Regular triangulations
+  typedef Tag_true  Weighted_tag;
+
+private:
+  size_type _hidden_vertices;
+
+public:
+  Regular_triangulation_2(const Gt& gt=Gt()) 
+    : Base(Weighted_point_mapper_2<Gt>(gt)), _hidden_vertices(0) {}
+
+  Regular_triangulation_2(const Regular_triangulation_2 &rt);
+
+  template < class InputIterator >
+  Regular_triangulation_2(InputIterator first, InputIterator last,
+                          const Gt& gt=Gt())
+    : Base(Weighted_point_mapper_2<Gt>(gt)), _hidden_vertices(0)
+  {
+    insert(first, last);
+  }
+
+  Regular_triangulation_2 & operator=(const Regular_triangulation_2 &tr);
+
+  size_type number_of_vertices() const {
+    return Base::number_of_vertices() - _hidden_vertices;
+  }
+ 
+  size_type number_of_hidden_vertices() const {
+    return _hidden_vertices;
+  }
+
+  // CHECK - QUERY
+
+  Oriented_side power_test(const Weighted_point &p,
+			   const Weighted_point &q,
+			   const Weighted_point &r,
+			   const Weighted_point &s, bool perturb) const;
+  Oriented_side power_test(const Weighted_point &p,
+			   const Weighted_point &q,
+			   const Weighted_point &r) const;
+  Oriented_side power_test(const Weighted_point &p,
+			   const Weighted_point &r) const;
+  Oriented_side power_test(const Face_handle &f, 
+			   const Weighted_point &p, bool perturb=false) const;
+  Oriented_side power_test(const Face_handle& f, int i,
+			   const Weighted_point &p) const;
+ 
+  
+  bool is_valid(bool verbose = false, int level = 0) const;
+  bool test_conflict(const Weighted_point  &p, Face_handle fh) const;
+  void show_face(Face_handle fh) const;
+  void show_all() const;	
+  
+   //  //template member functions, declared and defined at the end 
+  //  template <class OutputItFaces, class OutputItBoundaryEdges, 
+  //                                       class OutputItHiddenVertices> 
+  //   Triple<OutputItFaces,OutputItBoundaryEdges, OutputItHiddenVertices>
+  //   get_conflicts_and_boundary_and_hidden_vertices (const
+  //   Weighted_point  &p, 
+  // 						  OutputItFaces fit, 
+  // 						  OutputItBoundaryEdges eit,
+  // 						  OutputItHiddenVertices vit,  
+  // 						  Face_handle start = 
+  //                                                 Face_handle()) const;
+  // template <class OutputItFaces, class OutputItBoundaryEdges> 
+  // std::pair<OutputItFaces,OutputItBoundaryEdges>
+  // get_conflicts_and_boundary(const Weighted_point  &p, 
+  // 		                OutputItFaces fit, 
+  // 		                OutputItBoundaryEdges eit,
+  // 		                Face_handle start) const;
+  // template <class OutputItFaces>
+  // OutputItFaces
+  // get_conflicts (const Weighted_point  &p, 
+  //                OutputItFaces fit, 
+  // 		    Face_handle start ) const;
+  // template <class OutputItBoundaryEdges>
+  // OutputItBoundaryEdges
+  // get_boundary_of_conflicts(const Weighted_point  &p, 
+  // 			       OutputItBoundaryEdges eit, 
+  // 			       Face_handle start ) const;
+  //   template <class OutputItBoundaryEdges, class OutputItHiddenVertices> 
+  //   std::pair<OutputItBoundaryEdges, OutputItHiddenVertices> 
+  //   get_boundary_of_conflicts_and_hidden_vertices(const Weighted_point  &p, 
+  // 						OutputItBoundaryEdges eit, 
+  // 						OutputItHiddenVertices vit,
+  // 						Face_handle start=
+  //                                                Face_handle()) const;
+  //   template <class OutputItHiddenVertices> 
+  //   OutputItHiddenVertices
+  //   get_hidden_vertices(const Weighted_point  &p, 
+  // 			   OutputItHiddenVertices vit,
+  // 			   Face_handle start= 
+  //                       Face_handle()) const;
+  
+  // DUAL
+  Bare_point dual (Face_handle f) const;
+  Object dual(const Edge &e) const ;
+  Object dual(const Edge_circulator& ec) const;
+  Object dual(const Finite_edges_iterator& ei) const;
+  Bare_point weighted_circumcenter(Face_handle f) const; 
+  Bare_point weighted_circumcenter(const Weighted_point& p0, 
+			      const Weighted_point& p1, 
+			      const Weighted_point& p2) const;
+
+  // Insertion, Deletion and Flip
+  Vertex_handle push_back(const Weighted_point &p);
+  Vertex_handle insert(const Weighted_point &p, 
+		       Face_handle f = Face_handle() );
+  Vertex_handle insert(const Weighted_point &p,
+	 	       Locate_type  lt,
+		       Face_handle loc, int li );
+  Vertex_handle insert_in_face(const Weighted_point &p, Face_handle f);
+  Vertex_handle insert_in_edge(const Weighted_point &p, Face_handle f, int i);
+  void flip(Face_handle f, int i);
+  void remove_degree_3(Vertex_handle v, 
+		       Face_handle f = Face_handle());
+  void remove(Vertex_handle v);
+
+  All_vertices_iterator all_vertices_begin () const;
+  All_vertices_iterator all_vertices_end () const;
+
+  Finite_vertices_iterator finite_vertices_begin () const;
+  Finite_vertices_iterator finite_vertices_end () const;
+  Vertex_handle finite_vertex() const;
+
+  Hidden_vertices_iterator hidden_vertices_begin () const;
+  Hidden_vertices_iterator hidden_vertices_end () const;
+
+  //  Vertex_handle file_input(std::istream& is);
+  // void file_output(std::ostream& os) const;
+
+public:
+  void clear();
+  void copy_triangulation(const Self& tr);
+private:
+  void copy_triangulation_();
+  Vertex_handle reinsert(Vertex_handle v, Face_handle start);
+  void regularize(Vertex_handle v);
+  void remove_hidden(Vertex_handle v);
+  void remove_2D(Vertex_handle v);
+  void fill_hole_regular(std::list<Edge> & hole);
+  void set_face(Vertex_list& vl, const Face_handle& fh);
+  void update_hidden_points_3_1(const Face_handle& f1, const Face_handle& f2, 
+				const Face_handle& f3);
+  void update_hidden_points_2_2(const Face_handle& f1, const Face_handle& f2);
+  void update_hidden_points_1_3(const Face_handle& f1, const Face_handle& f2,
+				const Face_handle& f3);
+
+  Vertex_handle hide_new_vertex(Face_handle f, const Weighted_point& p);
+  void hide_remove_degree_3(Face_handle fh, Vertex_handle vh);
+  void hide_vertex(Face_handle f, Vertex_handle v);
+   void exchange_incidences(Vertex_handle va, Vertex_handle vb);
+  void exchange_hidden(Vertex_handle va, Vertex_handle vb);
+
+  void stack_flip(Vertex_handle v, Faces_around_stack &faces_around);
+  void stack_flip_4_2(Face_handle f, int i, int j, 
+		      Faces_around_stack &faces_around);
+  void stack_flip_3_1(Face_handle f, int i, int j,
+		      Faces_around_stack &faces_around);
+  void stack_flip_2_2(Face_handle f, int i, 
+		      Faces_around_stack &faces_around);
+  void stack_flip_dim1(Face_handle f, int i,
+		       Faces_around_stack &faces_around);
+  bool is_valid_face(Face_handle fh) const;
+  bool is_valid_vertex(Vertex_handle fh) const;
+		       
+
+
+public:
+#ifndef CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
+  template < class InputIterator >
+  std::ptrdiff_t
+  insert( InputIterator first, InputIterator last,
+          typename boost::enable_if<
+              boost::is_convertible<
+                  typename std::iterator_traits<InputIterator>::value_type,
+                  Weighted_point
+              >
+          >::type* = NULL  
+  )
+#else  
+  template < class InputIterator >
+  std::ptrdiff_t
+  insert(InputIterator first, InputIterator last)
+#endif //CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
+  {
+      size_type n = number_of_vertices();
+
+      std::vector<Weighted_point> points (first, last);
+      spatial_sort (points.begin(), points.end(), geom_traits());
+
+      Face_handle hint;
+      for (typename std::vector<Weighted_point>::const_iterator p = points.begin(),
+		      end = points.end();
+              p != end; ++p)
+          hint = insert (*p, hint)->face();
+
+      return number_of_vertices() - n;
+  }
+
+#ifndef CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
+private:
+  //top stands for tuple-or-pair
+  template <class Info>
+  const Weighted_point& top_get_first(const std::pair<Weighted_point,Info>& pair) const { return pair.first; }
+  template <class Info>
+  const Info& top_get_second(const std::pair<Weighted_point,Info>& pair) const { return pair.second; }
+  template <class Info>
+  const Weighted_point& top_get_first(const boost::tuple<Weighted_point,Info>& tuple) const { return boost::get<0>(tuple); }
+  template <class Info>
+  const Info& top_get_second(const boost::tuple<Weighted_point,Info>& tuple) const { return boost::get<1>(tuple); }
+
+  template <class Tuple_or_pair,class InputIterator>
+  std::ptrdiff_t insert_with_info(InputIterator first,InputIterator last)
+  {
+    size_type n = number_of_vertices();
+    std::vector<std::size_t> indices;
+    std::vector<Weighted_point> points;
+    std::vector<typename Triangulation_data_structure::Vertex::Info> infos;
+    std::size_t index=0;
+    for (InputIterator it=first;it!=last;++it){
+      Tuple_or_pair pair = *it;
+      points.push_back( top_get_first(pair) );
+      infos.push_back ( top_get_second(pair) );
+      indices.push_back(index++);
+    }
+
+    typedef typename Pointer_property_map<Weighted_point>::type Pmap;
+    typedef Spatial_sort_traits_adapter_2<Geom_traits,Pmap> Search_traits;
+    
+    spatial_sort(indices.begin(),
+                 indices.end(),
+                 Search_traits(make_property_map(points),geom_traits()));
+
+    Face_handle hint;
+    Vertex_handle v_hint;
+    for (typename std::vector<std::size_t>::const_iterator
+      it = indices.begin(), end = indices.end();
+      it != end; ++it)
+    {
+      v_hint = insert (points[*it], hint);
+      
+      if (v_hint!=Vertex_handle()){
+        v_hint->info()=infos[*it];
+        hint=v_hint->face();
+      }
+    }
+
+    return number_of_vertices() - n;
+  }
+  
+public:
+
+  template < class InputIterator >
+  std::ptrdiff_t
+  insert( InputIterator first,
+          InputIterator last,
+          typename boost::enable_if<
+              boost::is_convertible<
+                typename std::iterator_traits<InputIterator>::value_type,
+                std::pair<Weighted_point,typename internal::Info_check<typename Triangulation_data_structure::Vertex>::type>
+              >
+          >::type* = NULL
+  )
+  {return insert_with_info< std::pair<Weighted_point,typename internal::Info_check<typename Triangulation_data_structure::Vertex>::type> >(first,last);}
+  
+  template <class  InputIterator_1,class InputIterator_2>
+  std::ptrdiff_t
+  insert( boost::zip_iterator< boost::tuple<InputIterator_1,InputIterator_2> > first,
+          boost::zip_iterator< boost::tuple<InputIterator_1,InputIterator_2> > last,
+          typename boost::enable_if<
+            boost::mpl::and_<
+              typename boost::is_convertible< typename std::iterator_traits<InputIterator_1>::value_type, Weighted_point >,
+              typename boost::is_convertible< typename std::iterator_traits<InputIterator_2>::value_type, typename internal::Info_check<typename Triangulation_data_structure::Vertex>::type >
+            >
+          >::type* =NULL
+  )
+  {return insert_with_info< boost::tuple<Weighted_point,typename internal::Info_check<typename Triangulation_data_structure::Vertex>::type> >(first,last);}
+#endif //CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO  
+  
+  template < class Stream>
+  Stream& draw_dual(Stream & ps) const
+    {
+      Finite_edges_iterator eit = finite_edges_begin();
+      for (; eit != finite_edges_end(); ++eit) {
+	Object o = dual(eit);
+	typename Geom_traits::Line_2  l;
+	typename Geom_traits::Ray_2   r;
+	typename Geom_traits::Segment_2 s;
+	if (CGAL::assign(s,o)) ps << s;
+	if (CGAL::assign(r,o)) ps << r;
+	if (CGAL::assign(l,o)) ps << l;
+      }
+      return ps;
+    }
+   template <class OutputItFaces, class OutputItBoundaryEdges, 
+     class OutputItHiddenVertices> 
+   Triple<OutputItFaces,OutputItBoundaryEdges, OutputItHiddenVertices>
+   get_conflicts_and_boundary_and_hidden_vertices(const Weighted_point  &p, 
+						  OutputItFaces fit, 
+						  OutputItBoundaryEdges eit,
+						  OutputItHiddenVertices vit,
+						  Face_handle start = 
+						  Face_handle()) const
+    {
+      CGAL_triangulation_precondition( dimension() == 2);
+      int li;
+      Locate_type lt;
+      Face_handle fh = locate(p,lt,li, start);
+      switch(lt) {
+      case OUTSIDE_AFFINE_HULL:
+	return make_triple(fit, eit, vit);
+      case VERTEX:
+      case FACE:
+      case EDGE:
+      case OUTSIDE_CONVEX_HULL:
+	//test whether p is not in conflict 
+	// with the first face: 
+	// this includes the cases that p is located 
+	// on a vertex and either equal or no conflict
+	if (!test_conflict(p,fh))
+	  return make_triple(fit, eit, vit);
+	
+	// region includes all faces in conflict so far detected
+	// stack includes the faces in the region whose neighbors
+	// have not yet been looked at
+	std::set<Face_handle> region;
+	std::stack<Edge> st; 
+	
+	//collection of all boundary_vertices:
+	std::set< Vertex_handle> boundary_vertices;
+	//collection of potential_intern_vertices = vertices incident
+	// to an edge incident to two faces in conflict and met 
+	// twice during the "walk":
+	std::set< Vertex_handle> potential_intern_vertices;
+	
+	*fit++ = fh; //put fh in OutputItFaces
+	region.insert(fh);
+	st.push(Edge(fh,2));
+	st.push(Edge(fh,1));	
+	st.push(Edge(fh,0));
+
+	while (! st.empty()){
+	  Edge e = st.top();
+ 	  st.pop();
+	  Face_handle fh = e.first;
+	  Face_handle fn = fh->neighbor(e.second);
+	  int i = fn->index(fh);
+	  if( region.find(fn) == region.end() ){
+	    if (test_conflict(p,fn))
+	      {
+		region.insert(fn);
+		st.push(Edge(fn, cw(i)));
+		st.push(Edge(fn,ccw(i)));
+		*fit++ = fn;
+	      }
+	    else{ 
+	      e = Edge(fn,i);
+	      *eit++ = e;
+	      if(!is_infinite(fn->vertex(cw(i))))
+		boundary_vertices.insert(fn->vertex(cw(i)));
+	       if(!is_infinite(fn->vertex(ccw(i))))
+		 boundary_vertices.insert(fn->vertex(ccw(i)));
+	    }
+	  }
+	  else {
+	    //insert the vertices of the last edge into the set of 
+	    // potential intern vertices:
+	    potential_intern_vertices.insert(fn->vertex(ccw(i)));
+	    potential_intern_vertices.insert(fn->vertex(cw(i)));
+	  }
+	}
+	if(!potential_intern_vertices.empty()){
+	  //determine the hidden vertices:
+	  std::set_difference (potential_intern_vertices.begin(), 
+			  potential_intern_vertices.end(),
+			  boundary_vertices.begin(),
+			  boundary_vertices.end(),
+			  vit); 
+	}
+	return  make_triple(fit, eit, vit);
+      }
+      CGAL_triangulation_assertion(false);
+      return make_triple(fit, eit, vit);
+    }
+  
+  template <class OutputItFaces, class OutputItBoundaryEdges> 
+  std::pair<OutputItFaces,OutputItBoundaryEdges>
+  get_conflicts_and_boundary (const Weighted_point  &p, 
+			      OutputItFaces fit, 
+			      OutputItBoundaryEdges eit,
+			      Face_handle start = Face_handle()) const
+    {
+      Triple<OutputItFaces,OutputItBoundaryEdges,Emptyset_iterator>
+	pp = 
+	get_conflicts_and_boundary_and_hidden_vertices(p, fit, eit,
+       						       Emptyset_iterator(), 
+       						       start);
+      return std::make_pair(pp.first, pp.second);
+    }
+  template <class OutputItFaces, class OutputItHiddenVertices> 
+  std::pair<OutputItFaces, OutputItHiddenVertices> 
+  get_conflicts_and_hidden_vertices(const Weighted_point  &p, 
+				    OutputItFaces fit, 
+				    OutputItHiddenVertices vit,
+				    Face_handle start = 
+				    Face_handle()) const
+    {
+      Triple<OutputItFaces, Emptyset_iterator,OutputItHiddenVertices> 
+	pp = 
+	get_conflicts_and_boundary_and_hidden_vertices(p,fit,
+						       Emptyset_iterator(), 
+						       vit,
+						       start);
+      return std::make_pair(pp.first,pp.third);
+    }
+
+
+   template <class OutputItBoundaryEdges, class OutputItHiddenVertices> 
+  std::pair<OutputItBoundaryEdges, OutputItHiddenVertices> 
+  get_boundary_of_conflicts_and_hidden_vertices(const Weighted_point  &p, 
+						OutputItBoundaryEdges eit, 
+						OutputItHiddenVertices vit,
+						Face_handle start = 
+						Face_handle()) const
+    {
+      Triple<Emptyset_iterator,OutputItBoundaryEdges,
+	OutputItHiddenVertices> 
+	pp = 
+	get_conflicts_and_boundary_and_hidden_vertices(p,
+						       Emptyset_iterator(), 
+						       eit,vit,
+						       start);
+      return std::make_pair(pp.second,pp.third);
+    }
+
+  template <class OutputItFaces> 
+  OutputItFaces
+  get_conflicts (const Weighted_point  &p, 
+		 OutputItFaces fit, 
+		 Face_handle start= Face_handle()) const
+    {
+      Triple<OutputItFaces,Emptyset_iterator,Emptyset_iterator>
+	pp = 
+	get_conflicts_and_boundary_and_hidden_vertices(p, fit, 
+						       Emptyset_iterator(),
+						       Emptyset_iterator(), 
+						       start);
+      return pp.first;
+    }
+  
+  template <class OutputItBoundaryEdges> 
+  OutputItBoundaryEdges
+  get_boundary_of_conflicts(const Weighted_point  &p, 
+			    OutputItBoundaryEdges eit, 
+			    Face_handle start= Face_handle()) const
+    {    
+      Triple<Emptyset_iterator, OutputItBoundaryEdges,Emptyset_iterator>
+	pp = 
+	get_conflicts_and_boundary_and_hidden_vertices(p,
+						       Emptyset_iterator(),
+						       eit,
+						       Emptyset_iterator(), 
+						       start);
+      return pp.second;
+    }
+  template <class OutputItHiddenVertices> 
+  OutputItHiddenVertices 
+  get_hidden_vertices(const Weighted_point  &p, OutputItHiddenVertices vit,
+		      Face_handle start= Face_handle()) const
+    {
+      Triple<Emptyset_iterator,Emptyset_iterator,
+	OutputItHiddenVertices> 
+	pp = 
+	get_conflicts_and_boundary_and_hidden_vertices(p,Emptyset_iterator(), 
+						       Emptyset_iterator(),vit,
+						       start);
+      return pp.third;
+    }
+
+  // nearest power vertex query
+  Vertex_handle nearest_power_vertex(const Bare_point& p) const;
+};
+
+template < class Gt, class Tds >
+inline bool
+Regular_triangulation_2<Gt,Tds>::
+test_conflict(const Weighted_point  &p, Face_handle fh) const
+{
+  return(power_test(fh,p) == ON_POSITIVE_SIDE);
+}   
+
+template < class Gt, class Tds >
+void
+Regular_triangulation_2<Gt,Tds>::
+clear()
+{
+  Base::clear();
+  _hidden_vertices = 0;
+}
+
+template < class Gt, class Tds >
+void
+Regular_triangulation_2<Gt,Tds>::
+copy_triangulation_()
+{
+  // the list of vertices have been copied member for member and are
+  // not good
+  // clear them and next
+  // scan the hidden vertices to retablish the list in faces
+  typename Tds::Face_iterator 
+                       baseit= this->_tds.face_iterator_base_begin();
+  for( ; baseit !=  this->_tds.face_iterator_base_end(); baseit++){
+    baseit->vertex_list().clear();
+  }
+  Hidden_vertices_iterator hvit = hidden_vertices_begin();
+  for( ; hvit !=  hidden_vertices_end() ; ++hvit){
+    hvit->face()->vertex_list().push_back(hvit);
+  }
+  CGAL_triangulation_postcondition(is_valid());
+}
+
+template < class Gt, class Tds >
+void
+Regular_triangulation_2<Gt,Tds>::
+copy_triangulation(const Self &tr )
+{
+  Base::copy_triangulation(tr);
+  _hidden_vertices = tr._hidden_vertices;
+  copy_triangulation_();
+}
+
+template < class Gt, class Tds >
+Regular_triangulation_2<Gt,Tds>::
+Regular_triangulation_2(const Self &tr)
+  : Base(tr), _hidden_vertices(tr._hidden_vertices)
+{
+  copy_triangulation_();
+}
+
+template <class Gt, class Tds >
+Regular_triangulation_2<Gt,Tds> &
+Regular_triangulation_2<Gt, Tds>::
+operator=(const Self &tr)
+{
+  copy_triangulation(tr);
+  return *this;
+}
+
+template < class Gt, class Tds >
+Oriented_side
+Regular_triangulation_2<Gt,Tds>::
+power_test(const Face_handle &f, const Weighted_point &p, bool perturb) const
+{
+  // p is supposed to be a finite point
+  // if f is a finite face, 
+  // return  ON_NEGATIVE_SIDE if p is above f 
+  // (p has to be hidden)
+  if (dimension() == 1) return power_test(f->vertex(0)->point(),
+					  f->vertex(1)->point(),p);
+  int i;
+  if ( ! f->has_vertex(infinite_vertex(), i) )
+    return power_test(f->vertex(0)->point(),
+		      f->vertex(1)->point(),
+		      f->vertex(2)->point(),p, perturb);
+
+  Orientation o = orientation(f->vertex(ccw(i))->point(),
+			      f->vertex( cw(i))->point(),
+			      p);
+  if (o==COLLINEAR)
+    return power_test(f->vertex(ccw(i))->point(),
+		      f->vertex( cw(i))->point(),p);
+
+  return o;
+}
+
+template < class Gt, class Tds >
+Oriented_side
+Regular_triangulation_2<Gt,Tds>::
+power_test(const Face_handle& f, int i,
+	   const Weighted_point &p) const
+{
+  // f,i is supposed to be a finite edge
+  // p is supposed to be on  edge (f,i)
+  // return ON_NEGATIVE_SIDE if p is above (f,i)
+  // (p has to be hidden)
+  CGAL_triangulation_precondition (!is_infinite(f,i) &&
+	     orientation(f->vertex(ccw(i))->point(),
+			 f->vertex( cw(i))->point(),
+			 p) == COLLINEAR);
+  return  power_test(f->vertex(ccw(i))->point(),
+		     f->vertex( cw(i))->point(),
+		     p);
+}
+
+template < class Gt, class Tds >
+inline
+Oriented_side
+Regular_triangulation_2<Gt,Tds>::
+power_test(const Weighted_point &p0,
+	   const Weighted_point &p1,
+	   const Weighted_point &p2,
+	   const Weighted_point &p,
+           bool perturb) const
+{
+    CGAL_triangulation_precondition( orientation(p0, p1, p2) == POSITIVE );
+
+    using namespace boost;
+
+    Oriented_side os = geom_traits().power_test_2_object()(p0, p1, p2, p);
+
+    if ( (os != ON_ORIENTED_BOUNDARY) || (! perturb))
+        return os;
+
+    // We are now in a degenerate case => we do a symbolic perturbation.
+
+    // We sort the points lexicographically.
+    const Weighted_point * points[4] = {&p0, &p1, &p2, &p};
+    std::sort(points, points + 4,
+              boost::bind(&Self::compare_xy, this,
+                          boost::bind(Dereference<Weighted_point>(), _1),
+                          boost::bind(Dereference<Weighted_point>(), _2)) == SMALLER);
+
+
+
+
+
+    // We successively look whether the leading monomial, then 2nd monomial
+    // of the determinant has non null coefficient.
+    // 2 iterations are enough (cf paper)
+    for (int i=3; i>1; --i) {
+        if (points[i] == &p)
+            return ON_NEGATIVE_SIDE; // since p0 p1 p2 are non collinear
+                                     // and positively oriented
+	Orientation o;
+        if (points[i] == &p2 && (o = orientation(p0,p1,p)) != COLLINEAR )
+            return o;
+        if (points[i] == &p1 && (o = orientation(p0,p,p2)) != COLLINEAR )
+            return o;
+        if (points[i] == &p0 && (o = orientation(p,p1,p2)) != COLLINEAR )
+            return o;
+    }
+
+    CGAL_triangulation_assertion(false);
+    return ON_NEGATIVE_SIDE;
+}
+
+template < class Gt, class Tds >
+inline
+Oriented_side
+Regular_triangulation_2<Gt,Tds>::
+power_test(const Weighted_point &p,
+	   const Weighted_point &q,
+	   const Weighted_point &r) const
+{
+  return geom_traits().power_test_2_object()(p,q,r);
+}
+
+template < class Gt, class Tds >
+inline
+Oriented_side
+Regular_triangulation_2<Gt,Tds>::
+power_test(const Weighted_point &p,
+	   const Weighted_point &r) const
+{
+  return geom_traits().power_test_2_object()(p,r);
+}
+
+template < class Gt, class Tds >
+bool
+Regular_triangulation_2<Gt,Tds>::
+is_valid_face(Face_handle fh) const
+{
+  bool result = true;
+  if(is_infinite(fh)) result = result && fh->vertex_list().empty();
+  if (!result) { show_face(fh);}
+  CGAL_triangulation_assertion(result);
+
+  typename Vertex_list::iterator vlit = fh->vertex_list().begin(),
+	                       vldone = fh->vertex_list().end();
+  for (; vlit != vldone; vlit++)    {
+    result = result && power_test(fh, (*vlit)->point()) == ON_NEGATIVE_SIDE;
+    result = result && ((*vlit)->face() == fh);
+    if (!result)     show_face(fh);
+    CGAL_triangulation_assertion(result); 
+  }
+  return result;
+}
+
+template < class Gt, class Tds >
+bool
+Regular_triangulation_2<Gt,Tds>::
+is_valid_vertex(Vertex_handle vh) const
+{
+  bool result = true;
+  if (vh->is_hidden()) {
+    Locate_type lt; 
+    int li;
+    Face_handle loc  = locate(vh->point(), lt, li, vh->face());
+    if (dimension() == 0) {
+        result = result && lt == Base::VERTEX;
+        result = result && power_test (vh->face()->vertex(0)->point(), vh->point()) <= 0;
+    } else {
+        result = result && (!is_infinite(vh->face()));
+        result = result && (loc == vh->face() ||
+                (lt == Base::VERTEX && 
+                 vh->face()->has_vertex(loc->vertex(li))) ||
+                (lt == Base::EDGE && vh->face() ==
+                 loc->neighbor(li)) );
+
+        result = result && 
+            power_test(vh->face(),vh->point()) == ON_NEGATIVE_SIDE;
+//            if ( !result) {
+//               std::cerr << " from is_valid_vertex " << std::endl;
+//               std::cerr << "sommet cache " << &*(vh) 
+//         		<< "vh_point " <<vh->point() << " " << std::endl;
+//               std::cerr << "vh_>face " << &*(vh->face())  << " " << std::endl;
+//               std::cerr <<  "loc      " <<  &*(loc )
+//         	        << " lt " << lt  << " li " << li << std::endl;
+//               show_face(vh->face());
+//               show_face(loc);
+//             }
+    }
+  }
+  else { // normal vertex
+    result = result && vh->face()->has_vertex(vh);
+//     if ( !result) {
+//       std::cerr << " from is_valid_vertex " << std::endl;
+//       std::cerr << "normal vertex " << &(*vh) << std::endl;
+//       std::cerr << vh->point() << " " << std::endl;
+//       std::cerr << "vh_>face " << &*(vh->face())  << " " << std::endl;
+//       show_face(vh->face());
+//     }
+  }
+  CGAL_triangulation_assertion(result);
+  return result;
+}
+
+template < class Gt, class Tds >
+bool
+Regular_triangulation_2<Gt,Tds>::
+is_valid(bool verbose, int /* level */) const
+{
+  // cannot call for is_valid() of Base Triangulation class
+  // because 1) number of vertices of base class does not match
+  // tds.is_valid calls is_valid for each vertex
+  // and the test is not fullfilled by  hidden vertices ...
+  // result = result && Triangulation_2<Gt,Tds>::is_valid(verbose, level);
+  bool result = true;
+  for(All_faces_iterator fit = all_faces_begin(); 
+      fit != all_faces_end(); ++fit) {
+    result = result && is_valid_face(fit);
+  }
+
+  for(All_vertices_iterator vit = all_vertices_begin(); 
+                            vit != all_vertices_end(); ++vit) {
+    result = result && is_valid_vertex(vit);
+  }
+
+   for(Hidden_vertices_iterator hvit = hidden_vertices_begin(); 
+                                hvit != hidden_vertices_end(); ++hvit) {
+    result = result && is_valid_vertex(hvit);
+  }
+
+   switch(dimension()) {
+   case 0 :
+     break;
+   case 1:
+     if (number_of_vertices() > 2 ) {
+       Finite_vertices_iterator it1 = finite_vertices_begin(),
+	 it2(it1), it3(it1);
+       ++it2;
+       ++it3; ++it3;
+       while( it3 != finite_vertices_end()) {
+	 Orientation s = orientation(it1->point(),
+				    it2->point(),
+				    it3->point()); 
+	 result = result && s == COLLINEAR ;
+	 CGAL_triangulation_assertion(result);
+	 ++it1 ; ++it2; ++it3;
+       }
+     }
+     break;
+   case 2 :
+    for(Finite_faces_iterator it=finite_faces_begin(); 
+	 it!=finite_faces_end(); it++) {
+      CGAL_triangulation_assertion( ! is_infinite(it));
+      Orientation s = orientation(it->vertex(0)->point(),
+				  it->vertex(1)->point(),
+				  it->vertex(2)->point());
+      CGAL_triangulation_assertion( s == LEFT_TURN );
+      result = result && ( s == LEFT_TURN );
+
+      for (int i = 0 ; i < 3 ; i++) {
+	if (!is_infinite(it->vertex(i)))
+	  result = result && ON_POSITIVE_SIDE != 
+	    power_test(it->neighbor(i), it->vertex(i)->point());
+	CGAL_triangulation_assertion(result);
+      }
+    }
+
+     Vertex_circulator start = incident_vertices(infinite_vertex());
+     Vertex_circulator pc(start);
+     Vertex_circulator qc(start); ++qc;
+     Vertex_circulator rc(start); ++rc; ++rc;
+     do{
+       Orientation s = orientation(pc->point(),
+				   qc->point(),
+				   rc->point());
+       CGAL_triangulation_assertion( s != LEFT_TURN );
+       result = result && ( s != LEFT_TURN );
+       ++pc ; ++qc ; ++rc;
+     } while(pc != start);
+ 
+     // check number of faces. This cannot be done by the Tds
+     // which does not know the number of components nor the genus
+     result = result && (number_of_faces() == 2*(number_of_vertices()+1)
+		                            - 4 
+                                           - degree(infinite_vertex()));
+     CGAL_triangulation_assertion( result);
+     break;
+   }
+  
+   // in any dimension
+   if(verbose) {
+     std::cerr << " nombres de sommets " << number_of_vertices() << "\t"
+	       << "nombres de sommets  caches " << number_of_hidden_vertices()
+	       << std::endl;
+   }
+   result = result && ( Base::number_of_vertices() ==
+			number_of_vertices() + number_of_hidden_vertices());
+   CGAL_triangulation_assertion( result);
+   return result;
+}
+
+
+template <class Gt, class Tds >
+void
+ Regular_triangulation_2<Gt, Tds>::
+show_face(Face_handle fh) const
+{
+  Base::show_face(fh);
+
+  typename Vertex_list::iterator current;
+  std::cerr << "  +++++>>>    ";
+  for (current= fh->vertex_list().begin(); 
+       current!= fh->vertex_list().end() ; current++ ) {
+        std::cerr <<"[ "<< ((*current)->point()) << " ] ,  ";
+  }
+  std::cerr <<std::endl;
+}
+
+
+template < class Gt, class Tds >
+void
+Regular_triangulation_2<Gt,Tds>::
+show_all() const
+{
+  std::cerr<< "AFFICHE TOUTE LA TRIANGULATION :" << std::endl;
+  std::cerr << std::endl<<"====> "<< this ;
+  std::cerr <<  " dimension " <<  dimension() << std::endl;
+  std::cerr << "nb of vertices " << number_of_vertices() 
+	    << " nb of hidden vertices " << number_of_hidden_vertices() 
+	    <<   std::endl;
+
+  if (dimension() < 1) return;
+  if(dimension() == 1) {
+    std::cerr<<" all edges "<<std::endl; 
+    All_edges_iterator aeit;
+    for(aeit = all_edges_begin(); aeit != all_edges_end(); aeit++){
+      show_face(aeit->first);
+    }
+   }
+  
+  else{ //dimension ==2
+    std::cerr<<" faces finies "<<std::endl;
+    Finite_faces_iterator fi;
+    for(fi = finite_faces_begin(); fi != finite_faces_end(); fi++) {
+      show_face(fi);
+    }
+
+    std::cerr <<" faces infinies "<<std::endl;
+    All_faces_iterator afi;
+    for(afi = all_faces_begin(); afi != all_faces_end(); afi++) {
+      if(is_infinite(afi)) show_face(afi);
+    }
+  }
+  
+  if (number_of_vertices()>1) {
+    std::cerr << "affichage des sommets de la triangulation reguliere"
+	      <<std::endl;
+    All_vertices_iterator vi;
+    for( vi = all_vertices_begin(); vi != all_vertices_end(); vi++){
+      show_vertex(vi);
+      std::cerr << "  / face associee : "
+	     <<  &*(vi->face()) << std::endl;
+      }
+      std::cerr<<std::endl;
+  }
+  
+   std::cerr << "sommets caches "  << std::endl;
+   Hidden_vertices_iterator hvi = hidden_vertices_begin();
+   for( ; hvi != hidden_vertices_end(); hvi++) {
+     show_vertex(hvi);
+      std::cerr << "  / face associee : "
+	     << &*(hvi->face()) << std::endl;
+   }
+  return;
+}
+
+
+
+//DUALITY
+template < class Gt, class Tds >
+inline
+typename Regular_triangulation_2<Gt,Tds>::Bare_point
+Regular_triangulation_2<Gt,Tds>::
+dual (Face_handle f) const
+{
+  return weighted_circumcenter(f);
+}
+
+template < class Gt, class Tds >
+inline
+typename Regular_triangulation_2<Gt,Tds>::Bare_point
+Regular_triangulation_2<Gt,Tds>::
+weighted_circumcenter(Face_handle f) const
+{
+  CGAL_triangulation_precondition (dimension()==2 || !is_infinite(f));
+  return weighted_circumcenter(f->vertex(0)->point(),
+			       f->vertex(1)->point(),
+			       f->vertex(2)->point());
+}
+
+template<class Gt, class Tds>
+inline
+typename Regular_triangulation_2<Gt,Tds>::Bare_point
+Regular_triangulation_2<Gt,Tds>::
+weighted_circumcenter(const Weighted_point& p0, 
+		      const Weighted_point& p1, 
+		      const Weighted_point& p2) const
+{
+  return 
+    geom_traits().construct_weighted_circumcenter_2_object()(p0,p1,p2);
+}
+
+template < class Gt, class Tds >
+inline
+Object
+Regular_triangulation_2<Gt,Tds>::
+dual(const Edge &e) const
+{
+  typedef typename Geom_traits::Line_2        Line;
+  typedef typename Geom_traits::Ray_2         Ray;
+  typedef typename Geom_traits::Segment_2     Segment;
+  
+  CGAL_triangulation_precondition (! is_infinite(e));
+  if( dimension()== 1 ){
+    const Weighted_point& p = (e.first)->vertex(cw(e.second))->point();
+    const Weighted_point& q = (e.first)->vertex(ccw(e.second))->point();
+    Line l  = geom_traits().construct_radical_axis_2_object()(p,q);
+    return make_object(l);
+  }
+  
+  // dimension==2
+  if( (! is_infinite(e.first)) &&
+      (! is_infinite(e.first->neighbor(e.second))) ) {
+    Segment s = geom_traits().construct_segment_2_object()
+      (dual(e.first),dual(e.first->neighbor(e.second)));
+    return make_object(s);
+  } 
+
+  // one of the adjacent faces is infinite
+  Face_handle f; int i;
+  if ( is_infinite(e.first)) {
+    f=e.first->neighbor(e.second); i=f->index(e.first);
+  } 
+  else {
+    f=e.first; i=e.second;
+  }
+  const Weighted_point& p = f->vertex( cw(i))->point();
+  const Weighted_point& q = f->vertex( ccw(i))->point();
+  Line l  = geom_traits().construct_radical_axis_2_object()(p,q);
+  Ray r = geom_traits().construct_ray_2_object()(dual(f), l);
+  return make_object(r);
+}
+  
+
+template < class Gt, class Tds >
+inline 
+Object
+Regular_triangulation_2<Gt,Tds>::  
+dual(const Edge_circulator& ec) const
+{
+  return dual(*ec);
+}
+  
+template < class Gt, class Tds >
+inline 
+Object
+Regular_triangulation_2<Gt,Tds>::
+dual(const Finite_edges_iterator& ei) const
+{
+  return dual(*ei);
+}
+
+//INSERTION-REMOVAL
+template < class Gt, class Tds >
+typename Regular_triangulation_2<Gt,Tds>::Vertex_handle
+Regular_triangulation_2<Gt,Tds>::
+push_back(const Weighted_point &p)
+{	
+    return insert(p);
+}
+
+template < class Gt, class Tds >
+typename Regular_triangulation_2<Gt,Tds>::Vertex_handle
+Regular_triangulation_2<Gt,Tds>::
+insert(const Weighted_point &p, Face_handle start)
+{
+  Locate_type lt;
+  int li;
+  Face_handle loc = locate(p, lt, li, start);
+  return insert(p, lt, loc, li);
+}
+
+template < class Gt, class Tds >
+typename Regular_triangulation_2<Gt,Tds>::Vertex_handle
+Regular_triangulation_2<Gt,Tds>::
+insert(const Weighted_point &p, Locate_type lt, Face_handle loc, int li) 
+{
+    Vertex_handle v;
+    switch (lt) {
+    case Base::VERTEX:
+        {
+            CGAL_precondition (dimension() >= 0);
+            if (dimension() == 0) {
+                // in this case locate() oddly returns loc = NULL and li = 4,
+                // so we work around it.
+                loc = finite_vertex()->face();
+                li = 0;
+            }
+
+            Vertex_handle vv = loc->vertex(li);
+	    CGAL::Oriented_side side = power_test (vv->point(), p);
+	    
+	    switch(side) {
+	      
+	    case ON_NEGATIVE_SIDE:
+	      return hide_new_vertex (loc, p);
+	      
+	    case ON_POSITIVE_SIDE:
+	      v = this->_tds.create_vertex(); 
+	      v->set_point(p);
+	      exchange_incidences(v,vv);
+	      hide_vertex(loc, vv);
+	      regularize (v);
+	      return v;
+	      
+	    case ON_ORIENTED_BOUNDARY:
+	      return vv;
+	    }
+        }
+    case Base::EDGE:
+        {
+            CGAL_precondition (dimension() >= 1);
+            Oriented_side os = dimension() == 1 ? power_test (loc, li, p) :
+                                                  power_test (loc, p, true);
+
+            if (os < 0) {
+                if (is_infinite (loc)) loc = loc->neighbor (li);
+                return hide_new_vertex (loc, p);
+            }
+            v = insert_in_edge (p, loc, li);
+            break;
+        }
+
+    case Base::FACE:
+        {
+            CGAL_precondition (dimension() >= 2);
+            if (power_test (loc, p, true) < 0) {
+                return hide_new_vertex(loc,p);
+            }
+            v = insert_in_face (p, loc);
+            break;
+        }
+    default:
+        v = Base::insert (p, lt, loc, li);
+    }
+
+    if (lt == OUTSIDE_AFFINE_HULL) {
+        //clear vertex list of infinite faces which have been copied
+        for ( All_faces_iterator afi = all_faces_begin();
+                afi != all_faces_end(); afi++)
+            if (is_infinite (afi))
+                afi->vertex_list().clear();
+    }
+
+    regularize (v);
+
+    return v;
+}
+
+/*
+The reinsert function  insert a weighted point which was in a hidden
+vertex.
+The new and old vertices are then exchanged ; this is required
+if the regular triangulation is used with a hierarchy because
+the old vertex has its up and down pointers set and other vertices
+pointing on him
+*/
+template < class Gt, class Tds >
+typename Regular_triangulation_2<Gt,Tds>::Vertex_handle
+Regular_triangulation_2<Gt,Tds>::
+reinsert(Vertex_handle v, Face_handle start)
+{
+  CGAL_triangulation_assertion(v->is_hidden());
+  v->set_hidden(false);
+  _hidden_vertices--;
+ 
+//   //to debug 
+//   std::cerr << "from reinsert " << std::endl;
+//   show_vertex(v);
+//   Locate_type lt;
+//   int li;
+//   Face_handle loc = locate(v->point(), lt, li, start);
+//   std::cerr << "locate " << &(*loc) << "\t" << lt << "\t" << li <<
+//     std::endl;
+//   show_face(loc);
+//    std::cerr << std::endl;
+
+  Vertex_handle vh = insert(v->point(), start);
+  if(vh->is_hidden()) exchange_hidden(v,vh);
+  else  exchange_incidences(v,vh);
+  this->_tds.delete_vertex(vh);
+  return v;
+}
+
+ 
+//push va instead of vb in the list of the face fb hiding vb
+// vb must be the last inserted vertex in the list of fb
+template < class Gt, class Tds >
+void
+Regular_triangulation_2<Gt,Tds>::
+exchange_hidden(Vertex_handle va, Vertex_handle vb)
+{ 
+  CGAL_triangulation_assertion (vb->is_hidden());
+  CGAL_triangulation_assertion (vb == vb->face()->vertex_list().back());
+ 
+//   //to debug 
+//   std::cerr << "from exchange hidden 1" << std::endl;
+//   show_vertex(vb);
+//   std::cerr << "  / face associee : "
+// 	     << &*(vb->face()) << std::endl;
+  
+  vb->face()->vertex_list().pop_back();
+  _hidden_vertices--;
+  hide_vertex(vb->face(), va);
+
+//  //to debug 
+//   std::cerr << "from exchange hidden 1" << std::endl;
+//   show_vertex(va);
+//   std::cerr << "  / face associee : "
+// 	     << &*(va->face()) << std::endl << std::endl; 
+}
+
+// set to va the incidences of vb 
+template < class Gt, class Tds >
+void
+Regular_triangulation_2<Gt,Tds>::
+exchange_incidences(Vertex_handle va, Vertex_handle vb)
+{
+  CGAL_triangulation_assertion ( !vb->is_hidden());
+  std::list<Face_handle> faces;
+  if (dimension() == 0) {
+    faces.push_back (vb->face());
+  } else if (dimension() == 1) {
+    faces.push_back(vb->face());
+    int i = vb->face()->index(vb);
+    faces.push_back(vb->face()->neighbor(1-i));
+  }
+  else {
+    CGAL_triangulation_assertion (dimension() == 2);
+    Face_circulator fc = incident_faces(vb), done(fc);
+    do {
+      faces.push_back(fc);
+      fc++;
+    }while(fc != done);
+  }
+
+  va->set_face(*(faces.begin()));
+  for(typename std::list<Face_handle>::iterator it = faces.begin();
+      it != faces.end(); it++){
+    Face_handle fh = *it;
+    fh->set_vertex(fh->index(vb), va);
+  }
+  return;
+}
+
+template < class Gt, class Tds >
+typename Regular_triangulation_2<Gt,Tds>::Vertex_handle
+Regular_triangulation_2<Gt,Tds>::
+insert_in_face(const Weighted_point &p, Face_handle f)
+{
+  Vertex_handle v = Base::insert_in_face(p,f);
+  update_hidden_points_1_3(f, 
+			   f->neighbor(ccw(f->index(v))), 
+			   f->neighbor( cw(f->index(v))) );
+  return v;
+}
+
+template < class Gt, class Tds >
+typename Regular_triangulation_2<Gt,Tds>::Vertex_handle
+Regular_triangulation_2<Gt,Tds>::
+insert_in_edge(const Weighted_point &p, Face_handle f, int i)
+{
+  Vertex_handle v;
+  if (dimension() == 1) {
+    v = Base::insert_in_edge(p,f,i);
+    Face_handle g = f->neighbor(1 - f->index(v));
+    update_hidden_points_2_2(f,g);
+  }
+  else { //dimension()==2
+    // don't use update_hidden_points_2_2 any more to split
+    // hidden vertices list because new affectation of f and n
+    // around new vertex is unknown
+    Face_handle n = f->neighbor(i);
+    Vertex_list p_list;
+    p_list.splice(p_list.begin(),f->vertex_list());
+    p_list.splice(p_list.begin(),n->vertex_list());
+    v = Base::insert_in_edge(p,f,i);
+    Face_handle loc;
+    while ( ! p_list.empty() ){
+      loc = locate(p_list.front()->point(), n);
+      if (is_infinite(loc)) loc = loc->neighbor(loc->index(infinite_vertex()));
+      hide_vertex(loc, p_list.front());
+      p_list.pop_front();
+    }
+  }
+  return v;
+} 
+
+template < class Gt, class Tds >
+void
+Regular_triangulation_2<Gt,Tds>::
+regularize(Vertex_handle v)
+{
+  CGAL_triangulation_precondition( v != infinite_vertex());
+  Faces_around_stack faces_around;
+
+  if (dimension() < 1) return;
+
+  //initialise faces_around
+  if (dimension() == 1) {
+    faces_around.push_back(v->face());
+    faces_around.push_back(v->face()->neighbor(1- v->face()->index(v)));
+  }
+  else{ //dimension==2
+    Face_circulator fit = incident_faces(v), done(fit);
+    do {
+      faces_around.push_back(fit++);
+    } while(fit != done);
+  }
+
+  while( ! faces_around.empty() )
+    stack_flip(v, faces_around);
+  return;
+}
+
+
+template < class Gt, class Tds >
+void
+Regular_triangulation_2<Gt,Tds>::
+flip(Face_handle f, int i)
+{
+  Face_handle n = f->neighbor(i);
+  Base::flip(f,i);
+  update_hidden_points_2_2(f,n);
+}
+
+
+template < class Gt, class Tds >
+void
+Regular_triangulation_2<Gt,Tds>::
+remove_degree_3(Vertex_handle v, Face_handle f) 
+{
+  if (f == Face_handle())    f=v->face();
+  update_hidden_points_3_1(f, f->neighbor( cw(f->index(v))),
+			   f->neighbor(ccw(f->index(v))));
+  Base::remove_degree_3(v,f);
+  if (is_infinite(f)) { //the list of f is given to its finite neighbor
+    Face_handle fn = f->neighbor(f->index(infinite_vertex()));
+    set_face(f->vertex_list(),fn);
+    fn->vertex_list().splice(fn->vertex_list().begin(),f->vertex_list());
+  }
+
+}
+
+
+template < class Gt, class Tds >
+void
+Regular_triangulation_2<Gt,Tds>::
+remove_hidden(Vertex_handle v )
+{
+  _hidden_vertices--;
+  v->face()->vertex_list().remove(v);
+  delete_vertex(v);
+  return;
+}
+
+template < class Gt, class Tds >
+void
+Regular_triangulation_2<Gt,Tds>::
+remove(Vertex_handle v )
+{
+    CGAL_triangulation_precondition( v != Vertex_handle() );
+    CGAL_triangulation_precondition(!is_infinite(v));
+
+    if (v->is_hidden())
+        return remove_hidden (v);
+
+    Face_handle hint;
+    int ihint = 0;
+
+    Vertex_list to_reinsert;
+    switch (dimension()) {
+    case 0:
+        to_reinsert.splice (to_reinsert.begin(), v->face()->vertex_list());
+        break;
+    case 1:
+        {
+            Face_handle f1 = v->face();
+            ihint = f1->index(v);
+            hint = f1->neighbor(ihint);
+            Face_handle f2 = f1->neighbor(1 - ihint);
+            ihint = mirror_index (f1, ihint);
+
+            to_reinsert.splice (to_reinsert.begin(), f1->vertex_list());
+            to_reinsert.splice (to_reinsert.begin(), f2->vertex_list());
+            break;
+        }
+    case 2:
+        {
+            Face_circulator f = incident_faces (v), end = f;
+            ihint = f->index(v);
+            hint = f->neighbor(ihint);
+            ihint = mirror_index (f, ihint);
+            do to_reinsert.splice (to_reinsert.begin(), f->vertex_list());
+            while (++f != end);
+            break;
+        }
+    }
+
+    if (number_of_vertices() <= 2) {
+        this->_tds.remove_dim_down(v);
+    } else if (dimension() < 2) {
+        Base::remove (v);
+    } else {
+        remove_2D (v);
+    }
+
+    if (hint != Face_handle()) hint = hint->neighbor(ihint);
+
+    for (typename Vertex_list::iterator i = to_reinsert.begin();
+            i != to_reinsert.end(); ++i)
+    {
+        hint = reinsert (*i, hint)->face();
+    }
+}
+
+template < class Gt, class Tds >
+void
+Regular_triangulation_2<Gt,Tds>::
+remove_2D(Vertex_handle v)
+{
+  if (test_dim_down(v)) {  this->_tds.remove_dim_down(v);  }
+  else {
+    std::list<Edge> hole;
+    make_hole(v, hole);
+    fill_hole_regular(hole);
+    delete_vertex(v);
+  }
+  return;   
+}
+
+
+template < class Gt, class Tds >
+void
+Regular_triangulation_2<Gt,Tds>::
+fill_hole_regular(std::list<Edge> & first_hole)
+{
+  typedef std::list<Edge> Hole;
+  typedef std::list<Hole> Hole_list;
+  
+  Hole hole;
+  Hole_list hole_list;
+  Face_handle ff, fn;
+  int i, ii, in;
+	
+  hole_list.push_front(first_hole);
+  
+  while (! hole_list.empty())
+    {
+      hole = hole_list.front();
+      hole_list.pop_front();
+      typename Hole::iterator hit = hole.begin();
+	    
+      // if the hole has only three edges, create the triangle
+      if (hole.size() == 3)
+	{
+	  Face_handle  newf = create_face();
+	  hit = hole.begin();
+	  for(int j=0; j<3; j++)
+	    {
+	      ff = (*hit).first;
+	      ii = (*hit).second;
+	      hit++;
+	      ff->set_neighbor(ii,newf);
+	      newf->set_neighbor(j,ff);
+	      newf->set_vertex(newf->ccw(j),ff->vertex(ff->cw(ii)));
+	    }
+	  continue;
+	}
+  
+      // else find an edge with two finite vertices
+      // on the hole boundary
+      // and the new triangle adjacent to that edge
+      //  cut the hole and push it back
+ 
+      // first, ensure that a neighboring face
+      // whose vertices on the hole boundary are finite
+      // is the first of the hole
+      bool finite = false;
+      while (!finite)
+	{
+	  ff = hole.front().first;
+	  ii = hole.front().second;
+	  if ( is_infinite(ff->vertex(cw(ii))) ||
+	       is_infinite(ff->vertex(ccw(ii))))
+	    {
+	      hole.push_back(hole.front());
+	      hole.pop_front();
+	    }
+	  else
+	    finite = true;
+	}
+ 
+      // take the first neighboring face and pop it;
+      ff = hole.front().first;
+      ii = hole.front().second;
+      hole.pop_front();
+ 
+      Vertex_handle  v0 = ff->vertex(ff->cw(ii)); 
+      const Weighted_point& p0 = v0->point();
+      Vertex_handle  v1 = ff->vertex(ff->ccw(ii)); 
+      const Weighted_point& p1 = v1->point();
+      Vertex_handle  v2 = infinite_vertex(); 
+      Weighted_point p2;
+      Vertex_handle  vv;
+      Weighted_point p;
+ 
+      typename Hole::iterator hdone = hole.end();
+      hit = hole.begin();
+      typename Hole::iterator cut_after(hit);
+ 
+      // if tested vertex is c with respect to the vertex opposite
+      // to NULL neighbor,
+      // stop at the before last face;
+      hdone--;
+      while (hit != hdone) 
+	{
+	  fn = (*hit).first;
+	  in = (*hit).second;
+	  vv = fn->vertex(ccw(in));
+	  if (is_infinite(vv))
+	    {
+	      if (is_infinite(v2))
+		cut_after = hit;
+	    }
+	  else 
+	    {	// vv is a finite vertex
+	      p = vv->point();
+	      if (orientation(p0,p1,p) == 
+		  COUNTERCLOCKWISE)
+		{
+		  if (is_infinite(v2))
+		    {
+		      v2=vv;
+		      p2=p;
+		      cut_after=hit;
+		    }
+		  else if (power_test(p0,p1,p2,p,true) == 
+			   ON_POSITIVE_SIDE)
+		    {
+		      v2=vv;
+		      p2=p;
+		      cut_after=hit;
+		    }
+		}
+	    }
+	  ++hit;
+	}
+ 
+      // create new triangle and update adjacency relations
+      Face_handle newf = create_face(v0,v1,v2);
+      newf->set_neighbor(2,ff);
+      ff->set_neighbor(ii, newf);
+ 
+      //update the hole and push back in the Hole_List stack
+      // if v2 belongs to the neighbor following or preceding *f
+      // the hole remain a single hole
+      // otherwise it is split in two holes
+ 
+      fn = hole.front().first;
+      in = hole.front().second;
+      if (fn->has_vertex(v2, i) && i == (int)fn->ccw(in)) 
+	{
+	  newf->set_neighbor(0,fn);
+	  fn->set_neighbor(in,newf);
+	  hole.pop_front();
+	  hole.push_front(Edge(newf,1));
+	  hole_list.push_front(hole);
+	}
+      else
+	{
+	  fn = hole.back().first;
+	  in = hole.back().second;
+	  if (fn->has_vertex(v2, i) && i == (int)fn->cw(in)) 
+	    {
+	      newf->set_neighbor(1,fn);
+	      fn->set_neighbor(in,newf);
+	      hole.pop_back();
+	      hole.push_back(Edge(newf,0));
+	      hole_list.push_front(hole);
+	    }
+	  else
+	    { // split the hole in two holes
+	      Hole new_hole;
+	      ++cut_after;
+	      while (hole.begin() != cut_after)
+		{
+		  new_hole.push_back(hole.front());
+		  hole.pop_front();
+		}
+ 
+	      hole.push_front(Edge(newf,1));
+	      new_hole.push_front(Edge(newf,0));
+	      hole_list.push_front(hole);
+	      hole_list.push_front(new_hole);
+	    }
+	}
+    }
+}
+
+
+template < class Gt, class Tds >
+void
+Regular_triangulation_2<Gt,Tds>::
+set_face(Vertex_list& vl, const Face_handle& fh)
+{
+  for(typename Vertex_list::iterator it = vl.begin(); it != vl.end(); it++)
+    (*it)->set_face(fh);
+}
+
+// add the vertex_list of f2 and f3 to the point list of f1
+// for the 3-1 flip
+template < class Gt, class Tds >
+void
+Regular_triangulation_2<Gt,Tds>::
+update_hidden_points_3_1(const Face_handle& f1, const Face_handle& f2, 
+			 const Face_handle& f3)
+{
+  set_face(f2->vertex_list(), f1);
+  set_face(f3->vertex_list(), f1);
+  (f1->vertex_list()).splice(f1->vertex_list().begin(),f2->vertex_list());
+  (f1->vertex_list()).splice(f1->vertex_list().begin(),f3->vertex_list());
+  return;				  
+}
+
+
+// the points of the lists of 2 faces are sorted
+// because of a 2-2 flip
+template < class Gt, class Tds >
+void
+Regular_triangulation_2<Gt,Tds>::
+update_hidden_points_2_2(const Face_handle& f1, const Face_handle& f2)
+{	
+  CGAL_triangulation_assertion(f1->has_neighbor(f2));
+    
+  Vertex_list p_list;
+  p_list.splice(p_list.begin(),f1->vertex_list());
+  p_list.splice(p_list.begin(),f2->vertex_list());
+
+  // if one of the face is infinite, 
+  // the other face hide all the points
+  if ( is_infinite(f1)) {
+    set_face(p_list, f2);
+    (f2->vertex_list()).splice(f2->vertex_list().begin(),p_list);
+    return;
+  }
+  if ( is_infinite(f2)) {
+    set_face(p_list, f1);
+    (f1->vertex_list()).splice(f1->vertex_list().begin(),p_list);
+    return;
+  }
+
+  if (dimension() == 1) {
+    const Weighted_point& a1 = f1->vertex(f1->index(f2))->point();
+    const Weighted_point& a  = f1->vertex(1-f1->index(f2))->point();
+    while ( ! p_list.empty() ) {
+      if ( compare_x(a, p_list.front()->point()) == 
+	   compare_x(a, a1)  &&
+	   compare_y(a, p_list.front()->point()) == 
+	   compare_y(a, a1))
+	{
+	  hide_vertex(f1, p_list.front());
+	} else {
+	hide_vertex(f2, p_list.front());
+	}
+      p_list.pop_front();
+    }
+    return;
+  }
+
+  // from here f1 and f2 are finite 2-dimensional faces
+  int idx2 = f1->index(f2);
+  Vertex_handle v0=f1->vertex(ccw(idx2));
+  Vertex_handle v1=f1->vertex(cw(idx2));
+  CGAL_triangulation_assertion( !is_infinite(v0) && !is_infinite(v1)); 
+
+  while ( ! p_list.empty() )
+    {
+      if (orientation(v0->point(), v1->point(), p_list.front()->point()) ==
+	  COUNTERCLOCKWISE)
+	hide_vertex(f1, p_list.front());
+	else
+	hide_vertex(f2, p_list.front());
+      p_list.pop_front();
+    }
+}
+	  
+// The point list of f1 is separated into 3 lists
+// for a 1-3 flip
+template < class Gt, class Tds >
+void
+Regular_triangulation_2<Gt,Tds>::
+update_hidden_points_1_3(const Face_handle& f1, const Face_handle& f2, 
+			 const Face_handle& f3)
+{
+    CGAL_triangulation_assertion(f1->has_neighbor(f2) &&
+			      f2->has_neighbor(f3) &&
+			      f3->has_neighbor(f1));
+
+
+    Vertex_list p_list;
+    p_list.splice(p_list.begin(),f1->vertex_list());
+    if (p_list.empty())
+	return;
+
+    // the following does not work if 
+    // two of f1,f2 and f3 are twice neighbors
+    // but this cannot appear taking the assertion into account;
+    int idx2 = f1->index(f2),
+        idx3 = f1->index(f3);
+    Vertex_handle v2 = f1->vertex(idx2),
+                  v3 = f1->vertex(idx3),
+                  v0 = f1->vertex(3-(idx2+idx3)),
+                  v1 = f2->vertex(f2->index(f1));
+
+    CGAL_triangulation_assertion(f2->has_vertex(v0) && f1->has_vertex(v0));
+    CGAL_triangulation_assertion(f3->has_vertex(v1));
+    CGAL_triangulation_assertion( ! is_infinite(v0));
+
+    // if two of f1, f2,and f3 are infinite
+    // the list goes entirely to the third finite face
+    // no orientation test necessary
+    // because the point list of an infinite face
+    // is only made of point projecting on its finite edge
+    if ( is_infinite(f1 ) && is_infinite(f2)) {
+      set_face(p_list, f3);
+      f3->vertex_list().splice(f3->vertex_list().begin(), p_list);
+      return;
+    }
+    if ( is_infinite(f1) && is_infinite(f3)) {
+      set_face(p_list, f2);
+      f2->vertex_list().splice(f2->vertex_list().begin(), p_list);
+      return;
+    }
+    if ( is_infinite(f2) && is_infinite(f3)){
+      set_face(p_list, f1);
+      f1->vertex_list().splice(f1->vertex_list().begin(), p_list);
+      return;
+    }
+    
+    // if here, v1,v2,v3 and v0 are finite vertices
+    while(! p_list.empty())
+    {
+      Vertex_handle v(p_list.front());
+//       if(orientation(v2->point(),v0->point(), v->point()) !=
+// 	 orientation(v2->point(),v0->point(),v3->point()) )
+//       { // not in f1
+// 	if (orientation(v1->point(), v0->point(), v->point() ) !=
+// 	    orientation(v1->point(), v0->point(), v3->point() ) )
+// 	  // not in f2
+// 	    hide_vertex(f3, v);
+// 	   else
+// 	    hide_vertex(f2, v);
+//       }
+//       else
+// 	  hide_vertex(f1, v);
+      if(orientation(v2->point(),v0->point(), v->point()) ==
+ 	 orientation(v2->point(),v0->point(),v3->point())  &&
+	 orientation(v3->point(),v0->point(), v->point()) ==
+	 orientation(v3->point(),v0->point(), v2->point()))
+	hide_vertex(f1, v);
+      else if (orientation(v1->point(), v0->point(), v->point()) ==
+	       orientation(v1->point(), v0->point(), v3->point()) )
+	hide_vertex(f2,v);
+      else hide_vertex(f3,v);
+      p_list.pop_front();
+    }
+}
+
+// the vertex is a degree three vertex which has to removed
+// and hidden
+// create first  a new hidden vertex and exchange with the vertex
+// to be removed by the tds : 
+// this is required to keep up and down pointers right when using a hierarchy
+template < class Gt, class Tds >
+void 
+Regular_triangulation_2<Gt,Tds>::
+hide_remove_degree_3(Face_handle fh, Vertex_handle vh)
+{
+ Vertex_handle vnew= this->_tds.create_vertex();
+ exchange_incidences(vnew,vh);
+ remove_degree_3(vnew, fh);
+ hide_vertex(fh,vh);
+}
+
+// create a vertex and hide it
+template < class Gt, class Tds >
+typename Regular_triangulation_2<Gt,Tds>::Vertex_handle
+Regular_triangulation_2<Gt,Tds>::
+hide_new_vertex(Face_handle f, const Weighted_point& p)
+{
+  Vertex_handle v = this->_tds.create_vertex(); 
+  v->set_point(p);
+  hide_vertex(f, v);
+  return v;
+}
+
+// insert the vertex to the hidden vertex list
+template < class Gt, class Tds >
+void
+Regular_triangulation_2<Gt,Tds>::
+hide_vertex(Face_handle f, Vertex_handle vh)
+{
+  // no hidden vertex in infinite face
+  if(is_infinite(f) && dimension() > 0) f = f->neighbor(f->index(infinite_vertex()));
+ 
+  if(! vh->is_hidden()) {
+    vh->set_hidden(true);
+    _hidden_vertices++;
+  }
+  vh->set_face(f);
+  f->vertex_list().push_back(vh);
+}
+
+// template < class Gt, class Tds >
+// void
+// Regular_triangulation_2<Gt,Tds>::
+// hide_vertex(Face_handle f, void* ptr)
+// {
+//   Vertex_handle v(static_cast<Vertex*>(ptr));
+//   hide_vertex(f, v);
+// }
+
+
+
+template < class Gt, class Tds >
+void
+Regular_triangulation_2<Gt,Tds>::
+stack_flip(Vertex_handle v, Faces_around_stack &faces_around)
+{
+  Face_handle f=faces_around.front();
+  faces_around.pop_front();
+  int i = f->index(v);
+  Face_handle n = f->neighbor(i);
+    
+  if (dimension() == 1 ) {
+    if ( is_infinite(f)  || is_infinite(n) ) return;
+    if ( power_test( v->point(),
+		     n->vertex(n->index(f))->point(),
+		     f->vertex(1-i)->point()) ==  ON_NEGATIVE_SIDE)
+      stack_flip_dim1(f,i,faces_around);
+    return;
+  }  
+
+  // now dimension() == 2
+  //test the regularity of edge (f,i)
+  //if( power_test(n, v->point()) == ON_NEGATIVE_SIDE)
+  if( power_test(n, v->point(), true) != ON_POSITIVE_SIDE)
+    return;
+    
+  if(is_infinite(f,i))
+    {
+      int j = 3 - ( i + f->index(infinite_vertex()));
+      if ( degree(f->vertex(j)) == 4)
+	stack_flip_4_2(f,i,j,faces_around);
+      return;
+    }
+
+    // now f and n are both finite faces
+    int ni = n->index(f);
+    Orientation occw = orientation(f->vertex(i)->point(),
+				   f->vertex(ccw(i))->point(),
+				   n->vertex(ni)->point());
+    Orientation ocw  = orientation(f->vertex(i)->point(),
+				   f->vertex(cw(i))->point(),
+				   n->vertex(ni)->point());
+    if (occw == LEFT_TURN && ocw == RIGHT_TURN) {
+      // quadrilater (f,n) is convex
+      stack_flip_2_2(f,i, faces_around);
+      return;
+    }
+    if (occw == RIGHT_TURN && degree(f->vertex(ccw(i))) == 3) {
+      stack_flip_3_1(f,i,ccw(i),faces_around);
+      return;
+    }
+    if (ocw == LEFT_TURN && degree(f->vertex(cw(i))) == 3) {
+      stack_flip_3_1(f,i,cw(i),faces_around);
+      return;
+    }
+    if (occw == COLLINEAR && degree(f->vertex(ccw(i))) == 4) {
+      stack_flip_4_2(f,i,ccw(i),faces_around);
+      return;
+    }
+    if (ocw == COLLINEAR && degree(f->vertex(cw(i))) == 4)
+      stack_flip_4_2(f,i,cw(i),faces_around);
+    
+    return;
+}
+
+
+template < class Gt, class Tds >
+void
+Regular_triangulation_2<Gt,Tds>::
+stack_flip_4_2(Face_handle f, int i, int j, Faces_around_stack & faces_around)
+{
+    int k = 3-(i+j);
+    Face_handle g=f->neighbor(k);
+    if (!faces_around.empty())
+    {
+      if (faces_around.front() == g)
+	  faces_around.pop_front();
+      else if (faces_around.back() == g) 
+	  faces_around.pop_back();
+    }
+    
+    //union f with  g and f->neihgbor(i) with g->f->neihgbor(i)
+    Face_handle fn = f->neighbor(i);
+    //Face_handle gn = g->neighbor(g->index(f->vertex(i)));
+    Vertex_handle vq = f->vertex(j);
+    
+    this->_tds.flip( f, i); //not using flip because the vertex j is flat.
+    update_hidden_points_2_2(f,fn);
+    Face_handle h1 = ( j == ccw(i) ? fn : f);
+    //hide_vertex(h1, vq);
+    hide_remove_degree_3(g,vq);
+    if(j == ccw(i)) {
+      faces_around.push_front(h1); 
+      faces_around.push_front(g);
+    }
+    else {
+      faces_around.push_front(g);
+      faces_around.push_front(h1); 
+    }
+}
+
+
+template < class Gt, class Tds >
+void
+Regular_triangulation_2<Gt,Tds>::
+stack_flip_3_1(Face_handle f, int i, int j, Faces_around_stack & faces_around)
+{
+  int k = 3-(i+j);
+  Face_handle g=f->neighbor(k);
+  if (!faces_around.empty())
+  {
+    if (faces_around.front()== g)
+	faces_around.pop_front();
+    else if ( faces_around.back() == g)
+	faces_around.pop_back();
+  }
+
+  Vertex_handle vq= f->vertex(j);
+  //hide_vertex(f,vq);
+  hide_remove_degree_3(f,vq);
+  faces_around.push_front(f);
+}
+
+
+template < class Gt, class Tds >
+void
+Regular_triangulation_2<Gt,Tds>::
+stack_flip_2_2(Face_handle f, int i, Faces_around_stack & faces_around)
+{
+    Vertex_handle vq = f->vertex(ccw(i));
+    flip(f,i);
+    if(f->has_vertex(vq)) {
+      faces_around.push_front(f->neighbor(ccw(i)));
+      faces_around.push_front(f);
+    }
+    else { 
+      faces_around.push_front(f);
+      faces_around.push_front(f->neighbor(cw(i)));
+    }
+}
+  
+template < class Gt, class Tds >
+void
+Regular_triangulation_2<Gt,Tds>::
+stack_flip_dim1(Face_handle f, int i, Faces_around_stack &faces_around)
+{
+  Vertex_handle va = f->vertex(1-i);
+  Face_handle n= f->neighbor(i);
+  int in = n->index(f);
+  Vertex_handle vb = n->vertex(in);
+  f->set_vertex(1-i, n->vertex(in));
+  vb->set_face(f);
+  f->set_neighbor(i, n->neighbor(1-in));
+  n->neighbor(1-in)->set_neighbor(n->neighbor(1-in)->index(n), f);
+  (f->vertex_list()).splice(f->vertex_list().begin(),n->vertex_list());
+  set_face(f->vertex_list(),f);
+  this->delete_face(n);
+  hide_vertex(f,va);
+  faces_around.push_front(f);
+  return;
+}
+
+
+template < class Gt, class Tds >
+typename Regular_triangulation_2<Gt,Tds>::All_vertices_iterator 
+Regular_triangulation_2<Gt,Tds>::
+all_vertices_begin () const
+{
+  return CGAL::filter_iterator(Base::all_vertices_end(), 
+			 Hidden_tester(),
+			 Base::all_vertices_begin());
+}
+
+template < class Gt, class Tds >
+typename Regular_triangulation_2<Gt,Tds>::All_vertices_iterator 
+Regular_triangulation_2<Gt,Tds>::
+all_vertices_end () const
+{
+  return CGAL::filter_iterator(Base::all_vertices_end(), 
+			 Hidden_tester() ); 
+}
+
+template < class Gt, class Tds >
+typename Regular_triangulation_2<Gt,Tds>::Finite_vertices_iterator 
+Regular_triangulation_2<Gt,Tds>::
+finite_vertices_begin () const
+{
+  return CGAL::filter_iterator(Base::finite_vertices_end(), 
+			 Hidden_tester(),
+			 Base::finite_vertices_begin());
+}
+
+template < class Gt, class Tds >
+typename Regular_triangulation_2<Gt,Tds>::Vertex_handle 
+Regular_triangulation_2<Gt,Tds>::
+finite_vertex () const
+{
+  CGAL_triangulation_precondition (number_of_vertices() >= 1);
+  return (finite_vertices_begin());
+}
+
+
+
+template < class Gt, class Tds >
+typename Regular_triangulation_2<Gt,Tds>::Finite_vertices_iterator 
+Regular_triangulation_2<Gt,Tds>::
+finite_vertices_end () const
+{
+
+  return CGAL::filter_iterator(Base::finite_vertices_end(), 
+			 Hidden_tester() );
+
+}
+
+template < class Gt, class Tds >
+typename Regular_triangulation_2<Gt,Tds>::Hidden_vertices_iterator 
+Regular_triangulation_2<Gt,Tds>::
+hidden_vertices_begin () const
+{
+  return CGAL::filter_iterator(Base::finite_vertices_end(), 
+			 Unhidden_tester(), 
+			 Base::finite_vertices_begin() );
+
+}
+
+template < class Gt, class Tds >
+typename Regular_triangulation_2<Gt,Tds>::Hidden_vertices_iterator 
+Regular_triangulation_2<Gt,Tds>::
+hidden_vertices_end () const
+{
+  return CGAL::filter_iterator(Base::finite_vertices_end(), 
+			 Unhidden_tester() );
+}
+
+template < class Gt, class Tds >
+typename Regular_triangulation_2<Gt,Tds>::Vertex_handle
+Regular_triangulation_2<Gt,Tds>::
+nearest_power_vertex(const Bare_point& p) const
+{
+  if ( dimension() == -1 ) { return Vertex_handle(); }
+
+  if ( dimension() == 0 ) { return this->finite_vertex(); }
+
+  typename Geom_traits::Compare_power_distance_2 cmp_power_distance =
+    geom_traits().compare_power_distance_2_object();
+
+  Vertex_handle vclosest;
+  Vertex_handle v = this->finite_vertex();
+
+  //  if ( dimension() == 1 ) {
+  //  }
+
+  do {
+    vclosest = v;
+    Weighted_point wp = v->point();
+    Vertex_circulator vc_start = incident_vertices(v);
+    Vertex_circulator vc = vc_start;
+    do {
+      if ( !is_infinite(vc) ) {
+	if ( cmp_power_distance(p, vc->point(), wp) == SMALLER ) {
+	  v = vc;
+	  break;
+	}
+      }
+      ++vc;
+    } while ( vc != vc_start );
+  } while ( vclosest != v );
+
+  return vclosest;  
+}
+
+
+} //namespace CGAL 
+
+#endif // CGAL_REGULAR_TRIANGULATION_2_H
diff --git a/3rdparty/CGAL/include/CGAL/Regular_triangulation_3.h b/3rdparty/CGAL/include/CGAL/Regular_triangulation_3.h
new file mode 100644
index 0000000..5e274bf
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Regular_triangulation_3.h
@@ -0,0 +1,2329 @@
+// Copyright (c) 1999-2004  INRIA Sophia-Antipolis (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
+// 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(s)     : Monique Teillaud <Monique.Teillaud at sophia.inria.fr>
+//                 Sylvain Pion
+//                 Christophe Delage <Christophe.Delage at sophia.inria.fr>
+//                 Clement Jamin
+
+#ifndef CGAL_REGULAR_TRIANGULATION_3_H
+#define CGAL_REGULAR_TRIANGULATION_3_H
+
+#include <CGAL/basic.h>
+
+#include <set>
+
+#ifdef CGAL_LINKED_WITH_TBB
+# include <CGAL/point_generators_3.h>
+# include <tbb/parallel_for.h>
+# include <tbb/enumerable_thread_specific.h>
+# include <tbb/concurrent_vector.h>
+#endif
+
+#include <CGAL/Triangulation_3.h>
+#include <CGAL/Regular_triangulation_cell_base_3.h>
+#include <boost/bind.hpp>
+
+#ifndef CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
+#include <CGAL/Spatial_sort_traits_adapter_3.h>
+#include <CGAL/internal/info_check.h>
+
+#include <boost/iterator/zip_iterator.hpp>
+#include <boost/mpl/and.hpp>
+#endif //CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
+#ifdef CGAL_TRIANGULATION_3_PROFILING
+# include <CGAL/Mesh_3/Profiling_tools.h>
+#endif
+
+#ifdef CGAL_CONCURRENT_TRIANGULATION_3_ADD_TEMPORARY_POINTS_ON_FAR_SPHERE
+#include <CGAL/point_generators_3.h>
+#endif
+
+#if defined(BOOST_MSVC)
+#  pragma warning(push)
+#  pragma warning(disable:4355) // complaint about using 'this' to
+#endif                          // initialize a member
+
+namespace CGAL {
+
+  /************************************************
+   *
+   * Regular_triangulation_3 class
+   *
+   ************************************************/
+
+  template < class Gt, class Tds_ = Default, class Lock_data_structure_ = Default >
+  class Regular_triangulation_3
+  : public Triangulation_3<
+      Gt,
+      typename Default::Get<Tds_, Triangulation_data_structure_3 <
+        Triangulation_vertex_base_3<Gt>,
+        Regular_triangulation_cell_base_3<Gt> > >::type,
+      Lock_data_structure_>
+  {
+    typedef Regular_triangulation_3<Gt, Tds_, Lock_data_structure_> Self;
+
+    typedef typename Default::Get<Tds_, Triangulation_data_structure_3 <
+      Triangulation_vertex_base_3<Gt>,
+      Regular_triangulation_cell_base_3<Gt> > >::type Tds;
+
+    typedef Triangulation_3<Gt,Tds,Lock_data_structure_> Tr_Base;
+
+  public:
+
+    typedef Tds                                   Triangulation_data_structure;
+    typedef Gt                                    Geom_traits;
+
+    typedef typename Tr_Base::Concurrency_tag     Concurrency_tag;
+    typedef typename Tr_Base::Lock_data_structure Lock_data_structure;
+
+    typedef typename Tr_Base::Vertex_handle       Vertex_handle;
+    typedef typename Tr_Base::Cell_handle         Cell_handle;
+    typedef typename Tr_Base::Vertex              Vertex;
+    typedef typename Tr_Base::Cell                Cell;
+    typedef typename Tr_Base::Facet               Facet;
+    typedef typename Tr_Base::Edge                Edge;
+
+    typedef typename Tr_Base::size_type           size_type;
+    typedef typename Tr_Base::Locate_type         Locate_type;
+    typedef typename Tr_Base::Cell_iterator       Cell_iterator;
+    typedef typename Tr_Base::Facet_iterator      Facet_iterator;
+    typedef typename Tr_Base::Edge_iterator       Edge_iterator;
+    typedef typename Tr_Base::Facet_circulator    Facet_circulator;
+
+    typedef typename Tr_Base::Finite_vertices_iterator Finite_vertices_iterator;
+    typedef typename Tr_Base::Finite_cells_iterator    Finite_cells_iterator;
+    typedef typename Tr_Base::Finite_facets_iterator   Finite_facets_iterator;
+    typedef typename Tr_Base::Finite_edges_iterator    Finite_edges_iterator;
+    typedef typename Tr_Base::All_cells_iterator       All_cells_iterator;
+
+    typedef typename Gt::Weighted_point_3            Weighted_point;
+    typedef typename Gt::Bare_point                  Bare_point;
+    typedef typename Gt::Segment_3                   Segment;
+    typedef typename Gt::Triangle_3                  Triangle;
+    typedef typename Gt::Tetrahedron_3               Tetrahedron;
+
+    // types for dual:
+    typedef typename Gt::Line_3        Line;
+    typedef typename Gt::Ray_3         Ray;
+    typedef typename Gt::Plane_3       Plane;
+    typedef typename Gt::Object_3      Object;
+
+    //Tag to distinguish Delaunay from Regular triangulations
+    typedef Tag_true   Weighted_tag;
+
+    using Tr_Base::cw;
+    using Tr_Base::ccw;
+#ifndef CGAL_CFG_USING_BASE_MEMBER_BUG_2
+    using Tr_Base::geom_traits;
+#endif
+    using Tr_Base::number_of_vertices;
+    using Tr_Base::dimension;
+    using Tr_Base::finite_facets_begin;
+    using Tr_Base::finite_facets_end;
+    using Tr_Base::finite_vertices_begin;
+    using Tr_Base::finite_vertices_end;
+    using Tr_Base::finite_cells_begin;
+    using Tr_Base::finite_cells_end;
+    using Tr_Base::finite_edges_begin;
+    using Tr_Base::finite_edges_end;
+    using Tr_Base::tds;
+    using Tr_Base::infinite_vertex;
+    using Tr_Base::next_around_edge;
+    using Tr_Base::vertex_triple_index;
+    using Tr_Base::mirror_vertex;
+    using Tr_Base::mirror_index;
+    using Tr_Base::orientation;
+    using Tr_Base::coplanar_orientation;
+    using Tr_Base::adjacent_vertices;
+    using Tr_Base::construct_segment;
+    using Tr_Base::incident_facets;
+    using Tr_Base::insert_in_conflict;
+    using Tr_Base::is_infinite;
+    using Tr_Base::is_valid_finite;
+    using Tr_Base::locate;
+    using Tr_Base::side_of_segment;
+    using Tr_Base::side_of_edge;
+    using Tr_Base::find_conflicts;
+    using Tr_Base::is_valid;
+
+    Regular_triangulation_3(const Gt & gt = Gt(), Lock_data_structure *lock_ds = NULL)
+      : Tr_Base(gt, lock_ds), hidden_point_visitor(this)
+    {}
+
+    Regular_triangulation_3(Lock_data_structure *lock_ds, const Gt & gt = Gt())
+      : Tr_Base(lock_ds, gt), hidden_point_visitor(this)
+    {}
+
+    Regular_triangulation_3(const Regular_triangulation_3 & rt)
+      : Tr_Base(rt), hidden_point_visitor(this)
+    {
+      CGAL_triangulation_postcondition( is_valid() );
+    }
+
+    //insertion
+    template < typename InputIterator >
+    Regular_triangulation_3(InputIterator first, InputIterator last,
+      const Gt & gt = Gt(), Lock_data_structure *lock_ds = NULL)
+      : Tr_Base(gt, lock_ds), hidden_point_visitor(this)
+    {
+      insert(first, last);
+    }
+
+    template < typename InputIterator >
+    Regular_triangulation_3(InputIterator first, InputIterator last,
+      Lock_data_structure *lock_ds, const Gt & gt = Gt())
+      : Tr_Base(gt, lock_ds), hidden_point_visitor(this)
+    {
+      insert(first, last);
+    }
+
+  private:
+
+#ifdef CGAL_CONCURRENT_TRIANGULATION_3_ADD_TEMPORARY_POINTS_ON_FAR_SPHERE
+    std::vector<Vertex_handle> 
+    add_temporary_points_on_far_sphere(const size_t num_points)
+    {
+      std::vector<Vertex_handle> far_sphere_vertices;
+
+      const size_t MIN_NUM_POINTS_FOR_FAR_SPHERE_POINTS = 1000000;
+      if (num_points >= MIN_NUM_POINTS_FOR_FAR_SPHERE_POINTS)
+      {
+        // Add temporary vertices on a "far sphere" to reduce contention on
+        // the infinite vertex
+
+        // Get bbox
+        const Bbox_3 &bbox = *this->get_bbox();
+        // Compute radius for far sphere
+        const double& xdelta = bbox.xmax() - bbox.xmin();
+        const double& ydelta = bbox.ymax() - bbox.ymin();
+        const double& zdelta = bbox.zmax() - bbox.zmin();
+        const double radius = 1.3 * 0.5 * std::sqrt(xdelta*xdelta +
+          ydelta*ydelta +
+          zdelta*zdelta);
+
+        // WARNING - TODO: this code has to be fixed because Vector_3 is not 
+        // required by the traits concept
+        const typename Gt::Vector_3 center(
+          bbox.xmin() + 0.5*xdelta,
+          bbox.ymin() + 0.5*ydelta,
+          bbox.zmin() + 0.5*zdelta);
+        Random_points_on_sphere_3<Point> random_point(radius);
+        const int NUM_PSEUDO_INFINITE_VERTICES = static_cast<int>(
+          tbb::task_scheduler_init::default_num_threads() * 3.5);
+        std::vector<Point> points_on_far_sphere;
+        for (int i = 0 ; i < NUM_PSEUDO_INFINITE_VERTICES ; ++i, ++random_point)
+          points_on_far_sphere.push_back(*random_point + center);
+
+        spatial_sort(points_on_far_sphere.begin(),
+          points_on_far_sphere.end(),
+          geom_traits());
+
+        std::vector<Point>::const_iterator it_p = points_on_far_sphere.begin();
+        std::vector<Point>::const_iterator it_p_end = points_on_far_sphere.end();
+        for (; it_p != it_p_end ; ++it_p)
+        {
+          Locate_type lt;
+          Cell_handle c;
+          int li, lj;
+
+          c = locate(*it_p, lt, li, lj, hint);
+          Vertex_handle v = insert(*it_p, lt, c, li, lj);
+          hint = (v == Vertex_handle() ? c : v->cell());
+
+          far_sphere_vertices.push_back(v);
+        }
+      }
+
+      return far_sphere_vertices;
+    }
+
+    void remove_temporary_points_on_far_sphere(
+      const std::vector<Vertex_handle> & far_sphere_vertices)
+    {
+      if (!far_sphere_vertices.empty())
+      {
+        // Remove the temporary vertices on far sphere
+        remove(far_sphere_vertices.begin(), far_sphere_vertices.end());
+      }
+    }
+#endif // CGAL_CONCURRENT_TRIANGULATION_3_ADD_TEMPORARY_POINTS_ON_FAR_SPHERE
+
+  public:
+
+#ifndef CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
+    template < class InputIterator >
+    std::ptrdiff_t
+      insert( InputIterator first, InputIterator last,
+      typename boost::enable_if<
+      boost::is_convertible<
+      typename std::iterator_traits<InputIterator>::value_type,
+      Weighted_point
+      >
+      >::type* = NULL
+      )
+#else
+    template < class InputIterator >
+    std::ptrdiff_t
+      insert( InputIterator first, InputIterator last)
+#endif //CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
+    {
+#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
+      static Profile_branch_counter_3 bcounter(
+        "early withdrawals / late withdrawals / successes [Regular_tri_3::insert]");
+#endif
+
+#ifdef CGAL_TRIANGULATION_3_PROFILING
+      WallClockTimer t;
+#endif
+
+      size_type n = number_of_vertices();
+      std::vector<Weighted_point> points(first, last);
+      spatial_sort (points.begin(), points.end(), geom_traits());
+
+    // Parallel
+#ifdef CGAL_LINKED_WITH_TBB
+      if (this->is_parallel())
+      {
+        size_t num_points = points.size();
+        Cell_handle hint;
+        
+#ifdef CGAL_CONCURRENT_TRIANGULATION_3_ADD_TEMPORARY_POINTS_ON_FAR_SPHERE
+        std::vector<Vertex_handle> far_sphere_vertices = 
+          add_temporary_points_on_far_sphere(num_points);
+#endif
+      
+        size_t i = 0;
+        // Insert "num_points_seq" points sequentially
+        // (or more if dim < 3 after that)
+        size_t num_points_seq = (std::min)(num_points, (size_t)100);
+        while (dimension() < 3 || i < num_points_seq)
+        {
+          Locate_type lt;
+          Cell_handle c;
+          int li, lj;
+
+          c = locate (points[i], lt, li, lj, hint);
+          Vertex_handle v = insert (points[i], lt, c, li, lj);
+
+          hint = (v == Vertex_handle() ? c : v->cell());
+          ++i;
+        }
+
+        tbb::enumerable_thread_specific<Vertex_handle> tls_hint(hint->vertex(0));
+        tbb::parallel_for(
+          tbb::blocked_range<size_t>( i, num_points ),
+          Insert_point<Self>(*this, points, tls_hint)
+        );
+
+#ifdef CGAL_CONCURRENT_TRIANGULATION_3_ADD_TEMPORARY_POINTS_ON_FAR_SPHERE
+        remove_temporary_points_on_far_sphere(far_sphere_vertices);
+#endif
+      }
+      // Sequential
+      else
+#endif // CGAL_LINKED_WITH_TBB
+      {
+        Cell_handle hint;
+        for (typename std::vector<Weighted_point>::const_iterator p = points.begin(),
+          end = points.end(); p != end; ++p)
+        {
+          Locate_type lt;
+          Cell_handle c;
+          int li, lj;
+          c = locate (*p, lt, li, lj, hint);
+
+          Vertex_handle v = insert (*p, lt, c, li, lj);
+
+          hint = v == Vertex_handle() ? c : v->cell();
+        }
+      }
+#ifdef CGAL_TRIANGULATION_3_PROFILING
+      std::cerr << "Points inserted in " << t.elapsed() << " seconds." << std::endl;
+#endif
+      return number_of_vertices() - n;
+    }
+
+
+#ifndef CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
+  private:
+    //top stands for tuple-or-pair
+    template <class Info>
+    const Weighted_point& top_get_first(const std::pair<Weighted_point,Info>& pair) const { return pair.first; }
+    template <class Info>
+    const Info& top_get_second(const std::pair<Weighted_point,Info>& pair) const { return pair.second; }
+    template <class Info>
+    const Weighted_point& top_get_first(const boost::tuple<Weighted_point,Info>& tuple) const { return boost::get<0>(tuple); }
+    template <class Info>
+    const Info& top_get_second(const boost::tuple<Weighted_point,Info>& tuple) const { return boost::get<1>(tuple); }
+
+    template <class Tuple_or_pair,class InputIterator>
+    std::ptrdiff_t insert_with_info(InputIterator first,InputIterator last)
+    {
+      size_type n = number_of_vertices();
+      std::vector<std::size_t> indices;
+      std::vector<Weighted_point> points;
+      std::vector<typename Triangulation_data_structure::Vertex::Info> infos;
+      std::size_t index=0;
+      for (InputIterator it=first;it!=last;++it){
+        Tuple_or_pair pair = *it;
+        points.push_back( top_get_first(pair) );
+        infos.push_back ( top_get_second(pair) );
+        indices.push_back(index++);
+      }
+
+      typedef typename Pointer_property_map<Weighted_point>::type Pmap;
+      typedef Spatial_sort_traits_adapter_3<Geom_traits,Pmap> Search_traits;
+
+      spatial_sort( indices.begin(),
+                    indices.end(),
+                    Search_traits(make_property_map(points),geom_traits()) );
+#ifdef CGAL_LINKED_WITH_TBB
+      if (this->is_parallel())
+      {
+        size_t num_points = points.size();
+        Cell_handle hint;
+
+#ifdef CGAL_CONCURRENT_TRIANGULATION_3_ADD_TEMPORARY_POINTS_ON_FAR_SPHERE
+        std::vector<Vertex_handle> far_sphere_vertices =
+          add_temporary_points_on_far_sphere(num_points);
+#endif
+
+        size_t i = 0;
+        // Insert "num_points_seq" points sequentially
+        // (or more if dim < 3 after that)
+        size_t num_points_seq = (std::min)(num_points, (size_t)100);
+        while (dimension() < 3 || i < num_points_seq)
+        {
+          Locate_type lt;
+          Cell_handle c;
+          int li, lj;
+          c = locate(points[indices[i]], lt, li, lj, hint);
+
+          Vertex_handle v = insert(points[indices[i]], lt, c, li, lj);
+          if (v != Vertex_handle()){
+            v->info() = infos[indices[i]];
+            hint = v->cell();
+          }
+          else
+            hint = c;
+
+          ++i;
+        }
+
+        tbb::enumerable_thread_specific<Vertex_handle> tls_hint(hint->vertex(0));
+        tbb::parallel_for(
+          tbb::blocked_range<size_t>(i, num_points),
+          Insert_point_with_info<Self>(*this, points, infos, indices, tls_hint)
+          );
+
+#ifdef CGAL_CONCURRENT_TRIANGULATION_3_ADD_TEMPORARY_POINTS_ON_FAR_SPHERE
+        remove_temporary_points_on_far_sphere(far_sphere_vertices);
+#endif
+      }
+      // Sequential
+      else
+#endif // CGAL_LINKED_WITH_TBB
+      {
+        Cell_handle hint;
+        for (typename std::vector<std::size_t>::const_iterator
+          it = indices.begin(), end = indices.end();
+          it != end; ++it)
+        {
+          Locate_type lt;
+          Cell_handle c;
+          int li, lj;
+          c = locate (points[*it], lt, li, lj, hint);
+
+          Vertex_handle v = insert (points[*it], lt, c, li, lj);
+          if (v!=Vertex_handle()){
+            v->info()=infos[*it];
+            hint=v->cell();
+          }
+          else
+            hint=c;
+        }
+      }
+
+      return number_of_vertices() - n;
+    }
+
+  public:
+
+    template < class InputIterator >
+    std::ptrdiff_t
+      insert( InputIterator first,
+      InputIterator last,
+      typename boost::enable_if<
+      boost::is_convertible<
+      typename std::iterator_traits<InputIterator>::value_type,
+      std::pair<Weighted_point,typename internal::Info_check<typename Triangulation_data_structure::Vertex>::type>
+      >
+      >::type* = NULL
+      )
+    {return insert_with_info< std::pair<Weighted_point,typename internal::Info_check<typename Triangulation_data_structure::Vertex>::type> >(first,last);}
+
+    template <class  InputIterator_1,class InputIterator_2>
+    std::ptrdiff_t
+      insert( boost::zip_iterator< boost::tuple<InputIterator_1,InputIterator_2> > first,
+      boost::zip_iterator< boost::tuple<InputIterator_1,InputIterator_2> > last,
+      typename boost::enable_if<
+      boost::mpl::and_<
+      typename boost::is_convertible< typename std::iterator_traits<InputIterator_1>::value_type, Weighted_point >,
+      typename boost::is_convertible< typename std::iterator_traits<InputIterator_2>::value_type, typename internal::Info_check<typename Triangulation_data_structure::Vertex>::type >
+      >
+      >::type* =NULL
+      )
+    {return insert_with_info< boost::tuple<Weighted_point,typename internal::Info_check<typename Triangulation_data_structure::Vertex>::type> >(first,last);}
+#endif //CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
+
+
+    Vertex_handle insert(const Weighted_point & p, Vertex_handle hint,
+                         bool *could_lock_zone = NULL)
+    {
+      return insert(p,
+                    hint == Vertex_handle() ? this->infinite_cell() : hint->cell(),
+                    could_lock_zone);
+    }
+
+    Vertex_handle insert(const Weighted_point & p,
+      Cell_handle start = Cell_handle(), bool *could_lock_zone = NULL);
+
+    Vertex_handle insert(const Weighted_point & p, Locate_type lt,
+      Cell_handle c, int li, int, bool *could_lock_zone = NULL);
+
+    template <class CellIt>
+    Vertex_handle
+      insert_in_hole(const Weighted_point & p, CellIt cell_begin, CellIt cell_end,
+      Cell_handle begin, int i);
+
+    template <class CellIt>
+    Vertex_handle
+      insert_in_hole(const Weighted_point & p, CellIt cell_begin, CellIt cell_end,
+      Cell_handle begin, int i, Vertex_handle newv);
+
+    template <class OutputIteratorBoundaryFacets,
+    class OutputIteratorCells,
+    class OutputIteratorInternalFacets>
+      Triple<OutputIteratorBoundaryFacets,
+      OutputIteratorCells,
+      OutputIteratorInternalFacets>
+      find_conflicts(const Weighted_point &p, Cell_handle c,
+      OutputIteratorBoundaryFacets bfit,
+      OutputIteratorCells cit,
+      OutputIteratorInternalFacets ifit
+      , bool *could_lock_zone = NULL
+      , const Facet *this_facet_must_be_in_the_cz = NULL
+      , bool *the_facet_is_in_its_cz = NULL
+      ) const
+    {
+      CGAL_triangulation_precondition(dimension() >= 2);
+
+      std::vector<Cell_handle> cells;
+      cells.reserve(32);
+      std::vector<Facet> facets;
+      facets.reserve(64);
+
+      if (dimension() == 2) {
+        Conflict_tester_2 tester(p, this);
+        if (! tester (c)) return make_triple (bfit, cit, ifit);
+        ifit = Tr_Base::find_conflicts
+          (c, tester,
+          make_triple(std::back_inserter(facets),
+          std::back_inserter(cells),
+          ifit)
+          , could_lock_zone
+          , this_facet_must_be_in_the_cz
+          , the_facet_is_in_its_cz
+          ).third;
+      }
+      else {
+        Conflict_tester_3 tester(p, this);
+        if (! tester (c)) return make_triple (bfit, cit, ifit);
+        ifit = Tr_Base::find_conflicts
+          (c, tester,
+          make_triple(std::back_inserter(facets),
+          std::back_inserter(cells),
+          ifit)
+          , could_lock_zone
+          , this_facet_must_be_in_the_cz
+          , the_facet_is_in_its_cz
+          ).third;
+      }
+
+      // Reset the conflict flag on the boundary.
+      for(typename std::vector<Facet>::iterator fit=facets.begin();
+        fit != facets.end(); ++fit) {
+          fit->first->neighbor(fit->second)->tds_data().clear();
+          *bfit++ = *fit;
+      }
+
+      // Reset the conflict flag in the conflict cells.
+      for(typename std::vector<Cell_handle>::iterator ccit=cells.begin();
+        ccit != cells.end(); ++ccit) {
+          (*ccit)->tds_data().clear();
+          *cit++ = *ccit;
+      }
+      return make_triple(bfit, cit, ifit);
+    }
+
+    template <class OutputIteratorBoundaryFacets, class OutputIteratorCells>
+    std::pair<OutputIteratorBoundaryFacets, OutputIteratorCells>
+      find_conflicts(const Weighted_point &p, Cell_handle c,
+      OutputIteratorBoundaryFacets bfit,
+      OutputIteratorCells cit
+      , bool *could_lock_zone = NULL
+      ) const
+    {
+      Triple<OutputIteratorBoundaryFacets,
+        OutputIteratorCells,
+        Emptyset_iterator> t = find_conflicts(p, c, bfit, cit,
+                                              Emptyset_iterator(),
+                                              could_lock_zone);
+      return std::make_pair(t.first, t.second);
+    }
+
+    // Returns the vertices on the interior of the conflict hole.
+    template <class OutputIterator>
+    OutputIterator
+      vertices_inside_conflict_zone(const Weighted_point&p, Cell_handle c,
+      OutputIterator res) const
+    {
+      CGAL_triangulation_precondition(dimension() >= 2);
+
+      // Get the facets on the boundary of the hole, and the cells of the hole
+      std::vector<Cell_handle> cells;
+      std::vector<Facet> facets;
+      find_conflicts(p, c, std::back_inserter(facets),
+        std::back_inserter(cells), Emptyset_iterator());
+
+      // Put all vertices on the hole in 'vertices'
+      const int d = dimension();
+      std::set<Vertex_handle> vertices;
+      for (typename std::vector<Cell_handle>::const_iterator
+        it = cells.begin(),
+        end = cells.end(); it != end; ++it)
+      {
+        for(int i = 0; i <= d; ++i) {
+          vertices.insert((*it)->vertex(i));
+        }
+      }
+      // Then extract the vertices of the boundary and remove them from
+      // 'vertices'
+      if (dimension() == 3) {
+        for (typename std::vector<Facet>::const_iterator i = facets.begin();
+          i != facets.end(); ++i) {
+            vertices.erase(i->first->vertex((i->second+1)&3));
+            vertices.erase(i->first->vertex((i->second+2)&3));
+            vertices.erase(i->first->vertex((i->second+3)&3));
+        }
+      } else {
+        for (typename std::vector<Facet>::const_iterator i = facets.begin();
+          i != facets.end(); ++i) {
+            vertices.erase(i->first->vertex(cw(i->second)));
+            vertices.erase(i->first->vertex(ccw(i->second)));
+        }
+      }
+
+      return std::copy(vertices.begin(), vertices.end(), res);
+    }
+
+#ifndef CGAL_NO_DEPRECATED_CODE
+    // Returns the vertices on the boundary of the conflict hole.
+    template <class OutputIterator>
+    OutputIterator
+      vertices_in_conflict(const Weighted_point&p, Cell_handle c, OutputIterator res) const
+    {
+      return vertices_on_conflict_zone_boundary(p, c, res);
+    }
+#endif // CGAL_NO_DEPRECATED_CODE
+
+    // Returns the vertices on the boundary of the conflict hole.
+    template <class OutputIterator>
+    OutputIterator
+      vertices_on_conflict_zone_boundary(const Weighted_point&p, Cell_handle c,
+      OutputIterator res) const
+    {
+      CGAL_triangulation_precondition(dimension() >= 2);
+
+      // Get the facets on the boundary of the hole.
+      std::vector<Facet> facets;
+      find_conflicts(p, c, std::back_inserter(facets),
+        Emptyset_iterator(), Emptyset_iterator());
+
+      // Then extract uniquely the vertices.
+      std::set<Vertex_handle> vertices;
+      if (dimension() == 3) {
+        for (typename std::vector<Facet>::const_iterator i = facets.begin();
+          i != facets.end(); ++i) {
+            vertices.insert(i->first->vertex((i->second+1)&3));
+            vertices.insert(i->first->vertex((i->second+2)&3));
+            vertices.insert(i->first->vertex((i->second+3)&3));
+        }
+      } else {
+        for (typename std::vector<Facet>::const_iterator i = facets.begin();
+          i != facets.end(); ++i) {
+            vertices.insert(i->first->vertex(cw(i->second)));
+            vertices.insert(i->first->vertex(ccw(i->second)));
+        }
+      }
+
+      return std::copy(vertices.begin(), vertices.end(), res);
+    }
+
+    void remove (Vertex_handle v);
+    // Concurrency-safe
+    // See Triangulation_3::remove for more information
+    bool remove (Vertex_handle v, bool *could_lock_zone);
+
+    template < typename InputIterator >
+    size_type remove(InputIterator first, InputIterator beyond)
+    {
+      CGAL_triangulation_precondition(!this->does_repeat_in_range(first, beyond));
+      size_type n = number_of_vertices();
+
+#ifdef CGAL_TRIANGULATION_3_PROFILING
+      WallClockTimer t;
+#endif
+
+      // Parallel
+#ifdef CGAL_LINKED_WITH_TBB
+      if (this->is_parallel())
+      {
+        // TODO: avoid that by asking for ramdom-access iterators?
+        std::vector<Vertex_handle> vertices(first, beyond);
+        tbb::concurrent_vector<Vertex_handle> vertices_to_remove_sequentially;
+
+        tbb::parallel_for(
+          tbb::blocked_range<size_t>( 0, vertices.size()),
+          Remove_point<Self>(*this, vertices, vertices_to_remove_sequentially)
+        );
+
+        // Do the rest sequentially
+        for ( typename tbb::concurrent_vector<Vertex_handle>::const_iterator
+                it = vertices_to_remove_sequentially.begin(),
+                it_end = vertices_to_remove_sequentially.end()
+            ; it != it_end
+            ; ++it)
+        {
+          remove(*it);
+        }
+      }
+      // Sequential
+      else
+#endif // CGAL_LINKED_WITH_TBB
+      {
+        while (first != beyond) {
+          remove(*first);
+          ++first;
+        }
+      }
+
+#ifdef CGAL_TRIANGULATION_3_PROFILING
+      std::cerr << "Points removed in " << t.elapsed() << " seconds." << std::endl;
+#endif
+      return n - number_of_vertices();
+    }
+
+    
+    template <class OutputItCells>
+    void remove_and_give_new_cells(Vertex_handle v, OutputItCells cit)
+    {
+      Self tmp;
+      Vertex_remover<Self> remover (tmp);
+      Tr_Base::remove_and_give_new_cells(v, remover, cit);
+
+      CGAL_triangulation_expensive_postcondition(is_valid());
+    }
+
+
+    // DISPLACEMENT
+    Vertex_handle move_point(Vertex_handle v, const Weighted_point & p);
+
+    // Displacement works only for Regular triangulation
+    // without hidden points at any time
+    Vertex_handle move_if_no_collision(Vertex_handle v, const Weighted_point & p);
+    Vertex_handle move(Vertex_handle v, const Weighted_point & p);
+
+    // REMOVE CLUSTER - works only when Regular has no hidden point at all
+    // "regular as Delaunay"
+    template < typename InputIterator >
+    size_type remove_cluster(InputIterator first, InputIterator beyond)
+    {
+      Self tmp;
+      Vertex_remover<Self> remover (tmp);
+      return Tr_Base::remove(first, beyond, remover);
+    }
+
+  protected:
+
+    Oriented_side
+      side_of_oriented_power_sphere(const Weighted_point &p0,
+      const Weighted_point &p1,
+      const Weighted_point &p2,
+      const Weighted_point &p3,
+      const Weighted_point &p,
+      bool perturb = false) const;
+
+    Oriented_side
+      side_of_oriented_power_circle(const Weighted_point &p0,
+      const Weighted_point &p1,
+      const Weighted_point &p2,
+      const Weighted_point &p,
+      bool perturb = false) const;
+
+    Bounded_side
+      side_of_bounded_power_circle(const Weighted_point &p0,
+      const Weighted_point &p1,
+      const Weighted_point &p2,
+      const Weighted_point &p,
+      bool perturb = false) const;
+
+    Bounded_side
+      side_of_bounded_power_segment(const Weighted_point &p0,
+      const Weighted_point &p1,
+      const Weighted_point &p,
+      bool perturb = false) const;
+
+
+  public:
+
+    // Queries
+    Bounded_side
+      side_of_power_sphere(Cell_handle c, const Weighted_point &p,
+      bool perturb = false) const;
+
+    Bounded_side
+      side_of_power_circle(const Facet & f, const Weighted_point & p,
+      bool /* perturb */ = false) const
+    {
+      return side_of_power_circle(f.first, f.second, p);
+    }
+
+    Bounded_side
+      side_of_power_circle(Cell_handle c, int i, const Weighted_point &p,
+      bool perturb = false) const;
+
+    Bounded_side
+      side_of_power_segment(Cell_handle c, const Weighted_point &p,
+      bool perturb = false) const;
+
+    Vertex_handle
+      nearest_power_vertex_in_cell(const Bare_point& p,
+      Cell_handle c)  const;
+
+    Vertex_handle
+      nearest_power_vertex(const Bare_point& p, Cell_handle c =
+      Cell_handle()) const;
+
+    bool is_Gabriel(Cell_handle c, int i) const;
+    bool is_Gabriel(Cell_handle c, int i, int j) const;
+    bool is_Gabriel(const Facet& f)const ;
+    bool is_Gabriel(const Edge& e) const;
+    bool is_Gabriel(Vertex_handle v) const;
+
+
+    // Dual functions
+    Bare_point dual(Cell_handle c) const;
+
+    Object dual(const Facet & f) const
+    { return dual( f.first, f.second ); }
+
+    Object dual(Cell_handle c, int i) const;
+
+    template < class Stream>
+    Stream& draw_dual(Stream & os)
+    {
+      for (Finite_facets_iterator fit = finite_facets_begin(),
+        end = finite_facets_end();
+        fit != end; ++fit) {
+          Object o = dual(*fit);
+          if      (const Segment    *s = object_cast<Segment>(&o))    os << *s;
+          else if (const Ray        *r = object_cast<Ray>(&o))        os << *r;
+          else if (const Bare_point *p = object_cast<Bare_point>(&o)) os << *p;
+      }
+      return os;
+    }
+
+    bool is_valid(bool verbose = false, int level = 0) const;
+
+  protected:
+    bool
+      less_power_distance(const Bare_point &p,
+      const Weighted_point &q,
+      const Weighted_point &r)  const
+    {
+      return
+        geom_traits().compare_power_distance_3_object()(p, q, r) == SMALLER;
+    }
+
+    Bare_point
+      construct_weighted_circumcenter(const Weighted_point &p,
+      const Weighted_point &q,
+      const Weighted_point &r,
+      const Weighted_point &s) const
+    {
+      return geom_traits().construct_weighted_circumcenter_3_object()(p,q,r,s);
+    }
+
+    Bare_point
+      construct_weighted_circumcenter(const Weighted_point &p,
+      const Weighted_point &q,
+      const Weighted_point &r) const
+    {
+      return geom_traits().construct_weighted_circumcenter_3_object()(p,q,r);
+    }
+
+    Line
+      construct_perpendicular_line(const Plane &pl, const Bare_point &p) const
+    {
+      return geom_traits().construct_perpendicular_line_3_object()(pl, p);
+    }
+
+    Plane
+      construct_plane(const Bare_point &p, const Bare_point &q, const Bare_point &r) const
+    {
+      return geom_traits().construct_plane_3_object()(p, q, r);
+    }
+
+    Ray
+      construct_ray(const Bare_point &p, const Line &l) const
+    {
+      return geom_traits().construct_ray_3_object()(p, l);
+    }
+
+    Object
+      construct_object(const Bare_point &p) const
+    {
+      return geom_traits().construct_object_3_object()(p);
+    }
+
+    Object
+      construct_object(const Segment &s) const
+    {
+      return geom_traits().construct_object_3_object()(s);
+    }
+
+    Object
+      construct_object(const Ray &r) const
+    {
+      return geom_traits().construct_object_3_object()(r);
+    }
+
+    Vertex_handle
+      nearest_power_vertex(const Bare_point &p,
+      Vertex_handle v,
+      Vertex_handle w) const
+    {
+      // In case of equality, v is returned.
+      CGAL_triangulation_precondition(v != w);
+      if (is_infinite(v))	  return w;
+      if (is_infinite(w))	  return v;
+      return less_power_distance(p, w->point(), v->point()) ? w : v;
+    }
+
+    Oriented_side
+      power_test(const Weighted_point &p, const Weighted_point &q) const
+    {
+      CGAL_triangulation_precondition(this->equal(p, q));
+      return geom_traits().power_test_3_object()(p, q);
+    }
+
+    Oriented_side
+      power_test(const Weighted_point &p, const Weighted_point &q,
+      const Weighted_point &r) const
+    {
+      CGAL_triangulation_precondition(this->collinear(p, q, r));
+      return geom_traits().power_test_3_object()(p, q, r);
+    }
+
+    Oriented_side
+      power_test(const Weighted_point &p, const Weighted_point &q,
+      const Weighted_point &r, const Weighted_point &s) const
+    {
+      CGAL_triangulation_precondition(this->coplanar(p, q, r, s));
+      return geom_traits().power_test_3_object()(p, q, r, s);
+    }
+
+    Oriented_side
+      power_test(const Weighted_point &p, const Weighted_point &q,
+      const Weighted_point &r, const Weighted_point &s,
+      const Weighted_point &t) const
+    {
+      return geom_traits().power_test_3_object()(p, q, r, s, t);
+    }
+
+    bool in_conflict_3(const Weighted_point &p, const Cell_handle c) const
+    {
+      return side_of_power_sphere(c, p, true) == ON_BOUNDED_SIDE;
+    }
+
+    bool in_conflict_2(const Weighted_point &p, const Cell_handle c, int i) const
+    {
+      return side_of_power_circle(c, i, p, true) == ON_BOUNDED_SIDE;
+    }
+
+    bool in_conflict_1(const Weighted_point &p, const Cell_handle c) const
+    {
+      return side_of_power_segment(c, p, true) == ON_BOUNDED_SIDE;
+    }
+
+    bool in_conflict_0(const Weighted_point &p, const Cell_handle c) const
+    {
+      return power_test(c->vertex(0)->point(), p) == ON_POSITIVE_SIDE;
+    }
+
+    bool in_conflict(const Weighted_point &p, const Cell_handle c) const
+    {
+      switch (dimension()) {
+      case 0: return in_conflict_0(p, c);
+      case 1: return in_conflict_1(p, c);
+      case 2: return in_conflict_2(p, c, 3);
+      case 3: return in_conflict_3(p, c);
+      }
+      return true;
+    }
+
+    class Conflict_tester_3
+    {
+      const Weighted_point &p;
+      const Self *t;
+
+    public:
+
+      Conflict_tester_3(const Weighted_point &pt, const Self *tr)
+        : p(pt), t(tr) {}
+
+      bool operator()(const Cell_handle c) const {
+        return t->in_conflict_3(p, c);
+      }
+
+      bool test_initial_cell(const Cell_handle c) const {
+        return operator()(c);
+      }
+      Oriented_side compare_weight(const Weighted_point &wp1,
+        const Weighted_point &wp2) const
+      {
+        return t->power_test (wp1, wp2);
+      }
+    };
+
+    class Conflict_tester_2
+    {
+      const Weighted_point &p;
+      const Self *t;
+    public:
+
+      Conflict_tester_2(const Weighted_point &pt, const Self *tr)
+        : p(pt), t(tr) {}
+
+      bool operator()(const Cell_handle c) const
+      {
+        return t->in_conflict_2(p, c, 3);
+      }
+      bool test_initial_cell(const Cell_handle c) const {
+        return operator()(c);
+      }
+      Oriented_side compare_weight(const Weighted_point &wp1,
+        const Weighted_point &wp2) const
+      {
+        return t->power_test (wp1, wp2);
+      }
+    };
+
+    class Conflict_tester_1
+    {
+      const Weighted_point &p;
+      const Self *t;
+
+    public:
+
+      Conflict_tester_1(const Weighted_point &pt, const Self *tr)
+        : p(pt), t(tr) {}
+
+      bool operator()(const Cell_handle c) const
+      {
+        return t->in_conflict_1(p, c);
+      }
+      bool test_initial_cell(const Cell_handle c) const {
+        return operator()(c);
+      }
+      Oriented_side compare_weight(const Weighted_point &wp1,
+        const Weighted_point &wp2) const
+      {
+        return t->power_test (wp1, wp2);
+      }
+    };
+
+    class Conflict_tester_0
+    {
+      const Weighted_point &p;
+      const Self *t;
+
+    public:
+
+      Conflict_tester_0(const Weighted_point &pt, const Self *tr)
+        : p(pt), t(tr) {}
+
+      bool operator()(const Cell_handle c) const
+      {
+        return t->in_conflict_0(p, c);
+      }
+      bool test_initial_cell(const Cell_handle c) const {
+        return operator()(c);
+      }
+      int compare_weight(const Weighted_point &wp1,
+        const Weighted_point &wp2) const
+      {
+        return t->power_test (wp1, wp2);
+      }
+    };
+
+    // Sequential version
+    // "dummy" is here to allow the specialization (see below)
+    // See http://groups.google.com/group/comp.lang.c++.moderated/browse_thread/thread/285ab1eec49e1cb6
+    template<typename Concurrency_tag_, typename dummy = void>
+    class Hidden_point_visitor
+    {
+      Self *t;
+      mutable std::vector<Vertex_handle> vertices;
+      mutable std::vector<Weighted_point> hidden_points;
+
+    public:
+
+      Hidden_point_visitor(Self *tr) : t(tr) {}
+
+      template <class InputIterator>
+      void process_cells_in_conflict(InputIterator start, InputIterator end) const
+      {
+        int dim = t->dimension();
+        while (start != end) {
+          std::copy((*start)->hidden_points_begin(),
+            (*start)->hidden_points_end(),
+            std::back_inserter(hidden_points));
+
+          for (int i=0; i<=dim; i++) {
+            Vertex_handle v = (*start)->vertex(i);
+            if (v->cell() != Cell_handle()) {
+              vertices.push_back(v);
+              v->set_cell(Cell_handle());
+            }
+          }
+          start ++;
+        }
+      }
+      void reinsert_vertices(Vertex_handle v) {
+        Cell_handle hc = v->cell();
+        for (typename std::vector<Vertex_handle>::iterator
+          vi = vertices.begin(); vi != vertices.end(); ++vi) {
+            if ((*vi)->cell() != Cell_handle()) continue;
+            hc = t->locate ((*vi)->point(), hc);
+            hide_point(hc, (*vi)->point());
+            t->tds().delete_vertex(*vi);
+        }
+        vertices.clear();
+        for (typename std::vector<Weighted_point>::iterator
+          hp = hidden_points.begin(); hp != hidden_points.end(); ++hp) {
+            hc = t->locate (*hp, hc);
+            hide_point (hc, *hp);
+        }
+        hidden_points.clear();
+      }
+      Vertex_handle replace_vertex(Cell_handle c, int index,
+        const Weighted_point &p) {
+          Vertex_handle v = c->vertex(index);
+          hide_point(c, v->point());
+          v->set_point(p);
+          return v;
+      }
+      void hide_point(Cell_handle c, const Weighted_point &p) {
+        c->hide_point(p);
+      }
+    };
+
+#ifdef CGAL_LINKED_WITH_TBB
+    // Parallel version specialization
+    template<typename dummy>
+    class Hidden_point_visitor<Parallel_tag, dummy>
+    {
+      typedef Hidden_point_visitor<Parallel_tag> HPV;
+
+      Self *t;
+      mutable tbb::enumerable_thread_specific<std::vector<Vertex_handle> >  vertices;
+      mutable tbb::enumerable_thread_specific<std::vector<Weighted_point> > hidden_points;
+
+    public:
+
+      Hidden_point_visitor(Self *tr) : t(tr) {}
+
+      template <class InputIterator>
+      void process_cells_in_conflict(InputIterator start, InputIterator end) const
+      {
+        int dim = t->dimension();
+        while (start != end) {
+          std::copy((*start)->hidden_points_begin(),
+            (*start)->hidden_points_end(),
+            std::back_inserter(hidden_points.local()));
+
+          for (int i=0; i<=dim; i++) {
+            Vertex_handle v = (*start)->vertex(i);
+            if (v->cell() != Cell_handle()) {
+              vertices.local().push_back(v);
+              v->set_cell(Cell_handle());
+            }
+          }
+          start ++;
+        }
+      }
+      void reinsert_vertices(Vertex_handle v) {
+        Cell_handle hc = v->cell();
+        for (typename std::vector<Vertex_handle>::iterator
+          vi = vertices.local().begin(); vi != vertices.local().end(); ++vi) {
+            if ((*vi)->cell() != Cell_handle()) continue;
+            hc = t->locate ((*vi)->point(), hc);
+            hide_point(hc, (*vi)->point());
+            t->tds().delete_vertex(*vi);
+        }
+        vertices.local().clear();
+        for (typename std::vector<Weighted_point>::iterator
+          hp = hidden_points.local().begin(); hp != hidden_points.local().end(); ++hp) {
+            hc = t->locate (*hp, hc);
+            hide_point (hc, *hp);
+        }
+        hidden_points.local().clear();
+      }
+      Vertex_handle replace_vertex(Cell_handle c, int index,
+        const Weighted_point &p) {
+          Vertex_handle v = c->vertex(index);
+          hide_point(c, v->point());
+          v->set_point(p);
+          return v;
+      }
+      void hide_point(Cell_handle c, const Weighted_point &p) {
+        c->hide_point(p);
+      }
+    };
+
+  // Functor for parallel insert(begin, end) function
+  template <typename RT>
+  class Insert_point
+  {
+    typedef typename RT::Weighted_point                 Weighted_point;
+    typedef typename RT::Vertex_handle                  Vertex_handle;
+
+    RT                                                  & m_rt;
+    const std::vector<Weighted_point>                   & m_points;
+    tbb::enumerable_thread_specific<Vertex_handle>      & m_tls_hint;
+
+  public:
+    // Constructor
+    Insert_point(RT & rt,
+                 const std::vector<Weighted_point> & points,
+                 tbb::enumerable_thread_specific<Vertex_handle> & tls_hint)
+    : m_rt(rt), m_points(points), m_tls_hint(tls_hint)
+    {}
+
+    // Constructor
+    Insert_point(const Insert_point &ip)
+    : m_rt(ip.m_rt), m_points(ip.m_points), m_tls_hint(ip.m_tls_hint)
+    {}
+
+    // operator()
+    void operator()( const tbb::blocked_range<size_t>& r ) const
+    {
+#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
+      static Profile_branch_counter_3 bcounter(
+        "early withdrawals / late withdrawals / successes [Delaunay_tri_3::insert]");
+#endif
+
+      Vertex_handle &hint = m_tls_hint.local();
+      for( size_t i_point = r.begin() ; i_point != r.end() ; ++i_point)
+      {
+        bool success = false;
+        const Weighted_point &p = m_points[i_point];
+        while(!success)
+        {
+          if (m_rt.try_lock_vertex(hint) && m_rt.try_lock_point(p))
+          {
+            bool could_lock_zone;
+            Locate_type lt;
+            int li, lj;
+
+            Cell_handle c = m_rt.locate (p, lt, li, lj, hint->cell(), 
+                                         &could_lock_zone);
+            Vertex_handle v;
+            if (could_lock_zone)
+              v = m_rt.insert (p, lt, c, li, lj, &could_lock_zone);
+
+            if (could_lock_zone)
+            {
+              hint = (v == Vertex_handle() ? c->vertex(0) : v);
+              m_rt.unlock_all_elements();
+              success = true;
+#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
+              ++bcounter;
+#endif
+            }
+            else
+            {
+              m_rt.unlock_all_elements();
+#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
+              bcounter.increment_branch_1(); // THIS is a late withdrawal!
+#endif
+            }
+          }
+          else
+          {
+            m_rt.unlock_all_elements();
+#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
+            bcounter.increment_branch_2(); // THIS is an early withdrawal!
+#endif
+          }
+        }
+      }
+    }
+  };
+
+  // Functor for parallel insert_with_info(begin, end) function
+  template <typename RT>
+  class Insert_point_with_info
+  {
+    typedef typename RT::Weighted_point                         Weighted_point;
+    typedef typename RT::Vertex_handle                          Vertex_handle;
+    typedef typename RT::Triangulation_data_structure::Vertex::Info Info;
+
+    RT                                                  & m_rt;
+    const std::vector<Weighted_point>                   & m_points;
+    const std::vector<Info>                             & m_infos;
+    const std::vector<std::size_t>                      & m_indices;
+    tbb::enumerable_thread_specific<Vertex_handle>      & m_tls_hint;
+
+  public:
+    // Constructor
+    Insert_point_with_info(RT & rt,
+      const std::vector<Weighted_point> & points,
+      const std::vector<Info> & infos,
+      const std::vector<std::size_t> & indices,
+      tbb::enumerable_thread_specific<Vertex_handle> & tls_hint)
+    : m_rt(rt), m_points(points), m_infos(infos), m_indices(indices), 
+      m_tls_hint(tls_hint)
+    {}
+
+    // Constructor
+    Insert_point_with_info(const Insert_point_with_info &ip)
+    : m_rt(ip.m_rt), m_points(ip.m_points), m_infos(ip.m_infos), 
+      m_indices(ip.m_indices), m_tls_hint(ip.m_tls_hint)
+    {}
+
+    // operator()
+    void operator()(const tbb::blocked_range<size_t>& r) const
+    {
+#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
+      static Profile_branch_counter_3 bcounter(
+        "early withdrawals / late withdrawals / successes [Delaunay_tri_3::insert]");
+#endif
+
+      Vertex_handle &hint = m_tls_hint.local();
+      for (size_t i_idx = r.begin() ; i_idx != r.end() ; ++i_idx)
+      {
+        bool success = false;
+        std::ptrdiff_t i_point = m_indices[i_idx];
+        const Weighted_point &p = m_points[i_point];
+        while (!success)
+        {
+          if (m_rt.try_lock_vertex(hint) && m_rt.try_lock_point(p))
+          {
+            bool could_lock_zone;
+            Locate_type lt;
+            int li, lj;
+
+            Cell_handle c = m_rt.locate(p, lt, li, lj, hint->cell(),
+              &could_lock_zone);
+            Vertex_handle v;
+            if (could_lock_zone)
+              v = m_rt.insert(p, lt, c, li, lj, &could_lock_zone);
+
+            if (could_lock_zone)
+            {
+              if (v == Vertex_handle())
+              {
+                hint = c->vertex(0);
+              }
+              else
+              {
+                v->info() = m_infos[i_point];
+                hint = v;
+              }
+
+              m_rt.unlock_all_elements();
+              success = true;
+#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
+              ++bcounter;
+#endif
+            }
+            else
+            {
+              m_rt.unlock_all_elements();
+#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
+              bcounter.increment_branch_1(); // THIS is a late withdrawal!
+#endif
+            }
+          }
+          else
+          {
+            m_rt.unlock_all_elements();
+#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
+            bcounter.increment_branch_2(); // THIS is an early withdrawal!
+#endif
+          }
+        }
+      }
+    }
+  };
+
+  // Functor for parallel remove(begin, end) function
+  template <typename RT>
+  class Remove_point
+  {
+    typedef typename RT::Weighted_point                 Weighted_point;
+    typedef typename RT::Vertex_handle                  Vertex_handle;
+
+    RT                                    & m_rt;
+    const std::vector<Vertex_handle>      & m_vertices;
+    tbb::concurrent_vector<Vertex_handle> & m_vertices_to_remove_sequentially;
+
+  public:
+    // Constructor
+    Remove_point(RT & rt,
+                 const std::vector<Vertex_handle> & vertices,
+                 tbb::concurrent_vector<Vertex_handle> & 
+                   vertices_to_remove_sequentially)
+    : m_rt(rt), m_vertices(vertices), 
+      m_vertices_to_remove_sequentially(vertices_to_remove_sequentially)
+    {}
+
+    // Constructor
+    Remove_point(const Remove_point &rp)
+    : m_rt(rp.m_rt), m_vertices(rp.m_vertices),
+      m_vertices_to_remove_sequentially(rp.m_vertices_to_remove_sequentially)
+    {}
+
+    // operator()
+    void operator()( const tbb::blocked_range<size_t>& r ) const
+    {
+      for( size_t i_vertex = r.begin() ; i_vertex != r.end() ; ++i_vertex)
+      {
+        Vertex_handle v = m_vertices[i_vertex];
+        bool could_lock_zone, needs_to_be_done_sequentially;
+        do
+        {
+          needs_to_be_done_sequentially =
+            !m_rt.remove(v, &could_lock_zone);
+          m_rt.unlock_all_elements();
+        } while (!could_lock_zone);
+
+        if (needs_to_be_done_sequentially)
+          m_vertices_to_remove_sequentially.push_back(v);
+      }
+    }
+  };
+#endif // CGAL_LINKED_WITH_TBB
+
+    Hidden_point_visitor<Concurrency_tag> &get_hidden_point_visitor()
+    {
+      return hidden_point_visitor;
+    }
+
+    template < class RegularTriangulation_3 >
+    class Vertex_remover;
+
+    template < class RegularTriangulation_3 >
+    class Vertex_inserter;
+
+    Hidden_point_visitor<Concurrency_tag> hidden_point_visitor;
+  };
+
+
+  template < class Gt, class Tds, class Lds >
+  typename Regular_triangulation_3<Gt,Tds,Lds>::Vertex_handle
+    Regular_triangulation_3<Gt,Tds,Lds>::
+    nearest_power_vertex_in_cell(const Bare_point& p,
+    Cell_handle c) const
+    // Returns the finite vertex of the cell c with smaller
+    // power distance  to p.
+  {
+    CGAL_triangulation_precondition(dimension() >= 1);
+    Vertex_handle nearest = nearest_power_vertex(p,
+      c->vertex(0),
+      c->vertex(1));
+    if (dimension() >= 2) {
+      nearest = nearest_power_vertex(p, nearest, c->vertex(2));
+      if (dimension() == 3)
+        nearest = nearest_power_vertex(p, nearest, c->vertex(3));
+    }
+    return nearest;
+  }
+
+
+  template < class Gt, class Tds, class Lds >
+  typename Regular_triangulation_3<Gt,Tds,Lds>::Vertex_handle
+    Regular_triangulation_3<Gt,Tds,Lds>::
+    nearest_power_vertex(const Bare_point& p, Cell_handle start) const
+  {
+    if (number_of_vertices() == 0)
+      return Vertex_handle();
+
+    // Use a brute-force algorithm if dimension < 3.
+    if (dimension() < 3) {
+      Finite_vertices_iterator vit = finite_vertices_begin();
+      Vertex_handle res = vit;
+      ++vit;
+      for (Finite_vertices_iterator end = finite_vertices_end(); vit != end; ++vit)
+        res = nearest_power_vertex(p, res, vit);
+      return res;
+    }
+
+    Locate_type lt;
+    int li, lj;
+    // I put the cast here temporarily
+    // until we solve the traits class pb of regular triangulation
+    Cell_handle c = locate(static_cast<Weighted_point>(p), lt, li, lj, start);
+
+    // - start with the closest vertex from the located cell.
+    // - repeatedly take the nearest of its incident vertices if any
+    // - if not, we're done.
+    Vertex_handle nearest = nearest_power_vertex_in_cell(p, c);
+    std::vector<Vertex_handle> vs;
+    vs.reserve(32);
+    while (true) {
+      Vertex_handle tmp = nearest;
+      adjacent_vertices(nearest, std::back_inserter(vs));
+      for (typename std::vector<Vertex_handle>::const_iterator
+        vsit = vs.begin(); vsit != vs.end(); ++vsit)
+        tmp = nearest_power_vertex(p, tmp, *vsit);
+      if (tmp == nearest)
+        break;
+      vs.clear();
+      nearest = tmp;
+    }
+    return nearest;
+  }
+
+template < class Gt, class Tds, class Lds >
+typename Regular_triangulation_3<Gt,Tds,Lds>::Bare_point
+Regular_triangulation_3<Gt,Tds,Lds>::
+dual(Cell_handle c) const
+{
+  CGAL_triangulation_precondition(dimension()==3);
+  CGAL_triangulation_precondition( ! is_infinite(c) );
+
+  return c->weighted_circumcenter(geom_traits());
+}
+
+  template < class Gt, class Tds, class Lds >
+  typename Regular_triangulation_3<Gt,Tds,Lds>::Object
+    Regular_triangulation_3<Gt,Tds,Lds>::
+    dual(Cell_handle c, int i) const
+  {
+    CGAL_triangulation_precondition(dimension()>=2);
+    CGAL_triangulation_precondition( ! is_infinite(c,i) );
+
+    if ( dimension() == 2 ) {
+      CGAL_triangulation_precondition( i == 3 );
+      return construct_object(
+        construct_weighted_circumcenter(c->vertex(0)->point(),
+        c->vertex(1)->point(),
+        c->vertex(2)->point()) );
+    }
+
+    // dimension() == 3
+    Cell_handle n = c->neighbor(i);
+    if ( ! is_infinite(c) && ! is_infinite(n) )
+      return construct_object(construct_segment( dual(c), dual(n) ));
+
+    // either n or c is infinite
+    int in;
+    if ( is_infinite(c) )
+      in = n->index(c);
+    else {
+      n = c;
+      in = i;
+    }
+    // n now denotes a finite cell, either c or c->neighbor(i)
+    int ind[3] = {(in+1)&3,(in+2)&3,(in+3)&3};
+    if ( (in&1) == 1 )
+      std::swap(ind[0], ind[1]);
+    const Weighted_point& p = n->vertex(ind[0])->point();
+    const Weighted_point& q = n->vertex(ind[1])->point();
+    const Weighted_point& r = n->vertex(ind[2])->point();
+
+    Line l =
+      construct_perpendicular_line( construct_plane(p,q,r),
+      construct_weighted_circumcenter(p,q,r) );
+    return construct_object(construct_ray( dual(n), l));
+  }
+
+
+  template < class Gt, class Tds, class Lds >
+  Oriented_side
+    Regular_triangulation_3<Gt,Tds,Lds>::
+    side_of_oriented_power_sphere(const Weighted_point &p0,
+    const Weighted_point &p1,
+    const Weighted_point &p2,
+    const Weighted_point &p3,
+    const Weighted_point &p, bool perturb) const
+  {
+    CGAL_triangulation_precondition( orientation(p0, p1, p2, p3) == POSITIVE );
+
+    using namespace boost;
+
+    Oriented_side os = power_test(p0, p1, p2, p3, p);
+
+    if (os != ON_ORIENTED_BOUNDARY || !perturb)
+      return os;
+
+    // We are now in a degenerate case => we do a symbolic perturbation.
+
+    // We sort the points lexicographically.
+    const Weighted_point * points[5] = {&p0, &p1, &p2, &p3, &p};
+    std::sort(points, points + 5,
+      boost::bind(geom_traits().compare_xyz_3_object(),
+      boost::bind(Dereference<Weighted_point>(), _1),
+      boost::bind(Dereference<Weighted_point>(), _2)) == SMALLER);
+
+    // We successively look whether the leading monomial, then 2nd monomial
+    // of the determinant has non null coefficient.
+    for (int i=4; i>1; --i) {
+      if (points[i] == &p)
+        return ON_NEGATIVE_SIDE; // since p0 p1 p2 p3 are non coplanar
+      // and positively oriented
+      Orientation o;
+      if (points[i] == &p3 && (o = orientation(p0,p1,p2,p)) != COPLANAR )
+        return o;
+      if (points[i] == &p2 && (o = orientation(p0,p1,p,p3)) != COPLANAR )
+        return o;
+      if (points[i] == &p1 && (o = orientation(p0,p,p2,p3)) != COPLANAR )
+        return o;
+      if (points[i] == &p0 && (o = orientation(p,p1,p2,p3)) != COPLANAR )
+        return o;
+    }
+
+    CGAL_triangulation_assertion(false);
+    return ON_NEGATIVE_SIDE;
+  }
+
+
+  template < class Gt, class Tds, class Lds >
+  Bounded_side
+    Regular_triangulation_3<Gt,Tds,Lds>::
+    side_of_power_sphere(Cell_handle c, const Weighted_point &p,
+    bool perturb) const
+  {
+    CGAL_triangulation_precondition( dimension() == 3 );
+    int i3;
+    if ( ! c->has_vertex( infinite_vertex(), i3 ) ) {
+      return Bounded_side( side_of_oriented_power_sphere(c->vertex(0)->point(),
+        c->vertex(1)->point(),
+        c->vertex(2)->point(),
+        c->vertex(3)->point(),
+        p, perturb) );
+    }
+    // else infinite cell :
+    int i0,i1,i2;
+    if ( (i3%2) == 1 ) {
+      i0 = (i3+1)&3;
+      i1 = (i3+2)&3;
+      i2 = (i3+3)&3;
+    }
+    else {
+      i0 = (i3+2)&3;
+      i1 = (i3+1)&3;
+      i2 = (i3+3)&3;
+    }
+
+    // general case
+    Orientation o = orientation(c->vertex(i0)->point(),
+      c->vertex(i1)->point(),
+      c->vertex(i2)->point(), p);
+    if (o != ZERO)
+      return Bounded_side(o);
+
+    // else p coplanar with i0,i1,i2
+    return side_of_bounded_power_circle(c->vertex(i0)->point(),
+      c->vertex(i1)->point(),
+      c->vertex(i2)->point(),
+      p, perturb);
+  }
+
+
+  template < class Gt, class Tds, class Lds >
+  Bounded_side
+    Regular_triangulation_3<Gt,Tds,Lds>::
+    side_of_bounded_power_circle(const Weighted_point &p0,
+    const Weighted_point &p1,
+    const Weighted_point &p2,
+    const Weighted_point &p, bool perturb) const
+  {
+    CGAL_triangulation_precondition(coplanar_orientation(p0, p1, p2) != 0);
+    if (coplanar_orientation(p0, p1, p2) == POSITIVE)
+      return Bounded_side (side_of_oriented_power_circle(p0, p1, p2, p, perturb));
+    // Wrong because the low level power test already does a coplanar orientation
+    // test.
+    // return Bounded_side (- side_of_oriented_power_circle (p0, p2, p1, p,
+    // perturb));
+    return Bounded_side (side_of_oriented_power_circle(p0, p2, p1, p, perturb));
+  }
+
+
+  template < class Gt, class Tds, class Lds >
+  Oriented_side
+    Regular_triangulation_3<Gt,Tds,Lds>::
+    side_of_oriented_power_circle(const Weighted_point &p0,
+    const Weighted_point &p1,
+    const Weighted_point &p2,
+    const Weighted_point &p, bool perturb) const
+  {
+    CGAL_triangulation_precondition( coplanar_orientation(p0, p1, p2) == POSITIVE );
+
+    using namespace boost;
+
+    Oriented_side os = power_test(p0, p1, p2, p);
+
+    if (os != ON_ORIENTED_BOUNDARY || !perturb)
+      return os;
+
+    // We are now in a degenerate case => we do a symbolic perturbation.
+
+    // We sort the points lexicographically.
+    const Weighted_point * points[4] = {&p0, &p1, &p2, &p};
+    std::sort(points, points + 4,
+      boost::bind(geom_traits().compare_xyz_3_object(),
+      boost::bind(Dereference<Weighted_point>(), _1),
+      boost::bind(Dereference<Weighted_point>(), _2)) == SMALLER);
+
+    // We successively look whether the leading monomial, then 2nd monomial
+    // of the determinant has non null coefficient.
+    // 2 iterations are enough (cf paper)
+    for (int i=3; i>1; --i) {
+      if (points[i] == &p)
+        return ON_NEGATIVE_SIDE; // since p0 p1 p2 are non collinear
+      // and positively oriented
+      Orientation o;
+      if (points[i] == &p2 && (o = coplanar_orientation(p0,p1,p)) != COPLANAR )
+        return o;
+      if (points[i] == &p1 && (o = coplanar_orientation(p0,p,p2)) != COPLANAR )
+        return o;
+      if (points[i] == &p0 && (o = coplanar_orientation(p,p1,p2)) != COPLANAR )
+        return o;
+    }
+
+    CGAL_triangulation_assertion(false);
+    return ON_NEGATIVE_SIDE;
+  }
+
+
+  template < class Gt, class Tds, class Lds >
+  Bounded_side
+    Regular_triangulation_3<Gt,Tds,Lds>::
+    side_of_power_circle(Cell_handle c, int i, const Weighted_point &p,
+    bool perturb) const
+  {
+    CGAL_triangulation_precondition( dimension() >= 2 );
+    int i3 = 5;
+    if ( dimension() == 2 ) {
+      CGAL_triangulation_precondition( i == 3 );
+      // the triangulation is supposed to be valid, ie the facet
+      // with vertices 0 1 2 in this order is positively oriented
+      if ( ! c->has_vertex( infinite_vertex(), i3 ) )
+        return Bounded_side( side_of_oriented_power_circle(c->vertex(0)->point(),
+        c->vertex(1)->point(),
+        c->vertex(2)->point(),
+        p, perturb) );
+      // else infinite facet
+      // v1, v2 finite vertices of the facet such that v1,v2,infinite
+      // is positively oriented
+      Vertex_handle v1 = c->vertex( ccw(i3) ),
+        v2 = c->vertex( cw(i3) );
+      CGAL_triangulation_assertion(coplanar_orientation(v1->point(), v2->point(),
+        mirror_vertex(c, i3)->point()) == NEGATIVE);
+      Orientation o = coplanar_orientation(v1->point(), v2->point(), p);
+      if ( o != ZERO )
+        return Bounded_side( o );
+      // case when p collinear with v1v2
+      return side_of_bounded_power_segment(v1->point(),
+        v2->point(),
+        p, perturb);
+    }// dim 2
+
+    // else dimension == 3
+    CGAL_triangulation_precondition( (i >= 0) && (i < 4) );
+    if ( ( ! c->has_vertex(infinite_vertex(),i3) ) || ( i3 != i ) ) {
+      // finite facet
+      // initialization of i0 i1 i2, vertices of the facet positively
+      // oriented (if the triangulation is valid)
+      int i0 = (i>0) ? 0 : 1;
+      int i1 = (i>1) ? 1 : 2;
+      int i2 = (i>2) ? 2 : 3;
+      CGAL_triangulation_precondition(this->coplanar(c->vertex(i0)->point(),
+        c->vertex(i1)->point(),
+        c->vertex(i2)->point(), p));
+      return side_of_bounded_power_circle(c->vertex(i0)->point(),
+        c->vertex(i1)->point(),
+        c->vertex(i2)->point(),
+        p, perturb);
+    }
+    //else infinite facet
+    // v1, v2 finite vertices of the facet such that v1,v2,infinite
+    // is positively oriented
+    Vertex_handle v1 = c->vertex( next_around_edge(i3,i) ),
+      v2 = c->vertex( next_around_edge(i,i3) );
+    Orientation o = (Orientation)
+      (coplanar_orientation( v1->point(), v2->point(),
+      c->vertex(i)->point()) *
+      coplanar_orientation( v1->point(), v2->point(), p));
+    // then the code is duplicated from 2d case
+    if ( o != ZERO )
+      return Bounded_side( -o );
+    // because p is in f iff
+    // it is not on the same side of v1v2 as c->vertex(i)
+    // case when p collinear with v1v2 :
+    return side_of_bounded_power_segment(v1->point(),
+      v2->point(),
+      p, perturb);
+  }
+
+  template < class Gt, class Tds, class Lds >
+  Bounded_side
+    Regular_triangulation_3<Gt,Tds,Lds>::
+    side_of_bounded_power_segment(const Weighted_point &p0,
+    const Weighted_point &p1,
+    const Weighted_point &p, bool perturb) const
+  {
+    Oriented_side os = power_test(p0, p1, p);
+
+    if (os != ON_ORIENTED_BOUNDARY || !perturb)
+      return Bounded_side(os);
+
+    // We are now in a degenerate case => we do a symbolic perturbation.
+
+    switch (this->collinear_position(p0, p, p1)) {
+    case Tr_Base::BEFORE: case Tr_Base::AFTER:
+      return ON_UNBOUNDED_SIDE;
+    case Tr_Base::MIDDLE:
+      return ON_BOUNDED_SIDE;
+    default:
+      ;
+    }
+
+    CGAL_triangulation_assertion(false);
+    return ON_UNBOUNDED_SIDE;
+  }
+
+  template < class Gt, class Tds, class Lds >
+  Bounded_side
+    Regular_triangulation_3<Gt,Tds,Lds>::
+    side_of_power_segment(Cell_handle c, const Weighted_point &p,
+    bool perturb) const
+  {
+    CGAL_triangulation_precondition( dimension() == 1 );
+    if ( ! is_infinite(c,0,1) )
+      return side_of_bounded_power_segment(c->vertex(0)->point(),
+      c->vertex(1)->point(),
+      p, perturb);
+    Locate_type lt; int i;
+    Bounded_side soe = side_of_edge( p, c, lt, i );
+    if (soe != ON_BOUNDARY)
+      return soe;
+    // Either we compare weights, or we use the finite neighboring edge
+    Cell_handle finite_neighbor = c->neighbor(c->index(infinite_vertex()));
+    CGAL_triangulation_assertion(!is_infinite(finite_neighbor,0,1));
+    return side_of_bounded_power_segment(finite_neighbor->vertex(0)->point(),
+      finite_neighbor->vertex(1)->point(),
+      p, perturb);
+  }
+
+  template < class Gt, class Tds, class Lds >
+  bool
+    Regular_triangulation_3<Gt,Tds,Lds>::
+    is_Gabriel(const Facet& f) const
+  {
+    return is_Gabriel(f.first, f.second);
+  }
+
+  template < class Gt, class Tds, class Lds >
+  bool
+    Regular_triangulation_3<Gt,Tds,Lds>::
+    is_Gabriel(Cell_handle c, int i) const
+  {
+    CGAL_triangulation_precondition(dimension() == 3 && !is_infinite(c,i));
+    typename Geom_traits::Side_of_bounded_orthogonal_sphere_3
+      side_of_bounded_orthogonal_sphere =
+      geom_traits().side_of_bounded_orthogonal_sphere_3_object();
+
+    if ((!is_infinite(c->vertex(i))) &&
+      side_of_bounded_orthogonal_sphere(
+      c->vertex(vertex_triple_index(i,0))->point(),
+      c->vertex(vertex_triple_index(i,1))->point(),
+      c->vertex(vertex_triple_index(i,2))->point(),
+      c->vertex(i)->point()) == ON_BOUNDED_SIDE ) return false;
+
+    Cell_handle neighbor = c->neighbor(i);
+    int in = neighbor->index(c);
+
+    if ((!is_infinite(neighbor->vertex(in))) &&
+      side_of_bounded_orthogonal_sphere(
+      c->vertex(vertex_triple_index(i,0))->point(),
+      c->vertex(vertex_triple_index(i,1))->point(),
+      c->vertex(vertex_triple_index(i,2))->point(),
+      neighbor->vertex(in)->point()) == ON_BOUNDED_SIDE ) return false;
+
+    return true;
+  }
+
+
+  template < class Gt, class Tds, class Lds >
+  bool
+    Regular_triangulation_3<Gt,Tds,Lds>::
+    is_Gabriel(const Edge& e) const
+  {
+    return is_Gabriel(e.first, e.second, e.third);
+  }
+
+  template < class Gt, class Tds, class Lds >
+  bool
+    Regular_triangulation_3<Gt,Tds,Lds>::
+    is_Gabriel(Cell_handle c, int i, int j) const
+  {
+    CGAL_triangulation_precondition(dimension() == 3 && !is_infinite(c,i,j));
+    typename Geom_traits::Side_of_bounded_orthogonal_sphere_3
+      side_of_bounded_orthogonal_sphere =
+      geom_traits().side_of_bounded_orthogonal_sphere_3_object();
+
+    Facet_circulator fcirc = incident_facets(c,i,j),
+      fdone(fcirc);
+    Vertex_handle v1 = c->vertex(i);
+    Vertex_handle v2 = c->vertex(j);
+    do {
+      // test whether the vertex of cc opposite to *fcirc
+      // is inside the sphere defined by the edge e = (s, i,j)
+      Cell_handle cc = (*fcirc).first;
+      int ii = (*fcirc).second;
+      if (!is_infinite(cc->vertex(ii)) &&
+        side_of_bounded_orthogonal_sphere( v1->point(),
+        v2->point(),
+        cc->vertex(ii)->point())
+        == ON_BOUNDED_SIDE ) return false;
+    } while(++fcirc != fdone);
+    return true;
+  }
+
+  template < class Gt, class Tds, class Lds >
+  bool
+    Regular_triangulation_3<Gt,Tds,Lds>::
+    is_Gabriel(Vertex_handle v) const
+  {
+    return nearest_power_vertex( v->point().point(), v->cell()) == v;
+  }
+
+  // Returns
+  template < class Gt, class Tds, class Lds >
+  typename Regular_triangulation_3<Gt,Tds,Lds>::Vertex_handle
+    Regular_triangulation_3<Gt,Tds,Lds>::
+    insert(const Weighted_point & p, Cell_handle start, bool *could_lock_zone)
+  {
+    Locate_type lt;
+    int li, lj;
+
+    // Parallel
+    if (could_lock_zone)
+    {
+      Cell_handle c = locate(p, lt, li, lj, start, could_lock_zone);
+      if (*could_lock_zone)
+        return insert(p, lt, c, li, lj, could_lock_zone);
+      else
+        return Vertex_handle();
+    }
+    // Sequential
+    else
+    {
+      Cell_handle c = locate(p, lt, li, lj, start);
+      return insert(p, lt, c, li, lj);
+    }
+  }
+
+  template < class Gt, class Tds, class Lds >
+  typename Regular_triangulation_3<Gt,Tds,Lds>::Vertex_handle
+    Regular_triangulation_3<Gt,Tds,Lds>::
+    insert(const Weighted_point & p, Locate_type lt, Cell_handle c,
+           int li, int lj, bool *could_lock_zone)
+  {
+    switch (dimension()) {
+    case 3:
+      {
+        Conflict_tester_3 tester (p, this);
+        return insert_in_conflict(p, lt,c,li,lj, tester,
+                                  get_hidden_point_visitor(),
+                                  could_lock_zone);
+      }
+    case 2:
+      {
+        Conflict_tester_2 tester (p, this);
+        return insert_in_conflict(p, lt,c,li,lj, tester,
+                                  get_hidden_point_visitor(),
+                                  could_lock_zone);
+      }
+    case 1:
+      {
+        Conflict_tester_1 tester (p, this);
+        return insert_in_conflict(p, lt,c,li,lj, tester,
+                                  get_hidden_point_visitor(),
+                                  could_lock_zone);
+      }
+    }
+
+    Conflict_tester_0 tester (p, this);
+    return insert_in_conflict(p, lt,c,li,lj, tester,
+                              get_hidden_point_visitor(),
+                              could_lock_zone);
+  }
+
+
+  template < class Gt, class Tds, class Lds >
+  template <class CellIt>
+  typename Regular_triangulation_3<Gt,Tds,Lds>::Vertex_handle
+    Regular_triangulation_3<Gt,Tds,Lds>::
+    insert_in_hole(const Weighted_point & p, CellIt cell_begin, CellIt cell_end,
+    Cell_handle begin, int i)
+  {
+    CGAL_triangulation_precondition(cell_begin != cell_end);
+
+    get_hidden_point_visitor().process_cells_in_conflict(cell_begin,cell_end);
+
+    Vertex_handle v =
+      Tr_Base::insert_in_hole(p, cell_begin, cell_end, begin, i);
+
+    // Store the hidden points in their new cells and hide vertices that
+    // have to be hidden
+    get_hidden_point_visitor().reinsert_vertices(v);
+    return v;
+  }
+
+
+  template < class Gt, class Tds, class Lds >
+  template <class CellIt>
+  typename Regular_triangulation_3<Gt,Tds,Lds>::Vertex_handle
+    Regular_triangulation_3<Gt,Tds,Lds>::
+    insert_in_hole(const Weighted_point & p, CellIt cell_begin, CellIt cell_end,
+    Cell_handle begin, int i, Vertex_handle newv)
+  {
+    CGAL_triangulation_precondition(cell_begin != cell_end);
+
+    get_hidden_point_visitor().process_cells_in_conflict(cell_begin,cell_end);
+
+    Vertex_handle v =
+      Tr_Base::insert_in_hole(p, cell_begin, cell_end, begin, i, newv);
+
+    // Store the hidden points in their new cells and hide vertices that
+    // have to be hidden
+    get_hidden_point_visitor().reinsert_vertices(v);
+    return v;
+  }
+
+  template <class Gt, class Tds, class Lds >
+  template <class RegularTriangulation_3>
+  class Regular_triangulation_3<Gt, Tds, Lds>::Vertex_remover {
+    typedef RegularTriangulation_3 Regular;
+    typedef typename Gt::Point_3 Point;
+  public:
+    typedef typename std::vector<Point>::iterator
+      Hidden_points_iterator;
+
+    Vertex_remover(Regular &tmp_) : tmp(tmp_) {}
+
+    Regular &tmp;
+
+    void add_hidden_points(Cell_handle ch) {
+      std::copy (ch->hidden_points_begin(), ch->hidden_points_end(),
+        std::back_inserter(hidden));
+    }
+
+    Hidden_points_iterator hidden_points_begin() {
+      return hidden.begin();
+    }
+    Hidden_points_iterator hidden_points_end() {
+      return hidden.end();
+    }
+
+    Bounded_side side_of_bounded_circle(const Point &p, const Point &q,
+      const Point &r, const Point &s, bool perturb = false) const {
+        return tmp.side_of_bounded_power_circle(p,q,r,s,perturb);
+    }
+
+  private:
+    // The removal of v may un-hide some points,
+    // Space functions output them.
+    std::vector<Point> hidden;
+  };
+
+  // The displacement method works only
+  // on regular triangulation without hidden points at any time
+  // the vertex inserter is used only
+  // for the purpose of displacements
+  template <class Gt, class Tds, class Lds >
+  template <class RegularTriangulation_3>
+  class Regular_triangulation_3<Gt, Tds, Lds>::Vertex_inserter {
+    typedef RegularTriangulation_3 Regular;
+  public:
+    typedef Nullptr_t Hidden_points_iterator;
+
+    Vertex_inserter(Regular &tmp_) : tmp(tmp_) {}
+
+    Regular &tmp;
+
+    void add_hidden_points(Cell_handle) {}
+    Hidden_points_iterator hidden_points_begin() { return NULL; }
+    Hidden_points_iterator hidden_points_end() { return NULL; }
+
+    Vertex_handle insert(const Weighted_point& p,
+      Locate_type lt, Cell_handle c, int li, int lj) {
+        return tmp.insert(p, lt, c, li, lj);
+    }
+
+    Vertex_handle insert(const Weighted_point& p, Cell_handle c) {
+      return tmp.insert(p, c);
+    }
+
+    Vertex_handle insert(const Weighted_point& p) {
+      return tmp.insert(p);
+    }
+  };
+
+  template < class Gt, class Tds, class Lds >
+  void
+    Regular_triangulation_3<Gt,Tds,Lds>::
+    remove(Vertex_handle v)
+  {
+    Cell_handle c;
+    if (dimension() > 0)
+      c = v->cell()->neighbor(v->cell()->index(v));
+
+    Self tmp;
+    Vertex_remover<Self> remover(tmp);
+    Tr_Base::remove(v,remover);
+
+    // Re-insert the points that v was hiding.
+    for (typename Vertex_remover<Self>::Hidden_points_iterator
+      hi = remover.hidden_points_begin();
+      hi != remover.hidden_points_end(); ++hi) {
+        Vertex_handle hv = insert (*hi, c);
+        if (hv != Vertex_handle()) c = hv->cell();
+    }
+    CGAL_triangulation_expensive_postcondition (is_valid());
+  }
+
+  template < class Gt, class Tds, class Lds >
+  bool
+    Regular_triangulation_3<Gt,Tds,Lds>::
+    remove(Vertex_handle v, bool *could_lock_zone)
+  {
+    bool removed = true;
+
+    // Locking vertex v...
+    if (!this->try_lock_vertex(v))
+    {
+      *could_lock_zone = false;
+    }
+    else
+    {
+      Vertex_handle hint = (v->cell()->vertex(0) == v ?
+        v->cell()->vertex(1) : v->cell()->vertex(0));
+
+      Self tmp;
+      Vertex_remover<Self> remover(tmp);
+      removed = Tr_Base::remove(v, remover, could_lock_zone);
+
+      if (*could_lock_zone && removed)
+      {
+        // Re-insert the points that v was hiding.
+        for (typename Vertex_remover<Self>::Hidden_points_iterator
+          hi = remover.hidden_points_begin();
+          hi != remover.hidden_points_end(); ++hi)
+        {
+          bool could_lock_zone = false;
+          Vertex_handle hv;
+          while (!could_lock_zone)
+          {
+            hv = insert (*hi, hint, &could_lock_zone);
+          }
+          if (hv != Vertex_handle())
+            hint = hv;
+        }
+        CGAL_triangulation_expensive_postcondition (is_valid());
+      }
+    }
+
+    return removed;
+  }
+
+  // Again, verbatim copy from Delaunay.
+  template < class Gt, class Tds, class Lds >
+  typename Regular_triangulation_3<Gt,Tds,Lds>::Vertex_handle
+    Regular_triangulation_3<Gt,Tds,Lds>::
+    move_point(Vertex_handle v, const Weighted_point & p)
+  {
+    CGAL_triangulation_precondition(! is_infinite(v));
+    CGAL_triangulation_expensive_precondition(is_vertex(v));
+
+    // Dummy implementation for a start.
+
+    // Remember an incident vertex to restart
+    // the point location after the removal.
+    Cell_handle c = v->cell();
+    Vertex_handle old_neighbor = c->vertex(c->index(v) == 0 ? 1 : 0);
+    CGAL_triangulation_assertion(old_neighbor != v);
+
+    remove(v);
+
+    if (dimension() <= 0)
+      return insert(p);
+    return insert(p, old_neighbor->cell());
+  }
+
+  // Displacement works only for Regular triangulation
+  // without hidden points at any time
+  template < class Gt, class Tds, class Lds >
+  typename Regular_triangulation_3<Gt,Tds,Lds>::Vertex_handle
+    Regular_triangulation_3<Gt,Tds,Lds>::
+    move_if_no_collision(Vertex_handle v, const Weighted_point &p)
+  {
+    Self tmp;
+    Vertex_remover<Self> remover (tmp);
+    Vertex_inserter<Self> inserter (*this);
+    Vertex_handle res = Tr_Base::move_if_no_collision(v,p,remover,inserter);
+
+    CGAL_triangulation_expensive_postcondition(is_valid());
+    return res;
+  }
+
+  template <class Gt, class Tds, class Lds >
+  typename Regular_triangulation_3<Gt,Tds,Lds>::Vertex_handle
+    Regular_triangulation_3<Gt,Tds,Lds>::
+    move(Vertex_handle v, const Weighted_point &p) {
+      CGAL_triangulation_precondition(!is_infinite(v));
+      if(v->point() == p) return v;
+      Self tmp;
+      Vertex_remover<Self> remover (tmp);
+      Vertex_inserter<Self> inserter (*this);
+      return Tr_Base::move(v,p,remover,inserter);
+  }
+
+  template < class Gt, class Tds, class Lds >
+  bool
+    Regular_triangulation_3<Gt,Tds,Lds>::
+    is_valid(bool verbose, int level) const
+  {
+    if ( ! Tr_Base::is_valid(verbose,level) ) {
+      if (verbose)
+        std::cerr << "invalid base triangulation" << std::endl;
+      CGAL_triangulation_assertion(false);
+      return false;
+    }
+
+    switch ( dimension() ) {
+    case 3:
+      {
+        for(Finite_cells_iterator it = finite_cells_begin(), end = finite_cells_end(); it != end; ++it) {
+          is_valid_finite(it, verbose, level);
+          for(int i=0; i<4; i++) {
+            if ( !is_infinite
+              (it->neighbor(i)->vertex(it->neighbor(i)->index(it))) ) {
+                if ( side_of_power_sphere
+                  (it,
+                  it->neighbor(i)->vertex(it->neighbor(i)->index(it))->point())
+                  == ON_BOUNDED_SIDE ) {
+                    if (verbose)
+                      std::cerr << "non-empty sphere " << std::endl;
+                    CGAL_triangulation_assertion(false);
+                    return false;
+                }
+            }
+          }
+        }
+        break;
+      }
+    case 2:
+      {
+        for(Finite_facets_iterator it = finite_facets_begin(), end = finite_facets_end(); it!= end; ++it) {
+          is_valid_finite((*it).first, verbose, level);
+          for(int i=0; i<3; i++) {
+            if( !is_infinite
+              ((*it).first->neighbor(i)->vertex( (((*it).first)->neighbor(i))
+              ->index((*it).first))) ) {
+                if ( side_of_power_circle
+                  ( (*it).first, 3,
+                  (*it).first->neighbor(i)->
+                  vertex( (((*it).first)->neighbor(i))
+                  ->index((*it).first) )->point() )
+                  == ON_BOUNDED_SIDE ) {
+                    if (verbose)
+                      std::cerr << "non-empty circle " << std::endl;
+                    CGAL_triangulation_assertion(false);
+                    return false;
+                }
+            }
+          }
+        }
+        break;
+      }
+    case 1:
+      {
+        for(Finite_edges_iterator it = finite_edges_begin(), end = finite_edges_end(); it != end; ++it) {
+          is_valid_finite((*it).first, verbose, level);
+          for(int i=0; i<2; i++) {
+            if( !is_infinite
+              ((*it).first->neighbor(i)->vertex( (((*it).first)->neighbor(i))
+              ->index((*it).first))) ) {
+                if ( side_of_power_segment
+                  ( (*it).first,
+                  (*it).first->neighbor(i)->
+                  vertex( (((*it).first)->neighbor(i))
+                  ->index((*it).first) )->point() )
+                  == ON_BOUNDED_SIDE ) {
+                    if (verbose)
+                      std::cerr << "non-empty edge " << std::endl;
+                    CGAL_triangulation_assertion(false);
+                    return false;
+                }
+            }
+          }
+        }
+        break;
+      }
+    }
+    if (verbose)
+      std::cerr << "valid Regular triangulation" << std::endl;
+    return true;
+  }
+
+} //namespace CGAL
+
+#if defined(BOOST_MSVC)
+#  pragma warning(pop)
+#endif
+
+#endif // CGAL_REGULAR_TRIANGULATION_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Regular_triangulation_adaptation_policies_2.h b/3rdparty/CGAL/include/CGAL/Regular_triangulation_adaptation_policies_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Regular_triangulation_adaptation_policies_2.h
rename to 3rdparty/CGAL/include/CGAL/Regular_triangulation_adaptation_policies_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Regular_triangulation_adaptation_traits_2.h b/3rdparty/CGAL/include/CGAL/Regular_triangulation_adaptation_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Regular_triangulation_adaptation_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Regular_triangulation_adaptation_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Regular_triangulation_cell_base_3.h b/3rdparty/CGAL/include/CGAL/Regular_triangulation_cell_base_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Regular_triangulation_cell_base_3.h
rename to 3rdparty/CGAL/include/CGAL/Regular_triangulation_cell_base_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Regular_triangulation_cell_base_with_weighted_circumcenter_3.h b/3rdparty/CGAL/include/CGAL/Regular_triangulation_cell_base_with_weighted_circumcenter_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Regular_triangulation_cell_base_with_weighted_circumcenter_3.h
rename to 3rdparty/CGAL/include/CGAL/Regular_triangulation_cell_base_with_weighted_circumcenter_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Regular_triangulation_euclidean_traits_2.h b/3rdparty/CGAL/include/CGAL/Regular_triangulation_euclidean_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Regular_triangulation_euclidean_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Regular_triangulation_euclidean_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Regular_triangulation_euclidean_traits_3.h b/3rdparty/CGAL/include/CGAL/Regular_triangulation_euclidean_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Regular_triangulation_euclidean_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/Regular_triangulation_euclidean_traits_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Regular_triangulation_face_base_2.h b/3rdparty/CGAL/include/CGAL/Regular_triangulation_face_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Regular_triangulation_face_base_2.h
rename to 3rdparty/CGAL/include/CGAL/Regular_triangulation_face_base_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Regular_triangulation_filtered_traits_2.h b/3rdparty/CGAL/include/CGAL/Regular_triangulation_filtered_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Regular_triangulation_filtered_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Regular_triangulation_filtered_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Regular_triangulation_vertex_base_2.h b/3rdparty/CGAL/include/CGAL/Regular_triangulation_vertex_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Regular_triangulation_vertex_base_2.h
rename to 3rdparty/CGAL/include/CGAL/Regular_triangulation_vertex_base_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Residue.h b/3rdparty/CGAL/include/CGAL/Residue.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Residue.h
rename to 3rdparty/CGAL/include/CGAL/Residue.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Ridges.h b/3rdparty/CGAL/include/CGAL/Ridges.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Ridges.h
rename to 3rdparty/CGAL/include/CGAL/Ridges.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Robust_circumcenter_filtered_traits_3.h b/3rdparty/CGAL/include/CGAL/Robust_circumcenter_filtered_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Robust_circumcenter_filtered_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/Robust_circumcenter_filtered_traits_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Robust_circumcenter_traits_3.h b/3rdparty/CGAL/include/CGAL/Robust_circumcenter_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Robust_circumcenter_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/Robust_circumcenter_traits_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Robust_construction.h b/3rdparty/CGAL/include/CGAL/Robust_construction.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Robust_construction.h
rename to 3rdparty/CGAL/include/CGAL/Robust_construction.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Root_for_circles_2_2.h b/3rdparty/CGAL/include/CGAL/Root_for_circles_2_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Root_for_circles_2_2.h
rename to 3rdparty/CGAL/include/CGAL/Root_for_circles_2_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Root_for_spheres_2_3.h b/3rdparty/CGAL/include/CGAL/Root_for_spheres_2_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Root_for_spheres_2_3.h
rename to 3rdparty/CGAL/include/CGAL/Root_for_spheres_2_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Root_of_traits.h b/3rdparty/CGAL/include/CGAL/Root_of_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Root_of_traits.h
rename to 3rdparty/CGAL/include/CGAL/Root_of_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Root_of_traits_specializations.h b/3rdparty/CGAL/include/CGAL/Root_of_traits_specializations.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Root_of_traits_specializations.h
rename to 3rdparty/CGAL/include/CGAL/Root_of_traits_specializations.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Rotational_sweep_visibility_2.h b/3rdparty/CGAL/include/CGAL/Rotational_sweep_visibility_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Rotational_sweep_visibility_2.h
rename to 3rdparty/CGAL/include/CGAL/Rotational_sweep_visibility_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Runge_kutta_integrator_2.h b/3rdparty/CGAL/include/CGAL/Runge_kutta_integrator_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Runge_kutta_integrator_2.h
rename to 3rdparty/CGAL/include/CGAL/Runge_kutta_integrator_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Scalar_factor_traits.h b/3rdparty/CGAL/include/CGAL/Scalar_factor_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Scalar_factor_traits.h
rename to 3rdparty/CGAL/include/CGAL/Scalar_factor_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Scale_space_reconstruction_3/Scale_space_surface_reconstruction_3_impl.h b/3rdparty/CGAL/include/CGAL/Scale_space_reconstruction_3/Scale_space_surface_reconstruction_3_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Scale_space_reconstruction_3/Scale_space_surface_reconstruction_3_impl.h
rename to 3rdparty/CGAL/include/CGAL/Scale_space_reconstruction_3/Scale_space_surface_reconstruction_3_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Scale_space_reconstruction_3/Shape_construction_3.h b/3rdparty/CGAL/include/CGAL/Scale_space_reconstruction_3/Shape_construction_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Scale_space_reconstruction_3/Shape_construction_3.h
rename to 3rdparty/CGAL/include/CGAL/Scale_space_reconstruction_3/Shape_construction_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Scale_space_reconstruction_3/internal/Auto_count.h b/3rdparty/CGAL/include/CGAL/Scale_space_reconstruction_3/internal/Auto_count.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Scale_space_reconstruction_3/internal/Auto_count.h
rename to 3rdparty/CGAL/include/CGAL/Scale_space_reconstruction_3/internal/Auto_count.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Scale_space_surface_reconstruction_3.h b/3rdparty/CGAL/include/CGAL/Scale_space_surface_reconstruction_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Scale_space_surface_reconstruction_3.h
rename to 3rdparty/CGAL/include/CGAL/Scale_space_surface_reconstruction_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Search_traits.h b/3rdparty/CGAL/include/CGAL/Search_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Search_traits.h
rename to 3rdparty/CGAL/include/CGAL/Search_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Search_traits_2.h b/3rdparty/CGAL/include/CGAL/Search_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Search_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Search_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Search_traits_3.h b/3rdparty/CGAL/include/CGAL/Search_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Search_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/Search_traits_3.h
diff --git a/3rdparty/CGAL/include/CGAL/Search_traits_adapter.h b/3rdparty/CGAL/include/CGAL/Search_traits_adapter.h
new file mode 100644
index 0000000..0a408e1
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Search_traits_adapter.h
@@ -0,0 +1,182 @@
+// Copyright (c) 2011 GeometryFactory (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Sebastien Loriot
+
+#ifndef CGAL_SEARCH_TRAITS_WITH_INFO
+#define CGAL_SEARCH_TRAITS_WITH_INFO
+
+#include <CGAL/Kd_tree_rectangle.h>
+#include <CGAL/Euclidean_distance.h> //for default distance specialization
+#include <CGAL/property_map.h>
+#include <CGAL/assertions.h>
+
+#include <boost/mpl/has_xxx.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+namespace CGAL{
+
+using ::get;
+  
+template <class Point_with_info,class PointPropertyMap,class Base_traits>
+class Search_traits_adapter;
+  
+template <class Point_with_info,class PointPropertyMap,class Base_distance>
+class Distance_adapter;
+  
+namespace internal{
+
+BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Has_typedef_Iso_box_d,Iso_box_d,false)
+
+template <class T,bool Has_iso_box_d=Has_typedef_Iso_box_d<T>::value >
+struct Get_iso_box_d;
+
+template <class T>
+struct Get_iso_box_d<T,false>
+{
+  typedef void type;
+};
+
+template <class T>
+struct Get_iso_box_d<T,true>
+{
+  typedef typename T::Iso_box_d type;
+};
+  
+  template <class Point_with_info,class PointPropertyMap,class Base_traits>
+  struct Spatial_searching_default_distance< ::CGAL::Search_traits_adapter<Point_with_info,PointPropertyMap,Base_traits> >{
+    typedef ::CGAL::Distance_adapter<Point_with_info,
+                                                 PointPropertyMap,
+                                                 typename Spatial_searching_default_distance<Base_traits>::type> type;
+  };
+
+} //namespace internal
+  
+  
+template <class Point_with_info,class PointPropertyMap,class Base_traits>
+class Search_traits_adapter : public Base_traits{
+  PointPropertyMap ppmap;
+
+  CGAL_static_assertion( ( boost::is_same< boost::lvalue_property_map_tag,
+                           typename boost::property_traits<PointPropertyMap>::category
+                         >::value ) );
+public:
+  typedef Base_traits Base;
+  typedef typename internal::Get_iso_box_d<Base>::type Iso_box_d;
+
+  Search_traits_adapter(const PointPropertyMap& ppmap_=PointPropertyMap(),
+                          const Base_traits& base=Base_traits()
+  ):Base_traits(base),ppmap(ppmap_){}
+
+  typedef typename Base_traits::Cartesian_const_iterator_d      Cartesian_const_iterator_d;
+  typedef Point_with_info                                       Point_d;
+  typedef typename Base_traits::FT                              FT;
+  typedef typename Base_traits::Dimension                       Dimension;
+  
+
+  struct Construct_cartesian_const_iterator_d: public Base_traits::Construct_cartesian_const_iterator_d{
+    PointPropertyMap ppmap;
+    using Base_traits::Construct_cartesian_const_iterator_d::operator();
+    typedef typename Base_traits::Construct_cartesian_const_iterator_d Base;
+    
+    Construct_cartesian_const_iterator_d(const typename Base_traits::Construct_cartesian_const_iterator_d& base, const PointPropertyMap& ppmap_)
+      :Base_traits::Construct_cartesian_const_iterator_d(base), ppmap(ppmap_){}
+    
+    typename Base_traits::Cartesian_const_iterator_d operator()(const Point_with_info& p) const
+    { return Base::operator() (get(ppmap,p)); }
+
+    typename Base_traits::Cartesian_const_iterator_d operator()(const Point_with_info& p, int)  const
+    { return Base::operator() (get(ppmap,p),0); }
+  };
+  
+  struct Construct_iso_box_d: public Base::Construct_iso_box_d{
+    PointPropertyMap ppmap;
+    typedef typename Base_traits::FT  FT; // needed for VC++, because otherwise it is taken from the private typedef of the base class
+    typedef typename Base::Construct_iso_box_d Base_functor;
+
+    Iso_box_d operator() () const {
+      return Base_functor::operator() ();
+    }
+    Iso_box_d operator() (const Point_with_info& p, const Point_with_info& q) const
+    {
+      return Base_functor::operator() (get(ppmap,p),get(ppmap,q));
+    }
+  };
+  
+  const PointPropertyMap& point_property_map() const {return ppmap;}
+  
+  Construct_cartesian_const_iterator_d construct_cartesian_const_iterator_d_object() const {
+    return Construct_cartesian_const_iterator_d(
+      Base::construct_cartesian_const_iterator_d_object(),
+      ppmap);
+  }
+};
+
+template <class Point_with_info,class PointPropertyMap,class Base_distance>
+class Distance_adapter : public Base_distance {
+  PointPropertyMap ppmap;
+  typedef typename Base_distance::FT FT;
+
+  CGAL_static_assertion( ( boost::is_same< boost::lvalue_property_map_tag,
+                           typename boost::property_traits<PointPropertyMap>::category
+                         >::value ) );
+public:
+    
+  Distance_adapter( const PointPropertyMap& ppmap_=PointPropertyMap(),
+                         const Base_distance& distance=Base_distance()
+  ):Base_distance(distance),ppmap(ppmap_){}
+
+  using Base_distance::transformed_distance;
+  
+  typedef Point_with_info Point_d;
+  typedef typename Base_distance::Query_item Query_item;
+
+  const PointPropertyMap& point_property_map() const {return ppmap;}    
+
+  FT transformed_distance(const Query_item& p1, const Point_with_info& p2) const
+  {
+    return Base_distance::transformed_distance(p1,get(ppmap,p2));
+  }
+
+  template <class FT,class Dimension>
+  FT min_distance_to_rectangle(const Query_item& p, const CGAL::Kd_tree_rectangle<FT,Dimension>& b) const
+  {
+    return Base_distance::min_distance_to_rectangle(p,b);
+  }
+
+  template <class FT,class Dimension>
+  FT min_distance_to_rectangle(const Query_item& p, const CGAL::Kd_tree_rectangle<FT,Dimension>& b,std::vector<FT>& dists) const
+  {
+    return Base_distance::min_distance_to_rectangle(p,b,dists);
+  }
+
+  template <class FT,class Dimension>
+  FT max_distance_to_rectangle(const Query_item& p,const CGAL::Kd_tree_rectangle<FT,Dimension>& b) const
+  {
+    return Base_distance::max_distance_to_rectangle(p,b);
+  }  
+  template <class FT,class Dimension>
+  FT max_distance_to_rectangle(const Query_item& p,const CGAL::Kd_tree_rectangle<FT,Dimension>& b,std::vector<FT>& dists) const
+  {
+    return Base_distance::max_distance_to_rectangle(p,b,dists);
+  }  
+};
+
+}//namespace CGAL
+
+#endif //CGAL_SEARCH_TRAITS_WITH_INFO
diff --git a/3rdparty/CGAL/include/CGAL/Search_traits_d.h b/3rdparty/CGAL/include/CGAL/Search_traits_d.h
new file mode 100644
index 0000000..8fab379
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Search_traits_d.h
@@ -0,0 +1,51 @@
+// Copyright (c) 2002,2011 Utrecht University (The Netherlands).
+// 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
+// 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(s)     : Hans Tangelder (<hanst at cs.uu.nl>)
+
+
+#ifndef CGAL_SEARCH_TRAITS_D_H
+#define CGAL_SEARCH_TRAITS_D_H
+#include <CGAL/Dimension.h>
+
+namespace CGAL {
+
+
+  template <class K,typename D = Dynamic_dimension_tag>
+  class Search_traits_d {
+
+  public:
+    typedef D Dimension;
+    typedef typename K::Cartesian_const_iterator_d Cartesian_const_iterator_d;
+    typedef typename K::Construct_cartesian_const_iterator_d Construct_cartesian_const_iterator_d;
+    typedef typename K::Construct_iso_box_d Construct_iso_box_d;
+    typedef typename K::Construct_min_vertex_d Construct_min_vertex_d;
+    typedef typename K::Construct_max_vertex_d Construct_max_vertex_d;
+    typedef typename K::Point_d Point_d;
+    typedef typename K::Iso_box_d Iso_box_d;
+    typedef typename K::Sphere_d Sphere_d;
+    typedef typename K::FT FT;
+    
+    Construct_cartesian_const_iterator_d construct_cartesian_const_iterator_d_object() const {
+       return Construct_cartesian_const_iterator_d();
+    }  
+  };
+
+  
+} // namespace CGAL
+#endif // CGAL_SEARCH_TRAITS_D_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Search_traits_vertex_handle_3.h b/3rdparty/CGAL/include/CGAL/Search_traits_vertex_handle_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Search_traits_vertex_handle_3.h
rename to 3rdparty/CGAL/include/CGAL/Search_traits_vertex_handle_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_2.h b/3rdparty/CGAL/include/CGAL/Segment_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_2_Iso_rectangle_2_intersection.h b/3rdparty/CGAL/include/CGAL/Segment_2_Iso_rectangle_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_2_Iso_rectangle_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Segment_2_Iso_rectangle_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_2_Line_2_intersection.h b/3rdparty/CGAL/include/CGAL/Segment_2_Line_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_2_Line_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Segment_2_Line_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_2_Point_2_intersection.h b/3rdparty/CGAL/include/CGAL/Segment_2_Point_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_2_Point_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Segment_2_Point_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_2_Ray_2_intersection.h b/3rdparty/CGAL/include/CGAL/Segment_2_Ray_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_2_Ray_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Segment_2_Ray_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_2_Segment_2_intersection.h b/3rdparty/CGAL/include/CGAL/Segment_2_Segment_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_2_Segment_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Segment_2_Segment_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_2_Triangle_2_intersection.h b/3rdparty/CGAL/include/CGAL/Segment_2_Triangle_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_2_Triangle_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Segment_2_Triangle_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_3.h b/3rdparty/CGAL/include/CGAL/Segment_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_3.h
rename to 3rdparty/CGAL/include/CGAL/Segment_3.h
diff --git a/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2.h
new file mode 100644
index 0000000..39d88af
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2.h
@@ -0,0 +1,2045 @@
+// Copyright (c) 2003,2004,2005,2006  INRIA Sophia-Antipolis (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
+// 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(s)     : Menelaos Karavelas <mkaravel at iacm.forth.gr>
+
+
+
+#ifndef CGAL_SEGMENT_DELAUNAY_GRAPH_2_H
+#define CGAL_SEGMENT_DELAUNAY_GRAPH_2_H
+
+#include <iostream>
+#include <vector>
+#include <list>
+#include <set>
+#include <map>
+#include <algorithm>
+#include <boost/tuple/tuple.hpp>
+
+#include <CGAL/Segment_Delaunay_graph_2/basic.h>
+
+#include <CGAL/Triangulation_2.h>
+#include <CGAL/Segment_Delaunay_graph_storage_traits_2.h>
+#include <CGAL/Segment_Delaunay_graph_vertex_base_2.h>
+#include <CGAL/Segment_Delaunay_graph_face_base_2.h>
+#include <CGAL/Triangulation_data_structure_2.h>
+
+#include <CGAL/Segment_Delaunay_graph_2/in_place_edge_list.h>
+#include <CGAL/Segment_Delaunay_graph_2/edge_list.h>
+#include <CGAL/Segment_Delaunay_graph_2/Traits_wrapper_2.h>
+#include <CGAL/Segment_Delaunay_graph_2/Constructions_C2.h>
+
+#include <CGAL/Iterator_project.h>
+#include <CGAL/utility.h>
+
+#include <CGAL/spatial_sort.h>
+#include <CGAL/Spatial_sort_traits_adapter_2.h>
+
+#include <boost/iterator/counting_iterator.hpp>
+
+/*
+  Conventions:
+  ------------
+  1. we treat segments as open; the endpoints are separate objects
+  2. a segment of length zero is treated as a point
+  3. a point is deleted only if it has no segment adjacent to it
+  4. when a segment is deleted it's endpoints are not deleted
+  5. the user can force the deletion of endpoints; this is only done
+     if condition 3 is met.
+  6. when objects are written to a stream we distinguish between
+     points and segments; points start by a 'p' and segments by an 's'.
+*/
+
+
+namespace CGAL {
+
+namespace SegmentDelaunayGraph_2 {
+
+namespace Internal {
+
+  template<typename Edge, typename LTag> struct Which_list;
+
+  // use the in-place edge list
+  template<typename E>
+  struct Which_list<E,Tag_true>
+  {
+    typedef E                           Edge;
+    typedef In_place_edge_list_for_sdg<Edge>    List;
+  };
+
+  // do not use the in-place edge list
+  template<typename E>
+  struct Which_list<E,Tag_false>
+  {
+    typedef E                                 Edge;
+    // change the following to Tag_false in order to use
+    // CGAL's Unique_hash_map
+    typedef Tag_true                          Use_stl_map_tag;
+    typedef Edge_list<Edge,Use_stl_map_tag>   List;
+  };
+
+
+  template < class Node >
+  struct Project_site_2 {
+    typedef Node                   argument_type;
+    typedef typename Node::Site_2  Site;
+    typedef Site                   result_type;
+    Site& operator()(const Node& x) const { 
+      static Site s;
+      s = x.site();
+      return s;
+    }
+    //    const Site& operator()(const Node& x) const { return x.site(); }
+  };
+
+  template < class Node, class Site_t >
+  struct Project_input_to_site_2 {
+    typedef Node                   argument_type;
+    typedef Site_t                 Site;
+    typedef Site                   result_type;
+    Site& operator()(const Node& x) const {
+      static Site s;
+      if ( boost::tuples::get<2>(x) /*x.third*/ ) { // it is a point
+	//	s = Site::construct_site_2(*x.first);
+	s = Site::construct_site_2( *boost::tuples::get<0>(x) );
+      } else {
+	//	s = Site::construct_site_2(*x.first, *x.second);
+	s = Site::construct_site_2
+	  (*boost::tuples::get<0>(x), *boost::tuples::get<1>(x));
+      }
+      return s;
+    }
+  };
+
+  template<typename T, typename U>
+  struct Check_type_equality_for_info
+  {
+    Check_type_equality_for_info()
+    {
+      ERROR__INFO_TYPES_OF_insert_AND_Storage_traits_with_info_2_MUST_MATCH
+	(T(), U());
+    }
+  };
+
+  template<typename T>
+  struct Check_type_equality_for_info<T,T>
+  {
+  };
+
+} // namespace Internal
+
+} //namespace SegmentDelaunayGraph_2
+
+
+template<class Gt, class ST, class STag, class D_S, class LTag, class SDGLx >
+class Segment_Delaunay_graph_hierarchy_2;
+
+template<class Gt, class ST, class D_S, class LTag >
+class Segment_Delaunay_graph_Linf_2;
+
+
+template<class Gt,
+	 class ST = Segment_Delaunay_graph_storage_traits_2<Gt>,
+	 class D_S = Triangulation_data_structure_2 < 
+                Segment_Delaunay_graph_vertex_base_2<ST>,
+                Segment_Delaunay_graph_face_base_2<Gt> >,
+	 class LTag = Tag_false >
+class Segment_Delaunay_graph_2
+  : private Triangulation_2<
+          Segment_Delaunay_graph_traits_wrapper_2<Gt>, D_S >
+{
+  friend class Segment_Delaunay_graph_Linf_2<Gt,ST,D_S,LTag>;
+  friend class Segment_Delaunay_graph_hierarchy_2<Gt,ST,Tag_true,D_S,LTag,
+   Segment_Delaunay_graph_2<Gt,ST,D_S,LTag> >;
+  friend class Segment_Delaunay_graph_hierarchy_2<Gt,ST,Tag_false,D_S,LTag,
+   Segment_Delaunay_graph_2<Gt,ST,D_S,LTag> >;
+  friend class Segment_Delaunay_graph_hierarchy_2<Gt,ST,Tag_true,D_S,LTag,
+   Segment_Delaunay_graph_Linf_2<Gt,ST,D_S,LTag> >;
+  friend class Segment_Delaunay_graph_hierarchy_2<Gt,ST,Tag_false,D_S,LTag,
+   Segment_Delaunay_graph_Linf_2<Gt,ST,D_S,LTag> >;
+protected:
+  // LOCAL TYPES
+  //------------
+  typedef Segment_Delaunay_graph_2<Gt,ST,D_S,LTag>       Self;
+
+  typedef Segment_Delaunay_graph_traits_wrapper_2<Gt>   Modified_traits;
+  typedef Triangulation_2<Modified_traits,D_S>           DG;
+  typedef DG                                            Delaunay_graph;
+
+  typedef LTag                                          List_tag;
+
+public:
+  // PUBLIC TYPES
+  //-------------
+  typedef D_S                                     Data_structure;
+  typedef D_S                                     Triangulation_data_structure;
+  typedef Gt                                     Geom_traits;
+  typedef ST                                     Storage_traits;
+  typedef typename Gt::Site_2                    Site_2;
+  typedef typename Gt::Point_2                   Point_2;
+
+  typedef typename D_S::Edge                      Edge;
+  typedef typename D_S::Vertex_handle             Vertex_handle;
+  typedef typename D_S::Face_handle               Face_handle;
+  typedef typename D_S::Vertex                    Vertex;
+  typedef typename D_S::Face                      Face;
+
+  typedef typename D_S::size_type                 size_type;
+
+  typedef typename D_S::Vertex_circulator         Vertex_circulator;
+  typedef typename D_S::Edge_circulator           Edge_circulator;
+  typedef typename D_S::Face_circulator           Face_circulator;
+
+  typedef typename D_S::Face_iterator             All_faces_iterator;
+  typedef typename D_S::Vertex_iterator           All_vertices_iterator;
+  typedef typename D_S::Edge_iterator             All_edges_iterator;
+
+  typedef typename DG::Finite_faces_iterator     Finite_faces_iterator;
+  typedef typename DG::Finite_vertices_iterator  Finite_vertices_iterator;
+  typedef typename DG::Finite_edges_iterator     Finite_edges_iterator;
+
+  typedef typename Storage_traits::Point_container     Point_container;
+  typedef typename Storage_traits::Point_handle        Point_handle;
+  typedef typename Storage_traits::const_Point_handle  const_Point_handle;
+
+protected:
+  typedef typename Geom_traits::Arrangement_type_2  AT2;
+  typedef typename AT2::Arrangement_type            Arrangement_type;
+
+  // these containers should have point handles and should replace the
+  // point container...
+  typedef boost::tuples::tuple<Point_handle,Point_handle,bool>  Site_rep_2;
+
+  struct Site_rep_less_than {
+    // less than for site reps
+    bool operator()(const Site_rep_2& x, const Site_rep_2& y) const {
+      Point_handle x1 = boost::tuples::get<0>(x);
+      Point_handle y1 = boost::tuples::get<0>(y);
+
+      if ( &(*x1) < &(*y1) ) { return true; }
+      if ( &(*y1) < &(*x1) ) { return false; }
+
+      Point_handle x2 = boost::tuples::get<1>(x);
+      Point_handle y2 = boost::tuples::get<1>(y);
+
+      return &(*x2) < &(*y2);
+    }
+  };
+
+  typedef std::set<Site_rep_2,Site_rep_less_than>  Input_sites_container;
+  typedef typename Input_sites_container::const_iterator
+  All_inputs_iterator;
+
+  typedef
+  CGAL_SEGMENT_DELAUNAY_GRAPH_2_NS::Internal::
+  Project_input_to_site_2<Site_rep_2, Site_2>
+  Proj_input_to_site;
+
+  typedef CGAL_SEGMENT_DELAUNAY_GRAPH_2_NS::Internal::Project_site_2<Vertex>
+  Proj_site;
+
+  struct Point_handle_less_than {
+    // less than
+    bool operator()(const const_Point_handle& x,
+		    const const_Point_handle& y) const {
+      return &(*x) < &(*y);
+    }
+  };
+
+  typedef std::pair<Point_handle,Point_handle>   Point_handle_pair;
+
+  typedef std::map<Point_handle,Point_handle,Point_handle_less_than>
+  Handle_map;
+
+public:
+  typedef Iterator_project<All_inputs_iterator, Proj_input_to_site>
+  Input_sites_iterator;
+
+  typedef Iterator_project<Finite_vertices_iterator, 
+                           Proj_site>            Output_sites_iterator;
+protected:
+  // LOCAL VARIABLE(S)
+  //------------------
+  // the container of points
+  Point_container pc_;
+  Input_sites_container isc_;
+  Storage_traits st_;
+#ifdef CGAL_SDG_NO_FACE_MAP
+  std::vector<Face_handle> fhc_;
+#endif
+
+protected:
+  // MORE LOCAL TYPES
+  //-----------------
+  typedef typename Gt::Intersections_tag        Intersections_tag;
+
+  typedef std::map<Face_handle,bool>            Face_map;
+  typedef std::vector<Edge>                     Edge_vector;
+
+  typedef std::list<Vertex_handle>              Vertex_list;
+  typedef typename Vertex_list::iterator        Vertex_list_iterator;
+
+  typedef Triple<Vertex_handle,Vertex_handle,Vertex_handle>
+  Vertex_triple;
+
+  typedef Vertex_handle                         Vh_triple[3];
+  typedef std::map<Face_handle,Sign>            Sign_map;
+
+  typedef std::pair<Face_handle,Face_handle>    Face_pair;
+
+  typedef typename Storage_traits::Storage_site_2   Storage_site_2;
+
+  // the edge list
+  typedef typename
+  CGAL_SEGMENT_DELAUNAY_GRAPH_2_NS::Internal::Which_list<Edge,List_tag>::List 
+  List;
+
+
+protected:
+  // types for insert on segment functions
+  typedef Vertex_triple (Self::*Insert_on_Type)(
+      const Storage_site_2& ss, const Site_2& t,
+      Vertex_handle v, const Tag_true&);
+  Insert_on_Type insert_point_on_segment_ptr;
+
+  typedef Vertex_triple (Self::*Insert_Exact_on_Type)(
+      const Storage_site_2& ss, const Site_2& t,
+      Vertex_handle v);
+  Insert_Exact_on_Type insert_exact_point_on_segment_ptr;
+
+  Vertex_triple
+  insert_point_on_segment(const Storage_site_2& ss, const Site_2& t,
+			  Vertex_handle v, const Tag_true&);
+
+  Vertex_triple
+  insert_exact_point_on_segment(const Storage_site_2& ss, const Site_2& t,
+				Vertex_handle v);
+
+private:
+  // CREATION helper
+  template<class ITag>
+  inline
+  void setup_if_intersecting_pointer(ITag tag) {
+    setup_if_intersecting_pointer_with_tag(tag);
+  }
+
+  void setup_if_intersecting_pointer_with_tag(Tag_false) {
+    insert_point_on_segment_ptr = NULL;
+  }
+
+  void setup_if_intersecting_pointer_with_tag(Tag_true) {
+    insert_point_on_segment_ptr = &Self::insert_point_on_segment;
+  }
+
+  void setup_insert_on_pointers_l2(void) {
+    Intersections_tag itag;
+    setup_if_intersecting_pointer(itag);
+    insert_exact_point_on_segment_ptr = &Self::insert_exact_point_on_segment;
+  }
+
+public:
+  // CREATION
+  //---------
+  Segment_Delaunay_graph_2(const Geom_traits& gt = Geom_traits(),
+			   const Storage_traits& st = Storage_traits())
+    : DG(gt), st_(st)
+  {
+    setup_insert_on_pointers_l2();
+  }
+
+  template< class Input_iterator >
+  Segment_Delaunay_graph_2(Input_iterator first, Input_iterator beyond,
+			   const Geom_traits& gt = Geom_traits(),
+			   const Storage_traits& st = Storage_traits())
+    : DG(gt), st_(st)
+  {
+    setup_insert_on_pointers_l2();
+    insert(first, beyond);
+  }
+
+  Segment_Delaunay_graph_2(const Self& other);
+  Self& operator=(const Self& other);
+
+public:
+  // ACCESS METHODS
+  // --------------
+  const Geom_traits&  geom_traits() const { return DG::geom_traits(); }
+
+  const Storage_traits&  storage_traits() const { return st_; }
+
+  const Data_structure&   data_structure() const { return this->_tds; }
+  const Triangulation_data_structure& tds() const { return this->_tds; }
+  const Point_container&  point_container() const { return pc_; }
+
+  inline size_type number_of_input_sites() const {
+    return isc_.size();
+  }
+
+  inline size_type number_of_output_sites() const {
+    return number_of_vertices();
+  }
+
+  inline size_type number_of_vertices() const {
+    return DG::number_of_vertices();
+  }
+
+  inline size_type number_of_faces() const {
+    return DG::number_of_faces();
+  }
+
+  inline Vertex_handle infinite_vertex() const {
+    return DG::infinite_vertex();
+  }
+
+  inline Face_handle infinite_face() const {
+    return DG::infinite_face();
+  }
+
+  inline Vertex_handle finite_vertex() const {
+    return DG::finite_vertex();
+  }
+
+  inline int dimension() const {
+    return DG::dimension();
+  }
+
+  using Delaunay_graph::cw;
+  using Delaunay_graph::ccw;
+  using Delaunay_graph::delete_vertex;
+  using Delaunay_graph::delete_face;
+public:
+  // TRAVERSAL OF THE DUAL GRAPH
+  //----------------------------
+  inline Finite_faces_iterator finite_faces_begin() const {
+    return DG::finite_faces_begin();
+  }
+
+  inline Finite_faces_iterator finite_faces_end() const {
+    return DG::finite_faces_end();
+  }
+
+  inline Finite_vertices_iterator finite_vertices_begin() const {
+    return DG::finite_vertices_begin();
+  }
+
+  inline Finite_vertices_iterator finite_vertices_end() const {
+    return DG::finite_vertices_end();
+  }
+
+  inline Finite_edges_iterator finite_edges_begin() const {
+    return DG::finite_edges_begin();    
+  }
+
+  inline Finite_edges_iterator finite_edges_end() const {
+    return DG::finite_edges_end();    
+  }
+
+  inline All_faces_iterator all_faces_begin() const {
+    return DG::all_faces_begin();
+  }
+
+  inline All_faces_iterator all_faces_end() const {
+    return DG::all_faces_end();
+  }
+
+  inline All_vertices_iterator all_vertices_begin() const {
+    return DG::all_vertices_begin();
+  }
+
+  inline All_vertices_iterator all_vertices_end() const {
+    return DG::all_vertices_end();
+  }
+
+  inline All_edges_iterator all_edges_begin() const {
+    return DG::all_edges_begin();
+  }
+
+  inline All_edges_iterator all_edges_end() const {
+    return DG::all_edges_end();
+  }
+
+  inline Input_sites_iterator input_sites_begin() const {
+    return Input_sites_iterator(isc_.begin());
+  }
+
+  inline Input_sites_iterator input_sites_end() const {
+    return Input_sites_iterator(isc_.end());
+  }
+
+  inline Output_sites_iterator output_sites_begin() const {
+    return Output_sites_iterator(finite_vertices_begin());
+  }
+
+  inline Output_sites_iterator output_sites_end() const {
+    return Output_sites_iterator(finite_vertices_end());    
+  }
+
+public:
+  // CIRCULATORS
+  //------------
+  inline Face_circulator
+  incident_faces(Vertex_handle v,
+		 Face_handle f = Face_handle()) const {
+    return DG::incident_faces(v, f);
+  }
+
+  inline Vertex_circulator
+  incident_vertices(Vertex_handle v,
+		    Face_handle f = Face_handle()) const { 
+    return DG::incident_vertices(v, f);
+  }
+
+  inline Edge_circulator
+  incident_edges(Vertex_handle v,
+		 Face_handle f = Face_handle()) const {
+    return DG::incident_edges(v, f);
+  }
+ 
+public:
+  // PREDICATES
+  //-----------
+  inline bool is_infinite(const Vertex_handle& v) const {
+    return DG::is_infinite(v);
+  }
+
+  inline bool is_infinite(const Face_handle& f) const {
+    return DG::is_infinite(f);
+  }
+
+  inline bool is_infinite(const Face_handle& f, int i) const {
+    return DG::is_infinite(f, i);
+  }
+
+  inline bool is_infinite(const Edge& e) const {
+    return is_infinite(e.first, e.second);
+  }
+
+  inline bool is_infinite(const Edge_circulator& ec) const {
+    return DG::is_infinite(ec);
+  }
+
+public:
+  // INSERTION METHODS
+  //------------------
+  template<class Input_iterator>
+  inline size_type insert(Input_iterator first, Input_iterator beyond) {
+    return insert(first, beyond, Tag_false());
+  }
+
+  template<class Input_iterator>
+  size_type insert(Input_iterator first, Input_iterator beyond,	Tag_false)
+  {
+    // do it the obvious way: insert them as they come;
+    // one might think though that it might be better to first insert
+    // all end points and then all segments, or a variation of that.
+    size_type n_before = number_of_vertices();
+    for (Input_iterator it = first; it != beyond; ++it) {
+      insert(*it);
+    }
+    size_type n_after = number_of_vertices();
+    return n_after - n_before;
+  }
+
+  //insert a range of points using spatial sorting
+  std::size_t insert_points(std::vector<Point_2>& points)
+  {
+    size_type n = this->number_of_vertices();
+    spatial_sort (points.begin(), points.end(), geom_traits());
+    Vertex_handle hint;
+    for (typename std::vector<Point_2>::const_iterator
+          p = points.begin(), end = points.end(); p != end; ++p)
+    {
+      hint = insert(*p, hint);
+    }
+
+    return this->number_of_vertices() - n;
+  }
+
+  template <class PointIterator>
+  std::size_t insert_points(PointIterator first, PointIterator beyond)
+  {
+    std::vector<Point_2> points (first, beyond);
+    return insert_points(points);
+  }
+
+  template <class IndicesIterator>
+  std::size_t insert_segments( const std::vector<Point_2>& points,
+                               IndicesIterator indices_first,
+                               IndicesIterator indices_beyond )
+  {
+    typedef std::vector<std::size_t> Vertex_indices;
+    typedef std::vector<Vertex_handle> Vertices;
+
+    Vertex_indices vertex_indices;
+    vertex_indices.resize(points.size());
+
+    std::copy(boost::counting_iterator<std::size_t>(0),
+              boost::counting_iterator<std::size_t>(points.size()),
+              std::back_inserter(vertex_indices));
+
+    size_type n = this->number_of_vertices();
+    Spatial_sort_traits_adapter_2<Gt,
+                                  typename Pointer_property_map<Point_2>::const_type >
+      sort_traits(make_property_map(points));
+
+    spatial_sort(vertex_indices.begin(), vertex_indices.end(), sort_traits);
+
+    Vertices vertices;
+    vertices.resize(points.size());
+
+    Vertex_handle hint;
+    for(typename Vertex_indices::const_iterator
+          it_pti = vertex_indices.begin(), end = vertex_indices.end();
+          it_pti != end; ++it_pti)
+    {
+      hint = insert(points[*it_pti], hint);
+      vertices[*it_pti] = hint;
+    }
+
+    for(IndicesIterator it_cst=indices_first, end=indices_beyond;
+        it_cst!=end; ++it_cst)
+    {
+      Vertex_handle v1 = vertices[it_cst->first];
+      Vertex_handle v2 = vertices[it_cst->second];
+      if(v1 != v2) insert(v1, v2);
+    }
+
+    return this->number_of_vertices() - n;
+  }
+
+  template <class PointIterator, class IndicesIterator>
+  std::size_t insert_segments(PointIterator points_first,
+                              PointIterator points_beyond,
+                              IndicesIterator indices_first,
+                              IndicesIterator indices_beyond)
+  {
+    std::vector<Point_2> points (points_first, points_beyond);
+    return insert_segments(points, indices_first, indices_beyond);
+  }
+
+  static const Point_2& get_source(const std::pair<Point_2, Point_2>& segment){
+    return segment.first;
+  }
+  static const Point_2& get_target(const std::pair<Point_2, Point_2>& segment){
+    return segment.second;
+  }
+
+  template <class Segment_2>
+  static const Point_2& get_source(const Segment_2& segment){
+    return segment.source();
+  }
+  template <class Segment_2>
+  static const Point_2& get_target(const Segment_2& segment){
+    return segment.target();
+  }
+
+  static const Point_2& get_source(const Site_2& segment){
+    return segment.source_of_supporting_site();
+  }
+
+  static const Point_2& get_target(const Site_2& segment){
+    return segment.target_of_supporting_site();
+  }
+
+  template <class SegmentIterator>
+  std::size_t insert_segments(SegmentIterator first, SegmentIterator beyond)
+  {
+    std::vector<Point_2> points;
+    for (SegmentIterator s_it=first; s_it!=beyond; ++s_it)
+    {
+      points.push_back( get_source(*s_it) );
+      points.push_back( get_target(*s_it) );
+    }
+
+    std::vector< std::pair<std::size_t, std::size_t> > segment_indices;
+    std::size_t nb_segments = points.size() / 2;
+    segment_indices.reserve( nb_segments );
+    for (std::size_t k=0; k < nb_segments; ++k)
+      segment_indices.push_back( std::make_pair(2*k,2*k+1) );
+
+    return insert_segments( points,
+                            segment_indices.begin(),
+                            segment_indices.end() );
+  }
+
+  template <class Input_iterator>
+  inline size_type
+  insert_range(Input_iterator first, Input_iterator beyond, Site_2){
+    std::vector<Point_2> points;
+    std::vector<Point_2> segment_points;
+    std::vector< std::pair<std::size_t, std::size_t> > segment_indices;
+    std::vector<Site_2> non_input_segments;
+
+    for (Input_iterator it=first; it!=beyond; ++it)
+    {
+      if ( it->is_input() )
+      {
+        if (it->is_point() ) points.push_back( it->point() );
+        else{
+          segment_points.push_back( it->source_of_supporting_site() );
+          segment_points.push_back( it->target_of_supporting_site() );
+          segment_indices.push_back( std::make_pair(segment_points.size()-2,
+                                                    segment_points.size()-1 ));
+        }
+      }
+      else
+        non_input_segments.push_back(*it);
+    }
+    //insert the points
+    size_type n = insert_points(points);
+    //insert the segments
+    n += insert_segments( segment_points,
+                          segment_indices.begin(),
+                          segment_indices.end() );
+    //insert non-input sites
+    std::random_shuffle( non_input_segments.begin(), non_input_segments.end() );
+    n += insert(non_input_segments.begin(),
+                non_input_segments.end(), Tag_false() );
+    return n;
+  }
+
+  template <class Input_iterator>
+  inline size_type
+  insert_range(Input_iterator first, Input_iterator beyond, Point_2){
+    return insert_points(first, beyond);
+  }
+
+  template <class Input_iterator, class Segment_2>
+  inline size_type
+  insert_range(Input_iterator first, Input_iterator beyond, Segment_2){
+    return insert_segments(first, beyond);
+  }
+
+  template<class Input_iterator>
+  inline size_type
+  insert(Input_iterator first, Input_iterator beyond, Tag_true)
+  {
+    return
+      insert_range(first, beyond,
+                   typename std::iterator_traits<Input_iterator>::value_type()
+      );
+  }
+
+  // insert a point
+  inline Vertex_handle insert(const Point_2& p) {
+    // update input site container
+    Point_handle ph = register_input_site(p);
+    Storage_site_2 ss = st_.construct_storage_site_2_object()(ph);
+    return insert_point(ss, p, Vertex_handle());
+  }
+
+  inline Vertex_handle insert(const Point_2& p, Vertex_handle vnear) {
+    // update input site container
+    Point_handle ph = register_input_site(p);
+    Storage_site_2 ss = st_.construct_storage_site_2_object()(ph);
+    return insert_point(ss, p, vnear);
+  }
+
+protected:
+  // insert a point without registering it in the input sites
+  // container: useful for the hierarchy
+  inline Vertex_handle insert_no_register(const Storage_site_2& ss,
+					  const Point_2& p,
+					  Vertex_handle vnear) {
+    return insert_point(ss, p, vnear);
+  }
+
+public:
+  // insert a segment
+  inline Vertex_handle insert(const Point_2& p0, const Point_2& p1) {
+    // update input site container
+    Point_handle_pair php = register_input_site(p0, p1);
+    Storage_site_2 ss =
+      st_.construct_storage_site_2_object()(php.first, php.second);
+    Vertex_handle v = insert_segment(ss, Site_2::construct_site_2(p0, p1),
+				     Vertex_handle());
+    if ( v == Vertex_handle() ) {
+      unregister_input_site(php.first, php.second);
+    }
+    return v;
+  }
+
+  // inserting a segment whose endpoints have already been inserted
+  // update input site container
+  inline Vertex_handle insert(const Vertex_handle& v0,
+			      const Vertex_handle& v1) {
+    CGAL_precondition( v0->storage_site().is_point() &&
+		       v1->storage_site().is_point() );
+
+    Point_handle h0 = v0->storage_site().point();
+    Point_handle h1 = v1->storage_site().point();
+    Storage_site_2 ss = st_.construct_storage_site_2_object()(h0, h1);
+
+    // update input site container
+    Point_handle_pair php = register_input_site(h0, h1);
+
+    if ( number_of_vertices() == 2 ) {
+      return insert_third(ss, v0, v1);
+    }
+
+    Vertex_handle v = insert_segment_interior(ss.site(), ss, v0);
+    if ( v == Vertex_handle() ) {
+      unregister_input_site(php.first, php.second);
+    }
+    return v;
+  }
+
+  inline Vertex_handle insert(const Point_2& p0, const Point_2& p1, 
+			      Vertex_handle vnear) {
+    // update input site container
+    Point_handle_pair php = register_input_site(p0, p1);
+    Storage_site_2 ss =
+      st_.construct_storage_site_2_object()(php.first, php.second);
+    Vertex_handle v =
+      insert_segment(ss, Site_2::construct_site_2(p0, p1), vnear);
+    if ( v == Vertex_handle() ) {
+      unregister_input_site(php.first, php.second);
+    }
+    return v;
+  }
+
+  inline Vertex_handle insert(const Site_2& t) {
+    return insert(t, Vertex_handle());
+  }
+
+  Vertex_handle insert(const Site_2& t, Vertex_handle vnear)
+  {
+    // the intended use is to unify the calls to insert(...);
+    // thus the site must be an exact one; 
+    CGAL_precondition( t.is_input() );
+
+    // update input site container
+
+    if ( t.is_segment() ) {
+      Point_handle_pair php =
+	register_input_site( t.source_of_supporting_site(),
+			     t.target_of_supporting_site() );
+      Storage_site_2 ss =
+	st_.construct_storage_site_2_object()(php.first, php.second);
+      Vertex_handle v = insert_segment(ss, t, vnear);
+      if ( v == Vertex_handle() ) {
+	unregister_input_site( php.first, php.second );
+      }
+      return v;
+    } else if ( t.is_point() ) {
+      Point_handle ph = register_input_site( t.point() );
+      Storage_site_2 ss = st_.construct_storage_site_2_object()(ph);
+      return insert_point(ss, t.point(), vnear);
+    } else {
+      CGAL_precondition ( t.is_defined() );
+      return Vertex_handle(); // to avoid compiler error
+    }
+  }
+
+protected:
+  template<class SSite>
+  inline void convert_info1(SSite& ss_trg, const SSite& ss_src,
+			    bool is_src, int,
+			    typename SSite::Has_info_tag const* = 0) const
+  {
+    //    std::cerr << "converting info..." << std::flush;
+    typename Storage_traits::Convert_info convert = st_.convert_info_object();
+
+    ss_trg.set_info( convert(ss_src.info(), is_src) );
+    //    std::cerr << " done!" << std::endl;
+  }
+
+  template<class SSite>
+  inline void convert_info1(SSite& /*  ss_trg */,
+			    const SSite& /* ss_src */, bool, char) const
+  {
+  }
+
+  void convert_info(Storage_site_2& ss_trg,
+		    const Storage_site_2& ss_src, bool is_src) const {
+    CGAL_precondition( ss_src.is_segment() && ss_trg.is_point() );
+    CGAL_precondition( ss_src.is_input() && ss_trg.is_input() );
+    CGAL_assertion( (is_src && same_points(ss_src.source_site(), ss_trg)) ||
+		    (!is_src && same_points(ss_src.target_site(), ss_trg))
+		    );
+    convert_info1(ss_trg, ss_src, is_src, 0);
+  }
+
+  template<class SSite>
+  inline void merge_info1(Vertex_handle v, const SSite& ss, int,
+			  typename SSite::Has_info_tag const* = 0)
+  {
+    //    std::cerr << "merging info..." << std::flush;
+    Storage_site_2 ss_v = v->storage_site();
+
+    typename Storage_traits::Merge_info merge = st_.merge_info_object();
+
+    ss_v.set_info( merge(ss_v.info(), ss.info()) );
+    v->set_site(ss_v);
+    //    std::cerr << " done!" << std::endl;
+  }
+
+  template<class SSite>
+  inline void merge_info1(Vertex_handle, const SSite&, char) const
+  {
+  }
+
+  // merges the info of the storage site of the vertex handle with the
+  // info of the given site; the vertex_handle contains the storage
+  // site with the new info
+  inline void merge_info(Vertex_handle v, const Storage_site_2& ss)  {
+    CGAL_precondition( (v->storage_site().is_segment() &&
+			ss.is_segment() &&
+			same_segments(v->site(), ss.site())) ||
+		       (v->storage_site().is_point() &&
+			ss.is_point() &&
+			same_points(v->site(), ss.site())) ||
+    		       (v->storage_site().is_point() &&	ss.is_segment())
+    		       );
+    merge_info1(v, ss, 0);
+  }
+
+public:
+  template<typename Info_t>
+  inline Vertex_handle insert(const Site_2& t,
+			      const Info_t& info) {
+    return insert(t, info, Vertex_handle());
+  }
+
+  template<typename Info_t>
+  Vertex_handle insert(const Site_2& t,
+		       const Info_t& info,
+		       Vertex_handle vnear)
+  {
+    typedef typename Storage_traits::Info Info;
+    CGAL_SEGMENT_DELAUNAY_GRAPH_2_NS::Internal::
+      Check_type_equality_for_info<Info_t, Info>();
+    // the intended use is to unify the calls to insert(...);
+    // thus the site must be an exact one; 
+    CGAL_precondition( t.is_input() );
+
+    // update input site container
+
+    if ( t.is_segment() ) {
+      Point_handle_pair php =
+	register_input_site( t.source_of_supporting_site(),
+			     t.target_of_supporting_site() );
+      Storage_site_2 ss =
+	st_.construct_storage_site_2_object()(php.first, php.second);
+      ss.set_info(info);
+      Vertex_handle v = insert_segment(ss, t, vnear);
+      if ( v == Vertex_handle() ) {
+	unregister_input_site( php.first, php.second );
+      }
+      return v;
+    } else if ( t.is_point() ) {
+      Point_handle ph = register_input_site( t.point() );
+      Storage_site_2 ss = st_.construct_storage_site_2_object()(ph);
+      ss.set_info(info);
+      return insert_point(ss, t.point(), vnear);
+    } else {
+      CGAL_precondition ( t.is_defined() );
+      return Vertex_handle(); // to avoid compiler error
+    }
+  }
+
+  // REMOVAL METHODS
+  //----------------
+protected:
+  bool is_star(const Vertex_handle& v) const;
+  bool is_linear_chain(const Vertex_handle& v0, const Vertex_handle& v1,
+		       const Vertex_handle& v2) const;
+  bool is_flippable(const Face_handle& f, int i) const;
+
+  void minimize_degree(const Vertex_handle& v);
+
+  // this method does not really do the job as intended, i.e., for removal
+  void equalize_degrees(const Vertex_handle& v, Self& small_d,
+			std::map<Vertex_handle,Vertex_handle>& vmap,
+			List& l) const;
+
+  void expand_conflict_region_remove(const Face_handle& f,
+				     const Site_2& t,
+				     const Storage_site_2& ss,
+				     List& l, Face_map& fm,
+				     Sign_map& sign_map);
+
+  void find_conflict_region_remove(const Vertex_handle& v,
+				   const Vertex_handle& vnearest,
+				   List& l, Face_map& fm, Sign_map& vm);
+
+  template<class OutputItFaces>
+  OutputItFaces get_faces(const List& l, OutputItFaces fit) const
+  {
+    // map that determines if a face has been visited
+    std::map<Face_handle,bool> fmap;
+
+    // compute the initial face
+    Edge e_front = l.front();
+    Face_handle fstart = e_front.first->neighbor(e_front.second);
+
+    // do the recursion
+    return get_faces(l, fstart, fmap, fit);
+  }
+
+  template<class OutputItFaces>
+  OutputItFaces get_faces(const List& l, Face_handle f,
+			  std::map<Face_handle,bool>& fmap,
+			  OutputItFaces fit) const
+  {
+    // if the face has been visited return
+    if ( fmap.find(f) != fmap.end() ) { return fit; }
+
+    // mark the face as visited
+    fmap[f] = true;
+
+    // output the face
+    *fit++ = f;
+
+    // recursively go to neighbors
+    for (int i = 0; i < 3; i++) {
+      Face_handle n = f->neighbor(i);
+      Edge ee(n, n->index( this->_tds.mirror_vertex(f,i) ));
+      if ( !l.is_in_list(ee) ) {
+	fit = get_faces(l, n, fmap, fit);
+      }
+    }
+    return fit;
+  }
+
+  size_type count_faces(const List& l) const;
+
+  void fill_hole(const Self& small_d, const Vertex_handle& v, const List& l,
+		 std::map<Vertex_handle,Vertex_handle>& vmap);
+
+  bool remove_first(const Vertex_handle& v);
+  bool remove_second(const Vertex_handle& v);
+  bool remove_third(const Vertex_handle& v);
+
+  void compute_small_diagram(const Vertex_handle& v, Self& small_d) const;
+  void compute_vertex_map(const Vertex_handle& v, const Self& small_d,
+			  std::map<Vertex_handle,Vertex_handle>& vmap) const;
+  void remove_degree_d_vertex(const Vertex_handle& v);
+
+  bool remove_base(const Vertex_handle& v);
+
+public:
+  bool remove(const Vertex_handle& v);
+
+protected:
+  inline void unregister_input_site(const Point_handle& h)
+  {
+    Site_rep_2 rep(h, h, true);
+    typename Input_sites_container::iterator it = isc_.find(rep);
+    CGAL_assertion( it != isc_.end() );
+
+    pc_.erase(h);
+    isc_.erase(it);
+  }
+
+  inline void unregister_input_site(const Point_handle& h1,
+				    const Point_handle& h2)
+  {   
+    Site_rep_2 rep(h1, h2, false);
+    typename Input_sites_container::iterator it = isc_.find(rep);
+    
+    Site_rep_2 sym_rep(h2, h1, false);
+    typename Input_sites_container::iterator sym_it = isc_.find(sym_rep);
+
+    CGAL_assertion( it != isc_.end() || sym_it != isc_.end() );
+
+    if ( it != isc_.end() ) { isc_.erase(it); }
+    if ( sym_it != isc_.end() ) { isc_.erase(sym_it); }
+
+    Site_rep_2 r1(h1, h1, true);
+    if ( isc_.find(r1) == isc_.end() ) { isc_.insert(r1); }
+
+    Site_rep_2 r2(h2, h2, true);
+    if ( isc_.find(r2) == isc_.end() ) { isc_.insert(r2); }
+  }
+
+  inline Point_handle register_input_site(const Point_2& p)
+  {
+    std::pair<Point_handle,bool> it = pc_.insert(p);
+    Site_rep_2 rep(it.first, it.first, true);
+    isc_.insert( rep );
+    return it.first;
+  }
+
+  inline
+  Point_handle_pair register_input_site(const Point_2& p0, const Point_2& p1)
+  {
+    std::pair<Point_handle,bool> it1 = pc_.insert(p0);
+    std::pair<Point_handle,bool> it2 = pc_.insert(p1);
+    Site_rep_2 rep(it1.first, it2.first, false);
+    isc_.insert( rep );
+    return Point_handle_pair(it1.first, it2.first);
+  }
+
+  inline
+  Point_handle_pair register_input_site(const Point_handle& h0,
+					const Point_handle& h1)
+  {
+    CGAL_precondition( h0 != h1 );
+    Site_rep_2 rep(h0, h1, false);
+    isc_.insert( rep );
+    return Point_handle_pair(h0, h1);
+  }
+
+  Vertex_handle  insert_first(const Storage_site_2& ss, const Point_2& p);
+  Vertex_handle  insert_second(const Storage_site_2& ss, const Point_2& p);
+  Vertex_handle  insert_third(const Storage_site_2& ss, const Point_2& p);
+  Vertex_handle  insert_third(const Site_2& t, const Storage_site_2& ss);
+  Vertex_handle  insert_third(const Storage_site_2& ss, Vertex_handle v0,
+			      Vertex_handle v1);
+
+  Vertex_handle insert_point(const Storage_site_2& ss, const Point_2& p,
+			     Vertex_handle vnear);
+  Vertex_handle insert_point(const Storage_site_2& ss,
+			     const Site_2& t, Vertex_handle vnear);
+  Vertex_handle insert_point2(const Storage_site_2& ss,
+			      const Site_2& t, Vertex_handle vnear);
+
+  Vertex_handle insert_segment(const Storage_site_2& ss, const Site_2& t,
+			       Vertex_handle vnear);
+
+  Vertex_handle insert_segment_interior(const Site_2& t,
+					const Storage_site_2& ss,
+					Vertex_handle vnear);
+
+  template<class ITag>
+  inline
+  Vertex_handle insert_intersecting_segment(const Storage_site_2& ss,
+					    const Site_2& t,
+					    Vertex_handle v,
+					    ITag tag) {
+    return insert_intersecting_segment_with_tag(ss, t, v, tag);
+  }
+
+  Vertex_handle
+  insert_intersecting_segment_with_tag(const Storage_site_2& ss,
+				       const Site_2& t,
+				       Vertex_handle v, Tag_false);
+
+  Vertex_handle
+  insert_intersecting_segment_with_tag(const Storage_site_2& ss,
+				       const Site_2& t,
+				       Vertex_handle v, Tag_true);
+
+
+
+public:
+  // NEAREST NEIGHBOR LOCATION
+  //--------------------------
+  inline Vertex_handle nearest_neighbor(const Point_2& p) const {
+    return nearest_neighbor(Site_2::construct_site_2(p), Vertex_handle());
+  }
+
+  inline Vertex_handle nearest_neighbor(const Point_2& p,
+					Vertex_handle vnear) const {
+    return nearest_neighbor(Site_2::construct_site_2(p), vnear);
+  }
+
+protected:
+  Vertex_handle nearest_neighbor(const Site_2& p,
+				 Vertex_handle vnear) const;
+
+
+protected:
+  // I/O METHODS
+  //------------
+  typedef std::map<const_Point_handle,size_type,Point_handle_less_than>
+  Point_handle_mapper;
+
+  typedef std::vector<Point_handle> Point_handle_vector;
+
+  void file_output(std::ostream&, const Storage_site_2&,
+		   Point_handle_mapper&) const;
+
+  void file_output(std::ostream&, Point_handle_mapper&,
+		   bool print_point_container) const;
+
+  void file_input(std::istream&, Storage_site_2&,
+		  const Point_handle_vector&, const Tag_true&) const;
+  void file_input(std::istream&, Storage_site_2&,
+		  const Point_handle_vector&, const Tag_false&) const;
+  void file_input(std::istream&, bool read_handle_vector,
+		  Point_handle_vector&);
+
+public:
+  void file_input(std::istream& is) {
+    Point_handle_vector P;
+    file_input(is, true, P);
+  }
+
+  void file_output(std::ostream& os) const {
+    Point_handle_mapper P;
+    size_type inum = 0;
+    for (const_Point_handle ph = pc_.begin(); ph != pc_.end(); ++ph) {
+      P[ph] = inum++;
+    }
+    file_output(os, P, true);
+  }
+
+  template< class Stream >
+  Stream& draw_dual(Stream& str) const
+  {
+    Finite_edges_iterator eit = finite_edges_begin();
+    for (; eit != finite_edges_end(); ++eit) {
+      draw_dual_edge(*eit, str);
+    }
+    return str;
+  }
+
+  template < class Stream > 
+  Stream& draw_skeleton(Stream& str) const
+  {
+    Finite_edges_iterator eit = finite_edges_begin();
+    for (; eit != finite_edges_end(); ++eit) {
+      Site_2 p = eit->first->vertex(  cw(eit->second) )->site();
+      Site_2 q = eit->first->vertex( ccw(eit->second) )->site();
+
+      bool is_endpoint_of_seg =
+	( p.is_segment() && q.is_point() &&
+	  is_endpoint_of_segment(q, p) ) ||
+	( p.is_point() && q.is_segment() &&
+	  is_endpoint_of_segment(p, q) );
+
+      if ( !is_endpoint_of_seg ) {
+	draw_dual_edge(*eit, str);
+      }
+    }
+    return str;
+  }
+
+  // MK: this has to be rewritten. all the checking must be done in
+  // the geometric traits class.
+  template< class Stream >
+  Stream& draw_dual_edge(Edge e, Stream& str) const
+  {
+    CGAL_precondition( !is_infinite(e) );
+
+    typename Geom_traits::Line_2              l;
+    typename Geom_traits::Segment_2           s;
+    typename Geom_traits::Ray_2               r;
+    CGAL::Parabola_segment_2<Gt>              ps;
+
+    Object o = primal(e);
+
+    if (CGAL::assign(l, o))   str << l;
+    if (CGAL::assign(s, o))   str << s; 
+    if (CGAL::assign(r, o))   str << r;
+    if (CGAL::assign(ps, o))  ps.draw(str);
+
+    return str;
+  }
+
+  template< class Stream >
+  inline
+  Stream& draw_dual_edge(Edge_circulator ec, Stream& str) const {
+    return draw_dual_edge(*ec, str);
+  }
+
+  template< class Stream >
+  inline
+  Stream& draw_dual_edge(Finite_edges_iterator eit, Stream& str) const {
+    return draw_dual_edge(*eit, str);
+  }
+
+public:
+  // VALIDITY CHECK
+  //---------------
+  bool is_valid(bool verbose = false, int level = 1) const;
+
+public:
+  // MISCELLANEOUS
+  //--------------
+  void clear() {
+    DG::clear();
+    pc_.clear();
+    isc_.clear();
+  }
+
+  void swap(Segment_Delaunay_graph_2& sdg) {
+    DG::swap(sdg);
+    pc_.swap(sdg.pc_);
+    isc_.swap(sdg.isc_);
+  }
+
+  //////////////////////////////////////////////////////////////////////
+  // THE METHODS BELOW ARE LOCAL
+  //////////////////////////////////////////////////////////////////////
+
+protected:
+  // THE COPY METHOD
+  //------------------------------------------------------------------
+  // used in the copy constructor and assignment operator
+
+  Storage_site_2
+  copy_storage_site(const Storage_site_2& ss_other,
+		    Handle_map& hm, const Tag_false&);
+
+  Storage_site_2
+  copy_storage_site(const Storage_site_2& ss_other,
+		    Handle_map& hm, const Tag_true&);
+
+  void copy(Segment_Delaunay_graph_2& other);
+  void copy(Segment_Delaunay_graph_2& other, Handle_map& hm);
+
+protected:
+  // HELPER METHODS FOR COMBINATORIAL OPERATIONS ON THE DATA STRUCTURE
+  //------------------------------------------------------------------
+
+  // getting the degree of a vertex
+  inline
+  typename Data_structure::size_type degree(const Vertex_handle& v) const {
+    return this->_tds.degree(v);
+  }
+
+  // getting the symmetric edge
+  inline Edge sym_edge(const Edge e) const {
+    return sym_edge(e.first, e.second);
+  }
+
+  inline Edge sym_edge(const Face_handle& f, int i) const {
+    Face_handle f_sym = f->neighbor(i);
+#ifdef CGAL_SDG_ALTERNATE_SYMEDGE_IMPLEMENTATION_BY_AF
+    int count = ( f_sym->neighbor(0) == f );
+    int i_sym = 0;
+    if ( f_sym->neighbor(1) == f ) {
+      ++count;
+      i_sym = 1;
+    }
+    if ( f_sym->neighbor(2) == f ) {
+      ++count;
+      i_sym = 2;
+    }
+    if ( count == 1 ) {
+      return Edge(f_sym, i_sym);
+    }
+    return Edge(f_sym, f_sym->index( f->vertex(i) ));
+#else
+    return Edge(  f_sym, f_sym->index( this->_tds.mirror_vertex(f, i) )  );
+#endif
+  }
+
+  Edge flip(Face_handle& f, int i) {
+    CGAL_precondition ( f != Face_handle() );
+    CGAL_precondition (i == 0 || i == 1 || i == 2);
+    CGAL_precondition( this->dimension()==2 ); 
+
+    CGAL_precondition( f->vertex(i) != this->_tds.mirror_vertex(f, i) );
+
+    this->_tds.flip(f, i);
+
+    return Edge(f, ccw(i));
+  }
+
+  inline Edge flip(Edge e) {
+    return flip(e.first, e.second);
+  }
+
+  inline bool is_degree_2(const Vertex_handle& v) const {
+    Face_circulator fc = incident_faces(v);
+    Face_circulator fc1 = fc;
+    ++(++fc1);
+    return ( fc == fc1 );
+  }
+
+  inline Vertex_handle insert_degree_2(Edge e) {
+    return this->_tds.insert_degree_2(e.first,e.second);
+  }
+
+  inline Vertex_handle insert_degree_2(Edge e, const Storage_site_2& ss) {
+    Vertex_handle v = insert_degree_2(e);
+    v->set_site(ss);
+    return v;
+  }
+
+  inline void remove_degree_2(Vertex_handle v) {
+    CGAL_precondition( is_degree_2(v) );
+    this->_tds.remove_degree_2(v);
+  }
+
+  inline void remove_degree_3(Vertex_handle v) {
+    CGAL_precondition( degree(v) == 3 );
+    this->_tds.remove_degree_3(v, Face_handle());
+  }
+
+  inline Vertex_handle create_vertex(const Storage_site_2& ss) {
+    Vertex_handle v = this->_tds.create_vertex();
+    v->set_site(ss);
+    return v;
+  }
+
+  inline Vertex_handle create_vertex_dim_up(const Storage_site_2& ss) {
+    Vertex_handle v = this->_tds.insert_dim_up(infinite_vertex());
+    v->set_site(ss);
+    return v;
+  }
+
+protected:
+  // HELPER METHODS FOR CREATING STORAGE SITES
+  //------------------------------------------
+  inline
+  Storage_site_2 split_storage_site(const Storage_site_2& ss0,
+				    const Storage_site_2& ss1,
+				    bool first)
+  {
+    // Split the first storage site which is a segment using the
+    // second storage site which is an exact point
+    // i denotes whether the first or second half is to be created
+    CGAL_precondition( ss0.is_segment() && ss1.is_point() );
+
+    return st_.construct_storage_site_2_object()(ss0, ss1, first);
+  }
+
+public:
+  // METHODS FOR ACCESSING THE PRIMAL GRAPH
+  //---------------------------------------
+  // used primarily for visualization
+  inline Point_2 primal(const Face_handle& f) const {
+    return circumcenter(f);
+  }
+
+  Object primal(const Edge e) const;
+
+  inline Object primal(const Edge_circulator& ec) const {
+    return primal(*ec); 
+  }
+
+  inline Object primal(const Finite_edges_iterator& ei) const {
+    return primal(*ei);
+  }
+
+protected:
+  void print_error_message() const;
+
+  void print_error_message(const Tag_false&) const
+  {
+    static int i = 0;
+
+    if ( i == 0 ) {
+      i++;
+      std::cerr << "SDG::Insert aborted: intersecting segments found"
+		<< std::endl;
+    }
+  }
+
+  void print_error_message(const Tag_true&) const {}
+
+  //protected:
+public:
+  // wrappers for constructions
+  inline Point_2 circumcenter(const Face_handle& f) const {
+    CGAL_precondition( this->dimension()==2 || !is_infinite(f) );
+    return circumcenter(f->vertex(0)->site(),
+			f->vertex(1)->site(),
+			f->vertex(2)->site());
+  }
+
+  inline Point_2 circumcenter(const Site_2& t0, const Site_2& t1, 
+			      const Site_2& t2) const {
+    return
+    geom_traits().construct_svd_vertex_2_object()(t0, t1, t2);
+  }
+
+protected:
+  // HELPER METHODS FOR INSERTION
+  //-----------------------------
+  void initialize_conflict_region(const Face_handle& f, List& l);
+
+  std::pair<Face_handle,Face_handle>
+  find_faces_to_split(const Vertex_handle& v, const Site_2& t) const;
+
+  void expand_conflict_region(const Face_handle& f, const Site_2& t,
+			      const Storage_site_2& ss,
+#ifdef CGAL_SDG_NO_FACE_MAP
+			      List& l,
+#else
+			      List& l, Face_map& fm,
+			      std::map<Face_handle,Sign>& sign_map,
+#endif
+			      Triple<bool, Vertex_handle,
+			      Arrangement_type>& vcross);
+
+  Vertex_handle add_bogus_vertex(Edge e, List& l);
+  Vertex_list   add_bogus_vertices(List& l);
+  void          remove_bogus_vertices(Vertex_list& vl);
+
+#ifdef CGAL_SDG_NO_FACE_MAP
+  void retriangulate_conflict_region(Vertex_handle v, List& l);
+#else
+  void retriangulate_conflict_region(Vertex_handle v, List& l,
+				     Face_map& fm);
+#endif
+
+
+// choosing the correct bisector constructors
+private:
+  template <typename T, typename Tag_has_bisector_constructions>
+  struct ConstructionHelper {};
+
+  // take constructors from L2
+  template <typename T>
+  struct ConstructionHelper<T, Tag_false>
+  {
+    typedef CGAL_SEGMENT_DELAUNAY_GRAPH_2_NS::
+              Construct_sdg_bisector_2<Gt,
+                Integral_domain_without_division_tag>
+            tagbis;
+    typedef CGAL_SEGMENT_DELAUNAY_GRAPH_2_NS::
+              Construct_sdg_bisector_ray_2<Gt,
+                Integral_domain_without_division_tag>
+            tagbisray;
+    typedef CGAL_SEGMENT_DELAUNAY_GRAPH_2_NS::
+              Construct_sdg_bisector_segment_2<Gt,
+                Integral_domain_without_division_tag>
+            tagbisseg;
+  };
+
+  // constructors from traits
+  template <typename T>
+  struct ConstructionHelper<T, Tag_true>
+  {
+    typedef
+            typename T:: template Construct_sdg_bisector_2
+              <Gt, Integral_domain_without_division_tag>
+            tagbis;
+    typedef
+            typename T:: template Construct_sdg_bisector_ray_2
+              <Gt, Integral_domain_without_division_tag>
+            tagbisray;
+    typedef
+            typename T:: template Construct_sdg_bisector_segment_2
+              <Gt, Integral_domain_without_division_tag>
+            tagbisseg;
+  };
+
+  template <typename T>
+  struct ConstructionChooser
+  {
+    typedef typename ConstructionHelper<T, typename T::Tag_has_bisector_constructions>::tagbis tagbis;
+    typedef typename ConstructionHelper<T, typename T::Tag_has_bisector_constructions>::tagbisray tagbisray;
+    typedef typename ConstructionHelper<T, typename T::Tag_has_bisector_constructions>::tagbisseg tagbisseg;
+  };
+
+
+protected:
+  // TYPES AND ACCESS METHODS FOR VISUALIZATION
+  //-------------------------------------------
+
+  // types
+  typedef
+  CGAL_SEGMENT_DELAUNAY_GRAPH_2_NS::Construct_sdg_circle_2<Gt,Integral_domain_without_division_tag>
+  Construct_sdg_circle_2;
+
+  typedef typename
+          ConstructionChooser<Geom_traits>::tagbis
+          Construct_sdg_bisector_2;
+  typedef typename
+          ConstructionChooser<Geom_traits>::tagbisray
+          Construct_sdg_bisector_ray_2;
+  typedef typename
+          ConstructionChooser<Geom_traits>::tagbisseg
+          Construct_sdg_bisector_segment_2;
+
+  // access
+  inline Construct_sdg_circle_2
+  construct_sdg_circle_2_object() const{
+    return Construct_sdg_circle_2();
+  }
+
+  inline Construct_sdg_bisector_2
+  construct_sdg_bisector_2_object() const {
+    return Construct_sdg_bisector_2();
+  }
+
+  inline Construct_sdg_bisector_ray_2
+  construct_sdg_bisector_ray_2_object() const {
+    return Construct_sdg_bisector_ray_2();
+  }
+
+  inline Construct_sdg_bisector_segment_2
+  construct_sdg_bisector_segment_2_object() const { 
+    return Construct_sdg_bisector_segment_2(); 
+  }
+
+protected:
+  // WRAPPERS FOR GEOMETRIC PREDICATES
+  //----------------------------------
+  inline
+  bool same_points(const Storage_site_2& p, const Storage_site_2& q) const {
+    return geom_traits().equal_2_object()(p.site(), q.site());
+  }
+
+  inline
+  bool same_segments(const Storage_site_2& t, Vertex_handle v) const {
+    if ( is_infinite(v) ) { return false; }
+    if ( t.is_point() || v->storage_site().is_point() ) { return false; }
+    return same_segments(t.site(), v->site());
+  }
+
+  inline
+  bool is_endpoint_of_segment(const Storage_site_2& p,
+			      const Storage_site_2& s) const
+  {
+    CGAL_precondition( p.is_point() && s.is_segment() );
+    return ( same_points(p, s.source_site()) ||
+	     same_points(p, s.target_site()) );
+  }
+
+  inline
+  bool is_degenerate_segment(const Storage_site_2& s) const {
+    CGAL_precondition( s.is_segment() );
+    return same_points(s.source_site(), s.target_site());
+  }
+
+  // returns:
+  //   ON_POSITIVE_SIDE if q is closer to t1
+  //   ON_NEGATIVE_SIDE if q is closer to t2
+  //   ON_ORIENTED_BOUNDARY if q is on the bisector of t1 and t2
+  inline
+  Oriented_side side_of_bisector(const Storage_site_2 &t1,
+				 const Storage_site_2 &t2,
+				 const Storage_site_2 &q) const {
+    return
+      geom_traits().oriented_side_of_bisector_2_object()(t1.site(),
+							 t2.site(),
+							 q.site());
+  }
+
+  inline
+  Sign incircle(const Storage_site_2 &t1, const Storage_site_2 &t2,
+		const Storage_site_2 &t3, const Storage_site_2 &q) const {
+#ifdef CGAL_PROFILE_SDG_DUMP_INCIRCLE
+    typedef typename Geom_traits::FT  FT;
+    if ( !Algebraic_structure_traits<FT>::Is_exact::value ) {
+      std::ofstream ofs("incircle.cin", std::ios_base::app);
+      ofs.precision(16);
+      ofs << t1.site() << " ";
+      ofs << t2.site() << " ";
+      ofs << t3.site() << " ";
+      ofs <<  q.site() << std::endl;
+      ofs.close();
+    }
+#endif
+    return geom_traits().vertex_conflict_2_object()(t1.site(),
+						    t2.site(),
+						    t3.site(),
+						    q.site());
+  }
+
+  inline
+  Sign incircle(const Storage_site_2 &t1, const Storage_site_2 &t2,
+		const Storage_site_2 &q) const {
+    return geom_traits().vertex_conflict_2_object()(t1.site(),
+						    t2.site(),
+						    q.site());
+  }
+
+  inline
+  Sign incircle(const Face_handle& f, const Storage_site_2& q) const {
+    return incircle(f, q.site());
+  }
+
+  inline
+  bool finite_edge_interior(const Storage_site_2& t1,
+			    const Storage_site_2& t2,
+			    const Storage_site_2& t3,
+			    const Storage_site_2& t4,
+			    const Storage_site_2& q, Sign sgn) const {
+    return
+      geom_traits().finite_edge_interior_conflict_2_object()
+      (t1.site(), t2.site(), t3.site(), t4.site(), q.site(), sgn);
+  }
+
+  inline
+  bool finite_edge_interior(const Face_handle& f, int i,
+			    const Storage_site_2& q, Sign sgn) const {
+    CGAL_precondition( !is_infinite(f) &&
+		       !is_infinite(f->neighbor(i)) );
+    return finite_edge_interior( f->vertex( ccw(i) )->site(),
+				 f->vertex(  cw(i) )->site(),
+				 f->vertex(     i  )->site(),
+				 this->_tds.mirror_vertex(f, i)->site(),
+				 q.site(), sgn);
+  }
+
+  inline
+  bool finite_edge_interior(const Storage_site_2& t1,
+			    const Storage_site_2& t2,
+			    const Storage_site_2& t3,
+			    const Storage_site_2& q,
+			    Sign sgn) const {
+    return geom_traits().finite_edge_interior_conflict_2_object()(t1.site(),
+								  t2.site(),
+								  t3.site(),
+								  q.site(),
+								  sgn);
+  }
+
+  inline
+  bool finite_edge_interior(const Storage_site_2& t1,
+			    const Storage_site_2& t2,
+			    const Storage_site_2& q,
+			    Sign sgn) const {
+    return
+      geom_traits().finite_edge_interior_conflict_2_object()(t1.site(),
+							     t2.site(),
+							     q.site(),
+							     sgn);
+  }
+
+  bool finite_edge_interior(const Face_handle& f, int i,
+			    const Storage_site_2& p, Sign sgn,
+			    int j) const {
+    return finite_edge_interior(f, i, p.site(), sgn, j);
+  }
+
+  inline
+  bool infinite_edge_interior(const Storage_site_2& t2,
+			      const Storage_site_2& t3,
+			      const Storage_site_2& t4,
+			      const Storage_site_2& q, Sign sgn) const {
+    return
+      geom_traits().infinite_edge_interior_conflict_2_object()
+      (t2.site(), t3.site(), t4.site(), q.site(), sgn);
+  }
+
+  inline
+  bool infinite_edge_interior(const Face_handle& f, int i,
+			      const Storage_site_2& q, Sign sgn) const
+  {
+    return infinite_edge_interior(f, i, q, sgn);
+  }
+
+  inline
+  bool edge_interior(const Face_handle& f, int i,
+		     const Storage_site_2& t, Sign sgn) const {
+    return edge_interior(f, i, t.site(), sgn);
+  }
+
+  inline
+  bool edge_interior(const Edge& e,
+		     const Storage_site_2& t, Sign sgn) const {
+    return edge_interior(e.first, e.second, t, sgn);
+  }
+
+  inline Arrangement_type
+  arrangement_type(const Storage_site_2& t, const Vertex_handle& v) const {
+    if ( is_infinite(v) ) { return AT2::DISJOINT; }
+    return arrangement_type(t, v->storage_site());
+  }
+
+  inline
+  Arrangement_type arrangement_type(const Storage_site_2& p,
+				    const Storage_site_2& q) const {
+    return arrangement_type(p.site(), q.site());
+  }
+
+  inline
+  bool are_parallel(const Storage_site_2& p, const Storage_site_2& q) const {
+    return geom_traits().are_parallel_2_object()(p.site(), q.site());
+  }
+
+  inline Oriented_side
+  oriented_side(const Storage_site_2& s1, const Storage_site_2& s2,
+                const Storage_site_2& supp,
+		const Storage_site_2& p) const
+  {
+    CGAL_precondition( supp.is_segment() && p.is_point() );
+    return
+      geom_traits().oriented_side_2_object()(
+          s1.site(), s2.site(), supp.site(), p.site());
+  }
+
+  inline Oriented_side
+  oriented_side(const Storage_site_2& s1, const Storage_site_2& s2,
+		const Storage_site_2& s3, const Storage_site_2& supp,
+		const Storage_site_2& p) const {
+    CGAL_precondition( supp.is_segment() && p.is_point() );
+    return geom_traits().oriented_side_2_object()(s1.site(),
+						  s2.site(),
+						  s3.site(),
+						  supp.site(), p.site());
+  }
+
+
+  //-------
+
+  inline
+  bool same_points(const Site_2& p, const Site_2& q) const {
+    return geom_traits().equal_2_object()(p, q);
+  }
+
+  inline
+  bool same_segments(const Site_2& t, Vertex_handle v) const {
+    if ( is_infinite(v) ) { return false; }
+    if ( t.is_point() || v->site().is_point() ) { return false; }
+    return same_segments(t, v->site());
+  }
+
+  inline
+  bool same_segments(const Site_2& p, const Site_2& q) const {
+    CGAL_precondition( p.is_segment() && q.is_segment() );
+
+    return
+      (same_points(p.source_site(), q.source_site()) &&
+       same_points(p.target_site(), q.target_site())) ||
+      (same_points(p.source_site(), q.target_site()) &&
+       same_points(p.target_site(), q.source_site()));
+  }
+
+  inline
+  bool is_endpoint_of_segment(const Site_2& p, const Site_2& s) const
+  {
+    CGAL_precondition( p.is_point() && s.is_segment() );
+    return ( same_points(p, s.source_site()) ||
+	     same_points(p, s.target_site()) );
+  }
+
+  inline
+  bool is_degenerate_segment(const Site_2& s) const {
+    CGAL_precondition( s.is_segment() );
+    return same_points(s.source_site(), s.target_site());
+  }
+
+  // returns:
+  //   ON_POSITIVE_SIDE if q is closer to t1
+  //   ON_NEGATIVE_SIDE if q is closer to t2
+  //   ON_ORIENTED_BOUNDARY if q is on the bisector of t1 and t2
+  inline
+  Oriented_side side_of_bisector(const Site_2 &t1, const Site_2 &t2,
+				 const Site_2 &q) const {
+    return geom_traits().oriented_side_of_bisector_2_object()(t1, t2, q);
+  }
+
+  inline
+  Sign incircle(const Site_2 &t1, const Site_2 &t2,
+		const Site_2 &t3, const Site_2 &q) const {
+#ifdef CGAL_PROFILE_SDG_DUMP_INCIRCLE
+    typedef typename Geom_traits::FT  FT;
+    if ( !Algebraic_structure_traits<FT>::Is_exact::value ) {
+      std::ofstream ofs("incircle.cin", std::ios_base::app);
+      ofs.precision(16);
+      ofs << t1 << " ";
+      ofs << t2 << " ";
+      ofs << t3 << " ";
+      ofs <<  q << std::endl;
+      ofs.close();
+    }
+#endif
+    return geom_traits().vertex_conflict_2_object()(t1, t2, t3, q);
+  }
+
+  inline
+  Sign incircle(const Site_2 &t1, const Site_2 &t2,
+		const Site_2 &q) const {
+    return geom_traits().vertex_conflict_2_object()(t1, t2, q);
+  }
+
+  inline
+  Sign incircle(const Face_handle& f, const Site_2& q) const;
+
+  inline
+  Sign incircle(const Vertex_handle& v0, const Vertex_handle& v1,
+		const Vertex_handle& v) const {
+    CGAL_precondition( !is_infinite(v0) && !is_infinite(v1)
+		       && !is_infinite(v) );
+
+    return incircle( v0->site(), v1->site(), v->site());
+  }
+
+  Sign incircle(const Vertex_handle& v0, const Vertex_handle& v1,
+		const Vertex_handle& v2, const Vertex_handle& v) const;
+
+  inline
+  bool finite_edge_interior(const Site_2& t1, const Site_2& t2,
+			    const Site_2& t3, const Site_2& t4,
+			    const Site_2& q,  Sign sgn) const {
+    return
+      geom_traits().finite_edge_interior_conflict_2_object()
+      (t1,t2,t3,t4,q,sgn);
+  }
+
+  inline
+  bool finite_edge_interior(const Face_handle& f, int i,
+			    const Site_2& q, Sign sgn) const {
+    CGAL_precondition( !is_infinite(f) &&
+		       !is_infinite(f->neighbor(i)) );
+    return finite_edge_interior( f->vertex( ccw(i) )->site(),
+				 f->vertex(  cw(i) )->site(),
+				 f->vertex(     i  )->site(),
+				 this->_tds.mirror_vertex(f, i)->site(),
+				 q, sgn);
+  }
+
+  inline
+  bool finite_edge_interior(const Vertex_handle& v1, const Vertex_handle& v2,
+			    const Vertex_handle& v3, const Vertex_handle& v4,
+			    const Vertex_handle& v, Sign sgn) const {
+    CGAL_precondition( !is_infinite(v1) && !is_infinite(v2) &&
+		       !is_infinite(v3) && !is_infinite(v4) &&
+		       !is_infinite(v) );
+    return finite_edge_interior( v1->site(), v2->site(),
+				 v3->site(), v4->site(),
+				 v->site(), sgn);
+  }
+
+  inline
+  bool finite_edge_interior(const Site_2& t1, const Site_2& t2,
+			    const Site_2& t3, const Site_2& q,
+			    Sign sgn) const {
+    return
+    geom_traits().finite_edge_interior_conflict_2_object()(t1,t2,t3,q,sgn);
+  }
+
+  inline
+  bool finite_edge_interior(const Site_2& t1, const Site_2& t2,
+			    const Site_2& q,  Sign sgn) const {
+    return
+    geom_traits().finite_edge_interior_conflict_2_object()(t1,t2,q,sgn);
+  }
+
+  bool finite_edge_interior(const Face_handle& f, int i,
+			    const Site_2& p, Sign sgn, int) const;
+
+  bool finite_edge_interior(const Vertex_handle& v1, const Vertex_handle& v2,
+			    const Vertex_handle& v3, const Vertex_handle& v4,
+			    const Vertex_handle& v, Sign, int) const;
+
+  inline
+  bool infinite_edge_interior(const Site_2& t2, const Site_2& t3,
+			      const Site_2& t4, const Site_2& q,
+			      Sign sgn) const {
+    return
+      geom_traits().infinite_edge_interior_conflict_2_object()
+      (t2,t3,t4,q,sgn);
+  }
+
+
+  bool infinite_edge_interior(const Face_handle& f, int i,
+			      const Site_2& q, Sign sgn) const;
+
+  bool infinite_edge_interior(const Vertex_handle& v1,
+			      const Vertex_handle& v2,
+			      const Vertex_handle& v3,
+			      const Vertex_handle& v4,
+			      const Vertex_handle& v,
+			      Sign sgn) const;
+
+  bool edge_interior(const Face_handle& f, int i,
+		     const Site_2& t, Sign sgn) const;
+
+  bool edge_interior(const Edge& e,
+		     const Site_2& t, Sign sgn) const {
+    return edge_interior(e.first, e.second, t, sgn);
+  }
+
+  bool edge_interior(const Vertex_handle& v1,
+		     const Vertex_handle& v2,
+		     const Vertex_handle& v3,
+		     const Vertex_handle& v4,
+		     const Vertex_handle& v,
+		     Sign sgn) const;
+
+  inline Arrangement_type
+  arrangement_type(const Site_2& t, const Vertex_handle& v) const {
+    if ( is_infinite(v) ) { return AT2::DISJOINT; }
+    return arrangement_type(t, v->site());
+  }
+
+  Arrangement_type arrangement_type(const Site_2& p, const Site_2& q) const;
+
+  inline
+  bool are_parallel(const Site_2& p, const Site_2& q) const {
+    return geom_traits().are_parallel_2_object()(p, q);
+  }
+
+  inline Oriented_side
+  oriented_side(const Site_2& s1, const Site_2&s2,
+                const Site_2& supp, const Site_2& p) const
+  {
+    CGAL_precondition( supp.is_segment() && p.is_point() );
+    return geom_traits().oriented_side_2_object()(s1, s2, supp, p);
+  }
+
+  inline Oriented_side
+  oriented_side(const Site_2& s1, const Site_2& s2, const Site_2& s3,
+		const Site_2& supp, const Site_2& p) const {
+    CGAL_precondition( supp.is_segment() && p.is_point() );
+    return geom_traits().oriented_side_2_object()(s1, s2, s3, supp, p);
+  }
+
+  bool is_degenerate_edge(const Site_2& p1,
+			  const Site_2& p2,
+			  const Site_2& p3,
+			  const Site_2& p4) const {
+    return geom_traits().is_degenerate_edge_2_object()
+      (p1, p2, p3, p4);
+  }
+
+  bool is_degenerate_edge(const Vertex_handle& v1,
+			  const Vertex_handle& v2,
+			  const Vertex_handle& v3,
+			  const Vertex_handle& v4) const {
+    CGAL_precondition( !is_infinite(v1) && !is_infinite(v2) &&
+		       !is_infinite(v3) && !is_infinite(v4) );
+
+    return is_degenerate_edge(v1->site(), v2->site(),
+			      v3->site(), v4->site());
+  }
+
+  bool is_degenerate_edge(const Face_handle& f, int i) const {
+    Vertex_handle v1 = f->vertex( ccw(i) );
+    Vertex_handle v2 = f->vertex(  cw(i) );
+    Vertex_handle v3 = f->vertex(     i  );
+    Vertex_handle v4 = this->_tds.mirror_vertex(f, i);
+
+    return is_degenerate_edge(v1, v2, v3, v4);
+  }
+
+  bool is_degenerate_edge(const Edge& e) const {
+    return is_degenerate_edge(e.first, e.second);
+  }
+
+  Vertex_handle first_endpoint_of_segment(const Vertex_handle& v) const;
+  Vertex_handle second_endpoint_of_segment(const Vertex_handle& v) const;
+
+}; // Segment_Delaunay_graph_2
+
+
+template<class Gt, class D_S, class LTag>
+std::istream& operator>>(std::istream& is,
+			 Segment_Delaunay_graph_2<Gt,D_S,LTag>& sdg)
+{
+  sdg.file_input(is);
+  return is;
+}
+
+template<class Gt, class D_S, class LTag>
+std::ostream& operator<<(std::ostream& os,
+			 const Segment_Delaunay_graph_2<Gt,D_S,LTag>& sdg)
+{
+  sdg.file_output(os);
+  return os;
+}
+
+} //namespace CGAL
+
+
+#include <CGAL/Segment_Delaunay_graph_2/Segment_Delaunay_graph_2_impl.h>
+
+
+#endif // CGAL_SEGMENT_DELAUNAY_GRAPH_2_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Are_parallel_C2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Are_parallel_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Are_parallel_C2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Are_parallel_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Are_same_points_C2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Are_same_points_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Are_same_points_C2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Are_same_points_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Are_same_segments_C2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Are_same_segments_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Are_same_segments_C2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Are_same_segments_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Arrangement_enum.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Arrangement_enum.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Arrangement_enum.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Arrangement_enum.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Arrangement_type_C2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Arrangement_type_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Arrangement_type_C2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Arrangement_type_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Arrangement_type_non_intersecting_C2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Arrangement_type_non_intersecting_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Arrangement_type_non_intersecting_C2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Arrangement_type_non_intersecting_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Basic_predicates_C2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Basic_predicates_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Basic_predicates_C2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Basic_predicates_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Cartesian_converter.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Cartesian_converter.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Cartesian_converter.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Cartesian_converter.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Compare_x_2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Compare_x_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Compare_x_2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Compare_x_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Compare_y_2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Compare_y_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Compare_y_2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Compare_y_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Construct_storage_site_2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Construct_storage_site_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Construct_storage_site_2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Construct_storage_site_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Construct_storage_site_with_info_2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Construct_storage_site_with_info_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Construct_storage_site_with_info_2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Construct_storage_site_with_info_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Constructions_C2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Constructions_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Constructions_C2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Constructions_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Filtered_traits_base_2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Filtered_traits_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Filtered_traits_base_2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Filtered_traits_base_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Filtered_traits_concept_check_tags.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Filtered_traits_concept_check_tags.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Filtered_traits_concept_check_tags.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Filtered_traits_concept_check_tags.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Finite_edge_interior_conflict_C2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Finite_edge_interior_conflict_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Finite_edge_interior_conflict_C2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Finite_edge_interior_conflict_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Infinite_edge_interior_conflict_C2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Infinite_edge_interior_conflict_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Infinite_edge_interior_conflict_C2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Infinite_edge_interior_conflict_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Is_degenerate_edge_C2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Is_degenerate_edge_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Is_degenerate_edge_C2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Is_degenerate_edge_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Kernel_wrapper_2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Kernel_wrapper_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Kernel_wrapper_2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Kernel_wrapper_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Orientation_C2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Orientation_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Orientation_C2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Orientation_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Oriented_side_C2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Oriented_side_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Oriented_side_C2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Oriented_side_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Oriented_side_of_bisector_C2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Oriented_side_of_bisector_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Oriented_side_of_bisector_C2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Oriented_side_of_bisector_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Predicates_C2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Predicates_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Predicates_C2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Predicates_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Segment_Delaunay_graph_2_impl.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Segment_Delaunay_graph_2_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Segment_Delaunay_graph_2_impl.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Segment_Delaunay_graph_2_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Segment_Delaunay_graph_hierarchy_2_impl.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Segment_Delaunay_graph_hierarchy_2_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Segment_Delaunay_graph_hierarchy_2_impl.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Segment_Delaunay_graph_hierarchy_2_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Sqrt_extension_2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Sqrt_extension_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Sqrt_extension_2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Sqrt_extension_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Traits_base_2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Traits_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Traits_base_2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Traits_base_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Traits_wrapper_2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Traits_wrapper_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Traits_wrapper_2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Traits_wrapper_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Triangulation_face_base_with_edges_2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Triangulation_face_base_with_edges_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Triangulation_face_base_with_edges_2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Triangulation_face_base_with_edges_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Vertex_conflict_C2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Vertex_conflict_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Vertex_conflict_C2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Vertex_conflict_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Voronoi_vertex_C2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Voronoi_vertex_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Voronoi_vertex_C2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Voronoi_vertex_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Voronoi_vertex_ring_C2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Voronoi_vertex_ring_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Voronoi_vertex_ring_C2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Voronoi_vertex_ring_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Voronoi_vertex_sqrt_field_C2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Voronoi_vertex_sqrt_field_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Voronoi_vertex_sqrt_field_C2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Voronoi_vertex_sqrt_field_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Voronoi_vertex_sqrt_field_new_C2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Voronoi_vertex_sqrt_field_new_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/Voronoi_vertex_sqrt_field_new_C2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/Voronoi_vertex_sqrt_field_new_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/basic.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/basic.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/basic.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/basic.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/edge_list.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/edge_list.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/edge_list.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/edge_list.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/in_place_edge_list.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/in_place_edge_list.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_2/in_place_edge_list.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_2/in_place_edge_list.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_2/Basic_predicates_C2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_2/Basic_predicates_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_2/Basic_predicates_C2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_2/Basic_predicates_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_2/Bisector_Linf.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_2/Bisector_Linf.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_2/Bisector_Linf.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_2/Bisector_Linf.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_2/Constructions_C2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_2/Constructions_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_2/Constructions_C2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_2/Constructions_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_2/Filtered_traits_base_2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_2/Filtered_traits_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_2/Filtered_traits_base_2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_2/Filtered_traits_base_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_2/Finite_edge_interior_conflict_C2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_2/Finite_edge_interior_conflict_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_2/Finite_edge_interior_conflict_C2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_2/Finite_edge_interior_conflict_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_2/Infinite_edge_interior_conflict_C2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_2/Infinite_edge_interior_conflict_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_2/Infinite_edge_interior_conflict_C2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_2/Infinite_edge_interior_conflict_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_2/Orientation_Linf_C2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_2/Orientation_Linf_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_2/Orientation_Linf_C2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_2/Orientation_Linf_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_2/Oriented_side_C2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_2/Oriented_side_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_2/Oriented_side_C2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_2/Oriented_side_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_2/Oriented_side_of_bisector_C2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_2/Oriented_side_of_bisector_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_2/Oriented_side_of_bisector_C2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_2/Oriented_side_of_bisector_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_2/Predicates_C2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_2/Predicates_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_2/Predicates_C2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_2/Predicates_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_2/Segment_Delaunay_graph_Linf_2_impl.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_2/Segment_Delaunay_graph_Linf_2_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_2/Segment_Delaunay_graph_Linf_2_impl.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_2/Segment_Delaunay_graph_Linf_2_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_2/Segment_Delaunay_graph_Linf_hierarchy_2_impl.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_2/Segment_Delaunay_graph_Linf_hierarchy_2_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_2/Segment_Delaunay_graph_Linf_hierarchy_2_impl.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_2/Segment_Delaunay_graph_Linf_hierarchy_2_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_2/Traits_base_2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_2/Traits_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_2/Traits_base_2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_2/Traits_base_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_2/Vertex_conflict_C2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_2/Vertex_conflict_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_2/Vertex_conflict_C2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_2/Vertex_conflict_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_2/Voronoi_vertex_C2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_2/Voronoi_vertex_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_2/Voronoi_vertex_C2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_2/Voronoi_vertex_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_2/Voronoi_vertex_ring_C2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_2/Voronoi_vertex_ring_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_2/Voronoi_vertex_ring_C2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_2/Voronoi_vertex_ring_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_2/Voronoi_vertex_sqrt_field_new_C2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_2/Voronoi_vertex_sqrt_field_new_C2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_2/Voronoi_vertex_sqrt_field_new_C2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_2/Voronoi_vertex_sqrt_field_new_C2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_2/basic.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_2/basic.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_2/basic.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_2/basic.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_filtered_traits_2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_filtered_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_filtered_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_filtered_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_hierarchy_2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_hierarchy_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_hierarchy_2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_hierarchy_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_traits_2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_Linf_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_Linf_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_adaptation_policies_2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_adaptation_policies_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_adaptation_policies_2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_adaptation_policies_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_adaptation_traits_2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_adaptation_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_adaptation_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_adaptation_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_face_base_2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_face_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_face_base_2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_face_base_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_filtered_traits_2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_filtered_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_filtered_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_filtered_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_hierarchy_2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_hierarchy_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_hierarchy_2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_hierarchy_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_hierarchy_vertex_base_2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_hierarchy_vertex_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_hierarchy_vertex_base_2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_hierarchy_vertex_base_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_simple_site_2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_simple_site_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_simple_site_2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_simple_site_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_simple_storage_site_2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_simple_storage_site_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_simple_storage_site_2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_simple_storage_site_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_site_2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_site_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_site_2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_site_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_storage_site_2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_storage_site_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_storage_site_2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_storage_site_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_storage_site_with_info_2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_storage_site_with_info_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_storage_site_with_info_2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_storage_site_with_info_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_storage_traits_2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_storage_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_storage_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_storage_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_storage_traits_with_info_2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_storage_traits_with_info_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_storage_traits_with_info_2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_storage_traits_with_info_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_traits_2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_vertex_base_2.h b/3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_vertex_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_Delaunay_graph_vertex_base_2.h
rename to 3rdparty/CGAL/include/CGAL/Segment_Delaunay_graph_vertex_base_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_tree_d.h b/3rdparty/CGAL/include/CGAL/Segment_tree_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_tree_d.h
rename to 3rdparty/CGAL/include/CGAL/Segment_tree_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Segment_tree_k.h b/3rdparty/CGAL/include/CGAL/Segment_tree_k.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Segment_tree_k.h
rename to 3rdparty/CGAL/include/CGAL/Segment_tree_k.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Shape_detection_3.h b/3rdparty/CGAL/include/CGAL/Shape_detection_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Shape_detection_3.h
rename to 3rdparty/CGAL/include/CGAL/Shape_detection_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Shape_detection_3/Cone.h b/3rdparty/CGAL/include/CGAL/Shape_detection_3/Cone.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Shape_detection_3/Cone.h
rename to 3rdparty/CGAL/include/CGAL/Shape_detection_3/Cone.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Shape_detection_3/Cylinder.h b/3rdparty/CGAL/include/CGAL/Shape_detection_3/Cylinder.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Shape_detection_3/Cylinder.h
rename to 3rdparty/CGAL/include/CGAL/Shape_detection_3/Cylinder.h
diff --git a/3rdparty/CGAL/include/CGAL/Shape_detection_3/Efficient_RANSAC.h b/3rdparty/CGAL/include/CGAL/Shape_detection_3/Efficient_RANSAC.h
new file mode 100644
index 0000000..61ccf58
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Shape_detection_3/Efficient_RANSAC.h
@@ -0,0 +1,932 @@
+// Copyright (c) 2015 INRIA Sophia-Antipolis (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
+// 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(s)     : Sven Oesau, Yannick Verdie, Clément Jamin, Pierre Alliez
+//
+
+#ifndef CGAL_SHAPE_DETECTION_3_EFFICIENT_RANSAC_H
+#define CGAL_SHAPE_DETECTION_3_EFFICIENT_RANSAC_H
+
+#include <CGAL/Shape_detection_3/Octree.h>
+#include <CGAL/Shape_detection_3/Shape_base.h>
+#include <CGAL/Random.h>
+
+//for octree ------------------------------
+#include <boost/iterator/filter_iterator.hpp>
+#include <CGAL/bounding_box.h>
+#include <CGAL/Iterator_range.h>
+//----------
+
+#include <vector>
+#include <cmath>
+#include <limits>
+#include <fstream>
+#include <sstream>
+
+//boost --------------
+#include <boost/iterator/counting_iterator.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/make_shared.hpp>
+//---------------------
+
+
+/*! 
+  \file Efficient_RANSAC.h
+*/
+
+namespace CGAL {
+  namespace Shape_detection_3 {
+
+/*!
+\ingroup PkgPointSetShapeDetection3
+\brief A shape detection algorithm using a RANSAC method.
+
+Given a point set in 3D space with unoriented normals, sampled on surfaces,
+this class enables to detect subsets of connected points lying on the surface of primitive shapes.
+Each input point is assigned to either none or at most one detected primitive
+shape. The implementation follows \cgalCite{schnabel2007efficient}.
+
+\tparam Traits a model of `EfficientRANSACTraits`
+
+*/
+  template <class Traits>
+  class Efficient_RANSAC {
+  public:
+
+    /// \cond SKIP_IN_MANUAL
+    struct Filter_unassigned_points {
+      Filter_unassigned_points() : m_shape_index(dummy) {}
+      Filter_unassigned_points(const std::vector<int> &shapeIndex)
+        : m_shape_index(shapeIndex) {}
+
+      bool operator()(std::size_t x) {
+        if (x < m_shape_index.size())
+          return m_shape_index[x] == -1;
+        else return true; // to prevent infinite incrementing
+      }
+      const std::vector<int>&  m_shape_index;
+      std::vector<int> dummy;
+    };
+
+    typedef boost::filter_iterator<Filter_unassigned_points,
+      boost::counting_iterator<std::size_t> > Point_index_iterator;
+    ///< iterator for indices of points.
+    /// \endcond
+
+    /// \name Types 
+    /// @{
+    /// \cond SKIP_IN_MANUAL
+    typedef typename Traits::Input_range::iterator Input_iterator;
+    typedef typename Traits::FT FT; ///< number type.
+    typedef typename Traits::Point_3 Point; ///< point type.
+    typedef typename Traits::Vector_3 Vector; ///< vector type.
+    /// \endcond
+
+    typedef typename Traits::Input_range Input_range;
+    ///< Model of the concept `Range` with random access iterators, providing input points and normals
+    /// through the following two property maps.
+
+    typedef typename Traits::Point_map Point_map;
+    ///< property map to access the location of an input point.
+    typedef typename Traits::Normal_map Normal_map;
+    ///< property map to access the unoriented normal of an input point
+    typedef Shape_base<Traits> Shape; ///< shape type.
+
+#ifdef DOXYGEN_RUNNING
+    typedef unspecified_type Shape_range;
+#else
+    struct Shape_range : public Iterator_range<
+      typename std::vector<boost::shared_ptr<Shape> >::const_iterator> {
+      typedef Iterator_range<
+        typename std::vector<boost::shared_ptr<Shape> >::const_iterator> Base;
+
+      Shape_range(boost::shared_ptr<std::vector<boost::shared_ptr<Shape> > >
+        extracted_shapes) : Base(make_range(extracted_shapes->begin(),
+        extracted_shapes->end())), m_extracted_shapes(extracted_shapes) {}
+    private:
+      boost::shared_ptr<std::vector<boost::shared_ptr<Shape> > >
+        m_extracted_shapes; // keeps a reference to the shape vector
+    };
+#endif
+    ///< An `Iterator_range` with a bidirectional constant iterator type with value type `boost::shared_ptr<Shape>`.
+
+
+#ifdef DOXYGEN_RUNNING
+    typedef unspecified_type Point_index_range;
+    ///< An `Iterator_range` with a bidirectional iterator with value type `std::size_t`
+    ///  as indices into the input data that has not been assigned to a shape.
+    ///  As this range class has no `size()` method, the method 
+    ///  `Efficient_RANSAC::number_of_unassigned_points()` is provided.
+#else 
+    typedef Iterator_range<Point_index_iterator>
+      Point_index_range;
+#endif     
+
+    /// @}
+    
+    /// \name Parameters 
+    /// @{
+      /*!
+       %Parameters for the shape detection algorithm. They are explained in detail 
+       in Section \ref Point_set_shape_detection_3Parameters  of the User Manual.
+       */
+    struct Parameters {
+      Parameters()
+        : probability((FT) 0.01)
+        , min_points((std::numeric_limits<std::size_t>::max)())
+        , epsilon(-1)
+        , normal_threshold((FT) 0.9)
+        , cluster_epsilon(-1)
+      {}
+
+      FT probability;         ///< Probability to control search endurance. %Default value: 5%.
+      std::size_t min_points; ///< Minimum number of points of a shape. %Default value: 1% of total number of input points.
+      FT epsilon;             ///< Maximum tolerance Euclidian distance from a point and a shape. %Default value: 1% of bounding box diagonal.
+      FT normal_threshold;	  ///< Maximum tolerance normal deviation from a point's normal to the normal on shape at projected point. %Default value: 0.9 (around 25 degrees).
+      FT cluster_epsilon;	    ///< Maximum distance between points to be considered connected. %Default value: 1% of bounding box diagonal.
+    };
+    /// @}
+
+  private:
+    typedef internal::Octree<internal::DirectPointAccessor<Traits> >
+      Direct_octree;
+    typedef internal::Octree<internal::IndexedPointAccessor<Traits> >
+      Indexed_octree;
+    //--------------------------------------------typedef
+
+    // Creates a function pointer for instancing shape instances.
+    template <class ShapeT>
+    static Shape *factory() {
+      return new ShapeT;
+    }
+
+  public:
+
+  /// \name Initialization
+  /// @{
+
+    /*! 
+      Constructs an empty shape detection engine.
+    */ 
+    Efficient_RANSAC(Traits t = Traits())
+      : m_traits(t)
+      , m_direct_octrees(NULL)
+      , m_global_octree(NULL)
+      , m_num_subsets(0)
+      , m_num_available_points(0)
+      , m_num_total_points(0)
+      , m_valid_iterators(false)
+    {}
+
+    /*! 
+      Releases all memory allocated by this instances including shapes.
+    */ 
+    ~Efficient_RANSAC() {
+      clear();
+    }
+
+    /*!
+      Retrieves the traits class.
+     */
+    const Traits&
+    traits() const
+    {
+      return m_traits;
+    }
+
+    /*!
+      Retrieves the point property map.
+    */
+    const Point_map& point_map() const { return m_point_pmap; }
+    
+    /*!
+      Retrieves the normal property map.
+    */
+    const Normal_map& normal() const { return m_normal_pmap; }
+
+
+    Input_iterator input_iterator_first() const
+    {
+      return m_input_iterator_first;
+    }
+    Input_iterator input_iterator_beyond() const
+    {
+      return m_input_iterator_beyond;
+    }
+
+    /*!
+      Sets the input data. The range must stay valid
+      until the detection has been performed and the access to the
+      results is no longer required. The data in the input is reordered by the methods
+      `detect()` and `preprocess()`. This function first calls `clear()`.
+    */
+    void set_input(
+      Input_range& input_range,
+      ///< range of input data.
+      Point_map point_map = Point_map(),
+      ///< property map to access the position of an input point.
+      Normal_map normal_map = Normal_map()
+      ///< property map to access the normal of an input point.
+      ) {
+        m_point_pmap = point_map;
+        m_normal_pmap = normal_map;
+
+        m_input_iterator_first = input_range.begin();
+        m_input_iterator_beyond = input_range.end();
+
+        clear();
+
+        m_extracted_shapes = 
+          boost::make_shared<std::vector<boost::shared_ptr<Shape> > >();
+
+        m_num_available_points = m_num_total_points = std::distance(
+          m_input_iterator_first, m_input_iterator_beyond);
+
+        m_valid_iterators = true;
+    }
+    /*!
+      Registers in the detection engine the shape type `ShapeType` that must inherit from `Shape_base`.
+      For example, for registering a plane as detectable shape you should call
+      `ransac.add_shape_factory< Shape_detection_3::Plane<Traits> >();`. Note
+      that if your call is within a template, you should add the `template`
+      keyword just before `add_shape_factory`: 
+      `ransac.template add_shape_factory< Shape_detection_3::Plane<Traits> >();`.
+    */ 
+    template <class Shape_type>
+    void add_shape_factory() {
+      m_shape_factories.push_back(factory<Shape_type>);
+    }
+
+    /*!
+      Constructs internal data structures required for the shape detection.
+      These structures only depend on the input data, i.e. the points and
+      normal vectors. This method is called by `detect()`, if it was not called
+      before by the user.
+    */ 
+    bool preprocess() {
+      if (m_num_total_points == 0)
+        return false;
+
+      // Generation of subsets
+      m_num_subsets = (std::size_t)(std::max<std::ptrdiff_t>)((std::ptrdiff_t)
+        std::floor(std::log(double(m_num_total_points))/std::log(2.))-9, 2);
+
+      // SUBSET GENERATION ->
+      // approach with increasing subset sizes -> replace with octree later on
+      Input_iterator last = m_input_iterator_beyond - 1;
+      std::size_t remainingPoints = m_num_total_points;
+
+      m_available_octree_sizes.resize(m_num_subsets);
+      m_direct_octrees = new Direct_octree *[m_num_subsets];
+      for (int s = int(m_num_subsets) - 1;s >= 0;--s) {
+        std::size_t subsetSize = remainingPoints;
+        std::vector<std::size_t> indices(subsetSize);
+        if (s) {
+          subsetSize >>= 1;
+          for (std::size_t i = 0;i<subsetSize;i++) {
+            std::size_t index = get_default_random()(2);
+            index = index + (i<<1);
+            index = (index >= remainingPoints) ? remainingPoints - 1 : index;
+            indices[i] = index;
+          }
+
+          // move points to the end of the point vector
+          std::size_t j = subsetSize;
+          do {
+            j--;
+            typename std::iterator_traits<Input_iterator>::value_type
+              tmp = (*last);
+            *last = m_input_iterator_first[indices[std::size_t(j)]];
+            m_input_iterator_first[indices[std::size_t(j)]] = tmp;
+            last--;
+          } while (j > 0);
+          m_direct_octrees[s] = new Direct_octree(
+            m_traits, last + 1,
+            last + subsetSize + 1,
+            m_point_pmap, m_normal_pmap,
+            remainingPoints - subsetSize);
+        }
+        else
+          m_direct_octrees[0] = new Direct_octree(
+            m_traits, m_input_iterator_first,
+            m_input_iterator_first + (subsetSize),
+            m_point_pmap, m_normal_pmap,
+          0);
+
+        m_available_octree_sizes[s] = subsetSize;
+        m_direct_octrees[s]->createTree();
+
+        remainingPoints -= subsetSize;
+      }
+
+      m_global_octree = new Indexed_octree(
+        m_traits, m_input_iterator_first, m_input_iterator_beyond,
+        m_point_pmap, m_normal_pmap);
+      m_global_octree->createTree();
+
+      return true;
+    }
+
+    /// @}
+
+    /// \name Memory Management
+    /// @{
+    /*!
+      Removes all shape types registered for detection.
+     */ 
+    void clear_shape_factories() {
+      m_shape_factories.clear();
+    }
+
+    /*!
+      Frees memory allocated for the internal search structures but keeps the detected shapes.
+      It invalidates the range retrieved using `unassigned_points()`.
+     */ 
+    void clear_octrees() {
+      // If there is no data yet, there are no data structures.
+      if (!m_valid_iterators)
+        return;
+
+      if (m_global_octree) {
+        delete m_global_octree;
+        m_global_octree = NULL;
+      }
+
+      if (m_direct_octrees) {
+        for (std::size_t i = 0;i<m_num_subsets;i++) 
+          delete m_direct_octrees[i];
+        delete [] m_direct_octrees;
+
+        m_direct_octrees = NULL;
+      }
+
+      m_num_subsets = 0;
+    }
+
+    /*!
+      Calls `clear_octrees()` and removes all detected shapes.
+      All internal structures are cleaned, including formerly detected shapes.
+      Thus iterators and ranges retrieved through `shapes()` and `indices_of_unassigned_points()` 
+      are invalidated.
+    */ 
+    void clear() {
+      // If there is no data yet, there are no data structures.
+      if (!m_valid_iterators)
+        return;
+
+      std::vector<int>().swap(m_shape_index);
+
+      m_extracted_shapes = 
+        boost::make_shared<std::vector<boost::shared_ptr<Shape> > >();
+      
+      m_num_available_points = m_num_total_points;
+
+      clear_octrees();
+    }
+    /// @}
+
+    /// \name Detection 
+    /// @{
+    /*! 
+      Performs the shape detection. Shape types considered during the detection
+      are those registered using `add_shape_factory()`.
+
+      \return `true` if shape types have been registered and
+              input data has been set. Otherwise, `false` is returned.
+    */ 
+    bool detect(
+      const Parameters &options = Parameters()
+      ///< %Parameters for shape detection.
+                ) {
+      // No shape types for detection or no points provided, exit
+      if (m_shape_factories.size() == 0 ||
+          (m_input_iterator_beyond - m_input_iterator_first) == 0)
+        return false;
+
+      if (m_num_subsets == 0 || m_global_octree == 0) {
+        if (!preprocess())
+          return false;
+      }
+
+      // Reset data structures possibly used by former search
+      m_extracted_shapes = 
+        boost::make_shared<std::vector<boost::shared_ptr<Shape> > >();
+      m_num_available_points = m_num_total_points;
+
+      for (std::size_t i = 0;i<m_num_subsets;i++) {
+        m_available_octree_sizes[i] = m_direct_octrees[i]->size();
+      }
+
+      // Use bounding box diagonal as reference for default values
+      Bbox_3 bbox = m_global_octree->boundingBox();
+      FT bbox_diagonal = (FT) CGAL::sqrt(
+          (bbox.xmax() - bbox.xmin()) * (bbox.xmax() - bbox.xmin())
+        + (bbox.ymax() - bbox.ymin()) * (bbox.ymax() - bbox.ymin()) 
+        + (bbox.zmax() - bbox.zmin()) * (bbox.zmax() - bbox.zmin()));
+
+      m_options = options;
+
+      // Epsilon or cluster_epsilon have been set by the user?
+      // If not, derive from bounding box diagonal
+      m_options.epsilon = (m_options.epsilon < 0)
+        ? bbox_diagonal * (FT) 0.01 : m_options.epsilon;
+
+      m_options.cluster_epsilon = (m_options.cluster_epsilon < 0) 
+        ? bbox_diagonal * (FT) 0.01 : m_options.cluster_epsilon;
+
+      // Minimum number of points has been set?
+      m_options.min_points = 
+        (m_options.min_points >= m_num_available_points) ? 
+          (std::size_t)((FT)0.01 * m_num_available_points) : 
+          m_options.min_points;
+      m_options.min_points = (m_options.min_points < 10) ? 10 : m_options.min_points;
+      
+      // Initializing the shape index
+      m_shape_index.assign(m_num_available_points, -1);
+
+      // List of all randomly drawn candidates
+      // with the minimum number of points
+      std::vector<Shape *> candidates;
+
+      // Identifying minimum number of samples
+      std::size_t required_samples = 0;
+      for (std::size_t i = 0;i<m_shape_factories.size();i++) {
+        Shape *tmp = (Shape *) m_shape_factories[i]();
+        required_samples = (std::max<std::size_t>)(required_samples, tmp->minimum_sample_size());
+        delete tmp;
+      }
+
+      std::size_t first_sample; // first sample for RANSAC
+
+      FT best_expected = 0;
+
+      // number of points that have been assigned to a shape
+      std::size_t num_invalid = 0;
+
+      std::size_t generated_candidates = 0;
+      std::size_t failed_candidates = 0;
+      bool force_exit = false;
+      bool keep_searching = true;
+      
+      do { // main loop
+        best_expected = 0;
+
+        if (keep_searching)
+          do {
+            // Generate candidates
+            //1. pick a point p1 randomly among available points
+            std::set<std::size_t> indices;
+            bool done = false;
+            do {
+              do 
+              first_sample = get_default_random()(m_num_available_points);
+              while (m_shape_index[first_sample] != -1);
+
+              done = m_global_octree->drawSamplesFromCellContainingPoint(
+                get(m_point_pmap, 
+                *(m_input_iterator_first + first_sample)),
+                select_random_octree_level(),
+                indices,
+                m_shape_index,
+                required_samples);
+
+            } while (m_shape_index[first_sample] != -1 || !done);
+
+            generated_candidates++;
+
+            //add candidate for each type of primitives
+            for(typename std::vector<Shape *(*)()>::iterator it =
+              m_shape_factories.begin(); it != m_shape_factories.end(); it++)	{
+                Shape *p = (Shape *) (*it)();
+                //compute the primitive and says if the candidate is valid
+                p->compute(indices,
+                  m_input_iterator_first,
+                  m_traits,
+                  m_point_pmap,
+                  m_normal_pmap,
+                  m_options.epsilon, 
+                  m_options.normal_threshold);
+
+                if (p->is_valid()) {
+                  improve_bound(p, m_num_available_points - num_invalid, 1, 500);
+
+                  //evaluate the candidate
+                  if(p->max_bound() >= m_options.min_points && p->score() > 0) {
+                    if (best_expected < p->expected_value())
+                      best_expected = p->expected_value();
+
+                    candidates.push_back(p);
+                  }
+                  else {
+                    failed_candidates++;
+                    delete p;
+                  }        
+                }
+                else {
+                  failed_candidates++;
+                  delete p;
+                }
+            }
+
+            if (failed_candidates >= 10000)
+              force_exit = true;
+            
+            keep_searching = (stop_probability(m_options.min_points,
+              m_num_available_points - num_invalid, 
+              generated_candidates, m_global_octree->maxLevel())
+                    > m_options.probability);
+        } while( !force_exit
+          && stop_probability((std::size_t) best_expected,
+                             m_num_available_points - num_invalid, 
+                             generated_candidates,
+                             m_global_octree->maxLevel()) 
+                > m_options.probability
+          && keep_searching);
+        // end of generate candidate
+
+        if (force_exit) {
+          break;
+        }
+
+        if (candidates.empty())
+          continue;
+
+        // Now get the best candidate in the current set of all candidates
+        // Note that the function sorts the candidates:
+        //  the best candidate is always the last element of the vector
+        
+        Shape *best_candidate = 
+          get_best_candidate(candidates, m_num_available_points - num_invalid);
+
+        // If search is done and the best candidate is too small, we are done.
+        if (!keep_searching && best_candidate->m_score < m_options.min_points)
+          break;
+
+        if (!best_candidate)
+          continue;
+
+        best_candidate->m_indices.clear();
+
+        best_candidate->m_score = 
+          m_global_octree->score(best_candidate,
+                                 m_shape_index,
+                                 FT(3) * m_options.epsilon,
+                                 m_options.normal_threshold);
+
+        best_expected = static_cast<FT>(best_candidate->m_score);
+
+        best_candidate->connected_component(best_candidate->m_indices,
+                                            m_options.cluster_epsilon);
+        
+        // check score against min_points and clear out candidates if too low
+        if (best_candidate->indices_of_assigned_points().size() <
+          m_options.min_points) 
+        {
+          for (std::size_t i = 0;i < candidates.size() - 1;i++) {
+            if (best_candidate->is_same(candidates[i])) {
+              delete candidates[i];
+              candidates[i] = NULL;
+            }
+          }
+
+          candidates.back() = NULL;
+          delete best_candidate;
+          best_candidate = NULL;
+
+          // Trimming candidates list
+          std::size_t empty = 0, occupied = 0;
+          while (empty < candidates.size()) {
+            while (empty < candidates.size() && candidates[empty]) empty++;
+
+            if (empty >= candidates.size())
+              break;
+
+            if (occupied < empty)
+              occupied = empty + 1;
+
+            while (occupied < candidates.size() && !candidates[occupied])
+              occupied++;
+
+            if (occupied >= candidates.size())
+              break;
+            candidates[empty] = candidates[occupied];
+            candidates[occupied] = NULL;
+            empty++;
+            occupied++;
+          }
+
+          candidates.resize(empty);
+        }
+        else
+          if (stop_probability((std::size_t) best_candidate->expected_value(),
+                            (m_num_available_points - num_invalid),
+                            generated_candidates,
+                            m_global_octree->maxLevel())
+                <= m_options.probability) {
+
+            // Remove candidate from list
+            candidates.back() = NULL;
+
+            //1. add best candidate to final result.
+            m_extracted_shapes->push_back(
+                                    boost::shared_ptr<Shape>(best_candidate));
+
+            //2. remove the points
+            const std::vector<std::size_t> &indices_points_best_candidate =
+              best_candidate->indices_of_assigned_points();
+
+            for (std::size_t i = 0;i<indices_points_best_candidate.size();i++) {
+              m_shape_index[indices_points_best_candidate.at(i)] =
+                int(m_extracted_shapes->size()) - 1;
+
+              num_invalid++;
+              
+              for (std::size_t j = 0;j<m_num_subsets;j++) {
+                if (m_direct_octrees[j] && m_direct_octrees[j]->m_root) {
+                  std::size_t offset = m_direct_octrees[j]->offset();
+
+                  if (offset <= indices_points_best_candidate.at(i) &&
+                      (indices_points_best_candidate.at(i) - offset) 
+                      < m_direct_octrees[j]->size()) {
+                    m_available_octree_sizes[j]--;
+                  }
+                }
+              }
+            }
+
+            //2.3 Remove the points from the subtrees        
+
+            generated_candidates--;
+            failed_candidates = 0;
+            best_expected = 0;
+
+            std::vector<std::size_t> subset_sizes(m_num_subsets);
+            subset_sizes[0] = m_available_octree_sizes[0];
+            for (std::size_t i = 1;i<m_num_subsets;i++) {
+              subset_sizes[i] = subset_sizes[i-1] + m_available_octree_sizes[i];
+            }
+  
+  
+            //3. Remove points from candidates common with extracted primitive
+            //#pragma omp parallel for
+            best_expected = 0;
+            for (std::size_t i=0;i< candidates.size()-1;i++) {
+              if (candidates[i]) {
+                candidates[i]->update_points(m_shape_index);
+                candidates[i]->compute_bound(
+                  subset_sizes[candidates[i]->m_nb_subset_used - 1],
+                  m_num_available_points - num_invalid);
+  
+                if (candidates[i]->max_bound() < m_options.min_points) {
+                  delete candidates[i];
+                  candidates[i] = NULL;
+                }
+                else {
+                  best_expected = (candidates[i]->expected_value() > best_expected) ?
+                    candidates[i]->expected_value() : best_expected;
+                }
+              }
+            }
+  
+            std::size_t start = 0, end = candidates.size() - 1;
+            while (start < end) {
+              while (candidates[start] && start < end) start++;
+              while (!candidates[end] && start < end) end--;
+              if (!candidates[start] && candidates[end] && start < end) {
+                candidates[start] = candidates[end];
+                candidates[end] = NULL;
+                start++;
+                end--;
+              }
+            }
+  
+            if (candidates[end]) end++;
+  
+            candidates.resize(end);
+          }
+        keep_searching = (stop_probability(m_options.min_points,
+            m_num_available_points - num_invalid,
+            generated_candidates, 
+            m_global_octree->maxLevel())
+              > m_options.probability);
+      }
+      while((keep_searching
+        && FT(m_num_available_points - num_invalid) >= m_options.min_points)
+        || best_expected >= m_options.min_points);
+
+      // Clean up remaining candidates.
+      for (std::size_t i = 0;i<candidates.size();i++)
+        delete candidates[i];
+
+      candidates.resize(0);
+
+      m_num_available_points -= num_invalid;
+ 
+      return true;
+    }
+
+    /// @}
+
+    /// \name Access
+    /// @{            
+    /*!
+      Returns an `Iterator_range` with a bidirectional iterator with value type
+      `boost::shared_ptr<Shape>` over the detected shapes in the order of detection.
+      Depending on the chosen probability
+      for the detection, the shapes are ordered with decreasing size.
+    */
+    Shape_range shapes() const {
+      return Shape_range(m_extracted_shapes);
+    }
+      
+    /*! 
+      Number of points not assigned to a shape.
+    */ 
+    std::size_t number_of_unassigned_points() {
+      return m_num_available_points;
+    }
+    
+    /*! 
+      Returns an `Iterator_range` with a bidirectional iterator with value type `std::size_t`
+      as indices into the input data that has not been assigned to a shape. 
+    */ 
+    Point_index_range indices_of_unassigned_points() {
+      Filter_unassigned_points fup(m_shape_index);
+
+      Point_index_iterator p1 =
+        boost::make_filter_iterator<Filter_unassigned_points>(
+        fup,
+        boost::counting_iterator<std::size_t>(0),
+        boost::counting_iterator<std::size_t>(m_shape_index.size()));
+
+      return make_range(p1, Point_index_iterator(p1.end()));
+    }
+    /// @}
+
+  private:
+    int select_random_octree_level() {
+      return (int) get_default_random()(m_global_octree->maxLevel() + 1);
+    }
+
+    Shape* get_best_candidate(std::vector<Shape* >& candidates,
+                            const std::size_t num_available_points) {
+      if (candidates.size() == 1)
+        return candidates.back();
+
+      int index_worse_candidate = 0;
+      bool improved = true;
+
+      while (index_worse_candidate < (int)candidates.size() - 1 && improved) {
+        improved = false;
+
+        typename Shape::Compare_by_max_bound comp;
+
+        std::sort(candidates.begin() + index_worse_candidate,
+                  candidates.end(),
+                  comp);
+
+        //refine the best one 
+        improve_bound(candidates.back(),
+                     num_available_points, m_num_subsets,
+                     m_options.min_points);
+
+        int position_stop;
+
+        //Take all those intersecting the best one, check for equal ones
+        for (position_stop = int(candidates.size()) - 1;
+             position_stop > index_worse_candidate;
+             position_stop--) {
+          if (candidates.back()->min_bound() >
+            candidates.at(position_stop)->max_bound())
+            break;//the intervals do not overlaps anymore
+
+          if (candidates.at(position_stop)->max_bound()
+              <= m_options.min_points)
+            break;  //the following candidate doesnt have enough points!
+
+          //if we reach this point, there is an overlap
+          //  between best one and position_stop
+          //so request refining bound on position_stop
+          improved |= improve_bound(candidates.at(position_stop),
+                                   num_available_points,
+                                   m_num_subsets,
+                                   m_options.min_points);
+
+          //test again after refined
+          if (candidates.back()->min_bound() >
+            candidates.at(position_stop)->max_bound()) 
+            break;//the intervals do not overlaps anymore
+        }
+
+        index_worse_candidate = position_stop;
+      }
+
+      return candidates.back();
+    }
+
+    bool improve_bound(Shape *candidate,
+                      std::size_t num_available_points,
+                      std::size_t max_subset,
+                      std::size_t min_points) {
+      if (candidate->m_nb_subset_used >= max_subset)
+        return false;
+
+      if (candidate->m_nb_subset_used >= m_num_subsets)
+        return false;
+
+      candidate->m_nb_subset_used =
+        (candidate->m_nb_subset_used >= m_num_subsets) ? 
+        m_num_subsets - 1 : candidate->m_nb_subset_used;
+
+      //what it does is add another subset and recompute lower and upper bound
+      //the next subset to include is provided by m_nb_subset_used
+
+      std::size_t num_points_evaluated = 0;
+      for (std::size_t i=0;i<candidate->m_nb_subset_used;i++)
+        num_points_evaluated += m_available_octree_sizes[i];
+
+      // need score of new subset as well as sum of
+      // the score of the previous considered subset
+      std::size_t new_score = 0;
+      std::size_t new_sampled_points = 0;
+
+      do {
+        new_score = m_direct_octrees[candidate->m_nb_subset_used]->score(
+          candidate, 
+          m_shape_index, 
+          m_options.epsilon,
+          m_options.normal_threshold);
+
+        candidate->m_score += new_score;
+        
+        num_points_evaluated += 
+          m_available_octree_sizes[candidate->m_nb_subset_used];
+
+        new_sampled_points +=
+          m_available_octree_sizes[candidate->m_nb_subset_used];
+
+        candidate->m_nb_subset_used++;
+      } while (new_sampled_points < min_points &&
+        candidate->m_nb_subset_used < m_num_subsets);
+
+      candidate->m_score = candidate->m_indices.size();
+
+      candidate->compute_bound(num_points_evaluated, num_available_points);
+
+      return true;
+    }
+    
+    inline FT stop_probability(std::size_t largest_candidate, std::size_t num_pts, std::size_t num_candidates, std::size_t octree_depth) const {
+      return (std::min<FT>)(std::pow((FT) 1.f - (FT) largest_candidate / FT(num_pts * octree_depth * 4), (int) num_candidates), (FT) 1);
+    }
+    
+  private:
+    Parameters m_options;
+
+    // Traits class.
+    Traits m_traits;
+
+    // Octrees build on input data for quick shape evaluation and
+    // sample selection within an octree cell.
+    Direct_octree **m_direct_octrees;
+    Indexed_octree *m_global_octree;
+    std::vector<std::size_t> m_available_octree_sizes;
+    std::size_t m_num_subsets;
+
+    // maps index into points to assigned extracted primitive
+    std::vector<int> m_shape_index;
+    std::size_t m_num_available_points; 
+    std::size_t m_num_total_points;
+
+    //give the index of the subset of point i
+    std::vector<int> m_index_subsets;
+
+    boost::shared_ptr<std::vector<boost::shared_ptr<Shape> > > m_extracted_shapes;
+
+    std::vector<Shape *(*)()> m_shape_factories;
+
+    // iterators of input data
+    bool m_valid_iterators;
+    Input_iterator m_input_iterator_first, m_input_iterator_beyond; 
+    Point_map m_point_pmap;
+    Normal_map m_normal_pmap;
+  };
+}
+}
+
+#endif // CGAL_SHAPE_DETECTION_3_EFFICIENT_RANSAC_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Shape_detection_3/Efficient_RANSAC_traits.h b/3rdparty/CGAL/include/CGAL/Shape_detection_3/Efficient_RANSAC_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Shape_detection_3/Efficient_RANSAC_traits.h
rename to 3rdparty/CGAL/include/CGAL/Shape_detection_3/Efficient_RANSAC_traits.h
diff --git a/3rdparty/CGAL/include/CGAL/Shape_detection_3/Octree.h b/3rdparty/CGAL/include/CGAL/Shape_detection_3/Octree.h
new file mode 100644
index 0000000..2b3eb01
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Shape_detection_3/Octree.h
@@ -0,0 +1,727 @@
+// Copyright (c) 2015 INRIA Sophia-Antipolis (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
+// 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(s)     : Sven Oesau, Yannick Verdie, Clément Jamin, Pierre Alliez
+//
+
+#ifndef CGAL_SHAPE_DETECTION_3_OCTREE_H
+#define CGAL_SHAPE_DETECTION_3_OCTREE_H
+
+#include <limits>
+#include <stack>
+
+#include <CGAL/Random.h>
+#include <CGAL/Bbox_3.h>
+#include <CGAL/Shape_detection_3/Shape_base.h>
+
+
+extern int scoreTime;
+
+namespace CGAL {
+  namespace Shape_detection_3 {
+  
+    template<class Traits> 
+    class Efficient_RANSAC;
+    
+  namespace internal {
+
+    const std::size_t size_t_max = (std::numeric_limits<std::size_t>::max)();
+  
+    template<class Sdt>
+    class DirectPointAccessor {
+    public:
+      typedef Sdt Sd_traits;
+      typedef typename Sd_traits::Input_range::iterator Input_iterator;
+
+      DirectPointAccessor() {}
+      DirectPointAccessor(const Input_iterator &begin,
+                          const Input_iterator &beyond, 
+                          std::size_t offset) : m_first(begin), m_offset(offset) {
+        m_beyond = (beyond == begin) ? begin : beyond - 1;
+      }
+
+      Input_iterator at(std::size_t i) {
+        return m_first + i;
+      }
+
+      std::size_t index(std::size_t i) {
+        return i + m_offset;
+      }
+
+      std::size_t offset() {
+        return m_offset;
+      }
+
+      std::size_t size() {
+        return m_beyond - m_first + 1;
+      }
+
+      Input_iterator first() {
+        return m_first;
+      }
+
+      Input_iterator beyond() {
+        return m_beyond;
+      }
+
+      void setData(Input_iterator &begin, Input_iterator &beyond) {
+        m_beyond = (beyond == begin) ? begin : beyond - 1;
+      }
+
+      void swap(std::size_t a, std::size_t b) {
+        typename std::iterator_traits<Input_iterator>::value_type tmp;
+        tmp = m_first[a];
+        m_first[a] = m_first[b];
+        m_first[b] = tmp;
+      }
+
+    protected:
+      Input_iterator m_first;
+
+    private:
+      Input_iterator m_beyond;
+      std::size_t m_offset;
+    };
+
+    template<class Sdt>
+    class IndexedPointAccessor {
+    public:
+      typedef Sdt Sd_traits;
+      typedef typename Sd_traits::Input_range::iterator Input_iterator;
+
+      IndexedPointAccessor() {}
+      IndexedPointAccessor(const Input_iterator &begin,
+                           const Input_iterator &beyond, std::size_t)
+                           : m_first(begin) {
+        m_beyond = (beyond == begin) ? begin : beyond - 1;
+        m_indices.resize(size());
+        for (std::size_t i = 0;i<size();i++)
+          m_indices[i] = i;
+      }
+
+      Input_iterator at(std::size_t i) {
+        return m_first + m_indices[i];
+      }
+
+      std::size_t index(std::size_t i) {
+        return m_indices[i];
+      }
+
+      std::size_t offset() {
+        return 0;
+      }
+
+      Input_iterator first() {
+        return m_first;
+      }
+
+      Input_iterator beyond() {
+        return m_beyond;
+      }
+
+      void setData(Input_iterator &begin, Input_iterator &beyond) {
+        m_beyond = (beyond == begin) ? begin : beyond - 1;
+        m_indices.resize(size());
+        for (std::size_t i = 0;i<size();i++)
+          m_indices[i] = i;
+      }
+
+      std::size_t size() {
+        return m_beyond - m_first + 1;
+      }
+
+      void swap(std::size_t a, std::size_t b) {
+        std::size_t tmp = m_indices[a];
+        m_indices[a] = m_indices[b];
+        m_indices[b] = tmp;
+      }
+
+    protected:
+      Input_iterator m_first;
+
+    private:
+      std::vector<std::size_t> m_indices;
+      Input_iterator m_beyond;
+    };
+
+    template<class PointAccessor>
+    class Octree : public PointAccessor {
+
+      typedef typename PointAccessor::Sd_traits Sd_traits;
+      typedef typename Sd_traits::Input_range::iterator Input_iterator;
+      typedef Shape_base<Sd_traits> Shape;
+      typedef typename Sd_traits::Point_3 Point_3;
+      typedef typename Sd_traits::Vector_3 Vector_3;
+      typedef typename Sd_traits::FT FT;
+      typedef typename Sd_traits::Point_map Point_map;
+      typedef typename Sd_traits::Normal_map Normal_map;
+
+      template<class Sd_traits>
+        friend class ::CGAL::Shape_detection_3::Efficient_RANSAC;
+
+      struct Cell {
+        std::size_t first, last;
+        Cell *child[8];
+        Point_3 center;
+        std::size_t level;
+
+        Cell(std::size_t first, std::size_t last, Point_3 center, std::size_t level)
+          : first(first), last(last), center(center), level(level) {
+            memset(child, 0, sizeof(Cell *) * 8);
+        }
+
+        bool isLeaf() const {
+          for (std::size_t i = 0;i<8;i++) {
+            if (child[i])
+              return false;
+          }
+          return true;
+        }
+
+        std::size_t size() const {
+          if (first == size_t_max || last == size_t_max)
+            return 0;
+          else return (last - first + 1);
+        }
+      };
+
+      // --------------------------------------------------------------------------
+      // Utilities
+      // --------------------------------------------------------------------------
+      FT get_x(const Vector_3& v){ return m_traits.compute_x_3_object()(v); }
+      FT get_y(const Vector_3& v){ return m_traits.compute_y_3_object()(v); }
+      FT get_z(const Vector_3& v){ return m_traits.compute_z_3_object()(v); }
+      FT get_x(const Point_3& p){ return m_traits.compute_x_3_object()(p); }
+      FT get_y(const Point_3& p){ return m_traits.compute_y_3_object()(p); }
+      FT get_z(const Point_3& p){ return m_traits.compute_z_3_object()(p); }
+      FT get_coord(const Point_3& p, unsigned int d)
+      {
+        CGAL_assertion(d >= 0 && d < 3);
+        switch (d)
+        {
+          case 0: return get_x(p);
+          case 1: return get_y(p);
+          case 2: return get_z(p);
+          default: return FT(0);
+        }
+      }
+
+      Point_3 constr_pt(FT x, FT y, FT z) const
+      { return m_traits.construct_point_3_object()(x, y, z); }
+      Vector_3 constr_vec(const Point_3& p, const Point_3& q) const
+      { return m_traits.construct_vector_3_object()(p, q); }
+
+      Point_3 transl(const Point_3& p, const Vector_3 &v)
+      { return m_traits.construct_translated_point_3_object()(p, v); }
+        
+    public:
+      Octree(Sd_traits const& traits) 
+        : m_traits(traits), m_bucket_size(20), m_set_max_level(10), m_root(NULL) {}
+      Octree(Sd_traits const& traits,
+             const Input_iterator &first,
+             const Input_iterator &beyond,
+             Point_map& point_pmap,
+             Normal_map& normal_pmap,
+             std::size_t offset = 0,
+             std::size_t bucketSize = 20, 
+             std::size_t maxLevel = 10)
+             : PointAccessor(first, beyond, offset),
+               m_traits(traits),
+               m_root(NULL),
+               m_bucket_size(bucketSize),
+               m_set_max_level(maxLevel),
+               m_point_pmap (point_pmap),
+               m_normal_pmap (normal_pmap) {}
+
+      ~Octree() {
+        if (!m_root)
+          return;
+
+        std::stack<Cell *> stack;
+        stack.push(m_root);
+        while (!stack.empty()) {
+          Cell *cell = stack.top();
+          stack.pop();
+
+          for (std::size_t i = 0;i<8;i++)
+            if (cell->child[i])
+              stack.push(cell->child[i]);
+
+          delete cell;
+        }
+      }
+
+      // Sorting data in a way such that points of one cell
+      // are always in one range and ordered child-wise:
+      // +---+---+
+      // | 1.| 0.|
+      // +---+---+
+      // | 3.| 2.|
+      // +---+---+
+      // z max before z min, then y max before y min, then x max before x min
+      void createTree() {
+        buildBoundingCube();
+        std::size_t count = 0;
+        m_max_level = 0;
+
+        std::stack<Cell *> stack;
+        m_root = new Cell(0, this->size() - 1, m_center, 0);
+        stack.push(m_root);
+        while (!stack.empty()) {
+          Cell *cell= stack.top();
+          stack.pop();
+
+          m_max_level = std::max<std::size_t>(m_max_level, cell->level);
+          if (cell->level == m_set_max_level)
+            continue;
+          
+          std::size_t zLowYHighXSplit, zLowYLowXSplit, zLowYSplit;
+          std::size_t zHighYSplit, zHighYHighXSplit, zHighYLowXSplit;
+
+          std::size_t zSplit = split(cell->first, cell->last, 2, get_z(cell->center));
+
+          if (zSplit != size_t_max) {
+
+            zLowYSplit = split(cell->first, zSplit, 1, get_y(cell->center));
+            if (zLowYSplit != size_t_max) {
+              zLowYLowXSplit = split(cell->first,
+                                     zLowYSplit, 0, get_x(cell->center));
+              zLowYHighXSplit = split(zLowYSplit + 1,
+                                      zSplit, 0, get_x(cell->center)); 
+            }
+            else {
+              zLowYLowXSplit = size_t_max;
+              zLowYHighXSplit = split(cell->first, zSplit, 0, get_x(cell->center));
+            }
+
+            zHighYSplit = split(zSplit + 1, cell->last, 1, get_y(cell->center));  
+
+            if (zHighYSplit != size_t_max) {
+              zHighYHighXSplit = split(zHighYSplit + 1,
+                                       cell->last, 0, get_x(cell->center));
+              zHighYLowXSplit = split(zSplit + 1,
+                                      zHighYSplit, 0, get_x(cell->center));
+            }
+            else {
+              zHighYLowXSplit = size_t_max;
+              zHighYHighXSplit = split(zSplit + 1,
+                                       cell->last, 0, get_x(cell->center));
+            }
+          }
+          else {
+            zLowYSplit = size_t_max;
+            zLowYLowXSplit = size_t_max;
+            zLowYHighXSplit = size_t_max;
+
+            zHighYSplit = split(cell->first,
+                                cell->last,
+                                1,
+                                get_y(cell->center)); 
+
+            if (zHighYSplit != size_t_max) {
+              zHighYHighXSplit = split(zHighYSplit + 1, 
+                                       cell->last, 
+                                       0, 
+                                       get_x(cell->center));
+
+              zHighYLowXSplit = split(cell->first, 
+                                      zHighYSplit,
+                                      0, 
+                                      get_x(cell->center)); 
+            }
+            else {
+              zHighYLowXSplit = size_t_max;
+              zHighYHighXSplit = split(cell->first,
+                                       cell->last, 
+                                       0,
+                                       get_x(cell->center));
+            }
+          }
+
+
+          FT width = m_width / (1<<(cell->level + 1));
+
+          if (zSplit != size_t_max) {
+            if (zLowYSplit != size_t_max) {
+              if (zLowYLowXSplit != size_t_max) {
+
+                if (cell->first <= zLowYLowXSplit) {
+                  //---
+                  cell->child[7] = new Cell(cell->first,
+                                            zLowYLowXSplit, 
+                                            transl(cell->center, constr_vec(
+                                              ORIGIN, constr_pt(-width,-width,-width))),
+                                            cell->level + 1);
+
+                  if (cell->child[7]->size() > m_bucket_size)
+                    stack.push(cell->child[7]);
+                }
+              }
+              else zLowYLowXSplit = cell->first - 1;
+
+              if (zLowYLowXSplit < zLowYSplit || zLowYLowXSplit == size_t_max) {
+                //+--
+                cell->child[6] = new Cell(zLowYLowXSplit + 1,
+                                          zLowYSplit, 
+                                          transl(cell->center, constr_vec(
+                                            ORIGIN, constr_pt(width,-width,-width))),
+                                          cell->level + 1);
+
+                if (cell->child[6]->size() > m_bucket_size)
+                  stack.push(cell->child[6]);
+              }
+            }
+            else zLowYSplit = cell->first - 1;
+
+            if (zLowYHighXSplit != size_t_max) {
+
+              if (zLowYSplit < zLowYHighXSplit || zLowYSplit == size_t_max) {
+                //-+-
+                cell->child[5] = new Cell(zLowYSplit + 1, 
+                                          zLowYHighXSplit, 
+                                          transl(cell->center, constr_vec(
+                                            ORIGIN, constr_pt(-width, width,-width))),
+                                          cell->level + 1);
+
+                if (cell->child[5]->size() > m_bucket_size)
+                  stack.push(cell->child[5]);
+              }
+            }
+            else zLowYHighXSplit = zLowYSplit;
+
+            if (zLowYHighXSplit < zSplit || zLowYHighXSplit == size_t_max) {
+              //++-
+              cell->child[4] = new Cell(zLowYHighXSplit + 1,
+                                        zSplit, 
+                                        transl(cell->center, constr_vec(
+                                          ORIGIN, constr_pt(width, width,-width))),
+                                        cell->level + 1);
+
+              if (cell->child[4]->size() > m_bucket_size)
+                stack.push(cell->child[4]);
+            }
+          }
+          else zSplit = cell->first - 1;
+
+          if (zHighYSplit != size_t_max) {
+            if (zHighYLowXSplit != size_t_max) {
+
+              if (zSplit < zHighYLowXSplit || zSplit == size_t_max) {
+                //--+
+                cell->child[3] = new Cell(zSplit + 1,
+                                          zHighYLowXSplit,
+                                          transl(cell->center, constr_vec(
+                                            ORIGIN, constr_pt(-width,-width, width))),
+                                          cell->level + 1);
+
+                if (cell->child[3]->size() > m_bucket_size)
+                  stack.push(cell->child[3]);
+              }
+            }
+            else zHighYLowXSplit = zSplit;
+
+            if (zHighYLowXSplit < zHighYSplit || zHighYLowXSplit == size_t_max) {
+              //+-+
+              cell->child[2] = new Cell(zHighYLowXSplit + 1,
+                                        zHighYSplit, 
+                                        transl(cell->center, constr_vec(
+                                          ORIGIN, constr_pt(width,-width, width))),
+                                        cell->level + 1);
+
+              if (cell->child[2]->size() > m_bucket_size)
+                stack.push(cell->child[2]);
+            }
+
+          }
+          else zHighYSplit = zSplit;
+
+          if (zHighYHighXSplit != size_t_max) {
+            if (zHighYSplit < zHighYHighXSplit || zHighYSplit == size_t_max) {
+              //-++
+              cell->child[1] = new Cell(zHighYSplit + 1,
+                                        zHighYHighXSplit, 
+                                        transl(cell->center, constr_vec(
+                                          ORIGIN, constr_pt(-width, width, width))), 
+                                        cell->level + 1);
+
+              if (cell->child[1]->size() > m_bucket_size)
+                stack.push(cell->child[1]);
+            }
+          }
+          else zHighYHighXSplit = zHighYSplit;
+
+          if (zHighYHighXSplit <= cell->last || zHighYHighXSplit == size_t_max) {
+            if (zHighYHighXSplit < cell->last || zHighYHighXSplit == size_t_max) {
+              //+++
+              cell->child[0] = new Cell(zHighYHighXSplit + 1, 
+                                        cell->last,
+                                        transl(cell->center, constr_vec(
+                                          ORIGIN, constr_pt(width, width, width))),
+                                        cell->level + 1);
+
+              if (cell->child[0]->size() > m_bucket_size)
+                stack.push(cell->child[0]);
+            }
+          }
+
+          std::size_t sum = 0;
+          for (std::size_t i = 0;i<8;i++)
+            sum += (cell->child[i]) ? cell->child[i]->size() : 0;
+
+          count++;
+        }
+      }
+
+      bool drawSamplesFromCellContainingPoint(const Point_3 &p,
+                                              std::size_t level,
+                                              std::set<std::size_t>& indices,
+                                              const std::vector<int>& shapeIndex,
+                                              std::size_t requiredSamples) {
+
+        bool upperZ, upperY, upperX;
+        Cell *cur = m_root;
+
+        while (cur && cur->level < level) {
+          upperX = get_x(cur->center) <= get_x(p);
+          upperY = get_y(cur->center) <= get_y(p);
+          upperZ = get_z(cur->center) <= get_z(p);
+
+          if (upperZ) {
+            if (upperY)
+              cur = (upperX) ? cur->child[0] : cur->child[1];
+            else cur = (upperX) ? cur->child[2] : cur->child[3];
+          }
+          else {
+            if (upperY)
+              cur = (upperX) ? cur->child[4] : cur->child[5];
+            else cur = (upperX) ? cur->child[6] : cur->child[7];
+          }
+        }
+
+        if (cur) {
+          std::size_t enough = 0;
+          for (std::size_t i = cur->first;i<=cur->last;i++) {
+            std::size_t j = this->index(i);
+            if (shapeIndex[j] == -1) {
+              enough++;
+              if (enough >= requiredSamples)
+                break;
+            }
+          }
+          if (enough >= requiredSamples) {
+            do {
+              std::size_t p = CGAL::get_default_random().
+                uniform_int<std::size_t>(0, cur->size() - 1);
+              std::size_t j = this->index(cur->first + p);
+              if (shapeIndex[j] == -1)
+                indices.insert(j);
+            } while (indices.size() < requiredSamples);
+
+            return true;
+          }
+          else return false;
+        }
+        else return false;
+      }
+
+      std::size_t maxLevel() {
+        return m_max_level;
+      }
+
+      std::size_t fullScore(Shape *candidate,
+                       std::vector<int> &shapeIndex,
+                       FT epsilon, 
+                       FT normal_threshold) {
+
+        std::vector<std::size_t> indices(m_root->size());
+        for (std::size_t i = 0;i<m_root->size();i++) {
+          indices[i] = index(m_root->first + i);
+        }
+        
+        candidate->cost_function(this->begin() + m_root->first, 
+                                 this->begin() + m_root->last,
+                                 shapeIndex,
+                                 epsilon, 
+                                 normal_threshold, 
+                                 indices);
+
+        return candidate->m_indices.size();
+      }
+
+      std::size_t score(Shape *candidate, 
+                   std::vector<int> &shapeIndex,
+                   FT epsilon,
+                   FT normal_threshold) {
+
+        std::stack<Cell *> stack;
+        stack.push(m_root);
+
+        while(!stack.empty()) {
+          Cell *cell = stack.top();
+          stack.pop();
+
+          FT width = m_width / (1<<(cell->level));
+
+          FT diag = CGAL::sqrt(FT(3) * width * width) + epsilon;
+
+          FT dist = candidate->squared_distance(cell->center);
+
+          if (dist > (diag * diag))
+            continue;
+
+          // differ between full or partial overlap?
+          // if full overlap further traversal of this branch is not necessary
+          if (cell->isLeaf()) {
+            std::vector<std::size_t> indices;
+            indices.reserve(cell->size());
+            for (std::size_t i = 0;i<cell->size();i++) {
+              if (shapeIndex[this->index(cell->first + i)] == -1) {
+                indices.push_back(this->index(cell->first + i));
+              }
+            }
+
+            candidate->cost_function(epsilon, 
+                                     normal_threshold, 
+                                     indices);
+          }
+          else {
+            for (std::size_t i = 0;i<8;i++)
+              if (cell->child[i])
+                stack.push(cell->child[i]);
+          }
+
+        }
+
+        return candidate->m_indices.size();
+      }
+
+      void setBucketSize(std::size_t bucketSize) {
+        m_bucket_size = bucketSize;
+      }
+
+      const Bbox_3 &boundingBox() {
+        return m_bBox;
+      }
+        
+      const Bbox_3 &buildBoundingCube() {
+        FT min[] = {(std::numeric_limits<FT>::max)(),
+                    (std::numeric_limits<FT>::max)(),
+                    (std::numeric_limits<FT>::max)()};
+        FT max[] = {(std::numeric_limits<FT>::min)(),
+                    (std::numeric_limits<FT>::min)(),
+                    (std::numeric_limits<FT>::min)()};
+
+        for (std::size_t i = 0;i<this->size();i++) {
+          Point_3 p = get(m_point_pmap, *this->at(i));
+          min[0] = (std::min<FT>)(min[0], get_x(p));
+          min[1] = (std::min<FT>)(min[1], get_y(p));
+          min[2] = (std::min<FT>)(min[2], get_z(p));
+          max[0] = (std::max<FT>)(max[0], get_x(p));
+          max[1] = (std::max<FT>)(max[1], get_y(p));
+          max[2] = (std::max<FT>)(max[2], get_z(p));
+        }
+
+        m_bBox = Bbox_3(min[0], min[1], min[2], max[0], max[1], max[2]);
+
+        m_width = (std::max)(max[0] - min[0], 
+          (std::max)(max[1] - min[1], max[2] - min[2])) * (FT) 0.5;
+        m_center = constr_pt((min[0] + max[0]) * (FT) 0.5,
+                             (min[1] + max[1]) * (FT) 0.5,
+                             (min[2] + max[2]) * (FT) 0.5);
+
+        return m_bBox;
+      }
+
+      // returns index of last point below threshold
+      std::size_t split(std::size_t first, std::size_t last, std::size_t dimension, FT threshold) {
+        if (last == size_t_max || first == size_t_max) 
+          return size_t_max;
+
+        if (first > last)
+          return first - 1;
+
+        std::size_t origFirst = first;
+
+        while(first < last) {
+          // find first above threshold
+          Point_3 p1 = get(m_point_pmap, *this->at(first));
+          FT v1 = get_coord(p1, static_cast<unsigned int>(dimension));
+          while (get_coord(
+                   get(m_point_pmap, *this->at(first)),
+                   static_cast<unsigned int>(dimension)) < threshold
+                 && first < last) {
+            first++;
+          }
+
+          // check if last has been reached
+          if (first == last) {
+            return (get_coord(
+                      get(m_point_pmap, *this->at(first)),
+                      static_cast<unsigned int>(dimension)) < threshold) ?
+                   first : (first == origFirst) ? size_t_max : first - 1;
+          }
+
+          // find last below threshold
+          p1 = get(m_point_pmap, *this->at(last));
+          v1 = get_coord(p1, static_cast<unsigned int>(dimension));
+          while (get_coord(
+                   get(m_point_pmap, *this->at(last)),
+                   static_cast<unsigned int>(dimension)) >= threshold
+                 && last > first) {
+            last--;
+          }
+
+          // check if first has been reached
+          if (last == first) {
+            return (get_coord(
+                      get(m_point_pmap, *this->at(first)),
+                      static_cast<unsigned int>(dimension)) < threshold) ?
+                    first : (first == origFirst) ? size_t_max : first - 1;
+          }
+
+          this->swap(first, last);
+          p1 = get(m_point_pmap, *this->at(first));
+          v1 = get_coord(p1, static_cast<unsigned int>(dimension));
+          p1 = get(m_point_pmap, *this->at(last));
+          v1 = get_coord(p1, static_cast<unsigned int>(dimension));
+          first++;
+          last--;
+        }
+
+        return (get_coord(
+                  get(m_point_pmap, *this->at(first)),
+                  static_cast<unsigned int>(dimension)) < threshold) ?
+               first : (first == origFirst) ? size_t_max : first - 1;
+      }
+
+      Sd_traits m_traits;
+      Bbox_3 m_bBox;
+      Cell *m_root;
+      Point_3 m_center;
+      FT m_width;
+      std::size_t m_bucket_size;
+      std::size_t m_set_max_level;
+      std::size_t m_max_level;
+      Point_map m_point_pmap;
+      Normal_map m_normal_pmap;
+    };
+  }
+  }
+}
+
+#endif
diff --git a/3rdparty/CGAL/include/CGAL/Shape_detection_3/Plane.h b/3rdparty/CGAL/include/CGAL/Shape_detection_3/Plane.h
new file mode 100644
index 0000000..6f8c4f6
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Shape_detection_3/Plane.h
@@ -0,0 +1,239 @@
+// Copyright (c) 2015 INRIA Sophia-Antipolis (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
+// 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(s)     : Sven Oesau, Yannick Verdie, Clément Jamin, Pierre Alliez
+//
+
+#ifndef CGAL_SHAPE_DETECTION_3_PLANE_H
+#define CGAL_SHAPE_DETECTION_3_PLANE_H
+
+#include <CGAL/Shape_detection_3/Shape_base.h>
+#include <CGAL/number_utils.h>
+
+/*!
+ \file Plane.h
+ */
+namespace CGAL {
+  namespace Shape_detection_3 {
+    /*!
+     \ingroup PkgPointSetShapeDetection3Shapes
+     \brief Plane implements Shape_base. The plane is represented by the normal vector and the distance to the origin.
+     \tparam Traits a model of `EfficientRANSACTraits` with the additional 
+             requirement for planes (see `EfficientRANSACTraits` documentation).
+     */
+  template <class Traits>
+  class Plane : public Shape_base<Traits> {
+  public:
+    /// \cond SKIP_IN_MANUAL
+    typedef typename Traits::Point_map Point_map;
+     ///< property map to access the location of an input point.
+    typedef typename Traits::Normal_map Normal_map;
+     ///< property map to access the unoriented normal of an input point.
+    typedef typename Traits::FT FT; ///< number type.
+    typedef typename Traits::Point_3 Point_3; ///< point type.
+    typedef typename Traits::Point_2 Point_2; ///< point 2D type.
+    typedef typename Traits::Vector_3 Vector_3;
+    /// \endcond
+
+    typedef typename Traits::Plane_3 Plane_3;///< plane type for conversion operator.
+
+  public:
+    Plane() : Shape_base<Traits>() {}
+
+    /*!
+      Conversion operator to `Plane_3` type.
+     */
+    operator Plane_3() const {
+      return Plane_3(this->get_x(m_normal), this->get_y(m_normal), this->get_z(m_normal), m_d);
+    }
+            
+    /*!
+      Normal vector of the plane.
+     */
+    Vector_3 plane_normal() const {
+      return m_normal;
+    }
+            
+    /*!
+      Signed distance from the origin.
+     */
+    FT d() const {
+      return m_d;
+    }
+    
+    /// \cond SKIP_IN_MANUAL
+    /*!
+      Computes squared Euclidean distance from query point to the shape.
+     */
+    FT squared_distance(const Point_3 &p) const {
+      FT d = this->scalar_pdct(
+        this->constr_vec(p, m_point_on_primitive), m_normal);
+      return d * d;
+    }
+
+    /*!
+      Computes the orthogonal projection of a query point on the shape.
+     */
+    Point_3 projection (const Point_3& p) const {
+      return to_3d (to_2d (p));
+    }
+
+    Point_2 to_2d (const Point_3& p) const {
+      Vector_3 v (m_point_on_primitive, p);
+      return Point_2 (v * m_base1, v * m_base2);
+    }
+
+    Point_3 to_3d (const Point_2& p) const {
+      return m_point_on_primitive + p.x () * m_base1 + p.y () * m_base2;
+    }
+
+    /*!
+      Replaces the plane by p
+    */
+    void update (const Plane_3& p) {
+      m_base1 = p.base1 () / std::sqrt (p.base1() * p.base1 ());
+      m_base2 = p.base2 () / std::sqrt (p.base2() * p.base2 ());
+      m_normal = p.orthogonal_vector () / std::sqrt (p.orthogonal_vector () * p.orthogonal_vector ());
+      
+      m_d = p.d();
+
+    }
+
+    /*!
+      Helper function to write the plane equation and
+      number of assigned points into a string.
+     */
+    std::string info() const {
+      std::stringstream sstr;
+      sstr << "Type: plane (" << this->get_x(m_normal) << ", " << this->get_y(m_normal) 
+        << ", " << this->get_z(m_normal) << ")x - " << m_d << "= 0"
+        << " #Pts: " << this->m_indices.size();
+
+      return sstr.str();
+    }
+    /// \endcond
+
+  protected:
+      /// \cond SKIP_IN_MANUAL
+    virtual void create_shape(const std::vector<std::size_t> &indices) {
+      Point_3 p1 = this->point(indices[0]);
+      Point_3 p2 = this->point(indices[1]);
+      Point_3 p3 = this->point(indices[2]);
+
+      m_normal = this->cross_pdct(
+        this->constr_vec(p2, p1), this->constr_vec(p3, p1));
+
+      FT length = CGAL::sqrt(this->sqlen(m_normal));
+
+      // Are the points almost singular?
+      if (length < (FT)0.0001) {
+        return;
+      }
+
+      m_normal = this->scale(m_normal, (FT)1.0 / length);
+      m_d = -(this->get_x(p1) * this->get_x(m_normal) 
+        + this->get_y(p1) * this->get_y(m_normal) 
+        + this->get_z(p1) * this->get_z(m_normal));
+
+      //check deviation of the 3 normal
+      Vector_3 l_v = this->constr_vec();
+      for (std::size_t i = 0;i<3;i++) {
+        l_v = this->normal(indices[i]);
+
+        if (CGAL::abs(this->scalar_pdct(l_v, m_normal))
+            < this->m_normal_threshold * CGAL::sqrt(this->sqlen(l_v))) {
+          this->m_is_valid = false;
+          return;
+        }
+
+        m_point_on_primitive = p1;
+        m_base1 = this->cross_pdct(this->constr_vec(p2, p1), m_normal);
+        m_base1 = this->scale(m_base1, ((FT)1.0 / CGAL::sqrt(this->sqlen(m_base1))));
+
+        m_base2 = this->cross_pdct(m_base1, m_normal);
+        m_base2 = this->scale(m_base2, ((FT)1.0 / CGAL::sqrt(this->sqlen(m_base2))));
+      }
+
+      this->m_is_valid = true;
+    }
+
+    virtual void parameters(const std::vector<std::size_t> &indices,
+                            std::vector<std::pair<FT, FT> > &parameterSpace,
+                            FT &,                    
+                            FT min[2],
+                            FT max[2]) const {
+      // Transform first point before to initialize min/max
+      Vector_3 p = this->constr_vec(
+        m_point_on_primitive, this->point(indices[0]));
+      FT u = this->scalar_pdct(p, m_base1);
+      FT v = this->scalar_pdct(p, m_base2);
+      parameterSpace[0] = std::pair<FT, FT>(u, v);
+      min[0] = max[0] = u;
+      min[1] = max[1] = v;
+
+      for (std::size_t i = 1;i<indices.size();i++) {
+        p = this->constr_vec(m_point_on_primitive, this->point(indices[i]));
+        u = this->scalar_pdct(p, m_base1);
+        v = this->scalar_pdct(p, m_base2);
+        min[0] = (std::min<FT>)(min[0], u);
+        max[0] = (std::max<FT>)(max[0], u);
+        min[1] = (std::min<FT>)(min[1], v);
+        max[1] = (std::max<FT>)(max[1], v);
+        parameterSpace[i] = std::pair<FT, FT>(u, v);
+      }
+    }
+    
+    virtual void squared_distance(const std::vector<std::size_t> &indices,
+                                  std::vector<FT> &dists) const {
+      for (std::size_t i = 0;i<indices.size();i++) {
+        const FT d = this->scalar_pdct(
+          this->constr_vec(m_point_on_primitive, this->point(indices[i])), 
+          m_normal);
+        dists[i] = d * d;
+      }
+    }
+
+    virtual void cos_to_normal(const std::vector<std::size_t> &indices, 
+                               std::vector<FT> &angles) const {
+      for (std::size_t i = 0;i<indices.size();i++) {
+        angles[i] = CGAL::abs(
+          this->scalar_pdct(this->normal(indices[i]), m_normal));
+      }
+    }
+
+    FT cos_to_normal(const Point_3 &, const Vector_3 &n) const{
+      return CGAL::abs(this->scalar_pdct(n, m_normal));
+    } 
+    
+    virtual std::size_t minimum_sample_size() const {
+      return 3;
+    }
+
+    virtual bool supports_connected_component() const {
+      return true;
+    }
+
+  private:
+    Point_3 m_point_on_primitive;
+    Vector_3 m_base1, m_base2, m_normal;
+    FT m_d;
+    /// \endcond
+  };
+}
+}
+#endif
diff --git a/3rdparty/CGAL/include/CGAL/Shape_detection_3/Shape_base.h b/3rdparty/CGAL/include/CGAL/Shape_detection_3/Shape_base.h
new file mode 100644
index 0000000..a76b127
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Shape_detection_3/Shape_base.h
@@ -0,0 +1,702 @@
+// Copyright (c) 2015 INRIA Sophia-Antipolis (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
+// 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(s)     : Sven Oesau, Yannick Verdie, Clément Jamin, Pierre Alliez
+//
+
+#ifndef CGAL_SHAPE_DETECTION_3_SHAPE_BASE_H
+#define CGAL_SHAPE_DETECTION_3_SHAPE_BASE_H
+
+#include <vector>
+#include <set>
+#include <boost/tuple/tuple.hpp>
+#include <CGAL/Kd_tree.h>
+#include <CGAL/Fuzzy_sphere.h>
+#include <CGAL/property_map.h>
+#include <CGAL/number_utils.h>
+#include <CGAL/Random.h>
+
+/*!
+ \file Shape_base.h
+ */
+
+#ifndef CGAL_M_PI_2
+#define CGAL_M_PI_2 1.57079632679489661923
+#endif
+#ifndef CGAL_M_PI_4
+#define CGAL_M_PI_4 0.785398163397448309616
+#endif
+
+namespace CGAL {
+  namespace Shape_detection_3 {
+  namespace internal {
+    template<class PointAccessor>
+    class Octree;
+  }
+    
+    /*!
+     \ingroup PkgPointSetShapeDetection3Shapes
+     \brief Base class for shape types defining an interface to construct a
+            shape from a set of points and to compute the point distance and normal
+            deviation from the surface normal. It is used during detection to
+            identify the inliers from the input data and to extract the largest
+            connected component in inlier points.
+     */
+  template <class Traits>
+  class Shape_base {
+    /// \cond SKIP_IN_MANUAL
+    template <class T>
+    friend class Efficient_RANSAC;
+    template<class PointAccessor>
+    friend class internal::Octree;
+    /// \endcond
+
+  public:
+    /// \cond SKIP_IN_MANUAL
+    typedef typename Traits::Input_range::iterator Input_iterator;
+      ///< random access iterator for input data.
+    typedef typename Traits::Point_map Point_map;
+      ///< property map to access the location of an input point.
+    typedef typename Traits::Normal_map Normal_map;
+      ///< property map to access the unoriented normal of an input point.
+    typedef Shape_base<Traits> Shape;
+      ///< own type.
+    /// \endcond
+
+    typedef typename Traits::FT FT; ///< number type.
+    typedef typename Traits::Point_3 Point_3; ///< point type.
+    typedef typename Traits::Vector_3 Vector_3; ///< vector type.
+
+    // \todo The property maps should be passed here instead of `compute`
+    Shape_base() :
+    m_is_valid(false),
+      m_lower_bound((std::numeric_limits<FT>::min)()),
+      m_upper_bound((std::numeric_limits<FT>::min)()),
+      m_score(0),
+      m_sum_expected_value(0),
+      m_nb_subset_used(0),
+      m_has_connected_component(false) {
+    }
+
+    virtual ~Shape_base() {}
+      
+    /*!
+      returns the indices of the points in the input range assigned to this shape.
+     */
+    const std::vector<std::size_t> & indices_of_assigned_points() const {
+      return m_indices;
+    }
+      
+    /*!
+      returns a string containing the shape type
+      and the numerical parameters.
+     */
+    virtual std::string info() const {
+      return std::string();
+    }
+
+    /*!
+      Computes the squared Euclidean distance from the query point `p` to the shape.
+     */
+    virtual FT squared_distance(const Point_3 &p) const = 0;
+
+  protected:
+      
+    /*!
+      Constructs the shape based on a minimal set of samples from the
+      input data.
+     */
+    virtual void create_shape(const std::vector<std::size_t> &indices) = 0;
+    
+    /*!
+      Determines the largest cluster of inlier points. A point belongs to a cluster
+      if there is a point in the cluster closer than `cluster_epsilon` distance.
+     */
+    virtual std::size_t connected_component(
+      std::vector<std::size_t> &indices, FT cluster_epsilon) {
+      if (indices.size() == 0)
+        return 0;
+
+      if (m_has_connected_component)
+        return m_score;
+
+      m_has_connected_component = true;
+      if (!this->supports_connected_component())
+        return connected_component_kdTree(indices, cluster_epsilon);
+      
+      // Fetching parameters
+      FT min[] = {0,0}, max[] = {0,0};
+
+      std::vector<std::pair<FT, FT> > parameter_space;
+      parameter_space.resize(indices.size());
+
+      parameters(m_indices, parameter_space, cluster_epsilon, min, max);
+
+      // Determine required size of bitmap
+      std::size_t u_extent = std::size_t(ceil((max[0] - min[0]) / cluster_epsilon));
+      std::size_t v_extent = std::size_t(ceil((max[1] - min[1]) / cluster_epsilon));
+
+      // Handle singular case
+      u_extent = (u_extent == 0) ? 1 : u_extent;
+      v_extent = (v_extent == 0) ? 1 : v_extent;
+
+      std::vector<unsigned int> bitmap;
+      bitmap.resize(u_extent * v_extent, 0);
+
+      // Fill bitmap
+      for (std::size_t i = 0;i<parameter_space.size();i++) {
+        int u = (int)((parameter_space[i].first - min[0]) / cluster_epsilon);
+        int v = (int)((parameter_space[i].second - min[1]) / cluster_epsilon);
+
+        u = (u < 0) ? 0 : (((std::size_t)u >= u_extent) ? (int)u_extent - 1 : u);
+        v = (v < 0) ? 0 : (((std::size_t)v >= v_extent) ? (int)v_extent - 1 : v);
+
+        bitmap[v * int(u_extent) + u] = true;
+      }
+
+      // Iterate through the bitmap
+      std::vector<unsigned int> map;
+      map.reserve(64);
+      map.resize(2);
+
+      for (std::size_t y = 0;y<v_extent;y++) {
+        for (std::size_t x = 0;x<u_extent;x++) {
+          if (!bitmap[y * u_extent + x])
+            continue;
+
+          unsigned int w = (x > 0) ?
+            bitmap[y  * u_extent + x - 1] : 0;
+
+          unsigned int n = (y > 0) ?
+            bitmap[(y - 1) * u_extent + x] : 0;
+
+          unsigned int nw = (x > 0 && y > 0) ?
+            bitmap[(y - 1) * u_extent + x - 1] : 0;
+
+          unsigned int ne = ((x + 1 < u_extent) && y > 0) ?
+            bitmap[(y - 1) * u_extent + x + 1] : 0;
+
+          // Find smallest set label;
+          unsigned int curLabel = static_cast<unsigned int>(map.size());
+
+          curLabel = (w != 0) ?
+            (std::min<unsigned int>)(curLabel, w) : curLabel;
+
+          curLabel = (n != 0) ?
+            (std::min<unsigned int>)(curLabel, n) : curLabel;
+
+          curLabel = (nw != 0) ?
+            (std::min<unsigned int>)(curLabel, nw) : curLabel;
+
+          curLabel = (ne != 0) ? 
+            (std::min<unsigned int>)(curLabel, ne) : curLabel;
+
+          // Update merge map.
+          if (curLabel != map.size()) {
+            if (w > curLabel) update_label(map, w, curLabel);
+            if (nw > curLabel) update_label(map, nw, curLabel);
+            if (n > curLabel) update_label(map, n, curLabel);
+            if (ne > curLabel) update_label(map, ne, curLabel);
+          }
+          else map.push_back(static_cast<unsigned int>(map.size()));
+
+          bitmap[y * u_extent + x] = curLabel;
+        }
+      }
+
+      // post_wrap to handle boundaries in different shape types.
+      if (map.size() > 3)
+        post_wrap(bitmap, u_extent, v_extent, map);
+
+      // Propagate label changes
+      for (unsigned int j = 3; j < static_cast<unsigned int>(map.size()); j++)
+        update_label(map, j, map[j]);
+
+      // Update labels
+      for (std::size_t y = 0;y<v_extent;y++)
+        for (std::size_t x = 0;x<u_extent;x++) {
+          unsigned int label = bitmap[y * u_extent + x];
+
+          if (!label)
+            continue;
+
+          if (map[label] != label)
+            bitmap[y * u_extent + x] = map[label];
+        }
+
+      // Count points per label.
+      std::vector<unsigned int> count(map.size(), 0);
+
+      for (std::size_t i = 0;i<parameter_space.size();i++) {
+        int u = (int)((parameter_space[i].first - min[0]) / cluster_epsilon);
+        int v = (int)((parameter_space[i].second - min[1]) / cluster_epsilon);
+        
+        u = (u < 0) ? 0 : (((std::size_t)u >= u_extent) ? (int)u_extent - 1 : u);
+        v = (v < 0) ? 0 : (((std::size_t)v >= v_extent) ? (int)v_extent - 1 : v);
+
+        count[bitmap[v * int(u_extent) + u]]++;
+      }
+
+      // Find largest component. Start at index 2 as 0/1 are reserved for
+      // basic free/occupied bitmap labels.
+      unsigned int largest = 2;
+      for (unsigned int i = 3; i < static_cast<unsigned int>(count.size()); i++)
+        largest = (count[largest] < count[i]) ? i : largest;
+
+      // Extract sought-after indices.
+      std::vector<std::size_t> comp_indices;
+      comp_indices.reserve(count[largest]);
+
+      for (std::size_t i = 0;i<parameter_space.size();i++) {
+        int u = (int)((parameter_space[i].first - min[0]) / cluster_epsilon);
+        int v = (int)((parameter_space[i].second - min[1]) / cluster_epsilon);
+        
+        u = (u < 0) ? 0 : (((std::size_t)u >= u_extent) ? (int)u_extent - 1 : u);
+        v = (v < 0) ? 0 : (((std::size_t)v >= v_extent) ? (int)v_extent - 1 : v);
+
+        if (bitmap[v * int(u_extent) + u] == largest)
+          comp_indices.push_back(indices[i]);
+      }
+
+      indices = comp_indices;
+
+      return m_score = indices.size();
+    }
+    
+    /*!
+      Determines the largest cluster with a point-to-point
+      distance not larger than `cluster_epsilon`. This general version performs
+      a region growing within the inliers using a kd-tree.
+     */
+    std::size_t connected_component_kdTree(std::vector<std::size_t> &indices,
+                                           FT cluster_epsilon) {
+      typedef boost::tuple<Point_3, std::size_t> Point_and_size_t;
+      typedef CGAL::Search_traits_adapter<Point_and_size_t,
+        CGAL::Nth_of_tuple_property_map<0, Point_and_size_t>,
+        typename Traits::Search_traits> Search_traits_adapter;
+
+      typedef CGAL::Kd_tree<Search_traits_adapter> Kd_Tree;
+      typedef CGAL::Fuzzy_sphere<Search_traits_adapter> Fuzzy_sphere;
+
+      m_has_connected_component = true;
+      
+      std::vector<Point_and_size_t> pts;
+      std::vector<std::size_t> label_map;
+      pts.resize(indices.size());
+      label_map.resize(indices.size(), 0);
+
+      for (std::size_t i = 0;i < indices.size();i++) {
+        pts[i] = Point_and_size_t(point(indices[i]), i);
+      }
+
+      // construct kd tree
+      Kd_Tree tree(pts.begin(), pts.end());
+      
+      std::stack<std::size_t> stack;
+      std::size_t unlabeled = pts.size();
+      std::size_t label = 1;
+      std::size_t best = 0;
+      std::size_t best_size = 0;
+
+      for (std::size_t i = 0;i<pts.size();i++) {
+        if (label_map[i] != 0)
+          continue;
+
+        std::size_t assigned = 0;
+
+        stack.push(i);
+        while(!stack.empty()) {
+          std::vector<Point_and_size_t> near_points;
+
+          std::size_t p = stack.top();
+          stack.pop();
+
+          Fuzzy_sphere fs(pts[p], cluster_epsilon, 0);
+          tree.search(std::back_inserter(near_points), fs);
+
+          for (std::size_t j = 0;j<near_points.size();j++) {
+            std::size_t index = boost::get<1>(near_points[j]);
+            if (index == p)
+              continue;
+
+            if (label_map[index] != label) {
+              label_map[index] = label;
+              assigned++;
+              stack.push(index);
+            }
+          }
+        }
+        
+        // Track most prominent label and remaining points
+        unlabeled -= assigned;
+        if (assigned > best_size) {
+          best = label;
+          best_size = assigned;
+        }
+
+        label++;
+
+        // Can we stop already?
+        if (unlabeled <= best_size)
+          break;
+      }
+
+      std::vector<std::size_t> tmp_indices;
+      tmp_indices.reserve(best_size);
+      for (std::size_t i = 0;i<pts.size();i++) {
+        if (label_map[i] == best)
+          tmp_indices.push_back(indices[i]);
+      }
+
+      indices = tmp_indices;
+      
+      return indices.size();
+    }
+
+    /*!
+      Computes the squared Euclidean distance from a set of points to the shape.
+      The distances will be stored in the so called parameter.
+     */
+    virtual void squared_distance(const std::vector<std::size_t> &indices,
+                                  std::vector<FT> &distances) const = 0;
+
+    /*!
+      Computes the deviation of the point normal from the surface normal at the
+      projected point in form of the dot product and writes the result into the
+      provided `angles` vector.
+     */
+    virtual void cos_to_normal(const std::vector<std::size_t> &indices,
+                               std::vector<FT> &angles) const = 0;
+
+    /*!
+      Returns minimal number of sample points required for construction.
+     */
+    virtual std::size_t minimum_sample_size() const = 0;
+
+    /*!
+      Retrieves the point location from its index.
+     */
+    typename boost::property_traits< typename Traits::Point_map >::reference
+    point(std::size_t i) const {
+      return get(this->m_point_pmap, *(this->m_first + i));
+    }
+    
+    /*!
+      Retrieves the normal vector from its index.
+     */
+    typename boost::property_traits< typename Traits::Normal_map >::reference
+    normal(std::size_t i) const {
+      return get(this->m_normal_pmap, *(this->m_first + i));
+    }
+
+    /*!
+      Retrieves the traits class.
+     */
+    const Traits&
+    traits() const
+    {
+      return m_traits;
+    }
+
+    /// \cond SKIP_IN_MANUAL
+    struct Compare_by_max_bound {
+        bool operator() (const Shape *a, const Shape *b) {
+            return a->max_bound() < b->max_bound();
+        }
+    };
+      
+    FT expected_value() const {
+      return (m_lower_bound + m_upper_bound) / 2.f;
+    }
+
+    FT inline min_bound() const {
+      return  m_lower_bound;
+    }
+
+    FT inline max_bound() const {
+      return  m_upper_bound;
+    }
+
+    virtual void post_wrap(const std::vector<unsigned int> &bitmap,
+                   const std::size_t &u_extent,
+                   const std::size_t &v_extent,
+                   std::vector<unsigned int> &labels) const {
+      // Avoid compiler warnings about unused parameters.
+      (void) bitmap;
+      (void) u_extent;
+      (void) v_extent;
+      (void) labels;
+    }
+
+    // return last computed score, or -1 if no score yet
+    FT inline score() const {
+      return FT(m_score);
+    } 
+
+    int inline subsets() const {
+      return m_nb_subset_used;
+    }
+
+    // sorting is performed by expected value
+    operator FT() const {
+      return expected_value();
+    }
+
+    void inline update_label(std::vector<unsigned int> &labels, unsigned int i,
+                             unsigned int &new_value) const {
+      if (labels[i] != i)
+        update_label(labels, labels[i], new_value);
+
+      if (new_value < labels[i])
+        labels[i] = new_value;
+      else
+        new_value = labels[i];
+    }
+
+    void update_points(const std::vector<int> &shape_index) {
+      if (!m_indices.size())
+        return;
+      std::size_t start = 0, end = m_indices.size() - 1;
+      while (start < end) {
+        while (shape_index[m_indices[start]] == -1
+          && start < end) start++;
+
+        while (shape_index[m_indices[end]] != -1
+          && start < end) end--;
+
+        if (shape_index[m_indices[start]] != -1
+          && shape_index[m_indices[end]] == -1
+          && start < end) {
+          std::size_t tmp = m_indices[start];
+          m_indices[start] = m_indices[end];
+          m_indices[end] = tmp;
+        }
+      }
+      m_indices.resize(end);
+      m_score = m_indices.size();
+    }
+
+    bool is_valid() const {
+      return m_is_valid;
+    }
+
+    // Two shapes are considered the same if from 18 points randomly selected
+    // from the shapes at least 12 match both shapes
+    bool is_same(const Shape_base *other) const {
+      if (!other)
+        return false;
+      if (other->m_indices.size() == 0)
+        return true;
+
+      const std::size_t num = 9;
+      int score = 0;
+      std::vector<std::size_t> indices(num);
+      for (std::size_t i = 0;i<num;i++)
+        indices[i] = m_indices[get_default_random()(m_indices.size())];
+      
+      std::vector<FT> dists(num), angles(num);
+      other->squared_distance(indices, dists);
+      other->cos_to_normal(indices, angles);
+
+      for (std::size_t i = 0;i<num;i++)
+        if (dists[i] <= m_epsilon && angles[i] > m_normal_threshold)
+          score++;
+
+      if (score < 3)
+        return false;
+
+      for (std::size_t i = 0;i<num;i++)
+        indices[i] = other->m_indices[get_default_random()(other->m_indices.size())];
+
+      this->squared_distance(indices, dists);
+      this->cos_to_normal(indices, angles);
+
+      for (std::size_t i = 0;i<num;i++)
+        if (dists[i] <= m_epsilon && angles[i] > m_normal_threshold)
+          score++;
+
+      return (score >= 12);
+    }
+
+    virtual void parameters(const std::vector<std::size_t>& indices,
+                            std::vector<std::pair<FT, FT> >& parameter_space,
+                            FT &cluster_epsilon,
+                            FT min[2],
+                            FT max[2]) const {
+      // Avoid compiler warnings about unused parameters.
+      (void)indices;
+      (void)parameter_space;
+      (void)cluster_epsilon;
+      (void)min;
+      (void)max;
+    }
+
+    void compute(const std::set<std::size_t>& indices,
+                 Input_iterator first,
+                 Traits traits,
+                 Point_map point_pmap,
+                 Normal_map normal_pmap,
+                 FT epsilon,
+                 FT normal_threshold) {
+      if (indices.size() < minimum_sample_size())
+        return;
+
+      m_first = first;
+      m_traits = traits;
+      m_point_pmap = point_pmap;
+      m_normal_pmap = normal_pmap;
+      m_epsilon = epsilon;
+      m_normal_threshold = normal_threshold;
+
+      std::vector<std::size_t> output(indices.begin(), indices.end());
+
+      create_shape(output);
+    }
+
+    inline bool operator<(const Shape &c) const {
+      return expected_value() < c.expected_value();
+    }
+
+    std::size_t cost_function(FT epsilon,
+                         FT normal_threshold,
+                         const std::vector<std::size_t> &indices) {
+      std::vector<FT> dists, angles;
+      dists.resize(indices.size());
+      squared_distance(indices, dists);
+      angles.resize(indices.size());
+      cos_to_normal(indices, angles);
+
+      std::size_t score_before = m_indices.size();
+
+      FT eps = epsilon * epsilon;
+      for (std::size_t i = 0;i<indices.size();i++) {
+          if (dists[i] <= eps && angles[i] > normal_threshold)
+            m_indices.push_back(indices[i]);
+        }
+
+      return m_indices.size() - score_before;
+    }
+
+    template<typename T> bool is_finite(T arg) {
+      return arg == arg && 
+        arg != std::numeric_limits<T>::infinity() &&
+        arg != -std::numeric_limits<T>::infinity();
+    }
+
+    void compute_bound(const std::size_t num_evaluated_points,
+                       const std::size_t num_available_points) {
+      hypergeometrical_dist(-2 - num_evaluated_points,
+                            -2 - num_available_points,
+                            -1 - signed(m_indices.size()),
+                            m_lower_bound, m_upper_bound);
+
+      m_lower_bound = -1 - m_lower_bound;
+      m_upper_bound = -1 - m_upper_bound;
+    }
+
+    void hypergeometrical_dist(const std::ptrdiff_t UN, 
+                               const std::ptrdiff_t x,
+                               const std::ptrdiff_t n, 
+                               FT &low,
+                               FT &high) {                           
+      const FT q = FT(x * n * double(UN - x) * (UN - n) / (UN - 1));
+      const FT sq = CGAL::sqrt(q);
+      low  = (x * n - sq) / UN;
+      high = (x * n + sq)/UN;
+
+      if (!is_finite<FT>(low) || !is_finite<FT>(high)) {
+        low = high = 0;
+      }
+    }
+
+
+    virtual bool supports_connected_component() const {
+      return false;
+    };
+
+    
+    // ------------------------------------------------------------------------
+    // Utilities
+    // ------------------------------------------------------------------------
+    FT get_x(const Vector_3& v) const { return m_traits.compute_x_3_object()(v); }
+    FT get_y(const Vector_3& v) const { return m_traits.compute_y_3_object()(v); }
+    FT get_z(const Vector_3& v) const { return m_traits.compute_z_3_object()(v); }
+    FT get_x(const Point_3& p) const { return m_traits.compute_x_3_object()(p); }
+    FT get_y(const Point_3& p) const { return m_traits.compute_y_3_object()(p); }
+    FT get_z(const Point_3& p) const { return m_traits.compute_z_3_object()(p); }
+    
+    Point_3 constr_pt() const
+    { return m_traits.construct_point_3_object()(ORIGIN); }
+    Point_3 constr_pt(FT x, FT y, FT z) const
+    { return m_traits.construct_point_3_object()(x, y, z); }
+    Vector_3 constr_vec() const
+    { return m_traits.construct_vector_3_object()(NULL_VECTOR); }
+    Vector_3 constr_vec(const Point_3& p, const Point_3& q) const
+    { return m_traits.construct_vector_3_object()(p, q); }
+
+    FT sqlen(const Vector_3& v) const
+    { return m_traits.compute_squared_length_3_object()(v); }
+    Vector_3 scale(const Vector_3& v, FT scale) const
+    { return m_traits.construct_scaled_vector_3_object()(v, scale); }
+    Vector_3 sum_vectors(const Vector_3& u, const Vector_3& v) const
+    { return m_traits.construct_sum_of_vectors_3_object()(u, v); }
+    Point_3 transl(const Point_3& p, const Vector_3 &v) const
+    { return m_traits.construct_translated_point_3_object()(p, v); }
+    FT scalar_pdct(const Vector_3& u, const Vector_3& v) const
+    { return m_traits.compute_scalar_product_3_object()(u, v); }
+    Vector_3 cross_pdct(const Vector_3& u, const Vector_3& v) const
+    { return m_traits.construct_cross_product_vector_3_object()(u, v); }
+
+  protected:
+    /// \endcond
+    // 
+    /// \cond SKIP_IN_MANUAL
+    /*!
+      Contains indices of the inliers of the candidate, access
+      to the point and normal data is provided via property maps.
+     */
+    std::vector<std::size_t> m_indices;
+
+    FT m_epsilon;
+
+    //deviation of normal, used during first check of the 3 normal
+    FT m_normal_threshold;
+
+    bool m_is_valid;
+    FT m_lower_bound;
+    FT m_upper_bound;
+
+    std::size_t m_score;
+
+    FT m_sum_expected_value;
+
+    //count the number of subset used so far for the score,
+    //and thus indicate the next one to use
+    std::size_t m_nb_subset_used;
+    bool m_has_connected_component;
+
+    Input_iterator m_first;
+
+    Traits m_traits;
+    Point_map m_point_pmap;
+    Normal_map m_normal_pmap;
+    /// \endcond
+  };  
+}
+}
+#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Shape_detection_3/Sphere.h b/3rdparty/CGAL/include/CGAL/Shape_detection_3/Sphere.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Shape_detection_3/Sphere.h
rename to 3rdparty/CGAL/include/CGAL/Shape_detection_3/Sphere.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Shape_detection_3/Torus.h b/3rdparty/CGAL/include/CGAL/Shape_detection_3/Torus.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Shape_detection_3/Torus.h
rename to 3rdparty/CGAL/include/CGAL/Shape_detection_3/Torus.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Side_of_bounded_square_2.h b/3rdparty/CGAL/include/CGAL/Side_of_bounded_square_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Side_of_bounded_square_2.h
rename to 3rdparty/CGAL/include/CGAL/Side_of_bounded_square_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Side_of_oriented_square_2.h b/3rdparty/CGAL/include/CGAL/Side_of_oriented_square_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Side_of_oriented_square_2.h
rename to 3rdparty/CGAL/include/CGAL/Side_of_oriented_square_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Side_of_triangle_mesh.h b/3rdparty/CGAL/include/CGAL/Side_of_triangle_mesh.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Side_of_triangle_mesh.h
rename to 3rdparty/CGAL/include/CGAL/Side_of_triangle_mesh.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Simple_cartesian.h b/3rdparty/CGAL/include/CGAL/Simple_cartesian.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Simple_cartesian.h
rename to 3rdparty/CGAL/include/CGAL/Simple_cartesian.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Simple_circular_kernel_2.h b/3rdparty/CGAL/include/CGAL/Simple_circular_kernel_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Simple_circular_kernel_2.h
rename to 3rdparty/CGAL/include/CGAL/Simple_circular_kernel_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Simple_homogeneous.h b/3rdparty/CGAL/include/CGAL/Simple_homogeneous.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Simple_homogeneous.h
rename to 3rdparty/CGAL/include/CGAL/Simple_homogeneous.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Simple_polygon_visibility_2.h b/3rdparty/CGAL/include/CGAL/Simple_polygon_visibility_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Simple_polygon_visibility_2.h
rename to 3rdparty/CGAL/include/CGAL/Simple_polygon_visibility_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Simple_spherical_kernel_3.h b/3rdparty/CGAL/include/CGAL/Simple_spherical_kernel_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Simple_spherical_kernel_3.h
rename to 3rdparty/CGAL/include/CGAL/Simple_spherical_kernel_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sixtuple.h b/3rdparty/CGAL/include/CGAL/Sixtuple.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sixtuple.h
rename to 3rdparty/CGAL/include/CGAL/Sixtuple.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Skin_surface_3.h b/3rdparty/CGAL/include/CGAL/Skin_surface_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Skin_surface_3.h
rename to 3rdparty/CGAL/include/CGAL/Skin_surface_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Skin_surface_base_3.h b/3rdparty/CGAL/include/CGAL/Skin_surface_base_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Skin_surface_base_3.h
rename to 3rdparty/CGAL/include/CGAL/Skin_surface_base_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Skin_surface_filtered_traits_3.h b/3rdparty/CGAL/include/CGAL/Skin_surface_filtered_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Skin_surface_filtered_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/Skin_surface_filtered_traits_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Skin_surface_marching_tetrahedra_observer_3.h b/3rdparty/CGAL/include/CGAL/Skin_surface_marching_tetrahedra_observer_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Skin_surface_marching_tetrahedra_observer_3.h
rename to 3rdparty/CGAL/include/CGAL/Skin_surface_marching_tetrahedra_observer_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Skin_surface_polyhedral_items_3.h b/3rdparty/CGAL/include/CGAL/Skin_surface_polyhedral_items_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Skin_surface_polyhedral_items_3.h
rename to 3rdparty/CGAL/include/CGAL/Skin_surface_polyhedral_items_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Skin_surface_polyhedral_items_with_face_information.h b/3rdparty/CGAL/include/CGAL/Skin_surface_polyhedral_items_with_face_information.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Skin_surface_polyhedral_items_with_face_information.h
rename to 3rdparty/CGAL/include/CGAL/Skin_surface_polyhedral_items_with_face_information.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Skin_surface_quadratic_surface_3.h b/3rdparty/CGAL/include/CGAL/Skin_surface_quadratic_surface_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Skin_surface_quadratic_surface_3.h
rename to 3rdparty/CGAL/include/CGAL/Skin_surface_quadratic_surface_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Skin_surface_refinement_policy_3.h b/3rdparty/CGAL/include/CGAL/Skin_surface_refinement_policy_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Skin_surface_refinement_policy_3.h
rename to 3rdparty/CGAL/include/CGAL/Skin_surface_refinement_policy_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Skin_surface_traits_3.h b/3rdparty/CGAL/include/CGAL/Skin_surface_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Skin_surface_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/Skin_surface_traits_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Skiplist.h b/3rdparty/CGAL/include/CGAL/Skiplist.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Skiplist.h
rename to 3rdparty/CGAL/include/CGAL/Skiplist.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Small_side_angle_bisector_decomposition_2.h b/3rdparty/CGAL/include/CGAL/Small_side_angle_bisector_decomposition_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Small_side_angle_bisector_decomposition_2.h
rename to 3rdparty/CGAL/include/CGAL/Small_side_angle_bisector_decomposition_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Snap_rounding_2.h b/3rdparty/CGAL/include/CGAL/Snap_rounding_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Snap_rounding_2.h
rename to 3rdparty/CGAL/include/CGAL/Snap_rounding_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Snap_rounding_kd_2.h b/3rdparty/CGAL/include/CGAL/Snap_rounding_kd_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Snap_rounding_kd_2.h
rename to 3rdparty/CGAL/include/CGAL/Snap_rounding_kd_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Snap_rounding_traits_2.h b/3rdparty/CGAL/include/CGAL/Snap_rounding_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Snap_rounding_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Snap_rounding_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sorted_matrix_search_traits_adaptor.h b/3rdparty/CGAL/include/CGAL/Sorted_matrix_search_traits_adaptor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sorted_matrix_search_traits_adaptor.h
rename to 3rdparty/CGAL/include/CGAL/Sorted_matrix_search_traits_adaptor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Spatial_lock_grid_3.h b/3rdparty/CGAL/include/CGAL/Spatial_lock_grid_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Spatial_lock_grid_3.h
rename to 3rdparty/CGAL/include/CGAL/Spatial_lock_grid_3.h
diff --git a/3rdparty/CGAL/include/CGAL/Spatial_sort_traits_adapter_2.h b/3rdparty/CGAL/include/CGAL/Spatial_sort_traits_adapter_2.h
new file mode 100644
index 0000000..4e3fc07
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Spatial_sort_traits_adapter_2.h
@@ -0,0 +1,73 @@
+// Copyright (c) 2011  GeometryFactory (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Sebastien Loriot
+
+
+#ifndef CGAL_SPATIAL_SORT_TRAITS_ADAPTER_2_H
+#define CGAL_SPATIAL_SORT_TRAITS_ADAPTER_2_H
+
+#include <boost/call_traits.hpp>
+
+#include <CGAL/property_map.h>
+
+
+namespace CGAL{
+  
+using ::get;
+
+template<class Base_traits,class PointPropertyMap>
+class Spatial_sort_traits_adapter_2:public Base_traits{
+  PointPropertyMap ppmap_;
+public:
+  Spatial_sort_traits_adapter_2(Base_traits base=Base_traits()):Base_traits(base){}
+
+  Spatial_sort_traits_adapter_2(const PointPropertyMap& ppmap,Base_traits base=Base_traits())
+  :Base_traits(base),ppmap_(ppmap){}
+
+  typedef Base_traits Gt;
+  typedef typename boost::property_traits<PointPropertyMap>::key_type Point_2;
+  typedef typename boost::call_traits<Point_2>::param_type Arg_type;
+
+  struct Less_x_2 : public Base_traits::Less_x_2{
+    Less_x_2(const PointPropertyMap& ppmap,const typename Base_traits::Less_x_2& base):
+      Base_traits::Less_x_2(base),ppmap_(ppmap){}
+    const PointPropertyMap& ppmap_;
+    bool operator()(Arg_type p,Arg_type q) const {
+      return static_cast<const typename Base_traits::Less_x_2*>(this)->operator()(get(ppmap_,p),get(ppmap_,q));
+    }
+  };
+
+  struct Less_y_2 : public Base_traits::Less_y_2{
+    Less_y_2(const PointPropertyMap& ppmap,const typename Base_traits::Less_y_2& base):
+      Base_traits::Less_y_2(base),ppmap_(ppmap){}
+    const PointPropertyMap& ppmap_;
+    bool operator()(Arg_type p,Arg_type q) const {
+      return static_cast<const typename Base_traits::Less_y_2*>(this)->operator()(get(ppmap_,p),get(ppmap_,q));
+    }
+  };
+
+  Less_x_2 less_x_2_object () const {return Less_x_2(ppmap_,static_cast<const Gt*>(this)->less_x_2_object() );}
+  Less_y_2 less_y_2_object () const {return Less_y_2(ppmap_,static_cast<const Gt*>(this)->less_y_2_object() );}
+  
+  const PointPropertyMap& point_property_map() const {return ppmap_;}
+
+};
+
+} //namespace CGAL
+
+#endif //CGAL_SPATIAL_SORT_TRAITS_ADAPTER_2_H
diff --git a/3rdparty/CGAL/include/CGAL/Spatial_sort_traits_adapter_3.h b/3rdparty/CGAL/include/CGAL/Spatial_sort_traits_adapter_3.h
new file mode 100644
index 0000000..ebb4f39
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Spatial_sort_traits_adapter_3.h
@@ -0,0 +1,83 @@
+// Copyright (c) 2011  GeometryFactory (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Sebastien Loriot
+
+
+#ifndef CGAL_SPATIAL_SORT_TRAITS_ADAPTER_3_H
+#define CGAL_SPATIAL_SORT_TRAITS_ADAPTER_3_H
+
+#include <boost/call_traits.hpp>
+
+#include <CGAL/property_map.h>
+
+
+namespace CGAL{
+
+using ::get;
+  
+template<class Base_traits,class PointPropertyMap>
+class Spatial_sort_traits_adapter_3:public Base_traits{
+  PointPropertyMap ppmap_;
+public:
+  Spatial_sort_traits_adapter_3(Base_traits base=Base_traits()):Base_traits(base){}
+
+  Spatial_sort_traits_adapter_3(const PointPropertyMap& ppmap,Base_traits base=Base_traits())
+  :Base_traits(base),ppmap_(ppmap){}
+
+  typedef Base_traits Gt;
+  typedef typename boost::property_traits<PointPropertyMap>::key_type Point_3;
+  typedef typename boost::call_traits<Point_3>::param_type Arg_type;
+
+  struct Less_x_3 : public Base_traits::Less_x_3{
+    Less_x_3(const PointPropertyMap& ppmap,const typename Base_traits::Less_x_3& base):
+      Base_traits::Less_x_3(base),ppmap_(ppmap){}
+    const PointPropertyMap& ppmap_;
+    bool operator()(Arg_type p,Arg_type q) const {
+      return static_cast<const typename Base_traits::Less_x_3*>(this)->operator()(get(ppmap_,p),get(ppmap_,q));
+    }
+  };
+
+  struct Less_y_3 : public Base_traits::Less_y_3{
+    Less_y_3(const PointPropertyMap& ppmap,const typename Base_traits::Less_y_3& base):
+      Base_traits::Less_y_3(base),ppmap_(ppmap){}
+    const PointPropertyMap& ppmap_;
+    bool operator()(Arg_type p,Arg_type q) const {
+      return static_cast<const typename Base_traits::Less_y_3*>(this)->operator()(get(ppmap_,p),get(ppmap_,q));
+    }
+  };
+
+  struct Less_z_3 : public Base_traits::Less_z_3{
+    Less_z_3(const PointPropertyMap& ppmap,const typename Base_traits::Less_z_3& base):
+      Base_traits::Less_z_3(base),ppmap_(ppmap){}
+    const PointPropertyMap& ppmap_;
+    bool operator()(Arg_type p,Arg_type q) const {
+      return static_cast<const typename Base_traits::Less_z_3*>(this)->operator()(get(ppmap_,p),get(ppmap_,q));
+    }
+  };
+
+  Less_x_3 less_x_3_object () const {return Less_x_3(ppmap_,static_cast<const Gt*>(this)->less_x_3_object() );}
+  Less_y_3 less_y_3_object () const {return Less_y_3(ppmap_,static_cast<const Gt*>(this)->less_y_3_object() );}
+  Less_z_3 less_z_3_object () const {return Less_z_3(ppmap_,static_cast<const Gt*>(this)->less_z_3_object() );}
+  
+  const PointPropertyMap& point_property_map() const {return ppmap_;}
+  
+};
+
+} //namespace CGAL
+
+#endif //CGAL_SPATIAL_SORT_TRAITS_ADAPTER_3_H
diff --git a/3rdparty/CGAL/include/CGAL/Spatial_sort_traits_adapter_d.h b/3rdparty/CGAL/include/CGAL/Spatial_sort_traits_adapter_d.h
new file mode 100644
index 0000000..b7b34cf
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Spatial_sort_traits_adapter_d.h
@@ -0,0 +1,87 @@
+// Copyright (c) 2011  GeometryFactory (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Sebastien Loriot
+
+
+#ifndef CGAL_SPATIAL_SORT_TRAITS_ADAPTER_D_H
+#define CGAL_SPATIAL_SORT_TRAITS_ADAPTER_D_H
+
+#include <boost/call_traits.hpp>
+
+#include <CGAL/property_map.h>
+
+namespace CGAL{
+
+using ::get;
+  
+template<class Base_traits,class PointPropertyMap>
+class Spatial_sort_traits_adapter_d:public Base_traits{
+  PointPropertyMap ppmap_;
+public:
+  Spatial_sort_traits_adapter_d(Base_traits base=Base_traits()):Base_traits(base){}
+
+  Spatial_sort_traits_adapter_d(const PointPropertyMap& ppmap,Base_traits base=Base_traits())
+  :Base_traits(base),ppmap_(ppmap){}
+
+  typedef Base_traits Gt;
+  typedef typename boost::property_traits<PointPropertyMap>::key_type Point_d;
+  typedef typename boost::call_traits<Point_d>::param_type Arg_type;
+
+    
+    
+  struct Point_dimension_d: public Base_traits::Point_dimension_d{
+    Point_dimension_d(const PointPropertyMap& ppmap,const typename Base_traits::Point_dimension_d& base):
+      Base_traits::Point_dimension_d(base),ppmap_(ppmap){}
+    const PointPropertyMap& ppmap_;
+    int operator()(Arg_type p) const {
+      return static_cast<const typename Base_traits::Point_dimension_d*>(this)->operator()(get(ppmap_,p));
+    }
+  };
+
+  struct Less_coordinate_d: public Base_traits::Less_coordinate_d{
+    Less_coordinate_d(const PointPropertyMap& ppmap,const typename Base_traits::Less_coordinate_d& base):
+      Base_traits::Less_coordinate_d(base),ppmap_(ppmap){}
+    const PointPropertyMap& ppmap_;
+    bool operator()(Arg_type p,Arg_type q,int i) const {
+      return static_cast<const typename Base_traits::Less_coordinate_d*>(this)->operator()(get(ppmap_,p),get(ppmap_,q),i);
+    }
+  };
+
+
+  struct Compute_coordinate_d: public Base_traits::Compute_coordinate_d{
+    Compute_coordinate_d(const PointPropertyMap& ppmap,const typename Base_traits::Compute_coordinate_d& base):
+      Base_traits::Compute_coordinate_d(base),ppmap_(ppmap){}
+    const PointPropertyMap& ppmap_;
+    bool operator()(Arg_type p,int i) const {
+      return static_cast<const typename Base_traits::Compute_coordinate_d*>(this)->operator()(get(ppmap_,p),i);
+    }
+  };
+ 
+ 
+
+  Point_dimension_d point_dimension_d_object () const {return Point_dimension_d(ppmap_,static_cast<const Gt*>(this)->point_dimension_d_object() );}
+  Less_coordinate_d less_coordinate_d_object () const {return Less_coordinate_d(ppmap_,static_cast<const Gt*>(this)->less_coordinate_d_object() );}
+  Compute_coordinate_d compute_coordinate_d_object () const {return Compute_coordinate_d(ppmap_,static_cast<const Gt*>(this)->compute_coordinate_d_object() );}
+  
+  const PointPropertyMap& point_property_map() const {return ppmap_;}
+  
+};
+
+} //namespace CGAL
+
+#endif //CGAL_SPATIAL_SORT_TRAITS_ADAPTER_D_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sphere_3.h b/3rdparty/CGAL/include/CGAL/Sphere_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sphere_3.h
rename to 3rdparty/CGAL/include/CGAL/Sphere_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Spherical_kernel_3.h b/3rdparty/CGAL/include/CGAL/Spherical_kernel_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Spherical_kernel_3.h
rename to 3rdparty/CGAL/include/CGAL/Spherical_kernel_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Spherical_kernel_intersections.h b/3rdparty/CGAL/include/CGAL/Spherical_kernel_intersections.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Spherical_kernel_intersections.h
rename to 3rdparty/CGAL/include/CGAL/Spherical_kernel_intersections.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Spherical_kernel_type_equality_wrapper.h b/3rdparty/CGAL/include/CGAL/Spherical_kernel_type_equality_wrapper.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Spherical_kernel_type_equality_wrapper.h
rename to 3rdparty/CGAL/include/CGAL/Spherical_kernel_type_equality_wrapper.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Splitters.h b/3rdparty/CGAL/include/CGAL/Splitters.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Splitters.h
rename to 3rdparty/CGAL/include/CGAL/Splitters.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sqrt_extension.h b/3rdparty/CGAL/include/CGAL/Sqrt_extension.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sqrt_extension.h
rename to 3rdparty/CGAL/include/CGAL/Sqrt_extension.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sqrt_extension/Algebraic_extension_traits.h b/3rdparty/CGAL/include/CGAL/Sqrt_extension/Algebraic_extension_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sqrt_extension/Algebraic_extension_traits.h
rename to 3rdparty/CGAL/include/CGAL/Sqrt_extension/Algebraic_extension_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sqrt_extension/Algebraic_structure_traits.h b/3rdparty/CGAL/include/CGAL/Sqrt_extension/Algebraic_structure_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sqrt_extension/Algebraic_structure_traits.h
rename to 3rdparty/CGAL/include/CGAL/Sqrt_extension/Algebraic_structure_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sqrt_extension/Chinese_remainder_traits.h b/3rdparty/CGAL/include/CGAL/Sqrt_extension/Chinese_remainder_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sqrt_extension/Chinese_remainder_traits.h
rename to 3rdparty/CGAL/include/CGAL/Sqrt_extension/Chinese_remainder_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sqrt_extension/Coercion_traits.h b/3rdparty/CGAL/include/CGAL/Sqrt_extension/Coercion_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sqrt_extension/Coercion_traits.h
rename to 3rdparty/CGAL/include/CGAL/Sqrt_extension/Coercion_traits.h
diff --git a/3rdparty/CGAL/include/CGAL/Sqrt_extension/Eigen_NumTraits.h b/3rdparty/CGAL/include/CGAL/Sqrt_extension/Eigen_NumTraits.h
new file mode 100644
index 0000000..725e8b1
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Sqrt_extension/Eigen_NumTraits.h
@@ -0,0 +1,49 @@
+// Copyright (c) 2006-2008 Max-Planck-Institute Saarbruecken (Germany).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Michael Hemmer   <hemmer at mpi-inf.mpg.de>
+
+
+#ifndef CGAL_SQRT_EXTENSION_EIGEN_NUMTRAITS_H
+#define CGAL_SQRT_EXTENSION_EIGEN_NUMTRAITS_H
+
+namespace Eigen {
+  template<class> struct NumTraits;
+  template <class NT,class ROOT, class ACDE_TAG, class FP_TAG>
+  struct NumTraits<CGAL::Sqrt_extension<NT, ROOT, ACDE_TAG, FP_TAG> >
+  {
+    typedef CGAL::Sqrt_extension<NT, ROOT, ACDE_TAG, FP_TAG> Real;
+    typedef Real NonInteger;
+    typedef Real Nested;
+    typedef Real Literal;
+
+    static inline Real epsilon() { return NumTraits<NT>::epsilon(); }
+
+    enum {
+      IsInteger = 0,
+      IsSigned = 1,
+      IsComplex = 0,
+      RequireInitialization = 1,
+      ReadCost = 2*NumTraits<NT>::ReadCost+NumTraits<ROOT>::ReadCost,
+      AddCost = 2*NumTraits<NT>::AddCost+NumTraits<ROOT>::ReadCost,
+      MulCost = 5*NumTraits<NT>::MulCost+2*NumTraits<NT>::AddCost
+    };
+  };
+}
+
+#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sqrt_extension/Fraction_traits.h b/3rdparty/CGAL/include/CGAL/Sqrt_extension/Fraction_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sqrt_extension/Fraction_traits.h
rename to 3rdparty/CGAL/include/CGAL/Sqrt_extension/Fraction_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sqrt_extension/Get_arithmetic_kernel.h b/3rdparty/CGAL/include/CGAL/Sqrt_extension/Get_arithmetic_kernel.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sqrt_extension/Get_arithmetic_kernel.h
rename to 3rdparty/CGAL/include/CGAL/Sqrt_extension/Get_arithmetic_kernel.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sqrt_extension/Modular_traits.h b/3rdparty/CGAL/include/CGAL/Sqrt_extension/Modular_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sqrt_extension/Modular_traits.h
rename to 3rdparty/CGAL/include/CGAL/Sqrt_extension/Modular_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sqrt_extension/Real_embeddable_traits.h b/3rdparty/CGAL/include/CGAL/Sqrt_extension/Real_embeddable_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sqrt_extension/Real_embeddable_traits.h
rename to 3rdparty/CGAL/include/CGAL/Sqrt_extension/Real_embeddable_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sqrt_extension/Scalar_factor_traits.h b/3rdparty/CGAL/include/CGAL/Sqrt_extension/Scalar_factor_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sqrt_extension/Scalar_factor_traits.h
rename to 3rdparty/CGAL/include/CGAL/Sqrt_extension/Scalar_factor_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sqrt_extension/Sqrt_extension_type.h b/3rdparty/CGAL/include/CGAL/Sqrt_extension/Sqrt_extension_type.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sqrt_extension/Sqrt_extension_type.h
rename to 3rdparty/CGAL/include/CGAL/Sqrt_extension/Sqrt_extension_type.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sqrt_extension/Wang_traits.h b/3rdparty/CGAL/include/CGAL/Sqrt_extension/Wang_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sqrt_extension/Wang_traits.h
rename to 3rdparty/CGAL/include/CGAL/Sqrt_extension/Wang_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sqrt_extension/convert_to_bfi.h b/3rdparty/CGAL/include/CGAL/Sqrt_extension/convert_to_bfi.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sqrt_extension/convert_to_bfi.h
rename to 3rdparty/CGAL/include/CGAL/Sqrt_extension/convert_to_bfi.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sqrt_extension/io.h b/3rdparty/CGAL/include/CGAL/Sqrt_extension/io.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sqrt_extension/io.h
rename to 3rdparty/CGAL/include/CGAL/Sqrt_extension/io.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sqrt_extension_fwd.h b/3rdparty/CGAL/include/CGAL/Sqrt_extension_fwd.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sqrt_extension_fwd.h
rename to 3rdparty/CGAL/include/CGAL/Sqrt_extension_fwd.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Square_border_parameterizer_3.h b/3rdparty/CGAL/include/CGAL/Square_border_parameterizer_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Square_border_parameterizer_3.h
rename to 3rdparty/CGAL/include/CGAL/Square_border_parameterizer_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Straight_2.h b/3rdparty/CGAL/include/CGAL/Straight_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Straight_2.h
rename to 3rdparty/CGAL/include/CGAL/Straight_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Straight_skeleton_2.h b/3rdparty/CGAL/include/CGAL/Straight_skeleton_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Straight_skeleton_2.h
rename to 3rdparty/CGAL/include/CGAL/Straight_skeleton_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Straight_skeleton_2/Polygon_offset_builder_2_impl.h b/3rdparty/CGAL/include/CGAL/Straight_skeleton_2/Polygon_offset_builder_2_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Straight_skeleton_2/Polygon_offset_builder_2_impl.h
rename to 3rdparty/CGAL/include/CGAL/Straight_skeleton_2/Polygon_offset_builder_2_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Straight_skeleton_2/Straight_skeleton_aux.h b/3rdparty/CGAL/include/CGAL/Straight_skeleton_2/Straight_skeleton_aux.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Straight_skeleton_2/Straight_skeleton_aux.h
rename to 3rdparty/CGAL/include/CGAL/Straight_skeleton_2/Straight_skeleton_aux.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_2_impl.h b/3rdparty/CGAL/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_2_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_2_impl.h
rename to 3rdparty/CGAL/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_2_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_events_2.h b/3rdparty/CGAL/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_events_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_events_2.h
rename to 3rdparty/CGAL/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_events_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_traits_2_aux.h b/3rdparty/CGAL/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_traits_2_aux.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_traits_2_aux.h
rename to 3rdparty/CGAL/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_traits_2_aux.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Straight_skeleton_2/assertions.h b/3rdparty/CGAL/include/CGAL/Straight_skeleton_2/assertions.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Straight_skeleton_2/assertions.h
rename to 3rdparty/CGAL/include/CGAL/Straight_skeleton_2/assertions.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Straight_skeleton_2/debug.h b/3rdparty/CGAL/include/CGAL/Straight_skeleton_2/debug.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Straight_skeleton_2/debug.h
rename to 3rdparty/CGAL/include/CGAL/Straight_skeleton_2/debug.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Straight_skeleton_2/test.h b/3rdparty/CGAL/include/CGAL/Straight_skeleton_2/test.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Straight_skeleton_2/test.h
rename to 3rdparty/CGAL/include/CGAL/Straight_skeleton_2/test.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Straight_skeleton_builder_2.h b/3rdparty/CGAL/include/CGAL/Straight_skeleton_builder_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Straight_skeleton_builder_2.h
rename to 3rdparty/CGAL/include/CGAL/Straight_skeleton_builder_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Straight_skeleton_builder_traits_2.h b/3rdparty/CGAL/include/CGAL/Straight_skeleton_builder_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Straight_skeleton_builder_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Straight_skeleton_builder_traits_2.h
diff --git a/3rdparty/CGAL/include/CGAL/Straight_skeleton_converter_2.h b/3rdparty/CGAL/include/CGAL/Straight_skeleton_converter_2.h
new file mode 100644
index 0000000..cd95bf9
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Straight_skeleton_converter_2.h
@@ -0,0 +1,304 @@
+// Copyright (c) 2005-2008 Fernando Luis Cacciola Carballal. 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
+// 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(s)     : Fernando Cacciola <fernando_cacciola at ciudad.com.ar>
+
+#ifndef CGAL_STRAIGHT_SKELETON_CONVERTER_2_H
+#define CGAL_STRAIGHT_SKELETON_CONVERTER_2_H 1
+
+#include <boost/shared_ptr.hpp>
+
+#include <CGAL/Straight_skeleton_2.h>
+
+namespace CGAL {
+
+template<class Source_skeleton_
+        ,class Target_skeleton_
+        ,class NT_converter = typename internal::Default_converter<typename Source_skeleton_::Traits
+                                                               ,typename Target_skeleton_::Traits
+                                                               >::Type 
+        >
+struct Straight_skeleton_items_converter_2: Cartesian_converter< typename Source_skeleton_::Traits
+                                                               , typename Target_skeleton_::Traits
+                                                               , NT_converter
+                                                               >
+{
+  typedef Source_skeleton_ Source_skeleton ;
+  typedef Target_skeleton_ Target_skeleton ;
+  
+  typedef typename Source_skeleton::Traits Source_traits ;
+  typedef typename Target_skeleton::Traits Target_traits ;
+  
+  typedef Cartesian_converter<Source_traits,Target_traits> Base ;
+  
+  typedef typename Source_skeleton::Vertex_const_handle   Source_vertex_const_handle ;
+  typedef typename Source_skeleton::Halfedge_const_handle Source_halfedge_const_handle ;
+  typedef typename Source_skeleton::Face_const_handle     Source_face_const_handle  ;
+  
+  typedef typename Target_skeleton::Vertex    Target_vertex ;
+  typedef typename Target_skeleton::Halfedge  Target_halfedge ;
+  typedef typename Target_skeleton::Face      Target_face ;
+  
+  Target_vertex operator() ( Source_vertex_const_handle aV ) const 
+  {
+    CGAL_assertion( handle_assigned(aV) ) ;
+    
+    return Target_vertex( aV->id()
+                        , this->Base::operator()(aV->point())
+                        , this->Base::operator()(aV->time ())
+                        , aV->is_split()
+                        , aV->has_infinite_time()
+                        ) ;
+  }
+  
+  Target_halfedge operator() ( Source_halfedge_const_handle aH ) const 
+  {
+    CGAL_assertion( handle_assigned(aH) ) ;
+    
+    return Target_halfedge( aH->id(), aH->slope() ) ;
+  }
+  
+  Target_face operator() ( Source_face_const_handle aF ) const 
+  {
+    CGAL_assertion( handle_assigned(aF) ) ;
+    
+    return Target_face( aF->id() );
+  }
+} ;
+
+template<class Source_skeleton_, class Target_skeleton_, class Items_converter_>
+struct Straight_skeleton_converter_2
+{
+  typedef Source_skeleton_ Source_skeleton ;
+  typedef Target_skeleton_ Target_skeleton ;
+  typedef Items_converter_ Items_converter ;
+  
+  typedef typename Source_skeleton::Traits Source_traits ;
+  typedef typename Target_skeleton::Traits Target_traits ;
+  
+  typedef boost::shared_ptr<Target_skeleton> Target_skeleton_ptr ;
+  
+  typedef typename Source_skeleton::Vertex_const_iterator   Source_vertex_const_iterator ;
+  typedef typename Source_skeleton::Halfedge_const_iterator Source_halfedge_const_iterator ;
+  typedef typename Source_skeleton::Face_const_iterator     Source_face_const_iterator  ;
+  
+  typedef typename Source_skeleton::Halfedge_handle Source_halfedge_handle ;
+  
+  typedef typename Target_skeleton::Vertex   Target_vertex ;
+  typedef typename Target_skeleton::Halfedge Target_halfedge ;
+  typedef typename Target_skeleton::Face     Target_face ;
+  
+  typedef typename Target_skeleton::Vertex_handle   Target_vertex_handle ;
+  typedef typename Target_skeleton::Halfedge_handle Target_halfedge_handle ;
+  typedef typename Target_skeleton::Face_handle     Target_face_handle  ;
+  
+  typedef typename Target_skeleton::Vertex_iterator   Target_vertex_iterator ;
+  typedef typename Target_skeleton::Halfedge_iterator Target_halfedge_iterator ;
+  typedef typename Target_skeleton::Face_iterator     Target_face_iterator  ;
+
+  typedef typename Target_skeleton::Base      SlsBase ;
+  typedef typename Target_halfedge::Base_base HBase_base ;
+  typedef typename Target_halfedge::Base      HBase ;
+  typedef typename Target_vertex::Base        VBase ;
+  typedef typename Target_face::Base          FBase ;
+  
+  typedef CGAL_SS_i::Triedge<Source_halfedge_handle> Source_triedge ;
+  typedef CGAL_SS_i::Triedge<Target_halfedge_handle> Target_triedge ;
+  
+  Straight_skeleton_converter_2 ( Items_converter const& aCvt = Items_converter() )
+    :
+    cvt(aCvt)
+  {}
+  
+  Target_skeleton_ptr operator() ( Source_skeleton const& aSkeleton ) const
+  {
+    CGAL_assertion(aSkeleton.is_valid());
+    Target_skeleton_ptr rResult = create_unconnected_copy(aSkeleton);
+    connect_items(aSkeleton,*rResult);
+    CGAL_assertion(rResult->is_valid());
+    return rResult ;
+  }
+  
+private :
+  
+  Target_skeleton_ptr create_unconnected_copy ( Source_skeleton const& aSource ) const
+  {
+    Target_skeleton_ptr rCopy ( new Target_skeleton ) ;
+    
+    int lMaxVID =-1, lMaxHID = -1, lMaxFID = -1 ;
+    
+    for ( Source_vertex_const_iterator vit = aSource.vertices_begin(); vit != aSource.vertices_end(); ++ vit )
+      if ( vit->id() > lMaxVID )
+        lMaxVID = vit->id();
+        
+    for ( Source_halfedge_const_iterator hit = aSource.halfedges_begin(); hit != aSource.halfedges_end(); ++ hit )
+      if ( hit->id() > lMaxHID )
+        lMaxHID = hit->id();
+        
+    for ( Source_face_const_iterator fit = aSource.faces_begin(); fit != aSource.faces_end(); ++ fit )
+      if ( fit->id() > lMaxFID )
+        lMaxFID = fit->id();
+    
+    Target_vertices .clear();
+    Target_halfedges.clear();
+    Target_faces    .clear();
+    Target_vertices .resize(lMaxVID+1);
+    Target_halfedges.resize(lMaxHID+1);
+    Target_faces    .resize(lMaxFID+1);
+    
+    for ( Source_vertex_const_iterator vit = aSource.vertices_begin(); vit != aSource.vertices_end(); ++ vit )
+    {
+      Target_vertex_handle tv = rCopy->SlsBase::vertices_push_back( cvt(vit) ) ; 
+       
+      Target_vertices.at(tv->id()) = tv ;
+    }  
+      
+    for ( Source_halfedge_const_iterator hit = aSource.halfedges_begin(); hit != aSource.halfedges_end(); ++++ hit )
+    {
+      // In this loop, `hit` is incremented twice, to iterate on edges. We
+      // could have used `edges_begin()` and `edges_end()` instead.
+
+      Target_halfedge_handle    th = rCopy->SlsBase::edges_push_back( cvt(hit), cvt(hit->opposite()) ) ; 
+      Target_halfedge_handle oppth = th->opposite();
+      
+      Target_halfedges.at(   th->id()) = th ;
+      Target_halfedges.at(oppth->id()) = oppth ;
+      
+    } 
+    
+    for ( Source_face_const_iterator fit = aSource.faces_begin(); fit != aSource.faces_end(); ++ fit )
+    {
+      Target_face_handle tf = rCopy->SlsBase::faces_push_back( cvt(fit) ) ; 
+      
+      Target_faces.at(tf->id()) = tf ;
+    }  
+    
+    return rCopy ;
+  }
+  
+  void connect_items ( Source_skeleton const& aSource, Target_skeleton& aTarget ) const
+  {
+    Target_vertex_iterator tvit = aTarget.vertices_begin();
+    for ( Source_vertex_const_iterator svit = aSource.vertices_begin(); svit != aSource.vertices_end(); ++ svit, ++ tvit )
+    {
+      CGAL_assertion( handle_assigned(svit) ) ;
+      CGAL_assertion( handle_assigned(svit->halfedge()) ) ;
+      
+      Target_halfedge_handle tgt_halfedge = Target_halfedges.at(svit->halfedge()->id());
+          
+      CGAL_assertion( handle_assigned(tgt_halfedge) ) ;
+      tvit->VBase::set_halfedge(tgt_halfedge);
+      
+      Target_halfedge_handle tgt_striedge_e0, tgt_striedge_e1, tgt_striedge_e2 ;
+      
+      Source_triedge const& stri = svit->event_triedge() ;
+      
+      if ( handle_assigned(stri.e0()) )
+        tgt_striedge_e0 = Target_halfedges.at(stri.e0()->id());
+        
+      if ( handle_assigned(stri.e1()) )
+        tgt_striedge_e1 = Target_halfedges.at(stri.e1()->id());
+      
+      if ( handle_assigned(stri.e2()) )
+        tgt_striedge_e2 = Target_halfedges.at(stri.e2()->id());
+        
+      tvit->VBase::set_event_triedge( Target_triedge(tgt_striedge_e0, tgt_striedge_e1, tgt_striedge_e2) ) ;
+    }
+    
+    Target_halfedge_iterator thit = aTarget.halfedges_begin();
+    for ( Source_halfedge_const_iterator shit = aSource.halfedges_begin(); shit != aSource.halfedges_end(); ++ shit, ++ thit )
+    {
+      CGAL_assertion( handle_assigned(shit->opposite()) ) ;
+      CGAL_assertion( handle_assigned(shit->next    ()) ) ;
+      CGAL_assertion( handle_assigned(shit->prev    ()) ) ;
+      CGAL_assertion( handle_assigned(shit->vertex  ()) ) ;
+      
+      Target_halfedge_handle tgt_opposite = Target_halfedges.at(shit->opposite()->id());
+      Target_halfedge_handle tgt_next     = Target_halfedges.at(shit->next    ()->id());
+      Target_halfedge_handle tgt_prev     = Target_halfedges.at(shit->prev    ()->id());
+      Target_vertex_handle   tgt_vertex   = Target_vertices .at(shit->vertex  ()->id());
+      
+      CGAL_assertion( handle_assigned(tgt_opposite) ) ;
+      CGAL_assertion( handle_assigned(tgt_next)     ) ;
+      CGAL_assertion( handle_assigned(tgt_prev)     ) ;
+      CGAL_assertion( handle_assigned(tgt_vertex)   ) ;
+      
+      thit->HBase_base::set_opposite (tgt_opposite);
+      thit->HBase_base::set_next     (tgt_next);
+      thit->HBase_base::set_prev     (tgt_prev);
+      thit->HBase_base::set_vertex   (tgt_vertex);
+      
+      if ( handle_assigned(shit->face()) )
+      {
+        Target_face_handle tgt_face = Target_faces.at(shit->face()->id());
+        CGAL_assertion( handle_assigned(tgt_face) ) ;
+        thit->HBase_base::set_face(tgt_face);
+      }
+     }  
+    
+    Target_face_iterator tfit = aTarget.faces_begin();
+    for ( Source_face_const_iterator sfit = aSource.faces_begin(); sfit != aSource.faces_end(); ++ sfit, ++ tfit )
+    {
+      CGAL_assertion( handle_assigned(sfit->halfedge()) ) ;
+      
+      Target_halfedge_handle tgt_halfedge = Target_halfedges.at(sfit->halfedge()->id());
+          
+      CGAL_assertion( handle_assigned(tgt_halfedge) ) ;
+      
+      tfit->FBase::set_halfedge(tgt_halfedge);
+    }  
+  }
+  
+  Items_converter const& cvt ;
+  
+  mutable std::vector<Target_vertex_handle>   Target_vertices ;
+  mutable std::vector<Target_halfedge_handle> Target_halfedges;
+  mutable std::vector<Target_face_handle>     Target_faces    ;
+  
+} ;
+
+template<class Target_skeleton, class Source_skeleton, class Items_converter>
+boost::shared_ptr<Target_skeleton> 
+convert_straight_skeleton_2 ( Source_skeleton const& aSrc, Items_converter const& ic )
+{
+  typedef Straight_skeleton_converter_2<Source_skeleton,Target_skeleton,Items_converter> Skeleton_converter ;
+  
+  Skeleton_converter c(ic) ;
+  
+  return c(aSrc);
+    
+}
+
+template<class Target_skeleton, class Source_skeleton>
+boost::shared_ptr<Target_skeleton> 
+convert_straight_skeleton_2 ( Source_skeleton const& aSrc )
+{
+  typedef Straight_skeleton_items_converter_2<Source_skeleton,Target_skeleton> Items_converter ;
+  
+  typedef Straight_skeleton_converter_2<Source_skeleton,Target_skeleton,Items_converter> Skeleton_converter ;
+  
+  Skeleton_converter c ;
+  
+  return c(aSrc);
+    
+}
+
+} // end namespace CGAL
+
+
+#endif // CGAL_STRAIGHT_SKELETON_2_CONVERTER_H //
+// EOF //
+
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Straight_skeleton_face_base_2.h b/3rdparty/CGAL/include/CGAL/Straight_skeleton_face_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Straight_skeleton_face_base_2.h
rename to 3rdparty/CGAL/include/CGAL/Straight_skeleton_face_base_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Straight_skeleton_halfedge_base_2.h b/3rdparty/CGAL/include/CGAL/Straight_skeleton_halfedge_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Straight_skeleton_halfedge_base_2.h
rename to 3rdparty/CGAL/include/CGAL/Straight_skeleton_halfedge_base_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Straight_skeleton_items_2.h b/3rdparty/CGAL/include/CGAL/Straight_skeleton_items_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Straight_skeleton_items_2.h
rename to 3rdparty/CGAL/include/CGAL/Straight_skeleton_items_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Straight_skeleton_vertex_base_2.h b/3rdparty/CGAL/include/CGAL/Straight_skeleton_vertex_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Straight_skeleton_vertex_base_2.h
rename to 3rdparty/CGAL/include/CGAL/Straight_skeleton_vertex_base_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Stream_lines_2.h b/3rdparty/CGAL/include/CGAL/Stream_lines_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Stream_lines_2.h
rename to 3rdparty/CGAL/include/CGAL/Stream_lines_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Subdivision_mask_3.h b/3rdparty/CGAL/include/CGAL/Subdivision_mask_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Subdivision_mask_3.h
rename to 3rdparty/CGAL/include/CGAL/Subdivision_mask_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Subdivision_method_3.h b/3rdparty/CGAL/include/CGAL/Subdivision_method_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Subdivision_method_3.h
rename to 3rdparty/CGAL/include/CGAL/Subdivision_method_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Subdivision_method_impl_3.h b/3rdparty/CGAL/include/CGAL/Subdivision_method_impl_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Subdivision_method_impl_3.h
rename to 3rdparty/CGAL/include/CGAL/Subdivision_method_impl_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh.h b/3rdparty/CGAL/include/CGAL/Surface_mesh.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesh.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesh.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh/IO.h b/3rdparty/CGAL/include/CGAL/Surface_mesh/IO.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesh/IO.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesh/IO.h
diff --git a/3rdparty/CGAL/include/CGAL/Surface_mesh/Properties.h b/3rdparty/CGAL/include/CGAL/Surface_mesh/Properties.h
new file mode 100644
index 0000000..d8aaf2c
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Surface_mesh/Properties.h
@@ -0,0 +1,480 @@
+//=============================================================================
+// Copyright (C) 2001-2005 by Computer Graphics Group, RWTH Aachen
+// Copyright (C) 2011 by Graphics & Geometry Group, Bielefeld University
+// Copyright (C) 2014 GeometryFactory
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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.
+//
+
+
+#ifndef CGAL_SURFACE_MESH_PROPERTY_H
+#define CGAL_SURFACE_MESH_PROPERTY_H
+
+#include <vector>
+#include <string>
+#include <algorithm>
+#include <typeinfo>
+
+#include <CGAL/property_map.h>
+#include <CGAL/assertions.h>
+
+namespace CGAL {
+
+#ifndef DOXYGEN_RUNNING
+
+/// \addtogroup PkgSurface_mesh
+///
+/// @{
+
+/// @cond CGAL_DOCUMENT_INTERNALS
+class Base_property_array
+{
+public:
+
+    /// Default constructor
+    Base_property_array(const std::string& name) : name_(name) {}
+
+    /// Destructor.
+    virtual ~Base_property_array() {}
+
+    /// Reserve memory for n elements.
+    virtual void reserve(size_t n) = 0;
+
+    /// Resize storage to hold n elements.
+    virtual void resize(size_t n) = 0;
+
+    /// Free unused memory.
+    virtual void shrink_to_fit() = 0;
+
+    /// Extend the number of elements by one.
+    virtual void push_back() = 0;
+
+    /// Let two elements swap their storage place.
+    virtual void swap(size_t i0, size_t i1) = 0;
+
+    /// Return a deep copy of self.
+    virtual Base_property_array* clone () const = 0;
+
+    /// Return the type_info of the property
+    virtual const std::type_info& type() = 0;
+
+    /// Return the name of the property
+    const std::string& name() const { return name_; }
+
+
+protected:
+
+    std::string name_;
+};
+
+  /// @endcond
+
+
+//== CLASS DEFINITION =========================================================
+
+/// @cond CGAL_DOCUMENT_INTERNALS
+
+template <class T>
+class Property_array : public Base_property_array
+{
+public:
+
+    typedef T                                       value_type;
+    typedef std::vector<value_type>                 vector_type;
+    typedef typename vector_type::reference         reference;
+    typedef typename vector_type::const_reference   const_reference;
+
+    Property_array(const std::string& name, T t=T()) : Base_property_array(name), value_(t) {}
+
+public: // virtual interface of Base_property_array
+
+    virtual void reserve(size_t n)
+    {
+        data_.reserve(n);
+    }
+
+    virtual void resize(size_t n)
+    {
+        data_.resize(n, value_);
+    }
+
+    virtual void push_back()
+    {
+        data_.push_back(value_);
+    }
+
+    virtual void shrink_to_fit()
+    {
+        vector_type(data_).swap(data_);
+    }
+
+    virtual void swap(size_t i0, size_t i1)
+    {
+        T d(data_[i0]);
+        data_[i0]=data_[i1];
+        data_[i1]=d;
+    }
+
+    virtual Base_property_array* clone() const
+    {
+        Property_array<T>* p = new Property_array<T>(name_, value_);
+        p->data_ = data_;
+        return p;
+    }
+
+    virtual const std::type_info& type() { return typeid(T); }
+
+
+public:
+
+    /// Get pointer to array (does not work for T==bool)
+    const T* data() const
+    {
+        return &data_[0];
+    }
+
+    /// Access the i'th element. No range check is performed!
+    reference operator[](int _idx)
+    {
+        CGAL_assertion( size_t(_idx) < data_.size() );
+        return data_[_idx];
+    }
+
+    /// Const access to the i'th element. No range check is performed!
+    const_reference operator[](int _idx) const
+    {
+        CGAL_assertion( size_t(_idx) < data_.size());
+        return data_[_idx];
+    }
+
+
+
+private:
+    vector_type data_;
+    value_type  value_;
+};
+
+  /// @endcond
+
+// specialization for bool properties
+template <>
+inline const bool*
+Property_array<bool>::data() const
+{
+    CGAL_assertion(false);
+    return NULL;
+}
+
+
+
+//== CLASS DEFINITION =========================================================
+
+/// @cond CGAL_DOCUMENT_INTERNALS
+
+template<typename>
+class Property_container;
+/// @endcond 
+
+
+
+
+//== CLASS DEFINITION =========================================================
+/// @cond CGAL_DOCUMENT_INTERNALS
+
+template <class, class>
+class Property_map;
+
+template<typename Key>
+class Property_container
+{
+public:
+
+    // default constructor
+    Property_container() : size_(0) {}
+
+    // destructor (deletes all property arrays)
+    virtual ~Property_container() { clear(); }
+
+    // copy constructor: performs deep copy of property arrays
+    Property_container(const Property_container& _rhs) { operator=(_rhs); }
+
+    // assignment: performs deep copy of property arrays
+    Property_container& operator=(const Property_container& _rhs)
+    {
+        if (this != &_rhs)
+        {
+            clear();
+            parrays_.resize(_rhs.n_properties());
+            size_ = _rhs.size();
+            for (unsigned int i=0; i<parrays_.size(); ++i)
+                parrays_[i] = _rhs.parrays_[i]->clone();
+        }
+        return *this;
+    }
+
+    // returns the current size of the property arrays
+    size_t size() const { return size_; }
+
+    // returns the number of property arrays
+    size_t n_properties() const { return parrays_.size(); }
+
+    // returns a vector of all property names
+    std::vector<std::string> properties() const
+    {
+        std::vector<std::string> names;
+        for (unsigned int i=0; i<parrays_.size(); ++i)
+            names.push_back(parrays_[i]->name());
+        return names;
+    }
+
+    // add a property with name \c name and default value \c t
+    template <class T> 
+    std::pair<Property_map<Key, T>,bool>
+    add(const std::string& name, const T t=T())
+    {
+        // if a property with this name already exists, return it
+        for (unsigned int i=0; i<parrays_.size(); ++i)
+        {
+            if (parrays_[i]->name() == name)
+            {
+              return std::make_pair(Property_map<Key, T>(dynamic_cast<Property_array<T>*>(parrays_[i])), true);
+            }
+        }
+
+        // otherwise add the property
+        Property_array<T>* p = new Property_array<T>(name, t);
+        p->resize(size_);
+        parrays_.push_back(p);
+        return std::make_pair(Property_map<Key, T>(p),false);
+    }
+
+
+    // get a property by its name. returns invalid property if it does not exist.
+    template <class T> Property_map<Key, T> get(const std::string& name) const
+    {
+        for (unsigned int i=0; i<parrays_.size(); ++i)
+            if (parrays_[i]->name() == name)
+                return Property_map<Key, T>(dynamic_cast<Property_array<T>*>(parrays_[i]));
+        return Property_map<Key, T>();
+    }
+
+
+    // returns a property if it exists, otherwise it creates it first.
+    template <class T> Property_map<Key, T> get_or_add(const std::string& name, const T t=T())
+    {
+        Property_map<Key, T> p = get<T>(name);
+        if (!p) p = add<T>(name, t);
+        return p;
+    }
+
+
+    // get the type of property by its name. returns typeid(void) if it does not exist.
+    const std::type_info& get_type(const std::string& name)
+    {
+        for (unsigned int i=0; i<parrays_.size(); ++i)
+            if (parrays_[i]->name() == name)
+                return parrays_[i]->type();
+        return typeid(void);
+    }
+
+
+    // delete a property
+    template <class T> void remove(Property_map<Key, T>& h)
+    {
+        std::vector<Base_property_array*>::iterator it=parrays_.begin(), end=parrays_.end();
+        for (; it!=end; ++it)
+        {
+            if (*it == h.parray_)
+            {
+                delete *it;
+                parrays_.erase(it);
+                h.reset();
+                break;
+            }
+        }
+    }
+
+
+    // delete all properties
+    void clear()
+    {
+        for (unsigned int i=0; i<parrays_.size(); ++i)
+            delete parrays_[i];
+        parrays_.clear();
+        size_ = 0;
+    }
+
+
+    // reserve memory for n entries in all arrays
+    void reserve(size_t n) const
+    {
+        for (unsigned int i=0; i<parrays_.size(); ++i)
+            parrays_[i]->reserve(n);
+    }
+
+    // resize all arrays to size n
+    void resize(size_t n)
+    {
+        for (unsigned int i=0; i<parrays_.size(); ++i)
+            parrays_[i]->resize(n);
+        size_ = n;
+    }
+
+    // free unused space in all arrays
+    void shrink_to_fit() const
+    {
+        for (unsigned int i=0; i<parrays_.size(); ++i)
+            parrays_[i]->shrink_to_fit();
+    }
+
+    // add a new element to each vector
+    void push_back()
+    {
+        for (unsigned int i=0; i<parrays_.size(); ++i)
+            parrays_[i]->push_back();
+        ++size_;
+    }
+
+    // swap elements i0 and i1 in all arrays
+    void swap(size_t i0, size_t i1) const
+    {
+        for (unsigned int i=0; i<parrays_.size(); ++i)
+            parrays_[i]->swap(i0, i1);
+    }
+
+
+private:
+    std::vector<Base_property_array*>  parrays_;
+    size_t  size_;
+};
+
+  /// @endcond
+
+///
+/// `Property_map` enables to attach properties to the simplices of a 
+///  surface mesh.
+/// 
+/// @tparam Key The key type of the property map. It must be a model of `Index`.
+/// @tparam Value The value type of the property.
+///
+/// \cgalModels `LvaluePropertyMap`
+///
+template <class I, class T>
+class Property_map
+/// @cond CGAL_DOCUMENT_INTERNALS
+  : public boost::put_get_helper< 
+           typename Property_array<T>::reference,
+           Property_map< I, T > >
+/// @endcond
+{
+    typedef void (Property_map::*bool_type)() const;
+    void this_type_does_not_support_comparisons() const {}
+public:
+    typedef I key_type;
+    typedef T value_type;
+    typedef boost::lvalue_property_map_tag category;
+
+#ifndef DOXYGEN_RUNNING
+
+    typedef typename Property_array<T>::reference reference;
+
+    typedef typename Property_array<T>::const_reference const_reference;
+#else 
+    /// A reference to the value type of the property.
+  typedef unspecified_type reference;
+
+    /// A const reference to the value type of the property.
+  typedef unspecified_type const_reference;
+#endif
+
+#ifndef DOXYGEN_RUNNING
+    friend class Property_container<I>;
+
+    template <typename K>  friend class Surface_mesh;
+#endif
+
+public:
+/// @cond CGAL_DOCUMENT_INTERNALS
+    Property_map(Property_array<T>* p=NULL) : parray_(p) {}
+
+    void reset()
+    {
+        parray_ = NULL;
+    }
+  /// @endcond 
+
+public:
+    /// \name Accessing Properties
+    //@{
+#ifdef DOXYGEN_RUNNING
+    /// Conversion to a Boolean. It is \c true when the property map
+    /// can be used, and \c false otherwise.  
+  operator bool () const;
+#else
+    operator bool_type() const {
+        return parray_ != NULL ?
+            &Property_map::this_type_does_not_support_comparisons : 0;
+    }
+#endif
+    /// Access the property associated with the key \c i.
+    reference operator[](const I& i)
+    {
+      CGAL_assertion(parray_ != NULL);
+      return (*parray_)[i.idx()];
+    }
+
+    /// Access the property associated with the key \c i.
+    reference operator[](const I& i) const
+    {
+      CGAL_assertion(parray_ != NULL);
+      return (*parray_)[i.idx()];
+    }
+
+    /// Allows access to the underlying storage of the property. This
+    /// is useful when the key associated with the properties is
+    /// unimportant and only the properties are of interest
+    /// (e.g. rendering).
+    ///
+    /// \returns a pointer to the underlying storage of the property.
+    const T* data() const
+    {
+      CGAL_assertion(parray_ != NULL);
+      return parray_->data();
+    }
+
+    //@}
+private:
+
+    Property_array<T>& array()
+    {
+        CGAL_assertion(parray_ != NULL);
+        return *parray_;
+    }
+
+    const Property_array<T>& array() const
+    {
+        CGAL_assertion(parray_ != NULL);
+        return *parray_;
+    }
+
+    Property_array<T>* parray_;
+};
+
+
+
+///@}
+#endif // DOXYGEN_RUNNING  
+} // CGAL
+
+//=============================================================================
+#endif // CGAL_SURFACE_MESH_PROPERTY_H
+//=============================================================================
diff --git a/3rdparty/CGAL/include/CGAL/Surface_mesh/Surface_mesh.h b/3rdparty/CGAL/include/CGAL/Surface_mesh/Surface_mesh.h
new file mode 100644
index 0000000..2669bea
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Surface_mesh/Surface_mesh.h
@@ -0,0 +1,3111 @@
+//=============================================================================
+// Copyright (C) 2001-2005 by Computer Graphics Group, RWTH Aachen
+// Copyright (C) 2011 by Graphics & Geometry Group, Bielefeld University
+// Copyright (C) 2014 GeometryFactory
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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.
+//
+
+
+#ifndef CGAL_SURFACE_MESH_H
+#define CGAL_SURFACE_MESH_H
+
+#include <iterator>
+#include <algorithm>
+#include <utility>
+#include <iostream>
+#include <cstddef>
+#include <vector>
+#include <string>
+#include <typeinfo>
+#include <functional>
+
+#include <boost/cstdint.hpp>
+#include <boost/array.hpp>
+#include <boost/iterator/iterator_facade.hpp>
+#include <boost/foreach.hpp>
+
+#include <CGAL/property_map.h>
+#include <CGAL/Iterator_range.h>
+#include <CGAL/circulator.h>
+#include <CGAL/assertions.h>
+#include <CGAL/Surface_mesh/Surface_mesh_fwd.h>
+#include <CGAL/Surface_mesh/IO.h>
+//#include <CGAL/Surface_mesh/Properties.h>
+#include <CGAL/boost/graph/graph_traits_Surface_mesh.h>
+#include <CGAL/boost/graph/iterator.h>
+#include <CGAL/boost/graph/Euler_operations.h>
+#include <CGAL/IO/File_scanner_OFF.h>
+
+namespace CGAL {
+
+
+#ifndef DOXYGEN_RUNNING
+    /// Base class for vertex, halfedge, edge, and face index. 
+    ///
+    /// \attention Note that `Index` is not a model of the concept `Handle`,
+    /// because it cannot be dereferenced.
+    /// \sa `Vertex_index`, `Halfedge_index`, `Edge_index`, `Face_index`.
+    template<typename T>
+    class SM_Index
+    {
+    public:
+    typedef boost::uint32_t size_type;
+        /// Constructor. %Default construction creates an invalid index.
+        /// We write -1, which is <a href="http://en.cppreference.com/w/cpp/concept/numeric_limits">
+        /// <tt>std::numeric_limits<size_type>::max()</tt></a>
+        /// as `size_type` is an unsigned type. 
+        explicit SM_Index(size_type _idx=-1) : idx_(_idx) {}
+
+        /// Get the underlying index of this index
+        operator size_type() const { return idx_; }
+
+        /// reset index to be invalid (index=-1)
+        void reset() { idx_=-1; }
+
+        /// return whether the index is valid, i.e., the index is not equal to -1.
+        bool is_valid() const { 
+          size_type inf = -1;
+          return idx_ != inf;
+        }
+
+        /// are two indices equal?
+        bool operator==(const T& _rhs) const {
+            return idx_ == _rhs.idx_;
+        }
+
+        /// are two indices different?
+        bool operator!=(const T& _rhs) const {
+            return idx_ != _rhs.idx_;
+        }
+
+        /// Comparison by index.
+        bool operator<(const T& _rhs) const {
+            return idx_ < _rhs.idx_;
+        }
+
+        /// increments the internal index. This operation does not
+        /// guarantee that the index is valid or undeleted after the
+        /// increment.
+        SM_Index& operator++() { ++idx_; return *this; }
+        /// decrements the internal index. This operation does not
+        /// guarantee that the index is valid or undeleted after the
+        /// decrement.
+        SM_Index& operator--() { --idx_; return *this; }
+
+        /// increments the internal index. This operation does not
+        /// guarantee that the index is valid or undeleted after the
+        /// increment.
+        SM_Index operator++(int) { SM_Index tmp(*this); ++idx_; return tmp; }
+        /// decrements the internal index. This operation does not
+        /// guarantee that the index is valid or undeleted after the
+        /// decrement.
+        SM_Index operator--(int) { SM_Index tmp(*this); --idx_; return tmp; }
+
+
+      
+     
+      
+    private:
+        size_type idx_;
+    };
+
+  template <class T>
+  std::size_t hash_value(const SM_Index<T>&  i)
+  {
+    std::size_t ret = i;
+    return ret;
+  }
+
+    // Implementation for Surface_mesh::Vertex_index
+ 
+    class SM_Vertex_index
+ : public SM_Index<SM_Vertex_index>
+    {
+    public:
+
+        SM_Vertex_index() : SM_Index<SM_Vertex_index>(-1) {}
+
+        explicit SM_Vertex_index(size_type _idx) : SM_Index<SM_Vertex_index>(_idx) {}
+
+
+        friend std::ostream& operator<<(std::ostream& os, SM_Vertex_index const& v)
+        {
+          return (os << 'v' << (size_type)v );
+        }
+    };
+
+    // Implementation of Surface_mesh::Halfedge_index
+    class SM_Halfedge_index
+      : public SM_Index<SM_Halfedge_index>
+    {
+    public:
+
+        // Workaround for a bug in g++4.4 in ADL for function next:
+        // we provide the types needed for std::iterator_traits<Surface_mesh::halfedge_index>,
+        // although this descriptor is not an iterator.
+        typedef void iterator_category;
+        typedef void value_type;
+        typedef void difference_type;
+        typedef void pointer;
+        typedef void reference;
+
+        SM_Halfedge_index() : SM_Index<SM_Halfedge_index>(-1) {}
+
+        explicit SM_Halfedge_index(size_type _idx) : SM_Index<SM_Halfedge_index>(_idx) {}
+
+        friend std::ostream& operator<<(std::ostream& os, SM_Halfedge_index const& h)
+        {
+          return (os << 'h' << (size_type)h );
+        }
+    };
+
+    /// Implementation of Surfae_mesh::Face_index
+    class SM_Face_index
+      : public SM_Index<SM_Face_index>
+    {
+    public:
+
+        SM_Face_index() : SM_Index<SM_Face_index>(-1) {}
+
+        explicit SM_Face_index(size_type _idx) : SM_Index<SM_Face_index>(_idx) {}
+
+
+        friend std::ostream& operator<<(std::ostream& os, SM_Face_index const& f)
+        {
+          return (os << 'f' << (size_type)f );
+        }
+    };
+
+    /// Implementation of Surface_mesh::Edge_index
+    class SM_Edge_index
+    {
+    public:
+        typedef boost::uint32_t size_type;
+
+        SM_Edge_index() : halfedge_(-1) { }
+
+        SM_Edge_index(size_type idx) : halfedge_(idx * 2) { }
+
+        explicit SM_Edge_index(SM_Halfedge_index he) : halfedge_(he) { }
+
+        // returns the internal halfedge.
+        SM_Halfedge_index halfedge() const { return halfedge_; }
+
+        // returns the underlying index of this index.
+        operator size_type() const { return (size_type)halfedge_ / 2; }
+
+        // resets index to be invalid (index=-1)
+        void reset() { halfedge_.reset(); }
+
+        // returns whether the index is valid, i.e., the index is not equal to -1.
+        bool is_valid() const { return halfedge_.is_valid(); }
+
+        // Are two indices equal?
+        bool operator==(const SM_Edge_index& other) const { return (size_type)(*this) == (size_type)other; }
+
+        // Are two indices different?
+        bool operator!=(const SM_Edge_index& other) const { return (size_type)(*this) != (size_type)other; }
+
+        // compares by index.
+        bool operator<(const SM_Edge_index& other) const { return (size_type)(*this) < (size_type)other;}
+
+        // decrements the internal index. This operation does not
+        // guarantee that the index is valid or undeleted after the
+        // decrement.
+        SM_Edge_index& operator--() { halfedge_ = SM_Halfedge_index((size_type)halfedge_ - 2); return *this; }
+
+        // increments the internal index. This operation does not
+        // guarantee that the index is valid or undeleted after the
+        // increment.
+        SM_Edge_index& operator++() { halfedge_ = SM_Halfedge_index((size_type)halfedge_ + 2); return *this; }
+
+        // decrements internal index. This operation does not
+        // guarantee that the index is valid or undeleted after the
+        // decrement.
+        SM_Edge_index operator--(int) { SM_Edge_index tmp(*this); halfedge_ = SM_Halfedge_index((size_type)halfedge_ - 2); return tmp; }
+
+        // increments internal index. This operation does not
+        // guarantee that the index is valid or undeleted after the
+        // increment.
+        SM_Edge_index operator++(int) { SM_Edge_index tmp(*this); halfedge_ = SM_Halfedge_index((size_type)halfedge_ + 2); return tmp; }
+
+
+      // prints the index and a short identification string to an ostream.
+        friend std::ostream& operator<<(std::ostream& os, SM_Edge_index const& e)
+        {
+          return (os << 'e' << (size_type)e << " on " << e.halfedge());
+        }
+
+        friend  std::size_t hash_value(const SM_Edge_index&  i)
+        {
+          return i;
+        }
+
+    private:
+        SM_Halfedge_index halfedge_;
+    };
+#endif
+
+  /// \ingroup PkgSurface_mesh
+  /// This class is a data structure that can be used as halfedge data structure or polyhedral
+  /// surface. It is an alternative to the classes `HalfedgeDS` and `Polyhedron_3`
+  /// defined in the packages  \ref PkgHDSSummary and \ref PkgPolyhedronSummary. 
+  /// The main difference is that it is indexed based and not pointer based,
+  /// and that the mechanism for adding information to vertices, halfedges, edges,
+  /// and faces is much simpler and done at runtime and not at compile time.
+  /// When elements are removed, they are only marked as removed, and a garbage
+  /// collection function must be called to really remove them. 
+  /// @tparam P The type of the \em point property of a vertex. There is no requirement on `P`,
+  ///         besides being default constructible and assignable. 
+  ///         In typical use cases it will be a 2D or 3D point type.
+  /// \cgalModels `MutableFaceGraph` and `FaceListGraph`
+
+template <typename P>
+class Surface_mesh
+{
+
+    typedef Surface_mesh<P> Self;
+
+    template<typename>
+    class Handle_iterator;
+public:
+
+
+
+/// \addtogroup PkgSurface_mesh
+///
+/// @{
+
+/// @cond CGAL_DOCUMENT_INTERNALS
+class Base_property_array
+{
+public:
+
+    /// Default constructor
+    Base_property_array(const std::string& name) : name_(name) {}
+
+    /// Destructor.
+    virtual ~Base_property_array() {}
+
+    /// Reserve memory for n elements.
+    virtual void reserve(size_t n) = 0;
+
+    /// Resize storage to hold n elements.
+    virtual void resize(size_t n) = 0;
+
+    /// Free unused memory.
+    virtual void shrink_to_fit() = 0;
+
+    /// Extend the number of elements by one.
+    virtual void push_back() = 0;
+
+    virtual bool transfer(const Base_property_array& other) = 0;
+
+    /// Let two elements swap their storage place.
+    virtual void swap(size_t i0, size_t i1) = 0;
+
+    /// Return a deep copy of self.
+    virtual Base_property_array* clone () const = 0;
+
+    /// Return the type_info of the property
+    virtual const std::type_info& type() = 0;
+
+    /// Return the name of the property
+    const std::string& name() const { return name_; }
+
+
+protected:
+
+    std::string name_;
+};
+
+  /// @endcond
+
+
+//== CLASS DEFINITION =========================================================
+
+/// @cond CGAL_DOCUMENT_INTERNALS
+
+template <class T>
+class Property_array : public Base_property_array
+{
+public:
+
+    typedef T                                       value_type;
+    typedef std::vector<value_type>                 vector_type;
+    typedef typename vector_type::reference         reference;
+    typedef typename vector_type::const_reference   const_reference;
+
+    Property_array(const std::string& name, T t=T()) : Base_property_array(name), value_(t) {}
+
+public: // virtual interface of Base_property_array
+
+    virtual void reserve(size_t n)
+    {
+        data_.reserve(n);
+    }
+
+    virtual void resize(size_t n)
+    {
+        data_.resize(n, value_);
+    }
+
+    virtual void push_back()
+    {
+        data_.push_back(value_);
+    }
+
+    bool transfer(const Base_property_array& other)
+    {
+      const Property_array<T>* pa = dynamic_cast<const Property_array*>(&other);
+      if(pa != NULL){
+        std::copy((*pa).data_.begin(), (*pa).data_.end(), data_.end()-(*pa).data_.size());
+        return true;
+      } 
+      return false;
+    }
+
+    virtual void shrink_to_fit()
+    {
+        vector_type(data_).swap(data_);
+    }
+
+    virtual void swap(size_t i0, size_t i1)
+    {
+        T d(data_[i0]);
+        data_[i0]=data_[i1];
+        data_[i1]=d;
+    }
+
+    virtual Base_property_array* clone() const
+    {
+        Property_array<T>* p = new Property_array<T>(this->name_, this->value_);
+        p->data_ = data_;
+        return p;
+    }
+
+    virtual const std::type_info& type() { return typeid(T); }
+
+
+public:
+
+    /// Get pointer to array (does not work for T==bool)
+    const T* data() const
+    {
+        return &data_[0];
+    }
+
+    /// Access the i'th element. No range check is performed!
+    reference operator[](int _idx)
+    {
+        CGAL_assertion( size_t(_idx) < data_.size() );
+        return data_[_idx];
+    }
+
+    /// Const access to the i'th element. No range check is performed!
+    const_reference operator[](int _idx) const
+    {
+        CGAL_assertion( size_t(_idx) < data_.size());
+        return data_[_idx];
+    }
+
+
+
+private:
+    vector_type data_;
+    value_type  value_;
+};
+
+
+#if 0
+// specialization for bool properties
+template <>
+inline const bool*
+Property_array<bool>::data() const
+{
+    CGAL_assertion(false);
+    return NULL;
+}
+#endif 
+
+  /// @endcond
+
+//== CLASS DEFINITION =========================================================
+
+/// @cond CGAL_DOCUMENT_INTERNALS
+
+template<typename>
+class Property_container;
+/// @endcond 
+
+
+
+
+//== CLASS DEFINITION =========================================================
+/// @cond CGAL_DOCUMENT_INTERNALS
+
+template <class, class>
+class Property_map;
+
+template<typename Key>
+class Property_container
+{
+public:
+
+    // default constructor
+    Property_container() : size_(0) {}
+
+    // destructor (deletes all property arrays)
+    virtual ~Property_container() { clear(); }
+
+    // copy constructor: performs deep copy of property arrays
+    Property_container(const Property_container& _rhs) { operator=(_rhs); }
+
+    // assignment: performs deep copy of property arrays
+    Property_container& operator=(const Property_container& _rhs)
+    {
+        if (this != &_rhs)
+        {
+            clear();
+            parrays_.resize(_rhs.n_properties());
+            size_ = _rhs.size();
+            for (unsigned int i=0; i<parrays_.size(); ++i)
+                parrays_[i] = _rhs.parrays_[i]->clone();
+        }
+        return *this;
+    }
+
+    void transfer(const Property_container& _rhs)
+    {
+      for(unsigned int i=0; i<parrays_.size(); ++i){
+        for (unsigned int j=0; j<_rhs.parrays_.size(); ++j){
+          if(parrays_[i]->name() ==  _rhs.parrays_[j]->name()){
+            parrays_[i]->transfer(* _rhs.parrays_[j]);
+            break;
+          }
+        }
+      }
+    }
+
+    // returns the current size of the property arrays
+    size_t size() const { return size_; }
+
+    // returns the number of property arrays
+    size_t n_properties() const { return parrays_.size(); }
+
+    // returns a vector of all property names
+    std::vector<std::string> properties() const
+    {
+        std::vector<std::string> names;
+        for (unsigned int i=0; i<parrays_.size(); ++i)
+            names.push_back(parrays_[i]->name());
+        return names;
+    }
+
+    // add a property with name \c name and default value \c t
+    template <class T>
+    std::pair<Property_map<Key, T>, bool>
+    add(const std::string& name, const T t=T())
+    {
+        for (unsigned int i=0; i<parrays_.size(); ++i)
+        {
+            if (parrays_[i]->name() == name)
+            {
+              return std::make_pair(Property_map<Key, T>(dynamic_cast<Property_array<T>*>(parrays_[i])), false);
+            }
+        }
+
+        // otherwise add the property
+        Property_array<T>* p = new Property_array<T>(name, t);
+        p->resize(size_);
+        parrays_.push_back(p);
+        return std::make_pair(Property_map<Key, T>(p), true);
+    }
+
+
+    // get a property by its name. returns invalid property if it does not exist.
+    template <class T> 
+    std::pair<Property_map<Key, T>,bool>
+    get(const std::string& name) const
+    {
+        for (unsigned int i=0; i<parrays_.size(); ++i)
+            if (parrays_[i]->name() == name)
+              return std::make_pair(Property_map<Key, T>(dynamic_cast<Property_array<T>*>(parrays_[i])), true);
+        return std::make_pair(Property_map<Key, T>(), false);
+    }
+
+
+    // returns a property if it exists, otherwise it creates it first.
+    template <class T>
+    Property_map<Key, T> 
+    get_or_add(const std::string& name, const T t=T())
+    {
+      Property_map<Key, T> p;
+      bool b;
+      boost::tie(p,b)= get<T>(name);
+        if (!b) p = add<T>(name, t).first;
+        return p;
+    }
+
+
+    // get the type of property by its name. returns typeid(void) if it does not exist.
+    const std::type_info& 
+    get_type(const std::string& name)
+    {
+        for (unsigned int i=0; i<parrays_.size(); ++i)
+            if (parrays_[i]->name() == name)
+                return parrays_[i]->type();
+        return typeid(void);
+    }
+
+
+    // delete a property
+    template <class T> 
+    void
+    remove(Property_map<Key, T>& h)
+    {
+        typename std::vector<Base_property_array*>::iterator it=parrays_.begin(), end=parrays_.end();
+        for (; it!=end; ++it)
+        {
+            if (*it == h.parray_)
+            {
+                delete *it;
+                parrays_.erase(it);
+                h.reset();
+                break;
+            }
+        }
+    }
+
+
+    // delete all properties
+    void clear()
+    {
+        for (unsigned int i=0; i<parrays_.size(); ++i)
+            delete parrays_[i];
+        parrays_.clear();
+        size_ = 0;
+    }
+
+
+    // reserve memory for n entries in all arrays
+    void reserve(size_t n) const
+    {
+        for (unsigned int i=0; i<parrays_.size(); ++i)
+            parrays_[i]->reserve(n);
+    }
+
+    // resize all arrays to size n
+    void resize(size_t n)
+    {
+        for (unsigned int i=0; i<parrays_.size(); ++i)
+            parrays_[i]->resize(n);
+        size_ = n;
+    }
+
+    // free unused space in all arrays
+    void shrink_to_fit() const
+    {
+        for (unsigned int i=0; i<parrays_.size(); ++i)
+            parrays_[i]->shrink_to_fit();
+    }
+
+    // add a new element to each vector
+    void push_back()
+    {
+        for (unsigned int i=0; i<parrays_.size(); ++i)
+            parrays_[i]->push_back();
+        ++size_;
+    }
+
+    // swap elements i0 and i1 in all arrays
+    void swap(size_t i0, size_t i1) const
+    {
+        for (unsigned int i=0; i<parrays_.size(); ++i)
+            parrays_[i]->swap(i0, i1);
+    }
+
+
+private:
+    std::vector<Base_property_array*>  parrays_;
+    size_t  size_;
+};
+
+  /// @endcond
+
+#ifndef DOXYGEN_RUNNING
+/// 
+///
+/// `Property_map` enables to attach properties to the simplices of a 
+///  surface mesh.
+/// 
+/// @tparam Key The key type of the property map. It must be a model of `Index`.
+/// @tparam Value The value type of the property.
+///
+/// \cgalModels `LvaluePropertyMap`
+///
+template <class I, class T>
+class Property_map
+/// @cond CGAL_DOCUMENT_INTERNALS
+  : public boost::put_get_helper< 
+           typename Property_array<T>::reference,
+           Property_map< I, T > >
+/// @endcond
+{
+    typedef void (Property_map::*bool_type)() const;
+    void this_type_does_not_support_comparisons() const {}
+public:
+    typedef I key_type;
+    typedef T value_type;
+    typedef boost::lvalue_property_map_tag category;
+
+#ifndef DOXYGEN_RUNNING
+
+    typedef typename Property_array<T>::reference reference;
+
+    typedef typename Property_array<T>::const_reference const_reference;
+#else 
+    /// A reference to the value type of the property.
+  typedef unspecified_type reference;
+
+    /// A const reference to the value type of the property.
+  typedef unspecified_type const_reference;
+#endif
+
+#ifndef DOXYGEN_RUNNING
+    friend class Property_container<I>;
+
+    template <typename K>  friend class Surface_mesh;
+#endif
+
+public:
+/// @cond CGAL_DOCUMENT_INTERNALS
+    Property_map(Property_array<T>* p=NULL) : parray_(p) {}
+
+    void reset()
+    {
+        parray_ = NULL;
+    }
+  /// @endcond 
+
+public:
+    /// \name Accessing Properties
+    //@{
+#ifdef DOXYGEN_RUNNING
+    /// Conversion to a Boolean. It is \c true when the property map
+    /// can be used, and \c false otherwise.  
+  operator bool () const;
+#else
+    operator bool_type() const {
+        return parray_ != NULL ?
+            &Property_map::this_type_does_not_support_comparisons : 0;
+    }
+#endif
+    /// Access the property associated with the key \c i.
+    reference operator[](const I& i)
+    {
+      CGAL_assertion(parray_ != NULL);
+      return (*parray_)[i];
+    }
+
+    /// Access the property associated with the key \c i.
+    reference operator[](const I& i) const
+    {
+      CGAL_assertion(parray_ != NULL);
+      return (*parray_)[i];
+    }
+
+    bool transfer (const Property_map& other)
+    {
+      return parray_->transfer(*(other.parray_));
+    }
+
+    /// Allows access to the underlying storage of the property. This
+    /// is useful when the key associated with the properties is
+    /// unimportant and only the properties are of interest
+    /// (e.g. rendering).
+    ///
+    /// \returns a pointer to the underlying storage of the property.
+    const T* data() const
+    {
+      CGAL_assertion(parray_ != NULL);
+      return parray_->data();
+    }
+
+    //@}
+private:
+
+    Property_array<T>& array()
+    {
+        CGAL_assertion(parray_ != NULL);
+        return *parray_;
+    }
+
+    const Property_array<T>& array() const
+    {
+        CGAL_assertion(parray_ != NULL);
+        return *parray_;
+    }
+
+    Property_array<T>* parray_;
+};
+
+#endif // DOXYGEN_RUNNING
+
+///@}
+
+
+
+    /// \name Basic Types
+    ///
+    ///@{
+
+    /// The point type.
+    typedef P Point;
+
+    /// The type used to represent an index.
+    typedef boost::uint32_t size_type;
+
+    ///@}
+
+    /// \name Basic Elements
+    ///
+    ///@{
+
+
+#ifdef DOXYGEN_RUNNING
+
+    /// This class represents a vertex.
+    /// \cgalModels `Index`
+    /// \cgalModels `LessThanComparable`
+    /// \cgalModels `Hashable`
+    /// \sa `Halfedge_index`, `Edge_index`, `Face_index`
+    class Vertex_index
+    {
+    public:
+        /// %Default constructor.
+        Vertex_index() : SM_Index<Vertex_index>(-1) {}
+
+        explicit Vertex_index(size_type _idx) : SM_Index<Vertex_index>(_idx) {}
+
+        /// prints the index and a short identification string to an ostream.
+        friend std::ostream& operator<<(std::ostream& os, typename Surface_mesh::Vertex_index const& v)
+        {
+          return (os << 'v' << (size_type)v );
+        }
+    };
+#else
+  typedef SM_Vertex_index Vertex_index;
+#endif
+
+#ifdef DOXYGEN_RUNNING
+
+    /// This class represents a halfedge.
+    /// \cgalModels `Index`
+    /// \cgalModels `LessThanComparable`
+    /// \cgalModels `Hashable`
+    /// \sa `Vertex_index`, `Edge_index`, `Face_index`
+    class Halfedge_index
+    {
+    public:
+        /// %Default constructor
+        Halfedge_index() : SM_Index<Halfedge_index>(-1) {}
+
+        explicit Halfedge_index(size_type _idx) : SM_Index<Halfedge_index>(_idx) {}
+
+        /// prints the index and a short identification string to an ostream.
+        friend std::ostream& operator<<(std::ostream& os, typename Surface_mesh::Halfedge_index const& h)
+        {
+          return (os << 'h' << (size_type)h );
+        }
+
+    };
+#else
+  typedef SM_Halfedge_index Halfedge_index;
+#endif
+
+#ifdef DOXYGEN_RUNNING
+    /// This class represents a face
+    /// \cgalModels `Index`
+    /// \cgalModels `LessThanComparable`
+    /// \cgalModels `Hashable`
+    /// \sa `Vertex_index`, `Halfedge_index`, `Edge_index`
+    class Face_index
+    {
+    public:
+        /// %Default constructor
+        Face_index() : SM_Index<Face_index>(-1) {}
+
+        explicit Face_index(size_type _idx) : SM_Index<Face_index>(_idx) {}
+
+        /// prints the index and a short identification string to an ostream.
+        friend std::ostream& operator<<(std::ostream& os, typename Surface_mesh::Face_index const& f)
+        {
+          return (os << 'f' << (size_type)f );
+        }
+    };
+#else
+  typedef SM_Face_index Face_index;
+#endif
+
+#ifdef DOXYGEN_RUNNING
+    /// This class represents an edge.
+    /// \cgalModels `Index`
+    /// \cgalModels `LessThanComparable`
+    /// \cgalModels `Hashable`
+    /// \sa `Vertex_index`, `Halfedge_index`, `Face_index`
+    class Edge_index
+    {
+    public:
+        /// %Default constructor
+        Edge_index() : halfedge_(-1) { }
+
+        Edge_index(size_type idx) : halfedge_(idx * 2) { }
+
+        /// constructs an `Edge_index` from a halfedge.
+        Edge_index(Halfedge_index he) : halfedge_(he) { }
+        /// @cond CGAL_DOCUMENT_INTERNALS
+        /// returns the internal halfedge.
+        Halfedge_index halfedge() const { return halfedge_; }
+
+        /// returns the underlying index of this index.
+        operator size_type() const { return (size_type)halfedge_ / 2; }
+
+        /// resets index to be invalid (index=-1)
+        void reset() { halfedge_.reset(); }
+
+        /// returns whether the index is valid, i.e., the index is not equal to -1.
+        bool is_valid() const { return halfedge_.is_valid(); }
+
+        /// Are two indices equal?
+        bool operator==(const Edge_index& other) const { return (size_type)(*this) == (size_type)other; }
+
+        /// Are two indices different?
+        bool operator!=(const Edge_index& other) const { return (size_type)(*this) != (size_type)other; }
+
+        /// compares by index.
+        bool operator<(const Edge_index& other) const { return (size_type)(*this) < (size_type)other;}
+
+        /// decrements the internal index. This operation does not
+        /// guarantee that the index is valid or undeleted after the
+        /// decrement.
+        Edge_index& operator--() { halfedge_ = Halfedge_index((size_type)halfedge_ - 2); return *this; }
+
+        /// increments the internal index. This operation does not
+        /// guarantee that the index is valid or undeleted after the
+        /// increment.
+        Edge_index& operator++() { halfedge_ = Halfedge_index((size_type)halfedge_ + 2); return *this; }
+
+        /// decrements internal index. This operation does not
+        /// guarantee that the index is valid or undeleted after the
+        /// decrement.
+        Edge_index operator--(int) { Edge_index tmp(*this); halfedge_ = Halfedge_index((size_type)halfedge_ - 2); return tmp; }
+
+        /// increments internal index. This operation does not
+        /// guarantee that the index is valid or undeleted after the
+        /// increment.
+        Edge_index operator++(int) { Edge_index tmp(*this); halfedge_ = Halfedge_index((size_type)halfedge_ + 2); return tmp; }
+
+        /// @endcond 
+
+        /// prints the index and a short identification string to an ostream.
+        friend std::ostream& operator<<(std::ostream& os, typename Surface_mesh::Edge_index const& e)
+        {
+          return (os << 'e' << (size_type)e << " on " << e.halfedge());
+        }
+    private:
+        Halfedge_index halfedge_;
+    };
+#else
+  typedef SM_Edge_index Edge_index;
+#endif
+
+ 
+    ///@}
+private: //-------------------------------------------------- connectivity types
+
+    /// This type stores the vertex connectivity
+    /// \sa `Halfedge_connectivity`, `Face_connectivity`
+    struct Vertex_connectivity
+    {
+        /// an incoming halfedge per vertex (it will be a border halfedge for border vertices)
+        Halfedge_index  halfedge_;
+    };
+
+
+    /// This type stores the halfedge connectivity
+    /// \sa `Vertex_connectivity`, `Face_connectivity`
+    struct Halfedge_connectivity
+    {
+        /// face incident to halfedge
+        Face_index      face_;
+        /// vertex the halfedge points to
+        Vertex_index    vertex_;
+        /// next halfedge within a face (or along a border)
+        Halfedge_index  next_halfedge_;
+        /// previous halfedge within a face (or along a border)
+        Halfedge_index  prev_halfedge_;
+    };
+
+
+    /// This type stores the face connectivity
+    /// \sa `Vertex_connectivity`, `Halfedge_connectivity`
+    struct Face_connectivity
+    {
+        /// a halfedge that is part of the face
+        Halfedge_index  halfedge_;
+    };
+
+private: //------------------------------------------------------ iterator types
+    template<typename Index_>
+    class Index_iterator
+      : public boost::iterator_facade< Index_iterator<Index_>,
+                                       Index_,
+                                       std::bidirectional_iterator_tag
+                                       >
+    {
+        typedef boost::iterator_facade< Index_iterator<Index_>,
+                                        Index_,
+                                        std::bidirectional_iterator_tag
+                                        > Facade;
+    public:
+        Index_iterator() : hnd_(), mesh_(NULL) {}
+        Index_iterator(const Index_& h, const Surface_mesh* m)
+          : hnd_(h), mesh_(m) {
+          if (mesh_ && mesh_->has_garbage()){
+              while (mesh_->has_valid_index(hnd_) && mesh_->is_removed(hnd_)) ++hnd_;
+          }
+        }
+    private:
+        friend class boost::iterator_core_access;
+        void increment()
+        {
+            ++hnd_;
+            CGAL_assertion(mesh_ != NULL);
+
+            if(mesh_->has_garbage())
+              while ( mesh_->has_valid_index(hnd_) && mesh_->is_removed(hnd_)) ++hnd_;
+        }
+  
+        void decrement()
+        {
+            --hnd_;
+            CGAL_assertion(mesh_ != NULL);
+            if(mesh_->has_garbage())
+               while ( mesh_->has_valid_index(hnd_) && mesh_->is_removed(hnd_)) --hnd_;
+        }
+
+        bool equal(const Index_iterator& other) const
+        {
+            return this->hnd_ == other.hnd_;
+        }
+
+        Index_& dereference() const { return const_cast<Index_&>(hnd_); }
+
+        Index_ hnd_;
+        const Surface_mesh* mesh_;
+
+    };
+public:
+    /// \name Range Types
+    ///
+    /// Each range `R` in this section has a nested type `R::iterator`, 
+    /// is convertible to `std:pair<R::iterator,R::iterator>`, so that one can use `boost::tie()`,
+    /// and can be used with `BOOST_FOREACH()`, as well as with the C++11 range based for-loop.
+
+    ///@{
+
+#ifndef DOXYGEN_RUNNING
+    typedef Index_iterator<Vertex_index> Vertex_iterator;
+#endif
+
+    /// \brief The range over all vertex indices.
+    ///
+    /// A model of <a href="http://www.boost.org/libs/range/doc/html/range/concepts/bidirectional_range.html">BidirectionalRange</a> with value type `Vertex_index`.
+    /// \sa `vertices()`
+    /// \sa `Halfedge_range`, `Edge_range`, `Face_range`
+#ifdef DOXYGEN_RUNNING
+    typedef unspecified_type Vertex_range;
+#else
+    typedef Iterator_range<Vertex_iterator> Vertex_range;
+#endif
+
+#ifndef DOXYGEN_RUNNING
+    typedef Index_iterator<Halfedge_index> Halfedge_iterator;
+#endif
+
+    /// \brief The range over all halfedge indices.
+    ///
+    /// A model of <a href="http://www.boost.org/libs/range/doc/html/range/concepts/bidirectional_range.html">BidirectionalRange</a> with value type `Halfedge_index`.
+    /// \sa `halfedges()`
+    /// \sa `Vertex_range`, `Edge_range`, `Face_range`
+#ifdef DOXYGEN_RUNNING
+    typedef unspecified_type Halfedge_range;
+#else
+    typedef Iterator_range<Halfedge_iterator> Halfedge_range;
+#endif
+
+#ifndef DOXYGEN_RUNNING
+    typedef Index_iterator<Edge_index> Edge_iterator;
+#endif
+
+    /// \brief The range over all edge indices.
+    ///
+    /// A model of <a href="http://www.boost.org/libs/range/doc/html/range/concepts/bidirectional_range.html">BidirectionalRange</a> with value type `Edge_index`.
+    /// \sa `edges()`
+    /// \sa `Halfedge_range`, `Vertex_range`, `Face_range`
+#ifdef DOXYGEN_RUNNING
+    typedef unspecified_type Edge_range;
+#else
+    typedef Iterator_range<Edge_iterator> Edge_range;
+#endif
+
+
+#ifndef DOXYGEN_RUNNING
+    typedef Index_iterator<Face_index> Face_iterator;
+#endif
+    /// \brief The range over all face indices.
+    ///
+    /// A model of <a href="http://www.boost.org/libs/range/doc/html/range/concepts/bidirectional_range.html">BidirectionalRange</a> with value type `Face_index`.
+    /// \sa `faces()`
+    /// \sa `Vertex_range`, `Halfedge_range`, `Edge_range`
+ #ifdef DOXYGEN_RUNNING
+    typedef unspecified_type Face_range;
+#else
+   typedef Iterator_range<Face_iterator> Face_range;
+#endif
+
+#ifndef DOXYGEN_RUNNING 
+
+  typedef CGAL::Vertex_around_target_iterator<Surface_mesh> Vertex_around_target_iterator;
+  typedef Iterator_range<Vertex_around_target_iterator> Vertex_around_target_range;
+
+  typedef CGAL::Halfedge_around_target_iterator<Surface_mesh>  Halfedge_around_target_iterator;
+  typedef Iterator_range<Halfedge_around_target_iterator> Halfedge_around_target_range;
+
+  typedef CGAL::Face_around_target_iterator<Surface_mesh>  Face_around_target_iterator;
+  typedef Iterator_range<Face_around_target_iterator> Face_around_target_range;
+
+  typedef CGAL::Vertex_around_face_iterator<Surface_mesh>  Vertex_around_face_iterator;
+  typedef Iterator_range<Vertex_around_face_iterator> Vertex_around_face_range;
+
+  typedef CGAL::Halfedge_around_face_iterator<Surface_mesh>  Halfedge_around_face_iterator;
+  typedef Iterator_range<Halfedge_around_face_iterator> Halfedge_around_face_range;
+
+  typedef CGAL::Face_around_face_iterator<Surface_mesh>  Face_around_face_iterator;
+  typedef Iterator_range<Face_around_face_iterator> Face_around_face_range;
+#endif
+
+    /// @cond CGAL_BEGIN_END
+    /// Start iterator for vertices.
+    Vertex_iterator vertices_begin() const
+    {
+        return Vertex_iterator(Vertex_index(0), this);
+    }
+
+    /// End iterator for vertices.
+    Vertex_iterator vertices_end() const
+    {
+        return Vertex_iterator(Vertex_index(num_vertices()), this);
+    }
+    /// @endcond
+
+
+    /// returns the iterator range of the vertices of the mesh.
+    Vertex_range vertices() const {
+      return make_range(vertices_begin(), vertices_end());
+    }
+
+
+    /// @cond CGAL_BEGIN_END
+    /// Start iterator for halfedges.
+    Halfedge_iterator halfedges_begin() const
+    {
+        return Halfedge_iterator(Halfedge_index(0), this);
+    }
+
+    /// End iterator for halfedges.
+    Halfedge_iterator halfedges_end() const
+    {
+        return Halfedge_iterator(Halfedge_index(num_halfedges()), this);
+    }
+    /// @endcond
+
+
+    /// returns the iterator range of the halfedges of the mesh.
+    Halfedge_range halfedges() const {
+      return make_range(halfedges_begin(), halfedges_end());
+    }
+
+
+    /// @cond CGAL_BEGIN_END
+    /// Start iterator for edges.
+    Edge_iterator edges_begin() const
+    {
+        return Edge_iterator(Edge_index(0), this);
+    }
+
+    /// End iterator for edges.
+    Edge_iterator edges_end() const
+    {
+        return Edge_iterator(Edge_index(num_edges()), this);
+    }
+    /// @endcond
+
+
+    /// returns the iterator range of the edges of the mesh.
+    Edge_range edges() const
+    {
+        return make_range(edges_begin(), edges_end());
+    }
+
+
+    /// @cond CGAL_BEGIN_END
+    /// Start iterator for faces.
+    Face_iterator faces_begin() const
+    {
+        return Face_iterator(Face_index(0), this);
+    }
+
+    /// End iterator for faces.
+    Face_iterator faces_end() const
+    {
+        return Face_iterator(Face_index(num_faces()), this);
+    }
+    /// @endcond
+
+    /// returns the iterator range of the faces of the mesh.
+    Face_range faces() const {
+      return make_range(faces_begin(), faces_end());
+    }
+
+#ifndef DOXYGEN_RUNNING
+    /// returns the iterator range for vertices around vertex `target(h)`, starting at `source(h)`.
+    Vertex_around_target_range vertices_around_target(Halfedge_index h) const
+    {
+      return CGAL::vertices_around_target(h,*this);
+    }
+
+    /// returns the iterator range for incoming halfedges around vertex `target(h)`, starting at `h`.
+    Halfedge_around_target_range halfedges_around_target(Halfedge_index h) const
+    {
+      return CGAL::halfedges_around_target(h,*this);
+    }
+
+    /// returns the iterator range for faces around vertex `target(h)`, starting at `face(h)`.
+    Face_around_target_range faces_around_target(Halfedge_index h) const
+    {
+      return CGAL::faces_around_target(h,*this);
+    }
+
+    /// returns the iterator range for vertices around face `face(h)`, starting at `target(h)`.
+    Vertex_around_face_range vertices_around_face(Halfedge_index h) const
+     {
+       return CGAL::vertices_around_face(h,*this);
+     }
+
+    /// returns the iterator range for halfedges around face `face(h)`, starting at `h`.
+    Halfedge_around_face_range halfedges_around_face(Halfedge_index h) const
+    {
+      return CGAL::halfedges_around_face(h,*this);
+    }
+
+    /// returns the iterator range for halfedges around face `face(h)`, starting at `h`.
+    Face_around_face_range faces_around_face(Halfedge_index h) const
+    {
+       return CGAL::faces_around_face(h,*this);
+    }
+
+#endif
+
+    ///@}
+
+
+public: 
+
+#ifndef DOXYGEN_RUNNING
+    /// \name Circulator Types
+    ///
+    /// The following circulators enable to iterate through the elements around a face or vertex.
+    /// As explained in the \ref SurfaceMeshOrientation "User Manual", we can speak of a  
+    /// *clockwise* or *counterclockwise*
+    /// traversal, by looking at the surface from the right side.  
+    ///@{
+
+    /// \brief This class circulates clockwise through all 
+    /// one-ring neighbors of a vertex. 
+    ///  A model of `BidirectionalCirculator` with value type `Vertex_index`.
+    /// \sa `Halfedge_around_target_circulator`, `Face_around_target_circulator`
+
+  typedef CGAL::Vertex_around_target_circulator<Surface_mesh> Vertex_around_target_circulator;
+
+
+
+    /// \brief This class circulates clockwise through all incident faces of a vertex.
+    ///  A model of `BidirectionalCirculator` with value type `Face_index`.
+    /// \sa `Vertex_around_target_circulator`, `Halfedge_around_target_circulator`
+
+  typedef CGAL::Face_around_target_circulator<Surface_mesh> Face_around_target_circulator;
+
+
+    /// \brief This class circulates clockwise through all halfedges around a vertex that have this vertex as target.
+    ///  A model of `BidirectionalCirculator` with value type `Halfedge_index`.
+    /// \sa `Vertex_around_target_circulator`, `Halfedge_around_target_circulator`
+
+  typedef CGAL::Halfedge_around_target_circulator<Surface_mesh> Halfedge_around_target_circulator;
+
+
+    /// \brief This class circulates clockwise through all halfedges around a vertex that have this vertex as source.
+    ///  A model of `BidirectionalCirculator` with value type `Halfedge_index`.
+    /// \sa `Vertex_around_target_circulator`, `Halfedge_around_target_circulator`
+
+  typedef CGAL::Halfedge_around_source_circulator<Surface_mesh> Halfedge_around_source_circulator;
+
+    /// \brief This class circulates counterclockwise through all vertices around a face.
+    ///  A model of `BidirectionalCirculator` with value type `Vertex_index`.
+
+  typedef  CGAL::Vertex_around_face_circulator<Surface_mesh> Vertex_around_face_circulator;
+
+
+    /// \brief This class circulates counterclockwise through all halfedges around a face.
+    ///  A model of `BidirectionalCirculator` with value type `Halfedge_index`.
+
+  typedef  CGAL::Halfedge_around_face_circulator<Surface_mesh> Halfedge_around_face_circulator;
+
+   /// \brief This class circulates counterclockwise through all faces around a face.
+   ///  A model of `BidirectionalCirculator` with value type `Face_index`.
+   ///  Note that the face index is the same after `operator++`, if the neighboring faces share 
+   ///  several halfedges.
+
+  typedef  CGAL::Face_around_face_circulator<Surface_mesh> Face_around_face_circulator;
+  /// @}
+#endif
+
+  /// @cond CGAL_DOCUMENT_INTERNALS
+  // typedefs which make it easier to write the partial specialisation of boost::graph_traits
+
+  typedef Vertex_index   vertex_index;
+  typedef P                   vertex_property_type;
+  typedef Halfedge_index halfedge_index;
+  typedef Edge_index     edge_index;
+  typedef Face_index     face_index;
+
+  typedef Vertex_iterator     vertex_iterator;
+  typedef Halfedge_iterator   halfedge_iterator;
+  typedef Edge_iterator       edge_iterator;
+  typedef Face_iterator      face_iterator;
+  typedef CGAL::Out_edge_iterator<Self>     out_edge_iterator;
+
+  typedef boost::undirected_tag             directed_category;
+  typedef boost::disallow_parallel_edge_tag edge_parallel_category; 
+
+  struct traversal_category : public virtual boost::bidirectional_graph_tag,
+                              public virtual boost::vertex_list_graph_tag,
+                              public virtual boost::edge_list_graph_tag
+  {};
+
+  typedef size_type vertices_size_type;
+  typedef size_type halfedges_size_type;
+  typedef size_type edges_size_type;
+  typedef size_type faces_size_type;
+  typedef size_type degree_size_type;
+
+ /// @endcond
+public:
+
+    /// \name Construction, Destruction, Assignment
+    ///
+    ///  Copy constructors as well as assignment do also copy simplices marked as removed.
+    ///@{
+
+    /// %Default constructor.
+    Surface_mesh();
+
+    /// Copy constructor: copies `rhs` to `*this`. Performs a deep copy of all properties.
+    Surface_mesh(const Surface_mesh& rhs) { *this = rhs; }
+
+    /// assigns `rhs` to `*this`. Performs a deep copy of all properties.
+    Surface_mesh& operator=(const Surface_mesh& rhs);
+
+    /// assigns `rhs` to `*this`. Does not copy custom properties.
+    Surface_mesh& assign(const Surface_mesh& rhs);
+
+    ///@}
+
+public:
+
+    /// \name Adding Vertices, Edges, and Faces
+    ///@{
+
+   /// adds a new vertex, and resizes vertex properties if necessary.
+    Vertex_index add_vertex()
+    {
+      size_type inf = -1;
+      if(vertices_freelist_ != inf){
+        size_type idx = vertices_freelist_;
+        vertices_freelist_ = (size_type)vconn_[Vertex_index(vertices_freelist_)].halfedge_;
+        --removed_vertices_;
+        vremoved_[Vertex_index(idx)] = false;
+        return Vertex_index(idx);
+      } else {
+        vprops_.push_back();
+        return Vertex_index(num_vertices()-1);
+      }
+    }
+
+    /// adds a new vertex, resizes vertex properties if necessary,
+    /// and sets the \em point property to `p`.
+    /// \note Several vertices may have the same point property.
+    Vertex_index add_vertex(const Point& p) 
+    {
+        Vertex_index v = add_vertex();
+        vpoint_[v] = p;
+        return v;
+    }
+
+
+
+public:
+
+    /// adds a new edge, and resizes edge and halfedge properties if necessary.
+    Halfedge_index add_edge()
+    {
+      Halfedge_index h0, h1;
+      size_type inf = -1;
+      if(edges_freelist_ != inf){
+        size_type idx = edges_freelist_;
+        edges_freelist_ = (size_type)hconn_[Halfedge_index(edges_freelist_)].next_halfedge_;
+        --removed_edges_;
+        eremoved_[Edge_index(Halfedge_index(idx))] = false;
+        return Halfedge_index(idx);
+      } else {
+        eprops_.push_back();
+        hprops_.push_back();
+        hprops_.push_back();
+
+        return Halfedge_index(num_halfedges()-2);
+      }
+    }
+
+    /// adds two opposite halfedges, and resizes edge and halfedge properties if necessary.
+    /// Sets the targets of the halfedge to the given vertices, but does not modify the halfedge
+    /// associated to the vertices.
+    /// \note The function does not check whether there is already an edge between the vertices.
+    /// \returns the halfedge with `v1` as target
+
+    Halfedge_index add_edge(Vertex_index v0, Vertex_index v1)
+    {
+        CGAL_assertion(v0 != v1);
+        Halfedge_index h = add_edge();
+
+        set_target(h, v1);
+        set_target(opposite(h), v0);
+
+        return h;
+    }
+
+    /// adds a new face, and resizes face properties if necessary.
+    Face_index add_face()
+    {
+      size_type inf = -1;
+      if(faces_freelist_ != inf){
+        size_type idx = faces_freelist_;
+        faces_freelist_ = (size_type)fconn_[Face_index(faces_freelist_)].halfedge_;
+        --removed_faces_;
+        fremoved_[Face_index(idx)] = false;
+        return Face_index(idx);
+      } else {
+        fprops_.push_back();
+        return Face_index(num_faces()-1);
+      }
+    }
+
+    /// if possible, adds a new face with vertices from a range with value type `Vertex_index`.
+    /// The function adds halfedges between successive vertices if they are not yet indicent to halfedges,
+    /// or updates the connectivity of halfedges already in place. 
+    /// Resizes halfedge, edge, and face properties if necessary.
+    /// \returns the face index of the added face, or `Surface_mesh::null_face()` if the face could not be added.
+    template <typename Range>
+    Face_index add_face(const Range& vertices);
+
+
+    /// adds a new triangle connecting vertices `v0`, `v1`, `v2`.
+    /// \returns the face index of the added face, or `Surface_mesh::null_face()` if the face could not be added.
+    Face_index add_face(Vertex_index v0, Vertex_index v1, Vertex_index v2)
+    {
+        boost::array<Vertex_index, 3> 
+            v = {{v0, v1, v2}};
+        return add_face(v);
+    }
+
+    /// adds a new quad connecting vertices `v0`, `v1`, `v2`, `v3`.
+    /// \returns the face index of the added face, or `Surface_mesh::null_face()` if the face could not be added.
+    Face_index add_face(Vertex_index v0, Vertex_index v1, Vertex_index v2, Vertex_index v3)
+    {
+        boost::array<Vertex_index, 4> 
+            v = {{v0, v1, v2, v3}};
+        return add_face(v);
+    }
+
+    ///@}
+
+
+ 
+    /// \name Low-Level Removal Functions 
+    ///
+    /// Although the elements are only marked as removed
+    /// their connectivity and properties should not be used.
+    ///
+    /// \warning Functions in this group do not adjust any of
+    /// connected elements and usually leave the surface mesh in an
+    /// invalid state.
+    /// 
+    ///
+    /// @{
+
+    /// removes vertex `v` from the halfedge data structure without
+    /// adjusting anything.
+    void remove_vertex(Vertex_index v)
+    {
+        vremoved_ = add_property_map<Vertex_index, bool>("v:removed", false).first;
+        vremoved_[v] = true; ++removed_vertices_; garbage_ = true;
+        vconn_[v].halfedge_ = Halfedge_index(vertices_freelist_);
+        vertices_freelist_ = (size_type)v;
+    }
+
+    /// removes the two halfedges corresponding to `e` from the halfedge data structure without
+    /// adjusting anything.
+    void remove_edge(Edge_index e)
+    {
+        eremoved_ = add_property_map<Edge_index, bool>("e:removed", false).first;
+        eremoved_[e] = true; ++removed_edges_; garbage_ = true;
+        hconn_[Halfedge_index((size_type)e << 1)].next_halfedge_ = Halfedge_index(edges_freelist_ );
+        edges_freelist_ = ((size_type)e << 1);
+    }
+
+    /// removes  face `f` from the halfedge data structure without
+    /// adjusting anything.
+
+    void remove_face(Face_index f)
+    {
+        fremoved_ = add_property_map<Face_index, bool>("f:removed", false).first;
+        fremoved_[f] = true; ++removed_faces_; garbage_ = true;
+        fconn_[f].halfedge_ = Halfedge_index(faces_freelist_);
+        faces_freelist_ = (size_type)f;
+    }
+
+
+    ///@}
+
+
+    /// \name Memory Management
+    ///
+    /// Functions to check the number of elements, the amount of space
+    /// allocated for elements, and to clear the structure.
+    ///@{
+
+  /// returns the number of vertices in the mesh.
+  size_type number_of_vertices() const
+  {
+    return num_vertices() - number_of_removed_vertices();
+  }
+ 
+  /// returns the number of halfedges in the mesh.
+  size_type number_of_halfedges() const
+  {
+    return num_halfedges() - number_of_removed_halfedges();
+  }
+
+  /// returns the number of edges in the mesh.
+  size_type number_of_edges() const
+  {
+    return num_edges() - number_of_removed_edges();
+  }
+
+  /// returns the number of faces in the mesh.
+  size_type number_of_faces() const
+  {
+    return num_faces() - number_of_removed_faces();
+  }
+
+    /// returns `true` iff the mesh is empty, i.e., has no vertices, halfedges and faces.
+    bool is_empty() const
+  {
+    return ( num_vertices() == number_of_removed_vertices()
+             && num_halfedges() == number_of_removed_halfedges()
+             && num_faces() == number_of_removed_faces());
+  }
+
+    /// removes all vertices, halfedge, edges and faces. Collects garbage and clears all properties.
+    void clear();
+
+ 
+    /// reserves space for vertices, halfedges, edges, faces, and their currently
+    /// associated properties.
+    void reserve(size_type nvertices,
+                 size_type nedges,
+                 size_type nfaces )
+    {
+        vprops_.reserve(nvertices);
+        hprops_.reserve(2*nedges);
+        eprops_.reserve(nedges);
+        fprops_.reserve(nfaces);
+    }
+
+      void resize(size_type nvertices,
+                 size_type nedges,
+                 size_type nfaces )
+    {
+        vprops_.resize(nvertices);
+        hprops_.resize(2*nedges);
+        eprops_.resize(nedges);
+        fprops_.resize(nfaces);
+    }
+  
+  bool join(const Surface_mesh& other)
+  {
+    size_type nv = num_vertices(), nh = num_halfedges(), nf = num_faces();
+    resize(num_vertices()+  other.num_vertices(),
+            num_edges()+  other.num_edges(),
+            num_faces()+  other.num_faces());
+
+    vprops_.transfer(other.vprops_);
+    hprops_.transfer(other.hprops_);
+    fprops_.transfer(other.fprops_);
+    eprops_.transfer(other.eprops_);
+
+    for(size_type i = nv; i < nv+other.num_vertices(); i++){
+      Vertex_index vi(i);
+      if(vconn_[vi].halfedge_ != null_halfedge()){
+        vconn_[vi].halfedge_ = Halfedge_index(size_type(vconn_[vi].halfedge_)+nh);
+      }
+    }
+    for(size_type i = nf; i < nf+other.num_faces(); i++){
+      Face_index fi(i);
+      if(fconn_[fi].halfedge_ != null_halfedge()){
+        fconn_[fi].halfedge_ = Halfedge_index(size_type(fconn_[fi].halfedge_)+nh);
+      }
+    }
+    for(size_type i = nh; i < nh+other.num_halfedges(); i++){
+      Halfedge_index hi(i);
+      if(hconn_[hi].face_ != null_face()){
+        hconn_[hi].face_ = Face_index(size_type(hconn_[hi].face_)+nf);
+      }
+      if( hconn_[hi].vertex_ != null_vertex()){
+        hconn_[hi].vertex_ = Vertex_index(size_type(hconn_[hi].vertex_)+nv);
+      }
+      if(hconn_[hi].next_halfedge_ != null_halfedge()){
+        hconn_[hi].next_halfedge_ = Halfedge_index(size_type(hconn_[hi].next_halfedge_)+nh);
+      }
+      if(hconn_[hi].prev_halfedge_ != null_halfedge()){
+        hconn_[hi].prev_halfedge_ = Halfedge_index(size_type(hconn_[hi].prev_halfedge_)+nh);
+      }
+    }
+    size_type nil = -1;
+    if(other.vertices_freelist_ != nil){
+      if(vertices_freelist_ != nil){
+        Vertex_index vi(nv+other.vertices_freelist_);
+        Halfedge_index inf(-1);
+        while(vconn_[vi].halfedge_ != inf){
+          vi = Vertex_index(size_type(vconn_[vi].halfedge_));
+        }
+        vconn_[vi].halfedge_ = Halfedge_index(vertices_freelist_);
+      }
+      vertices_freelist_ = nv + other.vertices_freelist_; 
+    }
+    if(other.faces_freelist_ != nil){
+      if(faces_freelist_ != nil){
+        Face_index fi(nf+other.faces_freelist_);
+        Halfedge_index inf(-1);
+        while(fconn_[fi].halfedge_ != inf){
+          fi = Face_index(size_type(fconn_[fi].halfedge_));
+        }
+        fconn_[fi].halfedge_ = Halfedge_index(faces_freelist_);
+      }
+      faces_freelist_ = nf + other.faces_freelist_; 
+    }
+    if(other.edges_freelist_ != nil){
+      if(edges_freelist_ != nil){
+        Halfedge_index hi((nh>>1)+other.edges_freelist_);
+        Halfedge_index inf(-1);
+        while(hconn_[hi].next_halfedge_ != inf){
+          hi = hconn_[hi].next_halfedge_;
+        }
+        hconn_[hi].next_halfedge_ = Halfedge_index(edges_freelist_);
+      }
+      edges_freelist_ = (nh>>1) + other.edges_freelist_; 
+    }
+    garbage_ = garbage_ || other.garbage_;
+    removed_vertices_ += other.removed_vertices_;
+    removed_edges_ += other.removed_edges_;
+    removed_faces_ += other.removed_faces_;
+    return true;
+  }
+
+    ///@}
+
+    
+    /// \name Garbage Collection
+    ///
+    /// While removing elements only marks them as removed
+    /// garbage collection really removes them.
+    /// The API in this section allows to check whether 
+    /// an element is removed, to get the number of
+    /// removed elements, and to collect garbage.
+    /// The number of elements together with the number of  removed elements is
+    /// an upperbound on the index, and is needed
+    /// by algorithms that temporarily store a 
+    /// property in a vector of the appropriate size.
+    /// Note however that by garbage collecting elements get new indices.
+    /// In case you store indices in an auxiliary data structure
+    /// or in a property these indices are potentially no longer 
+    /// refering to the right elements. 
+
+
+    ///@{
+#ifndef DOXYGEN_RUNNING
+   /// returns the number of used and removed vertices in the mesh.
+    size_type num_vertices() const { return (size_type) vprops_.size(); }
+
+    /// returns the number of used and removed halfedges in the mesh.
+    size_type num_halfedges() const { return (size_type) hprops_.size(); }
+
+    /// returns the number of used and removed edges in the mesh.
+    size_type num_edges() const { return (size_type) eprops_.size(); }
+
+    /// returns the number of used and removed faces in the mesh.
+    size_type num_faces() const { return (size_type) fprops_.size(); }
+
+#endif
+
+    /// returns the number of vertices in the mesh which are marked removed.
+    size_type number_of_removed_vertices() const { return removed_vertices_; }
+
+    /// returns the number of halfedges in the mesh which are marked removed.
+    size_type number_of_removed_halfedges() const { return 2*removed_edges_; }
+
+    /// returns the number of edges in the mesh which are marked removed.
+    size_type number_of_removed_edges() const { return removed_edges_; }
+
+    /// returns the number offaces in the mesh which are marked removed.
+    size_type number_of_removed_faces() const { return removed_faces_; }
+
+
+
+    /// returns whether vertex `v` is marked removed.
+    /// \sa `collect_garbage()`
+    bool is_removed(Vertex_index v) const
+    {
+        return vremoved_[v];
+    }
+    /// returns whether halfedge `h` is marked removed.
+    /// \sa `collect_garbage()`
+    bool is_removed(Halfedge_index h) const
+    {
+        return eremoved_[edge(h)];
+    }
+    /// returns whether edge `e` is marked removed.
+    /// \sa `collect_garbage()`
+    bool is_removed(Edge_index e) const
+    {
+        return eremoved_[e];
+    }
+    /// returns whether face `f` is marked removed.
+    /// \sa `collect_garbage()`
+    bool is_removed(Face_index f) const
+    {
+        return fremoved_[f];
+    }
+
+    /// checks if any vertices, halfedges, edges, or faces are marked as removed.
+    /// \sa collect_garbage
+    bool has_garbage() const { return garbage_; }
+
+    /// really removes vertices, halfedges, edges, and faces which are marked removed.
+    /// \sa `has_garbage()`
+    /// \attention By garbage collecting elements get new indices.
+    /// In case you store indices in an auxiliary data structure
+    /// or in a property these indices are potentially no longer 
+    /// refering to the right elements. 
+    void collect_garbage();
+
+
+    /// @cond CGAL_DOCUMENT_INTERNALS
+    /// removes unused memory from vectors. This shrinks the storage
+    /// of all properties to the minimal required size.
+    /// \attention Invalidates all existing references to properties.
+
+    void shrink_to_fit()
+    {
+        vprops_.shrink_to_fit();
+        hprops_.shrink_to_fit();
+        eprops_.shrink_to_fit();
+        fprops_.shrink_to_fit();
+    }
+    /// @endcond
+
+    ///@}
+
+    /// @cond CGAL_DOCUMENT_INTERNALS
+    ///
+    /// \name Simple Validity Checks
+    ///
+    /// Functions in this group check if the index is valid, that is between
+    /// `0` and the currently allocated maximum amount of the
+    /// elements. They do not check if an element is marked as removed.
+    ///@{
+
+    /// returns whether the index of vertex `v` is valid, that is within the current array bounds.
+    bool has_valid_index(Vertex_index v) const
+    {
+      return ((size_type)v < num_vertices());
+    } 
+
+    /// returns whether the index of halfedge `h` is valid, that is within the current array bounds.
+    bool has_valid_index(Halfedge_index h) const
+    {
+      return ((size_type)h < num_halfedges());
+    }
+    /// returns whether the index of edge `e` is valid, that is within the current array bounds.
+    bool has_valid_index(Edge_index e) const
+    {
+      return ((size_type)e < num_edges());
+    }
+    /// returns whether the index of face `f` is valid, that is within the current array bounds.
+    bool has_valid_index(Face_index f) const
+    {
+        return ((size_type)f < num_faces());
+    }
+
+    /// @}
+    /// @endcond
+    
+    /// \name Validity Checks
+    ///
+    /// Functions in this group perform checks for structural
+    /// consistency of a complete surface mesh, or an individual element. 
+    /// They are expensive and should only be used in debug configurations.
+
+    ///@{
+
+    /// perform an expensive validity check on the data structure and
+    /// print found errors to `std::cerr` when `verbose == true`.
+  bool is_valid(bool verbose = true) const
+    {
+        bool valid = true;
+        size_type vcount = 0, hcount = 0, fcount = 0;
+        for(Halfedge_iterator it = halfedges_begin(); it != halfedges_end(); ++it) { 
+            ++hcount;
+            valid = valid && next(*it).is_valid();
+            valid = valid && opposite(*it).is_valid();
+            if(!valid) {
+                if (verbose)
+                  std::cerr << "Integrity of halfedge " << *it << " corrupted."  << std::endl;
+                break;
+            }
+
+            valid = valid && (opposite(*it) != *it);
+            valid = valid && (opposite(opposite(*it)) == *it);
+            if(!valid) {
+              if (verbose)
+                std::cerr << "Integrity of opposite halfedge of " << *it << " corrupted."  << std::endl;
+              break;
+            }
+
+            valid = valid && (next(prev(*it)) == *it);
+            if(!valid) {
+                if (verbose)
+                  std::cerr << "Integrity of previous halfedge of " << *it << " corrupted."  << std::endl;
+                break;
+            }
+
+            valid = valid && (prev(next(*it)) == *it);
+            if(!valid) {
+                if (verbose)
+                  std::cerr << "Integrity of next halfedge of " << *it << " corrupted."  << std::endl;
+                break;
+            }
+
+            valid = valid && target(*it).is_valid();
+            if(!valid) {
+                if (verbose)
+                  std::cerr << "Integrity of vertex of halfedge " << *it << " corrupted."  << std::endl;
+                break;
+            }
+
+            valid = valid && (target(*it) == target(opposite(next(*it))));
+            if(!valid) {
+                if (verbose)
+                  std::cerr << "Halfedge vertex of next opposite is not the same for " << *it << "."  << std::endl;
+                break;
+            }
+        }
+
+        for(Vertex_iterator it = vertices_begin(); it != vertices_end(); ++it) {
+          ++vcount;
+            if(halfedge(*it).is_valid()) {
+                // not an isolated vertex
+                valid = valid && (target(halfedge(*it)) == *it);
+                if(!valid) {
+                    if (verbose)
+                      std::cerr << "Halfedge of " << *it << " is not an incoming halfedge." << std::endl;
+                    break;
+                }
+            }
+        }
+        for(Face_iterator it = faces_begin(); it != faces_end(); ++it) {
+          ++fcount;
+        }
+        
+        valid = valid && (vcount == number_of_vertices());
+        if(!valid && verbose){
+          std::cerr << "#vertices: iterated: " << vcount << " vs number_of_vertices(): " << number_of_vertices()<< std::endl;
+        }
+
+        valid = valid && (hcount == number_of_halfedges());
+        if(!valid && verbose){
+          std::cerr << "#halfedges: iterated: " << hcount << " vs number_of_halfedges(): " << number_of_halfedges()<< std::endl;
+        }
+
+        valid = valid && (fcount == number_of_faces());
+        if(!valid && verbose){
+          std::cerr << "#faces: iterated: " << fcount << " vs number_of_faces(): " << number_of_faces()<< std::endl;
+        }
+        return valid;
+    }
+
+    /// performs a validity check on a single vertex.
+    bool is_valid(Vertex_index v) const {
+        Halfedge_index h = vconn_[v].halfedge_;
+        if(h!= null_halfedge() && (!has_valid_index(h) || is_removed(h))) {
+          std::cerr << "Vertex connectivity halfedge error in " << (size_type)v
+                    << " with " << (size_type)h << std::endl;
+            return false;
+        }
+        return true;
+    }
+
+    /// performs a validity check on a single halfedge.
+    bool is_valid(Halfedge_index h) const {
+        Face_index f = hconn_[h].face_;
+        Vertex_index v = hconn_[h].vertex_;
+        Halfedge_index hn = hconn_[h].next_halfedge_;
+        Halfedge_index hp = hconn_[h].prev_halfedge_;
+
+        bool valid = true;
+        // don't validate the face if this is a border halfedge
+        if(!is_border(h)) {
+            if(!has_valid_index(f) || is_removed(f)) {
+                std::cerr << "Halfedge connectivity Face "
+                          << (!has_valid_index(f) ? "invalid" : "removed")
+                          << " in " << (size_type)h << std::endl;
+                valid = false;
+            }
+        }
+
+        if(!has_valid_index(v) || is_removed(v)) {
+            std::cerr << "Halfedge connectivity Vertex "
+                      << (!has_valid_index(v) ? "invalid" : "removed")
+                      << " in " << (size_type)h << std::endl;
+            valid = false;
+        }
+
+        if(!has_valid_index(hn) || is_removed(hn)) {
+            std::cerr << "Halfedge connectivity hnext "
+                      << (!has_valid_index(hn) ? "invalid" : "removed")
+                      << " in " << (size_type)h << std::endl;
+            valid = false;
+        }
+        if(!has_valid_index(hp) || is_removed(hp)) {
+            std::cerr << "Halfedge connectivity hprev "
+                      << (!has_valid_index(hp) ? "invalid" : "removed")
+                      << " in " << (size_type)h << std::endl;
+            valid = false;
+        }
+        return valid;
+    }
+
+
+    /// performs a validity check on a single ede.
+    bool is_valid(Edge_index e) const {
+      Halfedge_index h = halfedge(e);
+      return is_valid(h) && is_valid(opposite(h));
+    }
+
+
+    /// performs a validity check on a single face.
+    bool is_valid(Face_index f) const {
+        Halfedge_index h = fconn_[f].halfedge_;
+        if(!has_valid_index(h) || is_removed(h)) {
+          std::cerr << "Face connectivity halfedge error in " << (size_type)f
+                      << " with " << (size_type)h << std::endl;
+            return false;
+        }
+        return true;
+    }
+
+    ///@}
+
+
+
+    /// \name Low-Level Connectivity
+    ///@{
+
+    /// returns the vertex the halfedge `h` points to.
+    Vertex_index target(Halfedge_index h) const
+    {
+        return hconn_[h].vertex_;
+    }
+
+    /// sets the vertex the halfedge `h` points to to `v`.
+    void set_target(Halfedge_index h, Vertex_index v)
+    {
+        hconn_[h].vertex_ = v;
+    }
+
+    /// returns the face incident to halfedge `h`.
+    Face_index face(Halfedge_index h) const
+    {
+        return hconn_[h].face_;
+    }
+
+    /// sets the incident face to halfedge `h` to `f`.
+    void set_face(Halfedge_index h, Face_index f)
+    {
+        hconn_[h].face_ = f;
+    }
+
+    /// returns the next halfedge within the incident face.
+    Halfedge_index next(Halfedge_index h) const
+    {
+        return hconn_[h].next_halfedge_;
+    }
+
+    /// returns the previous halfedge within the incident face.
+    Halfedge_index prev(Halfedge_index h) const
+    {
+        return hconn_[h].prev_halfedge_;
+    }
+
+    /// @cond CGAL_DOCUMENT_INTERNALS
+    // sets the next halfedge of `h` within the face to `nh`.
+    void set_next_only(Halfedge_index h, Halfedge_index nh)
+    {
+      hconn_[h].next_halfedge_ = nh;
+    }
+
+    // sets previous halfedge of `h` to `nh`.
+    void set_prev_only(Halfedge_index h, Halfedge_index nh)
+    {
+      if(h != null_halfedge()){
+        hconn_[h].prev_halfedge_ = nh;
+      }
+    }
+    /// @endcond  
+
+    /// sets the next halfedge of `h` within the face to `nh` and
+    /// the previous halfedge of `nh` to `h`.
+    void set_next(Halfedge_index h, Halfedge_index nh)
+    {
+      set_next_only(h, nh);
+      set_prev_only(nh, h);
+    }
+
+    /// returns an incoming halfedge of vertex `v`.
+    /// If `v` is a border vertex this will be a border halfedge.
+    /// \invariant `target(halfedge(v)) == v`
+    Halfedge_index halfedge(Vertex_index v) const
+    {
+        return vconn_[v].halfedge_;
+    }
+
+    /// sets the incoming halfedge of vertex `v` to `h`.
+    void set_halfedge(Vertex_index v, Halfedge_index h)
+    {
+        vconn_[v].halfedge_ = h;
+    }
+
+
+    /// returns a halfedge of face `f`.
+    Halfedge_index halfedge(Face_index f) const
+    {
+        return fconn_[f].halfedge_;
+    }
+
+    /// sets the halfedge of face `f` to `h`.
+    void set_halfedge(Face_index f, Halfedge_index h)
+    {
+        fconn_[f].halfedge_ = h;
+    }
+
+    /// returns the opposite halfedge of `h`. Note that there is no function `set_opposite()`.
+    Halfedge_index opposite(Halfedge_index h) const
+    {
+        return Halfedge_index(((size_type)h & 1) ? (size_type)h-1 : (size_type)h+1);
+    }
+
+    ///@}
+
+    /// \name Low-Level Connectivity Convenience Functions
+    ///@{
+
+    /// returns the vertex the halfedge `h` emanates from.
+    Vertex_index source(Halfedge_index h) const
+    {
+        return target(opposite(h));
+    }
+
+    /// returns `opposite(next(h))`, that is the next halfedge \ref SurfaceMeshOrientation 
+    /// "clockwise" around the target vertex of `h`.
+    Halfedge_index next_around_target(Halfedge_index h) const
+    {
+        return opposite(next(h));
+    }
+
+    /// returns `prev(opposite(h))`, that is the previous halfedge \ref SurfaceMeshOrientation
+    /// "clockwise" around the target vertex of `h`.
+    Halfedge_index prev_around_target(Halfedge_index h) const
+    {
+        return prev(opposite(h));
+    }
+
+    /// returns `next(opposite(h))`, that is the next halfedge \ref SurfaceMeshOrientation 
+    /// "clockwise" around the source vertex of `h`.
+    Halfedge_index next_around_source(Halfedge_index h) const
+    {
+        return next(opposite(h));
+    }
+
+    /// returns `opposite(prev(h))`, that is the previous halfedge \ref SurfaceMeshOrientation
+    /// "clockwise" around the source vertex of `h`.
+    Halfedge_index prev_around_source(Halfedge_index h) const
+    {
+        return opposite(prev(h));
+    }
+
+    /// returns the i'th vertex of edge `e`, for `i=0` or `1`.
+    Vertex_index vertex(Edge_index e, unsigned int i) const
+    {
+        CGAL_assertion(i<=1);
+        return target(halfedge(e, i));
+    }
+
+    /// finds a halfedge between two vertices. Returns a default constructed
+    /// `Halfedge_index`, if  `source` and  `target` are not connected.
+    Halfedge_index halfedge(Vertex_index source, Vertex_index target) const;
+
+    ///@}
+
+
+    /// \name Switching between Halfedges and Edges
+    ///@{
+
+    /// returns the edge that contains halfedge `h` as one of its two halfedges.
+    Edge_index edge(Halfedge_index h) const
+    {
+        return Edge_index(h);
+    }
+
+    /// returns the halfedge corresponding to the edge `e`.
+    Halfedge_index halfedge(Edge_index e) const
+    {
+        return Halfedge_index(e.halfedge());
+    }
+
+    /// returns the i'th halfedge of edge `e`, for `i=0` or `1`.
+    Halfedge_index halfedge(Edge_index e, unsigned int i) const
+    {
+        CGAL_assertion(i<=1);
+        return Halfedge_index(((size_type)e << 1) + i);
+    }
+
+    ///@}
+
+
+    /// \name Degree Functions
+    ///@{
+
+    /// returns the number of incident halfedges of vertex `v`.
+    size_type degree(Vertex_index v) const;
+
+    /// returns the number of incident halfedges of face `f`.
+    size_type degree(Face_index f) const;
+
+    ///@}
+
+
+
+    /// \name Borders
+    ///
+    ///  A halfedge, or edge is on the border of a surface mesh
+    /// if it is incident to a `null_face()`.  A vertex is on a border
+    /// if it is incident to a border halfedge. While for a halfedge and
+    /// edge this is a constant time operation, for a vertex it means
+    /// to look at all incident halfedges.  If algorithms operating on a 
+    /// surface mesh maintain that the halfedge associated to a border vertex is
+    /// a border halfedge, this is a constant time operation too.  
+    /// This section provides functions to check if an element is on a 
+    /// border and to change the halfedge associated to a border vertex.
+    ///@{
+
+    /// returns whether `v` is a border vertex. 
+    /// \cgalAdvancedBegin
+    /// With the default value for
+    /// `check_all_incident_halfedges` the function iteratates over the incident halfedges.
+    /// With `check_all_incident_halfedges == false` the function returns `true`, if the incident
+    /// halfedge associated to vertex `v` is a border halfedge.
+    /// \cgalAdvancedEnd
+  bool is_border(Vertex_index v, bool check_all_incident_halfedges = true) const
+    {
+        Halfedge_index h(halfedge(v));
+        if (h == null_halfedge()){
+          return false;
+        }
+        if(check_all_incident_halfedges){
+          Halfedge_around_target_circulator hatc(h,*this), done(hatc);
+          do {
+            if(is_border(*hatc)){
+              return true;
+            }
+          }while(++hatc != done);
+          return false;
+        }
+        return (!(is_valid(h) && is_border(h)));
+    }
+
+    /// returns whether `h` is a border halfege, that is if its incident face is `sm.null_face()`.
+    bool is_border(Halfedge_index h) const
+    {
+        return !face(h).is_valid();
+    }
+
+
+    /// returns whether `e` is a border edge, i.e., if any 
+    /// of its two halfedges is a border halfedge.
+    bool is_border(Edge_index e) const
+    {
+      return is_border(e.halfedge()) || is_border(opposite(e.halfedge()));
+    }
+
+  /// iterates over the incident halfedges and sets the incident halfedge
+  /// associated to vertex `v` to a border halfedge and returns `true` if it exists.
+  bool set_vertex_halfedge_to_border_halfedge(Vertex_index v)
+  {
+    if(halfedge(v) == null_halfedge()){
+      return false;
+    }
+    Halfedge_around_target_circulator hatc(halfedge(v),*this), done(hatc);
+    do {
+      if(is_border(*hatc)){
+        set_halfedge(v,*hatc);
+        return true;
+      }
+    }while(++hatc != done);
+    return false;
+  }
+
+  /// applies `set_vertex_halfedge_to_border_halfedge(Vertex_index)` on all vertices 
+  /// around the face associated to `h`.
+  void set_vertex_halfedge_to_border_halfedge(Halfedge_index h)
+  {
+    if(is_border(h)){
+      Halfedge_around_face_circulator hafc(h,*this),done(hafc);
+      do {
+        set_halfedge(target(*hafc),*hafc);
+      }while(++hafc != done);
+    } else {
+       Vertex_around_face_circulator vafc(h,*this),done(vafc);
+      do {
+        set_vertex_halfedge_to_border_halfedge(*vafc);
+      }while(++vafc != done);
+    }
+  }
+
+  /// applies `set_vertex_halfedge_to_border_halfedge(Vertex_index)` on all vertices 
+  /// of the surface mesh.
+  void set_vertex_halfedge_to_border_halfedge()
+  {
+    BOOST_FOREACH(Halfedge_index h, halfedges()){
+      if(is_border(h)){
+          set_halfedge(target(h),h);
+        }
+    }
+  }
+
+
+    /// returns whether `v` is isolated, i.e., incident to `Surface_mesh::null_halfedge()`.
+    bool is_isolated(Vertex_index v) const
+    {
+        return !halfedge(v).is_valid();
+    }
+
+    ///@}
+
+
+private: //--------------------------------------------------- property handling
+
+  // Property_selector maps an index type to a property_container, the
+  // dummy is necessary to make it a partial specialization (full
+  // specializations are only allowed at namespace scope).
+  template<typename, bool = true>
+  struct Property_selector {};
+
+  template<bool dummy>
+  struct Property_selector<typename CGAL::Surface_mesh<P>::Vertex_index, dummy> {
+    CGAL::Surface_mesh<P>* m_;
+    Property_selector(CGAL::Surface_mesh<P>* m) : m_(m) {}
+    Property_container<typename CGAL::Surface_mesh<P>::Vertex_index>&
+    operator()() { return m_->vprops_; }
+  };
+  template<bool dummy>
+  struct Property_selector<typename CGAL::Surface_mesh<P>::Halfedge_index, dummy> {
+    CGAL::Surface_mesh<P>* m_;
+    Property_selector(CGAL::Surface_mesh<P>* m) : m_(m) {}
+    Property_container<typename CGAL::Surface_mesh<P>::Halfedge_index>&
+    operator()() { return m_->hprops_; }
+  };
+  template<bool dummy>
+  struct Property_selector<typename CGAL::Surface_mesh<P>::Edge_index, dummy> {
+    CGAL::Surface_mesh<P>* m_;
+    Property_selector(CGAL::Surface_mesh<P>* m) : m_(m) {}
+    Property_container<typename CGAL::Surface_mesh<P>::Edge_index>&
+    operator()() { return m_->eprops_; }
+  };
+  template<bool dummy>
+  struct Property_selector<typename CGAL::Surface_mesh<P>::Face_index, dummy> {
+    CGAL::Surface_mesh<P>* m_;
+    Property_selector(CGAL::Surface_mesh<P>* m) : m_(m) {}
+    Property_container<typename CGAL::Surface_mesh<P>::Face_index>&
+    operator()() { return m_->fprops_; }
+  };
+
+    public:
+ 
+
+ /*! \name Property Handling
+
+ A `Property_map<I,T>` allows to associate properties of type `T` to a vertex, halfdge, edge, or face index type I.
+ Properties can be added, and looked up with a string, and they can be removed at runtime.
+ The \em point property of type `P` is associated to the string "v:point". 
+
+    */
+    ///@{
+
+  /// Model of `LvaluePropertyMap` with `I` as key type and `T` as value type, where `I`
+  /// is either a vertex, halfedge, edge, or face index type.
+#ifdef DOXYGEN_RUNNING
+  template <class I, class T>
+  using Property_map = unspecified_type;
+
+#else
+
+
+#endif
+
+    /// adds a property map named `name` with value type `T` and default `t`
+    /// for index type `I`. Returns the property map together with a Boolean 
+    /// that is `true` if a new map was created. In case it already exists
+    /// the existing map together with `false` is returned.
+
+  
+    template<class I, class T>
+    std::pair<Property_map<I, T>, bool>
+    add_property_map(const std::string& name, const T t=T()) {
+      return Property_selector<I>(this)().template add<T>(name, t);
+    }
+
+ 
+    /// returns a property map named `name` with key type `I` and value type `T`, 
+    /// and a Boolean that is `true` if the property exists. 
+    /// In case it does not exist the Boolean is `false` and the behavior of
+    /// the property map is undefined.
+    template <class I, class T>
+    std::pair<Property_map<I, T>,bool> property_map(const std::string& name) const
+    {
+      return Property_selector<I>(const_cast<Surface_mesh*>(this))().template get<T>(name);
+    }
+
+
+    /// removes property map `p`. The memory allocated for that property map is
+    /// freed.
+    template<class I, class T>
+    void remove_property_map(Property_map<I, T>& p)
+    {
+      (Property_selector<I>(this)()).remove(p);
+    }
+
+    /// @cond CGAL_DOCUMENT_INTERNALS
+    /// returns the std::type_info of the value type of the
+    /// property identified by `name`.  `typeid(void)` if `name`
+    /// does not identify any property.
+    ///
+    /// @tparam I The key type of the property. 
+
+    template<class I>
+    const std::type_info& property_type(const std::string& name)
+    {
+      return Property_selector<I>(this)().get_type(name);
+    }
+    /// @endcond
+
+    /// returns a vector with all strings that describe properties with the key type `I`.
+    /// @tparam I The key type of the properties.
+    template<class I>
+    std::vector<std::string> properties() const
+    {
+      return Property_selector<I>(const_cast<Self*>(this))().properties();
+    }
+
+    /// returns the property for the string "v:point".
+    Property_map<Vertex_index, Point>
+    points() const { return vpoint_; }
+
+    /// returns the point associated to vertex `v`.
+    const Point&
+    point(Vertex_index v) const { return vpoint_[v]; }
+
+    /// returns the point associated to vertex `v`.
+    Point&
+    point(Vertex_index v) { return vpoint_[v]; }
+
+    /// @cond CGAL_DOCUMENT_INTERNALS
+    /// prints property statistics to the stream `out`. The output is human-readable but
+    /// not machine-friendly.  
+    ///
+    void property_stats(std::ostream& out = std::cout) const;
+    /// @endcond
+    ///@}
+
+
+ /// \name Null Elements
+    ///@{
+
+  /// returns `Vertex_index(-1)`.
+  static Vertex_index null_vertex()
+  {
+    return vertex_index(-1);
+  }
+
+  /// returns `Edge_index(-1)`.
+  static Edge_index null_edge()
+  {
+    return edge_index(-1);
+  }
+  /// returns `Halfedge_index(-1)`.
+  static Halfedge_index null_halfedge()
+  {
+    return halfedge_index(-1);
+  }
+  /// returns `Face_index(-1)`.
+  static Face_index null_face()
+  {
+    return face_index(-1);
+  }
+  /// @}
+
+  
+private: //--------------------------------------------------- helper functions
+
+
+    /// make sure that the incoming halfedge of vertex v is a border halfedge
+    /// if `v` is a border vertex.
+    void adjust_incoming_halfedge(Vertex_index v);
+
+private: //------------------------------------------------------- private data
+    Property_container<Vertex_index> vprops_;
+    Property_container<Halfedge_index> hprops_;
+    Property_container<Edge_index> eprops_;
+    Property_container<Face_index> fprops_;
+
+    Property_map<Vertex_index, Vertex_connectivity>      vconn_;
+    Property_map<Halfedge_index, Halfedge_connectivity>  hconn_;
+    Property_map<Face_index, Face_connectivity>          fconn_;
+
+    Property_map<Vertex_index, bool>  vremoved_;
+    Property_map<Edge_index, bool>    eremoved_;
+    Property_map<Face_index, bool>    fremoved_;
+
+    Property_map<Vertex_index, Point>   vpoint_;
+
+    size_type removed_vertices_;
+    size_type removed_edges_;
+    size_type removed_faces_;
+
+    size_type vertices_freelist_;
+    size_type edges_freelist_;
+    size_type faces_freelist_;
+    bool garbage_;
+};
+
+  /*! \addtogroup PkgSurface_mesh
+   *
+   * @{
+   */
+
+  /// \relates Surface_mesh
+  /// Inserts `other` into `sm`. 
+  /// Shifts the indices of vertices of `other` by `sm.number_of_vertices() + sm.number_of_removed_vertices()`
+  /// and analoguously for halfedges, edges, and faces.
+  /// Copies entries of all property maps which have the same name in `sm` and `other`. 
+  /// that is, property maps which are only in `other` are ignored.
+  /// Also copies elements which are marked as removed, and concatenates the freelists of `sm` and `other`. 
+
+  template <typename P>
+  Surface_mesh<P>& operator+=(Surface_mesh<P>& sm, const Surface_mesh<P>& other)
+  {
+    sm.join(other);
+    return sm;
+  }
+
+  /// \relates Surface_mesh
+  /// Inserts the surface mesh in an output stream in Ascii OFF format. 
+  /// Only the \em point property is inserted in the stream.
+  /// \pre `operator<<(std::ostream&,const P&)` must be defined.
+  template <typename P>
+  std::ostream& operator<<(std::ostream& os, const Surface_mesh<P>& sm)
+  {
+    typedef Surface_mesh<P> Mesh;
+    typedef typename Mesh::Vertex_index Vertex_index;
+    typedef typename Mesh::Face_index Face_index;
+
+    os << "OFF\n" << sm.number_of_vertices() << " " << sm.number_of_faces() << " 0\n";
+    std::vector<int> reindex;
+    reindex.resize(sm.num_vertices());
+    int n = 0;
+    BOOST_FOREACH(Vertex_index v, sm.vertices()){
+      os << sm.point(v) << '\n';
+      reindex[v]=n++;
+    }
+
+    BOOST_FOREACH(Face_index f, sm.faces()){
+      os << sm.degree(f);
+      BOOST_FOREACH(Vertex_index v, CGAL::vertices_around_face(sm.halfedge(f),sm)){
+        os << " " << reindex[v];
+      }
+      os << '\n';
+    }
+    return os;
+  }
+
+/// @cond CGAL_DOCUMENT_INTERNALS
+
+  inline std::istream& sm_skip_comments( std::istream& in) {
+      char c;
+      in >> c;
+      while(c == '#')
+      {
+       in.ignore((std::numeric_limits<std::streamsize>::max)(), '\n');
+       in >> c;
+      }
+      in.putback(c);
+      return in;
+  }
+/// @endcond
+
+
+  /// \relates Surface_mesh
+
+  /// \relates Surface_mesh
+  /// Extracts the surface mesh from an input stream in Ascii OFF, COFF, NOFF, CNOFF format.
+  /// The operator reads the point property as well as "v:normal", "v:color", and "f:color".
+  /// Vertex texture coordinates are ignored.
+  /// \pre `operator>>(std::istream&,const P&)` must be defined.
+  template <typename P>
+  std::istream& operator>>(std::istream& is, Surface_mesh<P>& sm)
+  {
+   typedef Surface_mesh<P> Mesh;
+   typedef typename Kernel_traits<P>::Kernel K;
+   typedef typename K::Vector_3 Vector_3;
+   typedef typename Mesh::Face_index Face_index;
+   typedef typename Mesh::Vertex_index Vertex_index;
+   typedef typename Mesh::size_type size_type;
+    sm.clear();
+    int n, f, e;
+    std::string off;
+    is >> sm_skip_comments;
+    is >> off;
+    CGAL_assertion( (off == "OFF") || (off == "COFF") || (off == "NOFF") || (off == "CNOFF"));
+
+    is >> n >> f >> e;
+
+    sm.reserve(n,2*f,e);
+    P p;
+    Vector_3 v;
+    typename Mesh::template Property_map<Vertex_index,CGAL::Color> vcolor;
+    typename Mesh::template Property_map<Vertex_index,Vector_3> vnormal;
+    bool vcolored = false, v_has_normals = false;
+
+    if((off == "NOFF") || (off == "CNOFF")){
+      bool created;
+      boost::tie(vnormal, created) = sm.template add_property_map<Vertex_index,Vector_3>("v:normal",Vector_3(0,0,0));
+      v_has_normals = true;
+    }
+    char ci;
+
+    for(int i=0; i < n; i++){
+      is >> sm_skip_comments;
+      is >> p;
+      Vertex_index vi= sm.add_vertex(p);
+      if(v_has_normals){
+        is >> v;
+        vnormal[vi] = v;
+      }
+
+
+      if(i == 0 && ((off == "COFF") || (off == "CNOFF"))){
+        std::string col;
+        std::getline(is, col);
+        std::istringstream iss(col);
+        if(iss >> ci){
+         bool created;
+         boost::tie(vcolor, created) = sm.template add_property_map<Vertex_index,CGAL::Color>("v:color",CGAL::Color(0,0,0));
+         std::istringstream iss2(col);
+         vcolor[vi] = File_scanner_OFF::get_color_from_line(iss2);
+         vcolored = true;
+        }
+      }else{
+         if(vcolored){
+           //stores the RGB value
+           vcolor[vi] = File_scanner_OFF::get_color_from_line(is);
+         }
+       }
+    }
+    std::vector<size_type> vr;
+    std::size_t d;
+
+    bool fcolored = false;
+    typename Mesh::template Property_map<Face_index,CGAL::Color> fcolor;
+
+    for(int i=0; i < f; i++){
+      is >> sm_skip_comments;
+      is >> d;
+      vr.resize(d);
+      for(std::size_t j=0; j<d; j++){
+        is >> vr[j];
+      }
+      Face_index fi = sm.add_face(vr);
+      if(fi == sm.null_face())
+      {
+       std::cout<< "Warning: Facets don't seem to be oriented. Loading a Soup of polygons instead."<<std::endl;
+       sm.clear();
+       return is;
+      }
+
+      // the first face will tell us if faces have a color map
+      // TODO: extend this to RGBA
+      if(i == 0 ){
+        std::string col;
+        std::getline(is, col);
+        std::istringstream iss(col);
+        if(iss >> ci){
+          bool created;
+          boost::tie(fcolor, created) = sm.template add_property_map<Face_index,CGAL::Color>("f:color",CGAL::Color(0,0,0));
+          fcolored = true;
+          std::istringstream iss2(col);
+          fcolor[fi] = File_scanner_OFF::get_color_from_line(iss2);
+        }
+      } else {
+          if(fcolored){
+            fcolor[fi] = File_scanner_OFF::get_color_from_line(is);
+          }
+        }
+    }
+    return is;
+  }
+
+ 
+ /*! @} */
+
+template <typename P>
+Surface_mesh<P>::
+Surface_mesh()
+{
+    // allocate standard properties
+    // same list is used in operator=() and assign()
+    vconn_    = add_property_map<Vertex_index, Vertex_connectivity>("v:connectivity").first;
+    hconn_    = add_property_map<Halfedge_index, Halfedge_connectivity>("h:connectivity").first;
+    fconn_    = add_property_map<Face_index, Face_connectivity>("f:connectivity").first;
+    vpoint_   = add_property_map<Vertex_index, Point>("v:point").first;
+    vremoved_ = add_property_map<Vertex_index, bool>("v:removed", false).first;
+    eremoved_ = add_property_map<Edge_index, bool>("e:removed", false).first;
+    fremoved_ = add_property_map<Face_index, bool>("f:removed", false).first;
+
+    removed_vertices_ = removed_edges_ = removed_faces_ = 0;
+    vertices_freelist_ = edges_freelist_ = faces_freelist_ = -1;
+    garbage_ = false;
+}
+
+
+//-----------------------------------------------------------------------------
+template <typename P>
+Surface_mesh<P>&
+Surface_mesh<P>::
+operator=(const Surface_mesh<P>& rhs)
+{
+    if (this != &rhs)
+    {
+        // deep copy of property containers
+        vprops_ = rhs.vprops_;
+        hprops_ = rhs.hprops_;
+        eprops_ = rhs.eprops_;
+        fprops_ = rhs.fprops_;
+
+        // property handles contain pointers, have to be reassigned
+        vconn_    = property_map<Vertex_index, Vertex_connectivity>("v:connectivity").first;
+        hconn_    = property_map<Halfedge_index, Halfedge_connectivity>("h:connectivity").first;
+        fconn_    = property_map<Face_index, Face_connectivity>("f:connectivity").first;
+        vremoved_ = property_map<Vertex_index, bool>("v:removed").first;
+        eremoved_ = property_map<Edge_index, bool>("e:removed").first;
+        fremoved_ = property_map<Face_index, bool>("f:removed").first;
+        vpoint_   = property_map<Vertex_index, P>("v:point").first;
+
+        // how many elements are removed?
+        removed_vertices_  = rhs.removed_vertices_;
+        removed_edges_     = rhs.removed_edges_;
+        removed_faces_     = rhs.removed_faces_;
+        vertices_freelist_ = rhs.vertices_freelist_;
+        edges_freelist_    = rhs.edges_freelist_;
+        faces_freelist_    = rhs.faces_freelist_;
+        garbage_           = rhs.garbage_;
+    }
+
+    return *this;
+}
+
+
+//-----------------------------------------------------------------------------
+template <typename P>
+Surface_mesh<P>&
+Surface_mesh<P>::
+assign(const Surface_mesh<P>& rhs)
+{
+    if (this != &rhs)
+    {
+        // clear properties
+        vprops_.clear();
+        hprops_.clear();
+        eprops_.clear();
+        fprops_.clear();
+
+        // allocate standard properties
+        vconn_    = add_property_map<Vertex_index, Vertex_connectivity>("v:connectivity").first;
+        hconn_    = add_property_map<Halfedge_index, Halfedge_connectivity>("h:connectivity").first;
+        fconn_    = add_property_map<Face_index, Face_connectivity>("f:connectivity").first;
+        vpoint_   = add_property_map<Vertex_index, P>("v:point").first;
+        vremoved_ = add_property_map<Vertex_index, bool>("v:removed", false).first;
+        eremoved_ = add_property_map<Edge_index, bool>("e:removed", false).first;
+        fremoved_ = add_property_map<Face_index, bool>("f:removed", false).first;
+
+        // copy properties from other mesh
+        vconn_.array()     = rhs.vconn_.array();
+        hconn_.array()     = rhs.hconn_.array();
+        fconn_.array()     = rhs.fconn_.array();
+        vpoint_.array()    = rhs.vpoint_.array();
+        vremoved_.array()  = rhs.vremoved_.array();
+        eremoved_.array()  = rhs.eremoved_.array();
+        fremoved_.array()  = rhs.fremoved_.array();
+
+        // resize (needed by property containers)
+        vprops_.resize(rhs.num_vertices());
+        hprops_.resize(rhs.num_halfedges());
+        eprops_.resize(rhs.num_edges());
+        fprops_.resize(rhs.num_faces());
+
+        // how many elements are removed?
+        removed_vertices_  = rhs.removed_vertices_;
+        removed_edges_     = rhs.removed_edges_;
+        removed_faces_     = rhs.removed_faces_;
+        vertices_freelist_ = rhs.vertices_freelist_;
+        edges_freelist_    = rhs.edges_freelist_;
+        faces_freelist_    = rhs.faces_freelist_;
+        garbage_           = rhs.garbage_;
+    }
+
+    return *this;
+}
+
+//-----------------------------------------------------------------------------
+template <typename P>
+void
+Surface_mesh<P>::
+clear()
+{
+    vprops_.resize(0);
+    hprops_.resize(0);
+    eprops_.resize(0);
+    fprops_.resize(0);
+
+    vprops_.shrink_to_fit();
+    hprops_.shrink_to_fit();
+    eprops_.shrink_to_fit();
+    fprops_.shrink_to_fit();
+
+    removed_vertices_ = removed_edges_ = removed_faces_ = 0;
+    vertices_freelist_ = edges_freelist_ = faces_freelist_ = -1;
+    garbage_ = false;
+}
+
+//-----------------------------------------------------------------------------
+/// @cond CGAL_DOCUMENT_INTERNALS
+template <typename P>
+void
+Surface_mesh<P>::
+property_stats(std::ostream& out) const
+{
+    std::vector<std::string> props;
+
+    out << "vertex properties:\n";
+    props = properties<Vertex_index>();
+    for (unsigned int i=0; i<props.size(); ++i)
+        out << "\t" << props[i] << std::endl;
+
+    out << "halfedge properties:\n";
+    props = properties<Halfedge_index>();
+    for (unsigned int i=0; i<props.size(); ++i)
+        out << "\t" << props[i] << std::endl;
+
+    out << "edge properties:\n";
+    props = properties<Edge_index>();
+    for (unsigned int i=0; i<props.size(); ++i)
+        out << "\t" << props[i] << std::endl;
+
+    out << "face properties:\n";
+    props = properties<Face_index>();
+    for (unsigned int i=0; i<props.size(); ++i)
+        out << "\t" << props[i] << std::endl;
+}
+/// @endcond
+
+//-----------------------------------------------------------------------------
+template <typename P>
+typename Surface_mesh<P>::Halfedge_index
+Surface_mesh<P>::
+halfedge(Vertex_index source, Vertex_index target) const
+{
+    CGAL_assertion(has_valid_index(source) && has_valid_index(target));
+
+    Halfedge_index h  = halfedge(target);
+    const Halfedge_index hh = h;
+
+    if (h.is_valid())
+    {
+        do
+        {
+            if (this->source(h) == source)
+              return h;
+            h = next_around_target(h);
+        }
+        while (h != hh);
+    }
+
+    return Halfedge_index();
+}
+
+
+//-----------------------------------------------------------------------------
+template <typename P>
+void
+Surface_mesh<P>::
+adjust_incoming_halfedge(Vertex_index v)
+{
+    Halfedge_index h  = halfedge(v);
+    Halfedge_index hh = h;
+
+    if (h.is_valid())
+    {
+        if (target(h) != v)
+        {
+            // wrong target, flip
+            h = opposite(h);
+            hh = h;
+            set_halfedge(v, h);
+        }
+
+        do
+        {
+            if (is_border(h))
+            {
+                set_halfedge(v, h);
+                return;
+            }
+            h = next_around_target(h);
+        }
+        while (h != hh);
+    }
+}
+
+//-----------------------------------------------------------------------------
+
+ /// @cond CGAL_DOCUMENT_INTERNALS
+
+template <typename P>
+template <typename Range>
+typename Surface_mesh<P>::Face_index
+Surface_mesh<P>::add_face(const Range& r)
+{
+  return CGAL::Euler::add_face(r, *this);
+}
+
+  /// @endcond
+
+//-----------------------------------------------------------------------------
+template <typename P>
+typename Surface_mesh<P>::size_type
+Surface_mesh<P>::
+degree(Vertex_index v) const
+{
+    size_type count(0);
+    if(halfedge(v) == null_halfedge()){
+      return 0;
+    }
+    Vertex_around_target_circulator vvit(halfedge(v), *this);
+    Vertex_around_target_circulator vvend = vvit;
+    if(vvit) do
+    {
+        ++count;
+    } while (++vvit != vvend);
+
+    return count;
+}
+
+
+//-----------------------------------------------------------------------------
+template <typename P>
+typename Surface_mesh<P>::size_type
+Surface_mesh<P>::
+degree(Face_index f) const
+{
+    size_type count(0);
+    if(halfedge(f) == null_halfedge()){
+      return 0;
+    }
+    Vertex_around_face_circulator fvit(halfedge(f),*this);
+    Vertex_around_face_circulator fvend = fvit;
+    if(fvit) do {
+        ++count;
+    } while (++fvit != fvend);
+
+    return count;
+}
+
+template <typename P>
+void
+Surface_mesh<P>::
+collect_garbage()
+{
+    int  i, i0, i1,
+    nV(num_vertices()),
+    nE(num_edges()),
+    nH(num_halfedges()),
+    nF(num_faces());
+
+    Vertex_index    v;
+    Halfedge_index  h;
+    Face_index      f;
+
+
+    // setup index mapping%
+    Property_map<Vertex_index, Vertex_index>      vmap = add_property_map<Vertex_index, Vertex_index>("v:garbage-collection").first;
+    Property_map<Halfedge_index, Halfedge_index>  hmap = add_property_map<Halfedge_index, Halfedge_index>("h:garbage-collection").first;
+    Property_map<Face_index, Face_index>          fmap = add_property_map<Face_index, Face_index>("f:garbage-collection").first;
+    for (i=0; i<nV; ++i)
+        vmap[Vertex_index(i)] = Vertex_index(i);
+    for (i=0; i<nH; ++i)
+        hmap[Halfedge_index(i)] = Halfedge_index(i);
+    for (i=0; i<nF; ++i)
+        fmap[Face_index(i)] = Face_index(i);
+
+
+
+    // really remove vertices
+    if (nV > 0)
+    {
+        i0=0;  i1=nV-1;
+
+        while (1)
+        {
+            // find first removed and last un-removed
+            while (!vremoved_[Vertex_index(i0)] && i0 < i1)  ++i0;
+            while ( vremoved_[Vertex_index(i1)] && i0 < i1)  --i1;
+            if (i0 >= i1) break;
+
+            // swap
+            vprops_.swap(i0, i1);
+        };
+
+        // remember new size
+        nV = vremoved_[Vertex_index(i0)] ? i0 : i0+1;
+    }
+
+    // really remove edges
+    if (nE > 0)
+    {
+        i0=0;  i1=nE-1;
+
+        while (1)
+        {
+            // find first removed and last un-removed
+            while (!eremoved_[Edge_index(i0)] && i0 < i1) ++i0;
+            while ( eremoved_[Edge_index(i1)] && i0 < i1) --i1;
+            if (i0 >= i1) break;
+
+            // swap
+            eprops_.swap(i0, i1);
+            hprops_.swap(2*i0,   2*i1);
+            hprops_.swap(2*i0+1, 2*i1+1);
+        };
+
+        // remember new size
+        nE = eremoved_[Edge_index(i0)] ? i0 : i0+1;
+        nH = 2*nE;
+    }
+
+
+    // really remove faces
+    if (nF > 0)
+    {
+        i0=0;  i1=nF-1;
+
+        while (1)
+        {
+            // find 1st removed and last un-removed
+            while (!fremoved_[Face_index(i0)] && i0 < i1)  ++i0;
+            while ( fremoved_[Face_index(i1)] && i0 < i1)  --i1;
+            if (i0 >= i1) break;
+
+            // swap
+            fprops_.swap(i0, i1);
+        };
+
+        // remember new size
+        nF = fremoved_[Face_index(i0)] ? i0 : i0+1;
+    }
+
+
+    // update vertex connectivity
+    for (i=0; i<nV; ++i)
+    {
+        v = Vertex_index(i);
+        if (!is_isolated(v))
+            set_halfedge(v, hmap[halfedge(v)]);
+    }
+
+
+    // update halfedge connectivity
+    for (i=0; i<nH; ++i)
+    {
+        h = Halfedge_index(i);
+        set_target(h, vmap[target(h)]);
+        set_next(h, hmap[next(h)]);
+        if (!is_border(h))
+            set_face(h, fmap[face(h)]);
+    }
+
+
+    // update indices of faces
+    for (i=0; i<nF; ++i)
+    {
+        f = Face_index(i);
+        set_halfedge(f, hmap[halfedge(f)]);
+    }
+
+    // remove index maps
+    remove_property_map<Vertex_index>(vmap);
+    remove_property_map<Halfedge_index>(hmap);
+    remove_property_map<Face_index>(fmap);
+
+    // finally resize arrays
+    vprops_.resize(nV); vprops_.shrink_to_fit();
+    hprops_.resize(nH); hprops_.shrink_to_fit();
+    eprops_.resize(nE); eprops_.shrink_to_fit();
+    fprops_.resize(nF); fprops_.shrink_to_fit();
+
+    removed_vertices_ = removed_edges_ = removed_faces_ = 0;
+    vertices_freelist_ = edges_freelist_ = faces_freelist_ = -1;
+    garbage_ = false;
+}
+
+
+
+} // CGAL
+
+
+namespace std {
+
+#if defined(BOOST_MSVC)
+#  pragma warning(push)
+#  pragma warning(disable:4099) // For VC10 it is class hash 
+#endif
+
+#ifndef CGAL_CFG_NO_STD_HASH
+
+  template <>
+  struct hash<CGAL::SM_Halfedge_index >
+    : public std::unary_function<CGAL::SM_Halfedge_index, std::size_t> {
+
+    std::size_t operator()(const CGAL::SM_Halfedge_index& i) const
+    {
+      return i;
+    }
+  };
+
+  template <>
+  struct hash<CGAL::SM_Vertex_index >
+    : public std::unary_function<CGAL::SM_Vertex_index, std::size_t>  {
+
+    std::size_t operator()(const CGAL::SM_Vertex_index& i) const
+    {
+      return i;
+    }
+  };
+
+  template <>
+  struct hash<CGAL::SM_Face_index > 
+    : public std::unary_function<CGAL::SM_Face_index, std::size_t> {
+
+    std::size_t operator()(const CGAL::SM_Face_index& i) const
+    {
+      return i;
+    }
+  };
+
+  template <>
+  struct hash<CGAL::SM_Edge_index >
+    : public std::unary_function<CGAL::SM_Edge_index, std::size_t>  {
+
+    std::size_t operator()(const CGAL::SM_Edge_index& i) const
+    {
+      return i;
+    }
+  };
+#endif // CGAL_CFG_NO_STD_HASH
+
+#if defined(BOOST_MSVC)
+#  pragma warning(pop)
+#endif
+
+} // namespace std
+
+namespace boost {
+  template <>
+  struct hash<CGAL::SM_Vertex_index > {
+    std::size_t operator()(const CGAL::SM_Vertex_index& i) const
+    {
+      return i;
+    }
+  };
+
+} // namespace boost
+
+#endif /* CGAL_SURFACE_MESH_H */
+
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh/Surface_mesh_fwd.h b/3rdparty/CGAL/include/CGAL/Surface_mesh/Surface_mesh_fwd.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesh/Surface_mesh_fwd.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesh/Surface_mesh_fwd.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_cell_base_3.h b/3rdparty/CGAL/include/CGAL/Surface_mesh_cell_base_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_cell_base_3.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesh_cell_base_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_complex_2_in_triangulation_3.h b/3rdparty/CGAL/include/CGAL/Surface_mesh_complex_2_in_triangulation_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_complex_2_in_triangulation_3.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesh_complex_2_in_triangulation_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_default_criteria_3.h b/3rdparty/CGAL/include/CGAL/Surface_mesh_default_criteria_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_default_criteria_3.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesh_default_criteria_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_default_edges_criteria_3.h b/3rdparty/CGAL/include/CGAL/Surface_mesh_default_edges_criteria_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_default_edges_criteria_3.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesh_default_edges_criteria_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_default_triangulation_3.h b/3rdparty/CGAL/include/CGAL/Surface_mesh_default_triangulation_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_default_triangulation_3.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesh_default_triangulation_3.h
diff --git a/3rdparty/CGAL/include/CGAL/Surface_mesh_deformation.h b/3rdparty/CGAL/include/CGAL/Surface_mesh_deformation.h
new file mode 100644
index 0000000..417efea
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Surface_mesh_deformation.h
@@ -0,0 +1,1614 @@
+// Copyright (c) 2014 GeometryFactory
+// 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
+// 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(s)     : Yin Xu, Andreas Fabri and Ilker O. Yaz
+
+#ifndef CGAL_SURFACE_MESH_DEFORMATION_H
+#define CGAL_SURFACE_MESH_DEFORMATION_H
+
+#include <CGAL/config.h>
+#include <CGAL/Default.h>
+#include <CGAL/tuple.h>
+
+#include <CGAL/Polygon_mesh_processing/Weights.h>
+#include <CGAL/Simple_cartesian.h>
+
+#include <vector>
+#include <list>
+#include <utility>
+#include <limits>
+#include <boost/foreach.hpp>
+
+/*
+#define CGAL_DEFORM_MESH_USE_EXPERIMENTAL_SCALE // define it to activate optimal scale calculation,
+// then you can define below to just scale, if not both rotate and scale will be activated
+#define CGAL_DEFORM_MESH_JUST_EXPERIMENTAL_SCALE // to not to rotate but just scale
+*/
+
+// for default parameters
+#if defined(CGAL_EIGEN3_ENABLED)
+#include <CGAL/Eigen_solver_traits.h>  // for sparse linear system solver
+#include <CGAL/Deformation_Eigen_polar_closest_rotation_traits_3.h>  // for 3x3 closest rotation computer
+#endif
+
+namespace CGAL {
+
+/// \ingroup PkgSurfaceMeshDeformation
+///@brief Deformation algorithm type
+enum Deformation_algorithm_tag
+{
+  ORIGINAL_ARAP,   /**< use original as-rigid-as possible algorithm */
+  SPOKES_AND_RIMS, /**< use spokes and rims version of as-rigid-as possible algorithm */
+  SRE_ARAP         /**< use smooth rotation enhanced As-rigid-as-possible */
+};
+
+/// @cond CGAL_DOCUMENT_INTERNAL
+namespace internal {
+template<class TriangleMesh, Deformation_algorithm_tag deformation_algorithm_tag>
+struct Types_selectors;
+
+template<class TriangleMesh>
+struct Types_selectors<TriangleMesh, CGAL::SPOKES_AND_RIMS> {
+  typedef internal::Single_cotangent_weight_impl<TriangleMesh> Weight_calculator;
+
+  struct ARAP_visitor{
+    template <class VertexPointMap>
+    void init(TriangleMesh, VertexPointMap){}
+
+    void rotation_matrix_pre(
+      typename boost::graph_traits<TriangleMesh>::vertex_descriptor,
+      TriangleMesh&){}
+
+    template <class Square_matrix_3>
+    void update_covariance_matrix(
+      Square_matrix_3&,
+      const Square_matrix_3&){}
+
+    void set_sre_arap_alpha(double){}
+  };
+};
+
+template<class TriangleMesh>
+struct Types_selectors<TriangleMesh, CGAL::ORIGINAL_ARAP> {
+  typedef internal::Cotangent_weight_impl<TriangleMesh> Weight_calculator;
+
+  typedef typename Types_selectors<TriangleMesh, CGAL::SPOKES_AND_RIMS>
+    ::ARAP_visitor ARAP_visitor;
+};
+
+template<class TriangleMesh>
+struct Types_selectors<TriangleMesh, CGAL::SRE_ARAP> {
+  typedef internal::Cotangent_weight_impl<TriangleMesh> Weight_calculator;
+
+  class ARAP_visitor{
+    double m_nb_edges_incident;
+    double m_area;
+    double m_alpha;
+
+  public:
+    ARAP_visitor(): m_alpha(0.02) {}
+
+    template<class VertexPointMap>
+    void init(TriangleMesh triangle_mesh, const VertexPointMap& vpmap)
+    {
+      // calculate area
+      m_area = 0;
+      typedef typename boost::graph_traits<TriangleMesh>::face_descriptor face_descriptor;
+      BOOST_FOREACH(face_descriptor f, faces(triangle_mesh))
+      {
+        typename boost::graph_traits<TriangleMesh>::halfedge_descriptor
+          h = halfedge(f, triangle_mesh);
+        m_area += std::sqrt(CGAL::squared_area(
+                        get(vpmap, source(h, triangle_mesh) ),
+                        get(vpmap, target(h, triangle_mesh) ),
+                        get(vpmap, target(next(h, triangle_mesh), triangle_mesh) ) ));
+      }
+    }
+
+    void rotation_matrix_pre(
+      typename boost::graph_traits<TriangleMesh>::vertex_descriptor vi,
+      TriangleMesh& hg)
+    {
+      typename boost::graph_traits<TriangleMesh>::in_edge_iterator e, e_end;
+      cpp11::tie(e,e_end) = in_edges(vi, hg);
+      m_nb_edges_incident=(double) std::distance(e,e_end);
+    }
+
+    template <class Square_matrix_3>
+    void update_covariance_matrix(
+      Square_matrix_3& cov,
+      const Square_matrix_3& rot_mtr)
+    {
+      // add neighbor rotation
+      cov += m_alpha * m_area * rot_mtr.transpose() / m_nb_edges_incident;
+    }
+
+    void set_sre_arap_alpha(double a){ m_alpha=a; }
+  };
+};
+
+// property map that create a Simple_cartesian<double>::Point_3
+// on the fly in order the deformation class to be used
+// with points with minimal requirements
+template <class Vertex_point_map>
+struct SC_on_the_fly_pmap: public Vertex_point_map{
+  typedef boost::readable_property_map_tag category;
+  typedef CGAL::Simple_cartesian<double>::Point_3 value_type;
+  typedef value_type reference;
+  typedef typename boost::property_traits<Vertex_point_map>::key_type key_type;
+
+  SC_on_the_fly_pmap(Vertex_point_map base):
+    Vertex_point_map(base) {}
+
+  friend value_type
+  get(const SC_on_the_fly_pmap map, key_type k)
+  {
+    typename boost::property_traits<Vertex_point_map>::reference base=
+      get(static_cast<const Vertex_point_map&>(map), k);
+    return value_type(base[0], base[1], base[2]);
+  }
+};
+
+
+}//namespace internal
+/// @endcond
+
+ ///
+ /// \ingroup PkgSurfaceMeshDeformation
+ /// @brief Class providing the functionalities for deforming a triangulated surface mesh
+ ///
+ /// @tparam TM a model of `HalfedgeGraph`
+ /// @tparam VIM a model of `ReadablePropertyMap` with `Surface_mesh_deformation::vertex_descriptor` as key and `unsigned int` as value type.
+ ///         The default is `boost::property_map<TM, boost::%vertex_index_t>::%type`.
+ /// @tparam HIM a model of `ReadablePropertyMap` with `Surface_mesh_deformation::halfedge_descriptor` as key and `unsigned int` as value type.
+ ///         The default is `boost::property_map<TM, boost::%halfedge_index_t>::%type`.
+ /// @tparam TAG tag for selecting the deformation algorithm
+ /// @tparam WC a model of SurfaceMeshDeformationWeights, with `WC::Triangle_mesh` being `TM`.
+ ///         If `TAG` is `ORIGINAL_ARAP`, the weights must be positive to guarantee a correct energy minimization.
+ ///         The default is the cotangent weighting scheme. In case `TAG` is `ORIGINAL_ARAP`, negative weights are clamped to zero.
+ /// @tparam ST a model of SparseLinearAlgebraWithFactorTraits_d. If \ref thirdpartyEigen "Eigen" 3.2 (or greater) is available
+ /// and `CGAL_EIGEN3_ENABLED` is defined, then an overload of `Eigen_solver_traits` is provided as default parameter.\n
+  /// \code
+ ///     CGAL::Eigen_solver_traits<
+ ///         Eigen::SparseLU<
+ ///            CGAL::Eigen_sparse_matrix<double>::EigenType,
+ ///            Eigen::COLAMDOrdering<int> >  >
+ /// \endcode
+ /// @tparam CR a model of DeformationClosestRotationTraits_3. If \ref thirdpartyEigen "Eigen" 3.1 (or greater) is available and `CGAL_EIGEN3_ENABLED` is defined,
+ /// `Deformation_Eigen_polar_closest_rotation_traits_3` is provided as default parameter.
+ /// @tparam VPM a model of `ReadWritePropertyMap`</a>  with `Surface_mesh_deformation::vertex_descriptor` as key and a point as value type. The point type must be a model of `::RawPoint_3`.
+ /// The default is `boost::property_map<TM, CGAL::vertex_point_t>::%type`.
+template <
+  class TM,
+  class VIM=Default,
+  class HIM=Default,
+  Deformation_algorithm_tag TAG = SPOKES_AND_RIMS,
+  class WC = Default,
+  class ST = Default,
+  class CR = Default,
+  class VPM = Default
+  >
+class Surface_mesh_deformation
+{
+//Typedefs
+public:
+
+  /// \name Types
+  /// @{
+  // typedefed template parameters, main reason is doxygen creates autolink to typedefs but not template parameters
+  ///
+  typedef TM Triangle_mesh;
+  typedef TM Halfedge_graph;
+
+// Index maps
+#ifndef DOXYGEN_RUNNING
+  typedef typename Default::Get<
+    VIM,
+    typename boost::property_map<Triangle_mesh, boost::vertex_index_t>::type
+  >::type Vertex_index_map;
+  typedef typename Default::Get<
+    HIM,
+    typename boost::property_map<Triangle_mesh, boost::halfedge_index_t>::type
+  >::type Hedge_index_map;
+#else
+  ///
+  typedef VIM Vertex_index_map;
+  ///
+  typedef HIM Hedge_index_map;
+#endif
+
+// weight calculator
+#ifndef DOXYGEN_RUNNING
+  typedef typename Default::Get<
+    WC,
+    typename internal::Types_selectors<TM, TAG>::Weight_calculator
+  >::type Weight_calculator;
+#else
+  ///
+  typedef WC Weight_calculator;
+#endif
+
+// sparse linear solver
+#ifndef DOXYGEN_RUNNING
+  typedef typename Default::Get<
+    ST,
+  #if defined(CGAL_EIGEN3_ENABLED)
+      CGAL::Eigen_solver_traits<
+          Eigen::SparseLU<
+            CGAL::Eigen_sparse_matrix<double>::EigenType,
+            Eigen::COLAMDOrdering<int> >  >
+  #else
+    ST // no parameter provided, and Eigen is not enabled: so don't compile!
+  #endif
+  >::type Sparse_linear_solver;
+#else
+  ///
+  typedef ST Sparse_linear_solver;
+#endif
+
+// CR helper
+#ifndef DOXYGEN_RUNNING
+  typedef typename Default::Get<
+    CR,
+  #if defined(CGAL_EIGEN3_ENABLED)
+    Deformation_Eigen_polar_closest_rotation_traits_3
+  #else
+    CR // no parameter provided, and Eigen is not enabled: so don't compile!
+  #endif
+  >::type Closest_rotation_traits;
+#else
+  ///
+  typedef CR Closest_rotation_traits;
+#endif
+
+// vertex point pmap
+#ifndef DOXYGEN_RUNNING
+  typedef typename Default::Get<
+    VPM,
+    typename boost::property_map<Triangle_mesh, CGAL::vertex_point_t>::type
+  >::type Vertex_point_map;
+#else
+  ///
+  typedef VPM Vertex_point_map;
+#endif
+
+  /// The type for vertex descriptor
+  typedef typename boost::graph_traits<Triangle_mesh>::vertex_descriptor vertex_descriptor;
+  /// The type for halfedge descriptor
+  typedef typename boost::graph_traits<Triangle_mesh>::halfedge_descriptor halfedge_descriptor;
+  /// The 3D point type, model of `::RawPoint_3`
+  typedef typename boost::property_traits<Vertex_point_map>::value_type Point;
+  /// A constant iterator range over the vertices of the region-of-interest.
+  /// It is a model of `ConstRange` with `vertex_descriptor` as iterator value type.
+  typedef std::vector<vertex_descriptor> Roi_vertex_range;
+/// @}
+
+private:
+  typedef Surface_mesh_deformation<TM, VIM, HIM, TAG, WC, ST, CR> Self;
+  // Repeat Triangle_mesh types
+  typedef typename boost::graph_traits<Triangle_mesh>::vertex_iterator     vertex_iterator;
+  typedef typename boost::graph_traits<Triangle_mesh>::halfedge_iterator       halfedge_iterator;
+  typedef typename boost::graph_traits<Triangle_mesh>::in_edge_iterator    in_edge_iterator;
+  typedef typename boost::graph_traits<Triangle_mesh>::out_edge_iterator   out_edge_iterator;
+
+  typedef typename Closest_rotation_traits::Matrix CR_matrix;
+  typedef typename Closest_rotation_traits::Vector CR_vector;
+
+// Data members.
+  Triangle_mesh& m_triangle_mesh;                   /**< Source triangulated surface mesh for modeling */
+
+  std::vector<Point> original;                        ///< original positions of roi (size: ros + boundary_of_ros)
+  std::vector<Point> solution;                        ///< storing position of ros vertices during iterations (size: ros + boundary_of_ros)
+
+  Vertex_index_map vertex_index_map;                  ///< storing indices of all vertices
+  Hedge_index_map   hedge_index_map;                  ///< storing indices of all halfedges
+
+  std::vector<vertex_descriptor> roi;                 ///< region of interest
+  std::vector<vertex_descriptor> ros;                 ///< region of solution, including roi and hard constraints on boundary of roi
+
+  std::vector<std::size_t> ros_id_map;                ///< (size: num vertices)
+  std::vector<bool>        is_roi_map;                ///< (size: num vertices)
+  std::vector<bool>        is_ctrl_map;               ///< (size: num vertices)
+
+  std::vector<double> hedge_weight;                   ///< all halfedge weights
+  std::vector<CR_matrix> rot_mtr;                     ///< rotation matrices of ros vertices (size: ros)
+
+  Sparse_linear_solver m_solver;                      ///< linear sparse solver
+  unsigned int m_iterations;                          ///< number of maximal iterations
+  double m_tolerance;                                 ///< tolerance of convergence
+
+  bool need_preprocess_factorization;                 ///< is there any need to compute L and factorize
+  bool need_preprocess_region_of_solution;            ///< is there any need to compute region of solution
+
+  bool last_preprocess_successful;                    ///< stores the result of last call to preprocess()
+
+  Weight_calculator weight_calculator;
+
+  Vertex_point_map vertex_point_map;
+
+public:
+  typename internal::Types_selectors<TM, TAG>::ARAP_visitor arap_visitor;
+private:
+
+#ifdef CGAL_DEFORM_MESH_USE_EXPERIMENTAL_SCALE
+  std::vector<double> scales;
+#endif
+
+#ifndef CGAL_CFG_NO_CPP0X_DELETED_AND_DEFAULT_FUNCTIONS
+public:
+  Surface_mesh_deformation(const Self&) = delete; // no copy
+#else
+private:
+  Surface_mesh_deformation(const Self&); // no copy
+#endif
+
+
+// Public methods
+public:
+
+  /// \cond SKIP_FROM_MANUAL
+  //vertex_point_map set by default
+  Surface_mesh_deformation(Triangle_mesh& triangle_mesh,
+                           Vertex_index_map vertex_index_map,
+                           Hedge_index_map hedge_index_map
+                          )
+    : m_triangle_mesh(triangle_mesh), vertex_index_map(vertex_index_map), hedge_index_map(hedge_index_map),
+      ros_id_map(std::vector<std::size_t>(num_vertices(triangle_mesh), (std::numeric_limits<std::size_t>::max)() )),
+      is_roi_map(std::vector<bool>(num_vertices(triangle_mesh), false)),
+      is_ctrl_map(std::vector<bool>(num_vertices(triangle_mesh), false)),
+      m_iterations(5), m_tolerance(1e-4),
+      need_preprocess_factorization(true),
+      need_preprocess_region_of_solution(true),
+      last_preprocess_successful(false),
+      weight_calculator(Weight_calculator()),
+      vertex_point_map(get(vertex_point, triangle_mesh))
+  {
+    init();
+  }
+
+  //vertex_point_map and hedge_index_map set by default
+  Surface_mesh_deformation(Triangle_mesh& triangle_mesh,
+                           Vertex_index_map vertex_index_map
+                          )
+    : m_triangle_mesh(triangle_mesh), vertex_index_map(vertex_index_map),
+      hedge_index_map(get(boost::halfedge_index, triangle_mesh)),
+      ros_id_map(std::vector<std::size_t>(num_vertices(triangle_mesh), (std::numeric_limits<std::size_t>::max)() )),
+      is_roi_map(std::vector<bool>(num_vertices(triangle_mesh), false)),
+      is_ctrl_map(std::vector<bool>(num_vertices(triangle_mesh), false)),
+      m_iterations(5), m_tolerance(1e-4),
+      need_preprocess_factorization(true),
+      need_preprocess_region_of_solution(true),
+      last_preprocess_successful(false),
+      weight_calculator(Weight_calculator()),
+      vertex_point_map(get(vertex_point, triangle_mesh))
+  {
+    init();
+  }
+  //vertex_point_map, hedge_index_map and vertex_index_map set by default
+  Surface_mesh_deformation(Triangle_mesh& triangle_mesh)
+    : m_triangle_mesh(triangle_mesh),
+      vertex_index_map(get(boost::vertex_index, triangle_mesh)),
+      hedge_index_map(get(boost::halfedge_index, triangle_mesh)),
+      ros_id_map(std::vector<std::size_t>(num_vertices(triangle_mesh), (std::numeric_limits<std::size_t>::max)() )),
+      is_roi_map(std::vector<bool>(num_vertices(triangle_mesh), false)),
+      is_ctrl_map(std::vector<bool>(num_vertices(triangle_mesh), false)),
+      m_iterations(5), m_tolerance(1e-4),
+      need_preprocess_factorization(true),
+      need_preprocess_region_of_solution(true),
+      last_preprocess_successful(false),
+      weight_calculator(Weight_calculator()),
+      vertex_point_map(get(vertex_point, triangle_mesh))
+  {
+    init();
+  }
+
+  // Constructor with all the parameters provided
+  Surface_mesh_deformation(Triangle_mesh& triangle_mesh,
+                           Vertex_index_map vertex_index_map,
+                           Hedge_index_map hedge_index_map,
+                           Vertex_point_map vertex_point_map,
+                           Weight_calculator weight_calculator = Weight_calculator()
+                          )
+    : m_triangle_mesh(triangle_mesh), vertex_index_map(vertex_index_map), hedge_index_map(hedge_index_map),
+    ros_id_map(std::vector<std::size_t>(num_vertices(triangle_mesh), (std::numeric_limits<std::size_t>::max)() )),
+    is_roi_map(std::vector<bool>(num_vertices(triangle_mesh), false)),
+    is_ctrl_map(std::vector<bool>(num_vertices(triangle_mesh), false)),
+    m_iterations(5), m_tolerance(1e-4),
+    need_preprocess_factorization(true),
+    need_preprocess_region_of_solution(true),
+    last_preprocess_successful(false),
+    weight_calculator(weight_calculator),
+    vertex_point_map(vertex_point_map)
+  {
+    init();
+  }
+  /// \endcond
+  #if DOXYGEN_RUNNING
+/// \name Construction
+/// @{
+    /**
+   * The constructor of a deformation object
+   *
+   * @pre `triangle_mesh` consists of only triangular facets
+   * @param triangle_mesh triangulated surface mesh to deform
+   * @param vertex_index_map property map which associates an id to each vertex, from `0` to `num_vertices(triangle_mesh)-1`.
+   * @param hedge_index_map property map which associates an id to each halfedge, from `0` to `2*num_edges(triangle_mesh)-1`.
+   * @param vertex_point_map property map which associates a point to each vertex of the triangle mesh.
+   * @param weight_calculator function object or pointer for weight calculation
+   */
+  Surface_mesh_deformation(Triangle_mesh& triangle_mesh,
+    Vertex_index_map vertex_index_map=get(boost::vertex_index, triangle_mesh),
+    Hedge_index_map hedge_index_map=get(boost::halfedge_index, triangle_mesh),
+    Vertex_point_map vertex_point_map=get(boost::vertex_point, triangle_mesh),
+    Weight_calculator weight_calculator = Weight_calculator()
+    );
+/// @}
+  #endif
+
+private:
+  void init() {
+    typedef internal::SC_on_the_fly_pmap<Vertex_point_map> Wrapper;
+    // compute halfedge weights
+    halfedge_iterator eb, ee;
+    hedge_weight.reserve(2*num_edges(m_triangle_mesh));
+    for(cpp11::tie(eb, ee) = halfedges(m_triangle_mesh); eb != ee; ++eb)
+    {
+      hedge_weight.push_back(
+        this->weight_calculator(*eb, m_triangle_mesh, Wrapper(vertex_point_map)));
+    }
+    arap_visitor.init(m_triangle_mesh, vertex_point_map);
+  }
+
+public:
+
+/// \name Preprocessing
+/// @{
+  /**
+   * Erases all the vertices from the region-of-interest (control vertices included).
+   */
+  void clear_roi_vertices(){
+    need_preprocess_both();
+    // clear roi vertices
+    roi.clear();
+    //set to false all bits
+    is_roi_map.assign(num_vertices(m_triangle_mesh), false);
+    is_ctrl_map.assign(num_vertices(m_triangle_mesh), false);
+  }
+
+  /**
+   * Erases all the vertices from the set of control vertices.
+   */
+  void clear_control_vertices(){
+    need_preprocess_factorization=true;
+    //set to false all bits
+    is_ctrl_map.assign(num_vertices(m_triangle_mesh), false);
+  }
+
+  /**
+   * Inserts a vertex in the set of control vertices. The vertex is also inserted in the region-of-interest if it is not already in it.
+   * @param vd the vertex to be inserted
+   * @return `true` if `vd` is not already a control vertex.
+   */
+  bool insert_control_vertex(vertex_descriptor vd)
+  {
+    if(is_control_vertex(vd)) { return false; }
+    need_preprocess_factorization=true;
+
+    insert_roi_vertex(vd); // also insert it as roi
+
+    is_ctrl_map[id(vd)] = true;
+    return true;
+  }
+
+  /**
+   * Inserts a range of vertices in the set of control vertices. The vertices are also inserted in the region-of-interest if they are not already in it.
+   * @tparam InputIterator input iterator type with `vertex_descriptor` as value type
+   * @param begin first iterator of the range of vertices
+   * @param end past-the-end iterator of the range of vertices
+   */
+  template<class InputIterator>
+  void insert_control_vertices(InputIterator begin, InputIterator end)
+  {
+    for( ;begin != end; ++begin)
+    {
+      insert_control_vertex(*begin);
+    }
+  }
+
+  /**
+   * Erases a vertex from the set of control vertices.
+   * @param vd the vertex to be erased
+   * @return `true` if `vd` was a control vertex.
+   */
+  bool erase_control_vertex(vertex_descriptor vd)
+  {
+    if(!is_control_vertex(vd)) { return false; }
+
+    need_preprocess_factorization=true;
+    is_ctrl_map[id(vd)] = false;
+    return true;
+  }
+
+  /**
+   * Inserts a range of vertices in the region-of-interest
+   * @tparam InputIterator input iterator with `vertex_descriptor` as value type
+   * @param begin first iterator of the range of vertices
+   * @param end past-the-end iterator of the range of vertices
+   */
+  template<class InputIterator>
+  void insert_roi_vertices(InputIterator begin, InputIterator end)
+  {
+    for( ;begin != end; ++begin)
+    {
+      insert_roi_vertex(*begin);
+    }
+  }
+
+  /**
+   * Inserts a vertex in the region-of-interest
+   * @param vd the vertex to be inserted
+   * @return `true` if `vd` is not already in the region-of-interest.
+   */
+  bool insert_roi_vertex(vertex_descriptor vd)
+  {
+    if(is_roi_vertex(vd)) { return false; }
+    need_preprocess_both();
+
+    is_roi_map[id(vd)] = true;
+    roi.push_back(vd);
+    return true;
+  }
+
+  /**
+   * Erases a vertex from the region-of-interest and the set of control vertices.
+   * \note At the next call to `preprocess()`, any vertex that is no longer in the region-of-interest will be assigned to its original position
+   * (that is the position of the vertex at the time of construction or after the last call to `overwrite_initial_geometry()`).
+   * @param vd the vertex to be erased
+   * @return `true` `vd` was a vertex from the region-of-interest.
+   */
+  bool erase_roi_vertex(vertex_descriptor vd)
+  {
+    if(!is_roi_vertex(vd)) { return false; }
+
+    erase_control_vertex(vd); // also erase from being control
+
+    typename std::vector<vertex_descriptor>::iterator it = std::find(roi.begin(), roi.end(), vd);
+    if(it != roi.end())
+    {
+      is_roi_map[id(vd)] = false;
+      roi.erase(it);
+
+      need_preprocess_both();
+      return true;
+    }
+
+    CGAL_assertion(false); // inconsistency between is_roi_map, and roi vector!
+    return false;
+  }
+
+  /**
+   * Preprocessing function that need to be called each time the region-of-interest or the set
+   * of control vertices are changed before calling `deform()`.
+   * If not already done, `deform()` first calls this function.
+   * \cgalAdvancedBegin
+   * Collects the vertices not in the region-of-interest that are adjacent to a vertex from the
+   * region-of-interest (these vertices are internally considered as fixed control vertices).
+   * Then assembles and factorizes the Laplacian matrix used in the function `deform()`.
+   * \cgalAdvancedEnd
+   * \note A modification of the set of control vertices or the region-of-interest invalidates the
+   * preprocessing data.
+   * @return `true` if successful.
+   * A common reason for failure is that the system is rank deficient,
+   * which happens for example when all the vertices are in the region-of-interest and no control vertices are set, or
+   * if the weighting scheme used features too many zero and breaks the connectivity information.
+   */
+  bool preprocess()
+  {
+    region_of_solution();
+    assemble_laplacian_and_factorize();
+    return last_preprocess_successful; // which is set by assemble_laplacian_and_factorize()
+  }
+/// @} Preprocessing
+
+/// \name Deformation
+/// @{
+
+  /**
+   * Sets the target position of a control vertex.
+   * @param vd the control vertex the target position is set
+   * @param target_position the new target position
+   */
+  void set_target_position(vertex_descriptor vd, const Point& target_position)
+  {
+    region_of_solution(); // we require ros ids, so if there is any need to preprocess of region of solution -do it.
+
+    if(!is_control_vertex(vd)) { return; }
+    solution[ros_id(vd)] = target_position;
+  }
+
+  /**
+   * Updates the target position of `vd` by applying     a translation of vector `t`.
+   *
+   * @tparam Vect is a 3D vector class, with `Vect(double x,double y, double z)` being a constructor from its %Cartesian coordinates
+   *         and `double Vect::operator[](int i)` with i=0,1 or 2 returning its %Cartesian coordinates.
+   *
+   * @param vd a control vertex
+   * @param t translation vector
+   * \pre `is_control_vertex(vd)`
+   */
+  template<class Vect>
+  void translate(vertex_descriptor vd, const Vect& t)
+  {
+    region_of_solution(); // we require ros ids, so if there is any need to preprocess of region of solution -do it.
+
+    std::size_t v_id = ros_id(vd);
+    solution[v_id] = add_to_point(solution[v_id], t);
+  }
+
+  /**
+   * Equivalent to calling the overload taking only one control vertex, for each vertex in the range `[begin,end[`.
+   *
+   * @tparam InputIterator input iterator type with `vertex_descriptor` as value type
+   * @tparam Vect is a 3D vector class, with `Vect(double x,double y, double z)` being a constructor from its %Cartesian coordinates
+   *         and `double Vect::operator[](int i)` with i=0,1 or 2 returning its %Cartesian coordinates.
+   *
+   * @param begin first iterator of the range of vertices
+   * @param end past-the-end iterator of the range of vertices
+   * @param t translation vector
+   */
+  template<class InputIterator, class Vect>
+  void translate(InputIterator begin, InputIterator end, const Vect& t)
+  {
+    region_of_solution(); // we require ros ids, so if there is any need to preprocess of region of solution -do it.
+
+    for(; begin != end; ++begin) {
+      std::size_t v_id = ros_id(*begin);
+      solution[v_id] = add_to_point(solution[v_id], t);
+    }
+  }
+
+  /**
+   * Updates the target position of `vd` by applying to its last target position
+   * a rotation defined by the quaternion `quat`, the center of the rotation being
+   * the origin translated by `to_rotation_center` .
+   *
+   * @tparam Quaternion is a quaternion class with `Vect operator*(Quaternion, Vect)` returning the product of a quaternion with a vector
+   * @tparam Vect is a 3D vector class, with `Vect(double x,double y, double z)` being a constructor from its %Cartesian coordinates
+   *         and `double Vect::operator[](int i)` with i=0,1 or 2 returning its %Cartesian coordinates.
+   *
+   * @param vd a control vertex
+   * @param to_rotation_center the vector to translate the origin to the center of the rotation
+   * @param quat quaternion of the rotation
+   * \pre `is_control_vertex(vd)`
+   * \pre `quad` represents a rotation
+   */
+  template <typename Quaternion, typename Vect>
+  void rotate(vertex_descriptor vd, const Vect& to_rotation_center, const Quaternion& quat)
+  {
+    CGAL_precondition( is_control_vertex(vd) );
+    region_of_solution(); // we require ros ids, so if there is any need to preprocess of region of solution -do it.
+
+    std::size_t v_id = ros_id(vd);
+    Vect v = quat * sub_to_vect(solution[v_id], to_rotation_center);
+    solution[v_id] = Point( to_rotation_center[0]+v[0],
+                            to_rotation_center[1]+v[1],
+                            to_rotation_center[2]+v[2] );
+  }
+
+  /**
+   * Equivalent to calling the overload taking only one control vertex, for each vertex in the range `[begin,end[`.
+   *
+   * @tparam InputIterator input iterator type with `vertex_descriptor` as value type
+   * @tparam Quaternion is a quaternion class with `Vect operator*(Quaternion, Vect)` returning the product of a quaternion with a vector
+   * @tparam Vect is a 3D vector class, with `Vect(double x,double y, double z)` being a constructor from its %Cartesian coordinates
+   *         and `double Vect::operator[](int i)` with i=0,1 or 2 returning its %Cartesian coordinates.
+   *
+   * @param begin first iterator of the range of vertices
+   * @param end past-the-end iterator of the range of vertices
+   * @param to_rotation_center the vector to translate the origin to the center of the rotation
+   * @param quat quaternion of the rotation
+   * \pre `quad` represents a rotation
+   */
+  template <typename InputIterator, typename Vect, typename Quaternion>
+  void rotate(InputIterator begin, InputIterator end, const Vect& to_rotation_center, const Quaternion& quat)
+  {
+    region_of_solution(); // we require ros ids, so if there is any need to preprocess of region of solution -do it.
+
+    for(; begin != end; ++begin) {
+      std::size_t v_id = ros_id(*begin);
+      Vect v = quat * sub_to_vect(solution[v_id], to_rotation_center);
+      solution[v_id] = Point( to_rotation_center[0]+v[0],
+                              to_rotation_center[1]+v[1],
+                              to_rotation_center[2]+v[2] );
+    }
+  }
+
+  /**
+    * Returns the target position of a control vertex.
+    * \param vd a control vertex
+    * \pre `is_control_vertex(vd)`
+    */
+  const Point& target_position(vertex_descriptor vd)
+  {
+    region_of_solution();
+
+    CGAL_precondition( is_control_vertex(vd) );
+    return solution[ ros_id(vd) ];
+  }
+
+  /**
+   * Deforms the region-of-interest according to the deformation algorithm, using the target positions of each control vertex set by using `rotate()`, `translate()`, or `set_target_position()`.
+   * The points associated to each vertex of the input triangle mesh that are inside the region-of-interest are updated.
+   * \note Nothing happens if `preprocess()` returns `false`.
+   * @see set_iterations(unsigned int iterations), set_tolerance(double tolerance), deform(unsigned int iterations, double tolerance)
+   */
+  void deform()
+  {
+    deform(m_iterations, m_tolerance);
+  }
+
+  /**
+   * Same as `deform()` but the number of iterations and the tolerance are one-time parameters.
+   * @param iterations number of iterations for optimization procedure
+   * @param tolerance tolerance of convergence (see explanations set_tolerance(double tolerance))
+   */
+  void deform(unsigned int iterations, double tolerance)
+  {
+    preprocess();
+
+    if(!last_preprocess_successful) {
+      CGAL_warning(false);
+      return;
+    }
+    // Note: no energy based termination occurs at first iteration
+    // because comparing energy of original model (before deformation) and deformed model (deformed_1_iteration)
+    // simply does not make sense, comparison is meaningful between deformed_(i)_iteration & deformed_(i+1)_iteration
+
+    double energy_this = 0; // initial value is not important, because we skip first iteration
+    double energy_last;
+
+    // iterations
+    for ( unsigned int ite = 0; ite < iterations; ++ite)
+    {
+      // main steps of optimization
+      update_solution();
+#ifndef CGAL_DEFORM_MESH_JUST_EXPERIMENTAL_SCALE
+      optimal_rotations();
+#endif
+#ifdef CGAL_DEFORM_MESH_USE_EXPERIMENTAL_SCALE
+      optimal_scales();
+#endif
+      // energy based termination
+      if(tolerance > 0.0 && (ite + 1) < iterations) // if tolerance <= 0 then don't compute energy
+      {                                             // also no need compute energy if this iteration is the last iteration
+        energy_last = energy_this;
+        energy_this = energy();
+        CGAL_warning(energy_this >= 0);
+
+        if(ite != 0) // skip first iteration
+        {
+          double energy_dif = std::abs((energy_last - energy_this) / energy_this);
+          if ( energy_dif < tolerance ) { break; }
+        }
+      }
+    }
+    // copy solution to the target surface mesh
+    assign_solution();
+  }
+
+  /**
+   * Resets the points associated to the vertices of the region-of-interest at their
+   * initial positions at time of the functor construction or after
+   * the last call to `overwrite_initial_geometry()`.
+   * \note if the region-of-interest or the set of control vertices have been
+   * modified since the last call to `preprocess()`, it will be called prior
+   * to the reset.
+   */
+  void reset()
+  {
+    if(roi.empty()) { return; } // no ROI to reset
+
+    region_of_solution(); // since we are using original vector
+
+    //restore the current positions to be the original positions
+    BOOST_FOREACH(vertex_descriptor vd, roi_vertices())
+    {
+      put(vertex_point_map, vd, original[ros_id(vd)]);
+      solution[ros_id(vd)]=original[ros_id(vd)];
+    }
+
+    // also set rotation matrix to identity
+    std::fill(rot_mtr.begin(), rot_mtr.end(),
+              Closest_rotation_traits().identity_matrix());
+  }
+
+  /**
+   * Sets the initial positions of the vertices from the region-of-interest to the current positions. Calling this function has the same effect as creating
+   * a new deformation object with the current deformed triangle mesh, keeping the region-of-interest and the set of control vertices.
+   * \note if the region-of-interest or the set of control vertices have been modified since the last call to `preprocess()`,
+   * it will be called prior to the overwrite.
+   *
+   * \cgalAdvancedBegin
+   * This function might have a non-negligible effect on the result.
+   * The Laplacian matrix of the free vertices and the optimal rotations
+   * are computed using the original positions of the points
+   * associated to the vertices. Thus, if a deformed version of the surface mesh
+   * is used as reference, the surface mesh properties the algorithm
+   * tries to preserve are those of an altered version (which are already
+   * degraded).
+   * \cgalAdvancedEnd
+   */
+  void overwrite_initial_geometry()
+  {
+    typedef internal::SC_on_the_fly_pmap<Vertex_point_map> Wrapper;
+    if(roi.empty()) { return; } // no ROI to overwrite
+
+    region_of_solution(); // the roi should be preprocessed since we are using original_position vec
+
+    BOOST_FOREACH(vertex_descriptor vd, roi_vertices())
+    {
+      original[ros_id(vd)] = get(vertex_point_map, vd);
+    }
+
+    // now I need to compute weights for halfedges incident to roi vertices
+    std::vector<bool> is_weight_computed(2*num_edges(m_triangle_mesh), false);
+    BOOST_FOREACH(vertex_descriptor vd, roi_vertices())
+    {
+      in_edge_iterator e, e_end;
+      for (cpp11::tie(e,e_end) = in_edges(vd, m_triangle_mesh); e != e_end; e++)
+      {
+        halfedge_descriptor he = halfedge(*e, m_triangle_mesh);
+        std::size_t id_e = id(he);
+        if(is_weight_computed[id_e]) { continue; }
+
+        hedge_weight[id_e] = weight_calculator(he, m_triangle_mesh, Wrapper(vertex_point_map));
+        is_weight_computed[id_e] = true;
+
+        halfedge_descriptor e_opp = opposite(he, m_triangle_mesh);
+        std::size_t id_e_opp = id(e_opp);
+
+        hedge_weight[id_e_opp] = weight_calculator(e_opp, m_triangle_mesh, Wrapper(vertex_point_map));
+        is_weight_computed[id_e_opp] = true;
+      }
+    }
+
+    // also set rotation matrix to identity
+    std::fill(rot_mtr.begin(), rot_mtr.end(), Closest_rotation_traits().identity_matrix());
+
+    need_preprocess_both(); // now we need reprocess
+  }
+
+/// @} Deformation
+
+/// \name Utilities
+/// @{
+
+  /**
+   * Gets the default number of iterations (5) or the value passed to the function `set_iterations()`
+   */
+  unsigned int iterations()
+  { return m_iterations; }
+
+  /**
+   * Gets the default tolerance parameter (1e-4) or the value passed to the function `set_tolerance()`
+   */
+  double tolerance()
+  { return m_tolerance; }
+
+  /**
+   * Sets the maximum number of iterations ran by `deform()`
+   */
+  void set_iterations(unsigned int iterations)
+  { this->m_iterations = iterations; }
+
+   /// @brief Sets the tolerance of the convergence used in `deform()`.
+   /// If `tolerance==0`, no energy based termination criteria is used (preventing to do the energy computation at each iteration step)
+   ///
+   /// `tolerance >` \f$|\mathrm{energy}(m_i) - \mathrm{energy}(m_{i-1})| / \mathrm{energy}(m_i)\f$ will be used as a termination criterium.
+  void set_tolerance(double tolerance)
+  { this->m_tolerance = tolerance; }
+
+  /**
+   * Returns the range of vertices in the region-of-interest.
+   */
+  const Roi_vertex_range& roi_vertices() const
+  {
+    return roi;
+  }
+
+  /**
+   * Tests whether a vertex is inside the region-of-interest.
+   * @param vd the query vertex
+   * @return `true` if `vd` has been inserted to (and not erased from) the region-of-interest.
+   */
+  bool is_roi_vertex(vertex_descriptor vd) const
+  { return is_roi_map[id(vd)]; }
+
+  /**
+   * Tests whether a vertex is a control vertex.
+   * @param vd the query vertex
+   * @return `true` if `vd` has been inserted to (and not erased from) the set of control vertices.
+   */
+  bool is_control_vertex(vertex_descriptor vd) const
+  { return is_ctrl_map[id(vd)]; }
+
+  /**
+   * Provides access to the triangle mesh being deformed
+   */
+  const Triangle_mesh& triangle_mesh() const
+  { return m_triangle_mesh; }
+
+  const Triangle_mesh& halfedge_graph() const
+  { return m_triangle_mesh; }
+
+  /**
+   * Sets the alpha coefficient that determines the weight of the bending term (rotation smoothness) for the SRE-ARAP deformation technique.
+   * The range of values can be from 0 to infinity. When alpha=0, the method reverts to ARAP. When alpha is increased, neighboring rotations become similar to each other, where alpha=infinity results in a global rigid transformation of the ROI. The value of alpha depends on the surface area and shape. Since alpha is not too sensitive, it can be tweaked in most cases by multiplying it by powers of 10.
+   * The default value for alpha is 0.02.
+   */
+  void set_sre_arap_alpha(double a)
+  {
+    arap_visitor.set_sre_arap_alpha(a);
+  }
+
+/// @} Utilities
+
+
+private:
+
+  /// Assigns id to one ring neighbor of vd, and also push them into push_vector
+  void assign_ros_id_to_one_ring(vertex_descriptor vd,
+                             std::size_t& next_id,
+                             std::vector<vertex_descriptor>& push_vector)
+  {
+    in_edge_iterator e, e_end;
+    for (cpp11::tie(e,e_end) = in_edges(vd, m_triangle_mesh); e != e_end; e++)
+    {
+      vertex_descriptor vt = source(*e, m_triangle_mesh);
+      if(ros_id(vt) == (std::numeric_limits<std::size_t>::max)())  // neighboring vertex which is outside of roi and not visited previously (i.e. need an id)
+      {
+        ros_id(vt) = next_id++;
+        push_vector.push_back(vt);
+      }
+    }
+  }
+
+  /// Find region of solution, including roi and hard constraints, which is the 1-ring vertices out roi
+  /// Contains four parts:
+  ///  - if there is any vertex which is no longer roi, set its position back to original position
+  ///  - assign a ros id to vertices inside ros + ros-boundary
+  ///  - reinitialize rotation matrices, if a vertex is previously ros, use its previous matrix, otherwise set zero
+  ///  - reinitialize original, and solution,
+  ///      + if a vertex is previously roi, then use its original position in old_origional, else use point().
+  ///        In both case we are using "original position" of the vertex.
+  ///      + same for solution (it is required to prevent jumping effects)
+  void region_of_solution()
+  {
+    if(!need_preprocess_region_of_solution) { return; }
+    need_preprocess_region_of_solution = false;
+
+    std::vector<std::size_t>  old_ros_id_map = ros_id_map;
+    std::vector<CR_matrix>    old_rot_mtr    = rot_mtr;
+    std::vector<Point>        old_solution   = solution;
+    std::vector<Point>        old_original   = original;
+
+    // any vertices which are no longer ROI, should be assigned to their original position, so that:
+    // IF a vertex is ROI (actually if its ros + boundary) previously (when previous region_of_solution() is called)
+    // we have its original position in old_original
+    // ELSE
+    // we have its original position in vertex->point()
+    // (current ros is actually old ros - we did not change it yet)
+    for(typename std::vector<vertex_descriptor>::iterator it = ros.begin(); it != ros.end(); ++it)
+    {
+      if(!is_roi_vertex(*it)) {
+        put(vertex_point_map, *it, old_original[ old_ros_id_map[id(*it)] ]);
+      }
+    }
+
+    ////////////////////////////////////////////////////////////////
+    // assign id to vertices inside: roi, boundary of roi (roi + boundary of roi = ros),
+    //                               and boundary of ros
+    // keep in mind that id order does not have to be compatible with ros order
+    ros.clear(); // clear ros
+    ros.insert(ros.end(), roi.begin(), roi.end());
+
+    ros_id_map.assign(num_vertices(m_triangle_mesh), (std::numeric_limits<std::size_t>::max)()); // use max as not assigned mark
+
+    for(std::size_t i = 0; i < roi.size(); i++)  // assign id to all roi vertices
+    { ros_id(roi[i]) = i; }
+
+    // now assign an id to vertices on boundary of roi
+    std::size_t next_ros_index = roi.size();
+    for(std::size_t i = 0; i < roi.size(); i++)
+    { assign_ros_id_to_one_ring(roi[i], next_ros_index, ros); }
+
+    std::vector<vertex_descriptor> outside_ros;
+    // boundary of ros also must have ids because in CR calculation,
+    // one-ring neighbor of ROS vertices are reached.
+    for(std::size_t i = roi.size(); i < ros.size(); i++)
+    { assign_ros_id_to_one_ring(ros[i], next_ros_index, outside_ros); }
+    ////////////////////////////////////////////////////////////////
+
+    // initialize the rotation matrices (size: ros)
+    rot_mtr.resize(ros.size());
+    for(std::size_t i = 0; i < rot_mtr.size(); i++)
+    {
+      std::size_t v_ros_id = ros_id(ros[i]);
+      std::size_t v_id = id(ros[i]);
+
+      // any vertex which is previously ROS has a rotation matrix
+      // use that matrix to prevent jumping effects
+      if(old_ros_id_map[v_id] != (std::numeric_limits<std::size_t>::max)()
+          && old_ros_id_map[v_id] < old_rot_mtr.size()) {
+          // && boundary of ros vertices also have ids so check whether it is ros
+        rot_mtr[v_ros_id] = old_rot_mtr[ old_ros_id_map[v_id] ];
+      }
+      else {
+        rot_mtr[v_ros_id] = Closest_rotation_traits().identity_matrix();
+      }
+    }
+
+    // initialize solution and original (size: ros + boundary_of_ros)
+
+    // for simplifying coding effort, I also put boundary of ros into solution and original
+    // because boundary of ros vertices are reached in optimal_rotations() and energy()
+    solution.resize(ros.size() + outside_ros.size());
+    original.resize(ros.size() + outside_ros.size());
+
+    for(std::size_t i = 0; i < ros.size(); i++)
+    {
+      std::size_t v_ros_id = ros_id(ros[i]);
+      std::size_t v_id = id(ros[i]);
+
+      if(is_roi_vertex(ros[i]) && old_ros_id_map[v_id] != (std::numeric_limits<std::size_t>::max)()) {
+        // if it is currently roi and previously ros + boundary
+        // (actually I just need to assign old's to new's if a vertex is currently and previously ROI
+        // but no harm on assigning if its also previously ros + boundary because
+        // those(old_original & old_solution) will be equal to original position)
+        original[v_ros_id] = old_original[old_ros_id_map[v_id]];
+        solution[v_ros_id] = old_solution[old_ros_id_map[v_id]];
+      }
+      else {
+        solution[v_ros_id] = get(vertex_point_map, ros[i]);
+        original[v_ros_id] = get(vertex_point_map, ros[i]);
+      }
+    }
+
+    for(std::size_t i = 0; i < outside_ros.size(); ++i)
+    {
+      std::size_t v_ros_id = ros_id(outside_ros[i]);
+      original[v_ros_id] = get(vertex_point_map, outside_ros[i]);
+      solution[v_ros_id] = get(vertex_point_map, outside_ros[i]);
+    }
+
+#ifdef CGAL_DEFORM_MESH_USE_EXPERIMENTAL_SCALE
+    scales.resize(ros.size());
+    std::fill(scales.begin(), scales.end(), 1.0);
+#endif
+  }
+
+  /// Assemble Laplacian matrix A of linear system A*X=B
+  void assemble_laplacian_and_factorize()
+  {
+    if(TAG == SPOKES_AND_RIMS)
+    {
+      assemble_laplacian_and_factorize_spokes_and_rims();
+    }
+    else
+    {
+      assemble_laplacian_and_factorize_arap();
+    }
+  }
+  /// Construct matrix that corresponds to left-hand side of eq:lap_ber in user manual
+  /// Also constraints are integrated as eq:lap_energy_system in user manual
+  void assemble_laplacian_and_factorize_arap()
+  {
+    if(!need_preprocess_factorization) { return; }
+    need_preprocess_factorization = false;
+
+    typename Sparse_linear_solver::Matrix A(ros.size());
+
+    /// assign cotangent Laplacian to ros vertices
+    for(std::size_t k = 0; k < ros.size(); k++)
+    {
+      vertex_descriptor vi = ros[k];
+      std::size_t vi_id = ros_id(vi);
+      if ( is_roi_vertex(vi) && !is_control_vertex(vi) )          // vertices of ( roi - ctrl )
+      {
+        double diagonal = 0;
+        in_edge_iterator e, e_end;
+        for (cpp11::tie(e,e_end) = in_edges(vi, m_triangle_mesh); e != e_end; e++)
+        {
+          halfedge_descriptor he = halfedge(*e, m_triangle_mesh);
+          vertex_descriptor vj = source(he, m_triangle_mesh);
+          double wij = hedge_weight[id(he)];  // edge(pi - pj)
+          double wji = hedge_weight[id(opposite(he, m_triangle_mesh))]; // edge(pi - pj)
+          double total_weight = wij + wji;
+
+          A.set_coef(vi_id, ros_id(vj), -total_weight, true); // off-diagonal coefficient
+          diagonal += total_weight;
+        }
+        // diagonal coefficient
+        A.set_coef(vi_id, vi_id, diagonal, true);
+      }
+      else
+      {
+        A.set_coef(vi_id, vi_id, 1.0, true);
+      }
+    }
+
+    // now factorize
+    double D;
+    last_preprocess_successful = m_solver.factor(A, D);
+    CGAL_warning(last_preprocess_successful);
+  }
+  /// Construct matrix that corresponds to left-hand side of eq:lap_ber_rims in user manual
+  /// Also constraints are integrated as eq:lap_energy_system in user manual
+  void assemble_laplacian_and_factorize_spokes_and_rims()
+  {
+    if(!need_preprocess_factorization) { return; }
+    need_preprocess_factorization = false;
+
+    typename Sparse_linear_solver::Matrix A(ros.size());
+
+    /// assign cotangent Laplacian to ros vertices
+    for(std::size_t k = 0; k < ros.size(); k++)
+    {
+      vertex_descriptor vi = ros[k];
+      std::size_t vi_id = ros_id(vi);
+      if ( is_roi_vertex(vi) && !is_control_vertex(vi) ) // vertices of ( roi - ctrl ): free vertices
+      {
+        double diagonal = 0;
+        out_edge_iterator e, e_end;
+        for (cpp11::tie(e,e_end) = out_edges(vi, m_triangle_mesh); e != e_end; e++)
+        {
+          halfedge_descriptor he = halfedge(*e, m_triangle_mesh);
+          double total_weight = 0;
+          // an edge contribute to energy only if it is part of an incident triangle
+          // (i.e it should not be a border edge)
+          if(!is_border(he, m_triangle_mesh))
+          {
+            double wji = hedge_weight[id(he)]; // edge(pj - pi)
+            total_weight += wji;
+          }
+
+          halfedge_descriptor opp = opposite(he, m_triangle_mesh);
+          if(!is_border(opp, m_triangle_mesh))
+          {
+            double wij = hedge_weight[id(opp)]; // edge(pi - pj)
+            total_weight += wij;
+          }
+
+          // place coefficient to matrix
+          vertex_descriptor vj = target(he, m_triangle_mesh);
+          A.set_coef(vi_id, ros_id(vj), -total_weight, true); // off-diagonal coefficient
+          diagonal += total_weight;
+        }
+        // diagonal coefficient
+        A.set_coef(vi_id, vi_id, diagonal, true);
+      }
+      else // constrained vertex
+      {
+        A.set_coef(vi_id, vi_id, 1.0, true);
+      }
+    }
+
+    // now factorize
+    double D;
+    last_preprocess_successful = m_solver.factor(A, D);
+    CGAL_warning(last_preprocess_successful);
+  }
+
+  /// Local step of iterations, computing optimal rotation matrices
+  void optimal_rotations()
+  {
+    if(TAG == SPOKES_AND_RIMS)
+    {
+      optimal_rotations_spokes_and_rims();
+    }
+    else
+    {
+      optimal_rotations_arap();
+    }
+  }
+  void optimal_rotations_arap()
+  {
+    Closest_rotation_traits cr_traits;
+    CR_matrix cov = cr_traits.zero_matrix();
+
+    // only accumulate ros vertices
+    for ( std::size_t k = 0; k < ros.size(); k++ )
+    {
+      vertex_descriptor vi = ros[k];
+      std::size_t vi_id = ros_id(vi);
+      // compute covariance matrix (user manual eq:cov_matrix)
+      cov = cr_traits.zero_matrix();
+
+      in_edge_iterator e, e_end;
+
+      arap_visitor.rotation_matrix_pre(vi, m_triangle_mesh);
+
+      for (cpp11::tie(e,e_end) = in_edges(vi, m_triangle_mesh); e != e_end; e++)
+      {
+        halfedge_descriptor he=halfedge(*e, m_triangle_mesh);
+        vertex_descriptor vj = source(he, m_triangle_mesh);
+        std::size_t vj_id = ros_id(vj);
+
+        const CR_vector& pij = sub_to_CR_vector(original[vi_id], original[vj_id]);
+        const CR_vector& qij = sub_to_CR_vector(solution[vi_id], solution[vj_id]);
+        double wij = hedge_weight[id(he)];
+
+        cr_traits.add_scalar_t_vector_t_vector_transpose(cov, wij, pij, qij); // cov += wij * (pij * qij)
+
+        if ( vj_id < rot_mtr.size() )
+          arap_visitor.update_covariance_matrix(cov, rot_mtr[vj_id]);
+      }
+
+      cr_traits.compute_close_rotation(cov, rot_mtr[vi_id]);
+    }
+  }
+  void optimal_rotations_spokes_and_rims()
+  {
+    Closest_rotation_traits cr_traits;
+    CR_matrix cov =cr_traits.zero_matrix();
+
+    // only accumulate ros vertices
+    for ( std::size_t k = 0; k < ros.size(); k++ )
+    {
+      vertex_descriptor vi = ros[k];
+      std::size_t vi_id = ros_id(vi);
+      // compute covariance matrix
+      cov = cr_traits.zero_matrix();
+
+      //iterate through all triangles
+      out_edge_iterator e, e_end;
+      for (cpp11::tie(e,e_end) = out_edges(vi, m_triangle_mesh); e != e_end; e++)
+      {
+        halfedge_descriptor he = halfedge(*e, m_triangle_mesh);
+        if(is_border(he, m_triangle_mesh)) { continue; } // no facet
+        // iterate edges around facet
+        halfedge_descriptor hedge_around_facet = he;
+        do
+        {
+          vertex_descriptor v1 = target(hedge_around_facet, m_triangle_mesh);
+          vertex_descriptor v2 = source(hedge_around_facet, m_triangle_mesh);
+
+          std::size_t v1_id = ros_id(v1); std::size_t v2_id = ros_id(v2);
+
+          const CR_vector& p12 = sub_to_CR_vector(original[v1_id], original[v2_id]);
+          const CR_vector& q12 = sub_to_CR_vector(solution[v1_id], solution[v2_id]);
+          double w12 = hedge_weight[id(hedge_around_facet)];
+
+          cr_traits.add_scalar_t_vector_t_vector_transpose(cov, w12, p12, q12); // cov += w12 * (p12 * q12);
+
+        } while( (hedge_around_facet = next(hedge_around_facet, m_triangle_mesh)) != he);
+      }
+
+      cr_traits.compute_close_rotation(cov, rot_mtr[vi_id]);
+    }
+  }
+
+#ifdef CGAL_DEFORM_MESH_USE_EXPERIMENTAL_SCALE
+  void optimal_scales()
+  {
+    for ( std::size_t k = 0; k < ros.size(); k++ )
+    {
+      vertex_descriptor vi = ros[k];
+      std::size_t vi_id = ros_id(vi);
+      // compute covariance matrix (user manual eq:cov_matrix)
+      double eT_eR = 0, eRT_eR = 0;
+
+      in_edge_iterator e, e_end;
+      for (cpp11::tie(e,e_end) = in_edges(vi, m_triangle_mesh); e != e_end; e++)
+      {
+        halfedge_descriptor he = *e;
+        vertex_descriptor vj = source(he, m_triangle_mesh);
+        std::size_t vj_id = ros_id(vj);
+
+        const CR_vector& pij = sub_to_CR_vector(original[vi_id], original[vj_id]);
+        const CR_vector& qij = sub_to_CR_vector(solution[vi_id], solution[vj_id]);
+
+        double wij = hedge_weight[id(he)];
+
+        const CR_vector& pRij = rot_mtr[vi_id] * pij;
+        eRT_eR += pRij[0]*pRij[0] + pRij[1]*pRij[1] + pRij[2]*pRij[2];
+        eT_eR  += qij[0]*pRij[0]  + qij[1]*pRij[1]  + qij[2]*pRij[2];
+      }
+
+      scales[vi_id] = eT_eR / eRT_eR;
+    }
+  }
+#endif
+
+  /// Global step of iterations, updating solution
+  void update_solution()
+  {
+    if(TAG == SPOKES_AND_RIMS)
+    {
+      update_solution_spokes_and_rims();
+    }
+    else
+    {
+      update_solution_arap();
+    }
+  }
+  /// calculate right-hand side of eq:lap_ber in user manual and solve the system
+  void update_solution_arap()
+  {
+    typename Sparse_linear_solver::Vector X(ros.size()), Bx(ros.size());
+    typename Sparse_linear_solver::Vector Y(ros.size()), By(ros.size());
+    typename Sparse_linear_solver::Vector Z(ros.size()), Bz(ros.size());
+
+    Closest_rotation_traits cr_traits;
+
+    // assemble right columns of linear system
+    for ( std::size_t k = 0; k < ros.size(); k++ )
+    {
+      vertex_descriptor vi = ros[k];
+      std::size_t vi_id = ros_id(vi);
+
+      if ( is_roi_vertex(vi) && !is_control_vertex(vi) )
+      {// free vertices
+        // sum of right-hand side of eq:lap_ber in user manual
+        CR_vector xyz = cr_traits.vector(0, 0, 0);
+
+        in_edge_iterator e, e_end;
+        for (cpp11::tie(e,e_end) = in_edges(vi, m_triangle_mesh); e != e_end; e++)
+        {
+          halfedge_descriptor he = halfedge(*e, m_triangle_mesh);
+          vertex_descriptor vj = source(he, m_triangle_mesh);
+          std::size_t vj_id = ros_id(vj);
+
+          const CR_vector& pij = sub_to_CR_vector(original[vi_id], original[vj_id]);
+
+          double wij = hedge_weight[id(he)];
+          double wji = hedge_weight[id(opposite(he, m_triangle_mesh))];
+#ifndef CGAL_DEFORM_MESH_USE_EXPERIMENTAL_SCALE
+          cr_traits.add__scalar_t_matrix_p_scalar_t_matrix__t_vector(xyz, wij, rot_mtr[vi_id], wji, rot_mtr[vj_id], pij);
+#else
+        cr_traits.add__scalar_t_matrix_p_scalar_t_matrix__t_vector(xyz, wij * scales[vi_id], rot_mtr[vi_id],
+          wji * scales[vj_id], rot_mtr[vj_id], pij);
+#endif
+          // corresponds xyz += (wij*rot_mtr[vi_id] + wji*rot_mtr[vj_id]) * pij
+        }
+        Bx[vi_id] = cr_traits.vector_coordinate(xyz, 0);
+        By[vi_id] = cr_traits.vector_coordinate(xyz, 1);
+        Bz[vi_id] = cr_traits.vector_coordinate(xyz, 2);
+      }
+      else
+      {// constrained vertex
+        Bx[vi_id] = solution[vi_id][0]; By[vi_id] = solution[vi_id][1]; Bz[vi_id] = solution[vi_id][2];
+      }
+    }
+
+    // solve "A*X = B".
+    bool is_all_solved = m_solver.linear_solver(Bx, X) && m_solver.linear_solver(By, Y) && m_solver.linear_solver(Bz, Z);
+    if(!is_all_solved) {
+      CGAL_warning(false);
+      return;
+    }
+    // copy to solution
+    for (std::size_t i = 0; i < ros.size(); i++)
+    {
+      std::size_t v_id = ros_id(ros[i]);
+      Point p(X[v_id], Y[v_id], Z[v_id]);
+      if (!is_ctrl_map[id(ros[i])])
+        solution[v_id] = p;
+    }
+  }
+  /// calculate right-hand side of eq:lap_ber_rims in user manual and solve the system
+  void update_solution_spokes_and_rims()
+  {
+    typename Sparse_linear_solver::Vector X(ros.size()), Bx(ros.size());
+    typename Sparse_linear_solver::Vector Y(ros.size()), By(ros.size());
+    typename Sparse_linear_solver::Vector Z(ros.size()), Bz(ros.size());
+
+    Closest_rotation_traits cr_traits;
+
+    // assemble right columns of linear system
+    for ( std::size_t k = 0; k < ros.size(); k++ )
+    {
+      vertex_descriptor vi = ros[k];
+      std::size_t vi_id = ros_id(vi);
+
+      if ( is_roi_vertex(vi) && !is_control_vertex(vi) )
+      {// free vertices
+        // sum of right-hand side of eq:lap_ber_rims in user manual
+        CR_vector xyz = cr_traits.vector(0, 0, 0);
+
+        out_edge_iterator e, e_end;
+        for (cpp11::tie(e,e_end) = out_edges(vi, m_triangle_mesh); e != e_end; e++)
+        {
+          halfedge_descriptor he = halfedge(*e, m_triangle_mesh);
+          vertex_descriptor vj = target(he, m_triangle_mesh);
+          std::size_t vj_id = ros_id(vj);
+
+          const CR_vector& pij = sub_to_CR_vector(original[vi_id], original[vj_id]);
+
+          if(!is_border(he, m_triangle_mesh))
+          {
+            vertex_descriptor vn = target(next(he, m_triangle_mesh), m_triangle_mesh); // opp vertex of e_ij
+            double wji = hedge_weight[id(he)] / 3.0;  // edge(pj - pi)
+            cr_traits.add_scalar_t_matrix_sum_t_vector(xyz, wji, rot_mtr[vi_id], rot_mtr[vj_id], rot_mtr[ros_id(vn)], pij);
+            // corresponds  xyz += wji*(rot_mtr[vi_id] + rot_mtr[vj_id] + rot_mtr[ros_id(vn)])*pij;
+          }
+
+          halfedge_descriptor opp = opposite(he, m_triangle_mesh);
+          if(!is_border(opp, m_triangle_mesh))
+          {
+            vertex_descriptor vm = target(next(opp, m_triangle_mesh), m_triangle_mesh); // other opp vertex of e_ij
+            double wij = hedge_weight[id(opp)] / 3.0;  // edge(pi - pj)
+            cr_traits.add_scalar_t_matrix_sum_t_vector(xyz, wij, rot_mtr[vi_id], rot_mtr[vj_id], rot_mtr[ros_id(vm)], pij);
+            // corresponds xyz += wij * ( rot_mtr[vi_id] + rot_mtr[vj_id] + rot_mtr[ros_id(vm)] ) * pij
+          }
+        }
+        Bx[vi_id] = cr_traits.vector_coordinate(xyz, 0);
+        By[vi_id] = cr_traits.vector_coordinate(xyz, 1);
+        Bz[vi_id] = cr_traits.vector_coordinate(xyz, 2);
+      }
+      else
+      {// constrained vertices
+        Bx[vi_id] = solution[vi_id][0]; By[vi_id] = solution[vi_id][1]; Bz[vi_id] = solution[vi_id][2];
+      }
+    }
+    // solve "A*X = B".
+    bool is_all_solved = m_solver.linear_solver(Bx, X) && m_solver.linear_solver(By, Y) && m_solver.linear_solver(Bz, Z);
+    if(!is_all_solved) {
+      CGAL_warning(false);
+      return;
+    }
+
+    // copy to solution
+    for (std::size_t i = 0; i < ros.size(); i++)
+    {
+      std::size_t v_id = ros_id(ros[i]);
+      Point p(X[v_id], Y[v_id], Z[v_id]);
+      if (!is_ctrl_map[id(ros[i])])
+        solution[v_id] = p;
+    }
+  }
+
+  /// Assign solution to target surface mesh
+  void assign_solution()
+  {
+    for(std::size_t i = 0; i < ros.size(); ++i){
+      std::size_t v_id = ros_id(ros[i]);
+      if(is_roi_vertex(ros[i]))
+      {
+        put(vertex_point_map, ros[i], solution[v_id]);
+      }
+    }
+  }
+
+  /// Compute modeling energy
+  double energy() const
+  {
+    if(TAG == SPOKES_AND_RIMS)
+    {
+      return energy_spokes_and_rims();
+    }
+    else
+    {
+      return energy_arap();
+      return 0;
+    }
+  }
+  double energy_arap() const
+  {
+    Closest_rotation_traits cr_traits;
+
+    double sum_of_energy = 0;
+    // only accumulate ros vertices
+    for( std::size_t k = 0; k < ros.size(); k++ )
+    {
+      vertex_descriptor vi = ros[k];
+      std::size_t vi_id = ros_id(vi);
+
+      in_edge_iterator e, e_end;
+      for (cpp11::tie(e,e_end) = in_edges(vi, m_triangle_mesh); e != e_end; e++)
+      {
+        halfedge_descriptor he = halfedge(*e, m_triangle_mesh);
+        vertex_descriptor vj = source(he, m_triangle_mesh);
+        std::size_t vj_id = ros_id(vj);
+
+        const CR_vector& pij = sub_to_CR_vector(original[vi_id], original[vj_id]);
+        const CR_vector& qij = sub_to_CR_vector(solution[vi_id], solution[vj_id]);
+
+        double wij = hedge_weight[id(he)];
+
+        sum_of_energy += wij * cr_traits.squared_norm_vector_scalar_vector_subs(qij, rot_mtr[vi_id], pij);
+        // sum_of_energy += wij * ( qij - rot_mtr[vi_id]*pij )^2
+      }
+    }
+    return sum_of_energy;
+  }
+  double energy_spokes_and_rims() const
+  {
+    Closest_rotation_traits cr_traits;
+
+    double sum_of_energy = 0;
+    // only accumulate ros vertices
+    for( std::size_t k = 0; k < ros.size(); k++ )
+    {
+      vertex_descriptor vi = ros[k];
+      std::size_t vi_id = ros_id(vi);
+      //iterate through all triangles
+      out_edge_iterator e, e_end;
+      for (cpp11::tie(e,e_end) = out_edges(vi, m_triangle_mesh); e != e_end; e++)
+      {
+        halfedge_descriptor he = halfedge(*e, m_triangle_mesh);
+        if(is_border(he, m_triangle_mesh)) { continue; } // no facet
+        // iterate edges around facet
+        halfedge_descriptor hedge_around_facet = he;
+        do
+        {
+          vertex_descriptor v1 = target(hedge_around_facet, m_triangle_mesh);
+          vertex_descriptor v2 = source(hedge_around_facet, m_triangle_mesh);
+          std::size_t v1_id = ros_id(v1); std::size_t v2_id = ros_id(v2);
+
+          const CR_vector& p12 = sub_to_CR_vector(original[v1_id], original[v2_id]);
+          const CR_vector& q12 = sub_to_CR_vector(solution[v1_id], solution[v2_id]);
+          double w12 = hedge_weight[id(hedge_around_facet)];
+
+          sum_of_energy += w12 * cr_traits.squared_norm_vector_scalar_vector_subs(q12, rot_mtr[vi_id], p12);
+          // sum_of_energy += w12 * ( q12 - rot_mtr[vi_id]*p12 )^2
+
+        } while( (hedge_around_facet = next(hedge_around_facet, m_triangle_mesh)) != he);
+      }
+    }
+    return sum_of_energy;
+  }
+
+  void need_preprocess_both()
+  {
+    need_preprocess_factorization = true;
+    need_preprocess_region_of_solution = true;
+  }
+
+  /// p1 - p2, return CR_vector
+  CR_vector sub_to_CR_vector(const Point& p1, const Point& p2) const
+  {
+    return Closest_rotation_traits().vector(p1[0] - p2[0], p1[1] - p2[1], p1[2] - p2[2]);
+  }
+
+  template<class Vect>
+  Point add_to_point(const Point& p, const Vect& v) {
+    return Point(p[0] + v[0], p[1] + v[1], p[2] + v[2]);
+  }
+
+  template<class Vect>
+  Vect sub_to_vect(const Point& p, const Vect& v) {
+    return Vect(p[0] - v[0], p[1] - v[1], p[2] - v[2]);
+  }
+
+  /// shorthand of get(vertex_index_map, v)
+  std::size_t id(vertex_descriptor vd) const
+  { return get(vertex_index_map, vd); }
+
+  std::size_t& ros_id(vertex_descriptor vd)
+  { return ros_id_map[id(vd)]; }
+  std::size_t  ros_id(vertex_descriptor vd) const
+  { return ros_id_map[id(vd)]; }
+
+  /// shorthand of get(hedge_index_map, e)
+  std::size_t id(halfedge_descriptor e) const
+  {
+    return get(hedge_index_map, e);
+  }
+};
+} //namespace CGAL
+#endif  // CGAL_SURFACE_MESH_DEFORMATION_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_shortest_path.h b/3rdparty/CGAL/include/CGAL/Surface_mesh_shortest_path.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_shortest_path.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesh_shortest_path.h
diff --git a/3rdparty/CGAL/include/CGAL/Surface_mesh_shortest_path/Surface_mesh_shortest_path.h b/3rdparty/CGAL/include/CGAL/Surface_mesh_shortest_path/Surface_mesh_shortest_path.h
new file mode 100644
index 0000000..ad84a08
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Surface_mesh_shortest_path/Surface_mesh_shortest_path.h
@@ -0,0 +1,2785 @@
+// Copyright (c) 2014 GeometryFactory
+// 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
+// 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(s)     : Stephen Kiazyk
+
+#ifndef CGAL_SURFACE_MESH_SHORTEST_PATH_SURFACE_MESH_SHORTEST_PATH_H
+#define CGAL_SURFACE_MESH_SHORTEST_PATH_SURFACE_MESH_SHORTEST_PATH_H
+
+#include <iterator>
+#include <vector>
+#include <utility>
+#include <queue>
+#include <algorithm>
+#include <cstddef>
+#include <list>
+
+#include <boost/array.hpp>
+#include <boost/lexical_cast.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <iterator>
+
+#include <CGAL/assertions.h>
+#include <CGAL/AABB_tree.h>
+#include <CGAL/Default.h>
+
+#include <CGAL/Surface_mesh_shortest_path/barycentric.h>
+#include <CGAL/Surface_mesh_shortest_path/internal/Cone_tree.h>
+#include <CGAL/Surface_mesh_shortest_path/internal/misc_functions.h>
+
+#include <CGAL/boost/graph/iterator.h>
+#include <boost/variant/get.hpp>
+
+namespace CGAL {
+
+/*!
+\ingroup PkgSurfaceMeshShortestPath
+
+\brief Computes shortest surface paths from one or more source points on a surface mesh.
+
+\details Uses an optimized variation of Chen and Han's \f$ O(n^2) \f$ algorithm by Xin and Wang.
+Refer to those respective papers for the details of the implementation.
+
+\tparam Traits a model of `SurfaceMeshShortestPathTraits`.
+\tparam VIM a model of `ReadablePropertyMap` with `vertex_descriptor` as key and `unsigned int` as value type.
+            The default is `boost::property_map<HG, boost::%vertex_index_t>::%type`.
+\tparam HIM a model of `ReadablePropertyMap` with `halfedge_descriptor` as key and `unsigned int` as value type.
+            The default is `boost::property_map<HG, boost::%halfedge_index_t>::%type`.
+\tparam FIM a model of `ReadablePropertyMap` with `face_descriptor` as key and `unsigned int` as value type.
+            The default is `boost::property_map<HG, boost::%face_index_t>::%type`.
+\tparam VPM a model of `ReadablePropertyMap` with `vertex_descriptor` as key and `Traits::Point_3` as value type.
+            The default is `boost::property_map<HG, CGAL::vertex_point_t>::%type`.
+*/
+
+template<class Traits,
+  class VIM = Default,
+  class HIM = Default,
+  class FIM = Default,
+  class VPM = Default>
+class Surface_mesh_shortest_path
+{
+public:
+/// \name Types
+/// @{
+
+  /// The triangle mesh type which this algorithm acts on.
+  typedef typename Traits::Triangle_mesh Triangle_mesh;
+
+  /// The BGL graph traits for this triangle mesh
+  typedef boost::graph_traits<Triangle_mesh> Graph_traits;
+
+  /// Descriptors for the vertices of `Triangle_mesh`
+  typedef typename Graph_traits::vertex_descriptor vertex_descriptor;
+
+  /// Descriptors for the halfedges of `Triangle_mesh`
+  typedef typename Graph_traits::halfedge_descriptor halfedge_descriptor;
+
+  /// Descriptors of the faces of `Triangle_mesh`
+  typedef typename Graph_traits::face_descriptor face_descriptor;
+
+#ifndef DOXYGEN_RUNNING
+
+  typedef typename Default::Get<
+    VIM,
+    typename boost::property_map<Triangle_mesh, boost::vertex_index_t>::type
+      >::type Vertex_index_map;
+
+  typedef typename Default::Get<
+    HIM,
+    typename boost::property_map<Triangle_mesh, boost::halfedge_index_t>::type
+      >::type Halfedge_index_map;
+
+  typedef typename Default::Get<
+    FIM,
+    typename boost::property_map<Triangle_mesh, boost::face_index_t>::type
+      >::type Face_index_map;
+
+  typedef typename Default::Get<
+    VPM,
+    typename boost::property_map<Triangle_mesh, CGAL::vertex_point_t>::type
+      >::type Vertex_point_map;
+
+#else
+  /// The vertex index property map class
+  typedef VIM Vertex_index_map;
+
+  /// The halfedge index property map class
+  typedef HIM Halfedge_index_map;
+
+  /// The face index property map class
+  typedef FIM Face_index_map;
+
+  /// The vertex point property map class
+  typedef VPM Vertex_point_map;
+#endif
+
+  /// The numeric type used by this algorithm.
+  typedef typename Traits::FT FT;
+
+  /// The 3-dimensional point type, which must coincide with the value type of `Vertex_point_map`.
+  typedef typename Traits::Point_3 Point_3;
+
+  /// An ordered triple which specifies a location inside a triangle as
+  /// a convex combination of its three vertices.
+  typedef typename Traits::Barycentric_coordinate Barycentric_coordinate;
+
+  /// \brief An ordered pair specifying a location on the surface of the `Triangle_mesh`.
+  /// \details If `tm` is the input graph and given the pair (`f`, `bc`) such that `bc` is `(w0, w1, w2)`,
+  ///  the correspondance with the weights in `bc` and the vertices of the face `f` is the following:
+  /// - `w0 = source(halfedge(f,tm),tm)`
+  /// - `w1 = target(halfedge(f,tm),tm)`
+  /// - `w2 = target(next(halfedge(f,tm),tm),tm)`
+  typedef std::pair<face_descriptor, Barycentric_coordinate> Face_location;
+
+private:
+
+  typedef std::list<Face_location> Source_point_list;
+  typedef typename Source_point_list::iterator Source_point_underlying_iterator;
+
+public:
+
+  /*!
+  \brief A model of `BidirectionalIterator` to access the source points
+
+  \details An iterator becomes invalid if:
+   - the corresponding point is removed (either with `Surface_mesh_shortest_path::remove_source_point()` or `Surface_mesh_shortest_path::remove_all_source_points()`).
+   - the structure is re-built (triggered by a shortest path query or a call to `Surface_mesh_shortest_path::build_sequence_tree()`).
+   - the structure is cleared (`Surface_mesh_shortest_path::clear()`).
+
+  Dereferencing this iterator yields a `const Surface_mesh_shortest_path::Face_location&`.
+
+  This iterator supports equality comparison operations.
+  */
+  class Source_point_iterator
+  {
+  public:
+    typedef std::bidirectional_iterator_tag iterator_category;
+    typedef Face_location value_type;
+    typedef Face_location* pointer;
+    typedef Face_location& reference;
+
+  private:
+    Source_point_underlying_iterator m_iterator;
+
+    friend class Surface_mesh_shortest_path;
+
+    Source_point_iterator(Source_point_underlying_iterator it)
+      : m_iterator(it)
+    {
+    }
+
+  public:
+    /*!
+    \brief %Default constructor
+    */
+    Source_point_iterator()
+    {
+    }
+
+    /*!
+    \brief Copy constructor
+    */
+    Source_point_iterator(const Source_point_iterator& other)
+      : m_iterator(other.m_iterator)
+    {
+    }
+
+    /*
+    \brief Copy the contents of another `Source_point_iterator`
+
+    \param other The iterator to be copied
+    */
+    Source_point_iterator& operator=(const Source_point_iterator& other)
+    {
+      m_iterator = other.m_iterator;
+      return *this;
+    }
+
+    const Face_location& operator*() const
+    {
+      return *m_iterator;
+    }
+
+    const Face_location* operator->() const
+    {
+      return &(*m_iterator);
+    }
+
+    Source_point_iterator& operator++()
+    {
+      ++m_iterator;
+      return *this;
+    }
+
+    Source_point_iterator operator++(int)
+    {
+      Source_point_iterator temp(*this);
+      ++m_iterator;
+      return temp;
+    }
+
+    Source_point_iterator& operator--()
+    {
+      --m_iterator;
+      return *this;
+    }
+
+    Source_point_iterator operator--(int)
+    {
+      Source_point_iterator temp(*this);
+      --m_iterator;
+      return temp;
+    }
+
+    bool operator==(const Source_point_iterator& other)
+    {
+      return m_iterator == other.m_iterator;
+    }
+
+    bool operator!=(const Source_point_iterator& other)
+    {
+      return m_iterator != other.m_iterator;
+    }
+  };
+
+  /// The return type from shortest path distance queries. Stores the distance
+  /// to the nearest source point, and a `Source_point_iterator` to the
+  /// source point itself.
+  typedef std::pair<FT, Source_point_iterator> Shortest_path_result;
+
+/// @}
+
+private:
+  typedef typename Graph_traits::vertex_iterator vertex_iterator;
+  typedef typename Graph_traits::halfedge_iterator halfedge_iterator;
+  typedef typename Graph_traits::face_iterator face_iterator;
+
+  typedef typename Traits::Triangle_3 Triangle_3;
+  typedef typename Traits::Triangle_2 Triangle_2;
+  typedef typename Traits::Segment_2 Segment_2;
+  typedef typename Traits::Ray_3 Ray_3;
+  typedef typename Traits::Ray_2 Ray_2;
+  typedef typename Traits::Line_2 Line_2;
+  typedef typename Traits::Point_2 Point_2;
+  typedef typename Traits::Vector_2 Vector_2;
+
+  typedef internal::Cone_tree_node<Traits> Cone_tree_node;
+  typedef internal::Cone_expansion_event<Traits> Cone_expansion_event;
+
+  typedef std::priority_queue<Cone_expansion_event, std::vector<Cone_expansion_event*>, internal::Cone_expansion_event_min_priority_queue_comparator<Traits> > Expansion_priqueue;
+  typedef std::pair<Cone_tree_node*, FT> Node_distance_pair;
+
+private:
+
+  template <class OutputIterator>
+  struct Point_path_visitor_wrapper
+  {
+    Surface_mesh_shortest_path& m_owner;
+    OutputIterator m_output;
+
+    Point_path_visitor_wrapper(Surface_mesh_shortest_path& owner, OutputIterator output)
+      : m_owner(owner)
+      , m_output(output)
+    {
+    }
+
+    void operator()(halfedge_descriptor edge, FT t)
+    {
+      *m_output = m_owner.point(edge, t);
+      ++m_output;
+    }
+
+    void operator()(vertex_descriptor vertex)
+    {
+      *m_output = m_owner.point(vertex);
+      ++m_output;
+    }
+
+    void operator()(face_descriptor f, Barycentric_coordinate location)
+    {
+      *m_output = m_owner.point(f, location);
+      ++m_output;
+    }
+  };
+
+private:
+  Traits m_traits;
+  Triangle_mesh& m_graph;
+  Vertex_index_map m_vertexIndexMap;
+  Halfedge_index_map m_halfedgeIndexMap;
+  Face_index_map m_faceIndexMap;
+  Vertex_point_map m_vertexPointMap;
+
+  std::vector<bool> m_vertexIsPseudoSource;
+
+  std::vector<Node_distance_pair> m_vertexOccupiers;
+  std::vector<Node_distance_pair> m_closestToVertices;
+
+  std::vector<std::pair<Cone_tree_node*, Source_point_iterator> > m_rootNodes;
+  Source_point_list m_faceLocations;
+  Source_point_underlying_iterator m_firstNewSourcePoint;
+  Source_point_list m_deletedSourceLocations;
+
+  std::vector<std::vector<Cone_tree_node*> > m_faceOccupiers;
+
+  Expansion_priqueue m_expansionPriqueue;
+
+#if !defined(NDEBUG)
+
+  std::size_t m_currentNodeCount;
+  std::size_t m_peakNodeCount;
+  std::size_t m_queueAtPeakNodes;
+  std::size_t m_peakQueueSize;
+  std::size_t m_nodesAtPeakQueue;
+
+#endif
+
+#if !defined(NDEBUG)
+public:
+
+  /// \cond
+
+  std::size_t peak_node_count()
+  {
+    return m_peakNodeCount;
+  }
+
+  std::size_t current_node_count()
+  {
+    return m_currentNodeCount;
+  }
+
+  std::size_t peak_queue_size()
+  {
+    return m_peakQueueSize;
+  }
+
+  std::size_t current_memory_usage()
+  {
+    std::size_t baseUsage = m_rootNodes.size() * sizeof(Cone_tree_node*) + m_closestToVertices.size() * sizeof(Node_distance_pair);
+
+    std::size_t finalUsage = baseUsage + sizeof(Cone_tree_node) * m_currentNodeCount;
+
+    for (std::size_t i = 0; i < m_faceOccupiers.size(); ++i)
+    {
+      finalUsage += (m_faceOccupiers[i].size() * sizeof(Cone_tree_node*)) + sizeof(std::vector<Cone_tree_node*>);
+    }
+
+    return finalUsage;
+  }
+
+  std::size_t peak_memory_usage()
+  {
+    std::size_t baseUsage = m_rootNodes.size() * sizeof(Cone_tree_node*) + m_vertexOccupiers.size() * sizeof(Node_distance_pair) + m_closestToVertices.size() * sizeof(Node_distance_pair);
+
+    std::size_t peakNodeUsage = baseUsage + (sizeof(Cone_tree_node) * m_peakNodeCount) + ((sizeof(Cone_expansion_event) + sizeof(Cone_expansion_event*)) * m_queueAtPeakNodes);
+
+    std::size_t peakQueueUsage = baseUsage + (sizeof(Cone_expansion_event) + (sizeof(Cone_expansion_event*)) * m_peakQueueSize) + (sizeof(Cone_tree_node) * m_nodesAtPeakQueue);
+
+    return std::max(peakNodeUsage, peakQueueUsage);
+  }
+
+  /// \endcond
+
+#endif
+
+
+public:
+
+  /// \cond
+
+  /// This is just a placeholder for a proper debug output verbosity switch method
+  bool m_debugOutput;
+
+  /// \endcond
+
+private:
+
+  void node_created()
+  {
+#if !defined(NDEBUG)
+    ++m_currentNodeCount;
+    if (m_currentNodeCount > m_peakNodeCount)
+    {
+      m_peakNodeCount = m_currentNodeCount;
+      m_queueAtPeakNodes = m_expansionPriqueue.size();
+    }
+#endif
+  }
+
+  void queue_pushed()
+  {
+#if !defined(NDEBUG)
+    if (m_expansionPriqueue.size() > m_peakQueueSize)
+    {
+      m_peakQueueSize = m_expansionPriqueue.size();
+      m_nodesAtPeakQueue = m_currentNodeCount;
+    }
+#endif
+  }
+
+  void node_deleted()
+  {
+#if !defined(NDEBUG)
+    --m_currentNodeCount;
+#endif
+  }
+
+  Point_2 construct_barycenter_in_triangle_2(const Triangle_2& t, const Barycentric_coordinate& b) const
+  {
+    return construct_barycenter_in_triangle_2(t, b, m_traits);
+  }
+
+  static Point_2 construct_barycenter_in_triangle_2(const Triangle_2& t, const Barycentric_coordinate& b, const Traits& traits)
+  {
+    typename Traits::Construct_vertex_2 cv2(traits.construct_vertex_2_object());
+    typename Traits::Construct_barycentric_coordinate_weight cbcw(traits.construct_barycentric_coordinate_weight_object());
+    typename Traits::Construct_barycenter_2 cb2(traits.construct_barycenter_2_object());
+
+    return cb2(cv2(t, 0), cbcw(b, 0), cv2(t, 1), cbcw(b, 1), cv2(t, 2), cbcw(b, 2));
+  }
+
+  Point_3 construct_barycenter_in_triangle_3(const Triangle_3& t, const Barycentric_coordinate& b) const
+  {
+    return construct_barycenter_in_triangle_3(t, b, m_traits);
+  }
+
+  static Point_3 construct_barycenter_in_triangle_3(const Triangle_3& t, const Barycentric_coordinate& b, const Traits& traits)
+  {
+    typename Traits::Construct_vertex_3 cv3(traits.construct_vertex_3_object());
+    typename Traits::Construct_barycentric_coordinate_weight cbcw(traits.construct_barycentric_coordinate_weight_object());
+    typename Traits::Construct_barycenter_3 cb3(traits.construct_barycenter_3_object());
+
+    return cb3(cv3(t, 0), cbcw(b, 0), cv3(t, 1), cbcw(b, 1), cv3(t, 2), cbcw(b, 2));
+  }
+
+  Triangle_3 triangle_from_halfedge(halfedge_descriptor edge) const
+  {
+    return triangle_from_halfedge(edge, m_graph, m_vertexPointMap);
+  }
+
+  static Triangle_3 triangle_from_halfedge(halfedge_descriptor edge, const Triangle_mesh& tm)
+  {
+    return triangle_from_halfedge(edge, tm, get(vertex_point, tm));
+  }
+
+  static Triangle_3 triangle_from_halfedge(halfedge_descriptor edge, const Triangle_mesh& tm, Vertex_point_map vertexPointMap)
+  {
+    return CGAL::internal::triangle_from_halfedge<Triangle_3, Triangle_mesh, Vertex_point_map>(edge, tm, vertexPointMap);
+  }
+
+  Triangle_3 triangle_from_face(face_descriptor f) const
+  {
+    return triangle_from_face(f, m_graph, m_vertexPointMap);
+  }
+
+  static Triangle_3 triangle_from_face(face_descriptor f, const Triangle_mesh& tm)
+  {
+    return triangle_from_halfedge(halfedge(f, tm), tm, get(vertex_point, tm));
+  }
+
+  static Triangle_3 triangle_from_face(face_descriptor f, const Triangle_mesh& tm, Vertex_point_map vertexPointMap)
+  {
+    return triangle_from_halfedge(halfedge(f, tm), tm, vertexPointMap);
+  }
+
+  /*
+    Filtering algorithm described in Xin and Wang (2009) "Improving chen and han's algorithm on the discrete geodesic problem."
+    http://doi.acm.org/10.1145/1559755.1559761
+  */
+  bool window_distance_filter(Cone_tree_node* cone, Segment_2 windowSegment, bool reversed)
+  {
+    typename Traits::Construct_vertex_2 cv2(m_traits.construct_vertex_2_object());
+    typename Traits::Compute_squared_distance_2 csd2(m_traits.compute_squared_distance_2_object());
+
+    Segment_2 parentEntrySegment = cone->entry_segment();
+    Point_2 v2 = cone->target_point();
+    Point_2 I = cone->source_image();
+    FT d = cone->distance_from_source_to_root();
+    FT d1;
+    FT d2;
+    FT d3;
+    Point_2 A;
+    Point_2 B;
+    Point_2 v1;
+    Point_2 v3;
+
+    std::size_t v1Index = get(m_vertexIndexMap, source(cone->entry_edge(), m_graph));
+    std::size_t v2Index = get(m_vertexIndexMap, cone->target_vertex());
+    std::size_t v3Index = get(m_vertexIndexMap, target(cone->entry_edge(), m_graph));
+
+    Node_distance_pair v1Distance = m_closestToVertices[v1Index];
+    Node_distance_pair v2Distance = m_closestToVertices[v2Index];
+    Node_distance_pair v3Distance = m_closestToVertices[v3Index];
+
+    if (reversed)
+    {
+      std::swap(v1Distance, v3Distance);
+      std::swap(v1Index, v3Index);
+      A = cv2(windowSegment, 1);
+      B = cv2(windowSegment, 0);
+      v1 = cv2(parentEntrySegment, 1);
+      v3 = cv2(parentEntrySegment, 0);
+    }
+    else
+    {
+      A = cv2(windowSegment, 0);
+      B = cv2(windowSegment, 1);
+      v1 = cv2(parentEntrySegment, 0);
+      v3 = cv2(parentEntrySegment, 1);
+    }
+
+    d1 = v1Distance.second;
+    d2 = v2Distance.second;
+    d3 = v3Distance.second;
+
+    bool hasD1 = v1Distance.first != NULL && v1Distance.first != cone->parent();
+    bool hasD2 = v2Distance.first != NULL && v2Distance.first != cone->parent();
+    bool hasD3 = v3Distance.first != NULL && v3Distance.first != cone->parent();
+
+    if (hasD1 && (d + CGAL::internal::select_sqrt(csd2(I, B)) > d1 + CGAL::internal::select_sqrt(csd2(v1, B))))
+    {
+      if (m_debugOutput)
+      {
+        std::cout << "Filter: d + |I,B| > d1 + |v1,B|: " << std::endl;
+        std::cout << "v1 = " << v1Index << " , " << d1 << " , v2 = " << v2Index << " , " << d2 << " , v3 = " << v3Index << " , " << d3 << std::endl;
+        std::cout << "d = " << d << std::endl;
+        std::cout << "v1,B = " << CGAL::internal::select_sqrt(csd2(v1, B)) << std::endl;
+        std::cout << "I,B = " << CGAL::internal::select_sqrt(csd2(I, B)) << std::endl;
+        std::cout << "I,A = " << CGAL::internal::select_sqrt(csd2(I, A)) << std::endl;
+        std::cout << (d + CGAL::internal::select_sqrt(csd2(I, B))) << " vs. " << (d1 + CGAL::internal::select_sqrt(csd2(v1, B))) << std::endl;
+      }
+
+      return false;
+    }
+
+    if (hasD2 && (d + CGAL::internal::select_sqrt(csd2(I, A)) > d2 + CGAL::internal::select_sqrt(csd2(v2, A))))
+    {
+      if (m_debugOutput)
+      {
+        std::cout << "Filter: d + |I,A| > d2 + |v2,A|: " << std::endl;
+        std::cout << "v1 = " << v1Index << " , " << d1 << " , v2 = " << v2Index << " , " << d2 << " , v3 = " << v3Index << " , " << d3 << std::endl;
+        std::cout << "d = " << d << std::endl;
+        std::cout << "v2,A = " << CGAL::internal::select_sqrt(csd2(v2, A)) << std::endl;
+        std::cout << "I,A = " << CGAL::internal::select_sqrt(csd2(I, A)) << std::endl;
+        std::cout << (d + CGAL::internal::select_sqrt(csd2(I, A))) << " vs. " << (d2 + CGAL::internal::select_sqrt(csd2(v2, A))) << std::endl;
+      }
+
+      return false;
+    }
+
+    if (hasD3 && (d + CGAL::internal::select_sqrt(csd2(I, A)) > d3 + CGAL::internal::select_sqrt(csd2(v3, A))))
+    {
+      if (m_debugOutput)
+      {
+        std::cout << "Filter: d + |I,A| > d3 + |v3,A|: " << std::endl;
+        std::cout << "v1 = " << v1Index << " , " << d1 << " , v2 = " << v2Index << " , " << d2 << " , v3 = " << v3Index << " , " << d3 << std::endl;
+        std::cout << "d = " << d << std::endl;
+        std::cout << "v3,A = " << CGAL::internal::select_sqrt(csd2(v3, A)) << std::endl;
+        std::cout << "I,A = " << CGAL::internal::select_sqrt(csd2(I, A)) << std::endl;
+        std::cout << (d + CGAL::internal::select_sqrt(csd2(I, A))) << " vs. " << (d3 + CGAL::internal::select_sqrt(csd2(v3, A))) << std::endl;
+      }
+
+      return false;
+    }
+
+    return true;
+  }
+
+  /*
+    Push a new node representing crossing the edge to the left of `cone`'s target vertex
+  */
+  void expand_left_child(Cone_tree_node* cone, Segment_2 windowSegment)
+  {
+    typename Traits::Construct_vertex_2 cv2(m_traits.construct_vertex_2_object());
+    typename Traits::Construct_triangle_3_along_segment_2_flattening ft3as2(m_traits.construct_triangle_3_along_segment_2_flattening_object());
+
+    CGAL_assertion(cone->m_pendingLeftSubtree != NULL);
+
+    cone->m_pendingLeftSubtree = NULL;
+
+    if (window_distance_filter(cone, windowSegment, false))
+    {
+      Triangle_3 adjacentFace = triangle_from_halfedge(cone->left_child_edge());
+      Triangle_2 layoutFace = ft3as2(adjacentFace, 0, cone->left_child_base_segment());
+      Cone_tree_node* child = new Cone_tree_node(m_traits, m_graph, cone->left_child_edge(), layoutFace, cone->source_image(), cone->distance_from_source_to_root(), cv2(windowSegment, 0), cv2(windowSegment, 1), Cone_tree_node::INTERVAL);
+      node_created();
+      cone->set_left_child(child);
+      process_node(child);
+    }
+    else if (m_debugOutput)
+    {
+      std::cout << "\tNode was filtered." << std::endl;
+    }
+  }
+
+  /*
+    Push a new node representing crossing the edge to the right of `cone`'s target vertex
+  */
+  void expand_right_child(Cone_tree_node* cone, Segment_2 windowSegment)
+  {
+    typename Traits::Construct_vertex_2 cv2(m_traits.construct_vertex_2_object());
+    typename Traits::Construct_triangle_3_along_segment_2_flattening ft3as2(m_traits.construct_triangle_3_along_segment_2_flattening_object());
+
+    CGAL_assertion(cone->m_pendingRightSubtree != NULL);
+
+    cone->m_pendingRightSubtree = NULL;
+
+    if (window_distance_filter(cone, windowSegment, true))
+    {
+      Triangle_3 adjacentFace = triangle_from_halfedge(cone->right_child_edge());
+      Triangle_2 layoutFace = ft3as2(adjacentFace, 0, cone->right_child_base_segment());
+      Cone_tree_node* child = new Cone_tree_node(m_traits, m_graph, cone->right_child_edge(), layoutFace, cone->source_image(), cone->distance_from_source_to_root(), cv2(windowSegment, 0), cv2(windowSegment, 1), Cone_tree_node::INTERVAL);
+      node_created();
+      cone->set_right_child(child);
+      process_node(child);
+    }
+    else if (m_debugOutput)
+    {
+      std::cout << "\tNode was filtered." << std::endl;
+    }
+  }
+
+  /*
+    Determines whether to expand `location` as a face, edge, or vertex root, depending on
+    whether it is near to a given edge or vertex, or is an internal face location
+  */
+  void expand_root(face_descriptor f, Barycentric_coordinate location, Source_point_iterator sourcePointIt)
+  {
+    typename Traits::Construct_barycentric_coordinate_weight cbcw(m_traits.construct_barycentric_coordinate_weight_object());
+    typename Traits::Classify_barycentric_coordinate classify_barycentric_coordinate(m_traits.classify_barycentric_coordinate_object());
+
+    std::size_t associatedEdge;
+    CGAL::Surface_mesh_shortest_paths_3::Barycentric_coordinate_type type;
+    boost::tie(type, associatedEdge) = classify_barycentric_coordinate(location);
+
+    switch (type)
+    {
+      case CGAL::Surface_mesh_shortest_paths_3::BARYCENTRIC_COORDINATE_ON_BOUNDED_SIDE:
+        expand_face_root(f, location, sourcePointIt);
+        break;
+      case CGAL::Surface_mesh_shortest_paths_3::BARYCENTRIC_COORDINATE_ON_BOUNDARY:
+        {
+          halfedge_descriptor he = halfedge(f, m_graph);
+          for (std::size_t i = 0; i < associatedEdge; ++i)
+          {
+            he = next(he, m_graph);
+          }
+          expand_edge_root(he, cbcw(location, associatedEdge), cbcw(location, (associatedEdge + 1) % 3), sourcePointIt);
+        }
+        break;
+      case CGAL::Surface_mesh_shortest_paths_3::BARYCENTRIC_COORDINATE_ON_VERTEX:
+        {
+          halfedge_descriptor he = halfedge(f, m_graph);
+          for (std::size_t i = 0; i < associatedEdge; ++i)
+          {
+            he = next(he, m_graph);
+          }
+          expand_vertex_root(source(he, m_graph), sourcePointIt);
+        }
+        break;
+      default:
+        CGAL_assertion(false && "Invalid face location");
+        // Perhaps hit an assertion that the type must not be external or invalid?
+    }
+  }
+
+  /*
+    Create source nodes facing each edge of `f`, rooted at the given `faceLocation`
+  */
+  void expand_face_root(face_descriptor f, Barycentric_coordinate faceLocation, Source_point_iterator sourcePointIt)
+  {
+    typename Traits::Construct_triangle_3_to_triangle_2_projection pt3t2(m_traits.construct_triangle_3_to_triangle_2_projection_object());
+    typename Traits::Construct_vertex_2 cv2(m_traits.construct_vertex_2_object());
+
+    halfedge_descriptor start = halfedge(f, m_graph);
+    halfedge_descriptor current = start;
+
+    Cone_tree_node* faceRoot = new Cone_tree_node(m_traits, m_graph, m_rootNodes.size());
+    node_created();
+    m_rootNodes.push_back(std::make_pair(faceRoot, sourcePointIt));
+
+    if (m_debugOutput)
+    {
+      typename Traits::Construct_barycentric_coordinate_weight cbcw(m_traits.construct_barycentric_coordinate_weight_object());
+      std::cout << "\tFace Root Expansion: id = " << get(m_faceIndexMap, f) << " , Location = " << cbcw(faceLocation, 0) << " " << cbcw(faceLocation, 1) << " " << cbcw(faceLocation, 2) << " " << std::endl;
+    }
+
+    for (std::size_t currentVertex = 0; currentVertex < 3; ++currentVertex)
+    {
+      Triangle_3 face3d(triangle_from_halfedge(current));
+      Triangle_2 layoutFace(pt3t2(face3d));
+      Barycentric_coordinate rotatedFaceLocation(shifted_coordiate(faceLocation, currentVertex));
+      Point_2 sourcePoint(construct_barycenter_in_triangle_2(layoutFace, rotatedFaceLocation));
+
+      Cone_tree_node* child = new Cone_tree_node(m_traits, m_graph, current, layoutFace, sourcePoint, FT(0.0), cv2(layoutFace, 0), cv2(layoutFace, 2), Cone_tree_node::FACE_SOURCE);
+      node_created();
+      faceRoot->push_middle_child(child);
+
+      if (m_debugOutput)
+      {
+        std::cout << "\tExpanding face root #" << currentVertex << " : " << std::endl;;
+        std::cout << "\t\tFace = " << layoutFace << std::endl;
+        std::cout << "\t\tLocation = " << sourcePoint << std::endl;
+      }
+
+      process_node(child);
+
+      current = next(current, m_graph);
+    }
+  }
+
+  /*
+    Create 'source' nodes to each size of the given edge, rooted at the specified parametric location
+  */
+  void expand_edge_root(halfedge_descriptor baseEdge, FT t0, FT t1, Source_point_iterator sourcePointIt)
+  {
+    typename Traits::Construct_barycenter_2 cb2(m_traits.construct_barycenter_2_object());
+    typename Traits::Construct_vertex_2 cv2(m_traits.construct_vertex_2_object());
+    typename Traits::Construct_triangle_3_to_triangle_2_projection pt3t2(m_traits.construct_triangle_3_to_triangle_2_projection_object());
+
+    if (m_debugOutput)
+    {
+      std::cout << "\tEdge Root Expansion: faceA = " << get(m_faceIndexMap, face(baseEdge, m_graph)) << " , faceB = " << get(m_faceIndexMap, face(opposite(baseEdge, m_graph), m_graph)) << " , t0 = " << t0 << " , t1 = " << t1 << std::endl;
+    }
+
+    halfedge_descriptor baseEdges[2];
+    baseEdges[0] = baseEdge;
+    baseEdges[1] = opposite(baseEdge, m_graph);
+
+    Triangle_3 faces3d[2];
+    Triangle_2 layoutFaces[2];
+
+    for (std::size_t i = 0; i < 2; ++i)
+    {
+       faces3d[i] = triangle_from_halfedge(baseEdges[i]);
+       layoutFaces[i] = pt3t2(faces3d[i]);
+    }
+
+    Point_2 sourcePoints[2];
+    sourcePoints[0] = cb2(cv2(layoutFaces[0], 0), t0, cv2(layoutFaces[0], 1), t1);
+    sourcePoints[1] = cb2(cv2(layoutFaces[1], 0), t1, cv2(layoutFaces[1], 1), t0);
+
+    Cone_tree_node* edgeRoot = new Cone_tree_node(m_traits, m_graph, m_rootNodes.size());
+    node_created();
+    m_rootNodes.push_back(std::make_pair(edgeRoot, sourcePointIt));
+
+    for (std::size_t side = 0; side < 2; ++side)
+    {
+      if (m_debugOutput)
+      {
+        std::cout << "\tExpanding edge root #" << side << " : " << std::endl;;
+        std::cout << "\t\tFace = " << layoutFaces[side] << std::endl;
+        std::cout << "\t\tLocation = " << sourcePoints[side] << std::endl;
+      }
+
+      Cone_tree_node* mainChild = new Cone_tree_node(m_traits, m_graph, baseEdges[side], layoutFaces[side], sourcePoints[side], FT(0.0), cv2(layoutFaces[side], 0), cv2(layoutFaces[side], 1), Cone_tree_node::EDGE_SOURCE);
+      node_created();
+      edgeRoot->push_middle_child(mainChild);
+      process_node(mainChild);
+    }
+  }
+
+  /*
+    Create a 'source' node for each face surrounding the given vertex.
+  */
+  void expand_vertex_root(vertex_descriptor vertex, Source_point_iterator sourcePointIt)
+  {
+    if (m_debugOutput)
+    {
+      std::cout << "\tVertex Root Expansion: Vertex = " << get(m_vertexIndexMap, vertex) << std::endl;
+    }
+
+    Cone_tree_node* vertexRoot = new Cone_tree_node(m_traits, m_graph, m_rootNodes.size(), prev(halfedge(vertex, m_graph), m_graph));
+
+    node_created();
+    m_rootNodes.push_back(std::make_pair(vertexRoot, sourcePointIt));
+
+    m_closestToVertices[get(m_vertexIndexMap, vertex)] = Node_distance_pair(vertexRoot, FT(0.0));
+
+    expand_pseudo_source(vertexRoot);
+  }
+
+  /*
+    Create child nodes for each face surrounding the vertex occupied by `parent`, and push them to the queue
+  */
+  void expand_pseudo_source(Cone_tree_node* parent)
+  {
+    typename Traits::Construct_triangle_3_to_triangle_2_projection pt3t2(m_traits.construct_triangle_3_to_triangle_2_projection_object());
+    typename Traits::Construct_vertex_2 cv2(m_traits.construct_vertex_2_object());
+
+    parent->m_pendingMiddleSubtree = NULL;
+
+    vertex_descriptor expansionVertex = parent->target_vertex();
+
+    halfedge_descriptor startEdge = halfedge(expansionVertex, m_graph);
+    halfedge_descriptor currentEdge = halfedge(expansionVertex, m_graph);
+
+    FT distanceFromTargetToRoot = parent->distance_from_target_to_root();
+
+    if (m_debugOutput)
+    {
+      std::cout << "Distance from target to root: " << distanceFromTargetToRoot << std::endl;
+    }
+
+    // A potential optimization could be made by only expanding in the 'necessary' range (i.e. the range outside of geodesic visibility), but the
+    // benefits may be small, since the node filter would prevent more than one-level propagation.
+    // It would also be neccessary to distinguish expanding a root vertex node from a pseudo-source node
+
+    do
+    {
+      Triangle_3 face3d(triangle_from_halfedge(currentEdge));
+      Triangle_2 layoutFace(pt3t2(face3d));
+
+      if (m_debugOutput)
+      {
+        std::cout << "Expanding PsuedoSource: id = ";
+        if (face(currentEdge, m_graph) != Graph_traits::null_face())
+        {
+          std::cout << get(m_faceIndexMap, face(currentEdge, m_graph));
+        }
+        else
+        {
+          std::cout << "EXTERNAL";
+        }
+        std::cout << std::endl;
+      }
+
+      Cone_tree_node* child = new Cone_tree_node(m_traits, m_graph, currentEdge, layoutFace, cv2(layoutFace, 1), distanceFromTargetToRoot, cv2(layoutFace, 0), cv2(layoutFace, 2), Cone_tree_node::VERTEX_SOURCE);
+
+      node_created();
+      parent->push_middle_child(child);
+      process_node(child);
+
+      currentEdge = opposite(next(currentEdge, m_graph), m_graph);
+    }
+    while (currentEdge != startEdge);
+
+  }
+
+  /*
+    Returns the intersection of `segment` and the cone defined by the region to the left `leftBoundary` and right of `rightBoundary`
+  */
+  bool clip_to_bounds(const Segment_2& segment, const Ray_2& leftBoundary, const Ray_2& rightBoundary, Segment_2& outSegment)
+  {
+    typename Traits::Construct_source_2 cs2(m_traits.construct_source_2_object());
+    typename Traits::Construct_segment_2 cseg2(m_traits.construct_segment_2_object());
+    typename Traits::Construct_target_2 ct2(m_traits.construct_target_2_object());
+    typename Traits::Construct_line_2 cl2(m_traits.construct_line_2_object());
+    typename Traits::Intersect_2 i2(m_traits.intersect_2_object());
+    typename Traits::Orientation_2 o2(m_traits.orientation_2_object());
+    typename Traits::Construct_point_on_2 cpo2(m_traits.construct_point_on_2_object());
+    typename Traits::Compute_parametric_distance_along_segment_2 pdas2(m_traits.compute_parametric_distance_along_segment_2_object());
+
+    typedef typename cpp11::result_of<typename Traits::Intersect_2(Line_2, Line_2)>::type LineLineIntersectResult;
+
+    Point_2 leftPoint;
+    Point_2 rightPoint;
+
+    if (m_debugOutput)
+    {
+      std::cout << "Clipping Segment " << segment << " with left = " << leftBoundary << " and right = " << rightBoundary << std::endl;
+    }
+
+    FT leftT;
+    FT rightT;
+
+    CGAL::Orientation leftOrientation = o2(cs2(leftBoundary), cpo2(leftBoundary, 1), cs2(segment));
+
+    if (leftOrientation == CGAL::RIGHT_TURN || leftOrientation == CGAL::COLLINEAR)
+    {
+      if (m_debugOutput)
+      {
+        std::cout << "\tLeft is completely covered." << std::endl;
+      }
+      leftPoint = cs2(segment);
+      leftT = FT(0.0);
+    }
+    else
+    {
+      LineLineIntersectResult cgalIntersection = i2(cl2(segment), cl2(leftBoundary));
+
+      if (!cgalIntersection || !boost::get<Point_2>(&*cgalIntersection))
+      {
+        if (m_debugOutput)
+        {
+          std::cout << "Dropping left due to co-linearity of boundary. " << bool(cgalIntersection) << std::endl;
+        }
+        return false;
+      }
+      else
+      {
+        Point_2* result = boost::get<Point_2>(&*cgalIntersection);
+        FT t0 = pdas2(cs2(segment), ct2(segment), *result);
+
+        if (t0 >= FT(1.00000))
+        {
+          if (m_debugOutput)
+          {
+            std::cout << "Dropping due to missing left intersect. " << t0 << std::endl;
+          }
+
+          return false;
+        }
+        else if (t0 <= FT(0.00000))
+        {
+          if (m_debugOutput)
+          {
+            std::cout << "\tLeft is completely covered (secondary check). " << t0 << std::endl;
+          }
+
+          leftPoint = cs2(segment);
+          leftT = FT(0.0);
+        }
+        else
+        {
+          if (m_debugOutput)
+          {
+            std::cout << "\tLeft intersects at t = " << t0 << std::endl;
+          }
+
+          leftPoint = *result;
+          leftT = t0;
+        }
+      }
+    }
+
+    CGAL::Orientation rightOrientation = o2(cs2(rightBoundary), cpo2(rightBoundary, 1), ct2(segment));
+
+    if (rightOrientation == CGAL::LEFT_TURN || rightOrientation == CGAL::COLLINEAR)
+    {
+      if (m_debugOutput)
+      {
+        std::cout << "Right is completely covered." << std::endl;
+      }
+      rightPoint = ct2(segment);
+      rightT = FT(1.0);
+    }
+    else
+    {
+      LineLineIntersectResult cgalIntersection = i2(cl2(segment), cl2(rightBoundary));
+
+      if (!cgalIntersection || !boost::get<Point_2>(&*cgalIntersection))
+      {
+        if (m_debugOutput)
+        {
+          std::cout << "Dropping due to co-linearity of right boundary." << std::endl;
+        }
+        return false;
+      }
+      else
+      {
+        Point_2* result = boost::get<Point_2>(&*cgalIntersection);
+        FT t0 = pdas2(cs2(segment), ct2(segment), *result);
+
+        if (t0 <= FT(0.00000))
+        {
+          if (m_debugOutput)
+          {
+            std::cout << "Dropping due to missing right intersect. " << t0 << std::endl;
+          }
+          return false;
+        }
+        else if (t0 >= FT(1.00000))
+        {
+          if (m_debugOutput)
+          {
+            std::cout << "\tRight is completely covered (secondary check). " << t0 << std::endl;
+          }
+          rightPoint = ct2(segment);
+          rightT = FT(1.0);
+        }
+        else
+        {
+          if (m_debugOutput)
+          {
+            std::cout << "\tRight intersects at t = " << t0 << std::endl;
+          }
+          rightPoint = *result;
+          rightT = t0;
+        }
+      }
+    }
+
+    if (leftT >= rightT)
+    {
+      if (m_debugOutput)
+      {
+        std::cout << "Dropping due to overlap. " << leftT << " : " << rightT << std::endl;
+      }
+      return false;
+    }
+
+    outSegment = cseg2(leftPoint, rightPoint);
+
+    return true;
+  }
+
+  /*
+    Take a node and compute whether it is an occupier/evicts older nodes, then push any children it may have.
+  */
+  void process_node(Cone_tree_node* node)
+  {
+    typename Traits::Compare_relative_intersection_along_segment_2 crias2(m_traits.compare_relative_intersection_along_segment_2_object());
+
+    bool leftSide = false;
+    bool rightSide = false;
+
+    if (!node->is_source_node())
+    {
+      leftSide = node->has_left_side();
+      rightSide = node->has_right_side();
+    }
+    else if (node->node_type() == Cone_tree_node::EDGE_SOURCE) 
+    {
+      leftSide = true;
+      rightSide = true;
+    }
+    else
+    {
+      leftSide = true;
+      rightSide = false;
+    }
+
+    bool propagateLeft = false;
+    bool propagateRight = false;
+    bool propagateMiddle = false;
+
+    if (m_debugOutput)
+    {
+      std::cout << " Processing node " << node << " , level = " << node->level() << std::endl;
+      std::cout << "\tFace = " << node->layout_face() << std::endl;
+      std::cout << "\tVertices = ";
+      halfedge_descriptor current = node->entry_edge();
+      for (std::size_t i = 0; i < 3; ++i)
+      {
+        std::cout << get(m_vertexIndexMap, source(current, m_graph)) << " ";
+        current = next(current, m_graph);
+      }
+      std::cout << std::endl;
+      std::cout << "\tSource Image = " << node->source_image() << std::endl;
+      std::cout << "\tWindow Left = " << node->window_left() << std::endl;
+      std::cout << "\tWindow Right = " << node->window_right() << std::endl;
+      std::cout << "\t Has Left : " << (leftSide ? "yes" : "no") << " , Has Right : " << (rightSide ? "yes" : "no") << std::endl;
+    }
+
+    if (node->is_source_node() || (leftSide && rightSide))
+    {
+      if (m_debugOutput)
+      {
+        std::cout << "\tContains target vertex" << std::endl;
+      }
+
+      std::size_t entryEdgeIndex = get(m_halfedgeIndexMap, node->entry_edge());
+
+      Node_distance_pair currentOccupier = m_vertexOccupiers[entryEdgeIndex];
+      FT currentNodeDistance = node->distance_from_target_to_root();
+
+      bool isLeftOfCurrent = false;
+
+      if (m_debugOutput)
+      {
+        std::cout << "\t Entry Edge = " << entryEdgeIndex << std::endl;
+        std::cout << "\t Target vertex = " << get(m_vertexIndexMap, node->target_vertex()) << std::endl;
+      }
+
+      if (currentOccupier.first != NULL)
+      {
+        if (node->is_vertex_node())
+        {
+          isLeftOfCurrent = false;
+        }
+        else if (currentOccupier.first->is_vertex_node())
+        {
+          isLeftOfCurrent = true;
+        }
+        else
+        {
+          CGAL::Comparison_result comparison = crias2(
+            node->entry_segment(),
+            node->ray_to_target_vertex().supporting_line(),
+            currentOccupier.first->entry_segment(),
+            currentOccupier.first->ray_to_target_vertex().supporting_line()
+          );
+
+          if (comparison == CGAL::SMALLER)
+          {
+            isLeftOfCurrent = true;
+          }
+        }
+
+        if (m_debugOutput)
+        {
+          std::cout << "\t Current occupier = " << currentOccupier.first << std::endl;
+          std::cout << "\t Current Occupier Distance = " << currentOccupier.second << std::endl;
+          std::cout << "\t " << (isLeftOfCurrent ? "Left" : "Right") << " of current" << std::endl;
+        }
+      }
+
+      if (m_debugOutput)
+      {
+        std::cout << "\t New Distance = " << currentNodeDistance << std::endl;
+      }
+
+      if (currentOccupier.first == NULL || currentOccupier.second > currentNodeDistance)
+      {
+        if (m_debugOutput)
+        {
+          std::cout << "\t Current node is now the occupier" << std::endl;
+        }
+
+        m_vertexOccupiers[entryEdgeIndex] = std::make_pair(node, currentNodeDistance);
+
+        propagateLeft = true;
+        propagateRight = true;
+
+        // This is a consequence of using the same basic node type for source and interval nodes
+        // If this is a source node, it is only pointing to one of the two opposite edges (the left one by convention)
+        if (node->node_type() != Cone_tree_node::INTERVAL && node->node_type() != Cone_tree_node::EDGE_SOURCE)
+        {
+          propagateRight = false;
+
+          // Propagating a pseudo-source on a boundary vertex can result in a cone on a null face
+          // In such a case, we only care about the part of the cone pointing at the vertex (i.e. the middle child),
+          // so we can avoid propagating over the (non-existant) left opposite edge
+          if (node->is_null_face())
+          {
+            propagateLeft = false;
+          }
+        }
+
+        if (currentOccupier.first != NULL)
+        {
+          if (isLeftOfCurrent)
+          {
+            if (currentOccupier.first->get_left_child())
+            {
+              delete_node(currentOccupier.first->remove_left_child());
+            }
+            else if (currentOccupier.first->m_pendingLeftSubtree != NULL)
+            {
+              currentOccupier.first->m_pendingLeftSubtree->m_cancelled = true;
+              currentOccupier.first->m_pendingLeftSubtree = NULL;
+            }
+          }
+          else
+          {
+            if (currentOccupier.first->get_right_child())
+            {
+              delete_node(currentOccupier.first->remove_right_child());
+            }
+            else if (currentOccupier.first->m_pendingRightSubtree != NULL)
+            {
+              currentOccupier.first->m_pendingRightSubtree->m_cancelled = true;
+              currentOccupier.first->m_pendingRightSubtree = NULL;
+            }
+          }
+        }
+
+        std::size_t targetVertexIndex = get(m_vertexIndexMap, node->target_vertex());
+
+        // Check if this is now the absolute closest node, and replace the current closest as appropriate
+        Node_distance_pair currentClosest = m_closestToVertices[targetVertexIndex];
+
+        if (m_debugOutput && currentClosest.first != NULL)
+        {
+          std::cout << "\t Current Closest Distance = " << currentClosest.second << std::endl;
+        }
+
+        if (currentClosest.first == NULL || currentClosest.second > currentNodeDistance)
+        {
+          if (m_debugOutput)
+          {
+            std::cout << "\t Current node is now the closest" << std::endl;
+          }
+
+          // if this is a saddle vertex, then evict previous closest vertex
+          if (m_vertexIsPseudoSource[targetVertexIndex])
+          {
+            if (currentClosest.first != NULL)
+            {
+              if (m_debugOutput)
+              {
+                std::cout << "\tEvicting old pseudo-source: " << currentClosest.first << std::endl;
+              }
+
+              if (currentClosest.first->m_pendingMiddleSubtree != NULL)
+              {
+                currentClosest.first->m_pendingMiddleSubtree->m_cancelled = true;
+                currentClosest.first->m_pendingMiddleSubtree = NULL;
+              }
+
+              while (currentClosest.first->has_middle_children())
+              {
+                delete_node(currentClosest.first->pop_middle_child());
+              }
+
+              if (m_debugOutput)
+              {
+                std::cout << "\tFinished Evicting" << std::endl;
+              }
+            }
+
+            propagateMiddle = true;
+          }
+
+          m_closestToVertices[targetVertexIndex] = Node_distance_pair(node, currentNodeDistance);
+        }
+      }
+      else
+      {
+        if (isLeftOfCurrent)
+        {
+          propagateLeft = true;
+        }
+        else if (!node->is_source_node())
+        {
+          propagateRight = true;
+        }
+      }
+    }
+    else
+    {
+      propagateLeft = leftSide;
+      propagateRight = rightSide;
+    }
+
+    if (node->level() <= num_faces(m_graph))
+    {
+      if (propagateLeft)
+      {
+        push_left_child(node);
+      }
+
+      if (propagateRight && (!node->is_source_node() || node->node_type() == Cone_tree_node::EDGE_SOURCE))
+      {
+        push_right_child(node);
+      }
+
+      if (propagateMiddle)
+      {
+        push_middle_child(node);
+      }
+    }
+    else if (m_debugOutput)
+    {
+      std::cout << "\tNo expansion since level limit reached" << std::endl;
+    }
+
+  }
+
+  void push_left_child(Cone_tree_node* parent)
+  {
+    typename Traits::Compute_squared_distance_2 csd2(m_traits.compute_squared_distance_2_object());
+
+    if (face(parent->left_child_edge(), m_graph) != Graph_traits::null_face())
+    {
+      Segment_2 leftWindow;
+
+      if (parent->is_source_node())
+      {
+        leftWindow = parent->left_child_base_segment();
+      }
+      else
+      {
+        bool result = clip_to_bounds(parent->left_child_base_segment(), parent->left_boundary(), parent->right_boundary(), leftWindow);
+        if (!result)
+        {
+          if (m_debugOutput)
+          {
+            std::cout << "Left child clip failed, killing node." << std::endl;
+          }
+          return;
+        }
+      }
+
+      FT distanceEstimate = parent->distance_from_source_to_root() + CGAL::internal::select_sqrt(csd2(parent->source_image(), leftWindow));
+
+      if (m_debugOutput)
+      {
+        std::cout << "\tPushing Left Child, Segment = " << parent->left_child_base_segment() << " , clipped = " << leftWindow << " , Estimate = " << distanceEstimate << std::endl;
+      }
+
+      Cone_expansion_event* event = new Cone_expansion_event(parent, distanceEstimate, Cone_expansion_event::LEFT_CHILD, leftWindow);
+      parent->m_pendingLeftSubtree = event;
+
+      m_expansionPriqueue.push(event);
+
+      queue_pushed();
+    }
+  }
+
+  void push_right_child(Cone_tree_node* parent)
+  {
+    typename Traits::Compute_squared_distance_2 csd2(m_traits.compute_squared_distance_2_object());
+
+    if (face(parent->right_child_edge(), m_graph) != Graph_traits::null_face())
+    {
+      Segment_2 rightWindow;
+      bool result = clip_to_bounds(parent->right_child_base_segment(), parent->left_boundary(), parent->right_boundary(), rightWindow);
+
+      if (!result)
+      {
+        if (m_debugOutput)
+        {
+          std::cout << "Right child clip failed, killing node." << std::endl;
+        }
+        return;
+      }
+
+      FT distanceEstimate = parent->distance_from_source_to_root() + CGAL::internal::select_sqrt(csd2(parent->source_image(), rightWindow));
+
+      if (m_debugOutput)
+      {
+        std::cout << "\tPushing Right Child, Segment = " << parent->right_child_base_segment() << " , clipped = " << rightWindow << " , Estimate = " << distanceEstimate << std::endl;
+      }
+
+      Cone_expansion_event* event = new Cone_expansion_event(parent, distanceEstimate, Cone_expansion_event::RIGHT_CHILD, rightWindow);
+      queue_pushed();
+      parent->m_pendingRightSubtree = event;
+
+      m_expansionPriqueue.push(event);
+    }
+  }
+
+  void push_middle_child(Cone_tree_node* parent)
+  {
+    if (m_debugOutput)
+    {
+      std::cout << "\tPushing Middle Child, Estimate = " << parent->distance_from_target_to_root() << std::endl;
+    }
+
+    Cone_expansion_event* event = new Cone_expansion_event(parent, parent->distance_from_target_to_root(), Cone_expansion_event::PSEUDO_SOURCE);
+
+    queue_pushed();
+
+    parent->m_pendingMiddleSubtree = event;
+
+    m_expansionPriqueue.push(event);
+  }
+
+  void delete_node(Cone_tree_node* node, bool destruction = false)
+  {
+    if (node != NULL)
+    {
+      if (m_debugOutput)
+      {
+        std::cout << "Deleting node " << node << std::endl;
+      }
+
+      if (node->m_pendingLeftSubtree != NULL)
+      {
+        node->m_pendingLeftSubtree->m_cancelled = true;
+        node->m_pendingLeftSubtree = NULL;
+      }
+
+      if (node->get_left_child() != NULL)
+      {
+        if (m_debugOutput)
+        {
+          std::cout << "\t"  << node << " Descending left." << std::endl;
+        }
+
+        delete_node(node->remove_left_child(), destruction);
+      }
+
+      if (node->m_pendingRightSubtree != NULL)
+      {
+        node->m_pendingRightSubtree->m_cancelled = true;
+        node->m_pendingRightSubtree = NULL;
+      }
+
+      if (node->get_right_child() != NULL)
+      {
+        if (m_debugOutput)
+        {
+          std::cout << "\t"  << node << " Descending right." << std::endl;
+        }
+
+        delete_node(node->remove_right_child(), destruction);
+      }
+
+      if (node->m_pendingMiddleSubtree != NULL)
+      {
+        node->m_pendingMiddleSubtree->m_cancelled = true;
+        node->m_pendingMiddleSubtree = NULL;
+      }
+
+      if (node->has_middle_children() && m_debugOutput)
+      {
+        std::cout << "\t"  << node << " Descending middle." << std::endl;
+      }
+
+      while (node->has_middle_children())
+      {
+        delete_node(node->pop_middle_child(), destruction);
+      }
+
+      // At the point of destruction, the `Triangle_mesh` referenced may have gone out of scope, we wish to distinguish between deletion with an assumed reference
+      // to the original `Triangle_mesh`, and deletion without
+      if (!node->is_root_node() && !destruction)
+      {
+        std::size_t entryEdgeIndex = get(m_halfedgeIndexMap, node->entry_edge());
+
+        if (m_vertexOccupiers[entryEdgeIndex].first == node)
+        {
+          m_vertexOccupiers[entryEdgeIndex].first = NULL;
+
+          std::size_t targetVertexIndex = get(m_vertexIndexMap, node->target_vertex());
+
+          if (m_closestToVertices[targetVertexIndex].first == node)
+          {
+            m_closestToVertices[targetVertexIndex].first = NULL;
+          }
+        }
+      }
+
+      delete node;
+    }
+
+    node_deleted();
+  }
+
+  void set_vertex_types()
+  {
+    vertex_iterator current, end;
+
+    for (boost::tie(current, end) = vertices(m_graph); current != end; ++current)
+    {
+      std::size_t vertexIndex = get(m_vertexIndexMap, *current);
+
+      if (is_saddle_vertex(*current) || is_boundary_vertex(*current))
+      {
+        m_vertexIsPseudoSource[vertexIndex] = true;
+      }
+      else
+      {
+        m_vertexIsPseudoSource[vertexIndex] = false;
+      }
+    }
+  }
+
+  bool is_saddle_vertex(vertex_descriptor v)
+  {
+    return m_traits.is_saddle_vertex_object()(v, m_graph, m_vertexPointMap);
+  }
+
+  bool is_boundary_vertex(vertex_descriptor v)
+  {
+    halfedge_descriptor h = halfedge(v, m_graph);
+    halfedge_descriptor first = h;
+
+    do
+    {
+      if (face(h, m_graph) == Graph_traits::null_face() || face(opposite(h, m_graph), m_graph) == Graph_traits::null_face())
+      {
+        return true;
+      }
+
+      h = opposite(next(h, m_graph), m_graph);
+    }
+    while(h != first);
+
+    return false;
+  }
+
+  void delete_all_nodes()
+  {
+    for (std::size_t i = 0; i < m_rootNodes.size(); ++i)
+    {
+      delete_node(m_rootNodes[i].first, true);
+    }
+  }
+
+  void reset_algorithm(bool clearFaceLocations = true)
+  {
+    Cone_tree_node* null_value=NULL;
+    m_closestToVertices.resize(num_vertices(m_graph));
+    std::fill(m_closestToVertices.begin(), m_closestToVertices.end(), Node_distance_pair(null_value, FT(0.0)));
+    m_vertexOccupiers.resize(num_halfedges(m_graph));
+    std::fill(m_vertexOccupiers.begin(), m_vertexOccupiers.end(), Node_distance_pair(null_value, FT(0.0)));
+
+    while (!m_expansionPriqueue.empty())
+    {
+      delete m_expansionPriqueue.top();
+      m_expansionPriqueue.pop();
+    }
+
+    if (clearFaceLocations)
+    {
+      m_faceLocations.clear();
+      m_firstNewSourcePoint = m_faceLocations.end();
+      m_deletedSourceLocations.clear();
+    }
+
+    delete_all_nodes();
+    m_rootNodes.clear();
+    m_vertexIsPseudoSource.resize(num_vertices(m_graph));
+
+#if !defined(NDEBUG)
+    m_currentNodeCount = 0;
+    m_peakNodeCount = 0;
+    m_queueAtPeakNodes = 0;
+    m_peakQueueSize = 0;
+    m_nodesAtPeakQueue = 0;
+#endif
+
+  }
+
+  template <class Visitor>
+  void visit_shortest_path(Cone_tree_node* startNode, const Point_2& startLocation, Visitor& visitor)
+  {
+    typename Traits::Compute_parametric_distance_along_segment_2 parametric_distance_along_segment_2(m_traits.compute_parametric_distance_along_segment_2_object());
+    typename Traits::Construct_ray_2 construct_ray_2(m_traits.construct_ray_2_object());
+    typename Traits::Construct_line_2 construct_line_2(m_traits.construct_line_2_object());
+    typename Traits::Construct_source_2 construct_source_2(m_traits.construct_source_2_object());
+    typename Traits::Construct_target_2 construct_target_2(m_traits.construct_target_2_object());
+    typename Traits::Intersect_2 intersect_2(m_traits.intersect_2_object());
+
+    typedef typename cpp11::result_of<typename Traits::Intersect_2 (Line_2, Line_2)>::type LineLineIntersectResult;
+
+    Cone_tree_node* current = startNode;
+    Point_2 currentLocation(startLocation);
+
+    while (!current->is_root_node())
+    {
+      switch (current->node_type())
+      {
+        case Cone_tree_node::INTERVAL:
+        case Cone_tree_node::EDGE_SOURCE:
+        {
+          Segment_2 entrySegment = current->entry_segment();
+          Point_2 currentSourceImage = current->source_image();
+          Ray_2 rayToLocation(construct_ray_2(currentSourceImage, currentLocation));
+
+          LineLineIntersectResult cgalIntersection = intersect_2(construct_line_2(entrySegment), construct_line_2(rayToLocation));
+
+          CGAL_assertion(bool(cgalIntersection));
+
+          const Point_2* result = boost::get<Point_2>(&*cgalIntersection);
+
+          if (!result) result = ¤tSourceImage;
+
+          FT t0 = parametric_distance_along_segment_2(construct_source_2(entrySegment), construct_target_2(entrySegment), *result);
+
+          if (m_debugOutput)
+          {
+            std::cout << "Current Node: " << current << " , Face = " << current->layout_face() << std::endl;
+            halfedge_descriptor he = current->entry_edge();
+            std::cout << "Face vertices: ";
+            for (std::size_t i = 0; i < 3; ++i)
+            {
+              std::cout << get(m_vertexIndexMap, source(he, m_graph)) << ",";
+              he = next(he, m_graph);
+            }
+            std::cout << std::endl;
+            std::cout << "Current Location: " << currentLocation << std::endl;
+            std::cout << "Distance: " << current->distance_to_root(currentLocation) << std::endl;
+            std::cout << "Inside cone: " << (current->inside_window(currentLocation) ? "Yes" : "No") << std::endl;
+            std::cout << "Current Source: " << current->source_image() << std::endl;
+            std::cout << "Current Segment: " << entrySegment << std::endl;
+            std::cout << "Current Left Window: " << current->window_left() << "  ,  " << m_traits.compute_parametric_distance_along_segment_2_object()(entrySegment.start(), entrySegment.end(), current->window_left()) << std::endl;
+            std::cout << "Current Right Window: " << current->window_right() << "  ,  " << m_traits.compute_parametric_distance_along_segment_2_object()(entrySegment.start(), entrySegment.end(), current->window_right()) << std::endl;
+            std::cout << "Current Segment Intersection: " << *result << std::endl;
+            std::cout << "Edge: (" << get(m_vertexIndexMap, source(current->entry_edge(), m_graph)) << "," << get(m_vertexIndexMap, target(current->entry_edge(), m_graph)) << ")  :  " << t0 << std::endl;
+          }
+
+          visitor(current->entry_edge(), t0);
+
+          currentLocation = *result;
+
+          current = current->parent();
+
+        }
+          break;
+        case Cone_tree_node::VERTEX_SOURCE:
+          visitor(target(current->entry_edge(), m_graph));
+          currentLocation = current->parent()->target_point();
+          current = current->parent();
+          break;
+        case Cone_tree_node::FACE_SOURCE:
+          // This is guaranteed to be the final node in any sequence
+          visitor(m_rootNodes[current->tree_id()].second->first, m_rootNodes[current->tree_id()].second->second);
+          current = current->parent();
+          break;
+        default:
+          CGAL_assertion(false && "Unhandled node type found in tree");
+      }
+    }
+  }
+
+  void add_to_face_list(Cone_tree_node* node)
+  {
+    if (!node->is_root_node() && !node->is_null_face())
+    {
+      std::size_t faceIndex = get(m_faceIndexMap, node->current_face());
+      m_faceOccupiers[faceIndex].push_back(node);
+    }
+
+    if (node->get_left_child() != NULL)
+    {
+      add_to_face_list(node->get_left_child());
+    }
+
+    if (node->get_right_child() != NULL)
+    {
+      add_to_face_list(node->get_right_child());
+    }
+
+    for (std::size_t i = 0; i < node->num_middle_children(); ++i)
+    {
+      add_to_face_list(node->get_middle_child(i));
+    }
+  }
+
+  Point_2 face_location_with_normalized_coordinate(Cone_tree_node* node, Barycentric_coordinate location)
+  {
+    return construct_barycenter_in_triangle_2(node->layout_face(), localized_coordiate(node, location));
+  }
+
+  Barycentric_coordinate localized_coordiate(Cone_tree_node* node, Barycentric_coordinate location)
+  {
+    return shifted_coordiate(location, node->edge_face_index());
+  }
+
+  Barycentric_coordinate shifted_coordiate(Barycentric_coordinate location, std::size_t shift)
+  {
+    typename Traits::Construct_barycentric_coordinate_weight cbcw(m_traits.construct_barycentric_coordinate_weight_object());
+    typename Traits::Construct_barycentric_coordinate cbc(m_traits.construct_barycentric_coordinate_object());
+    return cbc(cbcw(location, shift), cbcw(location, (shift + 1) % 3), cbcw(location, (shift + 2) % 3));
+  }
+
+  std::pair<Node_distance_pair, Barycentric_coordinate> nearest_on_face(face_descriptor f, Barycentric_coordinate location)
+  {
+    typename Traits::Construct_barycentric_coordinate cbc(m_traits.construct_barycentric_coordinate_object());
+
+    std::size_t faceIndex = get(m_faceIndexMap, f);
+
+    Cone_tree_node* closest = NULL;
+    FT closestDistance = 0;
+
+    std::vector<Cone_tree_node*>& currentFaceList = m_faceOccupiers[faceIndex];
+
+    for (std::size_t i = 0; i < currentFaceList.size(); ++i)
+    {
+      Cone_tree_node* current = currentFaceList[i];
+
+      if (closest != NULL && current->distance_from_source_to_root() >= closestDistance)
+      {
+        continue;
+      }
+
+      Point_2 locationInContext = face_location_with_normalized_coordinate(current, location);
+
+      if (current->inside_window(locationInContext))
+      {
+        FT currentDistance = current->distance_to_root(locationInContext);
+
+        if (closest == NULL || currentDistance < closestDistance)
+        {
+          closest = current;
+          closestDistance = currentDistance;
+        }
+      }
+    }
+
+    if (closest)
+    {
+      return std::make_pair(Node_distance_pair(closest, closestDistance), localized_coordiate(closest, location));
+    }
+    else
+    {
+      return std::make_pair(Node_distance_pair((Cone_tree_node*)NULL, FT(0.0)), cbc(FT(0.0), FT(0.0), FT(0.0)));
+    }
+  }
+
+  std::pair<Node_distance_pair, Barycentric_coordinate> nearest_to_location(face_descriptor f, Barycentric_coordinate location)
+  {
+    typename Traits::Construct_barycentric_coordinate_weight cbcw(m_traits.construct_barycentric_coordinate_weight_object());
+    typename Traits::Construct_barycentric_coordinate cbc(m_traits.construct_barycentric_coordinate_object());
+    typename Traits::Classify_barycentric_coordinate classify_barycentric_coordinate(m_traits.classify_barycentric_coordinate_object());
+
+    std::size_t associatedEdge;
+    CGAL::Surface_mesh_shortest_paths_3::Barycentric_coordinate_type type;
+    boost::tie(type, associatedEdge) = classify_barycentric_coordinate(location);
+
+    switch (type)
+    {
+      case CGAL::Surface_mesh_shortest_paths_3::BARYCENTRIC_COORDINATE_ON_BOUNDED_SIDE:
+        return nearest_on_face(f, location);
+      case CGAL::Surface_mesh_shortest_paths_3::BARYCENTRIC_COORDINATE_ON_BOUNDARY:
+        {
+          halfedge_descriptor he = halfedge(f, m_graph);
+          for (std::size_t i = 0; i < associatedEdge; ++i)
+          {
+            he = next(he, m_graph);
+          }
+
+          halfedge_descriptor oppositeHalfedge = opposite(he, m_graph);
+
+          std::size_t oppositeIndex = internal::edge_index(oppositeHalfedge, m_graph);
+
+          FT oppositeLocationCoords[3] = { FT(0.0), FT(0.0), FT(0.0) };
+          oppositeLocationCoords[oppositeIndex] = cbcw(location, (associatedEdge + 1) % 3);
+          oppositeLocationCoords[(oppositeIndex + 1) % 3] = cbcw(location, associatedEdge);
+          std::pair<Node_distance_pair,Barycentric_coordinate> mainFace = nearest_on_face(f, location);
+          Barycentric_coordinate oppositeLocation(cbc(oppositeLocationCoords[0], oppositeLocationCoords[1], oppositeLocationCoords[2]));
+          std::pair<Node_distance_pair,Barycentric_coordinate> otherFace = nearest_on_face(face(oppositeHalfedge, m_graph), oppositeLocation);
+
+          if (mainFace.first.first == NULL)
+          {
+            return otherFace;
+          }
+          else if (otherFace.first.first == NULL)
+          {
+            return mainFace;
+          }
+          else
+          {
+            return mainFace.first.second < otherFace.first.second ? mainFace : otherFace;
+          }
+        }
+        break;
+      case CGAL::Surface_mesh_shortest_paths_3::BARYCENTRIC_COORDINATE_ON_VERTEX:
+        {
+          halfedge_descriptor he = halfedge(f, m_graph);
+
+          for (std::size_t i = 0; i < associatedEdge; ++i)
+          {
+            he = next(he, m_graph);
+          }
+
+          vertex_descriptor vertex = source(he, m_graph);
+
+          return std::make_pair(m_closestToVertices[get(m_vertexIndexMap, vertex)], cbc(FT(0.0), FT(0.0), FT(1.0)));
+        }
+        break;
+
+      default:
+        CGAL_assertion(false && "Invalid face location");
+        return std::pair<Node_distance_pair, Barycentric_coordinate>();
+    }
+  }
+
+  static bool cone_comparator(const Cone_tree_node* lhs, const Cone_tree_node* rhs)
+  {
+    return lhs->distance_from_source_to_root() < rhs->distance_from_source_to_root();
+  }
+
+  template <class InputIterator>
+  Source_point_iterator add_source_points_internal(InputIterator begin, InputIterator end, vertex_descriptor)
+  {
+    Source_point_iterator firstAdded;
+
+    for (InputIterator it = begin; it != end; ++it)
+    {
+      Source_point_iterator added = add_source_point(face_location(*it));
+
+      if (it == begin)
+      {
+        firstAdded = added;
+      }
+    }
+
+    return firstAdded;
+  }
+
+  template <class InputIterator>
+  Source_point_iterator add_source_points_internal(InputIterator begin, InputIterator end, Face_location)
+  {
+    Source_point_iterator firstAdded;
+
+    for (InputIterator it = begin; it != end; ++it)
+    {
+      Source_point_iterator added = add_source_point(it->first, it->second);
+
+      if (it == begin)
+      {
+        firstAdded = added;
+      }
+    }
+
+    return firstAdded;
+  }
+
+  void construct_sequence_tree_internal()
+  {
+    reset_algorithm(false);
+    set_vertex_types();
+
+    m_vertexOccupiers.resize(num_halfedges(m_graph));
+    m_closestToVertices.resize(num_vertices(m_graph));
+
+    if (m_debugOutput)
+    {
+      vertex_iterator current, end;
+
+      std::size_t numVertices = 0;
+
+      for (boost::tie(current,end) = vertices(m_graph); current != end; ++current)
+      {
+        std::cout << "Vertex#" << numVertices << ": p = " << get(m_vertexPointMap,*current) << " , Saddle Vertex: " << (is_saddle_vertex(*current) ? "yes" : "no") << " , Boundary Vertex: " << (is_boundary_vertex(*current) ? "yes" : "no") << std::endl;
+        ++numVertices;
+      }
+    }
+
+    face_iterator facesCurrent;
+    face_iterator facesEnd;
+
+    if (m_debugOutput)
+    {
+      std::size_t numFaces = 0;
+
+      for (boost::tie(facesCurrent, facesEnd) = faces(m_graph); facesCurrent != facesEnd; ++facesCurrent)
+      {
+        std::cout << "Face#" << numFaces << ": Vertices = (";
+        ++numFaces;
+        halfedge_descriptor faceEdgesStart = halfedge(*facesCurrent, m_graph);
+        halfedge_descriptor faceEdgesCurrent = faceEdgesStart;
+
+        do
+        {
+          std::cout << get(m_vertexIndexMap, source(faceEdgesCurrent, m_graph));
+
+          faceEdgesCurrent = next(faceEdgesCurrent, m_graph);
+
+          if (faceEdgesCurrent != faceEdgesStart)
+          {
+            std::cout << ", ";
+          }
+          else
+          {
+            std::cout << ")";
+          }
+        }
+        while (faceEdgesCurrent != faceEdgesStart);
+
+        std::cout << std::endl;
+      }
+
+    }
+
+    for (typename Source_point_list::iterator it = m_faceLocations.begin(); it != m_faceLocations.end(); ++it)
+    {
+      if (m_debugOutput)
+      {
+        std::cout << "Root: " << get(m_faceIndexMap, it->first) << " , " << it->second[0] << " " << it->second[1] << " " << it->second[2] << " " << std::endl;
+      }
+
+      expand_root(it->first, it->second, Source_point_iterator(it));
+    }
+
+    if (m_debugOutput)
+    {
+      std::cout << "PriQ start size = " << m_expansionPriqueue.size() << std::endl;
+
+      std::cout << "Num face locations: " << m_faceLocations.size() << std::endl;
+      std::cout << "Num root nodes: " << m_rootNodes.size() << " (Hint: these should be the same size)" << std::endl;
+
+    }
+
+    while (m_expansionPriqueue.size() > 0)
+    {
+      Cone_expansion_event* event = m_expansionPriqueue.top();
+      m_expansionPriqueue.pop();
+
+      if (!event->m_cancelled)
+      {
+        typename Cone_expansion_event::Expansion_type type = event->m_type;
+        Cone_tree_node* parent = event->m_parent;
+
+        switch (type)
+        {
+          case Cone_expansion_event::PSEUDO_SOURCE:
+            if (m_debugOutput)
+            {
+              std::cout << "PseudoSource Expansion: Parent = " << parent << " , Vertex = " << get(m_vertexIndexMap, event->m_parent->target_vertex()) << " , Distance = " << event->m_distanceEstimate << " , Level = " << event->m_parent->level() + 1 << std::endl;
+            }
+
+            expand_pseudo_source(parent);
+            break;
+          case Cone_expansion_event::LEFT_CHILD:
+            if (m_debugOutput)
+            {
+              std::cout << "Left Expansion: Parent = " << parent << " Edge = (" << get(m_vertexIndexMap, source(event->m_parent->left_child_edge(), m_graph)) << "," << get(m_vertexIndexMap, target(event->m_parent->left_child_edge(), m_graph)) << ") , Distance = " << event->m_distanceEstimate << " , Level = " << event->m_parent->level() + 1 << std::endl;
+            }
+
+            expand_left_child(parent, event->m_windowSegment);
+            break;
+          case Cone_expansion_event::RIGHT_CHILD:
+            if (m_debugOutput)
+            {
+              std::cout << "Right Expansion: Parent = " << parent << " , Edge = (" << get(m_vertexIndexMap, source(event->m_parent->right_child_edge(), m_graph)) << "," << get(m_vertexIndexMap, target(event->m_parent->right_child_edge(), m_graph)) << ") , Distance = " << event->m_distanceEstimate << " , Level = " << event->m_parent->level() + 1 << std::endl;
+            }
+
+            expand_right_child(parent, event->m_windowSegment);
+            break;
+        }
+      }
+      else if (m_debugOutput)
+      {
+        std::cout << "Found cancelled event for node: " << event->m_parent << std::endl;
+      }
+
+      delete event;
+    }
+
+    m_faceOccupiers.clear();
+    m_faceOccupiers.resize(num_faces(m_graph));
+
+    for (std::size_t i = 0; i < m_rootNodes.size(); ++i)
+    {
+      add_to_face_list(m_rootNodes[i].first);
+    }
+
+    for (std::size_t i = 0; i < m_faceOccupiers.size(); ++i)
+    {
+      std::vector<Cone_tree_node*>& currentFaceList = m_faceOccupiers[i];
+      std::sort(currentFaceList.begin(), currentFaceList.end(), cone_comparator);
+    }
+
+    if (m_debugOutput)
+    {
+      std::cout << "Closest distances: " << std::endl;
+
+      for (std::size_t i = 0; i < m_closestToVertices.size(); ++i)
+      {
+        std::cout << "\tVertex = " << i << std::endl;
+        std::cout << "\tDistance = " << m_closestToVertices[i].second << std::endl;
+      }
+
+      std::cout << std::endl;
+
+      for (std::size_t i = 0; i < m_faceOccupiers.size(); ++i)
+      {
+        std::cout << "\tFace = " << i << std::endl;
+        std::cout << "\t#Occupiers = " << m_faceOccupiers[i].size() << std::endl;
+      }
+
+      std::cout << std::endl << "Done!" << std::endl;
+    }
+
+    m_firstNewSourcePoint = m_faceLocations.end();
+    m_deletedSourceLocations.clear();
+
+  }
+
+public:
+
+  /// \name Constructors
+  /// @{
+
+  /*!
+  \brief Creates a shortest paths object using `tm` as input.
+
+  Equivalent to `Surface_mesh_shortest_path(tm, get(boost::vertex_index, tm), get(boost::halfedge_index, tm), get(boost::face_index, tm), get(CGAL::vertex_point, tm), traits)`.
+  */
+  Surface_mesh_shortest_path(Triangle_mesh& tm, const Traits& traits = Traits())
+    : m_traits(traits)
+    , m_graph(tm)
+    , m_vertexIndexMap(get(boost::vertex_index, tm))
+    , m_halfedgeIndexMap(get(boost::halfedge_index, tm))
+    , m_faceIndexMap(get(boost::face_index, tm))
+    , m_vertexPointMap(get(CGAL::vertex_point, tm))
+    , m_debugOutput(false)
+  {
+    reset_algorithm();
+  }
+
+  /*!
+  \brief Creates a shortest paths object using `tm` as input.
+
+  \details No copy of the `Triangle_mesh` is made, only a reference to the `tm` is held.
+
+  \param tm The surface mesh to compute shortest paths on.  Note that it must be triangulated.
+
+  \param vertexIndexMap Property map associating an id to each vertex, from 0 to `num_vertices(tm) - 1`.
+
+  \param halfedgeIndexMap Property map associating an id to each halfedge, from 0 to `num_halfedges(tm) - 1`.
+
+  \param faceIndexMap Property map associating an id to each face, from 0 to `num_faces(tm) - 1`.
+
+  \param vertexPointMap Property map used to access the points associated to each vertex of the graph.
+
+  \param traits Optional instance of the traits class to use.
+  */
+  Surface_mesh_shortest_path(Triangle_mesh& tm, Vertex_index_map vertexIndexMap, Halfedge_index_map halfedgeIndexMap, Face_index_map faceIndexMap, Vertex_point_map vertexPointMap, const Traits& traits = Traits())
+    : m_traits(traits)
+    , m_graph(tm)
+    , m_vertexIndexMap(vertexIndexMap)
+    , m_halfedgeIndexMap(halfedgeIndexMap)
+    , m_faceIndexMap(faceIndexMap)
+    , m_vertexPointMap(vertexPointMap)
+    , m_debugOutput(false)
+  {
+    reset_algorithm();
+  }
+
+  /// @}
+
+  /// \cond
+
+  ~Surface_mesh_shortest_path()
+  {
+    delete_all_nodes();
+
+#if !defined(NDEBUG)
+    if (m_debugOutput)
+    {
+      std::cout << "Final node count: " << m_currentNodeCount << std::endl;
+    }
+    return;
+    CGAL_assertion(m_currentNodeCount == 0);
+#endif
+  }
+
+  /// \endcond
+
+  /// \name Addition and Removal of Source Points
+  /// @{
+
+  /*!
+  \brief Adds `v` as a source for the shortest path queries.
+
+  \details No change to the internal shortest paths data structure occurs
+  until either `Surface_mesh_shortest_path::build_sequence_tree()` or
+  the first shortest path query is done.
+
+  \return An iterator to the source point added
+  */
+  Source_point_iterator add_source_point(vertex_descriptor v)
+  {
+    Face_location location = face_location(v);
+    return add_source_point(location);
+  }
+
+  /*!
+  \brief Adds a point inside the face `f` as a source for the shortest path queries.
+
+  \details No change to the internal shortest paths data structure occurs
+  until either `Surface_mesh_shortest_path::build_sequence_tree()` or
+  the first shortest path query is done.
+
+  \param f A face of the input face graph
+  \param location Barycentric coordinate in face `f` specifying the source point.
+  \return An iterator to the source point added
+  */
+  Source_point_iterator add_source_point(face_descriptor f, Barycentric_coordinate location)
+  {
+    return add_source_point(std::make_pair(f, location));
+  }
+
+  /*!
+  \brief Adds a point inside a face as a source for the shortest path queries,
+  equivalent to `Surface_mesh_shortest_path::add_source_point(location.first, location.second);`
+  */
+  Source_point_iterator add_source_point(Face_location location)
+  {
+    Source_point_underlying_iterator added = m_faceLocations.insert(m_faceLocations.end(), location);
+
+    if (m_firstNewSourcePoint == m_faceLocations.end())
+    {
+      m_firstNewSourcePoint = added;
+    }
+
+    return Source_point_iterator(added);
+  }
+
+  /*!
+  \brief Adds a range of points as sources for the shortest path queries.
+
+  \details No change to the internal shortest paths data structure occurs
+  until either `Surface_mesh_shortest_path::build_sequence_tree()` or
+  the first shortest path query is done.
+
+  \tparam InputIterator A `ForwardIterator` which dereferences to either `Surface_mesh_shortest_path::Face_location`, or `Surface_mesh_shortest_path::vertex_descriptor`.
+
+  \param begin iterator to the first in the list of source point locations.
+  \param end iterator to one past the end of the list of source point locations.
+  \return An iterator to the first source point added.
+  */
+  template <class InputIterator>
+  Source_point_iterator add_source_points(InputIterator begin, InputIterator end)
+  {
+    return add_source_points_internal(begin, end, typename std::iterator_traits<InputIterator>::value_type());
+  }
+
+  /*!
+  \brief Removes a source point for the shortest path queries.
+
+  \details No change to the internal shortest paths data structure occurs
+  until either `Surface_mesh_shortest_path::build_sequence_tree()` or
+  the first shortest path query is done.
+  Behaviour is undefined if the source point `it` was already removed.
+
+  \param it iterator to the source point to be removed
+  */
+  void remove_source_point(Source_point_iterator it)
+  {
+    if (it == m_firstNewSourcePoint)
+    {
+      ++m_firstNewSourcePoint;
+    }
+
+    m_deletedSourceLocations.splice(m_deletedSourceLocations.begin(), m_faceLocations, it.m_iterator);
+  }
+
+  /*!
+  \brief Removes all source points for the shortest path queries.
+
+  \details No change to the internal shortest paths data structure occurs
+  until either `Surface_mesh_shortest_path::build_sequence_tree()` or
+  the first shortest path query is done.
+  For a version which deletes all data immediately, use `clear()` instead.
+  */
+  void remove_all_source_points()
+  {
+    m_deletedSourceLocations.splice(m_deletedSourceLocations.begin(), m_faceLocations, m_faceLocations.begin(), m_faceLocations.end());
+    m_firstNewSourcePoint = m_faceLocations.end();
+  }
+
+  /// @}
+
+  /// \name Creation and Destruction of the Shortest Paths Sequence Tree
+  /// @{
+
+  /*!
+  \brief Computes all pending changes to the internal sequence tree
+
+  \details A call to this method will only trigger a computation only if some
+  change to the set of source points occurred since the last time
+  the sequence tree was computed.
+  */
+  void build_sequence_tree()
+  {
+    if (changed_since_last_build())
+    {
+      construct_sequence_tree_internal();
+    }
+  }
+
+  /*!
+  \brief Removes all data, the class is as if it was constructed.
+
+  \details All internal containers are cleared  and the internal
+  sequence tree is also cleared.  For a version which defers deletion until
+  it is necessary, use `Surface_mesh_shortest_path::remove_all_source_points()`.
+  */
+  void clear()
+  {
+    reset_algorithm();
+  }
+
+  /// @}
+
+  /// \name Accessors
+  /// @{
+
+  /*!
+  \brief Returns an iterator to the first source point location
+
+  \details The elements will appear in the order they were inserted to the
+  structure by calls to `add_source_point()` or `add_source_points()`.  Deleted
+  points will not appear in the sequence.
+
+  \return An iterator to the first of the stored source points.
+  */
+  Source_point_iterator source_points_begin() const
+  {
+    // It is a feature of C++11 that `const_iterator` may be used in calls to `erase()`, however
+    // in order to support C++98, we must use `iterator`.  Semantically, this is correct, but
+    // I must cast away the const-ness to hide the internal uglyness
+    return Source_point_iterator(const_cast<std::list<Face_location>&>(m_faceLocations).begin());
+  }
+
+  /*!
+  \brief Returns an iterator to one past the last source point location
+
+  \return An iterator to one past-the-end in the list of stored source points.
+  */
+  Source_point_iterator source_points_end() const
+  {
+    return Source_point_iterator(const_cast<std::list<Face_location>&>(m_faceLocations).end());
+  }
+
+  /*!
+  \brief Returns the total number of source points used for the shortest path queries.
+  */
+  std::size_t number_of_source_points() const
+  {
+    return m_faceLocations.size();
+  }
+
+  /*!
+  \brief Determines if the internal sequence tree is valid (already built and no new source point has been added).
+
+  \return true if the structure needs to be rebuilt, false otherwise
+  */
+  bool changed_since_last_build() const
+  {
+    return m_firstNewSourcePoint != m_faceLocations.end() || !m_deletedSourceLocations.empty();
+  }
+
+  /// @}
+
+  /// \name Shortest Distance Queries
+  /// @{
+
+  /*!
+  \brief Computes the shortest surface distance from a vertex to any source point
+
+  \param v A vertex of the input face graph
+  \return A pair, containing the distance to the source point, and an
+    iterator to the source point.  If no source point was reachable (can
+    occur when the graph is disconnected), the distance will be a negative
+    value and the source point iterator will be equal to `source_points_end()`.
+  */
+  Shortest_path_result shortest_distance_to_source_points(vertex_descriptor v)
+  {
+    build_sequence_tree();
+
+    Node_distance_pair result = m_closestToVertices[get(m_vertexIndexMap, v)];
+
+    Cone_tree_node* current = result.first;
+
+    if (current)
+    {
+      return std::make_pair(result.second, m_rootNodes[current->tree_id()].second);
+    }
+    else
+    {
+      return std::make_pair(FT(-1.0), source_points_end());
+    }
+  }
+
+  /*!
+  \brief Computes the shortest surface distance from any surface location to any source point
+
+  \param f A face of the input face graph
+  \param location Barycentric coordinate of the query point on face `f`
+  \return A pair, containing the distance to the source point, and an
+    iterator to the source point.  If no source point was reachable (can
+    occur when the graph is disconnected), the distance will be a negative
+    value and the source point iterator will be equal to `source_points_end()`.
+  */
+  Shortest_path_result shortest_distance_to_source_points(face_descriptor f, Barycentric_coordinate location)
+  {
+    build_sequence_tree();
+
+    std::pair<Node_distance_pair, Barycentric_coordinate> result = nearest_to_location(f, location);
+
+    Cone_tree_node* current = result.first.first;
+
+    if (current)
+    {
+      return std::make_pair(result.first.second, m_rootNodes[current->tree_id()].second);
+    }
+    else
+    {
+      return std::make_pair(FT(-1.0), source_points_end());
+    }
+  }
+
+  /// @}
+
+  /// \name Shortest Path Sequence Queries
+  /// @{
+
+  /*!
+  \brief Visits the sequence of edges, vertices and faces traversed by the shortest path
+  from a vertex to any source point.
+
+  \details Visits simplices, starting from the query vertex, back to
+  the nearest source point. If no shortest path could be found (for example,
+  the surface is disconnected), then no calls to the visitor will be made
+  (not even for the query vertex).
+
+  \param v A vertex of the input face graph
+  \param visitor A model of `SurfaceMeshShortestPathVisitor` to receive the shortest path
+  \return A pair, containing the distance to the source point, and an
+    iterator to the source point.  If no source point was reachable (can
+    occur when the graph is disconnected), the distance will be a negative
+    value and the source point iterator will be equal to `source_points_end()`.
+  */
+  template <class Visitor>
+  Shortest_path_result
+  shortest_path_sequence_to_source_points(vertex_descriptor v, Visitor& visitor)
+  {
+    build_sequence_tree();
+
+    Node_distance_pair result = m_closestToVertices[get(m_vertexIndexMap, v)];
+    Cone_tree_node* current = result.first;
+
+    if (current)
+    {
+      visitor(v);
+      visit_shortest_path(current, current->target_point(), visitor);
+      return std::make_pair(result.second, m_rootNodes[current->tree_id()].second);
+    }
+    else
+    {
+      return std::make_pair(FT(-1.0), source_points_end());
+    }
+  }
+
+  /*!
+  \brief Visits the sequence of edges, vertices and faces traversed by the shortest path
+  from any surface location to any source point.
+
+  \details Visits simplices, starting from the query point, back to
+  the nearest source point. If no shortest path could be found (for example,
+  the surface is disconnected), then no calls to the visitor will be made
+  (not even for the query point).
+
+  \param f A face of the input face graph
+  \param location Barycentric coordinate of the query point on face `f`
+  \param visitor A model of `SurfaceMeshShortestPathVisitor` to receive the shortest path
+  \return A pair, containing the distance to the source point, and an
+    iterator to the source point.  If no source point was reachable (can
+    occur when the graph is disconnected), the distance will be a negative
+    value and the source point iterator will be equal to `source_points_end()`.
+  */
+  template <class Visitor>
+  Shortest_path_result
+  shortest_path_sequence_to_source_points(face_descriptor f, Barycentric_coordinate location, Visitor& visitor)
+  {
+    build_sequence_tree();
+
+    std::pair<Node_distance_pair, Barycentric_coordinate> result = nearest_to_location(f, location);
+    Cone_tree_node* current = result.first.first;
+
+    if (current)
+    {
+      Point_2 locationInContext = construct_barycenter_in_triangle_2(current->layout_face(), result.second);
+      visitor(f, location);
+      visit_shortest_path(current, locationInContext, visitor);
+      return std::make_pair(result.first.second, m_rootNodes[current->tree_id()].second);
+    }
+    else
+    {
+      return std::make_pair(FT(-1.0), source_points_end());
+    }
+  }
+
+  /// @}
+
+  /// \name Shortest Path Point Queries
+  /// @{
+
+  /*!
+  \brief Computes the sequence of points in the shortest path along the
+    surface of the input face graph from the given vertex to the closest
+    source point.
+
+  \param v A vertex of the input face graph
+  \param output An OutputIterator to receive the shortest path points as `Point_3` objects
+  \return A pair, containing the distance to the source point, and an
+    iterator to the source point.  If no source point was reachable (can
+    occur when the graph is disconnected), the distance will be a negative
+    value and the source point iterator will be equal to `source_points_end()`.
+  */
+  template <class OutputIterator>
+  Shortest_path_result
+  shortest_path_points_to_source_points(vertex_descriptor v, OutputIterator output)
+  {
+    build_sequence_tree();
+
+    Point_path_visitor_wrapper<OutputIterator> wrapper(*this, output);
+    return shortest_path_sequence_to_source_points(v, wrapper);
+  }
+
+  /*!
+  \brief Computes the sequence of points in the shortest path along the
+    surface of the input face graph from the given query location to the closest
+    source point.
+
+  \param f A face of on the input face graph
+  \param location The barycentric coordinate of the query point on face `f`
+  \param output An OutputIterator to receive the shortest path points as `Point_3` objects
+  \return A pair, containing the distance to the source point, and an
+    iterator to the source point.  If no source point was reachable (can
+    occur when the graph is disconnected), the distance will be a negative
+    value and the source point iterator will be equal to `source_points_end()`.
+  */
+  template <class OutputIterator>
+  Shortest_path_result
+  shortest_path_points_to_source_points(face_descriptor f, Barycentric_coordinate location, OutputIterator output)
+  {
+    build_sequence_tree();
+
+    Point_path_visitor_wrapper<OutputIterator> wrapper(*this, output);
+    return shortest_path_sequence_to_source_points(f, location, wrapper);
+  }
+
+  /// @}
+
+  /// \name Surface Point Constructions
+  /// @{
+
+  /*!
+  \brief Returns the 3-dimensional coordinate at the barycentric coordinate
+    of the given face.
+
+  \details The following static overloads are also available:
+    - `static Point_3 point(face_descriptor f, Barycentric_coordinate location, const Triangle_mesh& tm, const Traits& traits = Traits())`
+    - `static Point_3 point(face_descriptor f, Barycentric_coordinate location, const Triangle_mesh& tm, Vertex_point_map vertexPointMap, const Traits& traits = Traits())`
+
+  \param f A face of on the input face graph
+  \param location The barycentric coordinate of the query point on face `f`
+  */
+  Point_3 point(face_descriptor f, Barycentric_coordinate location) const
+  {
+    return point(f, location, m_graph, m_vertexPointMap, m_traits);
+  }
+
+  /// \cond
+
+  static Point_3 point(face_descriptor f, Barycentric_coordinate location, const Triangle_mesh& tm, const Traits& traits = Traits())
+  {
+    return point(f, location, tm, CGAL::get(CGAL::vertex_point, tm), traits);
+  }
+
+  static Point_3 point(face_descriptor f, Barycentric_coordinate location, const Triangle_mesh& tm, Vertex_point_map vertexPointMap, const Traits& traits = Traits())
+  {
+    return construct_barycenter_in_triangle_3(triangle_from_face(f, tm, vertexPointMap), location, traits);
+  }
+
+  /// \endcond
+
+  /*!
+  \brief Returns the 3-dimensional coordinate at the parametric location
+    along the given edge.
+
+  \details The following static overloads are also available:
+    - `static Point_3 point(halfedge_descriptor edge, FT t, const Triangle_mesh& tm, const Traits& traits = Traits())`
+    - `static Point_3 point(halfedge_descriptor edge, FT t, const Triangle_mesh& tm, Vertex_point_map vertexPointMap, const Traits& traits = Traits())`
+
+  \param edge An edge of the input face graph
+  \param t The parametric distance along edge of the desired point
+  */
+  Point_3 point(halfedge_descriptor edge, FT t) const
+  {
+    return point(edge, t, m_graph, m_vertexPointMap, m_traits);
+  }
+
+  /// \cond
+
+  static Point_3 point(halfedge_descriptor edge, FT t, const Triangle_mesh& tm, const Traits& traits = Traits())
+  {
+    return point(edge, t, tm, CGAL::get(CGAL::vertex_point, tm), traits);
+  }
+
+  static Point_3 point(halfedge_descriptor edge, FT t, const Triangle_mesh& tm, Vertex_point_map vertexPointMap, const Traits& traits = Traits())
+  {
+    typename Traits::Construct_barycenter_3 construct_barycenter_3(traits.construct_barycenter_3_object());
+
+    // Note: the parameter t is meant to be the weighted coordinate on the _endpoint_ (i.e. target) of the segment
+    return construct_barycenter_3(get(vertexPointMap, target(edge, tm)), t, get(vertexPointMap, source(edge, tm)));
+  }
+
+  /// \endcond
+
+  /*!
+  \brief Returns the 3-dimensional coordinate of the given vertex.
+
+  \param vertex A vertex of the input face graph
+  */
+  Point_3 point(vertex_descriptor vertex) const
+  {
+    return get(m_vertexPointMap, vertex);
+  }
+
+  /// @}
+
+  /// \name Surface Face Location Constructions
+  /// @{
+
+  /*!
+  \brief Returns the location of the given vertex as a `Face_location`
+
+  \details The following static overload is also available:
+    - `static Face_location face_location(vertex_descriptor vertex, const Triangle_mesh& tm, const Traits& traits = Traits())`
+
+  \param vertex A vertex of the input face graph
+  */
+  Face_location face_location(vertex_descriptor vertex) const
+  {
+    return face_location(vertex, m_graph, m_traits);
+  }
+
+  /// \cond
+
+  static Face_location face_location(vertex_descriptor vertex, const Triangle_mesh& tm, const Traits& traits = Traits())
+  {
+    typename Traits::Construct_barycentric_coordinate construct_barycentric_coordinate(traits.construct_barycentric_coordinate_object());
+    halfedge_descriptor he = next(halfedge(vertex, tm), tm);
+    face_descriptor locationFace = face(he, tm);
+    std::size_t edgeIndex = CGAL::internal::edge_index(he, tm);
+
+    FT coords[3] = { FT(0.0), FT(0.0), FT(0.0) };
+
+    coords[edgeIndex] = FT(1.0);
+
+    return Face_location(locationFace, construct_barycentric_coordinate(coords[0], coords[1], coords[2]));
+  }
+
+  /// \endcond
+
+  /*!
+  \brief Returns a location along the given edge as a `Face_location`.
+
+  \details The following static overload is also available:
+    - `static Face_location face_location(halfedge_descriptor he, FT t, const Triangle_mesh& tm, const Traits& traits = Traits())`
+
+  \param he A halfedge of the input face graph
+  \param t Parametric distance of the desired point along `he`
+  */
+  Face_location face_location(halfedge_descriptor he, FT t) const
+  {
+    return face_location(he, t, m_graph, m_traits);
+  }
+
+  /// \cond
+
+  static Face_location face_location(halfedge_descriptor he, FT t, const Triangle_mesh& tm, const Traits& traits = Traits())
+  {
+    typename Traits::Construct_barycentric_coordinate cbc(traits.construct_barycentric_coordinate_object());
+    face_descriptor locationFace = face(he, tm);
+    std::size_t edgeIndex = CGAL::internal::edge_index(he, tm);
+
+    const FT oneMinusT(FT(1.0) - t);
+
+    FT coords[3] = { FT(0.0), FT(0.0), FT(0.0) };
+
+    coords[edgeIndex] = oneMinusT;
+    coords[(edgeIndex + 1) % 3] = t;
+
+    return Face_location(locationFace, cbc(coords[0], coords[1], coords[2]));
+  }
+
+  /// \endcond
+
+  /// @}
+
+  /// \name Nearest Face Location Queries
+  /// @{
+
+  /*
+  \brief Returns the nearest face location to the given point.
+    Note that this will (re-)build an `AABB_tree` on each call. If you need
+    to  call this function more than once, use `build_aabb_tree()` to cache a
+    copy of the `AABB_tree`, and use the overloads of this function
+    that accept a reference to an `AABB_tree` as input.
+
+  \details The following static overload is also available:
+    - `static Face_location locate(const Point_3& p, const Triangle_mesh& tm, Vertex_point_map vertexPointMap, const Traits& traits = Traits())`
+
+  \tparam AABBTraits A model of `AABBTraits` used to define a \cgal `AABB_tree`.
+
+  \param p Point to locate on the input face graph
+  */
+  template <class AABBTraits>
+  Face_location locate(const Point_3& p) const
+  {
+    return locate<AABBTraits>(p, m_graph, m_vertexPointMap, m_traits);
+  }
+
+  /// \cond
+
+  template <class AABBTraits>
+  static Face_location locate(const Point_3& location, const Triangle_mesh& tm, Vertex_point_map vertexPointMap, const Traits& traits = Traits())
+  {
+    AABB_tree<AABBTraits> tree;
+    build_aabb_tree(tm, tree);
+    return locate(location, tree, tm, vertexPointMap, traits);
+  }
+
+  /// \endcond
+
+  /*!
+  \brief Returns the face location nearest to the given point.
+
+  \details The following static overload is also available:
+    - static Face_location locate(const Point_3& p, const AABB_tree<AABBTraits>& tree, const Triangle_mesh& tm, Vertex_point_map vertexPointMap, const Traits& traits = Traits())
+
+  \tparam AABBTraits A model of `AABBTraits` used to define a \cgal `AABB_tree`.
+
+  \param p Point to locate on the input face graph
+  \param tree A `AABB_tree` containing the triangular faces of the input surface mesh to perform the point location with
+  */
+  template <class AABBTraits>
+  Face_location locate(const Point_3& p, const AABB_tree<AABBTraits>& tree) const
+  {
+    return locate(p, tree, m_graph, m_vertexPointMap, m_traits);
+  }
+
+  /// \cond
+
+  template <class AABBTraits>
+  static Face_location locate(const Point_3& location, const AABB_tree<AABBTraits>& tree, const Triangle_mesh& tm, Vertex_point_map vertexPointMap, const Traits& traits = Traits())
+  {
+    typename Traits::Construct_barycentric_coordinate_in_triangle_3 cbcit3(traits.construct_barycentric_coordinate_in_triangle_3_object());
+    typename AABB_tree<AABBTraits>::Point_and_primitive_id result = tree.closest_point_and_primitive(location);
+
+    face_descriptor f = result.second;
+    Barycentric_coordinate b = cbcit3(triangle_from_face(f, tm, vertexPointMap), result.first);
+    return Face_location(f, b);
+  }
+
+  /// \endcond
+
+  /*
+  \brief Returns the face location along `ray` nearest to its source point.
+    Note that this will (re-)build an `AABB_tree` on each call. If you need
+    to  call this function more than once, use `build_aabb_tree()` to cache a
+    copy of the `AABB_tree`, and use the overloads of this function
+    that accept a reference to an `AABB_tree` as input.
+
+  \details The following static overload is also available:
+    - `static Face_location locate(const Ray_3& ray, const Triangle_mesh& tm, Vertex_point_map vertexPointMap, const Traits& traits = Traits())`
+
+  \tparam AABBTraits A model of `AABBTraits` used to define an `AABB_tree`.
+
+  \param ray Ray to intersect with the input face graph
+  */
+  template <class AABBTraits>
+  Face_location locate(const Ray_3& ray) const
+  {
+    return locate<AABBTraits>(ray, m_graph, m_vertexPointMap, m_traits);
+  }
+
+  /// \cond
+
+  template <class AABBTraits>
+  static Face_location locate(const Ray_3& ray, const Triangle_mesh& tm, Vertex_point_map vertexPointMap, const Traits& traits = Traits())
+  {
+    AABB_tree<AABBTraits> tree;
+    build_aabb_tree(tm, tree);
+    return locate(ray, tree, tm, vertexPointMap, traits);
+  }
+
+  /// \endcond
+
+  /*!
+  \brief Returns the face location along `ray` nearest to
+    its source point.
+
+  \details The following static overload is also available:
+    - static Face_location locate(const Ray_3& ray, const AABB_tree<AABBTraits>& tree, const Triangle_mesh& tm, Vertex_point_map vertexPointMap, const Traits& traits = Traits())
+
+  \tparam AABBTraits A model of `AABBTraits` used to define a \cgal `AABB_tree`.
+
+  \param ray Ray to intersect with the input face graph
+  \param tree A `AABB_tree` containing the triangular faces of the input surface mesh to perform the point location with
+  */
+  template <class AABBTraits>
+  Face_location locate(const Ray_3& ray, const AABB_tree<AABBTraits>& tree) const
+  {
+    return locate(ray, tree, m_graph, m_vertexPointMap, m_traits);
+  }
+
+  /// \cond
+
+  template <class AABBTraits>
+  static Face_location locate(const Ray_3& ray, const AABB_tree<AABBTraits>& tree, const Triangle_mesh& tm, Vertex_point_map vertexPointMap, const Traits& traits = Traits())
+  {
+    typedef AABB_tree<AABBTraits> AABB_face_graph_tree;
+    typename Traits::Construct_barycentric_coordinate_in_triangle_3 cbcit3(traits.construct_barycentric_coordinate_in_triangle_3_object());
+    typename Traits::Construct_barycentric_coordinate cbc(traits.construct_barycentric_coordinate_object());
+    typename Traits::Compute_squared_distance_3 csd3(traits.compute_squared_distance_3_object());
+    typedef typename AABB_face_graph_tree::template Intersection_and_primitive_id<Ray_3>::Type Intersection_type;
+    typedef boost::optional<Intersection_type> Ray_intersection;
+
+    std::vector<Ray_intersection> intersections;
+
+    tree.all_intersections(ray, std::back_inserter(intersections));
+
+    bool foundOne = false;
+    FT nearestDistance = 0;
+    Point_3 nearestPoint = CGAL::ORIGIN;
+    face_descriptor nearestFace;
+
+    for (std::size_t i = 0; i < intersections.size(); ++i)
+    {
+      if (intersections[i])
+      {
+        Point_3* intersectionPoint = boost::get<Point_3>(&(intersections[i]->first));
+
+        if (intersectionPoint)
+        {
+          FT distance = csd3(*intersectionPoint, ray.source());
+
+          if (!foundOne || distance < nearestDistance)
+          {
+            foundOne = true;
+            nearestPoint = *intersectionPoint;
+            nearestDistance = distance;
+            nearestFace = intersections[i]->second;
+          }
+        }
+      }
+    }
+
+    if (foundOne)
+    {
+      Barycentric_coordinate b = cbcit3(triangle_from_face(nearestFace, tm, vertexPointMap), nearestPoint);
+      return Face_location(nearestFace, b);
+    }
+    else
+    {
+      return Face_location(Graph_traits::null_face(), cbc(FT(0.0), FT(0.0), FT(0.0)));
+    }
+  }
+
+  /// \endcond
+
+  /// @}
+
+  /*
+  \brief Creates an `AABB_tree` suitable for use with `locate`.
+
+  \details The following static overload is also available:
+    - `static void build_aabb_tree(const Triangle_mesh& tm, AABB_tree<AABBTraits>& outTree)`
+
+  \tparam AABBTraits A model of `AABBTraits` used to define a \cgal `AABB_tree`.
+
+  \param outTree Output parameter to store the computed `AABB_tree`
+  */
+  template <class AABBTraits>
+  void build_aabb_tree(AABB_tree<AABBTraits>& outTree) const
+  {
+    build_aabb_tree(m_graph, outTree);
+  }
+
+  /// \cond
+
+  template <class AABBTraits>
+  static void build_aabb_tree(const Triangle_mesh& tm, AABB_tree<AABBTraits>& outTree)
+  {
+    face_iterator facesStart, facesEnd;
+    boost::tie(facesStart, facesEnd) = faces(tm);
+    outTree.rebuild(facesStart, facesEnd, tm);
+    outTree.build();
+  }
+  /// \endcond
+
+};
+
+} // namespace CGAL
+
+#endif // CGAL_SURFACE_MESH_SHORTEST_PATH_SURFACE_MESH_SHORTEST_PATH_H
diff --git a/3rdparty/CGAL/include/CGAL/Surface_mesh_shortest_path/Surface_mesh_shortest_path_traits.h b/3rdparty/CGAL/include/CGAL/Surface_mesh_shortest_path/Surface_mesh_shortest_path_traits.h
new file mode 100644
index 0000000..9c6998c
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Surface_mesh_shortest_path/Surface_mesh_shortest_path_traits.h
@@ -0,0 +1,205 @@
+// Copyright (c) 2014 GeometryFactory
+// 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
+// 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(s)     : Stephen Kiazyk
+
+#ifndef CGAL_SURFACE_MESH_SHORTEST_PATH_TRAITS_H
+#define CGAL_SURFACE_MESH_SHORTEST_PATH_TRAITS_H
+
+#include <CGAL/Surface_mesh_shortest_path/barycentric.h>
+#include <CGAL/Surface_mesh_shortest_path/function_objects.h>
+
+#include <ostream>
+#include <cstddef>
+
+#include <boost/array.hpp>
+
+namespace CGAL {
+
+/*!
+\ingroup PkgSurfaceMeshShortestPathTraitsClasses
+
+\brief A model of the concept `SurfaceMeshShortestPathTraits`
+as required by the `Surface_mesh_shortest_path` class.
+
+\tparam K A \cgal Kernel
+
+\tparam TriangleMesh A model of `FaceListGraph`
+
+\cgalModels `SurfaceMeshShortestPathTraits`
+*/
+template <
+  class K,
+  class TriangleMesh>
+class Surface_mesh_shortest_path_traits : public K
+{
+public:
+
+  /// Kernel type
+  typedef K Kernel;
+
+  /// Triangle mesh type
+  typedef TriangleMesh Triangle_mesh;
+
+  typedef typename Kernel::FT FT;
+
+  /// Barycentric coordinate type
+  typedef typename CGAL::cpp11::array<FT,3> Barycentric_coordinate;
+
+  // Predicates
+public:
+  typedef typename Surface_mesh_shortest_paths_3::Compare_relative_intersection_along_segment_2<Kernel> Compare_relative_intersection_along_segment_2;
+  typedef typename Surface_mesh_shortest_paths_3::Is_saddle_vertex<Kernel, Triangle_mesh> Is_saddle_vertex;
+
+  // Constructions
+public:
+  class Construct_barycentric_coordinate
+  {
+  public:
+    typedef Barycentric_coordinate result_type;
+
+    result_type operator() (const FT& a, const FT& b, const FT& c) const
+    {
+      Barycentric_coordinate output;
+      output[0] = a;
+      output[1] = b;
+      output[2] = c;
+      return output;
+    }
+  };
+
+  class Construct_barycentric_coordinate_weight
+  {
+  public:
+    typedef FT result_type;
+
+    result_type operator() (const Barycentric_coordinate b, std::size_t i) const
+    {
+      return b[i % 3];
+    }
+  };
+
+  typedef typename Surface_mesh_shortest_paths_3::Construct_triangle_3_to_triangle_2_projection<K> Construct_triangle_3_to_triangle_2_projection;
+  typedef typename Surface_mesh_shortest_paths_3::Construct_triangle_3_along_segment_2_flattening<K> Construct_triangle_3_along_segment_2_flattening;
+  typedef typename Surface_mesh_shortest_paths_3::Compute_parametric_distance_along_segment_2<K> Compute_parametric_distance_along_segment_2;
+  typedef typename Surface_mesh_shortest_paths_3::Construct_barycentric_coordinate_in_triangle_2<K, Barycentric_coordinate, Construct_barycentric_coordinate> Construct_barycentric_coordinate_in_triangle_2;
+  typedef typename Surface_mesh_shortest_paths_3::Construct_barycentric_coordinate_in_triangle_3<K, Barycentric_coordinate, Construct_barycentric_coordinate> Construct_barycentric_coordinate_in_triangle_3;
+  typedef typename Surface_mesh_shortest_paths_3::Classify_barycentric_coordinate<Barycentric_coordinate, Construct_barycentric_coordinate_weight> Classify_barycentric_coordinate;
+
+private:
+  Kernel m_kernel;
+  Construct_barycentric_coordinate m_construct_barycentric_coordinate_object;
+  Construct_barycentric_coordinate_weight m_construct_barycentric_coordinate_weight_object;
+  Classify_barycentric_coordinate m_classify_barycentric_coordinate_object;
+  Construct_triangle_3_to_triangle_2_projection m_construct_triangle_3_to_triangle_2_projection_object;
+  Construct_triangle_3_along_segment_2_flattening m_construct_triangle_3_along_segment_2_flattening_object;
+  Construct_barycentric_coordinate_in_triangle_2 m_construct_barycentric_coordinate_in_triangle_2_object;
+  Construct_barycentric_coordinate_in_triangle_3 m_construct_barycentric_coordinate_in_triangle_3_object;
+  Compare_relative_intersection_along_segment_2 m_compare_relative_intersection_along_segment_2_object;
+  Is_saddle_vertex m_is_saddle_vertex_object;
+  Compute_parametric_distance_along_segment_2 m_compute_parametric_distance_along_segment_2_object;
+
+public:
+
+  Surface_mesh_shortest_path_traits()
+  {
+  }
+
+  Surface_mesh_shortest_path_traits(const Kernel& kernel)
+    : m_kernel(kernel)
+    , m_classify_barycentric_coordinate_object(m_construct_barycentric_coordinate_weight_object)
+    , m_construct_triangle_3_to_triangle_2_projection_object(m_kernel)
+    , m_construct_triangle_3_along_segment_2_flattening_object(m_kernel)
+    , m_is_saddle_vertex_object(m_kernel, m_construct_triangle_3_to_triangle_2_projection_object, m_construct_triangle_3_along_segment_2_flattening_object)
+    , m_compare_relative_intersection_along_segment_2_object(m_kernel)
+    , m_construct_barycentric_coordinate_in_triangle_2_object(m_construct_barycentric_coordinate_object, m_kernel.construct_vector_2_object(), m_kernel.compute_scalar_product_2_object())
+    , m_construct_barycentric_coordinate_in_triangle_3_object(m_construct_barycentric_coordinate_object, m_kernel.construct_vector_3_object(), m_kernel.compute_scalar_product_3_object())
+  {
+  }
+
+  Construct_barycentric_coordinate construct_barycentric_coordinate_object() const { return m_construct_barycentric_coordinate_object; }
+  Construct_barycentric_coordinate_weight construct_barycentric_coordinate_weight_object() const { return m_construct_barycentric_coordinate_weight_object; }
+  Classify_barycentric_coordinate classify_barycentric_coordinate_object() const { return m_classify_barycentric_coordinate_object; }
+
+  Is_saddle_vertex is_saddle_vertex_object() const { return m_is_saddle_vertex_object; }
+
+  Compare_relative_intersection_along_segment_2 compare_relative_intersection_along_segment_2_object() const { return m_compare_relative_intersection_along_segment_2_object; }
+  Construct_triangle_3_to_triangle_2_projection construct_triangle_3_to_triangle_2_projection_object() const { return m_construct_triangle_3_to_triangle_2_projection_object; }
+  Construct_triangle_3_along_segment_2_flattening construct_triangle_3_along_segment_2_flattening_object() const { return m_construct_triangle_3_along_segment_2_flattening_object; }
+  Construct_barycentric_coordinate_in_triangle_2 construct_barycentric_coordinate_in_triangle_2_object() const { return m_construct_barycentric_coordinate_in_triangle_2_object; }
+  Construct_barycentric_coordinate_in_triangle_3 construct_barycentric_coordinate_in_triangle_3_object() const { return m_construct_barycentric_coordinate_in_triangle_3_object; }
+  Compute_parametric_distance_along_segment_2 compute_parametric_distance_along_segment_2_object() const { return m_compute_parametric_distance_along_segment_2_object; }
+};
+
+template <class Kernel, class Triangle_mesh>
+std::ostream& operator<<(std::ostream& os, typename Surface_mesh_shortest_path_traits<Kernel, Triangle_mesh>::Barycentric_coordinate b)
+{
+  return os << b[0] << " " << b[1] << " " << b[2];
+}
+
+#ifndef DOXYGEN_RUNNING // needed due to a bug in doxygen
+/*!
+\ingroup PkgSurfaceMeshShortestPathTraitsClasses
+
+\internal
+
+\brief Provides an implementation of the SurfaceMeshShortestPathTraits
+model which uses an exact Kernel during the unfolding operations to achieve better overall precision
+
+\tparam K Kernel Type
+
+\tparam TriangleMesh triangle mesh type
+
+\cgalModels `SurfaceMeshShortestPathTraits`
+*/
+template <
+  class K,
+  class TriangleMesh>
+class Surface_mesh_shortest_path_traits_with_robust_unfolding : public Surface_mesh_shortest_path_traits<K,TriangleMesh>
+{
+public:
+  typedef K Kernel;
+  typedef typename Surface_mesh_shortest_paths_3::Robust_project_triangle_3_to_triangle_2<K> Construct_triangle_3_to_triangle_2_projection;
+  typedef typename Surface_mesh_shortest_paths_3::Robust_flatten_triangle_3_along_segment_2<K> Construct_triangle_3_along_segment_2_flattening;
+
+private:
+
+  Construct_triangle_3_to_triangle_2_projection m_robust_construct_triangle_3_to_triangle_2_projection_object;
+  Construct_triangle_3_along_segment_2_flattening m_robust_flatten_triangle_3_along_segment_2;
+
+public:
+
+  Surface_mesh_shortest_path_traits_with_robust_unfolding()
+  {
+  }
+
+  Surface_mesh_shortest_path_traits_with_robust_unfolding(const Kernel& kernel)
+    : Surface_mesh_shortest_path_traits<K,TriangleMesh>(kernel)
+    , m_robust_construct_triangle_3_to_triangle_2_projection_object(kernel)
+    , m_robust_flatten_triangle_3_along_segment_2(kernel)
+  {
+  }
+
+  Construct_triangle_3_to_triangle_2_projection construct_triangle_3_to_triangle_2_projection_object() const { return m_robust_construct_triangle_3_to_triangle_2_projection_object; }
+  Construct_triangle_3_along_segment_2_flattening construct_triangle_3_along_segment_2_flattening_object() const { return m_robust_flatten_triangle_3_along_segment_2; }
+};
+#endif
+
+} // namespace CGAL
+
+
+#endif // CGAL_SURFACE_MESH_SHORTEST_PATH_TRAITS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_shortest_path/barycentric.h b/3rdparty/CGAL/include/CGAL/Surface_mesh_shortest_path/barycentric.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_shortest_path/barycentric.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesh_shortest_path/barycentric.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_shortest_path/function_objects.h b/3rdparty/CGAL/include/CGAL/Surface_mesh_shortest_path/function_objects.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_shortest_path/function_objects.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesh_shortest_path/function_objects.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_shortest_path/internal/Cone_expansion_event.h b/3rdparty/CGAL/include/CGAL/Surface_mesh_shortest_path/internal/Cone_expansion_event.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_shortest_path/internal/Cone_expansion_event.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesh_shortest_path/internal/Cone_expansion_event.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_shortest_path/internal/Cone_tree.h b/3rdparty/CGAL/include/CGAL/Surface_mesh_shortest_path/internal/Cone_tree.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_shortest_path/internal/Cone_tree.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesh_shortest_path/internal/Cone_tree.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_shortest_path/internal/misc_functions.h b/3rdparty/CGAL/include/CGAL/Surface_mesh_shortest_path/internal/misc_functions.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_shortest_path/internal/misc_functions.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesh_shortest_path/internal/misc_functions.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/Detail/Common.h b/3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/Detail/Common.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/Detail/Common.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/Detail/Common.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/Detail/Edge_collapse.h b/3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/Detail/Edge_collapse.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/Detail/Edge_collapse.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/Detail/Edge_collapse.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/Detail/Edge_collapse_impl.h b/3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/Detail/Edge_collapse_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/Detail/Edge_collapse_impl.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/Detail/Edge_collapse_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/Edge_collapse_visitor_base.h b/3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/Edge_collapse_visitor_base.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/Edge_collapse_visitor_base.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/Edge_collapse_visitor_base.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/HalfedgeGraph_Polyhedron_3.h b/3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/HalfedgeGraph_Polyhedron_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/HalfedgeGraph_Polyhedron_3.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/HalfedgeGraph_Polyhedron_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Constrained_placement.h b/3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Constrained_placement.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Constrained_placement.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Constrained_placement.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_ratio_stop_predicate.h b/3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_ratio_stop_predicate.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_ratio_stop_predicate.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_ratio_stop_predicate.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h b/3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Detail/Lindstrom_Turk_core.h b/3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Detail/Lindstrom_Turk_core.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Detail/Lindstrom_Turk_core.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Detail/Lindstrom_Turk_core.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Detail/Lindstrom_Turk_core_impl.h b/3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Detail/Lindstrom_Turk_core_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Detail/Lindstrom_Turk_core_impl.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Detail/Lindstrom_Turk_core_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_length_cost.h b/3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_length_cost.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_length_cost.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_length_cost.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_profile.h b/3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_profile.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_profile.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_profile.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_profile_impl.h b/3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_profile_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_profile_impl.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_profile_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk.h b/3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_cost.h b/3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_cost.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_cost.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_cost.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_params.h b/3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_params.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_params.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_params.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_placement.h b/3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_placement.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_placement.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_placement.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Midpoint_and_length.h b/3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Midpoint_and_length.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Midpoint_and_length.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Midpoint_and_length.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Midpoint_placement.h b/3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Midpoint_placement.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Midpoint_placement.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Midpoint_placement.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/edge_collapse.h b/3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/edge_collapse.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_simplification/edge_collapse.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesh_simplification/edge_collapse.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_traits_generator_3.h b/3rdparty/CGAL/include/CGAL/Surface_mesh_traits_generator_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_traits_generator_3.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesh_traits_generator_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_triangulation_generator_3.h b/3rdparty/CGAL/include/CGAL/Surface_mesh_triangulation_generator_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_triangulation_generator_3.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesh_triangulation_generator_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_vertex_base_3.h b/3rdparty/CGAL/include/CGAL/Surface_mesh_vertex_base_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesh_vertex_base_3.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesh_vertex_base_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Combining_oracle.h b/3rdparty/CGAL/include/CGAL/Surface_mesher/Combining_oracle.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Combining_oracle.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesher/Combining_oracle.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Has_edges.h b/3rdparty/CGAL/include/CGAL/Surface_mesher/Has_edges.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Has_edges.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesher/Has_edges.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Implicit_surface_oracle_3.h b/3rdparty/CGAL/include/CGAL/Surface_mesher/Implicit_surface_oracle_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Implicit_surface_oracle_3.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesher/Implicit_surface_oracle_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Intersection_data_structure_3.h b/3rdparty/CGAL/include/CGAL/Surface_mesher/Intersection_data_structure_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Intersection_data_structure_3.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesher/Intersection_data_structure_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Null_oracle_visitor.h b/3rdparty/CGAL/include/CGAL/Surface_mesher/Null_oracle_visitor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Null_oracle_visitor.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesher/Null_oracle_visitor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Point_surface_indices_oracle_visitor.h b/3rdparty/CGAL/include/CGAL/Surface_mesher/Point_surface_indices_oracle_visitor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Point_surface_indices_oracle_visitor.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesher/Point_surface_indices_oracle_visitor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Poisson_implicit_surface_oracle_3.h b/3rdparty/CGAL/include/CGAL/Surface_mesher/Poisson_implicit_surface_oracle_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Poisson_implicit_surface_oracle_3.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesher/Poisson_implicit_surface_oracle_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Polyhedral_oracle.h b/3rdparty/CGAL/include/CGAL/Surface_mesher/Polyhedral_oracle.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Polyhedral_oracle.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesher/Polyhedral_oracle.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Profile_counter.h b/3rdparty/CGAL/include/CGAL/Surface_mesher/Profile_counter.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Profile_counter.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesher/Profile_counter.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Profile_timer.h b/3rdparty/CGAL/include/CGAL/Surface_mesher/Profile_timer.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Profile_timer.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesher/Profile_timer.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Sphere_oracle_3.h b/3rdparty/CGAL/include/CGAL/Surface_mesher/Sphere_oracle_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Sphere_oracle_3.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesher/Sphere_oracle_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Standard_criteria.h b/3rdparty/CGAL/include/CGAL/Surface_mesher/Standard_criteria.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Standard_criteria.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesher/Standard_criteria.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Surface_mesher.h b/3rdparty/CGAL/include/CGAL/Surface_mesher/Surface_mesher.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Surface_mesher.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesher/Surface_mesher.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Surface_mesher_edges_level.h b/3rdparty/CGAL/include/CGAL/Surface_mesher/Surface_mesher_edges_level.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Surface_mesher_edges_level.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesher/Surface_mesher_edges_level.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Surface_mesher_edges_level_visitor.h b/3rdparty/CGAL/include/CGAL/Surface_mesher/Surface_mesher_edges_level_visitor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Surface_mesher_edges_level_visitor.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesher/Surface_mesher_edges_level_visitor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Surface_mesher_manifold.h b/3rdparty/CGAL/include/CGAL/Surface_mesher/Surface_mesher_manifold.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Surface_mesher_manifold.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesher/Surface_mesher_manifold.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Surface_mesher_regular_edges.h b/3rdparty/CGAL/include/CGAL/Surface_mesher/Surface_mesher_regular_edges.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Surface_mesher_regular_edges.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesher/Surface_mesher_regular_edges.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Surface_mesher_visitor.h b/3rdparty/CGAL/include/CGAL/Surface_mesher/Surface_mesher_visitor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Surface_mesher_visitor.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesher/Surface_mesher_visitor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Types_generators.h b/3rdparty/CGAL/include/CGAL/Surface_mesher/Types_generators.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Types_generators.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesher/Types_generators.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Verbose_flag.h b/3rdparty/CGAL/include/CGAL/Surface_mesher/Verbose_flag.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Verbose_flag.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesher/Verbose_flag.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Vertices_on_the_same_psc_element_criterion.h b/3rdparty/CGAL/include/CGAL/Surface_mesher/Vertices_on_the_same_psc_element_criterion.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Vertices_on_the_same_psc_element_criterion.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesher/Vertices_on_the_same_psc_element_criterion.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Vertices_on_the_same_surface_criterion.h b/3rdparty/CGAL/include/CGAL/Surface_mesher/Vertices_on_the_same_surface_criterion.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesher/Vertices_on_the_same_surface_criterion.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesher/Vertices_on_the_same_surface_criterion.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Surface_mesher_generator.h b/3rdparty/CGAL/include/CGAL/Surface_mesher_generator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Surface_mesher_generator.h
rename to 3rdparty/CGAL/include/CGAL/Surface_mesher_generator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2.h b/3rdparty/CGAL/include/CGAL/Sweep_line_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2.h
rename to 3rdparty/CGAL/include/CGAL/Sweep_line_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Arr_basic_insertion_sl_visitor.h b/3rdparty/CGAL/include/CGAL/Sweep_line_2/Arr_basic_insertion_sl_visitor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Arr_basic_insertion_sl_visitor.h
rename to 3rdparty/CGAL/include/CGAL/Sweep_line_2/Arr_basic_insertion_sl_visitor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Arr_basic_insertion_traits_2.h b/3rdparty/CGAL/include/CGAL/Sweep_line_2/Arr_basic_insertion_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Arr_basic_insertion_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Sweep_line_2/Arr_basic_insertion_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Arr_batched_pl_sl_visitor.h b/3rdparty/CGAL/include/CGAL/Sweep_line_2/Arr_batched_pl_sl_visitor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Arr_batched_pl_sl_visitor.h
rename to 3rdparty/CGAL/include/CGAL/Sweep_line_2/Arr_batched_pl_sl_visitor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Arr_construction_event.h b/3rdparty/CGAL/include/CGAL/Sweep_line_2/Arr_construction_event.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Arr_construction_event.h
rename to 3rdparty/CGAL/include/CGAL/Sweep_line_2/Arr_construction_event.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Arr_construction_sl_visitor.h b/3rdparty/CGAL/include/CGAL/Sweep_line_2/Arr_construction_sl_visitor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Arr_construction_sl_visitor.h
rename to 3rdparty/CGAL/include/CGAL/Sweep_line_2/Arr_construction_sl_visitor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Arr_construction_subcurve.h b/3rdparty/CGAL/include/CGAL/Sweep_line_2/Arr_construction_subcurve.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Arr_construction_subcurve.h
rename to 3rdparty/CGAL/include/CGAL/Sweep_line_2/Arr_construction_subcurve.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Arr_default_overlay_traits_base.h b/3rdparty/CGAL/include/CGAL/Sweep_line_2/Arr_default_overlay_traits_base.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Arr_default_overlay_traits_base.h
rename to 3rdparty/CGAL/include/CGAL/Sweep_line_2/Arr_default_overlay_traits_base.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Arr_insertion_sl_visitor.h b/3rdparty/CGAL/include/CGAL/Sweep_line_2/Arr_insertion_sl_visitor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Arr_insertion_sl_visitor.h
rename to 3rdparty/CGAL/include/CGAL/Sweep_line_2/Arr_insertion_sl_visitor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Arr_insertion_traits_2.h b/3rdparty/CGAL/include/CGAL/Sweep_line_2/Arr_insertion_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Arr_insertion_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Sweep_line_2/Arr_insertion_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Arr_overlay_sl_visitor.h b/3rdparty/CGAL/include/CGAL/Sweep_line_2/Arr_overlay_sl_visitor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Arr_overlay_sl_visitor.h
rename to 3rdparty/CGAL/include/CGAL/Sweep_line_2/Arr_overlay_sl_visitor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Arr_overlay_subcurve.h b/3rdparty/CGAL/include/CGAL/Sweep_line_2/Arr_overlay_subcurve.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Arr_overlay_subcurve.h
rename to 3rdparty/CGAL/include/CGAL/Sweep_line_2/Arr_overlay_subcurve.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Arr_overlay_traits_2.h b/3rdparty/CGAL/include/CGAL/Sweep_line_2/Arr_overlay_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Arr_overlay_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Sweep_line_2/Arr_overlay_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Arr_vert_decomp_sl_visitor.h b/3rdparty/CGAL/include/CGAL/Sweep_line_2/Arr_vert_decomp_sl_visitor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Arr_vert_decomp_sl_visitor.h
rename to 3rdparty/CGAL/include/CGAL/Sweep_line_2/Arr_vert_decomp_sl_visitor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Basic_sweep_line_2_impl.h b/3rdparty/CGAL/include/CGAL/Sweep_line_2/Basic_sweep_line_2_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Basic_sweep_line_2_impl.h
rename to 3rdparty/CGAL/include/CGAL/Sweep_line_2/Basic_sweep_line_2_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Sweep_line_2_debug.h b/3rdparty/CGAL/include/CGAL/Sweep_line_2/Sweep_line_2_debug.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Sweep_line_2_debug.h
rename to 3rdparty/CGAL/include/CGAL/Sweep_line_2/Sweep_line_2_debug.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Sweep_line_2_impl.h b/3rdparty/CGAL/include/CGAL/Sweep_line_2/Sweep_line_2_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Sweep_line_2_impl.h
rename to 3rdparty/CGAL/include/CGAL/Sweep_line_2/Sweep_line_2_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Sweep_line_2_utils.h b/3rdparty/CGAL/include/CGAL/Sweep_line_2/Sweep_line_2_utils.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Sweep_line_2_utils.h
rename to 3rdparty/CGAL/include/CGAL/Sweep_line_2/Sweep_line_2_utils.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Sweep_line_2_visitors.h b/3rdparty/CGAL/include/CGAL/Sweep_line_2/Sweep_line_2_visitors.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Sweep_line_2_visitors.h
rename to 3rdparty/CGAL/include/CGAL/Sweep_line_2/Sweep_line_2_visitors.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Sweep_line_curve_pair.h b/3rdparty/CGAL/include/CGAL/Sweep_line_2/Sweep_line_curve_pair.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Sweep_line_curve_pair.h
rename to 3rdparty/CGAL/include/CGAL/Sweep_line_2/Sweep_line_curve_pair.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Sweep_line_event.h b/3rdparty/CGAL/include/CGAL/Sweep_line_2/Sweep_line_event.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Sweep_line_event.h
rename to 3rdparty/CGAL/include/CGAL/Sweep_line_2/Sweep_line_event.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Sweep_line_functors.h b/3rdparty/CGAL/include/CGAL/Sweep_line_2/Sweep_line_functors.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Sweep_line_functors.h
rename to 3rdparty/CGAL/include/CGAL/Sweep_line_2/Sweep_line_functors.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Sweep_line_subcurve.h b/3rdparty/CGAL/include/CGAL/Sweep_line_2/Sweep_line_subcurve.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2/Sweep_line_subcurve.h
rename to 3rdparty/CGAL/include/CGAL/Sweep_line_2/Sweep_line_subcurve.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2_algorithms.h b/3rdparty/CGAL/include/CGAL/Sweep_line_2_algorithms.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sweep_line_2_algorithms.h
rename to 3rdparty/CGAL/include/CGAL/Sweep_line_2_algorithms.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Sweep_line_empty_visitor.h b/3rdparty/CGAL/include/CGAL/Sweep_line_empty_visitor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Sweep_line_empty_visitor.h
rename to 3rdparty/CGAL/include/CGAL/Sweep_line_empty_visitor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/TDS_full_cell_default_storage_policy.h b/3rdparty/CGAL/include/CGAL/TDS_full_cell_default_storage_policy.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/TDS_full_cell_default_storage_policy.h
rename to 3rdparty/CGAL/include/CGAL/TDS_full_cell_default_storage_policy.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/TDS_full_cell_mirror_storage_policy.h b/3rdparty/CGAL/include/CGAL/TDS_full_cell_mirror_storage_policy.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/TDS_full_cell_mirror_storage_policy.h
rename to 3rdparty/CGAL/include/CGAL/TDS_full_cell_mirror_storage_policy.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Taucs_fix.h b/3rdparty/CGAL/include/CGAL/Taucs_fix.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Taucs_fix.h
rename to 3rdparty/CGAL/include/CGAL/Taucs_fix.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Taucs_matrix.h b/3rdparty/CGAL/include/CGAL/Taucs_matrix.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Taucs_matrix.h
rename to 3rdparty/CGAL/include/CGAL/Taucs_matrix.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Taucs_solver_traits.h b/3rdparty/CGAL/include/CGAL/Taucs_solver_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Taucs_solver_traits.h
rename to 3rdparty/CGAL/include/CGAL/Taucs_solver_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Taucs_vector.h b/3rdparty/CGAL/include/CGAL/Taucs_vector.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Taucs_vector.h
rename to 3rdparty/CGAL/include/CGAL/Taucs_vector.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Tetrahedron_3.h b/3rdparty/CGAL/include/CGAL/Tetrahedron_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Tetrahedron_3.h
rename to 3rdparty/CGAL/include/CGAL/Tetrahedron_3.h
diff --git a/3rdparty/CGAL/include/CGAL/Three/Polyhedron_demo_io_plugin_interface.h b/3rdparty/CGAL/include/CGAL/Three/Polyhedron_demo_io_plugin_interface.h
new file mode 100644
index 0000000..15891ce
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Three/Polyhedron_demo_io_plugin_interface.h
@@ -0,0 +1,62 @@
+// Copyright (c) 2009,2010,2012  GeometryFactory Sarl (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
+// 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(s)     : Laurent RINEAU
+//! \file Polyhedron_demo_io_plugin_interface.h
+#ifndef POLYHEDRON_DEMO_IO_PLUGIN_INTERFACE_H
+#define POLYHEDRON_DEMO_IO_PLUGIN_INTERFACE_H
+
+#include <QFileInfo>
+#include <QStringList>
+
+namespace CGAL{
+namespace Three {
+class Scene_item;
+  /*!
+   * This class provides a base for creating a new IO plugin.
+   */
+class Polyhedron_demo_io_plugin_interface 
+{
+public:
+  //!Returns the name of the plugin
+  virtual QString name() const = 0;
+  virtual ~Polyhedron_demo_io_plugin_interface() {}
+  /*! The filters for the names of the files that can be used
+   * by the plugin.
+   * Example : to filter OFF files : return "OFF files (*.off)"
+*/
+  virtual QString nameFilters() const = 0;
+  virtual QString saveNameFilters() const {return nameFilters();}
+  virtual QString loadNameFilters() const {return nameFilters();}
+
+  //! Specifies if the io_plugin is able to load an item or not.
+  virtual bool canLoad() const = 0;
+  //!  Loads an item from a file.
+  virtual Scene_item* load(QFileInfo fileinfo) = 0;
+  //!Specifies if the io_plugin can save the item or not.
+  virtual bool canSave(const Scene_item*) = 0;
+  //!Saves the item in the file corresponding to the path
+  //!contained in fileinfo. Returns false if error.
+  virtual bool save(const Scene_item*, QFileInfo fileinfo) = 0;
+};
+}
+}
+Q_DECLARE_INTERFACE(CGAL::Three::Polyhedron_demo_io_plugin_interface,
+                    "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0")
+
+#endif // POLYHEDRON_DEMO_IO_PLUGIN_INTERFACE_H
diff --git a/3rdparty/CGAL/include/CGAL/Three/Polyhedron_demo_plugin_helper.h b/3rdparty/CGAL/include/CGAL/Three/Polyhedron_demo_plugin_helper.h
new file mode 100644
index 0000000..fc3abde
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Three/Polyhedron_demo_plugin_helper.h
@@ -0,0 +1,95 @@
+// Copyright (c) 2009,2014,2015  GeometryFactory Sarl (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
+// 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(s)     : Laurent RINEAU
+
+//! \file Polyhedron_demo_plugin_helper.h 
+#ifndef POLYHEDRON_DEMO_OPERATION_HELPER_H
+#define POLYHEDRON_DEMO_OPERATION_HELPER_H
+
+#include "Scene_item_config.h" //defines SCENE_ITEM_EXPORT
+
+#include <QString>
+#include <QStringList>
+#include <QMap>
+
+class QAction;
+struct QMetaObject;
+class QMainWindow;
+class QDockWidget;
+
+#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
+#include <CGAL/Three/Scene_interface.h>
+namespace CGAL {
+namespace Three {
+  /*! \brief Provides convenient functions for a plugin.
+   * This class provides convenient functions to manage dock_widgets and to access a certain type of items in the scene.
+   * It also provides member variables for a Scene_interface and a QMainWindow.
+   */
+class SCENE_ITEM_EXPORT Polyhedron_demo_plugin_helper
+  : public Polyhedron_demo_plugin_interface
+{
+public:
+
+  /*! \brief Gets an item of the templated type.
+   *
+   * The function first checks if the selected item is of the wanted type. If not, it  will look in the scene entries if there is at least one item of the
+   * right type, make it the selection and return it.
+   * \return the first item found with the templated type
+   * \return NULL if none is found
+   */
+  template<class SceneType>
+  SceneType* getSelectedItem() const{
+   int item_id = scene->mainSelectionIndex();
+   SceneType* scene_item = qobject_cast<SceneType*>(scene->item(item_id));
+   if(!scene_item) {
+     // no selected SceneType - if there is only one in list return it, otherwise NULL
+     int counter = 0;
+     int last_selected = 0;
+     for(CGAL::Three::Scene_interface::Item_id i = 0, end = scene->numberOfEntries(); i < end && counter < 2; ++i) {
+       if(SceneType* tmp = qobject_cast<SceneType*>(scene->item(i))) {
+         scene_item = tmp;
+         counter++;
+         last_selected=i;
+       }
+     }
+     if(counter != 1) { return NULL; }
+     scene->setSelectedItem(last_selected);
+   }
+   return scene_item;
+ }
+
+  /*! \brief Adds a dock widget to the interface
+   *
+   * Adds a dock widget in the left section of the MainWindow. If the slot is already taken, the dock widgets will be tabified.
+   */
+  void addDockWidget(QDockWidget* dock);
+  /*! \brief Automatically connects each action of the plugin to the corresponding slot.
+   *
+   * All actions in actions() must have their slot name on_ActionsName_triggered().
+   */
+  void autoConnectActions();
+protected:
+  //!The reference to the scene
+  CGAL::Three::Scene_interface* scene;
+  //!The reference to the main window
+  QMainWindow* mw;
+};
+}
+}
+#endif // POLYHEDRON_DEMO_OPERATION_HELPER_H
diff --git a/3rdparty/CGAL/include/CGAL/Three/Polyhedron_demo_plugin_interface.h b/3rdparty/CGAL/include/CGAL/Three/Polyhedron_demo_plugin_interface.h
new file mode 100644
index 0000000..bec6d53
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Three/Polyhedron_demo_plugin_interface.h
@@ -0,0 +1,63 @@
+// Copyright (c) 2009-2015  GeometryFactory Sarl (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
+// 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(s)     : Laurent RINEAU
+
+//! \file Polyhedron_demo_plugin_interface.h
+#ifndef POLYHEDRON_DEMO_PLUGIN_INTERFACE_H
+#define POLYHEDRON_DEMO_PLUGIN_INTERFACE_H
+
+#include <QString>
+#include <QList>
+#include <QtPlugin>
+#include <QDebug>
+
+class QAction;
+class QMainWindow;
+class Messages_interface;
+namespace CGAL {
+namespace Three {
+class Scene_interface;
+  /*!
+   * This class gives some virtual functions to help making a plugin
+   */
+class Polyhedron_demo_plugin_interface 
+{
+public:
+  //! Initializes the plugin and gives access to a Message interface, that
+  //! can be used to display messages in the console dock widget.
+  //! @see init(QMainWindow*, CGAL::Three::Scene_interface*)
+  virtual void init(QMainWindow* , CGAL::Three::Scene_interface* , Messages_interface*) = 0;
+
+  //! Decides if the plugin's actions will be displayed or not.
+  //! @returns \c true, if the plugin is applicable, \c false
+  //! otherwise
+  virtual bool applicable(QAction*) const = 0;
+  //!The list of the actions of the plugin.
+  virtual QList<QAction*> actions() const = 0;
+  //!If you need to do something when the plugin is closed, do it here
+  virtual void closure() {
+ }
+protected :
+};
+}
+}
+Q_DECLARE_INTERFACE(CGAL::Three::Polyhedron_demo_plugin_interface,
+                    "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
+
+#endif // POLYHEDRON_DEMO_PLUGIN_INTERFACE_H
diff --git a/3rdparty/CGAL/include/CGAL/Three/Scene_draw_interface.h b/3rdparty/CGAL/include/CGAL/Three/Scene_draw_interface.h
new file mode 100644
index 0000000..fad8b01
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Three/Scene_draw_interface.h
@@ -0,0 +1,60 @@
+// Copyright (c) 2009,2010,2012,2015  GeometryFactory Sarl (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
+// 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(s)     : Laurent RINEAU
+
+#ifndef SCENE_DRAW_INTERFACE_H
+#define SCENE_DRAW_INTERFACE_H
+#include <QPoint>
+class QKeyEvent;
+class QPoint;
+namespace CGAL
+{
+namespace Three {
+  class Viewer_interface;
+
+
+// Base class to interact with the scene from the viewer.
+class Scene_draw_interface {
+public:
+  virtual ~Scene_draw_interface(){}
+  virtual void initializeGL() = 0;
+  virtual void draw(CGAL::Three::Viewer_interface*) = 0;
+  virtual void drawWithNames(CGAL::Three::Viewer_interface*) = 0;
+ /*! Sets the screen coordinates of the currently picked point.*/
+  virtual void setPickedPixel(const QPoint &e) = 0;
+  virtual bool keyPressEvent(QKeyEvent* e) = 0;
+  virtual float get_bbox_length() const = 0;
+  virtual void printPrimitiveId(QPoint point, CGAL::Three::Viewer_interface*) = 0;
+
+  /*!
+   * \brief testDisplayId checks if the id at position (x,y,z) is visible or not.
+   * \param x the X coordinate of the id's position.
+   * \param y the Y coordinate of the id's position.
+   * \param z the Z coordinate of the id's position.
+   * \param viewer the viewer used to display the Scene.
+   * \return true if the ID is visible. */
+  virtual bool  testDisplayId(double x, double y, double z, CGAL::Three::Viewer_interface* viewer) = 0;
+ /*!
+   * \brief printPrimitiveIds displays all the Ids if there are less than max_textItems.
+   */
+  virtual void printPrimitiveIds(CGAL::Three::Viewer_interface*) = 0;
+};
+}
+}
+#endif // SCENE_DRAW_INTERFACE_H;
diff --git a/3rdparty/CGAL/include/CGAL/Three/Scene_group_item.h b/3rdparty/CGAL/include/CGAL/Three/Scene_group_item.h
new file mode 100644
index 0000000..4735f40
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Three/Scene_group_item.h
@@ -0,0 +1,172 @@
+// Copyright (c) 2015  GeometryFactory Sarl (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
+// 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(s)     : Maxime Gimeno
+
+
+#ifndef SCENE_GROUP_ITEM_H
+#define SCENE_GROUP_ITEM_H
+
+#include <CGAL/Three/Scene_item.h>
+#include <CGAL/Three/Scene_interface.h>
+using namespace CGAL::Three;
+
+#include <QtCore/qglobal.h>
+#ifdef demo_framework_EXPORTS
+#  define DEMO_FRAMEWORK_EXPORT Q_DECL_EXPORT
+#else
+#  define DEMO_FRAMEWORK_EXPORT Q_DECL_IMPORT
+#endif
+namespace CGAL {
+namespace Three {
+//!A Scene_group_item is a virtual Scene_item that does not draw anything,
+//! but regroups other items as its children. It allows the
+//! user to apply several actions to multiple items at the same time.
+class DEMO_FRAMEWORK_EXPORT Scene_group_item : public Scene_item
+{
+    Q_OBJECT
+public :
+    Scene_group_item(QString name = QString("New group"), int nb_vbos = 0, int nb_vaos = 0);
+    ~Scene_group_item() {}
+    //!Sets the scene;
+    void setScene(Scene_interface* s) { scene = s; }
+    //!Returns false to avoid disturbing the BBox of the scene.
+    bool isFinite() const;
+    //!Returns true to avoid disturbing the BBox of the scene.
+    bool isEmpty() const ;
+    /*!
+     * \brief Locks a child
+     * A locked child cannot be moved out of the group nor can it be deleted.
+     */
+    void lockChild(CGAL::Three::Scene_item*);
+    /*!
+     * \brief Unlocks a child
+     * @see lockChild()
+     */
+    void unlockChild(CGAL::Three::Scene_item*);
+    /*!
+     * \brief Tells if a child is locked.
+     * \return true if the child is locked.
+     * @see lockChild()
+     */
+    bool isChildLocked(CGAL::Three::Scene_item*);
+    //!Returns if the group_item is currently expanded or collapsed in the view.
+    //! True means expanded, false means collapsed.
+    //! @see setExpanded.
+    bool isExpanded() const;
+    //!Makes the group_item expanded or collapsed in the view.
+    //! True means expanded, false means collapsed.
+    void setExpanded(bool);
+    //! @see isExpanded.
+    //!Returns an empty BBox to avoid disturbing the BBox of the scene.
+    Bbox bbox() const;
+    //!Not supported.
+    Scene_item* clone() const {return 0;}
+    //! Indicates if the rendering mode is supported.
+    bool supportsRenderingMode(RenderingMode m) const;
+    //!Prints the number of children.
+    QString toolTip() const;
+
+    /// Draw functions
+    ///@{
+    virtual void draw(CGAL::Three::Viewer_interface*) const;
+    virtual void drawEdges(CGAL::Three::Viewer_interface*) const;
+    virtual void drawPoints(CGAL::Three::Viewer_interface*) const;
+    virtual void drawSplats(CGAL::Three::Viewer_interface*) const;
+    ///@}
+
+    //!Adds a Scene_item* to the list of children.
+    //!@see getChildren. @see removeChild.
+    void addChild(Scene_item* new_item);
+    //!Sets all the children to the specified color.
+    void setColor(QColor c);
+    //!Sets all the children in the specified rendering mode.
+    void setRenderingMode(RenderingMode m);
+    //!Sets all the children to the specified visibility.
+    void setVisible(bool b);
+    //!Sets all the children in points mode.
+    void setPointsMode() {
+      setRenderingMode(Points);
+    }
+    //!Sets all the children in wireframe rendering.
+    void setWireframeMode() {
+      setRenderingMode(Wireframe);
+    }
+    //!Sets all the children in wireframe rendering.
+    void setWireframe() {
+      setRenderingMode(Wireframe);
+    }
+    //!Sets all the children in flat rendering.
+    void setFlat() {
+      setRenderingMode(Flat);
+    }
+    //!Sets all the children in flat rendering.
+    void setFlatMode() {
+      setRenderingMode(Flat);
+    }
+    //!Sets all the children in flat rendering with edges.
+    void setFlatPlusEdgesMode() {
+      setRenderingMode(FlatPlusEdges);
+    }
+    //!Sets all the children in smooth rendering.
+    void setGouraudMode() {
+      setRenderingMode(Gouraud);
+    }
+    //!Sets all the children in point rendering with normals.
+    void setPointsPlusNormalsMode(){
+      setRenderingMode(PointsPlusNormals);
+    }
+    //!Sets all the children in splat rendering.
+    void setSplattingMode(){
+      setRenderingMode(Splatting);
+    }
+    //!Returns a list of all the direct children.
+    QList<Scene_item*> getChildren() const {return children;}
+    //!Removes a Scene_item from the list of children.
+    //!@see getChildren @see addChild
+    void removeChild( Scene_item* item)
+    {
+     if(isChildLocked(item))
+      return;
+     update_group_number(item,0);
+     children.removeOne(item);
+    }
+    //!Moves a child up in the list.
+    void moveUp(int);
+    //!Moves a child down in the list.
+    void moveDown(int);
+
+public Q_SLOTS:
+    void resetDraw() { already_drawn = false;}
+private:
+    //!Updates the property has_group for each group and sub-groups containing new_item.
+    void update_group_number(Scene_item*new_item, int n);
+
+    bool expanded;
+    mutable bool already_drawn;
+protected:
+    Scene_interface *scene;
+    //!Contains a reference to all the children of this group.
+    QList<Scene_item*> children;
+
+}; //end of class Scene_group_item
+
+}
+}
+
+#endif // SCENE_GROUP_ITEM_H
diff --git a/3rdparty/CGAL/include/CGAL/Three/Scene_interface.h b/3rdparty/CGAL/include/CGAL/Three/Scene_interface.h
new file mode 100644
index 0000000..b4231f2
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Three/Scene_interface.h
@@ -0,0 +1,194 @@
+// Copyright (c) 2012-2015  GeometryFactory Sarl (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
+// 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(s)     : Laurent RINEAU
+
+//! \file Scene_interface.h
+#ifndef SCENE_INTERFACE_H
+#define SCENE_INTERFACE_H
+
+#include <QString>
+#include <QColor>
+#include <QList>
+#include <algorithm>
+#include <cmath>
+#include <CGAL/Bbox_3.h>
+namespace CGAL{namespace Three{
+class Scene_item;
+class Scene_group_item;
+    }}
+// OpenGL rendering mode
+/*!
+ * Contains the class Scene_interface and the enum RenderingMode.
+ */
+/*!
+ * \brief The RenderingMode enum
+ * Can be Points, PointsPlusNormals, Wireframe, Flat, FlatPlusEdges, or Gouraud.
+ * - Points, PointsPlusNormals, and Wireframe have no light model.
+ * - Flat and FlatPlusEdges use a basic light model with one normal per facet.
+ * - Gouraud use the same light model but with one normal per vertex.
+ */
+enum RenderingMode { Points = 0,
+                     PointsPlusNormals,
+                     Splatting,
+                     Wireframe, 
+                     Flat,
+                     FlatPlusEdges,
+                     Gouraud,
+                     LastRenderingMode = Gouraud,
+                     NumberOfRenderingMode = LastRenderingMode+1 };
+
+
+namespace CGAL {
+namespace Three{
+/*!
+ * This is the class given to the plugins to interact with the scene.
+ * */
+class Scene_interface {
+public:
+  typedef CGAL::Bbox_3 Bbox;
+    //!Contains the coordinates for the two extremities of the diagonal of a bounding box.
+    //! Those points are respectively the left bottom front vertex and the right upper back vertex.
+ /* struct Bbox {
+    double xmin, ymin, zmin;
+    double xmax, ymax, zmax;
+    Bbox(const double _xmin,const double _ymin,const double _zmin,
+         const double _xmax,const double _ymax,const double _zmax)
+      : xmin(_xmin), ymin(_ymin), zmin(_zmin),
+        xmax(_xmax), ymax(_ymax), zmax(_zmax)
+    {
+    }
+
+    //!The default constructor of a bounding box.
+    //! The two vertices are (0.0,0.0,0.0) and (1.0,1.0,1.0).
+    Bbox()
+      : xmin(0.0), ymin(0.0), zmin(0.0),
+        xmax(1.0), ymax(1.0), zmax(1.0)
+    {
+    }
+    //!Sums the coordinates of each vertex one by one.
+    Bbox operator+(const Bbox& b) const {
+      return Bbox((std::min)(xmin, b.xmin),
+                  (std::min)(ymin, b.ymin),
+                  (std::min)(zmin, b.zmin),
+                  (std::max)(xmax, b.xmax),
+                  (std::max)(ymax, b.ymax),
+                  (std::max)(zmax, b.zmax));
+    }
+
+    //!@returns true if all the coordinates of the two bounding boxes are the same.
+    bool operator==(const Bbox&b) const{
+      return
+        xmin==b.xmin && xmax==b.xmax &&
+        ymin==b.ymin && ymax==b.ymax &&
+        zmin==b.zmin && zmax==b.zmax;
+    }
+    //!@returns the opposite of ==.
+    //!@see #operator==
+    bool operator!=(const Bbox& b) const{
+      return !(*this == b);
+    }
+    //!@returns the difference between xmax and xmin.
+    double width() const { return xmax-xmin; }
+    //!@returns the difference between ymax and ymin.
+    double height() const { return ymax-ymin; }
+    //!@returns the difference between zmax and zmin.
+    double depth() const { return zmax-zmin; }
+    //!@returns the length of the diagonal of the bounding box.
+    double diagonal_length() const
+    {
+      return CGAL::sqrt((xmax()-xmin())*(xmax()-xmin()) + (ymax()-ymin())*(ymax()-ymin()) + (zmax()-zmin())*(zmax()-zmin()));
+    }
+
+  }; // struct BBox (ad hoc class, does not depend on CGAL kernels
+*/
+  //!Integer used as the index of a Scene_item.
+  typedef int Item_id;
+  //!Virtual destructor
+  virtual ~Scene_interface() {};
+  //!Adds an item to the list of items.
+  //!@returns the index of the new item.
+  virtual Item_id addItem(CGAL::Three::Scene_item* item) = 0;
+  //!Replace an item by a new one in the scene. The first is deleted and gives its index to the latter.
+  //!If emit_item_about_to_be_destroyed is true, emits
+  //!an itemAboutToBeDestroyed signal.
+  //!@returns a pointer to the old item.
+  virtual Scene_item* replaceItem(Item_id, CGAL::Three::Scene_item*, bool emit_item_about_to_be_destroyed = false) = 0;
+  //!Moves item to the targeted group.
+  virtual void changeGroup(CGAL::Three::Scene_item* item, CGAL::Three::Scene_group_item* target_group) = 0;
+
+  /*! Erases an item in the list.
+   * @returns the index of the item just before the one that is erased,
+   * or just after.
+   * @returns -1 if the list is empty.*/
+  virtual Item_id erase(Item_id) = 0;
+
+  /*! Duplicates a scene item.
+   * @returns the index of the new item (-1 on error).
+   */
+    virtual Item_id duplicate(Item_id) = 0;
+
+  // Accessors (getters)
+  //!
+  //!@returns the number of items in the scene.
+  virtual int numberOfEntries() const = 0;
+  //!
+  //! @returns the item with the specified index.
+  virtual CGAL::Three::Scene_item* item(Item_id) const = 0;
+  //!
+  //! @returns the id of the specified item.
+  virtual Item_id item_id(CGAL::Three::Scene_item*) const = 0;
+  //!
+  //!@returns the currently selected item's index. If several items are selected, returns the last one's index.
+  virtual Item_id mainSelectionIndex() const = 0;
+  //!
+  //!@returns the list of currently selected items indices.
+  virtual QList<Item_id> selectionIndices() const = 0;
+  //!
+  //!@returns the index of the Item_A
+  virtual Item_id selectionAindex() const = 0;
+  //!
+  //!@returns the index of the Item_B
+  virtual Item_id selectionBindex() const = 0;
+
+  //!
+  //!@returns the scene bounding box
+  virtual Bbox bbox() const = 0;
+  //!
+  //!@returns the length of the bounding box's diagonal.
+  virtual double len_diagonal() const = 0;
+
+public:
+  /*! Emits a dataChanged signal. */
+  virtual void itemChanged(Item_id i) = 0; 
+  /*! Emits a dataChanged signal.*/
+  virtual void itemChanged(CGAL::Three::Scene_item*) = 0;
+
+  /*! Selects the item with the specified index. */
+  virtual void setSelectedItem(Item_id) = 0;
+  /*!  Adds group to the Scene. If items were selected at the
+   * moment this function is called, they are added to the group.
+   * If all the selected items were in the same group, the new group
+   * is added as a sub-group of this group.*/
+  virtual void addGroup(Scene_group_item* group) = 0;
+  
+}; // end interface Scene_interface
+}
+}
+
+#endif // SCENE_INTERFACE_H
diff --git a/3rdparty/CGAL/include/CGAL/Three/Scene_item.h b/3rdparty/CGAL/include/CGAL/Three/Scene_item.h
new file mode 100644
index 0000000..fe47b51
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Three/Scene_item.h
@@ -0,0 +1,419 @@
+// Copyright (c) 2012-2015  GeometryFactory Sarl (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
+// 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(s)     : Laurent RINEAU, Maxime Gimeno
+
+#ifndef SCENE_ITEM_H
+#define SCENE_ITEM_H
+#include <CGAL/Three/Scene_item_config.h>
+#include <CGAL/Three/Scene_interface.h>
+#include <QString>
+#include <QPixmap>
+#include <QFont>
+#include <QOpenGLBuffer>
+#include <QOpenGLShader>
+#include <QOpenGLVertexArrayObject>
+#include <vector>
+#include <CGAL/Bbox_3.h>
+#include <CGAL/Three/Scene_print_interface_item.h>
+
+namespace CGAL {
+namespace Three {
+  class Viewer_interface;
+}
+}
+namespace qglviewer {
+  class ManipulatedFrame;
+}
+
+class QMenu;
+class QKeyEvent;
+namespace CGAL {
+namespace Three {
+
+class Scene_group_item;
+class Viewer_interface;
+//! This class represents an object in the OpenGL scene
+class SCENE_ITEM_EXPORT Scene_item : public QObject, public CGAL::Three::Scene_print_interface_item {
+  Q_OBJECT
+  Q_PROPERTY(QColor color READ color WRITE setColor)
+  Q_PROPERTY(QString name READ name WRITE setName)
+  Q_PROPERTY(bool visible READ visible WRITE setVisible)
+  Q_ENUMS(RenderingMode)
+  Q_PROPERTY(RenderingMode renderingMode READ renderingMode WRITE setRenderingMode)
+public:
+ /*!
+   * \brief The OpenGL_program_IDs enum
+   * This enum holds the OpenGL programs IDs that are given to getShaderProgram() and attribBuffers().
+   *@see getShaderProgram
+   * @see attribBuffers
+   */
+ enum OpenGL_program_IDs
+ {
+  PROGRAM_WITH_LIGHT = 0,      /** Used to render a surface or edge affected by the light. It uses a per fragment lighting model, and renders brighter the selected item.*/
+  PROGRAM_WITHOUT_LIGHT,       /** Used to render a polygon edge or points. It renders in a uniform color and is not affected by light. It renders the selected item in black.*/
+  PROGRAM_NO_SELECTION,        /** Used to render a polyline or a surface that is not affected by light, like a cutting plane. It renders in a uniform color that does not change with selection.*/
+  PROGRAM_WITH_TEXTURE,        /** Used to render a textured polyhedron. Affected by light.*/
+  PROGRAM_PLANE_TWO_FACES,     /** Used to render a two-faced plane. The two faces have a different color. Not affected by light.*/
+  PROGRAM_WITH_TEXTURED_EDGES, /** Used to render the edges of a textured polyhedorn. Not affected by light.*/
+  PROGRAM_INSTANCED,           /** Used to display instanced rendered spheres.Affected by light.*/
+  PROGRAM_INSTANCED_WIRE,      /** Used to display instanced rendered wired spheres. Not affected by light.*/
+  PROGRAM_C3T3,                /** Used to render a c3t3_item. It discards any fragment on a side of a plane, meaning that nothing is displayed on this side of the plane. Affected by light.*/
+  PROGRAM_C3T3_EDGES,          /** Used to render the edges of a c3t3_item. It discards any fragment on a side of a plane, meaning that nothing is displayed on this side of the plane. Not affected by light.*/
+  PROGRAM_CUTPLANE_SPHERES,    /** Used to render the spheres of an item with a cut plane.*/
+  PROGRAM_SPHERES,             /** Used to render one or several spheres.*/
+  NB_OF_PROGRAMS               /** Holds the number of different programs in this enum.*/
+ };
+  typedef CGAL::Bbox_3 Bbox;
+  typedef qglviewer::ManipulatedFrame ManipulatedFrame;
+  //! The default color of a scene_item.
+  static const QColor defaultColor; // defined in Scene_item.cpp
+
+  //!The Constructor.
+  /*!
+   * Initializes the number of VBOs and VAOs and creates them.
+   */
+  Scene_item(int buffers_size = 20, int vaos_size = 10);
+
+  //! Sets the number of isolated vertices.
+  void setNbIsolatedvertices(std::size_t nb) { nb_isolated_vertices = nb;}
+  //! Getter for the number of isolated vertices.
+  std::size_t getNbIsolatedvertices() const {return nb_isolated_vertices;}
+  //!The destructor. It is virtual as the item is virtual.
+  virtual ~Scene_item();
+  //! Creates a new item as a copy of the sender.
+  virtual Scene_item* clone() const = 0;
+
+  //! Indicates if rendering mode is supported
+  virtual bool supportsRenderingMode(RenderingMode m) const = 0;
+  //! Deprecated. Does nothing.
+  virtual void draw() const {}
+  /*! \brief The drawing function.
+   * Draws the facets of the item in the viewer using OpenGL functions. The data
+   * for the drawing is gathered in computeElements(), and is sent
+   * to buffers in initializeBuffers().
+   * @see computeElements()
+   * @see initializeBuffers()
+   */
+  virtual void draw(CGAL::Three::Viewer_interface*) const  { draw(); }
+  //! Deprecated. Does nothing.
+  virtual void drawEdges() const { draw(); }
+  /*! \brief The drawing function.
+   * Draws the edges and lines of the item in the viewer using OpenGL functions. The data
+   * for the drawing is gathered in computeElements(), and is sent
+   * to buffers in initializeBuffers().
+   * @see computeElements()
+   * @see initializeBuffers()
+   */
+  virtual void drawEdges(CGAL::Three::Viewer_interface* viewer) const { draw(viewer); }
+  //! Deprecated. Does nothing.
+  virtual void drawPoints() const { draw(); }
+  /*! \brief The drawing function.
+   * Draws the points of the item in the viewer using OpenGL functions. The data
+   * for the drawing is gathered in computeElements(), and is sent
+   * to buffers in initializeBuffers().
+   * @see computeElements()
+   * @see initializeBuffers()
+   */
+  virtual void drawPoints(CGAL::Three::Viewer_interface*) const { drawPoints(); }
+
+  //! Draws the splats of the item in the viewer using GLSplat functions.
+  virtual void drawSplats() const {}
+  //! Draws the splats of the item in the viewer using GLSplat functions.
+  virtual void drawSplats(CGAL::Three::Viewer_interface*) const {drawSplats();}
+
+  //! Called by the scene. If b is true, then this item is currently selected.
+  virtual void selection_changed(bool b);
+
+  // Functions for displaying meta-data of the item
+  //!\brief Contains meta-data about the item.
+  //! Data is :Number of vertices, Number of edges, Number of facets,
+  //! Volume, Area, Bounding box limits and Number of isolated points.
+  //! @returns a QString containing meta-data about the item.
+  virtual QString toolTip() const = 0;
+  //! \brief contains graphical meta-data about the item.
+  //! @returns a QPixmap containing graphical meta-data about the item.
+  virtual QPixmap graphicalToolTip() const { return QPixmap(); }
+  //! \brief contains the font used for the data of the item.
+  //! @returns a QFont containing the font used for the data of the item.
+  virtual QFont font() const { return QFont(); }
+
+  // Functions that help the Scene to compute its bbox
+  //! If isFinite() returns false, the BBox is not computed.
+  virtual bool isFinite() const { return true; }
+  //! Specifies if the item is empty or null.
+  virtual bool isEmpty() const { return true; }
+  //! \brief the item's bounding box.
+  //!@returns the item's bounding box.
+  virtual Bbox bbox() const {
+      if(!is_bbox_computed)
+          compute_bbox();
+      is_bbox_computed = true;
+      return _bbox;
+  }
+  virtual double diagonalBbox() const {
+   if(!is_diag_bbox_computed)
+       compute_diag_bbox();
+   is_diag_bbox_computed = true;
+   return _diag_bbox;
+  }
+
+  //!Finds the spot the closest to point and prints the id of the corresponding Primitive (vertex, edg or Facet).
+  virtual void printPrimitiveId(QPoint, CGAL::Three::Viewer_interface*);
+  virtual void printPrimitiveIds(CGAL::Three::Viewer_interface*)const;
+
+  virtual bool testDisplayId(double, double, double, CGAL::Three::Viewer_interface*);
+  // Function about manipulation
+  //! returns true  if the item can have a ManipulatedFrame.
+  virtual bool manipulatable() const { return false; }
+  //!@returns the manipulatedFrame of the item.
+  virtual ManipulatedFrame* manipulatedFrame() { return 0; }
+
+  // Getters for the four basic properties
+  //! @returns the current color of the item.
+  virtual QColor color() const { return color_; }
+  //! @returns the current name of the item.
+  virtual QString name() const { return name_; }
+  //! @returns the current visibility of the item.
+  virtual bool visible() const { return visible_; }
+  //! @returns the current rendering mode of the item.
+  //!@see RenderingMode
+  virtual RenderingMode renderingMode() const { return rendering_mode; }
+  //! @returns the current rendering mode of the item as a human readable string.
+  virtual QString renderingModeName() const;
+
+  //! Context menu
+  virtual QMenu* contextMenu();
+
+  //!Handles key press events.
+  virtual bool keyPressEvent(QKeyEvent*){return false;}
+
+  //!The parent group, or 0 if the item is not in a group.
+  Scene_group_item* parentGroup() const;
+
+  //!Contains the header for the table in the statistics dialog
+  /*!
+   * A header data is composed of 2 columns : the Categories and the titles.
+   * A category is the name given to an association of titles.
+   * A title is the name of a line.
+   *\verbatim
+   * For example,
+   * Category :    | Titles| Values
+   * 2 lines       |       |
+   *  ____________________________
+   * |             |Name   |Cube |
+   * |             |_______|_____|
+   * |General Info | #Edges|12   |
+   * |_____________|_______|_____|
+   *
+   *  would be stored as follows :
+   * categories = std::pair<QString,int>(QString("General Info"),2)
+   * titles.append("Name");
+   * titles.append("#Edges");\endverbatim
+   */
+  struct Header_data{
+   //!Contains the name of the category of statistics and the number of lines it will contain
+   QList<std::pair<QString, int> > categories;
+   //!Contains the name of the lines of each category. Must be sorted from top to bottom.
+   QList<QString> titles;
+  };
+  //!Returns a Header_data struct containing the header information.
+  virtual Header_data header()const;
+  //!Returns true if the item has statistics.
+  virtual bool has_stats()const{return false;}
+  //!Returns a QString containing the requested value for the the table in the statistics dialog
+  /*! \verbatim
+   * Example :
+   *  ____________________________
+   * |             |Name   |Cube |
+   * |             |_______|_____|
+   * |General Info | #Edges|12   |
+   * |_____________|_______|_____|
+   * compute stats(0) should return "Cube" and computeStats(1) should return QString::number(12);
+   * The numbers must be coherent with the order of declaration of the titles in the header.
+   * \endverbatim
+   *
+   */
+  virtual QString computeStats(int i);
+
+  //!Contains the number of group and subgroups containing this item.
+  int has_group;
+
+public Q_SLOTS:
+
+  //! Notifies the program that the internal data or the properties of
+  //! an item has changed, and that it must be computed again. It is
+  //! important to call this function whenever the internal data is changed,
+  //! or the displayed item will not be updated.
+  virtual void invalidateOpenGLBuffers();
+  //!Setter for the color of the item.
+  virtual void setColor(QColor c) { color_ = c;}
+  //!Setter for the RGB color of the item. Calls setColor(QColor).
+  //!@see setColor(QColor c)
+  void setRbgColor(int r, int g, int b) { setColor(QColor(r, g, b)); }
+  //!Sets the name of the item.
+  virtual void setName(QString n) { name_ = n; }
+    //!Sets the visibility of the item.
+  virtual void setVisible(bool b);
+  //!Set the parent group. If `group==0`, then the item has no parent.
+  //!This function is called by `Scene::changeGroup` and should not be
+  //!called manually.
+  virtual void moveToGroup(Scene_group_item* group);
+  //!Sets the rendering mode of the item.
+  //!@see RenderingMode
+  virtual void setRenderingMode(RenderingMode m) { 
+    if (supportsRenderingMode(m))
+      rendering_mode = m; 
+    Q_EMIT redraw();
+  }
+  //!Sets the RenderingMode to Points.
+  void setPointsMode() {
+    setRenderingMode(Points);
+  }
+  //!Sets the RenderingMode to Wireframe.
+  void setWireframeMode() {
+    setRenderingMode(Wireframe);
+  }
+
+  //!Sets the RenderingMode to Flat.
+  void setFlatMode() {
+    setRenderingMode(Flat);
+  }
+  //!Set the RenderingMode to FlatPlusEdges.
+  void setFlatPlusEdgesMode() {
+    setRenderingMode(FlatPlusEdges);
+  }
+  //!Sets the RenderingMode to Gouraud.
+  void setGouraudMode() {
+    setRenderingMode(Gouraud);
+  }
+  //!Sets the RenderingMode to PointsPlusNormals.
+  void setPointsPlusNormalsMode(){
+    setRenderingMode(PointsPlusNormals);
+  }
+  //!Sets the RenderingMode to Splatting.
+  void setSplattingMode(){
+    setRenderingMode(Splatting);
+  }
+  
+  //!Emits an aboutToBeDestroyed() signal.
+  virtual void itemAboutToBeDestroyed(Scene_item*);
+
+  //!Selects a point through raycasting.
+  virtual void select(double orig_x,
+                      double orig_y,
+                      double orig_z,
+                      double dir_x,
+                      double dir_y,
+                      double dir_z);
+
+Q_SIGNALS:
+  //! Is emitted to notify a change in the item's data.
+  void itemChanged();
+  //! Is emitted to notify that the item is about to be deleted.
+  void aboutToBeDestroyed();
+  //! Is emitted to require a new display.
+  void redraw();
+
+protected:
+  //!Holds the BBox of the item
+  mutable Bbox _bbox;
+  mutable double _diag_bbox;
+  mutable bool is_bbox_computed;
+  mutable bool is_diag_bbox_computed;
+  virtual void compute_bbox()const{}
+  virtual void compute_diag_bbox()const;
+  // The four basic properties
+  //!The name of the item.
+  QString name_;
+  //!The color of the item.
+  QColor color_;
+  //!The visibility of the item.
+  bool visible_;
+  //!The parent group, or 0 if the item is not in a group.
+  Scene_group_item* parent_group;
+  //!Specifies if the item is currently selected.
+  bool is_selected;
+  //! Holds the number of vertices that are not linked to the polyhedron from the OFF
+  //! file.
+  std::size_t nb_isolated_vertices;
+  /*! Decides if the draw function must call initializeBuffers() or not. It is set
+   * to true in the end of initializeBuffers() and to false in invalidateOpenGLBuffers(). The need of
+   * this boolean comes from the need of a context from the OpenGLFunctions used in
+   * initializeBuffers().
+   * @see initializeBuffers()
+   * @see invalidateOpenGLBuffers()
+   */
+  mutable bool are_buffers_filled;
+  //!The rendering mode of the item.
+  //!@see RenderingMode
+  RenderingMode rendering_mode;
+  //!The default context menu.
+  QMenu* defaultContextMenu;
+  /*! Contains the previous RenderingMode.
+   * This is used to determine if invalidateOpenGLBuffers should be called or not
+   * in certain cases.
+   * @see invalidateOpenGLBuffers()*/
+  RenderingMode prev_shading;
+  /*! \todo replace it by RenderingMode().
+   * \brief
+   *  Contains the current RenderingMode.
+   * This is used to determine if invalidateOpenGLBuffers should be called or not
+   * in certain cases.
+   * @see invalidateOpenGLBuffers()*/
+  RenderingMode cur_shading;
+  //!Contains the size of the vector of VBOs
+  int buffersSize;
+  //!Contains the size of the map of VAOs
+  int vaosSize;
+  //!Contains the VBOs
+  mutable std::vector<QOpenGLBuffer> buffers;
+  /*! Contains the VAOs.
+   */
+  std::vector<QOpenGLVertexArrayObject*> vaos;
+  //!Adds a VAO to the Map.
+  void addVaos(int i)
+  {
+      QOpenGLVertexArrayObject* n_vao = new QOpenGLVertexArrayObject();
+      vaos[i] = n_vao;
+  }
+
+  /*! Fills the VBOs with data. Must be called after each call to #compute_elements().
+   * @see compute_elements()
+   */
+  void initializeBuffers(){}
+
+  /*! Collects all the data for the shaders. Must be called in #invalidateOpenGLBuffers().
+   * @see invalidateOpenGLBuffers().
+   */
+  void computeElements(){}
+  /*! Passes all the uniform data to the shaders.
+   * According to program_name, this data may change.
+   */
+  void attribBuffers(CGAL::Three::Viewer_interface*, int program_name) const;
+
+  /*! Compatibility function. Calls `viewer->getShaderProgram()`. */
+  virtual QOpenGLShaderProgram* getShaderProgram(int name , CGAL::Three::Viewer_interface *viewer = 0) const;
+}; // end class Scene_item
+}
+}
+
+#include <QMetaType>
+Q_DECLARE_METATYPE(CGAL::Three::Scene_item*)
+
+#endif // SCENE_ITEM_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Three/Scene_item_config.h b/3rdparty/CGAL/include/CGAL/Three/Scene_item_config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Three/Scene_item_config.h
rename to 3rdparty/CGAL/include/CGAL/Three/Scene_item_config.h
diff --git a/3rdparty/CGAL/include/CGAL/Three/Scene_print_interface_item.h b/3rdparty/CGAL/include/CGAL/Three/Scene_print_interface_item.h
new file mode 100644
index 0000000..d1c9b67
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Three/Scene_print_interface_item.h
@@ -0,0 +1,41 @@
+// Copyright (c) 2009,2010,2012,2015  GeometryFactory Sarl (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
+// 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(s)     : Maxime GIMENO
+
+#ifndef SCENE_PRINT_INTERFACE_ITEM_H
+#define SCENE_PRINT_INTERFACE_ITEM_H
+#include <QPoint>
+namespace CGAL
+{
+namespace Three {
+  class Viewer_interface;
+
+
+//! Base class to allow an item to print its primitive IDs.
+class Scene_print_interface_item {
+public:
+  virtual ~Scene_print_interface_item(){}
+ //!Print the ID of the selected primitive.
+ virtual void printPrimitiveId(QPoint, CGAL::Three::Viewer_interface*) = 0;
+ //!Prints the ID of all the primitives.
+ virtual void printPrimitiveIds(CGAL::Three::Viewer_interface*)const = 0;
+};
+}
+}
+#endif // SCENE_PRINT_INTERFACE_ITEM_H
+
diff --git a/3rdparty/CGAL/include/CGAL/Three/TextRenderer.h b/3rdparty/CGAL/include/CGAL/Three/TextRenderer.h
new file mode 100644
index 0000000..f2bf38f
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Three/TextRenderer.h
@@ -0,0 +1,146 @@
+// Copyright (c) 2012-2015  GeometryFactory Sarl (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
+// 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(s)     : Laurent RINEAU, Maxime Gimeno
+
+#ifndef TEXTRENDERER_H
+#define TEXTRENDERER_H
+
+#include <QObject>
+#include <QVector3D>
+
+#include <CGAL/Three/Viewer_interface.h>
+#include <CGAL/Three/Scene_interface.h>
+
+//!This class holds the properties of each line of text to be rendered.
+class QVector3D;
+namespace CGAL{
+namespace Three{
+class Scene_item;
+}
+}
+class  VIEWER_EXPORT TextItem{
+public :
+  /*!
+   * \brief The default constructor.
+   * This is an overloaded functtion.
+   */
+    TextItem() {}
+    /*!
+     * \brief The construtor for the TextItem
+     * \param p_x the X coordinate of the displayed text.
+     * \param p_y the Y coordinate of the displayed text.
+     * \param p_z the Z coordinate of the displayed text.
+     * \param p_text the text to render.
+     * \param p_3D
+     * If true : the renderer will convert the coordinates into world coordinates.
+     * If false : the renderer will display the text in screen coordinates, and ignore p_z
+     * \param font the font used for the rendering.
+     * \param p_color the color of the text.
+     */
+    TextItem(float p_x, float p_y, float p_z, QString p_text, bool p_3D = true, QFont font = QFont(), QColor p_color = Qt::black, bool always_visible = false)
+        :x(p_x), y(p_y), z(p_z),_3D(p_3D), _is_always_visible(always_visible), m_text(p_text), m_font(font), m_color(p_color)
+    {
+       QFontMetrics fm(m_font);
+       _width = fm.width(m_text);
+       _height = fm.height();
+    }
+    QString text()const {return m_text;}
+    //!Returns the position of the center of the text, in world coordinates.
+    QVector3D position(){return QVector3D(x,y,z);}
+    float width(){return _width;}
+    float height(){return _height;}
+    QFont font(){return m_font;}
+    QColor color() {return m_color;}
+    bool is_3D()const{return _3D;}
+    bool is_always_visible(){return _is_always_visible;}
+private:
+    float x;
+    float y;
+    float z;
+    float _width;
+    float _height;
+    bool _3D;
+    bool _is_always_visible;
+    QString m_text;
+    QFont m_font;
+    QColor m_color;
+
+};//end class TextItem
+
+class  VIEWER_EXPORT TextListItem{
+public:
+    TextListItem(CGAL::Three::Scene_item* pItem)
+    {
+      _list = QList<TextItem*>();
+      _item = pItem;
+    }
+
+     CGAL::Three::Scene_item* item()const {return _item;}
+    QList<TextItem*> textList()const {return _list;}
+    void append(TextItem* ti) {_list.append(ti);}
+    void clear(){_list.clear();}
+    bool isEmpty()const {return _list.empty();}
+    std::size_t size()const{return _list.size();}
+private:
+    CGAL::Three::Scene_item* _item;
+    QList<TextItem*> _list;
+
+};
+//!This class draws all the textItems.
+/*!
+  * Projects each textItem from the world coordinates to the Screen coordinates
+  * and draws it.
+ */
+class VIEWER_EXPORT TextRenderer : public QObject{
+  Q_OBJECT
+public:
+    TextRenderer() : max_textItems(30000)
+    {
+    }
+    //!Draws all the TextItems
+    void draw(CGAL::Three::Viewer_interface* viewer);
+    //!Adds a TextItem to the local list.
+    void addText(TextItem*);
+    //!Adds a TextListItem to the global list.
+    void addTextList(TextListItem*);
+    //!Creates a new TextItem and adds it to the local list.
+    void addText(float p_x, float p_y, float p_z, QString p_text, bool p_3D = true,  QFont font = QFont(), QColor p_color = Qt::black);
+    //!Removes a TextItem from the local list.
+    void removeText(TextItem*);
+    //!Removes a TextItemList from the global list.
+    void removeTextList(TextListItem*);
+    //!Returns the local list of TextItems. This is the renderer's default list.
+    QList<TextItem*> getLocalTextItems(){return local_textItems;}
+    //!Returns the global list of TextItems. This is the list that is fed by pre-filled lists of TextItems (such as global Polyhedron IDs).
+    QList<TextListItem*> items() const{return textItems;}
+    //!Gives the renderer a Scene, needed to determine which Ids must be drawn.
+    void setScene(CGAL::Three::Scene_interface* p_scene){scene = p_scene;}
+    int getMax_textItems()const{return max_textItems;}
+    void setMax(int max){max_textItems = max;}
+
+Q_SIGNALS:
+    void sendMessage(QString message, int ms_delay =2000);
+private:
+    QList<TextListItem*> textItems;
+    CGAL::Three::Scene_interface *scene;
+    QList<TextItem*> local_textItems;
+    int max_textItems;
+
+};//end class TextRenderer
+#endif // TEXTRENDERER_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Three/Viewer_config.h b/3rdparty/CGAL/include/CGAL/Three/Viewer_config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Three/Viewer_config.h
rename to 3rdparty/CGAL/include/CGAL/Three/Viewer_config.h
diff --git a/3rdparty/CGAL/include/CGAL/Three/Viewer_interface.h b/3rdparty/CGAL/include/CGAL/Three/Viewer_interface.h
new file mode 100644
index 0000000..547059f
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Three/Viewer_interface.h
@@ -0,0 +1,186 @@
+// Copyright (c) 2012-2015  GeometryFactory Sarl (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
+// 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(s)     : Laurent RINEAU, Maxime Gimeno
+
+#ifndef VIEWER_INTERFACE_H
+#define VIEWER_INTERFACE_H
+
+#include <QGLViewer/qglviewer.h>
+#include <QWidget>
+#include <QPoint>
+#include <QOpenGLFunctions_2_1>
+#include <CGAL/Qt/CreateOpenGLContext.h>
+// forward declarations
+class QWidget;
+class QMouseEvent;
+class QKeyEvent;
+class QOpenGLShaderProgram;
+class TextRenderer;
+class TextListItem;
+
+//! \file Viewer_interface.h
+#include <CGAL/Three/Viewer_config.h> // for VIEWER_EXPORT
+namespace CGAL{
+namespace Three{
+class Scene_draw_interface;
+//! Base class to interact with the viewer from the plugins, the items and the scene.
+class VIEWER_EXPORT Viewer_interface : public QGLViewer, public QOpenGLFunctions_2_1 {
+
+  Q_OBJECT
+
+public:
+ /*!
+   * \brief The OpenGL_program_IDs enum
+   * This enum holds the OpenGL programs IDs that are given to getShaderProgram() and attribBuffers().
+   *@see getShaderProgram
+   * @see attribBuffers
+   */
+  enum OpenGL_program_IDs
+  {
+   PROGRAM_WITH_LIGHT = 0,      /** Used to render a surface or edge affected by the light. It uses a per fragment lighting model, and renders brighter the selected item.*/
+   PROGRAM_WITHOUT_LIGHT,       /** Used to render a polygon edge or points. It renders in a uniform color and is not affected by light. It renders the selected item in black.*/
+   PROGRAM_NO_SELECTION,        /** Used to render a polyline or a surface that is not affected by light, like a cutting plane. It renders in a uniform color that does not change with selection.*/
+   PROGRAM_WITH_TEXTURE,        /** Used to render a textured polyhedron. Affected by light.*/
+   PROGRAM_PLANE_TWO_FACES,     /** Used to render a two-faced plane. The two faces have a different color. Not affected by light.*/
+   PROGRAM_WITH_TEXTURED_EDGES, /** Used to render the edges of a textured polyhedorn. Not affected by light.*/
+   PROGRAM_INSTANCED,           /** Used to display instanced rendered spheres.Affected by light.*/
+   PROGRAM_INSTANCED_WIRE,      /** Used to display instanced rendered wired spheres. Not affected by light.*/
+   PROGRAM_C3T3,                /** Used to render a c3t3_item. It discards any fragment on a side of a plane, meaning that nothing is displayed on this side of the plane. Affected by light.*/
+   PROGRAM_C3T3_EDGES,          /** Used to render the edges of a c3t3_item. It discards any fragment on a side of a plane, meaning that nothing is displayed on this side of the plane. Not affected by light.*/
+   PROGRAM_CUTPLANE_SPHERES,    /** Used to render the spheres of an item with a cut plane.*/
+   PROGRAM_SPHERES,             /** Used to render one or several spheres.*/
+   NB_OF_PROGRAMS               /** Holds the number of different programs in this enum.*/
+  };
+
+ //!Returns the viewer's QPainter
+ virtual QPainter *getPainter() =0;
+
+  /*!
+   * \brief textRenderer is used to display text on the screen.
+   * The textRenderer uses the painter tu display 2D text over the 3D Scene. It has a list containing the TextItems to display.
+   */
+  TextRenderer *textRenderer;
+  /*!
+  * \brief testDisplayId checks if the id at position (x,y,z) is visible or not.
+  * \param x the X coordinate of the id's position.
+  * \param y the Y coordinate of the id's position.
+  * \param z the Z coordinate of the id's position.
+  * \return true if the ID is visible. */
+  virtual bool testDisplayId(double x, double y, double z) = 0;
+  //!Returns true if the primitive ids are displayed
+  virtual bool hasText() const { return false; }
+
+  Viewer_interface(QWidget* parent) : QGLViewer(CGAL::Qt::createOpenGLContext(), parent) {}
+  virtual ~Viewer_interface() {}
+
+  //! Sets the scene for the viewer.
+  virtual void setScene(CGAL::Three::Scene_draw_interface* scene) = 0;
+  //! @returns the antialiasing state.
+  virtual bool antiAliasing() const = 0;
+  
+  // Those two functions are defined in Viewer.cpp
+  //!Sets the position and orientation of a frame using a QString.
+  //!@returns true if it worked.
+  static bool readFrame(QString, qglviewer::Frame&);
+  //!@returns a QString contining the position and orientation of a frame.
+  static QString dumpFrame(const qglviewer::Frame&);
+  //! @returns the fastDrawing state.
+  virtual bool inFastDrawing() const = 0;
+  //! @returns if the viewer is in `drawWithNames()`
+  virtual bool inDrawWithNames() const = 0;
+
+  /*! Passes all the uniform data to the shaders.
+   * According to program_name, this data may change.
+   * @see OpenGL_program_IDs
+   */
+  virtual void attribBuffers(int program_name) const = 0;
+
+  /*! Returns a program according to name.
+   * If the program does not exist yet, it is created and stored in shader_programs.
+   * @see OpenGL_program_IDs
+   * @returns a pointer to the corresponding program.*/
+  virtual QOpenGLShaderProgram* getShaderProgram(int name) const = 0;
+
+  //!Allows OpenGL 2.1 context to get access to glDrawArraysInstanced.
+  typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDARBPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+  //!Allows OpenGL 2.1 context to get access to glVertexAttribDivisor.
+  typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORARBPROC) (GLuint index, GLuint divisor);
+  //!Allows OpenGL 2.1 context to get access to glVertexAttribDivisor.
+  typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) (GLuint target, GLuint attachment, GLuint textarget, GLuint texture, GLint level);
+  //!Allows OpenGL 2.1 context to get access to gkFrameBufferTexture2D.
+  PFNGLDRAWARRAYSINSTANCEDARBPROC glDrawArraysInstanced;
+  //!Allows OpenGL 2.1 context to get access to glVertexAttribDivisor.
+  PFNGLVERTEXATTRIBDIVISORARBPROC glVertexAttribDivisor;
+  //!Allows OpenGL 2.1 context to get access to gkFrameBufferTexture2D.
+  PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2D;
+  //!@returns true if glVertexAttribDivisor, and glDrawArraysInstanced are found.
+  //! Used by the items to avoid SEGFAULT.
+  bool extension_is_found;
+  //!The matrix used for the picking.
+  mutable GLfloat pickMatrix_[16];
+  //!Sets the binding for SHIFT+LEFT CLICK to SELECT (initially used in Scene_polyhedron_selection_item.h)
+  void setBindingSelect()
+  {
+#if QGLVIEWER_VERSION >= 0x020501
+    setMouseBinding(::Qt::ShiftModifier, ::Qt::LeftButton, SELECT);
+#else
+    setMouseBinding(::Qt::SHIFT + ::Qt::LeftButton, SELECT);
+#endif
+  }
+  //!Sets the binding for SHIFT+LEFT CLICK to NO_CLICK_ACTION (initially used in Scene_polyhedron_selection_item.h)
+  void setNoBinding()
+  {
+#if QGLVIEWER_VERSION >= 0x020501
+    setMouseBinding(::Qt::ShiftModifier, ::Qt::LeftButton, NO_CLICK_ACTION);
+#else
+    setMouseBinding(::Qt::SHIFT + ::Qt::LeftButton, NO_CLICK_ACTION);
+#endif
+  }
+
+Q_SIGNALS:
+  //!Is emitted after an item is picked.
+  void selected(int);
+  //!Is emitted to require a contextual menu to appear at global_pos.
+  void requestContextMenu(QPoint global_pos);
+  //!Is emitted after a point is selected.
+  void selectedPoint(double, double, double);
+  //!Is emitted to request the currently selected item to perform a selection based on an AABB_Tree and a raycasting.
+  void selectionRay(double, double, double, double, double, double);
+
+public Q_SLOTS:
+  //! Sets the antialiasing to true or false.
+  virtual void setAntiAliasing(bool b) = 0;
+  //! If b is true, facets will be ligted from both internal and external sides.
+  //! If b is false, only the side that is exposed to the light source will be lighted.
+  virtual void setTwoSides(bool b) = 0;
+  //! If b is true, some items are displayed in a simplified version when moving the camera.
+  //! If b is false, items display is never altered, even when moving.
+  virtual void setFastDrawing(bool b) = 0;
+  //! Make the camera turn around.
+  virtual void turnCameraBy180Degres() = 0;
+  //! @returns a QString containing the position and orientation of the camera.
+  virtual QString dumpCameraCoordinates() = 0;
+//!Moves the camera to the new coordinates (position and orientation) through an animation.
+  virtual bool moveCameraToCoordinates(QString, 
+                                       float animation_duration = 0.5f) = 0;
+
+}; // end class Viewer_interface
+}
+}
+#endif // VIEWER_INTERFACE_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Threetuple.h b/3rdparty/CGAL/include/CGAL/Threetuple.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Threetuple.h
rename to 3rdparty/CGAL/include/CGAL/Threetuple.h
diff --git a/3rdparty/CGAL/include/CGAL/Time_stamper.h b/3rdparty/CGAL/include/CGAL/Time_stamper.h
new file mode 100644
index 0000000..c60e059
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Time_stamper.h
@@ -0,0 +1,103 @@
+// Copyright (c) 2014 GeometryFactory Sarl (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.
+//
+//
+//
+// Author(s)     : Jane Tournois
+
+#include <CGAL/Has_timestamp.h>
+
+#ifndef CGAL_TIME_STAMPER_H
+#define CGAL_TIME_STAMPER_H
+
+namespace CGAL {
+
+template <typename T>
+struct Time_stamper
+{
+  Time_stamper()
+   : time_stamp_(0) {}
+
+  Time_stamper(const Time_stamper& ts)
+   : time_stamp_(ts.time_stamp_) {}
+
+  void set_time_stamp(T* pt) {
+    pt->set_time_stamp(time_stamp_++);
+  }
+
+
+  static std::size_t hash_value(const T* p) {
+    if(NULL == p)
+      return std::size_t(-1);
+    else
+      return p->time_stamp();
+  }
+
+  static bool less(const T* p_t1, const T* p_t2) {
+    if(p_t1 == NULL)      return (p_t2 != NULL);
+    else if(p_t2 == NULL) return false;
+    else                  return p_t1->time_stamp() < p_t2->time_stamp();
+  }
+
+  void reset() {
+    time_stamp_ = 0;
+  }
+private:
+  std::size_t time_stamp_;
+}; // end class template Time_stamper<T>
+
+template <typename T>
+struct No_time_stamp
+{
+public:
+  void set_time_stamp(T*)  {}
+  static bool less(const T* p_t1,const T* p_t2) {
+    return p_t1 < p_t2;
+  }
+
+  static std::size_t hash_value(const T* p) {
+    return reinterpret_cast<std::size_t>(p)/sizeof(T);
+  }
+
+  void reset()                {}
+}; // end class template No_time_stamp<T>
+
+// That class template is an auxiliary class.  It has a
+// specialization for the case where `T::Has_timestamp` does not exists.
+// The non-specialized template, when `T::Has_timestamp` exists, derives
+// from `Time_stamper<T>` or `No_time_stamp<T>` depending on the
+// value of the Boolean constant `T::Has_timestamp`.
+// The declaration of that class template requires `T` to be a complete type.
+template <class T, bool has_timestamp = internal::Has_timestamp<T>::value>
+struct Get_time_stamper{
+  typedef Time_stamper<T> type;
+};
+
+// Specialization when `T::Has_timestamp` does not exist, derives from
+// `TimeStamper_`, or from `No_time_stamp<T>`.
+template <class T>
+struct Get_time_stamper<T,false>{
+  typedef No_time_stamp<T> type;
+};
+
+// Implementation of the timestamp policy. It is very important that the
+// declaration of that class template does not require `T` to be a complete
+// type.  That way, the declaration of a pointer of type `Time_stamper_impl<T, Ts>
+// in `Compact_container` for example is possible with an incomplete type.
+template <class T>
+struct Time_stamper_impl : public Get_time_stamper<T>::type {};
+
+} //end of namespace CGAL
+
+#endif // CGAL_TIME_STAMPER_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Timer.h b/3rdparty/CGAL/include/CGAL/Timer.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Timer.h
rename to 3rdparty/CGAL/include/CGAL/Timer.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Timer_impl.h b/3rdparty/CGAL/include/CGAL/Timer_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Timer_impl.h
rename to 3rdparty/CGAL/include/CGAL/Timer_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Tools/Counter.h b/3rdparty/CGAL/include/CGAL/Tools/Counter.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Tools/Counter.h
rename to 3rdparty/CGAL/include/CGAL/Tools/Counter.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Tools/Label.h b/3rdparty/CGAL/include/CGAL/Tools/Label.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Tools/Label.h
rename to 3rdparty/CGAL/include/CGAL/Tools/Label.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Tools/Log.h b/3rdparty/CGAL/include/CGAL/Tools/Log.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Tools/Log.h
rename to 3rdparty/CGAL/include/CGAL/Tools/Log.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Tools/Log_impl.h b/3rdparty/CGAL/include/CGAL/Tools/Log_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Tools/Log_impl.h
rename to 3rdparty/CGAL/include/CGAL/Tools/Log_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Tools/chained_map.h b/3rdparty/CGAL/include/CGAL/Tools/chained_map.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Tools/chained_map.h
rename to 3rdparty/CGAL/include/CGAL/Tools/chained_map.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Tools/utility_macros.h b/3rdparty/CGAL/include/CGAL/Tools/utility_macros.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Tools/utility_macros.h
rename to 3rdparty/CGAL/include/CGAL/Tools/utility_macros.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Traits_with_offsets_adaptor.h b/3rdparty/CGAL/include/CGAL/Traits_with_offsets_adaptor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Traits_with_offsets_adaptor.h
rename to 3rdparty/CGAL/include/CGAL/Traits_with_offsets_adaptor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Transform_iterator.h b/3rdparty/CGAL/include/CGAL/Transform_iterator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Transform_iterator.h
rename to 3rdparty/CGAL/include/CGAL/Transform_iterator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Tree_assertions.h b/3rdparty/CGAL/include/CGAL/Tree_assertions.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Tree_assertions.h
rename to 3rdparty/CGAL/include/CGAL/Tree_assertions.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Tree_base.h b/3rdparty/CGAL/include/CGAL/Tree_base.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Tree_base.h
rename to 3rdparty/CGAL/include/CGAL/Tree_base.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Tree_traits.h b/3rdparty/CGAL/include/CGAL/Tree_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Tree_traits.h
rename to 3rdparty/CGAL/include/CGAL/Tree_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangle_2.h b/3rdparty/CGAL/include/CGAL/Triangle_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangle_2.h
rename to 3rdparty/CGAL/include/CGAL/Triangle_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangle_2_Iso_rectangle_2_intersection.h b/3rdparty/CGAL/include/CGAL/Triangle_2_Iso_rectangle_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangle_2_Iso_rectangle_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Triangle_2_Iso_rectangle_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangle_2_Line_2_intersection.h b/3rdparty/CGAL/include/CGAL/Triangle_2_Line_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangle_2_Line_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Triangle_2_Line_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangle_2_Point_2_intersection.h b/3rdparty/CGAL/include/CGAL/Triangle_2_Point_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangle_2_Point_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Triangle_2_Point_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangle_2_Ray_2_intersection.h b/3rdparty/CGAL/include/CGAL/Triangle_2_Ray_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangle_2_Ray_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Triangle_2_Ray_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangle_2_Segment_2_intersection.h b/3rdparty/CGAL/include/CGAL/Triangle_2_Segment_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangle_2_Segment_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Triangle_2_Segment_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangle_2_Triangle_2_do_intersect.h b/3rdparty/CGAL/include/CGAL/Triangle_2_Triangle_2_do_intersect.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangle_2_Triangle_2_do_intersect.h
rename to 3rdparty/CGAL/include/CGAL/Triangle_2_Triangle_2_do_intersect.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangle_2_Triangle_2_intersection.h b/3rdparty/CGAL/include/CGAL/Triangle_2_Triangle_2_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangle_2_Triangle_2_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Triangle_2_Triangle_2_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangle_3.h b/3rdparty/CGAL/include/CGAL/Triangle_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangle_3.h
rename to 3rdparty/CGAL/include/CGAL/Triangle_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangle_3_Line_3_do_intersect.h b/3rdparty/CGAL/include/CGAL/Triangle_3_Line_3_do_intersect.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangle_3_Line_3_do_intersect.h
rename to 3rdparty/CGAL/include/CGAL/Triangle_3_Line_3_do_intersect.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangle_3_Plane_3_do_intersect.h b/3rdparty/CGAL/include/CGAL/Triangle_3_Plane_3_do_intersect.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangle_3_Plane_3_do_intersect.h
rename to 3rdparty/CGAL/include/CGAL/Triangle_3_Plane_3_do_intersect.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangle_3_Point_3_do_intersect.h b/3rdparty/CGAL/include/CGAL/Triangle_3_Point_3_do_intersect.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangle_3_Point_3_do_intersect.h
rename to 3rdparty/CGAL/include/CGAL/Triangle_3_Point_3_do_intersect.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangle_3_Ray_3_do_intersect.h b/3rdparty/CGAL/include/CGAL/Triangle_3_Ray_3_do_intersect.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangle_3_Ray_3_do_intersect.h
rename to 3rdparty/CGAL/include/CGAL/Triangle_3_Ray_3_do_intersect.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangle_3_Segment_3_do_intersect.h b/3rdparty/CGAL/include/CGAL/Triangle_3_Segment_3_do_intersect.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangle_3_Segment_3_do_intersect.h
rename to 3rdparty/CGAL/include/CGAL/Triangle_3_Segment_3_do_intersect.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangle_3_Tetrahedron_3_do_intersect.h b/3rdparty/CGAL/include/CGAL/Triangle_3_Tetrahedron_3_do_intersect.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangle_3_Tetrahedron_3_do_intersect.h
rename to 3rdparty/CGAL/include/CGAL/Triangle_3_Tetrahedron_3_do_intersect.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangle_3_Triangle_3_do_intersect.h b/3rdparty/CGAL/include/CGAL/Triangle_3_Triangle_3_do_intersect.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangle_3_Triangle_3_do_intersect.h
rename to 3rdparty/CGAL/include/CGAL/Triangle_3_Triangle_3_do_intersect.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangle_3_Triangle_3_intersection.h b/3rdparty/CGAL/include/CGAL/Triangle_3_Triangle_3_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangle_3_Triangle_3_intersection.h
rename to 3rdparty/CGAL/include/CGAL/Triangle_3_Triangle_3_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangle_accessor_3.h b/3rdparty/CGAL/include/CGAL/Triangle_accessor_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangle_accessor_3.h
rename to 3rdparty/CGAL/include/CGAL/Triangle_accessor_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangular_expansion_visibility_2.h b/3rdparty/CGAL/include/CGAL/Triangular_expansion_visibility_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangular_expansion_visibility_2.h
rename to 3rdparty/CGAL/include/CGAL/Triangular_expansion_visibility_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangular_field_2.h b/3rdparty/CGAL/include/CGAL/Triangular_field_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangular_field_2.h
rename to 3rdparty/CGAL/include/CGAL/Triangular_field_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulated_mixed_complex_observer_3.h b/3rdparty/CGAL/include/CGAL/Triangulated_mixed_complex_observer_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulated_mixed_complex_observer_3.h
rename to 3rdparty/CGAL/include/CGAL/Triangulated_mixed_complex_observer_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation.h b/3rdparty/CGAL/include/CGAL/Triangulation.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_2.h b/3rdparty/CGAL/include/CGAL/Triangulation_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_2.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_2.h
diff --git a/3rdparty/CGAL/include/CGAL/Triangulation_2/insert_constraints.h b/3rdparty/CGAL/include/CGAL/Triangulation_2/insert_constraints.h
new file mode 100644
index 0000000..7d766fb
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Triangulation_2/insert_constraints.h
@@ -0,0 +1,118 @@
+// Copyright (c) 2014  INRIA Sophia-Antipolis (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
+// 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(s)     : Andreas Fabri, Mariette Yvinec
+
+#ifndef CGAL_INTERNAL_TRIANGULATION_2_IMSERT_CONSTRAINTS_H
+#define CGAL_INTERNAL_TRIANGULATION_2_IMSERT_CONSTRAINTS_H
+
+#include <CGAL/Spatial_sort_traits_adapter_2.h>
+#include <CGAL/property_map.h>
+#include <boost/iterator/counting_iterator.hpp>
+#include <vector>
+#include <iterator>
+
+namespace CGAL {
+  namespace internal {
+
+
+
+    template <class T, class IndicesIterator>
+    std::size_t insert_constraints( T& t,
+                                    const std::vector<typename T::Point>& points,
+                                    IndicesIterator indices_first,
+                                    IndicesIterator indices_beyond )
+  {
+    typedef typename T::Vertex_handle Vertex_handle;
+    typedef typename T::Face_handle Face_handle;
+    typedef typename T::Geom_traits Geom_traits;
+    typedef typename T::Point Point;
+    typedef std::vector<std::size_t> Vertex_indices;
+    typedef std::vector<Vertex_handle> Vertices;
+    
+    Vertex_indices vertex_indices;
+    vertex_indices.resize(points.size());
+
+    std::copy(boost::counting_iterator<std::ptrdiff_t>(0),
+              boost::counting_iterator<std::ptrdiff_t>(points.size()),
+              std::back_inserter(vertex_indices));
+
+    typename T::size_type n = t.number_of_vertices();
+    CGAL::Spatial_sort_traits_adapter_2<
+      Geom_traits,
+      typename Pointer_property_map<Point>::const_type >
+        sort_traits(make_property_map(points),t.geom_traits());
+
+    spatial_sort(vertex_indices.begin(), vertex_indices.end(), sort_traits);
+
+    Vertices vertices;
+    vertices.resize(points.size());
+
+    Face_handle hint;
+    for(typename Vertex_indices::const_iterator
+          it_pti = vertex_indices.begin(), end = vertex_indices.end();
+          it_pti != end; ++it_pti)
+    {
+      vertices[*it_pti] = t.insert(points[*it_pti], hint);
+      hint=vertices[*it_pti]->face();
+    }
+
+    for(IndicesIterator it_cst=indices_first, end=indices_beyond;
+        it_cst!=end; ++it_cst)
+    {
+      Vertex_handle v1 = vertices[it_cst->first];
+      Vertex_handle v2 = vertices[it_cst->second];
+      if(v1 != v2) t.insert_constraint(v1, v2);
+    }
+
+    return t.number_of_vertices() - n;
+  }
+
+
+
+    template <class T,class ConstraintIterator>
+    std::size_t insert_constraints(T& t,
+                                   ConstraintIterator first,
+                                   ConstraintIterator beyond)
+  {
+    typedef typename T::Point Point;
+    typedef typename T::Point Point;
+    std::vector<Point> points;
+    for (ConstraintIterator s_it=first; s_it!=beyond; ++s_it)
+    {
+      points.push_back( T::get_source(*s_it) );
+      points.push_back( T::get_target(*s_it) );
+    }
+
+    std::vector< std::pair<std::size_t, std::size_t> > segment_indices;
+    std::size_t nb_segments = points.size() / 2;
+    segment_indices.reserve( nb_segments );
+    for (std::size_t k=0; k < nb_segments; ++k)
+      segment_indices.push_back( std::make_pair(2*k,2*k+1) );
+
+    return insert_constraints( t,
+                               points,
+                               segment_indices.begin(),
+                               segment_indices.end() );
+  }
+
+
+  }
+}
+
+#endif // CGAL_INTERNAL_TRIANGULATION_2_IMSERT_CONSTRAINTS_H
diff --git a/3rdparty/CGAL/include/CGAL/Triangulation_2_filtered_projection_traits_3.h b/3rdparty/CGAL/include/CGAL/Triangulation_2_filtered_projection_traits_3.h
new file mode 100644
index 0000000..79061dc
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Triangulation_2_filtered_projection_traits_3.h
@@ -0,0 +1,31 @@
+ // Copyright (c) 2009  GeometryFactory (France)
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Laurent Rineau
+
+
+#ifndef CGAL_TRIANGULATION_2_FILTERED_PROJECTION_TRAITS_3_H
+#define CGAL_TRIANGULATION_2_FILTERED_PROJECTION_TRAITS_3_H
+
+#define CGAL_DEPRECATED_HEADER "<CGAL/Triangulation_2_filtered_projection_traits_3.h>"
+#define CGAL_REPLACEMENT_HEADER "<CGAL/Triangulation_2_projection_traits_3.h>"
+#include <CGAL/internal/deprecation_warning.h>
+
+#include <CGAL/internal/Triangulation_2_filtered_projection_traits_3.h>
+
+#endif // CGAL_TRIANGULATION_2_FILTERED_PROJECTION_TRAITS_3_H
diff --git a/3rdparty/CGAL/include/CGAL/Triangulation_2_projection_traits_3.h b/3rdparty/CGAL/include/CGAL/Triangulation_2_projection_traits_3.h
new file mode 100644
index 0000000..3cc6c52
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Triangulation_2_projection_traits_3.h
@@ -0,0 +1,57 @@
+// Copyright (c) 2009  GeometryFactory (France)
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Laurent Rineau
+
+
+#ifndef CGAL_TRIANGULATION_2_PROJECTION_TRAITS_3_H
+#define CGAL_TRIANGULATION_2_PROJECTION_TRAITS_3_H
+
+#include <CGAL/internal/Triangulation_2_filtered_projection_traits_3.h>
+
+namespace CGAL{
+
+// This declaration is needed to break the cyclic dependency.
+template < class Filtered_kernel >
+class Triangulation_2_filtered_projection_traits_3;
+
+template <class Kernel, bool Has_filtered_predicates=Kernel::Has_filtered_predicates>
+class Triangulation_2_projection_traits_3
+  : public Triangulation_2_projection_traits_base_3<Kernel>
+{
+public:
+  explicit
+  Triangulation_2_projection_traits_3(const typename Kernel::Vector_3& n_)
+    : Triangulation_2_projection_traits_base_3<Kernel>(n_)
+  {}
+};
+
+template <class Kernel>
+class Triangulation_2_projection_traits_3<Kernel, true>
+  : public Triangulation_2_filtered_projection_traits_3<Kernel>
+{
+public:
+  explicit
+  Triangulation_2_projection_traits_3(const typename Kernel::Vector_3& n_)
+    : Triangulation_2_filtered_projection_traits_3<Kernel>(n_)
+  {}
+};
+
+} // end namespace CGAL
+
+#endif // CGAL_TRIANGULATION_2_PROJECTION_TRAITS_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_2_traits_3.h b/3rdparty/CGAL/include/CGAL/Triangulation_2_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_2_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_2_traits_3.h
diff --git a/3rdparty/CGAL/include/CGAL/Triangulation_3.h b/3rdparty/CGAL/include/CGAL/Triangulation_3.h
new file mode 100644
index 0000000..b56c13e
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Triangulation_3.h
@@ -0,0 +1,6691 @@
+// Copyright (c) 1999-2003  INRIA Sophia-Antipolis (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
+// 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(s)     : Monique Teillaud <Monique.Teillaud at sophia.inria.fr>
+//                 Sylvain Pion
+//                 Clement Jamin
+
+#ifndef CGAL_TRIANGULATION_3_H
+#define CGAL_TRIANGULATION_3_H
+
+#include <CGAL/basic.h>
+
+#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
+# define CGAL_PROFILE
+# include <CGAL/Profile_counter.h>
+#endif
+
+#include <iostream>
+#include <list>
+#include <set>
+#include <map>
+#include <utility>
+#include <stack>
+
+#include <CGAL/Unique_hash_map.h>
+#include <CGAL/triangulation_assertions.h>
+#include <CGAL/Triangulation_utils_3.h>
+
+#include <CGAL/Triangulation_data_structure_3.h>
+#include <CGAL/Triangulation_cell_base_3.h>
+#include <CGAL/Triangulation_vertex_base_3.h>
+
+#include <CGAL/spatial_sort.h>
+
+#include <CGAL/iterator.h>
+#include <CGAL/function_objects.h>
+#include <CGAL/Iterator_project.h>
+#include <CGAL/Default.h>
+
+#include <CGAL/Bbox_3.h>
+#include <CGAL/Spatial_lock_grid_3.h>
+
+#include <boost/bind.hpp>
+#include <boost/random/linear_congruential.hpp>
+#include <boost/random/uniform_smallint.hpp>
+#include <boost/random/variate_generator.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/unordered_map.hpp>
+
+#ifndef CGAL_NO_STRUCTURAL_FILTERING
+#include <CGAL/internal/Static_filters/tools.h>
+#include <CGAL/Triangulation_structural_filtering_traits.h>
+#include <CGAL/determinant.h>
+#endif // no CGAL_NO_STRUCTURAL_FILTERING
+
+#ifdef CGAL_LINKED_WITH_TBB
+# include <tbb/scalable_allocator.h>
+#endif
+
+#define CGAL_TRIANGULATION_3_USE_THE_4_POINTS_CONSTRUCTOR
+
+namespace CGAL {
+
+template < class GT, class Tds = Default,
+           class Lock_data_structure = Default >
+class Triangulation_3;
+
+template < class GT, class Tds, class Lds > std::istream& operator>>
+(std::istream& is, Triangulation_3<GT,Tds,Lds> &tr);
+
+#ifndef CGAL_NO_STRUCTURAL_FILTERING
+namespace internal {
+// structural filtering is performed only for EPIC
+struct Structural_filtering_3_tag {};
+struct No_structural_filtering_3_tag {};
+
+template <bool filter>
+struct Structural_filtering_selector_3 {
+#ifdef FORCE_STRUCTURAL_FILTERING
+  typedef Structural_filtering_3_tag  Tag;
+#else
+  typedef No_structural_filtering_3_tag  Tag;
+#endif
+};
+
+template <>
+struct Structural_filtering_selector_3<true> {
+  typedef Structural_filtering_3_tag  Tag;
+};
+}
+#endif // no CGAL_NO_STRUCTURAL_FILTERING
+
+/************************************************
+// Class Triangulation_3_base
+// Two versions: Sequential (no locking) / Parallel (with locking)
+************************************************/
+
+// Sequential (without locking)
+template <typename Concurrency_tag, typename Lock_data_structure_>
+class Triangulation_3_base
+{
+public:
+  // If Lock_data_structure_ = Default => void
+  typedef typename Default::Get<
+    Lock_data_structure_, void>::type Lock_data_structure;
+
+protected:
+  Triangulation_3_base()  {}
+
+  Triangulation_3_base(Lock_data_structure *) {}
+
+  void swap(Triangulation_3_base<Concurrency_tag, Lock_data_structure_> &){}
+
+  template <typename Vertex_triple, typename Facet>
+  struct Vertex_triple_Facet_map_generator
+  {
+    typedef boost::unordered_map<Vertex_triple, Facet> type;
+  };
+
+  template <typename Vertex_handle>
+  struct Vertex_handle_unique_hash_map_generator
+  {
+    typedef Unique_hash_map<Vertex_handle,
+                            Vertex_handle,
+                            Handle_hash_function> type;
+  };
+
+public:
+  bool is_parallel() const
+  {
+    return false;
+  }
+
+  // LOCKS (no-op functions)
+
+  template <typename Point_3>
+  bool try_lock_point(const Point_3 &, int = 0) const
+  { return true; }
+
+  template <typename Vertex_handle>
+  bool try_lock_vertex(const Vertex_handle &, int = 0) const
+  { return true; }
+
+  template <typename Cell_handle>
+  bool try_lock_cell(const Cell_handle &, int = 0) const
+  { return true; }
+
+  template <typename Facet>
+  bool try_lock_facet(const Facet &, int = 0) const
+  { return true; }
+
+  template <typename P3>
+  bool is_point_locked_by_this_thread(const P3 &) const
+  { return false; }
+
+  template <typename Cell_handle>
+  bool is_cell_locked_by_this_thread(const Cell_handle &) const
+  { return false; }
+
+  void *get_lock_data_structure() const
+  {
+    return 0;
+  }
+
+  void set_lock_data_structure(void *) const
+  {
+  }
+
+  void unlock_all_elements() const {}
+  template <typename P3> void unlock_all_elements_but_one_point(const P3 &) const {}
+
+  const Bbox_3 *get_bbox() const
+  {
+    return NULL;
+  }
+};
+
+#ifdef CGAL_LINKED_WITH_TBB
+// Parallel (with locking)
+template <typename Lock_data_structure_>
+class Triangulation_3_base<Parallel_tag, Lock_data_structure_>
+{
+public:
+  // If Lock_data_structure_ = Default => use Spatial_lock_grid_3
+  typedef typename Default::Get<
+    Lock_data_structure_, Spatial_lock_grid_3<Tag_priority_blocking> >
+    ::type Lock_data_structure;
+
+protected:
+  Triangulation_3_base()
+    : m_lock_ds(0) {}
+
+  Triangulation_3_base(Lock_data_structure *lock_ds)
+    : m_lock_ds(lock_ds) {}
+
+  void swap(Triangulation_3_base<Parallel_tag, Lock_data_structure_> &tr)
+  {
+    std::swap(tr.m_lock_ds, m_lock_ds);
+  }
+
+  template <typename Vertex_triple, typename Facet>
+  struct Vertex_triple_Facet_map_generator
+  {
+    typedef boost::unordered_map
+    <
+      Vertex_triple,
+      Facet,
+      boost::hash<Vertex_triple>,
+      std::equal_to<Vertex_triple>,
+      tbb::scalable_allocator<std::pair<const Vertex_triple, Facet> >
+    > type;
+  };
+
+
+
+  template <typename Vertex_handle>
+  struct Vertex_handle_unique_hash_map_generator
+  {
+    typedef Unique_hash_map<Vertex_handle,
+                            Vertex_handle,
+                            Handle_hash_function,
+                            tbb::scalable_allocator<Vertex_handle> > type;
+  };
+
+public:
+
+  bool is_parallel() const
+  {
+    return m_lock_ds != 0;
+  }
+
+  // LOCKS
+  template <typename Point_3>
+  bool try_lock_point(const Point_3 &p, int lock_radius = 0) const
+  {
+    bool locked = true;
+    if (m_lock_ds)
+    {
+      locked = m_lock_ds->try_lock(p, lock_radius);
+    }
+    return locked;
+  }
+
+  template <typename Vertex_handle>
+  bool try_lock_vertex(const Vertex_handle &vh, int lock_radius = 0) const
+  {
+    bool locked = true;
+    if (m_lock_ds)
+    {
+      locked = m_lock_ds->try_lock(vh->point(), lock_radius);
+    }
+    return locked;
+  }
+
+  template <typename Cell_handle>
+  bool try_lock_cell(const Cell_handle &cell_handle, int lock_radius = 0) const
+  {
+    bool success = true;
+    // Lock the element area on the grid
+    for (int iVertex = 0 ; success && iVertex < 4 ; ++iVertex)
+    {
+      success = try_lock_vertex(cell_handle->vertex(iVertex), lock_radius);
+    }
+    return success;
+  }
+
+  template <typename Facet>
+  bool try_lock_facet(const Facet &facet, int lock_radius = 0) const
+  {
+    bool success = true;
+
+    // Lock the element area on the grid
+    for (int iVertex = (facet.second+1)&3 ;
+          success && iVertex != facet.second ; iVertex = (iVertex+1)&3)
+    {
+      success = try_lock_vertex(facet.first->vertex(iVertex), lock_radius);
+    }
+
+    return success;
+  }
+
+  template <typename P3>
+  bool is_point_locked_by_this_thread(const P3 &p) const
+  {
+    bool locked = true;
+    if (m_lock_ds)
+    {
+      locked = m_lock_ds->is_locked_by_this_thread(p);
+    }
+    return locked;
+  }
+
+  template <typename Cell_handle>
+  bool is_cell_locked_by_this_thread(const Cell_handle &cell_handle) const
+  {
+    bool locked = true;
+    if (m_lock_ds)
+    {
+      for (int iVertex = 0 ; locked && iVertex < 4 ; ++iVertex)
+      {
+        locked = m_lock_ds->is_locked_by_this_thread(
+          cell_handle->vertex(iVertex)->point());
+      }
+    }
+    return locked;
+  }
+
+  Lock_data_structure *get_lock_data_structure() const
+  {
+    return m_lock_ds;
+  }
+
+  void set_lock_data_structure(Lock_data_structure *lock_ds) const
+  {
+    m_lock_ds = lock_ds;
+  }
+
+  void unlock_all_elements() const
+  {
+    if (m_lock_ds)
+      m_lock_ds->unlock_all_points_locked_by_this_thread();
+  }
+
+  template <typename P3>
+  void unlock_all_elements_but_one_point(const P3 &point) const
+  {
+    if (m_lock_ds)
+      m_lock_ds->unlock_all_tls_locked_locations_but_one_point(point);
+  }
+
+  const Bbox_3 *get_bbox() const
+  {
+    return &m_lock_ds->get_bbox();
+  }
+
+protected:
+  mutable Lock_data_structure *m_lock_ds;
+};
+#endif // CGAL_LINKED_WITH_TBB
+
+/************************************************
+ *
+ * Triangulation_3 class
+ *
+ ************************************************/
+
+template < class GT, class Tds_, class Lock_data_structure_ >
+class Triangulation_3
+  : public Triangulation_3_base<
+      // Get Concurrency_tag from TDS
+      typename Default::Get< Tds_,
+                             Triangulation_data_structure_3
+                             <
+                               Triangulation_vertex_base_3<GT>,
+                                     Triangulation_cell_base_3<GT>
+                             >
+                           >::type::Concurrency_tag,
+      Lock_data_structure_>
+  , public Triangulation_utils_3
+{
+  friend std::istream& operator>> <>
+  (std::istream& is, Triangulation_3<GT,Tds_,Lock_data_structure_> &tr);
+
+  typedef typename Default::Get<Tds_, Triangulation_data_structure_3 <
+                                          Triangulation_vertex_base_3<GT>,
+                                          Triangulation_cell_base_3<GT> > >::type Tds;
+
+  typedef Triangulation_3<GT, Tds_, Lock_data_structure_> Self;
+  typedef Triangulation_3_base<
+    typename Tds::Concurrency_tag, Lock_data_structure_>  Base;
+
+public:
+
+  typedef typename Base::Lock_data_structure   Lock_data_structure;
+  typedef Tds                                  Triangulation_data_structure;
+  typedef GT                                   Geom_traits;
+
+  typedef typename GT::Point_3                 Point;
+  typedef typename GT::Segment_3               Segment;
+  typedef typename GT::Triangle_3              Triangle;
+  typedef typename GT::Tetrahedron_3           Tetrahedron;
+
+  typedef typename Tds::Concurrency_tag        Concurrency_tag;
+
+  typedef typename Tds::Vertex                 Vertex;
+  typedef typename Tds::Cell                   Cell;
+  typedef typename Tds::Facet                  Facet;
+  typedef typename Tds::Edge                   Edge;
+
+  typedef typename Tds::size_type              size_type;
+  typedef typename Tds::difference_type        difference_type;
+
+  typedef typename Tds::Vertex_handle          Vertex_handle;
+  typedef typename Tds::Cell_handle            Cell_handle;
+
+  typedef typename Tds::Cell_circulator        Cell_circulator;
+  typedef typename Tds::Facet_circulator       Facet_circulator;
+
+  // Not documented, see TDS.
+  typedef typename Tds::Face_circulator        Face_circulator;
+
+  typedef typename Tds::Cell_iterator          Cell_iterator;
+  typedef typename Tds::Facet_iterator         Facet_iterator;
+  typedef typename Tds::Edge_iterator          Edge_iterator;
+  typedef typename Tds::Vertex_iterator        Vertex_iterator;
+
+  typedef Cell_iterator                        All_cells_iterator;
+  typedef Facet_iterator                       All_facets_iterator;
+  typedef Edge_iterator                        All_edges_iterator;
+  typedef Vertex_iterator                      All_vertices_iterator;
+
+  typedef typename Tds::Simplex                Simplex;
+private:
+  // This class is used to generate the Finite_*_iterators.
+  class Infinite_tester
+  {
+      const Self *t;
+
+  public:
+
+      Infinite_tester() {}
+
+      Infinite_tester(const Self *tr)
+          : t(tr) {}
+
+      bool operator()(const Vertex_iterator & v) const
+      {
+          return t->is_infinite(v);
+      }
+
+      bool operator()(typename std::vector<Vertex_handle>::const_iterator v) const
+      {
+              return t->is_infinite(*v);
+      }
+
+      bool operator()(const Cell_iterator & c) const
+      {
+          return t->is_infinite(c);
+      }
+
+      bool operator()(const Edge_iterator & e) const
+      {
+          return t->is_infinite(*e);
+      }
+
+      bool operator()(const Facet_iterator & f) const
+      {
+          return t->is_infinite(*f);
+      }
+  };
+
+public:
+
+  // We derive in order to add a conversion to handle.
+  class Finite_cells_iterator
+    : public Filter_iterator<Cell_iterator, Infinite_tester> {
+    typedef Filter_iterator<Cell_iterator, Infinite_tester> Base;
+    typedef Finite_cells_iterator                           Self;
+  public:
+
+    Finite_cells_iterator() : Base() {}
+    Finite_cells_iterator(const Base &b) : Base(b) {}
+
+    Self & operator++() { Base::operator++(); return *this; }
+    Self & operator--() { Base::operator--(); return *this; }
+    Self operator++(int) { Self tmp(*this); ++(*this); return tmp; }
+    Self operator--(int) { Self tmp(*this); --(*this); return tmp; }
+
+    operator Cell_handle() const { return Base::base(); }
+  };
+
+  // We derive in order to add a conversion to handle.
+  class Finite_vertices_iterator
+    : public Filter_iterator<Vertex_iterator, Infinite_tester> {
+    typedef Filter_iterator<Vertex_iterator, Infinite_tester> Base;
+    typedef Finite_vertices_iterator                          Self;
+  public:
+
+    Finite_vertices_iterator() : Base() {}
+    Finite_vertices_iterator(const Base &b) : Base(b) {}
+
+    Self & operator++() { Base::operator++(); return *this; }
+    Self & operator--() { Base::operator--(); return *this; }
+    Self operator++(int) { Self tmp(*this); ++(*this); return tmp; }
+    Self operator--(int) { Self tmp(*this); --(*this); return tmp; }
+
+    operator Vertex_handle() const { return Base::base(); }
+  };
+
+  typedef Filter_iterator<Edge_iterator, Infinite_tester>
+                                               Finite_edges_iterator;
+  typedef Filter_iterator<Facet_iterator, Infinite_tester>
+                                               Finite_facets_iterator;
+
+private:
+  // Auxiliary iterators for convenience
+  // do not use default template argument to please VC++
+  typedef Project_point<Vertex>                           Proj_point;
+public:
+  typedef Iterator_project<Finite_vertices_iterator,
+                           Proj_point,
+                           const Point&,
+                           const Point*,
+                           std::ptrdiff_t,
+                           std::bidirectional_iterator_tag>  Point_iterator;
+
+  typedef Point                         value_type; // to have a back_inserter
+  typedef const value_type&             const_reference;
+
+  //Tag to distinguish triangulations with weighted_points
+  typedef Tag_false  Weighted_tag;
+
+
+
+  enum Locate_type {
+    VERTEX=0,
+    EDGE, //1
+    FACET, //2
+    CELL, //3
+    OUTSIDE_CONVEX_HULL, //4
+    OUTSIDE_AFFINE_HULL };//5
+
+protected:
+  Tds _tds;
+  GT  _gt;
+  Vertex_handle infinite; //infinite vertex
+
+  Comparison_result
+  compare_xyz(const Point &p, const Point &q) const
+  {
+      return geom_traits().compare_xyz_3_object()(p, q);
+  }
+
+  bool
+  equal(const Point &p, const Point &q) const
+  {
+      return compare_xyz(p, q) == EQUAL;
+  }
+
+  Orientation
+  orientation(const Point &p, const Point &q,
+              const Point &r, const Point &s) const
+  {
+      return geom_traits().orientation_3_object()(p, q, r, s);
+  }
+
+  bool
+  coplanar(const Point &p, const Point &q,
+           const Point &r, const Point &s) const
+  {
+      return orientation(p, q, r, s) == COPLANAR;
+  }
+
+  Orientation
+  coplanar_orientation(const Point &p, const Point &q, const Point &r) const
+  {
+      return geom_traits().coplanar_orientation_3_object()(p, q, r);
+  }
+
+  bool
+  collinear(const Point &p, const Point &q, const Point &r) const
+  {
+      return coplanar_orientation(p, q, r) == COLLINEAR;
+  }
+
+  Segment
+  construct_segment(const Point &p, const Point &q) const
+  {
+      return geom_traits().construct_segment_3_object()(p, q);
+  }
+
+  Triangle
+  construct_triangle(const Point &p, const Point &q, const Point &r) const
+  {
+      return geom_traits().construct_triangle_3_object()(p, q, r);
+  }
+
+  Tetrahedron
+  construct_tetrahedron(const Point &p, const Point &q,
+                        const Point &r, const Point &s) const
+  {
+      return geom_traits().construct_tetrahedron_3_object()(p, q, r, s);
+  }
+
+  enum COLLINEAR_POSITION {BEFORE, SOURCE, MIDDLE, TARGET, AFTER};
+
+  COLLINEAR_POSITION
+  collinear_position(const Point &s, const Point &p, const Point &t) const
+  // (s,t) defines a line, p is on that line.
+  // Depending on the position of p wrt s and t, returns :
+  // --------------- s ---------------- t --------------
+  // BEFORE       SOURCE    MIDDLE    TARGET       AFTER
+  {
+      CGAL_triangulation_precondition(!equal(s, t));
+      CGAL_triangulation_precondition(collinear(s, p, t));
+
+      Comparison_result ps = compare_xyz(p, s);
+      if (ps == EQUAL)
+          return SOURCE;
+      Comparison_result st = compare_xyz(s, t);
+      if (ps == st)
+          return BEFORE;
+      Comparison_result pt = compare_xyz(p, t);
+      if (pt == EQUAL)
+          return TARGET;
+      if (pt == st)
+          return MIDDLE;
+      return AFTER;
+  }
+
+  void init_tds()
+    {
+      infinite = _tds.insert_increase_dimension();
+    }
+
+  void init_tds(const Point &p0, const Point &p1,
+                const Point &p2, const Point &p3)
+  {
+    Vertex_handle v0, v1, v2, v3;
+    infinite = _tds.insert_first_finite_cell(v0, v1, v2, v3, infinite);
+    v0->set_point(p0);
+    v1->set_point(p1);
+    v2->set_point(p2);
+    v3->set_point(p3);
+  }
+
+  void init_tds(const Point &p0, const Point &p1,
+                const Point &p2, const Point &p3,
+                Vertex_handle &vh0, Vertex_handle &vh1,
+                Vertex_handle &vh2, Vertex_handle &vh3)
+  {
+    infinite = _tds.insert_first_finite_cell(vh0, vh1, vh2, vh3, infinite);
+    vh0->set_point(p0);
+    vh1->set_point(p1);
+    vh2->set_point(p2);
+    vh3->set_point(p3);
+  }
+
+public:
+
+  // CONSTRUCTORS
+  Triangulation_3(const GT & gt = GT(), Lock_data_structure *lock_ds = NULL)
+    : Base(lock_ds), _tds(), _gt(gt)
+    {
+      init_tds();
+    }
+
+  Triangulation_3(Lock_data_structure *lock_ds, const GT & gt = GT())
+    : Base(lock_ds), _tds(), _gt(gt)
+    {
+      init_tds();
+    }
+
+  // copy constructor duplicates vertices and cells
+  Triangulation_3(const Triangulation_3 & tr)
+    : Base(tr.get_lock_data_structure()), _gt(tr._gt)
+    {
+      infinite = _tds.copy_tds(tr._tds, tr.infinite);
+      CGAL_triangulation_expensive_postcondition(*this == tr);
+    }
+
+  template < typename InputIterator >
+  Triangulation_3(InputIterator first, InputIterator last,
+                  const GT & gt = GT(), Lock_data_structure *lock_ds = NULL)
+    : Base(lock_ds), _gt(gt)
+    {
+      init_tds();
+      insert(first, last);
+    }
+
+  // Create the 3D triangulation of p0, p1, p3 and p4
+  // Precondition: p0, p1, p3 and p4 MUST BE positively oriented
+  Triangulation_3(const Point &p0, const Point &p1,
+                  const Point &p3, const Point &p4,
+                  const GT & gt = GT(), Lock_data_structure *lock_ds = NULL)
+    : Base(lock_ds), _gt(gt)
+    {
+      CGAL_triangulation_precondition(orientation(p0, p1, p3, p4) == POSITIVE);
+      init_tds(p0, p1, p3, p4);
+    }
+
+  void clear()
+    {
+      _tds.clear();
+      init_tds();
+    }
+
+  Triangulation_3 & operator=(Triangulation_3 tr)
+    {
+      // The triangulation passed as argument has been copied,
+      // because the parameter tr is passed by value. Then the following
+      // swap consumes the *copy*. The original triangulation is left
+      // untouched.
+      swap(tr);
+      return *this;
+    }
+
+  // HELPING FUNCTIONS
+
+  void swap(Triangulation_3 &tr)
+    {
+      std::swap(tr._gt, _gt);
+      std::swap(tr.infinite, infinite);
+      _tds.swap(tr._tds);
+      Base::swap(tr);
+    }
+
+  //ACCESS FUNCTIONS
+  const GT & geom_traits() const
+    { return _gt;}
+
+  const Tds & tds() const
+    { return _tds;}
+
+  Tds & tds()
+    { return _tds;}
+
+  int dimension() const
+    { return _tds.dimension();}
+
+  size_type number_of_finite_cells() const;
+
+  size_type number_of_cells() const;
+
+  size_type number_of_finite_facets() const;
+
+  size_type number_of_facets() const;
+
+  size_type number_of_finite_edges() const;
+
+  size_type number_of_edges() const;
+
+  size_type number_of_vertices() const // number of finite vertices
+    {return _tds.number_of_vertices()-1;}
+
+  Vertex_handle infinite_vertex() const
+    { return infinite; }
+
+  void set_infinite_vertex(Vertex_handle v)
+    { infinite=v;}
+
+  Cell_handle infinite_cell() const
+    {
+      CGAL_triangulation_assertion(infinite_vertex()->cell()->
+                                   has_vertex(infinite_vertex()));
+      return infinite_vertex()->cell();
+    }
+
+  // GEOMETRIC ACCESS FUNCTIONS
+
+  Tetrahedron tetrahedron(const Cell_handle c) const
+    {
+      CGAL_triangulation_precondition( dimension() == 3 );
+      CGAL_triangulation_precondition( ! is_infinite(c) );
+      return construct_tetrahedron(c->vertex(0)->point(),
+                                   c->vertex(1)->point(),
+                                   c->vertex(2)->point(),
+                                   c->vertex(3)->point());
+    }
+
+  Triangle triangle(const Cell_handle c, int i) const;
+
+  Triangle triangle(const Facet & f) const
+    { return triangle(f.first, f.second); }
+
+  Segment segment(const Cell_handle c, int i, int j) const;
+
+  Segment segment(const Edge & e) const
+    { return segment(e.first,e.second,e.third); }
+
+  const Point & point(Cell_handle c, int i) const {
+    CGAL_triangulation_precondition( dimension() >= 0 );
+    CGAL_triangulation_precondition( i >= 0 && i <= dimension() );
+    CGAL_triangulation_precondition( ! is_infinite(c->vertex(i)) );
+    return c->vertex(i)->point();
+  }
+
+  const Point & point(Vertex_handle v) const {
+    CGAL_triangulation_precondition( dimension() >= 0 );
+    CGAL_triangulation_precondition( ! is_infinite(v) );
+    return v->point();
+  }
+
+  // TEST IF INFINITE FEATURES
+  bool is_infinite(const Vertex_handle v) const
+  { return v == infinite_vertex(); }
+
+  bool is_infinite(const Cell_handle c) const
+    {
+      CGAL_triangulation_precondition( dimension() == 3 );
+      return c->has_vertex(infinite_vertex());
+    }
+
+  bool is_infinite(const Cell_handle c, int i) const;
+
+  bool is_infinite(const Facet & f) const
+    { return is_infinite(f.first,f.second); }
+
+  bool is_infinite(const Cell_handle c, int i, int j) const;
+
+  bool is_infinite(const Edge & e) const
+    { return is_infinite(e.first,e.second,e.third); }
+
+  //QUERIES
+
+  bool is_vertex(const Point & p, Vertex_handle & v) const;
+
+  bool is_vertex(Vertex_handle v) const;
+  bool is_edge(Vertex_handle u, Vertex_handle v,
+               Cell_handle & c, int & i, int & j) const;
+  bool is_facet(Vertex_handle u, Vertex_handle v, Vertex_handle w,
+                Cell_handle & c, int & i, int & j, int & k) const;
+  bool is_cell(Cell_handle c) const;
+  bool is_cell(Vertex_handle u, Vertex_handle v,
+               Vertex_handle w, Vertex_handle t,
+               Cell_handle & c, int & i, int & j, int & k, int & l) const;
+  bool is_cell(Vertex_handle u, Vertex_handle v,
+               Vertex_handle w, Vertex_handle t,
+               Cell_handle & c) const;
+
+  bool has_vertex(const Facet & f, Vertex_handle v, int & j) const;
+  bool has_vertex(Cell_handle c, int i, Vertex_handle v, int & j) const;
+  bool has_vertex(const Facet & f, Vertex_handle v) const;
+  bool has_vertex(Cell_handle c, int i, Vertex_handle v) const;
+
+  bool are_equal(Cell_handle c, int i, Cell_handle n, int j) const;
+  bool are_equal(const Facet & f, const Facet & g) const;
+  bool are_equal(const Facet & f, Cell_handle n, int j) const;
+
+#ifdef CGAL_NO_STRUCTURAL_FILTERING
+  Cell_handle
+  locate(const Point & p,
+         Locate_type & lt, int & li, int & lj,
+         Cell_handle start = Cell_handle(),
+         bool *could_lock_zone = NULL) const;
+#else // no CGAL_NO_STRUCTURAL_FILTERING
+#  ifndef CGAL_T3_STRUCTURAL_FILTERING_MAX_VISITED_CELLS
+#    define CGAL_T3_STRUCTURAL_FILTERING_MAX_VISITED_CELLS 2500
+#  endif // no CGAL_T3_STRUCTURAL_FILTERING_MAX_VISITED_CELLS
+
+
+public:
+  Cell_handle
+  inexact_locate(const Point& p,
+                 Cell_handle start = Cell_handle(),
+                 int max_num_cells = CGAL_T3_STRUCTURAL_FILTERING_MAX_VISITED_CELLS,
+                 bool *could_lock_zone = NULL) const;
+protected:
+  Cell_handle
+  exact_locate(const Point& p,
+               Locate_type& lt,
+               int& li, int & lj,
+               Cell_handle start,
+               bool *could_lock_zone = NULL
+               ) const;
+
+  Cell_handle
+  generic_locate(const Point& p,
+                 Locate_type& lt,
+                 int& li, int & lj,
+                 Cell_handle start,
+                 internal::Structural_filtering_3_tag,
+                 bool *could_lock_zone = NULL) const
+  {
+    Cell_handle ch = inexact_locate(
+      p, start, CGAL_T3_STRUCTURAL_FILTERING_MAX_VISITED_CELLS, could_lock_zone);
+    if (could_lock_zone && *could_lock_zone == false)
+      return ch; // = Cell_handle() here
+    else
+      return exact_locate(p, lt, li, lj, ch, could_lock_zone);
+  }
+
+  Cell_handle
+  generic_locate(const Point& p,
+                 Locate_type& lt,
+                 int& li, int & lj,
+                 Cell_handle start,
+                 internal::No_structural_filtering_3_tag
+                 , bool *could_lock_zone = NULL) const
+  {
+    return exact_locate(p, lt, li, lj, start, could_lock_zone);
+  }
+
+public:
+  Orientation
+  inexact_orientation(const Point &p, const Point &q,
+                      const Point &r, const Point &s) const
+  {
+  // So that this code works well with Lazy_kernel
+  internal::Static_filters_predicates::Get_approx<Point> get_approx;
+    const double px = to_double(get_approx(p).x());
+    const double py = to_double(get_approx(p).y());
+    const double pz = to_double(get_approx(p).z());
+    const double qx = to_double(get_approx(q).x());
+    const double qy = to_double(get_approx(q).y());
+    const double qz = to_double(get_approx(q).z());
+    const double rx = to_double(get_approx(r).x());
+    const double ry = to_double(get_approx(r).y());
+    const double rz = to_double(get_approx(r).z());
+    const double sx = to_double(get_approx(s).x());
+    const double sy = to_double(get_approx(s).y());
+    const double sz = to_double(get_approx(s).z());
+
+    const double pqx = qx - px;
+    const double pqy = qy - py;
+    const double pqz = qz - pz;
+    const double prx = rx - px;
+    const double pry = ry - py;
+    const double prz = rz - pz;
+    const double psx = sx - px;
+    const double psy = sy - py;
+    const double psz = sz - pz;
+
+    const double det = determinant(pqx, pqy, pqz,
+                                   prx, pry, prz,
+                                   psx, psy, psz);
+    if (det > 0) return POSITIVE;
+    if (det < 0) return NEGATIVE;
+    return ZERO;
+  }
+
+public:
+
+  Cell_handle
+  locate(const Point & p,
+         Locate_type & lt, int & li, int & lj,
+         Cell_handle start = Cell_handle()
+         , bool *could_lock_zone = NULL
+         ) const
+  {
+    typedef Triangulation_structural_filtering_traits<Geom_traits> TSFT;
+    typedef typename internal::Structural_filtering_selector_3<
+      TSFT::Use_structural_filtering_tag::value >::Tag Should_filter_tag;
+
+    return generic_locate(p, lt, li, lj, start, Should_filter_tag(), could_lock_zone);
+  }
+#endif // no CGAL_NO_STRUCTURAL_FILTERING
+
+  Cell_handle
+  locate(const Point & p, Cell_handle start = Cell_handle(),
+         bool *could_lock_zone = NULL) const
+  {
+      Locate_type lt;
+      int li, lj;
+      return locate( p, lt, li, lj, start, could_lock_zone);
+  }
+
+  Cell_handle
+  locate(const Point & p,
+         Locate_type & lt, int & li, int & lj, Vertex_handle hint,
+   bool *could_lock_zone = NULL) const
+  {
+      return locate(p, lt, li, lj,
+        hint == Vertex_handle() ? infinite_cell() : hint->cell(),
+        could_lock_zone);
+  }
+
+  Cell_handle
+  locate(const Point & p, Vertex_handle hint,
+         bool *could_lock_zone = NULL) const
+    {
+      return locate(p, hint == Vertex_handle() ? infinite_cell() : hint->cell(),
+        could_lock_zone);
+  }
+
+  // PREDICATES ON POINTS ``TEMPLATED'' by the geom traits
+
+  Bounded_side
+  side_of_tetrahedron(const Point & p,
+                      const Point & p0,
+                      const Point & p1,
+                      const Point & p2,
+                      const Point & p3,
+                      Locate_type & lt, int & i, int & j ) const;
+  Bounded_side
+  side_of_cell(const Point & p,
+               Cell_handle c,
+               Locate_type & lt, int & i, int & j) const;
+  Bounded_side
+  side_of_triangle(const Point & p,
+                   const Point & p0, const Point & p1, const Point & p2,
+                   Locate_type & lt, int & i, int & j ) const;
+  Bounded_side
+  side_of_facet(const Point & p,
+                Cell_handle c,
+                Locate_type & lt, int & li, int & lj) const;
+  Bounded_side
+  side_of_facet(const Point & p,
+                const Facet & f,
+                Locate_type & lt, int & li, int & lj) const
+    {
+      CGAL_triangulation_precondition( f.second == 3 );
+      return side_of_facet(p, f.first, lt, li, lj);
+    }
+  Bounded_side
+  side_of_segment(const Point & p,
+                  const Point & p0, const Point & p1,
+                  Locate_type & lt, int & i ) const;
+  Bounded_side
+  side_of_edge(const Point & p,
+               Cell_handle c,
+               Locate_type & lt, int & li) const;
+  Bounded_side
+  side_of_edge(const Point & p,
+               const Edge & e,
+               Locate_type & lt, int & li) const
+    {
+      CGAL_triangulation_precondition( e.second == 0 );
+      CGAL_triangulation_precondition( e.third == 1 );
+      return side_of_edge(p, e.first, lt, li);
+    }
+
+  // Functions forwarded from TDS.
+  int mirror_index(Cell_handle c, int i) const
+  { return _tds.mirror_index(c, i); }
+
+  Vertex_handle mirror_vertex(Cell_handle c, int i) const
+  { return _tds.mirror_vertex(c, i); }
+
+  Facet mirror_facet(Facet f) const
+  { return _tds.mirror_facet(f);}
+
+  // MODIFIERS
+  bool flip(const Facet &f)
+  // returns false if the facet is not flippable
+  // true other wise and
+  // flips facet i of cell c
+  // c will be replaced by one of the new cells
+  {
+    return flip( f.first, f.second);
+  }
+  bool flip(Cell_handle c, int i);
+  void flip_flippable(const Facet &f)
+  {
+    flip_flippable( f.first, f.second);
+  }
+  void flip_flippable(Cell_handle c, int i);
+  bool flip(const Edge &e)
+  // returns false if the edge is not flippable
+  // true otherwise and
+  // flips edge i,j of cell c
+  // c will be deleted
+  {
+    return flip( e.first, e.second, e.third );
+  }
+  bool flip(Cell_handle c, int i, int j);
+  void flip_flippable(const Edge &e)
+  {
+    flip_flippable( e.first, e.second, e.third );
+  }
+  void flip_flippable(Cell_handle c, int i, int j);
+
+  //INSERTION
+
+  Vertex_handle insert(const Point & p, Vertex_handle hint)
+  {
+    return insert(p, hint == Vertex_handle() ? infinite_cell() : hint->cell());
+  }
+  Vertex_handle insert(const Point & p, Cell_handle start = Cell_handle());
+  Vertex_handle insert(const Point & p, Locate_type lt, Cell_handle c,
+                       int li, int lj);
+
+//protected: // internal methods
+
+  template <class OutputItCells>
+  Vertex_handle insert_and_give_new_cells(const Point  &p,
+                                          OutputItCells fit,
+                                          Cell_handle start = Cell_handle() );
+
+  template <class OutputItCells>
+  Vertex_handle insert_and_give_new_cells(const Point& p,
+                                          OutputItCells fit,
+                                          Vertex_handle hint);
+
+  template <class OutputItCells>
+  Vertex_handle insert_and_give_new_cells(const Point& p,
+                                          Locate_type lt,
+                                          Cell_handle c, int li, int lj,
+                                          OutputItCells fit);
+
+  template < class Conflict_tester, class Hidden_points_visitor >
+  inline Vertex_handle insert_in_conflict(const Point & p,
+                                          Locate_type lt,
+                                          Cell_handle c, int li, int lj,
+                                          const Conflict_tester &tester,
+                                          Hidden_points_visitor &hider,
+                                          bool *could_lock_zone = NULL);
+
+  template < class InputIterator >
+  std::ptrdiff_t insert(InputIterator first, InputIterator last)
+    {
+      size_type n = number_of_vertices();
+
+      std::vector<Point> points (first, last);
+      spatial_sort (points.begin(), points.end(), geom_traits());
+
+      Vertex_handle hint;
+      for (typename std::vector<Point>::const_iterator p = points.begin(), end = points.end();
+              p != end; ++p)
+          hint = insert(*p, hint);
+
+      return number_of_vertices() - n;
+    }
+
+  Vertex_handle
+  insert_in_cell(const Point & p, Cell_handle c);
+
+  Vertex_handle
+  insert_in_facet(const Point & p, Cell_handle c, int i);
+
+  Vertex_handle
+  insert_in_facet(const Point & p, const Facet & f)
+    {
+      return insert_in_facet(p, f.first, f.second);
+    }
+
+  Vertex_handle
+  insert_in_edge(const Point & p, Cell_handle c, int i, int j);
+
+  Vertex_handle
+  insert_in_edge(const Point & p, const Edge & e)
+    {
+      return insert_in_edge(p, e.first, e.second, e.third);
+    }
+
+  Vertex_handle
+  insert_outside_convex_hull(const Point & p, Cell_handle c);
+
+  Vertex_handle
+  insert_outside_affine_hull(const Point & p);
+
+  template <class CellIt>
+  Vertex_handle
+  insert_in_hole(const Point & p, CellIt cell_begin, CellIt cell_end,
+                 Cell_handle begin, int i)
+  {
+      // Some geometric preconditions should be tested...
+      Vertex_handle v = _tds.insert_in_hole(cell_begin, cell_end, begin, i);
+      v->set_point(p);
+      return v;
+  }
+
+  template <class CellIt>
+  Vertex_handle
+  insert_in_hole(const Point & p, CellIt cell_begin, CellIt cell_end,
+                 Cell_handle begin, int i, Vertex_handle newv)
+  {
+      // Some geometric preconditions should be tested...
+      newv->set_point(p);
+      return _tds.insert_in_hole(cell_begin, cell_end, begin, i, newv);
+  }
+
+  // Internal function, cells should already be marked.
+  template <class CellIt>
+  Vertex_handle
+  _insert_in_hole(const Point & p, CellIt cell_begin, CellIt cell_end,
+                  Cell_handle begin, int i)
+  {
+      // Some geometric preconditions should be tested...
+      Vertex_handle v = _tds._insert_in_hole(cell_begin, cell_end, begin, i);
+      v->set_point(p);
+      return v;
+  }
+
+  // Internal function, cells should already be marked.
+  template <class CellIt>
+  Vertex_handle
+  _insert_in_hole(const Point & p, CellIt cell_begin, CellIt cell_end,
+                  Cell_handle begin, int i, Vertex_handle newv)
+  {
+      // Some geometric preconditions should be tested...
+      newv->set_point(p);
+      return _tds._insert_in_hole(cell_begin, cell_end, begin, i, newv);
+  }
+
+protected:
+
+  template < class InputIterator >
+  bool does_repeat_in_range(InputIterator first, InputIterator beyond) const;
+
+  template < class InputIterator >
+  bool infinite_vertex_in_range(InputIterator first, InputIterator beyond) const;
+
+
+  // - c is the current cell, which must be in conflict.
+  // - tester is the function object that tests if a cell is in conflict.
+  template <class Conflict_test,
+            class OutputIteratorBoundaryFacets,
+            class OutputIteratorCells,
+            class OutputIteratorInternalFacets>
+  Triple<OutputIteratorBoundaryFacets,
+         OutputIteratorCells,
+         OutputIteratorInternalFacets>
+  find_conflicts(
+     Cell_handle d,
+     const Conflict_test &tester,
+     Triple<OutputIteratorBoundaryFacets,
+     OutputIteratorCells,
+     OutputIteratorInternalFacets> it
+     , bool *could_lock_zone = NULL
+     , const Facet *this_facet_must_be_in_the_cz = NULL
+     , bool *the_facet_is_in_its_cz = NULL
+     ) const
+  {
+    CGAL_triangulation_precondition( dimension()>=2 );
+
+    if (the_facet_is_in_its_cz)
+      *the_facet_is_in_its_cz = false;
+
+    if (could_lock_zone)
+      *could_lock_zone = true;
+
+    if (could_lock_zone)
+    {
+      if (!this->try_lock_cell(d))
+      {
+        *could_lock_zone = false;
+        return it;
+      }
+    }
+
+    CGAL_triangulation_precondition( tester(d) );
+
+    // To store the boundary cells, in case we need to rollback
+    std::stack<Cell_handle> cell_stack;
+    cell_stack.push(d);
+    d->tds_data().mark_in_conflict();
+
+    *it.second++ = d;
+
+    do {
+      Cell_handle c = cell_stack.top();
+      cell_stack.pop();
+
+      // For each neighbor cell
+      for (int i=0; i<dimension()+1; ++i) {
+        Cell_handle test = c->neighbor(i);
+
+        // "test" is either in the conflict zone,
+        // either facet-adjacent to the CZ
+
+        if (test->tds_data().is_in_conflict()) {
+
+          Facet f(c, i); // Internal facet.
+          // Is it the facet where're looking for?
+          if (this_facet_must_be_in_the_cz && the_facet_is_in_its_cz
+            && f == *this_facet_must_be_in_the_cz)
+          {
+            *the_facet_is_in_its_cz = true;
+          }
+          if (c < test)
+          {
+            *it.third++ = f;
+          }
+          continue; // test was already in conflict.
+        }
+        if (test->tds_data().is_clear()) {
+            if (tester(test)) {
+
+            // "test" is in the conflict zone
+            if (could_lock_zone)
+            {
+              if (!this->try_lock_cell(test))
+              {
+                *could_lock_zone = false;
+                // Unlock
+                return it;
+              }
+            }
+
+
+            Facet f(c, i); // Internal facet.
+            // Is it the facet where're looking for?
+            if (this_facet_must_be_in_the_cz && the_facet_is_in_its_cz
+              && f == *this_facet_must_be_in_the_cz)
+            {
+              *the_facet_is_in_its_cz = true;
+            }
+
+            if (c < test)
+            {
+              *it.third++ = f;
+            }
+
+            cell_stack.push(test);
+            test->tds_data().mark_in_conflict();
+            *it.second++ = test;
+            continue;
+          }
+
+          test->tds_data().mark_on_boundary();
+        }
+
+        Facet f(c, i); // Boundary facet.
+        // Is it the facet where're looking for?
+        if (this_facet_must_be_in_the_cz
+            && the_facet_is_in_its_cz
+            &&
+            (mirror_facet(f) == *this_facet_must_be_in_the_cz
+             || f == *this_facet_must_be_in_the_cz) )
+        {
+          *the_facet_is_in_its_cz = true;
+        }
+
+        *it.first++ = f;
+      }
+    } while (!cell_stack.empty());
+    return it;
+  }
+
+  // This one takes a function object to recursively determine the cells in
+  // conflict, then calls _tds._insert_in_hole().
+  template < class Conflict_test >
+  Vertex_handle
+  insert_conflict(Cell_handle c, const Conflict_test &tester)
+  {
+    CGAL_triangulation_precondition( dimension() >= 2 );
+    CGAL_triangulation_precondition( c != Cell_handle() );
+    CGAL_triangulation_precondition( tester(c) );
+
+    std::vector<Cell_handle> cells;
+    cells.reserve(32);
+
+    Facet facet;
+
+    // Find the cells in conflict
+    switch (dimension()) {
+    case 3:
+      find_conflicts(c, tester, make_triple(Oneset_iterator<Facet>(facet),
+                                            std::back_inserter(cells),
+                                            Emptyset_iterator()));
+      break;
+    case 2:
+      find_conflicts(c, tester, make_triple(Oneset_iterator<Facet>(facet),
+                                            std::back_inserter(cells),
+                                            Emptyset_iterator()));
+    }
+    // Create the new cells and delete the old.
+    return _tds._insert_in_hole(cells.begin(), cells.end(),
+                                  facet.first, facet.second);
+  }
+
+private:
+  // Here are the conflit tester function objects passed to
+  // insert_conflict_[23]() by insert_outside_convex_hull().
+  class Conflict_tester_outside_convex_hull_3
+  {
+      const Point &p;
+      const Self *t;
+
+  public:
+
+      Conflict_tester_outside_convex_hull_3(const Point &pt, const Self *tr)
+          : p(pt), t(tr) {}
+
+      bool operator()(const Cell_handle c) const
+      {
+          Locate_type loc;
+          int i, j;
+          return t->side_of_cell( p, c, loc, i, j ) == ON_BOUNDED_SIDE;
+      }
+  };
+
+  class Conflict_tester_outside_convex_hull_2
+  {
+      const Point &p;
+      const Self *t;
+
+  public:
+
+      Conflict_tester_outside_convex_hull_2(const Point &pt, const Self *tr)
+          : p(pt), t(tr) {}
+
+      bool operator()(const Cell_handle c) const
+      {
+          Locate_type loc;
+          int i, j;
+          return t->side_of_facet( p, c, loc, i, j ) == ON_BOUNDED_SIDE;
+      }
+  };
+
+protected:
+
+  // no point being private, we might need to test
+  // whether a displacement decreases dimension on
+  // others inherited triangulations
+  bool test_dim_down(Vertex_handle v) const;
+
+  bool test_dim_down_using_incident_cells_3(
+    Vertex_handle v, std::vector<Cell_handle> &incident_cells,
+    std::vector<Vertex_handle> &adj_vertices,
+    bool *could_lock_zone = NULL) const;
+
+  // REMOVAL
+  template < class VertexRemover >
+  void remove(Vertex_handle v, VertexRemover &remover);
+  template < class VertexRemover >
+  // Concurrency-safe version
+  // Pre-condition: dimension = 3
+  // The return value is only meaningful if *could_lock_zone = true:
+  // * returns true if the vertex was removed
+  // * returns false if the vertex wasn't removed since it would decrease
+  //   the dimension => needs to be done sequentially
+  bool remove(Vertex_handle v, VertexRemover &remover,
+              bool *could_lock_zone);
+
+  template < class VertexRemover, class OutputItCells >
+  void remove_and_give_new_cells(Vertex_handle v, VertexRemover &remover,
+                                 OutputItCells fit);
+
+  // This function removes a batch of points at once.
+  // If points are grouped in cluster, the performance is increased
+  // compared to removing one by one.
+  // For now, this function is only guaranteed for Delaunay triangulations (or Regular as Delaunay).
+  // By doing these kind of remove followed by inserting the cluster,
+  // we achieve fast relocations for a batch of points (in a Delaunay triangulation).
+  template < class InputIterator, class VertexRemover >
+  size_type remove(InputIterator first, InputIterator beyond,
+                   VertexRemover &remover);
+  enum REMOVE_VERTEX_STATE {CLEAR, TO_REMOVE, PROCESSED, EXTREMITY};
+
+  // MOVE
+  template < class VertexRemover, class VertexInserter >
+  Vertex_handle move_if_no_collision(Vertex_handle v, const Point &p,
+                                     VertexRemover &remover,
+                                     VertexInserter &inserter);
+
+  template < class VertexRemover, class VertexInserter >
+  Vertex_handle move(Vertex_handle v, const Point &p,
+                     VertexRemover &remover, VertexInserter &inserter);
+
+  // move and give new cells
+  template < class VertexRemover, class VertexInserter, class OutputItCells  >
+  Vertex_handle move_if_no_collision_and_give_new_cells(
+                                                        Vertex_handle v, const Point &p, VertexRemover &remover,
+                                                        VertexInserter &inserter, OutputItCells fit);
+
+  // This is a function better suited for tds
+  // but because it is not required in the model of tds
+  // at this time, it should be implemented here.
+  void flip_2D(Cell_handle f, int i)
+  {
+    CGAL_triangulation_precondition( dimension()==2);
+    Cell_handle n  = f->neighbor(i);
+    int ni = this->_tds.mirror_index(f,i); //ni = n->index(f);
+
+    int cwi = (i+2)%3;
+    int ccwi = (i+1)%3;
+    int cwni = (ni+2)%3;
+    int ccwni = (ni+1)%3;
+
+    Vertex_handle  v_cw = f->vertex(cwi);
+    Vertex_handle  v_ccw = f->vertex(ccwi);
+
+    // bl == bottom left, tr == top right
+    Cell_handle tr = f->neighbor(ccwi);
+    int tri =  this->_tds.mirror_index(f,ccwi);
+    Cell_handle bl = n->neighbor(ccwni);
+    int bli =  this->_tds.mirror_index(n,ccwni);
+
+    f->set_vertex(cwi, n->vertex(ni));
+    n->set_vertex(cwni, f->vertex(i));
+
+    // update the neighborhood relations
+    this->_tds.set_adjacency(f, i, bl, bli);
+    this->_tds.set_adjacency(f, ccwi, n, ccwni);
+    this->_tds.set_adjacency(n, ni, tr, tri);
+
+    if(v_cw->cell() == f) {
+      v_cw->set_cell(n);
+    }
+
+    if(v_ccw->cell() == n) {
+      v_ccw->set_cell(f);
+    }
+  }
+
+  template < class VertexRemover, class VertexInserter >
+  void restore_edges_after_decrease_dimension(Vertex_handle v,
+                                              VertexRemover &remover, VertexInserter &inserter)
+  {
+
+    Cell_handle fkstart = v->cell();
+    Cell_handle start = fkstart->neighbor(fkstart->index(v));
+
+    std::list<Edge_2D> hole;
+    make_hole_2D(v, hole, remover);
+    fill_hole_2D(hole, remover);
+    // make hole here will work if the link of v is a valid triangulation
+    // the aim here is Delaunay triangulations
+    // to make it more general one could have an internal function here
+    // to remove v without touching its handle
+
+    // This insert must be from Delaunay (or the particular trian.)
+    // not the basic Triangulation_3.
+    // Here we correct the recent triangulation (with decreased dimension) formed
+    // in particular here a 2D (from 3D to 2D displacement)
+    Vertex_handle inserted = inserter.insert(v->point(), start);
+
+    // fixing pointer
+    Cell_handle fc = inserted->cell(), done(fc);
+    std::vector<Cell_handle> faces_pt;
+    faces_pt.reserve(16);
+    do {
+      faces_pt.push_back(fc);
+      fc = fc->neighbor((fc->index(inserted) + 1)%3);
+    } while(fc != done);
+    std::size_t ss = faces_pt.size();
+    for(std::size_t k=0; k<ss; k++)
+    {
+      Cell_handle f = faces_pt[k];
+      int i = f->index(inserted);
+      f->set_vertex(i, v);
+    }
+    v->set_cell(inserted->cell());
+
+    tds().delete_vertex(inserted);
+  }
+
+private:
+  typedef Facet Edge_2D;
+  typedef Triple<Vertex_handle,Vertex_handle,Vertex_handle> Vertex_triple;
+  typedef typename Base::template Vertex_triple_Facet_map_generator<
+    Vertex_triple, Facet>::type Vertex_triple_Facet_map;
+  typedef typename Base::template Vertex_handle_unique_hash_map_generator<
+    Vertex_handle>::type Vertex_handle_unique_hash_map;
+
+  Vertex_triple make_vertex_triple(const Facet& f) const;
+  void make_canonical(Vertex_triple& t) const;
+
+  template < class VertexRemover >
+  VertexRemover& make_hole_2D(Vertex_handle v, std::list<Edge_2D> & hole,
+      VertexRemover &remover);
+  template < class VertexRemover >
+  VertexRemover& make_hole_2D(Vertex_handle v, std::list<Edge_2D> & hole,
+                              VertexRemover &remover,
+                              std::set<Cell_handle> &cells_set);
+
+  template < class VertexRemover >
+  void fill_hole_2D(std::list<Edge_2D> & hole, VertexRemover &remover);
+
+  void make_hole_3D( Vertex_handle v, Vertex_triple_Facet_map& outer_map,
+      std::vector<Cell_handle> & hole);
+  // When the incident cells are already known
+  void make_hole_3D(
+    Vertex_handle v,
+    const std::vector<Cell_handle> & incident_cells,
+          Vertex_triple_Facet_map& outer_map);
+
+  template < class VertexRemover >
+  VertexRemover& remove_dim_down(Vertex_handle v, VertexRemover &remover);
+  template < class VertexRemover >
+  VertexRemover& remove_1D(Vertex_handle v, VertexRemover &remover);
+  template < class VertexRemover >
+  VertexRemover& remove_2D(Vertex_handle v, VertexRemover &remover);
+  template < class VertexRemover >
+  VertexRemover& remove_3D(Vertex_handle v, VertexRemover &remover);
+  // Version of remove_3D if the incident cells and the adjacent vertices
+  // are already known
+  template < class VertexRemover >
+  VertexRemover& remove_3D(Vertex_handle v, VertexRemover &remover,
+                           const std::vector<Cell_handle> &inc_cells,
+                           std::vector<Vertex_handle> &adj_vertices);
+
+  template < class VertexRemover, class OutputItCells  >
+  VertexRemover& remove_dim_down(Vertex_handle v, VertexRemover &remover,
+                                 OutputItCells fit);
+
+  template < class VertexRemover, class OutputItCells  >
+  VertexRemover& remove_1D(Vertex_handle v, VertexRemover &remover,
+                           OutputItCells fit);
+
+  template < class VertexRemover, class OutputItCells  >
+  VertexRemover& remove_2D(Vertex_handle v, VertexRemover &remover,
+                           OutputItCells fit);
+
+  template < class VertexRemover, class OutputItCells  >
+  VertexRemover& remove_3D(Vertex_handle v, VertexRemover &remover,
+                           OutputItCells fit);
+
+  template < class VertexRemover, class OutputItCells  >
+  void fill_hole_2D(std::list<Edge_2D> & hole, VertexRemover &remover,
+                    OutputItCells fit);
+
+  // They access "Self", so need to be friend.
+  friend class Conflict_tester_outside_convex_hull_3;
+  friend class Conflict_tester_outside_convex_hull_2;
+  friend class Infinite_tester;
+  friend class Finite_vertices_iterator;
+  friend class Finite_cells_iterator;
+
+  // remove cluster
+  template < class InputIterator >
+  void _mark_vertices_to_remove(InputIterator first, InputIterator beyond,
+    std::map<Vertex_handle, REMOVE_VERTEX_STATE> &vstates) const
+  {
+    while (first != beyond) vstates[*first++] = TO_REMOVE;
+  }
+
+  bool _test_dim_down_cluster(
+                              std::map<Vertex_handle, REMOVE_VERTEX_STATE> &vstates) const
+  // tests whether removing the cluster of vertices
+  // marked as "to remove", decreases the dimension of the triangulation
+  {
+    CGAL_triangulation_precondition( dimension() == 3 );
+    int k=0;
+    Vertex_handle v[4];
+    for (Finite_vertices_iterator fit = finite_vertices_begin();
+         fit != finite_vertices_end(); ++fit ) {
+      if(vstates[fit] == TO_REMOVE) continue;
+      v[k++] = fit;
+      if(k == 4)
+      {
+        if (!coplanar(v[0]->point(), v[1]->point(),
+                      v[2]->point(), v[3]->point())) return false;
+        k--;
+      }
+    }
+    return k < 4;
+  }
+
+  template < class InputIterator, class VertexRemover >
+  bool
+  _remove_cluster_3D(InputIterator first, InputIterator beyond, VertexRemover &remover,
+                     std::map<Vertex_handle, REMOVE_VERTEX_STATE> &vstates);
+
+  void _make_big_hole_3D(Vertex_handle v,
+                         std::map<Vertex_triple,Facet>& outer_map,
+                         std::vector<Cell_handle> & hole,
+                         std::vector<Vertex_handle> & vertices,
+                         std::map<Vertex_handle, REMOVE_VERTEX_STATE> &vstates);
+
+public:
+
+  //TRAVERSING : ITERATORS AND CIRCULATORS
+  Finite_cells_iterator finite_cells_begin() const
+  {
+      if ( dimension() < 3 )
+          return finite_cells_end();
+      return CGAL::filter_iterator(cells_end(), Infinite_tester(this),
+                                   cells_begin());
+  }
+  Finite_cells_iterator finite_cells_end() const
+  {
+      return CGAL::filter_iterator(cells_end(), Infinite_tester(this));
+  }
+
+  Cell_iterator cells_begin() const
+  {
+      return _tds.cells_begin();
+  }
+  Cell_iterator cells_end() const
+  {
+      return _tds.cells_end();
+  }
+
+  All_cells_iterator all_cells_begin() const
+  {
+      return _tds.cells_begin();
+  }
+  All_cells_iterator all_cells_end() const
+  {
+      return _tds.cells_end();
+  }
+
+  Finite_vertices_iterator finite_vertices_begin() const
+  {
+      if ( number_of_vertices() <= 0 )
+          return finite_vertices_end();
+      return CGAL::filter_iterator(vertices_end(), Infinite_tester(this),
+                                   vertices_begin());
+  }
+  Finite_vertices_iterator finite_vertices_end() const
+  {
+      return CGAL::filter_iterator(vertices_end(), Infinite_tester(this));
+  }
+
+  Vertex_iterator vertices_begin() const
+  {
+      return _tds.vertices_begin();
+  }
+  Vertex_iterator vertices_end() const
+  {
+      return _tds.vertices_end();
+  }
+
+  All_vertices_iterator all_vertices_begin() const
+  {
+      return _tds.vertices_begin();
+  }
+  All_vertices_iterator all_vertices_end() const
+  {
+      return _tds.vertices_end();
+  }
+
+  Finite_edges_iterator finite_edges_begin() const
+  {
+      if ( dimension() < 1 )
+          return finite_edges_end();
+      return CGAL::filter_iterator(edges_end(), Infinite_tester(this),
+                                   edges_begin());
+  }
+  Finite_edges_iterator finite_edges_end() const
+  {
+      return CGAL::filter_iterator(edges_end(), Infinite_tester(this));
+  }
+
+  Edge_iterator edges_begin() const
+  {
+      return _tds.edges_begin();
+  }
+  Edge_iterator edges_end() const
+  {
+      return _tds.edges_end();
+  }
+
+  All_edges_iterator all_edges_begin() const
+  {
+      return _tds.edges_begin();
+  }
+  All_edges_iterator all_edges_end() const
+  {
+      return _tds.edges_end();
+  }
+
+  Finite_facets_iterator finite_facets_begin() const
+  {
+      if ( dimension() < 2 )
+          return finite_facets_end();
+      return CGAL::filter_iterator(facets_end(), Infinite_tester(this),
+                                   facets_begin());
+  }
+  Finite_facets_iterator finite_facets_end() const
+  {
+      return CGAL::filter_iterator(facets_end(), Infinite_tester(this));
+  }
+
+  Facet_iterator facets_begin() const
+  {
+      return _tds.facets_begin();
+  }
+  Facet_iterator facets_end() const
+  {
+      return _tds.facets_end();
+  }
+
+  All_facets_iterator all_facets_begin() const
+  {
+      return _tds.facets_begin();
+  }
+  All_facets_iterator all_facets_end() const
+  {
+      return _tds.facets_end();
+  }
+
+  Point_iterator points_begin() const
+  {
+      return Point_iterator(finite_vertices_begin());
+  }
+  Point_iterator points_end() const
+  {
+      return Point_iterator(finite_vertices_end());
+  }
+
+  // cells around an edge
+  Cell_circulator incident_cells(const Edge & e) const
+  {
+    return _tds.incident_cells(e);
+  }
+  Cell_circulator incident_cells(Cell_handle c, int i, int j) const
+  {
+    return _tds.incident_cells(c, i, j);
+  }
+  Cell_circulator incident_cells(const Edge & e, Cell_handle start) const
+  {
+    return _tds.incident_cells(e, start);
+  }
+  Cell_circulator incident_cells(Cell_handle c, int i, int j,
+                                 Cell_handle start) const
+  {
+    return _tds.incident_cells(c, i, j, start);
+  }
+
+  // facets around an edge
+  Facet_circulator incident_facets(const Edge & e) const
+  {
+    return _tds.incident_facets(e);
+  }
+  Facet_circulator incident_facets(Cell_handle c, int i, int j) const
+  {
+    return _tds.incident_facets(c, i, j);
+  }
+  Facet_circulator incident_facets(const Edge & e, const Facet & start) const
+  {
+    return _tds.incident_facets(e, start);
+  }
+  Facet_circulator incident_facets(Cell_handle c, int i, int j,
+                                   const Facet & start) const
+  {
+    return _tds.incident_facets(c, i, j, start);
+  }
+  Facet_circulator incident_facets(const Edge & e,
+                                   Cell_handle start, int f) const
+  {
+    return _tds.incident_facets(e, start, f);
+  }
+  Facet_circulator incident_facets(Cell_handle c, int i, int j,
+                                   Cell_handle start, int f) const
+  {
+    return _tds.incident_facets(c, i, j, start, f);
+  }
+
+  // around a vertex
+  class Finite_filter {
+    const Self* t;
+    public:
+    Finite_filter(const Self* _t): t(_t) {}
+    template<class T>
+    bool operator() (const T& e) const {
+      return t->is_infinite(e);
+    }
+  };
+
+  class Finite_filter_2D {
+    const Self* t;
+    public:
+    Finite_filter_2D(const Self* _t): t(_t) {}
+
+    template<class T>
+    bool operator() (const T& e) const {
+      return t->is_infinite(e);
+    }
+
+    bool operator() (const Cell_handle c) {
+      return t->is_infinite(c, 3);
+    }
+  };
+
+  template <typename OutputIterator>
+  OutputIterator
+  incident_cells(Vertex_handle v, OutputIterator cells) const
+  {
+    return _tds.incident_cells(v, cells);
+  }
+  
+  template <typename OutputIterator>
+  void incident_cells_threadsafe(Vertex_handle v,
+                                 OutputIterator cells) const
+  {
+    _tds.incident_cells_threadsafe(v, cells);
+  }
+  
+  template <typename Filter, typename OutputIterator>
+  void incident_cells_threadsafe(Vertex_handle v,
+                                 OutputIterator cells,
+                                 const Filter &filter) const
+  {
+    _tds.incident_cells_threadsafe(v, cells, filter);
+  }
+
+  bool
+  try_lock_and_get_incident_cells(Vertex_handle v,
+                                  std::vector<Cell_handle>& cells) const
+  {
+    // We need to lock v individually first, to be sure v->cell() is valid
+    if (!this->try_lock_vertex(v))
+      return false;
+
+    Cell_handle d = v->cell();
+    if (!this->try_lock_cell(d)) // LOCK
+    {
+      return false;
+    }
+    cells.push_back(d);
+    d->tds_data().mark_in_conflict();
+    int head=0;
+    int tail=1;
+    do {
+      Cell_handle c = cells[head];
+
+      for (int i=0; i<4; ++i) {
+        if (c->vertex(i) == v)
+          continue;
+        Cell_handle next = c->neighbor(i);
+
+        if (!this->try_lock_cell(next)) // LOCK
+        {
+          BOOST_FOREACH(Cell_handle& ch,
+            std::make_pair(cells.begin(), cells.end()))
+          {
+            ch->tds_data().clear();
+          }
+          cells.clear();
+          return false;
+        }
+        if (! next->tds_data().is_clear())
+          continue;
+        cells.push_back(next);
+        ++tail;
+        next->tds_data().mark_in_conflict();
+      }
+      ++head;
+    } while(head != tail);
+    BOOST_FOREACH(Cell_handle& ch, std::make_pair(cells.begin(), cells.end()))
+    {
+      ch->tds_data().clear();
+    }
+    return true;
+  }
+
+  template <class OutputIterator>
+  bool
+  try_lock_and_get_adjacent_vertices_and_cells_3(
+    Vertex_handle v, OutputIterator vertices,
+    std::vector<Cell_handle> &cells) const
+  {
+
+    // We need to lock v individually first, to be sure v->cell() is valid
+    if (!this->try_lock_vertex(v))
+      return false;
+
+    Cell_handle d = v->cell();
+    if (!this->try_lock_cell(d)) // LOCK
+    {
+      return false;
+    }
+    cells.push_back(d);
+    d->tds_data().mark_in_conflict();
+    int head=0;
+    int tail=1;
+    do {
+      Cell_handle c = cells[head];
+
+      for (int i=0; i<4; ++i) {
+        if (c->vertex(i) == v)
+          continue;
+        Cell_handle next = c->neighbor(i);
+
+        if (!this->try_lock_cell(next)) // LOCK
+        {
+          BOOST_FOREACH(Cell_handle& ch,
+            std::make_pair(cells.begin(), cells.end()))
+          {
+            ch->tds_data().clear();
+          }
+          cells.clear();
+          return false;
+        }
+        if (! next->tds_data().is_clear())
+          continue;
+        cells.push_back(next);
+        ++tail;
+        next->tds_data().mark_in_conflict();
+      }
+      ++head;
+    } while(head != tail);
+
+    std::set<Vertex_handle> tmp_vertices;
+    BOOST_FOREACH(Cell_handle& ch, std::make_pair(cells.begin(), cells.end()))
+    {
+      ch->tds_data().clear();
+      for (int i = 0;  i < 4; ++i)
+      {
+              Vertex_handle w = ch->vertex(i);
+              if (w != v && tmp_vertices.insert(w).second)
+        {
+                *vertices = w;
+
+        }
+      }
+    }
+    return true;
+  }
+
+  template <class OutputIterator>
+  OutputIterator
+  finite_incident_cells(Vertex_handle v, OutputIterator cells) const
+  {
+        if(dimension() == 2)
+          return _tds.incident_cells(v, cells, Finite_filter_2D(this));
+    return _tds.incident_cells(v, cells, Finite_filter(this));
+  }
+
+  template <class OutputIterator>
+  OutputIterator
+  incident_facets(Vertex_handle v, OutputIterator facets) const
+  {
+    return _tds.incident_facets(v, facets);
+  }
+
+  template <class OutputIterator>
+  OutputIterator
+  finite_incident_facets(Vertex_handle v, OutputIterator facets) const
+  {
+    return _tds.incident_facets(v, facets, Finite_filter(this));
+  }
+
+  template <class OutputIterator>
+  OutputIterator
+  incident_facets_threadsafe(Vertex_handle v, OutputIterator facets) const
+  {
+    return _tds.incident_facets_threadsafe(v, facets);
+  }
+
+  template <class OutputIterator>
+  OutputIterator
+  finite_incident_facets_threadsafe(Vertex_handle v, OutputIterator facets) const
+  {
+    return _tds.incident_facets_threadsafe(v, facets, Finite_filter(this));
+  }
+
+  // old name (up to CGAL 3.4)
+  // kept for backwards compatibility but not documented
+  template <class OutputIterator>
+  OutputIterator
+  incident_vertices(Vertex_handle v, OutputIterator vertices) const
+  {
+    return _tds.adjacent_vertices(v, vertices);
+  }
+
+  // correct name
+  template <class OutputIterator>
+  OutputIterator
+  adjacent_vertices(Vertex_handle v, OutputIterator vertices) const
+  {
+    return _tds.adjacent_vertices(v, vertices);
+  }
+
+  template <class OutputIterator>
+  OutputIterator
+  adjacent_vertices_and_cells_3(Vertex_handle v, OutputIterator vertices,
+                                std::vector<Cell_handle> &cells) const
+  {
+    return _tds.adjacent_vertices_and_cells_3(v, vertices, cells);
+  }
+
+  // old name (up to CGAL 3.4)
+  // kept for backwards compatibility but not documented
+  template <class OutputIterator>
+  OutputIterator
+  finite_incident_vertices(Vertex_handle v, OutputIterator vertices) const
+  {
+    return _tds.adjacent_vertices(v, vertices, Finite_filter(this));
+  }
+
+  // correct name
+  template <class OutputIterator>
+  OutputIterator
+  finite_adjacent_vertices(Vertex_handle v, OutputIterator vertices) const
+  {
+    return _tds.adjacent_vertices(v, vertices, Finite_filter(this));
+  }
+
+  template <class OutputIterator>
+  OutputIterator
+  incident_edges(Vertex_handle v, OutputIterator edges) const
+  {
+      return _tds.incident_edges(v, edges);
+  }
+
+  template <class OutputIterator>
+  OutputIterator
+  finite_incident_edges(Vertex_handle v, OutputIterator edges) const
+  {
+    return _tds.incident_edges(v, edges, Finite_filter(this));
+  }
+
+  size_type degree(Vertex_handle v) const
+  {
+      return _tds.degree(v);
+  }
+
+
+
+  // CHECKING
+  bool is_valid(bool verbose = false, int level = 0) const;
+
+  bool is_valid(Cell_handle c, bool verbose = false, int level = 0) const;
+
+  bool is_valid_finite(Cell_handle c, bool verbose = false, int level=0) const;
+};
+
+template < class GT, class Tds, class Lds >
+std::istream &
+operator>> (std::istream& is, Triangulation_3<GT, Tds, Lds> &tr)
+  // reads
+  // the dimension
+  // the number of finite vertices
+  // the non combinatorial information on vertices (point, etc)
+  // the number of cells
+  // the cells by the indices of their vertices in the preceding list
+  // of vertices, plus the non combinatorial information on each cell
+  // the neighbors of each cell by their index in the preceding list of cells
+  // when dimension < 3 : the same with faces of maximal dimension
+{
+  typedef Triangulation_3<GT, Tds>               Triangulation;
+  typedef typename Triangulation::Vertex_handle  Vertex_handle;
+  typedef typename Triangulation::Cell_handle    Cell_handle;
+
+  tr._tds.clear(); // infinite vertex deleted
+  tr.infinite = tr._tds.create_vertex();
+
+  std::size_t n;
+  int d;
+  if(is_ascii(is))
+     is >> d >> n;
+  else {
+    read(is, d);
+    read(is, n);
+  }
+  if(!is) return is;
+  tr._tds.set_dimension(d);
+
+  std::vector< Vertex_handle > V(n+1);
+  V[0] = tr.infinite_vertex();
+  // the infinite vertex is numbered 0
+
+  for (std::size_t i=1; i <= n; i++) {
+    V[i] = tr._tds.create_vertex();
+    if(!(is >> *V[i])) return is;
+  }
+
+  std::vector< Cell_handle > C;
+
+  std::size_t m;
+  tr._tds.read_cells(is, V, m, C);
+
+  for (std::size_t j=0 ; j < m; j++)
+    if(!(is >> *(C[j]))) return is;
+
+  CGAL_triangulation_assertion( tr.is_valid(false) );
+  return is;
+}
+
+template < class GT, class Tds, class Lds >
+std::ostream &
+operator<< (std::ostream& os, const Triangulation_3<GT, Tds, Lds> &tr)
+  // writes :
+  // the dimension
+  // the number of finite vertices
+  // the non combinatorial information on vertices (point, etc)
+  // the number of cells
+  // the cells by the indices of their vertices in the preceding list
+  // of vertices, plus the non combinatorial information on each cell
+  // the neighbors of each cell by their index in the preceding list of cells
+  // when dimension < 3 : the same with faces of maximal dimension
+{
+  typedef Triangulation_3<GT, Tds>                 Triangulation;
+  typedef typename Triangulation::size_type        size_type;
+  typedef typename Triangulation::Vertex_handle    Vertex_handle;
+  typedef typename Triangulation::Vertex_iterator  Vertex_iterator;
+  typedef typename Triangulation::Cell_iterator    Cell_iterator;
+  typedef typename Triangulation::Edge_iterator    Edge_iterator;
+  typedef typename Triangulation::Facet_iterator   Facet_iterator;
+
+  // outputs dimension and number of vertices
+  size_type n = tr.number_of_vertices();
+  if (is_ascii(os))
+    os << tr.dimension() << std::endl << n << std::endl;
+  else
+  {
+    write(os, tr.dimension());
+    write(os, n);
+  }
+
+  if (n == 0)
+    return os;
+
+  std::vector<Vertex_handle> TV(n+1);
+  size_type i = 0;
+
+  // write the vertices
+
+  for (Vertex_iterator it = tr.vertices_begin(), end = tr.vertices_end();
+         it != end; ++it)
+    TV[i++] = it;
+
+  CGAL_triangulation_assertion( i == n+1 );
+  CGAL_triangulation_assertion( tr.is_infinite(TV[0]) );
+
+  Unique_hash_map<Vertex_handle, std::size_t > V;
+
+  V[tr.infinite_vertex()] = 0;
+  for (i=1; i <= n; i++) {
+    os << *TV[i];
+    V[TV[i]] = i;
+    if (is_ascii(os))
+        os << std::endl;
+  }
+
+    // asks the tds for the combinatorial information
+  tr.tds().print_cells(os, V);
+
+
+  // write the non combinatorial information on the cells
+  // using the << operator of Cell
+  // works because the iterator of the tds traverses the cells in the
+  // same order as the iterator of the triangulation
+  switch ( tr.dimension() ) {
+  case 3:
+    {
+      for(Cell_iterator it = tr.cells_begin(), end = tr.cells_end(); it != end; ++it) {
+        os << *it; // other information
+        if(is_ascii(os))
+          os << std::endl;
+      }
+      break;
+    }
+  case 2:
+    {
+      for(Facet_iterator it = tr.facets_begin(), end = tr.facets_end(); it != end; ++it) {
+        os << *((*it).first); // other information
+        if(is_ascii(os))
+          os << std::endl;
+      }
+      break;
+    }
+  case 1:
+    {
+      for(Edge_iterator it = tr.edges_begin(), end = tr.edges_end(); it != end; ++it) {
+        os << *((*it).first); // other information
+        if(is_ascii(os))
+          os << std::endl;
+      }
+      break;
+    }
+  }
+
+
+  return os ;
+}
+
+template < class GT, class Tds, class Lds >
+typename Triangulation_3<GT,Tds,Lds>::size_type
+Triangulation_3<GT,Tds,Lds>::
+number_of_finite_cells() const
+{
+  if ( dimension() < 3 ) return 0;
+  return std::distance(finite_cells_begin(), finite_cells_end());
+}
+
+template < class GT, class Tds, class Lds >
+typename Triangulation_3<GT,Tds,Lds>::size_type
+Triangulation_3<GT,Tds,Lds>::
+number_of_cells() const
+{
+  return _tds.number_of_cells();
+}
+
+template < class GT, class Tds, class Lds >
+typename Triangulation_3<GT,Tds,Lds>::size_type
+Triangulation_3<GT,Tds,Lds>::
+number_of_finite_facets() const
+{
+  if ( dimension() < 2 ) return 0;
+  return std::distance(finite_facets_begin(), finite_facets_end());
+}
+
+template < class GT, class Tds, class Lds >
+typename Triangulation_3<GT,Tds,Lds>::size_type
+Triangulation_3<GT,Tds,Lds>::
+number_of_facets() const
+{
+  return _tds.number_of_facets();
+}
+
+template < class GT, class Tds, class Lds >
+typename Triangulation_3<GT,Tds,Lds>::size_type
+Triangulation_3<GT,Tds,Lds>::
+number_of_finite_edges() const
+{
+  if ( dimension() < 1 ) return 0;
+  return std::distance(finite_edges_begin(), finite_edges_end());
+}
+
+template < class GT, class Tds, class Lds >
+typename Triangulation_3<GT,Tds,Lds>::size_type
+Triangulation_3<GT,Tds,Lds>::
+number_of_edges() const
+{
+  return _tds.number_of_edges();
+}
+
+template < class GT, class Tds, class Lds >
+typename Triangulation_3<GT,Tds,Lds>::Triangle
+Triangulation_3<GT,Tds,Lds>::
+triangle(const Cell_handle c, int i) const
+{
+  CGAL_triangulation_precondition( dimension() == 2 || dimension() == 3 );
+  CGAL_triangulation_precondition( (dimension() == 2 && i == 3)
+                                || (dimension() == 3 && i >= 0 && i <= 3) );
+  CGAL_triangulation_precondition( ! is_infinite(Facet(c, i)) );
+  if ( (i&1)==0 )
+    return construct_triangle(c->vertex( (i+2)&3 )->point(),
+                              c->vertex( (i+1)&3 )->point(),
+                              c->vertex( (i+3)&3 )->point());
+  return construct_triangle(c->vertex( (i+1)&3 )->point(),
+                            c->vertex( (i+2)&3 )->point(),
+                            c->vertex( (i+3)&3 )->point());
+}
+
+template < class GT, class Tds, class Lds >
+typename Triangulation_3<GT,Tds,Lds>::Segment
+Triangulation_3<GT,Tds,Lds>::
+segment(const Cell_handle c, int i, int j) const
+{
+  CGAL_triangulation_precondition( i != j );
+  CGAL_triangulation_precondition( dimension() >= 1 && dimension() <= 3 );
+  CGAL_triangulation_precondition( i >= 0 && i <= dimension()
+                                   && j >= 0 && j <= dimension() );
+  CGAL_triangulation_precondition( ! is_infinite(Edge(c, i, j)) );
+  return construct_segment( c->vertex(i)->point(), c->vertex(j)->point() );
+}
+
+template < class GT, class Tds, class Lds >
+inline
+bool
+Triangulation_3<GT,Tds,Lds>::
+is_infinite(const Cell_handle c, int i) const
+{
+  CGAL_triangulation_precondition( dimension() == 2 || dimension() == 3 );
+  CGAL_triangulation_precondition( (dimension() == 2 && i == 3)
+                                   || (dimension() == 3 && i >= 0 && i <= 3) );
+  return is_infinite(c->vertex(i<=0 ? 1 : 0)) ||
+         is_infinite(c->vertex(i<=1 ? 2 : 1)) ||
+         is_infinite(c->vertex(i<=2 ? 3 : 2));
+}
+
+template < class GT, class Tds, class Lds >
+inline
+bool
+Triangulation_3<GT,Tds,Lds>::
+is_infinite(const Cell_handle c, int i, int j) const
+{
+  CGAL_triangulation_precondition( i != j );
+  CGAL_triangulation_precondition( dimension() >= 1 && dimension() <= 3 );
+  CGAL_triangulation_precondition(
+          i >= 0 && i <= dimension() && j >= 0 && j <= dimension() );
+  return is_infinite( c->vertex(i) ) || is_infinite( c->vertex(j) );
+}
+
+template < class GT, class Tds, class Lds >
+bool
+Triangulation_3<GT,Tds,Lds>::
+is_vertex(const Point & p, Vertex_handle & v) const
+{
+  Locate_type lt;
+  int li, lj;
+  Cell_handle c = locate( p, lt, li, lj );
+  if ( lt != VERTEX )
+    return false;
+  v = c->vertex(li);
+  return true;
+}
+
+template < class GT, class Tds, class Lds >
+inline
+bool
+Triangulation_3<GT,Tds,Lds>::
+is_vertex(Vertex_handle v) const
+{
+  return _tds.is_vertex(v);
+}
+
+template < class GT, class Tds, class Lds >
+bool
+Triangulation_3<GT,Tds,Lds>::
+is_edge(Vertex_handle u, Vertex_handle v,
+        Cell_handle & c, int & i, int & j) const
+{
+  return _tds.is_edge(u, v, c, i, j);
+}
+
+template < class GT, class Tds, class Lds >
+bool
+Triangulation_3<GT,Tds,Lds>::
+is_facet(Vertex_handle u, Vertex_handle v, Vertex_handle w,
+         Cell_handle & c, int & i, int & j, int & k) const
+{
+  return _tds.is_facet(u, v, w, c, i, j, k);
+}
+
+template < class GT, class Tds, class Lds >
+inline
+bool
+Triangulation_3<GT,Tds,Lds>::
+is_cell(Cell_handle c) const
+{
+  return _tds.is_cell(c);
+}
+
+template < class GT, class Tds, class Lds >
+bool
+Triangulation_3<GT,Tds,Lds>::
+is_cell(Vertex_handle u, Vertex_handle v,
+        Vertex_handle w, Vertex_handle t,
+        Cell_handle & c, int & i, int & j, int & k, int & l) const
+{
+  return _tds.is_cell(u, v, w, t, c, i, j, k, l);
+}
+
+template < class GT, class Tds, class Lds >
+bool
+Triangulation_3<GT,Tds,Lds>::
+is_cell(Vertex_handle u, Vertex_handle v,
+        Vertex_handle w, Vertex_handle t,
+        Cell_handle & c) const
+{
+  int i,j,k,l;
+  return _tds.is_cell(u, v, w, t, c, i, j, k, l);
+}
+
+template < class GT, class Tds, class Lds >
+inline
+bool
+Triangulation_3<GT,Tds,Lds>::
+has_vertex(const Facet & f, Vertex_handle v, int & j) const
+{
+  return _tds.has_vertex(f.first, f.second, v, j);
+}
+
+template < class GT, class Tds, class Lds >
+inline
+bool
+Triangulation_3<GT,Tds,Lds>::
+has_vertex(Cell_handle c, int i, Vertex_handle v, int & j) const
+{
+  return _tds.has_vertex(c, i, v, j);
+}
+
+template < class GT, class Tds, class Lds >
+inline
+bool
+Triangulation_3<GT,Tds,Lds>::
+has_vertex(const Facet & f, Vertex_handle v) const
+{
+  return _tds.has_vertex(f.first, f.second, v);
+}
+
+template < class GT, class Tds, class Lds >
+inline
+bool
+Triangulation_3<GT,Tds,Lds>::
+has_vertex(Cell_handle c, int i, Vertex_handle v) const
+{
+  return _tds.has_vertex(c, i, v);
+}
+
+template < class GT, class Tds, class Lds >
+inline
+bool
+Triangulation_3<GT,Tds,Lds>::
+are_equal(Cell_handle c, int i, Cell_handle n, int j) const
+{
+  return _tds.are_equal(c, i, n, j);
+}
+
+template < class GT, class Tds, class Lds >
+inline
+bool
+Triangulation_3<GT,Tds,Lds>::
+are_equal(const Facet & f, const Facet & g) const
+{
+  return _tds.are_equal(f.first, f.second, g.first, g.second);
+}
+
+template < class GT, class Tds, class Lds >
+inline
+bool
+Triangulation_3<GT,Tds,Lds>::
+are_equal(const Facet & f, Cell_handle n, int j) const
+{
+  return _tds.are_equal(f.first, f.second, n, j);
+}
+
+template < class GT, class Tds, class Lds >
+typename Triangulation_3<GT,Tds,Lds>::Cell_handle
+Triangulation_3<GT,Tds,Lds>::
+#ifdef CGAL_NO_STRUCTURAL_FILTERING
+locate(const Point & p, Locate_type & lt, int & li, int & lj,
+       Cell_handle start, bool *could_lock_zone) const
+#else
+exact_locate(const Point & p, Locate_type & lt, int & li, int & lj,
+             Cell_handle start, bool *could_lock_zone) const
+#endif
+  // returns the (finite or infinite) cell p lies in
+  // starts at cell "start"
+  // if lt == OUTSIDE_CONVEX_HULL, li is the
+  // index of a facet separating p from the rest of the triangulation
+  // in dimension 2 :
+  // returns a facet (Cell_handle,li) if lt == FACET
+  // returns an edge (Cell_handle,li,lj) if lt == EDGE
+  // returns a vertex (Cell_handle,li) if lt == VERTEX
+  // if lt == OUTSIDE_CONVEX_HULL, li, lj give the edge of c
+  // separating p from the rest of the triangulation
+  // lt = OUTSIDE_AFFINE_HULL if p is not coplanar with the triangulation
+{
+  CGAL_triangulation_expensive_assertion(start == Cell_handle() || tds().is_simplex(start) );
+
+  if (could_lock_zone)
+    *could_lock_zone = true;
+
+  if ( dimension() >= 1 ) {
+      // Make sure we continue from here with a finite cell.
+      if ( start == Cell_handle() )
+          start = infinite_cell();
+
+      int ind_inf;
+      if ( start->has_vertex(infinite, ind_inf) )
+          start = start->neighbor(ind_inf);
+  }
+
+  boost::rand48 rng;
+
+  switch (dimension()) {
+  case 3:
+  {
+    CGAL_triangulation_precondition( start != Cell_handle() );
+    CGAL_triangulation_precondition( ! start->has_vertex(infinite) );
+
+    // We implement the remembering visibility/stochastic walk.
+
+    // Remembers the previous cell to avoid useless orientation tests.
+    Cell_handle previous = Cell_handle();
+    Cell_handle c = start;
+
+    if (could_lock_zone)
+    {
+      if (!this->try_lock_cell(c))
+      {
+        *could_lock_zone = false;
+        return Cell_handle();
+      }
+    }
+
+    // Stores the results of the 4 orientation tests.  It will be used
+    // at the end to decide if p lies on a face/edge/vertex/interior.
+    Orientation o[4];
+
+    boost::uniform_smallint<> four(0, 3);
+    boost::variate_generator<boost::rand48&, boost::uniform_smallint<> > die4(rng, four);
+
+    // Now treat the cell c.
+    bool try_next_cell = true;
+    while(try_next_cell)
+    {
+      try_next_cell = false;
+      // We know that the 4 vertices of c are positively oriented.
+      // So, in order to test if p is seen outside from one of c's facets,
+      // we just replace the corresponding point by p in the orientation
+      // test.  We do this using the array below.
+      const Point* pts[4] = { &(c->vertex(0)->point()),
+                              &(c->vertex(1)->point()),
+                              &(c->vertex(2)->point()),
+                              &(c->vertex(3)->point()) };
+
+      // For the remembering stochastic walk,
+      // we need to start trying with a random index :
+      int i = die4();
+      // For the remembering visibility walk (Delaunay and Regular only), we don't :
+      // int i = 0;
+
+      // for each vertex
+      for (int j=0; !try_next_cell && j != 4; ++j, i = (i+1)&3)
+      {
+              Cell_handle next = c->neighbor(i);
+
+              if (previous == next)
+        {
+                o[i] = POSITIVE;
+        }
+        else
+        {
+          // We temporarily put p at i's place in pts.
+          const Point* backup = pts[i];
+          pts[i] = &p;
+                o[i] = orientation(*pts[0], *pts[1], *pts[2], *pts[3]);
+                if ( o[i] != NEGATIVE )
+          {
+            pts[i] = backup;
+          }
+          else
+          {
+                  if ( next->has_vertex(infinite, li) )
+            {
+                    // We are outside the convex hull.
+                    lt = OUTSIDE_CONVEX_HULL;
+                    return next;
+                  }
+                  previous = c;
+                  c = next;
+            if (could_lock_zone)
+            {
+              //previous->unlock(); // DON'T do that, "c" may be in
+                                    // the same locking cell as "previous"
+              if (!this->try_lock_cell(c))
+              {
+                *could_lock_zone = false;
+                return Cell_handle();
+              }
+            }
+            try_next_cell = true;
+          }
+        }
+      } // next vertex
+    } // next cell
+
+          // now p is in c or on its boundary
+          int sum = ( o[0] == COPLANAR )
+                  + ( o[1] == COPLANAR )
+                  + ( o[2] == COPLANAR )
+                  + ( o[3] == COPLANAR );
+          switch (sum) {
+          case 0:
+            {
+              lt = CELL;
+              break;
+            }
+          case 1:
+            {
+              lt = FACET;
+              li = ( o[0] == COPLANAR ) ? 0 :
+                   ( o[1] == COPLANAR ) ? 1 :
+                   ( o[2] == COPLANAR ) ? 2 : 3;
+              break;
+            }
+          case 2:
+            {
+              lt = EDGE;
+              li = ( o[0] != COPLANAR ) ? 0 :
+                   ( o[1] != COPLANAR ) ? 1 : 2;
+              lj = ( o[li+1] != COPLANAR ) ? li+1 :
+                   ( o[li+2] != COPLANAR ) ? li+2 : li+3;
+              CGAL_triangulation_assertion(collinear( p,
+                                                      c->vertex( li )->point(),
+                                                      c->vertex( lj )->point()));
+              break;
+            }
+          case 3:
+            {
+              lt = VERTEX;
+              li = ( o[0] != COPLANAR ) ? 0 :
+                   ( o[1] != COPLANAR ) ? 1 :
+                   ( o[2] != COPLANAR ) ? 2 : 3;
+              break;
+            }
+          }
+          return c;
+  }
+
+  case 2:
+    {
+      CGAL_triangulation_precondition( start != Cell_handle() );
+      CGAL_triangulation_precondition( ! start->has_vertex(infinite) );
+      Cell_handle c = start;
+
+      boost::uniform_smallint<> three(0, 2);
+      boost::variate_generator<boost::rand48&, boost::uniform_smallint<> > die3(rng, three);
+
+      //first tests whether p is coplanar with the current triangulation
+      if ( orientation( c->vertex(0)->point(),
+                        c->vertex(1)->point(),
+                        c->vertex(2)->point(),
+                        p ) != DEGENERATE ) {
+        lt = OUTSIDE_AFFINE_HULL;
+        li = 3; // only one facet in dimension 2
+        return c;
+      }
+      // if p is coplanar, location in the triangulation
+      // only the facet numbered 3 exists in each cell
+      while (1) {
+        int inf;
+        if ( c->has_vertex(infinite,inf) ) {
+          // c must contain p in its interior
+          lt = OUTSIDE_CONVEX_HULL;
+          li = cw(inf);
+          lj = ccw(inf);
+          return c;
+        }
+
+        // else c is finite
+        // we test its edges in a random order until we find a
+        // neighbor to go further
+        int i = die3();
+        const Point & p0 = c->vertex( i )->point();
+        const Point & p1 = c->vertex( ccw(i) )->point();
+        const Point & p2 = c->vertex( cw(i) )->point();
+        Orientation o[3];
+        CGAL_triangulation_assertion(coplanar_orientation(p0,p1,p2)==POSITIVE);
+        o[0] = coplanar_orientation(p0,p1,p);
+        if ( o[0] == NEGATIVE ) {
+          c = c->neighbor( cw(i) );
+          continue;
+        }
+        o[1] = coplanar_orientation(p1,p2,p);
+        if ( o[1] == NEGATIVE ) {
+          c = c->neighbor( i );
+          continue;
+        }
+        o[2] = coplanar_orientation(p2,p0,p);
+        if ( o[2] == NEGATIVE ) {
+          c = c->neighbor( ccw(i) );
+          continue;
+        }
+
+        // now p is in c or on its boundary
+        int sum = ( o[0] == COLLINEAR )
+                + ( o[1] == COLLINEAR )
+                + ( o[2] == COLLINEAR );
+        switch (sum) {
+        case 0:
+          {
+            lt = FACET;
+            li = 3; // useless ?
+            break;
+          }
+        case 1:
+          {
+            lt = EDGE;
+            li = ( o[0] == COLLINEAR ) ? i :
+                 ( o[1] == COLLINEAR ) ? ccw(i) :
+                 cw(i);
+            lj = ccw(li);
+            break;
+          }
+        case 2:
+          {
+            lt = VERTEX;
+            li = ( o[0] != COLLINEAR ) ? cw(i) :
+                 ( o[1] != COLLINEAR ) ? i :
+                 ccw(i);
+            break;
+          }
+        }
+        return c;
+      }
+    }
+  case 1:
+    {
+      CGAL_triangulation_precondition( start != Cell_handle() );
+      CGAL_triangulation_precondition( ! start->has_vertex(infinite) );
+      Cell_handle c = start;
+
+      //first tests whether p is collinear with the current triangulation
+      if ( ! collinear( p,
+                        c->vertex(0)->point(),
+                        c->vertex(1)->point()) ) {
+        lt = OUTSIDE_AFFINE_HULL;
+        return c;
+      }
+      // if p is collinear, location :
+      while (1) {
+        if ( c->has_vertex(infinite) ) {
+          // c must contain p in its interior
+          lt = OUTSIDE_CONVEX_HULL;
+          return c;
+        }
+
+        // else c is finite
+        // we test on which direction to continue the traversal
+        switch (collinear_position(c->vertex(0)->point(),
+                                   p,
+                                   c->vertex(1)->point()) ) {
+        case AFTER:
+          c = c->neighbor(0);
+          continue;
+        case BEFORE:
+          c = c->neighbor(1);
+          continue;
+        case MIDDLE:
+            lt = EDGE;
+            li = 0;
+            lj = 1;
+            return c;
+        case SOURCE:
+            lt = VERTEX;
+            li = 0;
+            return c;
+        case TARGET:
+            lt = VERTEX;
+            li = 1;
+            return c;
+        }
+      }
+    }
+  case 0:
+    {
+      Finite_vertices_iterator vit = finite_vertices_begin();
+      if ( ! equal( p, vit->point() ) ) {
+        lt = OUTSIDE_AFFINE_HULL;
+      }
+      else {
+        lt = VERTEX;
+        li = 0;
+      }
+      return vit->cell();
+    }
+  case -1:
+    {
+      lt = OUTSIDE_AFFINE_HULL;
+      return Cell_handle();
+    }
+  default:
+    {
+      CGAL_triangulation_assertion(false);
+      return Cell_handle();
+    }
+  }
+}
+
+#ifndef CGAL_NO_STRUCTURAL_FILTERING
+template <class Gt, class Tds, class Lds>
+inline
+typename Triangulation_3<Gt, Tds, Lds>::Cell_handle
+Triangulation_3<Gt, Tds, Lds>::
+inexact_locate(const Point & t, Cell_handle start, int n_of_turns,
+               bool *could_lock_zone) const
+{
+  CGAL_triangulation_expensive_assertion(start == Cell_handle() || tds().is_simplex(start) );
+
+  if (could_lock_zone)
+    *could_lock_zone = true;
+
+  if(dimension() < 3) return start;
+
+  // Make sure we continue from here with a finite cell.
+  if ( start == Cell_handle() )
+    start = infinite_cell();
+
+  // CJTODO: useless?
+  if (could_lock_zone)
+  {
+    if (!this->try_lock_cell(start))
+    {
+      *could_lock_zone = false;
+      return Cell_handle();
+    }
+  }
+
+  int ind_inf;
+  if( start->has_vertex(infinite, ind_inf) )
+    start = start->neighbor(ind_inf);
+
+  CGAL_triangulation_precondition( start != Cell_handle() );
+  CGAL_triangulation_precondition( ! start->has_vertex(infinite) );
+
+  // We implement the remembering visibility walk.
+  // in this phase, no need to be stochastic
+
+  // Remembers the previous cell to avoid useless orientation tests.
+  Cell_handle previous = Cell_handle();
+  Cell_handle c = start;
+
+  if (could_lock_zone)
+  {
+    if (!this->try_lock_cell(c))
+    {
+      *could_lock_zone = false;
+      return Cell_handle();
+    }
+  }
+
+  // Now treat the cell c.
+  try_next_cell:
+
+  n_of_turns--;
+
+  // We know that the 4 vertices of c are positively oriented.
+  // So, in order to test if p is seen outside from one of c's facets,
+  // we just replace the corresponding point by p in the orientation
+  // test.  We do this using the array below.
+  const Point* pts[4] = { &(c->vertex(0)->point()),
+                          &(c->vertex(1)->point()),
+                          &(c->vertex(2)->point()),
+                          &(c->vertex(3)->point()) };
+
+  // (non-stochastic) visibility walk
+  for (int i=0; i != 4; ++i) {
+    Cell_handle next = c->neighbor(i);
+    if (previous == next) continue;
+
+    // We temporarily put p at i's place in pts.
+    const Point* backup = pts[i];
+    pts[i] = &t;
+    if( inexact_orientation(*pts[0], *pts[1], *pts[2], *pts[3]) != NEGATIVE) {
+      pts[i] = backup;
+      continue;
+    }
+    if(next->has_vertex(infinite)) {
+      // We are outside the convex hull.
+      return next;
+    }
+    previous = c;
+    c = next;
+    if (could_lock_zone)
+    {
+      //previous->unlock(); // DON'T do that, "c" may be in
+                            // the same locking cell as "previous"
+      if (!this->try_lock_cell(c))
+      {
+        *could_lock_zone = false;
+        return Cell_handle();
+      }
+    }
+    if(n_of_turns) goto try_next_cell;
+  }
+
+  return c;
+}
+#endif // no CGAL_NO_STRUCTURAL_FILTERING
+
+template < class GT, class Tds, class Lds >
+Bounded_side
+Triangulation_3<GT,Tds,Lds>::
+side_of_tetrahedron(const Point & p,
+                    const Point & p0,
+                    const Point & p1,
+                    const Point & p2,
+                    const Point & p3,
+                    Locate_type & lt, int & i, int & j ) const
+  // p0,p1,p2,p3 supposed to be non coplanar
+  // tetrahedron p0,p1,p2,p3 is supposed to be well oriented
+  // returns :
+  // ON_BOUNDED_SIDE if p lies strictly inside the tetrahedron
+  // ON_BOUNDARY if p lies on one of the facets
+  // ON_UNBOUNDED_SIDE if p lies strictly outside the tetrahedron
+{
+  CGAL_triangulation_precondition
+    ( orientation(p0,p1,p2,p3) == POSITIVE );
+
+  Orientation o0,o1,o2,o3;
+  if ( ((o0 = orientation(p,p1,p2,p3)) == NEGATIVE) ||
+       ((o1 = orientation(p0,p,p2,p3)) == NEGATIVE) ||
+       ((o2 = orientation(p0,p1,p,p3)) == NEGATIVE) ||
+       ((o3 = orientation(p0,p1,p2,p)) == NEGATIVE) ) {
+    lt = OUTSIDE_CONVEX_HULL;
+    return ON_UNBOUNDED_SIDE;
+  }
+
+  // now all the oi's are >=0
+  // sum gives the number of facets p lies on
+  int sum = ( (o0 == ZERO) ? 1 : 0 )
+          + ( (o1 == ZERO) ? 1 : 0 )
+          + ( (o2 == ZERO) ? 1 : 0 )
+          + ( (o3 == ZERO) ? 1 : 0 );
+
+  switch (sum) {
+  case 0:
+    {
+      lt = CELL;
+      return ON_BOUNDED_SIDE;
+    }
+  case 1:
+    {
+      lt = FACET;
+      // i = index such that p lies on facet(i)
+      i = ( o0 == ZERO ) ? 0 :
+          ( o1 == ZERO ) ? 1 :
+          ( o2 == ZERO ) ? 2 :
+          3;
+      return ON_BOUNDARY;
+    }
+  case 2:
+    {
+      lt = EDGE;
+      // i = smallest index such that p does not lie on facet(i)
+      // i must be < 3 since p lies on 2 facets
+      i = ( o0 == POSITIVE ) ? 0 :
+          ( o1 == POSITIVE ) ? 1 :
+          2;
+      // j = larger index such that p not on facet(j)
+      // j must be > 0 since p lies on 2 facets
+      j = ( o3 == POSITIVE ) ? 3 :
+          ( o2 == POSITIVE ) ? 2 :
+          1;
+      return ON_BOUNDARY;
+    }
+  case 3:
+    {
+      lt = VERTEX;
+      // i = index such that p does not lie on facet(i)
+      i = ( o0 == POSITIVE ) ? 0 :
+          ( o1 == POSITIVE ) ? 1 :
+          ( o2 == POSITIVE ) ? 2 :
+          3;
+      return ON_BOUNDARY;
+    }
+  default:
+    {
+      // impossible : cannot be on 4 facets for a real tetrahedron
+      CGAL_triangulation_assertion(false);
+      return ON_BOUNDARY;
+    }
+  }
+}
+
+template < class GT, class Tds, class Lds >
+Bounded_side
+Triangulation_3<GT,Tds,Lds>::
+side_of_cell(const Point & p,
+             Cell_handle c,
+             Locate_type & lt, int & i, int & j) const
+  // returns
+  // ON_BOUNDED_SIDE if p inside the cell
+  // (for an infinite cell this means that p lies strictly in the half space
+  // limited by its finite facet)
+  // ON_BOUNDARY if p on the boundary of the cell
+  // (for an infinite cell this means that p lies on the *finite* facet)
+  // ON_UNBOUNDED_SIDE if p lies outside the cell
+  // (for an infinite cell this means that p is not in the preceding
+  // two cases)
+  // lt has a meaning only when ON_BOUNDED_SIDE or ON_BOUNDARY
+{
+  CGAL_triangulation_precondition( dimension() == 3 );
+  if ( ! is_infinite(c) ) {
+    return side_of_tetrahedron(p,
+                               c->vertex(0)->point(),
+                               c->vertex(1)->point(),
+                               c->vertex(2)->point(),
+                               c->vertex(3)->point(),
+                               lt, i, j);
+  }
+  else {
+    int inf = c->index(infinite);
+    Orientation o;
+    Vertex_handle
+      v1=c->vertex((inf+1)&3),
+      v2=c->vertex((inf+2)&3),
+      v3=c->vertex((inf+3)&3);
+    if ( (inf&1) == 0 )
+      o = orientation(p, v1->point(), v2->point(), v3->point());
+    else
+      o =  orientation(v3->point(), p, v1->point(), v2->point());
+
+    switch (o) {
+    case POSITIVE:
+      {
+        lt = CELL;
+        return ON_BOUNDED_SIDE;
+      }
+    case NEGATIVE:
+      return ON_UNBOUNDED_SIDE;
+    case ZERO:
+      {
+        // location in the finite facet
+        int i_f, j_f;
+        Bounded_side side =
+          side_of_triangle(p, v1->point(), v2->point(), v3->point(),
+                           lt, i_f, j_f);
+        // lt need not be modified in most cases :
+        switch (side) {
+        case ON_BOUNDED_SIDE:
+          {
+            // lt == FACET ok
+            i = inf;
+            return ON_BOUNDARY;
+          }
+        case ON_BOUNDARY:
+          {
+            // lt == VERTEX OR EDGE ok
+            i = ( i_f == 0 ) ? ((inf+1)&3) :
+                ( i_f == 1 ) ? ((inf+2)&3) :
+                ((inf+3)&3);
+            if ( lt == EDGE ) {
+              j = (j_f == 0 ) ? ((inf+1)&3) :
+                  ( j_f == 1 ) ? ((inf+2)&3) :
+                  ((inf+3)&3);
+            }
+            return ON_BOUNDARY;
+          }
+        case ON_UNBOUNDED_SIDE:
+          {
+            // p lies on the plane defined by the finite facet
+            // lt must be initialized
+            return ON_UNBOUNDED_SIDE;
+          }
+        default:
+          {
+            CGAL_triangulation_assertion(false);
+            return ON_BOUNDARY;
+          }
+        } // switch side
+      }// case ZERO
+    default:
+      {
+        CGAL_triangulation_assertion(false);
+        return ON_BOUNDARY;
+      }
+    } // switch o
+  } // else infinite cell
+} // side_of_cell
+
+template < class GT, class Tds, class Lds >
+Bounded_side
+Triangulation_3<GT,Tds,Lds>::
+side_of_triangle(const Point & p,
+                 const Point & p0,
+                 const Point & p1,
+                 const Point & p2,
+                 Locate_type & lt, int & i, int & j ) const
+  // p0,p1,p2 supposed to define a plane
+  // p supposed to lie on plane p0,p1,p2
+  // triangle p0,p1,p2 defines the orientation of the plane
+  // returns
+  // ON_BOUNDED_SIDE if p lies strictly inside the triangle
+  // ON_BOUNDARY if p lies on one of the edges
+  // ON_UNBOUNDED_SIDE if p lies strictly outside the triangle
+{
+  CGAL_triangulation_precondition( coplanar(p,p0,p1,p2) );
+
+  Orientation o012 = coplanar_orientation(p0,p1,p2);
+  CGAL_triangulation_precondition( o012 != COLLINEAR );
+
+  Orientation o0; // edge p0 p1
+  Orientation o1; // edge p1 p2
+  Orientation o2; // edge p2 p0
+
+  if ((o0 = coplanar_orientation(p0,p1,p)) == opposite(o012) ||
+      (o1 = coplanar_orientation(p1,p2,p)) == opposite(o012) ||
+      (o2 = coplanar_orientation(p2,p0,p)) == opposite(o012)) {
+    lt = OUTSIDE_CONVEX_HULL;
+    return ON_UNBOUNDED_SIDE;
+  }
+
+  // now all the oi's are >=0
+  // sum gives the number of edges p lies on
+  int sum = ( (o0 == ZERO) ? 1 : 0 )
+          + ( (o1 == ZERO) ? 1 : 0 )
+          + ( (o2 == ZERO) ? 1 : 0 );
+
+  switch (sum) {
+  case 0:
+    {
+      lt = FACET;
+      return ON_BOUNDED_SIDE;
+    }
+  case 1:
+    {
+      lt = EDGE;
+      i = ( o0 == ZERO ) ? 0 :
+          ( o1 == ZERO ) ? 1 :
+          2;
+      if ( i == 2 )
+        j=0;
+      else
+        j = i+1;
+      return ON_BOUNDARY;
+    }
+  case 2:
+    {
+      lt = VERTEX;
+      i = ( o0 == o012 ) ? 2 :
+          ( o1 == o012 ) ? 0 :
+          1;
+      return ON_BOUNDARY;
+    }
+  default:
+    {
+      // cannot happen
+      CGAL_triangulation_assertion(false);
+      return ON_BOUNDARY;
+    }
+  }
+}
+
+template < class GT, class Tds, class Lds >
+Bounded_side
+Triangulation_3<GT,Tds,Lds>::
+side_of_facet(const Point & p,
+              Cell_handle c,
+              Locate_type & lt, int & li, int & lj) const
+  // supposes dimension 2 otherwise does not work for infinite facets
+  // returns :
+  // ON_BOUNDED_SIDE if p inside the facet
+  // (for an infinite facet this means that p lies strictly in the half plane
+  // limited by its finite edge)
+  // ON_BOUNDARY if p on the boundary of the facet
+  // (for an infinite facet this means that p lies on the *finite* edge)
+  // ON_UNBOUNDED_SIDE if p lies outside the facet
+  // (for an infinite facet this means that p is not in the
+  // preceding two cases)
+  // lt has a meaning only when ON_BOUNDED_SIDE or ON_BOUNDARY
+  // when they mean anything, li and lj refer to indices in the cell c
+  // giving the facet (c,i)
+{
+  CGAL_triangulation_precondition( dimension() == 2 );
+  if ( ! is_infinite(c,3) ) {
+    // The following precondition is useless because it is written
+    // in side_of_facet
+    // 	CGAL_triangulation_precondition( coplanar (p,
+    // 					  c->vertex(0)->point,
+    // 					  c->vertex(1)->point,
+    // 					  c->vertex(2)->point) );
+    int i_t, j_t;
+    Bounded_side side = side_of_triangle(p,
+                            c->vertex(0)->point(),
+                            c->vertex(1)->point(),
+                            c->vertex(2)->point(),
+                            lt, i_t, j_t);
+    // We protect the following code by this test to avoid valgrind messages.
+    if (side == ON_BOUNDARY) {
+        // indices in the original cell :
+        li = ( i_t == 0 ) ? 0 :
+             ( i_t == 1 ) ? 1 : 2;
+        lj = ( j_t == 0 ) ? 0 :
+             ( j_t == 1 ) ? 1 : 2;
+    }
+    return side;
+  }
+  // else infinite facet
+  int inf = c->index(infinite);
+    // The following precondition is useless because it is written
+    // in side_of_facet
+    // 	CGAL_triangulation_precondition( coplanar (p,
+    // 				  c->neighbor(inf)->vertex(0)->point(),
+    // 				  c->neighbor(inf)->vertex(1)->point(),
+    // 				  c->neighbor(inf)->vertex(2)->point()));
+  int i2 = next_around_edge(inf,3);
+  int i1 = 3-inf-i2;
+  Vertex_handle v1 = c->vertex(i1),
+                v2 = c->vertex(i2);
+
+  CGAL_triangulation_assertion(coplanar_orientation(v1->point(), v2->point(),
+                               mirror_vertex(c, inf)->point()) == POSITIVE);
+
+  switch (coplanar_orientation(v1->point(), v2->point(), p)) {
+  case POSITIVE:
+      // p lies on the same side of v1v2 as vn, so not in f
+      return ON_UNBOUNDED_SIDE;
+  case NEGATIVE:
+      // p lies in f
+      lt = FACET;
+      li = 3;
+      return ON_BOUNDED_SIDE;
+  default: // case ZERO:
+      // p collinear with v1v2
+      int i_e;
+      switch (side_of_segment(p, v1->point(), v2->point(), lt, i_e)) {
+        // computation of the indices in the original cell
+      case ON_BOUNDED_SIDE:
+          // lt == EDGE ok
+          li = i1;
+          lj = i2;
+          return ON_BOUNDARY;
+      case ON_BOUNDARY:
+          // lt == VERTEX ok
+          li = ( i_e == 0 ) ? i1 : i2;
+          return ON_BOUNDARY;
+      default: // case ON_UNBOUNDED_SIDE:
+          // p lies on the line defined by the finite edge
+          return ON_UNBOUNDED_SIDE;
+      }
+  }
+}
+
+template < class GT, class Tds, class Lds >
+Bounded_side
+Triangulation_3<GT,Tds,Lds>::
+side_of_segment(const Point & p,
+                const Point & p0,
+                const Point & p1,
+                Locate_type & lt, int & i ) const
+  // p0, p1 supposed to be different
+  // p supposed to be collinear to p0, p1
+  // returns :
+  // ON_BOUNDED_SIDE if p lies strictly inside the edge
+  // ON_BOUNDARY if p equals p0 or p1
+  // ON_UNBOUNDED_SIDE if p lies strictly outside the edge
+{
+  CGAL_triangulation_precondition( ! equal(p0, p1) );
+  CGAL_triangulation_precondition( collinear(p, p0, p1) );
+
+  switch (collinear_position(p0, p, p1)) {
+  case MIDDLE:
+    lt = EDGE;
+    return ON_BOUNDED_SIDE;
+  case SOURCE:
+    lt = VERTEX;
+    i = 0;
+    return ON_BOUNDARY;
+  case TARGET:
+    lt = VERTEX;
+    i = 1;
+    return ON_BOUNDARY;
+  default: // case BEFORE: case AFTER:
+    lt = OUTSIDE_CONVEX_HULL;
+    return ON_UNBOUNDED_SIDE;
+  }
+}
+
+template < class GT, class Tds, class Lds >
+Bounded_side
+Triangulation_3<GT,Tds,Lds>::
+side_of_edge(const Point & p,
+             Cell_handle c,
+             Locate_type & lt, int & li) const
+  // supposes dimension 1 otherwise does not work for infinite edges
+  // returns :
+  // ON_BOUNDED_SIDE if p inside the edge
+  // (for an infinite edge this means that p lies in the half line
+  // defined by the vertex)
+  // ON_BOUNDARY if p equals one of the vertices
+  // ON_UNBOUNDED_SIDE if p lies outside the edge
+  // (for an infinite edge this means that p lies on the other half line)
+  // lt has a meaning when ON_BOUNDED_SIDE and ON_BOUNDARY
+  // li refer to indices in the cell c
+{
+  CGAL_triangulation_precondition( dimension() == 1 );
+  if ( ! is_infinite(c,0,1) )
+    return side_of_segment(p, c->vertex(0)->point(), c->vertex(1)->point(),
+                           lt, li);
+  // else infinite edge
+  int inf = c->index(infinite);
+  switch (collinear_position(c->vertex(1-inf)->point(), p,
+                             mirror_vertex(c, inf)->point())) {
+      case SOURCE:
+          lt = VERTEX;
+          li = 1-inf;
+          return ON_BOUNDARY;
+      case BEFORE:
+          lt = EDGE;
+          return ON_BOUNDED_SIDE;
+      default: // case MIDDLE: case AFTER: case TARGET:
+          return ON_UNBOUNDED_SIDE;
+  }
+}
+
+template < class GT, class Tds, class Lds >
+bool
+Triangulation_3<GT,Tds,Lds>::
+flip( Cell_handle c, int i )
+{
+  CGAL_triangulation_precondition( (dimension() == 3) && (0<=i) && (i<4)
+                                   && (number_of_vertices() >= 5) );
+
+  Cell_handle n = c->neighbor(i);
+  int in = n->index(c);
+  if ( is_infinite( c ) || is_infinite( n ) ) return false;
+
+  if ( i%2 == 1 ) {
+    if ( orientation( c->vertex((i+1)&3)->point(),
+                      c->vertex((i+2)&3)->point(),
+                      n->vertex(in)->point(),
+                      c->vertex(i)->point() )
+         != POSITIVE ) return false;
+    if ( orientation( c->vertex((i+2)&3)->point(),
+                      c->vertex((i+3)&3)->point(),
+                      n->vertex(in)->point(),
+                      c->vertex(i)->point() )
+         != POSITIVE ) return false;
+    if ( orientation( c->vertex((i+3)&3)->point(),
+                      c->vertex((i+1)&3)->point(),
+                      n->vertex(in)->point(),
+                      c->vertex(i)->point() )
+         != POSITIVE ) return false;
+  }
+  else {
+    if ( orientation( c->vertex((i+2)&3)->point(),
+                      c->vertex((i+1)&3)->point(),
+                      n->vertex(in)->point(),
+                      c->vertex(i)->point() )
+         != POSITIVE ) return false;
+    if ( orientation( c->vertex((i+3)&3)->point(),
+                      c->vertex((i+2)&3)->point(),
+                      n->vertex(in)->point(),
+                      c->vertex(i)->point() )
+         != POSITIVE ) return false;
+    if ( orientation( c->vertex((i+1)&3)->point(),
+                      c->vertex((i+3)&3)->point(),
+                      n->vertex(in)->point(),
+                      c->vertex(i)->point() )
+         != POSITIVE ) return false;
+  }
+
+  _tds.flip_flippable(c, i);
+  return true;
+}
+
+template < class GT, class Tds, class Lds >
+void
+Triangulation_3<GT,Tds,Lds>::
+flip_flippable( Cell_handle c, int i )
+{
+  CGAL_triangulation_precondition( (dimension() == 3) && (0<=i) && (i<4)
+                                   && (number_of_vertices() >= 5) );
+  CGAL_triangulation_precondition_code( Cell_handle n = c->neighbor(i); );
+  CGAL_triangulation_precondition_code( int in = n->index(c); );
+  CGAL_triangulation_precondition( ( ! is_infinite( c ) ) &&
+                                   ( ! is_infinite( n ) ) );
+
+  if ( i%2 == 1 ) {
+    CGAL_triangulation_precondition( orientation( c->vertex((i+1)&3)->point(),
+                                                  c->vertex((i+2)&3)->point(),
+                                                  n->vertex(in)->point(),
+                                                  c->vertex(i)->point() )
+                                     == POSITIVE );
+    CGAL_triangulation_precondition( orientation( c->vertex((i+2)&3)->point(),
+                                                  c->vertex((i+3)&3)->point(),
+                                                  n->vertex(in)->point(),
+                                                  c->vertex(i)->point() )
+                                     == POSITIVE );
+    CGAL_triangulation_precondition( orientation( c->vertex((i+3)&3)->point(),
+                                                  c->vertex((i+1)&3)->point(),
+                                                  n->vertex(in)->point(),
+                                                  c->vertex(i)->point() )
+                                     == POSITIVE );
+  }
+  else {
+    CGAL_triangulation_precondition( orientation( c->vertex((i+2)&3)->point(),
+                                                  c->vertex((i+1)&3)->point(),
+                                                  n->vertex(in)->point(),
+                                                  c->vertex(i)->point() )
+                                     == POSITIVE );
+    CGAL_triangulation_precondition( orientation( c->vertex((i+3)&3)->point(),
+                                                  c->vertex((i+2)&3)->point(),
+                                                  n->vertex(in)->point(),
+                                                  c->vertex(i)->point() )
+                                     == POSITIVE );
+    CGAL_triangulation_precondition( orientation( c->vertex((i+1)&3)->point(),
+                                                  c->vertex((i+3)&3)->point(),
+                                                  n->vertex(in)->point(),
+                                                  c->vertex(i)->point() )
+                                     == POSITIVE );
+  }
+
+  _tds.flip_flippable(c, i);
+}
+
+template < class GT, class Tds, class Lds >
+bool
+Triangulation_3<GT,Tds,Lds>::
+flip( Cell_handle c, int i, int j )
+  // flips edge i,j of cell c
+{
+  CGAL_triangulation_precondition( (dimension() == 3)
+                                   && (0<=i) && (i<4)
+                                   && (0<=j) && (j<4)
+                                   && ( i != j )
+                                   && (number_of_vertices() >= 5) );
+
+  // checks that degree 3 and not on the convex hull
+  int degree = 0;
+  Cell_circulator ccir = incident_cells(c,i,j);
+  Cell_circulator cdone = ccir;
+  do {
+    if ( is_infinite(ccir) ) return false;
+    ++degree;
+    ++ccir;
+  } while ( ccir != cdone );
+
+  if ( degree != 3 ) return false;
+
+  // checks that future tetrahedra are well oriented
+  Cell_handle n = c->neighbor( next_around_edge(i,j) );
+  int in = n->index( c->vertex(i) );
+  int jn = n->index( c->vertex(j) );
+  if ( orientation( c->vertex(next_around_edge(i,j))->point(),
+                    c->vertex(next_around_edge(j,i))->point(),
+                    n->vertex(next_around_edge(jn,in))->point(),
+                    c->vertex(j)->point() )
+       != POSITIVE ) return false;
+  if ( orientation( c->vertex(i)->point(),
+                    c->vertex(next_around_edge(j,i))->point(),
+                    n->vertex(next_around_edge(jn,in))->point(),
+                    c->vertex(next_around_edge(i,j))->point() )
+       != POSITIVE ) return false;
+
+  _tds.flip_flippable(c, i, j);
+  return true;
+}
+
+template < class GT, class Tds, class Lds >
+void
+Triangulation_3<GT,Tds,Lds>::
+flip_flippable( Cell_handle c, int i, int j )
+  // flips edge i,j of cell c
+{
+#if !defined CGAL_TRIANGULATION_NO_PRECONDITIONS && \
+    !defined CGAL_NO_PRECONDITIONS && !defined NDEBUG
+  CGAL_triangulation_precondition( (dimension() == 3)
+                                   && (0<=i) && (i<4)
+                                   && (0<=j) && (j<4)
+                                   && ( i != j )
+                                   && (number_of_vertices() >= 5) );
+  int degree = 0;
+  Cell_circulator ccir = incident_cells(c,i,j);
+  Cell_circulator cdone = ccir;
+  do {
+    CGAL_triangulation_precondition( ! is_infinite(ccir) );
+    ++degree;
+    ++ccir;
+  } while ( ccir != cdone );
+  CGAL_triangulation_precondition( degree == 3 );
+
+  Cell_handle n = c->neighbor( next_around_edge(i, j) );
+  int in = n->index( c->vertex(i) );
+  int jn = n->index( c->vertex(j) );
+  CGAL_triangulation_precondition
+    ( orientation( c->vertex(next_around_edge(i,j))->point(),
+                   c->vertex(next_around_edge(j,i))->point(),
+                   n->vertex(next_around_edge(jn,in))->point(),
+                   c->vertex(j)->point() ) == POSITIVE );
+  CGAL_triangulation_precondition
+    ( orientation( c->vertex(i)->point(),
+                   c->vertex(next_around_edge(j,i))->point(),
+                   n->vertex(next_around_edge(jn,in))->point(),
+                   c->vertex(next_around_edge(i,j))->point() ) == POSITIVE );
+#endif
+  _tds.flip_flippable(c, i, j);
+}
+
+template < class GT, class Tds, class Lds >
+typename Triangulation_3<GT,Tds,Lds>::Vertex_handle
+Triangulation_3<GT,Tds,Lds>::
+insert(const Point & p, Cell_handle start)
+{
+  Locate_type lt;
+  int li, lj;
+  Cell_handle c = locate( p, lt, li, lj, start);
+  return insert(p, lt, c, li, lj);
+}
+
+template < class GT, class Tds, class Lds >
+typename Triangulation_3<GT,Tds,Lds>::Vertex_handle
+Triangulation_3<GT,Tds,Lds>::
+insert(const Point & p, Locate_type lt, Cell_handle c, int li, int lj)
+{
+  switch (lt) {
+  case VERTEX:
+    return c->vertex(li);
+  case EDGE:
+    return insert_in_edge(p, c, li, lj);
+  case FACET:
+    return insert_in_facet(p, c, li);
+  case CELL:
+    return insert_in_cell(p, c);
+  case OUTSIDE_CONVEX_HULL:
+    return insert_outside_convex_hull(p, c);
+  case OUTSIDE_AFFINE_HULL:
+  default:
+    return insert_outside_affine_hull(p);
+  }
+}
+
+
+
+template < class GT, class Tds, class Lds >
+template < class Conflict_tester, class Hidden_points_visitor >
+typename Triangulation_3<GT,Tds,Lds>::Vertex_handle
+Triangulation_3<GT,Tds,Lds>::
+insert_in_conflict(const Point & p,
+                   Locate_type lt, Cell_handle c, int li, int /*lj*/,
+                   const Conflict_tester &tester,
+                   Hidden_points_visitor &hider,
+                   bool *could_lock_zone)
+{
+  if (could_lock_zone)
+    *could_lock_zone = true;
+
+  switch (dimension()) {
+  case 3:
+    {
+      if ((lt == VERTEX) &&
+          (tester.compare_weight(c->vertex(li)->point(), p)==0) ) {
+        return c->vertex(li);
+      }
+      // If the new point is not in conflict with its cell, it is hidden.
+      if (!tester.test_initial_cell(c)) {
+        hider.hide_point(c,p);
+        return Vertex_handle();
+      }
+
+      // Ok, we really insert the point now.
+      // First, find the conflict region.
+      std::vector<Cell_handle> cells;
+      Facet facet;
+
+      cells.reserve(32);
+
+      // Parallel
+      if (could_lock_zone)
+      {
+        std::vector<Facet> facets;
+        facets.reserve(32);
+
+        find_conflicts(
+          c,
+          tester,
+          make_triple(
+            std::back_inserter(facets),
+                                    std::back_inserter(cells),
+            Emptyset_iterator()),
+          could_lock_zone);
+
+        if (*could_lock_zone == false)
+        {
+          BOOST_FOREACH(Cell_handle& ch,
+            std::make_pair(cells.begin(), cells.end()))
+          {
+            ch->tds_data().clear();
+          }
+
+          BOOST_FOREACH(Facet& f,
+            std::make_pair(facets.begin(), facets.end()))
+          {
+            f.first->neighbor(f.second)->tds_data().clear();
+          }
+          return Vertex_handle();
+        }
+
+        facet = facets.back();
+      }
+      // Sequential
+      else
+      {
+        cells.reserve(32);
+        find_conflicts(
+          c,
+          tester,
+          make_triple(
+            Oneset_iterator<Facet>(facet),
+                                    std::back_inserter(cells),
+                                    Emptyset_iterator()));
+      }
+
+
+      // Remember the points that are hidden by the conflicting cells,
+      // as they will be deleted during the insertion.
+      hider.process_cells_in_conflict(cells.begin(), cells.end());
+
+      Vertex_handle v = _insert_in_hole(p, cells.begin(), cells.end(),
+                                        facet.first, facet.second);
+
+      // Store the hidden points in their new cells.
+      hider.reinsert_vertices(v);
+      return v;
+    }
+  case 2:
+    {
+      // This check is added compared to the 3D case
+      if (lt == OUTSIDE_AFFINE_HULL)
+        return insert_outside_affine_hull (p);
+
+      if ((lt == VERTEX) &&
+          (tester.compare_weight(c->vertex(li)->point(), p)==0) ) {
+        return c->vertex(li);
+      }
+      // If the new point is not in conflict with its cell, it is hidden.
+      if (!tester.test_initial_cell(c)) {
+        hider.hide_point(c,p);
+        return Vertex_handle();
+      }
+
+      // Ok, we really insert the point now.
+      // First, find the conflict region.
+      std::vector<Cell_handle> cells;
+      Facet facet;
+
+      cells.reserve(32);
+      find_conflicts
+        (c, tester, make_triple(Oneset_iterator<Facet>(facet),
+                                std::back_inserter(cells),
+                                Emptyset_iterator()));
+
+      // Remember the points that are hidden by the conflicting cells,
+      // as they will be deleted during the insertion.
+      hider.process_cells_in_conflict(cells.begin(), cells.end());
+
+      Vertex_handle v = _insert_in_hole(p, cells.begin(), cells.end(),
+                                        facet.first, facet.second);
+
+      // Store the hidden points in their new cells.
+      hider.reinsert_vertices(v);
+      return v;
+    }
+  default:
+    {
+      // dimension() <= 1
+      if (lt == OUTSIDE_AFFINE_HULL)
+        return insert_outside_affine_hull (p);
+
+      if (lt == VERTEX &&
+          tester.compare_weight(c->vertex(li)->point(), p) == 0) {
+        return c->vertex(li);
+      }
+
+      // If the new point is not in conflict with its cell, it is hidden.
+      if (! tester.test_initial_cell(c)) {
+        hider.hide_point(c,p);
+        return Vertex_handle();
+      }
+
+      if (dimension() == 0) {
+        return hider.replace_vertex(c, li, p);
+      }
+
+
+      // dimension() == 1;
+
+      // Ok, we really insert the point now.
+      // First, find the conflict region.
+      std::vector<Cell_handle> cells;
+      Facet facet;
+      Cell_handle bound[2];
+      // corresponding index: bound[j]->neighbor(1-j) is in conflict.
+
+      // We get all cells in conflict,
+      // and remember the 2 external boundaries.
+      cells.push_back(c);
+
+      for (int j = 0; j<2; ++j) {
+        Cell_handle n = c->neighbor(j);
+        while ( tester(n) ) {
+          cells.push_back(n);
+          n = n->neighbor(j);
+        }
+        bound[j] = n;
+      }
+
+      // Insertion.
+      hider.process_cells_in_conflict(cells.begin(), cells.end());
+
+      tds().delete_cells(cells.begin(), cells.end());
+
+      // We preserve the order (like the orientation in 2D-3D).
+      Vertex_handle v = tds().create_vertex();
+      Cell_handle c0 = tds().create_face(v, bound[0]->vertex(0), Vertex_handle());
+      Cell_handle c1 = tds().create_face(bound[1]->vertex(1), v, Vertex_handle());
+      tds().set_adjacency(c0, 1, c1, 0);
+      tds().set_adjacency(bound[0], 1, c0, 0);
+      tds().set_adjacency(c1, 1, bound[1], 0);
+      bound[0]->vertex(0)->set_cell(bound[0]);
+      bound[1]->vertex(1)->set_cell(bound[1]);
+      v->set_cell(c0);
+      v->set_point (p);
+
+      hider.reinsert_vertices(v);
+
+      return v;
+    }
+  }
+}
+
+template < class GT, class Tds, class Lds >
+typename Triangulation_3<GT,Tds,Lds>::Vertex_handle
+Triangulation_3<GT,Tds,Lds>::
+insert_in_cell(const Point & p, Cell_handle c)
+{
+  CGAL_triangulation_precondition( dimension() == 3 );
+  CGAL_triangulation_precondition_code
+    ( Locate_type lt;
+      int i; int j; );
+  CGAL_triangulation_precondition
+    ( side_of_tetrahedron( p,
+                           c->vertex(0)->point(),
+                           c->vertex(1)->point(),
+                           c->vertex(2)->point(),
+                           c->vertex(3)->point(),
+                           lt,i,j ) == ON_BOUNDED_SIDE );
+
+    Vertex_handle v = _tds.insert_in_cell(c);
+    v->set_point(p);
+    return v;
+}
+
+template < class GT, class Tds, class Lds >
+inline
+typename Triangulation_3<GT,Tds,Lds>::Vertex_handle
+Triangulation_3<GT,Tds,Lds>::
+insert_in_facet(const Point & p, Cell_handle c, int i)
+{
+  CGAL_triangulation_precondition( dimension() == 2 || dimension() == 3);
+  CGAL_triangulation_precondition( (dimension() == 2 && i == 3)
+                                || (dimension() == 3 && i >= 0 && i <= 3) );
+  CGAL_triangulation_exactness_precondition_code
+    ( Locate_type lt;
+      int li; int lj; );
+  CGAL_triangulation_exactness_precondition
+    ( coplanar( p, c->vertex((i+1)&3)->point(),
+                   c->vertex((i+2)&3)->point(),
+                   c->vertex((i+3)&3)->point() )
+      &&
+      side_of_triangle( p,
+                        c->vertex((i+1)&3)->point(),
+                        c->vertex((i+2)&3)->point(),
+                        c->vertex((i+3)&3)->point(),
+                        lt, li, lj) == ON_BOUNDED_SIDE );
+
+    Vertex_handle v = _tds.insert_in_facet(c, i);
+    v->set_point(p);
+    return v;
+}
+
+template < class GT, class Tds, class Lds >
+typename Triangulation_3<GT,Tds,Lds>::Vertex_handle
+Triangulation_3<GT,Tds,Lds>::
+insert_in_edge(const Point & p, Cell_handle c, int i, int j)
+{
+  CGAL_triangulation_precondition( i != j );
+  CGAL_triangulation_precondition( dimension() >= 1 && dimension() <= 3 );
+  CGAL_triangulation_precondition( i >= 0 && i <= dimension()
+                                   && j >= 0 && j <= dimension() );
+  CGAL_triangulation_exactness_precondition_code( Locate_type lt; int li; );
+  switch ( dimension() ) {
+  case 3:
+  case 2:
+    {
+      CGAL_triangulation_precondition( ! is_infinite(c, i, j) );
+      CGAL_triangulation_exactness_precondition(
+                         collinear( c->vertex(i)->point(),
+                                    p,
+                                    c->vertex(j)->point() )
+                      && side_of_segment( p,
+                                          c->vertex(i)->point(),
+                                          c->vertex(j)->point(),
+                                          lt, li ) == ON_BOUNDED_SIDE );
+      break;
+    }
+  case 1:
+    {
+      CGAL_triangulation_exactness_precondition( side_of_edge(p, c, lt, li)
+                                                 == ON_BOUNDED_SIDE );
+      break;
+    }
+  }
+
+  Vertex_handle v = _tds.insert_in_edge(c, i, j);
+  v->set_point(p);
+  return v;
+}
+
+template < class GT, class Tds, class Lds >
+typename Triangulation_3<GT,Tds,Lds>::Vertex_handle
+Triangulation_3<GT,Tds,Lds>::
+insert_outside_convex_hull(const Point & p, Cell_handle c)
+  // c is an infinite cell containing p
+  // p is strictly outside the convex hull
+  // dimension 0 not allowed, use outside-affine-hull
+{
+  CGAL_triangulation_precondition( dimension() > 0 );
+  CGAL_triangulation_precondition( c->has_vertex(infinite) );
+  // the precondition that p is in c is tested in each of the
+  // insertion methods called from this method
+  switch ( dimension() ) {
+  case 1:
+    {
+      // 	// p lies in the infinite edge neighboring c
+      // 	// on the other side of li
+      // 	return insert_in_edge(p,c->neighbor(1-li),0,1);
+      return insert_in_edge(p,c,0,1);
+    }
+  case 2:
+    {
+      Conflict_tester_outside_convex_hull_2 tester(p, this);
+      Vertex_handle v = insert_conflict(c, tester);
+      v->set_point(p);
+      return v;
+    }
+  default: // case 3:
+    {
+      Conflict_tester_outside_convex_hull_3 tester(p, this);
+      Vertex_handle v = insert_conflict(c, tester);
+      v->set_point(p);
+      return v;
+    }
+  }
+}
+
+template < class GT, class Tds, class Lds >
+typename Triangulation_3<GT,Tds,Lds>::Vertex_handle
+Triangulation_3<GT,Tds,Lds>::
+insert_outside_affine_hull(const Point & p)
+{
+  CGAL_triangulation_precondition( dimension() < 3 );
+  bool reorient;
+  switch ( dimension() ) {
+  case 1:
+    {
+      Cell_handle c = infinite_cell();
+      Cell_handle n = c->neighbor(c->index(infinite_vertex()));
+      Orientation o = coplanar_orientation(n->vertex(0)->point(),
+                                           n->vertex(1)->point(), p);
+      CGAL_triangulation_precondition ( o != COLLINEAR );
+      reorient = o == NEGATIVE;
+      break;
+    }
+  case 2:
+    {
+      Cell_handle c = infinite_cell();
+      Cell_handle n = c->neighbor(c->index(infinite_vertex()));
+      Orientation o = orientation( n->vertex(0)->point(),
+                                   n->vertex(1)->point(),
+                                   n->vertex(2)->point(), p );
+      CGAL_triangulation_precondition ( o != COPLANAR );
+      reorient = o == NEGATIVE;
+      break;
+    }
+  default:
+    reorient = false;
+  }
+
+  Vertex_handle v = _tds.insert_increase_dimension(infinite_vertex());
+  v->set_point(p);
+
+  if (reorient)
+      _tds.reorient();
+
+  return v;
+}
+
+template < class GT, class Tds, class Lds >
+template < class OutputItCells >
+typename Triangulation_3<GT,Tds,Lds>::Vertex_handle
+Triangulation_3<GT,Tds,Lds>::insert_and_give_new_cells(const Point  &p,
+                                                   OutputItCells fit,
+                                                   Cell_handle start)
+{
+  Vertex_handle v = insert(p, start);
+  int dimension = this->dimension();
+  if(dimension == 3) this->incident_cells(v, fit);
+  else if(dimension == 2)
+  {
+    Cell_handle c = v->cell(), end = c;
+    do {
+      *fit++ = c;
+      int i = c->index(v);
+      c = c->neighbor((i+1)%3);
+    } while(c != end);
+  }
+  else if(dimension == 1)
+  {
+    Cell_handle c = v->cell();
+    *fit++ = c;
+    *fit++ = c->neighbor((~(c->index(v)))&1);
+  }
+  else *fit++ = v->cell(); // dimension = 0
+  return v;
+}
+
+template < class GT, class Tds, class Lds >
+template < class OutputItCells >
+typename Triangulation_3<GT,Tds,Lds>::Vertex_handle
+Triangulation_3<GT,Tds,Lds>::insert_and_give_new_cells(const Point& p,
+                                                   OutputItCells fit,
+                                                   Vertex_handle hint)
+{
+  Vertex_handle v = insert(p, hint);
+  int dimension = this->dimension();
+  if(dimension == 3) this->incident_cells(v, fit);
+  else if(dimension == 2)
+  {
+    Cell_handle c = v->cell(), end = c;
+    do {
+      *fit++ = c;
+      int i = c->index(v);
+      c = c->neighbor((i+1)%3);
+    } while(c != end);
+  }
+  else if(dimension == 1)
+  {
+    Cell_handle c = v->cell();
+    *fit++ = c;
+    *fit++ = c->neighbor((~(c->index(v)))&1);
+  }
+  else *fit++ = v->cell(); // dimension = 0
+  return v;
+}
+
+template < class GT, class Tds, class Lds >
+template < class OutputItCells >
+typename Triangulation_3<GT,Tds,Lds>::Vertex_handle
+Triangulation_3<GT,Tds,Lds>::insert_and_give_new_cells(const Point& p,
+                                                   Locate_type lt,
+                                                   Cell_handle c, int li, int lj,
+                                                   OutputItCells fit)
+{
+  Vertex_handle v = insert(p, lt, c, li, lj);
+  int dimension = this->dimension();
+  if(dimension == 3) this->incident_cells(v, fit);
+  else if(dimension == 2)
+  {
+    Cell_handle c = v->cell(), end = c;
+    do {
+      *fit++ = c;
+      int i = c->index(v);
+      c = c->neighbor((i+1)%3);
+    } while(c != end);
+  }
+  else if(dimension == 1)
+  {
+    Cell_handle c = v->cell();
+    *fit++ = c;
+    *fit++ = c->neighbor((~(c->index(v)))&1);
+  }
+  else *fit++ = v->cell(); // dimension = 0
+  return v;
+}
+
+template <class Gt, class Tds, class Lds>
+typename Triangulation_3<Gt,Tds,Lds>::Vertex_triple
+Triangulation_3<Gt,Tds,Lds>::
+make_vertex_triple(const Facet& f) const
+{
+  Cell_handle ch = f.first;
+  int i = f.second;
+
+  return Vertex_triple(ch->vertex(vertex_triple_index(i,0)),
+      ch->vertex(vertex_triple_index(i,1)),
+      ch->vertex(vertex_triple_index(i,2)));
+}
+
+template <class Gt, class Tds, class Lds>
+void
+Triangulation_3<Gt,Tds,Lds>::
+make_canonical(Vertex_triple& t) const
+{
+  int i = (t.first < t.second) ? 0 : 1;
+  if(i==0) {
+    i = (t.first < t.third) ? 0 : 2;
+  } else {
+    i = (t.second < t.third) ? 1 : 2;
+  }
+  Vertex_handle tmp;
+  switch(i){
+  case 0: return;
+  case 1:
+    tmp = t.first;
+    t.first = t.second;
+    t.second = t.third;
+    t.third = tmp;
+    return;
+  default:
+    tmp = t.first;
+    t.first = t.third;
+    t.third = t.second;
+    t.second = tmp;
+  }
+}
+
+template < class GT, class Tds, class Lds >
+bool
+Triangulation_3<GT,Tds,Lds>::
+test_dim_down(Vertex_handle v) const
+  // tests whether removing v decreases the dimension of the triangulation
+  // true iff
+  // v is incident to all finite cells/facets
+  // and all the other vertices are coplanar/collinear in dim3/2.
+{
+  CGAL_triangulation_precondition(dimension() >= 0);
+  CGAL_triangulation_precondition(! is_infinite(v) );
+
+  if (dimension() == 3) {
+      Finite_cells_iterator cit = finite_cells_begin();
+
+      int iv;
+      if ( ! cit->has_vertex(v,iv) )
+          return false;
+      const Point &p1=cit->vertex((iv+1)&3)->point();
+      const Point &p2=cit->vertex((iv+2)&3)->point();
+      const Point &p3=cit->vertex((iv+3)&3)->point();
+      ++cit;
+
+      for (; cit != finite_cells_end(); ++cit ) {
+          if ( ! cit->has_vertex(v,iv) )
+              return false;
+          for (int i=1; i<4; i++ )
+              if ( !coplanar(p1,p2,p3,cit->vertex((iv+i)&3)->point()) )
+                  return false;
+      }
+  }
+  else if (dimension() == 2)
+  {
+      Finite_facets_iterator cit = finite_facets_begin();
+
+      int iv;
+      if ( ! cit->first->has_vertex(v,iv) )
+          return false;
+      const Point &p1 = cit->first->vertex(cw(iv))->point();
+      const Point &p2 = cit->first->vertex(ccw(iv))->point();
+      ++cit;
+
+      for (; cit != finite_facets_end(); ++cit ) {
+          if ( ! cit->first->has_vertex(v,iv) )
+              return false;
+          if ( !collinear(p1, p2, cit->first->vertex(cw(iv))->point()) ||
+               !collinear(p1, p2, cit->first->vertex(ccw(iv))->point()) )
+              return false;
+      }
+  }
+  else // dimension() == 1 or 0
+      return number_of_vertices() == (size_type) dimension() + 1;
+
+  return true;
+}
+
+template < class GT, class Tds, class Lds >
+bool
+Triangulation_3<GT,Tds,Lds>::
+test_dim_down_using_incident_cells_3(
+  Vertex_handle v, std::vector<Cell_handle> &incident_cells,
+  std::vector<Vertex_handle> &adj_vertices,
+  bool *could_lock_zone) const
+{
+  CGAL_triangulation_precondition(dimension() == 3);
+  CGAL_triangulation_precondition(! is_infinite(v) );
+
+  // Collect all vertices on the boundary
+  // and all incident cells
+  if (could_lock_zone)
+  {
+    *could_lock_zone = try_lock_and_get_adjacent_vertices_and_cells_3(
+      v, std::back_inserter(adj_vertices), incident_cells);
+    if (*could_lock_zone == false)
+      return false;
+  }
+  else
+  {
+    adjacent_vertices_and_cells_3(
+      v, std::back_inserter(adj_vertices), incident_cells);
+  }
+
+  typedef Filter_iterator< typename std::vector<Vertex_handle>::const_iterator,
+                           Infinite_tester
+                         > Finite_vertex_iterator;
+  Finite_vertex_iterator vit(
+    adj_vertices.end(), Infinite_tester(this), adj_vertices.begin());
+  Finite_vertex_iterator vit_end(
+    adj_vertices.end(), Infinite_tester(this));
+  const Point &p1 = (*vit++)->point();
+  const Point &p2 = (*vit++)->point();
+  const Point &p3 = (*vit++)->point();
+
+  for ( ; vit != vit_end ; ++vit )
+  {
+          if (!coplanar(p1, p2, p3, (*vit)->point()))
+            return false;
+  }
+
+  for (typename std::vector<Cell_handle>::const_iterator it_inc_cell
+         = incident_cells.begin() ;
+       it_inc_cell != incident_cells.end() ;
+       ++it_inc_cell)
+  {
+    if (!is_infinite(*it_inc_cell))
+      return is_infinite(mirror_vertex(
+        *it_inc_cell, (*it_inc_cell)->index(v)));
+  }
+
+  return true;
+}
+
+template <class Gt, class Tds, class Lds>
+template < class VertexRemover >
+VertexRemover&
+Triangulation_3<Gt, Tds, Lds>::
+make_hole_2D(Vertex_handle v, std::list<Edge_2D> &hole, VertexRemover &remover)
+{
+  std::vector<Cell_handle> to_delete;
+  to_delete.reserve(32);
+
+  Face_circulator fc = tds().incident_faces(v);
+  Face_circulator done(fc);
+
+  // We prepare for deleting all interior cells.
+  // We ->set_cell() pointers to cells outside the hole.
+  // We push the Edges_2D of the boundary (seen from outside) in "hole".
+  do {
+    Cell_handle f = fc;
+    int i = f->index(v);
+    Cell_handle fn = f->neighbor(i);
+    int in = fn->index(f);
+
+    f->vertex(cw(i))->set_cell(fn);
+    fn->set_neighbor(in, Cell_handle());
+
+    hole.push_back(Edge_2D(fn, in));
+    remover.add_hidden_points(f);
+    to_delete.push_back(f);
+
+    ++fc;
+  } while (fc != done);
+
+  tds().delete_cells(to_delete.begin(), to_delete.end());
+  return remover;
+}
+
+// this one also erases a set of cells
+// which is useful to the move method
+// outputting newly created cells
+template <class Gt, class Tds, class Lds>
+template < class VertexRemover >
+VertexRemover&
+Triangulation_3<Gt, Tds, Lds>::
+make_hole_2D(Vertex_handle v, std::list<Edge_2D> &hole, VertexRemover &remover,
+             std::set<Cell_handle> &cells_set)
+{
+  std::vector<Cell_handle> to_delete;
+  to_delete.reserve(32);
+
+  Face_circulator fc = tds().incident_faces(v);
+  Face_circulator done(fc);
+
+  // We prepare for deleting all interior cells.
+  // We ->set_cell() pointers to cells outside the hole.
+  // We push the Edges_2D of the boundary (seen from outside) in "hole".
+  do {
+    Cell_handle f = fc;
+    int i = f->index(v);
+    Cell_handle fn = f->neighbor(i);
+    int in = fn->index(f);
+
+    f->vertex(cw(i))->set_cell(fn);
+    fn->set_neighbor(in, Cell_handle());
+
+    hole.push_back(Edge_2D(fn, in));
+    remover.add_hidden_points(f);
+    to_delete.push_back(f);
+
+    ++fc;
+  } while (fc != done);
+
+  for(typename std::vector<Cell_handle>::const_iterator ib = to_delete.begin(),
+        iend = to_delete.end(); ib != iend; ib++) cells_set.erase(*ib);
+
+  tds().delete_cells(to_delete.begin(), to_delete.end());
+  return remover;
+}
+
+template <class Gt, class Tds, class Lds>
+template < class VertexRemover >
+void
+Triangulation_3<Gt, Tds, Lds>::
+fill_hole_2D(std::list<Edge_2D> & first_hole, VertexRemover &remover)
+{
+  typedef std::list<Edge_2D> Hole;
+
+  std::vector<Hole> hole_list;
+
+  Cell_handle  f, ff, fn;
+  int i, ii, in;
+
+  hole_list.push_back(first_hole);
+
+  while( ! hole_list.empty())
+    {
+      Hole hole = hole_list.back();
+      hole_list.pop_back();
+
+      // if the hole has only three edges, create the triangle
+      if (hole.size() == 3) {
+        typename Hole::iterator hit = hole.begin();
+        f = (*hit).first;        i = (*hit).second;
+        ff = (* ++hit).first;    ii = (*hit).second;
+        fn = (* ++hit).first;    in = (*hit).second;
+        tds().create_face(f, i, ff, ii, fn, in);
+        continue;
+      }
+
+      // else find an edge with two finite vertices
+      // on the hole boundary
+      // and the new triangle adjacent to that edge
+      //  cut the hole and push it back
+
+      // first, ensure that a neighboring face
+      // whose vertices on the hole boundary are finite
+      // is the first of the hole
+      while (1) {
+        ff = (hole.front()).first;
+        ii = (hole.front()).second;
+        if ( is_infinite(ff->vertex(cw(ii))) ||
+             is_infinite(ff->vertex(ccw(ii)))) {
+          hole.push_back(hole.front());
+          hole.pop_front();
+        }
+        else
+            break;
+      }
+
+      // take the first neighboring face and pop it;
+      ff = (hole.front()).first;
+      ii = (hole.front()).second;
+      hole.pop_front();
+
+      Vertex_handle v0 = ff->vertex(cw(ii));
+      Vertex_handle v1 = ff->vertex(ccw(ii));
+      Vertex_handle v2 = infinite_vertex();
+      const Point &p0 = v0->point();
+      const Point &p1 = v1->point();
+      const Point *p2 = NULL; // Initialize to NULL to avoid warning.
+
+      typename Hole::iterator hdone = hole.end();
+      typename Hole::iterator hit = hole.begin();
+      typename Hole::iterator cut_after(hit);
+
+      // if tested vertex is c with respect to the vertex opposite
+      // to NULL neighbor,
+      // stop at the before last face;
+      hdone--;
+      for (; hit != hdone; ++hit) {
+        fn = hit->first;
+        in = hit->second;
+        Vertex_handle vv = fn->vertex(ccw(in));
+        if (is_infinite(vv)) {
+          if (is_infinite(v2))
+              cut_after = hit;
+        }
+        else {     // vv is a finite vertex
+          const Point &p = vv->point();
+          if (coplanar_orientation(p0, p1, p) == COUNTERCLOCKWISE) {
+            if (is_infinite(v2) ||
+                remover.side_of_bounded_circle(p0, p1, *p2, p, true)
+                  == ON_BOUNDED_SIDE) {
+                v2 = vv;
+                p2 = &p;
+                cut_after = hit;
+            }
+          }
+        }
+      }
+
+      // create new triangle and update adjacency relations
+      Cell_handle newf;
+
+      //update the hole and push back in the Hole_List stack
+      // if v2 belongs to the neighbor following or preceding *f
+      // the hole remain a single hole
+      // otherwise it is split in two holes
+
+      fn = (hole.front()).first;
+      in = (hole.front()).second;
+      if (fn->has_vertex(v2, i) && i == ccw(in)) {
+        newf = tds().create_face(ff, ii, fn, in);
+        hole.pop_front();
+        hole.push_front(Edge_2D(newf, 1));
+        hole_list.push_back(hole);
+      }
+      else{
+        fn = (hole.back()).first;
+        in = (hole.back()).second;
+        if (fn->has_vertex(v2, i) && i == cw(in)) {
+          newf = tds().create_face(fn, in, ff, ii);
+          hole.pop_back();
+          hole.push_back(Edge_2D(newf, 1));
+          hole_list.push_back(hole);
+        }
+        else{
+          // split the hole in two holes
+          newf = tds().create_face(ff, ii, v2);
+          Hole new_hole;
+          ++cut_after;
+          while( hole.begin() != cut_after )
+            {
+              new_hole.push_back(hole.front());
+              hole.pop_front();
+            }
+
+          hole.push_front(Edge_2D(newf, 1));
+          new_hole.push_front(Edge_2D(newf, 0));
+          hole_list.push_back(hole);
+          hole_list.push_back(new_hole);
+        }
+      }
+    }
+}
+
+template <class Gt, class Tds, class Lds>
+template < class VertexRemover, class OutputItCells >
+void
+Triangulation_3<Gt, Tds, Lds>::
+fill_hole_2D(std::list<Edge_2D> & first_hole, VertexRemover &remover,
+             OutputItCells fit)
+{
+  typedef std::list<Edge_2D> Hole;
+
+  std::vector<Hole> hole_list;
+
+  Cell_handle  f, ff, fn;
+  int i, ii, in;
+
+  hole_list.push_back(first_hole);
+
+  while( ! hole_list.empty())
+  {
+    Hole hole = hole_list.back();
+    hole_list.pop_back();
+
+    // if the hole has only three edges, create the triangle
+    if (hole.size() == 3) {
+      typename Hole::iterator hit = hole.begin();
+      f = (*hit).first;        i = (*hit).second;
+      ff = (* ++hit).first;    ii = (*hit).second;
+      fn = (* ++hit).first;    in = (*hit).second;
+      *fit++ = tds().create_face(f, i, ff, ii, fn, in);
+      continue;
+    }
+
+    // else find an edge with two finite vertices
+    // on the hole boundary
+    // and the new triangle adjacent to that edge
+    //  cut the hole and push it back
+
+    // first, ensure that a neighboring face
+    // whose vertices on the hole boundary are finite
+    // is the first of the hole
+    while (1) {
+      ff = (hole.front()).first;
+      ii = (hole.front()).second;
+      if ( is_infinite(ff->vertex(cw(ii))) ||
+           is_infinite(ff->vertex(ccw(ii)))) {
+        hole.push_back(hole.front());
+        hole.pop_front();
+      }
+      else
+        break;
+    }
+
+    // take the first neighboring face and pop it;
+    ff = (hole.front()).first;
+    ii = (hole.front()).second;
+    hole.pop_front();
+
+    Vertex_handle v0 = ff->vertex(cw(ii));
+    Vertex_handle v1 = ff->vertex(ccw(ii));
+    Vertex_handle v2 = infinite_vertex();
+    const Point &p0 = v0->point();
+    const Point &p1 = v1->point();
+    const Point *p2 = NULL; // Initialize to NULL to avoid warning.
+
+    typename Hole::iterator hdone = hole.end();
+    typename Hole::iterator hit = hole.begin();
+    typename Hole::iterator cut_after(hit);
+
+    // if tested vertex is c with respect to the vertex opposite
+    // to NULL neighbor,
+    // stop at the before last face;
+    hdone--;
+    for (; hit != hdone; ++hit) {
+      fn = hit->first;
+      in = hit->second;
+      Vertex_handle vv = fn->vertex(ccw(in));
+      if (is_infinite(vv)) {
+        if (is_infinite(v2))
+          cut_after = hit;
+      }
+      else {     // vv is a finite vertex
+        const Point &p = vv->point();
+        if (coplanar_orientation(p0, p1, p) == COUNTERCLOCKWISE) {
+          if (is_infinite(v2) ||
+              remover.side_of_bounded_circle(p0, p1, *p2, p, true)
+              == ON_BOUNDED_SIDE) {
+            v2 = vv;
+            p2 = &p;
+            cut_after = hit;
+          }
+        }
+      }
+    }
+
+    // create new triangle and update adjacency relations
+    Cell_handle newf;
+
+    //update the hole and push back in the Hole_List stack
+    // if v2 belongs to the neighbor following or preceding *f
+    // the hole remain a single hole
+    // otherwise it is split in two holes
+
+    fn = (hole.front()).first;
+    in = (hole.front()).second;
+    if (fn->has_vertex(v2, i) && i == ccw(in)) {
+      newf = tds().create_face(ff, ii, fn, in);
+      hole.pop_front();
+      hole.push_front(Edge_2D(newf, 1));
+      hole_list.push_back(hole);
+    } else {
+      fn = (hole.back()).first;
+      in = (hole.back()).second;
+      if (fn->has_vertex(v2, i) && i == cw(in)) {
+        newf = tds().create_face(fn, in, ff, ii);
+        hole.pop_back();
+        hole.push_back(Edge_2D(newf, 1));
+        hole_list.push_back(hole);
+      } else {
+        // split the hole in two holes
+        newf = tds().create_face(ff, ii, v2);
+        Hole new_hole;
+        ++cut_after;
+        while( hole.begin() != cut_after )
+        {
+          new_hole.push_back(hole.front());
+          hole.pop_front();
+        }
+        hole.push_front(Edge_2D(newf, 1));
+        new_hole.push_front(Edge_2D(newf, 0));
+        hole_list.push_back(hole);
+        hole_list.push_back(new_hole);
+      }
+    }
+
+    *fit++ = newf;
+
+  }
+}
+
+template <class Gt, class Tds, class Lds>
+void
+Triangulation_3<Gt,Tds,Lds>::
+make_hole_3D( Vertex_handle v,
+              Vertex_triple_Facet_map& outer_map,
+              std::vector<Cell_handle> & hole)
+{
+  CGAL_triangulation_expensive_precondition( ! test_dim_down(v) );
+
+  incident_cells(v, std::back_inserter(hole));
+
+  for (typename std::vector<Cell_handle>::iterator cit = hole.begin(),
+       end = hole.end(); cit != end; ++cit) {
+    int indv = (*cit)->index(v);
+    Cell_handle opp_cit = (*cit)->neighbor( indv );
+    Facet f(opp_cit, opp_cit->index(*cit));
+    Vertex_triple vt = make_vertex_triple(f);
+    make_canonical(vt);
+    outer_map[vt] = f;
+    for (int i=0; i<4; i++)
+      if ( i != indv )
+        (*cit)->vertex(i)->set_cell(opp_cit);
+  }
+}
+
+// When the incident cells are already known
+template <class Gt, class Tds, class Lds>
+void
+Triangulation_3<Gt,Tds,Lds>::
+make_hole_3D( Vertex_handle v,
+              const std::vector<Cell_handle> & incident_cells,
+              Vertex_triple_Facet_map& outer_map)
+{
+  CGAL_triangulation_expensive_precondition( ! test_dim_down(v) );
+
+  for (typename std::vector<Cell_handle>::const_iterator cit = incident_cells.begin(),
+       end = incident_cells.end(); cit != end; ++cit) {
+    int indv = (*cit)->index(v);
+    Cell_handle opp_cit = (*cit)->neighbor( indv );
+    Facet f(opp_cit, opp_cit->index(*cit));
+    Vertex_triple vt = make_vertex_triple(f);
+    make_canonical(vt);
+    outer_map[vt] = f;
+    for (int i=0; i<4; i++)
+      if ( i != indv )
+        (*cit)->vertex(i)->set_cell(opp_cit);
+  }
+}
+
+template <class Gt, class Tds, class Lds>
+template < class VertexRemover >
+VertexRemover&
+Triangulation_3<Gt,Tds,Lds>::
+remove_dim_down(Vertex_handle v, VertexRemover &remover)
+{
+    CGAL_triangulation_precondition (dimension() >= 0);
+
+    // Collect all the hidden points.
+    for (All_cells_iterator ci = tds().raw_cells_begin(),
+            end = tds().raw_cells_end(); ci != end; ++ci)
+        remover.add_hidden_points(ci);
+
+    tds().remove_decrease_dimension(v, infinite_vertex());
+
+    // Now try to see if we need to re-orient.
+    if (dimension() == 2) {
+        Facet f = *finite_facets_begin();
+        if (coplanar_orientation(f.first->vertex(0)->point(),
+                                 f.first->vertex(1)->point(),
+                                 f.first->vertex(2)->point()) == NEGATIVE)
+            tds().reorient();
+    }
+
+    return remover;
+}
+
+template <class Gt, class Tds, class Lds>
+template < class VertexRemover >
+VertexRemover&
+Triangulation_3<Gt,Tds,Lds>::
+remove_1D(Vertex_handle v, VertexRemover &remover)
+{
+    CGAL_triangulation_precondition (dimension() == 1);
+
+    Cell_handle c1 = v->cell();
+    Cell_handle c2 = c1->neighbor(c1->index(v) == 0 ? 1 : 0);
+    remover.add_hidden_points(c1);
+    remover.add_hidden_points(c2);
+
+    tds().remove_from_maximal_dimension_simplex (v);
+
+    return remover;
+}
+
+template <class Gt, class Tds, class Lds>
+template < class VertexRemover >
+VertexRemover&
+Triangulation_3<Gt,Tds,Lds>::
+remove_2D(Vertex_handle v, VertexRemover &remover)
+{
+    CGAL_triangulation_precondition(dimension() == 2);
+    std::list<Edge_2D> hole;
+    make_hole_2D(v, hole, remover);
+    fill_hole_2D(hole, remover);
+    tds().delete_vertex(v);
+    return remover;
+}
+
+template <class Gt, class Tds, class Lds>
+template < class VertexRemover >
+VertexRemover&
+Triangulation_3<Gt,Tds,Lds>::
+remove_3D(Vertex_handle v, VertexRemover &remover)
+{
+  std::vector<Cell_handle> hole;
+  hole.reserve(64);
+
+  // Construct the set of vertex triples on the boundary
+  // with the facet just behind
+  Vertex_triple_Facet_map outer_map;
+  Vertex_triple_Facet_map inner_map;
+
+  make_hole_3D(v, outer_map, hole);
+  CGAL_assertion(remover.hidden_points_begin() ==
+      remover.hidden_points_end() );
+
+  // Output the hidden points.
+  for (typename std::vector<Cell_handle>::iterator
+      hi = hole.begin(), hend = hole.end(); hi != hend; ++hi)
+    remover.add_hidden_points(*hi);
+
+  bool inf = false;
+  // collect all vertices on the boundary
+  std::vector<Vertex_handle> vertices;
+  vertices.reserve(64);
+
+  adjacent_vertices(v, std::back_inserter(vertices));
+
+  // create a Delaunay triangulation of the points on the boundary
+  // and make a map from the vertices in remover.tmp towards the vertices
+  // in *this
+
+  unsigned int i = 0;
+  Vertex_handle_unique_hash_map vmap;
+  Cell_handle ch = Cell_handle();
+#ifdef CGAL_TRIANGULATION_3_USE_THE_4_POINTS_CONSTRUCTOR
+  size_t num_vertices = vertices.size();
+  if (num_vertices >= 5)
+  {
+    //std::random_shuffle(vertices.begin(), vertices.end());
+    for (int j = 0 ; j < 4 ; ++j)
+    {
+      if (is_infinite(vertices[j]))
+      {
+        std::swap(vertices[j], vertices[4]);
+        break;
+      }
+    }
+    Orientation o = orientation(
+      vertices[0]->point(),
+      vertices[1]->point(),
+      vertices[2]->point(),
+      vertices[3]->point());
+
+    if (o == NEGATIVE)
+      std::swap(vertices[0], vertices[1]);
+
+    if (o != ZERO)
+    {
+      Vertex_handle vh1, vh2, vh3, vh4;
+      remover.tmp.init_tds(
+        vertices[0]->point(), vertices[1]->point(),
+        vertices[2]->point(), vertices[3]->point(),
+        vh1, vh2, vh3, vh4);
+      ch = vh1->cell();
+      vmap[vh1] = vertices[0];
+      vmap[vh2] = vertices[1];
+      vmap[vh3] = vertices[2];
+      vmap[vh4] = vertices[3];
+      i = 4;
+    }
+  }
+#endif
+
+  for(; i < vertices.size(); i++){
+    if(! is_infinite(vertices[i])){
+      Vertex_handle vh = remover.tmp.insert(vertices[i]->point(), ch);
+      ch = vh->cell();
+      vmap[vh] = vertices[i];
+    }else {
+      inf = true;
+    }
+  }
+
+  if(remover.tmp.dimension()==2){
+    Vertex_handle fake_inf = remover.tmp.insert(v->point());
+    vmap[fake_inf] = infinite_vertex();
+  } else {
+    vmap[remover.tmp.infinite_vertex()] = infinite_vertex();
+  }
+
+  CGAL_triangulation_assertion(remover.tmp.dimension() == 3);
+
+  // Construct the set of vertex triples of remover.tmp
+  // We reorient the vertex triple so that it matches those from outer_map
+  // Also note that we use the vertices of *this, not of remover.tmp
+
+  if(inf){
+    for(All_cells_iterator it = remover.tmp.all_cells_begin(),
+        end = remover.tmp.all_cells_end(); it != end; ++it){
+      for(i=0; i < 4; i++){
+        Facet f = std::pair<Cell_handle,int>(it,i);
+        Vertex_triple vt_aux = make_vertex_triple(f);
+        Vertex_triple vt(vmap[vt_aux.first],vmap[vt_aux.third],vmap[vt_aux.second]);
+        make_canonical(vt);
+        inner_map[vt]= f;
+      }
+    }
+  } else {
+      for(Finite_cells_iterator it = remover.tmp.finite_cells_begin(),
+        end = remover.tmp.finite_cells_end(); it != end; ++it){
+      for(i=0; i < 4; i++){
+        Facet f = std::pair<Cell_handle,int>(it,i);
+        Vertex_triple vt_aux = make_vertex_triple(f);
+        Vertex_triple vt(vmap[vt_aux.first],vmap[vt_aux.third],vmap[vt_aux.second]);
+        make_canonical(vt);
+        inner_map[vt]= f;
+      }
+    }
+  }
+  // Grow inside the hole, by extending the surface
+  while(! outer_map.empty()){
+    typename Vertex_triple_Facet_map::iterator oit = outer_map.begin();
+    while(is_infinite(oit->first.first) ||
+          is_infinite(oit->first.second) ||
+          is_infinite(oit->first.third)){
+      ++oit;
+      // otherwise the lookup in the inner_map fails
+      // because the infinite vertices are different
+    }
+    typename Vertex_triple_Facet_map::value_type o_vt_f_pair = *oit;
+    Cell_handle o_ch = o_vt_f_pair.second.first;
+    unsigned int o_i = o_vt_f_pair.second.second;
+
+    typename Vertex_triple_Facet_map::iterator iit =
+             inner_map.find(o_vt_f_pair.first);
+    CGAL_triangulation_assertion(iit != inner_map.end());
+    typename Vertex_triple_Facet_map::value_type i_vt_f_pair = *iit;
+    Cell_handle i_ch = i_vt_f_pair.second.first;
+    unsigned int i_i = i_vt_f_pair.second.second;
+
+    // create a new cell and glue it to the outer surface
+    Cell_handle new_ch = tds().create_cell();
+    new_ch->set_vertices(vmap[i_ch->vertex(0)], vmap[i_ch->vertex(1)],
+                         vmap[i_ch->vertex(2)], vmap[i_ch->vertex(3)]);
+
+    o_ch->set_neighbor(o_i,new_ch);
+    new_ch->set_neighbor(i_i, o_ch);
+
+    // for the other faces check, if they can also be glued
+    for(i = 0; i < 4; i++){
+      if(i != i_i){
+        Facet f = std::pair<Cell_handle,int>(new_ch,i);
+        Vertex_triple vt = make_vertex_triple(f);
+        make_canonical(vt);
+        std::swap(vt.second,vt.third);
+        typename Vertex_triple_Facet_map::iterator oit2 = outer_map.find(vt);
+        if(oit2 == outer_map.end()){
+          std::swap(vt.second,vt.third);
+          outer_map[vt]= f;
+        } else {
+          // glue the faces
+          typename Vertex_triple_Facet_map::value_type o_vt_f_pair2 = *oit2;
+          Cell_handle o_ch2 = o_vt_f_pair2.second.first;
+          int o_i2 = o_vt_f_pair2.second.second;
+          o_ch2->set_neighbor(o_i2,new_ch);
+          new_ch->set_neighbor(i, o_ch2);
+          outer_map.erase(oit2);
+        }
+      }
+    }
+    outer_map.erase(oit);
+  }
+  tds().delete_vertex(v);
+  tds().delete_cells(hole.begin(), hole.end());
+
+  return remover;
+}
+
+template <class Gt, class Tds, class Lds>
+template < class VertexRemover >
+VertexRemover&
+Triangulation_3<Gt,Tds,Lds>::
+remove_3D(Vertex_handle v, VertexRemover &remover,
+          const std::vector<Cell_handle> &inc_cells,
+          std::vector<Vertex_handle> &adj_vertices)
+{
+  // Construct the set of vertex triples on the boundary
+  // with the facet just behind
+  Vertex_triple_Facet_map outer_map;
+  Vertex_triple_Facet_map inner_map;
+
+  make_hole_3D(v, inc_cells, outer_map);
+
+  CGAL_assertion(remover.hidden_points_begin() ==
+      remover.hidden_points_end() );
+
+  // Output the hidden points.
+  for (typename std::vector<Cell_handle>::const_iterator
+      hi = inc_cells.begin(), hend = inc_cells.end(); hi != hend; ++hi)
+    remover.add_hidden_points(*hi);
+
+  bool inf = false;
+
+  // create a Delaunay triangulation of the points on the boundary
+  // and make a map from the vertices in remover.tmp towards the vertices
+  // in *this
+
+  unsigned int i = 0;
+  Vertex_handle_unique_hash_map vmap;
+  Cell_handle ch = Cell_handle();
+#ifdef CGAL_TRIANGULATION_3_USE_THE_4_POINTS_CONSTRUCTOR
+  size_t num_vertices = adj_vertices.size();
+  if (num_vertices >= 5)
+  {
+    //std::random_shuffle(adj_vertices.begin(), adj_vertices.end());
+    for (int j = 0 ; j < 4 ; ++j)
+    {
+      if (is_infinite(adj_vertices[j]))
+      {
+        std::swap(adj_vertices[j], adj_vertices[4]);
+        break;
+      }
+    }
+    Orientation o = orientation(
+      adj_vertices[0]->point(),
+      adj_vertices[1]->point(),
+      adj_vertices[2]->point(),
+      adj_vertices[3]->point());
+
+    if (o == NEGATIVE)
+      std::swap(adj_vertices[0], adj_vertices[1]);
+
+    if (o != ZERO)
+    {
+      Vertex_handle vh1, vh2, vh3, vh4;
+      remover.tmp.init_tds(
+        adj_vertices[0]->point(), adj_vertices[1]->point(),
+        adj_vertices[2]->point(), adj_vertices[3]->point(),
+        vh1, vh2, vh3, vh4);
+      ch = vh1->cell();
+      vmap[vh1] = adj_vertices[0];
+      vmap[vh2] = adj_vertices[1];
+      vmap[vh3] = adj_vertices[2];
+      vmap[vh4] = adj_vertices[3];
+      i = 4;
+    }
+  }
+#endif
+
+  for(; i < adj_vertices.size(); i++){
+    if(! is_infinite(adj_vertices[i])){
+      Vertex_handle vh = remover.tmp.insert(adj_vertices[i]->point(), ch);
+      ch = vh->cell();
+      vmap[vh] = adj_vertices[i];
+    }else {
+      inf = true;
+    }
+  }
+
+  if(remover.tmp.dimension()==2){
+    Vertex_handle fake_inf = remover.tmp.insert(v->point());
+    vmap[fake_inf] = infinite_vertex();
+  } else {
+    vmap[remover.tmp.infinite_vertex()] = infinite_vertex();
+  }
+
+  CGAL_triangulation_assertion(remover.tmp.dimension() == 3);
+
+  // Construct the set of vertex triples of remover.tmp
+  // We reorient the vertex triple so that it matches those from outer_map
+  // Also note that we use the vertices of *this, not of remover.tmp
+
+  if(inf){
+    for(All_cells_iterator it = remover.tmp.all_cells_begin(),
+        end = remover.tmp.all_cells_end(); it != end; ++it){
+      for(i=0; i < 4; i++){
+        Facet f = std::pair<Cell_handle,int>(it,i);
+        Vertex_triple vt_aux = make_vertex_triple(f);
+        Vertex_triple vt(vmap[vt_aux.first],vmap[vt_aux.third],vmap[vt_aux.second]);
+        make_canonical(vt);
+        inner_map[vt]= f;
+      }
+    }
+  } else {
+      for(Finite_cells_iterator it = remover.tmp.finite_cells_begin(),
+        end = remover.tmp.finite_cells_end(); it != end; ++it){
+      for(i=0; i < 4; i++){
+        Facet f = std::pair<Cell_handle,int>(it,i);
+        Vertex_triple vt_aux = make_vertex_triple(f);
+        Vertex_triple vt(vmap[vt_aux.first],vmap[vt_aux.third],vmap[vt_aux.second]);
+        make_canonical(vt);
+        inner_map[vt]= f;
+      }
+    }
+  }
+  // Grow inside the hole, by extending the surface
+  while(! outer_map.empty()){
+    typename Vertex_triple_Facet_map::iterator oit = outer_map.begin();
+    while(is_infinite(oit->first.first) ||
+          is_infinite(oit->first.second) ||
+          is_infinite(oit->first.third)){
+      ++oit;
+      // otherwise the lookup in the inner_map fails
+      // because the infinite vertices are different
+    }
+    typename Vertex_triple_Facet_map::value_type o_vt_f_pair = *oit;
+    Cell_handle o_ch = o_vt_f_pair.second.first;
+    unsigned int o_i = o_vt_f_pair.second.second;
+
+    typename Vertex_triple_Facet_map::iterator iit =
+             inner_map.find(o_vt_f_pair.first);
+    CGAL_triangulation_assertion(iit != inner_map.end());
+    typename Vertex_triple_Facet_map::value_type i_vt_f_pair = *iit;
+    Cell_handle i_ch = i_vt_f_pair.second.first;
+    unsigned int i_i = i_vt_f_pair.second.second;
+
+    // create a new cell and glue it to the outer surface
+    Cell_handle new_ch = tds().create_cell();
+    new_ch->set_vertices(vmap[i_ch->vertex(0)], vmap[i_ch->vertex(1)],
+                         vmap[i_ch->vertex(2)], vmap[i_ch->vertex(3)]);
+
+    o_ch->set_neighbor(o_i,new_ch);
+    new_ch->set_neighbor(i_i, o_ch);
+
+    // for the other faces check, if they can also be glued
+    for(i = 0; i < 4; i++){
+      if(i != i_i){
+        Facet f = std::pair<Cell_handle,int>(new_ch,i);
+        Vertex_triple vt = make_vertex_triple(f);
+        make_canonical(vt);
+        std::swap(vt.second,vt.third);
+        typename Vertex_triple_Facet_map::iterator oit2 = outer_map.find(vt);
+        if(oit2 == outer_map.end()){
+          std::swap(vt.second,vt.third);
+          outer_map[vt]= f;
+        } else {
+          // glue the faces
+          typename Vertex_triple_Facet_map::value_type o_vt_f_pair2 = *oit2;
+          Cell_handle o_ch2 = o_vt_f_pair2.second.first;
+          int o_i2 = o_vt_f_pair2.second.second;
+          o_ch2->set_neighbor(o_i2,new_ch);
+          new_ch->set_neighbor(i, o_ch2);
+          outer_map.erase(oit2);
+        }
+      }
+    }
+    outer_map.erase(oit);
+  }
+  tds().delete_vertex(v);
+  tds().delete_cells(inc_cells.begin(), inc_cells.end());
+
+  return remover;
+}
+
+template <class Gt, class Tds, class Lds>
+template < class VertexRemover >
+void
+Triangulation_3<Gt, Tds, Lds>::
+remove(Vertex_handle v, VertexRemover &remover) {
+  CGAL_triangulation_precondition( v != Vertex_handle());
+  CGAL_triangulation_precondition( !is_infinite(v));
+  CGAL_triangulation_expensive_precondition( tds().is_vertex(v) );
+
+  if (test_dim_down (v)) {
+    remove_dim_down (v, remover);
+  }
+  else {
+    switch (dimension()) {
+    case 1: remove_1D (v, remover); break;
+    case 2: remove_2D (v, remover); break;
+    case 3: remove_3D (v, remover); break;
+    default:
+      CGAL_triangulation_assertion (false);
+    }
+  }
+}
+
+template <class Gt, class Tds, class Lds>
+template < class VertexRemover >
+bool
+Triangulation_3<Gt, Tds, Lds>::
+remove(Vertex_handle v, VertexRemover &remover, bool *could_lock_zone)
+{
+  // N.B.: dimension doesn't need to be atomic since the parallel removal
+  //       will never decrease the dimension (the last few removes are done
+  //       sequentially)
+  CGAL_triangulation_precondition( v != Vertex_handle());
+  CGAL_triangulation_precondition( !is_infinite(v));
+  CGAL_triangulation_precondition( dimension() == 3);
+  CGAL_triangulation_expensive_precondition( tds().is_vertex(v) );
+
+#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
+  static Profile_branch_counter_3 bcounter(
+    "early withdrawals / late withdrawals / successes [Delaunay_tri_3::remove]");
+#endif
+
+  bool removed = true;
+
+  // Locking vertex v is a good start
+  if (!this->try_lock_vertex(v))
+  {
+    *could_lock_zone = false;
+#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
+    bcounter.increment_branch_2(); // THIS is an early withdrawal!
+#endif
+  }
+  else
+  {
+    std::vector<Cell_handle> incident_cells;
+    incident_cells.reserve(64);
+    std::vector<Vertex_handle> adj_vertices;
+    adj_vertices.reserve(64);
+    bool dim_down = test_dim_down_using_incident_cells_3(
+      v, incident_cells, adj_vertices, could_lock_zone);
+
+    if (*could_lock_zone)
+    {
+      if (dim_down)
+        removed = false;
+      else
+        remove_3D (v, remover, incident_cells, adj_vertices);
+    }
+  }
+
+#ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING
+  if (could_lock_zone)
+  {
+    if (*could_lock_zone)
+      ++bcounter;
+    else
+      bcounter.increment_branch_1(); // THIS is a late withdrawal!
+  }
+#endif
+
+  return removed;
+}
+
+// The remove here uses the remover, but
+// no function envolving hidden points
+// will be used in this internal version
+template <class Gt, class Tds, class Lds>
+template < class VertexRemover, class OutputItCells >
+VertexRemover&
+Triangulation_3<Gt, Tds, Lds>::
+remove_dim_down(Vertex_handle v, VertexRemover &remover, OutputItCells fit) {
+  remove_dim_down(v, remover);
+  for(All_cells_iterator afi = tds().raw_cells_begin();
+      afi != tds().raw_cells_end();
+      afi++) *fit++ = afi;
+  return remover;
+}
+
+template <class Gt, class Tds, class Lds>
+template < class VertexRemover, class OutputItCells >
+VertexRemover&
+Triangulation_3<Gt, Tds, Lds>::
+remove_1D(Vertex_handle v, VertexRemover &remover, OutputItCells fit) {
+  Point p = v->point();
+  remove_1D(v, remover);
+  *fit++ = locate(p);
+  return remover;
+}
+
+template <class Gt, class Tds, class Lds>
+template < class VertexRemover, class OutputItCells >
+VertexRemover&
+Triangulation_3<Gt, Tds, Lds>::
+remove_2D(Vertex_handle v, VertexRemover &remover, OutputItCells fit) {
+  CGAL_triangulation_precondition(dimension() == 2);
+  std::list<Edge_2D> hole;
+  make_hole_2D(v, hole, remover);
+  fill_hole_2D(hole, remover, fit);
+  tds().delete_vertex(v);
+  return remover;
+}
+
+template <class Gt, class Tds, class Lds>
+template < class VertexRemover, class OutputItCells >
+VertexRemover&
+Triangulation_3<Gt, Tds, Lds>::
+remove_3D(Vertex_handle v, VertexRemover &remover, OutputItCells fit) {
+  CGAL_triangulation_precondition(dimension() == 3);
+
+  std::vector<Cell_handle> hole;
+  hole.reserve(64);
+
+  // Construct the set of vertex triples on the boundary
+  // with the facet just behind
+  Vertex_triple_Facet_map outer_map;
+  Vertex_triple_Facet_map inner_map;
+
+  make_hole_3D(v, outer_map, hole);
+
+  CGAL_assertion(remover.hidden_points_begin() ==
+                 remover.hidden_points_end() );
+
+  // Output the hidden points.
+  for (typename std::vector<Cell_handle>::iterator
+         hi = hole.begin(), hend = hole.end(); hi != hend; ++hi)
+    remover.add_hidden_points(*hi);
+
+  bool inf = false;
+  unsigned int i;
+  // collect all vertices on the boundary
+  std::vector<Vertex_handle> vertices;
+  vertices.reserve(64);
+
+  adjacent_vertices(v, std::back_inserter(vertices));
+
+  // create a Delaunay triangulation of the points on the boundary
+  // and make a map from the vertices in remover.tmp towards the vertices
+  // in *this
+
+  Vertex_handle_unique_hash_map vmap;
+  Cell_handle ch = Cell_handle();
+  for(i=0; i < vertices.size(); i++){
+    if(! is_infinite(vertices[i])){
+      Vertex_handle vh = remover.tmp.insert(vertices[i]->point(), ch);
+      ch = vh->cell();
+      vmap[vh] = vertices[i];
+    }else {
+      inf = true;
+    }
+  }
+
+  if(remover.tmp.dimension()==2){
+    Vertex_handle fake_inf = remover.tmp.insert(v->point());
+    vmap[fake_inf] = infinite_vertex();
+  } else {
+    vmap[remover.tmp.infinite_vertex()] = infinite_vertex();
+  }
+
+  CGAL_triangulation_assertion(remover.tmp.dimension() == 3);
+
+  // Construct the set of vertex triples of remover.tmp
+  // We reorient the vertex triple so that it matches those from outer_map
+  // Also note that we use the vertices of *this, not of remover.tmp
+
+  if(inf){
+    for(All_cells_iterator it = remover.tmp.all_cells_begin(),
+          end = remover.tmp.all_cells_end(); it != end; ++it)
+    {
+      for(i=0; i < 4; i++){
+        Facet f = std::pair<Cell_handle,int>(it,i);
+        Vertex_triple vt_aux = make_vertex_triple(f);
+        Vertex_triple vt(vmap[vt_aux.first],vmap[vt_aux.third],vmap[vt_aux.second]);
+        make_canonical(vt);
+        inner_map[vt]= f;
+      }
+    }
+  } else {
+    for(Finite_cells_iterator it = remover.tmp.finite_cells_begin(),
+        end = remover.tmp.finite_cells_end(); it != end; ++it)
+    {
+      for(i=0; i < 4; i++){
+        Facet f = std::pair<Cell_handle,int>(it,i);
+        Vertex_triple vt_aux = make_vertex_triple(f);
+        Vertex_triple vt(vmap[vt_aux.first],vmap[vt_aux.third],vmap[vt_aux.second]);
+        make_canonical(vt);
+        inner_map[vt]= f;
+      }
+    }
+  }
+  // Grow inside the hole, by extending the surface
+  while(! outer_map.empty()){
+    typename Vertex_triple_Facet_map::iterator oit = outer_map.begin();
+    while(is_infinite(oit->first.first) ||
+          is_infinite(oit->first.second) ||
+          is_infinite(oit->first.third)){
+      ++oit;
+      // otherwise the lookup in the inner_map fails
+      // because the infinite vertices are different
+    }
+    typename Vertex_triple_Facet_map::value_type o_vt_f_pair = *oit;
+    Cell_handle o_ch = o_vt_f_pair.second.first;
+    unsigned int o_i = o_vt_f_pair.second.second;
+
+    typename Vertex_triple_Facet_map::iterator iit =
+             inner_map.find(o_vt_f_pair.first);
+    CGAL_triangulation_assertion(iit != inner_map.end());
+    typename Vertex_triple_Facet_map::value_type i_vt_f_pair = *iit;
+    Cell_handle i_ch = i_vt_f_pair.second.first;
+    unsigned int i_i = i_vt_f_pair.second.second;
+
+    // create a new cell and glue it to the outer surface
+    Cell_handle new_ch = tds().create_cell();
+                *fit++ = new_ch;
+
+    new_ch->set_vertices(vmap[i_ch->vertex(0)], vmap[i_ch->vertex(1)],
+                         vmap[i_ch->vertex(2)], vmap[i_ch->vertex(3)]);
+
+    o_ch->set_neighbor(o_i,new_ch);
+    new_ch->set_neighbor(i_i, o_ch);
+
+    // for the other faces check, if they can also be glued
+    for(i = 0; i < 4; i++){
+      if(i != i_i){
+        Facet f = std::pair<Cell_handle,int>(new_ch,i);
+        Vertex_triple vt = make_vertex_triple(f);
+        make_canonical(vt);
+        std::swap(vt.second,vt.third);
+        typename Vertex_triple_Facet_map::iterator oit2 = outer_map.find(vt);
+        if(oit2 == outer_map.end()){
+          std::swap(vt.second,vt.third);
+          outer_map[vt]= f;
+        } else {
+          // glue the faces
+          typename Vertex_triple_Facet_map::value_type o_vt_f_pair2 = *oit2;
+          Cell_handle o_ch2 = o_vt_f_pair2.second.first;
+          int o_i2 = o_vt_f_pair2.second.second;
+          o_ch2->set_neighbor(o_i2,new_ch);
+          new_ch->set_neighbor(i, o_ch2);
+          outer_map.erase(oit2);
+        }
+      }
+    }
+    outer_map.erase(oit);
+  }
+  tds().delete_vertex(v);
+  tds().delete_cells(hole.begin(), hole.end());
+
+  return remover;
+}
+
+
+template <class Gt, class Tds, class Lds>
+template < class VertexRemover, class OutputItCells >
+void
+Triangulation_3<Gt, Tds, Lds>::
+remove_and_give_new_cells(Vertex_handle v, VertexRemover &remover,
+  OutputItCells fit) {
+  CGAL_triangulation_precondition( v != Vertex_handle());
+  CGAL_triangulation_precondition( !is_infinite(v));
+  CGAL_triangulation_expensive_precondition( tds().is_vertex(v) );
+
+  if (test_dim_down (v)) {
+    remove_dim_down (v, remover, fit);
+  }
+  else {
+    switch (dimension()) {
+    case 1: remove_1D (v, remover, fit); break;
+    case 2: remove_2D (v, remover, fit); break;
+    case 3: remove_3D (v, remover, fit); break;
+    default:
+      CGAL_triangulation_assertion (false);
+    }
+  }
+}
+
+// The VertexInserter is needed so as to
+// allow us the usage of the insertion method
+// from the particular triangulation
+template <class Gt, class Tds, class Lds>
+template < class VertexRemover, class VertexInserter >
+typename Triangulation_3<Gt,Tds,Lds>::Vertex_handle
+Triangulation_3<Gt,Tds,Lds>::
+move_if_no_collision(Vertex_handle v, const Point &p,
+                     VertexRemover &remover, VertexInserter &inserter) {
+  CGAL_assertion(remover.hidden_points_begin() ==
+                 remover.hidden_points_end() );
+  CGAL_triangulation_precondition(!is_infinite(v));
+  if(v->point() == p) return v;
+  const int dim = dimension();
+
+  // If displacements are known to be small
+  // we might want to optimize by checking
+  // whether there is a topological change
+  // or not before.
+  // In this version this will not be put inside this method
+  // because it is for general purposes,
+  // and remaining Delaunay after motion is a bit too restrictive.
+  // In the filtered version optimized for displacements
+  // it will be used as an a priori.
+  // However, a non-fully optimized but good version of
+  // is_delaunay_after_displacement is provided as an internal method of
+  // Delaunay_triangulation_3 (see the class for more details).
+
+  Locate_type lt;
+  int li, lj;
+  Cell_handle loc = locate(p, lt, li, lj, v->cell());
+
+  if(lt == VERTEX) return loc->vertex(li);
+
+  if(dim == 0) {
+    v->set_point(p);
+    return v;
+  }
+
+  size_type n_vertices = tds().number_of_vertices();
+
+  if((lt == OUTSIDE_AFFINE_HULL) && (dim == 1) && (n_vertices == 3)) {
+    v->set_point(p);
+    return v;
+  }
+
+  if((lt == OUTSIDE_AFFINE_HULL) && (dim == 2) && (n_vertices == 4)) {
+    v->set_point(p);
+    return v;
+  }
+
+  if((lt != OUTSIDE_AFFINE_HULL) && (dim == 1)) {
+
+    if(loc->has_vertex(v)) {
+      v->set_point(p);
+    } else {
+      Vertex_handle inserted = insert(p, lt, loc, li, lj);
+      Cell_handle f = v->cell();
+      int i = f->index(v);
+      if (i==0) {f = f->neighbor(1);}
+      CGAL_triangulation_assertion(f->index(v) == 1);
+      Cell_handle g= f->neighbor(0);
+      f->set_vertex(1, g->vertex(1));
+      f->set_neighbor(0,g->neighbor(0));
+      g->neighbor(0)->set_neighbor(1,f);
+      g->vertex(1)->set_cell(f);
+      tds().delete_cell(g);
+      Cell_handle f_ins = inserted->cell();
+      i = f_ins->index(inserted);
+      if (i==0) {f_ins = f_ins->neighbor(1);}
+      CGAL_triangulation_assertion(f_ins->index(inserted) == 1);
+      Cell_handle g_ins = f_ins->neighbor(0);
+      f_ins->set_vertex(1, v);
+      g_ins->set_vertex(0, v);
+      v->set_point(p);
+      v->set_cell(inserted->cell());
+      tds().delete_vertex(inserted);
+    }
+    return v;
+  }
+
+  bool dim_down = test_dim_down(v);
+
+  if((lt != OUTSIDE_AFFINE_HULL) && dim_down && (dim == 2)) {
+    // verify if p and two static vertices are collinear in this case
+    int iinf;
+    Cell_handle finf = infinite_vertex()->cell(), fdone;
+    fdone = finf;
+    do {
+      iinf = finf->index(infinite_vertex());
+      if(!finf->has_vertex(v)) break;
+      finf = finf->neighbor((iinf+1)%3);
+    } while(finf != fdone);
+    iinf = ~iinf;
+    if(this->collinear(finf->vertex(iinf&1)->point(),
+                       finf->vertex(iinf&2)->point(),
+                       p))
+    {
+      v->set_point(p);
+      _tds.decrease_dimension(loc, loc->index(v));
+      return v;
+    }
+  }
+
+  if(((dim == 2) && (lt != OUTSIDE_AFFINE_HULL)) ||
+     ((lt == OUTSIDE_AFFINE_HULL) && (dim == 1)))
+  {
+
+    // This is insert must be from Delaunay (or the particular trian.)
+    // not Triangulation_3 !
+    Vertex_handle inserted = inserter.insert(p, lt, loc, li, lj);
+
+    std::list<Edge_2D> hole;
+    make_hole_2D(v, hole, remover);
+    fill_hole_2D(hole, remover);
+
+    // fixing pointer
+    Cell_handle fc = inserted->cell(), done(fc);
+    std::vector<Cell_handle> faces_pt;
+    faces_pt.reserve(16);
+    do {
+      faces_pt.push_back(fc);
+      fc = fc->neighbor((fc->index(inserted) + 1)%3);
+    } while(fc != done);
+    std::size_t ss = faces_pt.size();
+    for(std::size_t k=0; k<ss; k++)
+    {
+      Cell_handle f = faces_pt[k];
+      int i = f->index(inserted);
+      f->set_vertex(i, v);
+    }
+    v->set_point(p);
+    v->set_cell(inserted->cell());
+
+    tds().delete_vertex(inserted);
+
+    return v;
+  }
+
+  if((lt != OUTSIDE_AFFINE_HULL) && dim_down && (dim == 3)) {
+    // verify if p and two static vertices are collinear in this case
+    std::vector<Cell_handle> ics;
+    incident_cells(infinite_vertex(), std::back_inserter(ics));
+    std::size_t size = ics.size();
+    Cell_handle finf;
+    for (std::size_t i=0; i<size; i++) {
+      finf = ics[i];
+      if(!finf->has_vertex(v)) break;
+    }
+    int iinf = finf->index(infinite_vertex());
+    if(remover.tmp.coplanar(finf->vertex((iinf+1)&3)->point(),
+                            finf->vertex((iinf+2)&3)->point(),
+                            finf->vertex((iinf+3)&3)->point(),
+                            p))
+    {
+      v->set_point(p);
+      _tds.decrease_dimension(loc, loc->index(v));
+      Facet f = *finite_facets_begin();
+      if (coplanar_orientation(f.first->vertex(0)->point(),
+                               f.first->vertex(1)->point(),
+                               f.first->vertex(2)->point()) == NEGATIVE)
+        tds().reorient();
+      restore_edges_after_decrease_dimension(v, remover,inserter);
+      return v;
+    }
+  }
+
+  // This is insert must be from Delaunay (or the particular trian.)
+  // not Triangulation_3 !
+  Vertex_handle inserted = inserter.insert(p, lt, loc, li, lj);
+
+  std::vector<Cell_handle> hole;
+  hole.reserve(64);
+
+  // Construct the set of vertex triples on the boundary
+  // with the facet just behind
+  Vertex_triple_Facet_map outer_map;
+  Vertex_triple_Facet_map inner_map;
+
+  make_hole_3D(v, outer_map, hole);
+
+  CGAL_assertion(remover.hidden_points_begin() ==
+                 remover.hidden_points_end() );
+
+  // Output the hidden points.
+  for (typename std::vector<Cell_handle>::iterator
+         hi = hole.begin(), hend = hole.end(); hi != hend; ++hi)
+    remover.add_hidden_points(*hi);
+
+  bool inf = false;
+  unsigned int i;
+  // collect all vertices on the boundary
+  std::vector<Vertex_handle> vertices;
+  vertices.reserve(64);
+
+  adjacent_vertices(v, std::back_inserter(vertices));
+
+  // create a Delaunay triangulation of the points on the boundary
+  // and make a map from the vertices in remover.tmp towards the vertices
+  // in *this
+
+  Vertex_handle_unique_hash_map vmap;
+  Cell_handle ch = Cell_handle();
+  for(i=0; i < vertices.size(); i++){
+    if(! is_infinite(vertices[i])){
+      Vertex_handle vh = remover.tmp.insert(vertices[i]->point(), ch);
+      ch = vh->cell();
+      vmap[vh] = vertices[i];
+    }else {
+      inf = true;
+    }
+  }
+
+  if(remover.tmp.dimension()==2){
+    Vertex_handle fake_inf = remover.tmp.insert(v->point());
+    vmap[fake_inf] = infinite_vertex();
+  } else {
+    vmap[remover.tmp.infinite_vertex()] = infinite_vertex();
+  }
+
+  CGAL_triangulation_assertion(remover.tmp.dimension() == 3);
+
+  // Construct the set of vertex triples of remover.tmp
+  // We reorient the vertex triple so that it matches those from outer_map
+  // Also note that we use the vertices of *this, not of remover.tmp
+
+  if(inf){
+    for(All_cells_iterator it = remover.tmp.all_cells_begin(),
+          end = remover.tmp.all_cells_end(); it != end; ++it){
+      for(i=0; i < 4; i++){
+        Facet f = std::pair<Cell_handle,int>(it,i);
+        Vertex_triple vt_aux = make_vertex_triple(f);
+        Vertex_triple vt(vmap[vt_aux.first],vmap[vt_aux.third],vmap[vt_aux.second]);
+        make_canonical(vt);
+        inner_map[vt]= f;
+      }
+    }
+  } else {
+    for(Finite_cells_iterator it = remover.tmp.finite_cells_begin(),
+          end = remover.tmp.finite_cells_end(); it != end; ++it){
+      for(i=0; i < 4; i++){
+        Facet f = std::pair<Cell_handle,int>(it,i);
+        Vertex_triple vt_aux = make_vertex_triple(f);
+        Vertex_triple vt(vmap[vt_aux.first],vmap[vt_aux.third],vmap[vt_aux.second]);
+        make_canonical(vt);
+        inner_map[vt]= f;
+      }
+    }
+  }
+  // Grow inside the hole, by extending the surface
+  while(! outer_map.empty()){
+    typename Vertex_triple_Facet_map::iterator oit = outer_map.begin();
+    while(is_infinite(oit->first.first) ||
+          is_infinite(oit->first.second) ||
+          is_infinite(oit->first.third)){
+      ++oit;
+      // otherwise the lookup in the inner_map fails
+      // because the infinite vertices are different
+    }
+    typename Vertex_triple_Facet_map::value_type o_vt_f_pair = *oit;
+    Cell_handle o_ch = o_vt_f_pair.second.first;
+    unsigned int o_i = o_vt_f_pair.second.second;
+
+    typename Vertex_triple_Facet_map::iterator iit =
+      inner_map.find(o_vt_f_pair.first);
+    CGAL_triangulation_assertion(iit != inner_map.end());
+    typename Vertex_triple_Facet_map::value_type i_vt_f_pair = *iit;
+    Cell_handle i_ch = i_vt_f_pair.second.first;
+    unsigned int i_i = i_vt_f_pair.second.second;
+
+    // create a new cell and glue it to the outer surface
+    Cell_handle new_ch = tds().create_cell();
+
+    new_ch->set_vertices(vmap[i_ch->vertex(0)], vmap[i_ch->vertex(1)],
+                         vmap[i_ch->vertex(2)], vmap[i_ch->vertex(3)]);
+
+    o_ch->set_neighbor(o_i,new_ch);
+    new_ch->set_neighbor(i_i, o_ch);
+
+    // for the other faces check, if they can also be glued
+    for(i = 0; i < 4; i++){
+      if(i != i_i){
+        Facet f = std::pair<Cell_handle,int>(new_ch,i);
+        Vertex_triple vt = make_vertex_triple(f);
+        make_canonical(vt);
+        std::swap(vt.second,vt.third);
+        typename Vertex_triple_Facet_map::iterator oit2 = outer_map.find(vt);
+        if(oit2 == outer_map.end()){
+          std::swap(vt.second,vt.third);
+          outer_map[vt]= f;
+        } else {
+          // glue the faces
+          typename Vertex_triple_Facet_map::value_type o_vt_f_pair2 = *oit2;
+          Cell_handle o_ch2 = o_vt_f_pair2.second.first;
+          int o_i2 = o_vt_f_pair2.second.second;
+          o_ch2->set_neighbor(o_i2,new_ch);
+          new_ch->set_neighbor(i, o_ch2);
+          outer_map.erase(oit2);
+        }
+      }
+    }
+    outer_map.erase(oit);
+  }
+
+  // fixing pointer
+  std::vector<Cell_handle> cells_pt;
+  cells_pt.reserve(64);
+  incident_cells(inserted, std::back_inserter(cells_pt));
+  std::size_t size = cells_pt.size();
+  for(std::size_t i=0; i<size; i++) {
+    Cell_handle c = cells_pt[i];
+    c->set_vertex(c->index(inserted), v);
+  }
+  v->set_point(p);
+  v->set_cell(inserted->cell());
+  tds().delete_vertex(inserted);
+  tds().delete_cells(hole.begin(), hole.end());
+  return v;
+} // end of Vertex_handle
+  // Triangulation_3<Gt,Tds,Lds>::
+  // move_if_no_collision(Vertex_handle,Point, VertexRemover, VertexInserter)
+
+template <class Gt, class Tds, class Lds>
+template < class VertexRemover, class VertexInserter >
+typename Triangulation_3<Gt,Tds,Lds>::Vertex_handle
+Triangulation_3<Gt,Tds,Lds>::
+move(Vertex_handle v, const Point &p,
+     VertexRemover &remover, VertexInserter &inserter) {
+  CGAL_assertion(remover.hidden_points_begin() ==
+                 remover.hidden_points_end() );
+  CGAL_triangulation_precondition(!is_infinite(v));
+  if(v->point() == p) return v;
+  Vertex_handle w = move_if_no_collision(v,p,remover,inserter);
+  if(w != v) {
+    remove(v, remover);
+    return w;
+  }
+  return v;
+}
+
+// The VertexInserter is needed so as to
+// allow us the usage of the insertion method
+// from the particular triangulation
+template <class Gt, class Tds, class Lds>
+template < class VertexRemover, class VertexInserter, class OutputItCells >
+typename Triangulation_3<Gt,Tds,Lds>::Vertex_handle
+Triangulation_3<Gt,Tds,Lds>::
+move_if_no_collision_and_give_new_cells(Vertex_handle v, const Point &p,
+                                        VertexRemover &remover, VertexInserter &inserter, OutputItCells fit) {
+  CGAL_assertion(remover.hidden_points_begin() ==
+                 remover.hidden_points_end() );
+  CGAL_triangulation_precondition(!is_infinite(v));
+  if(v->point() == p) return v;
+  const int dim = dimension();
+
+  // If displacements are known to be small
+  // we might want to optimize by checking
+  // whether there is a topological change
+  // or not before.
+  // In this version this will not be put inside this method
+  // because it is for general purposes,
+  // and remaining Delaunay after motion is a bit too restrictive.
+  // In the filtered version optimized for displacements
+  // it will be used as an a priori.
+  // However, a non-fully optimized but good version of
+  // is_delaunay_after_displacement is provided as an internal method of
+  // Delaunay_triangulation_3 (see the class for more details).
+
+  Locate_type lt;
+  int li, lj;
+  Cell_handle loc = locate(p, lt, li, lj, v->cell());
+
+  if(lt == VERTEX) return loc->vertex(li);
+
+  if(dim == 0) {
+    v->set_point(p);
+    return v;
+  }
+
+  int n_vertices = tds().number_of_vertices();
+
+  if((lt == OUTSIDE_AFFINE_HULL) && (dim == 1) && (n_vertices == 3)) {
+    v->set_point(p);
+    for(All_cells_iterator afi = tds().raw_cells_begin();
+        afi != tds().raw_cells_end();
+        afi++) *fit++ = afi;
+    return v;
+  }
+
+  if((lt == OUTSIDE_AFFINE_HULL) && (dim == 2) && (n_vertices == 4)) {
+    v->set_point(p);
+    for(All_cells_iterator afi = tds().raw_cells_begin();
+        afi != tds().raw_cells_end();
+        afi++) *fit++ = afi;
+    return v;
+  }
+
+  if((lt != OUTSIDE_AFFINE_HULL) && (dim == 1)) {
+    if(loc->has_vertex(v)) {
+      v->set_point(p);
+    } else {
+      Vertex_handle inserted = insert(p, lt, loc, li, lj);
+      Cell_handle f = v->cell();
+      int i = f->index(v);
+      if (i==0) {f = f->neighbor(1);}
+      CGAL_triangulation_assertion(f->index(v) == 1);
+      Cell_handle g= f->neighbor(0);
+      f->set_vertex(1, g->vertex(1));
+      f->set_neighbor(0,g->neighbor(0));
+      g->neighbor(0)->set_neighbor(1,f);
+      g->vertex(1)->set_cell(f);
+      tds().delete_cell(g);
+      *fit++ = f;
+      Cell_handle f_ins = inserted->cell();
+      i = f_ins->index(inserted);
+      if (i==0) {f_ins = f_ins->neighbor(1);}
+      CGAL_triangulation_assertion(f_ins->index(inserted) == 1);
+      Cell_handle g_ins = f_ins->neighbor(0);
+      f_ins->set_vertex(1, v);
+      g_ins->set_vertex(0, v);
+      v->set_point(p);
+      v->set_cell(inserted->cell());
+      tds().delete_vertex(inserted);
+    }
+    *fit++ = v->cell();
+    if(v->cell()->neighbor(0)->has_vertex(v))
+      *fit++ = v->cell()->neighbor(0);
+    if(v->cell()->neighbor(1)->has_vertex(v))
+      *fit++ = v->cell()->neighbor(1);
+    return v;
+  }
+
+  bool dim_down = test_dim_down(v);
+
+  if((lt != OUTSIDE_AFFINE_HULL) && dim_down && (dim == 2)) {
+    // verify if p and two static vertices are collinear in this case
+    int iinf;
+    Cell_handle finf = infinite_vertex()->cell(), fdone;
+    fdone = finf;
+    do {
+      iinf = finf->index(infinite_vertex());
+      if(!finf->has_vertex(v)) break;
+      finf = finf->neighbor((iinf+1)%3);
+    } while(finf != fdone);
+    iinf = ~iinf;
+    if(this->collinear(finf->vertex(iinf&1)->point(),
+                       finf->vertex(iinf&2)->point(),
+                       p))
+    {
+      v->set_point(p);
+      _tds.decrease_dimension(loc, loc->index(v));
+      for(All_cells_iterator afi = tds().raw_cells_begin();
+          afi != tds().raw_cells_end();
+          afi++) *fit++ = afi;
+      return v;
+    }
+  }
+
+  if(((dim == 2) && (lt != OUTSIDE_AFFINE_HULL)) ||
+     ((lt == OUTSIDE_AFFINE_HULL) && (dim == 1)))
+  {
+
+    std::set<Cell_handle> cells_set;
+    // This is insert must be from Delaunay (or the particular trian.)
+    // not Triangulation_3 !
+    Vertex_handle inserted = inserter.insert(p, lt, loc, li, lj);
+    Cell_handle c = inserted->cell(), end = c;
+    do {
+      cells_set.insert(c);
+      int i = c->index(inserted);
+      c = c->neighbor((i+1)%3);
+    }	while(c != end);
+
+    std::list<Edge_2D> hole;
+    make_hole_2D(v, hole, remover, cells_set);
+    fill_hole_2D(hole, remover, fit);
+
+    // fixing pointer
+    Cell_handle fc = inserted->cell(), done(fc);
+    std::vector<Cell_handle> faces_pt;
+    faces_pt.reserve(16);
+    do {
+      faces_pt.push_back(fc);
+      fc = fc->neighbor((fc->index(inserted) + 1)%3);
+    } while(fc != done);
+    int ss = faces_pt.size();
+    for(int k=0; k<ss; k++)
+    {
+      Cell_handle f = faces_pt[k];
+      int i = f->index(inserted);
+      f->set_vertex(i, v);
+    }
+    v->set_point(p);
+    v->set_cell(inserted->cell());
+
+    tds().delete_vertex(inserted);
+
+    for(typename std::set<Cell_handle>::const_iterator ib = cells_set.begin(),
+          iend = cells_set.end(); ib != iend; ib++) *fit++ = *ib;
+
+    return v;
+  }
+
+  if((lt != OUTSIDE_AFFINE_HULL) && dim_down && (dim == 3)) {
+    // verify if p and two static vertices are collinear in this case
+    std::vector<Cell_handle> ics;
+    incident_cells(infinite_vertex(), std::back_inserter(ics));
+    int size = ics.size();
+    Cell_handle finf;
+    for (int i=0; i<size; i++) {
+      finf = ics[i];
+      if(!finf->has_vertex(v)) break;
+    }
+    int iinf = finf->index(infinite_vertex());
+    if(remover.tmp.coplanar(finf->vertex((iinf+1)&3)->point(),
+                            finf->vertex((iinf+2)&3)->point(),
+                            finf->vertex((iinf+3)&3)->point(),
+                            p))
+    {
+      v->set_point(p);
+      _tds.decrease_dimension(loc, loc->index(v));
+      Facet f = *finite_facets_begin();
+      if (coplanar_orientation(f.first->vertex(0)->point(),
+                               f.first->vertex(1)->point(),
+                               f.first->vertex(2)->point()) == NEGATIVE)
+        tds().reorient();
+      restore_edges_after_decrease_dimension(v, remover,inserter);
+      for(All_cells_iterator afi = tds().raw_cells_begin();
+          afi != tds().raw_cells_end();
+          afi++) *fit++ = afi;
+      return v;
+    }
+  }
+
+  std::set<Cell_handle> cells_set;
+
+  // This is insert must be from Delaunay (or the particular trian.)
+  // not Triangulation_3 !
+  Vertex_handle inserted = inserter.insert(p, lt, loc, li, lj);
+
+  std::vector<Cell_handle> cells_tmp;
+  cells_tmp.reserve(64);
+  incident_cells(inserted, std::back_inserter(cells_tmp));
+  int size = cells_tmp.size();
+  for(int i=0; i<size; i++) {
+    cells_set.insert(cells_tmp[i]);
+  }
+
+  std::vector<Cell_handle> hole;
+  hole.reserve(64);
+
+  // Construct the set of vertex triples on the boundary
+  // with the facet just behind
+  Vertex_triple_Facet_map outer_map;
+  Vertex_triple_Facet_map inner_map;
+
+  make_hole_3D(v, outer_map, hole);
+
+  for(typename std::vector<Cell_handle>::const_iterator ib = hole.begin(),
+        iend = hole.end(); ib != iend; ib++) cells_set.erase(*ib);
+
+  CGAL_assertion(remover.hidden_points_begin() ==
+                 remover.hidden_points_end() );
+
+  // Output the hidden points.
+  for (typename std::vector<Cell_handle>::iterator
+         hi = hole.begin(), hend = hole.end(); hi != hend; ++hi)
+    remover.add_hidden_points(*hi);
+
+  bool inf = false;
+  unsigned int i;
+  // collect all vertices on the boundary
+  std::vector<Vertex_handle> vertices;
+  vertices.reserve(64);
+
+  adjacent_vertices(v, std::back_inserter(vertices));
+
+  // create a Delaunay triangulation of the points on the boundary
+  // and make a map from the vertices in remover.tmp towards the vertices
+  // in *this
+
+  Vertex_handle_unique_hash_map vmap;
+  Cell_handle ch = Cell_handle();
+  for(i=0; i < vertices.size(); i++){
+    if(! is_infinite(vertices[i])){
+      Vertex_handle vh = remover.tmp.insert(vertices[i]->point(), ch);
+      ch = vh->cell();
+      vmap[vh] = vertices[i];
+    }else {
+      inf = true;
+    }
+  }
+
+  if(remover.tmp.dimension()==2){
+    Vertex_handle fake_inf = remover.tmp.insert(v->point());
+    vmap[fake_inf] = infinite_vertex();
+  } else {
+    vmap[remover.tmp.infinite_vertex()] = infinite_vertex();
+  }
+
+  CGAL_triangulation_assertion(remover.tmp.dimension() == 3);
+
+  // Construct the set of vertex triples of remover.tmp
+  // We reorient the vertex triple so that it matches those from outer_map
+  // Also note that we use the vertices of *this, not of remover.tmp
+
+  if(inf){
+    for(All_cells_iterator it = remover.tmp.all_cells_begin(),
+          end = remover.tmp.all_cells_end(); it != end; ++it){
+      for(i=0; i < 4; i++){
+        Facet f = std::pair<Cell_handle,int>(it,i);
+        Vertex_triple vt_aux = make_vertex_triple(f);
+        Vertex_triple vt(vmap[vt_aux.first],vmap[vt_aux.third],vmap[vt_aux.second]);
+        make_canonical(vt);
+        inner_map[vt]= f;
+      }
+    }
+  } else {
+    for(Finite_cells_iterator it = remover.tmp.finite_cells_begin(),
+          end = remover.tmp.finite_cells_end(); it != end; ++it){
+      for(i=0; i < 4; i++){
+        Facet f = std::pair<Cell_handle,int>(it,i);
+        Vertex_triple vt_aux = make_vertex_triple(f);
+        Vertex_triple vt(vmap[vt_aux.first],vmap[vt_aux.third],vmap[vt_aux.second]);
+        make_canonical(vt);
+        inner_map[vt]= f;
+      }
+    }
+  }
+  // Grow inside the hole, by extending the surface
+  while(! outer_map.empty()){
+    typename Vertex_triple_Facet_map::iterator oit = outer_map.begin();
+    while(is_infinite(oit->first.first) ||
+          is_infinite(oit->first.second) ||
+          is_infinite(oit->first.third)){
+      ++oit;
+      // otherwise the lookup in the inner_map fails
+      // because the infinite vertices are different
+    }
+    typename Vertex_triple_Facet_map::value_type o_vt_f_pair = *oit;
+    Cell_handle o_ch = o_vt_f_pair.second.first;
+    unsigned int o_i = o_vt_f_pair.second.second;
+
+    typename Vertex_triple_Facet_map::iterator iit =
+      inner_map.find(o_vt_f_pair.first);
+    CGAL_triangulation_assertion(iit != inner_map.end());
+    typename Vertex_triple_Facet_map::value_type i_vt_f_pair = *iit;
+    Cell_handle i_ch = i_vt_f_pair.second.first;
+    unsigned int i_i = i_vt_f_pair.second.second;
+
+    // create a new cell and glue it to the outer surface
+    Cell_handle new_ch = tds().create_cell();
+    *fit++ = new_ch;
+
+    new_ch->set_vertices(vmap[i_ch->vertex(0)], vmap[i_ch->vertex(1)],
+                         vmap[i_ch->vertex(2)], vmap[i_ch->vertex(3)]);
+
+    o_ch->set_neighbor(o_i,new_ch);
+    new_ch->set_neighbor(i_i, o_ch);
+
+    // for the other faces check, if they can also be glued
+    for(i = 0; i < 4; i++){
+      if(i != i_i){
+        Facet f = std::pair<Cell_handle,int>(new_ch,i);
+        Vertex_triple vt = make_vertex_triple(f);
+        make_canonical(vt);
+        std::swap(vt.second,vt.third);
+        typename Vertex_triple_Facet_map::iterator oit2 = outer_map.find(vt);
+        if(oit2 == outer_map.end()){
+          std::swap(vt.second,vt.third);
+          outer_map[vt]= f;
+        } else {
+          // glue the faces
+          typename Vertex_triple_Facet_map::value_type o_vt_f_pair2 = *oit2;
+          Cell_handle o_ch2 = o_vt_f_pair2.second.first;
+          int o_i2 = o_vt_f_pair2.second.second;
+          o_ch2->set_neighbor(o_i2,new_ch);
+          new_ch->set_neighbor(i, o_ch2);
+          outer_map.erase(oit2);
+        }
+      }
+    }
+    outer_map.erase(oit);
+  }
+
+  // fixing pointer
+  std::vector<Cell_handle> cells_pt;
+  cells_pt.reserve(64);
+  incident_cells(inserted, std::back_inserter(cells_pt));
+  size = cells_pt.size();
+  for(int i=0; i<size; i++) {
+    Cell_handle c = cells_pt[i];
+    c->set_vertex(c->index(inserted), v);
+  }
+  v->set_point(p);
+  v->set_cell(inserted->cell());
+  tds().delete_vertex(inserted);
+  tds().delete_cells(hole.begin(), hole.end());
+
+  for(typename std::set<Cell_handle>::const_iterator ib = cells_set.begin(),
+        iend = cells_set.end(); ib != iend; ib++) *fit++ = *ib;
+  return v;
+}
+
+template <class Gt, class Tds, class Lds>
+void
+Triangulation_3<Gt,Tds,Lds>::
+_make_big_hole_3D( Vertex_handle v,
+                   std::map<Vertex_triple,Facet>& outer_map,
+                   std::vector<Cell_handle> & hole,
+                   std::vector<Vertex_handle> & vertices,
+                   std::map<Vertex_handle, REMOVE_VERTEX_STATE> &vstates)
+{
+
+  Cell_handle start = v->cell();
+  start->tds_data().mark_processed();
+  hole.push_back(start);
+  std::size_t i=0, n=1;
+  while(i < n)
+  {
+
+    Cell_handle c = hole[i++];
+
+    for(int k=0; k<4; k++)
+    {
+      Vertex_handle v0 = c->vertex(k);
+
+      const REMOVE_VERTEX_STATE vst = vstates[v0];
+
+      if(vst == CLEAR)
+      {
+        vstates[v0] = EXTREMITY;
+        vertices.push_back(v0);
+      }	else if(vst == TO_REMOVE) {
+        // we mark the vertices, so all the vertices
+        // from the same cluster will be skipped
+        // in the remove_cluster_3D function
+        vstates[v0] = PROCESSED;
+      }
+
+      int i1 = vertex_triple_index(k, 0);
+      int i2 = vertex_triple_index(k, 1);
+      int i3 = vertex_triple_index(k, 2);
+
+      Vertex_handle v1 = c->vertex(i1);
+      Vertex_handle v2 = c->vertex(i2);
+      Vertex_handle v3 = c->vertex(i3);
+
+      Cell_handle opp_cit = c->neighbor(k);
+      int opp_i = tds().mirror_index(c,k);
+      Vertex_handle vm = opp_cit->vertex(opp_i);
+
+      bool pb1 = false, pb2 = false, pb3 = false, pbm = false;
+
+      const REMOVE_VERTEX_STATE vst1 = vstates[v1];
+      pb1 = vst1 == TO_REMOVE || vst1 == PROCESSED;
+
+      if(!pb1) {
+        const REMOVE_VERTEX_STATE vst2 = vstates[v2];
+        pb2 = vst2 == TO_REMOVE || vst2 == PROCESSED;
+
+        if(!pb2) {
+          const REMOVE_VERTEX_STATE vst3 = vstates[v3];
+          pb3 = vst3 == TO_REMOVE || vst3 == PROCESSED;
+
+          if(!pb3) {
+            const REMOVE_VERTEX_STATE vstm = vstates[vm];
+            pbm = vstm == TO_REMOVE || vstm == PROCESSED;
+          }
+
+        }
+
+      }
+
+      bool bad_opposite_cell = pb1 || pb2 || pb3 || pbm;
+
+      // update the hole if needed
+      // when the vertex is not to be removed
+      if(bad_opposite_cell)
+      {
+        if(opp_cit->tds_data().is_clear())
+        {
+          hole.push_back(opp_cit);
+          opp_cit->tds_data().mark_processed();
+          n++;
+        }
+        continue;
+      }
+
+      Facet f(opp_cit, opp_i);
+      Vertex_triple vt = make_vertex_triple(f);
+      make_canonical(vt);
+      outer_map[vt] = f;
+      v1->set_cell(opp_cit);
+      v2->set_cell(opp_cit);
+      v3->set_cell(opp_cit);
+      vm->set_cell(opp_cit);
+
+    }
+  }
+
+  std::size_t vsize = vertices.size();
+  for(std::size_t i=0; i<vsize; i++) vstates[vertices[i]] = CLEAR;
+
+}
+
+
+template <class Gt, class Tds, class Lds>
+template < class InputIterator, class VertexRemover >
+bool
+Triangulation_3<Gt, Tds, Lds>::
+_remove_cluster_3D(InputIterator first, InputIterator beyond, VertexRemover &remover,
+                   std::map<Vertex_handle, REMOVE_VERTEX_STATE> &vstates) {
+  InputIterator init = first;
+  while(first != beyond)
+  {
+    Vertex_handle v = *first++;
+
+    if(vstates[v] == PROCESSED) continue;
+
+    //  _make_big_hole_3D and we fill the hole for each cluster
+    vstates[v] = PROCESSED;
+
+    // here, we make the hole for the cluster with v inside
+    typedef std::map<Vertex_triple,Facet> Vertex_triple_Facet_map;
+    std::vector<Cell_handle> hole;
+    std::vector<Vertex_handle> vertices;
+    hole.reserve(64);
+    vertices.reserve(32);
+    Vertex_triple_Facet_map outer_map;
+    _make_big_hole_3D(v, outer_map, hole, vertices, vstates);
+
+    // the connectivity is totally lost, we need to rebuild
+    if(!outer_map.size())
+    {
+      std::size_t nh = hole.size();
+      for(std::size_t i=0; i<nh; i++) hole[i]->tds_data().clear();
+      return false;
+    }
+
+    std::size_t vsi = vertices.size();
+
+    bool inf = false;
+    std::size_t i;
+    Vertex_handle_unique_hash_map vmap;
+    Cell_handle ch = Cell_handle();
+
+    if(vsi > 100)
+    {
+      // spatial sort if too many points
+      std::vector<Point> vps;
+      std::map<Point, Vertex_handle> mp_vps;
+      for(i=0; i<vsi;i++)
+      {
+        Vertex_handle vv = vertices[i];
+        if(! this->is_infinite(vv)) {
+          vps.push_back(vv->point());
+          mp_vps[vv->point()] = vv;
+        } else inf = true;
+      }
+      spatial_sort(vps.begin(), vps.end());
+
+      std::size_t svps = vps.size();
+
+      for(i=0; i < svps; i++){
+        Vertex_handle vv = mp_vps[vps[i]];
+        Vertex_handle vh = remover.tmp.insert(vv->point(), ch);
+        ch = vh->cell();
+        vmap[vh] = vv;
+      }
+
+      if(remover.tmp.dimension()==2){
+        Vertex_handle fake_inf = remover.tmp.insert(v->point());
+        vmap[fake_inf] = this->infinite_vertex();
+      } else {
+        vmap[remover.tmp.infinite_vertex()] = this->infinite_vertex();
+      }
+    } else {
+
+      for(i=0; i < vsi; i++){
+        if(!this->is_infinite(vertices[i])){
+          Vertex_handle vh = remover.tmp.insert(vertices[i]->point(), ch);
+          ch = vh->cell();
+          vmap[vh] = vertices[i];
+        } else {
+          inf = true;
+        }
+      }
+
+      if(remover.tmp.dimension()==2){
+        Vertex_handle fake_inf = remover.tmp.insert(v->point());
+        vmap[fake_inf] = this->infinite_vertex();
+      } else {
+        vmap[remover.tmp.infinite_vertex()] = this->infinite_vertex();
+      }
+    }
+
+    Vertex_triple_Facet_map inner_map;
+
+    if(inf){
+      for(All_cells_iterator it = remover.tmp.all_cells_begin(),
+            end = remover.tmp.all_cells_end(); it != end; ++it){
+        for(unsigned int index=0; index < 4; index++) {
+          Facet f = std::pair<Cell_handle,int>(it,index);
+          Vertex_triple vt_aux = this->make_vertex_triple(f);
+          Vertex_triple vt(vmap[vt_aux.first],vmap[vt_aux.third],vmap[vt_aux.second]);
+          this->make_canonical(vt);
+          inner_map[vt]= f;
+        }
+      }
+    } else {
+      for(Finite_cells_iterator it = remover.tmp.finite_cells_begin(),
+            end = remover.tmp.finite_cells_end(); it != end; ++it){
+        for(unsigned int index=0; index < 4; index++){
+          Facet f = std::pair<Cell_handle,int>(it,index);
+          Vertex_triple vt_aux = this->make_vertex_triple(f);
+          Vertex_triple vt(vmap[vt_aux.first],vmap[vt_aux.third],vmap[vt_aux.second]);
+          this->make_canonical(vt);
+          inner_map[vt]= f;
+        }
+      }
+    }
+
+    // Grow inside the hole, by extending the surface
+    while(! outer_map.empty()){
+      typename Vertex_triple_Facet_map::iterator oit = outer_map.begin();
+
+      while(this->is_infinite(oit->first.first) ||
+            this->is_infinite(oit->first.second) ||
+            this->is_infinite(oit->first.third)){
+        ++oit;
+        // otherwise the lookup in the inner_map fails
+        // because the infinite vertices are different
+      }
+      typename Vertex_triple_Facet_map::value_type o_vt_f_pair = *oit;
+      Cell_handle o_ch = o_vt_f_pair.second.first;
+      unsigned int o_i = o_vt_f_pair.second.second;
+
+      typename Vertex_triple_Facet_map::iterator iit =
+        inner_map.find(o_vt_f_pair.first);
+      CGAL_triangulation_assertion(iit != inner_map.end());
+      typename Vertex_triple_Facet_map::value_type i_vt_f_pair = *iit;
+      Cell_handle i_ch = i_vt_f_pair.second.first;
+      unsigned int i_i = i_vt_f_pair.second.second;
+
+      // create a new cell and glue it to the outer surface
+      Cell_handle new_ch = tds().create_cell();
+      new_ch->set_vertices(vmap[i_ch->vertex(0)], vmap[i_ch->vertex(1)],
+                           vmap[i_ch->vertex(2)], vmap[i_ch->vertex(3)]);
+
+      o_ch->set_neighbor(o_i,new_ch);
+      new_ch->set_neighbor(i_i, o_ch);
+
+      for(int j=0;j<4;j++) new_ch->vertex(j)->set_cell(new_ch);
+
+      // for the other faces check, if they can also be glued
+      for(unsigned int index = 0; index < 4; index++){
+        if(index != i_i){
+          Facet f = std::pair<Cell_handle,int>(new_ch,index);
+          Vertex_triple vt = this->make_vertex_triple(f);
+          this->make_canonical(vt);
+          std::swap(vt.second,vt.third);
+          typename Vertex_triple_Facet_map::iterator oit2 = outer_map.find(vt);
+          if(oit2 == outer_map.end()){
+            std::swap(vt.second,vt.third);
+            outer_map[vt]= f;
+          } else {
+            // glue the faces
+            typename Vertex_triple_Facet_map::value_type o_vt_f_pair2 = *oit2;
+            Cell_handle o_ch2 = o_vt_f_pair2.second.first;
+            int o_i2 = o_vt_f_pair2.second.second;
+            o_ch2->set_neighbor(o_i2,new_ch);
+            new_ch->set_neighbor(index, o_ch2);
+            outer_map.erase(oit2);
+          }
+        }
+      }
+
+      outer_map.erase(oit);
+    }
+
+    this->tds().delete_cells(hole.begin(), hole.end());
+    remover.tmp.clear();
+
+  }
+
+  this->tds().delete_vertices(init, beyond);
+
+  return true;
+}
+
+template <class Gt, class Tds, class Lds>
+template < class InputIterator >
+bool
+Triangulation_3<Gt, Tds, Lds>::
+does_repeat_in_range(InputIterator first, InputIterator beyond) const {
+  std::set<Vertex_handle> s;
+  while (first!=beyond) if (! s.insert(*first++).second ) return true;
+  return false;
+}
+
+template <class Gt, class Tds, class Lds>
+template < class InputIterator >
+bool
+Triangulation_3<Gt, Tds, Lds>::
+infinite_vertex_in_range(InputIterator first, InputIterator beyond) const {
+  while(first != beyond) if(is_infinite(*first++)) return true;
+  return false;
+}
+
+template <class Gt, class Tds, class Lds>
+template < class InputIterator, class VertexRemover >
+typename Triangulation_3<Gt, Tds, Lds>::size_type
+Triangulation_3<Gt, Tds, Lds>::
+remove(InputIterator first, InputIterator beyond, VertexRemover &remover) {
+  CGAL_triangulation_precondition(!does_repeat_in_range(first, beyond));
+  CGAL_triangulation_precondition(!infinite_vertex_in_range(first, beyond));
+  size_type n = number_of_vertices();
+  InputIterator init = first, init2 = first;
+  if(dimension() == 3 && n > 4)
+  {
+    // If we could add states on a vertex base as it is done
+    // for cells, it would improve the performance.
+    std::map<Vertex_handle, REMOVE_VERTEX_STATE> vstates;
+    _mark_vertices_to_remove(first, beyond, vstates);
+    if(!_test_dim_down_cluster(vstates))
+    {
+      if(_remove_cluster_3D(init, beyond, remover, vstates))
+        return n - number_of_vertices();
+    }
+  }
+
+  // dimension() < 3 or
+  // no connectivity of the remaining vertices
+  // we remove one by one
+  while (init2 != beyond) {
+    Vertex_handle v = *init2++;
+    remover.tmp.clear();
+    remove(v, remover);
+  }
+  return n - number_of_vertices();
+}
+
+template < class GT, class Tds, class Lds >
+bool
+Triangulation_3<GT,Tds,Lds>::
+is_valid(bool verbose, int level) const
+{
+  if ( ! _tds.is_valid(verbose,level) ) {
+    if (verbose)
+        std::cerr << "invalid data structure" << std::endl;
+    CGAL_triangulation_assertion(false);
+    return false;
+  }
+
+  if ( infinite_vertex() == Vertex_handle() ) {
+    if (verbose)
+        std::cerr << "no infinite vertex" << std::endl;
+    CGAL_triangulation_assertion(false);
+    return false;
+  }
+
+  switch ( dimension() ) {
+  case 3:
+    {
+      for(Finite_cells_iterator it = finite_cells_begin(), end = finite_cells_end();
+              it != end; ++it)
+        is_valid_finite(it, verbose, level);
+      break;
+    }
+  case 2:
+    {
+      for(Finite_facets_iterator it = finite_facets_begin(), end = finite_facets_end();
+             it != end; ++it)
+        is_valid_finite(it->first,verbose,level);
+      break;
+    }
+  case 1:
+    {
+      for(Finite_edges_iterator it = finite_edges_begin(), end = finite_edges_end();
+             it != end; ++it)
+        is_valid_finite(it->first,verbose,level);
+      break;
+    }
+  }
+  if (verbose)
+      std::cerr << "valid triangulation" << std::endl;
+  return true;
+}
+
+template < class GT, class Tds, class Lds >
+bool
+Triangulation_3<GT,Tds,Lds>::
+is_valid(Cell_handle c, bool verbose, int level) const
+{
+  if ( ! _tds.is_valid(c,verbose,level) ) {
+    if (verbose) {
+      std::cerr << "combinatorially invalid cell";
+      for (int i=0; i <= dimension(); i++ )
+        std::cerr << c->vertex(i)->point() << ", ";
+      std::cerr << std::endl;
+    }
+    CGAL_triangulation_assertion(false);
+    return false;
+  }
+  if ( ! is_infinite(c) )
+    is_valid_finite(c, verbose, level);
+  if (verbose)
+      std::cerr << "geometrically valid cell" << std::endl;
+  return true;
+}
+
+
+template < class GT, class Tds, class Lds >
+bool
+Triangulation_3<GT,Tds,Lds>::
+is_valid_finite(Cell_handle c, bool verbose, int) const
+{
+  switch ( dimension() ) {
+  case 3:
+    {
+      if ( orientation(c->vertex(0)->point(),
+                       c->vertex(1)->point(),
+                       c->vertex(2)->point(),
+                       c->vertex(3)->point()) != POSITIVE ) {
+        if (verbose)
+            std::cerr << "badly oriented cell "
+                      << c->vertex(0)->point() << ", "
+                      << c->vertex(1)->point() << ", "
+                      << c->vertex(2)->point() << ", "
+                      << c->vertex(3)->point() << std::endl;
+        CGAL_triangulation_assertion(false);
+        return false;
+      }
+      break;
+    }
+  case 2:
+    {
+        if (coplanar_orientation(c->vertex(0)->point(),
+                                 c->vertex(1)->point(),
+                                 c->vertex(2)->point()) != POSITIVE) {
+          if (verbose)
+              std::cerr << "badly oriented face "
+                        << c->vertex(0)->point() << ", "
+                        << c->vertex(1)->point() << ", "
+                        << c->vertex(2)->point() << std::endl;
+          CGAL_triangulation_assertion(false);
+          return false;
+        }
+      break;
+    }
+  case 1:
+    {
+      const Point & p0 = c->vertex(0)->point();
+      const Point & p1 = c->vertex(1)->point();
+
+      Vertex_handle v = c->neighbor(0)->vertex(c->neighbor(0)->index(c));
+      if ( ! is_infinite(v) )
+      {
+        if ( collinear_position(p0, p1, v->point()) != MIDDLE ) {
+          if (verbose)
+              std::cerr << "badly oriented edge "
+                        << p0 << ", " << p1 << std::endl
+                        << "with neighbor 0"
+                        << c->neighbor(0)->vertex(1-c->neighbor(0)->index(c))
+                                         ->point()
+                        << ", " << v->point() << std::endl;
+          CGAL_triangulation_assertion(false);
+          return false;
+        }
+      }
+
+      v = c->neighbor(1)->vertex(c->neighbor(1)->index(c));
+      if ( ! is_infinite(v) )
+      {
+        if ( collinear_position(p1, p0, v->point()) != MIDDLE ) {
+          if (verbose)
+              std::cerr << "badly oriented edge "
+                        << p0 << ", " << p1 << std::endl
+                        << "with neighbor 1"
+                        << c->neighbor(1)->vertex(1-c->neighbor(1)->index(c))
+                                         ->point()
+                        << ", " << v->point() << std::endl;
+          CGAL_triangulation_assertion(false);
+          return false;
+        }
+      }
+      break;
+    }
+  }
+  return true;
+}
+
+
+namespace internal {
+
+// Internal function used by operator==.
+template < class GT, class Tds1, class Tds2, class Lds >
+bool
+test_next(const Triangulation_3<GT, Tds1, Lds> &t1,
+          const Triangulation_3<GT, Tds2, Lds> &t2,
+          typename Triangulation_3<GT, Tds1, Lds>::Cell_handle c1,
+          typename Triangulation_3<GT, Tds2, Lds>::Cell_handle c2,
+          std::map<typename Triangulation_3<GT, Tds1, Lds>::Cell_handle,
+                   typename Triangulation_3<GT, Tds2, Lds>::Cell_handle> &Cmap,
+          std::map<typename Triangulation_3<GT, Tds1, Lds>::Vertex_handle,
+                   typename Triangulation_3<GT, Tds2, Lds>::Vertex_handle> &Vmap)
+{
+
+    // This function tests and registers the 4 neighbors of c1/c2,
+    // and recursively calls itself over them.
+    // We don't use the call stack as it may overflow
+    // Returns false if an inequality has been found.
+
+    // Precondition: c1, c2 have been registered as well as their 4 vertices.
+    CGAL_triangulation_precondition(t1.dimension() >= 2);
+    CGAL_triangulation_precondition(Cmap[c1] == c2);
+    CGAL_triangulation_precondition(Vmap.find(c1->vertex(0)) != Vmap.end());
+    CGAL_triangulation_precondition(Vmap.find(c1->vertex(1)) != Vmap.end());
+    CGAL_triangulation_precondition(Vmap.find(c1->vertex(2)) != Vmap.end());
+    CGAL_triangulation_precondition(t1.dimension() == 2 ||
+                                    Vmap.find(c1->vertex(3)) != Vmap.end());
+
+    typedef Triangulation_3<GT, Tds1, Lds> Tr1;
+    typedef Triangulation_3<GT, Tds2, Lds> Tr2;
+    typedef typename Tr1::Vertex_handle  Vertex_handle1;
+    typedef typename Tr1::Cell_handle    Cell_handle1;
+    typedef typename Tr2::Vertex_handle  Vertex_handle2;
+    typedef typename Tr2::Cell_handle    Cell_handle2;
+    typedef typename std::map<Cell_handle1, Cell_handle2>::const_iterator  Cit;
+    typedef typename std::map<Vertex_handle1,
+                              Vertex_handle2>::const_iterator Vit;
+
+    std::vector<std::pair<Cell_handle1, Cell_handle2> > cell_stack;
+    cell_stack.push_back(std::make_pair(c1, c2));
+
+    while(! cell_stack.empty()){
+
+      Cell_handle1 c1 = cell_stack.back().first;
+      Cell_handle2 c2 = cell_stack.back().second;
+      cell_stack.pop_back();
+
+      for (int i=0; i <= t1.dimension(); ++i) {
+        Cell_handle1 n1 = c1->neighbor(i);
+        Cit cit = Cmap.find(n1);
+        Vertex_handle1 v1 = c1->vertex(i);
+        Vertex_handle2 v2 = Vmap[v1];
+        Cell_handle2 n2 = c2->neighbor(c2->index(v2));
+        if (cit != Cmap.end()) {
+          // n1 was already registered.
+          if (cit->second != n2)
+              return false;
+          continue;
+        }
+        // n1 has not yet been registered.
+        // We check that the new vertices match geometrically.
+        // And we register them.
+        Vertex_handle1 vn1 = n1->vertex(n1->index(c1));
+        Vertex_handle2 vn2 = n2->vertex(n2->index(c2));
+        Vit vit = Vmap.find(vn1);
+        if (vit != Vmap.end()) {
+          // vn1 already registered
+          if (vit->second != vn2)
+            return false;
+        }
+        else {
+          if (t2.is_infinite(vn2))
+            return false; // vn1 can't be infinite,
+          // since it would have been registered.
+          if (t1.geom_traits().compare_xyz_3_object()(vn1->point(),
+                                                      vn2->point()) != 0)
+            return false;
+          // We register vn1/vn2.
+          Vmap.insert(std::make_pair(vn1, vn2));
+        }
+
+        // We register n1/n2.
+        Cmap.insert(std::make_pair(n1, n2));
+        cell_stack.push_back(std::make_pair(n1, n2));
+      }
+    }
+
+    return true;
+}
+
+} // namespace internal
+
+
+template < class GT, class Tds1, class Tds2, class Lds >
+bool
+operator==(const Triangulation_3<GT, Tds1, Lds> &t1,
+           const Triangulation_3<GT, Tds2, Lds> &t2)
+{
+    typedef typename Triangulation_3<GT, Tds1>::Vertex_handle Vertex_handle1;
+    typedef typename Triangulation_3<GT, Tds1>::Cell_handle   Cell_handle1;
+    typedef typename Triangulation_3<GT, Tds2>::Vertex_handle Vertex_handle2;
+    typedef typename Triangulation_3<GT, Tds2>::Cell_handle   Cell_handle2;
+
+    typedef typename Triangulation_3<GT, Tds1>::Point                       Point;
+    typedef typename Triangulation_3<GT, Tds1>::Geom_traits::Equal_3        Equal_3;
+    typedef typename Triangulation_3<GT, Tds1>::Geom_traits::Compare_xyz_3  Compare_xyz_3;
+
+    Equal_3 equal = t1.geom_traits().equal_3_object();
+    Compare_xyz_3 cmp1 = t1.geom_traits().compare_xyz_3_object();
+    Compare_xyz_3 cmp2 = t2.geom_traits().compare_xyz_3_object();
+
+    // Some quick checks.
+    if (t1.dimension() != t2.dimension()
+        || t1.number_of_vertices() != t2.number_of_vertices()
+        || t1.number_of_cells() != t2.number_of_cells())
+        return false;
+
+    int dim = t1.dimension();
+    // Special case for dimension < 1.
+    // The triangulation is uniquely defined in these cases.
+    if (dim < 1)
+        return true;
+
+    // Special case for dimension == 1.
+    if (dim == 1) {
+        // It's enough to test that the points are the same,
+        // since the triangulation is uniquely defined in this case.
+        using namespace boost;
+        std::vector<Point> V1 (t1.points_begin(), t1.points_end());
+        std::vector<Point> V2 (t2.points_begin(), t2.points_end());
+        std::sort(V1.begin(), V1.end(), boost::bind(cmp1, _1, _2) == NEGATIVE);
+        std::sort(V2.begin(), V2.end(), boost::bind(cmp2, _1, _2) == NEGATIVE);
+        return V1 == V2;
+    }
+
+    // We will store the mapping between the 2 triangulations vertices and
+    // cells in 2 maps.
+    std::map<Vertex_handle1, Vertex_handle2> Vmap;
+    std::map<Cell_handle1, Cell_handle2> Cmap;
+
+    // Handle the infinite vertex.
+    Vertex_handle1 v1 = t1.infinite_vertex();
+    Vertex_handle2 iv2 = t2.infinite_vertex();
+    Vmap.insert(std::make_pair(v1, iv2));
+
+    // We pick one infinite cell of t1, and try to match it against the
+    // infinite cells of t2.
+    Cell_handle1 c = v1->cell();
+    Vertex_handle1 v2 = c->vertex((c->index(v1)+1)%(dim+1));
+    Vertex_handle1 v3 = c->vertex((c->index(v1)+2)%(dim+1));
+    Vertex_handle1 v4 = c->vertex((c->index(v1)+3)%(dim+1));
+    const Point &p2 = v2->point();
+    const Point &p3 = v3->point();
+    const Point &p4 = v4->point();
+
+    std::vector<Cell_handle2> ics;
+    t2.incident_cells(iv2, std::back_inserter(ics));
+    for (typename std::vector<Cell_handle2>::const_iterator cit = ics.begin();
+            cit != ics.end(); ++cit) {
+        int inf = (*cit)->index(iv2);
+
+        if (equal(p2, (*cit)->vertex((inf+1)%(dim+1))->point()))
+            Vmap.insert(std::make_pair(v2, (*cit)->vertex((inf+1)%(dim+1))));
+        else if (equal(p2, (*cit)->vertex((inf+2)%(dim+1))->point()))
+            Vmap.insert(std::make_pair(v2, (*cit)->vertex((inf+2)%(dim+1))));
+        else if (dim == 3 &&
+                 equal(p2, (*cit)->vertex((inf+3)%(dim+1))->point()))
+            Vmap.insert(std::make_pair(v2, (*cit)->vertex((inf+3)%(dim+1))));
+        else
+            continue; // None matched v2.
+
+        if (equal(p3, (*cit)->vertex((inf+1)%(dim+1))->point()))
+            Vmap.insert(std::make_pair(v3, (*cit)->vertex((inf+1)%(dim+1))));
+        else if (equal(p3, (*cit)->vertex((inf+2)%(dim+1))->point()))
+            Vmap.insert(std::make_pair(v3, (*cit)->vertex((inf+2)%(dim+1))));
+        else if (dim == 3 &&
+                 equal(p3, (*cit)->vertex((inf+3)%(dim+1))->point()))
+            Vmap.insert(std::make_pair(v3, (*cit)->vertex((inf+3)%(dim+1))));
+        else
+            continue; // None matched v3.
+
+        if (dim == 3) {
+            if (equal(p4, (*cit)->vertex((inf+1)%(dim+1))->point()))
+                Vmap.insert(std::make_pair(v4,
+                                           (*cit)->vertex((inf+1)%(dim+1))));
+            else if (equal(p4, (*cit)->vertex((inf+2)%(dim+1))->point()))
+                Vmap.insert(std::make_pair(v4,
+                                           (*cit)->vertex((inf+2)%(dim+1))));
+            else if (equal(p4, (*cit)->vertex((inf+3)%(dim+1))->point()))
+                Vmap.insert(std::make_pair(v4,
+                                           (*cit)->vertex((inf+3)%(dim+1))));
+            else
+                continue; // None matched v4.
+        }
+
+        // Found it !
+        Cmap.insert(std::make_pair(c, *cit));
+        break;
+    }
+
+    if (Cmap.size() == 0)
+        return false;
+    // We now have one cell, we need to propagate recursively.
+    return internal::test_next(t1, t2,
+                     Cmap.begin()->first, Cmap.begin()->second, Cmap, Vmap);
+}
+
+template < class GT, class Tds1, class Tds2 >
+inline
+bool
+operator!=(const Triangulation_3<GT, Tds1> &t1,
+           const Triangulation_3<GT, Tds2> &t2)
+{
+  return ! (t1 == t2);
+}
+
+} //namespace CGAL
+
+#endif // CGAL_TRIANGULATION_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_cell_base_3.h b/3rdparty/CGAL/include/CGAL/Triangulation_cell_base_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_cell_base_3.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_cell_base_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_cell_base_with_circumcenter_3.h b/3rdparty/CGAL/include/CGAL/Triangulation_cell_base_with_circumcenter_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_cell_base_with_circumcenter_3.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_cell_base_with_circumcenter_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_cell_base_with_info_3.h b/3rdparty/CGAL/include/CGAL/Triangulation_cell_base_with_info_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_cell_base_with_info_3.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_cell_base_with_info_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_conformer_2.h b/3rdparty/CGAL/include/CGAL/Triangulation_conformer_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_conformer_2.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_conformer_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_data_structure.h b/3rdparty/CGAL/include/CGAL/Triangulation_data_structure.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_data_structure.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_data_structure.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_data_structure_2.h b/3rdparty/CGAL/include/CGAL/Triangulation_data_structure_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_data_structure_2.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_data_structure_2.h
diff --git a/3rdparty/CGAL/include/CGAL/Triangulation_data_structure_3.h b/3rdparty/CGAL/include/CGAL/Triangulation_data_structure_3.h
new file mode 100644
index 0000000..ec80b83
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Triangulation_data_structure_3.h
@@ -0,0 +1,3974 @@
+// Copyright (c) 1999-2005  INRIA Sophia-Antipolis (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
+// 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(s)     : Monique Teillaud <Monique.Teillaud at sophia.inria.fr>
+//                 Sylvain Pion
+
+// combinatorial triangulation of the boundary of a polytope
+// of dimension d in dimension d+1
+// for -1 <= d <= 3
+
+#ifndef CGAL_TRIANGULATION_DATA_STRUCTURE_3_H
+#define CGAL_TRIANGULATION_DATA_STRUCTURE_3_H
+
+#include <CGAL/basic.h>
+
+#include <utility>
+#include <map>
+#include <set>
+#include <vector>
+#include <stack>
+
+#include <boost/unordered_set.hpp>
+#include <CGAL/utility.h>
+#include <CGAL/iterator.h>
+
+#include <CGAL/Unique_hash_map.h>
+#include <CGAL/triangulation_assertions.h>
+#include <CGAL/Triangulation_utils_3.h>
+
+#include <CGAL/Concurrent_compact_container.h>
+#include <CGAL/Compact_container.h>
+
+#include <CGAL/Triangulation_ds_cell_base_3.h>
+#include <CGAL/Triangulation_ds_vertex_base_3.h>
+#include <CGAL/Triangulation_simplex_3.h>
+
+#include <CGAL/internal/Triangulation_ds_iterators_3.h>
+#include <CGAL/internal/Triangulation_ds_circulators_3.h>
+
+#ifdef CGAL_LINKED_WITH_TBB
+#  include <tbb/scalable_allocator.h>
+#endif
+
+#include <boost/foreach.hpp>
+#include <boost/type_traits/is_convertible.hpp>
+
+namespace CGAL {
+
+// TODO : noms : Vb != Vertex_base : clarifier.
+
+template < class Vb = Triangulation_ds_vertex_base_3<>,
+           class Cb = Triangulation_ds_cell_base_3<>,
+           class Concurrency_tag_ = Sequential_tag
+>
+class Triangulation_data_structure_3
+  : public Triangulation_utils_3
+{
+  typedef Triangulation_data_structure_3<Vb, Cb, Concurrency_tag_> Tds;
+
+public:
+
+  typedef Concurrency_tag_            Concurrency_tag;
+
+  // Tools to change the Vertex and Cell types of the TDS.
+  template < typename Vb2 >
+  struct Rebind_vertex {
+    typedef Triangulation_data_structure_3<Vb2, Cb, Concurrency_tag> Other;
+  };
+
+  template < typename Cb2 >
+  struct Rebind_cell {
+    typedef Triangulation_data_structure_3<Vb, Cb2, Concurrency_tag> Other;
+  };
+
+  // Put this TDS inside the Vertex and Cell types.
+  typedef typename Vb::template Rebind_TDS<Tds>::Other  Vertex;
+  typedef typename Cb::template Rebind_TDS<Tds>::Other  Cell;
+
+  class Cell_data {
+    unsigned char conflict_state;
+  public:
+    Cell_data() : conflict_state(0) {}
+
+    void clear()            { conflict_state = 0; }
+    void mark_in_conflict() { conflict_state = 1; }
+    void mark_on_boundary() { conflict_state = 2; }
+    void mark_processed()   { conflict_state = 1; }
+
+    bool is_clear()       const { return conflict_state == 0; }
+    bool is_in_conflict() const { return conflict_state == 1; }
+    bool is_on_boundary() const { return conflict_state == 2; }
+    bool processed() const { return conflict_state == 1; }
+  };
+
+private:
+
+  friend class internal::Triangulation_ds_facet_iterator_3<Tds>;
+  friend class internal::Triangulation_ds_edge_iterator_3<Tds>;
+
+  friend class internal::Triangulation_ds_cell_circulator_3<Tds>;
+  friend class internal::Triangulation_ds_facet_circulator_3<Tds>;
+
+public:
+    
+  // Cells
+  // N.B.: Concurrent_compact_container requires TBB
+#ifdef CGAL_LINKED_WITH_TBB
+  typedef typename boost::mpl::if_c
+  <
+    boost::is_convertible<Concurrency_tag, Parallel_tag>::value,
+    Concurrent_compact_container<Cell, tbb::scalable_allocator<Cell> >,
+    Compact_container<Cell>
+  >::type                                                Cell_range;
+
+# else
+  typedef Compact_container<Cell>                        Cell_range;
+#endif
+
+  // Vertices
+  // N.B.: Concurrent_compact_container requires TBB
+#ifdef CGAL_LINKED_WITH_TBB
+  typedef typename boost::mpl::if_c
+  <
+    boost::is_convertible<Concurrency_tag, Parallel_tag>::value,
+    Concurrent_compact_container<Vertex, tbb::scalable_allocator<Vertex> >,
+    Compact_container<Vertex>
+  >::type                                                Vertex_range;
+
+# else
+  typedef Compact_container<Vertex>                      Vertex_range;
+#endif
+
+  
+  typedef typename Cell_range::size_type       size_type;
+  typedef typename Cell_range::difference_type difference_type;
+
+  typedef typename Cell_range::iterator        Cell_iterator;
+  typedef typename Vertex_range::iterator      Vertex_iterator;
+
+  typedef internal::Triangulation_ds_facet_iterator_3<Tds>   Facet_iterator;
+  typedef internal::Triangulation_ds_edge_iterator_3<Tds>    Edge_iterator;
+
+  typedef internal::Triangulation_ds_cell_circulator_3<Tds>  Cell_circulator;
+  typedef internal::Triangulation_ds_facet_circulator_3<Tds> Facet_circulator;
+
+//private: // In 2D only :
+  typedef internal::Triangulation_ds_face_circulator_3<Tds>  Face_circulator;
+
+  typedef Vertex_iterator                          Vertex_handle;
+  typedef Cell_iterator                            Cell_handle;
+
+  typedef std::pair<Cell_handle, int>              Facet;
+  typedef Triple<Cell_handle, int, int>            Edge;
+
+  typedef Triangulation_simplex_3<Tds>             Simplex;
+//#ifndef CGAL_TDS_USE_RECURSIVE_CREATE_STAR_3
+  //internally used for create_star_3 (faster than a tuple)
+  struct iAdjacency_info{
+    int v1;
+    Cell_handle v2;
+    int v3;
+    Cell_handle v4;
+    int v5;
+    int v6;
+    iAdjacency_info(){}
+    iAdjacency_info(int a1,Cell_handle a2,int a3,Cell_handle a4,int a5 ,int a6):
+      v1(a1),v2(a2),v3(a3),v4(a4),v5(a5),v6(a6) {}
+    void update_variables(int& a1,Cell_handle& a2,int& a3,Cell_handle& a4,int& a5 ,int& a6)
+    {
+      a1=v1;
+      a2=v2;
+      a3=v3;
+      a4=v4;
+      a5=v5;
+      a6=v6;
+    }
+  };
+//#endif  
+ 
+
+public:
+  Triangulation_data_structure_3()
+    : _dimension(-2)
+  {}
+
+  Triangulation_data_structure_3(const Tds & tds)
+  {
+    copy_tds(tds);
+  }
+
+  Tds & operator= (const Tds & tds)
+  {
+    if (&tds != this) {
+      Tds tmp(tds);
+      swap(tmp);
+    }
+    return *this;
+  }
+
+  size_type number_of_vertices() const { return vertices().size(); }
+
+  int dimension() const {return _dimension;}
+
+  size_type number_of_cells() const
+    {
+      if ( dimension() < 3 ) return 0;
+      return cells().size();
+    }
+
+  size_type number_of_facets() const
+    {
+      if ( dimension() < 2 ) return 0;
+      return std::distance(facets_begin(), facets_end());
+    }
+
+  size_type number_of_edges() const
+    {
+      if ( dimension() < 1 ) return 0;
+      return std::distance(edges_begin(), edges_end());
+    }
+
+  // USEFUL CONSTANT TIME FUNCTIONS
+
+  // SETTING
+
+  void set_dimension(int n) { _dimension = n; }
+
+  Vertex_handle create_vertex(const Vertex &v)
+  {
+      return vertices().insert(v);
+  }
+
+  Vertex_handle create_vertex()
+  {
+      return vertices().emplace();
+  }
+
+  Vertex_handle create_vertex(Vertex_handle v)
+  {
+      return create_vertex(*v);
+  }
+
+  Cell_handle create_cell(const Cell &c)
+    {
+      return cells().insert(c);
+    }
+
+  Cell_handle create_cell()
+    {
+      return cells().emplace();
+    }
+
+  Cell_handle create_cell(Cell_handle c)
+    {
+      return create_cell(*c);
+    }
+
+  Cell_handle create_cell(Vertex_handle v0, Vertex_handle v1,
+                          Vertex_handle v2, Vertex_handle v3)
+    {
+      return cells().emplace(v0, v1, v2, v3);
+    }
+
+  Cell_handle create_cell(Vertex_handle v0, Vertex_handle v1,
+                          Vertex_handle v2, Vertex_handle v3,
+                          Cell_handle n0, Cell_handle n1,
+                          Cell_handle n2, Cell_handle n3)
+    {
+      return cells().emplace(v0, v1, v2, v3, n0, n1, n2, n3);
+    }
+
+  Cell_handle create_face()
+    {
+      CGAL_triangulation_precondition(dimension()<3);
+      return create_cell();
+    }
+
+  Cell_handle create_face(Vertex_handle v0, Vertex_handle v1,
+                          Vertex_handle v2)
+    {
+      CGAL_triangulation_precondition(dimension()<3);
+      return cells().emplace(v0, v1, v2, Vertex_handle());
+    }
+
+  // The following functions come from TDS_2.
+  Cell_handle create_face(Cell_handle f0, int i0,
+                          Cell_handle f1, int i1,
+                          Cell_handle f2, int i2)
+    {
+      CGAL_triangulation_precondition(dimension() <= 2);
+      Cell_handle newf = create_face(f0->vertex(cw(i0)),
+                                     f1->vertex(cw(i1)),
+                                     f2->vertex(cw(i2)));
+      set_adjacency(newf, 2, f0, i0);
+      set_adjacency(newf, 0, f1, i1);
+      set_adjacency(newf, 1, f2, i2);
+      return newf;
+    }
+
+  Cell_handle create_face(Cell_handle f0, int i0,
+                          Cell_handle f1, int i1)
+    {
+      CGAL_triangulation_precondition(dimension() <= 2);
+      Cell_handle newf = create_face(f0->vertex(cw(i0)),
+                                     f1->vertex(cw(i1)),
+                                     f1->vertex(ccw(i1)));
+      set_adjacency(newf, 2, f0, i0);
+      set_adjacency(newf, 0, f1, i1);
+      return newf;
+    }
+
+  Cell_handle create_face(Cell_handle f, int i, Vertex_handle v)
+    {
+      CGAL_triangulation_precondition(dimension() <= 2);
+      Cell_handle newf = create_face(f->vertex(cw(i)),
+                                     f->vertex(ccw(i)),
+                                     v);
+      set_adjacency(newf, 2, f, i);
+      return newf;
+    }
+
+  // not documented
+  void read_cells(std::istream& is, const std::vector< Vertex_handle > &V,
+                  std::size_t & m, std::vector< Cell_handle > &C);
+  // not documented
+  void print_cells(std::ostream& os,
+                   const Unique_hash_map<Vertex_handle, std::size_t> &V ) const;
+
+  // ACCESS FUNCTIONS
+
+  void delete_vertex( Vertex_handle v )
+  {
+      CGAL_triangulation_expensive_precondition( is_vertex(v) );
+      vertices().erase(v);
+  }
+
+  void delete_cell( Cell_handle c )
+  {
+      CGAL_triangulation_expensive_precondition( is_simplex(c) );
+      cells().erase(c);
+  }
+
+  template <class InputIterator>
+  void delete_vertices(InputIterator begin, InputIterator end)
+  {
+      for(; begin != end; ++begin)
+          delete_vertex(*begin);
+  }
+
+  template <class InputIterator>
+  void delete_cells(InputIterator begin, InputIterator end)
+  {
+      for(; begin != end; ++begin)
+          delete_cell(*begin);
+  }
+
+  // QUERIES
+
+  bool is_simplex(Cell_handle c) const; // undocumented for now
+  bool is_vertex(Vertex_handle v) const;
+  bool is_edge(Cell_handle c, int i, int j) const;
+  bool is_edge(Vertex_handle u, Vertex_handle v, Cell_handle & c,
+               int & i, int & j) const;
+  bool is_edge(Vertex_handle u, Vertex_handle v) const;
+  bool is_facet(Cell_handle c, int i) const;
+  bool is_facet(Vertex_handle u, Vertex_handle v,
+                Vertex_handle w,
+                Cell_handle & c, int & i, int & j, int & k) const;
+  bool is_cell(Cell_handle c) const;
+  bool is_cell(Vertex_handle u, Vertex_handle v,
+               Vertex_handle w, Vertex_handle t,
+               Cell_handle & c, int & i, int & j, int & k, int & l) const;
+  bool is_cell(Vertex_handle u, Vertex_handle v,
+               Vertex_handle w, Vertex_handle t) const;
+
+  bool has_vertex(const Facet & f, Vertex_handle v, int & j) const;
+  bool has_vertex(Cell_handle c, int i,
+                  Vertex_handle v, int & j) const;
+  bool has_vertex(const Facet & f, Vertex_handle v) const;
+  bool has_vertex(Cell_handle c, int i, Vertex_handle v) const;
+
+  bool are_equal(Cell_handle c, int i,
+                 Cell_handle n, int j) const;
+  bool are_equal(const Facet & f, const Facet & g) const;
+  bool are_equal(const Facet & f, Cell_handle n, int j) const;
+
+  // MODIFY
+
+  bool flip(Cell_handle c, int i);
+  bool flip(const Facet &f)
+  { return flip( f.first, f.second); }
+
+  void flip_flippable(Cell_handle c, int i);
+  void flip_flippable(const Facet &f)
+  { flip_flippable( f.first, f.second ); }
+
+  bool flip(Cell_handle c, int i, int j);
+  bool flip(const Edge &e)
+  { return flip( e.first, e.second, e.third ); }
+
+  void flip_flippable(Cell_handle c, int i, int j);
+  void flip_flippable(const Edge &e)
+  { flip_flippable( e.first, e.second, e.third ); }
+
+private:
+  // common to flip and flip_flippable
+  void flip_really(Cell_handle c, int i, Cell_handle n, int in);
+  void flip_really(Cell_handle c, int i, int j,
+                   Cell_handle c1, Vertex_handle v1,
+                   int i1, int j1, int next1,
+                   Cell_handle c2, Vertex_handle v2,
+                   int i2, int j2, int next2,
+                   Vertex_handle v3);
+
+  #ifdef CGAL_TDS_USE_RECURSIVE_CREATE_STAR_3
+  Cell_handle create_star_3(Vertex_handle v, Cell_handle c,
+                            int li, int prev_ind2 = -1);
+  #else
+  Cell_handle recursive_create_star_3(Vertex_handle v, Cell_handle c, int li, int prev_ind2,int depth);
+  Cell_handle non_recursive_create_star_3(Vertex_handle v, Cell_handle c, int li, int prev_ind2);
+
+  Cell_handle create_star_3(Vertex_handle v, Cell_handle c,
+                            int li, int prev_ind2 = -1)
+  {
+    return recursive_create_star_3(v,c,li,prev_ind2,0);
+  }
+  #endif
+
+  Cell_handle create_star_2(Vertex_handle v,
+                            Cell_handle c, int li);
+
+public:
+
+  // Internal function : assumes the conflict cells are marked.
+  template <class CellIt>
+  Vertex_handle _insert_in_hole(CellIt cell_begin, CellIt cell_end,
+                                Cell_handle begin, int i,
+                                Vertex_handle newv)
+  {
+      CGAL_triangulation_precondition(begin != Cell_handle());
+      // if begin == NULL (default arg), we could compute one by walking in
+      // CellIt.  At the moment, the functionality is not available, you have
+      // to specify a starting facet.
+
+      Cell_handle cnew;
+      if (dimension() == 3)
+          cnew = create_star_3(newv, begin, i);
+      else
+          cnew = create_star_2(newv, begin, i);
+
+      newv->set_cell(cnew);
+      delete_cells(cell_begin, cell_end);
+      return newv;
+  }
+
+  // Internal function : assumes the conflict cells are marked.
+  template <class CellIt>
+  Vertex_handle _insert_in_hole(CellIt cell_begin, CellIt cell_end,
+                                Cell_handle begin, int i)
+  {
+      return _insert_in_hole(cell_begin, cell_end, begin, i, create_vertex());
+  }
+
+  // Mark the cells in conflict, then calls the internal function.
+  template <class CellIt>
+  Vertex_handle insert_in_hole(CellIt cell_begin, CellIt cell_end,
+                               Cell_handle begin, int i,
+                               Vertex_handle newv)
+  {
+      for (CellIt cit = cell_begin; cit != cell_end; ++cit)
+          (*cit)->tds_data().mark_in_conflict();
+
+      return _insert_in_hole(cell_begin, cell_end, begin, i, newv);
+  }
+
+  // Mark the cells in conflict, then calls the internal function.
+  template <class CellIt>
+  Vertex_handle insert_in_hole(CellIt cell_begin, CellIt cell_end,
+                               Cell_handle begin, int i)
+  {
+      return insert_in_hole(cell_begin, cell_end, begin, i, create_vertex());
+  }
+
+  //INSERTION
+  
+  // Create a finite cell with v1, v2, v3 and v4
+  // Precondition: v1, v2, v3 and v4 MUST BE positively oriented
+  Vertex_handle insert_first_finite_cell(
+    Vertex_handle &v1, Vertex_handle &v2, Vertex_handle &v3, Vertex_handle &v4,
+    Vertex_handle v_infinite = Vertex_handle());
+
+  Vertex_handle insert_in_cell(Cell_handle c);
+
+  Vertex_handle insert_in_facet(const Facet & f)
+    { return insert_in_facet(f.first, f.second); }
+
+  Vertex_handle insert_in_facet(Cell_handle c, int i);
+
+  Vertex_handle insert_in_edge(const Edge & e)
+    { return insert_in_edge(e.first, e.second, e.third); }
+
+  Vertex_handle insert_in_edge(Cell_handle c, int i, int j);
+
+  Vertex_handle insert_increase_dimension(Vertex_handle star =Vertex_handle());
+
+  // REMOVAL
+
+private:
+  Cell_handle remove_degree_4(Vertex_handle v);
+  Cell_handle remove_degree_3(Vertex_handle v);
+  Cell_handle remove_degree_2(Vertex_handle v);
+public:
+  Cell_handle remove_from_maximal_dimension_simplex(Vertex_handle v);
+  void remove_decrease_dimension(Vertex_handle v)
+  {
+      remove_decrease_dimension (v, v);
+  }
+  void remove_decrease_dimension(Vertex_handle v, Vertex_handle w);
+  void decrease_dimension(Cell_handle f, int i);
+
+  // Change orientation of the whole TDS.
+  void reorient()
+  {
+      CGAL_triangulation_precondition(dimension() >= 1);
+      for (Cell_iterator i = cells().begin();
+              i != cells().end(); ++i)
+          change_orientation(i);
+  }
+
+  // ITERATOR METHODS
+
+  Cell_iterator cells_begin() const
+  {
+    if ( dimension() < 3 )
+        return cells_end();
+    return cells().begin();
+  }
+
+  Cell_iterator cells_end() const
+  {
+    return cells().end();
+  }
+
+  Cell_iterator raw_cells_begin() const
+  {
+    return cells().begin();
+  }
+
+  Cell_iterator raw_cells_end() const
+  {
+    return cells().end();
+  }
+
+  Facet_iterator facets_begin() const
+  {
+    if ( dimension() < 2 )
+        return facets_end();
+    return Facet_iterator(this);
+  }
+
+  Facet_iterator facets_end() const
+  {
+    return Facet_iterator(this, 1);
+  }
+
+  Edge_iterator edges_begin() const
+  {
+    if ( dimension() < 1 )
+        return edges_end();
+    return Edge_iterator(this);
+  }
+
+  Edge_iterator edges_end() const
+  {
+    return Edge_iterator(this,1);
+  }
+
+  Vertex_iterator vertices_begin() const
+  {
+    return vertices().begin();
+  }
+
+  Vertex_iterator vertices_end() const
+  {
+    return vertices().end();
+  }
+
+  // CIRCULATOR METHODS
+
+  // cells around an edge
+  Cell_circulator incident_cells(const Edge & e) const
+  {
+    CGAL_triangulation_precondition( dimension() == 3 );
+    return Cell_circulator(e);
+  }
+  Cell_circulator incident_cells(Cell_handle ce, int i, int j) const
+  {
+    CGAL_triangulation_precondition( dimension() == 3 );
+    return Cell_circulator(ce, i, j);
+  }
+
+  Cell_circulator incident_cells(const Edge &e, Cell_handle start) const
+  {
+    CGAL_triangulation_precondition( dimension() == 3 );
+    return Cell_circulator(e, start);
+  }
+  Cell_circulator incident_cells(Cell_handle ce, int i, int j,
+                                 Cell_handle start) const
+  {
+    CGAL_triangulation_precondition( dimension() == 3 );
+    return Cell_circulator(ce, i, j, start);
+  }
+
+  //facets around an edge
+  Facet_circulator incident_facets(const Edge & e) const
+  {
+    CGAL_triangulation_precondition( dimension() == 3 );
+    return Facet_circulator(e);
+  }
+  Facet_circulator incident_facets(Cell_handle ce, int i, int j) const
+  {
+    CGAL_triangulation_precondition( dimension() == 3 );
+    return Facet_circulator(ce, i, j);
+  }
+  Facet_circulator incident_facets(const Edge & e, const Facet & start) const
+  {
+    CGAL_triangulation_precondition( dimension() == 3 );
+    return Facet_circulator(e, start);
+  }
+  Facet_circulator incident_facets(Cell_handle ce, int i, int j,
+                                   const Facet & start) const
+  {
+    CGAL_triangulation_precondition( dimension() == 3 );
+    return Facet_circulator(ce, i, j, start);
+  }
+  Facet_circulator incident_facets(const Edge & e,
+                                   Cell_handle start, int f) const
+  {
+    CGAL_triangulation_precondition( dimension() == 3 );
+    return Facet_circulator(e, start, f);
+  }
+  Facet_circulator incident_facets(Cell_handle ce, int i, int j,
+                                   Cell_handle start, int f) const
+  {
+    CGAL_triangulation_precondition( dimension() == 3 );
+    return Facet_circulator(ce, i, j, start, f);
+  }
+
+  // 2D : circulates on the faces adjacent to a vertex.
+  Face_circulator incident_faces(Vertex_handle v) const
+  {
+    CGAL_triangulation_precondition( dimension() == 2 );
+    return Face_circulator(v, v->cell());
+  }
+
+  // around a vertex
+private:
+
+  template <class IncidentCellIterator, class IncidentFacetIterator>
+  std::pair<IncidentCellIterator, IncidentFacetIterator>
+  incident_cells_3(Vertex_handle v, Cell_handle d,
+                                 std::pair<IncidentCellIterator,
+                                 IncidentFacetIterator> it) const
+  {
+        CGAL_triangulation_precondition(dimension() == 3);
+        
+        std::stack<Cell_handle> cell_stack;
+        cell_stack.push(d);
+        d->tds_data().mark_in_conflict();
+        *it.first++ = d;
+        
+        do {
+                Cell_handle c = cell_stack.top();
+                cell_stack.pop();
+                
+                for (int i=0; i<4; ++i) {
+                        if (c->vertex(i) == v)
+                                continue;
+                        Cell_handle next = c->neighbor(i);
+                        if (c < next)
+                                *it.second++ = Facet(c, i); // Incident facet.
+                        if (! next->tds_data().is_clear())
+                                continue;
+                        cell_stack.push(next);
+                        next->tds_data().mark_in_conflict();
+                        *it.first++ = next;
+                }
+        } while(!cell_stack.empty());
+
+        return it;
+  }
+
+  template <class IncidentFacetIterator>
+  void
+  incident_cells_3_threadsafe(Vertex_handle v, Cell_handle d,
+                              std::vector<Cell_handle> &cells,
+                              IncidentFacetIterator facet_it) const
+  {
+    boost::unordered_set<Cell_handle, Handle_hash_function> found_cells;
+
+    cells.push_back(d);
+    found_cells.insert(d);
+    int head=0;
+    int tail=1;
+    do {
+      Cell_handle c = cells[head];
+
+      for (int i=0; i<4; ++i) {
+        if (c->vertex(i) == v)
+          continue;
+        Cell_handle next = c->neighbor(i);
+        if (c < next)
+          *facet_it++ = Facet(c, i); // Incident facet
+        if (! found_cells.insert(next).second )
+          continue;
+        cells.push_back(next);
+        ++tail;
+      }
+      ++head;
+    } while(head != tail);
+  }
+  
+  void just_incident_cells_3(Vertex_handle v,
+                             std::vector<Cell_handle>& cells) const
+  {
+    CGAL_triangulation_precondition(dimension() == 3);
+
+    Cell_handle d = v->cell();
+    cells.push_back(d);
+    d->tds_data().mark_in_conflict();
+    int head=0;
+    int tail=1;
+    do {
+      Cell_handle c = cells[head];
+
+      for (int i=0; i<4; ++i) {
+        if (c->vertex(i) == v)
+          continue;
+        Cell_handle next = c->neighbor(i);
+        if (! next->tds_data().is_clear())
+          continue;
+        cells.push_back(next);
+        ++tail;
+        next->tds_data().mark_in_conflict();
+      }
+      ++head;
+    } while(head != tail);
+  }
+
+  template <class OutputIterator>
+  void
+  incident_cells_2(Vertex_handle v, Cell_handle,
+                   OutputIterator cells) const
+  {
+      CGAL_triangulation_precondition(dimension() == 2);
+
+      Face_circulator fc = incident_faces(v);
+      Face_circulator done(fc);
+      do {
+        *cells++ = fc;
+        ++fc;
+      } while (fc != done);
+  }
+
+public:
+
+  class False_filter {
+    public:
+    False_filter() {}
+    template<class T>
+    bool operator() (T) {
+      return false;
+    }
+  };
+
+        // Visitor for visit_incident_cells:
+        // outputs the facets
+  template <class OutputIterator, class Filter>
+  class Facet_extractor {
+    OutputIterator output;
+    Filter filter;
+    public:
+    Facet_extractor(Vertex_handle, OutputIterator _output, const Tds*, Filter _filter):
+    output(_output), filter(_filter){}
+    void operator() (Cell_handle) {}
+
+    OutputIterator result() {
+      return output;
+    }
+
+    class Facet_it {
+      OutputIterator& output;
+      Filter& filter;
+      public:
+      Facet_it(OutputIterator& _output, Filter& _filter): output(_output), filter(_filter) {}
+      Facet_it& operator*() {return *this;};
+      Facet_it& operator++() {return *this;};
+      Facet_it operator++(int) {return *this;};
+      template<class T>
+      Facet_it& operator=(const T& e) {
+        if(filter(e))
+          return *this;
+        *output++ = e;
+        return *this;
+      }
+      Facet_it& operator=(const Facet_it& f) {
+        output = f.output;
+        filter = f.filter;
+        return *this;
+      }
+    };
+    Facet_it facet_it() {
+      return Facet_it(output, filter);
+    }
+  };
+
+        // Visitor for visit_incident_cells:
+        // outputs the cells
+  template <class OutputIterator, class Filter>
+  class Cell_extractor {
+    OutputIterator output;
+    Filter filter;
+    public:
+    Cell_extractor(Vertex_handle, OutputIterator _output, const Tds*, Filter _filter):
+    output(_output), filter(_filter) {}
+
+    void operator()(Cell_handle c) {
+      if(filter(c))
+        return;
+      *output++ = c;
+    }
+    CGAL::Emptyset_iterator facet_it() {return CGAL::Emptyset_iterator();}
+    OutputIterator result() {
+      return output;
+    }
+  };
+
+  // Visitor for visit_incident_cells:
+  // WARNING: 2D ONLY
+  // outputs the faces obtained as degenerated cells
+  template <class OutputIterator, class Filter>
+  class DegCell_as_Facet_extractor {
+    OutputIterator output;
+    Filter filter;
+    public:
+    DegCell_as_Facet_extractor(Vertex_handle, OutputIterator _output, const Tds*, Filter _filter):
+    output(_output), filter(_filter) {}
+
+    void operator()(Cell_handle c) {
+      Facet f = Facet(c,3);
+      if(filter(f))
+        return;
+      *output++ = f;
+    }
+    CGAL::Emptyset_iterator facet_it() {return CGAL::Emptyset_iterator();}
+    OutputIterator result() {
+      return output;
+    }
+  };
+
+  template<class Treatment, class OutputIterator, class Filter, bool hasVisited>
+  class Vertex_extractor;
+
+        // Visitor for visit_incident_cells:
+        // outputs the result of Treatment applied to the vertices
+  template<class Treatment, class OutputIterator, class Filter>
+  class Vertex_extractor<Treatment,OutputIterator,Filter,false> {
+    Vertex_handle v;
+
+    boost::unordered_set<Vertex_handle, Handle_hash_function> tmp_vertices;
+
+    Treatment treat;
+    const Tds* t;
+    Filter filter;
+  public:
+    Vertex_extractor(Vertex_handle _v, OutputIterator _output, const Tds* _t, Filter _filter):
+    v(_v), treat(_output), t(_t), filter(_filter) 
+    {
+#if ( BOOST_VERSION >= 105000 )
+      tmp_vertices.reserve(64);
+#endif
+    }
+
+    void operator()(Cell_handle c) {
+      for (int j=0; j<= t->dimension(); ++j) {
+        Vertex_handle w = c->vertex(j);
+        if(filter(w))
+          continue;
+        if (w != v) {
+          if(tmp_vertices.insert(w).second) {
+            treat(c, v, j);
+          }
+
+        }
+      }
+    }
+
+
+    CGAL::Emptyset_iterator facet_it() {return CGAL::Emptyset_iterator();}
+    OutputIterator result() {
+      return treat.result();
+    }
+  };
+
+  template<class Treatment, class OutputIterator, class Filter>
+  class Vertex_extractor<Treatment,OutputIterator,Filter,true> {
+    Vertex_handle v;
+    std::vector<Vertex_handle> tmp_vertices;
+
+    Treatment treat;
+    const Tds* t;
+    Filter filter;
+  public:
+    Vertex_extractor(Vertex_handle _v, OutputIterator _output, const Tds* _t, Filter _filter):
+    v(_v), treat(_output), t(_t), filter(_filter) {
+      tmp_vertices.reserve(64);
+    }
+
+    void operator()(Cell_handle c) {
+      for (int j=0; j<= t->dimension(); ++j) {
+	Vertex_handle w = c->vertex(j);
+	if(filter(w))
+	  continue;
+	if (w != v){
+
+          if(! w->visited_for_vertex_extractor){
+            w->visited_for_vertex_extractor = true;
+            tmp_vertices.push_back(w);
+	    treat(c, v, j);
+          }
+        }
+      }
+    }
+
+    ~Vertex_extractor()
+    {
+      for(std::size_t i=0; i < tmp_vertices.size(); ++i){
+        tmp_vertices[i]->visited_for_vertex_extractor = false;
+      }
+    }
+
+
+    CGAL::Emptyset_iterator facet_it() {return CGAL::Emptyset_iterator();}
+    OutputIterator result() {
+      return treat.result();
+    }
+  };
+
+
+
+  // Treatment for Vertex_extractor:
+  // outputs the vertices
+  template<class OutputIterator>
+  class Vertex_feeder_treatment {
+    OutputIterator output;
+  public:
+    Vertex_feeder_treatment(OutputIterator _output): output(_output) {};
+    void operator()(Cell_handle c, Vertex_handle, int index) {
+      *output++ = c->vertex(index);
+    }
+    OutputIterator result() {
+      return output;
+    }
+  };
+
+  // Treatment for Vertex_extractor:
+  // outputs the edges corresponding to the vertices
+  template<class OutputIterator>
+  class Edge_feeder_treatment {
+    OutputIterator output;
+  public:
+    Edge_feeder_treatment(OutputIterator _output): output(_output) {};
+    void operator()(Cell_handle c, Vertex_handle v, int index) {
+      *output++ = Edge(c, c->index(v), index);
+    }
+    OutputIterator result() {
+      return output;
+    }
+  };
+
+  template <class Filter, class OutputIterator>
+  OutputIterator
+  incident_cells(Vertex_handle v, OutputIterator cells, Filter f = Filter()) const
+  {
+    return visit_incident_cells<Cell_extractor<OutputIterator, Filter>,
+      OutputIterator>(v, cells, f);
+  }
+
+  template <class OutputIterator>
+  OutputIterator
+  incident_cells(Vertex_handle v, OutputIterator cells) const
+  {
+    return incident_cells<False_filter>(v, cells);
+  }
+
+  // This version only works for vectors and only in 3D
+  void incident_cells_3(Vertex_handle v,
+                        std::vector<Cell_handle>& cells) const
+  {
+    just_incident_cells_3(v, cells);  
+    typename std::vector<Cell_handle>::iterator cit,end;
+    for(cit = cells.begin(), end = cells.end();
+              cit != end;
+              ++cit)
+    {
+      (*cit)->tds_data().clear();
+    }
+  }
+  
+  template <class Filter, class OutputIterator>
+  OutputIterator
+  incident_cells_threadsafe(Vertex_handle v, OutputIterator cells, Filter f = Filter()) const
+  {
+    return visit_incident_cells_threadsafe<Cell_extractor<OutputIterator, Filter>,
+      OutputIterator>(v, cells, f);
+  }
+
+  template <class OutputIterator>
+  OutputIterator
+  incident_cells_threadsafe(Vertex_handle v, OutputIterator cells) const
+  {
+    return incident_cells_threadsafe<False_filter>(v, cells);
+  }
+
+  template <class Filter, class OutputIterator>
+  OutputIterator
+  incident_facets(Vertex_handle v, OutputIterator facets, Filter f = Filter()) const
+  {
+    CGAL_triangulation_precondition( dimension() > 1 );
+    if(dimension() == 3)
+        return visit_incident_cells<Facet_extractor<OutputIterator, Filter>, OutputIterator>(v, facets, f);
+    else
+        return visit_incident_cells<DegCell_as_Facet_extractor<OutputIterator, Filter>, OutputIterator>(v, facets, f);
+  }
+
+  template <class OutputIterator>
+  OutputIterator
+  incident_facets(Vertex_handle v, OutputIterator facets) const
+  {
+    return incident_facets<False_filter>(v, facets);
+  }
+  
+  template <class Filter, class OutputIterator>
+  OutputIterator
+  incident_facets_threadsafe(Vertex_handle v, OutputIterator facets, Filter f = Filter()) const
+  {
+    CGAL_triangulation_precondition( dimension() > 1 );
+    if(dimension() == 3)
+        return visit_incident_cells_threadsafe<Facet_extractor<OutputIterator, Filter>, OutputIterator>(v, facets, f);
+    else
+        return visit_incident_cells_threadsafe<DegCell_as_Facet_extractor<OutputIterator, Filter>, OutputIterator>(v, facets, f);
+  }
+
+  template <class OutputIterator>
+  OutputIterator
+  incident_facets_threadsafe(Vertex_handle v, OutputIterator facets) const
+  {
+    return incident_facets<False_filter>(v, facets);
+  }
+
+  BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Has_member_visited,Has_visited_for_vertex_extractor,false)
+
+  template <class Filter, class OutputIterator>
+  OutputIterator
+  incident_edges(Vertex_handle v, OutputIterator edges, Filter f = Filter()) const
+  {
+    CGAL_triangulation_precondition( v != Vertex_handle() );
+    CGAL_triangulation_precondition( dimension() >= 1 );
+    CGAL_triangulation_expensive_precondition( is_vertex(v) );
+    CGAL_triangulation_expensive_precondition( is_valid() );
+
+    if (dimension() == 1) {
+      CGAL_triangulation_assertion( number_of_vertices() >= 3);
+      Cell_handle n0 = v->cell();
+      const int index_v_in_n0 = n0->index(v);
+      CGAL_assume(index_v_in_n0 <= 1);
+      Cell_handle n1 = n0->neighbor(1-index_v_in_n0);
+      const int index_v_in_n1 = n1->index(v);
+      CGAL_assume(index_v_in_n1 <= 1);
+      if(!f(n0->vertex(1-index_v_in_n0))) *edges++ = Edge(n0, n0->index(v), 1-index_v_in_n0);
+      if(!f(n1->vertex(1-index_v_in_n1))) *edges++ = Edge(n1, n1->index(v), 1-index_v_in_n1);
+      return edges;
+    }
+    return visit_incident_cells<Vertex_extractor<Edge_feeder_treatment<OutputIterator>,
+                                                 OutputIterator, Filter, Has_member_visited<Vertex>::value>,
+    OutputIterator>(v, edges, f);
+  }
+
+  template <class OutputIterator>
+  OutputIterator
+  incident_edges(Vertex_handle v, OutputIterator edges) const
+  {
+    return incident_edges<False_filter>(v, edges);
+  }
+
+  template <class Filter, class OutputIterator>
+  OutputIterator
+  adjacent_vertices(Vertex_handle v, OutputIterator vertices, Filter f = Filter()) const
+  {
+    CGAL_triangulation_precondition( v != Vertex_handle() );
+    CGAL_triangulation_precondition( dimension() >= -1 );
+    CGAL_triangulation_expensive_precondition( is_vertex(v) );
+    CGAL_triangulation_expensive_precondition( is_valid() );
+
+    if (dimension() == -1)
+    return vertices;
+
+    if (dimension() == 0) {
+      Vertex_handle v1 = v->cell()->neighbor(0)->vertex(0);
+      if(!f(v1)) *vertices++ = v1;
+      return vertices;
+    }
+
+    if (dimension() == 1) {
+      CGAL_triangulation_assertion( number_of_vertices() >= 3);
+      Cell_handle n0 = v->cell();
+      const int index_v_in_n0 = n0->index(v);
+      CGAL_assume(index_v_in_n0 <= 1);
+      Cell_handle n1 = n0->neighbor(1-index_v_in_n0);
+      const int index_v_in_n1 = n1->index(v);
+      CGAL_assume(index_v_in_n1 <= 1);
+      Vertex_handle v1 = n0->vertex(1-index_v_in_n0);
+      Vertex_handle v2 = n1->vertex(1-index_v_in_n1);
+      if(!f(v1)) *vertices++ = v1;
+      if(!f(v2)) *vertices++ = v2;
+      return vertices;
+    }
+    return visit_incident_cells<Vertex_extractor<Vertex_feeder_treatment<OutputIterator>,
+    OutputIterator, Filter, Has_member_visited<Vertex>::value>,
+    OutputIterator>(v, vertices, f);
+  }
+
+  // old name - kept for backwards compatibility but not documented
+  template <class OutputIterator>
+  OutputIterator
+  incident_vertices(Vertex_handle v, OutputIterator vertices) const
+  {
+    return adjacent_vertices<False_filter>(v, vertices);
+  }
+
+  // correct name
+  template <class OutputIterator>
+  OutputIterator
+  adjacent_vertices(Vertex_handle v, OutputIterator vertices) const
+  {
+    return adjacent_vertices<False_filter>(v, vertices);
+  }
+
+  template <class Visitor, class OutputIterator, class Filter>
+  OutputIterator
+  visit_incident_cells(Vertex_handle v, OutputIterator output, Filter f) const
+  {
+    CGAL_triangulation_precondition( v != Vertex_handle() );
+    CGAL_triangulation_expensive_precondition( is_vertex(v) );
+
+    if ( dimension() < 2 )
+    return output;
+
+    Visitor visit(v, output, this, f);
+
+    std::vector<Cell_handle> tmp_cells;
+    tmp_cells.reserve(64);
+    if ( dimension() == 3 )
+    incident_cells_3(v, v->cell(), std::make_pair(std::back_inserter(tmp_cells), visit.facet_it()));
+    else
+    incident_cells_2(v, v->cell(), std::back_inserter(tmp_cells));
+
+    typename std::vector<Cell_handle>::iterator cit;
+    for(cit = tmp_cells.begin();
+        cit != tmp_cells.end();
+        ++cit)
+    {
+      (*cit)->tds_data().clear();
+      visit(*cit);
+    } 
+
+    return visit.result();
+  }
+  
+  template <class Visitor, class OutputIterator, class Filter>
+  OutputIterator
+  visit_incident_cells_threadsafe(
+    Vertex_handle v, OutputIterator output, Filter f) const
+  {
+    CGAL_triangulation_precondition( v != Vertex_handle() );
+    CGAL_triangulation_expensive_precondition( is_vertex(v) );
+
+    if ( dimension() < 2 )
+    return output;
+
+    Visitor visit(v, output, this, f);
+
+    std::vector<Cell_handle> tmp_cells;
+    tmp_cells.reserve(64);
+    if ( dimension() == 3 )
+      incident_cells_3_threadsafe(
+        v, v->cell(), tmp_cells, visit.facet_it());
+    else
+      incident_cells_2(v, v->cell(), std::back_inserter(tmp_cells));
+
+    typename std::vector<Cell_handle>::iterator cit;
+    for(cit = tmp_cells.begin();
+        cit != tmp_cells.end();
+        ++cit)
+    {
+      visit(*cit);
+    } 
+
+    return visit.result();
+  }
+  
+  template <class Visitor, class OutputIterator, class Filter>
+  OutputIterator
+  visit_incident_cells(Vertex_handle v, OutputIterator output, 
+                       std::vector<Cell_handle> &cells, Filter f) const
+  {
+    CGAL_triangulation_precondition( v != Vertex_handle() );
+    CGAL_triangulation_expensive_precondition( is_vertex(v) );
+
+    if ( dimension() < 2 )
+    return output;
+
+    Visitor visit(v, output, this, f);
+
+    if ( dimension() == 3 )
+    incident_cells_3(v, v->cell(), std::make_pair(std::back_inserter(cells), visit.facet_it()));
+    else
+    incident_cells_2(v, v->cell(), std::back_inserter(cells));
+
+    typename std::vector<Cell_handle>::iterator cit;
+    for(cit = cells.begin();
+        cit != cells.end();
+        ++cit)
+    {
+      (*cit)->tds_data().clear();
+      visit(*cit);
+    }
+    return visit.result();
+  }
+
+  template <class Visitor, class OutputIterator, class Filter>
+  OutputIterator
+  visit_just_incident_cells(Vertex_handle v, OutputIterator output, Filter f) const
+  {
+    CGAL_triangulation_precondition( v != Vertex_handle() );
+    CGAL_triangulation_expensive_precondition( is_vertex(v) );
+
+    if ( dimension() < 2 )
+    return output;
+
+    Visitor visit(v, output, this, f);
+
+    std::vector<Cell_handle> tmp_cells;
+    tmp_cells.reserve(64);
+
+    if ( dimension() == 3 )
+      just_incident_cells_3(v, tmp_cells);
+    else
+    incident_cells_2(v, v->cell(), std::back_inserter(tmp_cells));
+
+    typename std::vector<Cell_handle>::iterator cit;
+    for(cit = tmp_cells.begin();
+        cit != tmp_cells.end();
+        ++cit)
+    {
+      (*cit)->tds_data().clear();
+      visit(*cit);
+    }
+    return visit.result();
+  }
+  
+  // For dimension 3 only
+  template <class VertexFilter, class OutputVertexIterator>
+  OutputVertexIterator
+  adjacent_vertices_and_cells_3(Vertex_handle v, OutputVertexIterator vertices,
+                                std::vector<Cell_handle> &cells,
+                                VertexFilter f = VertexFilter()) const
+  {
+    CGAL_triangulation_precondition( v != Vertex_handle() );
+    CGAL_triangulation_precondition( dimension() == 3 );
+    CGAL_triangulation_expensive_precondition( is_vertex(v) );
+    CGAL_triangulation_expensive_precondition( is_valid() );
+
+    return 
+      visit_incident_cells
+      <
+        Vertex_extractor<Vertex_feeder_treatment<OutputVertexIterator>,
+                         OutputVertexIterator, 
+                         VertexFilter, 
+                         Has_member_visited<Vertex>::value>,
+        OutputVertexIterator
+      >(v, vertices, cells, f);
+  }
+
+  // For dimension 3 only
+  template <class OutputVertexIterator>
+  OutputVertexIterator
+  adjacent_vertices_and_cells_3(Vertex_handle v, OutputVertexIterator vertices,
+                                std::vector<Cell_handle> &cells) const
+  {
+    return adjacent_vertices_and_cells_3<False_filter>(v, vertices, cells);
+  }
+
+  size_type degree(Vertex_handle v) const;
+
+  // CHECKING
+  bool is_valid(bool verbose = false, int level = 0) const;
+  bool is_valid(Vertex_handle v, bool verbose = false, int level = 0) const;
+  bool is_valid(Cell_handle c, bool verbose = false, int level = 0) const;
+
+  // Helping functions
+  template <class TDS_src>
+  Vertex_handle copy_tds(const TDS_src & tds,
+                         typename TDS_src::Vertex_handle vert);
+
+  template <class TDS_src>
+  Vertex_handle copy_tds(const TDS_src & tds)
+  {
+    return copy_tds(tds, typename TDS_src::Vertex_handle());
+  }
+    // returns the new vertex corresponding to vert in the new tds
+
+  template <class TDS_src,class ConvertVertex,class ConvertCell>
+  Vertex_handle copy_tds(const TDS_src&, typename TDS_src::Vertex_handle,const ConvertVertex&,const ConvertCell&);
+
+  
+  void swap(Tds & tds);
+
+  void clear();
+
+  void set_adjacency(Cell_handle c0, int i0,
+                     Cell_handle c1, int i1) const
+  {
+      CGAL_triangulation_assertion(i0 >= 0 && i0 <= dimension());
+      CGAL_triangulation_assertion(i1 >= 0 && i1 <= dimension());
+      CGAL_triangulation_assertion(c0 != c1);
+      c0->set_neighbor(i0,c1);
+      c1->set_neighbor(i1,c0);
+  }
+
+  int mirror_index(Cell_handle c, int i) const
+  {
+      CGAL_triangulation_precondition ( i>=0 && i<4 );
+      return c->neighbor(i)->index(c);
+  }
+
+  Vertex_handle mirror_vertex(Cell_handle c, int i) const
+  {
+      return c->neighbor(i)->vertex(mirror_index(c, i));
+  }
+
+  Facet mirror_facet(Facet f) const
+  {
+    Cell_handle neighbor_cell = f.first->neighbor(f.second);
+    const int opposite_index = neighbor_cell->index(f.first);
+    return Facet(neighbor_cell, opposite_index);
+  }
+
+  // We need the const_cast<>s because TDS is not const-correct.
+  Cell_range & cells() { return _cells; }
+  Cell_range & cells() const
+  { return const_cast<Tds*>(this)->_cells; }
+
+  Vertex_range & vertices() {return _vertices;}
+  Vertex_range & vertices() const
+  { return const_cast<Tds*>(this)->_vertices; }
+
+private:
+
+  // Change the orientation of the cell by swapping indices 0 and 1.
+  void change_orientation(Cell_handle c) const
+  {
+      Vertex_handle tmp_v = c->vertex(0);
+      c->set_vertex(0, c->vertex(1));
+      c->set_vertex(1, tmp_v);
+      Cell_handle tmp_c = c->neighbor(0);
+      c->set_neighbor(0, c->neighbor(1));
+      c->set_neighbor(1, tmp_c);
+  }
+
+  // in dimension i, number of vertices >= i+2
+  // ( the boundary of a simplex in dimension i+1 has i+2 vertices )
+  int _dimension;
+
+  Cell_range   _cells;
+  Vertex_range _vertices;
+
+  // used by is-valid :
+  bool count_vertices(size_type &i, bool verbose = false, int level = 0) const;
+  // counts AND checks the validity
+  bool count_facets(size_type &i, bool verbose = false, int level = 0) const;
+  // counts but does not check
+  bool count_edges(size_type &i, bool verbose = false, int level = 0) const;
+  // counts but does not check
+  bool count_cells(size_type &i, bool verbose = false, int level = 0) const;
+  // counts AND checks the validity
+};
+
+#ifdef CGAL_TDS_USE_RECURSIVE_CREATE_STAR_3
+template <class Vb, class Cb, class Ct>
+typename Triangulation_data_structure_3<Vb,Cb,Ct>::Cell_handle
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+create_star_3(Vertex_handle v, Cell_handle c, int li, int prev_ind2)
+{
+    CGAL_triangulation_precondition( dimension() == 3);
+    CGAL_triangulation_precondition( c->tds_data().is_in_conflict() );
+    CGAL_triangulation_precondition( ! c->neighbor(li)->tds_data().is_in_conflict() );
+
+    Cell_handle cnew = create_cell(c->vertex(0),
+                                   c->vertex(1),
+                                   c->vertex(2),
+                                   c->vertex(3));
+    cnew->set_vertex(li, v);
+    Cell_handle c_li = c->neighbor(li);
+    set_adjacency(cnew, li, c_li, c_li->index(c));
+
+    // Look for the other neighbors of cnew.
+    for (int ii=0; ii<4; ++ii) {
+      if (ii == prev_ind2 || cnew->neighbor(ii) != Cell_handle())
+          continue;
+      cnew->vertex(ii)->set_cell(cnew);
+
+      // Indices of the vertices of cnew such that ii,vj1,vj2,li positive.
+      Vertex_handle vj1 = c->vertex(next_around_edge(ii, li));
+      Vertex_handle vj2 = c->vertex(next_around_edge(li, ii));
+      Cell_handle cur = c;
+      int zz = ii;
+      Cell_handle n = cur->neighbor(zz);
+      // turn around the oriented edge vj1 vj2
+      while ( n->tds_data().is_in_conflict() ) {
+        CGAL_triangulation_assertion( n != c );
+        cur = n;
+        zz = next_around_edge(n->index(vj1), n->index(vj2));
+        n = cur->neighbor(zz);
+      }
+      // Now n is outside region, cur is inside.
+      n->tds_data().clear(); // Reset the flag for boundary cells.
+
+      int jj1 = n->index(vj1);
+      int jj2 = n->index(vj2);
+      Vertex_handle vvv = n->vertex(next_around_edge(jj1, jj2));
+      Cell_handle nnn = n->neighbor(next_around_edge(jj2, jj1));
+      int zzz = nnn->index(vvv);
+      if (nnn == cur) {
+        // Neighbor relation is reciprocal, ie
+        // the cell we are looking for is not yet created.
+        nnn = create_star_3(v, nnn, zz, zzz);
+      }
+
+      set_adjacency(nnn, zzz, cnew, ii);
+    }
+
+    return cnew;
+}
+#else
+template <class Vb, class Cb, class Ct>
+typename Triangulation_data_structure_3<Vb,Cb,Ct>::Cell_handle
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+recursive_create_star_3(Vertex_handle v, Cell_handle c, int li,
+                        int prev_ind2, int depth)
+{
+    if ( depth == 100 ) return non_recursive_create_star_3(v,c,li,prev_ind2);
+    CGAL_triangulation_precondition( dimension() == 3);
+    CGAL_triangulation_precondition( c->tds_data().is_in_conflict() );
+    CGAL_triangulation_precondition( ! c->neighbor(li)->tds_data().is_in_conflict() );
+
+    Cell_handle cnew = create_cell(c->vertex(0),
+                                   c->vertex(1),
+                                   c->vertex(2),
+                                   c->vertex(3));
+    cnew->set_vertex(li, v);
+    Cell_handle c_li = c->neighbor(li);
+    set_adjacency(cnew, li, c_li, c_li->index(c));
+
+    // Look for the other neighbors of cnew.
+    for (int ii=0; ii<4; ++ii) {
+      if (ii == prev_ind2 || cnew->neighbor(ii) != Cell_handle())
+          continue;
+      cnew->vertex(ii)->set_cell(cnew);
+
+      // Indices of the vertices of cnew such that ii,vj1,vj2,li positive.
+      Vertex_handle vj1 = c->vertex(next_around_edge(ii, li));
+      Vertex_handle vj2 = c->vertex(next_around_edge(li, ii));
+      Cell_handle cur = c;
+      int zz = ii;
+      Cell_handle n = cur->neighbor(zz);
+      // turn around the oriented edge vj1 vj2
+      while ( n->tds_data().is_in_conflict() ) {
+        CGAL_triangulation_assertion( n != c );
+        cur = n;
+        zz = next_around_edge(n->index(vj1), n->index(vj2));
+        n = cur->neighbor(zz);
+      }
+      // Now n is outside region, cur is inside.
+      n->tds_data().clear(); // Reset the flag for boundary cells.
+
+      int jj1 = n->index(vj1);
+      int jj2 = n->index(vj2);
+      Vertex_handle vvv = n->vertex(next_around_edge(jj1, jj2));
+      Cell_handle nnn = n->neighbor(next_around_edge(jj2, jj1));
+      int zzz = nnn->index(vvv);
+      if (nnn == cur) {
+        // Neighbor relation is reciprocal, ie
+        // the cell we are looking for is not yet created.
+        nnn = recursive_create_star_3(v, nnn, zz, zzz,depth+1);
+      }
+
+      set_adjacency(nnn, zzz, cnew, ii);
+    }
+
+    return cnew;
+}
+
+//We use the class iAdjacency_info instead of a tuple because
+//at the moment we made the change it was faster like this.
+template <class Vb, class Cb, class Ct>
+typename Triangulation_data_structure_3<Vb,Cb,Ct>::Cell_handle
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+non_recursive_create_star_3(Vertex_handle v, Cell_handle c, int li, int prev_ind2)
+{
+    CGAL_triangulation_precondition( dimension() == 3);
+    CGAL_triangulation_precondition( c->tds_data().is_in_conflict() );
+    CGAL_triangulation_precondition( ! c->neighbor(li)->tds_data().is_in_conflict() );
+
+    Cell_handle cnew = create_cell(c->vertex(0),
+                                   c->vertex(1),
+                                   c->vertex(2),
+                                   c->vertex(3));
+    cnew->set_vertex(li, v);
+    Cell_handle c_li = c->neighbor(li);
+    set_adjacency(cnew, li, c_li, c_li->index(c));
+    
+    std::stack<iAdjacency_info> adjacency_info_stack;
+  
+    int ii=0;
+    do
+    {
+      // Look for the other neighbors of cnew.
+      if ( ! (ii == prev_ind2 || cnew->neighbor(ii) != Cell_handle()) ){
+        cnew->vertex(ii)->set_cell(cnew);
+
+        // Indices of the vertices of cnew such that ii,vj1,vj2,li positive.
+        Vertex_handle vj1 = c->vertex(next_around_edge(ii, li));
+        Vertex_handle vj2 = c->vertex(next_around_edge(li, ii));
+        Cell_handle cur = c;
+        int zz = ii;
+        Cell_handle n = cur->neighbor(zz);
+        // turn around the oriented edge vj1 vj2
+        while ( n->tds_data().is_in_conflict() ) {
+          CGAL_triangulation_assertion( n != c );
+          cur = n;
+          zz = next_around_edge(n->index(vj1), n->index(vj2));
+          n = cur->neighbor(zz);
+        }
+        // Now n is outside region, cur is inside.
+        n->tds_data().clear(); // Reset the flag for boundary cells.
+
+        int jj1 = n->index(vj1);
+        int jj2 = n->index(vj2);
+        Vertex_handle vvv = n->vertex(next_around_edge(jj1, jj2));
+        Cell_handle nnn = n->neighbor(next_around_edge(jj2, jj1));
+        int zzz = nnn->index(vvv);
+        if (nnn == cur) {
+          // Neighbor relation is reciprocal, ie
+          // the cell we are looking for is not yet created.
+          //re-run the loop
+          adjacency_info_stack.push( iAdjacency_info(zzz,cnew,ii,c,li,prev_ind2) );
+          c=nnn;  li=zz; prev_ind2=zzz; ii=0;
+          //copy-pasted from beginning to avoid if ii==0
+          CGAL_triangulation_precondition( c->tds_data().is_in_conflict() );
+          CGAL_triangulation_precondition( ! c->neighbor(li)->tds_data().is_in_conflict() );
+          cnew = create_cell(c->vertex(0),c->vertex(1),c->vertex(2),c->vertex(3));
+          cnew->set_vertex(li, v);
+          c_li = c->neighbor(li);
+          set_adjacency(cnew, li, c_li, c_li->index(c));          
+          continue;
+        }
+        set_adjacency(nnn, zzz, cnew, ii);
+      }
+      while (++ii==4){
+        if ( adjacency_info_stack.empty() ) return cnew;
+        Cell_handle nnn=cnew; 
+        int zzz;
+        adjacency_info_stack.top().update_variables(zzz,cnew,ii,c,li,prev_ind2);
+        adjacency_info_stack.pop();
+        set_adjacency(nnn, zzz, cnew, ii);
+      }
+    }
+    while (true);
+}
+#endif
+
+template <class Vb, class Cb, class Ct>
+typename Triangulation_data_structure_3<Vb,Cb,Ct>::Cell_handle
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+create_star_2(Vertex_handle v, Cell_handle c, int li )
+{
+  CGAL_triangulation_assertion( dimension() == 2 );
+  Cell_handle cnew;
+
+  // i1 i2 such that v,i1,i2 positive
+  int i1=ccw(li);
+  // traversal of the boundary of region in ccw order to create all
+  // the new facets
+  Cell_handle bound = c;
+  Vertex_handle v1 = c->vertex(i1);
+  int ind = c->neighbor(li)->index(c); // to be able to find the
+                                       // first cell that will be created
+  Cell_handle cur;
+  Cell_handle pnew = Cell_handle();
+  do {
+    cur = bound;
+    // turn around v2 until we reach the boundary of region
+    while ( cur->neighbor(cw(i1))->tds_data().is_in_conflict() ) {
+      // neighbor in conflict
+      cur = cur->neighbor(cw(i1));
+      i1 = cur->index( v1 );
+    }
+    cur->neighbor(cw(i1))->tds_data().clear();
+    // here cur has an edge on the boundary of region
+    cnew = create_face( v, v1, cur->vertex( ccw(i1) ) );
+    set_adjacency(cnew, 0, cur->neighbor(cw(i1)),
+                           cur->neighbor(cw(i1))->index(cur));
+    cnew->set_neighbor(1, Cell_handle());
+    cnew->set_neighbor(2, pnew);
+    // pnew is null at the first iteration
+    v1->set_cell(cnew);
+    //pnew->set_neighbor( cw(pnew->index(v1)), cnew );
+    if (pnew != Cell_handle()) { pnew->set_neighbor( 1, cnew );}
+
+    bound = cur;
+    i1 = ccw(i1);
+    v1 = bound->vertex(i1);
+    pnew = cnew;
+    //} while ( ( bound != c ) || ( li != cw(i1) ) );
+  } while ( v1 != c->vertex(ccw(li)) );
+  // missing neighbors between the first and the last created cells
+  cur = c->neighbor(li)->neighbor(ind); // first created cell
+  set_adjacency(cnew, 1, cur, 2);
+  return cnew;
+}
+
+template <class Vb, class Cb, class Ct>
+std::istream&
+operator>>(std::istream& is, Triangulation_data_structure_3<Vb,Cb,Ct>& tds)
+  // reads :
+  // the dimension
+  // the number of vertices
+  // the number of cells
+  // the cells by the indices of their vertices
+  // the neighbors of each cell by their index in the preceding list of cells
+  // when dimension < 3 : the same with faces of maximal dimension
+{
+  typedef Triangulation_data_structure_3<Vb,Cb,Ct> Tds;
+  typedef typename Tds::Vertex_handle  Vertex_handle;
+  typedef typename Tds::Cell_handle    Cell_handle;
+
+  tds.clear();
+
+  std::size_t n;
+  int d;
+  if(is_ascii(is))
+     is >> d >> n;
+  else {
+    read(is, n);
+    read(is,d);
+  }
+  tds.set_dimension(d);
+
+  if(n == 0)
+    return is;
+
+  std::vector<Vertex_handle > V(n);
+
+  // creation of the vertices
+  for (std::size_t i=0; i < n; i++) {
+    //    is >> p;
+    //    V[i] = tds.create_vertex();
+    //    V[i]->set_point(p);
+    V[i] = tds.create_vertex();
+  }
+
+  std::vector< Cell_handle > C;
+  std::size_t m;
+
+  tds.read_cells(is, V, m, C);
+  CGAL_triangulation_assertion( tds.is_valid() );
+  return is;
+}
+
+template <class Vb, class Cb, class Ct>
+std::ostream&
+operator<<(std::ostream& os, const Triangulation_data_structure_3<Vb,Cb,Ct> &tds)
+  // writes :
+  // the dimension
+  // the number of vertices
+  // the number of cells
+  // the cells by the indices of their vertices
+  // the neighbors of each cell by their index in the preceding list of cells
+  // when dimension < 3 : the same with faces of maximal dimension
+{
+  typedef Triangulation_data_structure_3<Vb,Cb,Ct> Tds;
+  typedef typename Tds::size_type               size_type;
+  typedef typename Tds::Vertex_handle           Vertex_handle;
+  typedef typename Tds::Vertex_iterator         Vertex_iterator;
+
+
+  Unique_hash_map<Vertex_handle, size_type> V;
+
+  // outputs dimension and number of vertices
+  size_type n = tds.number_of_vertices();
+
+  if (is_ascii(os))
+      os << tds.dimension() << std::endl << n << std::endl;
+  else
+  {
+    write(os,tds.dimension());
+    write(os,n);
+  }
+
+  if (n == 0)
+    return os;
+
+  // index the vertices
+  size_type i = 0;
+  for (Vertex_iterator it=tds.vertices_begin(); it != tds.vertices_end(); ++it)
+    V[it] = i++;
+
+  CGAL_triangulation_assertion( i == n );
+
+  tds.print_cells(os, V);
+
+  return os;
+}
+
+template <class Vb, class Cb, class Ct>
+bool
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+is_simplex( Cell_handle c ) const
+{
+  switch(dimension()) {
+    case 3 : return is_cell(c);
+    case 2 : return is_facet(c, 3);
+    case 1 : return is_edge(c, 0, 1);
+    case 0 : return is_vertex(c->vertex(0));
+    case -1 : return c == cells().begin();
+  }
+  return false;
+}
+
+template <class Vb, class Cb, class Ct>
+bool
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+is_vertex(Vertex_handle v) const
+{
+    return vertices().owns_dereferencable(v);
+}
+
+template <class Vb, class Cb, class Ct>
+bool
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+is_edge(Vertex_handle u, Vertex_handle v,
+        Cell_handle &c, int &i, int &j) const
+  // returns false when dimension <1 or when indices wrong
+{
+    CGAL_triangulation_expensive_precondition( is_vertex(u) && is_vertex(v) );
+
+    if (u==v)
+        return false;
+
+    std::vector<Cell_handle> cells;
+    cells.reserve(64);
+    incident_cells(u, std::back_inserter(cells));
+
+    for (typename std::vector<Cell_handle>::iterator cit = cells.begin();
+              cit != cells.end(); ++cit)
+        if ((*cit)->has_vertex(v, j)) {
+            c = *cit;
+            i = c->index(u);
+            return true;
+        }
+    return false;
+}
+
+template <class Vb, class Cb, class Ct>
+bool
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+is_edge(Vertex_handle u, Vertex_handle v) const
+{
+    Cell_handle c;
+    int i, j;
+    return is_edge(u, v, c, i, j);
+}
+
+template <class Vb, class Cb, class Ct>
+bool
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+is_edge(Cell_handle c, int i, int j) const
+{
+  if (dimension() < 1)
+    return false;
+
+  if ( i==j ) return false;
+  if ( (i<0) || (j<0) ) return false;
+  if ( (dimension() == 1) && ((i>1) || (j>1)) ) return false;
+  if ( (dimension() == 2) && ((i>2) || (j>2)) ) return false;
+  if ((i>3) || (j>3)) return false;
+
+  return cells().owns_dereferencable(c);
+}
+
+template <class Vb, class Cb, class Ct>
+bool
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+is_facet(Vertex_handle u, Vertex_handle v,
+         Vertex_handle w,
+         Cell_handle & c, int & i, int & j, int & k) const
+  // returns false when dimension <2 or when indices wrong
+{
+    CGAL_triangulation_expensive_precondition( is_vertex(u) &&
+                                               is_vertex(v) &&
+                                               is_vertex(w) );
+
+    if ( u==v || u==w || v==w )
+        return false;
+    if (dimension() < 2)
+        return false;
+
+    std::vector<Cell_handle> cells;
+    cells.reserve(64);
+    incident_cells(u, std::back_inserter(cells));
+
+    for (typename std::vector<Cell_handle>::iterator cit = cells.begin();
+              cit != cells.end(); ++cit)
+        if ((*cit)->has_vertex(v, j) && (*cit)->has_vertex(w, k)) {
+            c = *cit;
+            i = c->index(u);
+            return true;
+        }
+    return false;
+}
+
+template <class Vb, class Cb, class Ct>
+bool
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+is_facet(Cell_handle c, int i) const
+{
+    CGAL_triangulation_precondition(i>=0 && i<4);
+
+    if ( dimension() < 2 )
+        return false;
+
+    if ( (dimension() == 2) && (i!=3) )
+        return false;
+
+    return cells().owns_dereferencable(c);
+}
+
+template <class Vb, class Cb, class Ct>
+bool
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+is_cell( Cell_handle c ) const
+  // returns false when dimension <3
+{
+    if (dimension() < 3)
+        return false;
+
+    return cells().owns_dereferencable(c);
+}
+
+template <class Vb, class Cb, class Ct>
+bool
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+is_cell(Vertex_handle u, Vertex_handle v,
+        Vertex_handle w, Vertex_handle t,
+        Cell_handle & c, int & i, int & j, int & k, int & l) const
+  // returns false when dimension <3
+{
+    CGAL_triangulation_expensive_precondition( is_vertex(u) &&
+                                               is_vertex(v) &&
+                                               is_vertex(w) &&
+                                               is_vertex(t) );
+
+    if ( u==v || u==w || u==t || v==w || v==t || w==t )
+        return false;
+
+    std::vector<Cell_handle> cells;
+    cells.reserve(64);
+    incident_cells(u, std::back_inserter(cells));
+
+    for (typename std::vector<Cell_handle>::iterator cit = cells.begin();
+              cit != cells.end(); ++cit)
+        if ((*cit)->has_vertex(v, j) && (*cit)->has_vertex(w, k) &&
+            (*cit)->has_vertex(t, l)) {
+            c = *cit;
+            i = c->index(u);
+            return true;
+        }
+    return false;
+}
+
+template <class Vb, class Cb, class Ct>
+bool
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+is_cell(Vertex_handle u, Vertex_handle v,
+        Vertex_handle w, Vertex_handle t)
+    const
+  // returns false when dimension <3
+{
+    Cell_handle c;
+    int i, j, k, l;
+    return is_cell(u, v, w, t, c, i, j, k, l);
+}
+
+template <class Vb, class Cb, class Ct>
+inline
+bool
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+has_vertex(Cell_handle c, int i, Vertex_handle v, int & j) const
+  // computes the index j of the vertex in the cell c giving the query
+  // facet (c,i)
+  // j has no meaning if false is returned
+{
+  CGAL_triangulation_precondition( dimension() == 3 );
+  return ( c->has_vertex(v,j) && (j != i) );
+}
+
+template <class Vb, class Cb, class Ct>
+inline
+bool
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+has_vertex(Cell_handle c, int i, Vertex_handle v) const
+  // checks whether the query facet (c,i) has vertex v
+{
+  CGAL_triangulation_precondition( dimension() == 3 );
+  int j;
+  return ( c->has_vertex(v,j) && (j != i) );
+}
+
+template <class Vb, class Cb, class Ct>
+inline
+bool
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+has_vertex(const Facet & f, Vertex_handle v, int & j) const
+{
+  return has_vertex(f.first, f.second, v, j);
+}
+
+template <class Vb, class Cb, class Ct>
+inline
+bool
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+has_vertex(const Facet & f, Vertex_handle v) const
+{
+  return has_vertex(f.first, f.second, v);
+}
+
+template <class Vb, class Cb, class Ct>
+bool
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+are_equal(Cell_handle c, int i, Cell_handle n, int j) const
+  // tests whether facets c,i and n,j, have the same 3 vertices
+  // the triangulation is supposed to be valid, the orientation of the
+  // facets is not checked here
+  // the neighbor relations between c and  n are not tested either,
+  // which allows to use this method before setting these relations
+  // (see remove in Delaunay_3)
+  //   if ( c->neighbor(i) != n ) return false;
+  //   if ( n->neighbor(j) != c ) return false;
+{
+  CGAL_triangulation_precondition( dimension() == 3 );
+
+  if ( (c==n) && (i==j) ) return true;
+
+  int j1,j2,j3;
+  return( n->has_vertex( c->vertex((i+1)&3), j1 ) &&
+          n->has_vertex( c->vertex((i+2)&3), j2 ) &&
+          n->has_vertex( c->vertex((i+3)&3), j3 ) &&
+          ( j1+j2+j3+j == 6 ) );
+}
+
+template <class Vb, class Cb, class Ct>
+bool
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+are_equal(const Facet & f, const Facet & g) const
+{
+  return are_equal(f.first, f.second, g.first, g.second);
+}
+
+template <class Vb, class Cb, class Ct>
+bool
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+are_equal(const Facet & f, Cell_handle n, int j) const
+{
+  return are_equal(f.first, f.second, n, j);
+}
+
+template <class Vb, class Cb, class Ct>
+bool
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+flip( Cell_handle c, int i )
+  // returns false if the facet is not flippable
+  // true other wise and
+  // flips facet i of cell c
+  // c will be replaced by one of the new cells
+{
+  CGAL_triangulation_precondition( (dimension() == 3) && (0<=i) && (i<4)
+                                   && (number_of_vertices() >= 6) );
+  CGAL_triangulation_expensive_precondition( is_cell(c) );
+
+  Cell_handle n = c->neighbor(i);
+  int in = n->index(c);
+
+  // checks that the facet is flippable,
+  // ie the future edge does not already exist
+  if (is_edge(c->vertex(i), n->vertex(in)))
+      return false;
+
+  flip_really(c,i,n,in);
+  return true;
+}
+
+template <class Vb, class Cb, class Ct>
+void
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+flip_flippable(Cell_handle c, int i )
+  // flips facet i of cell c
+  // c will be replaced by one of the new cells
+{
+  CGAL_triangulation_precondition( (dimension() == 3) && (0<=i) && (i<4)
+                                   && (number_of_vertices() >= 6) );
+  CGAL_triangulation_expensive_precondition( is_cell(c) );
+
+  Cell_handle n = c->neighbor(i);
+  int in = n->index(c);
+
+  // checks that the facet is flippable,
+  // ie the future edge does not already exist
+  CGAL_triangulation_expensive_precondition( !is_edge(c->vertex(i),
+                                                      n->vertex(in)));
+  flip_really(c,i,n,in);
+}
+
+template <class Vb, class Cb, class Ct>
+inline
+void
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+flip_really( Cell_handle c, int i, Cell_handle n, int in )
+  // private - used by flip and flip_flippable
+{
+  int i1 = (i+1)&3;
+  int i2 = (i+2)&3;
+  int i3 = (i+3)&3;
+
+  int in1 = n->index(c->vertex(i1));
+  int in2 = n->index(c->vertex(i2));
+  int in3 = n->index(c->vertex(i3));
+
+  set_adjacency(c, i, n->neighbor(in3), n->neighbor(in3)->index(n));
+  c->set_vertex( i3, n->vertex(in) );
+
+  set_adjacency(n, in, c->neighbor(i1), c->neighbor(i1)->index(c));
+  n->set_vertex( in1, c->vertex(i) );
+
+  Cell_handle cnew = create_cell(c->vertex(i), c->vertex(i1),
+                                 n->vertex(in), n->vertex(in3));
+
+  set_adjacency(cnew, 0, n->neighbor(in2), n->neighbor(in2)->index(n));
+  set_adjacency(cnew, 1, n, in2);
+  set_adjacency(cnew, 2, c->neighbor(i2), c->neighbor(i2)->index(c));
+  set_adjacency(cnew, 3, c, i2);
+  set_adjacency(c, i1, n, in3);
+
+  if ((i&1) != 0)
+      change_orientation(cnew);
+
+  c->vertex(i1)->set_cell(cnew);
+  c->vertex(i2)->set_cell(c);
+  n->vertex(in3)->set_cell(n);
+  // to be implemented : 2d case
+  // CGAL_triangulation_precondition( (0<=i) && (i<3) );
+}
+
+template <class Vb, class Cb, class Ct>
+bool
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+flip( Cell_handle c, int i, int j )
+  // returns false if the edge is not flippable
+  // true otherwise and
+  // flips edge i,j of cell c
+  // c will be deleted
+{
+  CGAL_triangulation_precondition( (dimension() == 3)
+                                   && (0<=i) && (i<4)
+                                   && (0<=j) && (j<4)
+                                   && ( i != j )
+                                   && (number_of_vertices() >= 6) );
+  CGAL_triangulation_expensive_precondition( is_cell(c) );
+
+  // checks that the edge is flippable ie degree 3
+  int degree = 0;
+  Cell_circulator ccir = incident_cells(c,i,j);
+  Cell_circulator cdone = ccir;
+  do {
+    ++degree;
+    ++ccir;
+  } while ( ccir != cdone );
+
+  if ( degree != 3 ) return false;
+
+  int next = next_around_edge(i,j);
+  Cell_handle c1 = c->neighbor( next );
+  Vertex_handle v1 = c->vertex( next ); // will become vertex of c1
+  int i1 = c1->index( c->vertex(i) );
+  int j1 = c1->index( c->vertex(j) );
+
+  int next1 = next_around_edge(i1,j1);
+  Cell_handle c2  = c1->neighbor( next1 );
+  Vertex_handle v2 = c1->vertex( next1 ); // will become vertex of c2
+  int i2 = c2->index( c->vertex(i) );
+  int j2 = c2->index( c->vertex(j) );
+
+  int next2 = next_around_edge(i2,j2);
+  Vertex_handle v3 = c2->vertex( next2 );
+
+  // checks that the edge is flippable,
+  // is the future cells do not already exist
+  if ( is_cell(v1,v2,v3,c->vertex(i)) ) return false;
+  if ( is_cell(v1,v2,v3,c->vertex(j)) ) return false;
+
+  flip_really(c,i,j,c1,v1,i1,j1,next1,c2,v2,i2,j2,next2,v3);
+
+  return true;
+}
+
+template <class Vb, class Cb, class Ct>
+void
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+flip_flippable( Cell_handle c, int i, int j )
+  // flips edge i,j of cell c
+  // c will be deleted
+{
+  CGAL_triangulation_precondition( (dimension() == 3)
+                                   && (0<=i) && (i<4)
+                                   && (0<=j) && (j<4)
+                                   && ( i != j )
+                                   && (number_of_vertices() >= 6) );
+  CGAL_triangulation_expensive_precondition( is_cell(c) );
+
+  // checks that the edge is flippable ie degree 3
+  CGAL_triangulation_precondition_code( int degree = 0; );
+  CGAL_triangulation_precondition_code
+    ( Cell_circulator ccir = incident_cells(c,i,j); );
+  CGAL_triangulation_precondition_code( Cell_circulator cdone = ccir; );
+  CGAL_triangulation_precondition_code( do {
+                                          ++degree;
+                                          ++ccir;
+                                        } while ( ccir != cdone ); );
+
+  CGAL_triangulation_precondition( degree == 3 );
+
+  int next = next_around_edge(i,j);
+  Cell_handle c1 = c->neighbor( next );
+  Vertex_handle v1 = c->vertex( next ); // will become vertex of c1
+  int i1 = c1->index( c->vertex(i) );
+  int j1 = c1->index( c->vertex(j) );
+
+  int next1 = next_around_edge(i1,j1);
+  Cell_handle c2  = c1->neighbor( next1 );
+  Vertex_handle v2 = c1->vertex( next1 ); // will become vertex of c2
+  int i2 = c2->index( c->vertex(i) );
+  int j2 = c2->index( c->vertex(j) );
+
+  int next2 = next_around_edge(i2,j2);
+  Vertex_handle v3 = c2->vertex( next2 );
+
+  // checks that the edge is flippable,
+  // is the future cells do not already exist
+  CGAL_triangulation_expensive_precondition( !is_cell(v1,v2,v3,c->vertex(i)) );
+  CGAL_triangulation_expensive_precondition( !is_cell(v1,v2,v3,c->vertex(j)) );
+
+  flip_really(c,i,j,c1,v1,i1,j1,next1,c2,v2,i2,j2,next2,v3);
+}
+
+template <class Vb, class Cb, class Ct>
+inline
+void
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+flip_really( Cell_handle c, int i, int j,
+             Cell_handle c1, Vertex_handle v1,
+             int i1, int j1, int next1,
+             Cell_handle c2, Vertex_handle v2,
+             int i2, int j2, int next2,
+             Vertex_handle v3 )
+{
+  c->vertex(i)->set_cell(c1);
+  c->vertex(j)->set_cell(c2);
+
+  c1->set_vertex( j1, v1 );
+  v1->set_cell(c1);
+  c2->set_vertex( i2, v2 );
+  v2->set_cell(c2);
+
+  set_adjacency(c1, next1,c2->neighbor(j2), c2->neighbor(j2)->index(c2));
+  set_adjacency(c2,c2->index(v1),c1->neighbor(i1),c1->neighbor(i1)->index(c1));
+
+  set_adjacency(c1, i1, c2, j2);
+
+  set_adjacency(c1, 6-i1-j1-next1, c->neighbor(j), c->neighbor(j)->index(c));
+  set_adjacency(c2, next2, c->neighbor(i), c->neighbor(i)->index(c));
+
+  v3->set_cell( c2 );
+
+  delete_cell( c );
+}
+
+template <class Vb, class Cb, class Ct>
+void
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+read_cells(std::istream& is, const std::vector< Vertex_handle > &V,
+           std::size_t & m, std::vector< Cell_handle > &C)
+{
+  // creation of the cells and neighbors
+  switch (dimension()) {
+  case 3:
+  case 2:
+  case 1:
+    {
+      if(is_ascii(is))
+        is >> m;
+      else
+        read(is, m);
+
+      C.resize(m);
+
+      for(std::size_t i = 0; i < m; i++) {
+        Cell_handle c = create_cell();
+        for (int k=0; k<=dimension(); ++k) {
+          std::size_t ik;
+            if(is_ascii(is))
+               is >> ik;
+            else
+              read(is, ik);
+            c->set_vertex(k, V[ik]);
+            V[ik]->set_cell(c);
+        }
+        C[i] = c;
+      }
+      for(std::size_t j = 0; j < m; j++) {
+        Cell_handle c = C[j];
+        for (int k=0; k<=dimension(); ++k) {
+          std::size_t ik;
+            if(is_ascii(is))
+              is >> ik;
+            else
+              read(is, ik);
+            c->set_neighbor(k, C[ik]);
+        }
+      }
+      break;
+    }
+  case 0:
+    {
+      m = 2;
+      C.resize(m);
+      //      CGAL_triangulation_assertion( n == 2 );
+      for (int i=0; i < 2; i++) {
+        Cell_handle c = create_face(V[i], Vertex_handle(), Vertex_handle());
+        C[i] = c;
+        V[i]->set_cell(c);
+      }
+      for (int j=0; j < 2; j++) {
+        Cell_handle c = C[j];
+        c->set_neighbor(0, C[1-j]);
+      }
+      break;
+    }
+  case -1:
+    {
+      m = 1;
+      C.resize(m);
+      //      CGAL_triangulation_assertion( n == 1 );
+      Cell_handle c = create_face(V[0], Vertex_handle(), Vertex_handle());
+      C[0] = c;
+      V[0]->set_cell(c);
+      break;
+    }
+  }
+}
+
+template <class Vb, class Cb, class Ct>
+void
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+print_cells(std::ostream& os, const Unique_hash_map<Vertex_handle, std::size_t> &V ) const
+{
+  Unique_hash_map<Cell_handle, std::size_t > C;
+  std::size_t i = 0;
+
+  switch ( dimension() ) {
+  case 3:
+    {
+      std::size_t m = number_of_cells();
+      if(is_ascii(os))
+        os << m << std::endl;
+      else
+        write(os, m);
+
+      // write the cells
+      Cell_iterator it;
+      for(it = cells_begin(); it != cells_end(); ++it) {
+        C[it] = i++;
+        for(int j = 0; j < 4; j++){
+          if(is_ascii(os)) {
+            os << V[it->vertex(j)];
+            if ( j==3 )
+              os << '\n';
+            else
+              os << ' ';
+          }
+          else
+            write(os, V[it->vertex(j)]);
+        }
+      }
+      CGAL_triangulation_assertion( i == m );
+
+      // write the neighbors
+      for(it = cells_begin(); it != cells_end(); ++it) {
+        for (int j = 0; j < 4; j++) {
+          if(is_ascii(os)){
+            os << C[it->neighbor(j)];
+            if(j==3)
+              os << '\n';
+            else
+              os <<  ' ';
+          }
+          else
+            write(os, C[it->neighbor(j)]);
+        }
+      }
+      break;
+    }
+  case 2:
+    {
+      size_type m = number_of_facets();
+      if(is_ascii(os))
+        os << m << '\n';
+      else
+        write(os, m);
+
+      // write the facets
+      Facet_iterator it;
+      for(it = facets_begin(); it != facets_end(); ++it) {
+        C[(*it).first] = i++;
+        for(int j = 0; j < 3; j++){
+          if(is_ascii(os)) {
+            os << V[(*it).first->vertex(j)];
+            if ( j==2 )
+              os << '\n';
+            else
+              os <<  ' ';
+          }
+          else {
+            write(os,  V[(*it).first->vertex(j)]);
+          }
+        }
+      }
+      CGAL_triangulation_assertion( i == m );
+
+      // write the neighbors
+      for(it = facets_begin(); it != facets_end(); ++it) {
+        for (int j = 0; j < 3; j++) {
+          if(is_ascii(os)){
+            os << C[(*it).first->neighbor(j)];
+            if(j==2)
+              os << '\n';
+            else
+              os <<  ' ';
+          }
+          else {
+            write(os, C[(*it).first->neighbor(j)]);
+          }
+        }
+      }
+      break;
+    }
+  case 1:
+    {
+      size_type m = number_of_edges();
+      if(is_ascii(os))
+        os << m << '\n';
+      else
+        write(os, m);
+      // write the edges
+      Edge_iterator it;
+      for(it = edges_begin(); it != edges_end(); ++it) {
+        C[(*it).first] = i++;
+        for(int j = 0; j < 2; j++){
+          if(is_ascii(os)) {
+            os << V[(*it).first->vertex(j)];
+            if ( j==1 )
+              os << '\n';
+            else
+              os <<  ' ';
+          }
+          else {
+            write(os, V[(*it).first->vertex(j)]);
+          }
+        }
+      }
+      CGAL_triangulation_assertion( i == m );
+
+      // write the neighbors
+      for(it = edges_begin(); it != edges_end(); ++it) {
+        for (int j = 0; j < 2; j++) {
+          if(is_ascii(os)){
+            os << C[(*it).first->neighbor(j)];
+            if(j==1)
+              os << '\n';
+            else
+              os <<  ' ';
+          }
+          else {
+            write(os, C[(*it).first->neighbor(j)]);
+          }
+        }
+      }
+      break;
+    }
+  }
+}
+
+
+template <class Vb, class Cb, class Ct>
+typename Triangulation_data_structure_3<Vb,Cb,Ct>::Vertex_handle
+Triangulation_data_structure_3<Vb,Cb,Ct>::insert_first_finite_cell(
+  Vertex_handle &v0, Vertex_handle &v1, Vertex_handle &v2, Vertex_handle &v3,
+  Vertex_handle v_infinite)
+{
+  CGAL_triangulation_precondition( 
+    (v_infinite == Vertex_handle() && dimension() == -2)
+    || (v_infinite != Vertex_handle() && dimension() == -1));
+
+  if (v_infinite == Vertex_handle())
+    v_infinite = create_vertex();
+
+  set_dimension(3);
+
+  v0 = create_vertex();
+  v1 = create_vertex();
+  v2 = create_vertex();
+  v3 = create_vertex();
+
+  Cell_handle c0123 = create_cell(v0,         v1,   v2,   v3);
+  Cell_handle ci012 = create_cell(v_infinite, v0,   v1,   v2);
+  Cell_handle ci103 = create_cell(v_infinite, v1,   v0,   v3);
+  Cell_handle ci023 = create_cell(v_infinite, v0,   v2,   v3);
+  Cell_handle ci132 = create_cell(v_infinite, v1,   v3,   v2);
+
+  v_infinite->set_cell(ci012);
+  v0->set_cell(c0123);
+  v1->set_cell(c0123);
+  v2->set_cell(c0123);
+  v3->set_cell(c0123);
+
+  set_adjacency(c0123, 0, ci132, 0);
+  set_adjacency(c0123, 1, ci023, 0);
+  set_adjacency(c0123, 2, ci103, 0);
+  set_adjacency(c0123, 3, ci012, 0);
+
+  set_adjacency(ci012, 3, ci103, 3);
+  set_adjacency(ci012, 2, ci023, 3);
+  set_adjacency(ci012, 1, ci132, 2);
+  set_adjacency(ci103, 1, ci023, 2);
+  set_adjacency(ci023, 1, ci132, 1);
+  set_adjacency(ci103, 2, ci132, 3);
+
+  return v_infinite;
+}
+
+template <class Vb, class Cb, class Ct>
+typename Triangulation_data_structure_3<Vb,Cb,Ct>::Vertex_handle
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+insert_in_cell(Cell_handle c)
+{
+  CGAL_triangulation_precondition( dimension() == 3 );
+  CGAL_triangulation_precondition( c != Cell_handle() );
+  CGAL_triangulation_expensive_precondition( is_cell(c) );
+
+  Vertex_handle v = create_vertex();
+
+  Vertex_handle v0 = c->vertex(0);
+  Vertex_handle v1 = c->vertex(1);
+  Vertex_handle v2 = c->vertex(2);
+  Vertex_handle v3 = c->vertex(3);
+
+  Cell_handle n1 = c->neighbor(1);
+  Cell_handle n2 = c->neighbor(2);
+  Cell_handle n3 = c->neighbor(3);
+
+  // c will be modified to have v,v1,v2,v3 as vertices
+  Cell_handle c3 = create_cell(v0,v1,v2,v);
+  Cell_handle c2 = create_cell(v0,v1,v,v3);
+  Cell_handle c1 = create_cell(v0,v,v2,v3);
+
+  set_adjacency(c3, 0, c, 3);
+  set_adjacency(c2, 0, c, 2);
+  set_adjacency(c1, 0, c, 1);
+
+  set_adjacency(c2, 3, c3, 2);
+  set_adjacency(c1, 3, c3, 1);
+  set_adjacency(c1, 2, c2, 1);
+
+  set_adjacency(n1, n1->index(c), c1, 1);
+  set_adjacency(n2, n2->index(c), c2, 2);
+  set_adjacency(n3, n3->index(c), c3, 3);
+
+  c->set_vertex(0,v);
+
+  v0->set_cell(c1);
+  v->set_cell(c);
+
+  return v;
+}
+
+template <class Vb, class Cb, class Ct>
+typename Triangulation_data_structure_3<Vb,Cb,Ct>::Vertex_handle
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+insert_in_facet(Cell_handle c, int i)
+{ // inserts v in the facet opposite to vertex i of cell c
+
+  CGAL_triangulation_precondition( c != Cell_handle() );
+  CGAL_triangulation_precondition( dimension() >= 2 );
+
+  Vertex_handle v = create_vertex();
+
+  switch ( dimension() ) {
+
+  case 3:
+    {
+      CGAL_triangulation_expensive_precondition( is_cell(c) );
+      CGAL_triangulation_precondition( i == 0 || i == 1 ||
+                                       i == 2 || i == 3 );
+      // c will be modified to have v replacing vertex(i+3)
+      int i1,i2,i3;
+
+      if ( (i&1) == 0 ) {
+        i1=(i+1)&3; i2=(i+2)&3; i3=6-i-i1-i2;
+      }
+      else {
+        i1=(i+1)&3; i2=(i+3)&3; i3=6-i-i1-i2;
+      }
+      // i,i1,i2,i3 is well oriented
+      // so v will "replace" the vertices in this order
+      // when creating the new cells one after another from c
+
+      Vertex_handle vi=c->vertex(i);
+      Vertex_handle v1=c->vertex(i1);
+      Vertex_handle v2=c->vertex(i2);
+      Vertex_handle v3=c->vertex(i3);
+
+      // new cell with v in place of i1
+      Cell_handle nc = c->neighbor(i1);
+      Cell_handle cnew1 = create_cell(vi,v,v2,v3);
+      set_adjacency(cnew1, 1, nc, nc->index(c));
+      set_adjacency(cnew1, 3, c, i1);
+
+      v3->set_cell(cnew1);
+
+      // new cell with v in place of i2
+      nc = c->neighbor(i2);
+      Cell_handle cnew2 = create_cell(vi,v1,v,v3);
+      set_adjacency(cnew2, 2, nc, nc->index(c));
+      set_adjacency(cnew2, 3, c, i2);
+      set_adjacency(cnew1, 2, cnew2, 1);
+
+      // v replaces i3 in c
+      c->set_vertex(i3,v);
+
+      // other side of facet containing v
+      Cell_handle d = c->neighbor(i);
+      int j = d->index(c);
+      int j1=d->index(v1);// triangulation supposed to be valid
+      int j2=d->index(v2);
+      int j3=6-j-j1-j2;
+      // then the orientation of j,j1,j2,j3 depends on the parity
+      // of i-j
+
+      // new cell with v in place of j1
+      Cell_handle nd = d->neighbor(j1);
+      Cell_handle dnew1 = create_cell(d->vertex(j),v,v3,v2);
+      set_adjacency(dnew1, 1, nd, nd->index(d));
+      set_adjacency(dnew1, 2, d, j1);
+      set_adjacency(dnew1, 0, cnew1, 0);
+
+      // new cell with v in place of j2
+      nd = d->neighbor(j2);
+      Cell_handle dnew2 = create_cell(d->vertex(j),v1,v3,v);
+
+      set_adjacency(dnew2, 3, nd, nd->index(d));
+      set_adjacency(dnew2, 2, d, j2);
+      set_adjacency(dnew2, 0, cnew2, 0);
+      set_adjacency(dnew1, 3, dnew2, 1);
+
+      // v replaces i3 in d
+      d->set_vertex(j3,v);
+      v->set_cell(d);
+
+      break;
+    }
+  case 2:
+    {
+      CGAL_triangulation_expensive_precondition( is_facet(c,i) );
+      Cell_handle n = c->neighbor(2);
+      Cell_handle cnew = create_face(c->vertex(0),c->vertex(1),v);
+      set_adjacency(cnew, 2, n, n->index(c));
+      set_adjacency(cnew, 0, c, 2);
+      c->vertex(0)->set_cell(cnew);
+
+      n = c->neighbor(1);
+      Cell_handle dnew = create_face(c->vertex(0),v,c->vertex(2));
+      set_adjacency(dnew, 1, n, n->index(c));
+      set_adjacency(dnew, 0, c, 1);
+      set_adjacency(dnew, 2, cnew, 1);
+
+      c->set_vertex(0,v);
+      v->set_cell(c);
+      break;
+    }
+  }
+
+  return v;
+}
+
+template <class Vb, class Cb, class Ct>
+typename Triangulation_data_structure_3<Vb,Cb,Ct>::Vertex_handle
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+insert_in_edge(Cell_handle c, int i, int j)
+  // inserts a vertex in the edge of cell c with vertices i and j
+{
+  CGAL_triangulation_precondition( c != Cell_handle() );
+  CGAL_triangulation_precondition( i != j );
+  CGAL_triangulation_precondition( dimension() >= 1 );
+
+  switch ( dimension() ) {
+  case 3:
+    {
+      CGAL_triangulation_expensive_precondition( is_cell(c) );
+      CGAL_triangulation_precondition( i>=0 && i<=3 && j>=0 && j<=3 );
+
+      std::vector<Cell_handle > cells;
+      cells.reserve(32);
+      Cell_circulator ccir = incident_cells(c, i, j);
+      do {
+          Cell_handle cc = ccir;
+          cells.push_back(cc);
+          cc->tds_data().mark_in_conflict();
+          ++ccir;
+      } while (c != ccir);
+
+      return _insert_in_hole(cells.begin(), cells.end(), c, i);
+    }
+  case 2:
+    {
+      CGAL_triangulation_expensive_precondition( is_edge(c,i,j) );
+
+      Vertex_handle v = create_vertex();
+      int k=3-i-j; // index of the third vertex of the facet
+      Cell_handle d = c->neighbor(k);
+      int kd = d->index(c);
+      int id = d->index(c->vertex(i));
+      int jd = d->index(c->vertex(j));
+
+      Cell_handle cnew = create_cell();
+      cnew->set_vertex(i,c->vertex(i));
+      c->vertex(i)->set_cell(cnew);
+      cnew->set_vertex(j,v);
+      cnew->set_vertex(k,c->vertex(k));
+      c->set_vertex(i,v);
+
+      Cell_handle dnew = create_cell();
+      dnew->set_vertex(id,d->vertex(id));
+      // d->vertex(id)->cell() is cnew OK
+      dnew->set_vertex(jd,v);
+      dnew->set_vertex(kd,d->vertex(kd));
+      d->set_vertex(id,v);
+
+      Cell_handle nj = c->neighbor(j);
+      set_adjacency(cnew, i, c, j);
+      set_adjacency(cnew, j, nj, nj->index(c));
+
+      nj = d->neighbor(jd);
+      set_adjacency(dnew, id, d, jd);
+      set_adjacency(dnew, jd, nj, nj->index(d));
+
+      set_adjacency(cnew, k, dnew, kd);
+
+      v->set_cell(cnew);
+      return v;
+    }
+  default: // case 1:
+    {
+      Vertex_handle v = create_vertex();
+      CGAL_triangulation_expensive_precondition( is_edge(c,i,j) );
+      Cell_handle cnew = create_face(v, c->vertex(1), Vertex_handle());
+      c->vertex(1)->set_cell(cnew);
+      c->set_vertex(1,v);
+      set_adjacency(cnew, 0, c->neighbor(0), 1);
+      set_adjacency(cnew, 1, c, 0);
+
+      v->set_cell(cnew);
+      return v;
+    }
+  }
+}
+
+template <class Vb, class Cb, class Ct>
+typename Triangulation_data_structure_3<Vb,Cb,Ct>::Vertex_handle
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+insert_increase_dimension(Vertex_handle star)
+  // star = vertex from which we triangulate the facet of the
+  // incremented dimension
+  // ( geometrically : star = infinite vertex )
+  // = NULL only used to insert the 1st vertex (dimension -2 to dimension -1)
+  // changes the dimension
+{
+  CGAL_triangulation_precondition( dimension() < 3);
+
+  Vertex_handle v = create_vertex();
+
+  int dim = dimension();
+  if (dim != -2) {
+      CGAL_triangulation_precondition( star != Vertex_handle() );
+      // In this case, this precondition is not relatively expensive.
+      CGAL_triangulation_precondition( is_vertex(star) );
+  }
+
+  // this is set now, so that it becomes allowed to reorient
+  // new facets or cells by iterating on them (otherwise the
+  // dimension is too small)
+  set_dimension( dimension()+1 );
+
+  switch ( dim ) {
+  case -2:
+      // insertion of the first vertex
+      // ( geometrically : infinite vertex )
+    {
+      Cell_handle c = create_face(v, Vertex_handle(), Vertex_handle());
+      v->set_cell(c);
+      break;
+    }
+
+  case -1:
+    // insertion of the second vertex
+    // ( geometrically : first finite vertex )
+    {
+      Cell_handle d = create_face(v, Vertex_handle(), Vertex_handle());
+      v->set_cell(d);
+      set_adjacency(d, 0, star->cell(), 0);
+      break;
+    }
+
+  case 0:
+    // insertion of the third vertex
+    // ( geometrically : second finite vertex )
+    {
+      Cell_handle c = star->cell();
+      Cell_handle d = c->neighbor(0);
+
+      c->set_vertex(1,d->vertex(0));
+      d->set_vertex(1,v);
+      d->set_neighbor(1,c);
+      Cell_handle e = create_face( v, star, Vertex_handle() );
+      set_adjacency(e, 0, c, 1);
+      set_adjacency(e, 1, d, 0);
+
+      v->set_cell(d);
+      break;
+    }
+
+  case 1:
+    // general case : 4th vertex ( geometrically : 3rd finite vertex )
+    // degenerate cases geometrically : 1st non collinear vertex
+    {
+      Cell_handle c = star->cell();
+      int i = c->index(star); // i== 0 or 1
+      CGAL_assertion(i==0 || i==1);
+      int j = (i == 0) ? 1 : 0;
+      Cell_handle d = c->neighbor(j);
+        
+      c->set_vertex(2,v);
+
+      Cell_handle e = c->neighbor(i);
+      Cell_handle cnew = c;
+      Cell_handle enew = Cell_handle();
+        
+      while( e != d ){
+        enew = create_cell();
+        enew->set_vertex(i,e->vertex(j));
+        enew->set_vertex(j,e->vertex(i));
+        enew->set_vertex(2,star);
+        
+        set_adjacency(enew, i, cnew, j);
+        // false at the first iteration of the loop where it should
+        // be neighbor 2
+        // it is corrected after the loop
+        set_adjacency(enew, 2, e, 2);
+        // neighbor j will be set during next iteration of the loop
+        
+        e->set_vertex(2,v);
+
+        e = e->neighbor(i);
+        cnew = enew;
+      }
+        
+      d->set_vertex(2,v);
+      set_adjacency(enew, j, d, 2);
+
+      // corrections for star->cell() :
+      c = star->cell();
+      c->set_neighbor(2,c->neighbor(i)->neighbor(2));
+      c->set_neighbor(j,d);
+
+      v->set_cell(d);
+
+      break;
+    }
+
+  case 2:
+    // general case : 5th vertex ( geometrically : 4th finite vertex )
+    // degenerate cases : geometrically 1st non coplanar vertex
+    {
+      // used to store the new cells, in order to be able to traverse only
+      // them to find the missing neighbors.
+      std::vector<Cell_handle > new_cells;
+      new_cells.reserve(16);
+
+      Cell_iterator it = cells_begin();
+      // allowed since the dimension has already been set to 3
+
+      v->set_cell(it); // ok since there is at least one ``cell''
+      for(; it != cells_end(); ++it) {
+        // Here we must be careful since we create_cells in a loop controlled
+        // by an iterator.  So we first take care of the cells newly created
+        // by the following test :
+        if (it->neighbor(0) == Cell_handle())
+          continue;
+        it->set_neighbor(3, Cell_handle());
+        it->set_vertex(3, v);
+        if ( ! it->has_vertex(star) ) {
+          Cell_handle cnew = create_cell( it->vertex(0), it->vertex(2),
+                                          it->vertex(1), star);
+          // The Intel compiler has a problem with passing "it" directly to
+          // function "set_adjacency": the adjacency is not changed.
+          Cell_handle ch_it = it;
+          set_adjacency(cnew, 3, ch_it, 3);
+          cnew->set_neighbor(0, Cell_handle());
+          new_cells.push_back(cnew);
+        }
+      }
+
+      // traversal of the new cells only, to add missing neighbors
+      for(typename std::vector<Cell_handle>::iterator ncit = new_cells.begin();
+           ncit != new_cells.end(); ++ncit) {
+        Cell_handle n = (*ncit)->neighbor(3); // opposite to star
+        for ( int i=0; i<3; i++ ) {
+          int j;
+          if ( i==0 ) j=0;
+          else j=3-i; // vertex 1 and vertex 2 are always switched when
+          // creating a new cell (see above)
+          Cell_handle c = n->neighbor(i)->neighbor(3);
+          if ( c != Cell_handle() ) {
+            // i.e. star is not a vertex of n->neighbor(i)
+            (*ncit)->set_neighbor(j, c);
+            // opposite relation will be set when ncit arrives on c
+            // this avoids to look for the correct index
+            // and to test whether *ncit already has neighbor i
+          }
+          else {
+            // star is a vertex of n->neighbor(i)
+            set_adjacency(*ncit, j, n->neighbor(i), 3);//neighbor opposite to v
+          }
+        }
+      }
+    }
+  }// end switch
+
+  return v;
+}
+
+template <class Vb, class Cb, class Ct>
+void
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+remove_decrease_dimension(Vertex_handle v, Vertex_handle w)
+{
+    CGAL_triangulation_expensive_precondition( is_valid() );
+    CGAL_triangulation_precondition( dimension() >= -1 );
+    CGAL_triangulation_precondition( dimension() != 1 ||
+                                     number_of_vertices() == 3);
+    CGAL_triangulation_precondition( number_of_vertices() >
+                                     (size_type) dimension() + 1 );
+    CGAL_triangulation_precondition( degree(v) == number_of_vertices()-1 );
+
+    if (dimension() <= 0) {
+        delete_cell(v->cell());
+    }
+    else {
+        // the cells incident to w are down graded one dimension
+        // the other cells are deleted
+        std::vector<Cell_handle> to_delete, to_downgrade;
+
+        for (Cell_iterator ib = cells().begin();
+            ib != cells().end(); ++ib) {
+            if ( ib->has_vertex(w) )
+                to_downgrade.push_back(ib);
+            else
+                to_delete.push_back(ib);
+        }
+
+        typename std::vector<Cell_handle>::iterator lfit=to_downgrade.begin();
+        for( ; lfit != to_downgrade.end(); ++lfit) {
+            Cell_handle f = *lfit;
+            int j = f->index(w);
+            int k; if (f->has_vertex(v, k)) f->set_vertex(k, w);
+            if (j != dimension()) {
+                f->set_vertex(j, f->vertex(dimension()));
+                f->set_neighbor(j, f->neighbor(dimension()));
+                if (dimension() >= 1)
+                    change_orientation(f);
+            }
+            f->set_vertex(dimension(), Vertex_handle());
+            f->set_neighbor(dimension(), Cell_handle());
+
+            // Update vertex->cell() pointers.
+            for (int i = 0; i < dimension(); ++i)
+                f->vertex(i)->set_cell(f);
+        }
+
+        delete_cells(to_delete.begin(), to_delete.end());
+    }
+    delete_vertex(v);
+    set_dimension(dimension()-1);
+    CGAL_triangulation_postcondition(is_valid());
+}
+
+template <class Vb, class Cb, class Ct>
+typename Triangulation_data_structure_3<Vb,Cb,Ct>::Cell_handle
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+remove_from_maximal_dimension_simplex(Vertex_handle v)
+{
+    CGAL_triangulation_precondition(dimension() >= 1);
+    CGAL_triangulation_precondition(degree(v) == (size_type) dimension() + 1);
+    CGAL_triangulation_precondition(number_of_vertices() >
+                                    (size_type) dimension() + 1);
+
+    if (number_of_vertices() == (size_type) dimension() + 2) {
+        remove_decrease_dimension(v);
+        return Cell_handle();
+    }
+
+    if (dimension() == 3)
+        return remove_degree_4(v);
+    if (dimension() == 2)
+        return remove_degree_3(v);
+
+    // dimension() == 1
+    return remove_degree_2(v);
+}
+
+template <class Vb, class Cb, class Ct>
+typename Triangulation_data_structure_3<Vb,Cb,Ct>::Cell_handle
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+remove_degree_2(Vertex_handle v)
+{
+    CGAL_triangulation_precondition(dimension() == 1);
+    CGAL_triangulation_precondition(degree(v) == 2);
+    CGAL_triangulation_precondition(number_of_vertices() >= 4);
+
+    // Cells to be killed.
+    Cell_handle c0, c1;
+    // Indices of v in these cells.
+    int i0, i1;
+
+    c0 = v->cell();
+    i0 = c0->index(v);
+    c1 = c0->neighbor((i0 == 0) ? 1 : 0);
+    i1 = c1->index(v);
+
+    // New cell : we copy the content of c0, so we keep the orientation.
+    Cell_handle newc = create_face(c0->vertex(0),
+                                   c0->vertex(1),
+                                   Vertex_handle());
+
+    newc->set_vertex(i0, c1->vertex(c1->index(c0)));
+
+    set_adjacency(newc,    i0, c0->neighbor(i0), mirror_index(c0, i0));
+    set_adjacency(newc,  1-i0, c1->neighbor(i1), mirror_index(c1, i1));
+
+    newc->vertex(0)->set_cell(newc);
+    newc->vertex(1)->set_cell(newc);
+
+    delete_cell(c0);
+    delete_cell(c1);
+    delete_vertex(v);
+
+    return newc;
+}
+
+template <class Vb, class Cb, class Ct>
+typename Triangulation_data_structure_3<Vb,Cb,Ct>::Cell_handle
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+remove_degree_3(Vertex_handle v)
+{
+    CGAL_triangulation_precondition(dimension() == 2);
+    CGAL_triangulation_precondition(degree(v) == 3);
+    CGAL_triangulation_precondition(number_of_vertices() >= 5);
+
+    // Cells to be killed.
+    Cell_handle c0, c1, c2;
+    // Indices of v in these cells.
+    int i0, i1, i2;
+
+    c0 = v->cell();
+    i0 = c0->index(v);
+    c1 = c0->neighbor(cw(i0));
+    i1 = c1->index(v);
+    c2 = c0->neighbor(ccw(i0));
+    i2 = c2->index(v);
+
+    // New cell : we copy the content of c0, so we keep the orientation.
+    Cell_handle newc = create_face(c0->vertex(0),
+                                   c0->vertex(1),
+                                   c0->vertex(2));
+
+    newc->set_vertex(i0, c1->vertex(c1->index(c0)));
+
+    set_adjacency(newc,      i0, c0->neighbor(i0), mirror_index(c0, i0));
+    set_adjacency(newc,  cw(i0), c1->neighbor(i1), mirror_index(c1, i1));
+    set_adjacency(newc, ccw(i0), c2->neighbor(i2), mirror_index(c2, i2));
+
+    newc->vertex(0)->set_cell(newc);
+    newc->vertex(1)->set_cell(newc);
+    newc->vertex(2)->set_cell(newc);
+
+    delete_cell(c0);
+    delete_cell(c1);
+    delete_cell(c2);
+    delete_vertex(v);
+
+    return newc;
+}
+
+template <class Vb, class Cb, class Ct>
+typename Triangulation_data_structure_3<Vb,Cb,Ct>::Cell_handle
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+remove_degree_4(Vertex_handle v)
+{
+    CGAL_triangulation_precondition(dimension() == 3);
+    CGAL_triangulation_precondition(degree(v) == 4);
+    CGAL_triangulation_precondition(number_of_vertices() >= 6);
+
+    // Cells to be killed.
+    Cell_handle c0, c1, c2, c3;
+    // Indices of v in these cells.
+    int i0, i1, i2, i3;
+
+    c0 = v->cell();
+    i0 = c0->index(v);
+    c1 = c0->neighbor(i0^1);
+    i1 = c1->index(v);
+    c2 = c0->neighbor(i0^2);
+    i2 = c2->index(v);
+    c3 = c0->neighbor(i0^3);
+    i3 = c3->index(v);
+
+    // New cell : we copy the content of c0, so we keep the orientation.
+    Cell_handle newc = create_cell(c0->vertex(0),
+                                   c0->vertex(1),
+                                   c0->vertex(2),
+                                   c0->vertex(3));
+
+    newc->set_vertex(i0, c1->vertex(c1->index(c0)));
+
+    set_adjacency(newc,   i0, c0->neighbor(i0), mirror_index(c0, i0));
+    set_adjacency(newc, i0^1, c1->neighbor(i1), mirror_index(c1, i1));
+    set_adjacency(newc, i0^2, c2->neighbor(i2), mirror_index(c2, i2));
+    set_adjacency(newc, i0^3, c3->neighbor(i3), mirror_index(c3, i3));
+
+    newc->vertex(0)->set_cell(newc);
+    newc->vertex(1)->set_cell(newc);
+    newc->vertex(2)->set_cell(newc);
+    newc->vertex(3)->set_cell(newc);
+
+    delete_cell(c0);
+    delete_cell(c1);
+    delete_cell(c2);
+    delete_cell(c3);
+    delete_vertex(v);
+
+    return newc;
+}
+
+template <class Vb, class Cb, class Ct>
+void
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+decrease_dimension(Cell_handle c, int i)
+{
+  CGAL_triangulation_expensive_precondition( is_valid() );;
+  CGAL_triangulation_precondition( dimension() >= 2);
+  CGAL_triangulation_precondition( number_of_vertices() >
+                                   (size_type) dimension() + 1 );
+  CGAL_triangulation_precondition( degree(c->vertex(i)) == number_of_vertices()-1 );
+
+  Vertex_handle v = c->vertex(i);
+  Vertex_handle w = c->vertex(i);
+
+  // the cells incident to w are down graded one dimension
+  // the other cells are deleted
+  std::vector<Cell_handle> to_delete, to_downgrade;
+
+  for (Cell_iterator ib = cells().begin();
+       ib != cells().end(); ++ib) {
+    if ( ib->has_vertex(w) )
+      to_downgrade.push_back(ib);
+    else
+      to_delete.push_back(ib);
+  }
+
+  typename std::vector<Cell_handle>::iterator lfit=to_downgrade.begin();
+  for( ; lfit != to_downgrade.end(); ++lfit) {
+    Cell_handle f = *lfit;
+    int j = f->index(w);
+    int k; 
+    if (f->has_vertex(v, k)) f->set_vertex(k, w);
+    if (j != dimension()) {
+      f->set_vertex(j, f->vertex(dimension()));
+      f->set_neighbor(j, f->neighbor(dimension()));
+      if (dimension() >= 1)
+        change_orientation(f);
+    }
+    f->set_vertex(dimension(), Vertex_handle());
+    f->set_neighbor(dimension(), Cell_handle());
+
+    // Update vertex->cell() pointers.
+    for (int i = 0; i < dimension(); ++i)
+      f->vertex(i)->set_cell(f);
+  }
+
+  delete_cells(to_delete.begin(), to_delete.end());
+
+  //delete_vertex(v);
+  set_dimension(dimension()-1);
+
+  if(dimension() == 2)
+  {
+    Cell_handle n0 = c->neighbor(0);
+    Cell_handle n1 = c->neighbor(1);
+    Cell_handle n2 = c->neighbor(2);
+    Vertex_handle v0 = c->vertex(0);
+    Vertex_handle v1 = c->vertex(1);
+    Vertex_handle v2 = c->vertex(2);
+                
+    int i0 = 0, i1 = 0, i2 = 0;
+                
+    for(int i=0; i<3; i++) if(n0->neighbor(i) == c) { i0 = i; break; }
+    for(int i=0; i<3; i++) if(n1->neighbor(i) == c) { i1 = i; break; }
+    for(int i=0; i<3; i++) if(n2->neighbor(i) == c) { i2 = i; break; }
+                
+    Cell_handle c1 = create_cell(v, v0, v1, Vertex_handle());
+    Cell_handle c2 = create_cell(v, v1, v2, Vertex_handle());
+
+    c->set_vertex(0, v);
+    c->set_vertex(1, v2);
+    c->set_vertex(2, v0);
+    c->set_vertex(3, Vertex_handle());
+
+    //Cell_handle c3 = create_cell(v, v2, v0, Vertex_handle());
+    Cell_handle c3 = c;
+                
+    c1->set_neighbor(0, n2); n2->set_neighbor(i2, c1);
+    c1->set_neighbor(1, c2); 
+    c1->set_neighbor(2, c3);
+    c1->set_neighbor(3, Cell_handle());
+                
+    c2->set_neighbor(0, n0); n0->set_neighbor(i0, c2);
+    c2->set_neighbor(1, c3); 
+    c2->set_neighbor(2, c1);
+    c2->set_neighbor(3, Cell_handle());
+                
+    c3->set_neighbor(0, n1); n1->set_neighbor(i1, c3);
+    c3->set_neighbor(1, c1); 
+    c3->set_neighbor(2, c2);
+    c3->set_neighbor(3, Cell_handle());
+                
+    v->set_cell(c1);
+    v0->set_cell(c1);
+    v1->set_cell(c1);
+    v2->set_cell(c2);
+  }
+        
+  if(dimension() == 1)
+  {
+    Cell_handle n0 = c->neighbor(0);
+    Cell_handle n1 = c->neighbor(1);
+    Vertex_handle v0 = c->vertex(0);
+    Vertex_handle v1 = c->vertex(1);
+                
+    int i0 = 0 , i1 = 0;
+                
+    for(int i=0; i<2; i++) if(n0->neighbor(i) == c) { i0 = i; break; }
+    for(int i=0; i<2; i++) if(n1->neighbor(i) == c) { i1 = i; break; }
+                
+    Cell_handle c1 = create_cell(v0, v, Vertex_handle(), Vertex_handle());
+                
+    c->set_vertex(0, v);
+    c->set_vertex(1, v1);
+    c->set_vertex(2, Vertex_handle());
+    c->set_vertex(3, Vertex_handle());
+
+    //Cell_handle c2 = create_cell(v, v1, Vertex_handle(), Vertex_handle());
+    Cell_handle c2 = c;
+                
+    c1->set_neighbor(0, c2); 
+    c1->set_neighbor(1, n1); n1->set_neighbor(i1, c1);
+    c1->set_neighbor(2, Cell_handle());
+    c1->set_neighbor(3, Cell_handle());
+                
+    c2->set_neighbor(0, n0); n0->set_neighbor(i0, c2);
+    c2->set_neighbor(1, c1); 
+    c2->set_neighbor(2, Cell_handle());
+    c2->set_neighbor(3, Cell_handle());
+                
+    v->set_cell(c1);
+    v0->set_cell(c1);
+    v1->set_cell(c2);
+  }
+        
+  CGAL_triangulation_postcondition(is_valid());
+}
+
+
+template <class Vb, class Cb, class Ct>
+typename Triangulation_data_structure_3<Vb,Cb,Ct>::size_type
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+degree(Vertex_handle v) const
+{
+    std::size_t res;
+    adjacent_vertices(v, Counting_output_iterator(&res));
+    return res;
+}
+
+template <class Vb, class Cb, class Ct>
+bool
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+is_valid(bool verbose, int level ) const
+{
+  switch ( dimension() ) {
+  case 3:
+    {
+        
+      if(number_of_vertices() <= 4) {
+        if (verbose)
+          std::cerr << "wrong number of vertices" << std::endl;
+        CGAL_triangulation_assertion(false);
+        return false;
+      }
+        
+      size_type vertex_count;
+      if ( ! count_vertices(vertex_count,verbose,level) )
+        return false;
+      if ( number_of_vertices() != vertex_count ) {
+        if (verbose)
+          std::cerr << "wrong number of vertices" << std::endl;
+        CGAL_triangulation_assertion(false);
+        return false;
+      }
+
+      size_type cell_count;
+      if ( ! count_cells(cell_count,verbose,level) )
+        return false;
+      size_type edge_count;
+      if ( ! count_edges(edge_count,verbose,level) )
+          return false;
+      size_type facet_count;
+      if ( ! count_facets(facet_count,verbose,level) )
+          return false;
+
+      // Euler relation
+      if ( cell_count - facet_count + edge_count - vertex_count != 0 ) {
+        if (verbose)
+            std::cerr << "Euler relation unsatisfied" << std::endl;
+        CGAL_triangulation_assertion(false);
+        return false;
+      }
+
+      break;
+    }
+  case 2:
+    {
+        
+      if(number_of_vertices() <= 3) {
+        if (verbose)
+          std::cerr << "wrong number of vertices" << std::endl;
+        CGAL_triangulation_assertion(false);
+        return false;
+      }
+        
+      size_type vertex_count;
+      
+      if ( ! count_vertices(vertex_count,verbose,level) )
+        return false;
+      if ( number_of_vertices() != vertex_count ) {
+        if (verbose)
+            std::cerr << "false number of vertices" << std::endl;
+        CGAL_triangulation_assertion(false);
+        return false;
+      }
+
+      size_type edge_count;
+      if ( ! count_edges(edge_count,verbose,level) )
+          return false;
+      // Euler for edges
+      if ( edge_count != 3 * vertex_count - 6 ) {
+        if (verbose)
+            std::cerr << "Euler relation unsatisfied - edges/vertices"
+                      << std::endl;
+        CGAL_triangulation_assertion(false);
+        return false;
+      }
+
+      size_type facet_count;
+      if ( ! count_facets(facet_count,verbose,level) )
+          return false;
+      // Euler for facets
+      if ( facet_count != 2 * vertex_count - 4 ) {
+        if (verbose)
+            std::cerr << "Euler relation unsatisfied - facets/vertices"
+                      << std::endl;
+        CGAL_triangulation_assertion(false);
+        return false;
+      }
+      break;
+    }
+  case 1:
+    {
+        
+      if(number_of_vertices() <= 1) {
+        if (verbose)
+          std::cerr << "wrong number of vertices" << std::endl;
+        CGAL_triangulation_assertion(false);
+        return false;
+      }
+        
+      size_type vertex_count;
+      if ( ! count_vertices(vertex_count,verbose,level) )
+          return false;
+      if ( number_of_vertices() != vertex_count ) {
+        if (verbose)
+            std::cerr << "false number of vertices" << std::endl;
+        CGAL_triangulation_assertion(false);
+        return false;
+      }
+      size_type edge_count;
+      if ( ! count_edges(edge_count,verbose,level) )
+          return false;
+      // Euler for edges
+      if ( edge_count != vertex_count ) {
+        if (verbose)
+            std::cerr << "false number of edges" << std::endl;
+        CGAL_triangulation_assertion(false);
+        return false;
+      }
+      break;
+    }
+  case 0:
+    {
+      if ( number_of_vertices() < 2 ) {
+        if (verbose)
+            std::cerr << "less than 2 vertices but dimension 0" << std::endl;
+        CGAL_triangulation_assertion(false);
+        return false;
+      }
+      // no break; continue
+    }
+  case -1:
+    {
+      if ( number_of_vertices() < 1 ) {
+        if (verbose)
+          std::cerr << "no vertex but dimension -1" << std::endl;
+        CGAL_triangulation_assertion(false);
+        return false;
+      }
+      // vertex count
+      size_type vertex_count;
+      if ( ! count_vertices(vertex_count,verbose,level) )
+        return false;
+      if ( number_of_vertices() != vertex_count ) {
+        if (verbose)
+          std::cerr << "false number of vertices" << std::endl;
+        CGAL_triangulation_assertion(false);
+        return false;
+      }
+    }
+  } // end switch
+  if (verbose)
+      std::cerr << "valid data structure" << std::endl;
+  return true;
+}
+
+template <class Vb, class Cb, class Ct>
+bool
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+is_valid(Vertex_handle v, bool verbose, int level) const
+{
+  bool result = v->is_valid(verbose,level);
+  result = result && v->cell()->has_vertex(v);
+  if ( ! result ) {
+    if ( verbose )
+      std::cerr << "invalid vertex" << std::endl;
+    CGAL_triangulation_assertion(false);
+  }
+  return result;
+}
+
+template <class Vb, class Cb, class Ct>
+bool
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+is_valid(Cell_handle c, bool verbose, int level) const
+{
+    if ( ! c->is_valid(verbose, level) )
+        return false;
+
+    switch (dimension()) {
+    case -2:
+    case -1:
+    {
+      if ( c->vertex(0) == Vertex_handle() ) {
+        if (verbose)
+            std::cerr << "vertex 0 NULL" << std::endl;
+        CGAL_triangulation_assertion(false);
+        return false;
+      }
+      is_valid(c->vertex(0),verbose,level);
+      if ( c->vertex(1) != Vertex_handle() || c->vertex(2) != Vertex_handle()) {
+        if (verbose)
+            std::cerr << "vertex 1 or 2 != NULL" << std::endl;
+        CGAL_triangulation_assertion(false);
+        return false;
+      }
+      if ( c->neighbor(0) != Cell_handle() ||
+           c->neighbor(1) != Cell_handle() ||
+           c->neighbor(2) != Cell_handle()) {
+        if (verbose)
+            std::cerr << "one neighbor != NULL" << std::endl;
+        CGAL_triangulation_assertion(false);
+        return false;
+      }
+      break;
+    }
+
+    case 0:
+      {
+      if ( c->vertex(0) == Vertex_handle() ) {
+        if (verbose)
+            std::cerr << "vertex 0 NULL" << std::endl;
+        CGAL_triangulation_assertion(false);
+        return false;
+      }
+      is_valid(c->vertex(0),verbose,level);
+      if ( c->neighbor (0) == Cell_handle() ) {
+        if (verbose)
+            std::cerr << "neighbor 0 NULL" << std::endl;
+        CGAL_triangulation_assertion(false);
+        return false;
+      }
+      if ( c->vertex(1) != Vertex_handle() ||
+           c->vertex(2) != Vertex_handle() ) {
+        if (verbose)
+            std::cerr << "vertex 1 or 2 != NULL" << std::endl;
+        CGAL_triangulation_assertion(false);
+        return false;
+      }
+      if ( c->neighbor(1) != Cell_handle() ||
+           c->neighbor(2) != Cell_handle() ) {
+        if (verbose)
+            std::cerr << "neighbor 1 or 2 != NULL" << std::endl;
+        CGAL_triangulation_assertion(false);
+        return false;
+      }
+
+      if ( ! c->neighbor(0)->has_vertex(c->vertex(0)) ) {
+        if (verbose)
+            std::cerr << "neighbor 0 does not have vertex 0" << std::endl;
+        CGAL_triangulation_assertion(false);
+        return false;
+      }
+      break;
+      }
+
+    case 1:
+      {
+      Vertex_handle v0 = c->vertex(0);
+      Vertex_handle v1 = c->vertex(1);
+      Cell_handle n0 = c->neighbor(0);
+      Cell_handle n1 = c->neighbor(1);
+
+      if ( v0 == Vertex_handle() || v1 == Vertex_handle() ) {
+        if (verbose)
+            std::cerr << "vertex 0 or 1 NULL" << std::endl;
+        CGAL_triangulation_assertion(false);
+        return false;
+      }
+      is_valid(c->vertex(0),verbose,level);
+      is_valid(c->vertex(1),verbose,level);
+      if ( n0 == Cell_handle() || n1 == Cell_handle() ) {
+        if (verbose)
+            std::cerr << "neighbor 0 or 1 NULL" << std::endl;
+        CGAL_triangulation_assertion(false);
+        return false;
+      }
+
+      if ( v0 !=  n1->vertex(1) ) {
+        if (verbose)
+            std::cerr << "neighbor 1 does not have vertex 0 as vertex 1"
+                      << std::endl;
+        CGAL_triangulation_assertion(false);
+        return false;
+      }
+      if ( v1 != n0->vertex(0) ) {
+        if (verbose)
+            std::cerr << "neighbor 0 does not have vertex 1 as vertex 0"
+                      << std::endl;
+        CGAL_triangulation_assertion(false);
+        return false;
+      }
+
+      if ( n0->neighbor(1) != c ) {
+        if (verbose)
+            std::cerr << "neighbor 0 does not have this as neighbor 1"
+                      << std::endl;
+        CGAL_triangulation_assertion(false);
+        return false;
+      }
+      if ( n1->neighbor(0) != c ) {
+        if (verbose)
+            std::cerr << "neighbor 1 does not have this as neighbor 0"
+                      << std::endl;
+        CGAL_triangulation_assertion(false);
+        return false;
+      }
+
+      break;
+      }
+
+    case 2:
+      {
+      if ( c->vertex(0) == Vertex_handle() ||
+           c->vertex(1) == Vertex_handle() ||
+           c->vertex(2) == Vertex_handle() ) {
+        if (verbose)
+            std::cerr << "vertex 0, 1, or 2 NULL" << std::endl;
+        CGAL_triangulation_assertion(false);
+        return false;
+      }
+      is_valid(c->vertex(0),verbose,level);
+      is_valid(c->vertex(1),verbose,level);
+      is_valid(c->vertex(2),verbose,level);
+      int in;
+      Cell_handle n;
+      for(int i = 0; i < 3; i++) {
+        n = c->neighbor(i);
+        if ( n == Cell_handle() ) {
+          if (verbose)
+              std::cerr << "neighbor " << i << " NULL" << std::endl;
+          CGAL_triangulation_assertion(false);
+          return false;
+        }
+        if ( ! n->has_vertex(c->vertex(cw(i)),in ) ) {
+          if (verbose)
+              std::cerr << "vertex " << cw(i)
+                        << " not vertex of neighbor " << i << std::endl;
+          CGAL_triangulation_assertion(false);
+          return false;
+        }
+        in = cw(in);
+        if ( n->neighbor(in) != c ) {
+          if (verbose)
+              std::cerr << "neighbor " << i
+                        << " does not have this as neighbor "
+                        << in << std::endl;
+          CGAL_triangulation_assertion(false);
+          return false;
+        }
+        if ( c->vertex(ccw(i)) != n->vertex(cw(in)) ) {
+          if (verbose)
+              std::cerr << "vertex " << ccw(i)
+                        << " is not vertex " << cw(in)
+                        << " of neighbor " << i << std::endl;
+          CGAL_triangulation_assertion(false);
+          return false;
+        }
+      }
+      break;
+      }
+
+    case 3:
+      {
+        int i;
+        for(i = 0; i < 4; i++) {
+          if ( c->vertex(i) == Vertex_handle() ) {
+            if (verbose)
+                std::cerr << "vertex " << i << " NULL" << std::endl;
+            CGAL_triangulation_assertion(false);
+            return false;
+          }
+          is_valid(c->vertex(i),verbose,level);
+        }
+
+        for(i = 0; i < 4; i++) {
+          Cell_handle n = c->neighbor(i);
+          if ( n == Cell_handle() ) {
+            if (verbose)
+              std::cerr << "neighbor " << i << " NULL" << std::endl;
+            CGAL_triangulation_assertion(false);
+            return false;
+          }
+
+          int in = 5;
+          // if ( ! n->has_neighbor(handle(), in) ) {
+          if ( n->neighbor(0) == c) in = 0;
+          if ( n->neighbor(1) == c) in = 1;
+          if ( n->neighbor(2) == c) in = 2;
+          if ( n->neighbor(3) == c) in = 3;
+          if (in == 5) {
+            if (verbose)
+              std::cerr << "neighbor of c has not c as neighbor" << std::endl;
+            CGAL_triangulation_assertion(false);
+            return false;
+          }
+        
+          int j1n,j2n,j3n;
+          if ( ! n->has_vertex(c->vertex((i+1)&3),j1n) ) {
+            if (verbose) { std::cerr << "vertex " << ((i+1)&3)
+                                     << " not vertex of neighbor "
+                                     << i << std::endl; }
+            CGAL_triangulation_assertion(false);
+            return false;
+          }
+          if ( ! n->has_vertex(c->vertex((i+2)&3),j2n) ) {
+            if (verbose) { std::cerr << "vertex " << ((i+2)&3)
+                                     << " not vertex of neighbor "
+                                     << i << std::endl; }
+            CGAL_triangulation_assertion(false);
+            return false;
+          }
+          if ( ! n->has_vertex(c->vertex((i+3)&3),j3n) ) {
+            if (verbose) { std::cerr << "vertex " << ((i+3)&3)
+                                     << " not vertex of neighbor "
+                                     << i << std::endl; }
+            CGAL_triangulation_assertion(false);
+            return false;
+          }
+        
+          if ( in+j1n+j2n+j3n != 6) {
+            if (verbose) { std::cerr << "sum of the indices != 6 "
+                                     << std::endl; }
+            CGAL_triangulation_assertion(false);
+            return false;
+          }
+        
+          // tests whether the orientations of this and n are consistent
+          if ( ((i+in)&1) == 0 ) { // i and in have the same parity
+            if ( j1n == ((in+1)&3) ) {
+              if ( ( j2n != ((in+3)&3) ) || ( j3n != ((in+2)&3) ) ) {
+                if (verbose)
+                  std::cerr << " pb orientation with neighbor "
+                            << i << std::endl;
+                CGAL_triangulation_assertion(false);
+                return false;
+              }
+            }
+            if ( j1n == ((in+2)&3) ) {
+              if ( ( j2n != ((in+1)&3) ) || ( j3n != ((in+3)&3) ) ) {
+                if (verbose)
+                  std::cerr << " pb orientation with neighbor "
+                            << i << std::endl;
+                CGAL_triangulation_assertion(false);
+                return false;
+              }
+            }
+            if ( j1n == ((in+3)&3) ) {
+              if ( ( j2n != ((in+2)&3) ) || ( j3n != ((in+1)&3) ) ) {
+                if (verbose)
+                  std::cerr << " pb orientation with neighbor "
+                            << i << std::endl;
+                CGAL_triangulation_assertion(false);
+                return false;
+              }
+            }
+          }
+          else { // i and in do not have the same parity
+            if ( j1n == ((in+1)&3) ) {
+              if ( ( j2n != ((in+2)&3) ) || ( j3n != ((in+3)&3) ) ) {
+                if (verbose)
+                  std::cerr << " pb orientation with neighbor "
+                            << i << std::endl;
+                CGAL_triangulation_assertion(false);
+                return false;
+              }
+            }
+            if ( j1n == ((in+2)&3) ) {
+              if ( ( j2n != ((in+3)&3) ) || ( j3n != ((in+1)&3) ) ) {
+                if (verbose)
+                  std::cerr << " pb orientation with neighbor "
+                            << i << std::endl;
+                CGAL_triangulation_assertion(false);
+                return false;
+              }
+            }
+            if ( j1n == ((in+3)&3) ) {
+              if ( ( j2n != ((in+1)&3) ) || ( j3n != ((in+2)&3) ) ) {
+                if (verbose)
+                  std::cerr << " pb orientation with neighbor "
+                            << i << std::endl;
+                CGAL_triangulation_assertion(false);
+                return false;
+              }
+            }
+          }
+        } // end looking at neighbors
+      }// end case dim 3
+    } // end switch
+    return true;
+}
+
+template <class Vb, class Cb, class Ct>
+template <class TDS_src,class ConvertVertex,class ConvertCell>
+typename Triangulation_data_structure_3<Vb,Cb,Ct>::Vertex_handle
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+copy_tds(const TDS_src& tds,
+        typename TDS_src::Vertex_handle vert,
+        const ConvertVertex& convert_vertex,
+        const ConvertCell& convert_cell)
+{
+  CGAL_triangulation_expensive_precondition( vert == Vertex_handle()
+                                          || tds.is_vertex(vert) );
+
+  clear();
+
+  size_type n = tds.number_of_vertices();
+  set_dimension(tds.dimension());
+
+  if (n == 0)  return Vertex_handle(); 
+
+  // Number of pointers to cell/vertex to copy per cell.
+  int dim = (std::max)(1, dimension() + 1);
+
+  // Create the vertices.
+  std::vector<typename TDS_src::Vertex_handle> TV(n);
+  size_type i = 0;
+
+  for (typename TDS_src::Vertex_iterator vit = tds.vertices_begin();
+       vit != tds.vertices_end(); ++vit)
+    TV[i++] = vit;
+
+  CGAL_triangulation_assertion( i == n );
+
+  Unique_hash_map< typename TDS_src::Vertex_handle,Vertex_handle > V;
+  Unique_hash_map< typename TDS_src::Cell_handle,Cell_handle > F;
+  
+  for (i=0; i <= n-1; ++i){
+    Vertex_handle vh=create_vertex( convert_vertex(*TV[i]) );
+    V[ TV[i] ] = vh;
+    convert_vertex(*TV[i],*vh);
+  }
+
+  // Create the cells.
+  for (typename TDS_src::Cell_iterator cit = tds.cells().begin();
+          cit != tds.cells_end(); ++cit) {
+      Cell_handle ch=create_cell(convert_cell(*cit));
+      F[cit]=ch;
+      for (int j = 0; j < dim; j++)
+        ch->set_vertex(j, V[cit->vertex(j)] );
+      convert_cell(*cit,*ch);
+  }
+
+  // Link the vertices to a cell.
+  for (typename TDS_src::Vertex_iterator vit2 = tds.vertices_begin();
+       vit2 != tds.vertices_end(); ++vit2)
+    V[vit2]->set_cell( F[vit2->cell()] );
+
+  // Hook neighbor pointers of the cells.
+  for (typename TDS_src::Cell_iterator cit2 = tds.cells().begin();
+          cit2 != tds.cells_end(); ++cit2) {
+    for (int j = 0; j < dim; j++)
+      F[cit2]->set_neighbor(j, F[cit2->neighbor(j)] );
+  }
+
+  CGAL_triangulation_postcondition( is_valid() );
+
+  return (vert != typename TDS_src::Vertex_handle()) ? V[vert] : Vertex_handle();
+}
+
+//utilities for copy_tds
+namespace internal { namespace TDS_3{
+  template <class Vertex_src,class Vertex_tgt>
+  struct Default_vertex_converter
+  {
+    Vertex_tgt operator()(const Vertex_src& src) const {
+      return Vertex_tgt(src.point());
+    }
+    
+    void operator()(const Vertex_src&,Vertex_tgt&) const {}
+  };
+
+  template <class Cell_src,class Cell_tgt>
+  struct Default_cell_converter
+  {
+    Cell_tgt operator()(const Cell_src&) const {
+      return Cell_tgt();
+    }
+    
+    void operator()(const Cell_src&,Cell_tgt&) const {}
+  };
+  
+  template <class Vertex>
+  struct Default_vertex_converter<Vertex,Vertex>
+  {
+    const Vertex& operator()(const Vertex& src) const {
+      return src;
+    }
+    
+    void operator()(const Vertex&,Vertex&) const {}
+  };
+  
+  template <class Cell>
+  struct Default_cell_converter<Cell,Cell>{
+    const Cell& operator()(const Cell& src) const {
+      return src;
+    } 
+    
+    void operator()(const Cell&,Cell&) const {}
+  };
+} } //namespace internal::TDS_3
+
+template <class Vb, class Cb, class Ct>
+template<class TDS_src>
+typename Triangulation_data_structure_3<Vb,Cb,Ct>::Vertex_handle
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+copy_tds(const TDS_src& src,typename TDS_src::Vertex_handle vert)
+{
+  internal::TDS_3::Default_vertex_converter<typename TDS_src::Vertex,Vertex> setv;
+  internal::TDS_3::Default_cell_converter<typename TDS_src::Cell,Cell>  setc;
+  return copy_tds(src,vert,setv,setc);
+}
+
+template <class Vb, class Cb, class Ct>
+void
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+swap(Tds & tds)
+{
+  CGAL_triangulation_expensive_precondition(tds.is_valid() && is_valid());
+
+  std::swap(_dimension, tds._dimension);
+  cells().swap(tds.cells());
+  vertices().swap(tds.vertices());
+}
+
+template <class Vb, class Cb, class Ct>
+void
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+clear()
+{
+  cells().clear();
+  vertices().clear();
+  set_dimension(-2);
+}
+
+template <class Vb, class Cb, class Ct>
+bool
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+count_vertices(size_type & i, bool verbose, int level) const
+  // counts AND checks the validity
+{
+  i = 0;
+
+  for (Vertex_iterator it = vertices_begin(); it != vertices_end(); ++it) {
+    if ( ! is_valid(it,verbose,level) ) {
+      if (verbose)
+          std::cerr << "invalid vertex" << std::endl;
+      CGAL_triangulation_assertion(false);
+      return false;
+    }
+    ++i;
+  }
+  return true;
+}
+
+template <class Vb, class Cb, class Ct>
+bool
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+count_facets(size_type & i, bool verbose, int level) const
+  // counts but does not check
+{
+  i = 0;
+
+  for (Facet_iterator it = facets_begin(); it != facets_end(); ++it) {
+    if ( ! is_valid((*it).first,verbose, level) ) {
+      if (verbose)
+          std::cerr << "invalid facet" << std::endl;
+      CGAL_triangulation_assertion(false);
+      return false;
+    }
+    ++i;
+  }
+  return true;
+}
+
+template <class Vb, class Cb, class Ct>
+bool
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+count_edges(size_type & i, bool verbose, int level) const
+  // counts but does not check
+{
+  i = 0;
+
+  for (Edge_iterator it = edges_begin(); it != edges_end(); ++it) {
+    if ( ! is_valid((*it).first,verbose, level) ) {
+      if (verbose)
+          std::cerr << "invalid edge" << std::endl;
+      CGAL_triangulation_assertion(false);
+      return false;
+    }
+    ++i;
+  }
+  return true;
+}
+
+template <class Vb, class Cb, class Ct>
+bool
+Triangulation_data_structure_3<Vb,Cb,Ct>::
+count_cells(size_type & i, bool verbose, int level) const
+  // counts AND checks the validity
+{
+  i = 0;
+
+  for (Cell_iterator it = cells_begin(); it != cells_end(); ++it) {
+    if ( ! is_valid(it,verbose, level) ) {
+      if (verbose)
+          std::cerr << "invalid cell" << std::endl;
+      CGAL_triangulation_assertion(false);
+      return false;
+    }
+    ++i;
+  }
+  return true;
+}
+
+} //namespace CGAL
+
+#endif // CGAL_TRIANGULATION_DATA_STRUCTURE_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_data_structure_using_list_2.h b/3rdparty/CGAL/include/CGAL/Triangulation_data_structure_using_list_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_data_structure_using_list_2.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_data_structure_using_list_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_default_data_structure_2.h b/3rdparty/CGAL/include/CGAL/Triangulation_default_data_structure_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_default_data_structure_2.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_default_data_structure_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_ds_cell_base_3.h b/3rdparty/CGAL/include/CGAL/Triangulation_ds_cell_base_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_ds_cell_base_3.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_ds_cell_base_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_ds_circulators_2.h b/3rdparty/CGAL/include/CGAL/Triangulation_ds_circulators_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_ds_circulators_2.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_ds_circulators_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_ds_face_2.h b/3rdparty/CGAL/include/CGAL/Triangulation_ds_face_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_ds_face_2.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_ds_face_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_ds_face_base_2.h b/3rdparty/CGAL/include/CGAL/Triangulation_ds_face_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_ds_face_base_2.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_ds_face_base_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_ds_full_cell.h b/3rdparty/CGAL/include/CGAL/Triangulation_ds_full_cell.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_ds_full_cell.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_ds_full_cell.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_ds_iterators_2.h b/3rdparty/CGAL/include/CGAL/Triangulation_ds_iterators_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_ds_iterators_2.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_ds_iterators_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_ds_vertex.h b/3rdparty/CGAL/include/CGAL/Triangulation_ds_vertex.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_ds_vertex.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_ds_vertex.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_ds_vertex_2.h b/3rdparty/CGAL/include/CGAL/Triangulation_ds_vertex_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_ds_vertex_2.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_ds_vertex_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_ds_vertex_base_2.h b/3rdparty/CGAL/include/CGAL/Triangulation_ds_vertex_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_ds_vertex_base_2.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_ds_vertex_base_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_ds_vertex_base_3.h b/3rdparty/CGAL/include/CGAL/Triangulation_ds_vertex_base_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_ds_vertex_base_3.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_ds_vertex_base_3.h
diff --git a/3rdparty/CGAL/include/CGAL/Triangulation_euclidean_traits_2.h b/3rdparty/CGAL/include/CGAL/Triangulation_euclidean_traits_2.h
new file mode 100644
index 0000000..98f19d1
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Triangulation_euclidean_traits_2.h
@@ -0,0 +1,136 @@
+// Copyright (c) 1997   INRIA Sophia-Antipolis (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
+// 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(s)     : Mariette Yvinec
+
+#ifndef CGAL_TRIANGULATION_EUCLIDEAN_TRAITS_2_H
+#define CGAL_TRIANGULATION_EUCLIDEAN_TRAITS_2_H
+
+#define CGAL_DEPRECATED_HEADER "<CGAL/Triangulation_euclidean_traits_2.h>"
+#include <CGAL/internal/deprecation_warning.h>
+
+#include <CGAL/Point_2.h>
+#include <CGAL/Segment_2.h>
+#include <CGAL/Triangle_2.h>
+#include <CGAL/Line_2.h>
+#include <CGAL/Ray_2.h>
+#include <CGAL/predicates_on_points_2.h>
+#include <CGAL/basic_constructions_2.h>
+#include <CGAL/distance_predicates_2.h>
+
+#include <CGAL/triangulation_assertions.h>
+#include <CGAL/Segment_2_Segment_2_intersection.h>
+
+namespace CGAL { 
+
+template < class R >
+class Triangulation_euclidean_traits_2 {
+public:
+  typedef R Rep;
+  typedef typename R::Point_2     Point_2;
+  typedef typename R::Segment_2   Segment_2;
+  typedef typename R::Triangle_2  Triangle_2;
+  typedef typename R::Line_2      Line_2;
+  typedef typename R::Ray_2       Ray_2;
+
+  typedef typename R::Less_x_2                   Less_x_2;
+  typedef typename R::Less_y_2                   Less_y_2;
+  typedef typename R::Compare_x_2                Compare_x_2;
+  typedef typename R::Compare_y_2                Compare_y_2;
+  typedef typename R::Orientation_2              Orientation_2;
+  typedef typename R::Side_of_oriented_circle_2  Side_of_oriented_circle_2;
+  typedef typename R::Construct_circumcenter_2   Construct_circumcenter_2;
+  typedef typename R::Construct_bisector_2       Construct_bisector_2;
+  typedef typename R::Compare_distance_2         Compare_distance_2;
+  typedef typename R::Construct_segment_2        Construct_segment_2;
+  typedef typename R::Construct_triangle_2       Construct_triangle_2;
+  typedef typename R::Construct_direction_2      Construct_direction_2;
+  typedef typename R::Construct_ray_2            Construct_ray_2;
+  
+  //for natural_neighbor_coordinates_2
+  typedef typename R::FT                         FT;
+  typedef typename R::Equal_x_2                  Equal_x_2;
+  typedef typename R::Compute_area_2             Compute_area_2;
+  Compute_area_2 compute_area_2_object () const {return Compute_area_2();}
+  
+  // for compatibility with previous versions
+  typedef Point_2      Point;
+  typedef Segment_2    Segment;
+  typedef Triangle_2   Triangle;
+  typedef Ray_2        Ray;
+  typedef Line_2       Line;
+
+  Triangulation_euclidean_traits_2() {}
+  Triangulation_euclidean_traits_2(const Triangulation_euclidean_traits_2 &) {}
+  Triangulation_euclidean_traits_2 &operator=
+      (const Triangulation_euclidean_traits_2 &)
+  {return *this;}
+ 
+  Less_x_2
+  less_x_2_object() const
+    { return Less_x_2();}
+
+  Less_y_2
+  less_y_2_object() const
+    { return Less_y_2();}
+  
+  Compare_x_2
+  compare_x_2_object() const
+    { return Compare_x_2();}
+
+  Compare_y_2
+  compare_y_2_object() const
+    { return Compare_y_2();}
+  
+  Orientation_2
+  orientation_2_object() const
+    { return Orientation_2();}
+
+  Side_of_oriented_circle_2
+  side_of_oriented_circle_2_object() const
+    {return Side_of_oriented_circle_2();}
+ 
+  Construct_circumcenter_2
+  construct_circumcenter_2_object() const
+    { return Construct_circumcenter_2();}
+
+  Construct_bisector_2
+  construct_bisector_2_object() const
+    {return Construct_bisector_2();}
+  
+  Compare_distance_2
+  compare_distance_2_object() const
+    {return Compare_distance_2();}
+
+  Construct_segment_2  construct_segment_2_object() const
+    {return Construct_segment_2();}
+
+  Construct_triangle_2  construct_triangle_2_object() const
+    {return Construct_triangle_2();}
+
+  Construct_direction_2  construct_direction_2_object() const
+    {return Construct_direction_2();}
+
+  Construct_ray_2  construct_ray_2_object() const
+    {return Construct_ray_2();}
+
+};
+
+} //namespace CGAL 
+
+#endif // CGAL_TRIANGULATION_EUCLIDEAN_TRAITS_2_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_face.h b/3rdparty/CGAL/include/CGAL/Triangulation_face.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_face.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_face.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_face_base_2.h b/3rdparty/CGAL/include/CGAL/Triangulation_face_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_face_base_2.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_face_base_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_face_base_with_info_2.h b/3rdparty/CGAL/include/CGAL/Triangulation_face_base_with_info_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_face_base_with_info_2.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_face_base_with_info_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_full_cell.h b/3rdparty/CGAL/include/CGAL/Triangulation_full_cell.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_full_cell.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_full_cell.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_geom_traits_3.h b/3rdparty/CGAL/include/CGAL/Triangulation_geom_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_geom_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_geom_traits_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_hierarchy_2.h b/3rdparty/CGAL/include/CGAL/Triangulation_hierarchy_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_hierarchy_2.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_hierarchy_2.h
diff --git a/3rdparty/CGAL/include/CGAL/Triangulation_hierarchy_3.h b/3rdparty/CGAL/include/CGAL/Triangulation_hierarchy_3.h
new file mode 100644
index 0000000..c96760a
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Triangulation_hierarchy_3.h
@@ -0,0 +1,844 @@
+// Copyright (c) 1998, 2001, 2003  INRIA Sophia-Antipolis (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
+// 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(s)     : Olivier Devillers <Olivier.Devillers at sophia.inria.fr>
+//                 Sylvain Pion
+
+#ifndef CGAL_TRIANGULATION_HIERARCHY_3_H
+#define CGAL_TRIANGULATION_HIERARCHY_3_H
+
+#include <CGAL/basic.h>
+#include <CGAL/triangulation_assertions.h>
+#include <CGAL/Triangulation_hierarchy_vertex_base_3.h>
+#include <CGAL/Location_policy.h>
+
+#include <boost/random/linear_congruential.hpp>
+#include <boost/random/geometric_distribution.hpp>
+#include <boost/random/variate_generator.hpp>
+
+#ifndef CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
+#include <CGAL/Spatial_sort_traits_adapter_3.h>
+#include <CGAL/internal/info_check.h>
+
+#include <boost/tuple/tuple.hpp>
+#include <boost/iterator/zip_iterator.hpp>
+#include <boost/mpl/and.hpp>
+#endif //CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
+
+namespace CGAL {
+
+// This class is deprecated, but must be kept for backward compatibility.
+//
+// It would be better to move its content to the Delaunay_triangulation_3
+// specializations for Fast_location and make Triangulation_hierarchy_3 the
+// empty nutshell instead.
+//
+// Then, later, maybe merge the Compact/Fast codes in a cleaner factorized way.
+
+template < class Tr >
+class Triangulation_hierarchy_3
+  : public Tr
+{
+  // parameterization of the hierarchy
+  // maximal number of points is 30^5 = 24 millions !
+  enum { ratio = 30 };
+  enum { minsize = 20};
+  enum { maxlevel = 5};
+
+public:
+  typedef Tr                                   Tr_Base;
+  typedef Fast_location                        Location_policy;
+  typedef typename Tr_Base::Geom_traits        Geom_traits;
+  typedef typename Tr_Base::Point              Point;
+  typedef typename Tr_Base::size_type          size_type;
+  typedef typename Tr_Base::Vertex_handle      Vertex_handle;
+  typedef typename Tr_Base::Cell_handle        Cell_handle;
+  typedef typename Tr_Base::Vertex_iterator    Vertex_iterator;
+  typedef typename Tr_Base::Vertex             Vertex;
+  typedef typename Tr_Base::Locate_type        Locate_type;
+  typedef typename Tr_Base::Finite_vertices_iterator  Finite_vertices_iterator;
+  typedef typename Tr_Base::Finite_cells_iterator     Finite_cells_iterator;
+  typedef typename Tr_Base::Finite_facets_iterator    Finite_facets_iterator;
+  typedef typename Tr_Base::Finite_edges_iterator     Finite_edges_iterator;
+
+  using Tr_Base::number_of_vertices;
+  using Tr_Base::geom_traits;
+
+private:
+
+  // here is the stack of triangulations which form the hierarchy
+  Tr_Base*       hierarchy[maxlevel];
+  boost::rand48  random;
+
+  void set_up_down(Vertex_handle up, Vertex_handle down)
+  {
+    up->set_down(down);
+    down->set_up(up);
+  }
+
+public:
+
+  Triangulation_hierarchy_3(const Geom_traits& traits = Geom_traits());
+
+  Triangulation_hierarchy_3(const Triangulation_hierarchy_3& tr);
+
+  template < typename InputIterator >
+  Triangulation_hierarchy_3(InputIterator first, InputIterator last,
+                            const Geom_traits& traits = Geom_traits())
+    : Tr_Base(traits)
+  {
+      hierarchy[0] = this;
+      for(int i=1; i<maxlevel; ++i)
+          hierarchy[i] = new Tr_Base(traits);
+      insert(first, last);
+  }
+
+  Triangulation_hierarchy_3 & operator=(const Triangulation_hierarchy_3& tr)
+  {
+    Triangulation_hierarchy_3 tmp(tr);
+    swap(tmp);
+    return *this;
+  }
+
+  ~Triangulation_hierarchy_3();
+
+  void swap(Triangulation_hierarchy_3 &tr);
+
+  void clear();
+
+  // CHECKING
+  bool is_valid(bool verbose = false, int level = 0) const;
+
+  // INSERT REMOVE
+  Vertex_handle insert(const Point &p, Vertex_handle hint)
+  {
+    return insert(p, hint == Vertex_handle() ? this->infinite_cell() : hint->cell());
+  }
+
+  Vertex_handle insert(const Point &p, Cell_handle start = Cell_handle ());
+
+  Vertex_handle insert(const Point &p, Locate_type lt, Cell_handle loc,
+                       int li, int lj);
+
+#ifndef CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
+  template < class InputIterator >
+  std::ptrdiff_t
+  insert( InputIterator first, InputIterator last,
+          typename boost::enable_if<
+            boost::is_convertible<
+                typename std::iterator_traits<InputIterator>::value_type,
+                Point
+            >
+          >::type* = NULL
+  )
+#else
+  template < class InputIterator >
+  std::ptrdiff_t
+  insert( InputIterator first, InputIterator last)
+#endif //CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
+  {
+    size_type n = number_of_vertices();
+
+      std::vector<Point> points (first, last);
+      spatial_sort (points.begin(), points.end(), geom_traits());
+
+      // hints[i] is the vertex of the previously inserted point in level i.
+      // Thanks to spatial sort, they are better hints than what the hierarchy
+      // would give us.
+      Vertex_handle hints[maxlevel];
+      for (typename std::vector<Point>::const_iterator p = points.begin(), end = points.end();
+              p != end; ++p)
+      {
+          int vertex_level = random_level();
+
+          Vertex_handle v = hints[0] = hierarchy[0]->insert (*p, hints[0]);
+          Vertex_handle prev = v;
+
+          for (int level = 1; level <= vertex_level; ++level) {
+              v = hints[level] = hierarchy[level]->insert (*p, hints[level]);
+	      set_up_down(v, prev);
+              prev = v;
+          }
+      }
+      return number_of_vertices() - n;
+  }
+
+#ifndef CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
+private:
+  //top stands for tuple-or-pair
+  template <class Info>
+  const Point& top_get_first(const std::pair<Point,Info>& pair) const { return pair.first; }
+  template <class Info>
+  const Info& top_get_second(const std::pair<Point,Info>& pair) const { return pair.second; }
+  template <class Info>
+  const Point& top_get_first(const boost::tuple<Point,Info>& tuple) const { return boost::get<0>(tuple); }
+  template <class Info>
+  const Info& top_get_second(const boost::tuple<Point,Info>& tuple) const { return boost::get<1>(tuple); }
+
+  template <class Tuple_or_pair,class InputIterator>
+  std::ptrdiff_t insert_with_info(InputIterator first,InputIterator last)
+  {
+    size_type n = number_of_vertices();
+    std::vector<std::size_t> indices;
+    std::vector<Point> points;
+    std::vector<typename Vertex::Info> infos;
+    std::size_t index=0;
+    for (InputIterator it=first;it!=last;++it){
+      Tuple_or_pair value=*it;
+      points.push_back( top_get_first(value)  );
+      infos.push_back ( top_get_second(value) );
+      indices.push_back(index++);
+    }
+    typedef typename Pointer_property_map<Point>::type Pmap;
+    typedef Spatial_sort_traits_adapter_3<Geom_traits,Pmap> Search_traits;
+
+    spatial_sort(indices.begin(),
+                 indices.end(),
+                 Search_traits(make_property_map(points),geom_traits()));
+
+
+    // hints[i] is the vertex of the previously inserted point in level i.
+    // Thanks to spatial sort, they are better hints than what the hierarchy
+    // would give us.
+    Vertex_handle hints[maxlevel];
+    for (typename std::vector<std::size_t>::const_iterator
+      it = indices.begin(), end = indices.end();
+      it != end; ++it)
+    {
+        int vertex_level = random_level();
+
+        Vertex_handle v = hints[0] = hierarchy[0]->insert (points[*it], hints[0]);
+        v->info()=infos[*it];
+        Vertex_handle prev = v;
+
+        for (int level = 1; level <= vertex_level; ++level) {
+            v = hints[level] = hierarchy[level]->insert (points[*it], hints[level]);
+            set_up_down(v, prev);
+            prev = v;
+        }
+    }
+    return number_of_vertices() - n;
+  }
+
+public:
+
+  template < class InputIterator >
+  std::ptrdiff_t
+  insert( InputIterator first,
+          InputIterator last,
+          typename boost::enable_if<
+            boost::is_convertible<
+              typename std::iterator_traits<InputIterator>::value_type,
+              std::pair<Point,typename internal::Info_check<Vertex>::type>
+            > >::type* =NULL
+  )
+  {
+    return insert_with_info< std::pair<Point,typename internal::Info_check<Vertex>::type> >(first,last);
+  }
+
+  template <class  InputIterator_1,class InputIterator_2>
+  std::ptrdiff_t
+  insert( boost::zip_iterator< boost::tuple<InputIterator_1,InputIterator_2> > first,
+          boost::zip_iterator< boost::tuple<InputIterator_1,InputIterator_2> > last,
+          typename boost::enable_if<
+            boost::mpl::and_<
+              boost::is_convertible< typename std::iterator_traits<InputIterator_1>::value_type, Point >,
+              boost::is_convertible< typename std::iterator_traits<InputIterator_2>::value_type, typename internal::Info_check<Vertex>::type >
+            >
+          >::type* =NULL
+  )
+  {
+    return insert_with_info< boost::tuple<Point,typename internal::Info_check<Vertex>::type> >(first,last);
+  }
+#endif //CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
+
+  void remove(Vertex_handle v);
+
+  template < typename InputIterator >
+  size_type remove(InputIterator first, InputIterator beyond)
+  {
+    size_type n = number_of_vertices();
+    while (first != beyond) {
+      remove(*first);
+      ++first;
+    }
+    return n - number_of_vertices();
+  }
+
+  template < typename InputIterator >
+  size_type remove_cluster(InputIterator first, InputIterator beyond)
+  {
+    CGAL_triangulation_precondition(!this->does_repeat_in_range(first, beyond));
+    CGAL_triangulation_precondition(!this->infinite_vertex_in_range(first, beyond));
+    size_type n = this->number_of_vertices();
+    std::vector<Vertex_handle> vo(first, beyond), vc;
+    int l=0;
+    while(1) {
+      size_type n = vo.size();
+      if(n == 0) break;
+      for(size_type i=0; i<n; i++) {
+        if(vo[i]->up() != Vertex_handle()) vc.push_back(vo[i]->up());
+      }
+      hierarchy[l++]->remove_cluster(vo.begin(), vo.end());
+      std::swap(vo,vc);
+      vc.clear();
+    }
+    return n - this->number_of_vertices();
+  }
+
+#ifndef CGAL_NO_DEPRECATED_CODE
+  CGAL_DEPRECATED Vertex_handle move_point(Vertex_handle v, const Point & p);
+#endif
+
+  Vertex_handle move_if_no_collision(Vertex_handle v, const Point &p);
+  Vertex_handle move(Vertex_handle v, const Point &p);
+
+public: // some internal methods
+
+  // INSERT REMOVE DISPLACEMENT
+  // GIVING NEW FACES
+
+  template <class OutputItCells>
+  Vertex_handle insert_and_give_new_cells(const Point  &p, 
+                                          OutputItCells fit,
+                                          Cell_handle start = Cell_handle() );
+		
+  template <class OutputItCells>
+  Vertex_handle insert_and_give_new_cells(const Point& p,
+                                          OutputItCells /* fit */,
+                                          Vertex_handle hint)
+  {
+    return insert_and_give_new_cells(p, hint == Vertex_handle() ? 
+                                     this->infinite_cell() : hint->cell());			
+  }
+
+  template <class OutputItCells>
+  Vertex_handle insert_and_give_new_cells(const Point& p,
+                                          Locate_type lt,
+                                          Cell_handle c, int li, int lj, 
+                                          OutputItCells fit);
+
+  template <class OutputItCells>
+  void remove_and_give_new_cells(Vertex_handle v, 
+                                 OutputItCells fit);
+
+  template <class OutputItCells>
+  Vertex_handle move_if_no_collision_and_give_new_cells(Vertex_handle v, 
+                                                        const Point &p, OutputItCells fit);
+	
+public:	
+
+
+  //LOCATE
+  Cell_handle locate(const Point& p, Locate_type& lt, int& li, int& lj,
+                     Vertex_handle hint) const
+  {
+    return locate(p, lt, li, lj, hint == Vertex_handle() ? this->infinite_cell() : hint->cell());
+  }
+
+  Cell_handle locate(const Point& p, Vertex_handle hint) const
+  {
+    return locate(p, hint == Vertex_handle() ? this->infinite_cell() : hint->cell());
+  }
+
+  Cell_handle locate(const Point& p, Locate_type& lt, int& li, int& lj,
+                     Cell_handle start = Cell_handle ()) const;
+
+  Cell_handle locate(const Point& p, Cell_handle start = Cell_handle ()) const;
+
+  Vertex_handle
+  nearest_vertex(const Point& p, Cell_handle start = Cell_handle()) const;
+
+protected:
+
+  struct locs {
+      Cell_handle pos;
+      int li, lj;
+      Locate_type lt;
+  };
+
+  void locate(const Point& p, Locate_type& lt, int& li, int& lj,
+	      locs pos[maxlevel], Cell_handle start = Cell_handle ()) const;
+
+  int random_level();
+};
+
+
+template <class Tr >
+Triangulation_hierarchy_3<Tr>::
+Triangulation_hierarchy_3(const Geom_traits& traits)
+  : Tr_Base(traits)
+{
+  hierarchy[0] = this;
+  for(int i=1;i<maxlevel;++i)
+    hierarchy[i] = new Tr_Base(traits);
+}
+
+// copy constructor duplicates vertices and cells
+template <class Tr>
+Triangulation_hierarchy_3<Tr>::
+Triangulation_hierarchy_3(const Triangulation_hierarchy_3<Tr> &tr)
+    : Tr_Base(tr)
+{
+  hierarchy[0] = this;
+  for(int i=1; i<maxlevel; ++i)
+    hierarchy[i] = new Tr_Base(*tr.hierarchy[i]);
+
+  // up and down have been copied in straightforward way
+  // compute a map at lower level
+
+  std::map< Vertex_handle, Vertex_handle > V;
+
+  for( Finite_vertices_iterator it = hierarchy[0]->finite_vertices_begin(),
+       end = hierarchy[0]->finite_vertices_end(); it != end; ++it)
+    if (it->up() != Vertex_handle())
+      V[ it->up()->down() ] = it;
+
+  for(int j=1; j<maxlevel; ++j) {
+    for( Finite_vertices_iterator it = hierarchy[j]->finite_vertices_begin(),
+	 end = hierarchy[j]->finite_vertices_end(); it != end; ++it) {
+	// current it->down() pointer goes in original instead in copied triangulation
+	set_up_down(it, V[it->down()]);
+	// make map for next level
+	if (it->up() != Vertex_handle())
+	    V[ it->up()->down() ] = it;
+    }
+  }
+}
+
+template <class Tr>
+void
+Triangulation_hierarchy_3<Tr>::
+swap(Triangulation_hierarchy_3<Tr> &tr)
+{
+  Tr_Base::swap(tr);
+  for(int i=1; i<maxlevel; ++i)
+      std::swap(hierarchy[i], tr.hierarchy[i]);
+}
+
+template <class Tr>
+Triangulation_hierarchy_3<Tr>::
+~Triangulation_hierarchy_3()
+{
+  clear();
+  for(int i=1; i<maxlevel; ++i) {
+    delete hierarchy[i];
+  }
+}
+
+template <class Tr>
+void
+Triangulation_hierarchy_3<Tr>::
+clear()
+{
+  for(int i=0;i<maxlevel;++i)
+    hierarchy[i]->clear();
+}
+
+template <class Tr>
+bool
+Triangulation_hierarchy_3<Tr>::
+is_valid(bool verbose, int level) const
+{
+  bool result = true;
+
+  // verify correctness of triangulation at all levels
+  for(int i=0; i<maxlevel; ++i)
+	result = result && hierarchy[i]->is_valid(verbose, level);
+
+  // verify that lower level has no down pointers
+  for( Finite_vertices_iterator it = hierarchy[0]->finite_vertices_begin(),
+       end = hierarchy[0]->finite_vertices_end(); it != end; ++it)
+    result = result && (it->down() == Vertex_handle());
+
+  // verify that other levels has down pointer and reciprocal link is fine
+  for(int j=1; j<maxlevel; ++j)
+    for( Finite_vertices_iterator it = hierarchy[j]->finite_vertices_begin(),
+	 end = hierarchy[j]->finite_vertices_end(); it != end; ++it)
+      result = result && &*(it) == &*(it->down()->up());
+
+  // verify that other levels has down pointer and reciprocal link is fine
+  for(int k=0; k<maxlevel-1; ++k)
+    for( Finite_vertices_iterator it = hierarchy[k]->finite_vertices_begin(),
+	 end = hierarchy[k]->finite_vertices_end(); it != end; ++it)
+      result = result && ( it->up() == Vertex_handle() ||
+	        &*it == &*(it->up())->down() );
+
+  return result;
+}
+
+template <class Tr>
+typename Triangulation_hierarchy_3<Tr>::Vertex_handle
+Triangulation_hierarchy_3<Tr>::
+insert(const Point &p, Cell_handle start)
+{
+  int vertex_level = random_level();
+  Locate_type lt;
+  int i, j;
+  // locate using hierarchy
+  locs positions[maxlevel];
+  locate(p, lt, i, j, positions, start);
+  // insert at level 0
+  Vertex_handle vertex = hierarchy[0]->insert(p,
+	                                      positions[0].lt,
+	                                      positions[0].pos,
+	                                      positions[0].li,
+	                                      positions[0].lj);
+  Vertex_handle previous = vertex;
+  Vertex_handle first = vertex;
+
+  int level = 1;
+  while (level <= vertex_level ){
+      if (positions[level].pos == Cell_handle())
+          vertex = hierarchy[level]->insert(p);
+      else
+          vertex = hierarchy[level]->insert(p,
+	                                    positions[level].lt,
+	                                    positions[level].pos,
+	                                    positions[level].li,
+	                                    positions[level].lj);
+    set_up_down(vertex, previous);
+    previous=vertex;
+    level++;
+  }
+  return first;
+}
+
+template <class Tr>
+template <class OutputItCells>
+typename Triangulation_hierarchy_3<Tr>::Vertex_handle
+Triangulation_hierarchy_3<Tr>::
+insert_and_give_new_cells(const Point &p, OutputItCells fit, Cell_handle start)
+{
+  int vertex_level = random_level();
+  Locate_type lt;
+  int i, j;
+  // locate using hierarchy
+  locs positions[maxlevel];
+  locate(p, lt, i, j, positions, start);
+  // insert at level 0
+  Vertex_handle vertex = hierarchy[0]->insert_and_give_new_cells(p,
+                                                                 positions[0].lt,
+                                                                 positions[0].pos,
+                                                                 positions[0].li,
+                                                                 positions[0].lj,fit);
+  Vertex_handle previous = vertex;
+  Vertex_handle first = vertex;
+
+  int level = 1;
+  while (level <= vertex_level ){
+    if (positions[level].pos == Cell_handle())
+      vertex = hierarchy[level]->insert(p);
+    else
+      vertex = hierarchy[level]->insert(p,
+                                        positions[level].lt,
+                                        positions[level].pos,
+                                        positions[level].li,
+                                        positions[level].lj);
+    set_up_down(vertex, previous);
+    previous=vertex;
+    level++;
+  }
+  return first;
+}
+
+template <class Tr>
+typename Triangulation_hierarchy_3<Tr>::Vertex_handle
+Triangulation_hierarchy_3<Tr>::
+insert(const Point &p, Locate_type lt, Cell_handle loc, int li, int lj)
+{
+  int vertex_level = random_level();
+  // insert at level 0
+  Vertex_handle vertex = hierarchy[0]->insert(p,lt,loc,li,lj);
+  Vertex_handle previous = vertex;
+  Vertex_handle first = vertex;
+
+  if (vertex_level > 0) {
+    Locate_type lt;
+    int i, j;
+    // locate using hierarchy
+    locs positions[maxlevel];
+    locate(p, lt, i, j, positions, vertex->cell());
+
+    int level = 1;
+    while (level <= vertex_level ){
+      if (positions[level].pos == Cell_handle())
+	vertex = hierarchy[level]->insert(p);
+      else
+	vertex = hierarchy[level]->insert(p,
+	    positions[level].lt,
+	    positions[level].pos,
+	    positions[level].li,
+	    positions[level].lj);
+      set_up_down(vertex, previous);
+      previous=vertex;
+      level++;
+    }
+  }
+  return first;
+}
+
+template <class Tr>
+template <class OutputItCells>
+typename Triangulation_hierarchy_3<Tr>::Vertex_handle
+Triangulation_hierarchy_3<Tr>::
+insert_and_give_new_cells(const Point &p, Locate_type lt, Cell_handle loc, 
+  int li, int lj, OutputItCells fit)
+{
+  int vertex_level = random_level();
+  // insert at level 0
+  Vertex_handle vertex = 
+    hierarchy[0]->insert_and_give_new_cells(p,lt,loc,li,lj,fit);
+  Vertex_handle previous = vertex;
+  Vertex_handle first = vertex;
+
+  if (vertex_level > 0) {
+    Locate_type lt;
+    int i, j;
+    // locate using hierarchy
+    locs positions[maxlevel];
+    locate(p, lt, i, j, positions, vertex->cell());
+
+    int level = 1;
+    while (level <= vertex_level ){
+      if (positions[level].pos == Cell_handle())
+	vertex = hierarchy[level]->insert(p);
+      else
+	vertex = hierarchy[level]->insert(p,
+                                          positions[level].lt,
+                                          positions[level].pos,
+                                          positions[level].li,
+                                          positions[level].lj);
+      set_up_down(vertex, previous);
+      previous=vertex;
+      level++;
+    }
+  }
+  return first;
+}
+
+template <class Tr>
+void
+Triangulation_hierarchy_3<Tr>::
+remove(Vertex_handle v)
+{
+  CGAL_triangulation_precondition(v != Vertex_handle());
+  for (int l = 0; l < maxlevel; ++l) {
+    Vertex_handle u = v->up();
+    hierarchy[l]->remove(v);
+    if (u == Vertex_handle())
+	break;
+    v = u;
+  }
+}
+
+template <class Tr>
+template <class OutputItCells>
+void
+Triangulation_hierarchy_3<Tr>::
+remove_and_give_new_cells(Vertex_handle v, OutputItCells fit)
+{
+  CGAL_triangulation_precondition(v != Vertex_handle());
+  CGAL_triangulation_precondition(!is_infinite(v));
+  for (int l = 0; l < maxlevel; ++l) {
+    Vertex_handle u = v->up();
+    if(l) hierarchy[l]->remove(v);
+    else hierarchy[l]->remove_and_give_new_cells(v, fit);
+    if (u == Vertex_handle())
+	break;
+    v = u;
+  }
+}
+
+#ifndef CGAL_NO_DEPRECATED_CODE
+template < class Tr >
+typename Triangulation_hierarchy_3<Tr>::Vertex_handle
+Triangulation_hierarchy_3<Tr>::
+move_point(Vertex_handle v, const Point & p)
+{
+  CGAL_triangulation_precondition(v != Vertex_handle());
+  Vertex_handle old, ret;
+
+  for (std::size_t l = 0; l < maxlevel; ++l) {
+    Vertex_handle u = v->up();
+    Vertex_handle w = hierarchy[l]->move_point(v, p);
+    if (l == 0) {
+	ret = w;
+    }
+    else {
+        set_up_down(w, old);
+    }
+    if (u == Vertex_handle())
+	break;
+    old = w;
+    v = u;
+  }
+
+  return ret;
+}
+#endif
+
+template <class Tr>
+typename Triangulation_hierarchy_3<Tr>::Vertex_handle
+Triangulation_hierarchy_3<Tr>::
+move_if_no_collision(Vertex_handle v, const Point & p)
+{
+  CGAL_triangulation_precondition(!this->is_infinite(v));	
+  if(v->point() == p) return v;
+  Vertex_handle ans;
+  for (int l = 0; l < maxlevel; ++l) {
+    Vertex_handle u = v->up();
+    if(l) hierarchy[l]->move_if_no_collision(v, p);
+    else ans = hierarchy[l]->move_if_no_collision(v, p);
+    if(ans != v) return ans;
+    if (u == Vertex_handle())
+      break;
+    v = u;
+  }
+  return ans;
+}
+
+template <class Tr>
+typename Triangulation_hierarchy_3<Tr>::Vertex_handle
+Triangulation_hierarchy_3<Tr>::
+move(Vertex_handle v, const Point & p)
+{
+  CGAL_triangulation_precondition(!this->is_infinite(v));
+  if(v->point() == p) return v;
+  Vertex_handle w = move_if_no_collision(v,p);
+  if(w != v) {
+    remove(v);
+    return w;
+  }
+  return v;
+}
+
+template <class Tr>
+template <class OutputItCells>
+typename Triangulation_hierarchy_3<Tr>::Vertex_handle
+Triangulation_hierarchy_3<Tr>::
+move_if_no_collision_and_give_new_cells(
+  Vertex_handle v, const Point & p, OutputItCells fit)
+{
+  CGAL_triangulation_precondition(!is_infinite(v));	
+  if(v->point() == p) return v;
+  Vertex_handle ans;
+  for (int l = 0; l < maxlevel; ++l) {
+    Vertex_handle u = v->up();
+    if(l) hierarchy[l]->move_if_no_collision(v, p);
+    else ans = 
+           hierarchy[l]->move_if_no_collision_and_give_new_cells(v, p, fit);
+    if(ans != v) return ans;
+    if (u == Vertex_handle())
+      break;
+    v = u;
+  }
+  return ans;
+}
+
+template <class Tr>
+inline
+typename Triangulation_hierarchy_3<Tr>::Cell_handle
+Triangulation_hierarchy_3<Tr>::
+locate(const Point& p, Locate_type& lt, int& li, int& lj, Cell_handle start) const
+{
+  if (start != Cell_handle ())
+    return Tr_Base::locate (p, lt, li, lj, start);
+  locs positions[maxlevel];
+  locate(p, lt, li, lj, positions);
+  return positions[0].pos;
+}
+
+template <class Tr>
+inline
+typename Triangulation_hierarchy_3<Tr>::Cell_handle
+Triangulation_hierarchy_3<Tr>::
+locate(const Point& p, Cell_handle start) const
+{
+  if (start != Cell_handle ())
+    return Tr_Base::locate (p, start);
+  Locate_type lt;
+  int li, lj;
+  return locate(p, lt, li, lj);
+}
+
+template <class Tr>
+void
+Triangulation_hierarchy_3<Tr>::
+locate(const Point& p, Locate_type& lt, int& li, int& lj,
+       locs pos[maxlevel], Cell_handle start) const
+{
+  int level = maxlevel;
+
+  // find the highest level with enough vertices
+  while (hierarchy[--level]->number_of_vertices() < (size_type) minsize) {
+    if ( ! level)
+	break;  // do not go below 0
+  }
+
+  for (int i=level+1; i<maxlevel; ++i)
+      pos[i].pos = Cell_handle();
+
+  Cell_handle position = Cell_handle();
+  while(level > 0) {
+    // locate at that level from "position"
+    // result is stored in "position" for the next level
+    pos[level].pos = position = hierarchy[level]->locate(p,
+	                                                 pos[level].lt,
+	                                                 pos[level].li,
+	                                                 pos[level].lj,
+	                                                 position);
+    // find the nearest vertex.
+    Vertex_handle nearest = hierarchy[level]->nearest_vertex_in_cell(p, position);
+
+    // go at the same vertex on level below
+    nearest = nearest->down();
+    position = nearest->cell();                // incident cell
+    --level;
+  }
+
+  if (start != Cell_handle())
+    position = start;
+
+  pos[0].pos = hierarchy[0]->locate(p, lt, li, lj, position); // at level 0
+  pos[0].lt = lt;
+  pos[0].li = li;
+  pos[0].lj = lj;
+}
+
+template <class Tr>
+typename Triangulation_hierarchy_3<Tr>::Vertex_handle
+Triangulation_hierarchy_3<Tr>::
+nearest_vertex(const Point& p, Cell_handle start) const
+{
+    return Tr_Base::nearest_vertex(p, start != Cell_handle() ? start : locate(p));
+}
+
+template <class Tr>
+int
+Triangulation_hierarchy_3<Tr>::
+random_level()
+{
+  boost::geometric_distribution<> proba(1.0/ratio);
+  boost::variate_generator<boost::rand48&, boost::geometric_distribution<> > die(random, proba);
+
+  return (std::min)(die(), (int)maxlevel)-1;
+}
+
+} //namespace CGAL
+
+#endif // CGAL_TRIANGULATION_HIERARCHY_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_hierarchy_vertex_base_2.h b/3rdparty/CGAL/include/CGAL/Triangulation_hierarchy_vertex_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_hierarchy_vertex_base_2.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_hierarchy_vertex_base_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_hierarchy_vertex_base_3.h b/3rdparty/CGAL/include/CGAL/Triangulation_hierarchy_vertex_base_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_hierarchy_vertex_base_3.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_hierarchy_vertex_base_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_incremental_builder_3.h b/3rdparty/CGAL/include/CGAL/Triangulation_incremental_builder_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_incremental_builder_3.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_incremental_builder_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_iterator_adaptator.h b/3rdparty/CGAL/include/CGAL/Triangulation_iterator_adaptator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_iterator_adaptator.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_iterator_adaptator.h
diff --git a/3rdparty/CGAL/include/CGAL/Triangulation_line_face_circulator_2.h b/3rdparty/CGAL/include/CGAL/Triangulation_line_face_circulator_2.h
new file mode 100644
index 0000000..7f77d91
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Triangulation_line_face_circulator_2.h
@@ -0,0 +1,698 @@
+// Copyright (c) 1997  INRIA Sophia-Antipolis (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
+// 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(s)     : Mariette Yvinec
+
+
+#ifndef CGAL_TRIANGULATION_LINE_FACE_CIRCULATOR_2_H
+#define CGAL_TRIANGULATION_LINE_FACE_CIRCULATOR_2_H
+
+#include <CGAL/circulator.h>
+#include <CGAL/Triangulation_utils_2.h>
+#include <CGAL/triangulation_assertions.h>
+
+namespace CGAL {
+
+
+template <class Triangulation_ > //  < class Gt, class Tds >
+class Triangulation_line_face_circulator_2
+  :   public Bidirectional_circulator_base< typename Triangulation_::Triangulation_data_structure::Face,
+	                                    std::ptrdiff_t,
+                                            std::size_t>,
+      public Triangulation_cw_ccw_2
+{
+public:
+
+  typedef Triangulation_line_face_circulator_2<Triangulation_> Line_face_circulator;
+  typedef Triangulation_                      Triangulation;
+  typedef typename Triangulation::Geom_traits  Gt;
+  typedef typename Triangulation_::Triangulation_data_structure Tds;
+  typedef typename Tds::Vertex                 Vertex;
+  typedef typename Tds::Face                   Face;
+  typedef typename Tds::Edge                   Edge;
+  typedef typename Tds::Vertex_handle          Vertex_handle;
+  typedef typename Tds::Face_handle            Face_handle;
+  typedef typename Tds::Face_circulator        Face_circulator;
+  
+  typedef typename Gt::Point_2 Point;
+  typedef typename Triangulation::Locate_type Locate_type;
+
+   enum State {undefined = -1,
+	       vertex_vertex,
+	       vertex_edge,
+	       edge_vertex,
+	       edge_edge};
+            
+private:
+  Face_handle pos;
+  const Triangulation* _tr;
+  State s;
+  int i;
+  Point p, q;
+            
+public:
+  Triangulation_line_face_circulator_2()
+    : pos(), _tr(NULL), s(undefined), i(-1)
+    {}
+            
+  Triangulation_line_face_circulator_2(Vertex_handle v,
+				       const Triangulation* tr,
+				       const Point& dir);
+
+  Triangulation_line_face_circulator_2(const Point& pp,
+				       const Point& qq,
+				       const Triangulation * t);
+           
+  Triangulation_line_face_circulator_2(const Point& pp,
+				       const Point& qq,
+				       const Face_handle& ff,
+				       const Triangulation* t); 
+
+  Line_face_circulator&   operator++() ;
+  Line_face_circulator&   operator--() ;
+  Line_face_circulator    operator++(int);
+  Line_face_circulator    operator--(int);
+  Face*                   operator->() {return &*pos;}
+  Face&                   operator*() { return *pos;}
+  Face_handle             handle() {return pos;}
+  operator Face_handle() const {return pos;}
+  bool  operator==(const Line_face_circulator& lfc) const;
+  bool  operator!=(const Line_face_circulator& lfc) const;
+
+  bool  operator==(const Face_handle& fh) const { return fh == pos; }
+  bool  operator!=(const Face_handle& fh) const { return fh != pos; }
+
+  bool  operator==(Nullptr_t  CGAL_triangulation_assertion_code(n)) const;
+  bool  operator!=(Nullptr_t n) const;
+  bool  is_empty() const;
+  bool  collinear_outside() const;
+  bool locate(const Point& t, Locate_type &lt,  int &li);
+
+  //private:
+  Triangulation_line_face_circulator_2(const Face_handle& face,
+				       int index,
+				       State state,
+				       const Triangulation * t,
+				       const Point& pp,
+				       const Point& qq);
+private:
+  void increment();
+  void decrement();
+};
+
+template < class Triangulation >
+inline
+bool
+operator==(typename Triangulation::Triangulation_data_structure::Face_handle fh, 
+	   Triangulation_line_face_circulator_2<Triangulation> fc)
+{
+  return (fc==fh);
+}
+
+template < class Triangulation >
+inline
+bool
+operator!=(typename Triangulation::Triangulation_data_structure::Face_handle fh, 
+	   Triangulation_line_face_circulator_2<Triangulation> fc)
+{
+  return (fc!=fh);
+}
+
+template < class Triangulation >
+Triangulation_line_face_circulator_2<Triangulation>::
+Triangulation_line_face_circulator_2(const Face_handle& face,
+				     int index,
+				     State state,
+				     const Triangulation * t,
+				     const Point& pp,
+				     const Point& qq)
+    : pos(face), _tr(t), s(state), i(index),  
+      p(pp), q(qq)            
+{
+  CGAL_triangulation_precondition(! t->xy_equal(p, q));
+}
+
+
+template < class Triangulation >
+Triangulation_line_face_circulator_2<Triangulation>::
+Triangulation_line_face_circulator_2(Vertex_handle v,
+				     const Triangulation* tr,
+				     const Point& dir)
+  :pos(), _tr(tr), s(undefined)
+  // begin at the face incident to v, traversed by the ray from v to
+  // dir 
+  // or null iterator
+{
+  CGAL_triangulation_precondition((!_tr->is_infinite(v)) &&
+			       (_tr->dimension() == 2)  &&
+			       (! _tr->xy_equal(v->point(),dir)));
+  p=v->point();
+  q=dir;
+
+  // find a finite vertex to the left of pq
+  // if there is no, the line_face_circulator is null
+  Face_circulator fc = _tr->incident_faces(v);
+  Face_circulator done(fc);
+  int ic = fc->index(v);
+  Vertex_handle  vt= fc->vertex(cw(ic));
+   while( _tr->is_infinite(vt) || 
+	  _tr->orientation(p, q, vt->point()) != LEFT_TURN) {
+    ++fc;
+    ic = fc->index(v);
+    vt= fc->vertex(cw(ic));
+    if (fc == done) { *this = Line_face_circulator(); return;}
+  }
+  
+  // now vt is finite and to the left of pq
+  Vertex_handle vr = fc-> vertex(ccw(ic));
+  Orientation pqr = RIGHT_TURN; // warning "pqr might be used uninitialized"
+  while ( (!_tr->is_infinite(vr)) &&
+	  (pqr = _tr->orientation(p, q, vr->point()))== LEFT_TURN ) {
+    --fc;
+    ic = fc->index(v);
+    vr = fc-> vertex(ccw(ic));
+  }
+
+  // vr can be infinite or finite. 
+  // If finite [pqr] is COLLINEAR or RIGHT_TURN
+  // reset vt and conclude.  vt is still finite and [pqt] still LEFT_TURN
+  ic = fc->index(v);
+  vt= fc->vertex(cw(ic));
+  CGAL_triangulation_assertion (_tr->orientation(p,q, vt->point())==
+				LEFT_TURN );
+  if (_tr->is_infinite(vr)) {
+    --fc;
+    ic = fc->index(v);
+    vr = fc->vertex(ccw(ic));
+    pqr = _tr->orientation(p, q, vr->point());
+    switch(pqr){
+    case RIGHT_TURN:
+    case COLLINEAR:
+      ++fc;
+      ic = fc->index(_tr->infinite_vertex());
+      pos = fc;
+      s = vertex_vertex;
+      i = ic;
+      break;
+    case LEFT_TURN:
+     *this = Line_face_circulator(); 
+     break;
+    }
+  }
+  else if (pqr == COLLINEAR) {
+    pos = fc;
+    s = vertex_vertex;
+    i = ccw(ic);
+   }
+  else { // pqr==RIGHT_TURN 
+    pos = fc;
+    s = vertex_edge;
+    i = ic ;
+  }
+  return;
+}
+  
+
+
+
+template < class Triangulation >
+Triangulation_line_face_circulator_2<Triangulation>::
+Triangulation_line_face_circulator_2(const Point& pp,
+				     const Point& qq,
+				     const Triangulation * t)
+     : pos(), _tr(t), s(undefined), p(pp), q(qq)
+  //begins at the  first finite face traversed be the oriented line pq
+{
+  Vertex_handle inf = _tr->infinite_vertex();
+  Face_circulator fc = _tr->incident_faces(inf),
+    done(fc);
+
+  i = fc->index(inf);
+  Point l = fc->vertex(cw(i))->point();
+  Point r = fc->vertex(ccw(i))->point();
+  Orientation pql = _tr->orientation(p, q, l);
+  Orientation pqr = _tr->orientation(p, q, r);
+            
+   do{
+    if( (pql == LEFT_TURN) && (pqr == RIGHT_TURN) ){
+      *this = ++Line_face_circulator( fc, i, vertex_edge, t, p, q);
+           return;
+    } 
+    else if ( (pql == LEFT_TURN) && (pqr == COLLINEAR) ){
+      --fc;
+      i = fc->index(inf);
+      Point  ss = fc->vertex(ccw(i))->point();
+      Orientation pqs  = _tr->orientation(p, q, ss);
+      Face_handle fn;
+      int in;
+      switch(pqs) {
+      case LEFT_TURN:
+	*this = Line_face_circulator();
+	return;
+      case COLLINEAR:
+	fn = fc->neighbor(i);
+	in = fn->index(fc);
+	*this = Line_face_circulator( fn, cw(in),vertex_vertex,t,p,q);
+	return;
+      case RIGHT_TURN:
+	fn = fc->neighbor(i);
+	Vertex_handle vr = fc->vertex(cw(i)); // vertex corresponding to r
+	in = fn->index(vr);
+	ss = fn->vertex(cw(in))->point();
+	pqs = _tr->orientation(p, q, ss);
+	Orientation pqss = RIGHT_TURN;
+	while ( pqs != LEFT_TURN) {
+	  pqss = pqs;
+	  fn = fn->neighbor(ccw(in));
+	  in = fn->index(vr);
+	  ss = fn->vertex(cw(in))->point();
+	  pqs = _tr->orientation(p, q, ss);
+	}
+	if (pqss == RIGHT_TURN)
+	  *this = Line_face_circulator( fn, in ,vertex_edge,t,p,q);
+	else // pqss = COLLINEAR
+	  *this = Line_face_circulator(fn,ccw(in),vertex_vertex,t,p,q);
+	return;
+      }
+    }
+
+    // going CCW around convex hull is CW around infinite vertex
+    --fc; 
+    l = r;
+    pql = pqr;
+    i = fc->index(inf);
+    r = fc->vertex(ccw(i))->point();
+    pqr = _tr->orientation(p, q, r);
+  }while(fc != done);
+
+   // if line (p,q) does not intersect the convex hull in an edge
+   // the circulator has a singular value
+   *this=Line_face_circulator();
+   return;
+}
+
+
+template < class Triangulation >
+Triangulation_line_face_circulator_2<Triangulation>::
+Triangulation_line_face_circulator_2(const Point& pp,
+				     const Point& qq,
+				     const Face_handle& ff,
+				     const Triangulation* t)
+  : pos(ff), _tr(t), s(undefined), p(pp), q(qq)
+  // precondition : face ff contain p
+  // the walk  begins at face ff if ff is a finite face traversed by the
+  // circulator
+  // if ff is finite but not traversed by the circulator
+  // (this happens when p is a vertex of ff or on an edge) :
+  // the circulator may be empty, or the walk begins at a finite face
+  // incident to p 
+  // if ff is infinite, the walk begin at the first finite face traversed
+{
+  CGAL_triangulation_precondition(_tr->is_infinite(ff) ||
+			      _tr->oriented_side(ff,p) != ON_NEGATIVE_SIDE);
+  int j;
+  if(_tr->is_infinite(pos)){
+    *this  = Line_face_circulator(p, q, t);
+    return;
+  }
+
+  // Test whether p lies on a vertex
+  for(j = 0; j < 3; j++){
+    if(_tr->xy_equal(pos->vertex(j)->point(), p)){
+      *this = Line_face_circulator( pos->vertex(j), t, q);
+      if( (!is_empty()) && _tr->is_infinite(pos )) --(*this);
+      return;
+    }
+  }
+            
+  // Test whether p lies on an edge
+  for(j = 0; j < 3; j++) {
+    if(_tr->orientation(pos->vertex(ccw(j))->point(),
+			pos->vertex(cw(j))->point(),
+			p) == COLLINEAR){
+      Orientation pqj =
+	_tr->orientation(p, q, pos->vertex(j)->point());
+      Orientation pqcwj =
+	_tr->orientation(p, q, pos->vertex(cw(j))->point());
+      switch(pqcwj) {
+      case COLLINEAR :
+	if(pqj == LEFT_TURN){
+	  s = vertex_vertex;
+	  i = cw(j);
+	  return;
+	} 
+	else if(! _tr->is_infinite(pos->neighbor(j))){
+	  Face_handle n = pos->neighbor(j);
+	  i = cw(n->index(pos)); 
+	  pos = n;
+	  s = vertex_vertex;
+	  return;
+	} else {
+           // singular value
+	  *this = Line_face_circulator();
+	  return;
+	}
+      case LEFT_TURN :
+	i = j;
+	s = (pqj == COLLINEAR) ? vertex_edge :  
+	  edge_edge;
+	break;
+      case RIGHT_TURN :
+	switch(pqj){
+	case COLLINEAR:
+	  s = edge_vertex;
+	  i = j;
+	  return;
+	case LEFT_TURN:
+	  s = edge_edge;
+	  i = ccw(j);
+	  return;
+	case RIGHT_TURN:
+	  s = edge_edge;
+	  i = cw(j);
+	  return;
+	}
+      }
+    }
+  }
+
+  // p lies in the interior of the face
+  Orientation orient[3];
+  for(j=0; j<3; j++) {
+    orient[j] =
+      _tr->orientation(p,q,pos->vertex(j)->point());
+  }
+  for(j=0; j<3; j++) {
+    if(orient[j] == COLLINEAR) {
+      i = j;
+      s = (orient[ccw(j)] == LEFT_TURN) ? edge_vertex : 
+	vertex_edge;
+      return;
+    }
+  }
+  s = edge_edge;
+  for(j=0; j<3; j++){
+    if(orient[j] == RIGHT_TURN){
+      i = (orient[ccw(j)] == RIGHT_TURN) ? j : cw(j);
+      return;
+    }
+  }
+}
+
+
+template < class Triangulation >
+inline
+void
+Triangulation_line_face_circulator_2<Triangulation>::
+increment()
+{
+  CGAL_triangulation_precondition(pos != Face_handle());
+  if(s == vertex_vertex || s == edge_vertex) {
+    Orientation o;
+    do{
+      Face_handle n = pos->neighbor(cw(i));
+      i = n->index(pos);
+      pos = n;
+      if (pos->vertex(i) == _tr->infinite_vertex()){
+	o = COLLINEAR;
+	i = cw(i);
+	break;
+      }
+      o = _tr->orientation(p, q, pos->vertex(i)->point());
+      i = cw(i);
+    }while(o == LEFT_TURN);
+            
+    if(o == COLLINEAR) {
+      s = vertex_vertex;
+      i = ccw(i);
+    } 
+    else {
+      s = vertex_edge;
+    }
+  } 
+  else {
+    Face_handle n = pos->neighbor(i);
+    int ni = n->index(pos);
+    pos = n ;
+    Orientation o = _tr->is_infinite(pos->vertex(ni)) ?
+      COLLINEAR :
+      _tr->orientation(p,q,pos->vertex(ni)->point());
+            
+    switch(o){
+    case LEFT_TURN:
+      s = edge_edge;
+      i = ccw(ni);
+      break;
+    case RIGHT_TURN:
+      s = edge_edge;
+      i = cw(ni);
+      break;
+    default:
+      s = edge_vertex;
+      i = ni;
+    }
+  }
+} 
+            
+template < class Triangulation >
+void
+Triangulation_line_face_circulator_2<Triangulation>::             
+decrement()
+{
+  CGAL_triangulation_precondition(pos != Face_handle());
+  if(s == vertex_vertex || s == vertex_edge) {
+    if(s == vertex_vertex){
+      i = cw(i);
+    }
+    Orientation o;
+    do{
+      Face_handle n = pos->neighbor(ccw(i));
+      i = n->index(pos);
+      pos = n;
+      if (pos->vertex(i) == _tr->infinite_vertex()){
+	o = COLLINEAR;
+	i = ccw(i);
+	break;
+      }
+      o = _tr->orientation(p, q, pos->vertex(i)->point());
+      i = ccw(i);
+    }while(o == LEFT_TURN);
+            
+    s = (o == COLLINEAR) ? vertex_vertex : edge_vertex;
+            
+  } 
+  else { // s == edge_edge  ||  s == edge_vertex
+    // the following is not nice. A better solution is to say
+    // that index i is at the vertex that is alone on one side of l(p,q)
+    if(s == edge_edge){
+      i = (_tr->orientation
+	   (p, q,
+	    pos->vertex(i)->point()) == 
+	   LEFT_TURN)
+	? cw(i) : ccw(i);
+    }
+    Face_handle n = pos->neighbor(i);
+    i = n->index(pos);
+    pos = n;
+    Orientation o = _tr->is_infinite(pos->vertex(i)) ?
+      COLLINEAR :
+      _tr->orientation(p, q, pos->vertex(i)->point());
+            
+    s = (o == COLLINEAR) ? vertex_edge : edge_edge;
+  }
+}
+
+template < class Triangulation >
+bool
+Triangulation_line_face_circulator_2<Triangulation>::
+locate(const Point& t, Locate_type &lt,  int &li)
+{
+  switch(s){            
+  case edge_edge:
+  case vertex_edge:
+    {
+      Orientation o =
+	_tr->orientation(pos->vertex(ccw(i))->point(),
+			 pos->vertex(cw(i))->point(),
+			 t);
+      if(o == RIGHT_TURN)      return false;
+      if(o == COLLINEAR){
+	lt = Triangulation::EDGE;
+	li = i;
+	return true;
+      }
+      lt = Triangulation::FACE;
+      li = 4;//li unused in this case
+      return true;
+    }
+  case vertex_vertex:
+    {
+      if(_tr->is_infinite(pos->vertex(i))){
+	CGAL_triangulation_assertion(
+	       _tr->orientation( pos->vertex(cw(i))->point(),
+				 pos->vertex(ccw(i))->point(),
+				 t) != LEFT_TURN);
+	lt = Triangulation::OUTSIDE_CONVEX_HULL;
+	li = i;
+	return true;
+      }
+      const Point &u = pos->vertex(cw(i))->point();
+      const Point &v = pos->vertex(i)->point();
+      // u == t  was detected earlier
+      if(_tr->compare_x(v,t)==EQUAL && 
+	 _tr->compare_y(v,t)==EQUAL){
+	lt = Triangulation::VERTEX;
+	li = i;
+	return true;
+      }
+      if(_tr->collinear_between(u, t, v)) {
+	lt = Triangulation::EDGE;
+	li = ccw(i);
+	return true;
+      }
+      return false;
+    }
+  default: // edge_vertex
+    {
+      if(_tr->is_infinite(pos->vertex(i))){
+	lt = Triangulation::OUTSIDE_CONVEX_HULL;
+	li = i;
+	return true;
+      }
+      if(_tr->xy_equal(t,pos->vertex(i) ->point()) ){
+	li = i;
+	lt = Triangulation::VERTEX;
+	return true;
+      }
+      if(_tr->collinear_between(p, t, pos->vertex(i)->point())) {
+	lt = Triangulation::FACE;
+	return true;
+      }
+      return false;
+    }
+  }
+}
+           
+template < class Triangulation >
+inline
+Triangulation_line_face_circulator_2<Triangulation>&
+Triangulation_line_face_circulator_2<Triangulation>::
+operator++()
+{
+  CGAL_triangulation_precondition( pos != Face_handle()) ;
+  increment();
+  return *this;
+}
+            
+template < class Triangulation >
+inline
+Triangulation_line_face_circulator_2<Triangulation>&
+Triangulation_line_face_circulator_2<Triangulation>::            
+operator--()
+{
+  CGAL_triangulation_precondition(pos != Face_handle()) ;
+  decrement();
+  return *this;
+}
+            
+template < class Triangulation >
+inline
+Triangulation_line_face_circulator_2<Triangulation>
+Triangulation_line_face_circulator_2<Triangulation>::             
+operator++(int)
+{
+  Line_face_circulator tmp(*this);
+  ++(*this);
+  return tmp;
+}
+            
+template < class Triangulation >
+inline
+Triangulation_line_face_circulator_2<Triangulation>
+Triangulation_line_face_circulator_2<Triangulation>::             
+operator--(int)
+{
+  Line_face_circulator tmp(*this);
+  --(*this);
+  return tmp;
+}
+
+template < class Triangulation >
+inline bool
+Triangulation_line_face_circulator_2<Triangulation>::    
+operator==(const Line_face_circulator& lfc) const
+{
+  CGAL_triangulation_precondition( pos != Face_handle() &&
+			       lfc.pos != Face_handle());
+  return ( pos == lfc.pos &&  _tr == lfc._tr &&
+            s== lfc.s && p==lfc.p && q==lfc.q);
+}
+
+template < class Triangulation >
+inline bool
+Triangulation_line_face_circulator_2<Triangulation>:: 
+operator!=(const Line_face_circulator& lfc) const
+{
+  return !(*this == lfc);
+}
+            
+template < class Triangulation >
+inline bool
+Triangulation_line_face_circulator_2<Triangulation>::   
+is_empty() const
+{
+  return pos == Face_handle();
+}
+
+template < class Triangulation >
+inline bool
+Triangulation_line_face_circulator_2<Triangulation>::            
+operator==(Nullptr_t CGAL_triangulation_assertion_code(n)) const
+{
+  CGAL_triangulation_assertion( n == NULL);
+  return pos == Face_handle();
+}
+            
+template < class Triangulation >
+inline bool
+Triangulation_line_face_circulator_2<Triangulation>::            
+operator!=(Nullptr_t n) const
+{
+  CGAL_triangulation_assertion( n == NULL);
+  return !(*this == n);
+}
+            
+template < class Triangulation >
+inline bool
+Triangulation_line_face_circulator_2<Triangulation>:: 
+collinear_outside() const
+{
+//   return (_tr->is_infinite(*this))
+//     && (s == vertex_vertex)
+//     && (! _tr->is_infinite((*this)->vertex(i)));
+  // return true if  the circulator is non null
+  // the line is collinear with a convex hull edge
+  // and the convex hull is on the left of the line
+  Face_handle fh = pos;
+  return ( s == vertex_vertex  &&
+	  (! _tr->is_infinite(fh)) &&
+           _tr->is_infinite(fh->neighbor(ccw(i))));
+}
+
+} //namespace CGAL
+#endif //CGAL_TRIANGULATION_LINE_FACE_CIRCULATOR_2_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_simplex_3.h b/3rdparty/CGAL/include/CGAL/Triangulation_simplex_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_simplex_3.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_simplex_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_structural_filtering_traits.h b/3rdparty/CGAL/include/CGAL/Triangulation_structural_filtering_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_structural_filtering_traits.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_structural_filtering_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_utils_2.h b/3rdparty/CGAL/include/CGAL/Triangulation_utils_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_utils_2.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_utils_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_utils_3.h b/3rdparty/CGAL/include/CGAL/Triangulation_utils_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_utils_3.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_utils_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_vertex.h b/3rdparty/CGAL/include/CGAL/Triangulation_vertex.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_vertex.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_vertex.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_vertex_base_2.h b/3rdparty/CGAL/include/CGAL/Triangulation_vertex_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_vertex_base_2.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_vertex_base_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_vertex_base_3.h b/3rdparty/CGAL/include/CGAL/Triangulation_vertex_base_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_vertex_base_3.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_vertex_base_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_vertex_base_with_id_2.h b/3rdparty/CGAL/include/CGAL/Triangulation_vertex_base_with_id_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_vertex_base_with_id_2.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_vertex_base_with_id_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_vertex_base_with_info_2.h b/3rdparty/CGAL/include/CGAL/Triangulation_vertex_base_with_info_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_vertex_base_with_info_2.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_vertex_base_with_info_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Triangulation_vertex_base_with_info_3.h b/3rdparty/CGAL/include/CGAL/Triangulation_vertex_base_with_info_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Triangulation_vertex_base_with_info_3.h
rename to 3rdparty/CGAL/include/CGAL/Triangulation_vertex_base_with_info_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Trivial_iterator.h b/3rdparty/CGAL/include/CGAL/Trivial_iterator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Trivial_iterator.h
rename to 3rdparty/CGAL/include/CGAL/Trivial_iterator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Two_vertices_parameterizer_3.h b/3rdparty/CGAL/include/CGAL/Two_vertices_parameterizer_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Two_vertices_parameterizer_3.h
rename to 3rdparty/CGAL/include/CGAL/Two_vertices_parameterizer_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Twotuple.h b/3rdparty/CGAL/include/CGAL/Twotuple.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Twotuple.h
rename to 3rdparty/CGAL/include/CGAL/Twotuple.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Umbilics.h b/3rdparty/CGAL/include/CGAL/Umbilics.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Umbilics.h
rename to 3rdparty/CGAL/include/CGAL/Umbilics.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Uncertain.h b/3rdparty/CGAL/include/CGAL/Uncertain.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Uncertain.h
rename to 3rdparty/CGAL/include/CGAL/Uncertain.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Unfiltered_predicate_adaptor.h b/3rdparty/CGAL/include/CGAL/Unfiltered_predicate_adaptor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Unfiltered_predicate_adaptor.h
rename to 3rdparty/CGAL/include/CGAL/Unfiltered_predicate_adaptor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Union_find.h b/3rdparty/CGAL/include/CGAL/Union_find.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Union_find.h
rename to 3rdparty/CGAL/include/CGAL/Union_find.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Union_of_balls_3.h b/3rdparty/CGAL/include/CGAL/Union_of_balls_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Union_of_balls_3.h
rename to 3rdparty/CGAL/include/CGAL/Union_of_balls_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Unique_hash_map.h b/3rdparty/CGAL/include/CGAL/Unique_hash_map.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Unique_hash_map.h
rename to 3rdparty/CGAL/include/CGAL/Unique_hash_map.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Vector_2.h b/3rdparty/CGAL/include/CGAL/Vector_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Vector_2.h
rename to 3rdparty/CGAL/include/CGAL/Vector_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Vector_3.h b/3rdparty/CGAL/include/CGAL/Vector_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Vector_3.h
rename to 3rdparty/CGAL/include/CGAL/Vector_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Vertex2Data_Property_Map_with_std_map.h b/3rdparty/CGAL/include/CGAL/Vertex2Data_Property_Map_with_std_map.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Vertex2Data_Property_Map_with_std_map.h
rename to 3rdparty/CGAL/include/CGAL/Vertex2Data_Property_Map_with_std_map.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Visibility_2/visibility_utils.h b/3rdparty/CGAL/include/CGAL/Visibility_2/visibility_utils.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Visibility_2/visibility_utils.h
rename to 3rdparty/CGAL/include/CGAL/Visibility_2/visibility_utils.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2.h b/3rdparty/CGAL/include/CGAL/Voronoi_diagram_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2.h
rename to 3rdparty/CGAL/include/CGAL/Voronoi_diagram_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Accessor.h b/3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Accessor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Accessor.h
rename to 3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Accessor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Adaptation_traits_base_2.h b/3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Adaptation_traits_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Adaptation_traits_base_2.h
rename to 3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Adaptation_traits_base_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Adaptation_traits_functors.h b/3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Adaptation_traits_functors.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Adaptation_traits_functors.h
rename to 3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Adaptation_traits_functors.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Apollonius_graph_degeneracy_testers.h b/3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Apollonius_graph_degeneracy_testers.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Apollonius_graph_degeneracy_testers.h
rename to 3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Apollonius_graph_degeneracy_testers.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Apollonius_graph_nearest_site_2.h b/3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Apollonius_graph_nearest_site_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Apollonius_graph_nearest_site_2.h
rename to 3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Apollonius_graph_nearest_site_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Cached_degeneracy_testers.h b/3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Cached_degeneracy_testers.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Cached_degeneracy_testers.h
rename to 3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Cached_degeneracy_testers.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Circulator_adaptors.h b/3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Circulator_adaptors.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Circulator_adaptors.h
rename to 3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Circulator_adaptors.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Connected_components.h b/3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Connected_components.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Connected_components.h
rename to 3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Connected_components.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Construct_dual_points.h b/3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Construct_dual_points.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Construct_dual_points.h
rename to 3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Construct_dual_points.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Default_site_inserters.h b/3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Default_site_inserters.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Default_site_inserters.h
rename to 3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Default_site_inserters.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Default_site_removers.h b/3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Default_site_removers.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Default_site_removers.h
rename to 3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Default_site_removers.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Degeneracy_tester_binders.h b/3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Degeneracy_tester_binders.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Degeneracy_tester_binders.h
rename to 3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Degeneracy_tester_binders.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Delaunay_triangulation_degeneracy_testers.h b/3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Delaunay_triangulation_degeneracy_testers.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Delaunay_triangulation_degeneracy_testers.h
rename to 3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Delaunay_triangulation_degeneracy_testers.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Delaunay_triangulation_nearest_site_2.h b/3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Delaunay_triangulation_nearest_site_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Delaunay_triangulation_nearest_site_2.h
rename to 3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Delaunay_triangulation_nearest_site_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Dummy_iterator.h b/3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Dummy_iterator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Dummy_iterator.h
rename to 3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Dummy_iterator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Edge_less.h b/3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Edge_less.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Edge_less.h
rename to 3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Edge_less.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Face.h b/3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Face.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Face.h
rename to 3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Face.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Finder_classes.h b/3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Finder_classes.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Finder_classes.h
rename to 3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Finder_classes.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Halfedge.h b/3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Halfedge.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Halfedge.h
rename to 3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Halfedge.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Handle_adaptor.h b/3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Handle_adaptor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Handle_adaptor.h
rename to 3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Handle_adaptor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Identity_rejectors.h b/3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Identity_rejectors.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Identity_rejectors.h
rename to 3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Identity_rejectors.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Iterator_adaptors.h b/3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Iterator_adaptors.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Iterator_adaptors.h
rename to 3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Iterator_adaptors.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Policy_base.h b/3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Policy_base.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Policy_base.h
rename to 3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Policy_base.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Regular_triangulation_degeneracy_testers.h b/3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Regular_triangulation_degeneracy_testers.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Regular_triangulation_degeneracy_testers.h
rename to 3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Regular_triangulation_degeneracy_testers.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Regular_triangulation_nearest_site_2.h b/3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Regular_triangulation_nearest_site_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Regular_triangulation_nearest_site_2.h
rename to 3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Regular_triangulation_nearest_site_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Segment_Delaunay_graph_degeneracy_testers.h b/3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Segment_Delaunay_graph_degeneracy_testers.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Segment_Delaunay_graph_degeneracy_testers.h
rename to 3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Segment_Delaunay_graph_degeneracy_testers.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Segment_Delaunay_graph_nearest_site_2.h b/3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Segment_Delaunay_graph_nearest_site_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Segment_Delaunay_graph_nearest_site_2.h
rename to 3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Segment_Delaunay_graph_nearest_site_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Site_accessors.h b/3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Site_accessors.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Site_accessors.h
rename to 3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Site_accessors.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Unbounded_edges.h b/3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Unbounded_edges.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Unbounded_edges.h
rename to 3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Unbounded_edges.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Unbounded_faces.h b/3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Unbounded_faces.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Unbounded_faces.h
rename to 3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Unbounded_faces.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Validity_testers.h b/3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Validity_testers.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Validity_testers.h
rename to 3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Validity_testers.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Vertex.h b/3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Vertex.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/Vertex.h
rename to 3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/Vertex.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/basic.h b/3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/basic.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Voronoi_diagram_2/basic.h
rename to 3rdparty/CGAL/include/CGAL/Voronoi_diagram_2/basic.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Voronoi_intersection_2_traits_3.h b/3rdparty/CGAL/include/CGAL/Voronoi_intersection_2_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Voronoi_intersection_2_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/Voronoi_intersection_2_traits_3.h
diff --git a/3rdparty/CGAL/include/CGAL/Weighted_Minkowski_distance.h b/3rdparty/CGAL/include/CGAL/Weighted_Minkowski_distance.h
new file mode 100644
index 0000000..2c3f1af
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/Weighted_Minkowski_distance.h
@@ -0,0 +1,415 @@
+// Copyright (c) 2002,2011 Utrecht University (The Netherlands).
+// 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
+// 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(s)     : Hans Tangelder (<hanst at cs.uu.nl>)
+
+// Note: Use p=0 to denote the weighted Linf-distance 
+// For 0<p<1 Lp is not a metric
+
+#ifndef CGAL_WEIGHTED_MINKOWSKI_DISTANCE_H
+#define CGAL_WEIGHTED_MINKOWSKI_DISTANCE_H
+
+#include <cmath>
+#include <vector>
+
+#include <CGAL/number_utils.h>
+#include <CGAL/Kd_tree_rectangle.h>
+#include <CGAL/internal/Get_dimension_tag.h>
+
+namespace CGAL {
+
+  template <class SearchTraits>
+  class Weighted_Minkowski_distance {
+    SearchTraits traits;
+    public:
+
+    typedef typename SearchTraits::Point_d Point_d;
+    typedef Point_d                        Query_item;
+    typedef typename SearchTraits::FT      FT;
+    typedef std::vector<FT>                Weight_vector;
+    typedef typename internal::Get_dimension_tag<SearchTraits>::Dimension Dimension;
+
+    private:
+
+    typedef typename SearchTraits::Cartesian_const_iterator_d Coord_iterator;
+    FT power; 
+
+    Weight_vector the_weights;
+
+    public:
+
+
+    // default constructor
+    Weighted_Minkowski_distance(const SearchTraits& traits_=SearchTraits())
+      : traits(traits_),power(2) 
+    {}
+
+    Weighted_Minkowski_distance(const int d,const SearchTraits& traits_=SearchTraits()) 
+      : traits(traits_),power(2), the_weights(d)
+    {
+      for (int i = 0; i < d; ++i) the_weights[i]=FT(1);
+    }
+
+    //default copy constructor and destructor
+    
+
+    Weighted_Minkowski_distance (FT pow, int dim,
+				 const Weight_vector& weights,
+                                 const SearchTraits& traits_=SearchTraits()) 
+      : traits(traits_),power(pow)
+    {
+      CGAL_assertion(power >= FT(0));
+      CGAL_assertion(dim==weights.size());
+      for (unsigned int i = 0; i < weights.size(); ++i)
+	CGAL_assertion(weights[i]>=FT(0));
+      the_weights.resize(weights.size());
+      the_weights = weights;
+    }
+
+    template <class InputIterator>
+    Weighted_Minkowski_distance (FT pow, int dim,
+				 InputIterator begin, InputIterator end,
+                                 const SearchTraits& traits_=SearchTraits()) 
+      : traits(traits_),power(pow)
+    {
+      CGAL_assertion(power >= FT(0));
+      the_weights.resize(dim);
+      std::copy(begin, end, the_weights.begin());
+      for (int i = 0; i < dim; ++i){
+	the_weights[i] = *begin;
+	++begin;
+	CGAL_assertion(the_weights[i]>=FT(0));
+      }
+      CGAL_assertion(begin == end);
+    }
+
+
+    inline FT transformed_distance(const Query_item& q, const Point_d& p) const {
+        return transformed_distance(q,p, Dimension());
+    }
+
+    //Dynamic version for runtime dimension
+    inline 
+    FT 
+    transformed_distance(const Query_item& q, const Point_d& p, Dynamic_dimension_tag) const
+    {
+      FT distance = FT(0);
+      typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=
+        traits.construct_cartesian_const_iterator_d_object();
+      Coord_iterator qit = construct_it(q),
+	             qe = construct_it(q,1), 
+	             pit = construct_it(p);
+      if (power == FT(0)) {
+	for (unsigned int i = 0; qit != qe; ++qit, ++i)
+	  if (the_weights[i] * CGAL::abs((*qit) - (*pit)) > distance)
+	    distance = the_weights[i] * CGAL::abs((*qit)-(*pit));
+      }
+      else
+	for (unsigned int i = 0; qit != qe; ++qit, ++i)
+	  distance += 
+	    the_weights[i] * std::pow(CGAL::abs((*qit)-(*pit)),power);
+      return distance;
+    }
+
+    //Generic version for DIM > 3
+    template <int DIM>
+    inline FT 
+    transformed_distance(const Query_item& q, const Point_d& p, Dimension_tag<DIM>) const
+    {
+      FT distance = FT(0);
+      typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=
+        traits.construct_cartesian_const_iterator_d_object();
+      Coord_iterator qit = construct_it(q),
+	             qe = construct_it(q,1), 
+	             pit = construct_it(p);
+      if (power == FT(0)) {
+	for (unsigned int i = 0; qit != qe; ++qit, ++i)
+	  if (the_weights[i] * CGAL::abs((*qit) - (*pit)) > distance)
+	    distance = the_weights[i] * CGAL::abs((*qit)-(*pit));
+      }
+      else
+	for (unsigned int i = 0; qit != qe; ++qit, ++i)
+	  distance += 
+	    the_weights[i] * std::pow(CGAL::abs((*qit)-(*pit)),power);
+      return distance;
+    }
+
+    //DIM = 2 loop unrolled
+    inline FT 
+    transformed_distance(const Query_item& q, const Point_d& p, Dimension_tag<2>) const
+    {
+      FT distance = FT(0);
+      typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=
+        traits.construct_cartesian_const_iterator_d_object();
+      Coord_iterator qit = construct_it(q),
+	             pit = construct_it(p);
+      if (power == FT(0)) {
+	  if (the_weights[0] * CGAL::abs((*qit) - (*pit)) > distance)
+	    distance = the_weights[0] * CGAL::abs((*qit)-(*pit));
+          qit++;pit++;
+          if (the_weights[1] * CGAL::abs((*qit) - (*pit)) > distance)
+	    distance = the_weights[1] * CGAL::abs((*qit)-(*pit));
+      }
+      else{
+	  distance += 
+	    the_weights[0] * std::pow(CGAL::abs((*qit)-(*pit)),power);
+          qit++;pit++;
+          distance += 
+	    the_weights[1] * std::pow(CGAL::abs((*qit)-(*pit)),power);
+      }
+      return distance;
+    }
+
+    //DIM = 3 loop unrolled
+    inline FT 
+    transformed_distance(const Query_item& q, const Point_d& p, Dimension_tag<3>) const
+    {
+      FT distance = FT(0);
+      typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=
+        traits.construct_cartesian_const_iterator_d_object();
+      Coord_iterator qit = construct_it(q),
+	             pit = construct_it(p);
+      if (power == FT(0)) {
+	  if (the_weights[0] * CGAL::abs((*qit) - (*pit)) > distance)
+	    distance = the_weights[0] * CGAL::abs((*qit)-(*pit));
+          qit++;pit++;
+          if (the_weights[1] * CGAL::abs((*qit) - (*pit)) > distance)
+	    distance = the_weights[1] * CGAL::abs((*qit)-(*pit));
+          qit++;pit++;
+          if (the_weights[2] * CGAL::abs((*qit) - (*pit)) > distance)
+	    distance = the_weights[2] * CGAL::abs((*qit)-(*pit));
+      }
+      else{
+	  distance += 
+	    the_weights[0] * std::pow(CGAL::abs((*qit)-(*pit)),power);
+          qit++;pit++;
+          distance += 
+	    the_weights[1] * std::pow(CGAL::abs((*qit)-(*pit)),power);
+          qit++;pit++;
+          distance += 
+	    the_weights[2] * std::pow(CGAL::abs((*qit)-(*pit)),power);
+      }
+      return distance;
+    }
+
+    inline 
+    FT 
+    min_distance_to_rectangle(const Query_item& q,
+			      const Kd_tree_rectangle<FT,Dimension>& r) const 
+    {
+      FT distance = FT(0);
+      typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=
+        traits.construct_cartesian_const_iterator_d_object();
+      Coord_iterator qit = construct_it(q), qe = construct_it(q,1);
+      if (power == FT(0))
+	{
+	  for (unsigned int i = 0; qit != qe; ++qit, ++i) {
+	    if (the_weights[i]*(r.min_coord(i) - 
+				(*qit)) > distance)
+	      distance = the_weights[i] * (r.min_coord(i)-
+					   (*qit));
+	    if (the_weights[i] * ((*qit) - r.max_coord(i)) > 
+		distance)
+	      distance = the_weights[i] * 
+		((*qit)-r.max_coord(i));
+	  }
+	}
+      else
+	{
+	  for (unsigned int i = 0; qit != qe; ++qit, ++i) {
+	    if ((*qit) < r.min_coord(i))
+	      distance += the_weights[i] * 
+		std::pow(r.min_coord(i)-(*qit),power);
+	    if ((*qit) > r.max_coord(i))
+	      distance += the_weights[i] * 
+		std::pow((*qit)-r.max_coord(i),power);
+	  }
+	};
+      return distance;
+    }
+
+    inline 
+    FT 
+    min_distance_to_rectangle(const Query_item& q,
+			      const Kd_tree_rectangle<FT,Dimension>& r,std::vector<FT>& dists) const {
+      FT distance = FT(0);
+      typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=
+        traits.construct_cartesian_const_iterator_d_object();
+      Coord_iterator qit = construct_it(q), qe = construct_it(q,1);
+      if (power == FT(0))
+	{
+	  for (unsigned int i = 0; qit != qe; ++qit, ++i) {
+	    if (the_weights[i]*(r.min_coord(i) - 
+				(*qit)) > distance){
+              dists[i] = (r.min_coord(i)-
+		(*qit));
+	      distance = the_weights[i] * dists[i];
+            }
+	    if (the_weights[i] * ((*qit) - r.max_coord(i)) > 
+		distance){
+                  dists[i] = 
+		((*qit)-r.max_coord(i));
+	      distance = the_weights[i] * dists[i];
+            }
+	  }
+	}
+      else
+	{
+	  for (unsigned int i = 0; qit != qe; ++qit, ++i) {
+	    if ((*qit) < r.min_coord(i)){
+              dists[i] = r.min_coord(i)-(*qit);
+	      distance += the_weights[i] * 
+		std::pow(dists[i],power);
+            }
+	    if ((*qit) > r.max_coord(i)){
+              dists[i] = (*qit)-r.max_coord(i);
+	      distance += the_weights[i] * 
+		std::pow(dists[i],power);
+            }
+	  }
+	};
+      return distance;
+    }
+
+    inline 
+    FT
+    max_distance_to_rectangle(const Query_item& q,
+			      const Kd_tree_rectangle<FT,Dimension>& r) const {
+      FT distance=FT(0);
+      typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=
+        traits.construct_cartesian_const_iterator_d_object();
+      Coord_iterator qit = construct_it(q), qe = construct_it(q,1);
+      if (power == FT(0))
+	{
+	  for (unsigned int i = 0; qit != qe; ++qit, ++i) {
+	    if ((*qit) >= (r.min_coord(i) + 
+			 r.max_coord(i))/FT(2.0)) {
+	      if (the_weights[i] * ((*qit) - 
+				    r.min_coord(i)) > distance)
+		distance = the_weights[i] * 
+		  ((*qit)-r.min_coord(i));
+	      else
+		if (the_weights[i] * 
+		    (r.max_coord(i) - (*qit)) > distance)
+		  distance = the_weights[i] * 
+		    ( r.max_coord(i)-(*qit));
+            }
+	  }
+	}
+      else
+	{
+	  for (unsigned int i = 0; qit != qe; ++qit, ++i) {
+	    if ((*qit) <= (r.min_coord(i)+r.max_coord(i))/FT(2.0))
+	      distance += the_weights[i] * std::pow(r.max_coord(i)-(*qit),power);
+	    else
+	      distance += the_weights[i] * std::pow((*qit)-r.min_coord(i),power);
+	  }
+	};
+      return distance;
+    }
+
+     inline 
+    FT
+    max_distance_to_rectangle(const Query_item& q,
+			      const Kd_tree_rectangle<FT,Dimension>& r,std::vector<FT>& dists) const {
+      FT distance=FT(0);
+      typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=
+        traits.construct_cartesian_const_iterator_d_object();
+      Coord_iterator qit = construct_it(q), qe = construct_it(q,1);
+      if (power == FT(0))
+	{
+	  for (unsigned int i = 0; qit != qe; ++qit, ++i) {
+	    if ((*qit) >= (r.min_coord(i) + 
+			 r.max_coord(i))/FT(2.0)) {
+	      if (the_weights[i] * ((*qit) - 
+				    r.min_coord(i)) > distance){
+                dists[i] = (*qit)-r.min_coord(i);
+		distance = the_weights[i] * 
+		  (dists[i]);
+              }
+	      else
+		if (the_weights[i] * 
+		    (r.max_coord(i) - (*qit)) > distance){
+                      dists[i] =  r.max_coord(i)-(*qit);
+		  distance = the_weights[i] * 
+		    (dists[i]);
+                }
+            }
+	  }
+	}
+      else
+	{
+	  for (unsigned int i = 0; qit != qe; ++qit, ++i) {
+	    if ((*qit) <= (r.min_coord(i)+r.max_coord(i))/FT(2.0)){
+              dists[i] = r.max_coord(i)-(*qit);
+	      distance += the_weights[i] * std::pow(dists[i],power);
+            }
+	    else{
+              dists[i] = (*qit)-r.min_coord(i);
+	      distance += the_weights[i] * std::pow(dists[i],power);
+            }
+	  }
+	};
+      return distance;
+    }
+    
+    inline 
+    FT 
+    new_distance(FT dist, FT old_off, FT new_off,
+		 int cutting_dimension)  const 
+    {
+      FT new_dist;
+      if (power == FT(0))
+	{
+	  if (the_weights[cutting_dimension]*CGAL::abs(new_off) 
+	      > dist) 
+	    new_dist= 
+	      the_weights[cutting_dimension]*CGAL::abs(new_off);
+	  else new_dist=dist;
+	}
+      else
+	{
+	  new_dist = dist + the_weights[cutting_dimension] * 
+	    (std::pow(CGAL::abs(new_off),power)-std::pow(CGAL::abs(old_off),power));
+	}
+      return new_dist;
+    }
+    
+    inline 
+    FT 
+    transformed_distance(FT d) const 
+    {
+      if (power <= FT(0)) return d;
+      else return std::pow(d,power);
+      
+    }
+    
+    inline 
+    FT 
+    inverse_of_transformed_distance(FT d) const 
+    {
+      if (power <= FT(0)) return d;
+      else return std::pow(d,1/power);
+      
+    }
+
+  }; // class Weighted_Minkowski_distance
+
+} // namespace CGAL
+
+#endif // CGAL_WEIGHTED_MINKOWSKI_DISTANCE_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Weighted_alpha_shape_euclidean_traits_2.h b/3rdparty/CGAL/include/CGAL/Weighted_alpha_shape_euclidean_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Weighted_alpha_shape_euclidean_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/Weighted_alpha_shape_euclidean_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Weighted_alpha_shape_euclidean_traits_3.h b/3rdparty/CGAL/include/CGAL/Weighted_alpha_shape_euclidean_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Weighted_alpha_shape_euclidean_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/Weighted_alpha_shape_euclidean_traits_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Weighted_point.h b/3rdparty/CGAL/include/CGAL/Weighted_point.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Weighted_point.h
rename to 3rdparty/CGAL/include/CGAL/Weighted_point.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Weighted_point_with_psc_localisation.h b/3rdparty/CGAL/include/CGAL/Weighted_point_with_psc_localisation.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Weighted_point_with_psc_localisation.h
rename to 3rdparty/CGAL/include/CGAL/Weighted_point_with_psc_localisation.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Weighted_point_with_surface_index.h b/3rdparty/CGAL/include/CGAL/Weighted_point_with_surface_index.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Weighted_point_with_surface_index.h
rename to 3rdparty/CGAL/include/CGAL/Weighted_point_with_surface_index.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Weighted_point_with_surface_index_geom_traits.h b/3rdparty/CGAL/include/CGAL/Weighted_point_with_surface_index_geom_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Weighted_point_with_surface_index_geom_traits.h
rename to 3rdparty/CGAL/include/CGAL/Weighted_point_with_surface_index_geom_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Width_3.h b/3rdparty/CGAL/include/CGAL/Width_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Width_3.h
rename to 3rdparty/CGAL/include/CGAL/Width_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Width_default_traits_3.h b/3rdparty/CGAL/include/CGAL/Width_default_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Width_default_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/Width_default_traits_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Width_polyhedron_3.h b/3rdparty/CGAL/include/CGAL/Width_polyhedron_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Width_polyhedron_3.h
rename to 3rdparty/CGAL/include/CGAL/Width_polyhedron_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Win32_exception.h b/3rdparty/CGAL/include/CGAL/Win32_exception.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Win32_exception.h
rename to 3rdparty/CGAL/include/CGAL/Win32_exception.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/aff_transformation_tags.h b/3rdparty/CGAL/include/CGAL/aff_transformation_tags.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/aff_transformation_tags.h
rename to 3rdparty/CGAL/include/CGAL/aff_transformation_tags.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/aff_transformation_tags_impl.h b/3rdparty/CGAL/include/CGAL/aff_transformation_tags_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/aff_transformation_tags_impl.h
rename to 3rdparty/CGAL/include/CGAL/aff_transformation_tags_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/algorithm.h b/3rdparty/CGAL/include/CGAL/algorithm.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/algorithm.h
rename to 3rdparty/CGAL/include/CGAL/algorithm.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/all_furthest_neighbors_2.h b/3rdparty/CGAL/include/CGAL/all_furthest_neighbors_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/all_furthest_neighbors_2.h
rename to 3rdparty/CGAL/include/CGAL/all_furthest_neighbors_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/apply_to_range.h b/3rdparty/CGAL/include/CGAL/apply_to_range.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/apply_to_range.h
rename to 3rdparty/CGAL/include/CGAL/apply_to_range.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/approximated_offset_2.h b/3rdparty/CGAL/include/CGAL/approximated_offset_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/approximated_offset_2.h
rename to 3rdparty/CGAL/include/CGAL/approximated_offset_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/argument_swaps.h b/3rdparty/CGAL/include/CGAL/argument_swaps.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/argument_swaps.h
rename to 3rdparty/CGAL/include/CGAL/argument_swaps.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/arrange_offset_polygons_2.h b/3rdparty/CGAL/include/CGAL/arrange_offset_polygons_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/arrange_offset_polygons_2.h
rename to 3rdparty/CGAL/include/CGAL/arrange_offset_polygons_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/array.h b/3rdparty/CGAL/include/CGAL/array.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/array.h
rename to 3rdparty/CGAL/include/CGAL/array.h
diff --git a/3rdparty/CGAL/include/CGAL/assertions.h b/3rdparty/CGAL/include/CGAL/assertions.h
new file mode 100644
index 0000000..1c07b76
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/assertions.h
@@ -0,0 +1,359 @@
+// Copyright (c) 1999  
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved. 
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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(s)     : Geert-Jan Giezeman and Sven Schoenherr
+
+#include <CGAL/config.h>
+
+#ifndef CGAL_ASSERTIONS_H
+#define CGAL_ASSERTIONS_H
+
+#include <CGAL/export/CGAL.h>
+
+// #include <CGAL/assertions_behaviour.h> // for backward compatibility
+
+#ifdef NDEBUG
+#  ifndef CGAL_NDEBUG
+#    define CGAL_NDEBUG
+#  endif
+#endif
+
+// The macro `CGAL_DEBUG` allows to force CGAL assertions, even if `NDEBUG`
+// is defined,
+#ifdef CGAL_DEBUG
+#  ifdef CGAL_NDEBUG
+#    undef CGAL_NDEBUG
+#  endif
+#endif
+
+#ifdef CGAL_NDEBUG
+#  define CGAL_NO_ASSERTIONS
+#  define CGAL_NO_PRECONDITIONS
+#  define CGAL_NO_POSTCONDITIONS
+#  define CGAL_NO_WARNINGS
+#endif
+
+#ifdef CGAL_CFG_NO_CPP0X_STATIC_ASSERT
+#include <boost/static_assert.hpp>
+#endif
+
+namespace CGAL {
+
+// function declarations
+// =====================
+// failure functions
+// -----------------
+CGAL_EXPORT void assertion_fail      ( const char*, const char*, int, const char* = "") CGAL_NORETURN;
+CGAL_EXPORT void precondition_fail   ( const char*, const char*, int, const char* = "") CGAL_NORETURN;
+CGAL_EXPORT void postcondition_fail  ( const char*, const char*, int, const char* = "") CGAL_NORETURN;
+
+// warning function
+// ----------------
+CGAL_EXPORT
+void warning_fail( const char*, const char*, int, const char* = "");
+
+
+// The following declarations are needed first, before assertions are used.
+// ---------------------------------------------------------------------
+template < typename T > class Uncertain;
+inline bool possibly(bool b);
+inline bool possibly(Uncertain<bool> c);
+
+
+// macro definitions
+// =================
+// assertions
+// ----------
+
+#if defined(CGAL_NO_ASSERTIONS)
+#  define CGAL_assertion(EX) (static_cast<void>(0))
+#  define CGAL_destructor_assertion(EX) (static_cast<void>(0))
+#  define CGAL_assertion_msg(EX,MSG) (static_cast<void>(0))
+#  define CGAL_assertion_code(CODE)
+#  ifdef CGAL_ASSUME
+#    define CGAL_assume(EX) CGAL_ASSUME(EX)
+#    define CGAL_assume_code(CODE) CODE
+#  else // not def CGAL_ASSUME
+#    define CGAL_assume(EX)  CGAL_assertion(EX)
+#    define CGAL_assume_code(CODE) CGAL_assertion_code(CODE)
+#  endif // not def CGAL_ASSUME
+#else // no CGAL_NO_ASSERTIONS
+#  define CGAL_assertion(EX) \
+   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__))
+#  define CGAL_destructor_assertion(EX) \
+   (CGAL::possibly(EX)||std::uncaught_exception()?(static_cast<void>(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__))
+#  define CGAL_assertion_msg(EX,MSG) \
+   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG))
+#  define CGAL_assertion_code(CODE) CODE
+#  define CGAL_assume(EX) CGAL_assertion(EX)
+#  define CGAL_assume_code(CODE) CGAL_assertion_code(CODE)
+#endif // no CGAL_NO_ASSERTIONS
+
+#ifndef CGAL_CFG_NO_CPP0X_STATIC_ASSERT
+
+#  if defined(CGAL_NO_ASSERTIONS)
+
+#    define CGAL_static_assertion(EX) \
+     static_assert(true, "")
+
+#    define CGAL_static_assertion_msg(EX,MSG) \
+     static_assert(true, "")
+
+#  else // no CGAL_NO_ASSERTIONS
+
+#    define CGAL_static_assertion(EX) \
+     static_assert(EX, #EX)
+
+#    define CGAL_static_assertion_msg(EX,MSG) \
+     static_assert(EX, MSG)
+
+#  endif // no CGAL_NO_ASSERTIONS
+
+#else // if CGAL_CFG_NO_CPP0X_STATIC_ASSERT is true
+
+#  if defined(CGAL_NO_ASSERTIONS)
+
+#    define CGAL_static_assertion(EX) \
+     BOOST_STATIC_ASSERT(true) CGAL_UNUSED
+  
+#    define CGAL_static_assertion_msg(EX,MSG) \
+     BOOST_STATIC_ASSERT(true) CGAL_UNUSED
+
+#  else // no CGAL_NO_ASSERTIONS
+
+#    define CGAL_static_assertion(EX) \
+     BOOST_STATIC_ASSERT(EX) CGAL_UNUSED
+  
+#    define CGAL_static_assertion_msg(EX,MSG) \
+     BOOST_STATIC_ASSERT(EX) CGAL_UNUSED
+
+#  endif // no CGAL_NO_ASSERTIONS
+
+#endif // if CGAL_CFG_NO_CPP0X_STATIC_ASSERT is true
+  
+#if defined(CGAL_NO_ASSERTIONS) || !defined(CGAL_CHECK_EXACTNESS)
+#  define CGAL_exactness_assertion(EX) (static_cast<void>(0))
+#  define CGAL_exactness_assertion_msg(EX,MSG) (static_cast<void>(0))
+#  define CGAL_exactness_assertion_code(CODE)
+#else
+#  define CGAL_exactness_assertion(EX) \
+   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__))
+#  define CGAL_exactness_assertion_msg(EX,MSG) \
+   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG))
+#  define CGAL_exactness_assertion_code(CODE) CODE
+#endif // CGAL_NO_ASSERTIONS
+
+#if defined(CGAL_NO_ASSERTIONS) || !defined(CGAL_CHECK_EXPENSIVE)
+#  define CGAL_expensive_assertion(EX) (static_cast<void>(0))
+#  define CGAL_expensive_assertion_msg(EX,MSG) (static_cast<void>(0))
+#  define CGAL_expensive_assertion_code(CODE)
+#else
+#  define CGAL_expensive_assertion(EX) \
+   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__))
+#  define CGAL_expensive_assertion_msg(EX,MSG) \
+   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG))
+#  define CGAL_expensive_assertion_code(CODE) CODE
+#endif // CGAL_NO_ASSERTIONS
+
+#if defined(CGAL_NO_ASSERTIONS) || !defined(CGAL_CHECK_EXACTNESS) || !defined(CGAL_CHECK_EXPENSIVE)
+#  define CGAL_expensive_exactness_assertion(EX) (static_cast<void>(0))
+#  define CGAL_expensive_exactness_assertion_msg(EX,MSG) (static_cast<void>(0))
+#  define CGAL_expensive_exactness_assertion_code(CODE)
+#else
+#  define CGAL_expensive_exactness_assertion(EX) \
+   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__))
+#  define CGAL_expensive_exactness_assertion_msg(EX,MSG) \
+   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG))
+#  define CGAL_expensive_exactness_assertion_code(CODE) CODE
+#endif // CGAL_NO_ASSERTIONS
+
+
+// preconditions
+// -------------
+
+#if defined(CGAL_NO_PRECONDITIONS)
+#  define CGAL_precondition(EX) (static_cast<void>(0))
+#  define CGAL_precondition_msg(EX,MSG) (static_cast<void>(0))
+#  define CGAL_precondition_code(CODE)
+#else
+#  define CGAL_precondition(EX) \
+   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__))
+#  define CGAL_precondition_msg(EX,MSG) \
+   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG))
+#  define CGAL_precondition_code(CODE) CODE
+#endif // CGAL_NO_PRECONDITIONS
+
+#if defined(CGAL_NO_PRECONDITIONS) || !defined(CGAL_CHECK_EXACTNESS)
+#  define CGAL_exactness_precondition(EX) (static_cast<void>(0))
+#  define CGAL_exactness_precondition_msg(EX,MSG) (static_cast<void>(0))
+#  define CGAL_exactness_precondition_code(CODE)
+#else
+#  define CGAL_exactness_precondition(EX) \
+   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__))
+#  define CGAL_exactness_precondition_msg(EX,MSG) \
+   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG))
+#  define CGAL_exactness_precondition_code(CODE) CODE
+#endif // CGAL_NO_PRECONDITIONS
+
+#if defined(CGAL_NO_PRECONDITIONS) || !defined(CGAL_CHECK_EXPENSIVE)
+#  define CGAL_expensive_precondition(EX) (static_cast<void>(0))
+#  define CGAL_expensive_precondition_msg(EX,MSG) (static_cast<void>(0))
+#  define CGAL_expensive_precondition_code(CODE)
+#else
+#  define CGAL_expensive_precondition(EX) \
+   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__))
+#  define CGAL_expensive_precondition_msg(EX,MSG) \
+   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG))
+#  define CGAL_expensive_precondition_code(CODE) CODE
+#endif // CGAL_NO_PRECONDITIONS
+
+#if defined(CGAL_NO_PRECONDITIONS) || !defined(CGAL_CHECK_EXACTNESS) || !defined(CGAL_CHECK_EXPENSIVE) 
+#  define CGAL_expensive_exactness_precondition(EX) (static_cast<void>(0))
+#  define CGAL_expensive_exactness_precondition_msg(EX,MSG) (static_cast<void>(0))
+#  define CGAL_expensive_exactness_precondition_code(CODE)
+#else
+#  define CGAL_expensive_exactness_precondition(EX) \
+   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__))
+#  define CGAL_expensive_exactness_precondition_msg(EX,MSG) \
+   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG))
+#  define CGAL_expensive_exactness_precondition_code(CODE) CODE
+#endif // CGAL_NO_PRECONDITIONS
+
+
+// postconditions
+// --------------
+
+#if defined(CGAL_NO_POSTCONDITIONS)
+#  define CGAL_postcondition(EX) (static_cast<void>(0))
+#  define CGAL_postcondition_msg(EX,MSG) (static_cast<void>(0))
+#  define CGAL_postcondition_code(CODE)
+#else
+#  define CGAL_postcondition(EX) \
+   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__))
+#  define CGAL_postcondition_msg(EX,MSG) \
+   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG))
+#  define CGAL_postcondition_code(CODE) CODE
+#endif // CGAL_NO_POSTCONDITIONS
+
+#if defined(CGAL_NO_POSTCONDITIONS) || !defined(CGAL_CHECK_EXACTNESS)
+#  define CGAL_exactness_postcondition(EX) (static_cast<void>(0))
+#  define CGAL_exactness_postcondition_msg(EX,MSG) (static_cast<void>(0))
+#  define CGAL_exactness_postcondition_code(CODE)
+#else
+#  define CGAL_exactness_postcondition(EX) \
+   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__))
+#  define CGAL_exactness_postcondition_msg(EX,MSG) \
+   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG))
+#  define CGAL_exactness_postcondition_code(CODE) CODE
+#endif // CGAL_NO_POSTCONDITIONS
+
+#if defined(CGAL_NO_POSTCONDITIONS) || !defined(CGAL_CHECK_EXPENSIVE)
+#  define CGAL_expensive_postcondition(EX) (static_cast<void>(0))
+#  define CGAL_expensive_postcondition_msg(EX,MSG) (static_cast<void>(0))
+#  define CGAL_expensive_postcondition_code(CODE)
+#else
+#  define CGAL_expensive_postcondition(EX) \
+   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__))
+#  define CGAL_expensive_postcondition_msg(EX,MSG) \
+   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG))
+#  define CGAL_expensive_postcondition_code(CODE) CODE
+#endif // CGAL_NO_POSTCONDITIONS
+
+#if defined(CGAL_NO_POSTCONDITIONS) || !defined(CGAL_CHECK_EXACTNESS) || !defined(CGAL_CHECK_EXPENSIVE)
+#  define CGAL_expensive_exactness_postcondition(EX) (static_cast<void>(0))
+#  define CGAL_expensive_exactness_postcondition_msg(EX,MSG) (static_cast<void>(0))
+#  define CGAL_expensive_exactness_postcondition_code(CODE)
+#else
+#  define CGAL_expensive_exactness_postcondition(EX) \
+   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__))
+#  define CGAL_expensive_exactness_postcondition_msg(EX,MSG) \
+   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG))
+#  define CGAL_expensive_exactness_postcondition_code(CODE) CODE
+#endif // CGAL_NO_POSTCONDITIONS
+
+
+// warnings
+// --------
+
+#if defined(CGAL_NO_WARNINGS)
+#  define CGAL_warning(EX) (static_cast<void>(0))
+#  define CGAL_warning_msg(EX,MSG) (static_cast<void>(0))
+#  define CGAL_warning_code(CODE)
+#else
+#  define CGAL_warning(EX) \
+   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__))
+#  define CGAL_warning_msg(EX,MSG) \
+   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG))
+#  define CGAL_warning_code(CODE) CODE
+#endif // CGAL_NO_WARNINGS
+
+#if defined(CGAL_NO_WARNINGS) || !defined(CGAL_CHECK_EXACTNESS)
+#  define CGAL_exactness_warning(EX) (static_cast<void>(0))
+#  define CGAL_exactness_warning_msg(EX,MSG) (static_cast<void>(0))
+#  define CGAL_exactness_warning_code(CODE)
+#else
+#  define CGAL_exactness_warning(EX) \
+   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__))
+#  define CGAL_exactness_warning_msg(EX,MSG) \
+   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG))
+#  define CGAL_exactness_warning_code(CODE) CODE
+#endif // CGAL_NO_WARNINGS
+
+#if defined(CGAL_NO_WARNINGS) || !defined(CGAL_CHECK_EXPENSIVE)
+#  define CGAL_expensive_warning(EX) (static_cast<void>(0))
+#  define CGAL_expensive_warning_msg(EX,MSG) (static_cast<void>(0))
+#  define CGAL_expensive_warning_code(CODE)
+#else
+#  define CGAL_expensive_warning(EX) \
+   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__))
+#  define CGAL_expensive_warning_msg(EX,MSG) \
+   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG))
+#  define CGAL_expensive_warning_code(CODE) CODE
+#endif // CGAL_NO_WARNINGS
+
+#if defined(CGAL_NO_WARNINGS) || !defined(CGAL_CHECK_EXACTNESS) || !defined(CGAL_CHECK_EXPENSIVE)
+#  define CGAL_expensive_exactness_warning(EX) (static_cast<void>(0))
+#  define CGAL_expensive_exactness_warning_msg(EX,MSG) (static_cast<void>(0))
+#  define CGAL_expensive_exactness_warning_code(CODE)
+#else
+#  define CGAL_expensive_exactness_warning(EX) \
+   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__))
+#  define CGAL_expensive_exactness_warning_msg(EX,MSG) \
+   (CGAL::possibly(EX)?(static_cast<void>(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG))
+#  define CGAL_expensive_exactness_warning_code(CODE) CODE
+#endif // CGAL_NO_WARNINGS
+
+// CGAL error
+#define CGAL_error_msg(MSG) ::CGAL::assertion_fail( "", __FILE__, __LINE__, MSG )
+#define CGAL_error()        ::CGAL::assertion_fail( "", __FILE__, __LINE__ )
+
+} //namespace CGAL
+
+// This comes last as it is dependant on the macros to be defined.
+// But the macros need CGAL::possibly().
+#include <CGAL/Uncertain.h>
+
+#ifdef CGAL_HEADER_ONLY
+#include <CGAL/assertions_impl.h>
+#endif // CGAL_HEADER_ONLY
+
+#endif // CGAL_ASSERTIONS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/assertions_behaviour.h b/3rdparty/CGAL/include/CGAL/assertions_behaviour.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/assertions_behaviour.h
rename to 3rdparty/CGAL/include/CGAL/assertions_behaviour.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/assertions_impl.h b/3rdparty/CGAL/include/CGAL/assertions_impl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/assertions_impl.h
rename to 3rdparty/CGAL/include/CGAL/assertions_impl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/atomic.h b/3rdparty/CGAL/include/CGAL/atomic.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/atomic.h
rename to 3rdparty/CGAL/include/CGAL/atomic.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/auto_link/CGAL.h b/3rdparty/CGAL/include/CGAL/auto_link/CGAL.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/auto_link/CGAL.h
rename to 3rdparty/CGAL/include/CGAL/auto_link/CGAL.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/auto_link/CORE.h b/3rdparty/CGAL/include/CGAL/auto_link/CORE.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/auto_link/CORE.h
rename to 3rdparty/CGAL/include/CGAL/auto_link/CORE.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/auto_link/ImageIO.h b/3rdparty/CGAL/include/CGAL/auto_link/ImageIO.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/auto_link/ImageIO.h
rename to 3rdparty/CGAL/include/CGAL/auto_link/ImageIO.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/auto_link/LAPACK.h b/3rdparty/CGAL/include/CGAL/auto_link/LAPACK.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/auto_link/LAPACK.h
rename to 3rdparty/CGAL/include/CGAL/auto_link/LAPACK.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/auto_link/Qt.h b/3rdparty/CGAL/include/CGAL/auto_link/Qt.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/auto_link/Qt.h
rename to 3rdparty/CGAL/include/CGAL/auto_link/Qt.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/auto_link/TAUCS.h b/3rdparty/CGAL/include/CGAL/auto_link/TAUCS.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/auto_link/TAUCS.h
rename to 3rdparty/CGAL/include/CGAL/auto_link/TAUCS.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/auto_link/auto_link.h b/3rdparty/CGAL/include/CGAL/auto_link/auto_link.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/auto_link/auto_link.h
rename to 3rdparty/CGAL/include/CGAL/auto_link/auto_link.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/barycenter.h b/3rdparty/CGAL/include/CGAL/barycenter.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/barycenter.h
rename to 3rdparty/CGAL/include/CGAL/barycenter.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/basic.h b/3rdparty/CGAL/include/CGAL/basic.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/basic.h
rename to 3rdparty/CGAL/include/CGAL/basic.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/basic_classes.h b/3rdparty/CGAL/include/CGAL/basic_classes.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/basic_classes.h
rename to 3rdparty/CGAL/include/CGAL/basic_classes.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/basic_constructions_2.h b/3rdparty/CGAL/include/CGAL/basic_constructions_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/basic_constructions_2.h
rename to 3rdparty/CGAL/include/CGAL/basic_constructions_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/basic_constructions_3.h b/3rdparty/CGAL/include/CGAL/basic_constructions_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/basic_constructions_3.h
rename to 3rdparty/CGAL/include/CGAL/basic_constructions_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/bbox_intersection_3.h b/3rdparty/CGAL/include/CGAL/bbox_intersection_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/bbox_intersection_3.h
rename to 3rdparty/CGAL/include/CGAL/bbox_intersection_3.h
diff --git a/3rdparty/CGAL/include/CGAL/bilateral_smooth_point_set.h b/3rdparty/CGAL/include/CGAL/bilateral_smooth_point_set.h
new file mode 100644
index 0000000..6e5487e
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/bilateral_smooth_point_set.h
@@ -0,0 +1,629 @@
+// Copyright (c) 2013-06  INRIA Sophia-Antipolis (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
+// 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(s) : Shihao Wu, Clement Jamin, Pierre Alliez 
+
+#ifndef CGAL_BILATERAL_SMOOTH_POINT_SET_H
+#define CGAL_BILATERAL_SMOOTH_POINT_SET_H
+
+#include <CGAL/Search_traits_3.h>
+#include <CGAL/Orthogonal_k_neighbor_search.h>
+#include <CGAL/property_map.h>
+#include <CGAL/point_set_processing_assertions.h>
+#include <CGAL/Point_with_normal_3.h>
+
+#include <iterator>
+#include <set>
+#include <algorithm>
+#include <cmath>
+#include <ctime>
+#include <CGAL/Real_timer.h>
+#include <CGAL/Memory_sizer.h>
+#include <CGAL/property_map.h>
+
+#ifdef CGAL_LINKED_WITH_TBB
+#include <tbb/parallel_for.h>
+#include <tbb/blocked_range.h>
+#include <tbb/scalable_allocator.h>  
+#endif // CGAL_LINKED_WITH_TBB
+
+// Default allocator: use TBB allocators if available
+#ifdef CGAL_LINKED_WITH_TBB
+# define CGAL_PSP3_DEFAULT_ALLOCATOR tbb::scalable_allocator
+#else // CGAL_LINKED_WITH_TBB
+# define CGAL_PSP3_DEFAULT_ALLOCATOR std::allocator
+#endif // CGAL_LINKED_WITH_TBB
+
+
+//#define CGAL_PSP3_VERBOSE 
+
+namespace CGAL {
+
+// ----------------------------------------------------------------------------
+// Private section
+// ----------------------------------------------------------------------------
+/// \cond SKIP_IN_MANUAL
+
+namespace bilateral_smooth_point_set_internal{
+
+// Item in the Kd-tree: position (Point_3) + index
+template <typename Kernel>
+class Kd_tree_element : public Point_with_normal_3<Kernel>
+{
+public:
+  unsigned int index;
+
+  // basic geometric types
+  typedef typename CGAL::Origin Origin;
+  typedef CGAL::Point_with_normal_3<Kernel> Base;
+
+  Kd_tree_element(const Origin& o = ORIGIN, unsigned int id=0)
+    : Base(o), index(id)
+  {}
+  Kd_tree_element(const Base& p, unsigned int id=0)
+    : Base(p), index(id)
+  {}
+  Kd_tree_element(const Kd_tree_element& other)
+    : Base(other), index(other.index)
+  {}
+};
+
+
+// Helper class for the Kd-tree
+template <typename Kernel>
+class Kd_tree_gt : public Kernel
+{
+public:
+  typedef Kd_tree_element<Kernel> Point_3;
+};
+
+template <typename Kernel>
+class Kd_tree_traits : public CGAL::Search_traits_3<Kd_tree_gt<Kernel> >
+{
+public:
+  typedef typename Kernel::Point_3 PointType;
+};
+
+
+/// Compute bilateral projection for each point
+/// according to their KNN neighborhood points
+/// 
+/// \pre `k >= 2`, radius > 0 , sharpness_angle > 0 && sharpness_angle < 90
+///
+/// @tparam Kernel Geometric traits class.
+/// @tparam Tree KD-tree.
+///
+/// @return 
+
+template <typename Kernel>
+CGAL::Point_with_normal_3<Kernel>
+compute_denoise_projection(
+  const CGAL::Point_with_normal_3<Kernel>& query, ///< 3D point to project
+  const std::vector<CGAL::Point_with_normal_3<Kernel>,
+  CGAL_PSP3_DEFAULT_ALLOCATOR<CGAL::Point_with_normal_3<Kernel> > >& neighbor_pwns,  //
+  typename Kernel::FT radius,                   ///< accept neighborhood radius
+  typename Kernel::FT sharpness_angle           ///< control sharpness(0-90)
+)
+{
+  CGAL_point_set_processing_precondition(radius > 0);
+  CGAL_point_set_processing_precondition(sharpness_angle > 0
+                                         && sharpness_angle < 90);
+
+  // basic geometric types
+  typedef typename Kernel::FT FT;
+  typedef CGAL::Point_with_normal_3<Kernel> Pwn;
+  typedef typename Kernel::Vector_3 Vector;
+  typedef typename Kernel::Point_3 Point;
+
+  FT radius2 = radius * radius;
+
+  FT weight = (FT)0.0;
+  FT iradius16 = -(FT)4.0/radius2;
+  FT project_dist_sum = FT(0.0);
+  FT project_weight_sum = FT(0.0);
+  Vector normal_sum = CGAL::NULL_VECTOR; 
+
+  FT cos_sigma = cos(sharpness_angle / 180.0 * 3.1415926);
+  FT sharpness_bandwidth = std::pow((CGAL::max)(1e-8, 1 - cos_sigma), 2);
+
+  typename std::vector<Pwn,CGAL_PSP3_DEFAULT_ALLOCATOR<Pwn> >::const_iterator 
+    pwn_iter = neighbor_pwns.begin();
+  for (; pwn_iter != neighbor_pwns.end(); ++pwn_iter)
+  {
+    const Point& np = pwn_iter->position();
+    const Vector& nn = pwn_iter->normal();
+
+    FT dist2 = CGAL::squared_distance(query.position(), np);
+    if (dist2 < radius2)
+    {
+      FT theta = std::exp(dist2 * iradius16);
+      FT psi = std::exp(-std::pow(1 - query.normal() * nn, 2)
+        / sharpness_bandwidth);
+
+      weight = theta * psi;
+
+      project_dist_sum += ((query.position() - np) * nn) * weight;
+      project_weight_sum += weight;
+      normal_sum = normal_sum + nn * weight;
+    }
+  }
+
+  Vector update_normal = normal_sum / project_weight_sum;
+  update_normal = update_normal / sqrt(update_normal.squared_length());
+
+  Point update_point = query.position() - update_normal * 
+                      (project_dist_sum / project_weight_sum); 
+
+  return Pwn(update_point, update_normal);
+}
+
+/// Computes neighbors from kdtree.
+///
+/// \pre `k >= 2`.
+///
+/// @tparam Kernel Geometric traits class.
+/// @tparam Tree KD-tree.
+///
+/// @return neighbors pwn of query point.
+template < typename Kernel,
+           typename Tree>
+std::vector<CGAL::Point_with_normal_3<Kernel>,
+            CGAL_PSP3_DEFAULT_ALLOCATOR<CGAL::Point_with_normal_3<Kernel> > >
+compute_kdtree_neighbors(
+  const CGAL::Point_with_normal_3<Kernel>& query, ///< 3D point
+  const Tree& tree,                               ///< KD-tree
+  unsigned int k                                  ///< number of neighbors         
+)                       
+{
+  // basic geometric types
+  typedef CGAL::Point_with_normal_3<Kernel> Pwn;
+
+  // types for K nearest neighbors search
+  typedef bilateral_smooth_point_set_internal::Kd_tree_traits<Kernel> Tree_traits;
+  typedef CGAL::Orthogonal_k_neighbor_search<Tree_traits> Neighbor_search;
+  typedef typename Neighbor_search::iterator Search_iterator;
+
+  // performs k + 1 queries (if unique the query point is
+  // output first). search may be aborted when k is greater
+  // than number of input points
+  Neighbor_search search(tree, query, k+1);
+  Search_iterator search_iterator = search.begin();
+  ++search_iterator;
+  unsigned int i;
+  std::vector<CGAL::Point_with_normal_3<Kernel>
+    , CGAL_PSP3_DEFAULT_ALLOCATOR<CGAL::Point_with_normal_3<Kernel> > 
+    > neighbor_pwns;
+
+  for(i = 0; i < (k+1); ++i)
+  {
+    if(search_iterator == search.end())
+      break; // premature ending
+
+    Pwn pwn = search_iterator->first;
+    neighbor_pwns.push_back(pwn);
+    ++search_iterator;
+  }
+
+  // output 
+  return neighbor_pwns;
+}
+
+
+/// Computes max-spacing of one query point from K nearest neighbors.
+///
+/// \pre `k >= 2`.
+///
+/// @tparam Kernel Geometric traits class.
+/// @tparam Tree KD-tree.
+///
+/// @return max spacing.
+template < typename Kernel,
+           typename Tree >
+typename Kernel::FT
+compute_max_spacing(
+  const CGAL::Point_with_normal_3<Kernel>& query, ///< 3D point
+  Tree& tree,                                     ///< KD-tree
+  unsigned int k)                                 ///< number of neighbors
+{
+  // basic geometric types
+  typedef typename Kernel::FT FT;
+  typedef CGAL::Point_with_normal_3<Kernel> Pwn;
+
+  // types for K nearest neighbors search
+  typedef bilateral_smooth_point_set_internal::Kd_tree_traits<Kernel> Tree_traits;
+  typedef CGAL::Orthogonal_k_neighbor_search<Tree_traits> Neighbor_search;
+  typedef typename Neighbor_search::iterator Search_iterator;
+
+  // performs k + 1 queries (if unique the query point is
+  // output first). search may be aborted when k is greater
+  // than number of input points
+  Neighbor_search search(tree,query,k+1);
+  Search_iterator search_iterator = search.begin();
+  ++search_iterator;
+  FT max_distance = (FT)0.0;
+  unsigned int i;
+  for(i = 0; i < (k+1) ; ++i)
+  {
+    if(search_iterator == search.end())
+      break; // premature ending
+
+    Pwn pwn = search_iterator->first;
+    double dist2 = CGAL::squared_distance(query.position(), pwn.position());
+    max_distance = (CGAL::max)(dist2, max_distance);
+    ++search_iterator;
+  }
+
+  // output max spacing
+  return std::sqrt(max_distance);
+}
+
+} /* namespace internal */
+
+/// \endcond
+
+#ifdef CGAL_LINKED_WITH_TBB
+/// \cond SKIP_IN_MANUAL
+/// This is for parallelization of function: bilateral_smooth_point_set()
+template <typename Kernel, typename Tree>
+class Compute_pwns_neighbors
+{
+  typedef typename CGAL::Point_with_normal_3<Kernel> Pwn;
+  typedef typename std::vector<Pwn,CGAL_PSP3_DEFAULT_ALLOCATOR<Pwn> > Pwns;
+  typedef typename std::vector<Pwns,CGAL_PSP3_DEFAULT_ALLOCATOR<Pwns> > 
+                                                                Pwns_neighbors;
+  typedef typename Kernel::FT FT;
+
+  unsigned int                                              m_k;
+  const Tree                                              & m_tree;
+  const Pwns                                              & m_pwns;
+  Pwns_neighbors                                          & m_pwns_neighbors;
+
+public:
+  Compute_pwns_neighbors(unsigned int k, const Tree &tree,
+                         const Pwns &pwns, Pwns_neighbors &neighbors)
+    : m_k(k), m_tree(tree), m_pwns(pwns), m_pwns_neighbors(neighbors) {} 
+
+  void operator() ( const tbb::blocked_range<size_t>& r ) const 
+  {
+    for (size_t i = r.begin(); i!=r.end(); i++)
+    {
+      m_pwns_neighbors[i] = bilateral_smooth_point_set_internal::
+        compute_kdtree_neighbors<Kernel, Tree>(m_pwns[i], m_tree, m_k);
+    }
+  }
+};
+/// \endcond  
+
+/// \cond SKIP_IN_MANUAL
+/// This is for parallelization of function: compute_denoise_projection()
+template <typename Kernel>
+class Pwn_updater 
+{
+  typedef typename CGAL::Point_with_normal_3<Kernel> Pwn;
+  typedef typename std::vector<Pwn,CGAL_PSP3_DEFAULT_ALLOCATOR<Pwn> > Pwns;
+  typedef typename Kernel::FT FT;
+
+  FT sharpness_angle;
+  FT radius;
+  Pwns* pwns;
+  Pwns* update_pwns;
+  std::vector<Pwns,CGAL_PSP3_DEFAULT_ALLOCATOR<Pwns> >* pwns_neighbors;
+
+public:
+  Pwn_updater(FT sharpness, 
+    FT r,
+    Pwns *in,
+    Pwns *out, 
+    std::vector<Pwns,CGAL_PSP3_DEFAULT_ALLOCATOR<Pwns> >* neighbors): 
+  sharpness_angle(sharpness), 
+    radius(r),
+    pwns(in),
+    update_pwns(out),
+    pwns_neighbors(neighbors){} 
+
+
+  void operator() ( const tbb::blocked_range<size_t>& r ) const 
+  { 
+    for (size_t i = r.begin(); i != r.end(); ++i) 
+    {
+      (*update_pwns)[i] = bilateral_smooth_point_set_internal::
+        compute_denoise_projection<Kernel>((*pwns)[i], 
+        (*pwns_neighbors)[i], 
+        radius,
+        sharpness_angle);  
+
+    }
+  }
+};
+/// \endcond
+#endif // CGAL_LINKED_WITH_TBB
+
+
+// ----------------------------------------------------------------------------
+// Public section
+// ----------------------------------------------------------------------------
+
+//=============================================================================
+/// \ingroup PkgPointSetProcessing
+/// 
+/// This function smooths an input point set by iteratively projecting each 
+///  point onto the implicit surface patch fitted over its k nearest neighbors.
+///  Bilateral projection preserves sharp features according to the normal
+/// (gradient) information. Both point positions and normals will be modified.  
+/// For more details, please see section 4 in \cgalCite{ear-2013}.  
+///
+/// A parallel version of this function is provided and requires the executable to be 
+/// linked against the <a href="http://www.threadingbuildingblocks.org">Intel TBB library</a>.
+/// To control the number of threads used, the user may use the tbb::task_scheduler_init class.
+/// See the <a href="http://www.threadingbuildingblocks.org/documentation">TBB documentation</a> 
+/// for more details.
+///
+/// \pre Normals must be unit vectors
+/// \pre k >= 2
+///
+/// @tparam Concurrency_tag enables sequential versus parallel algorithm.
+///                         Possible values are `Sequential_tag`
+///                         and `Parallel_tag`.
+/// @tparam ForwardIterator iterator over input points.
+/// @tparam PointPMap is a model of `ReadWritePropertyMap` 
+///         with the value type of `ForwardIterator` as key and `Kernel::Point_3` as value type.
+///         It can be omitted if the value type of `ForwardIterator` is convertible to 
+///         `Kernel::Point_3`.
+/// @tparam NormalPMap is a model of `ReadWritePropertyMap` with the value type of `ForwardIterator` as key
+///         and `Kernel::Vector_3` as value type.
+/// @tparam Kernel Geometric traits class.
+///      It can be omitted and deduced automatically from the value type of  `PointPMap`
+///      using `Kernel_traits`.
+///
+/// @return Average point movement error. It's a convergence criterium for the algorithm.
+///         This value can help the user to decide how many iterations are
+///         sufficient.
+
+// This variant requires all parameters.
+template <typename Concurrency_tag,
+          typename ForwardIterator,
+          typename PointPMap,
+          typename NormalPMap,
+          typename Kernel>
+double
+bilateral_smooth_point_set(
+  ForwardIterator first,    ///< forward iterator on the first input point.
+  ForwardIterator beyond,   ///< past-the-end iterator.
+  PointPMap point_pmap,     ///< point property map.
+  NormalPMap normal_pmap,   ///< normal property map.
+  unsigned int k,           ///< size of the neighborhood for the implicit surface patch fitting.
+                            ///< The larger the value is, the smoother the result will be.
+  typename Kernel::FT sharpness_angle,  ///< controls the sharpness of the result.
+                            ///< The larger the value is, the smoother the result will be.
+                            ///< The range of possible value is [0, 90].
+  const Kernel& /*kernel*/) ///< geometric traits.
+{
+  // basic geometric types
+  typedef typename CGAL::Point_with_normal_3<Kernel> Pwn;
+  typedef typename std::vector<Pwn,CGAL_PSP3_DEFAULT_ALLOCATOR<Pwn> > Pwns;
+  typedef typename Kernel::FT FT;
+
+  CGAL_point_set_processing_precondition(first != beyond);
+  CGAL_point_set_processing_precondition(k > 1);
+
+  // types for K nearest neighbors search structure
+  typedef bilateral_smooth_point_set_internal::
+                                       Kd_tree_element<Kernel> Kd_tree_element;
+  typedef bilateral_smooth_point_set_internal::Kd_tree_traits<Kernel> Tree_traits;
+  typedef CGAL::Orthogonal_k_neighbor_search<Tree_traits> Neighbor_search;
+  typedef typename Neighbor_search::Tree Tree;
+
+  // copy points and normals
+  Pwns pwns;
+  for(ForwardIterator it = first; it != beyond; ++it)
+  {
+    typename boost::property_traits<PointPMap>::reference p = get(point_pmap, *it);
+    typename boost::property_traits<NormalPMap>::reference n = get(normal_pmap, *it);
+    CGAL_point_set_processing_precondition(n.squared_length() > 1e-10);
+    
+    pwns.push_back(Pwn(p, n));
+  }
+
+  std::size_t nb_points = pwns.size();
+
+#ifdef CGAL_PSP3_VERBOSE
+   std::cout << "Initialization and compute max spacing: " << std::endl;
+#endif
+   // initiate a KD-tree search for points
+   std::vector<Kd_tree_element,
+     CGAL_PSP3_DEFAULT_ALLOCATOR<Kd_tree_element> > treeElements;
+   treeElements.reserve(pwns.size());
+   typename std::vector<Pwn,CGAL_PSP3_DEFAULT_ALLOCATOR<Pwn> >::iterator 
+     pwn_iter = pwns.begin();
+   for (unsigned int i = 0; pwn_iter != pwns.end(); ++pwn_iter)
+   {
+     treeElements.push_back(Kd_tree_element(*pwn_iter, i));
+   }
+   Tree tree(treeElements.begin(), treeElements.end());
+   // Guess spacing
+#ifdef CGAL_PSP3_VERBOSE
+   CGAL::Real_timer task_timer;
+   task_timer.start();
+#endif
+   FT guess_neighbor_radius = 0.0; 
+
+   for(pwn_iter = pwns.begin(); pwn_iter != pwns.end(); ++pwn_iter)
+   {
+     FT max_spacing = bilateral_smooth_point_set_internal::
+       compute_max_spacing<Kernel,Tree>(*pwn_iter, tree, k);
+     guess_neighbor_radius = (CGAL::max)(max_spacing, guess_neighbor_radius); 
+   }
+   
+#ifdef CGAL_PSP3_VERBOSE
+   task_timer.stop();
+#endif
+   guess_neighbor_radius *= 0.95;
+
+#ifdef CGAL_PSP3_VERBOSE
+   CGAL::Memory_sizer::size_type memory = CGAL::Memory_sizer().virtual_size();
+   std::cout << "done: " << task_timer.time() << " seconds, "
+             << (memory>>20) << " Mb allocated" << std::endl;
+
+   std::cout << "Compute all neighbors: " << std::endl;
+   task_timer.reset();
+   task_timer.start();
+#endif
+   // compute all neighbors
+   std::vector<Pwns,CGAL_PSP3_DEFAULT_ALLOCATOR<Pwns> > pwns_neighbors;
+   pwns_neighbors.resize(nb_points);
+ 
+#ifndef CGAL_LINKED_WITH_TBB
+  CGAL_static_assertion_msg (!(boost::is_convertible<Concurrency_tag, Parallel_tag>::value),
+			     "Parallel_tag is enabled but TBB is unavailable.");
+#else
+   if (boost::is_convertible<Concurrency_tag,Parallel_tag>::value)
+   {
+     Compute_pwns_neighbors<Kernel, Tree> f(k, tree, pwns, pwns_neighbors);
+     tbb::parallel_for(tbb::blocked_range<size_t>(0, nb_points), f);
+   }
+   else
+#endif
+   {
+     typename std::vector<Pwns,CGAL_PSP3_DEFAULT_ALLOCATOR<Pwns> >::iterator 
+       pwns_iter = pwns_neighbors.begin();
+
+     for(pwn_iter = pwns.begin(); pwn_iter != pwns.end(); ++pwn_iter, ++pwns_iter)
+     {
+       *pwns_iter = bilateral_smooth_point_set_internal::
+         compute_kdtree_neighbors<Kernel, Tree>(*pwn_iter, tree, k);
+     }
+   }
+   
+#ifdef CGAL_PSP3_VERBOSE
+   task_timer.stop();
+   memory = CGAL::Memory_sizer().virtual_size();
+   std::cout << "done: " << task_timer.time() << " seconds, "
+             << (memory>>20) << " Mb allocated" << std::endl;
+
+   std::cout << "Compute update points and normals: " << std::endl;
+   task_timer.reset();
+   task_timer.start();
+#endif
+   // update points and normals
+   Pwns update_pwns(nb_points);
+
+#ifdef CGAL_LINKED_WITH_TBB
+   if(boost::is_convertible<Concurrency_tag, CGAL::Parallel_tag>::value)
+   {
+     //tbb::task_scheduler_init init(4);
+     tbb::blocked_range<size_t> block(0, nb_points);
+     Pwn_updater<Kernel> pwn_updater(sharpness_angle,
+                                     guess_neighbor_radius,
+                                     &pwns,
+                                     &update_pwns,
+                                     &pwns_neighbors);
+     tbb::parallel_for(block, pwn_updater);
+   }
+   else
+#endif // CGAL_LINKED_WITH_TBB
+   {
+     typename std::vector<Pwn,CGAL_PSP3_DEFAULT_ALLOCATOR<Pwn> >::iterator 
+       update_iter = update_pwns.begin();
+     typename std::vector<Pwns,CGAL_PSP3_DEFAULT_ALLOCATOR<Pwns> >::iterator 
+       neighbor_iter = pwns_neighbors.begin();
+     for(pwn_iter = pwns.begin(); pwn_iter != pwns.end(); 
+         ++pwn_iter, ++update_iter, ++neighbor_iter)
+     {
+       *update_iter = bilateral_smooth_point_set_internal::
+         compute_denoise_projection<Kernel>
+         (*pwn_iter, 
+          *neighbor_iter, 
+          guess_neighbor_radius, 
+          sharpness_angle);
+     }
+   }
+#ifdef CGAL_PSP3_VERBOSE
+   task_timer.stop(); 
+   memory = CGAL::Memory_sizer().virtual_size();
+   std::cout << "done: " << task_timer.time() << " seconds, "
+             << (memory>>20) << " Mb allocated" << std::endl;
+#endif
+   // save results
+   FT sum_move_error = 0;
+   ForwardIterator it = first;
+   for(unsigned int i = 0 ; it != beyond; ++it, ++i)
+   {
+     typename boost::property_traits<PointPMap>::reference p = get(point_pmap, *it);
+     sum_move_error += CGAL::squared_distance(p, update_pwns[i].position());
+     put (point_pmap, *it, update_pwns[i].position());
+     put (normal_pmap, *it, update_pwns[i].normal());
+   }
+     
+   return sum_move_error / nb_points;
+}
+
+
+/// @cond SKIP_IN_MANUAL
+// This variant deduces the kernel from the point property map.
+template <typename Concurrency_tag,
+          typename ForwardIterator,
+          typename PointPMap,
+          typename NormalPMap>
+double
+bilateral_smooth_point_set(
+  ForwardIterator first,      ///< forward iterator to the first input point.
+  ForwardIterator beyond,     ///< past-the-end iterator.
+  PointPMap point_pmap,        ///< property map OutputIterator -> Point_3.
+  NormalPMap normal_pmap,    ///< property map ForwardIterator -> Vector_3.
+  const unsigned int k,      ///< number of neighbors.
+  double sharpness_angle     ///< control sharpness(0-90)
+) ///< property map OutputIterator -> Vector_3.
+{
+  typedef typename boost::property_traits<PointPMap>::value_type Point;
+  typedef typename Kernel_traits<Point>::Kernel Kernel;
+  return bilateral_smooth_point_set<Concurrency_tag>(
+    first, beyond,
+    point_pmap,
+    normal_pmap,
+    k,
+    sharpness_angle,
+    Kernel());
+}
+/// @endcond
+
+/// @cond SKIP_IN_MANUAL
+// This variant creates a default point property map = Dereference_property_map.
+template <typename Concurrency_tag,
+          typename ForwardIterator,
+          typename NormalPMap>
+double
+bilateral_smooth_point_set(
+  ForwardIterator first,    ///< forward iterator to the first input point.
+  ForwardIterator beyond,   ///< past-the-end iterator.
+  const unsigned int k,     ///< number of neighbors.
+  double sharpness_angle,   ///< control sharpness(0-90)
+  NormalPMap normal_pmap)   ///< property map OutputIterator -> Vector_3.
+{
+  return bilateral_smooth_point_set<Concurrency_tag>(
+    first, beyond,
+    make_identity_property_map(
+    typename std::iterator_traits<ForwardIterator>::value_type()),
+    normal_pmap, 
+    k,
+    sharpness_angle);
+}
+/// @endcond
+
+
+} //namespace CGAL
+
+#endif // CGAL_BILATERAL_SMOOTH_POINT_SET_H
diff --git a/3rdparty/CGAL/include/CGAL/boost/graph/Dual.h b/3rdparty/CGAL/include/CGAL/boost/graph/Dual.h
new file mode 100644
index 0000000..ff6ae14
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/boost/graph/Dual.h
@@ -0,0 +1,480 @@
+// Copyright (c) 2015  GeometryFactory (France).  All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Andreas Fabri
+
+#ifndef CGAL_BGL_DUAL_H
+#define CGAL_BGL_DUAL_H
+
+#include <CGAL/boost/graph/properties.h>
+#include <boost/range/distance.hpp>
+
+namespace CGAL {
+
+/*!
+\ingroup PkgBGLHelper
+
+The class template `Dual` is an adaptor that creates the dual view of
+a `FaceGraph`. Faces of the original graph correspond to vertices in
+the `Dual` and vice versa.
+
+Note that border edges in a `Dual` have the `null_face` of the
+original graph as either source or target. This is unusual and might
+break other algorithms since edges are always assumed to have non-null
+vertices as a source and target. It is possible to filter border edges
+using `boost::filtered_graph` as shown in example
+\ref BGL_surface_mesh/surface_mesh_dual.cpp
+
+Property forwarding
+-------------------
+\cgalAdvancedBegin
+Edge properties of the underlying graph are forwarded directly. For
+faces and vertices only the `face_index` and `vertex_index` properties
+are forwarded. Accessing other properties will lead to a compilation
+error.
+\cgalAdvancedEnd
+*/
+template <typename Primal_>
+class Dual
+{
+  const Primal_& primal_;
+
+public:
+  /*! The underlying primal type. */
+  typedef Primal_ Primal;
+
+  /*! Construct a Dual from a given primal. */
+  Dual(const Primal& primal)
+    : primal_(primal) {}
+
+  /*! Returns the underlying primal. */
+  const Primal& primal() const
+  { return primal_; }
+};
+
+
+/*!
+  Construct a `Dual` from a given `primal`.
+  \relates CGAL::Dual
+ */
+template<typename Primal>
+Dual<Primal> dual(const Primal& primal)
+{ return Dual<Primal>(primal); }
+
+} // namespace CGAL
+
+namespace boost {
+  
+template <typename Primal>
+class graph_traits<CGAL::Dual<Primal> >
+{
+  typedef boost::graph_traits<Primal> GTP;
+public:
+  typedef typename GTP::face_descriptor     vertex_descriptor;
+  typedef typename GTP::vertex_descriptor   face_descriptor;
+  typedef typename GTP::halfedge_descriptor halfedge_descriptor;
+  typedef typename GTP::edge_descriptor     edge_descriptor;
+  typedef typename GTP::directed_category   directed_category;
+  typedef boost::allow_parallel_edge_tag    edge_parallel_category; 
+  typedef typename GTP::traversal_category  traversal_category;
+
+  typedef typename GTP::faces_size_type          vertices_size_type;
+  typedef typename GTP::vertices_size_type       faces_size_type;
+  typedef typename GTP::edges_size_type          edges_size_type;
+  typedef typename GTP::halfedges_size_type      halfedges_size_type;
+  typedef typename GTP::degree_size_type         degree_size_type;
+
+  typedef typename GTP::face_iterator     vertex_iterator;
+  typedef typename GTP::vertex_iterator   face_iterator;
+  typedef typename GTP::halfedge_iterator halfedge_iterator;
+  typedef typename GTP::edge_iterator     edge_iterator;
+
+  typedef CGAL::Halfedge_around_face_iterator<Primal>      in_edge_iterator;
+  typedef CGAL::Opposite_edge_around_face_iterator<Primal> out_edge_iterator;
+
+  static vertex_descriptor   null_vertex()   { return vertex_descriptor(); }
+  static face_descriptor     null_face()     { return face_descriptor(); }
+  static halfedge_descriptor null_halfedge() { return halfedge_descriptor(); }
+};
+ 
+template<typename P>
+struct graph_traits< const CGAL::Dual<P> >  
+  : public graph_traits< CGAL::Dual<P> >
+{}; 
+
+namespace internal{
+
+template <class G>
+struct Dual_vertex_index_pmap{
+  typedef typename boost::property_map<G, boost::face_index_t>::type  Property_map;
+  Property_map m_pmap;
+
+  typedef typename boost::graph_traits<G>::face_descriptor key_type;
+  typedef typename Property_map::value_type value_type;
+  typedef typename Property_map::reference reference;
+  typedef typename Property_map::category category;
+
+  Dual_vertex_index_pmap(const G& g)
+    : m_pmap( get(boost::face_index, g) )
+  {}
+
+  friend reference get(const Dual_vertex_index_pmap<G>& pmap, key_type fd) {
+    return get(pmap.m_pmap, fd);
+  }
+};
+
+template <class G>
+struct Dual_face_index_pmap{
+  typedef typename boost::property_map<G, boost::vertex_index_t>::type  Property_map;
+  Property_map m_pmap;
+
+  typedef typename boost::graph_traits<G>::vertex_descriptor key_type;
+  typedef typename Property_map::value_type value_type;
+  typedef typename Property_map::reference reference;
+  typedef typename Property_map::category category;
+
+  Dual_face_index_pmap(const G& g)
+    : m_pmap( get(boost::vertex_index, g) )
+  {}
+
+  friend reference get(const Dual_face_index_pmap<G>& pmap, key_type vd) {
+    return get(pmap.m_pmap, vd);
+  }
+};
+
+template<typename P, typename Property,
+         bool is_edge = boost::is_same<boost::edge_property_tag,
+                                       typename boost::property_kind<Property>::type>::value>
+struct Dual_property_maps : boost::property_map<P, Property> {};
+
+template< typename P, typename Property>
+struct Dual_property_maps<P, Property, false> {};
+
+} //end of namespace internal
+
+template <typename P, typename Property>
+struct property_map<CGAL::Dual<P>, Property>
+  : internal::Dual_property_maps<P, Property> {};
+
+template <typename P>
+struct property_map<CGAL::Dual<P>, boost::vertex_index_t>
+{
+  typedef internal::Dual_vertex_index_pmap<P> type;
+  typedef internal::Dual_vertex_index_pmap<P> const_type;
+};
+
+template <typename P>
+struct property_map<CGAL::Dual<P>, boost::face_index_t>
+{
+  typedef internal::Dual_face_index_pmap<P> type;
+  typedef internal::Dual_face_index_pmap<P> const_type;
+};
+
+} // namespace boost
+
+namespace CGAL {
+
+template <typename P, typename Property>
+typename boost::property_map<P, Property>::type
+get(Property p, Dual<P>& dual)
+{
+  return get(p, dual.primal());
+}
+
+template <typename P, typename Property>
+typename boost::property_map<P, Property>::const_type
+get(Property p, const Dual<P>& dual)
+{
+  return get(p, dual.primal());
+}
+
+template <typename P, typename Property, typename Key >
+typename boost::property_map_value<P, Property>::type
+get(Property p, const Dual<P>& dual, const Key& k)
+{
+  return get(p, dual.primal(), k);
+}
+
+template<typename G, typename P, typename>
+struct Property_map_value_dummy {
+  typedef typename boost::property_map_value<G, P>::type type;
+};
+
+template <typename P, typename Key>
+typename Property_map_value_dummy<Dual<P>, boost::vertex_index_t, Key>::type
+get(boost::vertex_index_t, const Dual<P>& dual, const Key& k)
+{
+  return get(typename boost::internal::Dual_vertex_index_pmap<P>(dual.primal()), k);
+}
+
+template <typename P, typename Key>
+typename Property_map_value_dummy<Dual<P>, boost::face_index_t, Key>::type
+get(boost::face_index_t, const Dual<P>& dual, const Key& k)
+{
+  return get(typename boost::internal::Dual_face_index_pmap<P>(dual.primal()), k);
+}
+
+template <typename P, typename Property, typename Key, typename Value>
+void
+put(Property p, const Dual<P>& dual, const Key& k, const Value& val)
+{
+  put(p, dual.primal(), k, val);
+}
+
+template <typename P>
+typename boost::internal::Dual_vertex_index_pmap<P>
+get(boost::vertex_index_t, const Dual<P>& dual)
+{
+  return typename boost::internal::Dual_vertex_index_pmap<P>(dual.primal());
+}
+
+template <typename P>
+typename boost::internal::Dual_face_index_pmap<P>
+get(boost::face_index_t, const Dual<P>& dual)
+{
+  return typename boost::internal::Dual_face_index_pmap<P>(dual.primal());
+}
+
+template <typename P>
+typename boost::graph_traits<CGAL::Dual<P> >::vertices_size_type
+num_vertices(const CGAL::Dual<P>& dual)
+{
+  return num_faces(dual.primal());
+}
+
+template <typename P>
+typename boost::graph_traits<CGAL::Dual<P> >::edges_size_type
+num_edges(const CGAL::Dual<P>& dual)
+{
+  return num_edges(dual.primal());
+}
+
+template <typename P>
+typename boost::graph_traits<CGAL::Dual<P> >::halfedges_size_type
+num_halfedges(const CGAL::Dual<P>& dual)
+{
+  return num_halfedges(dual.primal());
+}
+     
+template <typename P>
+typename boost::graph_traits<CGAL::Dual<P> >::faces_size_type
+num_faces(const CGAL::Dual<P>& dual)
+{
+  return num_vertices(dual.primal());
+}
+
+template <typename P>
+Iterator_range<typename boost::graph_traits<Dual<P> >::vertex_iterator>
+vertices(const CGAL::Dual<P>& dual)
+{
+  return faces(dual.primal()); 
+}
+
+template <typename P>
+Iterator_range<typename boost::graph_traits<Dual<P> >::face_iterator>
+faces(const CGAL::Dual<P>& dual)
+{
+  return vertices(dual.primal()); 
+}
+    
+template <typename P>
+Iterator_range<typename boost::graph_traits<Dual<P> >::halfedge_iterator>
+halfedges(const CGAL::Dual<P>& dual)
+{
+  return halfedges(dual.primal()); 
+}
+  
+template <typename P>
+Iterator_range<typename boost::graph_traits<Dual<P> >::edge_iterator>
+edges(const CGAL::Dual<P>& dual)
+{
+  return edges(dual.primal()); 
+}
+
+template <typename P>
+std::pair<typename boost::graph_traits<Dual<P> >::edge_descriptor, bool>
+edge(typename boost::graph_traits<Dual<P> >::vertex_descriptor u, 
+     typename boost::graph_traits<Dual<P> >::vertex_descriptor v, 
+     const Dual<P>& dual)
+{
+  typename boost::graph_traits<Dual<P> >::out_edge_iterator e, e_end;
+  for(boost::tie(e, e_end) = out_edges(u, dual); e != e_end; ++e) {
+    if(target(*e, dual) == v)
+      return std::make_pair(*e, true);
+  }
+  
+  return std::make_pair(typename boost::graph_traits<Dual<P> >::edge_descriptor(), false);
+}
+
+template <typename P>
+typename boost::graph_traits<Dual<P> >::edge_descriptor
+edge(typename boost::graph_traits<Dual<P> >::halfedge_descriptor h,
+     const Dual<P>& dual)
+{
+  return edge(h, dual.primal());
+}
+
+template <typename P>
+typename boost::graph_traits<Dual<P> >::vertex_descriptor
+source(typename boost::graph_traits<Dual<P> >::halfedge_descriptor h,
+       const Dual<P>& dual)
+{
+  const typename Dual<P>::Primal& primal = dual.primal();
+  return face(opposite(h,primal),primal);
+}
+ 
+template <typename P>
+typename boost::graph_traits<Dual<P> >::vertex_descriptor
+target(typename boost::graph_traits<Dual<P> >::halfedge_descriptor h,
+       const Dual<P>& dual)
+{
+  const typename Dual<P>::Primal& primal = dual.primal();
+  return face(h,primal);
+}
+ 
+
+template <typename P>
+typename boost::graph_traits<Dual<P> >::vertex_descriptor
+source(typename boost::graph_traits<Dual<P> >::edge_descriptor h,
+       const Dual<P>& dual)
+{
+  const typename Dual<P>::Primal& primal = dual.primal();
+  return face(opposite(halfedge(h,primal),primal),primal);
+}
+ 
+template <typename P>
+typename boost::graph_traits<Dual<P> >::vertex_descriptor
+target(typename boost::graph_traits<Dual<P> >::edge_descriptor h,
+       const Dual<P>& dual)
+{
+  const typename Dual<P>::Primal& primal = dual.primal();
+  return face(halfedge(h,primal),primal);
+}
+
+template <typename P>
+typename boost::graph_traits<Dual<P> >::halfedge_descriptor
+halfedge(typename boost::graph_traits<Dual<P> >::vertex_descriptor v,
+         const Dual<P>& dual)
+{
+  return halfedge(v, dual.primal());
+}
+
+template <typename P>
+typename boost::graph_traits<Dual<P> >::halfedge_descriptor
+halfedge(typename boost::graph_traits<Dual<P> >::face_descriptor f,
+         const Dual<P>& dual)
+{
+  return halfedge(f, dual.primal());
+}
+
+template <typename P>
+typename boost::graph_traits<Dual<P> >::halfedge_descriptor
+halfedge(typename boost::graph_traits<Dual<P> >::edge_descriptor e,
+         const Dual<P>& dual)
+{
+  return halfedge(e, dual.primal());
+}
+
+template <typename P>
+std::pair<typename boost::graph_traits<Dual<P> >::halfedge_descriptor, bool>
+halfedge(typename boost::graph_traits<Dual<P> >::vertex_descriptor u,
+         typename boost::graph_traits<Dual<P> >::vertex_descriptor v,
+         const Dual<P>& dual)
+{
+  typename boost::graph_traits<Dual<P> >::out_edge_iterator e, e_end;
+  for(boost::tie(e, e_end) = out_edges(u, dual); e != e_end; ++e) {
+    if(target(*e, dual) == v)
+      return std::make_pair(halfedge(*e, dual), true);
+  }
+  
+  return std::make_pair(boost::graph_traits<Dual<P> >::null_halfedge(), false);
+}
+
+template <typename P>
+typename boost::graph_traits<Dual<P> >::face_descriptor
+face(typename boost::graph_traits<Dual<P> >::halfedge_descriptor h,
+       const Dual<P>& dual)
+{
+  const typename Dual<P>::Primal& primal = dual.primal();
+  return target(h,primal);
+}
+
+template <typename P>
+typename boost::graph_traits<Dual<P> >::halfedge_descriptor
+opposite(typename boost::graph_traits<Dual<P> >::halfedge_descriptor h,
+         const Dual<P>& dual)
+{
+  return opposite(h, dual.primal());
+}
+
+template <typename P>
+typename boost::graph_traits<Dual<P> >::halfedge_descriptor
+next(typename boost::graph_traits<Dual<P> >::halfedge_descriptor h,
+         const Dual<P>& dual)
+{
+  const typename Dual<P>::Primal& primal = dual.primal();
+  return opposite(prev(h,primal),primal);
+}  
+
+template <typename P>
+typename boost::graph_traits<Dual<P> >::halfedge_descriptor
+prev(typename boost::graph_traits<Dual<P> >::halfedge_descriptor h,
+         const Dual<P>& dual)
+{
+  const typename Dual<P>::Primal& primal = dual.primal();
+  return next(opposite(h,primal),primal);
+}  
+
+template <typename P>
+Iterator_range<typename boost::graph_traits<Dual<P> >::out_edge_iterator>
+out_edges(typename boost::graph_traits<Dual<P> >::vertex_descriptor v,
+          const Dual<P>& dual)
+{
+  const typename Dual<P>::Primal& primal = dual.primal();
+  return opposite_edges_around_face(halfedge(v,primal),primal);
+}
+
+template <typename P>
+Iterator_range<typename boost::graph_traits<Dual<P> >::out_edge_iterator>
+in_edges(typename boost::graph_traits<Dual<P> >::vertex_descriptor v,
+         const Dual<P>& dual)
+{
+  const typename Dual<P>::Primal& primal = dual.primal();
+  return halfedges_around_face(halfedge(v,primal),primal);
+}
+       
+template <typename P>
+typename boost::graph_traits<Dual<P> >::degree_size_type
+out_degree(typename boost::graph_traits<Dual<P> >::vertex_descriptor v,
+           const Dual<P>& dual)
+{
+  const typename Dual<P>::Primal& primal = dual.primal();
+  return boost::distance(halfedges_around_face(halfedge(v,primal),primal));
+}
+
+ template <typename P>
+typename boost::graph_traits<Dual<P> >::degree_size_type
+in_degree(typename boost::graph_traits<Dual<P> >::vertex_descriptor v,
+           const Dual<P>& dual)
+{
+  return out_degree(v,dual);
+}
+         
+        
+} // namespace CGAL
+
+#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/Euler_operations.h b/3rdparty/CGAL/include/CGAL/boost/graph/Euler_operations.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/boost/graph/Euler_operations.h
rename to 3rdparty/CGAL/include/CGAL/boost/graph/Euler_operations.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/Graph_geometry.h b/3rdparty/CGAL/include/CGAL/boost/graph/Graph_geometry.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/boost/graph/Graph_geometry.h
rename to 3rdparty/CGAL/include/CGAL/boost/graph/Graph_geometry.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/backward_compatibility_functions.h b/3rdparty/CGAL/include/CGAL/boost/graph/backward_compatibility_functions.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/boost/graph/backward_compatibility_functions.h
rename to 3rdparty/CGAL/include/CGAL/boost/graph/backward_compatibility_functions.h
diff --git a/3rdparty/CGAL/include/CGAL/boost/graph/copy_face_graph.h b/3rdparty/CGAL/include/CGAL/boost/graph/copy_face_graph.h
new file mode 100644
index 0000000..167ef0e
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/boost/graph/copy_face_graph.h
@@ -0,0 +1,161 @@
+// Copyright (c) 2015  GeometryFactory (France).  All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Andreas Fabri
+
+#ifndef CGAL_BOOST_GRAPH_COPY_FACE_GRAPH_H
+#define CGAL_BOOST_GRAPH_COPY_FACE_GRAPH_H
+
+#include <CGAL/config.h>
+#include <CGAL/iterator.h>
+#include <CGAL/Kernel_traits.h>
+#include <CGAL/Cartesian_converter.h>
+
+#include <CGAL/boost/graph/Euler_operations.h>
+#include <CGAL/boost/graph/iterator.h>
+#include <CGAL/boost/graph/helpers.h>
+
+#include <boost/unordered_map.hpp>
+
+namespace CGAL {
+
+/*!
+  \ingroup PkgBGLHelperFct
+
+  copies a source model of `FaceListGraph` into a target model of a
+  `FaceListGraph`. `OutputIterators` can be provided to produce a
+  mapping between source and target elements. The target graph is not
+  cleared.
+
+  \tparam SourceMesh a model of `FaceListGraph`. 
+          The descriptor types `boost::graph_traits<SourceMesh>::%vertex_descriptor`
+          and `boost::graph_traits<SourceMesh>::%face_descriptor` must be
+          models of `Hashable`.
+  \tparam TargetMesh a model of `FaceListGraph`
+  \tparam V2V a model of `OutputIterator` accepting `std::pair<sm_vertex_descriptor, tm_vertex_descriptor>`
+  \tparam H2H a model of `OutputIterator` accepting `std::pair<sm_halfedge_descriptor, tm_halfedge_descriptor>`
+  \tparam F2F a model of `OutputIterator` accepting `std::pair<sm_face_descriptor, tm_face_descriptor>`
+
+  where the prefix `sm_` and `tm_` mean belonging to the source and
+  target mesh respectively.
+
+  The types `sm_vertex_descriptor` and `sm_face_descriptor` must be models of the concept `Hashable`.
+
+  \param sm the source mesh
+  \param tm the target mesh
+  \param v2v pairs of `vertex_descriptors` from `sm` and corresponding `vertex_descriptors` in `tm` are added to `v2v`
+  \param h2h pairs of `halfedge_descriptors` from `sm` and corresponding `halfedge_descriptors` in `tm` are added to `h2h`
+  \param f2f pairs of `face_descriptors` from `sm` and corresponding `face_descriptors` in `tm` are added to `f2f`
+
+  This function assumes that both graphs have an internal property
+  `vertex_point`. Values of that property are converted using
+  `CGAL::Cartesian_converter<SourceKernel,
+  TargetKernel>`. `SourceKernel` and `TargetKernel` are deduced using
+  `CGAL::Kernel_traits`.
+
+  Other properties are not copied.
+*/
+#if defined(CGAL_CXX11) || defined(DOXYGEN_RUNNING) // Use template default arguments
+template <typename SourceMesh, typename TargetMesh,
+          typename V2V = Emptyset_iterator,
+          typename H2H = Emptyset_iterator,
+          typename F2F = Emptyset_iterator>
+void copy_face_graph(const SourceMesh& sm, TargetMesh& tm,
+                     V2V v2v = V2V(), H2H h2h = H2H(), F2F f2f = F2F())
+#else // use the overloads
+template <typename SourceMesh, typename TargetMesh,
+          typename V2V, typename H2H, typename F2F>
+void copy_face_graph(const SourceMesh& sm, TargetMesh& tm,
+                     V2V v2v, H2H h2h, F2F f2f)
+#endif
+{
+  typedef typename boost::graph_traits<SourceMesh>::vertex_descriptor sm_vertex_descriptor;
+  typedef typename boost::graph_traits<TargetMesh>::vertex_descriptor tm_vertex_descriptor;
+
+  typedef typename boost::graph_traits<SourceMesh>::face_descriptor sm_face_descriptor;
+  typedef typename boost::graph_traits<TargetMesh>::face_descriptor tm_face_descriptor;
+
+  typedef typename boost::graph_traits<SourceMesh>::halfedge_descriptor sm_halfedge_descriptor;
+  typedef typename boost::graph_traits<TargetMesh>::halfedge_descriptor tm_halfedge_descriptor;
+
+  typedef typename boost::property_map<SourceMesh, vertex_point_t>::const_type sm_PMap;
+  typedef typename boost::property_map<TargetMesh, vertex_point_t>::type tm_PMap;
+
+  Cartesian_converter<typename Kernel_traits<typename boost::property_traits<sm_PMap>::value_type>::type, 
+                      typename Kernel_traits<typename boost::property_traits<tm_PMap>::value_type>::type > 
+    conv;
+
+  sm_PMap sm_pmap = get(vertex_point, sm);
+  tm_PMap tm_pmap = get(vertex_point, tm);
+
+  // internal f2f and v2v
+  boost::unordered_map<sm_vertex_descriptor, tm_vertex_descriptor> v2v_;
+  boost::unordered_map<sm_face_descriptor, tm_face_descriptor> f2f_;
+
+  BOOST_FOREACH(sm_vertex_descriptor svd, vertices(sm)){
+    tm_vertex_descriptor tvd = add_vertex(tm);
+    v2v_[svd] = tvd;
+    *v2v++ = std::make_pair(svd, tvd);
+    put(tm_pmap, tvd, conv(get(sm_pmap, svd)));
+  }
+
+  BOOST_FOREACH(sm_face_descriptor sfd, faces(sm)){
+    std::vector<tm_vertex_descriptor> tv;
+    BOOST_FOREACH(sm_vertex_descriptor svd, vertices_around_face(halfedge(sfd,sm),sm)){
+      tv.push_back(v2v_.at(svd));
+    }
+    tm_face_descriptor new_face = Euler::add_face(tv,tm);
+    f2f_[sfd] = new_face;
+    *f2f++ = std::make_pair(sfd, new_face);
+  }
+  
+  BOOST_FOREACH(sm_face_descriptor sfd, faces(sm)){
+    sm_halfedge_descriptor shd = halfedge(sfd,sm), done(shd);
+    tm_halfedge_descriptor thd = halfedge(f2f_[sfd],tm);
+    tm_vertex_descriptor tvd = v2v_.at(target(shd,sm));
+    while(target(thd,tm) != tvd){
+      thd = next(thd,tm);
+    }
+    do {
+      *h2h++ = std::make_pair(shd, thd);
+      if (face(opposite(shd, sm), sm) == boost::graph_traits<SourceMesh>::null_face()){
+        *h2h++  = std::make_pair(opposite(shd, sm), opposite(thd, tm));
+      }
+      shd = next(shd,sm);
+      thd = next(thd,tm);
+    }while(shd != done);
+  }
+  
+}
+
+#if !defined(CGAL_CXX11)  && !defined(DOXYGEN_RUNNING)
+template <typename SourceMesh, typename TargetMesh>
+void copy_face_graph(const SourceMesh& sm, TargetMesh& tm)
+{ copy_face_graph(sm, tm, Emptyset_iterator(), Emptyset_iterator(), Emptyset_iterator()); }
+
+template <typename SourceMesh, typename TargetMesh, typename V2V>
+void copy_face_graph(const SourceMesh& sm, TargetMesh& tm, V2V v2v)
+{ copy_face_graph(sm, tm, v2v, Emptyset_iterator(), Emptyset_iterator()); }
+
+template <typename SourceMesh, typename TargetMesh, typename V2V, typename H2H>
+void copy_face_graph(const SourceMesh& sm, TargetMesh& tm, V2V v2v, H2H h2h)
+{ copy_face_graph(sm, tm, v2v, h2h, Emptyset_iterator()); }
+#endif
+
+} // namespace CGAL
+
+#endif //  CGAL_BOOST_GRAPH_COPY_FACE_GRAPH_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/dijkstra_shortest_paths.h b/3rdparty/CGAL/include/CGAL/boost/graph/dijkstra_shortest_paths.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/boost/graph/dijkstra_shortest_paths.h
rename to 3rdparty/CGAL/include/CGAL/boost/graph/dijkstra_shortest_paths.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/dijkstra_shortest_paths.hpp b/3rdparty/CGAL/include/CGAL/boost/graph/dijkstra_shortest_paths.hpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/boost/graph/dijkstra_shortest_paths.hpp
rename to 3rdparty/CGAL/include/CGAL/boost/graph/dijkstra_shortest_paths.hpp
diff --git a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/graph_concepts.h b/3rdparty/CGAL/include/CGAL/boost/graph/graph_concepts.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/boost/graph/graph_concepts.h
rename to 3rdparty/CGAL/include/CGAL/boost/graph/graph_concepts.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/graph_traits_Arrangement_2.h b/3rdparty/CGAL/include/CGAL/boost/graph/graph_traits_Arrangement_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/boost/graph/graph_traits_Arrangement_2.h
rename to 3rdparty/CGAL/include/CGAL/boost/graph/graph_traits_Arrangement_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/graph_traits_CombinatorialMap.h b/3rdparty/CGAL/include/CGAL/boost/graph/graph_traits_CombinatorialMap.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/boost/graph/graph_traits_CombinatorialMap.h
rename to 3rdparty/CGAL/include/CGAL/boost/graph/graph_traits_CombinatorialMap.h
diff --git a/3rdparty/CGAL/include/CGAL/boost/graph/graph_traits_Delaunay_triangulation_2.h b/3rdparty/CGAL/include/CGAL/boost/graph/graph_traits_Delaunay_triangulation_2.h
new file mode 100644
index 0000000..8b36e09
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/boost/graph/graph_traits_Delaunay_triangulation_2.h
@@ -0,0 +1,394 @@
+// Copyright (c) 2007  GeometryFactory (France).  All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Andreas Fabri, Fernando Cacciola
+
+#ifndef CGAL_GRAPH_TRAITS_DELAUNAY_TRIANGULATION_2_H
+#define CGAL_GRAPH_TRAITS_DELAUNAY_TRIANGULATION_2_H
+
+// include this to avoid a VC15 warning
+#include <CGAL/boost/graph/named_function_params.h>
+
+#include <boost/config.hpp>
+#include <boost/iterator_adaptors.hpp>
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/properties.hpp>
+#include <CGAL/boost/graph/graph_traits_Triangulation_2.h>
+
+// The functions and classes in this file allows the user to
+// treat a CGAL Delaunay_triangulation_2 object as a boost graph "as is". No
+// wrapper is needed for the Delaunay_triangulation_2 object.
+
+
+
+namespace boost { 
+
+  template <class GT, class TDS>
+  struct graph_traits< CGAL::Delaunay_triangulation_2<GT,TDS> > {
+
+    struct DT2_graph_traversal_category : 
+      public virtual bidirectional_graph_tag,
+      public virtual adjacency_graph_tag,        
+      public virtual edge_list_graph_tag,
+      public virtual vertex_list_graph_tag { };
+
+    typedef CGAL::Delaunay_triangulation_2<GT,TDS> Delaunay_triangulation;
+
+    typedef typename CGAL::Delaunay_triangulation_2<GT,TDS>::Vertex_handle vertex_descriptor;
+    typedef CGAL::detail::Edge<CGAL::Delaunay_triangulation_2<GT,TDS>, typename CGAL::Delaunay_triangulation_2<GT,TDS>::Edge>  edge_descriptor;
+    typedef typename CGAL::Delaunay_triangulation_2<GT,TDS>::All_edges_iterator  edge_iterator;
+
+    typedef CGAL::detail::boost_all_vertices_iterator<Delaunay_triangulation> vertex_iterator;
+    typedef CGAL::Counting_iterator<CGAL::detail::Out_edge_circulator<typename Delaunay_triangulation::Edge_circulator, edge_descriptor>, edge_descriptor > out_edge_iterator;
+    typedef CGAL::Counting_iterator<CGAL::detail::In_edge_circulator<typename Delaunay_triangulation::Edge_circulator, edge_descriptor>, edge_descriptor > in_edge_iterator;
+    typedef CGAL::Counting_iterator<typename Delaunay_triangulation::Vertex_circulator> Incident_vertices_iterator;
+    typedef Incident_vertices_iterator adjacency_iterator;
+
+    typedef undirected_tag directed_category;
+    typedef disallow_parallel_edge_tag edge_parallel_category; 
+    typedef DT2_graph_traversal_category traversal_category;
+    typedef typename Delaunay_triangulation::size_type size_type;
+    typedef size_type vertices_size_type;
+    typedef size_type edges_size_type;
+    typedef size_type degree_size_type;
+  };
+
+
+} // namespace boost
+
+
+namespace CGAL {
+
+  template <class Gt, class Tds>
+  typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::vertex_descriptor
+  source(typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::edge_descriptor e,
+         const CGAL::Delaunay_triangulation_2<Gt,Tds>& g)
+  {
+    return e.first->vertex(g.ccw(e.second));
+  }
+
+  template <class Gt, class Tds>
+  typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::vertex_descriptor
+  target(typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::edge_descriptor e,
+         const CGAL::Delaunay_triangulation_2<Gt,Tds>& g)
+  {
+    return e.first->vertex(g.cw(e.second));
+  }
+
+  template <class Gt, class Tds>
+  inline std::pair<
+    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::vertex_iterator,
+    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::vertex_iterator >  
+  vertices(const CGAL::Delaunay_triangulation_2<Gt,Tds>& g)
+  {
+    typedef typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::vertex_iterator
+      Iter;
+    return std::make_pair( Iter(g.all_vertices_begin()), Iter(g.all_vertices_end()) );
+  }
+
+
+  template <class Gt, class Tds>
+  inline std::pair<
+    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::edge_iterator,
+    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::edge_iterator >  
+  edges(const CGAL::Delaunay_triangulation_2<Gt,Tds>& g)
+  {    
+    return std::make_pair(g.all_edges_begin(), g.all_edges_end());
+  }
+
+  template <class Gt, class Tds>
+  inline std::pair<
+    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::out_edge_iterator,
+    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::out_edge_iterator >  
+  out_edges(
+    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::vertex_descriptor u, 
+    const CGAL::Delaunay_triangulation_2<Gt,Tds>& g)
+  {
+    typename CGAL::Delaunay_triangulation_2<Gt,Tds>::Edge_circulator ec(u,u->face());
+    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::degree_size_type out_deg = out_degree(u,g);
+    typedef typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >
+      ::out_edge_iterator Iter;
+    
+    return std::make_pair( Iter(ec), Iter(ec,out_deg) );
+  }
+
+  template <class Gt, class Tds>
+  inline std::pair<
+    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::in_edge_iterator,
+    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::in_edge_iterator >  
+  in_edges(
+    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::vertex_descriptor u, 
+    const CGAL::Delaunay_triangulation_2<Gt,Tds>& g)
+  {
+    typename CGAL::Delaunay_triangulation_2<Gt,Tds>::Edge_circulator ec(u,u->face());
+    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::degree_size_type out_deg = out_degree(u,g);
+    typedef typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >
+      ::in_edge_iterator Iter;
+    return std::make_pair( Iter(ec), Iter(ec,out_deg) );
+  }
+
+  template <class Gt, class Tds>
+  inline std::pair<
+    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::adjacency_iterator,
+    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::adjacency_iterator >  
+  adjacent_vertices(
+    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::vertex_descriptor u, 
+    const CGAL::Delaunay_triangulation_2<Gt,Tds>& g)
+  {
+    typename CGAL::Delaunay_triangulation_2<Gt,Tds>::Vertex_circulator vc = out_edge_iterator(u,u.face());
+    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::degree_size_type out_deg = out_degree(u,g);
+    typedef typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >
+      ::adjacency_iterator Iter;
+    return std::make_pair( Iter(vc), Iter(vc,out_deg) );
+  }
+
+  template <class Gt, class Tds>
+  typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::vertices_size_type
+  num_vertices(const CGAL::Delaunay_triangulation_2<Gt,Tds>& g)
+  {
+    return g.number_of_vertices()+1;
+  }  
+
+  template <class Gt, class Tds>
+  typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::edges_size_type
+  num_edges(const CGAL::Delaunay_triangulation_2<Gt,Tds>& g)
+  {
+    return  g.number_of_vertices() + 1 + g.number_of_faces() + degree(g.infinite_vertex(), g) - 2;
+  }  
+
+  template <class Gt, class Tds>
+  typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::degree_size_type
+  out_degree(
+    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::vertex_descriptor u, 
+    const CGAL::Delaunay_triangulation_2<Gt,Tds>& g)
+  {
+    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::degree_size_type deg = 0;
+    typename CGAL::Delaunay_triangulation_2<Gt,Tds>::Edge_circulator c = g.incident_edges(u), done(c);
+    if ( c != 0) {
+        do {
+            ++deg;
+        } while (++c != done);
+    }
+    return deg;
+  }
+
+  template <class Gt, class Tds>
+  typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::degree_size_type
+  in_degree(
+    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::vertex_descriptor u, 
+    const CGAL::Delaunay_triangulation_2<Gt,Tds>& g)
+  {
+    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::degree_size_type deg = 0;
+    typename CGAL::Delaunay_triangulation_2<Gt,Tds>::Edge_circulator c = g.incident_edges(u), done(c);
+    if ( c != 0) {
+        do {
+            ++deg;
+        } while (++c != done);
+    }
+    return deg;
+  }
+
+  template <class Gt, class Tds>
+  typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::degree_size_type
+  degree(
+    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::vertex_descriptor u, 
+    const CGAL::Delaunay_triangulation_2<Gt,Tds>& g)
+  {
+    typename boost::graph_traits< CGAL::Delaunay_triangulation_2<Gt,Tds> >::degree_size_type deg = 0;
+    typename CGAL::Delaunay_triangulation_2<Gt,Tds>::Edge_circulator c = g.incident_edges(u), done(c);
+    if ( c != 0) {
+        do {
+            ++deg;
+        } while (++c != done);
+    }
+    return deg;
+  }
+
+
+  // property maps
+  template <class Gt, class Tds>
+  class DT2_vertex_id_map
+    : public boost::put_get_helper<int, DT2_vertex_id_map<Gt,Tds> >
+  {
+  public:
+    typedef boost::readable_property_map_tag category;
+    typedef int value_type;
+    typedef int reference;
+    typedef typename CGAL::Delaunay_triangulation_2<Gt,Tds>::Vertex_handle key_type;
+    
+    DT2_vertex_id_map()
+    {}
+    
+    long operator[](key_type vh) const {
+      return vh->id(); 
+    }
+  };
+
+  template <class Gt, class Tds>
+  class DT2_edge_id_map
+    : public boost::put_get_helper<int, DT2_edge_id_map<Gt,Tds> >
+  {
+  public:
+    typedef boost::readable_property_map_tag category;
+    typedef int value_type;
+    typedef int reference;
+    typedef typename CGAL::Delaunay_triangulation_2<Gt,Tds>::Edge key_type;
+    
+    DT2_edge_id_map()
+    {}
+    
+    long operator[](key_type e) const {
+      return (3 * e.first.id()) + e.second; 
+    }
+  };
+
+  template <class Gt, class Tds>
+  class DT2_edge_weight_map
+    : public boost::put_get_helper<typename Gt::FT, DT2_edge_weight_map<Gt, Tds> >
+  {
+  private:
+    const CGAL::Delaunay_triangulation_2<Gt,Tds>& tr;
+  public:
+    typedef boost::readable_property_map_tag category;
+    typedef typename Gt::FT value_type;
+    typedef value_type reference;
+    typedef typename CGAL::Delaunay_triangulation_2<Gt,Tds>::Edge key_type;
+
+    DT2_edge_weight_map(const CGAL::Delaunay_triangulation_2<Gt,Tds>& tr_) 
+      : tr(tr_) 
+    { }
+
+    typename Gt::FT operator[](key_type e) const {
+      return approximate_sqrt(tr.segment(e).squared_length());
+    }
+  };
+
+
+  template <class Gt, class Tds>
+  inline DT2_vertex_id_map<Gt,Tds>
+  get(boost::vertex_index_t, const CGAL::Delaunay_triangulation_2<Gt,Tds>& ) {
+    DT2_vertex_id_map<Gt,Tds> m;
+    return m;
+  }
+
+  template <class Gt, class Tds>
+  inline DT2_edge_id_map<Gt,Tds>
+  get(boost::edge_index_t, const CGAL::Delaunay_triangulation_2<Gt,Tds>& ) {
+    DT2_edge_id_map<Gt,Tds> m;
+    return m;
+  }
+
+  template <class Gt, class Tds>
+  inline DT2_edge_weight_map<Gt,Tds>
+  get(boost::edge_weight_t, const CGAL::Delaunay_triangulation_2<Gt,Tds>& g) {
+    DT2_edge_weight_map<Gt,Tds> m(g);
+    return m;
+  }
+
+  template <class Tag>
+  struct DT2_property_map { };
+
+  template <>
+  struct DT2_property_map<boost::vertex_index_t> {
+    template <class Gt, class Tds>
+    struct bind_ {
+      typedef DT2_vertex_id_map<Gt,Tds> type;
+      typedef DT2_vertex_id_map<Gt,Tds> const_type;
+    };
+  };
+
+
+  template <>
+  struct DT2_property_map<boost::edge_index_t> {
+    template <class Gt, class Tds>
+    struct bind_ {
+      typedef DT2_edge_id_map<Gt,Tds> type;
+      typedef DT2_edge_id_map<Gt,Tds> const_type;
+    };
+  };
+
+
+  template <>
+  struct DT2_property_map<boost::edge_weight_t> {
+    template <class Gt, class Tds>
+    struct bind_ {
+      typedef DT2_edge_weight_map<Gt,Tds> type;
+      typedef DT2_edge_weight_map<Gt,Tds> const_type;
+    };
+  };
+
+} // namespace CGAL
+
+namespace boost {
+
+  // g++ 'enumeral_type' in template unification not implemented workaround
+  template <class Gt, class Tds, class Tag>
+  struct property_map<CGAL::Delaunay_triangulation_2<Gt,Tds>, Tag> {
+    typedef typename 
+    CGAL::DT2_property_map<Tag>::template bind_<Gt,Tds> map_gen;
+    typedef typename map_gen::type type;
+    typedef typename map_gen::const_type const_type;
+  };
+
+  // see struct property_map in Polyehdron for an explanation
+  template <class Gt, class Tds, class Tag>
+  struct property_map<const CGAL::Delaunay_triangulation_2<Gt,Tds>, Tag> {
+    typedef typename 
+    CGAL::DT2_property_map<Tag>::template bind_<Gt,Tds> map_gen;
+    typedef typename map_gen::type type;
+    typedef typename map_gen::const_type const_type;
+  };
+
+} // namespace boost
+
+namespace CGAL {
+  template <class Gt, class Tds, class PropertyTag, class Key>
+  inline
+  typename boost::property_traits<
+    typename boost::property_map<CGAL::Delaunay_triangulation_2<Gt,Tds>,PropertyTag>::const_type>::value_type
+  get(PropertyTag p, const CGAL::Delaunay_triangulation_2<Gt,Tds>& g, const Key& key) {
+    return get(get(p, g), key);
+  }
+  
+  template <class Gt, class Tds, class PropertyTag, class Key,class Value>
+  inline void
+  put(PropertyTag p, CGAL::Delaunay_triangulation_2<Gt,Tds>& g, 
+      const Key& key, const Value& value)
+  {
+    typedef typename boost::property_map<CGAL::Delaunay_triangulation_2<Gt,Tds>, PropertyTag>::type Map;
+    Map pmap = get(p, g);
+    put(pmap, key, value);
+  }
+
+} // namespace CGAL
+
+namespace boost {
+
+  // What are those needed for ???
+  template <typename Gt, typename Tds>
+  struct edge_property_type<CGAL::Delaunay_triangulation_2<Gt,Tds> > {
+    typedef void type;
+  };  
+
+  template <typename Gt, typename Tds>
+  struct vertex_property_type<CGAL::Delaunay_triangulation_2<Gt,Tds> > {
+    typedef void type;
+  };
+} // namespace boost
+
+
+#endif // CGAL_GRAPH_TRAITS_DELAUNAY_TRIANGULATION_2_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/graph_traits_Dual_Arrangement_2.h b/3rdparty/CGAL/include/CGAL/boost/graph/graph_traits_Dual_Arrangement_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/boost/graph/graph_traits_Dual_Arrangement_2.h
rename to 3rdparty/CGAL/include/CGAL/boost/graph/graph_traits_Dual_Arrangement_2.h
diff --git a/3rdparty/CGAL/include/CGAL/boost/graph/graph_traits_HalfedgeDS.h b/3rdparty/CGAL/include/CGAL/boost/graph/graph_traits_HalfedgeDS.h
new file mode 100644
index 0000000..b6e7642
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/boost/graph/graph_traits_HalfedgeDS.h
@@ -0,0 +1,260 @@
+// Copyright (c) 2007  GeometryFactory (France).  All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Andreas Fabri, Fernando Cacciola
+
+#ifndef CGAL_BOOST_GRAPH_GRAPH_TRAITS_HALFEDGEDS_H
+#define CGAL_BOOST_GRAPH_GRAPH_TRAITS_HALFEDGEDS_H
+
+#include <functional>
+
+// include this to avoid a VC15 warning
+#include <CGAL/boost/graph/named_function_params.h>
+
+#include <boost/config.hpp>
+#include <boost/iterator/iterator_adaptor.hpp>
+#include <boost/iterator/transform_iterator.hpp>
+#include <boost/type_traits/remove_const.hpp>
+
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/properties.hpp>
+
+#include <CGAL/basic.h>
+#include <CGAL/boost/graph/iterator.h>
+#include <CGAL/Handle_hash_function.h>
+
+#ifndef CGAL_NO_DEPRECATED_CODE
+#include <CGAL/boost/graph/halfedge_graph_traits.h>
+#endif
+
+namespace CGAL {
+
+namespace internal {
+
+template<typename I>
+class Prevent_deref
+  : public boost::iterator_adaptor<
+  Prevent_deref<I>
+  , I // base
+  , I // value
+  >
+{
+public:
+  typedef boost::iterator_adaptor<
+  Prevent_deref<I>
+  , I // base
+  , I // value
+  > Base;
+  //  typedef typename Prevent_deref::iterator_adaptor_::reference reference;
+  typedef typename Base::reference reference;
+  Prevent_deref() : Base() {};
+  Prevent_deref(const I& i) : Base(i) {};
+private:
+  friend class boost::iterator_core_access;
+  reference dereference() const { return const_cast<typename boost::remove_reference<reference>::type&>(this->base_reference()); }
+};
+
+// a HDS_halfedge pretending to be an Edge
+template<typename Halfedge_handle>
+struct HDS_edge {
+  HDS_edge() : halfedge_() { }
+
+  explicit HDS_edge(const Halfedge_handle& h) : halfedge_(h) {}
+
+  bool operator==(const HDS_edge& other) const {
+    // equality is tricky, we are equal when both halfedges are the
+    // same or when the opposite halfedge of this is the same as
+    // halfedge_.other but we need to be careful not to apply this
+    // should this be the invalid halfedge or opposite is going to
+    // blow up
+    if(halfedge_ == other.halfedge_) {
+      return true;
+    } else if(halfedge_ != Halfedge_handle()) { // not default constructed
+      return halfedge_->opposite() == other.halfedge_;
+    } else {
+      // this is the invalid halfedge, it can only be equal to the
+      // invalid halfedge and this is covered by the first case
+      return false;
+    }
+  }
+
+  bool operator!=(const HDS_edge& other) const {
+    return !(*this == other);
+  }
+
+  friend bool operator<(const HDS_edge& a,const HDS_edge& b)
+  {
+    if(a==b) return false;
+    return a.halfedge_ < b.halfedge_;
+  }
+
+  // forward some function to avoid boilerplate and typedefs inside
+  // the free functions
+
+  HDS_edge next() { return HDS_edge(halfedge_->next()); }
+
+  // this is potentially broken as it does not use the decorator to
+  // find prev, but we cannot instantiate the entire decorator
+  // without the full polyhedron type and taking all necessary
+  // template parameters seems overkill
+  HDS_edge prev() { return HDS_edge(halfedge_->prev()); }
+
+  HDS_edge opposite() { return HDS_edge(halfedge_->opposite()); }
+
+  // this is hacky, we don't know the actual type of the id and if we
+  // start adding decltype special cases we have to do it consistently
+  // up to the property map and maybe back down to Polyhedron.
+  std::size_t id() const { return halfedge_->id() / 2; }
+
+  Halfedge_handle halfedge() const { return halfedge_; }
+
+  // save us some work to do function chaining
+  HDS_edge
+  opposite_next() { return HDS_edge(halfedge_->opposite()->next()); }
+
+  HDS_edge
+  next_opposite() { return HDS_edge(halfedge_->next()->opposite()); }
+
+  HDS_edge
+  prev_opposite() { return HDS_edge(halfedge_->prev()->opposite()); }
+
+  HDS_edge
+  opposite_prev() { return HDS_edge(halfedge_->opposite()->prev()); }
+
+  friend  std::size_t hash_value(const HDS_edge&  i)
+  {
+    if (i.halfedge()==Halfedge_handle()) return 0;
+    return hash_value(i.halfedge()<i.halfedge()->opposite()?
+                      i.halfedge():i.halfedge()->opposite());
+  }
+
+private:
+  Halfedge_handle halfedge_;
+};
+
+// make edge_descriptor hashable by default in Unique_hash_map
+namespace handle{
+  template<typename Halfedge_handle>
+  struct Hash_functor< HDS_edge<Halfedge_handle> >
+  {
+    std::size_t
+    operator()(const HDS_edge<Halfedge_handle>& edge)
+    {
+      Halfedge_handle he = edge.halfedge();
+      if (he==Halfedge_handle()) return 0;
+      if ( he < he->opposite() )
+        return Hash_functor<Halfedge_handle>()(he);
+      return Hash_functor<Halfedge_handle>()(he->opposite());
+    }
+  };
+} //end of namespace handle
+
+template<typename Halfedge_handle>
+struct Construct_edge {
+  typedef HDS_edge<Halfedge_handle> result_type;
+  HDS_edge<Halfedge_handle> operator()(const Halfedge_handle& he) const
+  { return HDS_edge<Halfedge_handle>(he); }
+};
+
+template<typename Halfedge_handle>
+struct Construct_edge_opposite {
+  typedef HDS_edge<Halfedge_handle> result_type;
+  HDS_edge<Halfedge_handle> operator()(const Halfedge_handle& he) const
+  { return HDS_edge<Halfedge_handle>(he->opposite()); }
+};
+
+} // internal
+
+template <class HDS>
+struct HDS_graph_traits
+{
+private:
+  struct HDS_graph_traversal_category : public virtual boost::bidirectional_graph_tag,
+                                        public virtual boost::vertex_list_graph_tag,
+                                        public virtual boost::edge_list_graph_tag
+  {};
+
+public:
+  typedef typename HDS::Vertex_handle                                vertex_descriptor;
+  typedef typename internal::HDS_edge<typename HDS::Halfedge_handle> edge_descriptor;
+  typedef typename HDS::Face_handle                                  face_descriptor;
+  typedef typename HDS::Halfedge_handle                              halfedge_descriptor;
+
+  typedef internal::Prevent_deref<typename HDS::Vertex_iterator>     vertex_iterator;
+  typedef internal::Prevent_deref<typename HDS::Face_iterator>       face_iterator;
+  typedef internal::Prevent_deref<typename HDS::Edge_iterator>       edge_iterator_i;
+  typedef internal::Prevent_deref<typename HDS::Halfedge_iterator>   halfedge_iterator;
+
+
+
+  typedef boost::transform_iterator<
+    internal::Construct_edge<typename HDS::Halfedge_handle>,
+    edge_iterator_i,
+    edge_descriptor> edge_iterator;
+
+  typedef Out_edge_iterator<HDS> out_edge_iterator;
+
+  typedef In_edge_iterator<HDS> in_edge_iterator;
+
+  typedef boost::undirected_tag             directed_category;
+  typedef boost::disallow_parallel_edge_tag edge_parallel_category;
+  typedef HDS_graph_traversal_category      traversal_category;
+
+  typedef typename HDS::size_type vertices_size_type;
+  typedef vertices_size_type      edges_size_type;
+  typedef vertices_size_type      halfedges_size_type;
+  typedef vertices_size_type      degree_size_type;
+  typedef vertices_size_type      faces_size_type;
+
+  static vertex_descriptor null_vertex() { return vertex_descriptor(); }
+  static halfedge_descriptor null_halfedge() { return halfedge_descriptor(); }
+  static face_descriptor null_face() { return face_descriptor(); }
+};
+
+
+} //namespace CGAL
+
+
+namespace std {
+
+#if defined(BOOST_MSVC)
+#  pragma warning(push)
+#  pragma warning(disable:4099) // For VC10 it is class hash 
+#endif
+
+#ifndef CGAL_CFG_NO_STD_HASH
+
+  template <typename H>
+  struct hash<CGAL::internal::HDS_edge<H> > {
+    std::size_t operator()(const CGAL::internal::HDS_edge<H>& e) const
+    {
+      std::hash<H> fct;
+      if (e.halfedge()==H()) return 0;
+      return fct(e.halfedge()<e.halfedge()->opposite()?
+                 e.halfedge():e.halfedge()->opposite());
+    }
+  };
+
+#endif // CGAL_CFG_NO_STD_HASH
+
+#if defined(BOOST_MSVC)
+#  pragma warning(pop)
+#endif
+
+} // namespace std
+
+#endif // CGAL_BOOST_GRAPH_GRAPH_TRAITS_HALFEDGEDS_H
diff --git a/3rdparty/CGAL/include/CGAL/boost/graph/graph_traits_PolyMesh_ArrayKernelT.h b/3rdparty/CGAL/include/CGAL/boost/graph/graph_traits_PolyMesh_ArrayKernelT.h
new file mode 100644
index 0000000..c8036b0
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/boost/graph/graph_traits_PolyMesh_ArrayKernelT.h
@@ -0,0 +1,697 @@
+// Copyright (c) 2007  GeometryFactory (France).  All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Andreas Fabri, Philipp Moeller
+
+#ifndef CGAL_BOOST_GRAPH_GRAPH_TRAITS_POLYMESH_ARRAYKERNELT_H
+#define CGAL_BOOST_GRAPH_GRAPH_TRAITS_POLYMESH_ARRAYKERNELT_H
+
+// include this to avoid a VC15 warning
+#include <CGAL/boost/graph/named_function_params.h>
+
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/properties.hpp>
+
+#include <boost/iterator/transform_iterator.hpp>
+
+#include <CGAL/boost/graph/properties_PolyMesh_ArrayKernelT.h>
+#include <CGAL/boost/graph/internal/OM_iterator_from_circulator.h>
+#include <CGAL/boost/graph/iterator.h>
+#include <CGAL/Iterator_range.h>
+#include <CGAL/boost/graph/helpers.h>
+#include <CGAL/assertions.h>
+
+#include <OpenMesh/Core/Mesh/PolyMesh_ArrayKernelT.hh>
+
+#include <CGAL/hash_openmesh.h>
+
+// http://openmesh.org/Documentation/OpenMesh-Doc-Latest/classOpenMesh_1_1Concepts_1_1KernelT.html
+
+#if defined(BOOST_MSVC)
+#  pragma warning(push)
+#  pragma warning(disable:4267)
+#endif
+namespace CGAL { namespace internal {
+
+
+template<typename Halfedge_handle>
+class OMesh_edge {
+public:
+  OMesh_edge() : halfedge_() {}
+  explicit OMesh_edge(const Halfedge_handle& h) : halfedge_(h) {}
+  Halfedge_handle halfedge() const { return halfedge_; }
+  bool is_valid() const { return halfedge_.is_valid(); }
+
+  bool
+  operator==(const OMesh_edge& other) {
+    if(halfedge_ == other.halfedge_) {
+      return true;
+    } else if(halfedge_ != Halfedge_handle()) {
+      return opposite() == other.halfedge_;
+    } else {
+      return false;
+    }
+  }
+
+  bool operator<(const OMesh_edge& other) const
+  { 
+    return this->idx() < other.idx();
+  }
+
+  bool
+  operator!=(const OMesh_edge& other) { return !(*this == other); }
+
+  Halfedge_handle
+  opposite() const { return Halfedge_handle((halfedge_.idx() & 1) ? halfedge_.idx()-1 : halfedge_.idx()+1); }
+
+  OMesh_edge
+  opposite_edge() const { return OMesh_edge(Halfedge_handle((halfedge_.idx() & 1) ? halfedge_.idx()-1 : halfedge_.idx()+1)); }
+
+  unsigned int idx() const { return halfedge_.idx() / 2; }
+private:
+  Halfedge_handle halfedge_;
+};
+
+template <typename Halfedge_handle, typename OMeshEdge>
+struct Convert_omesh_edge
+{
+  typedef OMesh_edge<Halfedge_handle> result_type;
+  result_type operator()(const OMeshEdge& h) const { 
+    return result_type(Halfedge_handle(h.idx() * 2)); 
+  }
+};
+
+template <typename Halfedge_handle>
+struct Construct_omesh_edge
+{
+  typedef OMesh_edge<Halfedge_handle> result_type;
+  template <typename T>
+  result_type operator()(const T& h) const { return result_type(h); }
+};
+
+template <typename Halfedge_handle>
+struct Construct_omesh_edge_opposite
+{
+  typedef OMesh_edge<Halfedge_handle> result_type;
+  template <typename T>
+  result_type operator()(const T& h) const { return result_type(h).opposite_edge(); }
+};
+
+
+} // internal
+} // CGAL
+
+
+namespace boost {
+
+template <class K>
+struct graph_traits< OpenMesh::PolyMesh_ArrayKernelT<K> >
+{
+private:
+  typedef OpenMesh::PolyMesh_ArrayKernelT<K> SM;
+
+  struct SM_graph_traversal_category : public virtual boost::bidirectional_graph_tag,
+                                       public virtual boost::vertex_list_graph_tag,
+                                       public virtual boost::edge_list_graph_tag
+  {};
+
+public:
+  // Graph
+  typedef typename SM::VertexHandle                                        vertex_descriptor;
+  typedef typename SM::Point                                               vertex_property_type;
+  typedef typename CGAL::internal::OMesh_edge<typename SM::HalfedgeHandle> edge_descriptor;
+  typedef boost::undirected_tag                                            directed_category;
+  typedef boost::disallow_parallel_edge_tag                                edge_parallel_category; 
+  typedef SM_graph_traversal_category                                      traversal_category;
+
+  // HalfedgeGraph
+  typedef typename SM::HalfedgeHandle              halfedge_descriptor;
+
+   // FaceGraph
+  typedef typename SM::FaceHandle   face_descriptor;
+  
+  // VertexListGraph
+  typedef typename SM::VertexIter   vertex_iterator;
+  typedef unsigned int              vertices_size_type;
+  // EdgeListGraph
+  typedef boost::transform_iterator<
+    CGAL::internal::Convert_omesh_edge<typename SM::HalfedgeHandle, typename SM::EdgeHandle>,
+    typename SM::EdgeIter,
+    edge_descriptor>                edge_iterator;
+
+  typedef unsigned int              edges_size_type;
+  // HalfEdgeListGraph
+  typedef typename SM::HalfedgeIter halfedge_iterator;
+  typedef unsigned int              halfedges_size_type;
+  // FaceListGraph
+  typedef typename SM::FaceIter     face_iterator;
+  typedef unsigned int              faces_size_type;
+
+  // IncidenceGraph
+  typedef unsigned int              degree_size_type;
+
+  
+  typedef CGAL::In_edge_iterator<SM> in_edge_iterator;
+
+  typedef CGAL::Out_edge_iterator<SM> out_edge_iterator;
+
+  // nulls
+  static vertex_descriptor   null_vertex() { return vertex_descriptor(); }
+  static face_descriptor     null_face()   { return face_descriptor(); }
+  static halfedge_descriptor     null_halfedge()   { return halfedge_descriptor(); }
+};
+
+template<typename K>
+struct graph_traits< const OpenMesh::PolyMesh_ArrayKernelT<K> >  
+  : public graph_traits< OpenMesh::PolyMesh_ArrayKernelT<K> >
+{ };
+
+} // namespace boost
+
+namespace OpenMesh {
+
+template <typename K>
+typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertices_size_type
+num_vertices(const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
+{
+  return sm.n_vertices();
+}
+  
+
+template <typename K>
+typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::edges_size_type
+num_edges(const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
+{
+  return sm.n_edges();
+}
+  
+
+template <typename K>
+typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::degree_size_type
+degree(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor v,
+       const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
+{
+  return sm.valence(v);
+}
+
+         
+template <typename K>
+typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::degree_size_type
+out_degree(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor v,
+           const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
+{
+  return sm.valence(v);
+}
+             
+  
+template <typename K>
+typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::degree_size_type
+in_degree(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor v,
+          const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
+{
+  return sm.valence(v);
+}
+            
+  
+template <typename K>
+typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor
+source(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::edge_descriptor e,
+       const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
+{
+  return sm.from_vertex_handle(e.halfedge());
+}
+
+template <typename K>
+typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor
+source(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor h,
+       const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
+{
+  return sm.from_vertex_handle(h);
+}
+         
+
+template <typename K>
+typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor
+target(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::edge_descriptor e,
+       const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
+{
+  return sm.to_vertex_handle(e.halfedge());
+}
+
+template <typename K>
+typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor
+target(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor h,
+       const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
+{
+  return sm.to_vertex_handle(h);
+}
+    
+template <typename K>
+CGAL::Iterator_range<typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_iterator>
+vertices(const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
+{
+  return CGAL::make_range(sm.vertices_sbegin(), sm.vertices_end()); 
+}
+
+ 
+template <typename K>
+CGAL::Iterator_range<typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::edge_iterator>
+edges(const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
+{
+  typedef typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::edge_iterator iterator;
+  iterator beg(sm.edges_sbegin());
+  iterator end(sm.edges_end());
+  return CGAL::make_range(beg,end); 
+}
+
+  
+template <typename K>
+CGAL::Iterator_range<typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::in_edge_iterator>
+in_edges(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor v,
+         const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
+{
+  typedef typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::in_edge_iterator Iter;
+
+  return CGAL::make_range(Iter(halfedge(v,sm),sm), Iter(halfedge(v,sm),sm,1));
+}
+
+
+template <typename K>
+CGAL::Iterator_range<typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::out_edge_iterator>
+out_edges(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor v,
+          const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
+{
+  typedef typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::out_edge_iterator Iter;
+  return CGAL::make_range(Iter(halfedge(v,sm),sm), Iter(halfedge(v,sm),sm,1));
+}
+
+
+template<typename K>
+std::pair<typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::edge_descriptor,
+          bool>
+edge(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor u, 
+     typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor v, 
+     const OpenMesh::PolyMesh_ArrayKernelT<K>& sm) {
+  typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::edge_descriptor 
+    he(sm.find_halfedge(u, v));
+  return std::make_pair(he, he.is_valid());
+}
+
+
+//
+// HalfedgeGraph
+//
+template <typename K>
+typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor
+next(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor h,
+     const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
+{
+  return sm.next_halfedge_handle(h);
+}
+
+template <typename K>
+typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor
+prev(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor h,
+     const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
+{
+  return sm.prev_halfedge_handle(h);
+}
+
+template <typename K>
+typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor
+opposite(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor h,
+         const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
+{
+  return sm.opposite_halfedge_handle(h);
+}
+
+template <typename K>
+typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::edge_descriptor
+edge(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor h,
+     const OpenMesh::PolyMesh_ArrayKernelT<K>& /*sm*/)
+{
+  return typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::edge_descriptor(h);
+}
+
+template <typename K>
+typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor
+halfedge(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::edge_descriptor e,
+         const OpenMesh::PolyMesh_ArrayKernelT<K>&)
+{
+  return e.halfedge();
+}
+
+template <typename K>
+typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor
+halfedge(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor v,
+         const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
+{
+  if(sm.halfedge_handle(v) == boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::null_halfedge()){
+    return boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::null_halfedge();
+  }
+  // prev because OpenMesh stores out-going halfedges
+  // return sm.prev_halfedge_handle(sm.halfedge_handle(v));
+  return sm.opposite_halfedge_handle(sm.halfedge_handle(v));
+}
+
+
+template <typename K>
+std::pair<
+  typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor,
+  bool
+>
+halfedge(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor u,
+         typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor v,
+         const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
+{
+  typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor h = sm.find_halfedge(u, v);
+  return std::make_pair(h, h.is_valid());
+}
+
+
+
+//
+// HalfedgeListGraph
+//
+template <typename K>
+CGAL::Iterator_range<typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_iterator>
+halfedges(const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
+{
+  return CGAL::make_range(sm.halfedges_sbegin(), sm.halfedges_end());
+}
+
+template <typename K>
+typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedges_size_type
+num_halfedges(const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
+{
+  return sm.n_halfedges();
+}
+
+
+
+//
+// MutableHalfedgeGraph
+//
+template<typename K>
+void
+set_next(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor h1, 
+         typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor h2,
+         OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
+{
+  sm.set_next_halfedge_handle(h1, h2);
+}
+
+
+
+template<typename K>
+void
+set_target(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor h,
+           typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor v,
+           OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
+{
+  sm.set_vertex_handle(h, v);
+}
+
+
+template<typename K>
+void
+set_halfedge(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor v,
+             typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor h,
+             OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
+{
+  sm.set_halfedge_handle(v, sm.opposite_halfedge_handle(h));
+}
+
+
+template<typename K>
+void
+adjust_border_halfedge(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor v,
+                       OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
+{
+  sm.adjust_outgoing_halfedge(v);
+}
+
+template<typename K>
+void
+garbage_collection(OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
+{
+  sm.garbage_collection();
+}
+
+template<typename K>
+typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::edge_descriptor
+add_edge(OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
+{
+  return edge(sm.new_edge(boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::null_vertex(),
+                          boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::null_vertex() ), sm);
+}
+
+
+//
+// FaceGraph
+//
+template<typename K>
+typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor
+halfedge(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::face_descriptor f,
+     const OpenMesh::PolyMesh_ArrayKernelT<K>& sm) 
+{
+  return sm.halfedge_handle(f);
+}
+  
+template<typename K>
+typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::face_descriptor
+face(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor h,
+     const OpenMesh::PolyMesh_ArrayKernelT<K>& sm) 
+{
+  return sm.face_handle(h);
+}
+
+
+
+//
+// MutableFaceGraph
+//
+template<typename K>
+void
+set_face(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor h,
+         typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::face_descriptor f,
+         OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
+{
+  sm.set_face_handle(h, f);
+}
+
+  
+template<typename K>
+void
+set_halfedge(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::face_descriptor f,
+             typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor h,
+             OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
+{
+  sm.set_halfedge_handle(f, h);
+}
+
+ 
+//
+// FaceListGraph
+//
+template <typename K>
+typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::faces_size_type
+num_faces(const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
+{
+  return sm.n_faces();
+}
+  
+template <typename K>
+CGAL::Iterator_range<typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::face_iterator>
+faces(const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
+{
+  return CGAL::make_range(sm.faces_sbegin(), sm.faces_end()); 
+}
+ 
+
+template <typename K>
+typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor
+add_vertex(OpenMesh::PolyMesh_ArrayKernelT<K>& sm) {
+  return sm.new_vertex();
+}
+
+  /*
+
+// MutableGraph
+// add a vertex with a default constructed property
+template <typename K>
+typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor
+add_vertex(OpenMesh::PolyMesh_ArrayKernelT<K>& sm) {
+  return sm.add_vertex(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_property_type());
+}
+
+template <typename K>
+typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor
+add_vertex(const typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_property_type& p, OpenMesh::PolyMesh_ArrayKernelT<K>& sm) {
+  return sm.add_vertex(p);
+}
+
+template <typename K>
+void
+clear_vertex(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor, 
+             OpenMesh::PolyMesh_ArrayKernelT<K>&) {
+  CGAL_assert(false);
+}
+
+  */
+
+template <typename K>
+void
+remove_vertex(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor v, 
+              OpenMesh::PolyMesh_ArrayKernelT<K>& sm) {
+
+  sm.request_face_status();
+  sm.request_vertex_status();
+  sm.request_halfedge_status();
+  sm.set_halfedge_handle(v, typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor());
+  sm.status(v).set_deleted(true);
+}
+
+  
+template <typename K>
+void
+remove_edge(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor u, 
+            typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor v, 
+            OpenMesh::PolyMesh_ArrayKernelT<K>& sm) 
+{
+  typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::edge_descriptor e = edge(u, v, sm);
+  remove_edge(e,sm);
+}
+
+template <typename K>
+void
+remove_edge(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::edge_descriptor e, 
+            OpenMesh::PolyMesh_ArrayKernelT<K>& sm) 
+{
+  sm.request_face_status();
+  sm.request_vertex_status();
+  sm.request_halfedge_status();
+  sm.request_edge_status();
+
+  typedef typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor halfedge_descriptor;
+
+  halfedge_descriptor h1 = halfedge(e,sm);
+  halfedge_descriptor h2 = opposite(halfedge(e,sm),sm);
+  sm.status(sm.edge_handle(h1)).set_deleted(true);
+  sm.status(h1).set_deleted(true);
+  sm.status(h2).set_deleted(true);
+
+}
+
+
+template <typename K>
+void
+remove_edge(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::edge_iterator eiter, 
+            OpenMesh::PolyMesh_ArrayKernelT<K>& sm) 
+{
+  remove_edge(*eiter, sm);
+}
+
+template<typename K>
+void
+remove_face(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::face_descriptor f, 
+            OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
+{
+
+  sm.request_face_status();
+  sm.request_vertex_status();
+  sm.request_halfedge_status();
+  
+  set_halfedge(f, typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_descriptor(), sm);
+  sm.status(f).set_deleted(true);
+}
+
+#if 0 // conflits with function in Euler_operations.h
+template<typename K>
+std::pair<typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::edge_descriptor,
+          bool>
+add_edge(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor v1, 
+         typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor v2, 
+         OpenMesh::PolyMesh_ArrayKernelT<K>& sm) {
+  
+  return sm.new_edge(v1, v2);
+}
+#endif
+
+template<typename K>
+typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::face_descriptor
+add_face(OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
+{
+  return sm.new_face();
+}
+
+template<typename K, typename InputIterator>
+typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::face_descriptor
+add_face(InputIterator begin, InputIterator end, OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
+{
+  std::vector<typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex_descriptor> 
+    v(begin, end);
+  return sm.add_face(v);
+}
+
+template<typename K>
+bool is_valid(OpenMesh::PolyMesh_ArrayKernelT<K>& sm, bool /* verbose */ = false)
+{
+  return CGAL::is_valid_polygon_mesh(sm);
+}
+
+} // namespace OpenMesh
+
+namespace CGAL {
+
+// Overload CGAL::clear function. PolyMesh_ArrayKernel behaves
+// differently from other meshes. Calling clear does not affect the
+// number of vertices, edges, or faces in the mesh. To get actual
+// numbers it is necessary to first collect garbage. We add an
+// overlaod to get consistent behavior.
+template<typename K>
+void clear(OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
+{
+  sm.clear();
+  sm.garbage_collection(true, true, true);
+  CGAL_postcondition(num_edges(sm) == 0);
+  CGAL_postcondition(num_vertices(sm) == 0);
+  CGAL_postcondition(num_faces(sm) == 0);
+}
+
+}
+#ifndef CGAL_NO_DEPRECATED_CODE
+#include <CGAL/boost/graph/backward_compatibility_functions.h>
+
+namespace boost {
+  // The following functions were defined in the namespace boost
+  using OpenMesh::vertices;
+  using OpenMesh::edges;
+  using OpenMesh::num_vertices;
+  using OpenMesh::num_edges;
+  using OpenMesh::out_edges;
+  using OpenMesh::in_edges;
+  using OpenMesh::target;
+  using OpenMesh::source;
+} // namespace boost
+#endif //CGAL_NO_DEPRECATED_CODE
+
+#if defined(BOOST_MSVC)
+#  pragma warning(pop)
+#endif
+
+#endif // CGAL_BOOST_GRAPH_TRAITS_POLYMESH_ARRAYKERNELT_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/graph_traits_Polyhedron_3.h b/3rdparty/CGAL/include/CGAL/boost/graph/graph_traits_Polyhedron_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/boost/graph/graph_traits_Polyhedron_3.h
rename to 3rdparty/CGAL/include/CGAL/boost/graph/graph_traits_Polyhedron_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/graph_traits_Surface_mesh.h b/3rdparty/CGAL/include/CGAL/boost/graph/graph_traits_Surface_mesh.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/boost/graph/graph_traits_Surface_mesh.h
rename to 3rdparty/CGAL/include/CGAL/boost/graph/graph_traits_Surface_mesh.h
diff --git a/3rdparty/CGAL/include/CGAL/boost/graph/graph_traits_TriMesh_ArrayKernelT.h b/3rdparty/CGAL/include/CGAL/boost/graph/graph_traits_TriMesh_ArrayKernelT.h
new file mode 100644
index 0000000..86b874b
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/boost/graph/graph_traits_TriMesh_ArrayKernelT.h
@@ -0,0 +1,616 @@
+// Copyright (c) 2007  GeometryFactory (France).  All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Andreas Fabri, Philipp Moeller
+
+#ifndef CGAL_BOOST_GRAPH_GRAPH_TRAITS_TRIMESH_ARRAYKERNELT_H
+#define CGAL_BOOST_GRAPH_GRAPH_TRAITS_TRIMESH_ARRAYKERNELT_H
+
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/properties.hpp>
+
+#include <boost/iterator/transform_iterator.hpp>
+
+#include <CGAL/boost/graph/properties_TriMesh_ArrayKernelT.h>
+#include <CGAL/boost/graph/graph_traits_PolyMesh_ArrayKernelT.h>
+#include <CGAL/boost/graph/internal/OM_iterator_from_circulator.h>
+#include <CGAL/boost/graph/iterator.h>
+#include <CGAL/Iterator_range.h>
+#include <CGAL/boost/graph/helpers.h>
+#include <CGAL/assertions.h>
+
+#include <OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh>
+
+#include <CGAL/hash_openmesh.h>
+
+// http://openmesh.org/Documentation/OpenMesh-Doc-Latest/classOpenMesh_1_1Concepts_1_1KernelT.html
+
+#if defined(BOOST_MSVC)
+#  pragma warning(push)
+#  pragma warning(disable:4267)
+#endif
+
+namespace boost {
+
+template <class K>
+struct graph_traits< OpenMesh::TriMesh_ArrayKernelT<K> >
+{
+private:
+  typedef OpenMesh::TriMesh_ArrayKernelT<K> SM;
+
+  struct SM_graph_traversal_category : public virtual boost::bidirectional_graph_tag,
+                                       public virtual boost::vertex_list_graph_tag,
+                                       public virtual boost::edge_list_graph_tag
+  {};
+
+public:
+  // Graph
+  typedef typename SM::VertexHandle                                        vertex_descriptor;
+  typedef typename SM::Point                                               vertex_property_type;
+  typedef typename CGAL::internal::OMesh_edge<typename SM::HalfedgeHandle> edge_descriptor;
+  typedef boost::undirected_tag                                            directed_category;
+  typedef boost::disallow_parallel_edge_tag                                edge_parallel_category; 
+  typedef SM_graph_traversal_category                                      traversal_category;
+
+  // HalfedgeGraph
+  typedef typename SM::HalfedgeHandle              halfedge_descriptor;
+
+   // FaceGraph
+  typedef typename SM::FaceHandle   face_descriptor;
+  
+  // VertexListGraph
+  typedef typename SM::VertexIter   vertex_iterator;
+  typedef unsigned int              vertices_size_type;
+  // EdgeListGraph
+  typedef boost::transform_iterator<
+    CGAL::internal::Convert_omesh_edge<typename SM::HalfedgeHandle, typename SM::EdgeHandle>,
+    typename SM::EdgeIter,
+    edge_descriptor>                edge_iterator;
+
+  typedef unsigned int              edges_size_type;
+  // HalfEdgeListGraph
+  typedef typename SM::HalfedgeIter halfedge_iterator;
+  typedef unsigned int              halfedges_size_type;
+  // FaceListGraph
+  typedef typename SM::FaceIter     face_iterator;
+  typedef unsigned int              faces_size_type;
+
+  // IncidenceGraph
+  typedef unsigned int              degree_size_type;
+
+  
+  typedef CGAL::In_edge_iterator<SM> in_edge_iterator;
+
+  typedef CGAL::Out_edge_iterator<SM> out_edge_iterator;
+
+  // nulls
+  static vertex_descriptor   null_vertex() { return vertex_descriptor(); }
+  static face_descriptor     null_face()   { return face_descriptor(); }
+  static halfedge_descriptor     null_halfedge()   { return halfedge_descriptor(); }
+};
+
+template<typename K>
+struct graph_traits< const OpenMesh::TriMesh_ArrayKernelT<K> >  
+  : public graph_traits< OpenMesh::TriMesh_ArrayKernelT<K> >
+{ };
+
+} // namespace boost
+
+namespace OpenMesh {
+
+template <typename K>
+typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertices_size_type
+num_vertices(const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
+{
+  return sm.n_vertices();
+}
+  
+
+template <typename K>
+typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::edges_size_type
+num_edges(const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
+{
+  return sm.n_edges();
+}
+  
+
+template <typename K>
+typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::degree_size_type
+degree(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor v,
+       const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
+{
+  return sm.valence(v);
+}
+
+         
+template <typename K>
+typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::degree_size_type
+out_degree(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor v,
+           const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
+{
+  return sm.valence(v);
+}
+             
+  
+template <typename K>
+typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::degree_size_type
+in_degree(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor v,
+          const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
+{
+  return sm.valence(v);
+}
+            
+  
+template <typename K>
+typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor
+source(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::edge_descriptor e,
+       const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
+{
+  return sm.from_vertex_handle(e.halfedge());
+}
+
+template <typename K>
+typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor
+source(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor h,
+       const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
+{
+  return sm.from_vertex_handle(h);
+}
+         
+
+template <typename K>
+typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor
+target(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::edge_descriptor e,
+       const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
+{
+  return sm.to_vertex_handle(e.halfedge());
+}
+
+template <typename K>
+typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor
+target(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor h,
+       const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
+{
+  return sm.to_vertex_handle(h);
+}
+    
+template <typename K>
+CGAL::Iterator_range<typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_iterator>
+vertices(const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
+{
+  return CGAL::make_range(sm.vertices_sbegin(), sm.vertices_end()); 
+}
+
+ 
+template <typename K>
+CGAL::Iterator_range<typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::edge_iterator>
+edges(const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
+{
+  typedef typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::edge_iterator iterator;
+  iterator beg(sm.edges_sbegin());
+  iterator end(sm.edges_end());
+  return CGAL::make_range(beg,end); 
+}
+
+  
+template <typename K>
+CGAL::Iterator_range<typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::in_edge_iterator>
+in_edges(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor v,
+         const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
+{
+  typedef typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::in_edge_iterator Iter;
+
+  return CGAL::make_range(Iter(halfedge(v,sm),sm), Iter(halfedge(v,sm),sm,1));
+}
+
+
+template <typename K>
+CGAL::Iterator_range<typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::out_edge_iterator>
+out_edges(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor v,
+          const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
+{
+  typedef typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::out_edge_iterator Iter;
+  return CGAL::make_range(Iter(halfedge(v,sm),sm), Iter(halfedge(v,sm),sm,1));
+}
+
+
+template<typename K>
+std::pair<typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::edge_descriptor,
+          bool>
+edge(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor u, 
+     typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor v, 
+     const OpenMesh::TriMesh_ArrayKernelT<K>& sm) {
+  typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::edge_descriptor 
+    he(sm.find_halfedge(u, v));
+  return std::make_pair(he, he.is_valid());
+}
+
+
+//
+// HalfedgeGraph
+//
+template <typename K>
+typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor
+next(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor h,
+     const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
+{
+  return sm.next_halfedge_handle(h);
+}
+
+template <typename K>
+typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor
+prev(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor h,
+     const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
+{
+  return sm.prev_halfedge_handle(h);
+}
+
+template <typename K>
+typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor
+opposite(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor h,
+         const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
+{
+  return sm.opposite_halfedge_handle(h);
+}
+
+template <typename K>
+typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::edge_descriptor
+edge(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor h,
+     const OpenMesh::TriMesh_ArrayKernelT<K>& /*sm*/)
+{
+  return typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::edge_descriptor(h);
+}
+
+template <typename K>
+typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor
+halfedge(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::edge_descriptor e,
+         const OpenMesh::TriMesh_ArrayKernelT<K>&)
+{
+  return e.halfedge();
+}
+
+template <typename K>
+typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor
+halfedge(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor v,
+         const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
+{
+  if(sm.halfedge_handle(v) == boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::null_halfedge()){
+    return boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::null_halfedge();
+  }
+  // prev because OpenMesh stores out-going halfedges
+  // return sm.prev_halfedge_handle(sm.halfedge_handle(v));
+  return sm.opposite_halfedge_handle(sm.halfedge_handle(v));
+}
+
+
+template <typename K>
+std::pair<
+  typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor,
+  bool
+>
+halfedge(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor u,
+         typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor v,
+         const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
+{
+  typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor h = sm.find_halfedge(u, v);
+  return std::make_pair(h, h.is_valid());
+}
+
+
+
+//
+// HalfedgeListGraph
+//
+template <typename K>
+CGAL::Iterator_range<typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_iterator>
+halfedges(const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
+{
+  return CGAL::make_range(sm.halfedges_sbegin(), sm.halfedges_end());
+}
+
+template <typename K>
+typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedges_size_type
+num_halfedges(const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
+{
+  return sm.n_halfedges();
+}
+
+
+
+//
+// MutableHalfedgeGraph
+//
+template<typename K>
+void
+set_next(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor h1, 
+         typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor h2,
+         OpenMesh::TriMesh_ArrayKernelT<K>& sm)
+{
+  sm.set_next_halfedge_handle(h1, h2);
+}
+
+
+
+template<typename K>
+void
+set_target(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor h,
+           typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor v,
+           OpenMesh::TriMesh_ArrayKernelT<K>& sm)
+{
+  sm.set_vertex_handle(h, v);
+}
+
+
+template<typename K>
+void
+set_halfedge(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor v,
+             typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor h,
+             OpenMesh::TriMesh_ArrayKernelT<K>& sm)
+{
+  sm.set_halfedge_handle(v, sm.opposite_halfedge_handle(h));
+}
+
+
+template<typename K>
+void
+adjust_border_halfedge(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor v,
+                       OpenMesh::TriMesh_ArrayKernelT<K>& sm)
+{
+  sm.adjust_outgoing_halfedge(v);
+}
+
+template<typename K>
+void
+garbage_collection(OpenMesh::TriMesh_ArrayKernelT<K>& sm)
+{
+  sm.garbage_collection();
+}
+
+template<typename K>
+typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::edge_descriptor
+add_edge(OpenMesh::TriMesh_ArrayKernelT<K>& sm)
+{
+  return edge(sm.new_edge(boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::null_vertex(),
+                          boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::null_vertex() ), sm);
+}
+
+
+//
+// FaceGraph
+//
+template<typename K>
+typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor
+halfedge(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::face_descriptor f,
+     const OpenMesh::TriMesh_ArrayKernelT<K>& sm) 
+{
+  return sm.halfedge_handle(f);
+}
+  
+template<typename K>
+typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::face_descriptor
+face(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor h,
+     const OpenMesh::TriMesh_ArrayKernelT<K>& sm) 
+{
+  return sm.face_handle(h);
+}
+
+
+
+//
+// MutableFaceGraph
+//
+template<typename K>
+void
+set_face(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor h,
+         typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::face_descriptor f,
+         OpenMesh::TriMesh_ArrayKernelT<K>& sm)
+{
+  sm.set_face_handle(h, f);
+}
+
+  
+template<typename K>
+void
+set_halfedge(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::face_descriptor f,
+             typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor h,
+             OpenMesh::TriMesh_ArrayKernelT<K>& sm)
+{
+  sm.set_halfedge_handle(f, h);
+}
+
+ 
+//
+// FaceListGraph
+//
+template <typename K>
+typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::faces_size_type
+num_faces(const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
+{
+  return sm.n_faces();
+}
+  
+template <typename K>
+CGAL::Iterator_range<typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::face_iterator>
+faces(const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
+{
+  return CGAL::make_range(sm.faces_sbegin(), sm.faces_end()); 
+}
+ 
+
+template <typename K>
+typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor
+add_vertex(OpenMesh::TriMesh_ArrayKernelT<K>& sm) {
+  return sm.new_vertex();
+}
+
+  /*
+
+// MutableGraph
+// add a vertex with a default constructed property
+template <typename K>
+typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor
+add_vertex(OpenMesh::TriMesh_ArrayKernelT<K>& sm) {
+  return sm.add_vertex(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_property_type());
+}
+
+template <typename K>
+typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor
+add_vertex(const typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_property_type& p, OpenMesh::TriMesh_ArrayKernelT<K>& sm) {
+  return sm.add_vertex(p);
+}
+
+template <typename K>
+void
+clear_vertex(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor, 
+             OpenMesh::TriMesh_ArrayKernelT<K>&) {
+  CGAL_assert(false);
+}
+
+  */
+
+template <typename K>
+void
+remove_vertex(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor v, 
+              OpenMesh::TriMesh_ArrayKernelT<K>& sm) {
+
+  sm.request_face_status();
+  sm.request_vertex_status();
+  sm.request_halfedge_status();
+  sm.set_halfedge_handle(v, typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor());
+  sm.status(v).set_deleted(true);
+}
+
+  
+template <typename K>
+void
+remove_edge(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor u, 
+            typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor v, 
+            OpenMesh::TriMesh_ArrayKernelT<K>& sm) 
+{
+  typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::edge_descriptor e = edge(u, v, sm);
+  remove_edge(e,sm);
+}
+
+template <typename K>
+void
+remove_edge(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::edge_descriptor e, 
+            OpenMesh::TriMesh_ArrayKernelT<K>& sm) 
+{
+  sm.request_face_status();
+  sm.request_vertex_status();
+  sm.request_halfedge_status();
+  sm.request_edge_status();
+
+  typedef typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor halfedge_descriptor;
+
+  halfedge_descriptor h1 = halfedge(e,sm);
+  halfedge_descriptor h2 = opposite(halfedge(e,sm),sm);
+  sm.status(sm.edge_handle(h1)).set_deleted(true);
+  sm.status(h1).set_deleted(true);
+  sm.status(h2).set_deleted(true);
+
+}
+
+
+template <typename K>
+void
+remove_edge(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::edge_iterator eiter, 
+            OpenMesh::TriMesh_ArrayKernelT<K>& sm) 
+{
+  remove_edge(*eiter, sm);
+}
+
+template<typename K>
+void
+remove_face(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::face_descriptor f, 
+            OpenMesh::TriMesh_ArrayKernelT<K>& sm)
+{
+
+  sm.request_face_status();
+  sm.request_vertex_status();
+  sm.request_halfedge_status();
+  
+  set_halfedge(f, typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::halfedge_descriptor(), sm);
+  sm.status(f).set_deleted(true);
+}
+
+#if 0 // conflits with function in Euler_operations.h
+template<typename K>
+std::pair<typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::edge_descriptor,
+          bool>
+add_edge(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor v1, 
+         typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor v2, 
+         OpenMesh::TriMesh_ArrayKernelT<K>& sm) {
+  
+  return sm.new_edge(v1, v2);
+}
+#endif
+
+template<typename K>
+typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::face_descriptor
+add_face(OpenMesh::TriMesh_ArrayKernelT<K>& sm)
+{
+  return sm.new_face();
+}
+
+template<typename K, typename InputIterator>
+typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::face_descriptor
+add_face(InputIterator begin, InputIterator end, OpenMesh::TriMesh_ArrayKernelT<K>& sm)
+{
+  typedef typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor vertex_descriptor;
+  CGAL_assertion(begin!= end);
+  vertex_descriptor u = *begin; 
+  ++begin;  
+  CGAL_assertion(begin!= end);
+    vertex_descriptor v = *begin; 
+  ++begin;  
+  CGAL_assertion(begin!= end);
+    vertex_descriptor w = *begin; 
+
+  return sm.add_face(u,v,w);
+}
+
+template<typename K>
+bool is_valid(OpenMesh::TriMesh_ArrayKernelT<K>& sm, bool /* verbose */ = false)
+{
+  return CGAL::is_valid_polygon_mesh(sm);
+}
+
+} // namespace OpenMesh
+
+
+#ifndef CGAL_NO_DEPRECATED_CODE
+#include <CGAL/boost/graph/backward_compatibility_functions.h>
+
+namespace boost {
+  // The following functions were defined in the namespace boost
+  using OpenMesh::vertices;
+  using OpenMesh::edges;
+  using OpenMesh::num_vertices;
+  using OpenMesh::num_edges;
+  using OpenMesh::out_edges;
+  using OpenMesh::in_edges;
+  using OpenMesh::target;
+  using OpenMesh::source;
+} // namespace boost
+#endif //CGAL_NO_DEPRECATED_CODE
+
+#if defined(BOOST_MSVC)
+#  pragma warning(pop)
+#endif
+
+#endif // CGAL_BOOST_GRAPH_TRAITS_TRIMESH_ARRAYKERNELT_H
diff --git a/3rdparty/CGAL/include/CGAL/boost/graph/graph_traits_Triangulation_2.h b/3rdparty/CGAL/include/CGAL/boost/graph/graph_traits_Triangulation_2.h
new file mode 100644
index 0000000..8cea712
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/boost/graph/graph_traits_Triangulation_2.h
@@ -0,0 +1,872 @@
+// Copyright (c) 2007  GeometryFactory (France).  All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Andreas Fabri, Fernando Cacciola
+
+#ifndef CGAL_GRAPH_TRAITS_TRIANGULATION_2_H
+#define CGAL_GRAPH_TRAITS_TRIANGULATION_2_H
+
+#include <functional>
+
+// include this to avoid a VC15 warning
+#include <CGAL/boost/graph/named_function_params.h>
+
+#include <boost/config.hpp>
+#include <boost/iterator_adaptors.hpp>
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/properties.hpp>
+
+#include <CGAL/boost/graph/properties.h>
+#include <CGAL/Triangulation_2.h>
+#include <CGAL/Iterator_range.h>
+
+// The functions and classes in this file allows the user to
+// treat a CGAL Triangulation_2 object as a boost graph "as is". No
+// wrapper is needed for the Triangulation_2 object.
+
+
+namespace CGAL {
+
+  namespace detail {
+
+template < class T, class EdgeBase >
+class Edge : public EdgeBase {
+
+public:
+  typedef typename T::Face_handle Face_handle ;
+  
+  Edge()
+  {}
+
+  Edge(Face_handle  fh, int i)
+    : EdgeBase(fh,i)
+  {}
+  
+  Edge(const EdgeBase& e)
+    : EdgeBase(e)
+  {}
+
+  Edge(const Edge& e)
+    : EdgeBase(e)
+  {}
+
+  Edge&
+  operator=(const Edge& e)
+  {
+    this->first = e.first;
+    this->second = e.second;
+    return *this;
+  }
+
+  friend std::size_t hash_value(const Edge& e)
+  {
+    if (e.first==Face_handle()) return 0;
+    return hash_value(e.first<e.first->neighbor(e.second)?
+                      e.first:e.first->neighbor(e.second));
+  }
+
+  bool operator==(const Edge& other) const
+  {
+    if((this->first == other.first)&&(this->second == other.second)) return true;
+    Face_handle fh = this->first->neighbor(this->second);
+    if(other.first != fh) return false;
+    int i = fh->index(this->first);
+    return (other.second == i);
+  }
+
+  bool operator!=(Edge& other) const
+  {
+    return ! (*this == other);
+  }
+};
+
+template <class Circ, class E>
+class Out_edge_circulator : public Circ
+{
+private:
+  mutable E e;
+
+public:
+
+  typedef E value_type;
+  typedef E* pointer;
+  typedef E& reference;
+
+  Out_edge_circulator()
+    : Circ()
+  {}
+
+  Out_edge_circulator(Circ c)
+    : Circ(c)
+  {}
+
+  const E& operator*() const
+  {
+    E ed = static_cast<const Circ*>(this)->operator*();
+    e = E(ed.first->neighbor(ed.second), ed.first->neighbor(ed.second)->index(ed.first));
+    return e;
+  }
+};
+ 
+template <class Circ, class E>
+class In_edge_circulator : public Circ
+{
+private:
+  mutable E e;
+
+public:
+
+  typedef E value_type;
+  typedef E* pointer;
+  typedef E& reference;
+
+  In_edge_circulator()
+    : Circ()
+  {}
+
+  In_edge_circulator(Circ c)
+    : Circ(c)
+  {}
+
+  const E& operator*() const
+{
+    typename Circ::value_type ed = static_cast<const Circ*>(this)->operator*();
+    e = E(ed);
+    return e;
+  }
+};
+  
+
+  //  The vertex iterator of the bgl must evaluate to a vertex handle, not to a vertex
+template < class T>
+class boost_all_vertices_iterator {
+protected:
+ typename T::All_vertices_iterator nt;
+public:
+  typedef typename T::All_vertices_iterator  Iterator;
+  typedef boost_all_vertices_iterator<T> Self;
+
+  typedef typename std::iterator_traits<Iterator>::iterator_category iterator_category;
+  typedef typename T::Vertex_handle  value_type;
+  typedef typename std::iterator_traits<Iterator>::difference_type           difference_type;
+  typedef value_type      reference;
+  typedef value_type      pointer;
+
+  // CREATION
+  // --------
+
+  boost_all_vertices_iterator()
+  {}
+
+  boost_all_vertices_iterator( Iterator j) : nt(j) {}
+
+  // OPERATIONS Forward Category
+  // ---------------------------
+
+
+  bool operator==( const Self& i) const { return ( nt == i.nt); }
+  bool operator!=( const Self& i) const { return !(nt == i.nt );   }
+  value_type  operator*() const  { return nt; }
+  value_type    operator->()  { return nt; }
+
+  Self& operator++() {
+    ++nt;
+    return *this;
+  }
+
+  Self  operator++(int) {
+    Self tmp = *this;
+    ++*this;
+    return tmp;
+  }
+
+  Self& operator--() {
+    --nt;
+    return *this;
+  }
+
+  Self  operator--(int) {
+    Self tmp = *this;
+    --*this;
+    return tmp;
+  }
+};
+
+template < class T>
+class boost_all_faces_iterator {
+protected:
+ typename T::All_faces_iterator nt;
+public:
+  typedef typename T::All_faces_iterator  Iterator;
+  typedef boost_all_faces_iterator<T> Self;
+
+  typedef typename std::iterator_traits<Iterator>::iterator_category iterator_category;
+  typedef typename T::Face_handle  value_type;
+  typedef typename std::iterator_traits<Iterator>::difference_type           difference_type;
+  typedef value_type      reference;
+  typedef value_type      pointer;
+
+  // CREATION
+  // --------
+
+  boost_all_faces_iterator()
+  {}
+
+  boost_all_faces_iterator( Iterator j) : nt(j) {}
+
+  // OPERATIONS Forward Category
+  // ---------------------------
+
+
+  bool operator==( const Self& i) const { return ( nt == i.nt); }
+  bool operator!=( const Self& i) const { return !(nt == i.nt );   }
+  value_type  operator*() const  { return nt; }
+  value_type    operator->()  { return nt; }
+
+  Self& operator++() {
+    ++nt;
+    return *this;
+  }
+
+  Self  operator++(int) {
+    Self tmp = *this;
+    ++*this;
+    return tmp;
+  }
+
+  Self& operator--() {
+    --nt;
+    return *this;
+  }
+
+  Self  operator--(int) {
+    Self tmp = *this;
+    --*this;
+    return tmp;
+  }
+};
+
+    
+    template <typename Tr>
+    struct T2_halfedge_descriptor
+    {
+      typedef typename Tr::Face_handle face_descriptor;
+      face_descriptor first;
+      int second;
+      operator std::pair<face_descriptor, int>() { return std::make_pair(first,second); }
+      
+      T2_halfedge_descriptor()
+      {}
+      
+      T2_halfedge_descriptor(const typename Tr::Edge& e)
+        : first(e.first), second(e.second)
+      {}
+      
+      T2_halfedge_descriptor(face_descriptor fd, int i)
+        : first(fd), second(i)
+      {}
+      
+      friend std::size_t hash_value(const T2_halfedge_descriptor& h)
+      {
+        return hash_value(h.first);
+      } 
+      
+      bool operator==(const T2_halfedge_descriptor& other) const
+      {
+        return (first == other.first) && (second == other.second);
+      }
+      
+      bool operator!=(const T2_halfedge_descriptor& other) const
+      {
+        return (first != other.first) || (second != other.second);
+      }
+
+      bool operator<(const T2_halfedge_descriptor& other) const
+      {
+        if(first < other.first) return true;
+        if(first > other.first) return false;
+        return second  < other.second;
+      }
+    };
+
+
+  } // namespace detail
+} // namespace CGAL
+
+namespace boost { 
+
+  template <class GT, class TDS>
+  struct graph_traits< CGAL::Triangulation_2<GT,TDS> > {
+
+    struct T2_graph_traversal_category : 
+      public virtual bidirectional_graph_tag,
+      public virtual adjacency_graph_tag,
+      public virtual edge_list_graph_tag,
+      public virtual vertex_list_graph_tag { };
+
+    typedef CGAL::Triangulation_2<GT,TDS> Triangulation;
+
+    typedef typename CGAL::Triangulation_2<GT,TDS>::Vertex_handle vertex_descriptor;
+    typedef typename CGAL::Triangulation_2<GT,TDS>::Face_handle face_descriptor;
+    typedef CGAL::detail::Edge<CGAL::Triangulation_2<GT,TDS>, typename CGAL::Triangulation_2<GT,TDS>::Edge>  edge_descriptor;
+    typedef typename CGAL::Triangulation_2<GT,TDS>::All_edges_iterator  edge_iterator;
+
+
+    typedef CGAL::detail::T2_halfedge_descriptor<Triangulation> halfedge_descriptor;
+
+    typedef typename CGAL::Triangulation_2<GT,TDS>::All_halfedges_iterator  halfedge_iterator;
+
+    typedef CGAL::detail::boost_all_vertices_iterator<Triangulation> vertex_iterator;
+    typedef CGAL::detail::boost_all_faces_iterator<Triangulation> face_iterator;
+    typedef CGAL::Counting_iterator<CGAL::detail::Out_edge_circulator<typename Triangulation::Edge_circulator, edge_descriptor>, edge_descriptor > out_edge_iterator;
+    typedef CGAL::Counting_iterator<CGAL::detail::In_edge_circulator<typename Triangulation::Edge_circulator, edge_descriptor>, edge_descriptor > in_edge_iterator;
+    typedef CGAL::Counting_iterator<typename Triangulation::Vertex_circulator> Incident_vertices_iterator;
+    typedef Incident_vertices_iterator adjacency_iterator;
+
+    typedef undirected_tag directed_category;
+    typedef disallow_parallel_edge_tag edge_parallel_category; 
+    typedef T2_graph_traversal_category traversal_category;
+    typedef typename Triangulation::size_type size_type;
+    typedef size_type vertices_size_type;
+    typedef size_type edges_size_type;
+    typedef size_type halfedges_size_type;
+    typedef size_type faces_size_type;
+    typedef size_type degree_size_type;
+
+  // nulls
+  static vertex_descriptor   null_vertex() { return vertex_descriptor(); }
+  static face_descriptor     null_face()   { return face_descriptor(); }
+  static halfedge_descriptor     null_halfedge()   { return halfedge_descriptor(); }
+  };
+
+
+} // namespace boost
+
+
+namespace CGAL {
+
+  template <class Gt, class Tds>
+  typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor
+  next(typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor e,
+       const Triangulation_2<Gt,Tds>& g)
+  {
+    typedef typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor halfedge_descriptor;
+    return halfedge_descriptor(e.first, g.ccw(e.second));
+  }
+
+
+  template <class Gt, class Tds>
+  typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor
+  prev(typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor e,
+       const Triangulation_2<Gt,Tds>& g)
+  {
+    typedef typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor halfedge_descriptor;
+    return halfedge_descriptor(e.first, g.cw(e.second));
+  }
+
+  
+
+  template <class Gt, class Tds>
+  typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor
+  opposite(typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor e,
+       const Triangulation_2<Gt,Tds>& g)
+  {
+    
+    return g.mirror_edge(e);
+  }
+  
+  template <class Gt, class Tds>
+  typename boost::graph_traits< Triangulation_2<Gt,Tds> >::vertex_descriptor
+  source(typename boost::graph_traits< Triangulation_2<Gt,Tds> >::edge_descriptor e,
+         const Triangulation_2<Gt,Tds>& g)
+  {
+    return e.first->vertex(g.ccw(e.second));
+  }
+
+  template <class Gt, class Tds>
+  typename boost::graph_traits< Triangulation_2<Gt,Tds> >::vertex_descriptor
+  target(typename boost::graph_traits< Triangulation_2<Gt,Tds> >::edge_descriptor e,
+         const Triangulation_2<Gt,Tds>& g)
+  {
+    return e.first->vertex(g.cw(e.second));
+  }
+
+  template <class Gt, class Tds>
+  typename boost::graph_traits< Triangulation_2<Gt,Tds> >::vertex_descriptor
+  source(typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor e,
+         const Triangulation_2<Gt,Tds>& g)
+  {
+    return e.first->vertex(g.ccw(e.second));
+  }
+
+  template <class Gt, class Tds>
+  typename boost::graph_traits< Triangulation_2<Gt,Tds> >::vertex_descriptor
+  target(typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor e,
+         const Triangulation_2<Gt,Tds>& g)
+  {
+    return e.first->vertex(g.cw(e.second));
+  }
+
+  template <class Gt, class Tds>
+  typename boost::graph_traits< Triangulation_2<Gt,Tds> >::face_descriptor
+  face(typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor e,
+         const Triangulation_2<Gt,Tds>&)
+  {
+    return e.first;
+  }
+
+  template <class Gt, class Tds>
+  typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor
+  halfedge(typename boost::graph_traits< Triangulation_2<Gt,Tds> >::face_descriptor f,
+           const Triangulation_2<Gt,Tds>&)
+  {
+    typedef typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor halfedge_descriptor;
+    return halfedge_descriptor(f,0);
+  }
+
+  template <class Gt, class Tds>
+  typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor
+  halfedge(typename boost::graph_traits< Triangulation_2<Gt,Tds> >::vertex_descriptor v,
+           const Triangulation_2<Gt,Tds>& g)
+  {
+    typedef typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor halfedge_descriptor;
+    typedef typename boost::graph_traits< Triangulation_2<Gt,Tds> >::face_descriptor face_descriptor;
+    face_descriptor fd = v->face();
+    int i = fd->index(v);
+    return halfedge_descriptor(fd,g.ccw(i));
+  }
+
+  template <class Gt, class Tds>
+  typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor
+  halfedge(typename boost::graph_traits< Triangulation_2<Gt,Tds> >::edge_descriptor e,
+           const Triangulation_2<Gt,Tds>&)
+  {
+    typedef typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor halfedge_descriptor;
+    return halfedge_descriptor(e.first,e.second);
+  }
+
+  template <class Gt, class Tds>
+  typename boost::graph_traits< Triangulation_2<Gt,Tds> >::edge_descriptor
+  edge(typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor e,
+           const Triangulation_2<Gt,Tds>&)
+  {
+    typedef typename boost::graph_traits< Triangulation_2<Gt,Tds> >::edge_descriptor edge_descriptor;
+    return edge_descriptor(e.first,e.second);
+  }
+
+
+  template <class Gt, class Tds>
+  inline Iterator_range<typename boost::graph_traits< Triangulation_2<Gt,Tds> >::vertex_iterator>  
+  vertices(const Triangulation_2<Gt,Tds>& g)
+  {
+    typedef typename boost::graph_traits< Triangulation_2<Gt,Tds> >::vertex_iterator
+      Iter;
+    return make_range( Iter(g.all_vertices_begin()), Iter(g.all_vertices_end()) );
+  }
+
+
+  template <class Gt, class Tds>
+  inline Iterator_range<typename boost::graph_traits< Triangulation_2<Gt,Tds> >::edge_iterator>  
+  edges(const Triangulation_2<Gt,Tds>& g)
+  {    
+    return make_range(g.all_edges_begin(), g.all_edges_end());
+  }
+
+  template <class Gt, class Tds>
+  inline Iterator_range<typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_iterator >  
+  halfedges(const Triangulation_2<Gt,Tds>& g)
+  {    
+    return make_range(g.all_halfedges_begin(), g.all_halfedges_end());
+  }
+
+  template <class Gt, class Tds>
+  inline Iterator_range<typename boost::graph_traits< Triangulation_2<Gt,Tds> >::face_iterator >  
+  faces(const Triangulation_2<Gt,Tds>& g)
+  {
+    typedef typename boost::graph_traits< Triangulation_2<Gt,Tds> >::face_iterator
+      Iter;
+    return make_range( Iter(g.all_faces_begin()), Iter(g.all_faces_end()) );
+  }
+
+  template <class Gt, class Tds>
+  typename boost::graph_traits< Triangulation_2<Gt,Tds> >::degree_size_type
+  out_degree(
+    typename boost::graph_traits< Triangulation_2<Gt,Tds> >::vertex_descriptor u, 
+    const Triangulation_2<Gt,Tds>& g)
+  {
+    typename boost::graph_traits< Triangulation_2<Gt,Tds> >::degree_size_type deg = 0;
+    typename Triangulation_2<Gt,Tds>::Edge_circulator c = g.incident_edges(u), done(c);
+    if ( c != 0) {
+        do {
+            ++deg;
+        } while (++c != done);
+    }
+    return deg;
+  }
+
+  template <class Gt, class Tds>
+  inline Iterator_range<typename boost::graph_traits< Triangulation_2<Gt,Tds> >::out_edge_iterator >  
+  out_edges(
+    typename boost::graph_traits< Triangulation_2<Gt,Tds> >::vertex_descriptor u, 
+    const Triangulation_2<Gt,Tds>& g)
+  {
+    typename Triangulation_2<Gt,Tds>::Edge_circulator ec(u,u->face());
+    typename boost::graph_traits< Triangulation_2<Gt,Tds> >::degree_size_type out_deg = out_degree(u,g);
+    typedef typename boost::graph_traits< Triangulation_2<Gt,Tds> >
+      ::out_edge_iterator Iter;
+    
+    return make_range( Iter(ec), Iter(ec,out_deg) );
+  }
+
+  template <class Gt, class Tds>
+  inline Iterator_range<typename boost::graph_traits< Triangulation_2<Gt,Tds> >::in_edge_iterator >  
+  in_edges(
+    typename boost::graph_traits< Triangulation_2<Gt,Tds> >::vertex_descriptor u, 
+    const Triangulation_2<Gt,Tds>& g)
+  {
+    typename Triangulation_2<Gt,Tds>::Edge_circulator ec(u,u->face());
+    typename boost::graph_traits< Triangulation_2<Gt,Tds> >::degree_size_type out_deg = out_degree(u,g);
+    typedef typename boost::graph_traits< Triangulation_2<Gt,Tds> >
+      ::in_edge_iterator Iter;
+    return make_range( Iter(ec), Iter(ec,out_deg) );
+  }
+
+  template <class Gt, class Tds>
+  inline Iterator_range<typename boost::graph_traits< Triangulation_2<Gt,Tds> >::adjacency_iterator>  
+  adjacent_vertices(
+    typename boost::graph_traits< Triangulation_2<Gt,Tds> >::vertex_descriptor u, 
+    const Triangulation_2<Gt,Tds>& g)
+  {
+    typename Triangulation_2<Gt,Tds>::Vertex_circulator vc = out_edge_iterator(u,u.face());
+    typename boost::graph_traits< Triangulation_2<Gt,Tds> >::degree_size_type out_deg = out_degree(u,g);
+    typedef typename boost::graph_traits< Triangulation_2<Gt,Tds> >
+      ::adjacency_iterator Iter;
+    return make_range( Iter(vc), Iter(vc,out_deg) );
+  }
+
+  template <class Gt, class Tds>
+  typename boost::graph_traits< Triangulation_2<Gt,Tds> >::vertices_size_type
+  num_vertices(const Triangulation_2<Gt,Tds>& g)
+  {
+    return g.tds().number_of_vertices();
+  }  
+
+  template <class Gt, class Tds>
+  typename boost::graph_traits< Triangulation_2<Gt,Tds> >::edges_size_type
+  num_edges(const Triangulation_2<Gt,Tds>& g)
+  {
+
+    return  g.tds().number_of_vertices() + g.tds().number_of_faces() - 2;
+  }  
+
+  template <class Gt, class Tds>
+  typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedges_size_type
+  num_halfedges(const Triangulation_2<Gt,Tds>& g)
+  {
+    return  num_edges(g) * 2;
+  }  
+
+  template <class Gt, class Tds>
+  typename boost::graph_traits< Triangulation_2<Gt,Tds> >::faces_size_type
+  num_faces(const Triangulation_2<Gt,Tds>& g)
+  {
+    return  g.tds().number_of_faces();
+  } 
+
+  template <class Gt, class Tds>
+  typename boost::graph_traits< Triangulation_2<Gt,Tds> >::degree_size_type
+  in_degree(
+    typename boost::graph_traits< Triangulation_2<Gt,Tds> >::vertex_descriptor u, 
+    const Triangulation_2<Gt,Tds>& g)
+  {
+    typename boost::graph_traits< Triangulation_2<Gt,Tds> >::degree_size_type deg = 0;
+    typename Triangulation_2<Gt,Tds>::Edge_circulator c = g.incident_edges(u), done(c);
+    if ( c != 0) {
+        do {
+            ++deg;
+        } while (++c != done);
+    }
+    return deg;
+  }
+
+  template <class Gt, class Tds>
+  typename boost::graph_traits< Triangulation_2<Gt,Tds> >::degree_size_type
+  degree(
+    typename boost::graph_traits< Triangulation_2<Gt,Tds> >::vertex_descriptor u, 
+    const Triangulation_2<Gt,Tds>& g)
+  {
+    typename boost::graph_traits< Triangulation_2<Gt,Tds> >::degree_size_type deg = 0;
+    typename Triangulation_2<Gt,Tds>::Edge_circulator c = g.incident_edges(u), done(c);
+    if ( c != 0) {
+        do {
+            ++deg;
+        } while (++c != done);
+    }
+    return deg;
+  }
+
+
+  // property maps
+  template <class Gt, class Tds>
+  class T2_vertex_id_map
+    : public boost::put_get_helper<int, T2_vertex_id_map<Gt,Tds> >
+  {
+  public:
+    typedef boost::readable_property_map_tag category;
+    typedef int value_type;
+    typedef int reference;
+    typedef typename CGAL::Triangulation_2<Gt,Tds>::Vertex_handle key_type;
+    
+    T2_vertex_id_map()
+    {}
+    
+    long operator[](key_type vh) const {
+      return vh->id(); 
+    }
+  };
+
+  template <class Gt, class Tds>
+  class T2_vertex_point_map
+  {
+  public:
+    typedef boost::lvalue_property_map_tag category;
+    typedef typename Tds::Vertex::Point value_type;
+    typedef value_type& reference;
+    typedef typename CGAL::Triangulation_2<Gt,Tds>::Vertex_handle key_type;
+
+    friend reference get(T2_vertex_point_map<Gt,Tds>, key_type vh)
+    { 
+      return vh->point(); 
+    }
+    friend void put(T2_vertex_point_map<Gt,Tds>, key_type vh, reference v)
+    {
+      vh->point()=v; 
+    }
+    reference operator[](key_type vh) const {
+      return vh->point();
+    }
+  };
+
+
+  template <class Gt, class Tds>
+  class T2_edge_id_map
+    : public boost::put_get_helper<int, T2_edge_id_map<Gt,Tds> >
+  {
+  public:
+    typedef boost::readable_property_map_tag category;
+    typedef int value_type;
+    typedef int reference;
+    typedef typename CGAL::Triangulation_2<Gt,Tds>::Edge key_type;
+    
+    T2_edge_id_map()
+    {}
+    
+    long operator[](key_type e) const {
+      return (3 * e.first.id()) + e.second; 
+    }
+  };
+
+  template <class Gt, class Tds>
+  class T2_edge_weight_map
+    : public boost::put_get_helper<typename Gt::FT, T2_edge_weight_map<Gt, Tds> >
+  {
+  private:
+    const CGAL::Triangulation_2<Gt,Tds>& tr;
+  public:
+    typedef boost::readable_property_map_tag category;
+    typedef typename Gt::FT value_type;
+    typedef value_type reference;
+    typedef typename CGAL::Triangulation_2<Gt,Tds>::Edge key_type;
+
+    T2_edge_weight_map(const CGAL::Triangulation_2<Gt,Tds>& tr_) 
+      : tr(tr_) 
+    { }
+
+    value_type operator[](key_type e) const {
+      return approximate_sqrt(tr.segment(e).squared_length());
+    }
+  };
+
+
+  template <class Gt, class Tds>
+  inline T2_vertex_id_map<Gt,Tds>
+  get(boost::vertex_index_t, const Triangulation_2<Gt,Tds>&) {
+    T2_vertex_id_map<Gt,Tds> m;
+    return m;
+  }
+
+  template <class Gt, class Tds>
+  inline T2_vertex_point_map<Gt,Tds>
+  get(boost::vertex_point_t, const Triangulation_2<Gt,Tds>&) {
+    T2_vertex_point_map<Gt,Tds> m;
+    return m;
+  }
+
+  template <class Gt, class Tds>
+  inline T2_edge_id_map<Gt,Tds>
+  get(boost::edge_index_t, const Triangulation_2<Gt,Tds>&) {
+    T2_edge_id_map<Gt,Tds> m;
+    return m;
+  }
+
+  template <class Gt, class Tds>
+  inline T2_edge_weight_map<Gt,Tds>
+  get(boost::edge_weight_t, const Triangulation_2<Gt,Tds>& g) {
+    T2_edge_weight_map<Gt,Tds> m(g);
+    return m;
+  }
+
+  template <class Tag>
+  struct T2_property_map { };
+
+  template <>
+  struct T2_property_map<boost::vertex_index_t> {
+    template <class Gt, class Tds>
+    struct bind_ {
+      typedef T2_vertex_id_map<Gt,Tds> type;
+      typedef T2_vertex_id_map<Gt,Tds> const_type;
+    };
+  };
+
+
+
+  template <>
+  struct T2_property_map<boost::vertex_point_t> {
+    template <class Gt, class Tds>
+    struct bind_ {
+      typedef T2_vertex_point_map<Gt,Tds> type;
+      typedef T2_vertex_point_map<Gt,Tds> const_type;
+    };
+  };
+
+
+  template <>
+  struct T2_property_map<boost::edge_index_t> {
+    template <class Gt, class Tds>
+    struct bind_ {
+      typedef T2_edge_id_map<Gt,Tds> type;
+      typedef T2_edge_id_map<Gt,Tds> const_type;
+    };
+  };
+
+
+  template <>
+  struct T2_property_map<boost::edge_weight_t> {
+    template <class Gt, class Tds>
+    struct bind_ {
+      typedef T2_edge_weight_map<Gt,Tds> type;
+      typedef T2_edge_weight_map<Gt,Tds> const_type;
+    };
+  };
+
+} // namespace CGAL
+
+namespace boost {
+  // g++ 'enumeral_type' in template unification not implemented workaround
+  template <class Gt, class Tds, class Tag>
+  struct property_map<CGAL::Triangulation_2<Gt,Tds>, Tag> {
+    typedef typename 
+    CGAL::T2_property_map<Tag>::template bind_<Gt,Tds> map_gen;
+    typedef typename map_gen::type type;
+    typedef typename map_gen::const_type const_type;
+  };
+
+  // see struct property_map in Polyehdron for an explanation
+  template <class Gt, class Tds, class Tag>
+  struct property_map<const CGAL::Triangulation_2<Gt,Tds>, Tag> {
+    typedef typename 
+    CGAL::T2_property_map<Tag>::template bind_<Gt,Tds> map_gen;
+    typedef typename map_gen::type type;
+    typedef typename map_gen::const_type const_type;
+  };
+
+} // namespace boost
+
+
+namespace CGAL {
+
+  template <class Gt, class Tds, class PropertyTag, class Key>
+  inline
+  typename boost::property_traits<
+    typename boost::property_map<Triangulation_2<Gt,Tds>,PropertyTag>::const_type>::value_type
+  get(PropertyTag p, const Triangulation_2<Gt,Tds>& g, const Key& key) {
+    return get(get(p, g), key);
+  }
+  
+  template <class Gt, class Tds, class PropertyTag, class Key,class Value>
+  inline void
+  put(PropertyTag p, Triangulation_2<Gt,Tds>& g, 
+      const Key& key, const Value& value)
+  {
+    typedef typename boost::property_map<Triangulation_2<Gt,Tds>, PropertyTag>::type Map;
+    Map pmap = get(p, g);
+    put(pmap, key, value);
+  }
+
+} // namespace CGAL 
+
+namespace boost {
+
+  // What are those needed for ???
+  template <typename Gt, typename Tds>
+  struct edge_property_type<CGAL::Triangulation_2<Gt,Tds> > {
+    typedef void type;
+  };  
+
+  template <typename Gt, typename Tds>
+  struct vertex_property_type<CGAL::Triangulation_2<Gt,Tds> > {
+    typedef void type;
+  };
+} // namespace boost
+
+
+namespace std {
+
+
+#if defined(BOOST_MSVC)
+#  pragma warning(push)
+#  pragma warning(disable:4099) // For VC10 it is class hash 
+#endif
+
+#ifndef CGAL_CFG_NO_STD_HASH
+
+  template < class T, class EdgeBase>
+  struct hash<CGAL::detail::Edge<T,EdgeBase> > {
+    std::size_t operator()(const CGAL::detail::Edge<T,EdgeBase>& e) const
+    {
+      return hash_value(e);
+    }
+  }; 
+
+  template < class Tr>
+  struct hash<CGAL::detail::T2_halfedge_descriptor<Tr> > {
+    std::size_t operator()(const CGAL::detail::T2_halfedge_descriptor<Tr>& e) const
+    {
+      return hash_value(e);
+    }
+  };
+
+#endif // CGAL_CFG_NO_STD_HASH
+
+#if defined(BOOST_MSVC)
+#  pragma warning(pop)
+#endif
+
+} // namespace std
+
+
+#endif // CGAL_GRAPH_TRAITS_TRIANGULATION_2_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/halfedge_graph_traits.h b/3rdparty/CGAL/include/CGAL/boost/graph/halfedge_graph_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/boost/graph/halfedge_graph_traits.h
rename to 3rdparty/CGAL/include/CGAL/boost/graph/halfedge_graph_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/halfedge_graph_traits_HalfedgeDS.h b/3rdparty/CGAL/include/CGAL/boost/graph/halfedge_graph_traits_HalfedgeDS.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/boost/graph/halfedge_graph_traits_HalfedgeDS.h
rename to 3rdparty/CGAL/include/CGAL/boost/graph/halfedge_graph_traits_HalfedgeDS.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/halfedge_graph_traits_Polyhedron_3.h b/3rdparty/CGAL/include/CGAL/boost/graph/halfedge_graph_traits_Polyhedron_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/boost/graph/halfedge_graph_traits_Polyhedron_3.h
rename to 3rdparty/CGAL/include/CGAL/boost/graph/halfedge_graph_traits_Polyhedron_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/helpers.h b/3rdparty/CGAL/include/CGAL/boost/graph/helpers.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/boost/graph/helpers.h
rename to 3rdparty/CGAL/include/CGAL/boost/graph/helpers.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/internal/Has_member_clear.h b/3rdparty/CGAL/include/CGAL/boost/graph/internal/Has_member_clear.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/boost/graph/internal/Has_member_clear.h
rename to 3rdparty/CGAL/include/CGAL/boost/graph/internal/Has_member_clear.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/internal/OM_iterator_from_circulator.h b/3rdparty/CGAL/include/CGAL/boost/graph/internal/OM_iterator_from_circulator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/boost/graph/internal/OM_iterator_from_circulator.h
rename to 3rdparty/CGAL/include/CGAL/boost/graph/internal/OM_iterator_from_circulator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/internal/helpers.h b/3rdparty/CGAL/include/CGAL/boost/graph/internal/helpers.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/boost/graph/internal/helpers.h
rename to 3rdparty/CGAL/include/CGAL/boost/graph/internal/helpers.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/iterator.h b/3rdparty/CGAL/include/CGAL/boost/graph/iterator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/boost/graph/iterator.h
rename to 3rdparty/CGAL/include/CGAL/boost/graph/iterator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/named_function_params.h b/3rdparty/CGAL/include/CGAL/boost/graph/named_function_params.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/boost/graph/named_function_params.h
rename to 3rdparty/CGAL/include/CGAL/boost/graph/named_function_params.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/properties.h b/3rdparty/CGAL/include/CGAL/boost/graph/properties.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/boost/graph/properties.h
rename to 3rdparty/CGAL/include/CGAL/boost/graph/properties.h
diff --git a/3rdparty/CGAL/include/CGAL/boost/graph/properties_CombinatorialMap.h b/3rdparty/CGAL/include/CGAL/boost/graph/properties_CombinatorialMap.h
new file mode 100644
index 0000000..30daae2
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/boost/graph/properties_CombinatorialMap.h
@@ -0,0 +1,279 @@
+// Copyright (c) 2013 CNRS and LIRIS' Establishments (France).
+//
+// 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:
+// 
+//
+// Author(s)     : Pierre Talbot
+
+#ifndef CGAL_BOOST_GRAPH_PROPERTIES_COMBINATORIAL_MAP_H
+#define CGAL_BOOST_GRAPH_PROPERTIES_COMBINATORIAL_MAP_H
+
+#include <CGAL/boost/graph/properties.h>
+#include <CGAL/Unique_hash_map.h>
+#include <CGAL/Linear_cell_complex.h>
+#include <CGAL/number_utils.h>
+
+#define CGAL_LCC_ARGS unsigned int d_, unsigned int ambient_dim, \
+             class Traits_, \
+             class Items_, \
+             class Alloc_, \
+             template<unsigned int, class, class, class> \
+             class CMap
+
+#define CGAL_LCC_TYPE CGAL::Linear_cell_complex<d_, ambient_dim, Traits_, Items_, Alloc_, CMap > 
+
+namespace CGAL {
+
+template<class LCC>
+class LCC_edge_weight_map : public boost::put_get_helper<double, LCC>
+{ 
+  typedef typename LCC::Point Point;
+  typedef typename Kernel_traits<Point>::Kernel::FT FT;
+public:
+
+  typedef boost::readable_property_map_tag                         category;
+  typedef FT                                                       value_type;
+  typedef FT                                                       reference;
+  typedef typename boost::graph_traits<LCC const>::edge_descriptor key_type;
+
+  LCC_edge_weight_map(LCC const& ) {}
+
+  reference operator[](key_type const& e) const
+  {
+    return approximate_sqrt(CGAL::squared_distance(LCC::point(e), LCC::point(e->opposite())));
+  }
+};
+
+template <class CMap>
+class CMap_dart_index_map_external 
+  : public boost::put_get_helper<std::size_t, CMap_dart_index_map_external<CMap> >
+{
+  
+public:
+
+  typedef boost::readable_property_map_tag                                category;
+  typedef std::size_t                                                     value_type;
+  typedef std::size_t                                                     reference;
+  typedef typename boost::graph_traits<CMap const>::edge_descriptor       key_type;
+
+  CMap_dart_index_map_external() : map()
+  {}
+
+  CMap_dart_index_map_external(CMap const& cm) 
+    : map()
+  {
+    CMap &cmap = const_cast<CMap&>(cm);
+    typedef typename CMap::template One_dart_per_cell_range<1>::iterator Iter;
+    Iter b=cmap.template one_dart_per_cell<1>().begin();
+    Iter e=cmap.template one_dart_per_cell<1>().end();
+    for(value_type i=0; b != e; ++b, ++i)
+    {
+      map[b] = i;
+      ++i;
+      map[b->opposite()] = i;
+    }
+    typedef typename CMap::Dart_range::iterator DIter;
+    DIter bi = cmap.darts().begin();
+    DIter ei = cmap.darts().end();
+    for(; bi != ei; ++bi)
+    {
+      value_type v1 = map[bi];
+      value_type v2 = map[opposite_edge(bi, cm)];
+      CGAL_assertion(v1 - v2 == 1 || v1 - v2 == -1);
+    }
+  }
+
+  reference operator[](key_type const& e) const { return map[e]; }
+  
+private:
+  
+  CGAL::Unique_hash_map<key_type,std::size_t> map ;
+};
+
+template<class LCC>
+class LCC_vertex_point_map : public boost::put_get_helper< typename LCC::Point&, LCC_vertex_point_map<LCC> >
+{
+public:
+
+  typedef typename LCC::Point Point;
+  
+  typedef boost::lvalue_property_map_tag category;
+  typedef Point value_type;
+  typedef Point& reference;
+  typedef typename boost::graph_traits<LCC>::vertex_descriptor key_type;
+
+  LCC_vertex_point_map(LCC& ) {}
+
+  reference operator[](key_type const& v) const { return LCC::point(v); }
+};
+
+template<class LCC>
+class LCC_vertex_point_const_map : public boost::put_get_helper< typename LCC::Point const&, LCC_vertex_point_const_map<LCC> >
+{
+public:
+
+  typedef typename LCC::Point Point;
+  
+  typedef boost::readable_property_map_tag category;
+  typedef Point value_type;
+  typedef Point const& reference;
+  typedef typename boost::graph_traits<LCC const>::vertex_descriptor key_type;
+
+  LCC_vertex_point_const_map(LCC const&) {}
+
+  reference operator[](key_type const& v) const { return LCC::point(v); }
+};
+
+
+template <class CMap, typename Tag>
+struct CMap_property_map
+{};
+
+template <class CMap>
+struct CMap_property_map<CMap, vertex_external_index_t> 
+{
+  typedef CMap_dart_index_map_external<CMap> type;
+  typedef CMap_dart_index_map_external<CMap> const_type;
+};
+
+template <class CMap>
+struct CMap_property_map<CMap, edge_external_index_t> 
+{
+  typedef CMap_dart_index_map_external<CMap> type;
+  typedef CMap_dart_index_map_external<CMap> const_type;
+};
+
+template <class CMap>
+struct CMap_property_map<CMap, boost::edge_index_t>
+{
+  typedef CMap_dart_index_map_external<CMap> type;
+  typedef CMap_dart_index_map_external<CMap> const_type;
+};
+
+template <class CMap>
+struct CMap_property_map<CMap, boost::vertex_index_t>
+{
+  typedef CMap_dart_index_map_external<CMap> type;
+  typedef CMap_dart_index_map_external<CMap> const_type;
+};
+
+// For LCC
+template <class LCC>
+struct CMap_property_map<LCC, boost::edge_weight_t>
+{
+  typedef LCC_edge_weight_map<LCC> type;
+  typedef LCC_edge_weight_map<LCC> const_type;
+};
+
+template <class LCC>
+struct CMap_property_map<LCC, vertex_point_t>
+{
+  typedef LCC_vertex_point_map<LCC> type;
+  typedef LCC_vertex_point_const_map<LCC> const_type;
+};
+
+template <class Type, class Tag>
+struct CMap_property_map_helper
+{
+  typedef typename CGAL::CMap_property_map<Type, Tag> map_gen;
+  typedef typename map_gen::type       type;
+  typedef typename map_gen::const_type const_type;
+};
+
+} // namespace CGAL
+
+namespace boost{
+
+// LCC.
+template<CGAL_LCC_ARGS, class Tag>
+struct property_map<CGAL_LCC_TYPE, Tag> : CGAL::CMap_property_map_helper<CGAL_LCC_TYPE, Tag>
+{};
+
+// This partial specialization shouldn't be needed but is due to a bug in Boost 1.51.
+template<CGAL_LCC_ARGS, class Tag>
+struct property_map<const CGAL_LCC_TYPE, Tag> : CGAL::CMap_property_map_helper<CGAL_LCC_TYPE, Tag>
+{};
+
+template<CGAL_LCC_ARGS>
+CGAL::CMap_dart_index_map_external<CGAL_LCC_TYPE> get(CGAL::edge_external_index_t, CGAL_LCC_TYPE const& cmap) 
+{
+  return CGAL::CMap_dart_index_map_external<CGAL_LCC_TYPE>(cmap);
+}
+
+template<CGAL_LCC_ARGS>
+CGAL::CMap_dart_index_map_external<CGAL_LCC_TYPE> get(CGAL::vertex_external_index_t, CGAL_LCC_TYPE const& cmap) 
+{
+  return CGAL::CMap_dart_index_map_external<CGAL_LCC_TYPE>(cmap);
+}
+
+// LCC get.
+template <CGAL_LCC_ARGS>
+CGAL::LCC_edge_weight_map<CGAL_LCC_TYPE> get(edge_weight_t, CGAL_LCC_TYPE const& lcc) 
+{
+  return CGAL::LCC_edge_weight_map<CGAL_LCC_TYPE>(lcc);
+}
+
+template <CGAL_LCC_ARGS>
+CGAL::CMap_dart_index_map_external<CGAL_LCC_TYPE> get(edge_index_t, CGAL_LCC_TYPE const& lcc) 
+{
+  return CGAL::CMap_dart_index_map_external<CGAL_LCC_TYPE>(lcc);
+}
+
+template <CGAL_LCC_ARGS>
+CGAL::CMap_dart_index_map_external<CGAL_LCC_TYPE> get(vertex_index_t, CGAL_LCC_TYPE const& lcc) 
+{
+  return CGAL::CMap_dart_index_map_external<CGAL_LCC_TYPE>(lcc);
+}
+
+template <CGAL_LCC_ARGS>
+CGAL::LCC_vertex_point_map<CGAL_LCC_TYPE> get(CGAL::vertex_point_t, CGAL_LCC_TYPE& lcc) 
+{
+  return CGAL::LCC_vertex_point_map<CGAL_LCC_TYPE>(lcc);
+}
+
+template <CGAL_LCC_ARGS>
+CGAL::LCC_vertex_point_const_map<CGAL_LCC_TYPE> get(CGAL::vertex_point_t, CGAL_LCC_TYPE const& lcc) 
+{
+  return CGAL::LCC_vertex_point_const_map<CGAL_LCC_TYPE>(lcc);
+}
+
+template<CGAL_LCC_ARGS, class PropertyTag, class Key>
+typename property_traits<typename property_map<CGAL_LCC_TYPE, PropertyTag>::type>::reference
+get(PropertyTag p, CGAL_LCC_TYPE& g, const Key& key) 
+{
+  return get(get(p, g), key);
+}
+
+template<CGAL_LCC_ARGS, class PropertyTag, class Key>
+typename property_traits<typename property_map<CGAL_LCC_TYPE, PropertyTag>::const_type>::reference
+get(PropertyTag p, CGAL_LCC_TYPE const& g, const Key& key) 
+{
+  return get(get(p, g), key);
+}
+
+template<CGAL_LCC_ARGS, class PropertyTag, class Key,class Value>
+void put(PropertyTag p, CGAL_LCC_TYPE& g, const Key& key, const Value& value)
+{
+  typedef typename property_map<CGAL_LCC_TYPE, PropertyTag>::type Map;
+  Map pmap = get(p, g);
+  put(pmap, key, value);
+}
+
+} // namespace boost
+
+#undef CGAL_LCC_ARGS
+#undef CGAL_LCC_TYPE
+
+
+#endif // CGAL_BOOST_GRAPH_PROPERTIES_COMBINATORIAL_MAP_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/properties_PolyMesh_ArrayKernelT.h b/3rdparty/CGAL/include/CGAL/boost/graph/properties_PolyMesh_ArrayKernelT.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/boost/graph/properties_PolyMesh_ArrayKernelT.h
rename to 3rdparty/CGAL/include/CGAL/boost/graph/properties_PolyMesh_ArrayKernelT.h
diff --git a/3rdparty/CGAL/include/CGAL/boost/graph/properties_Polyhedron_3.h b/3rdparty/CGAL/include/CGAL/boost/graph/properties_Polyhedron_3.h
new file mode 100644
index 0000000..af3fdc4
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/boost/graph/properties_Polyhedron_3.h
@@ -0,0 +1,443 @@
+// Copyright (c) 2007  GeometryFactory (France).  All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Andreas Fabri, Fernando Cacciola
+
+#ifndef CGAL_BOOST_GRAPH_PROPERTIES_POLYHEDRON_3_H
+#define CGAL_BOOST_GRAPH_PROPERTIES_POLYHEDRON_3_H
+
+#include <CGAL/boost/graph/properties.h>
+#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
+#include <CGAL/Unique_hash_map.h>
+#include <CGAL/squared_distance_2_1.h>
+#include <CGAL/number_utils.h>
+#include <boost/shared_ptr.hpp>
+
+#define CGAL_HDS_PARAM_ template < class Traits, class Items, class Alloc> class HDS
+
+namespace CGAL {
+
+namespace internal {
+
+template<class Handle>
+class Polyhedron_index_map_external
+  : public boost::put_get_helper<std::size_t, Polyhedron_index_map_external<Handle> >
+{
+public:
+  typedef boost::readable_property_map_tag category;
+  typedef std::size_t                      value_type;
+  typedef std::size_t                      reference;
+  typedef Handle                           key_type;
+
+private:
+  typedef CGAL::Unique_hash_map<key_type,std::size_t> Map;
+
+public:
+  template <typename InputIterator>
+  Polyhedron_index_map_external(InputIterator begin, InputIterator end, std::size_t max)
+    : map_(new Map(begin, end, 0, std::size_t(-1), max)) {}
+
+  reference operator[](const key_type& k) const { return (*map_)[k]; }
+private:
+   boost::shared_ptr<Map> map_;
+};
+
+// Special case for edges.
+template<class Polyhedron>
+class Polyhedron_edge_index_map_external
+  : public boost::put_get_helper<std::size_t, Polyhedron_edge_index_map_external<Polyhedron> >
+{
+public:
+  typedef boost::readable_property_map_tag                          category;
+  typedef std::size_t                                               value_type;
+  typedef std::size_t                                               reference;
+  typedef typename boost::graph_traits<Polyhedron>::edge_descriptor key_type;
+
+private:
+  typedef CGAL::Unique_hash_map<key_type,std::size_t> Map;
+
+public:
+  Polyhedron_edge_index_map_external(Polyhedron& p)
+    : map_(new Map(std::size_t(-1), num_halfedges(p)))
+  {
+    unsigned int data = 0;
+    typename boost::graph_traits<Polyhedron>::edge_iterator it, end;
+    for(boost::tie(it, end) = edges(p); it != end; ++it, ++data)
+      (*map_)[*it] = data;
+  }
+
+  reference operator[](const key_type& k) const { return (*map_)[k]; }
+private:
+  boost::shared_ptr<Map> map_;
+};
+
+  template<typename Handle, typename FT>
+struct Wrap_squared
+    : boost::put_get_helper< double, Wrap_squared<Handle,FT> >
+{
+  typedef FT value_type;
+  typedef FT reference;
+  typedef Handle key_type;
+  typedef boost::readable_property_map_tag category;
+
+  template<typename E>
+  FT
+  operator[](const E& e) const {
+    return approximate_sqrt(CGAL::squared_distance(e.halfedge()->vertex()->point(), e.halfedge()->opposite()->vertex()->point()));
+  }
+};
+
+  template<typename Polyhedron, typename Handle>
+struct Index_accessor
+    : boost::put_get_helper< std::size_t&, Index_accessor<Polyhedron,Handle> >
+{
+  typedef boost::lvalue_property_map_tag category;
+  typedef std::size_t&                   reference;
+  typedef std::size_t                    value_type;
+  typedef Handle                         key_type;
+
+  reference operator[](Handle h) const { return h->id(); }
+};
+
+template<typename Handle>
+struct Edge_index_accessor
+  : boost::put_get_helper< std::size_t, Edge_index_accessor<Handle> >
+{
+  typedef boost::readable_property_map_tag category;
+  typedef std::size_t                      reference;
+  typedef std::size_t                      value_type;
+  typedef Handle                           key_type;
+
+  reference operator[](Handle h) const { return h.id(); }
+};
+
+template<typename Handle, typename ValueType, typename Reference>
+struct Point_accessor
+  : boost::put_get_helper< Reference, Point_accessor<Handle, ValueType, Reference> >
+{
+  typedef boost::lvalue_property_map_tag category;
+  typedef Reference                      reference;
+  typedef ValueType                      value_type;
+  typedef Handle                         key_type;
+
+  reference operator[](Handle h) const { return h->point(); }
+};
+
+} // internal
+
+// the tag we dispatch on from property_map<G, Property>
+template <class Tag>
+struct Polyhedron_property_map {};
+
+} // namespace CGAL
+
+namespace CGAL {
+
+// generalized 2-ary get functions
+template<class Gt, class I, CGAL_HDS_PARAM_, class A, class PropertyTag>
+typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, PropertyTag >::const_type
+get(PropertyTag, CGAL::Polyhedron_3<Gt,I,HDS,A> const&)
+{ return typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, PropertyTag >::const_type(); }
+
+template<class Gt, class I, CGAL_HDS_PARAM_, class A, class PropertyTag>
+typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, PropertyTag >::type
+get(PropertyTag, CGAL::Polyhedron_3<Gt,I,HDS,A>&)
+{ return typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, PropertyTag >::type(); }
+
+// generalized 3-ary get functions
+template<class Gt, class I, CGAL_HDS_PARAM_, class A, class PropertyTag, class Key>
+typename boost::property_traits< typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, PropertyTag >::type >::reference
+get(PropertyTag p, CGAL::Polyhedron_3<Gt,I,HDS,A>& g, const Key& key)
+{ return get(get(p, g), key); }
+
+template<class Gt, class I, CGAL_HDS_PARAM_, class A, class PropertyTag, class Key>
+typename boost::property_traits< typename boost::property_map<CGAL::Polyhedron_3<Gt,I,HDS,A>, PropertyTag >::const_type >::reference
+get(PropertyTag p, CGAL::Polyhedron_3<Gt,I,HDS,A> const& g, const Key& key)
+{ return get(get(p, g), key); }
+
+
+
+// generalized put
+template<class Gt, class I, CGAL_HDS_PARAM_, class A, class PropertyTag, class Key,class Value>
+void put(PropertyTag p, CGAL::Polyhedron_3<Gt,I,HDS,A>& g, const Key& key, const Value& value)
+{
+  typedef typename boost::property_map<CGAL::Polyhedron_3<Gt,I,HDS,A>, PropertyTag>::type Map;
+  Map pmap = get(p, g);
+  put(pmap, key, value);
+}
+
+} // boost
+
+// specialization needs to be repeated for halfedge, vertex, face
+#define CGAL_POLYHEDRON_INDEX_PM(ENTITY, TAG, ACCESSOR)                 \
+  namespace CGAL {                                                      \
+  template<> struct Polyhedron_property_map<boost::ENTITY##TAG> {  \
+  template<class Gt, class I, CGAL_HDS_PARAM_, class A>                 \
+  struct bind_ {                                                        \
+    typedef internal::ACCESSOR##_accessor<                              \
+    CGAL::Polyhedron_3<Gt, I, HDS, A>, \
+    typename boost::graph_traits< CGAL::Polyhedron_3<Gt, I, HDS, A>     \
+                                  >::ENTITY##_descriptor > type;        \
+    typedef type const_type;                                            \
+  };                                                                    \
+  };                                                                    \
+  }
+
+CGAL_POLYHEDRON_INDEX_PM(halfedge, _index_t, Index)
+CGAL_POLYHEDRON_INDEX_PM(vertex, _index_t, Index)
+CGAL_POLYHEDRON_INDEX_PM(face, _index_t, Index)
+
+#undef CGAL_POLYHEDRON_INDEX_PM
+
+namespace CGAL {
+// not done with macros, because HDS_edge::id does not return a
+// reference
+template <>
+struct Polyhedron_property_map<boost::edge_index_t>
+{
+  template<class Gt, class I, CGAL_HDS_PARAM_, class A>
+  struct bind_
+  {
+    typedef internal::Edge_index_accessor<
+      typename boost::graph_traits<
+        CGAL::Polyhedron_3<Gt, I, HDS, A>
+        >::edge_descriptor > type;
+    typedef type const_type;
+  };
+};
+
+template <>
+struct Polyhedron_property_map<boost::edge_weight_t>
+{
+  template<class Gt, class I, CGAL_HDS_PARAM_, class A>
+  struct bind_
+  {
+    typedef typename CGAL::Polyhedron_3<Gt, I, HDS, A>::Traits::FT FT;
+    typedef typename boost::graph_traits<CGAL::Polyhedron_3<Gt, I, HDS, A> >::edge_descriptor edge_descriptor;
+    typedef internal::Wrap_squared<edge_descriptor,FT> type;
+    typedef type const_type;
+  };
+};
+
+template <>
+struct Polyhedron_property_map<vertex_point_t>
+{
+  template<class Gt, class I, CGAL_HDS_PARAM_, class A>
+  struct bind_
+  {
+    typedef internal::Point_accessor<
+      typename boost::graph_traits<
+        CGAL::Polyhedron_3<Gt, I, HDS, A>
+        >::vertex_descriptor,
+      typename Gt::Point_3, typename Gt::Point_3&> type;
+
+    typedef internal::Point_accessor<
+      typename boost::graph_traits<
+        CGAL::Polyhedron_3<Gt, I, HDS, A>
+        >::vertex_descriptor,
+      typename Gt::Point_3, const typename Gt::Point_3&> const_type;
+  };
+};
+
+//
+// external indices
+//
+
+template <>
+struct Polyhedron_property_map<edge_external_index_t>
+{
+  template<class Gt, class I, CGAL_HDS_PARAM_, class A>
+  struct bind_
+  {
+    typedef internal::Polyhedron_edge_index_map_external<
+      CGAL::Polyhedron_3<Gt, I, HDS, A>
+      > type;
+    typedef type const_type;
+  };
+};
+
+template <>
+struct Polyhedron_property_map<halfedge_external_index_t>
+{
+  template<class Gt, class I, CGAL_HDS_PARAM_, class A>
+  struct bind_
+  {
+    typedef internal::Polyhedron_index_map_external<
+      typename boost::graph_traits<
+        CGAL::Polyhedron_3<Gt, I, HDS, A>
+        >::halfedge_descriptor > type;
+    typedef type const_type;
+  };
+};
+
+
+template <>
+struct Polyhedron_property_map<vertex_external_index_t>
+{
+  template<class Gt, class I, CGAL_HDS_PARAM_, class A>
+  struct bind_
+  {
+    typedef internal::Polyhedron_index_map_external<
+      typename boost::graph_traits<
+        CGAL::Polyhedron_3<Gt, I, HDS, A>
+        >::vertex_descriptor > type;
+    typedef type const_type;
+  };
+};
+
+template <>
+struct Polyhedron_property_map<face_external_index_t>
+{
+  template<class Gt, class I, CGAL_HDS_PARAM_, class A>
+  struct bind_
+  {
+    typedef internal::Polyhedron_index_map_external<
+      typename boost::graph_traits<
+        CGAL::Polyhedron_3<Gt, I, HDS, A>
+        >::face_descriptor > type;
+    typedef type const_type;
+  };
+};
+
+} // CGAL
+
+namespace CGAL {
+
+template<class Gt, class I, CGAL_HDS_PARAM_, class A>
+typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, boost::edge_external_index_t >::const_type
+get(boost::edge_external_index_t, CGAL::Polyhedron_3<Gt,I,HDS,A> const& p)
+{
+  return typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, boost::edge_external_index_t >::const_type(
+    const_cast<CGAL::Polyhedron_3<Gt,I,HDS,A>& >(p));
+}
+
+template<class Gt, class I, CGAL_HDS_PARAM_, class A>
+typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, boost::halfedge_external_index_t >::const_type
+get(boost::halfedge_external_index_t, CGAL::Polyhedron_3<Gt,I,HDS,A> const& p)
+{
+  CGAL::Polyhedron_3<Gt,I,HDS,A>& ncp = const_cast<CGAL::Polyhedron_3<Gt,I,HDS,A>&>(p);
+
+  return typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, boost::halfedge_external_index_t >::const_type(
+    ncp.halfedges_begin(), ncp.halfedges_end(), ncp.size_of_halfedges());
+}
+
+template<class Gt, class I, CGAL_HDS_PARAM_, class A>
+typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, boost::vertex_external_index_t >::const_type
+get(boost::vertex_external_index_t, CGAL::Polyhedron_3<Gt,I,HDS,A> const& p)
+{
+  CGAL::Polyhedron_3<Gt,I,HDS,A>& ncp = const_cast<CGAL::Polyhedron_3<Gt,I,HDS,A>&>(p);
+
+  return typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, boost::vertex_external_index_t >::const_type(
+    ncp.vertices_begin(), ncp.vertices_end(), ncp.size_of_vertices());
+}
+
+template<class Gt, class I, CGAL_HDS_PARAM_, class A>
+typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, boost::face_external_index_t >::const_type
+get(boost::face_external_index_t, CGAL::Polyhedron_3<Gt,I,HDS,A> const& p)
+{
+  CGAL::Polyhedron_3<Gt,I,HDS,A>& ncp = const_cast<CGAL::Polyhedron_3<Gt,I,HDS,A>&>(p);
+
+  return typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, boost::face_external_index_t >::const_type(
+    ncp.facets_begin(), ncp.facets_end(), ncp.size_of_facets());
+}
+
+// the same blurb for non-const
+
+template<class Gt, class I, CGAL_HDS_PARAM_, class A>
+typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, boost::edge_external_index_t >::type
+get(boost::edge_external_index_t, CGAL::Polyhedron_3<Gt,I,HDS,A>& p)
+{
+  return typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, boost::edge_external_index_t >::type(
+    p);
+}
+
+template<class Gt, class I, CGAL_HDS_PARAM_, class A>
+typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, boost::halfedge_external_index_t >::type
+get(boost::halfedge_external_index_t, CGAL::Polyhedron_3<Gt,I,HDS,A> & ncp)
+{
+  return typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, boost::halfedge_external_index_t >::type(
+    ncp.halfedges_begin(), ncp.halfedges_end(), ncp.size_of_halfedges());
+}
+
+template<class Gt, class I, CGAL_HDS_PARAM_, class A>
+typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, boost::vertex_external_index_t >::type
+get(boost::vertex_external_index_t, CGAL::Polyhedron_3<Gt,I,HDS,A> & ncp)
+{
+  return typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, boost::vertex_external_index_t >::type(
+    ncp.vertices_begin(), ncp.vertices_end(), ncp.size_of_vertices());
+}
+
+
+template<class Gt, class I, CGAL_HDS_PARAM_, class A>
+typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, boost::face_external_index_t >::type
+get(boost::face_external_index_t, CGAL::Polyhedron_3<Gt,I,HDS,A> & ncp)
+{
+  return typename boost::property_map< CGAL::Polyhedron_3<Gt,I,HDS,A>, boost::face_external_index_t >::type(
+    ncp.facets_begin(), ncp.facets_end(), ncp.size_of_facets());
+}
+
+
+
+} // namespace CGAL
+
+
+namespace boost {
+
+// property_map dispatcher into Polyhedron
+template<class Gt, class I, CGAL_HDS_PARAM_, class A, class Tag>
+struct property_map<CGAL::Polyhedron_3<Gt,I,HDS,A>, Tag>
+{
+  typedef typename CGAL::Polyhedron_property_map<Tag>::
+      template bind_<Gt,I,HDS,A> map_gen;
+  typedef typename map_gen::type       type;
+  typedef typename map_gen::const_type const_type;
+};
+
+// property_map dispatcher into const Polyhedron
+template<class Gt, class I, CGAL_HDS_PARAM_, class A, class Tag>
+struct property_map<const CGAL::Polyhedron_3<Gt,I,HDS,A>, Tag>
+{
+  typedef typename CGAL::Polyhedron_property_map<Tag>::
+      template bind_<Gt,I,HDS,A> map_gen;
+  typedef typename map_gen::type       type;
+  typedef typename map_gen::const_type const_type;
+};
+
+// What are those needed for ???
+template<class Gt, class I, CGAL_HDS_PARAM_, class A>
+struct edge_property_type<CGAL::Polyhedron_3<Gt,I,HDS,A> >
+{
+  typedef edge_weight_t type;
+};
+
+template<class Gt, class I, CGAL_HDS_PARAM_, class A>
+struct vertex_property_type<CGAL::Polyhedron_3<Gt,I,HDS,A> >
+{
+  typedef CGAL::vertex_point_t type;
+};
+
+template<class Gt, class I, CGAL_HDS_PARAM_, class A>
+struct vertex_property_type<const CGAL::Polyhedron_3<Gt,I,HDS,A> >
+{
+  typedef CGAL::vertex_point_t type;
+};
+} // namespace boost
+
+
+#undef CGAL_HDS_PARAM_
+
+#endif // CGAL_BOOST_GRAPH_PROPERTIES_POLYHEDRON_3_H
diff --git a/3rdparty/CGAL/include/CGAL/boost/graph/properties_Surface_mesh.h b/3rdparty/CGAL/include/CGAL/boost/graph/properties_Surface_mesh.h
new file mode 100644
index 0000000..cf91c64
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/boost/graph/properties_Surface_mesh.h
@@ -0,0 +1,324 @@
+// Copyright (c) 2014  GeometryFactory (France).  All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Philipp Möller
+
+
+#ifndef CGAL_PROPERTIES_SURFACE_MESH_H
+#define CGAL_PROPERTIES_SURFACE_MESH_H
+
+#include <CGAL/assertions.h>
+#include <CGAL/Surface_mesh.h>
+#include <CGAL/Kernel_traits.h>
+#include <CGAL/squared_distance_3.h>
+#include <CGAL/number_utils.h>
+
+#include <CGAL/boost/graph/properties.h>
+
+#include <boost/cstdint.hpp>
+
+namespace CGAL {
+
+template <typename Point>
+class SM_edge_weight_pmap 
+  : public boost::put_get_helper<typename CGAL::Kernel_traits<Point>::type::FT, SM_edge_weight_pmap<Point> >
+{
+  typedef CGAL::Surface_mesh<Point> SM;
+public:
+  typedef boost::readable_property_map_tag                category;
+  typedef typename CGAL::Kernel_traits<Point>::type::FT   value_type;
+  typedef value_type                                      reference;
+  typedef typename SM::Edge_index                        key_type;
+
+  SM_edge_weight_pmap(const CGAL::Surface_mesh<Point>& sm)
+    : pm_(sm. template property_map<
+            typename SM::Vertex_index,
+            typename SM::Point >("v:point").first),
+      sm_(sm)
+    {}
+
+  value_type operator[](const key_type& e) const
+  {
+    return approximate_sqrt(CGAL::squared_distance(pm_[source(e, sm_)],
+                                                   pm_[target(e, sm_)]));
+  }
+
+private:
+   typename SM::template Property_map< typename SM::Vertex_index, 
+                                       typename SM::Point > pm_;
+  const SM& sm_;
+};
+
+
+template <typename K, typename VEF>
+class SM_index_pmap : public boost::put_get_helper<boost::uint32_t, SM_index_pmap<K,VEF> >
+{
+public:
+  typedef boost::readable_property_map_tag category;
+  typedef boost::uint32_t                  value_type;
+  typedef boost::uint32_t                  reference;
+  typedef VEF                              key_type;
+
+  value_type operator[](const key_type& vd) const
+  {
+    return vd;
+  }
+};
+
+} // CGAL
+
+// overloads and specializations in the boost namespace
+namespace boost {
+#if 1
+template <typename Point, typename T>
+struct property_map<CGAL::Surface_mesh<Point>, boost::vertex_property_t<T> >
+{
+  typedef CGAL::Surface_mesh<Point> SM;
+  typedef typename SM:: template Property_map<typename SM::vertex_index,T> type;
+  typedef type const_type;
+};
+
+
+#endif
+
+
+//
+// edge_weight
+//
+
+template <typename Point>
+struct property_map<CGAL::Surface_mesh<Point>, boost::edge_weight_t >
+{
+  typedef CGAL::SM_edge_weight_pmap<Point> type;
+  typedef CGAL::SM_edge_weight_pmap<Point> const_type;
+};
+}
+namespace CGAL{
+template <typename Point>
+typename boost::property_map<CGAL::Surface_mesh<Point>, boost::edge_weight_t>::const_type
+get(boost::edge_weight_t, const CGAL::Surface_mesh<Point>& sm)
+{
+  return CGAL::SM_edge_weight_pmap<Point>(sm);
+}
+
+// forward declarations, see <CGAL/Surface_mesh.h>
+class SM_Vertex_index;
+class SM_Edge_index;
+class SM_Halfedge_index;
+class SM_Face_index;
+
+template <typename Point>
+typename CGAL::Kernel_traits<Point>::type::FT
+get(boost::edge_weight_t, const CGAL::Surface_mesh<Point>& sm,
+    const SM_Edge_index& e)
+{
+  return CGAL::SM_edge_weight_pmap<Point>(sm)[e];
+}
+}
+//
+// vertex_index
+//
+
+namespace boost{
+template <typename Point>
+struct property_map<CGAL::Surface_mesh<Point>, boost::vertex_index_t >
+{
+  typedef CGAL::SM_index_pmap<Point, typename boost::graph_traits<CGAL::Surface_mesh<Point> >::vertex_descriptor> type;
+  typedef CGAL::SM_index_pmap<Point, typename boost::graph_traits<CGAL::Surface_mesh<Point> >::vertex_descriptor> const_type;
+};
+}
+namespace CGAL{
+
+template <typename Point>
+CGAL::SM_index_pmap<Point, SM_Vertex_index>
+get(const boost::vertex_index_t&, const CGAL::Surface_mesh<Point>&)
+{
+  return CGAL::SM_index_pmap<Point, typename boost::graph_traits<CGAL::Surface_mesh<Point> >::vertex_descriptor>();
+}
+}
+//
+// face_index
+//
+namespace boost{
+template <typename Point>
+struct property_map<CGAL::Surface_mesh<Point>, boost::face_index_t >
+{
+  typedef CGAL::SM_index_pmap<Point, typename boost::graph_traits<CGAL::Surface_mesh<Point> >::face_descriptor> type;
+  typedef CGAL::SM_index_pmap<Point, typename boost::graph_traits<CGAL::Surface_mesh<Point> >::face_descriptor> const_type;
+};
+}
+namespace CGAL{
+
+template <typename Point>
+CGAL::SM_index_pmap<Point, SM_Face_index>
+get(const boost::face_index_t&, const CGAL::Surface_mesh<Point>&)
+{
+  return CGAL::SM_index_pmap<Point, typename boost::graph_traits<CGAL::Surface_mesh<Point> >::face_descriptor>();
+}
+}
+//
+// edge_index
+//
+namespace boost{
+template <typename Point>
+struct property_map<CGAL::Surface_mesh<Point>, boost::edge_index_t >
+{
+  typedef CGAL::SM_index_pmap<Point, typename boost::graph_traits<CGAL::Surface_mesh<Point> >::edge_descriptor> type;
+  typedef CGAL::SM_index_pmap<Point, typename boost::graph_traits<CGAL::Surface_mesh<Point> >::edge_descriptor> const_type;
+};
+}
+namespace CGAL{
+template <typename Point>
+CGAL::SM_index_pmap<Point, SM_Edge_index>
+get(const boost::edge_index_t&, const CGAL::Surface_mesh<Point>&)
+{
+  return CGAL::SM_index_pmap<Point, typename boost::graph_traits<CGAL::Surface_mesh<Point> >::edge_descriptor>();
+}
+}
+//
+// halfedge_index
+//
+namespace boost{
+template <typename Point>
+struct property_map<CGAL::Surface_mesh<Point>, boost::halfedge_index_t >
+{
+  typedef CGAL::SM_index_pmap<Point, typename boost::graph_traits<CGAL::Surface_mesh<Point> >::halfedge_descriptor> type;
+  typedef CGAL::SM_index_pmap<Point, typename boost::graph_traits<CGAL::Surface_mesh<Point> >::halfedge_descriptor> const_type;
+};
+}
+namespace CGAL{
+
+template <typename Point>
+CGAL::SM_index_pmap<Point, SM_Halfedge_index>
+get(const boost::halfedge_index_t&, const CGAL::Surface_mesh<Point>&)
+{
+  return CGAL::SM_index_pmap<Point, typename boost::graph_traits<CGAL::Surface_mesh<Point> >::halfedge_descriptor>();
+}
+}
+//
+// vertex_point
+//
+namespace boost{
+template<typename P>
+struct property_map<CGAL::Surface_mesh<P>, CGAL::vertex_point_t >
+{
+  typedef CGAL::Surface_mesh<P> SM;
+
+  typedef typename
+    SM::template Property_map< typename SM::Vertex_index,
+                               P
+                               > type;
+
+  typedef type const_type;
+
+};
+}
+namespace CGAL{
+
+namespace internal {
+  template <typename Point>
+  struct Get_vertex_point_map_for_Surface_mesh_return_type {
+    typedef typename boost::property_map
+    <
+      CGAL::Surface_mesh<Point>,
+      CGAL::vertex_point_t
+      >::const_type type;
+  };
+} // end namespace internal
+
+template<typename Point>
+typename
+boost::lazy_disable_if
+<
+  boost::is_const<Point>,
+  internal::Get_vertex_point_map_for_Surface_mesh_return_type<Point>
+>::type
+get(CGAL::vertex_point_t, const CGAL::Surface_mesh<Point>& g) {
+  return g.points();
+}
+
+namespace internal {
+  template <typename Point>
+  struct Get_graph_traits_of_SM {
+    typedef boost::graph_traits< CGAL::Surface_mesh<Point> > type;
+  };
+} // end namespace internal
+
+// get for intrinsic properties
+#define CGAL_SM_INTRINSIC_PROPERTY(RET, PROP, TYPE)                     \
+ template<typename Point>                                              \
+ RET                                                                   \
+ get(PROP p, const CGAL::Surface_mesh<Point>& sm,                      \
+     const TYPE& x)                                                \
+ { return get(get(p, sm), x); }                                        \
+
+
+CGAL_SM_INTRINSIC_PROPERTY(boost::uint32_t, boost::vertex_index_t,
+SM_Vertex_index)
+CGAL_SM_INTRINSIC_PROPERTY(boost::uint32_t, boost::edge_index_t,
+SM_Edge_index)
+CGAL_SM_INTRINSIC_PROPERTY(boost::uint32_t, boost::halfedge_index_t,
+SM_Halfedge_index)
+CGAL_SM_INTRINSIC_PROPERTY(boost::uint32_t, boost::face_index_t,
+SM_Face_index)
+CGAL_SM_INTRINSIC_PROPERTY(Point&, CGAL::vertex_point_t, SM_Vertex_index)
+
+#undef CGAL_SM_INTRINSIC_PROPERTY
+
+// put for intrinsic properties
+// only available for vertex_point
+template<typename Point>
+void
+put(CGAL::vertex_point_t p, const CGAL::Surface_mesh<Point>& g,
+    typename boost::graph_traits< CGAL::Surface_mesh<Point> >::vertex_descriptor x,
+    const Point& point) {
+  typedef CGAL::Surface_mesh<Point> SM;
+  CGAL_assertion(g.is_valid(x));
+  typename SM::template Property_map< typename boost::graph_traits<SM>::vertex_descriptor,
+                    Point> prop = get(p, g);
+  prop[x] = point;
+}
+
+} // CGAL
+
+#if 0
+//
+namespace CGAL {
+template <typename Point, typename T>
+typename boost::property_map<CGAL::Surface_mesh<Point>, boost::vertex_property_t<T> >::const_type
+get(boost::vertex_property_t<T> vprop, const CGAL::Surface_mesh<Point>& sm)
+{
+  return sm.template get_property_map<typename CGAL::Surface_mesh<Point>::Vertex_index, T>(vprop.s).first;
+}
+
+template <typename Point, typename T>
+typename boost::property_map<CGAL::Surface_mesh<Point>, boost::vertex_property_t<T> >::const_type
+add(boost::vertex_property_t<T> vprop, CGAL::Surface_mesh<Point>& sm)
+{
+  return sm.template add_property_map<typename CGAL::Surface_mesh<Point>::Vertex_index, T>(vprop.s, vprop.t).first;
+}
+
+template <typename Pmap,typename P>
+void
+remove(Pmap pm, CGAL::Surface_mesh<P>& sm)
+{
+  return sm.remove_property_map(pm);
+}
+} // namespace CGAL
+#endif
+
+#endif /* CGAL_PROPERTIES_SURFACE_MESH_H */
diff --git a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/properties_TriMesh_ArrayKernelT.h b/3rdparty/CGAL/include/CGAL/boost/graph/properties_TriMesh_ArrayKernelT.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/boost/graph/properties_TriMesh_ArrayKernelT.h
rename to 3rdparty/CGAL/include/CGAL/boost/graph/properties_TriMesh_ArrayKernelT.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/selection.h b/3rdparty/CGAL/include/CGAL/boost/graph/selection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/boost/graph/selection.h
rename to 3rdparty/CGAL/include/CGAL/boost/graph/selection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/split_graph_into_polylines.h b/3rdparty/CGAL/include/CGAL/boost/graph/split_graph_into_polylines.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/boost/graph/split_graph_into_polylines.h
rename to 3rdparty/CGAL/include/CGAL/boost/graph/split_graph_into_polylines.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/boost/graph/visitor.h b/3rdparty/CGAL/include/CGAL/boost/graph/visitor.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/boost/graph/visitor.h
rename to 3rdparty/CGAL/include/CGAL/boost/graph/visitor.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/boost/iterator/counting_iterator.hpp b/3rdparty/CGAL/include/CGAL/boost/iterator/counting_iterator.hpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/boost/iterator/counting_iterator.hpp
rename to 3rdparty/CGAL/include/CGAL/boost/iterator/counting_iterator.hpp
diff --git a/3rdparty/CGAL-4.8/include/CGAL/boost/iterator/transform_iterator.hpp b/3rdparty/CGAL/include/CGAL/boost/iterator/transform_iterator.hpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/boost/iterator/transform_iterator.hpp
rename to 3rdparty/CGAL/include/CGAL/boost/iterator/transform_iterator.hpp
diff --git a/3rdparty/CGAL-4.8/include/CGAL/bounding_box.h b/3rdparty/CGAL/include/CGAL/bounding_box.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/bounding_box.h
rename to 3rdparty/CGAL/include/CGAL/bounding_box.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/box_intersection_d.h b/3rdparty/CGAL/include/CGAL/box_intersection_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/box_intersection_d.h
rename to 3rdparty/CGAL/include/CGAL/box_intersection_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/cartesian_homogeneous_conversion.h b/3rdparty/CGAL/include/CGAL/cartesian_homogeneous_conversion.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/cartesian_homogeneous_conversion.h
rename to 3rdparty/CGAL/include/CGAL/cartesian_homogeneous_conversion.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/centroid.h b/3rdparty/CGAL/include/CGAL/centroid.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/centroid.h
rename to 3rdparty/CGAL/include/CGAL/centroid.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/certified_numeric_predicates.h b/3rdparty/CGAL/include/CGAL/certified_numeric_predicates.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/certified_numeric_predicates.h
rename to 3rdparty/CGAL/include/CGAL/certified_numeric_predicates.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/certified_quotient_predicates.h b/3rdparty/CGAL/include/CGAL/certified_quotient_predicates.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/certified_quotient_predicates.h
rename to 3rdparty/CGAL/include/CGAL/certified_quotient_predicates.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/ch_akl_toussaint.h b/3rdparty/CGAL/include/CGAL/ch_akl_toussaint.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/ch_akl_toussaint.h
rename to 3rdparty/CGAL/include/CGAL/ch_akl_toussaint.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/ch_bykat.h b/3rdparty/CGAL/include/CGAL/ch_bykat.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/ch_bykat.h
rename to 3rdparty/CGAL/include/CGAL/ch_bykat.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/ch_eddy.h b/3rdparty/CGAL/include/CGAL/ch_eddy.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/ch_eddy.h
rename to 3rdparty/CGAL/include/CGAL/ch_eddy.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/ch_function_objects_2.h b/3rdparty/CGAL/include/CGAL/ch_function_objects_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/ch_function_objects_2.h
rename to 3rdparty/CGAL/include/CGAL/ch_function_objects_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/ch_graham_andrew.h b/3rdparty/CGAL/include/CGAL/ch_graham_andrew.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/ch_graham_andrew.h
rename to 3rdparty/CGAL/include/CGAL/ch_graham_andrew.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/ch_jarvis.h b/3rdparty/CGAL/include/CGAL/ch_jarvis.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/ch_jarvis.h
rename to 3rdparty/CGAL/include/CGAL/ch_jarvis.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/ch_melkman.h b/3rdparty/CGAL/include/CGAL/ch_melkman.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/ch_melkman.h
rename to 3rdparty/CGAL/include/CGAL/ch_melkman.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/ch_selected_extreme_points_2.h b/3rdparty/CGAL/include/CGAL/ch_selected_extreme_points_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/ch_selected_extreme_points_2.h
rename to 3rdparty/CGAL/include/CGAL/ch_selected_extreme_points_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/circulator.h b/3rdparty/CGAL/include/CGAL/circulator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/circulator.h
rename to 3rdparty/CGAL/include/CGAL/circulator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/circulator_bases.h b/3rdparty/CGAL/include/CGAL/circulator_bases.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/circulator_bases.h
rename to 3rdparty/CGAL/include/CGAL/circulator_bases.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/compare_vertices.h b/3rdparty/CGAL/include/CGAL/compare_vertices.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/compare_vertices.h
rename to 3rdparty/CGAL/include/CGAL/compare_vertices.h
diff --git a/3rdparty/CGAL/include/CGAL/compute_average_spacing.h b/3rdparty/CGAL/include/CGAL/compute_average_spacing.h
new file mode 100644
index 0000000..b550574
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/compute_average_spacing.h
@@ -0,0 +1,258 @@
+// Copyright (c) 2007-09  INRIA Sophia-Antipolis (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
+// 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(s) : Pierre Alliez and Laurent Saboret
+
+#ifndef CGAL_AVERAGE_SPACING_3_H
+#define CGAL_AVERAGE_SPACING_3_H
+
+#include <CGAL/Search_traits_3.h>
+#include <CGAL/squared_distance_3.h>
+#include <CGAL/Orthogonal_k_neighbor_search.h>
+#include <CGAL/property_map.h>
+#include <CGAL/point_set_processing_assertions.h>
+#include <CGAL/assertions.h>
+
+#include <iterator>
+#include <list>
+
+#ifdef CGAL_LINKED_WITH_TBB
+#include <tbb/parallel_for.h>
+#include <tbb/blocked_range.h>
+#include <tbb/scalable_allocator.h>  
+#endif // CGAL_LINKED_WITH_TBB
+
+namespace CGAL {
+
+
+// ----------------------------------------------------------------------------
+// Private section
+// ----------------------------------------------------------------------------
+/// \cond SKIP_IN_MANUAL
+namespace internal {
+
+
+/// Computes average spacing of one query point from K nearest neighbors.
+///
+/// \pre `k >= 2`.
+///
+/// @tparam Kernel Geometric traits class.
+/// @tparam Tree KD-tree.
+///
+/// @return average spacing (scalar).
+template < typename Kernel,
+           typename Tree >
+typename Kernel::FT
+compute_average_spacing(const typename Kernel::Point_3& query, ///< 3D point whose spacing we want to compute
+                        const Tree& tree,                      ///< KD-tree
+                        unsigned int k)                        ///< number of neighbors
+{
+  // basic geometric types
+  typedef typename Kernel::FT FT;
+  typedef typename Kernel::Point_3 Point;
+
+  // types for K nearest neighbors search
+  typedef Search_traits_3<Kernel> Tree_traits;
+  typedef Orthogonal_k_neighbor_search<Tree_traits> Neighbor_search;
+  typedef typename Neighbor_search::iterator Search_iterator;
+
+  // performs k + 1 queries (if unique the query point is
+  // output first). search may be aborted when k is greater
+  // than number of input points
+  Neighbor_search search(tree,query,k+1);
+  Search_iterator search_iterator = search.begin();
+  FT sum_distances = (FT)0.0;
+  unsigned int i;
+  for(i=0;i<(k+1);i++)
+  {
+    if(search_iterator == search.end())
+      break; // premature ending
+
+    Point p = search_iterator->first;
+    sum_distances += std::sqrt(CGAL::squared_distance(query,p));
+    search_iterator++;
+  }
+
+  // output average spacing
+  return sum_distances / (FT)i;
+}
+
+
+#ifdef CGAL_LINKED_WITH_TBB
+  template <typename Kernel, typename Tree>
+  class Compute_average_spacings {
+    typedef typename Kernel::Point_3 Point;
+    typedef typename Kernel::FT FT;
+    const Tree& tree;
+    const unsigned int k;
+    const std::vector<Point>& input;
+    std::vector<FT>& output;
+
+  public:
+    Compute_average_spacings(Tree& tree, unsigned int k, std::vector<Point>& points,
+			     std::vector<FT>& output)
+      : tree(tree), k (k), input (points), output (output)
+    { }
+    
+    void operator()(const tbb::blocked_range<std::size_t>& r) const
+    {
+      for( std::size_t i = r.begin(); i != r.end(); ++i)
+	output[i] = CGAL::internal::compute_average_spacing<Kernel,Tree>(input[i], tree, k);
+    }
+
+  };
+#endif // CGAL_LINKED_WITH_TBB
+
+} /* namespace internal */
+/// \endcond
+
+
+
+// ----------------------------------------------------------------------------
+// Public section
+// ----------------------------------------------------------------------------
+
+/// \ingroup PkgPointSetProcessing
+/// Computes average spacing from k nearest neighbors.
+///
+/// \pre `k >= 2.`
+///
+/// @tparam Concurrency_tag enables sequential versus parallel algorithm.
+///                         Possible values are `Sequential_tag`
+///                         and `Parallel_tag`.
+/// @tparam InputIterator iterator over input points.
+/// @tparam PointPMap is a model of `ReadablePropertyMap` with value type `Point_3<Kernel>`.
+///        It can be omitted if the value type of `InputIterator`  is convertible to `Point_3<Kernel>`.
+/// @tparam Kernel Geometric traits class.
+///        It can be omitted and deduced automatically from the value type of `PointPMap`.
+///
+/// @return average spacing (scalar).
+
+// This variant requires the kernel.
+template <typename Concurrency_tag,
+	  typename InputIterator,
+          typename PointPMap,
+          typename Kernel
+>
+typename Kernel::FT
+compute_average_spacing(
+  InputIterator first,  ///< iterator over the first input point.
+  InputIterator beyond, ///< past-the-end iterator over the input points.
+  PointPMap point_pmap, ///< property map: value_type of InputIterator -> Point_3
+  unsigned int k, ///< number of neighbors.
+  const Kernel& /*kernel*/) ///< geometric traits.
+{
+  // basic geometric types
+  typedef typename Kernel::Point_3 Point;
+
+  // types for K nearest neighbors search structure
+  typedef typename Kernel::FT FT;
+  typedef Search_traits_3<Kernel> Tree_traits;
+  typedef Orthogonal_k_neighbor_search<Tree_traits> Neighbor_search;
+  typedef typename Neighbor_search::Tree Tree;
+
+  // precondition: at least one element in the container.
+  // to fix: should have at least three distinct points
+  // but this is costly to check
+  CGAL_point_set_processing_precondition(first != beyond);
+
+  // precondition: at least 2 nearest neighbors
+  CGAL_point_set_processing_precondition(k >= 2);
+
+  // Instanciate a KD-tree search.
+  // Note: We have to convert each input iterator to Point_3.
+  std::vector<Point> kd_tree_points; 
+  for(InputIterator it = first; it != beyond; it++)
+    kd_tree_points.push_back(get(point_pmap, *it));
+  Tree tree(kd_tree_points.begin(), kd_tree_points.end());
+
+  // iterate over input points, compute and output normal
+  // vectors (already normalized)
+  FT sum_spacings = (FT)0.0;
+
+#ifndef CGAL_LINKED_WITH_TBB
+  CGAL_static_assertion_msg (!(boost::is_convertible<Concurrency_tag, Parallel_tag>::value),
+			     "Parallel_tag is enabled but TBB is unavailable.");
+#else
+   if (boost::is_convertible<Concurrency_tag,Parallel_tag>::value)
+   {
+     std::vector<FT> spacings (kd_tree_points.size ());
+     CGAL::internal::Compute_average_spacings<Kernel, Tree>
+       f (tree, k, kd_tree_points, spacings);
+     tbb::parallel_for(tbb::blocked_range<size_t>(0, kd_tree_points.size ()), f);
+     for (unsigned int i = 0; i < spacings.size (); ++ i)
+       sum_spacings += spacings[i];
+   }
+   else
+#endif
+     {
+       for(InputIterator it = first; it != beyond; it++)
+	 {
+	   sum_spacings += internal::compute_average_spacing<Kernel,Tree>(
+									  get(point_pmap,*it),
+									  tree,k);
+	 }
+     }
+   
+  // return average spacing
+   return sum_spacings / (FT)(kd_tree_points.size ());
+}
+
+/// @cond SKIP_IN_MANUAL
+// This variant deduces the kernel from the iterator type.
+template <typename Concurrency_tag,
+	  typename InputIterator,
+          typename PointPMap
+>
+typename Kernel_traits<typename boost::property_traits<PointPMap>::value_type>::Kernel::FT
+compute_average_spacing(
+  InputIterator first,    ///< iterator over the first input point.
+  InputIterator beyond,   ///< past-the-end iterator over the input points.
+  PointPMap point_pmap, ///< property map: value_type of InputIterator -> Point_3
+  unsigned int k) ///< number of neighbors
+{
+  typedef typename boost::property_traits<PointPMap>::value_type Point;
+  typedef typename Kernel_traits<Point>::Kernel Kernel;
+  return compute_average_spacing<Concurrency_tag>(
+    first,beyond,
+    point_pmap,
+    k,
+    Kernel());
+}
+/// @endcond
+
+/// @cond SKIP_IN_MANUAL
+// This variant creates a default point property map = Identity_property_map.
+template < typename Concurrency_tag, typename InputIterator >
+typename Kernel_traits<typename std::iterator_traits<InputIterator>::value_type>::Kernel::FT
+compute_average_spacing(
+  InputIterator first,    ///< iterator over the first input point.
+  InputIterator beyond,   ///< past-the-end iterator over the input points.
+  unsigned int k) ///< number of neighbors.
+{
+  return compute_average_spacing<Concurrency_tag>(
+    first,beyond,
+    make_identity_property_map(
+    typename std::iterator_traits<InputIterator>::value_type()),
+    k);
+}
+/// @endcond
+
+
+} //namespace CGAL
+
+#endif // CGAL_AVERAGE_SPACING_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/compute_outer_frame_margin.h b/3rdparty/CGAL/include/CGAL/compute_outer_frame_margin.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/compute_outer_frame_margin.h
rename to 3rdparty/CGAL/include/CGAL/compute_outer_frame_margin.h
diff --git a/3rdparty/CGAL/include/CGAL/config.h b/3rdparty/CGAL/include/CGAL/config.h
new file mode 100644
index 0000000..0e960f5
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/config.h
@@ -0,0 +1,536 @@
+// Copyright (c) 1997-2013
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved. 
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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(s)     : Wieger Wesselink 
+//                 Michael Hoffmann <hoffmann at inf.ethz.ch>
+//                 Sylvain Pion
+//                 Laurent Rineau
+
+#ifndef CGAL_CONFIG_H
+#define CGAL_CONFIG_H
+
+#ifdef CGAL_HEADER_ONLY
+#  define CGAL_NO_AUTOLINK 1
+#endif
+
+// Workaround for a bug in Boost, that checks WIN64 instead of _WIN64
+//   https://svn.boost.org/trac/boost/ticket/5519
+#if defined(_WIN64) && ! defined(WIN64)
+#  define WIN64
+#endif
+
+#ifdef CGAL_INCLUDE_WINDOWS_DOT_H
+// Mimic users including this file which defines min max macros
+// and other names leading to name clashes
+#include <windows.h>
+#endif
+
+#if defined(CGAL_TEST_SUITE) && defined(NDEBUG)
+#  error The test-suite needs no NDEBUG defined
+#endif // CGAL_TEST_SUITE and NDEBUG
+
+// See [[Small features/Visual_Leak_Detector]] in CGAL developers wiki
+// See also: http://vld.codeplex.com/
+#if defined(CGAL_ENABLE_VLD)
+#  include <vld.h>
+#endif // CGAL_ENABLE_VLD
+
+// Workaround to the following bug:
+// https://bugreports.qt-project.org/browse/QTBUG-22829
+#ifdef Q_MOC_RUN
+// When Qt moc runs on CGAL files, do not process
+// <boost/type_traits/has_operator.hpp>
+#  define BOOST_TT_HAS_OPERATOR_HPP_INCLUDED
+#  define BOOST_TT_HAS_BIT_AND_ASSIGN_HPP_INCLUDED
+#  define BOOST_TT_HAS_BIT_OR_HPP_INCLUDED
+#  define BOOST_TT_HAS_BIT_OR_ASSIGN_HPP_INCLUDED
+#  define BOOST_TT_HAS_BIT_XOR_HPP_INCLUDED
+#  define BOOST_TT_HAS_BIT_XOR_ASSIGN_HPP_INCLUDED
+#  define BOOST_TT_HAS_DIVIDES_HPP_INCLUDED
+#  define BOOST_TT_HAS_DIVIDES_ASSIGN_HPP_INCLUDED
+#  define BOOST_TT_HAS_EQUAL_TO_HPP_INCLUDED
+#  define BOOST_TT_HAS_GREATER_HPP_INCLUDED
+#  define BOOST_TT_HAS_GREATER_EQUAL_HPP_INCLUDED
+#  define BOOST_TT_HAS_LEFT_SHIFT_HPP_INCLUDED
+#  define BOOST_TT_HAS_LEFT_SHIFT_ASSIGN_HPP_INCLUDED
+#  define BOOST_TT_HAS_LESS_HPP_INCLUDED
+#  define BOOST_TT_HAS_LESS_EQUAL_HPP_INCLUDED
+#  define BOOST_TT_HAS_LOGICAL_AND_HPP_INCLUDED
+#  define BOOST_TT_HAS_LOGICAL_OR_HPP_INCLUDED
+#  define BOOST_TT_HAS_MINUS_HPP_INCLUDED
+#  define BOOST_TT_HAS_MINUS_ASSIGN_HPP_INCLUDED
+#  define BOOST_TT_HAS_MODULUS_HPP_INCLUDED
+#  define BOOST_TT_HAS_MODULUS_ASSIGN_HPP_INCLUDED
+#  define BOOST_TT_HAS_MULTIPLIES_HPP_INCLUDED
+#  define BOOST_TT_HAS_MULTIPLIES_ASSIGN_HPP_INCLUDED
+#  define BOOST_TT_HAS_NOT_EQUAL_TO_HPP_INCLUDED
+#  define BOOST_TT_HAS_PLUS_HPP_INCLUDED
+#  define BOOST_TT_HAS_PLUS_ASSIGN_HPP_INCLUDED
+#  define BOOST_TT_HAS_RIGHT_SHIFT_HPP_INCLUDED
+#  define BOOST_TT_HAS_RIGHT_SHIFT_ASSIGN_HPP_INCLUDED
+// do not include <boost/random.hpp> either
+// it includes <boost/type_traits/has_binary_operator.hpp>
+#  define BOOST_RANDOM_HPP
+#endif
+
+// The following header file defines among other things  BOOST_PREVENT_MACRO_SUBSTITUTION 
+#include <boost/config.hpp>
+#include <boost/version.hpp>
+
+// bug-fix for g++-5.x and Boost.Config<1.57
+//    https://svn.boost.org/trac/boost/ticket/10500
+#if BOOST_VERSION < 105700 && BOOST_GCC < 60000 && \
+  ! defined(__GXX_EXPERIMENTAL_CXX0X__) && defined(BOOST_HAS_VARIADIC_TMPL)
+#  undef BOOST_HAS_VARIADIC_TMPL
+#  define BOOST_NO_CXX11_VARIADIC_TEMPLATES
+#endif
+
+#include <CGAL/version.h>
+
+//----------------------------------------------------------------------//
+//  platform specific workaround flags (CGAL_CFG_...)
+//----------------------------------------------------------------------//
+
+#include <CGAL/compiler_config.h>
+
+//----------------------------------------------------------------------//
+//  Support for DLL on Windows (CGAL_EXPORT macro)
+//----------------------------------------------------------------------//
+
+#include <CGAL/export/CGAL.h>
+
+//----------------------------------------------------------------------//
+//  Use an implementation of fabs with sse2 on Windows
+//----------------------------------------------------------------------//
+
+#if (_M_IX86_FP >= 2) || defined(_M_X64)
+#define CGAL_USE_SSE2_FABS
+#endif
+
+//----------------------------------------------------------------------//
+//  Detect features at compile-time. Some macros have only been
+//  introduced as of Boost 1.40. In that case, we simply say that the
+//  feature is not available, even if that is wrong.
+//  ----------------------------------------------------------------------//
+
+#if defined(BOOST_NO_CXX11_RANGE_BASED_FOR) || BOOST_VERSION < 105000
+#define CGAL_CFG_NO_CPP0X_RANGE_BASED_FOR 1
+#endif
+#if defined(BOOST_NO_0X_HDR_ARRAY) || \
+    defined(BOOST_NO_CXX11_HDR_ARRAY) || BOOST_VERSION < 104000
+#define CGAL_CFG_NO_CPP0X_ARRAY 1
+#endif
+#if defined(BOOST_NO_DECLTYPE) || \
+    defined(BOOST_NO_CXX11_DECLTYPE) || (BOOST_VERSION < 103600)
+#define CGAL_CFG_NO_CPP0X_DECLTYPE 1
+#endif
+#if defined(BOOST_NO_DELETED_FUNCTIONS) || \
+    defined(BOOST_NO_DEFAULTED_FUNCTIONS) || \
+    defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) || \
+    defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) || (BOOST_VERSION < 103600)
+#define CGAL_CFG_NO_CPP0X_DELETED_AND_DEFAULT_FUNCTIONS 1
+#endif
+#if defined(BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS) || \
+    defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) || \
+    (BOOST_VERSION < 104100)
+#define CGAL_CFG_NO_CPP0X_DEFAULT_TEMPLATE_ARGUMENTS_FOR_FUNCTION_TEMPLATES 1
+#endif
+#if defined(BOOST_NO_INITIALIZER_LISTS) || \
+    defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) || (BOOST_VERSION < 103900)
+#define CGAL_CFG_NO_CPP0X_INITIALIZER_LISTS 1
+#endif
+#if defined(BOOST_MSVC)
+#define CGAL_CFG_NO_CPP0X_ISFINITE 1 // used in <CGAL/CORE/Filter.h>
+#endif
+#if defined(BOOST_NO_LONG_LONG) || (BOOST_VERSION < 103600)
+#define CGAL_CFG_NO_CPP0X_LONG_LONG 1
+#endif
+#if defined(BOOST_NO_LAMBDAS) || \
+    defined(BOOST_NO_CXX11_LAMBDAS) || BOOST_VERSION < 104000
+#define CGAL_CFG_NO_CPP0X_LAMBDAS 1
+#endif
+#if defined(BOOST_NO_RVALUE_REFERENCES) || \
+    defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || (BOOST_VERSION < 103600)
+#define CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE 1
+#endif
+#if defined(BOOST_NO_STATIC_ASSERT) || \
+    defined(BOOST_NO_CXX11_STATIC_ASSERT) || (BOOST_VERSION < 103600)
+#define CGAL_CFG_NO_CPP0X_STATIC_ASSERT 1
+#endif
+#if defined(BOOST_NO_0X_HDR_TUPLE) || \
+    defined(BOOST_NO_CXX11_HDR_TUPLE) || (BOOST_VERSION < 104000)
+#define CGAL_CFG_NO_CPP0X_TUPLE 1
+#endif
+#if defined(BOOST_NO_VARIADIC_TEMPLATES) || \
+    defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || (BOOST_VERSION < 103600)
+#define CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES 1
+#endif
+// never use TR1
+#define CGAL_CFG_NO_TR1_ARRAY 1
+// never use TR1
+#define CGAL_CFG_NO_TR1_TUPLE 1
+#if !defined(__GNUC__) || defined(__INTEL_COMPILER)
+#define CGAL_CFG_NO_STATEMENT_EXPRESSIONS 1
+#endif
+#if defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) || (BOOST_VERSION < 105100) || _MSC_VER==1800
+#define CGAL_CFG_NO_CPP0X_UNIFIED_INITIALIZATION_SYNTAX
+#endif
+#if __cplusplus < 201103L && !(_MSC_VER >= 1600)
+#define CGAL_CFG_NO_CPP0X_COPY_N 1
+#define CGAL_CFG_NO_CPP0X_NEXT_PREV 1
+#endif
+#if defined(BOOST_NO_EXPLICIT_CONVERSION_OPERATIONS) \
+    || defined(BOOST_NO_EXPLICIT_CONVERSION_OPERATORS) \
+    || defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS) \
+    || (BOOST_VERSION < 103600)
+#define CGAL_CFG_NO_CPP0X_EXPLICIT_CONVERSION_OPERATORS 1
+#endif
+
+// Some random list to let us write C++11 without thinking about
+// each feature we are using.
+#if __cplusplus >= 201103L && \
+    !defined CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES && \
+    !defined CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE && \
+    !defined CGAL_CFG_NO_CPP0X_EXPLICIT_CONVERSION_OPERATORS && \
+    !defined CGAL_CFG_NO_CPP0X_TUPLE && \
+    !defined CGAL_CFG_NO_CPP0X_UNIFIED_INITIALIZATION_SYNTAX && \
+    !defined CGAL_CFG_NO_CPP0X_STATIC_ASSERT && \
+    !defined CGAL_CFG_NO_CPP0X_DECLTYPE && \
+    !defined CGAL_CFG_NO_CPP0X_DELETED_AND_DEFAULT_FUNCTIONS && \
+    !defined CGAL_CFG_NO_CPP0X_DEFAULT_TEMPLATE_ARGUMENTS_FOR_FUNCTION_TEMPLATES
+#define CGAL_CXX11
+#endif
+
+#if defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) || BOOST_VERSION < 105000
+#define CGAL_CFG_NO_STD_HASH 1
+#endif
+
+//----------------------------------------------------------------------//
+//  auto-link the CGAL library on platforms that support it
+//----------------------------------------------------------------------//
+
+#include <CGAL/auto_link/CGAL.h>
+
+//----------------------------------------------------------------------//
+//  do some post processing for the flags
+//----------------------------------------------------------------------//
+
+#ifdef CGAL_CFG_NO_STL
+#  error "This compiler does not have a working STL"
+#endif
+
+// This macro computes the version number from an x.y.z release number.
+// It only works for public releases.
+#define CGAL_VERSION_NUMBER(x,y,z) (1000001 + 10000*x + 100*y + 10*z) * 1000
+
+#ifndef CGAL_NO_DEPRECATED_CODE
+#define CGAL_BEGIN_NAMESPACE  namespace CGAL { 
+#define CGAL_END_NAMESPACE }
+#endif
+
+
+#ifndef CGAL_CFG_NO_CPP0X_LONG_LONG
+#  define CGAL_USE_LONG_LONG
+#endif
+
+
+#ifndef CGAL_CFG_TYPENAME_BEFORE_DEFAULT_ARGUMENT_BUG
+#  define CGAL_TYPENAME_DEFAULT_ARG typename
+#else
+#  define CGAL_TYPENAME_DEFAULT_ARG
+#endif
+
+
+#ifdef CGAL_CFG_NO_CPP0X_DELETED_AND_DEFAULT_FUNCTIONS
+#  define CGAL_DELETED
+#  define CGAL_EXPLICITLY_DEFAULTED
+#else
+#  define CGAL_DELETED = delete
+#  define CGAL_EXPLICITLY_DEFAULTED = default
+#endif
+
+
+// Big endian or little endian machine.
+// ====================================
+
+#if (BOOST_VERSION >= 105500)
+#  include <boost/predef.h>
+#  if BOOST_ENDIAN_BIG_BYTE
+#    define CGAL_BIG_ENDIAN
+#  elif BOOST_ENDIAN_LITTLE_BYTE
+#    define CGAL_LITTLE_ENDIAN
+#  else
+#    error Unknown endianness
+#  endif
+#elif defined (__GLIBC__)
+#  include <endian.h>
+#  if (__BYTE_ORDER == __LITTLE_ENDIAN)
+#    define CGAL_LITTLE_ENDIAN
+#  elif (__BYTE_ORDER == __BIG_ENDIAN)
+#    define CGAL_BIG_ENDIAN
+#  else
+#    error Unknown endianness
+#  endif
+#elif defined(__sparc) || defined(__sparc__) \
+   || defined(_POWER) || defined(__powerpc__) \
+   || defined(__ppc__) || defined(__hppa) \
+   || defined(_MIPSEB) || defined(_POWER) \
+   || defined(__s390__)
+#  define CGAL_BIG_ENDIAN
+#elif defined(__i386__) || defined(__alpha__) \
+   || defined(__x86_64) || defined(__x86_64__) \
+   || defined(__ia64) || defined(__ia64__) \
+   || defined(_M_IX86) || defined(_M_IA64) \
+   || defined(_M_ALPHA) || defined(_WIN64)
+#  define CGAL_LITTLE_ENDIAN
+#else
+#  error Unknown endianness
+#endif
+
+
+// Symbolic constants to tailor inlining. Inlining Policy.
+// =======================================================
+#ifndef CGAL_MEDIUM_INLINE
+#  define CGAL_MEDIUM_INLINE inline
+#endif
+
+#ifndef CGAL_LARGE_INLINE
+#  define CGAL_LARGE_INLINE
+#endif
+
+#ifndef CGAL_HUGE_INLINE
+#  define CGAL_HUGE_INLINE
+#endif
+
+
+//----------------------------------------------------------------------//
+// SunPRO specific.
+//----------------------------------------------------------------------//
+#ifdef __SUNPRO_CC
+#  include <iterator>
+#  ifdef _RWSTD_NO_CLASS_PARTIAL_SPEC
+#    error "CGAL does not support SunPRO with the old Rogue Wave STL: use STLPort."
+#  endif
+#endif
+
+#ifdef __SUNPRO_CC
+// SunPRO 5.9 emits warnings "The variable tag has not yet been assigned a value"
+// even for empty "tag" variables.  No way to write a config/testfile for this.
+#  define CGAL_SUNPRO_INITIALIZE(C) C
+#else
+#  define CGAL_SUNPRO_INITIALIZE(C)
+#endif
+
+//----------------------------------------------------------------------//
+// MacOSX specific.
+//----------------------------------------------------------------------//
+
+#ifdef __APPLE__
+#  if defined(__GNUG__) && (__GNUG__ == 4) && (__GNUC_MINOR__ == 0) \
+   && defined(__OPTIMIZE__) && !defined(CGAL_NO_WARNING_FOR_MACOSX_GCC_4_0_BUG)
+#    warning "Your configuration may exhibit run-time errors in CGAL code"
+#    warning "This appears with g++ 4.0 on MacOSX when optimizing"
+#    warning "You can disable this warning using -DCGAL_NO_WARNING_FOR_MACOSX_GCC_4_0_BUG"
+#    warning "For more information, see http://www.cgal.org/FAQ.html#mac_optimization_bug"
+#  endif
+#endif
+
+//-------------------------------------------------------------------//
+// When the global min and max are no longer defined (as macros) 
+// because of NOMINMAX flag definition, we define our own global 
+// min/max functions to make the Microsoft headers compile. (afxtempl.h)
+// Users that does not want the global min/max 
+// should define CGAL_NOMINMAX
+//-------------------------------------------------------------------//
+#include <algorithm>
+#if defined NOMINMAX && !defined CGAL_NOMINMAX
+using std::min;
+using std::max;
+#endif
+
+//-------------------------------------------------------------------//
+// Is Geomview usable ?
+#if !defined(_MSC_VER) && !defined(__MINGW32__)
+#  define CGAL_USE_GEOMVIEW
+#endif
+
+
+//-------------------------------------------------------------------//
+// Compilers provide different macros to access the current function name
+#ifdef _MSC_VER
+#  define CGAL_PRETTY_FUNCTION __FUNCSIG__
+#elif defined __GNUG__
+#  define CGAL_PRETTY_FUNCTION __PRETTY_FUNCTION__
+#else 
+#  define CGAL_PRETTY_FUNCTION __func__
+// with sunpro, this requires -features=extensions
+#endif
+
+// Macro to detect GCC versions.
+// It evaluates to 0 if the compiler is not GCC. Be careful that the Intel
+// compilers on Linux, and the LLVM/clang compiler both define GCC version
+// macros.
+#define CGAL_GCC_VERSION (__GNUC__ * 10000       \
+                          + __GNUC_MINOR__ * 100 \
+                          + __GNUC_PATCHLEVEL__)
+
+// Macros to detect features of clang. We define them for the other
+// compilers.
+// See http://clang.llvm.org/docs/LanguageExtensions.html
+#ifndef __has_feature
+  #define __has_feature(x) 0  // Compatibility with non-clang compilers.
+#endif
+#ifndef __has_include
+  #define __has_include(x) 0  // Compatibility with non-clang compilers.
+#endif
+#ifndef __has_extension
+  #define __has_extension __has_feature // Compatibility with pre-3.0 compilers.
+#endif
+#ifndef __has_builtin
+  #define __has_builtin(x) 0  // Compatibility with non-clang compilers.
+#endif
+#ifndef __has_attribute
+  #define __has_attribute(x) 0  // Compatibility with non-clang compilers.
+#endif
+#ifndef __has_warning
+  #define __has_warning(x) 0  // Compatibility with non-clang compilers.
+#endif
+
+// Macro to specify a 'unused' attribute.
+#if defined(__GNUG__) || __has_attribute(__unused__)
+#  define CGAL_UNUSED  __attribute__ ((__unused__))
+#else
+#  define CGAL_UNUSED
+#endif
+
+// Macro to trigger deprecation warnings
+#ifdef CGAL_NO_DEPRECATION_WARNINGS
+#  define CGAL_DEPRECATED
+#  define CGAL_DEPRECATED_UNUSED CGAL_UNUSED
+#elif defined(__GNUC__) || __has_attribute(__deprecated__)
+#  define CGAL_DEPRECATED __attribute__((__deprecated__))
+#if __has_attribute(__unused__)
+#  define CGAL_DEPRECATED_UNUSED __attribute__((__deprecated__, __unused__))
+#else
+#  define CGAL_DEPRECATED_UNUSED __attribute__((__deprecated__))
+#endif
+#elif defined (_MSC_VER) && (_MSC_VER > 1300)
+#  define CGAL_DEPRECATED __declspec(deprecated)
+#  define CGAL_DEPRECATED_UNUSED __declspec(deprecated)
+#else
+#  define CGAL_DEPRECATED
+#  define CGAL_DEPRECATED_UNUSED
+#endif
+
+
+// Macro to specify a 'noreturn' attribute.
+#if defined(__GNUG__) || __has_attribute(__noreturn__)
+#  define CGAL_NORETURN  __attribute__ ((__noreturn__))
+#else
+#  define CGAL_NORETURN
+#endif
+
+// Macro CGAL_ASSUME
+// Call a builtin of the compiler to pass a hint to the compiler
+#if __has_builtin(__builtin_unreachable) || (CGAL_GCC_VERSION >= 40500 && !__STRICT_ANSI__)
+// From g++ 4.5, there exists a __builtin_unreachable()
+// Also in LLVM/clang
+#  define CGAL_ASSUME(EX) if(!(EX)) { __builtin_unreachable(); }
+#elif defined(_MSC_VER)
+// MSVC has __assume
+#  define CGAL_ASSUME(EX) __assume(EX)
+#endif
+// If CGAL_ASSUME is not defined, then CGAL_assume and CGAL_assume_code are
+// defined differently, in <CGAL/assertions.h>
+
+// If CGAL_HAS_THREADS is not defined, then CGAL code assumes
+// it can do any thread-unsafe things (like using static variables).
+#if !defined CGAL_HAS_THREADS && !defined CGAL_HAS_NO_THREADS
+#  if defined BOOST_HAS_THREADS || defined _OPENMP
+#    define CGAL_HAS_THREADS
+#  endif
+#endif
+
+#if __has_feature(cxx_thread_local) || \
+    ( (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L ) || \
+    ( _MSC_VER >= 1900 )
+#define CGAL_CAN_USE_CXX11_THREAD_LOCAL
+#endif
+
+#if ( BOOST_VERSION >= 105000 && ! defined(BOOST_NO_CXX11_HDR_MUTEX) ) || \
+    (__has_include(<mutex>) && __cplusplus >= 201103L ) | \
+    ( (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L ) || \
+    ( _MSC_VER >= 1700 )
+#define CGAL_CAN_USE_CXX11_MUTEX
+#endif
+
+#if ( BOOST_VERSION >= 105600 && ! defined(BOOST_NO_CXX11_HDR_ATOMIC) ) || \
+    (__has_include(<atomic>) && __cplusplus >= 201103L ) || \
+    ( (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L ) || \
+    ( _MSC_VER >= 1700 )
+#define CGAL_CAN_USE_CXX11_ATOMIC
+#endif
+
+// Support for LEDA with threads
+//   Not that, if CGAL_HAS_THREADS is defined, and you want to use LEDA,
+//   you must link with a version of LEDA libraries that support threads.
+#if defined(CGAL_HAS_THREADS) && CGAL_USE_LEDA
+#  define LEDA_MULTI_THREAD 1
+#endif
+// Support for LEDA_numbers on Windows
+#define LEDA_NUMBERS_DLL 1
+
+// Helper macros to disable macros
+#if defined(__clang__) || (BOOST_GCC >= 40600)
+#  define CGAL_PRAGMA_DIAG_PUSH _Pragma("GCC diagnostic push")
+#  define CGAL_PRAGMA_DIAG_POP  _Pragma("GCC diagnostic pop")
+#else
+#  define CGAL_PRAGMA_DIAG_PUSH
+#  define CGAL_PRAGMA_DIAG_POP
+#endif
+
+namespace CGAL {
+
+// Typedef for the type of NULL.
+typedef const void * Nullptr_t;   // Anticipate C++0x's std::nullptr_t
+
+} //namespace CGAL
+
+//Support for c++11 noexcept
+#if BOOST_VERSION > 104600 && !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_NOEXCEPT)
+#define CGAL_NOEXCEPT(x) noexcept(x)
+#else
+#define CGAL_NOEXCEPT(x)
+#endif
+
+// https://svn.boost.org/trac/boost/ticket/2839
+#if defined(BOOST_MSVC) && BOOST_VERSION < 105600
+#define CGAL_CFG_BOOST_VARIANT_SWAP_BUG 1
+#endif
+
+#ifndef CGAL_NO_ASSERTIONS
+#  define CGAL_NO_ASSERTIONS_BOOL false
+#else
+#  define CGAL_NO_ASSERTIONS_BOOL true
+#endif
+
+#endif // CGAL_CONFIG_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/connect_holes.h b/3rdparty/CGAL/include/CGAL/connect_holes.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/connect_holes.h
rename to 3rdparty/CGAL/include/CGAL/connect_holes.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/constant.h b/3rdparty/CGAL/include/CGAL/constant.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/constant.h
rename to 3rdparty/CGAL/include/CGAL/constant.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/constructions/Polygon_offset_cons_ftC2.h b/3rdparty/CGAL/include/CGAL/constructions/Polygon_offset_cons_ftC2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/constructions/Polygon_offset_cons_ftC2.h
rename to 3rdparty/CGAL/include/CGAL/constructions/Polygon_offset_cons_ftC2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/constructions/Straight_skeleton_cons_ftC2.h b/3rdparty/CGAL/include/CGAL/constructions/Straight_skeleton_cons_ftC2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/constructions/Straight_skeleton_cons_ftC2.h
rename to 3rdparty/CGAL/include/CGAL/constructions/Straight_skeleton_cons_ftC2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/constructions/constructions_for_voronoi_intersection_cartesian_2_3.h b/3rdparty/CGAL/include/CGAL/constructions/constructions_for_voronoi_intersection_cartesian_2_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/constructions/constructions_for_voronoi_intersection_cartesian_2_3.h
rename to 3rdparty/CGAL/include/CGAL/constructions/constructions_for_voronoi_intersection_cartesian_2_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/constructions/constructions_on_weighted_points_cartesian_3.h b/3rdparty/CGAL/include/CGAL/constructions/constructions_on_weighted_points_cartesian_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/constructions/constructions_on_weighted_points_cartesian_3.h
rename to 3rdparty/CGAL/include/CGAL/constructions/constructions_on_weighted_points_cartesian_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/constructions/kernel_ftC2.h b/3rdparty/CGAL/include/CGAL/constructions/kernel_ftC2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/constructions/kernel_ftC2.h
rename to 3rdparty/CGAL/include/CGAL/constructions/kernel_ftC2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/constructions/kernel_ftC3.h b/3rdparty/CGAL/include/CGAL/constructions/kernel_ftC3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/constructions/kernel_ftC3.h
rename to 3rdparty/CGAL/include/CGAL/constructions/kernel_ftC3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/constructions/squared_radius_smallest_orthogonalcircle_ftC2.h b/3rdparty/CGAL/include/CGAL/constructions/squared_radius_smallest_orthogonalcircle_ftC2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/constructions/squared_radius_smallest_orthogonalcircle_ftC2.h
rename to 3rdparty/CGAL/include/CGAL/constructions/squared_radius_smallest_orthogonalcircle_ftC2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/constructions_d.h b/3rdparty/CGAL/include/CGAL/constructions_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/constructions_d.h
rename to 3rdparty/CGAL/include/CGAL/constructions_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/constructions_on_weighted_points_cartesian_2.h b/3rdparty/CGAL/include/CGAL/constructions_on_weighted_points_cartesian_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/constructions_on_weighted_points_cartesian_2.h
rename to 3rdparty/CGAL/include/CGAL/constructions_on_weighted_points_cartesian_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/constructions_on_weighted_points_homogeneous_2.h b/3rdparty/CGAL/include/CGAL/constructions_on_weighted_points_homogeneous_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/constructions_on_weighted_points_homogeneous_2.h
rename to 3rdparty/CGAL/include/CGAL/constructions_on_weighted_points_homogeneous_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/convert_to_bfi.h b/3rdparty/CGAL/include/CGAL/convert_to_bfi.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/convert_to_bfi.h
rename to 3rdparty/CGAL/include/CGAL/convert_to_bfi.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/convex_decomposition_3.h b/3rdparty/CGAL/include/CGAL/convex_decomposition_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/convex_decomposition_3.h
rename to 3rdparty/CGAL/include/CGAL/convex_decomposition_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/convex_hull_2.h b/3rdparty/CGAL/include/CGAL/convex_hull_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/convex_hull_2.h
rename to 3rdparty/CGAL/include/CGAL/convex_hull_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/convex_hull_3.h b/3rdparty/CGAL/include/CGAL/convex_hull_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/convex_hull_3.h
rename to 3rdparty/CGAL/include/CGAL/convex_hull_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/convex_hull_3_to_polyhedron_3.h b/3rdparty/CGAL/include/CGAL/convex_hull_3_to_polyhedron_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/convex_hull_3_to_polyhedron_3.h
rename to 3rdparty/CGAL/include/CGAL/convex_hull_3_to_polyhedron_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/convex_hull_constructive_traits_2.h b/3rdparty/CGAL/include/CGAL/convex_hull_constructive_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/convex_hull_constructive_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/convex_hull_constructive_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/convex_hull_incremental_3.h b/3rdparty/CGAL/include/CGAL/convex_hull_incremental_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/convex_hull_incremental_3.h
rename to 3rdparty/CGAL/include/CGAL/convex_hull_incremental_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/convex_hull_traits_2.h b/3rdparty/CGAL/include/CGAL/convex_hull_traits_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/convex_hull_traits_2.h
rename to 3rdparty/CGAL/include/CGAL/convex_hull_traits_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/convexity_check_2.h b/3rdparty/CGAL/include/CGAL/convexity_check_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/convexity_check_2.h
rename to 3rdparty/CGAL/include/CGAL/convexity_check_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/convexity_check_3.h b/3rdparty/CGAL/include/CGAL/convexity_check_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/convexity_check_3.h
rename to 3rdparty/CGAL/include/CGAL/convexity_check_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/copy_n.h b/3rdparty/CGAL/include/CGAL/copy_n.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/copy_n.h
rename to 3rdparty/CGAL/include/CGAL/copy_n.h
diff --git a/3rdparty/CGAL/include/CGAL/corefinement_operations.h b/3rdparty/CGAL/include/CGAL/corefinement_operations.h
new file mode 100644
index 0000000..d715c91
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/corefinement_operations.h
@@ -0,0 +1,477 @@
+// Copyright (c) 2011 GeometryFactory (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Sebastien Loriot
+
+#ifndef CGAL_COREFINEMENT_OPERATIONS_H
+#define CGAL_COREFINEMENT_OPERATIONS_H
+
+#include <CGAL/intersection_of_Polyhedra_3.h>
+#include <CGAL/intersection_of_Polyhedra_3_refinement_visitor.h>
+
+namespace CGAL{
+/** \cond */
+namespace internal{
+  
+template <class HDS>
+class Import_volume_as_polyhedron : public CGAL::Modifier_base<HDS> {
+  typedef typename HDS::Halfedge_handle Halfedge_handle;
+  typedef typename HDS::Vertex_handle   Vertex_handle;
+  typedef typename HDS::Face_handle     Face_handle;
+  typedef typename HDS::Vertex          Vertex;
+  typedef typename HDS::Halfedge        Halfedge;
+  typedef typename HDS::Face            Face;
+  
+  //data members
+  Face_handle current_face;
+  std::vector< typename Vertex::Point >   points;
+  std::size_t nb_edges;
+  std::vector<CGAL::cpp11::tuple<unsigned,unsigned,unsigned> >           faces;
+
+public:
+  
+  //to import each piece individually
+  template <class Combinatorial_map_3>
+  Import_volume_as_polyhedron(const Combinatorial_map_3& map,typename Combinatorial_map_3::Dart_const_handle dart):nb_edges(0)
+  {
+    typedef Combinatorial_map_3 CMap;
+    typedef std::map<const typename Vertex::Point*,unsigned int> Vertex_map;
+    Vertex_map vertex_map;
+    unsigned int index=0;
+    //recover all the vertices in the current volumeiterator over all the point
+    //map the vertex to the index of the point in the vector
+    for (typename CMap::template One_dart_per_incident_cell_const_range<0,3>::const_iterator 
+         it=map.template one_dart_per_incident_cell<0,3>(dart).begin(),
+         itend=map.template one_dart_per_incident_cell<0,3>(dart).end();
+       it!=itend; ++it)
+    {
+      points.push_back(it->template attribute<0>()->point());
+      vertex_map.insert(std::make_pair(&it->template attribute<0>()->point(),index++));
+    }
+    
+    //count the number of edges    
+    nb_edges+=map.template one_dart_per_incident_cell<1,3>(dart).size();
+
+    //recover one dart per face
+    for (typename CMap::template  One_dart_per_incident_cell_const_range<2,3>::const_iterator 
+         it=map.template one_dart_per_incident_cell<2,3>(dart).begin(),
+         itend=map.template one_dart_per_incident_cell<2,3>(dart).end();
+       it!=itend; ++it)
+    {
+      //warning: the convention used into a polyhedron is that the normal 
+      //         of a triangle indicates the outside of the object; thus 
+      //         we need to reverse the orientation of the faces of the
+      //         combinatorial map.
+      unsigned int i=vertex_map[&it->template attribute<0>()->point()];
+      unsigned int j=vertex_map[&it->beta(0)->template attribute<0>()->point()];
+      unsigned int k=vertex_map[&it->beta(1)->template attribute<0>()->point()];
+      faces.push_back(CGAL::cpp11::make_tuple(i,j,k));
+    }
+  }
+  
+  //for intersection and symetric difference
+  template <class Combinatorial_map_3,class Iterator>
+  Import_volume_as_polyhedron(const Combinatorial_map_3& map,
+                              Iterator dart_begin,
+                              Iterator dart_end):nb_edges(0)
+  {
+    typedef Combinatorial_map_3 CMap;
+    typedef std::map<const typename Vertex::Point*,unsigned int> Vertex_map;
+    Vertex_map vertex_map;
+    unsigned int index=0;
+    
+    for (Iterator it=dart_begin;it!=dart_end;++it)
+    {
+      typename Combinatorial_map_3::Dart_const_handle dart=*it;
+      //recover all the vertices in the current volumeiterator over all the point
+      //map the vertex to the index of the point in the vector
+      for (typename CMap::template  One_dart_per_incident_cell_const_range<0,3>::const_iterator 
+           it=map.template one_dart_per_incident_cell<0,3>(dart).begin(),
+           itend=map.template one_dart_per_incident_cell<0,3>(dart).end();
+         it!=itend; ++it)
+      {
+        if ( vertex_map.insert(std::make_pair(&it->template attribute<0>()->point(),index)).second )
+        {          
+          points.push_back(it->template attribute<0>()->point());
+          ++index;
+        }
+      }
+      
+       //count the number of edges    
+      nb_edges+=map.template one_dart_per_incident_cell<1,3>(dart).size();
+
+      //recover one dart per face
+      for (typename CMap::template One_dart_per_incident_cell_const_range<2,3>::const_iterator 
+           it=map.template one_dart_per_incident_cell<2,3>(dart).begin(),
+           itend=map.template one_dart_per_incident_cell<2,3>(dart).end();
+         it!=itend; ++it)
+      {
+        //warning: the convention used into a polyhedron is that the normal 
+        //         of a triangle indicates the outside of the object; thus 
+        //         we need to reverse the orientation of the faces of the
+        //         combinatorial map.        
+        unsigned int i=vertex_map[&it->template attribute<0>()->point()];
+        unsigned int j=vertex_map[&it->beta(0)->template attribute<0>()->point()];
+        unsigned int k=vertex_map[&it->beta(1)->template attribute<0>()->point()];
+        faces.push_back(CGAL::cpp11::make_tuple(i,j,k));
+      }
+    }
+  }
+  
+  //for union : use the inverse of the complementary
+  template <class Combinatorial_map_3,class Iterator>
+  Import_volume_as_polyhedron(const Combinatorial_map_3& map,
+                              Iterator dart_begin,
+                              Iterator dart_end,bool):nb_edges(0)
+  {
+    typedef Combinatorial_map_3 CMap;
+    typedef std::map<const typename Vertex::Point*,unsigned int> Vertex_map;
+    Vertex_map vertex_map;
+    unsigned int index=0;
+    
+    for (Iterator it=dart_begin;it!=dart_end;++it)
+    {
+      typename Combinatorial_map_3::Dart_const_handle dart=*it;
+      //recover all the vertices in the current volumeiterator over all the point
+      //map the vertex to the index of the point in the vector
+      for (typename CMap::template One_dart_per_incident_cell_const_range<0,3>::const_iterator 
+           it=map.template one_dart_per_incident_cell<0,3>(dart).begin(),
+           itend=map.template one_dart_per_incident_cell<0,3>(dart).end();
+         it!=itend; ++it)
+      {
+        if (vertex_map.insert(std::make_pair(&it->template attribute<0>()->point(),index)).second )
+        {
+          points.push_back(it->template attribute<0>()->point());
+          ++index;
+        }
+      }
+      
+      //count the number of edges  
+      nb_edges+=map.template one_dart_per_incident_cell<1,3>(dart).size();
+
+      //recover one dart per face
+      for (typename CMap::template One_dart_per_incident_cell_const_range<2,3>::const_iterator 
+           it=map.template one_dart_per_incident_cell<2,3>(dart).begin(),
+           itend=map.template one_dart_per_incident_cell<2,3>(dart).end();
+         it!=itend; ++it)
+      {
+        //warning: the convention used into a polyhedron is that the normal 
+        //         of a triangle indicates the outside of the object; thus 
+        //         we need to reverse the orientation of the faces of the
+        //         combinatorial map. Since to get the complementary we 
+        //         also need to reverse the orientation, we finally do
+        //         not change it.
+        unsigned int i=vertex_map[&it->template attribute<0>()->point()];
+        unsigned int j=vertex_map[&it->beta(1)->template attribute<0>()->point()];
+        unsigned int k=vertex_map[&it->beta(0)->template attribute<0>()->point()];
+        faces.push_back(CGAL::cpp11::make_tuple(i,j,k));
+      }
+    }
+  }
+    
+  
+  void operator()( HDS& hds)
+  {
+    CGAL::Polyhedron_incremental_builder_3<HDS> B(hds, true);
+    B.begin_surface( points.size(), faces.size(),2*nb_edges);
+    
+    //insert vertices
+    for (typename std::vector<typename Vertex::Point>::iterator it=points.begin();it!=points.end();++it)
+      B.add_vertex(*it);
+
+    //create faces
+    for (std::vector<CGAL::cpp11::tuple<unsigned,unsigned,unsigned> >::iterator it=faces.begin();it!=faces.end();++it)
+    {
+      B.begin_facet();
+      B.add_vertex_to_facet(CGAL::cpp11::get<0>(*it));
+      B.add_vertex_to_facet(CGAL::cpp11::get<1>(*it));
+      B.add_vertex_to_facet(CGAL::cpp11::get<2>(*it));
+      B.end_facet();
+    }
+    B.end_surface();    
+  }
+};
+
+}
+/** \endcond */
+
+/*! \class Polyhedron_corefinement corefinement_operations.h CGAL/corefinement_operations.h
+  * Function object to compute the decomposition of the space induced by two polyhedra.
+  * @tparam Polyhedron must be an instantiation of  CGAL::Polyhedron_3<Traits>.
+  * @tparam Kernel must be a CGAL Kernel compatible with the underlying kernel of Polyhedron.
+  * @tparam Output_polyhedron is a polyhedron type used as output. `Kernel` must be compatible with the underlying kernel of `Output_polyhedron`.
+  */
+template <class Polyhedron,class Kernel=typename Polyhedron::Traits::Kernel, class Output_polyhedron=Polyhedron>
+class Polyhedron_corefinement
+{
+  typedef internal::Import_volume_as_polyhedron<typename Output_polyhedron::HalfedgeDS> Volume_import_modifier;
+  
+public:
+  /** Enumeration of the different feature tags, listing all kind of space decomposition the functor can compute given two input polyhedra P and Q.*/
+  enum Boolean_operation_tag
+  {
+    Join_tag=1,           /*!< the union of P and Q. */  
+    Intersection_tag=2,   /*!< the intersection of P and Q. */  
+    P_minus_Q_tag=4,      /*!< P minus Q. */  
+    Q_minus_P_tag=8,      /*!< Q minus P. */  
+    Parts_of_P_tag=32,    /*!< decomposition of the volume bounded by P induced by Q. */  
+    Parts_of_Q_tag=64,    /*!< decomposition of the volume bounded by Q induced by P. */  
+    Decomposition_tag=16  /*!< Both decompositions of P and Q. */  
+  };
+
+  /**
+    * This computes different polyhedra according to the value of features.
+    * Each input polyhedron is expected to bound a volume: the volume is bounded by the surface polyhedron with facet
+    * normals pointing outside the volume. Each facet is supposed to be counterclockwise oriented, that is its vertex 
+    * sequence (induced by halfedges) is seen counterclockwise from the side of the facet pointed by its normal. If one or
+    * both polyhedra are not closed, the algorithm will end up correctly if each intersection polyline separates each surface
+    * in two components. In that case for each triangle of each surface path boundary, the interior of the volume is considered
+    * to be on the side opposite of that pointed by it normals (but the orientation must be consistent on each patch). 
+    * the surface the volume bounded by an open surface is considered to be an infinite volume above
+    * or below the surface (the side not pointed by normal vectors). 
+    * @tparam Polyline_output_iterator must be an output iterator of std::vector<Kernel::Point_3>.
+    * @tparam Polyhedron_ptr_and_type_output_iterator an output iterator of std::pair<Polyhedron*,int>.
+    * @param P is the first input triangulated polyhedron. Note that a reference is taken and P will be updated to contain the 1D intersection between the two surfaces P and Q.
+    * @param Q is the second input triangulated polyhedron. Note that a reference is taken and Q will be updated to contain the 1D intersection between the two surfaces P and Q.
+    * @param polyline_output is an output iterator that collects intersection polylines between P and Q.
+    * @param poly_output is an output iterator that collects output polyhedra. Note that each polyhedron is allocated within this function (thus must be explicitly deleted when no longer used). The integer is a feature tag corresponding to the volume represented by the polyhedron of the pair.
+    * @param features is an integer indicating what polyhedra the function must compute. If several kind of polyhedra are expected, feature tags must be combined by |. For example if features = Polyhedron_corefinement<Polyhedron,Kernel>::Join_tag | Polyhedron_corefinement<Polyhedron,Kernel>::Intersection_tag, then poly_output will collect two polyhedra, the union and the intersection of P and Q. 
+    */
+  template <class Polyline_output_iterator,class Polyhedron_ptr_and_type_output_iterator>
+  void operator()(  Polyhedron& P, Polyhedron& Q,
+                    Polyline_output_iterator polyline_output,
+                    Polyhedron_ptr_and_type_output_iterator poly_output,
+                    int features) const
+  {
+    typedef CGAL::Node_visitor_refine_polyhedra<Polyhedron> Split_visitor;
+    Split_visitor visitor;
+    CGAL::Intersection_of_Polyhedra_3<Polyhedron,
+      Kernel,
+      Split_visitor> polyline_intersections(visitor);
+
+    polyline_intersections(P, Q, polyline_output);
+
+    typedef typename Split_visitor::Combinatorial_map_3  Combinatorial_map_3;
+    typedef typename Split_visitor::Volume_info  Volume_info;
+    typedef typename Combinatorial_map_3::Dart_const_handle Dart_const_handle;
+    
+    const typename Split_visitor::Combinatorial_map_3& final_map=visitor.combinatorial_map();
+   
+    typename Combinatorial_map_3::template One_dart_per_cell_const_range<3> cell_range=final_map.template one_dart_per_cell<3>();
+
+    std::list<Dart_const_handle> intersection;
+    std::list<Dart_const_handle> union_;
+    std::list<Dart_const_handle> P_minus_Q;
+    std::list<Dart_const_handle> Q_minus_P;
+        
+    for (typename Combinatorial_map_3::template One_dart_per_cell_const_range<3>::const_iterator 
+      it = cell_range.begin(), it_end= cell_range.end();
+      it!= it_end;
+      ++it )
+    {
+
+      const Volume_info& info=it->template attribute<3>()->info();
+      std::size_t inside_size=info.inside.size();
+      std::size_t outside_size=info.outside.size();
+
+      if ( inside_size + outside_size != 2){
+        std::cerr << "Error: One volume cannot be represented using a polyhedron. Aborted.\n";
+        break;
+      }
+
+      switch (outside_size)
+      {
+        case 2:
+          if (features & Join_tag) union_.push_back(it);
+          break;
+        case 0:
+          if (features & Intersection_tag) intersection.push_back(it);
+          break;
+        default:
+          if ( *info.inside.begin() == &P )
+          { if (features & P_minus_Q_tag) P_minus_Q.push_back(it); }
+          else
+          { if (features & Q_minus_P_tag) Q_minus_P.push_back(it); }
+      }
+      
+      if ( features&Decomposition_tag )
+      {
+        Volume_import_modifier modifier(final_map,it);
+        Output_polyhedron* new_poly=new Output_polyhedron();
+        new_poly->delegate(modifier);
+        *poly_output++ = std::make_pair( new_poly,static_cast<int>(Decomposition_tag) );
+      }
+      
+      if ( features&Parts_of_P_tag && info.inside.find(&P)!=info.inside.end() )
+      {
+        Volume_import_modifier modifier(final_map,it);
+        Output_polyhedron* new_poly=new Output_polyhedron();
+        new_poly->delegate(modifier);
+        *poly_output++ = std::make_pair( new_poly,static_cast<int>(Parts_of_P_tag) );
+      }
+
+      if ( features&Parts_of_Q_tag && info.inside.find(&Q)!=info.inside.end() )
+      {
+        Volume_import_modifier modifier(final_map,it);
+        Output_polyhedron* new_poly=new Output_polyhedron();
+        new_poly->delegate(modifier);
+        *poly_output++ = std::make_pair( new_poly,static_cast<int>(Parts_of_Q_tag) );
+      }
+    }
+    
+    if (!intersection.empty())
+    {
+      Volume_import_modifier modifier(final_map,intersection.begin(),intersection.end());
+      Output_polyhedron* new_poly=new Output_polyhedron();
+      new_poly->delegate(modifier);
+      *poly_output++=std::make_pair( new_poly,static_cast<int>(Intersection_tag) );
+    }
+    
+    if (!P_minus_Q.empty())
+    {
+      Volume_import_modifier modifier(final_map,P_minus_Q.begin(),P_minus_Q.end());
+      Output_polyhedron* new_poly=new Output_polyhedron();
+      new_poly->delegate(modifier);
+      *poly_output++=std::make_pair( new_poly,static_cast<int>(P_minus_Q_tag) );
+    }
+
+    if (!Q_minus_P.empty())
+    {
+      Volume_import_modifier modifier(final_map,Q_minus_P.begin(),Q_minus_P.end());
+      Output_polyhedron* new_poly=new Output_polyhedron();
+      new_poly->delegate(modifier);
+      *poly_output++=std::make_pair( new_poly,static_cast<int>(Q_minus_P_tag) );
+    }
+    
+    if (!union_.empty())
+    {
+      Volume_import_modifier modifier(final_map,union_.begin(),union_.end(),true);
+      Output_polyhedron* new_poly=new Output_polyhedron();
+      new_poly->delegate(modifier);
+      *poly_output++=std::make_pair( new_poly,static_cast<int>(Join_tag) );
+    }
+  }
+  /**
+    * This updates P according to the value of features.
+    * Each input polyhedron is expected to bound a volume: the volume is bounded by the surface polyhedron with facet
+    * normals pointing outside the volume. Each facet is supposed to be counterclockwise oriented, that is its vertex 
+    * sequence (induced by halfedges) is seen counterclockwise from the side of the facet pointed by its normal. If one or
+    * both polyhedra are not closed, the algorithm will end up correctly if each intersection polyline separates each surface
+    * in two components. In that case for each triangle of each surface path boundary, the interior of the volume is considered
+    * to be on the side opposite of that pointed by it normals (but the orientation must be consistent on each patch). 
+    * the surface the volume bounded by an open surface is considered to be an infinite volume above
+    * or below the surface (the side not pointed by normal vectors). 
+    * @tparam Polyline_output_iterator must be an output iterator of std::vector<Kernel::Point_3>.
+    * @param P is the first input triangulated polyhedron. Note that a reference is taken and P will be updated to contain the 1D intersection between the two surfaces P and Q.
+    * @param Q is the first input triangulated polyhedron. Note that a reference is taken and Q will be updated to contain the 1D intersection between the two surfaces P and Q.
+    * @param polyline_output is an output iterator that collects intersection polylines between P and Q.
+    * @param features is either Join_tag, Intersection_tag, P_minus_Q_tag or Q_minus_P_tag
+    */
+  template <class Polyline_output_iterator>
+  void operator()(  Polyhedron& P, Polyhedron& Q,
+                    Polyline_output_iterator polyline_output,
+                    Boolean_operation_tag features) const
+  {
+    typedef CGAL::Node_visitor_refine_polyhedra<Polyhedron> Split_visitor;
+    Split_visitor visitor;
+    CGAL::Intersection_of_Polyhedra_3<Polyhedron,
+      Kernel,
+      Split_visitor> polyline_intersections(visitor);
+
+    polyline_intersections(P, Q, polyline_output);
+
+    typedef typename Split_visitor::Combinatorial_map_3  Combinatorial_map_3;
+    typedef typename Split_visitor::Volume_info  Volume_info;
+    typedef typename Combinatorial_map_3::Dart_const_handle Dart_const_handle;
+    
+    const typename Split_visitor::Combinatorial_map_3& final_map=visitor.combinatorial_map();
+   
+    typename Combinatorial_map_3::template One_dart_per_cell_const_range<3> cell_range=final_map.template one_dart_per_cell<3>();
+
+    std::list<Dart_const_handle> darts;
+        
+    for (typename Combinatorial_map_3::template One_dart_per_cell_const_range<3>::const_iterator 
+      it = cell_range.begin(), it_end= cell_range.end();
+      it!= it_end;
+      ++it )
+    {
+
+      const Volume_info& info=it->template attribute<3>()->info();
+      std::size_t inside_size=info.inside.size();
+      std::size_t outside_size=info.outside.size();
+
+      if ( inside_size + outside_size != 2){
+        std::cerr << "Error: One volume cannot be represented using a polyhedron. Aborted.\n";
+        break;
+      }
+
+      switch (outside_size)
+      {
+        case 2:
+          if ( features==Join_tag ) darts.push_back(it);
+          break;
+        case 0:
+          if ( features==Intersection_tag ) darts.push_back(it);
+          break;
+        default:
+          if ( *info.inside.begin() == &P )
+          { if (features == P_minus_Q_tag) darts.push_back(it); }
+          else
+          { if (features == Q_minus_P_tag) darts.push_back(it); }
+      }
+    }
+    
+    P.clear();
+    
+    if (!darts.empty())
+    {
+      Volume_import_modifier modifier=
+      features==Join_tag?
+          Volume_import_modifier(final_map,darts.begin(),darts.end(),true)
+        : Volume_import_modifier(final_map,darts.begin(),darts.end());
+      P.delegate(modifier);
+    }
+  }
+  
+  /** \cond */
+  static std::string get_type_str(const std::string& Pname,const std::string& Qname,int i)
+  {
+    switch (i)
+    {
+      case Join_tag: 
+        return Pname+std::string("_union_")+Qname;
+      case P_minus_Q_tag: 
+        return Pname+std::string("_minus_")+Qname;
+      case Q_minus_P_tag:
+        return Qname+std::string("_minus_")+Pname;
+      case Intersection_tag:
+        return Pname+std::string("_inter_")+Qname;
+      case Decomposition_tag:
+        return std::string("Decomposition");
+    }
+    return std::string("Unknow");
+  }
+  /** \endcond */ 
+};
+
+
+
+
+}
+
+#endif // CGAL_COREFINEMENT_OPERATIONS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/create_offset_polygons_2.h b/3rdparty/CGAL/include/CGAL/create_offset_polygons_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/create_offset_polygons_2.h
rename to 3rdparty/CGAL/include/CGAL/create_offset_polygons_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/create_offset_polygons_from_polygon_with_holes_2.h b/3rdparty/CGAL/include/CGAL/create_offset_polygons_from_polygon_with_holes_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/create_offset_polygons_from_polygon_with_holes_2.h
rename to 3rdparty/CGAL/include/CGAL/create_offset_polygons_from_polygon_with_holes_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/create_straight_skeleton_2.h b/3rdparty/CGAL/include/CGAL/create_straight_skeleton_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/create_straight_skeleton_2.h
rename to 3rdparty/CGAL/include/CGAL/create_straight_skeleton_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/create_straight_skeleton_from_polygon_with_holes_2.h b/3rdparty/CGAL/include/CGAL/create_straight_skeleton_from_polygon_with_holes_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/create_straight_skeleton_from_polygon_with_holes_2.h
rename to 3rdparty/CGAL/include/CGAL/create_straight_skeleton_from_polygon_with_holes_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/determinant.h b/3rdparty/CGAL/include/CGAL/determinant.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/determinant.h
rename to 3rdparty/CGAL/include/CGAL/determinant.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/determinant_of_vectors.h b/3rdparty/CGAL/include/CGAL/determinant_of_vectors.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/determinant_of_vectors.h
rename to 3rdparty/CGAL/include/CGAL/determinant_of_vectors.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/distance_predicates_2.h b/3rdparty/CGAL/include/CGAL/distance_predicates_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/distance_predicates_2.h
rename to 3rdparty/CGAL/include/CGAL/distance_predicates_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/distance_predicates_3.h b/3rdparty/CGAL/include/CGAL/distance_predicates_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/distance_predicates_3.h
rename to 3rdparty/CGAL/include/CGAL/distance_predicates_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/double.h b/3rdparty/CGAL/include/CGAL/double.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/double.h
rename to 3rdparty/CGAL/include/CGAL/double.h
diff --git a/3rdparty/CGAL/include/CGAL/edge_aware_upsample_point_set.h b/3rdparty/CGAL/include/CGAL/edge_aware_upsample_point_set.h
new file mode 100644
index 0000000..b897997
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/edge_aware_upsample_point_set.h
@@ -0,0 +1,648 @@
+// Copyright (c) 2013-06  INRIA Sophia-Antipolis (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
+// 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(s) : Shihao Wu, Clement Jamin, Pierre Alliez 
+
+#ifndef CGAL_UPSAMPLE_POINT_SET_H
+#define CGAL_UPSAMPLE_POINT_SET_H
+
+#include <CGAL/property_map.h>
+#include <CGAL/point_set_processing_assertions.h>
+#include <CGAL/internal/Rich_grid.h>
+#include <CGAL/Real_timer.h>
+#include <CGAL/Memory_sizer.h>
+#include <CGAL/compute_average_spacing.h>
+
+#include <iterator>
+#include <set>
+#include <utility>
+
+
+//#define  CGAL_PSP3_VERBOSE
+
+namespace CGAL {
+
+// ----------------------------------------------------------------------------
+// Private section
+// ----------------------------------------------------------------------------
+/// \cond SKIP_IN_MANUAL
+
+namespace upsample_internal{
+
+/// For each query point, select a best "base point" in its neighborhoods.
+/// Then, a new point will be interpolated between query point and "base point".
+/// This is the key part of the upsample algorithm 
+/// 
+/// \pre `radius > 0`
+///
+/// @tparam Kernel Geometric traits class.
+///
+/// @return local density length
+template <typename Kernel>
+typename Kernel::FT
+base_point_selection(
+  const rich_grid_internal::Rich_point<Kernel>& query, ///< 3D point to project
+  const std::vector<rich_grid_internal::Rich_point<Kernel> >& 
+                    neighbor_points,///< neighbor sample points
+  const typename Kernel::FT edge_sensitivity,///< edge sensitivity parameter
+  unsigned int& output_base_index ///< base point index
+  )
+{
+  // basic geometric types
+  typedef typename Kernel::Point_3 Point;
+  typedef typename Kernel::Vector_3 Vector;
+  typedef typename Kernel::FT FT;
+  typedef typename rich_grid_internal::Rich_point<Kernel> Rich_point;
+
+  if (neighbor_points.empty())
+  {
+#ifdef CGAL_PSP3_VERBOSE
+    std::cout << "empty neighborhood" << std::endl;
+#endif
+    output_base_index = query.index;
+    return 0.0;
+  }
+
+  FT best_dist2 = -10.0;
+  const Rich_point& v = query;
+  typename std::vector<Rich_point>::const_iterator iter = neighbor_points.begin();
+  for (; iter != neighbor_points.end(); ++iter)
+  {
+    const Point& t = iter->pt;
+
+    const Vector& vm = v.normal;
+    const Vector& tm = iter->normal;
+
+    Vector diff_v_t = t - v.pt;
+    Point mid_point = v.pt + (diff_v_t * FT(0.5));
+    
+    FT dot_produce = std::pow((FT(2.0) - vm * tm), edge_sensitivity);
+
+    Vector diff_t_mid = mid_point - t;
+    FT project_t = diff_t_mid * tm;
+    FT min_dist2 = diff_t_mid.squared_length() - project_t * project_t;
+
+    typename std::vector<Rich_point>::const_iterator iter_in = neighbor_points.begin();
+    for (; iter_in != neighbor_points.end(); ++iter_in)
+    {
+      Vector diff_s_mid = mid_point - iter_in->pt;
+      FT project_s = diff_s_mid * iter_in->normal;
+
+      FT proj_min2 = diff_s_mid.squared_length() - project_s * project_s;
+
+      if (proj_min2 < min_dist2)
+      {
+        min_dist2 = proj_min2;
+      }
+    }
+    min_dist2 *= dot_produce;
+
+    if (min_dist2 > best_dist2)
+    {
+      best_dist2 = min_dist2;
+      output_base_index = iter->index;
+    }
+  }
+
+  return best_dist2; 
+}
+
+/// For each new inserted point, we need to do the following job
+/// 1, get neighbor information from the two "parent points"
+/// 2, update position and determine normal by bilateral projection 
+/// 3, update neighbor information again
+///
+/// \pre `radius > 0`
+///
+/// @tparam Kernel Geometric traits class.
+///
+template <typename Kernel>
+void
+update_new_point(
+  unsigned int new_point_index, ///< new inserted point
+  unsigned int father_index, ///< father point index
+  unsigned int mother_index, ///< mother point index
+  std::vector<rich_grid_internal::Rich_point<Kernel> >& rich_point_set,
+                                                           ///< all rich points
+  const typename Kernel::FT radius,          ///< accept neighborhood radius
+  const typename Kernel::FT sharpness_bandwidth  ///< control sharpness
+)
+{
+  // basic geometric types
+  typedef typename Kernel::Vector_3 Vector;
+  typedef typename Kernel::FT FT;
+  typedef typename rich_grid_internal::Rich_point<Kernel> Rich_point;
+
+  CGAL_assertion_code( unsigned int size = static_cast<unsigned int>(rich_point_set.size()) );
+  CGAL_point_set_processing_precondition(father_index >= 0 &&
+                                         father_index < size);
+  CGAL_point_set_processing_precondition(mother_index >= 0 &&
+                                           mother_index < size);
+
+  // 1, get neighbor information from the two "parent points"
+  Rich_point& new_v = rich_point_set[new_point_index];
+  Rich_point& father_v = rich_point_set[father_index];
+  Rich_point& mother_v = rich_point_set[mother_index];
+
+  std::set<int> neighbor_indexes;
+  std::vector<unsigned int>::iterator iter;
+  for (iter = father_v.neighbors.begin();
+       iter != father_v.neighbors.end();
+       ++iter)
+  {
+    neighbor_indexes.insert(*iter);
+  }
+
+  for (iter = mother_v.neighbors.begin();
+       iter != mother_v.neighbors.end();
+       ++iter)
+  {
+    neighbor_indexes.insert(*iter);
+  }
+
+  neighbor_indexes.insert(father_v.index);
+  neighbor_indexes.insert(mother_v.index);
+
+  FT radius2 = radius * radius;
+
+  new_v.neighbors.clear();
+  std::set<int>::iterator set_iter;
+  for (set_iter = neighbor_indexes.begin(); 
+       set_iter != neighbor_indexes.end(); ++set_iter)
+  {
+    Rich_point& t = rich_point_set[*set_iter];
+    FT dist2 =  CGAL::squared_distance(new_v.pt, t.pt);
+
+    if (dist2 < radius2)
+    {
+      new_v.neighbors.push_back(t.index);
+    }
+  }
+
+  // 2, update position and normal by bilateral projection 
+  const unsigned int candidate_num = 2; // we have two normal candidates:
+                                        // we say father's is 0
+                                        //        mother's is 1
+  std::vector<Vector> normal_cadidate(candidate_num);
+  normal_cadidate[0] = father_v.normal;
+  normal_cadidate[1] = mother_v.normal;
+
+  std::vector<FT> project_dist_sum(candidate_num, FT(0.0));
+  std::vector<FT> weight_sum(candidate_num, FT(0.0));
+  std::vector<Vector> normal_sum(candidate_num, NULL_VECTOR);
+   
+  FT radius16 = FT(-4.0) / radius2;
+
+  for (unsigned int i = 0; i < new_v.neighbors.size(); ++i)
+  {
+    const Rich_point& t = rich_point_set[new_v.neighbors[i]];
+    FT dist2 = CGAL::squared_distance(new_v.pt, t.pt);
+    FT theta = std::exp(dist2 * radius16);
+
+    for (unsigned int j = 0; j < candidate_num; j++)
+    {
+      FT psi = std::exp(-std::pow(1 - normal_cadidate[j] * t.normal, 2)
+                       / sharpness_bandwidth);
+      FT project_diff_t_v = (t.pt - new_v.pt) * t.normal;
+      FT weight = psi * theta;
+
+      project_dist_sum[j] += project_diff_t_v * weight;
+      normal_sum[j] = normal_sum[j] + t.normal * weight;
+      weight_sum[j] += weight;
+    }
+  }
+
+  // select best candidate
+  FT min_project_dist = (std::numeric_limits<FT>::max)();
+  unsigned int best = 0;
+
+  for (unsigned int i = 0; i < candidate_num; ++i)
+  {
+    FT absolute_dist = CGAL::abs(project_dist_sum[i] / weight_sum[i]);
+    if (absolute_dist < min_project_dist)
+    {
+      min_project_dist = absolute_dist;
+      best = i;
+    }
+  }
+
+  // update position and normal
+  Vector update_normal = normal_sum[best] / weight_sum[best];
+  new_v.normal = update_normal / sqrt(update_normal.squared_length());
+
+  FT project_dist = project_dist_sum[best] / weight_sum[best];
+  new_v.pt = new_v.pt + new_v.normal * project_dist;
+
+
+  // 3, update neighbor information again
+  new_v.neighbors.clear();
+  for (set_iter = neighbor_indexes.begin(); 
+       set_iter != neighbor_indexes.end(); ++set_iter)
+  {
+    Rich_point& t = rich_point_set[*set_iter];
+    FT dist2 =  CGAL::squared_distance(new_v.pt, t.pt);
+
+    if (dist2 < radius2)
+    {
+      new_v.neighbors.push_back(t.index);
+      t.neighbors.push_back(new_v.index);
+    }
+  }
+}
+
+} /* namespace upsample_internal */
+
+/// \endcond
+
+// ----------------------------------------------------------------------------
+// Public section
+// ----------------------------------------------------------------------------
+
+/// \ingroup PkgPointSetProcessing
+/// This method progressively upsamples the point set while 
+/// approaching the edge singularities (detected by normal variation), which 
+/// generates a denser point set from an input point set. This has applications 
+/// in point-based rendering, hole filling, and sparse surface reconstruction. 
+/// Normals of points are required as input. For more details, please refer to \cgalCite{ear-2013}.
+/// 
+/// @tparam Concurrency_tag enables sequential versus parallel
+///                         versions of `compute_average_spacing()` (called internally).
+///                         Possible values are `Sequential_tag`
+///                         and `Parallel_tag`.
+/// @tparam OutputIterator Type of the output iterator. 
+///         The type of the objects put in it is 
+///         `std::pair<Kernel::Point_3, Kernel::Vector_3>`.
+///         Note that the user may use a 
+///         <A HREF="http://www.boost.org/libs/iterator/doc/function_output_iterator.html">function_output_iterator</A>
+///         to match specific needs.
+/// @tparam ForwardIterator iterator over input points.
+/// @tparam PointPMap is a model of `ReadablePropertyMap` 
+///         with the value type of `ForwardIterator` as key and `Kernel::Point_3` as value type.
+///         It can be omitted if the value type of `ForwardIterator` is convertible to 
+///         `Kernel::Point_3`.
+/// @tparam NormalPMap is a model of `ReadablePropertyMap` with the value type of `ForwardIterator` as key
+///         and `Kernel::Vector_3` as value type.
+/// @tparam Kernel Geometric traits class.
+///      It can be omitted and deduced automatically from the value type of  `PointPMap`
+///      using `Kernel_traits`.
+///
+
+// This variant requires all parameters.
+template <typename Concurrency_tag,
+	  typename OutputIterator,
+          typename ForwardIterator, 
+          typename PointPMap, 
+          typename NormalPMap,
+          typename Kernel>
+OutputIterator
+edge_aware_upsample_point_set(
+  ForwardIterator first,  ///< forward iterator on the first input point.
+  ForwardIterator beyond, ///< past-the-end iterator.
+  OutputIterator output,  ///< output iterator where output points and normals 
+                          ///< are put.
+  PointPMap point_pmap,   ///< point property map.
+  NormalPMap normal_pmap, ///< vector property map.
+  const typename Kernel::FT sharpness_angle,  ///< 
+                    ///< controls the preservation of sharp features. 
+                    ///< The larger the value is,
+                    ///< the smoother the result will be.
+                    ///< The range of possible values is `[0, 90]`.
+                    ///< See section \ref Point_set_processing_3Upsample_Parameter2
+                    ///< for an example.
+  typename Kernel::FT edge_sensitivity,  ///<  
+                    ///< larger values of edge-sensitivity give higher priority 
+                    ///< to inserting points along sharp features.
+                    ///< The range of possible values is `[0, 1]`.
+                    ///< See section \ref Point_set_processing_3Upsample_Parameter1
+                    ///< for an example.
+  typename Kernel::FT neighbor_radius, ///< 
+                    ///< indicates the radius of the largest hole that should be filled.
+                    ///< The default value is set to 3 times the average spacing of the point set.
+                    ///< If the value given by user is smaller than the average spacing, 
+                    ///< the function will use the default value instead.
+  const std::size_t number_of_output_points,///< number of output
+                                             ///< points to generate.
+  const Kernel& /*kernel*/ ///< geometric traits.
+)
+{
+  // basic geometric types
+  typedef typename Kernel::Point_3 Point;
+  typedef typename Kernel::Vector_3 Vector;
+  typedef typename Kernel::FT FT;
+  typedef typename rich_grid_internal::Rich_point<Kernel> Rich_point;
+
+  // preconditions
+  CGAL_point_set_processing_precondition(first != beyond);
+  CGAL_point_set_processing_precondition(sharpness_angle >= 0 
+                                       &&sharpness_angle <= 90);
+  CGAL_point_set_processing_precondition(edge_sensitivity >= 0 
+                                       &&edge_sensitivity <= 1);
+  CGAL_point_set_processing_precondition(neighbor_radius > 0);
+
+  edge_sensitivity *= 10;  // just project [0, 1] to [0, 10].
+
+  std::size_t number_of_input = std::distance(first, beyond);
+  CGAL_point_set_processing_precondition(number_of_output_points > number_of_input);
+
+
+  const unsigned int nb_neighbors = 6; // 1 ring
+  FT average_spacing = CGAL::compute_average_spacing<Concurrency_tag>(
+                   first, beyond,
+                   point_pmap,
+                   nb_neighbors);
+
+  if (neighbor_radius < average_spacing)
+  {
+    neighbor_radius = average_spacing * 3.0f;
+#ifdef CGAL_PSP3_VERBOSE
+    std::cout << "neighbor radius: " << neighbor_radius << std::endl;
+#endif
+  }
+  
+  Real_timer task_timer;
+
+  // copy rich point set
+  std::vector<Rich_point> rich_point_set(number_of_input);
+  CGAL::Bbox_3 bbox(0., 0., 0., 0., 0., 0.);
+  
+  ForwardIterator it = first; // point iterator
+  for(unsigned int i = 0; it != beyond; ++it, ++i)
+  {
+    rich_point_set[i].pt = get(point_pmap, *it);
+    rich_point_set[i].normal = get(normal_pmap, *it);
+
+    rich_point_set[i].index = i;
+    bbox += rich_point_set[i].pt.bbox();
+    CGAL_point_set_processing_precondition(rich_point_set[i].normal.squared_length() > 1e-10);
+  }
+
+  // compute neighborhood
+  rich_grid_internal::compute_ball_neighbors_one_self(rich_point_set,
+                                                      bbox,
+                                                      neighbor_radius);
+
+  //
+  FT cos_sigma = static_cast<FT>(std::cos(CGAL::to_double(sharpness_angle) / 180.0 * CGAL_PI));
+  FT sharpness_bandwidth = std::pow((CGAL::max)((FT)1e-8, (FT)1.0 - cos_sigma), 2);
+
+  FT sum_density = 0.0;
+  unsigned int count_density = 1;
+  double max_iter_time = 20;
+  FT current_radius = neighbor_radius;
+  FT density_pass_threshold = 0.0;
+
+  for (unsigned int iter_time = 0; iter_time < max_iter_time; ++iter_time)
+  {
+  #ifdef CGAL_PSP3_VERBOSE
+     std::cout << std::endl << "iter_time: " << iter_time + 1  << std::endl;
+  #endif
+    if (iter_time > 0)
+    {
+      current_radius *= 0.75;
+      if (current_radius < density_pass_threshold * 3) //3 ring
+      {
+        current_radius = density_pass_threshold * 3;
+      }
+      rich_grid_internal::compute_ball_neighbors_one_self(rich_point_set,
+                                                          bbox,
+                                                          current_radius);
+    }
+ #ifdef CGAL_PSP3_VERBOSE
+    std::cout << "current radius: " << current_radius << std::endl; 
+ #endif
+
+    std::size_t current_size = rich_point_set.size();
+    std::vector<bool> is_pass_threshold(current_size, false);
+
+    if (iter_time == 0)
+    {
+      //estimate density threshold for the first time
+      for (unsigned int i = 0; i < rich_point_set.size() * 0.05; ++i)
+      {
+        const Rich_point& v = rich_point_set[i];
+
+        if (v.neighbors.empty())
+          continue;
+
+        // extract neighbor rich points by index
+        std::vector<Rich_point> neighbor_rich_points(v.neighbors.size());
+        for (unsigned int n = 0; n < v.neighbors.size(); n++)
+        {
+          neighbor_rich_points[n] = rich_point_set[v.neighbors[n]];
+        }
+
+        unsigned int base_index = 0;
+        FT density2 = upsample_internal::
+                              base_point_selection(v,
+                                                   neighbor_rich_points,
+                                                   edge_sensitivity,
+                                                   base_index);
+
+        if (density2 < 0)
+        {
+          continue;
+        }
+
+        sum_density += density2;
+        count_density++;
+      }
+    }
+
+    density_pass_threshold = static_cast<FT>(sqrt(sum_density / count_density) * FT(0.65));
+    sum_density = 0.;
+    count_density = 1;
+
+    FT density_pass_threshold2 = density_pass_threshold * 
+                                 density_pass_threshold;
+ #ifdef CGAL_PSP3_VERBOSE
+    std::cout << "pass_threshold:  " << density_pass_threshold << std::endl;
+ #endif
+    // insert new points until all the points' density pass the threshold
+    unsigned int max_loop_time = 3;
+    unsigned int loop = 0;
+    while (true)
+    {
+   #ifdef CGAL_PSP3_VERBOSE
+      std::cout << "loop_time: " << loop + 1 << std::endl;
+   #endif
+      unsigned int count_not_pass = 0;
+      loop++;
+      for (unsigned int i = 0; i < rich_point_set.size(); ++i)
+      {
+        if (is_pass_threshold[i])
+        {
+          continue;
+        }
+
+        const Rich_point& v = rich_point_set[i];
+
+        if (v.neighbors.empty())
+          continue;
+
+        // extract neighbor rich points by index
+        std::vector<Rich_point> neighbor_rich_points(v.neighbors.size());
+        for (unsigned int n = 0; n < v.neighbors.size(); ++n)
+        {
+          neighbor_rich_points[n] = rich_point_set[v.neighbors[n]];
+        }
+
+        // select base point 
+        unsigned int base_index = 0;
+        FT density2 = upsample_internal::
+                              base_point_selection(v,
+                                                   neighbor_rich_points,
+                                                   edge_sensitivity,
+                                                   base_index);
+
+        // test if it pass the density threshold
+        if (density2 < density_pass_threshold2)
+        {
+          is_pass_threshold[i] = true;
+          continue;
+        }
+        count_not_pass++;
+
+        sum_density += density2;
+        count_density++;
+
+        // insert a new rich point
+        unsigned int father_index = v.index;
+        unsigned int mother_index = base_index;
+
+        Rich_point new_v;
+        Rich_point& base = rich_point_set[mother_index];
+        Vector diff_v_base = base.pt - v.pt;
+        new_v.pt = v.pt + (diff_v_base * FT(0.5));
+        new_v.index = static_cast<unsigned int>(rich_point_set.size());
+
+        unsigned int new_point_index = new_v.index;
+        rich_point_set.push_back(new_v);
+        is_pass_threshold.push_back(false);
+
+        //update new rich point
+        upsample_internal::update_new_point(new_point_index, 
+                                            father_index, 
+                                            mother_index, 
+                                            rich_point_set, 
+                                            current_radius,
+                                            sharpness_bandwidth);
+
+        if (rich_point_set.size() >= number_of_output_points)
+        {
+          break;
+        }
+      }
+   #ifdef CGAL_PSP3_VERBOSE
+      std::cout << "current size: " << rich_point_set.size() << std::endl;
+   #endif
+      if (count_not_pass == 0 || 
+          loop >= max_loop_time || 
+          rich_point_set.size() >= number_of_output_points)
+      {
+        break;
+      }
+
+    }
+
+    if (rich_point_set.size() >= number_of_output_points)
+    {
+      break;
+    }
+  }
+
+  for (std::size_t i = number_of_input; i < rich_point_set.size(); ++i)
+  {
+    const Rich_point& v = rich_point_set[i];
+    Point point = v.pt;
+    Vector normal = v.normal;
+    *output++ = std::make_pair(point, normal);
+  }
+ 
+  return output;
+}
+
+
+/// @cond SKIP_IN_MANUAL
+// This variant deduces the kernel from the point property map.
+template <typename Concurrency_tag,
+	  typename OutputIterator,
+          typename ForwardIterator,
+          typename PointPMap,
+          typename NormalPMap>
+OutputIterator
+edge_aware_upsample_point_set(
+  ForwardIterator first,    ///< forward iterator to the first input point.
+  ForwardIterator beyond,   ///< past-the-end iterator.
+  OutputIterator output, ///< output iterator over points.
+  PointPMap point_pmap, ///< property map: `ForwardIterator` -> Point_3.
+  NormalPMap normal_pmap, ///< property map: `ForwardIterator` -> Vector_3.
+  double sharpness_angle,  ///< control sharpness(0-90)
+  double edge_sensitivity,  ///< edge sensitivity(0-5)
+  double neighbor_radius, ///< initial size of neighbors.
+  const std::size_t number_of_output_points///< number of iterations.   
+  )
+{
+  typedef typename boost::property_traits<PointPMap>::value_type Point;
+  typedef typename Kernel_traits<Point>::Kernel Kernel;
+  typedef typename Kernel::FT FT;
+  return edge_aware_upsample_point_set<Concurrency_tag>(
+    first, beyond,
+    output,
+    point_pmap,
+    normal_pmap,
+    static_cast<FT>(sharpness_angle), 
+    static_cast<FT>(edge_sensitivity),
+    static_cast<FT>(neighbor_radius), 
+    number_of_output_points,
+    Kernel());
+}
+/// @endcond
+
+
+/// @cond SKIP_IN_MANUAL
+template <typename Concurrency_tag,
+	  typename OutputIterator,
+          typename ForwardIterator,
+          typename NormalPMap>
+OutputIterator
+edge_aware_upsample_point_set(
+  ForwardIterator first, ///< iterator over the first input point
+  ForwardIterator beyond, ///< past-the-end iterator
+  OutputIterator output, ///< output iterator over points.
+  NormalPMap normal_pmap, ///< property map:  OutputIterator -> Vector_3.
+  double sharpness_angle = 30,  ///< control sharpness(0-90)
+  double edge_sensitivity = 1,  ///< edge sensitivity(0-5)
+  double neighbor_radius = -1, ///< initial size of neighbors.
+  const std::size_t number_of_output_points = 1000///< number of output points.     
+  )
+{
+  // just deduce value_type of OutputIterator
+  return edge_aware_upsample_point_set
+    <Concurrency_tag, typename value_type_traits<OutputIterator>::type>(
+    first, beyond,
+    output,
+    normal_pmap,
+    sharpness_angle, 
+    edge_sensitivity,
+    neighbor_radius, 
+    number_of_output_points);
+}
+/// @endcond
+
+} //namespace CGAL
+
+#endif // CGAL_UPSAMPLE_POINT_SET_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/enum.h b/3rdparty/CGAL/include/CGAL/enum.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/enum.h
rename to 3rdparty/CGAL/include/CGAL/enum.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/envelope_2.h b/3rdparty/CGAL/include/CGAL/envelope_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/envelope_2.h
rename to 3rdparty/CGAL/include/CGAL/envelope_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/envelope_3.h b/3rdparty/CGAL/include/CGAL/envelope_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/envelope_3.h
rename to 3rdparty/CGAL/include/CGAL/envelope_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/exceptions.h b/3rdparty/CGAL/include/CGAL/exceptions.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/exceptions.h
rename to 3rdparty/CGAL/include/CGAL/exceptions.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/export/CGAL.h b/3rdparty/CGAL/include/CGAL/export/CGAL.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/export/CGAL.h
rename to 3rdparty/CGAL/include/CGAL/export/CGAL.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/export/CORE.h b/3rdparty/CGAL/include/CGAL/export/CORE.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/export/CORE.h
rename to 3rdparty/CGAL/include/CGAL/export/CORE.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/export/ImageIO.h b/3rdparty/CGAL/include/CGAL/export/ImageIO.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/export/ImageIO.h
rename to 3rdparty/CGAL/include/CGAL/export/ImageIO.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/export/Qt.h b/3rdparty/CGAL/include/CGAL/export/Qt.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/export/Qt.h
rename to 3rdparty/CGAL/include/CGAL/export/Qt.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/export/helpers.h b/3rdparty/CGAL/include/CGAL/export/helpers.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/export/helpers.h
rename to 3rdparty/CGAL/include/CGAL/export/helpers.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/extended_euclidean_algorithm.h b/3rdparty/CGAL/include/CGAL/extended_euclidean_algorithm.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/extended_euclidean_algorithm.h
rename to 3rdparty/CGAL/include/CGAL/extended_euclidean_algorithm.h
diff --git a/3rdparty/CGAL/include/CGAL/extract_mean_curvature_flow_skeleton.h b/3rdparty/CGAL/include/CGAL/extract_mean_curvature_flow_skeleton.h
new file mode 100644
index 0000000..a36f0e0
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/extract_mean_curvature_flow_skeleton.h
@@ -0,0 +1,66 @@
+// Copyright (c) 2014  GeometryFactory (France). All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Sebastien Loriot
+//
+
+#ifndef CGAL_EXTRACT_MEAN_CURVATURE_FLOW_SKELETON_H
+#define CGAL_EXTRACT_MEAN_CURVATURE_FLOW_SKELETON_H
+
+#include <CGAL/Polyhedron_3.h>
+#include <CGAL/Polyhedron_items_with_id_3.h>
+#ifdef CGAL_EIGEN3_ENABLED
+#include <CGAL/Eigen_solver_traits.h>  // for sparse linear system solver
+#endif
+
+#include <CGAL/Mean_curvature_flow_skeletonization.h>
+
+namespace CGAL{
+
+#if defined(DOXYGEN_RUNNING) || defined(CGAL_EIGEN3_ENABLED)
+/// \ingroup PkgMeanCurvatureSkeleton3
+/// @brief extracts a medially centered curve skeleton for the triangle mesh `tmesh`.
+/// This function uses the class CGAL::Mean_curvature_flow_skeletonization with the default parameters.
+/// This function is provided only if \ref thirdpartyEigen "Eigen" 3.2 (or greater) is available and `CGAL_EIGEN3_ENABLED` is defined.
+/// @pre `tmesh` is a triangle mesh without borders and having exactly one connected component.
+/// @pre The specialization `boost::property_map<TriangleMesh, CGAL::vertex_point_t>::%type` and `get(vertex_point, tmesh)` are defined.
+/// @pre The value type of `boost::property_map<TriangleMesh, CGAL::vertex_point_t>::%type` is a point type from a \cgal Kernel.
+///
+/// @tparam TriangleMesh
+///         a model of `FaceListGraph`
+///
+/// @param tmesh
+///        input mesh
+/// @param skeleton
+///        graph that will contain the skeleton of `tmesh`.
+///        For each vertex descriptor `vd` of `skeleton`, the corresponding point
+///        and the set of input vertices that contracted to `vd` can be retrieved
+///        using `skeleton[vd].point` and `skeleton[vd].vertices` respectively.
+///
+template <class TriangleMesh>
+void extract_mean_curvature_flow_skeleton(const TriangleMesh& tmesh,
+                                          typename Mean_curvature_flow_skeletonization<TriangleMesh>::Skeleton& skeleton)
+{
+  // extract the skeleton
+  typedef CGAL::Mean_curvature_flow_skeletonization<TriangleMesh> Mcfskel;
+  Mcfskel mcfs(tmesh);
+  mcfs(skeleton);
+}
+#endif
+
+}// end of namespace CGAL
+
+#endif //CGAL_EXTRACT_MEAN_CURVATURE_FLOW_SKELETON_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/extremal_polygon_2.h b/3rdparty/CGAL/include/CGAL/extremal_polygon_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/extremal_polygon_2.h
rename to 3rdparty/CGAL/include/CGAL/extremal_polygon_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/exude_mesh_3.h b/3rdparty/CGAL/include/CGAL/exude_mesh_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/exude_mesh_3.h
rename to 3rdparty/CGAL/include/CGAL/exude_mesh_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/float.h b/3rdparty/CGAL/include/CGAL/float.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/float.h
rename to 3rdparty/CGAL/include/CGAL/float.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/function_objects.h b/3rdparty/CGAL/include/CGAL/function_objects.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/function_objects.h
rename to 3rdparty/CGAL/include/CGAL/function_objects.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/functions_on_enums.h b/3rdparty/CGAL/include/CGAL/functions_on_enums.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/functions_on_enums.h
rename to 3rdparty/CGAL/include/CGAL/functions_on_enums.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/functions_on_signs.h b/3rdparty/CGAL/include/CGAL/functions_on_signs.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/functions_on_signs.h
rename to 3rdparty/CGAL/include/CGAL/functions_on_signs.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/generators.h b/3rdparty/CGAL/include/CGAL/generators.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/generators.h
rename to 3rdparty/CGAL/include/CGAL/generators.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/generic_sweep.h b/3rdparty/CGAL/include/CGAL/generic_sweep.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/generic_sweep.h
rename to 3rdparty/CGAL/include/CGAL/generic_sweep.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/gl.h b/3rdparty/CGAL/include/CGAL/gl.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/gl.h
rename to 3rdparty/CGAL/include/CGAL/gl.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/global_functions_circular_kernel_2.h b/3rdparty/CGAL/include/CGAL/global_functions_circular_kernel_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/global_functions_circular_kernel_2.h
rename to 3rdparty/CGAL/include/CGAL/global_functions_circular_kernel_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/global_functions_on_root_for_sphere_2_3.h b/3rdparty/CGAL/include/CGAL/global_functions_on_root_for_sphere_2_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/global_functions_on_root_for_sphere_2_3.h
rename to 3rdparty/CGAL/include/CGAL/global_functions_on_root_for_sphere_2_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/global_functions_on_roots_and_polynomials_1_3.h b/3rdparty/CGAL/include/CGAL/global_functions_on_roots_and_polynomials_1_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/global_functions_on_roots_and_polynomials_1_3.h
rename to 3rdparty/CGAL/include/CGAL/global_functions_on_roots_and_polynomials_1_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/global_functions_on_roots_and_polynomials_2_3.h b/3rdparty/CGAL/include/CGAL/global_functions_on_roots_and_polynomials_2_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/global_functions_on_roots_and_polynomials_2_3.h
rename to 3rdparty/CGAL/include/CGAL/global_functions_on_roots_and_polynomials_2_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/global_functions_spherical_kernel_3.h b/3rdparty/CGAL/include/CGAL/global_functions_spherical_kernel_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/global_functions_spherical_kernel_3.h
rename to 3rdparty/CGAL/include/CGAL/global_functions_spherical_kernel_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/glu.h b/3rdparty/CGAL/include/CGAL/glu.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/glu.h
rename to 3rdparty/CGAL/include/CGAL/glu.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/gmp.h b/3rdparty/CGAL/include/CGAL/gmp.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/gmp.h
rename to 3rdparty/CGAL/include/CGAL/gmp.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/gmpxx.h b/3rdparty/CGAL/include/CGAL/gmpxx.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/gmpxx.h
rename to 3rdparty/CGAL/include/CGAL/gmpxx.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/gmpxx_coercion_traits.h b/3rdparty/CGAL/include/CGAL/gmpxx_coercion_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/gmpxx_coercion_traits.h
rename to 3rdparty/CGAL/include/CGAL/gmpxx_coercion_traits.h
diff --git a/3rdparty/CGAL/include/CGAL/gnuplot_output_2.h b/3rdparty/CGAL/include/CGAL/gnuplot_output_2.h
new file mode 100644
index 0000000..5e206b5
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/gnuplot_output_2.h
@@ -0,0 +1,246 @@
+// Copyright (c) 2013-2015  The University of Western Sydney, Australia.
+// 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
+// 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(s): Quincy Tse, Weisheng Si
+
+/*! \file gnuplot_output_2.h
+ *
+ * This header implements the function that can generate data and script files for plotting
+ * graphs by Gnuplot. This function requires that graphs be represented by boost::adjacency_list
+ * with its template parameter VertexProperties set to CGAL::Point_2.
+ */
+
+#ifndef GNUPLOT_OUTPUT_2_H
+#define GNUPLOT_OUTPUT_2_H
+
+#include <iostream>
+#include <sstream>
+#include <fstream>
+#include <string>
+#include <stdexcept>
+
+#include <boost/config.hpp>
+#include <boost/graph/adjacency_list.hpp>
+
+namespace CGAL {
+
+/*  ------ Declarations go first, then implementations follow.   ------ */
+
+/*!
+*  \ingroup PkgConeBasedSpanners
+*  \brief Output a set of files used by Gnuplot to plot `g`.
+*
+*  The files that are generated for Gnuplot are:
+*  (1) prefix.v (vertex list)
+*  (2) prefix.plt (Gnuplot script), This script will read
+*      prefix.v as input to plot the vertex list. The edge list is also
+*      included in this script.
+*
+*  Notes:
+*  (1) If these files already exists, this function will overwrite these
+*      files.
+*  (2) Parallel and self-edges cannot be plotted.
+*
+*  \tparam Graph  The type of the graph to be plotted. For this function to work,
+*                 the graph type must be `boost::adjacency_list` with `CGAL::Point_2`
+*                 as the `VertexProperties`.
+*
+*  \param g       A `boost::adjacency_list` graph with `CGAL::Point_2` as the VertexProperties to be plotted
+*  \param prefix  The prefix of the output files names
+*/
+template <typename Graph>
+void gnuplot_output_2 (const Graph& g, const std::string& prefix);
+
+/*
+*  \brief Compiles a multi-lined %string to draw the edges in \p g by Gnuplot.
+*  Compiles an edge list in the following format:
+*
+*  set arrow from (start x, start y) to (end x, end y)
+*   ...
+*
+*  NOTE: For undirected graphs, use "set style arrow nohead"; for directed graphs,
+*        use "set style arrow head"
+*
+*  \param g  A boost::adjacency_list graph with CGAL::Point_2 as the VertexProperties to be plotted
+*  \return   The edge list string.
+*/
+template <typename Graph>
+std::string gnuplot_edge_list (const Graph& g);
+
+/*
+*  \brief Compiles a multi-lined %string representing the vertices in \p g.
+*
+* Compiles a vertex list in the following format:
+*  x  y
+*  x  y
+*  ...
+*
+*  \param g  A boost::adjacency_list graph with CGAL::Point_2 as the VertexProperties to be plotted
+*  \return   The vertex list string.
+*/
+template <typename Graph>
+std::string gnuplot_vertex_list (const Graph& g);
+
+/* This struct is defined to use partial specialization to generate arrow styles differently for
+ * directed and undirected graphs.
+ * Note: Need to use structs because C++ before 11 doesn't allow partial specialisation
+ * for functions
+ */
+template <typename Graph, typename Directedness=typename Graph::directed_selector>
+struct Gnuplot_edges_2;
+
+/* -------   IMPLEMENTATIONS  ------- */
+
+template <typename Graph>
+std::string gnuplot_edge_list (const Graph& g)
+{
+    std::stringstream ss;
+    ss.precision(3);
+    ss << std::fixed;  // Use fixed floating-point notation
+
+    typename Graph::edge_iterator eit, ee;
+    for (boost::tie(eit, ee) = boost::edges(g); eit != ee; ++eit) {
+        typename Graph::vertex_descriptor src = boost::source(*eit, g);
+        typename Graph::vertex_descriptor end = boost::target(*eit, g);
+        ss << "set arrow from ";
+        ss << to_double(g[src].x()) << "," << to_double(g[src].y());
+        ss << " to ";
+        ss << to_double(g[end].x()) << "," << to_double(g[end].y());
+        ss << " as 1" << std::endl;
+    }
+    return ss.str();
+}
+
+// Common regardless of whether g is directed.
+template <typename Graph>
+std::string gnuplot_vertex_list(const Graph& g) {
+    std::stringstream ss;
+    ss.precision(3);
+    ss << std::fixed;
+
+    typename Graph::vertex_iterator vit, ve;
+    for (boost::tie(vit, ve) = boost::vertices(g); vit != ve; ++vit) {
+        ss << to_double(g[*vit].x()) << "  " << to_double(g[*vit].y()) << std::endl;
+    }
+    return ss.str();
+}
+
+template <typename Graph>
+void gnuplot_output_2 (const Graph& g, const std::string& prefix)
+{
+    // Generate the vertex list to the .v file
+    std::ofstream fs((prefix + ".v").c_str(),
+                     std::ofstream::out | std::ofstream::trunc);
+    fs << gnuplot_vertex_list(g);
+    fs.close();
+    std::cout << prefix << ".v" << " is generated. " << std::endl;
+
+    // Generate the Gnuplot Script to the .plt file
+    fs.open((prefix + ".plt").c_str(),
+            std::ofstream::out | std::ofstream::trunc);
+    fs << "set term ";
+    //  Choose one:
+    fs << "wxt ";
+    // fs << "postscript eps ";
+
+    fs << "font \", 9\" enhanced" << std::endl;
+
+    //  Uncomment if eps:
+    // fs << "set output \"" << prefix << ".eps\"" << std::endl;
+
+    fs << "set title" << std::endl;
+    fs << "set xlabel  # when no options, clear the xlabel" << std::endl;
+    fs << "set ylabel" << std::endl;
+    fs << "unset key" << std::endl;
+    fs << "set size square" << std::endl;
+    fs << "unset xtics" << std::endl;
+    fs << "unset ytics" << std::endl;
+    fs << "unset border" << std::endl;
+
+    /* Uncomment if you need the following:
+    ss << "set xtics" << std::endl;
+    ss << "set ytics" << std::endl;
+    ss << "set border" << std::endl;
+    ss << "set grid xtics ytics" << std::endl;
+    */
+
+    fs << std::endl;
+    // Specific part that depends on whether g is directed
+    fs << Gnuplot_edges_2<Graph>::gnuplot_edge_script(g);
+    fs << std::endl;
+
+    // plot the vertices
+    fs << "plot \"" << prefix << ".v\" with points pt 7 ps 0.8 lt rgb \"blue\"" << std::endl;
+
+    //  Uncomment if wxt and also want eps output:
+    //  fs << "set term postscript eps " << std::endl;
+    //  fs << "set output \"" << prefix << ".eps\"" << std::endl;
+    //  fs << "replot" << std::endl;
+
+    fs.close();
+    std::cout << prefix << ".plt" << " is generated. " << std::endl;
+}
+
+// directed graphs
+/* Writing edge list to the gnuplot script for directed graphs */
+template <typename Graph>
+struct Gnuplot_edges_2<Graph, boost::directedS> {
+
+    // Uses "set style arrow 1 head" to draw directed edges
+    // Edges are written directly into the script file.
+    static std::string gnuplot_edge_script(const Graph& g)
+    {
+        std::stringstream ss;
+
+        ss << "set style arrow 1 head filled lc rgb \"black\"" << std::endl;
+        ss << std::endl;
+        ss << "# edges" << std::endl;
+        ss << gnuplot_edge_list(g);
+        ss << "# end of edges" << std::endl;
+
+        return ss.str();
+    }
+};
+
+// Bidirectional graph, the same as the directed graph.
+/* Writing edge list to the gnuplot script for bidirectional graphs */
+template <typename Graph>
+struct Gnuplot_edges_2<Graph, boost::bidirectionalS> : public Gnuplot_edges_2<Graph, boost::directedS> {};
+
+// Undirected graphs
+/* Writing edge list to the gnuplot script for undirected graphs */
+template <typename Graph>
+struct Gnuplot_edges_2<Graph, boost::undirectedS> {
+
+    static std::string gnuplot_edge_script(const Graph& g)
+    {
+        std::stringstream ss;
+        ss << "set style arrow 1 nohead lc rgb \"black\"" << std::endl;
+        ss << std::endl;
+        ss << "# edges" << std::endl;
+        ss << gnuplot_edge_list(g);
+        ss << "# end of edges" << std::endl;
+
+        return ss.str();
+    }
+
+};
+
+}  // namespace CGAL
+
+#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/grabbers.h b/3rdparty/CGAL/include/CGAL/grabbers.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/grabbers.h
rename to 3rdparty/CGAL/include/CGAL/grabbers.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/graph_traits_Arrangement_2.h b/3rdparty/CGAL/include/CGAL/graph_traits_Arrangement_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/graph_traits_Arrangement_2.h
rename to 3rdparty/CGAL/include/CGAL/graph_traits_Arrangement_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/graph_traits_Dual_Arrangement_2.h b/3rdparty/CGAL/include/CGAL/graph_traits_Dual_Arrangement_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/graph_traits_Dual_Arrangement_2.h
rename to 3rdparty/CGAL/include/CGAL/graph_traits_Dual_Arrangement_2.h
diff --git a/3rdparty/CGAL/include/CGAL/grid_simplify_point_set.h b/3rdparty/CGAL/include/CGAL/grid_simplify_point_set.h
new file mode 100644
index 0000000..2102b8b
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/grid_simplify_point_set.h
@@ -0,0 +1,222 @@
+// Copyright (c) 2007-09  INRIA Sophia-Antipolis (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
+// 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(s) : Nader Salman and Laurent Saboret 
+
+#ifndef CGAL_GRID_SIMPLIFY_POINT_SET_H
+#define CGAL_GRID_SIMPLIFY_POINT_SET_H
+
+#include <CGAL/property_map.h>
+#include <CGAL/Kernel_traits.h>
+#include <CGAL/point_set_processing_assertions.h>
+
+#include <iterator>
+#include <set>
+#include <deque>
+#include <algorithm>
+#include <cmath>
+
+namespace CGAL {
+
+
+// ----------------------------------------------------------------------------
+// Private section
+// ----------------------------------------------------------------------------
+/// \cond SKIP_IN_MANUAL
+
+namespace internal {
+
+
+/// Utility class for grid_simplify_point_set():
+/// Less_epsilon_points_3 defines a 3D points order / 2 points are equal
+/// iff they belong to the same cell of a grid of cell size = epsilon.
+template <class Point_3, class PointPMap>
+struct Less_epsilon_points_3
+{
+private:
+
+    double m_epsilon;
+    PointPMap point_pmap;
+    typedef typename boost::property_traits<PointPMap>::value_type Point;
+public:
+
+    Less_epsilon_points_3 (double epsilon, PointPMap p_pmap) 
+        : m_epsilon (epsilon), point_pmap(p_pmap)
+    {
+        CGAL_point_set_processing_precondition(epsilon > 0);
+    }
+
+    bool operator() (const Point_3& a, const Point_3& b) const
+    {
+        // Round points to multiples of m_epsilon, then compare.
+        return round_epsilon( get(point_pmap,a), m_epsilon ) <
+               round_epsilon( get(point_pmap,b), m_epsilon );
+    }
+
+private:
+
+    // Round number to multiples of epsilon
+    static inline double round_epsilon(double value, double epsilon)
+    {
+        return std::floor(value/epsilon) * epsilon;
+    }
+
+    static inline Point round_epsilon(const Point& p, double epsilon)
+    {
+        return Point( round_epsilon(p.x(), epsilon),
+                      round_epsilon(p.y(), epsilon),
+                      round_epsilon(p.z(), epsilon) );
+    }
+};
+
+
+
+} /* namespace internal */
+
+
+// ----------------------------------------------------------------------------
+// Public section
+// ----------------------------------------------------------------------------
+
+
+/// Utility class for grid_simplify_point_set():
+/// 3D points set which allows at most 1 point per cell
+/// of a grid of cell size = epsilon.
+///
+/// Warning:
+/// This class is a container sorted wrt points position
+/// => you should not modify directly the order or the position of points.
+
+template <class Point_3, class PointPMap>
+class Epsilon_point_set_3
+  : public std::set<Point_3, internal::Less_epsilon_points_3<Point_3, PointPMap> >
+{
+private:
+
+    // superclass
+    typedef std::set<Point_3, internal::Less_epsilon_points_3<Point_3, PointPMap> > Base;
+
+public:
+
+    Epsilon_point_set_3 (double epsilon, PointPMap point_pmap)
+        : Base( internal::Less_epsilon_points_3<Point_3, PointPMap>(epsilon, point_pmap) )
+    {
+        CGAL_point_set_processing_precondition(epsilon > 0);
+    }
+
+    // default copy constructor, operator =() and destructor are fine.
+};
+
+/// \endcond
+
+/// \ingroup PkgPointSetProcessing
+/// Merges points which belong to the same cell of a grid of cell size = `epsilon`.
+///
+/// This method modifies the order of input points so as to pack all remaining points first,
+/// and returns an iterator over the first point to remove (see erase-remove idiom).
+/// For this reason it should not be called on sorted containers.
+///
+/// \pre `epsilon > 0`
+///
+/// @tparam ForwardIterator iterator over input points.
+/// @tparam PointPMap is a model of `ReadablePropertyMap` with value type `Point_3<Kernel>`.
+///        It can be omitted if the value type of `ForwardIterator` is convertible to `Point_3<Kernel>`.
+/// @tparam Kernel Geometric traits class.
+///        It can be omitted and deduced automatically from the value type of `PointPMap`.
+///
+/// @return iterator over the first point to remove.
+
+// This variant requires all parameters.
+template <typename ForwardIterator,
+          typename PointPMap,
+          typename Kernel>
+ForwardIterator grid_simplify_point_set(
+  ForwardIterator first,  ///< iterator over the first input point.
+  ForwardIterator beyond, ///< past-the-end iterator over the input points.
+  PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3
+  double epsilon, ///< tolerance value when merging 3D points.
+  const Kernel& /*kernel*/) ///< geometric traits.
+{
+  // actual type of input points
+  typedef typename std::iterator_traits<ForwardIterator>::value_type Enriched_point;
+
+  CGAL_point_set_processing_precondition(epsilon > 0);
+
+  // Merges points which belong to the same cell of a grid of cell size = epsilon.
+  // points_to_keep[] will contain 1 point per cell; the others will be in points_to_remove[].
+  Epsilon_point_set_3<Enriched_point, PointPMap> points_to_keep(epsilon, point_pmap);
+  std::deque<Enriched_point> points_to_remove;
+  for (ForwardIterator it=first ; it != beyond ; it++)
+  {
+      std::pair<typename Epsilon_point_set_3<Enriched_point, PointPMap>::iterator,bool> result;
+      result = points_to_keep.insert(*it);
+      if (!result.second) // if not inserted
+        points_to_remove.push_back(*it);
+  }
+
+  // Replaces `[first, beyond)` range by the content of points_to_keep, then points_to_remove.
+  ForwardIterator first_point_to_remove =
+    std::copy(points_to_keep.begin(), points_to_keep.end(), first);
+    std::copy(points_to_remove.begin(), points_to_remove.end(), first_point_to_remove);
+
+  return first_point_to_remove;
+}
+
+/// @cond SKIP_IN_MANUAL
+// This variant deduces the kernel from the iterator type.
+template <typename ForwardIterator,
+          typename PointPMap
+>
+ForwardIterator
+grid_simplify_point_set(
+  ForwardIterator first, ///< iterator over the first input point
+  ForwardIterator beyond, ///< past-the-end iterator
+  PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3
+  double epsilon) ///< tolerance value when merging 3D points
+{
+  typedef typename boost::property_traits<PointPMap>::value_type Point;
+  typedef typename Kernel_traits<Point>::Kernel Kernel;
+  return grid_simplify_point_set(
+    first,beyond,
+    point_pmap,
+    epsilon,
+    Kernel());
+}
+/// @endcond
+
+/// @cond SKIP_IN_MANUAL
+// This variant creates a default point property map = Identity_property_map.
+template <typename ForwardIterator
+>
+ForwardIterator
+grid_simplify_point_set(
+  ForwardIterator first, ///< iterator over the first input point
+  ForwardIterator beyond, ///< past-the-end iterator
+  double epsilon) ///< tolerance value when merging 3D points
+{
+  return grid_simplify_point_set(
+    first,beyond,
+    make_identity_property_map(
+    typename std::iterator_traits<ForwardIterator>::value_type()),
+    epsilon);
+}
+/// @endcond
+
+
+} //namespace CGAL
+
+#endif // CGAL_GRID_SIMPLIFY_POINT_SET_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/halfedgeDS_cut_component.h b/3rdparty/CGAL/include/CGAL/halfedgeDS_cut_component.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/halfedgeDS_cut_component.h
rename to 3rdparty/CGAL/include/CGAL/halfedgeDS_cut_component.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/halfedgeds_connected_components.h b/3rdparty/CGAL/include/CGAL/halfedgeds_connected_components.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/halfedgeds_connected_components.h
rename to 3rdparty/CGAL/include/CGAL/halfedgeds_connected_components.h
diff --git a/3rdparty/CGAL/include/CGAL/hash_openmesh.h b/3rdparty/CGAL/include/CGAL/hash_openmesh.h
new file mode 100644
index 0000000..7d12891
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/hash_openmesh.h
@@ -0,0 +1,115 @@
+// Copyright (c) 2016  GeometryFactory (France).  All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Andreas Fabri
+
+#ifndef CGAL_HASH_OPENMESH_H
+#define CGAL_HASH_OPENMESH_H
+
+#include <OpenMesh/Core/Mesh/Handles.hh>
+
+#if OM_VERSION < 0x60200
+
+namespace OpenMesh {
+
+inline std::size_t hash_value(const BaseHandle& h) { return h.idx(); }
+
+} // namespace OpenMesh
+#endif
+
+
+#ifndef OM_HAS_HASH
+
+#include <functional>
+
+
+namespace std {
+
+#if defined(BOOST_MSVC)
+#  pragma warning(push)
+#  pragma warning(disable:4099) // For VC10 it is class hash 
+#endif
+
+#ifndef CGAL_CFG_NO_STD_HASH
+
+template <>
+struct hash<OpenMesh::BaseHandle >
+  : public std::unary_function<OpenMesh::BaseHandle, std::size_t>
+{
+
+  std::size_t operator()(const OpenMesh::BaseHandle& h) const
+  {
+    return h.idx();
+  }
+};
+
+template <>
+struct hash<OpenMesh::VertexHandle >
+  : public std::unary_function<OpenMesh::VertexHandle, std::size_t>
+{
+
+  std::size_t operator()(const OpenMesh::VertexHandle& h) const
+  {
+    return h.idx();
+  }
+};
+
+template <>
+struct hash<OpenMesh::HalfedgeHandle >
+  : public std::unary_function<OpenMesh::HalfedgeHandle, std::size_t>
+{
+
+  std::size_t operator()(const OpenMesh::HalfedgeHandle& h) const
+  {
+    return h.idx();
+  }
+};
+
+template <>
+struct hash<OpenMesh::EdgeHandle >
+  : public std::unary_function<OpenMesh::EdgeHandle, std::size_t>
+{
+
+  std::size_t operator()(const OpenMesh::EdgeHandle& h) const
+  {
+    return h.idx();
+  }
+};
+
+template <>
+struct hash<OpenMesh::FaceHandle >
+  : public std::unary_function<OpenMesh::FaceHandle, std::size_t>
+{
+
+  std::size_t operator()(const OpenMesh::FaceHandle& h) const
+  {
+    return h.idx();
+  }
+};
+
+#endif // CGAL_CFG_NO_STD_HASH
+
+#if defined(BOOST_MSVC)
+#  pragma warning(pop)
+#endif
+
+} // namespace std
+
+
+#endif  // OM_HAS_HASH
+
+#endif // CGAL_HASH_OPENMESH_H
diff --git a/3rdparty/CGAL/include/CGAL/hierarchy_simplify_point_set.h b/3rdparty/CGAL/include/CGAL/hierarchy_simplify_point_set.h
new file mode 100644
index 0000000..c2fb829
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/hierarchy_simplify_point_set.h
@@ -0,0 +1,364 @@
+// Copyright (c) 2012  INRIA Sophia-Antipolis (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
+// 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(s) : Simon Giraudot, Pierre Alliez
+
+
+#ifndef HIERARCHY_SIMPLIFY_POINT_SET_H
+#define HIERARCHY_SIMPLIFY_POINT_SET_H
+
+#include <cmath>
+#include <stack>
+
+#include <CGAL/property_map.h>
+#include <CGAL/basic.h>
+#include <CGAL/Dimension.h>
+#include <CGAL/Object.h>
+#include <CGAL/centroid.h>
+#include <CGAL/point_set_processing_assertions.h>
+#include <CGAL/Default_diagonalize_traits.h>
+#include <CGAL/PCA_util.h>
+
+namespace CGAL {
+
+
+  namespace internal {
+
+    template < typename InputIterator,
+	       typename PointPMap,
+	       typename K >
+    typename K::Point_3
+    hsps_centroid(InputIterator begin, 
+		 InputIterator end,
+		 PointPMap& point_pmap,	     
+		 const K&)
+    {
+      typedef typename K::Point_3 Point;
+      typedef typename K::FT FT;
+
+      CGAL_precondition(begin != end);
+
+      FT x = (FT)0., y = (FT)0., z = (FT)0.;
+      unsigned int nb_pts = 0;
+      while(begin != end) 
+	{
+	  typename boost::property_traits<PointPMap>::reference point =
+            get(point_pmap, *begin);
+	  x += point.x ();  y += point.y ();  z += point.z ();
+	  ++ nb_pts;
+	  ++ begin;
+	}
+      return Point (x/nb_pts, y/nb_pts, z/nb_pts);
+    }
+
+    template < typename Input_type,
+	       typename PointPMap,
+	       typename K >
+    void
+    hsc_terminate_cluster (std::list<Input_type>& cluster,
+			   std::list<Input_type>& points_to_keep,
+			   std::list<Input_type>& points_to_remove,
+			   PointPMap& point_pmap,
+			   const typename K::Point_3& centroid,
+			   const K&)
+    {
+      typedef typename std::list<Input_type>::iterator Iterator;
+      typedef typename K::FT FT;
+
+      FT dist_min = (std::numeric_limits<FT>::max)();
+
+      typename std::list<Input_type>::iterator point_min;
+      for (Iterator it = cluster.begin (); it != cluster.end (); ++ it)
+	{
+	  FT dist = CGAL::squared_distance (get(point_pmap, *it), centroid);
+	  if (dist < dist_min)
+	    {
+	      dist_min = dist;
+	      point_min = it;
+	    }
+	}
+
+      points_to_keep.splice (points_to_keep.end (), cluster, point_min);
+      points_to_remove.splice (points_to_remove.end (), cluster, cluster.begin (), cluster.end ());
+    }			       
+			    
+
+
+
+  } // namespace internal
+    
+
+  /// \ingroup PkgPointSetProcessing
+  
+  /// Recursively split the point set in smaller clusters until the
+  /// clusters have less than `size` elements or until their variation
+  /// factor is below `var_max`. 
+  ///
+  /// This method modifies the order of input points so as to pack all remaining points first,
+  /// and returns an iterator over the first point to remove (see erase-remove idiom).
+  /// For this reason it should not be called on sorted containers.
+  ///
+  /// \pre `0 < var_max < 1/3`
+  /// \pre `size > 0`
+  ///
+  /// @tparam ForwardIterator iterator over input points.
+  /// @tparam PointPMap is a model of `ReadablePropertyMap` with value type `Point_3<Kernel>`.
+  ///        It can be omitted if the value type of `ForwardIterator` is convertible to `Point_3<Kernel>`.
+  /// @tparam DiagonalizeTraits is a model of `DiagonalizeTraits`. It
+  ///        can be omitted: if Eigen 3 (or greater) is available and
+  ///        `CGAL_EIGEN3_ENABLED` is defined then an overload using
+  ///        `Eigen_diagonalize_traits` is provided. Otherwise, the internal
+  ///        implementation `Internal_diagonalize_traits` is used.
+  /// @tparam Kernel Geometric traits class.
+  ///        It can be omitted and deduced automatically from the value type of `PointPMap`.
+  ///
+  /// @return iterator over the first point to remove.
+
+
+  // This variant requires all parameters.
+
+  template <typename ForwardIterator,
+	    typename PointPMap,
+	    typename DiagonalizeTraits,
+	    typename Kernel>
+  ForwardIterator hierarchy_simplify_point_set (ForwardIterator begin,
+						ForwardIterator end,
+						PointPMap point_pmap,
+						const unsigned int size,
+						const double var_max,
+						const DiagonalizeTraits&,
+						const Kernel&)
+  {
+    typedef typename std::iterator_traits<ForwardIterator>::value_type Input_type;
+    typedef typename Kernel::FT FT;
+    typedef typename Kernel::Point_3  Point;
+    typedef typename Kernel::Vector_3 Vector;
+
+    // We define a cluster as a point set + its centroid (useful for
+    // faster computations of centroids - to be implemented)
+    typedef std::pair< std::list<Input_type>, Point > cluster;
+
+    std::list<cluster> clusters_stack;
+    typedef typename std::list<cluster>::iterator cluster_iterator;
+
+    CGAL_precondition (begin != end);
+    CGAL_point_set_processing_precondition (size > 0);
+    CGAL_point_set_processing_precondition (var_max > 0.0);
+
+    // The first cluster is the whole input point set
+    clusters_stack.push_front (cluster (std::list<Input_type>(), Point (0., 0., 0.)));
+    std::copy (begin, end, std::back_inserter (clusters_stack.front ().first));
+    
+    clusters_stack.front ().second = internal::hsps_centroid (clusters_stack.front ().first.begin (),
+							     clusters_stack.front ().first.end (),
+							     point_pmap, Kernel());
+
+    std::list<Input_type> points_to_keep;
+    std::list<Input_type> points_to_remove;
+    
+    while (!(clusters_stack.empty ()))
+      {
+	cluster_iterator current_cluster = clusters_stack.begin ();
+
+	// If the cluster only has 1 element, we add it to the list of
+	// output points
+	if (current_cluster->first.size () == 1)
+	  {
+	    points_to_keep.splice (points_to_keep.end (), current_cluster->first,
+				   current_cluster->first.begin ());
+	    clusters_stack.pop_front ();
+	    continue;
+	  }
+
+	// Compute the covariance matrix of the set
+	cpp11::array<FT, 6> covariance = {{ 0., 0., 0., 0., 0., 0. }};
+
+	for (typename std::list<Input_type>::iterator it = current_cluster->first.begin ();
+	     it != current_cluster->first.end (); ++ it)
+	  {
+	    const Point& point = get(point_pmap, *it);
+	    Vector d = point - current_cluster->second;
+	    covariance[0] += d.x () * d.x ();
+	    covariance[1] += d.x () * d.y ();
+	    covariance[2] += d.x () * d.z ();
+	    covariance[3] += d.y () * d.y ();
+	    covariance[4] += d.y () * d.z ();
+	    covariance[5] += d.z () * d.z ();
+	  }
+
+	cpp11::array<FT, 3> eigenvalues = {{ 0., 0., 0. }};
+	cpp11::array<FT, 9> eigenvectors = {{ 0., 0., 0.,
+					      0., 0., 0.,
+					      0., 0., 0. }};
+	// Linear algebra = get eigenvalues and eigenvectors for
+	// PCA-like analysis
+	DiagonalizeTraits::diagonalize_selfadjoint_covariance_matrix
+	  (covariance, eigenvalues, eigenvectors);
+	
+	// Variation of the set defined as lambda_min / (lambda_0 + lambda_1 + lambda_2)
+	double var = eigenvalues[0] / (eigenvalues[0] + eigenvalues[1] + eigenvalues[2]);
+
+	// Split the set if size OR variance of the cluster is too large
+	if (current_cluster->first.size () > size || var > var_max)
+	  {
+	    clusters_stack.push_front (cluster (std::list<Input_type>(), Point (0., 0., 0.)));
+	    cluster_iterator negative_side = clusters_stack.begin ();
+	    // positive_side is built directly from current_cluster
+	    
+	    // The plane which splits the point set into 2 point sets:
+	    //  * Normal to the eigenvector with highest eigenvalue
+	    //  * Passes through the centroid of the set
+	    Vector v (eigenvectors[6], eigenvectors[7], eigenvectors[8]);
+
+	    std::size_t current_cluster_size = 0;
+	    typename std::list<Input_type>::iterator it = current_cluster->first.begin ();
+	    while (it != current_cluster->first.end ())
+	      {
+		typename std::list<Input_type>::iterator current = it ++;
+                const Point& point = get(point_pmap, *current);
+
+		// Test if point is on negative side of plane and
+		// transfer it to the negative_side cluster if it is
+		if (Vector (current_cluster->second, point) * v < 0)
+		  negative_side->first.splice (negative_side->first.end (),
+					       current_cluster->first, current);
+		++ current_cluster_size;
+	      }
+
+	    // If one of the clusters is empty, stop to avoid infinite
+	    // loop and keep the non-empty one
+	    if (current_cluster->first.empty () || negative_side->first.empty ())
+	      {
+		cluster_iterator nonempty = (current_cluster->first.empty ()
+					     ? negative_side : current_cluster);
+
+		// Compute the centroid
+		nonempty->second = internal::hsps_centroid (nonempty->first.begin (),
+							    nonempty->first.end (),
+							    point_pmap, Kernel());
+		
+		internal::hsc_terminate_cluster (nonempty->first,
+						 points_to_keep,
+						 points_to_remove,
+						 point_pmap,
+						 nonempty->second,
+						 Kernel ());
+		clusters_stack.pop_front ();
+		clusters_stack.pop_front ();
+	      }
+	    else
+	      {
+		// Save old centroid for faster computation
+		Point old_centroid = current_cluster->second;
+		
+		// Compute the first centroid
+		current_cluster->second = internal::hsps_centroid (current_cluster->first.begin (),
+								   current_cluster->first.end (),
+								   point_pmap, Kernel());
+
+		// The second centroid can be computed with the first and
+		// the old ones :
+		// centroid_neg = (n_total * old_centroid - n_pos * first_centroid)
+		//                 / n_neg;
+		negative_side->second = Point ((current_cluster_size * old_centroid.x ()
+						- current_cluster->first.size () * current_cluster->second.x ())
+					       / negative_side->first.size (),
+					       (current_cluster_size * old_centroid.y ()
+						- current_cluster->first.size () * current_cluster->second.y ())
+					       / negative_side->first.size (),
+					       (current_cluster_size * old_centroid.z ()
+						- current_cluster->first.size () * current_cluster->second.z ())
+					       / negative_side->first.size ());
+	      }
+	  }
+	// If the size/variance are small enough, add the centroid as
+	// and output point
+	else
+	  {
+	    internal::hsc_terminate_cluster (current_cluster->first,
+					     points_to_keep,
+					     points_to_remove,
+					     point_pmap,
+					     current_cluster->second,
+					     Kernel ());
+	    clusters_stack.pop_front ();
+	  }
+      }
+    ForwardIterator first_point_to_remove =
+      std::copy (points_to_keep.begin(), points_to_keep.end(), begin);
+    std::copy (points_to_remove.begin(), points_to_remove.end(), first_point_to_remove);
+
+    return first_point_to_remove;
+
+  }
+  /// @endcond
+
+
+  /// @cond SKIP_IN_MANUAL
+  // This variant deduces the kernel from the iterator type.
+  template <typename ForwardIterator,
+	    typename PointPMap,
+	    typename DiagonalizeTraits>
+  ForwardIterator hierarchy_simplify_point_set (ForwardIterator begin,
+						ForwardIterator end,
+						PointPMap point_pmap,
+						const unsigned int size,
+						const double var_max,
+						const DiagonalizeTraits& diagonalize_traits)
+  {
+    typedef typename boost::property_traits<PointPMap>::value_type Point;
+    typedef typename Kernel_traits<Point>::Kernel Kernel;
+    return hierarchy_simplify_point_set (begin, end, point_pmap, size, var_max,
+					 diagonalize_traits, Kernel());
+  }
+  /// @endcond
+
+  /// @cond SKIP_IN_MANUAL  
+  // This variant uses default diagonalize traits
+  template <typename ForwardIterator,
+	    typename PointPMap >
+  ForwardIterator hierarchy_simplify_point_set (ForwardIterator begin,
+						ForwardIterator end,
+						PointPMap point_pmap,
+						const unsigned int size,
+						const double var_max)
+  {
+    typedef typename boost::property_traits<PointPMap>::value_type Point;
+    typedef typename Kernel_traits<Point>::Kernel Kernel;
+    return hierarchy_simplify_point_set (begin, end, point_pmap, size, var_max,
+					 Default_diagonalize_traits<double, 3> (), Kernel());
+  }
+  /// @endcond  
+
+  /// @cond SKIP_IN_MANUAL
+  // This variant creates a default point property map = Identity_property_map.
+  template <typename ForwardIterator >
+  ForwardIterator hierarchy_simplify_point_set (ForwardIterator begin,
+						ForwardIterator end,
+						const unsigned int size = 10,
+						const double var_max = 0.333)
+  {
+    return hierarchy_simplify_point_set
+      (begin, end,
+       make_identity_property_map (typename std::iterator_traits<ForwardIterator>::value_type()),
+       size, var_max);
+  }
+  /// @endcond  
+
+} // namespace CGAL
+
+#endif // HIERARCHY_SIMPLIFY_POINT_SET_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/hilbert_sort.h b/3rdparty/CGAL/include/CGAL/hilbert_sort.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/hilbert_sort.h
rename to 3rdparty/CGAL/include/CGAL/hilbert_sort.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/hilbert_sort_on_sphere.h b/3rdparty/CGAL/include/CGAL/hilbert_sort_on_sphere.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/hilbert_sort_on_sphere.h
rename to 3rdparty/CGAL/include/CGAL/hilbert_sort_on_sphere.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/in_place_edge_list.h b/3rdparty/CGAL/include/CGAL/in_place_edge_list.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/in_place_edge_list.h
rename to 3rdparty/CGAL/include/CGAL/in_place_edge_list.h
diff --git a/3rdparty/CGAL/include/CGAL/int.h b/3rdparty/CGAL/include/CGAL/int.h
new file mode 100644
index 0000000..e90c6b7
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/int.h
@@ -0,0 +1,293 @@
+// Copyright (c) 1999,2007  
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved. 
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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(s)     : Stefan Schirra, Michael Hemmer
+
+
+#ifndef CGAL_INT_H
+#define CGAL_INT_H
+
+#include <CGAL/number_type_basic.h>
+#include <CGAL/Modular_traits.h>
+
+namespace CGAL {
+
+namespace INTERN_INT {
+    template< class Type >
+    class Is_square_per_double_conversion
+      : public std::binary_function< Type, Type&,
+                                bool > {
+      public:
+        bool operator()( const Type& x,
+                         Type& y ) const {
+          y = (Type) std::sqrt( (double)x );
+          return x == y * y;
+        }
+        bool operator()( const Type& x ) const {
+            Type y =
+                (Type) std::sqrt( (double)x );
+            return x == y * y;
+        }
+
+    };
+} // INTERN_INT
+
+// int
+template<> class Algebraic_structure_traits< int >
+  : public Algebraic_structure_traits_base< int, Euclidean_ring_tag > {
+
+  public:
+    typedef Tag_false            Is_exact;
+    typedef Tag_true             Is_numerical_sensitive;
+
+    typedef INTERN_AST::Div_per_operator< Type >  Div;
+    typedef INTERN_AST::Mod_per_operator< Type >  Mod;
+
+    typedef INTERN_INT::
+       Is_square_per_double_conversion< Type > Is_square;
+};
+
+template <> class Real_embeddable_traits< int >
+  : public INTERN_RET::Real_embeddable_traits_base< int , CGAL::Tag_true > {};
+
+/*! \ingroup CGAL_Modular_traits_spec
+  \brief Specialization of CGAL::Modular_traits for \c int.
+  
+  A model of concept ModularTraits, supports \c int. 
+*/
+  template <typename T>
+  class Modular_traits;
+
+template<>
+class Modular_traits<int>{
+public: 
+    typedef int NT;
+    typedef ::CGAL::Tag_true Is_modularizable;
+    typedef Residue Residue_type;
+ 
+    struct Modular_image{
+        Residue_type operator()(int i){
+            return Residue_type(i);
+        }
+    };    
+    struct Modular_image_representative{
+        NT operator()(const Residue_type& x){
+            return x.get_value();
+        }
+    };    
+};
+
+// long
+
+template<> class Algebraic_structure_traits< long int >
+  : public Algebraic_structure_traits_base< long int,
+                                            Euclidean_ring_tag > {
+
+  public:
+    typedef Tag_false            Is_exact;
+    typedef Tag_true           Is_numerical_sensitive;
+
+    typedef INTERN_AST::Div_per_operator< Type >  Div;
+    typedef INTERN_AST::Mod_per_operator< Type >  Mod;
+
+    typedef INTERN_INT::
+       Is_square_per_double_conversion< Type > Is_square;
+};
+
+template <> class Real_embeddable_traits< long int >
+  : public INTERN_RET::Real_embeddable_traits_base< long int , CGAL::Tag_true > {
+public:
+
+    class To_interval
+      : public std::unary_function< Type, std::pair< double, double > > {
+      public:
+        std::pair<double, double> operator()( const Type& x ) const {
+          return Interval_nt<true>(x).pair();
+        }
+    };
+};
+
+
+/*! \ingroup CGAL_Modular_traits_spec
+  \brief Specialization of CGAL::Modular_traits for \c long.
+  
+  A model of concept ModularTraits, supports \c long. 
+*/
+template<>
+class Modular_traits<long>{
+public: 
+    typedef long NT;
+    typedef ::CGAL::Tag_true Is_modularizable;
+    typedef Residue Residue_type;
+ 
+    struct Modular_image{
+        Residue_type operator()(long i){
+            return Residue_type(i);
+        }
+    };   
+    struct Modular_image_representative{
+        NT operator()(const Residue_type& x){
+            return NT(x.get_value());
+        }
+    };    
+};
+
+// short
+
+template<> class Algebraic_structure_traits< short int >
+  : public Algebraic_structure_traits_base< short int,
+                                            Euclidean_ring_tag > {
+
+  public:
+    typedef Tag_false            Is_exact;
+    typedef Tag_true             Is_numerical_sensitive;
+
+    // Explicitly defined functors which have no support for implicit
+    //  interoperability. This is nescessary because of the implicit conversion
+    //  to int for binary operations between short ints.
+    class Integral_division
+      : public std::binary_function< Type, Type,
+                                Type > {
+      public:
+        Type operator()( const Type& x,
+                                        const Type& y) const {
+          Algebraic_structure_traits<Type>::Div actual_div;
+          CGAL_precondition_msg( actual_div( x, y) * y == x,
+                  "'x' must be divisible by 'y' in "
+                  "Algebraic_structure_traits<...>::Integral_div()(x,y)" );
+          return actual_div( x, y);
+        }
+    };
+
+    class Gcd
+      : public std::binary_function< Type, Type,
+                                Type > {
+      public:
+        Type operator()( const Type& x,
+                                        const Type& y) const {
+          Algebraic_structure_traits<Type>::Mod mod;
+          Algebraic_structure_traits<Type>::Unit_part unit_part;
+          Algebraic_structure_traits<Type>::Integral_division integral_div;
+          // First: the extreme cases and negative sign corrections.
+          if (x == Type(0)) {
+              if (y == Type(0))
+                  return Type(0);
+              return integral_div( y, unit_part(y) );
+          }
+          if (y == Type(0))
+              return integral_div(x, unit_part(x) );
+          Type u = integral_div( x, unit_part(x) );
+          Type v = integral_div( y, unit_part(y) );
+          // Second: assuming mod is the most expensive op here, we don't compute it
+          // unnecessarily if u < v
+          if (u < v) {
+              v = mod(v,u);
+              // maintain invariant of v > 0 for the loop below
+              if ( v == Type(0) )
+                  return u;
+          }
+
+          Type w;
+          do {
+              w = mod(u,v);
+              if ( w == Type(0))
+                  return v;
+              u = mod(v,w);
+              if ( u == Type(0))
+                  return w;
+              v = mod(w,u);
+          } while (v != Type(0));
+          return u;
+        }
+    };
+
+    class Div_mod {
+      public:
+        typedef Type    first_argument_type;
+        typedef Type    second_argument_type;
+        typedef Type&   third_argument_type;
+        typedef Type&   fourth_argument_type;
+        typedef void  result_type;
+        void operator()( const Type& x,
+                         const Type& y,
+                         Type& q, Type& r) const {
+          q = Type(x / y);
+          r = Type(x % y);
+          CGAL_assertion(x == q * y + r);
+          return;
+        }
+    };
+
+    // based on \c Div_mod.
+    class Div
+      : public std::binary_function< Type, Type,
+                                Type > {
+      public:
+        Type operator()( const Type& x,
+                         const Type& y) const {
+          return Type(x / y);
+        };
+    };
+
+    // based on \c Div_mod.
+    class Mod
+      : public std::binary_function< Type, Type,
+                                Type > {
+      public:
+        Type operator()( const Type& x,
+                         const Type& y) const {
+          return Type(x % y);
+        };
+    };
+
+    typedef INTERN_INT::
+       Is_square_per_double_conversion< Type > Is_square;
+};
+
+template <> class Real_embeddable_traits< short int >
+  : public INTERN_RET::Real_embeddable_traits_base< short int , CGAL::Tag_true > {};
+
+// unsigned int
+
+template <> class Real_embeddable_traits< unsigned int >
+   : public INTERN_RET::Real_embeddable_traits_base< unsigned int , CGAL::Tag_true > {};
+
+// unsigned long
+
+template <> class Real_embeddable_traits< unsigned long >
+   : public INTERN_RET::Real_embeddable_traits_base< unsigned long , CGAL::Tag_true > {
+public:
+
+    class To_interval
+      : public std::unary_function< Type, std::pair< double, double > > {
+      public:
+        std::pair<double, double> operator()( const Type& x ) const {
+          return Interval_nt<true>(x).pair();
+        }
+    };
+};
+
+// Note : "long long" support is in <CGAL/long_long.h>
+
+} //namespace CGAL
+
+#endif // CGAL_INT_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/AABB_tree/AABB_drawing_traits.h b/3rdparty/CGAL/include/CGAL/internal/AABB_tree/AABB_drawing_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/AABB_tree/AABB_drawing_traits.h
rename to 3rdparty/CGAL/include/CGAL/internal/AABB_tree/AABB_drawing_traits.h
diff --git a/3rdparty/CGAL/include/CGAL/internal/AABB_tree/AABB_node.h b/3rdparty/CGAL/include/CGAL/internal/AABB_tree/AABB_node.h
new file mode 100644
index 0000000..d47056d
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/internal/AABB_tree/AABB_node.h
@@ -0,0 +1,202 @@
+// Copyright (c) 2008  INRIA Sophia-Antipolis (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
+// 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(s) : Camille Wormser, Pierre Alliez, Stephane Tayeb
+
+#ifndef CGAL_AABB_NODE_H
+#define CGAL_AABB_NODE_H
+
+#include <CGAL/Profile_counter.h>
+#include <CGAL/Cartesian_converter.h>
+#include <CGAL/intersections.h>
+#include <CGAL/Bbox_3.h>
+#include <vector>
+
+namespace CGAL {
+
+/**
+ * @class AABB_node
+ *
+ *
+ */
+template<typename AABBTraits>
+class AABB_node
+{
+public:
+  typedef typename AABBTraits::Bounding_box Bounding_box;
+
+  /// Constructor
+  AABB_node()
+    : m_bbox()
+    , m_p_left_child(NULL)
+    , m_p_right_child(NULL)      { };
+
+  /// Non virtual Destructor
+  /// Do not delete children because the tree hosts and delete them
+  ~AABB_node() { };
+
+  /// Returns the bounding box of the node
+  const Bounding_box& bbox() const { return m_bbox; }
+
+  /**
+   * @brief Builds the tree by recursive expansion.
+   * @param first the first primitive to insert
+   * @param last the last primitive to insert
+   * @param range the number of primitive of the range
+   *
+   * [first,last[ is the range of primitives to be added to the tree.
+   */
+  template<typename ConstPrimitiveIterator>
+  void expand(ConstPrimitiveIterator first,
+              ConstPrimitiveIterator beyond,
+              const std::size_t range,
+              const AABBTraits&);
+
+  /**
+   * @brief General traversal query
+   * @param query the query
+   * @param traits the traversal traits that define the traversal behaviour
+   * @param nb_primitives the number of primitive
+   *
+   * General traversal query. The traits class allows using it for the various
+   * traversal methods we need: listing, counting, detecting intersections,
+   * drawing the boxes.
+   */
+  template<class Traversal_traits, class Query>
+  void traversal(const Query& query,
+                 Traversal_traits& traits,
+                 const std::size_t nb_primitives) const;
+
+private:
+  typedef AABBTraits AABB_traits;
+  typedef AABB_node<AABB_traits> Node;
+  typedef typename AABB_traits::Primitive Primitive;
+
+
+public:
+  /// Helper functions
+  const Node& left_child() const
+                     { return *static_cast<Node*>(m_p_left_child); }
+  const Node& right_child() const
+                     { return *static_cast<Node*>(m_p_right_child); }
+  const Primitive& left_data() const
+                     { return *static_cast<Primitive*>(m_p_left_child); }
+  const Primitive& right_data() const
+                     { return *static_cast<Primitive*>(m_p_right_child); }
+
+private:
+  Node& left_child() { return *static_cast<Node*>(m_p_left_child); }
+  Node& right_child() { return *static_cast<Node*>(m_p_right_child); }
+  Primitive& left_data() { return *static_cast<Primitive*>(m_p_left_child); }
+  Primitive& right_data() { return *static_cast<Primitive*>(m_p_right_child); }
+
+private:
+  /// node bounding box
+  Bounding_box m_bbox;
+
+  /// children nodes, either pointing towards children (if children are not leaves),
+  /// or pointing toward input primitives (if children are leaves).
+  void *m_p_left_child;
+  void *m_p_right_child;
+
+private:
+  // Disabled copy constructor & assignment operator
+  typedef AABB_node<AABBTraits> Self;
+  AABB_node(const Self& src);
+  Self& operator=(const Self& src);
+
+};  // end class AABB_node
+
+
+template<typename Tr>
+template<typename ConstPrimitiveIterator>
+void
+AABB_node<Tr>::expand(ConstPrimitiveIterator first,
+                      ConstPrimitiveIterator beyond,
+                      const std::size_t range,
+                      const Tr& traits)
+{
+  m_bbox = traits.compute_bbox_object()(first, beyond);
+
+  // sort primitives along longest axis aabb
+  traits.sort_primitives_object()(first, beyond, m_bbox);
+
+  switch(range)
+  {
+  case 2:
+    m_p_left_child = &(*first);
+    m_p_right_child = &(*(++first));
+    break;
+  case 3:
+    m_p_left_child = &(*first);
+    m_p_right_child = static_cast<Node*>(this)+1;
+    right_child().expand(first+1, beyond, 2,traits);
+    break;
+  default:
+    const std::size_t new_range = range/2;
+    m_p_left_child = static_cast<Node*>(this) + 1;
+    m_p_right_child = static_cast<Node*>(this) + new_range;
+    left_child().expand(first, first + new_range, new_range,traits);
+    right_child().expand(first + new_range, beyond, range - new_range,traits);
+  }
+}
+
+
+template<typename Tr>
+template<class Traversal_traits, class Query>
+void
+AABB_node<Tr>::traversal(const Query& query,
+                         Traversal_traits& traits,
+                         const std::size_t nb_primitives) const
+{
+  // Recursive traversal
+  switch(nb_primitives)
+  {
+  case 2:
+    traits.intersection(query, left_data());
+    if( traits.go_further() )
+    {
+      traits.intersection(query, right_data());
+    }
+    break;
+  case 3:
+    traits.intersection(query, left_data());
+    if( traits.go_further() && traits.do_intersect(query, right_child()) )
+    {
+      right_child().traversal(query, traits, 2);
+    }
+    break;
+  default:
+    if( traits.do_intersect(query, left_child()) )
+    {
+      left_child().traversal(query, traits, nb_primitives/2);
+      if( traits.go_further() && traits.do_intersect(query, right_child()) )
+      {
+        right_child().traversal(query, traits, nb_primitives-nb_primitives/2);
+      }
+    }
+    else if( traits.do_intersect(query, right_child()) )
+    {
+      right_child().traversal(query, traits, nb_primitives-nb_primitives/2);
+    }
+  }
+}
+
+} // end namespace CGAL
+
+#endif // CGAL_AABB_NODE_H
diff --git a/3rdparty/CGAL/include/CGAL/internal/AABB_tree/AABB_ray_intersection.h b/3rdparty/CGAL/include/CGAL/internal/AABB_tree/AABB_ray_intersection.h
new file mode 100644
index 0000000..0733051
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/internal/AABB_tree/AABB_ray_intersection.h
@@ -0,0 +1,244 @@
+// Copyright (c) 2015 INRIA Sophia-Antipolis (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
+// 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(s) : Philipp Moeller
+//
+
+#ifndef CGAL_AABB_RAY_INTERSECTION_H
+#define CGAL_AABB_RAY_INTERSECTION_H
+
+#include <functional>
+#include <boost/optional.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/variant/apply_visitor.hpp>
+#if BOOST_VERSION >= 105000
+#include <boost/heap/priority_queue.hpp>
+#else
+#include <queue>
+#endif
+#include <CGAL/assertions.h>
+
+namespace CGAL {
+
+template<typename AABBTree, typename SkipFunctor>
+class AABB_ray_intersection {
+  typedef typename AABBTree::AABB_traits AABB_traits;
+  typedef typename AABB_traits::Ray_3 Ray;
+  typedef typename AABBTree::template Intersection_and_primitive_id<Ray>::Type Ray_intersection_and_primitive_id;
+  typedef typename Ray_intersection_and_primitive_id::first_type Ray_intersection;
+public:
+  AABB_ray_intersection(const AABBTree& tree) : tree_(tree) {}
+
+  boost::optional< Ray_intersection_and_primitive_id >
+  ray_intersection(const Ray& query, SkipFunctor skip) const {
+    // We hit the root, now continue on the children. Keep track of
+    // nb_primitives through a variable in each Node on the stack. In
+    // BVH_node::traversal this is done through the function parameter
+    // nb_primitives in the recursion.
+        typedef
+#if BOOST_VERSION >= 105000
+          boost::heap::priority_queue< Node_ptr_with_ft, boost::heap::compare< std::greater<Node_ptr_with_ft> > >
+#else
+          std::priority_queue< Node_ptr_with_ft>
+#endif
+          Heap_type;
+
+    typename AABB_traits::Intersection
+      intersection_obj = tree_.traits().intersection_object();
+    // typename AABB_traits::Do_intersect
+    //   do_intersect_obj = tree_.traits().do_intersect_object();
+    typename AABB_traits::Intersection_distance
+      intersection_distance_obj = tree_.traits().intersection_distance_object();
+    as_ray_param_visitor param_visitor = as_ray_param_visitor(&query);
+
+    Heap_type pq;
+    // pq.reserve(tree_.size() / 2);
+    boost::optional< Ray_intersection_and_primitive_id >
+      intersection, /* the temporary for calculating the result */
+      p; /* the current best intersection */
+
+    // this is not the right way to do it, but using
+    // numeric_limits<FT>::{max,infinity} will not work with Epeck.
+    FT t = (std::numeric_limits<double>::max)();
+    // Start with the root node.
+    pq.push(Node_ptr_with_ft(tree_.root_node(), 0, tree_.size()));
+
+    while(!pq.empty() && pq.top().value < t) {
+      Node_ptr_with_ft current = pq.top();
+      pq.pop();
+
+      switch(current.nb_primitives) { // almost copy-paste from BVH_node::traversal
+      case 2: // Left & right child both leaves
+      {
+        //left child
+        if(!skip(current.node->left_data().id()) /* && do_intersect_obj(query, current.node->left_data()) */) {
+          intersection = intersection_obj(query, current.node->left_data());
+          if(intersection) {
+            FT ray_distance = boost::apply_visitor(param_visitor, intersection->first);
+            if(ray_distance < t) {
+              t = ray_distance;
+              p = intersection;
+            }
+          }
+        }
+
+        // right child
+        if(!skip(current.node->right_data().id()) /* && do_intersect_obj(query, current.node->right_data()) */) {
+          intersection = intersection_obj(query, current.node->right_data());
+          if(intersection) {
+            FT ray_distance = boost::apply_visitor(param_visitor, intersection->first);
+            if(ray_distance < t) {
+              t = ray_distance;
+              p = intersection;
+            }
+          }
+        }
+        break;
+      }
+      case 3: // Left child leaf, right child inner node
+      {
+        //left child
+        if(!skip(current.node->left_data().id()) /* && do_intersect_obj(query, current.node->left_data()) */) {
+          intersection = intersection_obj(query, current.node->left_data());
+          if(intersection) {
+            FT ray_distance = boost::apply_visitor(param_visitor, intersection->first);
+            if(ray_distance < t) {
+              t = ray_distance;
+              p = intersection;
+            }
+          }
+        }
+
+        // right child
+        const Node* child = &(current.node->right_child());
+        boost::optional< FT > dist = intersection_distance_obj(query, child->bbox());
+        if(dist)
+          pq.push(Node_ptr_with_ft(child, *dist, 2));
+
+        break;
+      }
+      default: // Children both inner nodes
+      {
+        const Node* child = &(current.node->left_child());
+        boost::optional<FT> dist = intersection_distance_obj(query, child->bbox());
+        if(dist)
+          pq.push(Node_ptr_with_ft(child, *dist, current.nb_primitives/2));
+
+        child = &(current.node->right_child());
+        dist = intersection_distance_obj(query, child->bbox());
+        if(dist)
+          pq.push(Node_ptr_with_ft(child, *dist, current.nb_primitives - current.nb_primitives/2));
+
+        break;
+      }
+      }
+    }
+
+    return p;
+  }
+private:
+  const AABBTree& tree_;
+  typedef typename AABBTree::Point Point;
+  typedef typename AABBTree::FT FT;
+  typedef typename AABBTree::Node Node;
+  typedef typename AABBTree::size_type size_type;
+
+  struct Node_ptr_with_ft {
+    Node_ptr_with_ft(const Node* node, const FT& value, size_type nb_primitives)
+      : node(node), nb_primitives(nb_primitives), value(value) {}
+    const Node* node;
+    size_type nb_primitives;
+    FT value;
+#if BOOST_VERSION >= 105000
+    bool operator<(const Node_ptr_with_ft& other) const { return value < other.value; }
+    bool operator>(const Node_ptr_with_ft& other) const { return value > other.value; }
+#else
+    bool operator>(const Node_ptr_with_ft& other) const { return value < other.value; }
+    bool operator<(const Node_ptr_with_ft& other) const { return value > other.value; }
+
+#endif
+  };
+
+  struct as_ray_param_visitor {
+    typedef FT result_type;
+    as_ray_param_visitor(const Ray* ray) : ray(ray) {}
+
+    template<typename T>
+    FT operator()(const T&)
+    { std::cout << "not handled" << std::endl; return FT(); }
+
+    FT operator()(const Point& point) {
+      typename AABB_traits::Geom_traits::Vector_3 x(ray->source(), point);
+      typename AABB_traits::Geom_traits::Vector_3 v = ray->to_vector();
+
+      for(int i = 0; i < 3; ++i) {
+        if(v[0] != FT(0.)) {
+          return x[0] / v[0];
+        }
+      }
+      return FT(0.);
+    }
+
+    const Ray* ray;
+  };
+};
+
+template<typename AABBTraits>
+template<typename Ray, typename SkipFunctor>
+boost::optional< typename AABB_tree<AABBTraits>::template Intersection_and_primitive_id<Ray>::Type >
+AABB_tree<AABBTraits>::first_intersection(const Ray& query,
+                                          const SkipFunctor& skip) const {
+  CGAL_static_assertion_msg((boost::is_same<Ray, typename AABBTraits::Ray_3>::value), 
+                            "Ray and Ray_3 must be the same type");
+
+  switch(size()) // copy-paste from AABB_tree::traversal
+  {
+  case 0: // Tree empty, nothing to intersect
+    break;
+  case 1: // Tree has 1 node, intersect directly
+    return traits().intersection_object()(query, singleton_data());
+  default: // Tree has >= 2 nodes
+    if(traits().do_intersect_object()(query, root_node()->bbox())) {
+      AABB_ray_intersection< AABB_tree<AABBTraits>, SkipFunctor > ri(*this);
+      return ri.ray_intersection(query, skip);
+    } else {
+      // but we don't hit the root
+      break;
+    }
+  }
+  return boost::none;
+}
+
+template<typename AABBTraits>
+template<typename Ray, typename SkipFunctor>
+boost::optional<typename AABB_tree<AABBTraits>::Primitive_id>
+AABB_tree<AABBTraits>::first_intersected_primitive(const Ray& query,
+                            const SkipFunctor& skip) const
+{
+  boost::optional<
+    typename AABB_tree<AABBTraits>::
+      template Intersection_and_primitive_id<Ray>::Type > res =
+        first_intersection(query, skip);
+  if ( (bool) res )
+    return boost::make_optional( res->second );
+  return boost::none;
+}
+
+}
+
+#endif /* CGAL_AABB_RAY_INTERSECTION_H */
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/AABB_tree/AABB_search_tree.h b/3rdparty/CGAL/include/CGAL/internal/AABB_tree/AABB_search_tree.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/AABB_tree/AABB_search_tree.h
rename to 3rdparty/CGAL/include/CGAL/internal/AABB_tree/AABB_search_tree.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/AABB_tree/AABB_traversal_traits.h b/3rdparty/CGAL/include/CGAL/internal/AABB_tree/AABB_traversal_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/AABB_tree/AABB_traversal_traits.h
rename to 3rdparty/CGAL/include/CGAL/internal/AABB_tree/AABB_traversal_traits.h
diff --git a/3rdparty/CGAL/include/CGAL/internal/AABB_tree/Halfedge_and_face_graph_property_maps.h b/3rdparty/CGAL/include/CGAL/internal/AABB_tree/Halfedge_and_face_graph_property_maps.h
new file mode 100644
index 0000000..c3835a2
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/internal/AABB_tree/Halfedge_and_face_graph_property_maps.h
@@ -0,0 +1,201 @@
+// Copyright (c) 2012 GeometryFactory (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Sebastien Loriot
+//
+
+#ifndef HALFEDGE_AND_FACE_GRAPH_PROPERTY_MAPS_H
+#define HALFEDGE_AND_FACE_GRAPH_PROPERTY_MAPS_H
+
+#include <CGAL/property_map.h>
+#include <CGAL/boost/graph/properties.h>
+#include <boost/type_traits/is_const.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/type_traits/remove_const.hpp>
+
+namespace CGAL{
+
+//property map
+template <class FaceGraph,
+           class VertexPointPMap >
+struct Triangle_from_face_descriptor_property_map{
+  typename boost::remove_const<FaceGraph>::type* m_graph;
+  VertexPointPMap m_vppm;
+
+  Triangle_from_face_descriptor_property_map() : m_graph(NULL)
+  {}
+
+  Triangle_from_face_descriptor_property_map(FaceGraph* g)
+    : m_graph( const_cast<typename boost::remove_const<FaceGraph>::type*>(g) ),
+      m_vppm( get(vertex_point, *m_graph) )
+  {}
+
+  Triangle_from_face_descriptor_property_map(FaceGraph* g,
+                                          VertexPointPMap vppm )
+    : m_graph(const_cast<typename boost::remove_const<FaceGraph>::type*>(g)),
+      m_vppm(vppm)
+  {}
+
+  typedef typename boost::property_traits< VertexPointPMap >::value_type Point_3;
+  typedef typename Kernel_traits<Point_3>::Kernel::Triangle_3 Triangle_3;
+ 
+  //classical typedefs
+  typedef typename boost::graph_traits<FaceGraph>::face_descriptor key_type;
+  typedef Triangle_3 value_type;
+  typedef value_type reference;
+  typedef boost::readable_property_map_tag category;
+
+  //get function for property map
+  inline friend
+  Triangle_3
+  get(const Triangle_from_face_descriptor_property_map<FaceGraph,VertexPointPMap>& pmap,
+      typename Triangle_from_face_descriptor_property_map<FaceGraph,VertexPointPMap>::key_type f)
+  {
+    typedef typename boost::property_traits< VertexPointPMap >::value_type Point_3;
+    typedef typename Kernel_traits<Point_3>::Kernel::Triangle_3 Triangle_3;
+    typename boost::remove_const<FaceGraph>::type & g = *(pmap.m_graph);
+
+    CGAL_precondition(halfedge(f,g) == next(next(next(halfedge(f,g),g),g),g));
+    const Point_3& a = get(pmap.m_vppm, target(halfedge(f,g),g));
+    const Point_3& b = get(pmap.m_vppm, target(next(halfedge(f,g),g),g));
+    const Point_3& c = get(pmap.m_vppm,target(next(next(halfedge(f,g),g),g),g));
+ 
+    return Triangle_3(a,b,c);
+  }
+};
+
+
+template < class HalfedgeGraph,
+           class VertexPointPMap >
+struct Segment_from_edge_descriptor_property_map{
+
+  Segment_from_edge_descriptor_property_map()  : m_graph(NULL)
+  {}
+
+Segment_from_edge_descriptor_property_map(HalfedgeGraph* g)
+  : m_graph( const_cast<typename boost::remove_const<HalfedgeGraph>::type*>(g) ),
+    m_vppm( get(vertex_point, *m_graph) )
+  {}
+
+  Segment_from_edge_descriptor_property_map(HalfedgeGraph* g,
+                                            VertexPointPMap vppm )
+    : m_graph( const_cast<typename boost::remove_const<HalfedgeGraph>::type*>(g) ),
+      m_vppm(vppm)
+  {}
+
+  //classical typedefs
+  typedef typename boost::property_traits< VertexPointPMap >::value_type Point;
+  typedef typename boost::graph_traits<HalfedgeGraph>::edge_descriptor key_type;
+  typedef typename Kernel_traits<Point>::Kernel::Segment_3 value_type;
+  typedef value_type reference;
+  typedef boost::readable_property_map_tag category;
+  //data
+  typename boost::remove_const<HalfedgeGraph>::type* m_graph;
+  VertexPointPMap m_vppm;
+
+  //get function for property map
+  inline friend
+  value_type
+  get(Segment_from_edge_descriptor_property_map<HalfedgeGraph,VertexPointPMap> pmap,
+      key_type h)
+  {
+    typedef typename boost::property_traits< VertexPointPMap >::value_type Point;
+    typedef typename Kernel_traits<Point>::Kernel::Segment_3 Segment_3;
+
+    return Segment_3(get(pmap.m_vppm, source(h, *pmap.m_graph) ),
+                     get(pmap.m_vppm, target(h, *pmap.m_graph) ) );
+  }
+};
+
+//property map to access a point from a facet handle
+template <class FaceGraph,
+          class VertexPointPMap>
+struct One_point_from_face_descriptor_property_map{
+  One_point_from_face_descriptor_property_map()  : m_graph(NULL)
+  {}
+
+  One_point_from_face_descriptor_property_map(FaceGraph* g)
+    : m_graph( const_cast<typename boost::remove_const<FaceGraph>::type*>(g) )
+    , m_vppm( get(vertex_point, *m_graph) )
+  {}
+
+  One_point_from_face_descriptor_property_map(FaceGraph* g, VertexPointPMap vppm )
+    : m_graph( const_cast<typename boost::remove_const<FaceGraph>::type*>(g) ),
+      m_vppm(vppm)
+  {}
+
+  typename boost::remove_const<FaceGraph>::type* m_graph;
+  VertexPointPMap m_vppm;
+
+  //classical typedefs
+  typedef typename boost::graph_traits<FaceGraph>::face_descriptor key_type;
+  typedef typename boost::property_traits< VertexPointPMap >::value_type value_type;
+  typedef typename boost::property_traits< VertexPointPMap >::reference reference;
+  typedef boost::lvalue_property_map_tag category;
+
+  //get function for property map
+  inline friend
+  reference
+  get(const One_point_from_face_descriptor_property_map<FaceGraph,VertexPointPMap>& m,
+      key_type f)
+  {
+    return get(m.m_vppm, target(halfedge(f, *m.m_graph), *m.m_graph));
+  }
+};
+
+//property map to access a point from an edge
+template < class HalfedgeGraph,
+           class VertexPointPMap >
+struct Source_point_from_edge_descriptor{
+  Source_point_from_edge_descriptor()  : m_graph(NULL)
+  {}
+
+  Source_point_from_edge_descriptor(HalfedgeGraph* g)
+    : m_graph( const_cast<typename boost::remove_const<HalfedgeGraph>::type*>(g) )
+    , m_vppm( get(vertex_point, *m_graph) )
+  {}
+
+  Source_point_from_edge_descriptor(
+    HalfedgeGraph* g,
+    VertexPointPMap vppm ) :
+  m_graph( const_cast<typename boost::remove_const<HalfedgeGraph>::type*>(g) ),
+  m_vppm(vppm)
+  {}
+
+  //classical typedefs
+  typedef typename boost::property_traits< VertexPointPMap >::value_type value_type;
+  typedef typename boost::property_traits< VertexPointPMap >::reference reference;
+  typedef typename boost::graph_traits<HalfedgeGraph>::edge_descriptor key_type;
+  typedef boost::readable_property_map_tag category;
+  //data
+  typename boost::remove_const<HalfedgeGraph>::type* m_graph;
+  VertexPointPMap m_vppm;
+
+  //get function for property map
+  inline friend
+  reference
+  get(Source_point_from_edge_descriptor<HalfedgeGraph,VertexPointPMap> pmap,
+      key_type h)
+  {
+    return get(pmap.m_vppm,  source(h, *pmap.m_graph) );
+  }
+};
+
+} //namespace CGAL
+
+#endif //HALFEDGE_AND_FACE_GRAPH_PROPERTY_MAPS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/AABB_tree/Has_nested_type_Shared_data.h b/3rdparty/CGAL/include/CGAL/internal/AABB_tree/Has_nested_type_Shared_data.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/AABB_tree/Has_nested_type_Shared_data.h
rename to 3rdparty/CGAL/include/CGAL/internal/AABB_tree/Has_nested_type_Shared_data.h
diff --git a/3rdparty/CGAL/include/CGAL/internal/AABB_tree/Is_ray_intersection_geomtraits.h b/3rdparty/CGAL/include/CGAL/internal/AABB_tree/Is_ray_intersection_geomtraits.h
new file mode 100644
index 0000000..f2f6a5d
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/internal/AABB_tree/Is_ray_intersection_geomtraits.h
@@ -0,0 +1,52 @@
+// Copyright (c) 2015 INRIA Sophia-Antipolis (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
+// 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(s) : Philipp Moeller
+//
+
+#ifndef CGAL_IS_RAY_INTERSECTION_GEOMTRAITS_H
+#define CGAL_IS_RAY_INTERSECTION_GEOMTRAITS_H
+
+#include <boost/mpl/has_xxx.hpp>
+#include <boost/mpl/and.hpp>
+
+namespace CGAL {
+namespace internal {
+namespace AABB_tree {
+
+BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Has_ray_3,Ray_3,false)
+BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Has_construct_source_3,Construct_source_3,false)
+BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Has_vector_3,Construct_vector_3,false)
+BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Has_construct_cartesian_const_iterator_3,Construct_cartesian_const_iterator_3,false)
+BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Has_cartesian_const_iterator_3,Cartesian_const_iterator_3,false)
+
+template<typename GeomTraits>
+struct Is_ray_intersection_geomtraits
+: boost::mpl::and_< Has_ray_3<GeomTraits>,
+                    Has_construct_source_3<GeomTraits>,
+                    Has_vector_3<GeomTraits>,
+                    Has_construct_cartesian_const_iterator_3<GeomTraits>,
+                    Has_cartesian_const_iterator_3<GeomTraits> >::type
+{};
+
+
+} // AABB_tree
+} // internal
+} // CGAL
+
+#endif /* CGAL_IS_RAY_INTERSECTION_GEOMTRAITS_H */
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/AABB_tree/Primitive_helper.h b/3rdparty/CGAL/include/CGAL/internal/AABB_tree/Primitive_helper.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/AABB_tree/Primitive_helper.h
rename to 3rdparty/CGAL/include/CGAL/internal/AABB_tree/Primitive_helper.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/AABB_tree/nearest_point_segment_3.h b/3rdparty/CGAL/include/CGAL/internal/AABB_tree/nearest_point_segment_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/AABB_tree/nearest_point_segment_3.h
rename to 3rdparty/CGAL/include/CGAL/internal/AABB_tree/nearest_point_segment_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/AABB_tree/nearest_point_triangle_3.h b/3rdparty/CGAL/include/CGAL/internal/AABB_tree/nearest_point_triangle_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/AABB_tree/nearest_point_triangle_3.h
rename to 3rdparty/CGAL/include/CGAL/internal/AABB_tree/nearest_point_triangle_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/AFSR/Surface_face_base_2.h b/3rdparty/CGAL/include/CGAL/internal/AFSR/Surface_face_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/AFSR/Surface_face_base_2.h
rename to 3rdparty/CGAL/include/CGAL/internal/AFSR/Surface_face_base_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/AFSR/Surface_vertex_base_2.h b/3rdparty/CGAL/include/CGAL/internal/AFSR/Surface_vertex_base_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/AFSR/Surface_vertex_base_2.h
rename to 3rdparty/CGAL/include/CGAL/internal/AFSR/Surface_vertex_base_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/AFSR/construct_polyhedron.h b/3rdparty/CGAL/include/CGAL/internal/AFSR/construct_polyhedron.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/AFSR/construct_polyhedron.h
rename to 3rdparty/CGAL/include/CGAL/internal/AFSR/construct_polyhedron.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/AFSR/construct_surface_2.h b/3rdparty/CGAL/include/CGAL/internal/AFSR/construct_surface_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/AFSR/construct_surface_2.h
rename to 3rdparty/CGAL/include/CGAL/internal/AFSR/construct_surface_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/AFSR/orient.h b/3rdparty/CGAL/include/CGAL/internal/AFSR/orient.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/AFSR/orient.h
rename to 3rdparty/CGAL/include/CGAL/internal/AFSR/orient.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/AFSR/write_triple_indices.h b/3rdparty/CGAL/include/CGAL/internal/AFSR/write_triple_indices.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/AFSR/write_triple_indices.h
rename to 3rdparty/CGAL/include/CGAL/internal/AFSR/write_triple_indices.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Classification_type.h b/3rdparty/CGAL/include/CGAL/internal/Classification_type.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Classification_type.h
rename to 3rdparty/CGAL/include/CGAL/internal/Classification_type.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Combination_enumerator.h b/3rdparty/CGAL/include/CGAL/internal/Combination_enumerator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Combination_enumerator.h
rename to 3rdparty/CGAL/include/CGAL/internal/Combination_enumerator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Combinatorial_map_copy_functors.h b/3rdparty/CGAL/include/CGAL/internal/Combinatorial_map_copy_functors.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Combinatorial_map_copy_functors.h
rename to 3rdparty/CGAL/include/CGAL/internal/Combinatorial_map_copy_functors.h
diff --git a/3rdparty/CGAL/include/CGAL/internal/Combinatorial_map_group_functors.h b/3rdparty/CGAL/include/CGAL/internal/Combinatorial_map_group_functors.h
new file mode 100644
index 0000000..f0ec66a
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/internal/Combinatorial_map_group_functors.h
@@ -0,0 +1,1033 @@
+// Copyright (c) 2010-2011 CNRS and LIRIS' Establishments (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Guillaume Damiand <guillaume.damiand at liris.cnrs.fr>
+//
+#ifndef CGAL_COMBINATORIAL_MAP_GROUP_FUNCTORS_H
+#define CGAL_COMBINATORIAL_MAP_GROUP_FUNCTORS_H
+
+#include <CGAL/Unique_hash_map.h>
+#include <CGAL/Combinatorial_map_functors.h>
+
+/* Definition of functors used to group/ungroup attributes (we need functors
+ * as attributes are stored in tuple, thus all the access must be done at
+ * compiling time). Some of these functors are used with
+ * Foreach_enabled_attributes to iterate through all the non void attribs.
+ * These functors used other functors defined in Combinatorial_map_functors.h
+ *
+ * Group_attribute_functor_of_dart<CMap> to group the <i>-attributes of two
+ *    given darts (except for j-dim). Only the attributes of the two given
+ *    darts are possibly modified.
+ *
+ * Group_attribute_functor_of_dart_run<CMap,i> same than
+ *   Group_attribute_functor_of_dart<CMap>::run<i>, with i template argument
+ *   given in the struct to enable specialization.
+ *
+ * Group_attribute_functor<CMap> to group the <i>-attributes of two
+ *    given i-cells (except for j-adim). If one i-attribute is NULL, we set the
+ *    darts of its i-cell to the second attribute. If both i-attributes are
+ *    non NULL, we overide all the i-attribute of the second i-cell to the
+ *    first i-attribute.
+ *
+ * Degroup_attribute_functor_run<CMap> to degroup one i-attributes in two
+ *   (except for j-adim).
+ *
+ * Test_split_attribute_functor<CMap,i> to test if there is some i-attributes
+ *   that are split after an operation. Modified darts are given in a
+ *   std::deque.
+ */
+namespace CGAL
+{
+namespace internal
+{
+// ************************************************************************
+/// Functor used for link_beta to update the i-attributes of
+/// dh2 on the attributes of dh1 dart, except if i=j.
+///    (j is the dimension of the beta modified between dh1 and dh2,
+///     so that after the modification we will have beta_j(dh1)==dh2)
+/// Only attributes of dh1 or dh2 can be modified. If one dart as its
+/// attribute equal to null, it takes the attributes of the second dart.
+/// If both attributes are non null, dh2 takes the attribute of dh1.
+template<typename CMap, unsigned int i, unsigned int j=CMap::dimension+1,
+         typename T=typename CMap::template Attribute_type<i>::type>
+struct Group_nonvoid_attribute_functor_of_dart_run
+{
+  /// Group the i-attribute of dh1 and dh2.
+  static void run(CMap* amap,
+                  typename CMap::Dart_handle dh1,
+                  typename CMap::Dart_handle dh2)
+  {
+    CGAL_static_assertion( 1<=i && i<=CMap::dimension );
+    CGAL_static_assertion( i!=j && (i!=1 || j!=0) );
+    CGAL_static_assertion_msg(CMap::Helper::template
+                              Dimension_index<i>::value>=0,
+                              "Group_attribute_functor_of_dart_run<i> but "
+                              "i-attributes are disabled");
+    typename CMap::template Attribute_handle<i>::type
+        a1=amap->template attribute<i>(dh1);
+    typename CMap::template Attribute_handle<i>::type
+        a2=amap->template attribute<i>(dh2);
+
+    // If the two attributes are equal, nothing to do.
+    if ( a1==a2 ) return;
+
+    if ( a1==CMap::null_handle ) amap->template set_dart_attribute<i>(dh1, a2);
+    else amap->template set_dart_attribute<i>(dh2, a1);
+  }
+};
+// Specialization for i=0 and 2<=j. We modify 0-attribute for beta_j j>=2.
+template<typename CMap, unsigned int j, typename T>
+struct Group_nonvoid_attribute_functor_of_dart_run<CMap, 0, j, T>
+{
+  static void run(CMap* amap,
+                  typename CMap::Dart_handle dh1,
+                  typename CMap::Dart_handle dh2)
+  {
+    CGAL_static_assertion(j!=0 && j!=1);
+    CGAL_static_assertion_msg(CMap::Helper::template
+                              Dimension_index<0>::value>=0,
+                              "Group_attribute_functor_of_dart_run<0> but "
+                              "0-attributes are disabled");
+    typename CMap::template Attribute_handle<0>::type
+        a1=CMap::null_handle, a2=CMap::null_handle;
+
+    // First extremity
+    typename CMap::Dart_handle od = amap->other_extremity(dh2);
+    if ( od!=amap->null_handle )
+    {
+      a1=amap->template attribute<0>(dh1);
+      a2=amap->template attribute<0>(od);
+
+      if ( a1==CMap::null_handle && a2!=CMap::null_handle )
+        amap->template set_dart_attribute<0>(dh1, a2);
+    }
+
+    // Second extremity
+    od = amap->other_extremity(dh1);
+    if ( od!=amap->null_handle )
+    {
+      a1=amap->template attribute<0>(od);
+      if ( a1!=CMap::null_handle )
+        amap->template set_dart_attribute<0>(dh2, a1);
+    }
+  }
+};
+// Specialization for i=0 and j=0. We modify 0-attribute for beta_0.
+template<typename CMap, typename T>
+struct Group_nonvoid_attribute_functor_of_dart_run<CMap, 0, 0, T>
+{
+  static void run(CMap* amap,
+                  typename CMap::Dart_handle dh1,
+                  typename CMap::Dart_handle dh2)
+  {
+    CGAL_static_assertion_msg(CMap::Helper::template
+                              Dimension_index<0>::value>=0,
+                              "Group_attribute_functor_of_dart_run<0> but "
+                              "0-attributes are disabled");
+    typename CMap::Dart_handle od = amap->other_extremity(dh2);
+    if ( od!=amap->null_handle )
+    {
+      typename CMap::template Attribute_handle<0>::type
+          a1=amap->template attribute<0>(dh1);
+      typename CMap::template Attribute_handle<0>::type
+          a2=amap->template attribute<0>(od);
+
+      if ( a1==CMap::null_handle && a2!=CMap::null_handle )
+        amap->template set_dart_attribute<0>(dh1, a2);
+    }
+  }
+};
+// Specialization for i=0 and j=1. We modify 0-attribute for beta_1.
+template<typename CMap, typename T>
+struct Group_nonvoid_attribute_functor_of_dart_run<CMap, 0, 1, T>
+{
+  static void run(CMap* amap,
+                  typename CMap::Dart_handle dh1,
+                  typename CMap::Dart_handle dh2)
+  {
+    CGAL_static_assertion_msg(CMap::Helper::template
+                              Dimension_index<0>::value>=0,
+                              "Group_attribute_functor_of_dart_run<0> but "
+                              "0-attributes are disabled");
+    typename CMap::Dart_handle od = amap->other_extremity(dh1);
+    if ( od!=amap->null_handle )
+    {
+      typename CMap::template Attribute_handle<0>::type
+          a1=amap->template attribute<0>(od);
+
+      if ( a1!=CMap::null_handle )
+        amap->template set_dart_attribute<0>(dh2, a1);
+    }
+  }
+};
+// Specialization for i=j. Do nothing as j is the dimension to not consider.
+template<typename CMap, unsigned int i, typename T>
+struct Group_nonvoid_attribute_functor_of_dart_run<CMap,i,i,T>
+{
+  static void run(CMap*,
+                  typename CMap::Dart_handle,
+                  typename CMap::Dart_handle)
+  {}
+};
+// Specialization for i=1 and j=0. Do nothing as edges attributes are not
+// modify when we modify beta_0.
+template<typename CMap, typename T>
+struct Group_nonvoid_attribute_functor_of_dart_run<CMap,1,0,T>
+{
+  static void run(CMap*,
+                  typename CMap::Dart_handle,
+                  typename CMap::Dart_handle)
+  {}
+};
+//------------------------------------------------------------------------------
+template<typename CMap, unsigned int i, unsigned int j=CMap::dimension+1,
+         typename T=typename CMap::template Attribute_type<i>::type>
+struct Group_attribute_functor_of_dart_run
+{
+  /// Group the i-attribute of dh1 and dh2.
+  static void run(CMap* amap,
+                  typename CMap::Dart_handle dh1,
+                  typename CMap::Dart_handle dh2)
+  { Group_nonvoid_attribute_functor_of_dart_run<CMap, i, j, T>::
+      run(amap, dh1, dh2); }
+};
+// Specialization for void attributes.
+template<typename CMap, unsigned int i, unsigned int j>
+struct Group_attribute_functor_of_dart_run<CMap, i, j, CGAL::Void>
+{
+  static void run(CMap*,
+                  typename CMap::Dart_handle,
+                  typename CMap::Dart_handle)
+  {}
+};
+// ************************************************************************
+/// Functor used for link_beta to update the attributes of
+/// adart2 on the attributes of this dart, except for j-attributes.
+///    (j is the dimension of the beta modified between adart1 and adart2,
+///     so that after the modification we will have beta_j(adart1)==adart2)
+/// We define run<i> to allows to use this functor with
+/// Foreach_enabled_attributes.
+///   If you know i at compiling time, use directly
+///   Group_attribute_functor_of_dart_run.
+template<typename CMap, unsigned int j=CMap::dimension+1>
+struct Group_attribute_functor_of_dart
+{
+  template <unsigned int i>
+  static void run(CMap* amap,
+                  typename CMap::Dart_handle adart1,
+                  typename CMap::Dart_handle adart2)
+  {
+    CGAL::internal::Group_attribute_functor_of_dart_run<CMap,i,j>::
+        run(amap,adart1,adart2);
+  }
+};
+// ************************************************************************
+// Functor used to group the two i-attributes of the two i-cells, except
+// the attribute of j
+//    (j is the dimension of the beta modified between adart1 and adart2).
+template<typename CMap, unsigned int i, unsigned int j=CMap::dimension+1,
+         typename T=typename CMap::template Attribute_type<i>::type>
+struct Group_nonvoid_attribute_functor_run
+{
+  static void run(CMap* amap,
+                  typename CMap::Dart_handle adart1,
+                  typename CMap::Dart_handle adart2)
+  {
+    CGAL_static_assertion( 1<=i && i<=CMap::dimension );
+    CGAL_static_assertion( i!=j );
+    CGAL_static_assertion_msg
+        ( CMap::Helper::template Dimension_index<i>::value>=0,
+          "Group_attribute_functor_run<i> but i-attributes are disabled" );
+    typename CMap::template Attribute_handle<i>::type
+        a1=amap->template attribute<i>(adart1);
+    typename CMap::template Attribute_handle<i>::type
+        a2=amap->template attribute<i>(adart2);
+
+    // If the two attributes are equal, nothing to do.
+    if ( a1 == a2 ) return;
+
+    typename CMap::Dart_handle toSet = amap->null_handle;
+
+    // If the attribute associated to adart1 is NULL, set it with
+    // the attribute associated to adart2 (necessarily != NULL)
+    if (a1 == CMap::null_handle)
+    { toSet  = adart1; a1 = a2; }
+    else
+    {
+      toSet = adart2;
+      if (a2 != CMap::null_handle)
+      {
+        CGAL::internal::Call_merge_functor<CMap, i>::run(amap, a1, a2);
+      }
+    }
+    amap->template set_attribute<i>(toSet, a1);
+  }
+};
+// Specialization for i=0 and 2<=j. We update 0-attributes for beta_j j>=2.
+// We need to update both extremities of the edge dh1.
+template<typename CMap, unsigned int j, typename T>
+struct Group_nonvoid_attribute_functor_run<CMap, 0, j, T>
+{
+  static void run( CMap* amap,
+                   typename CMap::Dart_handle dh1,
+                   typename CMap::Dart_handle dh2 )
+  {
+    CGAL_static_assertion_msg
+        ( CMap::Helper::template Dimension_index<0>::value>=0,
+          "Group_attribute_functor_run<0> but 0-attributes are disabled" );
+    CGAL_static_assertion(j!=0 && j!=1);
+
+    typename CMap::template Attribute_handle<0>::type
+        a1=CMap::null_handle, a2=CMap::null_handle;
+    typename CMap::Dart_handle toSet=amap->null_handle;
+    // First extremity
+    typename CMap::Dart_handle od=amap->other_extremity(dh2);
+    if ( od!=amap->null_handle )
+    {
+      a1=amap->template attribute<0>(dh1);
+      a2=amap->template attribute<0>(od);
+      if ( a1!=a2 )
+      {
+        if ( a1==CMap::null_handle )
+        { toSet=dh1; a1=a2; }
+        else
+        {
+          toSet=od;
+          if ( a2!=CMap::null_handle )
+          {
+            CGAL::internal::Call_merge_functor<CMap, 0>::run(amap, a1, a2);
+          }
+        }
+        amap->template set_attribute<0>(toSet, a1);
+      }
+    }
+    // Second extremity
+    od = amap->other_extremity(dh1);
+    if ( od!=amap->null_handle )
+    {
+      a1=amap->template attribute<0>(od);
+      a2=amap->template attribute<0>(dh2);
+      if ( a1!=a2 )
+      {
+        if ( a1==CMap::null_handle )
+        { toSet=od; a1=a2; }
+        else
+        {
+          toSet=dh2;
+          if ( a2!=CMap::null_handle )
+          {
+            CGAL::internal::Call_merge_functor<CMap, 0>::run(amap, a1, a2);
+          }
+        }
+        amap->template set_attribute<0>(toSet, a1);
+      }
+    }
+  }
+};
+// Specialization for i=0 and j=0. We update 0-attributes for beta_0.
+// We need to update the first extremity of the edge dh1.
+template<typename CMap, typename T>
+struct Group_nonvoid_attribute_functor_run<CMap, 0, 0, T>
+{
+  static void run( CMap* amap,
+                   typename CMap::Dart_handle dh1,
+                   typename CMap::Dart_handle dh2 )
+  {
+    CGAL_static_assertion_msg
+        ( CMap::Helper::template Dimension_index<0>::value>=0,
+          "Group_attribute_functor_run<0> but 0-attributes are disabled" );
+    typename CMap::Dart_handle od=amap->other_extremity(dh2);
+    if ( od!=amap->null_handle )
+    {
+      typename CMap::Dart_handle toSet=amap->null_handle;
+      typename CMap::template Attribute_handle<0>::type
+          a1=amap->template attribute<0>(dh1);
+      typename CMap::template Attribute_handle<0>::type
+          a2=amap->template attribute<0>(od);
+      if ( a1!=a2 )
+      {
+        if ( a1==CMap::null_handle )
+        { toSet=dh1; a1=a2; }
+        else
+        {
+          toSet=od;
+          if ( a2!=CMap::null_handle )
+          {
+            CGAL::internal::Call_merge_functor<CMap, 0>::run(amap, a1, a2);
+          }
+        }
+        amap->template set_attribute<0>(toSet, a1);
+      }
+    }
+  }
+};
+// Specialization for i=0 and j=1. We update 0-attributes for beta_1.
+// We need to update the second extremity of the edge dh1.
+template<typename CMap, typename T>
+struct Group_nonvoid_attribute_functor_run<CMap, 0, 1, T>
+{
+  static void run( CMap* amap,
+                   typename CMap::Dart_handle dh1,
+                   typename CMap::Dart_handle dh2 )
+  {
+    CGAL_static_assertion_msg
+        ( CMap::Helper::template Dimension_index<0>::value>=0,
+          "Group_attribute_functor_run<0> but 0-attributes are disabled" );
+    typename CMap::Dart_handle od =amap->other_extremity(dh1);
+    if ( od!=amap->null_handle )
+    {
+      typename CMap::Dart_handle toSet=amap->null_handle;
+      typename CMap::template Attribute_handle<0>::type
+          a1=amap->template attribute<0>(od);
+      typename CMap::template Attribute_handle<0>::type
+          a2=amap->template attribute<0>(dh2);
+      if ( a1!=a2 )
+      {
+        if ( a1==CMap::null_handle )
+        { toSet=od; a1=a2; }
+        else
+        {
+          toSet=dh2;
+          if ( a2!=CMap::null_handle )
+          {
+            CGAL::internal::Call_merge_functor<CMap, 0>::run(amap, a1, a2);
+          }
+        }
+        amap->template set_attribute<0>(toSet, a1);
+      }
+    }
+  }
+};
+// Specialization for i=j. Do nothing as j is the dimension to not consider.
+template<typename CMap, unsigned int i, typename T>
+struct Group_nonvoid_attribute_functor_run<CMap,i,i,T>
+{
+  static void run(CMap*,
+                  typename CMap::Dart_handle,
+                  typename CMap::Dart_handle)
+  {}
+};
+// Specialization for i=1 and j=0. Do nothing as edges attributes are not
+// modify when we modify beta_0.
+template<typename CMap, typename T>
+struct Group_nonvoid_attribute_functor_run<CMap,1,0,T>
+{
+  static void run(CMap*,
+                  typename CMap::Dart_handle,
+                  typename CMap::Dart_handle)
+  {}
+};
+//------------------------------------------------------------------------------
+// Group_attribute_functor
+template<typename CMap, unsigned int i, unsigned int j=CMap::dimension+1,
+         typename T=typename CMap::template Attribute_type<i>::type>
+struct Group_attribute_functor_run
+{
+  static void run( CMap* amap,
+                   typename CMap::Dart_handle d1,
+                   typename CMap::Dart_handle d2)
+  { Group_nonvoid_attribute_functor_run<CMap, i, j, T>::run(amap, d1, d2); }
+};
+// Specialization for void attributes.
+template<typename CMap, unsigned int i, unsigned int j>
+struct Group_attribute_functor_run<CMap, i, j, CGAL::Void>
+{
+  static void run( CMap*,
+                   typename CMap::Dart_handle,
+                   typename CMap::Dart_handle )
+  {}
+};
+// ************************************************************************
+/// Functor used for sew to update the attributes of
+/// adart2 on the attributes of this dart, except for j-attributes.
+///    (j is the dimension of the beta modified between adart1 and adart2,
+///     so that after the modification we will have beta_j(adart1)==adart2)
+/// We define run<i> to allows to use this functor with
+/// Foreach_enabled_attributes.
+///   If you know i at compiling time, use directly
+///   Group_attribute_functor_run.
+template<typename CMap, unsigned int j=CMap::dimension+1>
+struct Group_attribute_functor
+{
+  template <unsigned int i>
+  static void run(CMap* amap,
+                  typename CMap::Dart_handle adart1,
+                  typename CMap::Dart_handle adart2)
+  { CGAL::internal::Group_attribute_functor_run<CMap,i,j>::
+        run(amap,adart1,adart2); }
+};
+// ************************************************************************
+// Functor used to degroup one i-attribute of one i-cell in two, except the
+// attribute of j.
+template<typename CMap, unsigned int i, unsigned int j=CMap::dimension+1,
+         typename T=typename CMap::template Attribute_type<i>::type>
+struct Degroup_nonvoid_attribute_functor_run
+{
+  static void run(CMap* amap,
+                  typename CMap::Dart_handle adart1,
+                  typename CMap::Dart_handle adart2)
+  {
+    CGAL_static_assertion( i<=CMap::dimension );
+    CGAL_static_assertion( i!=j );
+    CGAL_static_assertion_msg
+        ( CMap::Helper::template Dimension_index<i>::value>=0,
+          "Degroup_attribute_functor_run<i> but i-attributes are disabled" );
+
+    typename CMap::template Attribute_handle<i>::type
+        a1=amap->template attribute<i>(adart1);
+
+    // If there is no first attribute, nothing to degroup.
+    if ( a1==CMap::null_handle ) return;
+
+    // If the second attribute is non null and already different from a1,
+    // nothing to do.
+    if ( a1!=amap->template attribute<i>(adart2) &&
+         amap->template attribute<i>(adart2)!=CMap::null_handle ) return;
+
+    CGAL_assertion( (!CGAL::belong_to_same_cell<CMap,i>
+                     (*amap, adart1, adart2)) );
+
+    // As we split, we set the dart of the first attribute to adart1 for which
+    // we are sure it belongs to the first i-cell.
+    amap->template get_attribute<i>(a1).set_dart(adart1);
+
+    typename CMap::template Attribute_handle<i>::type
+      a2 = amap->template
+      create_attribute<i>(amap->template get_attribute<i>(a1));
+
+    amap->template set_attribute<i>(adart2, a2);
+    CGAL::internal::Call_split_functor<CMap, i>::run(amap, a1, a2);
+  }
+};
+// Specialization for i==j.
+template<typename CMap, unsigned int i, typename T>
+struct Degroup_nonvoid_attribute_functor_run<CMap, i, i, T>
+{
+  static void run(CMap*,
+                  typename CMap::Dart_handle,
+                  typename CMap::Dart_handle)
+  {}
+};
+//------------------------------------------------------------------------------
+template<typename CMap, unsigned int i, unsigned int j=CMap::dimension+1,
+         typename T=typename CMap::template Attribute_type<i>::type>
+struct Degroup_attribute_functor_run
+{
+  static void run(CMap* amap,
+                  typename CMap::Dart_handle adart1,
+                  typename CMap::Dart_handle adart2)
+  { Degroup_nonvoid_attribute_functor_run<CMap, i, j, T>::
+      run(amap, adart1, adart2); }
+};
+// Specialization for void attributes.
+template<typename CMap, unsigned int i, unsigned int j>
+struct Degroup_attribute_functor_run<CMap, i, j, CGAL::Void>
+{
+  static void run(CMap*,
+                  typename CMap::Dart_handle,
+                  typename CMap::Dart_handle)
+  {}
+};
+// ************************************************************************
+// Function used by Test_split_attribute_functor_run to process one dart.
+// Test the split of the i-cell containing the given dart adart.
+// When we process a dart, we search in the Unique_hash_map if its
+// i-attribute was already found. If yes, it means that we already
+// found an i-cell with this attribute, thus this attribute is split.
+// We mark (with mark) all the darts of the i-cell containing adart to
+// process them exactly once.
+template<typename CMap, unsigned int i>
+void test_split_attribute_functor_one_dart
+( CMap* amap, typename CMap::Dart_handle adart,
+  CGAL::Unique_hash_map<typename CMap::template Attribute_handle<i>::type,
+                        unsigned int, typename CMap::Hash_function> &
+  found_attributes, typename CMap::size_type mark )
+{
+  CGAL_assertion( amap!=NULL );
+  CGAL_static_assertion_msg(CMap::Helper::template
+                            Dimension_index<i>::value>=0,
+                            "Test_split_attribute_functor_one_dart<i> but "
+                            "i-attributes are disabled");
+
+  typedef typename CMap::template Attribute_handle<i>::type
+      Attribute_handle_i;
+
+  // If the current dart has no attribute, or if it is aldready marked,
+  // nothing to do.
+  if ( amap->template attribute<i>(adart)==CMap::null_handle ||
+       amap->is_marked(adart, mark) )
+    return;
+
+  Attribute_handle_i a1 = amap->template attribute<i>(adart);
+  if ( found_attributes.is_defined(a1) )
+  {  // Here the attribute was already present in the hash_map
+    Attribute_handle_i a2 = amap->template
+      create_attribute<i>(amap->template get_attribute<i>(a1));
+
+    for ( CGAL::CMap_dart_iterator_basic_of_cell<CMap, i>
+          itj(*amap, adart, mark); itj.cont(); ++itj )
+    {
+      amap->template set_dart_attribute<i>(itj, a2);
+      amap->mark(itj, mark);
+    }
+    CGAL::internal::Call_split_functor<CMap, i>::run(amap, a1, a2);
+  }
+  else
+  {
+    // Here the attribute was not in the hash_map.
+    found_attributes[a1]=1;
+    amap->template set_dart_of_attribute<i>(a1, adart);
+
+    for ( CGAL::CMap_dart_iterator_basic_of_cell<CMap, i>
+          itj(*amap, adart, mark); itj.cont(); ++itj )
+    {
+      CGAL_assertion( amap->template attribute<i>(itj)==a1 );
+      amap->mark(itj, mark);
+    }
+  }
+}
+// ************************************************************************
+/// Functor used for unsew to test if i-attributes are split after an
+/// operation, except for j-attributes.
+///   (j is the dimension of the beta modified for darts in modified_darts,
+///    if j==0 modified_darts2 are the darts modified for beta_1).
+template<typename CMap, unsigned int i, unsigned int j=CMap::dimension+1,
+         typename T=typename CMap::template Attribute_type<i>::type>
+struct Test_split_nonvoid_attribute_functor_run
+{
+  // modified_darts is the set of modified darts for beta_j
+  static void run( CMap* amap,
+                   const std::deque<typename CMap::Dart_handle>
+                   &modified_darts,
+                   typename CMap::size_type mark_modified_darts=CMap::INVALID_MARK)
+  {
+    CGAL_static_assertion( 1<=i && i<=CMap::dimension );
+    CGAL_assertion( i!=j );
+    CGAL_assertion( amap!=NULL );
+    CGAL_static_assertion_msg(CMap::Helper::template
+                              Dimension_index<i>::value>=0,
+                              "Test_split_attribute_functor_run<i> but "
+                              "i-attributes are disabled");
+
+    typedef typename CMap::template Attribute_handle<i>::type
+        Attribute_handle_i;
+
+    CGAL::Unique_hash_map<Attribute_handle_i, unsigned int,
+                          typename CMap::Hash_function> found_attributes;
+
+    typename CMap::size_type mark = amap->get_new_mark(); // to mark incident cells.
+    typename std::deque<typename CMap::Dart_handle>::const_iterator
+        it=modified_darts.begin();
+    for ( ; it!=modified_darts.end(); ++it )
+    {
+      CGAL::internal::test_split_attribute_functor_one_dart<CMap,i>
+          (amap, *it, found_attributes, mark);
+    }
+
+    // Now we unmark all the marked darts.
+    amap->negate_mark(mark);
+    for ( it=modified_darts.begin(); it!=modified_darts.end(); ++it )
+    {
+      if ( mark_modified_darts!=CMap::INVALID_MARK )
+        amap->unmark(*it, mark_modified_darts);
+
+      if ( !amap->is_marked(*it, mark) )
+        CGAL::mark_cell<CMap, i>(*amap, *it, mark);
+    }
+
+    CGAL_assertion( amap->is_whole_map_marked(mark) );
+    amap->free_mark(mark);
+  }
+  static void run( CMap* amap,
+                   const std::deque<typename CMap::Dart_handle>
+                   &modified_darts,
+                   const std::deque<typename CMap::Dart_handle>
+                   &modified_darts2,
+                   typename CMap::size_type mark_modified_darts=CMap::INVALID_MARK)
+  {
+    CGAL_static_assertion( 1<=i && i<=CMap::dimension );
+    CGAL_assertion( i!=j );
+    CGAL_assertion( amap!=NULL );
+    CGAL_static_assertion_msg(CMap::Helper::template
+                              Dimension_index<i>::value>=0,
+                              "Test_split_attribute_functor_run<i> but "
+                              "i-attributes are disabled");
+
+    typedef typename CMap::template Attribute_handle<i>::type
+        Attribute_handle_i;
+
+    CGAL::Unique_hash_map<Attribute_handle_i, unsigned int,
+                          typename CMap::Hash_function> found_attributes;
+
+    typename CMap::size_type mark = amap->get_new_mark(); // to mark incident cells.
+    typename std::deque<typename CMap::Dart_handle>::const_iterator
+        it=modified_darts.begin();
+    for ( ; it!=modified_darts.end(); ++it )
+    {
+      CGAL::internal::test_split_attribute_functor_one_dart<CMap,i>
+          (amap, *it, found_attributes, mark);
+    }
+    typename std::deque<typename CMap::Dart_handle>::const_iterator
+        it2=modified_darts2.begin();
+    for ( ; it2!=modified_darts2.end(); ++it2 )
+    {
+      CGAL::internal::test_split_attribute_functor_one_dart<CMap,i>
+          (amap, *it2, found_attributes, mark);
+    }
+
+    // Now we unmark all the marked darts.
+    amap->negate_mark(mark);
+    for ( it=modified_darts.begin(); it!=modified_darts.end(); ++it )
+    {
+      if ( mark_modified_darts!=CMap::INVALID_MARK )
+        amap->unmark(*it, mark_modified_darts);
+
+      if ( !amap->is_marked(*it, mark) )
+        CGAL::mark_cell<CMap, i>(*amap, *it, mark);
+    }
+    for ( it2=modified_darts2.begin(); it2!=modified_darts2.end(); ++it2 )
+    {
+      if ( mark_modified_darts!=CMap::INVALID_MARK )
+        amap->unmark(*it2, mark_modified_darts);
+
+      if ( !amap->is_marked(*it2, mark) )
+        CGAL::mark_cell<CMap, i>(*amap, *it2, mark);
+    }
+
+    CGAL_assertion( amap->is_whole_map_marked(mark) );
+    amap->free_mark(mark);
+  }
+};
+// Specialization for i=0 and 2<=j.
+template<typename CMap, unsigned int j, typename T>
+struct Test_split_nonvoid_attribute_functor_run<CMap, 0, j, T>
+{
+  static void run( CMap* amap,
+                   const std::deque<typename CMap::Dart_handle>
+                   &modified_darts,
+                   typename CMap::size_type mark_modified_darts=CMap::INVALID_MARK)
+  {
+    CGAL_assertion( j!=0 && j!=1 );
+    CGAL_assertion( amap!=NULL );
+    CGAL_static_assertion_msg(CMap::Helper::template
+                              Dimension_index<0>::value>=0,
+                              "Test_split_attribute_functor_run<0> but "
+                              "0-attributes are disabled");
+
+    typedef typename CMap::template Attribute_handle<0>::type
+        Attribute_handle_0;
+
+    CGAL::Unique_hash_map<Attribute_handle_0, unsigned int,
+                          typename CMap::Hash_function> found_attributes;
+    typename CMap::Dart_handle od=amap->null_handle;
+
+    typename CMap::size_type mark = amap->get_new_mark(); // to mark incident cells.
+    typename std::deque<typename CMap::Dart_handle>::const_iterator
+        it=modified_darts.begin();
+    for ( ; it!=modified_darts.end(); ++it )
+    {
+      CGAL::internal::test_split_attribute_functor_one_dart<CMap,0>
+          (amap, *it, found_attributes, mark);
+
+      od=amap->other_extremity(*it);
+      if ( od!=amap->null_handle )
+        CGAL::internal::test_split_attribute_functor_one_dart<CMap,0>
+            (amap, od, found_attributes, mark);
+    }
+
+    // Now we unmark all the marked darts.
+    amap->negate_mark(mark);
+    for ( it=modified_darts.begin(); it!=modified_darts.end(); ++it )
+    {
+      if ( mark_modified_darts!=CMap::INVALID_MARK )
+        amap->unmark(*it, mark_modified_darts);
+
+      if ( !amap->is_marked(*it, mark) )
+        CGAL::mark_cell<CMap, 0>(*amap, *it, mark);
+
+      od=amap->other_extremity(*it);
+      if ( od!=amap->null_handle && !amap->is_marked(od, mark) )
+        CGAL::mark_cell<CMap, 0>(*amap, od, mark);
+    }
+
+    CGAL_assertion( amap->is_whole_map_marked(mark) );
+    amap->free_mark(mark);
+  }
+  static void run( CMap* amap,
+                   const std::deque<typename CMap::Dart_handle>
+                   &modified_darts,
+                   const std::deque<typename CMap::Dart_handle>
+                   &modified_darts2,
+                   typename CMap::size_type mark_modified_darts=CMap::INVALID_MARK)
+  {
+    CGAL_assertion( j!=0 && j!=1 );
+    CGAL_assertion( amap!=NULL );
+    CGAL_static_assertion_msg(CMap::Helper::template
+                              Dimension_index<0>::value>=0,
+                              "Test_split_attribute_functor_run<0> but "
+                              "0-attributes are disabled");
+
+    typedef typename CMap::template Attribute_handle<0>::type
+        Attribute_handle_0;
+
+    CGAL::Unique_hash_map<Attribute_handle_0, unsigned int,
+                          typename CMap::Hash_function> found_attributes;
+    typename CMap::Dart_handle od=amap->null_handle;
+
+    typename CMap::size_type mark = amap->get_new_mark(); // to mark incident cells.
+    typename std::deque<typename CMap::Dart_handle>::const_iterator
+        it=modified_darts.begin();
+    for ( ; it!=modified_darts.end(); ++it )
+    {
+      CGAL::internal::test_split_attribute_functor_one_dart<CMap,0>
+          (amap, *it, found_attributes, mark);
+
+      od=amap->other_extremity(*it);
+      if ( od!=amap->null_handle )
+        CGAL::internal::test_split_attribute_functor_one_dart<CMap,0>
+            (amap, od, found_attributes, mark);
+    }
+    typename std::deque<typename CMap::Dart_handle>::const_iterator
+        it2=modified_darts2.begin();
+    for ( ; it2!=modified_darts2.end(); ++it2 )
+    {
+      CGAL::internal::test_split_attribute_functor_one_dart<CMap,0>
+          (amap, *it2, found_attributes, mark);
+
+      od=amap->other_extremity(*it2);
+      if ( od!=amap->null_handle )
+        CGAL::internal::test_split_attribute_functor_one_dart<CMap,0>
+            (amap, od, found_attributes, mark);
+    }
+
+    // Now we unmark all the marked darts.
+    amap->negate_mark(mark);
+    for ( it=modified_darts.begin(); it!=modified_darts.end(); ++it )
+    {
+      if ( mark_modified_darts!=CMap::INVALID_MARK )
+        amap->unmark(*it, mark_modified_darts);
+
+      if ( !amap->is_marked(*it, mark) )
+        CGAL::mark_cell<CMap, 0>(*amap, *it, mark);
+
+      od=amap->other_extremity(*it);
+      if ( od!=amap->null_handle && !amap->is_marked(od, mark) )
+        CGAL::mark_cell<CMap, 0>(*amap, od, mark);
+    }
+    for ( it2=modified_darts2.begin(); it2!=modified_darts2.end(); ++it2 )
+    {
+      if ( mark_modified_darts!=CMap::INVALID_MARK )
+        amap->unmark(*it2, mark_modified_darts);
+
+      if ( !amap->is_marked(*it2, mark) )
+        CGAL::mark_cell<CMap, 0>(*amap, *it2, mark);
+
+      od=amap->other_extremity(*it2);
+      if ( od!=amap->null_handle && !amap->is_marked(od, mark) )
+        CGAL::mark_cell<CMap, 0>(*amap, od, mark);
+    }
+
+    CGAL_assertion( amap->is_whole_map_marked(mark) );
+    amap->free_mark(mark);
+  }
+};
+// Specialization for i=0 and j=0.
+// For j==0 or j==1, we use only the version with two list of darts,
+// modified_darts are darts modified for beta0, and
+// modified_darts2 are darts modified for beta1.
+template<typename CMap, typename T>
+struct Test_split_nonvoid_attribute_functor_run<CMap, 0, 0, T>
+{
+  static void run( CMap*, const std::deque<typename CMap::Dart_handle>&,
+                   typename CMap::size_type =CMap::INVALID_MARK)
+  { CGAL_assertion(false); }
+  static void run( CMap* amap,
+                   const std::deque<typename CMap::Dart_handle>
+                   &modified_darts,
+                   const std::deque<typename CMap::Dart_handle>
+                   &modified_darts2,
+                   typename CMap::size_type mark_modified_darts=CMap::INVALID_MARK)
+  {
+    CGAL_assertion( amap!=NULL );
+    CGAL_static_assertion_msg(CMap::Helper::template
+                              Dimension_index<0>::value>=0,
+                              "Test_split_attribute_functor_run<0> but "
+                              "0-attributes are disabled");
+
+    typedef typename CMap::template Attribute_handle<0>::type
+        Attribute_handle_0;
+
+    CGAL::Unique_hash_map<Attribute_handle_0, unsigned int,
+                          typename CMap::Hash_function> found_attributes;
+    typename CMap::Dart_handle od=amap->null_handle;
+
+    typename CMap::size_type mark = amap->get_new_mark(); // to mark incident cells.
+    typename std::deque<typename CMap::Dart_handle>::const_iterator
+        it=modified_darts.begin();
+    for ( ; it!=modified_darts.end(); ++it )
+    {
+      CGAL::internal::test_split_attribute_functor_one_dart<CMap,0>
+          (amap, *it, found_attributes, mark);
+    }
+    typename std::deque<typename CMap::Dart_handle>::const_iterator
+        it2=modified_darts2.begin();
+    for ( ; it2!=modified_darts2.end(); ++it2 )
+    {
+      od=amap->other_extremity(*it2);
+      if ( od!=amap->null_handle )
+        CGAL::internal::test_split_attribute_functor_one_dart<CMap,0>
+            (amap, od, found_attributes, mark);
+    }
+
+    // Now we unmark all the marked darts.
+    amap->negate_mark(mark);
+    for ( it=modified_darts.begin(); it!=modified_darts.end(); ++it )
+    {
+      if ( mark_modified_darts!=CMap::INVALID_MARK )
+        amap->unmark(*it, mark_modified_darts);
+
+      if ( !amap->is_marked(*it, mark) )
+        CGAL::mark_cell<CMap, 0>(*amap, *it, mark);
+    }
+    for ( it2=modified_darts2.begin(); it2!=modified_darts2.end(); ++it2 )
+    {
+      if ( mark_modified_darts!=CMap::INVALID_MARK )
+        amap->unmark(*it2, mark_modified_darts);
+
+      od=amap->other_extremity(*it2);
+      if ( od!=amap->null_handle && !amap->is_marked(od, mark) )
+        CGAL::mark_cell<CMap, 0>(*amap, od, mark);
+    }
+
+    CGAL_assertion( amap->is_whole_map_marked(mark) );
+    amap->free_mark(mark);
+  }
+};
+// Specialization for i=0 and j=1.
+// Equivalent to i=0 and j=0.
+template<typename CMap, typename T>
+struct Test_split_nonvoid_attribute_functor_run<CMap, 0, 1, T>
+{
+  static void run( CMap*, const std::deque<typename CMap::Dart_handle>&,
+                   typename CMap::size_type =CMap::INVALID_MARK)
+  { CGAL_assertion(false); }
+  static void run( CMap* amap, const std::deque<typename CMap::Dart_handle>&
+                   modified_darts,
+                   const std::deque<typename CMap::Dart_handle>&
+                   modified_darts2,
+                   typename CMap::size_type mark_modified_darts=CMap::INVALID_MARK)
+  { CGAL::internal::Test_split_nonvoid_attribute_functor_run<CMap, 0, 0, T>::
+        run(amap, modified_darts, modified_darts2, mark_modified_darts); }
+};
+// Specialization for i=j.
+template<typename CMap, unsigned int i, typename T>
+struct Test_split_nonvoid_attribute_functor_run<CMap, i, i, T>
+{
+  static void run( CMap*, const std::deque<typename CMap::Dart_handle>&,
+                   typename CMap::size_type=CMap::INVALID_MARK)
+  {}
+  static void run( CMap*, const std::deque<typename CMap::Dart_handle>&,
+                   const std::deque<typename CMap::Dart_handle>&,
+                   typename CMap::size_type=CMap::INVALID_MARK)
+  {}
+};
+// Specialization for i=1 and j=0 (edge attributes are not modified
+// when we modify beta_0).
+template<typename CMap, typename T>
+struct Test_split_nonvoid_attribute_functor_run<CMap, 1, 0, T>
+{
+  static void run( CMap*, const std::deque<typename CMap::Dart_handle>&,
+                   typename CMap::size_type=CMap::INVALID_MARK)
+  {}
+  static void run( CMap*, const std::deque<typename CMap::Dart_handle>&,
+                   const std::deque<typename CMap::Dart_handle>&,
+                   typename CMap::size_type=CMap::INVALID_MARK)
+  {}
+};
+//------------------------------------------------------------------------------
+template<typename CMap, unsigned int i, unsigned int j=CMap::dimension+1,
+         typename T=typename CMap::template Attribute_type<i>::type>
+struct Test_split_attribute_functor_run
+{
+  // modified_darts is the set of modified darts for beta_j
+  static void run( CMap* amap,
+                   const std::deque<typename CMap::Dart_handle>
+                   &modified_darts,
+                   typename CMap::size_type mark_modified_darts=CMap::INVALID_MARK)
+  { Test_split_nonvoid_attribute_functor_run<CMap, i, j, T>::
+      run(amap, modified_darts, mark_modified_darts);
+  }
+  static void run( CMap* amap,
+                   const std::deque<typename CMap::Dart_handle>
+                   &modified_darts,
+                   const std::deque<typename CMap::Dart_handle>
+                   &modified_darts2,
+                   typename CMap::size_type mark_modified_darts=CMap::INVALID_MARK)
+  { Test_split_nonvoid_attribute_functor_run<CMap, i, j, T>::
+      run(amap, modified_darts, modified_darts2, mark_modified_darts);
+  }
+};
+// Specialization for void attributes.
+template<typename CMap, unsigned int i, unsigned int j>
+struct Test_split_attribute_functor_run<CMap, i, j, CGAL::Void>
+{
+  static void run( CMap*, const std::deque<typename CMap::Dart_handle>&,
+                   typename CMap::size_type=CMap::INVALID_MARK)
+  {}
+  static void run( CMap*, const std::deque<typename CMap::Dart_handle>&,
+                   const std::deque<typename CMap::Dart_handle>&,
+                   typename CMap::size_type=CMap::INVALID_MARK)
+  {}
+};
+// ************************************************************************
+/// Functor used for unsew to test if i-attributes are split after an
+/// operation, except for j-attributes.
+/// We define run<i> to allows to use this functor with
+/// Foreach_enabled_attributes.
+template<typename CMap, unsigned int j=CMap::dimension+1>
+struct Test_split_attribute_functor
+{
+  // Test the split of i-attributes, for all modified darts given in
+  // modified_darts, and marked with mark_modified_darts.
+  // For each split attribute, create a new i-attribute, associate
+  // it with the new i-cell and call onsplit functors.
+  template <unsigned int i>
+  static void run( CMap* amap,
+                   const std::deque<typename CMap::Dart_handle>
+                   &modified_darts,
+                   typename CMap::size_type mark_modified_darts=CMap::INVALID_MARK)
+  {
+    CGAL::internal::Test_split_attribute_functor_run<CMap, i, j>::
+        run(amap, modified_darts, mark_modified_darts);
+  }
+  template <unsigned int i>
+  static void run( CMap* amap,
+                   const std::deque<typename CMap::Dart_handle>
+                   &modified_darts,
+                   const std::deque<typename CMap::Dart_handle>
+                   &modified_darts2,
+                   typename CMap::size_type mark_modified_darts=CMap::INVALID_MARK)
+  {
+    CGAL::internal::Test_split_attribute_functor_run<CMap, i, j>::
+        run(amap, modified_darts, modified_darts2, mark_modified_darts);
+  }
+};
+// ************************************************************************
+} // namespace internal
+} // namespace CGAL
+
+#endif // CGAL_COMBINATORIAL_MAP_GROUP_FUNCTORS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Combinatorial_map_internal_functors.h b/3rdparty/CGAL/include/CGAL/internal/Combinatorial_map_internal_functors.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Combinatorial_map_internal_functors.h
rename to 3rdparty/CGAL/include/CGAL/internal/Combinatorial_map_internal_functors.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Combinatorial_map_sewable.h b/3rdparty/CGAL/include/CGAL/internal/Combinatorial_map_sewable.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Combinatorial_map_sewable.h
rename to 3rdparty/CGAL/include/CGAL/internal/Combinatorial_map_sewable.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Combinatorial_map_utility.h b/3rdparty/CGAL/include/CGAL/internal/Combinatorial_map_utility.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Combinatorial_map_utility.h
rename to 3rdparty/CGAL/include/CGAL/internal/Combinatorial_map_utility.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Combinatorial_map_utility_novariadic.h b/3rdparty/CGAL/include/CGAL/internal/Combinatorial_map_utility_novariadic.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Combinatorial_map_utility_novariadic.h
rename to 3rdparty/CGAL/include/CGAL/internal/Combinatorial_map_utility_novariadic.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Delaunay_triangulation_hierarchy_3.h b/3rdparty/CGAL/include/CGAL/internal/Delaunay_triangulation_hierarchy_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Delaunay_triangulation_hierarchy_3.h
rename to 3rdparty/CGAL/include/CGAL/internal/Delaunay_triangulation_hierarchy_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Dummy_tds_3.h b/3rdparty/CGAL/include/CGAL/internal/Dummy_tds_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Dummy_tds_3.h
rename to 3rdparty/CGAL/include/CGAL/internal/Dummy_tds_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Exact_type_selector.h b/3rdparty/CGAL/include/CGAL/internal/Exact_type_selector.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Exact_type_selector.h
rename to 3rdparty/CGAL/include/CGAL/internal/Exact_type_selector.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Get_dimension_tag.h b/3rdparty/CGAL/include/CGAL/internal/Get_dimension_tag.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Get_dimension_tag.h
rename to 3rdparty/CGAL/include/CGAL/internal/Get_dimension_tag.h
diff --git a/3rdparty/CGAL/include/CGAL/internal/Has_boolean_tags.h b/3rdparty/CGAL/include/CGAL/internal/Has_boolean_tags.h
new file mode 100644
index 0000000..6e718c7
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/internal/Has_boolean_tags.h
@@ -0,0 +1,82 @@
+// Copyright (c) 2016  GeometryFactory SARL(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(s)     : Sebastien Loriot
+//
+
+#ifndef CGAL_INTERNAL_HAS_BOOLEAN_TAGS_H
+#define CGAL_INTERNAL_HAS_BOOLEAN_TAGS_H
+
+#include <boost/mpl/has_xxx.hpp>
+#include <CGAL/tags.h>
+
+namespace CGAL{
+
+namespace internal{
+
+#define CGAL_HAS_XXX_MEMBER_NAMED_DEF(CLASS,MEMBER) \
+template<typename T> struct CLASS { \
+    struct Base { int MEMBER; }; \
+    struct Derived : T, Base { }; \
+\
+    template<typename C, C> struct Check; \
+\
+    template<typename C> static char (&f(Check<int Base::*, &C::MEMBER>*))[1]; \
+    template<typename C> static char (&f(...))[2]; \
+\
+    static bool const value = sizeof(f<Derived>(0)) == 2;\
+};
+
+CGAL_HAS_XXX_MEMBER_NAMED_DEF(Has_nested_type_Has_filtered_predicates,Has_filtered_predicates)
+CGAL_HAS_XXX_MEMBER_NAMED_DEF(Has_nested_type_Has_static_filters,Has_static_filters)
+
+#undef CGAL_HAS_XXX_MEMBER_NAMED_DEF
+
+template<class Traits, bool has_tag = Has_nested_type_Has_filtered_predicates<Traits>::value >
+struct Has_filtered_predicates;
+
+template<class Traits>
+struct Has_filtered_predicates<Traits,false>
+{
+  static const bool value = false;
+};
+
+template<class Traits>
+struct Has_filtered_predicates<Traits,true>
+{
+  static const bool value = Traits::Has_filtered_predicates;
+};
+
+template<class Traits, bool has_tag = Has_nested_type_Has_static_filters<Traits>::value >
+struct Has_static_filters;
+
+template<class Traits>
+struct Has_static_filters<Traits,false>
+{
+  static const bool value = false;
+};
+
+template<class Traits>
+struct Has_static_filters<Traits,true>
+{
+  static const bool value = Traits::Has_static_filters;
+};
+
+} } //namespace CGAL::internal
+
+#endif //CGAL_INTERNAL_HAS_BOOLEAN_TAGS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Intersections_3/Bbox_3_Bbox_3_do_intersect.h b/3rdparty/CGAL/include/CGAL/internal/Intersections_3/Bbox_3_Bbox_3_do_intersect.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Intersections_3/Bbox_3_Bbox_3_do_intersect.h
rename to 3rdparty/CGAL/include/CGAL/internal/Intersections_3/Bbox_3_Bbox_3_do_intersect.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Intersections_3/Bbox_3_Line_3_do_intersect.h b/3rdparty/CGAL/include/CGAL/internal/Intersections_3/Bbox_3_Line_3_do_intersect.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Intersections_3/Bbox_3_Line_3_do_intersect.h
rename to 3rdparty/CGAL/include/CGAL/internal/Intersections_3/Bbox_3_Line_3_do_intersect.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Intersections_3/Bbox_3_Plane_3_do_intersect.h b/3rdparty/CGAL/include/CGAL/internal/Intersections_3/Bbox_3_Plane_3_do_intersect.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Intersections_3/Bbox_3_Plane_3_do_intersect.h
rename to 3rdparty/CGAL/include/CGAL/internal/Intersections_3/Bbox_3_Plane_3_do_intersect.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Intersections_3/Bbox_3_Ray_3_do_intersect.h b/3rdparty/CGAL/include/CGAL/internal/Intersections_3/Bbox_3_Ray_3_do_intersect.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Intersections_3/Bbox_3_Ray_3_do_intersect.h
rename to 3rdparty/CGAL/include/CGAL/internal/Intersections_3/Bbox_3_Ray_3_do_intersect.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Intersections_3/Bbox_3_Segment_3_do_intersect.h b/3rdparty/CGAL/include/CGAL/internal/Intersections_3/Bbox_3_Segment_3_do_intersect.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Intersections_3/Bbox_3_Segment_3_do_intersect.h
rename to 3rdparty/CGAL/include/CGAL/internal/Intersections_3/Bbox_3_Segment_3_do_intersect.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Intersections_3/Bbox_3_Sphere_3_do_intersect.h b/3rdparty/CGAL/include/CGAL/internal/Intersections_3/Bbox_3_Sphere_3_do_intersect.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Intersections_3/Bbox_3_Sphere_3_do_intersect.h
rename to 3rdparty/CGAL/include/CGAL/internal/Intersections_3/Bbox_3_Sphere_3_do_intersect.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Intersections_3/Bbox_3_Triangle_3_do_intersect.h b/3rdparty/CGAL/include/CGAL/internal/Intersections_3/Bbox_3_Triangle_3_do_intersect.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Intersections_3/Bbox_3_Triangle_3_do_intersect.h
rename to 3rdparty/CGAL/include/CGAL/internal/Intersections_3/Bbox_3_Triangle_3_do_intersect.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Intersections_3/Triangle_3_Line_3_intersection.h b/3rdparty/CGAL/include/CGAL/internal/Intersections_3/Triangle_3_Line_3_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Intersections_3/Triangle_3_Line_3_intersection.h
rename to 3rdparty/CGAL/include/CGAL/internal/Intersections_3/Triangle_3_Line_3_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Intersections_3/Triangle_3_Ray_3_intersection.h b/3rdparty/CGAL/include/CGAL/internal/Intersections_3/Triangle_3_Ray_3_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Intersections_3/Triangle_3_Ray_3_intersection.h
rename to 3rdparty/CGAL/include/CGAL/internal/Intersections_3/Triangle_3_Ray_3_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Intersections_3/Triangle_3_Segment_3_intersection.h b/3rdparty/CGAL/include/CGAL/internal/Intersections_3/Triangle_3_Segment_3_intersection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Intersections_3/Triangle_3_Segment_3_intersection.h
rename to 3rdparty/CGAL/include/CGAL/internal/Intersections_3/Triangle_3_Segment_3_intersection.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/K_neighbor_search.h b/3rdparty/CGAL/include/CGAL/internal/K_neighbor_search.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/K_neighbor_search.h
rename to 3rdparty/CGAL/include/CGAL/internal/K_neighbor_search.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Lazy_alpha_nt_2.h b/3rdparty/CGAL/include/CGAL/internal/Lazy_alpha_nt_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Lazy_alpha_nt_2.h
rename to 3rdparty/CGAL/include/CGAL/internal/Lazy_alpha_nt_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Lazy_alpha_nt_3.h b/3rdparty/CGAL/include/CGAL/internal/Lazy_alpha_nt_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Lazy_alpha_nt_3.h
rename to 3rdparty/CGAL/include/CGAL/internal/Lazy_alpha_nt_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Mesh_3/Boundary_of_subdomain_of_complex_3_in_triangulation_3_to_off.h b/3rdparty/CGAL/include/CGAL/internal/Mesh_3/Boundary_of_subdomain_of_complex_3_in_triangulation_3_to_off.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Mesh_3/Boundary_of_subdomain_of_complex_3_in_triangulation_3_to_off.h
rename to 3rdparty/CGAL/include/CGAL/internal/Mesh_3/Boundary_of_subdomain_of_complex_3_in_triangulation_3_to_off.h
diff --git a/3rdparty/CGAL/include/CGAL/internal/Mesh_3/Graph_manipulations.h b/3rdparty/CGAL/include/CGAL/internal/Mesh_3/Graph_manipulations.h
new file mode 100644
index 0000000..c720688
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/internal/Mesh_3/Graph_manipulations.h
@@ -0,0 +1,115 @@
+// Copyright (c) 2015 GeometryFactory
+// 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
+// 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(s)     : Laurent Rineau
+
+#ifndef CGAL_INTERNAL_MESH_3_INTERNAL_GRAPH_MANIPULATIONS
+#define CGAL_INTERNAL_MESH_3_INTERNAL_GRAPH_MANIPULATIONS
+
+#include <CGAL/Kernel/global_functions_3.h>
+// Assumes the point is a CGAL point.
+
+#include <boost/graph/graph_traits.hpp>
+
+#include <map>
+
+namespace CGAL {
+namespace internal {
+namespace Mesh_3 {
+
+template <typename Graph, typename Point_3>
+struct Graph_manipulations
+{
+  typedef typename boost::graph_traits<Graph>::vertex_descriptor vertex_descriptor;
+  typedef typename boost::graph_traits<Graph>::edge_descriptor edge_descriptor;
+
+  std::map<Point_3, vertex_descriptor> p2v;
+  Graph& g;
+
+  Graph_manipulations(Graph& g) : g(g) {}
+
+  vertex_descriptor get_vertex(const Point_3& p) {
+    typename std::map<Point_3, vertex_descriptor>::iterator
+      it = p2v.find(p);
+    if(it == p2v.end()){
+      vertex_descriptor v0 = add_vertex(g);
+      p2v[p] = v0;
+      g[v0] = p;
+      return v0;
+    } else {
+      return it->second;
+    }
+  }
+
+  vertex_descriptor split(const Point_3& a, const Point_3& b,
+                          bool a_is_outside, bool b_is_outside)
+  {
+#ifdef CGAL_MESH_3_DEBUG_GRAPH_MANIPULATION
+    std::cerr << "split(" << a << ", " << b << ", "
+              << std::boolalpha << a_is_outside << ", "
+              <<  std::boolalpha << b_is_outside << ")\n";
+#endif // CGAL_MESH_3_DEBUG_GRAPH_MANIPULATION
+    const Point_3 mid = a < b ? midpoint(a, b) : midpoint(b, a);
+    vertex_descriptor vmid = get_vertex(mid);
+    typename std::map<Point_3, vertex_descriptor>::iterator
+      it_a = p2v.find(a),
+      it_b = p2v.find(b);
+    if(it_a != p2v.end() && it_b != p2v.end()) {
+      vertex_descriptor va = it_a->second;
+      vertex_descriptor vb = it_b->second;
+      edge_descriptor edge;
+      bool b;
+      // test if the edge is already here, using add_edge
+      boost::tie(edge, b) = add_edge(va, vb, g);
+      remove_edge(edge, g);
+      if(!b) {
+        // The edge was already here.
+        if(!a_is_outside) try_add_edge(va, vmid);
+        if(!b_is_outside) try_add_edge(vb, vmid);
+#ifdef CGAL_MESH_3_DEBUG_GRAPH_MANIPULATION
+        std::cerr << " --> vmid = " << vmid << "\n";
+#endif // CGAL_MESH_3_DEBUG_GRAPH_MANIPULATION
+        return vmid;
+      }
+    }
+#ifdef CGAL_MESH_3_DEBUG_GRAPH_MANIPULATION
+    std::cerr << " --> vmid = " << vmid << "\n";
+#endif // CGAL_MESH_3_DEBUG_GRAPH_MANIPULATION
+    return vmid;
+  }
+
+  bool try_add_edge(vertex_descriptor v1, vertex_descriptor v2) {
+#ifdef CGAL_MESH_3_DEBUG_GRAPH_MANIPULATION
+    std::cerr << "try_add_edge(" << v1 << " (" << g[v1]
+              << "), " << v2 << " (" << g[v2] << "))\n";
+#endif // CGAL_MESH_3_DEBUG_GRAPH_MANIPULATION
+    if(v1 != v2) {
+      edge_descriptor edge;
+      bool b;
+      boost::tie(edge, b) = add_edge(v1, v2, g);
+      return b;
+    } else
+      return false;
+  }
+}; // struct template Graph_manipulations
+
+} // namespace Mesh_3
+} // namespace internal
+} // namespace CGAL
+
+#endif //CGAL_INTERNAL_MESH_3_INTERNAL_GRAPH_MANIPULATIONS
diff --git a/3rdparty/CGAL/include/CGAL/internal/Mesh_3/Handle_IO_for_pair_of_int.h b/3rdparty/CGAL/include/CGAL/internal/Mesh_3/Handle_IO_for_pair_of_int.h
new file mode 100644
index 0000000..777c47a
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/internal/Mesh_3/Handle_IO_for_pair_of_int.h
@@ -0,0 +1,84 @@
+// Copyright (c) 2016 GeometryFactory
+// 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
+// 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(s)     : Laurent Rineau
+
+#ifndef CGAL_INTERNAL_MESH_3_INTERNAL_HANDLE_IO_FOR_PAIR_OF_INT_H
+#define CGAL_INTERNAL_MESH_3_INTERNAL_HANDLE_IO_FOR_PAIR_OF_INT_H
+
+#include <utility>
+#include <CGAL/Mesh_3/io_signature.h>
+#include <ostream>
+#include <istream>
+
+namespace CGAL {
+template <>
+struct Get_io_signature<std::pair<int, int> > {
+  std::string operator()() const
+  {
+    return std::string("std::pair<i,i>");
+  }
+}; // end Get_io_signature<std::pair<int, int> >
+
+inline std::ostream& operator<<(std::ostream& out, const std::pair<int, int>& id) {
+  return out << id.first << " " << id.second;
+}
+inline std::istream& operator>>(std::istream& in, std::pair<int, int>& id) {
+  return in >> id.first >> id.second;
+}
+
+template <>
+class Output_rep<std::pair<int, int> > : public IO_rep_is_specialized {
+  typedef std::pair<int, int> T;
+  const T& t;
+public:
+  //! initialize with a const reference to \a t.
+  Output_rep( const T& tt) : t(tt) {}
+  //! perform the output, calls \c operator\<\< by default.
+  std::ostream& operator()( std::ostream& out) const {
+    if(is_ascii(out)) {
+      out << t.first << " " << t.second;
+    } else {
+      CGAL::write(out, t.first);
+      CGAL::write(out, t.second);
+    }
+    return out;
+  }
+};
+
+template <>
+class Input_rep<std::pair<int, int> > : public IO_rep_is_specialized {
+  typedef std::pair<int, int> T;
+  T& t;
+public:
+  //! initialize with a const reference to \a t.
+  Input_rep( T& tt) : t(tt) {}
+  //! perform the output, calls \c operator\<\< by default.
+  std::istream& operator()( std::istream& in) const {
+    if(is_ascii(in)) {
+      in >> t.first >> t.second;
+    } else {
+      CGAL::read(in, t.first);
+      CGAL::read(in, t.second);
+    }
+    return in;
+  }
+};
+} // end namespace CGAL
+
+#endif // CGAL_INTERNAL_MESH_3_INTERNAL_HANDLE_IO_FOR_PAIR_OF_INT_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Mesh_3/check_weights.h b/3rdparty/CGAL/include/CGAL/internal/Mesh_3/check_weights.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Mesh_3/check_weights.h
rename to 3rdparty/CGAL/include/CGAL/internal/Mesh_3/check_weights.h
diff --git a/3rdparty/CGAL/include/CGAL/internal/Mesh_3/get_index.h b/3rdparty/CGAL/include/CGAL/internal/Mesh_3/get_index.h
new file mode 100644
index 0000000..25a58ff
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/internal/Mesh_3/get_index.h
@@ -0,0 +1,171 @@
+// Copyright (c) 2009 INRIA Sophia-Antipolis (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
+// 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: https://scm.gforge.inria.fr/svn/cgal/branches/features/Mesh_3-experimental-GF/Mesh_3/include/CGAL/internal/Mesh_3/get_index.h $
+// $Id: get_index.h 67573 2012-02-02 14:54:51Z lrineau $
+//
+//
+// Author(s)     : Stéphane Tayeb
+//
+//******************************************************************************
+// File Description :
+//
+//
+//******************************************************************************
+
+#ifndef CGAL_INTERNAL_MESH_3_GET_INDEX_3_H
+#define CGAL_INTERNAL_MESH_3_GET_INDEX_3_H
+
+#include <boost/type_traits/is_same.hpp>
+#include <CGAL/Mesh_3/Has_features.h>
+#include <CGAL/IO/io.h>
+
+namespace CGAL {
+namespace internal {
+namespace Mesh_3 {
+  
+  
+template <typename T, typename Boost_variant>
+const T& get_index(const Boost_variant& x,
+                   typename boost::disable_if<boost::is_same<T, Boost_variant> >::type * = 0)
+{ return boost::get<T>(x); }
+
+template <typename T>
+const T& get_index(const T& x) { return x; }
+
+template <typename Mesh_domain, 
+          bool has_feature = Has_features<Mesh_domain>::value> 
+struct Read_mesh_domain_index {
+  // here we have has_feature==true
+
+  typedef Mesh_domain MT; // was named "mesh traits" previously
+
+  typename Mesh_domain::Index 
+  operator()(int dimension, std::istream& is) const {
+    switch(dimension) {
+    case 0: 
+      typename MT::Corner_index ci;
+      if(is_ascii(is)) is >> ci;
+      else CGAL::read(is, ci);
+      return  ci;
+      break;
+    case 1: 
+      typename MT::Curve_segment_index si;
+      if(is_ascii(is)) is >> si;
+      else CGAL::read(is, si);
+      return  si;
+      break;
+    default:
+      return Read_mesh_domain_index<Mesh_domain, false>()(dimension, is);
+    }
+  }
+}; // end template partial specialization 
+   // Read_mesh_domain_index<Mesh_domain, true>
+
+template <typename Mesh_domain, 
+          bool has_feature = Has_features<Mesh_domain>::value> 
+struct Write_mesh_domain_index {
+  // here we have has_feature==true
+
+  typedef Mesh_domain MT; // was named "mesh traits" previously
+  typedef typename MT::Corner_index Ci;
+  typedef typename MT::Curve_segment_index  Si;
+
+  void
+  operator()(std::ostream& os, int dimension,
+             const typename Mesh_domain::Index& index) const {
+    switch(dimension) {
+    case 0: {
+      const Ci& ci = get_index<Ci>(index);
+      if(is_ascii(os)) os << oformat(ci);
+      else CGAL::write(os, ci);
+    }
+      break;
+    case 1: {
+      const Si& si = get_index<Si>(index);
+      if(is_ascii(os)) os << oformat(si);
+      else CGAL::write(os, si);
+    }
+      break;
+    default:
+      Write_mesh_domain_index<Mesh_domain, false>()(os, dimension, index);
+    }
+  }
+}; // end template partial specialization 
+   // Write_mesh_domain_index<Mesh_domain, true>
+
+template <typename Mesh_domain>
+struct Read_mesh_domain_index<Mesh_domain, false> {
+  // here we have has_feature==false
+
+  typedef Mesh_domain MT; // was named "mesh traits" previously
+
+  typename Mesh_domain::Index 
+  operator()(int dimension, std::istream& is) const {
+    switch(dimension) {
+    case 2: {
+      typename MT::Surface_patch_index spi;
+      if(is_ascii(is)) is >> iformat(spi);
+      else CGAL::read(is, spi);
+      return  spi;
+    }
+      break;
+    default: {// 3
+      typename MT::Subdomain_index di;
+      if(is_ascii(is)) is >> iformat(di);
+      else CGAL::read(is, di);
+      return  di;
+    }
+      break;
+    }
+  }
+}; // end template partial specialization 
+   // Read_mesh_domain_index<Mesh_domain, false>
+
+template <typename Mesh_domain>
+struct Write_mesh_domain_index<Mesh_domain, false> {
+  // here we have has_feature==false
+
+  typedef Mesh_domain MT; // was named "mesh traits" previously
+  typedef typename MT::Surface_patch_index Spi;
+  typedef typename MT::Subdomain_index Di;
+
+  void
+  operator()(std::ostream& os, int dimension,
+             const typename Mesh_domain::Index& index) const {
+    switch(dimension) {
+    case 2: {
+      const Spi& spi = get_index<Spi>(index);
+      if(is_ascii(os)) os << oformat(spi);
+      else CGAL::write(os, spi);
+    }
+      break;
+    default: {// 3
+      const Di& di = get_index<Di>(index);
+      if(is_ascii(os)) os << oformat(di);
+      else CGAL::write(os, di);
+    }
+      break;
+    }
+  }
+}; // end template partial specialization 
+   // Write_mesh_domain_index<Mesh_domain, false>
+
+
+
+}
+}
+}
+
+#endif
diff --git a/3rdparty/CGAL/include/CGAL/internal/Periodic_3_Delaunay_triangulation_filtered_traits_3.h b/3rdparty/CGAL/include/CGAL/internal/Periodic_3_Delaunay_triangulation_filtered_traits_3.h
new file mode 100644
index 0000000..41d3cbc
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/internal/Periodic_3_Delaunay_triangulation_filtered_traits_3.h
@@ -0,0 +1,167 @@
+// Copyright (c) 2004,2006-2009   INRIA Sophia-Antipolis (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
+// 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(s)     : Sylvain Pion <Sylvain.Pion at sophia.inria.fr>
+//                 Nico Kruithof <Nico.Kruithof at sophia.inria.fr>
+//                 Manuel Caroli <Manuel.Caroli at sophia.inria.fr>
+
+
+#ifndef CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_FILTERED_TRAITS_3_H
+#define CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_FILTERED_TRAITS_3_H
+
+#include <string>
+#include <CGAL/basic.h>
+#include <CGAL/config.h>
+#include <CGAL/Interval_nt.h>
+#include <CGAL/Uncertain.h>
+#include <CGAL/Profile_counter.h>
+#include <CGAL/internal/Periodic_3_triangulation_filtered_traits_3.h>
+#include <CGAL/Periodic_3_Delaunay_triangulation_traits_3.h>
+
+namespace CGAL {
+
+// The argument is supposed to be a Filtered_kernel like kernel.
+template < typename K, typename Off >
+class Periodic_3_Delaunay_triangulation_filtered_traits_base_3
+  : public Periodic_3_Delaunay_triangulation_traits_base_3<K, Off>
+{
+  typedef Periodic_3_Delaunay_triangulation_traits_base_3<K, Off> Base;
+
+  // Exact traits is based on the exact kernel.
+  typedef Periodic_3_Delaunay_triangulation_traits_3<typename K::Exact_kernel,
+                                            Off>
+                                                   Exact_traits;
+  // Filtering traits is based on the filtering kernel.
+  typedef Periodic_3_Delaunay_triangulation_traits_3<typename K::Approximate_kernel,
+                                            Off>
+                                                   Filtering_traits;
+private:
+  typedef typename K::C2E C2E;
+  typedef typename K::C2F C2F;
+
+  typedef typename C2E::Target_kernel::Iso_cuboid_3 Exact_iso_cuboid_3;
+  typedef typename C2F::Target_kernel::Iso_cuboid_3 Approximate_iso_cuboid_3;
+ 
+public:
+  typedef typename K::Iso_cuboid_3 Iso_cuboid_3;
+
+  void set_domain(const Iso_cuboid_3& domain) {
+    C2E c2e;
+    C2F c2f;
+    this->_domain = domain;
+    this->_domain_e = c2e(this->_domain);
+    this->_domain_f = c2f(this->_domain);
+  }
+
+  typedef Filtered_periodic_predicate<
+            typename Exact_traits::Compare_xyz_3,
+            typename Filtering_traits::Compare_xyz_3,
+            Offset_converter_3<C2E>,
+            Offset_converter_3<C2F> >  Compare_xyz_3;
+
+  typedef Filtered_periodic_predicate<
+            typename Exact_traits::Coplanar_orientation_3,
+            typename Filtering_traits::Coplanar_orientation_3,
+            Offset_converter_3<C2E>,
+            Offset_converter_3<C2F> >  Coplanar_orientation_3;
+
+  typedef Filtered_periodic_predicate<
+            typename Exact_traits::Orientation_3,
+            typename Filtering_traits::Orientation_3,
+            Offset_converter_3<C2E>,
+            Offset_converter_3<C2F> >  Orientation_3;
+
+  typedef Filtered_periodic_predicate<
+            typename Exact_traits::Coplanar_side_of_bounded_circle_3,
+            typename Filtering_traits::Coplanar_side_of_bounded_circle_3,
+            Offset_converter_3<C2E>,
+            Offset_converter_3<C2F> >  Coplanar_side_of_bounded_circle_3;
+
+  typedef Filtered_periodic_predicate<
+            typename Exact_traits::Side_of_oriented_sphere_3,
+            typename Filtering_traits::Side_of_oriented_sphere_3,
+            Offset_converter_3<C2E>,
+            Offset_converter_3<C2F> >  Side_of_oriented_sphere_3;
+
+  typedef Filtered_periodic_predicate<
+            typename Exact_traits::Compare_distance_3,
+            typename Filtering_traits::Compare_distance_3,
+            Offset_converter_3<C2E>,
+            Offset_converter_3<C2F> >  Compare_distance_3;
+
+  typedef Filtered_periodic_predicate<
+            typename Exact_traits::Side_of_bounded_sphere_3,
+            typename Filtering_traits::Side_of_bounded_sphere_3,
+            Offset_converter_3<C2E>,
+            Offset_converter_3<C2F> >  Side_of_bounded_sphere_3;
+
+
+  Compare_xyz_3 compare_xyz_3_object() const
+  { return Compare_xyz_3(&_domain_e,&_domain_f);}
+
+  Coplanar_orientation_3 coplanar_orientation_3_object() const
+  { return Coplanar_orientation_3(&_domain_e,&_domain_f); }
+
+  Orientation_3 orientation_3_object() const
+  { return Orientation_3(&_domain_e,&_domain_f);}
+
+  Coplanar_side_of_bounded_circle_3
+  coplanar_side_of_bounded_circle_3_object() const 
+  { return Coplanar_side_of_bounded_circle_3(&_domain_e,&_domain_f); }
+
+  Side_of_oriented_sphere_3 side_of_oriented_sphere_3_object() const
+  { return Side_of_oriented_sphere_3(&_domain_e,&_domain_f);}
+
+  Compare_distance_3 compare_distance_3_object() const
+  { return Compare_distance_3(&_domain_e,&_domain_f);}
+
+  Side_of_bounded_sphere_3 side_of_bounded_sphere_3_object() const
+  { return Side_of_bounded_sphere_3(&_domain_e,&_domain_f);}
+
+  // The following are inherited since they are constructions :
+  // Construct_segment_3
+  // Construct_triangle_3
+  // Construct_tetrahedron_3
+  // Construct_circumcenter_3
+
+ protected:
+  Exact_iso_cuboid_3 _domain_e;
+  Approximate_iso_cuboid_3 _domain_f;
+};
+
+} //namespace CGAL
+
+#include <CGAL/internal/Periodic_3_Delaunay_triangulation_statically_filtered_traits_3.h>
+
+namespace CGAL {
+
+template < typename K, typename Off = typename CGAL::Periodic_3_offset_3, bool Has_static_filters = internal::Has_static_filters<K>::value >
+class Periodic_3_Delaunay_triangulation_filtered_traits_3
+  : public Periodic_3_Delaunay_triangulation_statically_filtered_traits_3<
+  Periodic_3_Delaunay_triangulation_filtered_traits_base_3<K, Off> > {
+};
+
+template < typename K_, typename Off>
+class Periodic_3_Delaunay_triangulation_filtered_traits_3<K_, Off, false>
+  :  public Periodic_3_Delaunay_triangulation_filtered_traits_base_3<K_, Off>
+{
+};
+
+} //namespace CGAL
+
+#endif // CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_FILTERED_TRAITS_3_H
diff --git a/3rdparty/CGAL/include/CGAL/internal/Periodic_3_Delaunay_triangulation_statically_filtered_traits_3.h b/3rdparty/CGAL/include/CGAL/internal/Periodic_3_Delaunay_triangulation_statically_filtered_traits_3.h
new file mode 100644
index 0000000..81189b5
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/internal/Periodic_3_Delaunay_triangulation_statically_filtered_traits_3.h
@@ -0,0 +1,62 @@
+// Copyright (c) 2001,2004,2008-2009   INRIA Sophia-Antipolis (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
+// 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(s)     : Sylvain Pion <Sylvain.Pion at sophia.inria.fr>
+//                 Manuel Caroli <Manuel.Caroli at sophia.inria.fr>
+ 
+#ifndef CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_STATICALLY_FILTERED_TRAITS_3_H
+#define CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_STATICALLY_FILTERED_TRAITS_3_H
+
+// This class gathers optimized predicates written by hand, using
+// a few steps of filtering.  It should work if the initial traits has
+// cartesian coordinates which fit exactly in doubles.
+//
+// Purely static filters code has been removed, since it requires additional
+// logic and is not plug'n play (requires users providing bounds).
+// If it should be provided again, it should probably be separate.
+
+#include <CGAL/internal/Periodic_3_triangulation_statically_filtered_traits_3.h>
+
+#include <CGAL/internal/Static_filters/Periodic_3_side_of_oriented_sphere_3.h>
+
+// TODO :
+// - add more predicates :
+
+namespace CGAL {
+
+// The K_base argument is supposed to provide exact primitives.
+template < typename Traits >
+class Periodic_3_Delaunay_triangulation_statically_filtered_traits_3 : public Periodic_3_triangulation_statically_filtered_traits_3<Traits>
+{
+  typedef Periodic_3_Delaunay_triangulation_statically_filtered_traits_3<Traits> Self;
+
+public:
+
+  typedef internal::Static_filters_predicates::Periodic_3_side_of_oriented_sphere_3<Traits>
+    Side_of_oriented_sphere_3;
+
+  Side_of_oriented_sphere_3  side_of_oriented_sphere_3_object() const {
+    return Side_of_oriented_sphere_3(&this->_domain,
+                                     &this->_domain_e,
+                                     &this->_domain_f);
+  }
+};
+
+} //namespace CGAL
+
+#endif // CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_STATICALLY_FILTERED_TRAITS_3_H
diff --git a/3rdparty/CGAL/include/CGAL/internal/Periodic_3_triangulation_filtered_traits_3.h b/3rdparty/CGAL/include/CGAL/internal/Periodic_3_triangulation_filtered_traits_3.h
new file mode 100644
index 0000000..f952636
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/internal/Periodic_3_triangulation_filtered_traits_3.h
@@ -0,0 +1,210 @@
+// Copyright (c) 2004,2006-2009   INRIA Sophia-Antipolis (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
+// 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(s)     : Sylvain Pion <Sylvain.Pion at sophia.inria.fr>
+//                 Nico Kruithof <Nico.Kruithof at sophia.inria.fr>
+//                 Manuel Caroli <Manuel.Caroli at sophia.inria.fr>
+
+
+#ifndef CGAL_INTERNAL_PERIODIC_3_TRIANGULATION_FILTERED_TRAITS_3_H
+#define CGAL_INTERNAL_PERIODIC_3_TRIANGULATION_FILTERED_TRAITS_3_H
+
+#include <string>
+#include <CGAL/basic.h>
+#include <CGAL/config.h>
+#include <CGAL/Interval_nt.h>
+#include <CGAL/Uncertain.h>
+#include <CGAL/Profile_counter.h>
+#include <CGAL/Filtered_predicate.h>
+#include <CGAL/internal/Has_boolean_tags.h>
+
+namespace CGAL {
+
+// This template class is a wrapper that implements the filtering for any
+// predicate (dynamic filters with IA).
+
+// TODO :
+// - each predicate in the default kernel should define a tag that says if it
+//   wants to be filtered or not (=> all homogeneous predicate define this
+//   tag).  We could even test-suite that automatically.  It makes a strong
+//   new requirement on the kernel though...
+//   Could be done with a traits mechanism ?
+//   A default template could use the current IA, but other tags or whatever
+//   could specify no filtering at all, or static filtering...
+// - same thing for constructions => virtual operator() ?
+// - similarly, constructions should have a tag saying if they can throw or
+//   not, or we let all this up to the compiler optimizer to figure out ?
+// - Some caching could be done at the Point_2 level.
+
+template <class EP, class AP, class C2E, class C2A, bool Protection = true>
+class Filtered_periodic_predicate
+  : public Filtered_predicate<EP, AP, C2E, C2A, Protection>
+{
+  typedef Filtered_predicate<EP, AP, C2E, C2A, Protection> Base;
+public:
+  Filtered_periodic_predicate() : Base() {}
+
+  // These constructors are used for constructive predicates.
+  // You should try to avoid constructive predicates, as they will construct
+  // the exact values systematically (in the ctor), rather than lazily.
+  template <class OE, class OA> 
+  Filtered_periodic_predicate(const OE * oe, const OA * oa) 
+    : Base( EP(oe), AP(oa) )
+  {}
+};
+}
+
+#include <CGAL/Periodic_3_triangulation_traits_3.h>
+
+namespace CGAL
+{
+// The Offset_converter is parametrized by a usual kernel converter,
+// and adds the conversions for Offsets.
+template < typename Converter >
+struct Offset_converter_3
+  : public Converter
+{
+  typedef typename Converter::Source_kernel Source_kernel;
+  typedef typename Converter::Target_kernel Target_kernel;
+
+  typedef typename Periodic_3_triangulation_traits_base_3<Source_kernel>
+                   ::Offset  Source_off;
+  typedef typename Periodic_3_triangulation_traits_base_3<Source_kernel>
+                   ::Point_3  Source_pt;
+
+  typedef typename Periodic_3_triangulation_traits_base_3<Target_kernel>
+                   ::Offset  Target_off;
+  typedef typename Periodic_3_triangulation_traits_base_3<Target_kernel>
+                   ::Point_3  Target_pt;
+
+
+  using Converter::operator();
+
+  Target_off
+  operator()(const Source_off &off) const
+  {
+    return off;
+  }
+};
+
+// The argument is supposed to be a Filtered_kernel like kernel.
+template < typename K, typename Off >
+class Periodic_3_triangulation_filtered_traits_base_3
+  : public Periodic_3_triangulation_traits_base_3<K, Off>
+{
+  typedef Periodic_3_triangulation_traits_base_3<K, Off> Base;
+
+  // Exact traits is based on the exact kernel.
+  typedef Periodic_3_triangulation_traits_3<typename K::Exact_kernel,
+                                            Off>
+                                                   Exact_traits;
+  // Filtering traits is based on the filtering kernel.
+  typedef Periodic_3_triangulation_traits_3<typename K::Approximate_kernel,
+                                            Off>
+                                                   Filtering_traits;
+private:
+  typedef typename K::C2E C2E;
+  typedef typename K::C2F C2F;
+
+  typedef typename C2E::Target_kernel::Iso_cuboid_3 Exact_iso_cuboid_3;
+  typedef typename C2F::Target_kernel::Iso_cuboid_3 Approximate_iso_cuboid_3;
+ 
+public:
+  typedef typename K::Iso_cuboid_3 Iso_cuboid_3;
+
+  void set_domain(const Iso_cuboid_3& domain) {
+    C2E c2e;
+    C2F c2f;
+    this->_domain = domain;
+    this->_domain_e = c2e(this->_domain);
+    this->_domain_f = c2f(this->_domain);
+  }
+
+  typedef Filtered_periodic_predicate<
+            typename Exact_traits::Compare_xyz_3,
+            typename Filtering_traits::Compare_xyz_3,
+            Offset_converter_3<C2E>,
+            Offset_converter_3<C2F> >  Compare_xyz_3;
+
+  typedef Filtered_periodic_predicate<
+            typename Exact_traits::Coplanar_orientation_3,
+            typename Filtering_traits::Coplanar_orientation_3,
+            Offset_converter_3<C2E>,
+            Offset_converter_3<C2F> >  Coplanar_orientation_3;
+
+  typedef Filtered_periodic_predicate<
+            typename Exact_traits::Orientation_3,
+            typename Filtering_traits::Orientation_3,
+            Offset_converter_3<C2E>,
+            Offset_converter_3<C2F> >  Orientation_3;
+
+  typedef Filtered_periodic_predicate<
+            typename Exact_traits::Coplanar_side_of_bounded_circle_3,
+            typename Filtering_traits::Coplanar_side_of_bounded_circle_3,
+            Offset_converter_3<C2E>,
+            Offset_converter_3<C2F> >  Coplanar_side_of_bounded_circle_3;
+
+  typedef Filtered_periodic_predicate<
+            typename Exact_traits::Compare_distance_3,
+            typename Filtering_traits::Compare_distance_3,
+            Offset_converter_3<C2E>,
+            Offset_converter_3<C2F> >  Compare_distance_3;
+
+  Compare_xyz_3 compare_xyz_3_object() const
+  { return Compare_xyz_3(&_domain_e,&_domain_f);}
+
+  Coplanar_orientation_3 coplanar_orientation_3_object() const
+  { return Coplanar_orientation_3(&_domain_e,&_domain_f); }
+
+  Orientation_3 orientation_3_object() const
+  { return Orientation_3(&_domain_e,&_domain_f);}
+
+  Coplanar_side_of_bounded_circle_3
+  coplanar_side_of_bounded_circle_3_object() const 
+  { return Coplanar_side_of_bounded_circle_3(&_domain_e,&_domain_f); }
+
+  // The following are inherited since they are constructions :
+  // Construct_segment_3
+  // Construct_triangle_3
+  // Construct_tetrahedron_3
+
+ protected:
+  Exact_iso_cuboid_3 _domain_e;
+  Approximate_iso_cuboid_3 _domain_f;
+};
+
+} //namespace CGAL
+
+#include <CGAL/internal/Periodic_3_triangulation_statically_filtered_traits_3.h>
+
+namespace CGAL {
+
+template < typename K, typename Off = typename CGAL::Periodic_3_offset_3, bool Has_static_filters = internal::Has_static_filters<K>::value >
+class Periodic_3_triangulation_filtered_traits_3
+  : public Periodic_3_triangulation_statically_filtered_traits_3<
+  Periodic_3_triangulation_filtered_traits_base_3<K, Off> > {
+};
+
+template < typename K, typename Off >
+class Periodic_3_triangulation_filtered_traits_3<K, Off, false>
+  : public Periodic_3_triangulation_filtered_traits_base_3<K, Off>
+{};
+
+} //namespace CGAL
+
+#endif // CGAL_INTERNAL_PERIODIC_3_TRIANGULATION_FILTERED_TRAITS_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Periodic_3_triangulation_remove_traits_3.h b/3rdparty/CGAL/include/CGAL/internal/Periodic_3_triangulation_remove_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Periodic_3_triangulation_remove_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/internal/Periodic_3_triangulation_remove_traits_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/Periodic_3_triangulation_statically_filtered_traits_3.h b/3rdparty/CGAL/include/CGAL/internal/Periodic_3_triangulation_statically_filtered_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/Periodic_3_triangulation_statically_filtered_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/internal/Periodic_3_triangulation_statically_filtered_traits_3.h
diff --git a/3rdparty/CGAL/include/CGAL/internal/Polyhedron_plane_clipping_3.h b/3rdparty/CGAL/include/CGAL/internal/Polyhedron_plane_clipping_3.h
new file mode 100644
index 0000000..56e7396
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/internal/Polyhedron_plane_clipping_3.h
@@ -0,0 +1,432 @@
+// Copyright (c) 2015 GeometryFactory (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Sebastien Loriot
+
+#ifndef CGAL_INTERNAL_POLYHEDRON_PLANE_CLIPPING_3_H
+#define CGAL_INTERNAL_POLYHEDRON_PLANE_CLIPPING_3_H
+
+#include <CGAL/corefinement_operations.h>
+#include <CGAL/iterator.h>
+#include <CGAL/Bbox_3.h>
+#include <CGAL/array.h>
+#include <CGAL/Delaunay_triangulation_2.h>
+#include <CGAL/Triangulation_2_projection_traits_3.h>
+#include <CGAL/convex_hull_3.h>
+#include <CGAL/Polygon_mesh_processing/connected_components.h>
+#include <CGAL/convex_hull_3.h>
+
+namespace CGAL{
+namespace corefinement{
+
+namespace internal{
+ template <class HDS,class T>
+ class Builder_from_T_2 : public CGAL::Modifier_base<HDS> {
+   typedef std::map<typename T::Vertex_handle,unsigned> Vertex_map;
+
+   const T& t;
+   template <class Builder>
+   static unsigned get_vertex_index( Vertex_map& vertex_map,
+                                     typename T::Vertex_handle vh,
+                                     Builder& builder,
+                                     unsigned& vindex)
+   {
+     std::pair<typename Vertex_map::iterator,bool>
+       res=vertex_map.insert(std::make_pair(vh,vindex));
+     if (res.second){
+       builder.add_vertex(vh->point());
+         ++vindex;
+     }
+     return res.first->second;
+   }
+
+   public:
+   Builder_from_T_2(const T& t_):t(t_)
+   {
+     CGAL_assertion(t.dimension()==2);
+   }
+   void operator()( HDS& hds) {
+     // Postcondition: `hds' is a valid polyhedral surface.
+     CGAL::Polyhedron_incremental_builder_3<HDS> B( hds, true);
+     Vertex_map vertex_map;
+     //start the surface
+     B.begin_surface( t.number_of_vertices(), t.number_of_faces());
+     unsigned vindex=0;
+     for (typename T::Finite_faces_iterator it=t.finite_faces_begin();
+                                            it!=t.finite_faces_end();++it)
+     {
+       unsigned i0=get_vertex_index(vertex_map,it->vertex(0),B,vindex);
+       unsigned i1=get_vertex_index(vertex_map,it->vertex(1),B,vindex);
+       unsigned i2=get_vertex_index(vertex_map,it->vertex(2),B,vindex);
+       B.begin_facet();
+       B.add_vertex_to_facet( i0 );
+       B.add_vertex_to_facet( i1 );
+       B.add_vertex_to_facet( i2 );
+       B.end_facet();
+     }
+     B.end_surface();
+   }
+ };
+} // end of namespace internal
+
+template <class Polyhedron, class Plane_3>
+Polyhedron clip_to_bbox(const Bbox_3& bbox, const Plane_3& plane)
+{
+  typedef typename Polyhedron::Traits::Kernel Kernel;
+  typedef typename Kernel::Point_3 Point_3;
+  typedef typename Kernel::Segment_3 Segment_3;
+  cpp11::array<typename Kernel::Point_3,8> corners= {{
+    Point_3(bbox.xmin(),bbox.ymin(),bbox.zmin()),
+    Point_3(bbox.xmin(),bbox.ymax(),bbox.zmin()),
+    Point_3(bbox.xmax(),bbox.ymax(),bbox.zmin()),
+    Point_3(bbox.xmax(),bbox.ymin(),bbox.zmin()),
+    Point_3(bbox.xmin(),bbox.ymin(),bbox.zmax()),
+    Point_3(bbox.xmin(),bbox.ymax(),bbox.zmax()),
+    Point_3(bbox.xmax(),bbox.ymax(),bbox.zmax()),
+    Point_3(bbox.xmax(),bbox.ymin(),bbox.zmax())
+  }};
+
+  cpp11::array<CGAL::Oriented_side,8> orientations = {{
+    plane.oriented_side(corners[0]),
+    plane.oriented_side(corners[1]),
+    plane.oriented_side(corners[2]),
+    plane.oriented_side(corners[3]),
+    plane.oriented_side(corners[4]),
+    plane.oriented_side(corners[5]),
+    plane.oriented_side(corners[6]),
+    plane.oriented_side(corners[7])
+  }};
+
+  std::vector<Point_3> intersection_points;
+  // first look for intersections at corners
+  for (int i=0; i<8; ++i)
+    if (orientations[i]==ON_ORIENTED_BOUNDARY)
+      intersection_points.push_back(corners[i]);
+  // second look for intersections on edges
+  cpp11::array<int,24> edge_indices = {{ // 2 *12 edges
+    0,1, 1,2, 2,3, 3,0, // bottom face edges
+    4,5, 5,6, 6,7, 7,4, // top face edges
+    0,4, 1,5, 2,6, 3,7
+  }};
+
+  for (int i=0; i<12; ++i)
+  {
+    int i1=edge_indices[2*i], i2=edge_indices[2*i+1];
+    if (orientations[i1]==ON_ORIENTED_BOUNDARY) continue;
+    if (orientations[i2]==ON_ORIENTED_BOUNDARY) continue;
+    if (orientations[i1]!=orientations[i2])
+      intersection_points.push_back(
+        get<Point_3>(
+          *CGAL::intersection(plane, Segment_3(corners[i1], corners[i2]) )
+        )
+      );
+  }
+
+  Polyhedron P;
+
+  //if less that 3 points there will be nothing to clipping.
+  if (intersection_points.size()<3) return P;
+
+  //triangulate the set of intersection points (I know it's overkill)
+  typedef CGAL::Triangulation_2_projection_traits_3<Kernel>   P_traits;
+  typedef CGAL::Delaunay_triangulation_2<P_traits> DT;
+  DT dt(P_traits(plane.orthogonal_vector()));
+  dt.insert(intersection_points.begin(),
+            intersection_points.end());
+
+  // tangency with the bbox -> no intersection
+  if (dt.dimension()!=2) return P;
+
+  //now create the polyhedron from the triangulation
+  internal::Builder_from_T_2< typename Polyhedron::HalfedgeDS,DT > builder(dt);
+  P.delegate(builder);
+
+  return P;
+}
+
+template <class Polyhedron, class Plane_3>
+Polyhedron clip_bbox(const Bbox_3& bbox, const Plane_3& plane)
+{
+  typedef typename Polyhedron::Traits::Kernel Kernel;
+  typedef typename Kernel::Point_3 Point_3;
+  typedef typename Kernel::Segment_3 Segment_3;
+  cpp11::array<typename Kernel::Point_3,8> corners= {{
+    Point_3(bbox.xmin(),bbox.ymin(),bbox.zmin()),
+    Point_3(bbox.xmin(),bbox.ymax(),bbox.zmin()),
+    Point_3(bbox.xmax(),bbox.ymax(),bbox.zmin()),
+    Point_3(bbox.xmax(),bbox.ymin(),bbox.zmin()),
+    Point_3(bbox.xmin(),bbox.ymin(),bbox.zmax()),
+    Point_3(bbox.xmin(),bbox.ymax(),bbox.zmax()),
+    Point_3(bbox.xmax(),bbox.ymax(),bbox.zmax()),
+    Point_3(bbox.xmax(),bbox.ymin(),bbox.zmax())
+  }};
+
+  cpp11::array<CGAL::Oriented_side,8> orientations = {{
+    plane.oriented_side(corners[0]),
+    plane.oriented_side(corners[1]),
+    plane.oriented_side(corners[2]),
+    plane.oriented_side(corners[3]),
+    plane.oriented_side(corners[4]),
+    plane.oriented_side(corners[5]),
+    plane.oriented_side(corners[6]),
+    plane.oriented_side(corners[7])
+  }};
+
+  std::vector<Point_3> points;
+  // first look for intersections at corners
+  for (int i=0; i<8; ++i)
+    if (orientations[i]==ON_ORIENTED_BOUNDARY)
+      points.push_back(corners[i]);
+  // second look for intersections on edges
+  cpp11::array<int,24> edge_indices = {{ // 2 *12 edges
+    0,1, 1,2, 2,3, 3,0, // bottom face edges
+    4,5, 5,6, 6,7, 7,4, // top face edges
+    0,4, 1,5, 2,6, 3,7
+  }};
+
+  for (int i=0; i<12; ++i)
+  {
+    int i1=edge_indices[2*i], i2=edge_indices[2*i+1];
+    if (orientations[i1]==ON_ORIENTED_BOUNDARY) continue;
+    if (orientations[i2]==ON_ORIENTED_BOUNDARY) continue;
+    if (orientations[i1]!=orientations[i2])
+      points.push_back(
+        get<Point_3>(
+          *CGAL::intersection(plane, Segment_3(corners[i1], corners[i2]) )
+        )
+      );
+  }
+
+  Polyhedron P;
+
+  //if less that 3 points there will be nothing to clipping.
+  if (points.size()<3) return P;
+
+  for (int i=0; i<8; ++i)
+    if (orientations[i]==ON_NEGATIVE_SIDE)
+      points.push_back(corners[i]);
+
+  // take the convex hull of the points on the negative side+intersection points
+  // overkill...
+  CGAL::convex_hull_3(points.begin(), points.end(), P);
+
+  return P;
+}
+
+template <class Polyhedron>
+Polyhedron* clip_polyhedron(Polyhedron& P, Polyhedron& clipping_polyhedron)
+{
+  std::pair <Polyhedron*,int> result;
+  typedef CGAL::Polyhedron_corefinement<Polyhedron> Corefinement;
+  Corefinement coref;
+  CGAL::Emptyset_iterator emptyset_iterator;
+  coref(P, clipping_polyhedron, emptyset_iterator,
+        &result, Corefinement::Intersection_tag);
+
+  return result.first;
+}
+
+template <class Polyhedron, class Plane_3>
+Polyhedron* clip_polyhedron(const Polyhedron& P, const Plane_3& p)
+{
+  if(P.empty()) return new Polyhedron();
+  CGAL::Bbox_3 bbox( CGAL::bbox_3(P.points_begin(), P.points_end()) );
+  //extend the bbox a bit to avoid border cases
+  double xd=(bbox.xmax()-bbox.xmin())/100;
+  double yd=(bbox.ymax()-bbox.ymin())/100;
+  double zd=(bbox.zmax()-bbox.zmin())/100;
+  bbox=CGAL::Bbox_3(bbox.xmin()-xd, bbox.ymin()-yd, bbox.zmin()-zd,
+                    bbox.xmax()+xd, bbox.ymax()+yd, bbox.zmax()+zd);
+  Polyhedron clipping_polyhedron=clip_bbox<Polyhedron>(bbox, p);
+
+  if (clipping_polyhedron.empty()) //no intersection, result is all or nothing
+  {
+    if (p.oriented_side(*P.points_begin())==ON_POSITIVE_SIDE)
+      return new Polyhedron();
+    else
+      return new Polyhedron(P);
+  }
+  Polyhedron copy(P);
+  return clip_polyhedron(copy, clipping_polyhedron);
+}
+
+template <class Polyhedron, class Plane_3>
+std::pair<Polyhedron*,Polyhedron*> split_polyhedron(const Polyhedron& P, const Plane_3& p)
+{
+ std::pair<Polyhedron*, Polyhedron*> res;
+  if(P.empty()) {res.first=res.second= new Polyhedron(); return res;}
+  CGAL::Bbox_3 bbox( CGAL::bbox_3(P.points_begin(), P.points_end()) );
+  //extend the bbox a bit to avoid border cases
+  double xd=(bbox.xmax()-bbox.xmin())/100;
+  double yd=(bbox.ymax()-bbox.ymin())/100;
+  double zd=(bbox.zmax()-bbox.zmin())/100;
+  bbox=CGAL::Bbox_3(bbox.xmin()-xd, bbox.ymin()-yd, bbox.zmin()-zd,
+                    bbox.xmax()+xd, bbox.ymax()+yd, bbox.zmax()+zd);
+  //First Polyhedron
+  Polyhedron clipping_polyhedron=clip_bbox<Polyhedron>(bbox, p);
+
+
+  if (clipping_polyhedron.empty()) //no intersection, result is all or nothing
+  {
+    if (p.oriented_side(*P.points_begin())==ON_POSITIVE_SIDE)
+    {
+      res.first = new Polyhedron(); res.second = new Polyhedron(P);
+    }
+    else
+    {
+      res.first = new Polyhedron(P); res.second = new Polyhedron();
+    }
+    return res;
+  }
+
+  Polyhedron copy(P);
+  res.first = clip_polyhedron(copy, clipping_polyhedron);
+  //Second Polyhedron
+  Plane_3 p_op = p.opposite();
+  clipping_polyhedron=clip_bbox<Polyhedron>(bbox, p_op);
+
+  copy = P;
+  res.second = clip_polyhedron(copy, clipping_polyhedron);
+  return res;
+
+}
+
+namespace internal{
+
+template<class Polyhedron>
+struct Edge_is_marked4coref{
+  std::set<typename Polyhedron::Halfedge_handle>& marked_halfedges;
+  typedef bool value_type;
+  typedef value_type reference;
+  typedef std::pair<typename Polyhedron::Halfedge_handle,Polyhedron*> key_type;
+  typedef boost::read_write_property_map_tag category;
+
+  Edge_is_marked4coref(std::set<typename Polyhedron::Halfedge_handle>& mh)
+  : marked_halfedges(mh)
+  {}
+
+  friend reference get(Edge_is_marked4coref& map,const key_type& key) {
+    return map.marked_halfedges.count(key.first)!=0;
+  }
+  friend void put(Edge_is_marked4coref& map,key_type key,value_type v) {
+    if (v) map.marked_halfedges.insert(key.first);
+    else  map.marked_halfedges.erase(key.first);
+  }
+};
+
+template<class Polyhedron>
+struct Edge_is_marked{
+  const std::set<typename Polyhedron::Halfedge_handle>* marked_halfedges;
+  typedef bool value_type;
+  typedef value_type reference;
+  typedef typename boost::graph_traits<Polyhedron>::edge_descriptor key_type;
+  typedef boost::readable_property_map_tag category;
+
+  Edge_is_marked(){}
+  Edge_is_marked(const std::set<typename Polyhedron::Halfedge_handle>& mh)
+  : marked_halfedges(&mh)
+  {}
+
+  friend reference get(const Edge_is_marked& map,const key_type& key) {
+    return map.marked_halfedges->count(key.halfedge())!=0;
+  }
+};
+
+} //end of internal namespace
+
+template <class Polyhedron, class Plane_3>
+void inplace_clip_open_polyhedron(Polyhedron& P, const Plane_3& p)
+{
+  CGAL::Bbox_3 bbox( CGAL::bbox_3(P.points_begin(), P.points_end()) );
+  //extend the bbox a bit to avoid border cases
+  double xd=(bbox.xmax()-bbox.xmin())/100;
+  double yd=(bbox.ymax()-bbox.ymin())/100;
+  double zd=(bbox.zmax()-bbox.zmin())/100;
+  bbox=CGAL::Bbox_3(bbox.xmin()-xd, bbox.ymin()-yd, bbox.zmin()-zd,
+                    bbox.xmax()+xd, bbox.ymax()+yd, bbox.zmax()+zd);
+  Polyhedron clipping_polyhedron=clip_to_bbox<Polyhedron>(bbox, p);
+
+  if (clipping_polyhedron.empty()) //no intersection, result is all or nothing
+  {
+    if (p.oriented_side(*P.points_begin())==ON_POSITIVE_SIDE)
+      P.clear();
+    return;
+  }
+
+  // set for marking edges of P intersected by the clipping plane
+  std::set<typename Polyhedron::Halfedge_handle> marked_halfedges;
+  internal::Edge_is_marked4coref<Polyhedron> cr_edge_is_marked(marked_halfedges);
+  typedef typename Polyhedron::Traits::Kernel K;
+  typedef CGAL::Node_visitor_refine_polyhedra<
+            Polyhedron,K,internal::Edge_is_marked4coref<Polyhedron> >
+                  Split_visitor;
+    Split_visitor visitor(NULL, true, cr_edge_is_marked);
+    CGAL::Intersection_of_Polyhedra_3<Polyhedron,K,Split_visitor>
+      polyline_intersections(visitor);
+    CGAL::Emptyset_iterator emptyset_iterator;
+    // corefinement P and clipping_polyhedron
+    polyline_intersections(P,clipping_polyhedron,emptyset_iterator);
+
+    // extract connected components bounded by marked edges
+    internal::Edge_is_marked<Polyhedron> edge_is_marked(marked_halfedges);
+    namespace PMP=Polygon_mesh_processing;
+    std::map<typename Polyhedron::Face_handle, std::size_t> face_ccs;
+    std::size_t nb_cc=PMP::connected_components(P,
+      boost::make_assoc_property_map(face_ccs),
+      PMP::parameters::edge_is_constrained_map(edge_is_marked)
+        .face_index_map(get(boost::face_external_index,P))
+    );
+
+    // remove cc on the positive side of the plane
+    std::vector<bool> cc_handled(nb_cc, false);
+    std::vector<std::size_t> ccs_to_remove;
+    BOOST_FOREACH(typename Polyhedron::Face_handle f, faces(P))
+    {
+      std::size_t cc_id=face_ccs[f];
+      if (cc_handled[cc_id]) continue;
+
+      //look for a vertex not on the intersection
+      typename Polyhedron::Halfedge_handle h=f->halfedge();
+      for(int i=0;i<3;++i){
+        bool no_marked_edge=true;
+        BOOST_FOREACH(typename Polyhedron::Halfedge_handle h, halfedges_around_target(h, P))
+          if ( marked_halfedges.count(h) )
+            no_marked_edge=false;
+        if (no_marked_edge){
+          if ( p.oriented_side(h->vertex()->point())==ON_POSITIVE_SIDE )
+            ccs_to_remove.push_back(cc_id);
+          cc_handled[cc_id]=true;
+          if (--nb_cc==0) break;
+          break;
+        }
+        h=h->next();
+      }
+    }
+
+  //now remove the faces on the positive side
+  PMP::remove_connected_components(P,
+    ccs_to_remove,
+    boost::make_assoc_property_map(face_ccs),
+    PMP::parameters::vertex_index_map(get(boost::vertex_external_index,P))
+  );
+}
+
+} } // CGAL::corefinement
+
+
+#endif // CGAL_INTERNAL_POLYHEDRON_PLANE_CLIPPING_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Projection_traits_3.h b/3rdparty/CGAL/include/CGAL/internal/Projection_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Projection_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/internal/Projection_traits_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Regular_triangulation_filtered_traits_3.h b/3rdparty/CGAL/include/CGAL/internal/Regular_triangulation_filtered_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Regular_triangulation_filtered_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/internal/Regular_triangulation_filtered_traits_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Rich_grid.h b/3rdparty/CGAL/include/CGAL/internal/Rich_grid.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Rich_grid.h
rename to 3rdparty/CGAL/include/CGAL/internal/Rich_grid.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Angle_3.h b/3rdparty/CGAL/include/CGAL/internal/Static_filters/Angle_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Angle_3.h
rename to 3rdparty/CGAL/include/CGAL/internal/Static_filters/Angle_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Compare_squared_radius_3.h b/3rdparty/CGAL/include/CGAL/internal/Static_filters/Compare_squared_radius_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Compare_squared_radius_3.h
rename to 3rdparty/CGAL/include/CGAL/internal/Static_filters/Compare_squared_radius_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Compare_weighted_squared_radius_3.h b/3rdparty/CGAL/include/CGAL/internal/Static_filters/Compare_weighted_squared_radius_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Compare_weighted_squared_radius_3.h
rename to 3rdparty/CGAL/include/CGAL/internal/Static_filters/Compare_weighted_squared_radius_3.h
diff --git a/3rdparty/CGAL/include/CGAL/internal/Static_filters/Compare_x_2.h b/3rdparty/CGAL/include/CGAL/internal/Static_filters/Compare_x_2.h
new file mode 100644
index 0000000..9250c95
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/internal/Static_filters/Compare_x_2.h
@@ -0,0 +1,103 @@
+// Copyright (c) 2011 GeometryFactory Sarl (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(s)     : Andreas Fabri
+
+
+#ifndef CGAL_INTERNAL_STATIC_FILTERS_COMPARE_X_2_H
+#define CGAL_INTERNAL_STATIC_FILTERS_COMPARE_X_2_H
+
+#include <CGAL/Bbox_2.h>
+#include <CGAL/Profile_counter.h>
+#include <CGAL/internal/Static_filters/tools.h>
+#include <cmath>
+#include <iostream>
+
+namespace CGAL {
+
+namespace internal {
+
+namespace Static_filters_predicates {
+
+
+template < typename K_base >
+class Compare_x_2
+  : public K_base::Compare_x_2
+{
+  typedef typename K_base::Point_2   Point_2;
+  typedef typename K_base::Line_2    Line_2;
+  typedef typename K_base::Compare_x_2   Base;
+
+public:
+
+  typedef typename Base::result_type  result_type;
+
+
+#ifndef CGAL_CFG_MATCHING_BUG_6
+  using Base::operator();
+#else // CGAL_CFG_MATCHING_BUG_6
+  template <typename T>
+  result_type
+  operator()(const T& t1, const T& t2, const T& t3) const
+  {
+    return Base()(t1,t2,t3);
+  }
+
+  template <typename T>
+  result_type
+  operator()(const T& t1, const T& t2, const T& t3, const T& t4) const
+  {
+    return Base()(t1,t2,t3, t4);
+  } 
+  
+  result_type
+  operator()(const Point_2& p, const Line_2& l1, const Line_2& l2) const
+  {
+    return Base()(p,l1,l2);
+  } 
+#endif // CGAL_CFG_MATCHING_BUG_6
+
+
+  result_type operator()(const Point_2 &p, const Point_2& q) const
+  {
+    CGAL_BRANCH_PROFILER(std::string("semi-static attempts/calls to   : ") +
+                         std::string(CGAL_PRETTY_FUNCTION), tmp);
+
+    Get_approx<Point_2> get_approx; // Identity functor for all points
+                                    // but lazy points
+    double px, qx;
+
+    if (fit_in_double(get_approx(p).x(), px) && fit_in_double(get_approx(q).x(), qx) )
+    {
+      CGAL_BRANCH_PROFILER_BRANCH(tmp);
+      return compare(px, qx);
+    }
+    return Base::operator()(p, q);
+  }
+
+
+
+}; // end class Compare_x_2
+
+} // end namespace Static_filters_predicates
+
+} // end namespace internal
+
+} // end namespace CGAL
+
+#endif  // CGAL_INTERNAL_STATIC_FILTERS_COMPARE_X_2_H
diff --git a/3rdparty/CGAL/include/CGAL/internal/Static_filters/Compare_y_2.h b/3rdparty/CGAL/include/CGAL/internal/Static_filters/Compare_y_2.h
new file mode 100644
index 0000000..f755d8f
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/internal/Static_filters/Compare_y_2.h
@@ -0,0 +1,103 @@
+// Copyright (c) 2011 GeometryFactory Sarl (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(s)     : Andreas Fabri
+
+
+#ifndef CGAL_INTERNAL_STATIC_FILTERS_COMPARE_Y_2_H
+#define CGAL_INTERNAL_STATIC_FILTERS_COMPARE_Y_2_H
+
+#include <CGAL/Bbox_2.h>
+#include <CGAL/Profile_counter.h>
+#include <CGAL/internal/Static_filters/tools.h>
+#include <cmath>
+#include <iostream>
+
+namespace CGAL {
+
+namespace internal {
+
+namespace Static_filters_predicates {
+
+
+template < typename K_base >
+class Compare_y_2
+  : public K_base::Compare_y_2
+{
+  typedef typename K_base::Point_2   Point_2;
+  typedef typename K_base::Line_2    Line_2;
+  typedef typename K_base::Compare_y_2   Base;
+
+public:
+
+  typedef typename Base::result_type  result_type;
+
+
+#ifndef CGAL_CFG_MATCHING_BUG_6
+  using Base::operator();
+#else // CGAL_CFG_MATCHING_BUG_6
+  template <typename T>
+  result_type
+  operator()(const T& t1, const T& t2, const T& t3) const
+  {
+    return Base()(t1,t2,t3);
+  }
+
+  template <typename T>
+  result_type
+  operator()(const T& t1, const T& t2, const T& t3, const T& t4) const
+  {
+    return Base()(t1,t2,t3, t4);
+  } 
+  
+  result_type
+  operator()(const Point_2& p, const Line_2& l1, const Line_2& l2) const
+  {
+    return Base()(p,l1,l2);
+  } 
+#endif // CGAL_CFG_MATCHING_BUG_6
+
+
+  result_type operator()(const Point_2 &p, const Point_2& q) const
+  {
+    CGAL_BRANCH_PROFILER(std::string("semi-static attempts/calls to   : ") +
+                         std::string(CGAL_PRETTY_FUNCTION), tmp);
+
+    Get_approx<Point_2> get_approx; // Identity functor for all points
+                                    // but lazy points
+    double py, qy;
+
+    if (fit_in_double(get_approx(p).y(), py) && fit_in_double(get_approx(q).y(), qy) )
+    {
+      CGAL_BRANCH_PROFILER_BRANCH(tmp);
+      return compare(py, qy);
+    }
+    return Base::operator()(p, q);
+  }
+
+
+
+}; // end class Compare_y_2
+
+} // end namespace Static_filters_predicates
+
+} // end namespace internal
+
+} // end namespace CGAL
+
+#endif  // CGAL_INTERNAL_STATIC_FILTERS_COMPARE_Y_2_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Compare_y_at_x_2.h b/3rdparty/CGAL/include/CGAL/internal/Static_filters/Compare_y_at_x_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Compare_y_at_x_2.h
rename to 3rdparty/CGAL/include/CGAL/internal/Static_filters/Compare_y_at_x_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Coplanar_orientation_3.h b/3rdparty/CGAL/include/CGAL/internal/Static_filters/Coplanar_orientation_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Coplanar_orientation_3.h
rename to 3rdparty/CGAL/include/CGAL/internal/Static_filters/Coplanar_orientation_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Coplanar_side_of_bounded_circle_3.h b/3rdparty/CGAL/include/CGAL/internal/Static_filters/Coplanar_side_of_bounded_circle_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Coplanar_side_of_bounded_circle_3.h
rename to 3rdparty/CGAL/include/CGAL/internal/Static_filters/Coplanar_side_of_bounded_circle_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Do_intersect_3.h b/3rdparty/CGAL/include/CGAL/internal/Static_filters/Do_intersect_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Do_intersect_3.h
rename to 3rdparty/CGAL/include/CGAL/internal/Static_filters/Do_intersect_3.h
diff --git a/3rdparty/CGAL/include/CGAL/internal/Static_filters/Equal_2.h b/3rdparty/CGAL/include/CGAL/internal/Static_filters/Equal_2.h
new file mode 100644
index 0000000..a72c54a
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/internal/Static_filters/Equal_2.h
@@ -0,0 +1,108 @@
+// Copyright (c) 2011 GeometryFactory Sarl (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(s)     : Andreas Fabri
+
+
+#ifndef CGAL_INTERNAL_STATIC_FILTERS_EQUAL_2_H
+#define CGAL_INTERNAL_STATIC_FILTERS_EQUAL_2_H
+
+#include <CGAL/Bbox_2.h>
+#include <CGAL/Profile_counter.h>
+#include <CGAL/internal/Static_filters/tools.h>
+#include <cmath>
+#include <iostream>
+
+namespace CGAL {
+
+namespace internal {
+
+namespace Static_filters_predicates {
+
+
+template < typename K_base >
+class Equal_2
+  : public K_base::Equal_2
+{
+  typedef typename K_base::Point_2   Point_2;
+  typedef typename K_base::Vector_2  Vector_2;
+  typedef typename K_base::Equal_2   Base;
+
+public:
+
+  typedef typename Base::result_type  result_type;
+
+
+#ifndef CGAL_CFG_MATCHING_BUG_6
+  using Base::operator();
+#else // CGAL_CFG_MATCHING_BUG_6
+  template <typename T>
+  result_type
+  operator()(const T& t1, const T& t2) const
+  {
+    return Base()(t1,t2);
+  }
+#endif // CGAL_CFG_MATCHING_BUG_6
+
+
+  result_type operator()(const Point_2 &p, const Point_2& q) const
+  {
+    CGAL_BRANCH_PROFILER(std::string("semi-static attempts/calls to   : ") +
+                         std::string(CGAL_PRETTY_FUNCTION), tmp);
+
+    Get_approx<Point_2> get_approx; // Identity functor for all points
+                                    // but lazy points
+    double px, py, qx, qy;
+
+    if (fit_in_double(get_approx(p).x(), px) && fit_in_double(get_approx(p).y(), py) &&
+        fit_in_double(get_approx(q).x(), qx) && fit_in_double(get_approx(q).y(), qy) )
+    {
+      CGAL_BRANCH_PROFILER_BRANCH(tmp);
+      return px == qx && py == qy;
+    }
+    return Base::operator()(p, q);
+  }
+
+
+  result_type operator()(const Vector_2 &p, const Vector_2& q) const
+  {
+    CGAL_BRANCH_PROFILER(std::string("semi-static attempts/calls to   : ") +
+                         std::string(CGAL_PRETTY_FUNCTION), tmp);
+
+    Get_approx<Vector_2> get_approx; // Identity functor for all points
+                                     // but lazy points
+    double px, py, qx, qy;
+
+    if (fit_in_double(get_approx(p).x(), px) && fit_in_double(get_approx(p).y(), py) &&
+        fit_in_double(get_approx(q).x(), qx) && fit_in_double(get_approx(q).y(), qy) )
+    {
+      CGAL_BRANCH_PROFILER_BRANCH(tmp);
+      return px == qx && py == qy;
+    }
+    return Base::operator()(p, q);
+  }
+
+}; // end class Equal_2
+
+} // end namespace Static_filters_predicates
+
+} // end namespace internal
+
+} // end namespace CGAL
+
+#endif  // CGAL_INTERNAL_STATIC_FILTERS_EQUAL_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Equal_3.h b/3rdparty/CGAL/include/CGAL/internal/Static_filters/Equal_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Equal_3.h
rename to 3rdparty/CGAL/include/CGAL/internal/Static_filters/Equal_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Is_degenerate_3.h b/3rdparty/CGAL/include/CGAL/internal/Static_filters/Is_degenerate_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Is_degenerate_3.h
rename to 3rdparty/CGAL/include/CGAL/internal/Static_filters/Is_degenerate_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Orientation_2.h b/3rdparty/CGAL/include/CGAL/internal/Static_filters/Orientation_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Orientation_2.h
rename to 3rdparty/CGAL/include/CGAL/internal/Static_filters/Orientation_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Orientation_3.h b/3rdparty/CGAL/include/CGAL/internal/Static_filters/Orientation_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Orientation_3.h
rename to 3rdparty/CGAL/include/CGAL/internal/Static_filters/Orientation_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Periodic_2_orientation_2.h b/3rdparty/CGAL/include/CGAL/internal/Static_filters/Periodic_2_orientation_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Periodic_2_orientation_2.h
rename to 3rdparty/CGAL/include/CGAL/internal/Static_filters/Periodic_2_orientation_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Periodic_2_side_of_oriented_circle_2.h b/3rdparty/CGAL/include/CGAL/internal/Static_filters/Periodic_2_side_of_oriented_circle_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Periodic_2_side_of_oriented_circle_2.h
rename to 3rdparty/CGAL/include/CGAL/internal/Static_filters/Periodic_2_side_of_oriented_circle_2.h
diff --git a/3rdparty/CGAL/include/CGAL/internal/Static_filters/Periodic_3_orientation_3.h b/3rdparty/CGAL/include/CGAL/internal/Static_filters/Periodic_3_orientation_3.h
new file mode 100644
index 0000000..b9d1815
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/internal/Static_filters/Periodic_3_orientation_3.h
@@ -0,0 +1,273 @@
+// Copyright (c) 2001,2004,2008-2009   INRIA Sophia-Antipolis (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
+// 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(s)     : Sylvain Pion <Sylvain.Pion at sophia.inria.fr>
+//                 Manuel Caroli <Manuel.Caroli at sophia.inria.fr>
+
+#ifndef CGAL_INTERNAL_STATIC_FILTERS_PERIODIC_3_ORIENTATION_3_H
+#define CGAL_INTERNAL_STATIC_FILTERS_PERIODIC_3_ORIENTATION_3_H
+
+#include <CGAL/Profile_counter.h>
+#include <CGAL/internal/Static_filters/Static_filter_error.h>
+#include <CGAL/internal/Static_filters/tools.h>
+
+#include <CGAL/Periodic_3_offset_3.h>
+
+#include <cmath>
+
+namespace CGAL { namespace internal { namespace Static_filters_predicates {
+
+template < typename K_base >
+class Periodic_3_orientation_3
+  : public K_base::Orientation_3
+{
+  typedef typename K_base::Orientation_3    Base;
+  typedef typename K_base::FT               FT;
+  typedef typename K_base::Point_3          Point_3;
+  typedef typename K_base::Vector_3         Vector_3;
+  typedef typename K_base::Iso_cuboid_3     Iso_cuboid_3;
+  typedef typename K_base::Sphere_3         Sphere_3;
+  typedef CGAL::Periodic_3_offset_3         Offset;
+
+public:
+  const Iso_cuboid_3 * const _dom;
+
+public:
+ typedef typename Base::result_type  result_type;
+
+ template <class EX, class AP>
+ Periodic_3_orientation_3(const Iso_cuboid_3 * const dom,
+     const EX * dom_e, const AP * dom_f) : Base(dom_e,dom_f), _dom(dom) {
+ }
+
+#ifndef CGAL_CFG_MATCHING_BUG_6
+  using Base::operator();
+#else 
+  result_type
+  operator()(const Vector_3& u, const Vector_3& v, const Vector_3& w) const
+  { 
+    return Base::operator()(u,v,w);
+  }  
+
+  result_type
+  operator()(const Sphere_3& s) const
+  { 
+    return Base::operator()(s);
+  }
+#endif
+
+  result_type 
+  operator()(const Point_3 &p, const Point_3 &q,
+	     const Point_3 &r, const Point_3 &s) const
+  {
+      CGAL_PROFILER("Periodic_3_orientation_3 calls");
+      Get_approx<Point_3> get_approx; // Identity functor for all points
+                                      // but lazy points.
+      double px, py, pz, qx, qy, qz, rx, ry, rz, sx, sy, sz;
+      init_double(px, py, pz, qx, qy, qz, rx, ry, rz, sx, sy, sz, (FT*)(0));
+
+      if (fit_in_double(get_approx(p).x(), px) && fit_in_double(get_approx(p).y(), py) &&
+          fit_in_double(get_approx(p).z(), pz) &&
+          fit_in_double(get_approx(q).x(), qx) && fit_in_double(get_approx(q).y(), qy) &&
+          fit_in_double(get_approx(q).z(), qz) &&
+          fit_in_double(get_approx(r).x(), rx) && fit_in_double(get_approx(r).y(), ry) &&
+          fit_in_double(get_approx(r).z(), rz) &&
+          fit_in_double(get_approx(s).x(), sx) && fit_in_double(get_approx(s).y(), sy) &&
+          fit_in_double(get_approx(s).z(), sz))
+      {
+          CGAL_PROFILER("Periodic_3_orientation_3 semi-static attempts");
+
+          double pqx = qx - px;
+          double pqy = qy - py;
+          double pqz = qz - pz;
+          double prx = rx - px;
+          double pry = ry - py;
+          double prz = rz - pz;
+          double psx = sx - px;
+          double psy = sy - py;
+          double psz = sz - pz;
+
+          // Then semi-static filter.
+          double maxx = CGAL::abs(pqx);
+          double maxy = CGAL::abs(pqy);
+          double maxz = CGAL::abs(pqz);
+
+          double aprx = CGAL::abs(prx);
+          double apsx = CGAL::abs(psx);
+
+          double apry = CGAL::abs(pry);
+          double apsy = CGAL::abs(psy);
+
+          double aprz = CGAL::abs(prz);
+          double apsz = CGAL::abs(psz);
+
+          if (maxx < aprx) maxx = aprx;
+          if (maxx < apsx) maxx = apsx;
+          if (maxy < apry) maxy = apry;
+          if (maxy < apsy) maxy = apsy;
+          if (maxz < aprz) maxz = aprz;
+          if (maxz < apsz) maxz = apsz;
+          double eps = 5.1107127829973299e-15 * maxx * maxy * maxz;
+          double det = CGAL::determinant(pqx, pqy, pqz,
+                                         prx, pry, prz,
+                                         psx, psy, psz);
+
+          // Sort maxx < maxy < maxz.
+          if (maxx > maxz)
+              std::swap(maxx, maxz);
+          if (maxy > maxz)
+              std::swap(maxy, maxz);
+          else if (maxy < maxx)
+              std::swap(maxx, maxy);
+
+          // Protect against underflow in the computation of eps.
+          if (maxx < 1e-97) /* cbrt(min_double/eps) */ {
+            if (maxx == 0)
+              return ZERO;
+          }
+          // Protect against overflow in the computation of det.
+          else if (maxz < 1e102) /* cbrt(max_double [hadamard]/4) */ {
+            if (det > eps)  return POSITIVE;
+            if (det < -eps) return NEGATIVE;
+          }
+
+          CGAL_PROFILER("Periodic_3_orientation_3 semi-static failures");
+      }
+
+      return Base::operator()(p, q, r, s);
+  }
+
+  result_type
+  operator()(const Point_3 &p, const Point_3 &q,
+      const Point_3 &r, const Point_3 &s,
+      const Offset &o_p, const Offset &o_q,
+      const Offset &o_r, const Offset &o_s) const {
+
+      CGAL_PROFILER("Periodic_3_orientation_3 calls");
+      Get_approx<Point_3> get_approx; // Identity functor for all points
+                                      // but lazy points.
+      double px, py, pz, qx, qy, qz, rx, ry, rz, sx, sy, sz;
+      double domxmax, domxmin, domymax, domymin, domzmax, domzmin;
+      init_double(px, py, pz, qx, qy, qz, rx, ry, rz, sx, sy, sz, (FT*)(0));
+      init_double(domxmax, domxmin, domymax, domymin, domzmax, domzmin, (FT*)(0));
+      int opx = o_p.x();
+      int opy = o_p.y();
+      int opz = o_p.z();
+
+      if (fit_in_double(get_approx(p).x(), px) && fit_in_double(get_approx(p).y(), py) &&
+          fit_in_double(get_approx(p).z(), pz) &&
+          fit_in_double(get_approx(q).x(), qx) && fit_in_double(get_approx(q).y(), qy) &&
+          fit_in_double(get_approx(q).z(), qz) &&
+          fit_in_double(get_approx(r).x(), rx) && fit_in_double(get_approx(r).y(), ry) &&
+          fit_in_double(get_approx(r).z(), rz) &&
+          fit_in_double(get_approx(s).x(), sx) && fit_in_double(get_approx(s).y(), sy) &&
+          fit_in_double(get_approx(s).z(), sz) &&
+	  fit_in_double(_dom->xmax(), domxmax) &&
+	  fit_in_double(_dom->xmin(), domxmin) &&
+	  fit_in_double(_dom->ymax(), domymax) &&
+	  fit_in_double(_dom->ymin(), domymin) &&
+	  fit_in_double(_dom->zmax(), domzmax) &&
+	  fit_in_double(_dom->zmin(), domzmin))
+      {
+          CGAL_PROFILER("Periodic_3_orientation_3 semi-static attempts");
+
+	  double domx = domxmax - domxmin;
+	  double domy = domymax - domymin;
+	  double domz = domzmax - domzmin;
+
+          double pqx = qx - px + domx * ( o_q.x() - opx );
+          double pqy = qy - py + domy * ( o_q.y() - opy );
+          double pqz = qz - pz + domz * ( o_q.z() - opz );
+          double prx = rx - px + domx * ( o_r.x() - opx );
+          double pry = ry - py + domy * ( o_r.y() - opy );
+          double prz = rz - pz + domz * ( o_r.z() - opz );
+          double psx = sx - px + domx * ( o_s.x() - opx );
+          double psy = sy - py + domy * ( o_s.y() - opy );
+          double psz = sz - pz + domz * ( o_s.z() - opz );
+
+          // Then semi-static filter.
+          double maxx = CGAL::abs(pqx);
+          double maxy = CGAL::abs(pqy);
+          double maxz = CGAL::abs(pqz);
+
+          double aprx = CGAL::abs(prx);
+          double apry = CGAL::abs(pry);
+          double aprz = CGAL::abs(prz);
+
+          double apsx = CGAL::abs(psx);
+          double apsy = CGAL::abs(psy);
+          double apsz = CGAL::abs(psz);
+
+          if (maxx < aprx) maxx = aprx;
+          if (maxx < apsx) maxx = apsx;
+
+          if (maxy < apry) maxy = apry;
+          if (maxy < apsy) maxy = apsy;
+
+          if (maxz < aprz) maxz = aprz;
+          if (maxz < apsz) maxz = apsz;
+          double eps = 4.111024169857068197e-15 * maxx * maxy * maxz;
+          double det = CGAL::determinant(pqx, pqy, pqz,
+                                         prx, pry, prz,
+                                         psx, psy, psz);
+
+          // Sort maxx < maxy < maxz.
+          if (maxx > maxz)
+              std::swap(maxx, maxz);
+          if (maxy > maxz)
+              std::swap(maxy, maxz);
+          else if (maxy < maxx)
+              std::swap(maxx, maxy);
+
+          // Protect against underflow in the computation of eps.
+          if (maxx < 1e-97) /* cbrt(min_double/eps) */ {
+            if (maxx == 0)
+              return ZERO;
+          }
+          // Protect against overflow in the computation of det.
+          else if (maxz < 1e102) /* cbrt(max_double [hadamard]/4) */ {
+            if (det > eps)  return POSITIVE;
+            if (det < -eps) return NEGATIVE;
+          }
+
+          CGAL_PROFILER("Periodic_3_orientation_3 semi-static failures");
+      }
+
+      return Base::operator()(p,q,r,s,o_p,o_q,o_r,o_s);
+  }
+
+  // Computes the epsilon for Periodic_3_orientation_3.
+  static double compute_epsilon()
+  {
+    typedef Static_filter_error F;
+    F t1 = F(1, F::ulp()/4);         // First translation
+    F det = CGAL::determinant(t1, t1, t1,
+                              t1, t1, t1,
+                              t1, t1, t1); // Full det
+    double err = det.error();
+    err += err * 2 * F::ulp(); // Correction due to "eps * maxx * maxy...".
+    std::cerr << "*** epsilon for Periodic_3_orientation_3 = " << err 
+	      << std::endl;
+    return err;
+  }
+
+};
+
+} } } // namespace CGAL::internal::Static_filters_predicates
+
+#endif // CGAL_INTERNAL_STATIC_FILTERS_PERIODIC_3_ORIENTATION_3_H
diff --git a/3rdparty/CGAL/include/CGAL/internal/Static_filters/Periodic_3_side_of_oriented_sphere_3.h b/3rdparty/CGAL/include/CGAL/internal/Static_filters/Periodic_3_side_of_oriented_sphere_3.h
new file mode 100644
index 0000000..9ae3eb9
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/internal/Static_filters/Periodic_3_side_of_oriented_sphere_3.h
@@ -0,0 +1,306 @@
+// Copyright (c) 2001,2004,2008-2009   INRIA Sophia-Antipolis (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
+// 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(s)     : Sylvain Pion <Sylvain.Pion at sophia.inria.fr>
+//                 Manuel Caroli <Manuel.Caroli at sophia.inria.fr>
+
+#ifndef CGAL_INTERNAL_STATIC_FILTERS_PERIODIC_3_SIDE_OF_ORIENTED_SPHERE_3_H
+#define CGAL_INTERNAL_STATIC_FILTERS_PERIODIC_3_SIDE_OF_ORIENTED_SPHERE_3_H
+
+#include <CGAL/Profile_counter.h>
+#include <CGAL/internal/Static_filters/Static_filter_error.h>
+#include <CGAL/internal/Static_filters/tools.h>
+
+#include <CGAL/Periodic_3_offset_3.h>
+
+namespace CGAL { namespace internal { namespace Static_filters_predicates {
+
+template < typename K_base >
+class Periodic_3_side_of_oriented_sphere_3
+  : public K_base::Side_of_oriented_sphere_3
+{
+  typedef typename K_base::Side_of_oriented_sphere_3    Base;
+  typedef typename K_base::FT                           FT;
+  typedef typename K_base::Point_3                      Point_3;
+  typedef typename K_base::Iso_cuboid_3                 Iso_cuboid_3;
+  typedef CGAL::Periodic_3_offset_3                     Offset;
+
+public:
+  const Iso_cuboid_3 * _dom;
+
+public:
+  typedef typename Base::result_type  result_type;
+
+  template <class EX, class AP>
+  Periodic_3_side_of_oriented_sphere_3(const Iso_cuboid_3 * dom,
+					    const EX * dom_e,
+					    const AP * dom_f)
+      : Base(dom_e,dom_f), _dom(dom) { }
+
+  Oriented_side
+  operator()(const Point_3 &p, const Point_3 &q, const Point_3 &r,
+             const Point_3 &s, const Point_3 &t) const
+  {
+      CGAL_PROFILER("Periodic_3_side_of_oriented_sphere_3 calls");
+
+      Get_approx<Point_3> get_approx; // Identity functor for all points
+                                      // but lazy points.
+      double px, py, pz, qx, qy, qz, rx, ry, rz, sx, sy, sz, tx, ty, tz;
+      init_double(px, py, pz, qx, qy, qz, rx, ry, rz, sx, sy, sz, tx, ty, tz, (FT*)(0));
+
+      if (fit_in_double(get_approx(p).x(), px) && fit_in_double(get_approx(p).y(), py) &&
+          fit_in_double(get_approx(p).z(), pz) &&
+          fit_in_double(get_approx(q).x(), qx) && fit_in_double(get_approx(q).y(), qy) &&
+          fit_in_double(get_approx(q).z(), qz) &&
+          fit_in_double(get_approx(r).x(), rx) && fit_in_double(get_approx(r).y(), ry) &&
+          fit_in_double(get_approx(r).z(), rz) &&
+          fit_in_double(get_approx(s).x(), sx) && fit_in_double(get_approx(s).y(), sy) &&
+          fit_in_double(get_approx(s).z(), sz) &&
+          fit_in_double(get_approx(t).x(), tx) && fit_in_double(get_approx(t).y(), ty) &&
+          fit_in_double(get_approx(t).z(), tz))
+      {
+          CGAL_PROFILER("Periodic_3_side_of_oriented_sphere_3 semi-static attempts");
+
+          double ptx = px - tx;
+          double pty = py - ty;
+          double ptz = pz - tz;
+          double pt2 = CGAL_NTS square(ptx) + CGAL_NTS square(pty)
+	             + CGAL_NTS square(ptz);
+          double qtx = qx - tx;
+          double qty = qy - ty;
+          double qtz = qz - tz;
+          double qt2 = CGAL_NTS square(qtx) + CGAL_NTS square(qty)
+	             + CGAL_NTS square(qtz);
+          double rtx = rx - tx;
+          double rty = ry - ty;
+          double rtz = rz - tz;
+          double rt2 = CGAL_NTS square(rtx) + CGAL_NTS square(rty)
+	             + CGAL_NTS square(rtz);
+          double stx = sx - tx;
+          double sty = sy - ty;
+          double stz = sz - tz;
+          double st2 = CGAL_NTS square(stx) + CGAL_NTS square(sty)
+	             + CGAL_NTS square(stz);
+
+          // Compute the semi-static bound.
+          double maxx = CGAL::abs(ptx);
+          double maxy = CGAL::abs(pty);
+          double maxz = CGAL::abs(ptz);
+
+          double aqtx = CGAL::abs(qtx);
+          double aqty = CGAL::abs(qty);
+          double aqtz = CGAL::abs(qtz);
+
+          double artx = CGAL::abs(rtx);
+          double arty = CGAL::abs(rty);
+          double artz = CGAL::abs(rtz);
+
+          double astx = CGAL::abs(stx);
+          double asty = CGAL::abs(sty);
+          double astz = CGAL::abs(stz);
+          
+          if (maxx < aqtx) maxx = aqtx;
+          if (maxx < artx) maxx = artx;
+          if (maxx < astx) maxx = astx;
+
+          if (maxy < aqty) maxy = aqty;
+          if (maxy < arty) maxy = arty;
+          if (maxy < asty) maxy = asty;
+
+          if (maxz < aqtz) maxz = aqtz;
+          if (maxz < artz) maxz = artz;
+          if (maxz < astz) maxz = astz;
+
+          // Sort maxx < maxy < maxz.
+          if (maxx > maxz)
+              std::swap(maxx, maxz);
+          if (maxy > maxz)
+              std::swap(maxy, maxz);
+          else if (maxy < maxx)
+              std::swap(maxx, maxy);
+
+          double eps = 1.2466136531027298e-13 * maxx * maxy * maxz
+                     * (maxz * maxz);
+
+          double det = CGAL::determinant(ptx,pty,ptz,pt2,
+                                         rtx,rty,rtz,rt2,
+                                         qtx,qty,qtz,qt2,
+                                         stx,sty,stz,st2);
+
+          // Protect against underflow in the computation of eps.
+          if (maxx < 1e-58) /* sqrt^5(min_double/eps) */ {
+            if (maxx == 0)
+              return ON_ORIENTED_BOUNDARY;
+          }
+          // Protect against overflow in the computation of det.
+          else if (maxz < 1e61) /* sqrt^5(max_double/4 [hadamard]) */ {
+            if (det > eps)  return ON_POSITIVE_SIDE;
+            if (det < -eps) return ON_NEGATIVE_SIDE;
+          }
+
+          CGAL_PROFILER("Periodic_3_side_of_oriented_sphere_3 semi-static failures");
+      }
+      return Base::operator()(p, q, r, s, t);
+  }
+
+  Oriented_side
+  operator()(const Point_3 &p, const Point_3 &q, const Point_3 &r,
+      const Point_3 &s, const Point_3 &t, const Offset &o_p,
+      const Offset &o_q, const Offset &o_r,
+      const Offset &o_s, const Offset &o_t) const {
+
+    CGAL_PROFILER("Periodic_3_side_of_oriented_sphere_3 calls");
+
+    Get_approx<Point_3> get_approx; // Identity functor for all points
+                                    // but lazy points.
+
+    double px, py, pz, qx, qy, qz, rx, ry, rz, sx, sy, sz, tx, ty, tz;
+    double domxmax, domxmin, domymax, domymin, domzmax, domzmin;
+    init_double(px, py, pz, qx, qy, qz, rx, ry, rz, sx, sy, sz, tx, ty, tz, (FT*)(0));
+    init_double(domxmax, domxmin, domymax, domymin, domzmax, domzmin, (FT*)(0));
+    int otx = o_t.x();
+    int oty = o_t.y();
+    int otz = o_t.z();
+
+    if (fit_in_double(get_approx(p).x(), px) && fit_in_double(get_approx(p).y(), py) &&
+        fit_in_double(get_approx(p).z(), pz) &&
+        fit_in_double(get_approx(q).x(), qx) && fit_in_double(get_approx(q).y(), qy) &&
+        fit_in_double(get_approx(q).z(), qz) &&
+        fit_in_double(get_approx(r).x(), rx) && fit_in_double(get_approx(r).y(), ry) &&
+        fit_in_double(get_approx(r).z(), rz) &&
+        fit_in_double(get_approx(s).x(), sx) && fit_in_double(get_approx(s).y(), sy) &&
+        fit_in_double(get_approx(s).z(), sz) &&
+        fit_in_double(get_approx(t).x(), tx) && fit_in_double(get_approx(t).y(), ty) &&
+        fit_in_double(get_approx(t).z(), tz) &&
+	fit_in_double(_dom->xmax(), domxmax) &&
+	fit_in_double(_dom->xmin(), domxmin) &&
+	fit_in_double(_dom->ymax(), domymax) &&
+	fit_in_double(_dom->ymin(), domymin) &&
+	fit_in_double(_dom->zmax(), domzmax) &&
+	fit_in_double(_dom->zmin(), domzmin))
+    {
+      CGAL_PROFILER("Periodic_3_side_of_oriented_sphere_3 semi-static attempts");
+
+      double domx = domxmax - domxmin;
+      double domy = domymax - domymin;
+      double domz = domzmax - domzmin;
+
+      double ptx = px - tx + domx * (o_p.x() - otx);
+      double pty = py - ty + domy * (o_p.y() - oty);
+      double ptz = pz - tz + domz * (o_p.z() - otz);
+      double pt2 = CGAL_NTS square(ptx) + CGAL_NTS square(pty)
+            + CGAL_NTS square(ptz);
+      double qtx = qx - tx + domx * (o_q.x() - otx);
+      double qty = qy - ty + domy * (o_q.y() - oty);
+      double qtz = qz - tz + domz * (o_q.z() - otz);
+      double qt2 = CGAL_NTS square(qtx) + CGAL_NTS square(qty)
+            + CGAL_NTS square(qtz);
+      double rtx = rx - tx + domx * (o_r.x() - otx);
+      double rty = ry - ty + domy * (o_r.y() - oty);
+      double rtz = rz - tz + domz * (o_r.z() - otz);
+      double rt2 = CGAL_NTS square(rtx) + CGAL_NTS square(rty)
+            + CGAL_NTS square(rtz);
+      double stx = sx - tx + domx * (o_s.x() - otx);
+      double sty = sy - ty + domy * (o_s.y() - oty);
+      double stz = sz - tz + domz * (o_s.z() - otz);
+      double st2 = CGAL_NTS square(stx) + CGAL_NTS square(sty)
+            + CGAL_NTS square(stz);
+
+      // Compute the semi-static bound.
+      double maxx = CGAL::abs(ptx);
+      double maxy = CGAL::abs(pty);
+      double maxz = CGAL::abs(ptz);
+      
+      double aqtx = CGAL::abs(qtx);
+      double aqty = CGAL::abs(qty);
+      double aqtz = CGAL::abs(qtz);
+
+      double artx = CGAL::abs(rtx);
+      double arty = CGAL::abs(rty);
+      double artz = CGAL::abs(rtz);
+
+      double astx = CGAL::abs(stx);
+      double asty = CGAL::abs(sty);
+      double astz = CGAL::abs(stz);
+      
+      if (maxx < aqtx) maxx = aqtx;
+      if (maxx < artx) maxx = artx;
+      if (maxx < astx) maxx = astx;
+
+      if (maxy < aqty) maxy = aqty;
+      if (maxy < arty) maxy = arty;
+      if (maxy < asty) maxy = asty;
+
+      if (maxz < aqtz) maxz = aqtz;
+      if (maxz < artz) maxz = artz;
+      if (maxz < astz) maxz = astz;
+
+      // Sort maxx < maxy < maxz.
+      if (maxx > maxz)
+          std::swap(maxx, maxz);
+      if (maxy > maxz)
+          std::swap(maxy, maxz);
+      else if (maxy < maxx)
+          std::swap(maxx, maxy);
+
+      double eps = 1.0466759304746772485e-13 * maxx * maxy * maxz
+                  * (maxz * maxz);
+
+      double det = CGAL::determinant(ptx,pty,ptz,pt2,
+                                      rtx,rty,rtz,rt2,
+                                      qtx,qty,qtz,qt2,
+                                      stx,sty,stz,st2);
+
+      // Protect against underflow in the computation of eps.
+      if (maxx < 1e-58) /* sqrt^5(min_double/eps) */ {
+        if (maxx == 0)
+          return ON_ORIENTED_BOUNDARY;
+      }
+      // Protect against overflow in the computation of det.
+      else if (maxz < 1e61) /* sqrt^5(max_double/4 [hadamard]) */ {
+        if (det > eps)  return ON_POSITIVE_SIDE;
+        if (det < -eps) return ON_NEGATIVE_SIDE;
+      }
+
+      CGAL_PROFILER("Periodic_3_side_of_oriented_sphere_3 semi-static failures");
+    }
+    return Base::operator()(p, q, r, s, t, o_p, o_q, o_r, o_s, o_t);
+  }
+
+  // Computes the epsilon for Periodic_3_side_of_oriented_sphere_3.
+  static double compute_epsilon()
+  {
+    typedef Static_filter_error F;
+    F t1 = F(1,F::ulp()/4);   // First translations
+    F sq = t1*t1+t1*t1+t1*t1; // squares
+    F det = CGAL::determinant(t1, t1, t1, sq,
+                              t1, t1, t1, sq,
+                              t1, t1, t1, sq,
+                              t1, t1, t1, sq); // Full det
+    double err = det.error();
+    err += err * 3 * F::ulp(); // Correction due to "eps * maxx * ...".
+
+    std::cerr << "*** epsilon for Periodic_3_side_of_oriented_sphere_3 = "
+	      << err << std::endl;
+    return err;
+  }
+};
+
+} } } // namespace CGAL::internal::Static_filters_predicates
+
+#endif // CGAL_INTERNAL_STATIC_FILTERS_PERIODIC_3_SIDE_OF_ORIENTED_SPHERE_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Power_test_3.h b/3rdparty/CGAL/include/CGAL/internal/Static_filters/Power_test_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Power_test_3.h
rename to 3rdparty/CGAL/include/CGAL/internal/Static_filters/Power_test_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Regular_triangulation_static_filters_traits_3.h b/3rdparty/CGAL/include/CGAL/internal/Static_filters/Regular_triangulation_static_filters_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Regular_triangulation_static_filters_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/internal/Static_filters/Regular_triangulation_static_filters_traits_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Side_of_oriented_circle_2.h b/3rdparty/CGAL/include/CGAL/internal/Static_filters/Side_of_oriented_circle_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Side_of_oriented_circle_2.h
rename to 3rdparty/CGAL/include/CGAL/internal/Static_filters/Side_of_oriented_circle_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Side_of_oriented_sphere_3.h b/3rdparty/CGAL/include/CGAL/internal/Static_filters/Side_of_oriented_sphere_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Side_of_oriented_sphere_3.h
rename to 3rdparty/CGAL/include/CGAL/internal/Static_filters/Side_of_oriented_sphere_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Static_filter_error.h b/3rdparty/CGAL/include/CGAL/internal/Static_filters/Static_filter_error.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Static_filters/Static_filter_error.h
rename to 3rdparty/CGAL/include/CGAL/internal/Static_filters/Static_filter_error.h
diff --git a/3rdparty/CGAL/include/CGAL/internal/Static_filters/Static_filters.h b/3rdparty/CGAL/include/CGAL/internal/Static_filters/Static_filters.h
new file mode 100644
index 0000000..cc347ea
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/internal/Static_filters/Static_filters.h
@@ -0,0 +1,329 @@
+// Copyright (c) 2001,2004  INRIA Sophia-Antipolis (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(s)     : Sylvain Pion
+ 
+#ifndef CGAL_INTERNAL_STATIC_FILTERS_H
+#define CGAL_INTERNAL_STATIC_FILTERS_H
+
+// This kernel wrapper gathers optimized predicates written by hand, using
+// a few steps of filtering.  It should work if the initial traits has
+// cartesian coordinates which fit exactly in doubles.
+//
+// Purely static filters code has been removed, since it requires additional
+// logic and is not plug'n play (requires users providing bounds).
+// If it should be provided again, it should probably be separate.
+
+#include <CGAL/basic.h>
+
+#include <CGAL/Kernel/function_objects.h>
+#include <CGAL/Cartesian/function_objects.h>
+
+#include <CGAL/internal/Static_filters/tools.h>
+#include <CGAL/internal/Static_filters/Orientation_2.h>
+#include <CGAL/internal/Static_filters/Orientation_3.h>
+
+// for static filters added nov./dec. 2011
+#ifdef CGAL_DISABLE_STATIC_FILTERS_ADDED_2011
+#  define CGAL_NO_EQUAL_3_STATIC_FILTERS 1
+#  define CGAL_NO_COMPARE_X_2_STATIC_FILTERS 1
+#  define CGAL_NO_IS_DEGENERATE_3_STATIC_FILTERS 1
+#  define CGAL_NO_ANGLE_3_STATIC_FILTERS 1
+#  define CGAL_NO_DO_INTERSECT_3_STATIC_FILTERS 1
+#endif // CGAL_DISABLE_STATIC_FILTERS_ADDED_2011
+
+
+#ifndef CGAL_NO_EQUAL_3_STATIC_FILTERS
+#  include <CGAL/internal/Static_filters/Equal_3.h>
+#  include <CGAL/internal/Static_filters/Equal_2.h>
+#endif // NOT CGAL_NO_EQUAL_3_STATIC_FILTERS
+
+#ifndef CGAL_NO_COMPARE_X_2_STATIC_FILTERS
+#  include <CGAL/internal/Static_filters/Compare_x_2.h>
+#  include <CGAL/internal/Static_filters/Compare_y_2.h>
+#endif // NOT CGAL_NO_COMPARE_X_2_STATIC_FILTERS
+
+#ifndef CGAL_NO_IS_DEGENERATE_3_STATIC_FILTERS
+#  include <CGAL/internal/Static_filters/Is_degenerate_3.h>
+#endif // NOT CGAL_NO_IS_DEGENERATE_3_STATIC_FILTERS
+
+#ifndef CGAL_NO_ANGLE_3_STATIC_FILTERS
+#  include <CGAL/internal/Static_filters/Angle_3.h>
+#endif // NOT CGAL_NO_ANGLE_3_STATIC_FILTERS
+
+#ifndef CGAL_NO_DO_INTERSECT_3_STATIC_FILTERS
+#  include <CGAL/internal/Static_filters/Do_intersect_3.h>
+#endif // NOT NOT CGAL_NO_DO_INTERSECT_3_STATIC_FILTERS
+
+#include <CGAL/internal/Static_filters/Compare_y_at_x_2.h>
+#include <CGAL/internal/Static_filters/Side_of_oriented_circle_2.h>
+#include <CGAL/internal/Static_filters/Side_of_oriented_sphere_3.h>
+#include <CGAL/internal/Static_filters/Compare_squared_radius_3.h>
+
+// #include <CGAL/internal/Static_filters/Coplanar_orientation_3.h>
+// #include <CGAL/internal/Static_filters/Coplanar_side_of_bounded_circle_3.h>
+
+// TODO :
+// - add more predicates :
+//   - all lexicographical comparisons
+//   - left_turn (via generic adapter to orientation)
+//   - power_tests
+//   - others ?
+// - benchmark on more algorithms.
+// - improve fit_in_double() for other NTs (MP_Float, Lazy). cf tools.h.
+// - try to automatize : have a struct a la Static_filter_error, with one part
+//   which is runtime, and the other which can be constant-propagated by the
+//   compiler.  g++ 4.0 should be able to cprop the second part...
+
+
+// Note about the second parameter of Static_filters<K,bool>:
+// - if the access to Cartesian exact coordinates is cheap
+//   (Simple_cartesian, Cartesian), then one can implement predicates that
+//   just compare coordinates without filtering, using unfiltered
+//   predicates defined in the namespace CartesianKernelFunctors.
+// 
+// - in the case of Lazy_kernel, where the access to p.x(), for a point p,
+//   triggers the construction of a Lazy_exact_nt object, one does not want
+//   to use the functors from the namespace CartesianKernelFunctors.
+
+namespace CGAL { namespace internal {
+
+// Here is the case when has_cheap_access_to_cartesian_coordinates is
+// false, used by Lazy_kernel
+// The K_base argument is supposed to provide exact primitives.
+template < typename K_base, 
+           bool has_cheap_access_to_cartesian_coordinates = true>
+class Static_filters : public K_base {
+
+
+  typedef Static_filters<K_base, 
+                         has_cheap_access_to_cartesian_coordinates>         Self;
+
+public:
+#ifndef CGAL_NO_EQUAL_3_STATIC_FILTERS
+  typedef Static_filters_predicates::Equal_2<K_base>                        Equal_2;
+  typedef Static_filters_predicates::Equal_3<K_base>                        Equal_3;
+#endif // NOT CGAL_NO_EQUAL_3_STATIC_FILTERS
+
+#ifndef CGAL_NO_COMPARE_X_2_STATIC_FILTERS
+  typedef Static_filters_predicates::Compare_x_2<K_base>                    Compare_x_2;
+  typedef Static_filters_predicates::Compare_y_2<K_base>                    Compare_y_2;
+#endif // NOT CGAL_NO_COMPARE_X_2_STATIC_FILTERS
+
+#ifndef CGAL_NO_IS_DEGENERATE_3_STATIC_FILTERS
+  typedef Static_filters_predicates::Is_degenerate_3<K_base, Self>          Is_degenerate_3;
+#endif // NOT CGAL_NO_IS_DEGENERATE_3_STATIC_FILTERS
+  typedef Static_filters_predicates::Orientation_2<K_base>                  Orientation_2;
+  typedef Static_filters_predicates::Orientation_3<K_base>                  Orientation_3;
+#ifndef CGAL_NO_ANGLE_3_STATIC_FILTERS
+  typedef Static_filters_predicates::Angle_3<K_base>                        Angle_3;
+#endif // NOT CGAL_NO_ANGLE_3_STATIC_FILTERS
+#ifndef CGAL_NO_DO_INTERSECT_3_STATIC_FILTERS
+  typedef Static_filters_predicates::Do_intersect_3<K_base,Self>            Do_intersect_3;
+#endif // NOT CGAL_NO_DO_INTERSECT_3_STATIC_FILTERS
+  typedef Static_filters_predicates::Side_of_oriented_circle_2<K_base>      Side_of_oriented_circle_2;
+  typedef Static_filters_predicates::Side_of_oriented_sphere_3<K_base>      Side_of_oriented_sphere_3;
+  typedef Static_filters_predicates::Compare_squared_radius_3<K_base>       Compare_squared_radius_3;
+
+  Orientation_2
+  orientation_2_object() const
+  { return Orientation_2(); }
+
+  Orientation_3
+  orientation_3_object() const
+  { return Orientation_3(); }
+
+#ifndef CGAL_NO_EQUAL_3_STATIC_FILTERS
+ Equal_2
+  equal_2_object() const
+  { return Equal_2(); }
+
+ Equal_3
+  equal_3_object() const
+  { return Equal_3(); }
+#endif // NOT CGAL_NO_EQUAL_3_STATIC_FILTERS
+
+#ifndef CGAL_NO_COMPARE_X_2_STATIC_FILTERS
+ Compare_x_2
+  compare_x_2_object() const
+  { return Compare_x_2(); }
+
+Compare_y_2
+  compare_y_2_object() const
+  { return Compare_y_2(); }
+#endif // NOT CGAL_NO_COMPARE_Y_2_STATIC_FILTERS
+
+#ifndef CGAL_NO_IS_DEGENERATE_3_STATIC_FILTERS
+ Is_degenerate_3
+  is_degenerate_3_object() const
+  { return Is_degenerate_3(); }
+#endif // NOT CGAL_NO_IS_DEGENERATE_3_STATIC_FILTERS
+
+#ifndef CGAL_NO_ANGLE_3_STATIC_FILTERS
+  Angle_3
+  angle_3_object() const
+  { return Angle_3(); }
+#endif // NOT CGAL_NO_ANGLE_3_STATIC_FILTERS
+
+#ifndef CGAL_NO_DO_INTERSECT_3_STATIC_FILTERS
+  Do_intersect_3
+  do_intersect_3_object() const
+  { return Do_intersect_3(); }
+#endif // NOT CGAL_NO_DO_INTERSECT_3_STATIC_FILTERS
+
+  Side_of_oriented_circle_2
+  side_of_oriented_circle_2_object() const
+  { return Side_of_oriented_circle_2(); }
+
+  Side_of_oriented_sphere_3
+  side_of_oriented_sphere_3_object() const
+  { return Side_of_oriented_sphere_3(); }
+
+  Compare_squared_radius_3
+  compare_squared_radius_3_object() const
+  { return Compare_squared_radius_3(); }
+
+  enum { Has_static_filters = true };
+}; // end of class template Static_filters<K_base, false>
+
+
+// Here is the case when has_cheap_access_to_cartesian_coordinates is true,
+// the default, used by Filtered_kernel<CK>.
+// The K_base argument is supposed to provide exact primitives.
+template < typename K_base>
+class Static_filters<K_base, true> // has_cheap_access_to_cartesian_coordinates==true
+  : public Static_filters<K_base, false>
+{
+  typedef Static_filters<K_base, true>              Self;
+
+public:
+
+  typedef Static_filters_predicates::Compare_y_at_x_2<K_base,Self>          Compare_y_at_x_2;
+
+  // The following do not require filtering as they only do
+  // comparisons.  We must be careful that *all* their function
+  // operators must not do any comparisons.
+  // In case we would like to avoid filtering only some of
+  // the function operators, we need to make a new functors.
+  typedef CommonKernelFunctors::Left_turn_2<Self>   Left_turn_2;
+
+  typedef CartesianKernelFunctors::Less_x_2<Self>   Less_x_2;
+  typedef CartesianKernelFunctors::Less_y_2<Self>   Less_y_2;
+  typedef CartesianKernelFunctors::Less_xy_2<Self>  Less_xy_2;
+  typedef CartesianKernelFunctors::Less_yx_2<Self>  Less_yx_2;
+
+  typedef CartesianKernelFunctors::Less_x_3<Self>   Less_x_3;
+  typedef CartesianKernelFunctors::Less_y_3<Self>   Less_y_3;
+  typedef CartesianKernelFunctors::Less_z_3<Self>   Less_z_3;
+  typedef CartesianKernelFunctors::Less_xy_3<Self>  Less_xy_3;
+  typedef CartesianKernelFunctors::Less_xyz_3<Self> Less_xyz_3;
+
+  typedef CartesianKernelFunctors::Compare_xy_2<Self>  Compare_xy_2;
+  typedef CartesianKernelFunctors::Compare_x_3<Self>   Compare_x_3;
+  typedef CartesianKernelFunctors::Compare_y_3<Self>   Compare_y_3;
+  typedef CartesianKernelFunctors::Compare_z_3<Self>   Compare_z_3;
+  typedef CartesianKernelFunctors::Compare_xy_3<Self>  Compare_xy_3;
+  typedef CartesianKernelFunctors::Compare_xyz_3<Self> Compare_xyz_3;
+
+  Compare_xy_2
+  compare_xy_2_object() const
+  { return Compare_xy_2(); }
+
+  Compare_x_3
+  compare_x_3_object() const
+  { return Compare_x_3(); }
+
+  Compare_y_3
+  compare_y_3_object() const
+  { return Compare_y_3(); }
+
+  Compare_z_3
+  compare_z_3_object() const
+  { return Compare_z_3(); }
+
+  Compare_xy_3
+  compare_xy_3_object() const
+  { return Compare_xy_3(); }
+
+  Compare_xyz_3
+  compare_xyz_3_object() const
+  { return Compare_xyz_3(); }
+
+  Left_turn_2
+  left_turn_2_object() const
+  { return Left_turn_2(); }
+
+  Less_x_2
+  less_x_2_object() const
+  { return Less_x_2(); }
+
+  Less_y_2
+  less_y_2_object() const
+  { return Less_y_2(); }
+
+  Less_xy_2
+  less_xy_2_object() const
+  { return Less_xy_2(); }
+
+  Less_yx_2
+  less_yx_2_object() const
+  { return Less_yx_2(); }
+
+  Less_x_3
+  less_x_3_object() const
+  { return Less_x_3(); }
+
+  Less_y_3
+  less_y_3_object() const
+  { return Less_y_3(); }
+
+  Less_z_3
+  less_z_3_object() const
+  { return Less_z_3(); }
+
+  Less_xy_3
+  less_xy_3_object() const
+  { return Less_xy_3(); }
+
+  Less_xyz_3
+  less_xyz_3_object() const
+  { return Less_xyz_3(); }
+
+  Compare_y_at_x_2
+  compare_y_at_x_2_object() const
+  { return Compare_y_at_x_2(); }
+
+  // The two following are for degenerate cases, so I'll update them later.
+  //
+  // typedef Static_filters_predicates::Coplanar_orientation_3<Point_3, Orientation_2>
+  //                                                   Coplanar_orientation_3;
+  // typedef Static_filters_predicates::Side_of_bounded_circle_3<Point_3>
+  //                                         Coplanar_side_of_bounded_circle_3;
+
+  // Coplanar_orientation_3
+  // coplanar_orientation_3_object() const
+  // { return Coplanar_orientation_3(); }
+
+  // Coplanar_side_of_bounded_circle_3
+  // coplanar_side_of_bounded_circle_3_object() const
+  // { return Coplanar_side_of_bounded_circle_3(); }
+};
+
+} } // namespace CGAL::internal
+
+#endif // CGAL_INTERNAL_STATIC_FILTERS_H
diff --git a/3rdparty/CGAL/include/CGAL/internal/Static_filters/tools.h b/3rdparty/CGAL/include/CGAL/internal/Static_filters/tools.h
new file mode 100644
index 0000000..98f0f95
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/internal/Static_filters/tools.h
@@ -0,0 +1,209 @@
+// Copyright (c) 2001,2004  INRIA Sophia-Antipolis (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(s)     : Sylvain Pion
+ 
+#ifndef CGAL_INTERNAL_STATIC_FILTERS_TOOLS_H
+#define CGAL_INTERNAL_STATIC_FILTERS_TOOLS_H
+
+#include <CGAL/basic.h>
+#include <CGAL/function_objects.h>
+#include <boost/mpl/has_xxx.hpp>
+
+namespace CGAL {
+
+template < typename ET >
+class Lazy_exact_nt;
+
+namespace internal {
+
+// Utility function to check a posteriori that a subtraction was performed
+// without rounding error.
+inline bool diff_was_exact(double a, double b, double ab)
+{
+    return ab+b == a && a-ab == b;
+}
+
+template < typename T >
+inline void init_double(double&, T* ) {}
+
+template < typename T >
+inline void init_double(double&, double&, T* ) {}
+
+template < typename T >
+inline void init_double(double&, double&, double&, T* ) {}
+
+template < typename T >
+inline void init_double(double&, double&, double&, double&, T* ) {}
+
+template < typename T >
+inline void init_double(double&, double&, double&, double&, double&, T* ) {}
+
+template < typename T >
+inline void init_double(double&, double&, double&, double&, double&, double&, T* ) {}
+
+template < typename T >
+inline void init_double(double&, double&, double&, double&, double&, double&, double&, T* ) {}
+
+template < typename T >
+inline void init_double(double&, double&, double&, double&, double&, double&, double&, double&, T* ) {}
+
+template < typename T >
+inline void init_double(double&, double&, double&,double&, double&, double&, double&, double&, double&, T* ) {}
+
+template < typename T >
+inline void init_double(double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, T* ) {}
+
+
+template < typename T >
+inline void init_double(double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, T* ) {}
+
+
+template < typename T >
+inline void init_double(double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, T* ) {}
+
+
+template < typename T >
+inline void init_double(double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, T* ) {}
+
+
+template < typename T >
+inline void init_double(double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, T* ) {}
+
+
+template < typename T >
+inline void init_double(double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, T* ) {}
+
+
+
+template < typename ET >
+inline void init_double(double& d0, Lazy_exact_nt<ET>* )
+{d0 = 0;}
+
+template < typename ET >
+inline void init_double(double& d0, double& d1, Lazy_exact_nt<ET>* )
+{d0 = d1 = 0;}
+
+template < typename ET >
+inline void init_double(double& d0, double& d1, double& d2, Lazy_exact_nt<ET>* )
+{d0 = d1 = d2 = 0;}
+
+template < typename ET >
+inline void init_double(double& d0, double& d1, double& d2, double& d3, Lazy_exact_nt<ET>* )
+{d0 = d1 = d2 = d3 = 0;}
+
+template < typename ET >
+inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, Lazy_exact_nt<ET>* )
+{d0 = d1 = d2 = d3 = d4 = 0;}
+
+template < typename ET >
+inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, double& d5, Lazy_exact_nt<ET>* )
+{d0 = d1 = d2 = d3 = d4 = d5 = 0;}
+
+template < typename ET >
+inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, double& d5, double& d6, Lazy_exact_nt<ET>* )
+{d0 = d1 = d2 = d3 = d4 = d5 = d6 = 0;}
+
+template < typename ET >
+inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, double& d5, double& d6, double& d7, Lazy_exact_nt<ET>* )
+{d0 = d1 = d2 = d3 = d4 = d5 = d6 = d7 = 0;}
+
+template < typename ET >
+inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, double& d5, double& d6, double& d7, double& d8, Lazy_exact_nt<ET>* )
+{d0 = d1 = d2 = d3 = d4 = d5 = d6 = d7 = d8 = 0;}
+
+template < typename ET >
+inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, double& d5, double& d6, double& d7, double&d8, double& d9, Lazy_exact_nt<ET>* )
+{d0 = d1 = d2 = d3 = d4 = d5 = d6 = d7 = d8 = d9 = 0;}
+
+template < typename ET >
+inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, double& d5, double& d6, double& d7, double&d8, double& d9, double& d10, Lazy_exact_nt<ET>* )
+{d0 = d1 = d2 = d3 = d4 = d5 = d6 = d7 = d8 = d9 = d10 = 0;}
+
+template < typename ET >
+inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, double& d5, double& d6, double& d7, double&d8, double& d9, double& d10, double& d11, Lazy_exact_nt<ET>* )
+{d0 = d1 = d2 = d3 = d4 = d5 = d6 = d7 = d8 = d9 = d10 = d11 = 0;}
+
+template < typename ET >
+inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, double& d5, double& d6, double& d7, double&d8, double& d9, double& d10, double& d11, double& d12, Lazy_exact_nt<ET>* )
+{d0 = d1 = d2 = d3 = d4 = d5 = d6 = d7 = d8 = d9 = d10 = d11 = d12 = 0;}
+
+template < typename ET >
+inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, double& d5, double& d6, double& d7, double&d8, double& d9, double& d10, double& d11, double& d12, double& d13, Lazy_exact_nt<ET>* )
+{d0 = d1 = d2 = d3 = d4 = d5 = d6 = d7 = d8 = d9 = d10 = d11 = d12 = d13 = 0;}
+
+template < typename ET >
+inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, double& d5, double& d6, double& d7, double&d8, double& d9, double& d10, double& d11, double& d12, double& d13, double& d14, Lazy_exact_nt<ET>* )
+{d0 = d1 = d2 = d3 = d4 = d5 = d6 = d7 = d8 = d9 = d10 = d11 = d12 = d13 = d14 = 0;}
+
+
+// Auxiliary function to check if static filters can be applied, that is,
+// if to_double() does not add roundoff errors.
+// TODO :
+// - generalize it to other number types.
+// - promote it as a number type requirement ?
+// - naming : is_representable_in_double() ?
+//            is_representable<T>() for representable in T ?
+
+// Current semantics :  bool fit_in_double(const NT& n, double &)
+//
+// - returns true means that "n" is exactly representable by a double,
+//   _and_ then "returns" it in the reference.
+// - it is fine to return false conservatively.
+
+template < typename T >
+inline bool fit_in_double(const T&, double&) { return false; }
+
+inline bool fit_in_double(const double& d, double& r) { r = d; return true; }
+
+inline bool fit_in_double(const float& f, double& r) { r = f; return true; }
+
+inline bool fit_in_double(const int& i, double& r) { r = i; return true; }
+
+template < typename ET >
+inline bool fit_in_double(const Lazy_exact_nt<ET>&, double&);
+
+
+// Auxiliary functor, to get the approximation of a kernel object:
+//   - for a Point_3 of the Lazy_kernel<...>, one needs to call approx(),
+//   - for a Point_3 of Simple_cartesian<double>, for example, the
+//     approximation is the object itself.
+
+namespace Static_filters_predicates {
+
+BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Kernel_object_has_approx, \
+                                  Approximate_type, \
+                                  false)
+
+template <typename T, bool has_approx = Kernel_object_has_approx<T>::value>
+struct Get_approx : public CGAL::Identity<T> {
+  // If has_approx==false, this functor is the identity.
+};
+
+template <typename T>
+struct Get_approx<T, true> {
+  // If has_approx==false, this functor get .approx() on its argument.
+  const typename T::Approximate_type& operator()(const T& x) const { return x.approx(); }
+  typename T::Approximate_type& operator()(T& x) const { return x.approx(); }
+};
+
+} // end namespace Static_filters_predicates
+
+} } // namespace CGAL::internal
+
+#endif // CGAL_INTERNAL_STATIC_FILTERS_TOOLS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Static_or_dynamic_array.h b/3rdparty/CGAL/include/CGAL/internal/Static_or_dynamic_array.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Static_or_dynamic_array.h
rename to 3rdparty/CGAL/include/CGAL/internal/Static_or_dynamic_array.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Surface_mesh_deformation/Spokes_and_rims_iterator.h b/3rdparty/CGAL/include/CGAL/internal/Surface_mesh_deformation/Spokes_and_rims_iterator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Surface_mesh_deformation/Spokes_and_rims_iterator.h
rename to 3rdparty/CGAL/include/CGAL/internal/Surface_mesh_deformation/Spokes_and_rims_iterator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Surface_mesh_segmentation/AABB_traits.h b/3rdparty/CGAL/include/CGAL/internal/Surface_mesh_segmentation/AABB_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Surface_mesh_segmentation/AABB_traits.h
rename to 3rdparty/CGAL/include/CGAL/internal/Surface_mesh_segmentation/AABB_traits.h
diff --git a/3rdparty/CGAL/include/CGAL/internal/Surface_mesh_segmentation/AABB_traversal_traits.h b/3rdparty/CGAL/include/CGAL/internal/Surface_mesh_segmentation/AABB_traversal_traits.h
new file mode 100644
index 0000000..6c8dbf3
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/internal/Surface_mesh_segmentation/AABB_traversal_traits.h
@@ -0,0 +1,77 @@
+// Copyright (c) 2014  GeometryFactory Sarl (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
+// 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.
+
+
+#ifndef CGAL_INTERNAL_SURFACE_MESH_SEGMENTATION_AABB_TRAVERSAL_TRAITS_H
+#define CGAL_INTERNAL_SURFACE_MESH_SEGMENTATION_AABB_TRAVERSAL_TRAITS_H
+
+namespace CGAL
+{
+
+/// @cond CGAL_DOCUMENT_INTERNAL
+
+/**
+ * @class Special case for ray/segment-triangle
+ * the only difference with the offical one (Listing_intersection_traits) is that
+ * is the do_intersect which is made prior to the intersection call.
+ */
+template<typename AABBTraits, typename Query, typename Output_iterator>
+class Listing_intersection_traits_ray_or_segment_triangle
+{
+  typedef typename AABBTraits::FT FT;
+  typedef typename AABBTraits::Point_3 Point;
+  typedef typename AABBTraits::Primitive Primitive;
+  typedef typename AABBTraits::Bounding_box Bounding_box;
+  typedef typename AABBTraits::Primitive::Id Primitive_id;
+  typedef typename AABBTraits::Point_and_primitive_id Point_and_primitive_id;
+  typedef ::CGAL::AABB_node<AABBTraits> Node;
+  typedef typename ::CGAL::AABB_tree<AABBTraits>::size_type size_type;
+
+public:
+  Listing_intersection_traits_ray_or_segment_triangle(Output_iterator out_it,
+      const AABBTraits& traits)
+    : m_out_it(out_it), m_traits(traits) {}
+
+  bool go_further() const {
+    return true;
+  }
+
+  void intersection(const Query& query, const Primitive& primitive) {
+    //SL: using Kernel_traits is not bad in this context cause we expect a Ray/Segment from a CGAL Kernel here
+    typedef typename Kernel_traits<Query>::Kernel GeomTraits;
+    typedef typename AABBTraits:: template Intersection_and_primitive_id<Query>::Type Intersection_and_primitive_id;
+
+    if ( GeomTraits().do_intersect_3_object()(query,
+         primitive.datum(m_traits.shared_data())) ) {
+      boost::optional<Intersection_and_primitive_id> intersection
+        = m_traits.intersection_object()(query, primitive);
+      if(intersection) {
+        *m_out_it++ = *intersection;
+      }
+    }
+  }
+
+  bool do_intersect(const Query& query, const Node& node) const {
+    return m_traits.do_intersect_object()(query, node.bbox());
+  }
+
+private:
+  Output_iterator m_out_it;
+  const AABBTraits& m_traits;
+};
+
+/// @endcond
+
+} //namespace CGAL
+#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Surface_mesh_segmentation/Alpha_expansion_graph_cut.h b/3rdparty/CGAL/include/CGAL/internal/Surface_mesh_segmentation/Alpha_expansion_graph_cut.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Surface_mesh_segmentation/Alpha_expansion_graph_cut.h
rename to 3rdparty/CGAL/include/CGAL/internal/Surface_mesh_segmentation/Alpha_expansion_graph_cut.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Surface_mesh_segmentation/Disk_samplers.h b/3rdparty/CGAL/include/CGAL/internal/Surface_mesh_segmentation/Disk_samplers.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Surface_mesh_segmentation/Disk_samplers.h
rename to 3rdparty/CGAL/include/CGAL/internal/Surface_mesh_segmentation/Disk_samplers.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Surface_mesh_segmentation/Expectation_maximization.h b/3rdparty/CGAL/include/CGAL/internal/Surface_mesh_segmentation/Expectation_maximization.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Surface_mesh_segmentation/Expectation_maximization.h
rename to 3rdparty/CGAL/include/CGAL/internal/Surface_mesh_segmentation/Expectation_maximization.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Surface_mesh_segmentation/Filters.h b/3rdparty/CGAL/include/CGAL/internal/Surface_mesh_segmentation/Filters.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Surface_mesh_segmentation/Filters.h
rename to 3rdparty/CGAL/include/CGAL/internal/Surface_mesh_segmentation/Filters.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Surface_mesh_segmentation/K_means_clustering.h b/3rdparty/CGAL/include/CGAL/internal/Surface_mesh_segmentation/K_means_clustering.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Surface_mesh_segmentation/K_means_clustering.h
rename to 3rdparty/CGAL/include/CGAL/internal/Surface_mesh_segmentation/K_means_clustering.h
diff --git a/3rdparty/CGAL/include/CGAL/internal/Surface_mesh_segmentation/SDF_calculation.h b/3rdparty/CGAL/include/CGAL/internal/Surface_mesh_segmentation/SDF_calculation.h
new file mode 100644
index 0000000..9ff239f
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/internal/Surface_mesh_segmentation/SDF_calculation.h
@@ -0,0 +1,584 @@
+#ifndef CGAL_SURFACE_MESH_SEGMENTATION_SDF_CALCULATION_H
+// Copyright (c) 2014  GeometryFactory Sarl (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
+// 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.
+
+
+#define CGAL_SURFACE_MESH_SEGMENTATION_SDF_CALCULATION_H
+
+#include <CGAL/AABB_tree.h>
+#include <CGAL/AABB_face_graph_triangle_primitive.h>
+#include <CGAL/internal/Surface_mesh_segmentation/AABB_traversal_traits.h>
+#include <CGAL/internal/Surface_mesh_segmentation/AABB_traits.h>
+#include <CGAL/internal/Surface_mesh_segmentation/Disk_samplers.h>
+#include <CGAL/constructions/kernel_ftC3.h>
+#include <vector>
+#include <algorithm>
+
+#include <boost/tuple/tuple.hpp>
+#include <boost/optional.hpp>
+
+#define CGAL_NUMBER_OF_MAD 1.5
+
+namespace CGAL
+{
+/// @cond CGAL_DOCUMENT_INTERNAL
+namespace internal
+{
+
+template<class ID>
+struct SkipPrimitiveFunctor {
+
+  bool operator()(const ID& skip_me) const {
+    return skip_me == skip;
+  }
+
+  SkipPrimitiveFunctor(const ID& skip) : skip(skip) { }
+
+  ID skip;
+};
+
+template<class ID>
+struct FirstIntersectionVisitor {
+
+  void operator()(const ID& /*closest*/, double /*distance*/) const {
+  }
+};
+
+/**
+ * @brief Responsible for calculating Shape Diameter Function over surface of the mesh.
+ *
+ * @tparam Polyhedron a CGAL polyhedron
+ * @tparam GeomTraits a model of SegmentationGeomTraits
+ */
+template <
+      class Polyhedron,
+      class VertexPointPmap,
+      class GeomTraits = typename Polyhedron::Traits,
+      bool fast_bbox_intersection = true
+      >
+class SDF_calculation
+{
+//type definitions
+private:
+
+  typedef typename GeomTraits::Vector_3   Vector;
+  typedef typename GeomTraits::Point_3    Point;
+  typedef typename GeomTraits::Ray_3      Ray;
+  typedef typename GeomTraits::Plane_3    Plane;
+  typedef typename GeomTraits::Segment_3  Segment;
+  typedef typename GeomTraits::FT         FT;
+
+  typedef typename boost::graph_traits<Polyhedron>::face_iterator face_iterator;
+  typedef typename boost::graph_traits<Polyhedron>::face_descriptor   face_handle;
+  typedef typename boost::graph_traits<Polyhedron>::halfedge_descriptor   halfedge_handle;
+
+  typedef AABB_face_graph_triangle_primitive<Polyhedron, VertexPointPmap> Primitive;
+  typedef AABB_traits_SDF<GeomTraits, Primitive, fast_bbox_intersection>
+  AABB_traits_internal;
+  typedef typename CGAL::AABB_tree<AABB_traits_internal>                 Tree;
+  typedef typename Tree::Primitive_id Primitive_id;
+
+  // Sampled points from disk, t1 = coordinate-x, t2 = coordinate-y, t3 = weight.
+  typedef boost::tuple<double, double, double> Disk_sample;
+  typedef std::vector<Disk_sample>             Disk_samples_list;
+
+  // DiskSampling class responsible for the sampling points in a disk. It is used for generating rays in the cones. For different example see Disk_samplers.h
+  typedef Vogel_disk_sampling<boost::tuple<double, double, double> >
+  Default_sampler;
+
+// member variables
+private:
+  static AABB_traits_internal
+  create_traits(const Polyhedron& mesh,
+                VertexPointPmap vertex_point_map )
+  {
+    AABB_traits_internal traits;
+    traits.set_shared_data(mesh, vertex_point_map);
+    return traits;
+  }
+  GeomTraits traits;
+  const Polyhedron& mesh;
+  VertexPointPmap vertex_point_map;
+
+  typename GeomTraits::Angle_3                         angle_functor;
+  typename GeomTraits::Construct_scaled_vector_3       scale_functor;
+  typename GeomTraits::Construct_sum_of_vectors_3      sum_functor;
+  typename GeomTraits::Construct_normal_3              normal_functor;
+  typename GeomTraits::Construct_translated_point_3    translated_point_functor;
+  typename GeomTraits::Construct_centroid_3            centroid_functor;
+
+  Tree tree;
+
+  double max_diagonal;
+  bool   use_diagonal;
+public:
+  /**
+   * Construct AABB tree with a mesh. Ignores degenerated faces.
+   * @param mesh `CGAL Polyhedron` on which AABB tree constructed
+   * @param build_kd_tree requirement on internal kd-tree (it is only required if find_closest_with_AABB_distance is planned to use)
+   * @param use_diagonal if true: calculates diagonal of AABB tree and cast segments instead of rays using diagonal length
+   * @param traits trait object
+   */
+  SDF_calculation(const Polyhedron& mesh,
+                  VertexPointPmap vertex_point_map,
+                  bool build_kd_tree = false,
+                  bool use_diagonal = true, GeomTraits traits = GeomTraits())
+    :
+    traits(traits),
+    mesh(mesh),
+    vertex_point_map(vertex_point_map),
+    angle_functor(traits.angle_3_object()),
+    scale_functor(traits.construct_scaled_vector_3_object()),
+    sum_functor(traits.construct_sum_of_vectors_3_object()),
+    normal_functor(traits.construct_normal_3_object()),
+    translated_point_functor(traits.construct_translated_point_3_object()),
+    centroid_functor(traits.construct_centroid_3_object()),
+    tree(create_traits(mesh, vertex_point_map)),
+    use_diagonal(use_diagonal) 
+  {
+    typedef typename boost::property_traits<VertexPointPmap>::reference Point_ref;
+    typename GeomTraits::Collinear_3  collinear = traits.collinear_3_object();
+    face_iterator it, end;
+    for(it = faces(mesh).begin(), end = faces(mesh).end(); it!=end; it++)
+    {
+        halfedge_handle h = halfedge(*it, mesh);
+        Point_ref a(get(vertex_point_map, target(h, mesh)));
+        h = next(h, mesh);
+        Point_ref b(get(vertex_point_map,target(h, mesh)));
+        h = next(h, mesh);
+        Point_ref c(get(vertex_point_map, target(h, mesh)));
+        bool test = collinear(a,b,c);
+        if(!test)
+          tree.insert(Primitive(it, mesh, vertex_point_map));
+    }
+    tree.build();
+
+    if(build_kd_tree) {
+      tree.accelerate_distance_queries();
+    }
+
+    if(use_diagonal) {
+      CGAL::Bbox_3 bbox = tree.bbox();
+      max_diagonal =
+        std::sqrt(
+          CGAL::squared_distanceC3( bbox.xmin(), bbox.ymin(), bbox.zmin(), bbox.xmax(),
+                                    bbox.ymax(), bbox.zmax() )
+        );
+    }
+  }
+
+  /**
+   * Calculates SDF values for each facet in a range, and stores them in @a sdf_values. Note that sdf values are neither smoothed nor normalized.
+   * @tparam FacetValueMap `WritablePropertyMap` with `boost::graph_traits<Polyhedron>::face_handle` as key and `double` as value type
+   * @tparam InputIterator Iterator over polyhedrons. Its value type is `pointer to polyhedron`.
+   * @param facet_begin range begin
+   * @param facet_end range past-the-end
+   * @param cone_angle opening angle for cone, expressed in radians
+   * @param number_of_rays number of rays picked from cone for each facet
+   * @param[out] sdf_values
+   */
+  template <class FacetValueMap, class InputIterator, class DiskSampling>
+  void calculate_sdf_values(
+    InputIterator facet_begin,
+    InputIterator facet_end,
+    double cone_angle,
+    std::size_t number_of_rays,
+    FacetValueMap sdf_values,
+    DiskSampling disk_sampler) const {
+    Disk_samples_list disk_samples;
+    disk_sampler(number_of_rays, std::back_inserter(disk_samples));
+
+    for( ; facet_begin != facet_end; ++facet_begin) {
+      boost::optional<double> sdf_value = calculate_sdf_value_of_facet(*facet_begin,
+                                          cone_angle, true, disk_samples);
+
+      if(sdf_value) {
+        sdf_values[*facet_begin] = *sdf_value;
+      } else          {
+        sdf_values[*facet_begin] = -1.0;
+      }
+    }
+  }
+
+  /**
+   * Overload for default sampling parameter
+   */
+  template <class FacetValueMap, class InputIterator>
+  void calculate_sdf_values(
+    InputIterator facet_begin,
+    InputIterator facet_end,
+    double cone_angle,
+    std::size_t number_of_rays,
+    FacetValueMap sdf_values) const {
+    calculate_sdf_values(facet_begin, facet_end, cone_angle, number_of_rays,
+                         sdf_values, Default_sampler());
+  }
+
+  /**
+   * Cast rays inside code located around normal with apex at center.
+   * Any encountered primitives are tested with `skip`, and accepted if `skip` returns false.
+   * For each ray, closest encountered primitive send to `visitor`.
+   *
+   * \note: normal should have unit length
+   */
+  template<class SkipPrimitiveFunctor, class FirstIntersectionVisitor>
+  boost::optional<double> calculate_sdf_value_of_point(
+    Point center,
+    Vector normal,
+    SkipPrimitiveFunctor skip,
+    FirstIntersectionVisitor visitor,
+    double cone_angle,
+    std::size_t number_of_rays,
+    bool accept_if_acute) const {
+    return calculate_sdf_value_of_point(center, normal, skip, visitor, cone_angle,
+                                        number_of_rays, accept_if_acute,
+                                        Default_sampler() );
+  }
+
+  /**
+   * Overload for taking DiskSampling as template parameter
+   */
+  template<class SkipPrimitiveFunctor, class FirstIntersectionVisitor, class DiskSampling>
+  boost::optional<double> calculate_sdf_value_of_point(
+    Point center,
+    Vector normal,
+    SkipPrimitiveFunctor skip,
+    FirstIntersectionVisitor visitor,
+    double cone_angle,
+    std::size_t number_of_rays,
+    bool accept_if_acute,
+    DiskSampling disk_sampler) const {
+    Disk_samples_list disk_samples;
+    disk_sampler(number_of_rays, std::back_inserter(disk_samples));
+
+    return calculate_sdf_value_of_point(center, normal, skip, visitor, cone_angle,
+                                        accept_if_acute, disk_samples);
+  }
+
+  /**
+   * Overload for directly taking sampled points from disk as parameter
+   */
+  template<class SkipPrimitiveFunctor, class FirstIntersectionVisitor>
+  boost::optional<double> calculate_sdf_value_of_point(
+    const Point& center,
+    const Vector& normal,
+    SkipPrimitiveFunctor skip,
+    FirstIntersectionVisitor visitor,
+    double cone_angle,
+    bool accept_if_acute,
+    const Disk_samples_list& disk_samples) const {
+    if(cone_angle < 0.0 || cone_angle > CGAL_PI) {
+      CGAL_warning(false && "Cone angle is clamped between [0, CGAL_PI].");
+      cone_angle = (std::min)(CGAL_PI, (std::max)(0.0, cone_angle));
+    }
+
+    Plane plane(center, normal);
+    Vector v1 = plane.base1(), v2 = plane.base2();
+    v1 = scale_functor(v1, FT(1.0 / CGAL::sqrt( to_double(v1.squared_length()) )));
+    v2 = scale_functor(v2, FT(1.0 / CGAL::sqrt( to_double(v2.squared_length()) )));
+
+    std::vector<std::pair<double, double> > ray_distances;
+    ray_distances.reserve(disk_samples.size());
+
+    const FT normal_multiplier( cos(cone_angle / 2.0) );
+    const FT disk_multiplier  ( sin(cone_angle / 2.0) );
+
+    const Vector& scaled_normal = scale_functor(normal, normal_multiplier);
+
+    for(Disk_samples_list::const_iterator sample_it = disk_samples.begin();
+        sample_it != disk_samples.end(); ++sample_it) {
+      bool is_intersected, intersection_is_acute;
+      double min_distance;
+      Primitive_id closest_id;
+
+      Vector disk_vector = sum_functor(
+                             scale_functor(v1, FT(disk_multiplier * sample_it->get<0>())),
+                             scale_functor(v2, FT(disk_multiplier * sample_it->get<1>())) );
+      Vector ray_direction = sum_functor(scaled_normal, disk_vector);
+
+      if(use_diagonal) {
+        FT max_distance( max_diagonal / std::sqrt(to_double(
+                           ray_direction.squared_length())));
+        const Vector scaled_direction = scale_functor(ray_direction, max_distance);
+        const Vector target_vector = sum_functor( Vector(Point(ORIGIN), center),
+                                     scaled_direction);
+        const Point  target_point = translated_point_functor(Point(ORIGIN),
+                                    target_vector);
+        Segment segment(center, target_point);
+
+        if(traits.is_degenerate_3_object()(segment)) {
+          CGAL_warning(false &&
+                       "A degenerate segment is constructed. Most probable reason is using CGAL_PI as cone_angle parameter and also picking center of disk as a sample.");
+        }
+
+        boost::tie(is_intersected, intersection_is_acute, min_distance, closest_id)
+          = cast_and_return_minimum(segment, skip, accept_if_acute);
+      } else {
+        Ray ray(center, ray_direction);
+
+        if(traits.is_degenerate_3_object()(ray)) {
+          CGAL_warning(false &&
+                       "A degenerate ray is constructed. Most probable reason is using CGAL_PI as cone_angle parameter and also picking center of disk as a sample.");
+        }
+
+        boost::tie(is_intersected, intersection_is_acute, min_distance, closest_id)
+          = ray_casting(ray, skip, accept_if_acute);
+      }
+
+      if(!intersection_is_acute) {
+        continue;
+      }
+
+      visitor(closest_id, min_distance);
+
+      ray_distances.push_back(std::make_pair(min_distance, sample_it->get<2>()));
+    }
+
+    if(ray_distances.empty()) {
+      return boost::none;
+    }
+
+    return boost::optional<double>(remove_outliers_and_calculate_sdf_value(
+                                     ray_distances));
+  }
+
+  /**
+   * Finds closest distance to center using `closest_point` query on AABB.
+   * @return squared distance
+   */
+  double find_closest_with_AABB_distance(Point center) const {
+    Point closest = tree.closest_point(center);
+    return (closest - center).squared_length();
+  }
+private:
+  /**
+   * Calculates SDF value for parameter @a facet.
+   * @param facet
+   * @param tree AABB tree which is built from polyhedron
+   * @param samples sampled points from a unit-disk which are corresponds to rays picked from cone
+   * @return calculated SDF value
+   */
+  boost::optional<double> calculate_sdf_value_of_facet(
+    face_handle facet,
+    double cone_angle,
+    bool accept_if_acute,
+    const Disk_samples_list& disk_samples) const {
+    
+    const Point p1 = get(vertex_point_map,target(halfedge(facet,mesh),mesh));
+    const Point p2 = get(vertex_point_map,target(next(halfedge(facet,mesh),mesh),mesh));
+    const Point p3 = get(vertex_point_map,target(prev(halfedge(facet,mesh),mesh),mesh));
+    const Point center  = centroid_functor(p1, p2, p3);
+    Vector normal = normal_functor(p2, p1, p3);
+    normal=scale_functor(normal,
+                         FT(1.0/std::sqrt(to_double(normal.squared_length()))));
+
+    CGAL::internal::SkipPrimitiveFunctor<face_handle>
+    skip(facet);
+    CGAL::internal::FirstIntersectionVisitor<face_handle>
+    visitor;
+
+    return calculate_sdf_value_of_point(center, normal, skip, visitor, cone_angle,
+                                        accept_if_acute, disk_samples);
+  }
+
+  /**
+   * Finds closest intersection for parameter @a query.
+   * @param query `Segment` or `Ray` type query.
+   * It is now only used with `Segment` as the function `first_intersection()` is faster if rays are used
+   * @param tree AABB tree which includes polyhedron
+   * @param facet parent facet of @a query
+   * (since numerical limitations on both center calculation and intersection test, query might intersect with related facet, should be skipped in such case)
+   * @return tuple of:
+   *   - get<0> bool   : true if any intersection is found
+   *   - get<1> bool   : true if intersection is found and is acceptable (i.e. accute angle with surface normal)
+   *   - get<2> double : distance between ray/segment origin and intersection point (0.0 if get<0> is false)
+   *   - get<3> Primitive_id : closest intersected primitive if get<0> is true, else Primitive_id()
+   */
+  template <class Query, class SkipPrimitiveFunctor>
+  boost::tuple<bool, bool, double, Primitive_id> cast_and_return_minimum(
+    const Query& query, SkipPrimitiveFunctor skip, bool accept_if_acute) const {
+    boost::tuple<bool, bool, double, Primitive_id>
+    min_distance(false, false, 0.0, Primitive_id());
+
+    typedef typename Tree:: template Intersection_and_primitive_id<Query>::Type Intersection_and_primitive_id;
+    std::list<Intersection_and_primitive_id> intersections;
+
+    //SL: the difference with all_intersections is that in the traversal traits, we do do_intersect before calling intersection.
+    typedef  std::back_insert_iterator< std::list<Intersection_and_primitive_id> >
+    Output_iterator;
+    Listing_intersection_traits_ray_or_segment_triangle<typename Tree::AABB_traits,Query,Output_iterator>
+    traversal_traits(std::back_inserter(intersections), tree.traits());
+    tree.traversal(query,traversal_traits);
+
+    Vector min_i_ray(NULL_VECTOR);
+    Primitive_id min_id;
+    for(typename std::list<Intersection_and_primitive_id>::iterator op_it =
+          intersections.begin();
+        op_it != intersections.end() ; ++op_it) {
+      const typename Intersection_and_primitive_id::first_type& object = op_it->first;
+      Primitive_id id = op_it->second;
+      if( skip(id) ) {
+        continue;
+      }
+
+      const Point* i_point;
+      if(!(i_point = boost::get<Point>(&object))) {
+        continue;  // continue in case of segment.
+      }
+
+      Vector i_ray(*i_point, query.source());
+      double new_distance = to_double( i_ray.squared_length() );
+      if(!min_distance.template get<0>()
+          || new_distance < min_distance.template get<2>()) {
+        min_distance.template get<3>() = id;
+        min_distance.template get<2>() = new_distance;
+        min_distance.template get<0>() = true;
+        min_id = id;
+        min_i_ray = i_ray;
+      }
+    }
+    if(!min_distance.template get<0>()) {
+      return min_distance;
+    }
+
+    if(accept_if_acute) {
+      // check whether the ray makes acute angle with intersected facet
+      const Point& min_v1 = get(vertex_point_map,target(halfedge(min_id,mesh),mesh));
+      const Point& min_v2 = get(vertex_point_map,target(next(halfedge(min_id,mesh),mesh),mesh));
+      const Point& min_v3 = get(vertex_point_map,target(prev(halfedge(min_id,mesh),mesh),mesh));
+      Vector min_normal = scale_functor(normal_functor(min_v1, min_v2, min_v3), -1.0);
+
+      if(angle_functor(translated_point_functor(Point(ORIGIN), min_i_ray),
+                       Point(ORIGIN),
+                       translated_point_functor(Point(ORIGIN), min_normal)) != ACUTE) {
+        return min_distance;
+      }
+    }
+
+    min_distance.template get<1>() = true; // founded intersection is acceptable.
+    min_distance.template get<2>() = std::sqrt(min_distance.template get<2>());
+    return min_distance;
+  }
+
+  // function similar to `cast_and_return_minimum()` but using the function
+  // first_intersection with a Ray to get the closest intersected primitive
+  template<typename SkipFunctor>
+  boost::tuple<bool, bool, double, Primitive_id> ray_casting(
+    const Ray& query, SkipFunctor s, bool accept_if_acute) const {
+
+    const boost::optional< typename Tree::template Intersection_and_primitive_id<Ray>::Type >
+      min_intersection = tree.first_intersection(query, s);
+    if(!min_intersection)
+      return boost::make_tuple(false, false, 0.0, Primitive_id());
+
+    const Point* i_point = boost::get<Point>( &min_intersection->first );
+    if (!i_point) //segment case ignored
+      return boost::make_tuple(false, false, 0.0, Primitive_id());
+
+    Vector min_i_ray(*i_point, query.source());
+
+    boost::tuple<bool, bool, double, Primitive_id>
+    min_distance(true, false, to_double(min_i_ray.squared_length()), min_intersection->second);
+
+    const Primitive_id& min_id = min_distance.template get<3>();
+
+    if(accept_if_acute) {
+      // check whether the ray makes acute angle with intersected facet
+      const Point& min_v1 = get(vertex_point_map,target(halfedge(min_id,mesh),mesh));
+      const Point& min_v2 = get(vertex_point_map,target(next(halfedge(min_id,mesh),mesh),mesh));
+      const Point& min_v3 = get(vertex_point_map,target(prev(halfedge(min_id,mesh),mesh),mesh));
+      Vector min_normal = scale_functor(normal_functor(min_v1, min_v2, min_v3), -1.0);
+
+      if(angle_functor(translated_point_functor(Point(ORIGIN), min_i_ray),
+                       Point(ORIGIN),
+                       translated_point_functor(Point(ORIGIN), min_normal)) != ACUTE) {
+        return min_distance;
+      }
+    }
+
+    min_distance.template get<1>() = true; // founded intersection is acceptable.
+    min_distance.template get<2>() = std::sqrt(min_distance.template get<2>());
+
+    return min_distance;
+  }
+
+  /**
+   * Uses Median Absolute Deviation and removes rays which don't fall into `CGAL_NUMBER_OF_MAD` * MAD.
+   * Also takes weighted average of accepted rays and calculate final sdf value.
+   * @param ray_distances contains distance & weight pairs for each ray
+   * @return outlier removed and averaged sdf value
+   */
+  double remove_outliers_and_calculate_sdf_value(
+    std::vector<std::pair<double, double> >& ray_distances) const {
+    // pair first -> distance, second -> weight
+
+    const std::size_t accepted_ray_count = ray_distances.size();
+    if(accepted_ray_count == 0)      {
+      return 0.0;
+    } else if(accepted_ray_count == 1) {
+      return ray_distances[0].first;
+    }
+
+    /* Calculate median sdf */
+    const std::size_t half_ray_count = accepted_ray_count / 2;
+    std::nth_element(ray_distances.begin(), ray_distances.begin() + half_ray_count,
+                     ray_distances.end());
+    double median_sdf = ray_distances[half_ray_count].first;
+    if(accepted_ray_count % 2 == 0) {
+      median_sdf += std::max_element(ray_distances.begin(),
+                                     ray_distances.begin() + half_ray_count)->first;
+      median_sdf /= 2.0;
+    }
+
+    /* Calculate median absolute deviation */
+    std::vector<double> absolute_deviation;
+    absolute_deviation.reserve(accepted_ray_count);
+    for(std::vector<std::pair<double, double> >::iterator it =
+          ray_distances.begin(); it != ray_distances.end(); ++it) {
+      absolute_deviation.push_back(std::abs(it->first - median_sdf));
+    }
+
+    std::nth_element(absolute_deviation.begin(),
+                     absolute_deviation.begin() + half_ray_count, absolute_deviation.end());
+    double median_deviation = absolute_deviation[half_ray_count];
+    if(accepted_ray_count % 2 == 0) {
+      median_deviation += *std::max_element(absolute_deviation.begin(),
+                                            absolute_deviation.begin() + half_ray_count);
+      median_deviation /= 2.0;
+    }
+
+    /* Calculate sdf, accept rays if ray_dist - median < (median_deviation * Factor) */
+    double total_weights = 0.0, total_distance = 0.0;
+    for(std::vector<std::pair<double, double> >::iterator it =
+          ray_distances.begin(); it != ray_distances.end(); ++it) {
+      if(std::abs(it->first - median_sdf) > (median_deviation * CGAL_NUMBER_OF_MAD)) {
+        continue;
+      }
+      total_distance += it->first * it->second;
+      total_weights += it->second;
+    }
+
+    if(total_distance == 0.0) {
+      return median_sdf;  // no ray is accepted, return median.
+    } else                      {
+      return total_distance / total_weights;
+    }
+  }
+};
+}//namespace internal
+/// @endcond
+}//namespace CGAL
+#undef CGAL_NUMBER_OF_MAD
+
+#endif //CGAL_SURFACE_MESH_SEGMENTATION_SDF_CALCULATION_H
diff --git a/3rdparty/CGAL/include/CGAL/internal/Surface_mesh_segmentation/Surface_mesh_segmentation.h b/3rdparty/CGAL/include/CGAL/internal/Surface_mesh_segmentation/Surface_mesh_segmentation.h
new file mode 100644
index 0000000..b6273d4
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/internal/Surface_mesh_segmentation/Surface_mesh_segmentation.h
@@ -0,0 +1,548 @@
+#ifndef CGAL_SURFACE_MESH_SEGMENTATION_H
+// Copyright (c) 2014  GeometryFactory Sarl (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
+// 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.
+
+
+#define CGAL_SURFACE_MESH_SEGMENTATION_H
+
+#include <CGAL/internal/Surface_mesh_segmentation/Expectation_maximization.h>
+#include <CGAL/internal/Surface_mesh_segmentation/Filters.h>
+#include <CGAL/internal/Surface_mesh_segmentation/Alpha_expansion_graph_cut.h>
+#include <CGAL/internal/Surface_mesh_segmentation/SDF_calculation.h>
+
+#include <CGAL/Mesh_3/dihedral_angle_3.h>
+
+#include <CGAL/property_map.h>
+
+#include <cmath>
+#include <vector>
+#include <algorithm>
+#include <utility>
+#include <map>
+
+#define CGAL_NORMALIZATION_ALPHA 5.0
+#define CGAL_CONVEX_FACTOR 0.08
+#define CGAL_SMOOTHING_LAMBDA_MULTIPLIER 100.0
+
+namespace CGAL
+{
+/// @cond CGAL_DOCUMENT_INTERNAL
+namespace internal
+{
+
+// Post-process functions for sdf values
+template<class Polyhedron>
+class Postprocess_sdf_values
+{
+  typedef typename boost::graph_traits<Polyhedron>::face_descriptor   face_descriptor;
+  typedef typename boost::graph_traits<Polyhedron>::face_iterator face_iterator;
+
+  typedef Bilateral_filtering<Polyhedron>           Default_filter;
+
+public:
+
+  template <class Filter, class SDFPropertyMap>
+  std::pair<double, double>
+  postprocess(const Polyhedron& mesh, SDFPropertyMap sdf_pmap) {
+    check_missing_sdf_values(mesh, sdf_pmap);
+    Filter()(mesh, get_window_size(mesh), sdf_pmap);
+    return linear_normalize_sdf_values(mesh, sdf_pmap);
+  }
+
+  template <class SDFPropertyMap>
+  std::pair<double, double>
+  postprocess(const Polyhedron& mesh, SDFPropertyMap sdf_pmap) {
+    return postprocess<Default_filter>(mesh, sdf_pmap);
+  }
+
+  /**
+   * Finds facets which have missing (indicated by -1) sdf values.
+   * Sdf values on these facets are assigned to average sdf value of its neighbors.
+   * If still there is any facet which has no sdf value, assigns minimum sdf value to it.
+   * This is meaningful since (being an outlier) zero sdf values might effect normalization & log extremely.
+   * @param[in, out] sdf_values `ReadWritePropertyMap` with `Polyhedron::face_descriptor` as key and `double` as value type
+   */
+  template<class SDFPropertyMap>
+  void check_missing_sdf_values(const Polyhedron& mesh,
+                                SDFPropertyMap sdf_values) {
+    std::vector<face_descriptor> still_missing_facets;
+    double min_sdf = (std::numeric_limits<double>::max)();
+    // If there is any facet which has no sdf value, assign average sdf value of its neighbors
+    face_iterator facet_it, fend;
+    for(boost::tie(facet_it,fend) = faces(mesh);
+        facet_it != fend; ++facet_it) {
+      double sdf_value = sdf_values[*facet_it];
+      CGAL_assertion(sdf_value == -1 || sdf_value >= 0); // validity check
+      if(sdf_value != -1.0) {
+        min_sdf = (std::min)(sdf_value, min_sdf);
+        continue;
+      }
+
+      Halfedge_around_face_circulator<Polyhedron> facet_circulator(halfedge(*facet_it,mesh),mesh), done(facet_circulator);
+
+      double total_neighbor_sdf = 0.0;
+      std::size_t nb_valid_neighbors = 0;
+      do {
+        if(!(face(opposite(*facet_circulator,mesh),mesh) == boost::graph_traits<Polyhedron>::null_face())) {
+            double neighbor_sdf = sdf_values[face(opposite(*facet_circulator,mesh),mesh)];
+          if(neighbor_sdf != -1) {
+            total_neighbor_sdf += neighbor_sdf;
+            ++nb_valid_neighbors;
+          }
+        }
+      } while( ++facet_circulator != done);
+
+      if(nb_valid_neighbors == 0) {
+        still_missing_facets.push_back(*facet_it);
+      } else {
+        sdf_value = total_neighbor_sdf / nb_valid_neighbors;
+        sdf_values[*facet_it] = sdf_value;
+        // trying to update min_sdf is pointless, since it is interpolated one of the neighbors sdf will be smaller than it
+      }
+    }
+    // If still there is any facet which has no sdf value, assign minimum sdf value.
+    // This is meaningful since (being an outlier) 0 sdf values might effect normalization & log extremely.
+    for(typename std::vector<face_descriptor>::iterator it =
+          still_missing_facets.begin();
+        it != still_missing_facets.end(); ++it) {
+      sdf_values[*it] = min_sdf;
+    }
+  }
+
+  template<class SDFPropertyMap>
+  std::pair<double, double> min_max_value(const Polyhedron& mesh,
+                                          SDFPropertyMap sdf_values) {
+    double min_sdf = (std::numeric_limits<double>::max)();
+    double max_sdf = -min_sdf;
+    face_iterator facet_it, fend;
+    for(boost::tie(facet_it,fend) = faces(mesh);
+        facet_it != fend; ++facet_it) {
+      double sdf_value = sdf_values[*facet_it];
+      max_sdf = (std::max)(sdf_value, max_sdf);
+      min_sdf = (std::min)(sdf_value, min_sdf);
+    }
+    return std::make_pair(min_sdf, max_sdf);
+  }
+  /**
+   * Normalize sdf values between [0-1].
+   * @param sdf_values `ReadWritePropertyMap` with `Polyhedron::face_descriptor` as key and `double` as value type
+   * @return minimum and maximum SDF values before normalization
+   */
+  template<class SDFPropertyMap>
+  std::pair<double, double> linear_normalize_sdf_values(const Polyhedron& mesh,
+      SDFPropertyMap sdf_values) {
+    double min_sdf, max_sdf;
+    boost::tie(min_sdf, max_sdf) = min_max_value(mesh, sdf_values);
+
+    if(min_sdf == max_sdf) {
+      CGAL_warning(min_sdf == max_sdf && !"Linear normalization is not applicable!");
+      return std::make_pair(min_sdf, max_sdf);
+    }
+
+    const double max_min_dif = max_sdf - min_sdf;
+    face_iterator facet_it, fend;
+    for(boost::tie(facet_it,fend) = faces(mesh);
+        facet_it != fend; ++facet_it) {
+      sdf_values[*facet_it] = (sdf_values[*facet_it] - min_sdf) / max_min_dif;
+    }
+    return std::make_pair(min_sdf, max_sdf);
+  }
+
+  /**
+   * Simple window-size determination function for smoothing.
+   * It is proportional to square root of size of facets in polyhedron.
+   * @return size of the window
+   *  - 0-2000     -> 1
+   *  - 2000-8000  -> 2
+   *  - 8000-18000 -> 3
+   *  - ...
+   */
+  std::size_t get_window_size(const Polyhedron& mesh) {
+    double facet_sqrt = std::sqrt(num_faces(mesh) / 2000.0);
+    return static_cast<std::size_t>(facet_sqrt) + 1;
+  }
+};
+
+/**
+ * @brief Main entry point for mesh segmentation algorithm.
+ *
+ * It is a connector class which uses:
+ *   -  SDF_calculation for calculating sdf values
+ *   -  Expectation_maximization for soft clustering
+ *   -  An implementation of alpha-expansion graph cut for hard clustering
+ *
+ * Other than being a connector, it is also responsible for pre-process and postprocess on intermediate data, which are:
+ *   - log-normalizing probabilities received from soft clustering
+ *   - log-normalizing and calculating dihedral-angle based weights for edges
+ *   - smoothing and log-normalizing sdf values received from sdf calculation (Filters.h)
+ *   - assigning segment-id for each facet after hard clustering
+ *
+ * @tparam Polyhedron a CGAL polyhedron
+ * @tparam GeomTraits a model of SegmentationGeomTraits
+ * @tparam GraphCut chosen graph-cut implementation from Alpha_expansion_graph_cut.h
+ * @tparam Filter chosen filtering method from Filters.h
+ */
+template <
+class Polyhedron,
+      class GeomTraits,
+  class VertexPointPmap,
+      bool fast_bbox_intersection = true,
+#ifndef CGAL_DO_NOT_USE_BOYKOV_KOLMOGOROV_MAXFLOW_SOFTWARE
+      class GraphCut = Alpha_expansion_graph_cut_boykov_kolmogorov,
+#else
+      class GraphCut = Alpha_expansion_graph_cut_boost,
+#endif
+      class Filter = Bilateral_filtering<Polyhedron>
+      >
+class Surface_mesh_segmentation
+{
+//type definitions
+public:
+  typedef typename boost::graph_traits<Polyhedron>::face_descriptor      face_descriptor;
+
+private:
+  //typedef typename Polyhedron::Traits Kernel;
+  typedef typename GeomTraits::Point_3 Point;
+
+  typedef typename boost::graph_traits<Polyhedron>::edge_iterator     edge_iterator;
+  typedef typename boost::graph_traits<Polyhedron>::halfedge_descriptor  halfedge_descriptor;
+  typedef typename boost::graph_traits<Polyhedron>::halfedge_iterator halfedge_iterator;
+  typedef typename boost::graph_traits<Polyhedron>::face_iterator    face_iterator;
+  typedef typename boost::graph_traits<Polyhedron>::vertex_iterator   vertex_iterator;
+
+  typedef SDF_calculation<Polyhedron, VertexPointPmap, GeomTraits, fast_bbox_intersection>
+  SDF_calculation_class;
+
+// member variables
+private:
+  const Polyhedron& mesh;
+  GeomTraits traits;
+  VertexPointPmap vertex_point_pmap;
+// member functions
+public:
+  /**
+   * @pre @a polyhedron.is_pure_triangle()
+   * @param mesh `CGAL Polyhedron` on which other functions operate.
+   */
+  Surface_mesh_segmentation(const Polyhedron& mesh, GeomTraits traits, VertexPointPmap vertex_point_pmap)
+    : mesh(mesh), traits(traits), vertex_point_pmap(vertex_point_pmap) {
+    //    CGAL_precondition(is_pure_triangle(mesh));
+  }
+
+// Use these two functions together
+  template <class SDFPropertyMap>
+  std::pair<double, double>
+  calculate_sdf_values(double cone_angle, std::size_t number_of_rays,
+                       SDFPropertyMap sdf_pmap, bool postprocess_req) {
+    // calculate sdf values
+    SDF_calculation_class sdf_calculator(mesh, vertex_point_pmap,
+                                         false, /* build_kd_ree */
+                                         true, /* use_diagonal --> set to false to use `AABB_tree::first_intersection()` */
+                                         traits);
+    sdf_calculator.calculate_sdf_values(faces(mesh).first, faces(mesh).second,
+                                        cone_angle, number_of_rays, sdf_pmap);
+
+    Postprocess_sdf_values<Polyhedron> p;
+    return postprocess_req ? p.template postprocess<Filter>(mesh,
+           sdf_pmap) : // return minimum and maximum sdf values before normalization
+           p.min_max_value(mesh, sdf_pmap);
+  }
+
+  template <class FacetSegmentMap, class SDFPropertyMap>
+  std::size_t partition(std::size_t number_of_centers, double smoothing_lambda,
+                        SDFPropertyMap sdf_pmap, FacetSegmentMap segment_pmap,
+                        bool clusters_to_segments) {
+    smoothing_lambda = (std::max)(0.0, smoothing_lambda); // min zero
+    smoothing_lambda *=
+      CGAL_SMOOTHING_LAMBDA_MULTIPLIER; // scale it into meaningful range for graph-cut
+
+    // log normalize sdf values
+    std::vector<double> sdf_values;
+    log_normalize_sdf_values(sdf_pmap, sdf_values);
+
+    // soft clustering using GMM-fitting initialized with k-means
+    Expectation_maximization fitter(number_of_centers, sdf_values,
+                                    Expectation_maximization::K_MEANS_INITIALIZATION, 1);
+
+    std::vector<std::size_t> labels;
+    fitter.fill_with_center_ids(labels);
+
+    std::vector<std::vector<double> > probability_matrix;
+    fitter.fill_with_probabilities(probability_matrix);
+    log_normalize_probability_matrix(probability_matrix);
+
+    // calculating edge weights
+    std::vector<std::pair<std::size_t, std::size_t> > edges;
+    std::vector<double> edge_weights;
+    calculate_and_log_normalize_dihedral_angles(smoothing_lambda, edges,
+        edge_weights);
+
+    // apply graph cut
+    GraphCut()(edges, edge_weights, probability_matrix, labels);
+    std::vector<std::size_t>::iterator label_it = labels.begin();
+    face_iterator facet_it, fend;
+    for(boost::tie(facet_it,fend) = faces(mesh);
+        facet_it != fend;
+        ++facet_it, ++label_it) {
+      segment_pmap[*facet_it] = *label_it; // fill with cluster-ids
+    }
+    if(clusters_to_segments) {
+      // assign a segment id for each facet
+      std::size_t number_of_segments = assign_segments(number_of_centers, sdf_pmap,
+                                       segment_pmap);
+      return number_of_segments;
+    }
+    return number_of_centers;
+  }
+
+private:
+
+  /**
+   * Calculates dihedral angle between facets and normalize them between [0-1] from [0 - 2*pi].
+   * Also convex dihedral angles are multiplied by a factor smaller than 1.0 which reduces their effect in graph-cut.
+   * @pre parameter @a edge should not be a border.
+   * @param edge whose dihedral angle is computed using incident facets
+   * @return computed dihedral angle
+   */
+  double calculate_dihedral_angle_of_edge(halfedge_descriptor edge) const {
+
+    CGAL_precondition( (! (face(edge,mesh)==boost::graph_traits<Polyhedron>::null_face()))
+                       && (! (face(opposite(edge,mesh),mesh)==boost::graph_traits<Polyhedron>::null_face())) );
+    const Point a = get(vertex_point_pmap,target(edge,mesh));
+    const Point b = get(vertex_point_pmap,target(prev(edge,mesh),mesh));
+    const Point c = get(vertex_point_pmap,target(next(edge,mesh),mesh));
+    const Point d = get(vertex_point_pmap,target(next(opposite(edge,mesh),mesh),mesh));
+    // As far as I check: if, say, dihedral angle is 5, this returns 175,
+    // if dihedral angle is -5, this returns -175.
+    // Another words this function returns angle between planes.
+    double n_angle = to_double( ::CGAL::Mesh_3::dihedral_angle(a, b, c, d) );
+    n_angle /= 180.0;
+    bool concave = n_angle > 0;
+    double angle = 1 + ((concave ? -1 : +1) * n_angle);
+
+    if(!concave) {
+      angle *= CGAL_CONVEX_FACTOR;
+    }
+    return angle;
+  }
+
+  /**
+   * Normalize sdf values using function:
+   * normalized_sdf = log( alpha * ( current_sdf - min_sdf ) / ( max_sdf - min_sdf ) + 1 ) / log( alpha + 1 )
+   * @param sdf_values `ReadablePropertyMap` with `Polyhedron::face_descriptor` as key and `double` as value type
+   * @param[out] normalized_sdf_values normalized values stored in facet iteration order
+   * Important note: @a sdf_values parameter should contain linearly normalized values between [0-1]
+   */
+  template<class SDFPropertyMap>
+  void log_normalize_sdf_values(SDFPropertyMap sdf_values,
+                                std::vector<double>& normalized_sdf_values) {
+    normalized_sdf_values.reserve(num_faces(mesh));
+    face_iterator facet_it, fend;
+    for(boost::tie(facet_it,fend) = faces(mesh);
+        facet_it != fend; ++facet_it) {
+      double log_normalized = log(sdf_values[*facet_it] * CGAL_NORMALIZATION_ALPHA +
+                                  1) / log(CGAL_NORMALIZATION_ALPHA + 1);
+      normalized_sdf_values.push_back(log_normalized);
+    }
+  }
+
+  /**
+   * Receives probability-matrix with probabilities between [0-1], and returns log-normalized probabilities
+   * which are suitable to use in graph-cut.
+   * @param[in, out] probabilities probability matrix in [center][facet] order
+   */
+  void log_normalize_probability_matrix(std::vector<std::vector<double> >&
+                                        probabilities) const {
+    const double epsilon = 5e-6;
+    for(std::vector<std::vector<double> >::iterator it_i = probabilities.begin();
+        it_i != probabilities.end(); ++it_i) {
+      for(std::vector<double>::iterator it = it_i->begin(); it != it_i->end(); ++it) {
+        double probability = (std::max)(*it,
+                                        epsilon); // give every facet a little probability to be in any cluster
+        probability = -log(probability);
+        *it = (std::max)(probability, std::numeric_limits<double>::epsilon());
+        // zero values are not accepted in max-flow as weights for edges which connects some vertex with Source or Sink (in boost::boykov..)
+      }
+    }
+  }
+
+  /**
+   * Calculates dihedral-angle based weight for each edge which is not a border edge.
+   * @param smoothing_lambda a factor for each weight (weight *= smoothing_lambda).
+   * @param[out] edges list of pair of neighbor facet ids
+   * @param[out] edge_weights calculated weight for each edge in @a edges
+   */
+  void calculate_and_log_normalize_dihedral_angles(double smoothing_lambda,
+      std::vector<std::pair<std::size_t, std::size_t> >& a_edges,
+      std::vector<double>& edge_weights) const {
+    // associate each facet with an id
+    // important note: ids should be compatible with iteration order of facets:
+    // [0 <- facet_begin(),...., size_of_facets() -1 <- facet_end()]
+    // Why ? it is send to graph cut algorithm where other data associated with facets are also sorted according to iteration order.
+    std::map<face_descriptor, std::size_t> facet_index_map;
+    std::size_t facet_index = 0;
+    face_iterator facet_it, fend;
+    for(boost::tie(facet_it,fend) = faces(mesh);
+        facet_it != fend;
+        ++facet_it, ++facet_index) {
+      facet_index_map[*facet_it] = facet_index;
+    }
+
+    const double epsilon = 5e-6;
+    // edges and their weights. pair<std::size_t, std::size_t> stores facet-id pairs (see above) (may be using boost::tuple can be more suitable)
+    edge_iterator edge_it, eend;
+    for(boost::tie(edge_it,eend) = edges(mesh);
+        edge_it != eend; ++edge_it) {
+      halfedge_descriptor hd = halfedge(*edge_it,mesh);
+      halfedge_descriptor ohd = opposite(hd,mesh);
+      if((face(hd,mesh)==boost::graph_traits<Polyhedron>::null_face())
+         || (face(ohd,mesh)==boost::graph_traits<Polyhedron>::null_face()))  {
+        continue;  // if edge does not contain two neighbor facets then do not include it in graph-cut
+      }
+      const std::size_t index_f1 = facet_index_map[face(hd,mesh)];
+      const std::size_t index_f2 = facet_index_map[face(ohd,mesh)];
+      a_edges.push_back(std::make_pair(index_f1, index_f2));
+
+      double angle = calculate_dihedral_angle_of_edge(hd);
+
+      angle = (std::max)(angle, epsilon);
+      angle = -log(angle);
+      angle *= smoothing_lambda;
+
+      edge_weights.push_back(angle);
+    }
+  }
+
+  template<class Pair>
+  struct Sort_pairs_with_second {
+    bool operator() (const Pair& pair_1, const Pair& pair_2) const {
+      return pair_1.second < pair_2.second;
+    }
+  };
+
+/////////////////////////////////////
+//  0 0 1 1 0 0      0 0 2 2 4 4   //
+//  0 0 1 1 0 0      0 0 2 2 4 4   //
+//  1 0 2 2 1 1  ->  1 0 3 3 5 5   //
+//  1 0 2 2 1 1      1 0 3 3 5 5   //
+//  cluster-ids  ->  segment-ids   //
+  /**
+   * Definitions:
+   *   -Cluster is a set of facet which can be connected or disconnected.
+   *   -Segment is a connected set of facets which are placed under same cluster (after graph-cut).
+   * Function takes a map which contains a cluster-id per facet. It then fills the map with segment-ids by giving a unique id to each
+   * set of connected facets which are placed under same cluster. Note that returned segment-ids are ordered by average sdf value of segment ascen.
+   *
+   * @param number_of_clusters cluster-ids in @a segments should be between [0, number_of_clusters -1]
+   * @param sdf_values `ReadablePropertyMap` with `Polyhedron::face_descriptor` as key and `double` as value type
+   * @param[in, out] segments `ReadWritePropertyMap` with `Polyhedron::face_descriptor` as key and `std::size_t` as value type.
+   * @return number of segments
+   */
+  template<class SegmentPropertyMap, class SDFProperyMap>
+  std::size_t assign_segments(std::size_t number_of_clusters,
+                              SDFProperyMap sdf_values, SegmentPropertyMap segments) {
+    // assign a segment-id to each facet
+    std::size_t segment_id = number_of_clusters;
+    std::vector<std::pair<std::size_t, double> > segments_with_average_sdf_values;
+    face_iterator facet_it, fend;
+    for(boost::tie(facet_it,fend) = faces(mesh);
+        facet_it != fend; ++facet_it) {
+      if(segments[*facet_it] <
+          number_of_clusters) { // not visited by depth_first_traversal
+        double average_sdf_value = breadth_first_traversal(*facet_it, segment_id,
+                                   sdf_values, segments);
+
+        segments_with_average_sdf_values.push_back(std::make_pair(segment_id,
+            average_sdf_value));
+        ++segment_id;
+      }
+    }
+    // sort segments according to their average sdf value
+    sort(segments_with_average_sdf_values.begin(),
+         segments_with_average_sdf_values.end(),
+         Sort_pairs_with_second<std::pair<std::size_t, double> >());
+    // map each segment-id to its new sorted index
+    std::vector<std::size_t> segment_id_to_sorted_id_map(
+      segments_with_average_sdf_values.size());
+    for(std::size_t index = 0; index < segments_with_average_sdf_values.size();
+        ++index) {
+      std::size_t segment_id = segments_with_average_sdf_values[index].first -
+                               number_of_clusters;
+      segment_id_to_sorted_id_map[segment_id] = index;
+    }
+    // make one-pass on facets. First make segment-id zero based by subtracting number_of_clusters
+    //                        . Then place its sorted index to pmap
+    for(boost::tie(facet_it,fend) = faces(mesh);
+        facet_it != fend; ++facet_it) {
+      std::size_t segment_id = segments[*facet_it] - number_of_clusters;
+      segments[*facet_it] = segment_id_to_sorted_id_map[segment_id];
+    }
+    return segment_id - number_of_clusters;
+  }
+
+  /**
+   * Breadth-first traverse all connected facets which has same cluster with @a facet.
+   * Each visited facet assigned to @a segment_id.
+   * @param facet root facet
+   * @param segment_id segment-id of root facet
+   * @param sdf_values `ReadablePropertyMap` with `Polyhedron::face_descriptor` as key and `double` as value type
+   * @param[in, out] segments `ReadWritePropertyMap` with `Polyhedron::face_descriptor` as key and `std::size_t` as value type.
+   * @return average sdf value for segment
+   */
+  template<class SegmentPropertyMap, class SDFProperyMap>
+  double
+  breadth_first_traversal(face_descriptor root, std::size_t segment_id,
+                          SDFProperyMap sdf_values, SegmentPropertyMap segments) {
+    std::queue<face_descriptor> facet_queue;
+    facet_queue.push(root);
+
+    std::size_t prev_segment_id = segments[root];
+    segments[root] = segment_id;
+
+    double total_sdf_value = sdf_values[root];
+    std::size_t    visited_facet_count = 1;
+
+    while(!facet_queue.empty()) {
+      face_descriptor facet = facet_queue.front();
+
+      Halfedge_around_face_circulator<Polyhedron> facet_circulator(halfedge(facet,mesh),mesh), done(facet_circulator);
+      do {
+        if(face(opposite(*facet_circulator,mesh),mesh)==boost::graph_traits<Polyhedron>::null_face()) {
+          continue;  // no facet to traversal
+        }
+        face_descriptor neighbor = face(opposite(*facet_circulator,mesh),mesh);
+        if(prev_segment_id == segments[neighbor]) {
+          segments[neighbor] = segment_id;
+          facet_queue.push(neighbor);
+
+          total_sdf_value += sdf_values[neighbor];
+          ++visited_facet_count;
+        }
+      } while( ++facet_circulator != done);
+
+      facet_queue.pop();
+    }
+
+    return total_sdf_value / visited_facet_count;
+  }
+
+};
+}//namespace internal
+/// @endcond
+} //namespace CGAL
+
+#undef CGAL_NORMALIZATION_ALPHA
+#undef CGAL_CONVEX_FACTOR
+#undef CGAL_SMOOTHING_LAMBDA_MULTIPLIER
+#endif //CGAL_SURFACE_MESH_SEGMENTATION_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Surface_mesh_skeletonization/Curve_skeleton.h b/3rdparty/CGAL/include/CGAL/internal/Surface_mesh_skeletonization/Curve_skeleton.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Surface_mesh_skeletonization/Curve_skeleton.h
rename to 3rdparty/CGAL/include/CGAL/internal/Surface_mesh_skeletonization/Curve_skeleton.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Surface_mesh_skeletonization/Debug.h b/3rdparty/CGAL/include/CGAL/internal/Surface_mesh_skeletonization/Debug.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Surface_mesh_skeletonization/Debug.h
rename to 3rdparty/CGAL/include/CGAL/internal/Surface_mesh_skeletonization/Debug.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Surface_mesh_skeletonization/Detect_degeneracy.h b/3rdparty/CGAL/include/CGAL/internal/Surface_mesh_skeletonization/Detect_degeneracy.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Surface_mesh_skeletonization/Detect_degeneracy.h
rename to 3rdparty/CGAL/include/CGAL/internal/Surface_mesh_skeletonization/Detect_degeneracy.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Transform_coordinates_traits_3.h b/3rdparty/CGAL/include/CGAL/internal/Transform_coordinates_traits_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Transform_coordinates_traits_3.h
rename to 3rdparty/CGAL/include/CGAL/internal/Transform_coordinates_traits_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Triangulation/Dummy_TDS.h b/3rdparty/CGAL/include/CGAL/internal/Triangulation/Dummy_TDS.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Triangulation/Dummy_TDS.h
rename to 3rdparty/CGAL/include/CGAL/internal/Triangulation/Dummy_TDS.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Triangulation/Triangulation_ds_iterators.h b/3rdparty/CGAL/include/CGAL/internal/Triangulation/Triangulation_ds_iterators.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Triangulation/Triangulation_ds_iterators.h
rename to 3rdparty/CGAL/include/CGAL/internal/Triangulation/Triangulation_ds_iterators.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Triangulation/utilities.h b/3rdparty/CGAL/include/CGAL/internal/Triangulation/utilities.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Triangulation/utilities.h
rename to 3rdparty/CGAL/include/CGAL/internal/Triangulation/utilities.h
diff --git a/3rdparty/CGAL/include/CGAL/internal/Triangulation_2_filtered_projection_traits_3.h b/3rdparty/CGAL/include/CGAL/internal/Triangulation_2_filtered_projection_traits_3.h
new file mode 100644
index 0000000..054bd6b
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/internal/Triangulation_2_filtered_projection_traits_3.h
@@ -0,0 +1,85 @@
+ // Copyright (c) 2009  GeometryFactory (France)
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Laurent Rineau
+
+
+#ifndef CGAL_INTERNAL_TRIANGULATION_2_FILTERED_PROJECTION_TRAITS_3_H
+#define CGAL_INTERNAL_TRIANGULATION_2_FILTERED_PROJECTION_TRAITS_3_H
+
+#include <CGAL/internal/Triangulation_2_projection_traits_base_3.h>
+#include <CGAL/Filtered_predicate.h>
+
+namespace CGAL {
+
+template < class Filtered_kernel >
+class Triangulation_2_filtered_projection_traits_3
+  : public Triangulation_2_projection_traits_base_3<Filtered_kernel>
+{
+  typedef Filtered_kernel K;
+  typedef Triangulation_2_filtered_projection_traits_3<K> Self;
+  typedef Triangulation_2_projection_traits_base_3<K> Base;
+
+  typedef typename K::Exact_kernel Exact_kernel;
+  typedef typename K::Approximate_kernel Approximate_kernel;
+  typedef typename K::C2E C2E;
+  typedef typename K::C2F C2F;
+
+public:
+  typedef Triangulation_2_projection_traits_base_3<Exact_kernel> Exact_traits;
+  typedef Triangulation_2_projection_traits_base_3<Approximate_kernel> Filtering_traits;
+
+public:
+  explicit Triangulation_2_filtered_projection_traits_3(const typename K::Vector_3& n)
+    : Base(n)
+  {
+  }
+
+#define CGAL_TRIANGULATION_2_PROJ_TRAITS_FILTER_PRED(P, Pf, ACCESSOR)    \
+  typedef  Filtered_predicate< \
+    typename Exact_traits::P, \
+    typename Filtering_traits::P, \
+    C2E, \
+    C2F > P; \
+  P Pf() const { \
+    return P(this->ACCESSOR()); \
+  }
+  CGAL_TRIANGULATION_2_PROJ_TRAITS_FILTER_PRED(Orientation_2,
+                                               orientation_2_object,
+                                               normal)
+  CGAL_TRIANGULATION_2_PROJ_TRAITS_FILTER_PRED(Side_of_oriented_circle_2,
+                                               side_of_oriented_circle_2_object,
+                                               normal)
+  CGAL_TRIANGULATION_2_PROJ_TRAITS_FILTER_PRED(Less_x_2,
+					       less_x_2_object,
+					       base1)
+  CGAL_TRIANGULATION_2_PROJ_TRAITS_FILTER_PRED(Less_y_2,
+					       less_y_2_object,
+					       base2)
+  CGAL_TRIANGULATION_2_PROJ_TRAITS_FILTER_PRED(Compare_x_2,
+					       compare_x_2_object,
+					       base1)
+  CGAL_TRIANGULATION_2_PROJ_TRAITS_FILTER_PRED(Compare_y_2,
+					       compare_y_2_object,
+					       base2)
+}; // end class Triangulation_2_projection_traits_base_3<Filtered_kernel>
+
+} // end namespace CGAL
+
+
+#endif // CGAL_INTERNAL_TRIANGULATION_2_FILTERED_PROJECTION_TRAITS_3_H
diff --git a/3rdparty/CGAL/include/CGAL/internal/Triangulation_2_projection_traits_base_3.h b/3rdparty/CGAL/include/CGAL/internal/Triangulation_2_projection_traits_base_3.h
new file mode 100644
index 0000000..903c5df
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/internal/Triangulation_2_projection_traits_base_3.h
@@ -0,0 +1,486 @@
+// Copyright (c) 2009  GeometryFactory (France)
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Laurent Rineau
+
+
+#ifndef CGAL_INTERNAL_TRIANGULATION_2_PROJECTION_TRAITS_BASE_3_H
+#define CGAL_INTERNAL_TRIANGULATION_2_PROJECTION_TRAITS_BASE_3_H
+
+#include <CGAL/Profile_timer.h>
+#include <CGAL/intersections.h>
+
+namespace CGAL {
+
+namespace TriangulationProjectionTraitsCartesianFunctors {
+
+template <class Traits>
+class Projected_orientation_with_normal_3
+{
+  // private members
+  const typename Traits::Vector_3 normal;
+
+  // private type aliases
+  typedef typename Traits::K K;
+  typedef typename Traits::Point_2 Point;
+  typedef typename Traits::Vector_3 Vector_3;
+public:
+  typedef typename K::Orientation Orientation;
+  typedef Orientation result_type;
+
+  Projected_orientation_with_normal_3(const Vector_3& normal_)
+    : normal(normal_)
+  {
+    CGAL_PROFILER("Construct Projected_orientation_with_normal_3.")
+    CGAL_TIME_PROFILER("Construct Projected_orientation_with_normal_3")
+  }
+
+  Orientation operator()(const Point& p,
+			 const Point& q,
+			 const Point& r) const
+  {
+    CGAL_PROFILER("Projected_orientation_with_normal_3::operator()");
+    CGAL_TIME_PROFILER("Projected_orientation_with_normal_3::operator()");
+    return orientation(q-p, r-p, normal);
+  }
+}; // end class Projected_orientation_with_normal_3<Traits>
+
+template <class Traits>
+class Projected_side_of_oriented_circle_with_normal_3
+{
+  // private members
+  const typename Traits::Vector_3 normal;
+
+  // private types aliases
+  typedef typename Traits::K K;
+  typedef typename Traits::Point_2 Point;
+  typedef typename Traits::Vector_3 Vector_3;
+  typedef typename Traits::FT FT;
+
+  typedef Projected_side_of_oriented_circle_with_normal_3<Traits> Self;
+
+public:
+  typedef typename K::Oriented_side Oriented_side;
+  typedef Oriented_side result_type;
+
+  Projected_side_of_oriented_circle_with_normal_3(const Vector_3& normal_)
+    : normal(normal_)
+  {
+    CGAL_PROFILER("Construct Projected_side_of_oriented_circle_with_normal_3.")
+    CGAL_TIME_PROFILER("Construct Projected_side_of_oriented_circle_with_normal_3.")
+  }
+
+  Oriented_side operator()(const Point& p,
+			   const Point& q,
+			   const Point& r,
+			   const Point& t) const
+  {
+    CGAL_PROFILER("Projected_side_of_oriented_circle_with_normal_3::operator()")
+    CGAL_TIME_PROFILER("Projected_side_of_oriented_circle_with_normal_3::operator()")
+    const Vector_3& u = normal;
+
+    const Vector_3 tp = p - t;
+    const Vector_3 tq = q - t;
+    const Vector_3 tr = r - t;
+
+    const FT tp2 = tp * tp;
+    const FT tq2 = tq * tq;
+    const FT tr2 = tr * tr;
+    const FT u2  =  u * u;
+
+    const FT k_p = tp * u;
+    const FT k_q = tq * u;
+    const FT k_r = tr * u;
+
+    return
+       sign_of_determinant(tp.x(), tp.y(), tp.z(), (tp2 + k_p) * u2 - k_p * k_p,
+			   tr.x(), tr.y(), tr.z(), (tr2 + k_r) * u2 - k_r * k_r,
+			   tq.x(), tq.y(), tq.z(), (tq2 + k_q) * u2 - k_q * k_q,
+                           u.x(),  u.y(),  u.z(), u2 * u2);
+    // Note that q and r have been swapped in the determinant above, to
+    // inverse its sign.
+  }
+}; // end class Projected_side_of_oriented_circle_with_normal_3
+
+template <class Traits>
+class Projected_squared_distance_with_normal_3
+{
+  // private members
+  const typename Traits::Vector_3 normal;
+
+  // private types aliases
+  typedef typename Traits::K K;
+  typedef typename Traits::Point_2 Point;
+  typedef typename Traits::Line_2 Line;
+  typedef typename Traits::Vector_3 Vector_3;
+  typedef typename Traits::FT FT;
+
+public:
+  Projected_squared_distance_with_normal_3(const Vector_3& normal_)
+    : normal(normal_)
+  {
+    CGAL_PROFILER("Construct Projected_squared_distance_with_normal_3.")
+    CGAL_TIME_PROFILER("Construct Projected_squared_distance_with_normal_3")
+  }
+
+  FT operator()(const Point& p, const Point& q)
+  {
+    return squared_distance(p, q);
+  }
+
+  FT operator()(const Line& line, const Point& p)
+  {
+    CGAL_PROFILER("Projected_squared_distance_with_normal_3::operator()")
+    CGAL_TIME_PROFILER("Projected_squared_distance_with_normal_3::operator()")
+    const Vector_3& vl = line.to_vector();
+    const Point& pl = line.point();
+    const Vector_3 v = cross_product(normal,
+                                     vl);
+    if(v == NULL_VECTOR) {
+      // den == 0 if the line is vertical
+      // In that case, the distance is the distance to the line
+      const Vector_3 w = cross_product(pl - p,
+                                       vl);
+      return (w * w) / (vl * vl);
+    }
+    else {
+      const FT det = determinant(normal,
+                                 vl,
+                                 pl - p);
+      return (det * det) / ( v * v );
+    }
+  }
+}; // end class Projected_squared_distance_with_normal_3
+
+template <class Traits>
+class Projected_intersect_3
+{
+  // private members
+  const typename Traits::Vector_3 normal;
+
+  // private types aliases
+  typedef typename Traits::K K;
+  typedef typename Traits::Point_2 Point;
+  typedef typename Traits::Line_2 Line;
+  typedef typename Traits::Segment_2 Segment;
+  typedef typename K::Plane_3 Plane_3;
+  typedef typename Traits::Vector_3 Vector_3;
+  typedef typename Traits::FT FT;
+public:
+  Projected_intersect_3(const Vector_3& normal_)
+    : normal(normal_)
+  {
+    CGAL_PROFILER("Construct Projected_intersect_3")
+    CGAL_TIME_PROFILER("Construct Projected_intersect_3")
+  }
+
+  Object operator()(const Segment& s1, const Segment& s2)
+  {
+    CGAL_PROFILER("Projected_intersect_3::operator()")
+    CGAL_TIME_PROFILER("Projected_intersect_3::operator()")
+    const Vector_3 u1 = cross_product(s1.to_vector(), normal);
+    if(u1 == NULL_VECTOR)
+      return K().intersect_3_object()(s1.supporting_line(), s2);
+
+    const Vector_3 u2 = cross_product(s2.to_vector(), normal);
+    if(u2 == NULL_VECTOR)
+      return K().intersect_3_object()(s1, s2.supporting_line());
+
+    const Plane_3 plane_1(s1.source(), u1);
+    const Plane_3 plane_2(s2.source(), u2);
+
+    Object planes_intersection = intersection(plane_1, plane_2);
+    if(planes_intersection.empty()) {
+      std::cerr << "planes_intersection is empty\n";
+      return planes_intersection;
+    }
+    if(const Line* line = object_cast<Line>(&planes_intersection))
+    {
+      const Point& pi = line->point(0);
+      if(cross_product(normal, pi - s1.source())
+         * cross_product(normal, pi - s1.target()) > FT(0)
+         ||
+         cross_product(normal, pi - s2.source())
+         * cross_product(normal, pi - s2.target()) > FT(0) )
+      {
+        // the intersection of the lines is not inside the segments
+        std::cerr << "intersection not inside\n";
+        return Object();
+      }
+      else
+      {
+        // Let the plane passing through s1.source() and with normal
+        // the cross product of s1.to_vector() and s2.to_vector(). That
+        // plane should intersect *l, now.
+        return intersection(*line, Plane_3(s1.source(),
+                                           cross_product(s1.to_vector(),
+                                                         s2.to_vector())));
+      }
+    }
+    if(object_cast<Plane_3>(&planes_intersection))
+    {
+      std::cerr << "coplanar lines\n";
+      CGAL_error();
+      return Object();
+    }
+    return Object();
+  }
+}; // end class Projected_intersect_3
+
+
+template <class Traits>
+class Less_along_axis
+{
+  // private members
+  typedef typename Traits::Vector_3 Vector_3;
+  typedef typename Traits::Point_2 Point;
+  const Vector_3 base;
+public:
+  Less_along_axis(const Vector_3& base) : base(base)
+  {
+    CGAL_PROFILER("Construct Less_along_axis")
+    CGAL_TIME_PROFILER("Construct Less_along_axis")
+  }
+
+  typedef bool result_type;
+
+  bool operator() (const Point &p, const Point &q) const {
+    return base * (p - q) < 0;
+  }
+}; // end class Less_along_axis
+
+template <class Traits>
+class Compare_along_axis
+{
+  // private members
+  typedef typename Traits::Vector_3 Vector_3;
+  typedef typename Traits::Point_2 Point;
+  const Vector_3 base;
+public:
+  Compare_along_axis(const Vector_3& base) : base(base)
+  {
+    CGAL_PROFILER("Construct Compare_along_axis")
+    CGAL_TIME_PROFILER("Construct Compare_along_axis")
+  }
+
+  typedef Comparison_result result_type;
+
+  Comparison_result operator() (const Point &p, const Point &q) const {
+    return compare(base * (p - q), 0);
+  }
+}; // end class Compare_along_axis
+
+} // end namespace TriangulationProjectionTraitsCartesianFunctors
+
+
+template < class Kernel >
+class Triangulation_2_projection_traits_base_3
+{
+  typedef Triangulation_2_projection_traits_base_3<Kernel> Self;
+
+  typename Kernel::Vector_3 n, b1, b2;
+
+public:
+  typedef typename Kernel::Vector_3 Vector_3;
+
+
+  explicit Triangulation_2_projection_traits_base_3(const Vector_3& n_)
+    : n(n_)
+  {
+    typedef typename Kernel::FT FT;
+    typedef typename Kernel::Vector_3 Vector_3;
+
+    const FT& nx = n.x();
+    const FT& ny = n.y();
+    const FT& nz = n.z();
+    if(CGAL::abs(nz) >= CGAL::abs(ny)) {
+      b1 = Vector_3(nz, 0, -nx);
+    }
+    else {
+      b1 = Vector_3(ny, -nx, 0);
+    }
+    b2 = cross_product(n, b1);
+  }
+
+  const Vector_3& normal() const
+  {
+    return n;
+  }
+
+  const Vector_3& base1() const{
+    return b1;
+  }
+
+  const Vector_3& base2() const{
+    return b2;
+  }
+
+  typedef Kernel K;
+  typedef typename K::FT          FT;
+  typedef typename K::Point_3     Point_2;
+  typedef typename K::Segment_3   Segment_2;
+  typedef typename K::Vector_3    Vector_2;
+  typedef typename K::Triangle_3  Triangle_2;
+  typedef typename K::Line_3      Line_2;
+
+  typedef typename K::Angle_3                                Angle_2;
+
+  typedef TriangulationProjectionTraitsCartesianFunctors::
+    Compare_along_axis<Self>                                 Compare_x_2;
+  typedef TriangulationProjectionTraitsCartesianFunctors::
+    Compare_along_axis<Self>                                 Compare_y_2;
+
+  typedef TriangulationProjectionTraitsCartesianFunctors::
+    Less_along_axis<Self>                                    Less_x_2;
+  typedef TriangulationProjectionTraitsCartesianFunctors::
+    Less_along_axis<Self>                                    Less_y_2;
+
+  typedef TriangulationProjectionTraitsCartesianFunctors::
+    Projected_orientation_with_normal_3<Self>                Orientation_2;
+
+  typedef TriangulationProjectionTraitsCartesianFunctors::
+    Projected_side_of_oriented_circle_with_normal_3<Self>    Side_of_oriented_circle_2;
+
+  typedef TriangulationProjectionTraitsCartesianFunctors::
+  Projected_squared_distance_with_normal_3<Self>             Compute_squared_distance_2;
+
+  typedef TriangulationProjectionTraitsCartesianFunctors::
+  Projected_intersect_3<Self>                                Intersect_2;
+
+  typedef typename K::Construct_segment_3  Construct_segment_2;
+  typedef typename K::Construct_vector_3   Construct_vector_2;
+  typedef typename K::Construct_line_3     Construct_line_2;
+  typedef typename K::Construct_triangle_3 Construct_triangle_2;
+
+  typedef typename K::Construct_scaled_vector_3     Construct_scaled_vector_2;
+  typedef typename K::Construct_translated_point_3  Construct_translated_point_2;
+  typedef typename K::Construct_midpoint_3          Construct_midpoint_2;
+  typedef typename K::Construct_circumcenter_3      Construct_circumcenter_2;
+
+  typedef typename K::Compute_area_3                Compute_area_2;
+
+  Less_x_2
+  less_x_2_object() const
+  {
+    return Less_x_2(this->base1());
+  }
+
+  Less_y_2
+  less_y_2_object() const
+  {
+    return Less_y_2(this->base2());
+  }
+
+  Compare_x_2
+  compare_x_2_object() const
+  {
+    return Compare_x_2(this->base1());
+  }
+
+  Compare_y_2
+  compare_y_2_object() const
+  {
+    return Compare_y_2(this->base2());
+  }
+
+  Orientation_2
+  orientation_2_object() const
+  {
+    return Orientation_2(this->normal());
+  }
+
+  Side_of_oriented_circle_2
+  side_of_oriented_circle_2_object() const
+  {
+    return Side_of_oriented_circle_2(this->normal());
+  }
+
+  Compute_squared_distance_2
+  compute_squared_distance_2_object() const
+  {
+    return Compute_squared_distance_2(this->normal());
+  }
+
+  Intersect_2
+  intersect_2_object () const
+  {
+    return Intersect_2(this->normal());
+  }
+
+  Angle_2  angle_2_object() const
+    {return Angle_2();}
+
+  Construct_segment_2  construct_segment_2_object() const
+    {return Construct_segment_2();}
+
+  Construct_vector_2  construct_vector_2_object() const
+    {return Construct_vector_2();}
+
+  Construct_scaled_vector_2  construct_scaled_vector_2_object() const
+    {return Construct_scaled_vector_2();}
+
+  Construct_midpoint_2  construct_midpoint_2_object() const
+    {return Construct_midpoint_2();}
+
+  Construct_circumcenter_2  construct_circumcenter_2_object() const
+    {return Construct_circumcenter_2();}
+
+  Construct_translated_point_2  construct_translated_point_2_object() const
+    {return Construct_translated_point_2();}
+
+  Construct_line_2  construct_line_2_object() const
+    {return Construct_line_2();}
+
+  Construct_triangle_2  construct_triangle_2_object() const
+    {return Construct_triangle_2();}
+
+  Compute_area_2 compute_area_2_object() const
+  {return Compute_area_2();}
+
+
+
+  // Special functor, not in the Kernel concept
+  class Projection_to_plan {
+    // Remeber: Point_2 is K::Point_3
+    const Point_2& plane_point;
+    const Vector_3& normal;
+  public:
+    // Return the projection of a point to a plane passing through
+    // the point 'plane_point' and with orthogonal vector normal().
+    Projection_to_plan(const Point_2& plane_point_, const Self& self)
+      : plane_point(plane_point_),
+        normal(self.normal())
+    {}
+
+    Point_2 operator()(const Point_2& point) const
+    {
+      return point +
+        ( ( (plane_point - point) * normal ) / (normal * normal) ) * normal;
+    }
+  }; // end Projection_to_plan
+
+  Projection_to_plan projection_to_plan_object(const Point_2& plane_point) const
+  {
+    return Projection_to_plan(plane_point, *this);
+  }
+
+}; // end class Triangulation_2_projection_traits_base_3<Kernel>
+
+} // end namespace CGAL
+
+#endif // CGAL_INTERNAL_TRIANGULATION_2_PROJECTION_TRAITS_BASE_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Triangulation_ds_circulators_3.h b/3rdparty/CGAL/include/CGAL/internal/Triangulation_ds_circulators_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Triangulation_ds_circulators_3.h
rename to 3rdparty/CGAL/include/CGAL/internal/Triangulation_ds_circulators_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Triangulation_ds_iterators_3.h b/3rdparty/CGAL/include/CGAL/internal/Triangulation_ds_iterators_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Triangulation_ds_iterators_3.h
rename to 3rdparty/CGAL/include/CGAL/internal/Triangulation_ds_iterators_3.h
diff --git a/3rdparty/CGAL/include/CGAL/internal/Voronoi_covariance_3/voronoi_covariance_3.h b/3rdparty/CGAL/include/CGAL/internal/Voronoi_covariance_3/voronoi_covariance_3.h
new file mode 100644
index 0000000..f18b715
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/internal/Voronoi_covariance_3/voronoi_covariance_3.h
@@ -0,0 +1,231 @@
+// Copyright (c) 2014  INRIA Sophia-Antipolis (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
+// 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(s) : Jocelyn Meyron and Quentin Mérigot
+//
+
+#ifndef CGAL_INTERNAL_VCM_VORONOI_COVARIANCE_3_HPP
+#define CGAL_INTERNAL_VCM_VORONOI_COVARIANCE_3_HPP
+
+#include <list>
+#include <CGAL/array.h>
+#include <CGAL/internal/Voronoi_covariance_3/voronoi_covariance_sphere_3.h>
+#ifdef CGAL_VORONOI_COVARIANCE_USE_CONSTRUCTIONS
+#include <CGAL/Convex_hull_3/dual/halfspace_intersection_with_constructions_3.h>
+#else
+#include <CGAL/Convex_hull_3/dual/halfspace_intersection_3.h>
+#endif
+
+/// \cond SKIP_IN_MANUAL
+
+namespace CGAL {
+    namespace Voronoi_covariance_3 {
+        namespace internal {
+            template <class FT>
+                inline void
+                covariance_matrix_tetrahedron (FT ax, FT ay, FT az,
+                                               FT bx, FT by, FT bz,
+                                               FT cx, FT cy, FT cz,
+                                               cpp11::array<FT,6> &R)
+                {
+                    const FT det = (ax*cz*by - ax*bz*cy - ay*bx*cz +
+                                    ay*cx*bz + az*bx*cy - az*cx*by) / 60.0;
+
+                    R[0] += (ax*ax + ax*bx + ax*cx +
+                             bx*bx + bx*cx + cx*cx) * det;
+                    R[1] += (ax*ay + ax*by/2.0 + ax*cy/2.0 +
+                             bx*ay/2.0 + bx*by + bx*cy/2.0 +
+                             cx*ay/2.0 + cx*by/2.0 + cx*cy) * det;
+                    R[2] += (ax*az + ax*bz/2.0 + ax*cz/2.0 +
+                             bx*az/2.0 + bx*bz + bx*cz/2.0 +
+                             cx*az/2.0 + cx*bz/2.0 + cx*cz) * det;
+
+                    R[3] += (ay*ay + ay*by + ay*cy +
+                             by*by + by*cy + cy*cy) * det;
+                    R[4] += (az*ay + az*by/2.0 + az*cy/2.0 +
+                             bz*ay/2.0 + bz*by + bz*cy/2.0 +
+                             cz*ay/2.0 + cz*by/2.0 + cz*cy) * det;
+
+                    R[5] += (az*az + az*bz + az*cz +
+                             bz*bz + bz*cz + cz*cz) * det;
+                }
+
+            template <class FT>
+                class Covariance_accumulator_3
+                {
+                    public:
+                        typedef cpp11::array<FT, 6> Result_type;
+
+                    private:
+                        Result_type _result;
+
+                    public:
+                        Covariance_accumulator_3()
+                        {
+                            std::fill (_result.begin(), _result.end(), FT(0));
+                        }
+
+                        template <class Point>
+                            inline void operator () (const Point &a,
+                                                     const Point &b,
+                                                     const Point &c)
+                            {
+                                internal::covariance_matrix_tetrahedron (a[0], a[1], a[2],
+                                                                         b[0], b[1], b[2],
+                                                                         c[0], c[1], c[2],
+                                                                         _result);
+                            }
+
+                        const Result_type &result() const
+                        {
+                            return _result;
+                        }
+                };
+
+            template <class FT>
+                class Volume_accumulator_3
+                {
+                    public:
+                        typedef FT Result_type;
+
+                    private:
+                        Result_type _result;
+
+                    public:
+                        Volume_accumulator_3() : _result(0.0)
+                    {}
+
+                        template <class Point>
+                            inline void operator () (const Point &a,
+                                                     const Point &b,
+                                                     const Point &c)
+                            {
+                                const double  vol = CGAL::volume(a, b, c, Point(CGAL::ORIGIN));
+                                //std::cerr << "vol = " << vol << "\n";
+                                _result += vol;
+                            }
+
+                        const Result_type &result() const
+                        {
+                            return _result;
+                        }
+                };
+
+
+            template <class DT, class Sphere, class F>
+                F& tessellate_and_intersect(const DT &dt,
+                                            typename DT::Vertex_handle v,
+                                            const Sphere &sphere,
+                                            F &f)
+                {
+                    typedef typename DT::Vertex_handle Vertex_handle;
+                    typedef typename DT::Geom_traits::Kernel K;
+                    typedef typename K::Plane_3 Plane;
+                    typedef typename K::Point_3 Point;
+                    typedef typename K::Vector_3 Vector;
+                    typedef typename CGAL::Convex_hull_traits_3<K> Traits;
+                    typedef typename Traits::Polyhedron_3 Polyhedron;
+
+                    std::list<Vertex_handle> vertices;
+                    dt.incident_vertices(v,std::back_inserter(vertices));
+
+                    // construct intersection of half-planes using the convex hull function
+                    std::list<Plane> planes;
+                    for(typename std::list<Vertex_handle>::iterator it = vertices.begin();
+                        it != vertices.end(); ++it)
+                    {
+                        if (dt.is_infinite(*it))
+                          continue;
+                        Vector p = ((*it)->point() - v->point())/2;
+                        planes.push_back (Plane(CGAL::ORIGIN+p, p));
+                    }
+
+                    // add half-planes defining the sphere discretization
+                    sphere(std::back_inserter(planes));
+
+                    Polyhedron P;
+                    #ifdef CGAL_VORONOI_COVARIANCE_USE_CONSTRUCTIONS
+                    halfspace_intersection_with_constructions_3
+                    #else
+                    halfspace_intersection_3
+                    #endif
+                      (planes.begin(),
+                       planes.end(),
+                       P,
+                       boost::make_optional(Point(CGAL::ORIGIN)));
+
+                    // apply f to the triangles on the boundary of P
+                    for (typename Polyhedron::Facet_iterator it = P.facets_begin();
+                         it != P.facets_end(); ++it)
+                    {
+                        typename Polyhedron::Halfedge_around_facet_circulator
+                            h0 = it->facet_begin(), hf = h0--, hs = cpp11::next(hf);
+
+                        while(hs != h0)
+                        {
+                            f (h0->vertex()->point(), hf->vertex()->point(),
+                               hs->vertex()->point());
+                            ++hs; ++hf;
+                        }
+                    }
+                    return f;
+                }
+        } // namespace internal
+
+        template <class DT, class Sphere, class FT>
+            void
+            voronoi_covariance_3 (const DT &dt,
+                                  typename DT::Vertex_handle v,
+                                  const Sphere &sphere,
+                                  FT covariance[6])
+            {
+                typename internal::Covariance_accumulator_3<FT> ca;
+                internal::tessellate_and_intersect(dt, v, sphere, ca);
+                std::copy (ca.result().begin(), ca.result().end(), covariance);
+            }
+
+        template <class DT, class Sphere>
+            array<typename DT::Geom_traits::FT, 6>
+            voronoi_covariance_3 (const DT &dt,
+                                  typename DT::Vertex_handle v,
+                                  const Sphere &sphere)
+            {
+                typedef typename DT::Geom_traits::FT FT;
+                typename internal::Covariance_accumulator_3<FT> ca;
+
+                return internal::tessellate_and_intersect(dt, v, sphere, ca).result();
+            }
+
+        template <class DT, class Sphere>
+            typename DT::Geom_traits::FT
+            voronoi_volume_3 (const DT &dt,
+                              typename DT::Vertex_handle v,
+                              const Sphere &sphere)
+            {
+                typedef typename DT::Geom_traits::FT FT;
+                typename internal::Volume_accumulator_3<FT> va;
+
+                return internal::tessellate_and_intersect(dt, v, sphere, va).result();
+            }
+
+    } // namespace Voronoi_covariance_3
+} // namespace CGAL
+
+/// \endcond
+
+#endif // CGAL_INTERNAL_VCM_VORONOI_COVARIANCE_3_HPP
+
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/Voronoi_covariance_3/voronoi_covariance_sphere_3.h b/3rdparty/CGAL/include/CGAL/internal/Voronoi_covariance_3/voronoi_covariance_sphere_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/Voronoi_covariance_3/voronoi_covariance_sphere_3.h
rename to 3rdparty/CGAL/include/CGAL/internal/Voronoi_covariance_3/voronoi_covariance_sphere_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/auxiliary/graph.h b/3rdparty/CGAL/include/CGAL/internal/auxiliary/graph.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/auxiliary/graph.h
rename to 3rdparty/CGAL/include/CGAL/internal/auxiliary/graph.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/boost/array_binary_tree.hpp b/3rdparty/CGAL/include/CGAL/internal/boost/array_binary_tree.hpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/boost/array_binary_tree.hpp
rename to 3rdparty/CGAL/include/CGAL/internal/boost/array_binary_tree.hpp
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/boost/mutable_heap.hpp b/3rdparty/CGAL/include/CGAL/internal/boost/mutable_heap.hpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/boost/mutable_heap.hpp
rename to 3rdparty/CGAL/include/CGAL/internal/boost/mutable_heap.hpp
diff --git a/3rdparty/CGAL/include/CGAL/internal/boost/mutable_queue.hpp b/3rdparty/CGAL/include/CGAL/internal/boost/mutable_queue.hpp
new file mode 100644
index 0000000..8aaaf55
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/internal/boost/mutable_queue.hpp
@@ -0,0 +1,153 @@
+//
+//=======================================================================
+// Copyright 1997, 1998, 1999, 2000 University of Notre Dame.
+// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//=======================================================================
+//
+// $URL$
+// $Id$
+//
+// NOTE: this file have been taken from boost 1.46.1 for using
+//       with Modificable_priority_queue (to enhance the 
+//       non-documented mutable_queue).
+//       original file is <boost/pending/mutable_queue.hpp>
+//
+#ifndef CGAL_INTERNAL_BOOST_MUTABLE_QUEUE_HPP
+#define CGAL_INTERNAL_BOOST_MUTABLE_QUEUE_HPP
+
+#include <vector>
+#include <algorithm>
+#include <functional>
+#include <CGAL/property_map.h>
+#include <CGAL/internal/boost/mutable_heap.hpp>
+#include <CGAL/internal/boost/array_binary_tree.hpp>
+#include <iterator>
+
+namespace CGAL { namespace internal {
+namespace boost_ {
+
+  // The mutable queue whose elements are indexed
+  //
+  // This adaptor provides a special kind of priority queue that has
+  // and update operation. This allows the ordering of the items to
+  // change. After the ordering criteria for item x changes, one must
+  // call the Q.update(x)
+  //
+  // In order to efficiently find x in the queue, a functor must be
+  // provided to map value_type to a unique ID, which the
+  // mutable_queue will then use to map to the location of the
+  // item. The ID's generated must be between 0 and N, where N is the
+  // value passed to the constructor of mutable_queue
+
+  template <class IndexedType,
+            class RandomAccessContainer = std::vector<IndexedType>,
+            class Comp = std::less<typename RandomAccessContainer::value_type>,
+            class ID = ::boost::identity_property_map >
+  class mutable_queue {
+  public:
+    typedef IndexedType value_type;
+    typedef typename RandomAccessContainer::size_type size_type;
+  protected:
+    typedef typename RandomAccessContainer::iterator iterator;
+#if !defined BOOST_NO_STD_ITERATOR_TRAITS
+    typedef array_binary_tree_node<iterator, ID> Node;
+#else
+    typedef array_binary_tree_node<iterator, value_type, ID> Node;
+#endif
+    typedef compare_array_node<RandomAccessContainer,Comp> Compare;
+    typedef std::vector<size_type> IndexArray;
+  public:
+    typedef Compare value_compare;
+    typedef ID id_generator;
+
+    mutable_queue(size_type n, const Comp& x, const ID& _id)
+      : index_array(n), comp(x), id(_id) {
+      c.reserve(n);
+    }
+//SL: added this constructor so that index_array is filled with
+//    indices equals to n. Maintaining this property in pop allows
+//    to have a method to detect if an element is in the queue
+    mutable_queue(size_type n, const Comp& x, const ID& _id,bool)
+      : index_array(n,n), comp(x), id(_id) {
+      c.reserve(n);
+    }
+    
+    template <class ForwardIterator>
+    mutable_queue(ForwardIterator first, ForwardIterator last,
+                  const Comp& x, const ID& _id)
+      : index_array(std::distance(first, last)), comp(x), id(_id)
+    {
+      while( first != last ) {
+        push(*first);
+        ++first;
+      }
+    }
+
+    bool empty() const { return c.empty(); }
+//SL: modified this function so that the element popped from the queue
+//    has its index set to the max number of element. That way we know
+//    that an element is not in the tree if its index is the max number
+//    of elements.
+    void pop() {
+      value_type tmp = c.back();
+      c.back() = c.front();
+      c.front() = tmp;
+
+      size_type id_f = get(id, c.back());
+      size_type id_b = get(id, tmp);
+      //SL was: size_type i = index_array[ id_b ];
+      index_array[ id_b ] = index_array[ id_f ];
+      //SL was: index_array[ id_f ] = i; 
+      index_array[ id_f ] = index_array.size(); /*SL added*/
+      c.pop_back();
+      Node node(c.begin(), c.end(), c.begin(), id);
+      down_heap(node, comp, index_array);
+    }
+    void push(const IndexedType& x) {
+      c.push_back(x);
+      /*set index-array*/
+      index_array[ get(id, x) ] = c.size()-1;
+      Node node(c.begin(), c.end(), c.end() - 1, id);
+      up_heap(node, comp, index_array);
+    }
+
+    void update(const IndexedType& x) {
+      size_type current_pos = index_array[ get(id, x) ];
+      c[current_pos] = x;
+
+      Node node(c.begin(), c.end(), c.begin()+current_pos, id);
+      update_heap(node, comp, index_array);
+    }
+
+    value_type& front() { return c.front(); }
+    value_type& top() { return c.front(); }
+
+    const value_type& front() const { return c.front(); }
+    const value_type& top() const { return c.front(); }
+
+    size_type size() const { return c.size(); }
+
+    void clear() { c.clear(); }
+
+#if 0
+        // dwa 2003/7/11 - I don't know what compiler is supposed to
+        // be able to compile this, but is_heap is not standard!!
+    bool test() {
+      return std::is_heap(c.begin(), c.end(), Comp());
+    }
+#endif
+
+   protected:
+    IndexArray index_array;
+    Compare comp;
+    RandomAccessContainer c;
+    ID id;
+  };
+
+
+} } } //namespace CGAL::internal::boost_
+#endif // CGAL_INTERNAL_BOOST_MUTABLE_QUEUE_HPP
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/bounded_priority_queue.h b/3rdparty/CGAL/include/CGAL/internal/bounded_priority_queue.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/bounded_priority_queue.h
rename to 3rdparty/CGAL/include/CGAL/internal/bounded_priority_queue.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/container_fwd_fixed.hpp b/3rdparty/CGAL/include/CGAL/internal/container_fwd_fixed.hpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/container_fwd_fixed.hpp
rename to 3rdparty/CGAL/include/CGAL/internal/container_fwd_fixed.hpp
diff --git a/3rdparty/CGAL/include/CGAL/internal/corefinement/Combinatorial_map_for_corefinement.h b/3rdparty/CGAL/include/CGAL/internal/corefinement/Combinatorial_map_for_corefinement.h
new file mode 100644
index 0000000..5b15c6c
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/internal/corefinement/Combinatorial_map_for_corefinement.h
@@ -0,0 +1,113 @@
+// Copyright (c) 2012  GeometryFactory Sarl (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
+// 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.
+//
+// $UR$
+// $Id$
+//
+//
+// Author(s)     : Sebastien Loriot
+
+#ifndef CGAL_INTERNAL_COMBINATORIAL_MAP_FOR_COREFINEMENT_H
+#define CGAL_INTERNAL_COMBINATORIAL_MAP_FOR_COREFINEMENT_H
+
+#include <CGAL/Combinatorial_map.h>
+#include <CGAL/Combinatorial_map_constructors.h>
+#include <CGAL/Cell_attribute.h>
+#include <set>
+
+namespace CGAL{
+  namespace internal_IOP{
+
+template <class Polyhedron>
+struct Volume_info{
+  std::set<Polyhedron*> outside;
+  std::set<Polyhedron*> inside;
+  bool is_empty;
+  Volume_info():is_empty(false){}
+};
+
+struct Volume_on_merge
+{
+  template <class Attribute>
+  void operator() (Attribute& a1,const Attribute& a2) const
+  {
+    CGAL_assertion(!a1.info().is_empty && !a2.info().is_empty);
+    std::copy(a2.info().outside.begin(),a2.info().outside.end(),std::inserter(a1.info().outside,a1.info().outside.begin()));
+    std::copy(a2.info().inside.begin(),a2.info().inside.end(),std::inserter(a1.info().inside,a1.info().inside.begin()));
+  }
+};
+
+#ifndef NDEBUG
+struct Point_on_merge
+{
+  template <class Attribute>
+  void operator() (Attribute& a1,const Attribute& a2) const
+  {
+    CGAL_assertion(a1.point()==a2.point() );
+    CGAL_USE(a1); CGAL_USE(a2);
+  }
+};
+#endif
+
+
+template < class Refs, class T, class Point_,
+           class Functor_on_merge_=CGAL::Null_functor,
+           class Functor_on_split_=CGAL::Null_functor >
+class My_cell_attribute_with_point :
+  public CGAL::Cell_attribute_without_info<Refs, T, Functor_on_merge_, Functor_on_split_>
+{
+   Point_ mpoint;
+public:
+  typedef Point_            Point;
+  typedef Functor_on_merge_ Functor_on_merge;
+  typedef Functor_on_split_ Functor_on_split;
+
+  My_cell_attribute_with_point(){}
+  My_cell_attribute_with_point(const Point& apoint) : mpoint(apoint) {}
+  Point& point()             { return mpoint; }
+  const Point& point() const { return mpoint; }  
+    
+};
+
+template <typename Traits_,class Polyhedron>
+class Item_with_points_and_volume_info
+{
+public:
+  public:
+    static const unsigned int dimension = 3;
+    static const unsigned int NB_MARKS = 32;
+    template<class Refs>
+    struct Dart_wrapper
+    {
+      typedef CGAL::Dart<3, Refs >       Dart;
+      typedef Traits_                    Traits;
+      typedef typename Traits::FT        FT;
+      typedef typename Traits::Point_3   Point;
+      typedef typename Traits::Vector_3  Vector;
+      #ifndef NDEBUG
+      typedef My_cell_attribute_with_point< Refs,CGAL::Tag_true,Point,Point_on_merge>                 Vertex_attribute;
+      #else
+      typedef My_cell_attribute_with_point< Refs,CGAL::Tag_true,Point>                                Vertex_attribute;
+      #endif
+      typedef CGAL::Cell_attribute< Refs,Volume_info<Polyhedron>,CGAL::Tag_true,Volume_on_merge >     Volume_attribute;
+      typedef CGAL::cpp11::tuple< Vertex_attribute,
+                                  void,
+                                  void,
+                                  Volume_attribute>    Attributes;
+    };
+};
+
+} } //namespace CGAL::internal_IOP
+
+#endif //CGAL_INTERNAL_COMBINATORIAL_MAP_FOR_COREFINEMENT_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/corefinement/Polyhedron_constness_types.h b/3rdparty/CGAL/include/CGAL/internal/corefinement/Polyhedron_constness_types.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/corefinement/Polyhedron_constness_types.h
rename to 3rdparty/CGAL/include/CGAL/internal/corefinement/Polyhedron_constness_types.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/corefinement/intersection_coplanar_triangles_3.h b/3rdparty/CGAL/include/CGAL/internal/corefinement/intersection_coplanar_triangles_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/corefinement/intersection_coplanar_triangles_3.h
rename to 3rdparty/CGAL/include/CGAL/internal/corefinement/intersection_coplanar_triangles_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/corefinement/intersection_triangle_segment_3.h b/3rdparty/CGAL/include/CGAL/internal/corefinement/intersection_triangle_segment_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/corefinement/intersection_triangle_segment_3.h
rename to 3rdparty/CGAL/include/CGAL/internal/corefinement/intersection_triangle_segment_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/corefinement/intersection_triangle_segment_3_coplanar.h b/3rdparty/CGAL/include/CGAL/internal/corefinement/intersection_triangle_segment_3_coplanar.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/corefinement/intersection_triangle_segment_3_coplanar.h
rename to 3rdparty/CGAL/include/CGAL/internal/corefinement/intersection_triangle_segment_3_coplanar.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/deprecation_warning.h b/3rdparty/CGAL/include/CGAL/internal/deprecation_warning.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/deprecation_warning.h
rename to 3rdparty/CGAL/include/CGAL/internal/deprecation_warning.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/internal/info_check.h b/3rdparty/CGAL/include/CGAL/internal/info_check.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/internal/info_check.h
rename to 3rdparty/CGAL/include/CGAL/internal/info_check.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/interpolation_functions.h b/3rdparty/CGAL/include/CGAL/interpolation_functions.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/interpolation_functions.h
rename to 3rdparty/CGAL/include/CGAL/interpolation_functions.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/intersection_2.h b/3rdparty/CGAL/include/CGAL/intersection_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/intersection_2.h
rename to 3rdparty/CGAL/include/CGAL/intersection_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/intersection_2_1.h b/3rdparty/CGAL/include/CGAL/intersection_2_1.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/intersection_2_1.h
rename to 3rdparty/CGAL/include/CGAL/intersection_2_1.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/intersection_2_2.h b/3rdparty/CGAL/include/CGAL/intersection_2_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/intersection_2_2.h
rename to 3rdparty/CGAL/include/CGAL/intersection_2_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/intersection_2_3.h b/3rdparty/CGAL/include/CGAL/intersection_2_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/intersection_2_3.h
rename to 3rdparty/CGAL/include/CGAL/intersection_2_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/intersection_3.h b/3rdparty/CGAL/include/CGAL/intersection_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/intersection_3.h
rename to 3rdparty/CGAL/include/CGAL/intersection_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/intersection_3_1.h b/3rdparty/CGAL/include/CGAL/intersection_3_1.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/intersection_3_1.h
rename to 3rdparty/CGAL/include/CGAL/intersection_3_1.h
diff --git a/3rdparty/CGAL/include/CGAL/intersection_of_Polyhedra_3.h b/3rdparty/CGAL/include/CGAL/intersection_of_Polyhedra_3.h
new file mode 100644
index 0000000..a019ec2
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/intersection_of_Polyhedra_3.h
@@ -0,0 +1,2106 @@
+// Copyright (c) 2010-2012 GeometryFactory (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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(s)     : Sebastien Loriot
+
+#ifndef CGAL_INTERSECTION_OF_POLYHEDRA_3_H
+#define CGAL_INTERSECTION_OF_POLYHEDRA_3_H
+
+#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
+#include <CGAL/Cartesian_converter.h>
+#include <CGAL/box_intersection_d.h>
+#include <CGAL/Bbox_3.h>
+#include <CGAL/intersections.h>
+
+#include <boost/next_prior.hpp>
+#include <set>
+#include <vector>
+#include <list>
+#include <algorithm>
+#include <CGAL/tuple.h>
+#include <CGAL/iterator.h>
+
+#include <CGAL/Modifier_base.h>
+#include <CGAL/internal/corefinement/Polyhedron_constness_types.h>
+#include <CGAL/internal/corefinement/intersection_triangle_segment_3.h>
+#include <CGAL/internal/corefinement/intersection_coplanar_triangles_3.h>
+#include <CGAL/use.h>
+
+#include <boost/type_traits/is_base_of.hpp>
+#include <boost/type_traits/is_floating_point.hpp>
+
+#include <boost/foreach.hpp>
+#include <CGAL/Polygon_mesh_processing/self_intersections.h>
+
+#ifdef CGAL_COREFINEMENT_DEBUG
+#warning look at CGAL/Mesh_3/Robust_intersection_traits.h and the statically filtered decision tree
+#endif
+
+namespace CGAL{
+
+//This functor computes the pairwise intersection of polyhedral surfaces.
+//Intersection are given as a set of polylines
+//The algorithm works as follow:
+//From each polyhedral surface we can get it as a set of segments or as a set of triangles.
+//We first use Box_intersection_d to filter intersection between all polyhedral
+//surface segments and polyhedral triangles.
+//From this filtered set, for each pair (segment,triangle), we look at the
+//intersection type. If not empty, we can have three different cases
+//  1)the segment intersect the interior of the triangle:
+//        We compute the intersection point and for each triangle incident
+//        to the segment, we write the fact that the point belong to the intersection
+//        of these two triangles.
+//  2)the segment intersect the triangle on an edge
+//        We do the same thing as described above but
+//        for all triangle incident to the edge intersected
+//  3)the segment intersect the triangle at a vertex
+//        for each edge incident to the vertex, we do
+//        the same operations as in 2)
+//
+//In case the segment intersect the triangle at one of the segment endpoint,  
+//we repeat the same procedure for each segment incident to this
+//endpoint.
+//
+//Note that given a pair (segment,triangle)=(S,T), if S belongs 
+//to the plane of T, we have nothing to do in the following cases:
+//  -- no triangle T' contains S such that T and T' are coplanar
+//  -- at least one triangle contains S
+// Indeed, the intersection points of S and T will be found using segments
+// of T or segments adjacent to S.
+//
+// -- Sebastien Loriot, 2010/04/07
+
+namespace internal_IOP {
+  //an enum do decide which kind of intersection points are needed
+  struct No_predicates_on_constructions{};
+  struct Predicates_on_constructions{};
+} // namespace internal_IOP
+
+template<class Polyhedron>
+struct Empty_node_visitor{
+  typedef typename Polyhedron::Halfedge_const_handle Halfedge_handle;
+  void new_node_added(int,internal_IOP::Intersection_type,Halfedge_handle,Halfedge_handle,bool,bool){}
+  template<class Iterator>
+  void annotate_graph(Iterator,Iterator){}
+  void update_terminal_nodes(std::vector<bool>&){}
+  void set_number_of_intersection_points_from_coplanar_facets(int){};
+  void add_filtered_intersection(Halfedge_handle,Halfedge_handle,const Polyhedron&,const Polyhedron&){}
+  void start_new_polyline(int,int){}
+  void add_node_to_polyline(int){}
+  void new_input_polyhedron(const Polyhedron&){}
+  template<class T>
+  void finalize(T&){}
+  typedef internal_IOP::No_predicates_on_constructions Node_storage_type;
+  typedef Tag_true Is_polyhedron_const;
+  static const bool do_need_vertex_graph = false;
+};
+
+namespace internal_IOP{
+  
+template <class Polyhedron,class Is_const>
+struct Compare_handles{
+  typedef typename Polyhedron_types<Polyhedron,Is_const>::Halfedge_handle   Halfedge_handle;
+  typedef typename Polyhedron_types<Polyhedron,Is_const>::Halfedge          Halfedge;
+  typedef typename Polyhedron_types<Polyhedron,Is_const>::Vertex            Vertex;
+  typedef typename Polyhedron_types<Polyhedron,Is_const>::Facet             Facet;
+  typedef typename Polyhedron_types<Polyhedron,Is_const>::Facet_handle      Facet_handle;
+  typedef std::pair<const Vertex*,const Vertex*>                            Vertex_handle_pair;
+  
+  static inline Vertex_handle_pair 
+  make_sorted_pair_of_vertices(Halfedge_handle h) {
+    const Vertex* v1=&(* h->vertex() );
+    const Vertex* v2=&(* h->opposite()->vertex() );
+    if ( v1 < v2 )
+      return Vertex_handle_pair(v1,v2);
+    return Vertex_handle_pair(v2,v1);
+  }
+  
+  bool operator()(Halfedge_handle h1,Halfedge_handle h2) const {
+    Vertex_handle_pair p1=make_sorted_pair_of_vertices(h1);
+    Vertex_handle_pair p2=make_sorted_pair_of_vertices(h2);
+    return  p1 < p2; 
+  }
+  
+  bool operator()(Facet_handle f1,Facet_handle f2) const {
+    return &(*f1) < &(*f2);
+  }
+  
+  bool operator()(const std::pair<Halfedge_handle,Polyhedron*>& p1, const std::pair<Halfedge_handle,Polyhedron*>& p2) const{
+    Halfedge* h1= (std::min) ( &(*(p1.first)), &(*(p1.first->opposite())) );
+    Halfedge* h2= (std::min) ( &(*(p2.first)), &(*(p2.first->opposite())) );
+    return h1<h2;
+  }
+};
+
+//could not put it in the above struct (gcc complains about an ambiguous call)
+template <class Polyhedron,class Is_const>
+struct Compare_handle_pairs{
+  typedef typename Polyhedron_types<Polyhedron,Is_const>::Facet             Facet;
+  typedef typename Polyhedron_types<Polyhedron,Is_const>::Facet_handle      Facet_handle;  
+  typedef std::pair<Facet_handle,Facet_handle>                              Facet_pair;
+  typedef std::pair<Facet_pair,int>                                         Facet_pair_and_int;
+  
+  bool operator()(const Facet_pair& p1, const Facet_pair& p2) const{
+    Facet* f1=&(*p1.first);
+    Facet* f2=&(*p2.first);
+    if (f1==f2){
+      f1=&(*p1.second);
+      f2=&(*p2.second);
+    }
+    return f1<f2;
+  }
+
+  bool operator()(const Facet_pair_and_int& p1, const Facet_pair_and_int& p2) const{
+    Facet* f1=&(*p1.first.first);
+    Facet* f2=&(*p2.first.first);
+    if (f1==f2){
+      f1=&(*p1.first.second);
+      f2=&(*p2.first.second);
+    }
+    if (f1<f2) return true;
+    if (f1>f2) return false;
+    return p1.second<p2.second;
+  }
+};
+
+template<class Polyhedron,class Nodes_vector,class Is_const>
+struct Order_along_a_halfedge{
+  typedef typename Polyhedron_types<Polyhedron,Is_const>::Halfedge_handle Halfedge_handle;
+  const Nodes_vector& nodes;
+  Halfedge_handle hedge;
+  
+  Order_along_a_halfedge(Halfedge_handle hedge_,const Nodes_vector& nodes_):nodes(nodes_),hedge(hedge_){}
+  bool operator()(int i,int j) const {
+    //returns true, iff q lies strictly between p and r.
+    typename Nodes_vector::Protector p;
+    try{
+      CGAL::internal::use(p);
+
+      return CGAL::collinear_are_strictly_ordered_along_line(nodes.to_interval(hedge->vertex()->point()),
+                                                             nodes.interval_node(j),
+                                                             nodes.interval_node(i));
+    }
+    catch(CGAL::Uncertain_conversion_exception&){
+      return CGAL::collinear_are_strictly_ordered_along_line(nodes.to_exact(hedge->vertex()->point()),
+                                                             nodes.exact_node(j),
+                                                             nodes.exact_node(i));      
+    }
+  }
+};
+
+
+template <class HDS>
+class Split_halfedge_at_point : public CGAL::Modifier_base<HDS> {
+  typedef typename HDS::Halfedge_handle Halfedge_handle;
+  typedef typename HDS::Vertex_handle   Vertex_handle;
+  typedef typename HDS::Vertex          Vertex;
+  Halfedge_handle hedge;
+  Vertex          vertex;
+  
+  typename HDS::Halfedge::Base*
+  unlock_halfedge(Halfedge_handle h){
+    return static_cast<typename HDS::Halfedge::Base*>(&(*h));
+  }
+  
+public:
+  
+  template <class Point_3>
+  Split_halfedge_at_point( Halfedge_handle h,const Point_3& point):hedge(h),vertex(point){}
+
+  //   new_hedge    hedge
+  //  ----------->   ----------->
+  //               v
+  //  <-----------   <-----------
+  //   new_opposite     opposite 
+  //  
+  void operator()( HDS& hds) {
+    
+    Vertex_handle v=hds.vertices_push_back(vertex);
+    Halfedge_handle opposite=hedge->opposite();
+    
+    Halfedge_handle new_hedge=hds.edges_push_back(*hedge);
+    Halfedge_handle new_opposite=new_hedge->opposite();
+    
+    //update next relations
+    unlock_halfedge(new_hedge)->set_next(hedge);
+    unlock_halfedge(new_hedge->prev())->set_next(new_hedge);
+    unlock_halfedge(hedge)->set_prev(new_hedge);
+
+    unlock_halfedge(opposite)->set_next(new_opposite);
+    unlock_halfedge(new_opposite)->set_prev(opposite);    
+    unlock_halfedge(new_opposite->next())->set_prev(new_opposite);
+
+    unlock_halfedge(opposite)->set_vertex(v);
+    unlock_halfedge(new_hedge)->set_vertex(v);
+
+    v->set_halfedge(new_hedge);
+    new_opposite->vertex()->set_halfedge(new_opposite);
+  }
+};
+
+
+
+} //namespace internal_IOP
+
+
+
+//WARNING THIS IS DONE ONLY FOR POLYHEDRON
+template<class Polyhedron,class Halfedge_predicate,
+         class Set_vertex_corner, class Kernel=typename Polyhedron::Traits::Kernel>
+class Node_visitor_for_polyline_split{
+//typedefs  
+  typedef typename Polyhedron::Halfedge_handle                         Halfedge_handle;
+  typedef typename Polyhedron::Halfedge                                Halfedge;
+  typedef typename Polyhedron::Vertex_handle                           Vertex_handle;
+  //Info stores information about a particular intersection on an
+  //edge or a vertex of a polyhedron. The two first elements in 
+  //the template describe the intersected simplex of the considered 
+  //polyhedron; the two last elements describe the element of the 
+  //second polyhedron (can be either a vertex, an edge of a facet)
+  //involved in the intersection
+  typedef CGAL::cpp11::tuple<internal_IOP::Intersection_type,
+                             Halfedge_handle,
+                             internal_IOP::Intersection_type,
+                             Halfedge_handle>                          Info;
+  typedef std::map<Halfedge*,Polyhedron*>                              Hedge_to_polyhedron_map;
+  typedef std::vector<Info>                                            Infos;
+  typedef std::map<int,Infos >                                         Node_to_infos_map;
+//data members
+  Node_to_infos_map   node_infos;
+  Hedge_to_polyhedron_map hedge_to_polyhedron;
+  Halfedge_predicate is_on_polyline;
+  Set_vertex_corner set_as_corner;
+//functions  
+  void handle_principal_edge(int node_id,
+                             internal_IOP::Intersection_type type,
+                             Halfedge_handle principal_edge,
+                             Halfedge_handle additional_edge,
+                             bool is_vertex_coplanar,
+                             bool is_vertex_opposite_coplanar)
+  {
+    bool coplanar_v=false;
+    if (is_vertex_coplanar) coplanar_v=true;
+    else if (is_vertex_opposite_coplanar){
+      principal_edge=principal_edge->opposite();
+      coplanar_v=true;
+    }
+    
+    if (coplanar_v)
+      handle_on_vertex(node_id,principal_edge,type,additional_edge);
+    else{
+      if ( is_on_polyline(principal_edge) ){
+        typename Node_to_infos_map::iterator it_res=
+          node_infos.insert(std::make_pair(node_id,Infos())).first; 
+          it_res->second.push_back( Info(internal_IOP::EDGE,principal_edge,type,additional_edge) );
+      }
+    }
+  }
+  
+  void handle_on_vertex(int node_id,Halfedge_handle edge,internal_IOP::Intersection_type type,Halfedge_handle additional_edge){
+    Halfedge_handle current=edge;
+    do{
+      if (is_on_polyline(current)){
+        typename Node_to_infos_map::iterator it_res=
+          node_infos.insert(std::make_pair(node_id,Infos())).first; 
+          it_res->second.push_back( Info(internal_IOP::VERTEX,current,type,additional_edge) );        
+        break;
+      }
+      current=current->next()->opposite();
+    }
+    while(current!=edge);    
+  }
+  
+  Halfedge* make_unique_key(Halfedge_handle h){
+    if (&(*h) < &(*h->opposite()))
+      return &(*h);
+    else
+      return &(*h->opposite());
+  }
+  
+  //   new_hedge    hedge
+  //  ----------->   ----------->
+  //               v
+  //  <-----------   <-----------
+  //   new_opposite     opposite 
+  //  
+  void split_edge_and_retriangulate(Halfedge_handle hedge,const typename Kernel::Point_3& point,Polyhedron& P){
+    internal_IOP::Split_halfedge_at_point<typename Polyhedron::HalfedgeDS> delegated(hedge,point);
+    P.delegate( delegated );
+    CGAL_assertion(P.is_valid());
+    //triangulate the two adjacent facets
+    if (!hedge->is_border())
+      P.split_facet(hedge->prev(),hedge->next());
+    if (!hedge->opposite()->is_border())
+      P.split_facet(hedge->opposite(),hedge->opposite()->next()->next());
+    CGAL_assertion(P.is_valid());
+  }
+
+  //sort node ids so that we can split the hedge
+  //consecutively
+  template <class Nodes_vector>
+  void sort_vertices_along_hedge(std::vector<int>& node_ids,Halfedge_handle hedge,const Nodes_vector& nodes)
+  {
+    std::sort(node_ids.begin(),
+              node_ids.end(),
+              internal_IOP::Order_along_a_halfedge<Polyhedron,Nodes_vector,Is_polyhedron_const>(hedge,nodes)
+    );
+  }
+  
+public:
+  static const bool do_need_vertex_graph = false;  
+  typedef internal_IOP::Predicates_on_constructions  Node_storage_type;  
+  typedef Tag_false Is_polyhedron_const;
+
+  Node_visitor_for_polyline_split(){}
+  Node_visitor_for_polyline_split(const Halfedge_predicate& getting,
+                                  const Set_vertex_corner& setting)
+    :is_on_polyline(getting),set_as_corner(setting){}
+
+  void new_node_added(int node_id,
+                      internal_IOP::Intersection_type type,
+                      Halfedge_handle principal_edge,
+                      Halfedge_handle additional_edge,
+                      bool is_vertex_coplanar,
+                      bool is_vertex_opposite_coplanar)
+  {
+    switch(type)
+    {
+      case internal_IOP::FACET: //Facet intersected by an edge
+        handle_principal_edge(node_id,type,principal_edge,additional_edge,is_vertex_coplanar,is_vertex_opposite_coplanar);
+        break;
+      case internal_IOP::EDGE: //Edge intersected by an edge
+        handle_principal_edge(node_id,type,principal_edge,additional_edge,is_vertex_coplanar,is_vertex_opposite_coplanar);
+        if ( is_on_polyline(additional_edge) ){
+          typename Node_to_infos_map::iterator it_res=
+            node_infos.insert(std::make_pair(node_id,Infos())).first; 
+            it_res->second.push_back( Info(type,additional_edge,
+                                           ( is_vertex_coplanar||is_vertex_opposite_coplanar ) ? internal_IOP::VERTEX:internal_IOP::EDGE,
+                                           is_vertex_opposite_coplanar?principal_edge->opposite():principal_edge) );
+        }
+        break;
+      case internal_IOP::VERTEX://Vertex intersected by an edge
+        handle_principal_edge(node_id,type,principal_edge,additional_edge,is_vertex_coplanar,is_vertex_opposite_coplanar);
+        handle_on_vertex( node_id,additional_edge,
+                          ( is_vertex_coplanar||is_vertex_opposite_coplanar ) ? internal_IOP::VERTEX:internal_IOP::EDGE,
+                          is_vertex_opposite_coplanar?principal_edge->opposite():principal_edge);
+        break;
+      default:
+        break;
+    }
+  }
+  
+  template<class Iterator>
+  void annotate_graph(Iterator begin,Iterator end){
+    for(Iterator it=begin;it!=end;++it){
+      typename Node_to_infos_map::iterator it_res=node_infos.find(it->first);
+      if (it_res!=node_infos.end())
+        it->second.make_terminal();
+    }
+  }
+  
+  void update_terminal_nodes(std::vector<bool>& terminal_bools){
+    for (typename Node_to_infos_map::iterator it=node_infos.begin();it!=node_infos.end();++it){
+      terminal_bools[it->first]=true;
+    }
+  }
+  
+  void new_input_polyhedron(const Polyhedron&){}
+  void start_new_polyline(int,int){}
+  void add_node_to_polyline(int){}
+  void set_number_of_intersection_points_from_coplanar_facets(int){}
+  
+  void add_filtered_intersection(Halfedge_handle eh,Halfedge_handle fh,Polyhedron& Pe,Polyhedron& Pf){
+    hedge_to_polyhedron.insert(std::make_pair(make_unique_key(eh),&Pe));
+    hedge_to_polyhedron.insert(std::make_pair(make_unique_key(fh),&Pf));
+    hedge_to_polyhedron.insert(std::make_pair(make_unique_key(fh->next()),&Pf));
+    hedge_to_polyhedron.insert(std::make_pair(make_unique_key(fh->next()->next()),&Pf));
+  }
+    
+  //split_halfedges
+  template <class Nodes_vector>
+  void finalize(const Nodes_vector& nodes){
+    typedef std::map<std::pair<Halfedge_handle,Polyhedron*>,
+                     std::vector<int>,internal_IOP::Compare_handles<Polyhedron,Is_polyhedron_const> >  Halfedges_to_split;
+    
+    Halfedges_to_split halfedges_to_split;
+    
+    for (typename Node_to_infos_map::iterator it=node_infos.begin();it!=node_infos.end();++it){
+      int node_id=it->first;
+      const Infos& infos=it->second;
+      std::map<Polyhedron*,std::vector<Halfedge_handle> > hedges_to_split;
+      
+      //collect information about halfedge to split
+      typename Infos::const_iterator it_info=infos.begin();
+      for (;it_info!=infos.end();++it_info)
+      {
+        typename Hedge_to_polyhedron_map::iterator  it_poly=
+          hedge_to_polyhedron.find(make_unique_key(CGAL::cpp11::get<1>(*it_info)));
+        CGAL_assertion(it_poly!=hedge_to_polyhedron.end());
+        //associate information to an intersection point:
+        //we give which simplex of the other polyhedron intersect the simplex considered
+        set_as_corner.add_info_to_node(node_id,it_poly->second,*it_info);
+        switch(CGAL::cpp11::get<0>(*it_info))
+        {
+          case internal_IOP::EDGE:
+          {
+            halfedges_to_split.insert(
+              std::make_pair( std::make_pair(CGAL::cpp11::get<1>(*it_info),&(*(it_poly->second))),std::vector<int>() )
+            ).first->second.push_back(node_id);
+          break;
+          }
+          case internal_IOP::VERTEX:
+            set_as_corner(CGAL::cpp11::get<1>(*it_info)->vertex(),node_id,it_poly->second);
+          break;
+          default:
+            CGAL_assertion(false);
+            //should never be here
+        }
+      }
+    }
+    
+    
+    //do the split
+    for(typename Halfedges_to_split::iterator it=halfedges_to_split.begin();it!=halfedges_to_split.end();++it){
+      Halfedge_handle hedge=it->first.first;
+      Polyhedron* P=it->first.second;
+      std::vector<int>& node_ids=it->second;
+      
+      sort_vertices_along_hedge(node_ids,hedge,nodes);
+      for (std::vector<int>::iterator it_id=node_ids.begin();it_id!=node_ids.end();++it_id){
+        split_edge_and_retriangulate(hedge,nodes[*it_id],*P);
+        set_as_corner(hedge->opposite()->vertex(),*it_id,(Polyhedron*)(0));
+      }
+    }
+  }
+};
+
+
+namespace internal_IOP{
+  
+  template <class Polyhedron,class In_kernel,class Exact_kernel>
+  typename Exact_kernel::Point_3
+  compute_triangle_segment_intersection_point(
+    typename Polyhedron::Vertex_const_handle vh1,typename Polyhedron::Vertex_const_handle vh2,
+    typename Polyhedron::Vertex_const_handle vf1,typename Polyhedron::Vertex_const_handle vf2,typename Polyhedron::Vertex_const_handle vf3,
+    const Exact_kernel& ek)       
+  {
+    CGAL::Cartesian_converter<In_kernel,Exact_kernel> to_exact;
+    typename Exact_kernel::Triangle_3 t(to_exact( vf1->point() ),
+                                        to_exact( vf2->point() ),
+                                        to_exact( vf3->point() )
+    );
+    
+    typename Exact_kernel::Segment_3 s (to_exact( vh1->point() ),
+                                        to_exact( vh2->point() )
+    );
+    
+    typename Exact_kernel::Intersect_3 exact_intersect=ek.intersect_3_object();
+    CGAL::Object inter=exact_intersect(t,s);
+    CGAL_assertion(CGAL::do_intersect(t,s));
+    const typename Exact_kernel::Point_3* e_pt=CGAL::object_cast<typename Exact_kernel::Point_3>(&inter);
+    CGAL_assertion(e_pt!=NULL);
+    return *e_pt;
+  }
+  
+  template <class Polyhedron,class In_kernel,class Exact_kernel>
+  typename Exact_kernel::Point_3
+  compute_triangle_segment_intersection_point(
+    typename Polyhedron::Halfedge_const_handle edge,
+    typename Polyhedron::Facet_const_handle facet,
+    const Exact_kernel& ek) 
+  {
+    return compute_triangle_segment_intersection_point<Polyhedron,In_kernel,Exact_kernel>(
+            edge->vertex(),edge->opposite()->vertex(),
+            facet->halfedge()->vertex(),facet->halfedge()->next()->vertex(),facet->halfedge()->opposite()->vertex(),
+            ek);
+            
+  }    
+    
+  
+  //A class containing a vector of the intersection points.
+  //The third template parameter indicates whether an
+  //exact representation is required
+  template <class Polyhedron,class Kernel,class Node_storage,bool Has_exact_constructions=!boost::is_floating_point<typename Kernel::FT>::value>
+  class Triangle_segment_intersection_points;
+  
+  
+  //Store only the double version of the intersection points.
+  template <class Polyhedron,class Kernel>
+  class Triangle_segment_intersection_points<Polyhedron,Kernel,No_predicates_on_constructions,false>
+  {
+  //typedefs
+    typedef std::vector <typename Kernel::Point_3>             Nodes_vector;
+    typedef typename Polyhedron::Halfedge_const_handle         Halfedge_handle;
+    typedef typename Polyhedron::Facet_const_handle            Facet_handle;
+    typedef CGAL::Exact_predicates_exact_constructions_kernel  Exact_kernel;
+    typedef CGAL::Cartesian_converter<Exact_kernel,Kernel>     Exact_to_double;    
+  //members
+    Nodes_vector nodes;
+    Exact_kernel ek;
+    Exact_to_double exact_to_double;
+  public:
+    typedef CGAL::Interval_nt<true>::Protector                 Protector;
+  
+    const typename Kernel::Point_3&
+    operator[](int i) const {
+      return nodes[i];
+    }
+    
+    const typename Kernel::Point_3& exact_node(int i) const {return nodes[i];}
+    const typename Kernel::Point_3& interval_node(int i) const {return nodes[i];}
+    const typename Kernel::Point_3& to_exact(const typename Kernel::Point_3& p) const {return p;}
+    const typename Kernel::Point_3& to_interval(const typename Kernel::Point_3& p) const {return p;}
+    
+    size_t size() const {return nodes.size();}
+    
+    void add_new_node(const typename Exact_kernel::Point_3& p)
+    {
+      nodes.push_back(  exact_to_double(p) );
+    }
+
+    //add a new node in the final graph.
+    //it is the intersection of the triangle with the segment
+    void add_new_node(Halfedge_handle edge,Facet_handle facet)
+    {
+      add_new_node(
+        compute_triangle_segment_intersection_point<Polyhedron,Kernel>(edge,facet,ek)
+      );
+    }
+
+
+    void add_new_node(const typename Kernel::Point_3& p)
+    {
+      nodes.push_back(p);
+    }    
+  }; // end specialization
+     // Triangle_segment_intersection_points<Polyhedron,Kernel,No_predicates_on_constructions,false>
+
+
+  //second specializations: store an exact copy of the points so that we can answer exactly predicates
+  //FYI, it used to have two specializations (one in the case the polyhedron
+  //can be edited and on if it cannot) building exact representation on demand.
+  //In the former case, we were using facet and halfedge while in the latter
+  //triple of vertex_handle and pair of vertex_handle
+  template <class Polyhedron,class Kernel>
+  class Triangle_segment_intersection_points<Polyhedron,Kernel,Predicates_on_constructions,false>
+  {
+  //typedefs
+  public: 
+    typedef CGAL::Simple_cartesian<CGAL::Interval_nt<false> >  Ikernel;
+    typedef CGAL::Exact_predicates_exact_constructions_kernel  Exact_kernel;
+  private:
+    typedef CGAL::Cartesian_converter<Ikernel,Kernel>          Interval_to_double;
+    typedef CGAL::Cartesian_converter<Kernel,Ikernel>          Double_to_interval;
+    typedef CGAL::Cartesian_converter<Exact_kernel,Ikernel>    Exact_to_interval;
+    typedef CGAL::Cartesian_converter<Kernel,Exact_kernel>     Double_to_exact;
+  
+    typedef typename Polyhedron::Vertex_const_handle           Vertex_handle;
+    typedef typename Polyhedron::Halfedge_const_handle         Halfedge_handle;
+    typedef typename Polyhedron::Facet_const_handle            Facet_handle; 
+    
+    typedef std::vector <Ikernel::Point_3>      Interval_nodes;
+    typedef std::vector <Exact_kernel::Point_3> Exact_nodes;
+ 
+        
+  //members
+    Interval_nodes  inodes;
+    Exact_nodes enodes;
+  
+    Interval_to_double  interval_to_double;
+    Exact_to_interval   exact_to_interval;
+    Double_to_interval  double_to_interval;
+    Double_to_exact double_to_exact;
+    Exact_kernel        ek;
+    
+  public:
+    typedef CGAL::Interval_nt<false>::Protector                 Protector;  
+  
+    typename Kernel::Point_3
+    operator[](int i) const {
+      return interval_to_double(inodes[i]);
+    }
+    
+    const typename Ikernel::Point_3&
+    interval_node(int i) const {
+      return inodes[i];
+    }
+    
+    typename Ikernel::Point_3
+    to_interval(const typename Kernel::Point_3& p) const {
+      return double_to_interval(p);
+    }
+    
+    const Exact_kernel::Point_3
+    exact_node(int i) const {
+      return enodes[i];
+    }
+
+    typename Exact_kernel::Point_3
+    to_exact(const typename Kernel::Point_3& p) const {
+      return double_to_exact(p);
+    }    
+    
+    
+    size_t size() const {return enodes.size();}
+
+    void add_new_node(const Exact_kernel::Point_3& p){
+      const Ikernel::Point_3& p_approx=p.approx();
+      if ( !has_smaller_relative_precision(p_approx.x(),Lazy_exact_nt<typename Exact_kernel::FT>::get_relative_precision_of_to_double()) ||
+           !has_smaller_relative_precision(p_approx.y(),Lazy_exact_nt<typename Exact_kernel::FT>::get_relative_precision_of_to_double()) ||
+           !has_smaller_relative_precision(p_approx.z(),Lazy_exact_nt<typename Exact_kernel::FT>::get_relative_precision_of_to_double()) ) p.exact();
+      enodes.push_back(p);
+      inodes.push_back( exact_to_interval(p) );
+    }
+
+    void add_new_node(Halfedge_handle edge,Facet_handle facet)
+    {
+      add_new_node(compute_triangle_segment_intersection_point<Polyhedron,Kernel>(edge,facet,ek) );
+    }
+
+    //the point is an input
+    void add_new_node(const typename Kernel::Point_3& p){
+      enodes.push_back(to_exact(p));
+      inodes.push_back( double_to_interval(p) );
+    }
+  }; // end specialization
+     // Triangle_segment_intersection_points<Polyhedron,Kernel,Predicates_on_constructions,false>
+  
+  //Third specialization: The kernel already has exact constructions.
+  template <class Polyhedron,class Kernel,class Node_storage>
+  class Triangle_segment_intersection_points<Polyhedron,Kernel,Node_storage,true>
+  {
+  //typedefs
+    typedef std::vector <typename Kernel::Point_3>             Nodes_vector;
+    typedef typename Polyhedron::Halfedge_const_handle         Halfedge_handle;
+    typedef typename Polyhedron::Facet_const_handle            Facet_handle;
+  //members
+    Nodes_vector nodes;
+    Kernel k;
+  public:
+    typedef Kernel Ikernel;
+    typedef Kernel Exact_kernel;
+    typedef void* Protector;
+    const typename Kernel::Point_3&
+    operator[](int i) const {
+      return nodes[i];
+    }
+   
+    size_t size() const {return nodes.size();}
+    const typename Kernel::Point_3& exact_node(int i) const {return nodes[i];}
+    const typename Kernel::Point_3& interval_node(int i) const {return nodes[i];}
+    
+    //add a new node in the final graph.
+    //it is the intersection of the triangle with the segment
+    void add_new_node(Halfedge_handle edge,Facet_handle facet)
+    {
+      nodes.push_back (  
+        compute_triangle_segment_intersection_point<Polyhedron,Kernel>(edge,facet,k)
+      );
+    }
+
+    void add_new_node(const typename Kernel::Point_3& p)
+    {
+      nodes.push_back(p);
+    }
+    
+    const typename Kernel::Point_3& to_interval(const typename Kernel::Point_3& p) const { return p; }
+    const typename Kernel::Point_3& to_exact(const typename Kernel::Point_3& p) const { return p; }
+
+  }; // end specialization
+     // Triangle_segment_intersection_points<Polyhedron,Kernel,Node_storage,true>
+  
+}
+
+#ifdef CGAL_COREFINEMENT_DO_REPORT_SELF_INTERSECTIONS
+struct Intersection_of_Polyhedra_3_self_intersection_exception
+  : public std::logic_error
+  {
+    Intersection_of_Polyhedra_3_self_intersection_exception()
+      : std::logic_error("Self-intersection found in the facets involved in the intersection")
+    {}
+  };
+#endif
+
+//TODO an important requirement is that the Polyhedron should be based on a list-based
+//HDS. We use a lot of maps that use the address of Facet,Halfedge and a reallocation would
+//be dramatic.
+
+template< class Polyhedron,
+          class Kernel=typename Polyhedron::Traits::Kernel,
+          class Node_visitor=Empty_node_visitor<Polyhedron>,
+          class Node_storage_type=typename Node_visitor::Node_storage_type,
+          class Use_const_polyhedron=typename Node_visitor::Is_polyhedron_const
+         >
+class Intersection_of_Polyhedra_3{
+
+//typedefs  
+  typedef typename Kernel::Triangle_3                        Triangle;
+  typedef typename Kernel::Segment_3                         Segment;
+  typedef internal_IOP::
+    Polyhedron_types<Polyhedron,Use_const_polyhedron>        Polyhedron_types;
+  
+  typedef typename Polyhedron_types::Polyhedron_ref          Polyhedron_ref;
+  typedef typename Polyhedron_types::Halfedge_handle         Halfedge_handle;
+  typedef typename Polyhedron_types::Halfedge_iterator       Halfedge_iterator;
+  typedef typename Polyhedron_types::Facet_iterator          Facet_iterator;
+  typedef typename Polyhedron_types::Facet_handle            Facet_handle;
+  typedef typename Polyhedron_types::Vertex_handle           Vertex_handle;
+  typedef typename Polyhedron_types::Vertex                  Vertex;
+  typedef typename Polyhedron_types::Facet                   Facet;
+  typedef CGAL::Box_intersection_d::Box_with_handle_d<
+            double, 3, Halfedge_handle>                      Box;
+  typedef std::pair<Facet_handle,Facet_handle>               Facet_pair;
+  typedef std::pair<Facet_pair,int>                          Facet_pair_and_int;
+  
+  typedef internal_IOP::
+            Compare_handles<Polyhedron,Use_const_polyhedron> Compare_handles;
+
+  typedef internal_IOP::
+       Compare_handle_pairs<Polyhedron,Use_const_polyhedron> Compare_handle_pairs;
+  
+
+  typedef std::map<Facet_pair_and_int,                                           //we use Facet_pair_and_int and not Facet_pair to handle coplanar case.
+                   std::set<int>,Compare_handle_pairs>       Facets_to_nodes_map;//Indeed the boundary of the intersection of two coplanar triangles may contain several segments.
+  typedef std::set<Facet_pair,Compare_handle_pairs>          Coplanar_facets_set;//any insertion should be done with make_sorted_pair_of_facets
+  typedef typename Kernel::Point_3                           Node;
+  typedef internal_IOP::Triangle_segment_intersection_points
+            <Polyhedron,Kernel,Node_storage_type>            Nodes_vector;
+
+  typedef typename internal_IOP::
+    Intersection_types<Polyhedron,Use_const_polyhedron>
+      ::Intersection_result                                  Intersection_result;
+
+  typedef std::set<Facet_handle,Compare_handles>             Facet_set;
+
+  typedef std::map
+            <Halfedge_handle,Facet_set,Compare_handles>      Edge_to_intersected_facets;
+  #ifdef USE_DETECTION_MULTIPLE_DEFINED_EDGES
+  typedef std::set<Facet_pair,Compare_handle_pairs>          Coplanar_duplicated_intersection_set;
+  #endif
+//helper functions
+  static inline Facet_pair 
+  make_sorted_pair_of_facets(Facet_handle fh1,Facet_handle fh2) {
+    const Facet* f1=&(*fh1);
+    const Facet* f2=&(*fh2);
+    if (f1 < f2)
+      return Facet_pair(fh1,fh2);
+    return Facet_pair(fh2,fh1);
+  }
+
+  static inline Facet_pair_and_int
+  make_sorted_pair_of_facets_with_int(Facet_handle fh1,Facet_handle fh2,int i) {
+    return std::make_pair(make_sorted_pair_of_facets(fh1,fh2),i);
+  }
+
+  static inline std::pair<void*,void*> make_sorted_void_pair(void* v1,void* v2){
+    if (v1<v2) return std::make_pair(v1,v2);
+    return std::make_pair(v2,v1);
+  }
+
+  static inline Halfedge_handle smaller_handle(Halfedge_handle h){
+    if ( &(*h)<&(*h->opposite()) ) return h;
+    return h->opposite();
+  }
+  
+//member variables
+  Edge_to_intersected_facets  edge_to_sfacet; //Associate a segment to a filtered set of facets that may be intersected
+  Facets_to_nodes_map         f_to_node;      //Associate a pair of triangle to their intersection points
+  Coplanar_facets_set         coplanar_facets;//Contains all pairs of triangular facets intersecting that are coplanar
+  Nodes_vector                nodes;          //Contains intersection points of polyhedra
+  Node_visitor*               visitor;
+  bool                        is_default_visitor; //indicates whether the visitor need to be deleted
+  #ifdef USE_DETECTION_MULTIPLE_DEFINED_EDGES
+  //this does not occur only when one extremity of an edge is inside a face.
+  // The problem occur every time an edge or a part of an edge with two incident triangles
+  // is on the intersection polyline, I choose to direcly filter the output by removing duplicated edges
+  Coplanar_duplicated_intersection_set coplanar_duplicated_intersection;//Set containing edges that are duplicated because of edges (partially) included in a triangle
+  #endif
+  
+//functions that should come from a traits class
+  bool has_at_least_two_incident_faces(Halfedge_handle edge)
+  {
+    return !edge->is_border_edge();
+  }
+  
+  template <class Output_iterator>
+  void get_incident_facets(Halfedge_handle edge,Output_iterator out){
+    if (!edge->is_border()) *out++=edge->facet();
+    if (!edge->opposite()->is_border()) *out++=edge->opposite()->facet();
+  }
+
+  template <class Output_iterator>
+  void get_incident_edges_to_vertex(Halfedge_handle edge,Output_iterator out){
+    Halfedge_handle current=edge;
+    do{
+      *out++=current;
+      current=current->next()->opposite();
+    }
+    while(current!=edge);
+  }
+
+//internal functions
+  
+  class Map_edge_facet_bbox_intersection {
+    Edge_to_intersected_facets& edge_to_sfacet;
+    Polyhedron_ref polyhedron_triangle;
+    Polyhedron_ref polyhedron_edge;
+    Node_visitor& visitor;
+  public:
+    Map_edge_facet_bbox_intersection(Edge_to_intersected_facets& map_,
+                                     Polyhedron_ref  P,
+                                     Polyhedron_ref Q,
+                                     Node_visitor& visitor_)
+      :edge_to_sfacet(map_),polyhedron_triangle(P),polyhedron_edge(Q),visitor(visitor_){}
+
+    void operator()( const Box* fb, const Box* eb) const {
+      Halfedge_handle fh = fb->handle();
+      Halfedge_handle eh = eb->handle();
+
+      // The following call to map::insert() attempts an insertion of a pair
+      // into 'edge_to_sfacet'. If 'eh' is already inserted in the map,
+      // then the result 'res' is the current entry in the map for 'eh'.
+      typename Edge_to_intersected_facets::iterator res=
+        edge_to_sfacet.insert(std::make_pair(eh,Facet_set())).first;
+
+      res->second.insert(fh->facet());
+      // That could have been shortened to:
+      //
+      //       edge_to_sfacet[eh].insert(fh->facet())
+      //
+      // -- Laurent Rineau, 2012/11/01
+
+      visitor.add_filtered_intersection(eh,fh,polyhedron_edge,polyhedron_triangle);
+    }
+  };
+
+  class Map_edge_facet_bbox_intersection_extract_coplanar {
+    Edge_to_intersected_facets& edge_to_sfacet;
+    Coplanar_facets_set& coplanar_facets;
+    Polyhedron_ref polyhedron_triangle;
+    Polyhedron_ref polyhedron_edge;
+    Node_visitor& visitor;
+  public:
+    Map_edge_facet_bbox_intersection_extract_coplanar(
+      Edge_to_intersected_facets& map_,
+      Coplanar_facets_set& coplanar_facets_,
+      Polyhedron_ref  P,
+      Polyhedron_ref Q,
+      Node_visitor& visitor_)
+      :edge_to_sfacet(map_),coplanar_facets(coplanar_facets_),polyhedron_triangle(P),polyhedron_edge(Q),visitor(visitor_)
+    {}
+
+    void operator()( const Box* fb, const Box* eb) const {
+      Halfedge_handle fh = fb->handle(); //handle for the face
+      Halfedge_handle eh = eb->handle(); //handle for the edge
+      if(eh->is_border()) eh = eh->opposite();
+      CGAL_assertion(!eh->is_border());
+      
+      //check if the segment intersects the plane of the facet or if it is included in the plane
+      const typename Kernel::Point_3 & a = fh->vertex()->point();
+      const typename Kernel::Point_3 & b = fh->next()->vertex()->point();
+      const typename Kernel::Point_3 & c = fh->next()->next()->vertex()->point();
+      const Orientation abcp = orientation(a,b,c,eh->vertex()->point());
+      const Orientation abcq = orientation(a,b,c,eh->opposite()->vertex()->point());
+      if (abcp==abcq){
+        if (abcp!=COPLANAR){
+//          std::cout << "rejected " << &(*fh->facet()) << "{" << &(*eh->facet()) << " " <<&(*eh->opposite()->facet()) << " "<< eh->vertex()->point() << " " << eh->opposite()->vertex()->point() << "}" <<std::endl;
+          return; //no intersection
+        }
+        //WARNING THIS IS DONE ONLY FOR POLYHEDRON (MAX TWO INCIDENT FACETS TO EDGE)
+        if (/* !eh->is_border() && */ orientation(a,b,c,eh->next()->vertex()->point())==COPLANAR){
+          coplanar_facets.insert(make_sorted_pair_of_facets(eh->facet(),fh->facet()));
+        }
+        if (!eh->opposite()->is_border() && orientation(a,b,c,eh->opposite()->next()->vertex()->point())==COPLANAR){
+          coplanar_facets.insert(make_sorted_pair_of_facets(eh->opposite()->facet(),fh->facet()));
+        }
+        visitor.add_filtered_intersection(eh,fh,polyhedron_edge,polyhedron_triangle);
+        //in case only the edge is coplanar, the intersection points will be detected using an incident facet 
+        //(see remark at the beginning of the file)
+        return; 
+      }
+      
+      typename Edge_to_intersected_facets::iterator res=
+        edge_to_sfacet.insert(std::make_pair(eh,Facet_set())).first;
+      res->second.insert(fh->facet());
+      visitor.add_filtered_intersection(eh,fh,polyhedron_edge,polyhedron_triangle);
+    }
+  };
+
+  class Map_edge_facet_bbox_intersection_extract_coplanar_filter_self_intersections {
+    Polyhedron_ref polyhedron_triangle;
+    Polyhedron_ref polyhedron_edge;
+
+    std::set<Facet_handle>& m_reported_facets;
+    std::vector<std::pair<const Box*,const Box*> >& m_intersecting_bboxes;
+  public:
+    Map_edge_facet_bbox_intersection_extract_coplanar_filter_self_intersections(
+      Polyhedron_ref  P,
+      Polyhedron_ref Q,
+      std::set<Facet_handle>& reported_facets,
+      std::vector<std::pair<const Box*,const Box*> >& intersecting_bboxes
+    )
+      : polyhedron_triangle(P)
+      , polyhedron_edge(Q)
+      , m_reported_facets(reported_facets)
+      , m_intersecting_bboxes(intersecting_bboxes)
+    {}
+
+    void operator()( const Box* fb, const Box* eb) {
+      m_reported_facets.insert( fb->handle()->facet() );
+      m_intersecting_bboxes.push_back( std::make_pair(fb, eb) );
+    }
+
+    bool self_intersections_found()
+    {
+      try{
+        typedef typename CGAL::Box_intersection_d::Box_with_info_d<double, 3, Facet_handle> Box;
+
+        // make one box per facet
+        std::vector<Box> boxes;
+        boxes.reserve(m_reported_facets.size());
+
+        BOOST_FOREACH(Facet_handle fh, m_reported_facets)
+        {
+          boxes.push_back( Box( fh->halfedge()->vertex()->point().bbox() +
+                                fh->halfedge()->next()->vertex()->point().bbox() +
+                                fh->halfedge()->opposite()->vertex()->point().bbox(), fh )
+          );
+        }
+
+        // generate box pointers
+        std::vector<const Box*> box_ptr;
+        box_ptr.reserve(boxes.size());
+        typename std::vector<Box>::iterator b;
+        for(b = boxes.begin();
+          b != boxes.end();
+          b++)
+          box_ptr.push_back(&*b);
+
+        // compute self-intersections filtered out by boxes
+        typedef boost::function_output_iterator<internal::Throw_at_output> OutputIterator;
+        OutputIterator out;
+        internal::Intersect_facets<Polyhedron,Kernel,
+                                   Box,OutputIterator,
+                                   typename boost::property_map<Polyhedron,boost::vertex_point_t>::type>
+          intersect_facets(polyhedron_triangle, out, get(boost::vertex_point, polyhedron_triangle), Kernel());
+        std::ptrdiff_t cutoff = 2000;
+        CGAL::box_self_intersection_d(box_ptr.begin(), box_ptr.end(),intersect_facets,cutoff);
+        return false;
+      }
+      catch( internal::Throw_at_output::Throw_at_output_exception& )
+      {
+        return true;
+      }
+    }
+  };
+  
+  // This function tests the intersection of the faces of P with the edges of Q
+  void filter_intersections( Polyhedron_ref P, Polyhedron_ref Q) {
+    std::vector<Box> facet_boxes, edge_boxes;
+    facet_boxes.reserve( P.size_of_facets());
+    for ( Facet_iterator i = P.facets_begin(); i != P.facets_end(); ++i){
+        facet_boxes.push_back(
+            Box( i->halfedge()->vertex()->point().bbox()
+               + i->halfedge()->next()->vertex()->point().bbox()
+               + i->halfedge()->next()->next()->vertex()->point().bbox(),
+                 i->halfedge()));
+    }
+    std::vector<const Box*> facet_box_ptr;
+    facet_box_ptr.reserve( P.size_of_facets());
+    for ( typename std::vector<Box>::iterator j = facet_boxes.begin(); j != facet_boxes.end(); ++j){
+        facet_box_ptr.push_back( &*j);
+    }
+      
+    for ( Halfedge_iterator i = Q.halfedges_begin(); i != Q.halfedges_end(); ++i){
+      if(&*i < &*(i->opposite())){
+        edge_boxes.push_back(
+            Box( i->vertex()->point().bbox()
+                 + i->opposite()->vertex()->point().bbox(),
+                 i));
+      }
+   }
+   
+    std::vector<const Box*> edge_box_ptr;
+    edge_box_ptr.reserve( Q.size_of_halfedges()/2);
+    for ( typename std::vector<Box>::iterator j = edge_boxes.begin(); j != edge_boxes.end(); ++j){
+        edge_box_ptr.push_back( &*j);
+    }
+
+  #ifdef CGAL_COREFINEMENT_DO_REPORT_SELF_INTERSECTIONS
+    // this version first collect faces involved in the intersection and first
+    // check if they are involved in a self-intersection.
+    std::set<Facet_handle> reported_facets;
+    std::vector<std::pair<const Box*,const Box*> > intersecting_bboxes;
+    Map_edge_facet_bbox_intersection_extract_coplanar_filter_self_intersections
+      inter_functor4selfi(P, Q, reported_facets, intersecting_bboxes);
+    CGAL::box_intersection_d( facet_box_ptr.begin(), facet_box_ptr.end(),
+                              edge_box_ptr.begin(), edge_box_ptr.end(),
+                              inter_functor4selfi, std::ptrdiff_t(2000) );
+
+    if (inter_functor4selfi.self_intersections_found()) throw Intersection_of_Polyhedra_3_self_intersection_exception();
+
+    #ifdef DO_NOT_HANDLE_COPLANAR_FACETS
+    Map_edge_facet_bbox_intersection inter_functor(edge_to_sfacet,P,Q,*visitor);
+    #else // not DO_NOT_HANDLE_COPLANAR_FACETS
+    Map_edge_facet_bbox_intersection_extract_coplanar inter_functor(edge_to_sfacet,coplanar_facets,P,Q,*visitor);
+    #endif // not DO_NOT_HANDLE_COPLANAR_FACETS
+
+    typedef std::pair<const Box*,const Box*> Type_pair;
+    BOOST_FOREACH(const Type_pair& p, intersecting_bboxes)
+      inter_functor(p.first, p.second);
+  #else
+    CGAL::box_intersection_d( facet_box_ptr.begin(), facet_box_ptr.end(),
+                              edge_box_ptr.begin(), edge_box_ptr.end(),
+    #ifdef DO_NOT_HANDLE_COPLANAR_FACETS
+                              // Note that 'edge_to_sfacet' is passed by
+                              // non-const reference, here, to be filled.
+                              Map_edge_facet_bbox_intersection(edge_to_sfacet,P,Q,*visitor),
+    #else // not DO_NOT_HANDLE_COPLANAR_FACETS
+                              Map_edge_facet_bbox_intersection_extract_coplanar(edge_to_sfacet,coplanar_facets,P,Q,*visitor),
+    #endif // not DO_NOT_HANDLE_COPLANAR_FACETS
+                              std::ptrdiff_t(2000)
+    );
+  #endif
+  }
+
+
+  void add_intersection_point_to_facet_and_all_edge_incident_facets(Facet_handle facet,
+                                                                    Halfedge_handle edge,
+                                                                    int node_id)
+  {
+    std::vector<Facet_handle> incident_facets;
+    get_incident_facets(edge,std::back_inserter(incident_facets));
+    for (typename std::vector<Facet_handle>::iterator it=incident_facets.begin();
+         it!=incident_facets.end();++it)
+    {
+      CGAL_assertion(cgal_do_intersect_debug(facet,*it));
+      
+      Facet_pair facet_pair = make_sorted_pair_of_facets(facet,*it);
+      if ( !coplanar_facets.empty() && coplanar_facets.find(facet_pair)!=coplanar_facets.end() ) continue;
+      typename Facets_to_nodes_map::iterator it_list=
+        f_to_node.insert( std::make_pair( Facet_pair_and_int(facet_pair,0),std::set<int>()) ).first;
+      it_list->second.insert(node_id);
+    }
+  }
+
+  void cip_handle_case_edge(int node_id,
+                            Facet_set* fset,
+                            Halfedge_handle edge,
+                            Halfedge_handle edge_intersected)
+  {
+    //associate the intersection point to all facets incident to the intersected edge using edge
+    std::vector<Facet_handle> incident_facets;
+    get_incident_facets(edge_intersected,std::back_inserter(incident_facets));
+    for (typename std::vector<Facet_handle>::iterator it=incident_facets.begin();
+         it!=incident_facets.end();++it)
+    {
+      add_intersection_point_to_facet_and_all_edge_incident_facets(*it,edge,node_id);
+      if (fset!=NULL) fset->erase(*it);
+    }
+    incident_facets.clear();
+
+    //associate the intersection point to all facets incident to edge using the intersected edge
+    //at least one pair of facets is already handle above
+    
+    typename Edge_to_intersected_facets::iterator it_fset=edge_to_sfacet.find(edge_intersected);
+    if (it_fset==edge_to_sfacet.end()) return;
+    Facet_set& fset_bis=it_fset->second;
+    get_incident_facets(edge,std::back_inserter(incident_facets));
+    for (typename std::vector<Facet_handle>::iterator it=incident_facets.begin();
+         it!=incident_facets.end();++it)
+    {
+//      add_intersection_point_to_facet_and_all_edge_incident_facets(*it,edge_intersected,node_id); //this call is not needed, already done in the first loop
+      fset_bis.erase(*it);
+    }
+  }
+
+  void cip_handle_case_vertex(int node_id,
+                              Facet_set* fset,
+                              Halfedge_handle edge,
+                              Halfedge_handle vertex_intersected)
+  {
+    std::vector<Halfedge_handle> incident_halfedges;
+    get_incident_edges_to_vertex(vertex_intersected,std::back_inserter(incident_halfedges));
+    for (typename std::vector<Halfedge_handle>::iterator 
+      it=incident_halfedges.begin();it!=incident_halfedges.end();++it)
+    {
+      cip_handle_case_edge(node_id,fset,edge,*it);
+    }
+  }
+
+  //add a new node in the final graph.
+  //it is the intersection of the triangle with the segment
+  void add_new_node(Halfedge_handle edge,
+                    Facet_handle facet,
+                    const Intersection_result& inter_res,
+                    Nodes_vector& nodes)
+  {
+    bool is_vertex_coplanar = CGAL::cpp11::get<2>(inter_res);
+    if (is_vertex_coplanar)
+      nodes.add_new_node(edge->vertex()->point());
+    else{
+      bool is_opposite_vertex_coplanar = CGAL::cpp11::get<3>(inter_res);
+      if (is_opposite_vertex_coplanar)
+        nodes.add_new_node(edge->opposite()->vertex()->point());
+      else
+        nodes.add_new_node(edge,facet);
+    }
+  }
+
+  //either the exact or input point can be used to create a node
+  //with this function
+  template<class Point>
+  void add_new_node(const Point& pt)
+  {
+    nodes.add_new_node(pt);
+  }
+
+  
+  #ifdef USE_DETECTION_MULTIPLE_DEFINED_EDGES
+  void check_coplanar_edge(Halfedge_handle hedge,Facet_handle facet)
+  {
+    const typename Kernel::Point_3& p0=facet->halfedge()->vertex()->point();
+    const typename Kernel::Point_3& p1=facet->halfedge()->next()->vertex()->point();
+    const typename Kernel::Point_3& p2=facet->halfedge()->opposite()->vertex()->point();
+    CGAL_precondition( orientation( p0,p1,p2,hedge->vertex()->point() ) == COPLANAR );
+
+    if ( has_at_least_two_incident_faces(hedge) &&  orientation( p0,p1,p2,hedge->opposite()->vertex()->point() ) == COPLANAR )
+    {
+      //In case two facets are incident along such this edge, the intersection
+      //will be reported twice. We keep track of this so that at the end, we can remove one intersecting edge out of the two
+      //choose the smaller of the two faces (only one need to de deleted)
+      Facet_handle smaller=make_sorted_pair_of_facets(hedge->face(),hedge->opposite()->face()).first;
+      coplanar_duplicated_intersection.insert(make_sorted_pair_of_facets(smaller,facet));
+    }    
+  }
+  
+  bool are_incident_facets_coplanar(Halfedge_handle hedge){
+    const typename Kernel::Point_3& p0=hedge->vertex()->point();
+    const typename Kernel::Point_3& p1=hedge->next()->vertex()->point();
+    const typename Kernel::Point_3& p2=hedge->opposite()->vertex()->point();
+    const typename Kernel::Point_3& p3=hedge->opposite()->next()->vertex()->point();
+    return orientation( p0,p1,p2,p3 ) == COPLANAR;
+  }
+
+  void check_coplanar_edge(Halfedge_handle hedge,Halfedge_handle additional_edge,internal_IOP::Intersection_type type)
+  {
+    switch(type){
+      case internal_IOP::FACET:
+        check_coplanar_edge(hedge,additional_edge->face());
+      break;
+      
+      case internal_IOP::EDGE:
+        if ( !additional_edge->is_border() ){
+          check_coplanar_edge(hedge,additional_edge->face());
+        }
+        if (!additional_edge->opposite()->is_border())
+          check_coplanar_edge(hedge,additional_edge->opposite()->face());
+      break;        
+      case internal_IOP::VERTEX:
+      {
+        //consider  all incident faces
+        Halfedge_handle current=additional_edge;
+        do{
+          if( !current->is_border() )
+          check_coplanar_edge(hedge,current->face());
+          current=current->next()->opposite();
+        }
+        while(current!=additional_edge);
+      }
+      break;
+      
+      default:
+        CGAL_assertion(type==internal_IOP::COPLNR);
+      break;
+    }    
+  }
+  
+  void check_coplanar_edge_old(Halfedge_handle hedge,Halfedge_handle additional_edge,internal_IOP::Intersection_type type)
+  {
+    switch(type){
+      case internal_IOP::FACET:
+        check_coplanar_edge(hedge,additional_edge->face());
+      break;
+      
+      case internal_IOP::EDGE:
+      {
+        if ( !additional_edge->is_border() ){
+          if (!additional_edge->opposite()->is_border()){
+            if ( are_incident_facets_coplanar(additional_edge) )
+            {
+              Facet_handle facet=additional_edge->face();
+              const typename Kernel::Point_3& p0=facet->halfedge()->vertex()->point();
+              const typename Kernel::Point_3& p1=facet->halfedge()->next()->vertex()->point();
+              const typename Kernel::Point_3& p2=facet->halfedge()->opposite()->vertex()->point();
+              CGAL_precondition( orientation( p0,p1,p2,hedge->vertex()->point() ) == COPLANAR );
+
+              if ( has_at_least_two_incident_faces(hedge) &&  orientation( p0,p1,p2,hedge->opposite()->vertex()->point() ) == COPLANAR )
+              {
+                //In case two facets are incident along a common edge of two coplanar triangles.
+                //We need to remove three out of the four reported pair
+                Facet_handle smaller=make_sorted_pair_of_facets(hedge->face(),hedge->opposite()->face()).first;
+                coplanar_duplicated_intersection.insert(make_sorted_pair_of_facets(hedge->face(),facet));
+                coplanar_duplicated_intersection.insert(make_sorted_pair_of_facets(hedge->opposite()->face(),facet));
+                coplanar_duplicated_intersection.insert(make_sorted_pair_of_facets(hedge->opposite()->face(),additional_edge->opposite()->face()));
+              }              
+            }
+            else
+            {
+              check_coplanar_edge(hedge,additional_edge->face());
+              check_coplanar_edge(hedge,additional_edge->opposite()->face());
+            }
+          }
+          else
+            check_coplanar_edge(hedge,additional_edge->face());
+        }
+        else{
+          CGAL_assertion(!additional_edge->opposite()->is_border());
+          check_coplanar_edge(hedge,additional_edge->opposite()->face());
+        }
+      }
+      break;        
+      case internal_IOP::VERTEX:
+        
+      break;
+      
+      default:
+        CGAL_assertion(type==internal_IOP::COPLNR);
+      break;
+    }    
+  }
+  
+  template <class Hedge_iterator>
+  void check_coplanar_edges(Hedge_iterator begin,Hedge_iterator end,Halfedge_handle additional_edge,internal_IOP::Intersection_type type)
+  {
+    for (Hedge_iterator it=begin;it!=end;++it)
+      check_coplanar_edge(*it,additional_edge,type);
+  }
+  #endif // USE_DETECTION_MULTIPLE_DEFINED_EDGES
+  
+  void print_type_debug(internal_IOP::Intersection_type type,bool cpl,bool opp_cpl)
+  {
+    switch(type){
+      case internal_IOP::COPLNR:
+        std::cout << "COPLNR " << cpl << " " <<  opp_cpl << std::endl;
+      break;
+      case internal_IOP::EMPTY:
+        std::cout << "EMPTY " << cpl << " " <<  opp_cpl << std::endl;
+      break;
+      
+      case internal_IOP::FACET:
+        std::cout << "FACET " << cpl << " " <<  opp_cpl << std::endl;
+      break;
+      
+      case internal_IOP::EDGE:
+        std::cout << "EDGE " << cpl << " " <<  opp_cpl << std::endl;
+      break;        
+      case internal_IOP::VERTEX:
+        std::cout << "VERTEX " << cpl << " " <<  opp_cpl << std::endl;
+      break;
+    }
+  }
+  
+
+  void handle_coplanar_case_VERTEX_FACET(Halfedge_handle vertex,Halfedge_handle facet,int node_id){
+    visitor->new_node_added(node_id,internal_IOP::FACET,vertex,facet,true,false);
+    std::vector<Halfedge_handle> all_edges;
+    get_incident_edges_to_vertex(vertex,std::back_inserter(all_edges));
+    typename std::vector<Halfedge_handle>::iterator it_edge=all_edges.begin();
+    for (;it_edge!=all_edges.end();++it_edge){
+      add_intersection_point_to_facet_and_all_edge_incident_facets(facet->facet(),*it_edge,node_id);
+      typename Edge_to_intersected_facets::iterator it_ets=edge_to_sfacet.find(*it_edge);
+      if (it_ets!=edge_to_sfacet.end()) it_ets->second.erase(facet->facet());
+    }
+  }
+  
+  void handle_coplanar_case_VERTEX_EDGE(Halfedge_handle vertex,Halfedge_handle edge,int node_id){
+    visitor->new_node_added(node_id,internal_IOP::VERTEX,edge,vertex,false,false);
+    std::vector<Halfedge_handle> all_edges;
+    get_incident_edges_to_vertex(vertex,std::back_inserter(all_edges));
+    typename std::vector<Halfedge_handle>::iterator it_edge=all_edges.begin();
+    for (;it_edge!=all_edges.end();++it_edge){
+      typename Edge_to_intersected_facets::iterator it_ets=edge_to_sfacet.find(*it_edge);
+      Facet_set* fset = (it_ets!=edge_to_sfacet.end())?&(it_ets->second):NULL;
+      cip_handle_case_edge(node_id,fset,*it_edge,edge);
+    }
+  }
+
+  void handle_coplanar_case_VERTEX_VERTEX(Halfedge_handle vertex1,Halfedge_handle vertex2,int node_id){
+    visitor->new_node_added(node_id,internal_IOP::VERTEX,vertex2,vertex1,true,false);
+    std::vector<Halfedge_handle> all_edges;
+    get_incident_edges_to_vertex(vertex1,std::back_inserter(all_edges));
+    typename std::vector<Halfedge_handle>::iterator it_edge=all_edges.begin();          
+    for (;it_edge!=all_edges.end();++it_edge){
+      typename Edge_to_intersected_facets::iterator it_ets=edge_to_sfacet.find(*it_edge);
+      Facet_set* fset = (it_ets!=edge_to_sfacet.end())?&(it_ets->second):NULL;
+      cip_handle_case_vertex(node_id,fset,*it_edge,vertex2);
+    }
+  }
+  
+  
+  template<class Cpl_inter_pt,class Coplanar_node_map>
+  int get_or_create_node(Cpl_inter_pt& ipt,int& current_node,Coplanar_node_map& coplanar_node_map){
+    void *v1, *v2;
+    switch(ipt.type_1){
+      case internal_IOP::VERTEX: v1=(void*)( &(*(ipt.info_1->vertex()))     );  break;
+      case internal_IOP::EDGE  : v1=(void*)( &(*smaller_handle(ipt.info_1)) );  break;
+      case internal_IOP::FACET : v1=(void*)( &(*(ipt.info_1->facet()))      );  break;
+      default: CGAL_error_msg("Should not get there!");
+    }
+
+    switch(ipt.type_2){
+      case internal_IOP::VERTEX: v2=(void*)( &(*(ipt.info_2->vertex()))     );  break;
+      case internal_IOP::EDGE  : v2=(void*)( &(*smaller_handle(ipt.info_2)) );  break;
+      case internal_IOP::FACET : v2=(void*)( &(*(ipt.info_2->facet()))      );  break;
+      default: CGAL_error_msg("Should not get there!");
+    }
+
+    std::pair<void*,void*> key=make_sorted_void_pair(v1,v2);
+
+    std::pair<typename Coplanar_node_map::iterator,bool> res=coplanar_node_map.insert(std::make_pair(key,current_node+1));
+    if (res.second){ //insert a new node
+      
+      if (ipt.type_1==internal_IOP::VERTEX)
+        add_new_node(ipt.info_1->vertex()->point());
+      else{
+        if(ipt.type_2==internal_IOP::VERTEX)
+          add_new_node(ipt.info_2->vertex()->point());
+        else
+          add_new_node(ipt.point);
+      }
+      return ++current_node;
+    }
+    return res.first->second;
+  }
+  
+  void compute_intersection_of_coplanar_facets(int& current_node){
+    typedef std::map<std::pair<void*,void*>,int> Coplanar_node_map;
+    Coplanar_node_map coplanar_node_map;
+    
+    for (typename Coplanar_facets_set::iterator it=coplanar_facets.begin();it!=coplanar_facets.end();++it){
+      Facet_handle f1=it->first;
+      Facet_handle f2=it->second;
+      typedef internal_IOP::Intersection_point_with_info<Kernel,Halfedge_handle> Cpl_inter_pt;
+      std::list<Cpl_inter_pt> inter_pts;
+      internal_IOP::intersection_coplanar_facets<Kernel>(f1->halfedge(),f2->halfedge(),inter_pts);
+//      std::cout << "found " << inter_pts.size() << " inter pts: "; 
+      std::size_t nb_pts=inter_pts.size();
+      std::vector<int> cpln_nodes; cpln_nodes.reserve(nb_pts);
+      for (typename std::list<Cpl_inter_pt>::iterator iti=inter_pts.begin();iti!=inter_pts.end();++iti){
+        #ifdef CGAL_COREFINEMENT_DEBUG
+        //iti->print_debug();
+        #endif
+        CGAL_assertion(iti->is_valid());
+        int node_id=get_or_create_node(*iti,current_node,coplanar_node_map);
+        cpln_nodes.push_back(node_id);
+
+        switch(iti->type_1){
+          case internal_IOP::VERTEX:
+          {
+            switch(iti->type_2){
+              case internal_IOP::VERTEX: handle_coplanar_case_VERTEX_VERTEX(iti->info_1,iti->info_2,node_id); break;
+              case internal_IOP::EDGE  : handle_coplanar_case_VERTEX_EDGE(iti->info_1,iti->info_2,node_id);   break;
+              case internal_IOP::FACET : handle_coplanar_case_VERTEX_FACET(iti->info_1,iti->info_2,node_id);  break;
+              default: CGAL_error_msg("Should not get there!");
+            }
+          }
+          break;
+          case internal_IOP::EDGE:{
+            switch(iti->type_2){
+              case internal_IOP::VERTEX:handle_coplanar_case_VERTEX_EDGE(iti->info_2,iti->info_1,node_id);break;
+              case internal_IOP::EDGE:
+              {
+                visitor->new_node_added(node_id,internal_IOP::EDGE,iti->info_1,iti->info_2,false,false);
+                typename Edge_to_intersected_facets::iterator it_ets=edge_to_sfacet.find(iti->info_1);
+                Facet_set* fset = (it_ets!=edge_to_sfacet.end())?&(it_ets->second):NULL;
+                cip_handle_case_edge(node_id,fset,iti->info_1,iti->info_2);                
+              }
+              break;
+              default: CGAL_error_msg("Should not get there!");
+            }
+          }            
+          break;
+          
+          case internal_IOP::FACET:
+          {
+            CGAL_assertion(iti->type_2==internal_IOP::VERTEX);
+            handle_coplanar_case_VERTEX_FACET(iti->info_2,iti->info_1,node_id);
+          }
+          break;
+          
+          default: CGAL_error_msg("Should not get there!");
+        }
+      }
+      switch (nb_pts){
+        case 0: break;
+        case 1:
+        {
+          typename Facets_to_nodes_map::iterator it_list=  
+            f_to_node.insert( std::make_pair( Facet_pair_and_int(*it,1),std::set<int>()) ).first;
+          it_list->second.insert(cpln_nodes[0]);
+        }
+        break;
+        default:
+        {
+          int i=0;
+          std::size_t stop=nb_pts + (nb_pts<3?-1:0);
+          for (std::size_t k=0;k<stop;++k){
+            typename Facets_to_nodes_map::iterator it_list=
+              f_to_node.insert( std::make_pair( Facet_pair_and_int(*it,++i),std::set<int>()) ).first;
+            it_list->second.insert( cpln_nodes[k] );
+            it_list->second.insert( cpln_nodes[(k+1)%nb_pts] );
+          }
+        }
+      }
+//      std::cout << std::endl;
+    }
+  }
+  
+  void compute_intersection_points(int& current_node){
+    for(typename Edge_to_intersected_facets::iterator it=edge_to_sfacet.begin();it!=edge_to_sfacet.end();++it){
+      Halfedge_handle edge=it->first;
+      Facet_set& fset=it->second;
+      while (!fset.empty()){
+        Facet_handle facet=*fset.begin();
+        
+        Intersection_result res=internal_IOP::do_intersect<Polyhedron,Kernel,Use_const_polyhedron>(edge,facet);
+        internal_IOP::Intersection_type type=CGAL::cpp11::get<0>(res);
+        
+        //handle degenerate case: one extremity of edge below to facet
+        std::vector<Halfedge_handle> all_edges;
+        if ( CGAL::cpp11::get<2>(res) )
+          get_incident_edges_to_vertex(edge,std::back_inserter(all_edges));
+        else{
+          if ( CGAL::cpp11::get<3>(res) )
+            get_incident_edges_to_vertex(edge->opposite(),std::back_inserter(all_edges));
+          else
+            all_edges.push_back(edge);
+        }
+        
+        CGAL_precondition(*all_edges.begin()==edge || *all_edges.begin()==edge->opposite());
+//        print_type_debug(type,CGAL::cpp11::get<2>(res),CGAL::cpp11::get<3>(res));
+       
+        #ifdef USE_DETECTION_MULTIPLE_DEFINED_EDGES
+        check_coplanar_edges(boost::next(all_edges.begin()),all_edges.end(),CGAL::cpp11::get<1>(res),type);
+        #endif
+        
+        typename std::vector<Halfedge_handle>::iterator it_edge=all_edges.begin();
+        switch(type){
+          case internal_IOP::COPLNR:
+            #ifndef DO_NOT_HANDLE_COPLANAR_FACETS
+            CGAL_assertion(!"COPLANR : this point should never be reached!");
+            #else
+            //nothing need to be done, cf. comments at the beginning of the file
+            #endif
+          break;
+          case internal_IOP::EMPTY:
+            fset.erase(fset.begin());
+            CGAL_assertion(!cgal_do_intersect_debug(edge,facet));
+          break;
+
+          // Case when the edge pierces the facet in its interior.
+          case internal_IOP::FACET:
+          {
+            CGAL_assertion(cgal_do_intersect_debug(edge,facet));
+            CGAL_assertion(facet==CGAL::cpp11::get<1>(res)->face());
+
+            int node_id=++current_node;
+            add_new_node(edge,facet,res,nodes);
+            visitor->new_node_added(node_id,internal_IOP::FACET,edge,facet->halfedge(),CGAL::cpp11::get<2>(res),CGAL::cpp11::get<3>(res));
+            for (;it_edge!=all_edges.end();++it_edge){
+              add_intersection_point_to_facet_and_all_edge_incident_facets(facet,*it_edge,node_id);
+              //erase facet from the list to test intersection with it_edge
+              if ( it_edge==all_edges.begin() )
+                fset.erase(fset.begin());
+              else
+              {
+                typename Edge_to_intersected_facets::iterator it_ets=edge_to_sfacet.find(*it_edge);
+                if(it_ets!=edge_to_sfacet.end()) it_ets->second.erase(facet);
+              }
+            }
+          } // end case FACET
+          break;
+
+          // Case when the edge intersect one edge of the facet.
+          case internal_IOP::EDGE:
+          {
+            CGAL_assertion(cgal_do_intersect_debug(edge,facet));
+            int node_id=++current_node;
+            add_new_node(edge,facet,res,nodes);
+            Halfedge_handle edge_intersected=CGAL::cpp11::get<1>(res);
+            visitor->new_node_added(node_id,internal_IOP::EDGE,edge,edge_intersected,CGAL::cpp11::get<2>(res),CGAL::cpp11::get<3>(res));
+            for (;it_edge!=all_edges.end();++it_edge){
+              if ( it_edge!=all_edges.begin() ){
+                typename Edge_to_intersected_facets::iterator it_ets=edge_to_sfacet.find(*it_edge);
+                Facet_set* fset_bis = (it_ets!=edge_to_sfacet.end())?&(it_ets->second):NULL;
+                cip_handle_case_edge(node_id,fset_bis,*it_edge,edge_intersected);
+              }
+              else
+                cip_handle_case_edge(node_id,&fset,*it_edge,edge_intersected);
+            }
+          } // end case EDGE
+          break;
+
+          case internal_IOP::VERTEX:
+          {
+            CGAL_assertion(cgal_do_intersect_debug(edge,facet));
+            int node_id=++current_node;
+            Halfedge_handle vertex_intersected=CGAL::cpp11::get<1>(res);
+            add_new_node(vertex_intersected->vertex()->point()); //we use the original vertex to create the node
+            //before it was internal_IOP::FACET but do not remember why, probably a bug...
+            visitor->new_node_added(node_id,internal_IOP::VERTEX,edge,vertex_intersected,CGAL::cpp11::get<2>(res),CGAL::cpp11::get<3>(res));
+            for (;it_edge!=all_edges.end();++it_edge){
+              if ( it_edge!=all_edges.begin() ){
+                typename Edge_to_intersected_facets::iterator it_ets=edge_to_sfacet.find(*it_edge);
+                Facet_set* fset_bis = (it_ets!=edge_to_sfacet.end())?&(it_ets->second):NULL;                
+                cip_handle_case_vertex(node_id,fset_bis,*it_edge,vertex_intersected);
+              }
+              else
+                cip_handle_case_vertex(node_id,&fset,*it_edge,vertex_intersected);
+            }
+          } // end case VERTEX
+          break;
+
+        } // end switch on the type of the intersection
+      } // end loop on all facets that intersect the edge
+    } // end loop on all entries (edges) in 'edge_to_sfacet'
+    CGAL_assertion(nodes.size()==unsigned(current_node+1));
+  }
+  
+  #ifdef USE_DETECTION_MULTIPLE_DEFINED_EDGES
+  void remove_duplicated_intersecting_edges()
+  {
+    for (typename Coplanar_duplicated_intersection_set::iterator 
+        it=coplanar_duplicated_intersection.begin();
+        it!=coplanar_duplicated_intersection.end();
+        ++it)
+    {
+      typename Facets_to_nodes_map::iterator res=f_to_node.find(*it);
+      //CGAL_assertion(res!=f_to_node.end());
+      //we cannot use a precondition here: in some cases the coplanarity test is not sufficient.
+      //if on surface1 we have to coplanar triangle incident along edge e. Then in surface2, take a triangle
+      //with one edge inside one triangle of surface1 such that one vertex in on e. Then the collinearity test
+      //return true for both faces but only one implies a duplicated edge
+      if(res!=f_to_node.end())
+        f_to_node.erase(res);
+    }
+  }
+  #else // not USE_DETECTION_MULTIPLE_DEFINED_EDGES
+  void remove_duplicated_intersecting_edges()
+  {
+    std::set< std::pair<int,int> > already_seen;
+    std::list<typename Facets_to_nodes_map::iterator> to_erase;
+    for (typename Facets_to_nodes_map::iterator 
+          it=f_to_node.begin();
+          it!=f_to_node.end();
+          ++it
+    )
+    {
+      if (it->second.size()==1) continue;
+      CGAL_precondition(it->second.size()==2);
+      //it->second is a set so int are already sorted
+      bool is_new=already_seen.insert(  std::make_pair(
+                                       *(it->second.begin()),
+                                       *boost::next(it->second.begin()) )
+      ).second;
+      
+      if (!is_new)
+        to_erase.push_back(it);
+    }
+    
+    for ( typename std::list<typename Facets_to_nodes_map::iterator>::iterator
+          it=to_erase.begin();it!=to_erase.end();++it
+    )
+      f_to_node.erase(*it);
+  }
+  #endif // not USE_DETECTION_MULTIPLE_DEFINED_EDGES
+
+
+  struct Graph_node{
+    std::set<int> neighbors;
+    unsigned size;
+    
+    Graph_node():size(0){}
+    
+    void insert(int i){
+      ++size;
+      CGAL_assertion(neighbors.find(i)==neighbors.end());
+      neighbors.insert(i);
+    }
+    
+    void erase(int i){
+      CGAL_assertion(neighbors.find(i)!=neighbors.end());
+      neighbors.erase(i);
+    }
+    void make_terminal() {size=45;}
+    bool is_terminal()const {return size!=2;}
+    bool empty() const {return neighbors.empty();}
+    int top() const {return *neighbors.begin();}
+    void pop() {
+      CGAL_assertion(!neighbors.empty());
+      neighbors.erase(neighbors.begin());
+    }
+  };
+
+
+  template <class Output_iterator>
+  void construct_polylines(Nodes_vector& nodes,Output_iterator out){
+    typedef std::map<int,Graph_node> Graph;
+    Graph graph;
+    
+    //counts the number of time each node has been seen
+    std::size_t nb_nodes=nodes.size();
+    std::vector<int> node_mult(nb_nodes,0);
+    bool isolated_point_seen=false;
+    for (typename Facets_to_nodes_map::iterator it=f_to_node.begin();it!=f_to_node.end();++it){
+      const std::set<int>& segment=it->second;
+      CGAL_assertion(segment.size()==2 || segment.size()==1);
+      if (segment.size()==2){
+        int i=*segment.begin();
+        int j=*boost::next(segment.begin());
+        typename Graph::iterator ins_res=graph.insert(std::make_pair(i,Graph_node())).first;
+        ins_res->second.insert(j);
+        ins_res=graph.insert(std::make_pair(j,Graph_node())).first;
+        ins_res->second.insert(i);
+        ++(node_mult[i]);
+        ++(node_mult[j]);
+      }
+      else{
+        CGAL_assertion(segment.size()==1);
+        isolated_point_seen=true;
+      }
+    }
+    
+    //add isolated points
+    if (isolated_point_seen){
+      for (unsigned index=0;index<nb_nodes;++index)
+        if (node_mult[index]==0){
+          *out++=std::vector<typename Kernel::Point_3>(1,nodes[index]);
+          visitor->start_new_polyline(index,index);
+        }
+    }
+    
+    //visitor call
+    visitor->annotate_graph(graph.begin(),graph.end());
+    
+    bool only_cycle=false;
+    while (!graph.empty()){
+      typename Graph::iterator it=graph.begin();
+      for (;!only_cycle && it!=graph.end();++it){
+        if (it->second.is_terminal()) break;
+      }
+      
+      std::vector<typename Kernel::Point_3> polyline;
+      
+      if(!only_cycle && it!=graph.end()){
+        //this is a polyline
+        int i=it->first;
+        int j=it->second.top();
+        visitor->start_new_polyline(i,j);
+        CGAL_assertion(i!=j);
+        it->second.pop();
+        if (it->second.empty())
+          graph.erase(it);
+        polyline.push_back(nodes[i]);
+        visitor->add_node_to_polyline(i);
+        while(true){
+          it=graph.find(j);
+          CGAL_assertion(it!=graph.end());
+          it->second.erase(i);
+          i=j;
+          polyline.push_back(nodes[i]);
+          visitor->add_node_to_polyline(i);
+          if (it->second.empty()){
+            graph.erase(it);
+            break;
+          }
+          if (it->second.is_terminal()) break;
+          j=it->second.top();
+          it->second.pop();
+          if (it->second.empty())
+            graph.erase(it);
+        }
+        *out++=polyline;
+      }
+      else{
+        //it remains only cycles
+        only_cycle=true;
+        it=graph.begin();
+        int i=it->first;
+        int j=it->second.top();
+        visitor->start_new_polyline(i,j);
+        graph.erase(it);
+        polyline.push_back(nodes[i]);
+        visitor->add_node_to_polyline(i);
+        int first=i;
+        do{
+          it=graph.find(j);
+          it->second.erase(i);
+          i=j;
+          polyline.push_back(nodes[i]);
+          visitor->add_node_to_polyline(i);
+          j=it->second.top();
+          graph.erase(it);
+        }while(j!=first);
+        polyline.push_back(nodes[j]);// we duplicate first point for cycles
+        visitor->add_node_to_polyline(j);
+        *out++=polyline;      
+      }
+    }
+  }
+  
+  int get_other_int(const std::set<int>& s,int i) const {
+    if (*s.begin()!=i) return *s.begin();
+    return *boost::next(s.begin());
+  }
+  
+  template <class T,class Dispatch_out_it>
+  bool is_grabbed(const Dispatch_out_it&) const{
+    return CGAL::Is_in_tuple<T,typename Dispatch_out_it::Value_type_tuple>::value;
+  }
+  
+  
+  template <class OutputIterator>
+  struct Is_dispatch_based_ouput_iterator{
+    typedef  boost::false_type type;
+  };
+
+  template <template<class V_,class O_> class Dispatch_based_output_it,class V,class O>
+  struct Is_dispatch_based_ouput_iterator<Dispatch_based_output_it<V,O> >{
+    typedef typename boost::is_base_of< Dispatch_output_iterator<V,O>,
+                                        Dispatch_based_output_it<V,O>  >::type type;
+  };
+  
+  template <class Output_iterator>
+  inline void construct_polylines_with_info(Nodes_vector& nodes,Output_iterator out){
+    return construct_polylines_with_info(nodes,out,typename Is_dispatch_based_ouput_iterator<Output_iterator>::type());
+  }
+    
+  template <class Output_iterator>
+  void construct_polylines_with_info(Nodes_vector& nodes,Output_iterator out,boost::false_type){
+    construct_polylines_with_info(nodes,
+                                  dispatch_or_drop_output<std::vector<typename Kernel::Point_3> >(out),boost::true_type());
+  }
+  
+  template <template<class V_,class O_> class Dispatch_based_output_it,class V,class O>
+  void construct_polylines_with_info(Nodes_vector& nodes,
+                                     Dispatch_based_output_it<V,O> out,boost::true_type)
+  {
+    typedef typename Facets_to_nodes_map::value_type Edge;
+    typedef std::list<Facet_pair> Polyline_info;
+    
+    
+    std::size_t nb_nodes=nodes.size();
+    std::vector<int> node_mult(nb_nodes,0);
+    std::vector<bool> terminal_bools(nb_nodes,false);
+    std::vector< std::set<Edge*> > connections(nb_nodes);
+    // --counts the number of time each node has been seen
+    // --associate to each node its incident edges. An edge = a pair of Facet_handle+2 indices of intersection points
+    for (typename Facets_to_nodes_map::iterator it=f_to_node.begin();it!=f_to_node.end();++it){
+      const std::set<int>& segment=it->second;
+      CGAL_assertion(segment.size()==2 || segment.size()==1);
+      if (segment.size()==2){
+        int i=*segment.begin();
+        int j=*boost::next(segment.begin());
+        connections[i].insert(&(*it));
+        connections[j].insert(&(*it));
+        ++(node_mult[i]);
+        ++(node_mult[j]);
+      }
+    }
+
+    //detect terminal nodes and isolated nodes
+    for (unsigned k=0;k<nb_nodes;++k){
+      if (node_mult[k]!=2) terminal_bools[k]=true;
+      if (node_mult[k]==0){
+        *out++=std::vector<typename Kernel::Point_3>(1,nodes[k]);
+        if ( is_grabbed<std::vector<Facet_pair> >(out))
+          *out++=std::vector<Facet_pair>();
+      }
+    }
+   
+    //visitor call
+    visitor->update_terminal_nodes(terminal_bools);
+    
+    //We start from a node N and recursively walk one edge to find other
+    // node. If this is a cycle we stop when we are back at the node N;
+    //otherwise we stop at a terminal node and restart a walk from N
+    //following another edge (if N is not terminal) until finding a terminal
+    //node. With this we can associate to each edge the pair of facet_handle
+    //intersecting that define this edge.
+    unsigned current_node=0;
+    while (current_node!=nb_nodes){
+      if (connections[current_node].empty()){
+        ++current_node;
+        continue;
+      }
+      
+      Edge* edge=*connections[current_node].begin();
+      connections[current_node].erase(connections[current_node].begin());
+      
+      Polyline_info polyline_info;
+      std::list<typename Kernel::Point_3> polyline_embedding;
+      
+      if ( is_grabbed<std::vector<Facet_pair> >(out))
+        polyline_info.push_back(edge->first.first);
+      polyline_embedding.push_back(nodes[current_node]);
+      
+      unsigned i=current_node;
+      unsigned start_node=current_node;
+      bool reverse=false;
+      while (true){
+        i=get_other_int(edge->second,i);
+        connections[i].erase(edge);
+        
+        if (reverse) polyline_embedding.push_front(nodes[i]);
+        else         polyline_embedding.push_back(nodes[i]);
+        
+        if (i==start_node) break;
+        if (terminal_bools[i]){
+          if (reverse || terminal_bools[current_node]) break;
+          reverse=true;
+          i=current_node;
+          if ( connections[i].empty() ) break;
+        }
+        
+        edge=*connections[i].begin();
+        connections[i].erase(connections[i].begin());
+        
+        if ( is_grabbed<std::vector<Facet_pair> >(out)){
+          if (reverse) polyline_info.push_front(edge->first.first);
+          else         polyline_info.push_back(edge->first.first);
+        }
+          
+      }
+      
+      *out++=std::vector<typename Kernel::Point_3>(polyline_embedding.begin(),polyline_embedding.end());
+      if ( is_grabbed<std::vector<Facet_pair> >(out)){
+        CGAL_assertion(polyline_embedding.size()==polyline_info.size()+1);
+        *out++=std::vector<Facet_pair>(polyline_info.begin(),polyline_info.end());
+      }
+    }
+  }
+  
+//debug functions
+  
+  bool cgal_do_intersect_debug(Halfedge_handle eh,Facet_handle fh){
+    Triangle t( fh->halfedge()->vertex()->point(),
+                fh->halfedge()->next()->vertex()->point(),
+                fh->halfedge()->next()->next()->vertex()->point());
+
+    Segment s( eh->vertex()->point(),
+               eh->opposite()->vertex()->point());
+
+    return CGAL::do_intersect( s, t);
+  }
+
+  bool cgal_do_intersect_debug(Facet_handle fh1,Facet_handle fh2){
+    Triangle t1( fh1->halfedge()->vertex()->point(),
+                 fh1->halfedge()->next()->vertex()->point(),
+                 fh1->halfedge()->next()->next()->vertex()->point());
+    Triangle t2( fh2->halfedge()->vertex()->point(),
+                 fh2->halfedge()->next()->vertex()->point(),
+                 fh2->halfedge()->next()->next()->vertex()->point());
+
+
+    return CGAL::do_intersect( t1, t2);
+  }
+  
+  void print_f_to_node_debug(){
+    std::cout << "print_f_to_node_debug " << &f_to_node << std::endl;
+    for (typename Facets_to_nodes_map::iterator it=f_to_node.begin();it!=f_to_node.end();++it){
+      std::cout << &(*(it->first.first.first)) << " " << &(*(it->first.first.second)) << " " << it->first.second << " -> {";
+      std::copy(it->second.begin(),it->second.end(),std::ostream_iterator<int>(std::cout,","));
+      std::cout << "}" <<std::endl;
+    }
+  }
+  
+  void print_graph_debug(const std::map<int,Graph_node>& graph){
+    for (typename std::map<int,Graph_node>::const_iterator it=graph.begin();it!=graph.end();++it){
+      std::cout << it->first << " -> {";
+      std::copy(it->second.neighbors.begin(),it->second.neighbors.end(),std::ostream_iterator<int>(std::cout,","));
+      std::cout << "}" <<std::endl;      
+    }
+  }
+  
+  void print_edge_to_sfacet_debug(){
+    std::cout << "Potential intersection "<< edge_to_sfacet.size() << std::endl;
+    for(typename Edge_to_intersected_facets::iterator it=edge_to_sfacet.begin();it!=edge_to_sfacet.end();++it){
+      Facet_set& fset=it->second;
+      std::cout << &fset << " fset size " << fset.size() << std::endl;
+    }
+  }
+  
+  
+  template <class OutputIterator>
+  OutputIterator main_run(OutputIterator out,bool build_polylines=true){
+    // std::cout << edge_to_sfacet.size() << std::endl;
+    int current_node=-1;
+    
+    //print_edge_to_sfacet_debug();
+    #ifndef DO_NOT_HANDLE_COPLANAR_FACETS
+    //first handle coplanar triangles
+    compute_intersection_of_coplanar_facets(current_node);
+    visitor->set_number_of_intersection_points_from_coplanar_facets(current_node+1);
+    #endif // not DO_NOT_HANDLE_COPLANAR_FACETS
+    //print_edge_to_sfacet_debug();
+    //compute intersection points of segments and triangles.
+    //build node of the graph
+    //build connectivity info
+    compute_intersection_points(current_node); // 'current_node' is passed by
+                                               // non-const reference
+    
+    if (!build_polylines){
+      visitor->finalize(nodes);
+      return out;
+    }
+    //remove duplicated intersecting edges:      
+    //  In case two facets are incident along such an edge coplanar in a facet of another polyhedron (and one extremity inside the facet), the intersection
+    //  will be reported twice. We kept track (check_coplanar_edge(s)) of this so that, we can remove one intersecting edge out of the two
+    //print_f_to_node_debug();
+    remove_duplicated_intersecting_edges();
+    
+    //std::cout << "f_to_node "<< f_to_node.size() << std::endl;
+    //print_f_to_node_debug();
+    //collect connectivity infos and create polylines
+    if ( Node_visitor::do_need_vertex_graph )
+      construct_polylines(nodes,out); //using the graph approach (at some point we know all connections between intersection points)
+    else
+      construct_polylines_with_info(nodes,out); //direct construction by propagation
+    
+    visitor->finalize(nodes);    
+    
+    return out;
+  }
+  
+public:
+  Intersection_of_Polyhedra_3():visitor(new Node_visitor()),is_default_visitor(true){}
+  Intersection_of_Polyhedra_3(Node_visitor& v):visitor(&v),is_default_visitor(false){}
+  ~Intersection_of_Polyhedra_3(){if (is_default_visitor) delete visitor;}
+  //pairwise intersection between all elements in the range
+  template <class InputIterator, class OutputIterator>
+  OutputIterator
+  operator()(InputIterator begin, InputIterator end, OutputIterator out) {
+    for(InputIterator it1=begin;it1!=end;++it1){
+      CGAL_precondition( it1->is_pure_triangle() );
+      Polyhedron_ref P=*it1;
+      visitor->new_input_polyhedron(P);
+      for(InputIterator it2=boost::next(it1);it2!=end;++it2){  
+        CGAL_precondition( it2->is_pure_triangle() );
+        Polyhedron_ref Q=*it2;
+        filter_intersections(P, Q);
+        filter_intersections(Q, P);
+      }
+    }
+    
+    return main_run(out);
+  }
+  
+  //pairwise intersection between all elements in the range
+  //(pointers version)
+  template <class InputIterator, class OutputIterator>
+  OutputIterator
+  operator()(InputIterator begin, InputIterator end, OutputIterator out, int) {
+    for(InputIterator it1=begin;it1!=end;++it1){
+      CGAL_precondition( (*it1)->is_pure_triangle() );
+      Polyhedron_ref P=**it1;
+      visitor->new_input_polyhedron(P);
+      for(InputIterator it2=boost::next(it1);it2!=end;++it2){  
+        CGAL_precondition( (*it2)->is_pure_triangle() );
+        Polyhedron_ref Q=**it2;
+        filter_intersections(P, Q);
+        filter_intersections(Q, P);
+      }
+    }
+    
+    return main_run(out);
+  }
+  
+  //intersection between P and each element in the range
+  template <class InputIterator, class OutputIterator>
+  OutputIterator
+  operator()( Polyhedron_ref P, InputIterator begin, InputIterator end, OutputIterator out) {
+    CGAL_precondition( P.is_pure_triangle() );
+    visitor->new_input_polyhedron(P);
+    for(InputIterator it=begin;it!=end;++it){
+      CGAL_precondition( it->is_pure_triangle() );
+      Polyhedron_ref Q=*it;
+      visitor->new_input_polyhedron(Q);
+      filter_intersections(P, Q);
+      filter_intersections(Q, P);
+    }
+    return main_run(out);
+  }
+  
+  //intersection between P and each element in the range
+  //(pointers version)
+  template <class InputIterator, class OutputIterator>
+  OutputIterator
+  operator()(Polyhedron_ref P, InputIterator begin, InputIterator end, OutputIterator out, int) {
+    CGAL_precondition( P.is_pure_triangle() );
+    visitor->new_input_polyhedron(P);
+    for(InputIterator it=begin;it!=end;++it){
+      CGAL_precondition( (*it)->is_pure_triangle() );
+      Polyhedron_ref Q=**it;
+      visitor->new_input_polyhedron(Q);
+      filter_intersections(P, Q);
+      filter_intersections(Q, P);
+    }
+    return main_run(out);
+  }
+  
+  //intersection between P and Q
+  template <class OutputIterator>
+  OutputIterator
+  operator()(Polyhedron_ref P, Polyhedron_ref Q, OutputIterator out) {
+    visitor->new_input_polyhedron(P);
+    visitor->new_input_polyhedron(Q);
+    filter_intersections(P, Q);
+    filter_intersections(Q, P);
+    return main_run(out);
+  }
+
+  //intersection between P and Q, only visitor called not polyline is constructed
+  void operator()(Polyhedron_ref P, Polyhedron_ref Q) {
+    visitor->new_input_polyhedron(P);
+    visitor->new_input_polyhedron(Q);
+    filter_intersections(P, Q);
+    filter_intersections(Q, P);
+    main_run(Emptyset_iterator(),false);
+  }
+};
+
+template <typename Polyhedron, typename OutputIterator>
+OutputIterator
+intersection_Polyhedron_3_Polyhedron_3(const Polyhedron& P, const Polyhedron& Q, OutputIterator out)
+{
+  return Intersection_of_Polyhedra_3<Polyhedron>()(P,Q,out);
+}
+
+}// namespace CGAL
+
+#endif //CGAL_INTERSECTION_OF_POLYHEDRA_3_H
+
+/*
+  // Local variables for Emacs:
+  //   - set special indentation of case labels, compared to usual C/C++
+  //     indentation styles.
+  Local Variables:
+  c-file-offsets:((case-label . +))
+  End:
+*/
diff --git a/3rdparty/CGAL/include/CGAL/intersection_of_Polyhedra_3_refinement_visitor.h b/3rdparty/CGAL/include/CGAL/intersection_of_Polyhedra_3_refinement_visitor.h
new file mode 100644
index 0000000..0a93c25
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/intersection_of_Polyhedra_3_refinement_visitor.h
@@ -0,0 +1,2260 @@
+// Copyright (c) 2011 GeometryFactory (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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.
+//
+// $UR$
+// $Id$
+//
+//
+// Author(s)     : Sebastien Loriot
+
+#ifndef CGAL_INTERSECTION_OF_POLYHEDRA_3_REFINEMENT_VISITOR_H
+#define CGAL_INTERSECTION_OF_POLYHEDRA_3_REFINEMENT_VISITOR_H
+
+#include <CGAL/intersection_of_Polyhedra_3.h>
+#include <CGAL/Polygon_mesh_processing/connected_components.h>
+#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
+#include <CGAL/Constrained_Delaunay_triangulation_2.h>
+#include <CGAL/Triangulation_vertex_base_with_info_2.h>
+#include <CGAL/Default.h>
+
+#include <CGAL/internal/corefinement/Combinatorial_map_for_corefinement.h> 
+
+#include <CGAL/Side_of_triangle_mesh.h>
+#include <CGAL/property_map.h>
+#include <boost/optional.hpp>
+#include <boost/next_prior.hpp>
+
+#include <fstream>
+#include <sstream>
+
+//  TODOCUMENT
+//  --We suppose that the two input polyhedra are triangulated orientable surfaces.
+//  --Any polyhedron defines two bounding volumes: one inside and one outside.
+//    The convention used is the following: the normal of a triangle always indicates
+//    the outside of the object.
+//  --The  input polyhedra should not touch at only one point locally. If so, the current
+//    implementation just ignore it (TAG SL001)
+//  --Polyhedron type should be list-based or should guarantee no reallocation. We use maps
+//    on pointer of halfedges,facets and vertices
+//  --Polyhedral_mesh_domain requires the domain tp be closed: do not provided as input
+//    an open polyhedral surface and a polyhedron with a connected component free from intersection
+//OPTIMIZATIONS
+//  --cdt: try using intervals? in that case, only points inside the face should be considered
+//         and points on edge should be handled by hand (simply start using the point opposite to the edge)
+//  --filtered_order_around_edge: can be done using the original supporting planes
+//  --in intersection_of_Polyhedra_3: upon call to Triangle_segment_intersection_point::add_new_node, interval and exact nodes are
+//    inserted into a vector. Since we do not know the final size of vector this lead to reallocation of data.   
+//  --in Triangle_segment_intersection_point, try using EPEC instead of Interval_nt+SC<Gmpq>
+//  --use a sorted pair of indices in edge_to_hedge+simplify the code TAG_SLXX1
+//  --in sew_2_marked_darts arrange how darts are passed to avoid comparing to a Point_3
+//TODO:
+//  --validity of the embedding: points inserted in polyhedron are approximation of the real
+//    intersection points. It may happen that because of the approximation, the embedding gets
+//    wrong. To avoid this, for each new triangle created, we should make an orientation test
+//    with the approximated point to check if this is correct. If not, points must be moved
+//    within their double interval so that all triangles incident to each of these points are correctly
+//    oriented. This is probably an expensive test that can be activated only with a template parameter
+//    of something similar.
+namespace CGAL
+{
+  
+  namespace internal_IOP
+  {
+    template <class Polyhedron>
+    struct Compare_unik_address{
+      typedef typename Polyhedron::Halfedge_handle        Halfedge_handle;
+      typedef typename Polyhedron::Halfedge_const_handle  Halfedge_const_handle;
+      typedef typename Polyhedron::Halfedge               Halfedge;
+      
+      bool operator()(Halfedge_handle h1,Halfedge_handle h2) const {
+        Halfedge* ph1=&(*h1) < &(*h1->opposite()) ? &(*h1) : &(*h1->opposite());
+        Halfedge* ph2=&(*h2) < &(*h2->opposite()) ? &(*h2) : &(*h2->opposite());
+        return  ph1 < ph2; 
+      }
+
+      bool operator()(Halfedge_const_handle h1,Halfedge_const_handle h2) const {
+        const Halfedge* ph1=&(*h1) < &(*h1->opposite()) ? &(*h1) : &(*h1->opposite());
+        const Halfedge* ph2=&(*h2) < &(*h2->opposite()) ? &(*h2) : &(*h2->opposite());
+        return  ph1 < ph2; 
+      }
+    };
+
+  template <class Polyhedron>
+  struct Compare_address{
+    typedef typename Polyhedron::Halfedge_handle        Halfedge_handle;
+    typedef typename Polyhedron::Halfedge_const_handle  Halfedge_const_handle;
+    typedef typename Polyhedron::Halfedge               Halfedge;
+    
+    bool operator()(Halfedge_handle h1,Halfedge_handle h2) const {
+      return  &(*h1) < &(*h2); 
+    }
+
+    bool operator()(Halfedge_const_handle h1,Halfedge_const_handle h2) const {
+      return  &(*h1) < &(*h2); 
+    }
+  };
+
+  template <class Polyhedron>
+  class Non_intersection_halfedge{
+    typedef std::map< typename Polyhedron::Halfedge_const_handle,
+                      std::pair<int,int>,
+                      Compare_unik_address<Polyhedron> 
+                    >  Intersection_hedges_set;
+    Intersection_hedges_set intersection_hedges_;
+  public:  
+    Non_intersection_halfedge(const Intersection_hedges_set& the_set) : intersection_hedges_(the_set){}
+  
+  
+    bool operator()(typename Polyhedron::Halfedge_const_handle h) const
+    {
+      return intersection_hedges_.find(h)==intersection_hedges_.end();
+    }
+  };
+
+    
+  template <class HDS, class NestedFacetConstruct, class NewNodeVertexVisitor>
+  class Triangulate_a_face : public CGAL::Modifier_base<HDS> {
+    typedef typename HDS::Halfedge_handle Halfedge_handle;
+    typedef typename HDS::Vertex_handle   Vertex_handle;
+    typedef typename HDS::Face_handle     Face_handle;
+    typedef typename HDS::Vertex          Vertex;
+    typedef typename HDS::Halfedge        Halfedge;
+    typedef typename HDS::Face            Face;
+    
+    //data members
+    Face_handle current_face;
+    std::map<int,typename Vertex::Point >                  nodes_;
+    std::map<int,Vertex_handle>&                           node_to_polyhedron_vertex_;
+    std::map<std::pair<int,int>,Halfedge_handle>&          edge_to_hedge_;
+    std::vector<std::pair<int,int> >                       edges_to_create_;
+    std::vector<CGAL::cpp11::tuple<int,int,int> >          faces_to_create_;
+    NestedFacetConstruct facet_construct;
+    NewNodeVertexVisitor& node_vertex_visitor;
+
+    typename HDS::Halfedge::Base*
+    unlock_halfedge(Halfedge_handle h){
+      return static_cast<typename HDS::Halfedge::Base*>(&(*h));
+    }
+    
+    typename HDS::Face::Base*
+    unlock_face(Face_handle f){
+      return static_cast<typename HDS::Face::Base*>(&(*f));
+    }    
+    
+  public:
+    
+    template <class Nodes_vector,class Triangulation>
+    Triangulate_a_face( Face_handle face,
+                        const Nodes_vector& nodes,
+                        const std::vector<int>& node_ids,
+                        std::map<int,Vertex_handle>& node_to_polyhedron_vertex,
+                        std::map<std::pair<int,int>,Halfedge_handle>& edge_to_hedge,
+                        const Triangulation& triangulation,
+                        const NestedFacetConstruct& fc,
+                        NewNodeVertexVisitor& nv)
+    :current_face(face), node_to_polyhedron_vertex_(node_to_polyhedron_vertex), edge_to_hedge_(edge_to_hedge), facet_construct(fc), node_vertex_visitor(nv)
+    {
+      //grab vertices to be inserted to copy them from the vector
+      for (std::vector<int>::const_iterator it=node_ids.begin();it!=node_ids.end();++it)
+      {
+        nodes_.insert(std::make_pair(*it,nodes[*it]));
+      }
+      //grab edges that are not on the convex hull (these have already been created)
+      for (typename Triangulation::Finite_edges_iterator 
+        it=triangulation.finite_edges_begin();
+        it!=triangulation.finite_edges_end();
+        ++it)
+      {
+        typename Triangulation::Vertex_handle v0=it->first->vertex((it->second+1)%3);
+        typename Triangulation::Vertex_handle v1=it->first->vertex((it->second+2)%3);
+        //warning in degenerate cases you can insert outsite expected convex hull edges: need exact here.
+        //an alternative is to test if one the incident faces are infinite (cf assertion below)
+        if ( edge_to_hedge_.find(std::make_pair(v0->info(),v1->info()))==edge_to_hedge_.end() &&
+             edge_to_hedge_.find(std::make_pair(v1->info(),v0->info()))==edge_to_hedge_.end()    )
+        {
+          edges_to_create_.push_back( std::make_pair(v0->info(),v1->info()) );
+        }
+        else
+            CGAL_assertion( triangulation.is_infinite(it->first->vertex(it->second)) || triangulation.is_infinite( triangulation.mirror_vertex(it->first,it->second)) );
+      }
+      //grab triangles.
+      for (typename Triangulation::Finite_faces_iterator 
+        it=triangulation.finite_faces_begin();
+        it!=triangulation.finite_faces_end();
+        ++it)
+      {
+        typename Triangulation::Vertex_handle v0=it->vertex(0);
+        typename Triangulation::Vertex_handle v1=it->vertex(1);
+        typename Triangulation::Vertex_handle v2=it->vertex(2);
+        //warning in degenerate case we can have non wanted triangles: need exact here
+        faces_to_create_.push_back( CGAL::cpp11::make_tuple( v0->info(),v1->info(),v2->info() ) );
+      }
+    }
+
+
+  
+    void operator()( HDS& hds) {
+//      std::cerr << "node_to_polyhedron_vertex_"<< std::endl;
+//      for (typename std::map<int,Vertex_handle>::iterator it=node_to_polyhedron_vertex_.begin();it!=node_to_polyhedron_vertex_.end();++it)
+//        std::cerr << it->first << " " << &(*(it->second)) << std::endl;
+      
+      //insert the intersection point interior to the face inside the polyhedron and
+      //save their Polyhedron::vertex_handle 
+      for (typename std::map<int,typename Vertex::Point>::iterator it=nodes_.begin();it!=nodes_.end();++it)
+      {
+        Vertex_handle v=hds.vertices_push_back(Vertex(it->second));
+        node_vertex_visitor.new_vertex_added(it->first, v);
+        CGAL_assertion( node_to_polyhedron_vertex_.find( it->first ) == node_to_polyhedron_vertex_.end());
+        node_to_polyhedron_vertex_.insert( std::make_pair(it->first,v) );
+//        std::cerr << "vertices " << it->first  << " " << &(*v) << std::endl;
+      }
+      
+      //insert the new halfedge and set their incident vertex
+      for (typename std::vector<std::pair<int,int> >::iterator 
+        it=edges_to_create_.begin();it!=edges_to_create_.end();++it)
+      {
+        Halfedge_handle he=hds.edges_push_back(Halfedge(),Halfedge());
+        
+        //associate edge <i,j> to halfedge going from i to j with j as incident vertex
+        CGAL_assertion(node_to_polyhedron_vertex_.find(it->second)!= node_to_polyhedron_vertex_.end());
+        Vertex_handle v=node_to_polyhedron_vertex_.find(it->second)->second;
+        unlock_halfedge(he)->set_vertex( v );
+        v->set_halfedge(he);
+//        std::cerr << "  --in edge " << &(*v) << std::endl;
+        edge_to_hedge_.insert( std::make_pair(*it,he) ); 
+        v=node_to_polyhedron_vertex_.find(it->first)->second;
+//        std::cerr << "  --in edge " << &(*v) << std::endl;
+        unlock_halfedge( he->opposite() )->set_vertex( v );
+        v->set_halfedge(he->opposite());
+        edge_to_hedge_.insert( std::make_pair(std::make_pair(it->second,it->first),he->opposite()) );
+//        std::cerr << "edges " << it->first <<  " " << it->second << std::endl;
+      }
+      
+      std::vector<CGAL::cpp11::tuple<int,int,int> >::iterator it=faces_to_create_.begin();
+      Face_handle face_triangulated = current_face;
+      //create the new faces and update adjacencies
+      while (true)
+      {
+        int i=cpp11::get<0>(*it),j=cpp11::get<1>(*it),k=cpp11::get<2>(*it);
+//        std::cerr << "faces " << i <<  " " << j  << " " << k<< std::endl;        
+        Halfedge_handle current  = edge_to_hedge_.find(std::make_pair(i,j))->second;
+        Halfedge_handle next     = edge_to_hedge_.find(std::make_pair(j,k))->second;
+        Halfedge_handle previous = edge_to_hedge_.find(std::make_pair(k,i))->second;
+ 
+
+        CGAL_assertion (edge_to_hedge_.find(std::make_pair(i,j))!=edge_to_hedge_.end());
+        CGAL_assertion (edge_to_hedge_.find(std::make_pair(j,k))!=edge_to_hedge_.end());
+        CGAL_assertion (edge_to_hedge_.find(std::make_pair(k,i))!=edge_to_hedge_.end());
+        
+        CGAL_assertion(current->vertex()==node_to_polyhedron_vertex_.find(j)->second);
+        CGAL_assertion(next->vertex()==node_to_polyhedron_vertex_.find(k)->second);
+        CGAL_assertion(previous->vertex()==node_to_polyhedron_vertex_.find(i)->second);
+        
+        unlock_halfedge(current)->set_next(next);
+        unlock_halfedge(next)->set_next(previous);
+        unlock_halfedge(previous)->set_next(current);
+        
+        unlock_halfedge(current)->set_prev(previous);
+        unlock_halfedge(next)->set_prev(current);
+        unlock_halfedge(previous)->set_prev(next);
+        
+        //update face halfedge
+        unlock_face(current_face)->set_halfedge(current);
+        
+        //update face of halfedges
+        unlock_halfedge(current)  ->set_face(current_face);
+        unlock_halfedge(next)     ->set_face(current_face);
+        unlock_halfedge(previous) ->set_face(current_face);        
+        
+        if ( ++it!=faces_to_create_.end() )
+          current_face=hds.faces_push_back( facet_construct(*face_triangulated) );
+        else
+          break;
+      }
+    }
+  };    
+ 
+  } //namespace internal_IOP
+
+  
+//Considering the plane with normal vector [O_prime,O] and containing O. 
+//We define the counterclockwise order around O when looking from the side of the plane 
+//into which the vector [O_prime,O] is pointing.
+//We consider the portion of the plane defined by rotating a ray starting at O
+//from the planar projection of P1 to the planar projection of P2 in counterclockwise order.
+//The predicates indicates whether the planar projection of point Q lies in this portion of the plane.
+//Preconditions:
+//  O_prime,O,P1 are not collinear
+//  O_prime,O,P2 are not collinear
+//  O_prime,O,Q are not collinear
+//  O_prime,O,P1,Q are not coplanar or coplanar_orientation(O,O_prime,P1,Q)==NEGATIVE
+//  O_prime,O,P2,Q are not coplanar or coplanar_orientation(O,O_prime,P2,Q)==NEGATIVE
+template <class Kernel>
+bool  is_in_interior_of_object(
+    const typename Kernel::Point_3& O_prime,const typename Kernel::Point_3& O,
+    const typename Kernel::Point_3& P1,const typename Kernel::Point_3& P2,
+    const typename Kernel::Point_3& Q)
+{
+  //guarantee to have non-flat triangles
+  CGAL_precondition( !collinear(O_prime,O,P1) );
+  CGAL_precondition( !collinear(O_prime,O,P2) );
+  CGAL_precondition( !collinear(O_prime,O,Q)  );
+
+  //no two triangles are coplanar and on the same side of their common edge
+  CGAL_precondition( !coplanar(O_prime,O,P1,Q) || coplanar_orientation(O,O_prime,P1,Q)==NEGATIVE );
+  CGAL_precondition( !coplanar(O_prime,O,P2,Q) || coplanar_orientation(O,O_prime,P2,Q)==NEGATIVE );
+  
+  Sign s0 = sign( determinant(O-O_prime,P1-O,P2-O) );
+  
+  if ( s0==ZERO ){
+    //O, O_prime, P1 and P2 are coplanar
+    Orientation o=orientation(O_prime,O,P1,Q);
+    CGAL_precondition(o!=COPLANAR);
+    return o==POSITIVE;
+  }
+  
+  //O, O_prime, P1 and P2 are not coplanar
+  Sign s1 = sign( determinant(O-O_prime,P1-O,Q -O) );
+  Sign s2 = sign( determinant(O-O_prime,Q -O,P2-O) );
+
+  if (s0 == POSITIVE) // the angle P1,O,P2 is smaller that Pi.
+    return ( s1 == POSITIVE ) && ( s2 ==POSITIVE ); //true if the angles P1,O,Q and Q,O,P2 are smaller than Pi
+  else
+    return ( s1 != NEGATIVE ) || ( s2 != NEGATIVE ); //true if the angle P1,O,Q or the angle Q,O,P2 is smaller than or equal to Pi
+}
+
+//import into the combinatorial map facets in the given range.
+//they are supposed to be in the same connected component.
+//two volume are created (each facets gives two opposite orientation 2-cell in the map)
+template<class Polyhedron, class Map, class Face_iterator, class Non_special_edge_predicate,class Halfedge_to_dart_map_ >
+typename Map::Dart_handle import_from_polyhedron_subset(  Map& amap,
+                                                          Face_iterator faces_begin,
+                                                          Face_iterator faces_end,
+                                                          const Non_special_edge_predicate& is_non_special_edge,
+                                                          Halfedge_to_dart_map_& selected_hedge_to_dart,
+                                                          int mark_index
+  )
+{
+  typedef typename Polyhedron::Halfedge_const_handle  Halfedge_const_handle;
+  typedef std::map < Halfedge_const_handle, typename Map::Dart_handle,internal_IOP::Compare_address<Polyhedron> > Halfedge_to_dart_map;
+   
+  Halfedge_to_dart_map hedge_to_dart;
+  typename Map::Dart_handle first_dart = NULL;
+  // First traversal to build the darts and link them.
+  for (Face_iterator it_face = faces_begin; it_face != faces_end; ++it_face)
+  {
+    Halfedge_const_handle start=(*it_face)->halfedge();
+    
+    CGAL_precondition(start->next()!=start);
+    
+    Halfedge_const_handle current=start;
+    typename Map::Dart_handle prev = NULL;
+    typename Map::Dart_handle first_dart_of_face = NULL;
+    do
+    {
+      typename Map::Dart_handle d = amap.create_dart();
+      amap.template link_beta<3>(d,amap.create_dart()); //for opposite volume
+      hedge_to_dart[current] = d;
+             
+      if (prev != NULL){
+        amap.template link_beta<1>(prev, d);
+        amap.template link_beta<1>(d->beta(3),prev->beta(3));//for opposite volume
+      }
+      else 
+      {
+        first_dart_of_face = d;
+        if (first_dart==NULL) first_dart=d;
+      }
+      
+      if ( is_non_special_edge (current) ){
+        if ( !current->is_border_edge() ){
+          CGAL_assertion(current != current->opposite());
+          typename Halfedge_to_dart_map::iterator it = hedge_to_dart.find(current->opposite());
+          if (it != hedge_to_dart.end()){ //link the opposites halfedges only when both corresponding darts have been created
+            amap.template link_beta<2>(d, it->second);
+            amap.template link_beta<2>(d->beta(3), it->second->beta(3));//for opposite volume
+          }
+        }
+      }
+      else{
+        typename Halfedge_to_dart_map_::iterator it_hedge_map=selected_hedge_to_dart.find(current);
+         //all marked hedges are not the selected one for its polyline
+        if ( it_hedge_map!=selected_hedge_to_dart.end() ) it_hedge_map->second=d;
+        //darts d and d->beta(3) are special edges
+        amap.mark(d,mark_index);
+        amap.mark(d->beta(3),mark_index);
+      }
+      prev = d;
+      current=current->next();
+    }
+    while (current != start);
+    amap.template link_beta<1>(prev, first_dart_of_face);
+    amap.template link_beta<1>(first_dart_of_face->beta(3),prev->beta(3));//for opposite volume
+  }
+
+  // Second traversal to update the geometry.
+  // We run one again through the facets of the HDS.
+  for (Face_iterator it_face = faces_begin; it_face != faces_end; ++it_face)
+  {
+    Halfedge_const_handle start=(*it_face)->halfedge();
+    Halfedge_const_handle current=start;
+    do
+    {
+      typename Map::Dart_handle d = hedge_to_dart[current]; // Get the dart associated to the Halfedge
+      if (d->template attribute<0>() == NULL)
+      {	    
+        amap.template set_attribute<0>(d,
+           amap.template create_attribute<0>(current->opposite()->vertex()->point()));
+      }
+      current=current->next();
+    }
+    while (current != start);
+  }
+  
+  return first_dart;
+}
+
+ //turn around the target vertex of dart to find a marked dart
+template <class Combinatorial_map_3>
+boost::optional<typename Combinatorial_map_3::Dart_handle> 
+next_marked_dart_around_target_vertex(
+  const Combinatorial_map_3& final_map,
+  typename Combinatorial_map_3::Dart_handle dart,
+  int mark_index)
+{
+  CGAL_precondition(final_map.is_marked(dart,mark_index));
+  typename Combinatorial_map_3::Dart_handle next=dart->beta(1);
+  while ( ! final_map.is_marked(next,mark_index) ){
+    if (final_map.is_free(next,2) )//we reach a boundary
+      return  boost::optional<typename Combinatorial_map_3::Dart_handle>();
+    next=next->beta(2)->beta(1);
+  }
+  if (next == dart) //no new dart have been found  
+    return  boost::optional<typename Combinatorial_map_3::Dart_handle>();
+  CGAL_precondition(&dart->beta(1)->template attribute<0>()->point() == &next->template attribute<0>()->point());
+  return boost::optional<typename Combinatorial_map_3::Dart_handle> (next);
+}
+
+//turn around the target vertex of dart to find a marked dart
+//with expected_target as target vertex
+template <class Combinatorial_map_3>
+typename Combinatorial_map_3::Dart_handle
+get_next_marked_dart_around_target_vertex(
+  const Combinatorial_map_3& final_map,
+  typename Combinatorial_map_3::Dart_handle dart,
+  int mark_index)
+{
+  CGAL_precondition(final_map.is_marked(dart,mark_index));
+  typename Combinatorial_map_3::Dart_handle next=dart->beta(1);
+  while ( !final_map.is_marked(next,mark_index) ){
+    CGAL_assertion( !final_map.is_free(next,2) );
+    next=next->beta(2)->beta(1);
+    CGAL_assertion(next != dart);
+  }
+  CGAL_precondition(&dart->beta(1)->template attribute<0>()->point() == &next->template attribute<0>()->point());
+  return next;
+}
+
+//turn around the source vertex of dart to find a marked dart
+//with expected_source as source vertex
+template <class Combinatorial_map_3>
+typename Combinatorial_map_3::Dart_handle 
+get_next_marked_dart_around_source_vertex(  
+  const Combinatorial_map_3& final_map,
+  typename Combinatorial_map_3::Dart_handle dart,
+  int mark_index)
+{
+  CGAL_precondition(final_map.is_marked(dart,mark_index));
+  typename Combinatorial_map_3::Dart_handle next=dart->beta(0);
+  while ( ! final_map.is_marked(next,mark_index) ){ 
+    CGAL_assertion( !final_map.is_free(next,2) );
+    next=next->beta(2)->beta(0);
+    CGAL_assertion(next != dart);
+  }
+  CGAL_precondition(&dart->template attribute<0>()->point() == &next->beta(1)->template attribute<0>()->point());
+  return next;
+}
+
+//given two marked darts, this function links these two darts with beta<2>
+//but in addition it follows the marked darts connected to the same vertex
+//(there should be only one) to connect them all together
+//( this function is a kind of zipper ;) )
+template <class Combinatorial_map_3,class Nodes_vector>
+void sew_2_marked_darts( Combinatorial_map_3& final_map,
+                         typename Combinatorial_map_3::Dart_handle dart_1 , 
+                         typename Combinatorial_map_3::Dart_handle dart_2 ,
+                         int mark_index,
+                         const Nodes_vector& nodes,
+                         const std::pair<int,int>& indices,
+                         const std::pair<bool,int>& polyline_info)
+{
+  CGAL_precondition( final_map.is_free(dart_1,2) );
+  CGAL_precondition( final_map.is_free(dart_2,2) );
+  CGAL_precondition( final_map.is_marked(dart_1,mark_index) );
+  CGAL_precondition( final_map.is_marked(dart_2,mark_index) );
+  CGAL_precondition( dart_1->template attribute<0>()->point() == dart_2->beta(1)->template attribute<0>()->point() );
+  CGAL_precondition( dart_1->beta(1)->template attribute<0>()->point() == dart_2->template attribute<0>()->point() );
+  
+  int src_index = ( ( indices.first < indices.second) ==  polyline_info.first )
+                  ? indices.second:indices.first;
+  
+  if ( dart_1->template attribute<0>()->point() != nodes[ src_index ] ) std::swap(dart_1,dart_2);
+  
+  int nb_segs=polyline_info.second-1,k=1;
+  
+  do{
+    CGAL_precondition( final_map.template is_sewable<2>(dart_1,dart_2) );
+    final_map.template sew<2>(dart_1,dart_2);
+    
+    if (k==nb_segs) break;
+      
+    dart_1=get_next_marked_dart_around_target_vertex(final_map,dart_1,mark_index);
+    dart_2=get_next_marked_dart_around_source_vertex(final_map,dart_2,mark_index);
+  }
+  while(++k);
+}
+
+//not_top and not_down are two darts from volumes that get merged with an existing
+//other one because of a set of identical coplanar triangles.
+//top and down is the dart of the volumes "replacing" that of not_top and not down respectively, 
+//The function is considering all triangles that are bounded by a cycle of marked edges.
+//The volume not_top and not_down are part of are those that will disappear at the
+//end of the main algorithm.
+//( this function is a kind of facet gluer ;) )
+template <class Combinatorial_map_3>
+void sew_3_marked_darts( Combinatorial_map_3& final_map,
+                         typename Combinatorial_map_3::Dart_handle not_top , 
+                         typename Combinatorial_map_3::Dart_handle not_down ,
+                         typename Combinatorial_map_3::Dart_handle top , 
+                         typename Combinatorial_map_3::Dart_handle down ,
+                         int mark_index,
+                         std::set<typename Combinatorial_map_3::Dart_handle>& darts_to_remove)
+{
+  typedef boost::optional<typename Combinatorial_map_3::Dart_handle> O_Dart_handle;
+
+  if ( not_top->template attribute<3>()->info().is_empty ){
+    CGAL_assertion(not_down->template attribute<3>()->info().is_empty);
+    return;
+  }
+   
+  CGAL_assertion(!not_down->template attribute<3>()->info().is_empty);
+
+  //merge attribute of the two volumes:
+  internal_IOP::Volume_on_merge merge_attributes;
+  merge_attributes(*top->template attribute<3>(),*not_top->template attribute<3>());
+  merge_attributes(*down->template attribute<3>(),*not_down->template attribute<3>());
+  
+  //set volume attributes as empty to avoid double sew_3 of the same topological disk of triangles
+  not_top->template attribute<3>()->info().is_empty=true;
+  not_down->template attribute<3>()->info().is_empty=true;
+  
+  CGAL_precondition( final_map.is_marked(not_top,mark_index) && final_map.is_marked(top,mark_index) );
+  CGAL_precondition( final_map.is_marked(not_down,mark_index) && final_map.is_marked(down,mark_index) );
+  CGAL_precondition( not_top->template attribute<0>()->point() == not_down->beta(1)->template attribute<0>()->point() );
+  CGAL_precondition( not_top->beta(1)->template attribute<0>()->point() == not_down->template attribute<0>()->point() );
+  CGAL_precondition( not_top->template attribute<0>()->point() == top->template attribute<0>()->point() );
+  CGAL_precondition( not_down->template attribute<0>()->point() == down->template attribute<0>()->point() );
+  
+  CGAL_assertion( top->beta(3)==down );
+
+  //set to be removed the darts of the two no longer used volumes
+  typename Combinatorial_map_3::Dart_handle start=not_top;
+  do
+  {
+    CGAL_assertion(!final_map.is_free(not_top,3));
+    darts_to_remove.insert(not_top);   darts_to_remove.insert(not_top->beta(1)); darts_to_remove.insert(not_top->beta(1)->beta(1));
+    darts_to_remove.insert(not_top->beta(3));   darts_to_remove.insert(not_top->beta(3)->beta(1)); darts_to_remove.insert(not_top->beta(3)->beta(1)->beta(1));
+    O_Dart_handle current_1=next_marked_dart_around_target_vertex(final_map,not_top,mark_index);
+    CGAL_precondition(bool(current_1));
+    not_top=*current_1;
+  }
+  while(not_top!=start);
+}
+
+template<class Polyhedron>
+struct Dummy_edge_mark_property_map{
+  typedef bool value_type;
+  typedef value_type reference;
+  typedef std::pair<typename Polyhedron::Halfedge_handle,Polyhedron*> key_type;
+  typedef boost::read_write_property_map_tag category;  
+
+  Dummy_edge_mark_property_map(){}
+
+  friend reference get(Dummy_edge_mark_property_map,key_type) {return false;}
+  friend void put(Dummy_edge_mark_property_map,key_type,value_type) {}
+};
+
+template <class Polyhedron>
+struct Default_facet_construct{
+  typename Polyhedron::Facet operator()( const typename Polyhedron::Facet& )
+  { return typename Polyhedron::Facet(); }
+};
+
+template <class Polyhedron>
+struct Default_node_vertex_visitor{
+  void new_node_added(  int /* node_id */,
+                        internal_IOP::Intersection_type /* type */,
+                        typename Polyhedron::Halfedge_handle /* principal_edge */,
+                        typename Polyhedron::Halfedge_handle /* additional_edge */,
+                        bool /* is_vertex_coplanar */,
+                        bool /* is_vertex_opposite_coplanar */ )
+  {}
+
+  void new_vertex_added(int /* node_id */, typename Polyhedron::Vertex_handle /* vh */){}
+};
+
+template< class Polyhedron,
+          class Kernel_=Default,
+          class EdgeMarkPropertyMap_=Default,
+          class NestedFacetConstruct_=Default,
+          class NewNodeVertexVisitor_=Default
+        >
+class Node_visitor_refine_polyhedra{
+//Default typedefs
+  typedef typename Default::Get<Kernel_, typename Polyhedron::Traits::Kernel>::type Kernel;
+  typedef typename Default::Get<EdgeMarkPropertyMap_, Dummy_edge_mark_property_map<Polyhedron> >::type EdgeMarkPropertyMap;
+  typedef typename Default::Get<NestedFacetConstruct_, Default_facet_construct<Polyhedron > >::type NestedFacetConstruct;
+  typedef typename Default::Get<NewNodeVertexVisitor_, Default_node_vertex_visitor<Polyhedron> >::type NewNodeVertexVisitor;
+//typedefs  
+  typedef typename Polyhedron::Halfedge_handle                         Halfedge_handle;
+  typedef typename Polyhedron::Halfedge_const_handle                   Halfedge_const_handle;
+  typedef typename Polyhedron::Face_handle                             Face_handle;
+  typedef typename Polyhedron::Halfedge                                Halfedge;
+  typedef typename Polyhedron::Vertex_handle                           Vertex_handle;
+  typedef internal_IOP::Compare_handles<Polyhedron,CGAL::Tag_false>    Cmp_handle; //This ensures uniqueness of edges when comparing halfedges
+  typedef internal_IOP::Compare_unik_address<Polyhedron>               Cmp_unik_ad; //This ensures uniqueness of edges when comparing halfedges
+  
+  //constrained triangulation used for triangulation interior of faces
+  #ifdef DO_NO_USE_EXACT_CDT 
+  typedef CGAL::Triangulation_vertex_base_with_info_2<int,Kernel>       Vbi;
+  typedef CGAL::Constrained_triangulation_face_base_2<Kernel>           Fb;
+  typedef CGAL::Triangulation_data_structure_2<Vbi,Fb>                  TDS_2;
+  typedef CGAL::Constrained_Delaunay_triangulation_2<Kernel,TDS_2,CGAL::No_intersection_tag> CDT;  //DO WE NEED DELAUNAY????
+  #else
+  /// \todo change this, use it only if not already exact
+  typedef CGAL::Exact_predicates_exact_constructions_kernel             Exact_kernel;
+  typedef CGAL::Triangulation_vertex_base_with_info_2<int,Exact_kernel> Vbi;
+  typedef CGAL::Constrained_triangulation_face_base_2<Exact_kernel>           Fb;
+  typedef CGAL::Triangulation_data_structure_2<Vbi,Fb>                  TDS_2;
+  typedef CGAL::Constrained_Delaunay_triangulation_2<Exact_kernel,TDS_2,CGAL::No_intersection_tag> CDT;  //DO WE NEED DELAUNAY????  
+  #endif
+  
+  typedef std::map<Halfedge_handle,Polyhedron*,Cmp_unik_ad>            Hedge_to_polyhedron_map;
+
+  typedef std::vector<int>                                             Node_ids;
+  typedef std::set<int>                                                Node_id_set; //avoid having duplicated node on edge of coplanar triangles
+  typedef std::map< Face_handle,Node_ids,Cmp_handle >                  In_face_map; 
+  typedef std::map< Halfedge_handle,Node_id_set,Cmp_unik_ad >          In_halfedge_map;
+  //to keep the correspondance between node_id and vertex_handle in each polyhedron
+  typedef std::map<int,Vertex_handle> Node_to_polyhedron_vertex_map;
+  typedef std::map<Polyhedron*, Node_to_polyhedron_vertex_map > Poly_to_map_node;
+  //to maintain an polyhedron halfedge on each polyline + pair<bool,int>
+  //with first = "is the key (pair<int,int>) was reversed?" and second is the number of edges +1 in the polyline
+  typedef std::map< std::pair<int,int>, std::pair< std::map<Polyhedron*,Halfedge_handle>,std::pair<bool,int> > > An_edge_per_polyline_map;  
+  //to handle coplanar halfedge of polyhedra that are full in the intersection
+  typedef std::map< int,Halfedge_handle >                              Node_to_target_of_hedge_map;
+  typedef std::map< Polyhedron*,Node_to_target_of_hedge_map>           Poly_to_vertices_on_intersection_map;
+
+  //Combinatorial map typedefs
+  typedef internal_IOP::Item_with_points_and_volume_info<Kernel,Polyhedron> Items;
+  typedef CGAL::Combinatorial_map<3,Items> Combinatorial_map_3_;
+  typedef typename Combinatorial_map_3_::Dart_handle Dart_handle;
+  
+//data members
+  Hedge_to_polyhedron_map               hedge_to_polyhedron;
+  In_face_map                           in_face;
+  In_halfedge_map                       in_hedge;
+  std::map< int,std::set<int> >         graph_of_constraints;
+  std::map< int,std::set<int> >         coplanar_constraints;
+  An_edge_per_polyline_map              an_edge_per_polyline;
+  typename An_edge_per_polyline_map::iterator last_polyline;
+  Poly_to_vertices_on_intersection_map  poly_to_vertices_on_inter;
+  Poly_to_map_node                      polyhedron_to_map_node_to_polyhedron_vertex;
+  std::set<int>                         non_manifold_nodes; //contain nodes that are original vertices of input polyhedron and that neighborhood is not a topological disk
+  std::map<Vertex_handle,int>           nodes_that_are_original_vertices;//to keep the correspondance between original polyhedron vertices that are also nodes
+  
+  Combinatorial_map_3_*                 final_map_ptr;
+  Combinatorial_map_3_&                 final_map() {return *final_map_ptr;}
+  bool final_map_comes_from_outside;
+  //   new_hedge    hedge
+  //  ----------->   ----------->
+  //               v
+  //  <-----------   <-----------
+  //   new_opposite     opposite 
+  //  
+  Vertex_handle split_edge( Halfedge_handle hedge,
+                            const typename Kernel::Point_3& point,
+                            Polyhedron& P)
+  {
+    internal_IOP::Split_halfedge_at_point<typename Polyhedron::HalfedgeDS> delegated(hedge,point);
+    P.delegate( delegated );
+    CGAL_assertion(P.is_valid());
+    
+    //update marker tags. If the edge was marked, then the resulting edges in the split must be marked
+    if ( get(m_edge_mark_pmap,std::make_pair(hedge,&P)) )
+    {
+      CGAL_assertion( get(m_edge_mark_pmap,std::make_pair(hedge->opposite(),&P)) );
+      put(m_edge_mark_pmap,std::make_pair(hedge->prev(),&P),true);
+      put(m_edge_mark_pmap,std::make_pair(hedge->prev()->opposite(),&P),true);
+      put(m_edge_mark_pmap,std::make_pair(hedge->opposite()->next(),&P),true);
+      put(m_edge_mark_pmap,std::make_pair(hedge->opposite()->next()->opposite(),&P),true);
+    }
+    
+    Vertex_handle v=boost::prior(P.vertices_end());
+    CGAL_assertion(v->point()==point);
+    return v;
+  }
+
+  //sort node ids so that we can split the hedge
+  //consecutively
+  template <class Nodes_vector>
+  void sort_vertices_along_hedge(std::vector<int>& node_ids,Halfedge_handle hedge,const Nodes_vector& nodes)
+  {
+    std::sort(node_ids.begin(),
+              node_ids.end(),
+              internal_IOP::Order_along_a_halfedge<Polyhedron,Nodes_vector,Is_polyhedron_const>(hedge,nodes)
+    );
+  }
+  
+  //insert intersection as constrained edges  in a CDT triangulation
+  template <class CDT>
+  void insert_constrained_edges_coplanar_case(int node_id,
+                                              CDT& triangulation,
+                                              std::map<int,typename CDT::Vertex_handle>& id_to_CDT_vh)
+  {
+    if (node_id < number_coplanar_vertices){
+      //XSL_TAG_CPL_VERT
+      //Insert constrained edges from coplanar facets that have been retriangulated. This ensure that triangulations are compatible
+      std::map< int,std::set<int> >::iterator it_neighbors=coplanar_constraints.find(node_id);
+      if (it_neighbors!=coplanar_constraints.end())
+      {
+        typename CDT::Vertex_handle vh=id_to_CDT_vh.find(node_id)->second;
+        for (std::set<int>::iterator it_n=it_neighbors->second.begin();it_n!=it_neighbors->second.end();++it_n){
+          typename std::map<int,typename CDT::Vertex_handle>::iterator it_vh=id_to_CDT_vh.find(*it_n);
+          // this condition ensures to consider only graph edges that are in the same triangle (not in a neighbor one when involving node on a triangle edge)
+          // here we can't make the difference between a point on the interior or the boundary, so points_on_triangle is not used.
+          if ( it_vh!=id_to_CDT_vh.end() ){
+            triangulation.insert_constraint(vh,id_to_CDT_vh.find(*it_n)->second);
+          }
+        }
+      }
+    }
+  }
+  //insert intersection as constrained edges  in a CDT triangulation
+  template <class CDT,class Constrained_edges_map>
+  void insert_constrained_edges(Node_ids& node_ids, //index of vertices we are interested in
+                                CDT& triangulation,
+                                std::map<int,typename CDT::Vertex_handle>& id_to_CDT_vh,
+                                Constrained_edges_map& constrained_edges, //list of pair of int to indicate edges that are constrained
+                                bool points_on_triangle=false)
+  {
+    for (Node_ids::iterator it_node_id=node_ids.begin();it_node_id!=node_ids.end();++it_node_id){
+      std::map< int,std::set<int> >::iterator it_neighbors=graph_of_constraints.find(*it_node_id);
+      if (it_neighbors!=graph_of_constraints.end())
+      {
+        typename CDT::Vertex_handle vh=id_to_CDT_vh.find(*it_node_id)->second;
+        for (std::set<int>::iterator it_n=it_neighbors->second.begin();it_n!=it_neighbors->second.end();++it_n){
+          typename std::map<int,typename CDT::Vertex_handle>::iterator it_vh=id_to_CDT_vh.find(*it_n);
+          // this condition ensures to consider only graph edges that are in the same triangle (not in a neighbor one when involving node on a triangle edge)
+          if ( !points_on_triangle || it_vh!=id_to_CDT_vh.end() ){ 
+            CGAL_assertion(it_vh!=id_to_CDT_vh.end());
+            triangulation.insert_constraint(vh,id_to_CDT_vh.find(*it_n)->second);
+            constrained_edges.push_back(std::make_pair(*it_node_id,*it_n));
+          }
+        }
+      }
+      #ifdef CGAL_COREFINEMENT_DEBUG
+      else
+      {
+        std::cout << "X0: Found an isolated point" << std::endl;
+      }
+      #endif
+      
+      insert_constrained_edges_coplanar_case(*it_node_id,triangulation,id_to_CDT_vh);
+    }
+  }
+  
+  std::pair<int,int> make_sorted_pair(int i,int j) const {return i<j ? std::make_pair(i,j):std::make_pair(j,i);} 
+  
+  void update_edge_per_polyline(Polyhedron* P,std::pair<int,int> indices,typename Polyhedron::Halfedge_handle hedge)
+  {
+    std::pair<int,int> sorted_pair=make_sorted_pair(indices.first,indices.second);
+    typename An_edge_per_polyline_map::iterator it=an_edge_per_polyline.find(sorted_pair);
+    if (it!=an_edge_per_polyline.end()){
+      it->second.first.insert(std::make_pair( P,sorted_pair.first==indices.first?hedge:hedge->opposite() ));
+    }
+  }
+
+  int node_index_of_incident_vertex(Halfedge_const_handle h,
+                                    const std::map<Halfedge_const_handle,std::pair<int,int>,Cmp_unik_ad >& border_halfedges)
+  {
+    //WARNING this may be expensive
+    typedef std::map<Halfedge_const_handle,std::pair<int,int>,Cmp_unik_ad > Border_halfedges_map;
+
+    Halfedge_const_handle start=h;
+    Halfedge_const_handle curr=start;
+    do{
+      typename Border_halfedges_map::const_iterator it_border=border_halfedges.find( curr );
+      if (it_border!=border_halfedges.end())
+        return it_border->first==curr?it_border->second.second:it_border->second.first;      
+      curr=curr->next()->opposite();
+    }while(curr!=start);
+    
+    return -1;
+  }
+  
+  template <class Nodes_vector>
+  bool filtered_order_around_edge(int O_prime_index,
+                                  int O_index,
+                                  int P1_index,
+                                  int P2_index,
+                                  int Q_index,
+                                  Vertex_handle P1,
+                                  Vertex_handle P2,
+                                  Vertex_handle Q,
+                                  const Nodes_vector& nodes)
+  {
+    try{
+      return is_in_interior_of_object<typename Nodes_vector::Ikernel>(
+        nodes.interval_node(O_prime_index),
+        nodes.interval_node(O_index),
+        P1_index == -1 ? nodes.to_interval(P1->point()): nodes.interval_node(P1_index),
+        P2_index == -1 ? nodes.to_interval(P2->point()): nodes.interval_node(P2_index),
+        Q_index  == -1 ? nodes.to_interval(Q->point()) : nodes.interval_node(Q_index )
+      );
+    }
+    catch(Uncertain_conversion_exception&){
+      return is_in_interior_of_object<typename Nodes_vector::Exact_kernel>(
+        nodes.exact_node(O_prime_index),
+        nodes.exact_node(O_index),
+        P1_index == -1 ? nodes.to_exact(P1->point()): nodes.exact_node(P1_index),
+        P2_index == -1 ? nodes.to_exact(P2->point()): nodes.exact_node(P2_index),
+        Q_index  == -1 ? nodes.to_exact(Q->point()) : nodes.exact_node(Q_index )
+      );
+    }
+  }
+
+//keep track of the fact that a polyhedron original vertex is a node
+void all_incident_faces_got_a_node_as_vertex(Halfedge_handle incident_to_vertex_edge,int node_id)
+{
+  nodes_that_are_original_vertices.insert(std::make_pair(incident_to_vertex_edge->vertex(),node_id));
+}
+
+//if an original polyhedron vertex is also a node, do no use a fake id
+void set_triangle_boundary_indices(
+  Vertex_handle* triangle_boundary,
+  int* triangle_boundary_indices)
+{
+  triangle_boundary_indices[0]=-1;
+  triangle_boundary_indices[1]=-2;
+  triangle_boundary_indices[2]=-3;
+  
+  for (int k=0;k<3;++k){
+    typename std::map<Vertex_handle,int>::iterator it=nodes_that_are_original_vertices.find(triangle_boundary[k]);
+    if (it!=nodes_that_are_original_vertices.end())
+      triangle_boundary_indices[k]=it->second;
+  }
+}
+
+//======================================================================//
+//functions internally used to glue piece of the final combinatorial map//
+//======================================================================//
+
+
+  //-----first polyhedron
+template <class Halfedge_to_dart_map>
+inline Dart_handle get_associated_dart(Halfedge_handle hedge,Halfedge_to_dart_map& selected_hedge_to_dart){
+  typename Halfedge_to_dart_map::iterator it_saved_dart=selected_hedge_to_dart.find(hedge);
+  CGAL_assertion(it_saved_dart!=selected_hedge_to_dart.end());
+  return it_saved_dart->second;
+}
+
+//first_hedge defines four volumes, second_hedge only two
+//first_poly is not needed as inside/outside volume is update during the merge
+//of the sew. Only second_poly is needed
+template <class Nodes_vector,class Border_halfedges_map,class Halfedge_to_dart_map>
+void sew_2_three_volumes_case(  Halfedge_handle first_hedge, Halfedge_handle second_hedge,
+                                const std::pair<int,int>& indices,
+                                const Nodes_vector& nodes,
+                                Border_halfedges_map& border_halfedges,
+                                Halfedge_to_dart_map& selected_hedge_to_dart, 
+                                Polyhedron* /*first_poly*/, Polyhedron* second_poly,
+                                int mark_index,
+                                std::set<Dart_handle>& darts_to_remove,
+                                const std::pair<bool,int>& polyline_info)
+{
+  bool took_opposite=second_hedge->is_border();
+  if (took_opposite) second_hedge=second_hedge->opposite();
+  
+  Vertex_handle P1=first_hedge->opposite()->next()->vertex();
+  Vertex_handle P2=first_hedge->next()->vertex();
+  //    when looking from the side of indices.second, the interior of the first polyhedron is described 
+  //    by turning counterclockwise from P1 to P2
+  
+  Vertex_handle Q = second_hedge->next()->vertex();
+  
+  //check if the third point of each triangular face is an original point (stay -1)
+  //or a intersection point (in that case we need the index of the corresponding node to
+  //have the exact value of the point)      
+  int index_p1=node_index_of_incident_vertex(first_hedge->opposite()->next(),border_halfedges);
+  int index_p2=node_index_of_incident_vertex(first_hedge->next(),border_halfedges);
+  int index_q =node_index_of_incident_vertex(second_hedge->next(),border_halfedges);      
+
+  //Recover the dart that will be the start point of the different sewing
+  //  dof_X_outside = dart of face of , meaning the triangle containing the
+  //  point X and part of the volume outside of the corresponding polyhedron      
+  //-----first polyhedron
+  Dart_handle dof_P1_outside = get_associated_dart(first_hedge->opposite(),selected_hedge_to_dart);
+  Dart_handle dof_P2_outside = get_associated_dart(first_hedge,selected_hedge_to_dart);
+  //-----second polyhedron
+  Dart_handle dof_Q_outside = get_associated_dart(second_hedge,selected_hedge_to_dart);
+  
+  if (index_p1!=-1 && index_p1==index_q){
+    Dart_handle top=dof_P1_outside->beta(3), not_top=took_opposite?dof_Q_outside->beta(3):dof_Q_outside;
+    Dart_handle down=dof_P1_outside, not_down=took_opposite?dof_Q_outside:dof_Q_outside->beta(3);
+
+    if ( top->template attribute<3>()->info().is_empty ) std::swap(not_top,top);
+    if ( down->template attribute<3>()->info().is_empty ) std::swap(not_down,down);
+    CGAL_assertion( !top->template attribute<3>()->info().is_empty );
+    CGAL_assertion( !down->template attribute<3>()->info().is_empty );
+
+    sew_2_marked_darts( final_map(),top             , dof_P2_outside->beta(3)     ,mark_index, nodes, indices, polyline_info); //P1P2 or QP2      
+    sew_2_marked_darts( final_map(),dof_P2_outside  , down                        ,mark_index, nodes, indices, polyline_info); //P2Q or P2P1
+    sew_3_marked_darts( final_map(),not_top,not_down,top,down,mark_index,darts_to_remove);
+    
+    return;
+  }
+
+  if (index_p2!=-1 && index_p2==index_q){
+    Dart_handle top=dof_P2_outside->beta(3), not_top=took_opposite?dof_Q_outside:dof_Q_outside->beta(3);
+    Dart_handle down=dof_P2_outside, not_down=took_opposite?dof_Q_outside->beta(3):dof_Q_outside;
+
+    if ( top->template attribute<3>()->info().is_empty ) std::swap(not_top,top);
+    if ( down->template attribute<3>()->info().is_empty ) std::swap(not_down,down);
+    CGAL_assertion( !top->template attribute<3>()->info().is_empty );
+    CGAL_assertion( !down->template attribute<3>()->info().is_empty );
+
+    sew_2_marked_darts( final_map(),dof_P1_outside->beta(3) , top              ,mark_index, nodes, indices, polyline_info); //P1Q or P1P2      
+    sew_2_marked_darts( final_map(),down                    , dof_P1_outside   ,mark_index, nodes, indices, polyline_info); //QP1 or P2P1
+    sew_3_marked_darts( final_map(),not_top,not_down,top,down,mark_index,darts_to_remove);
+    
+    return;
+  }
+  
+  bool Q_is_between_P1P2 = filtered_order_around_edge(indices.first,indices.second,index_p1,index_p2,index_q,P1,P2,Q,nodes);
+
+
+  if (Q_is_between_P1P2)
+  {
+    // poly_first  - poly_second            = took_opposite?P1Q:QP2
+    // poly_second - poly_first             = {0}
+    // poly_first \cap poly_second          = took_opposite?QP2:P1Q
+    // opposite( poly_first U poly_second ) = P2P1
+    sew_2_marked_darts( final_map(),dof_P1_outside->beta(3)                            , took_opposite?dof_Q_outside:dof_Q_outside->beta(3)  ,mark_index, nodes, indices, polyline_info); //P1Q
+    sew_2_marked_darts( final_map(),took_opposite?dof_Q_outside->beta(3):dof_Q_outside , dof_P2_outside->beta(3)                             ,mark_index, nodes, indices, polyline_info); //QP2
+    sew_2_marked_darts( final_map(),dof_P2_outside                                     , dof_P1_outside                                      ,mark_index, nodes, indices, polyline_info); //P2P1
+    dof_P1_outside->template attribute<3>()->info().outside.insert(second_poly); //update P2P1 outside poly
+  }
+  else
+  {
+    // poly_first  - poly_second            = P1P2
+    // poly_second - poly_first             = took_opposite?QP1:P2Q
+    // poly_first \cap poly_second          = {0}
+    // opposite( poly_first U poly_second ) = took_opposite?P2Q:QP1
+    sew_2_marked_darts( final_map(),dof_P2_outside                                     , took_opposite?dof_Q_outside:dof_Q_outside->beta(3)  ,mark_index, nodes, indices, polyline_info); //P2Q
+    sew_2_marked_darts( final_map(),took_opposite?dof_Q_outside->beta(3):dof_Q_outside , dof_P1_outside                                      ,mark_index, nodes, indices, polyline_info); //QP1
+    sew_2_marked_darts( final_map(),dof_P1_outside->beta(3)                            , dof_P2_outside->beta(3)                             ,mark_index, nodes, indices, polyline_info); //P1P2
+    dof_P1_outside->beta(3)->template attribute<3>()->info().outside.insert(second_poly); //update P1P2 outside poly
+  }
+}
+
+//first_hedge defines two volumes, second_hedge only two
+template <class Halfedge_to_dart_map,class Border_halfedges_map,class Nodes_vector>
+void sew_2_two_volumes_case(  Halfedge_handle first_hedge, Halfedge_handle second_hedge,
+                              Border_halfedges_map& border_halfedges,
+                              Halfedge_to_dart_map& selected_hedge_to_dart,
+                              int mark_index,
+                              std::set<Dart_handle>& darts_to_remove,
+                              const Nodes_vector& nodes,
+                              const std::pair<int,int>& indices,
+                              const std::pair<bool,int>& polyline_info)
+{
+  bool first_took_opposite=first_hedge->is_border();
+  if (first_took_opposite) first_hedge=first_hedge->opposite();
+  bool second_took_opposite=second_hedge->is_border();
+  if (second_took_opposite) second_hedge=second_hedge->opposite();
+  
+    //-----first polyhedron
+  Dart_handle dof_P_outside = get_associated_dart(first_hedge,selected_hedge_to_dart);
+  //-----second polyhedron
+  Dart_handle dof_Q_outside = get_associated_dart(second_hedge,selected_hedge_to_dart);
+  
+  
+  
+  
+  int index_p =node_index_of_incident_vertex(first_hedge->next(),border_halfedges);
+  int index_q =node_index_of_incident_vertex(second_hedge->next(),border_halfedges);
+
+  if (index_p!=-1 && index_q!=-1 && index_p==index_q){
+    Dart_handle top=dof_P_outside, not_top=dof_Q_outside->beta(3);
+    Dart_handle down=dof_P_outside->beta(3), not_down=dof_Q_outside;
+    
+    if (first_took_opposite==second_took_opposite)
+    {
+      top=dof_P_outside->beta(3); not_top=dof_Q_outside->beta(3);
+      down=dof_P_outside; not_down=dof_Q_outside;
+    }
+    
+    if ( top->template attribute<3>()->info().is_empty ) std::swap(not_top,top);
+    if ( down->template attribute<3>()->info().is_empty ) std::swap(not_down,down);
+    CGAL_assertion( !top->template attribute<3>()->info().is_empty );
+    CGAL_assertion( !down->template attribute<3>()->info().is_empty );
+
+    sew_3_marked_darts( final_map(),not_top,not_down,top,down,mark_index,darts_to_remove);
+    
+    return;
+  }
+  
+  
+  
+  //since the edge is shared, the inside of each polyhedron must be on opposite orientation halfedges
+  if (first_took_opposite==second_took_opposite)
+  {
+    //sew out with in
+    sew_2_marked_darts( final_map(),dof_P_outside->beta(3)  , dof_Q_outside  ,mark_index, nodes, indices, polyline_info); //PQ
+    sew_2_marked_darts( final_map(),dof_Q_outside->beta(3)  , dof_P_outside  ,mark_index, nodes, indices, polyline_info); //QP
+  }
+  else
+  {
+    //sew in with in
+  sew_2_marked_darts( final_map(),dof_P_outside         , dof_Q_outside          ,mark_index, nodes, indices, polyline_info); //PQ
+  sew_2_marked_darts( final_map(),dof_Q_outside->beta(3), dof_P_outside->beta(3) ,mark_index, nodes, indices, polyline_info); //QP
+  }
+}
+
+//4 volume case with 2 identical volume
+//Q2 is supposed to be identical to P2
+template <class Nodes_vector,class Halfedge_to_dart_map>
+void sew_2_four_volumes_case_1(  Halfedge_handle first_hedge, Halfedge_handle second_hedge,
+                                 const std::pair<int,int>& indices,
+                                 const Nodes_vector& nodes,
+                                 int index_p1, int index_p2, int index_q1,
+                                 Halfedge_to_dart_map& selected_hedge_to_dart,
+                                 int mark_index,
+                                 std::set<Dart_handle>& darts_to_remove,
+                                 const std::pair<bool,int>& polyline_info,
+                                 bool swap_in_out_Q=false)
+{
+  Vertex_handle P1=first_hedge->opposite()->next()->vertex();
+  Vertex_handle P2=first_hedge->next()->vertex();
+  //    when looking from the side of indices.second, the interior of the first polyhedron is described 
+  //    by turning counterclockwise from P1 to P2
+  Vertex_handle Q1=second_hedge->opposite()->next()->vertex();
+  // Vertex_handle Q2=second_hedge->next()->vertex();  
+  bool Q1_is_between_P1P2 = filtered_order_around_edge(indices.first,indices.second,index_p1,index_p2,index_q1,P1,P2,Q1,nodes);
+  
+  
+  //Recover the dart that will be the start point of the different sewing
+  //  dof_X_outside = dart of face of , meaning the triangle containing the
+  //  point X and part of the volume outside of the corresponding polyhedron      
+  //-----first polyhedron
+  Dart_handle dof_P1_outside = get_associated_dart(first_hedge->opposite(),selected_hedge_to_dart);
+  Dart_handle dof_P2_outside = get_associated_dart(first_hedge,selected_hedge_to_dart);
+  //-----second polyhedron
+  Dart_handle dof_Q1_outside = get_associated_dart(second_hedge->opposite(),selected_hedge_to_dart);
+  Dart_handle dof_Q2_outside = get_associated_dart(second_hedge,selected_hedge_to_dart);  
+  
+  if( swap_in_out_Q ){
+    dof_Q1_outside=dof_Q1_outside->beta(3);
+    dof_Q2_outside=dof_Q2_outside->beta(3);
+  }
+  
+  if (Q1_is_between_P1P2){
+      Dart_handle top=dof_Q2_outside->beta(3), not_top=dof_P2_outside->beta(3);
+      Dart_handle down=dof_Q2_outside, not_down=dof_P2_outside;
+      if ( top->template attribute<3>()->info().is_empty ) std::swap(not_top,top);
+      if ( down->template attribute<3>()->info().is_empty ) std::swap(not_down,down);
+      CGAL_assertion( !top->template attribute<3>()->info().is_empty );
+      CGAL_assertion( !down->template attribute<3>()->info().is_empty );
+    
+      // poly_first  - poly_second            = P1Q1
+      // poly_second - poly_first             = {0}
+      // poly_first \cap poly_second          = Q1P2 or Q1Q2
+      // opposite( poly_first U poly_second ) = Q2P1 or P2P1
+      sew_2_marked_darts( final_map(),dof_P1_outside->beta(3) , dof_Q1_outside          ,mark_index, nodes, indices, polyline_info); //P1Q1      
+      sew_2_marked_darts( final_map(),dof_Q1_outside->beta(3) , top                     ,mark_index, nodes, indices, polyline_info); //Q1P2 or Q1Q2
+      sew_2_marked_darts( final_map(),down                    , dof_P1_outside          ,mark_index, nodes, indices, polyline_info); //Q2P1 or P2P1
+      sew_3_marked_darts( final_map(),not_top,not_down,top,down,mark_index,darts_to_remove);
+
+  }
+  else{
+      Dart_handle top=dof_Q2_outside->beta(3), not_top=dof_P2_outside->beta(3);
+      Dart_handle down=dof_Q2_outside, not_down=dof_P2_outside;
+      if ( top->template attribute<3>()->info().is_empty ) std::swap(not_top,top);
+      if ( down->template attribute<3>()->info().is_empty ) std::swap(not_down,down);
+      CGAL_assertion( !top->template attribute<3>()->info().is_empty );
+      CGAL_assertion( !down->template attribute<3>()->info().is_empty );
+
+      // poly_first  - poly_second            = {0}
+      // poly_second - poly_first             = Q1P1
+      // poly_first \cap poly_second          = P1P2 or P1Q2
+      // opposite( poly_first U poly_second ) = Q2Q1 or P2Q1
+      sew_2_marked_darts( final_map(),dof_Q1_outside->beta(3) , dof_P1_outside          ,mark_index, nodes, indices, polyline_info); //Q1P1
+      sew_2_marked_darts( final_map(),dof_P1_outside->beta(3) , top                     ,mark_index, nodes, indices, polyline_info); //P1P2 or P1Q2
+      sew_2_marked_darts( final_map(),down                    , dof_Q1_outside          ,mark_index, nodes, indices, polyline_info); //Q2Q1 or P2Q1
+      sew_3_marked_darts( final_map(),not_top,not_down,top,down,mark_index,darts_to_remove);
+  }  
+}
+
+template <class Nodes_vector,class Halfedge_to_dart_map>
+bool coplanar_triangles_case_handled(Halfedge_handle first_hedge,Halfedge_handle second_hedge,
+                                     const std::pair<int,int>& indices,
+                                     const Nodes_vector& nodes,
+                                     int index_p1, int index_p2, int index_q1,int index_q2,
+                                     Halfedge_to_dart_map& selected_hedge_to_dart,
+                                     int mark_index,
+                                     std::set<Dart_handle>& darts_to_remove,
+                                     const std::pair<bool,int>& polyline_info)
+{
+  if( index_p1!=-1 ){
+    if (index_p1==index_q1){
+      if(index_p2!=-1){
+        CGAL_assertion(index_p2!=index_q1);
+        if(index_p2==index_q2){
+          //-----first polyhedron
+          Dart_handle dof_P1_outside = get_associated_dart(first_hedge->opposite(),selected_hedge_to_dart);
+          Dart_handle dof_P2_outside = get_associated_dart(first_hedge,selected_hedge_to_dart);
+          //-----second polyhedron
+          Dart_handle dof_Q1_outside = get_associated_dart(second_hedge->opposite(),selected_hedge_to_dart);
+          Dart_handle dof_Q2_outside = get_associated_dart(second_hedge,selected_hedge_to_dart);      
+    
+          Dart_handle top_1=dof_P1_outside->beta(3), not_top_1=dof_Q1_outside->beta(3);
+          Dart_handle top_2=dof_P2_outside->beta(3), not_top_2=dof_Q2_outside->beta(3);
+          Dart_handle down_1=dof_P1_outside, not_down_1=dof_Q1_outside;
+          Dart_handle down_2=dof_P2_outside, not_down_2=dof_Q2_outside;
+          if ( top_1->template attribute<3>()->info().is_empty ) std::swap(top_1,not_top_1);
+          if ( top_2->template attribute<3>()->info().is_empty ) std::swap(top_2,not_top_2);
+          if ( down_1->template attribute<3>()->info().is_empty ) std::swap(down_1,not_down_1);
+          if ( down_2->template attribute<3>()->info().is_empty ) std::swap(down_2,not_down_2);
+          CGAL_assertion( !top_1->template attribute<3>()->info().is_empty );
+          CGAL_assertion( !top_2->template attribute<3>()->info().is_empty );
+          CGAL_assertion( !down_1->template attribute<3>()->info().is_empty );
+          CGAL_assertion( !down_2->template attribute<3>()->info().is_empty );
+          
+          // poly_first  - poly_second            = {0}
+          // poly_second - poly_first             = {0}
+          // poly_first \cap poly_second          = P1P2 or Q1Q2 or P1Q1 or Q1P2
+          // opposite( poly_first U poly_second ) = P2P1 or Q2Q1 or P2Q1 or Q2P1
+          sew_2_marked_darts( final_map(),top_1    , top_2     ,mark_index, nodes, indices, polyline_info); //P1P2 or Q1Q2 or P1Q1 or Q1P2
+          sew_2_marked_darts( final_map(),down_2   , down_1    ,mark_index, nodes, indices, polyline_info); //P2P1 or Q2Q1 or P2Q1 or Q2P1
+          sew_3_marked_darts( final_map(),not_top_1, not_down_1 ,top_1,down_1,mark_index,darts_to_remove);
+          sew_3_marked_darts( final_map(),not_top_2, not_down_2 ,top_2,down_2,mark_index,darts_to_remove);
+          return true;
+        }
+      }
+      sew_2_four_volumes_case_1(first_hedge->opposite(),second_hedge->opposite(),std::make_pair(indices.second,indices.first),nodes,index_p2,index_p1,index_q2,selected_hedge_to_dart,mark_index,darts_to_remove,polyline_info);
+      return true;
+    }
+    if (index_p1==index_q2){
+      if(index_p2!=-1){
+        CGAL_assertion(index_p2!=index_q2);
+        if(index_p2==index_q1){
+          //-----first polyhedron
+          Dart_handle dof_P1_outside = get_associated_dart(first_hedge->opposite(),selected_hedge_to_dart);
+          Dart_handle dof_P2_outside = get_associated_dart(first_hedge,selected_hedge_to_dart);
+          //-----second polyhedron
+          Dart_handle dof_Q1_outside = get_associated_dart(second_hedge->opposite(),selected_hedge_to_dart);
+          Dart_handle dof_Q2_outside = get_associated_dart(second_hedge,selected_hedge_to_dart);  
+          
+          Dart_handle top_1=dof_P1_outside->beta(3), not_top_1=dof_Q2_outside;
+          Dart_handle top_2=dof_P2_outside->beta(3), not_top_2=dof_Q1_outside;
+          Dart_handle down_1=dof_P1_outside, not_down_1=dof_Q2_outside->beta(3);
+          Dart_handle down_2=dof_P2_outside, not_down_2=dof_Q1_outside->beta(3);
+          if ( top_1->template attribute<3>()->info().is_empty ) std::swap(top_1,not_top_1);
+          if ( top_2->template attribute<3>()->info().is_empty ) std::swap(top_2,not_top_2);
+          if ( down_1->template attribute<3>()->info().is_empty ) std::swap(down_1,not_down_1);
+          if ( down_2->template attribute<3>()->info().is_empty ) std::swap(down_2,not_down_2);
+          CGAL_assertion( !top_1->template attribute<3>()->info().is_empty );
+          CGAL_assertion( !top_2->template attribute<3>()->info().is_empty );
+          CGAL_assertion( !down_1->template attribute<3>()->info().is_empty );
+          CGAL_assertion( !down_2->template attribute<3>()->info().is_empty );          
+          
+          // poly_first  - poly_second            = P1P2 or P1Q1 or Q2P2 or Q2Q1
+          // poly_second - poly_first             = Q1Q2 or Q1P1 or P2P1 or P2Q2
+          // poly_first \cap poly_second          = {0}
+          // opposite( poly_first U poly_second ) = all space
+          sew_2_marked_darts( final_map(),top_1    , top_2     ,mark_index, nodes, indices, polyline_info); //P1P2 or Q1Q2 or P1Q1 or Q1P2
+          sew_2_marked_darts( final_map(),down_2   , down_1    ,mark_index, nodes, indices, polyline_info); //P2P1 or Q2Q1 or P2Q1 or Q2P1
+          sew_3_marked_darts( final_map(),not_top_1, not_down_1 ,top_1,down_1,mark_index,darts_to_remove);
+          sew_3_marked_darts( final_map(),not_top_2, not_down_2 ,top_2,down_2,mark_index,darts_to_remove);
+          return true;           
+        }
+      }
+      sew_2_four_volumes_case_1(first_hedge->opposite(),second_hedge,std::make_pair(indices.second,indices.first),nodes,index_p2,index_p1,index_q1,selected_hedge_to_dart,mark_index,darts_to_remove,polyline_info,true);              
+      return true;
+    }
+  }
+  
+  if(index_p2!=-1){
+    if (index_p2==index_q1){
+      sew_2_four_volumes_case_1(first_hedge,second_hedge->opposite(),indices,nodes,index_p1,index_p2,index_q2,selected_hedge_to_dart,mark_index,darts_to_remove,polyline_info,true);
+      return true;
+    }
+    if(index_p2==index_q2){
+      sew_2_four_volumes_case_1(first_hedge,second_hedge,indices,nodes,index_p1,index_p2,index_q1,selected_hedge_to_dart,mark_index,darts_to_remove,polyline_info);
+      return true;
+    }
+  }
+  
+  
+  return false;
+}
+
+//===//
+//end//
+//===//
+  bool do_not_build_cmap; //set to true in the case only the corefinement must be done
+  int number_coplanar_vertices; //number of intersection points between coplanar facets, see fixes XSL_TAG_CPL_VERT
+  EdgeMarkPropertyMap m_edge_mark_pmap;     //property map to mark halfedge of the original polyhedra that are on the intersection
+  NestedFacetConstruct facet_construct;  // functor called to create new triangular faces inside a given face
+  NewNodeVertexVisitor node_vertex_visitor; // functor called when a new node is created and when a new vertex is added
+public:
+  Node_visitor_refine_polyhedra (
+    Combinatorial_map_3_* ptr=NULL,
+    bool do_not_build_cmap_=false,
+    EdgeMarkPropertyMap pmap=EdgeMarkPropertyMap(),
+    const NestedFacetConstruct& fc = NestedFacetConstruct(),
+    const NewNodeVertexVisitor& nv = NewNodeVertexVisitor()
+  ):do_not_build_cmap(do_not_build_cmap_), m_edge_mark_pmap(pmap), facet_construct(fc), node_vertex_visitor(nv)
+  {
+    if (ptr!=NULL){
+      final_map_comes_from_outside=true;
+      final_map_ptr=ptr;
+    }
+    else if (!do_not_build_cmap_) {
+      final_map_comes_from_outside=false;
+      final_map_ptr=new Combinatorial_map_3_();
+    }
+  }
+  
+  ~Node_visitor_refine_polyhedra(){
+    if(!do_not_build_cmap && !final_map_comes_from_outside) {
+      delete final_map_ptr;
+    }
+  }
+
+  
+  typedef internal_IOP::Predicates_on_constructions Node_storage_type;
+  typedef Tag_false Is_polyhedron_const;
+  static const bool do_need_vertex_graph = true;  //because we need to know which edges are constrained
+
+  typedef Combinatorial_map_3_ Combinatorial_map_3;
+  typedef internal_IOP::Volume_info<Polyhedron> Volume_info;
+
+  const Combinatorial_map_3& combinatorial_map() const {return *final_map_ptr;}
+  
+  void set_number_of_intersection_points_from_coplanar_facets(int n){
+    number_coplanar_vertices=n;
+  }
+  
+  void check_node_on_non_manifold_vertex(int node_id,Halfedge_handle hedge){
+    //we turn around the hedge and check no halfedge is a border halfedge
+    Halfedge_handle curr=hedge;
+    do{
+      if ( curr->is_border_edge() ){
+        non_manifold_nodes.insert(node_id);
+        return;
+      }
+      curr=curr->next()->opposite();
+    }
+    while(curr!=hedge);
+  }  
+  
+  void check_node_on_non_manifold_edge(int node_id,Halfedge_handle hedge){
+    if ( hedge->is_border_edge() ) non_manifold_nodes.insert(node_id);
+  }
+  
+  void new_node_added(int node_id,
+                      internal_IOP::Intersection_type type,
+                      Halfedge_handle principal_edge,
+                      Halfedge_handle additional_edge,
+                      bool is_vertex_coplanar,
+                      bool is_vertex_opposite_coplanar)
+  {
+    //forward to the visitor
+    node_vertex_visitor.new_node_added(node_id, type, principal_edge, additional_edge, is_vertex_coplanar, is_vertex_opposite_coplanar);
+    switch(type)
+    {
+      case internal_IOP::FACET: //Facet intersected by an edge
+      {
+        typename In_face_map::iterator it_fmap=in_face.insert(std::make_pair(additional_edge->face(), Node_ids())).first;
+        it_fmap->second.push_back(node_id);
+      }
+      break;
+      case internal_IOP::EDGE: //Edge intersected by an edge
+      {
+        typename In_halfedge_map::iterator it_hedge_map=in_hedge.insert(std::make_pair(additional_edge,Node_id_set())).first;
+        it_hedge_map->second.insert(node_id);
+        check_node_on_non_manifold_edge(node_id,additional_edge);
+      }
+      break;
+      case internal_IOP::VERTEX:
+      {
+        //grab original vertex that is on commom intersection
+        typename Hedge_to_polyhedron_map::iterator it=hedge_to_polyhedron.find(additional_edge->facet()->halfedge());
+        CGAL_assertion(it!=hedge_to_polyhedron.end());
+        poly_to_vertices_on_inter[it->second].insert(std::make_pair(node_id,additional_edge));
+        polyhedron_to_map_node_to_polyhedron_vertex[it->second].insert(std::make_pair(node_id,additional_edge->vertex()));
+        all_incident_faces_got_a_node_as_vertex(additional_edge,node_id);
+        check_node_on_non_manifold_vertex(node_id,additional_edge);
+      }
+      break;
+      default:
+      return;
+    }
+    
+    CGAL_assertion(!is_vertex_coplanar || !is_vertex_opposite_coplanar); //coplanar edge are not forwarded
+    
+    
+    if ( is_vertex_coplanar )
+    {
+      //grab original vertex that is on commom intersection
+      typename Hedge_to_polyhedron_map::iterator it=hedge_to_polyhedron.find(principal_edge->facet()->halfedge());
+      poly_to_vertices_on_inter[it->second].insert(std::make_pair(node_id,principal_edge));
+      polyhedron_to_map_node_to_polyhedron_vertex[it->second].insert(std::make_pair(node_id,principal_edge->vertex()));
+      all_incident_faces_got_a_node_as_vertex(principal_edge,node_id);
+      check_node_on_non_manifold_vertex(node_id,principal_edge);
+    }
+    else{
+      if ( is_vertex_opposite_coplanar ){
+        //grab original vertex that is on commom intersection
+        typename Hedge_to_polyhedron_map::iterator it=hedge_to_polyhedron.find(principal_edge->facet()->halfedge());
+        poly_to_vertices_on_inter[it->second].insert(std::make_pair(node_id,principal_edge->opposite()));
+        polyhedron_to_map_node_to_polyhedron_vertex[it->second].insert(std::make_pair(node_id,principal_edge->opposite()->vertex()));
+        all_incident_faces_got_a_node_as_vertex(principal_edge->opposite(),node_id);
+        check_node_on_non_manifold_vertex(node_id,principal_edge->opposite());
+      }
+      else{
+        //handle intersection on principal edge
+        typename In_halfedge_map::iterator it_hedge_map=in_hedge.insert(std::make_pair(principal_edge,Node_id_set())).first;
+        it_hedge_map->second.insert(node_id);
+        check_node_on_non_manifold_edge(node_id,principal_edge);
+      }
+    }
+  }
+  
+  template<class Iterator>
+  void annotate_graph(Iterator begin,Iterator end)
+  {
+//    std::cout << "Annotation graph..." << std::endl;
+    for (Iterator it=begin;it!=end;++it)
+    {
+      int node_id=it->first;
+      if (non_manifold_nodes.find(node_id)!=non_manifold_nodes.end()) it->second.make_terminal();
+      const std::set<int>& neighbors = it->second.neighbors;
+      graph_of_constraints.insert(std::make_pair(node_id,neighbors));
+    }
+  }
+  
+  void update_terminal_nodes(std::vector<bool>&)
+  {
+    CGAL_assertion(!"Must not call this function");
+  }
+  
+  void add_filtered_intersection(Halfedge_handle eh,Halfedge_handle fh,Polyhedron& Pe,Polyhedron& Pf){
+    //use the representant halfedge of the facet as key
+    //--set polyhedron for the two facets incident to the edge
+    CGAL_assertion(!eh->is_border());
+    hedge_to_polyhedron.insert(std::make_pair(eh->facet()->halfedge(),&Pe));
+    if ( !eh->opposite()->is_border() )
+      hedge_to_polyhedron.insert(std::make_pair(eh->opposite()->facet()->halfedge(),&Pe));
+    //--set polyhedron for the facet intersected by the edge
+    hedge_to_polyhedron.insert(std::make_pair(fh->facet()->halfedge(),&Pf));
+  }
+  
+
+  struct Polyhedron_face_boundary{
+    std::vector<int> node_ids_array[3]; // the node_ids on each halfedges
+    std::map<Halfedge_handle,int,Cmp_unik_ad> hedges_ids;
+    Halfedge_handle halfedges[3]; //the three halfedges of the original face
+    Vertex_handle   vertices[3];  //the three vertices  of the original face
+    //node_ids_array[0] corresponds to the original edge vertices[0],vertices[1] = halfedges[0]
+    //node_ids_array[1] corresponds to the original edge vertices[1],vertices[2] = halfedges[1]
+    //node_ids_array[2] corresponds to the original edge vertices[2],vertices[0] = halfedges[2]
+    Polyhedron_face_boundary(Halfedge_handle first)
+    {
+      CGAL_assertion(first->next()->next()->next()==first); //the face is a triangle
+      hedges_ids.insert(std::make_pair(first,0));
+      hedges_ids.insert(std::make_pair(first->next(),1));
+      hedges_ids.insert(std::make_pair(first->next()->next(),2));
+      halfedges[0]=first;
+      halfedges[1]=first->next();
+      halfedges[2]=first->next()->next();
+      
+      vertices[0]=halfedges[0]->opposite()->vertex();
+      vertices[1]=halfedges[1]->opposite()->vertex();
+      vertices[2]=halfedges[2]->opposite()->vertex();
+    }
+    
+    //used when object was create with hedge but opposite was used to split the original face
+    void update_original_halfedge(Halfedge_handle original,Halfedge_handle new_hedge)
+    {
+      typename std::map<Halfedge_handle,int,Cmp_unik_ad>::iterator it_id=hedges_ids.find(original);
+      CGAL_assertion(it_id!=hedges_ids.end());
+      int index=it_id->second;
+      CGAL_assertion(halfedges[index]==original);
+      hedges_ids.erase(it_id);
+      hedges_ids.insert(std::make_pair(new_hedge,index));
+      halfedges[index]=new_hedge;
+    }
+    
+    template <class Iterator>
+    void copy_node_ids(Halfedge_handle hedge,Iterator begin,Iterator end)
+    {
+      typename std::map<Halfedge_handle,int,Cmp_unik_ad>::iterator it_id=hedges_ids.find(hedge);
+      CGAL_assertion(it_id!=hedges_ids.end());
+      std::copy(begin,end,std::back_inserter(node_ids_array[it_id->second]));
+    }
+  };
+  
+  
+  void start_new_polyline(int i, int j)
+  {
+    if ( i==j ) //case of a single point
+    {
+      //TAG SL001
+      //nothing is done
+      return;
+    }
+    std::pair<typename An_edge_per_polyline_map::iterator,bool> res=
+      an_edge_per_polyline.insert( 
+        std::make_pair( make_sorted_pair(i,j),
+          std::make_pair( std::map<Polyhedron*,Halfedge_handle>(),std::make_pair(false,0))  )
+      );
+    CGAL_assertion(res.second);
+    last_polyline=res.first;
+    if ( i !=last_polyline->first.first ) 
+      last_polyline->second.second.first=true;
+  }
+  
+  void add_node_to_polyline(int){
+    ++(last_polyline->second.second.second);
+  }
+  
+  void new_input_polyhedron(Polyhedron& P)
+  {
+    typedef std::pair<typename Poly_to_map_node::iterator,bool> Res;
+    CGAL_USE_TYPE(Res);
+    CGAL_assertion_code(Res res = )
+      polyhedron_to_map_node_to_polyhedron_vertex.insert(std::make_pair( &P,Node_to_polyhedron_vertex_map() ));
+    CGAL_assertion(res.second == true);
+  }
+  
+  //1) split_halfedges and retriangulate faces with no intersection point interior to the facet
+  //2) retriangulate using a constrained Delaunay triangulation each triangle in each Polyhedron that contains at least
+  //   one intersection point inside the facet
+  //3) mark polyhedron edges that are on the intersection
+  //4) create one output polyhedron per connected component of polyhedron, connected by an edge which is not an intersection edge   
+  //5) import each piece into a common combinatorial map
+  //6) glue all the pieces together
+  template <class Nodes_vector>
+  void finalize(const Nodes_vector& nodes){
+    //mark halfedge that are on the intersection
+    //SL: I needed to use a map because to get the orientation around the edge,
+    //    I need to know in the case the third vertex is a node its index (for exact construction)
+    typedef std::map<Halfedge_const_handle,std::pair<int,int>,Cmp_unik_ad > Border_halfedges_map;
+    Border_halfedges_map border_halfedges;
+    
+    //store for each triangle facet which boundary is intersected by the other surface,
+    //original vertices (and halfedges in the refined mesh pointing on these vertices)
+    typedef std::map<Face_handle,Polyhedron_face_boundary,Cmp_handle> Faces_boundary;
+    Faces_boundary faces_boundary; 
+    
+    //0) For each polyhedron, collect original vertices that belongs to the intersection.
+    //   From the graph of constaints, extract intersection edges that are incident to such vertices. In case
+    //   there exists another original vertex adjacent to the first one found, this halfedge must be
+    //   marked on the boundary (and possibly update an_edge_per_polyline).
+    //   This is done first to avoid halfedges stored to be modified in the steps following.
+    for (typename Poly_to_vertices_on_intersection_map::iterator 
+      it=poly_to_vertices_on_inter.begin();
+      it!=poly_to_vertices_on_inter.end();
+      ++it)
+    {
+      Polyhedron* poly=it->first;
+      std::set<std::pair<int,int> > already_done;
+      Node_to_target_of_hedge_map& nodes_to_hedge=it->second;
+      for(typename Node_to_target_of_hedge_map::iterator 
+        it_node_2_hedge=nodes_to_hedge.begin();
+        it_node_2_hedge!=nodes_to_hedge.end();
+        ++it_node_2_hedge)
+      {
+        int node_id_of_first=it_node_2_hedge->first;
+        std::map< int,std::set<int> >::iterator it_neighbors=graph_of_constraints.find(node_id_of_first);
+        if ( it_neighbors!=graph_of_constraints.end() )
+        {
+          std::set<int>& neighbors=it_neighbors->second;
+          for (std::set<int>::iterator it_id=neighbors.begin();it_id!=neighbors.end();++it_id){
+            if ( already_done.find(std::make_pair(*it_id,node_id_of_first))!=already_done.end() ) continue;//already done for the opposite
+            typename Node_to_target_of_hedge_map::iterator it_node_2_hedge_two=nodes_to_hedge.find(*it_id);
+            if ( it_node_2_hedge_two!=nodes_to_hedge.end() ) //a full edge is on intersection
+            {
+              //get the corresponding halfedge with vertex corresponding to node_id_of_first
+              Halfedge_handle hedge=it_node_2_hedge->second;
+              CGAL_assertion_code(Halfedge_handle start=hedge;)
+              while ( hedge->opposite()->vertex()!=it_node_2_hedge_two->second->vertex() ){
+                hedge=hedge->next()->opposite();
+                CGAL_assertion(hedge!=start);
+              }
+              std::pair<int,int> edge_pair(*it_id,node_id_of_first);
+              border_halfedges.insert( std::make_pair(hedge,edge_pair) );
+              put(m_edge_mark_pmap,std::make_pair(hedge,poly),true);
+              put(m_edge_mark_pmap,std::make_pair(hedge->opposite(),poly),true);
+              update_edge_per_polyline(poly,edge_pair,hedge); 
+              //save the fact that we already handle this edge
+              already_done.insert(std::make_pair(node_id_of_first,*it_id));
+            }
+          }
+        }
+        #ifdef CGAL_COREFINEMENT_DEBUG
+        else
+        {
+          std::cout << "X1: Found an isolated point" << std::endl;
+        }
+        #endif
+      }
+    }
+    
+    //1) First split halfedges cut by the intersection polyline(s)
+    for (typename In_halfedge_map::iterator it=in_hedge.begin();it!=in_hedge.end();++it)
+    {
+      Halfedge_handle hedge=it->first; //the halfedge to be split (and its opposite too)
+      Node_ids node_ids;   //indices of the intersection points to be inserted
+      //we used a set to avoid having duplicated nodes reported on an edge of two coplanar triangles
+      std::copy(it->second.begin(),it->second.end(),std::back_inserter(node_ids));
+      typename Hedge_to_polyhedron_map::iterator  it_poly=hedge_to_polyhedron.find( hedge->facet()->halfedge() );
+      CGAL_assertion(it_poly!=hedge_to_polyhedron.end());
+      Polyhedron* P=it_poly->second;  //the polyhedron in which vertices should be added
+      
+      sort_vertices_along_hedge(node_ids,hedge,nodes);
+
+      //save original face and nodes for face of hedge (1)
+      if ( !hedge->is_border() ){
+        typename Faces_boundary::iterator it_face=faces_boundary.find(hedge->face());
+        if (it_face==faces_boundary.end())
+          it_face=faces_boundary.insert(std::make_pair(hedge->face(),Polyhedron_face_boundary(hedge))).first;
+        it_face->second.copy_node_ids(hedge,node_ids.begin(),node_ids.end());
+      }
+      
+      //save original face and nodes for face of hedge->opposite (2)
+      typename Faces_boundary::iterator opposite_original_info=faces_boundary.end();
+      if ( !hedge->opposite()->is_border() ){
+        opposite_original_info=faces_boundary.find(hedge->opposite()->face());
+        if (opposite_original_info==faces_boundary.end()) 
+          opposite_original_info=faces_boundary.insert(std::make_pair(hedge->opposite()->face(),Polyhedron_face_boundary(hedge->opposite()))).first;
+        opposite_original_info->second.copy_node_ids(hedge->opposite(),node_ids.rbegin(),node_ids.rend());      
+      }      
+      
+      typename Poly_to_map_node::iterator it_map=polyhedron_to_map_node_to_polyhedron_vertex.find(P);
+      CGAL_assertion(it_map!=polyhedron_to_map_node_to_polyhedron_vertex.end());
+      //a map to identify the vertex in the polyhedron corresponding to an intersection point
+      Node_to_polyhedron_vertex_map& node_to_polyhedron_vertex=it_map->second; 
+            
+      CGAL_assertion_code(Vertex_handle original_vertex=hedge->opposite()->vertex();)
+      
+      //We need an edge incident to the source vertex of hedge. This is the first opposite edge created.      
+      bool first=true; Halfedge_handle hedge_incident_to_src;
+      //do split the edges
+      for (std::vector<int>::const_iterator it_id=node_ids.begin();it_id!=node_ids.end();++it_id){
+        Vertex_handle v=split_edge(hedge,nodes[*it_id],*P);
+        node_vertex_visitor.new_vertex_added(*it_id, v);
+        node_to_polyhedron_vertex.insert(std::make_pair(*it_id,v));
+        if (first){
+          first=false;
+          hedge_incident_to_src=hedge->opposite()->next();
+        }
+      }
+      
+      CGAL_assertion(hedge_incident_to_src->vertex()==original_vertex);
+      CGAL_assertion(hedge_incident_to_src->face()==hedge->opposite()->face());
+
+      //save original face and nodes for face of hedge->opposite (2)
+      if ( !hedge->opposite()->is_border() ){
+        CGAL_assertion(opposite_original_info!=faces_boundary.end());
+        opposite_original_info->second.update_original_halfedge(hedge->opposite(),hedge_incident_to_src);
+      }
+      
+      //insert the two incident faces in in_face map so that they will be triangulated.
+      if (!hedge->is_border()) in_face.insert(std::make_pair(hedge->face(),Node_ids()));
+      if (!hedge->opposite()->is_border()) in_face.insert(std::make_pair(hedge->opposite()->face(),Node_ids()));
+    }
+    
+    //2)triangulation of the triangle faces containing intersection point in their interior
+    //  and also those with intersection points only on the boundary.
+    for (typename In_face_map::iterator it=in_face.begin();it!=in_face.end();++it)
+    {
+      Face_handle f = it->first; //the face to be retriangulated
+      Node_ids& node_ids  = it->second; //the index of the intersection point that are interior to the face
+      typename Faces_boundary::iterator it_fb=faces_boundary.find(f);
+
+      
+      typename Hedge_to_polyhedron_map::iterator it_polyhedron = hedge_to_polyhedron.find (f->halfedge()); //we can do this because the halfedge is still the same (at least its address)+no Face::set_halfedge called
+      CGAL_assertion(it_polyhedron != hedge_to_polyhedron.end());
+      Polyhedron* P=it_polyhedron->second;
+      typename Poly_to_map_node::iterator it_map=polyhedron_to_map_node_to_polyhedron_vertex.find(P);
+      CGAL_assertion(it_map!=polyhedron_to_map_node_to_polyhedron_vertex.end());
+      //a map to identify the vertex in the polyhedron corresponding to an intersection point
+      Node_to_polyhedron_vertex_map& node_to_polyhedron_vertex=it_map->second;
+      
+      std::map<int,typename CDT::Vertex_handle> id_to_CDT_vh;
+      
+      //associate an edge of the triangulation to a halfedge in a given polyhedron
+      std::map<std::pair<int,int>,Halfedge_handle> edge_to_hedge;
+      
+      Vertex_handle triangle_boundary[3];
+      int triangle_boundary_indices[3]; //the node_id of the triangle original vertex or a fake id
+      if (it_fb!=faces_boundary.end()){ //the boundary of the triangle face was refined
+        triangle_boundary[0]=it_fb->second.vertices[0];
+        triangle_boundary[1]=it_fb->second.vertices[1];
+        triangle_boundary[2]=it_fb->second.vertices[2];
+        set_triangle_boundary_indices(triangle_boundary,triangle_boundary_indices);
+      }
+      else{
+        triangle_boundary[0]=f->halfedge()->vertex(); //-1
+        triangle_boundary[1]=f->halfedge()->next()->vertex(); //-2
+        triangle_boundary[2]=f->halfedge()->next()->next()->vertex(); //-3
+        CGAL_assertion(f->halfedge()->next()->next()->next()==f->halfedge());//check this is a triangle
+        set_triangle_boundary_indices(triangle_boundary,triangle_boundary_indices);        
+        edge_to_hedge.insert (std::make_pair( std::make_pair( triangle_boundary_indices[2],triangle_boundary_indices[0] ) , f->halfedge() ) );
+        edge_to_hedge.insert (std::make_pair( std::make_pair( triangle_boundary_indices[0],triangle_boundary_indices[1] ) , f->halfedge()->next() ) );
+        edge_to_hedge.insert (std::make_pair( std::make_pair( triangle_boundary_indices[1],triangle_boundary_indices[2] ) , f->halfedge()->next()->next() ) );
+      }
+
+      
+      #ifdef DO_NO_USE_EXACT_CDT
+      typename Kernel::Plane_3 plane(triangle_boundary[0]->point(),triangle_boundary[1]->point(),triangle_boundary[2]->point());
+      #else
+      CGAL::Cartesian_converter<Kernel,Exact_kernel> convert;
+      typename Exact_kernel::Plane_3 plane(convert(triangle_boundary[0]->point()),convert(triangle_boundary[1]->point()),convert(triangle_boundary[2]->point()));
+      #endif
+      CDT triangulation;
+      //insert point inside face
+      for (std::vector<int>::iterator it_node_id=node_ids.begin();it_node_id!=node_ids.end();++it_node_id){
+        #ifdef DO_NO_USE_EXACT_CDT
+        typename CDT::Vertex_handle vh=triangulation.insert(plane.to_2d(nodes[*it_node_id]));
+        #else
+        typename CDT::Vertex_handle vh=triangulation.insert(plane.to_2d(nodes.exact_node(*it_node_id)));
+        #endif
+        vh->info()=*it_node_id;
+        id_to_CDT_vh.insert(std::make_pair(*it_node_id,vh));
+      }
+      
+      
+      typename CDT::Vertex_handle triangle_vertices[3];
+      #ifdef DO_NO_USE_EXACT_CDT
+      triangle_vertices[0]=triangulation.insert(plane.to_2d(triangle_boundary[0]->point()));
+      triangle_vertices[1]=triangulation.insert(plane.to_2d(triangle_boundary[1]->point()));
+      triangle_vertices[2]=triangulation.insert(plane.to_2d(triangle_boundary[2]->point()));
+      #else
+      //we can do this because these are input points.
+      triangle_vertices[0]=triangulation.insert(plane.to_2d(convert(triangle_boundary[0]->point())));
+      triangle_vertices[1]=triangulation.insert(plane.to_2d(convert(triangle_boundary[1]->point())));
+      triangle_vertices[2]=triangulation.insert(plane.to_2d(convert(triangle_boundary[2]->point())));      
+      #endif
+      
+      triangle_vertices[0]->info()=triangle_boundary_indices[0];
+      triangle_vertices[1]->info()=triangle_boundary_indices[1];
+      triangle_vertices[2]->info()=triangle_boundary_indices[2];
+      //insert face_extremities: we use operator[] because indice -1,-2,-3 are used in each loop and are specific to the current face
+      node_to_polyhedron_vertex[-1]=triangle_boundary[0];
+      node_to_polyhedron_vertex[-2]=triangle_boundary[1];
+      node_to_polyhedron_vertex[-3]=triangle_boundary[2];
+      
+      //if one of the triangle original vertex is also a node
+      for (int ik=0;ik<3;++ik){
+        if ( triangle_boundary_indices[ik]>=0 )
+          id_to_CDT_vh.insert(std::make_pair(triangle_boundary_indices[ik],triangle_vertices[ik]));
+      }
+      //insert points on edges 
+      #ifdef DO_NO_USE_EXACT_CDT
+      //and constrains these edges
+      #endif
+      if (it_fb!=faces_boundary.end()) //is there at least one intersection point on the boundary of the face?
+      {
+        //in the following loop, for each original edge of the triangle, we insert the constrained edges
+        // and we recover the halfedge_handle corresponding to these constrained (they are already in the polyhedron)
+        for (int i=0;i<3;++i){
+//          std::cerr << "Boundary edges" << std::endl;
+//          std::cerr <<  "  " << -1-i <<std::endl;
+          //handle case of halfedge starting at triangle_vertices[i] and ending at triangle_vertices[(i+1)%3]
+          Node_ids& bounding_ids=it_fb->second.node_ids_array[i];
+          typename CDT::Vertex_handle previous=triangle_vertices[i];
+          int previous_index=triangle_boundary_indices[i]; //index of original Polyhedron vertex
+          Halfedge_handle hedge = it_fb->second.halfedges[ (i+2) % 3]->next();
+          CGAL_assertion( hedge->opposite()->vertex()==it_fb->second.vertices[i] );
+          if (!bounding_ids.empty()){ //is there al least one intersection point on this edge?
+            for (Node_ids::iterator it_id=bounding_ids.begin();it_id!=bounding_ids.end();++it_id){
+//              std::cerr << "  "<<  *it_id << std::endl;
+              #ifdef DO_NO_USE_EXACT_CDT
+              typename CDT::Vertex_handle vh=triangulation.insert(plane.to_2d(nodes[*it_id]));
+              #else
+              typename CDT::Vertex_handle vh=triangulation.insert(plane.to_2d(nodes.exact_node(*it_id))); 
+              #endif
+              vh->info()=*it_id;
+              id_to_CDT_vh.insert(std::make_pair(*it_id,vh));
+              #ifdef DO_NO_USE_EXACT_CDT
+              triangulation.insert_constraint(previous,vh);
+              #endif
+              edge_to_hedge.insert (std::make_pair( std::make_pair(previous_index,*it_id),hedge) );
+              previous=vh;
+              hedge=hedge->next();
+              previous_index=*it_id;
+            }
+          }
+          else{
+            CGAL_assertion( it_fb->second.halfedges[i]->vertex() == it_fb->second.vertices[ (i+1) % 3 ] );
+            CGAL_assertion( it_fb->second.halfedges[i]->opposite()->vertex() == it_fb->second.vertices[ i ] );
+          }
+          CGAL_assertion(hedge==it_fb->second.halfedges[i]);
+          edge_to_hedge.insert (std::make_pair( std::make_pair(previous_index,triangle_boundary_indices[(i+1) % 3]) , it_fb->second.halfedges[i] ) );
+//          std::cerr <<  "  " << -1 - ( (i+1) % 3 ) <<std::endl;
+          #ifdef DO_NO_USE_EXACT_CDT
+          triangulation.insert_constraint(previous,triangle_vertices[(i+1)%3]);
+          #endif
+        }
+      }
+      
+      std::list<std::pair<int,int> > constrained_edges;
+      
+      //insert constraints that are interior to the triangle (in the case no edges are collinear in the meshes)
+      insert_constrained_edges(node_ids,triangulation,id_to_CDT_vh,constrained_edges);
+      
+      //insert constraints between points that are on the boundary (not a contrained on the triangle boundary)
+      if (it_fb!=faces_boundary.end()) //is there at least one intersection point on the boundary of the face?
+      {
+        for (int i=0;i<3;++i){
+          Node_ids& bounding_ids=it_fb->second.node_ids_array[i];  
+          insert_constrained_edges(bounding_ids,triangulation,id_to_CDT_vh,constrained_edges,true);
+        }
+      }
+      
+      //insert coplanar edges for endpoints of triangles
+      for (int i=0;i<3;++i){
+        int nindex=triangle_vertices[i]->info();
+        if ( nindex >=0 )
+          insert_constrained_edges_coplanar_case(nindex,triangulation,id_to_CDT_vh);
+      }
+      
+      //XSL_TAG_CPL_VERT
+      //collect edges incident to a point that is the intersection of two coplanar faces.
+      //This ensure that triangulations are compatible.
+      if (it_fb!=faces_boundary.end()) //is there at least one intersection point on the boundary of the face?
+      {
+        for (typename CDT::Finite_vertices_iterator vit=triangulation.finite_vertices_begin(),
+                                                vit_end=triangulation.finite_vertices_end();vit_end!=vit;++vit)
+        {
+          //skip original vertices (that are not nodes) and non-coplanar facet issued vertices 
+          //(this is working because intersection points between coplanar facets are the first inserted)
+          if ( vit->info() < 0 || vit->info() >= number_coplanar_vertices) continue;
+          std::map< int,std::set<int> >::iterator res=coplanar_constraints.insert(std::make_pair(vit->info(),std::set<int>())).first;
+          //turn around the vertex and get incident edge
+          typename CDT::Edge_circulator  start=triangulation.incident_edges(vit);
+          typename CDT::Edge_circulator  curr=start;
+          do{
+            if (triangulation.is_infinite(*curr) ) continue;
+            typename CDT::Edge mirror_edge=triangulation.mirror_edge(*curr);
+            if ( triangulation.is_infinite( curr->first->vertex(curr->second) ) ||
+                 triangulation.is_infinite( mirror_edge.first->vertex(mirror_edge.second) ) )            
+              continue; //skip edges that are on the boundary of the triangle (these are already constrained)
+            //insert edges in the set of constraints
+            int nindex = 
+              curr->first->vertex( (curr->second+1)%3 )==static_cast<typename CDT::Vertex_handle>(vit)?
+              (curr->second+2)%3:(curr->second+1)%3;
+            typename CDT::Vertex_handle vn=curr->first->vertex(nindex);
+            if ( vit->info() > vn->info() ) continue; //take only one out of the two edges + skip negative vn->info()
+            CGAL_assertion(vn->info()>=0);            
+            res->second.insert( vn->info() );
+          }while(start!=++curr);
+        }
+        
+// this is a working alternative that should be slower        
+//        for (typename CDT::Finite_edges_iterator eit=triangulation.finite_edges_begin(),
+//                                             eit_end=triangulation.finite_edges_end();eit_end!=eit;++eit)
+//        {
+//          typename CDT::Edge mirror_edge=triangulation.mirror_edge(*eit);
+//          if ( triangulation.is_infinite( eit->first->vertex(eit->second) ) ||
+//              triangulation.is_infinite( mirror_edge.first->vertex(mirror_edge.second) ) )
+//            continue; //skip edges that are on the boundary of the triangle (these are already constrained)
+//          typename CDT::Vertex_handle v1=eit->first->vertex( (eit->second+1)%3 ),
+//                                      v2=eit->first->vertex( (eit->second+2)%3 );
+//          if (v1->info()<0 || v2->info()<0) continue;
+//          if ( v1->info() > v2->info() ) std::swap(v1,v2);
+//          coplanar_constraints.insert(std::make_pair(v1->info(),std::set<int>())).first->second.insert(v2->info());
+//        }
+      }
+      
+      
+      //create a modifier to insert nodes and copy the triangulation of the face
+      //inside the polyhedron
+      internal_IOP::Triangulate_a_face<typename Polyhedron::HalfedgeDS, NestedFacetConstruct, NewNodeVertexVisitor> modifier(
+        f, nodes, node_ids, node_to_polyhedron_vertex, edge_to_hedge, triangulation, facet_construct, node_vertex_visitor);
+      
+      CGAL_assertion(P->is_valid());
+      P->delegate(modifier);
+      CGAL_assertion(P->is_valid());
+      
+      //3) mark halfedges that are common to two polyhedral surfaces
+      //recover halfedges inserted that are on the intersection
+      for (std::list<std::pair<int,int> >::iterator it_cst=constrained_edges.begin();it_cst!=constrained_edges.end();++it_cst)
+      {
+        typename std::map<std::pair<int,int>,Halfedge_handle>::iterator it_poly_hedge=edge_to_hedge.find(*it_cst);
+        //we cannot have an assertion here in the case an edge or part of an edge is a constraints.
+        //Indeed, the graph_of_constraints report an edge 0,1 and 1,0 for example while only one of the two
+        //is defined as one of them defines an adjacent face
+        //CGAL_assertion(it_poly_hedge!=edge_to_hedge.end());
+        if( it_poly_hedge!=edge_to_hedge.end() ){
+          border_halfedges.insert( std::make_pair(Halfedge_const_handle(it_poly_hedge->second),*it_cst) );
+          put(m_edge_mark_pmap,std::make_pair(it_poly_hedge->second,P),true);
+          put(m_edge_mark_pmap,std::make_pair(it_poly_hedge->second->opposite(),P),true); //setting the opposite is only needed for border edges (done in adjacent triangle otherwise)
+          update_edge_per_polyline(P,it_poly_hedge->first,it_poly_hedge->second);
+        }
+        else{
+          //WARNING: in few case this is needed if the marked edge is on the border
+          //to optimize it might be better to only use sorted pair. TAG_SLXX1
+          std::pair<int,int> opposite_pair(it_cst->second,it_cst->first);
+          it_poly_hedge=edge_to_hedge.find(opposite_pair);
+          CGAL_assertion( it_poly_hedge!=edge_to_hedge.end() );
+
+          border_halfedges.insert( std::make_pair(Halfedge_const_handle(it_poly_hedge->second),opposite_pair) );
+          put(m_edge_mark_pmap,std::make_pair(it_poly_hedge->second,P),true);
+          put(m_edge_mark_pmap,std::make_pair(it_poly_hedge->second->opposite(),P),true); //setting the opposite is only needed for border edges (done in adjacent triangle otherwise)
+          update_edge_per_polyline(P,it_poly_hedge->first,it_poly_hedge->second);          
+        }
+      }
+    }
+   
+    if (do_not_build_cmap) return;
+    
+    //4) create one output polyhedron per connected component of polyhedron,
+    //   connected by an edge which is not an intersection edge  
+    //5) import into a Combinatorial map
+    #ifdef CGAL_COREFINEMENT_DEBUG
+    std::cout << "Nb marked edges " << border_halfedges.size() << std::endl;
+//    for (typename Border_halfedges_map::iterator it=border_halfedges.begin();it!=border_halfedges.end();++it)
+//      std::cout << it->first->opposite()->vertex()->point() << " " << it->first->vertex()->point() << " is constrained " << std::endl;
+    std::cout << "Nb polylines " << an_edge_per_polyline.size() << std::endl;
+    #endif
+    
+    internal_IOP::Non_intersection_halfedge<Polyhedron> criterium(border_halfedges);
+
+    int mark_index = static_cast<int>(final_map().get_new_mark());
+                     //mark used to tag dart that are on an intersection
+
+    //define a map that will contain the correspondance between selected halfedges of the boundary and
+    //their corresponding Dart_handle in the cmap.
+    typedef std::map<Halfedge_const_handle,typename Combinatorial_map_3::Dart_handle,internal_IOP::Compare_address<Polyhedron> > Halfedge_to_dart_map;
+    Halfedge_to_dart_map selected_hedge_to_dart;
+    for (typename An_edge_per_polyline_map::iterator it=an_edge_per_polyline.begin();it!=an_edge_per_polyline.end();++it)
+    {
+      CGAL_assertion(it->second.first.size()==2);
+      //orientation of faces around the edge (to be sure we can do it)
+      Halfedge_handle first_hedge=it->second.first.begin()->second;
+      Halfedge_handle second_hedge=boost::next(it->second.first.begin())->second;
+      
+      if (!first_hedge->is_border())               selected_hedge_to_dart.insert(std::make_pair(first_hedge,Dart_handle(NULL)));
+      if (!first_hedge->opposite()->is_border())   selected_hedge_to_dart.insert(std::make_pair(first_hedge->opposite(),Dart_handle(NULL)));
+      if (!second_hedge->is_border())              selected_hedge_to_dart.insert(std::make_pair(second_hedge,Dart_handle(NULL)));
+      if (!second_hedge->opposite()->is_border())  selected_hedge_to_dart.insert(std::make_pair(second_hedge->opposite(),Dart_handle(NULL)));
+    }
+    
+    #ifdef CGAL_COREFINEMENT_DEBUG
+    int polynb=0;
+    #endif
+    for (typename Poly_to_map_node::iterator 
+          it=polyhedron_to_map_node_to_polyhedron_vertex.begin();
+          it!=polyhedron_to_map_node_to_polyhedron_vertex.end();
+          ++it
+        )
+    {
+      typedef typename Polyhedron::Facet_const_handle Facet_const_handle;
+      typedef ::CGAL::Union_find<Facet_const_handle> UF;
+      typedef typename UF::handle UF_handle;
+      typedef std::map<Facet_const_handle,std::list<Facet_const_handle>,internal::corefinement::Compare_handle_ptr<Polyhedron> > Result;
+      typedef std::map<Facet_const_handle,UF_handle,internal::corefinement::Compare_handle_ptr<Polyhedron> > Facet_to_handle_map;
+      
+      UF uf;
+      Facet_to_handle_map map_f2h;
+      Result result;
+      Polyhedron* current_poly=it->first;
+      
+      #ifdef CGAL_COREFINEMENT_DEBUG
+      std::cout << "writing poly debug"<< std::endl;
+      std::stringstream ss; 
+      ss << "output_debug-" << ++polynb << ".off";
+      std::ofstream output_debug(ss.str().c_str());
+      output_debug << *current_poly;
+      #endif
+      
+      internal::corefinement::extract_connected_components(*(static_cast<Polyhedron const *> (current_poly) ),criterium,uf,map_f2h,result);
+
+      
+      //add each connected component in the map with 2 volumes per component.
+      for (typename Result::iterator it_res=result.begin();it_res!=result.end();++it_res)
+      {
+        //create in the final Cmap a 2D component containing faces of a connected component 
+        //(twice: one with same orientation and one with the opposite orientation to model the other volume)
+        Dart_handle d = import_from_polyhedron_subset<Polyhedron>(final_map(),it_res->second.begin(),it_res->second.end(),criterium,selected_hedge_to_dart,mark_index);
+        //set an attribute to one volume represented by this component to indicates 
+        //a part outside of the polyhedron current_poly
+        typename Combinatorial_map_3_::template Attribute_range<3>::type::iterator attrib=final_map().template create_attribute<3>();
+        attrib->info().outside.insert(current_poly);
+        final_map().template set_attribute<3>(d,attrib);
+        //set the attribute for the opposite volume: represent a part inside current_poly
+        attrib=final_map().template create_attribute<3>();
+        attrib->info().inside.insert(current_poly);
+        final_map().template set_attribute<3>(d->beta(3),attrib);        
+        
+        #ifdef CGAL_COREFINEMENT_DEBUG
+        final_map().display_characteristics(std::cout);
+        std::cout << std::endl;
+        #endif
+      }
+    }
+    #ifndef NDEBUG
+    for(typename Halfedge_to_dart_map::iterator it=selected_hedge_to_dart.begin();it!=selected_hedge_to_dart.end();++it)
+      CGAL_assertion(it->second!=Dart_handle(NULL));
+    #endif
+    
+    CGAL_assertion(final_map().is_valid());
+
+    std::set<Dart_handle> darts_to_remove;
+    
+    //6) Glue pieces together
+    //   using one edge per intersection polyline, we merge the different volumes
+    for (typename An_edge_per_polyline_map::iterator it=an_edge_per_polyline.begin();it!=an_edge_per_polyline.end();++it)
+    {
+      CGAL_assertion(it->second.first.size()==2);
+      //orientation of faces around the edge (to be sure we can do it)
+      std::pair<int,int> indices = it->first;
+      const std::pair<bool,int>& polyline_info=it->second.second;
+
+      //get the two halfedges incident to the edge [indices.first,indices.second]
+      Halfedge_handle first_hedge=it->second.first.begin()->second;
+      Halfedge_handle second_hedge=boost::next(it->second.first.begin())->second;
+
+      CGAL_assertion(nodes[indices.second]==first_hedge->vertex()->point());
+      CGAL_assertion(nodes[indices.first]==first_hedge->opposite()->vertex()->point());
+      CGAL_assertion(nodes[indices.second]==second_hedge->vertex()->point());
+      CGAL_assertion(nodes[indices.first]==second_hedge->opposite()->vertex()->point());
+      
+      Polyhedron* first_poly  = it->second.first.begin()->first;
+      Polyhedron* second_poly = boost::next(it->second.first.begin())->first;
+      
+      //different handling depending on the number of incident triangles to the edge.
+      //After sewing there are two,three or four volumes if there are two,three or four incident triangles respectively
+      if ( first_hedge->is_border() || first_hedge->opposite()->is_border() ){
+        if (second_hedge->is_border()  || second_hedge->opposite()->is_border())
+          sew_2_two_volumes_case(first_hedge,second_hedge,border_halfedges,selected_hedge_to_dart,mark_index,darts_to_remove,nodes,indices,polyline_info);
+        else
+          sew_2_three_volumes_case(second_hedge, first_hedge,indices,nodes,border_halfedges,selected_hedge_to_dart,second_poly,first_poly,mark_index,darts_to_remove,polyline_info);
+      }
+      else
+        if (second_hedge->is_border()  || second_hedge->opposite()->is_border())
+          sew_2_three_volumes_case(first_hedge, second_hedge,indices,nodes,border_halfedges,selected_hedge_to_dart,first_poly,second_poly,mark_index,darts_to_remove,polyline_info);
+        else
+        {
+          //Sort the four triangle facets around their common edge
+          //  we suppose that the exterior of the polyhedron is indicated by
+          //  counterclockwise oriented facets.
+          Vertex_handle P1=first_hedge->opposite()->next()->vertex();
+          Vertex_handle P2=first_hedge->next()->vertex();
+          //    when looking from the side of indices.second, the interior of the first polyhedron is described 
+          //    by turning counterclockwise from P1 to P2
+          Vertex_handle Q1=second_hedge->opposite()->next()->vertex();
+          Vertex_handle Q2=second_hedge->next()->vertex();
+          //    when looking from the side of indices.second, the interior of the second polyhedron is described 
+          //    by turning from Q1 to Q2
+          
+          //check if the third point of each triangular face is an original point (stay -1)
+          //or a intersection point (in that case we need the index of the corresponding node to
+          //have the exact value of the point)      
+          int index_p1=node_index_of_incident_vertex(first_hedge->opposite()->next(),border_halfedges);
+          int index_p2=node_index_of_incident_vertex(first_hedge->next(),border_halfedges);
+          int index_q1=node_index_of_incident_vertex(second_hedge->opposite()->next(),border_halfedges);
+          int index_q2=node_index_of_incident_vertex(second_hedge->next(),border_halfedges);      
+          
+          #ifdef CGAL_COREFINEMENT_DEBUG
+          std::cout << index_p1 << " " << index_p2 << " " << index_q1 << " " <<index_q2 << std::endl;
+          std::cout << nodes[indices.first] << " | " << nodes[indices.second] << std::endl;
+          std::cout << P1->point() << " | " << P2->point() << " | " << Q1->point() << " | " <<Q2->point() << std::endl;
+          #endif
+          
+          if ( coplanar_triangles_case_handled(first_hedge,second_hedge,indices,nodes,index_p1,index_p2,index_q1,index_q2,selected_hedge_to_dart,mark_index,darts_to_remove,polyline_info) )
+            continue;
+          
+          CGAL_assertion(P1->point() !=Q1->point() && P1->point()!=Q2->point() && P2->point() !=Q1->point() && P2->point()!=Q2->point());
+          
+          bool Q1_is_between_P1P2 = filtered_order_around_edge(indices.first,indices.second,index_p1,index_p2,index_q1,P1,P2,Q1,nodes);
+          bool Q2_is_between_P1P2 = filtered_order_around_edge(indices.first,indices.second,index_p1,index_p2,index_q2,P1,P2,Q2,nodes);
+          
+          
+          //Recover the dart that will be the start point of the different sewing
+          //  dof_X_outside = dart of face of , meaning the triangle containing the
+          //  point X and part of the volume outside of the corresponding polyhedron      
+          //-----first polyhedron
+          Dart_handle dof_P1_outside = get_associated_dart(first_hedge->opposite(),selected_hedge_to_dart);
+          Dart_handle dof_P2_outside = get_associated_dart(first_hedge,selected_hedge_to_dart);
+          //-----second polyhedron
+          Dart_handle dof_Q1_outside = get_associated_dart(second_hedge->opposite(),selected_hedge_to_dart);
+          Dart_handle dof_Q2_outside = get_associated_dart(second_hedge,selected_hedge_to_dart);   
+          
+          if ( Q1_is_between_P1P2 ){
+            if( Q2_is_between_P1P2 )
+            {
+              bool P1_is_between_Q1Q2 = filtered_order_around_edge(indices.first,indices.second,index_q1,index_q2,index_p1,Q1,Q2,P1,nodes);
+              if (!P1_is_between_Q1Q2){
+                // poly_first  - poly_second            = P1Q1 U Q2P2
+                // poly_second - poly_first             = {0}
+                // poly_first \cap poly_second          = Q1Q2
+                // opposite( poly_first U poly_second ) = P2P1
+                sew_2_marked_darts( final_map(),dof_P1_outside->beta(3) , dof_Q1_outside          ,mark_index, nodes, indices, polyline_info); //P1Q1
+                sew_2_marked_darts( final_map(),dof_Q2_outside          , dof_P2_outside->beta(3) ,mark_index, nodes, indices, polyline_info); //Q2P2
+                sew_2_marked_darts( final_map(),dof_Q1_outside->beta(3) , dof_Q2_outside->beta(3) ,mark_index, nodes, indices, polyline_info); //Q1Q2
+                sew_2_marked_darts( final_map(),dof_P2_outside          , dof_P1_outside          ,mark_index, nodes, indices, polyline_info); //P2P1
+                //update inside outside info (because darts from the same volume have been merged)
+                dof_Q1_outside->beta(3)->template attribute<3>()->info().inside.insert(first_poly); //update Q1Q2 inside poly
+                dof_P2_outside->template attribute<3>()->info().outside.insert(second_poly);//update P2P1 outside poly
+              }
+              else{
+                // poly_first  - poly_second            = Q2Q1
+                // poly_second - poly_first             = P2P1
+                // poly_first \cap poly_second          = P1Q2 U Q1P2
+                // opposite( poly_first U poly_second ) = {O}
+                sew_2_marked_darts( final_map(),dof_Q2_outside          , dof_Q1_outside          ,mark_index, nodes, indices, polyline_info); //Q2Q1
+                sew_2_marked_darts( final_map(),dof_P2_outside          , dof_P1_outside          ,mark_index, nodes, indices, polyline_info); //P2P1
+                sew_2_marked_darts( final_map(),dof_Q1_outside->beta(3) , dof_P2_outside->beta(3) ,mark_index, nodes, indices, polyline_info); //Q1P2
+                sew_2_marked_darts( final_map(),dof_P1_outside->beta(3) , dof_Q2_outside->beta(3) ,mark_index, nodes, indices, polyline_info); //P1Q2
+                //update inside outside info (because darts from the same volume have been merged)
+                dof_Q2_outside->template attribute<3>()->info().inside.insert(first_poly); //update Q2Q1 inside poly
+                dof_P2_outside->template attribute<3>()->info().inside.insert(second_poly);//update P2P1 inside poly            
+              }
+            }
+            else
+            {
+              // poly_first  - poly_second            = P1Q1
+              // poly_second - poly_first             = P2Q2
+              // poly_first \cap poly_second          = Q1P2
+              // opposite( poly_first U poly_second ) = Q2P1
+              sew_2_marked_darts( final_map(),dof_P1_outside->beta(3) , dof_Q1_outside          ,mark_index, nodes, indices, polyline_info); //P1Q1
+              sew_2_marked_darts( final_map(),dof_P2_outside          , dof_Q2_outside->beta(3) ,mark_index, nodes, indices, polyline_info); //P2Q2
+              sew_2_marked_darts( final_map(),dof_Q1_outside->beta(3) , dof_P2_outside->beta(3) ,mark_index, nodes, indices, polyline_info); //Q1P2
+              sew_2_marked_darts( final_map(),dof_Q2_outside          , dof_P1_outside          ,mark_index, nodes, indices, polyline_info); //Q2P1
+            }        
+          }
+          else
+          {
+            if( Q2_is_between_P1P2 )
+            {
+              // poly_first  - poly_second            = Q2P2
+              // poly_second - poly_first             = Q1P1
+              // poly_first \cap poly_second          = P1Q2
+              // opposite( poly_first U poly_second ) = P2Q1
+              sew_2_marked_darts( final_map(),dof_Q2_outside          , dof_P2_outside->beta(3) ,mark_index, nodes, indices, polyline_info); //Q2P2
+              sew_2_marked_darts( final_map(),dof_Q1_outside->beta(3) , dof_P1_outside          ,mark_index, nodes, indices, polyline_info); //Q1P1
+              sew_2_marked_darts( final_map(),dof_P1_outside->beta(3) , dof_Q2_outside->beta(3) ,mark_index, nodes, indices, polyline_info); //P1Q2
+              sew_2_marked_darts( final_map(),dof_P2_outside          , dof_Q1_outside          ,mark_index, nodes, indices, polyline_info); //P2Q1
+            }
+            else
+            {
+              bool P1_is_between_Q1Q2 = filtered_order_around_edge(indices.first,indices.second,index_q1,index_q2,index_p1,Q1,Q2,P1,nodes);
+              if (!P1_is_between_Q1Q2){
+                // poly_first  - poly_second            = P1P2
+                // poly_second - poly_first             = Q1Q2
+                // poly_first \cap poly_second          = {0}
+                // opposite( poly_first U poly_second ) = P2Q1 U Q2P1
+                sew_2_marked_darts( final_map(),dof_P1_outside->beta(3) , dof_P2_outside->beta(3) ,mark_index, nodes, indices, polyline_info); //P1P2
+                sew_2_marked_darts( final_map(),dof_Q1_outside->beta(3) , dof_Q2_outside->beta(3) ,mark_index, nodes, indices, polyline_info); //Q1Q2
+                sew_2_marked_darts( final_map(),dof_P2_outside          , dof_Q1_outside          ,mark_index, nodes, indices, polyline_info); //P2Q1
+                sew_2_marked_darts( final_map(),dof_Q2_outside          , dof_P1_outside          ,mark_index, nodes, indices, polyline_info); //Q2P1
+                //update inside outside info (because darts from the same volume have been merged)
+                dof_Q1_outside->beta(3)->template attribute<3>()->info().outside.insert(first_poly); //update Q1Q2 outside poly
+                dof_P1_outside->beta(3)->template attribute<3>()->info().outside.insert(second_poly);//update P2P1 outside poly            
+              }
+              else{
+                // poly_first  - poly_second            = {0}
+                // poly_second - poly_first             = Q1P1 U P2Q2
+                // poly_first \cap poly_second          = P1P2
+                // opposite( poly_first U poly_second ) = Q2Q1
+                sew_2_marked_darts( final_map(),dof_Q1_outside->beta(3) , dof_P1_outside          ,mark_index, nodes, indices, polyline_info); //Q1P1
+                sew_2_marked_darts( final_map(),dof_P2_outside          , dof_Q2_outside->beta(3) ,mark_index, nodes, indices, polyline_info); //P2Q2
+                sew_2_marked_darts( final_map(),dof_P1_outside->beta(3) , dof_P2_outside->beta(3) ,mark_index, nodes, indices, polyline_info); //P1P2
+                sew_2_marked_darts( final_map(),dof_Q2_outside          , dof_Q1_outside          ,mark_index, nodes, indices, polyline_info); //Q2Q1
+                //update inside outside info (because darts from the same volume have been merged)
+                dof_P1_outside->beta(3)->template attribute<3>()->info().inside.insert(second_poly); //update P1P2 inside poly
+                dof_Q2_outside->template attribute<3>()->info().outside.insert(first_poly);//update Q2Q1 outside poly            
+              }
+            }
+          }
+        }      
+    }
+    
+    #ifdef CGAL_COREFINEMENT_DEBUG
+    std::cout << "number of darts to remove: " << darts_to_remove.size() <<std::endl;
+    #endif
+    //remove darts from empty volumes
+    for (typename std::set<Dart_handle>::iterator itdart=darts_to_remove.begin(),end=darts_to_remove.end();itdart!=end;++itdart){
+      final_map().erase_dart(*itdart);
+    }
+    
+    //remove empty volumes
+    typedef typename Combinatorial_map_3_::template Attribute_range<3>::type Volume_attribute_range;
+    Volume_attribute_range& ratrib=final_map().template attributes<3>();     
+    typename Volume_attribute_range::iterator curr=ratrib.begin(),end=ratrib.end();
+    do{
+      if (curr->info().is_empty)
+        final_map().template erase_attribute<3>(curr++);
+      else
+        ++curr;
+    }
+    while(curr!=end);
+    
+    CGAL_assertion(final_map().is_valid());
+    
+    //update the info of each volume knowing about only one polyhedron:
+    //this happens when one polyhedron has a connected component
+    //that do not intersect the other polyhedron
+
+    typedef Side_of_triangle_mesh<Polyhedron, Kernel> Inside_poly_test;
+
+    CGAL_precondition(polyhedron_to_map_node_to_polyhedron_vertex.size()==2);
+    Polyhedron* Poly_A = polyhedron_to_map_node_to_polyhedron_vertex.begin()->first;
+    Polyhedron* Poly_B = boost::next(polyhedron_to_map_node_to_polyhedron_vertex.begin())->first;
+    Inside_poly_test* inside_A_test_ptr=NULL;
+    Inside_poly_test* inside_B_test_ptr=NULL;
+    bool Poly_A_is_closed = Poly_A->is_closed();
+    bool Poly_B_is_closed = Poly_B->is_closed();
+
+    #ifdef CGAL_COREFINEMENT_DEBUG
+    final_map().display_characteristics(std::cout); std::cout << "\n";
+    #endif
+
+    typename Combinatorial_map_3::template  One_dart_per_cell_range<3> cell_range=final_map().template one_dart_per_cell<3>();
+    for (typename Combinatorial_map_3::template  One_dart_per_cell_range<3>::iterator
+      it = cell_range.begin(), it_end=cell_range.end();
+      it_end!= it;
+      ++it )
+    {
+      internal_IOP::Volume_info<Polyhedron>& info=it->template attribute<3>()->info();
+      std::size_t inside_size=info.inside.size();
+      std::size_t outside_size=info.outside.size();
+
+      // if a volume is not classified wrt the two polyhedra, it means the component we look at does not
+      // is a disjoint (but maybe at a vertex TAG SL001)
+      if ( inside_size + outside_size == 1)
+      {
+        bool is_inside = (inside_size==1);
+        Polyhedron* current_poly= is_inside? (*info.inside.begin()):(*info.outside.begin());
+        Polyhedron* test_poly;
+        Inside_poly_test* inside_test_ptr;
+        if ( current_poly==Poly_A)
+        {
+          // is the polyhedron is not closed, we set Poly_A to be outside by default
+          if (!Poly_B_is_closed){
+            info.outside.insert(Poly_B);
+            continue;
+          }
+          test_poly=Poly_B;
+          if (inside_B_test_ptr == NULL) inside_B_test_ptr=new Inside_poly_test(*Poly_B);
+          inside_test_ptr=inside_B_test_ptr;
+        }
+        else
+        {
+          // is the polyhedron is not closed, we set Poly_B to be outside by default
+          if (!Poly_A_is_closed){
+            info.outside.insert(Poly_A);
+            continue;
+          }
+          test_poly=Poly_A;
+          if (inside_A_test_ptr == NULL) inside_A_test_ptr=new Inside_poly_test(*Poly_A);
+          inside_test_ptr=inside_A_test_ptr;
+        }
+
+        // We need to find a point of the volume that is not on the boundary of the other volume.
+        // Then the position of this point give the position of the volume. If all the points are on
+        // the bounday, we take the mid-point of an edge (which must not be on the boundary otherwise
+        // it contradicts the fact that volumes are disjoint
+        // We first use the dart we have since one_dart_per_incident_cell has a non-negligeable cost.
+        typename Kernel::Point_3 query=it->template attribute<0>()->point();
+        CGAL::Bounded_side res = (*inside_test_ptr)(query);
+        if (res==ON_BOUNDARY)
+        {
+          typedef typename Combinatorial_map_3::
+            template One_dart_per_incident_cell_range<0,3> Vertex_range;
+
+          Vertex_range vertex_range =
+            final_map().template one_dart_per_incident_cell<0,3>(it);
+          typename Vertex_range::iterator vit = vertex_range.begin();
+
+          CGAL_assertion( typename Combinatorial_map_3::Dart_handle(vit) ==
+                          typename Combinatorial_map_3::Dart_handle(it) );
+          ++vit;
+          for ( ; vit!=vertex_range.end(); ++vit)
+          {
+            query=vit->template attribute<0>()->point();
+            res = (*inside_test_ptr)(query);
+            if ( res != ON_BOUNDARY ) break;
+          }
+
+          //take edge midpoint
+          if (res == ON_BOUNDARY)
+          {
+            /// \todo see do a better test here. At least the construction cannot fail
+            ///  but the mid-point can fall outside of the volume...
+            #ifdef CGAL_COREFINEMENT_DEBUG
+            #warning this is not exact!!!
+            #endif
+            typename Kernel::Point_3 p1=it->template attribute<0>()->point();
+            typename Kernel::Point_3 p2=it->beta(1)->template attribute<0>()->point();
+            query=midpoint(p1,p2);
+            res = (*inside_test_ptr)(query);
+          }
+
+          CGAL_assertion( res!= ON_BOUNDARY );
+        }
+
+        if (res  == ON_BOUNDED_SIDE )
+          info.inside.insert(test_poly);
+        else
+          info.outside.insert(test_poly);
+      }
+
+      #ifdef CGAL_COREFINEMENT_DEBUG
+      std::cout << "This volume has inside: ";
+      for (typename std::set<Polyhedron*>::iterator itpoly=info.inside.begin();itpoly!=info.inside.end();++itpoly)
+        std::cout << " " << *itpoly;
+      std::cout << " and outside: ";
+      for (typename std::set<Polyhedron*>::iterator itpoly=info.outside.begin();itpoly!=info.outside.end();++itpoly)
+        std::cout << " " << *itpoly;
+      std::cout << std::endl;
+      #endif
+    }
+    if (inside_A_test_ptr!=NULL) delete inside_A_test_ptr;
+    if (inside_B_test_ptr!=NULL) delete inside_B_test_ptr;
+  }
+};
+
+}//namespace CGAL
+  
+
+
+#endif //CGAL_INTERSECTION_OF_POLYHEDRA_3_REFINEMENT_VISITOR_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/intersections.h b/3rdparty/CGAL/include/CGAL/intersections.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/intersections.h
rename to 3rdparty/CGAL/include/CGAL/intersections.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/intersections_d.h b/3rdparty/CGAL/include/CGAL/intersections_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/intersections_d.h
rename to 3rdparty/CGAL/include/CGAL/intersections_d.h
diff --git a/3rdparty/CGAL/include/CGAL/ipower.h b/3rdparty/CGAL/include/CGAL/ipower.h
new file mode 100644
index 0000000..4c8cc10
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/ipower.h
@@ -0,0 +1,83 @@
+// Copyright (c) 2008 Max-Planck-Institute Saarbruecken (Germany).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Michael Hemmer 
+//
+// 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$
+
+#ifndef CGAL_IPOWER_H
+#define CGAL_IPOWER_H
+
+#include <CGAL/assertions.h>
+
+namespace CGAL {
+
+template <typename NT>
+inline
+NT ipower(const NT& base, int expn) {
+    // compute base^expn using square-and-multiply
+    CGAL_precondition(expn >= 0);
+    
+    // handle trivial cases efficiently
+    if (expn == 0) return NT(1);
+    if (expn == 1) return base;
+    
+    // find the most significant non-zero bit of expn
+    int e = expn, msb = 0;
+    while (e >>= 1) msb++;
+    
+    // computing base^expn by square-and-multiply
+    NT res = base;
+    int b = 1<<msb;
+    while (b >>= 1) { // is there another bit right of what we saw so far?
+        res *= res;
+        if (expn & b) res *= base;
+    }
+    return res;
+}
+
+template <typename NT>
+inline
+NT ipower(const NT& base, long expn) {
+    // compute base^expn using square-and-multiply
+    CGAL_precondition(expn >= 0);
+    
+    // handle trivial cases efficiently
+    if (expn == 0) return NT(1);
+    if (expn == 1) return base;
+    
+    // find the most significant non-zero bit of expn
+    long e = expn, msb = 0;
+    while (e >>= 1) msb++;
+    
+    // computing base^expn by square-and-multiply
+    NT res = base;
+    long b = 1L<<msb;
+    while (b >>= 1) { // is there another bit right of what we saw so far?
+        res *= res;
+        if (expn & b) res *= base;
+    }
+    return res;
+}
+
+} //namespace CGAL
+
+#endif // CGAL_IPOWER_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/is_convertible.h b/3rdparty/CGAL/include/CGAL/is_convertible.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/is_convertible.h
rename to 3rdparty/CGAL/include/CGAL/is_convertible.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/is_iterator.h b/3rdparty/CGAL/include/CGAL/is_iterator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/is_iterator.h
rename to 3rdparty/CGAL/include/CGAL/is_iterator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/is_streamable.h b/3rdparty/CGAL/include/CGAL/is_streamable.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/is_streamable.h
rename to 3rdparty/CGAL/include/CGAL/is_streamable.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/is_y_monotone_2.h b/3rdparty/CGAL/include/CGAL/is_y_monotone_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/is_y_monotone_2.h
rename to 3rdparty/CGAL/include/CGAL/is_y_monotone_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/iterator.h b/3rdparty/CGAL/include/CGAL/iterator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/iterator.h
rename to 3rdparty/CGAL/include/CGAL/iterator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/iterator_from_indices.h b/3rdparty/CGAL/include/CGAL/iterator_from_indices.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/iterator_from_indices.h
rename to 3rdparty/CGAL/include/CGAL/iterator_from_indices.h
diff --git a/3rdparty/CGAL/include/CGAL/jet_estimate_normals.h b/3rdparty/CGAL/include/CGAL/jet_estimate_normals.h
new file mode 100644
index 0000000..7cb5239
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/jet_estimate_normals.h
@@ -0,0 +1,339 @@
+// Copyright (c) 2007-09  INRIA Sophia-Antipolis (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
+// 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(s) : Pierre Alliez and Laurent Saboret and Marc Pouget and Frederic Cazals
+
+#ifndef CGAL_JET_ESTIMATE_NORMALS_H
+#define CGAL_JET_ESTIMATE_NORMALS_H
+
+#include <CGAL/trace.h>
+#include <CGAL/Search_traits_3.h>
+#include <CGAL/Orthogonal_k_neighbor_search.h>
+#include <CGAL/Monge_via_jet_fitting.h>
+#include <CGAL/property_map.h>
+#include <CGAL/point_set_processing_assertions.h>
+#include <CGAL/Memory_sizer.h>
+
+#include <iterator>
+#include <list>
+
+#ifdef CGAL_LINKED_WITH_TBB
+#include <tbb/parallel_for.h>
+#include <tbb/blocked_range.h>
+#include <tbb/scalable_allocator.h>  
+#endif // CGAL_LINKED_WITH_TBB
+
+namespace CGAL {
+
+
+// ----------------------------------------------------------------------------
+// Private section
+// ----------------------------------------------------------------------------
+/// \cond SKIP_IN_MANUAL
+namespace internal {
+
+
+/// Estimates normal direction using jet fitting
+/// on the k nearest neighbors.
+///
+/// \pre `k >= 2`
+///
+/// @tparam Kernel Geometric traits class.
+/// @tparam Tree KD-tree.
+///
+/// @return Computed normal. Orientation is random.
+template < typename Kernel,
+           typename SvdTraits,
+           typename Tree
+>
+typename Kernel::Vector_3
+jet_estimate_normal(const typename Kernel::Point_3& query, ///< point to compute the normal at
+                    Tree& tree, ///< KD-tree
+                    unsigned int k, ///< number of neighbors
+                    unsigned int degree_fitting)
+{
+  // basic geometric types
+  typedef typename Kernel::Point_3  Point;
+
+  // types for K nearest neighbors search
+  typedef typename CGAL::Search_traits_3<Kernel> Tree_traits;
+  typedef typename CGAL::Orthogonal_k_neighbor_search<Tree_traits> Neighbor_search;
+  typedef typename Neighbor_search::iterator Search_iterator;
+
+  // types for jet fitting
+  typedef Monge_via_jet_fitting< Kernel,
+                                 Simple_cartesian<double>,
+                                 SvdTraits> Monge_jet_fitting;
+  typedef typename Monge_jet_fitting::Monge_form Monge_form;
+
+  // Gather set of (k+1) neighboring points.
+  // Perform k+1 queries (as in point set, the query point is
+  // output first). Search may be aborted if k is greater
+  // than number of input points.
+  std::vector<Point> points; points.reserve(k+1);
+  Neighbor_search search(tree,query,k+1);
+  Search_iterator search_iterator = search.begin();
+  unsigned int i;
+  for(i=0;i<(k+1);i++)
+  {
+    if(search_iterator == search.end())
+      break; // premature ending
+    points.push_back(search_iterator->first);
+    search_iterator++;
+  }
+  CGAL_point_set_processing_precondition(points.size() >= 1);
+
+  // performs jet fitting
+  Monge_jet_fitting monge_fit;
+  const unsigned int degree_monge = 1; // we seek for normal and not more.
+  Monge_form monge_form = monge_fit(points.begin(), points.end(),
+                                    degree_fitting, degree_monge);
+
+  // output normal vector (already normalized in monge form)
+  return monge_form.normal_direction();
+}
+
+#ifdef CGAL_LINKED_WITH_TBB
+  template <typename Kernel, typename SvdTraits, typename Tree>
+  class Jet_estimate_normals {
+    typedef typename Kernel::Point_3 Point;
+    typedef typename Kernel::Vector_3 Vector;
+    const Tree& tree;
+    const unsigned int k;
+    const unsigned int degree_fitting;
+    const std::vector<Point>& input;
+    std::vector<Vector>& output;
+
+  public:
+    Jet_estimate_normals(Tree& tree, unsigned int k, std::vector<Point>& points,
+		     unsigned int degree_fitting, std::vector<Vector>& output)
+      : tree(tree), k (k), degree_fitting (degree_fitting), input (points), output (output)
+    { }
+    
+    void operator()(const tbb::blocked_range<std::size_t>& r) const
+    {
+      for( std::size_t i = r.begin(); i != r.end(); ++i)
+	output[i] = CGAL::internal::jet_estimate_normal<Kernel,SvdTraits>(input[i], tree, k, degree_fitting);
+    }
+
+  };
+#endif // CGAL_LINKED_WITH_TBB
+
+
+  
+} /* namespace internal */
+/// \endcond
+
+
+
+// ----------------------------------------------------------------------------
+// Public section
+// ----------------------------------------------------------------------------
+
+/// \ingroup PkgPointSetProcessing
+/// Estimates normal directions of the `[first, beyond)` range of points
+/// using jet fitting on the k nearest neighbors.
+/// The output normals are randomly oriented.
+///
+/// \pre `k >= 2`
+///
+/// @tparam Concurrency_tag enables sequential versus parallel algorithm.
+///                         Possible values are `Sequential_tag`
+///                         and `Parallel_tag`.
+/// @tparam ForwardIterator iterator model of the concept of the same name over input points and able to store output normals.
+/// @tparam PointPMap is a model of `ReadablePropertyMap` with  value type `Point_3<Kernel>`.
+///        It can be omitted if the value type of `ForwardIterator` is convertible to `Point_3<Kernel>`.
+/// @tparam NormalPMap is a model of `WritablePropertyMap` with value type `Vector_3<Kernel>`.
+/// @tparam Kernel Geometric traits class.
+///        It can be omitted and deduced automatically from the value type of `PointPMap`.
+/// @tparam SvdTraits template parameter for the class `Monge_via_jet_fitting` that
+///         can be ommited under conditions described in the documentation of `Monge_via_jet_fitting`.
+
+// This variant requires all parameters.
+template <typename Concurrency_tag,
+	  typename ForwardIterator,
+          typename PointPMap,
+          typename NormalPMap,
+          typename Kernel,
+          typename SvdTraits
+>
+void
+jet_estimate_normals(
+  ForwardIterator first,  ///< iterator over the first input point.
+  ForwardIterator beyond, ///< past-the-end iterator over the input points.
+  PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3.
+  NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3.
+  unsigned int k, ///< number of neighbors.
+  const Kernel& /*kernel*/, ///< geometric traits.
+  unsigned int degree_fitting = 2) ///< fitting degree
+{
+  CGAL_TRACE("Calls jet_estimate_normals()\n");
+
+  // basic geometric types
+  typedef typename Kernel::Point_3 Point;
+
+  // Input points types
+  typedef typename boost::property_traits<NormalPMap>::value_type Vector;
+
+  // types for K nearest neighbors search structure
+  typedef typename CGAL::Search_traits_3<Kernel> Tree_traits;
+  typedef typename CGAL::Orthogonal_k_neighbor_search<Tree_traits> Neighbor_search;
+  typedef typename Neighbor_search::Tree Tree;
+
+  // precondition: at least one element in the container.
+  // to fix: should have at least three distinct points
+  // but this is costly to check
+  CGAL_point_set_processing_precondition(first != beyond);
+
+  // precondition: at least 2 nearest neighbors
+  CGAL_point_set_processing_precondition(k >= 2);
+
+  std::size_t memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE("  %ld Mb allocated\n", memory>>20);
+  CGAL_TRACE("  Creates KD-tree\n");
+
+  ForwardIterator it;
+
+  // Instanciate a KD-tree search.
+  // Note: We have to convert each input iterator to Point_3.
+  std::vector<Point> kd_tree_points; 
+  for(it = first; it != beyond; it++)
+    kd_tree_points.push_back(get(point_pmap, *it));
+  Tree tree(kd_tree_points.begin(), kd_tree_points.end());
+
+  memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE("  %ld Mb allocated\n", memory>>20);
+  CGAL_TRACE("  Computes normals\n");
+
+  // iterate over input points, compute and output normal
+  // vectors (already normalized)
+#ifndef CGAL_LINKED_WITH_TBB
+  CGAL_static_assertion_msg (!(boost::is_convertible<Concurrency_tag, Parallel_tag>::value),
+			     "Parallel_tag is enabled but TBB is unavailable.");
+#else
+   if (boost::is_convertible<Concurrency_tag,Parallel_tag>::value)
+   {
+     std::vector<Vector> normals (kd_tree_points.size ());
+     CGAL::internal::Jet_estimate_normals<Kernel, SvdTraits, Tree>
+       f (tree, k, kd_tree_points, degree_fitting, normals);
+     tbb::parallel_for(tbb::blocked_range<size_t>(0, kd_tree_points.size ()), f);
+     unsigned int i = 0;
+     for(it = first; it != beyond; ++ it, ++ i)
+       {
+	 put (normal_pmap, *it, normals[i]);
+       }
+   }
+   else
+#endif
+     {
+       for(it = first; it != beyond; it++)
+	 {
+	   Vector normal = internal::jet_estimate_normal<Kernel,SvdTraits,Tree>(
+										get(point_pmap,*it), 
+										tree, k, degree_fitting);
+
+	   put(normal_pmap, *it, normal); // normal_pmap[it] = normal
+    
+	 }
+     }
+
+
+  memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE("  %ld Mb allocated\n", memory>>20);
+  CGAL_TRACE("End of jet_estimate_normals()\n");
+}
+
+#if defined(CGAL_EIGEN3_ENABLED) || defined(CGAL_LAPACK_ENABLED)
+/// @cond SKIP_IN_MANUAL
+template <typename Concurrency_tag,
+	  typename ForwardIterator,
+          typename PointPMap,
+          typename NormalPMap,
+          typename Kernel
+>
+void
+jet_estimate_normals(
+  ForwardIterator first,
+  ForwardIterator beyond,
+  PointPMap point_pmap,
+  NormalPMap normal_pmap,
+  unsigned int k,
+  const Kernel& kernel,
+  unsigned int degree_fitting = 2)
+{
+  #ifdef CGAL_EIGEN3_ENABLED
+  typedef Eigen_svd SvdTraits;
+  #else
+  typedef Lapack_svd SvdTraits;
+  #endif
+  jet_estimate_normals<Concurrency_tag,ForwardIterator,PointPMap,NormalPMap,Kernel,SvdTraits>(
+    first, beyond, point_pmap, normal_pmap, k,  kernel, degree_fitting);
+}
+
+/// @cond SKIP_IN_MANUAL
+// This variant deduces the kernel from the point property map.
+template <typename Concurrency_tag,
+	  typename ForwardIterator,
+          typename PointPMap,
+          typename NormalPMap
+>
+void
+jet_estimate_normals(
+  ForwardIterator first,  ///< iterator over the first input point.
+  ForwardIterator beyond, ///< past-the-end iterator over the input points.
+  PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3.
+  NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3.
+  unsigned int k, ///< number of neighbors.
+  unsigned int degree_fitting = 2)
+{
+  typedef typename boost::property_traits<PointPMap>::value_type Point;
+  typedef typename Kernel_traits<Point>::Kernel Kernel;
+  jet_estimate_normals<Concurrency_tag>(
+    first,beyond,
+    point_pmap, 
+    normal_pmap,
+    k,
+    Kernel(),
+    degree_fitting);
+}
+/// @endcond
+
+/// @cond SKIP_IN_MANUAL
+// This variant creates a default point property map = Identity_property_map.
+template <typename Concurrency_tag,
+	  typename ForwardIterator,
+          typename NormalPMap
+>
+void
+jet_estimate_normals(
+  ForwardIterator first,  ///< iterator over the first input point.
+  ForwardIterator beyond, ///< past-the-end iterator over the input points.
+  NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3.
+  unsigned int k, ///< number of neighbors.
+  unsigned int degree_fitting = 2)
+{
+  jet_estimate_normals<Concurrency_tag>(
+    first,beyond,
+    make_identity_property_map(
+    typename std::iterator_traits<ForwardIterator>::value_type()),
+    normal_pmap,
+    k,
+    degree_fitting);
+}
+/// @endcond
+#endif
+
+} //namespace CGAL
+
+#endif // CGAL_JET_ESTIMATE_NORMALS_H
diff --git a/3rdparty/CGAL/include/CGAL/jet_smooth_point_set.h b/3rdparty/CGAL/include/CGAL/jet_smooth_point_set.h
new file mode 100644
index 0000000..d36acb4
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/jet_smooth_point_set.h
@@ -0,0 +1,323 @@
+// Copyright (c) 2007-09  INRIA Sophia-Antipolis (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
+// 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(s) : Pierre Alliez, Marc Pouget and Laurent Saboret
+
+#ifndef CGAL_JET_SMOOTH_POINT_SET_H
+#define CGAL_JET_SMOOTH_POINT_SET_H
+
+#include <CGAL/trace.h>
+#include <CGAL/Search_traits_3.h>
+#include <CGAL/Orthogonal_k_neighbor_search.h>
+#include <CGAL/Monge_via_jet_fitting.h>
+#include <CGAL/property_map.h>
+#include <CGAL/point_set_processing_assertions.h>
+
+#include <iterator>
+#include <list>
+
+#ifdef CGAL_LINKED_WITH_TBB
+#include <tbb/parallel_for.h>
+#include <tbb/blocked_range.h>
+#include <tbb/scalable_allocator.h>  
+#endif // CGAL_LINKED_WITH_TBB
+
+namespace CGAL {
+
+
+// ----------------------------------------------------------------------------
+// Private section
+// ----------------------------------------------------------------------------
+/// \cond SKIP_IN_MANUAL
+
+namespace internal {
+
+/// Smoothes one point position using jet fitting on the k
+/// nearest neighbors and reprojection onto the jet.
+///
+/// \pre `k >= 2`
+///
+/// @tparam Kernel Geometric traits class.
+/// @tparam Tree KD-tree.
+///
+/// @return computed point
+template <typename Kernel,
+          typename SvdTraits,
+          typename Tree
+          >
+typename Kernel::Point_3
+jet_smooth_point(
+  const typename Kernel::Point_3& query, ///< 3D point to project
+  Tree& tree, ///< KD-tree
+  const unsigned int k, ///< number of neighbors.
+  const unsigned int degree_fitting,
+  const unsigned int degree_monge)
+{
+  // basic geometric types
+  typedef typename Kernel::Point_3 Point;
+
+  // types for K nearest neighbors search
+  typedef typename CGAL::Search_traits_3<Kernel> Tree_traits;
+  typedef typename CGAL::Orthogonal_k_neighbor_search<Tree_traits> Neighbor_search;
+  typedef typename Neighbor_search::iterator Search_iterator;
+
+  // types for jet fitting
+  typedef Monge_via_jet_fitting< Kernel,
+                                 Simple_cartesian<double>,
+                                 SvdTraits> Monge_jet_fitting;
+  typedef typename Monge_jet_fitting::Monge_form Monge_form;
+
+  // Gather set of (k+1) neighboring points.
+  // Performs k + 1 queries (if unique the query point is
+  // output first). Search may be aborted if k is greater
+  // than number of input points.
+  std::vector<Point> points; points.reserve(k+1);
+  Neighbor_search search(tree,query,k+1);
+  Search_iterator search_iterator = search.begin();
+  unsigned int i;
+  for(i=0;i<(k+1);i++)
+  {
+    if(search_iterator == search.end())
+      break; // premature ending
+    points.push_back(search_iterator->first);
+    search_iterator++;
+  }
+  CGAL_point_set_processing_precondition(points.size() >= 1);
+
+  // performs jet fitting
+  Monge_jet_fitting monge_fit;
+  Monge_form monge_form = monge_fit(points.begin(), points.end(),
+                                    degree_fitting, degree_monge);
+
+  // output projection of query point onto the jet
+  return monge_form.origin();
+}
+
+#ifdef CGAL_LINKED_WITH_TBB
+  template <typename Kernel, typename SvdTraits, typename Tree>
+  class Jet_smooth_pwns {
+    typedef typename Kernel::Point_3 Point;
+    const Tree& tree;
+    const unsigned int k;
+    unsigned int degree_fitting;
+    unsigned int degree_monge;
+    const std::vector<Point>& input;
+    std::vector<Point>& output;
+
+  public:
+    Jet_smooth_pwns (Tree& tree, unsigned int k, std::vector<Point>& points,
+		     unsigned int degree_fitting, unsigned int degree_monge, std::vector<Point>& output)
+      : tree(tree), k (k), degree_fitting (degree_fitting),
+	degree_monge (degree_monge), input (points), output (output)
+    { }
+    
+    void operator()(const tbb::blocked_range<std::size_t>& r) const
+    {
+      for( std::size_t i = r.begin(); i != r.end(); ++i)
+	output[i] = CGAL::internal::jet_smooth_point<Kernel, SvdTraits>(input[i], tree, k,
+									degree_fitting,
+									degree_monge);
+    }
+
+  };
+#endif // CGAL_LINKED_WITH_TBB
+
+
+} /* namespace internal */
+
+/// \endcond
+
+
+
+// ----------------------------------------------------------------------------
+// Public section
+// ----------------------------------------------------------------------------
+
+/// \ingroup PkgPointSetProcessing
+/// Smoothes the `[first, beyond)` range of points using jet fitting on the k
+/// nearest neighbors and reprojection onto the jet.
+/// As this method relocates the points, it
+/// should not be called on containers sorted w.r.t. point locations.
+///
+/// \pre `k >= 2`
+///
+/// @tparam Concurrency_tag enables sequential versus parallel algorithm.
+///                         Possible values are `Sequential_tag`
+///                         and `Parallel_tag`.
+/// @tparam InputIterator iterator over input points.
+/// @tparam PointPMap is a model of `ReadWritePropertyMap` with value type `Point_3<Kernel>`.
+///        It can be omitted if  the value type of `InputIterator` is convertible to `Point_3<Kernel>`.
+/// @tparam Kernel Geometric traits class.
+///        It can be omitted and deduced automatically from the value type of `PointPMap`.
+/// @tparam SvdTraits template parameter for the class `Monge_via_jet_fitting` that
+///         can be ommited under conditions described in the documentation of `Monge_via_jet_fitting`.
+
+// This variant requires all parameters.
+template <typename Concurrency_tag,
+	  typename InputIterator,
+          typename PointPMap,
+          typename Kernel,
+          typename SvdTraits
+>
+void
+jet_smooth_point_set(
+  InputIterator first,  ///< iterator over the first input point.
+  InputIterator beyond, ///< past-the-end iterator over the input points.
+  PointPMap point_pmap, ///< property map: value_type of InputIterator -> Point_3.
+  unsigned int k, ///< number of neighbors.
+  const Kernel& /*kernel*/, ///< geometric traits.
+  unsigned int degree_fitting = 2, ///< fitting degree
+  unsigned int degree_monge = 2)  ///< Monge degree
+{
+  // basic geometric types
+  typedef typename Kernel::Point_3 Point;
+
+  // types for K nearest neighbors search structure
+  typedef typename CGAL::Search_traits_3<Kernel> Tree_traits;
+  typedef typename CGAL::Orthogonal_k_neighbor_search<Tree_traits> Neighbor_search;
+  typedef typename Neighbor_search::Tree Tree;
+
+  // precondition: at least one element in the container.
+  // to fix: should have at least three distinct points
+  // but this is costly to check
+  CGAL_point_set_processing_precondition(first != beyond);
+
+  // precondition: at least 2 nearest neighbors
+  CGAL_point_set_processing_precondition(k >= 2);
+  
+  InputIterator it;
+
+  // Instanciate a KD-tree search.
+  // Note: We have to convert each input iterator to Point_3.
+  std::vector<Point> kd_tree_points; 
+  for(it = first; it != beyond; it++)
+    kd_tree_points.push_back(get(point_pmap, *it));
+  Tree tree(kd_tree_points.begin(), kd_tree_points.end());
+
+  // Iterates over input points and mutates them.
+  // Implementation note: the cast to Point& allows to modify only the point's position.
+
+#ifndef CGAL_LINKED_WITH_TBB
+  CGAL_static_assertion_msg (!(boost::is_convertible<Concurrency_tag, Parallel_tag>::value),
+			     "Parallel_tag is enabled but TBB is unavailable.");
+#else
+   if (boost::is_convertible<Concurrency_tag,Parallel_tag>::value)
+   {
+     std::vector<Point> mutated_points (kd_tree_points.size ());
+     CGAL::internal::Jet_smooth_pwns<Kernel, SvdTraits, Tree>
+       f (tree, k, kd_tree_points, degree_fitting, degree_monge,
+	  mutated_points);
+     tbb::parallel_for(tbb::blocked_range<size_t>(0, kd_tree_points.size ()), f);
+     unsigned int i = 0;
+     for(it = first; it != beyond; ++ it, ++ i)
+       {
+	 put(point_pmap, *it, mutated_points[i]);
+
+       }
+   }
+   else
+#endif
+     {
+       for(it = first; it != beyond; it++)
+	 {
+	   typename boost::property_traits<PointPMap>::reference p = get(point_pmap, *it);
+	   put(point_pmap, *it ,
+	       internal::jet_smooth_point<Kernel, SvdTraits>(
+							     p,tree,k,degree_fitting,degree_monge) );
+	 }
+     }
+}
+
+
+#if defined(CGAL_EIGEN3_ENABLED) || defined(CGAL_LAPACK_ENABLED)
+/// @cond SKIP_IN_MANUAL
+template <typename Concurrency_tag,
+	  typename InputIterator,
+          typename PointPMap,
+          typename Kernel
+>
+void
+jet_smooth_point_set(
+  InputIterator first,  ///< iterator over the first input point.
+  InputIterator beyond, ///< past-the-end iterator over the input points.
+  PointPMap point_pmap, ///< property map: value_type of InputIterator -> Point_3.
+  unsigned int k, ///< number of neighbors.
+  const Kernel& kernel, ///< geometric traits.
+  unsigned int degree_fitting = 2, ///< fitting degree
+  unsigned int degree_monge = 2)  ///< Monge degree
+{
+  #ifdef CGAL_EIGEN3_ENABLED
+  typedef Eigen_svd SvdTraits;
+  #else
+  typedef Lapack_svd SvdTraits;
+  #endif
+  jet_smooth_point_set<Concurrency_tag, InputIterator, PointPMap, Kernel, SvdTraits>(
+    first, beyond, point_pmap, k, kernel, degree_fitting, degree_monge);
+}
+
+/// @cond SKIP_IN_MANUAL
+// This variant deduces the kernel from the point property map.
+template <typename Concurrency_tag,
+	  typename InputIterator,
+          typename PointPMap
+>
+void
+jet_smooth_point_set(
+  InputIterator first, ///< iterator over the first input point
+  InputIterator beyond, ///< past-the-end iterator
+  PointPMap point_pmap, ///< property map: value_type of InputIterator -> Point_3
+  unsigned int k, ///< number of neighbors.
+  const unsigned int degree_fitting = 2,
+  const unsigned int degree_monge = 2)
+{
+  typedef typename boost::property_traits<PointPMap>::value_type Point;
+  typedef typename Kernel_traits<Point>::Kernel Kernel;
+  jet_smooth_point_set<Concurrency_tag>(
+    first,beyond,
+    point_pmap,
+    k,
+    Kernel(),
+    degree_fitting,degree_monge);
+}
+/// @endcond
+
+/// @cond SKIP_IN_MANUAL
+// This variant creates a default point property map = Identity_property_map.
+template <typename Concurrency_tag,
+	  typename InputIterator
+>
+void
+jet_smooth_point_set(
+  InputIterator first, ///< iterator over the first input point
+  InputIterator beyond, ///< past-the-end iterator
+  unsigned int k, ///< number of neighbors.
+  const unsigned int degree_fitting = 2,
+  const unsigned int degree_monge = 2)
+{
+  jet_smooth_point_set<Concurrency_tag>(
+    first,beyond,
+    make_identity_property_map(
+    typename std::iterator_traits<InputIterator>::value_type()),
+    k,
+    degree_fitting,degree_monge);
+}
+/// @endcond
+#endif
+
+} //namespace CGAL
+
+#endif // CGAL_JET_SMOOTH_POINT_SET_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/kernel_assertions.h b/3rdparty/CGAL/include/CGAL/kernel_assertions.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/kernel_assertions.h
rename to 3rdparty/CGAL/include/CGAL/kernel_assertions.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/kernel_basic.h b/3rdparty/CGAL/include/CGAL/kernel_basic.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/kernel_basic.h
rename to 3rdparty/CGAL/include/CGAL/kernel_basic.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/kernel_config.h b/3rdparty/CGAL/include/CGAL/kernel_config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/kernel_config.h
rename to 3rdparty/CGAL/include/CGAL/kernel_config.h
diff --git a/3rdparty/CGAL/include/CGAL/kernel_to_kernel.h b/3rdparty/CGAL/include/CGAL/kernel_to_kernel.h
new file mode 100644
index 0000000..f96ee01
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/kernel_to_kernel.h
@@ -0,0 +1,111 @@
+// Copyright (c) 1999  
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved. 
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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(s)     : Stefan Schirra
+ 
+#ifndef CGAL_KERNEL_TO_KERNEL_H
+#define CGAL_KERNEL_TO_KERNEL_H
+
+#include <CGAL/config.h>
+
+#ifdef CGAL_USE_LEDA
+#include <CGAL/LEDA_basic.h>
+#include <CGAL/leda_integer.h>
+#include <LEDA/geo/rat_point.h>
+#endif
+
+#include <CGAL/Point_2.h>
+#include <CGAL/Segment_2.h>
+#include <CGAL/Cartesian.h>
+#include <CGAL/Homogeneous.h>
+
+namespace CGAL {
+
+template <class NumberType>
+struct Cartesian_double_to_Homogeneous
+{
+  typedef Point_2< Homogeneous< NumberType> >    Point2;
+  typedef Segment_2< Homogeneous< NumberType> >  Segment;
+
+  Cartesian_double_to_Homogeneous() {}
+
+  Point2
+  operator()(  const Point_2<Cartesian<double> >& p) const
+  { return Point2( NumberType(p.x()), NumberType(p.y()) ); }
+
+  Segment
+  operator()(  const Segment_2<Cartesian<double> >& s) const
+  {
+    return Segment( Point2( NumberType(s.source().x()),
+                            NumberType(s.source().y()) ),
+                    Point2( NumberType(s.target().x()),
+                            NumberType(s.target().y()) ) );
+  }
+};
+
+#ifdef CGAL_USE_LEDA
+struct Cartesian_double_to_H_double_int
+{
+  typedef Point_2< Homogeneous< double> >    Point2;
+  typedef Segment_2< Homogeneous< double> >  Segment;
+
+  Segment
+  operator()(  const Segment_2< Cartesian< double> >& s) const
+  {
+    leda_rat_point rs =  leda_point(s.source().x(), s.source().y());
+    leda_rat_point rt =  leda_point(s.target().x(), s.target().y());
+
+    return Segment(
+      Point2(CGAL_LEDA_SCOPE::to_double(rs.X()),
+             CGAL_LEDA_SCOPE::to_double(rs.Y()),
+             CGAL_LEDA_SCOPE::to_double(rs.W())),
+      Point2(CGAL_LEDA_SCOPE::to_double(rt.X()),
+             CGAL_LEDA_SCOPE::to_double(rt.Y()),
+             CGAL_LEDA_SCOPE::to_double(rt.W())) );
+  }
+};
+
+struct Cartesian_float_to_H_double_int
+{
+  typedef Point_2< Homogeneous< double> >    Point2;
+  typedef Segment_2< Homogeneous< double> >  Segment;
+
+  Segment
+  operator()(  const Segment_2< Cartesian< float> >& s) const
+  {
+    leda_rat_point rs =  leda_point(s.source().x(), s.source().y());
+    leda_rat_point rt =  leda_point(s.target().x(), s.target().y());
+
+    return Segment(
+      Point2(CGAL_LEDA_SCOPE::to_double(rs.X()),
+             CGAL_LEDA_SCOPE::to_double(rs.Y()),
+             CGAL_LEDA_SCOPE::to_double(rs.W())),
+      Point2(CGAL_LEDA_SCOPE::to_double(rt.X()),
+             CGAL_LEDA_SCOPE::to_double(rt.Y()),
+             CGAL_LEDA_SCOPE::to_double(rt.W())) );
+  }
+};
+#endif // CGAL_USE_LEDA
+
+} //namespace CGAL
+
+#endif // CGAL_KERNEL_TO_KERNEL_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/known_bit_size_integers.h b/3rdparty/CGAL/include/CGAL/known_bit_size_integers.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/known_bit_size_integers.h
rename to 3rdparty/CGAL/include/CGAL/known_bit_size_integers.h
diff --git a/3rdparty/CGAL/include/CGAL/leda_bigfloat.h b/3rdparty/CGAL/include/CGAL/leda_bigfloat.h
new file mode 100644
index 0000000..67a322f
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/leda_bigfloat.h
@@ -0,0 +1,157 @@
+// Copyright (c) 1999,2007  
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved. 
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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(s)     : Stefan Schirra, Michael Hemmer
+
+#ifndef CGAL_LEDA_BIGFLOAT_H
+#define CGAL_LEDA_BIGFLOAT_H
+
+#include <CGAL/basic.h>
+
+#include <utility>
+#include <CGAL/leda_coercion_traits.h>
+#include <CGAL/Interval_nt.h>
+
+#include <CGAL/LEDA_basic.h>
+#include <LEDA/numbers/bigfloat.h>
+
+namespace CGAL {
+
+template <> class Algebraic_structure_traits< leda_bigfloat >
+  : public Algebraic_structure_traits_base< leda_bigfloat,
+                                            Field_with_kth_root_tag >  {
+  public:
+    typedef Tag_false           Is_exact;
+    typedef Tag_true            Is_numerical_sensitive;
+
+    class Sqrt
+      : public std::unary_function< Type, Type > {
+      public:
+        Type operator()( const Type& x ) const {
+          return CGAL_LEDA_SCOPE::sqrt( x );
+        }
+    };
+
+    class Kth_root
+      : public std::binary_function<int, Type, Type> {
+      public:
+        Type operator()( int k,
+                                        const Type& x) const {
+            CGAL_precondition_msg(k > 0, "'k' must be positive for k-th roots");
+            // heuristic: we ask for as many precision as the argument has
+            long d = x.get_significant_length();
+            if ( d < 53) // O.K. we want at least double precision
+                d = 53;
+            return CGAL_LEDA_SCOPE::sqrt_d( x, d, k);
+        }
+    };
+
+};
+
+template <> class Real_embeddable_traits< leda_bigfloat >
+  : public INTERN_RET::Real_embeddable_traits_base< leda_bigfloat , CGAL::Tag_true > {
+public:
+  
+    class Abs
+      : public std::unary_function< Type, Type > {
+      public:
+        Type operator()( const Type& x ) const {
+            return CGAL_LEDA_SCOPE::abs( x );
+        }
+    };
+
+    class Sgn
+      : public std::unary_function< Type, ::CGAL::Sign > {
+      public:
+        ::CGAL::Sign operator()( const Type& x ) const {
+          return (::CGAL::Sign) CGAL_LEDA_SCOPE::sign( x );
+        }
+    };
+
+    class Compare
+      : public std::binary_function< Type, Type,
+                                Comparison_result > {
+      public:
+        Comparison_result operator()( const Type& x,
+                                            const Type& y ) const {
+          return (Comparison_result) CGAL_LEDA_SCOPE::compare( x, y );
+        }
+        
+        CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT( Type, 
+                Comparison_result )
+    };
+
+    class To_double
+      : public std::unary_function< Type, double > {
+      public:
+        double operator()( const Type& x ) const {
+          return x.to_double();
+        }
+    };
+
+    class To_interval
+      : public std::unary_function< Type, std::pair< double, double > > {
+      public:
+        std::pair<double, double> operator()( const Type& x ) const {
+
+          // assuming leda_bigfloat guarantee 1 bit error max
+          Protect_FPU_rounding<true> P (CGAL_FE_TONEAREST);
+          Interval_nt_advanced approx (CGAL_LEDA_SCOPE::to_double(x));
+          FPU_set_cw(CGAL_FE_UPWARD);
+          approx += Interval_nt<false>::smallest();
+          return approx.pair();
+        }
+    };
+
+    class Is_finite
+      : public std::unary_function< Type, bool > {
+      public:
+        bool operator()( const Type& x )  const {
+          return !( CGAL_LEDA_SCOPE::isInf(x) || CGAL_LEDA_SCOPE::isNaN(x) );
+        }
+    };
+};
+
+template<>
+class Is_valid< leda_bigfloat >
+  : public std::unary_function< leda_bigfloat, bool > {
+  public :
+    bool operator()( const leda_bigfloat& x ) const {
+      return !( CGAL_LEDA_SCOPE::isNaN(x) );
+    }
+};
+
+
+} //namespace CGAL
+
+// Unary + is missing for leda::bigfloat
+namespace leda {
+    inline bigfloat operator+( const bigfloat& i) { return i; }
+} // namespace leda
+
+//since types are included by LEDA_coercion_traits.h:
+#include <CGAL/leda_integer.h>
+#include <CGAL/leda_rational.h>
+#include <CGAL/leda_real.h>
+#include <CGAL/LEDA_arithmetic_kernel.h>
+
+#endif // CGAL_LEDA_BIGFLOAT_H
diff --git a/3rdparty/CGAL/include/CGAL/leda_bigfloat_interval.h b/3rdparty/CGAL/include/CGAL/leda_bigfloat_interval.h
new file mode 100644
index 0000000..71dacbe
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/leda_bigfloat_interval.h
@@ -0,0 +1,488 @@
+// Copyright (c) 2008 Max-Planck-Institute Saarbruecken (Germany).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Michael Hemmer
+// TODO: add sign to RET
+
+
+#ifndef CGAL_LEDA_BIGFLOAT_INTERVAL_H
+#define CGAL_LEDA_BIGFLOAT_INTERVAL_H
+
+#include <CGAL/basic.h>
+
+#include <CGAL/LEDA_basic.h>
+#include <LEDA/numbers/bigfloat.h>
+
+#include <boost/numeric/interval.hpp>
+
+#include <CGAL/Interval_traits.h>
+#include <CGAL/Bigfloat_interval_traits.h>
+#include <CGAL/ipower.h>
+
+namespace CGAL {
+namespace internal {
+
+struct Rounding_for_leda_bigfloat {
+private:  typedef leda::bigfloat T;
+public:
+    Rounding_for_leda_bigfloat(){};
+    ~Rounding_for_leda_bigfloat(){};
+    
+    T conv_down(const T& a){
+        return round(a,leda::bigfloat::get_precision(),leda::TO_N_INF);
+    };
+    T conv_up  (const T& a){
+        return round(a,leda::bigfloat::get_precision(),leda::TO_P_INF);
+    };  
+    // mathematical operations
+    T add_down(const T& a, const T& b){
+        return add(a,b,leda::bigfloat::get_precision(),leda::TO_N_INF);
+    };
+    T add_up  (const T& a, const T& b){
+        return add(a,b,leda::bigfloat::get_precision(),leda::TO_P_INF);
+    };  
+    T sub_down(const T& a, const T& b){
+        return sub(a, b, leda::bigfloat::get_precision(),leda::TO_N_INF);
+    };
+    T sub_up  (const T& a, const T& b){
+        return sub(a, b, leda::bigfloat::get_precision(),leda::TO_P_INF);
+    }; 
+    T mul_down(const T& a, const T& b){
+        return mul(a, b, leda::bigfloat::get_precision(),leda::TO_N_INF);
+    };
+    T mul_up  (const T& a, const T& b){
+        return mul(a, b, leda::bigfloat::get_precision(),leda::TO_P_INF);
+    }; 
+    T div_down(const T& a, const T& b){
+        return div(a, b, leda::bigfloat::get_precision(),leda::TO_N_INF);
+    };
+    T div_up  (const T& a, const T& b){
+        return div(a, b, leda::bigfloat::get_precision(),leda::TO_P_INF);
+    };         
+    T sqrt_down(const T& a){
+        return sqrt(a, leda::bigfloat::get_precision(),leda::TO_N_INF);
+    };
+    T sqrt_up  (const T& a){
+        return sqrt(a, leda::bigfloat::get_precision(),leda::TO_P_INF);
+    }; 
+
+    T median(const T& a, const T& b){ return (a+b)/2;    };   
+    T int_down(const T& a)          { return T(floor(a));};   
+    T int_up  (const T& a)          { return T(ceil(a)); };
+};
+
+class Checking_for_leda_bigfloat {
+        
+    typedef leda::bigfloat T;
+
+public:
+        
+    static T pos_inf() {
+        T b = T(5) / T(0);
+        CGAL_assertion(leda::ispInf(b));
+        return b;
+    }
+
+    static T neg_inf() {
+        T b = T(-5) / T(0);
+        CGAL_assertion(leda::isnInf(b));
+        return b;
+    }
+        
+    static T nan() {
+        T b = T(0)*pos_inf();
+        CGAL_assertion(leda::isNaN(b));
+        return b;
+    }
+
+    static bool is_nan(const T& b) {
+        return leda::isNaN(b);
+    }
+
+    static T empty_lower() {
+        return T(1);
+    }
+
+    static T empty_upper() {
+        return T(0);
+    }
+
+    static bool is_empty(const T& a, const T& b) {
+      //return a==T(1) && b == T(0);
+      return a > b; 
+    }
+};
+
+} // namespace internal
+} //namespace CGAL
+
+namespace boost {
+namespace numeric {
+inline
+std::ostream& operator << 
+    (std::ostream& os, const boost::numeric::interval<leda::bigfloat>& x)
+{
+    os << "[" 
+       << x.lower().get_significant() << "*2^" << x.lower().get_exponent() 
+       << " , "
+       << x.upper().get_significant() << "*2^" << x.upper().get_exponent()
+       << "]";
+    return os;
+}
+
+
+}//namespace numeric
+}//namespace boost
+
+namespace CGAL {
+
+typedef boost::numeric::interval
+< leda::bigfloat,
+    boost::numeric::interval_lib::policies
+      < internal::Rounding_for_leda_bigfloat,
+        internal::Checking_for_leda_bigfloat > > 
+leda_bigfloat_interval;
+
+} //end of namespace CGAL
+
+#include <CGAL/leda_integer.h>
+#include <CGAL/leda_rational.h>
+#include <CGAL/leda_real.h>
+#include <CGAL/leda_bigfloat.h>
+
+namespace CGAL {
+
+template <> class Algebraic_structure_traits< leda_bigfloat_interval >
+    : public Algebraic_structure_traits_base< leda_bigfloat_interval,
+                                            Field_with_sqrt_tag >  {
+public:
+    typedef Tag_false           Is_exact;
+    typedef Tag_true            Is_numerical_sensitive;
+
+    class Sqrt
+        : public std::unary_function< Type, Type > {
+    public:
+        Type operator()( const Type& x ) const {
+            return ::boost::numeric::sqrt(x);
+        }
+    };
+};
+
+template <> class Real_embeddable_traits< leda_bigfloat_interval >
+    : public INTERN_RET::Real_embeddable_traits_base< leda_bigfloat_interval , CGAL::Tag_true > {
+public:
+  
+    class Abs
+        : public std::unary_function< Type, Type > {
+    public:
+        Type operator()( const Type& x ) const {
+            return ::boost::numeric::abs(x);
+        }
+    };
+
+    class To_double
+        : public std::unary_function< Type, double > {
+    public:
+        double operator()( const Type& x ) const {
+            return CGAL::to_double(::boost::numeric::median(x));
+        }
+    };
+
+    class To_interval
+        : public std::unary_function< Type, std::pair< double, double > > {
+    public:
+        std::pair<double, double> operator()( const Type& x ) const {            
+            std::pair<double, double> lower_I(CGAL::to_interval(x.lower()));
+            std::pair<double, double> upper_I(CGAL::to_interval(x.upper()));
+            return std::pair< double, double >(
+                    CGAL::min(lower_I.first , upper_I.first ),
+                    CGAL::max(lower_I.second, upper_I.second));
+        }
+    };
+};
+
+
+// Coercion traits:
+CGAL_DEFINE_COERCION_TRAITS_FROM_TO(short      ,leda_bigfloat_interval)
+CGAL_DEFINE_COERCION_TRAITS_FROM_TO(int        ,leda_bigfloat_interval)
+CGAL_DEFINE_COERCION_TRAITS_FROM_TO(long       ,leda_bigfloat_interval)
+CGAL_DEFINE_COERCION_TRAITS_FROM_TO(float      ,leda_bigfloat_interval)
+CGAL_DEFINE_COERCION_TRAITS_FROM_TO(double     ,leda_bigfloat_interval)
+CGAL_DEFINE_COERCION_TRAITS_FROM_TO(::leda::bigfloat   ,leda_bigfloat_interval)
+
+template <>
+struct Coercion_traits< leda_bigfloat_interval , ::leda::integer >{
+    typedef Tag_true  Are_explicit_interoperable;
+    typedef Tag_false Are_implicit_interoperable;
+    
+    typedef leda_bigfloat_interval Type;
+    
+    struct Cast{
+        typedef Type result_type;
+        Type operator()(const leda_bigfloat_interval& x)  const { return x;}
+        Type operator()(const ::leda::integer& x) const {
+            leda::bigfloat tmp(x);
+            leda_bigfloat_interval result(
+                    round(tmp,leda::bigfloat::get_precision(),leda::TO_N_INF),
+                    round(tmp,leda::bigfloat::get_precision(),leda::TO_P_INF));
+            CGAL_postcondition( result.lower() <= x );
+            CGAL_postcondition( result.upper() >= x );
+            return result; 
+        }
+    };
+};
+
+template <>
+struct Coercion_traits< leda_bigfloat_interval , ::leda::rational >{
+    typedef Tag_true  Are_explicit_interoperable;
+    typedef Tag_false Are_implicit_interoperable;
+    
+    typedef leda_bigfloat_interval Type;
+    
+    struct Cast{
+        typedef Type result_type;
+        Type operator()(const leda_bigfloat_interval& x)  const { return x;}
+        Type operator()(const ::leda::rational& x) const {
+            long prec = ::leda::bigfloat::get_precision();
+            leda_bigfloat_interval result (
+                    leda_bigfloat::from_rational(x,prec,leda::TO_N_INF),
+                    leda_bigfloat::from_rational(x,prec,leda::TO_P_INF));
+            CGAL_postcondition( result.lower() <= x );
+            CGAL_postcondition( result.upper() >= x );
+            return result; 
+        }
+    };
+};
+
+template <>
+struct Coercion_traits< leda_bigfloat_interval , ::leda::real >{
+    typedef Tag_true  Are_explicit_interoperable;
+    typedef Tag_false Are_implicit_interoperable;
+    
+    typedef leda_bigfloat_interval Type;
+    
+    struct Cast{
+        typedef Type result_type;
+        Type operator()(const leda_bigfloat_interval& x)  const { return x;}
+        Type operator()(const ::leda::real& x) const {
+            long current_prec = ::leda::bigfloat::get_precision();
+            x.guarantee_relative_error(current_prec);
+            leda_bigfloat_interval 
+                result(x.get_lower_bound(), x.get_upper_bound());
+            CGAL_postcondition( result.lower() <= x );
+            CGAL_postcondition( result.upper() >= x );
+            return result;
+        }
+    };
+};
+
+template <> struct Coercion_traits< ::leda::integer, leda_bigfloat_interval >
+    :public Coercion_traits< leda_bigfloat_interval , ::leda::integer >{}; 
+
+template <> struct Coercion_traits< ::leda::rational, leda_bigfloat_interval >
+    :public Coercion_traits< leda_bigfloat_interval , ::leda::rational >{}; 
+
+template <> struct Coercion_traits< ::leda::real, leda_bigfloat_interval >
+    :public Coercion_traits< leda_bigfloat_interval , ::leda::real>{};        
+        
+
+
+template<>
+class Interval_traits<leda_bigfloat_interval>
+  :public internal::Interval_traits_base<leda_bigfloat_interval>
+{
+public: 
+    typedef Interval_traits<leda_bigfloat_interval> Self; 
+    typedef leda_bigfloat_interval Interval; 
+    typedef leda::bigfloat Bound; 
+    typedef CGAL::Tag_true Is_interval; 
+    typedef CGAL::Tag_true With_empty_interval; 
+
+    struct Construct :public std::binary_function<Bound,Bound,Interval>{
+        Interval operator()( const Bound& l,const Bound& r) const {
+            CGAL_precondition( l < r ); 
+            return Interval(l,r);
+        }
+    };
+
+    struct Lower :public std::unary_function<Interval,Bound>{
+        Bound operator()( const Interval& a ) const {
+            return a.lower();
+        }
+    };
+
+    struct Upper :public std::unary_function<Interval,Bound>{
+        Bound operator()( const Interval& a ) const {
+            return a.upper();
+        }
+    };
+
+    struct Width :public std::unary_function<Interval,Bound>{
+        Bound operator()( const Interval& a ) const {
+            return ::boost::numeric::width(a);
+        }
+    };
+
+    struct Median :public std::unary_function<Interval,Bound>{
+        Bound operator()( const Interval& a ) const {
+            return ::boost::numeric::median(a);
+        }
+    };
+    
+    struct Norm :public std::unary_function<Interval,Bound>{
+        Bound operator()( const Interval& a ) const {
+            return ::boost::numeric::norm(a);
+        }
+    };
+
+    struct Empty :public std::unary_function<Interval,bool>{
+        bool operator()( const Interval& a ) const {
+            return ::boost::numeric::empty(a);
+        }
+    };
+
+    struct Singleton :public std::unary_function<Interval,bool>{
+        bool operator()( const Interval& a ) const {
+            return ::boost::numeric::singleton(a);
+        }
+    };
+
+    struct Zero_in :public std::unary_function<Interval,bool>{
+        bool operator()( const Interval& a ) const {
+            return ::boost::numeric::in_zero(a);
+        }
+    };
+
+    struct In :public std::binary_function<Bound,Interval,bool>{
+        bool operator()( Bound x, const Interval& a ) const {
+            return ::boost::numeric::in(x,a);
+        }
+    };
+
+    struct Equal :public std::binary_function<Interval,Interval,bool>{
+        bool operator()( const Interval& a, const Interval& b ) const {
+            return ::boost::numeric::equal(a,b);
+        }
+    };
+    
+    struct Overlap :public std::binary_function<Interval,Interval,bool>{
+        bool operator()( const Interval& a, const Interval& b ) const {
+            return ::boost::numeric::overlap(a,b);
+        }
+    };
+    
+    struct Subset :public std::binary_function<Interval,Interval,bool>{
+        bool operator()( const Interval& a, const Interval& b ) const {
+            return ::boost::numeric::subset(a,b);
+        }
+    };
+    
+    struct Proper_subset :public std::binary_function<Interval,Interval,bool>{
+        bool operator()( const Interval& a, const Interval& b ) const {
+            return ::boost::numeric::proper_subset(a,b);
+        }
+    };
+    
+    struct Hull :public std::binary_function<Interval,Interval,Interval>{
+        Interval operator()( const Interval& a, const Interval& b ) const {
+            return ::boost::numeric::hull(a,b);
+        }
+    };
+    
+    struct Intersection :public std::binary_function<Interval,Interval,Interval>{
+        Interval operator()( const Interval& a, const Interval& b ) const {
+            Interval r = ::boost::numeric::intersect(a,b);      
+            return r;
+        }
+    };
+};
+
+template<>
+class Bigfloat_interval_traits<leda_bigfloat_interval>
+    :public Interval_traits<leda_bigfloat_interval> 
+{
+  typedef leda_bigfloat_interval NT;
+  typedef leda::bigfloat BF; 
+public:
+  typedef Bigfloat_interval_traits<leda_bigfloat_interval> Self;
+  typedef CGAL::Tag_true Is_bigfloat_interval; 
+  
+
+//   struct Get_significant_bits : public std::unary_function<NT,long>{
+//         long operator()( NT x) const {
+//             CGAL_precondition(!Singleton()(x));
+//             leda::bigfloat lower = x.lower();
+//             leda::bigfloat upper = x.upper();
+//             leda::integer lower_m = lower.get_significant();
+//             leda::integer upper_m = upper.get_significant();
+//             leda::integer lower_exp = lower.get_exponent();
+//             leda::integer upper_exp = upper.get_exponent();
+//             long shift = (upper_exp - lower_exp).to_long();
+//             if(shift >= 0 ) upper_m = (upper_m <<  shift);
+//             else            lower_m = (lower_m << -shift);
+//             //CGAL_postcondition(lower_m.length() == upper_m.length());
+//             leda::integer err = upper_m - lower_m; 
+//             std::cout <<"LEDA: " << lower_m << " " << err << " " << std::endl; 
+//             return CGAL::abs(lower_m.length()-err.length());
+//         }
+//     };
+
+    
+  struct Relative_precision: public std::unary_function<NT,long>{
+    long operator()(const NT& x) const {
+      CGAL_precondition(!Singleton()(x));
+      CGAL_precondition(!CGAL::zero_in(x));
+
+      leda::bigfloat w = Width()(x);
+      w = leda::div(w,Lower()(x),Get_precision()(),leda::TO_P_INF); 
+      return -leda::ilog2(w).to_long();
+    }
+  };
+  
+  struct Set_precision : public std::unary_function<long,long> {
+    long operator()( long prec ) const {
+      return BF::set_precision(prec); 
+    }
+  };
+     
+    struct Get_precision {
+        // type for the \c AdaptableGenerator concept.
+        typedef long  result_type;  
+        long operator()() const {
+            return BF::get_precision(); 
+        }
+    };
+};
+
+
+::leda::bigfloat inline relative_error(const leda_bigfloat_interval& x){
+    if(in_zero(x)){
+        return CGAL::abs(x).upper();
+    }else{
+        return (width(x) / CGAL::abs(x)).upper();
+    }
+}
+
+leda_bigfloat_interval inline ipower(const leda_bigfloat_interval& x, int i ){
+    return ::boost::numeric::pow(x,i);
+}
+
+
+} //namespace CGAL
+
+#endif //  CGAL_LEDA_BIGFLOAT_INTERVAL_H
diff --git a/3rdparty/CGAL/include/CGAL/leda_coercion_traits.h b/3rdparty/CGAL/include/CGAL/leda_coercion_traits.h
new file mode 100644
index 0000000..ccf3581
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/leda_coercion_traits.h
@@ -0,0 +1,114 @@
+// Copyright (c) 2006-2008 Max-Planck-Institute Saarbruecken (Germany).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Michael Hemmer   <hemmer at mpi-inf.mpg.de>
+
+
+/*! \file NiX/LEDA/Coercion_traits.h
+ *  \brief Provides specializations of Coercion_traits for the LEDA number types.
+ */
+
+#ifndef CGAL_LEDA_COERCION_TRAITS_H
+#define CGAL_LEDA_COERCION_TRAITS_H
+
+#include <CGAL/number_type_basic.h>
+
+#ifdef CGAL_USE_LEDA
+
+#include <CGAL/LEDA_basic.h>
+#include <LEDA/numbers/integer.h>
+#include <LEDA/numbers/bigfloat.h>
+#include <LEDA/numbers/rational.h>
+#include <LEDA/numbers/real.h>
+
+namespace CGAL {
+
+
+//LEDA internal coercions:
+
+    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(::leda::integer,::leda::bigfloat)
+    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(::leda::integer,::leda::rational)
+    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(::leda::integer,::leda::real)
+
+// CGAL_DEFINE_COERCION_TRAITS_FROM_TO(::leda::bigfloat,::leda::rational); see below
+    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(::leda::bigfloat,::leda::real)
+
+    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(::leda::rational,::leda::real)
+
+// The following definitions reflect the interaction of the LEDA number types
+// with the built in types,
+// leda integer:
+    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(short    ,::leda::integer)
+    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(int      ,::leda::integer)
+    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(long     ,::leda::integer)
+
+// leda rational:
+    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(short      ,::leda::rational)
+    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(int        ,::leda::rational)
+    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(long       ,::leda::rational)
+
+    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(float      ,::leda::rational)
+    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(double     ,::leda::rational)
+    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(long double,::leda::rational)
+
+// leda bigfloat:      :
+    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(short      ,::leda::bigfloat)
+    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(int        ,::leda::bigfloat)
+    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(long       ,::leda::bigfloat)
+    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(float      ,::leda::bigfloat)
+    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(double     ,::leda::bigfloat)
+
+// leda real:
+    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(short      ,::leda::real)
+    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(int        ,::leda::real)
+    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(float      ,::leda::real)
+    CGAL_DEFINE_COERCION_TRAITS_FROM_TO(double     ,::leda::real)
+
+
+//not provided by LEDA
+//Note that this is not symmetric to CORE
+//CGAL_DEFINE_COERCION_TRAITS_FROM_TO(long long,::leda::integer);
+//CGAL_DEFINE_COERCION_TRAITS_FROM_TO(long long,::leda::rational);
+//CGAL_DEFINE_COERCION_TRAITS_FROM_TO(long long  ,::leda::bigfloat);
+//CGAL_DEFINE_COERCION_TRAITS_FROM_TO(long double,::leda::bigfloat);
+//CGAL_DEFINE_COERCION_TRAITS_FROM_TO(long       ,::leda::real);
+//CGAL_DEFINE_COERCION_TRAITS_FROM_TO(long long  ,::leda::real);
+//CGAL_DEFINE_COERCION_TRAITS_FROM_TO(long double,::leda::real);
+
+
+template <>
+struct Coercion_traits< ::leda::bigfloat ,::leda::rational  >{
+    typedef Tag_true  Are_explicit_interoperable;
+    typedef Tag_false Are_implicit_interoperable;
+    typedef ::leda::rational Type;
+    struct Cast{
+        typedef Type result_type;
+        Type operator()(const ::leda::rational& x)  const { return x;}
+        Type operator()(const ::leda::bigfloat& x) const {
+            return x.to_rational();
+        }
+    };
+};
+template <> struct Coercion_traits< ::leda::rational, ::leda::bigfloat >
+    :public Coercion_traits< ::leda::bigfloat , ::leda::rational >{};
+
+
+} //namespace CGAL
+#endif // CGAL_USE_LEDA
+#endif //CGAL_LEDA_COERCION_TRAITS_H
+//EOF
diff --git a/3rdparty/CGAL/include/CGAL/leda_integer.h b/3rdparty/CGAL/include/CGAL/leda_integer.h
new file mode 100644
index 0000000..22ed66a
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/leda_integer.h
@@ -0,0 +1,265 @@
+// Copyright (c) 1999,2007  
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved. 
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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(s)     : Andreas Fabri, Michael Hemmer
+
+#ifndef CGAL_LEDA_INTEGER_H
+#define CGAL_LEDA_INTEGER_H
+
+#include <CGAL/number_type_basic.h>
+
+#include <utility>
+
+#include <CGAL/leda_coercion_traits.h>
+#include <CGAL/Interval_nt.h>
+
+#include <CGAL/LEDA_basic.h>
+#include <LEDA/numbers/integer.h>
+#include <LEDA/numbers/bigfloat.h>// for To_interval
+
+#include <CGAL/Residue.h>
+#include <CGAL/Modular_traits.h>
+
+namespace CGAL {
+
+
+template <> class Algebraic_structure_traits< leda_integer >
+  : public Algebraic_structure_traits_base< leda_integer,
+                                            Euclidean_ring_tag >  {
+  public:
+    typedef Tag_true            Is_exact;
+    typedef Tag_false           Is_numerical_sensitive;
+
+    typedef INTERN_AST::Is_square_per_sqrt< Type >
+                                                                 Is_square;
+
+    class Gcd
+      : public std::binary_function< Type, Type,
+                                Type > {
+      public:
+        Type operator()( const Type& x,
+                                        const Type& y ) const {
+          // By definition gcd(0,0) == 0
+          if( x == Type(0) && y == Type(0) )
+            return Type(0);
+
+          return CGAL_LEDA_SCOPE::gcd( x, y );
+        }
+
+        CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( Type )
+    };
+
+    // Unfortunately the behaviour of leda has changed here several times
+    // The following Div_mod is invariant under these changes
+    // However, the Div and Mod defined below might be more efficient 
+    // TODO: recover Div Mod implementation for all leda versions
+    class Div_mod {
+    public: 
+        typedef Type first_argument_type;
+        typedef Type second_argument_type; 
+        typedef Type& third_argument_type; 
+        typedef Type& fourth_argument_type; 
+        typedef void result_type;
+        
+        void operator()(const Type& x, const Type& y, Type& q, Type& r) const {
+            
+            q = x / y;             
+            r = x - q*y;
+            CGAL_postcondition(x == y*q + r);  
+            
+            if (r == 0) return;   
+             
+            // round q towards zero 
+            if ( r.sign() != x.sign() ){
+                q -= x.sign();
+                r -= x.sign()*y;
+            }
+
+            CGAL_postcondition(x == y*q + r);            
+            CGAL_postcondition(r.sign() == x.sign());
+        }  
+    };
+    // Div defined via base using Div_mod
+    // Mod defined via base using Div_mod
+
+    // This code results in an inconsisten div/mod for some leda versions 
+    // TODO: reactivate this code 
+
+//     typedef INTERN_AST::Div_per_operator< Type > Div;
+//     class Mod
+//       : public std::binary_function< Type, Type,
+//                                 Type > {
+//       public:
+//         Type operator()( const Type& x, const Type& y ) const {
+//           Type m = x % y;
+//           return m;
+//         }
+//         CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( Type )
+//     };
+
+    class Sqrt
+      : public std::unary_function< Type, Type > {
+      public:
+        Type operator()( const Type& x ) const {
+          return CGAL_LEDA_SCOPE::sqrt( x );
+        }
+    };
+};
+
+template <> class Real_embeddable_traits< leda_integer >
+  : public INTERN_RET::Real_embeddable_traits_base< leda_integer , CGAL::Tag_true > {
+  public:
+  
+    class Abs
+      : public std::unary_function< Type, Type > {
+      public:
+        Type operator()( const Type& x ) const {
+            return CGAL_LEDA_SCOPE::abs( x );
+        }
+    };
+
+    class Sgn
+      : public std::unary_function< Type, ::CGAL::Sign > {
+      public:
+        ::CGAL::Sign operator()( const Type& x ) const {
+            return (::CGAL::Sign) CGAL_LEDA_SCOPE::sign( x );
+        }
+    };
+
+    class Compare
+      : public std::binary_function< Type, Type,
+                                Comparison_result > {
+      public:
+        Comparison_result operator()( const Type& x,
+                                            const Type& y ) const {
+          return (Comparison_result) CGAL_LEDA_SCOPE::compare( x, y );
+        }
+
+    };
+
+    class To_double
+      : public std::unary_function< Type, double > {
+      public:
+        double operator()( const Type& x ) const {
+          return x.to_double();
+        }
+    };
+
+    class To_interval
+      : public std::unary_function< Type, std::pair< double, double > > {
+      public:
+      std::pair<double, double> operator()( const Type& x ) const {
+        leda::bigfloat h(x);
+	double abs_err = 0;
+	double  low =h.to_double(abs_err, leda::TO_N_INF);
+	double high =h.to_double(abs_err, leda::TO_P_INF);
+	return std::make_pair(low,high);
+      }
+    };
+};
+
+template<>
+class Modular_traits< ::leda::integer > {
+    typedef Residue MOD;
+ public:
+    typedef ::leda::integer NT;
+    typedef ::CGAL::Tag_true Is_modularizable;
+    typedef MOD Residue_type;
+
+    struct Modular_image{
+        Residue_type operator()(const NT& a){
+            return Residue_type ((a%NT(MOD::get_current_prime())).to_long());
+        }
+    };
+    struct Modular_image_representative{
+        NT operator()(const Residue_type& x){
+            return NT(x.get_value());
+        }
+    };    
+};
+
+//
+// Needs_parens_as_product
+//
+template <>
+struct Needs_parens_as_product<leda_integer> {
+  bool operator()(const leda_integer& x) {
+    return CGAL_NTS is_negative(x);
+  }
+};
+
+// missing mixed operators
+inline
+bool
+operator==(int a, const leda_integer& b)
+{ return b == a; }
+
+inline
+bool
+operator!=(int a, const leda_integer& b)
+{ return b != a; }
+
+
+template <>
+struct Split_double<leda_integer>
+{
+  void operator()(double d, leda_integer &num, leda_integer &den) const
+  {
+    std::pair<double, double> p = split_numerator_denominator(d);
+    num = leda_integer(p.first);
+    den = leda_integer(p.second);
+  }
+};
+
+// Benchmark_rep specialization 
+template<>
+class Benchmark_rep< leda_integer > {
+    const leda_integer& t;
+public:
+    //! initialize with a const reference to \a t.
+    Benchmark_rep( const leda_integer& tt) : t(tt) {}
+    //! perform the output, calls \c operator\<\< by default.
+    std::ostream& operator()( std::ostream& out) const { 
+            out << t;
+            return out;
+    }
+    
+    static std::string get_benchmark_name() {
+        return "Integer";
+    }
+};
+
+
+} //namespace CGAL
+
+// Unary + is missing for leda::integer
+namespace leda {
+    inline integer operator+( const integer& i) { return i; }
+} // namespace leda
+
+//since types are included by LEDA_coercion_traits.h:
+#include <CGAL/leda_rational.h>
+#include <CGAL/leda_bigfloat.h>
+#include <CGAL/leda_real.h>
+#include <CGAL/LEDA_arithmetic_kernel.h>
+
+#endif // CGAL_LEDA_INTEGER_H
diff --git a/3rdparty/CGAL/include/CGAL/leda_rational.h b/3rdparty/CGAL/include/CGAL/leda_rational.h
new file mode 100644
index 0000000..13bfb7c
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/leda_rational.h
@@ -0,0 +1,282 @@
+// Copyright (c) 1999,2007  
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved. 
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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(s)     : Andreas Fabri, Michael Hemmer
+
+#ifndef CGAL_LEDA_RATIONAL_H
+#define CGAL_LEDA_RATIONAL_H
+
+#include <CGAL/IO/io.h>
+#include <CGAL/number_type_basic.h>
+
+#include <CGAL/leda_coercion_traits.h>
+#include <CGAL/Interval_nt.h>
+
+#include <CGAL/Needs_parens_as_product.h>
+
+#include <utility>
+#include <limits>
+
+#include <CGAL/LEDA_basic.h>
+#include <LEDA/numbers/rational.h>
+#if defined(  _MSC_VER )
+#  pragma push_macro("ERROR")
+#  undef ERROR
+#endif // _MSC_VER
+#include <LEDA/numbers/interval.h>
+#if defined(  _MSC_VER )
+#  pragma pop_macro("ERROR")
+#endif
+
+#include <CGAL/leda_integer.h> // for GCD in Fraction_traits
+
+namespace CGAL {
+
+template <> class Algebraic_structure_traits< leda_rational >
+  : public Algebraic_structure_traits_base< leda_rational,
+                                            Field_tag >  {
+  public:
+    typedef Tag_true            Is_exact;
+    typedef Tag_false           Is_numerical_sensitive;
+
+//    TODO: How to implement this without having sqrt?
+//    typedef INTERN_AST::Is_square_per_sqrt< Type >
+//                                                                 Is_square;
+
+    class Simplify
+      : public std::unary_function< Type&, void > {
+      public:
+        void operator()( Type& x) const {
+            x.normalize();
+        }
+    };
+
+};
+
+template <> class Real_embeddable_traits< leda_rational >
+  : public INTERN_RET::Real_embeddable_traits_base< leda_rational , CGAL::Tag_true > {
+  public:
+  
+    class Abs
+      : public std::unary_function< Type, Type > {
+      public:
+        Type operator()( const Type& x ) const {
+            return CGAL_LEDA_SCOPE::abs( x );
+        }
+    };
+
+    class Sgn
+      : public std::unary_function< Type, ::CGAL::Sign > {
+      public:
+        ::CGAL::Sign operator()( const Type& x ) const {
+            return (::CGAL::Sign) CGAL_LEDA_SCOPE::sign( x );
+        }
+    };
+
+    class Compare
+      : public std::binary_function< Type, Type,
+                                Comparison_result > {
+      public:
+        Comparison_result operator()( const Type& x,
+                                      const Type& y ) const {
+          return (Comparison_result) CGAL_LEDA_SCOPE::compare( x, y );
+        }
+        CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT(Type,Comparison_result)
+    };
+
+    class To_double
+      : public std::unary_function< Type, double > {
+      public:
+        double operator()( const Type& x ) const {
+          return x.to_double();
+        }
+    };
+
+    class To_interval
+      : public std::unary_function< Type, std::pair< double, double > > {
+      public:
+        std::pair<double, double> operator()( const Type& x ) const {
+
+          CGAL_LEDA_SCOPE::interval temp(x);
+          std::pair<double, double> result(temp.lower_bound(),temp.upper_bound());
+          CGAL_assertion_code( double infinity=std::numeric_limits<double>::infinity(); )
+          CGAL_postcondition(result.first  == -infinity || Type(result.first)<=x);
+          CGAL_postcondition(result.second ==  infinity || Type(result.second)>=x);
+          return result;
+          // Original CGAL to_interval (seemed to be inferior)
+          //  // There's no guarantee about the error of to_double(), so I add
+          //  //  3 ulps...
+          //  Protect_FPU_rounding<true> P (CGAL_FE_TONEAREST);
+          //  Interval_nt_advanced approx (z.to_double());
+          //  FPU_set_cw(CGAL_FE_UPWARD);
+          //
+          //  approx += Interval_nt<false>::smallest();
+          //  approx += Interval_nt<false>::smallest();
+          //  approx += Interval_nt<false>::smallest();
+          //  return approx.pair();
+
+        }
+    };
+};
+
+/*! \ingroup NiX_Fraction_traits_spec
+ *  \brief Specialization of Fraction_traits for ::leda::rational
+ */
+template <>
+class Fraction_traits< leda_rational > {
+public:
+    typedef leda_rational Type;
+    typedef ::CGAL::Tag_true Is_fraction;
+    typedef leda_integer Numerator_type;
+    typedef Numerator_type Denominator_type;
+
+    typedef Algebraic_structure_traits< Numerator_type >::Gcd Common_factor;
+
+    class Decompose {
+    public:
+        typedef Type first_argument_type;
+        typedef Numerator_type& second_argument_type;
+        typedef Numerator_type& third_argument_type;
+        void operator () (
+                const Type& rat,
+                Numerator_type& num,
+                Numerator_type& den) {
+            num = rat.numerator();
+            den = rat.denominator();
+        }
+    };
+
+    class Compose {
+    public:
+        typedef Numerator_type first_argument_type;
+        typedef Numerator_type second_argument_type;
+        typedef Type result_type;
+        Type operator ()(
+                const Numerator_type& num ,
+                const Numerator_type& den ) {
+            Type result(num, den);
+            result.normalize();
+            return result;
+        }
+    };
+};
+
+template <class F>
+class Output_rep< leda_rational, F> : public IO_rep_is_specialized {
+    const leda_rational& t;
+public:
+    //! initialize with a const reference to \a t.
+    Output_rep( const leda_rational& tt) : t(tt) {}
+    //! perform the output, calls \c operator\<\< by default.
+    std::ostream& operator()( std::ostream& out) const {
+        switch (get_mode(out)) {
+        case IO::PRETTY:{
+            if(t.denominator() == leda_integer(1))
+                return out <<t.numerator();
+            else
+                return out << t.numerator()
+                           << "/"
+                           << t.denominator();
+            break;
+        }
+
+        default:
+            return out << t.numerator()
+                       << "/"
+                       << t.denominator();
+        }
+    }
+};
+
+template <>
+struct Needs_parens_as_product< leda_rational >{
+    bool operator()( leda_rational t){
+        if (t.denominator() != 1 )
+            return true;
+        else
+            return needs_parens_as_product(t.numerator()) ;
+    }
+};
+
+template <>
+class Output_rep< leda_rational, Parens_as_product_tag >
+  : public IO_rep_is_specialized
+{
+    const leda_rational& t;
+public:
+    // Constructor
+    Output_rep( const leda_rational& tt) : t(tt) {}
+    // operator
+    std::ostream& operator()( std::ostream& out) const {
+        Needs_parens_as_product< leda_rational > needs_parens_as_product;
+        if (needs_parens_as_product(t))
+            return out <<"("<< oformat(t) <<")";
+        else
+            return out << oformat(t);
+    }
+};
+
+template < >
+class Benchmark_rep< leda_rational > {
+    const leda_rational& t;
+public:
+    //! initialize with a const reference to \a t.
+    Benchmark_rep( const leda_rational& tt) : t(tt) {}
+    //! perform the output, calls \c operator\<\< by default.
+    std::ostream& operator()( std::ostream& out) const { 
+            return 
+                out << "Rational(" << t.numerator() << "," 
+                    << t.denominator() << ")";
+    }
+
+    static std::string get_benchmark_name() {
+        return "Rational";
+    }
+
+};
+
+namespace internal {
+  // See: Stream_support/include/CGAL/IO/io.h
+  template <typename ET>
+  void read_float_or_quotient(std::istream & is, ET& et);
+
+  template <>
+  inline void read_float_or_quotient(std::istream & is, leda_rational& et)
+  {
+    internal::read_float_or_quotient<leda_integer,leda_rational>(is, et);
+  }
+} // namespace internal
+
+} //namespace CGAL
+
+// Unary + is missing for leda::rational
+namespace leda{
+inline rational operator+( const rational& i) { return i; }
+}
+
+//since types are included by LEDA_coercion_traits.h:
+#include <CGAL/leda_integer.h>
+#include <CGAL/leda_bigfloat.h>
+#include <CGAL/leda_real.h>
+#include <CGAL/LEDA_arithmetic_kernel.h>
+
+#endif  // CGAL_LEDA_RATIONAL_H
diff --git a/3rdparty/CGAL/include/CGAL/leda_real.h b/3rdparty/CGAL/include/CGAL/leda_real.h
new file mode 100644
index 0000000..3766b5f
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/leda_real.h
@@ -0,0 +1,231 @@
+// Copyright (c) 1999,2007  
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved. 
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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(s)     : Stefan Schirra, Michael Hemmer
+
+#ifndef CGAL_LEDA_REAL_H
+#define CGAL_LEDA_REAL_H
+
+#include <CGAL/number_type_basic.h>
+
+#include <CGAL/leda_coercion_traits.h>
+
+#include <CGAL/utils.h>
+#include <CGAL/Interval_nt.h>
+
+#include <utility>
+
+#include <CGAL/LEDA_basic.h>
+#include <LEDA/numbers/real.h>
+
+
+namespace CGAL {
+
+template <> class Algebraic_structure_traits< leda_real >
+
+  : public Algebraic_structure_traits_base< leda_real,
+                                            Field_with_root_of_tag >  {
+
+  public:
+    typedef Tag_true           Is_exact;
+    typedef Tag_true           Is_numerical_sensitive;
+
+    class Sqrt
+      : public std::unary_function< Type, Type > {
+      public:
+        Type operator()( const Type& x ) const {
+          return CGAL_LEDA_SCOPE::sqrt( x );
+        }
+    };
+
+    class Kth_root
+      : public std::binary_function<int, Type, Type> {
+      public:
+        Type operator()( int k,
+                                        const Type& x) const {
+            CGAL_precondition_msg(k > 0, "'k' must be positive for k-th roots");
+            return CGAL_LEDA_SCOPE::root( x, k);
+        }
+    };
+
+// Root_of is only available for LEDA versions >= 5.0
+    class Root_of {
+      public:
+        typedef Type result_type;
+
+//        typedef leda_rational Boundary;
+      private:
+        template< class ForwardIterator >
+        inline
+        CGAL_LEDA_SCOPE::polynomial<Type>
+        make_polynomial(ForwardIterator begin,
+                        ForwardIterator end) const {
+          CGAL_LEDA_SCOPE::growing_array<Type> coeffs;
+          for(ForwardIterator it = begin; it < end; it++)
+              coeffs.push_back(*it);
+          return CGAL_LEDA_SCOPE::polynomial<Type>(coeffs);
+        }
+      public:
+        template <class ForwardIterator>
+        Type operator()( int k,
+                       ForwardIterator begin,
+                       ForwardIterator end) const {
+            return CGAL_LEDA_SCOPE::diamond(k,make_polynomial(begin,end));
+        }
+/*        template <class ForwardIterator>
+        Type operator()( leda_rational lower,
+                                        leda_rational upper,
+                                        ForwardIterator begin,
+                                        ForwardIterator end) const {
+            return CGAL_LEDA_SCOPE::diamond(lower,upper,
+                                             make_polynomial(begin,end));
+        };*/
+    };
+
+
+
+};
+
+template <> class Real_embeddable_traits< leda_real >
+  : public INTERN_RET::Real_embeddable_traits_base< leda_real , CGAL::Tag_true > {
+  public:
+    class Abs
+      : public std::unary_function< Type, Type > {
+      public:
+        Type operator()( const Type& x ) const {
+            return CGAL_LEDA_SCOPE::abs( x );
+        }
+    };
+
+    class Sgn
+      : public std::unary_function< Type, ::CGAL::Sign > {
+      public:
+        ::CGAL::Sign operator()( const Type& x ) const {
+          return (::CGAL::Sign) CGAL_LEDA_SCOPE::sign( x );
+        }
+    };
+
+    class Compare
+      : public std::binary_function< Type, Type,
+                                Comparison_result > {
+      public:
+        Comparison_result operator()( const Type& x,
+                                            const Type& y ) const {
+          return (Comparison_result) CGAL_LEDA_SCOPE::compare( x, y );
+        }
+
+        CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT( Type,
+                                                      Comparison_result )
+
+    };
+
+    class To_double
+      : public std::unary_function< Type, double > {
+      public:
+        double operator()( const Type& x ) const {
+          // this call is required to get reasonable values for the double
+          // approximation (as of LEDA-4.3.1)
+          x.improve_approximation_to(53);
+          return x.to_double();
+        }
+    };
+
+    class To_interval
+      : public std::unary_function< Type, std::pair< double, double > > {
+      public:
+        std::pair<double, double> operator()( const Type& x ) const {
+
+            leda_bigfloat bnum = x.to_bigfloat();
+            leda_bigfloat berr = x.get_bigfloat_error();
+
+            double dummy;
+            double low = CGAL_LEDA_SCOPE::sub(bnum, berr, 53, CGAL_LEDA_SCOPE::TO_N_INF).to_double(dummy,
+                                                     CGAL_LEDA_SCOPE::TO_N_INF);
+            double upp = CGAL_LEDA_SCOPE::add(bnum, berr, 53, CGAL_LEDA_SCOPE::TO_P_INF).to_double(dummy,
+                                                     CGAL_LEDA_SCOPE::TO_P_INF);
+
+            std::pair<double, double> result(low, upp);
+            CGAL_postcondition(Type(result.first)<=x);
+            CGAL_postcondition(Type(result.second)>=x);
+            return result;
+              // Original CGAL to_interval:
+            //  Protect_FPU_rounding<true> P (CGAL_FE_TONEAREST);
+            //  double approx = z.to_double();
+            //  double rel_error = z.get_double_error();
+            //  FPU_set_cw(CGAL_FE_UPWARD);
+            //  Interval_nt_advanced ina(-rel_error,rel_error);
+            //  ina += 1;
+            //  ina *= approx;
+            //  return ina.pair();
+        }
+    };
+};
+
+
+template <>
+class Output_rep< ::leda::real > : public IO_rep_is_specialized {
+    const ::leda::real& t;
+public:
+    //! initialize with a const reference to \a t.
+    Output_rep( const ::leda::real& tt) : t(tt) {}
+    //! perform the output, calls \c operator\<\< by default.
+    std::ostream& operator()( std::ostream& out) const {
+        out << CGAL_NTS to_double(t);
+        return out;
+    }
+
+};
+
+template <>
+class Output_rep< ::leda::real, CGAL::Parens_as_product_tag >
+  : public IO_rep_is_specialized
+{
+    const ::leda::real& t;
+public:
+    //! initialize with a const reference to \a t.
+    Output_rep( const ::leda::real& tt) : t(tt) {}
+    //! perform the output, calls \c operator\<\< by default.
+    std::ostream& operator()( std::ostream& out) const {
+        if (t<0) out << "(" << ::CGAL::oformat(t)<<")";
+        else out << ::CGAL::oformat(t);
+        return out;
+    }
+};
+
+
+
+} //namespace CGAL
+
+// Unary + is missing for leda::real
+
+namespace leda {
+    inline real operator+( const real& i) { return i; }
+} // namespace leda
+
+
+//since types are included by LEDA_coercion_traits.h:
+#include <CGAL/leda_integer.h>
+#include <CGAL/leda_rational.h>
+#include <CGAL/leda_bigfloat.h>
+#include <CGAL/LEDA_arithmetic_kernel.h>
+
+#endif // CGAL_LEDA_REAL_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/linear_least_squares_fitting_2.h b/3rdparty/CGAL/include/CGAL/linear_least_squares_fitting_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/linear_least_squares_fitting_2.h
rename to 3rdparty/CGAL/include/CGAL/linear_least_squares_fitting_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/linear_least_squares_fitting_3.h b/3rdparty/CGAL/include/CGAL/linear_least_squares_fitting_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/linear_least_squares_fitting_3.h
rename to 3rdparty/CGAL/include/CGAL/linear_least_squares_fitting_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/linear_least_squares_fitting_circles_2.h b/3rdparty/CGAL/include/CGAL/linear_least_squares_fitting_circles_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/linear_least_squares_fitting_circles_2.h
rename to 3rdparty/CGAL/include/CGAL/linear_least_squares_fitting_circles_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/linear_least_squares_fitting_cuboids_3.h b/3rdparty/CGAL/include/CGAL/linear_least_squares_fitting_cuboids_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/linear_least_squares_fitting_cuboids_3.h
rename to 3rdparty/CGAL/include/CGAL/linear_least_squares_fitting_cuboids_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/linear_least_squares_fitting_points_2.h b/3rdparty/CGAL/include/CGAL/linear_least_squares_fitting_points_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/linear_least_squares_fitting_points_2.h
rename to 3rdparty/CGAL/include/CGAL/linear_least_squares_fitting_points_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/linear_least_squares_fitting_points_3.h b/3rdparty/CGAL/include/CGAL/linear_least_squares_fitting_points_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/linear_least_squares_fitting_points_3.h
rename to 3rdparty/CGAL/include/CGAL/linear_least_squares_fitting_points_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/linear_least_squares_fitting_rectangles_2.h b/3rdparty/CGAL/include/CGAL/linear_least_squares_fitting_rectangles_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/linear_least_squares_fitting_rectangles_2.h
rename to 3rdparty/CGAL/include/CGAL/linear_least_squares_fitting_rectangles_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/linear_least_squares_fitting_segments_2.h b/3rdparty/CGAL/include/CGAL/linear_least_squares_fitting_segments_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/linear_least_squares_fitting_segments_2.h
rename to 3rdparty/CGAL/include/CGAL/linear_least_squares_fitting_segments_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/linear_least_squares_fitting_segments_3.h b/3rdparty/CGAL/include/CGAL/linear_least_squares_fitting_segments_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/linear_least_squares_fitting_segments_3.h
rename to 3rdparty/CGAL/include/CGAL/linear_least_squares_fitting_segments_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/linear_least_squares_fitting_spheres_3.h b/3rdparty/CGAL/include/CGAL/linear_least_squares_fitting_spheres_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/linear_least_squares_fitting_spheres_3.h
rename to 3rdparty/CGAL/include/CGAL/linear_least_squares_fitting_spheres_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/linear_least_squares_fitting_tetrahedra_3.h b/3rdparty/CGAL/include/CGAL/linear_least_squares_fitting_tetrahedra_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/linear_least_squares_fitting_tetrahedra_3.h
rename to 3rdparty/CGAL/include/CGAL/linear_least_squares_fitting_tetrahedra_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/linear_least_squares_fitting_triangles_2.h b/3rdparty/CGAL/include/CGAL/linear_least_squares_fitting_triangles_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/linear_least_squares_fitting_triangles_2.h
rename to 3rdparty/CGAL/include/CGAL/linear_least_squares_fitting_triangles_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/linear_least_squares_fitting_triangles_3.h b/3rdparty/CGAL/include/CGAL/linear_least_squares_fitting_triangles_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/linear_least_squares_fitting_triangles_3.h
rename to 3rdparty/CGAL/include/CGAL/linear_least_squares_fitting_triangles_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/lloyd_optimize_mesh_2.h b/3rdparty/CGAL/include/CGAL/lloyd_optimize_mesh_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/lloyd_optimize_mesh_2.h
rename to 3rdparty/CGAL/include/CGAL/lloyd_optimize_mesh_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/lloyd_optimize_mesh_3.h b/3rdparty/CGAL/include/CGAL/lloyd_optimize_mesh_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/lloyd_optimize_mesh_3.h
rename to 3rdparty/CGAL/include/CGAL/lloyd_optimize_mesh_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/long_double.h b/3rdparty/CGAL/include/CGAL/long_double.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/long_double.h
rename to 3rdparty/CGAL/include/CGAL/long_double.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/long_long.h b/3rdparty/CGAL/include/CGAL/long_long.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/long_long.h
rename to 3rdparty/CGAL/include/CGAL/long_long.h
diff --git a/3rdparty/CGAL/include/CGAL/make_mesh_3.h b/3rdparty/CGAL/include/CGAL/make_mesh_3.h
new file mode 100644
index 0000000..1822508
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/make_mesh_3.h
@@ -0,0 +1,453 @@
+// Copyright (c) 2009 INRIA Sophia-Antipolis (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
+// 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(s)     : Stéphane Tayeb
+//
+//******************************************************************************
+// File Description : make_mesh_3 function definition.
+//******************************************************************************
+
+#ifndef CGAL_MAKE_MESH_3_H
+#define CGAL_MAKE_MESH_3_H
+
+#include <CGAL/Mesh_3/config.h>
+#include <CGAL/Mesh_3/global_parameters.h>
+#include <CGAL/refine_mesh_3.h>
+#include <CGAL/tags.h>
+#include <CGAL/Mesh_3/Protect_edges_sizing_field.h>
+#include <CGAL/Mesh_3/Has_features.h>
+
+#include <boost/mpl/has_xxx.hpp>
+
+namespace CGAL {
+  
+namespace parameters {
+  namespace internal {
+    // Features
+    struct Features_options
+    {
+      Features_options(bool b) : b_(b) {}
+      bool features() const { return b_; }
+    private:
+      bool b_;
+    };
+    
+    // -----------------------------------
+    // Features generator
+    // -----------------------------------
+    // struct Features_option_generator
+    template <typename HasFeatures>
+    struct Features_options_generator {};
+    
+    template<>
+    struct Features_options_generator<CGAL::Tag_true>
+    {
+      Features_options operator()() { return Features_options(true); }
+    };
+    
+    template<>
+    struct Features_options_generator<CGAL::Tag_false>
+    {
+      Features_options operator()() { return Features_options(false); }
+    };
+    
+    // struct Domain_features_generator is designed to handle cases where
+    // MeshDomain::Has_features is not a valid type
+    template< typename MeshDomain, bool MeshDomainHasHasFeatures >
+    struct Domain_features_generator {};
+    
+    template< typename MeshDomain >
+    struct Domain_features_generator< MeshDomain, false >
+    {
+      Features_options operator()()
+      { 
+        return Features_options_generator<CGAL::Tag_false>()();
+      }
+    };
+    
+    template< typename MeshDomain >
+    struct Domain_features_generator< MeshDomain, true >
+    {
+      Features_options operator()()
+      { 
+        return Features_options_generator<typename MeshDomain::Has_features>()();
+      }
+    };
+
+  } // end namespace internal
+
+  // -----------------------------------
+  // Features_options
+  // -----------------------------------
+  inline internal::Features_options
+  features() { return internal::Features_options(true); }
+
+  inline internal::Features_options
+  no_features() { return internal::Features_options(false); }
+  
+  template < typename MeshDomain >
+  inline internal::Features_options
+  features(const MeshDomain& /*domain*/)
+  {
+    typedef typename internal::Domain_features_generator<
+      MeshDomain,
+      CGAL::internal::Mesh_3::has_Has_features<MeshDomain>::value > Generator;
+    
+    return Generator()();
+  }
+  
+  // -----------------------------------
+  // Parameters
+  // -----------------------------------
+
+// see <CGAL/config.h>
+CGAL_PRAGMA_DIAG_PUSH
+// see <CGAL/Mesh_3/config.h>
+CGAL_MESH_3_IGNORE_BOOST_PARAMETER_NAME_WARNINGS
+
+  BOOST_PARAMETER_NAME( features_param )
+
+CGAL_PRAGMA_DIAG_POP
+  
+} // end namespace parameters::internal
+
+
+// -----------------------------------
+// Initialize c3t3 stuff
+// -----------------------------------
+namespace internal {
+namespace Mesh_3 {
+
+template < typename C3T3, typename MeshDomain, typename MeshCriteria >
+void
+init_c3t3(C3T3& c3t3, const MeshDomain& domain, const MeshCriteria&,
+          const int nb_initial_points)
+{
+  typedef typename MeshDomain::Point_3 Point_3;
+  typedef typename MeshDomain::Index Index;
+  typedef std::vector<std::pair<Point_3, Index> > Initial_points_vector;
+  typedef typename Initial_points_vector::iterator Ipv_iterator;
+  typedef typename C3T3::Vertex_handle Vertex_handle;
+  
+  // Mesh initialization : get some points and add them to the mesh
+  Initial_points_vector initial_points;
+  if (nb_initial_points > 0)
+    domain.construct_initial_points_object()(std::back_inserter(initial_points),
+                                             nb_initial_points);
+  else //use default number of points
+    domain.construct_initial_points_object()(std::back_inserter(initial_points));
+
+  // Insert points and set their index and dimension
+  for ( Ipv_iterator it = initial_points.begin() ;
+       it != initial_points.end() ;
+       ++it )
+  {
+    Vertex_handle v = c3t3.triangulation().insert(it->first);
+    
+    // v could be null if point is hidden
+    if ( v != Vertex_handle() )
+    {
+      c3t3.set_dimension(v,2); // by construction, points are on surface
+      c3t3.set_index(v,it->second);      
+    }
+  }
+}
+
+template < typename EdgeCriteria >
+struct Edge_criteria_sizing_field_wrapper
+{
+  typedef typename EdgeCriteria::Index    Index;
+  typedef typename EdgeCriteria::FT       FT;
+  typedef typename EdgeCriteria::Point_3  Point_3;
+  
+  Edge_criteria_sizing_field_wrapper(const EdgeCriteria& ec) : ec_(ec) {}
+  FT operator()(const Point_3& p, const int dim, const Index& index) const
+  { return ec_.sizing_field(p,dim,index); }
+
+private:
+  // No need to copy EdgeCriteria here
+  const EdgeCriteria& ec_;
+};
+
+template < typename C3T3, typename MeshDomain, typename MeshCriteria >
+void
+init_c3t3_with_features(C3T3& c3t3,
+                        const MeshDomain& domain,
+                        const MeshCriteria& criteria)
+{
+  typedef typename MeshCriteria::Edge_criteria Edge_criteria;
+  typedef Edge_criteria_sizing_field_wrapper<Edge_criteria> Sizing_field;
+
+  CGAL::Mesh_3::Protect_edges_sizing_field<C3T3,MeshDomain,Sizing_field>     
+    protect_edges(c3t3, domain, Sizing_field(criteria.edge_criteria_object()));
+  
+  protect_edges(true);
+}
+  
+
+// C3t3_initializer: initialize c3t3
+template < typename C3T3,
+           typename MeshDomain,
+           typename MeshCriteria,
+           bool MeshDomainHasHasFeatures,
+           typename HasFeatures = int>
+struct C3t3_initializer {};
+  
+// Partial specialization of C3t3_initializer
+// Handle cases where MeshDomain::Has_features is not a valid type
+template < typename C3T3, typename MD, typename MC, typename HasFeatures >
+struct C3t3_initializer < C3T3, MD, MC, false, HasFeatures >
+{
+  void operator()(C3T3& c3t3,
+                  const MD& domain,
+                  const MC& criteria,
+                  bool with_features,
+                  const int nb_initial_points = -1)
+  {
+    if ( with_features )
+    {
+      std::cerr << "Warning: you requested a mesh with features from a domain"
+                << " without features !" << std::endl;
+    }
+    
+    init_c3t3(c3t3,domain,criteria,nb_initial_points);
+  }
+};
+
+// Partial specialization of C3t3_initializer
+// Handles cases where MeshDomain::Has_features is a valid type
+template < typename C3T3, typename MD, typename MC, typename HasFeatures >
+struct C3t3_initializer < C3T3, MD, MC, true, HasFeatures >
+{
+  void operator()(C3T3& c3t3,
+                  const MD& domain,
+                  const MC& criteria,
+                  bool with_features,
+                  const int nb_initial_points = -1)
+  {
+    C3t3_initializer < C3T3, MD, MC, true, typename MD::Has_features >()
+      (c3t3,domain,criteria,with_features,nb_initial_points);
+  }  
+};
+
+// Partial specialization of C3t3_initializer
+// Handles cases where MeshDomain::Has_features is a valid type and is defined
+// to CGAL::Tag_true
+template < typename C3T3, typename MD, typename MC >
+struct C3t3_initializer < C3T3, MD, MC, true, CGAL::Tag_true >
+{
+  void operator()(C3T3& c3t3,
+                  const MD& domain,
+                  const MC& criteria,
+                  bool with_features,
+                  const int nb_initial_points = -1)
+  {
+    if ( with_features ) {
+      init_c3t3_with_features(c3t3,domain,criteria);
+
+      // If c3t3 initialization is not sufficient (may happen if there is only
+      // a planar curve as feature for example), add some surface points
+      if ( c3t3.triangulation().dimension() != 3 ) {
+        init_c3t3(c3t3, domain, criteria, nb_initial_points);
+      }
+    }
+    else { init_c3t3(c3t3,domain,criteria,nb_initial_points); }
+  }
+};
+  
+// Partial specialization of C3t3_initializer
+// Handles cases where MeshDomain::Has_features is a valid type and is defined
+// to CGAL::Tag_false
+template < typename C3T3, typename MD, typename MC >
+struct C3t3_initializer < C3T3, MD, MC, true, CGAL::Tag_false >
+{
+  void operator()(C3T3& c3t3,
+                  const MD& domain,
+                  const MC& criteria,
+                  bool with_features,
+                  const int nb_initial_points = -1)
+  {
+    if ( with_features )
+    {
+      std::cerr << "Warning: you requested a mesh with features from a domain"
+                << " without features !" << std::endl;
+    }
+    
+    init_c3t3(c3t3,domain,criteria,nb_initial_points);
+  }
+};
+
+}} // end namespace internal::Mesh_3
+  
+
+// -----------------------------------
+// make_mesh_3 stuff
+// -----------------------------------
+
+// Manual redirections
+// boost::parameter can't handle make_mesh_3 return_type alone...
+#ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
+
+template <typename C3T3, typename MD, typename MC, typename ... T>
+C3T3 make_mesh_3(const MD& md, const MC& mc, const T& ...t)
+{
+  C3T3 c3t3;
+  make_mesh_3_bp(c3t3,md,mc,t...);
+  return c3t3;  
+}
+
+#else
+
+template <typename C3T3, typename MD, typename MC>
+C3T3 make_mesh_3(const MD& md, const MC& mc)
+{ 
+  C3T3 c3t3;
+  make_mesh_3_bp(c3t3,md,mc);
+  return c3t3;
+}
+  
+template <typename C3T3, typename MD, typename MC,
+  typename Arg1>
+C3T3 make_mesh_3(const MD& md, const MC& mc, const Arg1& a1)
+{ 
+  C3T3 c3t3;
+  make_mesh_3_bp(c3t3,md,mc,a1);
+  return c3t3;
+}
+
+template <typename C3T3, typename MD, typename MC,
+  typename Arg1, typename Arg2>
+C3T3 make_mesh_3(const MD& md, const MC& mc, const Arg1& a1, const Arg2& a2)
+{
+  C3T3 c3t3; 
+  make_mesh_3_bp(c3t3,md,mc,a1,a2);
+  return c3t3;
+}
+
+template <typename C3T3, typename MD, typename MC,
+  typename Arg1, typename Arg2, typename Arg3>
+C3T3 make_mesh_3(const MD& md, const MC& mc, const Arg1& a1, const Arg2& a2,
+                 const Arg3& a3)
+{ 
+  C3T3 c3t3;
+  make_mesh_3_bp(c3t3,md,mc,a1,a2,a3);
+  return c3t3;
+}
+
+template <typename C3T3, typename MD, typename MC,
+  typename Arg1, typename Arg2, typename Arg3, typename Arg4>
+C3T3 make_mesh_3(const MD& md, const MC& mc, const Arg1& a1, const Arg2& a2,
+                 const Arg3& a3, const Arg4& a4)
+{ 
+  C3T3 c3t3;
+  make_mesh_3_bp(c3t3,md,mc,a1,a2,a3,a4);
+  return c3t3;
+}
+
+template <typename C3T3, typename MD, typename MC,
+  typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5>
+C3T3 make_mesh_3(const MD& md, const MC& mc, const Arg1& a1, const Arg2& a2,
+                 const Arg3& a3, const Arg4& a4, const Arg5& a5)
+{ 
+  C3T3 c3t3;
+  make_mesh_3_bp(c3t3,md,mc,a1,a2,a3,a4,a5);
+  return c3t3;
+}
+
+#endif  
+  
+// see <CGAL/config.h>
+CGAL_PRAGMA_DIAG_PUSH
+// see <CGAL/Mesh_3/config.h>
+CGAL_MESH_3_IGNORE_BOOST_PARAMETER_NAME_WARNINGS
+
+BOOST_PARAMETER_FUNCTION(
+  (void),
+  make_mesh_3_bp,
+  parameters::tag,
+  (required (in_out(c3t3),*) (domain,*) (criteria,*) ) // nondeduced
+  (deduced 
+    (optional
+      (features_param, (parameters::internal::Features_options), parameters::features(domain))
+      (exude_param, (parameters::internal::Exude_options), parameters::exude())
+      (perturb_param, (parameters::internal::Perturb_options), parameters::perturb())
+      (odt_param, (parameters::internal::Odt_options), parameters::no_odt())
+      (lloyd_param, (parameters::internal::Lloyd_options), parameters::no_lloyd())
+      (mesh_options_param, (parameters::internal::Mesh_3_options), 
+                           parameters::internal::Mesh_3_options())
+    )
+  )
+)
+{
+  make_mesh_3_impl(c3t3, domain, criteria,
+                   exude_param, perturb_param, odt_param, lloyd_param,
+                   features_param.features(), mesh_options_param);
+}
+CGAL_PRAGMA_DIAG_POP
+
+/**
+ * @brief This function meshes the domain defined by mesh_traits
+ * (respecting criteria), and outputs the mesh to c3t3
+ *
+ * @param domain the domain to be discretized
+ * @param criteria the criteria
+ * @param exude if it is set to \c true, an exudation step will be done at
+ *   the end of the Delaunay refinement process
+ *
+ * @return The mesh as a C3T3 object
+ */
+template<class C3T3, class MeshDomain, class MeshCriteria>
+void make_mesh_3_impl(C3T3& c3t3,
+                      const MeshDomain&   domain,
+                      const MeshCriteria& criteria,
+                      const parameters::internal::Exude_options& exude,
+                      const parameters::internal::Perturb_options& perturb,
+                      const parameters::internal::Odt_options& odt,
+                      const parameters::internal::Lloyd_options& lloyd,
+                      const bool with_features,
+                      const parameters::internal::Mesh_3_options& 
+                        mesh_options = parameters::internal::Mesh_3_options())
+{
+#ifdef CGAL_MESH_3_INITIAL_POINTS_NO_RANDOM_SHOOTING
+  CGAL::get_default_random() = CGAL::Random(0);
+#endif
+
+  // Initialize c3t3
+  internal::Mesh_3::C3t3_initializer< 
+    C3T3,
+    MeshDomain,
+    MeshCriteria,
+    internal::Mesh_3::has_Has_features<MeshDomain>::value > () (c3t3,
+            domain,
+            criteria,
+            with_features,
+            mesh_options.number_of_initial_points);
+
+  CGAL_assertion( c3t3.triangulation().dimension() == 3 );
+
+  // Build mesher and launch refinement process
+  // Don't reset c3t3 as we just created it
+  refine_mesh_3(c3t3, domain, criteria,
+                exude, perturb, odt, lloyd, parameters::no_reset_c3t3(), mesh_options);
+}
+
+
+}  // end namespace CGAL
+
+
+#endif // CGAL_MAKE_MESH_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/make_piecewise_smooth_surface_mesh.h b/3rdparty/CGAL/include/CGAL/make_piecewise_smooth_surface_mesh.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/make_piecewise_smooth_surface_mesh.h
rename to 3rdparty/CGAL/include/CGAL/make_piecewise_smooth_surface_mesh.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/make_skin_surface_mesh_3.h b/3rdparty/CGAL/include/CGAL/make_skin_surface_mesh_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/make_skin_surface_mesh_3.h
rename to 3rdparty/CGAL/include/CGAL/make_skin_surface_mesh_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/make_surface_mesh.h b/3rdparty/CGAL/include/CGAL/make_surface_mesh.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/make_surface_mesh.h
rename to 3rdparty/CGAL/include/CGAL/make_surface_mesh.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/make_union_of_balls_3.h b/3rdparty/CGAL/include/CGAL/make_union_of_balls_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/make_union_of_balls_3.h
rename to 3rdparty/CGAL/include/CGAL/make_union_of_balls_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/marching_tetrahedra_3.h b/3rdparty/CGAL/include/CGAL/marching_tetrahedra_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/marching_tetrahedra_3.h
rename to 3rdparty/CGAL/include/CGAL/marching_tetrahedra_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/memory.h b/3rdparty/CGAL/include/CGAL/memory.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/memory.h
rename to 3rdparty/CGAL/include/CGAL/memory.h
diff --git a/3rdparty/CGAL/include/CGAL/mesh_segmentation.h b/3rdparty/CGAL/include/CGAL/mesh_segmentation.h
new file mode 100644
index 0000000..987bdcf
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/mesh_segmentation.h
@@ -0,0 +1,491 @@
+#ifndef CGAL_SURFACE_MESH_SEGMENTATION_MESH_SEGMENTATION_H
+// Copyright (c) 2014  GeometryFactory Sarl (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
+// 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.
+
+
+#define CGAL_SURFACE_MESH_SEGMENTATION_MESH_SEGMENTATION_H
+
+/**
+ * @file mesh_segmentation.h
+ * @brief The API which contains free template functions for SDF computation and mesh segmentation.
+ */
+#include <CGAL/internal/Surface_mesh_segmentation/Surface_mesh_segmentation.h>
+#include <boost/config.hpp>
+
+namespace CGAL
+{
+
+
+/// @cond SKIP_IN_MANUAL
+template <bool Fast_sdf_calculation_mode, class TriangleMesh,
+         class SDFPropertyMap,
+         class PointPropertyMap
+#ifdef DOXYGEN_RUNNING
+         = typename boost::property_map<TriangleMesh, boost::vertex_point_t>::type
+#endif
+         , class GeomTraits
+#ifdef DOXYGEN_RUNNING
+         = typename Kernel_traits<typename boost::property_traits<PointPropertyMap>::value_type>::Kernel
+#endif
+         >
+std::pair<double, double>
+sdf_values( const TriangleMesh& triangle_mesh,
+            SDFPropertyMap sdf_values_map,
+            double cone_angle = 2.0 / 3.0 * CGAL_PI,
+            std::size_t number_of_rays = 25,
+            bool postprocess = true,
+            PointPropertyMap ppmap = PointPropertyMap(),
+            GeomTraits traits = GeomTraits())
+{
+  typedef PointPropertyMap VPMap;
+  internal::Surface_mesh_segmentation<TriangleMesh, GeomTraits, VPMap, Fast_sdf_calculation_mode>
+    algorithm(triangle_mesh, traits, ppmap);
+  return algorithm.calculate_sdf_values(cone_angle, number_of_rays,
+                                        sdf_values_map, postprocess);
+}
+/// @endcond
+
+/*!
+ * \ingroup PkgSurfaceSegmentation
+ * @brief Function computing the Shape Diameter Function over a surface mesh.
+ *
+ * This function implements the Shape Diameter Function (SDF) as described in \cgalCite{shapira2008consistent}.
+ * It is possible to compute raw SDF values (without post-processing). In such a case,
+ * -1 is used to indicate when no SDF value could be computed for a facet.
+ *
+ * @pre @a triangle_mesh.is_pure_triangle()
+ *
+ * @tparam TriangleMesh a model of `FaceListGraph`
+ * @tparam SDFPropertyMap  a `ReadWritePropertyMap` with `boost::graph_traits<TriangleMesh>::%face_descriptor` as key and `double` as value type
+ * @tparam GeomTraits a model of `SegmentationGeomTraits`
+ * @tparam PointPropertyMap a `ReadablePropertyMap` with `boost::graph_traits<TriangleMesh>::%vertex_descriptor` as key and `GeomTraits::Point_3` as value type.
+ *
+ * @param triangle_mesh surface mesh on which SDF values are computed
+ * @param[out] sdf_values_map the SDF value of each facet
+ * @param cone_angle opening angle in radians for the cone of each facet
+ * @param number_of_rays number of rays picked in the cone of each facet. In our experiments, we observe that increasing the number of rays beyond the default has little effect on the quality of the segmentation result
+ * @param postprocess if `true`, `CGAL::sdf_values_postprocessing()` is called on raw SDF value computed.
+ * @param traits traits class
+ * @param ppmap point property map. An overload is provided with `get(boost::vertex_point,triangle_mesh)` as default.
+ *
+ * @return minimum and maximum raw SDF values if @a postprocess is `true`, otherwise minimum and maximum SDF values (before linear normalization)
+ */
+template <class TriangleMesh, class SDFPropertyMap, class PointPropertyMap
+#ifdef DOXYGEN_RUNNING
+         = typename boost::property_map<TriangleMesh, boost::vertex_point_t>::type
+#endif
+, class GeomTraits
+#ifdef DOXYGEN_RUNNING
+=  typename Kernel_traits<typename boost::property_traits<PointPropertyMap>::value_type>::Kernel
+#endif
+>
+std::pair<double, double>
+sdf_values( const TriangleMesh& triangle_mesh,
+            SDFPropertyMap sdf_values_map,
+            double cone_angle = 2.0 / 3.0 * CGAL_PI,
+            std::size_t number_of_rays = 25,
+            bool postprocess = true,
+            PointPropertyMap ppmap = PointPropertyMap(),
+            GeomTraits traits = GeomTraits())
+{
+  return sdf_values<true, TriangleMesh, SDFPropertyMap, PointPropertyMap, GeomTraits>
+         (triangle_mesh, sdf_values_map, cone_angle, number_of_rays, postprocess, ppmap, traits);
+}
+
+
+/*!
+ * \ingroup PkgSurfaceSegmentation
+ * @brief Function post-processing raw SDF values computed per facet.
+ *
+ * Post-processing steps applied :
+ *   - Facets with -1 SDF values are assigned the average SDF value of their edge-adjacent neighbors.
+ *     If there is still a facet having -1 SDF value, the minimum valid SDF value assigned to it. Note that this step is not inherited from the paper.
+ *     The main reason for not assigning 0 to facets with no SDF values (i.e. -1) is that it can obstruct log-normalization process which takes place at the beginning of `CGAL::segmentation_from_sdf_values()`.
+ *   - SDF values are smoothed with bilateral filtering.
+ *   - SDF values are linearly normalized between [0,1].
+ *
+ * See the section \ref Surface_mesh_segmentationPostprocessing for more details.
+ *
+ * @pre @a triangle_mesh.is_pure_triangle()
+ * @pre Raw values should be greater or equal to 0. -1 indicates when no value could be computed
+ *
+ * @tparam TriangleMesh a model of `FaceListGraph`
+ * @tparam SDFPropertyMap  a `ReadWritePropertyMap` with `boost::graph_traits<TriangleMesh>::%face_descriptor` as key and `double` as value type
+ *
+ * @param triangle_mesh surface mesh on which SDF values are computed
+ * @param[in, out] sdf_values_map the SDF value of each facet
+ *
+ * @return minimum and maximum SDF values before linear normalization
+ */
+template<class TriangleMesh, class SDFPropertyMap>
+std::pair<double, double>
+sdf_values_postprocessing(const TriangleMesh& triangle_mesh,
+                          SDFPropertyMap sdf_values_map)
+{
+  CGAL_precondition(triangle_mesh.is_pure_triangle());
+  return internal::Postprocess_sdf_values<TriangleMesh>().postprocess(triangle_mesh,
+         sdf_values_map);
+}
+
+
+/*!
+ * \ingroup PkgSurfaceSegmentation
+ * @brief Function computing the segmentation of a surface mesh given an SDF value per facet.
+ *
+ * This function fills a property map which associates a segment-id (in [0, number of segments -1])
+ * or a cluster-id (in [0, `number_of_clusters` -1]) to each facet.
+ * A segment is a set of connected facets which are placed under the same cluster (see \cgalFigureRef{Cluster_vs_segment}).
+ *
+ * \note Log-normalization is applied on `sdf_values_map` before segmentation.
+ *       As described in the original paper \cgalCite{shapira2008consistent},
+ *       this normalization is done to preserve thin parts of the mesh
+ *       by increasing the distance between smaller SDF values and reducing
+ *       it between larger ones.
+ * \note There is no direct relation between the parameter `number_of_clusters`
+ * and the final number of segments after segmentation. However, setting a large number of clusters will result in a detailed segmentation of the mesh with a large number of segments.
+ *
+ * @pre @a triangle_mesh.is_pure_triangle()
+ * @pre @a number_of_clusters > 0
+ *
+ * @tparam TriangleMesh a model of `FaceListGraph`
+ * @tparam SDFPropertyMap  a `ReadablePropertyMap` with `boost::graph_traits<TriangleMesh>::%face_descriptor` as key and `double` as value type
+ * @tparam SegmentPropertyMap a `ReadWritePropertyMap` with `boost::graph_traits<TriangleMesh>::%face_descriptor` as key and `std::size_t` as value type
+ * @tparam GeomTraits a model of `SegmentationGeomTraits`
+ * @tparam PointPropertyMap a `ReadablePropertyMap` with `boost::graph_traits<TriangleMesh>::%vertex_descriptor` as key and `GeomTraits::Point_3` as value type.
+ *
+ * @param triangle_mesh surface mesh corresponding to the SDF values
+ * @param sdf_values_map the SDF value of each facet between [0-1]
+ * @param[out] segment_ids the segment or cluster id of each facet
+ * @param number_of_clusters number of clusters for the soft clustering
+ * @param smoothing_lambda factor which indicates the importance of the surface features for the energy minimization. It is recommended to choose a value in the interval [0,1]. See the section \ref Surface_mesh_segmentationGraphCut for more details.
+ * @param output_cluster_ids if `false` fill `segment_ids` with segment-ids, and with cluster-ids otherwise (see \cgalFigureRef{Cluster_vs_segment})
+ * @param traits traits class
+ * @param ppmap point property map. An overload is provided with `get(boost::vertex_point,triangle_mesh)` as default.
+ *
+ * @return number of segments if `output_cluster_ids` is set to `false` and `number_of_clusters` otherwise
+ */
+template <class TriangleMesh, class SDFPropertyMap, class SegmentPropertyMap,
+          class PointPropertyMap
+#ifdef DOXYGEN_RUNNING
+         = typename boost::property_map<TriangleMesh, boost::vertex_point_t>::type
+#endif
+         , class GeomTraits
+#ifdef DOXYGEN_RUNNING
+         = typename Kernel_traits<typename boost::property_traits<PointPropertyMap>::value_type>::Kernel
+#endif
+         >
+std::size_t
+segmentation_from_sdf_values( const TriangleMesh& triangle_mesh,
+                              SDFPropertyMap sdf_values_map,
+                              SegmentPropertyMap segment_ids,
+                              std::size_t number_of_clusters = 5,
+                              double smoothing_lambda = 0.26,
+                              bool output_cluster_ids = false,
+                              PointPropertyMap ppmap=PointPropertyMap(),
+                              GeomTraits traits=GeomTraits())
+{
+  typedef typename boost::property_map<TriangleMesh, boost::vertex_point_t>::type VPMap;
+  internal::Surface_mesh_segmentation<TriangleMesh, GeomTraits, VPMap> algorithm(triangle_mesh, traits, ppmap);
+  return algorithm.partition(number_of_clusters, smoothing_lambda, sdf_values_map,
+                             segment_ids, !output_cluster_ids);
+}
+
+///\cond SKIP_IN_MANUAL
+template < bool Fast_sdf_calculation_mode, class TriangleMesh,
+         class SegmentPropertyMap, class PointPropertyMap
+#ifdef DOXYGEN_RUNNING
+         = typename boost::property_map<TriangleMesh, boost::vertex_point_t>::type
+#endif
+        , class GeomTraits
+#ifdef DOXYGEN_RUNNING
+         = typename Kernel_traits<typename boost::property_traits<PointPropertyMap>::value_type>::Kernel
+#endif
+        >
+std::size_t
+segmentation_via_sdf_values(const TriangleMesh& triangle_mesh,
+                            SegmentPropertyMap segment_ids,
+                            double cone_angle = 2.0 / 3.0 * CGAL_PI,
+                            std::size_t number_of_rays = 25,
+                            std::size_t number_of_clusters = 5,
+                            double smoothing_lambda = 0.26,
+                            bool output_cluster_ids = false,
+                            PointPropertyMap ppmap=PointPropertyMap(),
+                            GeomTraits traits=GeomTraits() )
+{
+  typedef typename boost::graph_traits<TriangleMesh>::face_descriptor face_descriptor;
+  typedef std::map<face_descriptor, double>
+  Facet_double_map;
+  Facet_double_map internal_sdf_map;
+  boost::associative_property_map<Facet_double_map> sdf_property_map(
+    internal_sdf_map);
+
+  sdf_values<Fast_sdf_calculation_mode, TriangleMesh, boost::associative_property_map<Facet_double_map>, PointPropertyMap, GeomTraits>
+  (triangle_mesh, sdf_property_map, cone_angle, number_of_rays, true, ppmap, traits);
+  return segmentation_from_sdf_values<TriangleMesh, boost::associative_property_map<Facet_double_map>, SegmentPropertyMap, PointPropertyMap, GeomTraits>
+         (triangle_mesh, sdf_property_map, segment_ids, number_of_clusters,
+          smoothing_lambda, output_cluster_ids, ppmap, traits);
+}
+/// \endcond
+
+
+/*!
+ * \ingroup PkgSurfaceSegmentation
+ * @brief Function computing the segmentation of a surface mesh.
+ *
+ * This function is equivalent to calling the functions `CGAL::sdf_values()` and
+ * `CGAL::segmentation_from_sdf_values()` with the same parameters.
+ *
+ * \note There is no direct relation between the parameter `number_of_clusters`
+ * and the final number of segments after segmentation. However, setting a large number of clusters will result in a detailed segmentation of the mesh with a large number of segments.
+ * \note For computing segmentations of the mesh with different parameters (i.e. number of levels, and smoothing lambda),
+ * it is more efficient to first compute the SDF values using `CGAL::sdf_values()` and use them in different calls to
+ * `CGAL::segmentation_from_sdf_values()`.
+ *
+ * @pre @a triangle_mesh.is_pure_triangle()
+ * @pre @a number_of_clusters > 0
+ *
+ * @tparam TriangleMesh a model of `FaceListGraph`
+ * @tparam SegmentPropertyMap a `ReadWritePropertyMap` with `boost::graph_traits<TriangleMesh>::%face_descriptor` as key and `std::size_t` as value type
+ * @tparam GeomTraits a model of `SegmentationGeomTraits`
+ * @tparam PointPropertyMap a `ReadablePropertyMap` with `boost::graph_traits<TriangleMesh>::%vertex_descriptor` as key and `GeomTraits::Point_3` as value type.
+ *
+ * @param triangle_mesh surface mesh on which SDF values are computed
+ * @param[out] segment_ids the segment or cluster id of each facet
+ * @param cone_angle opening angle in radians for the cone of each facet
+ * @param number_of_rays number of rays picked in the cone of each facet. In our experiments, we observe that increasing the number of rays beyond the default has a little effect on the quality of the segmentation result
+ * @param number_of_clusters number of clusters for the soft clustering
+ * @param smoothing_lambda factor which indicates the importance of the surface features for the energy minimization. It is recommended to choose a value in the interval [0,1]. See the section \ref Surface_mesh_segmentationGraphCut for more details.
+ * @param output_cluster_ids if `false` fill `segment_ids` with segment-ids, and with cluster-ids otherwise (see \cgalFigureRef{Cluster_vs_segment})
+ * @param traits traits class
+ * @param ppmap point property map. An overload is provided with `get(boost::vertex_point,triangle_mesh)` as default.
+ *
+ * @return number of segments if `output_cluster_ids` is set to `false` and `number_of_clusters` otherwise
+ */
+template < class TriangleMesh, class SegmentPropertyMap, class PointPropertyMap
+#ifdef DOXYGEN_RUNNING
+         = typename boost::property_map<TriangleMesh, boost::vertex_point_t>::type
+#endif
+, class GeomTraits
+#ifdef DOXYGEN_RUNNING
+= typename Kernel_traits<typename boost::property_traits<PointPropertyMap>::value_type>::Kernel
+#endif
+>
+std::size_t
+segmentation_via_sdf_values(const TriangleMesh& triangle_mesh,
+                            SegmentPropertyMap segment_ids,
+                            double cone_angle = 2.0 / 3.0 * CGAL_PI,
+                            std::size_t number_of_rays = 25,
+                            std::size_t number_of_clusters = 5,
+                            double smoothing_lambda = 0.26,
+                            bool output_cluster_ids = false,
+                            PointPropertyMap ppmap=PointPropertyMap(),
+                            GeomTraits traits=GeomTraits())
+{
+  return segmentation_via_sdf_values<true, TriangleMesh, SegmentPropertyMap, PointPropertyMap, GeomTraits>
+         (triangle_mesh, segment_ids, cone_angle, number_of_rays, number_of_clusters,
+          smoothing_lambda, output_cluster_ids, ppmap, traits);
+}
+
+#ifndef DOXYGEN_RUNNING
+// we need these overloads for the default of the point property map
+
+/// sdf_values ///
+template < bool Fast_sdf_calculation_mode, class TriangleMesh, class SDFPropertyMap, class PointPropertyMap>
+std::pair<double, double>
+sdf_values( const TriangleMesh& triangle_mesh,
+            SDFPropertyMap sdf_values_map,
+            double cone_angle = 2.0 / 3.0 * CGAL_PI,
+            std::size_t number_of_rays = 25,
+            bool postprocess = true,
+            PointPropertyMap ppmap = PointPropertyMap())
+{
+  typedef typename boost::property_traits<PointPropertyMap>::value_type Point_3;
+  typedef typename Kernel_traits<Point_3>::Kernel GeomTraits;
+  GeomTraits traits;
+  return sdf_values<Fast_sdf_calculation_mode, TriangleMesh, SDFPropertyMap, PointPropertyMap, GeomTraits>
+         (triangle_mesh, sdf_values_map, cone_angle, number_of_rays, postprocess, ppmap, traits);
+}
+
+template < bool Fast_sdf_calculation_mode, class TriangleMesh, class SDFPropertyMap>
+std::pair<double, double>
+sdf_values( const TriangleMesh& triangle_mesh,
+            SDFPropertyMap sdf_values_map,
+            double cone_angle = 2.0 / 3.0 * CGAL_PI,
+            std::size_t number_of_rays = 25,
+            bool postprocess = true)
+{
+  typedef typename boost::property_map<TriangleMesh, boost::vertex_point_t>::type PointPropertyMap;
+  PointPropertyMap ppmap = get(boost::vertex_point, const_cast<TriangleMesh&>(triangle_mesh));
+  typedef typename boost::property_traits<PointPropertyMap>::value_type Point_3;
+  typedef typename Kernel_traits<Point_3>::Kernel GeomTraits;
+  GeomTraits traits;
+  return sdf_values<Fast_sdf_calculation_mode, TriangleMesh, SDFPropertyMap, PointPropertyMap, GeomTraits>
+         (triangle_mesh, sdf_values_map, cone_angle, number_of_rays, postprocess, ppmap, traits);
+}
+
+template < class TriangleMesh, class SDFPropertyMap, class PointPropertyMap>
+std::pair<double, double>
+sdf_values( const TriangleMesh& triangle_mesh,
+            SDFPropertyMap sdf_values_map,
+            double cone_angle = 2.0 / 3.0 * CGAL_PI,
+            std::size_t number_of_rays = 25,
+            bool postprocess = true,
+            PointPropertyMap ppmap = PointPropertyMap())
+{
+  typedef typename boost::property_traits<PointPropertyMap>::value_type Point_3;
+  typedef typename Kernel_traits<Point_3>::Kernel GeomTraits;
+  GeomTraits traits;
+  return sdf_values<true, TriangleMesh, SDFPropertyMap, PointPropertyMap, GeomTraits>
+         (triangle_mesh, sdf_values_map, cone_angle, number_of_rays, postprocess, ppmap, traits);
+}
+
+template < class TriangleMesh, class SDFPropertyMap>
+std::pair<double, double>
+sdf_values( const TriangleMesh& triangle_mesh,
+            SDFPropertyMap sdf_values_map,
+            double cone_angle = 2.0 / 3.0 * CGAL_PI,
+            std::size_t number_of_rays = 25,
+            bool postprocess = true)
+{
+  typedef typename boost::property_map<TriangleMesh, boost::vertex_point_t>::type PointPropertyMap;
+  PointPropertyMap ppmap = get(boost::vertex_point, const_cast<TriangleMesh&>(triangle_mesh));
+  typedef typename boost::property_traits<PointPropertyMap>::value_type Point_3;
+  typedef typename Kernel_traits<Point_3>::Kernel GeomTraits;
+  GeomTraits traits;
+  return sdf_values<true, TriangleMesh, SDFPropertyMap, PointPropertyMap, GeomTraits>
+         (triangle_mesh, sdf_values_map, cone_angle, number_of_rays, postprocess, ppmap, traits);
+}
+
+/// segmentation_from_sdf_values ///
+template <class TriangleMesh, class SDFPropertyMap, class SegmentPropertyMap, class PointPropertyMap>
+std::size_t
+segmentation_from_sdf_values(const TriangleMesh& triangle_mesh,
+                             SDFPropertyMap sdf_values_map,
+                             SegmentPropertyMap segment_ids,
+                             std::size_t number_of_clusters = 5,
+                             double smoothing_lambda = 0.26,
+                             bool output_cluster_ids = false,
+                             PointPropertyMap ppmap = PointPropertyMap() )
+{
+  typedef typename boost::property_traits<PointPropertyMap>::value_type Point_3;
+  typedef typename Kernel_traits<Point_3>::Kernel GeomTraits;
+  GeomTraits traits;
+  return segmentation_from_sdf_values<TriangleMesh, SDFPropertyMap, SegmentPropertyMap, PointPropertyMap, GeomTraits>
+         (triangle_mesh, sdf_values_map, segment_ids, number_of_clusters, smoothing_lambda,
+          output_cluster_ids, ppmap, traits);
+}
+
+template <class TriangleMesh, class SDFPropertyMap, class SegmentPropertyMap>
+std::size_t
+segmentation_from_sdf_values(const TriangleMesh& triangle_mesh,
+                             SDFPropertyMap sdf_values_map,
+                             SegmentPropertyMap segment_ids,
+                             std::size_t number_of_clusters = 5,
+                             double smoothing_lambda = 0.26,
+                             bool output_cluster_ids = false)
+{
+  typedef typename boost::property_map<TriangleMesh, boost::vertex_point_t>::type PointPropertyMap;
+  PointPropertyMap ppmap = get(boost::vertex_point, const_cast<TriangleMesh&>(triangle_mesh));
+  typedef typename boost::property_traits<PointPropertyMap>::value_type Point_3;
+  typedef typename Kernel_traits<Point_3>::Kernel GeomTraits;
+  GeomTraits traits;
+  return segmentation_from_sdf_values<TriangleMesh, SDFPropertyMap, SegmentPropertyMap, PointPropertyMap, GeomTraits>
+         (triangle_mesh, sdf_values_map, segment_ids, number_of_clusters, smoothing_lambda,
+          output_cluster_ids, ppmap, traits);
+}
+
+/// segmentation_via_sdf_values ///
+template <bool Fast_sdf_calculation_mode, class TriangleMesh, class SegmentPropertyMap, class PointPropertyMap>
+std::size_t
+segmentation_via_sdf_values(const TriangleMesh& triangle_mesh,
+                            SegmentPropertyMap segment_ids,
+                            double cone_angle = 2.0 / 3.0 * CGAL_PI,
+                            std::size_t number_of_rays = 25,
+                            std::size_t number_of_clusters = 5,
+                            double smoothing_lambda = 0.26,
+                            bool output_cluster_ids = false,
+                            PointPropertyMap ppmap = PointPropertyMap() )
+{
+  typedef typename boost::property_traits<PointPropertyMap>::value_type Point_3;
+  typedef typename Kernel_traits<Point_3>::Kernel GeomTraits;
+  GeomTraits traits;
+  return segmentation_via_sdf_values<Fast_sdf_calculation_mode, TriangleMesh, SegmentPropertyMap, PointPropertyMap, GeomTraits>
+         (triangle_mesh, segment_ids, cone_angle, number_of_rays, number_of_clusters,
+          smoothing_lambda, output_cluster_ids, ppmap, traits);
+}
+
+template <bool Fast_sdf_calculation_mode, class TriangleMesh, class SegmentPropertyMap>
+std::size_t
+segmentation_via_sdf_values(const TriangleMesh& triangle_mesh,
+                            SegmentPropertyMap segment_ids,
+                            double cone_angle = 2.0 / 3.0 * CGAL_PI,
+                            std::size_t number_of_rays = 25,
+                            std::size_t number_of_clusters = 5,
+                            double smoothing_lambda = 0.26,
+                            bool output_cluster_ids = false)
+{
+  typedef typename boost::property_map<TriangleMesh, boost::vertex_point_t>::type PointPropertyMap;
+  PointPropertyMap ppmap = get(boost::vertex_point, const_cast<TriangleMesh&>(triangle_mesh));
+  typedef typename boost::property_traits<PointPropertyMap>::value_type Point_3;
+  typedef typename Kernel_traits<Point_3>::Kernel GeomTraits;
+  GeomTraits traits;
+  return segmentation_via_sdf_values<Fast_sdf_calculation_mode, TriangleMesh, SegmentPropertyMap, PointPropertyMap, GeomTraits>
+         (triangle_mesh, segment_ids, cone_angle, number_of_rays, number_of_clusters,
+          smoothing_lambda, output_cluster_ids, ppmap, traits);
+}
+
+template <class TriangleMesh, class SegmentPropertyMap, class PointPropertyMap>
+std::size_t
+segmentation_via_sdf_values(const TriangleMesh& triangle_mesh,
+                            SegmentPropertyMap segment_ids,
+                            double cone_angle = 2.0 / 3.0 * CGAL_PI,
+                            std::size_t number_of_rays = 25,
+                            std::size_t number_of_clusters = 5,
+                            double smoothing_lambda = 0.26,
+                            bool output_cluster_ids = false,
+                            PointPropertyMap ppmap = PointPropertyMap() )
+{
+  typedef typename boost::property_traits<PointPropertyMap>::value_type Point_3;
+  typedef typename Kernel_traits<Point_3>::Kernel GeomTraits;
+  GeomTraits traits;
+  return segmentation_via_sdf_values<true, TriangleMesh, SegmentPropertyMap, PointPropertyMap, GeomTraits>
+         (triangle_mesh, segment_ids, cone_angle, number_of_rays, number_of_clusters,
+          smoothing_lambda, output_cluster_ids, ppmap, traits);
+}
+
+template <class TriangleMesh, class SegmentPropertyMap>
+std::size_t
+segmentation_via_sdf_values(const TriangleMesh& triangle_mesh,
+                            SegmentPropertyMap segment_ids,
+                            double cone_angle = 2.0 / 3.0 * CGAL_PI,
+                            std::size_t number_of_rays = 25,
+                            std::size_t number_of_clusters = 5,
+                            double smoothing_lambda = 0.26,
+                            bool output_cluster_ids = false)
+{
+  typedef typename boost::property_map<TriangleMesh, boost::vertex_point_t>::type PointPropertyMap;
+  PointPropertyMap ppmap = get(boost::vertex_point, const_cast<TriangleMesh&>(triangle_mesh));
+  typedef typename boost::property_traits<PointPropertyMap>::value_type Point_3;
+  typedef typename Kernel_traits<Point_3>::Kernel GeomTraits;
+  GeomTraits traits;
+  return segmentation_via_sdf_values<true, TriangleMesh, SegmentPropertyMap, PointPropertyMap, GeomTraits>
+         (triangle_mesh, segment_ids, cone_angle, number_of_rays, number_of_clusters,
+          smoothing_lambda, output_cluster_ids, ppmap, traits);
+}
+#endif
+
+
+}//namespace CGAL
+
+#endif // CGAL_SURFACE_MESH_SEGMENTATION_MESH_SEGMENTATION_H //
diff --git a/3rdparty/CGAL-4.8/include/CGAL/mesh_skin_surface_3.h b/3rdparty/CGAL/include/CGAL/mesh_skin_surface_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/mesh_skin_surface_3.h
rename to 3rdparty/CGAL/include/CGAL/mesh_skin_surface_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/mesh_union_of_balls_3.h b/3rdparty/CGAL/include/CGAL/mesh_union_of_balls_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/mesh_union_of_balls_3.h
rename to 3rdparty/CGAL/include/CGAL/mesh_union_of_balls_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/min_max_n.h b/3rdparty/CGAL/include/CGAL/min_max_n.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/min_max_n.h
rename to 3rdparty/CGAL/include/CGAL/min_max_n.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/min_quadrilateral_2.h b/3rdparty/CGAL/include/CGAL/min_quadrilateral_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/min_quadrilateral_2.h
rename to 3rdparty/CGAL/include/CGAL/min_quadrilateral_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/minimum_enclosing_quadrilateral_2.h b/3rdparty/CGAL/include/CGAL/minimum_enclosing_quadrilateral_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/minimum_enclosing_quadrilateral_2.h
rename to 3rdparty/CGAL/include/CGAL/minimum_enclosing_quadrilateral_2.h
diff --git a/3rdparty/CGAL/include/CGAL/minkowski_sum_2.h b/3rdparty/CGAL/include/CGAL/minkowski_sum_2.h
new file mode 100644
index 0000000..1715d66
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/minkowski_sum_2.h
@@ -0,0 +1,1103 @@
+// Copyright (c) 2006  Tel-Aviv University (Israel).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// 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.
+//
+// Author(s) : Ron Wein   <wein_r at yahoo.com>
+//             Efi Fogel  <efifogel at gmail.com>
+
+#ifndef CGAL_MINKOWSKI_SUM_2_H
+#define CGAL_MINKOWSKI_SUM_2_H
+
+#include <CGAL/basic.h>
+#include <CGAL/Polygon_with_holes_2.h>
+#include <CGAL/Minkowski_sum_2/Hole_filter_2.h>
+#include <CGAL/Minkowski_sum_2/Minkowski_sum_by_reduced_convolution_2.h>
+#include <CGAL/Minkowski_sum_2/Minkowski_sum_conv_2.h>
+#include <CGAL/Minkowski_sum_2/Minkowski_sum_decomp_2.h>
+#include <CGAL/Polygon_nop_decomposition_2.h>
+#include <CGAL/Gps_segment_traits_2.h>
+
+#include <list>
+
+namespace CGAL {
+
+/*!
+ * Computes the Minkowski sum \f$ P \oplus Q\f$ of two given polygons.
+ * The function computes the reduced convolution of the two polygons and
+ * extracts those loops of the convolution which are part of the Minkowsi
+ * sum. This method works very efficiently, regardless of whether `P` and
+ * `Q` are convex or non-convex.
+ * Note that as the input polygons may not be convex, their Minkowski
+ * sum may not be a simple polygon. The result is therefore represented
+ * as a polygon with holes.
+ * \param[in] pgn1 The first polygon.
+ * \param[in] pgn2 The second polygon.
+ * \pre Both `P` and `Q` are simple, counterclockwise-oriented polygons.
+ */
+template <typename Kernel_, typename Container_>
+Polygon_with_holes_2<Kernel_, Container_>
+minkowski_sum_by_reduced_convolution_2(const Polygon_2<Kernel_,
+                                       Container_>& pgn1,
+                                       const Polygon_2<Kernel_,
+                                       Container_>& pgn2)
+{
+  typedef Kernel_                                    Kernel;
+  typedef Container_                                 Container;
+
+  Minkowski_sum_by_reduced_convolution_2<Kernel, Container> mink_sum;
+  Polygon_2<Kernel, Container>                              sum_bound;
+  std::list<Polygon_2<Kernel, Container> >                  sum_holes;
+
+  if (pgn1.size() > pgn2.size())
+    mink_sum(pgn1, pgn2, sum_bound, std::back_inserter(sum_holes));
+  else mink_sum(pgn2, pgn1, sum_bound, std::back_inserter(sum_holes));
+
+  return (Polygon_with_holes_2<Kernel,Container>(sum_bound,
+                                                 sum_holes.begin(),
+                                                 sum_holes.end()));
+}
+
+/*!
+ * Computes the Minkowski sum \f$ P \oplus Q\f$ of two given polygons with
+ * holes.
+ * The function computes the reduced convolution of the two polygons and
+ * extracts those loops of the convolution which are part of the Minkowsi
+ * sum. This method works very efficiently, regardless of whether `P` and
+ * `Q` are convex or non-convex.
+ * The result is also represented as a polygon with holes.
+ * \param[in] pgn1 The first polygon.
+ * \param[in] pgn2 The second polygon.
+ */
+template <typename Kernel_, typename Container_>
+Polygon_with_holes_2<Kernel_, Container_>
+minkowski_sum_by_reduced_convolution_2
+(const Polygon_with_holes_2<Kernel_, Container_>& pgn1,
+ const Polygon_with_holes_2<Kernel_, Container_>& pgn2)
+{
+  typedef Kernel_                                    Kernel;
+  typedef Container_                                 Container;
+
+  Hole_filter_2<Kernel, Container> hole_filter;
+
+  Polygon_with_holes_2<Kernel, Container> filtered_pgn1;
+  Polygon_with_holes_2<Kernel, Container> filtered_pgn2;
+
+  hole_filter(pgn1, pgn2, filtered_pgn1);
+  hole_filter(pgn2, pgn1, filtered_pgn2);
+
+  Minkowski_sum_by_reduced_convolution_2<Kernel, Container> mink_sum;
+  Polygon_2<Kernel, Container>                              sum_bound;
+  std::list<Polygon_2<Kernel, Container> >                  sum_holes;
+
+  mink_sum(filtered_pgn1, filtered_pgn2, sum_bound,
+           std::back_inserter(sum_holes));
+
+  return (Polygon_with_holes_2<Kernel,Container>(sum_bound,
+                                                 sum_holes.begin(),
+                                                 sum_holes.end()));
+}
+
+/*!
+ * Computes the Minkowski sum \f$ P \oplus Q\f$ of a simple polygon and a
+ * polygon with holes.
+ * The function computes the reduced convolution of the two polygons and
+ * extracts those loops of the convolution which are part of the Minkowsi
+ * sum. This method works very efficiently, regardless of whether `P` and
+ * `Q` are convex or non-convex.
+ * The result is also represented as a polygon with holes.
+ * \param[in] pgn1 The simple polygon.
+ * \param[in] pgn2 The polygon with holes.
+ */
+template <typename Kernel_, typename Container_>
+Polygon_with_holes_2<Kernel_, Container_>
+minkowski_sum_by_reduced_convolution_2
+(const Polygon_2<Kernel_, Container_>& pgn1,
+ const Polygon_with_holes_2<Kernel_, Container_>& pgn2)
+{
+  typedef Kernel_                                    Kernel;
+  typedef Container_                                 Container;
+
+  Hole_filter_2<Kernel, Container> hole_filter;
+  Polygon_with_holes_2<Kernel, Container> filtered_pgn2;
+  hole_filter(pgn2, pgn1, filtered_pgn2);
+  Minkowski_sum_by_reduced_convolution_2<Kernel, Container> mink_sum;
+  Polygon_2<Kernel, Container>                              sum_bound;
+  std::list<Polygon_2<Kernel, Container> >                  sum_holes;
+  mink_sum(pgn1, filtered_pgn2, sum_bound, std::back_inserter(sum_holes));
+  return (Polygon_with_holes_2<Kernel,Container>(sum_bound,
+                                                 sum_holes.begin(),
+                                                 sum_holes.end()));
+}
+
+/*!
+ * Computes the Minkowski sum \f$ P \oplus Q\f$ of a simple polygon and a
+ * polygon with holes.
+ * The function computes the reduced convolution of the two polygons and
+ * extracts those loops of the convolution which are part of the Minkowsi
+ * sum. This method works very efficiently, regardless of whether `P` and
+ * `Q` are convex or non-convex.
+ * The result is also represented as a polygon with holes.
+ * \param[in] pgn1 The polygon with holes.
+ * \param[in] pgn2 The simple polygon.
+ */
+template <typename Kernel_, typename Container_>
+Polygon_with_holes_2<Kernel_, Container_>
+minkowski_sum_by_reduced_convolution_2
+(const Polygon_with_holes_2<Kernel_, Container_>& pgn1,
+ const Polygon_2<Kernel_, Container_>& pgn2)
+{ return minkowski_sum_by_reduced_convolution_2(pgn2, pgn1); }
+
+/*!
+ * Compute the Minkowski sum of two simple polygons using the (full)
+ * convolution method.
+ * Note that as the input polygons may not be convex, their Minkowski sum may
+ * not be a simple polygon. The result is therefore represented as a polygon
+ * with holes.
+ * \param[in] pgn1 The first polygon.
+ * \param[in] pgn2 The second polygon.
+ * \return The resulting polygon with holes, representing the sum.
+ */
+template <typename Kernel_, typename Container_>
+Polygon_with_holes_2<Kernel_, Container_>
+minkowski_sum_by_full_convolution_2(const Polygon_2<Kernel_, Container_>& pgn1,
+                                    const Polygon_2<Kernel_, Container_>& pgn2)
+{
+  typedef Kernel_                                    Kernel;
+  typedef Container_                                 Container;
+
+  Minkowski_sum_by_convolution_2<Kernel, Container> mink_sum;
+  Polygon_2<Kernel, Container>                      sum_bound;
+  std::list<Polygon_2<Kernel, Container> >          sum_holes;
+
+  if (pgn1.size() > pgn2.size())
+    mink_sum(pgn1, pgn2, sum_bound, std::back_inserter(sum_holes));
+  else mink_sum(pgn2, pgn1, sum_bound, std::back_inserter(sum_holes));
+  return (Polygon_with_holes_2<Kernel, Container>(sum_bound,
+                                                  sum_holes.begin(),
+                                                  sum_holes.end()));
+}
+
+/*!
+ * Compute the Minkowski sum of two simple polygons using the convolution
+ * method. This function defaults to calling the reduced convolution method,
+ * as it is more efficient in most cases.
+ * Note that as the input polygons may not be convex, their Minkowski sum may
+ * not be a simple polygon. The result is therefore represented as a polygon
+ * with holes.
+ * \param[in] pgn1 The first polygon.
+ * \param[in] pgn2 The second polygon.
+ * \return The resulting polygon with holes, representing the sum.
+ *
+ * \sa `CGAL::minkowski_sum_by_reduced_convolution_2()`
+ * \sa `CGAL::minkowski_sum_by_full_convolution_2()`
+ */
+template <typename Kernel_, typename Container_>
+Polygon_with_holes_2<Kernel_, Container_>
+minkowski_sum_2(const Polygon_2<Kernel_, Container_>& pgn1,
+                const Polygon_2<Kernel_, Container_>& pgn2)
+{ return minkowski_sum_by_reduced_convolution_2(pgn1, pgn2); }
+
+/*!
+ * Compute the Minkowski sum of two polygons with holes using the convolution
+ * method. This function defaults to calling the reduced convolution method,
+ * as it is more efficient in most cases.
+ * Note that the result may not be a simple polygon. The result is therefore
+ * represented as a polygon with holes.
+ * \param[in] pgn1 The first polygon with holes.
+ * \param[in] pgn2 The second polygon with holes.
+ * \return The resulting polygon with holes, representing the sum.
+ *
+ * \sa `CGAL::minkowski_sum_by_reduced_convolution_2()`
+ * \sa `CGAL::minkowski_sum_by_full_convolution_2()`
+ */
+template <typename Kernel_, typename Container_>
+Polygon_with_holes_2<Kernel_, Container_>
+minkowski_sum_2(const Polygon_with_holes_2<Kernel_, Container_>& pgn1,
+                const Polygon_with_holes_2<Kernel_, Container_>& pgn2)
+{ return minkowski_sum_by_reduced_convolution_2(pgn1, pgn2); }
+
+/*!
+ * Compute the Minkowski sum of a simple polygon and a polygon with holes
+ * using the convolution method. This function defaults to calling the reduced
+ * convolution method, as it is more efficient in most cases.
+ * Note that the result may not be a simple polygon. The result is therefore
+ * represented as a polygon with holes.
+ * \param[in] pgn1 The simple polygon.
+ * \param[in] pgn2 The polygon with holes.
+ * \return The resulting polygon with holes, representing the sum.
+ *
+ * \sa `CGAL::minkowski_sum_by_reduced_convolution_2()`
+ * \sa `CGAL::minkowski_sum_by_full_convolution_2()`
+ */
+template <typename Kernel_, typename Container_>
+Polygon_with_holes_2<Kernel_, Container_>
+minkowski_sum_2(const Polygon_2<Kernel_, Container_>& pgn1,
+                const Polygon_with_holes_2<Kernel_, Container_>& pgn2)
+{ return minkowski_sum_by_reduced_convolution_2(pgn1, pgn2); }
+
+/*!
+ * Compute the Minkowski sum of a simple polygon and a polygon with holes
+ * using the convolution method. This function defaults to calling the reduced
+ * convolution method, as it is more efficient in most cases.
+ * Note that the result may not be a simple polygon. The result is therefore
+ * represented as a polygon with holes.
+ * \param[in] pgn1 The polygon with holes.
+ * \param[in] pgn2 The simple polygon.
+ * \return The resulting polygon with holes, representing the sum.
+ *
+ * \sa `CGAL::minkowski_sum_by_reduced_convolution_2()`
+ * \sa `CGAL::minkowski_sum_by_full_convolution_2()`
+ */
+template <typename Kernel_, typename Container_>
+Polygon_with_holes_2<Kernel_, Container_>
+minkowski_sum_2(const Polygon_with_holes_2<Kernel_, Container_>& pgn1,
+                const Polygon_2<Kernel_, Container_>& pgn2)
+{ return minkowski_sum_by_reduced_convolution_2(pgn1, pgn2); }
+
+/*!
+ * \defgroup Minkowski sum by decomposition
+ * @{
+ */
+
+/*! Compute the Minkowski sum of two simple polygons by decomposing each
+ * polygon to convex sub-polygons and computing the union of the pairwise
+ * Minkowski sums of the sub-polygons.
+ * Note that as the input polygons may not be convex, their Minkowski sum may
+ * not be a simple polygon. The result is therefore represented as a polygon
+ * with holes.
+ * \param[in] pgn1 The first polygon.
+ * \param[in] pgn2 The second polygon.
+ * \param[in] decomposition_strategy A functor for decomposing polygons.
+ * \return The resulting polygon with holes, representing the sum.
+ */
+template <typename Kernel_, typename Container_,
+          typename DecompositionStrategy1_, typename DecompositionStrategy2_>
+Polygon_with_holes_2<Kernel_, Container_>
+minkowski_sum_2(const Polygon_2<Kernel_, Container_>& pgn1,
+                const Polygon_2<Kernel_, Container_>& pgn2,
+                const DecompositionStrategy1_& decomposition_strategy1,
+                const DecompositionStrategy2_& decomposition_strategy2)
+{
+  typename Minkowski_sum_by_decomposition_2<DecompositionStrategy1_,
+                                            DecompositionStrategy2_,
+                                            Container_>::Traits_2 traits;
+  return minkowski_sum_2(pgn1, pgn2,
+                         decomposition_strategy1, decomposition_strategy2,
+                         traits);
+}
+
+/*! Compute the Minkowski sum of two simple polygons by decomposing each
+ * polygon to convex sub-polygons and computing the union of the pairwise
+ * Minkowski sums of the sub-polygons.
+ * Note that as the input polygons may not be convex, their Minkowski sum may
+ * not be a simple polygon. The result is therefore represented as a polygon
+ * with holes.
+ * \param[in] pgn1 The first polygon.
+ * \param[in] pgn2 The second polygon.
+ * \param[in] decomposition_strategy A functor for decomposing polygons.
+ * \param[in] traits The traits.
+ * \return The resulting polygon with holes, representing the sum.
+ *
+ * The type of the last argument, namely,
+ *   Gps_segment_traits_2<Kernel_, Container_>
+ * and the type
+ *   const typename Minkowski_sum_by_decomposition_2<DecompositionStrategy1_,
+ *                                                   DecompositionStrategy2_,
+ *                                                   Container_>::Traits_2>
+ * are exchangable except for in one case, where there is an ambiguity.
+ * Thus, we use the former, even though it is less generic, as change to the
+ * traits type in Minkowski_sum_by_decomposition_2 would require a similar
+ * change here.
+ */
+template <typename Kernel_, typename Container_,
+          typename DecompositionStrategy1_, typename DecompositionStrategy2_>
+Polygon_with_holes_2<Kernel_, Container_>
+minkowski_sum_2(const Polygon_2<Kernel_, Container_>& pgn1,
+                const Polygon_2<Kernel_, Container_>& pgn2,
+                const DecompositionStrategy1_& decomposition_strategy1,
+                const DecompositionStrategy2_& decomposition_strategy2,
+                const Gps_segment_traits_2<Kernel_, Container_>& traits)
+{
+  typedef Container_                            Container;
+  typedef DecompositionStrategy1_               Decomposition_strategy1;
+  typedef DecompositionStrategy2_               Decomposition_strategy2;
+
+  Minkowski_sum_by_decomposition_2<Decomposition_strategy1,
+                                   Decomposition_strategy2, Container>
+    mink_sum(decomposition_strategy1, decomposition_strategy2, traits);
+  return mink_sum(pgn1, pgn2);
+}
+
+/*!
+ * Compute the Minkowski sum of two polygon with holes by decomposing each
+ * polygon to convex sub-polygons and computing the union of the pairwise
+ * Minkowski sums of the sub-polygons.
+ * The result is also represented as a polygon with holes.
+ * \param[in] pgn1 The first polygon.
+ * \param[in] pgn2 The second polygon.
+ * \param[in] decomposition_strategy A functor for decomposing polygons.
+ * \return The resulting polygon with holes, representing the sum.
+ */
+template <typename Kernel_, typename Container_,
+          typename DecompositionStrategy1_, typename DecompositionStrategy2_>
+Polygon_with_holes_2<Kernel_, Container_>
+minkowski_sum_2(const Polygon_with_holes_2<Kernel_, Container_>& pgn1,
+                const Polygon_with_holes_2<Kernel_, Container_>& pgn2,
+                const DecompositionStrategy1_& decomposition_strategy1,
+                const DecompositionStrategy2_& decomposition_strategy2)
+{
+  typename Minkowski_sum_by_decomposition_2<DecompositionStrategy1_,
+                                            DecompositionStrategy2_,
+                                            Container_>::Traits_2 traits;
+  return minkowski_sum_2(pgn1, pgn2,
+                         decomposition_strategy1, decomposition_strategy2,
+                         traits);
+}
+
+/*! Compute the Minkowski sum of two polygon with holes by decomposing each
+ * polygon to convex sub-polygons and computing the union of the pairwise
+ * Minkowski sums of the sub-polygons.
+ * The result is also represented as a polygon with holes.
+ * \param[in] pgn1 The first polygon.
+ * \param[in] pgn2 The second polygon.
+ * \param[in] decomposition_strategy A functor for decomposing polygons.
+ * \param[in] traits The traits.
+ * \return The resulting polygon with holes, representing the sum.
+ */
+template <typename Kernel_, typename Container_,
+          typename DecompositionStrategy1_, typename DecompositionStrategy2_>
+Polygon_with_holes_2<Kernel_, Container_>
+minkowski_sum_2(const Polygon_with_holes_2<Kernel_, Container_>& pgn1,
+                const Polygon_with_holes_2<Kernel_, Container_>& pgn2,
+                const DecompositionStrategy1_& decomposition_strategy1,
+                const DecompositionStrategy2_& decomposition_strategy2,
+                const Gps_segment_traits_2<Kernel_, Container_>& traits)
+{
+  typedef Kernel_                               Kernel;
+  typedef Container_                            Container;
+  typedef DecompositionStrategy1_               Decomposition_strategy1;
+  typedef DecompositionStrategy2_               Decomposition_strategy2;
+
+  Minkowski_sum_by_decomposition_2<Decomposition_strategy1,
+                                   Decomposition_strategy2, Container>
+    mink_sum(decomposition_strategy1, decomposition_strategy2, traits);
+  Hole_filter_2<Kernel, Container> hole_filter;
+  Polygon_with_holes_2<Kernel,Container> filtered_pgn1;
+  Polygon_with_holes_2<Kernel,Container> filtered_pgn2;
+  hole_filter(pgn1, pgn2, filtered_pgn1);
+  hole_filter(pgn2, pgn1, filtered_pgn2);
+  return mink_sum(filtered_pgn1, filtered_pgn2);
+}
+
+/*! Compute the Minkowski sum of a simple polygon and a polygon with holes
+ * by decomposing each polygon to convex sub-polygons and computing the union
+ * of the pairwise Minkowski sums of the sub-polygons.  The result is also
+ * represented as a polygon with holes.
+ * \param[in] pgn1 The first polygon.
+ * \param[in] pgn2 The second polygon.
+ * \param[in] decomposition_strategy A functor for decomposing polygons.
+ * \return The resulting polygon with holes, representing the sum.
+ */
+template <typename Kernel_, typename Container_,
+          typename DecompositionStrategy1_, typename DecompositionStrategy2_>
+Polygon_with_holes_2<Kernel_, Container_>
+minkowski_sum_2(const Polygon_2<Kernel_, Container_>& pgn1,
+                const Polygon_with_holes_2<Kernel_, Container_>& pgn2,
+                const DecompositionStrategy1_& decomposition_strategy1,
+                const DecompositionStrategy2_& decomposition_strategy2)
+{
+  typename Minkowski_sum_by_decomposition_2<DecompositionStrategy1_,
+                                            DecompositionStrategy2_,
+                                            Container_>::Traits_2 traits;
+  return minkowski_sum_2(pgn1, pgn2,
+                         decomposition_strategy1, decomposition_strategy2,
+                         traits);
+}
+
+/*! Compute the Minkowski sum of a simple polygon and a polygon with holes
+ * by decomposing each polygon to convex sub-polygons and computing the union
+ * of the pairwise Minkowski sums of the sub-polygons.  The result is also
+ * represented as a polygon with holes.
+ * \param[in] pgn1 The simple polygon.
+ * \param[in] pgn2 The polygon with holes.
+ * \param[in] decomposition_strategy A functor for decomposing polygons.
+ * \param[in] traits The traits.
+ * \return The resulting polygon with holes, representing the sum.
+ */
+template <typename Kernel_, typename Container_,
+          typename DecompositionStrategy1_, typename DecompositionStrategy2_>
+Polygon_with_holes_2<Kernel_, Container_>
+minkowski_sum_2(const Polygon_2<Kernel_, Container_>& pgn1,
+                const Polygon_with_holes_2<Kernel_, Container_>& pgn2,
+                const DecompositionStrategy1_& decomposition_strategy1,
+                const DecompositionStrategy2_& decomposition_strategy2,
+                const Gps_segment_traits_2<Kernel_, Container_>& traits)
+{
+  typedef Kernel_                               Kernel;
+  typedef Container_                            Container;
+  typedef DecompositionStrategy1_               Decomposition_strategy1;
+  typedef DecompositionStrategy2_               Decomposition_strategy2;
+
+  Minkowski_sum_by_decomposition_2<Decomposition_strategy1,
+                                   Decomposition_strategy2, Container>
+    mink_sum(decomposition_strategy1, decomposition_strategy2, traits);
+  Hole_filter_2<Kernel, Container> hole_filter;
+  Polygon_with_holes_2<Kernel, Container> filtered_pgn2;
+  hole_filter(pgn2, pgn1, filtered_pgn2);
+  return mink_sum(pgn1, filtered_pgn2);
+}
+
+/*! Compute the Minkowski sum of a simple polygon and a polygon with holes
+ * by decomposing each polygon to convex sub-polygons and computing the union
+ * of the pairwise Minkowski sums of the sub-polygons.  The result is also
+ * represented as a polygon with holes.
+ * \param[in] pgn1 The second polygon.
+ * \param[in] pgn2 The first polygon.
+ * \param[in] decomposition_strategy A functor for decomposing polygons.
+ * \return The resulting polygon with holes, representing the sum.
+ */
+template <typename Kernel_, typename Container_,
+          typename DecompositionStrategy1_, typename DecompositionStrategy2_>
+Polygon_with_holes_2<Kernel_, Container_>
+minkowski_sum_2(const Polygon_with_holes_2<Kernel_, Container_>& pgn1,
+                const Polygon_2<Kernel_, Container_>& pgn2,
+                const DecompositionStrategy1_& decomposition_strategy1,
+                const DecompositionStrategy2_& decomposition_strategy2)
+{
+  typename Minkowski_sum_by_decomposition_2<DecompositionStrategy1_,
+                                            DecompositionStrategy2_,
+                                            Container_>::Traits_2 traits;
+  return minkowski_sum_2(pgn1, pgn2,
+                         decomposition_strategy1, decomposition_strategy2,
+                         traits);
+}
+
+/*! Compute the Minkowski sum of a simple polygon and a polygon with holes
+ * by decomposing each polygon to convex sub-polygons and computing the union
+ * of the pairwise Minkowski sums of the sub-polygons.  The result is also
+ * represented as a polygon with holes.
+ * \param[in] pgn1 The polygon with holes.
+ * \param[in] pgn2 The simple polygon.
+ * \param[in] decomposition_strategy A functor for decomposing polygons.
+ * \param[in] traits The traits.
+ * \return The resulting polygon with holes, representing the sum.
+ */
+template <typename Kernel_, typename Container_,
+          typename DecompositionStrategy1_, typename DecompositionStrategy2_>
+Polygon_with_holes_2<Kernel_, Container_>
+minkowski_sum_2(const Polygon_with_holes_2<Kernel_, Container_>& pgn1,
+                const Polygon_2<Kernel_, Container_>& pgn2,
+                const DecompositionStrategy1_& decomposition_strategy1,
+                const DecompositionStrategy2_& decomposition_strategy2,
+                const Gps_segment_traits_2<Kernel_, Container_>& traits)
+{
+  return minkowski_sum_2(pgn2, pgn1,
+                         decomposition_strategy2, decomposition_strategy1,
+                         traits);
+}
+
+/*! Compute the Minkowski sum of two simple polygons by decomposing each
+ * polygon to convex sub-polygons and computing the union of the pairwise
+ * Minkowski sums of the sub-polygons.
+ * Note that as the input polygons may not be convex, their Minkowski sum may
+ * not be a simple polygon. The result is therefore represented as a polygon
+ * with holes.
+ * \param[in] pgn1 The first polygon.
+ * \param[in] pgn2 The second polygon.
+ * \param[in] decomposition_strategy A functor for decomposing polygons.
+ * \return The resulting polygon with holes, representing the sum.
+ */
+template <typename Kernel_, typename Container_,
+          typename DecompositionStrategy1_>
+Polygon_with_holes_2<Kernel_, Container_>
+minkowski_sum_2(const Polygon_2<Kernel_, Container_>& pgn1,
+                const Polygon_2<Kernel_, Container_>& pgn2,
+                const DecompositionStrategy1_& decomposition_strategy1)
+{
+  typename Minkowski_sum_by_decomposition_2<DecompositionStrategy1_,
+                                            DecompositionStrategy1_,
+                                            Container_>::Traits_2 traits;
+  return minkowski_sum_2(pgn1, pgn2,
+                         decomposition_strategy1, decomposition_strategy1,
+                         traits);
+}
+
+/*! Compute the Minkowski sum of two simple polygons by decomposing each
+ * polygon to convex sub-polygons and computing the union of the pairwise
+ * Minkowski sums of the sub-polygons.
+ * Note that as the input polygons may not be convex, their Minkowski sum may
+ * not be a simple polygon. The result is therefore represented as a polygon
+ * with holes.
+ * \param[in] pgn1 The first polygon.
+ * \param[in] pgn2 The second polygon.
+ * \param[in] decomposition_strategy A functor for decomposing polygons.
+ * \param[in] traits The traits.
+ * \return The resulting polygon with holes, representing the sum.
+ */
+template <typename Kernel_, typename Container_,
+          typename DecompositionStrategy1_>
+Polygon_with_holes_2<Kernel_, Container_>
+minkowski_sum_2(const Polygon_2<Kernel_, Container_>& pgn1,
+                const Polygon_2<Kernel_, Container_>& pgn2,
+                const DecompositionStrategy1_& decomposition_strategy1,
+                const Gps_segment_traits_2<Kernel_, Container_>& traits)
+{
+  typedef Container_                            Container;
+  typedef DecompositionStrategy1_               Decomposition_strategy1;
+
+  Minkowski_sum_by_decomposition_2<Decomposition_strategy1,
+                                   Decomposition_strategy1, Container>
+    mink_sum(decomposition_strategy1, decomposition_strategy1, traits);
+  return mink_sum(pgn1, pgn2);
+}
+
+/*!
+ * Compute the Minkowski sum of two polygon with holes by decomposing each
+ * polygon to convex sub-polygons and computing the union of the pairwise
+ * Minkowski sums of the sub-polygons.
+ * The result is also represented as a polygon with holes.
+ * \param[in] pgn1 The first polygon.
+ * \param[in] pgn2 The second polygon.
+ * \param[in] decomposition_strategy A functor for decomposing polygons.
+ * \return The resulting polygon with holes, representing the sum.
+ */
+template <typename Kernel_, typename Container_,
+          typename DecompositionStrategy1_>
+Polygon_with_holes_2<Kernel_, Container_>
+minkowski_sum_2(const Polygon_with_holes_2<Kernel_, Container_>& pgn1,
+                const Polygon_with_holes_2<Kernel_, Container_>& pgn2,
+                const DecompositionStrategy1_& decomposition_strategy1)
+{
+  typename Minkowski_sum_by_decomposition_2<DecompositionStrategy1_,
+                                            DecompositionStrategy1_,
+                                            Container_>::Traits_2 traits;
+  return minkowski_sum_2(pgn1, pgn2,
+                         decomposition_strategy1, decomposition_strategy1,
+                         traits);
+}
+
+/*! Compute the Minkowski sum of two polygon with holes by decomposing each
+ * polygon to convex sub-polygons and computing the union of the pairwise
+ * Minkowski sums of the sub-polygons.
+ * The result is also represented as a polygon with holes.
+ * \param[in] pgn1 The first polygon.
+ * \param[in] pgn2 The second polygon.
+ * \param[in] decomposition_strategy A functor for decomposing polygons.
+ * \param[in] traits The traits.
+ * \return The resulting polygon with holes, representing the sum.
+ */
+template <typename Kernel_, typename Container_,
+          typename DecompositionStrategy1_>
+Polygon_with_holes_2<Kernel_, Container_>
+minkowski_sum_2(const Polygon_with_holes_2<Kernel_, Container_>& pgn1,
+                const Polygon_with_holes_2<Kernel_, Container_>& pgn2,
+                const DecompositionStrategy1_& decomposition_strategy1,
+                const Gps_segment_traits_2<Kernel_, Container_>& traits)
+{
+  typedef Kernel_                               Kernel;
+  typedef Container_                            Container;
+  typedef DecompositionStrategy1_               Decomposition_strategy1;
+
+  Minkowski_sum_by_decomposition_2<Decomposition_strategy1,
+                                   Decomposition_strategy1, Container>
+    mink_sum(decomposition_strategy1, decomposition_strategy1, traits);
+  Hole_filter_2<Kernel, Container> hole_filter;
+  Polygon_with_holes_2<Kernel,Container> filtered_pgn1;
+  Polygon_with_holes_2<Kernel,Container> filtered_pgn2;
+  hole_filter(pgn1, pgn2, filtered_pgn1);
+  hole_filter(pgn2, pgn1, filtered_pgn2);
+  return mink_sum(filtered_pgn1, filtered_pgn2);
+}
+
+/*! Compute the Minkowski sum of a simple polygon and a polygon with holes
+ * by decomposing each polygon to convex sub-polygons and computing the union
+ * of the pairwise Minkowski sums of the sub-polygons.  The result is also
+ * represented as a polygon with holes.
+ * \param[in] pgn1 The first polygon.
+ * \param[in] pgn2 The second polygon.
+ * \param[in] decomposition_strategy A functor for decomposing polygons.
+ * \return The resulting polygon with holes, representing the sum.
+ */
+template <typename Kernel_, typename Container_,
+          typename DecompositionStrategy1_>
+Polygon_with_holes_2<Kernel_, Container_>
+minkowski_sum_2(const Polygon_2<Kernel_, Container_>& pgn1,
+                const Polygon_with_holes_2<Kernel_, Container_>& pgn2,
+                const DecompositionStrategy1_& decomposition_strategy1)
+{
+  typename Minkowski_sum_by_decomposition_2<DecompositionStrategy1_,
+                                            DecompositionStrategy1_,
+                                            Container_>::Traits_2 traits;
+  return minkowski_sum_2(pgn1, pgn2,
+                         decomposition_strategy1, decomposition_strategy1,
+                         traits);
+}
+
+/*! Compute the Minkowski sum of a simple polygon and a polygon with holes
+ * by decomposing each polygon to convex sub-polygons and computing the union
+ * of the pairwise Minkowski sums of the sub-polygons.  The result is also
+ * represented as a polygon with holes.
+ * \param[in] pgn1 The simple polygon.
+ * \param[in] pgn2 The polygon with holes.
+ * \param[in] decomposition_strategy A functor for decomposing polygons.
+ * \param[in] traits The traits.
+ * \return The resulting polygon with holes, representing the sum.
+ */
+template <typename Kernel_, typename Container_,
+          typename DecompositionStrategy1_>
+Polygon_with_holes_2<Kernel_, Container_>
+minkowski_sum_2(const Polygon_2<Kernel_, Container_>& pgn1,
+                const Polygon_with_holes_2<Kernel_, Container_>& pgn2,
+                const DecompositionStrategy1_& decomposition_strategy1,
+                const Gps_segment_traits_2<Kernel_, Container_>& traits)
+{
+  typedef Kernel_                               Kernel;
+  typedef Container_                            Container;
+  typedef DecompositionStrategy1_               Decomposition_strategy1;
+
+  Minkowski_sum_by_decomposition_2<Decomposition_strategy1,
+                                   Decomposition_strategy1, Container>
+    mink_sum(decomposition_strategy1, decomposition_strategy1, traits);
+  Hole_filter_2<Kernel, Container> hole_filter;
+  Polygon_with_holes_2<Kernel,Container> filtered_pgn2;
+  hole_filter(pgn2, pgn1, filtered_pgn2);
+  return mink_sum(pgn1, filtered_pgn2);
+}
+
+/*! Compute the Minkowski sum of a simple polygon and a polygon with holes
+ * by decomposing each polygon to convex sub-polygons and computing the union
+ * of the pairwise Minkowski sums of the sub-polygons.  The result is also
+ * represented as a polygon with holes.
+ * \param[in] pgn1 The second polygon.
+ * \param[in] pgn2 The first polygon.
+ * \param[in] decomposition_strategy A functor for decomposing polygons.
+ * \return The resulting polygon with holes, representing the sum.
+ */
+template <typename Kernel_, typename Container_,
+          typename DecompositionStrategy1_>
+Polygon_with_holes_2<Kernel_, Container_>
+minkowski_sum_2(const Polygon_with_holes_2<Kernel_, Container_>& pgn1,
+                const Polygon_2<Kernel_, Container_>& pgn2,
+                const DecompositionStrategy1_& decomposition_strategy1)
+{
+  typename Minkowski_sum_by_decomposition_2<DecompositionStrategy1_,
+                                            DecompositionStrategy1_,
+                                            Container_>::Traits_2 traits;
+  return minkowski_sum_2(pgn1, pgn2,
+                         decomposition_strategy1, decomposition_strategy1,
+                         traits);
+}
+
+/*! Compute the Minkowski sum of a simple polygon and a polygon with holes
+ * by decomposing each polygon to convex sub-polygons and computing the union
+ * of the pairwise Minkowski sums of the sub-polygons.  The result is also
+ * represented as a polygon with holes.
+ * \param[in] pgn1 The polygon with holes.
+ * \param[in] pgn2 The simple polygon.
+ * \param[in] decomposition_strategy A functor for decomposing polygons.
+ * \param[in] traits The traits.
+ * \return The resulting polygon with holes, representing the sum.
+ */
+template <typename Kernel_, typename Container_,
+          typename DecompositionStrategy1_>
+Polygon_with_holes_2<Kernel_, Container_>
+minkowski_sum_2(const Polygon_with_holes_2<Kernel_, Container_>& pgn1,
+                const Polygon_2<Kernel_, Container_>& pgn2,
+                const DecompositionStrategy1_& decomposition_strategy1,
+                const Gps_segment_traits_2<Kernel_, Container_>& traits)
+{
+  return minkowski_sum_2(pgn2, pgn1,
+                         decomposition_strategy1, decomposition_strategy1,
+                         traits);
+}
+
+/*! Compute the Minkowski sum of two simple polygons by decomposing each
+ * polygon to convex sub-polygons and computing the union of the pairwise
+ * Minkowski sums of the sub-polygons.
+ * Note that as the input polygons may not be convex, their Minkowski sum may
+ * not be a simple polygon. The result is therefore represented as a polygon
+ * with holes.
+ * \param[in] pgn1 The first polygon.
+ * \param[in] pgn2 The second polygon.
+ * \param[in] decomposition_strategy A functor for decomposing polygons.
+ * \return The resulting polygon with holes, representing the sum.
+ */
+template <typename Kernel_, typename Container_, typename Decomposition_>
+Polygon_with_holes_2<Kernel_, Container_>
+minkowski_sum_by_decomposition_2(const Polygon_2<Kernel_, Container_>& pgn1,
+                                 const Polygon_2<Kernel_, Container_>& pgn2,
+                                 const Decomposition_& decomp)
+{
+  typename Minkowski_sum_by_decomposition_2<Decomposition_, Decomposition_,
+                                            Container_>::Traits_2 traits;
+  return minkowski_sum_by_decomposition_2(pgn1, pgn2, decomp, traits);
+}
+
+/*! Compute the Minkowski sum of two simple polygons by decomposing each
+ * polygon to convex sub-polygons and computing the union of the pairwise
+ * Minkowski sums of the sub-polygons.
+ * Note that as the input polygons may not be convex, their Minkowski sum may
+ * not be a simple polygon. The result is therefore represented as a polygon
+ * with holes.
+ * \param[in] pgn1 The first polygon.
+ * \param[in] pgn2 The second polygon.
+ * \param[in] decomposition A functor for decomposing polygons.
+ * \param[in] traits The traits.
+ * \return The resulting polygon with holes, representing the sum.
+ */
+template <typename Kernel_, typename Container_, typename Decomposition_>
+Polygon_with_holes_2<Kernel_, Container_>
+minkowski_sum_by_decomposition_2
+(const Polygon_2<Kernel_, Container_>& pgn1,
+ const Polygon_2<Kernel_, Container_>& pgn2,
+ const Decomposition_& decomp,
+ const Gps_segment_traits_2<Kernel_, Container_>& traits)
+{
+  typedef Kernel_                               Kernel;
+  typedef Container_                            Container;
+  typedef Decomposition_                        Decomposition;
+  typedef Polygon_nop_decomposition_2<Kernel>   Nop_decomposition;
+
+  if (pgn1.is_convex()) {
+    Nop_decomposition decomp_nop;
+    if (pgn2.is_convex()) {
+      Minkowski_sum_by_decomposition_2<Nop_decomposition, Nop_decomposition,
+                                       Container>
+        mink_sum(decomp_nop, decomp_nop, traits);
+      return mink_sum(pgn1, pgn2);
+    }
+    Minkowski_sum_by_decomposition_2<Nop_decomposition, Decomposition,
+                                     Container>
+      mink_sum(decomp_nop, decomp, traits);
+    return mink_sum(pgn1, pgn2);
+  }
+
+  if (pgn2.is_convex()) {
+    Nop_decomposition decomp_nop;
+    Minkowski_sum_by_decomposition_2<Decomposition, Nop_decomposition,
+                                     Container>
+      mink_sum(decomp, decomp_nop, traits);
+    return mink_sum(pgn1, pgn2);
+  }
+
+  Minkowski_sum_by_decomposition_2<Decomposition, Decomposition, Container>
+    mink_sum(decomp, decomp, traits);
+  return mink_sum(pgn1, pgn2);
+}
+
+/*! Compute the Minkowski sum of two polygon with holes by decomposing each
+ * polygon to convex sub-polygons and computing the union of the pairwise
+ * Minkowski sums of the sub-polygons.
+ * The result is also represented as a polygon with holes.
+ * \param[in] pgn1 The first polygon.
+ * \param[in] pgn2 The second polygon.
+ * \param[in] decomposition A functor for decomposing polygons.
+ * \return The resulting polygon with holes, representing the sum.
+ */
+template <typename Kernel_, typename Container_,
+          typename NoHolesDecomposition_, typename WithHolesDecomposition_>
+Polygon_with_holes_2<Kernel_, Container_>
+minkowski_sum_by_decomposition_2
+(const Polygon_with_holes_2<Kernel_, Container_>& pgn1,
+ const Polygon_with_holes_2<Kernel_, Container_>& pgn2,
+ const NoHolesDecomposition_& decomp_no_holes,
+ const WithHolesDecomposition_& decomp_with_holes)
+{
+  typename Minkowski_sum_by_decomposition_2<NoHolesDecomposition_,
+                                            WithHolesDecomposition_,
+                                            Container_>::Traits_2 traits;
+  return minkowski_sum_by_decomposition_2(pgn1, pgn2,
+                                          decomp_no_holes, decomp_with_holes,
+                                          traits);
+}
+
+/*! Compute the Minkowski sum of two polygon with holes by decomposing each
+ * polygon to convex sub-polygons and computing the union of the pairwise
+ * Minkowski sums of the sub-polygons.
+ * The result is also represented as a polygon with holes.
+ * \param[in] pgn1 The first polygon.
+ * \param[in] pgn2 The second polygon.
+ * \param[in] decomposition A functor for decomposing polygons.
+ * \param[in] traits The traits.
+ * \return The resulting polygon with holes, representing the sum.
+ */
+template <typename Kernel_, typename Container_,
+          typename NoHolesDecomposition_, typename WithHolesDecomposition_>
+Polygon_with_holes_2<Kernel_, Container_>
+minkowski_sum_by_decomposition_2
+(const Polygon_with_holes_2<Kernel_, Container_>& pgn1,
+ const Polygon_with_holes_2<Kernel_, Container_>& pgn2,
+ const NoHolesDecomposition_& decomp_no_holes,
+ const WithHolesDecomposition_& decomp_with_holes,
+ const Gps_segment_traits_2<Kernel_, Container_>& traits)
+{
+  typedef Kernel_                               Kernel;
+  typedef Container_                            Container;
+  typedef NoHolesDecomposition_                 No_holes_decomposition;
+  typedef WithHolesDecomposition_               With_holes_decomposition;
+  typedef Polygon_nop_decomposition_2<Kernel>   Nop_decomposition;
+
+  Hole_filter_2<Kernel, Container> hole_filter;
+  Polygon_with_holes_2<Kernel, Container> filtered_pgn1;
+  Polygon_with_holes_2<Kernel, Container> filtered_pgn2;
+  hole_filter(pgn1, pgn2, filtered_pgn1);
+  hole_filter(pgn2, pgn1, filtered_pgn2);
+
+  if (0 == filtered_pgn1.number_of_holes()) {
+    const Polygon_2<Kernel, Container>& pnh1 = filtered_pgn1.outer_boundary();
+    if (pnh1.is_convex()) {
+      // pnh1 is convex
+      Nop_decomposition decomp_nop;
+      if (0 == filtered_pgn2.number_of_holes()) {
+        const Polygon_2<Kernel, Container>& pnh2 =
+          filtered_pgn2.outer_boundary();
+        if (pnh2.is_convex()) {
+          // pnh2 is convex
+          Minkowski_sum_by_decomposition_2<Nop_decomposition, Nop_decomposition,
+                                           Container>
+            mink_sum(decomp_nop, decomp_nop, traits);
+          return mink_sum(pnh1, pnh2);
+        }
+        // pnh2 is concave
+        Minkowski_sum_by_decomposition_2<Nop_decomposition,
+                                         No_holes_decomposition,
+                                         Container>
+          mink_sum(decomp_nop, decomp_no_holes, traits);
+        return mink_sum(pnh1, pnh2);
+      }
+      // pnh2 has holes
+      Minkowski_sum_by_decomposition_2<Nop_decomposition,
+                                       With_holes_decomposition,
+                                       Container>
+        mink_sum(decomp_nop, decomp_with_holes, traits);
+      return mink_sum(pnh1, filtered_pgn2);
+    }
+    // pnh1 is concave
+    if (0 == filtered_pgn2.number_of_holes()) {
+      const Polygon_2<Kernel, Container>& pnh2 =
+        filtered_pgn2.outer_boundary();
+      if (pnh2.is_convex()) {
+        // pnh2 is convex
+        Nop_decomposition decomp_nop;
+        Minkowski_sum_by_decomposition_2<No_holes_decomposition,
+                                         Nop_decomposition,
+                                         Container>
+          mink_sum(decomp_no_holes, decomp_nop, traits);
+        return mink_sum(pnh1, pnh2);
+      }
+      // pnh2 is concave
+      Minkowski_sum_by_decomposition_2<No_holes_decomposition,
+                                       No_holes_decomposition,
+                                       Container>
+        mink_sum(decomp_no_holes, decomp_no_holes, traits);
+      return mink_sum(pnh1, pnh2);
+    }
+    // pnh2 has holes
+    Minkowski_sum_by_decomposition_2<No_holes_decomposition,
+                                     With_holes_decomposition,
+                                     Container>
+      mink_sum(decomp_no_holes, decomp_with_holes, traits);
+    return mink_sum(pnh1, filtered_pgn2);
+  }
+
+  // filtered_pgn1 has holes
+  if (0 == filtered_pgn2.number_of_holes()) {
+    const Polygon_2<Kernel, Container>& pnh2 =
+      filtered_pgn2.outer_boundary();
+    if (pnh2.is_convex()) {
+      // pnh2 is convex
+      Nop_decomposition decomp_nop;
+      Minkowski_sum_by_decomposition_2<Nop_decomposition,
+                                       With_holes_decomposition,
+                                       Container>
+        mink_sum(decomp_nop, decomp_with_holes, traits);
+      return mink_sum(pnh2, filtered_pgn1);
+    }
+    // pnh2 is concave
+    Minkowski_sum_by_decomposition_2<No_holes_decomposition,
+                                     With_holes_decomposition,
+                                     Container>
+      mink_sum(decomp_no_holes, decomp_with_holes, traits);
+    return mink_sum(pnh2, filtered_pgn1);
+  }
+  // pnh2 has holes
+  Minkowski_sum_by_decomposition_2<With_holes_decomposition,
+                                   With_holes_decomposition,
+                                   Container>
+    mink_sum(decomp_with_holes, decomp_with_holes, traits);
+  return mink_sum(filtered_pgn1, filtered_pgn2);
+}
+
+/*! Compute the Minkowski sum of a simple polygon and a polygon with holes
+ * by decomposing each polygon to convex sub-polygons and computing the union
+ * of the pairwise Minkowski sums of the sub-polygons.  The result is also
+ * represented as a polygon with holes.
+ * \param[in] pgn1 The first polygon.
+ * \param[in] pgn2 The second polygon.
+ * \param[in] decomposition A functor for decomposing polygons.
+ * \return The resulting polygon with holes, representing the sum.
+ */
+template <typename Kernel_, typename Container_,
+          typename NoHolesDecomposition_, typename WithHolesDecomposition_>
+Polygon_with_holes_2<Kernel_, Container_>
+minkowski_sum_by_decomposition_2
+(const Polygon_2<Kernel_, Container_>& pgn1,
+ const Polygon_with_holes_2<Kernel_, Container_>& pgn2,
+ const NoHolesDecomposition_& decomp_no_holes,
+ const WithHolesDecomposition_& decomp_with_holes)
+{
+  typename Minkowski_sum_by_decomposition_2<NoHolesDecomposition_,
+                                            WithHolesDecomposition_,
+                                            Container_>::Traits_2 traits;
+  return minkowski_sum_by_decomposition_2(pgn1, pgn2,
+                                          decomp_no_holes, decomp_with_holes,
+                                          traits);
+}
+
+/*! Compute the Minkowski sum of a simple polygon and a polygon with holes
+ * by decomposing each polygon to convex sub-polygons and computing the union
+ * of the pairwise Minkowski sums of the sub-polygons.  The result is also
+ * represented as a polygon with holes.
+ * \param[in] pgn1 The simple polygon.
+ * \param[in] pgn2 The polygon with holes.
+ * \param[in] decomposition A functor for decomposing polygons.
+ * \param[in] traits The traits.
+ * \return The resulting polygon with holes, representing the sum.
+ */
+template <typename Kernel_, typename Container_,
+          typename NoHolesDecomposition_, typename WithHolesDecomposition_>
+Polygon_with_holes_2<Kernel_, Container_>
+minkowski_sum_by_decomposition_2
+(const Polygon_2<Kernel_, Container_>& pgn1,
+ const Polygon_with_holes_2<Kernel_, Container_>& pgn2,
+ const NoHolesDecomposition_& decomp_no_holes,
+ const WithHolesDecomposition_& decomp_with_holes,
+ const Gps_segment_traits_2<Kernel_, Container_>& traits)
+{
+  typedef Kernel_                               Kernel;
+  typedef Container_                            Container;
+  typedef NoHolesDecomposition_                 No_holes_decomposition;
+  typedef WithHolesDecomposition_               With_holes_decomposition;
+  typedef Polygon_nop_decomposition_2<Kernel>   Nop_decomposition;
+
+  Hole_filter_2<Kernel, Container> hole_filter;
+  Polygon_with_holes_2<Kernel,Container> filtered_pgn2;
+  hole_filter(pgn2, pgn1, filtered_pgn2);
+
+  if (pgn1.is_convex()) {
+    Nop_decomposition decomp_nop;
+    if (0 == filtered_pgn2.number_of_holes()) {
+      const Polygon_2<Kernel, Container>& pnh2 = filtered_pgn2.outer_boundary();
+      if (pnh2.is_convex()) {
+        Minkowski_sum_by_decomposition_2<Nop_decomposition, Nop_decomposition,
+                                         Container>
+          mink_sum(decomp_nop, decomp_nop, traits);
+        return mink_sum(pgn1, pnh2);
+      }
+      // pnh2 is concave
+      Minkowski_sum_by_decomposition_2<Nop_decomposition,
+                                       No_holes_decomposition,
+                                       Container>
+        mink_sum(decomp_nop, decomp_no_holes, traits);
+      return mink_sum(pgn1, pnh2);
+    }
+    // pnh2 has holes
+    Minkowski_sum_by_decomposition_2<Nop_decomposition,
+                                     With_holes_decomposition,
+                                     Container>
+      mink_sum(decomp_nop, decomp_with_holes, traits);
+    return mink_sum(pgn1, filtered_pgn2);
+  }
+  // pgn1 is concave
+  if (0 == filtered_pgn2.number_of_holes()) {
+    const Polygon_2<Kernel, Container>& pnh2 = filtered_pgn2.outer_boundary();
+    if (pnh2.is_convex()) {
+      // pnh2 is convex
+      Nop_decomposition decomp_nop;
+      Minkowski_sum_by_decomposition_2<No_holes_decomposition,
+                                       Nop_decomposition,
+                                       Container>
+        mink_sum(decomp_no_holes, decomp_nop, traits);
+      return mink_sum(pgn1, pnh2);
+    }
+    // pnh2 is concave
+    Minkowski_sum_by_decomposition_2<No_holes_decomposition,
+                                     No_holes_decomposition,
+                                     Container>
+      mink_sum(decomp_no_holes, decomp_no_holes, traits);
+    return mink_sum(pgn1, pnh2);
+  }
+  // pnh2 has holes
+  Minkowski_sum_by_decomposition_2<No_holes_decomposition,
+                                   With_holes_decomposition,
+                                   Container>
+    mink_sum(decomp_no_holes, decomp_with_holes, traits);
+  return mink_sum(pgn1, filtered_pgn2);
+}
+
+/*! Compute the Minkowski sum of a simple polygon and a polygon with holes
+ * by decomposing each polygon to convex sub-polygons and computing the union
+ * of the pairwise Minkowski sums of the sub-polygons.  The result is also
+ * represented as a polygon with holes.
+ * \param[in] pgn1 The second polygon.
+ * \param[in] pgn2 The first polygon.
+ * \param[in] decomposition A functor for decomposing polygons.
+ * \return The resulting polygon with holes, representing the sum.
+ */
+template <typename Kernel_, typename Container_,
+          typename NoHolesDecomposition_, typename WithHolesDecomposition_>
+Polygon_with_holes_2<Kernel_, Container_>
+minkowski_sum_by_decomposition_2
+(const Polygon_with_holes_2<Kernel_, Container_>& pgn1,
+ const Polygon_2<Kernel_, Container_>& pgn2,
+ const NoHolesDecomposition_& decomp_no_holes,
+ const WithHolesDecomposition_& decomp_with_holes)
+{
+  typename Minkowski_sum_by_decomposition_2<NoHolesDecomposition_,
+                                            WithHolesDecomposition_,
+                                            Container_>::Traits_2 traits;
+  return minkowski_sum_by_decomposition_2(pgn1, pgn2,
+                                          decomp_no_holes, decomp_with_holes,
+                                          traits);
+}
+
+/*! Compute the Minkowski sum of a simple polygon and a polygon with holes
+ * by decomposing each polygon to convex sub-polygons and computing the union
+ * of the pairwise Minkowski sums of the sub-polygons.  The result is also
+ * represented as a polygon with holes.
+ * \param[in] pgn1 The polygon with holes.
+ * \param[in] pgn2 The simple polygon.
+ * \param[in] decomposition A functor for decomposing polygons.
+ * \param[in] traits The traits.
+ * \return The resulting polygon with holes, representing the sum.
+ */
+template <typename Kernel_, typename Container_,
+          typename NoHoleDecomposition_, typename WithHolesDecomposition_>
+Polygon_with_holes_2<Kernel_, Container_>
+minkowski_sum_by_decomposition_2
+(const Polygon_with_holes_2<Kernel_, Container_>& pgn1,
+ const Polygon_2<Kernel_, Container_>& pgn2,
+ const NoHoleDecomposition_& decomp_no_holes,
+ const WithHolesDecomposition_& decomp_with_holes,
+ const Gps_segment_traits_2<Kernel_, Container_>& traits)
+{
+  return minkowski_sum_by_decomposition_2(pgn2, pgn1,
+                                          decomp_no_holes, decomp_with_holes,
+                                          traits);
+}
+
+/*!@}*/
+
+} //namespace CGAL
+
+#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/minkowski_sum_3.h b/3rdparty/CGAL/include/CGAL/minkowski_sum_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/minkowski_sum_3.h
rename to 3rdparty/CGAL/include/CGAL/minkowski_sum_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/monotone_matrix_search.h b/3rdparty/CGAL/include/CGAL/monotone_matrix_search.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/monotone_matrix_search.h
rename to 3rdparty/CGAL/include/CGAL/monotone_matrix_search.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/more_functions_on_signs.h b/3rdparty/CGAL/include/CGAL/more_functions_on_signs.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/more_functions_on_signs.h
rename to 3rdparty/CGAL/include/CGAL/more_functions_on_signs.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/mpfi_coercion_traits.h b/3rdparty/CGAL/include/CGAL/mpfi_coercion_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/mpfi_coercion_traits.h
rename to 3rdparty/CGAL/include/CGAL/mpfi_coercion_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/mpfr_coercion_traits.h b/3rdparty/CGAL/include/CGAL/mpfr_coercion_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/mpfr_coercion_traits.h
rename to 3rdparty/CGAL/include/CGAL/mpfr_coercion_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/mpq_class.h b/3rdparty/CGAL/include/CGAL/mpq_class.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/mpq_class.h
rename to 3rdparty/CGAL/include/CGAL/mpq_class.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/mpz_class.h b/3rdparty/CGAL/include/CGAL/mpz_class.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/mpz_class.h
rename to 3rdparty/CGAL/include/CGAL/mpz_class.h
diff --git a/3rdparty/CGAL/include/CGAL/mst_orient_normals.h b/3rdparty/CGAL/include/CGAL/mst_orient_normals.h
new file mode 100644
index 0000000..2aad9b1
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/mst_orient_normals.h
@@ -0,0 +1,672 @@
+// Copyright (c) 2007-09  INRIA Sophia-Antipolis (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
+// 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(s) : Laurent Saboret and Andreas Fabri
+
+#ifndef CGAL_MST_ORIENT_NORMALS_H
+#define CGAL_MST_ORIENT_NORMALS_H
+
+#include <CGAL/trace.h>
+#include <CGAL/Search_traits_3.h>
+#include <CGAL/Orthogonal_k_neighbor_search.h>
+#include <CGAL/Search_traits_vertex_handle_3.h>
+#include <CGAL/property_map.h>
+#include <CGAL/Index_property_map.h>
+#include <CGAL/Memory_sizer.h>
+#include <CGAL/point_set_processing_assertions.h>
+#include <CGAL/use.h>
+
+#include <iterator>
+#include <list>
+#include <climits>
+#include <math.h>
+
+#include <CGAL/property_map.h>
+#include <boost/graph/adjacency_list.hpp>
+#include <CGAL/boost/graph/dijkstra_shortest_paths.h> // work around a bug in boost 1.54
+#include <boost/graph/prim_minimum_spanning_tree.hpp>
+
+namespace CGAL {
+
+
+// ----------------------------------------------------------------------------
+// Private section
+// ----------------------------------------------------------------------------
+/// \cond SKIP_IN_MANUAL
+namespace internal {
+
+/// Generalization of std::distance() to compute the distance between 2 integers
+inline std::size_t
+distance(std::size_t _First, std::size_t _Last)
+{
+  // return int difference
+  return _Last - _First;
+}
+
+// Bring std::distance() to scope
+using std::distance;
+
+
+/// Helper class: Riemannian graph.
+///
+/// This class is used internally by mst_orient_normals()
+/// to encode:
+/// - the adjacency relations of vertices in a K-neighboring.
+/// - vertices contain the corresponding input point iterator.
+/// - the edge weight = edge weight = 1 - | normal1 * normal2 |
+///   where normal1 and normal2 are the normal at the edge extremities.
+
+template <typename ForwardIterator> ///< Input point iterator
+struct Riemannian_graph_vertex_properties {
+    ForwardIterator input_point; ///< Input point
+};
+template <typename ForwardIterator> ///< Input point iterator
+class Riemannian_graph
+  : public boost::adjacency_list< boost::vecS, boost::vecS,
+                                  boost::undirectedS,
+                                  Riemannian_graph_vertex_properties<ForwardIterator>,
+                                  boost::property<boost::edge_weight_t, float> >
+{
+};
+
+
+/// Helper class: MST graph
+///
+/// This class is used internally by mst_orient_normals()
+/// to encode:
+/// - the adjacency relations of vertices in a Minimum Spanning Tree.
+/// - vertices contain the corresponding input point iterator
+//    and a boolean indicating if the normal is oriented.
+
+template <typename ForwardIterator> ///< Input point iterator
+struct MST_graph_vertex_properties {
+    ForwardIterator input_point; ///< Input point
+    bool is_oriented; ///< Is input point's normal oriented?
+};
+template <typename ForwardIterator, ///< Input point iterator
+          typename NormalPMap, ///< property map: value_type of ForwardIterator -> Normal
+          typename Kernel ///< Geometric traits class
+>
+class MST_graph
+  : public boost::adjacency_list< boost::vecS, boost::vecS,
+                                  boost::directedS,
+                                  MST_graph_vertex_properties<ForwardIterator> >
+{
+public:
+    MST_graph(NormalPMap normal_pmap) : m_normal_pmap(normal_pmap) {}
+
+// Public data
+    const NormalPMap m_normal_pmap;
+};
+
+
+/// Helper class: Propagate_normal_orientation
+///
+/// This class is used internally by mst_orient_normals()
+/// to propage the normal orientation, starting from a source point
+/// and following the adjacency relations of vertices in a Minimum Spanning Tree.
+/// It does not orient normals that are already oriented.
+/// It does not propagate the orientation if the angle between 2 normals > angle_max.
+///
+/// \pre Normals must be unit vectors
+/// \pre `0 < angle_max <= PI/2`
+///
+/// @tparam ForwardIterator iterator over input points.
+/// @tparam NormalPMap is a model of `ReadWritePropertyMap`.
+/// @tparam Kernel Geometric traits class.
+
+template <typename ForwardIterator, ///< Input point iterator
+          typename NormalPMap, ///< property map: value_type of ForwardIterator -> Normal
+          typename Kernel
+>
+struct Propagate_normal_orientation
+  : public boost::base_visitor< Propagate_normal_orientation<ForwardIterator, NormalPMap, Kernel> >
+{
+    typedef internal::MST_graph<ForwardIterator, NormalPMap, Kernel> MST_graph;
+    typedef boost::on_examine_edge event_filter;
+
+    Propagate_normal_orientation(double angle_max = CGAL_PI/2.) ///< max angle to propagate the normal orientation (radians)
+    : m_angle_max(angle_max)
+    {
+        // Precondition: 0 < angle_max <= PI/2
+        CGAL_point_set_processing_precondition(0 < angle_max && angle_max <= CGAL_PI/2.);
+    }
+
+    template <class Edge>
+    void operator()(Edge& edge, const MST_graph& mst_graph)
+    {
+        typedef typename boost::property_traits<NormalPMap>::reference Vector_ref;
+        typedef typename MST_graph::vertex_descriptor vertex_descriptor;
+
+        // Gets source normal
+        vertex_descriptor source_vertex = source(edge, mst_graph);
+        Vector_ref source_normal = get(mst_graph.m_normal_pmap, *(mst_graph[source_vertex].input_point) );
+        const bool source_normal_is_oriented = mst_graph[source_vertex].is_oriented;
+        // Gets target normal
+        vertex_descriptor target_vertex = target(edge, mst_graph);
+        Vector_ref target_normal = get( mst_graph.m_normal_pmap, *(mst_graph[target_vertex].input_point) );
+        bool& target_normal_is_oriented = ((MST_graph&)mst_graph)[target_vertex].is_oriented;
+        if ( ! target_normal_is_oriented )
+        {
+          //             ->                        ->
+          // Orients target_normal parallel to source_normal
+          double normals_dot = source_normal * target_normal;
+          if (normals_dot < 0)
+          {
+            put( mst_graph.m_normal_pmap, *(mst_graph[target_vertex].input_point), -target_normal );
+          }
+
+          // Is orientation robust?
+          target_normal_is_oriented
+            = source_normal_is_oriented &&
+              (std::abs(normals_dot) >= std::cos(m_angle_max)); // oriented iff angle <= m_angle_max
+        }
+    }
+
+// Data
+// Implementation note: boost::breadth_first_search() makes copies of this object => data must be constant or shared.
+private:
+    const double m_angle_max; ///< max angle to propagate the normal orientation (radians).
+};
+
+/// Orients the normal of the point with maximum Z towards +Z axis.
+///
+/// @tparam ForwardIterator iterator over input points.
+/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3<Kernel>.
+/// @tparam NormalPMap is a model of `ReadWritePropertyMap` with a value_type = Vector_3<Kernel>.
+/// @tparam Kernel Geometric traits class.
+///
+/// @return iterator over the top point.
+template <typename ForwardIterator,
+          typename PointPMap,
+          typename NormalPMap,
+          typename Kernel
+>
+ForwardIterator
+mst_find_source(
+    ForwardIterator first,   ///< iterator over the first input point.
+    ForwardIterator beyond,  ///< past-the-end iterator over the input points.
+    PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3
+    NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3
+    const Kernel& /*kernel*/)    ///< geometric traits.
+{
+    CGAL_TRACE("  mst_find_source()\n");
+
+    // Input points types
+    typedef typename boost::property_traits<NormalPMap>::value_type Vector;
+    typedef typename boost::property_traits<NormalPMap>::reference Vector_ref;
+
+    // Precondition: at least one element in the container
+    CGAL_point_set_processing_precondition(first != beyond);
+
+    // Find top point
+    ForwardIterator top_point = first;
+    for (ForwardIterator v = ++first; v != beyond; v++)
+    {
+      
+      double top_z = get(point_pmap,*top_point).z(); // top_point's Z coordinate
+      double z = get(point_pmap,*v).z();
+      
+      if (top_z < z)
+        top_point = v;
+    }
+
+    // Orients its normal towards +Z axis
+    Vector_ref normal = get(normal_pmap,*top_point);
+    const Vector Z(0, 0, 1);
+    if (Z * normal < 0) {
+      CGAL_TRACE("  Flip top point normal\n");
+    put(normal_pmap,*top_point, -normal);
+    }
+
+    return top_point;
+}
+
+/// Iterates over input points and creates Riemannian Graph:
+/// - vertices are numbered like the input points index.
+/// - vertices contain the corresponding input point iterator.
+/// - we add the edge (i, j) if either vertex i is in the k-neighborhood of vertex j,
+///   or vertex j is in the k-neighborhood of vertex i.
+///
+/// \pre Normals must be unit vectors.
+/// \pre `k >= 2`
+///
+/// @tparam ForwardIterator iterator over input points.
+/// @tparam IndexPMap is a model of `ReadablePropertyMap` with an integral value_type.
+/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3<Kernel>.
+/// @tparam NormalPMap is a model of `ReadWritePropertyMap` with a value_type = Vector_3<Kernel>.
+/// @tparam Kernel Geometric traits class.
+///
+/// @return the Riemannian graph
+template <typename ForwardIterator,
+          typename PointPMap,
+          typename NormalPMap,
+          typename IndexPMap,
+          typename Kernel
+>
+Riemannian_graph<ForwardIterator>
+create_riemannian_graph(
+    ForwardIterator first,  ///< iterator over the first input point.
+    ForwardIterator beyond, ///< past-the-end iterator over the input points.
+    PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3
+    NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3
+    IndexPMap index_pmap, ///< property map ForwardIterator -> index
+    unsigned int k, ///< number of neighbors
+    const Kernel& /*kernel*/) ///< geometric traits.
+{
+    // Input points types
+    typedef typename boost::property_traits<PointPMap>::reference Point_ref;
+    typedef typename boost::property_traits<NormalPMap>::reference Vector_ref;
+
+    // Types for K nearest neighbors search structure
+    typedef Point_vertex_handle_3<ForwardIterator> Point_vertex_handle_3;
+    typedef Search_traits_vertex_handle_3<ForwardIterator> Traits;
+    typedef Euclidean_distance_vertex_handle_3<ForwardIterator> KDistance;
+    typedef Orthogonal_k_neighbor_search<Traits,KDistance> Neighbor_search;
+    typedef typename Neighbor_search::Tree Tree;
+    typedef typename Neighbor_search::iterator Search_iterator;
+
+    // Riemannian_graph types
+    typedef internal::Riemannian_graph<ForwardIterator> Riemannian_graph;
+    typedef typename boost::property_map<Riemannian_graph, boost::edge_weight_t>::type Riemannian_graph_weight_map;
+
+    // Precondition: at least one element in the container.
+    CGAL_point_set_processing_precondition(first != beyond);
+
+    // Precondition: at least 2 nearest neighbors
+    CGAL_point_set_processing_precondition(k >= 2);
+
+    // Number of input points
+    const std::size_t num_input_points = distance(first, beyond);
+
+    std::size_t memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE("  %ld Mb allocated\n", memory>>20);
+    CGAL_TRACE("  Creates KD-tree\n");
+
+    // Instanciate a KD-tree search.
+    // Notes: We have to wrap each input point by a Point_vertex_handle_3.
+    //        The KD-tree is allocated dynamically to recover RAM as soon as possible.
+    std::vector<Point_vertex_handle_3> kd_tree_points; kd_tree_points.reserve(num_input_points);
+    for (ForwardIterator it = first; it != beyond; it++)
+    {
+        
+        Point_ref point = get(point_pmap, *it);
+        Point_vertex_handle_3 point_wrapper(point.x(), point.y(), point.z(), it);
+        kd_tree_points.push_back(point_wrapper);
+    }
+    boost::shared_ptr<Tree> tree( new Tree(kd_tree_points.begin(), kd_tree_points.end()) );
+
+    // Recover RAM
+    kd_tree_points.clear();
+
+    memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE("  %ld Mb allocated\n", memory>>20);
+    CGAL_TRACE("  Creates Riemannian Graph\n");
+
+    // Iterates over input points and creates Riemannian Graph:
+    // - vertices are numbered like the input points index.
+    // - vertices contain the corresponding input point iterator.
+    // - we add the edge (i, j) if either vertex i is in the k-neighborhood of vertex j,
+    //   or vertex j is in the k-neighborhood of vertex i.
+    Riemannian_graph riemannian_graph;
+    //
+    // add vertices
+    for (ForwardIterator it = first; it != beyond; it++)
+    {
+        typename Riemannian_graph::vertex_descriptor v = add_vertex(riemannian_graph);
+        CGAL_point_set_processing_assertion(v == get(index_pmap,it));
+        riemannian_graph[v].input_point = it;
+    }
+    //
+    // add edges
+    Riemannian_graph_weight_map riemannian_graph_weight_map = get(boost::edge_weight, riemannian_graph);
+    for (ForwardIterator it = first; it != beyond; it++)
+    {
+        std::size_t it_index = get(index_pmap,it);
+        Vector_ref it_normal_vector = get(normal_pmap,*it);
+        
+        // Gather set of (k+1) neighboring points.
+        // Perform k+1 queries (as in point set, the query point is
+        // output first). Search may be aborted if k is greater
+        // than number of input points.
+        
+        Point_ref point = get(point_pmap, *it);
+        Point_vertex_handle_3 point_wrapper(point.x(), point.y(), point.z(), it);
+        Neighbor_search search(*tree, point_wrapper, k+1);
+        Search_iterator search_iterator = search.begin();
+        for(std::size_t i=0;i<(k+1);i++)
+        {
+            if(search_iterator == search.end())
+                break; // premature ending
+
+            ForwardIterator neighbor = search_iterator->first;
+            std::size_t neighbor_index = get(index_pmap,neighbor);
+            if (neighbor_index > it_index) // undirected graph
+            {
+                // Add edge
+                typename boost::graph_traits<Riemannian_graph>::edge_descriptor e;
+                bool inserted;
+                boost::tie(e, inserted) = add_edge(vertex(it_index, riemannian_graph),
+                                                   vertex(neighbor_index, riemannian_graph),
+                                                   riemannian_graph);
+                CGAL_point_set_processing_assertion(inserted);
+
+                //                               ->        ->
+                // Computes edge weight = 1 - | normal1 * normal2 |
+                // where normal1 and normal2 are the normal at the edge extremities.
+                
+                Vector_ref neighbor_normal_vector = get(normal_pmap,*neighbor);
+                double weight = 1.0 - std::abs(it_normal_vector * neighbor_normal_vector);
+                if (weight < 0)
+                    weight = 0; // safety check
+                riemannian_graph_weight_map[e] = (float)weight;
+            }
+
+            search_iterator++;
+        }
+    }
+
+    return riemannian_graph;
+}
+
+/// Computes Minimum Spanning Tree and store it in a Boost graph:
+/// - vertices are numbered like the input points index.
+/// - vertices contain the corresponding input point iterator.
+/// - we add the edge (predecessor[i], i) for each element of the MST.
+///
+/// \pre Normals must be unit vectors.
+///
+/// @tparam ForwardIterator iterator over input points.
+/// @tparam IndexPMap is a model of `ReadablePropertyMap` with an integral value_type.
+/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3<Kernel>.
+/// @tparam NormalPMap is a model of `ReadWritePropertyMap` with a value_type = Vector_3<Kernel>.
+/// @tparam Kernel Geometric traits class.
+///
+/// @return the MST graph.
+template <typename ForwardIterator,
+          typename PointPMap,
+          typename NormalPMap,
+          typename IndexPMap,
+          typename Kernel
+>
+MST_graph<ForwardIterator, NormalPMap, Kernel>
+create_mst_graph(
+    ForwardIterator first,  ///< iterator over the first input point.
+    ForwardIterator beyond, ///< past-the-end iterator over the input points.
+    PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3
+    NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3
+    IndexPMap index_pmap, ///< property map ForwardIterator -> index
+    unsigned int k, ///< number of neighbors
+    const Kernel& kernel, ///< geometric traits.
+    const Riemannian_graph<ForwardIterator>& riemannian_graph, ///< graph connecting each vertex to its knn
+    ForwardIterator source_point) ///< source point (with an oriented normal)
+{
+    // prevents warnings
+    CGAL_USE(point_pmap);
+    CGAL_USE(k);
+    CGAL_USE(kernel);
+
+    // Bring private stuff to scope
+    using namespace internal;
+
+    // Riemannian_graph types
+    typedef internal::Riemannian_graph<ForwardIterator> Riemannian_graph;
+    typedef typename boost::property_map<Riemannian_graph, boost::edge_weight_t>::const_type Riemannian_graph_weight_map;
+
+    // MST_graph types
+    typedef internal::MST_graph<ForwardIterator, NormalPMap, Kernel> MST_graph;
+
+    // Precondition: at least one element in the container.
+    CGAL_point_set_processing_precondition(first != beyond);
+
+    // Number of input points
+    const std::size_t num_input_points = num_vertices(riemannian_graph);
+
+    std::size_t memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE("  %ld Mb allocated\n", memory>>20);
+    CGAL_TRACE("  Calls boost::prim_minimum_spanning_tree()\n");
+
+    // Computes Minimum Spanning Tree.
+    std::size_t source_point_index = get(index_pmap, source_point);
+    Riemannian_graph_weight_map riemannian_graph_weight_map = get(boost::edge_weight, riemannian_graph);
+    typedef std::vector<typename Riemannian_graph::vertex_descriptor> PredecessorMap;
+    PredecessorMap predecessor(num_input_points);
+    boost::prim_minimum_spanning_tree(riemannian_graph, &predecessor[0],
+                                      weight_map( riemannian_graph_weight_map )
+                                     .root_vertex( vertex(source_point_index, riemannian_graph) ));
+
+    memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE("  %ld Mb allocated\n", memory>>20);
+    CGAL_TRACE("  Creates MST Graph\n");
+
+    // Converts predecessor map to a MST graph:
+    // - vertices are numbered like the input points index.
+    // - vertices contain the corresponding input point iterator.
+    // - we add the edge (predecessor[i], i) for each element of the predecessor map.
+    MST_graph mst_graph(normal_pmap);
+    //
+    // Add vertices. source_point is the unique point marked "oriented".
+    for (ForwardIterator it = first; it != beyond; it++)
+    {
+        // With C++11, the following line triggers a bug in Boost versions
+        // 1.56 and 1.57:
+        //   https://svn.boost.org/trac/boost/ticket/10382
+        typename MST_graph::vertex_descriptor v = add_vertex(mst_graph);
+        CGAL_point_set_processing_assertion(v == get(index_pmap,it));
+        mst_graph[v].input_point = it;
+        mst_graph[v].is_oriented = (it == source_point);
+    }
+    // add edges
+    for (std::size_t i=0; i < predecessor.size(); i++) // add edges
+    {
+        if (i != predecessor[i])
+        {
+            // check that bi-directed graph is useless
+            CGAL_point_set_processing_assertion(predecessor[predecessor[i]] != i);
+
+            add_edge(vertex(predecessor[i], mst_graph),
+                     vertex(i,     mst_graph),
+                     mst_graph);
+        }
+    }
+
+    return mst_graph;
+}
+
+} /* namespace internal */
+/// \endcond
+
+// ----------------------------------------------------------------------------
+// Public section
+// ----------------------------------------------------------------------------
+
+/// \ingroup PkgPointSetProcessing
+/// Orients the normals of the `[first, beyond)` range of points using the propagation
+/// of a seed orientation through a minimum spanning tree of the Riemannian graph [Hoppe92].
+///
+/// This method modifies the order of input points so as to pack all sucessfully oriented points first,
+/// and returns an iterator over the first point with an unoriented normal (see erase-remove idiom).
+/// For this reason it should not be called on sorted containers.
+/// \warning This function may fail when Boost version 1.54 is used,
+/// because of the following bug: https://svn.boost.org/trac/boost/ticket/9012
+///
+/// \pre Normals must be unit vectors
+/// \pre `k >= 2`
+///
+/// @tparam ForwardIterator iterator over input points.
+/// @tparam PointPMap is a model of `ReadablePropertyMap` with value type  `Point_3<Kernel>`.
+///        It can be omitted if the value type of `ForwardIterator` is convertible to `Point_3<Kernel>`.
+/// @tparam NormalPMap is a model of `ReadWritePropertyMap` with value type `Vector_3<Kernel>` .
+/// @tparam Kernel Geometric traits class.
+///        It can be omitted and deduced automatically from the value type of `PointPMap`.
+///
+/// @return iterator over the first point with an unoriented normal.
+
+// This variant requires all parameters.
+template <typename ForwardIterator,
+          typename PointPMap,
+          typename NormalPMap,
+          typename Kernel
+>
+ForwardIterator
+mst_orient_normals(
+    ForwardIterator first,  ///< iterator over the first input point.
+    ForwardIterator beyond, ///< past-the-end iterator over the input points.
+    PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3.
+    NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3.
+    unsigned int k, ///< number of neighbors
+    const Kernel& kernel) ///< geometric traits.
+{
+    CGAL_TRACE("Calls mst_orient_normals()\n");
+
+    // Bring private stuff to scope
+    using namespace internal;
+
+    // Input points types
+    typedef typename std::iterator_traits<ForwardIterator>::value_type Enriched_point; // actual type of input points
+    // Property map ForwardIterator -> index
+    typedef Index_property_map<ForwardIterator> IndexPMap;
+
+    // Riemannian_graph types
+    typedef Riemannian_graph<ForwardIterator> Riemannian_graph;
+
+    // MST_graph types
+    typedef MST_graph<ForwardIterator, NormalPMap, Kernel> MST_graph;
+
+    // Precondition: at least one element in the container.
+    CGAL_point_set_processing_precondition(first != beyond);
+
+    // Precondition: at least 2 nearest neighbors
+    CGAL_point_set_processing_precondition(k >= 2);
+
+    std::size_t memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE("  %ld Mb allocated\n", memory>>20);
+    CGAL_TRACE("  Create Index_property_map\n");
+
+    // Create a property map Iterator -> index.
+    // - if ForwardIterator is a random access iterator (typically vector and deque),
+    // get() just calls std::distance() and is very efficient;
+    // - else, the property map allocates a std::map to store indices
+    // and get() requires a lookup in the map.
+    IndexPMap index_pmap(first, beyond);
+
+    // Orients the normal of the point with maximum Z towards +Z axis.
+    ForwardIterator source_point
+      = mst_find_source(first, beyond,
+                        point_pmap, normal_pmap,
+                        kernel);
+
+    // Iterates over input points and creates Riemannian Graph:
+    // - vertices are numbered like the input points index.
+    // - vertices are empty.
+    // - we add the edge (i, j) if either vertex i is in the k-neighborhood of vertex j,
+    //   or vertex j is in the k-neighborhood of vertex i.
+    Riemannian_graph riemannian_graph
+      = create_riemannian_graph(first, beyond,
+                                point_pmap, normal_pmap, index_pmap,
+                                k,
+                                kernel);
+
+    // Creates a Minimum Spanning Tree starting at source_point
+    MST_graph mst_graph = create_mst_graph(first, beyond,
+                                           point_pmap, normal_pmap, index_pmap,
+                                           k,
+                                           kernel,
+                                           riemannian_graph,
+                                           source_point);
+
+    memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE("  %ld Mb allocated\n", memory>>20);
+    CGAL_TRACE("  Calls boost::breadth_first_search()\n");
+
+    // Traverse the point set along the MST to propagate source_point's orientation
+    Propagate_normal_orientation<ForwardIterator, NormalPMap, Kernel> orienter;
+    std::size_t source_point_index = get(index_pmap, source_point);
+    boost::breadth_first_search(mst_graph,
+                                vertex(source_point_index, mst_graph), // source
+                                visitor(boost::make_bfs_visitor(orienter)));
+
+    // Copy points with robust normal orientation to oriented_points[], the others to unoriented_points[].
+    std::deque<Enriched_point> oriented_points, unoriented_points;
+    for (ForwardIterator it = first; it != beyond; it++)
+    {
+        std::size_t it_index = get(index_pmap,it);
+        typename MST_graph::vertex_descriptor v = vertex(it_index, mst_graph);
+        if (mst_graph[v].is_oriented)
+          oriented_points.push_back(*it);
+        else
+          unoriented_points.push_back(*it);
+    }
+
+    // Replaces [first, beyond) range by the content of oriented_points[], then unoriented_points[].
+    ForwardIterator first_unoriented_point =
+      std::copy(oriented_points.begin(), oriented_points.end(), first);
+    std::copy(unoriented_points.begin(), unoriented_points.end(), first_unoriented_point);
+
+    // At this stage, we have typically 0 unoriented normals if k is large enough
+    CGAL_TRACE("  => %u normals are unoriented\n", unoriented_points.size());
+
+    memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE("  %ld Mb allocated\n", memory>>20);
+    CGAL_TRACE("End of mst_orient_normals()\n");
+
+    return first_unoriented_point;
+}
+
+/// @cond SKIP_IN_MANUAL
+// This variant deduces the kernel from the point property map.
+template <typename ForwardIterator,
+          typename PointPMap,
+          typename NormalPMap
+>
+ForwardIterator
+mst_orient_normals(
+    ForwardIterator first,  ///< iterator over the first input point.
+    ForwardIterator beyond, ///< past-the-end iterator over the input points.
+    PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3.
+    NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3.
+    unsigned int k) ///< number of neighbors
+{
+    typedef typename boost::property_traits<PointPMap>::value_type Point;
+    typedef typename Kernel_traits<Point>::Kernel Kernel;
+    return mst_orient_normals(
+      first,beyond,
+      point_pmap,
+      normal_pmap,
+      k,
+      Kernel());
+}
+/// @endcond
+
+/// @cond SKIP_IN_MANUAL
+// This variant creates a default point property map = Identity_property_map.
+template <typename ForwardIterator,
+          typename NormalPMap
+>
+ForwardIterator
+mst_orient_normals(
+    ForwardIterator first,  ///< iterator over the first input point.
+    ForwardIterator beyond, ///< past-the-end iterator over the input points.
+    NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3.
+    unsigned int k) ///< number of neighbors
+{
+    return mst_orient_normals(
+      first,beyond,
+      make_identity_property_map(
+      typename std::iterator_traits<ForwardIterator>::value_type()),
+      normal_pmap,
+      k);
+}
+/// @endcond
+
+
+} //namespace CGAL
+
+#endif // CGAL_MST_ORIENT_NORMALS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/multiset_assertions.h b/3rdparty/CGAL/include/CGAL/multiset_assertions.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/multiset_assertions.h
rename to 3rdparty/CGAL/include/CGAL/multiset_assertions.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/mutex.h b/3rdparty/CGAL/include/CGAL/mutex.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/mutex.h
rename to 3rdparty/CGAL/include/CGAL/mutex.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/natural_neighbor_coordinates_2.h b/3rdparty/CGAL/include/CGAL/natural_neighbor_coordinates_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/natural_neighbor_coordinates_2.h
rename to 3rdparty/CGAL/include/CGAL/natural_neighbor_coordinates_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/natural_neighbor_coordinates_3.h b/3rdparty/CGAL/include/CGAL/natural_neighbor_coordinates_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/natural_neighbor_coordinates_3.h
rename to 3rdparty/CGAL/include/CGAL/natural_neighbor_coordinates_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/nearest_neighbor_delaunay_2.h b/3rdparty/CGAL/include/CGAL/nearest_neighbor_delaunay_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/nearest_neighbor_delaunay_2.h
rename to 3rdparty/CGAL/include/CGAL/nearest_neighbor_delaunay_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/normal_vector_newell_3.h b/3rdparty/CGAL/include/CGAL/normal_vector_newell_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/normal_vector_newell_3.h
rename to 3rdparty/CGAL/include/CGAL/normal_vector_newell_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/number_type_basic.h b/3rdparty/CGAL/include/CGAL/number_type_basic.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/number_type_basic.h
rename to 3rdparty/CGAL/include/CGAL/number_type_basic.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/number_type_config.h b/3rdparty/CGAL/include/CGAL/number_type_config.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/number_type_config.h
rename to 3rdparty/CGAL/include/CGAL/number_type_config.h
diff --git a/3rdparty/CGAL/include/CGAL/number_utils.h b/3rdparty/CGAL/include/CGAL/number_utils.h
new file mode 100644
index 0000000..c3af1c4
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/number_utils.h
@@ -0,0 +1,335 @@
+// Copyright (c) 1999  
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved. 
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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(s)     : Stefan Schirra
+
+#ifndef CGAL_NUMBER_UTILS_H
+#define CGAL_NUMBER_UTILS_H
+
+#include <CGAL/number_type_config.h>
+#include <CGAL/Algebraic_structure_traits.h>
+#include <CGAL/Real_embeddable_traits.h>
+
+namespace CGAL {
+CGAL_NTS_BEGIN_NAMESPACE
+
+
+// AST-Functor adapting functions UNARY 
+template< class AS >
+inline 
+void
+simplify( AS& x ) {
+    typename Algebraic_structure_traits< AS >::Simplify simplify;
+    simplify( x );
+}
+
+template< class AS >
+inline
+typename Algebraic_structure_traits< AS >::Unit_part::result_type
+unit_part( const AS& x ) {
+    typename Algebraic_structure_traits< AS >::Unit_part unit_part;
+    return unit_part( x );
+}
+
+
+template< class AS >
+inline
+typename Algebraic_structure_traits< AS >::Is_square::result_type
+is_square( const AS& x, 
+           typename Algebraic_structure_traits< AS >::Is_square::second_argument_type y ) 
+{
+    typename Algebraic_structure_traits< AS >::Is_square is_square;
+    return is_square( x, y );
+}
+
+template< class AS >
+inline
+typename Algebraic_structure_traits< AS >::Is_square::result_type
+is_square( const AS& x){
+    typename Algebraic_structure_traits< AS >::Is_square is_square;
+    return is_square( x );
+}
+
+
+template< class AS >
+inline
+typename Algebraic_structure_traits< AS >::Square::result_type
+square( const AS& x ) {
+    typename Algebraic_structure_traits< AS >::Square square;
+    return square( x );
+}
+
+
+template< class AS >
+inline
+typename Algebraic_structure_traits< AS >::Inverse::result_type
+inverse( const AS& x ) {
+    typename Algebraic_structure_traits< AS >::Inverse inverse;
+    return inverse( x );
+}
+
+template< class AS >
+inline 
+typename Algebraic_structure_traits<AS>::Is_one::result_type
+is_one( const AS& x ) {
+    typename Algebraic_structure_traits< AS >::Is_one is_one;
+    return is_one( x );
+}
+
+template< class AS >
+inline
+typename Algebraic_structure_traits< AS >::Sqrt::result_type
+sqrt( const AS& x ) {
+    typename Algebraic_structure_traits< AS >::Sqrt sqrt;
+    return sqrt( x );
+}
+
+// AST-Functor adapting functions BINARY
+
+template< class A, class B >
+inline
+typename Algebraic_structure_traits< typename Coercion_traits<A,B>::Type>
+::Integral_division::result_type
+integral_division( const A& x, const B& y ) {
+    typedef typename Coercion_traits<A,B>::Type Type;
+    typename Algebraic_structure_traits< Type >::Integral_division 
+        integral_division;
+    return integral_division( x, y );
+}
+
+template< class A, class B >
+inline
+typename Algebraic_structure_traits< typename Coercion_traits<A,B>::Type> 
+::Divides::result_type
+divides( const A& x, const B& y ) {
+  typedef typename Coercion_traits<A,B>::Type Type;
+  typename Algebraic_structure_traits< Type >::Divides  divides;
+  return divides( x, y );
+}
+
+template< class Type >
+inline
+typename Algebraic_structure_traits<Type>::Divides::result_type
+divides( const Type& x, const Type& y, Type& q ) {
+  typename Algebraic_structure_traits< Type >::Divides  divides;
+  return divides( x, y, q);
+}
+
+template< class A, class B >
+inline
+typename Algebraic_structure_traits< typename Coercion_traits<A,B>::Type >
+::Gcd::result_type
+gcd( const A& x, const B& y ) {
+    typedef typename Coercion_traits<A,B>::Type      Type;
+    typename Algebraic_structure_traits< Type >::Gcd gcd;
+    return gcd( x, y );
+}
+
+
+template< class A, class B >
+inline
+typename Algebraic_structure_traits< typename Coercion_traits<A,B>::Type >
+::Mod::result_type
+mod( const A& x, const B& y ) {
+    typedef typename Coercion_traits<A,B>::Type Type;
+    typename Algebraic_structure_traits<Type >::Mod mod;
+    return mod( x, y );
+}
+
+template< class A, class B >
+inline
+typename Algebraic_structure_traits< typename Coercion_traits<A,B>::Type>::Div::result_type
+div( const A& x, const B& y ) {
+    typedef typename Coercion_traits<A,B>::Type Type;
+    typename Algebraic_structure_traits<Type >::Div div;
+    return div( x, y );
+}
+
+template< class A, class B >
+inline 
+void
+div_mod( 
+        const A& x,
+        const B& y,
+        typename Coercion_traits<A,B>::Type& q, 
+        typename Coercion_traits<A,B>::Type& r ) {
+    typedef typename Coercion_traits<A,B>::Type Type;
+    typename Algebraic_structure_traits< Type >::Div_mod div_mod;
+    div_mod( x, y, q, r );
+}
+
+// others 
+template< class AS >
+inline
+typename Algebraic_structure_traits< AS >::Kth_root::result_type
+kth_root( int k, const AS& x ) {
+    typename Algebraic_structure_traits< AS >::Kth_root
+        kth_root;
+    return kth_root( k, x );                                                                    
+}
+
+
+template< class Input_iterator >
+inline
+typename Algebraic_structure_traits< typename std::iterator_traits<Input_iterator>::value_type >
+::Root_of::result_type
+root_of( int k, Input_iterator begin, Input_iterator end ) {
+    typedef typename std::iterator_traits<Input_iterator>::value_type AS; 
+    return typename Algebraic_structure_traits<AS>::Root_of()( k, begin, end );
+}
+
+// AST- and RET-functor adapting function
+template< class Number_type >
+inline 
+// select a Is_zero functor
+typename boost::mpl::if_c< 
+ ::boost::is_same< typename Algebraic_structure_traits< Number_type >::Is_zero,
+ Null_functor  >::value ,
+  typename Real_embeddable_traits< Number_type >::Is_zero,
+  typename Algebraic_structure_traits< Number_type >::Is_zero
+>::type::result_type
+is_zero( const Number_type& x ) {
+    // We take the Algebraic_structure_traits<>::Is_zero functor by default. If it
+    //  is not available, we take the Real_embeddable_traits functor
+    typename ::boost::mpl::if_c< 
+        ::boost::is_same<
+             typename Algebraic_structure_traits< Number_type >::Is_zero,
+             Null_functor >::value ,
+       typename Real_embeddable_traits< Number_type >::Is_zero,
+       typename Algebraic_structure_traits< Number_type >::Is_zero >::type
+       is_zero;
+return is_zero( x );                                                                    
+}
+
+
+template <class A, class B>
+inline
+typename Real_embeddable_traits< typename Coercion_traits<A,B>::Type >
+::Compare::result_type 
+compare(const A& a, const B& b)
+{ 
+    typedef typename Coercion_traits<A,B>::Type Type;
+    typename Real_embeddable_traits<Type>::Compare compare;
+    return compare (a,b);
+    // return (a < b) ? SMALLER : (b < a) ? LARGER : EQUAL; 
+}
+
+
+// RET-Functor adapting functions
+template< class Real_embeddable >
+inline 
+//Real_embeddable 
+typename Real_embeddable_traits< Real_embeddable >::Abs::result_type 
+abs( const Real_embeddable& x ) {
+    typename Real_embeddable_traits< Real_embeddable >::Abs abs;
+    return abs( x );
+}
+
+template< class Real_embeddable >
+inline 
+//::Sign 
+typename Real_embeddable_traits< Real_embeddable >::Sgn::result_type
+sign( const Real_embeddable& x ) {
+    typename Real_embeddable_traits< Real_embeddable >::Sgn sgn;
+    return sgn( x );
+}
+
+template< class Real_embeddable >
+inline 
+//bool
+typename Real_embeddable_traits< Real_embeddable >::Is_finite::result_type
+is_finite( const Real_embeddable& x ) {
+    return typename Real_embeddable_traits< Real_embeddable >::Is_finite()( x );
+}
+
+template< class Real_embeddable >
+inline 
+typename Real_embeddable_traits< Real_embeddable >::Is_positive::result_type
+is_positive( const Real_embeddable& x ) {
+    typename Real_embeddable_traits< Real_embeddable >::Is_positive 
+        is_positive;
+    return is_positive( x );
+}
+
+template< class Real_embeddable >
+inline
+typename Real_embeddable_traits< Real_embeddable >::Is_negative::result_type
+is_negative( const Real_embeddable& x ) {
+    typename Real_embeddable_traits< Real_embeddable >::Is_negative
+        is_negative;
+    return is_negative( x );
+}
+
+/*
+template< class Real_embeddable >
+inline
+typename Real_embeddable_traits< Real_embeddable >::Compare::result_type
+//Comparison_result
+compare( const Real_embeddable& x, const Real_embeddable& y ) {
+    typename Real_embeddable_traits< Real_embeddable >::Compare compare;
+    return compare( x, y );
+}
+*/
+
+template< class Real_embeddable >
+inline
+typename Real_embeddable_traits< Real_embeddable >::To_double::result_type
+//double
+to_double( const Real_embeddable& x ) {
+    typename Real_embeddable_traits< Real_embeddable >::To_double to_double;  
+    return to_double( x );
+}
+
+template< class Real_embeddable >
+inline
+typename Real_embeddable_traits< Real_embeddable >::To_interval::result_type
+//std::pair< double, double >
+to_interval( const Real_embeddable& x) {
+    typename Real_embeddable_traits< Real_embeddable >::To_interval 
+        to_interval;
+    return to_interval( x );
+}
+
+template <typename NT>
+NT approximate_sqrt(const NT& nt, CGAL::Field_tag)
+{
+  return NT(sqrt(CGAL::to_double(nt)));
+}
+
+template <typename NT>
+NT approximate_sqrt(const NT& nt, CGAL::Field_with_sqrt_tag)
+{
+  return sqrt(nt);
+}
+
+template <typename NT>
+NT approximate_sqrt(const NT& nt)
+{
+  typedef CGAL::Algebraic_structure_traits<NT> AST;
+  typedef typename AST::Algebraic_category Algebraic_category;
+  return approximate_sqrt(nt, Algebraic_category());
+}
+
+CGAL_NTS_END_NAMESPACE
+} //namespace CGAL
+
+#endif // CGAL_NUMBER_UTILS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/number_utils_classes.h b/3rdparty/CGAL/include/CGAL/number_utils_classes.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/number_utils_classes.h
rename to 3rdparty/CGAL/include/CGAL/number_utils_classes.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/odt_optimize_mesh_3.h b/3rdparty/CGAL/include/CGAL/odt_optimize_mesh_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/odt_optimize_mesh_3.h
rename to 3rdparty/CGAL/include/CGAL/odt_optimize_mesh_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/offset_polygon_2.h b/3rdparty/CGAL/include/CGAL/offset_polygon_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/offset_polygon_2.h
rename to 3rdparty/CGAL/include/CGAL/offset_polygon_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/optimize_mesh_3.h b/3rdparty/CGAL/include/CGAL/optimize_mesh_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/optimize_mesh_3.h
rename to 3rdparty/CGAL/include/CGAL/optimize_mesh_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/parameterize.h b/3rdparty/CGAL/include/CGAL/parameterize.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/parameterize.h
rename to 3rdparty/CGAL/include/CGAL/parameterize.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/partition_2.h b/3rdparty/CGAL/include/CGAL/partition_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/partition_2.h
rename to 3rdparty/CGAL/include/CGAL/partition_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/partition_is_valid_2.h b/3rdparty/CGAL/include/CGAL/partition_is_valid_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/partition_is_valid_2.h
rename to 3rdparty/CGAL/include/CGAL/partition_is_valid_2.h
diff --git a/3rdparty/CGAL/include/CGAL/pca_estimate_normals.h b/3rdparty/CGAL/include/CGAL/pca_estimate_normals.h
new file mode 100644
index 0000000..6ee08b2
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/pca_estimate_normals.h
@@ -0,0 +1,294 @@
+// Copyright (c) 2007-09  INRIA Sophia-Antipolis (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
+// 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(s) : Pierre Alliez and Laurent Saboret
+
+#ifndef CGAL_PCA_ESTIMATE_NORMALS_H
+#define CGAL_PCA_ESTIMATE_NORMALS_H
+
+#include <CGAL/trace.h>
+#include <CGAL/Dimension.h>
+#include <CGAL/Search_traits_3.h>
+#include <CGAL/Orthogonal_k_neighbor_search.h>
+#include <CGAL/linear_least_squares_fitting_3.h>
+#include <CGAL/property_map.h>
+#include <CGAL/point_set_processing_assertions.h>
+#include <CGAL/Memory_sizer.h>
+
+#include <iterator>
+#include <list>
+
+#ifdef CGAL_LINKED_WITH_TBB
+#include <tbb/parallel_for.h>
+#include <tbb/blocked_range.h>
+#include <tbb/scalable_allocator.h>  
+#endif // CGAL_LINKED_WITH_TBB
+
+namespace CGAL {
+
+
+// ----------------------------------------------------------------------------
+// Private section
+// ----------------------------------------------------------------------------
+/// \cond SKIP_IN_MANUAL
+namespace internal {
+
+
+/// Estimates normal direction using linear least
+/// squares fitting of a plane on the K nearest neighbors.
+///
+/// \pre `k >= 2`
+///
+/// @tparam Kernel Geometric traits class.
+/// @tparam Tree KD-tree.
+///
+/// @return Computed normal. Orientation is random.
+template < typename Kernel,
+           typename Tree
+>
+typename Kernel::Vector_3
+pca_estimate_normal(const typename Kernel::Point_3& query, ///< point to compute the normal at
+                    const Tree& tree, ///< KD-tree
+                    unsigned int k) ///< number of neighbors
+{
+  // basic geometric types
+  typedef typename Kernel::Point_3  Point;
+  typedef typename Kernel::Plane_3  Plane;
+
+  // types for K nearest neighbors search
+  typedef typename CGAL::Search_traits_3<Kernel> Tree_traits;
+  typedef typename CGAL::Orthogonal_k_neighbor_search<Tree_traits> Neighbor_search;
+  typedef typename Neighbor_search::iterator Search_iterator;
+
+  // Gather set of (k+1) neighboring points.
+  // Perform k+1 queries (as in point set, the query point is
+  // output first). Search may be aborted if k is greater
+  // than number of input points.
+  std::vector<Point> points; points.reserve(k+1);
+  Neighbor_search search(tree,query,k+1);
+  Search_iterator search_iterator = search.begin();
+  unsigned int i;
+  for(i=0;i<(k+1);i++)
+  {
+    if(search_iterator == search.end())
+      break; // premature ending
+    points.push_back(search_iterator->first);
+    search_iterator++;
+  }
+  CGAL_point_set_processing_precondition(points.size() >= 1);
+
+  // performs plane fitting by point-based PCA
+  Plane plane;
+  linear_least_squares_fitting_3(points.begin(),points.end(),plane,Dimension_tag<0>());
+
+  // output normal vector (already normalized by PCA)
+  return plane.orthogonal_vector();
+}
+
+
+#ifdef CGAL_LINKED_WITH_TBB
+  template <typename Kernel, typename Tree>
+  class PCA_estimate_normals {
+    typedef typename Kernel::Point_3 Point;
+    typedef typename Kernel::Vector_3 Vector;
+    const Tree& tree;
+    const unsigned int k;
+    const std::vector<Point>& input;
+    std::vector<Vector>& output;
+
+  public:
+    PCA_estimate_normals(Tree& tree, unsigned int k, std::vector<Point>& points,
+			 std::vector<Vector>& output)
+      : tree(tree), k (k), input (points), output (output)
+    { }
+    
+    void operator()(const tbb::blocked_range<std::size_t>& r) const
+    {
+      for( std::size_t i = r.begin(); i != r.end(); ++i)
+	output[i] = CGAL::internal::pca_estimate_normal<Kernel,Tree>(input[i], tree, k);
+    }
+
+  };
+#endif // CGAL_LINKED_WITH_TBB
+  
+
+} /* namespace internal */
+/// \endcond
+
+
+
+// ----------------------------------------------------------------------------
+// Public section
+// ----------------------------------------------------------------------------
+
+/// \ingroup PkgPointSetProcessing
+/// Estimates normal directions of the `[first, beyond)` range of points
+/// by linear least squares fitting of a plane over the k nearest neighbors.
+/// The output normals are randomly oriented.
+///
+/// \pre `k >= 2`
+///
+/// @tparam Concurrency_tag enables sequential versus parallel algorithm.
+///                         Possible values are `Sequential_tag`
+///                         and `Parallel_tag`.
+/// @tparam ForwardIterator iterator over input points.
+/// @tparam PointPMap is a model of `ReadablePropertyMap` with value type `Point_3<Kernel>`.
+///        It can be omitted if the value type of  `ForwardIterator` is convertible to `Point_3<Kernel>`.
+/// @tparam NormalPMap is a model of `WritablePropertyMap` with value type  `Vector_3<Kernel>`.
+/// @tparam Kernel Geometric traits class.
+///        It can be omitted and deduced automatically from the value type of `PointPMap`.
+
+// This variant requires all parameters.
+template <typename Concurrency_tag,
+	  typename ForwardIterator,
+          typename PointPMap,
+          typename NormalPMap,
+          typename Kernel
+>
+void
+pca_estimate_normals(
+  ForwardIterator first,  ///< iterator over the first input point.
+  ForwardIterator beyond, ///< past-the-end iterator over the input points.
+  PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3.
+  NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3.
+  unsigned int k, ///< number of neighbors.
+  const Kernel& /*kernel*/) ///< geometric traits.
+{
+  CGAL_TRACE("Calls pca_estimate_normals()\n");
+
+  // basic geometric types
+  typedef typename Kernel::Point_3 Point;
+
+  // Input points types
+  typedef typename boost::property_traits<NormalPMap>::value_type Vector;
+
+  // types for K nearest neighbors search structure
+  typedef typename CGAL::Search_traits_3<Kernel> Tree_traits;
+  typedef typename CGAL::Orthogonal_k_neighbor_search<Tree_traits> Neighbor_search;
+  typedef typename Neighbor_search::Tree Tree;
+
+  // precondition: at least one element in the container.
+  // to fix: should have at least three distinct points
+  // but this is costly to check
+  CGAL_point_set_processing_precondition(first != beyond);
+
+  // precondition: at least 2 nearest neighbors
+  CGAL_point_set_processing_precondition(k >= 2);
+
+  std::size_t memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE("  %ld Mb allocated\n", memory>>20);
+  CGAL_TRACE("  Creates KD-tree\n");
+
+  ForwardIterator it;
+
+  // Instanciate a KD-tree search.
+  // Note: We have to convert each input iterator to Point_3.
+  std::vector<Point> kd_tree_points; 
+  for(it = first; it != beyond; it++)
+    kd_tree_points.push_back(get(point_pmap, *it));
+  Tree tree(kd_tree_points.begin(), kd_tree_points.end());
+
+  memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE("  %ld Mb allocated\n", memory>>20);
+  CGAL_TRACE("  Computes normals\n");
+
+  // iterate over input points, compute and output normal
+  // vectors (already normalized)
+#ifndef CGAL_LINKED_WITH_TBB
+  CGAL_static_assertion_msg (!(boost::is_convertible<Concurrency_tag, Parallel_tag>::value),
+			     "Parallel_tag is enabled but TBB is unavailable.");
+#else
+  if (boost::is_convertible<Concurrency_tag,Parallel_tag>::value)
+    {
+      std::vector<Vector> normals (kd_tree_points.size ());
+      CGAL::internal::PCA_estimate_normals<Kernel, Tree>
+	f (tree, k, kd_tree_points, normals);
+      tbb::parallel_for(tbb::blocked_range<size_t>(0, kd_tree_points.size ()), f);
+      unsigned int i = 0;
+      for(it = first; it != beyond; ++ it, ++ i)
+	{
+	  put (normal_pmap, *it, normals[i]);
+	}
+    }
+  else
+#endif
+    {
+      for(it = first; it != beyond; it++)
+	{
+	  Vector normal = internal::pca_estimate_normal<Kernel,Tree>(      
+								     get(point_pmap,*it),
+								     tree,
+								     k);
+
+	  put(normal_pmap, *it, normal); // normal_pmap[it] = normal
+	}
+    }
+   
+  memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE("  %ld Mb allocated\n", memory>>20);
+  CGAL_TRACE("End of pca_estimate_normals()\n");
+}
+  
+/// @cond SKIP_IN_MANUAL
+// This variant deduces the kernel from the point property map.
+template <typename Concurrency_tag,
+	  typename ForwardIterator,
+          typename PointPMap,
+          typename NormalPMap
+>
+void
+pca_estimate_normals(
+  ForwardIterator first,  ///< iterator over the first input point.
+  ForwardIterator beyond, ///< past-the-end iterator over the input points.
+  PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3.
+  NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3.
+  unsigned int k) ///< number of neighbors.
+{
+  typedef typename boost::property_traits<PointPMap>::value_type Point;
+  typedef typename Kernel_traits<Point>::Kernel Kernel;
+  pca_estimate_normals<Concurrency_tag>(
+    first,beyond,
+    point_pmap,
+    normal_pmap,
+    k,
+    Kernel());
+}
+/// @endcond
+
+/// @cond SKIP_IN_MANUAL
+// This variant creates a default point property map = Identity_property_map.
+template <typename Concurrency_tag,
+	  typename ForwardIterator,
+          typename NormalPMap
+>
+void
+pca_estimate_normals(
+  ForwardIterator first,  ///< iterator over the first input point.
+  ForwardIterator beyond, ///< past-the-end iterator over the input points.
+  NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3.
+  unsigned int k) ///< number of neighbors.
+{
+  pca_estimate_normals<Concurrency_tag>(
+    first,beyond,
+    make_identity_property_map(
+    typename std::iterator_traits<ForwardIterator>::value_type()),
+    normal_pmap,
+    k);
+}
+/// @endcond
+
+
+} //namespace CGAL
+
+#endif // CGAL_PCA_ESTIMATE_NORMALS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/periodic_3_triangulation_3_io.h b/3rdparty/CGAL/include/CGAL/periodic_3_triangulation_3_io.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/periodic_3_triangulation_3_io.h
rename to 3rdparty/CGAL/include/CGAL/periodic_3_triangulation_3_io.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/perturb_mesh_3.h b/3rdparty/CGAL/include/CGAL/perturb_mesh_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/perturb_mesh_3.h
rename to 3rdparty/CGAL/include/CGAL/perturb_mesh_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/pierce_rectangles_2.h b/3rdparty/CGAL/include/CGAL/pierce_rectangles_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/pierce_rectangles_2.h
rename to 3rdparty/CGAL/include/CGAL/pierce_rectangles_2.h
diff --git a/3rdparty/CGAL/include/CGAL/point_generators_2.h b/3rdparty/CGAL/include/CGAL/point_generators_2.h
new file mode 100644
index 0000000..8bb24a1
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/point_generators_2.h
@@ -0,0 +1,547 @@
+// Copyright (c) 1997  
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved. 
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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(s)     : Lutz Kettner  <kettner at inf.ethz.ch>
+//                 Pedro Machado Manhaes de Castro  <pmmc at cin.ufpe.br>
+//                 Alexandru Tifrea
+
+#ifndef CGAL_POINT_GENERATORS_2_H
+#define CGAL_POINT_GENERATORS_2_H 1
+#include <CGAL/generators.h>
+#include <iterator>
+#include <CGAL/number_type_basic.h>
+
+namespace CGAL {
+
+template < class P, class Creator = 
+                  Creator_uniform_2<typename Kernel_traits<P>::Kernel::RT,P> >
+class Random_points_in_disc_2 : public Random_generator_base<P>{
+    void generate_point();
+public:
+    typedef Random_points_in_disc_2<P,Creator> This;
+    Random_points_in_disc_2( double r = 1, Random& rnd = CGAL::get_default_random())
+        // g is an input iterator creating points of type `P' uniformly
+        // distributed in the open disc with radius r, i.e. |`*g'| < r .
+        // Two random numbers are needed from `rnd' for each point.
+    : Random_generator_base<P>(r, rnd) { generate_point(); }
+    This& operator++() {
+        generate_point();
+        return *this;
+    }
+    This  operator++(int) {
+        This tmp = *this;
+        ++(*this);
+        return tmp;
+    }
+};
+
+template < class P, class Creator >
+void
+Random_points_in_disc_2<P,Creator>::
+generate_point() {
+    typedef typename Creator::argument_type T;
+    double alpha = this->_rnd.get_double() * 2.0 * CGAL_PI;
+    double r = this->d_range * std::sqrt( this->_rnd.get_double());
+    Creator creator;
+    this->d_item = creator( T(r * std::cos(alpha)), 
+                            T(r * std::sin(alpha)));
+}
+
+
+template < class P, class Creator = 
+                  Creator_uniform_2<typename Kernel_traits<P>::Kernel::RT, P> >
+class Random_points_on_circle_2 : public Random_generator_base<P> {
+    void generate_point();
+public:
+    typedef Random_points_on_circle_2<P,Creator> This;
+    Random_points_on_circle_2( double r = 1, Random& rnd = CGAL::get_default_random())
+        // g is an input iterator creating points of type `P' uniformly
+        // distributed on the circle with radius r, i.e. |`*g'| == r . A
+        // single random number is needed from `rnd' for each point.
+    : Random_generator_base<P>(r, rnd) { generate_point(); }
+    This& operator++()    {
+        generate_point();
+        return *this;
+    }
+    This  operator++(int) {
+        This tmp = *this;
+        ++(*this);
+        return tmp;
+    }
+};
+
+template < class P, class Creator >
+void
+Random_points_on_circle_2<P,Creator>::
+generate_point() {
+    typedef typename Creator::argument_type T;
+    double a = this->_rnd.get_double() * 2.0 * CGAL_PI;
+    Creator creator;
+    this->d_item = creator( T(this->d_range * std::cos(a)), 
+                            T(this->d_range * std::sin(a)));
+}
+
+
+template < class P, class Creator = 
+                   Creator_uniform_2<typename Kernel_traits<P>::Kernel::RT,P> >
+class Random_points_in_square_2 : public Random_generator_base<P> {
+    void generate_point();
+public:
+    typedef Random_points_in_square_2<P,Creator> This;
+    Random_points_in_square_2( double a = 1, Random& rnd = CGAL::get_default_random())
+        // g is an input iterator creating points of type `P' uniformly
+        // distributed in the half-open square with side length a,
+        // centered around the origin, i.e. \forall p = `*g': -\frac{a}{2}
+        // <= p.x() < \frac{a}{2} and -\frac{a}{2} <= p.y() < \frac{a}{2}
+        // . Two random numbers are needed from `rnd' for each point.
+    : Random_generator_base<P>( a, rnd) { generate_point(); }
+    This& operator++()    {
+        generate_point();
+        return *this;
+    }
+    This  operator++(int) {
+        This tmp = *this;
+        ++(*this);
+        return tmp;
+    }
+};
+
+template < class P, class Creator >
+void
+Random_points_in_square_2<P,Creator>::
+generate_point() {
+    typedef typename Creator::argument_type  T;
+    Creator creator;
+    this->d_item =
+	    creator( T(this->d_range * (2 * this->_rnd.get_double() - 1.0)),
+                     T(this->d_range * (2 * this->_rnd.get_double() - 1.0)));
+}
+
+
+template < class P, class Creator = 
+                   Creator_uniform_2<typename Kernel_traits<P>::Kernel::RT,P> >
+class Random_points_on_square_2 : public Random_generator_base<P> {
+    void generate_point();
+public:
+    typedef Random_points_on_square_2<P,Creator> This;
+    Random_points_on_square_2( double a = 1, Random& rnd = CGAL::get_default_random())
+        // g is an input iterator creating points of type `P' uniformly
+        // distributed on the boundary of the square with side length a,
+        // centered around the origin, i.e. \forall p = `*g': one
+        // coordinate is either \frac{a}{2} or -\frac{a}{2} and for the
+        // other coordinate c holds -\frac{a}{2} <= c < \frac{a}{2} . A
+        // single random number is needed from `rnd' for each point.
+    : Random_generator_base<P>( a, rnd)  { generate_point(); }
+    This& operator++()    {
+        generate_point();
+        return *this;
+    }
+    This  operator++(int) {
+        This tmp = *this;
+        ++(*this);
+        return tmp;
+    }
+};
+
+template < class P, class Creator >
+void
+Random_points_on_square_2<P,Creator>::
+generate_point() {
+    typedef typename Creator::argument_type  T;
+    double d = this->_rnd.get_double() * 4.0;
+    int    k = int(d);
+    d = this->d_range * (2 * (d - k) - 1.0);
+    CGAL_assertion( - this->d_range <= d && d < this->d_range);
+    Creator creator;
+    switch (k) {
+    case 0:
+        this->d_item = creator(              T(d), T(-this->d_range));
+        break;
+    case 1:
+        this->d_item = creator(              T(d),  T(this->d_range));
+        break;
+    case 2:
+        this->d_item = creator( T(-this->d_range),        T(d));
+        break;
+    case 3:
+        this->d_item = creator( T( this->d_range),        T(d));
+        break;
+    }
+}
+
+
+template < class P, class Creator = 
+                   Creator_uniform_2<typename Kernel_traits<P>::Kernel::RT,P> >
+class Random_points_in_iso_rectangle_2 : public Random_generator_base<P> {
+  double left, right, top, bottom;
+    void generate_point();
+public:
+    typedef Random_points_in_iso_rectangle_2<P,Creator> This;
+    Random_points_in_iso_rectangle_2( const P&p, const P& q, Random& rnd = CGAL::get_default_random())
+      : Random_generator_base<P>( 1.0 , rnd)
+  {
+    left = (std::min)(to_double(p.x()), to_double(q.x()));
+    right = (std::max)(to_double(p.x()), to_double(q.x()));
+    top = (std::min)(to_double(p.y()), to_double(q.y()));
+    bottom = (std::max)(to_double(p.y()), to_double(q.y()));
+    generate_point(); 
+  }
+
+    This& operator++()    {
+        generate_point();
+        return *this;
+    }
+    This  operator++(int) {
+        This tmp = *this;
+        ++(*this);
+        return tmp;
+    }
+};
+
+template < class P, class Creator >
+void
+Random_points_in_iso_rectangle_2<P,Creator>::
+generate_point() {
+    typedef typename Creator::argument_type  T;
+    Creator creator;
+    this->d_item =
+	    creator( T(this->_rnd.get_double(left,right)),
+                     T(this->_rnd.get_double(top,bottom)));
+}
+
+
+
+template < class P, class Creator = 
+                   Creator_uniform_2<typename Kernel_traits<P>::Kernel::RT,P> >
+class Random_points_on_segment_2 : public Random_generator_base<P> {
+    P _p;
+    P _q;
+    void generate_point();
+public:
+    typedef Random_points_on_segment_2<P,Creator> This;
+    Random_points_on_segment_2( const P& p = P( -1, 0),
+                                const P& q = P(  1, 0),
+                                Random& rnd = CGAL::get_default_random())
+        // g is an input iterator creating points of type `P' uniformly
+        // distributed on the segment from p to q except q, i.e. `*g' ==
+        // \lambda p + (1-\lambda)\, q where 0 <= \lambda < 1 . A single
+        // random number is needed from `rnd' for each point.
+      : Random_generator_base<P>( (std::max)( (std::max)( to_double(p.x()), to_double(q.x())),
+                                              (std::max)( to_double(p.y()),
+                                                          to_double(q.y()))),
+                                  rnd) , _p(p), _q(q)
+    {
+        generate_point();
+    }
+    const P&  source() const { return _p; }
+    const P&  target() const { return _q; }
+    This& operator++()    {
+        generate_point();
+        return *this;
+    }
+    This  operator++(int) {
+        This tmp = *this;
+        ++(*this);
+        return tmp;
+    }
+};
+
+template < class P, class Creator >
+void
+Random_points_on_segment_2<P,Creator>::
+generate_point() {
+    typedef typename Creator::argument_type  T;
+    double la = this->_rnd.get_double();
+    double mu = 1.0 - la;
+    Creator creator;
+    this->d_item = creator(T(mu * to_double(_p.x()) + la * to_double(_q.x())),
+                           T(mu * to_double(_p.y()) + la * to_double(_q.y())));
+}
+
+template < class P >
+class Points_on_segment_2 : public Generator_base<P> {
+    P _p;
+    P _q;
+    std::size_t  d_i;
+    std::size_t  d_mx;
+    void generate_point();
+public:
+    typedef Points_on_segment_2<P> This;
+    Points_on_segment_2() {}
+    Points_on_segment_2( const P& p, const P& q,
+                         std::size_t mx, std::size_t i = 0)
+      : Generator_base<P>( (std::max)( (std::max)( to_double(p.x()), to_double(q.x())),
+                                       (std::max)( to_double(p.y()), to_double(q.y())))),
+        _p(p), _q(q), d_i(i), d_mx(mx) 
+    {
+        generate_point();
+    }
+    const P&  source() const { return _p; }
+    const P&  target() const { return _q; }
+    // Sufficient equality test.
+    bool operator==( const This& base) const { return ( d_i == base.d_i); }
+    bool operator!=( const This& base) const { return ! operator==(base); }
+    This& operator++()    {
+        d_i++;
+        generate_point();
+        return *this;
+    }
+    This  operator++(int) {
+        This tmp = *this;
+        ++(*this);
+        return tmp;
+    }
+};
+
+template < class P >
+void
+Points_on_segment_2<P>::
+generate_point() { this->d_item = _p + (_q-_p) * static_cast<double>(d_i) / (static_cast<double>(d_mx)-1); }
+
+template <class OutputIterator, class Creator>
+OutputIterator
+points_on_square_grid_2( double a, std::size_t n, OutputIterator o,
+                         Creator creator)
+{
+    typedef typename Creator::argument_type T;
+    if  (n == 0)
+        return o;
+    int m = int(std::ceil(std::sqrt(static_cast<double>(n))));
+    double base = -a;  // Left and bottom boundary.
+    double step = (2*a)/(m - 1);
+    int j = 0;
+    double px = base;
+    double py = base;
+    *o++ = creator( T(px), T(py));
+    for (std::size_t i = 1; i < n; i++) {
+        j++;
+        if ( j == m) {
+            px = base;
+            py = py + step;
+            j = 0;
+        } else {
+            px = px + step;
+        }
+        *o++ = creator( T(px), T(py));
+    }
+    return o;
+}
+
+template <class OutputIterator>
+OutputIterator
+points_on_square_grid_2( double a, std::size_t n, OutputIterator o)
+{
+    typedef std::iterator_traits<OutputIterator> ITraits;
+    typedef typename ITraits::value_type         P;
+    return points_on_square_grid_2(a, n, o, 
+                Creator_uniform_2<typename Kernel_traits<P>::Kernel::RT,P>());
+}
+
+template <class P, class OutputIterator>
+OutputIterator
+points_on_segment_2( const P& p, const P& q, std::size_t n,
+                     OutputIterator o)
+    // creates n points regular spaced on the segment from p to q, i.e.
+    // \forall i: 0 <= i < n: o[i] := \frac{n-i-1}{n-1} p + \frac{i}{n-1
+    // } q.
+{
+    for (std::size_t i = 0; i < n; i++) {
+      *o++ = p + (q-p) * static_cast<typename Kernel_traits<P>::Kernel::FT>(static_cast<double>(i) / (static_cast<double>(n)-1));
+    }
+    return o;
+}
+
+template <class ForwardIterator, class Creator>
+void perturb_points_2( ForwardIterator first,
+                       ForwardIterator last,
+                       double xeps,
+                       double yeps,
+                       Random& rnd,
+                       Creator creator)
+    // perturbs the points in the range [`first',`last') by replacing
+    // each point with a random point from the rectangle `xeps' \times
+    // `yeps' centered around the original point. Two random numbers are
+    // needed from `rnd' for each point. Precondition:
+    // The expression `to_double((*first).x())' and `to_double((
+    // *begin).y())' must be legal.
+{
+    typedef typename Creator::argument_type T;
+    xeps *= 2.0;
+    yeps *= 2.0;
+    for ( ; first != last; ++first) {
+        double x = to_double( (*first).x());
+        double y = to_double( (*first).y());
+        x += xeps * (rnd.get_double() - 0.5);
+        y += yeps * (rnd.get_double() - 0.5);
+        *first = creator( T(x), T(y));
+    }
+}
+
+template <class ForwardIterator>
+void perturb_points_2( ForwardIterator first,
+                       ForwardIterator last,
+                       double xeps,
+                       double yeps,
+                       Random& rnd)
+{
+    typedef std::iterator_traits<ForwardIterator> ITraits;
+    typedef typename ITraits::value_type          P;
+    perturb_points_2( first, last, xeps, yeps, rnd,
+                 Creator_uniform_2<typename Kernel_traits<P>::Kernel::RT,P>());
+}
+
+template <class ForwardIterator>
+inline
+void perturb_points_2( ForwardIterator first,
+                       ForwardIterator last,
+                       double xeps,
+                       Random& rnd)
+{
+    perturb_points_2( first, last, xeps, xeps, rnd);
+}
+
+template <class ForwardIterator>
+void perturb_points_2( ForwardIterator first,
+                       ForwardIterator last,
+                       double xeps,
+                       double yeps)
+{
+    perturb_points_2( first, last, xeps, yeps, CGAL::get_default_random());
+}
+
+template <class ForwardIterator>
+void perturb_points_2( ForwardIterator first,
+                       ForwardIterator last,
+                       double xeps)
+{
+    perturb_points_2( first, last, xeps, xeps, CGAL::get_default_random());
+}
+template <class RandomAccessIterator, class OutputIterator, class Creator>
+OutputIterator random_collinear_points_2(
+                       RandomAccessIterator first,
+                       RandomAccessIterator last,
+                       std::size_t n,
+                       OutputIterator first2,
+                       Random& rnd,
+                       Creator creator)
+{
+    typedef typename Creator::result_type   Point;
+    typedef typename Creator::argument_type T;
+
+    std::ptrdiff_t m = last - first;
+    for ( std::size_t i = 0; i < n; i++) {
+      const Point& p = first[ rnd.uniform_int<std::ptrdiff_t>( 0, m-1)];
+        const Point& q = first[ rnd.uniform_int<std::ptrdiff_t>( 0, m-1)];
+        double la = rnd.get_double();
+        double mu = 1.0 - la;
+        *first2++ = creator(T(mu * to_double(p.x()) +
+                              la * to_double(q.x())),
+                            T(mu * to_double(p.y()) +
+                              la * to_double(q.y())));
+    }
+    return first2;
+}
+
+template <class RandomAccessIterator, class OutputIterator>
+OutputIterator random_collinear_points_2(
+                       RandomAccessIterator first,
+                       RandomAccessIterator last,
+                       std::size_t n,
+                       OutputIterator first2,
+                       Random& rnd)
+    // choose two random points from the range [`first',`last'), create a
+    // random third point on the segment connecting this two points, and
+    // write it to `first2'. Repeat this n times, thus writing n points to
+    // `first2' that are collinear with points in the range [`first',
+    // `last'). Three random numbers are needed from `rnd' for each point.
+    // Returns the value of `first2' after inserting the n points.
+    // Precondition: The expression `to_double((*first).x()
+    // )' and `to_double((*first).y())' must be legal.
+{
+    typedef std::iterator_traits<RandomAccessIterator> ITraits;
+    typedef typename ITraits::value_type               P;
+    return random_collinear_points_2( first, last, n, first2, rnd,
+                 Creator_uniform_2<typename Kernel_traits<P>::Kernel::RT,P>());
+}
+
+template <class RandomAccessIterator, class OutputIterator>
+OutputIterator random_collinear_points_2(
+                       RandomAccessIterator first,
+                       RandomAccessIterator last,
+                       std::size_t n,
+                       OutputIterator first2)
+{
+    return  random_collinear_points_2( first, last, n, first2,
+                                       CGAL::get_default_random());
+}
+
+template < class P, class Creator = 
+Creator_uniform_2<typename Kernel_traits<P>::Kernel::RT,P> >
+class Random_points_in_triangle_2 : public Random_generator_base<P> {
+	P _p,_q,_r;
+	void generate_point();
+public:
+	typedef P result_type;
+	typedef Random_points_in_triangle_2<P> This;
+	typedef typename Kernel_traits<P>::Kernel::Triangle_2 Triangle_2;
+	Random_points_in_triangle_2() {}
+	Random_points_in_triangle_2( const This& x,Random& rnd = get_default_random())
+	: Random_generator_base<P>( 1, rnd ),_p(x._p),_q(x._q),_r(x._r) {
+		generate_point();
+	}
+	Random_points_in_triangle_2( const P& p, const P& q, const P& r, Random& rnd = get_default_random())
+	: Random_generator_base<P>( 1, rnd ),_p(p),_q(q),_r(r) {
+		generate_point();
+	}
+	Random_points_in_triangle_2( const Triangle_2& triangle,Random& rnd = get_default_random())
+	: Random_generator_base<P>( 1,
+			rnd),_p(triangle[0]),_q(triangle[1]),_r(triangle[2]) {
+		generate_point();
+	}
+	This& operator++() {
+		generate_point();
+		return *this;
+	}
+	This operator++(int) {
+		This tmp = *this;
+		++(*this);
+		return tmp;
+	}
+};
+	
+template<class P, class Creator >
+void Random_points_in_triangle_2<P, Creator>::generate_point() {
+	typedef typename Creator::argument_type T;
+	Creator creator;
+	double a1 = this->_rnd.get_double(0,1);
+	double a2 = this->_rnd.get_double(0,1);
+	if(a1>a2) std::swap(a1,a2);
+	double b1 = a1;
+	double b2 = a2-a1;
+	double b3 = 1.0-a2;
+	this->d_item = creator(T(to_double(_p.x())*b1+to_double(_q.x())*b2+to_double(_r.x())*b3),
+							T(to_double(_p.y())*b1+to_double(_q.y())*b2+to_double(_r.y())*b3));
+}
+
+} //namespace CGAL
+#endif // CGAL_POINT_GENERATORS_2_H //
+// EOF //
diff --git a/3rdparty/CGAL/include/CGAL/point_generators_3.h b/3rdparty/CGAL/include/CGAL/point_generators_3.h
new file mode 100644
index 0000000..cb5830c
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/point_generators_3.h
@@ -0,0 +1,309 @@
+// Copyright (c) 1997  
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved. 
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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(s)     : Lutz Kettner  <kettner at inf.ethz.ch>
+//                 Pedro Machado Manhaes de Castro  <pmmc at cin.ufpe.br>
+//                 Alexandru Tifrea
+
+#ifndef CGAL_POINT_GENERATORS_3_H
+#define CGAL_POINT_GENERATORS_3_H 1
+#include <CGAL/generators.h>
+#include <CGAL/point_generators_2.h>
+#include <CGAL/number_type_basic.h>
+
+namespace CGAL {
+
+template < class P, class Creator = 
+                   Creator_uniform_3<typename Kernel_traits<P>::Kernel::RT,P> >
+class Random_points_in_sphere_3 : public Random_generator_base<P> {
+    void generate_point();
+public:
+    typedef Random_points_in_sphere_3<P,Creator> This;
+    Random_points_in_sphere_3( double r = 1, Random& rnd = CGAL::get_default_random())
+        // g is an input iterator creating points of type `P' uniformly
+        // distributed in the open sphere with radius r, i.e. |`*g'| < r .
+        // Three random numbers are needed from `rnd' for each point
+    : Random_generator_base<P>( r, rnd) { generate_point(); }
+    This& operator++()    {
+        generate_point();
+        return *this;
+    }
+    This  operator++(int) {
+        This tmp = *this;
+        ++(*this);
+        return tmp;
+    }
+};
+
+template < class P, class Creator >
+void
+Random_points_in_sphere_3<P,Creator>::
+generate_point() {
+  // A strip between z and z+dz has an area independant of z
+    typedef typename Creator::argument_type T;
+    double alpha = this->_rnd.get_double() * 2.0 * CGAL_PI;
+    double z     = 2 * this->_rnd.get_double() - 1.0;
+    double r     = std::sqrt( 1 - z * z);
+    r *= std::pow( this->_rnd.get_double() , 1.0/3.0 );  
+    Creator creator;
+    this->d_item = creator( T(this->d_range * r * std::cos(alpha)),
+                            T(this->d_range * r * std::sin(alpha)),
+                            T(this->d_range * z));
+}
+
+
+template < class P, class Creator = 
+                   Creator_uniform_3<typename Kernel_traits<P>::Kernel::RT,P> >
+class Random_points_on_sphere_3 : public Random_generator_base<P> {
+    void generate_point();
+public:
+    typedef Random_points_on_sphere_3<P,Creator> This;
+    Random_points_on_sphere_3( double r = 1, Random& rnd = CGAL::get_default_random())
+        // g is an input iterator creating points of type `P' uniformly
+        // distributed on the sphere with radius r, i.e. |`*g'| == r . A
+        // two random numbers are needed from `rnd' for each point.
+    : Random_generator_base<P>( r, rnd) { generate_point(); }
+    This& operator++()    {
+        generate_point();
+        return *this;
+    }
+    This  operator++(int) {
+        This tmp = *this;
+        ++(*this);
+        return tmp;
+    }
+};
+
+template < class P, class Creator >
+void
+Random_points_on_sphere_3<P,Creator>::
+generate_point() {
+  // A strip between z and z+dz has an area independant of z
+    typedef typename Creator::argument_type T;
+    double alpha = this->_rnd.get_double() * 2.0 * CGAL_PI;
+    double z     = 2 * this->_rnd.get_double() - 1.0;
+    double r     = std::sqrt( 1 - z * z);
+    Creator creator;
+    this->d_item = creator( T(this->d_range * r * std::cos(alpha)),
+                            T(this->d_range * r * std::sin(alpha)),
+                            T(this->d_range * z));
+}
+
+
+template < class P, class Creator = 
+                   Creator_uniform_3<typename Kernel_traits<P>::Kernel::RT,P> >
+class Random_points_in_cube_3 : public Random_generator_base<P>{
+    void generate_point();
+public:
+    typedef Random_points_in_cube_3<P,Creator> This;
+    Random_points_in_cube_3( double a = 1, Random& rnd = CGAL::get_default_random())
+    : Random_generator_base<P>( a, rnd) { generate_point(); }
+    This& operator++()    {
+        generate_point();
+        return *this;
+    }
+    This  operator++(int) {
+        This tmp = *this;
+        ++(*this);
+        return tmp;
+    }
+};
+
+template < class P, class Creator >
+void
+Random_points_in_cube_3<P,Creator>::
+generate_point() {
+    typedef typename Creator::argument_type T;
+    Creator creator;
+    this->d_item =
+	     creator( T(this->d_range * ( 2 * this->_rnd.get_double() - 1.0)),
+                      T(this->d_range * ( 2 * this->_rnd.get_double() - 1.0)),
+                      T(this->d_range * ( 2 * this->_rnd.get_double() - 1.0)));
+}
+
+
+template <class OutputIterator, class Creator>
+OutputIterator
+points_on_cube_grid_3( double a, std::size_t n, 
+                         OutputIterator o, Creator creator)
+{
+    if  (n == 0)
+        return o;
+
+    int m = int(std::ceil(
+                  std::sqrt(std::sqrt(static_cast<double>(n)))));
+
+    while (m*m*m < int(n)) m++;
+
+    double base = -a;  // Left and bottom boundary.
+    double step = 2*a/(m-1);
+    int j = 0;
+    int k = 0;
+    double px = base;
+    double py = base;
+    double pz = base;
+    *o++ = creator( px, py, pz);
+    for (std::size_t i = 1; i < n; i++) {
+        j++;
+        if ( j == m) {
+           k++;
+           if ( k == m) {
+              py = base;
+              px = base;
+              pz = pz + step;
+              k = 0;
+           }
+           else {
+              px = base;
+              py = py + step;
+           }
+           j = 0;
+        } else {
+           px = px + step;
+        }
+        *o++ = creator( px, py, pz);
+    }
+    return o;
+}
+
+template <class OutputIterator>
+OutputIterator
+points_on_cube_grid_3( double a, std::size_t n, OutputIterator o)
+{
+    typedef std::iterator_traits<OutputIterator> ITraits;
+    typedef typename ITraits::value_type         P;
+    return points_on_square_grid_3(a, n, o, 
+                 Creator_uniform_3<typename Kernel_traits<P>::Kernel::RT,P>());
+}
+
+template < class P, class Creator = 
+Creator_uniform_3<typename Kernel_traits<P>::Kernel::RT,P> >
+class Random_points_in_triangle_3 : public Random_generator_base<P> {
+	P _p,_q,_r;
+	void generate_point();
+public:
+	typedef P result_type;
+	typedef Random_points_in_triangle_3<P> This;
+	typedef typename Kernel_traits<P>::Kernel::Triangle_3 Triangle_3;
+	Random_points_in_triangle_3() {}
+	Random_points_in_triangle_3( const This& x,Random& rnd = get_default_random())
+	: Random_generator_base<P>( 1, rnd ),_p(x._p),_q(x._q),_r(x._r) {
+		generate_point();
+	}
+	Random_points_in_triangle_3( const P& p, const P& q, const P& r, Random& rnd = get_default_random())
+	: Random_generator_base<P>( 1, rnd ),_p(p),_q(q),_r(r) {
+		generate_point();
+	}
+	Random_points_in_triangle_3( const Triangle_3& triangle,Random& rnd = get_default_random())
+	: Random_generator_base<P>( 1,
+			rnd),_p(triangle[0]),_q(triangle[1]),_r(triangle[2]) {
+		generate_point();
+	}
+	This& operator++() {
+		generate_point();
+		return *this;
+	}
+	This operator++(int) {
+		This tmp = *this;
+		++(*this);
+		return tmp;
+	}
+};
+
+
+template<class P, class Creator >
+void Random_points_in_triangle_3<P, Creator>::generate_point() {
+	typedef typename Creator::argument_type T;
+	Creator creator;
+	double a1 = this->_rnd.get_double(0,1);
+	double a2 = this->_rnd.get_double(0,1);
+	if(a1>a2) std::swap(a1,a2);
+	double b1 = a1;
+	double b2 = a2-a1;
+	double b3 = 1.0-a2;
+	T ret[3];
+	for(int i = 0; i < 3; ++i) {
+	    ret[i] = T(to_double(_p[i])*b1+to_double(_q[i])*b2+to_double(_r[i])*b3);
+	}
+	this->d_item = creator(ret[0],ret[1],ret[2]);
+}
+
+template < class P, class Creator = 
+Creator_uniform_3<typename Kernel_traits<P>::Kernel::RT,P> >
+class Random_points_in_tetrahedron_3 : public Random_generator_base<P> {
+	P _p,_q,_r,_s;
+	void generate_point();
+public:
+	typedef P result_type;
+	typedef Random_points_in_tetrahedron_3<P> This;
+	typedef typename Kernel_traits<P>::Kernel::Tetrahedron_3 Tetrahedron_3;
+	Random_points_in_tetrahedron_3() {}
+	Random_points_in_tetrahedron_3( const This& x,Random& rnd = get_default_random())
+	: Random_generator_base<P>( 1, rnd ),_p(x._p),_q(x._q),_r(x._r),_s(x._s) {
+		generate_point();
+	}
+	Random_points_in_tetrahedron_3( const P& p, const P& q, const P& r, const P& s,Random& rnd = get_default_random())
+	: Random_generator_base<P>( 1, rnd ),_p(p),_q(q),_r(r),_s(s) {
+		generate_point();
+	}
+	Random_points_in_tetrahedron_3( const Tetrahedron_3& tetrahedron,Random& rnd = get_default_random())
+	: Random_generator_base<P>( 1, rnd),_p(tetrahedron[0]),_q(tetrahedron[1]),_r(tetrahedron[2]),_s(tetrahedron[3]) {
+		generate_point();
+	}
+	This& operator++() {
+		generate_point();
+		return *this;
+	}
+	This operator++(int) {
+		This tmp = *this;
+		++(*this);
+		return tmp;
+	}
+};
+
+template<class P, class Creator >
+void Random_points_in_tetrahedron_3<P, Creator>::generate_point() {
+	typedef typename Creator::argument_type T;
+	Creator creator;
+	double a[3];
+	for(int i = 0; i < 3; ++i) {
+		a[i]=this->_rnd.get_double(0,1);
+	}
+	std::sort(a,a+3);
+	double b[4];
+	b[0]=a[0];
+	b[1]=a[1]-a[0];
+	b[2]=a[2]-a[1];
+	b[3]=1.0-a[2];
+	T ret[3];
+	for(int i = 0; i < 3; ++i) {
+	    ret[i] = T(to_double(_p[i])*b[0]+to_double(_q[i])*b[1]+to_double(_r[i])*b[2]+to_double(_s[i])*b[3]);
+	}
+	this->d_item = creator(ret[0],ret[1],ret[2]);
+}
+
+
+
+} //namespace CGAL
+
+#endif // CGAL_POINT_GENERATORS_3_H //
+// EOF //
diff --git a/3rdparty/CGAL-4.8/include/CGAL/point_generators_d.h b/3rdparty/CGAL/include/CGAL/point_generators_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/point_generators_d.h
rename to 3rdparty/CGAL/include/CGAL/point_generators_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/point_set_processing_assertions.h b/3rdparty/CGAL/include/CGAL/point_set_processing_assertions.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/point_set_processing_assertions.h
rename to 3rdparty/CGAL/include/CGAL/point_set_processing_assertions.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/poisson_refine_triangulation.h b/3rdparty/CGAL/include/CGAL/poisson_refine_triangulation.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/poisson_refine_triangulation.h
rename to 3rdparty/CGAL/include/CGAL/poisson_refine_triangulation.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/polygon_function_objects.h b/3rdparty/CGAL/include/CGAL/polygon_function_objects.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/polygon_function_objects.h
rename to 3rdparty/CGAL/include/CGAL/polygon_function_objects.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/polygon_mesh_processing.h b/3rdparty/CGAL/include/CGAL/polygon_mesh_processing.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/polygon_mesh_processing.h
rename to 3rdparty/CGAL/include/CGAL/polygon_mesh_processing.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/polyhedron_cut_plane_3.h b/3rdparty/CGAL/include/CGAL/polyhedron_cut_plane_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/polyhedron_cut_plane_3.h
rename to 3rdparty/CGAL/include/CGAL/polyhedron_cut_plane_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/polynomial_utils.h b/3rdparty/CGAL/include/CGAL/polynomial_utils.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/polynomial_utils.h
rename to 3rdparty/CGAL/include/CGAL/polynomial_utils.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/predicates/Polygon_offset_pred_ftC2.h b/3rdparty/CGAL/include/CGAL/predicates/Polygon_offset_pred_ftC2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/predicates/Polygon_offset_pred_ftC2.h
rename to 3rdparty/CGAL/include/CGAL/predicates/Polygon_offset_pred_ftC2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/predicates/Regular_triangulation_ftC2.h b/3rdparty/CGAL/include/CGAL/predicates/Regular_triangulation_ftC2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/predicates/Regular_triangulation_ftC2.h
rename to 3rdparty/CGAL/include/CGAL/predicates/Regular_triangulation_ftC2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/predicates/Regular_triangulation_ftC3.h b/3rdparty/CGAL/include/CGAL/predicates/Regular_triangulation_ftC3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/predicates/Regular_triangulation_ftC3.h
rename to 3rdparty/CGAL/include/CGAL/predicates/Regular_triangulation_ftC3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/predicates/Regular_triangulation_rtH2.h b/3rdparty/CGAL/include/CGAL/predicates/Regular_triangulation_rtH2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/predicates/Regular_triangulation_rtH2.h
rename to 3rdparty/CGAL/include/CGAL/predicates/Regular_triangulation_rtH2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/predicates/Regular_triangulation_rtH3.h b/3rdparty/CGAL/include/CGAL/predicates/Regular_triangulation_rtH3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/predicates/Regular_triangulation_rtH3.h
rename to 3rdparty/CGAL/include/CGAL/predicates/Regular_triangulation_rtH3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/predicates/Straight_skeleton_pred_ftC2.h b/3rdparty/CGAL/include/CGAL/predicates/Straight_skeleton_pred_ftC2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/predicates/Straight_skeleton_pred_ftC2.h
rename to 3rdparty/CGAL/include/CGAL/predicates/Straight_skeleton_pred_ftC2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/predicates/in_smallest_orthogonalcircle_ftC2.h b/3rdparty/CGAL/include/CGAL/predicates/in_smallest_orthogonalcircle_ftC2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/predicates/in_smallest_orthogonalcircle_ftC2.h
rename to 3rdparty/CGAL/include/CGAL/predicates/in_smallest_orthogonalcircle_ftC2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/predicates/kernel_ftC2.h b/3rdparty/CGAL/include/CGAL/predicates/kernel_ftC2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/predicates/kernel_ftC2.h
rename to 3rdparty/CGAL/include/CGAL/predicates/kernel_ftC2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/predicates/kernel_ftC3.h b/3rdparty/CGAL/include/CGAL/predicates/kernel_ftC3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/predicates/kernel_ftC3.h
rename to 3rdparty/CGAL/include/CGAL/predicates/kernel_ftC3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/predicates/predicates_for_mixed_complex_3.h b/3rdparty/CGAL/include/CGAL/predicates/predicates_for_mixed_complex_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/predicates/predicates_for_mixed_complex_3.h
rename to 3rdparty/CGAL/include/CGAL/predicates/predicates_for_mixed_complex_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/predicates/predicates_for_voronoi_intersection_cartesian_2_3.h b/3rdparty/CGAL/include/CGAL/predicates/predicates_for_voronoi_intersection_cartesian_2_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/predicates/predicates_for_voronoi_intersection_cartesian_2_3.h
rename to 3rdparty/CGAL/include/CGAL/predicates/predicates_for_voronoi_intersection_cartesian_2_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/predicates/predicates_on_weighted_points_cartesian_3.h b/3rdparty/CGAL/include/CGAL/predicates/predicates_on_weighted_points_cartesian_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/predicates/predicates_on_weighted_points_cartesian_3.h
rename to 3rdparty/CGAL/include/CGAL/predicates/predicates_on_weighted_points_cartesian_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/predicates/sign_of_determinant.h b/3rdparty/CGAL/include/CGAL/predicates/sign_of_determinant.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/predicates/sign_of_determinant.h
rename to 3rdparty/CGAL/include/CGAL/predicates/sign_of_determinant.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/predicates_d.h b/3rdparty/CGAL/include/CGAL/predicates_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/predicates_d.h
rename to 3rdparty/CGAL/include/CGAL/predicates_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/predicates_on_lines_2.h b/3rdparty/CGAL/include/CGAL/predicates_on_lines_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/predicates_on_lines_2.h
rename to 3rdparty/CGAL/include/CGAL/predicates_on_lines_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/predicates_on_points_2.h b/3rdparty/CGAL/include/CGAL/predicates_on_points_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/predicates_on_points_2.h
rename to 3rdparty/CGAL/include/CGAL/predicates_on_points_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/predicates_on_points_3.h b/3rdparty/CGAL/include/CGAL/predicates_on_points_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/predicates_on_points_3.h
rename to 3rdparty/CGAL/include/CGAL/predicates_on_points_3.h
diff --git a/3rdparty/CGAL/include/CGAL/primes.h b/3rdparty/CGAL/include/CGAL/primes.h
new file mode 100644
index 0000000..fbff306
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/primes.h
@@ -0,0 +1,332 @@
+// Copyright (c) 2006-2008 Max-Planck-Institute Saarbruecken (Germany).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Michael Hemmer    <hemmer at mpi-inf.mpg.de>
+//
+// =============================================================================
+
+#ifndef CGAL_PRIMES_H
+#define CGAL_PRIMES_H
+
+#include <CGAL/basic.h>
+
+namespace CGAL { 
+namespace internal {
+
+const int primes[2000] = {
+  /*
+  * Generated in SAGE with:
+  *
+  * N = 2000
+  * p = 2^26
+  * L = []
+  * while len(L) < N:
+  *   p = previous_prime(p)
+  *   if GF(p)(2).is_primitive_root():
+  *     L.append(p)
+  * k = 8
+  * for i in range(N/k):
+  *   print '  ' + ', '.join (str(p) for p in L[k*i:k*(i+1)]) + ','
+  */
+  67108859, 67108819, 67108763, 67108757, 67108747, 67108739, 67108709, 67108693,
+  67108669, 67108667, 67108661, 67108597, 67108579, 67108507, 67108493, 67108453,
+  67108387, 67108373, 67108331, 67108219, 67108187, 67108109, 67108037, 67108003,
+  67107941, 67107797, 67107787, 67107773, 67107757, 67107749, 67107707, 67107643,
+  67107541, 67107539, 67107533, 67107461, 67107427, 67107389, 67107323, 67107317,
+  67107301, 67107253, 67107203, 67107149, 67107043, 67106987, 67106821, 67106813,
+  67106797, 67106749, 67106717, 67106693, 67106483, 67106477, 67106357, 67106339,
+  67106323, 67106243, 67106213, 67106189, 67106107, 67106099, 67106093, 67106059,
+  67105963, 67105933, 67105877, 67105867, 67105811, 67105771, 67105763, 67105699,
+  67105691, 67105517, 67105459, 67105453, 67105373, 67105349, 67105267, 67105187,
+  67105141, 67105133, 67105061, 67104997, 67104931, 67104923, 67104893, 67104883,
+  67104859, 67104803, 67104757, 67104707, 67104691, 67104589, 67104581, 67104571,
+  67104563, 67104539, 67104517, 67104437, 67104419, 67104379, 67104341, 67104293,
+  67104277, 67104251, 67104227, 67104139, 67104061, 67104053, 67103963, 67103909,
+  67103867, 67103851, 67103837, 67103821, 67103731, 67103669, 67103653, 67103587,
+  67103579, 67103549, 67103507, 67103483, 67103219, 67103173, 67103149, 67103147,
+  67103107, 67103083, 67103051, 67103027, 67103021, 67102963, 67102949, 67102901,
+  67102843, 67102733, 67102627, 67102613, 67102531, 67102499, 67102459, 67102397,
+  67102333, 67102331, 67102283, 67102237, 67102181, 67102163, 67102099, 67102093,
+  67102069, 67102067, 67102019, 67101997, 67101989, 67101899, 67101883, 67101877,
+  67101779, 67101739, 67101691, 67101637, 67101613, 67101509, 67101493, 67101491,
+  67101469, 67101443, 67101413, 67101341, 67101323, 67101299, 67101187, 67101173,
+  67101053, 67100987, 67100981, 67100963, 67100947, 67100939, 67100909, 67100899,
+  67100861, 67100851, 67100827, 67100773, 67100731, 67100699, 67100669, 67100659,
+  67100653, 67100587, 67100459, 67100357, 67100347, 67100179, 67100141, 67100123,
+  67100101, 67099987, 67099957, 67099931, 67099861, 67099853, 67099829, 67099819,
+  67099699, 67099589, 67099547, 67099541, 67099517, 67099499, 67099397, 67099387,
+  67099363, 67099339, 67099267, 67099213, 67099141, 67099133, 67099037, 67098931,
+  67098923, 67098917, 67098907, 67098827, 67098821, 67098739, 67098653, 67098589,
+  67098419, 67098389, 67098347, 67098341, 67098323, 67098299, 67098277, 67098259,
+  67098203, 67098197, 67098179, 67098149, 67098067, 67098029, 67097917, 67097819,
+  67097813, 67097803, 67097747, 67097699, 67097669, 67097659, 67097579, 67097413,
+  67097363, 67097339, 67097333, 67097291, 67097269, 67097123, 67097053, 67096987,
+  67096979, 67096973, 67096907, 67096867, 67096837, 67096693, 67096669, 67096507,
+  67096499, 67096483, 67096411, 67096387, 67096373, 67096301, 67096109, 67096067,
+  67096021, 67096013, 67095989, 67095971, 67095893, 67095869, 67095797, 67095731,
+  67095701, 67095683, 67095667, 67095659, 67095629, 67095499, 67095421, 67095419,
+  67095349, 67095317, 67095173, 67095139, 67095131, 67095101, 67095037, 67095011,
+  67094987, 67094981, 67094917, 67094899, 67094891, 67094837, 67094827, 67094723,
+  67094717, 67094707, 67094701, 67094581, 67094557, 67094507, 67094501, 67094459,
+  67094437, 67094411, 67094389, 67094309, 67094299, 67094267, 67094141, 67094123,
+  67094099, 67093979, 67093933, 67093931, 67093861, 67093853, 67093757, 67093723,
+  67093699, 67093627, 67093619, 67093613, 67093603, 67093597, 67093547, 67093349,
+  67093307, 67093181, 67093171, 67093163, 67093157, 67093109, 67093069, 67093043,
+  67093003, 67092997, 67092947, 67092869, 67092821, 67092787, 67092757, 67092749,
+  67092709, 67092691, 67092643, 67092611, 67092563, 67092539, 67092491, 67092461,
+  67092419, 67092331, 67092323, 67092301, 67092227, 67092203, 67092197, 67092107,
+  67091987, 67091939, 67091933, 67091923, 67091797, 67091779, 67091771, 67091669,
+  67091611, 67091491, 67091477, 67091443, 67091357, 67091341, 67091243, 67091203,
+  67091149, 67091107, 67091029, 67090979, 67090973, 67090939, 67090861, 67090763,
+  67090627, 67090613, 67090589, 67090579, 67090549, 67090547, 67090523, 67090459,
+  67090451, 67090411, 67090403, 67090307, 67090259, 67090229, 67090189, 67090117,
+  67090099, 67090091, 67090043, 67090027, 67090013, 67089949, 67089829, 67089739,
+  67089733, 67089707, 67089683, 67089587, 67089541, 67089461, 67089299, 67089283,
+  67089277, 67089221, 67089059, 67088963, 67088821, 67088797, 67088779, 67088717,
+  67088683, 67088653, 67088627, 67088621, 67088603, 67088597, 67088573, 67088509,
+  67088501, 67088453, 67088429, 67088381, 67088347, 67088267, 67088117, 67088093,
+  67088059, 67087973, 67087957, 67087901, 67087883, 67087859, 67087723, 67087717,
+  67087637, 67087571, 67087547, 67087459, 67087451, 67087421, 67087277, 67087259,
+  67087243, 67087187, 67087123, 67087019, 67086949, 67086931, 67086917, 67086893,
+  67086869, 67086827, 67086757, 67086667, 67086637, 67086629, 67086611, 67086589,
+  67086421, 67086347, 67086323, 67086317, 67086307, 67086293, 67086259, 67086109,
+  67086067, 67086053, 67086043, 67086013, 67085939, 67085933, 67085899, 67085869,
+  67085867, 67085861, 67085819, 67085813, 67085803, 67085771, 67085741, 67085677,
+  67085531, 67085443, 67085437, 67085429, 67085357, 67085341, 67085267, 67085189,
+  67085173, 67085171, 67085099, 67085093, 67085003, 67084981, 67084973, 67084931,
+  67084861, 67084789, 67084757, 67084709, 67084643, 67084637, 67084603, 67084547,
+  67084517, 67084483, 67084427, 67084349, 67084333, 67084331, 67084309, 67084189,
+  67084187, 67084139, 67084013, 67083883, 67083859, 67083811, 67083803, 67083787,
+  67083739, 67083707, 67083629, 67083619, 67083613, 67083539, 67083517, 67083461,
+  67083437, 67083371, 67083323, 67083221, 67083197, 67083067, 67082989, 67082987,
+  67082963, 67082933, 67082909, 67082891, 67082861, 67082843, 67082779, 67082707,
+  67082699, 67082579, 67082549, 67082531, 67082453, 67082363, 67082339, 67082227,
+  67082189, 67082131, 67082123, 67082101, 67082003, 67081957, 67081829, 67081811,
+  67081787, 67081741, 67081733, 67081709, 67081691, 67081661, 67081579, 67081499,
+  67081477, 67081429, 67081283, 67081237, 67081213, 67081211, 67081139, 67081123,
+  67081051, 67080971, 67080947, 67080917, 67080859, 67080821, 67080803, 67080763,
+  67080701, 67080653, 67080557, 67080491, 67080437, 67080413, 67080323, 67080179,
+  67080173, 67080131, 67080107, 67080061, 67079981, 67079963, 67079941, 67079933,
+  67079917, 67079693, 67079587, 67079491, 67079459, 67079429, 67079347, 67079333,
+  67079323, 67079317, 67079267, 67079237, 67079219, 67079213, 67079203, 67079149,
+  67079141, 67079123, 67079083, 67079027, 67078981, 67078931, 67078877, 67078819,
+  67078813, 67078789, 67078763, 67078643, 67078573, 67078469, 67078387, 67078331,
+  67078309, 67078301, 67078283, 67078213, 67078181, 67078139, 67078133, 67078069,
+  67078061, 67078013, 67077947, 67077917, 67077851, 67077827, 67077797, 67077757,
+  67077643, 67077611, 67077541, 67077539, 67077419, 67077403, 67077379, 67077349,
+  67077341, 67077299, 67077293, 67077259, 67077181, 67077173, 67077133, 67076899,
+  67076869, 67076851, 67076843, 67076803, 67076773, 67076741, 67076693, 67076683,
+  67076677, 67076651, 67076629, 67076627, 67076573, 67076539, 67076413, 67076411,
+  67076357, 67076341, 67076291, 67076189, 67076147, 67076117, 67076077, 67076069,
+  67076029, 67075973, 67075949, 67075933, 67075907, 67075867, 67075787, 67075691,
+  67075669, 67075573, 67075493, 67075373, 67075363, 67075277, 67075243, 67075147,
+  67075109, 67075091, 67075069, 67075067, 67075037, 67074947, 67074901, 67074859,
+  67074853, 67074851, 67074829, 67074691, 67074619, 67074613, 67074611, 67074587,
+  67074523, 67074467, 67074317, 67074307, 67074277, 67074269, 67074179, 67073947,
+  67073917, 67073899, 67073803, 67073731, 67073707, 67073701, 67073683, 67073651,
+  67073603, 67073597, 67073579, 67073533, 67073459, 67073387, 67073339, 67073333,
+  67073323, 67073309, 67073261, 67073197, 67073189, 67073107, 67073051, 67073003,
+  67072997, 67072979, 67072909, 67072877, 67072781, 67072757, 67072739, 67072693,
+  67072541, 67072373, 67072363, 67072339, 67072309, 67072283, 67072277, 67072253,
+  67072139, 67072037, 67071997, 67071989, 67071947, 67071923, 67071899, 67071883,
+  67071877, 67071821, 67071707, 67071637, 67071547, 67071419, 67071413, 67071317,
+  67071299, 67071293, 67071157, 67071149, 67071139, 67071061, 67070989, 67070981,
+  67070909, 67070869, 67070837, 67070827, 67070813, 67070803, 67070749, 67070699,
+  67070621, 67070573, 67070539, 67070459, 67070357, 67070317, 67070291, 67070261,
+  67070251, 67070203, 67070053, 67070027, 67069979, 67069819, 67069813, 67069787,
+  67069781, 67069763, 67069669, 67069661, 67069549, 67069531, 67069469, 67069427,
+  67069397, 67069339, 67069157, 67069133, 67069109, 67069099, 67069043, 67069021,
+  67068971, 67068931, 67068787, 67068653, 67068643, 67068629, 67068571, 67068557,
+  67068539, 67068509, 67068493, 67068371, 67068301, 67068269, 67068259, 67068227,
+  67068203, 67068187, 67068181, 67068173, 67068163, 67068101, 67067971, 67067933,
+  67067909, 67067789, 67067779, 67067773, 67067723, 67067629, 67067597, 67067501,
+  67067453, 67067437, 67067389, 67067387, 67067339, 67067293, 67067269, 67067213,
+  67067173, 67067171, 67067069, 67067059, 67067029, 67066907, 67066861, 67066859,
+  67066771, 67066757, 67066723, 67066709, 67066667, 67066619, 67066613, 67066379,
+  67066277, 67066243, 67066211, 67066157, 67066093, 67066061, 67066019, 67065979,
+  67065931, 67065917, 67065883, 67065827, 67065787, 67065667, 67065659, 67065653,
+  67065643, 67065619, 67065563, 67065461, 67065437, 67065389, 67065373, 67065293,
+  67065283, 67065227, 67065211, 67065157, 67065091, 67064843, 67064827, 67064819,
+  67064773, 67064771, 67064741, 67064717, 67064693, 67064611, 67064597, 67064587,
+  67064579, 67064549, 67064467, 67064299, 67064267, 67064237, 67064213, 67064197,
+  67064171, 67064147, 67064131, 67064093, 67064059, 67063853, 67063813, 67063723,
+  67063643, 67063637, 67063523, 67063517, 67063397, 67063349, 67063307, 67063189,
+  67063163, 67063133, 67063123, 67063099, 67063093, 67063069, 67063043, 67063037,
+  67063019, 67062923, 67062893, 67062883, 67062859, 67062659, 67062629, 67062613,
+  67062539, 67062509, 67062469, 67062461, 67062379, 67062349, 67062299, 67062221,
+  67062179, 67062157, 67062067, 67062029, 67062011, 67061987, 67061947, 67061933,
+  67061909, 67061867, 67061861, 67061789, 67061747, 67061693, 67061627, 67061597,
+  67061563, 67061531, 67061333, 67061299, 67061227, 67061219, 67061179, 67061173,
+  67061147, 67061003, 67060997, 67060957, 67060949, 67060933, 67060837, 67060813,
+  67060627, 67060549, 67060523, 67060517, 67060507, 67060451, 67060421, 67060373,
+  67060333, 67060307, 67060277, 67060261, 67060229, 67060187, 67060171, 67060141,
+  67060109, 67060067, 67060043, 67060027, 67060013, 67059989, 67059907, 67059899,
+  67059869, 67059779, 67059757, 67059749, 67059731, 67059709, 67059701, 67059637,
+  67059613, 67059581, 67059547, 67059533, 67059523, 67059437, 67059427, 67059259,
+  67059173, 67059061, 67058963, 67058941, 67058909, 67058899, 67058891, 67058867,
+  67058843, 67058723, 67058699, 67058669, 67058627, 67058531, 67058389, 67058347,
+  67058339, 67058323, 67058309, 67058269, 67058227, 67058213, 67058141, 67058003,
+  67057883, 67057853, 67057819, 67057813, 67057763, 67057733, 67057723, 67057717,
+  67057709, 67057643, 67057499, 67057493, 67057387, 67057381, 67057379, 67057363,
+  67057307, 67057147, 67057141, 67056989, 67056971, 67056917, 67056877, 67056763,
+  67056677, 67056667, 67056659, 67056637, 67056611, 67056581, 67056461, 67056419,
+  67056371, 67056259, 67056251, 67056179, 67056107, 67056083, 67056053, 67056043,
+  67056013, 67055957, 67055909, 67055843, 67055789, 67055771, 67055629, 67055539,
+  67055491, 67055477, 67055467, 67055347, 67055309, 67055299, 67055291, 67055267,
+  67055243, 67055203, 67055179, 67055147, 67054997, 67054979, 67054907, 67054877,
+  67054859, 67054763, 67054733, 67054717, 67054541, 67054523, 67054483, 67054411,
+  67054387, 67054301, 67054213, 67054051, 67054037, 67053997, 67053971, 67053941,
+  67053893, 67053787, 67053733, 67053659, 67053653, 67053643, 67053629, 67053619,
+  67053563, 67053557, 67053523, 67053517, 67053419, 67053397, 67053373, 67053317,
+  67053251, 67053229, 67053197, 67053179, 67053149, 67053037, 67053029, 67052963,
+  67052939, 67052933, 67052819, 67052813, 67052779, 67052723, 67052677, 67052509,
+  67052477, 67052467, 67052243, 67052021, 67051979, 67051949, 67051909, 67051883,
+  67051861, 67051813, 67051811, 67051781, 67051709, 67051651, 67051643, 67051573,
+  67051571, 67051547, 67051493, 67051379, 67051373, 67051331, 67051253, 67051189,
+  67051181, 67051099, 67051069, 67051021, 67050979, 67050931, 67050917, 67050869,
+  67050827, 67050749, 67050707, 67050701, 67050619, 67050611, 67050541, 67050509,
+  67050443, 67050421, 67050419, 67050371, 67050301, 67050299, 67050251, 67050187,
+  67050101, 67050077, 67049987, 67049981, 67049963, 67049909, 67049891, 67049867,
+  67049837, 67049813, 67049747, 67049707, 67049693, 67049629, 67049627, 67049603,
+  67049573, 67049539, 67049453, 67049413, 67049267, 67049261, 67049251, 67049179,
+  67049149, 67049141, 67049093, 67049027, 67048963, 67048859, 67048819, 67048757,
+  67048733, 67048693, 67048627, 67048621, 67048523, 67048469, 67048411, 67048349,
+  67048277, 67048259, 67048141, 67048123, 67048109, 67047989, 67047859, 67047787,
+  67047763, 67047749, 67047733, 67047731, 67047683, 67047619, 67047613, 67047611,
+  67047581, 67047517, 67047509, 67047413, 67047397, 67047283, 67047131, 67047077,
+  67047061, 67047059, 67047053, 67047037, 67047011, 67046989, 67046939, 67046899,
+  67046797, 67046779, 67046731, 67046549, 67046531, 67046477, 67046467, 67046437,
+  67046429, 67046411, 67046387, 67046363, 67046341, 67046333, 67046261, 67046197,
+  67046107, 67046069, 67046059, 67046051, 67045973, 67045949, 67045907, 67045877,
+  67045723, 67045613, 67045579, 67045571, 67045549, 67045541, 67045507, 67045403,
+  67045339, 67045301, 67045267, 67045261, 67045211, 67045189, 67045133, 67045117,
+  67045109, 67045061, 67045037, 67045019, 67044973, 67044907, 67044829, 67044797,
+  67044779, 67044773, 67044763, 67044739, 67044541, 67044427, 67044371, 67044347,
+  67044301, 67044283, 67044203, 67044157, 67044083, 67044077, 67044067, 67044053,
+  67043981, 67043939, 67043909, 67043813, 67043797, 67043707, 67043507, 67043477,
+  67043443, 67043243, 67043147, 67043107, 67043083, 67043069, 67043059, 67043051,
+  67043027, 67042979, 67042973, 67042949, 67042931, 67042709, 67042643, 67042637,
+  67042589, 67042571, 67042541, 67042523, 67042501, 67042453, 67042427, 67042363,
+  67042307, 67042301, 67042259, 67042211, 67042091, 67042043, 67041907, 67041893,
+  67041869, 67041797, 67041749, 67041731, 67041701, 67041613, 67041581, 67041563,
+  67041547, 67041539, 67041509, 67041467, 67041461, 67041419, 67041371, 67041307,
+  67041283, 67041269, 67041203, 67041187, 67041179, 67041043, 67040917, 67040893,
+  67040789, 67040773, 67040723, 67040629, 67040627, 67040621, 67040587, 67040549,
+  67040509, 67040443, 67040387, 67040381, 67040317, 67040291, 67040261, 67040243,
+  67040219, 67040203, 67040069, 67040021, 67039997, 67039957, 67039883, 67039877,
+  67039867, 67039853, 67039811, 67039757, 67039723, 67039699, 67039669, 67039627,
+  67039613, 67039571, 67039547, 67039501, 67039499, 67039309, 67039307, 67039253,
+  67039187, 67039139, 67039051, 67039003, 67038947, 67038941, 67038877, 67038869,
+  67038827, 67038787, 67038739, 67038637, 67038589, 67038557, 67038539, 67038533,
+  67038427, 67038371, 67038341, 67038299, 67038277, 67038221, 67038197, 67038173,
+  67038149, 67038133, 67038131, 67038067, 67038029, 67038011, 67037843, 67037837,
+  67037819, 67037797, 67037771, 67037723, 67037683, 67037627, 67037603, 67037563,
+  67037483, 67037459, 67037429, 67037389, 67037261, 67037227, 67037213, 67037107,
+  67037101, 67037053, 67036979, 67036909, 67036901, 67036877, 67036867, 67036843,
+  67036819, 67036811, 67036747, 67036643, 67036589, 67036547, 67036507, 67036469,
+  67036397, 67036379, 67036357, 67036259, 67036243, 67036187, 67036181, 67036157,
+  67036093, 67036027, 67036019, 67035989, 67035949, 67035931, 67035901, 67035803,
+  67035707, 67035659, 67035653, 67035643, 67035589, 67035499, 67035491, 67035469,
+  67035413, 67035349, 67035347, 67035307, 67035277, 67035149, 67035107, 67035077,
+  67034987, 67034819, 67034699, 67034683, 67034677, 67034477, 67034419, 67034381,
+  67034339, 67034309, 67034293, 67034171, 67034117, 67034069, 67034021, 67033859,
+  67033763, 67033741, 67033709, 67033699, 67033667, 67033619, 67033613, 67033597,
+  67033541, 67033507, 67033469, 67033429, 67033403, 67033357, 67033331, 67033283,
+  67033277, 67033229, 67033157, 67033117, 67033061, 67032997, 67032941, 67032811,
+  67032803, 67032701, 67032661, 67032653, 67032613, 67032587, 67032541, 67032523,
+  67032517, 67032491, 67032461, 67032451, 67032443, 67032421, 67032389, 67032349,
+  67032347, 67032299, 67032221, 67032179, 67032101, 67031941, 67031933, 67031893,
+  67031851, 67031819, 67031813, 67031749, 67031693, 67031509, 67031483, 67031443,
+  67031429, 67031387, 67031243, 67031219, 67031203, 67031189, 67031149, 67031147,
+  67031123, 67031101, 67031059, 67030963, 67030933, 67030907, 67030867, 67030853,
+  67030757, 67030741, 67030739, 67030693, 67030669, 67030597, 67030517, 67030451,
+  67030427, 67030333, 67030331, 67030181, 67030069, 67030013, 67029947, 67029931,
+  67029923, 67029917, 67029901, 67029811, 67029779, 67029763, 67029749, 67029709,
+  67029707, 67029581, 67029541, 67029509, 67029491, 67029451, 67029437, 67029427,
+  67029421, 67029373, 67029341, 67029323, 67029293, 67029269, 67029253, 67029229,
+  67029077, 67029059, 67029043, 67029013, 67028981, 67028917, 67028771, 67028669,
+  67028653, 67028651, 67028597, 67028557, 67028539, 67028477, 67028413, 67028387,
+  67028243, 67028197, 67028083, 67028069, 67028021, 67027997, 67027963, 67027949,
+  67027931, 67027867, 67027861, 67027811, 67027693, 67027627, 67027619, 67027547,
+  67027507, 67027453, 67027427, 67027339, 67027283, 67027237, 67027189, 67027187,
+  67027069, 67027027, 67027019, 67027013, 67026979, 67026907, 67026829, 67026811,
+  67026803, 67026787, 67026643, 67026613, 67026539, 67026469, 67026467, 67026451,
+  67026437, 67026403, 67026307, 67026299, 67026227, 67026187, 67026139, 67026131,
+  67026109, 67026107, 67026083, 67026067, 67025971, 67025963, 67025957, 67025843,
+  67025779, 67025773, 67025723, 67025701, 67025683, 67025669, 67025579, 67025573,
+  67025531, 67025501, 67025459, 67025411, 67025363, 67025219, 67025213, 67025173,
+  67025107, 67025051, 67025029, 67024987, 67024957, 67024901, 67024891, 67024733,
+  67024637, 67024621, 67024613, 67024499, 67024483, 67024429, 67024411, 67024339,
+  67024157, 67024141, 67024003, 67023989, 67023899, 67023893, 67023779, 67023763,
+  67023667, 67023653, 67023493, 67023443, 67023421, 67023419, 67023371, 67023349,
+  67023347, 67023331, 67023293, 67023259, 67023227, 67023211, 67023179, 67023157,
+  67023139, 67023133, 67023091, 67023059, 67023053, 67023043, 67023037, 67023029,
+  67022869, 67022819, 67022797, 67022723, 67022707, 67022701, 67022699, 67022693,
+  67022539, 67022507, 67022477, 67022467, 67022387, 67022261, 67022243, 67022237,
+  67022213, 67022147, 67022077, 67022027, 67021979, 67021963, 67021901, 67021861,
+  67021741, 67021739, 67021723, 67021637, 67021621, 67021613, 67021499, 67021469,
+  67021459, 67021363, 67021301, 67021237, 67021147, 67021139, 67021099, 67021067,
+  67021043, 67020979, 67020973, 67020917, 67020893, 67020869, 67020797, 67020763,
+  67020683, 67020589, 67020587, 67020557, 67020491, 67020397, 67020323, 67020299,
+  67020251, 67020179, 67020077, 67020053, 67020013, 67019963, 67019867, 67019837,
+  67019819, 67019747, 67019741, 67019653, 67019587, 67019549, 67019483, 67019437,
+  67019371, 67019299, 67019123, 67019077, 67019027, 67019003, 67018997, 67018843,
+  67018837, 67018771, 67018733, 67018717, 67018667, 67018613, 67018499, 67018493,
+  67018429, 67018397, 67018387, 67018309, 67018181, 67018163, 67018141, 67018139,
+  67018069, 67018051, 67017971, 67017931, 67017803, 67017763, 67017733, 67017707,
+  67017677, 67017661, 67017659, 67017571, 67017563, 67017547, 67017413, 67017371,
+  67017299, 67017277, 67017227, 67017211, 67017163, 67017157, 67017107, 67017059,
+  67016869, 67016821, 67016813, 67016723, 67016717, 67016707, 67016693, 67016627,
+  67016611, 67016483, 67016437, 67016387, 67016269, 67016197, 67016189, 67016179,
+};
+
+static inline 
+int get_next_lower_prime(int current_prime){
+    bool is_prime = false;
+    
+    int i;
+    CGAL_precondition_msg(current_prime != 2 ," primes definitely exhausted ");
+
+    if((current_prime <= 7) && (current_prime > 2)){
+        if(current_prime <= 5){
+            if(current_prime == 3)
+                return 2;
+            return 3;
+        }
+        return 5;
+    }                
+    for(i=current_prime-2;(i>1 && !is_prime);i=i-2){
+        int r = 1;
+        for(int j=3; (j <= i/2 && (r != 0)); j++){
+            r = i % j;
+//                std::cout<<"i " <<i<<std::endl;
+//                std::cout<<"j " <<j<<std::endl;
+//                std::cout<<"i%j " <<i%j<<std::endl;
+            if(j==i/2 && r != 0)
+                is_prime = true;
+        }
+    }
+//    CGAL_precondition_msg(is_prime," primes definitely exhausted ");
+    return i+2;
+}
+
+
+}
+}
+
+#endif // CGAL_PRIMES_H
diff --git a/3rdparty/CGAL/include/CGAL/property_map.h b/3rdparty/CGAL/include/CGAL/property_map.h
new file mode 100644
index 0000000..a16bc26
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/property_map.h
@@ -0,0 +1,353 @@
+// Copyright (c) 2008-2009 GeometryFactory and INRIA
+// 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(s)     : Andreas Fabri and Laurent Saboret
+
+#ifndef CGAL_POINT_SET_PROPERTY_MAP_H
+#define CGAL_POINT_SET_PROPERTY_MAP_H
+
+#include <CGAL/value_type_traits.h>
+
+#include <boost/version.hpp>
+#if BOOST_VERSION >= 104000
+  #include <boost/property_map/property_map.hpp>
+#else
+  #include <boost/property_map.hpp>
+  #include <boost/vector_property_map.hpp>
+
+#endif
+#include <boost/tuple/tuple.hpp>
+
+#include <utility> // defines std::pair
+
+namespace CGAL {
+
+/// \cond SKIP_DOXYGEN
+
+
+template <typename PM1, typename PM2>
+class OR_property_map {
+  typedef typename PM1::key_type key_type;
+  typedef typename PM1::value_type value_type;
+  typedef typename PM1::reference reference;
+  typedef boost::read_write_property_map_tag category;
+
+  PM1 pm1;
+  PM2 pm2;
+
+ public:
+  OR_property_map(PM1 pm1, PM2 pm2)
+    : pm1(pm1),pm2(pm2)
+  {}
+
+  inline friend
+    value_type
+    get(const OR_property_map& pm, const key_type& k)
+  {
+    return get(pm.pm1,k) || get(pm.pm2,k);
+  }
+
+  inline friend
+    void
+  put(OR_property_map& pm, const key_type& k, const value_type& v)
+  {
+    put(pm.pm1,k, v);
+    put(pm.pm2,k, v);
+  }
+
+};
+
+/// Property map that accesses a value from an iterator
+///
+/// \cgalModels `ReadablePropertyMap`
+///
+/// \tparam InputIterator an input iterator
+/// \endcond
+template<class InputIterator>
+struct Input_iterator_property_map{
+  typedef InputIterator key_type;
+  typedef typename std::iterator_traits<InputIterator>::value_type value_type;
+  typedef typename std::iterator_traits<InputIterator>::reference reference;
+  typedef boost::readable_property_map_tag category;
+
+  /// Free function to use a get the value from an iterator using Input_iterator_property_map.
+  inline friend
+  reference
+  get(Input_iterator_property_map<InputIterator>,InputIterator it){ return *it; }
+};
+
+/// \ingroup PkgProperty_map
+/// Property map that converts a `T*` pointer (or in general an iterator
+/// over `T` elements) to the `T` object.
+///
+/// \cgalModels `LvaluePropertyMap`
+template <typename T>
+struct Dereference_property_map
+  : public boost::put_get_helper<T&, Dereference_property_map<T> >
+{
+  typedef T* key_type; ///< typedef to 'T*'
+  typedef T value_type; ///< typedef to 'T'
+  typedef const value_type& reference; ///< typedef to 'T&'
+  typedef boost::lvalue_property_map_tag category; ///< `boost::lvalue_property_map_tag`
+
+  /// Access a property map element.
+  ///
+  /// @tparam Iter Type convertible to `key_type`.
+  template <class Iter>
+  value_type& operator[](Iter it) const { return reference(*it); }
+};
+
+/// Free function to create a `Dereference_property_map` property map.
+///
+/// \relates Dereference_property_map 
+template <class Iter> // Type convertible to `key_type`
+Dereference_property_map<typename CGAL::value_type_traits<Iter>::type>
+make_dereference_property_map(Iter)
+{
+  // value_type_traits is a workaround as back_insert_iterator's `value_type` is void
+  return Dereference_property_map<typename CGAL::value_type_traits<Iter>::type>();
+}
+
+/// \ingroup PkgProperty_map
+/// A `LvaluePropertyMap` property map mapping a key to itself (by reference).
+///
+/// \cgalModels `LvaluePropertyMap`
+template <typename T>
+struct Identity_property_map
+{
+  typedef T key_type; ///< typedef to `T`
+  typedef T value_type; ///< typedef to `T`
+  typedef const T& reference; ///< typedef to `T&`
+  typedef boost::lvalue_property_map_tag category; ///< `boost::lvalue_property_map_tag`
+  /// Access a property map element.
+  /// @param k a key which is returned as mapped value.
+  value_type& operator[](key_type& k) const { return k; }
+
+  typedef Identity_property_map<T> Self;
+  /// \name Put/get free functions
+  /// @{
+  friend reference get(const Self&,const key_type& k) {return k;}
+  friend void put(const Self&,key_type& k, const value_type& v) {k=v;}
+  /// @}
+};
+
+/// Free function to create a `Identity_property_map` property map.
+///
+/// \relates Identity_property_map 
+template <class T> // Key and value type
+Identity_property_map<T>
+  make_identity_property_map(T)
+{
+  return Identity_property_map<T>();
+}
+
+
+/// \ingroup PkgProperty_map
+/// Property map that accesses the first item of a `std::pair`. 
+/// \tparam Pair Instance of `std::pair`. 
+/// \cgalModels `LvaluePropertyMap`
+///
+/// \sa `CGAL::Second_of_pair_property_map<Pair>`
+template <typename Pair>
+struct First_of_pair_property_map
+{
+  typedef Pair key_type; ///< typedef to `Pair`
+  typedef typename Pair::first_type value_type; ///< typedef to `Pair::first_type`
+  typedef const value_type& reference; ///< typedef to `value_type&`
+  typedef boost::lvalue_property_map_tag category; ///< boost::lvalue_property_map_tag
+
+  /// Access a property map element.
+  /// @param pair a key whose first item is accessed
+  value_type& operator[](key_type& pair) const { return pair.first; }
+
+  typedef First_of_pair_property_map<Pair> Self;
+  /// \name Put/get free functions
+  /// @{
+  friend reference get(const Self&,const key_type& k) {return k.first;}
+  friend void put(const Self&,key_type& k, const value_type& v) {k.first=v;}
+  /// @}
+};
+
+/// Free function to create a `First_of_pair_property_map` property map. 
+///
+/// \relates First_of_pair_property_map 
+template <class Pair> // Pair type
+First_of_pair_property_map<Pair>
+  make_first_of_pair_property_map(Pair)
+{
+  return First_of_pair_property_map<Pair>();
+}
+
+/// \ingroup PkgProperty_map
+/// 
+/// Property map that accesses the second item of a `std::pair`. 
+/// 
+/// \tparam Pair Instance of `std::pair`. 
+/// 
+/// \cgalModels `LvaluePropertyMap`
+/// 
+/// \sa `CGAL::First_of_pair_property_map<Pair>`
+template <typename Pair>
+struct Second_of_pair_property_map
+{
+  typedef Pair key_type; ///< typedef to `Pair`
+  typedef typename Pair::second_type value_type; ///< typedef to `Pair::first_type`
+  typedef const value_type& reference; ///< typedef to `value_type&`
+  typedef boost::lvalue_property_map_tag category; ///< boost::lvalue_property_map_tag
+
+  /// Access a property map element.
+  /// @param pair a key whose second item is accessed
+  value_type& operator[](key_type& pair) const { return pair.second; }
+
+  typedef Second_of_pair_property_map<Pair> Self;
+  /// \name Put/get free functions
+  /// @{
+  friend reference get(const Self&,const key_type& k) {return k.second;}
+  friend void put(const Self&,key_type& k, const value_type& v) {k.second=v;}
+  /// @}
+};
+
+/// Free function to create a Second_of_pair_property_map property map.
+///
+/// \relates Second_of_pair_property_map 
+template <class Pair> // Pair type
+Second_of_pair_property_map<Pair>
+  make_second_of_pair_property_map(Pair)
+{
+  return Second_of_pair_property_map<Pair>();
+}
+
+/// \ingroup PkgProperty_map
+/// 
+/// Property map that accesses the Nth item of a `boost::tuple`. 
+/// 
+/// \tparam N %Index of the item to access.
+/// \tparam Tuple Instance of `boost::tuple`.
+/// 
+/// \cgalModels `LvaluePropertyMap`
+template <int N, typename Tuple>
+struct Nth_of_tuple_property_map
+{
+  typedef Tuple key_type; ///< typedef to `Tuple`
+  typedef typename boost::tuples::element<N,Tuple>::type value_type; ///< typedef to `boost::tuples::element<N,Tuple>::%type`
+  typedef const value_type& reference; ///< typedef to `value_type&`
+  typedef boost::lvalue_property_map_tag category; ///< `boost::lvalue_property_map_tag`
+  /// Access a property map element.
+  /// @param tuple a key whose Nth item is accessed
+  value_type& operator[](key_type& tuple) const { return tuple.template get<N>(); }
+
+  typedef Nth_of_tuple_property_map<N,Tuple> Self;
+  /// \name Put/get free functions
+  /// @{
+  friend reference get(const Self&,const key_type& k) {return k.template get<N>();}
+  friend void put(const Self&,key_type& k, const value_type& v) {k.template get<N>()=v;}
+  /// @}
+};
+
+/// Free function to create a Nth_of_tuple_property_map property map.
+///
+/// \relates Nth_of_tuple_property_map
+template <int N, class Tuple> // Tuple type
+Nth_of_tuple_property_map<N, Tuple>
+  make_nth_of_tuple_property_map(Tuple)
+{
+  return Nth_of_tuple_property_map<N, Tuple>();
+}
+
+/// \ingroup PkgProperty_map
+/// Struct that turns a property map into a unary functor with
+/// `operator()(key k)` calling the get function with `k`
+template <class PropertyMap>
+struct Property_map_to_unary_function{
+  typedef typename boost::property_traits<PropertyMap>::key_type argument_type;
+  typedef typename boost::property_traits<PropertyMap>::reference result_type;
+
+  PropertyMap map;
+  Property_map_to_unary_function(PropertyMap m=PropertyMap())
+    : map(m)
+  {}
+
+  template <class KeyType>
+  result_type
+  operator()(const KeyType& a) const
+  {
+    return get(map,a);
+  }
+};
+
+/// \ingroup PkgProperty_map
+/// Utility class providing shortcuts to property maps based on raw pointers
+template <class T>
+struct Pointer_property_map{
+  typedef boost::iterator_property_map< T*,
+                              boost::typed_identity_property_map<std::size_t>,
+                              T,
+                              T&> type; ///< mutable `LvaluePropertyMap`
+  typedef boost::iterator_property_map< const T*,
+                              boost::typed_identity_property_map<std::size_t>,
+                              T,
+                              const T&> const_type; ///< non-mutable `LvaluePropertyMap`
+};
+
+/// \ingroup PkgProperty_map
+/// Starting from boost 1.55, the use of raw pointers as property maps has been deprecated.
+/// This function is a shortcut to the recommanded replacement:
+/// `boost::make_iterator_property_map(<pointer>, boost::typed_identity_property_map<std::size_t>())`
+/// Note that the property map is a mutable `LvaluePropertyMap` with `std::size_t` as key.
+template <class T>
+inline
+typename Pointer_property_map<T>::type
+make_property_map(T* pointer)
+{
+  return typename Pointer_property_map<T>::type(pointer);
+}
+
+/// \ingroup PkgProperty_map
+/// equivalent to `make_property_map(&v[0])`
+/// Note that `v` must not be modified while using the property map created
+template <class T>
+inline
+typename Pointer_property_map<T>::type
+make_property_map(std::vector<T>& v)
+{
+  return make_property_map(&v[0]);
+}
+
+/// \ingroup PkgProperty_map
+/// Non-mutable version
+template <class T>
+inline
+typename Pointer_property_map<T>::const_type
+make_property_map(const T* pointer)
+{
+  return typename Pointer_property_map<T>::const_type(pointer);
+}
+
+/// \ingroup PkgProperty_map
+/// equivalent to `make_property_map(&v[0])`
+/// Note that `v` must not be modified while using the property map created
+template <class T>
+inline
+typename Pointer_property_map<T>::const_type
+make_property_map(const std::vector<T>& v)
+{
+  return make_property_map(&v[0]);
+}
+
+} // namespace CGAL
+
+#endif // CGAL_POINT_SET_PROPERTY_MAP_H
diff --git a/3rdparty/CGAL/include/CGAL/radial_orient_normals.h b/3rdparty/CGAL/include/CGAL/radial_orient_normals.h
new file mode 100644
index 0000000..ebd1dd0
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/radial_orient_normals.h
@@ -0,0 +1,180 @@
+// Copyright (c) 2007-08  INRIA Sophia-Antipolis (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
+// 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(s) : Laurent Saboret
+
+#ifndef CGAL_RADIAL_ORIENT_NORMALS_H
+#define CGAL_RADIAL_ORIENT_NORMALS_H
+
+#include <CGAL/Origin.h>
+#include <CGAL/trace.h>
+#include <CGAL/property_map.h>
+#include <CGAL/point_set_processing_assertions.h>
+
+#include <deque>
+#include <math.h>
+
+namespace CGAL {
+
+/// \cond SKIP_IN_MANUAL
+
+/// Radial orientation of the `[first, beyond)` range of points.
+/// Normals are oriented towards exterior of the point set.
+/// This very fast method is intended to convex objects.
+///
+/// This method modifies the order of input points so as to pack all oriented points first,
+/// and returns an iterator over the first point with an unoriented normal (see erase-remove idiom).
+/// For this reason it should not be called on sorted containers.
+///
+/// \pre normals must be unit vectors
+///
+/// @tparam ForwardIterator iterator over input points.
+/// @tparam PointPMap is a model of `ReadablePropertyMap` with value type `Point_3<Kernel>`.
+///        It can be omitted if the value type of `ForwardIterator` is convertible to `Point_3<Kernel>`.
+/// @tparam NormalPMap is a model of `ReadWritePropertyMap` with value type `Vector_3<Kernel>`.
+/// @tparam Kernel Geometric traits class.
+///        It can be omitted and deduced automatically from the value type of `PointPMap`.
+///
+/// @return iterator over the first point with an unoriented normal.
+
+// This variant requires all parameters.
+template <typename ForwardIterator,
+          typename PointPMap,
+          typename NormalPMap,
+          typename Kernel
+>
+ForwardIterator
+radial_orient_normals(
+    ForwardIterator first,  ///< iterator over the first input point.
+    ForwardIterator beyond, ///< past-the-end iterator over the input points.
+    PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3.
+    NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3.
+    const Kernel& kernel) ///< geometric traits.
+{
+    CGAL_TRACE("Calls radial_orient_normals()\n");
+
+    // Input points types
+    typedef typename std::iterator_traits<ForwardIterator>::value_type Enriched_point;
+    typedef typename boost::property_traits<PointPMap>::value_type Point;
+    typedef typename boost::property_traits<NormalPMap>::value_type Vector;
+    typedef typename boost::property_traits<PointPMap>::reference Point_ref;
+    typedef typename boost::property_traits<NormalPMap>::reference Vector_ref;
+    typedef typename Kernel::FT FT;
+
+    // Precondition: at least one element in the container.
+    CGAL_point_set_processing_precondition(first != beyond);
+
+    // Find points barycenter.
+    // Note: We should use CGAL::centroid() from PCA component.
+    //       Unfortunately, it is not compatible with property maps.
+    Vector sum = CGAL::NULL_VECTOR;
+    int nb_points = 0;
+    for (ForwardIterator it = first; it != beyond; it++)
+    {
+      Point_ref point = get(point_pmap, *it);
+      sum = sum + (point - CGAL::ORIGIN);
+      nb_points++;
+    }
+    Point barycenter = CGAL::ORIGIN + sum / (FT)nb_points;
+
+    // Iterates over input points and orients normals towards exterior of the point set.
+    // Copy points with robust normal orientation to oriented_points[], the others to unoriented_points[].
+    std::deque<Enriched_point> oriented_points, unoriented_points;
+    for (ForwardIterator it = first; it != beyond; it++)
+    {
+      Point_ref point = get(point_pmap, *it);
+
+      // Radial vector towards exterior of the point set
+      Vector vec1 = point - barycenter;
+
+      // Point's normal
+      Vector_ref vec2 = get(normal_pmap, *it);
+      
+      //         ->               ->
+      // Orients vec2 parallel to vec1
+      double dot = vec1 * vec2;
+      if (dot < 0)
+        vec2 = -vec2;
+
+      put(normal_pmap, *it, vec2);
+
+      // Is orientation robust?
+      bool oriented = (std::abs(dot) > std::cos(80.*CGAL_PI/180.)); // robust iff angle < 80 degrees
+      if (oriented)
+        oriented_points.push_back(*it);
+      else
+        unoriented_points.push_back(*it);
+    }
+
+    // Replaces [first, beyond) range by the content of oriented_points[], then unoriented_points[].
+    ForwardIterator first_unoriented_point =
+      std::copy(oriented_points.begin(), oriented_points.end(), first);
+    std::copy(unoriented_points.begin(), unoriented_points.end(), first_unoriented_point);
+
+    CGAL_TRACE("  => %u normals are unoriented\n", unoriented_points.size());
+    CGAL_TRACE("End of radial_orient_normals()\n");
+
+    return first_unoriented_point;
+}
+
+/// @cond SKIP_IN_MANUAL
+// This variant deduces the kernel from the iterator type.
+template <typename ForwardIterator,
+          typename PointPMap,
+          typename NormalPMap
+>
+ForwardIterator
+radial_orient_normals(
+    ForwardIterator first,  ///< iterator over the first input point.
+    ForwardIterator beyond, ///< past-the-end iterator over the input points.
+    PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3.
+    NormalPMap normal_pmap) ///< property map: value_type of ForwardIterator -> Vector_3.
+{
+    typedef typename boost::property_traits<PointPMap>::value_type Point;
+    typedef typename Kernel_traits<Point>::Kernel Kernel;
+    return radial_orient_normals(
+      first,beyond,
+      point_pmap, normal_pmap, 
+      Kernel());
+}
+/// @endcond
+
+/// @cond SKIP_IN_MANUAL
+// This variant creates a default point property map = Identity_property_map.
+template <typename ForwardIterator,
+          typename NormalPMap
+>
+ForwardIterator
+radial_orient_normals(
+    ForwardIterator first,  ///< iterator over the first input point.
+    ForwardIterator beyond, ///< past-the-end iterator over the input points.
+    NormalPMap normal_pmap) ///< property map: value_type of ForwardIterator -> Vector_3.
+{
+    return radial_orient_normals(
+      first,beyond,
+      make_identity_property_map(
+      typename std::iterator_traits<ForwardIterator>::value_type()),
+      normal_pmap);
+}
+/// @endcond
+
+/// @endcond
+
+
+} //namespace CGAL
+
+#endif // CGAL_RADIAL_ORIENT_NORMALS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/random_convex_hull_in_disc_2.h b/3rdparty/CGAL/include/CGAL/random_convex_hull_in_disc_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/random_convex_hull_in_disc_2.h
rename to 3rdparty/CGAL/include/CGAL/random_convex_hull_in_disc_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/random_convex_set_2.h b/3rdparty/CGAL/include/CGAL/random_convex_set_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/random_convex_set_2.h
rename to 3rdparty/CGAL/include/CGAL/random_convex_set_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/random_polygon_2.h b/3rdparty/CGAL/include/CGAL/random_polygon_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/random_polygon_2.h
rename to 3rdparty/CGAL/include/CGAL/random_polygon_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/random_selection.h b/3rdparty/CGAL/include/CGAL/random_selection.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/random_selection.h
rename to 3rdparty/CGAL/include/CGAL/random_selection.h
diff --git a/3rdparty/CGAL/include/CGAL/random_simplify_point_set.h b/3rdparty/CGAL/include/CGAL/random_simplify_point_set.h
new file mode 100644
index 0000000..c22878a
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/random_simplify_point_set.h
@@ -0,0 +1,119 @@
+// Copyright (c) 2007-09  INRIA Sophia-Antipolis (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
+// 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(s) : Laurent Saboret
+
+#ifndef CGAL_RANDOM_SIMPLIFY_POINT_SET_H
+#define CGAL_RANDOM_SIMPLIFY_POINT_SET_H
+
+#include <CGAL/Kernel_traits.h>
+#include <CGAL/property_map.h>
+#include <CGAL/point_set_processing_assertions.h>
+
+#include <iterator>
+#include <set>
+#include <algorithm>
+#include <cmath>
+
+namespace CGAL {
+
+/// \ingroup PkgPointSetProcessing
+/// Randomly deletes a user-specified fraction of the input points.
+///
+/// This method modifies the order of input points so as to pack all remaining points first,
+/// and returns an iterator over the first point to remove (see erase-remove idiom).
+/// For this reason it should not be called on sorted containers.
+///
+/// @tparam ForwardIterator iterator over input points.
+/// @tparam PointPMap is a model of `ReadablePropertyMap` with value type `Point_3<Kernel>`.
+///        It can be omitted if the value type of `ForwardIterator` is convertible to `Point_3<Kernel>`.
+/// @tparam Kernel Geometric traits class.
+///        It can be omitted and deduced automatically from the value type of `PointPMap`.
+///
+/// @return iterator over the first point to remove.
+
+// This variant requires all parameters.
+template <typename ForwardIterator,
+          typename PointPMap,
+          typename Kernel
+>
+ForwardIterator
+random_simplify_point_set(
+  ForwardIterator first,  ///< iterator over the first input point.
+  ForwardIterator beyond, ///< past-the-end iterator over the input points.
+  PointPMap /*point_pmap*/, ///< property map: value_type of ForwardIterator -> Point_3
+  double removed_percentage, ///< percentage of points to remove.
+  const Kernel& /*kernel*/) ///< geometric traits.
+{
+  CGAL_point_set_processing_precondition(removed_percentage >= 0 && removed_percentage <= 100);
+
+  // Random shuffle
+  std::random_shuffle (first, beyond);
+
+  // Computes first iterator to remove
+  std::size_t nb_points = std::distance(first, beyond);
+  std::size_t first_index_to_remove = (std::size_t)(double(nb_points) * ((100.0-removed_percentage)/100.0));
+  ForwardIterator first_point_to_remove = first;
+  std::advance(first_point_to_remove, first_index_to_remove);
+
+  return first_point_to_remove;
+}
+
+/// @cond SKIP_IN_MANUAL
+// This variant deduces the kernel from the iterator type.
+template <typename ForwardIterator,
+          typename PointPMap
+>
+ForwardIterator
+random_simplify_point_set(
+  ForwardIterator first, ///< iterator over the first input point
+  ForwardIterator beyond, ///< past-the-end iterator
+  PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3
+  double removed_percentage) ///< percentage of points to remove
+{
+  typedef typename boost::property_traits<PointPMap>::value_type Point;
+  typedef typename Kernel_traits<Point>::Kernel Kernel;
+  return random_simplify_point_set(
+    first,beyond,
+    point_pmap,
+    removed_percentage,
+    Kernel());
+}
+/// @endcond
+
+/// @cond SKIP_IN_MANUAL
+// This variant creates a default point property map = Identity_property_map.
+template <typename ForwardIterator
+>
+ForwardIterator
+random_simplify_point_set(
+  ForwardIterator first, ///< iterator over the first input point
+  ForwardIterator beyond, ///< past-the-end iterator
+  double removed_percentage) ///< percentage of points to remove
+{
+  return random_simplify_point_set(
+    first,beyond,
+    make_identity_property_map(
+    typename std::iterator_traits<ForwardIterator>::value_type()),
+    removed_percentage);
+}
+/// @endcond
+
+
+} //namespace CGAL
+
+#endif // CGAL_RANDOM_SIMPLIFY_POINT_SET_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/range_search_delaunay_2.h b/3rdparty/CGAL/include/CGAL/range_search_delaunay_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/range_search_delaunay_2.h
rename to 3rdparty/CGAL/include/CGAL/range_search_delaunay_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/rational_rotation.h b/3rdparty/CGAL/include/CGAL/rational_rotation.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/rational_rotation.h
rename to 3rdparty/CGAL/include/CGAL/rational_rotation.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/read_vtk_image_data.h b/3rdparty/CGAL/include/CGAL/read_vtk_image_data.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/read_vtk_image_data.h
rename to 3rdparty/CGAL/include/CGAL/read_vtk_image_data.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/rectangular_3_center_2.h b/3rdparty/CGAL/include/CGAL/rectangular_3_center_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/rectangular_3_center_2.h
rename to 3rdparty/CGAL/include/CGAL/rectangular_3_center_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/rectangular_p_center_2.h b/3rdparty/CGAL/include/CGAL/rectangular_p_center_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/rectangular_p_center_2.h
rename to 3rdparty/CGAL/include/CGAL/rectangular_p_center_2.h
diff --git a/3rdparty/CGAL/include/CGAL/refine_mesh_3.h b/3rdparty/CGAL/include/CGAL/refine_mesh_3.h
new file mode 100644
index 0000000..077a5b8
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/refine_mesh_3.h
@@ -0,0 +1,504 @@
+// Copyright (c) 2009 INRIA Sophia-Antipolis (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
+// 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(s)     : Stephane Tayeb
+//
+//******************************************************************************
+// File Description : refine_mesh_3 function declaration and implementation.
+//******************************************************************************
+
+#ifndef CGAL_REFINE_MESH_3_H
+#define CGAL_REFINE_MESH_3_H
+
+#include <CGAL/config.h>
+#include <CGAL/Mesh_3/config.h>
+#include <CGAL/Mesh_3/Dump_c3t3.h>
+#include <CGAL/Mesh_3/global_parameters.h>
+#include <CGAL/Mesh_3/Mesher_3.h>
+#include <CGAL/optimize_mesh_3.h>
+
+namespace CGAL {
+
+  namespace details {
+    
+    /**
+     * @class Insert_vertex_in_c3t3
+     *
+     * A functor designed to insert unweighted points into the triangulation
+     * of a C3T3 from C3T3::Tr::Vertex , keeping the dimension and indices.
+     */
+    template <typename C3T3>
+    class Insert_vertex_in_c3t3
+    {
+    private:
+      typedef typename C3T3::Vertex_handle          Vertex_handle;
+      typedef typename C3T3::Index                  Index;
+      
+      typedef typename C3T3::Triangulation          Tr;
+      typedef typename Tr::Vertex                   Vertex;
+      typedef typename Tr::Point                    Weighted_point;
+      typedef typename Tr::Point::Weight            Weight;
+      
+    public:
+      Insert_vertex_in_c3t3(C3T3& c3t3)
+        : r_c3t3_(c3t3) {}
+      
+      void operator()(const Vertex& vertex) const
+      {
+        // Get vh properties
+        int dimension = vertex.in_dimension();
+        Weight w = (dimension < 2) ? vertex.point().weight() : 0;
+        Weighted_point point(vertex.point().point(),w);
+        Index index = vertex.index();
+
+        // Insert point and restore handle properties
+        Vertex_handle new_vertex = r_c3t3_.triangulation().insert(point);
+        r_c3t3_.set_index(new_vertex, index);
+        r_c3t3_.set_dimension(new_vertex, dimension);
+
+#if defined(CGAL_LINKED_WITH_TBB)\
+ && !defined(CGAL_PARALLEL_MESH_3_DO_NOT_ADD_OUTSIDE_POINTS_ON_A_FAR_SPHERE)
+        if (boost::is_convertible<typename C3T3::Concurrency_tag, CGAL::Parallel_tag>::value)
+        {
+          if (dimension == -1)
+            r_c3t3_.add_far_point(new_vertex);
+        }
+#endif
+#ifdef CGAL_SEQUENTIAL_MESH_3_ADD_OUTSIDE_POINTS_ON_A_FAR_SPHERE
+        if (boost::is_convertible<typename C3T3::Concurrency_tag, CGAL::Sequential_tag>::value)
+        {
+          if (dimension == -1)
+            r_c3t3_.add_far_point(new_vertex);
+        }
+#endif
+      }
+
+    private:
+      C3T3& r_c3t3_;
+    };
+  }
+  
+  
+namespace parameters {
+  
+  namespace internal {
+    
+    const int undef_parameter = -1;
+    
+    // Helpers
+    struct Optimization_options_base
+    {
+      Optimization_options_base(bool b)
+      : b_(b), time_limit_(undef_parameter), bound_(undef_parameter) {}
+      
+      operator bool() const { return b_; }
+      
+      bool is_time_limit_set() const { return time_limit_ != undef_parameter; }
+      void set_time_limit(double d) { time_limit_ = d; }
+      double time_limit() const { return time_limit_; }
+      
+      bool is_bound_set() const { return bound_ != undef_parameter; }
+      void set_bound(double d) { bound_ = d; }
+      double bound() const { return bound_; }
+      
+    private:
+      bool b_;
+      double time_limit_;
+      double bound_;
+    };
+    
+    struct Global_optimization_options_base
+    {
+      Global_optimization_options_base()
+      : convergence_(undef_parameter), max_it_nb_(undef_parameter) {}
+      
+      bool is_convergence_set() const { return convergence_ != undef_parameter; }
+      void set_convergence(double d) { convergence_ = d; }
+      double convergence() const { return convergence_; }
+      
+      bool is_max_iteration_number_set() const { return max_it_nb_ != undef_parameter; }
+      void set_max_iteration_number(int i) { max_it_nb_ = i; }
+      int max_iteration_number() const { return max_it_nb_; }
+      
+    private:
+      double convergence_;
+      int max_it_nb_; 
+    };
+    
+    // Perturb
+    struct Perturb_options : public Optimization_options_base
+    {
+      Perturb_options(bool b) : Optimization_options_base(b) {}
+    };
+    
+    // Exude
+    struct Exude_options : public Optimization_options_base
+    {
+      Exude_options(bool b) : Optimization_options_base(b) {}
+    };
+    
+    // Odt
+    struct Odt_options : public Optimization_options_base
+    , public Global_optimization_options_base
+    {
+      Odt_options(bool b) : Optimization_options_base(b)
+      , Global_optimization_options_base() {}
+    };
+    
+    // Lloyd
+    struct Lloyd_options : public Optimization_options_base
+    , public Global_optimization_options_base
+    {
+      Lloyd_options(bool b) : Optimization_options_base(b)
+      , Global_optimization_options_base() {}
+    };
+
+    // Various Mesh_3 option
+    struct Mesh_3_options {
+      Mesh_3_options() 
+        : dump_after_init_prefix()
+        , dump_after_refine_surface_prefix()
+        , dump_after_refine_prefix()
+        , dump_after_glob_opt_prefix()
+        , dump_after_perturb_prefix()
+        , dump_after_exude_prefix()
+        , number_of_initial_points()
+      {}
+
+      std::string dump_after_init_prefix;
+      std::string dump_after_refine_surface_prefix;
+      std::string dump_after_refine_prefix;
+      std::string dump_after_glob_opt_prefix;
+      std::string dump_after_perturb_prefix;
+      std::string dump_after_exude_prefix;
+      int number_of_initial_points;
+
+    }; // end struct Mesh_3_options
+
+  } // end namespace internal
+
+// see <CGAL/config.h>
+CGAL_PRAGMA_DIAG_PUSH
+// see <CGAL/Mesh_3/config.h>
+CGAL_MESH_3_IGNORE_BOOST_PARAMETER_NAME_WARNINGS
+
+
+  // -----------------------------------
+  // Perturb
+  // -----------------------------------
+  BOOST_PARAMETER_FUNCTION((internal::Perturb_options), perturb, tag,
+                           (optional (time_limit_, *, internal::undef_parameter )
+                                     (sliver_bound_, *, default_values::perturb_sliver_bound )))
+  { 
+    internal::Perturb_options options(true);
+    
+    if ( internal::undef_parameter != time_limit_ )
+      options.set_time_limit(time_limit_);
+    
+    options.set_bound(sliver_bound_);
+    
+    return options;
+  }
+  
+  inline internal::Perturb_options no_perturb() { return internal::Perturb_options(false); }
+  
+  // -----------------------------------
+  // Exude
+  // -----------------------------------
+  BOOST_PARAMETER_FUNCTION((internal::Exude_options), exude, tag,
+                           (optional (time_limit_, *, internal::undef_parameter )
+                                     (sliver_bound_, *, default_values::exude_sliver_bound )))
+  { 
+    internal::Exude_options options(true);
+    
+    if ( internal::undef_parameter != time_limit_ )
+      options.set_time_limit(time_limit_);
+
+    options.set_bound(sliver_bound_);
+    
+    return options;
+  }
+  
+  inline internal::Exude_options no_exude() { return internal::Exude_options(false); }
+  
+  // -----------------------------------
+  // Odt
+  // -----------------------------------
+  BOOST_PARAMETER_FUNCTION((internal::Odt_options), odt, tag,
+                           (optional (time_limit_, *, 0 )
+                                     (max_iteration_number_, *, 0 )
+                                     (convergence_, *, default_values::odt_convergence_ratio )
+                                     (freeze_bound_, *, default_values::odt_freeze_ratio )))
+  { 
+    internal::Odt_options options(true);
+
+    options.set_time_limit(time_limit_);
+    options.set_bound(freeze_bound_);
+    options.set_convergence(convergence_);
+    options.set_max_iteration_number(max_iteration_number_);
+    
+    return options;
+  }
+  
+  inline internal::Odt_options no_odt() { return internal::Odt_options(false); }
+  
+  // -----------------------------------
+  // Lloyd
+  // -----------------------------------
+  BOOST_PARAMETER_FUNCTION((internal::Lloyd_options), lloyd, tag,
+                           (optional (time_limit_, *, 0 )
+                                     (max_iteration_number_, *, 0 )
+                                     (convergence_, *, default_values::lloyd_convergence_ratio )
+                                     (freeze_bound_, *, default_values::lloyd_freeze_ratio )))
+  { 
+    internal::Lloyd_options options(true);
+    
+    options.set_time_limit(time_limit_);
+    options.set_bound(freeze_bound_);
+    options.set_convergence(convergence_);
+    options.set_max_iteration_number(max_iteration_number_);
+    
+    return options;
+  }
+  
+  inline internal::Lloyd_options no_lloyd() { return internal::Lloyd_options(false); }
+  
+  // Mesh options
+  // -----------------------------------
+
+  // Undocumented Boost parameter for refine_mesh_3 and make_mesh_3.
+  // Allows to dump the mesh at given stage of the mesh generation
+  // algorithm.
+  BOOST_PARAMETER_FUNCTION((internal::Mesh_3_options), mesh_3_options, tag,
+                           (optional 
+                            (dump_after_init_prefix_, (std::string), "" )
+                            (dump_after_refine_surface_prefix_, (std::string), "" )
+                            (dump_after_refine_prefix_, (std::string), "" )
+                            (dump_after_glob_opt_prefix_, (std::string), "" )
+                            (dump_after_perturb_prefix_, (std::string), "" )
+                            (dump_after_exude_prefix_, (std::string), "" )
+                            (number_of_initial_points_, (int), -1)
+                            )
+                           )
+  { 
+    internal::Mesh_3_options options;
+
+    options.dump_after_init_prefix=dump_after_init_prefix_;
+    options.dump_after_refine_surface_prefix=dump_after_refine_surface_prefix_;
+    options.dump_after_refine_prefix=dump_after_refine_prefix_;
+    options.dump_after_glob_opt_prefix=dump_after_glob_opt_prefix_;
+    options.dump_after_perturb_prefix=dump_after_perturb_prefix_;
+    options.dump_after_exude_prefix=dump_after_exude_prefix_;
+    options.number_of_initial_points=number_of_initial_points_;
+
+    return options;
+  }
+  
+  // Undocumented Boost parameter for refine_mesh_3 and make_mesh_3.
+  // Default Mesh_3_options: dump at every stage of the mesh generation.
+  inline internal::Mesh_3_options mesh_3_dump()
+  {
+    internal::Mesh_3_options options;
+
+    options.dump_after_init_prefix="mesh_dump_after_init";
+    options.dump_after_refine_surface_prefix="mesh_dump_after_refine_surface";
+    options.dump_after_refine_prefix="mesh_dump_after_refine";
+    options.dump_after_glob_opt_prefix="mesh_dump_after_glob_opt";
+    options.dump_after_perturb_prefix="mesh_dump_after_perturb";
+    options.dump_after_exude_prefix="mesh_dump_after_exude";
+    
+    return options;
+  }
+
+CGAL_PRAGMA_DIAG_POP
+
+  // -----------------------------------
+  // Reset_c3t3 (undocumented)
+  // -----------------------------------
+  CGAL_MESH_BOOLEAN_PARAMETER(Reset,reset_c3t3,no_reset_c3t3)
+  // CGAL_MESH_BOOLEAN_PARAMETER defined in <CGAL/Mesh_3/global_parameters.h>
+  
+// see <CGAL/config.h>
+CGAL_PRAGMA_DIAG_PUSH
+// see <CGAL/Mesh_3/config.h>
+CGAL_MESH_3_IGNORE_BOOST_PARAMETER_NAME_WARNINGS
+
+  // -----------------------------------
+  // Parameters
+  // -----------------------------------
+  BOOST_PARAMETER_NAME( exude_param )
+  BOOST_PARAMETER_NAME( perturb_param )
+  BOOST_PARAMETER_NAME( odt_param )
+  BOOST_PARAMETER_NAME( lloyd_param )
+  BOOST_PARAMETER_NAME( reset_param )
+  BOOST_PARAMETER_NAME( mesh_options_param )
+
+CGAL_PRAGMA_DIAG_POP
+} // end namespace parameters
+  
+// see <CGAL/config.h>
+CGAL_PRAGMA_DIAG_PUSH
+// see <CGAL/Mesh_3/config.h>
+CGAL_MESH_3_IGNORE_BOOST_PARAMETER_NAME_WARNINGS
+
+BOOST_PARAMETER_FUNCTION(
+  (void),
+  refine_mesh_3,
+  parameters::tag,
+  (required (in_out(c3t3),*) (domain,*) (criteria,*) ) // nondeduced
+  (deduced 
+    (optional
+      (exude_param, (parameters::internal::Exude_options), parameters::exude())
+      (perturb_param, (parameters::internal::Perturb_options), parameters::perturb())
+      (odt_param, (parameters::internal::Odt_options), parameters::no_odt())
+      (lloyd_param, (parameters::internal::Lloyd_options), parameters::no_lloyd())
+      (reset_param, (parameters::Reset), parameters::reset_c3t3())
+      (mesh_options_param, (parameters::internal::Mesh_3_options), 
+                           parameters::internal::Mesh_3_options())
+    )
+  )
+)
+{
+  return refine_mesh_3_impl(c3t3,
+                            domain,
+                            criteria,
+                            exude_param,
+                            perturb_param,
+                            odt_param,
+                            lloyd_param,
+                            reset_param(),
+                            mesh_options_param);
+}
+
+CGAL_PRAGMA_DIAG_POP
+
+  
+/**
+ * @brief This function refines the mesh c3t3 wrt domain & criteria
+ *
+ * @param c3t3 the mesh to be refined.
+ * @param domain the domain to be discretized
+ * @param criteria the criteria
+ * @param exude if \c true, an exudation step will be done at
+ *   the end of the Delaunay refinement process
+ * @param perturb if \c true, an explicit vertex perturbation step will be
+ *   done at the end of refinement process
+ * @param reset_c3t3 if \c true, a new C3T3 will be construct from param c3t3.
+ *   The new c3t3 keeps only the vertices (as NON-weighted points with their
+ *   dimension and Index) of the triangulation. That allows to refine a mesh
+ *   which has been exuded.
+ * @param mesh_3_various_options is a struct object used to pass
+ * non-documented options, for debugging purpose.
+ */
+template<class C3T3, class MeshDomain, class MeshCriteria>
+void refine_mesh_3_impl(C3T3& c3t3,
+                        const MeshDomain&   domain,
+                        const MeshCriteria& criteria,
+                        const parameters::internal::Exude_options& exude,
+                        const parameters::internal::Perturb_options& perturb,
+                        const parameters::internal::Odt_options& odt,
+                        const parameters::internal::Lloyd_options& lloyd,
+                        bool reset_c3t3,
+                        const parameters::internal::Mesh_3_options& 
+                          mesh_options = parameters::internal::Mesh_3_options())
+{
+  typedef Mesh_3::Mesher_3<C3T3, MeshCriteria, MeshDomain> Mesher;
+
+  // Reset c3t3 (i.e. remove weights) if needed
+  if ( reset_c3t3 )
+  {
+    C3T3 tmp_c3t3;
+    std::for_each(c3t3.triangulation().finite_vertices_begin(),
+                  c3t3.triangulation().finite_vertices_end(),
+                  details::Insert_vertex_in_c3t3<C3T3>(tmp_c3t3));
+    // TODO: corners and edges are not restored
+    c3t3.swap(tmp_c3t3);
+  }
+  
+  dump_c3t3(c3t3, mesh_options.dump_after_init_prefix);
+
+  // Build mesher and launch refinement process
+  Mesher mesher (c3t3, domain, criteria);
+  double refine_time = mesher.refine_mesh(mesh_options.dump_after_refine_surface_prefix);
+  c3t3.clear_manifold_info();
+
+  dump_c3t3(c3t3, mesh_options.dump_after_refine_prefix);
+
+  // Odt
+  if ( odt )
+  {
+    odt_optimize_mesh_3(c3t3,
+                        domain,
+                        parameters::time_limit = odt.time_limit(),
+                        parameters::max_iteration_number = odt.max_iteration_number(),
+                        parameters::convergence = odt.convergence(),
+                        parameters::freeze_bound = odt.bound());
+  }
+  
+  // Lloyd
+  if ( lloyd )
+  {
+    lloyd_optimize_mesh_3(c3t3,
+                          domain,
+                          parameters::time_limit = lloyd.time_limit(),
+                          parameters::max_iteration_number = lloyd.max_iteration_number(),
+                          parameters::convergence = lloyd.convergence(),
+                          parameters::freeze_bound = lloyd.bound());
+  }
+
+  if( odt || lloyd) {
+    dump_c3t3(c3t3, mesh_options.dump_after_glob_opt_prefix);
+  }
+
+  // Perturbation
+  if ( perturb )
+  {
+    double perturb_time_limit = refine_time;
+    
+    if ( perturb.is_time_limit_set() )
+      perturb_time_limit = perturb.time_limit();
+
+    perturb_mesh_3(c3t3,
+                   domain,
+                   parameters::time_limit = perturb_time_limit,
+                   parameters::sliver_bound = perturb.bound());
+
+    dump_c3t3(c3t3, mesh_options.dump_after_perturb_prefix);
+  }
+
+  // Exudation
+  if ( exude )
+  {
+    double exude_time_limit = refine_time;
+    
+    if ( exude.is_time_limit_set() )
+      exude_time_limit = exude.time_limit();
+    
+    exude_mesh_3(c3t3,
+                 parameters::time_limit = exude_time_limit,
+                 parameters::sliver_bound = exude.bound());
+
+    dump_c3t3(c3t3, mesh_options.dump_after_exude_prefix);
+  }
+
+}
+
+}  // end namespace CGAL
+
+
+#endif // CGAL_REFINE_MESH_3_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/regular_neighbor_coordinates_2.h b/3rdparty/CGAL/include/CGAL/regular_neighbor_coordinates_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/regular_neighbor_coordinates_2.h
rename to 3rdparty/CGAL/include/CGAL/regular_neighbor_coordinates_2.h
diff --git a/3rdparty/CGAL/include/CGAL/regularize_planes.h b/3rdparty/CGAL/include/CGAL/regularize_planes.h
new file mode 100644
index 0000000..df2234e
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/regularize_planes.h
@@ -0,0 +1,771 @@
+// Copyright (c) 2015 INRIA Sophia-Antipolis (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
+// 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(s)     : Florent Lafarge, Simon Giraudot
+//
+
+/**
+ * \ingroup PkgPointSetShapeDetection3
+ * \file CGAL/regularize_planes.h
+ *
+ */
+
+
+#ifndef CGAL_REGULARIZE_PLANES_H
+#define CGAL_REGULARIZE_PLANES_H
+
+#include <CGAL/Shape_detection_3.h>
+#include <CGAL/centroid.h>
+
+#include <boost/foreach.hpp>
+
+
+namespace CGAL {
+  
+// ----------------------------------------------------------------------------
+// Private section
+// ----------------------------------------------------------------------------
+/// \cond SKIP_IN_MANUAL
+namespace internal {
+namespace PlaneRegularization {
+
+template <typename Traits>
+struct Plane_cluster
+{
+  bool is_free;
+  std::vector<std::size_t> planes;
+  std::vector<std::size_t> coplanar_group;
+  std::vector<std::size_t> orthogonal_clusters;
+  typename Traits::Vector_3 normal;
+  typename Traits::FT cosangle_symmetry;
+  typename Traits::FT area;
+  typename Traits::FT cosangle_centroid;
+};
+
+  
+template <typename Traits>
+typename Traits::Vector_3 regularize_normal
+  (const typename Traits::Vector_3& n,
+   const typename Traits::Vector_3& symmetry_direction,
+   typename Traits::FT cos_symmetry)
+{
+  typedef typename Traits::FT FT;
+  typedef typename Traits::Point_3 Point;
+  typedef typename Traits::Vector_3 Vector;
+  typedef typename Traits::Line_3 Line;
+  typedef typename Traits::Plane_3 Plane;
+
+  Point pt_symmetry = CGAL::ORIGIN + cos_symmetry* symmetry_direction;
+
+  Plane plane_symmetry (pt_symmetry, symmetry_direction);
+  Point pt_normal = CGAL::ORIGIN + n;
+
+  if (n != symmetry_direction || n != -symmetry_direction)
+    {
+      Plane plane_cut (CGAL::ORIGIN, pt_normal, CGAL::ORIGIN + symmetry_direction);
+      Line line;
+      CGAL::Object ob_1 = CGAL::intersection(plane_cut, plane_symmetry);
+      if (!assign(line, ob_1))
+        return n;
+
+      FT delta = std::sqrt ((FT)1. - cos_symmetry * cos_symmetry);
+
+      Point projected_origin = line.projection (CGAL::ORIGIN);
+      Vector line_vector (line);
+      line_vector = line_vector / std::sqrt (line_vector * line_vector);
+      Point pt1 = projected_origin + delta * line_vector;
+      Point pt2 = projected_origin - delta * line_vector;
+
+      if (CGAL::squared_distance (pt_normal, pt1) <= CGAL::squared_distance (pt_normal, pt2))
+        return Vector (CGAL::ORIGIN, pt1);
+      else
+        return Vector (CGAL::ORIGIN, pt2);
+
+    }
+  else
+    return n;
+}
+
+template <typename Traits>  
+typename Traits::Vector_3 regularize_normals_from_prior
+  (const typename Traits::Vector_3& np,
+   const typename Traits::Vector_3& n,
+   const typename Traits::Vector_3& symmetry_direction,
+   typename Traits::FT cos_symmetry)
+{
+  typedef typename Traits::FT FT;
+  typedef typename Traits::Point_3 Point;
+  typedef typename Traits::Vector_3 Vector;
+  typedef typename Traits::Line_3 Line;
+  typedef typename Traits::Plane_3 Plane;
+
+  Plane plane_orthogonality (CGAL::ORIGIN, np);
+  Point pt_symmetry = CGAL::ORIGIN + cos_symmetry* symmetry_direction;
+
+  Plane plane_symmetry (pt_symmetry, symmetry_direction);
+		
+  Line line;
+  CGAL::Object ob_1 = CGAL::intersection (plane_orthogonality, plane_symmetry);
+  if (!assign(line, ob_1))
+    return regularize_normal<Traits> (n, symmetry_direction, cos_symmetry);
+
+  Point projected_origin = line.projection (CGAL::ORIGIN);
+  FT R = CGAL::squared_distance (Point (CGAL::ORIGIN), projected_origin);
+
+  if (R <= 1)  // 2 (or 1) possible points intersecting the unit sphere and line
+    {
+      FT delta = std::sqrt ((FT)1. - R);
+      Vector line_vector(line); 
+      line_vector = line_vector / std::sqrt (line_vector * line_vector);
+      Point pt1 = projected_origin + delta * line_vector;
+      Point pt2 = projected_origin - delta * line_vector;
+			
+      Point pt_n = CGAL::ORIGIN + n;
+      if (CGAL::squared_distance (pt_n, pt1) <= CGAL::squared_distance (pt_n, pt2))
+        return Vector (CGAL::ORIGIN, pt1);
+      else
+        return Vector (CGAL::ORIGIN, pt2);
+    }
+  else //no point intersecting the unit sphere and line
+    return regularize_normal<Traits> (n,symmetry_direction, cos_symmetry);
+
+}
+
+template <typename Traits,
+          typename RandomAccessIterator,
+          typename PlaneContainer,
+          typename PointPMap,
+          typename CentroidContainer,
+          typename AreaContainer>
+void compute_centroids_and_areas (RandomAccessIterator input_begin,
+                                  PlaneContainer& planes,
+                                  PointPMap point_pmap,
+                                  CentroidContainer& centroids,
+                                  AreaContainer& areas)
+{
+  typedef typename Traits::FT FT;
+  typedef typename Traits::Point_3 Point;
+  
+  for (std::size_t i = 0; i < planes.size (); ++ i)
+    {
+      std::vector < Point > listp;
+      for (std::size_t j = 0; j < planes[i]->indices_of_assigned_points ().size (); ++ j)
+        {
+          std::size_t yy = planes[i]->indices_of_assigned_points()[j];
+          Point pt = get (point_pmap, *(input_begin + yy));
+          listp.push_back(pt);
+        }
+      centroids.push_back (CGAL::centroid (listp.begin (), listp.end ()));
+      areas.push_back ((FT)(planes[i]->indices_of_assigned_points().size()) / (FT)100.);
+    }
+}
+
+
+template <typename Traits,
+          typename PlaneContainer,
+          typename PlaneClusterContainer,
+          typename AreaContainer>
+void compute_parallel_clusters (PlaneContainer& planes,
+                                PlaneClusterContainer& clusters,
+                                AreaContainer& areas,
+                                typename Traits::FT tolerance_cosangle,
+                                const typename Traits::Vector_3& symmetry_direction)
+{
+
+  typedef typename Traits::FT FT;
+  typedef typename Traits::Vector_3 Vector;
+  
+  typedef typename PlaneClusterContainer::value_type Plane_cluster;
+  
+  // find pairs of epsilon-parallel primitives and store them in parallel_planes
+  std::vector<std::vector<std::size_t> > parallel_planes (planes.size ());
+  for (std::size_t i = 0; i < planes.size (); ++ i)
+    {
+      Vector v1 = planes[i]->plane_normal ();
+          
+      for (std::size_t j = 0; j < planes.size(); ++ j)
+        {
+          if (i == j)
+            continue;
+              
+          Vector v2 = planes[j]->plane_normal ();
+
+          if (std::fabs (v1 * v2) > 1. - tolerance_cosangle)
+            parallel_planes[i].push_back (j);
+        }
+    }
+
+
+  std::vector<bool> is_available (planes.size (), true);
+      
+  for (std::size_t i = 0; i < planes.size(); ++ i)
+    {
+
+      if(is_available[i])
+        {
+          is_available[i] = false;
+
+          clusters.push_back (Plane_cluster());
+          Plane_cluster& clu = clusters.back ();
+
+          //initialization containers
+          clu.planes.push_back (i);
+              
+          std::vector<std::size_t> index_container_former_ring_parallel;
+          index_container_former_ring_parallel.push_back(i);
+              
+          std::list<std::size_t> index_container_current_ring_parallel;
+
+          //propagation over the pairs of epsilon-parallel primitives
+          bool propagation=true;
+          clu.normal = planes[i]->plane_normal ();
+          clu.area = areas[i];
+			
+          do
+            {
+              propagation = false;
+
+              for (std::size_t k = 0; k < index_container_former_ring_parallel.size(); ++ k)
+                {
+
+                  std::size_t plane_index = index_container_former_ring_parallel[k];
+
+                  for (std::size_t l = 0; l < parallel_planes[plane_index].size(); ++ l)
+                    {
+                      std::size_t it = parallel_planes[plane_index][l];
+                          
+                      Vector normal_it =  planes[it]->plane_normal ();
+
+                      if(is_available[it]
+                         && std::fabs (normal_it*clu.normal) > 1. - tolerance_cosangle )
+                        {	
+                          propagation = true;
+                          index_container_current_ring_parallel.push_back(it);
+                          is_available[it]=false;
+                              
+                          if(clu.normal * normal_it <0)
+                            normal_it = -normal_it;
+
+                          clu.normal = (FT)clu.area * clu.normal
+                            + (FT)areas[it] * normal_it;
+                          FT norm = (FT)1. / std::sqrt (clu.normal.squared_length()); 
+                          clu.normal = norm * clu.normal;
+                          clu.area += areas[it];
+                        }	
+                    }
+                }
+
+              //update containers
+              index_container_former_ring_parallel.clear();
+              for (std::list<std::size_t>::iterator it = index_container_current_ring_parallel.begin();
+                   it != index_container_current_ring_parallel.end(); ++it)
+                {
+                  index_container_former_ring_parallel.push_back(*it);
+                  clu.planes.push_back(*it);
+                }
+              index_container_current_ring_parallel.clear();
+
+            }
+          while(propagation);
+
+          if (symmetry_direction != CGAL::NULL_VECTOR)
+            {
+              clu.cosangle_symmetry = symmetry_direction * clu.normal;
+              if (clu.cosangle_symmetry < 0.)
+                {
+                  clu.normal = -clu.normal;
+                  clu.cosangle_symmetry = -clu.cosangle_symmetry;
+                }
+            }
+        }
+    }
+
+  is_available.clear();
+}
+
+template <typename Traits,
+          typename PlaneClusterContainer>
+void cluster_symmetric_cosangles (PlaneClusterContainer& clusters,
+                                  typename Traits::FT tolerance_cosangle,
+                                  typename Traits::FT tolerance_cosangle_ortho)
+{
+  typedef typename Traits::FT FT;
+  
+  std::vector < FT > cosangle_centroids;
+  std::vector < std::size_t> list_cluster_index;
+  for( std::size_t i = 0; i < clusters.size(); ++ i)
+    list_cluster_index.push_back(static_cast<std::size_t>(-1));
+      
+  std::size_t mean_index = 0;
+  for (std::size_t i = 0; i < clusters.size(); ++ i)
+    {
+      if(list_cluster_index[i] == static_cast<std::size_t>(-1))
+        {
+          list_cluster_index[i] = mean_index;
+          FT mean = clusters[i].area * clusters[i].cosangle_symmetry;
+          FT mean_area = clusters[i].area;
+              
+          for (std::size_t j = i+1; j < clusters.size(); ++ j)
+            {
+              if (list_cluster_index[j] == static_cast<std::size_t>(-1)
+                  && std::fabs (clusters[j].cosangle_symmetry -
+                                mean / mean_area) < tolerance_cosangle_ortho)
+                {
+                  list_cluster_index[j] = mean_index;
+                  mean_area += clusters[j].area;
+                  mean += clusters[j].area * clusters[j].cosangle_symmetry;
+                }
+            }
+          ++ mean_index;
+          mean /= mean_area;
+          cosangle_centroids.push_back (mean);
+        }
+    }
+
+  for (std::size_t i = 0; i < cosangle_centroids.size(); ++ i)
+    {
+      if (cosangle_centroids[i] < tolerance_cosangle_ortho)
+        cosangle_centroids[i] = 0;
+      else if (cosangle_centroids[i] > 1. - tolerance_cosangle)
+        cosangle_centroids[i] = 1;
+    }
+  for (std::size_t i = 0; i < clusters.size(); ++ i)
+    clusters[i].cosangle_symmetry = cosangle_centroids[list_cluster_index[i]];
+}
+
+
+template <typename Traits,
+          typename PlaneClusterContainer>
+void subgraph_mutually_orthogonal_clusters (PlaneClusterContainer& clusters,
+                                            const typename Traits::Vector_3& symmetry_direction)
+{
+  typedef typename Traits::FT FT;
+  typedef typename Traits::Vector_3 Vector;
+  
+  std::vector < std::vector < std::size_t> > subgraph_clusters;
+  std::vector < std::size_t> subgraph_clusters_max_area_index;
+
+  for (std::size_t i = 0; i < clusters.size(); ++ i)
+    clusters[i].is_free = true;
+
+  for (std::size_t i = 0; i < clusters.size(); ++ i)
+    {
+      if(clusters[i].is_free)
+        {
+          clusters[i].is_free = false;
+          FT max_area = clusters[i].area;
+          std::size_t index_max_area = i;
+
+          //initialization containers
+          std::vector < std::size_t > index_container;
+          index_container.push_back(i);
+          std::vector < std::size_t > index_container_former_ring;
+          index_container_former_ring.push_back(i);
+          std::list < std::size_t > index_container_current_ring;
+
+          //propagation
+          bool propagation=true;
+          do
+            {
+              propagation=false;
+
+              //neighbors
+              for (std::size_t k=0;k<index_container_former_ring.size();k++)
+                {
+
+                  std::size_t cluster_index=index_container_former_ring[k];
+
+                  for (std::size_t j = 0; j < clusters[cluster_index].orthogonal_clusters.size(); ++ j)
+                    {
+                      std::size_t cluster_index_2 = clusters[cluster_index].orthogonal_clusters[j];
+                      if(clusters[cluster_index_2].is_free)
+                        {
+                          propagation = true;
+                          index_container_current_ring.push_back(cluster_index_2);
+                          clusters[cluster_index_2].is_free = false;
+
+                          if(max_area < clusters[cluster_index_2].area)
+                            {
+                              max_area = clusters[cluster_index_2].area;
+                              index_max_area = cluster_index_2;
+                            }
+                        }	
+                    }
+                }
+
+              //update containers
+              index_container_former_ring.clear();
+              for(std::list < std::size_t>::iterator it = index_container_current_ring.begin();
+                  it != index_container_current_ring.end(); ++it)
+                {
+                  index_container_former_ring.push_back(*it);
+                  index_container.push_back(*it);
+                }
+              index_container_current_ring.clear();
+
+            }
+          while(propagation);
+          subgraph_clusters.push_back(index_container);
+          subgraph_clusters_max_area_index.push_back(index_max_area);
+        }
+    }
+
+  //create subgraphs of mutually orthogonal clusters in which the
+  //largest cluster is excluded and store in
+  //subgraph_clusters_prop
+  std::vector < std::vector < std::size_t> > subgraph_clusters_prop;
+  for (std::size_t i=0;i<subgraph_clusters.size(); i++)
+    {
+      std::size_t index=subgraph_clusters_max_area_index[i];
+      std::vector < std::size_t> subgraph_clusters_prop_temp;
+      for (std::size_t j=0;j<subgraph_clusters[i].size(); j++)
+        if(subgraph_clusters[i][j]!=index)
+          subgraph_clusters_prop_temp.push_back(subgraph_clusters[i][j]);
+
+      subgraph_clusters_prop.push_back(subgraph_clusters_prop_temp);
+    }
+
+  //regularization of cluster normals : in eachsubgraph, we start
+  //from the largest area cluster and we propage over the subgraph
+  //by regularizing the normals of the clusters accorting to
+  //orthogonality and cosangle to symmetry direction
+
+  for (std::size_t i = 0; i < clusters.size(); ++ i)
+    clusters[i].is_free = true;
+
+  for (std::size_t i = 0; i < subgraph_clusters_prop.size(); ++ i)
+    {
+	
+      std::size_t index_current=subgraph_clusters_max_area_index[i];
+
+      Vector vec_current=regularize_normal<Traits>
+        (clusters[index_current].normal,
+         symmetry_direction,
+         clusters[index_current].cosangle_symmetry);
+      clusters[index_current].normal = vec_current;
+      clusters[index_current].is_free = false;
+
+      //initialization containers
+      std::vector < std::size_t> index_container;
+      index_container.push_back(index_current);
+      std::vector < std::size_t> index_container_former_ring;
+      index_container_former_ring.push_back(index_current);
+      std::list < std::size_t> index_container_current_ring;
+
+      //propagation
+      bool propagation=true;
+      do
+        {
+          propagation=false;
+
+          //neighbors
+          for (std::size_t k=0;k<index_container_former_ring.size();k++)
+            {
+
+              std::size_t cluster_index=index_container_former_ring[k];
+
+              for (std::size_t j = 0; j < clusters[cluster_index].orthogonal_clusters.size(); ++ j)
+                {
+                  std::size_t cluster_index_2 = clusters[cluster_index].orthogonal_clusters[j];						
+                  if(clusters[cluster_index_2].is_free)
+                    {
+                      propagation = true;
+                      index_container_current_ring.push_back(cluster_index_2);
+                      clusters[cluster_index_2].is_free = false;
+
+                      Vector new_vect=regularize_normals_from_prior<Traits>
+                        (clusters[cluster_index].normal,
+                         clusters[cluster_index_2].normal,
+                         symmetry_direction,
+                         clusters[cluster_index_2].cosangle_symmetry);
+                      clusters[cluster_index_2].normal = new_vect;
+                    }
+                }	
+            }
+			
+          //update containers
+          index_container_former_ring.clear();
+          for(std::list < std::size_t>::iterator it = index_container_current_ring.begin();
+              it != index_container_current_ring.end(); ++it)
+            {
+              index_container_former_ring.push_back(*it);
+              index_container.push_back(*it);
+            }
+          index_container_current_ring.clear();
+        }while(propagation);
+    }
+}
+                                    
+
+
+} // namespace PlaneRegularization
+} // namespace internal
+/// \endcond
+
+
+// ----------------------------------------------------------------------------
+// Public section
+// ----------------------------------------------------------------------------
+
+/// \ingroup PkgPointSetShapeDetection3
+  
+  /*! 
+
+    Given a set of detected planes with their respective inlier sets,
+    this function enables to regularize the planes: 
+
+    - Planes near parallel can be made exactly parallel.
+
+    - Planes near orthogonal can be made exactly orthogonal.
+
+    - Planes parallel and near coplanar can be made exactly coplanar.
+
+    - Planes near symmetrical with a user-defined axis can be made
+    exactly symmetrical.
+
+    Planes are directly modified. Points are left unaltered, as well as
+    their relationships to planes (no transfer of point from a primitive
+    plane to another).
+
+    The implementation follows \cgalCite{cgal:vla-lod-15}.
+
+    \tparam Traits a model of `EfficientRANSACTraits`
+
+    \param shape_detection Shape detection object used to detect
+    shapes from the input data. While the shape detection algorithm
+    deals with several types of primitive shapes only planes can be
+    regularized.
+
+    \warning The `shape_detection` parameter must have already
+    detected shapes. If no plane exists in it, the regularization
+    function doesn't do anything.
+
+    \param regularize_parallelism Select whether parallelism is
+    regularized or not.
+
+    \param regularize_orthogonality Select whether orthogonality is
+    regularized or not.
+
+    \param regularize_coplanarity Select whether coplanarity is
+    regularized or not.
+
+    \param regularize_axis_symmetry Select whether axis symmetry is
+    regularized or not.
+
+    \param tolerance_angle Tolerance of deviation between normal
+    vectors of planes (in degrees) used for parallelism, orthogonality
+    and axis symmetry. Default value is 25 degrees.
+
+    \param tolerance_coplanarity Maximal distance between two parallel
+    planes such that they are considered coplanar. Default value is
+    0.01.
+
+    \param symmetry_direction Chosen axis for symmetry
+    regularization. Default value is the Z axis.
+*/ 
+
+template <typename EfficientRANSACTraits>
+void regularize_planes (const Shape_detection_3::Efficient_RANSAC<EfficientRANSACTraits>& shape_detection,
+                        bool regularize_parallelism,
+                        bool regularize_orthogonality,
+                        bool regularize_coplanarity,
+                        bool regularize_axis_symmetry,
+                        typename EfficientRANSACTraits::FT tolerance_angle
+                        = (typename EfficientRANSACTraits::FT)25.0,
+                        typename EfficientRANSACTraits::FT tolerance_coplanarity
+                        = (typename EfficientRANSACTraits::FT)0.01,
+                        typename EfficientRANSACTraits::Vector_3 symmetry_direction
+                        = typename EfficientRANSACTraits::Vector_3
+                        ((typename EfficientRANSACTraits::FT)0.,
+                         (typename EfficientRANSACTraits::FT)0.,
+                         (typename EfficientRANSACTraits::FT)1.))
+{
+  typedef typename EfficientRANSACTraits::FT FT;
+  typedef typename EfficientRANSACTraits::Point_3 Point;
+  typedef typename EfficientRANSACTraits::Vector_3 Vector;
+  typedef typename EfficientRANSACTraits::Plane_3 Plane;
+
+  typedef Shape_detection_3::Shape_base<EfficientRANSACTraits> Shape;
+  typedef Shape_detection_3::Plane<EfficientRANSACTraits> Plane_shape;
+
+  typedef typename internal::PlaneRegularization::Plane_cluster<EfficientRANSACTraits>
+    Plane_cluster;
+
+  typename EfficientRANSACTraits::Input_range::iterator input_begin = shape_detection.input_iterator_first();
+
+  std::vector<boost::shared_ptr<Plane_shape> > planes;
+    
+  BOOST_FOREACH (boost::shared_ptr<Shape> shape, shape_detection.shapes())
+    {
+      boost::shared_ptr<Plane_shape> pshape
+        = boost::dynamic_pointer_cast<Plane_shape>(shape);
+        
+      // Ignore all shapes other than plane
+      if (pshape == boost::shared_ptr<Plane_shape>())
+        continue;
+      planes.push_back (pshape);
+    }
+
+
+  /*
+   * Compute centroids and areas
+   */
+  std::vector<Point> centroids;
+  std::vector<FT> areas;
+  internal::PlaneRegularization::compute_centroids_and_areas<EfficientRANSACTraits>
+    (input_begin, planes, shape_detection.point_map(), centroids, areas);
+
+  tolerance_angle = tolerance_angle * (FT)CGAL_PI / (FT)(180);
+  FT tolerance_cosangle = (FT)1. - std::cos (tolerance_angle);
+  FT tolerance_cosangle_ortho = std::cos ((FT)0.5 * (FT)CGAL_PI - tolerance_angle);
+      
+  // clustering the parallel primitives and store them in clusters
+  // & compute the normal, size and cos angle to the symmetry
+  // direction of each cluster
+  std::vector<Plane_cluster> clusters;
+  internal::PlaneRegularization::compute_parallel_clusters<EfficientRANSACTraits>
+    (planes, clusters, areas,
+     (regularize_parallelism ? tolerance_cosangle : (FT)0.0),
+     (regularize_axis_symmetry ? symmetry_direction : CGAL::NULL_VECTOR));
+
+  if (regularize_orthogonality)
+    {
+      //discovery orthogonal relationship between clusters 
+      for (std::size_t i = 0; i < clusters.size(); ++ i)
+        {
+          for (std::size_t j = i + 1; j < clusters.size(); ++ j)
+            {
+              if (std::fabs (clusters[i].normal * clusters[j].normal) < tolerance_cosangle_ortho)
+                {
+                  clusters[i].orthogonal_clusters.push_back (j);
+                  clusters[j].orthogonal_clusters.push_back (i);
+                }
+            }
+        }
+    }
+      
+  if (regularize_axis_symmetry)
+    {
+      //clustering the symmetry cosangle and store their centroids in
+      //cosangle_centroids and the centroid index of each cluster in
+      //list_cluster_index
+      internal::PlaneRegularization::cluster_symmetric_cosangles<EfficientRANSACTraits>
+        (clusters, tolerance_cosangle, tolerance_cosangle_ortho);
+    }
+  
+  //find subgraphs of mutually orthogonal clusters (store index of
+  //clusters in subgraph_clusters), and select the cluster of
+  //largest area
+  if (regularize_orthogonality || regularize_axis_symmetry)
+    internal::PlaneRegularization::subgraph_mutually_orthogonal_clusters<EfficientRANSACTraits>
+      (clusters, (regularize_axis_symmetry ? symmetry_direction : CGAL::NULL_VECTOR));
+      
+  //recompute optimal plane for each primitive after normal regularization
+  for (std::size_t i=0; i < clusters.size(); ++ i)
+    {
+
+      Vector vec_reg = clusters[i].normal;
+      for (std::size_t j = 0; j < clusters[i].planes.size(); ++ j)
+        {
+          std::size_t index_prim = clusters[i].planes[j];
+          Point pt_reg = planes[index_prim]->projection (centroids[index_prim]);
+          if( planes[index_prim]->plane_normal () * vec_reg < 0)
+            vec_reg=-vec_reg;
+          Plane plane_reg(pt_reg,vec_reg);
+
+          if( std::fabs(planes[index_prim]->plane_normal () * vec_reg) > 1. - tolerance_cosangle)
+            planes[index_prim]->update (plane_reg);
+        }
+    }
+
+
+  if (regularize_coplanarity)
+    {
+      //detecting co-planarity and store in list_coplanar_prim
+      for (std::size_t i = 0; i < clusters.size(); ++ i)
+        {
+          Vector vec_reg = clusters[i].normal;
+
+          for (std::size_t ip = 0; ip < clusters[i].planes.size(); ++ ip)
+            clusters[i].coplanar_group.push_back (static_cast<std::size_t>(-1));
+
+          std::size_t cop_index=0;
+
+          for (std::size_t j = 0; j < clusters[i].planes.size(); ++ j)
+            {
+              std::size_t index_prim = clusters[i].planes[j];
+
+              if (clusters[i].coplanar_group[j] == static_cast<std::size_t>(-1))
+                {
+                  clusters[i].coplanar_group[j] = cop_index;
+			
+                  Point pt_reg = planes[index_prim]->projection(centroids[index_prim]);
+                  Plane plan_reg(pt_reg,vec_reg);
+
+                  for (std::size_t k = j + 1; k < clusters[i].planes.size(); ++ k)
+                    {
+                      if (clusters[i].coplanar_group[k] == static_cast<std::size_t>(-1))
+                        {
+                          std::size_t index_prim_next = clusters[i].planes[k];
+                          Point pt_reg_next = planes[index_prim_next]->projection(centroids[index_prim_next]);
+                          Point pt_proj=plan_reg.projection(pt_reg_next);
+                          FT distance = std::sqrt (CGAL::squared_distance(pt_reg_next,pt_proj));
+
+                          if (distance < tolerance_coplanarity)
+                            clusters[i].coplanar_group[k] = cop_index;
+                        }
+                    }
+                  cop_index++; 
+                }
+            }
+          //regularize primitive position by computing barycenter of cplanar planes
+          std::vector<Point> pt_bary (cop_index, Point ((FT)0., (FT)0., (FT)0.));
+          std::vector<FT> area (cop_index, 0.);
+      
+          for (std::size_t j = 0; j < clusters[i].planes.size (); ++ j)
+            {
+              std::size_t index_prim = clusters[i].planes[j];
+              std::size_t group = clusters[i].coplanar_group[j];
+              
+              Point pt_reg = planes[index_prim]->projection(centroids[index_prim]);
+
+              pt_bary[group] = CGAL::barycenter (pt_bary[group], area[group], pt_reg, areas[index_prim]); 
+              area[group] += areas[index_prim];
+            }
+
+
+          for (std::size_t j = 0; j < clusters[i].planes.size (); ++ j)
+            {
+              std::size_t index_prim = clusters[i].planes[j];
+              std::size_t group = clusters[i].coplanar_group[j];
+              Plane plane_reg (pt_bary[group], vec_reg);
+
+              if (planes[index_prim]->plane_normal ()
+                  * plane_reg.orthogonal_vector() < 0)
+                planes[index_prim]->update (plane_reg.opposite());
+              else
+                planes[index_prim]->update (plane_reg);
+            }
+        }
+    } 
+}
+
+
+} // namespace CGAL
+
+#endif // CGAL_REGULARIZE_PLANES_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/remove_far_points_in_mesh_3.h b/3rdparty/CGAL/include/CGAL/remove_far_points_in_mesh_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/remove_far_points_in_mesh_3.h
rename to 3rdparty/CGAL/include/CGAL/remove_far_points_in_mesh_3.h
diff --git a/3rdparty/CGAL/include/CGAL/remove_outliers.h b/3rdparty/CGAL/include/CGAL/remove_outliers.h
new file mode 100644
index 0000000..20ad801
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/remove_outliers.h
@@ -0,0 +1,242 @@
+// Copyright (c) 2007-09  INRIA Sophia-Antipolis (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
+// 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(s) : Laurent Saboret and Nader Salman and Pierre Alliez
+
+#ifndef CGAL_REMOVE_OUTLIERS_H
+#define CGAL_REMOVE_OUTLIERS_H
+
+#include <CGAL/Search_traits_3.h>
+#include <CGAL/Orthogonal_k_neighbor_search.h>
+#include <CGAL/property_map.h>
+#include <CGAL/point_set_processing_assertions.h>
+
+#include <iterator>
+#include <algorithm>
+#include <map>
+
+namespace CGAL {
+
+
+// ----------------------------------------------------------------------------
+// Private section
+// ----------------------------------------------------------------------------
+/// \cond SKIP_IN_MANUAL
+namespace internal {
+
+
+/// Utility function for remove_outliers():
+/// Computes average squared distance to the K nearest neighbors.
+///
+/// \pre `k >= 2`
+///
+/// @tparam Kernel Geometric traits class.
+/// @tparam Tree KD-tree.
+///
+/// @return computed distance.
+template < typename Kernel,
+           typename Tree >
+typename Kernel::FT
+compute_avg_knn_sq_distance_3(
+    const typename Kernel::Point_3& query, ///< 3D point to project
+    Tree& tree,                            ///< KD-tree
+    unsigned int k)                        ///< number of neighbors
+{
+    // geometric types
+    typedef typename Kernel::FT FT;
+    typedef typename Kernel::Point_3 Point;
+
+    // types for K nearest neighbors search
+    typedef typename CGAL::Search_traits_3<Kernel> Tree_traits;
+    typedef typename CGAL::Orthogonal_k_neighbor_search<Tree_traits> Neighbor_search;
+    typedef typename Neighbor_search::iterator Search_iterator;
+
+    // Gather set of (k+1) neighboring points.
+    // Perform k+1 queries (if in point set, the query point is
+    // output first). Search may be aborted if k is greater
+    // than number of input points.
+    std::vector<Point> points; points.reserve(k+1);
+    Neighbor_search search(tree,query,k+1);
+    Search_iterator search_iterator = search.begin();
+    unsigned int i;
+    for(i=0;i<(k+1);i++)
+    {
+        if(search_iterator == search.end())
+            break; // premature ending
+        points.push_back(search_iterator->first);
+        search_iterator++;
+    }
+    CGAL_point_set_processing_precondition(points.size() >= 1);
+
+    // compute average squared distance
+    typename Kernel::Compute_squared_distance_3 sqd;
+    FT sq_distance = (FT)0.0;
+    for(typename std::vector<Point>::iterator neighbor = points.begin(); neighbor != points.end(); neighbor++)
+        sq_distance += sqd(*neighbor, query);
+    sq_distance /= FT(points.size());
+    return sq_distance;
+}
+
+} /* namespace internal */
+/// \endcond
+
+
+// ----------------------------------------------------------------------------
+// Public section
+// ----------------------------------------------------------------------------
+
+/// \ingroup PkgPointSetProcessing
+/// Removes outliers:
+/// - computes average squared distance to the K nearest neighbors,
+/// - and sorts the points in increasing order of average distance.
+///
+/// This method modifies the order of input points so as to pack all remaining points first,
+/// and returns an iterator over the first point to remove (see erase-remove idiom).
+/// For this reason it should not be called on sorted containers.
+///
+/// \pre `k >= 2`
+///
+/// @tparam InputIterator iterator over input points.
+/// @tparam PointPMap is a model of `ReadablePropertyMap` with value type `Point_3<Kernel>`.
+///        It can be omitted ifthe value type of `InputIterator` is convertible to `Point_3<Kernel>`.
+/// @tparam Kernel Geometric traits class.
+///        It can be omitted and deduced automatically from the value type of `PointPMap`.
+///
+/// @return iterator over the first point to remove.
+
+// This variant requires all parameters.
+template <typename InputIterator,
+          typename PointPMap,
+          typename Kernel
+>
+InputIterator
+remove_outliers(
+  InputIterator first,  ///< iterator over the first input point.
+  InputIterator beyond, ///< past-the-end iterator over the input points.
+  PointPMap point_pmap, ///< property map: value_type of InputIterator -> Point_3
+  unsigned int k, ///< number of neighbors.
+  double threshold_percent, ///< percentage of points to remove.
+  const Kernel& /*kernel*/) ///< geometric traits.
+{
+  // geometric types
+  typedef typename Kernel::FT FT;
+  
+  // basic geometric types
+  typedef typename Kernel::Point_3 Point;
+
+  // actual type of input points
+  typedef typename std::iterator_traits<InputIterator>::value_type Enriched_point;
+
+  // types for K nearest neighbors search structure
+  typedef typename CGAL::Search_traits_3<Kernel> Tree_traits;
+  typedef typename CGAL::Orthogonal_k_neighbor_search<Tree_traits> Neighbor_search;
+  typedef typename Neighbor_search::Tree Tree;
+
+  // precondition: at least one element in the container.
+  // to fix: should have at least three distinct points
+  // but this is costly to check
+  CGAL_point_set_processing_precondition(first != beyond);
+
+  // precondition: at least 2 nearest neighbors
+  CGAL_point_set_processing_precondition(k >= 2);
+
+  CGAL_point_set_processing_precondition(threshold_percent >= 0 && threshold_percent <= 100);
+
+  InputIterator it;
+
+  // Instanciate a KD-tree search.
+  // Note: We have to convert each input iterator to Point_3.
+  std::vector<Point> kd_tree_points; 
+  for(it = first; it != beyond; it++)
+    kd_tree_points.push_back( get(point_pmap, *it) );
+  Tree tree(kd_tree_points.begin(), kd_tree_points.end());
+
+  // iterate over input points and add them to multimap sorted by distance to k
+  std::multimap<FT,Enriched_point> sorted_points;
+  for(it = first; it != beyond; it++)
+  {
+    FT sq_distance = internal::compute_avg_knn_sq_distance_3<Kernel>(
+      get(point_pmap,*it),
+      tree, k);
+    sorted_points.insert( std::make_pair(sq_distance, *it) );
+  }
+
+  // Replaces [first, beyond) range by the multimap content.
+  // Returns the iterator after the (100-threshold_percent) % best points.
+  InputIterator first_point_to_remove = beyond;
+  InputIterator dst = first;
+  int first_index_to_remove = int(double(sorted_points.size()) * ((100.0-threshold_percent)/100.0));
+  typename std::multimap<FT,Enriched_point>::iterator src;
+  int index;
+  for (src = sorted_points.begin(), index = 0;
+       src != sorted_points.end();
+       ++src, ++index)
+  {
+    *dst++ = src->second;
+    if (index == first_index_to_remove)
+      first_point_to_remove = dst;
+  }
+
+  return first_point_to_remove;
+}
+
+/// @cond SKIP_IN_MANUAL
+// This variant deduces the kernel from the iterator type.
+template <typename InputIterator,
+          typename PointPMap
+>
+InputIterator
+remove_outliers(
+  InputIterator first, ///< iterator over the first input point
+  InputIterator beyond, ///< past-the-end iterator
+  PointPMap point_pmap, ///< property map: value_type of InputIterator -> Point_3
+  unsigned int k, ///< number of neighbors.
+  double threshold_percent) ///< percentage of points to remove
+{
+  typedef typename boost::property_traits<PointPMap>::value_type Point;
+  typedef typename Kernel_traits<Point>::Kernel Kernel;
+  return remove_outliers(
+    first,beyond,
+    point_pmap,
+    k,threshold_percent,
+    Kernel());
+}
+/// @endcond
+
+/// @cond SKIP_IN_MANUAL
+// This variant creates a default point property map = Identity_property_map.
+template <typename InputIterator
+>
+InputIterator
+remove_outliers(
+  InputIterator first, ///< iterator over the first input point
+  InputIterator beyond, ///< past-the-end iterator
+  unsigned int k, ///< number of neighbors.
+  double threshold_percent) ///< percentage of points to remove
+{
+  return remove_outliers(
+    first,beyond,
+    make_identity_property_map(
+    typename std::iterator_traits<InputIterator>::value_type()),
+    k,threshold_percent);
+}
+/// @endcond
+
+
+} //namespace CGAL
+
+#endif // CGAL_REMOVE_OUTLIERS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/representation_tags.h b/3rdparty/CGAL/include/CGAL/representation_tags.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/representation_tags.h
rename to 3rdparty/CGAL/include/CGAL/representation_tags.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/result_of.h b/3rdparty/CGAL/include/CGAL/result_of.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/result_of.h
rename to 3rdparty/CGAL/include/CGAL/result_of.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/segment_intersection_points_2.h b/3rdparty/CGAL/include/CGAL/segment_intersection_points_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/segment_intersection_points_2.h
rename to 3rdparty/CGAL/include/CGAL/segment_intersection_points_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/sibson_gradient_fitting.h b/3rdparty/CGAL/include/CGAL/sibson_gradient_fitting.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/sibson_gradient_fitting.h
rename to 3rdparty/CGAL/include/CGAL/sibson_gradient_fitting.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/simple_transformations_d.h b/3rdparty/CGAL/include/CGAL/simple_transformations_d.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/simple_transformations_d.h
rename to 3rdparty/CGAL/include/CGAL/simple_transformations_d.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/simplest_rational_in_interval.h b/3rdparty/CGAL/include/CGAL/simplest_rational_in_interval.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/simplest_rational_in_interval.h
rename to 3rdparty/CGAL/include/CGAL/simplest_rational_in_interval.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/sorted_matrix_search.h b/3rdparty/CGAL/include/CGAL/sorted_matrix_search.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/sorted_matrix_search.h
rename to 3rdparty/CGAL/include/CGAL/sorted_matrix_search.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/spatial_sort.h b/3rdparty/CGAL/include/CGAL/spatial_sort.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/spatial_sort.h
rename to 3rdparty/CGAL/include/CGAL/spatial_sort.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/spatial_sort_on_sphere.h b/3rdparty/CGAL/include/CGAL/spatial_sort_on_sphere.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/spatial_sort_on_sphere.h
rename to 3rdparty/CGAL/include/CGAL/spatial_sort_on_sphere.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/squared_distance_2.h b/3rdparty/CGAL/include/CGAL/squared_distance_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/squared_distance_2.h
rename to 3rdparty/CGAL/include/CGAL/squared_distance_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/squared_distance_2_1.h b/3rdparty/CGAL/include/CGAL/squared_distance_2_1.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/squared_distance_2_1.h
rename to 3rdparty/CGAL/include/CGAL/squared_distance_2_1.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/squared_distance_2_2.h b/3rdparty/CGAL/include/CGAL/squared_distance_2_2.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/squared_distance_2_2.h
rename to 3rdparty/CGAL/include/CGAL/squared_distance_2_2.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/squared_distance_3.h b/3rdparty/CGAL/include/CGAL/squared_distance_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/squared_distance_3.h
rename to 3rdparty/CGAL/include/CGAL/squared_distance_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/squared_distance_3_0.h b/3rdparty/CGAL/include/CGAL/squared_distance_3_0.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/squared_distance_3_0.h
rename to 3rdparty/CGAL/include/CGAL/squared_distance_3_0.h
diff --git a/3rdparty/CGAL/include/CGAL/squared_distance_3_1.h b/3rdparty/CGAL/include/CGAL/squared_distance_3_1.h
new file mode 100644
index 0000000..31af229
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/squared_distance_3_1.h
@@ -0,0 +1,1015 @@
+// Copyright (c) 1998-2004  
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved. 
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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(s)     : Geert-Jan Giezeman, Andreas Fabri
+
+
+#ifndef CGAL_DISTANCE_3_1_H
+#define CGAL_DISTANCE_3_1_H
+
+
+#include <CGAL/squared_distance_3_0.h>
+
+#include <CGAL/Segment_3.h>
+#include <CGAL/Line_3.h>
+#include <CGAL/Ray_3.h>
+
+
+namespace CGAL {
+
+namespace internal {
+
+template <class K>
+typename K::FT
+squared_distance(
+    const typename K::Point_3 &pt,
+    const typename K::Line_3 &line,
+    const K& k)
+{
+  typedef typename K::Vector_3 Vector_3;
+  typename K::Construct_vector_3 construct_vector;
+  Vector_3 dir(line.direction().vector());
+  Vector_3 diff = construct_vector(line.point(), pt);
+  return internal::squared_distance_to_line(dir, diff, k);
+}
+
+template <class K>
+inline
+typename K::FT
+squared_distance(
+    const typename K::Line_3 & line,
+    const typename K::Point_3 & pt,
+    const K& k)
+{
+    return squared_distance(pt, line, k);
+}
+
+
+template <class K>
+typename K::FT
+squared_distance(
+    const typename K::Point_3 &pt,
+    const typename K::Ray_3 &ray,
+    const K& k)
+{
+  typename K::Construct_vector_3 construct_vector;
+  typedef typename K::Vector_3 Vector_3;
+
+    Vector_3 diff = construct_vector(ray.source(), pt);
+    const Vector_3 &dir = ray.direction().vector();
+    if (!is_acute_angle(dir,diff, k) )
+        return (typename K::FT)(diff*diff);
+    return squared_distance_to_line(dir, diff, k);
+}
+
+
+template <class K>
+inline
+typename K::FT
+squared_distance(
+    const typename K::Ray_3 & ray,
+    const typename K::Point_3 & pt,
+    const K& k)
+{
+    return squared_distance(pt, ray, k);
+}
+
+
+
+
+template <class K>
+typename K::FT
+squared_distance(
+    const typename K::Point_3 &pt,
+    const typename K::Segment_3 &seg,
+    const K& k,
+    const Homogeneous_tag)
+{
+    typename K::Construct_vector_3 construct_vector;
+    typedef typename K::Vector_3 Vector_3;
+    typedef typename K::RT RT;
+    typedef typename K::FT FT;
+    // assert that the segment is valid (non zero length).
+    Vector_3 diff = construct_vector(seg.source(), pt);
+    Vector_3 segvec = construct_vector(seg.source(), seg.target());
+    RT d = wdot(diff,segvec, k);
+    if (d <= (RT)0)
+        return (FT(diff*diff));
+    RT e = wdot(segvec,segvec, k);
+    if ( (d * segvec.hw()) > (e * diff.hw()))
+        return squared_distance(pt, seg.target(), k);
+
+    Vector_3 wcr = wcross(segvec, diff, k);
+    return FT(wcr*wcr)/FT(e * diff.hw() * diff.hw());
+}
+
+template <class K>
+typename K::FT
+squared_distance(
+    const typename K::Point_3 &pt,
+    const typename K::Segment_3 &seg,
+    const K& k,
+    const Cartesian_tag&)
+{
+    typename K::Construct_vector_3 construct_vector;
+    typedef typename K::Vector_3 Vector_3;
+    typedef typename K::RT RT;
+    typedef typename K::FT FT;
+    // assert that the segment is valid (non zero length).
+    Vector_3 diff = construct_vector(seg.source(), pt);
+    Vector_3 segvec = construct_vector(seg.source(), seg.target());
+    RT d = wdot(diff,segvec, k);
+    if (d <= (RT)0)
+        return (FT(diff*diff));
+    RT e = wdot(segvec,segvec, k);
+    if (d > e)
+        return squared_distance(pt, seg.target(), k);
+
+    Vector_3 wcr = wcross(segvec, diff, k);
+    return FT(wcr*wcr)/e;
+}
+
+
+template <class K>
+inline
+typename K::FT
+squared_distance(
+    const typename K::Point_3 &pt,
+    const typename K::Segment_3 &seg,
+    const K& k)
+{ 
+  typedef typename K::Kernel_tag Tag;
+  Tag tag;
+  return squared_distance(pt, seg, k, tag);
+}
+
+
+template <class K>
+inline 
+typename K::FT
+squared_distance(
+    const typename K::Segment_3 & seg,
+    const typename K::Point_3 & pt,
+    const K& k)
+{
+    return squared_distance(pt, seg, k);
+}
+
+
+
+template <class K>
+typename K::Comparison_result
+compare_distance_pssC3(
+    const typename K::Point_3 &pt,
+    const typename K::Segment_3 &seg1,
+    const typename K::Segment_3 &seg2,
+    const K& k)
+{
+    typename K::Construct_vector_3 construct_vector;
+    typedef typename K::Vector_3 Vector_3;
+    typedef typename K::RT RT;
+    typedef typename K::FT FT;
+    FT d1=FT(0), d2=FT(0);
+    RT e1 = RT(1), e2 = RT(1);
+    // assert that the segment is valid (non zero length).
+    {
+      Vector_3 diff = construct_vector(seg1.source(), pt);
+      Vector_3 segvec = construct_vector(seg1.source(), seg1.target());
+      RT d = wdot(diff,segvec, k);
+      if (d <= (RT)0){
+        d1 = (FT(diff*diff));
+      }else{
+        RT e = wdot(segvec,segvec, k);
+        if (d > e){
+          d1 = squared_distance(pt, seg1.target(), k);
+        } else{
+          Vector_3 wcr = wcross(segvec, diff, k);
+          d1 = FT(wcr*wcr);
+          e1 = e;
+        }
+      }
+    }
+    {
+      Vector_3 diff = construct_vector(seg2.source(), pt);
+      Vector_3 segvec = construct_vector(seg2.source(), seg2.target());
+      RT d = wdot(diff,segvec, k);
+      if (d <= (RT)0){
+        d2 = (FT(diff*diff));
+      }else{
+        RT e = wdot(segvec,segvec, k);
+        if (d > e){
+          d2 = squared_distance(pt, seg2.target(), k);
+        } else{
+          Vector_3 wcr = wcross(segvec, diff, k);
+          d2 = FT(wcr*wcr);
+          e2 = e;
+        }
+      }
+    }
+    return compare(d1*e2, d2*e1);
+}
+
+template <class K>
+typename K::Comparison_result
+compare_distance_ppsC3(
+    const typename K::Point_3 &pt,
+    const typename K::Point_3 &pt2,
+    const typename K::Segment_3 &seg,
+    const K& k)
+{
+    typename K::Construct_vector_3 construct_vector;
+    typedef typename K::Vector_3 Vector_3;
+    typedef typename K::RT RT;
+    typedef typename K::FT FT;
+    RT e2 = RT(1);
+    // assert that the segment is valid (non zero length).
+    FT d1 = squared_distance(pt, pt2, k);
+    FT d2 = FT(0);
+    {
+      Vector_3 diff = construct_vector(seg.source(), pt);
+      Vector_3 segvec = construct_vector(seg.source(), seg.target());
+      RT d = wdot(diff,segvec, k);
+      if (d <= (RT)0){
+        d2 = (FT(diff*diff));
+      }else{
+        RT e = wdot(segvec,segvec, k);
+        if (d > e){
+          d2 = squared_distance(pt, seg.target(), k);
+        } else{
+          Vector_3 wcr = wcross(segvec, diff, k);
+          d2 = FT(wcr*wcr);
+          e2 = e;
+        }
+      }
+    }
+    return compare(d1*e2, d2);
+}
+
+
+template <class K>
+typename K::FT
+squared_distance_parallel(
+    const typename K::Segment_3 &seg1,
+    const typename K::Segment_3 &seg2,
+    const K& k)
+{
+  typedef typename K::Vector_3 Vector_3;
+    const Vector_3 &dir1 = seg1.direction().vector();
+    const Vector_3 &dir2 = seg2.direction().vector();
+ 
+    if (same_direction(dir1, dir2, k)) {
+        if (!is_acute_angle(seg1.source(), seg1.target(), seg2.source(), k))
+            return squared_distance(seg1.target(), seg2.source(), k);
+        if (!is_acute_angle(seg1.target(), seg1.source(), seg2.target(), k))
+            return squared_distance(seg1.source(), seg2.target(), k);
+    } else {
+        if (!is_acute_angle(seg1.source(), seg1.target(), seg2.target(), k))
+            return squared_distance(seg1.target(), seg2.target(), k);
+        if (!is_acute_angle(seg1.target(), seg1.source(), seg2.source(), k))
+            return squared_distance(seg1.source(), seg2.source(), k);
+    }
+    return squared_distance(seg2.source(), seg1.supporting_line(), k);
+}
+
+
+
+template <class K>
+inline
+typename K::RT 
+_distance_measure_sub(typename K::RT startwdist, typename K::RT endwdist,
+			 const typename K::Vector_3 &start, 
+			 const typename K::Vector_3 &end,
+			 const K&)
+{
+    return  CGAL_NTS abs(wmult((K*)0, startwdist, end.hw())) -
+            CGAL_NTS abs(wmult((K*)0, endwdist, start.hw()));
+}
+
+
+template <class K>
+typename K::FT
+squared_distance(
+    const typename K::Segment_3 &seg1,
+    const typename K::Segment_3 &seg2,
+    const K& k)
+{
+    typename K::Construct_vector_3 construct_vector;
+    typedef typename K::Vector_3 Vector_3;
+    typedef typename K::Point_3 Point_3;
+    typedef typename K::RT RT;
+    typedef typename K::FT FT;
+    const Point_3 &start1 = seg1.source();
+    const Point_3 &start2 = seg2.source();
+    const Point_3 &end1 = seg1.target();
+    const Point_3 &end2 = seg2.target();
+
+    if (start1 == end1)
+        return squared_distance(start1, seg2, k);
+    if (start2 == end2)
+        return squared_distance(start2, seg1, k);
+    
+    Vector_3 dir1, dir2, normal;
+    dir1 = seg1.direction().vector();
+    dir2 = seg2.direction().vector();
+    normal = wcross(dir1, dir2, k);
+    if (is_null(normal, k))
+        return squared_distance_parallel(seg1, seg2, k);
+    
+    bool crossing1, crossing2;
+    RT sdm_s1to2, sdm_e1to2, sdm_s2to1, sdm_e2to1;
+    Vector_3 perpend1, perpend2, s2mins1, e2mins1, e1mins2;
+    perpend1 = wcross(dir1, normal, k);
+    perpend2 = wcross(dir2, normal, k);
+    s2mins1 = construct_vector(start1, start2);
+    e2mins1 = construct_vector(start1, end2);
+    e1mins2 = construct_vector(start2, end1);
+    sdm_s1to2 = -RT(wdot(perpend2, s2mins1, k));
+    sdm_e1to2 = wdot(perpend2, e1mins2, k);
+    sdm_s2to1 = wdot(perpend1, s2mins1, k);
+    sdm_e2to1 = wdot(perpend1, e2mins1, k);
+    
+    if (sdm_s1to2 < RT(0)) {
+        crossing1 = (sdm_e1to2 >= RT(0));
+    } else {
+        if (sdm_e1to2 <= RT(0)) {
+            crossing1 = true;
+        } else {
+            crossing1 = (sdm_s1to2 == RT(0));
+        }
+    }
+    if (sdm_s2to1 < RT(0)) {
+        crossing2 = (sdm_e2to1 >= RT(0));
+    } else {
+        if (sdm_e2to1 <= RT(0)) {
+            crossing2 = true;
+        } else {
+            crossing2 = (sdm_s2to1 == RT(0));
+        }
+    }
+    
+    if (crossing1) {
+        if (crossing2) {
+            return squared_distance_to_plane(normal, s2mins1, k);
+        }
+    
+        RT dm;
+        dm = _distance_measure_sub(
+                  sdm_s2to1, sdm_e2to1, s2mins1, e2mins1, k);
+        if (dm < RT(0)) {
+            return squared_distance(start2, seg1, k);
+        } else {
+            if (dm > RT(0)) {
+                return squared_distance(end2, seg1, k);
+            } else {
+                // should not happen with exact arithmetic.
+                return squared_distance_parallel(seg1, seg2, k);
+            }
+        }
+    } else {
+        if (crossing2) {
+            RT dm;
+            dm =_distance_measure_sub(
+                 sdm_s1to2, sdm_e1to2, s2mins1, e1mins2, k);
+            if (dm < RT(0)) {
+                return squared_distance(start1, seg2, k);
+            } else {
+                if (dm > RT(0)) {
+                    return squared_distance(end1, seg2, k);
+                } else {
+                    // should not happen with exact arithmetic.
+                    return squared_distance_parallel(seg1, seg2, k);
+                }
+            }
+        } else {
+            FT min1, min2;
+            RT dm;
+            dm = _distance_measure_sub(
+                     sdm_s1to2, sdm_e1to2, s2mins1, e1mins2, k);
+            if (dm == RT(0)) // should not happen with exact arithmetic.
+               return squared_distance_parallel(seg1, seg2, k);
+            min1 = (dm < RT(0)) ?
+                squared_distance(seg1.source(), seg2, k):
+                squared_distance(end1, seg2, k);
+            dm = _distance_measure_sub(
+                     sdm_s2to1, sdm_e2to1, s2mins1, e2mins1, k);
+            if (dm == RT(0)) // should not happen with exact arithmetic.
+                return squared_distance_parallel(seg1, seg2, k);
+            min2 = (dm < RT(0)) ?
+                squared_distance(start2, seg1, k):
+                squared_distance(end2, seg1, k);
+            return (min1 < min2) ? min1 : min2;
+        }
+    }
+    
+}
+
+
+
+
+
+
+template <class K>
+typename K::FT
+squared_distance_parallel(
+    const typename K::Segment_3 &seg,
+    const typename K::Ray_3 &ray,
+    const K& k)
+{
+
+  typedef typename K::Vector_3 Vector_3;
+  bool same_direction;
+  const Vector_3 &dir1 = seg.direction().vector();
+  const Vector_3 &dir2 = ray.direction().vector();
+  if (CGAL_NTS abs(dir1.hx()) > CGAL_NTS abs(dir1.hy())) {
+    same_direction = (CGAL_NTS sign(dir1.hx()) == CGAL_NTS sign(dir2.hx()));
+  } else {
+    same_direction = (CGAL_NTS sign(dir1.hy()) == CGAL_NTS sign(dir2.hy()));
+  }
+  if (same_direction) {
+    if (!is_acute_angle(seg.source(), seg.target(), ray.source(), k))
+      return squared_distance(seg.target(), ray.source(), k);
+  } else {
+    if (!is_acute_angle(seg.target(), seg.source(), ray.source(), k))
+      return squared_distance(seg.source(), ray.source(), k);
+  }
+  return squared_distance(ray.source(), seg.supporting_line(), k);
+}
+
+
+template <class K>
+typename K::FT
+squared_distance(
+    const typename K::Segment_3 &seg,
+    const typename K::Ray_3 &ray,
+    const K& k)
+{
+    typename K::Construct_vector_3 construct_vector;
+    typedef typename K::Point_3 Point_3;
+    typedef typename K::Vector_3 Vector_3;
+    typedef typename K::RT RT;
+    typedef typename K::FT FT;
+    const Point_3 & ss = seg.source();
+    const Point_3 & se = seg.target();
+    if (ss == se)
+        return squared_distance(ss, ray, k);
+    Vector_3 raydir, segdir, normal;
+    raydir = ray.direction().vector();
+    segdir = seg.direction().vector();
+    normal = wcross(segdir, raydir, k);
+    if (is_null(normal, k))
+        return squared_distance_parallel(seg, ray, k);
+
+    bool crossing1, crossing2;
+    RT sdm_ss2r, sdm_se2r, sdm_rs2s, sdm_re2s;
+    Vector_3 perpend2seg, perpend2ray, ss_min_rs, se_min_rs;
+    perpend2seg = wcross(segdir, normal, k);
+    perpend2ray = wcross(raydir, normal, k);
+    ss_min_rs = construct_vector(ray.source(), ss);
+    se_min_rs = construct_vector(ray.source(), se);
+    sdm_ss2r = wdot(perpend2ray, ss_min_rs, k);
+    sdm_se2r = wdot(perpend2ray, se_min_rs, k);
+    if (sdm_ss2r < RT(0)) {
+        crossing1 = (sdm_se2r >= RT(0));
+    } else {
+        if (sdm_se2r <= RT(0)) {
+            crossing1 = true;
+        } else {
+            crossing1 = (sdm_ss2r == RT(0));
+        }
+    }
+
+    sdm_rs2s = -RT(wdot(perpend2seg, ss_min_rs, k));
+    sdm_re2s = wdot(perpend2seg, raydir, k);
+    if (sdm_rs2s < RT(0)) {
+        crossing2 = (sdm_re2s >= RT(0));
+    } else {
+        if (sdm_re2s <= RT(0)) {
+            crossing2 = true;
+        } else {
+            crossing2 = (sdm_rs2s == RT(0));
+        }
+    }
+
+    if (crossing1) {
+        if (crossing2) {
+            return squared_distance_to_plane(normal, ss_min_rs, k);
+        }
+        return squared_distance(ray.source(), seg, k);
+    } else {
+        if (crossing2) {
+            RT dm;
+            dm = _distance_measure_sub(
+                    sdm_ss2r, sdm_se2r, ss_min_rs, se_min_rs, k);
+            if (dm < RT(0)) {
+                return squared_distance(ss, ray, k);
+            } else {
+                if (dm > RT(0)) {
+                    return squared_distance(se, ray, k);
+                } else {
+                    // parallel, should not happen (no crossing)
+                    return squared_distance_parallel(seg, ray, k);
+                }
+            }
+        } else {
+            FT min1, min2;
+            RT dm;
+            dm = _distance_measure_sub(
+                    sdm_ss2r, sdm_se2r, ss_min_rs, se_min_rs, k);
+            if (dm == RT(0))
+                return squared_distance_parallel(seg, ray, k);
+            min1 = (dm < RT(0))
+                 ? squared_distance(ss, ray, k)
+                 : squared_distance(se, ray, k);
+            min2 = squared_distance(ray.source(), seg, k);
+            return (min1 < min2) ? min1 : min2;
+        }
+    }
+}
+
+
+
+template <class K>
+inline
+typename K::FT
+squared_distance(
+    const typename K::Ray_3 & ray,
+    const typename K::Segment_3 & seg,
+    const K& k)
+{
+    return squared_distance(seg, ray, k);
+}
+
+
+template <class K>
+typename K::FT
+squared_distance(
+    const typename K::Segment_3 &seg,
+    const typename K::Line_3 &line,
+    const K& k)
+{
+    typename K::Construct_vector_3 construct_vector;
+    typedef typename K::Vector_3 Vector_3;
+    typedef typename K::Point_3 Point_3;
+    typedef typename K::RT RT;
+    const Point_3 &linepoint = line.point();
+    const Point_3 &start = seg.source();
+    const Point_3 &end = seg.target();
+
+    if (start == end)
+        return squared_distance(start, line, k);
+    Vector_3 linedir = line.direction().vector();
+    Vector_3 segdir = seg.direction().vector();
+    Vector_3 normal = wcross(segdir, linedir, k);
+    if (is_null(normal, k))
+        return squared_distance_to_line(linedir, 
+					construct_vector(linepoint,start), k);
+
+    bool crossing;
+    RT sdm_ss2l, sdm_se2l;
+    Vector_3 perpend2line, start_min_lp, end_min_lp;
+    perpend2line = wcross(linedir, normal, k);
+    start_min_lp = construct_vector(linepoint, start);
+    end_min_lp = construct_vector(linepoint, end);
+    sdm_ss2l = wdot(perpend2line, start_min_lp, k);
+    sdm_se2l = wdot(perpend2line, end_min_lp, k);
+    if (sdm_ss2l < RT(0)) {
+        crossing = (sdm_se2l >= RT(0));
+    } else {
+        if (sdm_se2l <= RT(0)) {
+            crossing = true;
+        } else {
+            crossing = (sdm_ss2l == RT(0));
+        }
+    }
+
+    if (crossing) {
+        return squared_distance_to_plane(normal, start_min_lp, k);
+    } else {
+        RT dm;
+        dm = _distance_measure_sub(
+                sdm_ss2l, sdm_se2l, start_min_lp, end_min_lp, k);
+        if (dm <= RT(0)) {
+            return squared_distance_to_line(linedir, start_min_lp, k);
+        } else {
+            return squared_distance_to_line(linedir, end_min_lp, k);
+        }
+    }
+}
+
+
+template <class K>
+inline
+typename K::FT
+squared_distance(
+    const typename K::Line_3 & line,
+    const typename K::Segment_3 & seg,
+    const K& k)
+{
+    return squared_distance(seg, line, k);
+}
+
+
+
+
+template <class K>
+typename K::FT
+ray_ray_squared_distance_parallel(
+    const typename K::Vector_3 &ray1dir,
+    const typename K::Vector_3 &ray2dir,
+    const typename K::Vector_3 &s1_min_s2,
+    const K& k)
+{
+  if (!is_acute_angle(ray2dir, s1_min_s2, k)) {
+    if (!same_direction(ray1dir, ray2dir, k))
+      return (typename K::FT)(s1_min_s2*s1_min_s2);
+  }
+  return squared_distance_to_line(ray1dir, s1_min_s2, k);
+}
+
+
+template <class K>
+typename K::FT
+squared_distance(
+    const typename K::Ray_3 &ray1,
+    const typename K::Ray_3 &ray2,
+    const K& k)
+{
+  typename K::Construct_vector_3 construct_vector;
+    typedef typename K::Vector_3 Vector_3;
+    typedef typename K::Point_3 Point_3;
+    typedef typename K::RT RT;
+    typedef typename K::FT FT;
+    const Point_3 & s1 = ray1.source();
+    const Point_3 & s2 = ray2.source();
+    Vector_3 dir1, dir2, normal;
+    dir1 = ray1.direction().vector();
+    dir2 = ray2.direction().vector();
+    normal = wcross(dir1, dir2, k);
+    Vector_3 s1_min_s2 = construct_vector(s2, s1);
+    if (is_null(normal, k))
+        return ray_ray_squared_distance_parallel(dir1, dir2, s1_min_s2, k);
+
+    bool crossing1, crossing2;
+    RT sdm_s1_2, sdm_s2_1;
+    Vector_3 perpend1, perpend2;
+    perpend1 = wcross(dir1, normal, k);
+    perpend2 = wcross(dir2, normal, k);
+
+    sdm_s1_2 = wdot(perpend2, s1_min_s2, k);
+    if (sdm_s1_2 < RT(0)) {
+        crossing1 = (RT(wdot(perpend2, dir1, k)) >= RT(0));
+    } else {
+        if (RT(wdot(perpend2, dir1, k)) <= RT(0)) {
+            crossing1 = true;
+        } else {
+            crossing1 = (sdm_s1_2 == RT(0));
+        }
+    }
+    sdm_s2_1 = -RT(wdot(perpend1, s1_min_s2, k));
+    if (sdm_s2_1 < RT(0)) {
+        crossing2 = (RT(wdot(perpend1, dir2, k)) >= RT(0));
+    } else {
+        if (RT(wdot(perpend1, dir2, k)) <= RT(0)) {
+            crossing2 = true;
+        } else {
+            crossing2 = (sdm_s2_1 == RT(0));
+        }
+    }
+    if (crossing1) {
+        if (crossing2)
+            return squared_distance_to_plane(normal, s1_min_s2, k);
+        return squared_distance(ray2.source(), ray1, k);
+    } else {
+        if (crossing2) {
+            return squared_distance(ray1.source(), ray2, k);
+        } else {
+          FT min1, min2;
+            min1 = squared_distance(ray1.source(), ray2, k);
+            min2 = squared_distance(ray2.source(), ray1, k);
+            return (min1 < min2) ? min1 : min2;
+        }
+    }
+}
+
+
+
+
+
+template <class K>
+typename K::FT
+squared_distance(
+    const typename K::Line_3 &line,
+    const typename K::Ray_3 &ray,
+    const K& k)
+{
+  typename K::Construct_vector_3 construct_vector;
+  typedef typename K::Vector_3 Vector_3;
+  typedef typename K::Point_3 Point_3;
+    typedef typename K::RT RT;
+    const Point_3 & rs =ray.source();
+    Vector_3 raydir, linedir, normal;
+    linedir = line.direction().vector();
+    raydir = ray.direction().vector();
+    normal = wcross(raydir, linedir, k);
+    Vector_3 rs_min_lp = construct_vector(line.point(), rs);
+    if (is_null(normal, k))
+        return squared_distance_to_line(linedir, rs_min_lp, k);
+
+    bool crossing;
+    RT sdm_sr_l;
+    Vector_3 perpend2l;
+    perpend2l = wcross(linedir, normal, k);
+
+    sdm_sr_l = wdot(perpend2l, rs_min_lp, k);
+    if (sdm_sr_l < RT(0)) {
+        crossing = (RT(wdot(perpend2l, raydir, k)) >= RT(0));
+    } else {
+        if (RT(wdot(perpend2l, raydir, k)) <= RT(0)) {
+            crossing = true;
+        } else {
+            crossing = (sdm_sr_l == RT(0));
+        }
+    }
+
+    if (crossing)
+        return squared_distance_to_plane(normal, rs_min_lp, k);
+    else
+        return squared_distance_to_line(linedir, rs_min_lp, k);
+}
+
+
+template <class K>
+inline typename K::FT
+squared_distance(
+    const typename K::Ray_3 & ray,
+    const typename K::Line_3 & line,
+    const K& k)
+{
+    return squared_distance(line, ray, k);
+}
+
+
+
+
+template <class K>
+typename K::FT
+squared_distance(
+    const typename K::Line_3 &line1,
+    const typename K::Line_3 &line2,
+    const K& k)
+{   
+  typename K::Construct_vector_3 construct_vector;
+    typedef typename K::Vector_3 Vector_3;
+
+    Vector_3 dir1, dir2, normal, diff;
+    dir1 = line1.direction().vector();
+    dir2 = line2.direction().vector();
+    normal = wcross(dir1, dir2, k);
+    diff = construct_vector(line1.point(), line2.point());
+    if (is_null(normal, k))
+        return squared_distance_to_line(dir2, diff, k);
+    return squared_distance_to_plane(normal, diff, k);
+}
+
+
+
+} // namespace internal
+
+
+
+template <class K>
+inline
+typename K::FT
+squared_distance(const Point_3<K> &pt,
+		 const Line_3<K> &line)
+{
+  return internal::squared_distance(pt, line, K());
+}
+
+
+template <class K>
+inline
+typename K::FT
+squared_distance(
+    const Line_3<K> & line,
+    const Point_3<K> & pt)
+{
+  return internal::squared_distance(pt, line, K());
+}
+
+
+template <class K>
+inline
+typename K::FT
+squared_distance(
+    const Point_3<K> &pt,
+    const Ray_3<K> &ray)
+{
+    return internal::squared_distance(pt, ray, K());
+}
+
+
+template <class K>
+inline
+typename K::FT
+squared_distance(
+    const Ray_3<K> & ray,
+    const Point_3<K> & pt)
+{
+    return internal::squared_distance(pt, ray, K());
+}
+
+
+template <class K>
+inline
+typename K::FT
+squared_distance(
+    const Point_3<K> &pt,
+    const Segment_3<K> &seg)
+{
+  return internal::squared_distance(pt, seg, K());
+}
+
+
+template <class K>
+inline
+typename K::FT
+squared_distance(
+    const Segment_3<K> & seg,
+    const Point_3<K> & pt)
+{
+    return internal::squared_distance(pt, seg, K());
+}
+
+
+
+
+template <class K>
+inline
+typename K::FT
+squared_distance_parallel(
+    const Segment_3<K> &seg1,
+    const Segment_3<K> &seg2)
+{
+  return internal::squared_distance_parallel(seg1, seg2, K());
+}
+
+
+
+
+template <class K>
+inline
+typename K::FT
+squared_distance(const Segment_3<K> &seg1,
+		 const Segment_3<K> &seg2)
+{
+  return internal::squared_distance(seg1, seg2, K());
+}
+
+
+
+
+
+
+template <class K>
+inline
+typename K::FT
+squared_distance_parallel(
+    const Segment_3<K> &seg,
+    const Ray_3<K> &ray)
+{
+  return internal::squared_distance_parallel(ray,seg, K());
+}
+
+
+template <class K>
+inline
+typename K::FT
+squared_distance(
+    const Segment_3<K> &seg,
+    const Ray_3<K> &ray)
+{
+  return internal::squared_distance(ray, seg, K());
+}
+
+
+
+template <class K>
+inline
+typename K::FT
+squared_distance(
+    const Ray_3<K> & ray,
+    const Segment_3<K> & seg)
+{
+    return internal::squared_distance(seg, ray, K());
+}
+
+
+template <class K>
+inline
+typename K::FT
+squared_distance(
+    const Segment_3<K> &seg,
+    const Line_3<K> &line)
+{
+  return internal::squared_distance(seg, line, K());
+}
+
+
+template <class K>
+inline
+typename K::FT
+squared_distance(
+    const Line_3<K> & line,
+    const Segment_3<K> & seg)
+{
+    return internal::squared_distance(seg, line, K());
+}
+
+
+
+
+template <class K>
+inline
+typename K::FT
+ray_ray_squared_distance_parallel(
+    const Vector_3<K> &ray1dir,
+    const Vector_3<K> &ray2dir,
+    const Vector_3<K> &s1_min_s2)
+{
+  return internal::ray_ray_squared_distance_parallel(ray1dir, ray2dir, 
+						  s1_min_s2, K());
+}
+
+template <class K>
+inline
+typename K::FT
+squared_distance(
+    const Ray_3<K> &ray1,
+    const Ray_3<K> &ray2)
+{
+  return internal::squared_distance(ray1, ray2, K());
+}
+
+
+
+
+
+template <class K>
+inline
+typename K::FT
+squared_distance(
+    const Line_3<K> &line,
+    const Ray_3<K> &ray)
+{
+  return internal::squared_distance(line, ray, K());
+}
+
+
+template <class K>
+inline
+typename K::FT
+squared_distance(
+    const Ray_3<K> & ray,
+    const Line_3<K> & line)
+{
+    return internal::squared_distance(line, ray, K());
+}
+
+
+
+
+template <class K>
+inline
+typename K::FT
+squared_distance(
+    const Line_3<K> &line1,
+    const Line_3<K> &line2)
+{  
+    return internal::squared_distance(line1, line2, K());
+}
+
+
+} //namespace CGAL
+
+
+#endif
diff --git a/3rdparty/CGAL/include/CGAL/squared_distance_3_2.h b/3rdparty/CGAL/include/CGAL/squared_distance_3_2.h
new file mode 100644
index 0000000..c5d2d03
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/squared_distance_3_2.h
@@ -0,0 +1,404 @@
+// Copyright (c) 1998-2004  
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved. 
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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(s)     : Geert-Jan Giezeman, Andreas Fabri
+
+
+#ifndef CGAL_DISTANCE_3_2_H
+#define CGAL_DISTANCE_3_2_H
+
+#include <CGAL/squared_distance_3_0.h>
+#include <CGAL/squared_distance_3_1.h>
+#include <CGAL/wmult.h>
+
+#include <CGAL/Point_3.h>
+#include <CGAL/Segment_3.h>
+#include <CGAL/Line_3.h>
+#include <CGAL/Ray_3.h>
+#include <CGAL/Triangle_3.h>
+#include <CGAL/Plane_3.h>
+
+namespace CGAL {
+
+namespace internal {
+
+template <class K>
+bool
+contains_vector(const typename K::Plane_3 &pl, 
+		const typename K::Vector_3 &vec,
+		const K&)
+{
+  typedef typename K::RT RT;
+  return pl.a()*vec.hx() + pl.b()*vec.hy() + pl.c() * vec.hz() == RT(0);
+}
+
+
+template <class K>
+inline typename K::FT
+squared_distance(
+    const typename K::Point_3 & pt,
+    const typename K::Plane_3 & plane,
+    const K& k)
+{
+  typename K::Construct_vector_3 construct_vector;
+  typedef typename K::Vector_3 Vector_3;
+  Vector_3 diff = construct_vector(plane.point(), pt);
+  return squared_distance_to_plane(plane.orthogonal_vector(), diff, k);
+}
+
+
+
+template <class K>
+inline typename K::FT
+squared_distance(
+    const typename K::Plane_3 & plane,
+    const typename K::Point_3 & pt,
+    const K& k)
+{
+    return squared_distance(pt, plane, k);
+}
+
+template <class K>
+typename K::FT
+squared_distance(
+    const typename K::Line_3 &line,
+    const typename K::Plane_3 &plane,
+    const K& k)
+{
+    typedef typename K::FT FT;
+    if (contains_vector(plane, line.direction().vector(), k))
+        return squared_distance(plane, line.point(), k);
+    return FT(0);
+}
+
+
+template <class K>
+inline typename K::FT
+squared_distance(
+    const typename K::Plane_3 & p,
+    const typename K::Line_3 & line,
+    const K& k)
+{
+    return squared_distance(line, p, k);
+}
+
+template <class K>
+typename K::FT
+squared_distance(
+    const typename K::Ray_3 &ray,
+    const typename K::Plane_3 &plane,
+    const K& k)
+{
+    typename K::Construct_vector_3 construct_vector;
+    typedef typename K::Point_3 Point_3;
+    typedef typename K::Vector_3 Vector_3;
+    typedef typename K::RT RT;
+    typedef typename K::FT FT;
+    const Point_3 &start = ray.start();
+    const Point_3 &planepoint = plane.point();
+    Vector_3 start_min_pp = construct_vector(planepoint, start);
+    Vector_3 end_min_pp = ray.direction().vector();
+    const Vector_3 &normal = plane.orthogonal_vector();
+    RT sdm_rs2pp = wdot(normal, start_min_pp, k);
+    RT sdm_re2pp = wdot(normal, end_min_pp, k);
+    switch (CGAL_NTS sign(sdm_rs2pp)) {
+    case -1:
+        if (sdm_re2pp > RT(0))
+            return FT(0);
+        return squared_distance_to_plane(normal, start_min_pp, k);
+    case 0:
+    default:
+        return FT(0);
+    case 1:
+        if (sdm_re2pp < RT(0))
+            return FT(0);
+        return squared_distance_to_plane(normal, start_min_pp, k);
+    }
+}
+
+
+template <class K>
+inline typename K::FT
+squared_distance(
+    const typename K::Plane_3 & plane,
+    const typename K::Ray_3 & ray,
+    const K& k)
+{
+    return squared_distance(ray, plane, k);
+}
+
+template <class K>
+typename K::FT
+squared_distance(
+    const typename K::Segment_3 &seg,
+    const typename K::Plane_3 &plane,
+    const K& k)
+{
+    typename K::Construct_vector_3 construct_vector;
+    typedef typename K::Point_3 Point_3;
+    typedef typename K::Vector_3 Vector_3;
+    typedef typename K::RT RT;
+    typedef typename K::FT FT;
+    const Point_3 &start = seg.start();
+    const Point_3 &end = seg.end();
+    if (start == end)
+        return squared_distance(start, plane, k);
+    const Point_3 &planepoint = plane.point();
+    Vector_3 start_min_pp = construct_vector(planepoint, start);
+    Vector_3 end_min_pp = construct_vector(planepoint, end);
+    const Vector_3 &normal = plane.orthogonal_vector();
+    RT sdm_ss2pp = wdot(normal, start_min_pp, k);
+    RT sdm_se2pp = wdot(normal, end_min_pp, k);
+    switch (CGAL_NTS sign(sdm_ss2pp)) {
+    case -1:
+        if (sdm_se2pp >= RT(0))
+            return FT(0);
+        if (sdm_ss2pp * end_min_pp.hw() >= sdm_se2pp * start_min_pp.hw())
+            return squared_distance_to_plane(normal, start_min_pp, k);
+        else
+            return squared_distance_to_plane(normal, end_min_pp, k);
+    case 0:
+    default:
+        return FT(0);
+    case 1:
+        if (sdm_se2pp <= RT(0))
+            return FT(0);
+        if (sdm_ss2pp  * end_min_pp.hw() <= sdm_se2pp * start_min_pp.hw())
+            return squared_distance_to_plane(normal, start_min_pp, k);
+        else
+            return squared_distance_to_plane(normal, end_min_pp, k);
+    }
+}
+
+
+template <class K>
+inline typename K::FT
+squared_distance(
+    const typename K::Plane_3 & plane,
+    const typename K::Segment_3 & seg,
+    const K& k)
+{
+    return squared_distance(seg, plane, k);
+}
+
+
+template <class K>
+inline bool
+on_left_of_triangle_edge(const typename K::Point_3 & pt,
+                         const typename K::Vector_3 & normal,
+                         const typename K::Point_3 & ep0,
+                         const typename K::Point_3 & ep1,
+                         const K& k)
+{
+  // return true iff pt is on the negative side of the plane defined
+  // by (ep0, ep1) and normal
+  typename K::Construct_vector_3 vector;
+  typename K::Vector_3 edge = vector(ep0, ep1);
+  typename K::Vector_3 diff = vector(ep0, pt);
+
+  typedef typename K::RT RT;
+
+  const bool result = 
+    RT(wdot(wcross(edge,
+                   normal,
+                   k), 
+            diff,
+            k)) <= RT(0);
+  return result;
+}
+
+template <class K>
+inline typename K::FT
+squared_distance_to_triangle(
+    const typename K::Point_3 & pt,
+    const typename K::Point_3 & t0,
+    const typename K::Point_3 & t1,
+    const typename K::Point_3 & t2,
+    const K& k)
+{
+  typename K::Construct_vector_3 vector;
+  typedef typename K::Vector_3 Vector_3;
+  const Vector_3 e1 = vector(t0, t1);
+  const Vector_3 oe3 = vector(t0, t2);
+  const Vector_3 normal = wcross(e1, oe3, k);
+
+  if(normal != NULL_VECTOR
+     && on_left_of_triangle_edge(pt, normal, t0, t1, k)
+     && on_left_of_triangle_edge(pt, normal, t1, t2, k)
+     && on_left_of_triangle_edge(pt, normal, t2, t0, k))
+      {
+        // the projection of pt is inside the triangle
+        return squared_distance_to_plane(normal, vector(t0, pt), k);
+      }
+      else {
+        // The case normal==NULL_VECTOR covers the case when the triangle
+        // is colinear, or even more degenerate. In that case, we can
+        // simply take also the distance to the three segments.
+        typename K::FT d1 = squared_distance(pt, 
+                                             typename K::Segment_3(t2, t0),
+                                             k);
+        typename K::FT d2 = squared_distance(pt, 
+                                             typename K::Segment_3(t1, t2),
+                                             k);
+        typename K::FT d3 = squared_distance(pt, 
+                                             typename K::Segment_3(t0, t1),
+                                             k);
+       
+        return (std::min)( (std::min)(d1, d2), d3);
+      }
+}
+
+template <class K>
+inline typename K::FT
+squared_distance(
+    const typename K::Point_3 & pt,
+    const typename K::Triangle_3 & t,
+    const K& k)
+{
+  typename K::Construct_vertex_3 vertex;
+  return squared_distance_to_triangle(pt,
+                                      vertex(t, 0),
+                                      vertex(t, 1),
+                                      vertex(t, 2),
+                                      k);
+}
+
+} // namespace internal
+
+
+template <class K>
+bool
+contains_vector(const Plane_3<K> &pl, const Vector_3<K> &vec)
+{
+  return internal::contains_vector(pl,vec, K());
+}
+
+
+template <class K>
+inline 
+typename K::FT
+squared_distance(
+    const Point_3<K> & pt,
+    const Plane_3<K> & plane)
+{
+  return internal::squared_distance(pt, plane, K());
+}
+
+
+
+template <class K>
+inline 
+typename K::FT
+squared_distance(
+    const Plane_3<K> & plane,
+    const Point_3<K> & pt)
+{
+    return internal::squared_distance(pt, plane, K());
+}
+
+template <class K>
+inline
+typename K::FT
+squared_distance(
+    const Line_3<K> &line,
+    const Plane_3<K> &plane)
+{
+    return internal::squared_distance(line, plane, K());
+}
+
+
+template <class K>
+inline 
+typename K::FT
+squared_distance(
+    const Plane_3<K> & p,
+    const Line_3<K> & line)
+{
+    return internal::squared_distance(line, p, K());
+}
+
+template <class K>
+inline
+typename K::FT
+squared_distance(
+    const Ray_3<K> &ray,
+    const Plane_3<K> &plane)
+{
+  return internal::squared_distance(ray, plane, K());
+}
+
+
+
+template <class K>
+inline 
+typename K::FT
+squared_distance(
+    const Plane_3<K> & plane,
+    const Ray_3<K> & ray)
+{
+    return internal::squared_distance(ray, plane, K());
+}
+
+template <class K>
+inline
+typename K::FT
+squared_distance(
+    const Segment_3<K> &seg,
+    const Plane_3<K> &plane)
+{
+  return internal::squared_distance(seg, plane, K());
+
+}
+
+
+template <class K>
+inline 
+typename K::FT
+squared_distance(
+    const Plane_3<K> & plane,
+    const Segment_3<K> & seg)
+{
+    return internal::squared_distance(seg, plane, K());
+}
+
+template <class K>
+inline
+typename K::FT
+squared_distance(const Point_3<K> & pt,
+                 const Triangle_3<K> & t) {
+  return internal::squared_distance(pt, t, K());
+}
+
+
+template <class K>
+inline
+typename K::FT
+squared_distance(const Triangle_3<K> & t,
+                 const Point_3<K> & pt) {
+  return internal::squared_distance(pt, t, K());
+}
+
+
+} //namespace CGAL
+
+
+#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/squared_distance_utils.h b/3rdparty/CGAL/include/CGAL/squared_distance_utils.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/squared_distance_utils.h
rename to 3rdparty/CGAL/include/CGAL/squared_distance_utils.h
diff --git a/3rdparty/CGAL/include/CGAL/sse2.h b/3rdparty/CGAL/include/CGAL/sse2.h
new file mode 100644
index 0000000..3e8394d
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/sse2.h
@@ -0,0 +1,36 @@
+// Copyright (c) 1999,2007  
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved. 
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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(s)     :  Andreas Fabri
+
+#ifndef CGAL_SSE2_H
+#define CGAL_SSE2_H
+
+#include <emmintrin.h>
+
+#if defined ( _MSC_VER )
+#define CGAL_ALIGN_16  __declspec(align(16))
+#elif defined( __GNUC__ )
+#define  CGAL_ALIGN_16 __attribute__((aligned(16))) 
+#endif
+
+#endif // CGAL_SSE2_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/streamlines_assertions.h b/3rdparty/CGAL/include/CGAL/streamlines_assertions.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/streamlines_assertions.h
rename to 3rdparty/CGAL/include/CGAL/streamlines_assertions.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/subdivide_skin_surface_mesh_3.h b/3rdparty/CGAL/include/CGAL/subdivide_skin_surface_mesh_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/subdivide_skin_surface_mesh_3.h
rename to 3rdparty/CGAL/include/CGAL/subdivide_skin_surface_mesh_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/subdivide_union_of_balls_mesh_3.h b/3rdparty/CGAL/include/CGAL/subdivide_union_of_balls_mesh_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/subdivide_union_of_balls_mesh_3.h
rename to 3rdparty/CGAL/include/CGAL/subdivide_union_of_balls_mesh_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/surface_mesh_parameterization_assertions.h b/3rdparty/CGAL/include/CGAL/surface_mesh_parameterization_assertions.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/surface_mesh_parameterization_assertions.h
rename to 3rdparty/CGAL/include/CGAL/surface_mesh_parameterization_assertions.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/surface_neighbor_coordinates_3.h b/3rdparty/CGAL/include/CGAL/surface_neighbor_coordinates_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/surface_neighbor_coordinates_3.h
rename to 3rdparty/CGAL/include/CGAL/surface_neighbor_coordinates_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/surface_neighbors_3.h b/3rdparty/CGAL/include/CGAL/surface_neighbors_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/surface_neighbors_3.h
rename to 3rdparty/CGAL/include/CGAL/surface_neighbors_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/surface_reconstruction_points_assertions.h b/3rdparty/CGAL/include/CGAL/surface_reconstruction_points_assertions.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/surface_reconstruction_points_assertions.h
rename to 3rdparty/CGAL/include/CGAL/surface_reconstruction_points_assertions.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/sweep_observer.h b/3rdparty/CGAL/include/CGAL/sweep_observer.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/sweep_observer.h
rename to 3rdparty/CGAL/include/CGAL/sweep_observer.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/tags.h b/3rdparty/CGAL/include/CGAL/tags.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/tags.h
rename to 3rdparty/CGAL/include/CGAL/tags.h
diff --git a/3rdparty/CGAL/include/CGAL/test_FPU_rounding_mode_impl.h b/3rdparty/CGAL/include/CGAL/test_FPU_rounding_mode_impl.h
new file mode 100644
index 0000000..797093c
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/test_FPU_rounding_mode_impl.h
@@ -0,0 +1,79 @@
+// Copyright (c) 2008  GeometryFactory (France)
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; 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(s)     : Laurent Rineau
+
+#ifdef CGAL_HEADER_ONLY
+#define CGAL_INLINE_FUNCTION inline
+#else
+#define CGAL_INLINE_FUNCTION
+#endif
+
+#ifndef CGAL_NDEBUG
+
+#include <CGAL/basic.h>
+#include <CGAL/assertions.h>
+
+namespace CGAL {
+
+struct Check_FPU_rounding_mode_is_restored {
+  FPU_CW_t mode;
+
+  Check_FPU_rounding_mode_is_restored()
+    : mode( FPU_get_cw()) {}
+
+  ~Check_FPU_rounding_mode_is_restored()
+  {
+    CGAL_assertion_msg( FPU_get_cw() == mode,
+                        "The default FPU rounding mode has not been restored "
+                        " before the exit of the program. "
+                        "That may be a bug in some CGAL kernel code.");
+  }
+};
+
+#ifdef CGAL_HEADER_ONLY
+
+inline const Check_FPU_rounding_mode_is_restored& 
+get_static_check_fpu_rounding_mode_is_restored()
+{
+  // A static object that emits a warning if the rounding mode at the
+  // beginning and the end of the program are not the same.
+  // Note that the get_static_check_fpu_rounding_mode_is_restored() function
+  // must be called at least once so that this object is created.
+  // It is done in the FPU_set_cw() function in FPU.h
+  static const Check_FPU_rounding_mode_is_restored check_fpu_rounding_mode_is_restored;
+  return check_fpu_rounding_mode_is_restored;
+}
+
+namespace {
+  CGAL_UNUSED const Check_FPU_rounding_mode_is_restored &
+    check_fpu_rounding_mode_is_restored 
+    = get_static_check_fpu_rounding_mode_is_restored();
+}
+
+#else
+
+// A global object that emits a warning if the rounding mode at the
+// beginning and the end of the program are not the same.
+static const Check_FPU_rounding_mode_is_restored check_fpu_rounding_mode_is_restored;
+
+#endif // CGAL_HEADER_ONLY
+
+} // end namespace CGAL
+
+#endif // #ifnedef CGAL_NDEBUG
diff --git a/3rdparty/CGAL-4.8/include/CGAL/to_rational.h b/3rdparty/CGAL/include/CGAL/to_rational.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/to_rational.h
rename to 3rdparty/CGAL/include/CGAL/to_rational.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/trace.h b/3rdparty/CGAL/include/CGAL/trace.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/trace.h
rename to 3rdparty/CGAL/include/CGAL/trace.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/transforming_iterator.h b/3rdparty/CGAL/include/CGAL/transforming_iterator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/transforming_iterator.h
rename to 3rdparty/CGAL/include/CGAL/transforming_iterator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/transforming_pair_iterator.h b/3rdparty/CGAL/include/CGAL/transforming_pair_iterator.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/transforming_pair_iterator.h
rename to 3rdparty/CGAL/include/CGAL/transforming_pair_iterator.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/triangulate_mixed_complex_3.h b/3rdparty/CGAL/include/CGAL/triangulate_mixed_complex_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/triangulate_mixed_complex_3.h
rename to 3rdparty/CGAL/include/CGAL/triangulate_mixed_complex_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/triangulate_power_diagram_3.h b/3rdparty/CGAL/include/CGAL/triangulate_power_diagram_3.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/triangulate_power_diagram_3.h
rename to 3rdparty/CGAL/include/CGAL/triangulate_power_diagram_3.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/triangulation_assertions.h b/3rdparty/CGAL/include/CGAL/triangulation_assertions.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/triangulation_assertions.h
rename to 3rdparty/CGAL/include/CGAL/triangulation_assertions.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/tss.h b/3rdparty/CGAL/include/CGAL/tss.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/tss.h
rename to 3rdparty/CGAL/include/CGAL/tss.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/tuple.h b/3rdparty/CGAL/include/CGAL/tuple.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/tuple.h
rename to 3rdparty/CGAL/include/CGAL/tuple.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/type_traits.h b/3rdparty/CGAL/include/CGAL/type_traits.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/type_traits.h
rename to 3rdparty/CGAL/include/CGAL/type_traits.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/typeset.h b/3rdparty/CGAL/include/CGAL/typeset.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/typeset.h
rename to 3rdparty/CGAL/include/CGAL/typeset.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/use.h b/3rdparty/CGAL/include/CGAL/use.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/use.h
rename to 3rdparty/CGAL/include/CGAL/use.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/user_classes.h b/3rdparty/CGAL/include/CGAL/user_classes.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/user_classes.h
rename to 3rdparty/CGAL/include/CGAL/user_classes.h
diff --git a/3rdparty/CGAL/include/CGAL/utility.h b/3rdparty/CGAL/include/CGAL/utility.h
new file mode 100644
index 0000000..ec0dc5f
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/utility.h
@@ -0,0 +1,363 @@
+// Copyright (c) 2003  
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved. 
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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(s)     : Michael Hoffmann <hoffmann at inf.ethz.ch>
+//                 Lutz Kettner <kettner at mpi-sb.mpg.de>
+//                 Sylvain Pion
+
+#ifndef CGAL_UTILITY_H
+#define CGAL_UTILITY_H 1
+
+#include <CGAL/config.h>
+#include <utility>
+#include <functional>
+#include <boost/functional/hash.hpp>
+
+// The Triple and Quadruple classes are NOT RECOMMENDED anymore.
+// We recommend that you use cpp11::tuple or cpp11::array instead
+// for new uses.
+
+namespace CGAL {
+
+namespace internal {
+
+template <int i, typename T>
+struct Tuple_get;
+
+template <typename T>
+struct Tuple_get<0, T>
+{
+  typedef typename T::first_type result_type;
+  static result_type       & get(T       & t) { return t.first; }
+  static result_type const & get(T const & t) { return t.first; }
+};
+
+template <typename T>
+struct Tuple_get<1, T>
+{
+  typedef typename T::second_type result_type;
+  static result_type       & get(T       & t) { return t.second; }
+  static result_type const & get(T const & t) { return t.second; }
+};
+
+template <typename T>
+struct Tuple_get<2, T>
+{
+  typedef typename T::third_type result_type;
+  static result_type       & get(T       & t) { return t.third; }
+  static result_type const & get(T const & t) { return t.third; }
+};
+
+template <typename T>
+struct Tuple_get<3, T>
+{
+  typedef typename T::fourth_type result_type;
+  static result_type       & get(T       & t) { return t.fourth; }
+  static result_type const & get(T const & t) { return t.fourth; }
+};
+
+}
+
+//+---------------------------------------------------------------------+
+//| Triple class                                                        |
+//+---------------------------------------------------------------------+
+
+template <class T1, class T2, class T3>
+class Triple
+{
+  typedef Triple<T1, T2, T3> Self;
+
+public:
+
+  typedef T1 first_type;
+  typedef T2 second_type;
+  typedef T3 third_type;
+
+  T1 first;
+  T2 second;
+  T3 third;
+
+  Triple() {}
+
+  Triple(const T1& a, const T2& b, const T3& c)
+  : first(a), second(b), third(c)
+  {}
+
+  template <class U, class V, class W>
+  Triple(const U& a, const V& b, const W& c)
+  : first(a), second(b), third(c)
+  {}
+
+  template <class U, class V, class W>
+  Triple& operator=(const Triple<U, V, W> &t) {
+    first = t.first;
+    second = t.second;
+    third = t.third;
+    return *this;
+  }
+
+  template < int i >
+  typename internal::Tuple_get<i, Self>::result_type const &
+  get() const
+  {
+    return internal::Tuple_get<i, Self>::get(*this);
+  }
+
+  template < int i >
+  typename internal::Tuple_get<i, Self>::result_type &
+  get()
+  {
+    return internal::Tuple_get<i, Self>::get(*this);
+  }
+
+
+  friend std::size_t hash_value(Triple<T1,T2,T3> const& t)
+    {
+        std::size_t seed = 0;
+        boost::hash_combine(seed, t.first);
+        boost::hash_combine(seed, t.second);
+        boost::hash_combine(seed, t.third);
+
+        return seed;
+    }
+
+};
+
+template <class T1, class T2, class T3>
+inline
+Triple<T1, T2, T3> make_triple(const T1& x, const T2& y, const T3& z)
+{
+  return Triple<T1, T2, T3>(x, y, z);
+}
+
+template <class T1, class T2, class T3>
+inline
+Triple<T1, T2, T3> make_tuple(const T1& x, const T2& y, const T3& z)
+{
+  return Triple<T1, T2, T3>(x, y, z);
+}
+
+template <class T1, class T2, class T3>
+inline bool operator==(const Triple<T1, T2, T3>& x,
+                       const Triple<T1, T2, T3>& y)
+{
+  return ( (x.first == y.first) &&
+           (x.second == y.second) &&
+           (x.third == y.third) );
+}
+
+template <class T1, class T2, class T3>
+inline bool operator!=(const Triple<T1, T2, T3>& x,
+                       const Triple<T1, T2, T3>& y)
+{
+  return !(x == y);
+}
+
+template <class T1, class T2, class T3>
+inline
+bool operator<(const Triple<T1, T2, T3>& x,
+               const Triple<T1, T2, T3>& y)
+{
+  return ( x.first < y.first ||
+           ( !(y.first < x.first) &&
+             ( x.second < y.second ||
+               ( !(y.second < x.second) && x.third < y.third ) ) ) );
+}
+//+---------------------------------------------------------------------+
+//| Quadruple class                                                     |
+//+---------------------------------------------------------------------+
+
+template <class T1, class T2, class T3, class T4>
+class Quadruple
+{
+  typedef Quadruple<T1, T2, T3, T4>  Self;
+
+public:
+
+  typedef T1 first_type;
+  typedef T2 second_type;
+  typedef T3 third_type;
+  typedef T4 fourth_type;
+
+  T1 first;
+  T2 second;
+  T3 third;
+  T4 fourth;
+
+  Quadruple() {}
+
+  Quadruple(const T1& a, const T2& b, const T3& c, const T4& d)
+  : first(a), second(b), third(c), fourth(d)
+  {}
+
+  template <class U, class V, class W, class X>
+  Quadruple(const U& a, const V& b, const W& c, const X& d)
+  : first(a), second(b), third(c), fourth(d)
+  {}
+
+  template <class U, class V, class W, class X>
+  Quadruple& operator=(const Quadruple<U, V, W, X> &q) {
+    first = q.first;
+    second = q.second;
+    third = q.third;
+    fourth = q.fourth;
+    return *this;
+  }
+
+  template < int i >
+  typename internal::Tuple_get<i, Self>::result_type const &
+  get() const
+  {
+    return internal::Tuple_get<i, Self>::get(*this);
+  }
+
+  template < int i >
+  typename internal::Tuple_get<i, Self>::result_type &
+  get()
+  {
+    return internal::Tuple_get<i, Self>::get(*this);
+  }
+};
+
+template <class T1, class T2, class T3, class T4>
+inline
+Quadruple<T1, T2, T3, T4>
+make_quadruple(const T1& x, const T2& y, const T3& z, const T4& zz)
+{
+  return Quadruple<T1, T2, T3, T4>(x, y, z, zz);
+}
+
+template <class T1, class T2, class T3, class T4>
+inline
+Quadruple<T1, T2, T3, T4>
+make_tuple(const T1& x, const T2& y, const T3& z, const T4& zz)
+{
+  return Quadruple<T1, T2, T3, T4>(x, y, z, zz);
+}
+
+template <class T1, class T2, class T3, class T4>
+inline
+bool
+operator==(const Quadruple<T1, T2, T3, T4>& x,
+           const Quadruple<T1, T2, T3, T4>& y)
+{
+  return ( (x.first == y.first) &&
+           (x.second == y.second) &&
+           (x.third == y.third) &&
+           (x.fourth == y.fourth) );
+}
+
+template <class T1, class T2, class T3, class T4>
+inline
+bool
+operator!=(const Quadruple<T1, T2, T3, T4>& x,
+           const Quadruple<T1, T2, T3, T4>& y)
+{
+  return ! (x == y);
+}
+
+template <class T1, class T2, class T3, class T4>
+inline
+bool
+operator<(const Quadruple<T1, T2, T3, T4>& x,
+          const Quadruple<T1, T2, T3, T4>& y)
+{
+  return ( x.first < y.first ||
+           ( !(y.first < x.first) &&
+             ( x.second < y.second ||
+               ( !(y.second < x.second) &&
+                 ( x.third < y.third ||
+                   (!(y.third < x.third) && x.fourth < y.fourth)) ) ) ) );
+}
+
+#if defined(CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE) || \
+    defined(CGAL_CFG_NO_CPP0X_DEFAULT_TEMPLATE_ARGUMENTS_FOR_FUNCTION_TEMPLATES) || \
+    BOOST_VERSION < 105000 || \
+    defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS)
+template <class T, class Compare>
+inline
+std::pair<  T, T >
+make_sorted_pair(const T& t1, const T& t2, Compare comp)
+{
+  return comp(t1, t2) ? std::make_pair(t1,t2) : std::make_pair(t2,t1);
+}
+
+template <class T>
+inline
+std::pair<T,T>
+make_sorted_pair(const T& t1, const T& t2)
+{
+  return make_sorted_pair(t1,t2, std::less<T>());
+}
+#else
+
+} //end of namespace CGAL
+
+#include <type_traits>
+
+namespace CGAL {
+
+struct Default_using_type
+{
+  template <typename Argument, typename Value>
+  struct Get {
+      typedef Argument type;
+  };
+
+  template <typename Value>
+  struct Get<Default_using_type, Value> {
+      typedef typename Value::type type;
+  };
+};
+
+template <class T_ = Default_using_type>
+struct less_cpp14
+{
+  template <class T1, class T2>
+  bool operator() (T1&& t1, T2&& t2) const
+  {
+    typedef typename Default_using_type::Get<
+      T_,
+      typename std::common_type<typename std::decay<T1>::type,
+                                typename std::decay<T2>::type> >::type T;
+    return std::less<T>()(t1,t2);
+  }
+};
+
+template <class T = Default_using_type,
+          class Compare = less_cpp14<T>,
+          class T1, class T2,
+          class A = typename Default_using_type::Get<T,
+            typename std::common_type<
+              typename std::decay<T1>::type,
+              typename std::decay<T2>::type > >::type,
+          class P = std::pair<A, A> >
+inline P make_sorted_pair(T1&& t1, T2&& t2, Compare comp = Compare())
+{
+  return comp(t1, t2) ? P(std::forward<T1>(t1), std::forward<T2>(t2))
+                      : P(std::forward<T2>(t2), std::forward<T1>(t1));
+}
+#endif
+
+} //namespace CGAL
+
+#endif // CGAL_UTILITY_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/utils.h b/3rdparty/CGAL/include/CGAL/utils.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/utils.h
rename to 3rdparty/CGAL/include/CGAL/utils.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/utils_classes.h b/3rdparty/CGAL/include/CGAL/utils_classes.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/utils_classes.h
rename to 3rdparty/CGAL/include/CGAL/utils_classes.h
diff --git a/3rdparty/CGAL/include/CGAL/value_type_traits.h b/3rdparty/CGAL/include/CGAL/value_type_traits.h
new file mode 100644
index 0000000..8783327
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/value_type_traits.h
@@ -0,0 +1,66 @@
+// Copyright (c) 2007-09  INRIA Sophia-Antipolis (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(s) : Alberto Ganesh Barbati and Laurent Saboret
+
+#ifndef CGAL_VALUE_TYPE_TRAITS_H
+#define CGAL_VALUE_TYPE_TRAITS_H
+
+#include <iterator>
+
+namespace CGAL {
+
+/// \ingroup  PkgStlExtension
+/// Class providing the value type of an iterator, and
+/// in the case of an output iterator, a type of objects that can be put in it.
+///
+template <class T>
+struct value_type_traits
+{
+  #ifndef DOXYGEN_RUNNING
+  typedef typename std::iterator_traits<T>::value_type type;
+  #else
+  /// If `T` is `std::insert_iterator<Container>`, `std::back_insert_iterator<Container>` or
+  /// `std::front_insert_iterator<Container>`, then `type` is `Container::value_type`.
+  /// Otherwise, `type` is `std::iterator_traits<T>::%value_type`.
+
+  typedef unspecified_type type;
+  #endif
+};
+
+template <class Container>
+struct value_type_traits<std::back_insert_iterator<Container> >
+{
+  typedef typename Container::value_type type;
+};
+
+template <class Container>
+struct value_type_traits<std::insert_iterator<Container> >
+{
+  typedef typename Container::value_type type;
+};
+
+template <class Container>
+struct value_type_traits<std::front_insert_iterator<Container> >
+{
+  typedef typename Container::value_type type;
+};
+
+} //namespace CGAL
+
+#endif // CGAL_VALUE_TYPE_TRAITS_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/vcm_estimate_edges.h b/3rdparty/CGAL/include/CGAL/vcm_estimate_edges.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/vcm_estimate_edges.h
rename to 3rdparty/CGAL/include/CGAL/vcm_estimate_edges.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/vcm_estimate_normals.h b/3rdparty/CGAL/include/CGAL/vcm_estimate_normals.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/vcm_estimate_normals.h
rename to 3rdparty/CGAL/include/CGAL/vcm_estimate_normals.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/vector.h b/3rdparty/CGAL/include/CGAL/vector.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/vector.h
rename to 3rdparty/CGAL/include/CGAL/vector.h
diff --git a/3rdparty/CGAL/include/CGAL/version.h b/3rdparty/CGAL/include/CGAL/version.h
new file mode 100644
index 0000000..24d0da7
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/version.h
@@ -0,0 +1,35 @@
+// Copyright (c) 2006  Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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.
+//
+// Author(s)     : -
+
+// This file is automatically created by create_internal_release.
+// Do not edit manually.
+
+#ifndef CGAL_VERSION_H
+#define CGAL_VERSION_H
+
+#define CGAL_xstr(s) #s
+#define CGAL_str(s) CGAL_xstr(s)
+
+#define CGAL_VERSION 4.9
+#define CGAL_VERSION_NR 1040901000
+#define CGAL_SVN_REVISION 99999
+#define CGAL_GIT_HASH 331eac693ae48e62e73bc9a810945b03d9d52c12
+#define CGAL_VERSION_STR CGAL_str(CGAL_VERSION)
+
+#endif
diff --git a/3rdparty/CGAL-4.8/include/CGAL/version_macros.h b/3rdparty/CGAL/include/CGAL/version_macros.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/version_macros.h
rename to 3rdparty/CGAL/include/CGAL/version_macros.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/vtkSurfaceMesherContourFilter.h b/3rdparty/CGAL/include/CGAL/vtkSurfaceMesherContourFilter.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/vtkSurfaceMesherContourFilter.h
rename to 3rdparty/CGAL/include/CGAL/vtkSurfaceMesherContourFilter.h
diff --git a/3rdparty/CGAL-4.8/include/CGAL/width_assertions.h b/3rdparty/CGAL/include/CGAL/width_assertions.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/width_assertions.h
rename to 3rdparty/CGAL/include/CGAL/width_assertions.h
diff --git a/3rdparty/CGAL/include/CGAL/wlop_simplify_and_regularize_point_set.h b/3rdparty/CGAL/include/CGAL/wlop_simplify_and_regularize_point_set.h
new file mode 100644
index 0000000..fd46a39
--- /dev/null
+++ b/3rdparty/CGAL/include/CGAL/wlop_simplify_and_regularize_point_set.h
@@ -0,0 +1,695 @@
+// Copyright (c) 2013-06  INRIA Sophia-Antipolis (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
+// 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(s) : Shihao Wu, Clement Jamin, Pierre Alliez 
+
+#ifndef CGAL_wlop_simplify_and_regularize_point_set_H
+#define CGAL_wlop_simplify_and_regularize_point_set_H
+
+#include <CGAL/Search_traits_3.h>
+#include <CGAL/Orthogonal_k_neighbor_search.h>
+#include <CGAL/property_map.h>
+#include <CGAL/point_set_processing_assertions.h>
+#include <CGAL/Memory_sizer.h>
+#include <CGAL/compute_average_spacing.h>
+
+#include <iterator>
+#include <set>
+#include <algorithm>
+#include <cmath>
+#include <ctime>
+
+#ifdef CGAL_LINKED_WITH_TBB
+#include <tbb/parallel_for.h>
+#include <tbb/blocked_range.h>
+#endif // CGAL_LINKED_WITH_TBB
+
+#include <CGAL/Simple_cartesian.h>
+#include <CGAL/Fuzzy_sphere.h>
+#include <CGAL/Search_traits_3.h>
+#include <CGAL/Bbox_3.h>
+
+namespace CGAL {
+// ----------------------------------------------------------------------------
+// Private section
+// ----------------------------------------------------------------------------
+/// \cond SKIP_IN_MANUAL
+
+namespace simplify_and_regularize_internal{
+
+// Item in the Kd-tree: position (Point_3) + index
+template <typename Kernel>
+class Kd_tree_element : public Kernel::Point_3
+{
+public:
+  unsigned int index;
+
+  // basic geometric types
+  typedef typename CGAL::Origin Origin;
+  typedef typename Kernel::Point_3 Base;
+
+  Kd_tree_element(const Origin& o = ORIGIN, unsigned int id=0)
+    : Base(o), index(id)
+  {}
+  Kd_tree_element(const Base& p, unsigned int id=0)
+    : Base(p), index(id)
+  {}
+  Kd_tree_element(const Kd_tree_element& other)
+    : Base(other), index(other.index)
+  {}
+};
+
+// Helper class for the Kd-tree
+template <typename Kernel>
+class Kd_tree_gt : public Kernel
+{
+public:
+  typedef Kd_tree_element<Kernel> Point_3;
+};
+
+template <typename Kernel>
+class Kd_tree_traits : public CGAL::Search_traits_3<Kd_tree_gt<Kernel> >
+{
+public:
+  typedef typename Kernel::Point_3 PointType;
+};
+
+/// Compute average and repulsion term, then 
+/// compute and update sample point locations
+/// 
+/// \pre `radius > 0`
+///
+/// @tparam Kernel Geometric traits class.
+/// @tparam Tree Kd-tree.
+///
+/// @return average term vector
+template <typename Kernel,
+          typename Tree,
+          typename RandomAccessIterator>
+typename Kernel::Point_3
+compute_update_sample_point(
+  const typename Kernel::Point_3& query, ///< 3D point to project
+  const Tree& original_kd_tree,          ///< original Kd-tree
+  const Tree& sample_kd_tree,            ///< sample Kd-tree
+  const typename Kernel::FT radius,      ///< neighborhood radius square
+  const std::vector<typename Kernel::FT>& original_densities, ///<  
+  const std::vector<typename Kernel::FT>& sample_densities ///< 
+)
+{
+  CGAL_point_set_processing_precondition(radius > 0);
+  bool is_original_densities_empty = original_densities.empty();
+  bool is_sample_densities_empty = sample_densities.empty();
+
+  // basic geometric types
+  typedef typename Kernel::Point_3 Point;
+  typedef typename Kernel::Vector_3 Vector;
+  typedef typename Kernel::FT FT;
+
+  //types for range search
+  typedef simplify_and_regularize_internal::Kd_tree_element<Kernel> Kd_tree_point;
+  typedef simplify_and_regularize_internal::Kd_tree_traits<Kernel> Traits;
+  typedef CGAL::Fuzzy_sphere<Traits> Fuzzy_sphere;
+
+  //range search for original neighborhood
+  Fuzzy_sphere fs(query, radius, 0.0);
+  std::vector<Kd_tree_point> neighbor_original_points;
+  original_kd_tree.search(std::back_inserter(neighbor_original_points), fs);
+
+  //Compute average term
+  FT radius2 = radius * radius;
+  Vector average = CGAL::NULL_VECTOR; 
+  FT weight = (FT)0.0, average_weight_sum = (FT)0.0;
+  FT iradius16 = -(FT)4.0 / radius2;
+
+  typename std::vector<Kd_tree_point>::iterator iter;
+  iter = neighbor_original_points.begin();
+  for (; iter != neighbor_original_points.end(); ++iter)
+  {
+    const Point& np = *iter;
+
+    Kd_tree_point& kp = *iter;
+    int original_index = kp.index;
+
+    FT dist2 = CGAL::squared_distance(query, np);
+    if (dist2 < 1e-10) continue;
+
+    weight = exp(dist2 * iradius16);
+
+    if (!is_original_densities_empty)
+    {
+      weight *= original_densities[original_index];
+    }
+    average_weight_sum += weight;
+    average = average + (np - CGAL::ORIGIN) * weight;
+  }
+
+  if (neighbor_original_points.empty() || average_weight_sum < FT(1e-10))
+  {
+    average = query - CGAL::ORIGIN;
+  }
+  else
+  {
+    average = average / average_weight_sum; 
+  }
+  neighbor_original_points.clear();
+  
+
+  //Compute repulsion term
+
+  Fuzzy_sphere fs2(query, radius, 0.0);
+  std::vector<Kd_tree_point> neighbor_sample_points;
+  sample_kd_tree.search(std::back_inserter(neighbor_sample_points), fs2);
+
+  weight = (FT)0.0;
+  FT repulsion_weight_sum = (FT)0.0;
+  Vector repulsion = CGAL::NULL_VECTOR; 
+
+  iter = neighbor_sample_points.begin();
+  for(; iter != neighbor_sample_points.end(); ++iter)
+  {
+    const Point& np = *iter;
+
+    Kd_tree_point& kp = *iter;
+    int sample_index = kp.index;
+
+    FT dist2 = CGAL::squared_distance(query, np);
+    if (dist2 < 1e-10) continue;
+    FT dist = std::sqrt(dist2);
+    
+    weight = std::exp(dist2 * iradius16) * std::pow(FT(1.0) / dist, 2); // L1
+   
+    if (!is_sample_densities_empty)
+    {
+      weight *= sample_densities[sample_index];
+    }
+
+    Vector diff = query - np;
+
+    repulsion_weight_sum += weight;
+    repulsion = repulsion + diff * weight;
+  }
+
+  if (neighbor_sample_points.size() < 3 || repulsion_weight_sum < FT(1e-10))
+  {
+    repulsion = CGAL::NULL_VECTOR;
+  }
+  else
+  {
+    repulsion = repulsion / repulsion_weight_sum; 
+  }
+  neighbor_sample_points.clear();
+
+  // Compute update sample point
+  Point update_sample = CGAL::ORIGIN + average + FT(0.45) * repulsion;
+  return update_sample;
+}
+
+
+/// Compute density weight for each original points,
+/// according to their neighbor original points
+/// 
+/// \pre `k >= 2`, radius > 0
+///
+/// @tparam Kernel Geometric traits class.
+/// @tparam Tree Kd-tree.
+///
+/// @return computed point
+template <typename Kernel, typename Tree>
+typename Kernel::FT
+compute_density_weight_for_original_point(
+  const typename Kernel::Point_3& query, ///< 3D point to project
+  Tree& original_kd_tree,                       ///< Kd-tree
+  const typename Kernel::FT radius       ///< neighbor radius square
+)
+{
+  CGAL_point_set_processing_precondition(radius > 0);
+
+  // basic geometric types
+  typedef typename Kernel::Point_3                         Point;
+  typedef typename Kernel::FT                              FT;
+                                                          
+  //types for range search
+  typedef simplify_and_regularize_internal::Kd_tree_element<Kernel> Kd_tree_point;
+  typedef simplify_and_regularize_internal::Kd_tree_traits<Kernel> Traits;
+  typedef CGAL::Fuzzy_sphere<Traits> Fuzzy_sphere;
+
+  //range search for original neighborhood
+  Fuzzy_sphere fs(query, radius, 0.0);
+  std::vector<Kd_tree_point> neighbor_original_points;
+
+  original_kd_tree.search(std::back_inserter(neighbor_original_points), fs);
+
+  //Compute density weight
+  FT radius2 = radius * radius;
+  FT density_weight = (FT)1.0;
+  FT iradius16 = -(FT)4.0 / radius2;
+
+  typename std::vector<Kd_tree_point>::iterator iter;
+  iter = neighbor_original_points.begin();
+
+  for (; iter != neighbor_original_points.end(); iter++)
+  {
+    const Point& np = *iter;
+
+    FT dist2 = CGAL::squared_distance(query, np);
+    if (dist2 < 1e-8) continue;
+    
+    density_weight += std::exp(dist2 * iradius16);
+  }
+
+  // output
+  return FT(1.0) / density_weight;
+}
+
+
+/// Compute density weight for sample point,
+/// according to their neighbor sample points
+/// 
+/// \pre `k >= 2`, radius > 0
+///
+/// @tparam Kernel Geometric traits class.
+/// @tparam Tree Kd-tree.
+///
+/// @return computed point
+template <typename Kernel, typename Tree>
+typename Kernel::FT
+compute_density_weight_for_sample_point(
+  const typename Kernel::Point_3& query, ///< 3D point to project
+  Tree& sample_kd_tree,                ///< Kd-tree
+  const typename Kernel::FT radius       ///< neighbor radius square
+)
+{
+  // basic geometric types
+  typedef typename Kernel::Point_3                          Point;
+  typedef typename Kernel::FT                               FT;
+
+  //types for range search
+  typedef simplify_and_regularize_internal::Kd_tree_element<Kernel> Kd_tree_point;
+  typedef simplify_and_regularize_internal::Kd_tree_traits<Kernel> Traits;
+  typedef CGAL::Fuzzy_sphere<Traits> Fuzzy_sphere;
+
+  //range search for original neighborhood
+  Fuzzy_sphere fs(query, radius, 0.0);
+  std::vector<Kd_tree_point> neighbor_sample_points;
+  sample_kd_tree.search(std::back_inserter(neighbor_sample_points), fs);
+
+  //Compute density weight
+  FT radius2 = radius * radius;
+  FT density_weight = (FT)1.0;
+  FT iradius16 = -(FT)4.0 / radius2;
+
+  typename std::vector<Kd_tree_point>::iterator iter;
+  iter = neighbor_sample_points.begin();
+
+  for (; iter != neighbor_sample_points.end(); iter++)
+  {
+    const Point& np = *iter;
+
+    FT dist2 = CGAL::squared_distance(query, np);
+    density_weight += std::exp(dist2 * iradius16);
+  }
+  
+  return density_weight;
+}
+
+} // namespace simplify_and_regularize_internal
+
+/// \endcond
+
+#ifdef CGAL_LINKED_WITH_TBB
+/// \cond SKIP_IN_MANUAL
+/// This is for parallelization of function: compute_denoise_projection()
+template <typename Kernel, typename Tree, typename RandomAccessIterator>
+class Sample_point_updater 
+{
+  typedef typename Kernel::Point_3   Point;
+  typedef typename Kernel::FT        FT;
+
+  std::vector<Point> &update_sample_points;
+  std::vector<Point> &sample_points;
+  const Tree &original_kd_tree;            
+  const Tree &sample_kd_tree;              
+  const typename Kernel::FT radius;  
+  const std::vector<typename Kernel::FT> &original_densities;
+  const std::vector<typename Kernel::FT> &sample_densities; 
+
+public:
+  Sample_point_updater(
+    std::vector<Point> &out,
+    std::vector<Point> &in,
+    const Tree &_original_kd_tree,            
+    const Tree &_sample_kd_tree,              
+    const typename Kernel::FT _radius,
+    const std::vector<typename Kernel::FT> &_original_densities,
+    const std::vector<typename Kernel::FT> &_sample_densities): 
+  update_sample_points(out), 
+    sample_points(in),
+    original_kd_tree(_original_kd_tree),
+    sample_kd_tree(_sample_kd_tree),
+    radius(_radius),
+    original_densities(_original_densities),
+    sample_densities(_sample_densities){} 
+
+
+  void operator() ( const tbb::blocked_range<size_t>& r ) const 
+  { 
+    for (size_t i = r.begin(); i != r.end(); ++i) 
+    {
+      update_sample_points[i] = simplify_and_regularize_internal::
+        compute_update_sample_point<Kernel, Tree, RandomAccessIterator>(
+        sample_points[i], 
+        original_kd_tree,
+        sample_kd_tree,
+        radius, 
+        original_densities,
+        sample_densities);
+    }
+  }
+};
+/// \endcond  
+#endif // CGAL_LINKED_WITH_TBB
+
+
+// ----------------------------------------------------------------------------
+// Public section
+// ----------------------------------------------------------------------------
+
+//=============================================================================
+/// \ingroup PkgPointSetProcessing
+/// This is an implementation of the Weighted Locally Optimal Projection (WLOP) simplification algorithm.
+/// The WLOP simplification algorithm can produce a set of 
+/// denoised, outlier-free and evenly distributed particles over the original 
+/// dense point cloud. 
+/// The core of the algorithm is a Weighted Locally Optimal Projection operator
+/// with a density uniformization term. 
+/// For more details, please refer to \cgalCite{wlop-2009}.
+///
+/// A parallel version of WLOP is provided and requires the executable to be 
+/// linked against the <a href="http://www.threadingbuildingblocks.org">Intel TBB library</a>.
+/// To control the number of threads used, the user may use the tbb::task_scheduler_init class.
+/// See the <a href="http://www.threadingbuildingblocks.org/documentation">TBB documentation</a> 
+/// for more details.
+///
+/// @tparam Concurrency_tag enables sequential versus parallel algorithm.
+///                         Possible values are `Sequential_tag`
+///                         and `Parallel_tag`.
+/// @tparam OutputIterator Type of the output iterator. 
+///         It must accept objects of type `Kernel::Point_3`.
+/// @tparam RandomAccessIterator Iterator over input points.
+/// @tparam PointPMap is a model of `ReadablePropertyMap` 
+///         with the value type of `ForwardIterator` as key type and `Kernel::Point_3` as value type.
+///         It can be omitted if the value type of ` RandomAccessIterator` is convertible  
+///         to `Kernel::Point_3`.
+/// @tparam Kernel Geometric traits class.
+///      It can be omitted and deduced automatically from the value type of `PointPMap`
+///      using `Kernel_traits`.
+
+// This variant requires all parameters.
+template <typename Concurrency_tag,
+          typename OutputIterator,
+          typename RandomAccessIterator,
+          typename PointPMap,
+          typename Kernel>
+OutputIterator
+wlop_simplify_and_regularize_point_set(
+  RandomAccessIterator first,  ///< random-access iterator to the first input point.
+  RandomAccessIterator beyond, ///< past-the-end iterator.
+  OutputIterator output,       ///< output iterator where output points are put.
+  PointPMap point_pmap,        ///< point property map.
+  double select_percentage,    ///< percentage of points to retain. 
+                               ///< The default value is set to 5 (\%).
+  double radius,               ///< spherical neighborhood radius.
+                               ///< This is a key parameter that needs to be finely tuned.  
+                               ///< The result will be irregular if too small, but a larger
+                               ///< value will impact the runtime.
+                               ///< In practice, choosing a radius such that the neighborhood of each sample point
+                               ///< includes at least two rings of neighboring sample points
+                               ///< gives satisfactory result.
+                               ///< The default value is set to 8 times the average spacing of the point set.
+  unsigned int iter_number,    ///< number of iterations to solve the optimsation problem. The default value is 35.
+                               ///< More iterations give a more regular result but increase the runtime.
+  bool require_uniform_sampling,///< an optional preprocessing, which will give better result
+                               ///< if the distribution of the input points is highly non-uniform. 
+                               ///< The default value is `false`. 
+  const Kernel&                ///< geometric traits.
+)
+{
+  // basic geometric types
+  typedef typename Kernel::Point_3   Point;
+  typedef typename Kernel::FT        FT;
+
+  // types for K nearest neighbors search structure
+  typedef simplify_and_regularize_internal::Kd_tree_element<Kernel> Kd_tree_element;
+  typedef simplify_and_regularize_internal::Kd_tree_traits<Kernel> Tree_traits;
+  typedef CGAL::Orthogonal_k_neighbor_search<Tree_traits> Neighbor_search;
+  typedef typename Neighbor_search::Tree Kd_Tree;
+
+  // precondition: at least one element in the container.
+  // to fix: should have at least three distinct points
+  // but this is costly to check
+  CGAL_point_set_processing_precondition(first != beyond);
+  CGAL_point_set_processing_precondition(select_percentage >= 0 
+                                         && select_percentage <= 100);
+
+  // Random shuffle
+  std::random_shuffle (first, beyond);
+
+  // Computes original(input) and sample points size 
+  std::size_t number_of_original = std::distance(first, beyond);
+  std::size_t number_of_sample = (std::size_t)(FT(number_of_original) * 
+                                 (select_percentage / FT(100.0)));
+  std::size_t first_index_to_sample = number_of_original - number_of_sample;
+
+  // The first point iter of original and sample points
+  RandomAccessIterator it;                             // point iterator
+  RandomAccessIterator first_original_iter = first;
+  RandomAccessIterator first_sample_iter = first;
+  std::advance(first_sample_iter, first_index_to_sample);
+
+  //Copy sample points
+  std::vector<Point> sample_points;
+  sample_points.reserve(number_of_sample);
+  unsigned int i;                                     
+
+  for(it = first_sample_iter; it != beyond; ++it)
+  {
+    sample_points.push_back(get(point_pmap, *it));
+  }
+  
+  //compute default neighbor_radius, if no radius in
+  if (radius < 0)
+  {
+    const unsigned int nb_neighbors = 6; // 1 ring
+    FT average_spacing = CGAL::compute_average_spacing<Concurrency_tag>(
+                               first, beyond,
+                               point_pmap,
+                               nb_neighbors);
+    radius = average_spacing * 8.0;
+
+#ifdef CGAL_PSP3_VERBOSE
+    std::cout << "The estimated radius size is: " << radius << std::endl;
+    std::cout << "Be careful! Using this radius estimation may not be able to have good performance/result for different input" << std::endl;
+#endif
+  }
+
+  FT radius2 = radius * radius;
+  CGAL_point_set_processing_precondition(radius > 0);
+
+  // Initiate a KD-tree search for original points
+  std::vector<Kd_tree_element> original_treeElements;
+  for (it = first_original_iter, i=0 ; it != beyond ; ++it, ++i)
+    original_treeElements.push_back( Kd_tree_element(get(point_pmap, *it), i) );
+  Kd_Tree original_kd_tree(original_treeElements.begin(), 
+                           original_treeElements.end());
+
+
+  std::vector<Point> update_sample_points(number_of_sample);
+  typename std::vector<Point>::iterator sample_iter;
+  
+  // Compute original density weight for original points if user needed
+  std::vector<FT> original_density_weights;
+
+  if (require_uniform_sampling)//default value is false
+  {
+    //todo: this part could also be parallelized if needed
+    for (it = first_original_iter, i = 0; it != beyond ; ++it, ++i)
+    {
+      FT density = simplify_and_regularize_internal::
+                   compute_density_weight_for_original_point<Kernel, Kd_Tree>
+                                         (
+                                           get(point_pmap, *it),
+                                           original_kd_tree, 
+                                           radius);
+
+      original_density_weights.push_back(density);
+    }
+  }
+
+  for (unsigned int iter_n = 0; iter_n < iter_number; ++iter_n)
+  {
+    // Initiate a KD-tree search for sample points
+    std::vector<Kd_tree_element> sample_treeElements;
+    for (i=0 ; i < sample_points.size(); i++)
+    {
+      Point& p0 = sample_points[i];
+      sample_treeElements.push_back(Kd_tree_element(p0,i));
+    }
+    Kd_Tree sample_kd_tree(sample_treeElements.begin(), sample_treeElements.end());
+
+    // Compute sample density weight for sample points
+    std::vector<FT> sample_density_weights;
+
+    for (sample_iter = sample_points.begin();
+         sample_iter != sample_points.end(); ++sample_iter)
+    {
+      FT density = simplify_and_regularize_internal::
+                   compute_density_weight_for_sample_point<Kernel, Kd_Tree>
+                   (*sample_iter, 
+                    sample_kd_tree, 
+                    radius);
+
+      sample_density_weights.push_back(density);
+    }
+    
+
+    typename std::vector<Point>::iterator update_iter = update_sample_points.begin();
+#ifndef CGAL_LINKED_WITH_TBB
+  CGAL_static_assertion_msg (!(boost::is_convertible<Concurrency_tag, Parallel_tag>::value),
+			     "Parallel_tag is enabled but TBB is unavailable.");
+#else
+    //parallel
+    if (boost::is_convertible<Concurrency_tag, Parallel_tag>::value)
+    {
+      tbb::blocked_range<size_t> block(0, number_of_sample);
+      Sample_point_updater<Kernel, Kd_Tree, RandomAccessIterator> sample_updater(
+                           update_sample_points,
+                           sample_points,          
+                           original_kd_tree,
+                           sample_kd_tree,
+                           radius, 
+                           original_density_weights,
+                           sample_density_weights);
+
+       tbb::parallel_for(block, sample_updater);
+    }else
+#endif
+    {
+      //sequential
+      for (sample_iter = sample_points.begin();
+        sample_iter != sample_points.end(); ++sample_iter, ++update_iter)
+      {
+        *update_iter = simplify_and_regularize_internal::
+          compute_update_sample_point<Kernel,
+                                      Kd_Tree,
+                                      RandomAccessIterator>
+                                      (*sample_iter,
+                                       original_kd_tree,
+                                       sample_kd_tree,
+                                       radius2,
+                                       original_density_weights,
+                                       sample_density_weights);
+      }
+    }
+    
+    sample_iter = sample_points.begin();
+    for (update_iter = update_sample_points.begin();
+         update_iter != update_sample_points.end();
+         ++update_iter, ++sample_iter)
+    {
+      *sample_iter = *update_iter;
+    }
+  }
+
+  // final output
+  for(sample_iter = sample_points.begin(); 
+      sample_iter != sample_points.end(); ++sample_iter)
+  {
+    *output++ = *sample_iter;
+  }
+
+  return output;
+}
+
+/// @cond SKIP_IN_MANUAL
+// This variant deduces the kernel from the iterator type.
+template <typename Concurrency_tag,
+          typename OutputIterator,     
+          typename RandomAccessIterator, 
+          typename PointPMap>
+OutputIterator 
+wlop_simplify_and_regularize_point_set(
+  RandomAccessIterator  first,  ///< iterator over the first input point
+  RandomAccessIterator  beyond, ///< past-the-end iterator
+  OutputIterator output,        ///< add back-inserter
+  PointPMap point_pmap, ///< property map RandomAccessIterator  -> Point_3
+  const double select_percentage,     ///< percentage of points to retain
+  double neighbor_radius,       ///< size of neighbors.
+  const unsigned int max_iter_number, ///< number of iterations.
+  const bool require_uniform_sampling     ///< if needed to compute density 
+                                      ///  to generate more rugularized result.                                 
+) 
+{
+  typedef typename boost::property_traits<PointPMap>::value_type  Point;
+  typedef typename Kernel_traits<Point>::Kernel                   Kernel;
+  
+  return wlop_simplify_and_regularize_point_set<Concurrency_tag>(
+      first, beyond,
+      output,
+      point_pmap,
+      select_percentage,
+      neighbor_radius,
+      max_iter_number,
+      require_uniform_sampling,
+      Kernel());
+}
+/// @endcond
+
+
+
+/// @cond SKIP_IN_MANUAL
+/// This variant creates a default point property map=Dereference_property_map.
+template <typename Concurrency_tag, 
+          typename OutputIterator,     
+          typename RandomAccessIterator >
+OutputIterator
+wlop_simplify_and_regularize_point_set(
+  RandomAccessIterator  first,  ///< iterator to the first input point.
+  RandomAccessIterator  beyond, ///< past-the-end iterator.
+  OutputIterator output,        ///< add back-inserter.
+  const double select_percentage = 5, ///< percentage of points to retain
+  double neighbor_radius = -1,  ///< size of neighbors.
+  const unsigned int max_iter_number = 35, ///< number of iterations.
+  const bool require_uniform_sampling = false ///< if needed to compute density   
+                                           ///to generate a more uniform result. 
+)
+{
+  return wlop_simplify_and_regularize_point_set<Concurrency_tag>(
+          first, beyond,
+          output,
+          make_identity_property_map(typename std::iterator_traits
+                                     <RandomAccessIterator >::
+                                     value_type()),
+          select_percentage, 
+          neighbor_radius, 
+          max_iter_number, 
+          require_uniform_sampling);
+}
+/// @endcond
+
+} //namespace CGAL
+
+#endif // CGAL_wlop_simplify_and_regularize_point_set_H
diff --git a/3rdparty/CGAL-4.8/include/CGAL/wmult.h b/3rdparty/CGAL/include/CGAL/wmult.h
similarity index 100%
rename from 3rdparty/CGAL-4.8/include/CGAL/wmult.h
rename to 3rdparty/CGAL/include/CGAL/wmult.h
diff --git a/3rdparty/CGAL/scripts/cgal_create_CMakeLists b/3rdparty/CGAL/scripts/cgal_create_CMakeLists
new file mode 100755
index 0000000..2331ff7
--- /dev/null
+++ b/3rdparty/CGAL/scripts/cgal_create_CMakeLists
@@ -0,0 +1,629 @@
+#!/bin/bash
+
+# Copyright (c) 1999,2000,2002-2007,2009,2011,2012
+# Utrecht University (The Netherlands),
+# ETH Zurich (Switzerland),
+# INRIA Sophia-Antipolis (France),
+# Max-Planck-Institute for Informatics Saarbruecken (Germany), 
+# and Tel-Aviv University (Israel).  All rights reserved.
+#
+# This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public License as
+# 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: svn+ssh://fcacciola@scm.gforge.inria.fr/svn/cgal/trunk/Scripts/scripts/cgal_create_makefile $
+# $Id: cgal_create_makefile 36976 2007-03-09 22:53:24Z reichel $
+#
+# Author(s)     : various
+
+# This script creates a CGAL cmake script with entries for files with a common
+# C++ file extension (as mentioned in the g++ man page) in the current directory.
+# Some options can be given or specified in a file.
+
+
+#LEDA
+#GMP
+#GMPXX
+#MPFR
+#MPFI
+#RS
+#BLAS
+#LAPACK
+#OPENNL
+#QGLViewer (or implied by Qt4?)
+#ESBTL
+#NTL
+
+#Core (implies GMP+GMPXX)
+#Qt4 (implies QT4)
+#ImageIO
+
+#not (yet) supported
+#F2C (comes with BLAS/LAPACK - something like that)
+#IPE (ask Laurent)
+#MKL (ask Andreas)
+
+create_cmake_script_with_options()
+{
+  qt4='n'
+
+  # parse options file
+  if [ -e "$OPTIONS_FILE" ]; then
+
+    OLDIFS="$IFS"
+    IFS=$'\n'
+    for LINE in `cat $OPTIONS_FILE`; do 
+
+      # CGAL components
+      if [ -z "$CGAL_COMPONENTS_GIVEN" ]; then # read file only if not given!
+        next_cgal_component=`echo $LINE | grep -v "#" | grep CGAL_COMPONENT`
+        if [ ! -z "$next_cgal_component" ]; then
+          next_cgal_component=${next_cgal_component/CGAL_COMPONENT /}
+          if [ -z "$CGAL_COMPONENTS" ]; then 
+            CGAL_COMPONENTS=$next_cgal_component
+          else
+            CGAL_COMPONENTS=$CGAL_COMPONENTS":"$next_cgal_component
+          fi
+        fi
+      fi
+
+      # Boost components
+      if [ -z "$BOOST_COMPONENTS_GIVEN" ]; then # read file only if not given!
+        next_boost_component=`echo $LINE | grep -v "#" | grep BOOST_COMPONENT`
+        if [ ! -z "$next_boost_component" ]; then
+          next_boost_component=${next_boost_component/BOOST_COMPONENT /}
+          if [ -z "$BOOST_COMPONENTS" ]; then 
+            BOOST_COMPONENTS=$next_boost_component
+          else
+            BOOST_COMPONENTS=$BOOST_COMPONENTS":"$next_boost_component
+          fi
+        fi
+      fi
+
+    done
+    IFS="$OLDIFS"
+  fi
+
+
+  # print makefile header
+  #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
+  cat << 'EOF'
+# Created by the script cgal_create_CMakeLists
+# This is the CMake script for compiling a set of CGAL applications.
+
+EOF
+  #---------------------------------------------------------------------------
+  if [ "$SINGLE_SOURCE" = "n" ]; then
+    echo "project( ${PROJECT} )"
+  else 
+    echo "project( ${SOURCE} )"
+  fi
+
+  #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
+  cat << 'EOF'
+
+
+cmake_minimum_required(VERSION 2.8.11)
+
+# CGAL and its components
+EOF
+if [ -n "$ENABLE_CTEST" ]; then
+  echo "enable_testing()"
+fi
+  #---------------------------------------------------------------------------
+  # echo "CGAL_COMPONENTS: $CGAL_COMPONENTS"
+  if [ ! -z "$CGAL_COMPONENTS" ]; then
+    # ensure capitalization
+
+    # CGAL: Core, Qt4, PDB, ImageIO
+    CGAL_COMPONENTS=${CGAL_COMPONENTS//[c|C][o|O][r|R][e|E]/Core}
+    CGAL_COMPONENTS=${CGAL_COMPONENTS//[q|Q][t|T]4/Qt4}
+    CGAL_COMPONENTS=${CGAL_COMPONENTS//[i|I][m|M][a|A][g|G][e|E][i|I][o|O]/ImageIO}
+  
+    # external libs
+
+    CGAL_COMPONENTS=${CGAL_COMPONENTS//[g|G][m|M][p|P]/GMP}
+    CGAL_COMPONENTS=${CGAL_COMPONENTS//[g|G][m|M][p|P][x|X][x|X]/GMPXX}
+
+    CGAL_COMPONENTS=${CGAL_COMPONENTS//[m|M][p|P][f|F][r|R]/MPFR}
+    CGAL_COMPONENTS=${CGAL_COMPONENTS//[l|L][e|E][d|D][a|A]/LEDA}
+    CGAL_COMPONENTS=${CGAL_COMPONENTS//[m|M][p|P][f|F][i|I]/MPFI}
+    CGAL_COMPONENTS=${CGAL_COMPONENTS//[r|R][s|S]/RS}
+
+    CGAL_COMPONENTS=${CGAL_COMPONENTS//[o|O][p|P][e|E][n|N][n|N][l|L]/OpenNL}
+    CGAL_COMPONENTS=${CGAL_COMPONENTS//[b|B][l|L][a|A][s|S]/BLAS}
+    CGAL_COMPONENTS=${CGAL_COMPONENTS//[l|L][a|A][p|P][a|A][c|C][k|K]/LAPACK}
+
+    CGAL_COMPONENTS=${CGAL_COMPONENTS//[q|Q][g|G][l|L][v|V][i|I][e|E][w|W][e|E][r|R]/QGLViewer}
+
+    CGAL_COMPONENTS=${CGAL_COMPONENTS//[z|Z][l|L][i|I][b|B]/zlib}
+
+    CGAL_COMPONENTS=${CGAL_COMPONENTS//[e|E][s|S][b|B][t|T][l|L]/ESBTL}
+
+    CGAL_COMPONENTS=${CGAL_COMPONENTS//[n|N][t|T][l|L]/NTL}
+
+    CGAL_COMPONENTS=${CGAL_COMPONENTS//[o|O][p|P][e|E][n|N][g|G][l|L]/OpenGL}
+
+
+#F2C?
+#IPE?
+#MKL?
+
+    OLDIFS="$IFS"
+    IFS=':'
+    for cgal_component in $CGAL_COMPONENTS; do
+      COMPONENT=`echo $cgal_component | tr '[:upper:]' '[:lower:]'`
+
+      # for qtmoc
+      if [ "$COMPONENT" = "qt4" ]; then
+        qt4='y'
+      fi
+
+    done
+    IFS=$OLDIFS
+
+  fi
+
+  echo "find_package( CGAL QUIET COMPONENTS ${CGAL_COMPONENTS//:/ } )"
+
+  #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
+  cat << 'EOF'
+
+if ( NOT CGAL_FOUND )
+
+  message(STATUS "This project requires the CGAL library, and will not be compiled.")
+  return()  
+
+endif()
+
+# include helper file
+include( ${CGAL_USE_FILE} )
+
+EOF
+  #---------------------------------------------------------------------------
+
+  #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
+  cat << 'EOF'
+
+# Boost and its components
+EOF
+  #---------------------------------------------------------------------------
+
+  if [ ! -z "$BOOST_COMPONENTS" ]; then
+
+    echo "find_package( Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS//:/ } )"
+
+  else
+
+    echo "find_package( Boost REQUIRED )"
+
+  fi # additional Boost components
+
+  #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
+  cat << 'EOF'
+
+if ( NOT Boost_FOUND )
+
+  message(STATUS "This project requires the Boost library, and will not be compiled.")
+
+  return()  
+
+endif()
+EOF
+  #---------------------------------------------------------------------------
+
+
+  #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
+  cat << 'EOF'
+
+# include for local directory
+EOF
+  #---------------------------------------------------------------------------
+
+  if [ -d include ] ; then
+    echo 'include_directories( BEFORE include )'
+  fi		
+
+  #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
+  cat << 'EOF'
+
+# include for local package
+EOF
+  #---------------------------------------------------------------------------
+
+  # includes for local package
+  if [ -d ../../include ] ; then
+    echo 'include_directories( BEFORE ../../include )'
+  fi
+  if [ -d ../include ] ; then
+    echo 'include_directories( BEFORE ../include )'
+  fi
+
+  if [ ! -z "$PACKAGES" ]; then
+    #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
+    cat << 'EOF'
+
+# include of additional packages
+EOF
+    #-------------------------------------------------------------------------
+  fi
+
+  # Qt4
+  if [ "$qt4" = "y" ]; then
+
+    #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
+    cat << 'EOF'
+
+# Qt4
+set( QT_USE_QTXML     true )
+set( QT_USE_QTMAIN    true )
+set( QT_USE_QTSCRIPT  true )
+set( QT_USE_QTOPENGL  true )
+
+find_package(Qt4)  
+
+if ( NOT QT_FOUND )
+
+  message(STATUS "This project requires the Qt4 library, and will not be compiled.")
+  return()  
+
+endif()
+EOF
+    #-------------------------------------------------------------------------
+
+  fi #qt4
+
+  if [ ! -z "$BOOST_COMPONENTS" ]; then
+    #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
+    cat << 'EOF'
+
+# Boost linking
+EOF
+    #-------------------------------------------------------------------------
+
+    OLDIFS="$IFS"
+    IFS=':'
+    for boost_component in $BOOST_COMPONENTS; do
+      BOOST_COMPONENT=`echo $boost_component | tr '[:lower:]' '[:upper:]'`
+      echo "add_definitions( \"-DCGAL_USE_BOOST_${BOOST_COMPONENT}\" )"
+      echo "list(APPEND CGAL_3RD_PARTY_LIBRARIES \${Boost_${BOOST_COMPONENT}_LIBRARY} )"
+    done
+    IFS=$OLDIFS
+
+  fi # additional Boost components
+
+
+  # All Files or Single Source
+
+  if [ "$SINGLE_SOURCE" = "n" ]; then #=======================================
+
+    ###############
+    # ALL SOURCES #
+    ###############
+
+    #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
+    cat << 'EOF'
+
+
+# Creating entries for all C++ files with "main" routine
+# ##########################################################
+
+EOF
+    #-------------------------------------------------------------------------
+
+
+    if [ "$qt4" = "y" ]; then
+
+      echo "include( CGAL_CreateSingleSourceCGALProgramQt4 )"
+
+    else
+ 
+      echo "include( CGAL_CreateSingleSourceCGALProgram )"
+
+    fi
+    # add a new line
+    echo
+
+    # Qt4
+    if [ "$qt4" = "y" ]; then
+      #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
+      cat << 'EOF'
+
+if ( CGAL_Qt4_FOUND AND QT_FOUND )
+
+  include( ${QT_USE_FILE} )
+  include_directories( ${QT_INCLUDE_DIR} )  
+
+endif()
+
+EOF
+      #-----------------------------------------------------------------------
+    fi # qt4
+
+    for file in `ls *.cc *.cp *.cxx *.cpp *.CPP *.c++ *.C 2> /dev/null | sort` ; do
+      # Create an executable for each cpp that  contains a function "main()"
+      BASE=`basename $file .cc`
+      BASE=`basename $BASE .cp`
+      BASE=`basename $BASE .cxx`
+      BASE=`basename $BASE .cpp`
+      BASE=`basename $BASE .CPP`
+      BASE=`basename $BASE .c++`
+      BASE=`basename $BASE .C`
+      egrep '\bmain[ \t]*\(' $file >/dev/null 2>&1
+      if [ $? -eq 0 ]; then
+        if [ "$qt4" = "y" ]; then
+          echo "create_single_source_cgal_program_qt4( \"$file\" )"
+        else
+          echo "create_single_source_cgal_program( \"$file\" )"
+        fi
+        if [ -n "$ENABLE_CTEST" ]; then 
+          if [ -f "$BASE.cin" ] ; then
+            CIN=" < $BASE.cin"
+          else
+            CIN=
+          fi
+          cat <<EOF
+add_test( "$BASE" \${CMAKE_CTEST_COMMAND}
+  --build-and-test "\${CMAKE_CURRENT_SOURCE_DIR}"
+                   "\${CMAKE_CURRENT_BINARY_DIR}"
+  --build-generator "\${CMAKE_GENERATOR}"
+  --build-makeprogram "\${CMAKE_MAKE_PROGRAM}"
+  --build-target $BASE
+  --build-no-clean
+  --build-run-dir "\${CMAKE_CURRENT_SOURCE_DIR}"
+  --test-command sh -c "\${CMAKE_CURRENT_BINARY_DIR}/$BASE$CIN" )
+EOF
+        fi
+      fi
+      #add a new line
+      echo 
+    done
+    
+  else #======================================================================
+
+    #################
+    # SINGLE_SOURCE #
+    #################
+
+    target_name=$SOURCE
+
+    echo
+    echo
+    echo "# Creating entries for target: $target_name"
+    #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
+    cat << 'EOF'
+# ############################
+EOF
+    #-------------------------------------------------------------------------
+
+    for file in `ls *.cc *.cp *.cxx *.cpp *.CPP *.c++ *.C 2> /dev/null | sort` ; do
+      all="$all $file"
+    done
+
+    # Qt4
+    if [ "$qt4" = "y" ]; then
+      #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
+      cat << 'EOF'
+
+if ( CGAL_Qt4_FOUND AND QT_FOUND )
+
+  include( ${QT_USE_FILE} )
+  include_directories( ${QT_INCLUDE_DIR} )  
+
+EOF
+      #-----------------------------------------------------------------------
+
+      echo "  # UI files (Qt Designer files)"
+      for file in `ls *.ui 2> /dev/null | sort`; do
+        echo "  qt4_wrap_ui( DT_UI_FILES $file )"
+      done
+      echo
+      echo "  # qrc files (resources files, that contain icons, at least)"
+      for file in `ls *.qrc 2> /dev/null | sort`; do
+        echo "  qt4_add_resources ( DT_RESOURCE_FILES ./$file )"
+      done
+      echo
+      MOC_FILES=""
+      echo "  # use the Qt MOC preprocessor on classes that derives from QObject"
+      for file in `ls include/*.h 2> /dev/null | sort`; do
+        BASE=`basename $file .h`
+        egrep 'Q_OBJECT' $file >/dev/null 2>&1
+        if [ $? -eq 0 ]; then
+          echo "  qt4_generate_moc( include/${BASE}.h ${BASE}.moc )"
+          MOC_FILES="${BASE}.moc $MOC_FILES"
+        fi
+      done
+      for file in `ls *.h 2> /dev/null | sort`; do
+        BASE=`basename $file .h`
+        egrep 'Q_OBJECT' $file >/dev/null 2>&1
+        if [ $? -eq 0 ]; then
+          echo "  qt4_generate_moc( ${BASE}.h ${BASE}.moc )"
+          MOC_FILES="${BASE}.moc $MOC_FILES"
+        fi
+      done
+      for file in `ls *.cc *.cp *.cxx *.cpp *.CPP *.c++ *.C 2> /dev/null | sort` ; do
+        BASE=`basename $file .cc`
+        BASE=`basename $BASE .cp`
+        BASE=`basename $BASE .cxx`
+        BASE=`basename $BASE .cpp`
+        BASE=`basename $BASE .CPP`
+        BASE=`basename $BASE .c++`
+        BASE=`basename $BASE .C`
+        egrep 'Q_OBJECT' $file >/dev/null 2>&1
+        if [ $? -eq 0 ]; then
+          echo "  qt4_generate_moc( ${BASE}.cpp ${BASE}.moc )"
+          MOC_FILES="${BASE}.moc $MOC_FILES"
+        fi
+      done
+
+      #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
+      cat << 'EOF'
+
+endif()
+EOF
+      #-----------------------------------------------------------------------
+
+      all="${all} ${MOC_FILES} \${DT_UI_FILES} \${DT_RESOURCE_FILES}"
+
+    fi # qt4
+
+    # no 'cat' here, as variable substitution required
+    echo
+    echo "add_executable( ${target_name} ${all} )"
+    echo
+    echo "add_to_cached_list( CGAL_EXECUTABLE_TARGETS ${target_name} )"
+    echo
+    echo "# Link the executable to CGAL and third-party libraries"
+    LIBS=""
+    if [ "$qt4" = "y" ]; then
+      LIBS="\${QT_LIBRARIES}" 
+    fi
+    LIBS=$LIBS" \${CGAL_LIBRARIES} \${CGAL_3RD_PARTY_LIBRARIES}"
+    echo "target_link_libraries(${target_name}  $LIBS )"
+
+  fi # single source or all files #===========================================
+
+  #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
+  cat << 'EOF'
+EOF
+  #---------------------------------------------------------------------------
+
+echo
+
+}
+
+usage()
+{
+  echo "Usage: `basename $0` [-s source] [-c cgal-component1:cgal-component2:...] [-b boost-component1:boost-component2:...] [-p] [-o options_file='`pwd`/cgal_cmake_options:$HOME/.cgal_cmake_options_rc'] [-v] [-h]" >&2
+  echo >&2
+  echo "  -s source If this parameter is given the script will create one single executable for 'source' with all source files; otherwise it creates one executable for each main'ed source." >&2
+  echo "  cgal_componentX - must be a valid cgal component, examples are 'Core','ImageIO','Qt4' ('benchmark', 'symbolic')." >&2
+  echo "  boost_componentX - must be a valid boost component, like 'filesystem', 'program_options'." >&2
+  echo "  -o options_file - file with PACKAGE, DIRECTORY, CGAL_COMPONENT, and BOOST_COMPONENT directives" >&2
+  echo "  -v the version" >&2
+  echo "  -h this info screen" >&2
+  echo  >&2
+}
+
+
+SINGLE_SOURCE='n'
+SOURCE=""
+
+CGAL_COMPONENTS_GIVEN=""
+CGAL_COMPONENTS=""
+
+BOOST_COMPONENTS_GIVEN=""
+BOOST_COMPONENTS=""
+
+OPTIONS_FILE=`pwd`"/cgal_cmake_options"
+
+if [ ! -e "$OPTIONS_FILE" ]; then
+  OPTIONS_FILE="${HOME}/.cgal_cmake_options_rc"
+fi
+
+# parse command line arguments
+while getopts s:c:b:o:phvt OPT; do
+  case "$OPT" in
+    s)  SINGLE_SOURCE='y'
+        SOURCE=$OPTARG
+        if [ "${SOURCE:(-3)}" = ".cc" ]; then
+           echo "Error: Source must not end with '.cc'!" >&2
+           echo
+           usage
+           exit 2
+        fi
+        if [ "${SOURCE:(-3)}" = ".cp" ]; then
+           echo "Error: Source must not end with '.cp'!" >&2
+           echo
+           usage
+           exit 2
+        fi
+        if [ "${SOURCE:(-4)}" = ".cxx" ]; then
+           echo "Error: Source must not end with '.cxx'!" >&2
+           echo
+           usage
+           exit 2
+        fi
+        if [ "${SOURCE:(-4)}" = ".cpp" ]; then
+           echo "Error: Source must not end with '.cpp'!" >&2
+           echo
+           usage
+           exit 2
+        fi
+        if [ "${SOURCE:(-4)}" = ".CPP" ]; then
+           echo "Error: Source must not end with '.CPP'!" >&2
+           echo
+           usage
+           exit 2
+        fi
+        if [ "${SOURCE:(-4)}" = ".c++" ]; then
+           echo "Error: Source must not end with '.c++'!" >&2
+           echo
+           usage
+           exit 2
+        fi
+        if [ "${SOURCE:(-2)}" = ".C" ]; then
+           echo "Error: Source must not end with '.C'!" >&2
+           echo
+           usage
+           exit 2
+        fi
+
+        ;;
+
+    c)  CGAL_COMPONENTS_GIVEN='y'
+        CGAL_COMPONENTS=$OPTARG
+        ;;
+    b)  BOOST_COMPONENTS_GIVEN='y'
+        BOOST_COMPONENTS=$OPTARG
+        ;;
+
+    o)  OPTIONS_FILE=$OPTARG
+        if [ ! -e "$OPTIONS_FILE" ]; then
+          echo "Options-file '$OPTIONS_FILE' does not exist." >&2
+          exit 1
+        fi
+        ;;
+    t)  ENABLE_CTEST='y'
+        ;;
+    h)  usage
+        exit 0
+        ;;
+    v)  echo "`basename $0` version 0.1"
+        exit 0
+        ;;
+    \?) # getopts issues an error message
+        usage
+        exit 1
+        ;;
+  esac
+done
+
+shift `expr $OPTIND - 1`
+
+#echo "FILE: $OPTIONS_FILE"
+#echo "BOOST_COMPONENTS: $BOOST_COMPONENTS"
+echo "CGAL_COMPONENTS: $CGAL_COMPONENTS"
+#echo "SINGLE_SOURCE: $SINGLE_SOURCE"
+#echo "SOURCE: $SOURCE"
+
+OUTPUTFILE=CMakeLists.txt
+PROJECT=`basename $PWD`
+
+if [ -f ${OUTPUTFILE} ] ; then
+  echo "moving $OUTPUTFILE to ${OUTPUTFILE}.bak ..."
+  echo
+  mv -f $OUTPUTFILE ${OUTPUTFILE}.bak
+fi
+
+create_cmake_script_with_options | tee $OUTPUTFILE
+
+echo
+echo "created $OUTPUTFILE in $PWD ..."
diff --git a/3rdparty/CGAL-4.8/scripts/cgal_create_assertions.sh b/3rdparty/CGAL/scripts/cgal_create_assertions.sh
similarity index 100%
rename from 3rdparty/CGAL-4.8/scripts/cgal_create_assertions.sh
rename to 3rdparty/CGAL/scripts/cgal_create_assertions.sh
diff --git a/3rdparty/CGAL-4.8/scripts/cgal_create_cmake_script b/3rdparty/CGAL/scripts/cgal_create_cmake_script
similarity index 100%
rename from 3rdparty/CGAL-4.8/scripts/cgal_create_cmake_script
rename to 3rdparty/CGAL/scripts/cgal_create_cmake_script
diff --git a/3rdparty/CGAL-4.8/scripts/cgal_make_macosx_app b/3rdparty/CGAL/scripts/cgal_make_macosx_app
similarity index 100%
rename from 3rdparty/CGAL-4.8/scripts/cgal_make_macosx_app
rename to 3rdparty/CGAL/scripts/cgal_make_macosx_app
diff --git a/3rdparty/CGAL-4.8/src/CGAL/Bbox_2_intersections.cpp b/3rdparty/CGAL/src/CGAL/Bbox_2_intersections.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL/Bbox_2_intersections.cpp
rename to 3rdparty/CGAL/src/CGAL/Bbox_2_intersections.cpp
diff --git a/3rdparty/CGAL/src/CGAL/CMakeLists.txt b/3rdparty/CGAL/src/CGAL/CMakeLists.txt
new file mode 100644
index 0000000..c3c3611
--- /dev/null
+++ b/3rdparty/CGAL/src/CGAL/CMakeLists.txt
@@ -0,0 +1,19 @@
+message("Configuring libCGAL")
+
+use_essential_libs()
+
+include_directories (SYSTEM ${CGAL_3RD_PARTY_INCLUDE_DIRS})
+
+add_definitions(${CGAL_3RD_PARTY_DEFINITIONS})
+
+link_directories(${CGAL_3RD_PARTY_LIBRARIES_DIRS})
+
+collect_cgal_library(CGAL "")
+
+if(CGAL_HEADER_ONLY)
+  target_link_libraries(CGAL INTERFACE ${CGAL_3RD_PARTY_LIBRARIES})
+else()
+  target_link_libraries(CGAL ${CGAL_3RD_PARTY_LIBRARIES})
+endif()
+
+message("libCGAL is configured")
diff --git a/3rdparty/CGAL-4.8/src/CGAL/Color.cpp b/3rdparty/CGAL/src/CGAL/Color.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL/Color.cpp
rename to 3rdparty/CGAL/src/CGAL/Color.cpp
diff --git a/3rdparty/CGAL-4.8/src/CGAL/File_header_OFF.cpp b/3rdparty/CGAL/src/CGAL/File_header_OFF.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL/File_header_OFF.cpp
rename to 3rdparty/CGAL/src/CGAL/File_header_OFF.cpp
diff --git a/3rdparty/CGAL-4.8/src/CGAL/File_header_extended_OFF.cpp b/3rdparty/CGAL/src/CGAL/File_header_extended_OFF.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL/File_header_extended_OFF.cpp
rename to 3rdparty/CGAL/src/CGAL/File_header_extended_OFF.cpp
diff --git a/3rdparty/CGAL-4.8/src/CGAL/File_scanner_OFF.cpp b/3rdparty/CGAL/src/CGAL/File_scanner_OFF.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL/File_scanner_OFF.cpp
rename to 3rdparty/CGAL/src/CGAL/File_scanner_OFF.cpp
diff --git a/3rdparty/CGAL-4.8/src/CGAL/File_writer_OFF.cpp b/3rdparty/CGAL/src/CGAL/File_writer_OFF.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL/File_writer_OFF.cpp
rename to 3rdparty/CGAL/src/CGAL/File_writer_OFF.cpp
diff --git a/3rdparty/CGAL-4.8/src/CGAL/File_writer_VRML_2.cpp b/3rdparty/CGAL/src/CGAL/File_writer_VRML_2.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL/File_writer_VRML_2.cpp
rename to 3rdparty/CGAL/src/CGAL/File_writer_VRML_2.cpp
diff --git a/3rdparty/CGAL-4.8/src/CGAL/File_writer_inventor.cpp b/3rdparty/CGAL/src/CGAL/File_writer_inventor.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL/File_writer_inventor.cpp
rename to 3rdparty/CGAL/src/CGAL/File_writer_inventor.cpp
diff --git a/3rdparty/CGAL-4.8/src/CGAL/File_writer_wavefront.cpp b/3rdparty/CGAL/src/CGAL/File_writer_wavefront.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL/File_writer_wavefront.cpp
rename to 3rdparty/CGAL/src/CGAL/File_writer_wavefront.cpp
diff --git a/3rdparty/CGAL-4.8/src/CGAL/Geomview_stream.cpp b/3rdparty/CGAL/src/CGAL/Geomview_stream.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL/Geomview_stream.cpp
rename to 3rdparty/CGAL/src/CGAL/Geomview_stream.cpp
diff --git a/3rdparty/CGAL-4.8/src/CGAL/Interval_arithmetic.cpp b/3rdparty/CGAL/src/CGAL/Interval_arithmetic.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL/Interval_arithmetic.cpp
rename to 3rdparty/CGAL/src/CGAL/Interval_arithmetic.cpp
diff --git a/3rdparty/CGAL-4.8/src/CGAL/JAMA_numeric_solver.cpp b/3rdparty/CGAL/src/CGAL/JAMA_numeric_solver.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL/JAMA_numeric_solver.cpp
rename to 3rdparty/CGAL/src/CGAL/JAMA_numeric_solver.cpp
diff --git a/3rdparty/CGAL-4.8/src/CGAL/KDS_Log.cpp b/3rdparty/CGAL/src/CGAL/KDS_Log.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL/KDS_Log.cpp
rename to 3rdparty/CGAL/src/CGAL/KDS_Log.cpp
diff --git a/3rdparty/CGAL-4.8/src/CGAL/NefPolynomial.cpp b/3rdparty/CGAL/src/CGAL/NefPolynomial.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL/NefPolynomial.cpp
rename to 3rdparty/CGAL/src/CGAL/NefPolynomial.cpp
diff --git a/3rdparty/CGAL/src/CGAL/Random.cpp b/3rdparty/CGAL/src/CGAL/Random.cpp
new file mode 100644
index 0000000..40210d3
--- /dev/null
+++ b/3rdparty/CGAL/src/CGAL/Random.cpp
@@ -0,0 +1,36 @@
+// Copyright (c) 1997-2001  
+// Utrecht University (The Netherlands),
+// ETH Zurich (Switzerland),
+// INRIA Sophia-Antipolis (France),
+// Max-Planck-Institute Saarbruecken (Germany),
+// and Tel-Aviv University (Israel).  All rights reserved. 
+//
+// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License as
+// 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(s)     : Sven Schönherr <sven at inf.ethz.ch>
+
+#ifndef CGAL_HEADER_ONLY
+
+#include <CGAL/Random.h>
+#include <CGAL/Random_impl.h>
+
+namespace CGAL {
+
+  Random  default_random;
+
+} //namespace CGAL
+
+#endif
diff --git a/3rdparty/CGAL-4.8/src/CGAL/Real_timer.cpp b/3rdparty/CGAL/src/CGAL/Real_timer.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL/Real_timer.cpp
rename to 3rdparty/CGAL/src/CGAL/Real_timer.cpp
diff --git a/3rdparty/CGAL-4.8/src/CGAL/Residue_type.cpp b/3rdparty/CGAL/src/CGAL/Residue_type.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL/Residue_type.cpp
rename to 3rdparty/CGAL/src/CGAL/Residue_type.cpp
diff --git a/3rdparty/CGAL-4.8/src/CGAL/Timer.cpp b/3rdparty/CGAL/src/CGAL/Timer.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL/Timer.cpp
rename to 3rdparty/CGAL/src/CGAL/Timer.cpp
diff --git a/3rdparty/CGAL-4.8/src/CGAL/Turkowski_numeric_solver.cpp b/3rdparty/CGAL/src/CGAL/Turkowski_numeric_solver.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL/Turkowski_numeric_solver.cpp
rename to 3rdparty/CGAL/src/CGAL/Turkowski_numeric_solver.cpp
diff --git a/3rdparty/CGAL-4.8/src/CGAL/assertions.cpp b/3rdparty/CGAL/src/CGAL/assertions.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL/assertions.cpp
rename to 3rdparty/CGAL/src/CGAL/assertions.cpp
diff --git a/3rdparty/CGAL-4.8/src/CGAL/io.cpp b/3rdparty/CGAL/src/CGAL/io.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL/io.cpp
rename to 3rdparty/CGAL/src/CGAL/io.cpp
diff --git a/3rdparty/CGAL-4.8/src/CGAL/kernel.cpp b/3rdparty/CGAL/src/CGAL/kernel.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL/kernel.cpp
rename to 3rdparty/CGAL/src/CGAL/kernel.cpp
diff --git a/3rdparty/CGAL-4.8/src/CGAL/numeric_solvers_support.cpp b/3rdparty/CGAL/src/CGAL/numeric_solvers_support.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL/numeric_solvers_support.cpp
rename to 3rdparty/CGAL/src/CGAL/numeric_solvers_support.cpp
diff --git a/3rdparty/CGAL-4.8/src/CGAL/test_FPU_rounding_mode.cpp b/3rdparty/CGAL/src/CGAL/test_FPU_rounding_mode.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL/test_FPU_rounding_mode.cpp
rename to 3rdparty/CGAL/src/CGAL/test_FPU_rounding_mode.cpp
diff --git a/3rdparty/CGAL-4.8/src/CGAL_Core/BigFloat.cpp b/3rdparty/CGAL/src/CGAL_Core/BigFloat.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL_Core/BigFloat.cpp
rename to 3rdparty/CGAL/src/CGAL_Core/BigFloat.cpp
diff --git a/3rdparty/CGAL/src/CGAL_Core/CMakeLists.txt b/3rdparty/CGAL/src/CGAL_Core/CMakeLists.txt
new file mode 100644
index 0000000..b07019a
--- /dev/null
+++ b/3rdparty/CGAL/src/CGAL_Core/CMakeLists.txt
@@ -0,0 +1,24 @@
+message("Configuring libCGAL_Core")
+
+use_essential_libs()
+
+include_directories (SYSTEM ${CGAL_3RD_PARTY_INCLUDE_DIRS})
+
+add_definitions(${CGAL_3RD_PARTY_DEFINITIONS})
+
+link_directories    ( ${CGAL_LIBRARIES_DIR} ${CGAL_3RD_PARTY_LIBRARIES_DIRS} )
+
+collect_cgal_library(CGAL_Core "")
+
+if(NOT CGAL_HEADER_ONLY)
+   # CGAL_Core does not depend on CGAL in either DEBUG or RELEASE, but we
+   # still link it.
+   target_link_libraries( CGAL_Core CGAL ${CGAL_3RD_PARTY_LIBRARIES} )
+
+   add_dependencies( CGAL_Core CGAL )
+else()
+  target_link_libraries( CGAL_Core INTERFACE ${CGAL_3RD_PARTY_LIBRARIES} )
+endif()
+
+message("libCGAL_Core is configured")
+
diff --git a/3rdparty/CGAL-4.8/src/CGAL_Core/CoreAux.cpp b/3rdparty/CGAL/src/CGAL_Core/CoreAux.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL_Core/CoreAux.cpp
rename to 3rdparty/CGAL/src/CGAL_Core/CoreAux.cpp
diff --git a/3rdparty/CGAL-4.8/src/CGAL_Core/CoreDefs.cpp b/3rdparty/CGAL/src/CGAL_Core/CoreDefs.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL_Core/CoreDefs.cpp
rename to 3rdparty/CGAL/src/CGAL_Core/CoreDefs.cpp
diff --git a/3rdparty/CGAL-4.8/src/CGAL_Core/CoreIO.cpp b/3rdparty/CGAL/src/CGAL_Core/CoreIO.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL_Core/CoreIO.cpp
rename to 3rdparty/CGAL/src/CGAL_Core/CoreIO.cpp
diff --git a/3rdparty/CGAL-4.8/src/CGAL_Core/Expr.cpp b/3rdparty/CGAL/src/CGAL_Core/Expr.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL_Core/Expr.cpp
rename to 3rdparty/CGAL/src/CGAL_Core/Expr.cpp
diff --git a/3rdparty/CGAL-4.8/src/CGAL_Core/GmpIO.cpp b/3rdparty/CGAL/src/CGAL_Core/GmpIO.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL_Core/GmpIO.cpp
rename to 3rdparty/CGAL/src/CGAL_Core/GmpIO.cpp
diff --git a/3rdparty/CGAL-4.8/src/CGAL_Core/Real.cpp b/3rdparty/CGAL/src/CGAL_Core/Real.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL_Core/Real.cpp
rename to 3rdparty/CGAL/src/CGAL_Core/Real.cpp
diff --git a/3rdparty/CGAL-4.8/src/CGAL_Core/extLong.cpp b/3rdparty/CGAL/src/CGAL_Core/extLong.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL_Core/extLong.cpp
rename to 3rdparty/CGAL/src/CGAL_Core/extLong.cpp
diff --git a/3rdparty/CGAL/src/CGAL_ImageIO/CMakeLists.txt b/3rdparty/CGAL/src/CGAL_ImageIO/CMakeLists.txt
new file mode 100644
index 0000000..87ec974
--- /dev/null
+++ b/3rdparty/CGAL/src/CGAL_ImageIO/CMakeLists.txt
@@ -0,0 +1,52 @@
+message("Configuring libCGAL_ImageIO")
+
+find_package( ZLIB )
+
+if(ZLIB_FOUND)
+  get_dependency_version(ZLIB)
+  cache_set(CGAL_ImageIO_3RD_PARTY_INCLUDE_DIRS ${CGAL_ImageIO_3RD_PARTY_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR} )
+  cache_set(CGAL_ImageIO_3RD_PARTY_LIBRARIES    ${CGAL_ImageIO_3RD_PARTY_LIBRARIES} ${ZLIB_LIBRARY} )
+  cache_set(CGAL_ImageIO_3RD_PARTY_DEFINITIONS  "-DCGAL_USE_ZLIB")
+  cache_set(CGAL_ImageIO_USE_ZLIB "ON")
+endif(ZLIB_FOUND)
+
+set( CGAL_ImageIO_BASENAME CGAL_ImageIO)
+
+if(COMMAND add_config_flag)
+  set( CGAL_HAS_IMAGEIO TRUE ) 
+  add_config_flag( CGAL_HAS_IMAGEIO )
+endif()
+
+use_essential_libs()
+
+if (CGAL_HEADER_ONLY)
+  cache_set(CGAL_ImageIO_3RD_PARTY_INCLUDE_DIRS ${CGAL_ImageIO_3RD_PARTY_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR})
+else()
+  include_directories( SYSTEM ${CGAL_3RD_PARTY_INCLUDE_DIRS} ${CGAL_ImageIO_3RD_PARTY_INCLUDE_DIRS} )
+  link_directories   ( ${CGAL_LIBRARIES_DIR} ${CGAL_3RD_PARTY_LIBRARIES_DIRS} )
+  add_definitions    ( ${CGAL_3RD_PARTY_DEFINITIONS} ${CGAL_ImageIO_3RD_PARTY_DEFINITIONS} )
+endif()
+
+collect_cgal_library( CGAL_ImageIO "")
+
+if (NOT CGAL_HEADER_ONLY)
+
+  add_dependencies( CGAL_ImageIO CGAL )
+
+  # CGAL_ImageIO only depends on CGAL in DEBUG, but we still link it
+  # in both build types.
+  target_link_libraries( CGAL_ImageIO CGAL ${CGAL_3RD_PARTY_LIBRARIES} ${CGAL_ImageIO_3RD_PARTY_LIBRARIES} )
+
+else()
+
+  target_link_libraries( CGAL_ImageIO INTERFACE ${CGAL_3RD_PARTY_LIBRARIES} ${CGAL_ImageIO_3RD_PARTY_LIBRARIES} )
+  target_include_directories( CGAL_ImageIO INTERFACE ${CGAL_3RD_PARTY_LIBRARIES_DIRS})
+
+endif()
+
+message("libCGAL_ImageIO is configured")
+
+if(NOT ZLIB_FOUND)
+  message( STATUS "NOTICE: libCGAL_ImageIO needs ZLib to read compressed files. That feature will not be activated.")
+endif()
+
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/ImageIO.cpp b/3rdparty/CGAL/src/CGAL_ImageIO/ImageIO.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL_ImageIO/ImageIO.cpp
rename to 3rdparty/CGAL/src/CGAL_ImageIO/ImageIO.cpp
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/Image_3.cpp b/3rdparty/CGAL/src/CGAL_ImageIO/Image_3.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL_ImageIO/Image_3.cpp
rename to 3rdparty/CGAL/src/CGAL_ImageIO/Image_3.cpp
diff --git a/3rdparty/CGAL-4.8/src/CGAL_ImageIO/LICENSE b/3rdparty/CGAL/src/CGAL_ImageIO/LICENSE
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL_ImageIO/LICENSE
rename to 3rdparty/CGAL/src/CGAL_ImageIO/LICENSE
diff --git a/3rdparty/CGAL/src/CGAL_ImageIO/analyze.cpp b/3rdparty/CGAL/src/CGAL_ImageIO/analyze.cpp
new file mode 100644
index 0000000..fb2da78
--- /dev/null
+++ b/3rdparty/CGAL/src/CGAL_ImageIO/analyze.cpp
@@ -0,0 +1,27 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+#ifndef CGAL_HEADER_ONLY
+
+#include <CGAL/ImageIO/analyze.h>
+#include <CGAL/ImageIO/analyze_impl.h>
+
+#endif // CGAL_HEADER_ONLY
diff --git a/3rdparty/CGAL/src/CGAL_ImageIO/bmp.cpp b/3rdparty/CGAL/src/CGAL_ImageIO/bmp.cpp
new file mode 100644
index 0000000..8e70717
--- /dev/null
+++ b/3rdparty/CGAL/src/CGAL_ImageIO/bmp.cpp
@@ -0,0 +1,27 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+#ifndef CGAL_HEADER_ONLY
+
+#include <CGAL/ImageIO/bmp.h>
+#include <CGAL/ImageIO/bmp_impl.h>
+
+#endif // CGAL_HEADER_ONLY
diff --git a/3rdparty/CGAL/src/CGAL_ImageIO/bmpendian.cpp b/3rdparty/CGAL/src/CGAL_ImageIO/bmpendian.cpp
new file mode 100644
index 0000000..54b41b7
--- /dev/null
+++ b/3rdparty/CGAL/src/CGAL_ImageIO/bmpendian.cpp
@@ -0,0 +1,27 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+#ifndef CGAL_HEADER_ONLY
+
+#include <CGAL/ImageIO/bmpendian.h>
+#include <CGAL/ImageIO/bmpendian_impl.h>
+
+#endif // CGAL_HEADER_ONLY
diff --git a/3rdparty/CGAL/src/CGAL_ImageIO/bmpread.cpp b/3rdparty/CGAL/src/CGAL_ImageIO/bmpread.cpp
new file mode 100644
index 0000000..584f5c0
--- /dev/null
+++ b/3rdparty/CGAL/src/CGAL_ImageIO/bmpread.cpp
@@ -0,0 +1,27 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+#ifndef CGAL_HEADER_ONLY
+
+#include <CGAL/ImageIO/bmpread.h>
+#include <CGAL/ImageIO/bmpread_impl.h>
+
+#endif // CGAL_HEADER_ONLY
diff --git a/3rdparty/CGAL/src/CGAL_ImageIO/convert.cpp b/3rdparty/CGAL/src/CGAL_ImageIO/convert.cpp
new file mode 100644
index 0000000..d415136
--- /dev/null
+++ b/3rdparty/CGAL/src/CGAL_ImageIO/convert.cpp
@@ -0,0 +1,27 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+#ifndef CGAL_HEADER_ONLY
+
+#include <CGAL/ImageIO/convert.h>
+#include <CGAL/ImageIO/convert_impl.h>
+
+#endif // CGAL_HEADER_ONLY
diff --git a/3rdparty/CGAL/src/CGAL_ImageIO/fgetns.cpp b/3rdparty/CGAL/src/CGAL_ImageIO/fgetns.cpp
new file mode 100644
index 0000000..ff47d2b
--- /dev/null
+++ b/3rdparty/CGAL/src/CGAL_ImageIO/fgetns.cpp
@@ -0,0 +1,27 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+#ifndef CGAL_HEADER_ONLY
+
+#include <CGAL/ImageIO/fgetns.h>
+#include <CGAL/ImageIO/fgetns_impl.h>
+
+#endif // CGAL_HEADER_ONLY
diff --git a/3rdparty/CGAL/src/CGAL_ImageIO/gif.cpp b/3rdparty/CGAL/src/CGAL_ImageIO/gif.cpp
new file mode 100644
index 0000000..13645f0
--- /dev/null
+++ b/3rdparty/CGAL/src/CGAL_ImageIO/gif.cpp
@@ -0,0 +1,27 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+#ifndef CGAL_HEADER_ONLY
+
+#include <CGAL/ImageIO/gif.h>
+#include <CGAL/ImageIO/gif_impl.h>
+
+#endif // CGAL_HEADER_ONLY
diff --git a/3rdparty/CGAL/src/CGAL_ImageIO/gis.cpp b/3rdparty/CGAL/src/CGAL_ImageIO/gis.cpp
new file mode 100644
index 0000000..038f695
--- /dev/null
+++ b/3rdparty/CGAL/src/CGAL_ImageIO/gis.cpp
@@ -0,0 +1,27 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+#ifndef CGAL_HEADER_ONLY
+
+#include <CGAL/ImageIO/gis.h>
+#include <CGAL/ImageIO/gis_impl.h>
+
+#endif // CGAL_HEADER_ONLY
diff --git a/3rdparty/CGAL/src/CGAL_ImageIO/inr.cpp b/3rdparty/CGAL/src/CGAL_ImageIO/inr.cpp
new file mode 100644
index 0000000..fe6518c
--- /dev/null
+++ b/3rdparty/CGAL/src/CGAL_ImageIO/inr.cpp
@@ -0,0 +1,27 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+#ifndef CGAL_HEADER_ONLY
+
+#include <CGAL/ImageIO/inr.h>
+#include <CGAL/ImageIO/inr_impl.h>
+
+#endif // CGAL_HEADER_ONLY
diff --git a/3rdparty/CGAL/src/CGAL_ImageIO/iris.cpp b/3rdparty/CGAL/src/CGAL_ImageIO/iris.cpp
new file mode 100644
index 0000000..e2b3508
--- /dev/null
+++ b/3rdparty/CGAL/src/CGAL_ImageIO/iris.cpp
@@ -0,0 +1,27 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+#ifndef CGAL_HEADER_ONLY
+
+#include <CGAL/ImageIO/iris.h>
+#include <CGAL/ImageIO/iris_impl.h>
+
+#endif // CGAL_HEADER_ONLY
diff --git a/3rdparty/CGAL/src/CGAL_ImageIO/mincio.cpp b/3rdparty/CGAL/src/CGAL_ImageIO/mincio.cpp
new file mode 100644
index 0000000..33650f2
--- /dev/null
+++ b/3rdparty/CGAL/src/CGAL_ImageIO/mincio.cpp
@@ -0,0 +1,27 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+#ifndef CGAL_HEADER_ONLY
+
+#include <CGAL/ImageIO/mincio.h>
+#include <CGAL/ImageIO/mincio_impl.h>
+
+#endif // CGAL_HEADER_ONLY
diff --git a/3rdparty/CGAL/src/CGAL_ImageIO/pnm.cpp b/3rdparty/CGAL/src/CGAL_ImageIO/pnm.cpp
new file mode 100644
index 0000000..c0016c5
--- /dev/null
+++ b/3rdparty/CGAL/src/CGAL_ImageIO/pnm.cpp
@@ -0,0 +1,27 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+#ifndef CGAL_HEADER_ONLY
+
+#include <CGAL/ImageIO/pnm.h>
+#include <CGAL/ImageIO/pnm_impl.h>
+
+#endif // CGAL_HEADER_ONLY
diff --git a/3rdparty/CGAL/src/CGAL_ImageIO/recbuffer.cpp b/3rdparty/CGAL/src/CGAL_ImageIO/recbuffer.cpp
new file mode 100644
index 0000000..f7bdc1c
--- /dev/null
+++ b/3rdparty/CGAL/src/CGAL_ImageIO/recbuffer.cpp
@@ -0,0 +1,27 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+#ifndef CGAL_HEADER_ONLY
+
+#include <CGAL/ImageIO/recbuffer.h>
+#include <CGAL/ImageIO/recbuffer_impl.h>
+
+#endif // CGAL_HEADER_ONLY
diff --git a/3rdparty/CGAL/src/CGAL_ImageIO/recline.cpp b/3rdparty/CGAL/src/CGAL_ImageIO/recline.cpp
new file mode 100644
index 0000000..988f962
--- /dev/null
+++ b/3rdparty/CGAL/src/CGAL_ImageIO/recline.cpp
@@ -0,0 +1,27 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+#ifndef CGAL_HEADER_ONLY
+
+#include <CGAL/ImageIO/recline.h>
+#include <CGAL/ImageIO/recline_impl.h>
+
+#endif // CGAL_HEADER_ONLY
diff --git a/3rdparty/CGAL/src/CGAL_ImageIO/reech4x4.cpp b/3rdparty/CGAL/src/CGAL_ImageIO/reech4x4.cpp
new file mode 100644
index 0000000..51b5972
--- /dev/null
+++ b/3rdparty/CGAL/src/CGAL_ImageIO/reech4x4.cpp
@@ -0,0 +1,27 @@
+// Copyright (c) 2005-2008 ASCLEPIOS Project, INRIA Sophia-Antipolis (France)
+// All rights reserved.
+//
+// This file is part of the ImageIO Library, and as been adapted for
+// 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.
+//
+// These files are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+//
+//
+// Author(s)     :  ASCLEPIOS Project (INRIA Sophia-Antipolis), Laurent Rineau
+
+#ifndef CGAL_HEADER_ONLY
+
+#include <CGAL/ImageIO/reech4x4.h>
+#include <CGAL/ImageIO/reech4x4_impl.h>
+
+#endif // CGAL_HEADER_ONLY
diff --git a/3rdparty/CGAL/src/CGAL_Qt5/CMakeLists.txt b/3rdparty/CGAL/src/CGAL_Qt5/CMakeLists.txt
new file mode 100644
index 0000000..5aece17
--- /dev/null
+++ b/3rdparty/CGAL/src/CGAL_Qt5/CMakeLists.txt
@@ -0,0 +1,110 @@
+message("Configuring libCGAL_Qt5")
+
+if(POLICY CMP0043)
+  cmake_policy(SET CMP0043 OLD)
+endif()
+
+if($ENV{CGAL_FAKE_PUBLIC_RELEASE})
+  add_definitions( -DCGAL_FAKE_PUBLIC_RELEASE )
+endif()
+
+if(CGAL_HEADER_ONLY)
+  cache_set(CGAL_Qt5_3RD_PARTY_LIBRARIES Qt5::OpenGL Qt5::Svg )
+else(CGAL_HEADER_ONLY)
+  find_package(Qt5 QUIET COMPONENTS OpenGL Svg)
+  find_package(OpenGL QUIET)
+
+  set(CGAL_Qt5_MISSING_DEPS "")
+  if(NOT Qt5OpenGL_FOUND)
+    set(CGAL_Qt5_MISSING_DEPS "Qt5OpenGL")
+  endif()
+  if(NOT Qt5Svg_FOUND)
+    set(CGAL_Qt5_MISSING_DEPS "${CGAL_Qt5_MISSING_DEPS} Qt5Svg")
+  endif()
+  if(NOT Qt5_FOUND)
+    set(CGAL_Qt5_MISSING_DEPS "${CGAL_Qt5_MISSING_DEPS} Qt5")
+  endif()
+  if(NOT OPENGL_FOUND)
+    set(CGAL_Qt5_MISSING_DEPS "${CGAL_Qt5_MISSING_DEPS} OpenGL")
+  endif()
+
+  if(CGAL_Qt5_MISSING_DEPS)
+    message(STATUS "libCGAL_Qt5 is missing the dependencies: ${CGAL_Qt5_MISSING_DEPS} cannot be configured.")
+    return()
+  endif()
+
+  include_directories (BEFORE ../../include)
+
+  message( STATUS "USING Qt5_VERSION = '${Qt5Core_VERSION_STRING}'" )
+  if(COMMAND add_config_flag)
+    set( CGAL_HAS_QT5 TRUE )
+    add_config_flag( CGAL_HAS_QT5 )
+  endif()
+
+  get_property(QT_UIC_EXECUTABLE TARGET Qt5::uic PROPERTY LOCATION)
+  message( STATUS "OpenGL include:      ${OPENGL_INCLUDE_DIR}" )
+  message( STATUS "OpenGL libraries:    ${OPENGL_LIBRARIES}" )
+  message( STATUS "OpenGL definitions:  ${OPENGL_DEFINITIONS}" )
+  message( STATUS "Qt5Core include:     ${Qt5Core_INCLUDE_DIRS}" )
+  message( STATUS "Qt5 libraries:       ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Svg_LIBRARIES} ${Qt5OpenGL_LIBRARIES}" )
+  message( STATUS "Qt5Core definitions: ${Qt5Core_DEFINITIONS}" )
+  message( STATUS "moc executable:      ${QT_MOC_EXECUTABLE}" )
+  message( STATUS "uic executable:      ${QT_UIC_EXECUTABLE}" )
+
+  cache_set(CGAL_Qt5_3RD_PARTY_INCLUDE_DIRS ${QT_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR} )
+  cache_set(CGAL_Qt5_3RD_PARTY_LIBRARIES    ${QT_LIBRARIES}   ${OPENGL_LIBRARIES}   )
+  cache_set(CGAL_Qt5_3RD_PARTY_DEFINITIONS  ${QT_DEFINITIONS} ${OPENGL_DEFINITIONS} )
+
+  set(mocfiles "")
+  set(RESOURCE_FILES "")
+
+  foreach (package ${CGAL_CONFIGURED_PACKAGES} )
+    file(GLOB PACKAGE_QTMOC_FILES "${package}/src/CGAL_Qt5/*.qtmoc.cmake")
+    list(SORT PACKAGE_QTMOC_FILES)
+    foreach(package_qtmoc_file ${PACKAGE_QTMOC_FILES})
+      # includes 'moccing' for sources/headers in package + collects lists of moc-files for dependency (to properly build the lib)
+      include(${package_qtmoc_file})
+      #        message(STATUS QTMOC------------FILE: ${package_qtmoc_file})
+
+    endforeach()
+  endforeach()
+
+  foreach(mocfile ${mocfiles})
+    list(APPEND additional_files ${mocfile})
+  endforeach()
+  foreach(resfile ${RESOURCE_FILES})
+    list(APPEND additional_files ${resfile})
+  endforeach()
+
+#    message(STATUS "Additional input files: ${additional_files}")
+
+  use_essential_libs()
+
+  include_directories( SYSTEM ${CGAL_3RD_PARTY_INCLUDE_DIRS} ${CGAL_Qt5_3RD_PARTY_INCLUDE_DIRS} )
+
+  link_directories    ( ${CGAL_LIBRARIES_DIR} ${CGAL_3RD_PARTY_LIBRARIES_DIRS} )
+
+  add_definitions ( ${CGAL_3RD_PARTY_DEFINITIONS} ${CGAL_Qt5_3RD_PARTY_DEFINITIONS} )
+endif(CGAL_HEADER_ONLY)
+
+collect_cgal_library( CGAL_Qt5 "${additional_files}")
+
+if (NOT CGAL_HEADER_ONLY)
+
+  qt5_use_modules(CGAL_Qt5 OpenGL Svg)
+
+  add_dependencies( CGAL_Qt5 CGAL )
+
+  # CGAL_Qt5 only depends on CGAL in DEBUG, but we still link it in
+  # both build types.
+  target_link_libraries( CGAL_Qt5 CGAL ${CGAL_3RD_PARTY_LIBRARIES} ${CGAL_Qt5_3RD_PARTY_LIBRARIES} )
+
+else()
+
+  install(DIRECTORY "../../include/CGAL/Qt/" DESTINATION "${CGAL_INSTALL_INC_DIR}/CGAL/include/CGAL/Qt")
+  install(DIRECTORY "../../demo/resources/" DESTINATION "${CGAL_INSTALL_INC_DIR}/CGAL/demo/resources")
+  install(DIRECTORY "../../demo/icons/" DESTINATION "${CGAL_INSTALL_INC_DIR}/CGAL/demo/icons")
+
+endif()
+
+message("libCGAL_Qt5 is configured")
diff --git a/3rdparty/CGAL-4.8/src/CGAL_Qt5/DemosMainWindow.cpp b/3rdparty/CGAL/src/CGAL_Qt5/DemosMainWindow.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL_Qt5/DemosMainWindow.cpp
rename to 3rdparty/CGAL/src/CGAL_Qt5/DemosMainWindow.cpp
diff --git a/3rdparty/CGAL/src/CGAL_Qt5/GraphicsView.qtmoc.cmake b/3rdparty/CGAL/src/CGAL_Qt5/GraphicsView.qtmoc.cmake
new file mode 100644
index 0000000..95ba7c3
--- /dev/null
+++ b/3rdparty/CGAL/src/CGAL_Qt5/GraphicsView.qtmoc.cmake
@@ -0,0 +1,8 @@
+# moc files that are compiled directly as cpp files
+qt5_wrap_cpp(mocfiles ../../include/CGAL/Qt/GraphicsViewNavigation.h
+                      ../../include/CGAL/Qt/DemosMainWindow.h
+                      ../../include/CGAL/Qt/GraphicsItem.h
+                      ../../include/CGAL/Qt/GraphicsViewInput.h)
+
+# qrc files (resources files, that contain icons, at least)
+qt5_add_resources ( RESOURCE_FILES ../../demo/resources/CGAL.qrc ../../demo/icons/Input.qrc ../../demo/icons/File.qrc ../../demo/icons/Triangulation_2.qrc)
diff --git a/3rdparty/CGAL-4.8/src/CGAL_Qt5/GraphicsViewNavigation.cpp b/3rdparty/CGAL/src/CGAL_Qt5/GraphicsViewNavigation.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL_Qt5/GraphicsViewNavigation.cpp
rename to 3rdparty/CGAL/src/CGAL_Qt5/GraphicsViewNavigation.cpp
diff --git a/3rdparty/CGAL-4.8/src/CGAL_Qt5/GraphicsViewPolylineInput.cpp b/3rdparty/CGAL/src/CGAL_Qt5/GraphicsViewPolylineInput.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL_Qt5/GraphicsViewPolylineInput.cpp
rename to 3rdparty/CGAL/src/CGAL_Qt5/GraphicsViewPolylineInput.cpp
diff --git a/3rdparty/CGAL-4.8/src/CGAL_Qt5/debug.cpp b/3rdparty/CGAL/src/CGAL_Qt5/debug.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL_Qt5/debug.cpp
rename to 3rdparty/CGAL/src/CGAL_Qt5/debug.cpp
diff --git a/3rdparty/CGAL-4.8/src/CGAL_Qt5/resources.cpp b/3rdparty/CGAL/src/CGAL_Qt5/resources.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL_Qt5/resources.cpp
rename to 3rdparty/CGAL/src/CGAL_Qt5/resources.cpp
diff --git a/3rdparty/CGAL-4.8/src/CGAL_Qt5/utility.cpp b/3rdparty/CGAL/src/CGAL_Qt5/utility.cpp
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL_Qt5/utility.cpp
rename to 3rdparty/CGAL/src/CGAL_Qt5/utility.cpp
diff --git a/3rdparty/CGAL-4.8/src/CGAL_libs_verinfo.rc.in b/3rdparty/CGAL/src/CGAL_libs_verinfo.rc.in
similarity index 100%
rename from 3rdparty/CGAL-4.8/src/CGAL_libs_verinfo.rc.in
rename to 3rdparty/CGAL/src/CGAL_libs_verinfo.rc.in
diff --git a/3rdparty/CGAL/src/CMakeLists.txt b/3rdparty/CGAL/src/CMakeLists.txt
new file mode 100644
index 0000000..da2b92f
--- /dev/null
+++ b/3rdparty/CGAL/src/CMakeLists.txt
@@ -0,0 +1,217 @@
+function (collect_cgal_library LIBRARY_NAME ADDITIONAL_FILES)
+
+  if (NOT CGAL_HEADER_ONLY)
+  # IMPORTANT: First delete all_files.cpp
+  if (EXISTS ${CMAKE_CURRENT_BINARY_DIR}/all_files.cpp)
+    file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/all_files.cpp)
+  endif()
+
+  # THEN collect *.cpp
+  foreach (package ${CGAL_CONFIGURED_PACKAGES} )
+    file(GLOB CGAL_LIBRARY_SOURCE_FILES_TMP ${package}/src/${LIBRARY_NAME}/*.cpp)
+    list(SORT CGAL_LIBRARY_SOURCE_FILES_TMP)
+    foreach(file ${CGAL_LIBRARY_SOURCE_FILES_TMP})
+      if(NOT ${file} MATCHES "/qrc_.*")
+        list(APPEND CGAL_LIBRARY_SOURCE_FILES ${file})
+      endif()
+    endforeach()
+  endforeach()
+
+  foreach(source ${CGAL_LIBRARY_SOURCE_FILES})
+    # It may happen that a file all_files.cpp had been created in-source by
+    # a previous in-source build. We certainly do not want to include that
+    # file in the new all_files.cpp because .cpp files would be included
+    # twice, and that breaks the one-definition rule (ODR).
+    if(NOT source MATCHES ".*/all_files.cpp")
+      file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/all_files.cpp "\#include \"${source}\"\n")
+    endif()
+  endforeach()
+  endif()
+
+  if(CGAL_BUILD_SHARED_LIBS)
+    set(CGAL_LIB_PREFIX "")
+  else()
+    set(CGAL_LIB_PREFIX "lib")
+  endif()
+
+  set(RELEASE_MANGLED_NAME        "${CGAL_LIB_PREFIX}${LIBRARY_NAME}-${CGAL_TOOLSET}-mt-${CGAL_FULL_VERSION}" )
+  set(DEBUG_MANGLED_NAME          "${CGAL_LIB_PREFIX}${LIBRARY_NAME}-${CGAL_TOOLSET}-mt-gd-${CGAL_FULL_VERSION}" )
+
+  if(CGAL_BUILD_SHARED_LIBS AND WIN32)
+    configure_file(${CGAL_INSTALLATION_PACKAGE_DIR}/src/CGAL_libs_verinfo.rc.in ${LIBRARY_NAME}_verinfo.rc @ONLY)
+    set(rc_file ${CMAKE_CURRENT_BINARY_DIR}/${LIBRARY_NAME}_verinfo.rc)
+  else()
+    set(rc_file )
+  endif()
+
+  if (NOT CGAL_HEADER_ONLY)
+    add_library (${LIBRARY_NAME}
+      ${CMAKE_CURRENT_BINARY_DIR}/all_files.cpp
+      ${rc_file}
+      ${ADDITIONAL_FILES})
+    #  add_library (${LIBRARY_NAME} ${CGAL_LIBRARY_SOURCE_FILES} ${rc_file} ${ADDITIONAL_FILES}) # builing not creating temporary all_files.cpp
+    if(CGAL_SOVERSION AND CGAL_SONAME_VERSION)
+      set_target_properties(${LIBRARY_NAME} PROPERTIES
+        VERSION "${CGAL_SOVERSION}"
+        SOVERSION "${CGAL_SONAME_VERSION}")
+    endif()
+  else()
+    if(${LIBRARY_NAME}_LIB_DEPENDS)
+      # Fix a bug when CGAL is configured first without `CGAL_HEADER_ONLY`
+      # and then `CGAL_HEADER_ONLY` is set without cleaning the cache.
+      unset(${LIBRARY_NAME}_LIB_DEPENDS CACHE)
+    endif()
+    add_library(${LIBRARY_NAME} INTERFACE)
+  endif()
+
+  if(CGAL_AUTO_LINK_ENABLED)
+    if (NOT CGAL_HEADER_ONLY)
+      set_target_properties( ${LIBRARY_NAME} PROPERTIES
+        OUTPUT_NAME_DEBUG          "${DEBUG_MANGLED_NAME}"
+        OUTPUT_NAME_RELEASE        "${RELEASE_MANGLED_NAME}"
+        OUTPUT_NAME_MINSIZEREL     "${RELEASE_MANGLED_NAME}"
+        OUTPUT_NAME_RELWITHDEBINFO "${RELEASE_MANGLED_NAME}"
+        )
+
+      if ( HAS_CFG_INTDIR )
+        add_custom_command(TARGET ${LIBRARY_NAME} POST_BUILD COMMAND if exist \"$(TargetDir)$(TargetName).dll\" copy /Y \"$(TargetDir)$(TargetName).dll\" \"$(TargetDir)..\" )
+        add_custom_command(TARGET ${LIBRARY_NAME} POST_BUILD COMMAND if exist \"$(TargetDir)$(TargetName).pdb\" copy /Y \"$(TargetDir)$(TargetName).pdb\" \"$(TargetDir)..\" )
+        add_custom_command(TARGET ${LIBRARY_NAME} POST_BUILD COMMAND if exist \"$(SolutionDir)lib\\$(ConfigurationName)\\$(TargetName).lib\" copy /Y \"$(SolutionDir)lib\\$(ConfigurationName)\\$(TargetName).lib\" \"$(SolutionDir)lib\" )
+      endif()
+    endif()
+  endif()
+
+  # if (NOT CGAL_HEADER_ONLY)
+    install(TARGETS ${LIBRARY_NAME} EXPORT ${LIBRARY_NAME}Exports
+      RUNTIME DESTINATION "${CGAL_INSTALL_BIN_DIR}"
+      LIBRARY DESTINATION "${CGAL_INSTALL_LIB_DIR}"
+      ARCHIVE DESTINATION "${CGAL_INSTALL_LIB_DIR}")
+    install(EXPORT ${LIBRARY_NAME}Exports
+      DESTINATION "${CGAL_INSTALL_CMAKE_DIR}"
+      NAMESPACE CGAL::)
+  # endif()
+
+  # We have to call configure_file twice to force double expansion of variables.
+  configure_file("${CGAL_MODULES_DIR}/CGALLibConfig.cmake.in"
+    "${CMAKE_BINARY_DIR}/${LIBRARY_NAME}LibConfig.cmake" @ONLY)
+  configure_file("${CMAKE_BINARY_DIR}/${LIBRARY_NAME}LibConfig.cmake"
+    "${CMAKE_BINARY_DIR}/${LIBRARY_NAME}LibConfig.cmake" @ONLY)
+  install(FILES "${CMAKE_BINARY_DIR}/${LIBRARY_NAME}LibConfig.cmake" DESTINATION ${CGAL_INSTALL_CMAKE_DIR})
+
+endfunction()
+
+function( configure_component DIR COMPONENT )
+  set(enabled_by_default ON)
+  option( WITH_${COMPONENT} "Enable CGAL component ${COMPONENT}" ${enabled_by_default})
+  if ( WITH_${COMPONENT})
+    add_subdirectory( ${DIR} ${COMPONENT} )
+  endif()
+endfunction()
+
+# Output directory of libraries (.so, .dylib, non-static .lib)
+set(CGAL_LIBRARIES_DIR ${CMAKE_BINARY_DIR}/lib)
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CGAL_LIBRARIES_DIR})
+# Output directory of static libraries (.a, static .lib)
+set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CGAL_LIBRARIES_DIR})
+
+# For output directory of DLLs (.dll files)
+set(CGAL_RUNTIME_DIR ${CMAKE_BINARY_DIR}/bin)
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CGAL_RUNTIME_DIR})
+
+## Prevent use of intermediate directory with MSVC, because we use name
+## mangling
+#foreach(Conf_type ${CMAKE_CONFIGURATION_TYPES})
+#  # Conf_type is Debug, Release, DebWithDebInfo...
+#  string(TOUPPER ${Conf_type} CONF_TYPE)
+#  # CONF_TYPE is DEBUG, RELEASE, DEBWITHDEBINFO
+#  set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CONF_TYPE} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
+#  set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CONF_TYPE} ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY})
+#  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CONF_TYPE} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
+#endforeach()
+
+# TODO: Seems useless, because it is called again in ../CMakeLists.txt
+#       Should probably be removed. -- Laurent Rineau, 2014/07/22
+create_CGALconfig_files()
+
+set(CGAL_DIR ${CMAKE_BINARY_DIR})
+
+add_subdirectory(CGAL)
+
+# search libs
+set(CGAL_CONFIGURED_LIBRARIES "")
+
+foreach(package ${CGAL_CONFIGURED_PACKAGES})
+  file(GLOB CONFIGURED_LIBS_IN_PACKAGE ${package}/src/CGAL_*/CMakeLists.txt)
+  list(SORT CONFIGURED_LIBS_IN_PACKAGE)
+  foreach (libconfigfile ${CONFIGURED_LIBS_IN_PACKAGE})
+    get_filename_component(CGAL_CONFIGURED_LIBRARY_NAME ${libconfigfile} PATH)
+    get_filename_component(CGAL_CONFIGURED_LIBRARY_NAME ${CGAL_CONFIGURED_LIBRARY_NAME} NAME)
+
+    if (NOT ${CGAL_CONFIGURED_LIBRARY_NAME} STREQUAL "CGAL")
+
+     message(STATUS "Sources for CGAL component library '${CGAL_CONFIGURED_LIBRARY_NAME}' detected")
+      list(APPEND CGAL_CONFIGURED_LIBRARIES ${CGAL_CONFIGURED_LIBRARY_NAME})
+      #message(STATUS "Library config detected: ${CGAL_CONFIGURED_LIBRARIES}")
+
+      cache_set(${CGAL_CONFIGURED_LIBRARY_NAME}_LIBRARY                  "" )
+      cache_set(${CGAL_CONFIGURED_LIBRARY_NAME}_3RD_PARTY_DEFINITIONS    "" )
+      cache_set(${CGAL_CONFIGURED_LIBRARY_NAME}_3RD_PARTY_INCLUDE_DIRS   "" )
+      cache_set(${CGAL_CONFIGURED_LIBRARY_NAME}_3RD_PARTY_LIBRARIES      "" )
+      cache_set(${CGAL_CONFIGURED_LIBRARY_NAME}_3RD_PARTY_LIBRARIES_DIRS "" )
+      if (${CGAL_CONFIGURED_LIBRARY_NAME} STREQUAL "CGAL_Core")
+        if (NOT CGAL_NO_CORE)
+          configure_component( ${package}/src/${CGAL_CONFIGURED_LIBRARY_NAME} ${CGAL_CONFIGURED_LIBRARY_NAME})
+        else(NOT CGAL_NO_CORE)
+          message( STATUS "CGAL_Core is not being configured (missing GMP, or 64bit architecture).")
+        endif(NOT CGAL_NO_CORE)
+      else()
+        configure_component( ${package}/src/${CGAL_CONFIGURED_LIBRARY_NAME} ${CGAL_CONFIGURED_LIBRARY_NAME})
+      endif()
+
+     cache_get(${CGAL_CONFIGURED_LIBRARY_NAME}_LIBRARY)
+
+     cache_get(${CGAL_CONFIGURED_LIBRARY_NAME}_3RD_PARTY_DEFINITIONS   )
+     cache_get(${CGAL_CONFIGURED_LIBRARY_NAME}_3RD_PARTY_INCLUDE_DIRS  )
+     cache_get(${CGAL_CONFIGURED_LIBRARY_NAME}_3RD_PARTY_LIBRARIES     )
+     cache_get(${CGAL_CONFIGURED_LIBRARY_NAME}_3RD_PARTY_LIBRARIES_DIRS)
+
+    else()
+
+      list(APPEND CGAL_CONFIGURED_LIBRARIES CGAL)
+
+    endif()
+  endforeach()
+endforeach()
+
+if (NOT CGAL_CONFIGURED_LIBRARIES)
+   message(FATAL_ERROR "No component library in configured packages found. Please fix package-file.")
+endif()
+
+list(REMOVE_DUPLICATES CGAL_CONFIGURED_LIBRARIES)
+list(SORT CGAL_CONFIGURED_LIBRARIES)
+cache_set(CGAL_CONFIGURED_LIBRARIES "${CGAL_CONFIGURED_LIBRARIES}")
+
+# CGAL_CONFIGURED_LIBRARIES is a virtually useless variable, because
+# we do not know if those components actually created a target.  It
+# might seem bad that we hardcode the target names here, but they have
+# always been hardcoded in the CGALConfig files, so we do not make it
+# any worse. We can also not use export(EXPORT) since that is only
+# available in newer CMake versions.
+set(CGAL_ACTUAL_CONFIGURED_LIBRARIES "")
+macro(CGAL_add_if_target TARGET)
+  if(TARGET ${TARGET})
+    list(APPEND CGAL_ACTUAL_CONFIGURED_LIBRARIES ${TARGET})
+  endif()
+endmacro()
+
+CGAL_add_if_target(CGAL)
+CGAL_add_if_target(CGAL_Core)
+CGAL_add_if_target(CGAL_ImageIO)
+CGAL_add_if_target(CGAL_Qt5)
+
+# if (NOT CGAL_HEADER_ONLY)
+  export(TARGETS ${CGAL_ACTUAL_CONFIGURED_LIBRARIES} NAMESPACE CGAL:: FILE "${CMAKE_BINARY_DIR}/CGALExports.cmake")
+# endif()
+
+message(STATUS "Sources for CGAL component libraries '${CGAL_CONFIGURED_LIBRARIES}' detected")
+
diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt
index 50c20ce..69c163b 100644
--- a/3rdparty/CMakeLists.txt
+++ b/3rdparty/CMakeLists.txt
@@ -5,7 +5,7 @@ message(STATUS "Building CGAL")
 message(STATUS "Current source dir: ${CMAKE_CURRENT_SOURCE_DIR}")
 message(STATUS "Binary dir: ${CMAKE_BINARY_DIR}")
 
-set(CGAL_INSTALL_DIR ${CMAKE_BINARY_DIR}/CGAL-4.8-installdir)
+set(CGAL_INSTALL_DIR ${CMAKE_BINARY_DIR}/CGAL-installdir)
 
 if ( CMAKE_BUILD_TYPE )
   set(CGAL_BUILD_TYPE ${CMAKE_BUILD_TYPE})
@@ -25,10 +25,12 @@ endif()
 message(STATUS "CGAL build type: ${CGAL_BUILD_TYPE}")
 
 # Note: Need to add fPIC in order to be able to link staticly with CGAL
-ExternalProject_Add(CGAL-4.8
-  SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/CGAL-4.8
+# FIXME: The CMAKE_CXX_FLAGS=-std=c++11 is a hack to remove CGAL's dependency on boost.thread (see setup_Boost.cmake)
+# This should be removed when CGAL's boost dependecy is eventually removed.
+ExternalProject_Add(CGAL
+  SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/CGAL
   INSTALL_DIR ${CGAL_INSTALL_DIR}
-  CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CGAL_INSTALL_DIR} -DCMAKE_BUILD_TYPE=${CGAL_BUILD_TYPE} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCGAL_CXX_FLAGS=-fPIC -DWITH_CGAL_Core:BOOL=OFF -DWITH_CGAL_ImageIO:BOOL=OFF -DWITH_CGAL_Qt5:BOOL=OFF -DWITH_demos:BOOL=OFF -DWITH_examples:BOOL=OFF -DWITH_LEDA:BOOL=OFF -DWITH_GMP:BOOL=ON -DWITH_MPFR:BOOL=ON -DWITH_Eigen3:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=OFF -DBOOST_ROOT=${BOOST_ROOT} -DGMP_INCLUDE_DIR=${GMP [...]
+  CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CGAL_INSTALL_DIR} -DCMAKE_BUILD_TYPE=${CGAL_BUILD_TYPE} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_CXX_FLAGS=-std=c++11 -DCGAL_CXX_FLAGS=-fPIC -DWITH_CGAL_Core:BOOL=OFF -DWITH_CGAL_ImageIO:BOOL=OFF -DWITH_CGAL_Qt5:BOOL=OFF -DWITH_demos:BOOL=OFF -DWITH_examples:BOOL=OFF -DWITH_LEDA:BOOL=OFF -DWITH_GMP:BOOL=ON -DWITH_MPFR:BOOL=ON -DWITH_Eigen3:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=OFF -DBOOST_ROOT=${BOOST_ [...]
 
     # -DWITH_ESBTL:BOOL=OFF        \
     # -DWITH_GMPXX:BOOL=OFF        \
@@ -64,5 +66,5 @@ set(CGAL_LIB_DIR ${CGAL_INSTALL_DIR}/lib PARENT_SCOPE)
 add_subdirectory( tetgen1.5.0 )
 
 set(EXTERNAL_INCLUDE_DIRS "${CGAL_INSTALL_DIR}/include;${TETGEN_INCLUDE_DIR}" PARENT_SCOPE)
-set(EXTERNAL_LIBS "${CGAL_INSTALL_DIR}/lib/libCGAL.a;tet" PARENT_SCOPE)
+set(EXTERNAL_LIBS "tet" PARENT_SCOPE)
 set(EXTERNAL_DEFINITIONS "${TETGEN_DEFINITIONS}" PARENT_SCOPE)
diff --git a/3rdparty/cgal-version.txt b/3rdparty/cgal-version.txt
new file mode 100644
index 0000000..86a9588
--- /dev/null
+++ b/3rdparty/cgal-version.txt
@@ -0,0 +1 @@
+4.9
diff --git a/3rdparty/cgal.patch b/3rdparty/cgal.patch
new file mode 100644
index 0000000..ffb6ef1
--- /dev/null
+++ b/3rdparty/cgal.patch
@@ -0,0 +1,35 @@
+diff --git a/3rdparty/CGAL/include/CGAL/Polyhedral_mesh_domain_with_features_3.h b/3rdparty/CGAL/include/CGAL/Polyhedral_mesh_domain_with_features_3.h
+index 3731b02..53e3edf 100644
+--- a/3rdparty/CGAL/include/CGAL/Polyhedral_mesh_domain_with_features_3.h
++++ b/3rdparty/CGAL/include/CGAL/Polyhedral_mesh_domain_with_features_3.h
+@@ -74,10 +74,10 @@ class Polyhedral_mesh_domain_with_features_3
+     Polyhedral_mesh_domain_3<
+            Polyhedron_, IGT_, TriangleAccessor,
+	           Use_patch_id_tag, Use_exact_intersection_construction_tag > > Base;
+		   -
+		   -  typedef Polyhedron_ Polyhedron;
+		   -
+		   +
+		    public:
+		    +  typedef Polyhedron_ Polyhedron;
+		    +
+		       // Index types
+		          typedef typename Base::Index                Index;
+			     typedef typename Base::Corner_index         Corner_index;
+			     @@ -170,6 +170,16 @@ private:
+			        std::vector<Polyhedron> poly_;
+				   bool borders_detected_;
+
++public:
++  const Polyhedron& polyhedron() const
++  {
++    if (poly_.size() != 1)
++    {
++      std::err << "Unexpected number of polyhedrons! " << poly_.size() << std::endl;
++      return poly_[0];
++    }
++  }
++
+ private:
+    // Disabled copy constructor & assignment operator
+       typedef Polyhedral_mesh_domain_with_features_3 Self;
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 56c2a0a..12c290b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,7 @@
 project( MSHR )
 set(MSHR_VERSION_RELEASE 1)
 set(MSHR_VERSION_MAJOR "2016")
-set(MSHR_VERSION_MINOR "1")
+set(MSHR_VERSION_MINOR "2")
 set(MSHR_VERSION_MICRO "0")
 set(MSHR_VERSION "${MSHR_VERSION_MAJOR}.${MSHR_VERSION_MINOR}.${MSHR_VERSION_MICRO}")
 if (NOT MSHR_VERSION_RELEASE)
@@ -25,7 +25,7 @@ if ( COMMAND cmake_policy )
 endif()
 
 # Borrow some cmake modules from cgal
-set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/3rdparty/CGAL-4.8/cmake/modules")
+set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/3rdparty/CGAL/cmake/modules")
 
 # Helper macro for testing if particular value is contained in list
 # Taken from http://www.cmake.org/Wiki/CMakeMacroListOperations#LIST_CONTAINS
@@ -51,13 +51,11 @@ endif()
 
 # Prevent FindBoost.cmake from looking for system Boost{foo}.cmake files
 set(Boost_NO_BOOST_CMAKE true)
-find_package( Boost REQUIRED system filesystem program_options thread )
-
+find_package( Boost REQUIRED system filesystem program_options )
+# Save this because it will be overwritten by find_package(DOLFIN)
+set(Boost_MSHR_LIBRARIES ${Boost_LIBRARIES})
 include_directories("${Boost_INCLUDE_DIRS}")
 
-# Temporary: attempt to find linking problem
-find_package(MPI REQUIRED)
-
 #  GMP_INCLUDE_DIR       - the GMP include directory
 #  GMP_LIBRARIES_DIR     - directory where the GMP libraries are located
 #  GMP_LIBRARIES         - Link these to use GMP
@@ -82,16 +80,16 @@ find_package(DOLFIN REQUIRED)
 include_directories(${DOLFIN_PYTHON_INCLUDE_DIRS})
 include(${DOLFIN_USE_FILE})
 
-# If MSHR_ENABLE_VTK is defined (ie. on the command line), it will
-# take precedence. Otherwise, mshr, will check if Dolfin is configured
-# with VTK and do the same.
 LIST_CONTAINS(DOLFIN_HAS_VTK "-DHAS_VTK" ${DOLFIN_CXX_DEFINITIONS})
-if ( MSHR_ENABLE_VTK OR
-    (NOT DEFINED MSHR_ENABLE_VTK AND DOLFIN_HAS_VTK) )
+option(MSHR_ENABLE_VTK "Build mshr with suport for vtk file reading and writing" ON)
+if ( MSHR_ENABLE_VTK )
   find_package(VTK)
   if (VTK_FOUND)
+    message(STATUS "Found VTK")
     add_definitions( -DMSHR_HAS_VTK )
     include(${VTK_USE_FILE})
+  else()
+    message(STATUS "VTK not found")
   endif()
 endif()
 
@@ -122,7 +120,7 @@ include_directories( BEFORE include )
 file( GLOB_RECURSE SOURCES src/*.cpp )
 
 add_library(mshr SHARED ${SOURCES})
-add_dependencies( mshr CGAL-4.8 )
+add_dependencies( mshr CGAL )
 
 # Append the library version information to the library target properties
 option(MSHR_WITH_LIBRARY_VERSION "Build with library version information." ON)
@@ -138,8 +136,7 @@ endif()
 set_target_properties(mshr PROPERTIES ${MSHR_LIBRARY_PROPERTIES})
 
 # Link the executable to (static) CGAL libraries
-target_link_libraries( mshr ${CGAL_LIB_DIR}/libCGAL.a
-			    ${Boost_LIBRARIES}
+target_link_libraries( mshr ${Boost_MSHR_LIBRARIES}
                             ${GMP_LIBRARIES}
                             ${MPFR_LIBRARIES}
 			    tet
@@ -168,7 +165,7 @@ export(PACKAGE mshr)
 
 target_link_libraries( mshr
   ${DOLFIN_LIBRARIES}
-  ${Boost_LIBRARIES}
+  ${Boost_MSHR_LIBRARIES}
   )
 
 # install library
@@ -181,10 +178,11 @@ install(TARGETS mshr
 option(ENABLE_MSHRABLE "Enable building the command line client, mshrable" ON)
 if (ENABLE_MSHRABLE)
   add_executable( mshrable app/mshrable.cpp )
+
   target_link_libraries( mshrable
     mshr
     ${DOLFIN_LIBRARIES}
-    ${Boost_LIBRARIES}
+    ${Boost_MSHR_LIBRARIES}
     )
 
   # install app
diff --git a/ChangeLog b/ChangeLog
index 28abecd..6c31a5b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2016.2.0 [2016-11-30]
+ - Improvements and bugfixes
+ - Upgrade to CGAL 4.9 and use CGAL as header only library
 2016.1.0 [2016-06-23]
  - Major improvements, in particular boundary conditions
 1.6.0 [2015-07-28]
diff --git a/app/mshrable.cpp b/app/mshrable.cpp
index 85d3144..c486a7c 100644
--- a/app/mshrable.cpp
+++ b/app/mshrable.cpp
@@ -117,8 +117,8 @@ int main(int argc, char** argv)
   }
 
 
-  mshr::Surface3D surf(vm["input-file"].as<std::string>());
-  surf.degenerate_tolerance = vm["degenerate_tolerance"].as<double>();
+  std::shared_ptr<mshr::Surface3D> surf(new mshr::Surface3D(vm["input-file"].as<std::string>()));
+  surf->degenerate_tolerance = vm["degenerate_tolerance"].as<double>();
 
   // Operations that disable mesh generation
   if (vm.count("polyout") || vm.count("polystats"))
diff --git a/doc/sphinx/Makefile b/doc/sphinx/Makefile
new file mode 100644
index 0000000..06a261d
--- /dev/null
+++ b/doc/sphinx/Makefile
@@ -0,0 +1,216 @@
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS    =
+SPHINXBUILD   = sphinx-build
+PAPER         =
+BUILDDIR      = build
+
+# User-friendly check for sphinx-build
+ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
+$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
+endif
+
+# Internal variables.
+PAPEROPT_a4     = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
+# the i18n builder cannot share the environment and doctrees with the others
+I18NSPHINXOPTS  = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
+
+.PHONY: help
+help:
+	@echo "Please use \`make <target>' where <target> is one of"
+	@echo "  html       to make standalone HTML files"
+	@echo "  dirhtml    to make HTML files named index.html in directories"
+	@echo "  singlehtml to make a single large HTML file"
+	@echo "  pickle     to make pickle files"
+	@echo "  json       to make JSON files"
+	@echo "  htmlhelp   to make HTML files and a HTML help project"
+	@echo "  qthelp     to make HTML files and a qthelp project"
+	@echo "  applehelp  to make an Apple Help Book"
+	@echo "  devhelp    to make HTML files and a Devhelp project"
+	@echo "  epub       to make an epub"
+	@echo "  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+	@echo "  latexpdf   to make LaTeX files and run them through pdflatex"
+	@echo "  latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
+	@echo "  text       to make text files"
+	@echo "  man        to make manual pages"
+	@echo "  texinfo    to make Texinfo files"
+	@echo "  info       to make Texinfo files and run them through makeinfo"
+	@echo "  gettext    to make PO message catalogs"
+	@echo "  changes    to make an overview of all changed/added/deprecated items"
+	@echo "  xml        to make Docutils-native XML files"
+	@echo "  pseudoxml  to make pseudoxml-XML files for display purposes"
+	@echo "  linkcheck  to check all external links for integrity"
+	@echo "  doctest    to run all doctests embedded in the documentation (if enabled)"
+	@echo "  coverage   to run coverage check of the documentation (if enabled)"
+
+.PHONY: clean
+clean:
+	rm -rf $(BUILDDIR)/*
+
+.PHONY: html
+html:
+	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+	@echo
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+
+.PHONY: dirhtml
+dirhtml:
+	$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
+	@echo
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
+
+.PHONY: singlehtml
+singlehtml:
+	$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
+	@echo
+	@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
+
+.PHONY: pickle
+pickle:
+	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
+	@echo
+	@echo "Build finished; now you can process the pickle files."
+
+.PHONY: json
+json:
+	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
+	@echo
+	@echo "Build finished; now you can process the JSON files."
+
+.PHONY: htmlhelp
+htmlhelp:
+	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
+	@echo
+	@echo "Build finished; now you can run HTML Help Workshop with the" \
+	      ".hhp project file in $(BUILDDIR)/htmlhelp."
+
+.PHONY: qthelp
+qthelp:
+	$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
+	@echo
+	@echo "Build finished; now you can run "qcollectiongenerator" with the" \
+	      ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
+	@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/mshr.qhcp"
+	@echo "To view the help file:"
+	@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/mshr.qhc"
+
+.PHONY: applehelp
+applehelp:
+	$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
+	@echo
+	@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
+	@echo "N.B. You won't be able to view it unless you put it in" \
+	      "~/Library/Documentation/Help or install it in your application" \
+	      "bundle."
+
+.PHONY: devhelp
+devhelp:
+	$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
+	@echo
+	@echo "Build finished."
+	@echo "To view the help file:"
+	@echo "# mkdir -p $$HOME/.local/share/devhelp/mshr"
+	@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/mshr"
+	@echo "# devhelp"
+
+.PHONY: epub
+epub:
+	$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
+	@echo
+	@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
+
+.PHONY: latex
+latex:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo
+	@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
+	@echo "Run \`make' in that directory to run these through (pdf)latex" \
+	      "(use \`make latexpdf' here to do that automatically)."
+
+.PHONY: latexpdf
+latexpdf:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo "Running LaTeX files through pdflatex..."
+	$(MAKE) -C $(BUILDDIR)/latex all-pdf
+	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+.PHONY: latexpdfja
+latexpdfja:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo "Running LaTeX files through platex and dvipdfmx..."
+	$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
+	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+.PHONY: text
+text:
+	$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
+	@echo
+	@echo "Build finished. The text files are in $(BUILDDIR)/text."
+
+.PHONY: man
+man:
+	$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
+	@echo
+	@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
+
+.PHONY: texinfo
+texinfo:
+	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+	@echo
+	@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
+	@echo "Run \`make' in that directory to run these through makeinfo" \
+	      "(use \`make info' here to do that automatically)."
+
+.PHONY: info
+info:
+	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+	@echo "Running Texinfo files through makeinfo..."
+	make -C $(BUILDDIR)/texinfo info
+	@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
+
+.PHONY: gettext
+gettext:
+	$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
+	@echo
+	@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
+
+.PHONY: changes
+changes:
+	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
+	@echo
+	@echo "The overview file is in $(BUILDDIR)/changes."
+
+.PHONY: linkcheck
+linkcheck:
+	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
+	@echo
+	@echo "Link check complete; look for any errors in the above output " \
+	      "or in $(BUILDDIR)/linkcheck/output.txt."
+
+.PHONY: doctest
+doctest:
+	$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
+	@echo "Testing of doctests in the sources finished, look at the " \
+	      "results in $(BUILDDIR)/doctest/output.txt."
+
+.PHONY: coverage
+coverage:
+	$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
+	@echo "Testing of coverage in the sources finished, look at the " \
+	      "results in $(BUILDDIR)/coverage/python.txt."
+
+.PHONY: xml
+xml:
+	$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
+	@echo
+	@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
+
+.PHONY: pseudoxml
+pseudoxml:
+	$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
+	@echo
+	@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
diff --git a/doc/sphinx/README b/doc/sphinx/README
new file mode 100644
index 0000000..049ff11
--- /dev/null
+++ b/doc/sphinx/README
@@ -0,0 +1,20 @@
+====================
+Sphinx documentation
+====================
+
+mshr is documented using Sphinx and reStructured text. The
+documentation is hosted at http://fenics-mshr.readthedocs.org/. The
+online documentation is automatically updated upon pushes to the mshr
+master branch.
+
+
+Building the documentation locally
+==================================
+
+The HTML documentation can be built locally using::
+
+    make html
+
+In order for changes in the docstring to be propagated to the html
+pages, mshr must be installed anew. In other words, sphinx reads the
+docstrings from the installed code, not the source code.
diff --git a/doc/sphinx/source/conf.py b/doc/sphinx/source/conf.py
new file mode 100644
index 0000000..eecdcf5
--- /dev/null
+++ b/doc/sphinx/source/conf.py
@@ -0,0 +1,291 @@
+# -*- coding: utf-8 -*-
+#
+# mshr documentation build configuration file, created by
+# sphinx-quickstart on Thu Aug 11 13:48:10 2016.
+#
+# This file is execfile()d with the current directory set to its
+# containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys
+import os
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+#sys.path.insert(0, os.path.abspath('.'))
+
+# -- General configuration ------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+#needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be
+# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
+# ones.
+extensions = [
+    'sphinx.ext.autodoc',
+    'sphinx.ext.doctest',
+    'sphinx.ext.coverage',
+    'sphinx.ext.mathjax',
+    'sphinx.ext.viewcode',
+]
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix(es) of source filenames.
+# You can specify multiple suffix as a list of string:
+# source_suffix = ['.rst', '.md']
+source_suffix = '.rst'
+
+# The encoding of source files.
+#source_encoding = 'utf-8-sig'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = u'mshr'
+copyright = u'2016, FEniCS Project'
+author = u'FEniCS Project'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+import mshr
+mshr_version = mshr.__version__
+# The short X.Y version.
+version = mshr_version
+# The full version, including alpha/beta/rc tags.
+release = mshr_version
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#
+# This is also used if you do content translation via gettext catalogs.
+# Usually you set "language" from the command line for these cases.
+language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+exclude_patterns = []
+
+# The reST default role (used for this markup: `text`) to use for all
+# documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# A list of ignored prefixes for module index sorting.
+#modindex_common_prefix = []
+
+# If true, keep warnings as "system message" paragraphs in the built documents.
+#keep_warnings = False
+
+# If true, `todo` and `todoList` produce output, else they produce nothing.
+todo_include_todos = False
+
+
+# -- Options for HTML output ----------------------------------------------
+
+# The theme to use for HTML and HTML Help pages.  See the documentation for
+# a list of builtin themes.
+#html_theme = 'alabaster'
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further.  For a list of options available for each theme, see the
+# documentation.
+#html_theme_options = {}
+
+# Add any paths that contain custom themes here, relative to this directory.
+#html_theme_path = []
+
+# The name for this set of Sphinx documents.  If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# A shorter title for the navigation bar.  Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = None
+
+# The name of an image file (relative to this directory) to use as a favicon of
+# the docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# Add any extra paths that contain custom files (such as robots.txt or
+# .htaccess) here, relative to this directory. These files are copied
+# directly to the root of the documentation.
+#html_extra_path = []
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_domain_indices = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+#html_show_sourcelink = True
+
+# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
+#html_show_sphinx = True
+
+# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
+#html_show_copyright = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it.  The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# This is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = None
+
+# Language to be used for generating the HTML full-text search index.
+# Sphinx supports the following languages:
+#   'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
+#   'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr'
+#html_search_language = 'en'
+
+# A dictionary with options for the search language support, empty by default.
+# Now only 'ja' uses this config value
+#html_search_options = {'type': 'default'}
+
+# The name of a javascript file (relative to the configuration directory) that
+# implements a search results scorer. If empty, the default will be used.
+#html_search_scorer = 'scorer.js'
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'mshrdoc'
+
+# -- Options for LaTeX output ---------------------------------------------
+
+latex_elements = {
+# The paper size ('letterpaper' or 'a4paper').
+#'papersize': 'letterpaper',
+
+# The font size ('10pt', '11pt' or '12pt').
+#'pointsize': '10pt',
+
+# Additional stuff for the LaTeX preamble.
+#'preamble': '',
+
+# Latex figure (float) alignment
+#'figure_align': 'htbp',
+}
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title,
+#  author, documentclass [howto, manual, or own class]).
+latex_documents = [
+    (master_doc, 'mshr.tex', u'mshr Documentation',
+     u'FEniCS Project', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# If true, show page references after internal links.
+#latex_show_pagerefs = False
+
+# If true, show URL addresses after external links.
+#latex_show_urls = False
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_domain_indices = True
+
+
+# -- Options for manual page output ---------------------------------------
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+    (master_doc, 'mshr', u'mshr Documentation',
+     [author], 1)
+]
+
+# If true, show URL addresses after external links.
+#man_show_urls = False
+
+
+# -- Options for Texinfo output -------------------------------------------
+
+# Grouping the document tree into Texinfo files. List of tuples
+# (source start file, target name, title, author,
+#  dir menu entry, description, category)
+texinfo_documents = [
+    (master_doc, 'mshr', u'mshr Documentation',
+     author, 'mshr', 'One line description of project.',
+     'Miscellaneous'),
+]
+
+# Documents to append as an appendix to all manuals.
+#texinfo_appendices = []
+
+# If false, no module index is generated.
+#texinfo_domain_indices = True
+
+# How to display URL addresses: 'footnote', 'no', or 'inline'.
+#texinfo_show_urls = 'footnote'
+
+# If true, do not generate a @detailmenu in the "Top" node's menu.
+#texinfo_no_detailmenu = False
diff --git a/doc/sphinx/source/index.rst b/doc/sphinx/source/index.rst
new file mode 100644
index 0000000..5426fb1
--- /dev/null
+++ b/doc/sphinx/source/index.rst
@@ -0,0 +1,24 @@
+.. mshr documentation master file, created by
+   sphinx-quickstart on Thu Aug 11 13:48:10 2016.
+   You can adapt this file completely to your liking, but it should at least
+   contain the root `toctree` directive.
+
+Welcome to mshr's documentation!
+================================
+
+Testing
+
+Contents:
+
+.. toctree::
+   :maxdepth: 2
+
+
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
+
diff --git a/include/mshr/ASCFileReader.h b/include/mshr/ASCFileReader.h
new file mode 100755
index 0000000..6643955
--- /dev/null
+++ b/include/mshr/ASCFileReader.h
@@ -0,0 +1,47 @@
+// Copyright (C) 2016 Lars Magnus Valnes
+//
+// This file is part of mshr.
+//
+// mshr is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+// 
+// mshr is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with mshr.  If not, see <http://www.gnu.org/licenses/>.
+//
+
+#ifndef __ASC_FILE_READER_H // ??
+#define __ASC_FILE_READER_H // ?? 
+
+#include <string>
+#include <vector>
+#include <array>
+
+namespace mshr
+{
+
+class ASCFileReader
+{
+ public:
+  /// @brief Read and parse a triangular 3d surface off file
+  /// @param filename The file to read
+  /// @param vertices A vector of points to be read into
+  /// @param facets A vector of facets given as indices to the vertex array.
+  static void read(const std::string filename, 
+                   std::vector<std::array<double, 3> >& vertices,
+                   std::vector<std::array<std::size_t, 3> >& facets);
+
+  static void write(const std::string filename,
+                    const std::vector<std::array<double, 3> >& vertices,
+                    const std::vector<std::array<std::size_t, 3> >& facets);
+
+};
+
+}
+#endif
diff --git a/include/mshr/CSGCGALDomain2D.h b/include/mshr/CSGCGALDomain2D.h
index 54312cf..ba3f2a8 100644
--- a/include/mshr/CSGCGALDomain2D.h
+++ b/include/mshr/CSGCGALDomain2D.h
@@ -41,7 +41,10 @@ class CSGCGALDomain2D : public dolfin::Variable
   CSGCGALDomain2D();
 
   /// @brief Construct polygon from Dolfin CSG geometry
-  CSGCGALDomain2D(const mshr::CSGGeometry *csg);
+  CSGCGALDomain2D(
+      std::shared_ptr<const CSGGeometry> geometry,
+      double segment_granularity=0.1
+      );
 
   /// @brief Destructor
   ~CSGCGALDomain2D();
diff --git a/include/mshr/CSGCGALDomain3D.h b/include/mshr/CSGCGALDomain3D.h
index badbef3..0557b59 100644
--- a/include/mshr/CSGCGALDomain3D.h
+++ b/include/mshr/CSGCGALDomain3D.h
@@ -52,7 +52,7 @@ class CSGCGALDomain3D : public CSGPrimitive3D
   CSGCGALDomain3D();
 
   /// @brief Construct polyhedron from CSG geometry
-  CSGCGALDomain3D(const mshr::CSGGeometry &csg);
+  CSGCGALDomain3D(std::shared_ptr<const mshr::CSGGeometry> csg);
 
   CSGCGALDomain3D(const std::vector<std::array<double, 3>>& vertices,
                   const std::vector<std::array<std::size_t, 3>>& facets);
@@ -85,8 +85,10 @@ class CSGCGALDomain3D : public CSGPrimitive3D
   /// @brief Count the number of degenerate facets wrt. the given tolerance
   std::size_t num_degenerate_facets(double threshold) const;
 
+  std::pair<double, double> facet_area_minmax() const;
+
   /// @brief get length of shortest edge
-  double shortest_edge() const;
+  std::pair<double, double> edge_length_range() const;
 
   /// @brief count edges with squared length shorter than tolerance
   std::size_t num_short_edges(double tolerance) const;
@@ -96,10 +98,14 @@ class CSGCGALDomain3D : public CSGPrimitive3D
 
   std::size_t remove_selfintersections();
 
+  void normalize();
+
   /// @brief Save polyhedron to off file
   /// @param filename Filename to write to
   void save_off(std::string filename) const;
 
+  void save(std::string filename) const;
+
   // TODO: Define iterators to be more memory friendly
 
   /// @brief Output vertices in double precision
@@ -113,7 +119,7 @@ class CSGCGALDomain3D : public CSGPrimitive3D
   /// @param holes the returned points
   /// @param q a query structure returned from get_query_structure()
   void get_points_in_holes(std::vector<dolfin::Point>& holes,
-                           std::shared_ptr<CSGCGALDomain3DQueryStructure> q) const;
+                           std::shared_ptr<CSGCGALDomain3DQueryStructure> q=std::shared_ptr<CSGCGALDomain3DQueryStructure>()) const;
 
   /// @brief Attempt to remove degenerate facets.
   void remove_degenerate_facets(double tolerance);
@@ -146,7 +152,7 @@ class CSGCGALDomain3D : public CSGPrimitive3D
   /// point
   void filter_facets(dolfin::Point start,
                      double threshold,
-                     std::shared_ptr<CSGCGALDomain3DQueryStructure> q);
+                     std::shared_ptr<CSGCGALDomain3DQueryStructure> q=std::shared_ptr<CSGCGALDomain3DQueryStructure>());
 
   void inside_out();
 
@@ -169,7 +175,9 @@ class CSGCGALDomain3D : public CSGPrimitive3D
   void close_holes();
 
   /// @brief Close and triangulate hole. Experimental.
-  void close_hole(std::size_t hole);
+  bool close_hole(std::size_t hole, std::string method="auto");
+
+  void list_hole(std::size_t hole) const;
 
   double sharpest_edge() const;
   std::size_t num_sharp_edges(double tolerance) const;
@@ -185,7 +193,11 @@ class CSGCGALDomain3D : public CSGPrimitive3D
   void refine_edge_split();
 
   // @brief Reconstruct surface from point set. Experimental
-  std::shared_ptr<CSGCGALDomain3D> reconstruct_surface() const;
+  std::shared_ptr<CSGCGALDomain3D> reconstruct_surface(double expansion=0.0) const;
+
+  // @brief Isotropic remeshing. Experimental
+  std::shared_ptr<CSGCGALDomain3D> remesh_surface(double edge_length,
+                                                  double sharp_edge_tolerance=60) const;
 
   /// @brief Return convex hull of vertices as CSGCGALDomain3D object. Experimental
   std::shared_ptr<CSGCGALDomain3D> convex_hull() const;
diff --git a/include/mshr/CSGCGALMeshGenerator2D.h b/include/mshr/CSGCGALMeshGenerator2D.h
index 4cd0c0f..24cdc9a 100644
--- a/include/mshr/CSGCGALMeshGenerator2D.h
+++ b/include/mshr/CSGCGALMeshGenerator2D.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2012 Benjamin Kehlet
+// Copyright (C) 2012-2016 Benjamin Kehlet
 //
 // This file is part of mshr.
 //
@@ -6,12 +6,12 @@
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 3 of the License, or
 // (at your option) any later version.
-// 
+//
 // mshr is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with mshr.  If not, see <http://www.gnu.org/licenses/>.
 //
@@ -22,15 +22,17 @@
 
 #include <dolfin/common/Variable.h>
 
+#include <vector>
+#include <memory>
+
 // Forward declaration
 namespace dolfin{ class Mesh; }
 
 namespace mshr
 {
 
-  // Forward declarations
-
-  class CSGGeometry;
+  // Forward declaration
+  class CSGCGALDomain2D;
 
   /// @brief Mesh generator for Constructive Solid Geometry (CSG)
   /// utilizing CGALs 2D Regularized Boolean Set-Operations
@@ -50,9 +52,9 @@ namespace mshr
     /// @param partition (experimental) If true then generate mesh on process 0 and partition and distribute
     ///   it. If false, then a full mesh is generated on all processes.(only
     ///   relevant when running in parallel)
-    void generate(const CSGGeometry& geometry,
-                  dolfin::Mesh& mesh,
-                  bool partition=true);
+    std::shared_ptr<dolfin::Mesh> generate(std::shared_ptr<const CSGCGALDomain2D> domain,
+                                           const std::vector<std::pair<std::size_t, std::shared_ptr<const CSGCGALDomain2D>>>& subdomains
+                                           = std::vector<std::pair<std::size_t, std::shared_ptr<const CSGCGALDomain2D>>>());
 
     /// Default parameter values
     static dolfin::Parameters default_parameters()
@@ -61,11 +63,11 @@ namespace mshr
       p.add("mesh_resolution", 64.0);
       p.add("triangle_shape_bound", 0.125);
       p.add("cell_size", 0.25);
-
-      p.add("pixel_size", 1e-16);
+      p.add("lloyd_optimize", false);
 
       // shorter edges in the domain will be collapsed before meshing
       p.add("edge_truncate_tolerance", 1e-16);
+      p.add("partition", true);
 
       return p;
     }
diff --git a/include/mshr/CSGGeometry.h b/include/mshr/CSGGeometry.h
index ca497ff..1c59df0 100644
--- a/include/mshr/CSGGeometry.h
+++ b/include/mshr/CSGGeometry.h
@@ -64,7 +64,7 @@ namespace mshr
     bool has_subdomains() const;
 
     /// @brief Return const list of subdomain geometries
-    const std::list<std::pair<std::size_t, std::shared_ptr<const CSGGeometry> > >& get_subdomains() const { return subdomains; }
+    const std::list<std::pair<std::size_t, std::shared_ptr<const CSGGeometry>>>& get_subdomains() const { return subdomains; }
 
     enum Type { Box,
                 Sphere,
diff --git a/include/mshr/CSGPrimitives2D.h b/include/mshr/CSGPrimitives2D.h
index 7b269a8..6496bc9 100644
--- a/include/mshr/CSGPrimitives2D.h
+++ b/include/mshr/CSGPrimitives2D.h
@@ -6,12 +6,12 @@
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 3 of the License, or
 // (at your option) any later version.
-// 
+//
 // mshr is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with mshr.  If not, see <http://www.gnu.org/licenses/>.
 //
@@ -54,7 +54,7 @@ namespace mshr
     /// @param c center.
     /// @param r radius.
     /// @param segments number of segments when computing the polygonal approximation
-    Circle(dolfin::Point c, double r, std::size_t segments=32);
+    Circle(dolfin::Point c, double r, std::size_t segments=0);
 
     /// @brief get informal string representation
     /// @param verbose  Verbosity level
@@ -91,7 +91,7 @@ namespace mshr
     /// @param a        the horizontal semi-axis
     /// @param b        the vertical semi-axis
     /// @param segments the resolution when computing polygonal approximation
-    Ellipse(dolfin::Point c, double a, double b, std::size_t segments=32);
+    Ellipse(dolfin::Point c, double a, double b, std::size_t segments=0);
 
     /// @brief get informal string representation
     /// @param verbose  Verbosity level
@@ -155,7 +155,7 @@ namespace mshr
 
     /// @brief Create polygon defined by the given vertices. Vertices must be in counter-clockwise order and free of self-intersections.
     ///
-    /// @param vertices A vector of dolfin::Points. Vertices are copied into the object. 
+    /// @param vertices A vector of dolfin::Points. Vertices are copied into the object.
     Polygon(const std::vector<dolfin::Point>& vertices);
 
     /// @brief get informal string representation
diff --git a/include/mshr/DolfinMeshUtils.h b/include/mshr/DolfinMeshUtils.h
index 2992cd1..0029841 100644
--- a/include/mshr/DolfinMeshUtils.h
+++ b/include/mshr/DolfinMeshUtils.h
@@ -46,9 +46,20 @@ class DolfinMeshUtils
     extract_subdomain(std::shared_ptr<const dolfin::Mesh>,
                       std::size_t cell_domain);
 
+  /// @brief Glue together two meshes by matching boundary vertices.
+  /// @param m1 Mesh 1 to merge
+  /// @param m2 Mesh 2 to merge
+  /// @param m1_boundary_marker Mark boundary facets the belongs to m1. A value < 0 disables marking.
+  /// @param m1_boundary_marker Mark boundary facets the belongs to m2. A value < 0 disables marking.
+  /// @param m1_boundary_marker Mark boundary facets the belongs to the interface between m1 an m2. A value < 0 disables marking.
   static std::shared_ptr<dolfin::Mesh>
     merge_meshes(std::shared_ptr<dolfin::Mesh> m1,
-                 std::shared_ptr<dolfin::Mesh> m2);
+                 std::shared_ptr<dolfin::Mesh> m2,
+                 int m1_marker=1,
+                 int m2_marker=2,
+                 int m1_boundary_marker=1,
+                 int m2_boundary_marker=2,
+                 int interface_marker=3);
 };
 
 }
diff --git a/include/mshr/MeshGenerator.h b/include/mshr/MeshGenerator.h
index c453ce6..7cf3c87 100644
--- a/include/mshr/MeshGenerator.h
+++ b/include/mshr/MeshGenerator.h
@@ -33,7 +33,7 @@ namespace mshr
 
   /// Generate mesh from CSG geometry
   std::shared_ptr<dolfin::Mesh>
-    generate_mesh(const CSGGeometry& geometry,
+    generate_mesh(std::shared_ptr<const CSGGeometry> geometry,
                   double resolution,
                   std::string backend="cgal");
 }
diff --git a/include/mshr/STLFileReader.h b/include/mshr/STLFileReader.h
index f605c42..0a00ee5 100644
--- a/include/mshr/STLFileReader.h
+++ b/include/mshr/STLFileReader.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2014 Benjamin Kehlet
+// Copyright (C) 2014 Benjamin Kehlet & 2016 Lars Magnus Valnes
 //
 // This file is part of mshr.
 //
@@ -39,6 +39,9 @@ public:
   static void read(const std::string filename, 
                    std::vector<std::array<double, 3> >& vertices,
                    std::vector<std::array<std::size_t, 3> >& facets);
+  static void write(const std::string filename, 
+                   std::vector<std::array<double, 3> >& vertices,
+                   std::vector<std::array<std::size_t, 3> >& facets);
 };
 
 }
diff --git a/include/mshr/SurfaceConsistency.h b/include/mshr/SurfaceConsistency.h
index f57c590..285a153 100644
--- a/include/mshr/SurfaceConsistency.h
+++ b/include/mshr/SurfaceConsistency.h
@@ -51,8 +51,13 @@
                           const std::vector<std::array<double, 3> >& vertices,
                           double tolerance);
 
-  static void orient_component(std::vector<std::array<std::size_t, 3> >& facets,
-                               std::size_t start);
+   static std::size_t remove_null_facets(std::vector<std::array<std::size_t, 3>>& facets);
+
+   static std::size_t remove_isolated_vertices(std::vector<std::array<double, 3>>& vertices,
+                                               std::vector<std::array<std::size_t, 3>>& facets);
+
+   static void orient_component(std::vector<std::array<std::size_t, 3> >& facets,
+                                std::size_t start);
 };
 
 }
diff --git a/include/mshr/SurfaceReconstruction.h b/include/mshr/SurfaceReconstruction.h
index 87d6ca4..4837a0a 100644
--- a/include/mshr/SurfaceReconstruction.h
+++ b/include/mshr/SurfaceReconstruction.h
@@ -30,7 +30,15 @@ namespace mshr
     static void reconstruct(const std::vector<double>& vertices,
                             const std::vector<std::size_t>& facets,
                             std::vector<std::array<double, 3>>& reconstructed_vertices,
-                            std::vector<std::array<std::size_t, 3>>& reconstruct_facets);
+                            std::vector<std::array<std::size_t, 3>>& reconstruct_facets,
+                            double expansion);
+
+    static void remesh(double edge_length,
+                       double sharp_edge_tolerance,
+                       const std::vector<double>& vertices,
+                       const std::vector<std::size_t>& facets,
+                       std::vector<std::array<double, 3>>& remeshed_vertices,
+                       std::vector<std::array<std::size_t, 3>>& remeshed_facets);
   };
 
 }
diff --git a/include/mshr/VTPFileReader.h b/include/mshr/VTPFileReader.h
index 945e819..8966919 100644
--- a/include/mshr/VTPFileReader.h
+++ b/include/mshr/VTPFileReader.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2015 Benjamin Kehlet
+// Copyright (C) 2014-2016 Benjamin Kehlet
 //
 // This file is part of mshr.
 //
@@ -36,6 +36,10 @@ public:
   static void read(const std::string filename, 
                    std::vector<std::array<double, 3> >& vertices,
                    std::vector<std::array<std::size_t, 3> >& facets);
+
+  static void write(const std::string filename, 
+                    const std::vector<std::array<double, 3> >& vertices,
+                    const std::vector<std::array<std::size_t, 3> >& facets);
 };
 
 }
diff --git a/src/ASCFileReader.cpp b/src/ASCFileReader.cpp
new file mode 100755
index 0000000..a1e16b8
--- /dev/null
+++ b/src/ASCFileReader.cpp
@@ -0,0 +1,173 @@
+// Copyright (C) 2016 Lars Magnus Valnes
+//
+// This file is part of mshr.
+//
+// mshr is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// mshr is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with mshr.  If not, see <http://www.gnu.org/licenses/>.
+//
+
+#include <mshr/ASCFileReader.h>
+
+#include <dolfin/geometry/Point.h>
+#include <dolfin/common/constants.h>
+#include <dolfin/log/LogStream.h>
+#include <dolfin/log/log.h>
+
+#define BOOST_FILESYSTEM_NO_DEPRECATED
+#include <boost/filesystem.hpp>
+#include <boost/tokenizer.hpp>
+#include <boost/algorithm/string.hpp>
+
+#include <fstream>
+#include <iostream>
+#include <sstream>
+#include <string>
+#include <algorithm>
+#include <string>
+#include <map>
+
+namespace
+{
+template<typename T>
+inline double convert_string(const std::string& s)
+{
+  std::istringstream is(s);
+  T val;
+  is >> val;
+
+  return val;
+}
+
+// get next line of file and trim away whitespace
+inline void get_next_line(std::ifstream& file, std::string& line, std::size_t &lineno)
+{
+  do
+  {
+    std::getline(file, line);
+    boost::algorithm::trim(line);
+    lineno++;
+  } while ( !file.eof() && line == "");
+}
+} // end anonymous namespace
+//-----------------------------------------------------------------------------
+namespace mshr
+{
+
+void ASCFileReader::read(const std::string filename,
+                         std::vector<std::array<double, 3> >& vertices,
+                         std::vector<std::array<std::size_t, 3> >& facets)
+{
+  dolfin::log(dolfin:: TRACE, "Reading surface from %s ", filename.c_str());
+
+  vertices.clear();
+  facets.clear();
+  typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
+
+  std::ifstream file(filename.c_str());
+  if (!file.is_open())
+  {
+    dolfin::dolfin_error("ASCFileReader.cpp",
+                         "open .asc file to read 3D surface",
+                         "Failed to open file");
+  }
+
+  std::string line;
+  std::size_t lineno = 0;
+  const boost::char_separator<char> sep(" ");
+  const boost::char_separator<char> sep2("  ");
+  
+  get_next_line(file, line, lineno);  
+  // First line is not important
+  get_next_line(file, line, lineno);
+  tokenizer tokens(line, sep); 
+  tokenizer::iterator tok_iter = tokens.begin();
+  const std::size_t num_vertices = convert_string<std::size_t>(*tok_iter);
+  tok_iter++;
+  const std::size_t num_facets   = convert_string<std::size_t>(*tok_iter);
+  tok_iter++;
+  dolfin_assert(tok_iter == tokens.end());
+
+  vertices.reserve(num_vertices);
+  facets.reserve(num_facets);
+
+  get_next_line(file, line, lineno);   
+  for (std::size_t i = 0; i < num_vertices; i++)
+  {
+    tokenizer tokens(line, sep2);
+    tokenizer::iterator tok_iter = tokens.begin();
+
+    std::array<double, 3> vertex;
+    vertex[0] = convert_string<double>(*tok_iter);
+    tok_iter++;
+    vertex[1] = convert_string<double>(*tok_iter);
+    tok_iter++;
+    vertex[2] = convert_string<double>(*tok_iter);
+    tok_iter++;
+
+    tok_iter++;
+
+    dolfin_assert(tok_iter == tokens.end());
+    vertices.push_back(vertex);
+    get_next_line(file, line, lineno);
+  }
+  for (std::size_t i = 0; i < num_facets; i++)
+  {
+    tokenizer tokens(line, sep);
+    tokenizer::iterator tok_iter = tokens.begin();
+
+    std::array<std::size_t, 3> facet;
+    facet[0] = convert_string<std::size_t>(*tok_iter);
+    tok_iter++;
+    facet[1] = convert_string<std::size_t>(*tok_iter);
+    tok_iter++;
+    facet[2] = convert_string<std::size_t>(*tok_iter);
+    tok_iter++;
+    tok_iter++;
+
+    dolfin_assert(tok_iter == tokens.end());
+
+    facets.push_back(facet);
+    get_next_line(file, line, lineno); 
+
+  }
+  
+}
+//-----------------------------------------------------------------------------
+void ASCFileReader::write(const std::string filename,
+                          const std::vector<std::array<double, 3> >& vertices,
+                          const std::vector<std::array<std::size_t, 3> >& facets)
+{
+  std::ofstream file(filename);
+  file.precision(6);
+
+  if (!file.is_open())
+  {
+    dolfin::dolfin_error("ASCFileReader.cpp",
+                         "open file to write asc data",
+                         "Failed to open file");
+  }
+
+  file << "#!" <<  std::endl;
+  file << vertices.size() << " " << facets.size() << std::endl;
+	// Orded vertices
+  for (const std::array<double, 3>& v : vertices)
+  {
+    file << v[0] << "  " << v[1] << "  " << v[2] << "  " << 0 << std::endl;
+  }
+
+  for (const std::array<std::size_t, 3>& f : facets)
+  {
+    file << f[0] << " " << f[1] << " " << f[2] << " " << 0 <<  std::endl;
+  }
+}
+}
diff --git a/src/CSGCGALDomain2D.cpp b/src/CSGCGALDomain2D.cpp
index 0032975..638efc2 100644
--- a/src/CSGCGALDomain2D.cpp
+++ b/src/CSGCGALDomain2D.cpp
@@ -19,6 +19,7 @@
 // They should idellay have been added via the command line,
 // but since CGAL configure time is at mshr compile time, we don't
 // have access to CGALConfig.cmake at configure time...
+#define CGAL_HEADER_ONLY 1
 #include <CGAL/compiler_config.h>
 #include <CGAL/Cartesian.h>
 #include <CGAL/Quotient.h>
@@ -147,7 +148,7 @@ Point_2 point_in_polygon(const Polygon_2& p)
 //-----------------------------------------------------------------------------
 void truncate_short_edges(Polygon_set_2& polygon_set,
                           FT tolerance,
-                          const std::set<Point_2> collapsable_vertices = std::set<Point_2>())
+                          const std::set<Point_2> & collapsable_vertices = std::set<Point_2>())
 {
   const FT tolerance_squared = tolerance*tolerance;
 
@@ -213,18 +214,31 @@ struct CSGCGALDomain2DImpl
   Polygon_set_2 polygon_set;
 
   CSGCGALDomain2DImpl(){}
-  CSGCGALDomain2DImpl(const Polygon_set_2& p)
+  explicit CSGCGALDomain2DImpl(const Polygon_set_2& p)
     : polygon_set(p) {}
 };
 //-----------------------------------------------------------------------------
-Polygon_2 make_circle(const Circle* c)
+Polygon_2 make_circle(
+    const Circle* c,
+    const double segment_granularity
+    )
 {
+  unsigned int num_segments = 0;
+  if (c->segments() > 0) {
+    num_segments = c->segments();
+  } else {
+    dolfin_assert(segment_granularity > 0.0);
+    num_segments = std::round(
+        (2 * DOLFIN_PI * c->radius()) / segment_granularity
+        );
+  }
+
   std::vector<Point_2> pts;
-  pts.reserve(c->segments());
+  pts.reserve(num_segments);
 
-  for (std::size_t i = 0; i < c->segments(); i++)
+  for (std::size_t i = 0; i < num_segments; i++)
   {
-    const double phi = (2*DOLFIN_PI*i) / c->segments();
+    const double phi = (2*DOLFIN_PI*i) / num_segments;
     const double x = c->center().x() + c->radius()*cos(phi);
     const double y = c->center().y() + c->radius()*sin(phi);
     pts.push_back(Point_2(x, y));
@@ -233,13 +247,32 @@ Polygon_2 make_circle(const Circle* c)
   return Polygon_2(pts.begin(), pts.end());
 }
 //-----------------------------------------------------------------------------
-Polygon_2 make_ellipse(const Ellipse* e)
+Polygon_2 make_ellipse(
+    const Ellipse* e,
+    const double segment_granularity
+    )
 {
+  unsigned int num_segments = 0;
+  if (e->segments() > 0) {
+    num_segments = e->segments();
+  } else {
+    dolfin_assert(segment_granularity > 0.0);
+    // https://en.wikipedia.org/wiki/Ellipse#Circumference
+    const double a_min_b = e->a() - e->b();
+    const double a_plus_b = e->a() + e->b();
+    const double h = (a_min_b*a_min_b) / (a_plus_b*a_plus_b);
+    const double arc_length_ellipse_approx = DOLFIN_PI * a_plus_b * (
+        1.0 + 3.0*h / (10 + sqrt(4.0 - 3.0*h))
+        );
+    num_segments = std::round(arc_length_ellipse_approx / segment_granularity);
+  }
+
   std::vector<Point_2> pts;
+  pts.reserve(num_segments);
 
-  for (std::size_t i = 0; i < e->segments(); i++)
+  for (std::size_t i = 0; i < num_segments; i++)
   {
-    const double phi = (2*DOLFIN_PI*i) / e->segments();
+    const double phi = (2*DOLFIN_PI*i) / num_segments;
     const double x = e->center().x() + e->a()*cos(phi);
     const double y = e->center().y() + e->b()*sin(phi);
     pts.push_back(Point_2(x, y));
@@ -314,10 +347,11 @@ CSGCGALDomain2D::~CSGCGALDomain2D()
 {
 }
 //-----------------------------------------------------------------------------
-CSGCGALDomain2D::CSGCGALDomain2D(const CSGGeometry *geometry)
-: impl(new CSGCGALDomain2DImpl)
+CSGCGALDomain2D::CSGCGALDomain2D(
+    std::shared_ptr<const CSGGeometry> geometry,
+    double segment_granularity)
+ : impl(new CSGCGALDomain2DImpl)
 {
-
   if (geometry->dim() != 2)
     dolfin::dolfin_error("CSGCGALDomain2D.cpp",
                          "Creating polygonal domain",
@@ -328,11 +362,11 @@ CSGCGALDomain2D::CSGCGALDomain2D(const CSGGeometry *geometry)
   {
     case CSGGeometry::Union:
     {
-      const CSGUnion *u = dynamic_cast<const CSGUnion*>(geometry);
+      const CSGUnion *u = dynamic_cast<const CSGUnion*>(geometry.get());
       dolfin_assert(u);
 
-      CSGCGALDomain2D a(u->_g0.get());
-      CSGCGALDomain2D b(u->_g1.get());
+      CSGCGALDomain2D a(u->_g0);
+      CSGCGALDomain2D b(u->_g1);
 
       impl.swap(a.impl);
       impl->polygon_set.join(b.impl->polygon_set);
@@ -340,11 +374,11 @@ CSGCGALDomain2D::CSGCGALDomain2D(const CSGGeometry *geometry)
     }
     case CSGGeometry::Intersection:
     {
-      const CSGIntersection* u = dynamic_cast<const CSGIntersection*>(geometry);
+      const CSGIntersection* u = dynamic_cast<const CSGIntersection*>(geometry.get());
       dolfin_assert(u);
 
-      CSGCGALDomain2D a(u->_g0.get());
-      CSGCGALDomain2D b(u->_g1.get());
+      CSGCGALDomain2D a(u->_g0);
+      CSGCGALDomain2D b(u->_g1);
 
       impl.swap(a.impl);
       impl->polygon_set.intersection(b.impl->polygon_set);
@@ -352,10 +386,10 @@ CSGCGALDomain2D::CSGCGALDomain2D(const CSGGeometry *geometry)
     }
     case CSGGeometry::Difference:
     {
-      const CSGDifference* u = dynamic_cast<const CSGDifference*>(geometry);
+      const CSGDifference* u = dynamic_cast<const CSGDifference*>(geometry.get());
       dolfin_assert(u);
-      CSGCGALDomain2D a(u->_g0.get());
-      CSGCGALDomain2D b(u->_g1.get());
+      CSGCGALDomain2D a(u->_g0);
+      CSGCGALDomain2D b(u->_g1);
 
       impl.swap(a.impl);
       impl->polygon_set.difference(b.impl->polygon_set);
@@ -363,9 +397,9 @@ CSGCGALDomain2D::CSGCGALDomain2D(const CSGGeometry *geometry)
     }
     case CSGGeometry::Translation :
     {
-      const CSGTranslation* t = dynamic_cast<const CSGTranslation*>(geometry);
+      const CSGTranslation* t = dynamic_cast<const CSGTranslation*>(geometry.get());
       dolfin_assert(t);
-      CSGCGALDomain2D a(t->g.get());
+      CSGCGALDomain2D a(t->g);
       Exact_Kernel::Aff_transformation_2 translation(CGAL::TRANSLATION, Vector_2(t->t.x(), t->t.y()));
       std::unique_ptr<CSGCGALDomain2DImpl> transformed = do_transformation(a.impl->polygon_set, translation);
       impl.swap(transformed);
@@ -373,9 +407,9 @@ CSGCGALDomain2D::CSGCGALDomain2D(const CSGGeometry *geometry)
     }
     case CSGGeometry::Scaling :
     {
-      const CSGScaling* t = dynamic_cast<const CSGScaling*>(geometry);
+      const CSGScaling* t = dynamic_cast<const CSGScaling*>(geometry.get());
       dolfin_assert(t);
-      CSGCGALDomain2D a(t->g.get());
+      CSGCGALDomain2D a(t->g);
       Exact_Kernel::Aff_transformation_2 tr(CGAL::IDENTITY);
 
       // Translate if requested
@@ -397,9 +431,9 @@ CSGCGALDomain2D::CSGCGALDomain2D(const CSGGeometry *geometry)
     }
     case CSGGeometry::Rotation :
     {
-      const CSGRotation* t = dynamic_cast<const CSGRotation*>(geometry);
+      const CSGRotation* t = dynamic_cast<const CSGRotation*>(geometry.get());
       dolfin_assert(t);
-      CSGCGALDomain2D a(t->g.get());
+      CSGCGALDomain2D a(t->g);
       Exact_Kernel::Aff_transformation_2 tr(CGAL::IDENTITY);
 
       // Translate if requested
@@ -421,28 +455,28 @@ CSGCGALDomain2D::CSGCGALDomain2D(const CSGGeometry *geometry)
     }
     case CSGGeometry::Circle:
     {
-      const Circle* c = dynamic_cast<const Circle*>(geometry);
+      const Circle* c = dynamic_cast<const Circle*>(geometry.get());
       dolfin_assert(c);
-      impl->polygon_set.insert(make_circle(c));
+      impl->polygon_set.insert(make_circle(c, segment_granularity));
       break;
     }
     case CSGGeometry::Ellipse:
     {
-      const Ellipse* c = dynamic_cast<const Ellipse*>(geometry);
+      const Ellipse* c = dynamic_cast<const Ellipse*>(geometry.get());
       dolfin_assert(c);
-      impl->polygon_set.insert(make_ellipse(c));
+      impl->polygon_set.insert(make_ellipse(c, segment_granularity));
       break;
     }
     case CSGGeometry::Rectangle:
     {
-      const Rectangle* r = dynamic_cast<const Rectangle*>(geometry);
+      const Rectangle* r = dynamic_cast<const Rectangle*>(geometry.get());
       dolfin_assert(r);
       impl->polygon_set.insert(make_rectangle(r));
       break;
     }
     case CSGGeometry::Polygon:
     {
-      const Polygon* p = dynamic_cast<const Polygon*>(geometry);
+      const Polygon* p = dynamic_cast<const Polygon*>(geometry.get());
       dolfin_assert(p);
       impl->polygon_set.insert(make_polygon(p));
       break;
@@ -654,7 +688,7 @@ pslg_segment_intersection(Point_2 p,
                           const std::vector<Point_2>& vertices,
                           const std::set<std::pair<std::size_t, std::size_t>>& segments)
 {
-  for (SegmentIterator it = segments.begin(); it != segments.end(); it++)
+  for (SegmentIterator it = segments.begin(); it != segments.end(); ++it)
   {
     const Segment_2 current(vertices[it->first], vertices[it->second]);
     if (CGAL::do_intersect(p, current))
diff --git a/src/CSGCGALDomain3D.cpp b/src/CSGCGALDomain3D.cpp
index 3f5ef45..3ef7742 100644
--- a/src/CSGCGALDomain3D.cpp
+++ b/src/CSGCGALDomain3D.cpp
@@ -15,6 +15,7 @@
 // You should have received a copy of the GNU General Public License
 // along with mshr.  If not, see <http://www.gnu.org/licenses/>.
 
+#define CGAL_HEADER_ONLY 1
 #include <mshr/CSGCGALDomain3D.h>
 #include <mshr/CSGGeometry.h>
 #include <mshr/CSGOperators.h>
@@ -22,6 +23,7 @@
 #include <mshr/STLFileReader.h>
 #include <mshr/VTPFileReader.h>
 #include <mshr/OFFFileReader.h>
+#include <mshr/ASCFileReader.h>
 #include <mshr/SurfaceConsistency.h>
 #include <mshr/CSGCGALDomain2D.h>
 #include <mshr/CSGCGALMeshGenerator2D.h>
@@ -41,7 +43,6 @@
 #include <dolfin/mesh/Vertex.h>
 #include <dolfin/mesh/Cell.h>
 
-
 #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
 #include <CGAL/Polyhedron_incremental_builder_3.h>
 #ifndef MSHR_ENABLE_EXPERIMENTAL
@@ -612,6 +613,10 @@ namespace
           // TODO: Only if vtk is installed
           mshr::VTPFileReader::read(s->_filename, vertices, facets);
         }
+	else if (fpath.extension() == ".asc") // ADDED
+	{
+	mshr::ASCFileReader::read(s->_filename, vertices, facets);
+	}
         else
         {
           dolfin::dolfin_error("CSGCGALDomain3D.cpp",
@@ -622,14 +627,6 @@ namespace
         log(dolfin::TRACE, "Done reading file");
       }
 
-      if (s->debug_dump != "")
-      {
-        log(dolfin::TRACE, "Dumping to file '%s'", s->debug_dump.c_str());
-        mshr::OFFFileReader::write(s->debug_dump,
-                                   vertices,
-                                   facets);
-      }
-
       if (s->flip_facets)
       {
         log(dolfin::TRACE, "Flipping facets");
@@ -651,6 +648,19 @@ namespace
 
       if (s->repair)
       {
+        {
+          const std::size_t removed = mshr::SurfaceConsistency::remove_null_facets(facets);
+          if (removed > 0)
+            log(dolfin::TRACE, "Removed %u degenerate facets", removed);
+        }
+
+        {
+          const std::size_t removed = mshr::SurfaceConsistency::remove_isolated_vertices(vertices, facets);
+          if (removed > 0)
+            log(dolfin::TRACE, "Removed %u isolated vertices", removed);
+        }
+
+
         // TODO: Orient all components
         mshr::SurfaceConsistency::orient_component(facets, 0);
         // std::size_t start_facet = s->first_facet;
@@ -682,6 +692,15 @@ namespace
 
     } // end read from file
 
+    if (s->debug_dump != "")
+    {
+      log(dolfin::TRACE, "Dumping to file '%s'", s->debug_dump.c_str());
+      mshr::OFFFileReader::write(s->debug_dump,
+                                 vertices,
+                                 facets);
+    }
+
+
     // Create the polyhedron
     BuildFromFacetList<Exact_HalfedgeDS> builder(vertices, facets, skip);
     P.delegate(builder);
@@ -818,13 +837,16 @@ namespace
     void operator()(HDS& hds)
     {
       // Let the 2d mesh generator triangulate the polygon
-      dolfin::Mesh mesh2d;
+      std::shared_ptr<dolfin::Mesh> mesh2d(new dolfin::Mesh());
       {
         mshr::CSGCGALMeshGenerator2D generator;
         generator.parameters["mesh_resolution"] = 2.0;
+        generator.parameters["partition"] = false;
 
         // Generate 2D mesh (on all nodes if in parallel)
-        generator.generate(polygon, mesh2d, false);
+        std::shared_ptr<mshr::CSGCGALDomain2D>
+          d2(new mshr::CSGCGALDomain2D(dolfin::reference_to_no_delete_pointer(polygon)));
+        mesh2d = generator.generate(d2);
       }
 
       CGAL::Polyhedron_incremental_builder_3<HDS> builder(hds, true);
@@ -835,7 +857,7 @@ namespace
       const double max_z = std::max(0., z);
 
       // Copy vertices to the new 3d polyhedron
-      const std::vector<double>& vertices = mesh2d.coordinates();
+      const std::vector<double>& vertices = mesh2d->coordinates();
       for (std::size_t i = 0; i < vertices.size()/2; i++)
       {
         builder.add_vertex(Exact_Point_3(vertices[2*i], vertices[2*i+1], min_z));
@@ -843,7 +865,7 @@ namespace
       }
 
       // Add the triangles from the 2d mesh at z=0 and z=z
-      for (dolfin::CellIterator c(mesh2d); !c.end(); ++c)
+      for (dolfin::CellIterator c(*mesh2d); !c.end(); ++c)
       {
         const unsigned int* v_indices = c->entities(0);
         const bool flip = Exact_Triangle_2(Exact_Point_2(vertices[2*v_indices[0]], vertices[2*v_indices[0]+1]),
@@ -880,7 +902,7 @@ namespace
       }
 
       // Connect the two polygons
-      dolfin::BoundaryMesh bdr(mesh2d, "exterior", false);
+      dolfin::BoundaryMesh bdr(*mesh2d, "exterior", false);
       const dolfin::MeshFunction<std::size_t>& vertex_map = bdr.entity_map(0);
       for (dolfin::CellIterator cell(bdr); !cell.end(); ++cell)
       {
@@ -1461,19 +1483,19 @@ namespace
       parameters = default_parameters();
     }
     //-----------------------------------------------------------------------------
-    CSGCGALDomain3D::CSGCGALDomain3D(const mshr::CSGGeometry &csg)
+  CSGCGALDomain3D::CSGCGALDomain3D(std::shared_ptr<const mshr::CSGGeometry> csg)
       : impl(new CSGCGALDomain3DImpl)
     {
       parameters = default_parameters();
 
-      if (csg.dim() != 3)
+      if (csg->dim() != 3)
       {
         dolfin::dolfin_error("CSGCGALDomain3D.cpp",
                              "Creating polyhedral domain",
-                             "Geometry has dimension %d, expected 3", csg.dim());
+                             "Geometry has dimension %d, expected 3", csg->dim());
       }
 
-      convert(csg, impl->p);
+      convert(*csg, impl->p);
 
     }
     //-----------------------------------------------------------------------------
@@ -1577,6 +1599,9 @@ namespace
 
       if (parts.size() > 1)
       {
+        if (!q)
+          q = get_query_structure();
+
         for (std::vector<typename Exact_Polyhedron_3::Vertex_const_handle>::const_iterator it = parts.begin();
              it != parts.end(); it++)
         {
@@ -1742,6 +1767,29 @@ namespace
       return number_of_degenerate_facets(impl->p, threshold);
     }
 //-----------------------------------------------------------------------------
+    std::pair<double, double> CSGCGALDomain3D::facet_area_minmax() const
+    {
+      double smallest_triangle = std::numeric_limits<double>::max();
+      double largest_triangle = 0.;
+      for (auto f = impl->p.facets_begin(); f != impl->p.facets_end(); f++)
+      {
+        auto h = f->halfedge();
+        if (f->is_triangle())
+        {
+          const Exact_Triangle_3 t(h->vertex()->point(),
+                                   h->next()->vertex()->point(),
+                                   h->next()->next()->vertex()->point());
+          const double squared_area = CGAL::to_double(t.squared_area());
+          smallest_triangle = std::min(smallest_triangle,
+                                       squared_area);
+          largest_triangle = std::max(largest_triangle,
+                                      squared_area);
+        }
+      }
+      return std::make_pair(sqrt(smallest_triangle),
+                            sqrt(largest_triangle));
+    }
+  //-----------------------------------------------------------------------------
     void CSGCGALDomain3D::save_off(std::string filename) const
     {
       {
@@ -1782,20 +1830,108 @@ namespace
       outfile.close();
     }
 //-----------------------------------------------------------------------------
-    double CSGCGALDomain3D::shortest_edge() const
-    {
+void CSGCGALDomain3D::save(std::string filename) const
+     { 
+     boost::filesystem::path fpath(filename);
+     if (fpath.extension() == ".off") 
+     {
+	save_off(filename);
+     }	
+     else if  (fpath.extension() == ".asc") 
+     {
+       std::vector<std::array<double, 3>> new_vertices;
+       std::vector<std::array<std::size_t, 3>> new_facets;    
+       std::vector<double> vertices = *get_vertices(); 
+       std::vector<std::size_t> facets = *get_facets();
+       for (std::size_t i = 0; i < vertices.size(); i += 3)
+       {
+         std::array<double, 3> vertex; 
+         vertex[0] = vertices[i];
+         vertex[1] =vertices[i+1];
+         vertex[2] = vertices[i+2];
+         new_vertices.push_back(vertex);
+       }
+       for (std::size_t i = 0; i < facets.size(); i += 3)
+       {
+         std::array<std::size_t, 3> facet;
+         facet[0] = facets[i];
+         facet[1] = facets[i+1];
+         facet[2] = facets[i+2];
+         new_facets.push_back(facet);
+       }
+       mshr::ASCFileReader::write(filename,new_vertices,new_facets);
+     }
+     else if  (fpath.extension() == ".vtp") 
+     {
+       std::vector<std::array<double, 3>> new_vertices;
+       std::vector<std::array<std::size_t, 3>> new_facets;    
+       std::vector<double> vertices = *get_vertices(); 
+       std::vector<std::size_t> facets = *get_facets();
+       for (std::size_t i = 0; i < vertices.size(); i += 3)
+       {
+         std::array<double, 3> vertex; 
+         vertex[0] = vertices[i];
+         vertex[1] =vertices[i+1];
+         vertex[2] = vertices[i+2];
+         new_vertices.push_back(vertex);
+       }
+     for (std::size_t i = 0; i < facets.size(); i += 3)
+     {
+       std::array<std::size_t, 3> facet;
+       facet[0] = facets[i];
+       facet[1] = facets[i+1];
+       facet[2] = facets[i+2];
+       new_facets.push_back(facet);
+     }
+     mshr::VTPFileReader::write(filename,new_vertices,new_facets);
+     }
+     else if (fpath.extension() == ".stl")
+     {
+       std::vector<std::array<double, 3>> new_vertices;
+       std::vector<std::array<std::size_t, 3>> new_facets;    
+       std::vector<double> vertices = *get_vertices(); 
+       std::vector<std::size_t> facets = *get_facets();
+       for (std::size_t i = 0; i < vertices.size(); i += 3)
+       {
+         std::array<double, 3> vertex; 
+         vertex[0] = vertices[i];
+         vertex[1] =vertices[i+1];
+         vertex[2] = vertices[i+2];
+         new_vertices.push_back(vertex);
+       }
+       for (std::size_t i = 0; i < facets.size(); i += 3)
+       {
+         std::array<std::size_t, 3> facet;
+         facet[0] = facets[i];
+         facet[1] = facets[i+1];
+         facet[2] = facets[i+2];
+         new_facets.push_back(facet);
+       }
+       mshr::STLFileReader::write(filename,new_vertices,new_facets);
+     } 
+     else
+     {
+     dolfin::dolfin_error("CSGCGALDomain3D",
+                         "extension to file is not known",
+                         "Failed write file");
+     } 
+    }
+//-----------------------------------------------------------------------------
+  std::pair<double, double> CSGCGALDomain3D::edge_length_range() const
+  {
       Exact_Polyhedron_3::Edge_const_iterator it = impl->p.edges_begin();
-      Exact_Kernel::FT shortest = (it->vertex()->point() - it->opposite()->vertex()->point()).squared_length();
-
+      double shortest = CGAL::to_double((it->vertex()->point() - it->opposite()->vertex()->point()).squared_length());
+      double longest = shortest;
+      it++;
 
       for (; it != impl->p.edges_end(); it++)
       {
-        const Exact_Kernel::FT l = (it->vertex()->point() - it->opposite()->vertex()->point()).squared_length();
-        if (l < shortest)
-          shortest = l;
+        const double l = CGAL::to_double((it->vertex()->point() - it->opposite()->vertex()->point()).squared_length());
+        shortest = std::min(shortest, l);
+        longest = std::max(longest, l);
       }
 
-      return CGAL::to_double(shortest);
+      return std::make_pair(sqrt(shortest), sqrt(longest));
     }
 //-----------------------------------------------------------------------------
     std::size_t CSGCGALDomain3D::num_short_edges(double tolerance) const
@@ -1822,10 +1958,12 @@ namespace
       if (verbose)
       {
         ss << "Volume: " << volume() << std::endl;
-        ss << "Shortest edge: " << shortest_edge() << std::endl;
+        const std::pair<double, double> edge_lengths = edge_length_range();
+        ss << "Edge length range: (" << edge_lengths.first << ", " << edge_lengths.second << ")" << std::endl;
         ss << "Degenerate facets: " << num_degenerate_facets(1e-12) << std::endl;
         ss << "Is inside out:        " << (is_insideout() ? "Yes" : "No") << std::endl;
-        ss << "Is self-intersecting: " << (is_selfintersecting() ? "Yes" : "No");
+        ss << "Is self-intersecting: " << (is_selfintersecting() ? "Yes" : "No") << std::endl;
+        ss << "Is closed:            " << (num_holes() > 0 ? "Yes" : "No");
       }
 
       return ss.str();
@@ -1860,12 +1998,18 @@ namespace
     {
       std::cout << "Filtering facets" << std::endl;
 
+      if (!q)
+        q = get_query_structure();
+
       typedef AABB_Tree::Point_and_primitive_id Point_and_primitive_id;
       typedef Exact_Polyhedron_3::Face_handle Face_handle;
       typedef Exact_Polyhedron_3::Halfedge_handle Halfedge_handle;
       Exact_Point_3 query_point(start[0], start[1], start[2]);
       Point_and_primitive_id pp = q->impl->aabb_tree.closest_point_and_primitive(query_point);
-      std::cout << "Closest point: " << pp.first << std::endl;
+      dolfin::log(dolfin::TRACE, "Closest point: (%f, %f, %f)",
+                  CGAL::to_double(pp.first.x()),
+                  CGAL::to_double(pp.first.y()),
+                  CGAL::to_double(pp.first.z()));
 
       const double cos_threshold = cos(threshold);
 
@@ -1907,7 +2051,7 @@ namespace
         }
       }
 
-      std::cout << "Removing " << to_be_removed.size() << " facets" << std::endl;
+      dolfin::log(dolfin::TRACE, "Removing %d facets", to_be_removed.size());
 
       for (auto fit = to_be_removed.begin(); fit != to_be_removed.end(); fit++)
       {
@@ -1917,6 +2061,73 @@ namespace
       dolfin_assert(impl->p.is_valid());
     }
 //-----------------------------------------------------------------------------
+    // std::shared_ptr<CSGCGALDomain3D> get_component(dolfin::Point p,
+    //                                                std::shared_ptr<CSGCGALDomain3DQueryStructure> qs)
+    // {
+    //   if (!qs)
+    //     qs = get_query_structure();
+
+
+    //   typedef AABB_Tree::Point_and_primitive_id Point_and_primitive_id;
+    //   typedef Exact_Polyhedron_3::Face_handle Face_handle;
+    //   typedef Exact_Polyhedron_3::Halfedge_handle Halfedge_handle;
+    //   Exact_Point_3 query_point(start[0], start[1], start[2]);
+    //   Point_and_primitive_id pp = q->impl->aabb_tree.closest_point_and_primitive(query_point);
+    //   dolfin::log(dolfin::TRACE, "Closest point: %s", dolfin::Point(CGAL::double(pp.first[0])),
+    //                                                   dolfin::Point(CGAL::to_double(pp.first[1])),
+    //                                                   dolfin::Point(CGAL::to_double(pp.first[2])));
+
+    //   const double cos_threshold = cos(threshold);
+
+    //   std::set<Face_handle> to_be_removed;
+    //   {
+    //     std::deque<Face_handle> queue;
+    //     queue.push_back(pp.second);
+
+    //     while (!queue.empty())
+    //     {
+    //       Face_handle f = queue.front();
+    //       queue.pop_front();
+
+    //       if (to_be_removed.count(f) > 0)
+    //         continue;
+
+    //       to_be_removed.insert(f);
+
+    //       const Halfedge_handle start = f->halfedge();
+    //       Halfedge_handle c = start;
+    //       const Exact_Triangle_3 f_triangle = PolyhedronUtils::get_facet_triangle<Exact_Polyhedron_3>(f->halfedge());
+    //       do
+    //       {
+    //         Halfedge_handle current = c;
+    //         c = c->next();
+
+    //         if (current->is_border_edge())
+    //           continue;
+
+    //         Face_handle f2 = current->opposite()->facet();
+    //         if (PolyhedronUtils::get_triangle_cos_angle<Exact_Triangle_3>(f_triangle,
+    //                                                                       PolyhedronUtils::get_facet_triangle<Exact_Polyhedron_3>(f2->halfedge())) > cos_threshold &&
+    //             to_be_removed.count(f2) == 0)
+    //         {
+    //           queue.push_back(f2);
+    //         }
+
+    //       } while (c != start);
+    //     }
+    //   }
+
+    //   std::cout << "Removing " << to_be_removed.size() << " facets" << std::endl;
+
+    //   for (auto fit = to_be_removed.begin(); fit != to_be_removed.end(); fit++)
+    //   {
+    //     impl->p.erase_facet((*fit)->halfedge());
+    //   }
+
+    //   dolfin_assert(impl->p.is_valid());
+
+    // }
+//-----------------------------------------------------------------------------
     void CSGCGALDomain3D::inside_out()
     {
       dolfin_assert(impl->p.is_valid());
@@ -1933,7 +2144,7 @@ namespace
       return holes.size();
     }
     //-----------------------------------------------------------------------------
-    void CSGCGALDomain3D::close_hole(std::size_t hole)
+    bool CSGCGALDomain3D::close_hole(std::size_t hole, std::string method)
     {
       dolfin::warning("Hole closing is an experimental feature");
       dolfin_assert(impl->p.is_valid(false, 0));
@@ -1941,14 +2152,44 @@ namespace
 
       const std::vector<Exact_Polyhedron_3::Halfedge_handle> holes = PolyhedronUtils::get_holes(impl->p);
 
-      PolyhedronUtils::close_hole(impl->p,
-                                  holes[hole]);
-      impl->p.normalize_border();
+      if (method == "auto")
+        PolyhedronUtils::close_hole(impl->p,
+                                    holes[hole]);
+      else if (method == "planar")
+      {
+        const bool res = PolyhedronUtils::triangulate_polygon_3d(impl->p,
+                                                                 holes[hole],
+                                                                 false);
 
-      dolfin_assert(impl->p.is_valid(false, 0));
-      dolfin_assert(impl->p.is_pure_triangle());
+        dolfin_assert(impl->p.is_valid(false, 0));
+        //dolfin_assert(impl->p.is_pure_triangle());
+        impl->p.normalize_border();
+        return res;
+      }
+      else if (method == "split")
+      {
+        const bool res = PolyhedronUtils::split_hole_planar(impl->p, holes[hole]);
+        dolfin_assert(impl->p.is_valid(false, 0));
+        //dolfin_assert(impl->p.is_pure_triangle());
+        impl->p.normalize_border();
+        return res;
+      }
+      else
+      {
+        dolfin::dolfin_error("CSGCGALDomain3D.cpp",
+                             "triangulate hole",
+                             "Unknown hole closing method");
+        return false;
+      }
+      return true;
     }
     //-----------------------------------------------------------------------------
+  void CSGCGALDomain3D::list_hole(std::size_t hole) const
+  {
+      const std::vector<Exact_Polyhedron_3::Halfedge_handle> holes = PolyhedronUtils::get_holes(impl->p);
+      PolyhedronUtils::list_hole<Exact_Polyhedron_3>(holes[hole]);
+  }
+  //-----------------------------------------------------------------------------
     void CSGCGALDomain3D::close_holes()
     {
       dolfin::warning("Hole closing is an experimental feature");
@@ -1970,7 +2211,7 @@ namespace
       dolfin_assert(impl->p.is_closed());
     }
   //-----------------------------------------------------------------------------
-  std::shared_ptr<CSGCGALDomain3D> CSGCGALDomain3D::reconstruct_surface() const
+  std::shared_ptr<CSGCGALDomain3D> CSGCGALDomain3D::reconstruct_surface(double expansion) const
   {
     std::vector<std::array<double, 3>> new_vertices;
     std::vector<std::array<std::size_t, 3>> new_facets;
@@ -1979,19 +2220,87 @@ namespace
       std::unique_ptr<const std::vector<double>> vertices = get_vertices();
       std::unique_ptr<const std::vector<std::size_t>> facets = get_facets();
 
-      SurfaceReconstruction::reconstruct(*vertices, *facets,
-                                         new_vertices, new_facets);
+      SurfaceReconstruction::reconstruct(*vertices,
+                                         *facets,
+                                         new_vertices,
+                                         new_facets,
+                                         expansion);
     }
 
     return std::shared_ptr<CSGCGALDomain3D>(new CSGCGALDomain3D(new_vertices,
                                                                 new_facets));
   }
   //-----------------------------------------------------------------------------
+  std::shared_ptr<CSGCGALDomain3D> CSGCGALDomain3D::remesh_surface(double edge_length,
+                                                                   double sharp_edge_tolerance) const
+  {
+    std::vector<std::array<double, 3>> remeshed_vertices;
+    std::vector<std::array<std::size_t, 3>> remeshed_facets;
+
+    std::unique_ptr<std::vector<double>> vertices = get_vertices();
+    std::unique_ptr<std::vector<std::size_t>> facets = get_facets();
+
+    SurfaceReconstruction::remesh(edge_length,
+                                  sharp_edge_tolerance,
+                                  *vertices,
+                                  *facets,
+                                  remeshed_vertices,
+                                  remeshed_facets);
+    return std::shared_ptr<CSGCGALDomain3D>(new CSGCGALDomain3D(remeshed_vertices,
+                                                                remeshed_facets));
+  }
+  //-----------------------------------------------------------------------------
   std::size_t CSGCGALDomain3D::remove_selfintersections()
   {
     return PolyhedronUtils::remove_self_intersections(impl->p);
   }
   //-----------------------------------------------------------------------------
+  void CSGCGALDomain3D::normalize()
+  {
+    typedef typename Exact_Polyhedron_3::Vertex_iterator Vertex_iterator;
+    typedef typename Exact_Kernel::Aff_transformation_3 Aff_transformation_3;
+
+    if (impl->p.size_of_vertices() > 0)
+    {
+      Vertex_iterator v = impl->p.vertices_begin();
+      const Vertex_iterator end = impl->p.vertices_end();
+      CGAL::Bbox_3 bbox = v->point().bbox();
+      v++;
+
+      for (; v != end; v++)
+      {
+        bbox += v->point().bbox();
+      }
+
+      std::cout << "Bounding box: " << bbox << std::endl;
+      const Exact_Point_3 mid((bbox.xmax()+bbox.xmin())/2,
+                              (bbox.ymax()+bbox.ymin())/2,
+                              (bbox.zmax()+bbox.zmin())/2);
+      std::cout << "Mid point: " << mid << std::endl;
+      const Exact_Vector_3 translation = CGAL::ORIGIN-mid;
+      const Exact_Kernel::RT scaling = std::max(std::max(bbox.xmax()-bbox.xmin(),
+                                                         bbox.ymax()-bbox.ymin()),
+                                                bbox.zmax()-bbox.zmin());
+
+      std::cout << "Scaling: " << scaling << std::endl;
+
+      const Aff_transformation_3 t(CGAL::Translation(), translation);
+      const Aff_transformation_3 s(CGAL::Scaling(), 2/scaling);
+      const Aff_transformation_3 transform = s*t;
+
+      CGAL::Bbox_3 new_bbox = Exact_Point_3(0,0,0).bbox();
+
+      for (Vertex_iterator v = impl->p.vertices_begin(); v != end; v++)
+      {
+        //v->point() = v->point() + translation;
+        v->point() = transform.transform(v->point());
+        new_bbox += v->point().bbox();
+      }
+
+      std::cout << "New bbox: " << new_bbox << std::endl;
+    }
+  }
+  //-----------------------------------------------------------------------------
   void CSGCGALDomain3D::smooth_taubin(std::size_t iterations)
   {
     for (std::size_t i = 0; i < iterations; i++)
@@ -2051,3 +2360,4 @@ namespace
   }
   //-----------------------------------------------------------------------------
 } // end namespace mshr
+
diff --git a/src/CSGCGALMeshGenerator2D.cpp b/src/CSGCGALMeshGenerator2D.cpp
index c7757b5..6716966 100644
--- a/src/CSGCGALMeshGenerator2D.cpp
+++ b/src/CSGCGALMeshGenerator2D.cpp
@@ -21,6 +21,7 @@
 #include <limits>
 #include <fstream>
 
+#define CGAL_HEADER_ONLY 1
 #include <CGAL/compiler_config.h>
 #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
 #include <CGAL/Triangulation_vertex_base_with_info_2.h>
@@ -28,7 +29,9 @@
 #include <CGAL/Triangulation_face_base_with_info_2.h>
 #include <CGAL/Delaunay_mesher_2.h>
 #include <CGAL/Delaunay_mesh_face_base_2.h>
+#include <CGAL/Delaunay_mesh_vertex_base_2.h>
 #include <CGAL/Delaunay_mesh_size_criteria_2.h>
+#include <CGAL/lloyd_optimize_mesh_2.h>
 
 #include <dolfin/common/constants.h>
 #include <dolfin/common/MPI.h>
@@ -49,7 +52,7 @@
 
 
 typedef CGAL::Exact_predicates_inexact_constructions_kernel             Inexact_Kernel;
-typedef CGAL::Triangulation_vertex_base_2<Inexact_Kernel>               Vertex_base;
+typedef CGAL::Delaunay_mesh_vertex_base_2<Inexact_Kernel>               Vertex_base;
 typedef CGAL::Delaunay_mesh_face_base_2<Inexact_Kernel>                 Face_base;
 typedef CGAL::Triangulation_data_structure_2<Vertex_base, Face_base>    TDS;
 typedef CGAL::Constrained_Delaunay_triangulation_2<Inexact_Kernel, TDS> CDT;
@@ -181,43 +184,53 @@ double shortest_constrained_edge(const CDT &cdt)
   return min_length;
 }
 //-----------------------------------------------------------------------------
-void CSGCGALMeshGenerator2D::generate(const CSGGeometry& geometry,
-                                      dolfin::Mesh& mesh,
-                                      bool partition)
+std::shared_ptr<dolfin::Mesh> CSGCGALMeshGenerator2D::generate(const std::shared_ptr<const CSGCGALDomain2D> total_domain,
+                                                               const std::vector<std::pair<std::size_t,
+                                                                                           std::shared_ptr<const CSGCGALDomain2D>>>& subdomains)
 {
+  const bool partition = parameters["partition"];
+
+  std::shared_ptr<dolfin::Mesh> mesh(new dolfin::Mesh);
+
   // Note that if not in parallel (ie. size() == 0)
   // then both receiver and broadcaster will return false
   // If not partition, then generate the mesh on all processes
-  if (!partition || !dolfin::MPI::is_receiver(mesh.mpi_comm()))
+  if (!partition || !dolfin::MPI::is_receiver(mesh->mpi_comm()))
   {
+    double cell_size;
+    {
+      const double mesh_resolution = parameters["mesh_resolution"];
+      if (mesh_resolution > 0)
+      {
+        const double min_radius = total_domain->compute_boundingcircle_radius();
+        cell_size = 2.0*min_radius/mesh_resolution;
+      }
+      else
+        cell_size = parameters["cell_size"];
+    }
 
     std::vector<std::pair<std::size_t, CSGCGALDomain2D> >
       subdomain_geometries;
 
     log(dolfin::TRACE, "Converting geometry to CGAL polygon");
-    CSGCGALDomain2D total_domain(&geometry);
 
     // Empty polygon, will be populated when traversing the subdomains
     CSGCGALDomain2D overlaying;
 
-
     // Add the subdomains to the PSLG. Traverse in reverse order to get the latest
     // added subdomain on top
     std::list<std::pair<std::size_t, std::shared_ptr<const CSGGeometry> > >::const_reverse_iterator it;
 
-    if (!geometry.get_subdomains().empty())
+    if (!subdomains.empty())
       log(dolfin::TRACE, "Processing subdomains");
 
-    for (it = geometry.get_subdomains().rbegin(); it != geometry.get_subdomains().rend();
-         ++it)
+    for (const std::pair<std::size_t, std::shared_ptr<const CSGCGALDomain2D>>& current_subdomain : subdomains)
     {
-      const std::size_t current_index = it->first;
-      std::shared_ptr<const CSGGeometry> current_subdomain = it->second;
-
-      CSGCGALDomain2D cgal_geometry(current_subdomain.get());
+      const std::size_t current_index = current_subdomain.first;
+      CSGCGALDomain2D cgal_geometry = *current_subdomain.second;
 
       // Only the part inside the total domain
-      cgal_geometry.intersect_inplace(total_domain, 1e-15);
+      cgal_geometry.intersect_inplace(*total_domain, 1e-15);
 
       // Only the part outside overlaying subdomains
       cgal_geometry.difference_inplace(overlaying);
@@ -228,29 +241,12 @@ void CSGCGALMeshGenerator2D::generate(const CSGGeometry& geometry,
       overlaying.join_inplace(cgal_geometry);
     }
 
-    CSGCGALDomain2D remaining(total_domain);
+    CSGCGALDomain2D remaining(*total_domain);
     remaining.difference_inplace(overlaying);
 
     subdomain_geometries.push_back(std::make_pair(0, remaining));
 
-    // Compute cell size
-    double cell_size;
-    const double mesh_resolution = parameters["mesh_resolution"];
-    if (mesh_resolution > 0)
-    {
-      const double min_radius = total_domain.compute_boundingcircle_radius();
-      cell_size = 2.0*min_radius/mesh_resolution;
-    }
-    else
-    {
-      cell_size = parameters["cell_size"];
-    }
-
-    log(dolfin::TRACE, "Request cell size: %f", cell_size);
-
-    std::pair<std::vector<dolfin::Point>,
-              std::vector<std::pair<std::size_t, std::size_t>>> pslg =
-      CSGCGALDomain2D::compute_pslg(subdomain_geometries);
+    const auto pslg = CSGCGALDomain2D::compute_pslg(subdomain_geometries);
 
 
     // for (dolfin::Point p : pslg.first)
@@ -296,7 +292,7 @@ void CSGCGALMeshGenerator2D::generate(const CSGGeometry& geometry,
 
     // Add seeds for all faces in the total domain
     std::vector<dolfin::Point> hole_points;
-    total_domain.get_points_in_holes(hole_points);
+    total_domain->get_points_in_holes(hole_points);
     std::vector<Point_2> seed_points;
     for (dolfin::Point p : hole_points)
       seed_points.push_back(Point_2(p.x(), p.y()));
@@ -311,6 +307,12 @@ void CSGCGALMeshGenerator2D::generate(const CSGGeometry& geometry,
     // Refine CGAL mesh/triangulation
     mesher.refine_mesh();
 
+    // Lloyd optimization
+    if (parameters["lloyd_optimize"]) {
+      log(dolfin::TRACE, "Optimizing mesh by Lloyd smoothing");
+      CGAL::lloyd_optimize_mesh_2(cdt);
+    }
+
     // Make sure triangulation is valid
     dolfin_assert(cdt.is_valid());
 
@@ -318,7 +320,7 @@ void CSGCGALMeshGenerator2D::generate(const CSGGeometry& geometry,
     log(dolfin::TRACE, "Exploring subdomains in mesh");
 
     std::map<Face_handle, unsigned int> subdomain_map =
-      explore_subdomains(cdt, total_domain, subdomain_geometries);
+      explore_subdomains(cdt, *total_domain, subdomain_geometries);
 
     // Clear mesh
     // This function has been removed from dolfin.
@@ -344,7 +346,7 @@ void CSGCGALMeshGenerator2D::generate(const CSGGeometry& geometry,
 
     // Create a MeshEditor and open
     dolfin::MeshEditor mesh_editor;
-    mesh_editor.open(mesh, tdim, gdim);
+    mesh_editor.open(*mesh, tdim, gdim);
     mesh_editor.init_vertices(num_vertices);
     mesh_editor.init_cells(num_cells);
 
@@ -370,9 +372,9 @@ void CSGCGALMeshGenerator2D::generate(const CSGGeometry& geometry,
     dolfin_assert(vertex_index == num_vertices);
 
     // Add cells to mesh and build domain marker mesh function
-    dolfin::MeshDomains &domain_markers = mesh.domains();
+    dolfin::MeshDomains &domain_markers = mesh->domains();
     std::size_t cell_index = 0;
-    const bool mark_cells = geometry.has_subdomains();
+    const bool mark_cells = !subdomains.empty();
     for (CDT::Finite_faces_iterator cgal_cell = cdt.finite_faces_begin();
          cgal_cell != cdt.finite_faces_end(); ++cgal_cell)
     {
@@ -400,7 +402,9 @@ void CSGCGALMeshGenerator2D::generate(const CSGGeometry& geometry,
 
   // Distribute the mesh (if in parallel)
   if (partition)
-    dolfin::MeshPartitioning::build_distributed_mesh(mesh);
+    dolfin::MeshPartitioning::build_distributed_mesh(*mesh);
+
+  return mesh;
 }
 }
 //-----------------------------------------------------------------------------
diff --git a/src/CSGCGALMeshGenerator3D.cpp b/src/CSGCGALMeshGenerator3D.cpp
index a728465..82f90fc 100644
--- a/src/CSGCGALMeshGenerator3D.cpp
+++ b/src/CSGCGALMeshGenerator3D.cpp
@@ -26,12 +26,12 @@
 #include <dolfin/mesh/MeshEditor.h>
 #include <dolfin/mesh/MeshPartitioning.h>
 
+#include <chrono>
+#include <thread>
 #include <memory>
 
+#define CGAL_HEADER_ONLY 1
 #define CGAL_NO_DEPRECATED_CODE
-#define CGAL_MESH_3_VERBOSE
-//#define PROTECTION_DEBUG
-
 #define CGAL_MESH_3_NO_DEPRECATED_SURFACE_INDEX
 #define CGAL_MESH_3_NO_DEPRECATED_C3T3_ITERATORS
 
@@ -73,8 +73,27 @@ typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;
 
 namespace
 {
+//-----------------------------------------------------------------------------
+// Repeatedly output some data from the triangulation. Return when the mutex is
+// released.
+void output_num_vertices(Tr& triangulation, std::timed_mutex& mutex)
+{
+  std::chrono::seconds timeout(1);
 
-
+  while (!mutex.try_lock_for(timeout))
+  {
+    // Be carefull to only call functions which are thread safe.
+    // Inspecting the triangulation data structure reveals that both
+    // Tr::number_of_vertices() and Tr::number_of_cells() just reads an
+    // int. Both Tr::number_of_finite_cells and
+    // Tr::number_of_finite_vertices() count by iterating through the data
+    // (which creates a race condition).
+    dolfin::log(dolfin::PROGRESS,
+                "Generating mesh: Currently approx. %ld vertices and %ld cells",
+                triangulation.number_of_vertices(),
+                triangulation.number_of_cells());
+  }
+}
 //-----------------------------------------------------------------------------
 void build_dolfin_mesh(const C3t3& c3t3, dolfin::Mesh& mesh)
 {
@@ -305,17 +324,26 @@ void CSGCGALMeshGenerator3D::generate(std::shared_ptr<const CSGCGALDomain3D> csg
     // Mesh generation
     log(dolfin::TRACE, "Generating mesh");
     C3t3 c3t3;
-    make_multicomponent_mesh_3_impl<C3t3>(c3t3,
-                                          domain,
-                                          *criteria,
-                                          CGAL::parameters::no_exude(),
-                                          CGAL::parameters::no_perturb(),
-                                          CGAL::parameters::no_odt(),
-                                          CGAL::parameters::no_lloyd(),
-                                          true);
-
-
+    {
+      std::timed_mutex mutex;
+      mutex.lock();
+      std::thread output_thread(output_num_vertices,
+                                std::ref(c3t3.triangulation()), std::ref(mutex));
+      dolfin::begin("Generating mesh with CGAL 3D mesh generator");
+      make_multicomponent_mesh_3_impl<C3t3>(c3t3,
+                                            domain,
+                                            *criteria,
+                                            CGAL::parameters::no_exude(),
+                                            CGAL::parameters::no_perturb(),
+                                            CGAL::parameters::no_odt(),
+                                            CGAL::parameters::no_lloyd(),
+                                            true);
+      mutex.unlock();
+      output_thread.join();
+      dolfin::end();
+    }
 
+    log(dolfin::TRACE, "Done");
     if (parameters["odt_optimize"])
     {
       log(dolfin::TRACE, "Optimizing mesh by odt optimization");
diff --git a/src/CSGOperators.cpp b/src/CSGOperators.cpp
index b4366d1..e9aa69f 100644
--- a/src/CSGOperators.cpp
+++ b/src/CSGOperators.cpp
@@ -6,12 +6,12 @@
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 3 of the License, or
 // (at your option) any later version.
-// 
+//
 // mshr is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with mshr.  If not, see <http://www.gnu.org/licenses/>.
 //
@@ -50,7 +50,7 @@ CSGUnion::CSGUnion(std::shared_ptr<CSGGeometry> g0,
   {
     dolfin::dolfin_error("CSGOperators.cpp",
                          "create union of CSG geometries",
-                         "Dimensions of geomestries don't match (%d vs %d)",
+                         "Dimensions of geometries don't match (%d vs %d)",
                          g0->dim(), g1->dim());
   }
 
@@ -175,7 +175,7 @@ std::string CSGIntersection::str(bool verbose) const
 //-----------------------------------------------------------------------------
 CSGTranslation::CSGTranslation(std::shared_ptr<CSGGeometry> g,
                                dolfin::Point t)
-  : g(g), t(t) 
+  : g(g), t(t)
 {
   assert(g);
 
diff --git a/src/CSGPrimitives2D.cpp b/src/CSGPrimitives2D.cpp
index 358fb4d..110d3b8 100644
--- a/src/CSGPrimitives2D.cpp
+++ b/src/CSGPrimitives2D.cpp
@@ -6,12 +6,12 @@
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 3 of the License, or
 // (at your option) any later version.
-// 
+//
 // mshr is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with mshr.  If not, see <http://www.gnu.org/licenses/>.
 //
@@ -51,11 +51,11 @@ Circle::Circle(dolfin::Point(c), double r, std::size_t segments)
                          s.str());
   }
 
-  if (_segments < 3)
+  if (0 < _segments && _segments < 3)
   {
     dolfin::dolfin_error("CSGPrimitives2D.cpp",
                          "create circle",
-                         "Unable to create circle with less than 3 segments");
+                         "Unable to create circle with fewer than 3 segments");
   }
 }
 //-----------------------------------------------------------------------------
@@ -90,11 +90,11 @@ Ellipse::Ellipse(dolfin::Point c, double a, double b,
                          s.str());
   }
 
-  if (_segments < 3)
+  if (0 < _segments && _segments < 3)
   {
     dolfin::dolfin_error("CSGPrimitives2D.cpp",
                  "create ellipse",
-                 "Unable to create ellipse with less than 3 segmentss");
+                 "Unable to create ellipse with fewer than 3 segments");
   }
 }
 //-----------------------------------------------------------------------------
@@ -200,7 +200,7 @@ std::string Polygon::str(bool verbose) const
 bool Polygon::ccw() const
 {
   double signed_area = 0.0;
-  
+
   dolfin::Point prev = _vertices.back();
   for (std::vector<dolfin::Point>::const_iterator it = _vertices.begin(),
 	 v_end = _vertices.end();
diff --git a/src/DolfinMeshUtils.cpp b/src/DolfinMeshUtils.cpp
index 0a168a9..0dd4c0a 100644
--- a/src/DolfinMeshUtils.cpp
+++ b/src/DolfinMeshUtils.cpp
@@ -134,7 +134,12 @@ std::shared_ptr<dolfin::Mesh>
 //-----------------------------------------------------------------------------
 std::shared_ptr<dolfin::Mesh>
 DolfinMeshUtils::merge_meshes(std::shared_ptr<dolfin::Mesh> m1,
-                              std::shared_ptr<dolfin::Mesh> m2)
+                              std::shared_ptr<dolfin::Mesh> m2,
+                              int m1_marker,
+                              int m2_marker,
+                              int m1_boundary_marker,
+                              int m2_boundary_marker,
+                              int interface_marker)
 {
   log(dolfin::TRACE, "Merge meshes");
   // Map vertex (geometric) points to index for m1
@@ -229,8 +234,16 @@ DolfinMeshUtils::merge_meshes(std::shared_ptr<dolfin::Mesh> m1,
 
   for (std::size_t i = 0; i < outmesh->num_cells(); ++i)
   {
-    domain_markers.set_marker(std::make_pair(i,
-                                             i < m1->num_cells() ? 1 : 2), 3);
+    if (m1->num_cells())
+    {
+      if (m1_marker >= 0)
+        domain_markers.set_marker(std::make_pair(i, m1_marker), 3);
+    }
+    else
+    {
+      if (m2_marker >= 0)
+        domain_markers.set_marker(std::make_pair(i, m2_marker), 3);
+    }
   }
 
   // Mark facets
@@ -239,23 +252,34 @@ DolfinMeshUtils::merge_meshes(std::shared_ptr<dolfin::Mesh> m1,
   // 3.
 
   // Compute facet - cell connectivity
-  // std::cout << "Compute facet - cell connectivity" << std::endl;
+
   outmesh->init(2, 3);
   // std::cout << "Done" << std::endl;
   for (dolfin::FacetIterator f(*outmesh); !f.end(); ++f)
   {
     if (f->exterior())
     {
-      const std::size_t marker = f->entities(3)[0] < m1->num_cells() ? 1 : 2;
-      domain_markers.set_marker(std::make_pair(f->index(), marker), 2);
+      if (f->entities(3)[0] < m1->num_cells())
+      {
+        if (m1_boundary_marker >= 0)
+          domain_markers.set_marker(std::make_pair(f->index(), m1_boundary_marker), 2);
+      }
+      else
+      {
+        if (m2_boundary_marker >= 0)
+          domain_markers.set_marker(std::make_pair(f->index(), m2_boundary_marker), 2);
+      }
     }
     else
     {
-      const std::size_t cell1 = f->entities(3)[0];
-      const std::size_t cell2 = f->entities(3)[1];
-      if ( (cell1 < m1->num_cells() && cell2 >= m1->num_cells()) ||
-           (cell1 >= m1->num_cells() && cell2 < m1->num_cells()))
-        domain_markers.set_marker(std::make_pair(f->index(), 3), 2);
+      if (interface_marker >= 0)
+      {
+        const std::size_t cell1 = f->entities(3)[0];
+        const std::size_t cell2 = f->entities(3)[1];
+        if ( (cell1 < m1->num_cells() && cell2 >= m1->num_cells()) ||
+             (cell1 >= m1->num_cells() && cell2 < m1->num_cells()))
+          domain_markers.set_marker(std::make_pair(f->index(), 3), 2);
+      }
     }
   }
 
diff --git a/src/GlobalInitializer.cpp b/src/GlobalInitializer.cpp
index 5999806..fb040e1 100644
--- a/src/GlobalInitializer.cpp
+++ b/src/GlobalInitializer.cpp
@@ -17,6 +17,7 @@
 
 #include <mshr/GlobalInitializer.h>
 
+#define CGAL_HEADER_ONLY 1
 #include <CGAL/Random.h>
 
 #include <iostream>
diff --git a/src/MeshGenerator.cpp b/src/MeshGenerator.cpp
index 39fd8f1..556fa59 100644
--- a/src/MeshGenerator.cpp
+++ b/src/MeshGenerator.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2012 Anders Logg, Benjamin Kehlet, Johannes Ring
+// Copyright (C) 2012 Anders Logg, Johannes Ring, 2012-2016 Benjamin Kehlet
 //
 // This file is part of mshr.
 //
@@ -6,12 +6,12 @@
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 3 of the License, or
 // (at your option) any later version.
-// 
+//
 // mshr is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with mshr.  If not, see <http://www.gnu.org/licenses/>.
 
@@ -21,6 +21,8 @@
 #include <mshr/CSGCGALMeshGenerator3D.h>
 #include <mshr/TetgenMeshGenerator3D.h>
 
+#include <mshr/CSGCGALDomain2D.h>
+
 #include <dolfin/log/log.h>
 #include <dolfin/mesh/BoundaryMesh.h>
 
@@ -29,11 +31,19 @@ namespace mshr
 {
 
 //-----------------------------------------------------------------------------
-std::shared_ptr<dolfin::Mesh> generate_mesh(const CSGGeometry& geometry,
+std::shared_ptr<dolfin::Mesh> generate_mesh(std::shared_ptr<const CSGGeometry> geometry,
                                             double resolution,
                                             std::string backend)
 {
-  if (geometry.dim() == 2)
+  if (resolution <= 0)
+  {
+    dolfin::dolfin_error("MeshGenerator.cpp",
+                         "generate from CSG geometry",
+                         "Resolution argument must be positive");
+  }
+
+
+  if (geometry->dim() == 2)
   {
     if (backend != "cgal")
     {
@@ -41,15 +51,44 @@ std::shared_ptr<dolfin::Mesh> generate_mesh(const CSGGeometry& geometry,
       dolfin::dolfin_error("MeshGenerator.cpp",
                            "generate mesh of 2D geometry",
                            e);
-}
+    }
 
-    std::shared_ptr<dolfin::Mesh> mesh(new dolfin::Mesh());
     CSGCGALMeshGenerator2D generator;
-    generator.parameters["mesh_resolution"] = resolution;
-    generator.generate(geometry, *mesh);
-    return mesh;
+
+    // Compute cell size
+    // Chicken-and-egg problem:
+    // The cell size is needed to transform the circles into polygons, but
+    // the cell size can only be determined via the bounding circle radius
+    // which can only be computed if we already have a polygon.
+    //
+    // Proper solution:
+    // Compute the bounding circle radius from the geometry information
+    // alone.
+    //
+    // Workaround:
+    // Polygonize with some arbitrary cell size, compute the bounding circle
+    // of the resulting polygonal object, and take the cell size from that.
+    double cell_size;
+    {
+      const double tmp_cell_size = 0.1;
+      CSGCGALDomain2D total_domain_coarse(geometry, tmp_cell_size);
+      const double min_radius = total_domain_coarse.compute_boundingcircle_radius();
+      cell_size = 2.0*min_radius/resolution;
+    }
+    log(dolfin::TRACE, "Request cell size: %f", cell_size);
+    generator.parameters["mesh_resolution"] = -1.0;
+    generator.parameters["cell_size"] = cell_size;
+
+    std::shared_ptr<CSGCGALDomain2D> total_domain(new CSGCGALDomain2D(geometry));
+    std::vector<std::pair<std::size_t, std::shared_ptr<const CSGCGALDomain2D>>> subdomain_geometries;
+    for (const std::pair<std::size_t, std::shared_ptr<const CSGGeometry>>& subdomain : geometry->get_subdomains())
+    {
+      subdomain_geometries.push_back(std::make_pair(subdomain.first,
+                                                    std::shared_ptr<CSGCGALDomain2D>(new CSGCGALDomain2D(subdomain.second))));
+    }
+    return generator.generate(total_domain, subdomain_geometries);
   }
-  else if (geometry.dim() == 3)
+  else if (geometry->dim() == 3)
   {
     std::shared_ptr<CSGCGALDomain3D> domain(new CSGCGALDomain3D(geometry));
     domain->ensure_meshing_preconditions();
@@ -79,7 +118,7 @@ std::shared_ptr<dolfin::Mesh> generate_mesh(const CSGGeometry& geometry,
   {
     dolfin::dolfin_error("MeshGenerator.cpp",
                          "create mesh from CSG geometry",
-                         "Unhandled geometry dimension %d", geometry.dim());
+                         "Unhandled geometry dimension %d", geometry->dim());
     return std::shared_ptr<dolfin::Mesh>();
   }
 }
diff --git a/src/Meshes.cpp b/src/Meshes.cpp
index b4d61de..f5687cb 100644
--- a/src/Meshes.cpp
+++ b/src/Meshes.cpp
@@ -33,7 +33,7 @@ namespace mshr
       return;
     }
 
-    Sphere s(dolfin::Point(0,0,0), 1.0, resolution);
+    std::shared_ptr<Sphere> s(new Sphere(dolfin::Point(0,0,0), 1.0, resolution));
     std::shared_ptr<CSGCGALDomain3D> polyhedral_domain(new CSGCGALDomain3D(s));
 
     TetgenMeshGenerator3D generator;
diff --git a/src/Polyhedron_utils.h b/src/Polyhedron_utils.h
index 7d0015f..12190e9 100644
--- a/src/Polyhedron_utils.h
+++ b/src/Polyhedron_utils.h
@@ -51,6 +51,66 @@ class PolyhedronUtils
  public:
 
   //-----------------------------------------------------------------------------
+  template<typename CDT>
+  static void dump_2D_triangulation(const CDT& cdt, std::string filename)
+  {
+    std::cout << "Dumping 2D triangulation" << std::endl;
+
+    // Count valid cells and connected vertices
+    std::size_t num_cells = 0;
+    std::map<typename CDT::Vertex_handle, std::size_t> vertex_map;
+
+    for (typename CDT::Finite_faces_iterator cgal_cell = cdt.finite_faces_begin();
+         cgal_cell != cdt.finite_faces_end(); ++cgal_cell)
+    {
+      if (cgal_cell->is_in_domain())
+      {
+        num_cells++;
+
+        for (std::size_t i = 0; i < 3; i++)
+        {
+          const typename CDT::Vertex_handle v = cgal_cell->vertex(i);
+          if (vertex_map.count(v) == 0)
+          {
+            const std::size_t s = vertex_map.size();
+            vertex_map[v] = s;
+          }
+        }
+      }
+    }
+
+    std::cout << "Adding " << vertex_map.size() << " vertices and " << num_cells << " cells" << std::endl;
+
+    std::ofstream outfile(filename);
+    outfile << std::setprecision(16);
+    outfile << "OFF" << std::endl;
+    outfile << vertex_map.size() << " " << num_cells << " 0" << std::endl;
+    outfile << std::endl;
+
+    std::vector<typename CDT::Vertex_handle> vertices(vertex_map.size());
+    for (const std::pair<typename CDT::Vertex_handle, std::size_t>& vertex : vertex_map)
+      vertices[vertex.second] = vertex.first;
+
+    for (const typename CDT::Vertex_handle v : vertices)
+    {
+      outfile << v->point()[0] << " "
+              << v->point()[1] << " 0 " << std::endl;
+    }
+
+    for (typename CDT::Finite_faces_iterator cgal_cell = cdt.finite_faces_begin();
+         cgal_cell != cdt.finite_faces_end(); ++cgal_cell)
+    {
+      // Add cell if it is in the domain
+      if (cgal_cell->is_in_domain())
+      {
+        outfile << "3 "
+                << vertex_map[cgal_cell->vertex(0)] << " "
+                << vertex_map[cgal_cell->vertex(1)] << " "
+                << vertex_map[cgal_cell->vertex(2)] << std::endl;
+      }
+    }
+  }
+  //-----------------------------------------------------------------------------
   // Scans the vertices of the polyhedron the polyhedron and returns a
   // Polyhedron::Vertex_const_handle for each disconnected component.
   template <typename Polyhedron, typename OutputIterator>
@@ -75,12 +135,12 @@ class PolyhedronUtils
       *it = start;
       it++;
 
-      // Remove rest of component
+      // Remove all vertices belonging to component from v
       std::deque<Vertex_const_handle> queue;
       queue.push_back(start);
       while (!queue.empty())
       {
-        Vertex_const_handle current = queue.front();
+        const Vertex_const_handle current = queue.front();
         queue.pop_front();
 
         if (v.count(current) > 0)
@@ -407,10 +467,11 @@ class PolyhedronUtils
   }
   //-----------------------------------------------------------------------------
   // Compute the fit quality heuristic of the vertices from h1 to h2 both
-  // included Some experiences:
+  // included.
 
-  // The plane fit quality as returned from
-  // * CGAL::linear_least_squares_fitting_3() is not suitable here. It measures
+  // Some experiences:
+  // * The plane fit quality as returned from
+  // CGAL::linear_least_squares_fitting_3() is not suitable here. It measures
   // how distinct the best fitting plane is, rather than the actual quality of
   // the fit.
   // * The max angle between the segments and the normal work good is the hole
@@ -535,142 +596,224 @@ class PolyhedronUtils
     //return (-avg_distance_squared1 - avg_distance_squared2)/std::max(max_angle1, max_angle2); ///std::min(plane1fit, plane2fit);
     return -std::max(max_angle1, max_angle2);
   }
+
   //-----------------------------------------------------------------------------
-  // This class is capable of filling a hole in a polyhedron by inserting
-  // a 2D triangulation.
-  // TODO: This needs to be fixed!
-  template <class Polyhedron, class CDT>
-  class Triangulation_inserter
-    : public CGAL::Modifier_base<typename Polyhedron::HalfedgeDS>
+  // Compute the transformation that rotates a given vector (assumed to be of
+  // unit length) into (0,0,1)
+  template<typename Vector_3>
+  static CGAL::Aff_transformation_3<typename CGAL::Kernel_traits<Vector_3>::Kernel>
+    rotate_to_xy(Vector_3 a)
   {
-   public:
-    typedef typename Polyhedron::HalfedgeDS HalfedgeDS;
-    typedef typename Polyhedron::Vertex Vertex;
-    typedef typename Polyhedron::Halfedge_around_vertex_circulator He_circ;
-    typedef typename Polyhedron::Traits::Point_3 Point_3;
-    typedef typename CDT::Geom_traits::Point_3 InexactPoint_3;
-    typedef typename Polyhedron::Vertex_handle Vertex_handle;
-    typedef typename Polyhedron::Halfedge_handle Halfedge_handle;
-    typedef typename Polyhedron::Traits Traits;
-    typedef typename CGAL::Aff_transformation_3<typename CDT::Geom_traits> Aff_transformation_3;
+    typedef typename CGAL::Kernel_traits<Vector_3>::Kernel::RT RT;
+    typedef typename CGAL::Aff_transformation_3<typename CGAL::Kernel_traits<Vector_3>::Kernel> Aff_transformation_3;
 
-    // Constructor
- Triangulation_inserter(CDT& cdt, Aff_transformation_3 tr, double z, Halfedge_handle h)
-   : cdt(cdt), tr(tr), z(z), h(h)
-    {}
+    // Inner product of a and target vector (0,0,1)
+    const RT cos_theta = a[2];
 
-    void operator()(HalfedgeDS& hds)
-    {
-      CGAL::HalfedgeDS_decorator<HalfedgeDS> decorator(hds);
-      typedef typename HalfedgeDS::Halfedge Halfedge;
+    // Cross product of a and target vector (0,0,1)
+    // const RT sine_theta = CGAL::sqrt(a[1]*a[1] + a[0]*a[0]);
+    const RT sine_theta = sqrt(CGAL::to_double(a[1]*a[1] + a[0]*a[0]));
 
-      std::map<std::pair<Vertex_handle, Vertex_handle>, Halfedge_handle> inserted_edges;
+    const RT ux = a[1]/sine_theta;;
+    const RT uy = -a[0]/sine_theta;
+    const RT uz = 0;
+    dolfin_assert(CGAL::abs(ux*ux + uy*uy + uz*uz) - 1 < DOLFIN_EPS);
 
-      // Collect the already existing edges on the boundary
-      Halfedge_handle current = h;
-      do
-      {
-        inserted_edges[std::make_pair(current->vertex(), current->next()->vertex())] = current->next();
-        current = current->next();
-      } while (current != h);
-
-      std::size_t vcounter = 0;
-      std::vector<Vertex_handle> inserted_vertices;
-
-      for (typename CDT::Finite_vertices_iterator vit = cdt.finite_vertices_begin();
-           vit != cdt.finite_vertices_end(); vit++)
+    return Aff_transformation_3(
+      cos_theta+ux*ux*(1-cos_theta),     ux*uy*(1-cos_theta)-uz*sine_theta, ux*uz*(1-cos_theta)+uy*sine_theta,
+      uy*ux*(1-cos_theta)+uz*sine_theta, cos_theta+uy*uy*(1-cos_theta),     uy*uz*(1-cos_theta)-ux*sine_theta,
+      uz*ux*(1-cos_theta)-uy*sine_theta, uz*uy*(1-cos_theta)+ux*sine_theta, cos_theta+uz*uz*(1-cos_theta));
+  }
+  //-----------------------------------------------------------------------------
+  template <typename HDS, typename CDT>
+  class Add2DTriangulation : public CGAL::Modifier_base<HDS>
+  {
+  public:
+ Add2DTriangulation(const CDT& cdt,
+                    const typename HDS::Traits::Aff_transformation_3& from_xy,
+                    const typename CDT::Vertex_handle v0,
+                    const typename CDT::Vertex_handle v1,
+                    const typename HDS::Traits::Vector_3 displacement=typename HDS::Traits::Vector_3(CGAL::Null_vector()))
+   : cdt(cdt),
+      rotate_from_xy(from_xy),
+      displacement(displacement),
+      v0_2d(v0),
+      v1_2d(v1),
+      v0_initialized(false),
+      v1_initialized(false)
+    { }
+
+    void operator()(HDS& hds)
+    {
+      CGAL::Polyhedron_incremental_builder_3<HDS> builder(hds, true);
+
+      for (typename CDT::Finite_vertices_iterator cgal_vertex = cdt.finite_vertices_begin();
+           cgal_vertex != cdt.finite_vertices_end(); ++cgal_vertex)
       {
-        if (vit->info() == Vertex_handle())
-        {
-          // std::cout << "Inserting new vertex" << std::endl;
-          Vertex_handle v = decorator.vertices_push_back(Vertex());
-          inserted_vertices.push_back(v);
-          vit->info() = v;
-          const InexactPoint_3 p(vit->point()[0], vit->point()[1], z);
-          const InexactPoint_3 rotated = tr.transform(p);
-          v->point() = Point_3(rotated[0], rotated[1], rotated[2]);
-          vcounter++;
-        }
+        cgal_vertex->info() = std::make_pair(typename HDS::Vertex_handle(),
+                                             std::numeric_limits<std::size_t>::max());
       }
 
-      // std::cout << vcounter << " vertices inserted" << std::endl;
+      // Find the face incident to both v0 and v1
+      // We will use this to check the orientation of the faces when they are
+      // inserted into the 3D polyhedron
+      typename CDT::Face_handle f;
 
-      std::size_t fcounter = 0;
-      for (typename CDT::Finite_faces_iterator fit = cdt.finite_faces_begin();
-           fit != cdt.finite_faces_end(); fit++)
+      // Count valid cells and connected vertices
+      std::size_t num_cells = 0;
+      std::size_t num_vertices = 0;
+      for (typename CDT::Finite_faces_iterator cgal_cell = cdt.finite_faces_begin();
+           cgal_cell != cdt.finite_faces_end(); ++cgal_cell)
       {
-        if (fit->is_in_domain())
+        if (cgal_cell->is_in_domain())
         {
-          // std::cout << "Inserting face" << std::endl;
-
-          // Check if any of the edges are missing
-          std::array<Vertex_handle, 3> vertices{fit->vertex(0)->info(),
-                                                fit->vertex(1)->info(),
-                                                fit->vertex(2)->info()} ;
-          dolfin_assert(vertices[0] != Vertex_handle());
-          dolfin_assert(vertices[1] != Vertex_handle());
-          dolfin_assert(vertices[2] != Vertex_handle());
-
-          // std::cout << "Creating edges" << std::endl;
-          std::array<Halfedge_handle, 3> edges;
+          num_cells++;
+
           for (std::size_t i = 0; i < 3; i++)
           {
-            if (inserted_edges.count(std::make_pair(vertices[i], vertices[(i+1)%3])) == 0)
+            typename CDT::Vertex_handle v = cgal_cell->vertex(i);
+            if (v->info().second == std::numeric_limits<std::size_t>::max())
             {
-              Halfedge_handle hnew = hds.edges_push_back(Halfedge(),
-                                                         Halfedge());
-              decorator.set_vertex(hnew, vertices[(i+1)%3]);
-              decorator.set_vertex(hnew->opposite(), vertices[i]);
-              inserted_edges[std::make_pair(vertices[i], vertices[(i+1)%3])] = hnew;
-              inserted_edges[std::make_pair(vertices[(i+1)%3], vertices[i])] = hnew->opposite();
-              edges[i] = hnew;
+              v->info().second = num_vertices;
+              num_vertices++;
             }
-            else
-              edges[i] = inserted_edges[std::make_pair(vertices[i], vertices[(i+1)%3])];
           }
 
-          // std::cout << "Now creating face" << std::endl;
+          if (cgal_cell->has_vertex(v0_2d) && cgal_cell->has_vertex(v1_2d))
+          {
+            std::cout << "!!!! Found the face!!!" << std::endl;
+            std::cout << cgal_cell->index(v0_2d) << " " << cgal_cell->index(v1_2d) << std::endl;
+            f = cgal_cell;
+          }
+        }
+      }
+
+      // Check the orientation of the facets
+      const bool flip = ((f->index(v1_2d)+1)%3 == f->index(v0_2d));
 
-          // This typedef for some reason gives a "unused local typedef" warning
-          //from clang (...?) --> write out the typename in the statements
-          //below.
-          // typedef typename Halfedge::Base HBase;
-          edges[0]->Halfedge::Base::set_next(edges[1]);
-          decorator.set_prev(edges[1], edges[0]);
-          edges[1]->Halfedge::Base::set_next(edges[2]);
-          decorator.set_prev(edges[2], edges[1]);
-          edges[2]->Halfedge::Base::set_next(edges[0]);
-          decorator.set_prev(edges[0], edges[2]);
+      const typename HDS::Traits::Vector_3 displacement_flipped = flip ? -displacement : displacement;
 
-          decorator.fill_hole(edges[0]);
+      builder.begin_surface(num_vertices, num_cells);
 
-          fcounter++;
+      std::cout << "Adding " << num_vertices << " vertices and " << num_cells << " cells" << std::endl;
+
+      // Add vertices
+      std::size_t vertex_index = 0;
+      for (typename CDT::Finite_vertices_iterator cgal_vertex = cdt.finite_vertices_begin();
+           cgal_vertex != cdt.finite_vertices_end(); ++cgal_vertex)
+      {
+        const typename CDT::Vertex_handle current = cgal_vertex;
+
+        // Transform point from xy plane to where it belongs in the polyhendron (2D point is EPICK)
+        typename HDS::Traits::Point_3 p = rotate_from_xy(typename HDS::Traits::Point_3(cgal_vertex->point()[0],
+                                                                                       cgal_vertex->point()[1],
+                                                                                       0))+displacement;
+
+        /* std::cout << "  2D point: " << cgal_vertex->point() << " (" << z << ")" << std::endl; */
+        /* std::cout << "  Rotated:  " << p << std::endl; */
+        /* std::cout << "  Index: " << vertex_index << std::endl; */
+// FRom remove-null-facets
+          /* // std::cout << "Now creating face" << std::endl; */
+
+          /* // This typedef for some reason gives a "unused local typedef" warning */
+          /* //from clang (...?) --> write out the typename in the statements */
+          /* //below. */
+          /* // typedef typename Halfedge::Base HBase; */
+          /* edges[0]->Halfedge::Base::set_next(edges[1]); */
+          /* decorator.set_prev(edges[1], edges[0]); */
+          /* edges[1]->Halfedge::Base::set_next(edges[2]); */
+          /* decorator.set_prev(edges[2], edges[1]); */
+          /* edges[2]->Halfedge::Base::set_next(edges[0]); */
+          /* decorator.set_prev(edges[0], edges[2]); */
+// end remove-null-facets
+
+        // Add vertex (convert point to EPECK)
+        typename HDS::Vertex_handle h = builder.add_vertex(p);
+        if (current == v0_2d)
+        {
+          v0 = h;
+          v0_initialized = true;
+        }
+        else if (current == v1_2d)
+        {
+          v1 = h;
+          v1_initialized = true;
         }
+
+        // Attach index to vertex and increment
+        cgal_vertex->info().second = vertex_index++;
       }
 
-      // std::cout << "Added " << fcounter << " faces" << std::endl;
-    }
+      // Add cells to mesh and build domain marker mesh function
+      // std::size_t cell_index = 0;
+      for (typename CDT::Finite_faces_iterator cgal_cell = cdt.finite_faces_begin();
+           cgal_cell != cdt.finite_faces_end(); ++cgal_cell)
+      {
+        // Add cell if it is in the domain
+        if (cgal_cell->is_in_domain())
+        {
+          const typename CDT::Geom_traits::Triangle_2 t_2d(cgal_cell->vertex(0)->point(),
+                                                           cgal_cell->vertex(1)->point(),
+                                                           cgal_cell->vertex(2)->point());
+
+          // Transform point from xy plane to where it belongs in the polyhendron (2D point is EPICK)
+          typename HDS::Traits::Point_3 p0 = rotate_from_xy(typename HDS::Traits::Point_3(cgal_cell->vertex(0)->point()[0],
+                                                                                          cgal_cell->vertex(0)->point()[1],
+                                                                                          0));
+
+          typename HDS::Traits::Point_3 p1 = rotate_from_xy(typename HDS::Traits::Point_3(cgal_cell->vertex(1)->point()[0],
+                                                                                          cgal_cell->vertex(1)->point()[1],
+                                                                                          0));
+
+          typename HDS::Traits::Point_3 p2 = rotate_from_xy(typename HDS::Traits::Point_3(cgal_cell->vertex(2)->point()[0],
+                                                                                          cgal_cell->vertex(2)->point()[1],
+                                                                                          0));
+
+          typename HDS::Traits::Triangle_3 t_3d(p0, p1, p2);
+
+          const double diff = sqrt(CGAL::to_double(t_3d.squared_area()))-CGAL::to_double(CGAL::abs(t_2d.area()));
+          if (std::abs(diff) > 1e-10)
+            std::cout << "Rotated triangle differs: " << diff << std::endl;
+
+
 
-    CDT& cdt;
-    const CGAL::Aff_transformation_3<typename CDT::Geom_traits> tr;
-    const double z;
-    const Halfedge_handle h;
+          builder.begin_facet();
+          builder.add_vertex_to_facet(cgal_cell->vertex(0)->info().second);
+          if (flip)
+          {
+            builder.add_vertex_to_facet(cgal_cell->vertex(2)->info().second);
+            builder.add_vertex_to_facet(cgal_cell->vertex(1)->info().second);
+            /* std::cout << "  Adding vertex: (" << cgal_cell->vertex(0)->info().second */
+            /*           << ", " << cgal_cell->vertex(2)->info().second */
+            /*           << ", " << cgal_cell->vertex(1)->info().second << std::endl; */
+          }
+          else
+          {
+            builder.add_vertex_to_facet(cgal_cell->vertex(1)->info().second);
+            builder.add_vertex_to_facet(cgal_cell->vertex(2)->info().second);
+            /* std::cout << "  Adding vertex: (" << cgal_cell->vertex(0)->info().second */
+            /*           << ", " << cgal_cell->vertex(1)->info().second */
+            /*           << ", " << cgal_cell->vertex(2)->info().second << std::endl; */
+
+          }
+          new_facets.insert(builder.end_facet());
+        }
+      }
+
+      builder.end_surface();
+
+      dolfin_assert(v0_initialized);
+      dolfin_assert(v1_initialized);
+    }
+    const CDT& cdt;
+    const typename HDS::Traits::Aff_transformation_3 rotate_from_xy;
+    const typename HDS::Traits::Vector_3 displacement;
+    const typename CDT::Vertex_handle v0_2d, v1_2d;
+    typename HDS::Vertex_handle v0, v1;
+    bool v0_initialized, v1_initialized;
+    std::set<typename HDS::Halfedge_handle> new_facets;
   };
 
-  //-----------------------------------------------------------------------------
-  // Compute the transformation that rotates a given vector (assumed to be of
-  // unit length) into (0,0,1)
-  template<typename Vector_3>
-  static CGAL::Aff_transformation_3<typename CGAL::Kernel_traits<Vector_3>::Kernel>
-    rotate_to_xy(Vector_3 a)
-  {
-    const typename CGAL::Kernel_traits<Vector_3>::Kernel::FT den = a[0]*a[0] + a[1]*a[1];
-    return CGAL::Aff_transformation_3<typename CGAL::Kernel_traits<Vector_3>::Kernel>
-      (1 - a[0]*a[0]*(1-a[2])/den, -a[0]*a[1]*(1-a[2])/den,   -a[0],
-       - a[0]*a[1]*(1-a[2])/den,   1 -a[1]*a[1]*(1-a[2])/den, -a[1],
-       a[0],                       a[1],                      1 + (-a[0]*a[0]-a[1]*a[1])*(1-a[2])/den);
-  }
-  //-----------------------------------------------------------------------------
   /// Attempts to triangulate a polygon in 3d by projecting vertices into the
   /// best fitting plane and triangulating in 2d.
   /// Return the new added edges.
@@ -678,24 +821,30 @@ class PolyhedronUtils
   /// the return vector is empty
   template <typename Polyhedron>
   static bool triangulate_polygon_3d(Polyhedron& P,
-                                     typename Polyhedron::Halfedge_handle h,
-                                     bool check_for_intersections = true)
+                                     const typename Polyhedron::Halfedge_handle h,
+                                     bool check_for_intersections = true,
+                                     bool refine = true)
   {
     typedef typename Polyhedron::Halfedge_handle Halfedge_handle;
     typedef typename Polyhedron::Vertex_handle Vertex_handle;
-    typedef typename Polyhedron::Facet_handle Facet_handle;
+    // typedef typename Polyhedron::Facet_handle Facet_handle;
+    typedef typename Polyhedron::Traits::FT FT;
     typedef typename Polyhedron::Traits::Point_3 Point_3;
     typedef typename Polyhedron::Traits::Segment_3 Segment_3;
+    typedef typename Polyhedron::Traits::Vector_3 Vector_3;
+    typedef CGAL::Aff_transformation_3<typename Polyhedron::Traits> Aff_transformation_3;
+
 
     typedef CGAL::Exact_predicates_inexact_constructions_kernel InexactKernel;
     typedef typename InexactKernel::Plane_3 InexactPlane_3;
     typedef typename InexactKernel::Point_3 InexactPoint_3;
     typedef typename InexactKernel::Vector_3 InexactVector_3;
     typedef typename InexactKernel::Point_2 InexactPoint_2;
-    typedef typename InexactKernel::Segment_2 InexactSegment_2;
+    // typedef typename InexactKernel::Segment_2 InexactSegment_2;
     typedef typename InexactKernel::Segment_3 InexactSegment_3;
+    typedef typename InexactKernel::Triangle_2 InexactTriangle_2;
 
-    typedef CGAL::Triangulation_vertex_base_with_info_2<Vertex_handle, InexactKernel> Vb;
+    typedef CGAL::Triangulation_vertex_base_with_info_2<std::pair<Vertex_handle, std::size_t>, InexactKernel> Vb;
     typedef CGAL::Delaunay_mesh_face_base_2<InexactKernel> Fb;
     typedef CGAL::Triangulation_data_structure_2<Vb,Fb> TDS;
     typedef CGAL::No_intersection_tag Itag;
@@ -703,13 +852,28 @@ class PolyhedronUtils
     typedef CGAL::Delaunay_mesh_size_criteria_2<CDT> Mesh_criteria_2;
     typedef CGAL::Delaunay_mesher_no_edge_refinement_2<CDT, Mesh_criteria_2>  CGAL_Mesher_2;
 
+    std::cout << "Triangulating hole as 2d polygon" << std::endl;
     dolfin_assert(P.is_valid());
-    // std::cout << "Triangulating hole as 2d polygon" << std::endl;
 
-    // Compute the best fitting plane of the points of the hole
-    InexactPlane_3 fitting_plane;
-    // double fit_quality;
     {
+      std::cout << "Polygon ";
+      typename Polyhedron::Halfedge_handle current = h;
+      do
+      {
+        std::cout << current->vertex()->point() << ", ";
+        current = current->next();
+      } while (current != h);
+
+       std::cout << std::endl;
+    }
+
+    Aff_transformation_3 to_xy;
+    Vector_3 plane_normal;
+    {
+      // Compute the best fitting plane of the points of the hole
+      InexactPlane_3 fitting_plane;
+
+
       std::vector<InexactSegment_3> boundary;
       Halfedge_handle current = h;
       do
@@ -722,95 +886,154 @@ class PolyhedronUtils
         current = current->next();
       } while (current != h);
 
-      const double fit_quality = CGAL::linear_least_squares_fitting_3(boundary.begin(),
-                                                                      boundary.end(),
-                                                                      fitting_plane,
-                                                                      CGAL::Dimension_tag<1>());
-      double min_cos_normal_angle = 0;
+      /* const double fit_quality = */
+      CGAL::linear_least_squares_fitting_3(boundary.begin(),
+                                           boundary.end(),
+                                           fitting_plane,
+                                           CGAL::Dimension_tag<1>());
+
+      // Compute rotation that will rotate the fitting plane to the xy plane
+      const InexactVector_3 orthogonal = fitting_plane.orthogonal_vector();
+      const Vector_3 orthogonal_exact(orthogonal[0], orthogonal[1], orthogonal[2]);
+      // std::cout << "Orthogonal vector: " << orthogonal << ", " << orthogonal.squared_length() << std::endl;
+      const Aff_transformation_3 rotation = rotate_to_xy(orthogonal_exact);
+      // std::cout << "Rotation: " << rotation << std::endl;
+      std::cout << "Rotated: " << rotation.transform(orthogonal_exact) << std::endl;
+      const InexactPoint_3 point_on_plane = fitting_plane.point();
+      const FT z = rotation.transform(Point_3(point_on_plane[0],
+                                              point_on_plane[1],
+                                              point_on_plane[2]))[2];
+
+      const Aff_transformation_3 zero_z(CGAL::Translation(), Vector_3(0,0,-z));
+
+      double max_cos_normal_angle = 0;
       const InexactVector_3 normal = fitting_plane.orthogonal_vector();
+      std::cout << "Normal: " << plane_normal << std::endl;
+      plane_normal = Vector_3(normal.x(), normal.y(), normal.z());
+
       double max_squared_distance = 0;
       dolfin_assert(dolfin::near(normal.squared_length(), 1, DOLFIN_EPS_LARGE));
 
-      InexactVector_3 prev = InexactVector_3(boundary[boundary.size()-1]) / std::sqrt(boundary[boundary.size()-1].squared_length());
-      for (auto sit = boundary.begin(); sit != boundary.end(); sit++)
+      // Compute 2D bounding box
+      std::vector<InexactPoint_2> points_2D;
+      for (const InexactSegment_3& s : boundary)
       {
-        InexactVector_3 current = InexactVector_3(*sit) / std::sqrt(sit->squared_length());
-        max_squared_distance = std::max(max_squared_distance, (sit->source()-fitting_plane.projection(sit->source())).squared_length());
+        const Point_3 current_exact(s.source()[0], s.source()[1], s.source()[2]);
+        const Point_3 rotated = rotation.transform(current_exact);
+        points_2D.push_back(InexactPoint_2(CGAL::to_double(rotated[0]),
+                                           CGAL::to_double(rotated[1])));
+      }
+      CGAL::Bbox_2 bbox = CGAL::bbox_2(points_2D.begin(), points_2D.end());
+      std::cout << "Bounding box: " << bbox << std::endl;
+
+      // InexactVector_3 prev = InexactVector_3(boundary[boundary.size()-1]) / std::sqrt(boundary[boundary.size()-1].squared_length());
+      for (const InexactSegment_3& s : boundary)
+      {
+        InexactVector_3 current = InexactVector_3(s) / std::sqrt(s.squared_length());
+        max_squared_distance = std::max(max_squared_distance, (s.source()-fitting_plane.projection(s.source())).squared_length());
 
         // std::cout << "Length: " << sit->squared_length() << ", " << current.squared_length() << ", " << (current*normal) << std::endl;
         dolfin_assert(dolfin::near(current.squared_length(), 1, DOLFIN_EPS_LARGE));
-        min_cos_normal_angle = std::max(min_cos_normal_angle, std::abs(current*normal));
-        prev = current;
+        max_cos_normal_angle = std::max(max_cos_normal_angle, CGAL::abs(current*normal));
+        // prev = current;
+
+        const Point_3 current_exact(s.source()[0], s.source()[1], s.source()[2]);
+        const Point_3 rotated = rotation.transform(current_exact);
+        // bbox += InexactPoint_2(CGAL::to_double(rotated[0]), CGAL::to_double(rotated[1])).bbox();
+        // std::cout << "  " << bbox << std::endl;
       }
 
-      // std::cout << "Max abs cos normal angle: " << min_cos_normal_angle << std::endl;
+      std::cout << "Max abs cos normal angle: " << max_cos_normal_angle << std::endl;
       // std::cout << "Plane quality: " << fit_quality << std::endl;
-      // std::cout << "Max distance: " << std::sqrt(max_squared_distance) << std::endl;
+      std::cout << "Max distance: " << std::sqrt(max_squared_distance) << std::endl;
 
-      // FIXME: Improve this test
-      if (fit_quality < .95 || min_cos_normal_angle > .3)
+      if (max_cos_normal_angle > .2)
       {
-        // std::cout << "Rejecting 2d triangulating" << std::endl;
+        std::cout << "ERROR: Rejecting 2d triangulating, max_cos_normal_angle: " << max_cos_normal_angle << std::endl;
         return false;
       }
+      if (max_squared_distance > 1e-8)
+      {
+        std::cout << "ERROR: Rejecting 2d triangulating, max squared_distance: " << max_squared_distance << std::endl;
+        return false;
+      }
+
+      const Aff_transformation_3 normalization(CGAL::Translation(), Vector_3(-(bbox.xmax()+bbox.xmin())/2,
+                                                                             -(bbox.ymax()+bbox.ymin())/2,
+                                                                             0));
+
+      to_xy = normalization*zero_z*rotation;
     }
 
-    // Compute rotation that will rotate the fitting plane to the xy plane
-    const CGAL::Aff_transformation_3<InexactKernel> rotation = rotate_to_xy(fitting_plane.orthogonal_vector());
-    double z = 0;//  = rotation.transform(InexactPoint_3(CGAL::to_double(h->vertex()->point()[0]),
-    //                              CGAL::to_double(h->vertex()->point()[1]),
-    //                                                 CGAL::to_double(h->vertex()->point()[2])))[2];
 
     // std::cout << "Rotate normal: " << rotation.transform(fitting_plane.orthogonal_vector()) << std::endl;
-    dolfin_assert(dolfin::near(fitting_plane.orthogonal_vector().squared_length(), 1, DOLFIN_EPS_LARGE));
+    // dolfin_assert(dolfin::near(fitting_plane.orthogonal_vector().squared_length(), 1, DOLFIN_EPS_LARGE));
+    double max_z = 0.;
 
     CDT cdt;
 
-    // std::cout << "Projected polygon" << std::endl;
-    // std::cout << "Polygon";
+    std::cout << "Projected polygon" << std::endl;
+    std::cout << "Polygon";
 
     // Insert vertices into 2D triangulation
     std::vector<typename CDT::Vertex_handle> vertices;
     double max_squared_edge_length = 0;
+    double min_squared_edge_length = std::numeric_limits<double>::max();
 
     {
       Halfedge_handle current = h;
       Point_3 prev = current->prev()->vertex()->point();
+      std::stringstream ss;
+      ss << "Polygon ";
       do
       {
 
         const Point_3& p = current->vertex()->point();
-        max_squared_edge_length = std::max(max_squared_edge_length, CGAL::to_double(Segment_3(prev, p).squared_length()));
-        const InexactPoint_3 rotated = rotation.transform(InexactPoint_3(CGAL::to_double(p[0]),
-                                                                         CGAL::to_double(p[1]),
-                                                                         CGAL::to_double(p[2])));
-        z += rotated[2];
-        // std::cout << " " << rotated << ", ";
+        // InexactPoint_3 p_inexact(CGAL::to_double(p[0]),
+//                                  CGAL::to_double(p[1]),
+        //                               CGAL::to_double(p[2]));
+        // InexactPoint_3 p_projected = fitting_plane.projection(p_inexact);
+        // std::cout << " " << p_projected << ", ";
 
-        const InexactPoint_2 p_2d(rotated[0], rotated[1]);
+        const double length_current = CGAL::to_double(Segment_3(prev, p).squared_length());
+        max_squared_edge_length = std::max(max_squared_edge_length, length_current);
+        min_squared_edge_length = std::min(min_squared_edge_length, length_current);
+        const Point_3 rotated = to_xy.transform(p);
+
+        max_z = std::max(max_z, CGAL::to_double(CGAL::abs(rotated.z())));
+        ss << " " << rotated << ", ";
+
+        const InexactPoint_2 p_2d(CGAL::to_double(rotated[0]), CGAL::to_double(rotated[1]));
 
         // std::cout << " " << p_2d << ", ";
 
         vertices.push_back(cdt.insert(p_2d));
-        vertices.back()->info() = current->vertex();
+        vertices.back()->info().first = current->vertex();
 
         prev = p;
         current = current->next();
       } while (current != h);
 
       // std::cout << std::endl;
+      std::cout << std::endl;
+      std::cout << ss.str() << std::endl;
     }
 
-    // std::cout << "Size of points: " << vertices.size() << std::endl;
-    z /= vertices.size();
+    std::cout << "Size of points: " << vertices.size() << std::endl;
+    // std::cout << "z = " << z << std::endl;
+    std::cout << "Max z : " << max_z << std::endl;
+    std::cout << "Longest edge:  " << max_squared_edge_length << std::endl;
+    std::cout << "Shortest edge: " << min_squared_edge_length << std::endl;
+
 
     // Check if any of the edges intersect (before actually adding the
-    // constrained edges to the triangulation
+    // constrained edges to the triangulation)
+#if 0
     if (check_for_intersections)
     {
       for (std::size_t i = 0; i < vertices.size()-1; i++)
       {
-        const Point_3& a = vertices[i]->info()->point(), b = vertices[+1]->info()->point();
+        const Point_3& a = vertices[i]->info().first->point(), b = vertices[+1]->info().first->point();
         const InexactSegment_2 s(vertices[i]->point(), vertices[i+1]->point());
         const Segment_3 original(a, b);
 
@@ -833,15 +1056,15 @@ class PolyhedronUtils
             {
               if (j != i+1 && i != (j+1)%vertices.size())
               {
-                //std::cout << "Non-neighbors (" << i << ", " << j << ")/" << vertices.size()
-                //          << " intersect in single point" << std::endl;
+                std::cout << "Non-neighbors (" << i << ", " << j << ")/" << vertices.size()
+                          << " intersect in single point" << std::endl;
 
                 return false;
               }
             }
             else if (boost::get<InexactSegment_2>(&*intersection))
             {
-              // std::cout << "Intersects in segment" << std::endl;
+              std::cout << "Intersects in segment" << std::endl;
               return false;
             }
             else
@@ -856,301 +1079,518 @@ class PolyhedronUtils
       // No edges intersect, so we can safely insert then as constraints to the
       // triangulation
     }
+#endif
 
     // Insert the edges around the facet as constraints to the triangulation
     for (std::size_t i = 0; i < vertices.size(); i++)
     {
+      // std::cout << "Insert constraint: (" << i << ") " << vertices[i]->point() << ", (" << (i+1)%vertices.size() << ") " << vertices[(i+1)%vertices.size()]->point() << std::endl;
       cdt.insert_constraint(vertices[i], vertices[(i+1)%vertices.size()]);
     }
 
     // std::cout << "Done triangulating" << std::endl;
     // std::cout << "Num vertices: " << cdt.number_of_vertices() << std::endl;
 
-    // Create mesher
-    CGAL_Mesher_2 mesher(cdt);
+    if (refine)
+    {
+      // Create mesher
+      CGAL_Mesher_2 mesher(cdt);
 
-    // Set shape and size criteria
-    mesher.set_criteria(Mesh_criteria_2(.125, std::sqrt(max_squared_edge_length)));
+      // Set shape and size criteria
+      mesher.set_criteria(Mesh_criteria_2(.125, 2*std::sqrt(max_squared_edge_length)));
 
-    // Refine CGAL mesh/triangulation
-    mesher.refine_mesh();
+      // No size criteria, only shape
+      //mesher.set_criteria(Mesh_criteria_2());
 
-    // std::cout << "Done meshing. Num vertices: " << cdt.number_of_vertices() << std::endl;
+      std::cout << "Max edge length: " << 2*std::sqrt(max_squared_edge_length) << std::endl;
 
-    // Collecting faces inside the polygon
-    std::set<typename CDT::Face_handle> faces_inside;
-    std::size_t num_cells = 0;
-    for (typename CDT::Finite_faces_iterator cgal_cell = cdt.finite_faces_begin();
-         cgal_cell != cdt.finite_faces_end(); ++cgal_cell)
+      // Refine CGAL mesh/triangulation
+      std::cout << "Refining 2D mesh" << std::endl;
+      mesher.refine_mesh();
+    }
+    else
     {
-      // Add cell if it is in the domain
-      if (cgal_cell->is_in_domain())
+      for (auto f = cdt.finite_faces_begin(); f != cdt.finite_faces_end(); f++)
       {
-        faces_inside.insert(cgal_cell);
-        num_cells++;
+        f->set_in_domain(true);
       }
     }
 
-    // std::cout << "Collected " << num_cells << " faces inside" << std::endl;
+    std::cout << "Done meshing. Num vertices: " << cdt.number_of_vertices() << std::endl;
 
-    // Check if any of the triangles will intersect when transformed back to
-    // the polyhedron.
-    /* std::cout << "Checking if triangulation can be inserted without introducing self intersections" << std::endl; */
+    {
+      double shortest_edge = std::numeric_limits<double>::max();
+      double smallest_triangle = std::numeric_limits<double>::max();
+      for (auto f = cdt.finite_faces_begin(); f != cdt.finite_faces_end(); f++)
+      {
+        if (f->is_in_domain())
+        {
+          for (int i = 0; i < 3; i++)
+            shortest_edge = std::min(shortest_edge,
+                                     CGAL::to_double((f->vertex(i)->point()-f->vertex((i+1)%3)->point()).squared_length()));
+          InexactTriangle_2 t(f->vertex(0)->point(),
+                              f->vertex(1)->point(),
+                              f->vertex(2)->point());
+          smallest_triangle = std::min(smallest_triangle, CGAL::to_double(CGAL::abs(t.area())));
+        }
+      }
 
-    /* std::vector<Triangle_3> triangle_set; */
+      std::cout << "Shortest edge in 2D triangulation: " << shortest_edge << std::endl;
+      std::cout << "Smallest triangle in 2D triangulation: " << smallest_triangle << std::endl;
+    }
 
-    /* // Collect neighbor triangles */
-    /* Halfedge_handle current = h; */
-    /* do */
-    /* { */
-    /*   if (!current->opposite()->is_border() && current->opposite()->facet()->facet_degree() == 3) */
-    /*   { */
-    /*     triangle_set.push_back(get_facet_triangle<Polyhedron>(current->opposite())); */
-    /*   } */
-    /*   current = current->next(); */
-    /* } while (current != h); */
+    //P.normalize_border();
+    // dolfin_assert(P.is_valid(false, 1));
 
-    /* const auto rotate_back = rotation.inverse(); */
+    // add the triangulation to the polyhedron
 
-    /* for (auto fit = faces_inside.begin(); fit != faces_inside.end(); ++fit) */
-    /* { */
-    /*   Point_3 t0; */
-    /*   if ((*fit)->vertex(0)->info() != Vertex_handle()) */
-    /*     t0 = (*fit)->vertex(0)->info()->point(); */
-    /*   else */
-    /*   { */
-    /*     InexactPoint_3 t_ = rotate_back.transform(InexactPoint_3( (*fit)->vertex(0)->point()[0], */
-    /*                                                               (*fit)->vertex(0)->point()[1], */
-    /*                                                               z)); */
-    /*     t0 = Point_3(t_[0], t_[1], t_[2]); */
-    /*   } */
+    dump_2D_triangulation(cdt, "triangulation2D.off");
 
-    /*   Point_3 t1; */
-    /*   if ((*fit)->vertex(1)->info() != Vertex_handle()) */
-    /*     (*fit)->vertex(1)->info()->point(); */
-    /*   else */
-    /*   { */
-    /*     InexactPoint_3 t_ = rotate_back.transform(InexactPoint_3( (*fit)->vertex(1)->point()[0], */
-    /*                                                               (*fit)->vertex(1)->point()[1], */
-    /*                                                               z)); */
-    /*     t1 = Point_3(t_[0], t_[1], t_[2]); */
-    /*   } */
+    Add2DTriangulation<typename Polyhedron::HalfedgeDS, CDT> builder(cdt,
+                                                                     to_xy.inverse(),
+                                                                     vertices[0],
+                                                                     vertices[1],
+                                                                     plane_normal*.001);
+    P.delegate(builder);
 
-    /*   Point_3 t2; */
-    /*   if ((*fit)->vertex(2)->info() != Vertex_handle()) */
-    /*     t2 = (*fit)->vertex(2)->info()->point(); */
-    /*   else */
-    /*   { */
-    /*     InexactPoint_3 t_ = rotate_back.transform(InexactPoint_3( (*fit)->vertex(2)->point()[0], */
-    /*                                                               (*fit)->vertex(2)->point()[1], */
-    /*                                                               z)); */
-    /*     t2 = Point_3(t_[0], t_[1], t_[2]); */
-    /*   } */
+    std::cout << "Inserted: " << builder.new_facets.size() << " new facets" << std::endl;
 
-    /*   Triangle_3 t(t0, t1, t2); */
-    /*   if (triangle_set_intersect_triangle(t, triangle_set)) */
-    /*   { */
-    /*     std::cout << "2D triangulation cancelled! Will introduce self intersections" << std::endl; */
-    /*     { int tmp; std::cin >> tmp; } */
-    /*     return false; */
-    /*   } */
+    // Find the border edge incident to "inserted h"
+    const typename Polyhedron::Halfedge_around_vertex_circulator start = builder.v0->vertex_begin();
+    typename Polyhedron::Halfedge_around_vertex_circulator current = start;
 
-    /*   triangle_set.push_back(t); */
-    /* } */
+    do
+    {
+      if (current->opposite()->vertex() == builder.v1)
+      {
+        std::cout << "Found the edge" << std::endl;
+        break;
+      }
+      std::cout << "Advancing" << std::endl;
+      current++;
+    } while (current != start);
+
+    const typename Polyhedron::Halfedge_handle h_new = current->is_border() ? current : current->opposite();
 
-    /* std::cout << "  Done" << std::endl; */
+    if (!h_new->is_border())
+    {
+      std::cout << "Is border edge: " << h_new->is_border_edge() << std::endl;
+      dolfin::dolfin_error("Polyhedron_utils.h",
+                           "Locating border edge",
+                           "locating border edge");
+    }
 
-    // Triangles did not intersect any of the surrounding triangles
+    std::cout << "2D: " << vertices[0]->point() << std::endl;
+    std::cout << "Original: " << h->vertex()->point() << std::endl;
+    std::cout << "Original Next: " << h->next()->vertex()->point() << std::endl;
+    std::cout << "Original prev: " << h->prev()->vertex()->point() << std::endl;
+    std::cout << "Inserted: " << h_new->vertex()->point() << std::endl;
+    std::cout << "Inserted next: " << h_new->next()->vertex()->point() << std::endl;
+    std::cout << "Inserted prev: " << h_new->prev()->vertex()->point() << std::endl;
+    std::cout << "Vertex degree: " << h_new->vertex()->vertex_degree() << std::endl;
 
-    dolfin_assert(cdt.is_valid());
 
-    // Triangulation_inserter<Polyhedron, CDT> modifier(cdt, rotation.inverse(), z, h);
-    // P.delegate(modifier);
+    std::cout << "Joining loop" << std::endl;
 
-    std::set<typename CDT::Face_handle> faces;
-    for (typename CDT::Finite_faces_iterator fit = cdt.finite_faces_begin();
-         fit != cdt.finite_faces_end(); fit++)
     {
-      if (fit->is_in_domain())
-        faces.insert(fit);
+      Halfedge_handle a = h_new;
+      Halfedge_handle b = h;
+      double max_distance = 0.;
+      do
+      {
+        max_distance = std::max(max_distance, CGAL::to_double((a->vertex()->point()-b->vertex()->point()).squared_length()));
+
+        a = a->next();
+        b = b->prev();
+      } while (a != h_new);
+      std::cout << "Max distance between merged vertices: " << max_distance << std::endl;
     }
-    // std::cout << "Faces to be insered: " << faces.size() << std::endl;
-    // std::size_t countdown = faces.size()+40;
 
-    // TODO: This works, but is incredibly slow for large holes. Should be
-    // possible to insert the new vertices and edges directly to the HDS of the
-    // polyhedron using a modifier.
+    {
+      double shortest_edge = std::numeric_limits<double>::max();
+      for (auto e = P.halfedges_begin(); e != P.halfedges_end(); e++)
+      {
+        shortest_edge = std::min(shortest_edge, CGAL::to_double((e->vertex()->point()-e->opposite()->vertex()->point()).squared_length()));
+      }
+
+      std::cout << "Shortest edge: " << shortest_edge << std::endl;
+    }
 
-    while (faces.size() > 0)
     {
-      // std::cout << "---- Face iteration (outer): " << h->facet()->facet_degree() << std::endl;
-      auto fit = faces.begin();
-      while (fit != faces.end())
+      double smallest_triangle = std::numeric_limits<double>::max();;
+      for (auto f = P.facets_begin(); f != P.facets_end(); f++)
       {
-        dolfin_assert(P.is_valid());
+        auto h = f->halfedge();
+        if (f->is_triangle())
+        {
+          typename Polyhedron::Traits::Triangle_3 t(h->vertex()->point(),
+                                                    h->next()->vertex()->point(),
+                                                    h->next()->next()->vertex()->point());
+          smallest_triangle = std::min(smallest_triangle,
+                                      CGAL::to_double(t.squared_area()));
+        }
+      }
+      std::cout << "Smallest triangle before join: " << smallest_triangle << std::endl;
+    }
+
+
+    //
+    P.join_loop(h, h_new);
+
+    {
+      double shortest_edge = std::numeric_limits<double>::max();
+      for (auto e = P.halfedges_begin(); e != P.halfedges_end(); e++)
+      {
+        shortest_edge = std::min(shortest_edge, CGAL::to_double((e->vertex()->point()-e->opposite()->vertex()->point()).squared_length()));
+      }
+
+      std::cout << "Shortest edge after merge: " << shortest_edge << std::endl;
+    }
+
+    {
+      double smallest_triangle = std::numeric_limits<double>::max();;
+      for (auto f = P.facets_begin(); f != P.facets_end(); f++)
+      {
+        auto h = f->halfedge();
+        if (f->is_triangle())
+        {
+          typename Polyhedron::Traits::Triangle_3 t(h->vertex()->point(),
+                                                    h->next()->vertex()->point(),
+                                                    h->next()->next()->vertex()->point());
+          smallest_triangle = std::min(smallest_triangle,
+                                      CGAL::to_double(t.squared_area()));
+        }
+      }
+      std::cout << "Smallest triangle: " << smallest_triangle << std::endl;
+    }
+
+
+
+    std::cout << "H degree: " << h->facet()->facet_degree() << std::endl;
+    std::cout << "Hole: " << (h->is_border_edge() ? "Yes" : "No") << std::endl;
+
+    return true;
+  }
+  //-----------------------------------------------------------------------------
+  template <typename Polyhedron>
+  static std::pair<double, double> evaluate_planarity(const typename Polyhedron::Halfedge_handle from,
+                                                      const typename Polyhedron::Halfedge_handle to)
+  {
+    typedef typename Polyhedron::Halfedge_handle Halfedge_handle;
+    typedef CGAL::Exact_predicates_inexact_constructions_kernel InexactKernel;
+    typedef typename InexactKernel::Plane_3 InexactPlane_3;
+    typedef typename InexactKernel::Segment_3 InexactSegment_3;
+    typedef typename InexactKernel::Vector_3 InexactVector_3;
+    typedef typename InexactKernel::Point_3 InexactPoint_3;
+    typedef typename Polyhedron::Traits::Point_3 Point_3;
+
+    std::vector<InexactSegment_3> segments;
+    Halfedge_handle current = from;
+    while (current != to)
+    {
+      const Point_3& s1 = current->vertex()->point();
+      const Point_3& s2 = current->next()->vertex()->point();
+      segments.push_back(InexactSegment_3(InexactPoint_3(CGAL::to_double(s1[0]),
+                                                         CGAL::to_double(s1[1]),
+                                                         CGAL::to_double(s1[2])),
+                                          InexactPoint_3(CGAL::to_double(s2[0]),
+                                                         CGAL::to_double(s2[1]),
+                                                         CGAL::to_double(s2[2]))));
+      current = current->next();
+    }
+
+    InexactPlane_3 fitting_plane;
+    CGAL::linear_least_squares_fitting_3(segments.begin(),
+                                         segments.end(),
+                                         fitting_plane,
+                                         CGAL::Dimension_tag<1>());
+
+    const InexactVector_3 orthogonal_vector = fitting_plane.orthogonal_vector()/sqrt(CGAL::to_double(fitting_plane.orthogonal_vector().squared_length()));
+
+    dolfin_assert(dolfin::near(orthogonal_vector.squared_length(), 1., DOLFIN_EPS_LARGE));
+
+    double max_distance = 0.;
+    double min_cos_angle = 1.;
+
+    current = from;;
+    while (current != to)
+    {
+      const Point_3& p1 = current->vertex()->point();
+      const InexactPoint_3 p1_inexact(CGAL::to_double(p1[0]),
+                                      CGAL::to_double(p1[1]),
+                                      CGAL::to_double(p1[2]));
+
+      const Point_3& next = current->next()->vertex()->point();
+      const InexactPoint_3 next_inexact(CGAL::to_double(next[0]),
+                                        CGAL::to_double(next[1]),
+                                        CGAL::to_double(next[2]));
+
+      const InexactVector_3 current_vector = (p1_inexact-next_inexact)/sqrt(CGAL::to_double((p1_inexact-next_inexact).squared_length()));
+      dolfin_assert(dolfin::near(current_vector.squared_length(), 1., DOLFIN_EPS_LARGE));
 
-        typename std::set<typename CDT::Face_handle>::iterator f = fit;
-        fit++;
+      // Check if the angle between this vector and the fitting plane is acceptable
+      min_cos_angle = std::min(min_cos_angle,
+                               CGAL::abs(current_vector*orthogonal_vector));
 
-        dolfin_assert(!h->is_border());
+      max_distance = std::max(max_distance,
+                              sqrt((p1_inexact-fitting_plane.projection(p1_inexact)).squared_length()));
+
+      current = current->next();
+    }
+
+    return std::make_pair(max_distance, min_cos_angle);
+  }
+  //-----------------------------------------------------------------------------
+  template <typename Polyhedron>
+  static std::pair<typename Polyhedron::Halfedge_handle, typename Polyhedron::Halfedge_handle>
+  find_best_cut (Polyhedron& P,
+                 const typename Polyhedron::Halfedge_handle h,
+                 double cos_angle_tolerance)
+  {
+    typedef typename Polyhedron::Halfedge_handle Halfedge_handle;
+    typedef typename Polyhedron::Traits::Point_3 Point_3;
+    typedef CGAL::Exact_predicates_inexact_constructions_kernel InexactKernel;
+    typedef typename InexactKernel::Plane_3 InexactPlane_3;
+    typedef typename InexactKernel::Point_3 InexactPoint_3;
+    typedef typename InexactKernel::Vector_3 InexactVector_3;
+    typedef typename InexactKernel::Segment_3 InexactSegment_3;
+
+    Halfedge_handle h1_distance, h2_distance;
+    double min_distance = std::numeric_limits<double>::max();
+
+    Halfedge_handle h1_angle, h2_angle;
+    double min_cos_normal = std::numeric_limits<double>::max();
+
+    Halfedge_handle current1 = h->next()->next();
+    const Halfedge_handle current1_end = h->prev()->prev();
+    do
+    {
+      // std::cout << "Current1 " << current1->vertex()->point() << std::endl;
+      Halfedge_handle current2 = current1->next()->next();
+      const Halfedge_handle current2_end = current1->prev();
+      do
+      {
+        /* std::cout << "  Current 2" << std::endl; */
+        /* std::cout << "Segment " << current1->vertex()->point() << ", " << current2->vertex()->point() << std::endl; */
 
-        std::array<typename CDT::Vertex_handle, 3> vertices{{(*f)->vertex(0),
-                                                             (*f)->vertex(1),
-                                                             (*f)->vertex(2)}};
+        double max_distance_local = 0.;
+        double max_cos_normal_local = 0;
 
-        if (vertices[0]->info() != Vertex_handle() &&
-            vertices[1]->info() != Vertex_handle() &&
-            vertices[2]->info() != Vertex_handle())
+        // Compute fitting plane of segments from current1 to current2
+        // std::cout << "Compute fit plane 1" << std::endl;
         {
-          // ear cut, all vertices already exists
-          // std::cout << "All vertices present" << std::endl;
-          const Facet_handle common_facet = find_common_facet<Polyhedron>(vertices[0]->info(),
-                                                                          vertices[1]->info(),
-                                                                          vertices[2]->info());
-          if (common_facet->facet_degree() > 3)
+          InexactPlane_3 fitting_plane;
+          std::vector<InexactSegment_3> segments;
+          Halfedge_handle current3 = current1;
+          while (current3 != current2)
           {
-            dolfin_assert(common_facet == h->facet());
-            std::array<Halfedge_handle, 3> halfedges {{find_edge<Polyhedron>(vertices[0]->info(), h->facet()),
-                                                       find_edge<Polyhedron>(vertices[1]->info(), h->facet()),
-                                                       find_edge<Polyhedron>(vertices[2]->info(), h->facet())}};
-
-            /* std::cout << "Vertices: " << std::distance(P.halfedges_begin(), halfedges[0]) << ", " */
-            /*           << std::distance(P.halfedges_begin(), halfedges[1]) << ", " */
-            /*           << std::distance(P.halfedges_begin(), halfedges[2]) << std::endl; */
-
-            /* std::cout << "0: " << std::distance(P.halfedges_begin(), halfedges[0]->prev()) << " - " */
-            /*           << std::distance(P.halfedges_begin(), halfedges[0]) << " - " */
-            /*           << std::distance(P.halfedges_begin(), halfedges[0]->next()) << std::endl; */
-            /* std::cout << "1: " << std::distance(P.halfedges_begin(), halfedges[1]->prev()) << " - " */
-            /*           << std::distance(P.halfedges_begin(), halfedges[1]) << " - " */
-            /*           << std::distance(P.halfedges_begin(), halfedges[1]->next()) << std::endl; */
-            /* std::cout << "2: " << std::distance(P.halfedges_begin(), halfedges[2]->prev()) << " - " */
-            /*           << std::distance(P.halfedges_begin(), halfedges[2]) << " - " */
-            /*           << std::distance(P.halfedges_begin(), halfedges[2]->next()) << std::endl; */
-
-            // Check how many edges are already present
-            // insert edge (2 <--> 0), ie cut 1
-            if ((halfedges[2]->next() == halfedges[1] &&
-                 halfedges[2]->next()->next() == halfedges[0]) ||
-                (halfedges[0]->next() == halfedges[1] &&
-                 halfedges[0]->next()->next() == halfedges[2]))
-            {
-              // std::cout << "inserting (2-0)" << std::endl;
-              h = halfedges[1]->next()->next();
-              P.split_facet(halfedges[2], halfedges[0]);
-            }
-            // insert edge (2 <--> 1), ie cut 0
-            else if ((halfedges[1]->next() == halfedges[0] &&
-                        halfedges[1]->next()->next() == halfedges[2]) ||
-                       (halfedges[2]->next() == halfedges[0] &&
-                        halfedges[2]->next()->next() == halfedges[1]))
-            {
-              // std::cout << "inserting (2-1)" << std::endl;
-              h = halfedges[0]->next()->next();
-              P.split_facet(halfedges[2], halfedges[1]);
-            }
-            // insert edge (0 <--> 1), ie cut 2
-            else if ((halfedges[0]->next() == halfedges[2] &&
-                      halfedges[0]->next()->next() == halfedges[1]) ||
-                     (halfedges[1]->next() == halfedges[2] &&
-                      halfedges[1]->next()->next() == halfedges[0]))
-            {
-              // std::cout << "inserting (0-1)" << std::endl;
-              h = halfedges[2]->next()->next();
-              P.split_facet(halfedges[0], halfedges[1]);
-            }
-            else
-            {
-              // Note that even if all the vertices have been inserted, we may
-              // miss edges
-              continue;
-            }
+            const Point_3& s1 = current3->vertex()->point();
+            const Point_3& s2 = current3->next()->vertex()->point();
+            segments.push_back(InexactSegment_3(InexactPoint_3(CGAL::to_double(s1[0]),
+                                                               CGAL::to_double(s1[1]),
+                                                               CGAL::to_double(s1[2])),
+                                                InexactPoint_3(CGAL::to_double(s2[0]),
+                                                               CGAL::to_double(s2[1]),
+                                                               CGAL::to_double(s2[2]))));
+            current3 = current3->next();
           }
 
-          // print sometimes
-          /* if (countdown-faces.size() > 100) */
-          /* { */
-          /*   std::cout << "Face iteration (inner): " << faces.size() << std::endl; */
-          /*   countdown = faces.size(); */
-          /* } */
+          /* const double fit_quality = */
+          CGAL::linear_least_squares_fitting_3(segments.begin(),
+                                               segments.end(),
+                                               fitting_plane,
+                                               CGAL::Dimension_tag<1>());
+          const InexactVector_3 orthogonal_vector = fitting_plane.orthogonal_vector()/sqrt(CGAL::to_double(fitting_plane.orthogonal_vector().squared_length()));
+
+          // std::cout << "Plane vector length: " << (CGAL::abs(orthogonal_vector.squared_length())-1) << std::endl;
+          dolfin_assert(dolfin::near(orthogonal_vector.squared_length(), 1., DOLFIN_EPS_LARGE));
+
+          current3 = current1;
+          while (current3 != current2)
+          {
+            const Point_3& p1 = current3->vertex()->point();
+            const InexactPoint_3 p1_inexact(CGAL::to_double(p1[0]),
+                                            CGAL::to_double(p1[1]),
+                                            CGAL::to_double(p1[2]));
+
+            const Point_3& next = current3->next()->vertex()->point();
+            const InexactPoint_3 next_inexact(CGAL::to_double(next[0]),
+                                              CGAL::to_double(next[1]),
+                                              CGAL::to_double(next[2]));
+
+            const InexactVector_3 current_vector = (p1_inexact-next_inexact)/sqrt(CGAL::to_double((p1_inexact-next_inexact).squared_length()));
+            dolfin_assert(dolfin::near(current_vector.squared_length(), 1., DOLFIN_EPS_LARGE));
+
+            // Check if angle between this vector and the fitting plane is acceptable
+            max_cos_normal_local = std::max(max_cos_normal_local, CGAL::abs(current_vector*orthogonal_vector));
+
+            max_distance_local = std::max(max_distance_local,
+                                          CGAL::to_double((p1_inexact-fitting_plane.projection(p1_inexact)).squared_length()));
 
-          faces.erase(f);
-          continue;
+            current3 = current3->next();
+          }
         }
-        else
+
+        // std::cout << "Done evaluating candidate: " << std::endl;
+
+        // Compute fitting plane of segments from current2 to current1
         {
-          for (std::size_t i = 0; i < 3; i++)
+          InexactPlane_3 fitting_plane;
+          std::vector<InexactSegment_3> segments;
+          Halfedge_handle current3 = current2;
+          while (current3 != current1)
           {
-            if (vertices[i]->info() != Vertex_handle() &&
-                vertices[(i+1)%3]->info() == Vertex_handle() &&
-                vertices[(i+2)%3]->info() != Vertex_handle())
-            {
-              // std::cout << "vertex insertion (" << i << ")" << std::endl;
-              Halfedge_handle h1 = find_edge<Polyhedron>(vertices[i]->info(), h->facet());
-              Halfedge_handle h2 = find_edge<Polyhedron>(vertices[(i+2)%3]->info(), h->facet());
+            const Point_3& s1 = current3->vertex()->point();
+            const Point_3& s2 = current3->next()->vertex()->point();
+            segments.push_back(InexactSegment_3(InexactPoint_3(CGAL::to_double(s1[0]),
+                                                               CGAL::to_double(s1[1]),
+                                                               CGAL::to_double(s1[2])),
+                                                InexactPoint_3(CGAL::to_double(s2[0]),
+                                                               CGAL::to_double(s2[1]),
+                                                               CGAL::to_double(s2[2]))));
+            current3 = current3->next();
+          }
 
-              if (h1->next() != h2)
-              {
-                Halfedge_handle tmp = h1;
-                h1 = h2;
-                h2 = tmp;
-              }
-              if (h1->next() != h2)
-                break;
+          /* const double fit_quality = */ CGAL::linear_least_squares_fitting_3(segments.begin(),
+                                                                          segments.end(),
+                                                                          fitting_plane,
+                                                                          CGAL::Dimension_tag<1>());
 
-              dolfin_assert(h1->next() == h2);
-
-              h = h2->next();
-
-              // We are not allowed to introduce multiedges, so we can't do
-              // split_facet(h1, h2)
-              // Split facet w
-              // std::cout << "adding diagonal" << std::endl;
-              Halfedge_handle new_diagonal = P.split_facet(h2, h2->next()->next());
-              dolfin_assert(new_diagonal->prev() == h2);
-              // std::cout << "Adding new vertex" << std::endl;
-              Halfedge_handle new_vertex = P.split_edge(new_diagonal);
-              dolfin_assert(new_vertex->prev() == h2);
-              // std::cout << "Rotating back" << std::endl;
-              const auto rotate_back = rotation.inverse();
-              InexactPoint_3 new_point = rotate_back.transform(InexactPoint_3(vertices[(i+1)%3]->point()[0],
-                                                                              vertices[(i+1)%3]->point()[1],
-                                                                              z));
-              new_vertex->vertex()->point() = Point_3(new_point[0],
-                                                      new_point[1],
-                                                      new_point[2]);
-
-              //Vertex_handle v = new_vertex->vertex();
-              typename CDT::Vertex_handle v_vdt = vertices[(i+1)%3];
-              // std::cout << "Setting new vertex as info" << std::endl;
-
-              vertices[(i+1)%3]->info() = new_vertex->vertex();
-              // std::cout << "Splitting facet" << std::endl;
-              P.split_facet(h1, new_vertex);
-
-              dolfin_assert(h2->facet()->facet_degree() == 3);
-              dolfin_assert(h2->prev()->vertex() == h1->vertex());
-              // std::cout << "Joining facet" << std::endl;
-              P.join_facet(new_diagonal);
-
-              //dolfin_assert(edge_count(h2) == 3);
-              // std::cout << "New facet size: " << h->facet()->facet_degree() << std::endl;
-              // std::cout << "Erasing facet" << std::endl;
-              faces.erase(f);
-              // std::cout << "Breaking" << std::endl;
-              break;
-            }
+          const InexactVector_3 orthogonal_vector = fitting_plane.orthogonal_vector()/sqrt(CGAL::to_double(fitting_plane.orthogonal_vector().squared_length()));
+          // const double angle_tolerance = .5;
+          // std::cout << "Plane vector length: " << (CGAL::abs(orthogonal_vector.squared_length())-1) << std::endl;
+          dolfin_assert(dolfin::near(CGAL::to_double(orthogonal_vector.squared_length()), 1., DOLFIN_EPS_LARGE));
+
+          current3 = current2;
+          while (current3 != current1)
+          {
+            const Point_3& p1 = current3->vertex()->point();
+            const InexactPoint_3 p1_inexact(CGAL::to_double(p1[0]),
+                                            CGAL::to_double(p1[1]),
+                                            CGAL::to_double(p1[2]));
+
+            const Point_3& next = current3->next()->vertex()->point();
+            const InexactPoint_3 next_inexact(CGAL::to_double(next[0]),
+                                              CGAL::to_double(next[1]),
+                                              CGAL::to_double(next[2]));
+
+            const InexactVector_3 current_vector = (p1_inexact-next_inexact)/sqrt(CGAL::to_double((p1_inexact-next_inexact).squared_length()));
+            dolfin_assert(dolfin::near(CGAL::to_double(current_vector.squared_length()), 1., DOLFIN_EPS_LARGE));
+
+            // Check if the angle between this vector and the fitting plane is acceptable
+            max_cos_normal_local = std::max(max_cos_normal_local, CGAL::abs(current_vector*orthogonal_vector));
+
+            max_distance_local = std::max(max_distance_local,
+                                          CGAL::to_double((p1_inexact-fitting_plane.projection(p1_inexact)).squared_length()));
+
+            current3 = current3->next();
           }
         }
-      }
+
+        // std::cout << "Done evaluating other half: " << std::endl;
+
+        if (max_distance_local < min_distance)
+        {
+          // std::cout << "New min split" << std::endl;
+          min_distance = max_distance_local;
+          h1_distance = current1;
+          h2_distance = current2;
+        }
+
+        if (max_cos_normal_local < min_cos_normal)
+        {
+          min_cos_normal = max_cos_normal_local;
+          h1_angle = current1;
+          h2_angle = current2;
+        }
+
+        current2 = current2->next();
+      } while (current2 != current2_end);
+
+      current1 = current1->next();
+    } while (current1 != current1_end);
+
+    std::cout << "Best cut, distance=" << min_distance << " : Segment " << h1_distance->vertex()->point() << ", " << h2_distance->vertex()->point() << std::endl;
+    std::cout << "Best cut, angle=" << min_cos_normal << " : Segment " << h1_angle->vertex()->point() << ", " << h2_angle->vertex()->point() << std::endl;
+
+
+    return std::make_pair(h1_angle, h2_angle);
+  }
+  //-----------------------------------------------------------------------------
+  template <typename Polyhedron>
+  static bool split_hole_planar(Polyhedron& P,
+                                typename Polyhedron::Halfedge_handle h)
+  {
+    typedef typename Polyhedron::Halfedge_handle Halfedge_handle;
+    typedef typename Polyhedron::Traits::Vector_3 Vector_3;
+
+    std::cout << "Split hole" << std::endl;
+
+    const std::pair<Halfedge_handle, Halfedge_handle> best_cut = find_best_cut(P, h, .3);
+
+    std::cout << "Found best cut" << std::endl;
+    if (best_cut.first == Halfedge_handle() || best_cut.second == Halfedge_handle())
+      return false;
+
+
+    const std::pair<double, double> planarity1 = evaluate_planarity<Polyhedron>(best_cut.first, best_cut.second);
+    const std::pair<double, double> planarity2 = evaluate_planarity<Polyhedron>(best_cut.second, best_cut.first);
+
+    std::cout << "Planarity: " << planarity1.first << " vs " << planarity2.first << std::endl;
+
+    const Halfedge_handle start = planarity1.first < planarity2.first ? best_cut.first : best_cut.second;
+    const Halfedge_handle end   = planarity1.first < planarity2.first ? best_cut.second : best_cut.first;
+
+    // Compute average edge length
+    double length = 0.;
+    int num_edges = 0;
+    Halfedge_handle current = best_cut.first;
+    do
+    {
+      length += sqrt(CGAL::to_double((current->vertex()->point()-current->next()->vertex()->point()).squared_length()));
+      num_edges++;
+    } while (current != best_cut.first);
+
+    length /= num_edges;
+
+    const Vector_3 cut = start->vertex()->point() - end->vertex()->point();
+    const double cut_length = sqrt(CGAL::to_double(cut.squared_length()));
+    const int num_new_edges = static_cast<int>(cut_length/length);
+
+    P.fill_hole(h);
+
+    Halfedge_handle new_diagonal = P.split_facet(end, start);
+    // Now new_diagonal is on the facet to be
+
+    std::cout << "Inserting " << num_new_edges << " vertices from " << start->vertex()->point() << " to " << end->vertex()->point() << std::endl;
+    for (int i = 1; i < num_new_edges; i++)
+    {
+      Halfedge_handle hnew = P.split_edge(new_diagonal);
+      hnew->vertex()->point() = end->vertex()->point() + cut*i/num_new_edges;
+      // std::cout << "  " << i << ": " << hnew->vertex()->point() << (hnew->vertex()->point()-hnew->opposite()->vertex()->point()).squared_length() << std::endl;
     }
 
-    //P.normalize_border();
-    // dolfin_assert(P.is_valid(false, 1));
+    /* Halfedge_handle c = new_diagonal; */
+    /* do */
+    /* { */
+    /*   std::cout << "Edge: " << c->vertex()->point() << " <--> " << c->opposite()->vertex()->point() << " : " << (c->vertex()->point()-c->opposite()->vertex()->point()).squared_length() << std::endl; */
+    /*   c = c->next(); */
+    /* } while (c != new_diagonal); */
+
+
+    const Halfedge_handle opposite = new_diagonal->opposite();
+    P.make_hole(new_diagonal);
+    const bool success = triangulate_polygon_3d(P, new_diagonal);
+    //dolfin_assert(success);
+
+    P.make_hole(opposite);
+    if (!success)
+      return false;
 
     return true;
   }
   //-----------------------------------------------------------------------------
+
   /* template <typename Polyhedron> */
   /* void min_vertex_degree(const Polyhedron& p) */
   /* { */
@@ -1168,10 +1608,10 @@ class PolyhedronUtils
   /* } */
   //-----------------------------------------------------------------------------
   template<typename Polyhedron>
-  static void list_hole(typename Polyhedron::Halfedge_handle h)
+  static void list_hole(const typename Polyhedron::Halfedge_handle h)
   {
     std::size_t counter = 0;
-    // std::cout << "Polygon";
+    std::cout << "Polygon";
 
     {
       typename Polyhedron::Halfedge_handle current = h;
@@ -1187,12 +1627,12 @@ class PolyhedronUtils
       typename Polyhedron::Halfedge_handle current = h;
       do
       {
-        // std::cout << " " << current->vertex()->point() << ",";
+        std::cout << " " << current->vertex()->point() << ",";
 
         current = current->next();
       } while(current != h);
       // }
-      // std::cout << std::endl;
+      std::cout << std::endl;
 
       // std::cout << " size: " << counter << std::endl;
   }
@@ -1650,80 +2090,12 @@ class PolyhedronUtils
   }
   //-----------------------------------------------------------------------------
   template<typename Polyhedron>
-  static void triangulate_quad_facet(Polyhedron& P,
-                             typename Polyhedron::Halfedge_handle h)
-  {
-    typedef typename Polyhedron::Traits::Triangle_3 Triangle_3;
-
-    // std::cout << "Tringulating quad" << std::endl;
-    dolfin_assert(h->next()->next()->next()->next() == h);
-
-    //P.fill_hole(h);
-
-    if (get_triangle_cos_angle(Triangle_3(h->vertex()->point(),
-                                          h->next()->vertex()->point(),
-                                          h->next()->next()->vertex()->point()),
-                               Triangle_3(h->vertex()->point(),
-                                          h->next()->next()->vertex()->point(),
-                                          h->prev()->vertex()->point())) <
-        get_triangle_cos_angle(Triangle_3(h->next()->vertex()->point(),
-                                          h->next()->next()->vertex()->point(),
-                                          h->prev()->vertex()->point()),
-                               Triangle_3(h->vertex()->point(),
-                                          h->next()->vertex()->point(),
-                                          h->prev()->vertex()->point())))
-    {
-      // The edge should go from h <--> h->next()->next()
-      P.split_facet(h, h->next()->next());
-    }
-    else
-    {
-      // the edge should ho from h->next() <--> h->prev()
-      P.split_facet(h->next(), h->prev());
-    }
-  }
-  //-----------------------------------------------------------------------------
-  template<typename Polyhedron>
-  static void triangulate_5_facet(Polyhedron& P,
-                                  typename Polyhedron::Halfedge_handle h)
-  {
-    typedef typename Polyhedron::Halfedge_handle Halfedge_handle;
-    typedef typename Polyhedron::Traits::Triangle_3 Triangle_3;
-
-    double best_quality = 1;
-    Halfedge_handle best_triangle;
-    Halfedge_handle current = h;
-    do
-    {
-      const double candidate_quality = get_triangle_cos_angle(Triangle_3(current->next()->vertex()->point(),
-                                                                   current->next()->next()->vertex()->point(),
-                                                                   current->next()->next()->next()->vertex()->point()),
-                                                        Triangle_3(current->prev()->prev()->vertex()->point(),
-                                                                   current->prev()->vertex()->point(),
-                                                                   current->vertex()->point()));
-      if (candidate_quality < best_quality)
-      {
-        best_triangle = current;
-        best_quality = candidate_quality;
-      }
-
-      current = current->next();
-    } while (current != h);
-
-    //P.fill_hole(h);
-    P.split_facet(best_triangle->next(),
-                  best_triangle->next()->next()->next());
-    P.split_facet(best_triangle->next()->next(), best_triangle);
-  }
-  //-----------------------------------------------------------------------------
-  template<typename Polyhedron>
   static void close_hole(Polyhedron& P,
                          typename Polyhedron::Halfedge_handle h)
   {
     //typedef typename Polyhedron::Traits::Point_3 Point_3;
     typedef typename Polyhedron::Halfedge_handle Halfedge_handle;
 
-    // std::cout << "----------- Closing hole --------------------" << std::endl;
     dolfin_assert(P.is_valid(false, 0));
     dolfin_assert(P.is_pure_triangle());
     dolfin_assert(h->is_border());
@@ -1731,12 +2103,10 @@ class PolyhedronUtils
     P.fill_hole(h);
     P.normalize_border();
 
-    // std::cout << "Size of hole: " << h->facet()->facet_degree() << std::endl;
-    // list_hole<Polyhedron>(h);
-
     dolfin_assert(h->facet()->facet_degree() > 2);
 
     // Since the facet may be split, we push the facets to a fifo queue.
+    // Neighbor facets are now not guaranteed to be triangles.
     std::deque<Halfedge_handle> queue;
     queue.push_back(h);
 
@@ -1746,7 +2116,7 @@ class PolyhedronUtils
       const Halfedge_handle current = queue.front();
       queue.pop_front();
 
-      list_hole<Polyhedron>(current);
+      // list_hole<Polyhedron>(current);
 
       dolfin_assert(P.is_valid(false, 0));
       dolfin_assert(halfedge_is_in_polyhedron(P, current));
@@ -1764,14 +2134,6 @@ class PolyhedronUtils
                       !triangles_intersect(get_facet_triangle<Polyhedron>(current),
                                            get_facet_triangle<Polyhedron>(current->prev()->opposite())));
       }
-      else if (current->facet()->facet_degree() == 4)
-      {
-        triangulate_quad_facet(P, current);
-      }
-      /* else if (current->facet()->facet_degree() == 5) */
-      /* { */
-      /*   triangulate_5_facet(P, current); */
-      /* } */
       else
       {
         // std::cout << "Attempting to triangulate in 2D" << std::endl;
@@ -1780,43 +2142,11 @@ class PolyhedronUtils
         {
           dolfin_assert(halfedge_is_in_polyhedron(P, current));
 
-          // if (!center_vertex_triangulation(P, current))
-          // {
-            //std::pair<Halfedge_handle, Halfedge_handle> facets = subdivide_facet(P, current);
-            Halfedge_handle facet = subdivide_facet(P, current);
-            // dolfin_assert(facets.first != Halfedge_handle());
-            // dolfin_assert(facets.second != Halfedge_handle());
-
-            queue.push_back(facet->opposite());
-            queue.push_back(facet);
-            //queue.push_back(facets.first);
-            //queue.push_back(facets.second);
-            // }
-        }
-
-        /* std::cout << "Points are not coplanar" << std::endl; */
-        /* Polyhedron hole; */
-        /* std::cout << "Compute convex hull" << std::endl; */
-        /* CGAL::convex_hull_3(points.begin(), points.end(), hole); */
-        /* {std::ofstream f("convex_hull.off"); f << hole; } */
-
-        /* // Find intersection polyline */
-        /* std::list<std::vector<Point_3> > intersection_polylines; */
-
-        /* // Search for a common vertex */
-        /* /\* bool found; *\/ */
-        /* /\* Halfedge_handle current = h; *\/ */
-        /* /\* do *\/ */
-        /* /\* { *\/ */
-
-        /* /\*   current = current->next(); *\/ */
-        /* /\* } while (current != h); *\/ */
-
-        /* CGALCSGOperator op; */
+          Halfedge_handle facet = subdivide_facet(P, current);
 
-        /* std::cout << "Computing union" << std::endl; */
-        /* op(P, hole, std::back_inserter(intersection_polylines), CGALCSGOperator::Join_tag); */
-        /* std::cout << "Done computing union" << std::endl; */
+          queue.push_back(facet->opposite());
+          queue.push_back(facet);
+        }
       }
     }
   }
@@ -1831,8 +2161,9 @@ class PolyhedronUtils
     typedef typename Polyhedron::Traits::Segment_3 Segment_3;
     typedef typename Polyhedron::Traits::Vector_3 Vector_3;
 
-    // Search for triangles that divide the hole, such that the dividing triangle
-    // does not intersect triangles next to the hole
+    // Search for segments that divide the hole, such that the dividing segment
+    // does not intersect triangles next to the hole and the facets on each side
+    // of the split is as planar as possible.
 
     // Store all triangles around the hole and compute max edge length
     std::vector<Triangle_3> border_triangles;
@@ -1848,12 +2179,11 @@ class PolyhedronUtils
         {
           border_triangles.push_back(get_facet_triangle<Polyhedron>(current->opposite()));
         }
+
         current = current->next();
       } while (current != h);
     }
 
-    // std::cout << "Number of border triangles: " << border_triangles.size() << std::endl;
-    // std::cout << "Plane fit: " << get_plane_fit<Polyhedron>(h, h)[0] << std::endl;
     dolfin_assert(border_triangles.size() > 4);
 
     // Search for the best dividing segment
@@ -1879,19 +2209,10 @@ class PolyhedronUtils
           Segment_3 current_segment(current_outer->vertex()->point(),
                                     current_inner->vertex()->point());
 
-          /* std::cout << "Checking segment: Segment " << current_segment.source() << ", " << current_segment.target() */
-          /*           << " length: " << current_segment.squared_length() << std::endl; */
-
           // Check that this does not introduce an intersection
           if (!segment_intersects_triangle_set(current_segment, border_triangles))
           {
-            //const double side1_quality = get_plane_fit<Polyhedron>(current_outer, current_inner);
-            //const double side2_quality = get_plane_fit<Polyhedron>(current_inner, current_outer);
-            //const double candidate_quality = std::min(side1_quality, side2_quality);
             const double candidate_quality = evaluate_hole_subdivision<Polyhedron>(current_inner, current_outer);
-            //std::cout << "Plane qualities: " << side1_quality << ", " << side2_quality << std::endl;
-            // std::cout << "Segment " << current_inner->vertex()->point() << ", " << current_outer->vertex()->point() << " : " << candidate_quality << std::endl;
-            // std::cout << "Quality: " << candidate_quality << std::endl;
 
             if (candidate_quality > best_quality)
             {
@@ -1918,114 +2239,27 @@ class PolyhedronUtils
     //           << ", " << best_inner->vertex()->point() << std::endl;
     // std::cout << "Quality: " << best_quality << std::endl;
 
-    /* if (best_quality > .9) */
-    /* { */
-      dolfin_assert(P.is_valid(false, 0));
-      const Halfedge_handle new_diagonal = P.split_facet(best_inner, best_outer);
-      const Point_3& p = new_diagonal->opposite()->vertex()->point();
-
-      const Vector_3 new_edge(new_diagonal->opposite()->vertex()->point(),
-                              new_diagonal->vertex()->point());
-
-      const int num_segments = static_cast<int>(sqrt(CGAL::to_double(new_edge.squared_length())/max_squared_edge_length)+.5);
-
-      // std::cout << "Num segments: " << num_segments << std::endl;
-
-      // Note: Don't use std::size_t as 0-1 becomes very large...
-      for (int i = 1; i < num_segments; i++)
-      {
-        //std::cout << "Splitting segment" << std::endl;
-        Halfedge_handle new_segment = P.split_edge(new_diagonal);
-        new_segment->vertex()->point() = p + static_cast<double>(i)/num_segments * new_edge;
-      }
-
-      P.normalize_border();
-      dolfin_assert(P.is_valid(false, 0));
-      //return std::make_pair(new_diagonal, new_diagonal->opposite());
-      return new_diagonal;
-    /* } */
-    /* else */
-    /*   //return std::make_pair(Halfedge_handle(), Halfedge_handle()); */
-    /*   return Halfedge_handle(); */
-
-    /* Halfedge_handle v1, v2; */
-    /* best_quality = -1000; */
-
-    /* { */
-    /*   // Candidate 1: best_inner, best_inner->next(), best_outer */
-    /*   std::cout << "Candidate 1" << std::endl; */
-    /*   // Check the four candidates where the chosen segment is an edge */
-    /*   if (best_inner->next()->next() != best_outer) */
-    /*   { */
-    /*     const double candidate_quality= std::min(get_plane_fit<Polyhedron>(best_outer, best_inner), */
-    /*                                              get_plane_fit<Polyhedron>(best_inner->next(), best_outer)); */
-
-    /*     if (candidate_quality > best_quality) */
-    /*     { */
-    /*       v1 = best_outer; */
-    /*       v2 = best_inner; */
-    /*       best_quality = candidate_quality; */
-    /*     } */
-    /*   } */
-    /* } */
-
-    /* if (best_outer->next()->next() != best_inner) */
-    /* { */
-    /*   // Candidate 2: best_inner, best_outer, best_outer->next() */
-    /*   double candidate_quality = std::min(get_plane_fit<Polyhedron>(best_outer->next(), best_inner), */
-    /*                                       get_plane_fit<Polyhedron>(best_inner, best_outer)); */
-
-    /*   if (candidate_quality > best_quality) */
-    /*   { */
-    /*     std::cout << "Candidate 2" << std::endl; */
-    /*     v1 = best_inner; */
-    /*     v2 = best_outer; */
-    /*     best_quality = candidate_quality; */
-    /*   } */
-    /* } */
-
-    /* if (best_outer->next()->next() != best_inner) */
-    /* { */
-    /*   // Candidate 3: best_inner->prev(), best_inner, best_outer */
-    /*   const double candidate_quality = std::min(get_plane_fit<Polyhedron>(best_outer, best_inner->prev()), */
-    /*                                             get_plane_fit<Polyhedron>(best_inner, best_outer)); */
-
-    /*   if (candidate_quality > best_quality) */
-    /*   { */
-    /*     std::cout << "Candidate 3" << std::endl; */
-    /*     v1 = best_outer; */
-    /*     v2 = best_inner->prev(); */
-    /*     best_quality = candidate_quality; */
-    /*   } */
-    /* } */
-
-    /* if (best_inner->next()->next() != best_outer) */
-    /* { */
-    /*   // Candidate 4: best_inner, best_outer->prev(), best_outer */
-    /*   const double candidate_quality = std::min(get_plane_fit<Polyhedron>(best_outer, best_inner), */
-    /*                                             get_plane_fit<Polyhedron>(best_inner, best_outer->prev())); */
+    dolfin_assert(P.is_valid(false, 0));
+    const Halfedge_handle new_diagonal = P.split_facet(best_inner, best_outer);
+    const Point_3& p = new_diagonal->opposite()->vertex()->point();
 
-    /*   if (candidate_quality > best_quality) */
-    /*   { */
-    /*     std::cout << "Candidate 4" << std::endl; */
-    /*     v1 = best_inner; */
-    /*     v2 = best_outer->prev(); */
-    /*   } */
-    /* } */
+    const Vector_3 new_edge(new_diagonal->opposite()->vertex()->point(),
+                            new_diagonal->vertex()->point());
 
-    /* dolfin_assert(v1 != Halfedge_handle()); */
-    /* dolfin_assert(v2 != Halfedge_handle()); */
+    const int num_segments = static_cast<int>(sqrt(CGAL::to_double(new_edge.squared_length())/max_squared_edge_length)+.5);
 
-    /* // Divide hole by chosen triangle (v1, v2, v2->next()) */
-    /* Halfedge_handle f = P.fill_hole(h); */
-    /* dolfin_assert(v1->facet() == v2->facet()); */
+    // Note: Don't use std::size_t as 0-1 becomes very large...
+    for (int i = 1; i < num_segments; i++)
+    {
+      //std::cout << "Splitting segment" << std::endl;
+      Halfedge_handle new_segment = P.split_edge(new_diagonal);
+      new_segment->vertex()->point() = p + static_cast<double>(i)/num_segments * new_edge;
+    }
 
-    /* Halfedge_handle hole1 = P.split_facet(v1, v2->next()); */
-    /* Halfedge_handle hole2 = P.split_facet(v2, hole1->opposite()); */
-    /* P.make_hole(hole1); */
-    /* P.make_hole(hole2); */
+    P.normalize_border();
+    dolfin_assert(P.is_valid(false, 0));
 
-    /* return true; */
+    return new_diagonal;
   }
   //-----------------------------------------------------------------------------
   /* template<typename Polyhedron> */
@@ -2162,141 +2396,59 @@ class PolyhedronUtils
 
     return false;
   }
-
   //-----------------------------------------------------------------------------
-  /// Check if the triangle defined by (v, v2, v3) intersects any of the
-  /// triangular facets adjacent to v
   template<typename Polyhedron>
-  static bool facets_intersect(typename Polyhedron::Vertex_handle v,
-                               typename Polyhedron::Vertex_handle v2,
-                               typename Polyhedron::Vertex_handle v3)
+  static std::string list_self_intersections(Polyhedron& p)
   {
-    typedef typename Polyhedron::Traits::Point_3 Point_3;
-    typedef typename Polyhedron::Traits::Triangle_3 Triangle_3;
-    typedef typename Polyhedron::Traits::Segment_3 Segment_3;
+    typedef typename Polyhedron::Facet_handle Facet_handle;
     typedef typename Polyhedron::Halfedge_handle Halfedge_handle;
-    typedef typename Polyhedron::Vertex_handle Vertex_handle;
-    typedef typename Polyhedron::Halfedge_around_vertex_circulator Vertex_circulator;
-
-    Triangle_3 t(v->point(), v2->point(), v3->point());
+    typedef typename Polyhedron::Traits Polyhedron_traits;
+    typedef typename Polyhedron_traits::Triangle_3 Triangle_3;
+    typedef typename Polyhedron_traits::Point_3 Point_3;
+    typedef typename Polyhedron_traits::Segment_3 Segment_3;
 
-    std::cout << "Facets_intersect()" << std::endl;
-    std::cout << "--Vertex: " << v->point() << std::endl;
-    std::cout << "--Trial triangle: " << t[0] << ", " << t[1] << ", " << t[2] << std::endl;
-
-    dolfin_assert(v->point() == t[0] || v->point() == t[1] || v->point() == t[2]);
+    std::stringstream ss;
 
-    Vertex_circulator start = v->vertex_begin();
-    Vertex_circulator c = start;
+    std::vector<std::pair<Facet_handle, Facet_handle> > intersections;
+    CGAL::Polygon_mesh_processing::self_intersections(p, std::back_inserter(intersections));
 
-    do
+    for (const std::pair<Facet_handle, Facet_handle>& iit : intersections)
     {
-      Halfedge_handle current = c;
-      c++;
-      // std::cout << "  Checking" << std::endl;
-      if (!current->is_border())
-      {
-        dolfin_assert(current->facet()->is_triangle());
-
-        Triangle_3 t_current(current->vertex()->point(),
-                             current->next()->vertex()->point(),
-                             current->next()->next()->vertex()->point());
-        std::cout << "  Test triangle: " << t_current[0] << ", " << t_current[1] << ", " << t_current[2] << std::endl;
-
-        auto result = CGAL::intersection(t, t_current);
-
-        if (result)
-        {
-          if (const Point_3* p = boost::get<Point_3>(&*result))
-          {
-            dolfin_assert(*p == v->point());
-            std::cout << "  Vertex point" << std::endl;
-            std::cout << *p << std::endl;
-            continue;
-          }
-          else if (const Segment_3* s = boost::get<Segment_3>(&*result))
-          {
-            std::cout << "  Segment intersection" << std::endl;
+      ss << "Intersection (neighbors: " << (facets_are_neighbors<Polyhedron>(iit.first, iit.second) ? "Yes" : "No") << ")" << std::endl;
+      const Halfedge_handle h1 = iit.first->halfedge();
+      const Halfedge_handle h2 = iit.second->halfedge();
+      print_triangle<Polyhedron>(h1);
+      print_triangle<Polyhedron>(h2);
 
-            // Check that they share a halfedge
-            dolfin_assert(s->source() == v->point() || s->target() == v->point());
-            std::array<Vertex_handle, 3> v_facet{v, v2, v3};
-            std::array<Vertex_handle, 3> u_facet{current->vertex(), current->next()->vertex(), current->next()->next()->vertex()};
-
-            bool neighbors_detected = false;
-            for (std::size_t i = 0; i < 3; i++)
-            {
-              for (std::size_t j = 0; j < 3; j++)
-              {
-                if (v_facet[i] == u_facet[(j+1)%3] && v_facet[(i+1)%3] == u_facet[j])
-                {
-                  std::cout << "  Neighbors" << std::endl;
-                  neighbors_detected = true;
-                  break;
-                }
-              }
-            }
+      // Compute intersection
 
-            if (neighbors_detected)
-              continue;
-            /* if ( (s->source() == t_current[0] || s->source() == t_current[1] || s->source() == t_current[2]) && */
-            /*      (s->target() == t_current[0] || s->target() == t_current[1] || s->target() == t_current[2]) ) */
-            /* { */
-            /*   std::cout << "  Edge segment" << std::endl; */
-            /*   std::cout << s->source() << " " << s->target() << std::endl; */
-            /*   continue; */
-            /* } */
-          }
+      const Triangle_3 t1(h1->vertex()->point(),
+                          h1->next()->vertex()->point(),
+                          h1->next()->next()->vertex()->point());
 
+      const Triangle_3 t2(h2->vertex()->point(),
+                          h2->next()->vertex()->point(),
+                          h2->next()->next()->vertex()->point());
 
-          std::cout << "Facets intersect" << std::endl;
+      const auto result = CGAL::intersection(t1, t2);
 
-          if (const Point_3* p = boost::get<Point_3>(&*result))
-          {
-            std::cout << "    Intersection point: " << *p << std::endl;
-            return true;
-          }
-          else if (const Segment_3* s = boost::get<Segment_3>(&*result))
-          {
-            std::cout << "    Intersection segment: " << s->source() << ", " << s->target() << std::endl;
-            return true;
-          }
-          else if (const Triangle_3* tt = boost::get<Triangle_3>(&*result))
-          {
-            std::cout << "    Intersection triangle: " << (*tt)[0] << ", " << (*tt)[1] << ", " << (*tt)[2] << std::endl;
-          }
-          else if (const std::vector<Point_3>* v = boost::get<std::vector<Point_3> >(&*result))
-          {
-            std::cout << "    Intersection vector of points" << std::endl;
-          }
-          else
-          {
-            std::cout << "    Unknown intersection type" << std::endl;
-            return true;
-          }
-        }
+      dolfin_assert(result);
+      if (const Segment_3* s = boost::get<Segment_3>(&*result))
+      {
+        ss << "Segment: " << *s << std::endl;
+      }
+      else if (const Point_3* p = boost::get<Point_3>(&*result))
+      {
+        ss << "Point: " << *p << std::endl;
+      }
+      else if (const Triangle_3* t = boost::get<Triangle_3>(&*result))
+      {
+        ss << "Triangle: " << *t << std::endl;
+      }
+      else
+      {
+        ss << "Polygon" << std::endl;
       }
-
-
-    } while (c != start);
-
-    return false;
-  }
-  //-----------------------------------------------------------------------------
-  template<typename Polyhedron>
-  static std::string list_self_intersections(Polyhedron& p)
-  {
-    typedef typename Polyhedron::Facet_handle Facet_handle;
-    // typedef typename Polyhedron::Traits Polyhedron_traits;
-    std::vector<std::pair<Facet_handle, Facet_handle> > intersections;
-    CGAL::Polygon_mesh_processing::self_intersections(p, std::back_inserter(intersections));
-
-    std::stringstream ss;
-    for (auto iit = intersections.begin(); iit != intersections.end(); iit++)
-    {
-      ss << "Intersection (neighbors: " << (facets_are_neighbors<Polyhedron>(iit->first, iit->second) ? "Yes" : "No") << ")" << std::endl;
-      ss << print_triangle<Polyhedron>(iit->first->halfedge());
-      ss << print_triangle<Polyhedron>(iit->second->halfedge());
     }
 
     return ss.str();
@@ -2395,11 +2547,9 @@ class PolyhedronUtils
     std::vector<std::pair<Facet_handle, Facet_handle> > intersections;
     CGAL::Polygon_mesh_processing::self_intersections(P, std::back_inserter(intersections));
 
-    /* if (intersections.size() > 0) */
-    /*   std::cout << "Removing self intersections" << std::endl; */
-
     while (intersections.size() > 0)
     {
+      std::cout << "Removing self intersection (" << intersections.size() << ")" << std::endl;
       const typename Polyhedron::Facet_handle f1 = intersections.front().first;
       const typename Polyhedron::Facet_handle f2 = intersections.front().second;
 
@@ -2415,10 +2565,10 @@ class PolyhedronUtils
       std::set<Facet_handle> to_be_removed2;
       to_be_removed2.insert(f2);
 
-      while (true)
-      {
-        bool done = false;
+      bool f1_done = false;
 
+      while (!f1_done)
+      {
         // Pop from queue 1
         if (queue1.size() > 0)
         {
@@ -2430,12 +2580,13 @@ class PolyhedronUtils
 
           do
           {
-            // std::cout << "Spreading out" << std::endl;
+            std::cout << "Spreading out 1" << std::endl;
             if (!current->is_border_edge())
             {
-              if (to_be_removed2.count(current->opposite()->facet()) > 0)
+              //if (to_be_removed2.count(current->opposite()->facet()) > 0)
+              if (current->opposite()->facet() == f2)
               {
-                done = true;
+                f1_done = true;
                 break;
               }
               else
@@ -2448,13 +2599,14 @@ class PolyhedronUtils
         }
         else
         {
-          done = true;
+          f1_done = true;
         }
+      }
 
-        if (done)
-          break;
-
+      bool f2_done = false;
 
+      while (!f2_done)
+      {
         // Pop from queue 2
         if (queue2.size() > 0)
         {
@@ -2465,12 +2617,13 @@ class PolyhedronUtils
 
           do
           {
-            // std::cout << "Spreading out" << std::endl;
+            std::cout << "Spreading out 2" << std::endl;
             if (!current->is_border_edge())
             {
-              if (to_be_removed1.count(current->opposite()->facet()) > 0)
+              // if (to_be_removed1.count(current->opposite()->facet()) > 0)
+              if (current->opposite()->facet() == f1)
               {
-                done = true;
+                f2_done = true;
                 break;
               }
               else
@@ -2483,14 +2636,16 @@ class PolyhedronUtils
         }
         else
         {
-          done = true;
+          f2_done = true;
         }
-
-        if (done)
-          break;
       }
 
-      // std::cout << "To be removed 1: " << to_be_removed1.size() << std::endl;
+      std::cout << "To be removed 1: " << to_be_removed1.size() << std::endl;
+      std::cout << "To be removed 2: " << to_be_removed2.size() << std::endl;
+
+      to_be_removed1.insert(to_be_removed2.begin(),
+                            to_be_removed2.end());
+
       for (typename Polyhedron::Face_handle f : to_be_removed1)
       {
         P.erase_facet(f->halfedge());
@@ -2498,18 +2653,20 @@ class PolyhedronUtils
         removed++;
       }
 
-      // std::cout << "To be removed 2: " << to_be_removed2.size() << std::endl;
-      for (typename Polyhedron::Face_handle f : to_be_removed2)
-      {
-        P.erase_facet(f->halfedge());
-        dolfin_assert(P.is_valid());
-        removed++;
-      }
+
+      /* for (typename Polyhedron::Face_handle f : to_be_removed2) */
+      /* { */
+      /*   P.erase_facet(f->halfedge()); */
+      /*   dolfin_assert(P.is_valid()); */
+      /*   removed++; */
+      /* } */
 
       dolfin_assert(P.is_valid());
 
       intersections.clear();
-      //CGAL::self_intersect<Polyhedron_traits>(P, std::back_inserter(intersections));
+      CGAL::Polygon_mesh_processing::self_intersections(P, std::back_inserter(intersections));
+
+      break;
     }
 
     return removed;
diff --git a/src/STLFileReader.cpp b/src/STLFileReader.cpp
index b1f972c..3e124da 100644
--- a/src/STLFileReader.cpp
+++ b/src/STLFileReader.cpp
@@ -36,7 +36,7 @@
 #include <algorithm>
 #include <string>
 #include <map>
-
+#include <math.h> 
 namespace
 {
 inline double strToDouble(const std::string& s)
@@ -275,5 +275,61 @@ void STLFileReader::read(const std::string filename,
 
   // closest_vertices(vertex_map);
 }
+void STLFileReader::write(const std::string filename,
+                         std::vector<std::array<double, 3> >& vertices,
+                         std::vector<std::array<std::size_t, 3> >& facets)
+{
+
+    std::ofstream file(filename);
+    file.precision(6);
+
+    if (!file.is_open())
+    {
+       dolfin::dolfin_error("STLFileReader.cpp",
+                         "open file to write stl data",
+                         "Failed to open file");
+    }
+
+    file << "solid "<< filename << std::endl;
+    
+
+    
+    
+    for (const std::array<std::size_t, 3>& f : facets)
+    {
+
+       std::array<double,3> n;
+       float vec1x,vec1y,vec1z;
+       float vec2x,vec2y,vec2z;
+       float size;
+      
+       std::array<double, 3>& v0 = vertices[f[0]];
+       std::array<double, 3>& v1 = vertices[f[1]];
+       std::array<double, 3>& v2 = vertices[f[2]];
+       
+       vec1x = v1[0] - v0[0];
+       vec1y = v1[1] - v0[1];
+       vec1z = v1[2] - v0[2];
+
+       vec2x = v2[0] - v0[0];
+       vec2y = v2[1] - v0[1];
+       vec2z = v2[2] - v0[2];
+       
+       n[0] = vec1y*vec2z-vec1z*vec2y;
+       n[1] = vec1z*vec2x-vec1x*vec2z;
+       n[2] = vec1x*vec2y-vec1y*vec2x; 		
+       size = sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);
+
+       file << "facet normal " << n[0]/size << " " << n[1]/size  << " " << n[2]/size <<std::endl;
+       file << "outer loop"<< std::endl;
+       file << "\t" << "vertex " << v0[0] << " " << v0[1]<< " " << v0[2] << std::endl;
+       file << "\t" << "vertex " << v1[0] << " " << v1[1]<< " " << v1[2] << std::endl;
+       file << "\t" << "vertex " << v2[0] << " " << v2[1]<< " " << v2[2] << std::endl;
+       file <<"endloop" << std::endl;
+       file <<"endfacet"<< std::endl;
+    }
+    file << "endsolid"  << std::endl;
+
+}
 
 }
diff --git a/src/SurfaceConsistency.cpp b/src/SurfaceConsistency.cpp
index 50cebbb..4eb6974 100644
--- a/src/SurfaceConsistency.cpp
+++ b/src/SurfaceConsistency.cpp
@@ -6,12 +6,12 @@
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 3 of the License, or
 // (at your option) any later version.
-// 
+//
 // mshr is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with mshr.  If not, see <http://www.gnu.org/licenses/>.
 
@@ -125,7 +125,7 @@ void SurfaceConsistency::filterFacets(const std::vector<std::array<std::size_t,
       edge_map[e] = i;
       prev = *vit;
     }
-    
+
     skip.insert(i);
   }
 
@@ -265,7 +265,7 @@ void SurfaceConsistency::orient_component(std::vector<std::array<std::size_t, 3>
     {
       counter++;
       visited.insert(current);
-      
+
       for (std::size_t j = 0; j < 3; j++)
       {
         auto edge = std::make_pair(std::min(current_facet[j], current_facet[(j+1)%3]), std::max(current_facet[j], current_facet[(j+1)%3]));
@@ -277,7 +277,7 @@ void SurfaceConsistency::orient_component(std::vector<std::array<std::size_t, 3>
         if (opposite != std::numeric_limits<std::size_t>::max() && visited.count(opposite) == 0)
         {
           dolfin_assert(opposite != current);
-          
+
           std::array<std::size_t, 3>& opposite_facet = facets[opposite];
           for (std::size_t k = 0; k < 3; k++)
           {
@@ -299,5 +299,65 @@ void SurfaceConsistency::orient_component(std::vector<std::array<std::size_t, 3>
   }
   log(dolfin::TRACE, "Flipped %u triangles", flipped);
 }
+
+std::size_t SurfaceConsistency::remove_null_facets(std::vector<std::array<std::size_t, 3>>& facets)
+{
+  std::size_t counter = 0;
+
+  std::vector<std::array<std::size_t, 3>>::iterator it = facets.begin();
+
+  while (it != facets.end())
+  {
+    const std::array<std::size_t, 3>& f = *it;
+    if (f[0] == f[1] || f[0] == f[2] || f[1] == f[2])
+    {
+      *it = facets.back();
+      facets.pop_back();
+      counter++;
+    }
+    else
+      it++;
+  }
+
+  return counter;
 }
 
+std::size_t SurfaceConsistency::remove_isolated_vertices(std::vector<std::array<double, 3>>& vertices,
+                                                         std::vector<std::array<std::size_t, 3>>& facets)
+{
+  std::size_t counter = 0;
+  std::vector<bool> is_connected(vertices.size());
+  std::fill(is_connected.begin(), is_connected.end(), false);
+  for (const std::array<std::size_t, 3>& f : facets)
+  {
+    is_connected[f[0]] = true;
+    is_connected[f[1]] = true;
+    is_connected[f[2]] = true;
+  }
+
+  for (std::size_t i_ = 0; i_ < is_connected.size(); i_++)
+  {
+    // Need to do this in reverse order, so the vertices with higher index is
+    // processed first to avoid invalidating the
+    const std::size_t i = is_connected.size()-i_-1;
+
+    if (!is_connected[i])
+    {
+      vertices.erase(vertices.begin()+i);
+
+      for (std::array<std::size_t, 3>& f : facets)
+      {
+        if (f[0] > i) f[0]--;
+        if (f[1] > i) f[1]--;
+        if (f[2] > i) f[2]--;
+      }
+
+      counter++;
+    }
+  }
+
+  return counter;
+}
+
+
+}
diff --git a/src/SurfaceReconstruction.cpp b/src/SurfaceReconstruction.cpp
index 977c772..eb02257 100644
--- a/src/SurfaceReconstruction.cpp
+++ b/src/SurfaceReconstruction.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015 Benjamin Kehlet
+// Copyright (C) 2015-2016 Benjamin Kehlet
 //
 // This file is part of mshr.
 //
@@ -18,22 +18,23 @@
 
 #include <mshr/SurfaceReconstruction.h>
 #include <dolfin/log/log.h>
+#include <dolfin/common/constants.h>
 
+#define CGAL_HEADER_ONLY 1
 #define CGAL_EIGEN3_ENABLED true
 #include <CGAL/trace.h>
 #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-#include <CGAL/Polyhedron_3.h>
-#include <CGAL/IO/Polyhedron_iostream.h>
 #include <CGAL/Surface_mesh_default_triangulation_3.h>
 #include <CGAL/make_surface_mesh.h>
 #include <CGAL/Implicit_surface_3.h>
-#include <CGAL/IO/output_surface_facets_to_polyhedron.h>
 #include <CGAL/Poisson_reconstruction_function.h>
 #include <CGAL/Point_with_normal_3.h>
 #include <CGAL/property_map.h>
-#include <CGAL/IO/read_xyz_points.h>
 #include <CGAL/compute_average_spacing.h>
 
+#include <CGAL/Surface_mesh.h>
+#include <CGAL/Polygon_mesh_processing/remesh.h>
+
 // Based on CGAL/Surface_reconstruction_points_3/poisson_reconstruction_example.cpp
 typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
 typedef Kernel::FT FT;
@@ -42,7 +43,6 @@ typedef Kernel::Vector_3 Vector;
 typedef CGAL::Point_with_normal_3<Kernel> Point_with_normal;
 typedef Kernel::Sphere_3 Sphere;
 typedef std::vector<Point_with_normal> PointList;
-typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
 typedef CGAL::Poisson_reconstruction_function<Kernel> Poisson_reconstruction_function;
 typedef CGAL::Surface_mesh_default_triangulation_3 STr;
 typedef CGAL::Surface_mesh_complex_2_in_triangulation_3<STr> C2t3;
@@ -177,11 +177,15 @@ void export_triangulation(const C2t3& c2t3,
   }
 }
 }
+
+namespace mshr
+{
 //-----------------------------------------------------------------------------
 void mshr::SurfaceReconstruction::reconstruct(const std::vector<double>& vertices,
                                               const std::vector<std::size_t>& facets,
                                               std::vector<std::array<double, 3>>& reconstructed_vertices,
-                                              std::vector<std::array<std::size_t, 3>>& reconstructed_facets)
+                                              std::vector<std::array<std::size_t, 3>>& reconstructed_facets,
+                                              double expansion)
 {
   // Poisson options
   FT sm_angle = 20.0; // Min triangle angle in degrees.
@@ -202,8 +206,10 @@ void mshr::SurfaceReconstruction::reconstruct(const std::vector<double>& vertice
     // compute normal
     const Vector normal = CGAL::cross_product(b-a, c-a);
     const Point centroid = CGAL::ORIGIN + ((a-CGAL::ORIGIN)+(b-CGAL::ORIGIN)+(c-CGAL::ORIGIN))/3.0;
-    Point_with_normal pm( centroid,
-                          normal/std::sqrt(normal.squared_length()));
+    const Vector normal_normalized = normal/std::sqrt(normal.squared_length());
+    Point_with_normal pm( centroid + normal_normalized*expansion,
+                          normal_normalized );
+
     points.push_back(pm);
   }
 
@@ -261,4 +267,105 @@ void mshr::SurfaceReconstruction::reconstruct(const std::vector<double>& vertice
                        reconstructed_vertices,
                        reconstructed_facets);
 }
+  //-----------------------------------------------------------------------------
+void SurfaceReconstruction::remesh(double edge_length,
+                                   double sharp_edge_tolerance,
+                                   const std::vector<double>& vertices,
+                                   const std::vector<std::size_t>& facets,
+                                   std::vector<std::array<double, 3>>& remeshed_vertices,
+                                   std::vector<std::array<std::size_t, 3>>& remeshed_facets)
+{
+  typedef CGAL::Surface_mesh<Point> Surface_mesh;
+  typedef Surface_mesh::Vertex_index Vertex_index;
+  typedef Surface_mesh::Face_index Face_index;
+  typedef Surface_mesh::Edge_index Edge_index;
+  typedef Surface_mesh::Halfedge_index Halfedge_index;
+  typedef boost::graph_traits<Surface_mesh>::face_descriptor face_descriptor;
+  typedef boost::graph_traits<Surface_mesh>::edge_descriptor edge_descriptor;
+
+  namespace Parameters = CGAL::Polygon_mesh_processing::parameters;
+
+  Surface_mesh m;
+  std::vector<Vertex_index> v_index_mapping;
+  v_index_mapping.reserve(vertices.size());
+  for (std::size_t i = 0; i < vertices.size(); i += 3)
+  {
+    v_index_mapping.push_back(m.add_vertex(Point(vertices[i], vertices[i+1], vertices[i+2])));
+  }
+
+  for (std::size_t i = 0; i < facets.size(); i += 3)
+  {
+    m.add_face(v_index_mapping[facets[i]],
+               v_index_mapping[facets[i+1]],
+               v_index_mapping[facets[i+2]]);
+  }
+
+  // Collect edges that should be protected during remeshing
+  const double cos_tolerance = cos(2*DOLFIN_PI*sharp_edge_tolerance/360);
+
+  Surface_mesh::Property_map<edge_descriptor, bool> edge_constrained_map =
+    m.add_property_map<edge_descriptor, bool>("e:is_constrained", false).first;
+
+  std::size_t num_protected = 0;
+  if (sharp_edge_tolerance > 0)
+  {
+    Surface_mesh::Property_map<face_descriptor, Vector> fnormals =
+      m.add_property_map<face_descriptor, Vector>("f:normals", CGAL::NULL_VECTOR).first;
+
+    CGAL::Polygon_mesh_processing::compute_face_normals(m, fnormals);
+
+    for (Edge_index e : m.edges())
+    {
+      Halfedge_index h = e.halfedge();
+      Face_index f1 = m.face(h);
+      Face_index f2 = m.face(m.opposite(h));
+      const Vector& n1 = fnormals[f1];
+      const Vector& n2 = fnormals[f2];
+
+      if (n1*n2 < cos_tolerance)
+      {
+        edge_constrained_map[e] = true;
+        num_protected++;
+      }
+    }
+
+    m.remove_property_map(fnormals);
+
+    dolfin::log(dolfin::TRACE,
+                "Number of protected edges: %u", num_protected);
+  }
+
+  // Remeshing
+  CGAL::Polygon_mesh_processing::isotropic_remeshing(faces(m),
+                                                     edge_length,
+                                                     m,
+                                                     Parameters::edge_is_constrained_map(edge_constrained_map)
+    );
+
+  remeshed_vertices.clear();
+  remeshed_facets.clear();
+
+  std::vector<std::size_t> vertex_index_mapping;
+  vertex_index_mapping.resize(m.num_vertices());
+  int i = 0;
+  for(Vertex_index vd : m.vertices())
+  {
+    const Point& p = m.point(vd);
+    remeshed_vertices.push_back({{CGAL::to_double(p[0]), CGAL::to_double(p[1]), CGAL::to_double(p[2])}});
+    vertex_index_mapping[vd] = i;
+    i++;
+  }
+
+  for (Face_index f : m.faces())
+  {
+    const Halfedge_index h = m.halfedge(f);
+    const Halfedge_index h_next = m.next(h);
+    const Halfedge_index h_next_next = m.next(h_next);
+
+    remeshed_facets.push_back({{vertex_index_mapping[m.source(h)],
+                                vertex_index_mapping[m.source(h_next)],
+                                vertex_index_mapping[m.source(h_next_next)]}});
+  }
+}
 
+} // end namespace mshr
diff --git a/src/TetgenMeshGenerator3D.cpp b/src/TetgenMeshGenerator3D.cpp
index b685d5f..227a42a 100644
--- a/src/TetgenMeshGenerator3D.cpp
+++ b/src/TetgenMeshGenerator3D.cpp
@@ -20,11 +20,13 @@
 
 #include <dolfin/mesh/Mesh.h>
 #include <dolfin/mesh/MeshEditor.h>
-#include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/MeshPartitioning.h>
 #include <dolfin/log/log.h>
+
 #include <tetgen.h>
 
 // Bounding sphere computation
+#define CGAL_HEADER_ONLY 1
 #include <CGAL/Cartesian.h>
 #include <CGAL/Min_sphere_of_spheres_d.h>
 #include <CGAL/Min_sphere_of_spheres_d_traits_3.h>
@@ -158,13 +160,10 @@ TetgenMeshGenerator3D::generate(std::shared_ptr<const CSGCGALDomain3D> domain) c
   }
 
   // Mark holes in the domain
-  // TODO: Check if there are more than one disconnected part
-  // before creating the query structure.
   {
     dolfin::log(dolfin::TRACE, "Marking holes");
     std::vector<dolfin::Point> holes;
-    std::shared_ptr<CSGCGALDomain3DQueryStructure> qs = domain->get_query_structure();
-    domain->get_points_in_holes(holes, qs);
+    domain->get_points_in_holes(holes);
 
     in.numberofholes = holes.size();
     in.holelist = new REAL[in.numberofholes*3];
@@ -239,6 +238,10 @@ TetgenMeshGenerator3D::generate(std::shared_ptr<const CSGCGALDomain3D> domain) c
 
   std::shared_ptr<dolfin::Mesh> mesh(new dolfin::Mesh());
   build_dolfin_mesh(out, *mesh);
+
+  // Distribute the mesh (if in parallel)
+  dolfin::MeshPartitioning::build_distributed_mesh(*mesh);
+
   return mesh;
 }
 //-----------------------------------------------------------------------------
diff --git a/src/VTPFileReader.cpp b/src/VTPFileReader.cpp
index 68bc902..98edffc 100644
--- a/src/VTPFileReader.cpp
+++ b/src/VTPFileReader.cpp
@@ -6,29 +6,32 @@
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 3 of the License, or
 // (at your option) any later version.
-// 
+//
 // mshr is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with mshr.  If not, see <http://www.gnu.org/licenses/>.
 
-
 #include <mshr/VTPFileReader.h>
 #include <dolfin/log/log.h>
 
 #ifdef MSHR_HAS_VTK
 #include <vtkXMLPolyDataReader.h>
+#include <vtkXMLPolyDataWriter.h>
+#include <vtkSmartPointer.h>
 #include <vtkPolyData.h>
 #include <vtkCellArray.h>
+#include <vtkTriangle.h>
+#include <vtkPoints.h>
 #endif
 
 
 namespace mshr
 {
-void VTPFileReader::read(const std::string filename, 
+void VTPFileReader::read(const std::string filename,
                          std::vector<std::array<double, 3> >& vertices,
                          std::vector<std::array<std::size_t, 3> >& facets)
 {
@@ -39,7 +42,7 @@ void VTPFileReader::read(const std::string filename,
   reader->SetFileName(filename.c_str());
   reader->Update();
   vtkPolyData* polydata = reader->GetOutput();
- 
+
   //get the number of points the file contains
   const vtkIdType num_points = polydata->GetNumberOfPoints();
   vertices.resize(num_points);
@@ -52,12 +55,12 @@ void VTPFileReader::read(const std::string filename,
 
   const vtkIdType num_polys = polydata->GetNumberOfPolys();
   facets.resize(num_polys);
- 
+
   vtkCellArray* TriangleCells = polydata->GetPolys();
   vtkIdType npts;
   vtkIdType *pts;
   vtkIdType facet_counter = 0;
- 
+
   while(TriangleCells->GetNextCell(npts, pts))
   {
     dolfin_assert(npts == 3);
@@ -75,8 +78,50 @@ void VTPFileReader::read(const std::string filename,
 dolfin::dolfin_error("VTPFileReader.cpp",
                      "reading VTP file",
                      "mshr is not built with VTK support");
-
 #endif
 
 }
+void VTPFileReader::write(const std::string filename,
+                          const std::vector<std::array<double, 3> >& vertices,
+                          const std::vector<std::array<std::size_t, 3> >& facets)
+{
+  #ifdef MSHR_HAS_VTK
+    vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
+    vtkSmartPointer<vtkCellArray> triangles = vtkSmartPointer<vtkCellArray>::New();
+
+    for (const std::array<double, 3>& v : vertices)
+    {
+       points->InsertNextPoint( v[0],v[1] ,v[2] );
+    }
+
+    for (const std::array<std::size_t, 3>& f : facets)
+    {
+      vtkSmartPointer<vtkTriangle> triangle = vtkSmartPointer<vtkTriangle>::New();
+      triangle->GetPointIds()->SetId(0,f[0]);
+      triangle->GetPointIds()->SetId(1,f[1]);
+      triangle->GetPointIds()->SetId(2,f[2]);
+      triangles->InsertNextCell(triangle);
+    }
+
+    vtkSmartPointer<vtkPolyData> polydata = vtkSmartPointer<vtkPolyData>::New();
+    polydata->SetPoints(points);
+    polydata->SetPolys(triangles);
+
+    vtkXMLPolyDataWriter* writer = vtkXMLPolyDataWriter::New();
+    writer->SetFileName(filename.c_str());
+
+    #if VTK_MAJOR_VERSION <= 5
+      writer->SetInput(polydata);
+    #else
+      writer->SetInputData(polydata);
+    #endif
+
+    writer->Write();
+  #else
+    dolfin::dolfin_error("VTPFileReader.cpp",
+                         "writing VTP file",
+                         "mshr is not built with VTK support");
+  #endif
 }
+
+} // end namespace mshr
diff --git a/src/meshclean.h b/src/meshclean.h
index da7310f..7ca75e3 100644
--- a/src/meshclean.h
+++ b/src/meshclean.h
@@ -328,23 +328,24 @@ inline bool remove_degree3_with_short_edges(Polyhedron& p,
 {
   bool removed = false;
 
-  for (typename Polyhedron::Vertex_iterator it = p.vertices_begin();
-       it != p.vertices_end(); it++)
+  typename Polyhedron::Vertex_iterator vit = p.vertices_begin();
+  typename Polyhedron::Vertex_iterator vertex_end = p.vertices_end();
+  while (vit != vertex_end)
   {
-    if (it->vertex_degree() < 4)
-    {
-      if (!it->is_trivalent())
-        std::cout << "Strange! Degree: " << it->vertex_degree() << std::endl;
-      dolfin_assert(it->is_trivalent());
+    // iterator is invalid if we remove the vertex, so copy and advance now
+    typename Polyhedron::Vertex_handle v = vit;
+    vit++;
+
+    if (v->vertex_degree() < 3)
+      log(dolfin::DBG, "Vertex with degree less than 3 detected");
 
-      typename Polyhedron::Halfedge_handle h = it->halfedge();
+    if (v->is_trivalent())
+    {
+      typename Polyhedron::Halfedge_handle h = v->halfedge();
       if (get_edge_length<Polyhedron>(h) < tol_sq ||
           get_edge_length<Polyhedron>(h->next()) < tol_sq ||
           get_edge_length<Polyhedron>(h->prev()) < tol_sq)
       {
-
-        // std::cout << "Removing degree 3 with short edges" << std::endl;
-
         p.erase_center_vertex(h);
         removed = true;
       }
@@ -539,7 +540,7 @@ bool remove_degenerate(Polyhedron &p, double tolerance)
 
   const bool edges_removed = remove_degree3_with_short_edges(p, tol_sq);
   if (edges_removed)
-    std::cout << "Remove degree 3 vertices" << std::endl;
+    log(dolfin::TRACE, "Remove degree 3 vertices");
 
   ASSERT_GOOD_STATE(p);
 
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index cc1d2b3..633a021 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -26,47 +26,50 @@ set(PYTHON_ENVIR "${CMAKE_BINARY_DIR}/swig:$ENV{PYTHONPATH};DOLFIN_NOPLOT=True")
 
 
 ############# A python program that just imports dolfin and mshr ##############################
-add_test("Python-DummyImport" "python" "${CMAKE_SOURCE_DIR}/test/dummy.py")
+add_test("Python-DummyImport" "${PYTHON_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/test/dummy.py")
 set_property(TEST "Python-DummyImport" PROPERTY
     ENVIRONMENT "PYTHONPATH=${PYTHON_ENVIR}"
 )
 
 ############# A union which is particularly prone to roundoff errors ##########################
-add_test("Python-DegenerateRemoval" "python" "${CMAKE_SOURCE_DIR}/test/degenerate_removal.py")
+add_test("Python-DegenerateRemoval" "${PYTHON_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/test/degenerate_removal.py")
 set_property(TEST "Python-DegenerateRemoval" PROPERTY
     ENVIRONMENT "PYTHONPATH=${PYTHON_ENVIR}"
 )
 
 ############# Test the csg operators ##########################################################
-add_test("Python-CSGOperators" "python" "${CMAKE_SOURCE_DIR}/test/test-csg.py")
+add_test("Python-CSGOperators" "${PYTHON_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/test/test-csg.py")
 set_property(TEST "Python-CSGOperators" PROPERTY
     ENVIRONMENT "PYTHONPATH=${PYTHON_ENVIR}"
 )
 
 ############# Test the fuzzy point map ########################################################
-add_test("Python-FuzzyPointMap" "python" "${CMAKE_SOURCE_DIR}/test/test-fuzzypointmap.py")
+add_test("Python-FuzzyPointMap" "${PYTHON_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/test/test-fuzzypointmap.py")
 set_property(TEST "Python-FuzzyPointMap" PROPERTY
     ENVIRONMENT "PYTHONPATH=${PYTHON_ENVIR}"
 )
 
 ############# Test the mesh generation ########################################################
-add_test("Python-MeshGeneration" "python" "${CMAKE_SOURCE_DIR}/test/test-mesh-generation.py")
+add_test("Python-MeshGeneration" "${PYTHON_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/test/test-mesh-generation.py")
 set_property(TEST "Python-MeshGeneration" PROPERTY
     ENVIRONMENT "PYTHONPATH=${PYTHON_ENVIR}"
 )
 
 ############# Test the predefined meshes ##########################################################
-add_test("Python-Meshes" "python" "${CMAKE_SOURCE_DIR}/test/test-meshes.py")
+add_test("Python-Meshes" "${PYTHON_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/test/test-meshes.py")
 set_property(TEST "Python-Meshes" PROPERTY
     ENVIRONMENT "PYTHONPATH=${PYTHON_ENVIR}"
 )
-
-
+############# Test the ASCFileReader ##########################################################
+add_test("Python-ASCFileReader" "${PYTHON_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/test/test-ASCFileReader.py")
+set_property(TEST "Python-ASCFileReader" PROPERTY
+    ENVIRONMENT "PYTHONPATH=${PYTHON_ENVIR}"
+)
 
 
 ############# Try meshing some surface files found in the cgal source ########################
 # TODO: Print mesh quality measure from program and check the value
-set(CGAL_DATA_DIR "${CMAKE_SOURCE_DIR}/3rdparty/CGAL-4.8/demo/Polyhedron/data")
+set(CGAL_DATA_DIR "${CMAKE_SOURCE_DIR}/3rdparty/CGAL/demo/Polyhedron/data")
 
 # Files that should pass
 # Note elephant.off is valid a should passes but takes a very long (so test slave may time out)
@@ -85,7 +88,7 @@ endforeach(CURRENT_DATA_FILE)
 ############ Run the demos as regression test ################################################
 file(GLOB PYTHONDEMOS "${CMAKE_SOURCE_DIR}/demo/python/*.py")
 foreach(CURRENT_DEMO IN LISTS PYTHONDEMOS)
-  add_test("PythonDemo-${CURRENT_DEMO}" "python" "${CURRENT_DEMO}")
+  add_test("PythonDemo-${CURRENT_DEMO}" "${PYTHON_EXECUTABLE}" "${CURRENT_DEMO}")
   set_property(TEST "PythonDemo-${CURRENT_DEMO}" PROPERTY
     ENVIRONMENT "PYTHONPATH=${PYTHON_ENVIR}"
   )
diff --git a/test/test-ASCFileReader.py b/test/test-ASCFileReader.py
new file mode 100644
index 0000000..5d081da
--- /dev/null
+++ b/test/test-ASCFileReader.py
@@ -0,0 +1,23 @@
+from dolfin import *
+from mshr import *
+
+import os
+import tempfile
+
+def save_surface(filename) :
+        geometry = Sphere(Point(0.0,0.0,0.0),10.)
+        domain = CSGCGALDomain3D(geometry)
+        domain.save(filename)
+
+def load_surface(filename) :
+        surf  = Surface3D(filename)
+        domain = CSGCGALDomain3D(surf)
+        mesh = generate_mesh(domain, 10)
+
+fd, temp_path = tempfile.mkstemp(suffix='.asc')
+
+save_surface(temp_path)
+load_surface(temp_path)
+
+os.close(fd)
+os.remove(temp_path)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/fenics/mshr.git



More information about the debian-science-commits mailing list